From: Cris Di Sclafani Date: Fri, 30 Oct 2020 10:38:24 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.4 X-Git-Url: http://repos.xcallymotion.com/base//%22angular-material.themes.css/%22?a=commitdiff_plain;h=95045fe15537fe7c325f7493ac4c3f72044cff9b;p=motion2.git Built motion from commit (unavailable).|2.5.4 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 277db11..deae4cc 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.4", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2020-10-30T10:30:02.510Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 69a762b..56de421 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "xCALLY Motion API", "version": "2.5.4", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2020-10-30T10:30:02.510Z", "url": "http://apidocjs.com", "version": "0.19.0" } } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 8715048..50d58b6 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 _0x058a=['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','action','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x058a,0x1d8));var _0xa058=function(_0x142ba1,_0x5a6ef1){_0x142ba1=_0x142ba1-0x0;var _0xd00583=_0x058a[_0x142ba1];return _0xd00583;};'use strict';var Sequelize=require(_0xa058('0x0'));module[_0xa058('0x1')]={'name':{'type':Sequelize[_0xa058('0x2')],'get':function(_0x468d05){return this['getDataValue'](_0xa058('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xa058('0x4'),_0xa058('0x5'),_0xa058('0x6'),_0xa058('0x7'),_0xa058('0x8'),_0xa058('0x9'),_0xa058('0xa'),_0xa058('0xb')]],'msg':_0xa058('0xc')}},'comment':_0xa058('0xc')},'data1':{'type':Sequelize[_0xa058('0xd')](0x1000),'comment':_0xa058('0xe')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xa058('0xf')},'data3':{'type':Sequelize[_0xa058('0xd')](0x1000),'comment':_0xa058('0x10')},'data4':{'type':Sequelize[_0xa058('0xd')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0xa058('0xd')]},'data7':{'type':Sequelize[_0xa058('0x11')]}}; \ No newline at end of file +var _0x8c65=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot'];(function(_0x2063ac,_0x5dcbf1){var _0x113a8d=function(_0x1b7a82){while(--_0x1b7a82){_0x2063ac['push'](_0x2063ac['shift']());}};_0x113a8d(++_0x5dcbf1);}(_0x8c65,0x94));var _0x58c6=function(_0x238b75,_0x185e8d){_0x238b75=_0x238b75-0x0;var _0x7b0fe4=_0x8c65[_0x238b75];return _0x7b0fe4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x180683){return this['getDataValue']('action');}},'action':{'type':Sequelize[_0x58c6('0x0')],'allowNull':![],'validate':{'isIn':{'args':[[_0x58c6('0x1'),_0x58c6('0x2'),_0x58c6('0x3'),_0x58c6('0x4'),_0x58c6('0x5'),_0x58c6('0x6'),_0x58c6('0x7'),'script']],'msg':_0x58c6('0x8')}},'comment':_0x58c6('0x8')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x58c6('0x9')},'data3':{'type':Sequelize[_0x58c6('0x0')](0x1000),'comment':_0x58c6('0xa')},'data4':{'type':Sequelize[_0x58c6('0x0')](0x1000)},'data5':{'type':Sequelize[_0x58c6('0x0')](0x1000)},'data6':{'type':Sequelize[_0x58c6('0x0')]},'data7':{'type':Sequelize[_0x58c6('0xb')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index d3a9c95..3054bc4 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 _0x44dd=['find','params','body','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','error','name','send','Action'];(function(_0x339ce4,_0x214d4c){var _0x12efc1=function(_0x25706c){while(--_0x25706c){_0x339ce4['push'](_0x339ce4['shift']());}};_0x12efc1(++_0x214d4c);}(_0x44dd,0x1e8));var _0xd44d=function(_0x39df26,_0x30c4fa){_0x39df26=_0x39df26-0x0;var _0x2fcdfc=_0x44dd[_0x39df26];return _0x2fcdfc;};'use strict';var pdf=require(_0xd44d('0x0'));var emlformat=require(_0xd44d('0x1'));var rimraf=require(_0xd44d('0x2'));var zipdir=require(_0xd44d('0x3'));var jsonpatch=require(_0xd44d('0x4'));var rp=require(_0xd44d('0x5'));var moment=require(_0xd44d('0x6'));var BPromise=require(_0xd44d('0x7'));var Mustache=require('mustache');var util=require(_0xd44d('0x8'));var path=require('path');var sox=require(_0xd44d('0x9'));var csv=require(_0xd44d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd44d('0xb'));var crypto=require('crypto');var jsforce=require(_0xd44d('0xc'));var deskjs=require(_0xd44d('0xd'));var toCsv=require(_0xd44d('0xa'));var querystring=require(_0xd44d('0xe'));var Papa=require('papaparse');var Redis=require(_0xd44d('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd44d('0x10'));var hardwareService=require(_0xd44d('0x11'));var logger=require(_0xd44d('0x12'))(_0xd44d('0x13'));var utils=require(_0xd44d('0x14'));var config=require(_0xd44d('0x15'));var db=require(_0xd44d('0x16'))['db'];function respondWithStatusCode(_0x1ae3f1,_0x512c1f){_0x512c1f=_0x512c1f||0xcc;return function(_0x4291b8){if(_0x4291b8){return _0x1ae3f1[_0xd44d('0x17')](_0x512c1f);}return _0x1ae3f1[_0xd44d('0x18')](_0x512c1f)[_0xd44d('0x19')]();};}function respondWithResult(_0xbf31cd,_0x50f939){_0x50f939=_0x50f939||0xc8;return function(_0x539eb1){if(_0x539eb1){return _0xbf31cd[_0xd44d('0x18')](_0x50f939)[_0xd44d('0x1a')](_0x539eb1);}};}function respondWithFilteredResult(_0x332b9f,_0x3e6f89){return function(_0x2bc45c){if(_0x2bc45c){var _0x3ed187=_0x2bc45c[_0xd44d('0x1b')],_0x21b634=_0x3e6f89['offset'],_0x57fbbb=_0x3e6f89[_0xd44d('0x1c')]+_0x3e6f89[_0xd44d('0x1d')],_0x3389f5;if(_0x57fbbb>=_0x3ed187){_0x57fbbb=_0x3ed187;_0x3389f5=0xc8;}else{_0x3389f5=0xce;}_0x332b9f[_0xd44d('0x18')](_0x3389f5);return _0x332b9f[_0xd44d('0x1e')]('Content-Range',_0x21b634+'-'+_0x57fbbb+'/'+_0x3ed187)[_0xd44d('0x1a')](_0x2bc45c);}return null;};}function patchUpdates(_0x4f497a){return function(_0x31fa4e){try{jsonpatch['apply'](_0x31fa4e,_0x4f497a,!![]);}catch(_0x4e6aea){return BPromise[_0xd44d('0x1f')](_0x4e6aea);}return _0x31fa4e[_0xd44d('0x20')]();};}function saveUpdates(_0x2f7a3c,_0x33de9b){return function(_0x273d5f){if(_0x273d5f){return _0x273d5f[_0xd44d('0x21')](_0x2f7a3c)[_0xd44d('0x22')](function(_0xf2ac6d){return _0xf2ac6d;});}return null;};}function removeEntity(_0x535c81,_0x580e1c){return function(_0x28c4ff){if(_0x28c4ff){return _0x28c4ff[_0xd44d('0x23')]()[_0xd44d('0x22')](function(){_0x535c81[_0xd44d('0x18')](0xcc)[_0xd44d('0x19')]();});}};}function handleEntityNotFound(_0x4bd6cc,_0x574c00){return function(_0x59ea34){if(!_0x59ea34){_0x4bd6cc[_0xd44d('0x17')](0x194);}return _0x59ea34;};}function handleError(_0x382e52,_0x3b4ea8){_0x3b4ea8=_0x3b4ea8||0x1f4;return function(_0x123573){logger[_0xd44d('0x24')](_0x123573['stack']);if(_0x123573[_0xd44d('0x25')]){delete _0x123573[_0xd44d('0x25')];}_0x382e52[_0xd44d('0x18')](_0x3b4ea8)[_0xd44d('0x26')](_0x123573);};}exports[_0xd44d('0x21')]=function(_0x3147d7,_0x494bda){if(_0x3147d7['body']['id']){delete _0x3147d7['body']['id'];}return db[_0xd44d('0x27')][_0xd44d('0x28')]({'where':{'id':_0x3147d7[_0xd44d('0x29')]['id']}})['then'](handleEntityNotFound(_0x494bda,null))[_0xd44d('0x22')](saveUpdates(_0x3147d7[_0xd44d('0x2a')],null))[_0xd44d('0x22')](respondWithResult(_0x494bda,null))[_0xd44d('0x2b')](handleError(_0x494bda,null));};exports[_0xd44d('0x23')]=function(_0x179ce6,_0x341050){return db['Action'][_0xd44d('0x28')]({'where':{'id':_0x179ce6[_0xd44d('0x29')]['id']}})[_0xd44d('0x22')](handleEntityNotFound(_0x341050,null))['then'](removeEntity(_0x341050,null))[_0xd44d('0x2b')](handleError(_0x341050,null));}; \ No newline at end of file +var _0x28a1=['params','then','destroy','catch','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','save','error','stack','name','update','body','Action','find'];(function(_0x52ffc8,_0x60f852){var _0x55204a=function(_0x80181c){while(--_0x80181c){_0x52ffc8['push'](_0x52ffc8['shift']());}};_0x55204a(++_0x60f852);}(_0x28a1,0xb4));var _0x128a=function(_0x42bb6d,_0x412255){_0x42bb6d=_0x42bb6d-0x0;var _0x1db89b=_0x28a1[_0x42bb6d];return _0x1db89b;};'use strict';var pdf=require(_0x128a('0x0'));var emlformat=require(_0x128a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x128a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x128a('0x3'));var moment=require(_0x128a('0x4'));var BPromise=require(_0x128a('0x5'));var Mustache=require('mustache');var util=require(_0x128a('0x6'));var path=require(_0x128a('0x7'));var sox=require(_0x128a('0x8'));var csv=require(_0x128a('0x9'));var ejs=require(_0x128a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x128a('0xb'));var jsforce=require(_0x128a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x128a('0xd'));var Papa=require(_0x128a('0xe'));var Redis=require(_0x128a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x128a('0x10'));var hardwareService=require(_0x128a('0x11'));var logger=require(_0x128a('0x12'))(_0x128a('0x13'));var utils=require(_0x128a('0x14'));var config=require(_0x128a('0x15'));var db=require(_0x128a('0x16'))['db'];function respondWithStatusCode(_0x300663,_0x4e84ec){_0x4e84ec=_0x4e84ec||0xcc;return function(_0x30a7c0){if(_0x30a7c0){return _0x300663[_0x128a('0x17')](_0x4e84ec);}return _0x300663[_0x128a('0x18')](_0x4e84ec)[_0x128a('0x19')]();};}function respondWithResult(_0x37464d,_0x499123){_0x499123=_0x499123||0xc8;return function(_0x580c48){if(_0x580c48){return _0x37464d[_0x128a('0x18')](_0x499123)['json'](_0x580c48);}};}function respondWithFilteredResult(_0x179c73,_0x34490d){return function(_0x19c838){if(_0x19c838){var _0x275162=_0x19c838[_0x128a('0x1a')],_0x54cfc1=_0x34490d[_0x128a('0x1b')],_0x553657=_0x34490d['offset']+_0x34490d[_0x128a('0x1c')],_0x1a6c4a;if(_0x553657>=_0x275162){_0x553657=_0x275162;_0x1a6c4a=0xc8;}else{_0x1a6c4a=0xce;}_0x179c73['status'](_0x1a6c4a);return _0x179c73['set'](_0x128a('0x1d'),_0x54cfc1+'-'+_0x553657+'/'+_0x275162)[_0x128a('0x1e')](_0x19c838);}return null;};}function patchUpdates(_0x13ff63){return function(_0x7749dc){try{jsonpatch['apply'](_0x7749dc,_0x13ff63,!![]);}catch(_0x2cb406){return BPromise[_0x128a('0x1f')](_0x2cb406);}return _0x7749dc[_0x128a('0x20')]();};}function saveUpdates(_0x6cbaea,_0x46bb68){return function(_0x2c1a6a){if(_0x2c1a6a){return _0x2c1a6a['update'](_0x6cbaea)['then'](function(_0xc8aac7){return _0xc8aac7;});}return null;};}function removeEntity(_0x3393ee,_0x3bbce5){return function(_0x1430d4){if(_0x1430d4){return _0x1430d4['destroy']()['then'](function(){_0x3393ee[_0x128a('0x18')](0xcc)[_0x128a('0x19')]();});}};}function handleEntityNotFound(_0x3b0b42,_0x13c069){return function(_0x24b506){if(!_0x24b506){_0x3b0b42[_0x128a('0x17')](0x194);}return _0x24b506;};}function handleError(_0x53d325,_0x2fa3c6){_0x2fa3c6=_0x2fa3c6||0x1f4;return function(_0x44a247){logger[_0x128a('0x21')](_0x44a247[_0x128a('0x22')]);if(_0x44a247[_0x128a('0x23')]){delete _0x44a247[_0x128a('0x23')];}_0x53d325[_0x128a('0x18')](_0x2fa3c6)['send'](_0x44a247);};}exports[_0x128a('0x24')]=function(_0x303262,_0x38110a){if(_0x303262['body']['id']){delete _0x303262[_0x128a('0x25')]['id'];}return db[_0x128a('0x26')][_0x128a('0x27')]({'where':{'id':_0x303262[_0x128a('0x28')]['id']}})[_0x128a('0x29')](handleEntityNotFound(_0x38110a,null))[_0x128a('0x29')](saveUpdates(_0x303262['body'],null))[_0x128a('0x29')](respondWithResult(_0x38110a,null))['catch'](handleError(_0x38110a,null));};exports[_0x128a('0x2a')]=function(_0x520234,_0x5f1fa5){return db['Action'][_0x128a('0x27')]({'where':{'id':_0x520234['params']['id']}})[_0x128a('0x29')](handleEntityNotFound(_0x5f1fa5,null))[_0x128a('0x29')](removeEntity(_0x5f1fa5,null))[_0x128a('0x2b')](handleError(_0x5f1fa5,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index dc032cb..5968d1e 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 _0xec47=['lodash','../../config/logger','api','request-promise','path','rimraf','./action.attributes','exports','define','Action','tools_actions'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xec47,0x113));var _0x7ec4=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xec47[_0x29d94e];return _0x106237;};'use strict';var _=require(_0x7ec4('0x0'));var util=require('util');var logger=require(_0x7ec4('0x1'))(_0x7ec4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7ec4('0x3'));var fs=require('fs');var path=require(_0x7ec4('0x4'));var rimraf=require(_0x7ec4('0x5'));var config=require('../../config/environment');var attributes=require(_0x7ec4('0x6'));module[_0x7ec4('0x7')]=function(_0xd3aebd,_0x1cb441){return _0xd3aebd[_0x7ec4('0x8')](_0x7ec4('0x9'),attributes,{'tableName':_0x7ec4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xacfb=['moment','bluebird','request-promise','path','../../config/environment','./action.attributes','exports','lodash','api'];(function(_0x4afaaa,_0x28b654){var _0x350930=function(_0xe096c8){while(--_0xe096c8){_0x4afaaa['push'](_0x4afaaa['shift']());}};_0x350930(++_0x28b654);}(_0xacfb,0xc4));var _0xbacf=function(_0x530b51,_0x2778e4){_0x530b51=_0x530b51-0x0;var _0x257be7=_0xacfb[_0x530b51];return _0x257be7;};'use strict';var _=require(_0xbacf('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbacf('0x1'));var moment=require(_0xbacf('0x2'));var BPromise=require(_0xbacf('0x3'));var rp=require(_0xbacf('0x4'));var fs=require('fs');var path=require(_0xbacf('0x5'));var rimraf=require('rimraf');var config=require(_0xbacf('0x6'));var attributes=require(_0xbacf('0x7'));module[_0xbacf('0x8')]=function(_0x295609,_0x8aa887){return _0x295609['define']('Action',attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 96a8c15..8c729bd 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 _0x0713=['Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x395fe9,_0x29f3da){var _0xeaa070=function(_0x2c5bd7){while(--_0x2c5bd7){_0x395fe9['push'](_0x395fe9['shift']());}};_0xeaa070(++_0x29f3da);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('Action,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0x70e0=['code','Action,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5df8e7,_0x63aeb7){var _0x3d5ec9=function(_0x15b032){while(--_0x15b032){_0x5df8e7['push'](_0x5df8e7['shift']());}};_0x3d5ec9(++_0x63aeb7);}(_0x70e0,0x17b));var _0x070e=function(_0x557496,_0x29b6cd){_0x557496=_0x557496-0x0;var _0x31a63a=_0x70e0[_0x557496];return _0x31a63a;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('Action,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('Action,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index b2bc9c7..22c9d74 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 _0xa1b3=['connect-timeout','Router','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','util','path'];(function(_0x2211e9,_0x2c0ae2){var _0x3ccb22=function(_0x29da8a){while(--_0x29da8a){_0x2211e9['push'](_0x2211e9['shift']());}};_0x3ccb22(++_0x2c0ae2);}(_0xa1b3,0x153));var _0x3a1b=function(_0x4e19cb,_0x11df04){_0x4e19cb=_0x4e19cb-0x0;var _0x2cfec8=_0xa1b3[_0x4e19cb];return _0x2cfec8;};'use strict';var multer=require('multer');var util=require(_0x3a1b('0x0'));var path=require(_0x3a1b('0x1'));var timeout=require(_0x3a1b('0x2'));var express=require('express');var router=express[_0x3a1b('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3a1b('0x4'));var controller=require(_0x3a1b('0x5'));router[_0x3a1b('0x6')](_0x3a1b('0x7'),auth[_0x3a1b('0x8')](),controller[_0x3a1b('0x9')]);router[_0x3a1b('0xa')](_0x3a1b('0x7'),auth[_0x3a1b('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x01f1=['../../config/environment','put','/:id','isAuthenticated','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x2154e2,_0x3eb2a2){var _0x39a490=function(_0x3a4a09){while(--_0x3a4a09){_0x2154e2['push'](_0x2154e2['shift']());}};_0x39a490(++_0x3eb2a2);}(_0x01f1,0xcb));var _0x101f=function(_0x4abab9,_0xde21a4){_0x4abab9=_0x4abab9-0x0;var _0x374eba=_0x01f1[_0x4abab9];return _0x374eba;};'use strict';var multer=require(_0x101f('0x0'));var util=require(_0x101f('0x1'));var path=require(_0x101f('0x2'));var timeout=require(_0x101f('0x3'));var express=require(_0x101f('0x4'));var router=express['Router']();var auth=require(_0x101f('0x5'));var interaction=require(_0x101f('0x6'));var config=require(_0x101f('0x7'));var controller=require('./action.controller');router[_0x101f('0x8')](_0x101f('0x9'),auth[_0x101f('0xa')](),controller['update']);router[_0x101f('0xb')](_0x101f('0x9'),auth['isAuthenticated'](),controller[_0x101f('0xc')]);module[_0x101f('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 819ca80..1697041 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 _0x06f3=['TEXT','exports','STRING'];(function(_0x247917,_0x3554c7){var _0x4db89c=function(_0x27fa1f){while(--_0x27fa1f){_0x247917['push'](_0x247917['shift']());}};_0x4db89c(++_0x3554c7);}(_0x06f3,0x163));var _0x306f=function(_0x43b487,_0x21893a){_0x43b487=_0x43b487-0x0;var _0x2f707a=_0x06f3[_0x43b487];return _0x2f707a;};'use strict';var Sequelize=require('sequelize');module[_0x306f('0x0')]={'name':{'type':Sequelize[_0x306f('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x306f('0x1')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x306f('0x1')]},'conditions':{'type':Sequelize[_0x306f('0x2')]},'joins':{'type':Sequelize[_0x306f('0x2')]}}; \ No newline at end of file +var _0xb8c5=['STRING','TEXT','sequelize','exports'];(function(_0x107fd5,_0x44f2e6){var _0xdad8fb=function(_0x3d2eb5){while(--_0x3d2eb5){_0x107fd5['push'](_0x107fd5['shift']());}};_0xdad8fb(++_0x44f2e6);}(_0xb8c5,0x112));var _0x5b8c=function(_0x4f33ff,_0x4cc52d){_0x4f33ff=_0x4f33ff-0x0;var _0x40e19c=_0xb8c5[_0x4f33ff];return _0x40e19c;};'use strict';var Sequelize=require(_0x5b8c('0x0'));module[_0x5b8c('0x1')]={'name':{'type':Sequelize[_0x5b8c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5b8c('0x2')]},'parent':{'type':Sequelize[_0x5b8c('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x5b8c('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 8024e1c..281e392 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 _0xcf1c=['findAll','from','table','MetricId','replace','format','orderBy','DESC','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','SELECT','SUM(%s)','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','IS\x20EMPTY','value','getFields','Sequelize','keyBy','select','metric','groupBy','alias','parentKey','clone','QueryTypes','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','fork','../../components/export/','savename','COUNT(*)','run','runReport','COUNT(DISTINCT\x20%s)','UNIX_TIMESTAMP(%s)','function','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','dbH','status','end','json','count','offset','limit','set','apply','destroy','then','get','UserProfileResource','sendStatus','stack','name','index','map','AnalyticCustomReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','preview','join','left_join','right_join','cross_join','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xcf1c,0x18d));var _0xccf1=function(_0x198d2a,_0x510eb7){_0x198d2a=_0x198d2a-0x0;var _0xfda34d=_0xcf1c[_0x198d2a];return _0xfda34d;};'use strict';var pdf=require(_0xccf1('0x0'));var emlformat=require(_0xccf1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xccf1('0x2'));var jsonpatch=require(_0xccf1('0x3'));var rp=require(_0xccf1('0x4'));var moment=require(_0xccf1('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xccf1('0x6'));var sox=require('sox');var csv=require(_0xccf1('0x7'));var ejs=require(_0xccf1('0x8'));var fs=require('fs');var _=require(_0xccf1('0x9'));var squel=require(_0xccf1('0xa'));var crypto=require(_0xccf1('0xb'));var jsforce=require(_0xccf1('0xc'));var deskjs=require(_0xccf1('0xd'));var toCsv=require(_0xccf1('0x7'));var querystring=require(_0xccf1('0xe'));var Papa=require(_0xccf1('0xf'));var Redis=require(_0xccf1('0x10'));var authService=require(_0xccf1('0x11'));var qs=require(_0xccf1('0x12'));var as=require(_0xccf1('0x13'));var hardwareService=require(_0xccf1('0x14'));var logger=require(_0xccf1('0x15'))(_0xccf1('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xccf1('0x17'))['db'];var dbH=require(_0xccf1('0x17'))[_0xccf1('0x18')];function respondWithStatusCode(_0x3789c2,_0x3da424){_0x3da424=_0x3da424||0xcc;return function(_0x568b81){if(_0x568b81){return _0x3789c2['sendStatus'](_0x3da424);}return _0x3789c2[_0xccf1('0x19')](_0x3da424)[_0xccf1('0x1a')]();};}function respondWithResult(_0x1170e1,_0x44b68a){_0x44b68a=_0x44b68a||0xc8;return function(_0x95a852){if(_0x95a852){return _0x1170e1['status'](_0x44b68a)[_0xccf1('0x1b')](_0x95a852);}};}function respondWithFilteredResult(_0x537996,_0x4e91cd){return function(_0x1ceb48){if(_0x1ceb48){var _0x381da9=_0x1ceb48[_0xccf1('0x1c')],_0x4193b6=_0x4e91cd[_0xccf1('0x1d')],_0xf0f09a=_0x4e91cd['offset']+_0x4e91cd[_0xccf1('0x1e')],_0x157c26;if(_0xf0f09a>=_0x381da9){_0xf0f09a=_0x381da9;_0x157c26=0xc8;}else{_0x157c26=0xce;}_0x537996['status'](_0x157c26);return _0x537996[_0xccf1('0x1f')]('Content-Range',_0x4193b6+'-'+_0xf0f09a+'/'+_0x381da9)[_0xccf1('0x1b')](_0x1ceb48);}return null;};}function patchUpdates(_0x3a1635){return function(_0x590174){try{jsonpatch[_0xccf1('0x20')](_0x590174,_0x3a1635,!![]);}catch(_0x305889){return BPromise['reject'](_0x305889);}return _0x590174['save']();};}function saveUpdates(_0x4bcb98,_0x43c982){return function(_0xaab93c){if(_0xaab93c){return _0xaab93c['update'](_0x4bcb98)['then'](function(_0x18b7a3){return _0x18b7a3;});}return null;};}function removeEntity(_0xb819a6,_0x43d622){return function(_0xe8c94){if(_0xe8c94){return _0xe8c94[_0xccf1('0x21')]()[_0xccf1('0x22')](function(){var _0x2aa979=_0xe8c94[_0xccf1('0x23')]({'plain':!![]});var _0x75b9f6='CustomReports';return db[_0xccf1('0x24')][_0xccf1('0x21')]({'where':{'type':_0x75b9f6,'resourceId':_0x2aa979['id']}})[_0xccf1('0x22')](function(){return _0xe8c94;});})[_0xccf1('0x22')](function(){_0xb819a6[_0xccf1('0x19')](0xcc)[_0xccf1('0x1a')]();});}};}function handleEntityNotFound(_0x3d1011,_0x29f095){return function(_0x34799e){if(!_0x34799e){_0x3d1011[_0xccf1('0x25')](0x194);}return _0x34799e;};}function handleError(_0x40b762,_0x46a584){_0x46a584=_0x46a584||0x1f4;return function(_0x300da5){logger['error'](_0x300da5[_0xccf1('0x26')]);if(_0x300da5[_0xccf1('0x27')]){delete _0x300da5[_0xccf1('0x27')];}_0x40b762[_0xccf1('0x19')](_0x46a584)['send'](_0x300da5);};}exports[_0xccf1('0x28')]=function(_0x2e3c50,_0x39f66a){var _0x33bcba={},_0x2abc80={},_0x1fc293={'count':0x0,'rows':[]};var _0xc5cb28=_[_0xccf1('0x29')](db[_0xccf1('0x2a')]['rawAttributes'],function(_0x1082b5){return{'name':_0x1082b5[_0xccf1('0x2b')],'type':_0x1082b5[_0xccf1('0x2c')][_0xccf1('0x2d')]};});_0x2abc80[_0xccf1('0x2e')]=_['map'](_0xc5cb28,_0xccf1('0x27'));_0x2abc80[_0xccf1('0x2f')]=_[_0xccf1('0x30')](_0x2e3c50[_0xccf1('0x2f')]);_0x2abc80[_0xccf1('0x31')]=_['intersection'](_0x2abc80['model'],_0x2abc80[_0xccf1('0x2f')]);_0x33bcba[_0xccf1('0x32')]=_[_0xccf1('0x33')](_0x2abc80[_0xccf1('0x2e')],qs['fields'](_0x2e3c50[_0xccf1('0x2f')][_0xccf1('0x34')]));_0x33bcba[_0xccf1('0x32')]=_0x33bcba[_0xccf1('0x32')][_0xccf1('0x35')]?_0x33bcba[_0xccf1('0x32')]:_0x2abc80[_0xccf1('0x2e')];if(!_0x2e3c50['query'][_0xccf1('0x36')](_0xccf1('0x37'))){_0x33bcba[_0xccf1('0x1e')]=qs[_0xccf1('0x1e')](_0x2e3c50[_0xccf1('0x2f')][_0xccf1('0x1e')]);_0x33bcba[_0xccf1('0x1d')]=qs[_0xccf1('0x1d')](_0x2e3c50[_0xccf1('0x2f')][_0xccf1('0x1d')]);}_0x33bcba[_0xccf1('0x38')]=qs[_0xccf1('0x39')](_0x2e3c50['query'][_0xccf1('0x39')]);_0x33bcba[_0xccf1('0x3a')]=qs['filters'](_[_0xccf1('0x3b')](_0x2e3c50[_0xccf1('0x2f')],_0x2abc80[_0xccf1('0x31')]),_0xc5cb28);if(_0x2e3c50[_0xccf1('0x2f')][_0xccf1('0x3c')]){_0x33bcba[_0xccf1('0x3a')]=_[_0xccf1('0x3d')](_0x33bcba[_0xccf1('0x3a')],{'$or':_[_0xccf1('0x29')](_0xc5cb28,function(_0x1f5ebf){if(_0x1f5ebf['type']!==_0xccf1('0x3e')){var _0x583db2={};_0x583db2[_0x1f5ebf['name']]={'$like':'%'+_0x2e3c50[_0xccf1('0x2f')][_0xccf1('0x3c')]+'%'};return _0x583db2;}})});}_0x33bcba=_['merge']({},_0x33bcba,_0x2e3c50[_0xccf1('0x3f')]);var _0xcdcc3d={'where':_0x33bcba['where']};return db['AnalyticCustomReport'][_0xccf1('0x1c')](_0xcdcc3d)[_0xccf1('0x22')](function(_0x8c9185){_0x1fc293[_0xccf1('0x1c')]=_0x8c9185;if(_0x2e3c50[_0xccf1('0x2f')][_0xccf1('0x40')]){_0x33bcba[_0xccf1('0x41')]=[{'all':!![]}];}return db[_0xccf1('0x2a')]['findAll'](_0x33bcba);})[_0xccf1('0x22')](function(_0x16519b){_0x1fc293[_0xccf1('0x42')]=_0x16519b;return _0x1fc293;})[_0xccf1('0x22')](respondWithFilteredResult(_0x39f66a,_0x33bcba))['catch'](handleError(_0x39f66a,null));};exports[_0xccf1('0x43')]=function(_0x3fee3b,_0x2b14b0){var _0x5a6c44={'raw':![],'where':{'id':_0x3fee3b[_0xccf1('0x44')]['id']}},_0x546302={};_0x546302[_0xccf1('0x2e')]=_['keys'](db[_0xccf1('0x2a')]['rawAttributes']);_0x546302[_0xccf1('0x2f')]=_[_0xccf1('0x30')](_0x3fee3b[_0xccf1('0x2f')]);_0x546302[_0xccf1('0x31')]=_[_0xccf1('0x33')](_0x546302[_0xccf1('0x2e')],_0x546302[_0xccf1('0x2f')]);_0x5a6c44[_0xccf1('0x32')]=_[_0xccf1('0x33')](_0x546302[_0xccf1('0x2e')],qs[_0xccf1('0x34')](_0x3fee3b[_0xccf1('0x2f')][_0xccf1('0x34')]));_0x5a6c44['attributes']=_0x5a6c44[_0xccf1('0x32')][_0xccf1('0x35')]?_0x5a6c44[_0xccf1('0x32')]:_0x546302[_0xccf1('0x2e')];if(_0x3fee3b[_0xccf1('0x2f')][_0xccf1('0x40')]){_0x5a6c44[_0xccf1('0x41')]=[{'all':!![]}];}_0x5a6c44=_[_0xccf1('0x3d')]({},_0x5a6c44,_0x3fee3b[_0xccf1('0x3f')]);return db[_0xccf1('0x2a')]['find'](_0x5a6c44)[_0xccf1('0x22')](handleEntityNotFound(_0x2b14b0,null))[_0xccf1('0x22')](respondWithResult(_0x2b14b0,null))[_0xccf1('0x45')](handleError(_0x2b14b0,null));};exports[_0xccf1('0x46')]=function(_0x9a4221,_0x25d34e){return db['AnalyticCustomReport']['create'](_0x9a4221[_0xccf1('0x47')],{})[_0xccf1('0x22')](function(_0x4955a2){var _0x4e43ec=_0x9a4221[_0xccf1('0x48')][_0xccf1('0x23')]({'plain':!![]});if(!_0x4e43ec)throw new Error(_0xccf1('0x49'));if(_0x4e43ec[_0xccf1('0x4a')]===_0xccf1('0x48')){var _0x1a7d83=_0x4955a2['get']({'plain':!![]});var _0x50a9af=_0xccf1('0x4b');return db[_0xccf1('0x4c')]['find']({'where':{'name':_0x50a9af,'userProfileId':_0x4e43ec[_0xccf1('0x4d')]},'raw':!![]})[_0xccf1('0x22')](function(_0x114da9){if(_0x114da9&&_0x114da9['autoAssociation']===0x0){return db[_0xccf1('0x24')]['create']({'name':_0x1a7d83['name'],'resourceId':_0x1a7d83['id'],'type':_0xccf1('0x4e'),'sectionId':_0x114da9['id']},{})[_0xccf1('0x22')](function(){return _0x4955a2;});}else{return _0x4955a2;}})[_0xccf1('0x45')](function(_0x2fea19){logger[_0xccf1('0x4f')](_0xccf1('0x50'),_0x2fea19);throw _0x2fea19;});}return _0x4955a2;})['then'](respondWithResult(_0x25d34e,0xc9))[_0xccf1('0x45')](handleError(_0x25d34e,null));};exports[_0xccf1('0x51')]=function(_0x360d02,_0x4ca904){if(_0x360d02[_0xccf1('0x47')]['id']){delete _0x360d02[_0xccf1('0x47')]['id'];}return db[_0xccf1('0x2a')][_0xccf1('0x52')]({'where':{'id':_0x360d02['params']['id']}})[_0xccf1('0x22')](handleEntityNotFound(_0x4ca904,null))[_0xccf1('0x22')](saveUpdates(_0x360d02[_0xccf1('0x47')],null))[_0xccf1('0x22')](respondWithResult(_0x4ca904,null))['catch'](handleError(_0x4ca904,null));};exports['destroy']=function(_0x2ced92,_0x2306d0){return db[_0xccf1('0x2a')][_0xccf1('0x52')]({'where':{'id':_0x2ced92[_0xccf1('0x44')]['id']}})[_0xccf1('0x22')](handleEntityNotFound(_0x2306d0,null))['then'](removeEntity(_0x2306d0,null))[_0xccf1('0x45')](handleError(_0x2306d0,null));};exports[_0xccf1('0x53')]=function(_0x2e2d2c,_0x57ba0b){var _0x4362b4=0xa;var _0x5da043=[_0xccf1('0x54'),_0xccf1('0x55'),_0xccf1('0x56'),_0xccf1('0x57')];var _0x42c543={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xccf1('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xccf1('0x59'),'GROUP_CONCAT DESC':_0xccf1('0x5a')};var _0x4bed11={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xccf1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3125ab=function(_0x147053){return!_[_0xccf1('0x5c')]([_0xccf1('0x5d'),_0xccf1('0x5e'),'IS\x20EMPTY',_0xccf1('0x5f')],_0x147053);};var _0x4cc592=function(_0x2e38f5){if(!_0x2e38f5||!_0x2e38f5[_0xccf1('0x60')][_0xccf1('0x35')]){return'';}for(var _0x18631d='(',_0xe52eb2=0x0;_0xe52eb2<_0x2e38f5['rules'][_0xccf1('0x35')];_0xe52eb2+=0x1){_0xe52eb2>0x0&&(_0x18631d+='\x20'+_0x2e38f5[_0xccf1('0x61')]+'\x20');_0x18631d+=_0x2e38f5[_0xccf1('0x60')][_0xe52eb2][_0xccf1('0x62')]?_0x4cc592(_0x2e38f5[_0xccf1('0x60')][_0xe52eb2]['group']):_0x2e38f5[_0xccf1('0x60')][_0xe52eb2][_0xccf1('0x63')]+'\x20'+_0x2e38f5[_0xccf1('0x60')][_0xe52eb2]['condition']+(_0x3125ab(_0x2e38f5[_0xccf1('0x60')][_0xe52eb2][_0xccf1('0x64')])?'\x20'+_0x2e38f5['rules'][_0xe52eb2]['value']:'');}return _0x18631d+')';};var _0x443fe0={'where':{'id':_0x2e2d2c[_0xccf1('0x44')]['id']}},_0x88c5f9,_0x291abc,_0x21c025,_0xc800be,_0x603a4f;_0x443fe0=_[_0xccf1('0x3d')]({},_0x443fe0,_0x2e2d2c[_0xccf1('0x3f')]);return db[_0xccf1('0x2a')][_0xccf1('0x52')](_0x443fe0)[_0xccf1('0x22')](function(_0x2f816b){if(_0x2f816b){_0x88c5f9=_0x2f816b;return _0x2f816b['getFields']();}return null;})[_0xccf1('0x22')](function(_0x31c1b6){if(_0x31c1b6){if(!_0x31c1b6[_0xccf1('0x35')]){throw new db['Sequelize'][(_0xccf1('0x65'))](_0xccf1('0x66'),0x193);}_0x291abc=_0x31c1b6;return db[_0xccf1('0x67')][_0xccf1('0x68')]({'raw':!![]});}return null;})[_0xccf1('0x22')](function(_0x5203d0){if(_0x5203d0){_0x21c025=_['keyBy'](_0x5203d0,'id');var _0x2a1095;var _0x51d6c5=squel['select']();_0x51d6c5[_0xccf1('0x69')](_0x88c5f9[_0xccf1('0x6a')]);for(var _0x3176cc=0x0;_0x3176cc<_0x291abc[_0xccf1('0x35')];_0x3176cc+=0x1){_0x2a1095=_0x291abc[_0x3176cc]['MetricId']?_0x21c025[_0x291abc[_0x3176cc][_0xccf1('0x6b')]]['metric']:_0x291abc[_0x3176cc][_0xccf1('0x63')];_0x2a1095=_0x291abc[_0x3176cc]['function']?_[_0xccf1('0x6c')](_0x42c543[_0x291abc[_0x3176cc]['function']],'%s',_0x2a1095):_0x2a1095;_0x2a1095=_0x291abc[_0x3176cc]['format']?_['replace'](_0x4bed11[_0x291abc[_0x3176cc][_0xccf1('0x6d')]],'%s',_0x2a1095):_0x2a1095;if(_0x291abc[_0x3176cc]['groupBy']){_0x51d6c5['group'](_0x2a1095);}_0x291abc[_0x3176cc][_0xccf1('0x6e')]&&_0x51d6c5[_0xccf1('0x38')](_0x2a1095,_0x291abc[_0x3176cc][_0xccf1('0x6e')]===_0xccf1('0x6f')?![]:!![]);_0x51d6c5[_0xccf1('0x63')](_0x2a1095,_0x291abc[_0x3176cc]['alias']||_0x2a1095);}if(_0x88c5f9[_0xccf1('0x70')]){_0x88c5f9[_0xccf1('0x70')]=JSON[_0xccf1('0x71')](_0x88c5f9[_0xccf1('0x70')]);for(var _0x6dde90=0x0;_0x6dde90<_0x88c5f9[_0xccf1('0x70')][_0xccf1('0x35')];_0x6dde90+=0x1){if(_0x88c5f9[_0xccf1('0x70')][_0x6dde90]['type']&&_[_0xccf1('0x5c')](_0x5da043,_0x88c5f9['joins'][_0x6dde90]['type'])&&_0x88c5f9[_0xccf1('0x70')][_0x6dde90]['parentKey']&&_0x88c5f9['joins'][_0x6dde90][_0xccf1('0x72')]&&_0x88c5f9[_0xccf1('0x70')][_0x6dde90][_0xccf1('0x73')]){_0x51d6c5[_0x88c5f9[_0xccf1('0x70')][_0x6dde90]['type']](_0x88c5f9[_0xccf1('0x70')][_0x6dde90][_0xccf1('0x72')],null,util['format'](_0xccf1('0x74'),_0x88c5f9[_0xccf1('0x6a')],_0x88c5f9['joins'][_0x6dde90]['parentKey'],_0x88c5f9[_0xccf1('0x70')][_0x6dde90]['foreignTable'],_0x88c5f9['joins'][_0x6dde90]['foreignKey']));}}}if(_0x88c5f9[_0xccf1('0x75')]){_0x88c5f9[_0xccf1('0x75')]=JSON[_0xccf1('0x71')](_0x88c5f9['conditions']);_0x51d6c5[_0xccf1('0x3a')](_0x4cc592(_0x88c5f9[_0xccf1('0x75')][_0xccf1('0x62')]));}_0x603a4f=_0x51d6c5['clone']();_0x51d6c5[_0xccf1('0x1e')](_0x4362b4);_0x51d6c5[_0xccf1('0x1d')](0x0);logger[_0xccf1('0x76')](_0xccf1('0x77'),_0x51d6c5[_0xccf1('0x78')]());return db[_0xccf1('0x79')][_0xccf1('0x2f')](_0x51d6c5[_0xccf1('0x78')](),{'type':db[_0xccf1('0x79')]['QueryTypes'][_0xccf1('0x7a')]});}})[_0xccf1('0x22')](respondWithResult(_0x57ba0b,null))[_0xccf1('0x45')](handleError(_0x57ba0b,null));};function runReport(_0x4ef7af,_0x42dc38,_0x53c205){var _0x49f068=_0x42dc38['name'];var _0x210529=0xa;var _0x14b30f=[_0xccf1('0x54'),_0xccf1('0x55'),_0xccf1('0x56'),_0xccf1('0x57')];var _0x51fd96={'SUM':_0xccf1('0x7b'),'COUNT':_0xccf1('0x7c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xccf1('0x7d'),'AVG':_0xccf1('0x58'),'GROUP_CONCAT':_0xccf1('0x7e'),'GROUP_CONCAT ASC':_0xccf1('0x59'),'GROUP_CONCAT DESC':_0xccf1('0x5a')};var _0x5c8571={'SEC_TO_TIME':_0xccf1('0x7f'),'DATE':_0xccf1('0x80'),'HOUR':_0xccf1('0x81'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x45c7f2=function(_0x8787cd){return!_[_0xccf1('0x5c')](['IS\x20NULL',_0xccf1('0x5e'),_0xccf1('0x82'),_0xccf1('0x5f')],_0x8787cd);};var _0x213339=function(_0x289d78){if(!_0x289d78||!_0x289d78[_0xccf1('0x60')][_0xccf1('0x35')]){return'';}for(var _0x43b579='(',_0x375879=0x0;_0x375879<_0x289d78[_0xccf1('0x60')][_0xccf1('0x35')];_0x375879+=0x1){_0x375879>0x0&&(_0x43b579+='\x20'+_0x289d78[_0xccf1('0x61')]+'\x20');_0x43b579+=_0x289d78[_0xccf1('0x60')][_0x375879][_0xccf1('0x62')]?_0x213339(_0x289d78[_0xccf1('0x60')][_0x375879][_0xccf1('0x62')]):_0x289d78[_0xccf1('0x60')][_0x375879][_0xccf1('0x63')]+'\x20'+_0x289d78[_0xccf1('0x60')][_0x375879]['condition']+(_0x45c7f2(_0x289d78['rules'][_0x375879]['condition'])?'\x20'+_0x289d78[_0xccf1('0x60')][_0x375879][_0xccf1('0x83')]:'');}return _0x43b579+')';};var _0x4dcd4d={'where':{'id':_0x4ef7af['id']}},_0x98f34d,_0xe2f4bd,_0x15559e,_0x27d0d8,_0x2601a7;_0x4dcd4d=_[_0xccf1('0x3d')]({},_0x4dcd4d,_0x53c205);return db['AnalyticCustomReport'][_0xccf1('0x52')](_0x4dcd4d)['then'](function(_0x2ca66f){if(_0x2ca66f){_0x98f34d=_0x2ca66f;return _0x2ca66f[_0xccf1('0x84')]();}return null;})['then'](function(_0x2f87d0){if(_0x2f87d0){if(!_0x2f87d0[_0xccf1('0x35')]){throw new db[(_0xccf1('0x85'))]['ValidationErrorItem'](_0xccf1('0x66'),0x193);}_0xe2f4bd=_0x2f87d0;return db[_0xccf1('0x67')][_0xccf1('0x68')]({'raw':!![]});}return null;})[_0xccf1('0x22')](function(_0xa4a717){if(_0xa4a717){_0x15559e=_[_0xccf1('0x86')](_0xa4a717,'id');var _0x28fc3a;var _0x3786a9=squel[_0xccf1('0x87')]();_0x3786a9['from'](_0x98f34d[_0xccf1('0x6a')]);for(var _0x1765be=0x0;_0x1765be<_0xe2f4bd['length'];_0x1765be+=0x1){_0x28fc3a=_0xe2f4bd[_0x1765be]['MetricId']?_0x15559e[_0xe2f4bd[_0x1765be][_0xccf1('0x6b')]][_0xccf1('0x88')]:_0xe2f4bd[_0x1765be][_0xccf1('0x63')];_0x28fc3a=_0xe2f4bd[_0x1765be]['function']?_[_0xccf1('0x6c')](_0x51fd96[_0xe2f4bd[_0x1765be]['function']],'%s',_0x28fc3a):_0x28fc3a;_0x28fc3a=_0xe2f4bd[_0x1765be]['format']?_[_0xccf1('0x6c')](_0x5c8571[_0xe2f4bd[_0x1765be]['format']],'%s',_0x28fc3a):_0x28fc3a;if(_0xe2f4bd[_0x1765be][_0xccf1('0x89')]){_0x3786a9[_0xccf1('0x62')](_0x28fc3a);}_0xe2f4bd[_0x1765be][_0xccf1('0x6e')]&&_0x3786a9[_0xccf1('0x38')](_0x28fc3a,_0xe2f4bd[_0x1765be][_0xccf1('0x6e')]===_0xccf1('0x6f')?![]:!![]);_0x3786a9[_0xccf1('0x63')](_0x28fc3a,_0xe2f4bd[_0x1765be][_0xccf1('0x8a')]||_0x28fc3a);}if(_0x98f34d[_0xccf1('0x70')]){_0x98f34d[_0xccf1('0x70')]=JSON['parse'](_0x98f34d[_0xccf1('0x70')]);for(var _0x4a91b2=0x0;_0x4a91b2<_0x98f34d['joins'][_0xccf1('0x35')];_0x4a91b2+=0x1){if(_0x98f34d[_0xccf1('0x70')][_0x4a91b2]['type']&&_[_0xccf1('0x5c')](_0x14b30f,_0x98f34d[_0xccf1('0x70')][_0x4a91b2]['type'])&&_0x98f34d[_0xccf1('0x70')][_0x4a91b2][_0xccf1('0x8b')]&&_0x98f34d[_0xccf1('0x70')][_0x4a91b2]['foreignTable']&&_0x98f34d[_0xccf1('0x70')][_0x4a91b2]['foreignKey']){_0x3786a9[_0x98f34d[_0xccf1('0x70')][_0x4a91b2][_0xccf1('0x2c')]](_0x98f34d[_0xccf1('0x70')][_0x4a91b2]['foreignTable'],null,util[_0xccf1('0x6d')](_0xccf1('0x74'),_0x98f34d[_0xccf1('0x6a')],_0x98f34d[_0xccf1('0x70')][_0x4a91b2][_0xccf1('0x8b')],_0x98f34d[_0xccf1('0x70')][_0x4a91b2][_0xccf1('0x72')],_0x98f34d[_0xccf1('0x70')][_0x4a91b2][_0xccf1('0x73')]));}}}if(_0x98f34d[_0xccf1('0x75')]){_0x98f34d[_0xccf1('0x75')]=JSON[_0xccf1('0x71')](_0x98f34d[_0xccf1('0x75')]);_0x3786a9[_0xccf1('0x3a')](_0x213339(_0x98f34d[_0xccf1('0x75')]['group']));}_0x2601a7=_0x3786a9[_0xccf1('0x8c')]();_0x3786a9['limit'](_0x210529);_0x3786a9[_0xccf1('0x1d')](0x0);logger['debug'](_0xccf1('0x77'),_0x3786a9['toString']());return db[_0xccf1('0x79')]['query'](_0x3786a9[_0xccf1('0x78')](),{'type':db[_0xccf1('0x79')][_0xccf1('0x8d')][_0xccf1('0x7a')]});}})[_0xccf1('0x22')](function(_0x5636e3){if(!_0x5636e3['length']){throw new db[(_0xccf1('0x85'))][(_0xccf1('0x65'))](_0xccf1('0x8e'),0xcc);}if(_0x42dc38[_0xccf1('0x8f')]===_0xccf1('0x90')){return null;}var _0x2c3c2c=_[_0xccf1('0x3d')](_0x42dc38,{'name':_0x42dc38[_0xccf1('0x91')]||_0x42dc38[_0xccf1('0x27')]||_0x98f34d[_0xccf1('0x27')],'basename':_0x49f068,'savename':util[_0xccf1('0x6d')](_0xccf1('0x92'),_0x42dc38['name']||_0x98f34d[_0xccf1('0x27')],require(_0xccf1('0x93'))[_0xccf1('0x94')](0x4),_0x42dc38[_0xccf1('0x8f')]||_0xccf1('0x95')),'reportId':_0x98f34d['id'],'reportType':_0xccf1('0x96')});return db['AnalyticExtractedReport'][_0xccf1('0x46')](_0x2c3c2c,{'raw':!![]});})[_0xccf1('0x22')](function(_0x247e31){if(_0x98f34d[_0xccf1('0x6a')]===_0xccf1('0x97')){_0x2601a7[_0xccf1('0x3a')](_0x98f34d['table']+_0xccf1('0x98'),_0x42dc38['startDate'],_0x42dc38[_0xccf1('0x99')]);}else{_0x2601a7['where'](_0x98f34d[_0xccf1('0x6a')]+_0xccf1('0x9a'),_0x42dc38[_0xccf1('0x9b')],_0x42dc38[_0xccf1('0x99')]);}if(_0x247e31){logger[_0xccf1('0x9c')](_0xccf1('0x9d'),_0x2601a7['toString']());require('child_process')[_0xccf1('0x9e')](path[_0xccf1('0x54')](__dirname,_0xccf1('0x9f'),_0x247e31[_0xccf1('0x8f')]),[_0x247e31['id'],_0x2601a7[_0xccf1('0x78')](),path[_0xccf1('0x54')](__dirname,'../../files/reports',_0x247e31[_0xccf1('0xa0')]),_0x49f068]);return _0x247e31;}else{var _0x4f5b35=squel[_0xccf1('0x87')]();_0x4f5b35[_0xccf1('0x69')]('('+_0x2601a7[_0xccf1('0x78')]()+')','countTable');_0x4f5b35['field'](_0xccf1('0xa1'),_0xccf1('0x1c'));_0x2601a7[_0xccf1('0x1e')](_0x42dc38['limit']||_0x210529);_0x2601a7[_0xccf1('0x1d')](_0x42dc38[_0xccf1('0x1d')]||0x0);return dbH[_0xccf1('0x79')][_0xccf1('0x2f')](_0x4f5b35[_0xccf1('0x78')](),{'type':dbH[_0xccf1('0x79')][_0xccf1('0x8d')]['SELECT']})[_0xccf1('0x22')](function(_0x250a21){if(!_0x250a21[_0xccf1('0x35')]){_0x27d0d8=0x0;}else{_0x27d0d8=_0x250a21[0x0][_0xccf1('0x1c')]||0x0;}return dbH['sequelize'][_0xccf1('0x2f')](_0x2601a7[_0xccf1('0x78')](),{'type':dbH['sequelize']['QueryTypes'][_0xccf1('0x7a')]});})[_0xccf1('0x22')](function(_0xd07d8a){return{'rows':_0xd07d8a||[],'count':_0x27d0d8};});}});}exports[_0xccf1('0xa2')]=function(_0x402464,_0x2a3682){return runReport(_0x402464['params'],_0x402464[_0xccf1('0x2f')],_0x402464[_0xccf1('0x3f')])[_0xccf1('0x22')](respondWithResult(_0x2a3682,null))['catch'](handleError(_0x2a3682,null));};exports[_0xccf1('0xa3')]=runReport;exports['query']=function(_0x252da5,_0x5bbced){var _0x4f66df=0xa;var _0xbba79a=[_0xccf1('0x54'),_0xccf1('0x55'),_0xccf1('0x56'),_0xccf1('0x57')];var _0x40a499={'SUM':'SUM(%s)','COUNT':_0xccf1('0x7c'),'COUNT DISTINCT':_0xccf1('0xa4'),'MAX':'MAX(%s)','MIN':_0xccf1('0x7d'),'AVG':_0xccf1('0x58'),'GROUP_CONCAT':_0xccf1('0x7e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xb9a7cf={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xccf1('0x5b'),'UNIX_TIMESTAMP':_0xccf1('0xa5')};var _0xf37089=function(_0x5e30a2){return!_[_0xccf1('0x5c')]([_0xccf1('0x5d'),_0xccf1('0x5e'),_0xccf1('0x82'),'IS\x20NOT\x20EMPTY'],_0x5e30a2);};var _0x57432d=function(_0x2b5ab6){if(!_0x2b5ab6||!_0x2b5ab6[_0xccf1('0x60')][_0xccf1('0x35')]){return'';}for(var _0x17f378='(',_0x2992c1=0x0;_0x2992c1<_0x2b5ab6[_0xccf1('0x60')][_0xccf1('0x35')];_0x2992c1+=0x1){_0x2992c1>0x0&&(_0x17f378+='\x20'+_0x2b5ab6[_0xccf1('0x61')]+'\x20');_0x17f378+=_0x2b5ab6['rules'][_0x2992c1][_0xccf1('0x62')]?_0x57432d(_0x2b5ab6[_0xccf1('0x60')][_0x2992c1]['group']):_0x2b5ab6[_0xccf1('0x60')][_0x2992c1][_0xccf1('0x63')]+'\x20'+_0x2b5ab6[_0xccf1('0x60')][_0x2992c1]['condition']+(_0xf37089(_0x2b5ab6['rules'][_0x2992c1][_0xccf1('0x64')])?'\x20'+_0x2b5ab6[_0xccf1('0x60')][_0x2992c1][_0xccf1('0x83')]:'');}return _0x17f378+')';};var _0x293ed0={'where':{'id':_0x252da5[_0xccf1('0x44')]['id']}},_0x4293c1,_0x54f708,_0x514569,_0x584f5e,_0xf3d495;_0x293ed0=_[_0xccf1('0x3d')]({},_0x293ed0,_0x252da5[_0xccf1('0x3f')]);return db[_0xccf1('0x2a')]['find'](_0x293ed0)['then'](function(_0x248aae){if(_0x248aae){_0x4293c1=_0x248aae;return _0x248aae['getFields']();}return null;})['then'](function(_0x33807a){if(_0x33807a){if(!_0x33807a['length']){throw new db[(_0xccf1('0x85'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x54f708=_0x33807a;return db[_0xccf1('0x67')]['findAll']({'raw':!![]});}return null;})[_0xccf1('0x22')](function(_0xace1a7){if(_0xace1a7){_0x514569=_[_0xccf1('0x86')](_0xace1a7,'id');var _0x4edcd2;var _0x82852e=squel['select']();_0x82852e['from'](_0x4293c1[_0xccf1('0x6a')]);for(var _0x5059ae=0x0;_0x5059ae<_0x54f708[_0xccf1('0x35')];_0x5059ae+=0x1){_0x4edcd2=_0x54f708[_0x5059ae][_0xccf1('0x6b')]?_0x514569[_0x54f708[_0x5059ae]['MetricId']][_0xccf1('0x88')]:_0x54f708[_0x5059ae][_0xccf1('0x63')];_0x4edcd2=_0x54f708[_0x5059ae]['function']?_[_0xccf1('0x6c')](_0x40a499[_0x54f708[_0x5059ae][_0xccf1('0xa6')]],'%s',_0x4edcd2):_0x4edcd2;_0x4edcd2=_0x54f708[_0x5059ae][_0xccf1('0x6d')]?_[_0xccf1('0x6c')](_0xb9a7cf[_0x54f708[_0x5059ae][_0xccf1('0x6d')]],'%s',_0x4edcd2):_0x4edcd2;if(_0x54f708[_0x5059ae][_0xccf1('0x89')]){_0x82852e['group'](_0x4edcd2);}_0x54f708[_0x5059ae][_0xccf1('0x6e')]&&_0x82852e[_0xccf1('0x38')](_0x4edcd2,_0x54f708[_0x5059ae]['orderBy']===_0xccf1('0x6f')?![]:!![]);_0x82852e[_0xccf1('0x63')](_0x4edcd2,_0x54f708[_0x5059ae]['alias']||_0x4edcd2);}if(_0x4293c1[_0xccf1('0x70')]){_0x4293c1['joins']=JSON[_0xccf1('0x71')](_0x4293c1[_0xccf1('0x70')]);for(var _0x2b99be=0x0;_0x2b99be<_0x4293c1['joins']['length'];_0x2b99be+=0x1){if(_0x4293c1[_0xccf1('0x70')][_0x2b99be][_0xccf1('0x2c')]&&_[_0xccf1('0x5c')](_0xbba79a,_0x4293c1[_0xccf1('0x70')][_0x2b99be][_0xccf1('0x2c')])&&_0x4293c1[_0xccf1('0x70')][_0x2b99be][_0xccf1('0x8b')]&&_0x4293c1[_0xccf1('0x70')][_0x2b99be][_0xccf1('0x72')]&&_0x4293c1[_0xccf1('0x70')][_0x2b99be][_0xccf1('0x73')]){_0x82852e[_0x4293c1[_0xccf1('0x70')][_0x2b99be][_0xccf1('0x2c')]](_0x4293c1[_0xccf1('0x70')][_0x2b99be][_0xccf1('0x72')],null,util[_0xccf1('0x6d')](_0xccf1('0x74'),_0x4293c1[_0xccf1('0x6a')],_0x4293c1[_0xccf1('0x70')][_0x2b99be]['parentKey'],_0x4293c1[_0xccf1('0x70')][_0x2b99be][_0xccf1('0x72')],_0x4293c1[_0xccf1('0x70')][_0x2b99be][_0xccf1('0x73')]));}}}if(_0x4293c1[_0xccf1('0x75')]){_0x4293c1[_0xccf1('0x75')]=JSON[_0xccf1('0x71')](_0x4293c1['conditions']);_0x82852e['where'](_0x57432d(_0x4293c1[_0xccf1('0x75')][_0xccf1('0x62')]));}_0xf3d495=_0x82852e[_0xccf1('0x8c')]();_0x82852e[_0xccf1('0x1e')](_0x4f66df);_0x82852e[_0xccf1('0x1d')](0x0);logger[_0xccf1('0x76')](_0xccf1('0x77'),_0x82852e[_0xccf1('0x78')]());return db['sequelize'][_0xccf1('0x2f')](_0x82852e['toString'](),{'type':db[_0xccf1('0x79')][_0xccf1('0x8d')][_0xccf1('0x7a')]});}})[_0xccf1('0x22')](function(){return{'sql':_0xf3d495[_0xccf1('0x78')]()};})[_0xccf1('0x22')](respondWithResult(_0x5bbced,null))[_0xccf1('0x45')](handleError(_0x5bbced,null));}; \ No newline at end of file +var _0x4403=['from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','right_join','COUNT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','IS\x20NULL','operator','condition','value','SELECT','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','zip-dir','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','get','CustomReports','destroy','error','stack','name','send','index','fieldName','model','map','keys','intersection','attributes','query','length','hasOwnProperty','order','sort','where','filters','type','VIRTUAL','filter','merge','AnalyticCustomReport','include','findAll','rows','catch','show','rawAttributes','fields','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select'];(function(_0x5d70f9,_0x281d2c){var _0x133a6c=function(_0x46d9af){while(--_0x46d9af){_0x5d70f9['push'](_0x5d70f9['shift']());}};_0x133a6c(++_0x281d2c);}(_0x4403,0x179));var _0x3440=function(_0x35b08a,_0xd824d1){_0x35b08a=_0x35b08a-0x0;var _0x20bc1a=_0x4403[_0x35b08a];return _0x20bc1a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3440('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3440('0x1'));var moment=require(_0x3440('0x2'));var BPromise=require(_0x3440('0x3'));var Mustache=require(_0x3440('0x4'));var util=require('util');var path=require(_0x3440('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3440('0x6'));var fs=require('fs');var _=require(_0x3440('0x7'));var squel=require(_0x3440('0x8'));var crypto=require('crypto');var jsforce=require(_0x3440('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x3440('0xa'));var querystring=require(_0x3440('0xb'));var Papa=require(_0x3440('0xc'));var Redis=require('ioredis');var authService=require(_0x3440('0xd'));var qs=require(_0x3440('0xe'));var as=require(_0x3440('0xf'));var hardwareService=require(_0x3440('0x10'));var logger=require(_0x3440('0x11'))(_0x3440('0x12'));var utils=require(_0x3440('0x13'));var config=require('../../config/environment');var db=require(_0x3440('0x14'))['db'];var dbH=require(_0x3440('0x14'))[_0x3440('0x15')];function respondWithStatusCode(_0x4f541e,_0x270f4a){_0x270f4a=_0x270f4a||0xcc;return function(_0xb24e14){if(_0xb24e14){return _0x4f541e[_0x3440('0x16')](_0x270f4a);}return _0x4f541e[_0x3440('0x17')](_0x270f4a)[_0x3440('0x18')]();};}function respondWithResult(_0x5201e6,_0x36dd82){_0x36dd82=_0x36dd82||0xc8;return function(_0x55eac4){if(_0x55eac4){return _0x5201e6[_0x3440('0x17')](_0x36dd82)[_0x3440('0x19')](_0x55eac4);}};}function respondWithFilteredResult(_0x33a5bb,_0x18871d){return function(_0x11930d){if(_0x11930d){var _0x1193f7=_0x11930d[_0x3440('0x1a')],_0x131eea=_0x18871d[_0x3440('0x1b')],_0xb66a69=_0x18871d[_0x3440('0x1b')]+_0x18871d[_0x3440('0x1c')],_0x5a5d2a;if(_0xb66a69>=_0x1193f7){_0xb66a69=_0x1193f7;_0x5a5d2a=0xc8;}else{_0x5a5d2a=0xce;}_0x33a5bb[_0x3440('0x17')](_0x5a5d2a);return _0x33a5bb[_0x3440('0x1d')]('Content-Range',_0x131eea+'-'+_0xb66a69+'/'+_0x1193f7)[_0x3440('0x19')](_0x11930d);}return null;};}function patchUpdates(_0x268086){return function(_0x2e692b){try{jsonpatch[_0x3440('0x1e')](_0x2e692b,_0x268086,!![]);}catch(_0x10982f){return BPromise[_0x3440('0x1f')](_0x10982f);}return _0x2e692b[_0x3440('0x20')]();};}function saveUpdates(_0x36f851,_0x25afeb){return function(_0xd34993){if(_0xd34993){return _0xd34993[_0x3440('0x21')](_0x36f851)['then'](function(_0x485350){return _0x485350;});}return null;};}function removeEntity(_0x5f4386,_0x2c8e7c){return function(_0x45afde){if(_0x45afde){return _0x45afde['destroy']()[_0x3440('0x22')](function(){var _0x232b8f=_0x45afde[_0x3440('0x23')]({'plain':!![]});var _0x38bf02=_0x3440('0x24');return db['UserProfileResource'][_0x3440('0x25')]({'where':{'type':_0x38bf02,'resourceId':_0x232b8f['id']}})[_0x3440('0x22')](function(){return _0x45afde;});})[_0x3440('0x22')](function(){_0x5f4386[_0x3440('0x17')](0xcc)[_0x3440('0x18')]();});}};}function handleEntityNotFound(_0x58c03a,_0x381942){return function(_0x2e93c){if(!_0x2e93c){_0x58c03a[_0x3440('0x16')](0x194);}return _0x2e93c;};}function handleError(_0x251646,_0x21ed0c){_0x21ed0c=_0x21ed0c||0x1f4;return function(_0x5bb009){logger[_0x3440('0x26')](_0x5bb009[_0x3440('0x27')]);if(_0x5bb009[_0x3440('0x28')]){delete _0x5bb009[_0x3440('0x28')];}_0x251646[_0x3440('0x17')](_0x21ed0c)[_0x3440('0x29')](_0x5bb009);};}exports[_0x3440('0x2a')]=function(_0x1f7fee,_0xc2167c){var _0xf38d1={},_0x2f2bdb={},_0x581315={'count':0x0,'rows':[]};var _0x5d6b82=_['map'](db['AnalyticCustomReport']['rawAttributes'],function(_0x4ab2ef){return{'name':_0x4ab2ef[_0x3440('0x2b')],'type':_0x4ab2ef['type']['key']};});_0x2f2bdb[_0x3440('0x2c')]=_[_0x3440('0x2d')](_0x5d6b82,_0x3440('0x28'));_0x2f2bdb['query']=_[_0x3440('0x2e')](_0x1f7fee['query']);_0x2f2bdb['filters']=_[_0x3440('0x2f')](_0x2f2bdb['model'],_0x2f2bdb['query']);_0xf38d1[_0x3440('0x30')]=_['intersection'](_0x2f2bdb[_0x3440('0x2c')],qs['fields'](_0x1f7fee[_0x3440('0x31')]['fields']));_0xf38d1[_0x3440('0x30')]=_0xf38d1['attributes'][_0x3440('0x32')]?_0xf38d1[_0x3440('0x30')]:_0x2f2bdb[_0x3440('0x2c')];if(!_0x1f7fee[_0x3440('0x31')][_0x3440('0x33')]('nolimit')){_0xf38d1[_0x3440('0x1c')]=qs[_0x3440('0x1c')](_0x1f7fee[_0x3440('0x31')][_0x3440('0x1c')]);_0xf38d1['offset']=qs[_0x3440('0x1b')](_0x1f7fee[_0x3440('0x31')]['offset']);}_0xf38d1[_0x3440('0x34')]=qs[_0x3440('0x35')](_0x1f7fee[_0x3440('0x31')][_0x3440('0x35')]);_0xf38d1[_0x3440('0x36')]=qs[_0x3440('0x37')](_['pick'](_0x1f7fee[_0x3440('0x31')],_0x2f2bdb[_0x3440('0x37')]),_0x5d6b82);if(_0x1f7fee[_0x3440('0x31')]['filter']){_0xf38d1['where']=_['merge'](_0xf38d1['where'],{'$or':_[_0x3440('0x2d')](_0x5d6b82,function(_0x1eae46){if(_0x1eae46[_0x3440('0x38')]!==_0x3440('0x39')){var _0x67bfe7={};_0x67bfe7[_0x1eae46['name']]={'$like':'%'+_0x1f7fee[_0x3440('0x31')][_0x3440('0x3a')]+'%'};return _0x67bfe7;}})});}_0xf38d1=_[_0x3440('0x3b')]({},_0xf38d1,_0x1f7fee['options']);var _0x4d7204={'where':_0xf38d1['where']};return db[_0x3440('0x3c')][_0x3440('0x1a')](_0x4d7204)[_0x3440('0x22')](function(_0x1e9c62){_0x581315[_0x3440('0x1a')]=_0x1e9c62;if(_0x1f7fee[_0x3440('0x31')]['includeAll']){_0xf38d1[_0x3440('0x3d')]=[{'all':!![]}];}return db[_0x3440('0x3c')][_0x3440('0x3e')](_0xf38d1);})['then'](function(_0x134b76){_0x581315[_0x3440('0x3f')]=_0x134b76;return _0x581315;})[_0x3440('0x22')](respondWithFilteredResult(_0xc2167c,_0xf38d1))[_0x3440('0x40')](handleError(_0xc2167c,null));};exports[_0x3440('0x41')]=function(_0x151ece,_0x54ceff){var _0x40ebe1={'raw':![],'where':{'id':_0x151ece['params']['id']}},_0x2ffa59={};_0x2ffa59[_0x3440('0x2c')]=_[_0x3440('0x2e')](db[_0x3440('0x3c')][_0x3440('0x42')]);_0x2ffa59[_0x3440('0x31')]=_[_0x3440('0x2e')](_0x151ece[_0x3440('0x31')]);_0x2ffa59[_0x3440('0x37')]=_[_0x3440('0x2f')](_0x2ffa59[_0x3440('0x2c')],_0x2ffa59[_0x3440('0x31')]);_0x40ebe1['attributes']=_[_0x3440('0x2f')](_0x2ffa59['model'],qs[_0x3440('0x43')](_0x151ece[_0x3440('0x31')]['fields']));_0x40ebe1[_0x3440('0x30')]=_0x40ebe1[_0x3440('0x30')][_0x3440('0x32')]?_0x40ebe1[_0x3440('0x30')]:_0x2ffa59[_0x3440('0x2c')];if(_0x151ece[_0x3440('0x31')][_0x3440('0x44')]){_0x40ebe1[_0x3440('0x3d')]=[{'all':!![]}];}_0x40ebe1=_[_0x3440('0x3b')]({},_0x40ebe1,_0x151ece[_0x3440('0x45')]);return db[_0x3440('0x3c')]['find'](_0x40ebe1)[_0x3440('0x22')](handleEntityNotFound(_0x54ceff,null))[_0x3440('0x22')](respondWithResult(_0x54ceff,null))['catch'](handleError(_0x54ceff,null));};exports[_0x3440('0x46')]=function(_0x98540c,_0xe76afe){return db[_0x3440('0x3c')][_0x3440('0x46')](_0x98540c[_0x3440('0x47')],{})[_0x3440('0x22')](function(_0x4a00e0){var _0x56d37b=_0x98540c[_0x3440('0x48')][_0x3440('0x23')]({'plain':!![]});if(!_0x56d37b)throw new Error(_0x3440('0x49'));if(_0x56d37b[_0x3440('0x4a')]===_0x3440('0x48')){var _0x36fd4d=_0x4a00e0[_0x3440('0x23')]({'plain':!![]});var _0x265e54=_0x3440('0x4b');return db[_0x3440('0x4c')][_0x3440('0x4d')]({'where':{'name':_0x265e54,'userProfileId':_0x56d37b[_0x3440('0x4e')]},'raw':!![]})[_0x3440('0x22')](function(_0x485490){if(_0x485490&&_0x485490['autoAssociation']===0x0){return db[_0x3440('0x4f')][_0x3440('0x46')]({'name':_0x36fd4d[_0x3440('0x28')],'resourceId':_0x36fd4d['id'],'type':_0x3440('0x24'),'sectionId':_0x485490['id']},{})[_0x3440('0x22')](function(){return _0x4a00e0;});}else{return _0x4a00e0;}})['catch'](function(_0x349f26){logger['error'](_0x3440('0x50'),_0x349f26);throw _0x349f26;});}return _0x4a00e0;})['then'](respondWithResult(_0xe76afe,0xc9))[_0x3440('0x40')](handleError(_0xe76afe,null));};exports['update']=function(_0x3acd64,_0x59f4f9){if(_0x3acd64[_0x3440('0x47')]['id']){delete _0x3acd64[_0x3440('0x47')]['id'];}return db[_0x3440('0x3c')][_0x3440('0x4d')]({'where':{'id':_0x3acd64[_0x3440('0x51')]['id']}})['then'](handleEntityNotFound(_0x59f4f9,null))[_0x3440('0x22')](saveUpdates(_0x3acd64[_0x3440('0x47')],null))[_0x3440('0x22')](respondWithResult(_0x59f4f9,null))[_0x3440('0x40')](handleError(_0x59f4f9,null));};exports[_0x3440('0x25')]=function(_0x224e82,_0x1e1b17){return db[_0x3440('0x3c')][_0x3440('0x4d')]({'where':{'id':_0x224e82['params']['id']}})[_0x3440('0x22')](handleEntityNotFound(_0x1e1b17,null))[_0x3440('0x22')](removeEntity(_0x1e1b17,null))[_0x3440('0x40')](handleError(_0x1e1b17,null));};exports[_0x3440('0x52')]=function(_0x57fb43,_0x3576ab){var _0x40016c=0xa;var _0x55a132=[_0x3440('0x53'),_0x3440('0x54'),'right_join',_0x3440('0x55')];var _0x302ced={'SUM':_0x3440('0x56'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x3440('0x57'),'MAX':_0x3440('0x58'),'MIN':_0x3440('0x59'),'AVG':_0x3440('0x5a'),'GROUP_CONCAT':_0x3440('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x353d94={'SEC_TO_TIME':_0x3440('0x5c'),'DATE':'DATE(%s)','HOUR':_0x3440('0x5d'),'ROUND':_0x3440('0x5e'),'UNIX_TIMESTAMP':_0x3440('0x5f')};var _0x57197c=function(_0x35ee73){return!_[_0x3440('0x60')](['IS\x20NULL',_0x3440('0x61'),_0x3440('0x62'),_0x3440('0x63')],_0x35ee73);};var _0x1accbe=function(_0x262719){if(!_0x262719||!_0x262719[_0x3440('0x64')]['length']){return'';}for(var _0x21010c='(',_0x5e5f80=0x0;_0x5e5f80<_0x262719[_0x3440('0x64')]['length'];_0x5e5f80+=0x1){_0x5e5f80>0x0&&(_0x21010c+='\x20'+_0x262719['operator']+'\x20');_0x21010c+=_0x262719[_0x3440('0x64')][_0x5e5f80][_0x3440('0x65')]?_0x1accbe(_0x262719[_0x3440('0x64')][_0x5e5f80]['group']):_0x262719[_0x3440('0x64')][_0x5e5f80][_0x3440('0x66')]+'\x20'+_0x262719[_0x3440('0x64')][_0x5e5f80]['condition']+(_0x57197c(_0x262719[_0x3440('0x64')][_0x5e5f80]['condition'])?'\x20'+_0x262719[_0x3440('0x64')][_0x5e5f80]['value']:'');}return _0x21010c+')';};var _0x51c746={'where':{'id':_0x57fb43[_0x3440('0x51')]['id']}},_0x37c158,_0xa2f09e,_0x4854f5,_0x49069d,_0x2f4c4d;_0x51c746=_['merge']({},_0x51c746,_0x57fb43['options']);return db[_0x3440('0x3c')]['find'](_0x51c746)[_0x3440('0x22')](function(_0x47867b){if(_0x47867b){_0x37c158=_0x47867b;return _0x47867b[_0x3440('0x67')]();}return null;})[_0x3440('0x22')](function(_0x5c4b11){if(_0x5c4b11){if(!_0x5c4b11['length']){throw new db[(_0x3440('0x68'))][(_0x3440('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xa2f09e=_0x5c4b11;return db[_0x3440('0x6a')][_0x3440('0x3e')]({'raw':!![]});}return null;})['then'](function(_0x1afdfe){if(_0x1afdfe){_0x4854f5=_[_0x3440('0x6b')](_0x1afdfe,'id');var _0x1344b2;var _0x4213e6=squel[_0x3440('0x6c')]();_0x4213e6[_0x3440('0x6d')](_0x37c158[_0x3440('0x6e')]);for(var _0x1772f8=0x0;_0x1772f8<_0xa2f09e['length'];_0x1772f8+=0x1){_0x1344b2=_0xa2f09e[_0x1772f8]['MetricId']?_0x4854f5[_0xa2f09e[_0x1772f8][_0x3440('0x6f')]][_0x3440('0x70')]:_0xa2f09e[_0x1772f8][_0x3440('0x66')];_0x1344b2=_0xa2f09e[_0x1772f8][_0x3440('0x71')]?_[_0x3440('0x72')](_0x302ced[_0xa2f09e[_0x1772f8]['function']],'%s',_0x1344b2):_0x1344b2;_0x1344b2=_0xa2f09e[_0x1772f8][_0x3440('0x73')]?_[_0x3440('0x72')](_0x353d94[_0xa2f09e[_0x1772f8][_0x3440('0x73')]],'%s',_0x1344b2):_0x1344b2;if(_0xa2f09e[_0x1772f8][_0x3440('0x74')]){_0x4213e6['group'](_0x1344b2);}_0xa2f09e[_0x1772f8][_0x3440('0x75')]&&_0x4213e6[_0x3440('0x34')](_0x1344b2,_0xa2f09e[_0x1772f8]['orderBy']===_0x3440('0x76')?![]:!![]);_0x4213e6[_0x3440('0x66')](_0x1344b2,_0xa2f09e[_0x1772f8][_0x3440('0x77')]||_0x1344b2);}if(_0x37c158['joins']){_0x37c158[_0x3440('0x78')]=JSON[_0x3440('0x79')](_0x37c158[_0x3440('0x78')]);for(var _0x46d0ba=0x0;_0x46d0ba<_0x37c158[_0x3440('0x78')][_0x3440('0x32')];_0x46d0ba+=0x1){if(_0x37c158[_0x3440('0x78')][_0x46d0ba][_0x3440('0x38')]&&_[_0x3440('0x60')](_0x55a132,_0x37c158[_0x3440('0x78')][_0x46d0ba][_0x3440('0x38')])&&_0x37c158['joins'][_0x46d0ba]['parentKey']&&_0x37c158[_0x3440('0x78')][_0x46d0ba][_0x3440('0x7a')]&&_0x37c158[_0x3440('0x78')][_0x46d0ba][_0x3440('0x7b')]){_0x4213e6[_0x37c158['joins'][_0x46d0ba]['type']](_0x37c158[_0x3440('0x78')][_0x46d0ba][_0x3440('0x7a')],null,util[_0x3440('0x73')](_0x3440('0x7c'),_0x37c158[_0x3440('0x6e')],_0x37c158[_0x3440('0x78')][_0x46d0ba][_0x3440('0x7d')],_0x37c158[_0x3440('0x78')][_0x46d0ba]['foreignTable'],_0x37c158[_0x3440('0x78')][_0x46d0ba][_0x3440('0x7b')]));}}}if(_0x37c158['conditions']){_0x37c158[_0x3440('0x7e')]=JSON[_0x3440('0x79')](_0x37c158['conditions']);_0x4213e6[_0x3440('0x36')](_0x1accbe(_0x37c158['conditions'][_0x3440('0x65')]));}_0x2f4c4d=_0x4213e6[_0x3440('0x7f')]();_0x4213e6[_0x3440('0x1c')](_0x40016c);_0x4213e6['offset'](0x0);logger[_0x3440('0x80')](_0x3440('0x81'),_0x4213e6[_0x3440('0x82')]());return db[_0x3440('0x83')][_0x3440('0x31')](_0x4213e6[_0x3440('0x82')](),{'type':db[_0x3440('0x83')][_0x3440('0x84')]['SELECT']});}})[_0x3440('0x22')](respondWithResult(_0x3576ab,null))[_0x3440('0x40')](handleError(_0x3576ab,null));};function runReport(_0x463641,_0x2f7ee5,_0x11af84){var _0x5352c8=_0x2f7ee5['name'];var _0x1c1b21=0xa;var _0x357c33=['join',_0x3440('0x54'),_0x3440('0x85'),_0x3440('0x55')];var _0x1a7ae3={'SUM':_0x3440('0x56'),'COUNT':_0x3440('0x86'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x3440('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x3440('0x5b'),'GROUP_CONCAT ASC':_0x3440('0x87'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x51f6fa={'SEC_TO_TIME':_0x3440('0x5c'),'DATE':_0x3440('0x88'),'HOUR':_0x3440('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5d9281=function(_0x1e7186){return!_[_0x3440('0x60')]([_0x3440('0x89'),_0x3440('0x61'),_0x3440('0x62'),'IS\x20NOT\x20EMPTY'],_0x1e7186);};var _0x3664d9=function(_0x391a10){if(!_0x391a10||!_0x391a10[_0x3440('0x64')][_0x3440('0x32')]){return'';}for(var _0x2119d6='(',_0x10e939=0x0;_0x10e939<_0x391a10[_0x3440('0x64')][_0x3440('0x32')];_0x10e939+=0x1){_0x10e939>0x0&&(_0x2119d6+='\x20'+_0x391a10[_0x3440('0x8a')]+'\x20');_0x2119d6+=_0x391a10['rules'][_0x10e939][_0x3440('0x65')]?_0x3664d9(_0x391a10['rules'][_0x10e939][_0x3440('0x65')]):_0x391a10[_0x3440('0x64')][_0x10e939][_0x3440('0x66')]+'\x20'+_0x391a10['rules'][_0x10e939]['condition']+(_0x5d9281(_0x391a10[_0x3440('0x64')][_0x10e939][_0x3440('0x8b')])?'\x20'+_0x391a10[_0x3440('0x64')][_0x10e939][_0x3440('0x8c')]:'');}return _0x2119d6+')';};var _0x37d730={'where':{'id':_0x463641['id']}},_0x1a2735,_0x31ca5d,_0x18e3cd,_0x2a5537,_0x25af24;_0x37d730=_[_0x3440('0x3b')]({},_0x37d730,_0x11af84);return db[_0x3440('0x3c')]['find'](_0x37d730)['then'](function(_0x4c1bcf){if(_0x4c1bcf){_0x1a2735=_0x4c1bcf;return _0x4c1bcf[_0x3440('0x67')]();}return null;})[_0x3440('0x22')](function(_0x5a2b2d){if(_0x5a2b2d){if(!_0x5a2b2d[_0x3440('0x32')]){throw new db[(_0x3440('0x68'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x31ca5d=_0x5a2b2d;return db[_0x3440('0x6a')][_0x3440('0x3e')]({'raw':!![]});}return null;})[_0x3440('0x22')](function(_0x2cb3e6){if(_0x2cb3e6){_0x18e3cd=_[_0x3440('0x6b')](_0x2cb3e6,'id');var _0x2f7514;var _0x597d85=squel['select']();_0x597d85['from'](_0x1a2735['table']);for(var _0x3a38dc=0x0;_0x3a38dc<_0x31ca5d[_0x3440('0x32')];_0x3a38dc+=0x1){_0x2f7514=_0x31ca5d[_0x3a38dc][_0x3440('0x6f')]?_0x18e3cd[_0x31ca5d[_0x3a38dc][_0x3440('0x6f')]][_0x3440('0x70')]:_0x31ca5d[_0x3a38dc][_0x3440('0x66')];_0x2f7514=_0x31ca5d[_0x3a38dc]['function']?_['replace'](_0x1a7ae3[_0x31ca5d[_0x3a38dc]['function']],'%s',_0x2f7514):_0x2f7514;_0x2f7514=_0x31ca5d[_0x3a38dc][_0x3440('0x73')]?_['replace'](_0x51f6fa[_0x31ca5d[_0x3a38dc][_0x3440('0x73')]],'%s',_0x2f7514):_0x2f7514;if(_0x31ca5d[_0x3a38dc][_0x3440('0x74')]){_0x597d85[_0x3440('0x65')](_0x2f7514);}_0x31ca5d[_0x3a38dc][_0x3440('0x75')]&&_0x597d85[_0x3440('0x34')](_0x2f7514,_0x31ca5d[_0x3a38dc][_0x3440('0x75')]===_0x3440('0x76')?![]:!![]);_0x597d85[_0x3440('0x66')](_0x2f7514,_0x31ca5d[_0x3a38dc][_0x3440('0x77')]||_0x2f7514);}if(_0x1a2735['joins']){_0x1a2735[_0x3440('0x78')]=JSON[_0x3440('0x79')](_0x1a2735[_0x3440('0x78')]);for(var _0x219b5a=0x0;_0x219b5a<_0x1a2735[_0x3440('0x78')][_0x3440('0x32')];_0x219b5a+=0x1){if(_0x1a2735[_0x3440('0x78')][_0x219b5a][_0x3440('0x38')]&&_[_0x3440('0x60')](_0x357c33,_0x1a2735[_0x3440('0x78')][_0x219b5a]['type'])&&_0x1a2735[_0x3440('0x78')][_0x219b5a]['parentKey']&&_0x1a2735[_0x3440('0x78')][_0x219b5a]['foreignTable']&&_0x1a2735['joins'][_0x219b5a][_0x3440('0x7b')]){_0x597d85[_0x1a2735[_0x3440('0x78')][_0x219b5a]['type']](_0x1a2735[_0x3440('0x78')][_0x219b5a]['foreignTable'],null,util[_0x3440('0x73')](_0x3440('0x7c'),_0x1a2735[_0x3440('0x6e')],_0x1a2735[_0x3440('0x78')][_0x219b5a]['parentKey'],_0x1a2735['joins'][_0x219b5a]['foreignTable'],_0x1a2735[_0x3440('0x78')][_0x219b5a][_0x3440('0x7b')]));}}}if(_0x1a2735[_0x3440('0x7e')]){_0x1a2735['conditions']=JSON['parse'](_0x1a2735[_0x3440('0x7e')]);_0x597d85['where'](_0x3664d9(_0x1a2735[_0x3440('0x7e')]['group']));}_0x25af24=_0x597d85[_0x3440('0x7f')]();_0x597d85[_0x3440('0x1c')](_0x1c1b21);_0x597d85[_0x3440('0x1b')](0x0);logger['debug'](_0x3440('0x81'),_0x597d85['toString']());return db[_0x3440('0x83')][_0x3440('0x31')](_0x597d85[_0x3440('0x82')](),{'type':db[_0x3440('0x83')][_0x3440('0x84')][_0x3440('0x8d')]});}})[_0x3440('0x22')](function(_0x35e239){if(!_0x35e239[_0x3440('0x32')]){throw new db[(_0x3440('0x68'))]['ValidationErrorItem']('No\x20available\x20data',0xcc);}if(_0x2f7ee5[_0x3440('0x8e')]===_0x3440('0x8f')){return null;}var _0x91b15f=_[_0x3440('0x3b')](_0x2f7ee5,{'name':_0x2f7ee5[_0x3440('0x90')]||_0x2f7ee5[_0x3440('0x28')]||_0x1a2735['name'],'basename':_0x5352c8,'savename':util[_0x3440('0x73')](_0x3440('0x91'),_0x2f7ee5[_0x3440('0x28')]||_0x1a2735[_0x3440('0x28')],require(_0x3440('0x92'))[_0x3440('0x93')](0x4),_0x2f7ee5[_0x3440('0x8e')]||_0x3440('0x94')),'reportId':_0x1a2735['id'],'reportType':_0x3440('0x95')});return db['AnalyticExtractedReport'][_0x3440('0x46')](_0x91b15f,{'raw':!![]});})[_0x3440('0x22')](function(_0xf80fdb){if(_0x1a2735[_0x3440('0x6e')]===_0x3440('0x96')){_0x25af24[_0x3440('0x36')](_0x1a2735[_0x3440('0x6e')]+_0x3440('0x97'),_0x2f7ee5[_0x3440('0x98')],_0x2f7ee5['endDate']);}else{_0x25af24[_0x3440('0x36')](_0x1a2735[_0x3440('0x6e')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2f7ee5[_0x3440('0x98')],_0x2f7ee5[_0x3440('0x99')]);}if(_0xf80fdb){logger[_0x3440('0x9a')](_0x3440('0x9b'),_0x25af24[_0x3440('0x82')]());require('child_process')['fork'](path[_0x3440('0x53')](__dirname,_0x3440('0x9c'),_0xf80fdb[_0x3440('0x8e')]),[_0xf80fdb['id'],_0x25af24[_0x3440('0x82')](),path[_0x3440('0x53')](__dirname,_0x3440('0x9d'),_0xf80fdb[_0x3440('0x9e')]),_0x5352c8]);return _0xf80fdb;}else{var _0x9f41f2=squel[_0x3440('0x6c')]();_0x9f41f2[_0x3440('0x6d')]('('+_0x25af24[_0x3440('0x82')]()+')',_0x3440('0x9f'));_0x9f41f2[_0x3440('0x66')](_0x3440('0xa0'),_0x3440('0x1a'));_0x25af24['limit'](_0x2f7ee5[_0x3440('0x1c')]||_0x1c1b21);_0x25af24[_0x3440('0x1b')](_0x2f7ee5[_0x3440('0x1b')]||0x0);return dbH[_0x3440('0x83')][_0x3440('0x31')](_0x9f41f2[_0x3440('0x82')](),{'type':dbH[_0x3440('0x83')][_0x3440('0x84')]['SELECT']})[_0x3440('0x22')](function(_0x452093){if(!_0x452093[_0x3440('0x32')]){_0x2a5537=0x0;}else{_0x2a5537=_0x452093[0x0][_0x3440('0x1a')]||0x0;}return dbH[_0x3440('0x83')][_0x3440('0x31')](_0x25af24['toString'](),{'type':dbH['sequelize'][_0x3440('0x84')]['SELECT']});})[_0x3440('0x22')](function(_0x41740a){return{'rows':_0x41740a||[],'count':_0x2a5537};});}});}exports['run']=function(_0x20f208,_0x406b00){return runReport(_0x20f208[_0x3440('0x51')],_0x20f208['query'],_0x20f208[_0x3440('0x45')])[_0x3440('0x22')](respondWithResult(_0x406b00,null))[_0x3440('0x40')](handleError(_0x406b00,null));};exports[_0x3440('0xa1')]=runReport;exports[_0x3440('0x31')]=function(_0x5d8410,_0xb020c3){var _0x2c7da1=0xa;var _0x44e8da=[_0x3440('0x53'),_0x3440('0x54'),_0x3440('0x85'),'cross_join'];var _0x445193={'SUM':_0x3440('0x56'),'COUNT':_0x3440('0x86'),'COUNT DISTINCT':_0x3440('0x57'),'MAX':_0x3440('0x58'),'MIN':_0x3440('0x59'),'AVG':_0x3440('0x5a'),'GROUP_CONCAT':_0x3440('0x5b'),'GROUP_CONCAT ASC':_0x3440('0x87'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4f4ad4={'SEC_TO_TIME':_0x3440('0x5c'),'DATE':'DATE(%s)','HOUR':_0x3440('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xfdccbe=function(_0x307d0e){return!_['includes']([_0x3440('0x89'),_0x3440('0x61'),'IS\x20EMPTY',_0x3440('0x63')],_0x307d0e);};var _0x2c0fe9=function(_0xa24af){if(!_0xa24af||!_0xa24af[_0x3440('0x64')][_0x3440('0x32')]){return'';}for(var _0x1bba0e='(',_0x4b8543=0x0;_0x4b8543<_0xa24af[_0x3440('0x64')][_0x3440('0x32')];_0x4b8543+=0x1){_0x4b8543>0x0&&(_0x1bba0e+='\x20'+_0xa24af[_0x3440('0x8a')]+'\x20');_0x1bba0e+=_0xa24af[_0x3440('0x64')][_0x4b8543][_0x3440('0x65')]?_0x2c0fe9(_0xa24af[_0x3440('0x64')][_0x4b8543][_0x3440('0x65')]):_0xa24af[_0x3440('0x64')][_0x4b8543][_0x3440('0x66')]+'\x20'+_0xa24af[_0x3440('0x64')][_0x4b8543][_0x3440('0x8b')]+(_0xfdccbe(_0xa24af[_0x3440('0x64')][_0x4b8543][_0x3440('0x8b')])?'\x20'+_0xa24af[_0x3440('0x64')][_0x4b8543][_0x3440('0x8c')]:'');}return _0x1bba0e+')';};var _0x386a1a={'where':{'id':_0x5d8410[_0x3440('0x51')]['id']}},_0x535b5a,_0x3bff2e,_0x8d71c,_0x56d8e2,_0x1d2d4a;_0x386a1a=_['merge']({},_0x386a1a,_0x5d8410[_0x3440('0x45')]);return db['AnalyticCustomReport'][_0x3440('0x4d')](_0x386a1a)[_0x3440('0x22')](function(_0x46dd79){if(_0x46dd79){_0x535b5a=_0x46dd79;return _0x46dd79[_0x3440('0x67')]();}return null;})[_0x3440('0x22')](function(_0x2f8f9d){if(_0x2f8f9d){if(!_0x2f8f9d[_0x3440('0x32')]){throw new db[(_0x3440('0x68'))][(_0x3440('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3bff2e=_0x2f8f9d;return db[_0x3440('0x6a')][_0x3440('0x3e')]({'raw':!![]});}return null;})[_0x3440('0x22')](function(_0x1e83a1){if(_0x1e83a1){_0x8d71c=_[_0x3440('0x6b')](_0x1e83a1,'id');var _0x21b905;var _0x16e272=squel[_0x3440('0x6c')]();_0x16e272[_0x3440('0x6d')](_0x535b5a[_0x3440('0x6e')]);for(var _0x396480=0x0;_0x396480<_0x3bff2e['length'];_0x396480+=0x1){_0x21b905=_0x3bff2e[_0x396480]['MetricId']?_0x8d71c[_0x3bff2e[_0x396480][_0x3440('0x6f')]][_0x3440('0x70')]:_0x3bff2e[_0x396480][_0x3440('0x66')];_0x21b905=_0x3bff2e[_0x396480]['function']?_[_0x3440('0x72')](_0x445193[_0x3bff2e[_0x396480][_0x3440('0x71')]],'%s',_0x21b905):_0x21b905;_0x21b905=_0x3bff2e[_0x396480][_0x3440('0x73')]?_['replace'](_0x4f4ad4[_0x3bff2e[_0x396480][_0x3440('0x73')]],'%s',_0x21b905):_0x21b905;if(_0x3bff2e[_0x396480]['groupBy']){_0x16e272[_0x3440('0x65')](_0x21b905);}_0x3bff2e[_0x396480][_0x3440('0x75')]&&_0x16e272['order'](_0x21b905,_0x3bff2e[_0x396480][_0x3440('0x75')]===_0x3440('0x76')?![]:!![]);_0x16e272[_0x3440('0x66')](_0x21b905,_0x3bff2e[_0x396480][_0x3440('0x77')]||_0x21b905);}if(_0x535b5a[_0x3440('0x78')]){_0x535b5a[_0x3440('0x78')]=JSON[_0x3440('0x79')](_0x535b5a[_0x3440('0x78')]);for(var _0x3d4c81=0x0;_0x3d4c81<_0x535b5a[_0x3440('0x78')][_0x3440('0x32')];_0x3d4c81+=0x1){if(_0x535b5a['joins'][_0x3d4c81][_0x3440('0x38')]&&_[_0x3440('0x60')](_0x44e8da,_0x535b5a['joins'][_0x3d4c81][_0x3440('0x38')])&&_0x535b5a[_0x3440('0x78')][_0x3d4c81][_0x3440('0x7d')]&&_0x535b5a[_0x3440('0x78')][_0x3d4c81][_0x3440('0x7a')]&&_0x535b5a[_0x3440('0x78')][_0x3d4c81][_0x3440('0x7b')]){_0x16e272[_0x535b5a['joins'][_0x3d4c81][_0x3440('0x38')]](_0x535b5a[_0x3440('0x78')][_0x3d4c81][_0x3440('0x7a')],null,util[_0x3440('0x73')]('%s.%s\x20=\x20%s.%s',_0x535b5a[_0x3440('0x6e')],_0x535b5a[_0x3440('0x78')][_0x3d4c81][_0x3440('0x7d')],_0x535b5a[_0x3440('0x78')][_0x3d4c81][_0x3440('0x7a')],_0x535b5a[_0x3440('0x78')][_0x3d4c81]['foreignKey']));}}}if(_0x535b5a[_0x3440('0x7e')]){_0x535b5a['conditions']=JSON[_0x3440('0x79')](_0x535b5a[_0x3440('0x7e')]);_0x16e272['where'](_0x2c0fe9(_0x535b5a[_0x3440('0x7e')][_0x3440('0x65')]));}_0x1d2d4a=_0x16e272[_0x3440('0x7f')]();_0x16e272[_0x3440('0x1c')](_0x2c7da1);_0x16e272[_0x3440('0x1b')](0x0);logger[_0x3440('0x80')](_0x3440('0x81'),_0x16e272[_0x3440('0x82')]());return db[_0x3440('0x83')]['query'](_0x16e272[_0x3440('0x82')](),{'type':db[_0x3440('0x83')][_0x3440('0x84')][_0x3440('0x8d')]});}})[_0x3440('0x22')](function(){return{'sql':_0x1d2d4a[_0x3440('0x82')]()};})[_0x3440('0x22')](respondWithResult(_0xb020c3,null))[_0x3440('0x40')](handleError(_0xb020c3,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index db04603..11c0dfa 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 _0x4317=['./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4cbd7b,_0x5ee2e6){var _0x2e8d7a=function(_0x49752c){while(--_0x49752c){_0x4cbd7b['push'](_0x4cbd7b['shift']());}};_0x2e8d7a(++_0x5ee2e6);}(_0x4317,0x7c));var _0x7431=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x4317[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x7431('0x0'));var logger=require(_0x7431('0x1'))(_0x7431('0x2'));var moment=require('moment');var BPromise=require(_0x7431('0x3'));var rp=require(_0x7431('0x4'));var fs=require('fs');var path=require(_0x7431('0x5'));var rimraf=require(_0x7431('0x6'));var config=require(_0x7431('0x7'));var attributes=require(_0x7431('0x8'));module['exports']=function(_0x57adc1,_0x1e1f35){return _0x57adc1[_0x7431('0x9')](_0x7431('0xa'),attributes,{'tableName':_0x7431('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2b5=['../../config/environment','./analyticCustomReport.attributes','AnalyticCustomReport','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3fa209,_0x10f34f){var _0x4b5189=function(_0x59e905){while(--_0x59e905){_0x3fa209['push'](_0x3fa209['shift']());}};_0x4b5189(++_0x10f34f);}(_0xa2b5,0x142));var _0x5a2b=function(_0x403425,_0x51c6a2){_0x403425=_0x403425-0x0;var _0x22b7e7=_0xa2b5[_0x403425];return _0x22b7e7;};'use strict';var _=require(_0x5a2b('0x0'));var util=require('util');var logger=require(_0x5a2b('0x1'))(_0x5a2b('0x2'));var moment=require(_0x5a2b('0x3'));var BPromise=require(_0x5a2b('0x4'));var rp=require(_0x5a2b('0x5'));var fs=require('fs');var path=require(_0x5a2b('0x6'));var rimraf=require(_0x5a2b('0x7'));var config=require(_0x5a2b('0x8'));var attributes=require(_0x5a2b('0x9'));module['exports']=function(_0x3c8539,_0x473113){return _0x3c8539['define'](_0x5a2b('0xa'),attributes,{'tableName':'analytics_custom_reports','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 7bf97c8..8c4538c 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 _0xa377=['then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xa377,0x172));var _0x7a37=function(_0x41b31a,_0x338c1f){_0x41b31a=_0x41b31a-0x0;var _0x2a2554=_0xa377[_0x41b31a];return _0x2a2554;};'use strict';var _=require(_0x7a37('0x0'));var util=require(_0x7a37('0x1'));var moment=require(_0x7a37('0x2'));var BPromise=require('bluebird');var rs=require(_0x7a37('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7a37('0x4'));var logger=require(_0x7a37('0x5'))(_0x7a37('0x6'));var config=require(_0x7a37('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7a37('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32e271,_0x94cee3,_0x3f5bff){return new BPromise(function(_0x86c01f,_0x123b25){return client[_0x7a37('0x9')](_0x32e271,_0x3f5bff)[_0x7a37('0xa')](function(_0x39b22b){logger[_0x7a37('0xb')](_0x7a37('0xc'),_0x94cee3,_0x7a37('0xd'));logger[_0x7a37('0xe')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x94cee3,'request\x20sent',JSON[_0x7a37('0xf')](_0x39b22b));if(_0x39b22b[_0x7a37('0x10')]){if(_0x39b22b['error'][_0x7a37('0x11')]===0x1f4){logger[_0x7a37('0x10')](_0x7a37('0xc'),_0x94cee3,_0x39b22b[_0x7a37('0x10')][_0x7a37('0x12')]);return _0x123b25(_0x39b22b['error']['message']);}logger[_0x7a37('0x10')](_0x7a37('0xc'),_0x94cee3,_0x39b22b[_0x7a37('0x10')][_0x7a37('0x12')]);return _0x86c01f(_0x39b22b[_0x7a37('0x10')]['message']);}else{logger['info'](_0x7a37('0xc'),_0x94cee3,'request\x20sent');_0x86c01f(_0x39b22b['result'][_0x7a37('0x12')]);}})[_0x7a37('0x13')](function(_0x2f3fb6){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x94cee3,_0x2f3fb6);_0x123b25(_0x2f3fb6);});});} \ No newline at end of file +var _0x279c=['../../config/logger','rpc','../../config/environment','jayson/promise','then','info','AnalyticCustomReport,\x20%s,\x20%s','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x88db2c,_0x20898b){var _0x58cb16=function(_0x4bfea7){while(--_0x4bfea7){_0x88db2c['push'](_0x88db2c['shift']());}};_0x58cb16(++_0x20898b);}(_0x279c,0x1f1));var _0xc279=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x279c[_0x39e84d];return _0x1991bc;};'use strict';var _=require(_0xc279('0x0'));var util=require(_0xc279('0x1'));var moment=require(_0xc279('0x2'));var BPromise=require('bluebird');var rs=require(_0xc279('0x3'));var fs=require('fs');var Redis=require(_0xc279('0x4'));var db=require(_0xc279('0x5'))['db'];var utils=require(_0xc279('0x6'));var logger=require(_0xc279('0x7'))(_0xc279('0x8'));var config=require(_0xc279('0x9'));var jayson=require(_0xc279('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x91bc06,_0x18f799,_0x2c3620){return new BPromise(function(_0x24a4d4,_0x25607c){return client['request'](_0x91bc06,_0x2c3620)[_0xc279('0xb')](function(_0x3b85bc){logger[_0xc279('0xc')](_0xc279('0xd'),_0x18f799,'request\x20sent');logger['debug'](_0xc279('0xe'),_0x18f799,_0xc279('0xf'),JSON[_0xc279('0x10')](_0x3b85bc));if(_0x3b85bc[_0xc279('0x11')]){if(_0x3b85bc[_0xc279('0x11')][_0xc279('0x12')]===0x1f4){logger[_0xc279('0x11')](_0xc279('0xd'),_0x18f799,_0x3b85bc[_0xc279('0x11')][_0xc279('0x13')]);return _0x25607c(_0x3b85bc[_0xc279('0x11')]['message']);}logger[_0xc279('0x11')](_0xc279('0xd'),_0x18f799,_0x3b85bc[_0xc279('0x11')][_0xc279('0x13')]);return _0x24a4d4(_0x3b85bc[_0xc279('0x11')][_0xc279('0x13')]);}else{logger[_0xc279('0xc')](_0xc279('0xd'),_0x18f799,_0xc279('0xf'));_0x24a4d4(_0x3b85bc['result']['message']);}})[_0xc279('0x14')](function(_0x13c3bb){logger['error'](_0xc279('0xd'),_0x18f799,_0x13c3bb);_0x25607c(_0x13c3bb);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 64ce1f6..8322296 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 _0x84ff=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','show','preview','run','/:id/query','query','post','put','update','delete','/:id','destroy','exports','multer'];(function(_0x3969ff,_0x17cf26){var _0x193c32=function(_0x5afabe){while(--_0x5afabe){_0x3969ff['push'](_0x3969ff['shift']());}};_0x193c32(++_0x17cf26);}(_0x84ff,0xef));var _0xf84f=function(_0x3ce56d,_0x986c71){_0x3ce56d=_0x3ce56d-0x0;var _0x13a48a=_0x84ff[_0x3ce56d];return _0x13a48a;};'use strict';var multer=require(_0xf84f('0x0'));var util=require(_0xf84f('0x1'));var path=require(_0xf84f('0x2'));var timeout=require('connect-timeout');var express=require(_0xf84f('0x3'));var router=express[_0xf84f('0x4')]();var auth=require(_0xf84f('0x5'));var interaction=require(_0xf84f('0x6'));var config=require(_0xf84f('0x7'));var controller=require(_0xf84f('0x8'));router[_0xf84f('0x9')]('/',auth[_0xf84f('0xa')](),controller[_0xf84f('0xb')]);router['get']('/:id',auth[_0xf84f('0xa')](),controller[_0xf84f('0xc')]);router[_0xf84f('0x9')]('/:id/preview',auth['isAuthenticated'](),controller[_0xf84f('0xd')]);router['get']('/:id/run',auth['isAuthenticated'](),controller[_0xf84f('0xe')]);router[_0xf84f('0x9')](_0xf84f('0xf'),auth['isAuthenticated'](),controller[_0xf84f('0x10')]);router[_0xf84f('0x11')]('/',auth[_0xf84f('0xa')](),controller['create']);router[_0xf84f('0x12')]('/:id',auth[_0xf84f('0xa')](),controller[_0xf84f('0x13')]);router[_0xf84f('0x14')](_0xf84f('0x15'),auth['isAuthenticated'](),controller[_0xf84f('0x16')]);module[_0xf84f('0x17')]=router; \ No newline at end of file +var _0xa5f9=['index','show','/:id/preview','/:id/run','run','/:id/query','post','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated'];(function(_0x25eedd,_0x2c0186){var _0x30af64=function(_0x22c94a){while(--_0x22c94a){_0x25eedd['push'](_0x25eedd['shift']());}};_0x30af64(++_0x2c0186);}(_0xa5f9,0x1af));var _0x9a5f=function(_0x5290b6,_0x8aa8ed){_0x5290b6=_0x5290b6-0x0;var _0x134d64=_0xa5f9[_0x5290b6];return _0x134d64;};'use strict';var multer=require(_0x9a5f('0x0'));var util=require(_0x9a5f('0x1'));var path=require(_0x9a5f('0x2'));var timeout=require(_0x9a5f('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x9a5f('0x4'));var interaction=require(_0x9a5f('0x5'));var config=require('../../config/environment');var controller=require(_0x9a5f('0x6'));router[_0x9a5f('0x7')]('/',auth[_0x9a5f('0x8')](),controller[_0x9a5f('0x9')]);router[_0x9a5f('0x7')]('/:id',auth[_0x9a5f('0x8')](),controller[_0x9a5f('0xa')]);router[_0x9a5f('0x7')](_0x9a5f('0xb'),auth['isAuthenticated'](),controller['preview']);router[_0x9a5f('0x7')](_0x9a5f('0xc'),auth[_0x9a5f('0x8')](),controller[_0x9a5f('0xd')]);router[_0x9a5f('0x7')](_0x9a5f('0xe'),auth[_0x9a5f('0x8')](),controller['query']);router[_0x9a5f('0xf')]('/',auth['isAuthenticated'](),controller[_0x9a5f('0x10')]);router[_0x9a5f('0x11')]('/:id',auth[_0x9a5f('0x8')](),controller[_0x9a5f('0x12')]);router[_0x9a5f('0x13')](_0x9a5f('0x14'),auth[_0x9a5f('0x8')](),controller['destroy']);module[_0x9a5f('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 6c88f93..e9b66de 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 _0x34c2=['STRING','TEXT','sequelize'];(function(_0x680b65,_0x5b2e9c){var _0x1c2053=function(_0x1128e0){while(--_0x1128e0){_0x680b65['push'](_0x680b65['shift']());}};_0x1c2053(++_0x5b2e9c);}(_0x34c2,0x6b));var _0x234c=function(_0x91ff52,_0x2cde3c){_0x91ff52=_0x91ff52-0x0;var _0x37d193=_0x34c2[_0x91ff52];return _0x37d193;};'use strict';var Sequelize=require(_0x234c('0x0'));module['exports']={'name':{'type':Sequelize[_0x234c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x234c('0x1')]},'parent':{'type':Sequelize[_0x234c('0x1')]},'table':{'type':Sequelize[_0x234c('0x1')]},'conditions':{'type':Sequelize[_0x234c('0x2')]},'joins':{'type':Sequelize[_0x234c('0x2')]}}; \ No newline at end of file +var _0x14fb=['TEXT','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14fb,0x95));var _0xb14f=function(_0x2bb04e,_0x13112e){_0x2bb04e=_0x2bb04e-0x0;var _0x52d47a=_0x14fb[_0x2bb04e];return _0x52d47a;};'use strict';var Sequelize=require(_0xb14f('0x0'));module[_0xb14f('0x1')]={'name':{'type':Sequelize[_0xb14f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb14f('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0xb14f('0x2')]},'conditions':{'type':Sequelize[_0xb14f('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 75ecc03..8dd6f1a 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 _0x6dc1=['Run\x20Query:','child_process','fork','join','../../components/export/','../../files/reports','savename','run','runReport','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','dbH','sendStatus','end','status','json','count','limit','set','Content-Range','save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','filter','merge','includeAll','params','keys','include','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','left_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','getFields','AnalyticMetric','select','QueryTypes','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info'];(function(_0x347862,_0x339566){var _0x2ec88b=function(_0x290bdc){while(--_0x290bdc){_0x347862['push'](_0x347862['shift']());}};_0x2ec88b(++_0x339566);}(_0x6dc1,0xac));var _0x16dc=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x6dc1[_0x1d24eb];return _0x1dc576;};'use strict';var pdf=require(_0x16dc('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x16dc('0x1'));var zipdir=require(_0x16dc('0x2'));var jsonpatch=require(_0x16dc('0x3'));var rp=require(_0x16dc('0x4'));var moment=require(_0x16dc('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x16dc('0x6'));var sox=require(_0x16dc('0x7'));var csv=require(_0x16dc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x16dc('0x9'));var squel=require(_0x16dc('0xa'));var crypto=require(_0x16dc('0xb'));var jsforce=require(_0x16dc('0xc'));var deskjs=require(_0x16dc('0xd'));var toCsv=require(_0x16dc('0x8'));var querystring=require(_0x16dc('0xe'));var Papa=require(_0x16dc('0xf'));var Redis=require(_0x16dc('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x16dc('0x11'));var hardwareService=require(_0x16dc('0x12'));var logger=require('../../config/logger')(_0x16dc('0x13'));var utils=require('../../config/utils');var config=require(_0x16dc('0x14'));var db=require(_0x16dc('0x15'))['db'];var dbH=require(_0x16dc('0x15'))[_0x16dc('0x16')];function respondWithStatusCode(_0x8bc22d,_0x2569d7){_0x2569d7=_0x2569d7||0xcc;return function(_0x3a5a33){if(_0x3a5a33){return _0x8bc22d[_0x16dc('0x17')](_0x2569d7);}return _0x8bc22d['status'](_0x2569d7)[_0x16dc('0x18')]();};}function respondWithResult(_0x813247,_0x54e01a){_0x54e01a=_0x54e01a||0xc8;return function(_0xfb403){if(_0xfb403){return _0x813247[_0x16dc('0x19')](_0x54e01a)[_0x16dc('0x1a')](_0xfb403);}};}function respondWithFilteredResult(_0x53a09,_0x43086d){return function(_0x1a1739){if(_0x1a1739){var _0x376c75=_0x1a1739[_0x16dc('0x1b')],_0x11e97c=_0x43086d['offset'],_0x4b7e6c=_0x43086d['offset']+_0x43086d[_0x16dc('0x1c')],_0x457baf;if(_0x4b7e6c>=_0x376c75){_0x4b7e6c=_0x376c75;_0x457baf=0xc8;}else{_0x457baf=0xce;}_0x53a09[_0x16dc('0x19')](_0x457baf);return _0x53a09[_0x16dc('0x1d')](_0x16dc('0x1e'),_0x11e97c+'-'+_0x4b7e6c+'/'+_0x376c75)[_0x16dc('0x1a')](_0x1a1739);}return null;};}function patchUpdates(_0x4f3a60){return function(_0x3dd8f7){try{jsonpatch['apply'](_0x3dd8f7,_0x4f3a60,!![]);}catch(_0xa63798){return BPromise['reject'](_0xa63798);}return _0x3dd8f7[_0x16dc('0x1f')]();};}function saveUpdates(_0xdd445b,_0x3e449a){return function(_0x12be93){if(_0x12be93){return _0x12be93['update'](_0xdd445b)[_0x16dc('0x20')](function(_0x3961b9){return _0x3961b9;});}return null;};}function removeEntity(_0x388c2b,_0x59adb8){return function(_0x297ac0){if(_0x297ac0){return _0x297ac0[_0x16dc('0x21')]()[_0x16dc('0x20')](function(){var _0x84150b=_0x297ac0[_0x16dc('0x22')]({'plain':!![]});var _0x2ae8dc=_0x16dc('0x23');return db[_0x16dc('0x24')][_0x16dc('0x21')]({'where':{'type':_0x2ae8dc,'resourceId':_0x84150b['id']}})[_0x16dc('0x20')](function(){return _0x297ac0;});})[_0x16dc('0x20')](function(){_0x388c2b[_0x16dc('0x19')](0xcc)[_0x16dc('0x18')]();});}};}function handleEntityNotFound(_0x2dd0e0,_0x1b252f){return function(_0x1b9c15){if(!_0x1b9c15){_0x2dd0e0[_0x16dc('0x17')](0x194);}return _0x1b9c15;};}function handleError(_0x176783,_0x361d76){_0x361d76=_0x361d76||0x1f4;return function(_0x1c4fe5){logger[_0x16dc('0x25')](_0x1c4fe5['stack']);if(_0x1c4fe5[_0x16dc('0x26')]){delete _0x1c4fe5[_0x16dc('0x26')];}_0x176783[_0x16dc('0x19')](_0x361d76)[_0x16dc('0x27')](_0x1c4fe5);};}exports[_0x16dc('0x28')]=function(_0x43607a,_0x385e4d){var _0x2db06d={},_0x3859af={},_0x229a8b={'count':0x0,'rows':[]};var _0x2a71c1=_[_0x16dc('0x29')](db[_0x16dc('0x2a')][_0x16dc('0x2b')],function(_0x110824){return{'name':_0x110824[_0x16dc('0x2c')],'type':_0x110824[_0x16dc('0x2d')][_0x16dc('0x2e')]};});_0x3859af[_0x16dc('0x2f')]=_[_0x16dc('0x29')](_0x2a71c1,_0x16dc('0x26'));_0x3859af[_0x16dc('0x30')]=_['keys'](_0x43607a[_0x16dc('0x30')]);_0x3859af['filters']=_[_0x16dc('0x31')](_0x3859af['model'],_0x3859af[_0x16dc('0x30')]);_0x2db06d[_0x16dc('0x32')]=_['intersection'](_0x3859af['model'],qs['fields'](_0x43607a['query']['fields']));_0x2db06d['attributes']=_0x2db06d[_0x16dc('0x32')][_0x16dc('0x33')]?_0x2db06d[_0x16dc('0x32')]:_0x3859af[_0x16dc('0x2f')];if(!_0x43607a[_0x16dc('0x30')][_0x16dc('0x34')](_0x16dc('0x35'))){_0x2db06d['limit']=qs['limit'](_0x43607a[_0x16dc('0x30')][_0x16dc('0x1c')]);_0x2db06d[_0x16dc('0x36')]=qs[_0x16dc('0x36')](_0x43607a[_0x16dc('0x30')][_0x16dc('0x36')]);}_0x2db06d[_0x16dc('0x37')]=qs[_0x16dc('0x38')](_0x43607a[_0x16dc('0x30')][_0x16dc('0x38')]);_0x2db06d[_0x16dc('0x39')]=qs[_0x16dc('0x3a')](_['pick'](_0x43607a[_0x16dc('0x30')],_0x3859af[_0x16dc('0x3a')]),_0x2a71c1);if(_0x43607a[_0x16dc('0x30')][_0x16dc('0x3b')]){_0x2db06d['where']=_[_0x16dc('0x3c')](_0x2db06d[_0x16dc('0x39')],{'$or':_['map'](_0x2a71c1,function(_0xf80ad1){if(_0xf80ad1[_0x16dc('0x2d')]!=='VIRTUAL'){var _0x5c591a={};_0x5c591a[_0xf80ad1[_0x16dc('0x26')]]={'$like':'%'+_0x43607a['query'][_0x16dc('0x3b')]+'%'};return _0x5c591a;}})});}_0x2db06d=_[_0x16dc('0x3c')]({},_0x2db06d,_0x43607a['options']);var _0x56721c={'where':_0x2db06d[_0x16dc('0x39')]};return db[_0x16dc('0x2a')][_0x16dc('0x1b')](_0x56721c)[_0x16dc('0x20')](function(_0x2f4c38){_0x229a8b[_0x16dc('0x1b')]=_0x2f4c38;if(_0x43607a[_0x16dc('0x30')][_0x16dc('0x3d')]){_0x2db06d['include']=[{'all':!![]}];}return db[_0x16dc('0x2a')]['findAll'](_0x2db06d);})[_0x16dc('0x20')](function(_0x11a2ee){_0x229a8b['rows']=_0x11a2ee;return _0x229a8b;})['then'](respondWithFilteredResult(_0x385e4d,_0x2db06d))['catch'](handleError(_0x385e4d,null));};exports['show']=function(_0x1ce037,_0x4e4097){var _0x1eae55={'raw':!![],'where':{'id':_0x1ce037[_0x16dc('0x3e')]['id']}},_0x52d37c={};_0x52d37c[_0x16dc('0x2f')]=_['keys'](db[_0x16dc('0x2a')][_0x16dc('0x2b')]);_0x52d37c[_0x16dc('0x30')]=_[_0x16dc('0x3f')](_0x1ce037['query']);_0x52d37c[_0x16dc('0x3a')]=_[_0x16dc('0x31')](_0x52d37c[_0x16dc('0x2f')],_0x52d37c[_0x16dc('0x30')]);_0x1eae55[_0x16dc('0x32')]=_[_0x16dc('0x31')](_0x52d37c['model'],qs['fields'](_0x1ce037[_0x16dc('0x30')]['fields']));_0x1eae55[_0x16dc('0x32')]=_0x1eae55[_0x16dc('0x32')][_0x16dc('0x33')]?_0x1eae55[_0x16dc('0x32')]:_0x52d37c['model'];if(_0x1ce037[_0x16dc('0x30')][_0x16dc('0x3d')]){_0x1eae55[_0x16dc('0x40')]=[{'all':!![]}];}_0x1eae55=_[_0x16dc('0x3c')]({},_0x1eae55,_0x1ce037[_0x16dc('0x41')]);return db[_0x16dc('0x2a')][_0x16dc('0x42')](_0x1eae55)['then'](handleEntityNotFound(_0x4e4097,null))[_0x16dc('0x20')](respondWithResult(_0x4e4097,null))[_0x16dc('0x43')](handleError(_0x4e4097,null));};exports[_0x16dc('0x44')]=function(_0x393819,_0x30f863){return db['AnalyticDefaultReport']['create'](_0x393819[_0x16dc('0x45')],{})[_0x16dc('0x20')](function(_0x4be995){var _0x508c66=_0x393819[_0x16dc('0x46')][_0x16dc('0x22')]({'plain':!![]});if(!_0x508c66)throw new Error(_0x16dc('0x47'));if(_0x508c66[_0x16dc('0x48')]===_0x16dc('0x46')){var _0x2c03b2=_0x4be995[_0x16dc('0x22')]({'plain':!![]});var _0x105a05=_0x16dc('0x49');return db[_0x16dc('0x4a')][_0x16dc('0x42')]({'where':{'name':_0x105a05,'userProfileId':_0x508c66[_0x16dc('0x4b')]},'raw':!![]})['then'](function(_0x12ae0d){if(_0x12ae0d&&_0x12ae0d[_0x16dc('0x4c')]===0x0){return db['UserProfileResource'][_0x16dc('0x44')]({'name':_0x2c03b2[_0x16dc('0x26')],'resourceId':_0x2c03b2['id'],'type':'DefaultReports','sectionId':_0x12ae0d['id']},{})[_0x16dc('0x20')](function(){return _0x4be995;});}else{return _0x4be995;}})[_0x16dc('0x43')](function(_0x5abe49){logger[_0x16dc('0x25')](_0x16dc('0x4d'),_0x5abe49);throw _0x5abe49;});}return _0x4be995;})[_0x16dc('0x20')](respondWithResult(_0x30f863,0xc9))['catch'](handleError(_0x30f863,null));};exports['update']=function(_0x254e01,_0x1065ef){if(_0x254e01[_0x16dc('0x45')]['id']){delete _0x254e01[_0x16dc('0x45')]['id'];}return db[_0x16dc('0x2a')][_0x16dc('0x42')]({'where':{'id':_0x254e01[_0x16dc('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1065ef,null))['then'](saveUpdates(_0x254e01['body'],null))[_0x16dc('0x20')](respondWithResult(_0x1065ef,null))[_0x16dc('0x43')](handleError(_0x1065ef,null));};exports[_0x16dc('0x21')]=function(_0x431d4f,_0xe955ae){return db[_0x16dc('0x2a')][_0x16dc('0x42')]({'where':{'id':_0x431d4f[_0x16dc('0x3e')]['id']}})[_0x16dc('0x20')](handleEntityNotFound(_0xe955ae,null))[_0x16dc('0x20')](removeEntity(_0xe955ae,null))[_0x16dc('0x43')](handleError(_0xe955ae,null));};exports[_0x16dc('0x4e')]=function(_0x42c899,_0x784c23){var _0x3ec6c0=0xa;var _0x4a78a9=['join','left_join',_0x16dc('0x4f'),_0x16dc('0x50')];var _0x45b40b={'SUM':_0x16dc('0x51'),'COUNT':_0x16dc('0x52'),'COUNT DISTINCT':_0x16dc('0x53'),'MAX':_0x16dc('0x54'),'MIN':_0x16dc('0x55'),'AVG':_0x16dc('0x56'),'GROUP_CONCAT':_0x16dc('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x16dc('0x58')};var _0x5d6d6f={'SEC_TO_TIME':_0x16dc('0x59'),'DATE':_0x16dc('0x5a'),'HOUR':_0x16dc('0x5b'),'ROUND':_0x16dc('0x5c'),'UNIX_TIMESTAMP':_0x16dc('0x5d')};var _0x393901=function(_0x54d5fc){return!_['includes']([_0x16dc('0x5e'),'IS\x20NOT\x20NULL',_0x16dc('0x5f'),_0x16dc('0x60')],_0x54d5fc);};var _0x2825ce=function(_0xb43a90){if(!_0xb43a90||!_0xb43a90['rules'][_0x16dc('0x33')]){return'';}for(var _0xfaf57b='(',_0x3c3dfc=0x0;_0x3c3dfc<_0xb43a90[_0x16dc('0x61')][_0x16dc('0x33')];_0x3c3dfc+=0x1){_0x3c3dfc>0x0&&(_0xfaf57b+='\x20'+_0xb43a90[_0x16dc('0x62')]+'\x20');_0xfaf57b+=_0xb43a90[_0x16dc('0x61')][_0x3c3dfc]['group']?_0x2825ce(_0xb43a90[_0x16dc('0x61')][_0x3c3dfc][_0x16dc('0x63')]):_0xb43a90[_0x16dc('0x61')][_0x3c3dfc][_0x16dc('0x64')]+'\x20'+_0xb43a90[_0x16dc('0x61')][_0x3c3dfc]['condition']+(_0x393901(_0xb43a90['rules'][_0x3c3dfc][_0x16dc('0x65')])?'\x20'+_0xb43a90[_0x16dc('0x61')][_0x3c3dfc][_0x16dc('0x66')]:'');}return _0xfaf57b+')';};var _0x50e8dc={'where':{'id':_0x42c899[_0x16dc('0x3e')]['id']}},_0x4ba2fe,_0x3c49ce,_0x4e2ee9,_0x82b7ea,_0x279da9;_0x50e8dc=_[_0x16dc('0x3c')]({},_0x50e8dc,_0x42c899[_0x16dc('0x41')]);return db[_0x16dc('0x2a')][_0x16dc('0x42')](_0x50e8dc)[_0x16dc('0x20')](function(_0x56c8cb){if(_0x56c8cb){_0x4ba2fe=_0x56c8cb;return _0x56c8cb['getFields']();}return null;})['then'](function(_0x16636c){if(_0x16636c){if(!_0x16636c[_0x16dc('0x33')]){throw new db[(_0x16dc('0x67'))][(_0x16dc('0x68'))](_0x16dc('0x69'),0x193);}_0x3c49ce=_0x16636c;return db['AnalyticMetric'][_0x16dc('0x6a')]({'raw':!![]});}return null;})[_0x16dc('0x20')](function(_0x30399c){if(_0x30399c){_0x4e2ee9=_[_0x16dc('0x6b')](_0x30399c,'id');var _0x438e1a;var _0x1a6119=squel['select']();_0x1a6119[_0x16dc('0x6c')](_0x4ba2fe[_0x16dc('0x6d')]);for(var _0x644b7=0x0;_0x644b7<_0x3c49ce[_0x16dc('0x33')];_0x644b7+=0x1){_0x438e1a=_0x3c49ce[_0x644b7]['MetricId']?_0x4e2ee9[_0x3c49ce[_0x644b7][_0x16dc('0x6e')]][_0x16dc('0x6f')]:_0x3c49ce[_0x644b7]['field'];_0x438e1a=_0x3c49ce[_0x644b7][_0x16dc('0x70')]?_[_0x16dc('0x71')](_0x45b40b[_0x3c49ce[_0x644b7][_0x16dc('0x70')]],'%s',_0x438e1a):_0x438e1a;_0x438e1a=_0x3c49ce[_0x644b7][_0x16dc('0x72')]?_[_0x16dc('0x71')](_0x5d6d6f[_0x3c49ce[_0x644b7]['format']],'%s',_0x438e1a):_0x438e1a;if(_0x3c49ce[_0x644b7][_0x16dc('0x73')]){_0x1a6119[_0x16dc('0x63')](_0x438e1a);}_0x3c49ce[_0x644b7][_0x16dc('0x74')]&&_0x1a6119[_0x16dc('0x37')](_0x438e1a,_0x3c49ce[_0x644b7]['orderBy']===_0x16dc('0x75')?![]:!![]);_0x1a6119['field'](_0x438e1a,_0x3c49ce[_0x644b7][_0x16dc('0x76')]||_0x438e1a);}if(_0x4ba2fe[_0x16dc('0x77')]){_0x4ba2fe[_0x16dc('0x77')]=JSON[_0x16dc('0x78')](_0x4ba2fe[_0x16dc('0x77')]);for(var _0x55b75d=0x0;_0x55b75d<_0x4ba2fe[_0x16dc('0x77')]['length'];_0x55b75d+=0x1){if(_0x4ba2fe[_0x16dc('0x77')][_0x55b75d][_0x16dc('0x2d')]&&_[_0x16dc('0x79')](_0x4a78a9,_0x4ba2fe[_0x16dc('0x77')][_0x55b75d]['type'])&&_0x4ba2fe[_0x16dc('0x77')][_0x55b75d][_0x16dc('0x7a')]&&_0x4ba2fe['joins'][_0x55b75d][_0x16dc('0x7b')]&&_0x4ba2fe['joins'][_0x55b75d][_0x16dc('0x7c')]){_0x1a6119[_0x4ba2fe[_0x16dc('0x77')][_0x55b75d][_0x16dc('0x2d')]](_0x4ba2fe['joins'][_0x55b75d][_0x16dc('0x7b')],null,util['format'](_0x16dc('0x7d'),_0x4ba2fe[_0x16dc('0x6d')],_0x4ba2fe[_0x16dc('0x77')][_0x55b75d][_0x16dc('0x7a')],_0x4ba2fe[_0x16dc('0x77')][_0x55b75d][_0x16dc('0x7b')],_0x4ba2fe[_0x16dc('0x77')][_0x55b75d]['foreignKey']));}}}if(_0x4ba2fe[_0x16dc('0x7e')]){_0x4ba2fe[_0x16dc('0x7e')]=JSON[_0x16dc('0x78')](_0x4ba2fe[_0x16dc('0x7e')]);_0x1a6119[_0x16dc('0x39')](_0x2825ce(_0x4ba2fe[_0x16dc('0x7e')][_0x16dc('0x63')]));}_0x279da9=_0x1a6119[_0x16dc('0x7f')]();_0x1a6119[_0x16dc('0x1c')](_0x3ec6c0);_0x1a6119[_0x16dc('0x36')](0x0);logger[_0x16dc('0x80')](_0x16dc('0x81'),_0x1a6119['toString']());return db['sequelize'][_0x16dc('0x30')](_0x1a6119[_0x16dc('0x82')](),{'type':db[_0x16dc('0x83')]['QueryTypes'][_0x16dc('0x84')]});}})['then'](respondWithResult(_0x784c23,null))['catch'](handleError(_0x784c23,null));};function runReport(_0xc2975d,_0x27b5ec,_0x236a19){var _0x460eb5=_0x27b5ec['name'];var _0x20ab60=0xa;var _0x3541d1=['join',_0x16dc('0x85'),_0x16dc('0x4f'),_0x16dc('0x50')];var _0x2597d6={'SUM':'SUM(%s)','COUNT':_0x16dc('0x52'),'COUNT DISTINCT':_0x16dc('0x53'),'MAX':_0x16dc('0x54'),'MIN':'MIN(%s)','AVG':_0x16dc('0x56'),'GROUP_CONCAT':_0x16dc('0x57'),'GROUP_CONCAT ASC':_0x16dc('0x86'),'GROUP_CONCAT DESC':_0x16dc('0x58')};var _0x326d74={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x16dc('0x5a'),'HOUR':_0x16dc('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3728aa=function(_0x2dd175){return!_[_0x16dc('0x79')]([_0x16dc('0x5e'),_0x16dc('0x87'),'IS\x20EMPTY',_0x16dc('0x60')],_0x2dd175);};var _0x1e1901=function(_0x27b398){if(!_0x27b398||!_0x27b398[_0x16dc('0x61')][_0x16dc('0x33')]){return'';}for(var _0x4ed453='(',_0x19d113=0x0;_0x19d113<_0x27b398[_0x16dc('0x61')][_0x16dc('0x33')];_0x19d113+=0x1){_0x19d113>0x0&&(_0x4ed453+='\x20'+_0x27b398['operator']+'\x20');_0x4ed453+=_0x27b398[_0x16dc('0x61')][_0x19d113][_0x16dc('0x63')]?_0x1e1901(_0x27b398['rules'][_0x19d113][_0x16dc('0x63')]):_0x27b398[_0x16dc('0x61')][_0x19d113][_0x16dc('0x64')]+'\x20'+_0x27b398['rules'][_0x19d113][_0x16dc('0x65')]+(_0x3728aa(_0x27b398[_0x16dc('0x61')][_0x19d113][_0x16dc('0x65')])?'\x20'+_0x27b398[_0x16dc('0x61')][_0x19d113][_0x16dc('0x66')]:'');}return _0x4ed453+')';};var _0x5d62ca={'where':{'id':_0xc2975d['id']}},_0x40f656,_0x208c80,_0x88f7c7,_0x84e7da,_0x3ae6f9;_0x5d62ca=_[_0x16dc('0x3c')]({},_0x5d62ca,_0x236a19);return db[_0x16dc('0x2a')][_0x16dc('0x42')](_0x5d62ca)[_0x16dc('0x20')](function(_0x4f3a9c){if(_0x4f3a9c){_0x40f656=_0x4f3a9c;return _0x4f3a9c[_0x16dc('0x88')]();}return null;})['then'](function(_0x26a593){if(_0x26a593){if(!_0x26a593[_0x16dc('0x33')]){throw new db[(_0x16dc('0x67'))]['ValidationErrorItem'](_0x16dc('0x69'),0x193);}_0x208c80=_0x26a593;return db[_0x16dc('0x89')][_0x16dc('0x6a')]({'raw':!![]});}return null;})[_0x16dc('0x20')](function(_0x18d6b8){if(_0x18d6b8){_0x88f7c7=_[_0x16dc('0x6b')](_0x18d6b8,'id');var _0x3fd3fe;var _0x9d9476=squel[_0x16dc('0x8a')]();_0x9d9476[_0x16dc('0x6c')](_0x40f656[_0x16dc('0x6d')]);for(var _0x1f2a25=0x0;_0x1f2a25<_0x208c80[_0x16dc('0x33')];_0x1f2a25+=0x1){_0x3fd3fe=_0x208c80[_0x1f2a25][_0x16dc('0x6e')]?_0x88f7c7[_0x208c80[_0x1f2a25][_0x16dc('0x6e')]][_0x16dc('0x6f')]:_0x208c80[_0x1f2a25][_0x16dc('0x64')];_0x3fd3fe=_0x208c80[_0x1f2a25][_0x16dc('0x70')]?_['replace'](_0x2597d6[_0x208c80[_0x1f2a25]['function']],'%s',_0x3fd3fe):_0x3fd3fe;_0x3fd3fe=_0x208c80[_0x1f2a25]['format']?_[_0x16dc('0x71')](_0x326d74[_0x208c80[_0x1f2a25][_0x16dc('0x72')]],'%s',_0x3fd3fe):_0x3fd3fe;if(_0x208c80[_0x1f2a25][_0x16dc('0x73')]){_0x9d9476['group'](_0x3fd3fe);}_0x208c80[_0x1f2a25][_0x16dc('0x74')]&&_0x9d9476[_0x16dc('0x37')](_0x3fd3fe,_0x208c80[_0x1f2a25]['orderBy']==='DESC'?![]:!![]);_0x9d9476['field'](_0x3fd3fe,_0x208c80[_0x1f2a25][_0x16dc('0x76')]||_0x3fd3fe);}if(_0x40f656[_0x16dc('0x77')]){_0x40f656[_0x16dc('0x77')]=JSON[_0x16dc('0x78')](_0x40f656[_0x16dc('0x77')]);for(var _0xdf70ca=0x0;_0xdf70ca<_0x40f656[_0x16dc('0x77')][_0x16dc('0x33')];_0xdf70ca+=0x1){if(_0x40f656[_0x16dc('0x77')][_0xdf70ca][_0x16dc('0x2d')]&&_[_0x16dc('0x79')](_0x3541d1,_0x40f656['joins'][_0xdf70ca][_0x16dc('0x2d')])&&_0x40f656['joins'][_0xdf70ca][_0x16dc('0x7a')]&&_0x40f656[_0x16dc('0x77')][_0xdf70ca][_0x16dc('0x7b')]&&_0x40f656['joins'][_0xdf70ca][_0x16dc('0x7c')]){_0x9d9476[_0x40f656['joins'][_0xdf70ca]['type']](_0x40f656['joins'][_0xdf70ca]['foreignTable'],null,util[_0x16dc('0x72')]('%s.%s\x20=\x20%s.%s',_0x40f656['table'],_0x40f656[_0x16dc('0x77')][_0xdf70ca]['parentKey'],_0x40f656[_0x16dc('0x77')][_0xdf70ca][_0x16dc('0x7b')],_0x40f656[_0x16dc('0x77')][_0xdf70ca]['foreignKey']));}}}if(_0x40f656['conditions']){_0x40f656[_0x16dc('0x7e')]=JSON[_0x16dc('0x78')](_0x40f656[_0x16dc('0x7e')]);_0x9d9476[_0x16dc('0x39')](_0x1e1901(_0x40f656[_0x16dc('0x7e')][_0x16dc('0x63')]));}_0x3ae6f9=_0x9d9476[_0x16dc('0x7f')]();_0x9d9476['limit'](_0x20ab60);_0x9d9476['offset'](0x0);logger['debug']('Limited\x20Query:',_0x9d9476[_0x16dc('0x82')]());return db[_0x16dc('0x83')][_0x16dc('0x30')](_0x9d9476[_0x16dc('0x82')](),{'type':db[_0x16dc('0x83')][_0x16dc('0x8b')]['SELECT']});}})[_0x16dc('0x20')](function(_0x398001){if(!_0x398001[_0x16dc('0x33')]){throw new db[(_0x16dc('0x67'))][(_0x16dc('0x68'))](_0x16dc('0x8c'),0xcc);}if(_0x27b5ec[_0x16dc('0x8d')]===_0x16dc('0x8e')){return null;}var _0xfc2f28=_[_0x16dc('0x3c')](_0x27b5ec,{'name':_0x27b5ec[_0x16dc('0x8f')]||_0x27b5ec[_0x16dc('0x26')]||_0x40f656[_0x16dc('0x26')],'basename':_0x460eb5,'savename':util[_0x16dc('0x72')](_0x16dc('0x90'),_0x27b5ec[_0x16dc('0x26')]||_0x40f656[_0x16dc('0x26')],require(_0x16dc('0x91'))[_0x16dc('0x92')](0x4),_0x27b5ec[_0x16dc('0x8d')]||'csv'),'reportId':_0x40f656['id'],'reportType':'default'});return db[_0x16dc('0x93')][_0x16dc('0x44')](_0xfc2f28,{'raw':!![]});})['then'](function(_0x473e42){if(_0x40f656[_0x16dc('0x6d')]===_0x16dc('0x94')){_0x3ae6f9[_0x16dc('0x39')](_0x40f656['table']+_0x16dc('0x95'),_0x27b5ec[_0x16dc('0x96')],_0x27b5ec[_0x16dc('0x97')]);}else{_0x3ae6f9[_0x16dc('0x39')](_0x40f656[_0x16dc('0x6d')]+_0x16dc('0x98'),_0x27b5ec[_0x16dc('0x96')],_0x27b5ec[_0x16dc('0x97')]);}if(_0x473e42){logger[_0x16dc('0x99')](_0x16dc('0x9a'),_0x3ae6f9['toString']());require(_0x16dc('0x9b'))[_0x16dc('0x9c')](path[_0x16dc('0x9d')](__dirname,_0x16dc('0x9e'),_0x473e42[_0x16dc('0x8d')]),[_0x473e42['id'],_0x3ae6f9[_0x16dc('0x82')](),path[_0x16dc('0x9d')](__dirname,_0x16dc('0x9f'),_0x473e42[_0x16dc('0xa0')]),_0x460eb5]);return _0x473e42;}else{var _0x136c78=squel['select']();_0x136c78['from']('('+_0x3ae6f9[_0x16dc('0x82')]()+')','countTable');_0x136c78[_0x16dc('0x64')]('COUNT(*)',_0x16dc('0x1b'));_0x3ae6f9[_0x16dc('0x1c')](_0x27b5ec[_0x16dc('0x1c')]||_0x20ab60);_0x3ae6f9['offset'](_0x27b5ec['offset']||0x0);return dbH['sequelize'][_0x16dc('0x30')](_0x136c78[_0x16dc('0x82')](),{'type':dbH[_0x16dc('0x83')][_0x16dc('0x8b')][_0x16dc('0x84')]})[_0x16dc('0x20')](function(_0x54baac){if(!_0x54baac[_0x16dc('0x33')]){_0x84e7da=0x0;}else{_0x84e7da=_0x54baac[0x0]['count']||0x0;}return dbH[_0x16dc('0x83')][_0x16dc('0x30')](_0x3ae6f9[_0x16dc('0x82')](),{'type':dbH[_0x16dc('0x83')][_0x16dc('0x8b')][_0x16dc('0x84')]});})['then'](function(_0x4410dd){return{'rows':_0x4410dd||[],'count':_0x84e7da};});}});}exports[_0x16dc('0xa1')]=function(_0xcef6f3,_0x50b6d1){return runReport(_0xcef6f3[_0x16dc('0x3e')],_0xcef6f3[_0x16dc('0x30')],_0xcef6f3[_0x16dc('0x41')])['then'](respondWithResult(_0x50b6d1,null))['catch'](handleError(_0x50b6d1,null));};exports[_0x16dc('0xa2')]=runReport;exports[_0x16dc('0x30')]=function(_0x192e38,_0x19cee8){var _0x50166d=0xa;var _0xa07bbe=['join','left_join',_0x16dc('0x4f'),'cross_join'];var _0x52a704={'SUM':_0x16dc('0x51'),'COUNT':_0x16dc('0x52'),'COUNT DISTINCT':_0x16dc('0x53'),'MAX':_0x16dc('0x54'),'MIN':'MIN(%s)','AVG':_0x16dc('0x56'),'GROUP_CONCAT':_0x16dc('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x16dc('0x58')};var _0x53cea1={'SEC_TO_TIME':_0x16dc('0x59'),'DATE':_0x16dc('0x5a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x16dc('0x5d')};var _0x1ff014=function(_0x1b6de6){return!_['includes']([_0x16dc('0x5e'),_0x16dc('0x87'),_0x16dc('0x5f'),_0x16dc('0x60')],_0x1b6de6);};var _0x11dff0=function(_0x1f0ed8){if(!_0x1f0ed8||!_0x1f0ed8[_0x16dc('0x61')]['length']){return'';}for(var _0x89604c='(',_0x173b89=0x0;_0x173b89<_0x1f0ed8[_0x16dc('0x61')][_0x16dc('0x33')];_0x173b89+=0x1){_0x173b89>0x0&&(_0x89604c+='\x20'+_0x1f0ed8[_0x16dc('0x62')]+'\x20');_0x89604c+=_0x1f0ed8[_0x16dc('0x61')][_0x173b89][_0x16dc('0x63')]?_0x11dff0(_0x1f0ed8[_0x16dc('0x61')][_0x173b89][_0x16dc('0x63')]):_0x1f0ed8['rules'][_0x173b89]['field']+'\x20'+_0x1f0ed8[_0x16dc('0x61')][_0x173b89]['condition']+(_0x1ff014(_0x1f0ed8['rules'][_0x173b89][_0x16dc('0x65')])?'\x20'+_0x1f0ed8[_0x16dc('0x61')][_0x173b89][_0x16dc('0x66')]:'');}return _0x89604c+')';};var _0x28c3e4={'where':{'id':_0x192e38[_0x16dc('0x3e')]['id']}},_0x3bee1d,_0x498482,_0x528d25,_0x3515fc,_0x261bf2;_0x28c3e4=_[_0x16dc('0x3c')]({},_0x28c3e4,_0x192e38[_0x16dc('0x41')]);return db['AnalyticDefaultReport'][_0x16dc('0x42')](_0x28c3e4)['then'](function(_0x34632c){if(_0x34632c){_0x3bee1d=_0x34632c;return _0x34632c['getFields']();}return null;})['then'](function(_0x5aa38e){if(_0x5aa38e){if(!_0x5aa38e[_0x16dc('0x33')]){throw new db[(_0x16dc('0x67'))][(_0x16dc('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x498482=_0x5aa38e;return db[_0x16dc('0x89')][_0x16dc('0x6a')]({'raw':!![]});}return null;})[_0x16dc('0x20')](function(_0x34bfed){if(_0x34bfed){_0x528d25=_[_0x16dc('0x6b')](_0x34bfed,'id');var _0x54362c;var _0x17453f=squel[_0x16dc('0x8a')]();_0x17453f[_0x16dc('0x6c')](_0x3bee1d[_0x16dc('0x6d')]);for(var _0x439f64=0x0;_0x439f64<_0x498482[_0x16dc('0x33')];_0x439f64+=0x1){_0x54362c=_0x498482[_0x439f64][_0x16dc('0x6e')]?_0x528d25[_0x498482[_0x439f64]['MetricId']][_0x16dc('0x6f')]:_0x498482[_0x439f64][_0x16dc('0x64')];_0x54362c=_0x498482[_0x439f64][_0x16dc('0x70')]?_[_0x16dc('0x71')](_0x52a704[_0x498482[_0x439f64][_0x16dc('0x70')]],'%s',_0x54362c):_0x54362c;_0x54362c=_0x498482[_0x439f64]['format']?_['replace'](_0x53cea1[_0x498482[_0x439f64][_0x16dc('0x72')]],'%s',_0x54362c):_0x54362c;if(_0x498482[_0x439f64][_0x16dc('0x73')]){_0x17453f[_0x16dc('0x63')](_0x54362c);}_0x498482[_0x439f64][_0x16dc('0x74')]&&_0x17453f[_0x16dc('0x37')](_0x54362c,_0x498482[_0x439f64][_0x16dc('0x74')]===_0x16dc('0x75')?![]:!![]);_0x17453f['field'](_0x54362c,_0x498482[_0x439f64]['alias']||_0x54362c);}if(_0x3bee1d['joins']){_0x3bee1d[_0x16dc('0x77')]=JSON[_0x16dc('0x78')](_0x3bee1d[_0x16dc('0x77')]);for(var _0x59fbe6=0x0;_0x59fbe6<_0x3bee1d[_0x16dc('0x77')]['length'];_0x59fbe6+=0x1){if(_0x3bee1d[_0x16dc('0x77')][_0x59fbe6]['type']&&_[_0x16dc('0x79')](_0xa07bbe,_0x3bee1d[_0x16dc('0x77')][_0x59fbe6][_0x16dc('0x2d')])&&_0x3bee1d[_0x16dc('0x77')][_0x59fbe6][_0x16dc('0x7a')]&&_0x3bee1d['joins'][_0x59fbe6][_0x16dc('0x7b')]&&_0x3bee1d['joins'][_0x59fbe6][_0x16dc('0x7c')]){_0x17453f[_0x3bee1d['joins'][_0x59fbe6][_0x16dc('0x2d')]](_0x3bee1d[_0x16dc('0x77')][_0x59fbe6]['foreignTable'],null,util[_0x16dc('0x72')](_0x16dc('0x7d'),_0x3bee1d[_0x16dc('0x6d')],_0x3bee1d[_0x16dc('0x77')][_0x59fbe6][_0x16dc('0x7a')],_0x3bee1d[_0x16dc('0x77')][_0x59fbe6]['foreignTable'],_0x3bee1d['joins'][_0x59fbe6]['foreignKey']));}}}if(_0x3bee1d[_0x16dc('0x7e')]){_0x3bee1d['conditions']=JSON[_0x16dc('0x78')](_0x3bee1d[_0x16dc('0x7e')]);_0x17453f[_0x16dc('0x39')](_0x11dff0(_0x3bee1d[_0x16dc('0x7e')]['group']));}_0x261bf2=_0x17453f[_0x16dc('0x7f')]();_0x17453f[_0x16dc('0x1c')](_0x50166d);_0x17453f[_0x16dc('0x36')](0x0);logger[_0x16dc('0x80')]('Limited\x20Query:',_0x17453f[_0x16dc('0x82')]());return db['sequelize'][_0x16dc('0x30')](_0x17453f[_0x16dc('0x82')](),{'type':db[_0x16dc('0x83')]['QueryTypes'][_0x16dc('0x84')]});}})[_0x16dc('0x20')](function(){return{'sql':_0x261bf2['toString']()};})['then'](respondWithResult(_0x19cee8,null))[_0x16dc('0x43')](handleError(_0x19cee8,null));}; \ No newline at end of file +var _0x26c0=['Run\x20Query:','child_process','fork','../../components/export/','countTable','run','runReport','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','Please\x20insert\x20at\x20least\x20one\x20field','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','index','AnalyticDefaultReport','rawAttributes','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','findAll','rows','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','keyBy','select','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','right_join','MIN(%s)','SEC_TO_TIME(%s)','DATE(%s)','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','QueryTypes','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','csv','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x26c0,0xb2));var _0x026c=function(_0x475e55,_0x2bfc0c){_0x475e55=_0x475e55-0x0;var _0x59f30a=_0x26c0[_0x475e55];return _0x59f30a;};'use strict';var pdf=require(_0x026c('0x0'));var emlformat=require(_0x026c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x026c('0x2'));var jsonpatch=require(_0x026c('0x3'));var rp=require(_0x026c('0x4'));var moment=require(_0x026c('0x5'));var BPromise=require(_0x026c('0x6'));var Mustache=require(_0x026c('0x7'));var util=require(_0x026c('0x8'));var path=require(_0x026c('0x9'));var sox=require(_0x026c('0xa'));var csv=require(_0x026c('0xb'));var ejs=require(_0x026c('0xc'));var fs=require('fs');var _=require(_0x026c('0xd'));var squel=require(_0x026c('0xe'));var crypto=require(_0x026c('0xf'));var jsforce=require(_0x026c('0x10'));var deskjs=require(_0x026c('0x11'));var toCsv=require('to-csv');var querystring=require(_0x026c('0x12'));var Papa=require(_0x026c('0x13'));var Redis=require(_0x026c('0x14'));var authService=require(_0x026c('0x15'));var qs=require(_0x026c('0x16'));var as=require(_0x026c('0x17'));var hardwareService=require(_0x026c('0x18'));var logger=require('../../config/logger')(_0x026c('0x19'));var utils=require(_0x026c('0x1a'));var config=require(_0x026c('0x1b'));var db=require(_0x026c('0x1c'))['db'];var dbH=require(_0x026c('0x1c'))['dbH'];function respondWithStatusCode(_0x236a3d,_0x129068){_0x129068=_0x129068||0xcc;return function(_0x2d21bd){if(_0x2d21bd){return _0x236a3d[_0x026c('0x1d')](_0x129068);}return _0x236a3d[_0x026c('0x1e')](_0x129068)[_0x026c('0x1f')]();};}function respondWithResult(_0x41bf79,_0x15244d){_0x15244d=_0x15244d||0xc8;return function(_0x38ae73){if(_0x38ae73){return _0x41bf79[_0x026c('0x1e')](_0x15244d)[_0x026c('0x20')](_0x38ae73);}};}function respondWithFilteredResult(_0x5bbf86,_0x4c6056){return function(_0x247727){if(_0x247727){var _0xb206b0=_0x247727[_0x026c('0x21')],_0x8b65d8=_0x4c6056[_0x026c('0x22')],_0x129541=_0x4c6056[_0x026c('0x22')]+_0x4c6056['limit'],_0xd59087;if(_0x129541>=_0xb206b0){_0x129541=_0xb206b0;_0xd59087=0xc8;}else{_0xd59087=0xce;}_0x5bbf86[_0x026c('0x1e')](_0xd59087);return _0x5bbf86['set'](_0x026c('0x23'),_0x8b65d8+'-'+_0x129541+'/'+_0xb206b0)[_0x026c('0x20')](_0x247727);}return null;};}function patchUpdates(_0x5a6734){return function(_0x314d2a){try{jsonpatch[_0x026c('0x24')](_0x314d2a,_0x5a6734,!![]);}catch(_0x5c5564){return BPromise[_0x026c('0x25')](_0x5c5564);}return _0x314d2a[_0x026c('0x26')]();};}function saveUpdates(_0x250839,_0x28270a){return function(_0xee92f2){if(_0xee92f2){return _0xee92f2[_0x026c('0x27')](_0x250839)[_0x026c('0x28')](function(_0x46cfb5){return _0x46cfb5;});}return null;};}function removeEntity(_0x567b36,_0x8d94b3){return function(_0x439514){if(_0x439514){return _0x439514[_0x026c('0x29')]()['then'](function(){var _0x4eda3d=_0x439514[_0x026c('0x2a')]({'plain':!![]});var _0x3c9038=_0x026c('0x2b');return db[_0x026c('0x2c')][_0x026c('0x29')]({'where':{'type':_0x3c9038,'resourceId':_0x4eda3d['id']}})['then'](function(){return _0x439514;});})[_0x026c('0x28')](function(){_0x567b36[_0x026c('0x1e')](0xcc)[_0x026c('0x1f')]();});}};}function handleEntityNotFound(_0x5d91d0,_0x5f2d99){return function(_0x2fb419){if(!_0x2fb419){_0x5d91d0['sendStatus'](0x194);}return _0x2fb419;};}function handleError(_0x54b14e,_0x226798){_0x226798=_0x226798||0x1f4;return function(_0x396467){logger[_0x026c('0x2d')](_0x396467[_0x026c('0x2e')]);if(_0x396467[_0x026c('0x2f')]){delete _0x396467[_0x026c('0x2f')];}_0x54b14e[_0x026c('0x1e')](_0x226798)['send'](_0x396467);};}exports[_0x026c('0x30')]=function(_0x3fdb34,_0x3c001a){var _0x570a05={},_0x1c67a3={},_0x4ae7cc={'count':0x0,'rows':[]};var _0x323b46=_['map'](db[_0x026c('0x31')][_0x026c('0x32')],function(_0x571e95){return{'name':_0x571e95['fieldName'],'type':_0x571e95['type'][_0x026c('0x33')]};});_0x1c67a3[_0x026c('0x34')]=_[_0x026c('0x35')](_0x323b46,_0x026c('0x2f'));_0x1c67a3[_0x026c('0x36')]=_[_0x026c('0x37')](_0x3fdb34[_0x026c('0x36')]);_0x1c67a3['filters']=_['intersection'](_0x1c67a3['model'],_0x1c67a3[_0x026c('0x36')]);_0x570a05['attributes']=_[_0x026c('0x38')](_0x1c67a3[_0x026c('0x34')],qs[_0x026c('0x39')](_0x3fdb34[_0x026c('0x36')][_0x026c('0x39')]));_0x570a05[_0x026c('0x3a')]=_0x570a05[_0x026c('0x3a')][_0x026c('0x3b')]?_0x570a05['attributes']:_0x1c67a3[_0x026c('0x34')];if(!_0x3fdb34[_0x026c('0x36')][_0x026c('0x3c')](_0x026c('0x3d'))){_0x570a05['limit']=qs[_0x026c('0x3e')](_0x3fdb34[_0x026c('0x36')][_0x026c('0x3e')]);_0x570a05[_0x026c('0x22')]=qs[_0x026c('0x22')](_0x3fdb34[_0x026c('0x36')][_0x026c('0x22')]);}_0x570a05['order']=qs['sort'](_0x3fdb34['query'][_0x026c('0x3f')]);_0x570a05[_0x026c('0x40')]=qs[_0x026c('0x41')](_[_0x026c('0x42')](_0x3fdb34['query'],_0x1c67a3['filters']),_0x323b46);if(_0x3fdb34[_0x026c('0x36')]['filter']){_0x570a05[_0x026c('0x40')]=_[_0x026c('0x43')](_0x570a05[_0x026c('0x40')],{'$or':_['map'](_0x323b46,function(_0x512378){if(_0x512378[_0x026c('0x44')]!==_0x026c('0x45')){var _0x4466f4={};_0x4466f4[_0x512378[_0x026c('0x2f')]]={'$like':'%'+_0x3fdb34['query'][_0x026c('0x46')]+'%'};return _0x4466f4;}})});}_0x570a05=_[_0x026c('0x43')]({},_0x570a05,_0x3fdb34[_0x026c('0x47')]);var _0x5f2e9f={'where':_0x570a05['where']};return db[_0x026c('0x31')][_0x026c('0x21')](_0x5f2e9f)[_0x026c('0x28')](function(_0x43840d){_0x4ae7cc[_0x026c('0x21')]=_0x43840d;if(_0x3fdb34[_0x026c('0x36')]['includeAll']){_0x570a05['include']=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x026c('0x48')](_0x570a05);})[_0x026c('0x28')](function(_0x5f06e4){_0x4ae7cc[_0x026c('0x49')]=_0x5f06e4;return _0x4ae7cc;})['then'](respondWithFilteredResult(_0x3c001a,_0x570a05))['catch'](handleError(_0x3c001a,null));};exports[_0x026c('0x4a')]=function(_0x4734e3,_0x39d76e){var _0x2a9bed={'raw':!![],'where':{'id':_0x4734e3[_0x026c('0x4b')]['id']}},_0x145a13={};_0x145a13[_0x026c('0x34')]=_[_0x026c('0x37')](db['AnalyticDefaultReport'][_0x026c('0x32')]);_0x145a13[_0x026c('0x36')]=_[_0x026c('0x37')](_0x4734e3[_0x026c('0x36')]);_0x145a13[_0x026c('0x41')]=_['intersection'](_0x145a13[_0x026c('0x34')],_0x145a13[_0x026c('0x36')]);_0x2a9bed['attributes']=_['intersection'](_0x145a13[_0x026c('0x34')],qs[_0x026c('0x39')](_0x4734e3[_0x026c('0x36')][_0x026c('0x39')]));_0x2a9bed['attributes']=_0x2a9bed[_0x026c('0x3a')]['length']?_0x2a9bed['attributes']:_0x145a13['model'];if(_0x4734e3[_0x026c('0x36')]['includeAll']){_0x2a9bed[_0x026c('0x4c')]=[{'all':!![]}];}_0x2a9bed=_[_0x026c('0x43')]({},_0x2a9bed,_0x4734e3[_0x026c('0x47')]);return db[_0x026c('0x31')][_0x026c('0x4d')](_0x2a9bed)[_0x026c('0x28')](handleEntityNotFound(_0x39d76e,null))[_0x026c('0x28')](respondWithResult(_0x39d76e,null))['catch'](handleError(_0x39d76e,null));};exports[_0x026c('0x4e')]=function(_0x2b715c,_0x32f500){return db[_0x026c('0x31')][_0x026c('0x4e')](_0x2b715c['body'],{})[_0x026c('0x28')](function(_0x370827){var _0x4863ca=_0x2b715c[_0x026c('0x4f')][_0x026c('0x2a')]({'plain':!![]});if(!_0x4863ca)throw new Error(_0x026c('0x50'));if(_0x4863ca['role']===_0x026c('0x4f')){var _0x2940de=_0x370827[_0x026c('0x2a')]({'plain':!![]});var _0x3ded94=_0x026c('0x51');return db[_0x026c('0x52')][_0x026c('0x4d')]({'where':{'name':_0x3ded94,'userProfileId':_0x4863ca[_0x026c('0x53')]},'raw':!![]})[_0x026c('0x28')](function(_0x37002b){if(_0x37002b&&_0x37002b['autoAssociation']===0x0){return db['UserProfileResource'][_0x026c('0x4e')]({'name':_0x2940de[_0x026c('0x2f')],'resourceId':_0x2940de['id'],'type':'DefaultReports','sectionId':_0x37002b['id']},{})['then'](function(){return _0x370827;});}else{return _0x370827;}})[_0x026c('0x54')](function(_0x39ce6e){logger[_0x026c('0x2d')](_0x026c('0x55'),_0x39ce6e);throw _0x39ce6e;});}return _0x370827;})[_0x026c('0x28')](respondWithResult(_0x32f500,0xc9))['catch'](handleError(_0x32f500,null));};exports[_0x026c('0x27')]=function(_0x2fea44,_0x3c15d6){if(_0x2fea44[_0x026c('0x56')]['id']){delete _0x2fea44[_0x026c('0x56')]['id'];}return db['AnalyticDefaultReport'][_0x026c('0x4d')]({'where':{'id':_0x2fea44['params']['id']}})['then'](handleEntityNotFound(_0x3c15d6,null))[_0x026c('0x28')](saveUpdates(_0x2fea44[_0x026c('0x56')],null))['then'](respondWithResult(_0x3c15d6,null))[_0x026c('0x54')](handleError(_0x3c15d6,null));};exports[_0x026c('0x29')]=function(_0x3ab2d9,_0x3d2e87){return db['AnalyticDefaultReport'][_0x026c('0x4d')]({'where':{'id':_0x3ab2d9['params']['id']}})['then'](handleEntityNotFound(_0x3d2e87,null))[_0x026c('0x28')](removeEntity(_0x3d2e87,null))[_0x026c('0x54')](handleError(_0x3d2e87,null));};exports[_0x026c('0x57')]=function(_0x3dd9e7,_0x58eff7){var _0x13ef00=0xa;var _0x26da73=[_0x026c('0x58'),_0x026c('0x59'),'right_join',_0x026c('0x5a')];var _0x16b9c7={'SUM':_0x026c('0x5b'),'COUNT':_0x026c('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x026c('0x5d'),'MIN':'MIN(%s)','AVG':_0x026c('0x5e'),'GROUP_CONCAT':_0x026c('0x5f'),'GROUP_CONCAT ASC':_0x026c('0x60'),'GROUP_CONCAT DESC':_0x026c('0x61')};var _0x1a2c49={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x026c('0x62'),'ROUND':_0x026c('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x44b1b2=function(_0x1840c9){return!_[_0x026c('0x64')]([_0x026c('0x65'),'IS\x20NOT\x20NULL',_0x026c('0x66'),_0x026c('0x67')],_0x1840c9);};var _0x2e92c2=function(_0x2d250a){if(!_0x2d250a||!_0x2d250a['rules'][_0x026c('0x3b')]){return'';}for(var _0x521975='(',_0x5bd7ee=0x0;_0x5bd7ee<_0x2d250a[_0x026c('0x68')][_0x026c('0x3b')];_0x5bd7ee+=0x1){_0x5bd7ee>0x0&&(_0x521975+='\x20'+_0x2d250a[_0x026c('0x69')]+'\x20');_0x521975+=_0x2d250a[_0x026c('0x68')][_0x5bd7ee][_0x026c('0x6a')]?_0x2e92c2(_0x2d250a['rules'][_0x5bd7ee][_0x026c('0x6a')]):_0x2d250a['rules'][_0x5bd7ee][_0x026c('0x6b')]+'\x20'+_0x2d250a[_0x026c('0x68')][_0x5bd7ee][_0x026c('0x6c')]+(_0x44b1b2(_0x2d250a[_0x026c('0x68')][_0x5bd7ee][_0x026c('0x6c')])?'\x20'+_0x2d250a['rules'][_0x5bd7ee][_0x026c('0x6d')]:'');}return _0x521975+')';};var _0x50cfa6={'where':{'id':_0x3dd9e7['params']['id']}},_0x3e9447,_0x54c32e,_0x500216,_0x527a23,_0x161d5f;_0x50cfa6=_['merge']({},_0x50cfa6,_0x3dd9e7[_0x026c('0x47')]);return db[_0x026c('0x31')]['find'](_0x50cfa6)[_0x026c('0x28')](function(_0x271695){if(_0x271695){_0x3e9447=_0x271695;return _0x271695['getFields']();}return null;})['then'](function(_0x18a31e){if(_0x18a31e){if(!_0x18a31e[_0x026c('0x3b')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x54c32e=_0x18a31e;return db['AnalyticMetric'][_0x026c('0x48')]({'raw':!![]});}return null;})[_0x026c('0x28')](function(_0x35aae0){if(_0x35aae0){_0x500216=_[_0x026c('0x6e')](_0x35aae0,'id');var _0x4e1222;var _0x2ae9e6=squel[_0x026c('0x6f')]();_0x2ae9e6[_0x026c('0x70')](_0x3e9447['table']);for(var _0x8e0dfa=0x0;_0x8e0dfa<_0x54c32e['length'];_0x8e0dfa+=0x1){_0x4e1222=_0x54c32e[_0x8e0dfa]['MetricId']?_0x500216[_0x54c32e[_0x8e0dfa][_0x026c('0x71')]][_0x026c('0x72')]:_0x54c32e[_0x8e0dfa]['field'];_0x4e1222=_0x54c32e[_0x8e0dfa][_0x026c('0x73')]?_[_0x026c('0x74')](_0x16b9c7[_0x54c32e[_0x8e0dfa][_0x026c('0x73')]],'%s',_0x4e1222):_0x4e1222;_0x4e1222=_0x54c32e[_0x8e0dfa][_0x026c('0x75')]?_[_0x026c('0x74')](_0x1a2c49[_0x54c32e[_0x8e0dfa]['format']],'%s',_0x4e1222):_0x4e1222;if(_0x54c32e[_0x8e0dfa][_0x026c('0x76')]){_0x2ae9e6[_0x026c('0x6a')](_0x4e1222);}_0x54c32e[_0x8e0dfa]['orderBy']&&_0x2ae9e6['order'](_0x4e1222,_0x54c32e[_0x8e0dfa][_0x026c('0x77')]===_0x026c('0x78')?![]:!![]);_0x2ae9e6[_0x026c('0x6b')](_0x4e1222,_0x54c32e[_0x8e0dfa][_0x026c('0x79')]||_0x4e1222);}if(_0x3e9447['joins']){_0x3e9447[_0x026c('0x7a')]=JSON[_0x026c('0x7b')](_0x3e9447[_0x026c('0x7a')]);for(var _0x417d04=0x0;_0x417d04<_0x3e9447[_0x026c('0x7a')][_0x026c('0x3b')];_0x417d04+=0x1){if(_0x3e9447[_0x026c('0x7a')][_0x417d04]['type']&&_[_0x026c('0x64')](_0x26da73,_0x3e9447[_0x026c('0x7a')][_0x417d04]['type'])&&_0x3e9447[_0x026c('0x7a')][_0x417d04][_0x026c('0x7c')]&&_0x3e9447['joins'][_0x417d04][_0x026c('0x7d')]&&_0x3e9447[_0x026c('0x7a')][_0x417d04][_0x026c('0x7e')]){_0x2ae9e6[_0x3e9447[_0x026c('0x7a')][_0x417d04][_0x026c('0x44')]](_0x3e9447['joins'][_0x417d04]['foreignTable'],null,util[_0x026c('0x75')](_0x026c('0x7f'),_0x3e9447[_0x026c('0x80')],_0x3e9447['joins'][_0x417d04][_0x026c('0x7c')],_0x3e9447[_0x026c('0x7a')][_0x417d04][_0x026c('0x7d')],_0x3e9447[_0x026c('0x7a')][_0x417d04][_0x026c('0x7e')]));}}}if(_0x3e9447[_0x026c('0x81')]){_0x3e9447[_0x026c('0x81')]=JSON[_0x026c('0x7b')](_0x3e9447['conditions']);_0x2ae9e6['where'](_0x2e92c2(_0x3e9447[_0x026c('0x81')][_0x026c('0x6a')]));}_0x161d5f=_0x2ae9e6[_0x026c('0x82')]();_0x2ae9e6[_0x026c('0x3e')](_0x13ef00);_0x2ae9e6[_0x026c('0x22')](0x0);logger[_0x026c('0x83')](_0x026c('0x84'),_0x2ae9e6[_0x026c('0x85')]());return db['sequelize'][_0x026c('0x36')](_0x2ae9e6[_0x026c('0x85')](),{'type':db[_0x026c('0x86')]['QueryTypes'][_0x026c('0x87')]});}})['then'](respondWithResult(_0x58eff7,null))[_0x026c('0x54')](handleError(_0x58eff7,null));};function runReport(_0x30f8c6,_0x552299,_0x66e736){var _0xa70e87=_0x552299[_0x026c('0x2f')];var _0x32f60a=0xa;var _0x5a1102=[_0x026c('0x58'),_0x026c('0x59'),_0x026c('0x88'),'cross_join'];var _0x55ea15={'SUM':_0x026c('0x5b'),'COUNT':_0x026c('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x026c('0x5d'),'MIN':_0x026c('0x89'),'AVG':_0x026c('0x5e'),'GROUP_CONCAT':_0x026c('0x5f'),'GROUP_CONCAT ASC':_0x026c('0x60'),'GROUP_CONCAT DESC':_0x026c('0x61')};var _0x1615da={'SEC_TO_TIME':_0x026c('0x8a'),'DATE':_0x026c('0x8b'),'HOUR':_0x026c('0x62'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x45c671=function(_0x464b06){return!_[_0x026c('0x64')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x026c('0x66'),_0x026c('0x67')],_0x464b06);};var _0x4e26b8=function(_0x664c8c){if(!_0x664c8c||!_0x664c8c['rules'][_0x026c('0x3b')]){return'';}for(var _0x505f82='(',_0x2d8423=0x0;_0x2d8423<_0x664c8c[_0x026c('0x68')]['length'];_0x2d8423+=0x1){_0x2d8423>0x0&&(_0x505f82+='\x20'+_0x664c8c[_0x026c('0x69')]+'\x20');_0x505f82+=_0x664c8c[_0x026c('0x68')][_0x2d8423][_0x026c('0x6a')]?_0x4e26b8(_0x664c8c[_0x026c('0x68')][_0x2d8423][_0x026c('0x6a')]):_0x664c8c[_0x026c('0x68')][_0x2d8423][_0x026c('0x6b')]+'\x20'+_0x664c8c['rules'][_0x2d8423]['condition']+(_0x45c671(_0x664c8c['rules'][_0x2d8423][_0x026c('0x6c')])?'\x20'+_0x664c8c['rules'][_0x2d8423][_0x026c('0x6d')]:'');}return _0x505f82+')';};var _0x4eb90d={'where':{'id':_0x30f8c6['id']}},_0x1e2fe4,_0x591650,_0x446a5a,_0x4b2c93,_0x1082bc;_0x4eb90d=_['merge']({},_0x4eb90d,_0x66e736);return db['AnalyticDefaultReport'][_0x026c('0x4d')](_0x4eb90d)[_0x026c('0x28')](function(_0x55798b){if(_0x55798b){_0x1e2fe4=_0x55798b;return _0x55798b[_0x026c('0x8c')]();}return null;})[_0x026c('0x28')](function(_0xfa2ba8){if(_0xfa2ba8){if(!_0xfa2ba8[_0x026c('0x3b')]){throw new db[(_0x026c('0x8d'))][(_0x026c('0x8e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x591650=_0xfa2ba8;return db[_0x026c('0x8f')][_0x026c('0x48')]({'raw':!![]});}return null;})[_0x026c('0x28')](function(_0x29f6a4){if(_0x29f6a4){_0x446a5a=_['keyBy'](_0x29f6a4,'id');var _0x5c9c64;var _0x303f7e=squel[_0x026c('0x6f')]();_0x303f7e[_0x026c('0x70')](_0x1e2fe4[_0x026c('0x80')]);for(var _0x2e0e74=0x0;_0x2e0e74<_0x591650[_0x026c('0x3b')];_0x2e0e74+=0x1){_0x5c9c64=_0x591650[_0x2e0e74][_0x026c('0x71')]?_0x446a5a[_0x591650[_0x2e0e74][_0x026c('0x71')]][_0x026c('0x72')]:_0x591650[_0x2e0e74][_0x026c('0x6b')];_0x5c9c64=_0x591650[_0x2e0e74][_0x026c('0x73')]?_['replace'](_0x55ea15[_0x591650[_0x2e0e74]['function']],'%s',_0x5c9c64):_0x5c9c64;_0x5c9c64=_0x591650[_0x2e0e74]['format']?_['replace'](_0x1615da[_0x591650[_0x2e0e74][_0x026c('0x75')]],'%s',_0x5c9c64):_0x5c9c64;if(_0x591650[_0x2e0e74][_0x026c('0x76')]){_0x303f7e[_0x026c('0x6a')](_0x5c9c64);}_0x591650[_0x2e0e74][_0x026c('0x77')]&&_0x303f7e['order'](_0x5c9c64,_0x591650[_0x2e0e74][_0x026c('0x77')]===_0x026c('0x78')?![]:!![]);_0x303f7e[_0x026c('0x6b')](_0x5c9c64,_0x591650[_0x2e0e74][_0x026c('0x79')]||_0x5c9c64);}if(_0x1e2fe4[_0x026c('0x7a')]){_0x1e2fe4[_0x026c('0x7a')]=JSON[_0x026c('0x7b')](_0x1e2fe4[_0x026c('0x7a')]);for(var _0x3f0727=0x0;_0x3f0727<_0x1e2fe4[_0x026c('0x7a')]['length'];_0x3f0727+=0x1){if(_0x1e2fe4[_0x026c('0x7a')][_0x3f0727][_0x026c('0x44')]&&_[_0x026c('0x64')](_0x5a1102,_0x1e2fe4['joins'][_0x3f0727][_0x026c('0x44')])&&_0x1e2fe4['joins'][_0x3f0727][_0x026c('0x7c')]&&_0x1e2fe4[_0x026c('0x7a')][_0x3f0727][_0x026c('0x7d')]&&_0x1e2fe4[_0x026c('0x7a')][_0x3f0727]['foreignKey']){_0x303f7e[_0x1e2fe4['joins'][_0x3f0727][_0x026c('0x44')]](_0x1e2fe4['joins'][_0x3f0727]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x1e2fe4[_0x026c('0x80')],_0x1e2fe4[_0x026c('0x7a')][_0x3f0727][_0x026c('0x7c')],_0x1e2fe4[_0x026c('0x7a')][_0x3f0727][_0x026c('0x7d')],_0x1e2fe4['joins'][_0x3f0727][_0x026c('0x7e')]));}}}if(_0x1e2fe4[_0x026c('0x81')]){_0x1e2fe4[_0x026c('0x81')]=JSON[_0x026c('0x7b')](_0x1e2fe4[_0x026c('0x81')]);_0x303f7e[_0x026c('0x40')](_0x4e26b8(_0x1e2fe4['conditions'][_0x026c('0x6a')]));}_0x1082bc=_0x303f7e['clone']();_0x303f7e[_0x026c('0x3e')](_0x32f60a);_0x303f7e[_0x026c('0x22')](0x0);logger[_0x026c('0x83')](_0x026c('0x84'),_0x303f7e[_0x026c('0x85')]());return db[_0x026c('0x86')][_0x026c('0x36')](_0x303f7e['toString'](),{'type':db['sequelize'][_0x026c('0x90')][_0x026c('0x87')]});}})[_0x026c('0x28')](function(_0x906756){if(!_0x906756[_0x026c('0x3b')]){throw new db[(_0x026c('0x8d'))][(_0x026c('0x8e'))](_0x026c('0x91'),0xcc);}if(_0x552299[_0x026c('0x92')]===_0x026c('0x93')){return null;}var _0x1df577=_[_0x026c('0x43')](_0x552299,{'name':_0x552299[_0x026c('0x94')]||_0x552299['name']||_0x1e2fe4[_0x026c('0x2f')],'basename':_0xa70e87,'savename':util[_0x026c('0x75')](_0x026c('0x95'),_0x552299[_0x026c('0x2f')]||_0x1e2fe4['name'],require(_0x026c('0x96'))['generate'](0x4),_0x552299[_0x026c('0x92')]||_0x026c('0x97')),'reportId':_0x1e2fe4['id'],'reportType':'default'});return db[_0x026c('0x98')][_0x026c('0x4e')](_0x1df577,{'raw':!![]});})[_0x026c('0x28')](function(_0xfdded5){if(_0x1e2fe4[_0x026c('0x80')]==='cdr'){_0x1082bc['where'](_0x1e2fe4[_0x026c('0x80')]+_0x026c('0x99'),_0x552299[_0x026c('0x9a')],_0x552299[_0x026c('0x9b')]);}else{_0x1082bc[_0x026c('0x40')](_0x1e2fe4[_0x026c('0x80')]+_0x026c('0x9c'),_0x552299[_0x026c('0x9a')],_0x552299[_0x026c('0x9b')]);}if(_0xfdded5){logger[_0x026c('0x9d')](_0x026c('0x9e'),_0x1082bc[_0x026c('0x85')]());require(_0x026c('0x9f'))[_0x026c('0xa0')](path[_0x026c('0x58')](__dirname,_0x026c('0xa1'),_0xfdded5[_0x026c('0x92')]),[_0xfdded5['id'],_0x1082bc[_0x026c('0x85')](),path[_0x026c('0x58')](__dirname,'../../files/reports',_0xfdded5['savename']),_0xa70e87]);return _0xfdded5;}else{var _0x5e52ab=squel['select']();_0x5e52ab['from']('('+_0x1082bc[_0x026c('0x85')]()+')',_0x026c('0xa2'));_0x5e52ab['field']('COUNT(*)',_0x026c('0x21'));_0x1082bc[_0x026c('0x3e')](_0x552299['limit']||_0x32f60a);_0x1082bc[_0x026c('0x22')](_0x552299[_0x026c('0x22')]||0x0);return dbH[_0x026c('0x86')][_0x026c('0x36')](_0x5e52ab[_0x026c('0x85')](),{'type':dbH['sequelize'][_0x026c('0x90')][_0x026c('0x87')]})[_0x026c('0x28')](function(_0xd1447f){if(!_0xd1447f['length']){_0x4b2c93=0x0;}else{_0x4b2c93=_0xd1447f[0x0][_0x026c('0x21')]||0x0;}return dbH['sequelize']['query'](_0x1082bc[_0x026c('0x85')](),{'type':dbH[_0x026c('0x86')][_0x026c('0x90')]['SELECT']});})[_0x026c('0x28')](function(_0x52e296){return{'rows':_0x52e296||[],'count':_0x4b2c93};});}});}exports[_0x026c('0xa3')]=function(_0x54637e,_0x36689d){return runReport(_0x54637e[_0x026c('0x4b')],_0x54637e[_0x026c('0x36')],_0x54637e[_0x026c('0x47')])[_0x026c('0x28')](respondWithResult(_0x36689d,null))[_0x026c('0x54')](handleError(_0x36689d,null));};exports[_0x026c('0xa4')]=runReport;exports[_0x026c('0x36')]=function(_0x3543e0,_0x52db5e){var _0x161da5=0xa;var _0x2a6db3=['join',_0x026c('0x59'),'right_join',_0x026c('0x5a')];var _0x299d40={'SUM':_0x026c('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x026c('0x5d'),'MIN':_0x026c('0x89'),'AVG':_0x026c('0x5e'),'GROUP_CONCAT':_0x026c('0x5f'),'GROUP_CONCAT ASC':_0x026c('0x60'),'GROUP_CONCAT DESC':_0x026c('0x61')};var _0x2b4423={'SEC_TO_TIME':_0x026c('0x8a'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x026c('0x63'),'UNIX_TIMESTAMP':_0x026c('0xa5')};var _0x55dcf9=function(_0x20d342){return!_['includes'](['IS\x20NULL',_0x026c('0xa6'),'IS\x20EMPTY',_0x026c('0x67')],_0x20d342);};var _0x166712=function(_0x3421c2){if(!_0x3421c2||!_0x3421c2[_0x026c('0x68')][_0x026c('0x3b')]){return'';}for(var _0x16dfb3='(',_0x4535bf=0x0;_0x4535bf<_0x3421c2['rules'][_0x026c('0x3b')];_0x4535bf+=0x1){_0x4535bf>0x0&&(_0x16dfb3+='\x20'+_0x3421c2[_0x026c('0x69')]+'\x20');_0x16dfb3+=_0x3421c2['rules'][_0x4535bf][_0x026c('0x6a')]?_0x166712(_0x3421c2[_0x026c('0x68')][_0x4535bf]['group']):_0x3421c2['rules'][_0x4535bf]['field']+'\x20'+_0x3421c2[_0x026c('0x68')][_0x4535bf]['condition']+(_0x55dcf9(_0x3421c2[_0x026c('0x68')][_0x4535bf][_0x026c('0x6c')])?'\x20'+_0x3421c2['rules'][_0x4535bf][_0x026c('0x6d')]:'');}return _0x16dfb3+')';};var _0x584f93={'where':{'id':_0x3543e0[_0x026c('0x4b')]['id']}},_0x21ab76,_0x3bc6bb,_0x42c43e,_0x1b6cb4,_0xbdcc2b;_0x584f93=_[_0x026c('0x43')]({},_0x584f93,_0x3543e0[_0x026c('0x47')]);return db[_0x026c('0x31')][_0x026c('0x4d')](_0x584f93)[_0x026c('0x28')](function(_0x147744){if(_0x147744){_0x21ab76=_0x147744;return _0x147744[_0x026c('0x8c')]();}return null;})['then'](function(_0x38cac0){if(_0x38cac0){if(!_0x38cac0[_0x026c('0x3b')]){throw new db['Sequelize'][(_0x026c('0x8e'))](_0x026c('0xa7'),0x193);}_0x3bc6bb=_0x38cac0;return db['AnalyticMetric'][_0x026c('0x48')]({'raw':!![]});}return null;})['then'](function(_0x31ec3){if(_0x31ec3){_0x42c43e=_[_0x026c('0x6e')](_0x31ec3,'id');var _0x12c814;var _0x15495d=squel[_0x026c('0x6f')]();_0x15495d[_0x026c('0x70')](_0x21ab76['table']);for(var _0x5680c4=0x0;_0x5680c4<_0x3bc6bb['length'];_0x5680c4+=0x1){_0x12c814=_0x3bc6bb[_0x5680c4][_0x026c('0x71')]?_0x42c43e[_0x3bc6bb[_0x5680c4]['MetricId']][_0x026c('0x72')]:_0x3bc6bb[_0x5680c4][_0x026c('0x6b')];_0x12c814=_0x3bc6bb[_0x5680c4][_0x026c('0x73')]?_[_0x026c('0x74')](_0x299d40[_0x3bc6bb[_0x5680c4][_0x026c('0x73')]],'%s',_0x12c814):_0x12c814;_0x12c814=_0x3bc6bb[_0x5680c4][_0x026c('0x75')]?_[_0x026c('0x74')](_0x2b4423[_0x3bc6bb[_0x5680c4][_0x026c('0x75')]],'%s',_0x12c814):_0x12c814;if(_0x3bc6bb[_0x5680c4][_0x026c('0x76')]){_0x15495d[_0x026c('0x6a')](_0x12c814);}_0x3bc6bb[_0x5680c4]['orderBy']&&_0x15495d['order'](_0x12c814,_0x3bc6bb[_0x5680c4][_0x026c('0x77')]==='DESC'?![]:!![]);_0x15495d[_0x026c('0x6b')](_0x12c814,_0x3bc6bb[_0x5680c4][_0x026c('0x79')]||_0x12c814);}if(_0x21ab76['joins']){_0x21ab76[_0x026c('0x7a')]=JSON[_0x026c('0x7b')](_0x21ab76[_0x026c('0x7a')]);for(var _0x57400e=0x0;_0x57400e<_0x21ab76[_0x026c('0x7a')][_0x026c('0x3b')];_0x57400e+=0x1){if(_0x21ab76['joins'][_0x57400e][_0x026c('0x44')]&&_[_0x026c('0x64')](_0x2a6db3,_0x21ab76[_0x026c('0x7a')][_0x57400e][_0x026c('0x44')])&&_0x21ab76[_0x026c('0x7a')][_0x57400e][_0x026c('0x7c')]&&_0x21ab76[_0x026c('0x7a')][_0x57400e][_0x026c('0x7d')]&&_0x21ab76[_0x026c('0x7a')][_0x57400e][_0x026c('0x7e')]){_0x15495d[_0x21ab76[_0x026c('0x7a')][_0x57400e]['type']](_0x21ab76['joins'][_0x57400e][_0x026c('0x7d')],null,util[_0x026c('0x75')](_0x026c('0x7f'),_0x21ab76[_0x026c('0x80')],_0x21ab76['joins'][_0x57400e][_0x026c('0x7c')],_0x21ab76[_0x026c('0x7a')][_0x57400e][_0x026c('0x7d')],_0x21ab76[_0x026c('0x7a')][_0x57400e]['foreignKey']));}}}if(_0x21ab76[_0x026c('0x81')]){_0x21ab76[_0x026c('0x81')]=JSON['parse'](_0x21ab76[_0x026c('0x81')]);_0x15495d[_0x026c('0x40')](_0x166712(_0x21ab76['conditions']['group']));}_0xbdcc2b=_0x15495d[_0x026c('0x82')]();_0x15495d[_0x026c('0x3e')](_0x161da5);_0x15495d['offset'](0x0);logger[_0x026c('0x83')]('Limited\x20Query:',_0x15495d['toString']());return db[_0x026c('0x86')]['query'](_0x15495d[_0x026c('0x85')](),{'type':db[_0x026c('0x86')]['QueryTypes'][_0x026c('0x87')]});}})[_0x026c('0x28')](function(){return{'sql':_0xbdcc2b['toString']()};})[_0x026c('0x28')](respondWithResult(_0x52db5e,null))[_0x026c('0x54')](handleError(_0x52db5e,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 1fa7d16..3904b21 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 _0x53ec=['bluebird','path','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','lodash','util','../../config/logger','api','moment'];(function(_0x20d6d5,_0x1ae0bc){var _0x5bb62a=function(_0x430f0c){while(--_0x430f0c){_0x20d6d5['push'](_0x20d6d5['shift']());}};_0x5bb62a(++_0x1ae0bc);}(_0x53ec,0x192));var _0xc53e=function(_0x1dc01f,_0x157a75){_0x1dc01f=_0x1dc01f-0x0;var _0x298041=_0x53ec[_0x1dc01f];return _0x298041;};'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 fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','lodash','util'];(function(_0x1a9bd6,_0x20bcb8){var _0x8d30a5=function(_0x199e7a){while(--_0x199e7a){_0x1a9bd6['push'](_0x1a9bd6['shift']());}};_0x8d30a5(++_0x20bcb8);}(_0x7a54,0x106));var _0x47a5=function(_0x13cc57,_0x4b99ab){_0x13cc57=_0x13cc57-0x0;var _0x177d16=_0x7a54[_0x13cc57];return _0x177d16;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 61c7401..7c05e31 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 _0xd957=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x38b3cb,_0x4ad7b3){var _0x5a9a84=function(_0x237634){while(--_0x237634){_0x38b3cb['push'](_0x38b3cb['shift']());}};_0x5a9a84(++_0x4ad7b3);}(_0xd957,0x153));var _0x7d95=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd957[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x7d95('0x0'));var util=require(_0x7d95('0x1'));var moment=require('moment');var BPromise=require(_0x7d95('0x2'));var rs=require(_0x7d95('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d95('0x4'))['db'];var utils=require(_0x7d95('0x5'));var logger=require(_0x7d95('0x6'))(_0x7d95('0x7'));var config=require(_0x7d95('0x8'));var jayson=require(_0x7d95('0x9'));var client=jayson[_0x7d95('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x181ca5,_0x11bb29,_0x4f10ec){return new BPromise(function(_0xfd14f6,_0x399d23){return client[_0x7d95('0xb')](_0x181ca5,_0x4f10ec)[_0x7d95('0xc')](function(_0x173838){logger['info'](_0x7d95('0xd'),_0x11bb29,_0x7d95('0xe'));logger[_0x7d95('0xf')](_0x7d95('0x10'),_0x11bb29,_0x7d95('0xe'),JSON['stringify'](_0x173838));if(_0x173838['error']){if(_0x173838[_0x7d95('0x11')][_0x7d95('0x12')]===0x1f4){logger['error'](_0x7d95('0xd'),_0x11bb29,_0x173838[_0x7d95('0x11')][_0x7d95('0x13')]);return _0x399d23(_0x173838[_0x7d95('0x11')][_0x7d95('0x13')]);}logger[_0x7d95('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x11bb29,_0x173838[_0x7d95('0x11')]['message']);return _0xfd14f6(_0x173838[_0x7d95('0x11')]['message']);}else{logger[_0x7d95('0x14')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x11bb29,_0x7d95('0xe'));_0xfd14f6(_0x173838[_0x7d95('0x15')][_0x7d95('0x13')]);}})[_0x7d95('0x16')](function(_0x5ab72e){logger['error'](_0x7d95('0xd'),_0x11bb29,_0x5ab72e);_0x399d23(_0x5ab72e);});});} \ No newline at end of file +var _0x76bc=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','lodash'];(function(_0x5dfc41,_0x48746b){var _0x110021=function(_0x4e76f4){while(--_0x4e76f4){_0x5dfc41['push'](_0x5dfc41['shift']());}};_0x110021(++_0x48746b);}(_0x76bc,0x17f));var _0xc76b=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0x76bc[_0x240261];return _0x45c332;};'use strict';var _=require(_0xc76b('0x0'));var util=require(_0xc76b('0x1'));var moment=require(_0xc76b('0x2'));var BPromise=require(_0xc76b('0x3'));var rs=require(_0xc76b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc76b('0x5'));var logger=require(_0xc76b('0x6'))(_0xc76b('0x7'));var config=require(_0xc76b('0x8'));var jayson=require(_0xc76b('0x9'));var client=jayson[_0xc76b('0xa')][_0xc76b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cbe53,_0x110f3b,_0x1cb174){return new BPromise(function(_0x235ff3,_0xaf195c){return client[_0xc76b('0xc')](_0x2cbe53,_0x1cb174)[_0xc76b('0xd')](function(_0x2803e9){logger[_0xc76b('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x110f3b,_0xc76b('0xf'));logger[_0xc76b('0x10')](_0xc76b('0x11'),_0x110f3b,_0xc76b('0xf'),JSON[_0xc76b('0x12')](_0x2803e9));if(_0x2803e9[_0xc76b('0x13')]){if(_0x2803e9['error'][_0xc76b('0x14')]===0x1f4){logger[_0xc76b('0x13')](_0xc76b('0x15'),_0x110f3b,_0x2803e9[_0xc76b('0x13')][_0xc76b('0x16')]);return _0xaf195c(_0x2803e9[_0xc76b('0x13')][_0xc76b('0x16')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x110f3b,_0x2803e9[_0xc76b('0x13')][_0xc76b('0x16')]);return _0x235ff3(_0x2803e9[_0xc76b('0x13')][_0xc76b('0x16')]);}else{logger[_0xc76b('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x110f3b,_0xc76b('0xf'));_0x235ff3(_0x2803e9[_0xc76b('0x17')][_0xc76b('0x16')]);}})['catch'](function(_0x4e759e){logger[_0xc76b('0x13')](_0xc76b('0x15'),_0x110f3b,_0x4e759e);_0xaf195c(_0x4e759e);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index f66bfe6..46c1135 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 _0x4321=['run','/:id/query','query','create','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','isAuthenticated','get','/:id/preview','preview'];(function(_0x5182f9,_0x4acf0c){var _0x4c9fad=function(_0x453b0e){while(--_0x453b0e){_0x5182f9['push'](_0x5182f9['shift']());}};_0x4c9fad(++_0x4acf0c);}(_0x4321,0x134));var _0x1432=function(_0x50e97d,_0x2b574d){_0x50e97d=_0x50e97d-0x0;var _0x113a5b=_0x4321[_0x50e97d];return _0x113a5b;};'use strict';var multer=require('multer');var util=require(_0x1432('0x0'));var path=require(_0x1432('0x1'));var timeout=require(_0x1432('0x2'));var express=require(_0x1432('0x3'));var router=express[_0x1432('0x4')]();var auth=require(_0x1432('0x5'));var interaction=require(_0x1432('0x6'));var config=require('../../config/environment');var controller=require(_0x1432('0x7'));router['get']('/',auth[_0x1432('0x8')](),controller['index']);router[_0x1432('0x9')]('/:id',auth[_0x1432('0x8')](),controller['show']);router[_0x1432('0x9')](_0x1432('0xa'),auth[_0x1432('0x8')](),controller[_0x1432('0xb')]);router[_0x1432('0x9')]('/:id/run',auth[_0x1432('0x8')](),controller[_0x1432('0xc')]);router[_0x1432('0x9')](_0x1432('0xd'),auth[_0x1432('0x8')](),controller[_0x1432('0xe')]);router['post']('/',auth[_0x1432('0x8')](),controller[_0x1432('0xf')]);router['put'](_0x1432('0x10'),auth[_0x1432('0x8')](),controller[_0x1432('0x11')]);router['delete'](_0x1432('0x10'),auth['isAuthenticated'](),controller[_0x1432('0x12')]);module[_0x1432('0x13')]=router; \ No newline at end of file +var _0x3de6=['../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5bf811,_0x348069){var _0x12d3a5=function(_0x4d9395){while(--_0x4d9395){_0x5bf811['push'](_0x5bf811['shift']());}};_0x12d3a5(++_0x348069);}(_0x3de6,0x199));var _0x63de=function(_0x51a645,_0x14c255){_0x51a645=_0x51a645-0x0;var _0x5d7f72=_0x3de6[_0x51a645];return _0x5d7f72;};'use strict';var multer=require(_0x63de('0x0'));var util=require(_0x63de('0x1'));var path=require('path');var timeout=require(_0x63de('0x2'));var express=require(_0x63de('0x3'));var router=express[_0x63de('0x4')]();var auth=require(_0x63de('0x5'));var interaction=require(_0x63de('0x6'));var config=require(_0x63de('0x7'));var controller=require(_0x63de('0x8'));router[_0x63de('0x9')]('/',auth[_0x63de('0xa')](),controller[_0x63de('0xb')]);router[_0x63de('0x9')](_0x63de('0xc'),auth[_0x63de('0xa')](),controller['show']);router[_0x63de('0x9')](_0x63de('0xd'),auth[_0x63de('0xa')](),controller[_0x63de('0xe')]);router[_0x63de('0x9')](_0x63de('0xf'),auth['isAuthenticated'](),controller[_0x63de('0x10')]);router['get'](_0x63de('0x11'),auth['isAuthenticated'](),controller[_0x63de('0x12')]);router[_0x63de('0x13')]('/',auth[_0x63de('0xa')](),controller[_0x63de('0x14')]);router[_0x63de('0x15')](_0x63de('0xc'),auth['isAuthenticated'](),controller[_0x63de('0x16')]);router[_0x63de('0x17')](_0x63de('0xc'),auth['isAuthenticated'](),controller[_0x63de('0x18')]);module[_0x63de('0x19')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index c47d0b9..5e38e04 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 _0xe144=['STRING','ENUM','pdf','xlsx','csv','DATE','Loading','manual','scheduled','sequelize','moment','exports'];(function(_0x559b06,_0x46ad96){var _0x109308=function(_0x21719f){while(--_0x21719f){_0x559b06['push'](_0x559b06['shift']());}};_0x109308(++_0x46ad96);}(_0xe144,0x11d));var _0x4e14=function(_0x330723,_0x8de382){_0x330723=_0x330723-0x0;var _0x60c546=_0xe144[_0x330723];return _0x60c546;};'use strict';var Sequelize=require(_0x4e14('0x0'));var moment=require(_0x4e14('0x1'));module[_0x4e14('0x2')]={'name':{'type':Sequelize[_0x4e14('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x4e14('0x4')]('csv',_0x4e14('0x5'),_0x4e14('0x6')),'allowNull':![],'defaultValue':_0x4e14('0x7')},'savename':{'type':Sequelize[_0x4e14('0x3')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x4e14('0x8')]},'status':{'type':Sequelize[_0x4e14('0x3')],'defaultValue':_0x4e14('0x9')},'type':{'type':Sequelize[_0x4e14('0x4')](_0x4e14('0xa'),_0x4e14('0xb')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x4e14('0x3')]}}; \ No newline at end of file +var _0x87e7=['manual','INTEGER','UNSIGNED','sequelize','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading'];(function(_0x4de003,_0x1677e9){var _0x2875b9=function(_0x686fda){while(--_0x686fda){_0x4de003['push'](_0x4de003['shift']());}};_0x2875b9(++_0x1677e9);}(_0x87e7,0x1cb));var _0x787e=function(_0x291aaf,_0x4c6d8d){_0x291aaf=_0x291aaf-0x0;var _0x5571e6=_0x87e7[_0x291aaf];return _0x5571e6;};'use strict';var Sequelize=require(_0x787e('0x0'));var moment=require('moment');module[_0x787e('0x1')]={'name':{'type':Sequelize[_0x787e('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x787e('0x3')](_0x787e('0x4'),_0x787e('0x5'),_0x787e('0x6')),'allowNull':![],'defaultValue':_0x787e('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x787e('0x7')]},'endDate':{'type':Sequelize[_0x787e('0x7')]},'status':{'type':Sequelize[_0x787e('0x2')],'defaultValue':_0x787e('0x8')},'type':{'type':Sequelize[_0x787e('0x3')](_0x787e('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0x787e('0x9')},'reportId':{'type':Sequelize[_0x787e('0xa')](0xb)[_0x787e('0xb')]},'reportType':{'type':Sequelize[_0x787e('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 0641633..f893cba 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 _0x6658=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','join','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','toLowerCase','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','name','index','AnalyticExtractedReport','type','key','model','query','keys','filters','attributes','intersection','fields','length'];(function(_0x37b9cc,_0x5e59be){var _0x1aa9c6=function(_0x2fedf){while(--_0x2fedf){_0x37b9cc['push'](_0x37b9cc['shift']());}};_0x1aa9c6(++_0x5e59be);}(_0x6658,0xe5));var _0x8665=function(_0x45a093,_0x2a8239){_0x45a093=_0x45a093-0x0;var _0x56bf35=_0x6658[_0x45a093];return _0x56bf35;};'use strict';var pdf=require(_0x8665('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8665('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8665('0x2'));var rp=require(_0x8665('0x3'));var moment=require(_0x8665('0x4'));var BPromise=require(_0x8665('0x5'));var Mustache=require(_0x8665('0x6'));var util=require(_0x8665('0x7'));var path=require(_0x8665('0x8'));var sox=require(_0x8665('0x9'));var csv=require('to-csv');var ejs=require(_0x8665('0xa'));var fs=require('fs');var _=require(_0x8665('0xb'));var squel=require(_0x8665('0xc'));var crypto=require(_0x8665('0xd'));var jsforce=require(_0x8665('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8665('0xf'));var querystring=require(_0x8665('0x10'));var Papa=require('papaparse');var Redis=require(_0x8665('0x11'));var authService=require(_0x8665('0x12'));var qs=require(_0x8665('0x13'));var as=require(_0x8665('0x14'));var hardwareService=require(_0x8665('0x15'));var logger=require(_0x8665('0x16'))('api');var utils=require(_0x8665('0x17'));var config=require(_0x8665('0x18'));var db=require(_0x8665('0x19'))['db'];function respondWithStatusCode(_0x539397,_0x1a2033){_0x1a2033=_0x1a2033||0xcc;return function(_0x3f33ed){if(_0x3f33ed){return _0x539397[_0x8665('0x1a')](_0x1a2033);}return _0x539397[_0x8665('0x1b')](_0x1a2033)['end']();};}function respondWithResult(_0x474337,_0x318b7e){_0x318b7e=_0x318b7e||0xc8;return function(_0x1bce2c){if(_0x1bce2c){return _0x474337[_0x8665('0x1b')](_0x318b7e)[_0x8665('0x1c')](_0x1bce2c);}};}function respondWithFilteredResult(_0x318371,_0x4adb92){return function(_0x19ff05){if(_0x19ff05){var _0x5fd055=_0x19ff05[_0x8665('0x1d')],_0x451d9d=_0x4adb92[_0x8665('0x1e')],_0x2e1d11=_0x4adb92[_0x8665('0x1e')]+_0x4adb92[_0x8665('0x1f')],_0x20178a;if(_0x2e1d11>=_0x5fd055){_0x2e1d11=_0x5fd055;_0x20178a=0xc8;}else{_0x20178a=0xce;}_0x318371[_0x8665('0x1b')](_0x20178a);return _0x318371[_0x8665('0x20')](_0x8665('0x21'),_0x451d9d+'-'+_0x2e1d11+'/'+_0x5fd055)[_0x8665('0x1c')](_0x19ff05);}return null;};}function patchUpdates(_0x184098){return function(_0x171a46){try{jsonpatch['apply'](_0x171a46,_0x184098,!![]);}catch(_0x331961){return BPromise[_0x8665('0x22')](_0x331961);}return _0x171a46[_0x8665('0x23')]();};}function saveUpdates(_0x348c14,_0x66bdd5){return function(_0x21e35a){if(_0x21e35a){return _0x21e35a[_0x8665('0x24')](_0x348c14)[_0x8665('0x25')](function(_0x3c9b5b){return _0x3c9b5b;});}return null;};}function removeEntity(_0x531f97,_0x2b581d){return function(_0xfd89af){if(_0xfd89af){return _0xfd89af[_0x8665('0x26')]()[_0x8665('0x25')](function(){var _0x48298b=_0xfd89af[_0x8665('0x27')]({'plain':!![]});var _0x4d8db9=_0x8665('0x28');return db[_0x8665('0x29')][_0x8665('0x26')]({'where':{'type':_0x4d8db9,'resourceId':_0x48298b['id']}})[_0x8665('0x25')](function(){return _0xfd89af;});})[_0x8665('0x25')](function(){_0x531f97[_0x8665('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x66bdeb,_0x30ae5f){return function(_0x36cf8f){if(!_0x36cf8f){_0x66bdeb[_0x8665('0x1a')](0x194);}return _0x36cf8f;};}function handleError(_0xf4e028,_0x3c7bb6){_0x3c7bb6=_0x3c7bb6||0x1f4;return function(_0x599b13){logger[_0x8665('0x2a')](_0x599b13['stack']);if(_0x599b13[_0x8665('0x2b')]){delete _0x599b13['name'];}_0xf4e028['status'](_0x3c7bb6)['send'](_0x599b13);};}exports[_0x8665('0x2c')]=function(_0x28d334,_0x390a45){var _0x1637fb={},_0x278fbe={},_0x57f749={'count':0x0,'rows':[]};var _0x3c5ae3=_['map'](db[_0x8665('0x2d')]['rawAttributes'],function(_0xc3dbe3){return{'name':_0xc3dbe3['fieldName'],'type':_0xc3dbe3[_0x8665('0x2e')][_0x8665('0x2f')]};});_0x278fbe[_0x8665('0x30')]=_['map'](_0x3c5ae3,'name');_0x278fbe[_0x8665('0x31')]=_[_0x8665('0x32')](_0x28d334[_0x8665('0x31')]);_0x278fbe[_0x8665('0x33')]=_['intersection'](_0x278fbe['model'],_0x278fbe[_0x8665('0x31')]);_0x1637fb[_0x8665('0x34')]=_[_0x8665('0x35')](_0x278fbe['model'],qs[_0x8665('0x36')](_0x28d334['query'][_0x8665('0x36')]));_0x1637fb[_0x8665('0x34')]=_0x1637fb[_0x8665('0x34')][_0x8665('0x37')]?_0x1637fb['attributes']:_0x278fbe[_0x8665('0x30')];if(!_0x28d334[_0x8665('0x31')][_0x8665('0x38')](_0x8665('0x39'))){_0x1637fb[_0x8665('0x1f')]=qs[_0x8665('0x1f')](_0x28d334['query'][_0x8665('0x1f')]);_0x1637fb[_0x8665('0x1e')]=qs[_0x8665('0x1e')](_0x28d334['query'][_0x8665('0x1e')]);}_0x1637fb[_0x8665('0x3a')]=qs[_0x8665('0x3b')](_0x28d334[_0x8665('0x31')][_0x8665('0x3b')]);_0x1637fb[_0x8665('0x3c')]=qs['filters'](_[_0x8665('0x3d')](_0x28d334[_0x8665('0x31')],_0x278fbe[_0x8665('0x33')]),_0x3c5ae3);if(_0x28d334[_0x8665('0x31')][_0x8665('0x3e')]){_0x1637fb['where']=_[_0x8665('0x3f')](_0x1637fb[_0x8665('0x3c')],{'$or':_['map'](_0x3c5ae3,function(_0x505cc8){if(_0x505cc8[_0x8665('0x2e')]!==_0x8665('0x40')){var _0x39d50a={};_0x39d50a[_0x505cc8[_0x8665('0x2b')]]={'$like':'%'+_0x28d334[_0x8665('0x31')][_0x8665('0x3e')]+'%'};return _0x39d50a;}})});}_0x1637fb=_[_0x8665('0x3f')]({},_0x1637fb,_0x28d334[_0x8665('0x41')]);var _0x10409f={'where':_0x1637fb[_0x8665('0x3c')]};return db[_0x8665('0x2d')][_0x8665('0x1d')](_0x10409f)[_0x8665('0x25')](function(_0x4acf2f){_0x57f749['count']=_0x4acf2f;if(_0x28d334[_0x8665('0x31')][_0x8665('0x42')]){_0x1637fb[_0x8665('0x43')]=[{'all':!![]}];}return db[_0x8665('0x2d')][_0x8665('0x44')](_0x1637fb);})[_0x8665('0x25')](function(_0x29c422){_0x57f749[_0x8665('0x45')]=_0x29c422;return _0x57f749;})[_0x8665('0x25')](respondWithFilteredResult(_0x390a45,_0x1637fb))[_0x8665('0x46')](handleError(_0x390a45,null));};exports[_0x8665('0x47')]=function(_0x2618ac,_0x439389){var _0x2f8ea6={'raw':!![],'where':{'id':_0x2618ac[_0x8665('0x48')]['id']}},_0x1886b6={};_0x1886b6[_0x8665('0x30')]=_[_0x8665('0x32')](db[_0x8665('0x2d')][_0x8665('0x49')]);_0x1886b6['query']=_['keys'](_0x2618ac['query']);_0x1886b6[_0x8665('0x33')]=_['intersection'](_0x1886b6[_0x8665('0x30')],_0x1886b6[_0x8665('0x31')]);_0x2f8ea6[_0x8665('0x34')]=_[_0x8665('0x35')](_0x1886b6[_0x8665('0x30')],qs['fields'](_0x2618ac[_0x8665('0x31')]['fields']));_0x2f8ea6[_0x8665('0x34')]=_0x2f8ea6[_0x8665('0x34')][_0x8665('0x37')]?_0x2f8ea6[_0x8665('0x34')]:_0x1886b6[_0x8665('0x30')];if(_0x2618ac[_0x8665('0x31')][_0x8665('0x42')]){_0x2f8ea6[_0x8665('0x43')]=[{'all':!![]}];}_0x2f8ea6=_['merge']({},_0x2f8ea6,_0x2618ac[_0x8665('0x41')]);return db[_0x8665('0x2d')]['find'](_0x2f8ea6)[_0x8665('0x25')](handleEntityNotFound(_0x439389,null))[_0x8665('0x25')](respondWithResult(_0x439389,null))['catch'](handleError(_0x439389,null));};exports[_0x8665('0x4a')]=function(_0x9a0f71,_0xa3f7c7){return db[_0x8665('0x2d')][_0x8665('0x4a')](_0x9a0f71[_0x8665('0x4b')],{})['then'](function(_0x3dbd36){var _0x4b14e6=_0x9a0f71[_0x8665('0x4c')][_0x8665('0x27')]({'plain':!![]});if(!_0x4b14e6)throw new Error(_0x8665('0x4d'));if(_0x4b14e6[_0x8665('0x4e')]===_0x8665('0x4c')){var _0x3e63cd=_0x3dbd36[_0x8665('0x27')]({'plain':!![]});var _0x14257d=_0x8665('0x28');return db[_0x8665('0x4f')][_0x8665('0x50')]({'where':{'name':_0x14257d,'userProfileId':_0x4b14e6[_0x8665('0x51')]},'raw':!![]})['then'](function(_0x16935f){if(_0x16935f&&_0x16935f['autoAssociation']===0x0){return db[_0x8665('0x29')][_0x8665('0x4a')]({'name':_0x3e63cd[_0x8665('0x2b')],'resourceId':_0x3e63cd['id'],'type':_0x16935f[_0x8665('0x2b')],'sectionId':_0x16935f['id']},{})[_0x8665('0x25')](function(){return _0x3dbd36;});}else{return _0x3dbd36;}})[_0x8665('0x46')](function(_0x541730){logger[_0x8665('0x2a')](_0x8665('0x52'),_0x541730);throw _0x541730;});}return _0x3dbd36;})['then'](respondWithResult(_0xa3f7c7,0xc9))[_0x8665('0x46')](handleError(_0xa3f7c7,null));};exports[_0x8665('0x24')]=function(_0x252bb1,_0x2050c6){if(_0x252bb1[_0x8665('0x4b')]['id']){delete _0x252bb1[_0x8665('0x4b')]['id'];}return db['AnalyticExtractedReport'][_0x8665('0x50')]({'where':{'id':_0x252bb1[_0x8665('0x48')]['id']}})['then'](handleEntityNotFound(_0x2050c6,null))['then'](saveUpdates(_0x252bb1[_0x8665('0x4b')],null))[_0x8665('0x25')](respondWithResult(_0x2050c6,null))[_0x8665('0x46')](handleError(_0x2050c6,null));};exports[_0x8665('0x26')]=function(_0x437079,_0x3ad761){return db[_0x8665('0x2d')]['find']({'where':{'id':_0x437079[_0x8665('0x48')]['id']}})[_0x8665('0x25')](handleEntityNotFound(_0x3ad761,null))[_0x8665('0x25')](removeEntity(_0x3ad761,null))[_0x8665('0x46')](handleError(_0x3ad761,null));};exports[_0x8665('0x53')]=function(_0x45745e,_0x2bbe77,_0x5d1233){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x45745e['params']['id']},'attributes':['name',_0x8665('0x54'),_0x8665('0x55'),_0x8665('0x56')],'raw':!![]})[_0x8665('0x25')](handleEntityNotFound(_0x2bbe77,null))[_0x8665('0x25')](function(_0x1b7b46){if(_0x1b7b46){if(!fs[_0x8665('0x57')](path[_0x8665('0x58')](config[_0x8665('0x59')],_0x8665('0x5a'),_0x1b7b46['savename']))){throw new db['Sequelize'][(_0x8665('0x5b'))](_0x8665('0x5c'));}if(_0x45745e['query'][_0x8665('0x5d')]){return _0x2bbe77[_0x8665('0x1a')](0xc8);}return _0x2bbe77[_0x8665('0x53')](path[_0x8665('0x58')](config['root'],_0x8665('0x5a'),_0x1b7b46[_0x8665('0x55')]),util['format']('%s.%s',_0x1b7b46[_0x8665('0x54')]||_0x1b7b46[_0x8665('0x2b')],_0x1b7b46['output'][_0x8665('0x5e')]()));}})['catch'](handleError(_0x2bbe77,null));}; \ No newline at end of file +var _0x327f=['map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','keys','filters','attributes','intersection','fields','query','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','includeAll','find','create','user','role','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','download','basename','savename','output','existsSync','join','root','server/files/reports','Report\x20not\x20found\x20or\x20empty','sendStatus','format','%s.%s','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','index'];(function(_0x575246,_0x77ec5d){var _0x223f70=function(_0x349c28){while(--_0x349c28){_0x575246['push'](_0x575246['shift']());}};_0x223f70(++_0x77ec5d);}(_0x327f,0x92));var _0xf327=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x327f[_0xfae23b];return _0x200640;};'use strict';var pdf=require(_0xf327('0x0'));var emlformat=require(_0xf327('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xf327('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf327('0x3'));var BPromise=require(_0xf327('0x4'));var Mustache=require(_0xf327('0x5'));var util=require(_0xf327('0x6'));var path=require(_0xf327('0x7'));var sox=require(_0xf327('0x8'));var csv=require('to-csv');var ejs=require(_0xf327('0x9'));var fs=require('fs');var _=require(_0xf327('0xa'));var squel=require('squel');var crypto=require(_0xf327('0xb'));var jsforce=require(_0xf327('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf327('0xd'));var querystring=require(_0xf327('0xe'));var Papa=require(_0xf327('0xf'));var Redis=require(_0xf327('0x10'));var authService=require(_0xf327('0x11'));var qs=require(_0xf327('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf327('0x13'));var logger=require(_0xf327('0x14'))(_0xf327('0x15'));var utils=require(_0xf327('0x16'));var config=require(_0xf327('0x17'));var db=require(_0xf327('0x18'))['db'];function respondWithStatusCode(_0x35c92f,_0x3b2562){_0x3b2562=_0x3b2562||0xcc;return function(_0x2c9ebe){if(_0x2c9ebe){return _0x35c92f['sendStatus'](_0x3b2562);}return _0x35c92f['status'](_0x3b2562)['end']();};}function respondWithResult(_0x3559ea,_0x2956ec){_0x2956ec=_0x2956ec||0xc8;return function(_0x9eebd8){if(_0x9eebd8){return _0x3559ea[_0xf327('0x19')](_0x2956ec)[_0xf327('0x1a')](_0x9eebd8);}};}function respondWithFilteredResult(_0x36eec0,_0x27b957){return function(_0x5e8cf1){if(_0x5e8cf1){var _0x525c29=_0x5e8cf1[_0xf327('0x1b')],_0x10c964=_0x27b957[_0xf327('0x1c')],_0x358572=_0x27b957['offset']+_0x27b957[_0xf327('0x1d')],_0x3bb7f2;if(_0x358572>=_0x525c29){_0x358572=_0x525c29;_0x3bb7f2=0xc8;}else{_0x3bb7f2=0xce;}_0x36eec0[_0xf327('0x19')](_0x3bb7f2);return _0x36eec0[_0xf327('0x1e')](_0xf327('0x1f'),_0x10c964+'-'+_0x358572+'/'+_0x525c29)[_0xf327('0x1a')](_0x5e8cf1);}return null;};}function patchUpdates(_0x236a65){return function(_0x24cef1){try{jsonpatch[_0xf327('0x20')](_0x24cef1,_0x236a65,!![]);}catch(_0x785246){return BPromise[_0xf327('0x21')](_0x785246);}return _0x24cef1[_0xf327('0x22')]();};}function saveUpdates(_0x1dbe4d,_0x40438e){return function(_0x783a43){if(_0x783a43){return _0x783a43[_0xf327('0x23')](_0x1dbe4d)[_0xf327('0x24')](function(_0x48b38f){return _0x48b38f;});}return null;};}function removeEntity(_0xfd750f,_0x1a639f){return function(_0x2f9c7e){if(_0x2f9c7e){return _0x2f9c7e[_0xf327('0x25')]()['then'](function(){var _0x27da75=_0x2f9c7e[_0xf327('0x26')]({'plain':!![]});var _0x3cdebc='ExtractedReports';return db[_0xf327('0x27')]['destroy']({'where':{'type':_0x3cdebc,'resourceId':_0x27da75['id']}})[_0xf327('0x24')](function(){return _0x2f9c7e;});})['then'](function(){_0xfd750f[_0xf327('0x19')](0xcc)[_0xf327('0x28')]();});}};}function handleEntityNotFound(_0x3abf80,_0x2ceb78){return function(_0x301f2e){if(!_0x301f2e){_0x3abf80['sendStatus'](0x194);}return _0x301f2e;};}function handleError(_0x93fa96,_0xf555f0){_0xf555f0=_0xf555f0||0x1f4;return function(_0x2a4ef7){logger[_0xf327('0x29')](_0x2a4ef7['stack']);if(_0x2a4ef7['name']){delete _0x2a4ef7[_0xf327('0x2a')];}_0x93fa96['status'](_0xf555f0)['send'](_0x2a4ef7);};}exports[_0xf327('0x2b')]=function(_0x3ce6d6,_0x342618){var _0x4a3baa={},_0x45b608={},_0x1081c0={'count':0x0,'rows':[]};var _0x521c9c=_[_0xf327('0x2c')](db[_0xf327('0x2d')][_0xf327('0x2e')],function(_0x118cdb){return{'name':_0x118cdb[_0xf327('0x2f')],'type':_0x118cdb[_0xf327('0x30')][_0xf327('0x31')]};});_0x45b608[_0xf327('0x32')]=_[_0xf327('0x2c')](_0x521c9c,'name');_0x45b608['query']=_[_0xf327('0x33')](_0x3ce6d6['query']);_0x45b608[_0xf327('0x34')]=_['intersection'](_0x45b608[_0xf327('0x32')],_0x45b608['query']);_0x4a3baa[_0xf327('0x35')]=_[_0xf327('0x36')](_0x45b608[_0xf327('0x32')],qs[_0xf327('0x37')](_0x3ce6d6[_0xf327('0x38')]['fields']));_0x4a3baa[_0xf327('0x35')]=_0x4a3baa[_0xf327('0x35')][_0xf327('0x39')]?_0x4a3baa[_0xf327('0x35')]:_0x45b608[_0xf327('0x32')];if(!_0x3ce6d6[_0xf327('0x38')][_0xf327('0x3a')]('nolimit')){_0x4a3baa[_0xf327('0x1d')]=qs[_0xf327('0x1d')](_0x3ce6d6[_0xf327('0x38')][_0xf327('0x1d')]);_0x4a3baa[_0xf327('0x1c')]=qs[_0xf327('0x1c')](_0x3ce6d6[_0xf327('0x38')][_0xf327('0x1c')]);}_0x4a3baa[_0xf327('0x3b')]=qs[_0xf327('0x3c')](_0x3ce6d6[_0xf327('0x38')]['sort']);_0x4a3baa[_0xf327('0x3d')]=qs[_0xf327('0x34')](_[_0xf327('0x3e')](_0x3ce6d6[_0xf327('0x38')],_0x45b608[_0xf327('0x34')]),_0x521c9c);if(_0x3ce6d6[_0xf327('0x38')][_0xf327('0x3f')]){_0x4a3baa[_0xf327('0x3d')]=_['merge'](_0x4a3baa[_0xf327('0x3d')],{'$or':_[_0xf327('0x2c')](_0x521c9c,function(_0x302cd4){if(_0x302cd4[_0xf327('0x30')]!==_0xf327('0x40')){var _0x26001e={};_0x26001e[_0x302cd4[_0xf327('0x2a')]]={'$like':'%'+_0x3ce6d6[_0xf327('0x38')][_0xf327('0x3f')]+'%'};return _0x26001e;}})});}_0x4a3baa=_[_0xf327('0x41')]({},_0x4a3baa,_0x3ce6d6[_0xf327('0x42')]);var _0x41b39d={'where':_0x4a3baa[_0xf327('0x3d')]};return db[_0xf327('0x2d')][_0xf327('0x1b')](_0x41b39d)[_0xf327('0x24')](function(_0x39ae82){_0x1081c0['count']=_0x39ae82;if(_0x3ce6d6[_0xf327('0x38')]['includeAll']){_0x4a3baa[_0xf327('0x43')]=[{'all':!![]}];}return db[_0xf327('0x2d')][_0xf327('0x44')](_0x4a3baa);})[_0xf327('0x24')](function(_0x40f90c){_0x1081c0[_0xf327('0x45')]=_0x40f90c;return _0x1081c0;})[_0xf327('0x24')](respondWithFilteredResult(_0x342618,_0x4a3baa))['catch'](handleError(_0x342618,null));};exports['show']=function(_0x1bbe15,_0x5a2b0b){var _0x55b1c7={'raw':!![],'where':{'id':_0x1bbe15['params']['id']}},_0x3af3ba={};_0x3af3ba[_0xf327('0x32')]=_[_0xf327('0x33')](db[_0xf327('0x2d')][_0xf327('0x2e')]);_0x3af3ba['query']=_[_0xf327('0x33')](_0x1bbe15[_0xf327('0x38')]);_0x3af3ba[_0xf327('0x34')]=_[_0xf327('0x36')](_0x3af3ba['model'],_0x3af3ba[_0xf327('0x38')]);_0x55b1c7['attributes']=_['intersection'](_0x3af3ba[_0xf327('0x32')],qs[_0xf327('0x37')](_0x1bbe15[_0xf327('0x38')][_0xf327('0x37')]));_0x55b1c7[_0xf327('0x35')]=_0x55b1c7[_0xf327('0x35')][_0xf327('0x39')]?_0x55b1c7[_0xf327('0x35')]:_0x3af3ba[_0xf327('0x32')];if(_0x1bbe15[_0xf327('0x38')][_0xf327('0x46')]){_0x55b1c7[_0xf327('0x43')]=[{'all':!![]}];}_0x55b1c7=_['merge']({},_0x55b1c7,_0x1bbe15[_0xf327('0x42')]);return db[_0xf327('0x2d')][_0xf327('0x47')](_0x55b1c7)[_0xf327('0x24')](handleEntityNotFound(_0x5a2b0b,null))['then'](respondWithResult(_0x5a2b0b,null))['catch'](handleError(_0x5a2b0b,null));};exports[_0xf327('0x48')]=function(_0x3aeb10,_0x5de8a7){return db[_0xf327('0x2d')]['create'](_0x3aeb10['body'],{})[_0xf327('0x24')](function(_0x416d73){var _0x4318ff=_0x3aeb10[_0xf327('0x49')][_0xf327('0x26')]({'plain':!![]});if(!_0x4318ff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4318ff[_0xf327('0x4a')]===_0xf327('0x49')){var _0x391458=_0x416d73[_0xf327('0x26')]({'plain':!![]});var _0xc21568=_0xf327('0x4b');return db[_0xf327('0x4c')][_0xf327('0x47')]({'where':{'name':_0xc21568,'userProfileId':_0x4318ff[_0xf327('0x4d')]},'raw':!![]})[_0xf327('0x24')](function(_0x311aad){if(_0x311aad&&_0x311aad[_0xf327('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x391458['name'],'resourceId':_0x391458['id'],'type':_0x311aad[_0xf327('0x2a')],'sectionId':_0x311aad['id']},{})[_0xf327('0x24')](function(){return _0x416d73;});}else{return _0x416d73;}})[_0xf327('0x4f')](function(_0x3e9519){logger['error'](_0xf327('0x50'),_0x3e9519);throw _0x3e9519;});}return _0x416d73;})['then'](respondWithResult(_0x5de8a7,0xc9))[_0xf327('0x4f')](handleError(_0x5de8a7,null));};exports[_0xf327('0x23')]=function(_0x332a5a,_0x24fa45){if(_0x332a5a[_0xf327('0x51')]['id']){delete _0x332a5a[_0xf327('0x51')]['id'];}return db['AnalyticExtractedReport'][_0xf327('0x47')]({'where':{'id':_0x332a5a[_0xf327('0x52')]['id']}})[_0xf327('0x24')](handleEntityNotFound(_0x24fa45,null))[_0xf327('0x24')](saveUpdates(_0x332a5a[_0xf327('0x51')],null))['then'](respondWithResult(_0x24fa45,null))['catch'](handleError(_0x24fa45,null));};exports[_0xf327('0x25')]=function(_0x554026,_0x4dd54c){return db[_0xf327('0x2d')][_0xf327('0x47')]({'where':{'id':_0x554026[_0xf327('0x52')]['id']}})[_0xf327('0x24')](handleEntityNotFound(_0x4dd54c,null))[_0xf327('0x24')](removeEntity(_0x4dd54c,null))[_0xf327('0x4f')](handleError(_0x4dd54c,null));};exports[_0xf327('0x53')]=function(_0x5b7e18,_0x3c1c1e,_0x2d00bd){return db[_0xf327('0x2d')]['find']({'where':{'id':_0x5b7e18[_0xf327('0x52')]['id']},'attributes':[_0xf327('0x2a'),_0xf327('0x54'),_0xf327('0x55'),_0xf327('0x56')],'raw':!![]})[_0xf327('0x24')](handleEntityNotFound(_0x3c1c1e,null))[_0xf327('0x24')](function(_0x5f424b){if(_0x5f424b){if(!fs[_0xf327('0x57')](path[_0xf327('0x58')](config[_0xf327('0x59')],_0xf327('0x5a'),_0x5f424b['savename']))){throw new db['Sequelize']['ValidationError'](_0xf327('0x5b'));}if(_0x5b7e18[_0xf327('0x38')]['exists']){return _0x3c1c1e[_0xf327('0x5c')](0xc8);}return _0x3c1c1e[_0xf327('0x53')](path[_0xf327('0x58')](config[_0xf327('0x59')],_0xf327('0x5a'),_0x5f424b[_0xf327('0x55')]),util[_0xf327('0x5d')](_0xf327('0x5e'),_0x5f424b[_0xf327('0x54')]||_0x5f424b[_0xf327('0x2a')],_0x5f424b[_0xf327('0x56')]['toLowerCase']()));}})[_0xf327('0x4f')](handleError(_0x3c1c1e,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 8cd827d..5d3defc 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 _0xf47a=['path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','../../config/logger','api','moment','bluebird'];(function(_0xc378d6,_0x3d5ee4){var _0x1c07ee=function(_0x39c436){while(--_0x39c436){_0xc378d6['push'](_0xc378d6['shift']());}};_0x1c07ee(++_0x3d5ee4);}(_0xf47a,0x187));var _0xaf47=function(_0x5a0619,_0x5f3daf){_0x5a0619=_0x5a0619-0x0;var _0x458bf6=_0xf47a[_0x5a0619];return _0x458bf6;};'use strict';var _=require(_0xaf47('0x0'));var util=require('util');var logger=require(_0xaf47('0x1'))(_0xaf47('0x2'));var moment=require(_0xaf47('0x3'));var BPromise=require(_0xaf47('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaf47('0x5'));var rimraf=require(_0xaf47('0x6'));var config=require(_0xaf47('0x7'));var attributes=require(_0xaf47('0x8'));module[_0xaf47('0x9')]=function(_0xe93184,_0x2ae851){return _0xe93184[_0xaf47('0xa')](_0xaf47('0xb'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf477=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf477,0x10f));var _0x7f47=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xf477[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x7f47('0x0'));var util=require(_0x7f47('0x1'));var logger=require(_0x7f47('0x2'))(_0x7f47('0x3'));var moment=require('moment');var BPromise=require(_0x7f47('0x4'));var rp=require(_0x7f47('0x5'));var fs=require('fs');var path=require(_0x7f47('0x6'));var rimraf=require(_0x7f47('0x7'));var config=require(_0x7f47('0x8'));var attributes=require(_0x7f47('0x9'));module['exports']=function(_0x1b8a37,_0x5a5c44){return _0x1b8a37[_0x7f47('0xa')](_0x7f47('0xb'),attributes,{'tableName':_0x7f47('0xc'),'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 e4ae430..9287f18 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 _0x6b49=['debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6b49,0x1d4));var _0x96b4=function(_0x8e8ca7,_0x5a5e07){_0x8e8ca7=_0x8e8ca7-0x0;var _0x561381=_0x6b49[_0x8e8ca7];return _0x561381;};'use strict';var _=require(_0x96b4('0x0'));var util=require(_0x96b4('0x1'));var moment=require(_0x96b4('0x2'));var BPromise=require(_0x96b4('0x3'));var rs=require(_0x96b4('0x4'));var fs=require('fs');var Redis=require(_0x96b4('0x5'));var db=require(_0x96b4('0x6'))['db'];var utils=require(_0x96b4('0x7'));var logger=require(_0x96b4('0x8'))(_0x96b4('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x96b4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19d0c4,_0x35082a,_0x5ba878){return new BPromise(function(_0x47589d,_0x3ae20c){return client[_0x96b4('0xb')](_0x19d0c4,_0x5ba878)['then'](function(_0x29bbb7){logger[_0x96b4('0xc')](_0x96b4('0xd'),_0x35082a,_0x96b4('0xe'));logger[_0x96b4('0xf')](_0x96b4('0x10'),_0x35082a,'request\x20sent',JSON[_0x96b4('0x11')](_0x29bbb7));if(_0x29bbb7[_0x96b4('0x12')]){if(_0x29bbb7[_0x96b4('0x12')][_0x96b4('0x13')]===0x1f4){logger[_0x96b4('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x35082a,_0x29bbb7['error'][_0x96b4('0x14')]);return _0x3ae20c(_0x29bbb7[_0x96b4('0x12')]['message']);}logger[_0x96b4('0x12')](_0x96b4('0xd'),_0x35082a,_0x29bbb7[_0x96b4('0x12')]['message']);return _0x47589d(_0x29bbb7[_0x96b4('0x12')][_0x96b4('0x14')]);}else{logger[_0x96b4('0xc')](_0x96b4('0xd'),_0x35082a,_0x96b4('0xe'));_0x47589d(_0x29bbb7[_0x96b4('0x15')][_0x96b4('0x14')]);}})[_0x96b4('0x16')](function(_0x4c7ec3){logger['error'](_0x96b4('0xd'),_0x35082a,_0x4c7ec3);_0x3ae20c(_0x4c7ec3);});});} \ No newline at end of file +var _0x06b4=['jayson/promise','client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x474f47,_0x2303b7){var _0x21bfe6=function(_0x1121d1){while(--_0x1121d1){_0x474f47['push'](_0x474f47['shift']());}};_0x21bfe6(++_0x2303b7);}(_0x06b4,0x17f));var _0x406b=function(_0x2fc4c5,_0x801c20){_0x2fc4c5=_0x2fc4c5-0x0;var _0x534a37=_0x06b4[_0x2fc4c5];return _0x534a37;};'use strict';var _=require(_0x406b('0x0'));var util=require('util');var moment=require(_0x406b('0x1'));var BPromise=require(_0x406b('0x2'));var rs=require(_0x406b('0x3'));var fs=require('fs');var Redis=require(_0x406b('0x4'));var db=require(_0x406b('0x5'))['db'];var utils=require(_0x406b('0x6'));var logger=require('../../config/logger')(_0x406b('0x7'));var config=require('../../config/environment');var jayson=require(_0x406b('0x8'));var client=jayson[_0x406b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48c367,_0x446f5f,_0x1272c5){return new BPromise(function(_0x2ef18a,_0x2d682f){return client[_0x406b('0xa')](_0x48c367,_0x1272c5)[_0x406b('0xb')](function(_0x1e3759){logger[_0x406b('0xc')](_0x406b('0xd'),_0x446f5f,'request\x20sent');logger[_0x406b('0xe')](_0x406b('0xf'),_0x446f5f,'request\x20sent',JSON[_0x406b('0x10')](_0x1e3759));if(_0x1e3759[_0x406b('0x11')]){if(_0x1e3759['error'][_0x406b('0x12')]===0x1f4){logger[_0x406b('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x446f5f,_0x1e3759[_0x406b('0x11')]['message']);return _0x2d682f(_0x1e3759['error'][_0x406b('0x13')]);}logger[_0x406b('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x446f5f,_0x1e3759['error']['message']);return _0x2ef18a(_0x1e3759[_0x406b('0x11')][_0x406b('0x13')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x446f5f,_0x406b('0x14'));_0x2ef18a(_0x1e3759[_0x406b('0x15')][_0x406b('0x13')]);}})[_0x406b('0x16')](function(_0x389735){logger[_0x406b('0x11')](_0x406b('0xd'),_0x446f5f,_0x389735);_0x2d682f(_0x389735);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 5ae7ba7..07ed4e4 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 _0x112a=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','put','update','delete','destroy'];(function(_0xe29d1a,_0x27cfdc){var _0x54db89=function(_0x5e359b){while(--_0x5e359b){_0xe29d1a['push'](_0xe29d1a['shift']());}};_0x54db89(++_0x27cfdc);}(_0x112a,0x115));var _0xa112=function(_0x4d5da7,_0x22b833){_0x4d5da7=_0x4d5da7-0x0;var _0x7d1356=_0x112a[_0x4d5da7];return _0x7d1356;};'use strict';var multer=require(_0xa112('0x0'));var util=require(_0xa112('0x1'));var path=require(_0xa112('0x2'));var timeout=require(_0xa112('0x3'));var express=require(_0xa112('0x4'));var router=express[_0xa112('0x5')]();var auth=require(_0xa112('0x6'));var interaction=require(_0xa112('0x7'));var config=require(_0xa112('0x8'));var controller=require(_0xa112('0x9'));router[_0xa112('0xa')]('/',auth[_0xa112('0xb')](),controller[_0xa112('0xc')]);router[_0xa112('0xa')](_0xa112('0xd'),auth[_0xa112('0xb')](),controller[_0xa112('0xe')]);router[_0xa112('0xa')](_0xa112('0xf'),auth[_0xa112('0xb')](),controller[_0xa112('0x10')]);router[_0xa112('0x11')]('/',auth[_0xa112('0xb')](),controller['create']);router[_0xa112('0x12')]('/:id',auth[_0xa112('0xb')](),controller[_0xa112('0x13')]);router[_0xa112('0x14')](_0xa112('0xd'),auth[_0xa112('0xb')](),controller[_0xa112('0x15')]);module[_0xa112('0x16')]=router; \ No newline at end of file +var _0x55a3=['/:id/download','post','create','put','update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x279478,_0x5d9207){var _0x141575=function(_0x2d8142){while(--_0x2d8142){_0x279478['push'](_0x279478['shift']());}};_0x141575(++_0x5d9207);}(_0x55a3,0x8c));var _0x355a=function(_0x88342d,_0xe0feb3){_0x88342d=_0x88342d-0x0;var _0x238708=_0x55a3[_0x88342d];return _0x238708;};'use strict';var multer=require(_0x355a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x355a('0x1'));var express=require(_0x355a('0x2'));var router=express[_0x355a('0x3')]();var auth=require(_0x355a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x355a('0x5'));var controller=require(_0x355a('0x6'));router[_0x355a('0x7')]('/',auth[_0x355a('0x8')](),controller[_0x355a('0x9')]);router[_0x355a('0x7')](_0x355a('0xa'),auth[_0x355a('0x8')](),controller[_0x355a('0xb')]);router[_0x355a('0x7')](_0x355a('0xc'),auth[_0x355a('0x8')](),controller['download']);router[_0x355a('0xd')]('/',auth['isAuthenticated'](),controller[_0x355a('0xe')]);router[_0x355a('0xf')](_0x355a('0xa'),auth[_0x355a('0x8')](),controller[_0x355a('0x10')]);router[_0x355a('0x11')](_0x355a('0xa'),auth[_0x355a('0x8')](),controller[_0x355a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index a3d7460..15dd4c4 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 _0xc4aa=['exports','TEXT','STRING','sequelize'];(function(_0x4f3367,_0x5b29b2){var _0x354b00=function(_0x35c813){while(--_0x35c813){_0x4f3367['push'](_0x4f3367['shift']());}};_0x354b00(++_0x5b29b2);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc4aa[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'field':{'type':Sequelize[_0xac4a('0x2')]},'alias':{'type':Sequelize[_0xac4a('0x3')]},'function':{'type':Sequelize[_0xac4a('0x3')]},'format':{'type':Sequelize[_0xac4a('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x814b=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x5076ae,_0x4d9525){var _0x1b936f=function(_0x46f2a4){while(--_0x46f2a4){_0x5076ae['push'](_0x5076ae['shift']());}};_0x1b936f(++_0x4d9525);}(_0x814b,0x1a2));var _0xb814=function(_0x134192,_0x36adc5){_0x134192=_0x134192-0x0;var _0x3cd080=_0x814b[_0x134192];return _0x3cd080;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'field':{'type':Sequelize[_0xb814('0x2')]},'alias':{'type':Sequelize[_0xb814('0x3')]},'function':{'type':Sequelize[_0xb814('0x3')]},'format':{'type':Sequelize[_0xb814('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb814('0x3')]},'custom':{'type':Sequelize[_0xb814('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index cc038bf..0dc9fb5 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 _0x2e8a=['../../config/utils','../../config/environment','sendStatus','status','json','offset','set','Content-Range','reject','save','then','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','merge','VIRTUAL','filter','options','AnalyticFieldReport','count','includeAll','findAll','catch','show','params','find','create','body','bulkCreate','destroy','ids','addFields','AnalyticCustomReport','sequelize','CustomReportId','eml-format','rimraf','fast-json-patch','request-promise','bluebird','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x24caf3,_0x4fdf9c){var _0x2840e7=function(_0x2f3de7){while(--_0x2f3de7){_0x24caf3['push'](_0x24caf3['shift']());}};_0x2840e7(++_0x4fdf9c);}(_0x2e8a,0xc7));var _0xa2e8=function(_0x2b2c53,_0x4bcf9b){_0x2b2c53=_0x2b2c53-0x0;var _0x311ec2=_0x2e8a[_0x2b2c53];return _0x311ec2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa2e8('0x0'));var rimraf=require(_0xa2e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa2e8('0x2'));var rp=require(_0xa2e8('0x3'));var moment=require('moment');var BPromise=require(_0xa2e8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xa2e8('0x5'));var ejs=require(_0xa2e8('0x6'));var fs=require('fs');var _=require(_0xa2e8('0x7'));var squel=require('squel');var crypto=require(_0xa2e8('0x8'));var jsforce=require(_0xa2e8('0x9'));var deskjs=require(_0xa2e8('0xa'));var toCsv=require(_0xa2e8('0x5'));var querystring=require('querystring');var Papa=require(_0xa2e8('0xb'));var Redis=require('ioredis');var authService=require(_0xa2e8('0xc'));var qs=require(_0xa2e8('0xd'));var as=require(_0xa2e8('0xe'));var hardwareService=require(_0xa2e8('0xf'));var logger=require(_0xa2e8('0x10'))('api');var utils=require(_0xa2e8('0x11'));var config=require(_0xa2e8('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbb58e3,_0x4e985d){_0x4e985d=_0x4e985d||0xcc;return function(_0x38abcb){if(_0x38abcb){return _0xbb58e3[_0xa2e8('0x13')](_0x4e985d);}return _0xbb58e3[_0xa2e8('0x14')](_0x4e985d)['end']();};}function respondWithResult(_0x4d03bc,_0x5e3a2b){_0x5e3a2b=_0x5e3a2b||0xc8;return function(_0x469c1e){if(_0x469c1e){return _0x4d03bc['status'](_0x5e3a2b)[_0xa2e8('0x15')](_0x469c1e);}};}function respondWithFilteredResult(_0x51494d,_0x5a99bf){return function(_0x29cd40){if(_0x29cd40){var _0x41161f=_0x29cd40['count'],_0x79aba2=_0x5a99bf[_0xa2e8('0x16')],_0x98dab7=_0x5a99bf['offset']+_0x5a99bf['limit'],_0x163482;if(_0x98dab7>=_0x41161f){_0x98dab7=_0x41161f;_0x163482=0xc8;}else{_0x163482=0xce;}_0x51494d[_0xa2e8('0x14')](_0x163482);return _0x51494d[_0xa2e8('0x17')](_0xa2e8('0x18'),_0x79aba2+'-'+_0x98dab7+'/'+_0x41161f)[_0xa2e8('0x15')](_0x29cd40);}return null;};}function patchUpdates(_0x3063ab){return function(_0x4b7f2c){try{jsonpatch['apply'](_0x4b7f2c,_0x3063ab,!![]);}catch(_0x14daed){return BPromise[_0xa2e8('0x19')](_0x14daed);}return _0x4b7f2c[_0xa2e8('0x1a')]();};}function saveUpdates(_0x1a6bbc,_0xd8f70){return function(_0x280a87){if(_0x280a87){return _0x280a87['update'](_0x1a6bbc)[_0xa2e8('0x1b')](function(_0xbeb0f0){return _0xbeb0f0;});}return null;};}function removeEntity(_0x35ace4,_0x1ba92a){return function(_0x51e9a9){if(_0x51e9a9){return _0x51e9a9['destroy']()[_0xa2e8('0x1b')](function(){_0x35ace4[_0xa2e8('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x518532,_0x520545){return function(_0x32758e){if(!_0x32758e){_0x518532[_0xa2e8('0x13')](0x194);}return _0x32758e;};}function handleError(_0x26c1eb,_0x1c4c97){_0x1c4c97=_0x1c4c97||0x1f4;return function(_0x139508){logger[_0xa2e8('0x1c')](_0x139508[_0xa2e8('0x1d')]);if(_0x139508[_0xa2e8('0x1e')]){delete _0x139508[_0xa2e8('0x1e')];}_0x26c1eb[_0xa2e8('0x14')](_0x1c4c97)[_0xa2e8('0x1f')](_0x139508);};}exports[_0xa2e8('0x20')]=function(_0x25b322,_0x529078){var _0x3f03a4={},_0x14bcf7={},_0x182052={'count':0x0,'rows':[]};var _0x29b706=_['map'](db['AnalyticFieldReport'][_0xa2e8('0x21')],function(_0x14558f){return{'name':_0x14558f['fieldName'],'type':_0x14558f[_0xa2e8('0x22')][_0xa2e8('0x23')]};});_0x14bcf7[_0xa2e8('0x24')]=_[_0xa2e8('0x25')](_0x29b706,_0xa2e8('0x1e'));_0x14bcf7[_0xa2e8('0x26')]=_[_0xa2e8('0x27')](_0x25b322['query']);_0x14bcf7['filters']=_[_0xa2e8('0x28')](_0x14bcf7[_0xa2e8('0x24')],_0x14bcf7[_0xa2e8('0x26')]);_0x3f03a4[_0xa2e8('0x29')]=_[_0xa2e8('0x28')](_0x14bcf7[_0xa2e8('0x24')],qs[_0xa2e8('0x2a')](_0x25b322[_0xa2e8('0x26')]['fields']));_0x3f03a4[_0xa2e8('0x29')]=_0x3f03a4[_0xa2e8('0x29')][_0xa2e8('0x2b')]?_0x3f03a4['attributes']:_0x14bcf7[_0xa2e8('0x24')];if(!_0x25b322[_0xa2e8('0x26')][_0xa2e8('0x2c')](_0xa2e8('0x2d'))){_0x3f03a4[_0xa2e8('0x2e')]=qs[_0xa2e8('0x2e')](_0x25b322[_0xa2e8('0x26')][_0xa2e8('0x2e')]);_0x3f03a4[_0xa2e8('0x16')]=qs[_0xa2e8('0x16')](_0x25b322[_0xa2e8('0x26')][_0xa2e8('0x16')]);}_0x3f03a4['order']=qs[_0xa2e8('0x2f')](_0x25b322[_0xa2e8('0x26')][_0xa2e8('0x2f')]);_0x3f03a4[_0xa2e8('0x30')]=qs[_0xa2e8('0x31')](_[_0xa2e8('0x32')](_0x25b322[_0xa2e8('0x26')],_0x14bcf7['filters']),_0x29b706);if(_0x25b322['query']['filter']){_0x3f03a4['where']=_[_0xa2e8('0x33')](_0x3f03a4[_0xa2e8('0x30')],{'$or':_[_0xa2e8('0x25')](_0x29b706,function(_0x22270e){if(_0x22270e['type']!==_0xa2e8('0x34')){var _0x3ea0ff={};_0x3ea0ff[_0x22270e['name']]={'$like':'%'+_0x25b322[_0xa2e8('0x26')][_0xa2e8('0x35')]+'%'};return _0x3ea0ff;}})});}_0x3f03a4=_[_0xa2e8('0x33')]({},_0x3f03a4,_0x25b322[_0xa2e8('0x36')]);var _0x2f065f={'where':_0x3f03a4[_0xa2e8('0x30')]};return db[_0xa2e8('0x37')][_0xa2e8('0x38')](_0x2f065f)[_0xa2e8('0x1b')](function(_0xd0cbdd){_0x182052[_0xa2e8('0x38')]=_0xd0cbdd;if(_0x25b322[_0xa2e8('0x26')][_0xa2e8('0x39')]){_0x3f03a4['include']=[{'all':!![]}];}return db[_0xa2e8('0x37')][_0xa2e8('0x3a')](_0x3f03a4);})[_0xa2e8('0x1b')](function(_0x544cbc){_0x182052['rows']=_0x544cbc;return _0x182052;})[_0xa2e8('0x1b')](respondWithFilteredResult(_0x529078,_0x3f03a4))[_0xa2e8('0x3b')](handleError(_0x529078,null));};exports[_0xa2e8('0x3c')]=function(_0x29090e,_0x52167d){var _0x2b24ad={'raw':![],'where':{'id':_0x29090e[_0xa2e8('0x3d')]['id']}},_0x479584={};_0x479584[_0xa2e8('0x24')]=_['keys'](db[_0xa2e8('0x37')][_0xa2e8('0x21')]);_0x479584['query']=_[_0xa2e8('0x27')](_0x29090e[_0xa2e8('0x26')]);_0x479584[_0xa2e8('0x31')]=_[_0xa2e8('0x28')](_0x479584[_0xa2e8('0x24')],_0x479584[_0xa2e8('0x26')]);_0x2b24ad['attributes']=_['intersection'](_0x479584['model'],qs['fields'](_0x29090e[_0xa2e8('0x26')][_0xa2e8('0x2a')]));_0x2b24ad[_0xa2e8('0x29')]=_0x2b24ad[_0xa2e8('0x29')][_0xa2e8('0x2b')]?_0x2b24ad[_0xa2e8('0x29')]:_0x479584['model'];if(_0x29090e[_0xa2e8('0x26')][_0xa2e8('0x39')]){_0x2b24ad['include']=[{'all':!![]}];}_0x2b24ad=_['merge']({},_0x2b24ad,_0x29090e[_0xa2e8('0x36')]);return db['AnalyticFieldReport'][_0xa2e8('0x3e')](_0x2b24ad)['then'](handleEntityNotFound(_0x52167d,null))['then'](respondWithResult(_0x52167d,null))[_0xa2e8('0x3b')](handleError(_0x52167d,null));};exports[_0xa2e8('0x3f')]=function(_0x3fd5b1,_0x175118){return db[_0xa2e8('0x37')][_0xa2e8('0x3f')](_0x3fd5b1[_0xa2e8('0x40')],{})[_0xa2e8('0x1b')](respondWithResult(_0x175118,0xc9))['catch'](handleError(_0x175118,null));};exports[_0xa2e8('0x41')]=function(_0x9c4023,_0xa5ef12){return db[_0xa2e8('0x37')][_0xa2e8('0x41')](_0x9c4023[_0xa2e8('0x40')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0xa5ef12,0xc9))[_0xa2e8('0x3b')](handleError(_0xa5ef12,null));};exports['update']=function(_0x4721fd,_0x1cb290){if(_0x4721fd[_0xa2e8('0x40')]['id']){delete _0x4721fd[_0xa2e8('0x40')]['id'];}return db['AnalyticFieldReport'][_0xa2e8('0x3e')]({'where':{'id':_0x4721fd[_0xa2e8('0x3d')]['id']}})[_0xa2e8('0x1b')](handleEntityNotFound(_0x1cb290,null))[_0xa2e8('0x1b')](saveUpdates(_0x4721fd[_0xa2e8('0x40')],null))[_0xa2e8('0x1b')](respondWithResult(_0x1cb290,null))[_0xa2e8('0x3b')](handleError(_0x1cb290,null));};exports[_0xa2e8('0x42')]=function(_0x470912,_0x228bc6){return db['AnalyticFieldReport'][_0xa2e8('0x3e')]({'where':{'id':_0x470912[_0xa2e8('0x3d')]['id']}})[_0xa2e8('0x1b')](handleEntityNotFound(_0x228bc6,null))[_0xa2e8('0x1b')](removeEntity(_0x228bc6,null))[_0xa2e8('0x3b')](handleError(_0x228bc6,null));};exports['bulkDestroy']=function(_0x75b60f,_0xfc983c){return db[_0xa2e8('0x37')][_0xa2e8('0x42')]({'where':{'id':_0x75b60f['query'][_0xa2e8('0x43')]||[]},'raw':![],'individualHooks':!![]})[_0xa2e8('0x1b')](respondWithResult(_0xfc983c,0xcc))[_0xa2e8('0x3b')](handleError(_0xfc983c,null));};exports[_0xa2e8('0x44')]=function(_0x22c87e,_0x58cb98,_0xfe0083){return db[_0xa2e8('0x45')]['findOne']({'where':{'id':_0x22c87e['params']['id']}})[_0xa2e8('0x1b')](handleEntityNotFound(_0x58cb98,null))[_0xa2e8('0x1b')](function(_0x3c48d9){if(_0x3c48d9){return db[_0xa2e8('0x46')]['transaction'](function(_0xf7aaf3){return db[_0xa2e8('0x37')][_0xa2e8('0x42')]({'where':{'CustomReportId':_0x22c87e['params']['id']},'transaction':_0xf7aaf3})[_0xa2e8('0x1b')](function(_0x14903f){var _0x10b0ac=_[_0xa2e8('0x25')](_0x22c87e[_0xa2e8('0x40')],function(_0x53bf44){delete _0x53bf44['id'];_0x53bf44[_0xa2e8('0x47')]=_0x22c87e[_0xa2e8('0x3d')]['id'];return _0x53bf44;});return db[_0xa2e8('0x37')][_0xa2e8('0x41')](_0x10b0ac,{'transaction':_0xf7aaf3});});})[_0xa2e8('0x1b')](function(){return db[_0xa2e8('0x37')][_0xa2e8('0x3a')]({'where':{'CustomReportId':_0x22c87e[_0xa2e8('0x3d')]['id']}});});}})[_0xa2e8('0x1b')](respondWithResult(_0x58cb98,null))[_0xa2e8('0x3b')](handleError(_0x58cb98,null));}; \ No newline at end of file +var _0x7c55=['filter','merge','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','bulkCreate','ids','addFields','AnalyticCustomReport','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','apply','reject','save','update','destroy','error','stack','name','index','map','AnalyticFieldReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where'];(function(_0x1e5f91,_0xa38bd9){var _0x5bb46b=function(_0x2af6e6){while(--_0x2af6e6){_0x1e5f91['push'](_0x1e5f91['shift']());}};_0x5bb46b(++_0xa38bd9);}(_0x7c55,0x180));var _0x57c5=function(_0x55bf39,_0x20a585){_0x55bf39=_0x55bf39-0x0;var _0x28d307=_0x7c55[_0x55bf39];return _0x28d307;};'use strict';var pdf=require(_0x57c5('0x0'));var emlformat=require(_0x57c5('0x1'));var rimraf=require(_0x57c5('0x2'));var zipdir=require(_0x57c5('0x3'));var jsonpatch=require(_0x57c5('0x4'));var rp=require('request-promise');var moment=require(_0x57c5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x57c5('0x6'));var util=require(_0x57c5('0x7'));var path=require(_0x57c5('0x8'));var sox=require(_0x57c5('0x9'));var csv=require(_0x57c5('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x57c5('0xb'));var deskjs=require(_0x57c5('0xc'));var toCsv=require(_0x57c5('0xa'));var querystring=require(_0x57c5('0xd'));var Papa=require(_0x57c5('0xe'));var Redis=require('ioredis');var authService=require(_0x57c5('0xf'));var qs=require(_0x57c5('0x10'));var as=require(_0x57c5('0x11'));var hardwareService=require(_0x57c5('0x12'));var logger=require('../../config/logger')(_0x57c5('0x13'));var utils=require('../../config/utils');var config=require(_0x57c5('0x14'));var db=require(_0x57c5('0x15'))['db'];function respondWithStatusCode(_0x42310d,_0x4d3a99){_0x4d3a99=_0x4d3a99||0xcc;return function(_0x29d313){if(_0x29d313){return _0x42310d[_0x57c5('0x16')](_0x4d3a99);}return _0x42310d['status'](_0x4d3a99)[_0x57c5('0x17')]();};}function respondWithResult(_0x3e0174,_0xdc2558){_0xdc2558=_0xdc2558||0xc8;return function(_0x41abfc){if(_0x41abfc){return _0x3e0174[_0x57c5('0x18')](_0xdc2558)[_0x57c5('0x19')](_0x41abfc);}};}function respondWithFilteredResult(_0x31ef5e,_0x408874){return function(_0x45f9c3){if(_0x45f9c3){var _0x3e7798=_0x45f9c3[_0x57c5('0x1a')],_0x5ef878=_0x408874['offset'],_0x151aa3=_0x408874[_0x57c5('0x1b')]+_0x408874[_0x57c5('0x1c')],_0x572385;if(_0x151aa3>=_0x3e7798){_0x151aa3=_0x3e7798;_0x572385=0xc8;}else{_0x572385=0xce;}_0x31ef5e[_0x57c5('0x18')](_0x572385);return _0x31ef5e['set']('Content-Range',_0x5ef878+'-'+_0x151aa3+'/'+_0x3e7798)['json'](_0x45f9c3);}return null;};}function patchUpdates(_0x4baace){return function(_0xe33428){try{jsonpatch[_0x57c5('0x1d')](_0xe33428,_0x4baace,!![]);}catch(_0x4b3a16){return BPromise[_0x57c5('0x1e')](_0x4b3a16);}return _0xe33428[_0x57c5('0x1f')]();};}function saveUpdates(_0x373d1a,_0x58cc9f){return function(_0x35943d){if(_0x35943d){return _0x35943d[_0x57c5('0x20')](_0x373d1a)['then'](function(_0x597e52){return _0x597e52;});}return null;};}function removeEntity(_0x56f182,_0x2a5415){return function(_0x172a4b){if(_0x172a4b){return _0x172a4b[_0x57c5('0x21')]()['then'](function(){_0x56f182[_0x57c5('0x18')](0xcc)[_0x57c5('0x17')]();});}};}function handleEntityNotFound(_0x423d1d,_0x5bb917){return function(_0x1c45f1){if(!_0x1c45f1){_0x423d1d[_0x57c5('0x16')](0x194);}return _0x1c45f1;};}function handleError(_0x22111c,_0x5ec1a1){_0x5ec1a1=_0x5ec1a1||0x1f4;return function(_0x55665d){logger[_0x57c5('0x22')](_0x55665d[_0x57c5('0x23')]);if(_0x55665d[_0x57c5('0x24')]){delete _0x55665d[_0x57c5('0x24')];}_0x22111c[_0x57c5('0x18')](_0x5ec1a1)['send'](_0x55665d);};}exports[_0x57c5('0x25')]=function(_0x12c3d2,_0x5cbbe9){var _0x57e998={},_0x3d121a={},_0x410172={'count':0x0,'rows':[]};var _0x5224a3=_[_0x57c5('0x26')](db[_0x57c5('0x27')]['rawAttributes'],function(_0x5f5d60){return{'name':_0x5f5d60[_0x57c5('0x28')],'type':_0x5f5d60[_0x57c5('0x29')][_0x57c5('0x2a')]};});_0x3d121a[_0x57c5('0x2b')]=_['map'](_0x5224a3,_0x57c5('0x24'));_0x3d121a[_0x57c5('0x2c')]=_[_0x57c5('0x2d')](_0x12c3d2[_0x57c5('0x2c')]);_0x3d121a[_0x57c5('0x2e')]=_[_0x57c5('0x2f')](_0x3d121a[_0x57c5('0x2b')],_0x3d121a[_0x57c5('0x2c')]);_0x57e998[_0x57c5('0x30')]=_[_0x57c5('0x2f')](_0x3d121a['model'],qs[_0x57c5('0x31')](_0x12c3d2[_0x57c5('0x2c')]['fields']));_0x57e998['attributes']=_0x57e998[_0x57c5('0x30')][_0x57c5('0x32')]?_0x57e998[_0x57c5('0x30')]:_0x3d121a[_0x57c5('0x2b')];if(!_0x12c3d2[_0x57c5('0x2c')]['hasOwnProperty'](_0x57c5('0x33'))){_0x57e998[_0x57c5('0x1c')]=qs[_0x57c5('0x1c')](_0x12c3d2[_0x57c5('0x2c')]['limit']);_0x57e998[_0x57c5('0x1b')]=qs[_0x57c5('0x1b')](_0x12c3d2[_0x57c5('0x2c')][_0x57c5('0x1b')]);}_0x57e998[_0x57c5('0x34')]=qs['sort'](_0x12c3d2[_0x57c5('0x2c')]['sort']);_0x57e998[_0x57c5('0x35')]=qs[_0x57c5('0x2e')](_['pick'](_0x12c3d2['query'],_0x3d121a['filters']),_0x5224a3);if(_0x12c3d2[_0x57c5('0x2c')][_0x57c5('0x36')]){_0x57e998[_0x57c5('0x35')]=_[_0x57c5('0x37')](_0x57e998[_0x57c5('0x35')],{'$or':_[_0x57c5('0x26')](_0x5224a3,function(_0x4f4533){if(_0x4f4533[_0x57c5('0x29')]!=='VIRTUAL'){var _0x363257={};_0x363257[_0x4f4533[_0x57c5('0x24')]]={'$like':'%'+_0x12c3d2[_0x57c5('0x2c')][_0x57c5('0x36')]+'%'};return _0x363257;}})});}_0x57e998=_[_0x57c5('0x37')]({},_0x57e998,_0x12c3d2['options']);var _0x2b384e={'where':_0x57e998[_0x57c5('0x35')]};return db[_0x57c5('0x27')][_0x57c5('0x1a')](_0x2b384e)[_0x57c5('0x38')](function(_0x224339){_0x410172[_0x57c5('0x1a')]=_0x224339;if(_0x12c3d2['query'][_0x57c5('0x39')]){_0x57e998[_0x57c5('0x3a')]=[{'all':!![]}];}return db[_0x57c5('0x27')][_0x57c5('0x3b')](_0x57e998);})['then'](function(_0x2c6f4b){_0x410172[_0x57c5('0x3c')]=_0x2c6f4b;return _0x410172;})[_0x57c5('0x38')](respondWithFilteredResult(_0x5cbbe9,_0x57e998))[_0x57c5('0x3d')](handleError(_0x5cbbe9,null));};exports[_0x57c5('0x3e')]=function(_0x52d416,_0x2634cf){var _0x2fbff0={'raw':![],'where':{'id':_0x52d416[_0x57c5('0x3f')]['id']}},_0x24ae67={};_0x24ae67[_0x57c5('0x2b')]=_[_0x57c5('0x2d')](db['AnalyticFieldReport'][_0x57c5('0x40')]);_0x24ae67[_0x57c5('0x2c')]=_[_0x57c5('0x2d')](_0x52d416[_0x57c5('0x2c')]);_0x24ae67['filters']=_[_0x57c5('0x2f')](_0x24ae67[_0x57c5('0x2b')],_0x24ae67[_0x57c5('0x2c')]);_0x2fbff0[_0x57c5('0x30')]=_['intersection'](_0x24ae67[_0x57c5('0x2b')],qs[_0x57c5('0x31')](_0x52d416[_0x57c5('0x2c')][_0x57c5('0x31')]));_0x2fbff0[_0x57c5('0x30')]=_0x2fbff0[_0x57c5('0x30')][_0x57c5('0x32')]?_0x2fbff0[_0x57c5('0x30')]:_0x24ae67['model'];if(_0x52d416[_0x57c5('0x2c')][_0x57c5('0x39')]){_0x2fbff0[_0x57c5('0x3a')]=[{'all':!![]}];}_0x2fbff0=_[_0x57c5('0x37')]({},_0x2fbff0,_0x52d416[_0x57c5('0x41')]);return db['AnalyticFieldReport'][_0x57c5('0x42')](_0x2fbff0)['then'](handleEntityNotFound(_0x2634cf,null))[_0x57c5('0x38')](respondWithResult(_0x2634cf,null))[_0x57c5('0x3d')](handleError(_0x2634cf,null));};exports['create']=function(_0x5a618d,_0x4271bd){return db[_0x57c5('0x27')][_0x57c5('0x43')](_0x5a618d[_0x57c5('0x44')],{})[_0x57c5('0x38')](respondWithResult(_0x4271bd,0xc9))[_0x57c5('0x3d')](handleError(_0x4271bd,null));};exports[_0x57c5('0x45')]=function(_0x37bdb7,_0x846476){return db[_0x57c5('0x27')][_0x57c5('0x45')](_0x37bdb7['body'],{'raw':![],'individualHooks':!![]})[_0x57c5('0x38')](respondWithResult(_0x846476,0xc9))['catch'](handleError(_0x846476,null));};exports[_0x57c5('0x20')]=function(_0x23f24c,_0x3b1540){if(_0x23f24c[_0x57c5('0x44')]['id']){delete _0x23f24c[_0x57c5('0x44')]['id'];}return db[_0x57c5('0x27')][_0x57c5('0x42')]({'where':{'id':_0x23f24c[_0x57c5('0x3f')]['id']}})[_0x57c5('0x38')](handleEntityNotFound(_0x3b1540,null))[_0x57c5('0x38')](saveUpdates(_0x23f24c[_0x57c5('0x44')],null))[_0x57c5('0x38')](respondWithResult(_0x3b1540,null))[_0x57c5('0x3d')](handleError(_0x3b1540,null));};exports['destroy']=function(_0x311b46,_0xf3bb6e){return db['AnalyticFieldReport'][_0x57c5('0x42')]({'where':{'id':_0x311b46[_0x57c5('0x3f')]['id']}})['then'](handleEntityNotFound(_0xf3bb6e,null))['then'](removeEntity(_0xf3bb6e,null))['catch'](handleError(_0xf3bb6e,null));};exports['bulkDestroy']=function(_0x50d665,_0x51aa96){return db[_0x57c5('0x27')][_0x57c5('0x21')]({'where':{'id':_0x50d665['query'][_0x57c5('0x46')]||[]},'raw':![],'individualHooks':!![]})[_0x57c5('0x38')](respondWithResult(_0x51aa96,0xcc))[_0x57c5('0x3d')](handleError(_0x51aa96,null));};exports[_0x57c5('0x47')]=function(_0x14f7f0,_0x1e6137,_0x41ada8){return db[_0x57c5('0x48')]['findOne']({'where':{'id':_0x14f7f0[_0x57c5('0x3f')]['id']}})[_0x57c5('0x38')](handleEntityNotFound(_0x1e6137,null))[_0x57c5('0x38')](function(_0x221534){if(_0x221534){return db['sequelize']['transaction'](function(_0x5861d){return db['AnalyticFieldReport'][_0x57c5('0x21')]({'where':{'CustomReportId':_0x14f7f0[_0x57c5('0x3f')]['id']},'transaction':_0x5861d})[_0x57c5('0x38')](function(_0x478c38){var _0x4b8b2f=_[_0x57c5('0x26')](_0x14f7f0[_0x57c5('0x44')],function(_0x456618){delete _0x456618['id'];_0x456618['CustomReportId']=_0x14f7f0['params']['id'];return _0x456618;});return db[_0x57c5('0x27')][_0x57c5('0x45')](_0x4b8b2f,{'transaction':_0x5861d});});})['then'](function(){return db['AnalyticFieldReport'][_0x57c5('0x3b')]({'where':{'CustomReportId':_0x14f7f0['params']['id']}});});}})['then'](respondWithResult(_0x1e6137,null))[_0x57c5('0x3d')](handleError(_0x1e6137,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index c00593a..d1e9432 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 _0x462c=['AnalyticFieldReport','lodash','util','../../config/logger','api','bluebird','rimraf','./analyticFieldReport.attributes','define'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x462c,0x6d));var _0xc462=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x462c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc462('0x0'));var util=require(_0xc462('0x1'));var logger=require(_0xc462('0x2'))(_0xc462('0x3'));var moment=require('moment');var BPromise=require(_0xc462('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc462('0x5'));var config=require('../../config/environment');var attributes=require(_0xc462('0x6'));module['exports']=function(_0x43d491,_0x3772cc){return _0x43d491[_0xc462('0x7')](_0xc462('0x8'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1971=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields','util'];(function(_0x196944,_0x338458){var _0x30d0d1=function(_0x3dbe3f){while(--_0x3dbe3f){_0x196944['push'](_0x196944['shift']());}};_0x30d0d1(++_0x338458);}(_0x1971,0x110));var _0x1197=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x1971[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require('lodash');var util=require(_0x1197('0x0'));var logger=require(_0x1197('0x1'))(_0x1197('0x2'));var moment=require(_0x1197('0x3'));var BPromise=require(_0x1197('0x4'));var rp=require(_0x1197('0x5'));var fs=require('fs');var path=require(_0x1197('0x6'));var rimraf=require(_0x1197('0x7'));var config=require(_0x1197('0x8'));var attributes=require(_0x1197('0x9'));module['exports']=function(_0x52eefe,_0x3b2340){return _0x52eefe[_0x1197('0xa')](_0x1197('0xb'),attributes,{'tableName':_0x1197('0xc'),'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 5a18124..90cc4f5 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 _0x6ec1=['request','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x4e7195,_0x46e342){var _0x865f9a=function(_0xcdc5e5){while(--_0xcdc5e5){_0x4e7195['push'](_0x4e7195['shift']());}};_0x865f9a(++_0x46e342);}(_0x6ec1,0xf2));var _0x16ec=function(_0x4140ba,_0x265f95){_0x4140ba=_0x4140ba-0x0;var _0x1840bd=_0x6ec1[_0x4140ba];return _0x1840bd;};'use strict';var _=require(_0x16ec('0x0'));var util=require('util');var moment=require(_0x16ec('0x1'));var BPromise=require(_0x16ec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x16ec('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x16ec('0x4'));var logger=require(_0x16ec('0x5'))(_0x16ec('0x6'));var config=require(_0x16ec('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x16ec('0x8')][_0x16ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x322892,_0x1e6686,_0xc9dd2e){return new BPromise(function(_0x3fd430,_0x4b9d0f){return client[_0x16ec('0xa')](_0x322892,_0xc9dd2e)['then'](function(_0x37bc06){logger[_0x16ec('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1e6686,_0x16ec('0xc'));logger[_0x16ec('0xd')](_0x16ec('0xe'),_0x1e6686,_0x16ec('0xc'),JSON[_0x16ec('0xf')](_0x37bc06));if(_0x37bc06[_0x16ec('0x10')]){if(_0x37bc06[_0x16ec('0x10')][_0x16ec('0x11')]===0x1f4){logger['error'](_0x16ec('0x12'),_0x1e6686,_0x37bc06[_0x16ec('0x10')][_0x16ec('0x13')]);return _0x4b9d0f(_0x37bc06[_0x16ec('0x10')][_0x16ec('0x13')]);}logger['error'](_0x16ec('0x12'),_0x1e6686,_0x37bc06[_0x16ec('0x10')][_0x16ec('0x13')]);return _0x3fd430(_0x37bc06[_0x16ec('0x10')][_0x16ec('0x13')]);}else{logger['info'](_0x16ec('0x12'),_0x1e6686,_0x16ec('0xc'));_0x3fd430(_0x37bc06['result'][_0x16ec('0x13')]);}})[_0x16ec('0x14')](function(_0x3a34ff){logger[_0x16ec('0x10')](_0x16ec('0x12'),_0x1e6686,_0x3a34ff);_0x4b9d0f(_0x3a34ff);});});} \ No newline at end of file +var _0x2745=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','util','moment','bluebird'];(function(_0x3ea898,_0x54ff1e){var _0x31cf52=function(_0xfb856d){while(--_0xfb856d){_0x3ea898['push'](_0x3ea898['shift']());}};_0x31cf52(++_0x54ff1e);}(_0x2745,0xef));var _0x5274=function(_0xa5053c,_0x467be3){_0xa5053c=_0xa5053c-0x0;var _0x567fd3=_0x2745[_0xa5053c];return _0x567fd3;};'use strict';var _=require('lodash');var util=require(_0x5274('0x0'));var moment=require(_0x5274('0x1'));var BPromise=require(_0x5274('0x2'));var rs=require(_0x5274('0x3'));var fs=require('fs');var Redis=require(_0x5274('0x4'));var db=require(_0x5274('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5274('0x6'))(_0x5274('0x7'));var config=require(_0x5274('0x8'));var jayson=require(_0x5274('0x9'));var client=jayson[_0x5274('0xa')][_0x5274('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e9b9f,_0x462aba,_0x267b97){return new BPromise(function(_0x2383d7,_0x6014bd){return client[_0x5274('0xc')](_0x4e9b9f,_0x267b97)[_0x5274('0xd')](function(_0x5c3fcf){logger['info'](_0x5274('0xe'),_0x462aba,_0x5274('0xf'));logger[_0x5274('0x10')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x462aba,_0x5274('0xf'),JSON[_0x5274('0x11')](_0x5c3fcf));if(_0x5c3fcf[_0x5274('0x12')]){if(_0x5c3fcf['error']['code']===0x1f4){logger[_0x5274('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x462aba,_0x5c3fcf['error'][_0x5274('0x13')]);return _0x6014bd(_0x5c3fcf[_0x5274('0x12')][_0x5274('0x13')]);}logger[_0x5274('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x462aba,_0x5c3fcf[_0x5274('0x12')][_0x5274('0x13')]);return _0x2383d7(_0x5c3fcf['error']['message']);}else{logger[_0x5274('0x14')](_0x5274('0xe'),_0x462aba,_0x5274('0xf'));_0x2383d7(_0x5c3fcf['result'][_0x5274('0x13')]);}})[_0x5274('0x15')](function(_0x47b0f2){logger[_0x5274('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x462aba,_0x47b0f2);_0x6014bd(_0x47b0f2);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 9634404..b613433 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 _0x5fc3=['get','isAuthenticated','/:id','show','post','create','/create_many','/:id/create_many','addFields','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticFieldReport.controller'];(function(_0x21f729,_0x20de13){var _0x41c0ab=function(_0x4c8560){while(--_0x4c8560){_0x21f729['push'](_0x21f729['shift']());}};_0x41c0ab(++_0x20de13);}(_0x5fc3,0xa8));var _0x35fc=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x5fc3[_0x18cd5b];return _0x5eaa52;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var auth=require(_0x35fc('0x5'));var interaction=require(_0x35fc('0x6'));var config=require('../../config/environment');var controller=require(_0x35fc('0x7'));router[_0x35fc('0x8')]('/',auth[_0x35fc('0x9')](),controller['index']);router['get'](_0x35fc('0xa'),auth['isAuthenticated'](),controller[_0x35fc('0xb')]);router[_0x35fc('0xc')]('/',auth[_0x35fc('0x9')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xc')](_0x35fc('0xe'),auth[_0x35fc('0x9')](),controller['bulkCreate']);router[_0x35fc('0xc')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x10')]);router[_0x35fc('0x11')]('/:id',auth[_0x35fc('0x9')](),controller[_0x35fc('0x12')]);router['delete']('/destroy_many',auth[_0x35fc('0x9')](),controller['bulkDestroy']);router[_0x35fc('0x13')](_0x35fc('0xa'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x14')]);module[_0x35fc('0x15')]=router; \ No newline at end of file +var _0x5fc3=['get','isAuthenticated','/:id','show','post','create','/create_many','/:id/create_many','addFields','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticFieldReport.controller'];(function(_0x340740,_0x2a07b3){var _0x4da9c2=function(_0x235821){while(--_0x235821){_0x340740['push'](_0x340740['shift']());}};_0x4da9c2(++_0x2a07b3);}(_0x5fc3,0xa8));var _0x35fc=function(_0x43fdf8,_0x8426b3){_0x43fdf8=_0x43fdf8-0x0;var _0x1160c6=_0x5fc3[_0x43fdf8];return _0x1160c6;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var auth=require(_0x35fc('0x5'));var interaction=require(_0x35fc('0x6'));var config=require('../../config/environment');var controller=require(_0x35fc('0x7'));router[_0x35fc('0x8')]('/',auth[_0x35fc('0x9')](),controller['index']);router['get'](_0x35fc('0xa'),auth['isAuthenticated'](),controller[_0x35fc('0xb')]);router[_0x35fc('0xc')]('/',auth[_0x35fc('0x9')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xc')](_0x35fc('0xe'),auth[_0x35fc('0x9')](),controller['bulkCreate']);router[_0x35fc('0xc')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x10')]);router[_0x35fc('0x11')]('/:id',auth[_0x35fc('0x9')](),controller[_0x35fc('0x12')]);router['delete']('/destroy_many',auth[_0x35fc('0x9')](),controller['bulkDestroy']);router[_0x35fc('0x13')](_0x35fc('0xa'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x14')]);module[_0x35fc('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 473b177..5f4c69e 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 _0xcb10=['sequelize','exports','name','STRING'];(function(_0x5d8c3a,_0x52c448){var _0x5fbe1b=function(_0x5a07b4){while(--_0x5a07b4){_0x5d8c3a['push'](_0x5d8c3a['shift']());}};_0x5fbe1b(++_0x52c448);}(_0xcb10,0x104));var _0x0cb1=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xcb10[_0x40220a];return _0x3903cc;};'use strict';var Sequelize=require(_0x0cb1('0x0'));module[_0x0cb1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0cb1('0x2')},'table':{'type':Sequelize[_0x0cb1('0x3')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x0cb1('0x3')]}}; \ No newline at end of file +var _0xc234=['TEXT','exports','STRING'];(function(_0x277fa3,_0x3b2dde){var _0x2e4520=function(_0x209eab){while(--_0x209eab){_0x277fa3['push'](_0x277fa3['shift']());}};_0x2e4520(++_0x3b2dde);}(_0xc234,0x7f));var _0x4c23=function(_0x1d3038,_0x1a6ea3){_0x1d3038=_0x1d3038-0x0;var _0x5e5ac0=_0xc234[_0x1d3038];return _0x5e5ac0;};'use strict';var Sequelize=require('sequelize');module[_0x4c23('0x0')]={'name':{'type':Sequelize[_0x4c23('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x4c23('0x1')]},'metric':{'type':Sequelize[_0x4c23('0x2')]},'description':{'type':Sequelize[_0x4c23('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 8ebea19..966e3a7 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 _0x5a13=['catch','params','rawAttributes','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','get','Metrics','UserProfileResource','error','stack','name','send','index','map','AnalyticMetric','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','include'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x5a13,0x145));var _0x35a1=function(_0x497449,_0x59e358){_0x497449=_0x497449-0x0;var _0x425794=_0x5a13[_0x497449];return _0x425794;};'use strict';var pdf=require(_0x35a1('0x0'));var emlformat=require(_0x35a1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x35a1('0x2'));var jsonpatch=require(_0x35a1('0x3'));var rp=require(_0x35a1('0x4'));var moment=require(_0x35a1('0x5'));var BPromise=require(_0x35a1('0x6'));var Mustache=require(_0x35a1('0x7'));var util=require(_0x35a1('0x8'));var path=require(_0x35a1('0x9'));var sox=require(_0x35a1('0xa'));var csv=require(_0x35a1('0xb'));var ejs=require(_0x35a1('0xc'));var fs=require('fs');var _=require(_0x35a1('0xd'));var squel=require(_0x35a1('0xe'));var crypto=require(_0x35a1('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x35a1('0x10'));var Papa=require(_0x35a1('0x11'));var Redis=require('ioredis');var authService=require(_0x35a1('0x12'));var qs=require(_0x35a1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x35a1('0x14'))(_0x35a1('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x35a1('0x16'))['db'];function respondWithStatusCode(_0x4df4be,_0x386db9){_0x386db9=_0x386db9||0xcc;return function(_0x572c66){if(_0x572c66){return _0x4df4be[_0x35a1('0x17')](_0x386db9);}return _0x4df4be[_0x35a1('0x18')](_0x386db9)[_0x35a1('0x19')]();};}function respondWithResult(_0x28a180,_0x1f57bf){_0x1f57bf=_0x1f57bf||0xc8;return function(_0xa149d0){if(_0xa149d0){return _0x28a180[_0x35a1('0x18')](_0x1f57bf)[_0x35a1('0x1a')](_0xa149d0);}};}function respondWithFilteredResult(_0x1a2627,_0xff0405){return function(_0x366df0){if(_0x366df0){var _0x41939f=_0x366df0[_0x35a1('0x1b')],_0x2f93be=_0xff0405[_0x35a1('0x1c')],_0x44c755=_0xff0405[_0x35a1('0x1c')]+_0xff0405[_0x35a1('0x1d')],_0x45f49a;if(_0x44c755>=_0x41939f){_0x44c755=_0x41939f;_0x45f49a=0xc8;}else{_0x45f49a=0xce;}_0x1a2627[_0x35a1('0x18')](_0x45f49a);return _0x1a2627['set'](_0x35a1('0x1e'),_0x2f93be+'-'+_0x44c755+'/'+_0x41939f)[_0x35a1('0x1a')](_0x366df0);}return null;};}function patchUpdates(_0x28bc31){return function(_0x13ba22){try{jsonpatch[_0x35a1('0x1f')](_0x13ba22,_0x28bc31,!![]);}catch(_0x4255ac){return BPromise[_0x35a1('0x20')](_0x4255ac);}return _0x13ba22[_0x35a1('0x21')]();};}function saveUpdates(_0x4179a2,_0x5929e5){return function(_0x473186){if(_0x473186){return _0x473186[_0x35a1('0x22')](_0x4179a2)['then'](function(_0xfce076){return _0xfce076;});}return null;};}function removeEntity(_0x174ca0,_0x5433d7){return function(_0xc13bad){if(_0xc13bad){return _0xc13bad['destroy']()[_0x35a1('0x23')](function(){var _0x1bca05=_0xc13bad[_0x35a1('0x24')]({'plain':!![]});var _0x5e42cf=_0x35a1('0x25');return db[_0x35a1('0x26')]['destroy']({'where':{'type':_0x5e42cf,'resourceId':_0x1bca05['id']}})['then'](function(){return _0xc13bad;});})['then'](function(){_0x174ca0[_0x35a1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5408a7,_0x52d22b){return function(_0x2ee03c){if(!_0x2ee03c){_0x5408a7[_0x35a1('0x17')](0x194);}return _0x2ee03c;};}function handleError(_0x39248b,_0x3f1563){_0x3f1563=_0x3f1563||0x1f4;return function(_0x536394){logger[_0x35a1('0x27')](_0x536394[_0x35a1('0x28')]);if(_0x536394[_0x35a1('0x29')]){delete _0x536394[_0x35a1('0x29')];}_0x39248b[_0x35a1('0x18')](_0x3f1563)[_0x35a1('0x2a')](_0x536394);};}exports[_0x35a1('0x2b')]=function(_0x24bb2d,_0x243841){var _0x381bcc={},_0x83a000={},_0x384a8e={'count':0x0,'rows':[]};var _0xacadf2=_[_0x35a1('0x2c')](db[_0x35a1('0x2d')]['rawAttributes'],function(_0x9720a4){return{'name':_0x9720a4[_0x35a1('0x2e')],'type':_0x9720a4[_0x35a1('0x2f')][_0x35a1('0x30')]};});_0x83a000[_0x35a1('0x31')]=_[_0x35a1('0x2c')](_0xacadf2,_0x35a1('0x29'));_0x83a000[_0x35a1('0x32')]=_[_0x35a1('0x33')](_0x24bb2d[_0x35a1('0x32')]);_0x83a000[_0x35a1('0x34')]=_['intersection'](_0x83a000['model'],_0x83a000[_0x35a1('0x32')]);_0x381bcc['attributes']=_[_0x35a1('0x35')](_0x83a000['model'],qs[_0x35a1('0x36')](_0x24bb2d[_0x35a1('0x32')][_0x35a1('0x36')]));_0x381bcc[_0x35a1('0x37')]=_0x381bcc[_0x35a1('0x37')][_0x35a1('0x38')]?_0x381bcc[_0x35a1('0x37')]:_0x83a000[_0x35a1('0x31')];if(!_0x24bb2d[_0x35a1('0x32')][_0x35a1('0x39')](_0x35a1('0x3a'))){_0x381bcc['limit']=qs[_0x35a1('0x1d')](_0x24bb2d[_0x35a1('0x32')][_0x35a1('0x1d')]);_0x381bcc['offset']=qs['offset'](_0x24bb2d['query']['offset']);}_0x381bcc['order']=qs['sort'](_0x24bb2d[_0x35a1('0x32')][_0x35a1('0x3b')]);_0x381bcc[_0x35a1('0x3c')]=qs[_0x35a1('0x34')](_[_0x35a1('0x3d')](_0x24bb2d[_0x35a1('0x32')],_0x83a000[_0x35a1('0x34')]),_0xacadf2);if(_0x24bb2d[_0x35a1('0x32')]['filter']){_0x381bcc[_0x35a1('0x3c')]=_['merge'](_0x381bcc[_0x35a1('0x3c')],{'$or':_[_0x35a1('0x2c')](_0xacadf2,function(_0x3f367a){if(_0x3f367a[_0x35a1('0x2f')]!==_0x35a1('0x3e')){var _0x53d505={};_0x53d505[_0x3f367a[_0x35a1('0x29')]]={'$like':'%'+_0x24bb2d[_0x35a1('0x32')][_0x35a1('0x3f')]+'%'};return _0x53d505;}})});}_0x381bcc=_['merge']({},_0x381bcc,_0x24bb2d['options']);var _0x241d44={'where':_0x381bcc[_0x35a1('0x3c')]};return db[_0x35a1('0x2d')][_0x35a1('0x1b')](_0x241d44)['then'](function(_0x49ca91){_0x384a8e['count']=_0x49ca91;if(_0x24bb2d[_0x35a1('0x32')]['includeAll']){_0x381bcc[_0x35a1('0x40')]=[{'all':!![]}];}return db[_0x35a1('0x2d')]['findAll'](_0x381bcc);})['then'](function(_0x221136){_0x384a8e['rows']=_0x221136;return _0x384a8e;})[_0x35a1('0x23')](respondWithFilteredResult(_0x243841,_0x381bcc))[_0x35a1('0x41')](handleError(_0x243841,null));};exports['show']=function(_0x3522c3,_0x502695){var _0xb1c14c={'raw':!![],'where':{'id':_0x3522c3[_0x35a1('0x42')]['id']}},_0x4c4c21={};_0x4c4c21['model']=_[_0x35a1('0x33')](db['AnalyticMetric'][_0x35a1('0x43')]);_0x4c4c21['query']=_[_0x35a1('0x33')](_0x3522c3[_0x35a1('0x32')]);_0x4c4c21[_0x35a1('0x34')]=_[_0x35a1('0x35')](_0x4c4c21[_0x35a1('0x31')],_0x4c4c21[_0x35a1('0x32')]);_0xb1c14c[_0x35a1('0x37')]=_['intersection'](_0x4c4c21[_0x35a1('0x31')],qs[_0x35a1('0x36')](_0x3522c3[_0x35a1('0x32')][_0x35a1('0x36')]));_0xb1c14c[_0x35a1('0x37')]=_0xb1c14c[_0x35a1('0x37')]['length']?_0xb1c14c[_0x35a1('0x37')]:_0x4c4c21[_0x35a1('0x31')];if(_0x3522c3[_0x35a1('0x32')][_0x35a1('0x44')]){_0xb1c14c[_0x35a1('0x40')]=[{'all':!![]}];}_0xb1c14c=_['merge']({},_0xb1c14c,_0x3522c3[_0x35a1('0x45')]);return db[_0x35a1('0x2d')][_0x35a1('0x46')](_0xb1c14c)[_0x35a1('0x23')](handleEntityNotFound(_0x502695,null))['then'](respondWithResult(_0x502695,null))[_0x35a1('0x41')](handleError(_0x502695,null));};exports[_0x35a1('0x47')]=function(_0x1c1e24,_0x1c4cae){return db[_0x35a1('0x2d')][_0x35a1('0x47')](_0x1c1e24[_0x35a1('0x48')],{})['then'](function(_0x5571b6){var _0x16092f=_0x1c1e24[_0x35a1('0x49')][_0x35a1('0x24')]({'plain':!![]});if(!_0x16092f)throw new Error(_0x35a1('0x4a'));if(_0x16092f['role']==='user'){var _0x18e1dd=_0x5571b6[_0x35a1('0x24')]({'plain':!![]});var _0x19123f=_0x35a1('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x19123f,'userProfileId':_0x16092f['userProfileId']},'raw':!![]})[_0x35a1('0x23')](function(_0x5d7f55){if(_0x5d7f55&&_0x5d7f55[_0x35a1('0x4b')]===0x0){return db[_0x35a1('0x26')][_0x35a1('0x47')]({'name':_0x18e1dd[_0x35a1('0x29')],'resourceId':_0x18e1dd['id'],'type':_0x5d7f55[_0x35a1('0x29')],'sectionId':_0x5d7f55['id']},{})[_0x35a1('0x23')](function(){return _0x5571b6;});}else{return _0x5571b6;}})[_0x35a1('0x41')](function(_0x1fed77){logger['error'](_0x35a1('0x4c'),_0x1fed77);throw _0x1fed77;});}return _0x5571b6;})[_0x35a1('0x23')](respondWithResult(_0x1c4cae,0xc9))[_0x35a1('0x41')](handleError(_0x1c4cae,null));};exports['update']=function(_0x4e4a2c,_0x5c9761){if(_0x4e4a2c['body']['id']){delete _0x4e4a2c[_0x35a1('0x48')]['id'];}return db[_0x35a1('0x2d')][_0x35a1('0x46')]({'where':{'id':_0x4e4a2c[_0x35a1('0x42')]['id']}})[_0x35a1('0x23')](handleEntityNotFound(_0x5c9761,null))[_0x35a1('0x23')](saveUpdates(_0x4e4a2c[_0x35a1('0x48')],null))[_0x35a1('0x23')](respondWithResult(_0x5c9761,null))[_0x35a1('0x41')](handleError(_0x5c9761,null));};exports[_0x35a1('0x4d')]=function(_0x481075,_0x3ca42a){return db[_0x35a1('0x2d')][_0x35a1('0x46')]({'where':{'id':_0x481075['params']['id']}})['then'](handleEntityNotFound(_0x3ca42a,null))[_0x35a1('0x23')](removeEntity(_0x3ca42a,null))['catch'](handleError(_0x3ca42a,null));}; \ No newline at end of file +var _0xcf66=['index','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','AnalyticMetric','includeAll','include','findAll','rows','catch','params','keys','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','Metrics','error','stack','name'];(function(_0x4de5c1,_0x5ccdc2){var _0x106360=function(_0x2b0105){while(--_0x2b0105){_0x4de5c1['push'](_0x4de5c1['shift']());}};_0x106360(++_0x5ccdc2);}(_0xcf66,0x71));var _0x6cf6=function(_0x126f36,_0x5d4afd){_0x126f36=_0x126f36-0x0;var _0x31ecc1=_0xcf66[_0x126f36];return _0x31ecc1;};'use strict';var pdf=require(_0x6cf6('0x0'));var emlformat=require(_0x6cf6('0x1'));var rimraf=require(_0x6cf6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6cf6('0x3'));var rp=require(_0x6cf6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6cf6('0x5'));var util=require(_0x6cf6('0x6'));var path=require('path');var sox=require(_0x6cf6('0x7'));var csv=require(_0x6cf6('0x8'));var ejs=require(_0x6cf6('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6cf6('0xa'));var crypto=require(_0x6cf6('0xb'));var jsforce=require(_0x6cf6('0xc'));var deskjs=require(_0x6cf6('0xd'));var toCsv=require(_0x6cf6('0x8'));var querystring=require(_0x6cf6('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6cf6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6cf6('0x10'));var logger=require(_0x6cf6('0x11'))(_0x6cf6('0x12'));var utils=require(_0x6cf6('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5801a9,_0x3fdfea){_0x3fdfea=_0x3fdfea||0xcc;return function(_0x13b1ad){if(_0x13b1ad){return _0x5801a9[_0x6cf6('0x14')](_0x3fdfea);}return _0x5801a9[_0x6cf6('0x15')](_0x3fdfea)[_0x6cf6('0x16')]();};}function respondWithResult(_0x114c2c,_0x57909f){_0x57909f=_0x57909f||0xc8;return function(_0x32fe64){if(_0x32fe64){return _0x114c2c['status'](_0x57909f)[_0x6cf6('0x17')](_0x32fe64);}};}function respondWithFilteredResult(_0x18360e,_0x4b073f){return function(_0x40e413){if(_0x40e413){var _0x1b40f8=_0x40e413[_0x6cf6('0x18')],_0x2d23ab=_0x4b073f[_0x6cf6('0x19')],_0x74486a=_0x4b073f[_0x6cf6('0x19')]+_0x4b073f[_0x6cf6('0x1a')],_0x2b6d7b;if(_0x74486a>=_0x1b40f8){_0x74486a=_0x1b40f8;_0x2b6d7b=0xc8;}else{_0x2b6d7b=0xce;}_0x18360e[_0x6cf6('0x15')](_0x2b6d7b);return _0x18360e['set'](_0x6cf6('0x1b'),_0x2d23ab+'-'+_0x74486a+'/'+_0x1b40f8)[_0x6cf6('0x17')](_0x40e413);}return null;};}function patchUpdates(_0x22ab0){return function(_0x581164){try{jsonpatch[_0x6cf6('0x1c')](_0x581164,_0x22ab0,!![]);}catch(_0x39b4a2){return BPromise[_0x6cf6('0x1d')](_0x39b4a2);}return _0x581164[_0x6cf6('0x1e')]();};}function saveUpdates(_0x440634,_0x21e903){return function(_0x123993){if(_0x123993){return _0x123993['update'](_0x440634)[_0x6cf6('0x1f')](function(_0x306a64){return _0x306a64;});}return null;};}function removeEntity(_0x1add7a,_0x380a40){return function(_0x5cba3a){if(_0x5cba3a){return _0x5cba3a[_0x6cf6('0x20')]()[_0x6cf6('0x1f')](function(){var _0x111274=_0x5cba3a['get']({'plain':!![]});var _0x5b30e0=_0x6cf6('0x21');return db['UserProfileResource'][_0x6cf6('0x20')]({'where':{'type':_0x5b30e0,'resourceId':_0x111274['id']}})[_0x6cf6('0x1f')](function(){return _0x5cba3a;});})[_0x6cf6('0x1f')](function(){_0x1add7a[_0x6cf6('0x15')](0xcc)[_0x6cf6('0x16')]();});}};}function handleEntityNotFound(_0x565fad,_0x1c966e){return function(_0x4e0e85){if(!_0x4e0e85){_0x565fad[_0x6cf6('0x14')](0x194);}return _0x4e0e85;};}function handleError(_0xc7b489,_0x3eaa31){_0x3eaa31=_0x3eaa31||0x1f4;return function(_0x558405){logger[_0x6cf6('0x22')](_0x558405[_0x6cf6('0x23')]);if(_0x558405[_0x6cf6('0x24')]){delete _0x558405[_0x6cf6('0x24')];}_0xc7b489['status'](_0x3eaa31)['send'](_0x558405);};}exports[_0x6cf6('0x25')]=function(_0x4521af,_0x57099f){var _0x5869e9={},_0x5ccc8f={},_0x2afc06={'count':0x0,'rows':[]};var _0x52717d=_['map'](db['AnalyticMetric'][_0x6cf6('0x26')],function(_0x65433){return{'name':_0x65433[_0x6cf6('0x27')],'type':_0x65433[_0x6cf6('0x28')][_0x6cf6('0x29')]};});_0x5ccc8f['model']=_[_0x6cf6('0x2a')](_0x52717d,_0x6cf6('0x24'));_0x5ccc8f[_0x6cf6('0x2b')]=_['keys'](_0x4521af[_0x6cf6('0x2b')]);_0x5ccc8f[_0x6cf6('0x2c')]=_[_0x6cf6('0x2d')](_0x5ccc8f[_0x6cf6('0x2e')],_0x5ccc8f[_0x6cf6('0x2b')]);_0x5869e9[_0x6cf6('0x2f')]=_[_0x6cf6('0x2d')](_0x5ccc8f[_0x6cf6('0x2e')],qs[_0x6cf6('0x30')](_0x4521af[_0x6cf6('0x2b')][_0x6cf6('0x30')]));_0x5869e9[_0x6cf6('0x2f')]=_0x5869e9[_0x6cf6('0x2f')][_0x6cf6('0x31')]?_0x5869e9[_0x6cf6('0x2f')]:_0x5ccc8f[_0x6cf6('0x2e')];if(!_0x4521af[_0x6cf6('0x2b')][_0x6cf6('0x32')]('nolimit')){_0x5869e9[_0x6cf6('0x1a')]=qs[_0x6cf6('0x1a')](_0x4521af[_0x6cf6('0x2b')][_0x6cf6('0x1a')]);_0x5869e9[_0x6cf6('0x19')]=qs[_0x6cf6('0x19')](_0x4521af[_0x6cf6('0x2b')][_0x6cf6('0x19')]);}_0x5869e9[_0x6cf6('0x33')]=qs[_0x6cf6('0x34')](_0x4521af[_0x6cf6('0x2b')]['sort']);_0x5869e9[_0x6cf6('0x35')]=qs[_0x6cf6('0x2c')](_[_0x6cf6('0x36')](_0x4521af[_0x6cf6('0x2b')],_0x5ccc8f[_0x6cf6('0x2c')]),_0x52717d);if(_0x4521af[_0x6cf6('0x2b')][_0x6cf6('0x37')]){_0x5869e9[_0x6cf6('0x35')]=_[_0x6cf6('0x38')](_0x5869e9['where'],{'$or':_[_0x6cf6('0x2a')](_0x52717d,function(_0x46423f){if(_0x46423f[_0x6cf6('0x28')]!==_0x6cf6('0x39')){var _0x14e0eb={};_0x14e0eb[_0x46423f[_0x6cf6('0x24')]]={'$like':'%'+_0x4521af[_0x6cf6('0x2b')][_0x6cf6('0x37')]+'%'};return _0x14e0eb;}})});}_0x5869e9=_[_0x6cf6('0x38')]({},_0x5869e9,_0x4521af['options']);var _0x23622f={'where':_0x5869e9['where']};return db[_0x6cf6('0x3a')][_0x6cf6('0x18')](_0x23622f)[_0x6cf6('0x1f')](function(_0x1ce0be){_0x2afc06[_0x6cf6('0x18')]=_0x1ce0be;if(_0x4521af[_0x6cf6('0x2b')][_0x6cf6('0x3b')]){_0x5869e9[_0x6cf6('0x3c')]=[{'all':!![]}];}return db['AnalyticMetric'][_0x6cf6('0x3d')](_0x5869e9);})[_0x6cf6('0x1f')](function(_0x52c417){_0x2afc06[_0x6cf6('0x3e')]=_0x52c417;return _0x2afc06;})[_0x6cf6('0x1f')](respondWithFilteredResult(_0x57099f,_0x5869e9))[_0x6cf6('0x3f')](handleError(_0x57099f,null));};exports['show']=function(_0x10bb9b,_0x128f7a){var _0x51d915={'raw':!![],'where':{'id':_0x10bb9b[_0x6cf6('0x40')]['id']}},_0x3f1084={};_0x3f1084[_0x6cf6('0x2e')]=_[_0x6cf6('0x41')](db[_0x6cf6('0x3a')][_0x6cf6('0x26')]);_0x3f1084[_0x6cf6('0x2b')]=_['keys'](_0x10bb9b[_0x6cf6('0x2b')]);_0x3f1084['filters']=_[_0x6cf6('0x2d')](_0x3f1084[_0x6cf6('0x2e')],_0x3f1084['query']);_0x51d915[_0x6cf6('0x2f')]=_[_0x6cf6('0x2d')](_0x3f1084[_0x6cf6('0x2e')],qs[_0x6cf6('0x30')](_0x10bb9b[_0x6cf6('0x2b')]['fields']));_0x51d915[_0x6cf6('0x2f')]=_0x51d915[_0x6cf6('0x2f')][_0x6cf6('0x31')]?_0x51d915['attributes']:_0x3f1084[_0x6cf6('0x2e')];if(_0x10bb9b[_0x6cf6('0x2b')][_0x6cf6('0x3b')]){_0x51d915['include']=[{'all':!![]}];}_0x51d915=_[_0x6cf6('0x38')]({},_0x51d915,_0x10bb9b['options']);return db['AnalyticMetric'][_0x6cf6('0x42')](_0x51d915)[_0x6cf6('0x1f')](handleEntityNotFound(_0x128f7a,null))[_0x6cf6('0x1f')](respondWithResult(_0x128f7a,null))[_0x6cf6('0x3f')](handleError(_0x128f7a,null));};exports[_0x6cf6('0x43')]=function(_0x311745,_0x28629d){return db[_0x6cf6('0x3a')][_0x6cf6('0x43')](_0x311745[_0x6cf6('0x44')],{})[_0x6cf6('0x1f')](function(_0x1ac2cd){var _0x3786d1=_0x311745['user'][_0x6cf6('0x45')]({'plain':!![]});if(!_0x3786d1)throw new Error(_0x6cf6('0x46'));if(_0x3786d1['role']==='user'){var _0x10047a=_0x1ac2cd[_0x6cf6('0x45')]({'plain':!![]});var _0x1db524=_0x6cf6('0x21');return db[_0x6cf6('0x47')][_0x6cf6('0x42')]({'where':{'name':_0x1db524,'userProfileId':_0x3786d1['userProfileId']},'raw':!![]})[_0x6cf6('0x1f')](function(_0x262c23){if(_0x262c23&&_0x262c23[_0x6cf6('0x48')]===0x0){return db['UserProfileResource']['create']({'name':_0x10047a[_0x6cf6('0x24')],'resourceId':_0x10047a['id'],'type':_0x262c23[_0x6cf6('0x24')],'sectionId':_0x262c23['id']},{})[_0x6cf6('0x1f')](function(){return _0x1ac2cd;});}else{return _0x1ac2cd;}})[_0x6cf6('0x3f')](function(_0x2dbd71){logger[_0x6cf6('0x22')](_0x6cf6('0x49'),_0x2dbd71);throw _0x2dbd71;});}return _0x1ac2cd;})[_0x6cf6('0x1f')](respondWithResult(_0x28629d,0xc9))[_0x6cf6('0x3f')](handleError(_0x28629d,null));};exports[_0x6cf6('0x4a')]=function(_0x4bb37e,_0x217072){if(_0x4bb37e[_0x6cf6('0x44')]['id']){delete _0x4bb37e[_0x6cf6('0x44')]['id'];}return db[_0x6cf6('0x3a')][_0x6cf6('0x42')]({'where':{'id':_0x4bb37e[_0x6cf6('0x40')]['id']}})[_0x6cf6('0x1f')](handleEntityNotFound(_0x217072,null))[_0x6cf6('0x1f')](saveUpdates(_0x4bb37e[_0x6cf6('0x44')],null))[_0x6cf6('0x1f')](respondWithResult(_0x217072,null))[_0x6cf6('0x3f')](handleError(_0x217072,null));};exports['destroy']=function(_0x153423,_0x4ec56b){return db[_0x6cf6('0x3a')][_0x6cf6('0x42')]({'where':{'id':_0x153423['params']['id']}})[_0x6cf6('0x1f')](handleEntityNotFound(_0x4ec56b,null))[_0x6cf6('0x1f')](removeEntity(_0x4ec56b,null))[_0x6cf6('0x3f')](handleError(_0x4ec56b,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index ec0c497..51b8f1e 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 _0x3a2c=['analytics_metrics','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticMetric.attributes','AnalyticMetric'];(function(_0x405afe,_0xd77272){var _0x563b39=function(_0x172ffd){while(--_0x172ffd){_0x405afe['push'](_0x405afe['shift']());}};_0x563b39(++_0xd77272);}(_0x3a2c,0x12d));var _0xc3a2=function(_0x2b4333,_0x13828c){_0x2b4333=_0x2b4333-0x0;var _0x383acb=_0x3a2c[_0x2b4333];return _0x383acb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc3a2('0x0'))(_0xc3a2('0x1'));var moment=require(_0xc3a2('0x2'));var BPromise=require(_0xc3a2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc3a2('0x4'));var rimraf=require(_0xc3a2('0x5'));var config=require(_0xc3a2('0x6'));var attributes=require(_0xc3a2('0x7'));module['exports']=function(_0x38210e,_0x1613c2){return _0x38210e['define'](_0xc3a2('0x8'),attributes,{'tableName':_0xc3a2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b6b=['./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x4ea2e2,_0x3ceddd){var _0x40599d=function(_0x2cbff0){while(--_0x2cbff0){_0x4ea2e2['push'](_0x4ea2e2['shift']());}};_0x40599d(++_0x3ceddd);}(_0x4b6b,0x122));var _0xb4b6=function(_0x5a67d3,_0x30b33a){_0x5a67d3=_0x5a67d3-0x0;var _0x14fd66=_0x4b6b[_0x5a67d3];return _0x14fd66;};'use strict';var _=require(_0xb4b6('0x0'));var util=require(_0xb4b6('0x1'));var logger=require(_0xb4b6('0x2'))(_0xb4b6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb4b6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb4b6('0x5'));var config=require(_0xb4b6('0x6'));var attributes=require(_0xb4b6('0x7'));module['exports']=function(_0x2fa058,_0x3d6e77){return _0x2fa058[_0xb4b6('0x8')](_0xb4b6('0x9'),attributes,{'tableName':_0xb4b6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 8b25669..4fb8df4 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 _0xae97=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x48245e,_0x178e51){var _0x4e5e30=function(_0x428bfd){while(--_0x428bfd){_0x48245e['push'](_0x48245e['shift']());}};_0x4e5e30(++_0x178e51);}(_0xae97,0x1c7));var _0x7ae9=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xae97[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0x7ae9('0x0'));var util=require(_0x7ae9('0x1'));var moment=require('moment');var BPromise=require(_0x7ae9('0x2'));var rs=require(_0x7ae9('0x3'));var fs=require('fs');var Redis=require(_0x7ae9('0x4'));var db=require(_0x7ae9('0x5'))['db'];var utils=require(_0x7ae9('0x6'));var logger=require(_0x7ae9('0x7'))('rpc');var config=require(_0x7ae9('0x8'));var jayson=require(_0x7ae9('0x9'));var client=jayson[_0x7ae9('0xa')][_0x7ae9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a22e7,_0x4d76d0,_0x18d502){return new BPromise(function(_0x1f90a4,_0xfdcf12){return client[_0x7ae9('0xc')](_0x2a22e7,_0x18d502)['then'](function(_0x316059){logger[_0x7ae9('0xd')](_0x7ae9('0xe'),_0x4d76d0,_0x7ae9('0xf'));logger[_0x7ae9('0x10')](_0x7ae9('0x11'),_0x4d76d0,'request\x20sent',JSON[_0x7ae9('0x12')](_0x316059));if(_0x316059['error']){if(_0x316059[_0x7ae9('0x13')][_0x7ae9('0x14')]===0x1f4){logger[_0x7ae9('0x13')](_0x7ae9('0xe'),_0x4d76d0,_0x316059[_0x7ae9('0x13')]['message']);return _0xfdcf12(_0x316059[_0x7ae9('0x13')][_0x7ae9('0x15')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x4d76d0,_0x316059[_0x7ae9('0x13')]['message']);return _0x1f90a4(_0x316059['error'][_0x7ae9('0x15')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x4d76d0,'request\x20sent');_0x1f90a4(_0x316059[_0x7ae9('0x16')][_0x7ae9('0x15')]);}})[_0x7ae9('0x17')](function(_0x32e26f){logger[_0x7ae9('0x13')](_0x7ae9('0xe'),_0x4d76d0,_0x32e26f);_0xfdcf12(_0x32e26f);});});} \ No newline at end of file +var _0xdcce=['message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','AnalyticMetric,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdcce,0x128));var _0xedcc=function(_0x48634a,_0x36ed6e){_0x48634a=_0x48634a-0x0;var _0x2b4898=_0xdcce[_0x48634a];return _0x2b4898;};'use strict';var _=require(_0xedcc('0x0'));var util=require(_0xedcc('0x1'));var moment=require(_0xedcc('0x2'));var BPromise=require(_0xedcc('0x3'));var rs=require(_0xedcc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedcc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xedcc('0x6'))('rpc');var config=require(_0xedcc('0x7'));var jayson=require(_0xedcc('0x8'));var client=jayson[_0xedcc('0x9')][_0xedcc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21c92f,_0x10b7cc,_0x4a6c75){return new BPromise(function(_0x3c2148,_0xa63a64){return client[_0xedcc('0xb')](_0x21c92f,_0x4a6c75)[_0xedcc('0xc')](function(_0xa8b87a){logger[_0xedcc('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x10b7cc,'request\x20sent');logger['debug'](_0xedcc('0xe'),_0x10b7cc,_0xedcc('0xf'),JSON[_0xedcc('0x10')](_0xa8b87a));if(_0xa8b87a[_0xedcc('0x11')]){if(_0xa8b87a[_0xedcc('0x11')]['code']===0x1f4){logger['error'](_0xedcc('0x12'),_0x10b7cc,_0xa8b87a[_0xedcc('0x11')][_0xedcc('0x13')]);return _0xa63a64(_0xa8b87a[_0xedcc('0x11')][_0xedcc('0x13')]);}logger['error'](_0xedcc('0x12'),_0x10b7cc,_0xa8b87a[_0xedcc('0x11')]['message']);return _0x3c2148(_0xa8b87a[_0xedcc('0x11')][_0xedcc('0x13')]);}else{logger['info'](_0xedcc('0x12'),_0x10b7cc,'request\x20sent');_0x3c2148(_0xa8b87a[_0xedcc('0x14')]['message']);}})['catch'](function(_0x38f1f8){logger[_0xedcc('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x10b7cc,_0x38f1f8);_0xa63a64(_0x38f1f8);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 9c7128d..8ad4416 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 _0xba34=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','../../config/environment','./analyticMetric.controller'];(function(_0x5ea2ff,_0x51175d){var _0x53c9ef=function(_0x3d3b9a){while(--_0x3d3b9a){_0x5ea2ff['push'](_0x5ea2ff['shift']());}};_0x53c9ef(++_0x51175d);}(_0xba34,0x119));var _0x4ba3=function(_0x3e0404,_0x446c60){_0x3e0404=_0x3e0404-0x0;var _0x9daaad=_0xba34[_0x3e0404];return _0x9daaad;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4ba3('0x5'));var controller=require(_0x4ba3('0x6'));router[_0x4ba3('0x7')]('/',auth[_0x4ba3('0x8')](),controller[_0x4ba3('0x9')]);router[_0x4ba3('0x7')](_0x4ba3('0xa'),auth['isAuthenticated'](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0xc')]('/',auth[_0x4ba3('0x8')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')](_0x4ba3('0xa'),auth[_0x4ba3('0x8')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xa'),auth[_0x4ba3('0x8')](),controller['destroy']);module[_0x4ba3('0x11')]=router; \ No newline at end of file +var _0x1967=['get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller'];(function(_0x425372,_0x392a79){var _0x5509eb=function(_0xc63ab0){while(--_0xc63ab0){_0x425372['push'](_0x425372['shift']());}};_0x5509eb(++_0x392a79);}(_0x1967,0x173));var _0x7196=function(_0x71783,_0x138cb1){_0x71783=_0x71783-0x0;var _0xd8100f=_0x1967[_0x71783];return _0xd8100f;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var auth=require(_0x7196('0x5'));var interaction=require(_0x7196('0x6'));var config=require(_0x7196('0x7'));var controller=require(_0x7196('0x8'));router[_0x7196('0x9')]('/',auth['isAuthenticated'](),controller[_0x7196('0xa')]);router[_0x7196('0x9')](_0x7196('0xb'),auth[_0x7196('0xc')](),controller[_0x7196('0xd')]);router[_0x7196('0xe')]('/',auth['isAuthenticated'](),controller[_0x7196('0xf')]);router[_0x7196('0x10')](_0x7196('0xb'),auth[_0x7196('0xc')](),controller[_0x7196('0x11')]);router['delete']('/:id',auth[_0x7196('0xc')](),controller[_0x7196('0x12')]);module[_0x7196('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 658cfbe..b0ed4a3 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 _0xa305=['sequelize','TEXT'];(function(_0x41ec2f,_0xedb083){var _0x2abd9f=function(_0x14ce42){while(--_0x14ce42){_0x41ec2f['push'](_0x41ec2f['shift']());}};_0x2abd9f(++_0xedb083);}(_0xa305,0x172));var _0x5a30=function(_0x2a757a,_0x371d6c){_0x2a757a=_0x2a757a-0x0;var _0x11dbe0=_0xa305[_0x2a757a];return _0x11dbe0;};'use strict';var Sequelize=require(_0x5a30('0x0'));module['exports']={'tree':{'type':Sequelize[_0x5a30('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x0540=['sequelize','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0540,0x1a0));var _0x0054=function(_0x7eea4,_0x31fb2e){_0x7eea4=_0x7eea4-0x0;var _0x378b00=_0x0540[_0x7eea4];return _0x378b00;};'use strict';var Sequelize=require(_0x0054('0x0'));module[_0x0054('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 a03a0dc..912fd76 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 _0x7990=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','count','includeAll','include','findAll','rows','params','fields','find','catch','create','body','update','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x7990,0x191));var _0x0799=function(_0x4d4999,_0x4fec95){_0x4d4999=_0x4d4999-0x0;var _0x3ee105=_0x7990[_0x4d4999];return _0x3ee105;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0799('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0799('0x1'));var moment=require(_0x0799('0x2'));var BPromise=require(_0x0799('0x3'));var Mustache=require('mustache');var util=require(_0x0799('0x4'));var path=require(_0x0799('0x5'));var sox=require(_0x0799('0x6'));var csv=require(_0x0799('0x7'));var ejs=require(_0x0799('0x8'));var fs=require('fs');var _=require(_0x0799('0x9'));var squel=require(_0x0799('0xa'));var crypto=require('crypto');var jsforce=require(_0x0799('0xb'));var deskjs=require(_0x0799('0xc'));var toCsv=require(_0x0799('0x7'));var querystring=require(_0x0799('0xd'));var Papa=require('papaparse');var Redis=require(_0x0799('0xe'));var authService=require(_0x0799('0xf'));var qs=require(_0x0799('0x10'));var as=require(_0x0799('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0799('0x12'))('api');var utils=require(_0x0799('0x13'));var config=require(_0x0799('0x14'));var db=require(_0x0799('0x15'))['db'];function respondWithStatusCode(_0x271e5c,_0x1f8173){_0x1f8173=_0x1f8173||0xcc;return function(_0x460b58){if(_0x460b58){return _0x271e5c[_0x0799('0x16')](_0x1f8173);}return _0x271e5c[_0x0799('0x17')](_0x1f8173)[_0x0799('0x18')]();};}function respondWithResult(_0x515c06,_0x15cc1e){_0x15cc1e=_0x15cc1e||0xc8;return function(_0x22dd75){if(_0x22dd75){return _0x515c06[_0x0799('0x17')](_0x15cc1e)[_0x0799('0x19')](_0x22dd75);}};}function respondWithFilteredResult(_0x4267b8,_0x526fe7){return function(_0xe7b983){if(_0xe7b983){var _0x4d7ad3=_0xe7b983['count'],_0x4be047=_0x526fe7[_0x0799('0x1a')],_0x59f2b3=_0x526fe7[_0x0799('0x1a')]+_0x526fe7[_0x0799('0x1b')],_0x544d2e;if(_0x59f2b3>=_0x4d7ad3){_0x59f2b3=_0x4d7ad3;_0x544d2e=0xc8;}else{_0x544d2e=0xce;}_0x4267b8[_0x0799('0x17')](_0x544d2e);return _0x4267b8['set'](_0x0799('0x1c'),_0x4be047+'-'+_0x59f2b3+'/'+_0x4d7ad3)[_0x0799('0x19')](_0xe7b983);}return null;};}function patchUpdates(_0x35d306){return function(_0x1ac8fe){try{jsonpatch['apply'](_0x1ac8fe,_0x35d306,!![]);}catch(_0x66c3d6){return BPromise['reject'](_0x66c3d6);}return _0x1ac8fe['save']();};}function saveUpdates(_0x163f9e,_0x1b37d4){return function(_0x1fe042){if(_0x1fe042){return _0x1fe042['update'](_0x163f9e)[_0x0799('0x1d')](function(_0x2da5de){return _0x2da5de;});}return null;};}function removeEntity(_0x35ab30,_0x375920){return function(_0x4c0ef0){if(_0x4c0ef0){return _0x4c0ef0[_0x0799('0x1e')]()[_0x0799('0x1d')](function(){_0x35ab30[_0x0799('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10a318,_0x17ce3d){return function(_0x1d35a6){if(!_0x1d35a6){_0x10a318[_0x0799('0x16')](0x194);}return _0x1d35a6;};}function handleError(_0x324f9e,_0x9516b1){_0x9516b1=_0x9516b1||0x1f4;return function(_0x22d19d){logger[_0x0799('0x1f')](_0x22d19d[_0x0799('0x20')]);if(_0x22d19d[_0x0799('0x21')]){delete _0x22d19d[_0x0799('0x21')];}_0x324f9e[_0x0799('0x17')](_0x9516b1)[_0x0799('0x22')](_0x22d19d);};}exports[_0x0799('0x23')]=function(_0x24f693,_0x2ababa){var _0x5749ac={},_0x3a3345={},_0x3d1f7e={'count':0x0,'rows':[]};var _0x29fc46=_[_0x0799('0x24')](db[_0x0799('0x25')][_0x0799('0x26')],function(_0xc2c4f3){return{'name':_0xc2c4f3[_0x0799('0x27')],'type':_0xc2c4f3['type'][_0x0799('0x28')]};});_0x3a3345[_0x0799('0x29')]=_[_0x0799('0x24')](_0x29fc46,_0x0799('0x21'));_0x3a3345[_0x0799('0x2a')]=_[_0x0799('0x2b')](_0x24f693[_0x0799('0x2a')]);_0x3a3345[_0x0799('0x2c')]=_[_0x0799('0x2d')](_0x3a3345[_0x0799('0x29')],_0x3a3345['query']);_0x5749ac[_0x0799('0x2e')]=_['intersection'](_0x3a3345['model'],qs['fields'](_0x24f693[_0x0799('0x2a')]['fields']));_0x5749ac[_0x0799('0x2e')]=_0x5749ac['attributes']['length']?_0x5749ac[_0x0799('0x2e')]:_0x3a3345[_0x0799('0x29')];if(!_0x24f693[_0x0799('0x2a')][_0x0799('0x2f')](_0x0799('0x30'))){_0x5749ac[_0x0799('0x1b')]=qs['limit'](_0x24f693[_0x0799('0x2a')][_0x0799('0x1b')]);_0x5749ac[_0x0799('0x1a')]=qs[_0x0799('0x1a')](_0x24f693[_0x0799('0x2a')]['offset']);}_0x5749ac[_0x0799('0x31')]=qs[_0x0799('0x32')](_0x24f693['query']['sort']);_0x5749ac[_0x0799('0x33')]=qs['filters'](_[_0x0799('0x34')](_0x24f693['query'],_0x3a3345['filters']),_0x29fc46);if(_0x24f693[_0x0799('0x2a')][_0x0799('0x35')]){_0x5749ac[_0x0799('0x33')]=_[_0x0799('0x36')](_0x5749ac[_0x0799('0x33')],{'$or':_[_0x0799('0x24')](_0x29fc46,function(_0x56203d){if(_0x56203d[_0x0799('0x37')]!=='VIRTUAL'){var _0x9b3ef2={};_0x9b3ef2[_0x56203d[_0x0799('0x21')]]={'$like':'%'+_0x24f693[_0x0799('0x2a')]['filter']+'%'};return _0x9b3ef2;}})});}_0x5749ac=_[_0x0799('0x36')]({},_0x5749ac,_0x24f693[_0x0799('0x38')]);var _0x2231a0={'where':_0x5749ac[_0x0799('0x33')]};return db[_0x0799('0x25')][_0x0799('0x39')](_0x2231a0)[_0x0799('0x1d')](function(_0x2b628c){_0x3d1f7e[_0x0799('0x39')]=_0x2b628c;if(_0x24f693['query'][_0x0799('0x3a')]){_0x5749ac[_0x0799('0x3b')]=[{'all':!![]}];}return db[_0x0799('0x25')][_0x0799('0x3c')](_0x5749ac);})['then'](function(_0x3d5af2){_0x3d1f7e[_0x0799('0x3d')]=_0x3d5af2;return _0x3d1f7e;})[_0x0799('0x1d')](respondWithFilteredResult(_0x2ababa,_0x5749ac))['catch'](handleError(_0x2ababa,null));};exports['show']=function(_0x30aa85,_0x389728){var _0x2a1b76={'raw':!![],'where':{'id':_0x30aa85[_0x0799('0x3e')]['id']}},_0x2130f9={};_0x2130f9[_0x0799('0x29')]=_[_0x0799('0x2b')](db['AnalyticTreeReport']['rawAttributes']);_0x2130f9['query']=_[_0x0799('0x2b')](_0x30aa85[_0x0799('0x2a')]);_0x2130f9[_0x0799('0x2c')]=_[_0x0799('0x2d')](_0x2130f9[_0x0799('0x29')],_0x2130f9[_0x0799('0x2a')]);_0x2a1b76[_0x0799('0x2e')]=_[_0x0799('0x2d')](_0x2130f9[_0x0799('0x29')],qs[_0x0799('0x3f')](_0x30aa85[_0x0799('0x2a')][_0x0799('0x3f')]));_0x2a1b76[_0x0799('0x2e')]=_0x2a1b76[_0x0799('0x2e')]['length']?_0x2a1b76[_0x0799('0x2e')]:_0x2130f9['model'];if(_0x30aa85['query']['includeAll']){_0x2a1b76[_0x0799('0x3b')]=[{'all':!![]}];}_0x2a1b76=_[_0x0799('0x36')]({},_0x2a1b76,_0x30aa85[_0x0799('0x38')]);return db[_0x0799('0x25')][_0x0799('0x40')](_0x2a1b76)[_0x0799('0x1d')](handleEntityNotFound(_0x389728,null))[_0x0799('0x1d')](respondWithResult(_0x389728,null))[_0x0799('0x41')](handleError(_0x389728,null));};exports['create']=function(_0x37754d,_0x29b874){return db[_0x0799('0x25')][_0x0799('0x42')](_0x37754d[_0x0799('0x43')],{})[_0x0799('0x1d')](respondWithResult(_0x29b874,0xc9))[_0x0799('0x41')](handleError(_0x29b874,null));};exports[_0x0799('0x44')]=function(_0x106cae,_0x4c2d5d){if(_0x106cae[_0x0799('0x43')]['id']){delete _0x106cae[_0x0799('0x43')]['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x106cae[_0x0799('0x3e')]['id']}})[_0x0799('0x1d')](handleEntityNotFound(_0x4c2d5d,null))[_0x0799('0x1d')](saveUpdates(_0x106cae[_0x0799('0x43')],null))[_0x0799('0x1d')](respondWithResult(_0x4c2d5d,null))[_0x0799('0x41')](handleError(_0x4c2d5d,null));};exports[_0x0799('0x1e')]=function(_0x3fd1b9,_0x1c03a3){return db[_0x0799('0x25')][_0x0799('0x40')]({'where':{'id':_0x3fd1b9[_0x0799('0x3e')]['id']}})[_0x0799('0x1d')](handleEntityNotFound(_0x1c03a3,null))[_0x0799('0x1d')](removeEntity(_0x1c03a3,null))[_0x0799('0x41')](handleError(_0x1c03a3,null));}; \ No newline at end of file +var _0xe1d9=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','fieldName','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','options','AnalyticTreeReport','include','rows','catch','show','params','rawAttributes','includeAll','create','body','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js'];(function(_0x1bc4de,_0x358405){var _0xb73fcf=function(_0xc3b836){while(--_0xc3b836){_0x1bc4de['push'](_0x1bc4de['shift']());}};_0xb73fcf(++_0x358405);}(_0xe1d9,0x88));var _0x9e1d=function(_0x1708d1,_0x494b2c){_0x1708d1=_0x1708d1-0x0;var _0x270211=_0xe1d9[_0x1708d1];return _0x270211;};'use strict';var pdf=require(_0x9e1d('0x0'));var emlformat=require(_0x9e1d('0x1'));var rimraf=require(_0x9e1d('0x2'));var zipdir=require(_0x9e1d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9e1d('0x4'));var moment=require(_0x9e1d('0x5'));var BPromise=require(_0x9e1d('0x6'));var Mustache=require('mustache');var util=require(_0x9e1d('0x7'));var path=require(_0x9e1d('0x8'));var sox=require(_0x9e1d('0x9'));var csv=require(_0x9e1d('0xa'));var ejs=require(_0x9e1d('0xb'));var fs=require('fs');var _=require(_0x9e1d('0xc'));var squel=require('squel');var crypto=require(_0x9e1d('0xd'));var jsforce=require(_0x9e1d('0xe'));var deskjs=require(_0x9e1d('0xf'));var toCsv=require(_0x9e1d('0xa'));var querystring=require(_0x9e1d('0x10'));var Papa=require(_0x9e1d('0x11'));var Redis=require('ioredis');var authService=require(_0x9e1d('0x12'));var qs=require(_0x9e1d('0x13'));var as=require(_0x9e1d('0x14'));var hardwareService=require(_0x9e1d('0x15'));var logger=require(_0x9e1d('0x16'))(_0x9e1d('0x17'));var utils=require(_0x9e1d('0x18'));var config=require(_0x9e1d('0x19'));var db=require(_0x9e1d('0x1a'))['db'];function respondWithStatusCode(_0x3098a5,_0x108dc5){_0x108dc5=_0x108dc5||0xcc;return function(_0x2daf51){if(_0x2daf51){return _0x3098a5[_0x9e1d('0x1b')](_0x108dc5);}return _0x3098a5[_0x9e1d('0x1c')](_0x108dc5)['end']();};}function respondWithResult(_0x2eae8e,_0x167774){_0x167774=_0x167774||0xc8;return function(_0x985dde){if(_0x985dde){return _0x2eae8e['status'](_0x167774)[_0x9e1d('0x1d')](_0x985dde);}};}function respondWithFilteredResult(_0x37e2dd,_0x84891d){return function(_0x4ef6fb){if(_0x4ef6fb){var _0x1c634c=_0x4ef6fb[_0x9e1d('0x1e')],_0x56fe55=_0x84891d['offset'],_0xc70e63=_0x84891d[_0x9e1d('0x1f')]+_0x84891d[_0x9e1d('0x20')],_0x36ad68;if(_0xc70e63>=_0x1c634c){_0xc70e63=_0x1c634c;_0x36ad68=0xc8;}else{_0x36ad68=0xce;}_0x37e2dd[_0x9e1d('0x1c')](_0x36ad68);return _0x37e2dd[_0x9e1d('0x21')](_0x9e1d('0x22'),_0x56fe55+'-'+_0xc70e63+'/'+_0x1c634c)[_0x9e1d('0x1d')](_0x4ef6fb);}return null;};}function patchUpdates(_0x218de4){return function(_0x13dfed){try{jsonpatch['apply'](_0x13dfed,_0x218de4,!![]);}catch(_0x19556b){return BPromise[_0x9e1d('0x23')](_0x19556b);}return _0x13dfed[_0x9e1d('0x24')]();};}function saveUpdates(_0x44a0a6,_0x131948){return function(_0x1c0eae){if(_0x1c0eae){return _0x1c0eae[_0x9e1d('0x25')](_0x44a0a6)[_0x9e1d('0x26')](function(_0xad8721){return _0xad8721;});}return null;};}function removeEntity(_0x15b654,_0x434ff9){return function(_0x4bf372){if(_0x4bf372){return _0x4bf372[_0x9e1d('0x27')]()[_0x9e1d('0x26')](function(){_0x15b654[_0x9e1d('0x1c')](0xcc)[_0x9e1d('0x28')]();});}};}function handleEntityNotFound(_0x11807e,_0x35ac93){return function(_0x1e02c7){if(!_0x1e02c7){_0x11807e[_0x9e1d('0x1b')](0x194);}return _0x1e02c7;};}function handleError(_0x1439eb,_0x1c9cd9){_0x1c9cd9=_0x1c9cd9||0x1f4;return function(_0x5358c2){logger[_0x9e1d('0x29')](_0x5358c2[_0x9e1d('0x2a')]);if(_0x5358c2[_0x9e1d('0x2b')]){delete _0x5358c2[_0x9e1d('0x2b')];}_0x1439eb[_0x9e1d('0x1c')](_0x1c9cd9)[_0x9e1d('0x2c')](_0x5358c2);};}exports[_0x9e1d('0x2d')]=function(_0x5af3a0,_0xb78d2d){var _0x2d4c8e={},_0xa8a03={},_0x267508={'count':0x0,'rows':[]};var _0x57fe5a=_[_0x9e1d('0x2e')](db['AnalyticTreeReport']['rawAttributes'],function(_0x355c5f){return{'name':_0x355c5f[_0x9e1d('0x2f')],'type':_0x355c5f['type']['key']};});_0xa8a03['model']=_['map'](_0x57fe5a,'name');_0xa8a03[_0x9e1d('0x30')]=_[_0x9e1d('0x31')](_0x5af3a0['query']);_0xa8a03['filters']=_[_0x9e1d('0x32')](_0xa8a03[_0x9e1d('0x33')],_0xa8a03[_0x9e1d('0x30')]);_0x2d4c8e['attributes']=_['intersection'](_0xa8a03[_0x9e1d('0x33')],qs[_0x9e1d('0x34')](_0x5af3a0['query'][_0x9e1d('0x34')]));_0x2d4c8e[_0x9e1d('0x35')]=_0x2d4c8e[_0x9e1d('0x35')][_0x9e1d('0x36')]?_0x2d4c8e[_0x9e1d('0x35')]:_0xa8a03[_0x9e1d('0x33')];if(!_0x5af3a0[_0x9e1d('0x30')][_0x9e1d('0x37')](_0x9e1d('0x38'))){_0x2d4c8e[_0x9e1d('0x20')]=qs[_0x9e1d('0x20')](_0x5af3a0[_0x9e1d('0x30')][_0x9e1d('0x20')]);_0x2d4c8e[_0x9e1d('0x1f')]=qs['offset'](_0x5af3a0[_0x9e1d('0x30')][_0x9e1d('0x1f')]);}_0x2d4c8e['order']=qs[_0x9e1d('0x39')](_0x5af3a0[_0x9e1d('0x30')]['sort']);_0x2d4c8e[_0x9e1d('0x3a')]=qs[_0x9e1d('0x3b')](_[_0x9e1d('0x3c')](_0x5af3a0[_0x9e1d('0x30')],_0xa8a03[_0x9e1d('0x3b')]),_0x57fe5a);if(_0x5af3a0[_0x9e1d('0x30')]['filter']){_0x2d4c8e[_0x9e1d('0x3a')]=_[_0x9e1d('0x3d')](_0x2d4c8e[_0x9e1d('0x3a')],{'$or':_[_0x9e1d('0x2e')](_0x57fe5a,function(_0x52eba5){if(_0x52eba5[_0x9e1d('0x3e')]!==_0x9e1d('0x3f')){var _0x78a3f2={};_0x78a3f2[_0x52eba5[_0x9e1d('0x2b')]]={'$like':'%'+_0x5af3a0[_0x9e1d('0x30')]['filter']+'%'};return _0x78a3f2;}})});}_0x2d4c8e=_[_0x9e1d('0x3d')]({},_0x2d4c8e,_0x5af3a0[_0x9e1d('0x40')]);var _0x166de3={'where':_0x2d4c8e[_0x9e1d('0x3a')]};return db[_0x9e1d('0x41')][_0x9e1d('0x1e')](_0x166de3)[_0x9e1d('0x26')](function(_0x42dfc9){_0x267508[_0x9e1d('0x1e')]=_0x42dfc9;if(_0x5af3a0[_0x9e1d('0x30')]['includeAll']){_0x2d4c8e[_0x9e1d('0x42')]=[{'all':!![]}];}return db[_0x9e1d('0x41')]['findAll'](_0x2d4c8e);})[_0x9e1d('0x26')](function(_0x37a320){_0x267508[_0x9e1d('0x43')]=_0x37a320;return _0x267508;})[_0x9e1d('0x26')](respondWithFilteredResult(_0xb78d2d,_0x2d4c8e))[_0x9e1d('0x44')](handleError(_0xb78d2d,null));};exports[_0x9e1d('0x45')]=function(_0x344a06,_0x147d9a){var _0x4ecb39={'raw':!![],'where':{'id':_0x344a06[_0x9e1d('0x46')]['id']}},_0x199e47={};_0x199e47['model']=_['keys'](db['AnalyticTreeReport'][_0x9e1d('0x47')]);_0x199e47[_0x9e1d('0x30')]=_[_0x9e1d('0x31')](_0x344a06[_0x9e1d('0x30')]);_0x199e47['filters']=_['intersection'](_0x199e47['model'],_0x199e47[_0x9e1d('0x30')]);_0x4ecb39['attributes']=_[_0x9e1d('0x32')](_0x199e47[_0x9e1d('0x33')],qs[_0x9e1d('0x34')](_0x344a06[_0x9e1d('0x30')][_0x9e1d('0x34')]));_0x4ecb39[_0x9e1d('0x35')]=_0x4ecb39[_0x9e1d('0x35')]['length']?_0x4ecb39[_0x9e1d('0x35')]:_0x199e47[_0x9e1d('0x33')];if(_0x344a06[_0x9e1d('0x30')][_0x9e1d('0x48')]){_0x4ecb39[_0x9e1d('0x42')]=[{'all':!![]}];}_0x4ecb39=_[_0x9e1d('0x3d')]({},_0x4ecb39,_0x344a06[_0x9e1d('0x40')]);return db[_0x9e1d('0x41')]['find'](_0x4ecb39)[_0x9e1d('0x26')](handleEntityNotFound(_0x147d9a,null))[_0x9e1d('0x26')](respondWithResult(_0x147d9a,null))[_0x9e1d('0x44')](handleError(_0x147d9a,null));};exports[_0x9e1d('0x49')]=function(_0xd109b7,_0x3ccb1f){return db[_0x9e1d('0x41')][_0x9e1d('0x49')](_0xd109b7['body'],{})['then'](respondWithResult(_0x3ccb1f,0xc9))['catch'](handleError(_0x3ccb1f,null));};exports[_0x9e1d('0x25')]=function(_0x559edb,_0x3f6290){if(_0x559edb[_0x9e1d('0x4a')]['id']){delete _0x559edb[_0x9e1d('0x4a')]['id'];}return db[_0x9e1d('0x41')][_0x9e1d('0x4b')]({'where':{'id':_0x559edb['params']['id']}})[_0x9e1d('0x26')](handleEntityNotFound(_0x3f6290,null))[_0x9e1d('0x26')](saveUpdates(_0x559edb[_0x9e1d('0x4a')],null))[_0x9e1d('0x26')](respondWithResult(_0x3f6290,null))[_0x9e1d('0x44')](handleError(_0x3f6290,null));};exports[_0x9e1d('0x27')]=function(_0x1d5347,_0x4d9ef7){return db['AnalyticTreeReport'][_0x9e1d('0x4b')]({'where':{'id':_0x1d5347[_0x9e1d('0x46')]['id']}})[_0x9e1d('0x26')](handleEntityNotFound(_0x4d9ef7,null))[_0x9e1d('0x26')](removeEntity(_0x4d9ef7,null))['catch'](handleError(_0x4d9ef7,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 392f872..40e5056 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 _0xd0ae=['define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports'];(function(_0x3df31d,_0x5081ff){var _0x352dbc=function(_0x2ede7c){while(--_0x2ede7c){_0x3df31d['push'](_0x3df31d['shift']());}};_0x352dbc(++_0x5081ff);}(_0xd0ae,0x8f));var _0xed0a=function(_0x5618ad,_0xc9873){_0x5618ad=_0x5618ad-0x0;var _0x1a3590=_0xd0ae[_0x5618ad];return _0x1a3590;};'use strict';var _=require(_0xed0a('0x0'));var util=require(_0xed0a('0x1'));var logger=require(_0xed0a('0x2'))(_0xed0a('0x3'));var moment=require('moment');var BPromise=require(_0xed0a('0x4'));var rp=require(_0xed0a('0x5'));var fs=require('fs');var path=require(_0xed0a('0x6'));var rimraf=require(_0xed0a('0x7'));var config=require(_0xed0a('0x8'));var attributes=require(_0xed0a('0x9'));module[_0xed0a('0xa')]=function(_0x44b7df,_0x2df952){return _0x44b7df[_0xed0a('0xb')](_0xed0a('0xc'),attributes,{'tableName':_0xed0a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x18ca=['request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','util','../../config/logger','api','moment'];(function(_0x15870f,_0x19e6dc){var _0x4b5a93=function(_0x2f75cd){while(--_0x2f75cd){_0x15870f['push'](_0x15870f['shift']());}};_0x4b5a93(++_0x19e6dc);}(_0x18ca,0x188));var _0xa18c=function(_0x3fa6ad,_0x3d0983){_0x3fa6ad=_0x3fa6ad-0x0;var _0x20099d=_0x18ca[_0x3fa6ad];return _0x20099d;};'use strict';var _=require('lodash');var util=require(_0xa18c('0x0'));var logger=require(_0xa18c('0x1'))(_0xa18c('0x2'));var moment=require(_0xa18c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa18c('0x4'));var fs=require('fs');var path=require(_0xa18c('0x5'));var rimraf=require(_0xa18c('0x6'));var config=require(_0xa18c('0x7'));var attributes=require(_0xa18c('0x8'));module[_0xa18c('0x9')]=function(_0x96f2f3,_0x1d253d){return _0x96f2f3['define'](_0xa18c('0xa'),attributes,{'tableName':'analytics_report_trees','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 0d16b17..87e9af7 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 _0x6b95=['jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b95,0x19f));var _0x56b9=function(_0x501cea,_0x25e1c5){_0x501cea=_0x501cea-0x0;var _0x2797b5=_0x6b95[_0x501cea];return _0x2797b5;};'use strict';var _=require(_0x56b9('0x0'));var util=require('util');var moment=require(_0x56b9('0x1'));var BPromise=require(_0x56b9('0x2'));var rs=require(_0x56b9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x56b9('0x4'));var config=require('../../config/environment');var jayson=require(_0x56b9('0x5'));var client=jayson[_0x56b9('0x6')][_0x56b9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1aae21,_0x4b8148,_0x53336f){return new BPromise(function(_0x2e14a1,_0x115666){return client[_0x56b9('0x8')](_0x1aae21,_0x53336f)[_0x56b9('0x9')](function(_0x3ade31){logger[_0x56b9('0xa')](_0x56b9('0xb'),_0x4b8148,'request\x20sent');logger[_0x56b9('0xc')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x4b8148,'request\x20sent',JSON[_0x56b9('0xd')](_0x3ade31));if(_0x3ade31[_0x56b9('0xe')]){if(_0x3ade31[_0x56b9('0xe')][_0x56b9('0xf')]===0x1f4){logger[_0x56b9('0xe')](_0x56b9('0xb'),_0x4b8148,_0x3ade31[_0x56b9('0xe')][_0x56b9('0x10')]);return _0x115666(_0x3ade31[_0x56b9('0xe')][_0x56b9('0x10')]);}logger['error'](_0x56b9('0xb'),_0x4b8148,_0x3ade31[_0x56b9('0xe')][_0x56b9('0x10')]);return _0x2e14a1(_0x3ade31['error']['message']);}else{logger[_0x56b9('0xa')](_0x56b9('0xb'),_0x4b8148,_0x56b9('0x11'));_0x2e14a1(_0x3ade31[_0x56b9('0x12')][_0x56b9('0x10')]);}})[_0x56b9('0x13')](function(_0x3c1b9b){logger[_0x56b9('0xe')](_0x56b9('0xb'),_0x4b8148,_0x3c1b9b);_0x115666(_0x3c1b9b);});});} \ No newline at end of file +var _0x7984=['debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x7984,0x79));var _0x4798=function(_0x652c38,_0x4ec2a3){_0x652c38=_0x652c38-0x0;var _0x31d2fd=_0x7984[_0x652c38];return _0x31d2fd;};'use strict';var _=require(_0x4798('0x0'));var util=require(_0x4798('0x1'));var moment=require(_0x4798('0x2'));var BPromise=require(_0x4798('0x3'));var rs=require(_0x4798('0x4'));var fs=require('fs');var Redis=require(_0x4798('0x5'));var db=require(_0x4798('0x6'))['db'];var utils=require(_0x4798('0x7'));var logger=require(_0x4798('0x8'))(_0x4798('0x9'));var config=require('../../config/environment');var jayson=require(_0x4798('0xa'));var client=jayson['client'][_0x4798('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bc240,_0x25fc3c,_0x496e1f){return new BPromise(function(_0xcd8961,_0x6feae4){return client[_0x4798('0xc')](_0x1bc240,_0x496e1f)[_0x4798('0xd')](function(_0xc9f17c){logger[_0x4798('0xe')](_0x4798('0xf'),_0x25fc3c,_0x4798('0x10'));logger[_0x4798('0x11')](_0x4798('0x12'),_0x25fc3c,'request\x20sent',JSON[_0x4798('0x13')](_0xc9f17c));if(_0xc9f17c[_0x4798('0x14')]){if(_0xc9f17c[_0x4798('0x14')]['code']===0x1f4){logger[_0x4798('0x14')](_0x4798('0xf'),_0x25fc3c,_0xc9f17c[_0x4798('0x14')][_0x4798('0x15')]);return _0x6feae4(_0xc9f17c[_0x4798('0x14')]['message']);}logger['error'](_0x4798('0xf'),_0x25fc3c,_0xc9f17c[_0x4798('0x14')][_0x4798('0x15')]);return _0xcd8961(_0xc9f17c['error'][_0x4798('0x15')]);}else{logger['info'](_0x4798('0xf'),_0x25fc3c,_0x4798('0x10'));_0xcd8961(_0xc9f17c['result'][_0x4798('0x15')]);}})[_0x4798('0x16')](function(_0x43077f){logger['error'](_0x4798('0xf'),_0x25fc3c,_0x43077f);_0x6feae4(_0x43077f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 334c6d2..c5c5877 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 _0x4f6d=['./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x54f4f1,_0x2e603b){var _0x14b71f=function(_0x410ca5){while(--_0x410ca5){_0x54f4f1['push'](_0x54f4f1['shift']());}};_0x14b71f(++_0x2e603b);}(_0x4f6d,0x102));var _0xd4f6=function(_0x526c39,_0x20b835){_0x526c39=_0x526c39-0x0;var _0x113bbd=_0x4f6d[_0x526c39];return _0x113bbd;};'use strict';var multer=require(_0xd4f6('0x0'));var util=require(_0xd4f6('0x1'));var path=require(_0xd4f6('0x2'));var timeout=require(_0xd4f6('0x3'));var express=require('express');var router=express[_0xd4f6('0x4')]();var auth=require(_0xd4f6('0x5'));var interaction=require(_0xd4f6('0x6'));var config=require(_0xd4f6('0x7'));var controller=require(_0xd4f6('0x8'));router[_0xd4f6('0x9')]('/',auth[_0xd4f6('0xa')](),controller[_0xd4f6('0xb')]);router[_0xd4f6('0x9')](_0xd4f6('0xc'),auth[_0xd4f6('0xa')](),controller[_0xd4f6('0xd')]);router['post']('/',auth[_0xd4f6('0xa')](),controller['create']);router[_0xd4f6('0xe')]('/:id',auth[_0xd4f6('0xa')](),controller[_0xd4f6('0xf')]);router[_0xd4f6('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xd4f6('0x11')]);module[_0xd4f6('0x12')]=router; \ No newline at end of file +var _0xe302=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x36fc09,_0x524f5a){var _0x52d555=function(_0x112183){while(--_0x112183){_0x36fc09['push'](_0x36fc09['shift']());}};_0x52d555(++_0x524f5a);}(_0xe302,0x93));var _0x2e30=function(_0x396244,_0x19da7f){_0x396244=_0x396244-0x0;var _0xdf4a90=_0xe302[_0x396244];return _0xdf4a90;};'use strict';var multer=require(_0x2e30('0x0'));var util=require(_0x2e30('0x1'));var path=require(_0x2e30('0x2'));var timeout=require(_0x2e30('0x3'));var express=require(_0x2e30('0x4'));var router=express[_0x2e30('0x5')]();var auth=require(_0x2e30('0x6'));var interaction=require(_0x2e30('0x7'));var config=require(_0x2e30('0x8'));var controller=require('./analyticTreeReport.controller');router[_0x2e30('0x9')]('/',auth[_0x2e30('0xa')](),controller['index']);router[_0x2e30('0x9')](_0x2e30('0xb'),auth[_0x2e30('0xa')](),controller[_0x2e30('0xc')]);router['post']('/',auth[_0x2e30('0xa')](),controller['create']);router[_0x2e30('0xd')](_0x2e30('0xb'),auth[_0x2e30('0xa')](),controller[_0x2e30('0xe')]);router[_0x2e30('0xf')](_0x2e30('0xb'),auth[_0x2e30('0xa')](),controller['destroy']);module[_0x2e30('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index d155a9e..9300f5b 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 _0xaf29=['sequelize','exports','STRING'];(function(_0x4b6d80,_0x4d923a){var _0x25b204=function(_0xa7c1af){while(--_0xa7c1af){_0x4b6d80['push'](_0x4b6d80['shift']());}};_0x25b204(++_0x4d923a);}(_0xaf29,0x1d1));var _0x9af2=function(_0xcebf99,_0xc51861){_0xcebf99=_0xcebf99-0x0;var _0x3e72d3=_0xaf29[_0xcebf99];return _0x3e72d3;};'use strict';var Sequelize=require(_0x9af2('0x0'));module[_0x9af2('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x9af2('0x2')]},'type':{'type':Sequelize[_0x9af2('0x2')]}}; \ No newline at end of file +var _0x160d=['sequelize','exports','STRING'];(function(_0x225714,_0x1652ae){var _0x580214=function(_0x5e5933){while(--_0x5e5933){_0x225714['push'](_0x225714['shift']());}};_0x580214(++_0x1652ae);}(_0x160d,0x123));var _0xd160=function(_0x4d4ab2,_0x1cb84f){_0x4d4ab2=_0x4d4ab2-0x0;var _0x53a726=_0x160d[_0x4d4ab2];return _0x53a726;};'use strict';var Sequelize=require(_0xd160('0x0'));module[_0xd160('0x1')]={'name':{'type':Sequelize[_0xd160('0x2')]},'basename':{'type':Sequelize[_0xd160('0x2')]},'type':{'type':Sequelize[_0xd160('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index efa0672..fef8054 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 _0x4b7b=['crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Attachment','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','length','find','clone','get','omit','body','createdAt','updatedAt','create','file','basename','filename','findOne','root','server/files/attachments/','html-pdf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash'];(function(_0x1f4085,_0x532ee6){var _0x3bcd43=function(_0x345fcf){while(--_0x345fcf){_0x1f4085['push'](_0x1f4085['shift']());}};_0x3bcd43(++_0x532ee6);}(_0x4b7b,0x142));var _0xb4b7=function(_0xda1060,_0x3cce4e){_0xda1060=_0xda1060-0x0;var _0x577780=_0x4b7b[_0xda1060];return _0x577780;};'use strict';var pdf=require(_0xb4b7('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb4b7('0x1'));var rp=require(_0xb4b7('0x2'));var moment=require('moment');var BPromise=require(_0xb4b7('0x3'));var Mustache=require(_0xb4b7('0x4'));var util=require(_0xb4b7('0x5'));var path=require(_0xb4b7('0x6'));var sox=require(_0xb4b7('0x7'));var csv=require('to-csv');var ejs=require(_0xb4b7('0x8'));var fs=require('fs');var _=require(_0xb4b7('0x9'));var squel=require('squel');var crypto=require(_0xb4b7('0xa'));var jsforce=require(_0xb4b7('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb4b7('0xc'));var querystring=require(_0xb4b7('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb4b7('0xe'));var qs=require(_0xb4b7('0xf'));var as=require(_0xb4b7('0x10'));var hardwareService=require(_0xb4b7('0x11'));var logger=require(_0xb4b7('0x12'))('api');var utils=require(_0xb4b7('0x13'));var config=require(_0xb4b7('0x14'));var db=require(_0xb4b7('0x15'))['db'];function respondWithStatusCode(_0x450802,_0x2ed3af){_0x2ed3af=_0x2ed3af||0xcc;return function(_0x1ec08d){if(_0x1ec08d){return _0x450802[_0xb4b7('0x16')](_0x2ed3af);}return _0x450802['status'](_0x2ed3af)[_0xb4b7('0x17')]();};}function respondWithResult(_0xaf32d6,_0x2de675){_0x2de675=_0x2de675||0xc8;return function(_0xef960d){if(_0xef960d){return _0xaf32d6[_0xb4b7('0x18')](_0x2de675)[_0xb4b7('0x19')](_0xef960d);}};}function respondWithFilteredResult(_0x8ad8aa,_0x5132b8){return function(_0x238c22){if(_0x238c22){var _0x47e42d=_0x238c22[_0xb4b7('0x1a')],_0x59e025=_0x5132b8['offset'],_0x52beb3=_0x5132b8[_0xb4b7('0x1b')]+_0x5132b8['limit'],_0x2d85f;if(_0x52beb3>=_0x47e42d){_0x52beb3=_0x47e42d;_0x2d85f=0xc8;}else{_0x2d85f=0xce;}_0x8ad8aa['status'](_0x2d85f);return _0x8ad8aa['set'](_0xb4b7('0x1c'),_0x59e025+'-'+_0x52beb3+'/'+_0x47e42d)['json'](_0x238c22);}return null;};}function patchUpdates(_0x1c18e9){return function(_0x3c3af2){try{jsonpatch[_0xb4b7('0x1d')](_0x3c3af2,_0x1c18e9,!![]);}catch(_0x342db1){return BPromise[_0xb4b7('0x1e')](_0x342db1);}return _0x3c3af2[_0xb4b7('0x1f')]();};}function saveUpdates(_0x15b99e,_0x2c9eec){return function(_0xe2b0d3){if(_0xe2b0d3){return _0xe2b0d3[_0xb4b7('0x20')](_0x15b99e)[_0xb4b7('0x21')](function(_0x2cc855){return _0x2cc855;});}return null;};}function removeEntity(_0x1e95d6,_0x160ab3){return function(_0xcbbcef){if(_0xcbbcef){return _0xcbbcef[_0xb4b7('0x22')]()[_0xb4b7('0x21')](function(){_0x1e95d6['status'](0xcc)[_0xb4b7('0x17')]();});}};}function handleEntityNotFound(_0x2c33bd,_0x72dc70){return function(_0x3691ae){if(!_0x3691ae){_0x2c33bd[_0xb4b7('0x16')](0x194);}return _0x3691ae;};}function handleError(_0x46731d,_0x5678ac){_0x5678ac=_0x5678ac||0x1f4;return function(_0x919dee){logger[_0xb4b7('0x23')](_0x919dee[_0xb4b7('0x24')]);if(_0x919dee[_0xb4b7('0x25')]){delete _0x919dee[_0xb4b7('0x25')];}_0x46731d[_0xb4b7('0x18')](_0x5678ac)[_0xb4b7('0x26')](_0x919dee);};}exports[_0xb4b7('0x27')]=function(_0x2d52eb,_0x2cfbec){var _0x1754fb={},_0x53c793={},_0x1b6690={'count':0x0,'rows':[]};var _0x13a56c=_[_0xb4b7('0x28')](db[_0xb4b7('0x29')][_0xb4b7('0x2a')],function(_0x1c4096){return{'name':_0x1c4096['fieldName'],'type':_0x1c4096[_0xb4b7('0x2b')][_0xb4b7('0x2c')]};});_0x53c793[_0xb4b7('0x2d')]=_[_0xb4b7('0x28')](_0x13a56c,'name');_0x53c793[_0xb4b7('0x2e')]=_[_0xb4b7('0x2f')](_0x2d52eb[_0xb4b7('0x2e')]);_0x53c793[_0xb4b7('0x30')]=_[_0xb4b7('0x31')](_0x53c793[_0xb4b7('0x2d')],_0x53c793[_0xb4b7('0x2e')]);_0x1754fb['attributes']=_[_0xb4b7('0x31')](_0x53c793[_0xb4b7('0x2d')],qs[_0xb4b7('0x32')](_0x2d52eb['query'][_0xb4b7('0x32')]));_0x1754fb[_0xb4b7('0x33')]=_0x1754fb[_0xb4b7('0x33')]['length']?_0x1754fb[_0xb4b7('0x33')]:_0x53c793[_0xb4b7('0x2d')];if(!_0x2d52eb['query'][_0xb4b7('0x34')](_0xb4b7('0x35'))){_0x1754fb[_0xb4b7('0x36')]=qs[_0xb4b7('0x36')](_0x2d52eb['query'][_0xb4b7('0x36')]);_0x1754fb[_0xb4b7('0x1b')]=qs[_0xb4b7('0x1b')](_0x2d52eb[_0xb4b7('0x2e')][_0xb4b7('0x1b')]);}_0x1754fb[_0xb4b7('0x37')]=qs[_0xb4b7('0x38')](_0x2d52eb[_0xb4b7('0x2e')][_0xb4b7('0x38')]);_0x1754fb[_0xb4b7('0x39')]=qs['filters'](_[_0xb4b7('0x3a')](_0x2d52eb['query'],_0x53c793[_0xb4b7('0x30')]),_0x13a56c);if(_0x2d52eb['query'][_0xb4b7('0x3b')]){_0x1754fb[_0xb4b7('0x39')]=_[_0xb4b7('0x3c')](_0x1754fb[_0xb4b7('0x39')],{'$or':_[_0xb4b7('0x28')](_0x13a56c,function(_0x5e7722){if(_0x5e7722[_0xb4b7('0x2b')]!=='VIRTUAL'){var _0xa4d839={};_0xa4d839[_0x5e7722['name']]={'$like':'%'+_0x2d52eb[_0xb4b7('0x2e')][_0xb4b7('0x3b')]+'%'};return _0xa4d839;}})});}_0x1754fb=_['merge']({},_0x1754fb,_0x2d52eb[_0xb4b7('0x3d')]);var _0x16ae61={'where':_0x1754fb[_0xb4b7('0x39')]};return db[_0xb4b7('0x29')][_0xb4b7('0x1a')](_0x16ae61)[_0xb4b7('0x21')](function(_0x45fb88){_0x1b6690[_0xb4b7('0x1a')]=_0x45fb88;if(_0x2d52eb[_0xb4b7('0x2e')][_0xb4b7('0x3e')]){_0x1754fb[_0xb4b7('0x3f')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x1754fb);})['then'](function(_0x415388){_0x1b6690[_0xb4b7('0x40')]=_0x415388;return _0x1b6690;})[_0xb4b7('0x21')](respondWithFilteredResult(_0x2cfbec,_0x1754fb))[_0xb4b7('0x41')](handleError(_0x2cfbec,null));};exports[_0xb4b7('0x42')]=function(_0x28376f,_0x49eb7b){var _0x1e541d={'raw':!![],'where':{'id':_0x28376f[_0xb4b7('0x43')]['id']}},_0x5a0bb0={};_0x5a0bb0[_0xb4b7('0x2d')]=_[_0xb4b7('0x2f')](db['Attachment']['rawAttributes']);_0x5a0bb0[_0xb4b7('0x2e')]=_[_0xb4b7('0x2f')](_0x28376f[_0xb4b7('0x2e')]);_0x5a0bb0[_0xb4b7('0x30')]=_['intersection'](_0x5a0bb0[_0xb4b7('0x2d')],_0x5a0bb0[_0xb4b7('0x2e')]);_0x1e541d[_0xb4b7('0x33')]=_[_0xb4b7('0x31')](_0x5a0bb0[_0xb4b7('0x2d')],qs['fields'](_0x28376f['query'][_0xb4b7('0x32')]));_0x1e541d[_0xb4b7('0x33')]=_0x1e541d[_0xb4b7('0x33')][_0xb4b7('0x44')]?_0x1e541d[_0xb4b7('0x33')]:_0x5a0bb0['model'];if(_0x28376f['query']['includeAll']){_0x1e541d[_0xb4b7('0x3f')]=[{'all':!![]}];}_0x1e541d=_[_0xb4b7('0x3c')]({},_0x1e541d,_0x28376f[_0xb4b7('0x3d')]);return db['Attachment'][_0xb4b7('0x45')](_0x1e541d)['then'](handleEntityNotFound(_0x49eb7b,null))[_0xb4b7('0x21')](respondWithResult(_0x49eb7b,null))['catch'](handleError(_0x49eb7b,null));};exports[_0xb4b7('0x46')]=function(_0xce3df7,_0x408575){var _0x594f92={'where':{'id':_0xce3df7[_0xb4b7('0x43')]['id']}},_0x557877={};_0x557877[_0xb4b7('0x2d')]=_[_0xb4b7('0x2f')](db[_0xb4b7('0x29')][_0xb4b7('0x2a')]);_0x594f92[_0xb4b7('0x33')]=_[_0xb4b7('0x31')](_0x557877[_0xb4b7('0x2d')],qs[_0xb4b7('0x32')](_0xce3df7[_0xb4b7('0x2e')][_0xb4b7('0x32')]));_0x594f92['attributes']=_0x594f92['attributes'][_0xb4b7('0x44')]?_0x594f92[_0xb4b7('0x33')]:_0x557877[_0xb4b7('0x2d')];if(_0xce3df7[_0xb4b7('0x2e')][_0xb4b7('0x3e')]){_0x594f92[_0xb4b7('0x3f')]=[{'all':!![]}];}_0x594f92=_[_0xb4b7('0x3c')]({},_0x594f92,_0xce3df7['options']);return db['Attachment'][_0xb4b7('0x45')](_0x594f92)[_0xb4b7('0x21')](handleEntityNotFound(_0x408575,null))[_0xb4b7('0x21')](function(_0x3c13eb){if(_0x3c13eb){var _0x5636b1=_0x3c13eb[_0xb4b7('0x47')]({'plain':!![]});_0x5636b1=qs[_0xb4b7('0x48')](_0x5636b1,['id','createdAt','updatedAt']);_0xce3df7['body']=_[_0xb4b7('0x48')](_0xce3df7[_0xb4b7('0x49')],['id',_0xb4b7('0x4a'),_0xb4b7('0x4b')]);return db[_0xb4b7('0x29')][_0xb4b7('0x4c')](_[_0xb4b7('0x3c')](_0x5636b1,_0xce3df7[_0xb4b7('0x49')]),{'include':_0xce3df7[_0xb4b7('0x2e')][_0xb4b7('0x3e')]?[{'all':!![]}]:undefined});}})[_0xb4b7('0x21')](respondWithResult(_0x408575,0xc9))[_0xb4b7('0x41')](handleError(_0x408575,null));};exports['update']=function(_0x1816e7,_0x46a106){if(_0x1816e7[_0xb4b7('0x49')]['id']){delete _0x1816e7['body']['id'];}return db['Attachment']['find']({'where':{'id':_0x1816e7[_0xb4b7('0x43')]['id']}})['then'](handleEntityNotFound(_0x46a106,null))[_0xb4b7('0x21')](saveUpdates(_0x1816e7[_0xb4b7('0x49')],null))['then'](respondWithResult(_0x46a106,null))[_0xb4b7('0x41')](handleError(_0x46a106,null));};exports[_0xb4b7('0x22')]=function(_0x4a96c7,_0x5758a7){return db[_0xb4b7('0x29')][_0xb4b7('0x45')]({'where':{'id':_0x4a96c7[_0xb4b7('0x43')]['id']}})[_0xb4b7('0x21')](handleEntityNotFound(_0x5758a7,null))[_0xb4b7('0x21')](removeEntity(_0x5758a7,null))[_0xb4b7('0x41')](handleError(_0x5758a7,null));};exports[_0xb4b7('0x4c')]=function(_0x1c7a90,_0x3a5b54,_0x7cd49e){_0x1c7a90[_0xb4b7('0x49')][_0xb4b7('0x25')]=_0x1c7a90[_0xb4b7('0x4d')]['originalname'];_0x1c7a90['body'][_0xb4b7('0x4e')]=_0x1c7a90[_0xb4b7('0x4d')][_0xb4b7('0x4f')];_0x1c7a90['body'][_0xb4b7('0x2b')]=_0x1c7a90['file']['mimetype'];return db[_0xb4b7('0x29')]['create'](_0x1c7a90[_0xb4b7('0x49')])['then'](respondWithResult(_0x3a5b54,0xc9))[_0xb4b7('0x41')](handleError(_0x3a5b54,null));};exports['download']=function(_0x34daff,_0x580ce5,_0x27086c){return db['Attachment'][_0xb4b7('0x50')]({'where':{'id':_0x34daff[_0xb4b7('0x43')]['id']},'raw':!![]})[_0xb4b7('0x21')](handleEntityNotFound(_0x580ce5,null))[_0xb4b7('0x21')](function(_0x2dab4d){if(_0x2dab4d){return _0x580ce5['download'](path['join'](config[_0xb4b7('0x51')],_0xb4b7('0x52'),_0x2dab4d['basename']));}})[_0xb4b7('0x41')](handleError(_0x580ce5,null));}; \ No newline at end of file +var _0x8cb8=['../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','filter','merge','options','where','then','includeAll','include','Attachment','catch','show','params','find','clone','get','omit','createdAt','updatedAt','body','create','file','basename','filename','mimetype','download','findOne','join','root','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8cb8,0x13c));var _0x88cb=function(_0x1663ae,_0x10484a){_0x1663ae=_0x1663ae-0x0;var _0x30ffb8=_0x8cb8[_0x1663ae];return _0x30ffb8;};'use strict';var pdf=require(_0x88cb('0x0'));var emlformat=require(_0x88cb('0x1'));var rimraf=require(_0x88cb('0x2'));var zipdir=require(_0x88cb('0x3'));var jsonpatch=require(_0x88cb('0x4'));var rp=require(_0x88cb('0x5'));var moment=require(_0x88cb('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x88cb('0x7'));var path=require(_0x88cb('0x8'));var sox=require(_0x88cb('0x9'));var csv=require(_0x88cb('0xa'));var ejs=require(_0x88cb('0xb'));var fs=require('fs');var _=require(_0x88cb('0xc'));var squel=require('squel');var crypto=require(_0x88cb('0xd'));var jsforce=require(_0x88cb('0xe'));var deskjs=require(_0x88cb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x88cb('0x10'));var Papa=require('papaparse');var Redis=require(_0x88cb('0x11'));var authService=require(_0x88cb('0x12'));var qs=require(_0x88cb('0x13'));var as=require(_0x88cb('0x14'));var hardwareService=require(_0x88cb('0x15'));var logger=require('../../config/logger')(_0x88cb('0x16'));var utils=require(_0x88cb('0x17'));var config=require(_0x88cb('0x18'));var db=require(_0x88cb('0x19'))['db'];function respondWithStatusCode(_0x52ac81,_0x8f67fd){_0x8f67fd=_0x8f67fd||0xcc;return function(_0x986b22){if(_0x986b22){return _0x52ac81[_0x88cb('0x1a')](_0x8f67fd);}return _0x52ac81[_0x88cb('0x1b')](_0x8f67fd)[_0x88cb('0x1c')]();};}function respondWithResult(_0x5336b2,_0x2d1ef5){_0x2d1ef5=_0x2d1ef5||0xc8;return function(_0x563995){if(_0x563995){return _0x5336b2[_0x88cb('0x1b')](_0x2d1ef5)[_0x88cb('0x1d')](_0x563995);}};}function respondWithFilteredResult(_0x21761a,_0x1ca675){return function(_0x547852){if(_0x547852){var _0x3f039b=_0x547852[_0x88cb('0x1e')],_0x1958b4=_0x1ca675[_0x88cb('0x1f')],_0x1bf159=_0x1ca675[_0x88cb('0x1f')]+_0x1ca675[_0x88cb('0x20')],_0x5240cb;if(_0x1bf159>=_0x3f039b){_0x1bf159=_0x3f039b;_0x5240cb=0xc8;}else{_0x5240cb=0xce;}_0x21761a['status'](_0x5240cb);return _0x21761a[_0x88cb('0x21')]('Content-Range',_0x1958b4+'-'+_0x1bf159+'/'+_0x3f039b)[_0x88cb('0x1d')](_0x547852);}return null;};}function patchUpdates(_0x425bc6){return function(_0x54992b){try{jsonpatch[_0x88cb('0x22')](_0x54992b,_0x425bc6,!![]);}catch(_0x25bb08){return BPromise['reject'](_0x25bb08);}return _0x54992b[_0x88cb('0x23')]();};}function saveUpdates(_0x1cd854,_0xbae77f){return function(_0xe79059){if(_0xe79059){return _0xe79059[_0x88cb('0x24')](_0x1cd854)['then'](function(_0x504429){return _0x504429;});}return null;};}function removeEntity(_0x7a60a9,_0x4e79be){return function(_0x1614a9){if(_0x1614a9){return _0x1614a9[_0x88cb('0x25')]()['then'](function(){_0x7a60a9[_0x88cb('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x228f28,_0x57e2c1){return function(_0x370ad7){if(!_0x370ad7){_0x228f28[_0x88cb('0x1a')](0x194);}return _0x370ad7;};}function handleError(_0x3a668e,_0x213076){_0x213076=_0x213076||0x1f4;return function(_0x19aae5){logger[_0x88cb('0x26')](_0x19aae5[_0x88cb('0x27')]);if(_0x19aae5[_0x88cb('0x28')]){delete _0x19aae5['name'];}_0x3a668e['status'](_0x213076)['send'](_0x19aae5);};}exports['index']=function(_0x354e20,_0x3e3e7b){var _0x214cd5={},_0x457aac={},_0x11487a={'count':0x0,'rows':[]};var _0x1f06fa=_[_0x88cb('0x29')](db['Attachment'][_0x88cb('0x2a')],function(_0x198562){return{'name':_0x198562[_0x88cb('0x2b')],'type':_0x198562[_0x88cb('0x2c')][_0x88cb('0x2d')]};});_0x457aac[_0x88cb('0x2e')]=_[_0x88cb('0x29')](_0x1f06fa,_0x88cb('0x28'));_0x457aac[_0x88cb('0x2f')]=_[_0x88cb('0x30')](_0x354e20[_0x88cb('0x2f')]);_0x457aac[_0x88cb('0x31')]=_['intersection'](_0x457aac[_0x88cb('0x2e')],_0x457aac[_0x88cb('0x2f')]);_0x214cd5['attributes']=_[_0x88cb('0x32')](_0x457aac[_0x88cb('0x2e')],qs[_0x88cb('0x33')](_0x354e20[_0x88cb('0x2f')]['fields']));_0x214cd5[_0x88cb('0x34')]=_0x214cd5[_0x88cb('0x34')][_0x88cb('0x35')]?_0x214cd5['attributes']:_0x457aac[_0x88cb('0x2e')];if(!_0x354e20[_0x88cb('0x2f')]['hasOwnProperty']('nolimit')){_0x214cd5[_0x88cb('0x20')]=qs[_0x88cb('0x20')](_0x354e20['query'][_0x88cb('0x20')]);_0x214cd5['offset']=qs[_0x88cb('0x1f')](_0x354e20[_0x88cb('0x2f')]['offset']);}_0x214cd5[_0x88cb('0x36')]=qs[_0x88cb('0x37')](_0x354e20[_0x88cb('0x2f')][_0x88cb('0x37')]);_0x214cd5['where']=qs[_0x88cb('0x31')](_[_0x88cb('0x38')](_0x354e20[_0x88cb('0x2f')],_0x457aac[_0x88cb('0x31')]),_0x1f06fa);if(_0x354e20[_0x88cb('0x2f')][_0x88cb('0x39')]){_0x214cd5['where']=_[_0x88cb('0x3a')](_0x214cd5['where'],{'$or':_[_0x88cb('0x29')](_0x1f06fa,function(_0x179a0f){if(_0x179a0f['type']!=='VIRTUAL'){var _0x19db25={};_0x19db25[_0x179a0f[_0x88cb('0x28')]]={'$like':'%'+_0x354e20['query'][_0x88cb('0x39')]+'%'};return _0x19db25;}})});}_0x214cd5=_[_0x88cb('0x3a')]({},_0x214cd5,_0x354e20[_0x88cb('0x3b')]);var _0x1b7a7b={'where':_0x214cd5[_0x88cb('0x3c')]};return db['Attachment'][_0x88cb('0x1e')](_0x1b7a7b)[_0x88cb('0x3d')](function(_0x2b85b2){_0x11487a[_0x88cb('0x1e')]=_0x2b85b2;if(_0x354e20[_0x88cb('0x2f')][_0x88cb('0x3e')]){_0x214cd5[_0x88cb('0x3f')]=[{'all':!![]}];}return db[_0x88cb('0x40')]['findAll'](_0x214cd5);})[_0x88cb('0x3d')](function(_0x524e79){_0x11487a['rows']=_0x524e79;return _0x11487a;})[_0x88cb('0x3d')](respondWithFilteredResult(_0x3e3e7b,_0x214cd5))[_0x88cb('0x41')](handleError(_0x3e3e7b,null));};exports[_0x88cb('0x42')]=function(_0x5deab6,_0x15a328){var _0x8bf3b4={'raw':!![],'where':{'id':_0x5deab6[_0x88cb('0x43')]['id']}},_0x4b4a9c={};_0x4b4a9c[_0x88cb('0x2e')]=_['keys'](db[_0x88cb('0x40')][_0x88cb('0x2a')]);_0x4b4a9c[_0x88cb('0x2f')]=_[_0x88cb('0x30')](_0x5deab6[_0x88cb('0x2f')]);_0x4b4a9c[_0x88cb('0x31')]=_[_0x88cb('0x32')](_0x4b4a9c[_0x88cb('0x2e')],_0x4b4a9c[_0x88cb('0x2f')]);_0x8bf3b4[_0x88cb('0x34')]=_[_0x88cb('0x32')](_0x4b4a9c['model'],qs[_0x88cb('0x33')](_0x5deab6[_0x88cb('0x2f')]['fields']));_0x8bf3b4['attributes']=_0x8bf3b4[_0x88cb('0x34')]['length']?_0x8bf3b4[_0x88cb('0x34')]:_0x4b4a9c['model'];if(_0x5deab6['query']['includeAll']){_0x8bf3b4[_0x88cb('0x3f')]=[{'all':!![]}];}_0x8bf3b4=_[_0x88cb('0x3a')]({},_0x8bf3b4,_0x5deab6[_0x88cb('0x3b')]);return db[_0x88cb('0x40')][_0x88cb('0x44')](_0x8bf3b4)[_0x88cb('0x3d')](handleEntityNotFound(_0x15a328,null))[_0x88cb('0x3d')](respondWithResult(_0x15a328,null))['catch'](handleError(_0x15a328,null));};exports[_0x88cb('0x45')]=function(_0x38a9ad,_0x4fab43){var _0x1f46ff={'where':{'id':_0x38a9ad[_0x88cb('0x43')]['id']}},_0x4a1e24={};_0x4a1e24[_0x88cb('0x2e')]=_[_0x88cb('0x30')](db['Attachment'][_0x88cb('0x2a')]);_0x1f46ff[_0x88cb('0x34')]=_[_0x88cb('0x32')](_0x4a1e24['model'],qs[_0x88cb('0x33')](_0x38a9ad[_0x88cb('0x2f')][_0x88cb('0x33')]));_0x1f46ff[_0x88cb('0x34')]=_0x1f46ff[_0x88cb('0x34')]['length']?_0x1f46ff[_0x88cb('0x34')]:_0x4a1e24[_0x88cb('0x2e')];if(_0x38a9ad[_0x88cb('0x2f')]['includeAll']){_0x1f46ff['include']=[{'all':!![]}];}_0x1f46ff=_[_0x88cb('0x3a')]({},_0x1f46ff,_0x38a9ad[_0x88cb('0x3b')]);return db['Attachment']['find'](_0x1f46ff)[_0x88cb('0x3d')](handleEntityNotFound(_0x4fab43,null))[_0x88cb('0x3d')](function(_0x2038b9){if(_0x2038b9){var _0x57fca5=_0x2038b9[_0x88cb('0x46')]({'plain':!![]});_0x57fca5=qs[_0x88cb('0x47')](_0x57fca5,['id',_0x88cb('0x48'),_0x88cb('0x49')]);_0x38a9ad[_0x88cb('0x4a')]=_[_0x88cb('0x47')](_0x38a9ad[_0x88cb('0x4a')],['id',_0x88cb('0x48'),_0x88cb('0x49')]);return db['Attachment'][_0x88cb('0x4b')](_[_0x88cb('0x3a')](_0x57fca5,_0x38a9ad[_0x88cb('0x4a')]),{'include':_0x38a9ad[_0x88cb('0x2f')][_0x88cb('0x3e')]?[{'all':!![]}]:undefined});}})[_0x88cb('0x3d')](respondWithResult(_0x4fab43,0xc9))['catch'](handleError(_0x4fab43,null));};exports[_0x88cb('0x24')]=function(_0x13ea39,_0x1a6d12){if(_0x13ea39['body']['id']){delete _0x13ea39[_0x88cb('0x4a')]['id'];}return db['Attachment'][_0x88cb('0x44')]({'where':{'id':_0x13ea39[_0x88cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x1a6d12,null))[_0x88cb('0x3d')](saveUpdates(_0x13ea39[_0x88cb('0x4a')],null))[_0x88cb('0x3d')](respondWithResult(_0x1a6d12,null))[_0x88cb('0x41')](handleError(_0x1a6d12,null));};exports['destroy']=function(_0x193f20,_0x308287){return db[_0x88cb('0x40')]['find']({'where':{'id':_0x193f20['params']['id']}})[_0x88cb('0x3d')](handleEntityNotFound(_0x308287,null))['then'](removeEntity(_0x308287,null))['catch'](handleError(_0x308287,null));};exports[_0x88cb('0x4b')]=function(_0x242c35,_0x21f7eb,_0x4bbafe){_0x242c35[_0x88cb('0x4a')][_0x88cb('0x28')]=_0x242c35[_0x88cb('0x4c')]['originalname'];_0x242c35[_0x88cb('0x4a')][_0x88cb('0x4d')]=_0x242c35['file'][_0x88cb('0x4e')];_0x242c35[_0x88cb('0x4a')][_0x88cb('0x2c')]=_0x242c35[_0x88cb('0x4c')][_0x88cb('0x4f')];return db['Attachment'][_0x88cb('0x4b')](_0x242c35[_0x88cb('0x4a')])[_0x88cb('0x3d')](respondWithResult(_0x21f7eb,0xc9))[_0x88cb('0x41')](handleError(_0x21f7eb,null));};exports[_0x88cb('0x50')]=function(_0x40d1d0,_0xc09947,_0x2588fe){return db['Attachment'][_0x88cb('0x51')]({'where':{'id':_0x40d1d0['params']['id']},'raw':!![]})[_0x88cb('0x3d')](handleEntityNotFound(_0xc09947,null))['then'](function(_0x36f42d){if(_0x36f42d){return _0xc09947[_0x88cb('0x50')](path[_0x88cb('0x52')](config[_0x88cb('0x53')],_0x88cb('0x54'),_0x36f42d['basename']));}})[_0x88cb('0x41')](handleError(_0xc09947,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index d26d1db..6da6f60 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 _0xb7c8=['request-promise','path','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','util','../../config/logger','api','moment','bluebird'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xb7c8,0x119));var _0x8b7c=function(_0x3afbcb,_0x3e5dd8){_0x3afbcb=_0x3afbcb-0x0;var _0x36bf9e=_0xb7c8[_0x3afbcb];return _0x36bf9e;};'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 fs=require('fs');var path=require(_0x8b7c('0x6'));var rimraf=require('rimraf');var config=require(_0x8b7c('0x7'));var attributes=require(_0x8b7c('0x8'));module[_0x8b7c('0x9')]=function(_0x440900,_0x107428){return _0x440900[_0x8b7c('0xa')](_0x8b7c('0xb'),attributes,{'tableName':_0x8b7c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd64b=['define','Attachment','attachments','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x49c1b0,_0x35b033){var _0x5be831=function(_0x1ae2a4){while(--_0x1ae2a4){_0x49c1b0['push'](_0x49c1b0['shift']());}};_0x5be831(++_0x35b033);}(_0xd64b,0xc1));var _0xbd64=function(_0x14ec54,_0x2d5098){_0x14ec54=_0x14ec54-0x0;var _0x2f8c0e=_0xd64b[_0x14ec54];return _0x2f8c0e;};'use strict';var _=require(_0xbd64('0x0'));var util=require('util');var logger=require(_0xbd64('0x1'))('api');var moment=require(_0xbd64('0x2'));var BPromise=require(_0xbd64('0x3'));var rp=require(_0xbd64('0x4'));var fs=require('fs');var path=require(_0xbd64('0x5'));var rimraf=require(_0xbd64('0x6'));var config=require('../../config/environment');var attributes=require('./attachment.attributes');module['exports']=function(_0x51e87d,_0x58e9e7){return _0x51e87d[_0xbd64('0x7')](_0xbd64('0x8'),attributes,{'tableName':_0xbd64('0x9'),'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 e4a0eb3..808a05e 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 _0x2ce3=['Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','create','body','options','raw','CreateAttachment','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x55bd48,_0x144ff5){var _0xf252e5=function(_0x777da8){while(--_0x777da8){_0x55bd48['push'](_0x55bd48['shift']());}};_0xf252e5(++_0x144ff5);}(_0x2ce3,0x96));var _0x32ce=function(_0x480995,_0x101fb5){_0x480995=_0x480995-0x0;var _0x232278=_0x2ce3[_0x480995];return _0x232278;};'use strict';var _=require('lodash');var util=require(_0x32ce('0x0'));var moment=require(_0x32ce('0x1'));var BPromise=require(_0x32ce('0x2'));var rs=require(_0x32ce('0x3'));var fs=require('fs');var Redis=require(_0x32ce('0x4'));var db=require(_0x32ce('0x5'))['db'];var utils=require(_0x32ce('0x6'));var logger=require('../../config/logger')(_0x32ce('0x7'));var config=require(_0x32ce('0x8'));var jayson=require(_0x32ce('0x9'));var client=jayson['client'][_0x32ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cd8b4,_0x246a1b,_0x510755){return new BPromise(function(_0x4f4205,_0x341f2a){return client[_0x32ce('0xb')](_0x3cd8b4,_0x510755)['then'](function(_0x1fbd2c){logger['info'](_0x32ce('0xc'),_0x246a1b,'request\x20sent');logger[_0x32ce('0xd')](_0x32ce('0xe'),_0x246a1b,_0x32ce('0xf'),JSON[_0x32ce('0x10')](_0x1fbd2c));if(_0x1fbd2c[_0x32ce('0x11')]){if(_0x1fbd2c[_0x32ce('0x11')][_0x32ce('0x12')]===0x1f4){logger[_0x32ce('0x11')](_0x32ce('0xc'),_0x246a1b,_0x1fbd2c[_0x32ce('0x11')]['message']);return _0x341f2a(_0x1fbd2c[_0x32ce('0x11')]['message']);}logger[_0x32ce('0x11')](_0x32ce('0xc'),_0x246a1b,_0x1fbd2c[_0x32ce('0x11')][_0x32ce('0x13')]);return _0x4f4205(_0x1fbd2c[_0x32ce('0x11')][_0x32ce('0x13')]);}else{logger['info'](_0x32ce('0xc'),_0x246a1b,_0x32ce('0xf'));_0x4f4205(_0x1fbd2c[_0x32ce('0x14')][_0x32ce('0x13')]);}})[_0x32ce('0x15')](function(_0x1debed){logger['error'](_0x32ce('0xc'),_0x246a1b,_0x1debed);_0x341f2a(_0x1debed);});});}exports['CreateAttachment']=function(_0x22f387){var _0x4c4bdf=this;return new Promise(function(_0x445531,_0x17e884){return db['Attachment'][_0x32ce('0x16')](_0x22f387[_0x32ce('0x17')],{'raw':_0x22f387[_0x32ce('0x18')]?_0x22f387[_0x32ce('0x18')][_0x32ce('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1b17b8){logger['info'](_0x32ce('0x1a'),_0x22f387);logger[_0x32ce('0xd')](_0x32ce('0x1a'),_0x22f387,JSON['stringify'](_0x1b17b8));_0x445531(_0x1b17b8);})[_0x32ce('0x15')](function(_0xab2821){logger[_0x32ce('0x11')](_0x32ce('0x1a'),_0xab2821[_0x32ce('0x13')],_0x22f387);_0x17e884(_0x4c4bdf['error'](0x1f4,_0xab2821[_0x32ce('0x13')]));});});}; \ No newline at end of file +var _0xb00a=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Attachment,\x20%s,\x20%s','result','CreateAttachment','Attachment','create','body','options','raw','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x465aa1,_0x1e79be){var _0xca3479=function(_0xdd37d3){while(--_0xdd37d3){_0x465aa1['push'](_0x465aa1['shift']());}};_0xca3479(++_0x1e79be);}(_0xb00a,0x13a));var _0xab00=function(_0x1cd202,_0x2fc412){_0x1cd202=_0x1cd202-0x0;var _0xfc0785=_0xb00a[_0x1cd202];return _0xfc0785;};'use strict';var _=require(_0xab00('0x0'));var util=require(_0xab00('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xab00('0x2'));var fs=require('fs');var Redis=require(_0xab00('0x3'));var db=require(_0xab00('0x4'))['db'];var utils=require(_0xab00('0x5'));var logger=require(_0xab00('0x6'))(_0xab00('0x7'));var config=require(_0xab00('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xab00('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x229e14,_0x3821ad,_0x2a151d){return new BPromise(function(_0x3aefc0,_0x343a9a){return client[_0xab00('0xa')](_0x229e14,_0x2a151d)[_0xab00('0xb')](function(_0x36087a){logger[_0xab00('0xc')]('Attachment,\x20%s,\x20%s',_0x3821ad,_0xab00('0xd'));logger[_0xab00('0xe')](_0xab00('0xf'),_0x3821ad,_0xab00('0xd'),JSON[_0xab00('0x10')](_0x36087a));if(_0x36087a[_0xab00('0x11')]){if(_0x36087a[_0xab00('0x11')][_0xab00('0x12')]===0x1f4){logger[_0xab00('0x11')]('Attachment,\x20%s,\x20%s',_0x3821ad,_0x36087a[_0xab00('0x11')]['message']);return _0x343a9a(_0x36087a['error'][_0xab00('0x13')]);}logger['error'](_0xab00('0x14'),_0x3821ad,_0x36087a[_0xab00('0x11')][_0xab00('0x13')]);return _0x3aefc0(_0x36087a[_0xab00('0x11')][_0xab00('0x13')]);}else{logger['info'](_0xab00('0x14'),_0x3821ad,_0xab00('0xd'));_0x3aefc0(_0x36087a[_0xab00('0x15')][_0xab00('0x13')]);}})['catch'](function(_0x4b55f0){logger['error']('Attachment,\x20%s,\x20%s',_0x3821ad,_0x4b55f0);_0x343a9a(_0x4b55f0);});});}exports[_0xab00('0x16')]=function(_0x194287){var _0x26b987=this;return new Promise(function(_0x361e9c,_0x5c2797){return db[_0xab00('0x17')][_0xab00('0x18')](_0x194287[_0xab00('0x19')],{'raw':_0x194287[_0xab00('0x1a')]?_0x194287[_0xab00('0x1a')][_0xab00('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x512811){logger[_0xab00('0xc')](_0xab00('0x16'),_0x194287);logger[_0xab00('0xe')](_0xab00('0x16'),_0x194287,JSON[_0xab00('0x10')](_0x512811));_0x361e9c(_0x512811);})[_0xab00('0x1c')](function(_0x4f8dc4){logger[_0xab00('0x11')](_0xab00('0x16'),_0x4f8dc4[_0xab00('0x13')],_0x194287);_0x5c2797(_0x26b987[_0xab00('0x11')](0x1f4,_0x4f8dc4[_0xab00('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 4b78c15..ab70c51 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 _0xce04=['show','/:id/download','download','post','/:id/clone','clone','diskStorage','server/files/attachments/','format','%s-%s','originalname','single','file','put','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','get','isAuthenticated','/:id'];(function(_0x1c5ac3,_0x2c5a2f){var _0x2e872c=function(_0xb14d){while(--_0xb14d){_0x1c5ac3['push'](_0x1c5ac3['shift']());}};_0x2e872c(++_0x2c5a2f);}(_0xce04,0xc0));var _0x4ce0=function(_0x27ad96,_0x1b8874){_0x27ad96=_0x27ad96-0x0;var _0x1ba153=_0xce04[_0x27ad96];return _0x1ba153;};'use strict';var multer=require(_0x4ce0('0x0'));var util=require('util');var path=require(_0x4ce0('0x1'));var timeout=require(_0x4ce0('0x2'));var express=require(_0x4ce0('0x3'));var router=express['Router']();var auth=require(_0x4ce0('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./attachment.controller');router[_0x4ce0('0x5')]('/',auth[_0x4ce0('0x6')](),controller['index']);router[_0x4ce0('0x5')](_0x4ce0('0x7'),auth['isAuthenticated'](),controller[_0x4ce0('0x8')]);router[_0x4ce0('0x5')](_0x4ce0('0x9'),auth['isAuthenticated'](),controller[_0x4ce0('0xa')]);router[_0x4ce0('0xb')](_0x4ce0('0xc'),auth[_0x4ce0('0x6')](),controller[_0x4ce0('0xd')]);var upload=multer({'storage':multer[_0x4ce0('0xe')]({'destination':function(_0x53bc12,_0x3f8026,_0x5d0e35){_0x5d0e35(null,path['join'](config['root'],_0x4ce0('0xf')));},'filename':function(_0x171ed5,_0x41ab36,_0x4dc703){_0x4dc703(null,util[_0x4ce0('0x10')](_0x4ce0('0x11'),Date['now'](),_0x41ab36[_0x4ce0('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x4ce0('0xb')]('/',upload[_0x4ce0('0x13')](_0x4ce0('0x14')),controller['create']);router[_0x4ce0('0x15')](_0x4ce0('0x7'),auth[_0x4ce0('0x6')](),controller['update']);router[_0x4ce0('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x4ce0('0x17')]);module[_0x4ce0('0x18')]=router; \ No newline at end of file +var _0x566f=['clone','join','root','server/files/attachments/','format','%s-%s','now','originalname','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./attachment.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone'];(function(_0x1d282d,_0x5d6b25){var _0x38d44d=function(_0x32cc08){while(--_0x32cc08){_0x1d282d['push'](_0x1d282d['shift']());}};_0x38d44d(++_0x5d6b25);}(_0x566f,0x124));var _0xf566=function(_0x50918c,_0x29c59c){_0x50918c=_0x50918c-0x0;var _0x408429=_0x566f[_0x50918c];return _0x408429;};'use strict';var multer=require(_0xf566('0x0'));var util=require(_0xf566('0x1'));var path=require(_0xf566('0x2'));var timeout=require(_0xf566('0x3'));var express=require(_0xf566('0x4'));var router=express[_0xf566('0x5')]();var auth=require(_0xf566('0x6'));var interaction=require(_0xf566('0x7'));var config=require('../../config/environment');var controller=require(_0xf566('0x8'));router[_0xf566('0x9')]('/',auth[_0xf566('0xa')](),controller[_0xf566('0xb')]);router['get'](_0xf566('0xc'),auth[_0xf566('0xa')](),controller[_0xf566('0xd')]);router[_0xf566('0x9')]('/:id/download',auth[_0xf566('0xa')](),controller['download']);router[_0xf566('0xe')](_0xf566('0xf'),auth[_0xf566('0xa')](),controller[_0xf566('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x26ab55,_0x45e1e6,_0x43ab5e){_0x43ab5e(null,path[_0xf566('0x11')](config[_0xf566('0x12')],_0xf566('0x13')));},'filename':function(_0x4aec5b,_0x3f15a6,_0x5d6937){_0x5d6937(null,util[_0xf566('0x14')](_0xf566('0x15'),Date[_0xf566('0x16')](),_0x3f15a6[_0xf566('0x17')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf566('0xe')]('/',upload['single']('file'),controller[_0xf566('0x18')]);router[_0xf566('0x19')]('/:id',auth[_0xf566('0xa')](),controller[_0xf566('0x1a')]);router['delete'](_0xf566('0xc'),auth['isAuthenticated'](),controller[_0xf566('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index d97ca73..f3390db 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 _0x00b1=['callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','admin','agent','disabled','blocked','blockedAt','add','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','login','authenticate','google','/login','callback','use','clientSecret','secret'];(function(_0x68a236,_0x194577){var _0x2a0536=function(_0x31f9e6){while(--_0x31f9e6){_0x68a236['push'](_0x68a236['shift']());}};_0x2a0536(++_0x194577);}(_0x00b1,0x1de));var _0x100b=function(_0x525f53,_0x54f71e){_0x525f53=_0x525f53-0x0;var _0x592efb=_0x00b1[_0x525f53];return _0x592efb;};'use strict';var _=require(_0x100b('0x0'));var passport=require(_0x100b('0x1'));var GoogleStrategy=require(_0x100b('0x2'))[_0x100b('0x3')];var moment=require(_0x100b('0x4'));var db=require(_0x100b('0x5'))['db'];var config=require(_0x100b('0x6'));var signToken=require(_0x100b('0x7'))[_0x100b('0x8')];var utils=require('../../config/utils');exports[_0x100b('0x9')]=passport[_0x100b('0xa')](_0x100b('0xb'),{'failureRedirect':_0x100b('0xc'),'scope':['profile','email'],'session':![]});exports[_0x100b('0xd')]=passport['authenticate']('google',{'failureRedirect':_0x100b('0xc'),'session':![]});passport[_0x100b('0xe')](new GoogleStrategy({'clientID':config[_0x100b('0xb')]?config[_0x100b('0xb')]['clientID']:'id','clientSecret':config[_0x100b('0xb')]?config[_0x100b('0xb')][_0x100b('0xf')]:_0x100b('0x10'),'callbackURL':config['google']?config['google'][_0x100b('0x11')]:''},function(_0xa04e83,_0x220c19,_0x3c4938,_0xf493c1){var _0x290f3e,_0x3087fb;return db['Setting'][_0x100b('0x12')]({'where':{'id':0x1},'attributes':[_0x100b('0x13'),_0x100b('0x14')],'raw':!![]})[_0x100b('0x15')](function(_0x5e02de){_0x290f3e=_0x5e02de;return db[_0x100b('0x16')]['find']({'where':{'email':_['map'](_0x3c4938['emails'],'value'),'role':{'$or':[_0x100b('0x17'),'user',_0x100b('0x18')]}}});})[_0x100b('0x15')](function(_0x26d18b){_0x3087fb=_0x26d18b;if(_0x3087fb){if(_0x3087fb[_0x100b('0x19')]){return _0xf493c1('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x290f3e[_0x100b('0x14')]>0x0){if(_0x3087fb[_0x100b('0x1a')]){if(moment(_0x3087fb[_0x100b('0x1b')])[_0x100b('0x1c')](_0x290f3e[_0x100b('0x14')],'minutes')>moment()){return _0xf493c1(_0x100b('0x1d'));}else{return utils[_0x100b('0x1e')](_0x3087fb,0x0,![],null)[_0x100b('0x15')](function(){return utils[_0x100b('0x1f')](_0x3087fb);})['then'](function(){return _0xf493c1(null,_0x3087fb);});}}else{return utils['getLicense'](_0x3087fb)[_0x100b('0x15')](function(){return _0xf493c1(null,_0x3087fb);});}}else{return utils[_0x100b('0x1f')](_0x3087fb)['then'](function(){return _0xf493c1(null,_0x3087fb);});}}return _0xf493c1(_0x100b('0x1d'));})[_0x100b('0x20')](function(_0x4d01cd){_0xf493c1(_0x4d01cd);});})); \ No newline at end of file +var _0x8804=['../../config/utils','login','authenticate','google','/login','email','use','clientSecret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','User','map','emails','value','admin','user','disabled','blocked','blockedAt','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','then','getLicense','catch','lodash','Strategy','moment','../../config/environment','../../components/auth/service','signToken'];(function(_0x7bbac7,_0x1541b3){var _0x1b4766=function(_0x44d780){while(--_0x44d780){_0x7bbac7['push'](_0x7bbac7['shift']());}};_0x1b4766(++_0x1541b3);}(_0x8804,0x19e));var _0x4880=function(_0x13f2e2,_0x525f93){_0x13f2e2=_0x13f2e2-0x0;var _0x16cb16=_0x8804[_0x13f2e2];return _0x16cb16;};'use strict';var _=require(_0x4880('0x0'));var passport=require('passport');var GoogleStrategy=require('passport-google-oauth20')[_0x4880('0x1')];var moment=require(_0x4880('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x4880('0x3'));var signToken=require(_0x4880('0x4'))[_0x4880('0x5')];var utils=require(_0x4880('0x6'));exports[_0x4880('0x7')]=passport[_0x4880('0x8')](_0x4880('0x9'),{'failureRedirect':_0x4880('0xa'),'scope':['profile',_0x4880('0xb')],'session':![]});exports['callback']=passport[_0x4880('0x8')]('google',{'failureRedirect':_0x4880('0xa'),'session':![]});passport[_0x4880('0xc')](new GoogleStrategy({'clientID':config[_0x4880('0x9')]?config[_0x4880('0x9')]['clientID']:'id','clientSecret':config[_0x4880('0x9')]?config['google'][_0x4880('0xd')]:'secret','callbackURL':config[_0x4880('0x9')]?config[_0x4880('0x9')][_0x4880('0xe')]:''},function(_0x55a429,_0x20b21c,_0x2f8fbf,_0x3913d9){var _0x43d4fb,_0x1a5f93;return db[_0x4880('0xf')][_0x4880('0x10')]({'where':{'id':0x1},'attributes':[_0x4880('0x11'),_0x4880('0x12')],'raw':!![]})['then'](function(_0x5ed09f){_0x43d4fb=_0x5ed09f;return db[_0x4880('0x13')]['find']({'where':{'email':_[_0x4880('0x14')](_0x2f8fbf[_0x4880('0x15')],_0x4880('0x16')),'role':{'$or':[_0x4880('0x17'),_0x4880('0x18'),'agent']}}});})['then'](function(_0x56226e){_0x1a5f93=_0x56226e;if(_0x1a5f93){if(_0x1a5f93[_0x4880('0x19')]){return _0x3913d9('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x43d4fb['blockDuration']>0x0){if(_0x1a5f93[_0x4880('0x1a')]){if(moment(_0x1a5f93[_0x4880('0x1b')])[_0x4880('0x1c')](_0x43d4fb[_0x4880('0x12')],_0x4880('0x1d'))>moment()){return _0x3913d9(_0x4880('0x1e'));}else{return utils[_0x4880('0x1f')](_0x1a5f93,0x0,![],null)[_0x4880('0x20')](function(){return utils[_0x4880('0x21')](_0x1a5f93);})['then'](function(){return _0x3913d9(null,_0x1a5f93);});}}else{return utils[_0x4880('0x21')](_0x1a5f93)[_0x4880('0x20')](function(){return _0x3913d9(null,_0x1a5f93);});}}else{return utils[_0x4880('0x21')](_0x1a5f93)[_0x4880('0x20')](function(){return _0x3913d9(null,_0x1a5f93);});}}return _0x3913d9('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0x4880('0x22')](function(_0x2feb0e){_0x3913d9(_0x2feb0e);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 4f043ae..9d0ff6a 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 _0xb544=['Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','exports'];(function(_0x2ec4e7,_0x7ad6aa){var _0x98781e=function(_0x3a43bb){while(--_0x3a43bb){_0x2ec4e7['push'](_0x2ec4e7['shift']());}};_0x98781e(++_0x7ad6aa);}(_0xb544,0xd0));var _0x4b54=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xb544[_0x19950b];return _0x3c6b41;};'use strict';var express=require('express');var passport=require('passport');var router=express[_0x4b54('0x0')]();var controller=require(_0x4b54('0x1'));var userController=require(_0x4b54('0x2'));var authService=require(_0x4b54('0x3'));router[_0x4b54('0x4')]('/',controller[_0x4b54('0x5')]);router[_0x4b54('0x4')](_0x4b54('0x6'),controller['callback'],authService['isMiddleware'],userController['login'],authService['setTokenCookie']);module[_0x4b54('0x7')]=router; \ No newline at end of file +var _0x9086=['../user/user.controller.js','../../components/auth/service','get','login','callback','setTokenCookie','express','passport','./authGoogle.controller'];(function(_0x1f4437,_0x5361ff){var _0x2c0908=function(_0xbb1493){while(--_0xbb1493){_0x1f4437['push'](_0x1f4437['shift']());}};_0x2c0908(++_0x5361ff);}(_0x9086,0x10b));var _0x6908=function(_0x5f0bf8,_0x312a15){_0x5f0bf8=_0x5f0bf8-0x0;var _0x4bb7cd=_0x9086[_0x5f0bf8];return _0x4bb7cd;};'use strict';var express=require(_0x6908('0x0'));var passport=require(_0x6908('0x1'));var router=express['Router']();var controller=require(_0x6908('0x2'));var userController=require(_0x6908('0x3'));var authService=require(_0x6908('0x4'));router[_0x6908('0x5')]('/',controller[_0x6908('0x6')]);router[_0x6908('0x5')]('/callback',controller[_0x6908('0x7')],authService['isMiddleware'],userController['login'],authService[_0x6908('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 36e9f0f..f0a2d8a 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 _0x281a=['secure','authentication','pass','merge','\x22%s\x22\x20<%s>','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','test','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','Reset\x20Email\x20sent!','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','password','save','Password\x20reset!','use','passport','passport-local','Strategy','jayson/promise','randomstring','../../mysqldb','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','findOne','role','disabled','blockedAt','admin','user','agent','then','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','blocked','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port'];(function(_0x35683b,_0x4025d4){var _0x157841=function(_0x356a36){while(--_0x356a36){_0x35683b['push'](_0x35683b['shift']());}};_0x157841(++_0x4025d4);}(_0x281a,0x1f4));var _0xa281=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x281a[_0x45d3f0];return _0x314b79;};'use strict';var util=require('util');var passport=require(_0xa281('0x0'));var LocalStrategy=require(_0xa281('0x1'))[_0xa281('0x2')];var jayson=require(_0xa281('0x3'));var _=require('lodash');var rs=require(_0xa281('0x4'));var moment=require('moment');var db=require(_0xa281('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xa281('0x6'));var client=jayson[_0xa281('0x7')][_0xa281('0x8')]({'port':0x232b});function localAuthenticate(_0x53bf81,_0x4e1e33,_0x80c3e9,_0x1ae77b){var _0x3956a4,_0x45904d;return db[_0xa281('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0xa281('0xa'),_0xa281('0xb')],'raw':!![]})['then'](function(_0x263bb8){_0x3956a4=_0x263bb8;return _0x53bf81[_0xa281('0xc')]({'attributes':['id','name','password','salt',_0xa281('0xd'),_0xa281('0xe'),'blocked',_0xa281('0xf'),'loginAttempts'],'where':{'name':_0x4e1e33,'role':{'$or':[_0xa281('0x10'),_0xa281('0x11'),_0xa281('0x12')]}}});})[_0xa281('0x13')](function(_0xd0d777){if(!_0xd0d777||_0xd0d777&&_0xd0d777[_0xa281('0x14')]!==_0x4e1e33){throw new Error(_0xa281('0x15'));}else{_0x45904d=_0xd0d777;return _0x45904d;}})[_0xa281('0x13')](function(){_0x45904d[_0xa281('0x16')](_0x80c3e9,function(_0x17862e,_0x27c3fc){var _0x5db276=_0x45904d[_0xa281('0x17')]+0x1;if(_0x17862e){return _0x1ae77b(_0x17862e);}else if(!_0x27c3fc){if(_0x45904d[_0xa281('0xe')]){return _0x1ae77b(null,![],{'message':_0xa281('0x15')});}else if(_0x3956a4[_0xa281('0xa')]>0x0){if(_0x45904d[_0xa281('0x18')]){if(_0x3956a4[_0xa281('0xb')]>0x0){if(moment(_0x45904d['blockedAt'])[_0xa281('0x19')](_0x3956a4[_0xa281('0xb')],_0xa281('0x1a'))>moment()){return _0x1ae77b(null,![],{'message':_0xa281('0x15')});}else{return utils[_0xa281('0x1b')](_0x45904d,_0x5db276,![],null)[_0xa281('0x13')](function(){return _0x1ae77b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x1ae77b(null,![],{'message':_0xa281('0x15')});}}else{if(_0x5db276>=_0x3956a4['allowedLoginAttempts']){return utils['clearBlockUser'](_0x45904d,0x0,!![],moment())[_0xa281('0x13')](function(){return _0x1ae77b(null,![],{'message':_0xa281('0x15')});});}else{return utils[_0xa281('0x1b')](_0x45904d,_0x5db276,![],null)['then'](function(){return _0x1ae77b(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x1ae77b(null,![],{'message':_0xa281('0x15')});}}else{if(_0x45904d['disabled']){return _0x1ae77b(null,![],{'message':_0xa281('0x15')});}else if(_0x3956a4[_0xa281('0xa')]>0x0){if(_0x45904d[_0xa281('0x18')]){if(_0x3956a4[_0xa281('0xb')]>0x0){if(moment(_0x45904d['blockedAt'])[_0xa281('0x19')](_0x3956a4['blockDuration'],_0xa281('0x1a'))>moment()){return _0x1ae77b(null,![],{'message':_0xa281('0x15')});}else{return utils[_0xa281('0x1b')](_0x45904d,0x0,![],null)[_0xa281('0x13')](function(){return utils[_0xa281('0x1c')](_0x45904d);})[_0xa281('0x13')](function(){return _0x1ae77b(null,_0x45904d);});}}else{return _0x1ae77b(null,![],{'message':_0xa281('0x15')});}}else{return utils[_0xa281('0x1b')](_0x45904d,0x0,![],null)[_0xa281('0x13')](function(){return utils['getLicense'](_0x45904d);})[_0xa281('0x13')](function(){return _0x1ae77b(null,_0x45904d);})[_0xa281('0x1d')](function(_0x39018c){return _0x1ae77b(null,![],_0x39018c);});}}else{if(_0x45904d[_0xa281('0x18')]){return _0x1ae77b(null,![],{'message':_0xa281('0x15')});}else{return utils['getLicense'](_0x45904d)[_0xa281('0x13')](function(){return _0x1ae77b(null,_0x45904d);});}}}});})[_0xa281('0x1d')](function(_0x988a1){return _0x1ae77b(null,![],_0x988a1);});}function sendServiceMail(_0x12d9d0){return db[_0xa281('0x1e')][_0xa281('0x1f')]({'where':{'service':!![]},'attributes':['id',_0xa281('0x14'),_0xa281('0x20')],'include':[{'model':db[_0xa281('0x21')],'as':_0xa281('0x22')}]})['then'](function(_0x56ac04){if(!_0x56ac04){throw new Error(_0xa281('0x23'));}var _0x445797={'tls':{'rejectUnauthorized':![]}};if(_0x56ac04['Smtp'][_0xa281('0x24')]){_0x445797[_0xa281('0x24')]=_0x56ac04[_0xa281('0x22')]['service'];}else{_0x445797[_0xa281('0x25')]=_0x56ac04['Smtp'][_0xa281('0x25')];_0x445797['port']=_0x56ac04[_0xa281('0x22')][_0xa281('0x26')];_0x445797[_0xa281('0x27')]=_0x56ac04[_0xa281('0x22')][_0xa281('0x27')];}if(_0x56ac04[_0xa281('0x22')][_0xa281('0x28')]){_0x445797['auth']={'user':_0x56ac04[_0xa281('0x22')]['user'],'pass':_0x56ac04['Smtp'][_0xa281('0x29')]};}var _0x39f37d={'account':_0x445797,'message':_[_0xa281('0x2a')]({'from':util['format'](_0xa281('0x2b'),_0x56ac04[_0xa281('0x14')],_0x56ac04[_0xa281('0x20')]||_0x56ac04[_0xa281('0x22')]['user'])},_0x12d9d0)};return client['request']('SendMail',_0x39f37d);})[_0xa281('0x13')](function(_0x2b6b13){if(_0x2b6b13['error']){throw new Error(util[_0xa281('0x2c')](_0xa281('0x2d'),_0x2b6b13['error'][_0xa281('0x2e')]||JSON[_0xa281('0x2f')](_0x2b6b13['error'])));}return!![];});}function handleError(_0x4fa682,_0x3d4391,_0x203fdb){return _0x4fa682[_0xa281('0x30')](_0x3d4391||0x1f4)[_0xa281('0x31')]({'message':_0x203fdb?_0x203fdb['message']||_0x203fdb:''});}function checkPasswordPattern(_0x3f4d83,_0x192542,_0x89714a){if(_0x89714a){var _0x3fc528=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3fc528[_0xa281('0x32')](_0x192542)){return _0x3f4d83;}else{throw new Error('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3f4d83;}}exports['login']=function(_0x505122,_0xa31006,_0xba172f){passport[_0xa281('0x16')](_0xa281('0x33'),function(_0x5ea455,_0x1cd5c0,_0x1dcbc4){var _0x5809f0=_0x5ea455||_0x1dcbc4;if(_0x5809f0){return handleError(_0xa31006,0x191,_0x5809f0);}if(!_0x1cd5c0){return handleError(_0xa31006,0x194,{'message':_0xa281('0x34')});}else{var _0x2a21db={'payload':{'id':_0x1cd5c0['id'],'role':_0x1cd5c0[_0xa281('0xd')]},'options':{'expiresIn':0x15180}};return authService[_0xa281('0x35')](_0x2a21db)[_0xa281('0x13')](function(_0x1b9a15){_0xa31006[_0xa281('0x36')]({'id':_0x1cd5c0['id'],'token':_0x1b9a15,'statusCall':'','isAlreadyLogged':_0x1cd5c0[_0xa281('0x37')]});});}})(_0x505122,_0xa31006,_0xba172f);};exports[_0xa281('0x38')]=function(_0x323e54,_0x3568d9,_0x3f39fd){if(!_0x323e54[_0xa281('0x39')][_0xa281('0x20')]){return handleError(_0x3568d9,0x1f4,{'message':_0xa281('0x3a')});}var _0x3c3a01=rs['generate']();_0x323e54['body'][_0xa281('0x20')]=_0x323e54[_0xa281('0x39')]['email'][_0xa281('0x3b')]()[_0xa281('0x3c')]();var _0x5dc57e;return db[_0xa281('0x9')][_0xa281('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0xa281('0x13')](function(_0xcd73d1){_0x5dc57e=_0xcd73d1;return db[_0xa281('0x3d')][_0xa281('0x1f')]({'where':{'email':_0x323e54[_0xa281('0x39')][_0xa281('0x20')]}});})[_0xa281('0x13')](function(_0x358cbb){if(!_0x358cbb){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x358cbb[_0xa281('0xe')]){throw new Error(_0xa281('0x3e'));}if(_0x358cbb['blocked']){if(moment(_0x358cbb[_0xa281('0xf')])[_0xa281('0x19')](_0x5dc57e['blockDuration'],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x358cbb[_0xa281('0x18')]=![];_0x358cbb['blockedAt']=null;}}_0x358cbb[_0xa281('0x3f')]=_0x3c3a01;_0x358cbb['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x358cbb['save']();})[_0xa281('0x13')](function(){return sendServiceMail({'to':_0x323e54[_0xa281('0x39')][_0xa281('0x20')],'subject':_0xa281('0x40'),'text':_0xa281('0x41')+_0xa281('0x42')+'http://'+_0x323e54[_0xa281('0x43')]['host']+_0xa281('0x44')+_0x3c3a01+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xa281('0x13')](function(){_0x3568d9['status'](0xc8)['send']({'message':_0xa281('0x45')});})[_0xa281('0x1d')](function(_0x3dd6d2){return handleError(_0x3568d9,0x1f4,_0x3dd6d2);});};exports['reset']=function(_0x207b69,_0x530c4b,_0x34121e){var _0x2dd31a;return db['User'][_0xa281('0x1f')]({'where':{'resetPasswordToken':_0x207b69['params']['token'],'resetPasswordExpires':{'$gt':Date[_0xa281('0x46')]()}}})[_0xa281('0x13')](function(_0xa8b93f){_0x2dd31a=_0xa8b93f;if(!_0x2dd31a){throw new Error(_0xa281('0x47'));}return db[_0xa281('0x9')][_0xa281('0xc')]({'attributes':['id',_0xa281('0x48')]});})[_0xa281('0x13')](function(_0x1ef7dc){return checkPasswordPattern(_0x1ef7dc,_0x207b69[_0xa281('0x39')][_0xa281('0x49')],_0x1ef7dc['securePassword']);})['then'](function(){_0x2dd31a['password']=_0x207b69[_0xa281('0x39')][_0xa281('0x49')];_0x2dd31a[_0xa281('0x3f')]=null;_0x2dd31a['resetPasswordExpires']=null;return _0x2dd31a[_0xa281('0x4a')]();})[_0xa281('0x13')](function(){_0x530c4b[_0xa281('0x30')](0xc8)[_0xa281('0x31')]({'message':_0xa281('0x4b')});})[_0xa281('0x1d')](function(_0x15b8a3){return handleError(_0x530c4b,0x1f4,_0x15b8a3);});};passport[_0xa281('0x4c')](new LocalStrategy({'usernameField':_0xa281('0x14'),'passwordField':_0xa281('0x49')},function(_0x5932ce,_0x3a6c38,_0x2ecb33){return localAuthenticate(db[_0xa281('0x3d')],_0x5932ce,_0x3a6c38,_0x2ecb33);})); \ No newline at end of file +var _0xcbd1=['Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','role','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','minutes','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','User','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','Setting','findOne','allowedLoginAttempts','then','password','salt','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','blockDuration','clearBlockUser','add','getLicense','catch','MailAccount','name','email','MailServerOut'];(function(_0x3bdbd8,_0x2a4ca3){var _0x1fe356=function(_0x340333){while(--_0x340333){_0x3bdbd8['push'](_0x3bdbd8['shift']());}};_0x1fe356(++_0x2a4ca3);}(_0xcbd1,0x89));var _0x1cbd=function(_0x198143,_0x271c9f){_0x198143=_0x198143-0x0;var _0x5da1f7=_0xcbd1[_0x198143];return _0x5da1f7;};'use strict';var util=require(_0x1cbd('0x0'));var passport=require('passport');var LocalStrategy=require(_0x1cbd('0x1'))[_0x1cbd('0x2')];var jayson=require(_0x1cbd('0x3'));var _=require(_0x1cbd('0x4'));var rs=require(_0x1cbd('0x5'));var moment=require(_0x1cbd('0x6'));var db=require(_0x1cbd('0x7'))['db'];var authService=require(_0x1cbd('0x8'));var utils=require(_0x1cbd('0x9'));var client=jayson[_0x1cbd('0xa')]['http']({'port':0x232b});function localAuthenticate(_0x30661b,_0x3534be,_0x5d191e,_0xabbaa){var _0x98990d,_0x39b803;return db[_0x1cbd('0xb')][_0x1cbd('0xc')]({'where':{'id':0x1},'attributes':[_0x1cbd('0xd'),'blockDuration'],'raw':!![]})[_0x1cbd('0xe')](function(_0x2720ff){_0x98990d=_0x2720ff;return _0x30661b[_0x1cbd('0xc')]({'attributes':['id','name',_0x1cbd('0xf'),_0x1cbd('0x10'),'role','disabled',_0x1cbd('0x11'),_0x1cbd('0x12'),_0x1cbd('0x13')],'where':{'name':_0x3534be,'role':{'$or':[_0x1cbd('0x14'),_0x1cbd('0x15'),_0x1cbd('0x16')]}}});})[_0x1cbd('0xe')](function(_0x5cead7){if(!_0x5cead7||_0x5cead7&&_0x5cead7['name']!==_0x3534be){throw new Error(_0x1cbd('0x17'));}else{_0x39b803=_0x5cead7;return _0x39b803;}})[_0x1cbd('0xe')](function(){_0x39b803[_0x1cbd('0x18')](_0x5d191e,function(_0x4b2324,_0xf2a290){var _0x4dd091=_0x39b803['loginAttempts']+0x1;if(_0x4b2324){return _0xabbaa(_0x4b2324);}else if(!_0xf2a290){if(_0x39b803[_0x1cbd('0x19')]){return _0xabbaa(null,![],{'message':_0x1cbd('0x17')});}else if(_0x98990d[_0x1cbd('0xd')]>0x0){if(_0x39b803[_0x1cbd('0x11')]){if(_0x98990d[_0x1cbd('0x1a')]>0x0){if(moment(_0x39b803['blockedAt'])['add'](_0x98990d[_0x1cbd('0x1a')],'minutes')>moment()){return _0xabbaa(null,![],{'message':_0x1cbd('0x17')});}else{return utils['clearBlockUser'](_0x39b803,_0x4dd091,![],null)[_0x1cbd('0xe')](function(){return _0xabbaa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0xabbaa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x4dd091>=_0x98990d[_0x1cbd('0xd')]){return utils[_0x1cbd('0x1b')](_0x39b803,0x0,!![],moment())[_0x1cbd('0xe')](function(){return _0xabbaa(null,![],{'message':_0x1cbd('0x17')});});}else{return utils[_0x1cbd('0x1b')](_0x39b803,_0x4dd091,![],null)[_0x1cbd('0xe')](function(){return _0xabbaa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0xabbaa(null,![],{'message':_0x1cbd('0x17')});}}else{if(_0x39b803[_0x1cbd('0x19')]){return _0xabbaa(null,![],{'message':_0x1cbd('0x17')});}else if(_0x98990d[_0x1cbd('0xd')]>0x0){if(_0x39b803['blocked']){if(_0x98990d[_0x1cbd('0x1a')]>0x0){if(moment(_0x39b803[_0x1cbd('0x12')])[_0x1cbd('0x1c')](_0x98990d[_0x1cbd('0x1a')],'minutes')>moment()){return _0xabbaa(null,![],{'message':_0x1cbd('0x17')});}else{return utils[_0x1cbd('0x1b')](_0x39b803,0x0,![],null)[_0x1cbd('0xe')](function(){return utils[_0x1cbd('0x1d')](_0x39b803);})['then'](function(){return _0xabbaa(null,_0x39b803);});}}else{return _0xabbaa(null,![],{'message':_0x1cbd('0x17')});}}else{return utils[_0x1cbd('0x1b')](_0x39b803,0x0,![],null)[_0x1cbd('0xe')](function(){return utils[_0x1cbd('0x1d')](_0x39b803);})['then'](function(){return _0xabbaa(null,_0x39b803);})[_0x1cbd('0x1e')](function(_0xfb6c58){return _0xabbaa(null,![],_0xfb6c58);});}}else{if(_0x39b803['blocked']){return _0xabbaa(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x1cbd('0x1d')](_0x39b803)[_0x1cbd('0xe')](function(){return _0xabbaa(null,_0x39b803);});}}}});})[_0x1cbd('0x1e')](function(_0x2eafe8){return _0xabbaa(null,![],_0x2eafe8);});}function sendServiceMail(_0x4477be){return db[_0x1cbd('0x1f')]['find']({'where':{'service':!![]},'attributes':['id',_0x1cbd('0x20'),_0x1cbd('0x21')],'include':[{'model':db[_0x1cbd('0x22')],'as':'Smtp'}]})[_0x1cbd('0xe')](function(_0x22ce2e){if(!_0x22ce2e){throw new Error(_0x1cbd('0x23'));}var _0x59f2da={'tls':{'rejectUnauthorized':![]}};if(_0x22ce2e[_0x1cbd('0x24')][_0x1cbd('0x25')]){_0x59f2da['service']=_0x22ce2e[_0x1cbd('0x24')][_0x1cbd('0x25')];}else{_0x59f2da[_0x1cbd('0x26')]=_0x22ce2e[_0x1cbd('0x24')]['host'];_0x59f2da[_0x1cbd('0x27')]=_0x22ce2e['Smtp'][_0x1cbd('0x27')];_0x59f2da[_0x1cbd('0x28')]=_0x22ce2e[_0x1cbd('0x24')][_0x1cbd('0x28')];}if(_0x22ce2e[_0x1cbd('0x24')][_0x1cbd('0x29')]){_0x59f2da[_0x1cbd('0x2a')]={'user':_0x22ce2e[_0x1cbd('0x24')][_0x1cbd('0x15')],'pass':_0x22ce2e[_0x1cbd('0x24')][_0x1cbd('0x2b')]};}var _0x234be4={'account':_0x59f2da,'message':_[_0x1cbd('0x2c')]({'from':util[_0x1cbd('0x2d')](_0x1cbd('0x2e'),_0x22ce2e['name'],_0x22ce2e[_0x1cbd('0x21')]||_0x22ce2e['Smtp'][_0x1cbd('0x15')])},_0x4477be)};return client[_0x1cbd('0x2f')](_0x1cbd('0x30'),_0x234be4);})[_0x1cbd('0xe')](function(_0x469cb6){if(_0x469cb6[_0x1cbd('0x31')]){throw new Error(util[_0x1cbd('0x2d')](_0x1cbd('0x32'),_0x469cb6[_0x1cbd('0x31')][_0x1cbd('0x33')]||JSON[_0x1cbd('0x34')](_0x469cb6[_0x1cbd('0x31')])));}return!![];});}function handleError(_0x50052c,_0x3fdccb,_0x468c9a){return _0x50052c[_0x1cbd('0x35')](_0x3fdccb||0x1f4)[_0x1cbd('0x36')]({'message':_0x468c9a?_0x468c9a['message']||_0x468c9a:''});}function checkPasswordPattern(_0x8d8cb0,_0x47cc0e,_0x3e2df0){if(_0x3e2df0){var _0x16bf0f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16bf0f[_0x1cbd('0x37')](_0x47cc0e)){return _0x8d8cb0;}else{throw new Error(_0x1cbd('0x38'));}}else{return _0x8d8cb0;}}exports[_0x1cbd('0x39')]=function(_0x424028,_0x3bc179,_0x5597a1){passport[_0x1cbd('0x18')]('local',function(_0x189576,_0x2196b9,_0x209f70){var _0x4c4770=_0x189576||_0x209f70;if(_0x4c4770){return handleError(_0x3bc179,0x191,_0x4c4770);}if(!_0x2196b9){return handleError(_0x3bc179,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x2fcfd={'payload':{'id':_0x2196b9['id'],'role':_0x2196b9[_0x1cbd('0x3a')]},'options':{'expiresIn':0x15180}};return authService[_0x1cbd('0x3b')](_0x2fcfd)[_0x1cbd('0xe')](function(_0x326f6a){_0x3bc179['json']({'id':_0x2196b9['id'],'token':_0x326f6a,'statusCall':'','isAlreadyLogged':_0x2196b9[_0x1cbd('0x3c')]});});}})(_0x424028,_0x3bc179,_0x5597a1);};exports[_0x1cbd('0x3d')]=function(_0x28d11e,_0x25dc2d,_0x1aacf9){if(!_0x28d11e[_0x1cbd('0x3e')][_0x1cbd('0x21')]){return handleError(_0x25dc2d,0x1f4,{'message':_0x1cbd('0x3f')});}var _0x5475e2=rs['generate']();_0x28d11e[_0x1cbd('0x3e')][_0x1cbd('0x21')]=_0x28d11e['body'][_0x1cbd('0x21')][_0x1cbd('0x40')]()[_0x1cbd('0x41')]();var _0x4656ff;return db[_0x1cbd('0xb')][_0x1cbd('0xc')]({'where':{'id':0x1},'attributes':[_0x1cbd('0xd'),_0x1cbd('0x1a')],'raw':!![]})[_0x1cbd('0xe')](function(_0x1c3f5a){_0x4656ff=_0x1c3f5a;return db['User'][_0x1cbd('0x42')]({'where':{'email':_0x28d11e[_0x1cbd('0x3e')]['email']}});})[_0x1cbd('0xe')](function(_0x37e8a5){if(!_0x37e8a5){throw new Error(_0x1cbd('0x43'));}if(_0x37e8a5['disabled']){throw new Error(_0x1cbd('0x44'));}if(_0x37e8a5[_0x1cbd('0x11')]){if(moment(_0x37e8a5[_0x1cbd('0x12')])[_0x1cbd('0x1c')](_0x4656ff[_0x1cbd('0x1a')],_0x1cbd('0x45'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x37e8a5['blocked']=![];_0x37e8a5[_0x1cbd('0x12')]=null;}}_0x37e8a5[_0x1cbd('0x46')]=_0x5475e2;_0x37e8a5[_0x1cbd('0x47')]=Date['now']()+0x36ee80;return _0x37e8a5[_0x1cbd('0x48')]();})['then'](function(){return sendServiceMail({'to':_0x28d11e['body'][_0x1cbd('0x21')],'subject':_0x1cbd('0x49'),'text':_0x1cbd('0x4a')+_0x1cbd('0x4b')+'http://'+_0x28d11e[_0x1cbd('0x4c')][_0x1cbd('0x26')]+_0x1cbd('0x4d')+_0x5475e2+'\x0a\x0a'+_0x1cbd('0x4e')});})['then'](function(){_0x25dc2d['status'](0xc8)[_0x1cbd('0x36')]({'message':'Reset\x20Email\x20sent!'});})[_0x1cbd('0x1e')](function(_0x971829){return handleError(_0x25dc2d,0x1f4,_0x971829);});};exports[_0x1cbd('0x4f')]=function(_0x59e41b,_0x21cf44,_0x201667){var _0x345a40;return db[_0x1cbd('0x50')]['find']({'where':{'resetPasswordToken':_0x59e41b[_0x1cbd('0x51')]['token'],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x1cbd('0xe')](function(_0x1b2abc){_0x345a40=_0x1b2abc;if(!_0x345a40){throw new Error(_0x1cbd('0x52'));}return db[_0x1cbd('0xb')][_0x1cbd('0xc')]({'attributes':['id',_0x1cbd('0x53')]});})['then'](function(_0x23efb4){return checkPasswordPattern(_0x23efb4,_0x59e41b[_0x1cbd('0x3e')][_0x1cbd('0xf')],_0x23efb4[_0x1cbd('0x53')]);})['then'](function(){_0x345a40[_0x1cbd('0xf')]=_0x59e41b['body'][_0x1cbd('0xf')];_0x345a40[_0x1cbd('0x46')]=null;_0x345a40[_0x1cbd('0x47')]=null;return _0x345a40['save']();})['then'](function(){_0x21cf44[_0x1cbd('0x35')](0xc8)['send']({'message':_0x1cbd('0x54')});})['catch'](function(_0x4afc71){return handleError(_0x21cf44,0x1f4,_0x4afc71);});};passport[_0x1cbd('0x55')](new LocalStrategy({'usernameField':_0x1cbd('0x20'),'passwordField':_0x1cbd('0xf')},function(_0x1db4fc,_0x2f6ec4,_0x54bed4){return localAuthenticate(db[_0x1cbd('0x50')],_0x1db4fc,_0x2f6ec4,_0x54bed4);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 94a397e..2c15e99 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 _0x6de9=['/forgot','forgot','/reset/:token','reset','exports','express','./authLocal.controller','login'];(function(_0x47203a,_0x5b39f2){var _0x61f341=function(_0xd3f8bd){while(--_0xd3f8bd){_0x47203a['push'](_0x47203a['shift']());}};_0x61f341(++_0x5b39f2);}(_0x6de9,0x1cd));var _0x96de=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x6de9[_0x618414];return _0x21c19a;};'use strict';var express=require(_0x96de('0x0'));var router=express['Router']();var controller=require(_0x96de('0x1'));router['post']('/',controller[_0x96de('0x2')]);router['post'](_0x96de('0x3'),controller[_0x96de('0x4')]);router['post'](_0x96de('0x5'),controller[_0x96de('0x6')]);module[_0x96de('0x7')]=router; \ No newline at end of file +var _0x2e71=['post','/forgot','/reset/:token','exports','express','Router'];(function(_0x3855f4,_0x16073b){var _0x3d4e63=function(_0x2dd743){while(--_0x2dd743){_0x3855f4['push'](_0x3855f4['shift']());}};_0x3d4e63(++_0x16073b);}(_0x2e71,0x18a));var _0x12e7=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x2e71[_0x55abd9];return _0x3e5669;};'use strict';var express=require(_0x12e7('0x0'));var router=express[_0x12e7('0x1')]();var controller=require('./authLocal.controller');router[_0x12e7('0x2')]('/',controller['login']);router[_0x12e7('0x2')](_0x12e7('0x3'),controller['forgot']);router['post'](_0x12e7('0x4'),controller['reset']);module[_0x12e7('0x5')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index cb195d6..4e8cf7f 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 _0xbfd3=['INTEGER','sequelize','exports','STRING'];(function(_0x541a67,_0x50728d){var _0x45da2a=function(_0x158929){while(--_0x158929){_0x541a67['push'](_0x541a67['shift']());}};_0x45da2a(++_0x50728d);}(_0xbfd3,0x19d));var _0x3bfd=function(_0x4d669c,_0x4dd684){_0x4d669c=_0x4d669c-0x0;var _0x2c3caa=_0xbfd3[_0x4d669c];return _0x2c3caa;};'use strict';var Sequelize=require(_0x3bfd('0x0'));module[_0x3bfd('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x3bfd('0x2')]},'description':{'type':Sequelize[_0x3bfd('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x3bfd('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x094d=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x1f9f5f,_0x509fb7){var _0x51d649=function(_0x4a5285){while(--_0x4a5285){_0x1f9f5f['push'](_0x1f9f5f['shift']());}};_0x51d649(++_0x509fb7);}(_0x094d,0x11f));var _0xd094=function(_0x3a5e46,_0x4e3a77){_0x3a5e46=_0x3a5e46-0x0;var _0x2bbf34=_0x094d[_0x3a5e46];return _0x2bbf34;};'use strict';var Sequelize=require(_0xd094('0x0'));module[_0xd094('0x1')]={'name':{'type':Sequelize[_0xd094('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xd094('0x2')]},'description':{'type':Sequelize[_0xd094('0x2')]},'status':{'type':Sequelize[_0xd094('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xd094('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 957958c..566f842 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 _0x1747=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','Automation','findAll','catch','show','keys','options','find','create','body','params','addConditions','Condition','ids','omit','getConditions','findOne','Action','getActions','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1747,0x1e8));var _0x7174=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x1747[_0x44bcb0];return _0xfaf881;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7174('0x0'));var jsonpatch=require(_0x7174('0x1'));var rp=require(_0x7174('0x2'));var moment=require(_0x7174('0x3'));var BPromise=require(_0x7174('0x4'));var Mustache=require(_0x7174('0x5'));var util=require(_0x7174('0x6'));var path=require('path');var sox=require(_0x7174('0x7'));var csv=require('to-csv');var ejs=require(_0x7174('0x8'));var fs=require('fs');var _=require(_0x7174('0x9'));var squel=require(_0x7174('0xa'));var crypto=require('crypto');var jsforce=require(_0x7174('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7174('0xc'));var querystring=require(_0x7174('0xd'));var Papa=require(_0x7174('0xe'));var Redis=require(_0x7174('0xf'));var authService=require(_0x7174('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7174('0x11'));var hardwareService=require(_0x7174('0x12'));var logger=require(_0x7174('0x13'))(_0x7174('0x14'));var utils=require(_0x7174('0x15'));var config=require(_0x7174('0x16'));var db=require(_0x7174('0x17'))['db'];function respondWithStatusCode(_0x36509b,_0x2ff2ad){_0x2ff2ad=_0x2ff2ad||0xcc;return function(_0x49da2c){if(_0x49da2c){return _0x36509b[_0x7174('0x18')](_0x2ff2ad);}return _0x36509b[_0x7174('0x19')](_0x2ff2ad)[_0x7174('0x1a')]();};}function respondWithResult(_0x56b2e5,_0xc55c6c){_0xc55c6c=_0xc55c6c||0xc8;return function(_0x1c951b){if(_0x1c951b){return _0x56b2e5['status'](_0xc55c6c)[_0x7174('0x1b')](_0x1c951b);}};}function respondWithFilteredResult(_0x2db0e8,_0xbe30c6){return function(_0x1d8379){if(_0x1d8379){var _0x2a3f6b=_0x1d8379[_0x7174('0x1c')],_0x2e25e7=_0xbe30c6[_0x7174('0x1d')],_0x23615d=_0xbe30c6[_0x7174('0x1d')]+_0xbe30c6[_0x7174('0x1e')],_0x325c19;if(_0x23615d>=_0x2a3f6b){_0x23615d=_0x2a3f6b;_0x325c19=0xc8;}else{_0x325c19=0xce;}_0x2db0e8[_0x7174('0x19')](_0x325c19);return _0x2db0e8[_0x7174('0x1f')](_0x7174('0x20'),_0x2e25e7+'-'+_0x23615d+'/'+_0x2a3f6b)['json'](_0x1d8379);}return null;};}function patchUpdates(_0x4579e2){return function(_0x3e6ad6){try{jsonpatch[_0x7174('0x21')](_0x3e6ad6,_0x4579e2,!![]);}catch(_0x37da11){return BPromise[_0x7174('0x22')](_0x37da11);}return _0x3e6ad6['save']();};}function saveUpdates(_0x13e3f7,_0x2c82f9){return function(_0x2082d5){if(_0x2082d5){return _0x2082d5[_0x7174('0x23')](_0x13e3f7)[_0x7174('0x24')](function(_0x3ca3ed){return _0x3ca3ed;});}return null;};}function removeEntity(_0x306b1b,_0x511e70){return function(_0x2dd5d3){if(_0x2dd5d3){return _0x2dd5d3[_0x7174('0x25')]()[_0x7174('0x24')](function(){_0x306b1b[_0x7174('0x19')](0xcc)[_0x7174('0x1a')]();});}};}function handleEntityNotFound(_0x48d474,_0x2b6dce){return function(_0x361c44){if(!_0x361c44){_0x48d474['sendStatus'](0x194);}return _0x361c44;};}function handleError(_0x353378,_0x246576){_0x246576=_0x246576||0x1f4;return function(_0x1a1f7c){logger[_0x7174('0x26')](_0x1a1f7c[_0x7174('0x27')]);if(_0x1a1f7c[_0x7174('0x28')]){delete _0x1a1f7c['name'];}_0x353378[_0x7174('0x19')](_0x246576)[_0x7174('0x29')](_0x1a1f7c);};}exports[_0x7174('0x2a')]=function(_0x34f3c8,_0x126944){var _0x5075f6={},_0x521385={},_0x3e106f={'count':0x0,'rows':[]};var _0x1f2bdd=_[_0x7174('0x2b')](db['Automation'][_0x7174('0x2c')],function(_0x265cd7){return{'name':_0x265cd7[_0x7174('0x2d')],'type':_0x265cd7[_0x7174('0x2e')][_0x7174('0x2f')]};});_0x521385[_0x7174('0x30')]=_[_0x7174('0x2b')](_0x1f2bdd,_0x7174('0x28'));_0x521385[_0x7174('0x31')]=_['keys'](_0x34f3c8['query']);_0x521385[_0x7174('0x32')]=_[_0x7174('0x33')](_0x521385[_0x7174('0x30')],_0x521385['query']);_0x5075f6[_0x7174('0x34')]=_[_0x7174('0x33')](_0x521385[_0x7174('0x30')],qs[_0x7174('0x35')](_0x34f3c8['query'][_0x7174('0x35')]));_0x5075f6[_0x7174('0x34')]=_0x5075f6[_0x7174('0x34')][_0x7174('0x36')]?_0x5075f6[_0x7174('0x34')]:_0x521385[_0x7174('0x30')];if(!_0x34f3c8[_0x7174('0x31')][_0x7174('0x37')](_0x7174('0x38'))){_0x5075f6[_0x7174('0x1e')]=qs['limit'](_0x34f3c8['query']['limit']);_0x5075f6[_0x7174('0x1d')]=qs[_0x7174('0x1d')](_0x34f3c8['query'][_0x7174('0x1d')]);}_0x5075f6[_0x7174('0x39')]=qs[_0x7174('0x3a')](_0x34f3c8['query'][_0x7174('0x3a')]);_0x5075f6[_0x7174('0x3b')]=qs['filters'](_[_0x7174('0x3c')](_0x34f3c8[_0x7174('0x31')],_0x521385[_0x7174('0x32')]),_0x1f2bdd);if(_0x34f3c8[_0x7174('0x31')][_0x7174('0x3d')]){_0x5075f6[_0x7174('0x3b')]=_[_0x7174('0x3e')](_0x5075f6[_0x7174('0x3b')],{'$or':_[_0x7174('0x2b')](_0x1f2bdd,function(_0x4c422b){if(_0x4c422b['type']!==_0x7174('0x3f')){var _0x1da9c4={};_0x1da9c4[_0x4c422b[_0x7174('0x28')]]={'$like':'%'+_0x34f3c8[_0x7174('0x31')][_0x7174('0x3d')]+'%'};return _0x1da9c4;}})});}_0x5075f6=_[_0x7174('0x3e')]({},_0x5075f6,_0x34f3c8['options']);var _0x315b2d={'where':_0x5075f6[_0x7174('0x3b')]};return db['Automation'][_0x7174('0x1c')](_0x315b2d)[_0x7174('0x24')](function(_0x407034){_0x3e106f['count']=_0x407034;if(_0x34f3c8[_0x7174('0x31')][_0x7174('0x40')]){_0x5075f6[_0x7174('0x41')]=[{'all':!![]}];}return db[_0x7174('0x42')][_0x7174('0x43')](_0x5075f6);})['then'](function(_0x4a2e41){_0x3e106f['rows']=_0x4a2e41;return _0x3e106f;})[_0x7174('0x24')](respondWithFilteredResult(_0x126944,_0x5075f6))[_0x7174('0x44')](handleError(_0x126944,null));};exports[_0x7174('0x45')]=function(_0x26d247,_0x198110){var _0x3c1c8b={'raw':![],'where':{'id':_0x26d247['params']['id']}},_0x2706ce={};_0x2706ce[_0x7174('0x30')]=_['keys'](db[_0x7174('0x42')][_0x7174('0x2c')]);_0x2706ce[_0x7174('0x31')]=_[_0x7174('0x46')](_0x26d247[_0x7174('0x31')]);_0x2706ce[_0x7174('0x32')]=_[_0x7174('0x33')](_0x2706ce['model'],_0x2706ce[_0x7174('0x31')]);_0x3c1c8b[_0x7174('0x34')]=_[_0x7174('0x33')](_0x2706ce[_0x7174('0x30')],qs[_0x7174('0x35')](_0x26d247[_0x7174('0x31')][_0x7174('0x35')]));_0x3c1c8b[_0x7174('0x34')]=_0x3c1c8b['attributes'][_0x7174('0x36')]?_0x3c1c8b[_0x7174('0x34')]:_0x2706ce[_0x7174('0x30')];if(_0x26d247[_0x7174('0x31')][_0x7174('0x40')]){_0x3c1c8b['include']=[{'all':!![]}];}_0x3c1c8b=_[_0x7174('0x3e')]({},_0x3c1c8b,_0x26d247[_0x7174('0x47')]);return db[_0x7174('0x42')][_0x7174('0x48')](_0x3c1c8b)[_0x7174('0x24')](handleEntityNotFound(_0x198110,null))[_0x7174('0x24')](respondWithResult(_0x198110,null))[_0x7174('0x44')](handleError(_0x198110,null));};exports[_0x7174('0x49')]=function(_0x19ca07,_0x32d63a){return db['Automation']['create'](_0x19ca07[_0x7174('0x4a')],{})[_0x7174('0x24')](respondWithResult(_0x32d63a,0xc9))['catch'](handleError(_0x32d63a,null));};exports[_0x7174('0x23')]=function(_0x44234d,_0x435735){if(_0x44234d[_0x7174('0x4a')]['id']){delete _0x44234d[_0x7174('0x4a')]['id'];}return db[_0x7174('0x42')][_0x7174('0x48')]({'where':{'id':_0x44234d[_0x7174('0x4b')]['id']}})['then'](handleEntityNotFound(_0x435735,null))[_0x7174('0x24')](saveUpdates(_0x44234d['body'],null))[_0x7174('0x24')](respondWithResult(_0x435735,null))[_0x7174('0x44')](handleError(_0x435735,null));};exports[_0x7174('0x25')]=function(_0xc9ad4,_0x3cbd41){return db[_0x7174('0x42')][_0x7174('0x48')]({'where':{'id':_0xc9ad4[_0x7174('0x4b')]['id']}})[_0x7174('0x24')](handleEntityNotFound(_0x3cbd41,null))[_0x7174('0x24')](removeEntity(_0x3cbd41,null))[_0x7174('0x44')](handleError(_0x3cbd41,null));};exports[_0x7174('0x4c')]=function(_0x3cd443,_0x2be078,_0x5bf49c){return db[_0x7174('0x4d')][_0x7174('0x48')]({'where':{'id':_0x3cd443['params']['id']}})[_0x7174('0x24')](handleEntityNotFound(_0x2be078,null))[_0x7174('0x24')](function(_0x3e2e03){if(_0x3e2e03){return _0x3e2e03[_0x7174('0x4c')](_0x3cd443[_0x7174('0x4a')][_0x7174('0x4e')],_[_0x7174('0x4f')](_0x3cd443['body'],['ids','id'])||{});}})[_0x7174('0x24')](respondWithResult(_0x2be078,null))[_0x7174('0x44')](handleError(_0x2be078,null));};exports[_0x7174('0x50')]=function(_0x5cab82,_0x15ee7b,_0x3835e8){var _0x4d0f04={};var _0x31df9d={};var _0x1382ae;var _0x21c08d;return db[_0x7174('0x42')][_0x7174('0x51')]({'where':{'id':_0x5cab82[_0x7174('0x4b')]['id']}})[_0x7174('0x24')](handleEntityNotFound(_0x15ee7b,null))['then'](function(_0x266eaf){if(_0x266eaf){_0x1382ae=_0x266eaf;_0x31df9d[_0x7174('0x30')]=_[_0x7174('0x46')](db[_0x7174('0x4d')][_0x7174('0x2c')]);_0x31df9d[_0x7174('0x31')]=_[_0x7174('0x46')](_0x5cab82['query']);_0x31df9d[_0x7174('0x32')]=_[_0x7174('0x33')](_0x31df9d[_0x7174('0x30')],_0x31df9d[_0x7174('0x31')]);_0x4d0f04['attributes']=_[_0x7174('0x33')](_0x31df9d[_0x7174('0x30')],qs['fields'](_0x5cab82[_0x7174('0x31')]['fields']));_0x4d0f04[_0x7174('0x34')]=_0x4d0f04[_0x7174('0x34')]['length']?_0x4d0f04[_0x7174('0x34')]:_0x31df9d[_0x7174('0x30')];_0x4d0f04[_0x7174('0x39')]=qs['sort'](_0x5cab82[_0x7174('0x31')][_0x7174('0x3a')]);_0x4d0f04[_0x7174('0x3b')]=qs['filters'](_[_0x7174('0x3c')](_0x5cab82[_0x7174('0x31')],_0x31df9d[_0x7174('0x32')]));if(_0x5cab82[_0x7174('0x31')]['filter']){_0x4d0f04['where']=_[_0x7174('0x3e')](_0x4d0f04['where'],{'$or':_[_0x7174('0x2b')](_0x4d0f04['attributes'],function(_0xb09653){var _0x4ff10f={};_0x4ff10f[_0xb09653]={'$like':'%'+_0x5cab82[_0x7174('0x31')]['filter']+'%'};return _0x4ff10f;})});}_0x4d0f04=_['merge']({},_0x4d0f04,_0x5cab82[_0x7174('0x47')]);return _0x1382ae[_0x7174('0x50')](_0x4d0f04);}})['then'](function(_0x5fc970){if(_0x5fc970){_0x21c08d=_0x5fc970[_0x7174('0x36')];if(!_0x5cab82['query']['hasOwnProperty'](_0x7174('0x38'))){_0x4d0f04[_0x7174('0x1e')]=qs[_0x7174('0x1e')](_0x5cab82[_0x7174('0x31')][_0x7174('0x1e')]);_0x4d0f04[_0x7174('0x1d')]=qs[_0x7174('0x1d')](_0x5cab82[_0x7174('0x31')]['offset']);}return _0x1382ae[_0x7174('0x50')](_0x4d0f04);}})[_0x7174('0x24')](function(_0x45b176){if(_0x45b176){return _0x45b176?{'count':_0x21c08d,'rows':_0x45b176}:null;}})[_0x7174('0x24')](respondWithResult(_0x15ee7b,null))[_0x7174('0x44')](handleError(_0x15ee7b,null));};exports['addActions']=function(_0x34a370,_0x5478ef,_0xb246ae){return db[_0x7174('0x52')][_0x7174('0x48')]({'where':{'id':_0x34a370[_0x7174('0x4b')]['id']}})[_0x7174('0x24')](handleEntityNotFound(_0x5478ef,null))['then'](function(_0x2ea077){if(_0x2ea077){return _0x2ea077['addActions'](_0x34a370[_0x7174('0x4a')][_0x7174('0x4e')],_[_0x7174('0x4f')](_0x34a370[_0x7174('0x4a')],['ids','id'])||{});}})[_0x7174('0x24')](respondWithResult(_0x5478ef,null))[_0x7174('0x44')](handleError(_0x5478ef,null));};exports[_0x7174('0x53')]=function(_0x181e69,_0x58507c,_0x2afafc){var _0x7d4bcb={};var _0xe859bf={};var _0x59d68c;var _0x2f9d62;return db[_0x7174('0x42')][_0x7174('0x51')]({'where':{'id':_0x181e69[_0x7174('0x4b')]['id']}})[_0x7174('0x24')](handleEntityNotFound(_0x58507c,null))[_0x7174('0x24')](function(_0x298c36){if(_0x298c36){_0x59d68c=_0x298c36;_0xe859bf[_0x7174('0x30')]=_['keys'](db[_0x7174('0x52')][_0x7174('0x2c')]);_0xe859bf['query']=_[_0x7174('0x46')](_0x181e69[_0x7174('0x31')]);_0xe859bf['filters']=_[_0x7174('0x33')](_0xe859bf[_0x7174('0x30')],_0xe859bf[_0x7174('0x31')]);_0x7d4bcb[_0x7174('0x34')]=_[_0x7174('0x33')](_0xe859bf[_0x7174('0x30')],qs[_0x7174('0x35')](_0x181e69[_0x7174('0x31')][_0x7174('0x35')]));_0x7d4bcb[_0x7174('0x34')]=_0x7d4bcb[_0x7174('0x34')][_0x7174('0x36')]?_0x7d4bcb[_0x7174('0x34')]:_0xe859bf['model'];_0x7d4bcb[_0x7174('0x39')]=qs[_0x7174('0x3a')](_0x181e69[_0x7174('0x31')][_0x7174('0x3a')]);_0x7d4bcb[_0x7174('0x3b')]=qs[_0x7174('0x32')](_['pick'](_0x181e69[_0x7174('0x31')],_0xe859bf[_0x7174('0x32')]));if(_0x181e69[_0x7174('0x31')][_0x7174('0x3d')]){_0x7d4bcb[_0x7174('0x3b')]=_[_0x7174('0x3e')](_0x7d4bcb[_0x7174('0x3b')],{'$or':_['map'](_0x7d4bcb[_0x7174('0x34')],function(_0x4645eb){var _0x1415f1={};_0x1415f1[_0x4645eb]={'$like':'%'+_0x181e69['query'][_0x7174('0x3d')]+'%'};return _0x1415f1;})});}_0x7d4bcb=_[_0x7174('0x3e')]({},_0x7d4bcb,_0x181e69[_0x7174('0x47')]);return _0x59d68c[_0x7174('0x53')](_0x7d4bcb);}})[_0x7174('0x24')](function(_0x2b9297){if(_0x2b9297){_0x2f9d62=_0x2b9297[_0x7174('0x36')];if(!_0x181e69[_0x7174('0x31')][_0x7174('0x37')](_0x7174('0x38'))){_0x7d4bcb[_0x7174('0x1e')]=qs[_0x7174('0x1e')](_0x181e69[_0x7174('0x31')][_0x7174('0x1e')]);_0x7d4bcb[_0x7174('0x1d')]=qs[_0x7174('0x1d')](_0x181e69[_0x7174('0x31')]['offset']);}return _0x59d68c[_0x7174('0x53')](_0x7d4bcb);}})[_0x7174('0x24')](function(_0x63d20){if(_0x63d20){return _0x63d20?{'count':_0x2f9d62,'rows':_0x63d20}:null;}})[_0x7174('0x24')](respondWithResult(_0x58507c,null))['catch'](handleError(_0x58507c,null));}; \ No newline at end of file +var _0x0276=['Automation','rawAttributes','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','catch','show','params','includeAll','find','create','body','addConditions','Condition','ids','omit','getConditions','order','addActions','Action','getActions','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','limit','set','reject','save','update','then','destroy','error','stack','name','send','map'];(function(_0x26a672,_0x59f5be){var _0x348f43=function(_0x461812){while(--_0x461812){_0x26a672['push'](_0x26a672['shift']());}};_0x348f43(++_0x59f5be);}(_0x0276,0x7a));var _0x6027=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x0276[_0xa1e3e3];return _0xc980e9;};'use strict';var pdf=require(_0x6027('0x0'));var emlformat=require(_0x6027('0x1'));var rimraf=require(_0x6027('0x2'));var zipdir=require(_0x6027('0x3'));var jsonpatch=require(_0x6027('0x4'));var rp=require('request-promise');var moment=require(_0x6027('0x5'));var BPromise=require(_0x6027('0x6'));var Mustache=require(_0x6027('0x7'));var util=require(_0x6027('0x8'));var path=require(_0x6027('0x9'));var sox=require(_0x6027('0xa'));var csv=require('to-csv');var ejs=require(_0x6027('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6027('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6027('0xd'));var toCsv=require(_0x6027('0xe'));var querystring=require(_0x6027('0xf'));var Papa=require(_0x6027('0x10'));var Redis=require(_0x6027('0x11'));var authService=require(_0x6027('0x12'));var qs=require(_0x6027('0x13'));var as=require(_0x6027('0x14'));var hardwareService=require(_0x6027('0x15'));var logger=require(_0x6027('0x16'))(_0x6027('0x17'));var utils=require(_0x6027('0x18'));var config=require(_0x6027('0x19'));var db=require(_0x6027('0x1a'))['db'];function respondWithStatusCode(_0x263d71,_0x853a04){_0x853a04=_0x853a04||0xcc;return function(_0x16bd15){if(_0x16bd15){return _0x263d71[_0x6027('0x1b')](_0x853a04);}return _0x263d71['status'](_0x853a04)[_0x6027('0x1c')]();};}function respondWithResult(_0x1ad331,_0x29aecc){_0x29aecc=_0x29aecc||0xc8;return function(_0x4ccb05){if(_0x4ccb05){return _0x1ad331[_0x6027('0x1d')](_0x29aecc)[_0x6027('0x1e')](_0x4ccb05);}};}function respondWithFilteredResult(_0x5df5f1,_0x56e4f2){return function(_0x274061){if(_0x274061){var _0x3588a0=_0x274061[_0x6027('0x1f')],_0x405236=_0x56e4f2['offset'],_0x301289=_0x56e4f2['offset']+_0x56e4f2[_0x6027('0x20')],_0x707fe3;if(_0x301289>=_0x3588a0){_0x301289=_0x3588a0;_0x707fe3=0xc8;}else{_0x707fe3=0xce;}_0x5df5f1[_0x6027('0x1d')](_0x707fe3);return _0x5df5f1[_0x6027('0x21')]('Content-Range',_0x405236+'-'+_0x301289+'/'+_0x3588a0)[_0x6027('0x1e')](_0x274061);}return null;};}function patchUpdates(_0x160cf5){return function(_0x2bf233){try{jsonpatch['apply'](_0x2bf233,_0x160cf5,!![]);}catch(_0xce7f48){return BPromise[_0x6027('0x22')](_0xce7f48);}return _0x2bf233[_0x6027('0x23')]();};}function saveUpdates(_0x511d73,_0x4b2cca){return function(_0x228f7d){if(_0x228f7d){return _0x228f7d[_0x6027('0x24')](_0x511d73)[_0x6027('0x25')](function(_0x1aaa12){return _0x1aaa12;});}return null;};}function removeEntity(_0x265f53,_0x1725ce){return function(_0xa2727b){if(_0xa2727b){return _0xa2727b[_0x6027('0x26')]()['then'](function(){_0x265f53[_0x6027('0x1d')](0xcc)[_0x6027('0x1c')]();});}};}function handleEntityNotFound(_0x438b7e,_0x2908db){return function(_0x195363){if(!_0x195363){_0x438b7e[_0x6027('0x1b')](0x194);}return _0x195363;};}function handleError(_0x437f25,_0x55efb6){_0x55efb6=_0x55efb6||0x1f4;return function(_0xc193c4){logger[_0x6027('0x27')](_0xc193c4[_0x6027('0x28')]);if(_0xc193c4[_0x6027('0x29')]){delete _0xc193c4['name'];}_0x437f25[_0x6027('0x1d')](_0x55efb6)[_0x6027('0x2a')](_0xc193c4);};}exports['index']=function(_0x444364,_0x3bb92e){var _0xab6f3c={},_0xa8e067={},_0x38c8bb={'count':0x0,'rows':[]};var _0x4ac904=_[_0x6027('0x2b')](db[_0x6027('0x2c')][_0x6027('0x2d')],function(_0x37efa9){return{'name':_0x37efa9['fieldName'],'type':_0x37efa9[_0x6027('0x2e')]['key']};});_0xa8e067['model']=_[_0x6027('0x2b')](_0x4ac904,_0x6027('0x29'));_0xa8e067[_0x6027('0x2f')]=_[_0x6027('0x30')](_0x444364[_0x6027('0x2f')]);_0xa8e067['filters']=_[_0x6027('0x31')](_0xa8e067[_0x6027('0x32')],_0xa8e067['query']);_0xab6f3c[_0x6027('0x33')]=_[_0x6027('0x31')](_0xa8e067[_0x6027('0x32')],qs[_0x6027('0x34')](_0x444364[_0x6027('0x2f')][_0x6027('0x34')]));_0xab6f3c['attributes']=_0xab6f3c[_0x6027('0x33')][_0x6027('0x35')]?_0xab6f3c['attributes']:_0xa8e067[_0x6027('0x32')];if(!_0x444364[_0x6027('0x2f')][_0x6027('0x36')](_0x6027('0x37'))){_0xab6f3c[_0x6027('0x20')]=qs[_0x6027('0x20')](_0x444364[_0x6027('0x2f')][_0x6027('0x20')]);_0xab6f3c['offset']=qs[_0x6027('0x38')](_0x444364[_0x6027('0x2f')][_0x6027('0x38')]);}_0xab6f3c['order']=qs[_0x6027('0x39')](_0x444364['query'][_0x6027('0x39')]);_0xab6f3c[_0x6027('0x3a')]=qs[_0x6027('0x3b')](_[_0x6027('0x3c')](_0x444364[_0x6027('0x2f')],_0xa8e067[_0x6027('0x3b')]),_0x4ac904);if(_0x444364[_0x6027('0x2f')][_0x6027('0x3d')]){_0xab6f3c[_0x6027('0x3a')]=_[_0x6027('0x3e')](_0xab6f3c[_0x6027('0x3a')],{'$or':_[_0x6027('0x2b')](_0x4ac904,function(_0x35f8af){if(_0x35f8af['type']!==_0x6027('0x3f')){var _0x5f01aa={};_0x5f01aa[_0x35f8af[_0x6027('0x29')]]={'$like':'%'+_0x444364[_0x6027('0x2f')][_0x6027('0x3d')]+'%'};return _0x5f01aa;}})});}_0xab6f3c=_[_0x6027('0x3e')]({},_0xab6f3c,_0x444364[_0x6027('0x40')]);var _0x5313eb={'where':_0xab6f3c['where']};return db[_0x6027('0x2c')][_0x6027('0x1f')](_0x5313eb)[_0x6027('0x25')](function(_0x1af863){_0x38c8bb[_0x6027('0x1f')]=_0x1af863;if(_0x444364['query']['includeAll']){_0xab6f3c['include']=[{'all':!![]}];}return db[_0x6027('0x2c')]['findAll'](_0xab6f3c);})[_0x6027('0x25')](function(_0xab2344){_0x38c8bb[_0x6027('0x41')]=_0xab2344;return _0x38c8bb;})[_0x6027('0x25')](respondWithFilteredResult(_0x3bb92e,_0xab6f3c))[_0x6027('0x42')](handleError(_0x3bb92e,null));};exports[_0x6027('0x43')]=function(_0x13f75f,_0x19dfad){var _0x115031={'raw':![],'where':{'id':_0x13f75f[_0x6027('0x44')]['id']}},_0x108253={};_0x108253[_0x6027('0x32')]=_[_0x6027('0x30')](db[_0x6027('0x2c')][_0x6027('0x2d')]);_0x108253[_0x6027('0x2f')]=_[_0x6027('0x30')](_0x13f75f[_0x6027('0x2f')]);_0x108253[_0x6027('0x3b')]=_[_0x6027('0x31')](_0x108253['model'],_0x108253[_0x6027('0x2f')]);_0x115031[_0x6027('0x33')]=_[_0x6027('0x31')](_0x108253[_0x6027('0x32')],qs[_0x6027('0x34')](_0x13f75f[_0x6027('0x2f')]['fields']));_0x115031[_0x6027('0x33')]=_0x115031[_0x6027('0x33')][_0x6027('0x35')]?_0x115031[_0x6027('0x33')]:_0x108253[_0x6027('0x32')];if(_0x13f75f['query'][_0x6027('0x45')]){_0x115031['include']=[{'all':!![]}];}_0x115031=_['merge']({},_0x115031,_0x13f75f[_0x6027('0x40')]);return db[_0x6027('0x2c')][_0x6027('0x46')](_0x115031)[_0x6027('0x25')](handleEntityNotFound(_0x19dfad,null))[_0x6027('0x25')](respondWithResult(_0x19dfad,null))[_0x6027('0x42')](handleError(_0x19dfad,null));};exports['create']=function(_0x373ad4,_0x1db0ab){return db[_0x6027('0x2c')][_0x6027('0x47')](_0x373ad4['body'],{})[_0x6027('0x25')](respondWithResult(_0x1db0ab,0xc9))[_0x6027('0x42')](handleError(_0x1db0ab,null));};exports[_0x6027('0x24')]=function(_0xe3153e,_0x3c7bbb){if(_0xe3153e['body']['id']){delete _0xe3153e[_0x6027('0x48')]['id'];}return db[_0x6027('0x2c')][_0x6027('0x46')]({'where':{'id':_0xe3153e[_0x6027('0x44')]['id']}})['then'](handleEntityNotFound(_0x3c7bbb,null))[_0x6027('0x25')](saveUpdates(_0xe3153e['body'],null))[_0x6027('0x25')](respondWithResult(_0x3c7bbb,null))[_0x6027('0x42')](handleError(_0x3c7bbb,null));};exports['destroy']=function(_0x8d7584,_0x4790d1){return db[_0x6027('0x2c')][_0x6027('0x46')]({'where':{'id':_0x8d7584[_0x6027('0x44')]['id']}})[_0x6027('0x25')](handleEntityNotFound(_0x4790d1,null))[_0x6027('0x25')](removeEntity(_0x4790d1,null))[_0x6027('0x42')](handleError(_0x4790d1,null));};exports[_0x6027('0x49')]=function(_0x5f2531,_0x591fdd,_0x804267){return db[_0x6027('0x4a')]['find']({'where':{'id':_0x5f2531[_0x6027('0x44')]['id']}})[_0x6027('0x25')](handleEntityNotFound(_0x591fdd,null))[_0x6027('0x25')](function(_0x22d699){if(_0x22d699){return _0x22d699['addConditions'](_0x5f2531[_0x6027('0x48')][_0x6027('0x4b')],_[_0x6027('0x4c')](_0x5f2531[_0x6027('0x48')],[_0x6027('0x4b'),'id'])||{});}})[_0x6027('0x25')](respondWithResult(_0x591fdd,null))['catch'](handleError(_0x591fdd,null));};exports[_0x6027('0x4d')]=function(_0x3f89f6,_0x3f6298,_0x1eb89a){var _0x4537f4={};var _0xd1669d={};var _0x556e38;var _0x3754d5;return db['Automation']['findOne']({'where':{'id':_0x3f89f6[_0x6027('0x44')]['id']}})['then'](handleEntityNotFound(_0x3f6298,null))[_0x6027('0x25')](function(_0x27b539){if(_0x27b539){_0x556e38=_0x27b539;_0xd1669d[_0x6027('0x32')]=_[_0x6027('0x30')](db[_0x6027('0x4a')][_0x6027('0x2d')]);_0xd1669d['query']=_[_0x6027('0x30')](_0x3f89f6['query']);_0xd1669d['filters']=_['intersection'](_0xd1669d[_0x6027('0x32')],_0xd1669d[_0x6027('0x2f')]);_0x4537f4['attributes']=_[_0x6027('0x31')](_0xd1669d['model'],qs[_0x6027('0x34')](_0x3f89f6[_0x6027('0x2f')][_0x6027('0x34')]));_0x4537f4[_0x6027('0x33')]=_0x4537f4[_0x6027('0x33')][_0x6027('0x35')]?_0x4537f4[_0x6027('0x33')]:_0xd1669d[_0x6027('0x32')];_0x4537f4[_0x6027('0x4e')]=qs[_0x6027('0x39')](_0x3f89f6[_0x6027('0x2f')][_0x6027('0x39')]);_0x4537f4[_0x6027('0x3a')]=qs[_0x6027('0x3b')](_[_0x6027('0x3c')](_0x3f89f6[_0x6027('0x2f')],_0xd1669d[_0x6027('0x3b')]));if(_0x3f89f6[_0x6027('0x2f')]['filter']){_0x4537f4['where']=_[_0x6027('0x3e')](_0x4537f4['where'],{'$or':_[_0x6027('0x2b')](_0x4537f4[_0x6027('0x33')],function(_0x531498){var _0x13767b={};_0x13767b[_0x531498]={'$like':'%'+_0x3f89f6[_0x6027('0x2f')]['filter']+'%'};return _0x13767b;})});}_0x4537f4=_[_0x6027('0x3e')]({},_0x4537f4,_0x3f89f6[_0x6027('0x40')]);return _0x556e38[_0x6027('0x4d')](_0x4537f4);}})[_0x6027('0x25')](function(_0x249bb1){if(_0x249bb1){_0x3754d5=_0x249bb1[_0x6027('0x35')];if(!_0x3f89f6[_0x6027('0x2f')][_0x6027('0x36')](_0x6027('0x37'))){_0x4537f4['limit']=qs[_0x6027('0x20')](_0x3f89f6[_0x6027('0x2f')][_0x6027('0x20')]);_0x4537f4[_0x6027('0x38')]=qs[_0x6027('0x38')](_0x3f89f6['query'][_0x6027('0x38')]);}return _0x556e38[_0x6027('0x4d')](_0x4537f4);}})[_0x6027('0x25')](function(_0x4d054d){if(_0x4d054d){return _0x4d054d?{'count':_0x3754d5,'rows':_0x4d054d}:null;}})[_0x6027('0x25')](respondWithResult(_0x3f6298,null))[_0x6027('0x42')](handleError(_0x3f6298,null));};exports[_0x6027('0x4f')]=function(_0x19e1c0,_0x3b34da,_0x25a168){return db[_0x6027('0x50')][_0x6027('0x46')]({'where':{'id':_0x19e1c0[_0x6027('0x44')]['id']}})['then'](handleEntityNotFound(_0x3b34da,null))[_0x6027('0x25')](function(_0x10d10a){if(_0x10d10a){return _0x10d10a[_0x6027('0x4f')](_0x19e1c0[_0x6027('0x48')][_0x6027('0x4b')],_[_0x6027('0x4c')](_0x19e1c0['body'],[_0x6027('0x4b'),'id'])||{});}})[_0x6027('0x25')](respondWithResult(_0x3b34da,null))[_0x6027('0x42')](handleError(_0x3b34da,null));};exports[_0x6027('0x51')]=function(_0x13ffb1,_0x257993,_0x36991b){var _0x9e6e9e={};var _0x1d6672={};var _0xb05d70;var _0x5c9acb;return db[_0x6027('0x2c')][_0x6027('0x52')]({'where':{'id':_0x13ffb1[_0x6027('0x44')]['id']}})['then'](handleEntityNotFound(_0x257993,null))['then'](function(_0x63c89d){if(_0x63c89d){_0xb05d70=_0x63c89d;_0x1d6672['model']=_['keys'](db[_0x6027('0x50')]['rawAttributes']);_0x1d6672[_0x6027('0x2f')]=_[_0x6027('0x30')](_0x13ffb1['query']);_0x1d6672['filters']=_[_0x6027('0x31')](_0x1d6672[_0x6027('0x32')],_0x1d6672[_0x6027('0x2f')]);_0x9e6e9e['attributes']=_[_0x6027('0x31')](_0x1d6672['model'],qs[_0x6027('0x34')](_0x13ffb1[_0x6027('0x2f')]['fields']));_0x9e6e9e[_0x6027('0x33')]=_0x9e6e9e[_0x6027('0x33')][_0x6027('0x35')]?_0x9e6e9e[_0x6027('0x33')]:_0x1d6672[_0x6027('0x32')];_0x9e6e9e[_0x6027('0x4e')]=qs['sort'](_0x13ffb1[_0x6027('0x2f')][_0x6027('0x39')]);_0x9e6e9e[_0x6027('0x3a')]=qs[_0x6027('0x3b')](_['pick'](_0x13ffb1['query'],_0x1d6672[_0x6027('0x3b')]));if(_0x13ffb1[_0x6027('0x2f')][_0x6027('0x3d')]){_0x9e6e9e['where']=_[_0x6027('0x3e')](_0x9e6e9e['where'],{'$or':_[_0x6027('0x2b')](_0x9e6e9e[_0x6027('0x33')],function(_0x50f75b){var _0x3ddab6={};_0x3ddab6[_0x50f75b]={'$like':'%'+_0x13ffb1[_0x6027('0x2f')][_0x6027('0x3d')]+'%'};return _0x3ddab6;})});}_0x9e6e9e=_['merge']({},_0x9e6e9e,_0x13ffb1[_0x6027('0x40')]);return _0xb05d70[_0x6027('0x51')](_0x9e6e9e);}})[_0x6027('0x25')](function(_0xf3a6da){if(_0xf3a6da){_0x5c9acb=_0xf3a6da[_0x6027('0x35')];if(!_0x13ffb1[_0x6027('0x2f')][_0x6027('0x36')](_0x6027('0x37'))){_0x9e6e9e[_0x6027('0x20')]=qs[_0x6027('0x20')](_0x13ffb1[_0x6027('0x2f')][_0x6027('0x20')]);_0x9e6e9e[_0x6027('0x38')]=qs[_0x6027('0x38')](_0x13ffb1[_0x6027('0x2f')]['offset']);}return _0xb05d70[_0x6027('0x51')](_0x9e6e9e);}})[_0x6027('0x25')](function(_0x591518){if(_0x591518){return _0x591518?{'count':_0x5c9acb,'rows':_0x591518}:null;}})['then'](respondWithResult(_0x257993,null))[_0x6027('0x42')](handleError(_0x257993,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index a0156bb..6c51e0f 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 _0x9a19=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x9a19,0x114));var _0x99a1=function(_0x52e0ee,_0x52f7c1){_0x52e0ee=_0x52e0ee-0x0;var _0x32534c=_0x9a19[_0x52e0ee];return _0x32534c;};'use strict';var _=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var logger=require(_0x99a1('0x2'))('api');var moment=require(_0x99a1('0x3'));var BPromise=require(_0x99a1('0x4'));var rp=require(_0x99a1('0x5'));var fs=require('fs');var path=require(_0x99a1('0x6'));var rimraf=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var attributes=require(_0x99a1('0x9'));module[_0x99a1('0xa')]=function(_0x3eff4a,_0xff0240){return _0x3eff4a[_0x99a1('0xb')]('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bd8=['./automation.attributes','exports','define','Automation','tools_automations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x216494,_0x21a0b4){var _0x3fce22=function(_0x510bbd){while(--_0x510bbd){_0x216494['push'](_0x216494['shift']());}};_0x3fce22(++_0x21a0b4);}(_0x2bd8,0x130));var _0x82bd=function(_0xdcbca9,_0x540b0a){_0xdcbca9=_0xdcbca9-0x0;var _0x56d932=_0x2bd8[_0xdcbca9];return _0x56d932;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var logger=require(_0x82bd('0x1'))(_0x82bd('0x2'));var moment=require(_0x82bd('0x3'));var BPromise=require(_0x82bd('0x4'));var rp=require(_0x82bd('0x5'));var fs=require('fs');var path=require(_0x82bd('0x6'));var rimraf=require(_0x82bd('0x7'));var config=require('../../config/environment');var attributes=require(_0x82bd('0x8'));module[_0x82bd('0x9')]=function(_0x3bf810,_0x5ceb60){return _0x3bf810[_0x82bd('0xa')](_0x82bd('0xb'),attributes,{'tableName':_0x82bd('0xc'),'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 dc0e91e..25038af 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 _0x145b=['result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','Automation,\x20%s,\x20%s','error','message'];(function(_0x5117b4,_0x183d07){var _0x1f8458=function(_0xbf904d){while(--_0xbf904d){_0x5117b4['push'](_0x5117b4['shift']());}};_0x1f8458(++_0x183d07);}(_0x145b,0x70));var _0xb145=function(_0x10d6cc,_0x2b972f){_0x10d6cc=_0x10d6cc-0x0;var _0x4f8d20=_0x145b[_0x10d6cc];return _0x4f8d20;};'use strict';var _=require('lodash');var util=require(_0xb145('0x0'));var moment=require(_0xb145('0x1'));var BPromise=require(_0xb145('0x2'));var rs=require(_0xb145('0x3'));var fs=require('fs');var Redis=require(_0xb145('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb145('0x5'));var logger=require(_0xb145('0x6'))(_0xb145('0x7'));var config=require(_0xb145('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb145('0x9')][_0xb145('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8eb5,_0x4ba56c,_0x2a257d){return new BPromise(function(_0x4b80ef,_0x43d1ff){return client[_0xb145('0xb')](_0xe8eb5,_0x2a257d)['then'](function(_0x15b2f9){logger[_0xb145('0xc')]('Automation,\x20%s,\x20%s',_0x4ba56c,_0xb145('0xd'));logger[_0xb145('0xe')](_0xb145('0xf'),_0x4ba56c,_0xb145('0xd'),JSON[_0xb145('0x10')](_0x15b2f9));if(_0x15b2f9['error']){if(_0x15b2f9['error']['code']===0x1f4){logger['error'](_0xb145('0x11'),_0x4ba56c,_0x15b2f9[_0xb145('0x12')]['message']);return _0x43d1ff(_0x15b2f9[_0xb145('0x12')][_0xb145('0x13')]);}logger[_0xb145('0x12')](_0xb145('0x11'),_0x4ba56c,_0x15b2f9['error']['message']);return _0x4b80ef(_0x15b2f9[_0xb145('0x12')][_0xb145('0x13')]);}else{logger[_0xb145('0xc')](_0xb145('0x11'),_0x4ba56c,_0xb145('0xd'));_0x4b80ef(_0x15b2f9[_0xb145('0x14')][_0xb145('0x13')]);}})[_0xb145('0x15')](function(_0x295586){logger[_0xb145('0x12')](_0xb145('0x11'),_0x4ba56c,_0x295586);_0x43d1ff(_0x295586);});});} \ No newline at end of file +var _0x8535=['info','request\x20sent','debug','stringify','code','error','Automation,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1b785c,_0xcd7648){var _0x3ac3f5=function(_0x421faf){while(--_0x421faf){_0x1b785c['push'](_0x1b785c['shift']());}};_0x3ac3f5(++_0xcd7648);}(_0x8535,0xaa));var _0x5853=function(_0x4fa6cd,_0x279bf1){_0x4fa6cd=_0x4fa6cd-0x0;var _0x535fe6=_0x8535[_0x4fa6cd];return _0x535fe6;};'use strict';var _=require(_0x5853('0x0'));var util=require('util');var moment=require(_0x5853('0x1'));var BPromise=require(_0x5853('0x2'));var rs=require(_0x5853('0x3'));var fs=require('fs');var Redis=require(_0x5853('0x4'));var db=require(_0x5853('0x5'))['db'];var utils=require(_0x5853('0x6'));var logger=require('../../config/logger')(_0x5853('0x7'));var config=require(_0x5853('0x8'));var jayson=require(_0x5853('0x9'));var client=jayson[_0x5853('0xa')][_0x5853('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x422fe2,_0x12a158,_0x1b516){return new BPromise(function(_0x59095c,_0x13a3fe){return client[_0x5853('0xc')](_0x422fe2,_0x1b516)[_0x5853('0xd')](function(_0x149e6f){logger[_0x5853('0xe')]('Automation,\x20%s,\x20%s',_0x12a158,_0x5853('0xf'));logger[_0x5853('0x10')]('Automation,\x20%s,\x20%s,\x20%s',_0x12a158,'request\x20sent',JSON[_0x5853('0x11')](_0x149e6f));if(_0x149e6f['error']){if(_0x149e6f['error'][_0x5853('0x12')]===0x1f4){logger[_0x5853('0x13')](_0x5853('0x14'),_0x12a158,_0x149e6f[_0x5853('0x13')]['message']);return _0x13a3fe(_0x149e6f[_0x5853('0x13')][_0x5853('0x15')]);}logger[_0x5853('0x13')](_0x5853('0x14'),_0x12a158,_0x149e6f[_0x5853('0x13')][_0x5853('0x15')]);return _0x59095c(_0x149e6f[_0x5853('0x13')][_0x5853('0x15')]);}else{logger[_0x5853('0xe')](_0x5853('0x14'),_0x12a158,_0x5853('0xf'));_0x59095c(_0x149e6f[_0x5853('0x16')]['message']);}})['catch'](function(_0x5bb28d){logger[_0x5853('0x13')](_0x5853('0x14'),_0x12a158,_0x5bb28d);_0x13a3fe(_0x5bb28d);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 035d48f..cbb61b9 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 _0xa177=['isAuthenticated','index','show','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','addActions','put','/:id','delete','destroy','exports','path','express','Router','../../components/interaction/service','../../config/environment','./automation.controller','get'];(function(_0x53cd39,_0x10a792){var _0x3806e9=function(_0x91f763){while(--_0x91f763){_0x53cd39['push'](_0x53cd39['shift']());}};_0x3806e9(++_0x10a792);}(_0xa177,0x143));var _0x7a17=function(_0x42d779,_0x2065a5){_0x42d779=_0x42d779-0x0;var _0x133e68=_0xa177[_0x42d779];return _0x133e68;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7a17('0x0'));var timeout=require('connect-timeout');var express=require(_0x7a17('0x1'));var router=express[_0x7a17('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x7a17('0x3'));var config=require(_0x7a17('0x4'));var controller=require(_0x7a17('0x5'));router[_0x7a17('0x6')]('/',auth[_0x7a17('0x7')](),controller[_0x7a17('0x8')]);router[_0x7a17('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x7a17('0x9')]);router[_0x7a17('0x6')](_0x7a17('0xa'),auth[_0x7a17('0x7')](),controller[_0x7a17('0xb')]);router[_0x7a17('0x6')](_0x7a17('0xc'),auth['isAuthenticated'](),controller[_0x7a17('0xd')]);router[_0x7a17('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x7a17('0xa'),auth[_0x7a17('0x7')](),controller[_0x7a17('0xf')]);router[_0x7a17('0xe')](_0x7a17('0xc'),auth['isAuthenticated'](),controller[_0x7a17('0x10')]);router[_0x7a17('0x11')](_0x7a17('0x12'),auth[_0x7a17('0x7')](),controller['update']);router[_0x7a17('0x13')](_0x7a17('0x12'),auth[_0x7a17('0x7')](),controller[_0x7a17('0x14')]);module[_0x7a17('0x15')]=router; \ No newline at end of file +var _0x1921=['show','get','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./automation.controller','isAuthenticated','index','/:id'];(function(_0x5612c8,_0xe5949c){var _0x136203=function(_0x558147){while(--_0x558147){_0x5612c8['push'](_0x5612c8['shift']());}};_0x136203(++_0xe5949c);}(_0x1921,0xe4));var _0x1192=function(_0x9f7bff,_0xa544ae){_0x9f7bff=_0x9f7bff-0x0;var _0x21956f=_0x1921[_0x9f7bff];return _0x21956f;};'use strict';var multer=require(_0x1192('0x0'));var util=require(_0x1192('0x1'));var path=require(_0x1192('0x2'));var timeout=require(_0x1192('0x3'));var express=require(_0x1192('0x4'));var router=express[_0x1192('0x5')]();var auth=require(_0x1192('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1192('0x7'));var controller=require(_0x1192('0x8'));router['get']('/',auth[_0x1192('0x9')](),controller[_0x1192('0xa')]);router['get'](_0x1192('0xb'),auth[_0x1192('0x9')](),controller[_0x1192('0xc')]);router[_0x1192('0xd')](_0x1192('0xe'),auth[_0x1192('0x9')](),controller[_0x1192('0xf')]);router[_0x1192('0xd')](_0x1192('0x10'),auth[_0x1192('0x9')](),controller[_0x1192('0x11')]);router[_0x1192('0x12')]('/',auth[_0x1192('0x9')](),controller[_0x1192('0x13')]);router[_0x1192('0x12')](_0x1192('0xe'),auth[_0x1192('0x9')](),controller[_0x1192('0x14')]);router[_0x1192('0x12')](_0x1192('0x10'),auth[_0x1192('0x9')](),controller['addActions']);router['put'](_0x1192('0xb'),auth[_0x1192('0x9')](),controller[_0x1192('0x15')]);router[_0x1192('0x16')](_0x1192('0xb'),auth[_0x1192('0x9')](),controller['destroy']);module[_0x1192('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index c3112b5..e0e6c10 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 _0x8b2a=['#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','ENUM','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence'];(function(_0x3825a8,_0x2ce1a2){var _0xabc9bc=function(_0x101073){while(--_0x101073){_0x3825a8['push'](_0x3825a8['shift']());}};_0xabc9bc(++_0x2ce1a2);}(_0x8b2a,0x145));var _0xa8b2=function(_0x3920b4,_0x4cd07a){_0x3920b4=_0x3920b4-0x0;var _0x1ef94f=_0x8b2a[_0x3920b4];return _0x1ef94f;};'use strict';var Sequelize=require(_0xa8b2('0x0'));module[_0xa8b2('0x1')]={'name':{'type':Sequelize[_0xa8b2('0x2')],'unique':_0xa8b2('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xa8b2('0x4')),'allowNull':![],'defaultValue':_0xa8b2('0x4')},'description':{'type':Sequelize[_0xa8b2('0x2')]},'active':{'type':Sequelize[_0xa8b2('0x5')],'defaultValue':0x0,'comment':_0xa8b2('0x6')},'limitCalls':{'type':Sequelize[_0xa8b2('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xa8b2('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xa8b2('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xa8b2('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xa8b2('0x7')](0x3)[_0xa8b2('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa8b2('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xa8b2('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa8b2('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xa8b2('0x7')](0x3)[_0xa8b2('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa8b2('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xa8b2('0x7')](0x5)[_0xa8b2('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa8b2('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa8b2('0x7')](0x3)[_0xa8b2('0x9')],'defaultValue':0x3,'comment':_0xa8b2('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xa8b2('0x7')](0x5)[_0xa8b2('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa8b2('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0xa8b2('0x7')](0x3)[_0xa8b2('0x9')],'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[_0xa8b2('0x2')],'defaultValue':_0xa8b2('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xa8b2('0x11')](_0xa8b2('0x12'),'never',_0xa8b2('0x13')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xa8b2('0x7')](0x9)[_0xa8b2('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa8b2('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xa8b2('0x7')](0x9)[_0xa8b2('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xa8b2('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa8b2('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xa8b2('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xa8b2('0x7')](0x9)[_0xa8b2('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa8b2('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xa8b2('0x7')](0x9)[_0xa8b2('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xa8b2('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xa8b2('0x7')](0x9)[_0xa8b2('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa8b2('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xa8b2('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa8b2('0x7')](0x5)[_0xa8b2('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa8b2('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa8b2('0x7')](0x9)[_0xa8b2('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0xa8b2('0x1c')),'defaultValue':_0xa8b2('0x1d')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa8b2('0x7')](0x3)[_0xa8b2('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa8b2('0x1e')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xa8b2('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa8b2('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa8b2('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa8b2('0x7')](0x5)[_0xa8b2('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa8b2('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0xa8b2('0x7')](0x3)[_0xa8b2('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa8b2('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0xa8b2('0x7')](0x5)[_0xa8b2('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa8b2('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa8b2('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa8b2('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa8b2('0x7')](0x5)[_0xa8b2('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xa8b2('0x7')](0x3)[_0xa8b2('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa8b2('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0xa8b2('0x7')](0x5)[_0xa8b2('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa8b2('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xa8b2('0x7')](0x3)[_0xa8b2('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xa8b2('0x7')](0x5)[_0xa8b2('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa8b2('0x26')}}; \ No newline at end of file +var _0x2458=['#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2458,0x182));var _0x8245=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x2458[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x8245('0x0'));module['exports']={'name':{'type':Sequelize[_0x8245('0x1')],'unique':_0x8245('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x8245('0x3')](_0x8245('0x4')),'allowNull':![],'defaultValue':_0x8245('0x4')},'description':{'type':Sequelize[_0x8245('0x1')]},'active':{'type':Sequelize[_0x8245('0x5')],'defaultValue':0x0,'comment':_0x8245('0x6')},'limitCalls':{'type':Sequelize[_0x8245('0x7')](0x4)[_0x8245('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x8245('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8245('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x8245('0x7')](0x3)[_0x8245('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8245('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8245('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8245('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8245('0x7')](0x5)[_0x8245('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8245('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x8245('0x7')](0x5)[_0x8245('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8245('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8245('0x8')],'defaultValue':0x3,'comment':_0x8245('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8245('0x7')](0x5)[_0x8245('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8245('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x8245('0x7')](0x3)[_0x8245('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8245('0x10')},'dialTimezone':{'type':Sequelize[_0x8245('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x8245('0x11'),_0x8245('0x12'),_0x8245('0x13')),'defaultValue':_0x8245('0x11')},'dialAMDActive':{'type':Sequelize[_0x8245('0x5')],'defaultValue':0x0,'comment':_0x8245('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x8245('0x7')](0x9)[_0x8245('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8245('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x8245('0x7')](0x9)[_0x8245('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8245('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8245('0x7')](0x9)[_0x8245('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8245('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8245('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x8245('0x7')](0x9)[_0x8245('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8245('0x7')](0x9)[_0x8245('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8245('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8245('0x7')](0x9)[_0x8245('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x8245('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8245('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8245('0x7')](0x9)[_0x8245('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x8245('0x3')](_0x8245('0x1a'),'ASC'),'defaultValue':_0x8245('0x1a')},'dialPrefix':{'type':Sequelize[_0x8245('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8245('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8245('0x1b')},'dialCutDigit':{'type':Sequelize[_0x8245('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8245('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8245('0x7')](0x3)[_0x8245('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8245('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8245('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x8245('0x7')](0x3)[_0x8245('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8245('0x1e')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8245('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8245('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8245('0x7')](0x3)[_0x8245('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8245('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8245('0x7')](0x5)[_0x8245('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8245('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0x8245('0x7')](0x3)[_0x8245('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8245('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0x8245('0x7')](0x5)[_0x8245('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x8245('0x7')](0x3)[_0x8245('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8245('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8245('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8245('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 5891c26..555a3d4 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 _0xaa0b=['request-promise','moment','util','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','end','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','Campaign','include','findAll','catch','show','params','includeAll','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','userProfileId','getHoppers','findOne','CmHopper','pick','CampaignId','CmHopperHistory','CmHopperFinal','rows','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','scheduledAt','ContactId','select','field','phone','NOW()','CmListId','ListId','toString','from','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','cm_hopper','CampaignId\x20=\x20?','onlyIfOpen','fromQuery','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','fast-json-patch'];(function(_0x2c2b98,_0x51b5b3){var _0x5be3ae=function(_0xc3aaa1){while(--_0xc3aaa1){_0x2c2b98['push'](_0x2c2b98['shift']());}};_0x5be3ae(++_0x51b5b3);}(_0xaa0b,0x7f));var _0xbaa0=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xaa0b[_0x1cc8fe];return _0x230054;};'use strict';var pdf=require(_0xbaa0('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbaa0('0x1'));var rp=require(_0xbaa0('0x2'));var moment=require(_0xbaa0('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbaa0('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xbaa0('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbaa0('0x6'));var squel=require(_0xbaa0('0x7'));var crypto=require(_0xbaa0('0x8'));var jsforce=require(_0xbaa0('0x9'));var deskjs=require(_0xbaa0('0xa'));var toCsv=require(_0xbaa0('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbaa0('0xb'));var authService=require(_0xbaa0('0xc'));var qs=require(_0xbaa0('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbaa0('0xe'));var logger=require(_0xbaa0('0xf'))(_0xbaa0('0x10'));var utils=require(_0xbaa0('0x11'));var config=require(_0xbaa0('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1279ae,_0x41037a){_0x41037a=_0x41037a||0xcc;return function(_0x24f6c1){if(_0x24f6c1){return _0x1279ae['sendStatus'](_0x41037a);}return _0x1279ae['status'](_0x41037a)['end']();};}function respondWithResult(_0x1336de,_0x4afb02){_0x4afb02=_0x4afb02||0xc8;return function(_0xdeda8f){if(_0xdeda8f){return _0x1336de[_0xbaa0('0x13')](_0x4afb02)[_0xbaa0('0x14')](_0xdeda8f);}};}function respondWithFilteredResult(_0x4154c6,_0x4047b6){return function(_0xeae196){if(_0xeae196){var _0x26a513=_0xeae196[_0xbaa0('0x15')],_0x1b731e=_0x4047b6[_0xbaa0('0x16')],_0x221971=_0x4047b6[_0xbaa0('0x16')]+_0x4047b6[_0xbaa0('0x17')],_0x707178;if(_0x221971>=_0x26a513){_0x221971=_0x26a513;_0x707178=0xc8;}else{_0x707178=0xce;}_0x4154c6[_0xbaa0('0x13')](_0x707178);return _0x4154c6[_0xbaa0('0x18')](_0xbaa0('0x19'),_0x1b731e+'-'+_0x221971+'/'+_0x26a513)['json'](_0xeae196);}return null;};}function patchUpdates(_0xb1341e){return function(_0x37645a){try{jsonpatch[_0xbaa0('0x1a')](_0x37645a,_0xb1341e,!![]);}catch(_0x214aed){return BPromise[_0xbaa0('0x1b')](_0x214aed);}return _0x37645a[_0xbaa0('0x1c')]();};}function saveUpdates(_0x917bf,_0x327594){return function(_0x2ac3f7){if(_0x2ac3f7){return _0x2ac3f7[_0xbaa0('0x1d')](_0x917bf)[_0xbaa0('0x1e')](function(_0x94b433){return _0x94b433;});}return null;};}function removeEntity(_0x5a8a1c,_0x24fbf0){return function(_0x4cea1c){if(_0x4cea1c){return _0x4cea1c[_0xbaa0('0x1f')]()['then'](function(){var _0x30eda8=_0x4cea1c[_0xbaa0('0x20')]({'plain':!![]});var _0x67e3b4=_0xbaa0('0x21');return db[_0xbaa0('0x22')]['destroy']({'where':{'type':_0x67e3b4,'resourceId':_0x30eda8['id']}})[_0xbaa0('0x1e')](function(){return _0x4cea1c;});})[_0xbaa0('0x1e')](function(){_0x5a8a1c[_0xbaa0('0x13')](0xcc)[_0xbaa0('0x23')]();});}};}function handleEntityNotFound(_0x49b98d,_0x5d1c47){return function(_0x25e0b5){if(!_0x25e0b5){_0x49b98d[_0xbaa0('0x24')](0x194);}return _0x25e0b5;};}function handleError(_0x6edbba,_0x384ff0){_0x384ff0=_0x384ff0||0x1f4;return function(_0x259e83){logger[_0xbaa0('0x25')](_0x259e83[_0xbaa0('0x26')]);if(_0x259e83[_0xbaa0('0x27')]){delete _0x259e83[_0xbaa0('0x27')];}_0x6edbba[_0xbaa0('0x13')](_0x384ff0)[_0xbaa0('0x28')](_0x259e83);};}exports['index']=function(_0x2f8784,_0x9f77){var _0x4df494={},_0x545063={},_0x3657d6={'count':0x0,'rows':[]};var _0x59a1c5=_[_0xbaa0('0x29')](db['Campaign'][_0xbaa0('0x2a')],function(_0x4619f5){return{'name':_0x4619f5[_0xbaa0('0x2b')],'type':_0x4619f5[_0xbaa0('0x2c')]['key']};});_0x545063[_0xbaa0('0x2d')]=_[_0xbaa0('0x29')](_0x59a1c5,_0xbaa0('0x27'));_0x545063[_0xbaa0('0x2e')]=_[_0xbaa0('0x2f')](_0x2f8784[_0xbaa0('0x2e')]);_0x545063[_0xbaa0('0x30')]=_[_0xbaa0('0x31')](_0x545063[_0xbaa0('0x2d')],_0x545063[_0xbaa0('0x2e')]);_0x4df494[_0xbaa0('0x32')]=_['intersection'](_0x545063[_0xbaa0('0x2d')],qs[_0xbaa0('0x33')](_0x2f8784[_0xbaa0('0x2e')][_0xbaa0('0x33')]));_0x4df494[_0xbaa0('0x32')]=_0x4df494['attributes'][_0xbaa0('0x34')]?_0x4df494['attributes']:_0x545063['model'];if(!_0x2f8784['query'][_0xbaa0('0x35')](_0xbaa0('0x36'))){_0x4df494['limit']=qs[_0xbaa0('0x17')](_0x2f8784[_0xbaa0('0x2e')][_0xbaa0('0x17')]);_0x4df494[_0xbaa0('0x16')]=qs[_0xbaa0('0x16')](_0x2f8784['query'][_0xbaa0('0x16')]);}_0x4df494[_0xbaa0('0x37')]=qs[_0xbaa0('0x38')](_0x2f8784[_0xbaa0('0x2e')][_0xbaa0('0x38')]);_0x4df494[_0xbaa0('0x39')]=qs[_0xbaa0('0x30')](_['pick'](_0x2f8784['query'],_0x545063['filters']),_0x59a1c5);if(_0x2f8784[_0xbaa0('0x2e')][_0xbaa0('0x3a')]){_0x4df494['where']=_['merge'](_0x4df494[_0xbaa0('0x39')],{'$or':_[_0xbaa0('0x29')](_0x59a1c5,function(_0x1a2312){if(_0x1a2312[_0xbaa0('0x2c')]!==_0xbaa0('0x3b')){var _0x3e29c7={};_0x3e29c7[_0x1a2312[_0xbaa0('0x27')]]={'$like':'%'+_0x2f8784[_0xbaa0('0x2e')][_0xbaa0('0x3a')]+'%'};return _0x3e29c7;}})});}_0x4df494=_[_0xbaa0('0x3c')]({},_0x4df494,_0x2f8784[_0xbaa0('0x3d')]);var _0x24d632={'where':_0x4df494[_0xbaa0('0x39')]};return db[_0xbaa0('0x3e')][_0xbaa0('0x15')](_0x24d632)[_0xbaa0('0x1e')](function(_0x14d4d9){_0x3657d6['count']=_0x14d4d9;if(_0x2f8784[_0xbaa0('0x2e')]['includeAll']){_0x4df494[_0xbaa0('0x3f')]=[{'all':!![]}];}return db[_0xbaa0('0x3e')][_0xbaa0('0x40')](_0x4df494);})['then'](function(_0x5824c1){_0x3657d6['rows']=_0x5824c1;return _0x3657d6;})[_0xbaa0('0x1e')](respondWithFilteredResult(_0x9f77,_0x4df494))[_0xbaa0('0x41')](handleError(_0x9f77,null));};exports[_0xbaa0('0x42')]=function(_0x494e42,_0x5e7858){var _0x42063f={'raw':![],'where':{'id':_0x494e42[_0xbaa0('0x43')]['id']}},_0xdb18ed={};_0xdb18ed[_0xbaa0('0x2d')]=_['keys'](db['Campaign'][_0xbaa0('0x2a')]);_0xdb18ed[_0xbaa0('0x2e')]=_[_0xbaa0('0x2f')](_0x494e42[_0xbaa0('0x2e')]);_0xdb18ed[_0xbaa0('0x30')]=_[_0xbaa0('0x31')](_0xdb18ed['model'],_0xdb18ed[_0xbaa0('0x2e')]);_0x42063f[_0xbaa0('0x32')]=_[_0xbaa0('0x31')](_0xdb18ed[_0xbaa0('0x2d')],qs[_0xbaa0('0x33')](_0x494e42[_0xbaa0('0x2e')]['fields']));_0x42063f[_0xbaa0('0x32')]=_0x42063f['attributes'][_0xbaa0('0x34')]?_0x42063f[_0xbaa0('0x32')]:_0xdb18ed['model'];if(_0x494e42['query'][_0xbaa0('0x44')]){_0x42063f[_0xbaa0('0x3f')]=[{'all':!![]}];}_0x42063f=_[_0xbaa0('0x3c')]({},_0x42063f,_0x494e42[_0xbaa0('0x3d')]);return db[_0xbaa0('0x3e')][_0xbaa0('0x45')](_0x42063f)[_0xbaa0('0x1e')](handleEntityNotFound(_0x5e7858,null))['then'](respondWithResult(_0x5e7858,null))[_0xbaa0('0x41')](handleError(_0x5e7858,null));};exports[_0xbaa0('0x46')]=function(_0x45b70d,_0x3bccd0){return db['Campaign'][_0xbaa0('0x46')](_0x45b70d[_0xbaa0('0x47')],{})[_0xbaa0('0x1e')](function(_0x2514e8){var _0x25ef89=_0x45b70d[_0xbaa0('0x48')][_0xbaa0('0x20')]({'plain':!![]});if(!_0x25ef89)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25ef89['role']===_0xbaa0('0x48')){var _0xe2d756=_0x2514e8[_0xbaa0('0x20')]({'plain':!![]});var _0x3f2f4e=_0xbaa0('0x21');return db[_0xbaa0('0x49')][_0xbaa0('0x45')]({'where':{'name':_0x3f2f4e,'userProfileId':_0x25ef89['userProfileId']},'raw':!![]})[_0xbaa0('0x1e')](function(_0x5aafb5){if(_0x5aafb5&&_0x5aafb5[_0xbaa0('0x4a')]===0x0){return db[_0xbaa0('0x22')]['create']({'name':_0xe2d756['name'],'resourceId':_0xe2d756['id'],'type':_0x5aafb5[_0xbaa0('0x27')],'sectionId':_0x5aafb5['id']},{})[_0xbaa0('0x1e')](function(){return _0x2514e8;});}else{return _0x2514e8;}})[_0xbaa0('0x41')](function(_0xd9152b){logger[_0xbaa0('0x25')](_0xbaa0('0x4b'),_0xd9152b);throw _0xd9152b;});}return _0x2514e8;})['then'](respondWithResult(_0x3bccd0,0xc9))[_0xbaa0('0x41')](handleError(_0x3bccd0,null));};exports[_0xbaa0('0x4c')]=function(_0x57aa29,_0x1188d6){var _0x37f0a5={'where':{'id':_0x57aa29[_0xbaa0('0x43')]['id']}},_0x33de1b={};_0x33de1b[_0xbaa0('0x2d')]=_[_0xbaa0('0x2f')](db['Campaign']['rawAttributes']);_0x37f0a5[_0xbaa0('0x32')]=_[_0xbaa0('0x31')](_0x33de1b['model'],qs['fields'](_0x57aa29[_0xbaa0('0x2e')][_0xbaa0('0x33')]));_0x37f0a5[_0xbaa0('0x32')]=_0x37f0a5['attributes']['length']?_0x37f0a5[_0xbaa0('0x32')]:_0x33de1b[_0xbaa0('0x2d')];if(_0x57aa29[_0xbaa0('0x2e')][_0xbaa0('0x44')]){_0x37f0a5['include']=[{'all':!![]}];}_0x37f0a5=_[_0xbaa0('0x3c')]({},_0x37f0a5,_0x57aa29['options']);return db['Campaign'][_0xbaa0('0x45')](_0x37f0a5)[_0xbaa0('0x1e')](handleEntityNotFound(_0x1188d6,null))[_0xbaa0('0x1e')](function(_0x1a1eba){if(_0x1a1eba){var _0x558ad5=_0x1a1eba[_0xbaa0('0x20')]({'plain':!![]});_0x558ad5=qs['omit'](_0x558ad5,['id',_0xbaa0('0x4d'),_0xbaa0('0x4e')]);_0x57aa29[_0xbaa0('0x47')]=_[_0xbaa0('0x4f')](_0x57aa29[_0xbaa0('0x47')],['id','createdAt',_0xbaa0('0x4e')]);return db[_0xbaa0('0x3e')][_0xbaa0('0x46')](_['merge'](_0x558ad5,_0x57aa29[_0xbaa0('0x47')]),{'include':_0x57aa29[_0xbaa0('0x2e')][_0xbaa0('0x44')]?[{'all':!![]}]:undefined})[_0xbaa0('0x1e')](function(_0x4dbba1){var _0x493beb=_0x57aa29[_0xbaa0('0x48')][_0xbaa0('0x20')]({'plain':!![]});if(!_0x493beb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x493beb['role']==='user'){var _0x4dfcb9=_0x4dbba1[_0xbaa0('0x20')]({'plain':!![]});var _0x17a0d5=_0xbaa0('0x21');return db[_0xbaa0('0x49')]['find']({'where':{'name':_0x17a0d5,'userProfileId':_0x493beb[_0xbaa0('0x50')]},'raw':!![]})[_0xbaa0('0x1e')](function(_0x3f97cf){if(_0x3f97cf&&_0x3f97cf['autoAssociation']===0x0){return db[_0xbaa0('0x22')][_0xbaa0('0x46')]({'name':_0x4dfcb9[_0xbaa0('0x27')],'resourceId':_0x4dfcb9['id'],'type':_0x3f97cf[_0xbaa0('0x27')],'sectionId':_0x3f97cf['id']},{})[_0xbaa0('0x1e')](function(){return _0x4dbba1;});}else{return _0x4dbba1;}})[_0xbaa0('0x41')](function(_0x4bd45f){logger[_0xbaa0('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bd45f);throw _0x4bd45f;});}return _0x4dbba1;});}})[_0xbaa0('0x1e')](respondWithResult(_0x1188d6,0xc9))[_0xbaa0('0x41')](handleError(_0x1188d6,null));};exports[_0xbaa0('0x1d')]=function(_0x161e20,_0x1c2e7f){if(_0x161e20['body']['id']){delete _0x161e20[_0xbaa0('0x47')]['id'];}return db['Campaign'][_0xbaa0('0x45')]({'where':{'id':_0x161e20['params']['id']}})['then'](handleEntityNotFound(_0x1c2e7f,null))['then'](saveUpdates(_0x161e20['body'],null))['then'](respondWithResult(_0x1c2e7f,null))[_0xbaa0('0x41')](handleError(_0x1c2e7f,null));};exports['destroy']=function(_0x44deb4,_0x3d4a6e){return db['Campaign'][_0xbaa0('0x45')]({'where':{'id':_0x44deb4[_0xbaa0('0x43')]['id']}})['then'](handleEntityNotFound(_0x3d4a6e,null))[_0xbaa0('0x1e')](removeEntity(_0x3d4a6e,null))[_0xbaa0('0x41')](handleError(_0x3d4a6e,null));};exports[_0xbaa0('0x51')]=function(_0x36a332,_0x410bf9,_0x5a204a){var _0x1e0249={'raw':!![],'where':{}};var _0x408562={};var _0x4ba05b={'count':0x0,'rows':[]};return db['Campaign'][_0xbaa0('0x52')]({'where':{'id':_0x36a332['params']['id']}})['then'](handleEntityNotFound(_0x410bf9,null))[_0xbaa0('0x1e')](function(_0xbfeb3f){if(_0xbfeb3f){_0x408562['model']=_['keys'](db[_0xbaa0('0x53')]['rawAttributes']);_0x408562[_0xbaa0('0x2e')]=_[_0xbaa0('0x2f')](_0x36a332['query']);_0x408562[_0xbaa0('0x30')]=_[_0xbaa0('0x31')](_0x408562['model'],_0x408562[_0xbaa0('0x2e')]);_0x1e0249[_0xbaa0('0x32')]=_[_0xbaa0('0x31')](_0x408562[_0xbaa0('0x2d')],qs[_0xbaa0('0x33')](_0x36a332[_0xbaa0('0x2e')]['fields']));_0x1e0249[_0xbaa0('0x32')]=_0x1e0249[_0xbaa0('0x32')]['length']?_0x1e0249[_0xbaa0('0x32')]:_0x408562[_0xbaa0('0x2d')];if(!_0x36a332[_0xbaa0('0x2e')][_0xbaa0('0x35')](_0xbaa0('0x36'))){_0x1e0249[_0xbaa0('0x17')]=qs[_0xbaa0('0x17')](_0x36a332[_0xbaa0('0x2e')][_0xbaa0('0x17')]);_0x1e0249['offset']=qs[_0xbaa0('0x16')](_0x36a332['query'][_0xbaa0('0x16')]);}_0x1e0249[_0xbaa0('0x37')]=qs['sort'](_0x36a332[_0xbaa0('0x2e')]['sort']);_0x1e0249[_0xbaa0('0x39')]=qs[_0xbaa0('0x30')](_[_0xbaa0('0x54')](_0x36a332[_0xbaa0('0x2e')],_0x408562['filters']));_0x1e0249[_0xbaa0('0x39')][_0xbaa0('0x55')]=_0xbfeb3f['id'];if(_0x36a332[_0xbaa0('0x2e')][_0xbaa0('0x3a')]){_0x1e0249['where']=_[_0xbaa0('0x3c')](_0x1e0249['where'],{'$or':_[_0xbaa0('0x29')](_0x1e0249['attributes'],function(_0x3c4ea8){var _0x5ee155={};_0x5ee155[_0x3c4ea8]={'$like':'%'+_0x36a332[_0xbaa0('0x2e')][_0xbaa0('0x3a')]+'%'};return _0x5ee155;})});}_0x1e0249=_[_0xbaa0('0x3c')]({},_0x1e0249,_0x36a332['options']);return db[_0xbaa0('0x53')][_0xbaa0('0x15')]({'where':_0x1e0249[_0xbaa0('0x39')]})[_0xbaa0('0x1e')](function(_0x1a2c22){_0x4ba05b[_0xbaa0('0x15')]=_0x1a2c22;if(_0x36a332[_0xbaa0('0x2e')][_0xbaa0('0x44')]){_0x1e0249[_0xbaa0('0x3f')]=[{'all':!![]}];}return db['CmHopper'][_0xbaa0('0x40')](_0x1e0249);})[_0xbaa0('0x1e')](function(_0x190d49){_0x4ba05b['rows']=_0x190d49;return _0x4ba05b;});}})[_0xbaa0('0x1e')](respondWithFilteredResult(_0x410bf9,_0x1e0249))['catch'](handleError(_0x410bf9,null));};exports['getHopperHistories']=function(_0x34ae8e,_0xfcd9fa,_0x5e9c8a){var _0x3b505e={'raw':!![],'where':{}};var _0x2a6c29={};var _0x4db2ec={'count':0x0,'rows':[]};return db['Campaign'][_0xbaa0('0x52')]({'where':{'id':_0x34ae8e['params']['id']}})[_0xbaa0('0x1e')](handleEntityNotFound(_0xfcd9fa,null))[_0xbaa0('0x1e')](function(_0x33e830){if(_0x33e830){_0x2a6c29[_0xbaa0('0x2d')]=_[_0xbaa0('0x2f')](db[_0xbaa0('0x56')][_0xbaa0('0x2a')]);_0x2a6c29[_0xbaa0('0x2e')]=_[_0xbaa0('0x2f')](_0x34ae8e[_0xbaa0('0x2e')]);_0x2a6c29[_0xbaa0('0x30')]=_['intersection'](_0x2a6c29['model'],_0x2a6c29[_0xbaa0('0x2e')]);_0x3b505e['attributes']=_[_0xbaa0('0x31')](_0x2a6c29[_0xbaa0('0x2d')],qs[_0xbaa0('0x33')](_0x34ae8e[_0xbaa0('0x2e')][_0xbaa0('0x33')]));_0x3b505e[_0xbaa0('0x32')]=_0x3b505e[_0xbaa0('0x32')][_0xbaa0('0x34')]?_0x3b505e['attributes']:_0x2a6c29[_0xbaa0('0x2d')];if(!_0x34ae8e[_0xbaa0('0x2e')][_0xbaa0('0x35')](_0xbaa0('0x36'))){_0x3b505e[_0xbaa0('0x17')]=qs['limit'](_0x34ae8e[_0xbaa0('0x2e')][_0xbaa0('0x17')]);_0x3b505e[_0xbaa0('0x16')]=qs[_0xbaa0('0x16')](_0x34ae8e[_0xbaa0('0x2e')][_0xbaa0('0x16')]);}_0x3b505e[_0xbaa0('0x37')]=qs['sort'](_0x34ae8e['query'][_0xbaa0('0x38')]);_0x3b505e['where']=qs[_0xbaa0('0x30')](_[_0xbaa0('0x54')](_0x34ae8e['query'],_0x2a6c29[_0xbaa0('0x30')]));_0x3b505e[_0xbaa0('0x39')]['CampaignId']=_0x33e830['id'];if(_0x34ae8e['query']['filter']){_0x3b505e[_0xbaa0('0x39')]=_[_0xbaa0('0x3c')](_0x3b505e[_0xbaa0('0x39')],{'$or':_[_0xbaa0('0x29')](_0x3b505e[_0xbaa0('0x32')],function(_0xc2bf5d){var _0x37eeba={};_0x37eeba[_0xc2bf5d]={'$like':'%'+_0x34ae8e[_0xbaa0('0x2e')][_0xbaa0('0x3a')]+'%'};return _0x37eeba;})});}_0x3b505e=_[_0xbaa0('0x3c')]({},_0x3b505e,_0x34ae8e[_0xbaa0('0x3d')]);return db[_0xbaa0('0x56')][_0xbaa0('0x15')]({'where':_0x3b505e[_0xbaa0('0x39')]})[_0xbaa0('0x1e')](function(_0x27e52d){_0x4db2ec[_0xbaa0('0x15')]=_0x27e52d;if(_0x34ae8e[_0xbaa0('0x2e')]['includeAll']){_0x3b505e[_0xbaa0('0x3f')]=[{'all':!![]}];}return db[_0xbaa0('0x56')]['findAll'](_0x3b505e);})[_0xbaa0('0x1e')](function(_0x2cae34){_0x4db2ec['rows']=_0x2cae34;return _0x4db2ec;});}})[_0xbaa0('0x1e')](respondWithFilteredResult(_0xfcd9fa,_0x3b505e))[_0xbaa0('0x41')](handleError(_0xfcd9fa,null));};exports['getHopperFinals']=function(_0x52ade1,_0x2e3b8e,_0x36827f){var _0x38ee3f={'raw':!![],'where':{}};var _0x24f0bd={};var _0x12898d={'count':0x0,'rows':[]};return db[_0xbaa0('0x3e')]['findOne']({'where':{'id':_0x52ade1['params']['id']}})['then'](handleEntityNotFound(_0x2e3b8e,null))[_0xbaa0('0x1e')](function(_0xa9d4ca){if(_0xa9d4ca){_0x24f0bd[_0xbaa0('0x2d')]=_[_0xbaa0('0x2f')](db['CmHopperFinal'][_0xbaa0('0x2a')]);_0x24f0bd[_0xbaa0('0x2e')]=_[_0xbaa0('0x2f')](_0x52ade1['query']);_0x24f0bd[_0xbaa0('0x30')]=_['intersection'](_0x24f0bd['model'],_0x24f0bd[_0xbaa0('0x2e')]);_0x38ee3f[_0xbaa0('0x32')]=_[_0xbaa0('0x31')](_0x24f0bd[_0xbaa0('0x2d')],qs[_0xbaa0('0x33')](_0x52ade1[_0xbaa0('0x2e')][_0xbaa0('0x33')]));_0x38ee3f['attributes']=_0x38ee3f[_0xbaa0('0x32')][_0xbaa0('0x34')]?_0x38ee3f['attributes']:_0x24f0bd[_0xbaa0('0x2d')];if(!_0x52ade1['query'][_0xbaa0('0x35')](_0xbaa0('0x36'))){_0x38ee3f[_0xbaa0('0x17')]=qs['limit'](_0x52ade1[_0xbaa0('0x2e')][_0xbaa0('0x17')]);_0x38ee3f['offset']=qs[_0xbaa0('0x16')](_0x52ade1[_0xbaa0('0x2e')][_0xbaa0('0x16')]);}_0x38ee3f[_0xbaa0('0x37')]=qs['sort'](_0x52ade1[_0xbaa0('0x2e')][_0xbaa0('0x38')]);_0x38ee3f[_0xbaa0('0x39')]=qs[_0xbaa0('0x30')](_['pick'](_0x52ade1[_0xbaa0('0x2e')],_0x24f0bd[_0xbaa0('0x30')]));_0x38ee3f[_0xbaa0('0x39')]['CampaignId']=_0xa9d4ca['id'];if(_0x52ade1['query']['filter']){_0x38ee3f[_0xbaa0('0x39')]=_['merge'](_0x38ee3f[_0xbaa0('0x39')],{'$or':_[_0xbaa0('0x29')](_0x38ee3f[_0xbaa0('0x32')],function(_0x167fac){var _0x1148a2={};_0x1148a2[_0x167fac]={'$like':'%'+_0x52ade1[_0xbaa0('0x2e')][_0xbaa0('0x3a')]+'%'};return _0x1148a2;})});}_0x38ee3f=_['merge']({},_0x38ee3f,_0x52ade1[_0xbaa0('0x3d')]);return db[_0xbaa0('0x57')]['count']({'where':_0x38ee3f[_0xbaa0('0x39')]})[_0xbaa0('0x1e')](function(_0x7e1f8){_0x12898d[_0xbaa0('0x15')]=_0x7e1f8;if(_0x52ade1[_0xbaa0('0x2e')][_0xbaa0('0x44')]){_0x38ee3f['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xbaa0('0x40')](_0x38ee3f);})[_0xbaa0('0x1e')](function(_0x3a9792){_0x12898d[_0xbaa0('0x58')]=_0x3a9792;return _0x12898d;});}})[_0xbaa0('0x1e')](respondWithFilteredResult(_0x2e3b8e,_0x38ee3f))[_0xbaa0('0x41')](handleError(_0x2e3b8e,null));};exports[_0xbaa0('0x59')]=function(_0x12b4d6,_0x585fdc,_0x45c5a0){var _0x292919={'raw':!![],'where':{}};var _0x242d05={};var _0x29ec14={'count':0x0,'rows':[]};return db[_0xbaa0('0x3e')]['findOne']({'where':{'id':_0x12b4d6[_0xbaa0('0x43')]['id']}})['then'](handleEntityNotFound(_0x585fdc,null))[_0xbaa0('0x1e')](function(_0x22b358){if(_0x22b358){_0x242d05[_0xbaa0('0x2d')]=_['keys'](db[_0xbaa0('0x5a')][_0xbaa0('0x2a')]);_0x242d05['query']=_[_0xbaa0('0x2f')](_0x12b4d6['query']);_0x242d05[_0xbaa0('0x30')]=_[_0xbaa0('0x31')](_0x242d05[_0xbaa0('0x2d')],_0x242d05[_0xbaa0('0x2e')]);_0x292919[_0xbaa0('0x32')]=_[_0xbaa0('0x31')](_0x242d05[_0xbaa0('0x2d')],qs[_0xbaa0('0x33')](_0x12b4d6[_0xbaa0('0x2e')][_0xbaa0('0x33')]));_0x292919[_0xbaa0('0x32')]=_0x292919['attributes'][_0xbaa0('0x34')]?_0x292919[_0xbaa0('0x32')]:_0x242d05[_0xbaa0('0x2d')];if(!_0x12b4d6[_0xbaa0('0x2e')]['hasOwnProperty']('nolimit')){_0x292919[_0xbaa0('0x17')]=qs[_0xbaa0('0x17')](_0x12b4d6[_0xbaa0('0x2e')][_0xbaa0('0x17')]);_0x292919[_0xbaa0('0x16')]=qs[_0xbaa0('0x16')](_0x12b4d6[_0xbaa0('0x2e')][_0xbaa0('0x16')]);}_0x292919[_0xbaa0('0x37')]=qs[_0xbaa0('0x38')](_0x12b4d6[_0xbaa0('0x2e')][_0xbaa0('0x38')]);_0x292919['where']=qs['filters'](_[_0xbaa0('0x54')](_0x12b4d6['query'],_0x242d05[_0xbaa0('0x30')]));_0x292919[_0xbaa0('0x39')]['CampaignId']=_0x22b358['id'];if(_0x12b4d6[_0xbaa0('0x2e')][_0xbaa0('0x3a')]){_0x292919[_0xbaa0('0x39')]=_[_0xbaa0('0x3c')](_0x292919['where'],{'$or':_['map'](_0x292919[_0xbaa0('0x32')],function(_0x2e77d0){var _0x2b5a73={};_0x2b5a73[_0x2e77d0]={'$like':'%'+_0x12b4d6[_0xbaa0('0x2e')][_0xbaa0('0x3a')]+'%'};return _0x2b5a73;})});}_0x292919=_[_0xbaa0('0x3c')]({},_0x292919,_0x12b4d6[_0xbaa0('0x3d')]);return db[_0xbaa0('0x5a')][_0xbaa0('0x15')]({'where':_0x292919[_0xbaa0('0x39')]})[_0xbaa0('0x1e')](function(_0x555e37){_0x29ec14['count']=_0x555e37;if(_0x12b4d6[_0xbaa0('0x2e')][_0xbaa0('0x44')]){_0x292919[_0xbaa0('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xbaa0('0x40')](_0x292919);})['then'](function(_0x13bbf5){_0x29ec14[_0xbaa0('0x58')]=_0x13bbf5;return _0x29ec14;});}})[_0xbaa0('0x1e')](respondWithFilteredResult(_0x585fdc,_0x292919))[_0xbaa0('0x41')](handleError(_0x585fdc,null));};exports['getLists']=function(_0x40bd81,_0x2adeca,_0x4f8cb9){var _0x2bcead={};var _0x22a564={};var _0xb47b40;var _0x2b73ce;return db[_0xbaa0('0x3e')][_0xbaa0('0x52')]({'where':{'id':_0x40bd81[_0xbaa0('0x43')]['id']}})[_0xbaa0('0x1e')](handleEntityNotFound(_0x2adeca,null))['then'](function(_0x9b9bd){if(_0x9b9bd){_0xb47b40=_0x9b9bd;_0x22a564[_0xbaa0('0x2d')]=_[_0xbaa0('0x2f')](db[_0xbaa0('0x5b')][_0xbaa0('0x2a')]);_0x22a564[_0xbaa0('0x2e')]=_[_0xbaa0('0x2f')](_0x40bd81[_0xbaa0('0x2e')]);_0x22a564[_0xbaa0('0x30')]=_['intersection'](_0x22a564[_0xbaa0('0x2d')],_0x22a564['query']);_0x2bcead[_0xbaa0('0x32')]=_[_0xbaa0('0x31')](_0x22a564[_0xbaa0('0x2d')],qs[_0xbaa0('0x33')](_0x40bd81[_0xbaa0('0x2e')][_0xbaa0('0x33')]));_0x2bcead[_0xbaa0('0x32')]=_0x2bcead[_0xbaa0('0x32')][_0xbaa0('0x34')]?_0x2bcead[_0xbaa0('0x32')]:_0x22a564['model'];_0x2bcead[_0xbaa0('0x37')]=qs['sort'](_0x40bd81[_0xbaa0('0x2e')][_0xbaa0('0x38')]);_0x2bcead[_0xbaa0('0x39')]=qs[_0xbaa0('0x30')](_[_0xbaa0('0x54')](_0x40bd81[_0xbaa0('0x2e')],_0x22a564[_0xbaa0('0x30')]));if(_0x40bd81[_0xbaa0('0x2e')][_0xbaa0('0x3a')]){_0x2bcead[_0xbaa0('0x39')]=_[_0xbaa0('0x3c')](_0x2bcead[_0xbaa0('0x39')],{'$or':_[_0xbaa0('0x29')](_0x2bcead['attributes'],function(_0x48b9c7){var _0x57108b={};_0x57108b[_0x48b9c7]={'$like':'%'+_0x40bd81[_0xbaa0('0x2e')][_0xbaa0('0x3a')]+'%'};return _0x57108b;})});}_0x2bcead=_[_0xbaa0('0x3c')]({},_0x2bcead,_0x40bd81[_0xbaa0('0x3d')]);return _0xb47b40[_0xbaa0('0x5c')](_0x2bcead);}})[_0xbaa0('0x1e')](function(_0x3f75f0){if(_0x3f75f0){_0x2b73ce=_0x3f75f0['length'];if(!_0x40bd81[_0xbaa0('0x2e')][_0xbaa0('0x35')]('nolimit')){_0x2bcead['limit']=qs[_0xbaa0('0x17')](_0x40bd81[_0xbaa0('0x2e')][_0xbaa0('0x17')]);_0x2bcead['offset']=qs[_0xbaa0('0x16')](_0x40bd81[_0xbaa0('0x2e')]['offset']);}return _0xb47b40[_0xbaa0('0x5c')](_0x2bcead);}})[_0xbaa0('0x1e')](function(_0x2fd4e8){if(_0x2fd4e8){return _0x2fd4e8?{'count':_0x2b73ce,'rows':_0x2fd4e8}:null;}})[_0xbaa0('0x1e')](respondWithResult(_0x2adeca,null))[_0xbaa0('0x41')](handleError(_0x2adeca,null));};exports[_0xbaa0('0x5d')]=function(_0x2426cd,_0x32b6d6,_0x3a8490){var _0x136311,_0x37ae19;return db[_0xbaa0('0x3e')][_0xbaa0('0x45')]({'where':{'id':_0x2426cd['params']['id']}})[_0xbaa0('0x1e')](handleEntityNotFound(_0x32b6d6,null))[_0xbaa0('0x1e')](function(_0x5c6a3f){if(_0x5c6a3f){_0x37ae19=_0x5c6a3f;return _0x5c6a3f[_0xbaa0('0x5d')](_0x2426cd[_0xbaa0('0x47')][_0xbaa0('0x5e')],_[_0xbaa0('0x4f')](_0x2426cd[_0xbaa0('0x47')],[_0xbaa0('0x5e'),'id'])||{});}return null;})[_0xbaa0('0x5f')](function(_0x20fd73){var _0x181b97;_0x136311=_0x20fd73||[];var _0x85926d=[];if(_0x20fd73){for(var _0x22626f=0x0;_0x22626f<_0x20fd73[_0xbaa0('0x34')];_0x22626f+=0x1){var _0x59f971=_0x20fd73[_0x22626f][_0xbaa0('0x20')]({'plain':!![]});_0x37ae19[_0xbaa0('0x60')]=_0x2426cd[_0xbaa0('0x47')][_0xbaa0('0x60')]?_0x2426cd[_0xbaa0('0x47')][_0xbaa0('0x60')]:_0x37ae19[_0xbaa0('0x60')];switch(_0x37ae19[_0xbaa0('0x60')]){case _0xbaa0('0x61'):_0x181b97=squel[_0xbaa0('0x62')]()[_0xbaa0('0x63')]('cm_hopper')['fromQuery'](['phone',_0xbaa0('0x64'),_0xbaa0('0x65'),'ListId','CampaignId',_0xbaa0('0x4d'),'updatedAt'],squel[_0xbaa0('0x66')]()[_0xbaa0('0x67')](_0xbaa0('0x68'),_0xbaa0('0x68'))[_0xbaa0('0x67')](_0xbaa0('0x69'),_0xbaa0('0x64'))['field']('id',_0xbaa0('0x65'))[_0xbaa0('0x67')](_0x59f971[_0xbaa0('0x6a')]['toString'](),_0xbaa0('0x6b'))['field'](_0x2426cd[_0xbaa0('0x43')]['id'][_0xbaa0('0x6c')](),_0xbaa0('0x55'))[_0xbaa0('0x67')](_0xbaa0('0x69'),_0xbaa0('0x4d'))[_0xbaa0('0x67')](_0xbaa0('0x69'),_0xbaa0('0x4e'))[_0xbaa0('0x6d')](_0xbaa0('0x6e'))[_0xbaa0('0x39')]('deletedAt\x20IS\x20NULL')[_0xbaa0('0x39')]('ListId\x20=\x20?',_0x59f971['CmListId'][_0xbaa0('0x6c')]())['where'](_0xbaa0('0x6f'))[_0xbaa0('0x39')](_0xbaa0('0x70'),squel[_0xbaa0('0x66')]()[_0xbaa0('0x67')](_0xbaa0('0x71'))[_0xbaa0('0x6d')](_0xbaa0('0x72'))[_0xbaa0('0x39')]('CampaignId\x20=\x20?',_0x2426cd[_0xbaa0('0x43')]['id'][_0xbaa0('0x6c')]()))['where'](_0xbaa0('0x70'),squel[_0xbaa0('0x66')]()[_0xbaa0('0x67')]('COALESCE(phone,\x27\x27)')[_0xbaa0('0x6d')](_0xbaa0('0x73'))[_0xbaa0('0x39')](_0xbaa0('0x74'),_0x2426cd[_0xbaa0('0x43')]['id'][_0xbaa0('0x6c')]())))['toString']();break;case _0xbaa0('0x75'):_0x181b97=squel[_0xbaa0('0x62')]()[_0xbaa0('0x63')](_0xbaa0('0x73'))[_0xbaa0('0x76')]([_0xbaa0('0x68'),_0xbaa0('0x64'),_0xbaa0('0x65'),_0xbaa0('0x6b'),_0xbaa0('0x55'),'createdAt',_0xbaa0('0x4e')],squel[_0xbaa0('0x66')]()['field']('phone',_0xbaa0('0x68'))[_0xbaa0('0x67')]('NOW()',_0xbaa0('0x64'))[_0xbaa0('0x67')]('id',_0xbaa0('0x65'))[_0xbaa0('0x67')](_0x59f971[_0xbaa0('0x6a')]['toString'](),_0xbaa0('0x6b'))['field'](_0x2426cd['params']['id'][_0xbaa0('0x6c')](),_0xbaa0('0x55'))[_0xbaa0('0x67')]('NOW()',_0xbaa0('0x4d'))[_0xbaa0('0x67')](_0xbaa0('0x69'),_0xbaa0('0x4e'))[_0xbaa0('0x6d')]('cm_contacts')[_0xbaa0('0x39')](_0xbaa0('0x77'))[_0xbaa0('0x39')](_0xbaa0('0x78'),_0x59f971[_0xbaa0('0x6a')][_0xbaa0('0x6c')]())[_0xbaa0('0x39')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xbaa0('0x66')]()[_0xbaa0('0x67')]('COALESCE(phone,\x27\x27)')[_0xbaa0('0x6d')]('cm_hopper')[_0xbaa0('0x39')](_0xbaa0('0x74'),_0x2426cd[_0xbaa0('0x43')]['id'][_0xbaa0('0x6c')]())))['toString']();break;default:_0x181b97=squel[_0xbaa0('0x62')]()[_0xbaa0('0x63')]('cm_hopper')[_0xbaa0('0x76')](['phone',_0xbaa0('0x64'),'ContactId',_0xbaa0('0x6b'),'CampaignId','createdAt',_0xbaa0('0x4e')],squel[_0xbaa0('0x66')]()['field'](_0xbaa0('0x68'),_0xbaa0('0x68'))['field']('NOW()',_0xbaa0('0x64'))['field']('id',_0xbaa0('0x65'))[_0xbaa0('0x67')](_0x59f971['CmListId'][_0xbaa0('0x6c')](),'ListId')[_0xbaa0('0x67')](_0x2426cd[_0xbaa0('0x43')]['id']['toString'](),_0xbaa0('0x55'))[_0xbaa0('0x67')](_0xbaa0('0x69'),'createdAt')[_0xbaa0('0x67')]('NOW()',_0xbaa0('0x4e'))[_0xbaa0('0x6d')](_0xbaa0('0x6e'))[_0xbaa0('0x39')](_0xbaa0('0x77'))[_0xbaa0('0x39')](_0xbaa0('0x78'),_0x59f971[_0xbaa0('0x6a')][_0xbaa0('0x6c')]())[_0xbaa0('0x39')](_0xbaa0('0x6f')))[_0xbaa0('0x6c')]();}_0x85926d[_0xbaa0('0x79')](db[_0xbaa0('0x7a')][_0xbaa0('0x2e')](_0x181b97));}return BPromise[_0xbaa0('0x7b')](_0x85926d);}})[_0xbaa0('0x1e')](function(){return _0x136311;})[_0xbaa0('0x1e')](respondWithResult(_0x32b6d6,null))[_0xbaa0('0x41')](handleError(_0x32b6d6,null));};exports[_0xbaa0('0x7c')]=function(_0x3617e2,_0xcd0363,_0x25ddd2){return db[_0xbaa0('0x3e')][_0xbaa0('0x45')]({'where':{'id':_0x3617e2[_0xbaa0('0x43')]['id']}})[_0xbaa0('0x1e')](handleEntityNotFound(_0xcd0363,null))['then'](function(_0x762405){if(_0x762405){return _0x762405[_0xbaa0('0x7c')](_0x3617e2[_0xbaa0('0x2e')][_0xbaa0('0x5e')]);}})[_0xbaa0('0x1e')](function(_0x5dd57e){if(_0x5dd57e){return db[_0xbaa0('0x53')][_0xbaa0('0x1f')]({'where':{'ListId':_0x3617e2[_0xbaa0('0x2e')][_0xbaa0('0x5e')],'CampaignId':_0x3617e2['params']['id']}})[_0xbaa0('0x1e')](function(){return _0x5dd57e;});}})[_0xbaa0('0x1e')](respondWithStatusCode(_0xcd0363,null))['catch'](handleError(_0xcd0363,null));};exports[_0xbaa0('0x7d')]=function(_0x47073c,_0x37d740,_0x167ed6){var _0x43f3ae={'raw':!![],'where':{}};var _0x3fe4b5={};var _0x352eae={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x47073c['params']['id']}})[_0xbaa0('0x1e')](handleEntityNotFound(_0x37d740,null))[_0xbaa0('0x1e')](function(_0x2e8672){if(_0x2e8672){_0x3fe4b5[_0xbaa0('0x2d')]=_[_0xbaa0('0x2f')](db[_0xbaa0('0x5b')][_0xbaa0('0x2a')]);_0x3fe4b5[_0xbaa0('0x2e')]=_[_0xbaa0('0x2f')](_0x47073c[_0xbaa0('0x2e')]);_0x3fe4b5[_0xbaa0('0x30')]=_[_0xbaa0('0x31')](_0x3fe4b5[_0xbaa0('0x2d')],_0x3fe4b5[_0xbaa0('0x2e')]);_0x43f3ae['attributes']=_[_0xbaa0('0x31')](_0x3fe4b5[_0xbaa0('0x2d')],qs[_0xbaa0('0x33')](_0x47073c[_0xbaa0('0x2e')][_0xbaa0('0x33')]));_0x43f3ae[_0xbaa0('0x32')]=_0x43f3ae[_0xbaa0('0x32')][_0xbaa0('0x34')]?_0x43f3ae[_0xbaa0('0x32')]:_0x3fe4b5['model'];if(!_0x47073c[_0xbaa0('0x2e')][_0xbaa0('0x35')](_0xbaa0('0x36'))){_0x43f3ae[_0xbaa0('0x17')]=qs[_0xbaa0('0x17')](_0x47073c[_0xbaa0('0x2e')][_0xbaa0('0x17')]);_0x43f3ae[_0xbaa0('0x16')]=qs['offset'](_0x47073c[_0xbaa0('0x2e')][_0xbaa0('0x16')]);}_0x43f3ae[_0xbaa0('0x37')]=qs[_0xbaa0('0x38')](_0x47073c[_0xbaa0('0x2e')][_0xbaa0('0x38')]);_0x43f3ae[_0xbaa0('0x39')]=qs[_0xbaa0('0x30')](_[_0xbaa0('0x54')](_0x47073c['query'],_0x3fe4b5['filters']));_0x43f3ae[_0xbaa0('0x39')][_0xbaa0('0x55')]=_0x2e8672['id'];if(_0x47073c[_0xbaa0('0x2e')][_0xbaa0('0x3a')]){_0x43f3ae[_0xbaa0('0x39')]=_[_0xbaa0('0x3c')](_0x43f3ae[_0xbaa0('0x39')],{'$or':_[_0xbaa0('0x29')](_0x43f3ae[_0xbaa0('0x32')],function(_0x122bec){var _0x171abb={};_0x171abb[_0x122bec]={'$like':'%'+_0x47073c[_0xbaa0('0x2e')]['filter']+'%'};return _0x171abb;})});}_0x43f3ae=_[_0xbaa0('0x3c')]({},_0x43f3ae,_0x47073c[_0xbaa0('0x3d')]);return db[_0xbaa0('0x5b')][_0xbaa0('0x15')]({'where':_0x43f3ae['where']})[_0xbaa0('0x1e')](function(_0x34ac39){_0x352eae[_0xbaa0('0x15')]=_0x34ac39;if(_0x47073c['query'][_0xbaa0('0x44')]){_0x43f3ae[_0xbaa0('0x3f')]=[{'all':!![]}];}return db[_0xbaa0('0x5b')]['findAll'](_0x43f3ae);})[_0xbaa0('0x1e')](function(_0x2a7bad){_0x352eae[_0xbaa0('0x58')]=_0x2a7bad;return _0x352eae;});}})[_0xbaa0('0x1e')](respondWithFilteredResult(_0x37d740,_0x43f3ae))[_0xbaa0('0x41')](handleError(_0x37d740,null));};exports[_0xbaa0('0x7e')]=function(_0x580ea0,_0x1d9e9b,_0x4e732b){var _0x4a877d,_0x1b54a2;return db[_0xbaa0('0x3e')][_0xbaa0('0x45')]({'where':{'id':_0x580ea0[_0xbaa0('0x43')]['id']}})[_0xbaa0('0x1e')](handleEntityNotFound(_0x1d9e9b,null))['then'](function(_0x7c8829){if(_0x7c8829){_0x1b54a2=_0x7c8829;return _0x7c8829[_0xbaa0('0x7e')](_0x580ea0[_0xbaa0('0x47')][_0xbaa0('0x5e')],_[_0xbaa0('0x4f')](_0x580ea0[_0xbaa0('0x47')],[_0xbaa0('0x5e'),'id'])||{});}return null;})[_0xbaa0('0x5f')](function(_0x2db07f){var _0x3d13c2;_0x4a877d=_0x2db07f||[];var _0x1ca215=[];if(_0x2db07f){for(var _0x25a6cb=0x0;_0x25a6cb<_0x2db07f[_0xbaa0('0x34')];_0x25a6cb+=0x1){var _0x19d2e5=_0x2db07f[_0x25a6cb][_0xbaa0('0x20')]({'plain':!![]});_0x3d13c2=squel['insert']()[_0xbaa0('0x63')](_0xbaa0('0x7f'))[_0xbaa0('0x76')]([_0xbaa0('0x68'),'ContactId',_0xbaa0('0x6b'),'CampaignId','createdAt',_0xbaa0('0x4e')],squel[_0xbaa0('0x66')]()[_0xbaa0('0x67')](_0xbaa0('0x68'),_0xbaa0('0x68'))[_0xbaa0('0x67')]('id','ContactId')[_0xbaa0('0x67')](_0x19d2e5[_0xbaa0('0x6a')][_0xbaa0('0x6c')](),_0xbaa0('0x6b'))['field'](_0x580ea0[_0xbaa0('0x43')]['id']['toString'](),_0xbaa0('0x55'))[_0xbaa0('0x67')](_0xbaa0('0x69'),_0xbaa0('0x4d'))['field']('NOW()','updatedAt')['from'](_0xbaa0('0x6e'))[_0xbaa0('0x39')](_0xbaa0('0x77'))[_0xbaa0('0x39')]('ListId\x20=\x20?',_0x19d2e5['CmListId'][_0xbaa0('0x6c')]())[_0xbaa0('0x39')](_0xbaa0('0x6f')))[_0xbaa0('0x6c')]();_0x1ca215[_0xbaa0('0x79')](db[_0xbaa0('0x7a')]['query'](_0x3d13c2));}return BPromise[_0xbaa0('0x7b')](_0x1ca215);}})[_0xbaa0('0x1e')](function(){return _0x4a877d;})[_0xbaa0('0x1e')](respondWithResult(_0x1d9e9b,null))[_0xbaa0('0x41')](handleError(_0x1d9e9b,null));};exports[_0xbaa0('0x80')]=function(_0x3f1d93,_0xcbd6e8,_0x7cc06){return db['Campaign'][_0xbaa0('0x45')]({'where':{'id':_0x3f1d93[_0xbaa0('0x43')]['id']}})[_0xbaa0('0x1e')](handleEntityNotFound(_0xcbd6e8,null))[_0xbaa0('0x1e')](function(_0x4fa629){if(_0x4fa629){return _0x4fa629[_0xbaa0('0x80')](_0x3f1d93['query'][_0xbaa0('0x5e')]);}})[_0xbaa0('0x1e')](function(_0x4df1ec){if(_0x4df1ec){return db[_0xbaa0('0x5a')][_0xbaa0('0x1f')]({'where':{'ListId':_0x3f1d93['query'][_0xbaa0('0x5e')],'CampaignId':_0x3f1d93[_0xbaa0('0x43')]['id']}})[_0xbaa0('0x1e')](function(){return _0x4df1ec;});}})[_0xbaa0('0x1e')](respondWithStatusCode(_0xcbd6e8,null))['catch'](handleError(_0xcbd6e8,null));}; \ No newline at end of file +var _0x29bc=['clone','omit','createdAt','updatedAt','body','getHoppers','hasOwnProperty','order','rows','CmHopperHistory','CampaignId','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','getLists','CmList','addLists','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','push','sequelize','all','removeLists','CmHopper','destroy','getBlackLists','addBlackLists','spread','cm_hopper_black','removeBlackLists','CmHopperBlack','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','save','update','then','get','IvrCampaigns','UserProfileResource','sendStatus','error','stack','name','send','map','Campaign','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','rawAttributes','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x2431ba,_0x208094){var _0x21da30=function(_0x572155){while(--_0x572155){_0x2431ba['push'](_0x2431ba['shift']());}};_0x21da30(++_0x208094);}(_0x29bc,0x146));var _0xc29b=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x29bc[_0x173441];return _0x2423a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc29b('0x0'));var rimraf=require(_0xc29b('0x1'));var zipdir=require(_0xc29b('0x2'));var jsonpatch=require(_0xc29b('0x3'));var rp=require(_0xc29b('0x4'));var moment=require('moment');var BPromise=require(_0xc29b('0x5'));var Mustache=require(_0xc29b('0x6'));var util=require(_0xc29b('0x7'));var path=require(_0xc29b('0x8'));var sox=require(_0xc29b('0x9'));var csv=require(_0xc29b('0xa'));var ejs=require(_0xc29b('0xb'));var fs=require('fs');var _=require(_0xc29b('0xc'));var squel=require(_0xc29b('0xd'));var crypto=require(_0xc29b('0xe'));var jsforce=require(_0xc29b('0xf'));var deskjs=require(_0xc29b('0x10'));var toCsv=require(_0xc29b('0xa'));var querystring=require(_0xc29b('0x11'));var Papa=require(_0xc29b('0x12'));var Redis=require(_0xc29b('0x13'));var authService=require(_0xc29b('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc29b('0x15'));var logger=require('../../config/logger')(_0xc29b('0x16'));var utils=require('../../config/utils');var config=require(_0xc29b('0x17'));var db=require(_0xc29b('0x18'))['db'];function respondWithStatusCode(_0x3b2bbd,_0xcfbf36){_0xcfbf36=_0xcfbf36||0xcc;return function(_0x340a73){if(_0x340a73){return _0x3b2bbd['sendStatus'](_0xcfbf36);}return _0x3b2bbd[_0xc29b('0x19')](_0xcfbf36)[_0xc29b('0x1a')]();};}function respondWithResult(_0x2d7691,_0x419f5c){_0x419f5c=_0x419f5c||0xc8;return function(_0x3e9006){if(_0x3e9006){return _0x2d7691[_0xc29b('0x19')](_0x419f5c)[_0xc29b('0x1b')](_0x3e9006);}};}function respondWithFilteredResult(_0x3b4d85,_0x27a19a){return function(_0x2b80e9){if(_0x2b80e9){var _0x484e63=_0x2b80e9[_0xc29b('0x1c')],_0x297d7a=_0x27a19a[_0xc29b('0x1d')],_0x382417=_0x27a19a['offset']+_0x27a19a[_0xc29b('0x1e')],_0x4b3e6e;if(_0x382417>=_0x484e63){_0x382417=_0x484e63;_0x4b3e6e=0xc8;}else{_0x4b3e6e=0xce;}_0x3b4d85[_0xc29b('0x19')](_0x4b3e6e);return _0x3b4d85[_0xc29b('0x1f')]('Content-Range',_0x297d7a+'-'+_0x382417+'/'+_0x484e63)[_0xc29b('0x1b')](_0x2b80e9);}return null;};}function patchUpdates(_0xcf618c){return function(_0x4f1f73){try{jsonpatch[_0xc29b('0x20')](_0x4f1f73,_0xcf618c,!![]);}catch(_0x1ecb82){return BPromise['reject'](_0x1ecb82);}return _0x4f1f73[_0xc29b('0x21')]();};}function saveUpdates(_0x567270,_0x473246){return function(_0x59a82e){if(_0x59a82e){return _0x59a82e[_0xc29b('0x22')](_0x567270)[_0xc29b('0x23')](function(_0xb74294){return _0xb74294;});}return null;};}function removeEntity(_0x3c1754,_0x2c280f){return function(_0x3ebea0){if(_0x3ebea0){return _0x3ebea0['destroy']()[_0xc29b('0x23')](function(){var _0x318619=_0x3ebea0[_0xc29b('0x24')]({'plain':!![]});var _0x79ec00=_0xc29b('0x25');return db[_0xc29b('0x26')]['destroy']({'where':{'type':_0x79ec00,'resourceId':_0x318619['id']}})['then'](function(){return _0x3ebea0;});})[_0xc29b('0x23')](function(){_0x3c1754['status'](0xcc)[_0xc29b('0x1a')]();});}};}function handleEntityNotFound(_0x3608d2,_0x58ff5e){return function(_0x1f9d6f){if(!_0x1f9d6f){_0x3608d2[_0xc29b('0x27')](0x194);}return _0x1f9d6f;};}function handleError(_0x3bf257,_0x2e4df8){_0x2e4df8=_0x2e4df8||0x1f4;return function(_0xfffecf){logger[_0xc29b('0x28')](_0xfffecf[_0xc29b('0x29')]);if(_0xfffecf[_0xc29b('0x2a')]){delete _0xfffecf['name'];}_0x3bf257[_0xc29b('0x19')](_0x2e4df8)[_0xc29b('0x2b')](_0xfffecf);};}exports['index']=function(_0x517329,_0x50ccb1){var _0x25f079={},_0x3ec5d5={},_0x55b5ca={'count':0x0,'rows':[]};var _0xb79d00=_[_0xc29b('0x2c')](db[_0xc29b('0x2d')]['rawAttributes'],function(_0xf304c1){return{'name':_0xf304c1[_0xc29b('0x2e')],'type':_0xf304c1['type'][_0xc29b('0x2f')]};});_0x3ec5d5[_0xc29b('0x30')]=_[_0xc29b('0x2c')](_0xb79d00,_0xc29b('0x2a'));_0x3ec5d5[_0xc29b('0x31')]=_['keys'](_0x517329['query']);_0x3ec5d5[_0xc29b('0x32')]=_[_0xc29b('0x33')](_0x3ec5d5['model'],_0x3ec5d5[_0xc29b('0x31')]);_0x25f079['attributes']=_[_0xc29b('0x33')](_0x3ec5d5[_0xc29b('0x30')],qs['fields'](_0x517329[_0xc29b('0x31')][_0xc29b('0x34')]));_0x25f079[_0xc29b('0x35')]=_0x25f079[_0xc29b('0x35')][_0xc29b('0x36')]?_0x25f079[_0xc29b('0x35')]:_0x3ec5d5[_0xc29b('0x30')];if(!_0x517329[_0xc29b('0x31')]['hasOwnProperty'](_0xc29b('0x37'))){_0x25f079[_0xc29b('0x1e')]=qs['limit'](_0x517329[_0xc29b('0x31')][_0xc29b('0x1e')]);_0x25f079[_0xc29b('0x1d')]=qs[_0xc29b('0x1d')](_0x517329['query'][_0xc29b('0x1d')]);}_0x25f079['order']=qs[_0xc29b('0x38')](_0x517329[_0xc29b('0x31')][_0xc29b('0x38')]);_0x25f079[_0xc29b('0x39')]=qs[_0xc29b('0x32')](_[_0xc29b('0x3a')](_0x517329[_0xc29b('0x31')],_0x3ec5d5[_0xc29b('0x32')]),_0xb79d00);if(_0x517329[_0xc29b('0x31')][_0xc29b('0x3b')]){_0x25f079[_0xc29b('0x39')]=_[_0xc29b('0x3c')](_0x25f079[_0xc29b('0x39')],{'$or':_[_0xc29b('0x2c')](_0xb79d00,function(_0x5689cb){if(_0x5689cb['type']!==_0xc29b('0x3d')){var _0x8dcd07={};_0x8dcd07[_0x5689cb[_0xc29b('0x2a')]]={'$like':'%'+_0x517329['query'][_0xc29b('0x3b')]+'%'};return _0x8dcd07;}})});}_0x25f079=_[_0xc29b('0x3c')]({},_0x25f079,_0x517329[_0xc29b('0x3e')]);var _0x1c97f1={'where':_0x25f079[_0xc29b('0x39')]};return db[_0xc29b('0x2d')][_0xc29b('0x1c')](_0x1c97f1)[_0xc29b('0x23')](function(_0x3e4a36){_0x55b5ca[_0xc29b('0x1c')]=_0x3e4a36;if(_0x517329[_0xc29b('0x31')][_0xc29b('0x3f')]){_0x25f079[_0xc29b('0x40')]=[{'all':!![]}];}return db[_0xc29b('0x2d')][_0xc29b('0x41')](_0x25f079);})[_0xc29b('0x23')](function(_0x23c9c6){_0x55b5ca['rows']=_0x23c9c6;return _0x55b5ca;})[_0xc29b('0x23')](respondWithFilteredResult(_0x50ccb1,_0x25f079))[_0xc29b('0x42')](handleError(_0x50ccb1,null));};exports['show']=function(_0x37c949,_0x1566bf){var _0x4e0b1b={'raw':![],'where':{'id':_0x37c949[_0xc29b('0x43')]['id']}},_0x1ee371={};_0x1ee371[_0xc29b('0x30')]=_[_0xc29b('0x44')](db[_0xc29b('0x2d')][_0xc29b('0x45')]);_0x1ee371[_0xc29b('0x31')]=_[_0xc29b('0x44')](_0x37c949[_0xc29b('0x31')]);_0x1ee371['filters']=_[_0xc29b('0x33')](_0x1ee371[_0xc29b('0x30')],_0x1ee371['query']);_0x4e0b1b[_0xc29b('0x35')]=_[_0xc29b('0x33')](_0x1ee371[_0xc29b('0x30')],qs[_0xc29b('0x34')](_0x37c949['query'][_0xc29b('0x34')]));_0x4e0b1b[_0xc29b('0x35')]=_0x4e0b1b['attributes'][_0xc29b('0x36')]?_0x4e0b1b[_0xc29b('0x35')]:_0x1ee371[_0xc29b('0x30')];if(_0x37c949[_0xc29b('0x31')][_0xc29b('0x3f')]){_0x4e0b1b[_0xc29b('0x40')]=[{'all':!![]}];}_0x4e0b1b=_[_0xc29b('0x3c')]({},_0x4e0b1b,_0x37c949[_0xc29b('0x3e')]);return db[_0xc29b('0x2d')]['find'](_0x4e0b1b)[_0xc29b('0x23')](handleEntityNotFound(_0x1566bf,null))['then'](respondWithResult(_0x1566bf,null))[_0xc29b('0x42')](handleError(_0x1566bf,null));};exports[_0xc29b('0x46')]=function(_0x258cda,_0x40e6f1){return db[_0xc29b('0x2d')]['create'](_0x258cda['body'],{})[_0xc29b('0x23')](function(_0x182778){var _0x4272af=_0x258cda[_0xc29b('0x47')][_0xc29b('0x24')]({'plain':!![]});if(!_0x4272af)throw new Error(_0xc29b('0x48'));if(_0x4272af[_0xc29b('0x49')]==='user'){var _0x124026=_0x182778['get']({'plain':!![]});var _0xb7c815=_0xc29b('0x25');return db[_0xc29b('0x4a')][_0xc29b('0x4b')]({'where':{'name':_0xb7c815,'userProfileId':_0x4272af[_0xc29b('0x4c')]},'raw':!![]})['then'](function(_0x363f17){if(_0x363f17&&_0x363f17[_0xc29b('0x4d')]===0x0){return db[_0xc29b('0x26')][_0xc29b('0x46')]({'name':_0x124026[_0xc29b('0x2a')],'resourceId':_0x124026['id'],'type':_0x363f17[_0xc29b('0x2a')],'sectionId':_0x363f17['id']},{})[_0xc29b('0x23')](function(){return _0x182778;});}else{return _0x182778;}})[_0xc29b('0x42')](function(_0x510c47){logger['error'](_0xc29b('0x4e'),_0x510c47);throw _0x510c47;});}return _0x182778;})['then'](respondWithResult(_0x40e6f1,0xc9))[_0xc29b('0x42')](handleError(_0x40e6f1,null));};exports[_0xc29b('0x4f')]=function(_0x232ae6,_0x464178){var _0x429204={'where':{'id':_0x232ae6[_0xc29b('0x43')]['id']}},_0x224f0c={};_0x224f0c[_0xc29b('0x30')]=_[_0xc29b('0x44')](db[_0xc29b('0x2d')][_0xc29b('0x45')]);_0x429204[_0xc29b('0x35')]=_[_0xc29b('0x33')](_0x224f0c[_0xc29b('0x30')],qs[_0xc29b('0x34')](_0x232ae6[_0xc29b('0x31')][_0xc29b('0x34')]));_0x429204[_0xc29b('0x35')]=_0x429204[_0xc29b('0x35')][_0xc29b('0x36')]?_0x429204[_0xc29b('0x35')]:_0x224f0c['model'];if(_0x232ae6[_0xc29b('0x31')][_0xc29b('0x3f')]){_0x429204[_0xc29b('0x40')]=[{'all':!![]}];}_0x429204=_[_0xc29b('0x3c')]({},_0x429204,_0x232ae6[_0xc29b('0x3e')]);return db[_0xc29b('0x2d')][_0xc29b('0x4b')](_0x429204)[_0xc29b('0x23')](handleEntityNotFound(_0x464178,null))['then'](function(_0x31f0ac){if(_0x31f0ac){var _0x165b8f=_0x31f0ac['get']({'plain':!![]});_0x165b8f=qs[_0xc29b('0x50')](_0x165b8f,['id',_0xc29b('0x51'),_0xc29b('0x52')]);_0x232ae6[_0xc29b('0x53')]=_[_0xc29b('0x50')](_0x232ae6[_0xc29b('0x53')],['id',_0xc29b('0x51'),_0xc29b('0x52')]);return db[_0xc29b('0x2d')][_0xc29b('0x46')](_['merge'](_0x165b8f,_0x232ae6[_0xc29b('0x53')]),{'include':_0x232ae6[_0xc29b('0x31')][_0xc29b('0x3f')]?[{'all':!![]}]:undefined})[_0xc29b('0x23')](function(_0x304532){var _0x113c75=_0x232ae6['user'][_0xc29b('0x24')]({'plain':!![]});if(!_0x113c75)throw new Error(_0xc29b('0x48'));if(_0x113c75[_0xc29b('0x49')]===_0xc29b('0x47')){var _0x406d2c=_0x304532[_0xc29b('0x24')]({'plain':!![]});var _0x185e23=_0xc29b('0x25');return db['UserProfileSection'][_0xc29b('0x4b')]({'where':{'name':_0x185e23,'userProfileId':_0x113c75['userProfileId']},'raw':!![]})[_0xc29b('0x23')](function(_0x3bd32f){if(_0x3bd32f&&_0x3bd32f[_0xc29b('0x4d')]===0x0){return db[_0xc29b('0x26')][_0xc29b('0x46')]({'name':_0x406d2c['name'],'resourceId':_0x406d2c['id'],'type':_0x3bd32f['name'],'sectionId':_0x3bd32f['id']},{})[_0xc29b('0x23')](function(){return _0x304532;});}else{return _0x304532;}})[_0xc29b('0x42')](function(_0x1de4da){logger[_0xc29b('0x28')](_0xc29b('0x4e'),_0x1de4da);throw _0x1de4da;});}return _0x304532;});}})[_0xc29b('0x23')](respondWithResult(_0x464178,0xc9))['catch'](handleError(_0x464178,null));};exports[_0xc29b('0x22')]=function(_0x35ad7c,_0xabb277){if(_0x35ad7c[_0xc29b('0x53')]['id']){delete _0x35ad7c['body']['id'];}return db[_0xc29b('0x2d')]['find']({'where':{'id':_0x35ad7c[_0xc29b('0x43')]['id']}})[_0xc29b('0x23')](handleEntityNotFound(_0xabb277,null))[_0xc29b('0x23')](saveUpdates(_0x35ad7c[_0xc29b('0x53')],null))['then'](respondWithResult(_0xabb277,null))[_0xc29b('0x42')](handleError(_0xabb277,null));};exports['destroy']=function(_0x47ad62,_0x143de7){return db[_0xc29b('0x2d')][_0xc29b('0x4b')]({'where':{'id':_0x47ad62[_0xc29b('0x43')]['id']}})[_0xc29b('0x23')](handleEntityNotFound(_0x143de7,null))[_0xc29b('0x23')](removeEntity(_0x143de7,null))['catch'](handleError(_0x143de7,null));};exports[_0xc29b('0x54')]=function(_0xba0560,_0x593710,_0x1f4021){var _0xd0eac9={'raw':!![],'where':{}};var _0x53e344={};var _0x40489a={'count':0x0,'rows':[]};return db[_0xc29b('0x2d')]['findOne']({'where':{'id':_0xba0560[_0xc29b('0x43')]['id']}})[_0xc29b('0x23')](handleEntityNotFound(_0x593710,null))[_0xc29b('0x23')](function(_0x7989d6){if(_0x7989d6){_0x53e344[_0xc29b('0x30')]=_[_0xc29b('0x44')](db['CmHopper'][_0xc29b('0x45')]);_0x53e344['query']=_[_0xc29b('0x44')](_0xba0560[_0xc29b('0x31')]);_0x53e344[_0xc29b('0x32')]=_[_0xc29b('0x33')](_0x53e344[_0xc29b('0x30')],_0x53e344[_0xc29b('0x31')]);_0xd0eac9[_0xc29b('0x35')]=_[_0xc29b('0x33')](_0x53e344[_0xc29b('0x30')],qs['fields'](_0xba0560[_0xc29b('0x31')][_0xc29b('0x34')]));_0xd0eac9[_0xc29b('0x35')]=_0xd0eac9['attributes'][_0xc29b('0x36')]?_0xd0eac9[_0xc29b('0x35')]:_0x53e344[_0xc29b('0x30')];if(!_0xba0560[_0xc29b('0x31')][_0xc29b('0x55')](_0xc29b('0x37'))){_0xd0eac9['limit']=qs['limit'](_0xba0560[_0xc29b('0x31')][_0xc29b('0x1e')]);_0xd0eac9[_0xc29b('0x1d')]=qs[_0xc29b('0x1d')](_0xba0560[_0xc29b('0x31')][_0xc29b('0x1d')]);}_0xd0eac9[_0xc29b('0x56')]=qs[_0xc29b('0x38')](_0xba0560[_0xc29b('0x31')][_0xc29b('0x38')]);_0xd0eac9[_0xc29b('0x39')]=qs['filters'](_[_0xc29b('0x3a')](_0xba0560['query'],_0x53e344[_0xc29b('0x32')]));_0xd0eac9[_0xc29b('0x39')]['CampaignId']=_0x7989d6['id'];if(_0xba0560[_0xc29b('0x31')][_0xc29b('0x3b')]){_0xd0eac9['where']=_['merge'](_0xd0eac9[_0xc29b('0x39')],{'$or':_[_0xc29b('0x2c')](_0xd0eac9[_0xc29b('0x35')],function(_0x49b2ba){var _0xa6102={};_0xa6102[_0x49b2ba]={'$like':'%'+_0xba0560[_0xc29b('0x31')][_0xc29b('0x3b')]+'%'};return _0xa6102;})});}_0xd0eac9=_[_0xc29b('0x3c')]({},_0xd0eac9,_0xba0560['options']);return db['CmHopper'][_0xc29b('0x1c')]({'where':_0xd0eac9[_0xc29b('0x39')]})[_0xc29b('0x23')](function(_0x54f6ef){_0x40489a[_0xc29b('0x1c')]=_0x54f6ef;if(_0xba0560[_0xc29b('0x31')]['includeAll']){_0xd0eac9[_0xc29b('0x40')]=[{'all':!![]}];}return db['CmHopper'][_0xc29b('0x41')](_0xd0eac9);})[_0xc29b('0x23')](function(_0x5eaf5a){_0x40489a[_0xc29b('0x57')]=_0x5eaf5a;return _0x40489a;});}})[_0xc29b('0x23')](respondWithFilteredResult(_0x593710,_0xd0eac9))[_0xc29b('0x42')](handleError(_0x593710,null));};exports['getHopperHistories']=function(_0x34dbc3,_0x2c0de5,_0x5dc17f){var _0x26be26={'raw':!![],'where':{}};var _0x1979c8={};var _0x5d3b7e={'count':0x0,'rows':[]};return db[_0xc29b('0x2d')]['findOne']({'where':{'id':_0x34dbc3[_0xc29b('0x43')]['id']}})['then'](handleEntityNotFound(_0x2c0de5,null))['then'](function(_0x4cfba0){if(_0x4cfba0){_0x1979c8[_0xc29b('0x30')]=_[_0xc29b('0x44')](db[_0xc29b('0x58')][_0xc29b('0x45')]);_0x1979c8[_0xc29b('0x31')]=_['keys'](_0x34dbc3[_0xc29b('0x31')]);_0x1979c8[_0xc29b('0x32')]=_[_0xc29b('0x33')](_0x1979c8[_0xc29b('0x30')],_0x1979c8[_0xc29b('0x31')]);_0x26be26[_0xc29b('0x35')]=_['intersection'](_0x1979c8[_0xc29b('0x30')],qs['fields'](_0x34dbc3[_0xc29b('0x31')][_0xc29b('0x34')]));_0x26be26['attributes']=_0x26be26[_0xc29b('0x35')][_0xc29b('0x36')]?_0x26be26[_0xc29b('0x35')]:_0x1979c8[_0xc29b('0x30')];if(!_0x34dbc3[_0xc29b('0x31')][_0xc29b('0x55')](_0xc29b('0x37'))){_0x26be26['limit']=qs['limit'](_0x34dbc3[_0xc29b('0x31')]['limit']);_0x26be26[_0xc29b('0x1d')]=qs[_0xc29b('0x1d')](_0x34dbc3['query'][_0xc29b('0x1d')]);}_0x26be26[_0xc29b('0x56')]=qs[_0xc29b('0x38')](_0x34dbc3['query']['sort']);_0x26be26[_0xc29b('0x39')]=qs['filters'](_[_0xc29b('0x3a')](_0x34dbc3[_0xc29b('0x31')],_0x1979c8[_0xc29b('0x32')]));_0x26be26[_0xc29b('0x39')][_0xc29b('0x59')]=_0x4cfba0['id'];if(_0x34dbc3[_0xc29b('0x31')][_0xc29b('0x3b')]){_0x26be26[_0xc29b('0x39')]=_[_0xc29b('0x3c')](_0x26be26[_0xc29b('0x39')],{'$or':_[_0xc29b('0x2c')](_0x26be26['attributes'],function(_0x1c942e){var _0xe7baf2={};_0xe7baf2[_0x1c942e]={'$like':'%'+_0x34dbc3[_0xc29b('0x31')][_0xc29b('0x3b')]+'%'};return _0xe7baf2;})});}_0x26be26=_[_0xc29b('0x3c')]({},_0x26be26,_0x34dbc3[_0xc29b('0x3e')]);return db[_0xc29b('0x58')][_0xc29b('0x1c')]({'where':_0x26be26[_0xc29b('0x39')]})[_0xc29b('0x23')](function(_0xde7611){_0x5d3b7e[_0xc29b('0x1c')]=_0xde7611;if(_0x34dbc3['query'][_0xc29b('0x3f')]){_0x26be26['include']=[{'all':!![]}];}return db[_0xc29b('0x58')][_0xc29b('0x41')](_0x26be26);})[_0xc29b('0x23')](function(_0x530fff){_0x5d3b7e[_0xc29b('0x57')]=_0x530fff;return _0x5d3b7e;});}})[_0xc29b('0x23')](respondWithFilteredResult(_0x2c0de5,_0x26be26))[_0xc29b('0x42')](handleError(_0x2c0de5,null));};exports[_0xc29b('0x5a')]=function(_0x1142bf,_0x13dee5,_0x5608db){var _0xe7feae={'raw':!![],'where':{}};var _0x27cdae={};var _0x13e185={'count':0x0,'rows':[]};return db['Campaign'][_0xc29b('0x5b')]({'where':{'id':_0x1142bf['params']['id']}})[_0xc29b('0x23')](handleEntityNotFound(_0x13dee5,null))[_0xc29b('0x23')](function(_0x25ada9){if(_0x25ada9){_0x27cdae[_0xc29b('0x30')]=_[_0xc29b('0x44')](db[_0xc29b('0x5c')][_0xc29b('0x45')]);_0x27cdae[_0xc29b('0x31')]=_[_0xc29b('0x44')](_0x1142bf[_0xc29b('0x31')]);_0x27cdae[_0xc29b('0x32')]=_['intersection'](_0x27cdae[_0xc29b('0x30')],_0x27cdae[_0xc29b('0x31')]);_0xe7feae[_0xc29b('0x35')]=_[_0xc29b('0x33')](_0x27cdae[_0xc29b('0x30')],qs['fields'](_0x1142bf[_0xc29b('0x31')][_0xc29b('0x34')]));_0xe7feae[_0xc29b('0x35')]=_0xe7feae[_0xc29b('0x35')][_0xc29b('0x36')]?_0xe7feae[_0xc29b('0x35')]:_0x27cdae['model'];if(!_0x1142bf['query'][_0xc29b('0x55')](_0xc29b('0x37'))){_0xe7feae[_0xc29b('0x1e')]=qs['limit'](_0x1142bf['query'][_0xc29b('0x1e')]);_0xe7feae[_0xc29b('0x1d')]=qs['offset'](_0x1142bf['query'][_0xc29b('0x1d')]);}_0xe7feae[_0xc29b('0x56')]=qs[_0xc29b('0x38')](_0x1142bf['query'][_0xc29b('0x38')]);_0xe7feae[_0xc29b('0x39')]=qs[_0xc29b('0x32')](_['pick'](_0x1142bf[_0xc29b('0x31')],_0x27cdae[_0xc29b('0x32')]));_0xe7feae[_0xc29b('0x39')][_0xc29b('0x59')]=_0x25ada9['id'];if(_0x1142bf[_0xc29b('0x31')][_0xc29b('0x3b')]){_0xe7feae[_0xc29b('0x39')]=_[_0xc29b('0x3c')](_0xe7feae[_0xc29b('0x39')],{'$or':_[_0xc29b('0x2c')](_0xe7feae['attributes'],function(_0x4a45b1){var _0x38017b={};_0x38017b[_0x4a45b1]={'$like':'%'+_0x1142bf[_0xc29b('0x31')][_0xc29b('0x3b')]+'%'};return _0x38017b;})});}_0xe7feae=_[_0xc29b('0x3c')]({},_0xe7feae,_0x1142bf[_0xc29b('0x3e')]);return db[_0xc29b('0x5c')][_0xc29b('0x1c')]({'where':_0xe7feae['where']})[_0xc29b('0x23')](function(_0x5b13dd){_0x13e185['count']=_0x5b13dd;if(_0x1142bf['query'][_0xc29b('0x3f')]){_0xe7feae[_0xc29b('0x40')]=[{'all':!![]}];}return db[_0xc29b('0x5c')][_0xc29b('0x41')](_0xe7feae);})[_0xc29b('0x23')](function(_0x4693c6){_0x13e185['rows']=_0x4693c6;return _0x13e185;});}})['then'](respondWithFilteredResult(_0x13dee5,_0xe7feae))['catch'](handleError(_0x13dee5,null));};exports[_0xc29b('0x5d')]=function(_0x48a8f7,_0x1737ef,_0x58beee){var _0x549368={'raw':!![],'where':{}};var _0x549833={};var _0x24b4a2={'count':0x0,'rows':[]};return db[_0xc29b('0x2d')][_0xc29b('0x5b')]({'where':{'id':_0x48a8f7[_0xc29b('0x43')]['id']}})['then'](handleEntityNotFound(_0x1737ef,null))[_0xc29b('0x23')](function(_0x2a935a){if(_0x2a935a){_0x549833[_0xc29b('0x30')]=_[_0xc29b('0x44')](db['CmHopperBlack']['rawAttributes']);_0x549833['query']=_[_0xc29b('0x44')](_0x48a8f7[_0xc29b('0x31')]);_0x549833[_0xc29b('0x32')]=_[_0xc29b('0x33')](_0x549833[_0xc29b('0x30')],_0x549833[_0xc29b('0x31')]);_0x549368[_0xc29b('0x35')]=_['intersection'](_0x549833['model'],qs['fields'](_0x48a8f7['query']['fields']));_0x549368['attributes']=_0x549368[_0xc29b('0x35')]['length']?_0x549368[_0xc29b('0x35')]:_0x549833[_0xc29b('0x30')];if(!_0x48a8f7[_0xc29b('0x31')][_0xc29b('0x55')](_0xc29b('0x37'))){_0x549368['limit']=qs[_0xc29b('0x1e')](_0x48a8f7[_0xc29b('0x31')]['limit']);_0x549368[_0xc29b('0x1d')]=qs[_0xc29b('0x1d')](_0x48a8f7[_0xc29b('0x31')][_0xc29b('0x1d')]);}_0x549368['order']=qs[_0xc29b('0x38')](_0x48a8f7[_0xc29b('0x31')][_0xc29b('0x38')]);_0x549368[_0xc29b('0x39')]=qs['filters'](_[_0xc29b('0x3a')](_0x48a8f7[_0xc29b('0x31')],_0x549833['filters']));_0x549368[_0xc29b('0x39')][_0xc29b('0x59')]=_0x2a935a['id'];if(_0x48a8f7[_0xc29b('0x31')][_0xc29b('0x3b')]){_0x549368['where']=_[_0xc29b('0x3c')](_0x549368[_0xc29b('0x39')],{'$or':_['map'](_0x549368['attributes'],function(_0x29f352){var _0x29bdd9={};_0x29bdd9[_0x29f352]={'$like':'%'+_0x48a8f7[_0xc29b('0x31')][_0xc29b('0x3b')]+'%'};return _0x29bdd9;})});}_0x549368=_[_0xc29b('0x3c')]({},_0x549368,_0x48a8f7[_0xc29b('0x3e')]);return db['CmHopperBlack'][_0xc29b('0x1c')]({'where':_0x549368[_0xc29b('0x39')]})['then'](function(_0x44730a){_0x24b4a2['count']=_0x44730a;if(_0x48a8f7[_0xc29b('0x31')]['includeAll']){_0x549368[_0xc29b('0x40')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x549368);})[_0xc29b('0x23')](function(_0x4b307a){_0x24b4a2[_0xc29b('0x57')]=_0x4b307a;return _0x24b4a2;});}})[_0xc29b('0x23')](respondWithFilteredResult(_0x1737ef,_0x549368))[_0xc29b('0x42')](handleError(_0x1737ef,null));};exports[_0xc29b('0x5e')]=function(_0x1af331,_0x859929,_0x48ff87){var _0x33670f={};var _0x54514b={};var _0x5cabd7;var _0x7cab81;return db[_0xc29b('0x2d')]['findOne']({'where':{'id':_0x1af331[_0xc29b('0x43')]['id']}})[_0xc29b('0x23')](handleEntityNotFound(_0x859929,null))['then'](function(_0x346a6c){if(_0x346a6c){_0x5cabd7=_0x346a6c;_0x54514b[_0xc29b('0x30')]=_[_0xc29b('0x44')](db[_0xc29b('0x5f')][_0xc29b('0x45')]);_0x54514b[_0xc29b('0x31')]=_[_0xc29b('0x44')](_0x1af331[_0xc29b('0x31')]);_0x54514b[_0xc29b('0x32')]=_[_0xc29b('0x33')](_0x54514b[_0xc29b('0x30')],_0x54514b['query']);_0x33670f[_0xc29b('0x35')]=_[_0xc29b('0x33')](_0x54514b[_0xc29b('0x30')],qs[_0xc29b('0x34')](_0x1af331[_0xc29b('0x31')][_0xc29b('0x34')]));_0x33670f[_0xc29b('0x35')]=_0x33670f['attributes'][_0xc29b('0x36')]?_0x33670f['attributes']:_0x54514b['model'];_0x33670f[_0xc29b('0x56')]=qs[_0xc29b('0x38')](_0x1af331[_0xc29b('0x31')][_0xc29b('0x38')]);_0x33670f[_0xc29b('0x39')]=qs[_0xc29b('0x32')](_[_0xc29b('0x3a')](_0x1af331[_0xc29b('0x31')],_0x54514b[_0xc29b('0x32')]));if(_0x1af331[_0xc29b('0x31')][_0xc29b('0x3b')]){_0x33670f[_0xc29b('0x39')]=_[_0xc29b('0x3c')](_0x33670f[_0xc29b('0x39')],{'$or':_[_0xc29b('0x2c')](_0x33670f[_0xc29b('0x35')],function(_0x3d1734){var _0x39fdd8={};_0x39fdd8[_0x3d1734]={'$like':'%'+_0x1af331[_0xc29b('0x31')][_0xc29b('0x3b')]+'%'};return _0x39fdd8;})});}_0x33670f=_[_0xc29b('0x3c')]({},_0x33670f,_0x1af331[_0xc29b('0x3e')]);return _0x5cabd7[_0xc29b('0x5e')](_0x33670f);}})[_0xc29b('0x23')](function(_0x4b0ef1){if(_0x4b0ef1){_0x7cab81=_0x4b0ef1[_0xc29b('0x36')];if(!_0x1af331['query'][_0xc29b('0x55')](_0xc29b('0x37'))){_0x33670f[_0xc29b('0x1e')]=qs[_0xc29b('0x1e')](_0x1af331['query']['limit']);_0x33670f['offset']=qs['offset'](_0x1af331[_0xc29b('0x31')][_0xc29b('0x1d')]);}return _0x5cabd7[_0xc29b('0x5e')](_0x33670f);}})[_0xc29b('0x23')](function(_0x555a6d){if(_0x555a6d){return _0x555a6d?{'count':_0x7cab81,'rows':_0x555a6d}:null;}})['then'](respondWithResult(_0x859929,null))['catch'](handleError(_0x859929,null));};exports[_0xc29b('0x60')]=function(_0x27af5b,_0x535b0b,_0x14bfcc){var _0x1d7bb9,_0x47fab7;return db[_0xc29b('0x2d')][_0xc29b('0x4b')]({'where':{'id':_0x27af5b[_0xc29b('0x43')]['id']}})[_0xc29b('0x23')](handleEntityNotFound(_0x535b0b,null))[_0xc29b('0x23')](function(_0x40a62d){if(_0x40a62d){_0x47fab7=_0x40a62d;return _0x40a62d['addLists'](_0x27af5b[_0xc29b('0x53')]['ids'],_[_0xc29b('0x50')](_0x27af5b[_0xc29b('0x53')],[_0xc29b('0x61'),'id'])||{});}return null;})['spread'](function(_0xb92582){var _0x35d1f5;_0x1d7bb9=_0xb92582||[];var _0x1c787c=[];if(_0xb92582){for(var _0x29d494=0x0;_0x29d494<_0xb92582[_0xc29b('0x36')];_0x29d494+=0x1){var _0x1985b9=_0xb92582[_0x29d494]['get']({'plain':!![]});_0x47fab7[_0xc29b('0x62')]=_0x27af5b[_0xc29b('0x53')][_0xc29b('0x62')]?_0x27af5b[_0xc29b('0x53')][_0xc29b('0x62')]:_0x47fab7[_0xc29b('0x62')];switch(_0x47fab7[_0xc29b('0x62')]){case _0xc29b('0x63'):_0x35d1f5=squel[_0xc29b('0x64')]()[_0xc29b('0x65')](_0xc29b('0x66'))[_0xc29b('0x67')]([_0xc29b('0x68'),_0xc29b('0x69'),_0xc29b('0x6a'),_0xc29b('0x6b'),_0xc29b('0x59'),_0xc29b('0x51'),_0xc29b('0x52')],squel[_0xc29b('0x6c')]()[_0xc29b('0x6d')]('phone',_0xc29b('0x68'))[_0xc29b('0x6d')](_0xc29b('0x6e'),_0xc29b('0x69'))['field']('id',_0xc29b('0x6a'))['field'](_0x1985b9[_0xc29b('0x6f')][_0xc29b('0x70')](),_0xc29b('0x6b'))[_0xc29b('0x6d')](_0x27af5b[_0xc29b('0x43')]['id'][_0xc29b('0x70')](),_0xc29b('0x59'))[_0xc29b('0x6d')](_0xc29b('0x6e'),_0xc29b('0x51'))[_0xc29b('0x6d')](_0xc29b('0x6e'),'updatedAt')[_0xc29b('0x71')](_0xc29b('0x72'))[_0xc29b('0x39')](_0xc29b('0x73'))[_0xc29b('0x39')](_0xc29b('0x74'),_0x1985b9['CmListId'][_0xc29b('0x70')]())[_0xc29b('0x39')]('phone\x20IS\x20NOT\x20NULL')[_0xc29b('0x39')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc29b('0x6c')]()[_0xc29b('0x6d')](_0xc29b('0x75'))[_0xc29b('0x71')]('cm_hopper_final')['where']('CampaignId\x20=\x20?',_0x27af5b[_0xc29b('0x43')]['id'][_0xc29b('0x70')]()))[_0xc29b('0x39')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xc29b('0x6d')]('COALESCE(phone,\x27\x27)')[_0xc29b('0x71')](_0xc29b('0x66'))[_0xc29b('0x39')](_0xc29b('0x76'),_0x27af5b[_0xc29b('0x43')]['id'][_0xc29b('0x70')]())))[_0xc29b('0x70')]();break;case _0xc29b('0x77'):_0x35d1f5=squel[_0xc29b('0x64')]()[_0xc29b('0x65')](_0xc29b('0x66'))[_0xc29b('0x67')](['phone','scheduledAt',_0xc29b('0x6a'),_0xc29b('0x6b'),_0xc29b('0x59'),_0xc29b('0x51'),'updatedAt'],squel[_0xc29b('0x6c')]()[_0xc29b('0x6d')](_0xc29b('0x68'),_0xc29b('0x68'))[_0xc29b('0x6d')]('NOW()',_0xc29b('0x69'))[_0xc29b('0x6d')]('id',_0xc29b('0x6a'))['field'](_0x1985b9[_0xc29b('0x6f')][_0xc29b('0x70')](),_0xc29b('0x6b'))['field'](_0x27af5b[_0xc29b('0x43')]['id'][_0xc29b('0x70')](),_0xc29b('0x59'))[_0xc29b('0x6d')](_0xc29b('0x6e'),'createdAt')['field'](_0xc29b('0x6e'),'updatedAt')[_0xc29b('0x71')](_0xc29b('0x72'))[_0xc29b('0x39')](_0xc29b('0x73'))['where']('ListId\x20=\x20?',_0x1985b9['CmListId'][_0xc29b('0x70')]())[_0xc29b('0x39')](_0xc29b('0x78'))[_0xc29b('0x39')](_0xc29b('0x79'),squel[_0xc29b('0x6c')]()[_0xc29b('0x6d')](_0xc29b('0x7a'))[_0xc29b('0x71')]('cm_hopper')['where'](_0xc29b('0x76'),_0x27af5b[_0xc29b('0x43')]['id'][_0xc29b('0x70')]())))[_0xc29b('0x70')]();break;default:_0x35d1f5=squel['insert']()[_0xc29b('0x65')](_0xc29b('0x66'))['fromQuery']([_0xc29b('0x68'),'scheduledAt',_0xc29b('0x6a'),_0xc29b('0x6b'),'CampaignId',_0xc29b('0x51'),'updatedAt'],squel['select']()[_0xc29b('0x6d')]('phone',_0xc29b('0x68'))[_0xc29b('0x6d')](_0xc29b('0x6e'),_0xc29b('0x69'))[_0xc29b('0x6d')]('id',_0xc29b('0x6a'))[_0xc29b('0x6d')](_0x1985b9['CmListId'][_0xc29b('0x70')](),_0xc29b('0x6b'))['field'](_0x27af5b[_0xc29b('0x43')]['id'][_0xc29b('0x70')](),_0xc29b('0x59'))['field'](_0xc29b('0x6e'),'createdAt')['field']('NOW()',_0xc29b('0x52'))[_0xc29b('0x71')](_0xc29b('0x72'))[_0xc29b('0x39')](_0xc29b('0x73'))[_0xc29b('0x39')](_0xc29b('0x74'),_0x1985b9['CmListId'][_0xc29b('0x70')]())[_0xc29b('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0xc29b('0x70')]();}_0x1c787c[_0xc29b('0x7b')](db[_0xc29b('0x7c')][_0xc29b('0x31')](_0x35d1f5));}return BPromise[_0xc29b('0x7d')](_0x1c787c);}})[_0xc29b('0x23')](function(){return _0x1d7bb9;})['then'](respondWithResult(_0x535b0b,null))['catch'](handleError(_0x535b0b,null));};exports[_0xc29b('0x7e')]=function(_0x3c3f52,_0x4aa168,_0x9aa6d2){return db[_0xc29b('0x2d')][_0xc29b('0x4b')]({'where':{'id':_0x3c3f52['params']['id']}})[_0xc29b('0x23')](handleEntityNotFound(_0x4aa168,null))['then'](function(_0xef0389){if(_0xef0389){return _0xef0389[_0xc29b('0x7e')](_0x3c3f52[_0xc29b('0x31')]['ids']);}})['then'](function(_0x513661){if(_0x513661){return db[_0xc29b('0x7f')][_0xc29b('0x80')]({'where':{'ListId':_0x3c3f52[_0xc29b('0x31')]['ids'],'CampaignId':_0x3c3f52[_0xc29b('0x43')]['id']}})[_0xc29b('0x23')](function(){return _0x513661;});}})['then'](respondWithStatusCode(_0x4aa168,null))[_0xc29b('0x42')](handleError(_0x4aa168,null));};exports[_0xc29b('0x81')]=function(_0x46ae72,_0xc8331a,_0x2def21){var _0x226d5e={'raw':!![],'where':{}};var _0x49ec23={};var _0x53f01e={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x46ae72['params']['id']}})[_0xc29b('0x23')](handleEntityNotFound(_0xc8331a,null))['then'](function(_0x3cb2d9){if(_0x3cb2d9){_0x49ec23[_0xc29b('0x30')]=_[_0xc29b('0x44')](db[_0xc29b('0x5f')]['rawAttributes']);_0x49ec23[_0xc29b('0x31')]=_['keys'](_0x46ae72[_0xc29b('0x31')]);_0x49ec23[_0xc29b('0x32')]=_[_0xc29b('0x33')](_0x49ec23[_0xc29b('0x30')],_0x49ec23[_0xc29b('0x31')]);_0x226d5e[_0xc29b('0x35')]=_[_0xc29b('0x33')](_0x49ec23[_0xc29b('0x30')],qs['fields'](_0x46ae72[_0xc29b('0x31')][_0xc29b('0x34')]));_0x226d5e[_0xc29b('0x35')]=_0x226d5e[_0xc29b('0x35')][_0xc29b('0x36')]?_0x226d5e[_0xc29b('0x35')]:_0x49ec23[_0xc29b('0x30')];if(!_0x46ae72[_0xc29b('0x31')][_0xc29b('0x55')](_0xc29b('0x37'))){_0x226d5e[_0xc29b('0x1e')]=qs[_0xc29b('0x1e')](_0x46ae72[_0xc29b('0x31')][_0xc29b('0x1e')]);_0x226d5e[_0xc29b('0x1d')]=qs[_0xc29b('0x1d')](_0x46ae72[_0xc29b('0x31')]['offset']);}_0x226d5e[_0xc29b('0x56')]=qs[_0xc29b('0x38')](_0x46ae72[_0xc29b('0x31')]['sort']);_0x226d5e[_0xc29b('0x39')]=qs[_0xc29b('0x32')](_[_0xc29b('0x3a')](_0x46ae72[_0xc29b('0x31')],_0x49ec23[_0xc29b('0x32')]));_0x226d5e[_0xc29b('0x39')]['CampaignId']=_0x3cb2d9['id'];if(_0x46ae72[_0xc29b('0x31')][_0xc29b('0x3b')]){_0x226d5e[_0xc29b('0x39')]=_['merge'](_0x226d5e[_0xc29b('0x39')],{'$or':_[_0xc29b('0x2c')](_0x226d5e[_0xc29b('0x35')],function(_0x4232a3){var _0x386995={};_0x386995[_0x4232a3]={'$like':'%'+_0x46ae72['query'][_0xc29b('0x3b')]+'%'};return _0x386995;})});}_0x226d5e=_[_0xc29b('0x3c')]({},_0x226d5e,_0x46ae72[_0xc29b('0x3e')]);return db['CmList'][_0xc29b('0x1c')]({'where':_0x226d5e[_0xc29b('0x39')]})['then'](function(_0x34fe1b){_0x53f01e[_0xc29b('0x1c')]=_0x34fe1b;if(_0x46ae72[_0xc29b('0x31')][_0xc29b('0x3f')]){_0x226d5e[_0xc29b('0x40')]=[{'all':!![]}];}return db['CmList'][_0xc29b('0x41')](_0x226d5e);})[_0xc29b('0x23')](function(_0x4b0130){_0x53f01e[_0xc29b('0x57')]=_0x4b0130;return _0x53f01e;});}})['then'](respondWithFilteredResult(_0xc8331a,_0x226d5e))['catch'](handleError(_0xc8331a,null));};exports[_0xc29b('0x82')]=function(_0xaba168,_0x4add88,_0x31bfbf){var _0x461692,_0x40f329;return db['Campaign'][_0xc29b('0x4b')]({'where':{'id':_0xaba168[_0xc29b('0x43')]['id']}})['then'](handleEntityNotFound(_0x4add88,null))[_0xc29b('0x23')](function(_0x19e89e){if(_0x19e89e){_0x40f329=_0x19e89e;return _0x19e89e['addBlackLists'](_0xaba168[_0xc29b('0x53')]['ids'],_[_0xc29b('0x50')](_0xaba168[_0xc29b('0x53')],[_0xc29b('0x61'),'id'])||{});}return null;})[_0xc29b('0x83')](function(_0x461db4){var _0x1b9510;_0x461692=_0x461db4||[];var _0x4e82fa=[];if(_0x461db4){for(var _0x58fc2b=0x0;_0x58fc2b<_0x461db4[_0xc29b('0x36')];_0x58fc2b+=0x1){var _0x2c679a=_0x461db4[_0x58fc2b][_0xc29b('0x24')]({'plain':!![]});_0x1b9510=squel['insert']()[_0xc29b('0x65')](_0xc29b('0x84'))[_0xc29b('0x67')]([_0xc29b('0x68'),'ContactId',_0xc29b('0x6b'),_0xc29b('0x59'),_0xc29b('0x51'),_0xc29b('0x52')],squel[_0xc29b('0x6c')]()[_0xc29b('0x6d')](_0xc29b('0x68'),_0xc29b('0x68'))[_0xc29b('0x6d')]('id',_0xc29b('0x6a'))['field'](_0x2c679a[_0xc29b('0x6f')][_0xc29b('0x70')](),_0xc29b('0x6b'))[_0xc29b('0x6d')](_0xaba168[_0xc29b('0x43')]['id'][_0xc29b('0x70')](),_0xc29b('0x59'))[_0xc29b('0x6d')](_0xc29b('0x6e'),_0xc29b('0x51'))[_0xc29b('0x6d')](_0xc29b('0x6e'),_0xc29b('0x52'))[_0xc29b('0x71')]('cm_contacts')['where'](_0xc29b('0x73'))[_0xc29b('0x39')](_0xc29b('0x74'),_0x2c679a[_0xc29b('0x6f')][_0xc29b('0x70')]())[_0xc29b('0x39')](_0xc29b('0x78')))[_0xc29b('0x70')]();_0x4e82fa[_0xc29b('0x7b')](db[_0xc29b('0x7c')]['query'](_0x1b9510));}return BPromise['all'](_0x4e82fa);}})[_0xc29b('0x23')](function(){return _0x461692;})[_0xc29b('0x23')](respondWithResult(_0x4add88,null))[_0xc29b('0x42')](handleError(_0x4add88,null));};exports[_0xc29b('0x85')]=function(_0x34bf3e,_0x44d3d6,_0x2a00f6){return db[_0xc29b('0x2d')]['find']({'where':{'id':_0x34bf3e[_0xc29b('0x43')]['id']}})[_0xc29b('0x23')](handleEntityNotFound(_0x44d3d6,null))['then'](function(_0x50d5ea){if(_0x50d5ea){return _0x50d5ea['removeBlackLists'](_0x34bf3e[_0xc29b('0x31')][_0xc29b('0x61')]);}})[_0xc29b('0x23')](function(_0xdd890){if(_0xdd890){return db[_0xc29b('0x86')][_0xc29b('0x80')]({'where':{'ListId':_0x34bf3e['query'][_0xc29b('0x61')],'CampaignId':_0x34bf3e[_0xc29b('0x43')]['id']}})['then'](function(){return _0xdd890;});}})[_0xc29b('0x23')](respondWithStatusCode(_0x44d3d6,null))[_0xc29b('0x42')](handleError(_0x44d3d6,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index d2326d0..c17fe38 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 _0xa9e0=['../../config/environment','./campaign.attributes','exports','define','Campaign','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x3345f3,_0x5f00a9){var _0x50f904=function(_0x25dbed){while(--_0x25dbed){_0x3345f3['push'](_0x3345f3['shift']());}};_0x50f904(++_0x5f00a9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./campaign.attributes','exports','define','Campaign','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x28a8c7,_0x856bd7){var _0x1648d4=function(_0x36bdc7){while(--_0x36bdc7){_0x28a8c7['push'](_0x28a8c7['shift']());}};_0x1648d4(++_0x856bd7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 6f5e0d0..4692f61 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x27d815,_0x925095){var _0x44fd8f=function(_0x3e3009){while(--_0x3e3009){_0x27d815['push'](_0x27d815['shift']());}};_0x44fd8f(++_0x925095);}(_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 Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file +var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x336d19,_0x3767d0){var _0x419656=function(_0x3add45){while(--_0x3add45){_0x336d19['push'](_0x336d19['shift']());}};_0x419656(++_0x3767d0);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 8dd0c48..a4753e6 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 _0xb608=['addBlackLists','put','update','delete','removeLists','removeBlackLists','exports','util','path','connect-timeout','express','Router','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','post','create','clone','addLists','/:id/blacklists'];(function(_0x2a77ce,_0x20393f){var _0x143400=function(_0x3fc6c6){while(--_0x3fc6c6){_0x2a77ce['push'](_0x2a77ce['shift']());}};_0x143400(++_0x20393f);}(_0xb608,0x1e7));var _0x8b60=function(_0x545ca0,_0xefd646){_0x545ca0=_0x545ca0-0x0;var _0x2cdccc=_0xb608[_0x545ca0];return _0x2cdccc;};'use strict';var multer=require('multer');var util=require(_0x8b60('0x0'));var path=require(_0x8b60('0x1'));var timeout=require(_0x8b60('0x2'));var express=require(_0x8b60('0x3'));var router=express[_0x8b60('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8b60('0x5'));var controller=require(_0x8b60('0x6'));router[_0x8b60('0x7')]('/',auth['isAuthenticated'](),controller[_0x8b60('0x8')]);router[_0x8b60('0x7')](_0x8b60('0x9'),auth[_0x8b60('0xa')](),controller['show']);router[_0x8b60('0x7')](_0x8b60('0xb'),auth[_0x8b60('0xa')](),controller[_0x8b60('0xc')]);router[_0x8b60('0x7')](_0x8b60('0xd'),auth[_0x8b60('0xa')](),controller[_0x8b60('0xe')]);router[_0x8b60('0x7')](_0x8b60('0xf'),auth[_0x8b60('0xa')](),controller[_0x8b60('0x10')]);router[_0x8b60('0x7')](_0x8b60('0x11'),auth[_0x8b60('0xa')](),controller['getHopperBlacks']);router['get'](_0x8b60('0x12'),auth[_0x8b60('0xa')](),controller[_0x8b60('0x13')]);router[_0x8b60('0x7')]('/:id/blacklists',auth[_0x8b60('0xa')](),controller['getBlackLists']);router[_0x8b60('0x14')]('/',auth['isAuthenticated'](),controller[_0x8b60('0x15')]);router[_0x8b60('0x14')]('/:id/clone',auth[_0x8b60('0xa')](),controller[_0x8b60('0x16')]);router['post']('/:id/lists',auth[_0x8b60('0xa')](),controller[_0x8b60('0x17')]);router['post'](_0x8b60('0x18'),auth['isAuthenticated'](),controller[_0x8b60('0x19')]);router[_0x8b60('0x1a')](_0x8b60('0x9'),auth[_0x8b60('0xa')](),controller[_0x8b60('0x1b')]);router[_0x8b60('0x1c')](_0x8b60('0x9'),auth[_0x8b60('0xa')](),controller['destroy']);router[_0x8b60('0x1c')](_0x8b60('0x12'),auth[_0x8b60('0xa')](),controller[_0x8b60('0x1d')]);router[_0x8b60('0x1c')](_0x8b60('0x18'),auth[_0x8b60('0xa')](),controller[_0x8b60('0x1e')]);module[_0x8b60('0x1f')]=router; \ No newline at end of file +var _0xf4de=['multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','put','update','delete','destroy','removeBlackLists'];(function(_0x3a3fcc,_0x38afb3){var _0xe16438=function(_0x2280b4){while(--_0x2280b4){_0x3a3fcc['push'](_0x3a3fcc['shift']());}};_0xe16438(++_0x38afb3);}(_0xf4de,0x160));var _0xef4d=function(_0x340fc8,_0x5dbd85){_0x340fc8=_0x340fc8-0x0;var _0x38df28=_0xf4de[_0x340fc8];return _0x38df28;};'use strict';var multer=require(_0xef4d('0x0'));var util=require('util');var path=require(_0xef4d('0x1'));var timeout=require(_0xef4d('0x2'));var express=require(_0xef4d('0x3'));var router=express['Router']();var auth=require(_0xef4d('0x4'));var interaction=require(_0xef4d('0x5'));var config=require(_0xef4d('0x6'));var controller=require(_0xef4d('0x7'));router[_0xef4d('0x8')]('/',auth['isAuthenticated'](),controller[_0xef4d('0x9')]);router[_0xef4d('0x8')](_0xef4d('0xa'),auth[_0xef4d('0xb')](),controller['show']);router[_0xef4d('0x8')]('/:id/hoppers',auth[_0xef4d('0xb')](),controller[_0xef4d('0xc')]);router['get'](_0xef4d('0xd'),auth[_0xef4d('0xb')](),controller[_0xef4d('0xe')]);router[_0xef4d('0x8')](_0xef4d('0xf'),auth[_0xef4d('0xb')](),controller[_0xef4d('0x10')]);router[_0xef4d('0x8')](_0xef4d('0x11'),auth[_0xef4d('0xb')](),controller[_0xef4d('0x12')]);router[_0xef4d('0x8')](_0xef4d('0x13'),auth[_0xef4d('0xb')](),controller[_0xef4d('0x14')]);router[_0xef4d('0x8')](_0xef4d('0x15'),auth['isAuthenticated'](),controller[_0xef4d('0x16')]);router[_0xef4d('0x17')]('/',auth[_0xef4d('0xb')](),controller[_0xef4d('0x18')]);router[_0xef4d('0x17')](_0xef4d('0x19'),auth[_0xef4d('0xb')](),controller[_0xef4d('0x1a')]);router[_0xef4d('0x17')](_0xef4d('0x13'),auth[_0xef4d('0xb')](),controller['addLists']);router['post'](_0xef4d('0x15'),auth[_0xef4d('0xb')](),controller['addBlackLists']);router[_0xef4d('0x1b')](_0xef4d('0xa'),auth[_0xef4d('0xb')](),controller[_0xef4d('0x1c')]);router[_0xef4d('0x1d')]('/:id',auth[_0xef4d('0xb')](),controller[_0xef4d('0x1e')]);router[_0xef4d('0x1d')](_0xef4d('0x13'),auth[_0xef4d('0xb')](),controller['removeLists']);router['delete'](_0xef4d('0x15'),auth[_0xef4d('0xb')](),controller[_0xef4d('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 5b3f81d..c506205 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 _0x4e27=['getDataValue','key','sequelize','exports','STRING','TEXT','VIRTUAL'];(function(_0x263a49,_0x1900ca){var _0x3d2cff=function(_0x2b84f0){while(--_0x2b84f0){_0x263a49['push'](_0x263a49['shift']());}};_0x3d2cff(++_0x1900ca);}(_0x4e27,0x17c));var _0x74e2=function(_0x353a78,_0x205d80){_0x353a78=_0x353a78-0x0;var _0x502335=_0x4e27[_0x353a78];return _0x502335;};'use strict';var Sequelize=require(_0x74e2('0x0'));module[_0x74e2('0x1')]={'key':{'type':Sequelize[_0x74e2('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x74e2('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x74e2('0x2')]},'name':{'type':Sequelize[_0x74e2('0x4')],'get':function(){return this[_0x74e2('0x5')](_0x74e2('0x6'));}}}; \ No newline at end of file +var _0xd458=['VIRTUAL','getDataValue','key','exports','STRING'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xd458,0x1de));var _0x8d45=function(_0x519bf7,_0x3b46bf){_0x519bf7=_0x519bf7-0x0;var _0x1267cc=_0xd458[_0x519bf7];return _0x1267cc;};'use strict';var Sequelize=require('sequelize');module[_0x8d45('0x0')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x8d45('0x1')]},'name':{'type':Sequelize[_0x8d45('0x2')],'get':function(){return this[_0x8d45('0x3')](_0x8d45('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 0d8ebf0..8460501 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 _0xb98f=['rawAttributes','length','include','find','body','params','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','index','map','fieldName','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','CannedAnswer','rows','catch','keys'];(function(_0x1f26d3,_0x32ee3c){var _0x3d48de=function(_0x38b200){while(--_0x38b200){_0x1f26d3['push'](_0x1f26d3['shift']());}};_0x3d48de(++_0x32ee3c);}(_0xb98f,0x1cb));var _0xfb98=function(_0x2fe76b,_0x43899f){_0x2fe76b=_0x2fe76b-0x0;var _0x19e9d3=_0xb98f[_0x2fe76b];return _0x19e9d3;};'use strict';var pdf=require(_0xfb98('0x0'));var emlformat=require(_0xfb98('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfb98('0x2'));var rp=require(_0xfb98('0x3'));var moment=require(_0xfb98('0x4'));var BPromise=require(_0xfb98('0x5'));var Mustache=require('mustache');var util=require(_0xfb98('0x6'));var path=require(_0xfb98('0x7'));var sox=require(_0xfb98('0x8'));var csv=require(_0xfb98('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfb98('0xa'));var squel=require(_0xfb98('0xb'));var crypto=require(_0xfb98('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfb98('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfb98('0xe'));var Papa=require(_0xfb98('0xf'));var Redis=require(_0xfb98('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfb98('0x11'));var as=require(_0xfb98('0x12'));var hardwareService=require(_0xfb98('0x13'));var logger=require(_0xfb98('0x14'))(_0xfb98('0x15'));var utils=require(_0xfb98('0x16'));var config=require(_0xfb98('0x17'));var db=require(_0xfb98('0x18'))['db'];function respondWithStatusCode(_0xa13c86,_0x42af0b){_0x42af0b=_0x42af0b||0xcc;return function(_0xaae1cd){if(_0xaae1cd){return _0xa13c86[_0xfb98('0x19')](_0x42af0b);}return _0xa13c86[_0xfb98('0x1a')](_0x42af0b)[_0xfb98('0x1b')]();};}function respondWithResult(_0x593d7e,_0x552e86){_0x552e86=_0x552e86||0xc8;return function(_0x3ef066){if(_0x3ef066){return _0x593d7e[_0xfb98('0x1a')](_0x552e86)[_0xfb98('0x1c')](_0x3ef066);}};}function respondWithFilteredResult(_0x59b3ac,_0x4800e1){return function(_0x19a31d){if(_0x19a31d){var _0x1b8a3f=_0x19a31d[_0xfb98('0x1d')],_0x41cf57=_0x4800e1[_0xfb98('0x1e')],_0x39a517=_0x4800e1['offset']+_0x4800e1['limit'],_0x5a401c;if(_0x39a517>=_0x1b8a3f){_0x39a517=_0x1b8a3f;_0x5a401c=0xc8;}else{_0x5a401c=0xce;}_0x59b3ac[_0xfb98('0x1a')](_0x5a401c);return _0x59b3ac[_0xfb98('0x1f')](_0xfb98('0x20'),_0x41cf57+'-'+_0x39a517+'/'+_0x1b8a3f)['json'](_0x19a31d);}return null;};}function patchUpdates(_0x498a35){return function(_0x3ad264){try{jsonpatch[_0xfb98('0x21')](_0x3ad264,_0x498a35,!![]);}catch(_0x389252){return BPromise[_0xfb98('0x22')](_0x389252);}return _0x3ad264[_0xfb98('0x23')]();};}function saveUpdates(_0x23f9e1,_0x12ba65){return function(_0x4344d8){if(_0x4344d8){return _0x4344d8[_0xfb98('0x24')](_0x23f9e1)[_0xfb98('0x25')](function(_0x20aff4){return _0x20aff4;});}return null;};}function removeEntity(_0x59f9a2,_0x577cd3){return function(_0x18b97d){if(_0x18b97d){return _0x18b97d[_0xfb98('0x26')]()[_0xfb98('0x25')](function(){var _0x41da76=_0x18b97d[_0xfb98('0x27')]({'plain':!![]});var _0x49d24e=_0xfb98('0x28');return db[_0xfb98('0x29')]['destroy']({'where':{'type':_0x49d24e,'resourceId':_0x41da76['id']}})[_0xfb98('0x25')](function(){return _0x18b97d;});})[_0xfb98('0x25')](function(){_0x59f9a2[_0xfb98('0x1a')](0xcc)[_0xfb98('0x1b')]();});}};}function handleEntityNotFound(_0x3d53aa,_0x3d7728){return function(_0x16eaa7){if(!_0x16eaa7){_0x3d53aa[_0xfb98('0x19')](0x194);}return _0x16eaa7;};}function handleError(_0x2102b9,_0x1a62ab){_0x1a62ab=_0x1a62ab||0x1f4;return function(_0x503af7){logger[_0xfb98('0x2a')](_0x503af7[_0xfb98('0x2b')]);if(_0x503af7['name']){delete _0x503af7[_0xfb98('0x2c')];}_0x2102b9[_0xfb98('0x1a')](_0x1a62ab)['send'](_0x503af7);};}exports[_0xfb98('0x2d')]=function(_0x1bde34,_0x70f5a6){var _0x5a8c20={},_0x220048={},_0x4212bc={'count':0x0,'rows':[]};var _0x258275=_[_0xfb98('0x2e')](db['CannedAnswer']['rawAttributes'],function(_0x501d7f){return{'name':_0x501d7f[_0xfb98('0x2f')],'type':_0x501d7f['type']['key']};});_0x220048['model']=_[_0xfb98('0x2e')](_0x258275,_0xfb98('0x2c'));_0x220048[_0xfb98('0x30')]=_['keys'](_0x1bde34['query']);_0x220048['filters']=_[_0xfb98('0x31')](_0x220048[_0xfb98('0x32')],_0x220048[_0xfb98('0x30')]);_0x5a8c20[_0xfb98('0x33')]=_[_0xfb98('0x31')](_0x220048['model'],qs[_0xfb98('0x34')](_0x1bde34['query'][_0xfb98('0x34')]));_0x5a8c20[_0xfb98('0x33')]=_0x5a8c20['attributes']['length']?_0x5a8c20[_0xfb98('0x33')]:_0x220048[_0xfb98('0x32')];if(!_0x1bde34[_0xfb98('0x30')][_0xfb98('0x35')](_0xfb98('0x36'))){_0x5a8c20[_0xfb98('0x37')]=qs[_0xfb98('0x37')](_0x1bde34[_0xfb98('0x30')][_0xfb98('0x37')]);_0x5a8c20[_0xfb98('0x1e')]=qs[_0xfb98('0x1e')](_0x1bde34[_0xfb98('0x30')][_0xfb98('0x1e')]);}_0x5a8c20[_0xfb98('0x38')]=qs['sort'](_0x1bde34[_0xfb98('0x30')][_0xfb98('0x39')]);_0x5a8c20[_0xfb98('0x3a')]=qs[_0xfb98('0x3b')](_['pick'](_0x1bde34[_0xfb98('0x30')],_0x220048[_0xfb98('0x3b')]),_0x258275);if(_0x1bde34[_0xfb98('0x30')][_0xfb98('0x3c')]){_0x5a8c20[_0xfb98('0x3a')]=_[_0xfb98('0x3d')](_0x5a8c20[_0xfb98('0x3a')],{'$or':_['map'](_0x258275,function(_0x460948){if(_0x460948['type']!==_0xfb98('0x3e')){var _0x55644f={};_0x55644f[_0x460948[_0xfb98('0x2c')]]={'$like':'%'+_0x1bde34[_0xfb98('0x30')][_0xfb98('0x3c')]+'%'};return _0x55644f;}})});}_0x5a8c20=_[_0xfb98('0x3d')]({},_0x5a8c20,_0x1bde34[_0xfb98('0x3f')]);var _0x2942e4={'where':_0x5a8c20[_0xfb98('0x3a')]};return db['CannedAnswer'][_0xfb98('0x1d')](_0x2942e4)['then'](function(_0x1fe2d0){_0x4212bc[_0xfb98('0x1d')]=_0x1fe2d0;if(_0x1bde34['query'][_0xfb98('0x40')]){_0x5a8c20['include']=[{'all':!![]}];}return db[_0xfb98('0x41')]['findAll'](_0x5a8c20);})['then'](function(_0xec73ce){_0x4212bc[_0xfb98('0x42')]=_0xec73ce;return _0x4212bc;})['then'](respondWithFilteredResult(_0x70f5a6,_0x5a8c20))[_0xfb98('0x43')](handleError(_0x70f5a6,null));};exports['show']=function(_0x3e8a23,_0x360475){var _0x7150b6={'raw':!![],'where':{'id':_0x3e8a23['params']['id']}},_0x37d37d={};_0x37d37d[_0xfb98('0x32')]=_[_0xfb98('0x44')](db[_0xfb98('0x41')][_0xfb98('0x45')]);_0x37d37d[_0xfb98('0x30')]=_[_0xfb98('0x44')](_0x3e8a23[_0xfb98('0x30')]);_0x37d37d['filters']=_[_0xfb98('0x31')](_0x37d37d[_0xfb98('0x32')],_0x37d37d[_0xfb98('0x30')]);_0x7150b6['attributes']=_['intersection'](_0x37d37d['model'],qs['fields'](_0x3e8a23[_0xfb98('0x30')][_0xfb98('0x34')]));_0x7150b6['attributes']=_0x7150b6['attributes'][_0xfb98('0x46')]?_0x7150b6['attributes']:_0x37d37d['model'];if(_0x3e8a23['query'][_0xfb98('0x40')]){_0x7150b6[_0xfb98('0x47')]=[{'all':!![]}];}_0x7150b6=_[_0xfb98('0x3d')]({},_0x7150b6,_0x3e8a23[_0xfb98('0x3f')]);return db[_0xfb98('0x41')][_0xfb98('0x48')](_0x7150b6)[_0xfb98('0x25')](handleEntityNotFound(_0x360475,null))[_0xfb98('0x25')](respondWithResult(_0x360475,null))[_0xfb98('0x43')](handleError(_0x360475,null));};exports[_0xfb98('0x24')]=function(_0x1bd904,_0x42d1e5){if(_0x1bd904[_0xfb98('0x49')]['id']){delete _0x1bd904['body']['id'];}return db[_0xfb98('0x41')]['find']({'where':{'id':_0x1bd904[_0xfb98('0x4a')]['id']}})['then'](handleEntityNotFound(_0x42d1e5,null))[_0xfb98('0x25')](saveUpdates(_0x1bd904['body'],null))['then'](respondWithResult(_0x42d1e5,null))[_0xfb98('0x43')](handleError(_0x42d1e5,null));};exports[_0xfb98('0x26')]=function(_0x440eb8,_0x4d7493){return db[_0xfb98('0x41')][_0xfb98('0x48')]({'where':{'id':_0x440eb8['params']['id']}})[_0xfb98('0x25')](handleEntityNotFound(_0x4d7493,null))[_0xfb98('0x25')](removeEntity(_0x4d7493,null))['catch'](handleError(_0x4d7493,null));};exports['create']=function(_0x3bbf06,_0x427246){var _0x394950={'key':_0x3bbf06[_0xfb98('0x49')]['key']};if(_0x3bbf06[_0xfb98('0x49')]['MailAccountId']){_0x394950[_0xfb98('0x4b')]=_0x3bbf06[_0xfb98('0x49')][_0xfb98('0x4b')];}else if(_0x3bbf06[_0xfb98('0x49')]['SmsAccountId']){_0x394950[_0xfb98('0x4c')]=_0x3bbf06[_0xfb98('0x49')][_0xfb98('0x4c')];}else if(_0x3bbf06[_0xfb98('0x49')][_0xfb98('0x4d')]){_0x394950[_0xfb98('0x4d')]=_0x3bbf06['body'][_0xfb98('0x4d')];}else if(_0x3bbf06[_0xfb98('0x49')]['ChatWebsiteId']){_0x394950[_0xfb98('0x4e')]=_0x3bbf06[_0xfb98('0x49')][_0xfb98('0x4e')];}return db[_0xfb98('0x41')]['find']({'where':_0x394950})['then'](function(_0x434186){if(_0x434186){throw new db[(_0xfb98('0x4f'))][(_0xfb98('0x50'))](_0xfb98('0x51'));}return db[_0xfb98('0x41')][_0xfb98('0x52')](_0x3bbf06[_0xfb98('0x49')]);})[_0xfb98('0x25')](function(_0x33ceec){var _0x3f1c39=_0x3bbf06[_0xfb98('0x53')][_0xfb98('0x27')]({'plain':!![]});if(!_0x3f1c39)throw new Error(_0xfb98('0x54'));if(_0x3f1c39[_0xfb98('0x55')]===_0xfb98('0x53')){var _0x370093=_0x33ceec[_0xfb98('0x27')]({'plain':!![]});return db['UserProfileSection'][_0xfb98('0x48')]({'where':{'name':_0xfb98('0x28'),'userProfileId':_0x3f1c39[_0xfb98('0x56')]},'raw':!![]})[_0xfb98('0x25')](function(_0x898a3b){if(_0x898a3b&&_0x898a3b[_0xfb98('0x57')]===0x0){return db['UserProfileResource'][_0xfb98('0x52')]({'name':_0x370093[_0xfb98('0x2c')],'resourceId':_0x370093['id'],'type':_0x898a3b[_0xfb98('0x2c')],'sectionId':_0x898a3b['id']},{})['then'](function(){return _0x33ceec;});}else{return _0x33ceec;}})[_0xfb98('0x43')](function(_0x15839a){logger[_0xfb98('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15839a);throw _0x15839a;});}return _0x33ceec;})['then'](respondWithResult(_0x427246,0xc9))['catch'](handleError(_0x427246,null));}; \ No newline at end of file +var _0x2115=['key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','CannedAnswers','UserProfileResource','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','update','body'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x2115,0xbf));var _0x5211=function(_0x59710f,_0x44c7f0){_0x59710f=_0x59710f-0x0;var _0xaae66a=_0x2115[_0x59710f];return _0xaae66a;};'use strict';var pdf=require(_0x5211('0x0'));var emlformat=require(_0x5211('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5211('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5211('0x3'));var moment=require(_0x5211('0x4'));var BPromise=require(_0x5211('0x5'));var Mustache=require(_0x5211('0x6'));var util=require(_0x5211('0x7'));var path=require(_0x5211('0x8'));var sox=require(_0x5211('0x9'));var csv=require(_0x5211('0xa'));var ejs=require(_0x5211('0xb'));var fs=require('fs');var _=require(_0x5211('0xc'));var squel=require('squel');var crypto=require(_0x5211('0xd'));var jsforce=require(_0x5211('0xe'));var deskjs=require(_0x5211('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5211('0x10'));var Papa=require(_0x5211('0x11'));var Redis=require(_0x5211('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5211('0x13'));var as=require(_0x5211('0x14'));var hardwareService=require(_0x5211('0x15'));var logger=require(_0x5211('0x16'))(_0x5211('0x17'));var utils=require(_0x5211('0x18'));var config=require(_0x5211('0x19'));var db=require(_0x5211('0x1a'))['db'];function respondWithStatusCode(_0x200393,_0x21e253){_0x21e253=_0x21e253||0xcc;return function(_0x4eb959){if(_0x4eb959){return _0x200393[_0x5211('0x1b')](_0x21e253);}return _0x200393[_0x5211('0x1c')](_0x21e253)[_0x5211('0x1d')]();};}function respondWithResult(_0x13981d,_0x1ccc8e){_0x1ccc8e=_0x1ccc8e||0xc8;return function(_0x36caca){if(_0x36caca){return _0x13981d[_0x5211('0x1c')](_0x1ccc8e)[_0x5211('0x1e')](_0x36caca);}};}function respondWithFilteredResult(_0x1d07f5,_0x404370){return function(_0x1c6db1){if(_0x1c6db1){var _0x596048=_0x1c6db1[_0x5211('0x1f')],_0x22941c=_0x404370[_0x5211('0x20')],_0x539883=_0x404370[_0x5211('0x20')]+_0x404370[_0x5211('0x21')],_0xfd174b;if(_0x539883>=_0x596048){_0x539883=_0x596048;_0xfd174b=0xc8;}else{_0xfd174b=0xce;}_0x1d07f5['status'](_0xfd174b);return _0x1d07f5[_0x5211('0x22')]('Content-Range',_0x22941c+'-'+_0x539883+'/'+_0x596048)['json'](_0x1c6db1);}return null;};}function patchUpdates(_0x353a01){return function(_0x3e78c0){try{jsonpatch[_0x5211('0x23')](_0x3e78c0,_0x353a01,!![]);}catch(_0x3e94ad){return BPromise[_0x5211('0x24')](_0x3e94ad);}return _0x3e78c0[_0x5211('0x25')]();};}function saveUpdates(_0x4bbb4d,_0x5e927b){return function(_0x290c97){if(_0x290c97){return _0x290c97['update'](_0x4bbb4d)[_0x5211('0x26')](function(_0x412f43){return _0x412f43;});}return null;};}function removeEntity(_0x3a7ec1,_0x1524de){return function(_0xf983f2){if(_0xf983f2){return _0xf983f2[_0x5211('0x27')]()[_0x5211('0x26')](function(){var _0x3cf0fa=_0xf983f2['get']({'plain':!![]});var _0x455992=_0x5211('0x28');return db[_0x5211('0x29')]['destroy']({'where':{'type':_0x455992,'resourceId':_0x3cf0fa['id']}})[_0x5211('0x26')](function(){return _0xf983f2;});})[_0x5211('0x26')](function(){_0x3a7ec1[_0x5211('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3466a1,_0x12323d){return function(_0x37ca41){if(!_0x37ca41){_0x3466a1['sendStatus'](0x194);}return _0x37ca41;};}function handleError(_0x3fa475,_0x4067e2){_0x4067e2=_0x4067e2||0x1f4;return function(_0x1f9853){logger[_0x5211('0x2a')](_0x1f9853[_0x5211('0x2b')]);if(_0x1f9853[_0x5211('0x2c')]){delete _0x1f9853[_0x5211('0x2c')];}_0x3fa475[_0x5211('0x1c')](_0x4067e2)[_0x5211('0x2d')](_0x1f9853);};}exports[_0x5211('0x2e')]=function(_0x307c0f,_0xaeadab){var _0x73c9bd={},_0x5536a1={},_0xf3916={'count':0x0,'rows':[]};var _0x23998b=_[_0x5211('0x2f')](db[_0x5211('0x30')][_0x5211('0x31')],function(_0x289ec3){return{'name':_0x289ec3[_0x5211('0x32')],'type':_0x289ec3[_0x5211('0x33')]['key']};});_0x5536a1['model']=_[_0x5211('0x2f')](_0x23998b,_0x5211('0x2c'));_0x5536a1[_0x5211('0x34')]=_[_0x5211('0x35')](_0x307c0f[_0x5211('0x34')]);_0x5536a1[_0x5211('0x36')]=_[_0x5211('0x37')](_0x5536a1['model'],_0x5536a1[_0x5211('0x34')]);_0x73c9bd[_0x5211('0x38')]=_['intersection'](_0x5536a1[_0x5211('0x39')],qs['fields'](_0x307c0f['query'][_0x5211('0x3a')]));_0x73c9bd['attributes']=_0x73c9bd[_0x5211('0x38')][_0x5211('0x3b')]?_0x73c9bd[_0x5211('0x38')]:_0x5536a1[_0x5211('0x39')];if(!_0x307c0f[_0x5211('0x34')]['hasOwnProperty']('nolimit')){_0x73c9bd[_0x5211('0x21')]=qs['limit'](_0x307c0f[_0x5211('0x34')]['limit']);_0x73c9bd['offset']=qs[_0x5211('0x20')](_0x307c0f['query'][_0x5211('0x20')]);}_0x73c9bd['order']=qs[_0x5211('0x3c')](_0x307c0f[_0x5211('0x34')]['sort']);_0x73c9bd[_0x5211('0x3d')]=qs['filters'](_['pick'](_0x307c0f[_0x5211('0x34')],_0x5536a1[_0x5211('0x36')]),_0x23998b);if(_0x307c0f[_0x5211('0x34')][_0x5211('0x3e')]){_0x73c9bd[_0x5211('0x3d')]=_['merge'](_0x73c9bd[_0x5211('0x3d')],{'$or':_['map'](_0x23998b,function(_0x4cd744){if(_0x4cd744[_0x5211('0x33')]!==_0x5211('0x3f')){var _0x64078c={};_0x64078c[_0x4cd744[_0x5211('0x2c')]]={'$like':'%'+_0x307c0f[_0x5211('0x34')][_0x5211('0x3e')]+'%'};return _0x64078c;}})});}_0x73c9bd=_[_0x5211('0x40')]({},_0x73c9bd,_0x307c0f[_0x5211('0x41')]);var _0x1473f4={'where':_0x73c9bd[_0x5211('0x3d')]};return db[_0x5211('0x30')][_0x5211('0x1f')](_0x1473f4)[_0x5211('0x26')](function(_0x4045f8){_0xf3916[_0x5211('0x1f')]=_0x4045f8;if(_0x307c0f[_0x5211('0x34')][_0x5211('0x42')]){_0x73c9bd['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x5211('0x43')](_0x73c9bd);})[_0x5211('0x26')](function(_0x1128b5){_0xf3916[_0x5211('0x44')]=_0x1128b5;return _0xf3916;})[_0x5211('0x26')](respondWithFilteredResult(_0xaeadab,_0x73c9bd))[_0x5211('0x45')](handleError(_0xaeadab,null));};exports[_0x5211('0x46')]=function(_0x42f2cc,_0x2eb6fc){var _0x265d8b={'raw':!![],'where':{'id':_0x42f2cc[_0x5211('0x47')]['id']}},_0x47768b={};_0x47768b[_0x5211('0x39')]=_[_0x5211('0x35')](db[_0x5211('0x30')][_0x5211('0x31')]);_0x47768b['query']=_['keys'](_0x42f2cc[_0x5211('0x34')]);_0x47768b[_0x5211('0x36')]=_[_0x5211('0x37')](_0x47768b[_0x5211('0x39')],_0x47768b[_0x5211('0x34')]);_0x265d8b[_0x5211('0x38')]=_['intersection'](_0x47768b['model'],qs[_0x5211('0x3a')](_0x42f2cc[_0x5211('0x34')]['fields']));_0x265d8b[_0x5211('0x38')]=_0x265d8b[_0x5211('0x38')][_0x5211('0x3b')]?_0x265d8b[_0x5211('0x38')]:_0x47768b[_0x5211('0x39')];if(_0x42f2cc[_0x5211('0x34')]['includeAll']){_0x265d8b[_0x5211('0x48')]=[{'all':!![]}];}_0x265d8b=_[_0x5211('0x40')]({},_0x265d8b,_0x42f2cc[_0x5211('0x41')]);return db[_0x5211('0x30')][_0x5211('0x49')](_0x265d8b)[_0x5211('0x26')](handleEntityNotFound(_0x2eb6fc,null))[_0x5211('0x26')](respondWithResult(_0x2eb6fc,null))[_0x5211('0x45')](handleError(_0x2eb6fc,null));};exports[_0x5211('0x4a')]=function(_0x2856ce,_0x4a6696){if(_0x2856ce[_0x5211('0x4b')]['id']){delete _0x2856ce['body']['id'];}return db[_0x5211('0x30')][_0x5211('0x49')]({'where':{'id':_0x2856ce['params']['id']}})['then'](handleEntityNotFound(_0x4a6696,null))[_0x5211('0x26')](saveUpdates(_0x2856ce[_0x5211('0x4b')],null))[_0x5211('0x26')](respondWithResult(_0x4a6696,null))[_0x5211('0x45')](handleError(_0x4a6696,null));};exports[_0x5211('0x27')]=function(_0x2b2451,_0x3f658d){return db[_0x5211('0x30')]['find']({'where':{'id':_0x2b2451[_0x5211('0x47')]['id']}})[_0x5211('0x26')](handleEntityNotFound(_0x3f658d,null))[_0x5211('0x26')](removeEntity(_0x3f658d,null))[_0x5211('0x45')](handleError(_0x3f658d,null));};exports['create']=function(_0x5818f4,_0x6c0381){var _0x3eae23={'key':_0x5818f4[_0x5211('0x4b')][_0x5211('0x4c')]};if(_0x5818f4[_0x5211('0x4b')][_0x5211('0x4d')]){_0x3eae23[_0x5211('0x4d')]=_0x5818f4[_0x5211('0x4b')][_0x5211('0x4d')];}else if(_0x5818f4[_0x5211('0x4b')][_0x5211('0x4e')]){_0x3eae23[_0x5211('0x4e')]=_0x5818f4['body'][_0x5211('0x4e')];}else if(_0x5818f4[_0x5211('0x4b')]['OpenchannelAccountId']){_0x3eae23[_0x5211('0x4f')]=_0x5818f4[_0x5211('0x4b')][_0x5211('0x4f')];}else if(_0x5818f4[_0x5211('0x4b')][_0x5211('0x50')]){_0x3eae23['ChatWebsiteId']=_0x5818f4['body'][_0x5211('0x50')];}return db[_0x5211('0x30')]['find']({'where':_0x3eae23})['then'](function(_0x5f1a63){if(_0x5f1a63){throw new db['Sequelize']['ValidationError'](_0x5211('0x51'));}return db[_0x5211('0x30')]['create'](_0x5818f4[_0x5211('0x4b')]);})[_0x5211('0x26')](function(_0x54da56){var _0x3af03d=_0x5818f4[_0x5211('0x52')][_0x5211('0x53')]({'plain':!![]});if(!_0x3af03d)throw new Error(_0x5211('0x54'));if(_0x3af03d[_0x5211('0x55')]===_0x5211('0x52')){var _0x2411ad=_0x54da56[_0x5211('0x53')]({'plain':!![]});return db['UserProfileSection'][_0x5211('0x49')]({'where':{'name':_0x5211('0x28'),'userProfileId':_0x3af03d['userProfileId']},'raw':!![]})['then'](function(_0x5f136d){if(_0x5f136d&&_0x5f136d[_0x5211('0x56')]===0x0){return db['UserProfileResource'][_0x5211('0x57')]({'name':_0x2411ad[_0x5211('0x2c')],'resourceId':_0x2411ad['id'],'type':_0x5f136d[_0x5211('0x2c')],'sectionId':_0x5f136d['id']},{})[_0x5211('0x26')](function(){return _0x54da56;});}else{return _0x54da56;}})[_0x5211('0x45')](function(_0x302b3d){logger[_0x5211('0x2a')](_0x5211('0x58'),_0x302b3d);throw _0x302b3d;});}return _0x54da56;})[_0x5211('0x26')](respondWithResult(_0x6c0381,0xc9))[_0x5211('0x45')](handleError(_0x6c0381,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index f662a14..c79e9de 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 _0x8c52=['path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5e47c0,_0x493994){var _0x3db4ea=function(_0x35f2bc){while(--_0x35f2bc){_0x5e47c0['push'](_0x5e47c0['shift']());}};_0x3db4ea(++_0x493994);}(_0x8c52,0x7e));var _0x28c5=function(_0x937506,_0x32072c){_0x937506=_0x937506-0x0;var _0x5d6d09=_0x8c52[_0x937506];return _0x5d6d09;};'use strict';var _=require(_0x28c5('0x0'));var util=require('util');var logger=require(_0x28c5('0x1'))(_0x28c5('0x2'));var moment=require(_0x28c5('0x3'));var BPromise=require(_0x28c5('0x4'));var rp=require(_0x28c5('0x5'));var fs=require('fs');var path=require(_0x28c5('0x6'));var rimraf=require(_0x28c5('0x7'));var config=require(_0x28c5('0x8'));var attributes=require(_0x28c5('0x9'));module[_0x28c5('0xa')]=function(_0x209f3d,_0x3b5c38){return _0x209f3d['define']('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x28c5('0xb')});}; \ No newline at end of file +var _0x78d3=['exports','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes'];(function(_0x5315bc,_0x3788a0){var _0x40b280=function(_0x4369ea){while(--_0x4369ea){_0x5315bc['push'](_0x5315bc['shift']());}};_0x40b280(++_0x3788a0);}(_0x78d3,0x73));var _0x378d=function(_0x40e609,_0x4e4b74){_0x40e609=_0x40e609-0x0;var _0xf46928=_0x78d3[_0x40e609];return _0xf46928;};'use strict';var _=require(_0x378d('0x0'));var util=require(_0x378d('0x1'));var logger=require(_0x378d('0x2'))(_0x378d('0x3'));var moment=require(_0x378d('0x4'));var BPromise=require(_0x378d('0x5'));var rp=require(_0x378d('0x6'));var fs=require('fs');var path=require(_0x378d('0x7'));var rimraf=require(_0x378d('0x8'));var config=require(_0x378d('0x9'));var attributes=require(_0x378d('0xa'));module[_0x378d('0xb')]=function(_0xc18c0b,_0x59117c){return _0xc18c0b['define']('CannedAnswer',attributes,{'tableName':_0x378d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x378d('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index b6e9f45..512a042 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 _0x9dfe=['randomstring','../../config/utils','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','CannedAnswer,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9dfe,0xcf));var _0xe9df=function(_0x4c95cc,_0x58b755){_0x4c95cc=_0x4c95cc-0x0;var _0x254f7f=_0x9dfe[_0x4c95cc];return _0x254f7f;};'use strict';var _=require(_0xe9df('0x0'));var util=require(_0xe9df('0x1'));var moment=require(_0xe9df('0x2'));var BPromise=require('bluebird');var rs=require(_0xe9df('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9df('0x4'));var logger=require('../../config/logger')(_0xe9df('0x5'));var config=require(_0xe9df('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe9df('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x19f919,_0x457985,_0x5abbaa){return new BPromise(function(_0x4423e9,_0x4bf6ff){return client[_0xe9df('0x8')](_0x19f919,_0x5abbaa)[_0xe9df('0x9')](function(_0x422eb6){logger[_0xe9df('0xa')]('CannedAnswer,\x20%s,\x20%s',_0x457985,_0xe9df('0xb'));logger[_0xe9df('0xc')](_0xe9df('0xd'),_0x457985,_0xe9df('0xb'),JSON[_0xe9df('0xe')](_0x422eb6));if(_0x422eb6[_0xe9df('0xf')]){if(_0x422eb6['error'][_0xe9df('0x10')]===0x1f4){logger['error'](_0xe9df('0x11'),_0x457985,_0x422eb6[_0xe9df('0xf')][_0xe9df('0x12')]);return _0x4bf6ff(_0x422eb6[_0xe9df('0xf')]['message']);}logger[_0xe9df('0xf')]('CannedAnswer,\x20%s,\x20%s',_0x457985,_0x422eb6[_0xe9df('0xf')]['message']);return _0x4423e9(_0x422eb6['error']['message']);}else{logger['info'](_0xe9df('0x11'),_0x457985,'request\x20sent');_0x4423e9(_0x422eb6[_0xe9df('0x13')]['message']);}})[_0xe9df('0x14')](function(_0x56c911){logger[_0xe9df('0xf')](_0xe9df('0x11'),_0x457985,_0x56c911);_0x4bf6ff(_0x56c911);});});} \ No newline at end of file +var _0xae07=['http','request','then','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client'];(function(_0x2e9bbc,_0xe722cc){var _0x129d25=function(_0x4ecb64){while(--_0x4ecb64){_0x2e9bbc['push'](_0x2e9bbc['shift']());}};_0x129d25(++_0xe722cc);}(_0xae07,0x1da));var _0x7ae0=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xae07[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x7ae0('0x0'));var util=require(_0x7ae0('0x1'));var moment=require(_0x7ae0('0x2'));var BPromise=require(_0x7ae0('0x3'));var rs=require(_0x7ae0('0x4'));var fs=require('fs');var Redis=require(_0x7ae0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ae0('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7ae0('0x7'));var client=jayson[_0x7ae0('0x8')][_0x7ae0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xb3e597,_0x56ba46,_0x1efef8){return new BPromise(function(_0x1f3f85,_0x4fa383){return client[_0x7ae0('0xa')](_0xb3e597,_0x1efef8)[_0x7ae0('0xb')](function(_0x3746ab){logger['info'](_0x7ae0('0xc'),_0x56ba46,_0x7ae0('0xd'));logger[_0x7ae0('0xe')](_0x7ae0('0xf'),_0x56ba46,_0x7ae0('0xd'),JSON[_0x7ae0('0x10')](_0x3746ab));if(_0x3746ab[_0x7ae0('0x11')]){if(_0x3746ab[_0x7ae0('0x11')]['code']===0x1f4){logger[_0x7ae0('0x11')](_0x7ae0('0xc'),_0x56ba46,_0x3746ab['error'][_0x7ae0('0x12')]);return _0x4fa383(_0x3746ab[_0x7ae0('0x11')][_0x7ae0('0x12')]);}logger[_0x7ae0('0x11')](_0x7ae0('0xc'),_0x56ba46,_0x3746ab[_0x7ae0('0x11')][_0x7ae0('0x12')]);return _0x1f3f85(_0x3746ab[_0x7ae0('0x11')][_0x7ae0('0x12')]);}else{logger['info'](_0x7ae0('0xc'),_0x56ba46,'request\x20sent');_0x1f3f85(_0x3746ab[_0x7ae0('0x13')]['message']);}})[_0x7ae0('0x14')](function(_0x216538){logger[_0x7ae0('0x11')]('CannedAnswer,\x20%s,\x20%s',_0x56ba46,_0x216538);_0x4fa383(_0x216538);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index a3a7303..32ff29a 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 _0x9f17=['get','index','isAuthenticated','show','post','create','put','update','/:id','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller'];(function(_0x411ef1,_0x5aa7e6){var _0x2ac899=function(_0x5cb8f0){while(--_0x5cb8f0){_0x411ef1['push'](_0x411ef1['shift']());}};_0x2ac899(++_0x5aa7e6);}(_0x9f17,0x1f0));var _0x79f1=function(_0x2e52a2,_0x4ec214){_0x2e52a2=_0x2e52a2-0x0;var _0x489e12=_0x9f17[_0x2e52a2];return _0x489e12;};'use strict';var multer=require(_0x79f1('0x0'));var util=require('util');var path=require(_0x79f1('0x1'));var timeout=require('connect-timeout');var express=require(_0x79f1('0x2'));var router=express[_0x79f1('0x3')]();var auth=require(_0x79f1('0x4'));var interaction=require(_0x79f1('0x5'));var config=require(_0x79f1('0x6'));var controller=require(_0x79f1('0x7'));router[_0x79f1('0x8')]('/',auth['isAuthenticated'](),controller[_0x79f1('0x9')]);router[_0x79f1('0x8')]('/:id',auth[_0x79f1('0xa')](),controller[_0x79f1('0xb')]);router[_0x79f1('0xc')]('/',auth['isAuthenticated'](),controller[_0x79f1('0xd')]);router[_0x79f1('0xe')]('/:id',auth[_0x79f1('0xa')](),controller[_0x79f1('0xf')]);router['delete'](_0x79f1('0x10'),auth[_0x79f1('0xa')](),controller['destroy']);module[_0x79f1('0x11')]=router; \ No newline at end of file +var _0x813e=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x1c156e,_0x3263a6){var _0x58fc22=function(_0x42f1eb){while(--_0x42f1eb){_0x1c156e['push'](_0x1c156e['shift']());}};_0x58fc22(++_0x3263a6);}(_0x813e,0xba));var _0xe813=function(_0x39e164,_0x2cb93b){_0x39e164=_0x39e164-0x0;var _0x13fa6b=_0x813e[_0x39e164];return _0x13fa6b;};'use strict';var multer=require(_0xe813('0x0'));var util=require(_0xe813('0x1'));var path=require(_0xe813('0x2'));var timeout=require(_0xe813('0x3'));var express=require(_0xe813('0x4'));var router=express[_0xe813('0x5')]();var auth=require(_0xe813('0x6'));var interaction=require(_0xe813('0x7'));var config=require(_0xe813('0x8'));var controller=require(_0xe813('0x9'));router['get']('/',auth[_0xe813('0xa')](),controller[_0xe813('0xb')]);router['get']('/:id',auth[_0xe813('0xa')](),controller[_0xe813('0xc')]);router[_0xe813('0xd')]('/',auth['isAuthenticated'](),controller[_0xe813('0xe')]);router[_0xe813('0xf')](_0xe813('0x10'),auth[_0xe813('0xa')](),controller[_0xe813('0x11')]);router[_0xe813('0x12')]('/:id',auth[_0xe813('0xa')](),controller[_0xe813('0x13')]);module[_0xe813('0x14')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index bc06a19..91ea38f 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 _0xe5ef=['INTEGER','sequelize','1970-01-01\x2000:00:01','STRING'];(function(_0x37ffc1,_0x11d498){var _0x4ffbd8=function(_0x461a61){while(--_0x461a61){_0x37ffc1['push'](_0x37ffc1['shift']());}};_0x4ffbd8(++_0x11d498);}(_0xe5ef,0x1c5));var _0xfe5e=function(_0x2a39fc,_0x3cadf5){_0x2a39fc=_0x2a39fc-0x0;var _0x22e8fd=_0xe5ef[_0x2a39fc];return _0x22e8fd;};'use strict';var Sequelize=require(_0xfe5e('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xfe5e('0x1')},'clid':{'type':Sequelize[_0xfe5e('0x2')]},'src':{'type':Sequelize[_0xfe5e('0x2')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0xfe5e('0x2')]},'channel':{'type':Sequelize[_0xfe5e('0x2')]},'dstchannel':{'type':Sequelize[_0xfe5e('0x2')]},'lastapp':{'type':Sequelize[_0xfe5e('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xfe5e('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xfe5e('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xfe5e('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xfe5e('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xfe5e('0x2')]},'linkedid':{'type':Sequelize[_0xfe5e('0x2')]},'sequence':{'type':Sequelize[_0xfe5e('0x2')]},'peeraccount':{'type':Sequelize[_0xfe5e('0x2')]},'type':{'type':Sequelize[_0xfe5e('0x2')]},'tag':{'type':Sequelize[_0xfe5e('0x2')]}}; \ No newline at end of file +var _0x95b1=['sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x95b1,0x7e));var _0x195b=function(_0x2eff65,_0x56d9be){_0x2eff65=_0x2eff65-0x0;var _0x1e898a=_0x95b1[_0x2eff65];return _0x1e898a;};'use strict';var Sequelize=require(_0x195b('0x0'));module[_0x195b('0x1')]={'calldate':{'type':Sequelize[_0x195b('0x2')],'allowNull':![],'defaultValue':_0x195b('0x3')},'clid':{'type':Sequelize[_0x195b('0x4')]},'src':{'type':Sequelize[_0x195b('0x4')]},'dst':{'type':Sequelize[_0x195b('0x4')]},'dcontext':{'type':Sequelize[_0x195b('0x4')]},'channel':{'type':Sequelize[_0x195b('0x4')]},'dstchannel':{'type':Sequelize[_0x195b('0x4')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x195b('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x195b('0x4')]},'amaflags':{'type':Sequelize[_0x195b('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x195b('0x4')]},'userfield':{'type':Sequelize[_0x195b('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x195b('0x4')]},'sequence':{'type':Sequelize[_0x195b('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x195b('0x4')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index a5178a2..7fef8d6 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 _0xb40f=['hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','includeAll','include','findAll','catch','show','keys','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','ejs','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','update','destroy','then','error','stack','name','send','map','Cdr','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x16b396,_0x5dea08){var _0xff7f77=function(_0x3c9682){while(--_0x3c9682){_0x16b396['push'](_0x16b396['shift']());}};_0xff7f77(++_0x5dea08);}(_0xb40f,0x1f2));var _0xfb40=function(_0x14476b,_0xd1a7a4){_0x14476b=_0x14476b-0x0;var _0x24e2e8=_0xb40f[_0x14476b];return _0x24e2e8;};'use strict';var pdf=require(_0xfb40('0x0'));var emlformat=require(_0xfb40('0x1'));var rimraf=require(_0xfb40('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb40('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfb40('0x4'));var Mustache=require(_0xfb40('0x5'));var util=require('util');var path=require(_0xfb40('0x6'));var sox=require(_0xfb40('0x7'));var csv=require('to-csv');var ejs=require(_0xfb40('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xfb40('0x9'));var jsforce=require(_0xfb40('0xa'));var deskjs=require(_0xfb40('0xb'));var toCsv=require(_0xfb40('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfb40('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb40('0xe'));var logger=require('../../config/logger')(_0xfb40('0xf'));var utils=require(_0xfb40('0x10'));var config=require('../../config/environment');var db=require(_0xfb40('0x11'))['db'];function respondWithStatusCode(_0x4cfdb6,_0x49415a){_0x49415a=_0x49415a||0xcc;return function(_0x8cbd3b){if(_0x8cbd3b){return _0x4cfdb6[_0xfb40('0x12')](_0x49415a);}return _0x4cfdb6[_0xfb40('0x13')](_0x49415a)[_0xfb40('0x14')]();};}function respondWithResult(_0x57e214,_0x33bf72){_0x33bf72=_0x33bf72||0xc8;return function(_0x4ce9c7){if(_0x4ce9c7){return _0x57e214[_0xfb40('0x13')](_0x33bf72)[_0xfb40('0x15')](_0x4ce9c7);}};}function respondWithFilteredResult(_0x4e83a2,_0x331e5c){return function(_0x804bc4){if(_0x804bc4){var _0x5e4c1a=_0x804bc4[_0xfb40('0x16')],_0x271d11=_0x331e5c[_0xfb40('0x17')],_0x5392f1=_0x331e5c[_0xfb40('0x17')]+_0x331e5c[_0xfb40('0x18')],_0x386245;if(_0x5392f1>=_0x5e4c1a){_0x5392f1=_0x5e4c1a;_0x386245=0xc8;}else{_0x386245=0xce;}_0x4e83a2['status'](_0x386245);return _0x4e83a2['set'](_0xfb40('0x19'),_0x271d11+'-'+_0x5392f1+'/'+_0x5e4c1a)[_0xfb40('0x15')](_0x804bc4);}return null;};}function patchUpdates(_0x4c1125){return function(_0x2403f4){try{jsonpatch['apply'](_0x2403f4,_0x4c1125,!![]);}catch(_0x1df8ba){return BPromise[_0xfb40('0x1a')](_0x1df8ba);}return _0x2403f4['save']();};}function saveUpdates(_0x1dacec,_0x832243){return function(_0x176067){if(_0x176067){return _0x176067[_0xfb40('0x1b')](_0x1dacec)['then'](function(_0x107065){return _0x107065;});}return null;};}function removeEntity(_0x3244de,_0x43ff4d){return function(_0x4c33ad){if(_0x4c33ad){return _0x4c33ad[_0xfb40('0x1c')]()[_0xfb40('0x1d')](function(){_0x3244de[_0xfb40('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2192b0,_0x410f81){return function(_0xa4a37b){if(!_0xa4a37b){_0x2192b0[_0xfb40('0x12')](0x194);}return _0xa4a37b;};}function handleError(_0x129d41,_0x1ff436){_0x1ff436=_0x1ff436||0x1f4;return function(_0x4c106f){logger[_0xfb40('0x1e')](_0x4c106f[_0xfb40('0x1f')]);if(_0x4c106f[_0xfb40('0x20')]){delete _0x4c106f[_0xfb40('0x20')];}_0x129d41[_0xfb40('0x13')](_0x1ff436)[_0xfb40('0x21')](_0x4c106f);};}exports['index']=function(_0x495380,_0x4c4311){var _0x4ee2d5={},_0x1aa940={},_0x180fcc={'count':0x0,'rows':[]};var _0x44b19f=_[_0xfb40('0x22')](db[_0xfb40('0x23')][_0xfb40('0x24')],function(_0x338031){return{'name':_0x338031[_0xfb40('0x25')],'type':_0x338031['type'][_0xfb40('0x26')]};});_0x1aa940[_0xfb40('0x27')]=_[_0xfb40('0x22')](_0x44b19f,'name');_0x1aa940[_0xfb40('0x28')]=_['keys'](_0x495380['query']);_0x1aa940[_0xfb40('0x29')]=_[_0xfb40('0x2a')](_0x1aa940['model'],_0x1aa940[_0xfb40('0x28')]);_0x4ee2d5[_0xfb40('0x2b')]=_[_0xfb40('0x2a')](_0x1aa940['model'],qs[_0xfb40('0x2c')](_0x495380[_0xfb40('0x28')]['fields']));_0x4ee2d5[_0xfb40('0x2b')]=_0x4ee2d5[_0xfb40('0x2b')][_0xfb40('0x2d')]?_0x4ee2d5[_0xfb40('0x2b')]:_0x1aa940['model'];if(!_0x495380[_0xfb40('0x28')][_0xfb40('0x2e')](_0xfb40('0x2f'))){_0x4ee2d5[_0xfb40('0x18')]=qs[_0xfb40('0x18')](_0x495380['query'][_0xfb40('0x18')]);_0x4ee2d5[_0xfb40('0x17')]=qs[_0xfb40('0x17')](_0x495380['query'][_0xfb40('0x17')]);}_0x4ee2d5[_0xfb40('0x30')]=qs[_0xfb40('0x31')](_0x495380[_0xfb40('0x28')][_0xfb40('0x31')]);_0x4ee2d5['where']=qs['filters'](_[_0xfb40('0x32')](_0x495380[_0xfb40('0x28')],_0x1aa940['filters']),_0x44b19f);if(_0x495380['query'][_0xfb40('0x33')]){_0x4ee2d5[_0xfb40('0x34')]=_['merge'](_0x4ee2d5[_0xfb40('0x34')],{'$or':_['map'](_0x44b19f,function(_0x3d5984){if(_0x3d5984[_0xfb40('0x35')]!==_0xfb40('0x36')){var _0x5e5ead={};_0x5e5ead[_0x3d5984['name']]={'$like':'%'+_0x495380['query'][_0xfb40('0x33')]+'%'};return _0x5e5ead;}})});}_0x4ee2d5=_[_0xfb40('0x37')]({},_0x4ee2d5,_0x495380['options']);var _0x5d236d={'where':_0x4ee2d5[_0xfb40('0x34')]};return db['Cdr']['count'](_0x5d236d)[_0xfb40('0x1d')](function(_0x3fd121){_0x180fcc['count']=_0x3fd121;if(_0x495380[_0xfb40('0x28')][_0xfb40('0x38')]){_0x4ee2d5[_0xfb40('0x39')]=[{'all':!![]}];}return db[_0xfb40('0x23')][_0xfb40('0x3a')](_0x4ee2d5);})['then'](function(_0x531c01){_0x180fcc['rows']=_0x531c01;return _0x180fcc;})[_0xfb40('0x1d')](respondWithFilteredResult(_0x4c4311,_0x4ee2d5))[_0xfb40('0x3b')](handleError(_0x4c4311,null));};exports[_0xfb40('0x3c')]=function(_0x2febf3,_0x35db9f){var _0x2f5745={'raw':!![],'where':{'id':_0x2febf3['params']['id']}},_0x324c9a={};_0x324c9a[_0xfb40('0x27')]=_['keys'](db['Cdr'][_0xfb40('0x24')]);_0x324c9a[_0xfb40('0x28')]=_[_0xfb40('0x3d')](_0x2febf3['query']);_0x324c9a[_0xfb40('0x29')]=_['intersection'](_0x324c9a['model'],_0x324c9a[_0xfb40('0x28')]);_0x2f5745[_0xfb40('0x2b')]=_['intersection'](_0x324c9a[_0xfb40('0x27')],qs[_0xfb40('0x2c')](_0x2febf3[_0xfb40('0x28')][_0xfb40('0x2c')]));_0x2f5745[_0xfb40('0x2b')]=_0x2f5745[_0xfb40('0x2b')]['length']?_0x2f5745[_0xfb40('0x2b')]:_0x324c9a[_0xfb40('0x27')];if(_0x2febf3['query']['includeAll']){_0x2f5745[_0xfb40('0x39')]=[{'all':!![]}];}_0x2f5745=_['merge']({},_0x2f5745,_0x2febf3[_0xfb40('0x3e')]);return db['Cdr'][_0xfb40('0x3f')](_0x2f5745)[_0xfb40('0x1d')](handleEntityNotFound(_0x35db9f,null))[_0xfb40('0x1d')](respondWithResult(_0x35db9f,null))['catch'](handleError(_0x35db9f,null));};exports[_0xfb40('0x40')]=function(_0x19fa18,_0xe1a1ec){return db[_0xfb40('0x23')][_0xfb40('0x40')](_0x19fa18[_0xfb40('0x41')],{})['then'](respondWithResult(_0xe1a1ec,0xc9))[_0xfb40('0x3b')](handleError(_0xe1a1ec,null));};exports[_0xfb40('0x1b')]=function(_0x3e23ee,_0x2cc00c){if(_0x3e23ee[_0xfb40('0x41')]['id']){delete _0x3e23ee[_0xfb40('0x41')]['id'];}return db[_0xfb40('0x23')][_0xfb40('0x3f')]({'where':{'id':_0x3e23ee[_0xfb40('0x42')]['id']}})[_0xfb40('0x1d')](handleEntityNotFound(_0x2cc00c,null))[_0xfb40('0x1d')](saveUpdates(_0x3e23ee[_0xfb40('0x41')],null))[_0xfb40('0x1d')](respondWithResult(_0x2cc00c,null))['catch'](handleError(_0x2cc00c,null));};exports[_0xfb40('0x1c')]=function(_0x396301,_0x343f93){return db[_0xfb40('0x23')][_0xfb40('0x3f')]({'where':{'id':_0x396301[_0xfb40('0x42')]['id']}})[_0xfb40('0x1d')](handleEntityNotFound(_0x343f93,null))[_0xfb40('0x1d')](removeEntity(_0x343f93,null))[_0xfb40('0x3b')](handleError(_0x343f93,null));};exports[_0xfb40('0x43')]=function(_0x1b739b,_0x360081){return db[_0xfb40('0x23')][_0xfb40('0x43')]()[_0xfb40('0x1d')](respondWithResult(_0x360081,null))[_0xfb40('0x3b')](handleError(_0x360081,null));}; \ No newline at end of file +var _0xf2f7=['error','stack','name','send','index','Cdr','rawAttributes','type','key','model','map','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','then','rows','catch','show','length','include','find','create','body','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save'];(function(_0x2c7071,_0xad8154){var _0x7fecdf=function(_0x2fb8b0){while(--_0x2fb8b0){_0x2c7071['push'](_0x2c7071['shift']());}};_0x7fecdf(++_0xad8154);}(_0xf2f7,0x1ef));var _0x7f2f=function(_0x5e05ac,_0x54f012){_0x5e05ac=_0x5e05ac-0x0;var _0x57267f=_0xf2f7[_0x5e05ac];return _0x57267f;};'use strict';var pdf=require(_0x7f2f('0x0'));var emlformat=require(_0x7f2f('0x1'));var rimraf=require(_0x7f2f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f2f('0x3'));var rp=require(_0x7f2f('0x4'));var moment=require('moment');var BPromise=require(_0x7f2f('0x5'));var Mustache=require(_0x7f2f('0x6'));var util=require(_0x7f2f('0x7'));var path=require(_0x7f2f('0x8'));var sox=require(_0x7f2f('0x9'));var csv=require('to-csv');var ejs=require(_0x7f2f('0xa'));var fs=require('fs');var _=require(_0x7f2f('0xb'));var squel=require('squel');var crypto=require(_0x7f2f('0xc'));var jsforce=require(_0x7f2f('0xd'));var deskjs=require(_0x7f2f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7f2f('0xf'));var Papa=require('papaparse');var Redis=require(_0x7f2f('0x10'));var authService=require(_0x7f2f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7f2f('0x12'));var hardwareService=require(_0x7f2f('0x13'));var logger=require(_0x7f2f('0x14'))(_0x7f2f('0x15'));var utils=require(_0x7f2f('0x16'));var config=require(_0x7f2f('0x17'));var db=require(_0x7f2f('0x18'))['db'];function respondWithStatusCode(_0x3a52a9,_0x322dd4){_0x322dd4=_0x322dd4||0xcc;return function(_0x52b3a7){if(_0x52b3a7){return _0x3a52a9[_0x7f2f('0x19')](_0x322dd4);}return _0x3a52a9['status'](_0x322dd4)[_0x7f2f('0x1a')]();};}function respondWithResult(_0x51e7a0,_0x4d7c5c){_0x4d7c5c=_0x4d7c5c||0xc8;return function(_0x389dba){if(_0x389dba){return _0x51e7a0[_0x7f2f('0x1b')](_0x4d7c5c)['json'](_0x389dba);}};}function respondWithFilteredResult(_0x27714d,_0xb3fdc6){return function(_0x3aa3ca){if(_0x3aa3ca){var _0x528086=_0x3aa3ca[_0x7f2f('0x1c')],_0x5b32fe=_0xb3fdc6[_0x7f2f('0x1d')],_0x11cd8e=_0xb3fdc6[_0x7f2f('0x1d')]+_0xb3fdc6[_0x7f2f('0x1e')],_0x52c213;if(_0x11cd8e>=_0x528086){_0x11cd8e=_0x528086;_0x52c213=0xc8;}else{_0x52c213=0xce;}_0x27714d['status'](_0x52c213);return _0x27714d[_0x7f2f('0x1f')](_0x7f2f('0x20'),_0x5b32fe+'-'+_0x11cd8e+'/'+_0x528086)[_0x7f2f('0x21')](_0x3aa3ca);}return null;};}function patchUpdates(_0x291c27){return function(_0x4f128d){try{jsonpatch[_0x7f2f('0x22')](_0x4f128d,_0x291c27,!![]);}catch(_0x59ac0c){return BPromise[_0x7f2f('0x23')](_0x59ac0c);}return _0x4f128d[_0x7f2f('0x24')]();};}function saveUpdates(_0x1e1faa,_0x41a045){return function(_0x49655e){if(_0x49655e){return _0x49655e['update'](_0x1e1faa)['then'](function(_0x21580d){return _0x21580d;});}return null;};}function removeEntity(_0x4f365d,_0x1e8884){return function(_0x17f9ec){if(_0x17f9ec){return _0x17f9ec['destroy']()['then'](function(){_0x4f365d[_0x7f2f('0x1b')](0xcc)[_0x7f2f('0x1a')]();});}};}function handleEntityNotFound(_0x56e10f,_0x4c14cc){return function(_0x344312){if(!_0x344312){_0x56e10f[_0x7f2f('0x19')](0x194);}return _0x344312;};}function handleError(_0x2ece4c,_0x105092){_0x105092=_0x105092||0x1f4;return function(_0x31c28a){logger[_0x7f2f('0x25')](_0x31c28a[_0x7f2f('0x26')]);if(_0x31c28a[_0x7f2f('0x27')]){delete _0x31c28a[_0x7f2f('0x27')];}_0x2ece4c[_0x7f2f('0x1b')](_0x105092)[_0x7f2f('0x28')](_0x31c28a);};}exports[_0x7f2f('0x29')]=function(_0x5a0604,_0x5b283f){var _0x59eef7={},_0xdd5448={},_0x4337df={'count':0x0,'rows':[]};var _0x56fef0=_['map'](db[_0x7f2f('0x2a')][_0x7f2f('0x2b')],function(_0x42c84f){return{'name':_0x42c84f['fieldName'],'type':_0x42c84f[_0x7f2f('0x2c')][_0x7f2f('0x2d')]};});_0xdd5448[_0x7f2f('0x2e')]=_[_0x7f2f('0x2f')](_0x56fef0,_0x7f2f('0x27'));_0xdd5448['query']=_[_0x7f2f('0x30')](_0x5a0604[_0x7f2f('0x31')]);_0xdd5448[_0x7f2f('0x32')]=_['intersection'](_0xdd5448[_0x7f2f('0x2e')],_0xdd5448[_0x7f2f('0x31')]);_0x59eef7[_0x7f2f('0x33')]=_[_0x7f2f('0x34')](_0xdd5448[_0x7f2f('0x2e')],qs[_0x7f2f('0x35')](_0x5a0604[_0x7f2f('0x31')][_0x7f2f('0x35')]));_0x59eef7[_0x7f2f('0x33')]=_0x59eef7[_0x7f2f('0x33')]['length']?_0x59eef7['attributes']:_0xdd5448[_0x7f2f('0x2e')];if(!_0x5a0604['query'][_0x7f2f('0x36')](_0x7f2f('0x37'))){_0x59eef7['limit']=qs[_0x7f2f('0x1e')](_0x5a0604[_0x7f2f('0x31')][_0x7f2f('0x1e')]);_0x59eef7['offset']=qs[_0x7f2f('0x1d')](_0x5a0604[_0x7f2f('0x31')]['offset']);}_0x59eef7['order']=qs[_0x7f2f('0x38')](_0x5a0604[_0x7f2f('0x31')][_0x7f2f('0x38')]);_0x59eef7[_0x7f2f('0x39')]=qs[_0x7f2f('0x32')](_[_0x7f2f('0x3a')](_0x5a0604[_0x7f2f('0x31')],_0xdd5448['filters']),_0x56fef0);if(_0x5a0604[_0x7f2f('0x31')]['filter']){_0x59eef7[_0x7f2f('0x39')]=_[_0x7f2f('0x3b')](_0x59eef7[_0x7f2f('0x39')],{'$or':_[_0x7f2f('0x2f')](_0x56fef0,function(_0x21213e){if(_0x21213e['type']!==_0x7f2f('0x3c')){var _0x3ac79b={};_0x3ac79b[_0x21213e['name']]={'$like':'%'+_0x5a0604[_0x7f2f('0x31')][_0x7f2f('0x3d')]+'%'};return _0x3ac79b;}})});}_0x59eef7=_[_0x7f2f('0x3b')]({},_0x59eef7,_0x5a0604[_0x7f2f('0x3e')]);var _0x55eee4={'where':_0x59eef7[_0x7f2f('0x39')]};return db[_0x7f2f('0x2a')][_0x7f2f('0x1c')](_0x55eee4)['then'](function(_0x23182c){_0x4337df[_0x7f2f('0x1c')]=_0x23182c;if(_0x5a0604['query'][_0x7f2f('0x3f')]){_0x59eef7['include']=[{'all':!![]}];}return db[_0x7f2f('0x2a')][_0x7f2f('0x40')](_0x59eef7);})[_0x7f2f('0x41')](function(_0x5a6f4d){_0x4337df[_0x7f2f('0x42')]=_0x5a6f4d;return _0x4337df;})[_0x7f2f('0x41')](respondWithFilteredResult(_0x5b283f,_0x59eef7))[_0x7f2f('0x43')](handleError(_0x5b283f,null));};exports[_0x7f2f('0x44')]=function(_0x2cbf8c,_0x58f00e){var _0x45e88f={'raw':!![],'where':{'id':_0x2cbf8c['params']['id']}},_0x15256a={};_0x15256a[_0x7f2f('0x2e')]=_['keys'](db[_0x7f2f('0x2a')][_0x7f2f('0x2b')]);_0x15256a[_0x7f2f('0x31')]=_['keys'](_0x2cbf8c['query']);_0x15256a[_0x7f2f('0x32')]=_['intersection'](_0x15256a[_0x7f2f('0x2e')],_0x15256a[_0x7f2f('0x31')]);_0x45e88f['attributes']=_[_0x7f2f('0x34')](_0x15256a['model'],qs[_0x7f2f('0x35')](_0x2cbf8c[_0x7f2f('0x31')][_0x7f2f('0x35')]));_0x45e88f['attributes']=_0x45e88f[_0x7f2f('0x33')][_0x7f2f('0x45')]?_0x45e88f[_0x7f2f('0x33')]:_0x15256a[_0x7f2f('0x2e')];if(_0x2cbf8c[_0x7f2f('0x31')]['includeAll']){_0x45e88f[_0x7f2f('0x46')]=[{'all':!![]}];}_0x45e88f=_['merge']({},_0x45e88f,_0x2cbf8c[_0x7f2f('0x3e')]);return db['Cdr'][_0x7f2f('0x47')](_0x45e88f)[_0x7f2f('0x41')](handleEntityNotFound(_0x58f00e,null))['then'](respondWithResult(_0x58f00e,null))['catch'](handleError(_0x58f00e,null));};exports[_0x7f2f('0x48')]=function(_0x31e59e,_0x4e6927){return db[_0x7f2f('0x2a')]['create'](_0x31e59e[_0x7f2f('0x49')],{})[_0x7f2f('0x41')](respondWithResult(_0x4e6927,0xc9))[_0x7f2f('0x43')](handleError(_0x4e6927,null));};exports['update']=function(_0xdbb50d,_0x34bf33){if(_0xdbb50d[_0x7f2f('0x49')]['id']){delete _0xdbb50d[_0x7f2f('0x49')]['id'];}return db[_0x7f2f('0x2a')][_0x7f2f('0x47')]({'where':{'id':_0xdbb50d['params']['id']}})[_0x7f2f('0x41')](handleEntityNotFound(_0x34bf33,null))[_0x7f2f('0x41')](saveUpdates(_0xdbb50d[_0x7f2f('0x49')],null))[_0x7f2f('0x41')](respondWithResult(_0x34bf33,null))[_0x7f2f('0x43')](handleError(_0x34bf33,null));};exports['destroy']=function(_0x46ac43,_0x59aa06){return db[_0x7f2f('0x2a')]['find']({'where':{'id':_0x46ac43[_0x7f2f('0x4a')]['id']}})[_0x7f2f('0x41')](handleEntityNotFound(_0x59aa06,null))[_0x7f2f('0x41')](removeEntity(_0x59aa06,null))[_0x7f2f('0x43')](handleError(_0x59aa06,null));};exports['describe']=function(_0xe1e86c,_0x44b7b1){return db[_0x7f2f('0x2a')][_0x7f2f('0x4b')]()[_0x7f2f('0x41')](respondWithResult(_0x44b7b1,null))['catch'](handleError(_0x44b7b1,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 39ffee1..44599d5 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 _0x605f=['lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','./cdr.attributes','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid'];(function(_0x3103e4,_0x202431){var _0x360a19=function(_0x24f2d4){while(--_0x24f2d4){_0x3103e4['push'](_0x3103e4['shift']());}};_0x360a19(++_0x202431);}(_0x605f,0x1d0));var _0xf605=function(_0xef0161,_0x36bb64){_0xef0161=_0xef0161-0x0;var _0x15058b=_0x605f[_0xef0161];return _0x15058b;};'use strict';var _=require(_0xf605('0x0'));var util=require('util');var logger=require(_0xf605('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf605('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf605('0x3'));var rimraf=require(_0xf605('0x4'));var config=require(_0xf605('0x5'));var attributes=require(_0xf605('0x6'));module['exports']=function(_0xb39e55,_0x48ac0c){return _0xb39e55[_0xf605('0x7')](_0xf605('0x8'),attributes,{'tableName':_0xf605('0x9'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0xf605('0xa')]},{'name':'calldate','fields':[_0xf605('0xb')]},{'name':_0xf605('0xc'),'fields':[_0xf605('0xc')]},{'name':_0xf605('0xd'),'fields':[_0xf605('0xd')]},{'name':_0xf605('0xe'),'fields':[_0xf605('0xe')]},{'name':'uniqueid','fields':[_0xf605('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x2e44=['calldate','disposition','dst','src','uniqueid','lodash','util','api','moment','request-promise','path','../../config/environment','./cdr.attributes','exports','Cdr','cdr','accountcode'];(function(_0x4d582d,_0x43a1e9){var _0x36b316=function(_0x2d74e1){while(--_0x2d74e1){_0x4d582d['push'](_0x4d582d['shift']());}};_0x36b316(++_0x43a1e9);}(_0x2e44,0xf3));var _0x42e4=function(_0x27685e,_0x845417){_0x27685e=_0x27685e-0x0;var _0x224a6f=_0x2e44[_0x27685e];return _0x224a6f;};'use strict';var _=require(_0x42e4('0x0'));var util=require(_0x42e4('0x1'));var logger=require('../../config/logger')(_0x42e4('0x2'));var moment=require(_0x42e4('0x3'));var BPromise=require('bluebird');var rp=require(_0x42e4('0x4'));var fs=require('fs');var path=require(_0x42e4('0x5'));var rimraf=require('rimraf');var config=require(_0x42e4('0x6'));var attributes=require(_0x42e4('0x7'));module[_0x42e4('0x8')]=function(_0x307604,_0x18ee8a){return _0x307604['define'](_0x42e4('0x9'),attributes,{'tableName':_0x42e4('0xa'),'paranoid':![],'indexes':[{'name':_0x42e4('0xb'),'fields':['accountcode']},{'name':_0x42e4('0xc'),'fields':[_0x42e4('0xc')]},{'name':'disposition','fields':[_0x42e4('0xd')]},{'name':_0x42e4('0xe'),'fields':[_0x42e4('0xe')]},{'name':_0x42e4('0xf'),'fields':[_0x42e4('0xf')]},{'name':_0x42e4('0x10'),'fields':[_0x42e4('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 3b08993..7e3e1a1 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 _0x34ec=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','result','util','bluebird'];(function(_0x3d3e9e,_0x11b915){var _0x264d43=function(_0x1b8e76){while(--_0x1b8e76){_0x3d3e9e['push'](_0x3d3e9e['shift']());}};_0x264d43(++_0x11b915);}(_0x34ec,0x1a2));var _0xc34e=function(_0x103e79,_0x3f4cad){_0x103e79=_0x103e79-0x0;var _0x429379=_0x34ec[_0x103e79];return _0x429379;};'use strict';var _=require('lodash');var util=require(_0xc34e('0x0'));var moment=require('moment');var BPromise=require(_0xc34e('0x1'));var rs=require(_0xc34e('0x2'));var fs=require('fs');var Redis=require(_0xc34e('0x3'));var db=require(_0xc34e('0x4'))['db'];var utils=require(_0xc34e('0x5'));var logger=require(_0xc34e('0x6'))('rpc');var config=require(_0xc34e('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc34e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5cfc7a,_0x940917,_0x52cc17){return new BPromise(function(_0x246031,_0x457a43){return client[_0xc34e('0x9')](_0x5cfc7a,_0x52cc17)['then'](function(_0x33ef73){logger[_0xc34e('0xa')]('Cdr,\x20%s,\x20%s',_0x940917,_0xc34e('0xb'));logger[_0xc34e('0xc')](_0xc34e('0xd'),_0x940917,'request\x20sent',JSON[_0xc34e('0xe')](_0x33ef73));if(_0x33ef73[_0xc34e('0xf')]){if(_0x33ef73['error'][_0xc34e('0x10')]===0x1f4){logger['error'](_0xc34e('0x11'),_0x940917,_0x33ef73[_0xc34e('0xf')][_0xc34e('0x12')]);return _0x457a43(_0x33ef73[_0xc34e('0xf')][_0xc34e('0x12')]);}logger[_0xc34e('0xf')](_0xc34e('0x11'),_0x940917,_0x33ef73[_0xc34e('0xf')][_0xc34e('0x12')]);return _0x246031(_0x33ef73['error']['message']);}else{logger[_0xc34e('0xa')](_0xc34e('0x11'),_0x940917,_0xc34e('0xb'));_0x246031(_0x33ef73[_0xc34e('0x13')]['message']);}})['catch'](function(_0x175e5d){logger['error'](_0xc34e('0x11'),_0x940917,_0x175e5d);_0x457a43(_0x175e5d);});});} \ No newline at end of file +var _0xcdd6=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xcdd6,0xbe));var _0x6cdd=function(_0x2ab118,_0xbd2407){_0x2ab118=_0x2ab118-0x0;var _0x52e887=_0xcdd6[_0x2ab118];return _0x52e887;};'use strict';var _=require(_0x6cdd('0x0'));var util=require(_0x6cdd('0x1'));var moment=require(_0x6cdd('0x2'));var BPromise=require(_0x6cdd('0x3'));var rs=require(_0x6cdd('0x4'));var fs=require('fs');var Redis=require(_0x6cdd('0x5'));var db=require(_0x6cdd('0x6'))['db'];var utils=require(_0x6cdd('0x7'));var logger=require('../../config/logger')(_0x6cdd('0x8'));var config=require(_0x6cdd('0x9'));var jayson=require(_0x6cdd('0xa'));var client=jayson['client'][_0x6cdd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x37ae65,_0x5b18d3,_0x6a3402){return new BPromise(function(_0x2de608,_0x4af298){return client[_0x6cdd('0xc')](_0x37ae65,_0x6a3402)[_0x6cdd('0xd')](function(_0x26e01d){logger['info'](_0x6cdd('0xe'),_0x5b18d3,_0x6cdd('0xf'));logger['debug'](_0x6cdd('0x10'),_0x5b18d3,'request\x20sent',JSON[_0x6cdd('0x11')](_0x26e01d));if(_0x26e01d[_0x6cdd('0x12')]){if(_0x26e01d[_0x6cdd('0x12')][_0x6cdd('0x13')]===0x1f4){logger[_0x6cdd('0x12')](_0x6cdd('0xe'),_0x5b18d3,_0x26e01d[_0x6cdd('0x12')][_0x6cdd('0x14')]);return _0x4af298(_0x26e01d[_0x6cdd('0x12')][_0x6cdd('0x14')]);}logger[_0x6cdd('0x12')](_0x6cdd('0xe'),_0x5b18d3,_0x26e01d['error'][_0x6cdd('0x14')]);return _0x2de608(_0x26e01d[_0x6cdd('0x12')]['message']);}else{logger[_0x6cdd('0x15')](_0x6cdd('0xe'),_0x5b18d3,_0x6cdd('0xf'));_0x2de608(_0x26e01d[_0x6cdd('0x16')][_0x6cdd('0x14')]);}})[_0x6cdd('0x17')](function(_0x50be34){logger[_0x6cdd('0x12')](_0x6cdd('0xe'),_0x5b18d3,_0x50be34);_0x4af298(_0x50be34);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index a29ed2e..b00ea03 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 _0x9b73=['show','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9b73,0x157));var _0x39b7=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9b73[_0x1ac595];return _0x455fff;};'use strict';var multer=require('multer');var util=require(_0x39b7('0x0'));var path=require(_0x39b7('0x1'));var timeout=require(_0x39b7('0x2'));var express=require(_0x39b7('0x3'));var router=express[_0x39b7('0x4')]();var auth=require(_0x39b7('0x5'));var interaction=require(_0x39b7('0x6'));var config=require(_0x39b7('0x7'));var controller=require(_0x39b7('0x8'));router[_0x39b7('0x9')]('/',auth[_0x39b7('0xa')](),controller['index']);router[_0x39b7('0x9')](_0x39b7('0xb'),auth['isAuthenticated'](),controller[_0x39b7('0xc')]);router[_0x39b7('0x9')](_0x39b7('0xd'),auth[_0x39b7('0xa')](),controller[_0x39b7('0xe')]);router[_0x39b7('0xf')]('/',auth[_0x39b7('0xa')](),controller[_0x39b7('0x10')]);router[_0x39b7('0x11')](_0x39b7('0xd'),auth['isAuthenticated'](),controller[_0x39b7('0x12')]);router['delete'](_0x39b7('0xd'),auth[_0x39b7('0xa')](),controller[_0x39b7('0x13')]);module[_0x39b7('0x14')]=router; \ No newline at end of file +var _0xda39=['get','isAuthenticated','/:id','show','post','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x59aadc,_0x1584f3){var _0x4b5a98=function(_0x282abb){while(--_0x282abb){_0x59aadc['push'](_0x59aadc['shift']());}};_0x4b5a98(++_0x1584f3);}(_0xda39,0x15d));var _0x9da3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xda39[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x9da3('0x0'));var util=require(_0x9da3('0x1'));var path=require(_0x9da3('0x2'));var timeout=require('connect-timeout');var express=require(_0x9da3('0x3'));var router=express[_0x9da3('0x4')]();var auth=require(_0x9da3('0x5'));var interaction=require(_0x9da3('0x6'));var config=require(_0x9da3('0x7'));var controller=require('./cdr.controller');router[_0x9da3('0x8')]('/',auth[_0x9da3('0x9')](),controller['index']);router[_0x9da3('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x9da3('0x8')](_0x9da3('0xa'),auth['isAuthenticated'](),controller[_0x9da3('0xb')]);router[_0x9da3('0xc')]('/',auth[_0x9da3('0x9')](),controller['create']);router[_0x9da3('0xd')](_0x9da3('0xa'),auth[_0x9da3('0x9')](),controller['update']);router[_0x9da3('0xe')](_0x9da3('0xa'),auth['isAuthenticated'](),controller[_0x9da3('0xf')]);module[_0x9da3('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 957ff4a..3e092cd 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 _0xa370=['sequelize','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x43e863,_0x27864e){var _0x2c65b6=function(_0x305d8c){while(--_0x305d8c){_0x43e863['push'](_0x43e863['shift']());}};_0x2c65b6(++_0x27864e);}(_0xa370,0x84));var _0x0a37=function(_0x38de33,_0x4361bb){_0x38de33=_0x38de33-0x0;var _0x40f16d=_0xa370[_0x38de33];return _0x40f16d;};'use strict';var Sequelize=require(_0x0a37('0x0'));module['exports']={'priority':{'type':Sequelize[_0x0a37('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0a37('0x2')],'allowNull':![],'defaultValue':_0x0a37('0x3')},'appdata':{'type':Sequelize[_0x0a37('0x4')]()},'description':{'type':Sequelize[_0x0a37('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0a37('0x5')}}; \ No newline at end of file +var _0x0f4b=['exports','INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x7c97ba,_0x33c896){var _0xe57057=function(_0x31d16f){while(--_0x31d16f){_0x7c97ba['push'](_0x7c97ba['shift']());}};_0xe57057(++_0x33c896);}(_0x0f4b,0x179));var _0xb0f4=function(_0x3d6198,_0x5b65cd){_0x3d6198=_0x3d6198-0x0;var _0x186e9b=_0x0f4b[_0x3d6198];return _0x186e9b;};'use strict';var Sequelize=require(_0xb0f4('0x0'));module[_0xb0f4('0x1')]={'priority':{'type':Sequelize[_0xb0f4('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb0f4('0x3')},'appdata':{'type':Sequelize[_0xb0f4('0x4')]()},'description':{'type':Sequelize[_0xb0f4('0x5')]},'interval':{'type':Sequelize[_0xb0f4('0x5')],'defaultValue':_0xb0f4('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 0618179..add3008 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 _0x488b=['status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','error','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','include','merge','ChatApplication','find','catch','update','body','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0x687222,_0x284105){var _0x39718f=function(_0x4fc763){while(--_0x4fc763){_0x687222['push'](_0x687222['shift']());}};_0x39718f(++_0x284105);}(_0x488b,0xc5));var _0xb488=function(_0x2002b8,_0x1ccadd){_0x2002b8=_0x2002b8-0x0;var _0xb3b102=_0x488b[_0x2002b8];return _0xb3b102;};'use strict';var pdf=require(_0xb488('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb488('0x1'));var zipdir=require(_0xb488('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb488('0x3'));var moment=require(_0xb488('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb488('0x5'));var util=require(_0xb488('0x6'));var path=require(_0xb488('0x7'));var sox=require(_0xb488('0x8'));var csv=require('to-csv');var ejs=require(_0xb488('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb488('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb488('0xb'));var toCsv=require('to-csv');var querystring=require(_0xb488('0xc'));var Papa=require(_0xb488('0xd'));var Redis=require(_0xb488('0xe'));var authService=require(_0xb488('0xf'));var qs=require(_0xb488('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb488('0x11'));var logger=require(_0xb488('0x12'))(_0xb488('0x13'));var utils=require('../../config/utils');var config=require(_0xb488('0x14'));var db=require(_0xb488('0x15'))['db'];function respondWithStatusCode(_0x5d4e89,_0x1a1cf5){_0x1a1cf5=_0x1a1cf5||0xcc;return function(_0x8f8216){if(_0x8f8216){return _0x5d4e89[_0xb488('0x16')](_0x1a1cf5);}return _0x5d4e89[_0xb488('0x17')](_0x1a1cf5)[_0xb488('0x18')]();};}function respondWithResult(_0x1f1810,_0x36c9e7){_0x36c9e7=_0x36c9e7||0xc8;return function(_0x1f4d1b){if(_0x1f4d1b){return _0x1f1810[_0xb488('0x17')](_0x36c9e7)[_0xb488('0x19')](_0x1f4d1b);}};}function respondWithFilteredResult(_0x4048c6,_0x27ba6a){return function(_0x1782cc){if(_0x1782cc){var _0x3ca5ad=_0x1782cc[_0xb488('0x1a')],_0x1aba73=_0x27ba6a['offset'],_0x42c2f6=_0x27ba6a[_0xb488('0x1b')]+_0x27ba6a['limit'],_0x15981e;if(_0x42c2f6>=_0x3ca5ad){_0x42c2f6=_0x3ca5ad;_0x15981e=0xc8;}else{_0x15981e=0xce;}_0x4048c6[_0xb488('0x17')](_0x15981e);return _0x4048c6['set'](_0xb488('0x1c'),_0x1aba73+'-'+_0x42c2f6+'/'+_0x3ca5ad)[_0xb488('0x19')](_0x1782cc);}return null;};}function patchUpdates(_0x5c89c8){return function(_0x3fbe03){try{jsonpatch[_0xb488('0x1d')](_0x3fbe03,_0x5c89c8,!![]);}catch(_0x3dcbc4){return BPromise[_0xb488('0x1e')](_0x3dcbc4);}return _0x3fbe03[_0xb488('0x1f')]();};}function saveUpdates(_0x4d5adc,_0x52fe56){return function(_0x4ae7d5){if(_0x4ae7d5){return _0x4ae7d5['update'](_0x4d5adc)[_0xb488('0x20')](function(_0x25ebc9){return _0x25ebc9;});}return null;};}function removeEntity(_0x3d924b,_0x290a81){return function(_0x1acbb9){if(_0x1acbb9){return _0x1acbb9[_0xb488('0x21')]()[_0xb488('0x20')](function(){_0x3d924b[_0xb488('0x17')](0xcc)[_0xb488('0x18')]();});}};}function handleEntityNotFound(_0x1b64d3,_0x575cba){return function(_0x4607e3){if(!_0x4607e3){_0x1b64d3[_0xb488('0x16')](0x194);}return _0x4607e3;};}function handleError(_0xbab90f,_0x31e513){_0x31e513=_0x31e513||0x1f4;return function(_0x4845a9){logger[_0xb488('0x22')](_0x4845a9['stack']);if(_0x4845a9[_0xb488('0x23')]){delete _0x4845a9['name'];}_0xbab90f['status'](_0x31e513)[_0xb488('0x24')](_0x4845a9);};}exports[_0xb488('0x25')]=function(_0xd20d6d,_0x561720){var _0x38b383={'raw':!![],'where':{'id':_0xd20d6d[_0xb488('0x26')]['id']}},_0x258fe3={};_0x258fe3[_0xb488('0x27')]=_[_0xb488('0x28')](db['ChatApplication'][_0xb488('0x29')]);_0x258fe3[_0xb488('0x2a')]=_['keys'](_0xd20d6d[_0xb488('0x2a')]);_0x258fe3[_0xb488('0x2b')]=_[_0xb488('0x2c')](_0x258fe3[_0xb488('0x27')],_0x258fe3[_0xb488('0x2a')]);_0x38b383['attributes']=_[_0xb488('0x2c')](_0x258fe3[_0xb488('0x27')],qs[_0xb488('0x2d')](_0xd20d6d[_0xb488('0x2a')][_0xb488('0x2d')]));_0x38b383[_0xb488('0x2e')]=_0x38b383[_0xb488('0x2e')][_0xb488('0x2f')]?_0x38b383[_0xb488('0x2e')]:_0x258fe3['model'];if(_0xd20d6d[_0xb488('0x2a')]['includeAll']){_0x38b383[_0xb488('0x30')]=[{'all':!![]}];}_0x38b383=_[_0xb488('0x31')]({},_0x38b383,_0xd20d6d['options']);return db[_0xb488('0x32')][_0xb488('0x33')](_0x38b383)[_0xb488('0x20')](handleEntityNotFound(_0x561720,null))[_0xb488('0x20')](respondWithResult(_0x561720,null))[_0xb488('0x34')](handleError(_0x561720,null));};exports[_0xb488('0x35')]=function(_0x5aed5b,_0x6f0eb2){if(_0x5aed5b[_0xb488('0x36')]['id']){delete _0x5aed5b['body']['id'];}return db[_0xb488('0x32')][_0xb488('0x33')]({'where':{'id':_0x5aed5b['params']['id']}})[_0xb488('0x20')](handleEntityNotFound(_0x6f0eb2,null))[_0xb488('0x20')](saveUpdates(_0x5aed5b[_0xb488('0x36')],null))[_0xb488('0x20')](respondWithResult(_0x6f0eb2,null))['catch'](handleError(_0x6f0eb2,null));};exports['destroy']=function(_0x3fa099,_0x582807){return db[_0xb488('0x32')][_0xb488('0x33')]({'where':{'id':_0x3fa099[_0xb488('0x26')]['id']}})['then'](handleEntityNotFound(_0x582807,null))['then'](removeEntity(_0x582807,null))[_0xb488('0x34')](handleError(_0x582807,null));}; \ No newline at end of file +var _0x2aa6=['mustache','path','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x26d7c1,_0x51912f){var _0x423d10=function(_0x4cf15a){while(--_0x4cf15a){_0x26d7c1['push'](_0x26d7c1['shift']());}};_0x423d10(++_0x51912f);}(_0x2aa6,0x11c));var _0x62aa=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x2aa6[_0x4a7631];return _0x1a5a6f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x62aa('0x0'));var rimraf=require(_0x62aa('0x1'));var zipdir=require(_0x62aa('0x2'));var jsonpatch=require(_0x62aa('0x3'));var rp=require('request-promise');var moment=require(_0x62aa('0x4'));var BPromise=require(_0x62aa('0x5'));var Mustache=require(_0x62aa('0x6'));var util=require('util');var path=require(_0x62aa('0x7'));var sox=require('sox');var csv=require(_0x62aa('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x62aa('0x9'));var squel=require(_0x62aa('0xa'));var crypto=require('crypto');var jsforce=require(_0x62aa('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x62aa('0x8'));var querystring=require(_0x62aa('0xc'));var Papa=require(_0x62aa('0xd'));var Redis=require(_0x62aa('0xe'));var authService=require(_0x62aa('0xf'));var qs=require(_0x62aa('0x10'));var as=require(_0x62aa('0x11'));var hardwareService=require(_0x62aa('0x12'));var logger=require(_0x62aa('0x13'))(_0x62aa('0x14'));var utils=require('../../config/utils');var config=require(_0x62aa('0x15'));var db=require(_0x62aa('0x16'))['db'];function respondWithStatusCode(_0x5bdf2a,_0x3deb98){_0x3deb98=_0x3deb98||0xcc;return function(_0x33e62c){if(_0x33e62c){return _0x5bdf2a[_0x62aa('0x17')](_0x3deb98);}return _0x5bdf2a['status'](_0x3deb98)['end']();};}function respondWithResult(_0x1ce90f,_0x3c8b63){_0x3c8b63=_0x3c8b63||0xc8;return function(_0x3bcf81){if(_0x3bcf81){return _0x1ce90f[_0x62aa('0x18')](_0x3c8b63)['json'](_0x3bcf81);}};}function respondWithFilteredResult(_0x53b683,_0x384587){return function(_0x135ff2){if(_0x135ff2){var _0x4929a0=_0x135ff2[_0x62aa('0x19')],_0x2c94b6=_0x384587[_0x62aa('0x1a')],_0x4ac9d7=_0x384587[_0x62aa('0x1a')]+_0x384587[_0x62aa('0x1b')],_0x4b655c;if(_0x4ac9d7>=_0x4929a0){_0x4ac9d7=_0x4929a0;_0x4b655c=0xc8;}else{_0x4b655c=0xce;}_0x53b683[_0x62aa('0x18')](_0x4b655c);return _0x53b683[_0x62aa('0x1c')](_0x62aa('0x1d'),_0x2c94b6+'-'+_0x4ac9d7+'/'+_0x4929a0)[_0x62aa('0x1e')](_0x135ff2);}return null;};}function patchUpdates(_0x42b010){return function(_0x5eb3fe){try{jsonpatch[_0x62aa('0x1f')](_0x5eb3fe,_0x42b010,!![]);}catch(_0x2b0ac3){return BPromise[_0x62aa('0x20')](_0x2b0ac3);}return _0x5eb3fe[_0x62aa('0x21')]();};}function saveUpdates(_0x519a92,_0x52714e){return function(_0x1c56c5){if(_0x1c56c5){return _0x1c56c5[_0x62aa('0x22')](_0x519a92)[_0x62aa('0x23')](function(_0xab8c0){return _0xab8c0;});}return null;};}function removeEntity(_0x122172,_0x2846c2){return function(_0x1b4516){if(_0x1b4516){return _0x1b4516[_0x62aa('0x24')]()['then'](function(){_0x122172[_0x62aa('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c64e3,_0x3d0e5c){return function(_0x34b555){if(!_0x34b555){_0x5c64e3[_0x62aa('0x17')](0x194);}return _0x34b555;};}function handleError(_0x1b9b74,_0x2ed569){_0x2ed569=_0x2ed569||0x1f4;return function(_0x288dcb){logger[_0x62aa('0x25')](_0x288dcb[_0x62aa('0x26')]);if(_0x288dcb[_0x62aa('0x27')]){delete _0x288dcb[_0x62aa('0x27')];}_0x1b9b74[_0x62aa('0x18')](_0x2ed569)[_0x62aa('0x28')](_0x288dcb);};}exports[_0x62aa('0x29')]=function(_0xd51b31,_0xe8109e){var _0x307504={'raw':!![],'where':{'id':_0xd51b31[_0x62aa('0x2a')]['id']}},_0x4edf2f={};_0x4edf2f[_0x62aa('0x2b')]=_[_0x62aa('0x2c')](db[_0x62aa('0x2d')][_0x62aa('0x2e')]);_0x4edf2f[_0x62aa('0x2f')]=_[_0x62aa('0x2c')](_0xd51b31[_0x62aa('0x2f')]);_0x4edf2f[_0x62aa('0x30')]=_[_0x62aa('0x31')](_0x4edf2f[_0x62aa('0x2b')],_0x4edf2f['query']);_0x307504[_0x62aa('0x32')]=_[_0x62aa('0x31')](_0x4edf2f[_0x62aa('0x2b')],qs[_0x62aa('0x33')](_0xd51b31[_0x62aa('0x2f')][_0x62aa('0x33')]));_0x307504[_0x62aa('0x32')]=_0x307504[_0x62aa('0x32')]['length']?_0x307504[_0x62aa('0x32')]:_0x4edf2f[_0x62aa('0x2b')];if(_0xd51b31[_0x62aa('0x2f')]['includeAll']){_0x307504[_0x62aa('0x34')]=[{'all':!![]}];}_0x307504=_[_0x62aa('0x35')]({},_0x307504,_0xd51b31[_0x62aa('0x36')]);return db[_0x62aa('0x2d')]['find'](_0x307504)[_0x62aa('0x23')](handleEntityNotFound(_0xe8109e,null))[_0x62aa('0x23')](respondWithResult(_0xe8109e,null))[_0x62aa('0x37')](handleError(_0xe8109e,null));};exports[_0x62aa('0x22')]=function(_0x2f2a17,_0x3e9d16){if(_0x2f2a17[_0x62aa('0x38')]['id']){delete _0x2f2a17['body']['id'];}return db[_0x62aa('0x2d')][_0x62aa('0x39')]({'where':{'id':_0x2f2a17[_0x62aa('0x2a')]['id']}})[_0x62aa('0x23')](handleEntityNotFound(_0x3e9d16,null))[_0x62aa('0x23')](saveUpdates(_0x2f2a17[_0x62aa('0x38')],null))[_0x62aa('0x23')](respondWithResult(_0x3e9d16,null))['catch'](handleError(_0x3e9d16,null));};exports[_0x62aa('0x24')]=function(_0x37984f,_0x29c990){return db[_0x62aa('0x2d')][_0x62aa('0x39')]({'where':{'id':_0x37984f[_0x62aa('0x2a')]['id']}})[_0x62aa('0x23')](handleEntityNotFound(_0x29c990,null))[_0x62aa('0x23')](removeEntity(_0x29c990,null))[_0x62aa('0x37')](handleError(_0x29c990,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 342f3cf..e6a3a17 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 _0xfaf0=['rimraf','../../config/environment','./chatApplication.attributes','define','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise'];(function(_0x541f8b,_0x3cece6){var _0x49fdae=function(_0x4a420f){while(--_0x4a420f){_0x541f8b['push'](_0x541f8b['shift']());}};_0x49fdae(++_0x3cece6);}(_0xfaf0,0x10f));var _0x0faf=function(_0x35c6b5,_0x5be61f){_0x35c6b5=_0x35c6b5-0x0;var _0x3de236=_0xfaf0[_0x35c6b5];return _0x3de236;};'use strict';var _=require(_0x0faf('0x0'));var util=require(_0x0faf('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0faf('0x2'));var BPromise=require(_0x0faf('0x3'));var rp=require(_0x0faf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0faf('0x5'));var config=require(_0x0faf('0x6'));var attributes=require(_0x0faf('0x7'));module['exports']=function(_0x78d53,_0x2f6c7e){return _0x78d53[_0x0faf('0x8')]('ChatApplication',attributes,{'tableName':_0x0faf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0faf('0xa'),'collate':_0x0faf('0xb')});}; \ No newline at end of file +var _0x7171=['chat_applications','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./chatApplication.attributes','exports','ChatApplication'];(function(_0x45346d,_0xffd56b){var _0x5ce7ca=function(_0x27ce87){while(--_0x27ce87){_0x45346d['push'](_0x45346d['shift']());}};_0x5ce7ca(++_0xffd56b);}(_0x7171,0x182));var _0x1717=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x7171[_0x4fde08];return _0x12e725;};'use strict';var _=require('lodash');var util=require(_0x1717('0x0'));var logger=require(_0x1717('0x1'))(_0x1717('0x2'));var moment=require(_0x1717('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1717('0x4'));var rimraf=require(_0x1717('0x5'));var config=require(_0x1717('0x6'));var attributes=require(_0x1717('0x7'));module[_0x1717('0x8')]=function(_0x1e085b,_0xb1fbbd){return _0x1e085b['define'](_0x1717('0x9'),attributes,{'tableName':_0x1717('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 624e1b1..81acb67 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 _0x584c=['bluebird','randomstring','../../config/logger','jayson/promise','client','http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment'];(function(_0x3a59bb,_0x333390){var _0x1a5def=function(_0x27ca8b){while(--_0x27ca8b){_0x3a59bb['push'](_0x3a59bb['shift']());}};_0x1a5def(++_0x333390);}(_0x584c,0xcf));var _0xc584=function(_0x45ce4e,_0x3a367c){_0x45ce4e=_0x45ce4e-0x0;var _0x4a105a=_0x584c[_0x45ce4e];return _0x4a105a;};'use strict';var _=require(_0xc584('0x0'));var util=require('util');var moment=require(_0xc584('0x1'));var BPromise=require(_0xc584('0x2'));var rs=require(_0xc584('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc584('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc584('0x5'));var client=jayson[_0xc584('0x6')][_0xc584('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1a3af0,_0x50206c,_0x50d6a8){return new BPromise(function(_0x4c6360,_0x5671ef){return client[_0xc584('0x8')](_0x1a3af0,_0x50d6a8)['then'](function(_0x5ed39c){logger[_0xc584('0x9')](_0xc584('0xa'),_0x50206c,_0xc584('0xb'));logger[_0xc584('0xc')](_0xc584('0xd'),_0x50206c,_0xc584('0xb'),JSON[_0xc584('0xe')](_0x5ed39c));if(_0x5ed39c[_0xc584('0xf')]){if(_0x5ed39c['error'][_0xc584('0x10')]===0x1f4){logger[_0xc584('0xf')]('ChatApplication,\x20%s,\x20%s',_0x50206c,_0x5ed39c[_0xc584('0xf')]['message']);return _0x5671ef(_0x5ed39c[_0xc584('0xf')][_0xc584('0x11')]);}logger[_0xc584('0xf')](_0xc584('0xa'),_0x50206c,_0x5ed39c[_0xc584('0xf')][_0xc584('0x11')]);return _0x4c6360(_0x5ed39c[_0xc584('0xf')]['message']);}else{logger[_0xc584('0x9')](_0xc584('0xa'),_0x50206c,_0xc584('0xb'));_0x4c6360(_0x5ed39c['result'][_0xc584('0x11')]);}})[_0xc584('0x12')](function(_0x132495){logger[_0xc584('0xf')](_0xc584('0xa'),_0x50206c,_0x132495);_0x5671ef(_0x132495);});});} \ No newline at end of file +var _0xdd68=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x3acd3b,_0x21e7f5){var _0x5bb412=function(_0x3ae7e3){while(--_0x3ae7e3){_0x3acd3b['push'](_0x3acd3b['shift']());}};_0x5bb412(++_0x21e7f5);}(_0xdd68,0x155));var _0x8dd6=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xdd68[_0x710815];return _0x5b3b89;};'use strict';var _=require(_0x8dd6('0x0'));var util=require(_0x8dd6('0x1'));var moment=require(_0x8dd6('0x2'));var BPromise=require(_0x8dd6('0x3'));var rs=require(_0x8dd6('0x4'));var fs=require('fs');var Redis=require(_0x8dd6('0x5'));var db=require(_0x8dd6('0x6'))['db'];var utils=require(_0x8dd6('0x7'));var logger=require(_0x8dd6('0x8'))(_0x8dd6('0x9'));var config=require(_0x8dd6('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x8dd6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1303a2,_0x3da3fa,_0x11a4cf){return new BPromise(function(_0x25b8b5,_0x37edec){return client[_0x8dd6('0xc')](_0x1303a2,_0x11a4cf)[_0x8dd6('0xd')](function(_0x5a8789){logger['info'](_0x8dd6('0xe'),_0x3da3fa,_0x8dd6('0xf'));logger[_0x8dd6('0x10')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x3da3fa,_0x8dd6('0xf'),JSON['stringify'](_0x5a8789));if(_0x5a8789[_0x8dd6('0x11')]){if(_0x5a8789[_0x8dd6('0x11')][_0x8dd6('0x12')]===0x1f4){logger[_0x8dd6('0x11')](_0x8dd6('0xe'),_0x3da3fa,_0x5a8789[_0x8dd6('0x11')][_0x8dd6('0x13')]);return _0x37edec(_0x5a8789[_0x8dd6('0x11')][_0x8dd6('0x13')]);}logger[_0x8dd6('0x11')]('ChatApplication,\x20%s,\x20%s',_0x3da3fa,_0x5a8789[_0x8dd6('0x11')][_0x8dd6('0x13')]);return _0x25b8b5(_0x5a8789[_0x8dd6('0x11')][_0x8dd6('0x13')]);}else{logger[_0x8dd6('0x14')](_0x8dd6('0xe'),_0x3da3fa,'request\x20sent');_0x25b8b5(_0x5a8789[_0x8dd6('0x15')][_0x8dd6('0x13')]);}})[_0x8dd6('0x16')](function(_0xa3ed31){logger[_0x8dd6('0x11')]('ChatApplication,\x20%s,\x20%s',_0x3da3fa,_0xa3ed31);_0x37edec(_0xa3ed31);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 7cb485d..144e584 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 _0xe493=['exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','delete','destroy'];(function(_0x3fbeb5,_0x250fd6){var _0x53e495=function(_0x2370c9){while(--_0x2370c9){_0x3fbeb5['push'](_0x3fbeb5['shift']());}};_0x53e495(++_0x250fd6);}(_0xe493,0x1f1));var _0x3e49=function(_0x6003e2,_0x5a4d7e){_0x6003e2=_0x6003e2-0x0;var _0x1ce4de=_0xe493[_0x6003e2];return _0x1ce4de;};'use strict';var multer=require(_0x3e49('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3e49('0x1'));var express=require(_0x3e49('0x2'));var router=express[_0x3e49('0x3')]();var auth=require(_0x3e49('0x4'));var interaction=require(_0x3e49('0x5'));var config=require(_0x3e49('0x6'));var controller=require(_0x3e49('0x7'));router[_0x3e49('0x8')](_0x3e49('0x9'),auth[_0x3e49('0xa')](),controller[_0x3e49('0xb')]);router[_0x3e49('0xc')](_0x3e49('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x3e49('0xd')](_0x3e49('0x9'),auth[_0x3e49('0xa')](),controller[_0x3e49('0xe')]);module[_0x3e49('0xf')]=router; \ No newline at end of file +var _0x889f=['/:id','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','isAuthenticated','put'];(function(_0x327828,_0x15e6c9){var _0xb64e83=function(_0x42ef09){while(--_0x42ef09){_0x327828['push'](_0x327828['shift']());}};_0xb64e83(++_0x15e6c9);}(_0x889f,0x67));var _0xf889=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0x889f[_0x1e4a8e];return _0x5408f9;};'use strict';var multer=require(_0xf889('0x0'));var util=require('util');var path=require(_0xf889('0x1'));var timeout=require(_0xf889('0x2'));var express=require('express');var router=express[_0xf889('0x3')]();var auth=require(_0xf889('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatApplication.controller');router['get']('/:id',auth[_0xf889('0x5')](),controller['show']);router[_0xf889('0x6')](_0xf889('0x7'),auth[_0xf889('0x5')](),controller['update']);router[_0xf889('0x8')](_0xf889('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0xf889('0x9')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 34c6e26..f1f3334 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 _0x00dc=['sequelize','STRING'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x00dc,0x178));var _0xc00d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x00dc[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xc00d('0x0'));module['exports']={'name':{'type':Sequelize[_0xc00d('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc00d('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x90f8=['STRING','BOOLEAN','sequelize','exports'];(function(_0x13e150,_0x2d4c71){var _0x1d1b72=function(_0x5f4266){while(--_0x5f4266){_0x13e150['push'](_0x13e150['shift']());}};_0x1d1b72(++_0x2d4c71);}(_0x90f8,0x192));var _0x890f=function(_0xbc6932,_0x426566){_0xbc6932=_0xbc6932-0x0;var _0x588a0a=_0x90f8[_0xbc6932];return _0x588a0a;};'use strict';var Sequelize=require(_0x890f('0x0'));module[_0x890f('0x1')]={'name':{'type':Sequelize[_0x890f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x890f('0x2')]},'write':{'type':Sequelize[_0x890f('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index b084645..e8f9446 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 _0xb40b=['sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','map','ChatGroup','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','params','length','options','find','create','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','body','ids','omit','getMembers','findOne','User','pick','removeMembers','ChatGroupId','getMessages','$gte','split','format','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x59f132,_0x47d1cb){var _0x4822b9=function(_0x28c90d){while(--_0x28c90d){_0x59f132['push'](_0x59f132['shift']());}};_0x4822b9(++_0x47d1cb);}(_0xb40b,0x119));var _0xbb40=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xb40b[_0x5608a3];return _0x1ed50a;};'use strict';var pdf=require(_0xbb40('0x0'));var emlformat=require(_0xbb40('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbb40('0x2'));var jsonpatch=require(_0xbb40('0x3'));var rp=require(_0xbb40('0x4'));var moment=require(_0xbb40('0x5'));var BPromise=require(_0xbb40('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xbb40('0x7'));var csv=require(_0xbb40('0x8'));var ejs=require(_0xbb40('0x9'));var fs=require('fs');var _=require(_0xbb40('0xa'));var squel=require('squel');var crypto=require(_0xbb40('0xb'));var jsforce=require(_0xbb40('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbb40('0x8'));var querystring=require(_0xbb40('0xd'));var Papa=require(_0xbb40('0xe'));var Redis=require(_0xbb40('0xf'));var authService=require(_0xbb40('0x10'));var qs=require(_0xbb40('0x11'));var as=require(_0xbb40('0x12'));var hardwareService=require(_0xbb40('0x13'));var logger=require('../../config/logger')(_0xbb40('0x14'));var utils=require(_0xbb40('0x15'));var config=require(_0xbb40('0x16'));var db=require(_0xbb40('0x17'))['db'];config[_0xbb40('0x18')]=_[_0xbb40('0x19')](config[_0xbb40('0x18')],{'host':_0xbb40('0x1a'),'port':0x18eb});var socket=require(_0xbb40('0x1b'))(new Redis(config[_0xbb40('0x18')]));require(_0xbb40('0x1c'))[_0xbb40('0x1d')](socket);var jayson=require(_0xbb40('0x1e'));var client=jayson[_0xbb40('0x1f')]['http']({'port':0x232a});function checkPasswordPattern(_0x4a35cd,_0x2b4181,_0x2aa8ed){if(_0x2aa8ed){var _0xc4c413=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xc4c413[_0xbb40('0x20')](_0x2b4181)){return _0x4a35cd;}else{throw new db[(_0xbb40('0x21'))][(_0xbb40('0x22'))](_0xbb40('0x23'));}}else{return _0x4a35cd;}}function respondWithRpcPromise(_0x1bf5e4,_0x489489,_0x250a51,_0x4048c8){return new BPromise(function(_0x1cd597,_0x2befe5){var _0x349ed3=_0x4048c8||client;return _0x349ed3[_0xbb40('0x24')](_0x1bf5e4,_0x250a51)[_0xbb40('0x25')](function(_0x5ebf88){logger[_0xbb40('0x26')](_0xbb40('0x27'),_0x489489,_0xbb40('0x28'));logger[_0xbb40('0x29')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x489489,_0xbb40('0x28'),JSON[_0xbb40('0x2a')](_0x5ebf88));if(_0x5ebf88[_0xbb40('0x2b')]){if(_0x5ebf88[_0xbb40('0x2b')][_0xbb40('0x2c')]===0x1f4){logger['error'](_0xbb40('0x27'),_0x489489,_0x5ebf88[_0xbb40('0x2b')]['message']);return _0x2befe5(_0x5ebf88[_0xbb40('0x2b')][_0xbb40('0x2d')]);}logger[_0xbb40('0x2b')]('ChatGroup,\x20%s,\x20%s',_0x489489,_0x5ebf88['error']['message']);return _0x1cd597(_0x5ebf88[_0xbb40('0x2b')][_0xbb40('0x2d')]);}else{logger[_0xbb40('0x26')](_0xbb40('0x27'),_0x489489,_0xbb40('0x28'));_0x1cd597(_0x5ebf88['result']['message']);}})['catch'](function(_0x48c66c){logger['error'](_0xbb40('0x27'),_0x489489,_0x48c66c);_0x2befe5(_0x48c66c);});});}function respondWithStatusCode(_0x51ff75,_0xc35dbb){_0xc35dbb=_0xc35dbb||0xcc;return function(_0xd3f778){if(_0xd3f778){return _0x51ff75[_0xbb40('0x2e')](_0xc35dbb);}return _0x51ff75[_0xbb40('0x2f')](_0xc35dbb)[_0xbb40('0x30')]();};}function respondWithResult(_0x1d4dc8,_0x992548){_0x992548=_0x992548||0xc8;return function(_0x3d889d){if(_0x3d889d){return _0x1d4dc8[_0xbb40('0x2f')](_0x992548)['json'](_0x3d889d);}};}function respondWithFilteredResult(_0x5d01d9,_0x4746b7){return function(_0x1da9c0){if(_0x1da9c0){var _0x120f77=_0x1da9c0[_0xbb40('0x31')],_0x42ac90=_0x4746b7[_0xbb40('0x32')],_0x403ebc=_0x4746b7['offset']+_0x4746b7[_0xbb40('0x33')],_0x14d9b4;if(_0x403ebc>=_0x120f77){_0x403ebc=_0x120f77;_0x14d9b4=0xc8;}else{_0x14d9b4=0xce;}_0x5d01d9[_0xbb40('0x2f')](_0x14d9b4);return _0x5d01d9['set'](_0xbb40('0x34'),_0x42ac90+'-'+_0x403ebc+'/'+_0x120f77)[_0xbb40('0x35')](_0x1da9c0);}return null;};}function patchUpdates(_0x3ab62d){return function(_0x4e0b2c){try{jsonpatch[_0xbb40('0x36')](_0x4e0b2c,_0x3ab62d,!![]);}catch(_0x80a8df){return BPromise[_0xbb40('0x37')](_0x80a8df);}return _0x4e0b2c[_0xbb40('0x38')]();};}function saveUpdates(_0x299b12,_0x3914ba){return function(_0x373015){if(_0x373015){return _0x373015[_0xbb40('0x39')](_0x299b12)['then'](function(_0x562308){return _0x562308;});}return null;};}function removeEntity(_0x40d47b,_0x14ab34){return function(_0x533305){if(_0x533305){return _0x533305[_0xbb40('0x3a')]()[_0xbb40('0x25')](function(){_0x40d47b[_0xbb40('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb1a6d7,_0x2c5724){return function(_0x42a5cd){if(!_0x42a5cd){_0xb1a6d7[_0xbb40('0x2e')](0x194);}return _0x42a5cd;};}function handleError(_0x40ee3a,_0x33c77d){_0x33c77d=_0x33c77d||0x1f4;return function(_0x2dc8f7){logger[_0xbb40('0x2b')](_0x2dc8f7['stack']);if(_0x2dc8f7['name']){delete _0x2dc8f7['name'];}_0x40ee3a['status'](_0x33c77d)['send'](_0x2dc8f7);};}exports['index']=function(_0x259431,_0x11be1c){var _0x20ac9e={},_0xee9c4f={},_0x26e01d={'count':0x0,'rows':[]};var _0x19e80a=_[_0xbb40('0x3b')](db[_0xbb40('0x3c')][_0xbb40('0x3d')],function(_0x3d3bab){return{'name':_0x3d3bab[_0xbb40('0x3e')],'type':_0x3d3bab[_0xbb40('0x3f')][_0xbb40('0x40')]};});_0xee9c4f[_0xbb40('0x41')]=_[_0xbb40('0x3b')](_0x19e80a,_0xbb40('0x42'));_0xee9c4f[_0xbb40('0x43')]=_[_0xbb40('0x44')](_0x259431[_0xbb40('0x43')]);_0xee9c4f[_0xbb40('0x45')]=_[_0xbb40('0x46')](_0xee9c4f[_0xbb40('0x41')],_0xee9c4f[_0xbb40('0x43')]);_0x20ac9e[_0xbb40('0x47')]=_['intersection'](_0xee9c4f[_0xbb40('0x41')],qs[_0xbb40('0x48')](_0x259431[_0xbb40('0x43')]['fields']));_0x20ac9e[_0xbb40('0x47')]=_0x20ac9e[_0xbb40('0x47')]['length']?_0x20ac9e[_0xbb40('0x47')]:_0xee9c4f['model'];if(!_0x259431[_0xbb40('0x43')][_0xbb40('0x49')](_0xbb40('0x4a'))){_0x20ac9e[_0xbb40('0x33')]=qs['limit'](_0x259431[_0xbb40('0x43')]['limit']);_0x20ac9e[_0xbb40('0x32')]=qs[_0xbb40('0x32')](_0x259431['query'][_0xbb40('0x32')]);}_0x20ac9e[_0xbb40('0x4b')]=qs[_0xbb40('0x4c')](_0x259431[_0xbb40('0x43')][_0xbb40('0x4c')]);_0x20ac9e[_0xbb40('0x4d')]=qs[_0xbb40('0x45')](_['pick'](_0x259431[_0xbb40('0x43')],_0xee9c4f[_0xbb40('0x45')]),_0x19e80a);if(_0x259431[_0xbb40('0x43')][_0xbb40('0x4e')]){_0x20ac9e[_0xbb40('0x4d')]=_['merge'](_0x20ac9e[_0xbb40('0x4d')],{'$or':_[_0xbb40('0x3b')](_0x19e80a,function(_0x3b03c1){if(_0x3b03c1[_0xbb40('0x3f')]!=='VIRTUAL'){var _0x37fd80={};_0x37fd80[_0x3b03c1[_0xbb40('0x42')]]={'$like':'%'+_0x259431[_0xbb40('0x43')]['filter']+'%'};return _0x37fd80;}})});}_0x20ac9e=_[_0xbb40('0x4f')]({},_0x20ac9e,_0x259431['options']);var _0x843ccc={'where':_0x20ac9e['where']};return db[_0xbb40('0x3c')]['count'](_0x843ccc)[_0xbb40('0x25')](function(_0xc57549){_0x26e01d[_0xbb40('0x31')]=_0xc57549;if(_0x259431[_0xbb40('0x43')][_0xbb40('0x50')]){_0x20ac9e[_0xbb40('0x51')]=[{'all':!![]}];}return db[_0xbb40('0x3c')][_0xbb40('0x52')](_0x20ac9e);})['then'](function(_0x27f6d9){_0x26e01d[_0xbb40('0x53')]=_0x27f6d9;return _0x26e01d;})[_0xbb40('0x25')](respondWithFilteredResult(_0x11be1c,_0x20ac9e))[_0xbb40('0x54')](handleError(_0x11be1c,null));};exports['show']=function(_0xbede2c,_0x4001e7){var _0xd29b3c={'raw':!![],'where':{'id':_0xbede2c[_0xbb40('0x55')]['id']}},_0x246f2e={};_0x246f2e[_0xbb40('0x41')]=_['keys'](db['ChatGroup'][_0xbb40('0x3d')]);_0x246f2e[_0xbb40('0x43')]=_[_0xbb40('0x44')](_0xbede2c[_0xbb40('0x43')]);_0x246f2e[_0xbb40('0x45')]=_[_0xbb40('0x46')](_0x246f2e[_0xbb40('0x41')],_0x246f2e[_0xbb40('0x43')]);_0xd29b3c[_0xbb40('0x47')]=_['intersection'](_0x246f2e['model'],qs[_0xbb40('0x48')](_0xbede2c[_0xbb40('0x43')]['fields']));_0xd29b3c[_0xbb40('0x47')]=_0xd29b3c['attributes'][_0xbb40('0x56')]?_0xd29b3c[_0xbb40('0x47')]:_0x246f2e[_0xbb40('0x41')];if(_0xbede2c[_0xbb40('0x43')][_0xbb40('0x50')]){_0xd29b3c[_0xbb40('0x51')]=[{'all':!![]}];}_0xd29b3c=_[_0xbb40('0x4f')]({},_0xd29b3c,_0xbede2c[_0xbb40('0x57')]);return db[_0xbb40('0x3c')][_0xbb40('0x58')](_0xd29b3c)[_0xbb40('0x25')](handleEntityNotFound(_0x4001e7,null))[_0xbb40('0x25')](respondWithResult(_0x4001e7,null))[_0xbb40('0x54')](handleError(_0x4001e7,null));};exports['create']=function(_0x12d91b,_0x15b8b6){return db['ChatGroup'][_0xbb40('0x59')](_0x12d91b['body'],{})[_0xbb40('0x25')](respondWithResult(_0x15b8b6,0xc9))[_0xbb40('0x54')](handleError(_0x15b8b6,null));};exports['update']=function(_0x1a91ab,_0x5b1b7f){if(_0x1a91ab['body']['id']){delete _0x1a91ab['body']['id'];}return db[_0xbb40('0x3c')][_0xbb40('0x58')]({'where':{'id':_0x1a91ab[_0xbb40('0x55')]['id']}})[_0xbb40('0x25')](handleEntityNotFound(_0x5b1b7f,null))[_0xbb40('0x25')](saveUpdates(_0x1a91ab['body'],null))[_0xbb40('0x25')](respondWithResult(_0x5b1b7f,null))[_0xbb40('0x54')](handleError(_0x5b1b7f,null));};exports['destroy']=function(_0x1126ca,_0x14a258){return db[_0xbb40('0x3c')]['find']({'where':{'id':_0x1126ca['params']['id']}})[_0xbb40('0x25')](handleEntityNotFound(_0x14a258,null))[_0xbb40('0x25')](removeEntity(_0x14a258,null))[_0xbb40('0x54')](handleError(_0x14a258,null));};exports[_0xbb40('0x5a')]=function(_0x1e4db5,_0x492d31){return db[_0xbb40('0x3c')]['describe']()[_0xbb40('0x25')](respondWithResult(_0x492d31,null))['catch'](handleError(_0x492d31,null));};exports[_0xbb40('0x5b')]=function(_0x25cfa4,_0x4ea8fd,_0x206a9e){return db[_0xbb40('0x5c')][_0xbb40('0x31')]({'where':{'ChatGroupId':_0x25cfa4[_0xbb40('0x55')]['id'],'ToId':_0x25cfa4[_0xbb40('0x5d')]['id'],'read':![]}})[_0xbb40('0x25')](function(_0x10781b){return{'id':_[_0xbb40('0x5e')](_0x25cfa4['params']['id']),'count':_0x10781b};})[_0xbb40('0x25')](respondWithResult(_0x4ea8fd,null))[_0xbb40('0x54')](handleError(_0x4ea8fd,null));};exports[_0xbb40('0x5f')]=function(_0x1df23d,_0x35d971,_0x46f787){return db[_0xbb40('0x3c')][_0xbb40('0x58')]({'where':{'id':_0x1df23d['params']['id']}})[_0xbb40('0x25')](handleEntityNotFound(_0x35d971,null))[_0xbb40('0x25')](function(_0x51c717){if(_0x51c717){return _0x51c717[_0xbb40('0x5f')](_0x1df23d[_0xbb40('0x60')][_0xbb40('0x61')],_[_0xbb40('0x62')](_0x1df23d[_0xbb40('0x60')],['ids','id'])||{});}})[_0xbb40('0x25')](respondWithResult(_0x35d971,null))[_0xbb40('0x54')](handleError(_0x35d971,null));};exports[_0xbb40('0x63')]=function(_0x3e45d2,_0x312d72,_0x564b62){var _0x3e3e25={};var _0x531abd={};var _0x4ed545;var _0x4e9a1f;return db['ChatGroup'][_0xbb40('0x64')]({'where':{'id':_0x3e45d2['params']['id']}})['then'](handleEntityNotFound(_0x312d72,null))['then'](function(_0x419707){if(_0x419707){_0x4ed545=_0x419707;_0x531abd[_0xbb40('0x41')]=_['keys'](db[_0xbb40('0x65')][_0xbb40('0x3d')]);_0x531abd[_0xbb40('0x43')]=_[_0xbb40('0x44')](_0x3e45d2[_0xbb40('0x43')]);_0x531abd[_0xbb40('0x45')]=_['intersection'](_0x531abd[_0xbb40('0x41')],_0x531abd[_0xbb40('0x43')]);_0x3e3e25[_0xbb40('0x47')]=_['intersection'](_0x531abd[_0xbb40('0x41')],qs[_0xbb40('0x48')](_0x3e45d2[_0xbb40('0x43')]['fields']));_0x3e3e25[_0xbb40('0x47')]=_0x3e3e25[_0xbb40('0x47')]['length']?_0x3e3e25[_0xbb40('0x47')]:_0x531abd[_0xbb40('0x41')];_0x3e3e25[_0xbb40('0x4b')]=qs[_0xbb40('0x4c')](_0x3e45d2['query'][_0xbb40('0x4c')]);_0x3e3e25[_0xbb40('0x4d')]=qs[_0xbb40('0x45')](_[_0xbb40('0x66')](_0x3e45d2[_0xbb40('0x43')],_0x531abd[_0xbb40('0x45')]));if(_0x3e45d2['query'][_0xbb40('0x4e')]){_0x3e3e25[_0xbb40('0x4d')]=_[_0xbb40('0x4f')](_0x3e3e25[_0xbb40('0x4d')],{'$or':_[_0xbb40('0x3b')](_0x3e3e25[_0xbb40('0x47')],function(_0x1088bc){var _0x1c5724={};_0x1c5724[_0x1088bc]={'$like':'%'+_0x3e45d2[_0xbb40('0x43')][_0xbb40('0x4e')]+'%'};return _0x1c5724;})});}_0x3e3e25=_[_0xbb40('0x4f')]({},_0x3e3e25,_0x3e45d2[_0xbb40('0x57')]);return _0x4ed545['getMembers'](_0x3e3e25);}})['then'](function(_0x5e3656){if(_0x5e3656){_0x4e9a1f=_0x5e3656['length'];if(!_0x3e45d2[_0xbb40('0x43')]['hasOwnProperty'](_0xbb40('0x4a'))){_0x3e3e25[_0xbb40('0x33')]=qs[_0xbb40('0x33')](_0x3e45d2[_0xbb40('0x43')][_0xbb40('0x33')]);_0x3e3e25[_0xbb40('0x32')]=qs[_0xbb40('0x32')](_0x3e45d2['query'][_0xbb40('0x32')]);}return _0x4ed545[_0xbb40('0x63')](_0x3e3e25);}})['then'](function(_0xc6aca4){if(_0xc6aca4){return _0xc6aca4?{'count':_0x4e9a1f,'rows':_0xc6aca4}:null;}})[_0xbb40('0x25')](respondWithResult(_0x312d72,null))['catch'](handleError(_0x312d72,null));};exports[_0xbb40('0x67')]=function(_0x3e4ab3,_0x4b7706,_0x1d11ba){return db[_0xbb40('0x3c')][_0xbb40('0x58')]({'where':{'id':_0x3e4ab3[_0xbb40('0x55')]['id']}})[_0xbb40('0x25')](handleEntityNotFound(_0x4b7706,null))[_0xbb40('0x25')](function(_0x182553){if(_0x182553){return _0x182553[_0xbb40('0x67')](_0x3e4ab3['query']['ids']);}})[_0xbb40('0x25')](respondWithStatusCode(_0x4b7706,null))[_0xbb40('0x54')](handleError(_0x4b7706,null));};exports['addMessage']=function(_0x41479c,_0x281576,_0x38e460){if(_0x41479c[_0xbb40('0x60')]['id']){delete _0x41479c[_0xbb40('0x60')]['id'];}return db[_0xbb40('0x3c')][_0xbb40('0x58')]({'where':{'id':_0x41479c['params']['id']}})[_0xbb40('0x25')](handleEntityNotFound(_0x281576,null))[_0xbb40('0x25')](function(_0x588169){if(_0x588169){_0x41479c[_0xbb40('0x60')][_0xbb40('0x68')]=_0x588169['id'];return db[_0xbb40('0x5c')][_0xbb40('0x59')](_0x41479c[_0xbb40('0x60')]);}})[_0xbb40('0x25')](respondWithResult(_0x281576,null))['catch'](handleError(_0x281576,null));};exports[_0xbb40('0x69')]=function(_0x3bf4a1,_0x8bcb90,_0x2a4573){var _0xc93e76={};var _0x55c2d8={};var _0x1c0540;var _0x44d776;return db['ChatGroup']['findOne']({'where':{'id':_0x3bf4a1[_0xbb40('0x55')]['id']}})['then'](handleEntityNotFound(_0x8bcb90,null))[_0xbb40('0x25')](function(_0x50b2f1){if(_0x50b2f1){_0x1c0540=_0x50b2f1;_0x55c2d8[_0xbb40('0x41')]=_['keys'](db[_0xbb40('0x5c')][_0xbb40('0x3d')]);_0x55c2d8['query']=_[_0xbb40('0x44')](_0x3bf4a1['query']);_0x55c2d8[_0xbb40('0x45')]=_[_0xbb40('0x46')](_0x55c2d8[_0xbb40('0x41')],_0x55c2d8[_0xbb40('0x43')]);_0xc93e76['attributes']=_['intersection'](_0x55c2d8[_0xbb40('0x41')],qs[_0xbb40('0x48')](_0x3bf4a1[_0xbb40('0x43')][_0xbb40('0x48')]));_0xc93e76[_0xbb40('0x47')]=_0xc93e76['attributes'][_0xbb40('0x56')]?_0xc93e76[_0xbb40('0x47')]:_0x55c2d8[_0xbb40('0x41')];_0xc93e76[_0xbb40('0x4b')]=qs[_0xbb40('0x4c')](_0x3bf4a1[_0xbb40('0x43')][_0xbb40('0x4c')]);_0xc93e76[_0xbb40('0x4d')]=qs[_0xbb40('0x45')](_['pick'](_0x3bf4a1[_0xbb40('0x43')],_0x55c2d8[_0xbb40('0x45')]));if(_0x3bf4a1[_0xbb40('0x43')][_0xbb40('0x4e')]){_0xc93e76['where']=_['merge'](_0xc93e76[_0xbb40('0x4d')],{'$or':_['map'](_0xc93e76[_0xbb40('0x47')],function(_0xaecee1){var _0x1e1814={};_0x1e1814[_0xaecee1]={'$like':'%'+_0x3bf4a1[_0xbb40('0x43')][_0xbb40('0x4e')]+'%'};return _0x1e1814;})});}if(_0x3bf4a1[_0xbb40('0x43')][_0xbb40('0x6a')]){var _0x3eee92=_0x3bf4a1['query'][_0xbb40('0x6a')][_0xbb40('0x6b')](',');var _0x24f8ef={};_0x24f8ef[_0x3eee92[0x0]]={'$gte':moment(_0x3eee92[0x1])[_0xbb40('0x6c')]('YYYY-MM-DD\x20HH:mm:ss')};_0xc93e76[_0xbb40('0x4d')]=_[_0xbb40('0x4f')](_0xc93e76[_0xbb40('0x4d')],_0x24f8ef);}_0xc93e76=_[_0xbb40('0x4f')]({},_0xc93e76,_0x3bf4a1[_0xbb40('0x57')]);return _0x1c0540[_0xbb40('0x69')](_0xc93e76);}})[_0xbb40('0x25')](function(_0x16a6f2){if(_0x16a6f2){_0x44d776=_0x16a6f2[_0xbb40('0x56')];if(!_0x3bf4a1[_0xbb40('0x43')][_0xbb40('0x49')](_0xbb40('0x4a'))){_0xc93e76[_0xbb40('0x33')]=qs[_0xbb40('0x33')](_0x3bf4a1[_0xbb40('0x43')][_0xbb40('0x33')]);_0xc93e76['offset']=qs[_0xbb40('0x32')](_0x3bf4a1[_0xbb40('0x43')][_0xbb40('0x32')]);}return _0x1c0540['getMessages'](_0xc93e76);}})[_0xbb40('0x25')](function(_0x346817){if(_0x346817){return _0x346817?{'count':_0x44d776,'rows':_0x346817}:null;}})[_0xbb40('0x25')](respondWithResult(_0x8bcb90,null))[_0xbb40('0x54')](handleError(_0x8bcb90,null));}; \ No newline at end of file +var _0xaad8=['VIRTUAL','filter','includeAll','findAll','show','params','length','include','options','find','create','body','destroy','describe','getUnread','user','toInteger','addMembers','ids','omit','getMembers','findOne','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','error','code','ChatGroup,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','send','index','map','ChatGroup','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge'];(function(_0x2aa031,_0x3643d0){var _0x587fe3=function(_0x14e3ac){while(--_0x14e3ac){_0x2aa031['push'](_0x2aa031['shift']());}};_0x587fe3(++_0x3643d0);}(_0xaad8,0xfd));var _0x8aad=function(_0x54dce5,_0x8bbf80){_0x54dce5=_0x54dce5-0x0;var _0x1de4a7=_0xaad8[_0x54dce5];return _0x1de4a7;};'use strict';var pdf=require(_0x8aad('0x0'));var emlformat=require(_0x8aad('0x1'));var rimraf=require(_0x8aad('0x2'));var zipdir=require(_0x8aad('0x3'));var jsonpatch=require(_0x8aad('0x4'));var rp=require(_0x8aad('0x5'));var moment=require(_0x8aad('0x6'));var BPromise=require(_0x8aad('0x7'));var Mustache=require(_0x8aad('0x8'));var util=require(_0x8aad('0x9'));var path=require('path');var sox=require(_0x8aad('0xa'));var csv=require(_0x8aad('0xb'));var ejs=require(_0x8aad('0xc'));var fs=require('fs');var _=require(_0x8aad('0xd'));var squel=require(_0x8aad('0xe'));var crypto=require(_0x8aad('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x8aad('0x10'));var toCsv=require(_0x8aad('0xb'));var querystring=require(_0x8aad('0x11'));var Papa=require('papaparse');var Redis=require(_0x8aad('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8aad('0x13'));var as=require(_0x8aad('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8aad('0x15'))(_0x8aad('0x16'));var utils=require(_0x8aad('0x17'));var config=require(_0x8aad('0x18'));var db=require(_0x8aad('0x19'))['db'];config[_0x8aad('0x1a')]=_['defaults'](config['redis'],{'host':_0x8aad('0x1b'),'port':0x18eb});var socket=require(_0x8aad('0x1c'))(new Redis(config[_0x8aad('0x1a')]));require(_0x8aad('0x1d'))['register'](socket);var jayson=require(_0x8aad('0x1e'));var client=jayson[_0x8aad('0x1f')][_0x8aad('0x20')]({'port':0x232a});function checkPasswordPattern(_0x264acc,_0x10c87f,_0x52a876){if(_0x52a876){var _0x187032=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x187032[_0x8aad('0x21')](_0x10c87f)){return _0x264acc;}else{throw new db[(_0x8aad('0x22'))][(_0x8aad('0x23'))](_0x8aad('0x24'));}}else{return _0x264acc;}}function respondWithRpcPromise(_0x51d0d5,_0x2484b9,_0x16be0a,_0x34de3d){return new BPromise(function(_0x11edf0,_0x11f867){var _0x4df755=_0x34de3d||client;return _0x4df755[_0x8aad('0x25')](_0x51d0d5,_0x16be0a)[_0x8aad('0x26')](function(_0x2539c3){logger[_0x8aad('0x27')]('ChatGroup,\x20%s,\x20%s',_0x2484b9,_0x8aad('0x28'));logger[_0x8aad('0x29')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x2484b9,_0x8aad('0x28'),JSON['stringify'](_0x2539c3));if(_0x2539c3[_0x8aad('0x2a')]){if(_0x2539c3['error'][_0x8aad('0x2b')]===0x1f4){logger[_0x8aad('0x2a')](_0x8aad('0x2c'),_0x2484b9,_0x2539c3[_0x8aad('0x2a')][_0x8aad('0x2d')]);return _0x11f867(_0x2539c3[_0x8aad('0x2a')][_0x8aad('0x2d')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x2484b9,_0x2539c3[_0x8aad('0x2a')][_0x8aad('0x2d')]);return _0x11edf0(_0x2539c3['error']['message']);}else{logger[_0x8aad('0x27')](_0x8aad('0x2c'),_0x2484b9,_0x8aad('0x28'));_0x11edf0(_0x2539c3['result']['message']);}})[_0x8aad('0x2e')](function(_0x5d36b1){logger[_0x8aad('0x2a')](_0x8aad('0x2c'),_0x2484b9,_0x5d36b1);_0x11f867(_0x5d36b1);});});}function respondWithStatusCode(_0x17f9a6,_0x10b34c){_0x10b34c=_0x10b34c||0xcc;return function(_0x393e9){if(_0x393e9){return _0x17f9a6[_0x8aad('0x2f')](_0x10b34c);}return _0x17f9a6[_0x8aad('0x30')](_0x10b34c)[_0x8aad('0x31')]();};}function respondWithResult(_0x41a9c3,_0x20f984){_0x20f984=_0x20f984||0xc8;return function(_0x17917a){if(_0x17917a){return _0x41a9c3['status'](_0x20f984)[_0x8aad('0x32')](_0x17917a);}};}function respondWithFilteredResult(_0x2bccd5,_0x14142c){return function(_0x2ff4dc){if(_0x2ff4dc){var _0x14b366=_0x2ff4dc[_0x8aad('0x33')],_0x1e28d0=_0x14142c[_0x8aad('0x34')],_0x14cf78=_0x14142c['offset']+_0x14142c[_0x8aad('0x35')],_0x53f26d;if(_0x14cf78>=_0x14b366){_0x14cf78=_0x14b366;_0x53f26d=0xc8;}else{_0x53f26d=0xce;}_0x2bccd5[_0x8aad('0x30')](_0x53f26d);return _0x2bccd5[_0x8aad('0x36')](_0x8aad('0x37'),_0x1e28d0+'-'+_0x14cf78+'/'+_0x14b366)[_0x8aad('0x32')](_0x2ff4dc);}return null;};}function patchUpdates(_0x25516c){return function(_0x3a10df){try{jsonpatch[_0x8aad('0x38')](_0x3a10df,_0x25516c,!![]);}catch(_0x5e5934){return BPromise[_0x8aad('0x39')](_0x5e5934);}return _0x3a10df[_0x8aad('0x3a')]();};}function saveUpdates(_0x2f9762,_0x406414){return function(_0x3cfa1a){if(_0x3cfa1a){return _0x3cfa1a[_0x8aad('0x3b')](_0x2f9762)[_0x8aad('0x26')](function(_0x3c1b41){return _0x3c1b41;});}return null;};}function removeEntity(_0x2eac44,_0x594ffb){return function(_0x891b19){if(_0x891b19){return _0x891b19['destroy']()[_0x8aad('0x26')](function(){_0x2eac44[_0x8aad('0x30')](0xcc)[_0x8aad('0x31')]();});}};}function handleEntityNotFound(_0x59de88,_0x282fe9){return function(_0x2d8c2b){if(!_0x2d8c2b){_0x59de88[_0x8aad('0x2f')](0x194);}return _0x2d8c2b;};}function handleError(_0x266a6a,_0x56c21b){_0x56c21b=_0x56c21b||0x1f4;return function(_0x7db13f){logger[_0x8aad('0x2a')](_0x7db13f[_0x8aad('0x3c')]);if(_0x7db13f[_0x8aad('0x3d')]){delete _0x7db13f[_0x8aad('0x3d')];}_0x266a6a[_0x8aad('0x30')](_0x56c21b)[_0x8aad('0x3e')](_0x7db13f);};}exports[_0x8aad('0x3f')]=function(_0x485fb4,_0x18f4ff){var _0x357bec={},_0x550c04={},_0x30af0e={'count':0x0,'rows':[]};var _0x2dd78b=_[_0x8aad('0x40')](db[_0x8aad('0x41')][_0x8aad('0x42')],function(_0x467cc7){return{'name':_0x467cc7['fieldName'],'type':_0x467cc7[_0x8aad('0x43')][_0x8aad('0x44')]};});_0x550c04[_0x8aad('0x45')]=_[_0x8aad('0x40')](_0x2dd78b,_0x8aad('0x3d'));_0x550c04[_0x8aad('0x46')]=_[_0x8aad('0x47')](_0x485fb4[_0x8aad('0x46')]);_0x550c04[_0x8aad('0x48')]=_[_0x8aad('0x49')](_0x550c04[_0x8aad('0x45')],_0x550c04['query']);_0x357bec[_0x8aad('0x4a')]=_['intersection'](_0x550c04[_0x8aad('0x45')],qs[_0x8aad('0x4b')](_0x485fb4[_0x8aad('0x46')][_0x8aad('0x4b')]));_0x357bec[_0x8aad('0x4a')]=_0x357bec[_0x8aad('0x4a')]['length']?_0x357bec[_0x8aad('0x4a')]:_0x550c04[_0x8aad('0x45')];if(!_0x485fb4[_0x8aad('0x46')][_0x8aad('0x4c')](_0x8aad('0x4d'))){_0x357bec['limit']=qs[_0x8aad('0x35')](_0x485fb4['query']['limit']);_0x357bec[_0x8aad('0x34')]=qs[_0x8aad('0x34')](_0x485fb4[_0x8aad('0x46')][_0x8aad('0x34')]);}_0x357bec[_0x8aad('0x4e')]=qs[_0x8aad('0x4f')](_0x485fb4['query'][_0x8aad('0x4f')]);_0x357bec[_0x8aad('0x50')]=qs[_0x8aad('0x48')](_[_0x8aad('0x51')](_0x485fb4[_0x8aad('0x46')],_0x550c04[_0x8aad('0x48')]),_0x2dd78b);if(_0x485fb4['query']['filter']){_0x357bec[_0x8aad('0x50')]=_[_0x8aad('0x52')](_0x357bec[_0x8aad('0x50')],{'$or':_[_0x8aad('0x40')](_0x2dd78b,function(_0xb89731){if(_0xb89731[_0x8aad('0x43')]!==_0x8aad('0x53')){var _0x4df5bd={};_0x4df5bd[_0xb89731['name']]={'$like':'%'+_0x485fb4[_0x8aad('0x46')][_0x8aad('0x54')]+'%'};return _0x4df5bd;}})});}_0x357bec=_[_0x8aad('0x52')]({},_0x357bec,_0x485fb4['options']);var _0x84e7eb={'where':_0x357bec[_0x8aad('0x50')]};return db['ChatGroup'][_0x8aad('0x33')](_0x84e7eb)['then'](function(_0x308a2b){_0x30af0e[_0x8aad('0x33')]=_0x308a2b;if(_0x485fb4['query'][_0x8aad('0x55')]){_0x357bec['include']=[{'all':!![]}];}return db[_0x8aad('0x41')][_0x8aad('0x56')](_0x357bec);})[_0x8aad('0x26')](function(_0x2d5128){_0x30af0e['rows']=_0x2d5128;return _0x30af0e;})[_0x8aad('0x26')](respondWithFilteredResult(_0x18f4ff,_0x357bec))[_0x8aad('0x2e')](handleError(_0x18f4ff,null));};exports[_0x8aad('0x57')]=function(_0x37356f,_0x3cfab6){var _0x135b79={'raw':!![],'where':{'id':_0x37356f[_0x8aad('0x58')]['id']}},_0x49f2b8={};_0x49f2b8[_0x8aad('0x45')]=_[_0x8aad('0x47')](db[_0x8aad('0x41')]['rawAttributes']);_0x49f2b8[_0x8aad('0x46')]=_[_0x8aad('0x47')](_0x37356f[_0x8aad('0x46')]);_0x49f2b8[_0x8aad('0x48')]=_['intersection'](_0x49f2b8[_0x8aad('0x45')],_0x49f2b8['query']);_0x135b79['attributes']=_['intersection'](_0x49f2b8[_0x8aad('0x45')],qs[_0x8aad('0x4b')](_0x37356f[_0x8aad('0x46')][_0x8aad('0x4b')]));_0x135b79[_0x8aad('0x4a')]=_0x135b79[_0x8aad('0x4a')][_0x8aad('0x59')]?_0x135b79[_0x8aad('0x4a')]:_0x49f2b8[_0x8aad('0x45')];if(_0x37356f['query'][_0x8aad('0x55')]){_0x135b79[_0x8aad('0x5a')]=[{'all':!![]}];}_0x135b79=_['merge']({},_0x135b79,_0x37356f[_0x8aad('0x5b')]);return db[_0x8aad('0x41')][_0x8aad('0x5c')](_0x135b79)[_0x8aad('0x26')](handleEntityNotFound(_0x3cfab6,null))[_0x8aad('0x26')](respondWithResult(_0x3cfab6,null))[_0x8aad('0x2e')](handleError(_0x3cfab6,null));};exports[_0x8aad('0x5d')]=function(_0xc2ad2c,_0x54055d){return db[_0x8aad('0x41')][_0x8aad('0x5d')](_0xc2ad2c[_0x8aad('0x5e')],{})[_0x8aad('0x26')](respondWithResult(_0x54055d,0xc9))['catch'](handleError(_0x54055d,null));};exports[_0x8aad('0x3b')]=function(_0x4dde2f,_0x5adfac){if(_0x4dde2f[_0x8aad('0x5e')]['id']){delete _0x4dde2f[_0x8aad('0x5e')]['id'];}return db[_0x8aad('0x41')]['find']({'where':{'id':_0x4dde2f[_0x8aad('0x58')]['id']}})[_0x8aad('0x26')](handleEntityNotFound(_0x5adfac,null))[_0x8aad('0x26')](saveUpdates(_0x4dde2f[_0x8aad('0x5e')],null))[_0x8aad('0x26')](respondWithResult(_0x5adfac,null))['catch'](handleError(_0x5adfac,null));};exports[_0x8aad('0x5f')]=function(_0x282507,_0xbcdd84){return db[_0x8aad('0x41')][_0x8aad('0x5c')]({'where':{'id':_0x282507[_0x8aad('0x58')]['id']}})[_0x8aad('0x26')](handleEntityNotFound(_0xbcdd84,null))[_0x8aad('0x26')](removeEntity(_0xbcdd84,null))['catch'](handleError(_0xbcdd84,null));};exports[_0x8aad('0x60')]=function(_0x2debbe,_0x424514){return db[_0x8aad('0x41')]['describe']()[_0x8aad('0x26')](respondWithResult(_0x424514,null))[_0x8aad('0x2e')](handleError(_0x424514,null));};exports[_0x8aad('0x61')]=function(_0x202780,_0x12847f,_0x5182b9){return db['ChatInternalMessage'][_0x8aad('0x33')]({'where':{'ChatGroupId':_0x202780['params']['id'],'ToId':_0x202780[_0x8aad('0x62')]['id'],'read':![]}})[_0x8aad('0x26')](function(_0x70e34a){return{'id':_[_0x8aad('0x63')](_0x202780['params']['id']),'count':_0x70e34a};})[_0x8aad('0x26')](respondWithResult(_0x12847f,null))[_0x8aad('0x2e')](handleError(_0x12847f,null));};exports[_0x8aad('0x64')]=function(_0x36395f,_0x34058e,_0x34864a){return db[_0x8aad('0x41')][_0x8aad('0x5c')]({'where':{'id':_0x36395f[_0x8aad('0x58')]['id']}})[_0x8aad('0x26')](handleEntityNotFound(_0x34058e,null))[_0x8aad('0x26')](function(_0x30b2d3){if(_0x30b2d3){return _0x30b2d3[_0x8aad('0x64')](_0x36395f[_0x8aad('0x5e')][_0x8aad('0x65')],_[_0x8aad('0x66')](_0x36395f[_0x8aad('0x5e')],[_0x8aad('0x65'),'id'])||{});}})['then'](respondWithResult(_0x34058e,null))[_0x8aad('0x2e')](handleError(_0x34058e,null));};exports[_0x8aad('0x67')]=function(_0x332534,_0x33378d,_0x259059){var _0x3009d7={};var _0x2da8aa={};var _0x34941f;var _0x565231;return db[_0x8aad('0x41')][_0x8aad('0x68')]({'where':{'id':_0x332534[_0x8aad('0x58')]['id']}})[_0x8aad('0x26')](handleEntityNotFound(_0x33378d,null))[_0x8aad('0x26')](function(_0x16891a){if(_0x16891a){_0x34941f=_0x16891a;_0x2da8aa[_0x8aad('0x45')]=_[_0x8aad('0x47')](db['User'][_0x8aad('0x42')]);_0x2da8aa[_0x8aad('0x46')]=_[_0x8aad('0x47')](_0x332534[_0x8aad('0x46')]);_0x2da8aa[_0x8aad('0x48')]=_['intersection'](_0x2da8aa['model'],_0x2da8aa[_0x8aad('0x46')]);_0x3009d7['attributes']=_['intersection'](_0x2da8aa[_0x8aad('0x45')],qs[_0x8aad('0x4b')](_0x332534[_0x8aad('0x46')][_0x8aad('0x4b')]));_0x3009d7[_0x8aad('0x4a')]=_0x3009d7[_0x8aad('0x4a')][_0x8aad('0x59')]?_0x3009d7['attributes']:_0x2da8aa[_0x8aad('0x45')];_0x3009d7[_0x8aad('0x4e')]=qs['sort'](_0x332534[_0x8aad('0x46')][_0x8aad('0x4f')]);_0x3009d7['where']=qs[_0x8aad('0x48')](_[_0x8aad('0x51')](_0x332534[_0x8aad('0x46')],_0x2da8aa[_0x8aad('0x48')]));if(_0x332534[_0x8aad('0x46')][_0x8aad('0x54')]){_0x3009d7[_0x8aad('0x50')]=_[_0x8aad('0x52')](_0x3009d7[_0x8aad('0x50')],{'$or':_[_0x8aad('0x40')](_0x3009d7[_0x8aad('0x4a')],function(_0x1f4dea){var _0x4620cb={};_0x4620cb[_0x1f4dea]={'$like':'%'+_0x332534[_0x8aad('0x46')]['filter']+'%'};return _0x4620cb;})});}_0x3009d7=_[_0x8aad('0x52')]({},_0x3009d7,_0x332534[_0x8aad('0x5b')]);return _0x34941f[_0x8aad('0x67')](_0x3009d7);}})[_0x8aad('0x26')](function(_0x44e52e){if(_0x44e52e){_0x565231=_0x44e52e[_0x8aad('0x59')];if(!_0x332534['query'][_0x8aad('0x4c')](_0x8aad('0x4d'))){_0x3009d7[_0x8aad('0x35')]=qs[_0x8aad('0x35')](_0x332534['query'][_0x8aad('0x35')]);_0x3009d7['offset']=qs[_0x8aad('0x34')](_0x332534[_0x8aad('0x46')]['offset']);}return _0x34941f[_0x8aad('0x67')](_0x3009d7);}})[_0x8aad('0x26')](function(_0x593210){if(_0x593210){return _0x593210?{'count':_0x565231,'rows':_0x593210}:null;}})[_0x8aad('0x26')](respondWithResult(_0x33378d,null))[_0x8aad('0x2e')](handleError(_0x33378d,null));};exports['removeMembers']=function(_0x2f4186,_0x234bfc,_0x1a1946){return db[_0x8aad('0x41')]['find']({'where':{'id':_0x2f4186[_0x8aad('0x58')]['id']}})[_0x8aad('0x26')](handleEntityNotFound(_0x234bfc,null))[_0x8aad('0x26')](function(_0x276027){if(_0x276027){return _0x276027['removeMembers'](_0x2f4186['query'][_0x8aad('0x65')]);}})['then'](respondWithStatusCode(_0x234bfc,null))['catch'](handleError(_0x234bfc,null));};exports[_0x8aad('0x69')]=function(_0x45ca6d,_0xc4ec76,_0x3e110b){if(_0x45ca6d['body']['id']){delete _0x45ca6d[_0x8aad('0x5e')]['id'];}return db[_0x8aad('0x41')]['find']({'where':{'id':_0x45ca6d[_0x8aad('0x58')]['id']}})[_0x8aad('0x26')](handleEntityNotFound(_0xc4ec76,null))[_0x8aad('0x26')](function(_0x19c6a0){if(_0x19c6a0){_0x45ca6d[_0x8aad('0x5e')][_0x8aad('0x6a')]=_0x19c6a0['id'];return db['ChatInternalMessage'][_0x8aad('0x5d')](_0x45ca6d[_0x8aad('0x5e')]);}})[_0x8aad('0x26')](respondWithResult(_0xc4ec76,null))['catch'](handleError(_0xc4ec76,null));};exports[_0x8aad('0x6b')]=function(_0x27c803,_0x33b55d,_0x2314b1){var _0x592163={};var _0x2099bf={};var _0x583ea1;var _0x3f5fa2;return db[_0x8aad('0x41')][_0x8aad('0x68')]({'where':{'id':_0x27c803[_0x8aad('0x58')]['id']}})['then'](handleEntityNotFound(_0x33b55d,null))[_0x8aad('0x26')](function(_0x4f5235){if(_0x4f5235){_0x583ea1=_0x4f5235;_0x2099bf[_0x8aad('0x45')]=_[_0x8aad('0x47')](db['ChatInternalMessage'][_0x8aad('0x42')]);_0x2099bf[_0x8aad('0x46')]=_[_0x8aad('0x47')](_0x27c803[_0x8aad('0x46')]);_0x2099bf[_0x8aad('0x48')]=_[_0x8aad('0x49')](_0x2099bf[_0x8aad('0x45')],_0x2099bf[_0x8aad('0x46')]);_0x592163[_0x8aad('0x4a')]=_[_0x8aad('0x49')](_0x2099bf[_0x8aad('0x45')],qs[_0x8aad('0x4b')](_0x27c803['query'][_0x8aad('0x4b')]));_0x592163[_0x8aad('0x4a')]=_0x592163[_0x8aad('0x4a')]['length']?_0x592163[_0x8aad('0x4a')]:_0x2099bf[_0x8aad('0x45')];_0x592163[_0x8aad('0x4e')]=qs['sort'](_0x27c803[_0x8aad('0x46')][_0x8aad('0x4f')]);_0x592163['where']=qs[_0x8aad('0x48')](_[_0x8aad('0x51')](_0x27c803[_0x8aad('0x46')],_0x2099bf[_0x8aad('0x48')]));if(_0x27c803[_0x8aad('0x46')][_0x8aad('0x54')]){_0x592163[_0x8aad('0x50')]=_[_0x8aad('0x52')](_0x592163['where'],{'$or':_[_0x8aad('0x40')](_0x592163[_0x8aad('0x4a')],function(_0x4835d0){var _0x3a93d1={};_0x3a93d1[_0x4835d0]={'$like':'%'+_0x27c803['query'][_0x8aad('0x54')]+'%'};return _0x3a93d1;})});}if(_0x27c803[_0x8aad('0x46')][_0x8aad('0x6c')]){var _0x4c73e5=_0x27c803[_0x8aad('0x46')][_0x8aad('0x6c')][_0x8aad('0x6d')](',');var _0x3805d6={};_0x3805d6[_0x4c73e5[0x0]]={'$gte':moment(_0x4c73e5[0x1])[_0x8aad('0x6e')](_0x8aad('0x6f'))};_0x592163[_0x8aad('0x50')]=_[_0x8aad('0x52')](_0x592163['where'],_0x3805d6);}_0x592163=_[_0x8aad('0x52')]({},_0x592163,_0x27c803['options']);return _0x583ea1[_0x8aad('0x6b')](_0x592163);}})[_0x8aad('0x26')](function(_0xaa0073){if(_0xaa0073){_0x3f5fa2=_0xaa0073[_0x8aad('0x59')];if(!_0x27c803[_0x8aad('0x46')][_0x8aad('0x4c')](_0x8aad('0x4d'))){_0x592163[_0x8aad('0x35')]=qs[_0x8aad('0x35')](_0x27c803[_0x8aad('0x46')][_0x8aad('0x35')]);_0x592163[_0x8aad('0x34')]=qs[_0x8aad('0x34')](_0x27c803[_0x8aad('0x46')][_0x8aad('0x34')]);}return _0x583ea1[_0x8aad('0x6b')](_0x592163);}})[_0x8aad('0x26')](function(_0x1181e9){if(_0x1181e9){return _0x1181e9?{'count':_0x3f5fa2,'rows':_0x1181e9}:null;}})[_0x8aad('0x26')](respondWithResult(_0x33b55d,null))['catch'](handleError(_0x33b55d,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index b08cd62..21b5d41 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 _0x5f66=['remove','emit','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x218be9,_0x13ba83){var _0x54f070=function(_0x275327){while(--_0x275327){_0x218be9['push'](_0x218be9['shift']());}};_0x54f070(++_0x13ba83);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x65f6('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x65f6('0x1')](0x0);var events={'afterCreate':_0x65f6('0x2'),'afterUpdate':_0x65f6('0x3'),'afterDestroy':_0x65f6('0x4')};function emitEvent(_0x1a330c){return function(_0x5eb9ad,_0x3c5029,_0x5150c8){ChatGroupEvents[_0x65f6('0x5')](_0x1a330c+':'+_0x5eb9ad['id'],_0x5eb9ad);ChatGroupEvents[_0x65f6('0x5')](_0x1a330c,_0x5eb9ad);_0x5150c8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x65f6('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0x2032=['exports','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x2032,0xd9));var _0x2203=function(_0x35fa8c,_0x165769){_0x35fa8c=_0x35fa8c-0x0;var _0x1d611c=_0x2032[_0x35fa8c];return _0x1d611c;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];ChatGroup[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index d5d9f04..3b26a65 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 _0x44e8=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash'];(function(_0x145016,_0x40ba0b){var _0x4a57e8=function(_0x11ea2a){while(--_0x11ea2a){_0x145016['push'](_0x145016['shift']());}};_0x4a57e8(++_0x40ba0b);}(_0x44e8,0xd7));var _0x844e=function(_0x95286,_0xfc6c1f){_0x95286=_0x95286-0x0;var _0x39e162=_0x44e8[_0x95286];return _0x39e162;};'use strict';var _=require(_0x844e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x844e('0x1'));var moment=require(_0x844e('0x2'));var BPromise=require(_0x844e('0x3'));var rp=require(_0x844e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x844e('0x5'));var config=require(_0x844e('0x6'));var attributes=require(_0x844e('0x7'));module[_0x844e('0x8')]=function(_0x5c8f67,_0x2f6539){return _0x5c8f67[_0x844e('0x9')](_0x844e('0xa'),attributes,{'tableName':_0x844e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c09=['rimraf','../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x19aa32,_0x33381b){var _0x104dd6=function(_0xd172cd){while(--_0xd172cd){_0x19aa32['push'](_0x19aa32['shift']());}};_0x104dd6(++_0x33381b);}(_0x7c09,0x102));var _0x97c0=function(_0x3ed077,_0x4c0723){_0x3ed077=_0x3ed077-0x0;var _0x893393=_0x7c09[_0x3ed077];return _0x893393;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var logger=require(_0x97c0('0x1'))('api');var moment=require(_0x97c0('0x2'));var BPromise=require(_0x97c0('0x3'));var rp=require(_0x97c0('0x4'));var fs=require('fs');var path=require(_0x97c0('0x5'));var rimraf=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var attributes=require(_0x97c0('0x8'));module['exports']=function(_0x4b2f81,_0x590368){return _0x4b2f81[_0x97c0('0x9')](_0x97c0('0xa'),attributes,{'tableName':_0x97c0('0xb'),'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 22c30f7..e88e3f7 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 _0x2c7d=['../../mysqldb','../../config/logger','rpc','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','randomstring'];(function(_0x1a7a1b,_0x518846){var _0x350750=function(_0x4ab680){while(--_0x4ab680){_0x1a7a1b['push'](_0x1a7a1b['shift']());}};_0x350750(++_0x518846);}(_0x2c7d,0x18d));var _0xd2c7=function(_0x44d9a4,_0x1890b6){_0x44d9a4=_0x44d9a4-0x0;var _0x47694c=_0x2c7d[_0x44d9a4];return _0x47694c;};'use strict';var _=require(_0xd2c7('0x0'));var util=require(_0xd2c7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd2c7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd2c7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd2c7('0x4'))(_0xd2c7('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xd2c7('0x6')]=_[_0xd2c7('0x7')](config[_0xd2c7('0x6')],{'host':_0xd2c7('0x8'),'port':0x18eb});var socket=require(_0xd2c7('0x9'))(new Redis(config[_0xd2c7('0x6')]));require(_0xd2c7('0xa'))['register'](socket);function respondWithRpcPromise(_0xcab518,_0x2a1d73,_0x1fd07e){return new BPromise(function(_0x48ee08,_0x5ecbaa){return client['request'](_0xcab518,_0x1fd07e)[_0xd2c7('0xb')](function(_0x2230d5){logger[_0xd2c7('0xc')](_0xd2c7('0xd'),_0x2a1d73,_0xd2c7('0xe'));logger['debug'](_0xd2c7('0xf'),_0x2a1d73,_0xd2c7('0xe'),JSON['stringify'](_0x2230d5));if(_0x2230d5['error']){if(_0x2230d5[_0xd2c7('0x10')][_0xd2c7('0x11')]===0x1f4){logger['error'](_0xd2c7('0xd'),_0x2a1d73,_0x2230d5['error'][_0xd2c7('0x12')]);return _0x5ecbaa(_0x2230d5[_0xd2c7('0x10')][_0xd2c7('0x12')]);}logger[_0xd2c7('0x10')](_0xd2c7('0xd'),_0x2a1d73,_0x2230d5[_0xd2c7('0x10')]['message']);return _0x48ee08(_0x2230d5[_0xd2c7('0x10')][_0xd2c7('0x12')]);}else{logger[_0xd2c7('0xc')](_0xd2c7('0xd'),_0x2a1d73,_0xd2c7('0xe'));_0x48ee08(_0x2230d5['result'][_0xd2c7('0x12')]);}})[_0xd2c7('0x13')](function(_0x50b373){logger[_0xd2c7('0x10')](_0xd2c7('0xd'),_0x2a1d73,_0x50b373);_0x5ecbaa(_0x50b373);});});} \ No newline at end of file +var _0x9bbb=['./chatGroup.socket','request','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter'];(function(_0x3bcefb,_0x1e88c0){var _0x267bd9=function(_0x2097c8){while(--_0x2097c8){_0x3bcefb['push'](_0x3bcefb['shift']());}};_0x267bd9(++_0x1e88c0);}(_0x9bbb,0x1a4));var _0xb9bb=function(_0x50ebff,_0x5aec48){_0x50ebff=_0x50ebff-0x0;var _0x1596ca=_0x9bbb[_0x50ebff];return _0x1596ca;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb9bb('0x0'));var BPromise=require(_0xb9bb('0x1'));var rs=require(_0xb9bb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9bb('0x3'))['db'];var utils=require(_0xb9bb('0x4'));var logger=require(_0xb9bb('0x5'))(_0xb9bb('0x6'));var config=require(_0xb9bb('0x7'));var jayson=require(_0xb9bb('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xb9bb('0x9')]=_['defaults'](config['redis'],{'host':_0xb9bb('0xa'),'port':0x18eb});var socket=require(_0xb9bb('0xb'))(new Redis(config[_0xb9bb('0x9')]));require(_0xb9bb('0xc'))['register'](socket);function respondWithRpcPromise(_0x3f5e98,_0x23fa00,_0x58a993){return new BPromise(function(_0x48c84a,_0xf8dc62){return client[_0xb9bb('0xd')](_0x3f5e98,_0x58a993)['then'](function(_0x5e472c){logger['info'](_0xb9bb('0xe'),_0x23fa00,_0xb9bb('0xf'));logger[_0xb9bb('0x10')](_0xb9bb('0x11'),_0x23fa00,_0xb9bb('0xf'),JSON[_0xb9bb('0x12')](_0x5e472c));if(_0x5e472c[_0xb9bb('0x13')]){if(_0x5e472c[_0xb9bb('0x13')][_0xb9bb('0x14')]===0x1f4){logger[_0xb9bb('0x13')](_0xb9bb('0xe'),_0x23fa00,_0x5e472c[_0xb9bb('0x13')]['message']);return _0xf8dc62(_0x5e472c['error'][_0xb9bb('0x15')]);}logger[_0xb9bb('0x13')](_0xb9bb('0xe'),_0x23fa00,_0x5e472c[_0xb9bb('0x13')][_0xb9bb('0x15')]);return _0x48c84a(_0x5e472c[_0xb9bb('0x13')]['message']);}else{logger[_0xb9bb('0x16')](_0xb9bb('0xe'),_0x23fa00,'request\x20sent');_0x48c84a(_0x5e472c[_0xb9bb('0x17')][_0xb9bb('0x15')]);}})['catch'](function(_0x1a4048){logger[_0xb9bb('0x13')]('ChatGroup,\x20%s,\x20%s',_0x23fa00,_0x1a4048);_0xf8dc62(_0x1a4048);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 119a286..135c23f 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 _0xe339=['register','chatGroup:','save','remove','update'];(function(_0x221071,_0x16f736){var _0x4e9f8e=function(_0xcd378c){while(--_0xcd378c){_0x221071['push'](_0x221071['shift']());}};_0x4e9f8e(++_0x16f736);}(_0xe339,0x188));var _0x9e33=function(_0x42cc58,_0x5a4760){_0x42cc58=_0x42cc58-0x0;var _0x5ca9cb=_0xe339[_0x42cc58];return _0x5ca9cb;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x9e33('0x0'),_0x9e33('0x1'),_0x9e33('0x2')];function createListener(_0x4c5b8a,_0x29c5cf){return function(_0x8590ab){_0x29c5cf['emit'](_0x4c5b8a,_0x8590ab);};}function removeListener(_0x2e4286,_0x4f07f9){return function(){ChatGroupEvents['removeListener'](_0x2e4286,_0x4f07f9);};}exports[_0x9e33('0x3')]=function(_0x58d749){for(var _0x3fb434=0x0,_0x5243f2=events['length'];_0x3fb434<_0x5243f2;_0x3fb434++){var _0x278c7e=events[_0x3fb434];var _0x12eaf4=createListener(_0x9e33('0x4')+_0x278c7e,_0x58d749);ChatGroupEvents['on'](_0x278c7e,_0x12eaf4);}}; \ No newline at end of file +var _0x5c77=['remove','update','emit','register','length','chatGroup:','./chatGroup.events','save'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x5c77,0xae));var _0x75c7=function(_0x3b6bab,_0x4dd853){_0x3b6bab=_0x3b6bab-0x0;var _0x3f6478=_0x5c77[_0x3b6bab];return _0x3f6478;};'use strict';var ChatGroupEvents=require(_0x75c7('0x0'));var events=[_0x75c7('0x1'),_0x75c7('0x2'),_0x75c7('0x3')];function createListener(_0x1baf8a,_0x3c1050){return function(_0x2c5794){_0x3c1050[_0x75c7('0x4')](_0x1baf8a,_0x2c5794);};}function removeListener(_0x32a3e4,_0x39e5be){return function(){ChatGroupEvents['removeListener'](_0x32a3e4,_0x39e5be);};}exports[_0x75c7('0x5')]=function(_0x4d2ade){for(var _0x305a02=0x0,_0xdb23c6=events[_0x75c7('0x6')];_0x305a02<_0xdb23c6;_0x305a02++){var _0x538225=events[_0x305a02];var _0x4dae36=createListener(_0x75c7('0x7')+_0x538225,_0x4d2ade);ChatGroupEvents['on'](_0x538225,_0x4dae36);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 43679ed..ce59637 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 _0xaa1e=['removeMembers','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMessage','/:id','update','delete','destroy'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xaa1e,0x110));var _0xeaa1=function(_0x5ef12e,_0x59a72a){_0x5ef12e=_0x5ef12e-0x0;var _0xd8607=_0xaa1e[_0x5ef12e];return _0xd8607;};'use strict';var multer=require(_0xeaa1('0x0'));var util=require(_0xeaa1('0x1'));var path=require(_0xeaa1('0x2'));var timeout=require(_0xeaa1('0x3'));var express=require('express');var router=express[_0xeaa1('0x4')]();var auth=require(_0xeaa1('0x5'));var interaction=require(_0xeaa1('0x6'));var config=require(_0xeaa1('0x7'));var controller=require('./chatGroup.controller');router[_0xeaa1('0x8')]('/',auth[_0xeaa1('0x9')](),controller[_0xeaa1('0xa')]);router[_0xeaa1('0x8')](_0xeaa1('0xb'),auth['isAuthenticated'](),controller[_0xeaa1('0xc')]);router[_0xeaa1('0x8')]('/:id',auth[_0xeaa1('0x9')](),controller['show']);router[_0xeaa1('0x8')](_0xeaa1('0xd'),auth['isAuthenticated'](),controller[_0xeaa1('0xe')]);router['get'](_0xeaa1('0xf'),auth['isAuthenticated'](),controller[_0xeaa1('0x10')]);router[_0xeaa1('0x8')](_0xeaa1('0x11'),auth['isAuthenticated'](),controller[_0xeaa1('0x12')]);router[_0xeaa1('0x13')]('/',auth[_0xeaa1('0x9')](),controller['create']);router[_0xeaa1('0x13')](_0xeaa1('0xf'),auth['isAuthenticated'](),controller['addMembers']);router[_0xeaa1('0x13')](_0xeaa1('0x11'),auth[_0xeaa1('0x9')](),controller[_0xeaa1('0x14')]);router['put'](_0xeaa1('0x15'),auth[_0xeaa1('0x9')](),controller[_0xeaa1('0x16')]);router[_0xeaa1('0x17')](_0xeaa1('0x15'),auth[_0xeaa1('0x9')](),controller[_0xeaa1('0x18')]);router[_0xeaa1('0x17')](_0xeaa1('0xf'),auth['isAuthenticated'](),controller[_0xeaa1('0x19')]);module[_0xeaa1('0x1a')]=router; \ No newline at end of file +var _0xa44e=['post','/:id/messages','addMessage','put','update','removeMembers','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMessages','create'];(function(_0x3536de,_0x200191){var _0x18010f=function(_0x3b875f){while(--_0x3b875f){_0x3536de['push'](_0x3536de['shift']());}};_0x18010f(++_0x200191);}(_0xa44e,0xdf));var _0xea44=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa44e[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xea44('0x0'));var util=require(_0xea44('0x1'));var path=require(_0xea44('0x2'));var timeout=require('connect-timeout');var express=require(_0xea44('0x3'));var router=express[_0xea44('0x4')]();var auth=require(_0xea44('0x5'));var interaction=require(_0xea44('0x6'));var config=require(_0xea44('0x7'));var controller=require(_0xea44('0x8'));router[_0xea44('0x9')]('/',auth[_0xea44('0xa')](),controller[_0xea44('0xb')]);router[_0xea44('0x9')]('/describe',auth[_0xea44('0xa')](),controller[_0xea44('0xc')]);router[_0xea44('0x9')](_0xea44('0xd'),auth[_0xea44('0xa')](),controller[_0xea44('0xe')]);router[_0xea44('0x9')](_0xea44('0xf'),auth['isAuthenticated'](),controller[_0xea44('0x10')]);router[_0xea44('0x9')](_0xea44('0x11'),auth[_0xea44('0xa')](),controller['getMembers']);router[_0xea44('0x9')]('/:id/messages',auth[_0xea44('0xa')](),controller[_0xea44('0x12')]);router['post']('/',auth[_0xea44('0xa')](),controller[_0xea44('0x13')]);router['post'](_0xea44('0x11'),auth['isAuthenticated'](),controller['addMembers']);router[_0xea44('0x14')](_0xea44('0x15'),auth[_0xea44('0xa')](),controller[_0xea44('0x16')]);router[_0xea44('0x17')](_0xea44('0xd'),auth[_0xea44('0xa')](),controller[_0xea44('0x18')]);router['delete'](_0xea44('0xd'),auth[_0xea44('0xa')](),controller['destroy']);router['delete'](_0xea44('0x11'),auth[_0xea44('0xa')](),controller[_0xea44('0x19')]);module[_0xea44('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 6a1356e..7e5de21 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 _0x03b3=['TEXT','STRING','DATE','long','sequelize','BOOLEAN','ENUM','star'];(function(_0x251b02,_0x38c0f7){var _0x14017c=function(_0x7a976a){while(--_0x7a976a){_0x251b02['push'](_0x251b02['shift']());}};_0x14017c(++_0x38c0f7);}(_0x03b3,0x124));var _0x303b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03b3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x303b('0x0'));module['exports']={'closed':{'type':Sequelize[_0x303b('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x303b('0x2')](_0x303b('0x3'),'thumb'),'defaultValue':_0x303b('0x3')},'ratingMessage':{'type':Sequelize[_0x303b('0x4')]},'pathTranscript':{'type':Sequelize[_0x303b('0x4')]},'mailTranscript':{'type':Sequelize[_0x303b('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x303b('0x6')]},'disposition':{'type':Sequelize[_0x303b('0x5')]},'note':{'type':Sequelize[_0x303b('0x5')]},'browserName':{'type':Sequelize[_0x303b('0x5')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x303b('0x5')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x303b('0x5')]},'deviceType':{'type':Sequelize[_0x303b('0x5')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x303b('0x5')]},'formData':{'type':Sequelize['TEXT'](_0x303b('0x7'))},'read1stAt':{'type':Sequelize[_0x303b('0x6')]},'lastMsgAt':{'type':Sequelize[_0x303b('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x303b('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x303b('0x5')]},'customerPort':{'type':Sequelize[_0x303b('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x303b('0x4')]}}; \ No newline at end of file +var _0x137a=['ENUM','star','TEXT','STRING','DATE','exports','BOOLEAN'];(function(_0x29cadc,_0x2b3de0){var _0x36d08a=function(_0x2f8dd7){while(--_0x2f8dd7){_0x29cadc['push'](_0x29cadc['shift']());}};_0x36d08a(++_0x2b3de0);}(_0x137a,0xe5));var _0xa137=function(_0x46587c,_0x574944){_0x46587c=_0x46587c-0x0;var _0xb9f613=_0x137a[_0x46587c];return _0xb9f613;};'use strict';var Sequelize=require('sequelize');module[_0xa137('0x0')]={'closed':{'type':Sequelize[_0xa137('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xa137('0x2')](_0xa137('0x3'),'thumb'),'defaultValue':_0xa137('0x3')},'ratingMessage':{'type':Sequelize[_0xa137('0x4')]},'pathTranscript':{'type':Sequelize[_0xa137('0x4')]},'mailTranscript':{'type':Sequelize[_0xa137('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xa137('0x6')]},'disposition':{'type':Sequelize[_0xa137('0x5')]},'note':{'type':Sequelize[_0xa137('0x5')]},'browserName':{'type':Sequelize[_0xa137('0x5')]},'browserVersion':{'type':Sequelize[_0xa137('0x5')]},'osName':{'type':Sequelize[_0xa137('0x5')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0xa137('0x5')]},'deviceType':{'type':Sequelize[_0xa137('0x5')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xa137('0x5')]},'formData':{'type':Sequelize[_0xa137('0x4')]('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xa137('0x6')]},'lastMsgDirection':{'type':Sequelize[_0xa137('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xa137('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 27b3c75..6d7bcb1 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 _0xbff5=['i.*','c.firstName','Contact.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','rawAttributes','includeAll','include','merge','options','create','body','params','createVidaooSession','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','MotionCWB:','follow','join_url','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','closed','file','originalname','basename','filename','mimetype','Attachment','Unauthorized','attachId','join','server/files/attachments/','close','root','format','transcript-%s.txt','now','ChatMessage','CmContact','Messages','%s%d','System','customer','Visitor','agentIdentifier','website_alias','agentAlias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','findOne','MailServerOut','Smtp','service','host','port','secure','authentication','pass','SendMail','sendMail','email','mailTranscript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','includeAgent','addTags','setTags','spread','Tag','emit','chatInteractionTags:save','removeTags','download','unix','files','tmp','server','attachments','transcript-%d-%s.zip','firstName','lastName','Account','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','Owner','N.A.','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','out','renderFile','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','http','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','json','count','offset','limit','set','apply','reject','save','update','end','sendStatus','stack','name','send','Users','fullname','Tags','TagIds','split','forEach','push','index','map','ChatInteraction','fieldName','type','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','UserId','keys','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','t.id\x20IN\x20?','resolve','journey','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition'];(function(_0x4b9cf0,_0x5153b4){var _0x179c85=function(_0x502876){while(--_0x502876){_0x4b9cf0['push'](_0x4b9cf0['shift']());}};_0x179c85(++_0x5153b4);}(_0xbff5,0x1bc));var _0x5bff=function(_0x19d260,_0x25b555){_0x19d260=_0x19d260-0x0;var _0x1cc4ef=_0xbff5[_0x19d260];return _0x1cc4ef;};'use strict';var pdf=require(_0x5bff('0x0'));var emlformat=require(_0x5bff('0x1'));var rimraf=require(_0x5bff('0x2'));var zipdir=require(_0x5bff('0x3'));var jsonpatch=require(_0x5bff('0x4'));var rp=require(_0x5bff('0x5'));var moment=require(_0x5bff('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x5bff('0x7'));var util=require('util');var path=require('path');var sox=require(_0x5bff('0x8'));var csv=require(_0x5bff('0x9'));var ejs=require(_0x5bff('0xa'));var fs=require('fs');var _=require(_0x5bff('0xb'));var squel=require(_0x5bff('0xc'));var crypto=require(_0x5bff('0xd'));var jsforce=require(_0x5bff('0xe'));var deskjs=require(_0x5bff('0xf'));var toCsv=require(_0x5bff('0x9'));var querystring=require('querystring');var Papa=require(_0x5bff('0x10'));var Redis=require('ioredis');var authService=require(_0x5bff('0x11'));var qs=require(_0x5bff('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bff('0x13'));var logger=require('../../config/logger')(_0x5bff('0x14'));var utils=require('../../config/utils');var config=require(_0x5bff('0x15'));var db=require(_0x5bff('0x16'))['db'];config['redis']=_[_0x5bff('0x17')](config['redis'],{'host':_0x5bff('0x18'),'port':0x18eb});var socket=require(_0x5bff('0x19'))(new Redis(config['redis']));require(_0x5bff('0x1a'))[_0x5bff('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x5bff('0x1c')]({'port':0x232b});var client9004=jayson[_0x5bff('0x1d')][_0x5bff('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x4d883e,_0x2d22ab,_0x4612ec){if(_0x4612ec){var _0xcb8995=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xcb8995['test'](_0x2d22ab)){return _0x4d883e;}else{throw new db[(_0x5bff('0x1e'))][(_0x5bff('0x1f'))](_0x5bff('0x20'));}}else{return _0x4d883e;}}function respondWithRpcPromise(_0x546351,_0xc9fbc3,_0x279c22,_0x36653b){return new BPromise(function(_0x32cf60,_0x5216dc){var _0x3065c1=_0x36653b||client;return _0x3065c1['request'](_0x546351,_0x279c22)[_0x5bff('0x21')](function(_0x4d0111){logger[_0x5bff('0x22')](_0x5bff('0x23'),_0xc9fbc3,_0x5bff('0x24'));logger[_0x5bff('0x25')](_0x5bff('0x26'),_0xc9fbc3,_0x5bff('0x24'),JSON[_0x5bff('0x27')](_0x4d0111));if(_0x4d0111[_0x5bff('0x28')]){if(_0x4d0111[_0x5bff('0x28')]['code']===0x1f4){logger[_0x5bff('0x28')](_0x5bff('0x23'),_0xc9fbc3,_0x4d0111[_0x5bff('0x28')][_0x5bff('0x29')]);return _0x5216dc(_0x4d0111[_0x5bff('0x28')][_0x5bff('0x29')]);}logger[_0x5bff('0x28')](_0x5bff('0x23'),_0xc9fbc3,_0x4d0111['error']['message']);return _0x32cf60(_0x4d0111[_0x5bff('0x28')]['message']);}else{logger[_0x5bff('0x22')](_0x5bff('0x23'),_0xc9fbc3,_0x5bff('0x24'));_0x32cf60(_0x4d0111[_0x5bff('0x2a')][_0x5bff('0x29')]);}})[_0x5bff('0x2b')](function(_0x271f3c){logger[_0x5bff('0x28')]('ChatInteraction,\x20%s,\x20%s',_0xc9fbc3,_0x271f3c);_0x5216dc(_0x271f3c);});});}function respondWithStatusCode(_0x4df57a,_0x20d750){_0x20d750=_0x20d750||0xcc;return function(_0x2dd52f){if(_0x2dd52f){return _0x4df57a['sendStatus'](_0x20d750);}return _0x4df57a[_0x5bff('0x2c')](_0x20d750)['end']();};}function respondWithResult(_0x5470cb,_0x3eda3a){_0x3eda3a=_0x3eda3a||0xc8;return function(_0x5cf207){if(_0x5cf207){return _0x5470cb[_0x5bff('0x2c')](_0x3eda3a)[_0x5bff('0x2d')](_0x5cf207);}};}function respondWithFilteredResult(_0x2d692a,_0x11d48a){return function(_0x48aee1){if(_0x48aee1){var _0x71783=_0x48aee1[_0x5bff('0x2e')],_0x4ee6f1=_0x11d48a[_0x5bff('0x2f')],_0x3c1405=_0x11d48a[_0x5bff('0x2f')]+_0x11d48a[_0x5bff('0x30')],_0x5a7873;if(_0x3c1405>=_0x71783){_0x3c1405=_0x71783;_0x5a7873=0xc8;}else{_0x5a7873=0xce;}_0x2d692a[_0x5bff('0x2c')](_0x5a7873);return _0x2d692a[_0x5bff('0x31')]('Content-Range',_0x4ee6f1+'-'+_0x3c1405+'/'+_0x71783)[_0x5bff('0x2d')](_0x48aee1);}return null;};}function patchUpdates(_0x31c33f){return function(_0x3fef83){try{jsonpatch[_0x5bff('0x32')](_0x3fef83,_0x31c33f,!![]);}catch(_0x1f01ee){return BPromise[_0x5bff('0x33')](_0x1f01ee);}return _0x3fef83[_0x5bff('0x34')]();};}function saveUpdates(_0x16b3c2,_0x4dab82){return function(_0x1d6b04){if(_0x1d6b04){return _0x1d6b04[_0x5bff('0x35')](_0x16b3c2)[_0x5bff('0x21')](function(_0x320ff0){return _0x320ff0;});}return null;};}function removeEntity(_0x4fc35f,_0x19cfc3){return function(_0x48ed7){if(_0x48ed7){return _0x48ed7['destroy']()[_0x5bff('0x21')](function(){_0x4fc35f[_0x5bff('0x2c')](0xcc)[_0x5bff('0x36')]();});}};}function handleEntityNotFound(_0x28006e,_0x5a7c87){return function(_0x38245d){if(!_0x38245d){_0x28006e[_0x5bff('0x37')](0x194);}return _0x38245d;};}function handleError(_0x324495,_0x525c10){_0x525c10=_0x525c10||0x1f4;return function(_0x1065d1){logger['error'](_0x1065d1[_0x5bff('0x38')]);if(_0x1065d1[_0x5bff('0x39')]){delete _0x1065d1[_0x5bff('0x39')];}_0x324495['status'](_0x525c10)[_0x5bff('0x3a')](_0x1065d1);};}function getInteractionUsers(_0x1ec079,_0x3a4763){return new BPromise(function(_0x494fdc,_0x2e87b6){try{if(_0x3a4763[_0x1ec079['id']]){_0x1ec079[_0x5bff('0x3b')]=_['map'](_0x3a4763[_0x1ec079['id']],function(_0x265cdb){return{'id':_0x265cdb['id'],'fullname':_0x265cdb[_0x5bff('0x3c')]};});}}catch(_0x2ff182){_0x2e87b6(_0x2ff182);}_0x494fdc(_0x1ec079);});}function getInteractionTags(_0x77a071,_0x3b0f99){return new BPromise(function(_0x4c239f,_0x35796f){try{if(_0x77a071['TagIds']){_0x77a071[_0x5bff('0x3d')]=[];_0x77a071[_0x5bff('0x3e')][_0x5bff('0x3f')](',')[_0x5bff('0x40')](function(_0x32c4f1){_0x77a071[_0x5bff('0x3d')][_0x5bff('0x41')](_0x3b0f99[_0x32c4f1]);});}delete _0x77a071['TagIds'];}catch(_0x5c7f5f){_0x35796f(_0x5c7f5f);}_0x4c239f(_0x77a071);});}function updateChatInteraction(_0x12f0db,_0x2b9e6f,_0x3006c4){return new BPromise(function(_0x27a191,_0x25ef5f){return getInteractionUsers(_0x12f0db,_0x3006c4)[_0x5bff('0x21')](function(_0x13de8a){return getInteractionTags(_0x13de8a,_0x2b9e6f);})[_0x5bff('0x21')](function(_0x4cabe8){_0x27a191(_0x4cabe8);})[_0x5bff('0x2b')](function(_0x49676f){_0x25ef5f(_0x49676f);});});}exports[_0x5bff('0x42')]=function(_0x1b8c7f,_0x543517){var _0x15801c={},_0x463c70={},_0x536277={'count':0x0,'rows':[]};var _0x2b36dc=_[_0x5bff('0x43')](db[_0x5bff('0x44')]['rawAttributes'],function(_0x35e5f4){return{'name':_0x35e5f4[_0x5bff('0x45')],'type':_0x35e5f4[_0x5bff('0x46')]['key']};});_0x463c70[_0x5bff('0x47')]=_[_0x5bff('0x43')](_0x2b36dc,_0x5bff('0x39'));_0x463c70[_0x5bff('0x48')]=_['keys'](_0x1b8c7f[_0x5bff('0x48')]);_0x463c70['filters']=_['intersection'](_0x463c70[_0x5bff('0x47')],_0x463c70[_0x5bff('0x48')]);_0x15801c['attributes']=_[_0x5bff('0x49')](_0x463c70[_0x5bff('0x47')],qs['fields'](_0x1b8c7f[_0x5bff('0x48')][_0x5bff('0x4a')]));_0x15801c[_0x5bff('0x4b')]=_0x15801c[_0x5bff('0x4b')]['length']?_0x15801c[_0x5bff('0x4b')]:_0x463c70[_0x5bff('0x47')];if(!_0x1b8c7f[_0x5bff('0x48')][_0x5bff('0x4c')](_0x5bff('0x4d'))){_0x15801c[_0x5bff('0x30')]=qs['limit'](_0x1b8c7f[_0x5bff('0x48')][_0x5bff('0x30')]);_0x15801c['offset']=qs[_0x5bff('0x2f')](_0x1b8c7f['query']['offset']);}_0x15801c['order']=qs[_0x5bff('0x4e')](_0x1b8c7f[_0x5bff('0x48')]['sort']);_0x15801c[_0x5bff('0x4f')]=qs[_0x5bff('0x50')](_[_0x5bff('0x51')](_0x1b8c7f[_0x5bff('0x48')],_0x463c70[_0x5bff('0x50')]),_0x2b36dc);var _0x4a63b3=[];var _0x1015d0=squel[_0x5bff('0x52')]()['field']('id')[_0x5bff('0x53')]('name')[_0x5bff('0x53')](_0x5bff('0x54'))[_0x5bff('0x55')](_0x5bff('0x56'));var _0x29f7dc=squel['select']()[_0x5bff('0x53')](_0x5bff('0x57'))['field'](_0x5bff('0x58'))[_0x5bff('0x53')]('ui.ChatInteractionId')[_0x5bff('0x55')](_0x5bff('0x59'),'ui')[_0x5bff('0x5a')](_0x5bff('0x5b'),'u',_0x5bff('0x5c'));var _0x1be6eb=squel['select']()['from'](_0x5bff('0x5d'),'i')['left_join'](_0x5bff('0x5e'),'c',_0x5bff('0x5f'))[_0x5bff('0x5a')](_0x5bff('0x5b'),'o',_0x5bff('0x60'))[_0x5bff('0x5a')](_0x5bff('0x61'),'a',_0x5bff('0x62'))[_0x5bff('0x5a')](_0x5bff('0x63'),'me',_0x5bff('0x64'))['left_join']('chat_interaction_has_tags','it',_0x5bff('0x65'))['left_join'](_0x5bff('0x56'),'t','t.id\x20=\x20it.TagId');var _0x149022=squel[_0x5bff('0x66')]();var _0xb20434=[];var _0x3e6e4c=squel[_0x5bff('0x66')]();var _0x1021b1;if(_0x1b8c7f[_0x5bff('0x48')][_0x5bff('0x67')]){_0x1021b1=as[_0x5bff('0x68')](_0x1b8c7f[_0x5bff('0x48')][_0x5bff('0x67')]);var _0x57053a=_0x1021b1[_0x5bff('0x69')];for(var _0x56eff2=0x0;_0x56eff2<_0x1021b1['conditions']['length'];_0x56eff2++){var _0x1720ac=_0x1021b1['conditions'][_0x56eff2];var _0xb800d9='i';var _0x17d6f2=_[_0x5bff('0x6a')](_0x2b36dc,[_0x5bff('0x39'),_0x1720ac['field']]);if(!_0x17d6f2){switch(_0x1720ac['field']){case'unreadMessages':if(_0x1720ac[_0x5bff('0x6b')]==0x1){_0x1be6eb[_0x5bff('0x6c')]('`'+_0x1720ac['field']+_0x5bff('0x6d'));}else{_0x1be6eb[_0x5bff('0x6c')]('`'+_0x1720ac[_0x5bff('0x53')]+_0x5bff('0x6e'));}break;case _0x5bff('0x6f'):if(_0x1720ac[_0x5bff('0x70')]===_0x5bff('0x71')){if(_0x1720ac[_0x5bff('0x6b')][_0x5bff('0x3f')]('\x20')[_0x5bff('0x72')]>0x1){_0x149022[_0x57053a](_0x5bff('0x73'),qs[_0x5bff('0x74')](_0x1720ac[_0x5bff('0x6b')]),null);}else{var _0x33464a='%'+_0x1720ac['value']+'%';_0x149022[_0x57053a](_0x5bff('0x75'),_0x33464a,_0x33464a,_0x33464a);}}else{_0x17d6f2=_[_0x5bff('0x6a')](_0x2b36dc,[_0x5bff('0x39'),_0x5bff('0x76')]);_0x1720ac[_0x5bff('0x53')]=_0x5bff('0x76');_0x5b3b25=as[_0x5bff('0x77')](_0xb800d9,_0x17d6f2[_0x5bff('0x46')],_0x1720ac);_0x149022[_0x57053a](_0x5b3b25[_0x5bff('0x78')],_0x5b3b25[_0x5bff('0x6b')][_0x5bff('0x79')],_0x5b3b25[_0x5bff('0x6b')][_0x5bff('0x36')]);}break;case'Tag':var _0x9ef636=_0x1720ac[_0x5bff('0x6b')][_0x5bff('0x3f')](',')[_0x5bff('0x43')](function(_0x8a6f48){return Number(_0x8a6f48);});_0x9ef636['forEach'](function(_0x78f4c9){_0x3e6e4c['or'](_0x5bff('0x7a'),'%,'+_0x78f4c9+',%');});_0xb20434=_['union'](_0xb20434,_0x9ef636);break;case _0x5bff('0x7b'):if(_0x1720ac[_0x5bff('0x70')]===_0x5bff('0x71')){_0x149022[_0x57053a]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1720ac[_0x5bff('0x6b')]+'%',null);}else{_0x17d6f2=_[_0x5bff('0x6a')](_0x2b36dc,[_0x5bff('0x39'),_0x5bff('0x7c')]);_0x1720ac[_0x5bff('0x53')]=_0x5bff('0x7c');_0x5b3b25=as[_0x5bff('0x77')](_0xb800d9,_0x17d6f2[_0x5bff('0x46')],_0x1720ac);_0x149022[_0x57053a](_0x5b3b25[_0x5bff('0x78')],_0x5b3b25[_0x5bff('0x6b')][_0x5bff('0x79')],_0x5b3b25[_0x5bff('0x6b')]['end']);}break;case'body':_0x5b3b25=as[_0x5bff('0x77')]('me',null,_0x1720ac);_0x149022[_0x57053a](_0x5b3b25[_0x5bff('0x78')],_0x5b3b25[_0x5bff('0x6b')]['start'],_0x5b3b25[_0x5bff('0x6b')]['end']);break;}}else{var _0x5b3b25=as[_0x5bff('0x77')](_0xb800d9,_0x17d6f2['type'],_0x1720ac);_0x149022[_0x57053a](_0x5b3b25['text'],_0x5b3b25[_0x5bff('0x6b')][_0x5bff('0x79')],_0x5b3b25['value'][_0x5bff('0x36')]);}}}else{var _0x74714a=_(_0x1b8c7f[_0x5bff('0x48')])[_0x5bff('0x7d')]()[_0x5bff('0x43')](function(_0x3dcc24){return _[_0x5bff('0x7e')](_0x2b36dc,[_0x5bff('0x39'),_0x3dcc24])?_0x3dcc24:undefined;})[_0x5bff('0x7f')]()[_0x5bff('0x6b')]();if(!_[_0x5bff('0x80')](_0x74714a)){_0x74714a[_0x5bff('0x40')](function(_0x2e51a3){if(_0x2e51a3===_0x5bff('0x81')){_0x1be6eb[_0x5bff('0x4f')](_0x5bff('0x82'),[][_0x5bff('0x83')](_0x1b8c7f[_0x5bff('0x48')][_0x2e51a3]));}else if(_0x2e51a3===_0x5bff('0x84')){var _0x1fe577=JSON[_0x5bff('0x85')](_0x1b8c7f['query'][_0x2e51a3])[_0x5bff('0x86')];var _0x36c26c=JSON['parse'](_0x1b8c7f[_0x5bff('0x48')][_0x2e51a3])['$lte'];_0x1be6eb[_0x5bff('0x4f')](_0x5bff('0x87'),_0x1fe577,_0x36c26c);}else{if(_0x1b8c7f['query'][_0x2e51a3]===_0x5bff('0x88')){_0x1be6eb[_0x5bff('0x4f')]('i.'+_0x2e51a3+_0x5bff('0x89'));}else{_0x1be6eb[_0x5bff('0x4f')]('i.'+_0x2e51a3+_0x5bff('0x8a'),_0x1b8c7f[_0x5bff('0x48')][_0x2e51a3]);}}});}if(_0x1b8c7f[_0x5bff('0x48')][_0x5bff('0x8b')]){if(_0x1b8c7f[_0x5bff('0x48')][_0x5bff('0x8b')]==0x1){_0x1be6eb[_0x5bff('0x6c')]('`unreadMessages`\x20=\x200');}else{_0x1be6eb[_0x5bff('0x6c')](_0x5bff('0x8c'));}}if(_0x1b8c7f['query'][_0x5bff('0x8d')]){_0xb20434=_[_0x5bff('0x8e')](_0x1b8c7f[_0x5bff('0x48')][_0x5bff('0x8d')])?_0x1b8c7f[_0x5bff('0x48')][_0x5bff('0x8d')]:new Array(_0x1b8c7f[_0x5bff('0x48')][_0x5bff('0x8d')]);_0xb20434['forEach'](function(_0x4d42bc){_0x3e6e4c['or'](_0x5bff('0x7a'),'%,'+_0x4d42bc+',%');});}if(_0x1b8c7f['query'][_0x5bff('0x8f')]){var _0x40bd5d=_0x1b8c7f[_0x5bff('0x48')]['filter'][_0x5bff('0x90')]('\x5c','\x5c\x5c')[_0x5bff('0x90')]('\x27\x27',_0x5bff('0x91'));if(qs[_0x5bff('0x92')](_0x40bd5d)){_0x149022['or'](_0x5bff('0x93'),_0x40bd5d+'%');}else{_0x149022['or'](_0x5bff('0x94'),qs['getFullTextValue'](_0x40bd5d))['or'](_0x5bff('0x95'),_0x40bd5d+'%');}}}_0x1be6eb[_0x5bff('0x4f')](_0x149022);_0x1be6eb[_0x5bff('0x96')](_0x5bff('0x97'));var _0x5b0acf={'type':db[_0x5bff('0x1e')]['QueryTypes'][_0x5bff('0x98')],'raw':!![]};var _0x1e9c92=_0x1be6eb[_0x5bff('0x99')]();_0x1e9c92[_0x5bff('0x53')](_0x5bff('0x97'));_0x1e9c92[_0x5bff('0x53')](_0x5bff('0x9a'),'unreadMessages');if(_0x15801c[_0x5bff('0x9b')]){_0x15801c['order']['forEach'](function(_0x26290a){_0x1be6eb[_0x5bff('0x9b')]('i.'+_0x26290a[0x0],_0x26290a[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0xb20434)){_0x1be6eb[_0x5bff('0x6c')](_0x3e6e4c);_0x1e9c92[_0x5bff('0x4f')](_0x5bff('0x9c'),_0xb20434);}BPromise[_0x5bff('0x9d')]()['then'](function(){if(!_0x1021b1){if(_0x1b8c7f[_0x5bff('0x48')]['ChatWebsiteId']||_0x1b8c7f[_0x5bff('0x48')][_0x5bff('0x9e')])return;_0x1e9c92[_0x5bff('0x4f')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x1be6eb[_0x5bff('0x4f')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}return _0x1b8c7f[_0x5bff('0x9f')][_0x5bff('0xa0')]({'attributes':['id'],'raw':!![]})[_0x5bff('0x21')](function(_0x5b2058){if(_['isEmpty'](_0x5b2058)){_0x1e9c92[_0x5bff('0x4f')](_0x5bff('0xa1'));_0x1be6eb[_0x5bff('0x4f')](_0x5bff('0xa1'));}else{_0x1e9c92[_0x5bff('0x4f')](_0x5bff('0x82'),_[_0x5bff('0x43')](_0x5b2058,'id'));_0x1be6eb[_0x5bff('0x4f')](_0x5bff('0x82'),_['map'](_0x5b2058,'id'));}});})[_0x5bff('0x21')](function(){db[_0x5bff('0xa2')][_0x5bff('0x48')](_0x1e9c92['toString'](),_0x5b0acf)['then'](function(_0x2bba31){_0x536277[_0x5bff('0x2e')]=_0x2bba31['length'];if(_0x536277['count']===0x0)return[];return db[_0x5bff('0xa2')]['query'](_0x1015d0[_0x5bff('0xa3')](),_0x5b0acf)[_0x5bff('0x21')](function(_0x2efdb9){_0x4a63b3=_[_0x5bff('0xa4')](_0x2efdb9,'id');_0x5b0acf=_['merge'](_0x5b0acf,{'model':db[_0x5bff('0x44')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1b8c7f['query'][_0x5bff('0x4a')]){_0x15801c[_0x5bff('0x4b')][_0x5bff('0x40')](function(_0x272926){_0x1be6eb[_0x5bff('0x53')]('i.'+_0x272926);});}else{_0x1be6eb['field'](_0x5bff('0x9a'),_0x5bff('0xa5'));_0x1be6eb['field'](_0x5bff('0xa6'),_0x5bff('0xa7'));_0x1be6eb[_0x5bff('0x53')](_0x5bff('0xa8'),_0x5bff('0xa9'));_0x1be6eb['field'](_0x5bff('0xaa'));_0x1be6eb[_0x5bff('0x53')](_0x5bff('0xab'),_0x5bff('0xac'));_0x1be6eb[_0x5bff('0x53')](_0x5bff('0xad'),'Contact.lastName');_0x1be6eb[_0x5bff('0x53')]('c.email',_0x5bff('0xae'));_0x1be6eb[_0x5bff('0x53')](_0x5bff('0xaf'),_0x5bff('0xb0'));_0x1be6eb[_0x5bff('0x53')](_0x5bff('0xb1'),_0x5bff('0xb2'));_0x1be6eb[_0x5bff('0x53')](_0x5bff('0xb3'),_0x5bff('0xb4'));_0x1be6eb[_0x5bff('0x53')](_0x5bff('0xb5'),_0x5bff('0xb6'));_0x1be6eb['field']('o.internal',_0x5bff('0xb7'));_0x1be6eb[_0x5bff('0x53')](_0x5bff('0xb8'),_0x5bff('0x3e'));}if(_0x15801c[_0x5bff('0x30')])_0x1be6eb['limit'](_0x15801c[_0x5bff('0x30')]);if(_0x15801c[_0x5bff('0x2f')])_0x1be6eb[_0x5bff('0x2f')](_0x15801c['offset']);return db[_0x5bff('0xa2')]['query'](_0x1be6eb[_0x5bff('0xa3')](),_0x5b0acf);})['then'](function(_0x338e0c){_0x29f7dc['where'](_0x5bff('0xb9'),_[_0x5bff('0x43')](_0x338e0c,'id'));return db[_0x5bff('0xa2')]['query'](_0x29f7dc[_0x5bff('0xa3')](),_0x5b0acf)[_0x5bff('0x21')](function(_0x1b895d){var _0x3dbb53=_[_0x5bff('0xba')](_0x1b895d,_0x5bff('0xbb'));var _0x2ca82e=[];_0x338e0c[_0x5bff('0x40')](function(_0x2f9221){_0x2ca82e[_0x5bff('0x41')](updateChatInteraction(_0x2f9221,_0x4a63b3,_0x3dbb53));});return BPromise['all'](_0x2ca82e);});});})[_0x5bff('0x21')](function(_0xddc173){_0x536277['rows']=_0xddc173;return _0x536277;})[_0x5bff('0x21')](respondWithFilteredResult(_0x543517,_0x15801c));})['catch'](handleError(_0x543517,null));};exports['show']=function(_0x23371a,_0x40a636){var _0x2175df={'raw':![],'where':{'id':_0x23371a['params']['id']}},_0xd0b4f8={};_0xd0b4f8['model']=_[_0x5bff('0x7d')](db[_0x5bff('0x44')][_0x5bff('0xbc')]);_0xd0b4f8['query']=_[_0x5bff('0x7d')](_0x23371a[_0x5bff('0x48')]);_0xd0b4f8[_0x5bff('0x50')]=_[_0x5bff('0x49')](_0xd0b4f8[_0x5bff('0x47')],_0xd0b4f8['query']);_0x2175df[_0x5bff('0x4b')]=_[_0x5bff('0x49')](_0xd0b4f8['model'],qs[_0x5bff('0x4a')](_0x23371a[_0x5bff('0x48')][_0x5bff('0x4a')]));_0x2175df[_0x5bff('0x4b')]=_0x2175df['attributes']['length']?_0x2175df[_0x5bff('0x4b')]:_0xd0b4f8[_0x5bff('0x47')];if(_0x23371a[_0x5bff('0x48')][_0x5bff('0xbd')]){_0x2175df[_0x5bff('0xbe')]=[{'all':!![]}];}_0x2175df=_[_0x5bff('0xbf')]({},_0x2175df,_0x23371a[_0x5bff('0xc0')]);return db[_0x5bff('0x44')][_0x5bff('0x6a')](_0x2175df)[_0x5bff('0x21')](handleEntityNotFound(_0x40a636,null))['then'](respondWithResult(_0x40a636,null))[_0x5bff('0x2b')](handleError(_0x40a636,null));};exports[_0x5bff('0xc1')]=function(_0xb8396,_0x427a7d){return db['ChatInteraction']['create'](_0xb8396[_0x5bff('0xc2')],{})[_0x5bff('0x21')](respondWithResult(_0x427a7d,0xc9))[_0x5bff('0x2b')](handleError(_0x427a7d,null));};exports[_0x5bff('0x35')]=function(_0x39da05,_0x2d1845){if(_0x39da05[_0x5bff('0xc2')]['id']){delete _0x39da05['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x39da05['params']['id']}})[_0x5bff('0x21')](handleEntityNotFound(_0x2d1845,null))[_0x5bff('0x21')](saveUpdates(_0x39da05[_0x5bff('0xc2')],null))[_0x5bff('0x21')](respondWithResult(_0x2d1845,null))['catch'](handleError(_0x2d1845,null));};exports['destroy']=function(_0x908c2c,_0x40de22){return db[_0x5bff('0x44')][_0x5bff('0x6a')]({'where':{'id':_0x908c2c[_0x5bff('0xc3')]['id']}})[_0x5bff('0x21')](handleEntityNotFound(_0x40de22,null))['then'](removeEntity(_0x40de22,null))['catch'](handleError(_0x40de22,null));};exports['describe']=function(_0x4c482e,_0x98350){return db[_0x5bff('0x44')]['describe']()[_0x5bff('0x21')](respondWithResult(_0x98350,null))[_0x5bff('0x2b')](handleError(_0x98350,null));};exports[_0x5bff('0xc4')]=function(_0x4f6cc2,_0x349be9){var _0x5ac000=_0x4f6cc2['params']['id'];var _0x35a229;var _0x1e0635;var _0x6912b;return db[_0x5bff('0x44')]['findOne']({'where':{'id':_0x5ac000}})[_0x5bff('0x21')](function(_0x218fce){_0x35a229=_0x218fce;return db[_0x5bff('0xc5')]['findOne']({'where':{'id':_0x218fce[_0x5bff('0x81')]},'attributes':['id',_0x5bff('0xc6'),_0x5bff('0xc7')],'raw':!![]});})[_0x5bff('0x21')](function(_0x3bd9c2){if(_0x3bd9c2&&_0x3bd9c2['vidaooApiKey']&&_0x3bd9c2[_0x5bff('0xc7')]){_0x1e0635=_0x3bd9c2;var _0x5a9e8e={'rejectUnauthorized':![],'method':_0x5bff('0xc8'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x3bd9c2[_0x5bff('0xc6')]},'body':{'name':_0x5bff('0xc9')+_0x5ac000},'redirect':_0x5bff('0xca'),'json':!![]};return rp(_0x5a9e8e);}else{throw new db[(_0x5bff('0x1e'))][(_0x5bff('0x1f'))]('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x568f34){_0x6912b=_0x568f34;if(_0x6912b['id']){var _0x4a4b12={'body':_0x6912b[_0x5bff('0xcb')],'ChatWebsiteId':_0x1e0635['id'],'ChatInteractionId':_0x35a229['id'],'direction':'out','UserId':_0x4f6cc2['user']['id']};return db['ChatMessage'][_0x5bff('0xc1')](_0x4a4b12,{});}else{throw new db['Sequelize']['ValidationError'](_0x5bff('0xcc'));}})[_0x5bff('0x21')](function(){return _0x35a229[_0x5bff('0xcd')]({'vidaooSessionId':_0x6912b['id']});})[_0x5bff('0x21')](respondWithResult(_0x349be9,null))[_0x5bff('0x2b')](handleError(_0x349be9,null));};exports['customUpdate']=function(_0x566cd2,_0x4d4513){if(_0x566cd2['body']['id']){delete _0x566cd2[_0x5bff('0xc2')]['id'];}return db[_0x5bff('0x44')]['find']({'where':{'id':_0x566cd2['params']['id']}})[_0x5bff('0x21')](handleEntityNotFound(_0x4d4513,null))[_0x5bff('0x21')](saveUpdates(_0x566cd2['body'],null))['then'](respondWithResult(_0x4d4513,null))[_0x5bff('0x2b')](handleError(_0x4d4513,null));};exports[_0x5bff('0xce')]=function(_0x3dff34,_0x18e73a,_0x40b41f){if(_0x3dff34[_0x5bff('0xc2')]['id']){delete _0x3dff34['body']['id'];}return db[_0x5bff('0x44')]['find']({'where':{'id':_0x3dff34[_0x5bff('0xc3')]['id']}})['then'](function(_0x14e2ce){if(!_0x14e2ce){logger[_0x5bff('0x28')](_0x5bff('0xcf'),_0x5bff('0xce'),0x194,_0x5bff('0xd0'));_0x18e73a['sendStatus'](0x194);}else{if(_0x14e2ce[_0x5bff('0x7c')]){throw new db[(_0x5bff('0x1e'))][(_0x5bff('0x1f'))]('Interaction\x20already\x20assigned');}}return _0x14e2ce;})[_0x5bff('0x21')](function(_0x3515e8){if(_0x3515e8){return _0x3515e8[_0x5bff('0x35')]({'closed':_0x3dff34[_0x5bff('0xc2')][_0x5bff('0xd1')],'disposition':_0x3dff34[_0x5bff('0xc2')]['disposition']})['then'](function(_0xb88dd1){return _0xb88dd1;});}})['then'](function(_0x433745){return respondWithRpcPromise('AbandonInteraction',_0x5bff('0xce'),_0x3dff34['body'],client9004);})[_0x5bff('0x21')](respondWithResult(_0x18e73a,null))[_0x5bff('0x2b')](handleError(_0x18e73a,null));};exports['attachmentUpload']=function(_0x4e5717,_0x45ce61,_0x427421){_0x4e5717[_0x5bff('0xc2')][_0x5bff('0x39')]=_0x4e5717[_0x5bff('0xd2')][_0x5bff('0xd3')];_0x4e5717[_0x5bff('0xc2')][_0x5bff('0xd4')]=_0x4e5717[_0x5bff('0xd2')][_0x5bff('0xd5')];_0x4e5717[_0x5bff('0xc2')][_0x5bff('0x46')]=_0x4e5717[_0x5bff('0xd2')][_0x5bff('0xd6')];return db[_0x5bff('0xd7')][_0x5bff('0xc1')](_0x4e5717['body'])[_0x5bff('0x21')](respondWithResult(_0x45ce61,0xc9))[_0x5bff('0x2b')](handleError(_0x45ce61,null));};exports['attachmentDownload']=function(_0x983fca,_0x25242c,_0x4c7489){return db['ChatInteraction']['findOne']({'where':{'id':_0x983fca[_0x5bff('0xc3')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x25242c,null))[_0x5bff('0x21')](function(_0x54e12f){if(_0x54e12f){if(_0x54e12f[_0x5bff('0xd1')]){return _0x25242c[_0x5bff('0x2c')](0x193)[_0x5bff('0x2d')]({'status':0x193,'message':_0x5bff('0xd8')});}return db[_0x5bff('0xd7')]['findOne']({'where':{'id':_0x983fca[_0x5bff('0x48')][_0x5bff('0xd9')]},'raw':!![]})['then'](handleEntityNotFound(_0x25242c,null));}})[_0x5bff('0x21')](function(_0xe44bfb){if(_0xe44bfb){return _0x25242c['download'](path[_0x5bff('0xda')](config['root'],_0x5bff('0xdb'),_0xe44bfb[_0x5bff('0xd4')]));}})[_0x5bff('0x2b')](handleError(_0x25242c,null));};exports[_0x5bff('0xdc')]=function(_0x42ad65,_0x4c0677){var _0x186b14=null;var _0x232714=null;var _0x2f7714=null;var _0x1bd2ff=null;if(_0x42ad65['body']['id']){delete _0x42ad65['body']['id'];}if(_0x42ad65[_0x5bff('0xc2')]['mailTranscript']){_0x1bd2ff=path['join'](config[_0x5bff('0xdd')],'server/files/chat/upload/',util[_0x5bff('0xde')](_0x5bff('0xdf'),Date[_0x5bff('0xe0')]()));_0x42ad65[_0x5bff('0xc2')]['pathTranscript']=_0x1bd2ff;}return db[_0x5bff('0x44')][_0x5bff('0x6a')]({'where':{'id':_0x42ad65['params']['id']},'include':[{'model':db[_0x5bff('0xe1')],'as':'Messages','include':[{'model':db[_0x5bff('0x7b')],'as':_0x5bff('0x7b')}]}]})[_0x5bff('0x21')](handleEntityNotFound(_0x4c0677,null))[_0x5bff('0x21')](saveUpdates(_0x42ad65[_0x5bff('0xc2')],null))[_0x5bff('0x21')](function(_0x17f279){if(_0x17f279){_0x186b14=_0x17f279;return db[_0x5bff('0xc5')][_0x5bff('0x6a')]({'where':{'id':_0x186b14['ChatWebsiteId']}});}})[_0x5bff('0x21')](function(_0x7848b0){if(_0x7848b0){_0x2f7714=_0x7848b0;return db[_0x5bff('0xe2')][_0x5bff('0x6a')]({'where':{'id':_0x186b14[_0x5bff('0x76')]}});}})[_0x5bff('0x21')](function(_0x1f1e73){if(_0x1f1e73){_0x232714=_0x1f1e73;if(_0x1bd2ff){var _0xe4eb98=null;for(var _0x497727=0x1;_0x497727<_0x186b14[_0x5bff('0xe3')][_0x5bff('0x72')];++_0x497727){_0xe4eb98=_0x186b14['Messages'][_0x497727];var _0x4a66e5=_0xe4eb98[_0x5bff('0x7c')]?util['format'](_0x5bff('0xe4'),_0x2f7714['agentAlias'],_0xe4eb98[_0x5bff('0x7c')]):_0x5bff('0xe5');var _0x3f6d3e=_0x42ad65['body'][_0x5bff('0xe6')]||util[_0x5bff('0xde')]('%s%d',_0x5bff('0xe7'),_0xe4eb98['ContactId']);switch(_0x2f7714[_0x5bff('0xe8')]){case _0x5bff('0xe9'):_0x4a66e5=_0xe4eb98[_0x5bff('0x7c')]?util[_0x5bff('0xde')](_0x5bff('0xe4'),_0x2f7714[_0x5bff('0xea')],_0xe4eb98['UserId']):_0x5bff('0xe5');break;case _0x5bff('0xeb'):_0x4a66e5=_0xe4eb98['UserId']?_0xe4eb98[_0x5bff('0x7b')][_0x5bff('0xec')]||_0xe4eb98[_0x5bff('0x7b')][_0x5bff('0x3c')]:'System';break;case _0x5bff('0xed'):_0x4a66e5=_0xe4eb98[_0x5bff('0x7c')]?_0xe4eb98[_0x5bff('0x7b')]['fullname']:'System';break;default:_0x4a66e5=_0xe4eb98[_0x5bff('0x7c')]?util[_0x5bff('0xde')]('%s%d',_0x2f7714[_0x5bff('0xea')],_0xe4eb98[_0x5bff('0x7c')]):_0x5bff('0xe5');}var _0x5ca677=util[_0x5bff('0xde')](_0x5bff('0xee'),moment(_0xe4eb98[_0x5bff('0x84')])[_0x5bff('0xde')](_0x5bff('0xef')),_0xe4eb98[_0x5bff('0xf0')]==='in'?_0x3f6d3e:_0x4a66e5,_0xe4eb98['body']);if(!_0xe4eb98[_0x5bff('0xf1')]){fs['appendFileSync'](_0x1bd2ff,_0x5ca677);}}return db[_0x5bff('0xf2')][_0x5bff('0xf3')]({'where':{'service':!![]},'include':[{'model':db[_0x5bff('0xf4')],'as':_0x5bff('0xf5'),'raw':!![]}]});}}})['then'](function(_0x5c82ae){if(_0x5c82ae&&_0x5c82ae[_0x5bff('0xf5')]&&_0x42ad65[_0x5bff('0xc2')]){var _0x54aaeb={'tls':{'rejectUnauthorized':![]}};if(_0x5c82ae[_0x5bff('0xf5')][_0x5bff('0xf6')]){_0x54aaeb[_0x5bff('0xf6')]=_0x5c82ae[_0x5bff('0xf5')][_0x5bff('0xf6')];}else{_0x54aaeb[_0x5bff('0xf7')]=_0x5c82ae['Smtp']['host'];_0x54aaeb['port']=_0x5c82ae['Smtp'][_0x5bff('0xf8')];_0x54aaeb[_0x5bff('0xf9')]=_0x5c82ae[_0x5bff('0xf5')][_0x5bff('0xf9')];}if(_0x5c82ae[_0x5bff('0xf5')][_0x5bff('0xfa')]){_0x54aaeb['auth']={'user':_0x5c82ae[_0x5bff('0xf5')][_0x5bff('0x9f')],'pass':_0x5c82ae[_0x5bff('0xf5')][_0x5bff('0xfb')]};}return respondWithRpcPromise(_0x5bff('0xfc'),_0x5bff('0xfd'),{'account':_0x54aaeb,'message':{'from':util[_0x5bff('0xde')]('\x22%s\x22\x20<%s>',_0x5c82ae[_0x5bff('0x39')],_0x5c82ae[_0x5bff('0xfe')]||_0x5c82ae['Smtp']['user']),'to':_0x42ad65[_0x5bff('0xc2')][_0x5bff('0xff')],'subject':'Mail\x20Transcript','text':util[_0x5bff('0xde')](_0x5bff('0x100'),_0x42ad65[_0x5bff('0xc2')][_0x5bff('0xff')]),'attachments':[{'path':_0x1bd2ff}]}})[_0x5bff('0x21')](function(){return _0x186b14;})[_0x5bff('0x2b')](function(_0x5d9524){console['error'](_0x5d9524);});}else{return _0x186b14;}})[_0x5bff('0x21')](respondWithStatusCode(_0x4c0677,0xc8))[_0x5bff('0x2b')](handleError(_0x4c0677,null));};exports[_0x5bff('0x101')]=function(_0x354d8d,_0x4afaed,_0x3b18fc){return db['ChatMessage'][_0x5bff('0x6a')]({'where':{'id':_0x354d8d[_0x5bff('0xc3')]['id']}})[_0x5bff('0x21')](handleEntityNotFound(_0x4afaed,null))[_0x5bff('0x21')](function(_0x43ba2a){if(_0x43ba2a){return _0x43ba2a[_0x5bff('0x101')](_0x354d8d[_0x5bff('0xc2')][_0x5bff('0x102')],_[_0x5bff('0x103')](_0x354d8d[_0x5bff('0xc2')],[_0x5bff('0x102'),'id'])||{});}})['then'](respondWithResult(_0x4afaed,null))['catch'](handleError(_0x4afaed,null));};exports[_0x5bff('0x104')]=function(_0x4e8a7b,_0x3fc781,_0xfbb251){var _0xd8b197={'raw':![],'where':{}};var _0x19be7b={};var _0x4fa4fb={'count':0x0,'rows':[]};return db[_0x5bff('0x44')][_0x5bff('0xf3')]({'where':{'id':_0x4e8a7b['params']['id']}})['then'](handleEntityNotFound(_0x3fc781,null))[_0x5bff('0x21')](function(_0x31df77){if(_0x31df77){_0x19be7b[_0x5bff('0x47')]=_['keys'](db[_0x5bff('0xe1')][_0x5bff('0xbc')]);_0x19be7b[_0x5bff('0x48')]=_[_0x5bff('0x7d')](_0x4e8a7b[_0x5bff('0x48')]);_0x19be7b[_0x5bff('0x50')]=_[_0x5bff('0x49')](_0x19be7b[_0x5bff('0x47')],_0x19be7b[_0x5bff('0x48')]);_0xd8b197[_0x5bff('0x4b')]=_['intersection'](_0x19be7b[_0x5bff('0x47')],qs[_0x5bff('0x4a')](_0x4e8a7b[_0x5bff('0x48')]['fields']));_0xd8b197[_0x5bff('0x4b')]=_0xd8b197[_0x5bff('0x4b')][_0x5bff('0x72')]?_0xd8b197[_0x5bff('0x4b')]:_0x19be7b[_0x5bff('0x47')];if(!_0x4e8a7b['query'][_0x5bff('0x4c')](_0x5bff('0x4d'))){_0xd8b197['limit']=qs[_0x5bff('0x30')](_0x4e8a7b[_0x5bff('0x48')][_0x5bff('0x30')]);_0xd8b197[_0x5bff('0x2f')]=qs['offset'](_0x4e8a7b[_0x5bff('0x48')][_0x5bff('0x2f')]);}_0xd8b197[_0x5bff('0x9b')]=qs['sort'](_0x4e8a7b['query'][_0x5bff('0x4e')]);_0xd8b197['where']=qs[_0x5bff('0x50')](_['pick'](_0x4e8a7b[_0x5bff('0x48')],_0x19be7b[_0x5bff('0x50')]));_0xd8b197[_0x5bff('0x4f')][_0x5bff('0xbb')]=_0x31df77['id'];if(_0x4e8a7b[_0x5bff('0x48')][_0x5bff('0x8f')]){_0xd8b197[_0x5bff('0x4f')]=_[_0x5bff('0xbf')](_0xd8b197[_0x5bff('0x4f')],{'$or':_[_0x5bff('0x43')](_0xd8b197[_0x5bff('0x4b')],function(_0xbac61b){var _0x170444={};_0x170444[_0xbac61b]={'$like':'%'+_0x4e8a7b[_0x5bff('0x48')][_0x5bff('0x8f')]+'%'};return _0x170444;})});}if(_0x4e8a7b[_0x5bff('0x48')]['$gte']){var _0x4671b0=_0x4e8a7b[_0x5bff('0x48')][_0x5bff('0x86')][_0x5bff('0x3f')](',');var _0x29f8d5={};_0x29f8d5[_0x4671b0[0x0]]={'$gte':moment(_0x4671b0[0x1])[_0x5bff('0xde')](_0x5bff('0x105'))};_0xd8b197['where']=_[_0x5bff('0xbf')](_0xd8b197[_0x5bff('0x4f')],_0x29f8d5);}_0xd8b197=_[_0x5bff('0xbf')]({},_0xd8b197,_0x4e8a7b['options']);return db[_0x5bff('0xe1')]['count']({'where':_0xd8b197[_0x5bff('0x4f')]})[_0x5bff('0x21')](function(_0x45f642){_0x4fa4fb[_0x5bff('0x2e')]=_0x45f642;if(_0x4e8a7b[_0x5bff('0x48')][_0x5bff('0xbd')]){_0xd8b197[_0x5bff('0xbe')]=[{'all':!![]}];}return db[_0x5bff('0xe1')][_0x5bff('0x106')](_0xd8b197);})['then'](function(_0x54051f){_0x4fa4fb[_0x5bff('0x107')]=_0x54051f;return _0x4fa4fb;});}})[_0x5bff('0x21')](respondWithFilteredResult(_0x3fc781,_0xd8b197))['catch'](handleError(_0x3fc781,null));};exports[_0x5bff('0x108')]=function(_0x3b700a,_0x2af5a9,_0xd2d093){var _0x108b68={'where':{}},_0x15bf3f={},_0x26843c={'count':0x0,'rows':[]};return db[_0x5bff('0x44')][_0x5bff('0xf3')]({'where':{'id':_0x3b700a['params']['id']}})[_0x5bff('0x21')](handleEntityNotFound(_0x2af5a9,null))[_0x5bff('0x21')](function(_0x53d4df){if(_0x53d4df){_0x15bf3f['model']=_['keys'](db[_0x5bff('0xe1')][_0x5bff('0xbc')]);_0x15bf3f['query']=_[_0x5bff('0x7d')](_0x3b700a[_0x5bff('0x48')]);_0x15bf3f[_0x5bff('0x50')]=_['intersection'](_0x15bf3f[_0x5bff('0x47')],_0x15bf3f['query']);_0x108b68[_0x5bff('0x4b')]=_[_0x5bff('0x49')](_0x15bf3f[_0x5bff('0x47')],qs['fields'](_0x3b700a[_0x5bff('0x48')]['fields']));_0x108b68[_0x5bff('0x4b')]=_0x108b68['attributes'][_0x5bff('0x72')]?_0x108b68[_0x5bff('0x4b')]:_0x15bf3f[_0x5bff('0x47')];if(!_0x3b700a['query']['hasOwnProperty'](_0x5bff('0x4d'))){_0x108b68['limit']=qs[_0x5bff('0x30')](_0x3b700a[_0x5bff('0x48')][_0x5bff('0x30')]);_0x108b68['offset']=qs[_0x5bff('0x2f')](_0x3b700a[_0x5bff('0x48')][_0x5bff('0x2f')]);}_0x108b68[_0x5bff('0x9b')]=qs[_0x5bff('0x4e')](_0x3b700a['query'][_0x5bff('0x4e')]);_0x108b68[_0x5bff('0x4f')]=qs[_0x5bff('0x50')](_[_0x5bff('0x51')](_0x3b700a['query'],_0x15bf3f['filters']));_0x108b68[_0x5bff('0x4f')][_0x5bff('0xbb')]=_0x53d4df['id'];if(_0x3b700a[_0x5bff('0x48')][_0x5bff('0x8f')]){_0x108b68['where']=_[_0x5bff('0xbf')](_0x108b68[_0x5bff('0x4f')],{'$or':_[_0x5bff('0x43')](_0x108b68['attributes'],function(_0x28d5a7){var _0x23dc13={};_0x23dc13[_0x28d5a7]={'$like':'%'+_0x3b700a['query'][_0x5bff('0x8f')]+'%'};return _0x23dc13;})});}_0x108b68['where'][_0x5bff('0xf1')]=![];if(_0x3b700a[_0x5bff('0x48')]['id']){_0x108b68['where']['id']={'$gt':_0x3b700a[_0x5bff('0x48')]['id']};}_0x108b68=_[_0x5bff('0xbf')]({},_0x108b68,_0x3b700a[_0x5bff('0xc0')]);return db[_0x5bff('0xe1')][_0x5bff('0x2e')]({'where':_0x108b68[_0x5bff('0x4f')]})[_0x5bff('0x21')](function(_0x1c4d21){_0x26843c[_0x5bff('0x2e')]=_0x1c4d21;_0x108b68[_0x5bff('0xbe')]=[];if(_0x3b700a[_0x5bff('0x48')][_0x5bff('0x109')]){_0x108b68['include'][_0x5bff('0x41')]({'model':db[_0x5bff('0x7b')],'as':_0x5bff('0x7b'),'attributes':['id',_0x5bff('0x3c'),_0x5bff('0xec')]});}if(_0x3b700a['query'][_0x5bff('0xbd')]){_0x108b68[_0x5bff('0xbe')]=[{'all':!![]}];}return db[_0x5bff('0xe1')]['findAll'](_0x108b68);})['then'](function(_0xb51e72){_0x26843c[_0x5bff('0x107')]=_0xb51e72;return _0x26843c;});}})[_0x5bff('0x21')](respondWithFilteredResult(_0x2af5a9,_0x108b68))[_0x5bff('0x2b')](handleError(_0x2af5a9,null));};exports[_0x5bff('0x10a')]=function(_0x34e008,_0xcb8662,_0x255485){return db[_0x5bff('0x44')][_0x5bff('0x6a')]({'where':{'id':_0x34e008[_0x5bff('0xc3')]['id']}})[_0x5bff('0x21')](handleEntityNotFound(_0xcb8662,null))['then'](function(_0x21db1f){if(_0x21db1f){return _0x21db1f[_0x5bff('0x10b')](_0x34e008[_0x5bff('0xc2')][_0x5bff('0x102')],_[_0x5bff('0x103')](_0x34e008[_0x5bff('0xc2')],[_0x5bff('0x102'),'id'])||{})[_0x5bff('0x10c')](function(){return db[_0x5bff('0x10d')][_0x5bff('0x106')]({'attributes':['id',_0x5bff('0x39'),'color'],'where':{'id':_0x34e008[_0x5bff('0xc2')]['ids']}});})[_0x5bff('0x21')](function(_0x335fa7){socket[_0x5bff('0x10e')](_0x5bff('0x10f'),{'id':Number(_0x34e008[_0x5bff('0xc3')]['id']),'tags':_0x335fa7||[]});return{'id':Number(_0x34e008[_0x5bff('0xc3')]['id']),'tags':_0x335fa7||[]};});}})['then'](respondWithResult(_0xcb8662,null))['catch'](handleError(_0xcb8662,null));};exports[_0x5bff('0x110')]=function(_0x1efdf4,_0x385998,_0x1c5027){return db[_0x5bff('0x44')][_0x5bff('0x6a')]({'where':{'id':_0x1efdf4['params']['id']}})[_0x5bff('0x21')](handleEntityNotFound(_0x385998,null))[_0x5bff('0x21')](function(_0xc8ec17){if(_0xc8ec17){return _0xc8ec17[_0x5bff('0x110')](_0x1efdf4['query'][_0x5bff('0x102')]);}})[_0x5bff('0x21')](respondWithStatusCode(_0x385998,null))['catch'](handleError(_0x385998,null));};exports[_0x5bff('0x111')]=function(_0x4b41a3,_0x4127b9){var _0x1e6c87=moment()[_0x5bff('0x112')]()[_0x5bff('0xa3')]();var _0x40e3a8=path[_0x5bff('0xda')](config[_0x5bff('0xdd')],'server',_0x5bff('0x113'),_0x5bff('0x114'));var _0x2a8bb5=path[_0x5bff('0xda')](config['root'],_0x5bff('0x115'),_0x5bff('0x113'),_0x5bff('0x116'));var _0x4e11ae=path[_0x5bff('0xda')](_0x40e3a8,_0x1e6c87);var _0x3a0716=util[_0x5bff('0xde')](_0x5bff('0x117'),_0x4b41a3['params']['id'],_0x1e6c87);var _0x5ac27e=path['join'](_0x40e3a8,_0x3a0716);var _0x68b387=[];_0x68b387['push']({'model':db['User'],'as':_0x5bff('0x7b'),'attributes':['id','fullname'],'raw':!![]});_0x68b387[_0x5bff('0x41')]({'model':db[_0x5bff('0xe2')],'as':_0x5bff('0x6f'),'attributes':['id',_0x5bff('0x118'),_0x5bff('0x119')],'raw':!![]});if(_0x4b41a3[_0x5bff('0x48')][_0x5bff('0x116')]){_0x68b387[_0x5bff('0x41')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x1e6855=[{'model':db[_0x5bff('0xe1')],'as':'Messages','attributes':['id',_0x5bff('0xc2'),_0x5bff('0x84'),_0x5bff('0xf0'),_0x5bff('0xf1'),_0x5bff('0x8b')],'include':_0x68b387}];_0x1e6855[_0x5bff('0x41')]({'model':db[_0x5bff('0xc5')],'as':_0x5bff('0x11a'),'attributes':['id',_0x5bff('0x39')]});_0x1e6855[_0x5bff('0x41')]({'model':db[_0x5bff('0x7b')],'as':'Owner','attributes':['id',_0x5bff('0x3c')]});return db[_0x5bff('0x44')][_0x5bff('0x6a')]({'where':{'id':_0x4b41a3['params']['id']},'include':_0x1e6855})[_0x5bff('0x21')](handleEntityNotFound(_0x4127b9,null))['then'](function(_0x5575bf){if(_0x5575bf){var _0x414dbd=_0x5575bf[_0x5bff('0x11b')]({'plain':!![]});fs[_0x5bff('0x11c')](_0x4e11ae);var _0x43aa58={'format':'A4','border':'10px','header':{'height':_0x5bff('0x11d'),'contents':{'first':_0x5bff('0x11e')}},'footer':{'height':'30px','contents':{'default':util[_0x5bff('0xde')](_0x5bff('0x11f'),util[_0x5bff('0xde')](_0x5bff('0x120'),_0x5bff('0x121'),_0x414dbd['id']),moment()[_0x5bff('0xde')](_0x5bff('0x122'))[_0x5bff('0xa3')]())}}};var _0x40de1e={'channel':_0x5bff('0x121'),'account':_0x414dbd[_0x5bff('0x11a')][_0x5bff('0x39')],'agent':_0x414dbd[_0x5bff('0x123')]?_0x414dbd[_0x5bff('0x123')][_0x5bff('0x3c')]:_0x5bff('0x124'),'createdAt':moment(_0x414dbd[_0x5bff('0x84')])[_0x5bff('0xde')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5bff('0xa3')](),'closedAt':_0x414dbd[_0x5bff('0xd1')]?moment(_0x414dbd['closedAt'])[_0x5bff('0xde')](_0x5bff('0x105'))[_0x5bff('0xa3')]():'','disposition':_0x414dbd['disposition'],'chatInfo':{'browser':_0x414dbd['browserName'],'os':_0x414dbd[_0x5bff('0x125')],'referer':_0x414dbd[_0x5bff('0x126')],'customerIp':_0x414dbd[_0x5bff('0x127')],'customerPort':_0x414dbd[_0x5bff('0x128')]?_0x414dbd[_0x5bff('0x128')]:'N.A.'},'messages':_(_0x414dbd[_0x5bff('0xe3')])[_0x5bff('0x129')]()[_0x5bff('0x8f')]({'secret':![]})[_0x5bff('0x43')](function(_0x47092d){if(_0x47092d[_0x5bff('0xd7')]){var _0x3ab58c=path[_0x5bff('0xda')](_0x2a8bb5,_0x47092d[_0x5bff('0xd7')][_0x5bff('0xd4')]);if(fs[_0x5bff('0x12a')](_0x3ab58c)){fs['createReadStream'](_0x3ab58c)[_0x5bff('0x12b')](fs[_0x5bff('0x12c')](path[_0x5bff('0xda')](_0x4e11ae,_0x47092d[_0x5bff('0xd7')][_0x5bff('0xd4')])));}}return{'date':moment(_0x47092d[_0x5bff('0x84')])[_0x5bff('0xde')](_0x5bff('0x105'))[_0x5bff('0xa3')](),'sender':_0x47092d[_0x5bff('0xf0')]===_0x5bff('0x12d')?_0x47092d[_0x5bff('0x7b')]?_0x47092d['User'][_0x5bff('0x3c')]:'System':_0x47092d['Contact']['firstName']+(_0x47092d['Contact'][_0x5bff('0x119')]?'\x20'+_0x47092d['Contact']['lastName']:''),'body':_0x47092d[_0x5bff('0xd7')]?_0x47092d[_0x5bff('0xd7')][_0x5bff('0xd4')]:_0x47092d[_0x5bff('0xc2')],'direction':_0x47092d[_0x5bff('0xf0')]==='out'?'A':'C','secret':_0x47092d[_0x5bff('0xf1')],'read':_0x47092d[_0x5bff('0x8b')],'attachment':_0x47092d[_0x5bff('0xd7')]};})['value']()};return ejs[_0x5bff('0x12e')](path['join'](config[_0x5bff('0xdd')],_0x5bff('0x115'),'views','downloadInteraction.html'),{'interaction':_0x40de1e})[_0x5bff('0x21')](function(_0x1eb2b2){return new BPromise(function(_0x19a022,_0x3fef8f){pdf['create'](_0x1eb2b2,_0x43aa58)['toFile'](path[_0x5bff('0xda')](_0x4e11ae,_0x5bff('0x12f')+_0x414dbd['id']+'-'+_0x1e6c87+_0x5bff('0x130')),function(_0x174a5f,_0xa1cfa){if(_0x174a5f)return _0x3fef8f(_0x174a5f);_0x19a022(_0xa1cfa);});});})[_0x5bff('0x21')](function(){return new BPromise(function(_0x5ebe5e,_0x3044cc){zipdir(_0x4e11ae,{'saveTo':_0x5ac27e},function(_0x323748,_0x15b492){if(_0x323748)return _0x3044cc(_0x323748);return _0x5ebe5e(_0x15b492);});})[_0x5bff('0x21')](function(){return new BPromise(function(_0xb9f1cd,_0x42e269){rimraf(_0x4e11ae,function(_0x36c54f){if(_0x36c54f)_0x42e269(_0x36c54f);return _0xb9f1cd();});});})[_0x5bff('0x21')](function(){return _0x4127b9[_0x5bff('0x111')](_0x5ac27e,_0x3a0716,function(_0xed8ee7){if(_0xed8ee7){console['log'](_0x5bff('0x131'),_0xed8ee7);}else{fs[_0x5bff('0x132')](_0x5ac27e);}});});});}else{return _0x4127b9[_0x5bff('0x37')](0xc8);}})[_0x5bff('0x2b')](handleError(_0x4127b9,null));}; \ No newline at end of file +var _0x7bd0=['ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','count','offset','set','Content-Range','apply','save','destroy','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','index','ChatInteraction','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.ChatInteractionId','users','u.id\x20=\x20ui.UserId','chat_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','find','ContactId','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','buildExpression','text','start','body','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','ChatWebsiteId','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','rows','show','params','include','options','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','https://api-vidaoo.xcally.com/api/v1/sessions','follow','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','create','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','disposition','file','originalname','basename','filename','mimetype','Attachment','closed','attachId','join','server/files/attachments/','mailTranscript','root','server/files/chat/upload/','format','now','pathTranscript','Messages','CmContact','%s%d','System','customer','Visitor','website_alias','agentAlias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','rawAttributes','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','includeAgent','includeAll','setTags','spread','emit','chatInteractionTags:save','removeTags','download','unix','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Account','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Chat','Owner','N.A.','closedAt','browserName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','client','http','test','Sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7bd0,0x111));var _0x07bd=function(_0x568a61,_0x2124f8){_0x568a61=_0x568a61-0x0;var _0x334c3b=_0x7bd0[_0x568a61];return _0x334c3b;};'use strict';var pdf=require(_0x07bd('0x0'));var emlformat=require(_0x07bd('0x1'));var rimraf=require(_0x07bd('0x2'));var zipdir=require(_0x07bd('0x3'));var jsonpatch=require(_0x07bd('0x4'));var rp=require(_0x07bd('0x5'));var moment=require(_0x07bd('0x6'));var BPromise=require(_0x07bd('0x7'));var Mustache=require('mustache');var util=require(_0x07bd('0x8'));var path=require(_0x07bd('0x9'));var sox=require(_0x07bd('0xa'));var csv=require(_0x07bd('0xb'));var ejs=require(_0x07bd('0xc'));var fs=require('fs');var _=require(_0x07bd('0xd'));var squel=require(_0x07bd('0xe'));var crypto=require('crypto');var jsforce=require(_0x07bd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x07bd('0xb'));var querystring=require(_0x07bd('0x10'));var Papa=require(_0x07bd('0x11'));var Redis=require('ioredis');var authService=require(_0x07bd('0x12'));var qs=require(_0x07bd('0x13'));var as=require(_0x07bd('0x14'));var hardwareService=require(_0x07bd('0x15'));var logger=require('../../config/logger')(_0x07bd('0x16'));var utils=require(_0x07bd('0x17'));var config=require(_0x07bd('0x18'));var db=require(_0x07bd('0x19'))['db'];config[_0x07bd('0x1a')]=_[_0x07bd('0x1b')](config[_0x07bd('0x1a')],{'host':_0x07bd('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x07bd('0x1d'))[_0x07bd('0x1e')](socket);var jayson=require(_0x07bd('0x1f'));var client=jayson[_0x07bd('0x20')][_0x07bd('0x21')]({'port':0x232b});var client9004=jayson[_0x07bd('0x20')][_0x07bd('0x21')]({'port':0x232c});function checkPasswordPattern(_0x49d962,_0x418444,_0x505839){if(_0x505839){var _0x229bf1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x229bf1[_0x07bd('0x22')](_0x418444)){return _0x49d962;}else{throw new db[(_0x07bd('0x23'))][(_0x07bd('0x24'))](_0x07bd('0x25'));}}else{return _0x49d962;}}function respondWithRpcPromise(_0x4929d6,_0x3f9f0b,_0xc4cf4c,_0x4948f4){return new BPromise(function(_0x3e8ec4,_0x72f775){var _0x758fd5=_0x4948f4||client;return _0x758fd5[_0x07bd('0x26')](_0x4929d6,_0xc4cf4c)[_0x07bd('0x27')](function(_0x109dbc){logger[_0x07bd('0x28')](_0x07bd('0x29'),_0x3f9f0b,_0x07bd('0x2a'));logger['debug'](_0x07bd('0x2b'),_0x3f9f0b,_0x07bd('0x2a'),JSON[_0x07bd('0x2c')](_0x109dbc));if(_0x109dbc[_0x07bd('0x2d')]){if(_0x109dbc[_0x07bd('0x2d')]['code']===0x1f4){logger['error'](_0x07bd('0x29'),_0x3f9f0b,_0x109dbc['error'][_0x07bd('0x2e')]);return _0x72f775(_0x109dbc['error']['message']);}logger[_0x07bd('0x2d')](_0x07bd('0x29'),_0x3f9f0b,_0x109dbc[_0x07bd('0x2d')][_0x07bd('0x2e')]);return _0x3e8ec4(_0x109dbc[_0x07bd('0x2d')][_0x07bd('0x2e')]);}else{logger['info'](_0x07bd('0x29'),_0x3f9f0b,_0x07bd('0x2a'));_0x3e8ec4(_0x109dbc[_0x07bd('0x2f')][_0x07bd('0x2e')]);}})[_0x07bd('0x30')](function(_0x1c1fda){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x3f9f0b,_0x1c1fda);_0x72f775(_0x1c1fda);});});}function respondWithStatusCode(_0x5184dc,_0x335d61){_0x335d61=_0x335d61||0xcc;return function(_0xfa7566){if(_0xfa7566){return _0x5184dc[_0x07bd('0x31')](_0x335d61);}return _0x5184dc['status'](_0x335d61)[_0x07bd('0x32')]();};}function respondWithResult(_0x400cc0,_0x253dc0){_0x253dc0=_0x253dc0||0xc8;return function(_0x46ed12){if(_0x46ed12){return _0x400cc0[_0x07bd('0x33')](_0x253dc0)[_0x07bd('0x34')](_0x46ed12);}};}function respondWithFilteredResult(_0x58f189,_0xfc836f){return function(_0x20cc94){if(_0x20cc94){var _0x4182b9=_0x20cc94[_0x07bd('0x35')],_0x321200=_0xfc836f[_0x07bd('0x36')],_0x1b6cc=_0xfc836f['offset']+_0xfc836f['limit'],_0x314bda;if(_0x1b6cc>=_0x4182b9){_0x1b6cc=_0x4182b9;_0x314bda=0xc8;}else{_0x314bda=0xce;}_0x58f189[_0x07bd('0x33')](_0x314bda);return _0x58f189[_0x07bd('0x37')](_0x07bd('0x38'),_0x321200+'-'+_0x1b6cc+'/'+_0x4182b9)['json'](_0x20cc94);}return null;};}function patchUpdates(_0x31316e){return function(_0x2c8612){try{jsonpatch[_0x07bd('0x39')](_0x2c8612,_0x31316e,!![]);}catch(_0x5eb6ca){return BPromise['reject'](_0x5eb6ca);}return _0x2c8612[_0x07bd('0x3a')]();};}function saveUpdates(_0x185783,_0x71c030){return function(_0x22ed79){if(_0x22ed79){return _0x22ed79['update'](_0x185783)[_0x07bd('0x27')](function(_0x3b1d78){return _0x3b1d78;});}return null;};}function removeEntity(_0x1d6653,_0x4d12df){return function(_0x278afb){if(_0x278afb){return _0x278afb[_0x07bd('0x3b')]()['then'](function(){_0x1d6653[_0x07bd('0x33')](0xcc)[_0x07bd('0x32')]();});}};}function handleEntityNotFound(_0x204eb7,_0x354546){return function(_0x5cde8d){if(!_0x5cde8d){_0x204eb7['sendStatus'](0x194);}return _0x5cde8d;};}function handleError(_0x290e0f,_0x4e5e51){_0x4e5e51=_0x4e5e51||0x1f4;return function(_0x3c2878){logger[_0x07bd('0x2d')](_0x3c2878[_0x07bd('0x3c')]);if(_0x3c2878[_0x07bd('0x3d')]){delete _0x3c2878[_0x07bd('0x3d')];}_0x290e0f[_0x07bd('0x33')](_0x4e5e51)[_0x07bd('0x3e')](_0x3c2878);};}function getInteractionUsers(_0x333ac2,_0x4957fc){return new BPromise(function(_0x27b563,_0x9d843b){try{if(_0x4957fc[_0x333ac2['id']]){_0x333ac2[_0x07bd('0x3f')]=_[_0x07bd('0x40')](_0x4957fc[_0x333ac2['id']],function(_0x51e8e2){return{'id':_0x51e8e2['id'],'fullname':_0x51e8e2[_0x07bd('0x41')]};});}}catch(_0x2799c6){_0x9d843b(_0x2799c6);}_0x27b563(_0x333ac2);});}function getInteractionTags(_0x220a8e,_0x3e38d7){return new BPromise(function(_0x5d1b84,_0x2d2b71){try{if(_0x220a8e[_0x07bd('0x42')]){_0x220a8e[_0x07bd('0x43')]=[];_0x220a8e[_0x07bd('0x42')][_0x07bd('0x44')](',')['forEach'](function(_0x56b964){_0x220a8e[_0x07bd('0x43')][_0x07bd('0x45')](_0x3e38d7[_0x56b964]);});}delete _0x220a8e[_0x07bd('0x42')];}catch(_0x3d8936){_0x2d2b71(_0x3d8936);}_0x5d1b84(_0x220a8e);});}function updateChatInteraction(_0x5ec192,_0x9f9c4c,_0x2e1dcf){return new BPromise(function(_0x3de7d3,_0x6cdf23){return getInteractionUsers(_0x5ec192,_0x2e1dcf)[_0x07bd('0x27')](function(_0x2a08e3){return getInteractionTags(_0x2a08e3,_0x9f9c4c);})[_0x07bd('0x27')](function(_0x52f749){_0x3de7d3(_0x52f749);})[_0x07bd('0x30')](function(_0x7b1042){_0x6cdf23(_0x7b1042);});});}exports[_0x07bd('0x46')]=function(_0x3a5827,_0x418f26){var _0x4d43b1={},_0x243490={},_0x41a5d2={'count':0x0,'rows':[]};var _0x324cfc=_[_0x07bd('0x40')](db[_0x07bd('0x47')]['rawAttributes'],function(_0x14d4d8){return{'name':_0x14d4d8[_0x07bd('0x48')],'type':_0x14d4d8[_0x07bd('0x49')][_0x07bd('0x4a')]};});_0x243490['model']=_['map'](_0x324cfc,_0x07bd('0x3d'));_0x243490[_0x07bd('0x4b')]=_[_0x07bd('0x4c')](_0x3a5827[_0x07bd('0x4b')]);_0x243490[_0x07bd('0x4d')]=_[_0x07bd('0x4e')](_0x243490[_0x07bd('0x4f')],_0x243490[_0x07bd('0x4b')]);_0x4d43b1[_0x07bd('0x50')]=_['intersection'](_0x243490['model'],qs[_0x07bd('0x51')](_0x3a5827[_0x07bd('0x4b')][_0x07bd('0x51')]));_0x4d43b1[_0x07bd('0x50')]=_0x4d43b1[_0x07bd('0x50')][_0x07bd('0x52')]?_0x4d43b1['attributes']:_0x243490[_0x07bd('0x4f')];if(!_0x3a5827[_0x07bd('0x4b')][_0x07bd('0x53')](_0x07bd('0x54'))){_0x4d43b1[_0x07bd('0x55')]=qs[_0x07bd('0x55')](_0x3a5827['query'][_0x07bd('0x55')]);_0x4d43b1[_0x07bd('0x36')]=qs[_0x07bd('0x36')](_0x3a5827[_0x07bd('0x4b')][_0x07bd('0x36')]);}_0x4d43b1[_0x07bd('0x56')]=qs[_0x07bd('0x57')](_0x3a5827[_0x07bd('0x4b')][_0x07bd('0x57')]);_0x4d43b1[_0x07bd('0x58')]=qs[_0x07bd('0x4d')](_[_0x07bd('0x59')](_0x3a5827['query'],_0x243490[_0x07bd('0x4d')]),_0x324cfc);var _0x6db109=[];var _0x41dbe7=squel['select']()['field']('id')[_0x07bd('0x5a')]('name')[_0x07bd('0x5a')](_0x07bd('0x5b'))[_0x07bd('0x5c')](_0x07bd('0x5d'));var _0x2a8167=squel[_0x07bd('0x5e')]()[_0x07bd('0x5a')](_0x07bd('0x5f'))['field'](_0x07bd('0x60'))[_0x07bd('0x5a')](_0x07bd('0x61'))['from']('user_has_chat_interactions','ui')['left_join'](_0x07bd('0x62'),'u',_0x07bd('0x63'));var _0x12eae6=squel['select']()[_0x07bd('0x5c')](_0x07bd('0x64'),'i')[_0x07bd('0x65')](_0x07bd('0x66'),'c',_0x07bd('0x67'))[_0x07bd('0x65')]('users','o','o.id\x20=\x20i.UserId')[_0x07bd('0x65')]('chat_websites','a','a.id\x20=\x20i.ChatWebsiteId')[_0x07bd('0x65')](_0x07bd('0x68'),'me',_0x07bd('0x69'))['left_join'](_0x07bd('0x6a'),'it',_0x07bd('0x6b'))[_0x07bd('0x65')](_0x07bd('0x5d'),'t',_0x07bd('0x6c'));var _0x1a6df7=squel[_0x07bd('0x6d')]();var _0x248d6f=[];var _0x27ff6b=squel['expr']();var _0x38a9ef;if(_0x3a5827['query'][_0x07bd('0x6e')]){_0x38a9ef=as[_0x07bd('0x6f')](_0x3a5827[_0x07bd('0x4b')]['search']);var _0xc1d8b2=_0x38a9ef['sqlOperator'];for(var _0xc4f963=0x0;_0xc4f963<_0x38a9ef[_0x07bd('0x70')][_0x07bd('0x52')];_0xc4f963++){var _0xdde48d=_0x38a9ef['conditions'][_0xc4f963];var _0x5dc6f6='i';var _0x135e4e=_['find'](_0x324cfc,[_0x07bd('0x3d'),_0xdde48d[_0x07bd('0x5a')]]);if(!_0x135e4e){switch(_0xdde48d[_0x07bd('0x5a')]){case _0x07bd('0x71'):if(_0xdde48d[_0x07bd('0x72')]==0x1){_0x12eae6[_0x07bd('0x73')]('`'+_0xdde48d['field']+_0x07bd('0x74'));}else{_0x12eae6[_0x07bd('0x73')]('`'+_0xdde48d[_0x07bd('0x5a')]+_0x07bd('0x75'));}break;case _0x07bd('0x76'):if(_0xdde48d['operator']===_0x07bd('0x77')){if(_0xdde48d[_0x07bd('0x72')][_0x07bd('0x44')]('\x20')['length']>0x1){_0x1a6df7[_0xc1d8b2](_0x07bd('0x78'),qs['getFullTextValue'](_0xdde48d[_0x07bd('0x72')]),null);}else{var _0x46a22c='%'+_0xdde48d['value']+'%';_0x1a6df7[_0xc1d8b2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x46a22c,_0x46a22c,_0x46a22c);}}else{_0x135e4e=_[_0x07bd('0x79')](_0x324cfc,[_0x07bd('0x3d'),_0x07bd('0x7a')]);_0xdde48d[_0x07bd('0x5a')]=_0x07bd('0x7a');_0x4b4264=as['buildExpression'](_0x5dc6f6,_0x135e4e[_0x07bd('0x49')],_0xdde48d);_0x1a6df7[_0xc1d8b2](_0x4b4264['text'],_0x4b4264[_0x07bd('0x72')]['start'],_0x4b4264[_0x07bd('0x72')]['end']);}break;case'Tag':var _0x3b3331=_0xdde48d[_0x07bd('0x72')][_0x07bd('0x44')](',')[_0x07bd('0x40')](function(_0x475039){return Number(_0x475039);});_0x3b3331[_0x07bd('0x7b')](function(_0x2045d9){_0x27ff6b['or'](_0x07bd('0x7c'),'%,'+_0x2045d9+',%');});_0x248d6f=_[_0x07bd('0x7d')](_0x248d6f,_0x3b3331);break;case _0x07bd('0x7e'):if(_0xdde48d['operator']===_0x07bd('0x77')){_0x1a6df7[_0xc1d8b2]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xdde48d[_0x07bd('0x72')]+'%',null);}else{_0x135e4e=_[_0x07bd('0x79')](_0x324cfc,[_0x07bd('0x3d'),'UserId']);_0xdde48d[_0x07bd('0x5a')]=_0x07bd('0x7f');_0x4b4264=as[_0x07bd('0x80')](_0x5dc6f6,_0x135e4e[_0x07bd('0x49')],_0xdde48d);_0x1a6df7[_0xc1d8b2](_0x4b4264[_0x07bd('0x81')],_0x4b4264[_0x07bd('0x72')][_0x07bd('0x82')],_0x4b4264['value'][_0x07bd('0x32')]);}break;case _0x07bd('0x83'):_0x4b4264=as[_0x07bd('0x80')]('me',null,_0xdde48d);_0x1a6df7[_0xc1d8b2](_0x4b4264['text'],_0x4b4264[_0x07bd('0x72')][_0x07bd('0x82')],_0x4b4264[_0x07bd('0x72')][_0x07bd('0x32')]);break;}}else{var _0x4b4264=as[_0x07bd('0x80')](_0x5dc6f6,_0x135e4e[_0x07bd('0x49')],_0xdde48d);_0x1a6df7[_0xc1d8b2](_0x4b4264[_0x07bd('0x81')],_0x4b4264[_0x07bd('0x72')]['start'],_0x4b4264[_0x07bd('0x72')]['end']);}}}else{var _0x2749c3=_(_0x3a5827[_0x07bd('0x4b')])[_0x07bd('0x4c')]()[_0x07bd('0x40')](function(_0x5be4ef){return _[_0x07bd('0x84')](_0x324cfc,[_0x07bd('0x3d'),_0x5be4ef])?_0x5be4ef:undefined;})[_0x07bd('0x85')]()[_0x07bd('0x72')]();if(!_[_0x07bd('0x86')](_0x2749c3)){_0x2749c3[_0x07bd('0x7b')](function(_0x2b3cbb){if(_0x2b3cbb==='ChatWebsiteId'){_0x12eae6[_0x07bd('0x58')](_0x07bd('0x87'),[][_0x07bd('0x88')](_0x3a5827[_0x07bd('0x4b')][_0x2b3cbb]));}else if(_0x2b3cbb===_0x07bd('0x89')){var _0x4d1c79=JSON[_0x07bd('0x8a')](_0x3a5827[_0x07bd('0x4b')][_0x2b3cbb])[_0x07bd('0x8b')];var _0x50aad3=JSON[_0x07bd('0x8a')](_0x3a5827[_0x07bd('0x4b')][_0x2b3cbb])[_0x07bd('0x8c')];_0x12eae6[_0x07bd('0x58')](_0x07bd('0x8d'),_0x4d1c79,_0x50aad3);}else{if(_0x3a5827['query'][_0x2b3cbb]==='null'){_0x12eae6[_0x07bd('0x58')]('i.'+_0x2b3cbb+_0x07bd('0x8e'));}else{_0x12eae6[_0x07bd('0x58')]('i.'+_0x2b3cbb+_0x07bd('0x8f'),_0x3a5827[_0x07bd('0x4b')][_0x2b3cbb]);}}});}if(_0x3a5827[_0x07bd('0x4b')][_0x07bd('0x90')]){if(_0x3a5827[_0x07bd('0x4b')][_0x07bd('0x90')]==0x1){_0x12eae6['having'](_0x07bd('0x91'));}else{_0x12eae6[_0x07bd('0x73')](_0x07bd('0x92'));}}if(_0x3a5827[_0x07bd('0x4b')][_0x07bd('0x93')]){_0x248d6f=_['isArray'](_0x3a5827[_0x07bd('0x4b')]['tag'])?_0x3a5827[_0x07bd('0x4b')][_0x07bd('0x93')]:new Array(_0x3a5827['query'][_0x07bd('0x93')]);_0x248d6f['forEach'](function(_0x4a79c6){_0x27ff6b['or'](_0x07bd('0x7c'),'%,'+_0x4a79c6+',%');});}if(_0x3a5827[_0x07bd('0x4b')][_0x07bd('0x94')]){var _0x30f02a=_0x3a5827[_0x07bd('0x4b')]['filter'][_0x07bd('0x95')]('\x5c','\x5c\x5c')[_0x07bd('0x95')]('\x27\x27',_0x07bd('0x96'));if(qs['isNumeric'](_0x30f02a)){_0x1a6df7['or'](_0x07bd('0x97'),_0x30f02a+'%');}else{_0x1a6df7['or'](_0x07bd('0x98'),qs['getFullTextValue'](_0x30f02a))['or'](_0x07bd('0x99'),_0x30f02a+'%');}}}_0x12eae6[_0x07bd('0x58')](_0x1a6df7);_0x12eae6['group'](_0x07bd('0x9a'));var _0x2c3b85={'type':db[_0x07bd('0x23')][_0x07bd('0x9b')][_0x07bd('0x9c')],'raw':!![]};var _0x3d1275=_0x12eae6[_0x07bd('0x9d')]();_0x3d1275[_0x07bd('0x5a')]('i.id');_0x3d1275[_0x07bd('0x5a')](_0x07bd('0x9e'),'unreadMessages');if(_0x4d43b1[_0x07bd('0x56')]){_0x4d43b1[_0x07bd('0x56')][_0x07bd('0x7b')](function(_0x7d85c2){_0x12eae6['order']('i.'+_0x7d85c2[0x0],_0x7d85c2[0x1]===_0x07bd('0x9f')?![]:!![]);});}if(!_[_0x07bd('0x86')](_0x248d6f)){_0x12eae6[_0x07bd('0x73')](_0x27ff6b);_0x3d1275[_0x07bd('0x58')]('t.id\x20IN\x20?',_0x248d6f);}BPromise[_0x07bd('0xa0')]()[_0x07bd('0x27')](function(){if(!_0x38a9ef){if(_0x3a5827[_0x07bd('0x4b')][_0x07bd('0xa1')]||_0x3a5827[_0x07bd('0x4b')][_0x07bd('0xa2')])return;_0x3d1275[_0x07bd('0x58')](_0x07bd('0xa3'));_0x12eae6[_0x07bd('0x58')](_0x07bd('0xa3'));return;}return _0x3a5827[_0x07bd('0xa4')][_0x07bd('0xa5')]({'attributes':['id'],'raw':!![]})[_0x07bd('0x27')](function(_0x3cd40c){if(_[_0x07bd('0x86')](_0x3cd40c)){_0x3d1275[_0x07bd('0x58')](_0x07bd('0xa6'));_0x12eae6[_0x07bd('0x58')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x3d1275[_0x07bd('0x58')](_0x07bd('0x87'),_[_0x07bd('0x40')](_0x3cd40c,'id'));_0x12eae6[_0x07bd('0x58')](_0x07bd('0x87'),_[_0x07bd('0x40')](_0x3cd40c,'id'));}});})[_0x07bd('0x27')](function(){db[_0x07bd('0xa7')][_0x07bd('0x4b')](_0x3d1275[_0x07bd('0xa8')](),_0x2c3b85)['then'](function(_0x289d10){_0x41a5d2[_0x07bd('0x35')]=_0x289d10[_0x07bd('0x52')];if(_0x41a5d2[_0x07bd('0x35')]===0x0)return[];return db[_0x07bd('0xa7')][_0x07bd('0x4b')](_0x41dbe7[_0x07bd('0xa8')](),_0x2c3b85)[_0x07bd('0x27')](function(_0x1b3c8b){_0x6db109=_[_0x07bd('0xa9')](_0x1b3c8b,'id');_0x2c3b85=_[_0x07bd('0xaa')](_0x2c3b85,{'model':db[_0x07bd('0x47')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3a5827[_0x07bd('0x4b')][_0x07bd('0x51')]){_0x4d43b1[_0x07bd('0x50')][_0x07bd('0x7b')](function(_0x28b036){_0x12eae6[_0x07bd('0x5a')]('i.'+_0x28b036);});}else{_0x12eae6[_0x07bd('0x5a')](_0x07bd('0x9e'),_0x07bd('0x71'));_0x12eae6[_0x07bd('0x5a')]('a.key',_0x07bd('0xab'));_0x12eae6[_0x07bd('0x5a')]('a.mandatoryDisposition',_0x07bd('0xac'));_0x12eae6['field'](_0x07bd('0xad'));_0x12eae6['field'](_0x07bd('0xae'),_0x07bd('0xaf'));_0x12eae6['field'](_0x07bd('0xb0'),_0x07bd('0xb1'));_0x12eae6['field'](_0x07bd('0xb2'),'Contact.email');_0x12eae6[_0x07bd('0x5a')](_0x07bd('0xb3'),_0x07bd('0xb4'));_0x12eae6[_0x07bd('0x5a')](_0x07bd('0xb5'),_0x07bd('0xb6'));_0x12eae6[_0x07bd('0x5a')]('c.fax','Contact.fax');_0x12eae6[_0x07bd('0x5a')](_0x07bd('0xb7'),_0x07bd('0xb8'));_0x12eae6[_0x07bd('0x5a')](_0x07bd('0xb9'),_0x07bd('0xba'));_0x12eae6['field'](_0x07bd('0xbb'),'TagIds');}if(_0x4d43b1[_0x07bd('0x55')])_0x12eae6['limit'](_0x4d43b1[_0x07bd('0x55')]);if(_0x4d43b1[_0x07bd('0x36')])_0x12eae6[_0x07bd('0x36')](_0x4d43b1[_0x07bd('0x36')]);return db[_0x07bd('0xa7')]['query'](_0x12eae6[_0x07bd('0xa8')](),_0x2c3b85);})[_0x07bd('0x27')](function(_0x145647){_0x2a8167[_0x07bd('0x58')](_0x07bd('0xbc'),_[_0x07bd('0x40')](_0x145647,'id'));return db[_0x07bd('0xa7')][_0x07bd('0x4b')](_0x2a8167[_0x07bd('0xa8')](),_0x2c3b85)['then'](function(_0x95eeb8){var _0x3ca8ed=_[_0x07bd('0xbd')](_0x95eeb8,'ChatInteractionId');var _0x234fb4=[];_0x145647[_0x07bd('0x7b')](function(_0xb0923c){_0x234fb4[_0x07bd('0x45')](updateChatInteraction(_0xb0923c,_0x6db109,_0x3ca8ed));});return BPromise['all'](_0x234fb4);});});})[_0x07bd('0x27')](function(_0x337d52){_0x41a5d2[_0x07bd('0xbe')]=_0x337d52;return _0x41a5d2;})[_0x07bd('0x27')](respondWithFilteredResult(_0x418f26,_0x4d43b1));})['catch'](handleError(_0x418f26,null));};exports[_0x07bd('0xbf')]=function(_0x3466cc,_0x12c7c2){var _0x4e1abc={'raw':![],'where':{'id':_0x3466cc[_0x07bd('0xc0')]['id']}},_0x1797d1={};_0x1797d1[_0x07bd('0x4f')]=_[_0x07bd('0x4c')](db['ChatInteraction']['rawAttributes']);_0x1797d1[_0x07bd('0x4b')]=_[_0x07bd('0x4c')](_0x3466cc[_0x07bd('0x4b')]);_0x1797d1[_0x07bd('0x4d')]=_[_0x07bd('0x4e')](_0x1797d1[_0x07bd('0x4f')],_0x1797d1[_0x07bd('0x4b')]);_0x4e1abc['attributes']=_['intersection'](_0x1797d1[_0x07bd('0x4f')],qs['fields'](_0x3466cc[_0x07bd('0x4b')][_0x07bd('0x51')]));_0x4e1abc['attributes']=_0x4e1abc[_0x07bd('0x50')][_0x07bd('0x52')]?_0x4e1abc[_0x07bd('0x50')]:_0x1797d1[_0x07bd('0x4f')];if(_0x3466cc['query']['includeAll']){_0x4e1abc[_0x07bd('0xc1')]=[{'all':!![]}];}_0x4e1abc=_[_0x07bd('0xaa')]({},_0x4e1abc,_0x3466cc[_0x07bd('0xc2')]);return db[_0x07bd('0x47')][_0x07bd('0x79')](_0x4e1abc)[_0x07bd('0x27')](handleEntityNotFound(_0x12c7c2,null))[_0x07bd('0x27')](respondWithResult(_0x12c7c2,null))[_0x07bd('0x30')](handleError(_0x12c7c2,null));};exports['create']=function(_0x3d7f09,_0x582d88){return db[_0x07bd('0x47')]['create'](_0x3d7f09[_0x07bd('0x83')],{})[_0x07bd('0x27')](respondWithResult(_0x582d88,0xc9))[_0x07bd('0x30')](handleError(_0x582d88,null));};exports['update']=function(_0x3be757,_0x1777f9){if(_0x3be757['body']['id']){delete _0x3be757[_0x07bd('0x83')]['id'];}return db[_0x07bd('0x47')][_0x07bd('0x79')]({'where':{'id':_0x3be757[_0x07bd('0xc0')]['id']}})['then'](handleEntityNotFound(_0x1777f9,null))[_0x07bd('0x27')](saveUpdates(_0x3be757[_0x07bd('0x83')],null))[_0x07bd('0x27')](respondWithResult(_0x1777f9,null))[_0x07bd('0x30')](handleError(_0x1777f9,null));};exports[_0x07bd('0x3b')]=function(_0x488daf,_0x18d46b){return db['ChatInteraction'][_0x07bd('0x79')]({'where':{'id':_0x488daf['params']['id']}})[_0x07bd('0x27')](handleEntityNotFound(_0x18d46b,null))[_0x07bd('0x27')](removeEntity(_0x18d46b,null))[_0x07bd('0x30')](handleError(_0x18d46b,null));};exports[_0x07bd('0xc3')]=function(_0x1ca64f,_0x5137ec){return db[_0x07bd('0x47')]['describe']()[_0x07bd('0x27')](respondWithResult(_0x5137ec,null))['catch'](handleError(_0x5137ec,null));};exports[_0x07bd('0xc4')]=function(_0x2e5df4,_0x7e6b24){var _0x3f37e8=_0x2e5df4[_0x07bd('0xc0')]['id'];var _0x5a6eea;var _0x34e9dc;var _0x7c54d5;return db[_0x07bd('0x47')][_0x07bd('0xc5')]({'where':{'id':_0x3f37e8}})[_0x07bd('0x27')](function(_0x394670){_0x5a6eea=_0x394670;return db['ChatWebsite'][_0x07bd('0xc5')]({'where':{'id':_0x394670['ChatWebsiteId']},'attributes':['id',_0x07bd('0xc6'),_0x07bd('0xc7')],'raw':!![]});})['then'](function(_0x4ca3e1){if(_0x4ca3e1&&_0x4ca3e1[_0x07bd('0xc6')]&&_0x4ca3e1[_0x07bd('0xc7')]){_0x34e9dc=_0x4ca3e1;var _0x5f4d04={'rejectUnauthorized':![],'method':'POST','uri':_0x07bd('0xc8'),'headers':{'X-APIKEY':_0x4ca3e1[_0x07bd('0xc6')]},'body':{'name':'MotionCWB:'+_0x3f37e8},'redirect':_0x07bd('0xc9'),'json':!![]};return rp(_0x5f4d04);}else{throw new db[(_0x07bd('0x23'))][(_0x07bd('0x24'))](_0x07bd('0xca'));}})['then'](function(_0x198e27){_0x7c54d5=_0x198e27;if(_0x7c54d5['id']){var _0x1a6fa6={'body':_0x7c54d5[_0x07bd('0xcb')],'ChatWebsiteId':_0x34e9dc['id'],'ChatInteractionId':_0x5a6eea['id'],'direction':_0x07bd('0xcc'),'UserId':_0x2e5df4['user']['id']};return db[_0x07bd('0xcd')][_0x07bd('0xce')](_0x1a6fa6,{});}else{throw new db[(_0x07bd('0x23'))][(_0x07bd('0x24'))](_0x07bd('0xcf'));}})[_0x07bd('0x27')](function(){return _0x5a6eea['updateAttributes']({'vidaooSessionId':_0x7c54d5['id']});})[_0x07bd('0x27')](respondWithResult(_0x7e6b24,null))[_0x07bd('0x30')](handleError(_0x7e6b24,null));};exports[_0x07bd('0xd0')]=function(_0x314211,_0x3da905){if(_0x314211[_0x07bd('0x83')]['id']){delete _0x314211[_0x07bd('0x83')]['id'];}return db['ChatInteraction'][_0x07bd('0x79')]({'where':{'id':_0x314211[_0x07bd('0xc0')]['id']}})[_0x07bd('0x27')](handleEntityNotFound(_0x3da905,null))['then'](saveUpdates(_0x314211[_0x07bd('0x83')],null))[_0x07bd('0x27')](respondWithResult(_0x3da905,null))[_0x07bd('0x30')](handleError(_0x3da905,null));};exports['abandon']=function(_0x433ded,_0xfec700,_0x6cad7e){if(_0x433ded[_0x07bd('0x83')]['id']){delete _0x433ded[_0x07bd('0x83')]['id'];}return db[_0x07bd('0x47')][_0x07bd('0x79')]({'where':{'id':_0x433ded[_0x07bd('0xc0')]['id']}})[_0x07bd('0x27')](function(_0x2c20a3){if(!_0x2c20a3){logger[_0x07bd('0x2d')](_0x07bd('0xd1'),_0x07bd('0xd2'),0x194,_0x07bd('0xd3'));_0xfec700['sendStatus'](0x194);}else{if(_0x2c20a3[_0x07bd('0x7f')]){throw new db['Sequelize']['ValidationError']('Interaction\x20already\x20assigned');}}return _0x2c20a3;})[_0x07bd('0x27')](function(_0x2beefe){if(_0x2beefe){return _0x2beefe['update']({'closed':_0x433ded[_0x07bd('0x83')]['closed'],'disposition':_0x433ded['body'][_0x07bd('0xd4')]})[_0x07bd('0x27')](function(_0x510b6e){return _0x510b6e;});}})[_0x07bd('0x27')](function(_0x519101){return respondWithRpcPromise('AbandonInteraction','abandon',_0x433ded[_0x07bd('0x83')],client9004);})['then'](respondWithResult(_0xfec700,null))[_0x07bd('0x30')](handleError(_0xfec700,null));};exports['attachmentUpload']=function(_0x5e39ff,_0x2bef09,_0x5558a7){_0x5e39ff[_0x07bd('0x83')][_0x07bd('0x3d')]=_0x5e39ff[_0x07bd('0xd5')][_0x07bd('0xd6')];_0x5e39ff[_0x07bd('0x83')][_0x07bd('0xd7')]=_0x5e39ff[_0x07bd('0xd5')][_0x07bd('0xd8')];_0x5e39ff['body']['type']=_0x5e39ff[_0x07bd('0xd5')][_0x07bd('0xd9')];return db[_0x07bd('0xda')]['create'](_0x5e39ff[_0x07bd('0x83')])[_0x07bd('0x27')](respondWithResult(_0x2bef09,0xc9))['catch'](handleError(_0x2bef09,null));};exports['attachmentDownload']=function(_0x4e26ca,_0x8695ca,_0x3133aa){return db[_0x07bd('0x47')]['findOne']({'where':{'id':_0x4e26ca['params']['id']},'raw':!![]})[_0x07bd('0x27')](handleEntityNotFound(_0x8695ca,null))['then'](function(_0x401076){if(_0x401076){if(_0x401076[_0x07bd('0xdb')]){return _0x8695ca['status'](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0x07bd('0xda')]['findOne']({'where':{'id':_0x4e26ca[_0x07bd('0x4b')][_0x07bd('0xdc')]},'raw':!![]})[_0x07bd('0x27')](handleEntityNotFound(_0x8695ca,null));}})[_0x07bd('0x27')](function(_0x55405e){if(_0x55405e){return _0x8695ca['download'](path[_0x07bd('0xdd')](config['root'],_0x07bd('0xde'),_0x55405e['basename']));}})[_0x07bd('0x30')](handleError(_0x8695ca,null));};exports['close']=function(_0x48263c,_0x91b210){var _0x303e33=null;var _0x53d9d0=null;var _0x382ebc=null;var _0x4f669c=null;if(_0x48263c['body']['id']){delete _0x48263c['body']['id'];}if(_0x48263c['body'][_0x07bd('0xdf')]){_0x4f669c=path[_0x07bd('0xdd')](config[_0x07bd('0xe0')],_0x07bd('0xe1'),util[_0x07bd('0xe2')]('transcript-%s.txt',Date[_0x07bd('0xe3')]()));_0x48263c[_0x07bd('0x83')][_0x07bd('0xe4')]=_0x4f669c;}return db[_0x07bd('0x47')][_0x07bd('0x79')]({'where':{'id':_0x48263c[_0x07bd('0xc0')]['id']},'include':[{'model':db['ChatMessage'],'as':_0x07bd('0xe5'),'include':[{'model':db[_0x07bd('0x7e')],'as':_0x07bd('0x7e')}]}]})[_0x07bd('0x27')](handleEntityNotFound(_0x91b210,null))[_0x07bd('0x27')](saveUpdates(_0x48263c[_0x07bd('0x83')],null))[_0x07bd('0x27')](function(_0x3084fe){if(_0x3084fe){_0x303e33=_0x3084fe;return db['ChatWebsite'][_0x07bd('0x79')]({'where':{'id':_0x303e33[_0x07bd('0xa1')]}});}})[_0x07bd('0x27')](function(_0x4884a8){if(_0x4884a8){_0x382ebc=_0x4884a8;return db[_0x07bd('0xe6')][_0x07bd('0x79')]({'where':{'id':_0x303e33[_0x07bd('0x7a')]}});}})[_0x07bd('0x27')](function(_0xda0a0d){if(_0xda0a0d){_0x53d9d0=_0xda0a0d;if(_0x4f669c){var _0x3206ce=null;for(var _0x45a5d7=0x1;_0x45a5d7<_0x303e33[_0x07bd('0xe5')][_0x07bd('0x52')];++_0x45a5d7){_0x3206ce=_0x303e33['Messages'][_0x45a5d7];var _0x5dceb4=_0x3206ce[_0x07bd('0x7f')]?util[_0x07bd('0xe2')](_0x07bd('0xe7'),_0x382ebc['agentAlias'],_0x3206ce['UserId']):_0x07bd('0xe8');var _0x4be9df=_0x48263c['body'][_0x07bd('0xe9')]||util[_0x07bd('0xe2')](_0x07bd('0xe7'),_0x07bd('0xea'),_0x3206ce['ContactId']);switch(_0x382ebc['agentIdentifier']){case _0x07bd('0xeb'):_0x5dceb4=_0x3206ce[_0x07bd('0x7f')]?util[_0x07bd('0xe2')](_0x07bd('0xe7'),_0x382ebc[_0x07bd('0xec')],_0x3206ce[_0x07bd('0x7f')]):_0x07bd('0xe8');break;case _0x07bd('0xed'):_0x5dceb4=_0x3206ce[_0x07bd('0x7f')]?_0x3206ce[_0x07bd('0x7e')][_0x07bd('0xee')]||_0x3206ce[_0x07bd('0x7e')]['fullname']:_0x07bd('0xe8');break;case'agent_fullname':_0x5dceb4=_0x3206ce['UserId']?_0x3206ce[_0x07bd('0x7e')][_0x07bd('0x41')]:'System';break;default:_0x5dceb4=_0x3206ce[_0x07bd('0x7f')]?util['format'](_0x07bd('0xe7'),_0x382ebc[_0x07bd('0xec')],_0x3206ce[_0x07bd('0x7f')]):_0x07bd('0xe8');}var _0x2f8086=util[_0x07bd('0xe2')](_0x07bd('0xef'),moment(_0x3206ce[_0x07bd('0x89')])[_0x07bd('0xe2')](_0x07bd('0xf0')),_0x3206ce[_0x07bd('0xf1')]==='in'?_0x4be9df:_0x5dceb4,_0x3206ce[_0x07bd('0x83')]);if(!_0x3206ce[_0x07bd('0xf2')]){fs['appendFileSync'](_0x4f669c,_0x2f8086);}}return db[_0x07bd('0xf3')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x07bd('0xf4')],'as':_0x07bd('0xf5'),'raw':!![]}]});}}})[_0x07bd('0x27')](function(_0x17262a){if(_0x17262a&&_0x17262a[_0x07bd('0xf5')]&&_0x48263c[_0x07bd('0x83')]){var _0x49ea11={'tls':{'rejectUnauthorized':![]}};if(_0x17262a[_0x07bd('0xf5')][_0x07bd('0xf6')]){_0x49ea11[_0x07bd('0xf6')]=_0x17262a[_0x07bd('0xf5')][_0x07bd('0xf6')];}else{_0x49ea11[_0x07bd('0xf7')]=_0x17262a['Smtp'][_0x07bd('0xf7')];_0x49ea11[_0x07bd('0xf8')]=_0x17262a['Smtp'][_0x07bd('0xf8')];_0x49ea11[_0x07bd('0xf9')]=_0x17262a[_0x07bd('0xf5')][_0x07bd('0xf9')];}if(_0x17262a['Smtp'][_0x07bd('0xfa')]){_0x49ea11[_0x07bd('0xfb')]={'user':_0x17262a['Smtp'][_0x07bd('0xa4')],'pass':_0x17262a[_0x07bd('0xf5')][_0x07bd('0xfc')]};}return respondWithRpcPromise(_0x07bd('0xfd'),_0x07bd('0xfe'),{'account':_0x49ea11,'message':{'from':util[_0x07bd('0xe2')](_0x07bd('0xff'),_0x17262a[_0x07bd('0x3d')],_0x17262a['email']||_0x17262a[_0x07bd('0xf5')][_0x07bd('0xa4')]),'to':_0x48263c[_0x07bd('0x83')]['mailTranscript'],'subject':_0x07bd('0x100'),'text':util[_0x07bd('0xe2')](_0x07bd('0x101'),_0x48263c[_0x07bd('0x83')]['mailTranscript']),'attachments':[{'path':_0x4f669c}]}})[_0x07bd('0x27')](function(){return _0x303e33;})[_0x07bd('0x30')](function(_0x3989f0){console[_0x07bd('0x2d')](_0x3989f0);});}else{return _0x303e33;}})[_0x07bd('0x27')](respondWithStatusCode(_0x91b210,0xc8))[_0x07bd('0x30')](handleError(_0x91b210,null));};exports[_0x07bd('0x102')]=function(_0x58b380,_0x17a4c4,_0x555142){return db['ChatMessage'][_0x07bd('0x79')]({'where':{'id':_0x58b380[_0x07bd('0xc0')]['id']}})[_0x07bd('0x27')](handleEntityNotFound(_0x17a4c4,null))['then'](function(_0x51caf9){if(_0x51caf9){return _0x51caf9['addMessage'](_0x58b380[_0x07bd('0x83')][_0x07bd('0x103')],_[_0x07bd('0x104')](_0x58b380['body'],[_0x07bd('0x103'),'id'])||{});}})[_0x07bd('0x27')](respondWithResult(_0x17a4c4,null))['catch'](handleError(_0x17a4c4,null));};exports[_0x07bd('0x105')]=function(_0x5415fb,_0x16217a,_0x59e629){var _0x3fbdc5={'raw':![],'where':{}};var _0x53a683={};var _0xd48416={'count':0x0,'rows':[]};return db[_0x07bd('0x47')][_0x07bd('0xc5')]({'where':{'id':_0x5415fb['params']['id']}})[_0x07bd('0x27')](handleEntityNotFound(_0x16217a,null))[_0x07bd('0x27')](function(_0x124ce6){if(_0x124ce6){_0x53a683[_0x07bd('0x4f')]=_[_0x07bd('0x4c')](db[_0x07bd('0xcd')][_0x07bd('0x106')]);_0x53a683[_0x07bd('0x4b')]=_[_0x07bd('0x4c')](_0x5415fb[_0x07bd('0x4b')]);_0x53a683['filters']=_[_0x07bd('0x4e')](_0x53a683[_0x07bd('0x4f')],_0x53a683[_0x07bd('0x4b')]);_0x3fbdc5[_0x07bd('0x50')]=_[_0x07bd('0x4e')](_0x53a683[_0x07bd('0x4f')],qs[_0x07bd('0x51')](_0x5415fb[_0x07bd('0x4b')][_0x07bd('0x51')]));_0x3fbdc5[_0x07bd('0x50')]=_0x3fbdc5[_0x07bd('0x50')]['length']?_0x3fbdc5['attributes']:_0x53a683[_0x07bd('0x4f')];if(!_0x5415fb[_0x07bd('0x4b')][_0x07bd('0x53')]('nolimit')){_0x3fbdc5['limit']=qs[_0x07bd('0x55')](_0x5415fb[_0x07bd('0x4b')][_0x07bd('0x55')]);_0x3fbdc5[_0x07bd('0x36')]=qs['offset'](_0x5415fb['query'][_0x07bd('0x36')]);}_0x3fbdc5[_0x07bd('0x56')]=qs[_0x07bd('0x57')](_0x5415fb[_0x07bd('0x4b')][_0x07bd('0x57')]);_0x3fbdc5[_0x07bd('0x58')]=qs['filters'](_['pick'](_0x5415fb['query'],_0x53a683[_0x07bd('0x4d')]));_0x3fbdc5[_0x07bd('0x58')][_0x07bd('0x107')]=_0x124ce6['id'];if(_0x5415fb['query'][_0x07bd('0x94')]){_0x3fbdc5['where']=_[_0x07bd('0xaa')](_0x3fbdc5[_0x07bd('0x58')],{'$or':_['map'](_0x3fbdc5[_0x07bd('0x50')],function(_0x16714a){var _0x3b41b7={};_0x3b41b7[_0x16714a]={'$like':'%'+_0x5415fb[_0x07bd('0x4b')][_0x07bd('0x94')]+'%'};return _0x3b41b7;})});}if(_0x5415fb[_0x07bd('0x4b')][_0x07bd('0x8b')]){var _0x109536=_0x5415fb[_0x07bd('0x4b')][_0x07bd('0x8b')]['split'](',');var _0x49b2d6={};_0x49b2d6[_0x109536[0x0]]={'$gte':moment(_0x109536[0x1])[_0x07bd('0xe2')](_0x07bd('0x108'))};_0x3fbdc5[_0x07bd('0x58')]=_[_0x07bd('0xaa')](_0x3fbdc5['where'],_0x49b2d6);}_0x3fbdc5=_[_0x07bd('0xaa')]({},_0x3fbdc5,_0x5415fb[_0x07bd('0xc2')]);return db[_0x07bd('0xcd')][_0x07bd('0x35')]({'where':_0x3fbdc5[_0x07bd('0x58')]})['then'](function(_0x3dd7df){_0xd48416[_0x07bd('0x35')]=_0x3dd7df;if(_0x5415fb[_0x07bd('0x4b')]['includeAll']){_0x3fbdc5['include']=[{'all':!![]}];}return db['ChatMessage'][_0x07bd('0x109')](_0x3fbdc5);})[_0x07bd('0x27')](function(_0x130188){_0xd48416[_0x07bd('0xbe')]=_0x130188;return _0xd48416;});}})[_0x07bd('0x27')](respondWithFilteredResult(_0x16217a,_0x3fbdc5))[_0x07bd('0x30')](handleError(_0x16217a,null));};exports['getMyMessages']=function(_0x3d3e16,_0x2cb7d5,_0x521183){var _0x338a8b={'where':{}},_0x47b90f={},_0x47c2ee={'count':0x0,'rows':[]};return db[_0x07bd('0x47')][_0x07bd('0xc5')]({'where':{'id':_0x3d3e16[_0x07bd('0xc0')]['id']}})['then'](handleEntityNotFound(_0x2cb7d5,null))[_0x07bd('0x27')](function(_0x3e5b03){if(_0x3e5b03){_0x47b90f['model']=_['keys'](db[_0x07bd('0xcd')][_0x07bd('0x106')]);_0x47b90f[_0x07bd('0x4b')]=_['keys'](_0x3d3e16[_0x07bd('0x4b')]);_0x47b90f[_0x07bd('0x4d')]=_['intersection'](_0x47b90f[_0x07bd('0x4f')],_0x47b90f['query']);_0x338a8b[_0x07bd('0x50')]=_['intersection'](_0x47b90f[_0x07bd('0x4f')],qs[_0x07bd('0x51')](_0x3d3e16[_0x07bd('0x4b')][_0x07bd('0x51')]));_0x338a8b['attributes']=_0x338a8b[_0x07bd('0x50')][_0x07bd('0x52')]?_0x338a8b[_0x07bd('0x50')]:_0x47b90f[_0x07bd('0x4f')];if(!_0x3d3e16[_0x07bd('0x4b')]['hasOwnProperty']('nolimit')){_0x338a8b[_0x07bd('0x55')]=qs[_0x07bd('0x55')](_0x3d3e16['query']['limit']);_0x338a8b['offset']=qs[_0x07bd('0x36')](_0x3d3e16[_0x07bd('0x4b')][_0x07bd('0x36')]);}_0x338a8b['order']=qs[_0x07bd('0x57')](_0x3d3e16[_0x07bd('0x4b')]['sort']);_0x338a8b[_0x07bd('0x58')]=qs[_0x07bd('0x4d')](_[_0x07bd('0x59')](_0x3d3e16['query'],_0x47b90f[_0x07bd('0x4d')]));_0x338a8b[_0x07bd('0x58')][_0x07bd('0x107')]=_0x3e5b03['id'];if(_0x3d3e16[_0x07bd('0x4b')][_0x07bd('0x94')]){_0x338a8b[_0x07bd('0x58')]=_['merge'](_0x338a8b['where'],{'$or':_[_0x07bd('0x40')](_0x338a8b[_0x07bd('0x50')],function(_0x44470e){var _0x1c18f6={};_0x1c18f6[_0x44470e]={'$like':'%'+_0x3d3e16[_0x07bd('0x4b')]['filter']+'%'};return _0x1c18f6;})});}_0x338a8b[_0x07bd('0x58')][_0x07bd('0xf2')]=![];if(_0x3d3e16['query']['id']){_0x338a8b[_0x07bd('0x58')]['id']={'$gt':_0x3d3e16['query']['id']};}_0x338a8b=_[_0x07bd('0xaa')]({},_0x338a8b,_0x3d3e16[_0x07bd('0xc2')]);return db[_0x07bd('0xcd')][_0x07bd('0x35')]({'where':_0x338a8b[_0x07bd('0x58')]})[_0x07bd('0x27')](function(_0x1e5acb){_0x47c2ee[_0x07bd('0x35')]=_0x1e5acb;_0x338a8b['include']=[];if(_0x3d3e16[_0x07bd('0x4b')][_0x07bd('0x10a')]){_0x338a8b[_0x07bd('0xc1')][_0x07bd('0x45')]({'model':db[_0x07bd('0x7e')],'as':_0x07bd('0x7e'),'attributes':['id','fullname',_0x07bd('0xee')]});}if(_0x3d3e16[_0x07bd('0x4b')][_0x07bd('0x10b')]){_0x338a8b[_0x07bd('0xc1')]=[{'all':!![]}];}return db[_0x07bd('0xcd')]['findAll'](_0x338a8b);})[_0x07bd('0x27')](function(_0x2e8391){_0x47c2ee[_0x07bd('0xbe')]=_0x2e8391;return _0x47c2ee;});}})[_0x07bd('0x27')](respondWithFilteredResult(_0x2cb7d5,_0x338a8b))['catch'](handleError(_0x2cb7d5,null));};exports['addTags']=function(_0x2723fc,_0x543735,_0x38fcdb){return db['ChatInteraction'][_0x07bd('0x79')]({'where':{'id':_0x2723fc[_0x07bd('0xc0')]['id']}})[_0x07bd('0x27')](handleEntityNotFound(_0x543735,null))[_0x07bd('0x27')](function(_0x517bd6){if(_0x517bd6){return _0x517bd6[_0x07bd('0x10c')](_0x2723fc[_0x07bd('0x83')][_0x07bd('0x103')],_[_0x07bd('0x104')](_0x2723fc[_0x07bd('0x83')],[_0x07bd('0x103'),'id'])||{})[_0x07bd('0x10d')](function(){return db['Tag'][_0x07bd('0x109')]({'attributes':['id',_0x07bd('0x3d'),_0x07bd('0x5b')],'where':{'id':_0x2723fc[_0x07bd('0x83')][_0x07bd('0x103')]}});})['then'](function(_0x11f77c){socket[_0x07bd('0x10e')](_0x07bd('0x10f'),{'id':Number(_0x2723fc[_0x07bd('0xc0')]['id']),'tags':_0x11f77c||[]});return{'id':Number(_0x2723fc[_0x07bd('0xc0')]['id']),'tags':_0x11f77c||[]};});}})['then'](respondWithResult(_0x543735,null))['catch'](handleError(_0x543735,null));};exports[_0x07bd('0x110')]=function(_0x309582,_0x3a1783,_0x1209b5){return db[_0x07bd('0x47')][_0x07bd('0x79')]({'where':{'id':_0x309582[_0x07bd('0xc0')]['id']}})[_0x07bd('0x27')](handleEntityNotFound(_0x3a1783,null))[_0x07bd('0x27')](function(_0x47975a){if(_0x47975a){return _0x47975a[_0x07bd('0x110')](_0x309582[_0x07bd('0x4b')]['ids']);}})[_0x07bd('0x27')](respondWithStatusCode(_0x3a1783,null))[_0x07bd('0x30')](handleError(_0x3a1783,null));};exports[_0x07bd('0x111')]=function(_0xcd654c,_0x1e06bb){var _0x144b56=moment()[_0x07bd('0x112')]()[_0x07bd('0xa8')]();var _0x575701=path[_0x07bd('0xdd')](config[_0x07bd('0xe0')],_0x07bd('0x113'),_0x07bd('0x114'),_0x07bd('0x115'));var _0x4432ac=path[_0x07bd('0xdd')](config[_0x07bd('0xe0')],'server','files',_0x07bd('0x116'));var _0x5d6a67=path[_0x07bd('0xdd')](_0x575701,_0x144b56);var _0x2cae5c=util[_0x07bd('0xe2')](_0x07bd('0x117'),_0xcd654c[_0x07bd('0xc0')]['id'],_0x144b56);var _0x8703d0=path['join'](_0x575701,_0x2cae5c);var _0x1639b9=[];_0x1639b9[_0x07bd('0x45')]({'model':db[_0x07bd('0x7e')],'as':'User','attributes':['id',_0x07bd('0x41')],'raw':!![]});_0x1639b9[_0x07bd('0x45')]({'model':db['CmContact'],'as':_0x07bd('0x76'),'attributes':['id',_0x07bd('0x118'),_0x07bd('0x119')],'raw':!![]});if(_0xcd654c[_0x07bd('0x4b')][_0x07bd('0x116')]){_0x1639b9[_0x07bd('0x45')]({'model':db['Attachment'],'as':_0x07bd('0xda'),'raw':!![]});}var _0x41cd5e=[{'model':db[_0x07bd('0xcd')],'as':_0x07bd('0xe5'),'attributes':['id',_0x07bd('0x83'),'createdAt',_0x07bd('0xf1'),_0x07bd('0xf2'),'read'],'include':_0x1639b9}];_0x41cd5e[_0x07bd('0x45')]({'model':db['ChatWebsite'],'as':_0x07bd('0x11a'),'attributes':['id',_0x07bd('0x3d')]});_0x41cd5e['push']({'model':db[_0x07bd('0x7e')],'as':'Owner','attributes':['id',_0x07bd('0x41')]});return db['ChatInteraction'][_0x07bd('0x79')]({'where':{'id':_0xcd654c[_0x07bd('0xc0')]['id']},'include':_0x41cd5e})[_0x07bd('0x27')](handleEntityNotFound(_0x1e06bb,null))[_0x07bd('0x27')](function(_0x1a1ead){if(_0x1a1ead){var _0x144514=_0x1a1ead['get']({'plain':!![]});fs['mkdirSync'](_0x5d6a67);var _0x335863={'format':'A4','border':_0x07bd('0x11b'),'header':{'height':_0x07bd('0x11c'),'contents':{'first':_0x07bd('0x11d')}},'footer':{'height':_0x07bd('0x11e'),'contents':{'default':util['format'](_0x07bd('0x11f'),util[_0x07bd('0xe2')]('%s\x20#%d',_0x07bd('0x120'),_0x144514['id']),moment()[_0x07bd('0xe2')]('YYYY-MM-DD')[_0x07bd('0xa8')]())}}};var _0x2da7ca={'channel':'Chat','account':_0x144514[_0x07bd('0x11a')][_0x07bd('0x3d')],'agent':_0x144514[_0x07bd('0x121')]?_0x144514['Owner'][_0x07bd('0x41')]:_0x07bd('0x122'),'createdAt':moment(_0x144514[_0x07bd('0x89')])[_0x07bd('0xe2')](_0x07bd('0x108'))[_0x07bd('0xa8')](),'closedAt':_0x144514[_0x07bd('0xdb')]?moment(_0x144514[_0x07bd('0x123')])[_0x07bd('0xe2')](_0x07bd('0x108'))[_0x07bd('0xa8')]():'','disposition':_0x144514[_0x07bd('0xd4')],'chatInfo':{'browser':_0x144514[_0x07bd('0x124')],'os':_0x144514['osName'],'referer':_0x144514[_0x07bd('0x125')],'customerIp':_0x144514[_0x07bd('0x126')],'customerPort':_0x144514[_0x07bd('0x127')]?_0x144514[_0x07bd('0x127')]:_0x07bd('0x122')},'messages':_(_0x144514[_0x07bd('0xe5')])[_0x07bd('0x128')]()[_0x07bd('0x94')]({'secret':![]})[_0x07bd('0x40')](function(_0x5e0443){if(_0x5e0443['Attachment']){var _0x322c73=path[_0x07bd('0xdd')](_0x4432ac,_0x5e0443[_0x07bd('0xda')][_0x07bd('0xd7')]);if(fs[_0x07bd('0x129')](_0x322c73)){fs[_0x07bd('0x12a')](_0x322c73)[_0x07bd('0x12b')](fs[_0x07bd('0x12c')](path[_0x07bd('0xdd')](_0x5d6a67,_0x5e0443[_0x07bd('0xda')][_0x07bd('0xd7')])));}}return{'date':moment(_0x5e0443[_0x07bd('0x89')])['format'](_0x07bd('0x108'))['toString'](),'sender':_0x5e0443[_0x07bd('0xf1')]===_0x07bd('0xcc')?_0x5e0443[_0x07bd('0x7e')]?_0x5e0443[_0x07bd('0x7e')][_0x07bd('0x41')]:_0x07bd('0xe8'):_0x5e0443[_0x07bd('0x76')]['firstName']+(_0x5e0443[_0x07bd('0x76')]['lastName']?'\x20'+_0x5e0443[_0x07bd('0x76')][_0x07bd('0x119')]:''),'body':_0x5e0443[_0x07bd('0xda')]?_0x5e0443[_0x07bd('0xda')]['basename']:_0x5e0443[_0x07bd('0x83')],'direction':_0x5e0443[_0x07bd('0xf1')]===_0x07bd('0xcc')?'A':'C','secret':_0x5e0443['secret'],'read':_0x5e0443[_0x07bd('0x90')],'attachment':_0x5e0443[_0x07bd('0xda')]};})[_0x07bd('0x72')]()};return ejs[_0x07bd('0x12d')](path[_0x07bd('0xdd')](config[_0x07bd('0xe0')],_0x07bd('0x113'),_0x07bd('0x12e'),_0x07bd('0x12f')),{'interaction':_0x2da7ca})[_0x07bd('0x27')](function(_0x389742){return new BPromise(function(_0xe36373,_0x152e53){pdf[_0x07bd('0xce')](_0x389742,_0x335863)[_0x07bd('0x130')](path[_0x07bd('0xdd')](_0x5d6a67,_0x07bd('0x131')+_0x144514['id']+'-'+_0x144b56+_0x07bd('0x132')),function(_0x5184f9,_0x2cea3f){if(_0x5184f9)return _0x152e53(_0x5184f9);_0xe36373(_0x2cea3f);});});})['then'](function(){return new BPromise(function(_0xdbbc02,_0x235f96){zipdir(_0x5d6a67,{'saveTo':_0x8703d0},function(_0x32b928,_0x37c797){if(_0x32b928)return _0x235f96(_0x32b928);return _0xdbbc02(_0x37c797);});})[_0x07bd('0x27')](function(){return new BPromise(function(_0x4002ba,_0x2f15e5){rimraf(_0x5d6a67,function(_0x29c6d0){if(_0x29c6d0)_0x2f15e5(_0x29c6d0);return _0x4002ba();});});})[_0x07bd('0x27')](function(){return _0x1e06bb[_0x07bd('0x111')](_0x8703d0,_0x2cae5c,function(_0x53d0cc){if(_0x53d0cc){console['log'](_0x07bd('0x133'),_0x53d0cc);}else{fs[_0x07bd('0x134')](_0x8703d0);}});});});}else{return _0x1e06bb[_0x07bd('0x31')](0xc8);}})[_0x07bd('0x30')](handleError(_0x1e06bb,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 44fc9e5..a7d95a3 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 _0xa026=['length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x121981,_0x36d2f6){var _0x30dc1e=function(_0x2e9950){while(--_0x2e9950){_0x121981['push'](_0x121981['shift']());}};_0x30dc1e(++_0x36d2f6);}(_0xa026,0x1f4));var _0x6a02=function(_0x2c3f08,_0x380f2b){_0x2c3f08=_0x2c3f08-0x0;var _0x4ea2ab=_0xa026[_0x2c3f08];return _0x4ea2ab;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x6a02('0x0'))['db'][_0x6a02('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0x6a02('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x6a02('0x3')](0x0);var events={'afterCreate':_0x6a02('0x4'),'afterUpdate':_0x6a02('0x5'),'afterDestroy':_0x6a02('0x6')};function emitEvent(_0x3859d2){return function(_0x5ac27b,_0x43c053,_0x14b11e){_0x5ac27b['getUsers']({'attributes':['id'],'raw':!![]})[_0x6a02('0x7')](function(_0x1565c6){_0x5ac27b[_0x6a02('0x8')](_0x6a02('0x9'),_0x1565c6[_0x6a02('0xa')](function(_0x389ab0){return{'id':_0x389ab0['id']};}));return ChatMessage[_0x6a02('0xb')]({'where':{'ChatInteractionId':_0x5ac27b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x44980a){_0x5ac27b[_0x6a02('0x8')](_0x6a02('0xc'),_0x44980a[_0x6a02('0xd')]);ChatInteractionEvents['emit'](_0x3859d2+':'+_0x5ac27b['id'],_0x5ac27b);ChatInteractionEvents[_0x6a02('0xe')](_0x3859d2,_0x5ac27b);_0x14b11e(null);})[_0x6a02('0xf')](_0x14b11e(null));};}for(var e in events){if(events[_0x6a02('0x10')](e)){var event=events[e];ChatInteraction[_0x6a02('0x11')](e,emitEvent(event));}}module[_0x6a02('0x12')]=ChatInteractionEvents; \ No newline at end of file +var _0xf105=['events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','update','getUsers','then','setDataValue','map','findAll','length','emit','catch','hasOwnProperty','hook'];(function(_0x6abd7f,_0x23d86a){var _0x2a3b37=function(_0x2eab19){while(--_0x2eab19){_0x6abd7f['push'](_0x6abd7f['shift']());}};_0x2a3b37(++_0x23d86a);}(_0xf105,0x1b0));var _0x5f10=function(_0x1a60b1,_0x1a6171){_0x1a60b1=_0x1a60b1-0x0;var _0x21b0e9=_0xf105[_0x1a60b1];return _0x21b0e9;};'use strict';var EventEmitter=require(_0x5f10('0x0'));var ChatInteraction=require(_0x5f10('0x1'))['db'][_0x5f10('0x2')];var ChatMessage=require(_0x5f10('0x1'))['db'][_0x5f10('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x5f10('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5f10('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2c0393){return function(_0x14dcab,_0xd0dde3,_0x1b7489){_0x14dcab[_0x5f10('0x6')]({'attributes':['id'],'raw':!![]})[_0x5f10('0x7')](function(_0x34bd06){_0x14dcab[_0x5f10('0x8')]('Users',_0x34bd06[_0x5f10('0x9')](function(_0x3430fd){return{'id':_0x3430fd['id']};}));return ChatMessage[_0x5f10('0xa')]({'where':{'ChatInteractionId':_0x14dcab['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5f10('0x7')](function(_0x1b5463){_0x14dcab[_0x5f10('0x8')]('unreadMessages',_0x1b5463[_0x5f10('0xb')]);ChatInteractionEvents[_0x5f10('0xc')](_0x2c0393+':'+_0x14dcab['id'],_0x14dcab);ChatInteractionEvents[_0x5f10('0xc')](_0x2c0393,_0x14dcab);_0x1b7489(null);})[_0x5f10('0xd')](_0x1b7489(null));};}for(var e in events){if(events[_0x5f10('0xe')](e)){var event=events[e];ChatInteraction[_0x5f10('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index f13acbc..6b85765 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 _0x54f3=['utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','define','ChatInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x54f3,0x155));var _0x354f=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x54f3[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x354f('0x0'))(_0x354f('0x1'));var moment=require(_0x354f('0x2'));var BPromise=require(_0x354f('0x3'));var rp=require(_0x354f('0x4'));var fs=require('fs');var path=require(_0x354f('0x5'));var rimraf=require(_0x354f('0x6'));var config=require(_0x354f('0x7'));var attributes=require(_0x354f('0x8'));module['exports']=function(_0x30aaa9,_0x51c9b1){return _0x30aaa9[_0x354f('0x9')](_0x354f('0xa'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x26cbf4,_0x14d977,_0x2067d4){if(_0x26cbf4[_0x354f('0xb')](_0x354f('0xc'))){_0x26cbf4[_0x354f('0xd')]=moment()[_0x354f('0xe')](_0x354f('0xf'));}_0x2067d4(null,_0x26cbf4);}},'charset':'utf8mb4','collate':_0x354f('0x10')});}; \ No newline at end of file +var _0x5184=['YYYY-MM-DD\x20HH:mm:ss','util','api','bluebird','path','define','ChatInteraction','chat_interactions','changed','closed','closedAt'];(function(_0x2abbd9,_0x3b519e){var _0x370282=function(_0x635d87){while(--_0x635d87){_0x2abbd9['push'](_0x2abbd9['shift']());}};_0x370282(++_0x3b519e);}(_0x5184,0x16c));var _0x4518=function(_0x49c433,_0x27c449){_0x49c433=_0x49c433-0x0;var _0x191026=_0x5184[_0x49c433];return _0x191026;};'use strict';var _=require('lodash');var util=require(_0x4518('0x0'));var logger=require('../../config/logger')(_0x4518('0x1'));var moment=require('moment');var BPromise=require(_0x4518('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4518('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module['exports']=function(_0x4b5863,_0x3c1e27){return _0x4b5863[_0x4518('0x4')](_0x4518('0x5'),attributes,{'tableName':_0x4518('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x38154b,_0x9e951e,_0x44fe36){if(_0x38154b[_0x4518('0x7')](_0x4518('0x8'))){_0x38154b[_0x4518('0x9')]=moment()['format'](_0x4518('0xa'));}_0x44fe36(null,_0x38154b);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 02a3452..15fbbe4 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 _0x919c=['redis','socket.io-emitter','./chatInteraction.socket','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','body','options','where','attributes','limit','AddTagsToChatInteraction','find','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x577991,_0x4af074){var _0x112e6b=function(_0x2e1e1e){while(--_0x2e1e1e){_0x577991['push'](_0x577991['shift']());}};_0x112e6b(++_0x4af074);}(_0x919c,0x18d));var _0xc919=function(_0x3647c4,_0x3b821a){_0x3647c4=_0x3647c4-0x0;var _0x12946c=_0x919c[_0x3647c4];return _0x12946c;};'use strict';var _=require(_0xc919('0x0'));var util=require(_0xc919('0x1'));var moment=require(_0xc919('0x2'));var BPromise=require(_0xc919('0x3'));var rs=require(_0xc919('0x4'));var fs=require('fs');var Redis=require(_0xc919('0x5'));var db=require(_0xc919('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc919('0x7'))(_0xc919('0x8'));var config=require(_0xc919('0x9'));var jayson=require(_0xc919('0xa'));var client=jayson[_0xc919('0xb')][_0xc919('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc919('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xc919('0xe'))(new Redis(config[_0xc919('0xd')]));require(_0xc919('0xf'))['register'](socket);function respondWithRpcPromise(_0x4478ef,_0x565ecf,_0x164ecd){return new BPromise(function(_0xe6e818,_0x20406c){return client[_0xc919('0x10')](_0x4478ef,_0x164ecd)[_0xc919('0x11')](function(_0x1759a3){logger[_0xc919('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x565ecf,_0xc919('0x13'));logger[_0xc919('0x14')](_0xc919('0x15'),_0x565ecf,_0xc919('0x13'),JSON[_0xc919('0x16')](_0x1759a3));if(_0x1759a3['error']){if(_0x1759a3[_0xc919('0x17')][_0xc919('0x18')]===0x1f4){logger[_0xc919('0x17')](_0xc919('0x19'),_0x565ecf,_0x1759a3[_0xc919('0x17')][_0xc919('0x1a')]);return _0x20406c(_0x1759a3[_0xc919('0x17')][_0xc919('0x1a')]);}logger[_0xc919('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x565ecf,_0x1759a3[_0xc919('0x17')]['message']);return _0xe6e818(_0x1759a3[_0xc919('0x17')][_0xc919('0x1a')]);}else{logger['info'](_0xc919('0x19'),_0x565ecf,_0xc919('0x13'));_0xe6e818(_0x1759a3[_0xc919('0x1b')][_0xc919('0x1a')]);}})[_0xc919('0x1c')](function(_0x1ba041){logger[_0xc919('0x17')](_0xc919('0x19'),_0x565ecf,_0x1ba041);_0x20406c(_0x1ba041);});});}exports[_0xc919('0x1d')]=function(_0x4d0e88){var _0x4e13ee=this;return new Promise(function(_0x22e5a7,_0x4479c4){return db[_0xc919('0x1e')]['update'](_0x4d0e88[_0xc919('0x1f')],{'raw':_0x4d0e88[_0xc919('0x20')]?_0x4d0e88['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d0e88[_0xc919('0x20')]?_0x4d0e88[_0xc919('0x20')][_0xc919('0x21')]||null:null,'attributes':_0x4d0e88['options']?_0x4d0e88[_0xc919('0x20')][_0xc919('0x22')]||null:null,'limit':_0x4d0e88[_0xc919('0x20')]?_0x4d0e88[_0xc919('0x20')][_0xc919('0x23')]||null:null})[_0xc919('0x11')](function(_0x31f210){logger[_0xc919('0x12')]('UpdateChatInteraction',_0x4d0e88);logger[_0xc919('0x14')](_0xc919('0x1d'),_0x4d0e88,JSON['stringify'](_0x31f210));_0x22e5a7(_0x31f210);})[_0xc919('0x1c')](function(_0x4f853b){logger['error'](_0xc919('0x1d'),_0x4f853b[_0xc919('0x1a')],_0x4d0e88);_0x4479c4(_0x4e13ee[_0xc919('0x17')](0x1f4,_0x4f853b[_0xc919('0x1a')]));});});};exports[_0xc919('0x24')]=function(_0x3ef37f){return new Promise(function(_0x241244,_0x3d7696){return db[_0xc919('0x1e')][_0xc919('0x25')]({'where':_0x3ef37f[_0xc919('0x20')]?_0x3ef37f[_0xc919('0x20')]['where']||null:null})['then'](function(_0x2fef89){if(_0x2fef89){return _0x2fef89['addTags'](_0x3ef37f[_0xc919('0x1f')][_0xc919('0x26')],_['omit'](_0x3ef37f[_0xc919('0x1f')],[_0xc919('0x26'),'id'])||{});}})[_0xc919('0x27')](function(_0xc475eb){logger[_0xc919('0x12')](_0xc919('0x28'),_0x3ef37f);logger[_0xc919('0x14')](_0xc919('0x28'),_0x3ef37f,JSON[_0xc919('0x16')](_0xc475eb));_0x241244(_0xc475eb);})[_0xc919('0x1c')](function(_0x421012){logger[_0xc919('0x17')]('AddTags',_0x421012[_0xc919('0x1a')],_0x3ef37f);_0x3d7696(_this[_0xc919('0x17')](0x1f4,_0x421012[_0xc919('0x1a')]));});});}; \ No newline at end of file +var _0xc234=['http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','where','attributes','limit','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x5be197,_0x1c1847){var _0x581449=function(_0x328574){while(--_0x328574){_0x5be197['push'](_0x5be197['shift']());}};_0x581449(++_0x1c1847);}(_0xc234,0x1b7));var _0x4c23=function(_0x46774d,_0x559bc8){_0x46774d=_0x46774d-0x0;var _0x187f5a=_0xc234[_0x46774d];return _0x187f5a;};'use strict';var _=require(_0x4c23('0x0'));var util=require(_0x4c23('0x1'));var moment=require('moment');var BPromise=require(_0x4c23('0x2'));var rs=require(_0x4c23('0x3'));var fs=require('fs');var Redis=require(_0x4c23('0x4'));var db=require(_0x4c23('0x5'))['db'];var utils=require(_0x4c23('0x6'));var logger=require(_0x4c23('0x7'))(_0x4c23('0x8'));var config=require(_0x4c23('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4c23('0xa')][_0x4c23('0xb')]({'port':0x232a});config[_0x4c23('0xc')]=_[_0x4c23('0xd')](config['redis'],{'host':_0x4c23('0xe'),'port':0x18eb});var socket=require(_0x4c23('0xf'))(new Redis(config[_0x4c23('0xc')]));require(_0x4c23('0x10'))['register'](socket);function respondWithRpcPromise(_0x22fe12,_0x1eb1ad,_0x460496){return new BPromise(function(_0x31d285,_0x4430cf){return client[_0x4c23('0x11')](_0x22fe12,_0x460496)[_0x4c23('0x12')](function(_0x17887e){logger[_0x4c23('0x13')](_0x4c23('0x14'),_0x1eb1ad,_0x4c23('0x15'));logger[_0x4c23('0x16')](_0x4c23('0x17'),_0x1eb1ad,_0x4c23('0x15'),JSON[_0x4c23('0x18')](_0x17887e));if(_0x17887e[_0x4c23('0x19')]){if(_0x17887e[_0x4c23('0x19')][_0x4c23('0x1a')]===0x1f4){logger[_0x4c23('0x19')](_0x4c23('0x14'),_0x1eb1ad,_0x17887e[_0x4c23('0x19')][_0x4c23('0x1b')]);return _0x4430cf(_0x17887e[_0x4c23('0x19')][_0x4c23('0x1b')]);}logger[_0x4c23('0x19')](_0x4c23('0x14'),_0x1eb1ad,_0x17887e['error'][_0x4c23('0x1b')]);return _0x31d285(_0x17887e[_0x4c23('0x19')][_0x4c23('0x1b')]);}else{logger['info'](_0x4c23('0x14'),_0x1eb1ad,_0x4c23('0x15'));_0x31d285(_0x17887e[_0x4c23('0x1c')][_0x4c23('0x1b')]);}})[_0x4c23('0x1d')](function(_0x4aa46c){logger[_0x4c23('0x19')](_0x4c23('0x14'),_0x1eb1ad,_0x4aa46c);_0x4430cf(_0x4aa46c);});});}exports[_0x4c23('0x1e')]=function(_0x4e3a64){var _0x2da0db=this;return new Promise(function(_0xbde47a,_0x3a8343){return db[_0x4c23('0x1f')][_0x4c23('0x20')](_0x4e3a64[_0x4c23('0x21')],{'raw':_0x4e3a64[_0x4c23('0x22')]?_0x4e3a64[_0x4c23('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e3a64[_0x4c23('0x22')]?_0x4e3a64[_0x4c23('0x22')][_0x4c23('0x23')]||null:null,'attributes':_0x4e3a64['options']?_0x4e3a64[_0x4c23('0x22')][_0x4c23('0x24')]||null:null,'limit':_0x4e3a64['options']?_0x4e3a64[_0x4c23('0x22')][_0x4c23('0x25')]||null:null})[_0x4c23('0x12')](function(_0x56cc67){logger[_0x4c23('0x13')](_0x4c23('0x1e'),_0x4e3a64);logger[_0x4c23('0x16')](_0x4c23('0x1e'),_0x4e3a64,JSON[_0x4c23('0x18')](_0x56cc67));_0xbde47a(_0x56cc67);})[_0x4c23('0x1d')](function(_0x55e27e){logger[_0x4c23('0x19')](_0x4c23('0x1e'),_0x55e27e['message'],_0x4e3a64);_0x3a8343(_0x2da0db[_0x4c23('0x19')](0x1f4,_0x55e27e[_0x4c23('0x1b')]));});});};exports[_0x4c23('0x26')]=function(_0x10eedb){return new Promise(function(_0x3633a8,_0x2f29c1){return db[_0x4c23('0x1f')][_0x4c23('0x27')]({'where':_0x10eedb['options']?_0x10eedb[_0x4c23('0x22')]['where']||null:null})[_0x4c23('0x12')](function(_0x4fa34a){if(_0x4fa34a){return _0x4fa34a[_0x4c23('0x28')](_0x10eedb['body'][_0x4c23('0x29')],_[_0x4c23('0x2a')](_0x10eedb[_0x4c23('0x21')],[_0x4c23('0x29'),'id'])||{});}})[_0x4c23('0x2b')](function(_0x3d2c26){logger[_0x4c23('0x13')]('AddTags',_0x10eedb);logger[_0x4c23('0x16')](_0x4c23('0x2c'),_0x10eedb,JSON[_0x4c23('0x18')](_0x3d2c26));_0x3633a8(_0x3d2c26);})[_0x4c23('0x1d')](function(_0x5384d4){logger['error'](_0x4c23('0x2c'),_0x5384d4[_0x4c23('0x1b')],_0x10eedb);_0x2f29c1(_this['error'](0x1f4,_0x5384d4[_0x4c23('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 5f4363a..14e1b76 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 _0xe982=['emit','register','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0xe982,0x1b4));var _0x2e98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe982[_0x20a584];return _0x4b41a8;};'use strict';var ChatInteractionEvents=require(_0x2e98('0x0'));var events=[_0x2e98('0x1'),'remove','update'];function createListener(_0xef0d53,_0x5eb043){return function(_0x3a09bf){_0x5eb043[_0x2e98('0x2')](_0xef0d53,_0x3a09bf);};}function removeListener(_0x3973d6,_0x119f32){return function(){ChatInteractionEvents['removeListener'](_0x3973d6,_0x119f32);};}exports[_0x2e98('0x3')]=function(_0x20a02e){for(var _0x17d3a1=0x0,_0x35df5f=events[_0x2e98('0x4')];_0x17d3a1<_0x35df5f;_0x17d3a1++){var _0x5254fe=events[_0x17d3a1];var _0x27b919=createListener(_0x2e98('0x5')+_0x5254fe,_0x20a02e);ChatInteractionEvents['on'](_0x5254fe,_0x27b919);}}; \ No newline at end of file +var _0x6925=['save','update','emit','length','chatInteraction:','./chatInteraction.events'];(function(_0x718493,_0x485616){var _0x59af54=function(_0x21268d){while(--_0x21268d){_0x718493['push'](_0x718493['shift']());}};_0x59af54(++_0x485616);}(_0x6925,0x1f1));var _0x5692=function(_0x55cebe,_0xb85afd){_0x55cebe=_0x55cebe-0x0;var _0x14c2be=_0x6925[_0x55cebe];return _0x14c2be;};'use strict';var ChatInteractionEvents=require(_0x5692('0x0'));var events=[_0x5692('0x1'),'remove',_0x5692('0x2')];function createListener(_0x10720a,_0x31061a){return function(_0xaead20){_0x31061a[_0x5692('0x3')](_0x10720a,_0xaead20);};}function removeListener(_0x4abb34,_0x253b80){return function(){ChatInteractionEvents['removeListener'](_0x4abb34,_0x253b80);};}exports['register']=function(_0x34eaa6){for(var _0x4843b3=0x0,_0x2e4871=events[_0x5692('0x4')];_0x4843b3<_0x2e4871;_0x4843b3++){var _0x71162b=events[_0x4843b3];var _0x41fb93=createListener(_0x5692('0x5')+_0x71162b,_0x34eaa6);ChatInteractionEvents['on'](_0x71162b,_0x41fb93);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 64f09f4..eeb45e3 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 _0x77f1=['now','originalname','/:id/attachment_upload','single','file','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','/:id','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','util','path','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','post','/:id/vidaoo','join','root','server/files/attachments/','format'];(function(_0x29ffa2,_0x333c9a){var _0x1156de=function(_0x5da8a6){while(--_0x5da8a6){_0x29ffa2['push'](_0x29ffa2['shift']());}};_0x1156de(++_0x333c9a);}(_0x77f1,0x1dd));var _0x177f=function(_0x5c2887,_0x1c220b){_0x5c2887=_0x5c2887-0x0;var _0x37b728=_0x77f1[_0x5c2887];return _0x37b728;};'use strict';var multer=require('multer');var util=require(_0x177f('0x0'));var path=require(_0x177f('0x1'));var timeout=require(_0x177f('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x177f('0x3'));var config=require(_0x177f('0x4'));var controller=require('./chatInteraction.controller');router[_0x177f('0x5')]('/',auth[_0x177f('0x6')](),controller[_0x177f('0x7')]);router[_0x177f('0x5')](_0x177f('0x8'),auth['isAuthenticated'](),controller[_0x177f('0x9')]);router[_0x177f('0x5')]('/:id',auth[_0x177f('0xa')](),controller['show']);router[_0x177f('0x5')]('/:id/attachment_download',auth[_0x177f('0xa')](),controller[_0x177f('0xb')]);router['get'](_0x177f('0xc'),auth[_0x177f('0x6')](),controller[_0x177f('0xd')]);router[_0x177f('0x5')](_0x177f('0xe'),auth[_0x177f('0xa')](),controller[_0x177f('0xf')]);router[_0x177f('0x5')]('/:id/download',auth[_0x177f('0x6')](),controller[_0x177f('0x10')]);router[_0x177f('0x11')]('/',auth[_0x177f('0x6')](),controller['create']);router[_0x177f('0x11')](_0x177f('0x12'),auth[_0x177f('0x6')](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2366ba,_0x2f9446,_0x457d8b){_0x457d8b(null,path[_0x177f('0x13')](config[_0x177f('0x14')],_0x177f('0x15')));},'filename':function(_0x2900de,_0x2f0db5,_0x2389d5){_0x2389d5(null,util[_0x177f('0x16')]('%s-%s',Date[_0x177f('0x17')](),_0x2f0db5[_0x177f('0x18')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x177f('0x11')](_0x177f('0x19'),upload[_0x177f('0x1a')](_0x177f('0x1b')),controller[_0x177f('0x1c')]);router[_0x177f('0x11')](_0x177f('0xc'),auth[_0x177f('0xa')](),controller[_0x177f('0x1d')]);router[_0x177f('0x11')]('/:id/tags',auth[_0x177f('0x6')](),interaction[_0x177f('0x1e')](_0x177f('0x1f'),_0x177f('0x20')),controller[_0x177f('0x21')]);router[_0x177f('0x22')](_0x177f('0x23'),auth['isAuthenticated'](),interaction['tracked'](_0x177f('0x1f'),_0x177f('0x24')),controller[_0x177f('0x25')]);router[_0x177f('0x22')](_0x177f('0x26'),controller[_0x177f('0x27')]);router['put'](_0x177f('0x28'),auth[_0x177f('0xa')](),controller[_0x177f('0x29')]);router[_0x177f('0x22')](_0x177f('0x2a'),controller[_0x177f('0x2b')]);router[_0x177f('0x2c')](_0x177f('0x23'),auth[_0x177f('0x6')](),interaction[_0x177f('0x1e')](_0x177f('0x1f'),_0x177f('0x2d')),controller[_0x177f('0x2e')]);router[_0x177f('0x2c')](_0x177f('0x2f'),auth['isAuthenticated'](),controller[_0x177f('0x30')]);module[_0x177f('0x31')]=router; \ No newline at end of file +var _0x8533=['attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','create','post','/:id/vidaoo','join','root','format','%s-%s','now','originalname','replace','single','attachmentUpload','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','tracked','chatinteraction:update','/:id/abandon','abandon','close','delete','destroy','removeTags','exports','multer','util','path','express','Router','../../components/interaction/service','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/attachment_download','isChatInteractionAuthorized'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x8533,0x141));var _0x3853=function(_0x44a86f,_0x5e37d6){_0x44a86f=_0x44a86f-0x0;var _0x2a7458=_0x8533[_0x44a86f];return _0x2a7458;};'use strict';var multer=require(_0x3853('0x0'));var util=require(_0x3853('0x1'));var path=require(_0x3853('0x2'));var timeout=require('connect-timeout');var express=require(_0x3853('0x3'));var router=express[_0x3853('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3853('0x5'));var config=require('../../config/environment');var controller=require(_0x3853('0x6'));router['get']('/',auth[_0x3853('0x7')](),controller[_0x3853('0x8')]);router[_0x3853('0x9')](_0x3853('0xa'),auth['isAuthenticated'](),controller[_0x3853('0xb')]);router[_0x3853('0x9')](_0x3853('0xc'),auth['isChatInteractionAuthorized'](),controller['show']);router[_0x3853('0x9')](_0x3853('0xd'),auth[_0x3853('0xe')](),controller[_0x3853('0xf')]);router['get'](_0x3853('0x10'),auth[_0x3853('0x7')](),controller[_0x3853('0x11')]);router[_0x3853('0x9')](_0x3853('0x12'),auth[_0x3853('0xe')](),controller['getMyMessages']);router[_0x3853('0x9')](_0x3853('0x13'),auth[_0x3853('0x7')](),controller[_0x3853('0x14')]);router['post']('/',auth[_0x3853('0x7')](),controller[_0x3853('0x15')]);router[_0x3853('0x16')](_0x3853('0x17'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x130b7b,_0x77518,_0x378431){_0x378431(null,path[_0x3853('0x18')](config[_0x3853('0x19')],'server/files/attachments/'));},'filename':function(_0x14c3df,_0x4bf82a,_0x28f339){_0x28f339(null,util[_0x3853('0x1a')](_0x3853('0x1b'),Date[_0x3853('0x1c')](),_0x4bf82a[_0x3853('0x1d')][_0x3853('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0x3853('0x1f')]('file'),controller[_0x3853('0x20')]);router[_0x3853('0x16')]('/:id/messages',auth[_0x3853('0xe')](),controller[_0x3853('0x21')]);router[_0x3853('0x16')](_0x3853('0x22'),auth[_0x3853('0x7')](),interaction['tracked'](_0x3853('0x23'),_0x3853('0x24')),controller[_0x3853('0x25')]);router[_0x3853('0x26')](_0x3853('0xc'),auth[_0x3853('0x7')](),interaction[_0x3853('0x27')]('chat',_0x3853('0x28')),controller['update']);router[_0x3853('0x26')]('/:id/custom_update',controller['customUpdate']);router[_0x3853('0x26')](_0x3853('0x29'),auth[_0x3853('0xe')](),controller[_0x3853('0x2a')]);router[_0x3853('0x26')]('/:id/close',controller[_0x3853('0x2b')]);router[_0x3853('0x2c')]('/:id',auth[_0x3853('0x7')](),interaction['tracked']('chat','chatinteraction:destroy'),controller[_0x3853('0x2d')]);router[_0x3853('0x2c')](_0x3853('0x22'),auth['isAuthenticated'](),controller[_0x3853('0x2e')]);module[_0x3853('0x2f')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index fca9663..1f2908d 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 _0x7a54=['BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x509273,_0x13fc9f){var _0x38ef40=function(_0xf8d4c9){while(--_0xf8d4c9){_0x509273['push'](_0x509273['shift']());}};_0x38ef40(++_0x13fc9f);}(_0x7a54,0x106));var _0x47a5=function(_0x1ccd09,_0x4403e8){_0x1ccd09=_0x1ccd09-0x0;var _0x25afd5=_0x7a54[_0x1ccd09];return _0x25afd5;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'body':{'type':Sequelize[_0x47a5('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x47a5('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0xda2d=['medium','BOOLEAN','INTEGER','exports','TEXT'];(function(_0x32bda0,_0x807e85){var _0x4122ce=function(_0x505fa8){while(--_0x505fa8){_0x32bda0['push'](_0x32bda0['shift']());}};_0x4122ce(++_0x807e85);}(_0xda2d,0x102));var _0xdda2=function(_0x535594,_0x405ab6){_0x535594=_0x535594-0x0;var _0x26ec47=_0xda2d[_0x535594];return _0x26ec47;};'use strict';var Sequelize=require('sequelize');module[_0xdda2('0x0')]={'body':{'type':Sequelize[_0xdda2('0x1')](_0xdda2('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xdda2('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xdda2('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index a1f81f9..6f6472a 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 _0xbf1d=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','count','offset','Content-Range','reject','save','update','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','limit','sort','where','filters','merge','VIRTUAL','then','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','describe','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','user','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','FromId','ToId','read','-createdAt','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xbf1d,0x19e));var _0xdbf1=function(_0x14d7ef,_0x4c5ae8){_0x14d7ef=_0x14d7ef-0x0;var _0x1215df=_0xbf1d[_0x14d7ef];return _0x1215df;};'use strict';var pdf=require(_0xdbf1('0x0'));var emlformat=require(_0xdbf1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdbf1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdbf1('0x3'));var moment=require(_0xdbf1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdbf1('0x5'));var util=require('util');var path=require(_0xdbf1('0x6'));var sox=require(_0xdbf1('0x7'));var csv=require(_0xdbf1('0x8'));var ejs=require(_0xdbf1('0x9'));var fs=require('fs');var _=require(_0xdbf1('0xa'));var squel=require(_0xdbf1('0xb'));var crypto=require(_0xdbf1('0xc'));var jsforce=require(_0xdbf1('0xd'));var deskjs=require(_0xdbf1('0xe'));var toCsv=require(_0xdbf1('0x8'));var querystring=require(_0xdbf1('0xf'));var Papa=require(_0xdbf1('0x10'));var Redis=require(_0xdbf1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdbf1('0x12'));var as=require(_0xdbf1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdbf1('0x14'));var utils=require(_0xdbf1('0x15'));var config=require(_0xdbf1('0x16'));var db=require('../../mysqldb')['db'];config[_0xdbf1('0x17')]=_[_0xdbf1('0x18')](config[_0xdbf1('0x17')],{'host':_0xdbf1('0x19'),'port':0x18eb});var socket=require(_0xdbf1('0x1a'))(new Redis(config[_0xdbf1('0x17')]));require(_0xdbf1('0x1b'))[_0xdbf1('0x1c')](socket);function respondWithStatusCode(_0x349473,_0x20b768){_0x20b768=_0x20b768||0xcc;return function(_0x257a76){if(_0x257a76){return _0x349473[_0xdbf1('0x1d')](_0x20b768);}return _0x349473[_0xdbf1('0x1e')](_0x20b768)[_0xdbf1('0x1f')]();};}function respondWithResult(_0x59de70,_0x4fc777){_0x4fc777=_0x4fc777||0xc8;return function(_0x133db4){if(_0x133db4){return _0x59de70[_0xdbf1('0x1e')](_0x4fc777)[_0xdbf1('0x20')](_0x133db4);}};}function respondWithFilteredResult(_0x2d6477,_0x46dce3){return function(_0x1f5757){if(_0x1f5757){var _0x225176=_0x1f5757[_0xdbf1('0x21')],_0x405e19=_0x46dce3[_0xdbf1('0x22')],_0x55769b=_0x46dce3['offset']+_0x46dce3['limit'],_0x44a528;if(_0x55769b>=_0x225176){_0x55769b=_0x225176;_0x44a528=0xc8;}else{_0x44a528=0xce;}_0x2d6477['status'](_0x44a528);return _0x2d6477['set'](_0xdbf1('0x23'),_0x405e19+'-'+_0x55769b+'/'+_0x225176)[_0xdbf1('0x20')](_0x1f5757);}return null;};}function patchUpdates(_0x2dfb0){return function(_0x4534d3){try{jsonpatch['apply'](_0x4534d3,_0x2dfb0,!![]);}catch(_0x54cce5){return BPromise[_0xdbf1('0x24')](_0x54cce5);}return _0x4534d3[_0xdbf1('0x25')]();};}function saveUpdates(_0x404edc,_0x26ca80){return function(_0x4952f0){if(_0x4952f0){return _0x4952f0[_0xdbf1('0x26')](_0x404edc)['then'](function(_0x3ef73a){return _0x3ef73a;});}return null;};}function removeEntity(_0xdb8629,_0x42d664){return function(_0x573d91){if(_0x573d91){return _0x573d91[_0xdbf1('0x27')]()['then'](function(){_0xdb8629[_0xdbf1('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19f47d,_0x1fcf64){return function(_0x3917ff){if(!_0x3917ff){_0x19f47d['sendStatus'](0x194);}return _0x3917ff;};}function handleError(_0x934717,_0x63e494){_0x63e494=_0x63e494||0x1f4;return function(_0x4c63e1){logger[_0xdbf1('0x28')](_0x4c63e1[_0xdbf1('0x29')]);if(_0x4c63e1[_0xdbf1('0x2a')]){delete _0x4c63e1[_0xdbf1('0x2a')];}_0x934717[_0xdbf1('0x1e')](_0x63e494)[_0xdbf1('0x2b')](_0x4c63e1);};}exports[_0xdbf1('0x2c')]=function(_0x4a98b2,_0x4f90d1){var _0x2e46de={},_0x3a0921={},_0xecd4a5={'count':0x0,'rows':[]};var _0x4d7b8c=_[_0xdbf1('0x2d')](db[_0xdbf1('0x2e')][_0xdbf1('0x2f')],function(_0xf6196b){return{'name':_0xf6196b[_0xdbf1('0x30')],'type':_0xf6196b[_0xdbf1('0x31')][_0xdbf1('0x32')]};});_0x3a0921[_0xdbf1('0x33')]=_['map'](_0x4d7b8c,'name');_0x3a0921[_0xdbf1('0x34')]=_[_0xdbf1('0x35')](_0x4a98b2[_0xdbf1('0x34')]);_0x3a0921['filters']=_[_0xdbf1('0x36')](_0x3a0921[_0xdbf1('0x33')],_0x3a0921[_0xdbf1('0x34')]);_0x2e46de[_0xdbf1('0x37')]=_['intersection'](_0x3a0921['model'],qs[_0xdbf1('0x38')](_0x4a98b2[_0xdbf1('0x34')][_0xdbf1('0x38')]));_0x2e46de[_0xdbf1('0x37')]=_0x2e46de['attributes']['length']?_0x2e46de[_0xdbf1('0x37')]:_0x3a0921[_0xdbf1('0x33')];if(!_0x4a98b2[_0xdbf1('0x34')]['hasOwnProperty']('nolimit')){_0x2e46de[_0xdbf1('0x39')]=qs[_0xdbf1('0x39')](_0x4a98b2[_0xdbf1('0x34')][_0xdbf1('0x39')]);_0x2e46de[_0xdbf1('0x22')]=qs[_0xdbf1('0x22')](_0x4a98b2[_0xdbf1('0x34')]['offset']);}_0x2e46de['order']=qs[_0xdbf1('0x3a')](_0x4a98b2[_0xdbf1('0x34')][_0xdbf1('0x3a')]);_0x2e46de[_0xdbf1('0x3b')]=qs[_0xdbf1('0x3c')](_['pick'](_0x4a98b2[_0xdbf1('0x34')],_0x3a0921['filters']),_0x4d7b8c);if(_0x4a98b2[_0xdbf1('0x34')]['filter']){_0x2e46de[_0xdbf1('0x3b')]=_[_0xdbf1('0x3d')](_0x2e46de[_0xdbf1('0x3b')],{'$or':_[_0xdbf1('0x2d')](_0x4d7b8c,function(_0x571bd0){if(_0x571bd0[_0xdbf1('0x31')]!==_0xdbf1('0x3e')){var _0x1a6471={};_0x1a6471[_0x571bd0[_0xdbf1('0x2a')]]={'$like':'%'+_0x4a98b2['query']['filter']+'%'};return _0x1a6471;}})});}_0x2e46de=_[_0xdbf1('0x3d')]({},_0x2e46de,_0x4a98b2['options']);var _0x4155bc={'where':_0x2e46de['where']};return db[_0xdbf1('0x2e')][_0xdbf1('0x21')](_0x4155bc)[_0xdbf1('0x3f')](function(_0x46de90){_0xecd4a5[_0xdbf1('0x21')]=_0x46de90;if(_0x4a98b2['query'][_0xdbf1('0x40')]){_0x2e46de[_0xdbf1('0x41')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xdbf1('0x42')](_0x2e46de);})[_0xdbf1('0x3f')](function(_0x107091){_0xecd4a5[_0xdbf1('0x43')]=_0x107091;return _0xecd4a5;})[_0xdbf1('0x3f')](respondWithFilteredResult(_0x4f90d1,_0x2e46de))[_0xdbf1('0x44')](handleError(_0x4f90d1,null));};exports[_0xdbf1('0x45')]=function(_0x409639,_0x581382){var _0x551114={'raw':!![],'where':{'id':_0x409639[_0xdbf1('0x46')]['id']}},_0xf949d2={};_0xf949d2['model']=_[_0xdbf1('0x35')](db[_0xdbf1('0x2e')][_0xdbf1('0x2f')]);_0xf949d2[_0xdbf1('0x34')]=_[_0xdbf1('0x35')](_0x409639[_0xdbf1('0x34')]);_0xf949d2['filters']=_['intersection'](_0xf949d2[_0xdbf1('0x33')],_0xf949d2['query']);_0x551114[_0xdbf1('0x37')]=_['intersection'](_0xf949d2[_0xdbf1('0x33')],qs[_0xdbf1('0x38')](_0x409639[_0xdbf1('0x34')][_0xdbf1('0x38')]));_0x551114['attributes']=_0x551114[_0xdbf1('0x37')][_0xdbf1('0x47')]?_0x551114[_0xdbf1('0x37')]:_0xf949d2[_0xdbf1('0x33')];if(_0x409639[_0xdbf1('0x34')][_0xdbf1('0x40')]){_0x551114[_0xdbf1('0x41')]=[{'all':!![]}];}_0x551114=_[_0xdbf1('0x3d')]({},_0x551114,_0x409639[_0xdbf1('0x48')]);return db[_0xdbf1('0x2e')][_0xdbf1('0x49')](_0x551114)[_0xdbf1('0x3f')](handleEntityNotFound(_0x581382,null))['then'](respondWithResult(_0x581382,null))[_0xdbf1('0x44')](handleError(_0x581382,null));};exports[_0xdbf1('0x4a')]=function(_0x4e3b89,_0xdb5638){return db['ChatInternalMessage']['create'](_0x4e3b89['body'],{})['then'](respondWithResult(_0xdb5638,0xc9))[_0xdbf1('0x44')](handleError(_0xdb5638,null));};exports[_0xdbf1('0x26')]=function(_0x183ad0,_0x2e9cfb){if(_0x183ad0[_0xdbf1('0x4b')]['id']){delete _0x183ad0[_0xdbf1('0x4b')]['id'];}return db[_0xdbf1('0x2e')]['find']({'where':{'id':_0x183ad0[_0xdbf1('0x46')]['id']}})[_0xdbf1('0x3f')](handleEntityNotFound(_0x2e9cfb,null))[_0xdbf1('0x3f')](saveUpdates(_0x183ad0[_0xdbf1('0x4b')],null))[_0xdbf1('0x3f')](respondWithResult(_0x2e9cfb,null))['catch'](handleError(_0x2e9cfb,null));};exports[_0xdbf1('0x27')]=function(_0x4be54e,_0x364535){return db[_0xdbf1('0x2e')]['find']({'where':{'id':_0x4be54e[_0xdbf1('0x46')]['id']}})[_0xdbf1('0x3f')](handleEntityNotFound(_0x364535,null))[_0xdbf1('0x3f')](removeEntity(_0x364535,null))['catch'](handleError(_0x364535,null));};exports['describe']=function(_0x13cacf,_0x95cf5c){return db[_0xdbf1('0x2e')][_0xdbf1('0x4c')]()[_0xdbf1('0x3f')](respondWithResult(_0x95cf5c,null))[_0xdbf1('0x44')](handleError(_0x95cf5c,null));};function wrapUser(_0x2e2fd4){return function(_0x4a4778){var _0x7b24d0=_0x2e2fd4['get']({'plain':!![]});_0x7b24d0[_0xdbf1('0x4d')]=[];if(_0x4a4778){_0x7b24d0[_0xdbf1('0x4e')]=_0x4a4778[_0xdbf1('0x4f')];_0x7b24d0[_0xdbf1('0x50')]=_0x4a4778;}else{_0x7b24d0['lastMessageAt']=moment(0x0)[_0xdbf1('0x51')](_0xdbf1('0x52'));_0x7b24d0['lastMessage']={};}return _0x7b24d0;};}exports[_0xdbf1('0x53')]=function(_0x3517b5,_0x4da95b,_0x3aaaad){var _0x5eca2a=[];return db[_0xdbf1('0x54')][_0xdbf1('0x42')]({'where':{'role':['agent','admin',_0xdbf1('0x55')]},'attributes':['id','fullname',_0xdbf1('0x2a'),_0xdbf1('0x56'),_0xdbf1('0x57'),_0xdbf1('0x58'),_0xdbf1('0x59'),_0xdbf1('0x5a'),_0xdbf1('0x5b'),_0xdbf1('0x5c')],'order':qs[_0xdbf1('0x3a')]('-online'),'include':[{'model':db[_0xdbf1('0x5d')],'as':'VoiceQueues','attributes':['id',_0xdbf1('0x2a'),_0xdbf1('0x31')],'through':{'attributes':[]}}]})[_0xdbf1('0x3f')](function(_0x38ed29){if(_0x38ed29){var _0x245330=_0x3517b5[_0xdbf1('0x55')]['get']({'plain':!![]});if(!_0x245330)throw new Error(_0xdbf1('0x5e'));if(_0x245330[_0xdbf1('0x56')]===_0xdbf1('0x55')){return db['UserProfileSection']['find']({'where':{'name':'Agents','userProfileId':_0x245330[_0xdbf1('0x5f')]},'raw':!![]})[_0xdbf1('0x3f')](function(_0xc94249){if(_0xc94249){if(_0xc94249[_0xdbf1('0x60')]===0x0){return db[_0xdbf1('0x61')][_0xdbf1('0x42')]({'where':{'sectionId':_0xc94249['id']},'raw':!![]})['then'](function(_0x176aa1){var _0x32d3fc=[];if(_[_0xdbf1('0x62')](_0x176aa1)){_0x32d3fc=_['filter'](_0x38ed29,function(_0x39f80b){if(_0x39f80b[_0xdbf1('0x56')]!==_0xdbf1('0x63')){return _0x39f80b;}});return _0x32d3fc;}else{for(var _0x11428c=0x0;_0x11428c<_0x38ed29[_0xdbf1('0x47')];_0x11428c++){var _0x1cf1f7=_0x38ed29[_0x11428c];if(_0x1cf1f7[_0xdbf1('0x56')]===_0xdbf1('0x63')){var _0x104fb2=_[_0xdbf1('0x49')](_0x176aa1,function(_0x37bac7){return _0x37bac7[_0xdbf1('0x64')]===_0x1cf1f7['id'];});if(_0x104fb2)_0x32d3fc[_0xdbf1('0x65')](_0x1cf1f7);}else{_0x32d3fc[_0xdbf1('0x65')](_0x1cf1f7);}}return _0x32d3fc;}});}else{return _0x38ed29;}}else{var _0x4b637b=_['filter'](_0x38ed29,function(_0x29940b){if(_0x29940b[_0xdbf1('0x56')]!==_0xdbf1('0x63')){return _0x29940b;}});return _0x4b637b;}});}else{return _0x38ed29;}}})[_0xdbf1('0x3f')](function(_0x681134){var _0xf44cba=[];if(_0x681134){_0x5eca2a=_0x681134;for(var _0x54353b=0x0;_0x54353b<_0x681134[_0xdbf1('0x47')];_0x54353b+=0x1){_0x5eca2a[_0x54353b][_0xdbf1('0x4d')]=[];_0xf44cba[_0xdbf1('0x65')](db[_0xdbf1('0x2e')][_0xdbf1('0x49')]({'where':{'FromId':[_0x3517b5[_0xdbf1('0x55')]['id'],_0x681134[_0x54353b]['id']],'ToId':[_0x3517b5['user']['id'],_0x681134[_0x54353b]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xdbf1('0x66'),_0xdbf1('0x67'),_0xdbf1('0x68'),_0xdbf1('0x4b')],'order':qs[_0xdbf1('0x3a')](_0xdbf1('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xdbf1('0x3f')](wrapUser(_0x681134[_0x54353b])));}return BPromise['all'](_0xf44cba);}return[];})['then'](function(_0x33af7a){return{'rows':_0x33af7a,'count':_0x33af7a[_0xdbf1('0x47')]};})['then'](respondWithResult(_0x4da95b,null))[_0xdbf1('0x44')](handleError(_0x4da95b,null));}; \ No newline at end of file +var _0x492d=['ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','rows','catch','show','keys','include','create','body','find','params','describe','messages','lastMessageAt','createdAt','lastMessage','format','getUsers','User','findAll','agent','fullname','role','internal','lastLoginAt','allowmessenger','showWebBar','sort','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','push','ToId','read','-createdAt','all','html-pdf','zip-dir','mustache','util','path','sox'];(function(_0x25d403,_0x5612bb){var _0x3f3b24=function(_0x4c0691){while(--_0x4c0691){_0x25d403['push'](_0x25d403['shift']());}};_0x3f3b24(++_0x5612bb);}(_0x492d,0x64));var _0xd492=function(_0x28a180,_0x2eb1f7){_0x28a180=_0x28a180-0x0;var _0x1071a8=_0x492d[_0x28a180];return _0x1071a8;};'use strict';var pdf=require(_0xd492('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd492('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd492('0x2'));var util=require(_0xd492('0x3'));var path=require(_0xd492('0x4'));var sox=require(_0xd492('0x5'));var csv=require('to-csv');var ejs=require(_0xd492('0x6'));var fs=require('fs');var _=require(_0xd492('0x7'));var squel=require(_0xd492('0x8'));var crypto=require(_0xd492('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xd492('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd492('0xb'));var Redis=require(_0xd492('0xc'));var authService=require(_0xd492('0xd'));var qs=require(_0xd492('0xe'));var as=require(_0xd492('0xf'));var hardwareService=require(_0xd492('0x10'));var logger=require(_0xd492('0x11'))(_0xd492('0x12'));var utils=require(_0xd492('0x13'));var config=require('../../config/environment');var db=require(_0xd492('0x14'))['db'];config[_0xd492('0x15')]=_[_0xd492('0x16')](config[_0xd492('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xd492('0x17'))(new Redis(config[_0xd492('0x15')]));require(_0xd492('0x18'))[_0xd492('0x19')](socket);function respondWithStatusCode(_0xb8460b,_0x75268e){_0x75268e=_0x75268e||0xcc;return function(_0x339e01){if(_0x339e01){return _0xb8460b[_0xd492('0x1a')](_0x75268e);}return _0xb8460b[_0xd492('0x1b')](_0x75268e)['end']();};}function respondWithResult(_0x23b6cd,_0x250a11){_0x250a11=_0x250a11||0xc8;return function(_0x906aa6){if(_0x906aa6){return _0x23b6cd[_0xd492('0x1b')](_0x250a11)['json'](_0x906aa6);}};}function respondWithFilteredResult(_0x552049,_0x283c77){return function(_0x279d38){if(_0x279d38){var _0x546d62=_0x279d38[_0xd492('0x1c')],_0xed587e=_0x283c77[_0xd492('0x1d')],_0x4dc0f5=_0x283c77[_0xd492('0x1d')]+_0x283c77[_0xd492('0x1e')],_0xd324ff;if(_0x4dc0f5>=_0x546d62){_0x4dc0f5=_0x546d62;_0xd324ff=0xc8;}else{_0xd324ff=0xce;}_0x552049['status'](_0xd324ff);return _0x552049[_0xd492('0x1f')](_0xd492('0x20'),_0xed587e+'-'+_0x4dc0f5+'/'+_0x546d62)[_0xd492('0x21')](_0x279d38);}return null;};}function patchUpdates(_0x306615){return function(_0x1f0aa3){try{jsonpatch[_0xd492('0x22')](_0x1f0aa3,_0x306615,!![]);}catch(_0x1868b6){return BPromise[_0xd492('0x23')](_0x1868b6);}return _0x1f0aa3['save']();};}function saveUpdates(_0x25200e,_0x17078c){return function(_0x4fcda1){if(_0x4fcda1){return _0x4fcda1[_0xd492('0x24')](_0x25200e)[_0xd492('0x25')](function(_0x15715f){return _0x15715f;});}return null;};}function removeEntity(_0x1110b9,_0x312e82){return function(_0x78adfa){if(_0x78adfa){return _0x78adfa[_0xd492('0x26')]()[_0xd492('0x25')](function(){_0x1110b9[_0xd492('0x1b')](0xcc)[_0xd492('0x27')]();});}};}function handleEntityNotFound(_0x93bb3d,_0x2dee5d){return function(_0x88a33f){if(!_0x88a33f){_0x93bb3d[_0xd492('0x1a')](0x194);}return _0x88a33f;};}function handleError(_0x44dd88,_0x17004d){_0x17004d=_0x17004d||0x1f4;return function(_0x46a132){logger[_0xd492('0x28')](_0x46a132[_0xd492('0x29')]);if(_0x46a132[_0xd492('0x2a')]){delete _0x46a132[_0xd492('0x2a')];}_0x44dd88[_0xd492('0x1b')](_0x17004d)['send'](_0x46a132);};}exports[_0xd492('0x2b')]=function(_0x553d17,_0x4a822b){var _0x5b248a={},_0x5079f7={},_0x4701fe={'count':0x0,'rows':[]};var _0x28b838=_[_0xd492('0x2c')](db[_0xd492('0x2d')][_0xd492('0x2e')],function(_0x2492d5){return{'name':_0x2492d5[_0xd492('0x2f')],'type':_0x2492d5[_0xd492('0x30')][_0xd492('0x31')]};});_0x5079f7[_0xd492('0x32')]=_['map'](_0x28b838,_0xd492('0x2a'));_0x5079f7[_0xd492('0x33')]=_['keys'](_0x553d17['query']);_0x5079f7[_0xd492('0x34')]=_[_0xd492('0x35')](_0x5079f7[_0xd492('0x32')],_0x5079f7[_0xd492('0x33')]);_0x5b248a['attributes']=_['intersection'](_0x5079f7['model'],qs[_0xd492('0x36')](_0x553d17[_0xd492('0x33')][_0xd492('0x36')]));_0x5b248a[_0xd492('0x37')]=_0x5b248a[_0xd492('0x37')][_0xd492('0x38')]?_0x5b248a[_0xd492('0x37')]:_0x5079f7[_0xd492('0x32')];if(!_0x553d17[_0xd492('0x33')][_0xd492('0x39')](_0xd492('0x3a'))){_0x5b248a[_0xd492('0x1e')]=qs['limit'](_0x553d17[_0xd492('0x33')][_0xd492('0x1e')]);_0x5b248a['offset']=qs['offset'](_0x553d17[_0xd492('0x33')][_0xd492('0x1d')]);}_0x5b248a[_0xd492('0x3b')]=qs['sort'](_0x553d17[_0xd492('0x33')]['sort']);_0x5b248a[_0xd492('0x3c')]=qs[_0xd492('0x34')](_[_0xd492('0x3d')](_0x553d17['query'],_0x5079f7[_0xd492('0x34')]),_0x28b838);if(_0x553d17['query'][_0xd492('0x3e')]){_0x5b248a[_0xd492('0x3c')]=_[_0xd492('0x3f')](_0x5b248a[_0xd492('0x3c')],{'$or':_[_0xd492('0x2c')](_0x28b838,function(_0x3a27e0){if(_0x3a27e0[_0xd492('0x30')]!=='VIRTUAL'){var _0x2df73d={};_0x2df73d[_0x3a27e0['name']]={'$like':'%'+_0x553d17[_0xd492('0x33')][_0xd492('0x3e')]+'%'};return _0x2df73d;}})});}_0x5b248a=_[_0xd492('0x3f')]({},_0x5b248a,_0x553d17[_0xd492('0x40')]);var _0x4dc9e3={'where':_0x5b248a[_0xd492('0x3c')]};return db['ChatInternalMessage'][_0xd492('0x1c')](_0x4dc9e3)[_0xd492('0x25')](function(_0x56e272){_0x4701fe['count']=_0x56e272;if(_0x553d17['query'][_0xd492('0x41')]){_0x5b248a['include']=[{'all':!![]}];}return db[_0xd492('0x2d')]['findAll'](_0x5b248a);})['then'](function(_0x1646c6){_0x4701fe[_0xd492('0x42')]=_0x1646c6;return _0x4701fe;})[_0xd492('0x25')](respondWithFilteredResult(_0x4a822b,_0x5b248a))[_0xd492('0x43')](handleError(_0x4a822b,null));};exports[_0xd492('0x44')]=function(_0x5a6ed7,_0x388d09){var _0x3a08aa={'raw':!![],'where':{'id':_0x5a6ed7['params']['id']}},_0x2363a9={};_0x2363a9[_0xd492('0x32')]=_[_0xd492('0x45')](db[_0xd492('0x2d')][_0xd492('0x2e')]);_0x2363a9[_0xd492('0x33')]=_[_0xd492('0x45')](_0x5a6ed7[_0xd492('0x33')]);_0x2363a9[_0xd492('0x34')]=_[_0xd492('0x35')](_0x2363a9[_0xd492('0x32')],_0x2363a9[_0xd492('0x33')]);_0x3a08aa[_0xd492('0x37')]=_[_0xd492('0x35')](_0x2363a9[_0xd492('0x32')],qs[_0xd492('0x36')](_0x5a6ed7[_0xd492('0x33')]['fields']));_0x3a08aa[_0xd492('0x37')]=_0x3a08aa[_0xd492('0x37')][_0xd492('0x38')]?_0x3a08aa[_0xd492('0x37')]:_0x2363a9[_0xd492('0x32')];if(_0x5a6ed7['query'][_0xd492('0x41')]){_0x3a08aa[_0xd492('0x46')]=[{'all':!![]}];}_0x3a08aa=_[_0xd492('0x3f')]({},_0x3a08aa,_0x5a6ed7[_0xd492('0x40')]);return db[_0xd492('0x2d')]['find'](_0x3a08aa)[_0xd492('0x25')](handleEntityNotFound(_0x388d09,null))[_0xd492('0x25')](respondWithResult(_0x388d09,null))[_0xd492('0x43')](handleError(_0x388d09,null));};exports['create']=function(_0x6cdeb2,_0x20400d){return db[_0xd492('0x2d')][_0xd492('0x47')](_0x6cdeb2['body'],{})[_0xd492('0x25')](respondWithResult(_0x20400d,0xc9))[_0xd492('0x43')](handleError(_0x20400d,null));};exports['update']=function(_0xb2d3bf,_0x4cb329){if(_0xb2d3bf['body']['id']){delete _0xb2d3bf[_0xd492('0x48')]['id'];}return db[_0xd492('0x2d')][_0xd492('0x49')]({'where':{'id':_0xb2d3bf[_0xd492('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4cb329,null))['then'](saveUpdates(_0xb2d3bf['body'],null))[_0xd492('0x25')](respondWithResult(_0x4cb329,null))[_0xd492('0x43')](handleError(_0x4cb329,null));};exports[_0xd492('0x26')]=function(_0x45b192,_0x28f66f){return db[_0xd492('0x2d')][_0xd492('0x49')]({'where':{'id':_0x45b192[_0xd492('0x4a')]['id']}})[_0xd492('0x25')](handleEntityNotFound(_0x28f66f,null))[_0xd492('0x25')](removeEntity(_0x28f66f,null))[_0xd492('0x43')](handleError(_0x28f66f,null));};exports[_0xd492('0x4b')]=function(_0x437c42,_0x33ba33){return db[_0xd492('0x2d')]['describe']()[_0xd492('0x25')](respondWithResult(_0x33ba33,null))[_0xd492('0x43')](handleError(_0x33ba33,null));};function wrapUser(_0x267b8d){return function(_0xf4b928){var _0x56ef37=_0x267b8d['get']({'plain':!![]});_0x56ef37[_0xd492('0x4c')]=[];if(_0xf4b928){_0x56ef37[_0xd492('0x4d')]=_0xf4b928[_0xd492('0x4e')];_0x56ef37[_0xd492('0x4f')]=_0xf4b928;}else{_0x56ef37[_0xd492('0x4d')]=moment(0x0)[_0xd492('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x56ef37['lastMessage']={};}return _0x56ef37;};}exports[_0xd492('0x51')]=function(_0x4af32e,_0x3904ea,_0x9ba9c6){var _0x4993f5=[];return db[_0xd492('0x52')][_0xd492('0x53')]({'where':{'role':[_0xd492('0x54'),'admin','user']},'attributes':['id',_0xd492('0x55'),'name',_0xd492('0x56'),'userpic',_0xd492('0x57'),'online',_0xd492('0x58'),_0xd492('0x59'),_0xd492('0x5a')],'order':qs[_0xd492('0x5b')]('-online'),'include':[{'model':db[_0xd492('0x5c')],'as':_0xd492('0x5d'),'attributes':['id',_0xd492('0x2a'),_0xd492('0x30')],'through':{'attributes':[]}}]})[_0xd492('0x25')](function(_0x533bb3){if(_0x533bb3){var _0x532b52=_0x4af32e[_0xd492('0x5e')]['get']({'plain':!![]});if(!_0x532b52)throw new Error(_0xd492('0x5f'));if(_0x532b52['role']===_0xd492('0x5e')){return db[_0xd492('0x60')][_0xd492('0x49')]({'where':{'name':_0xd492('0x61'),'userProfileId':_0x532b52[_0xd492('0x62')]},'raw':!![]})[_0xd492('0x25')](function(_0x22ae98){if(_0x22ae98){if(_0x22ae98[_0xd492('0x63')]===0x0){return db['UserProfileResource'][_0xd492('0x53')]({'where':{'sectionId':_0x22ae98['id']},'raw':!![]})[_0xd492('0x25')](function(_0x335621){var _0x4f6405=[];if(_[_0xd492('0x64')](_0x335621)){_0x4f6405=_[_0xd492('0x3e')](_0x533bb3,function(_0xdc77df){if(_0xdc77df[_0xd492('0x56')]!=='agent'){return _0xdc77df;}});return _0x4f6405;}else{for(var _0x390833=0x0;_0x390833<_0x533bb3[_0xd492('0x38')];_0x390833++){var _0x37eeb8=_0x533bb3[_0x390833];if(_0x37eeb8[_0xd492('0x56')]==='agent'){var _0x4c1bb0=_[_0xd492('0x49')](_0x335621,function(_0x36bd06){return _0x36bd06['resourceId']===_0x37eeb8['id'];});if(_0x4c1bb0)_0x4f6405[_0xd492('0x65')](_0x37eeb8);}else{_0x4f6405[_0xd492('0x65')](_0x37eeb8);}}return _0x4f6405;}});}else{return _0x533bb3;}}else{var _0x4603a8=_[_0xd492('0x3e')](_0x533bb3,function(_0x2db5c6){if(_0x2db5c6[_0xd492('0x56')]!=='agent'){return _0x2db5c6;}});return _0x4603a8;}});}else{return _0x533bb3;}}})['then'](function(_0x135b94){var _0x54f331=[];if(_0x135b94){_0x4993f5=_0x135b94;for(var _0x108466=0x0;_0x108466<_0x135b94[_0xd492('0x38')];_0x108466+=0x1){_0x4993f5[_0x108466][_0xd492('0x4c')]=[];_0x54f331[_0xd492('0x65')](db[_0xd492('0x2d')][_0xd492('0x49')]({'where':{'FromId':[_0x4af32e[_0xd492('0x5e')]['id'],_0x135b94[_0x108466]['id']],'ToId':[_0x4af32e[_0xd492('0x5e')]['id'],_0x135b94[_0x108466]['id']],'ChatGroupId':null},'attributes':['id',_0xd492('0x4e'),'FromId',_0xd492('0x66'),_0xd492('0x67'),'body'],'order':qs['sort'](_0xd492('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x135b94[_0x108466])));}return BPromise[_0xd492('0x69')](_0x54f331);}return[];})[_0xd492('0x25')](function(_0x1a8427){return{'rows':_0x1a8427,'count':_0x1a8427[_0xd492('0x38')]};})[_0xd492('0x25')](respondWithResult(_0x3904ea,null))['catch'](handleError(_0x3904ea,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 2184a2d..774732a 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 _0x23ea=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x23ea,0xc3));var _0xa23e=function(_0x59808b,_0x448eac){_0x59808b=_0x59808b-0x0;var _0x32e13a=_0x23ea[_0x59808b];return _0x32e13a;};'use strict';var EventEmitter=require(_0xa23e('0x0'));var ChatInternalMessage=require(_0xa23e('0x1'))['db'][_0xa23e('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xa23e('0x3')](0x0);var events={'afterCreate':_0xa23e('0x4'),'afterUpdate':_0xa23e('0x5'),'afterDestroy':_0xa23e('0x6')};function emitEvent(_0x3428d6){return function(_0xf8cea8,_0x441b2e,_0x6f7d68){ChatInternalMessageEvents['emit'](_0x3428d6+':'+_0xf8cea8['id'],_0xf8cea8);ChatInternalMessageEvents[_0xa23e('0x7')](_0x3428d6,_0xf8cea8);_0x6f7d68(null);};}for(var e in events){if(events[_0xa23e('0x8')](e)){var event=events[e];ChatInternalMessage[_0xa23e('0x9')](e,emitEvent(event));}}module[_0xa23e('0xa')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xa8ca=['save','update','remove','emit','exports','events','ChatInternalMessage'];(function(_0x4b075e,_0x57874c){var _0x31385c=function(_0x3ab6ef){while(--_0x3ab6ef){_0x4b075e['push'](_0x4b075e['shift']());}};_0x31385c(++_0x57874c);}(_0xa8ca,0x12b));var _0xaa8c=function(_0x1cc806,_0x340aaf){_0x1cc806=_0x1cc806-0x0;var _0x187566=_0xa8ca[_0x1cc806];return _0x187566;};'use strict';var EventEmitter=require(_0xaa8c('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xaa8c('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaa8c('0x2'),'afterUpdate':_0xaa8c('0x3'),'afterDestroy':_0xaa8c('0x4')};function emitEvent(_0x1f965d){return function(_0x2c993f,_0x3b6002,_0x4a0298){ChatInternalMessageEvents[_0xaa8c('0x5')](_0x1f965d+':'+_0x2c993f['id'],_0x2c993f);ChatInternalMessageEvents[_0xaa8c('0x5')](_0x1f965d,_0x2c993f);_0x4a0298(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xaa8c('0x6')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 0257eef..211b9af 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 _0xd832=['rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x5795f4,_0x5660af){var _0x3e2937=function(_0x19598f){while(--_0x19598f){_0x5795f4['push'](_0x5795f4['shift']());}};_0x3e2937(++_0x5660af);}(_0xd832,0xe9));var _0x2d83=function(_0x602ca8,_0x568e82){_0x602ca8=_0x602ca8-0x0;var _0x26e8ab=_0xd832[_0x602ca8];return _0x26e8ab;};'use strict';var _=require(_0x2d83('0x0'));var util=require(_0x2d83('0x1'));var logger=require('../../config/logger')(_0x2d83('0x2'));var moment=require(_0x2d83('0x3'));var BPromise=require(_0x2d83('0x4'));var rp=require(_0x2d83('0x5'));var fs=require('fs');var path=require(_0x2d83('0x6'));var rimraf=require(_0x2d83('0x7'));var config=require(_0x2d83('0x8'));var attributes=require(_0x2d83('0x9'));module[_0x2d83('0xa')]=function(_0x35acbe,_0x4c10b1){return _0x35acbe[_0x2d83('0xb')](_0x2d83('0xc'),attributes,{'tableName':_0x2d83('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2d83('0xe'),'collate':_0x2d83('0xf')});}; \ No newline at end of file +var _0xf3d2=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xf3d2,0x11e));var _0x2f3d=function(_0x584a03,_0x59e0c8){_0x584a03=_0x584a03-0x0;var _0x29d9c9=_0xf3d2[_0x584a03];return _0x29d9c9;};'use strict';var _=require(_0x2f3d('0x0'));var util=require(_0x2f3d('0x1'));var logger=require(_0x2f3d('0x2'))(_0x2f3d('0x3'));var moment=require(_0x2f3d('0x4'));var BPromise=require(_0x2f3d('0x5'));var rp=require(_0x2f3d('0x6'));var fs=require('fs');var path=require(_0x2f3d('0x7'));var rimraf=require(_0x2f3d('0x8'));var config=require(_0x2f3d('0x9'));var attributes=require(_0x2f3d('0xa'));module[_0x2f3d('0xb')]=function(_0xdcefc7,_0x39a626){return _0xdcefc7[_0x2f3d('0xc')](_0x2f3d('0xd'),attributes,{'tableName':_0x2f3d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2f3d('0xf'),'collate':_0x2f3d('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 0045f8d..8b3aa89 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 _0x2bbb=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','ioredis','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2ed08e,_0x31e039){var _0x5d98cb=function(_0x345294){while(--_0x345294){_0x2ed08e['push'](_0x2ed08e['shift']());}};_0x5d98cb(++_0x31e039);}(_0x2bbb,0x1ca));var _0xb2bb=function(_0x2a38c0,_0x58c49c){_0x2a38c0=_0x2a38c0-0x0;var _0x314fb3=_0x2bbb[_0x2a38c0];return _0x314fb3;};'use strict';var _=require(_0xb2bb('0x0'));var util=require('util');var moment=require(_0xb2bb('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb2bb('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb2bb('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xb2bb('0x4'));var jayson=require(_0xb2bb('0x5'));var client=jayson['client'][_0xb2bb('0x6')]({'port':0x232a});config[_0xb2bb('0x7')]=_[_0xb2bb('0x8')](config[_0xb2bb('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xb2bb('0x9'))(new Redis(config['redis']));require(_0xb2bb('0xa'))[_0xb2bb('0xb')](socket);function respondWithRpcPromise(_0x3fbc8e,_0x558203,_0x2b600f){return new BPromise(function(_0x16e447,_0x27dfc5){return client[_0xb2bb('0xc')](_0x3fbc8e,_0x2b600f)[_0xb2bb('0xd')](function(_0x1125c5){logger['info'](_0xb2bb('0xe'),_0x558203,_0xb2bb('0xf'));logger[_0xb2bb('0x10')](_0xb2bb('0x11'),_0x558203,'request\x20sent',JSON[_0xb2bb('0x12')](_0x1125c5));if(_0x1125c5[_0xb2bb('0x13')]){if(_0x1125c5[_0xb2bb('0x13')][_0xb2bb('0x14')]===0x1f4){logger[_0xb2bb('0x13')](_0xb2bb('0xe'),_0x558203,_0x1125c5[_0xb2bb('0x13')][_0xb2bb('0x15')]);return _0x27dfc5(_0x1125c5[_0xb2bb('0x13')][_0xb2bb('0x15')]);}logger[_0xb2bb('0x13')](_0xb2bb('0xe'),_0x558203,_0x1125c5['error'][_0xb2bb('0x15')]);return _0x16e447(_0x1125c5[_0xb2bb('0x13')][_0xb2bb('0x15')]);}else{logger[_0xb2bb('0x16')](_0xb2bb('0xe'),_0x558203,'request\x20sent');_0x16e447(_0x1125c5[_0xb2bb('0x17')]['message']);}})[_0xb2bb('0x18')](function(_0x4b8d35){logger[_0xb2bb('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x558203,_0x4b8d35);_0x27dfc5(_0x4b8d35);});});} \ No newline at end of file +var _0x8c68=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result'];(function(_0x2a66ff,_0x6f8400){var _0x426ff9=function(_0x375b14){while(--_0x375b14){_0x2a66ff['push'](_0x2a66ff['shift']());}};_0x426ff9(++_0x6f8400);}(_0x8c68,0x1c3));var _0x88c6=function(_0x152b9f,_0x51b306){_0x152b9f=_0x152b9f-0x0;var _0x5f0f8e=_0x8c68[_0x152b9f];return _0x5f0f8e;};'use strict';var _=require(_0x88c6('0x0'));var util=require('util');var moment=require(_0x88c6('0x1'));var BPromise=require(_0x88c6('0x2'));var rs=require(_0x88c6('0x3'));var fs=require('fs');var Redis=require(_0x88c6('0x4'));var db=require(_0x88c6('0x5'))['db'];var utils=require(_0x88c6('0x6'));var logger=require(_0x88c6('0x7'))('rpc');var config=require(_0x88c6('0x8'));var jayson=require(_0x88c6('0x9'));var client=jayson[_0x88c6('0xa')][_0x88c6('0xb')]({'port':0x232a});config[_0x88c6('0xc')]=_['defaults'](config['redis'],{'host':_0x88c6('0xd'),'port':0x18eb});var socket=require(_0x88c6('0xe'))(new Redis(config[_0x88c6('0xc')]));require(_0x88c6('0xf'))[_0x88c6('0x10')](socket);function respondWithRpcPromise(_0x39fc49,_0x1f0376,_0xc379a3){return new BPromise(function(_0x4b4310,_0x555e4e){return client[_0x88c6('0x11')](_0x39fc49,_0xc379a3)[_0x88c6('0x12')](function(_0x596408){logger[_0x88c6('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x1f0376,'request\x20sent');logger[_0x88c6('0x14')](_0x88c6('0x15'),_0x1f0376,_0x88c6('0x16'),JSON[_0x88c6('0x17')](_0x596408));if(_0x596408[_0x88c6('0x18')]){if(_0x596408[_0x88c6('0x18')][_0x88c6('0x19')]===0x1f4){logger['error'](_0x88c6('0x1a'),_0x1f0376,_0x596408[_0x88c6('0x18')][_0x88c6('0x1b')]);return _0x555e4e(_0x596408[_0x88c6('0x18')][_0x88c6('0x1b')]);}logger[_0x88c6('0x18')](_0x88c6('0x1a'),_0x1f0376,_0x596408[_0x88c6('0x18')][_0x88c6('0x1b')]);return _0x4b4310(_0x596408[_0x88c6('0x18')]['message']);}else{logger[_0x88c6('0x13')](_0x88c6('0x1a'),_0x1f0376,_0x88c6('0x16'));_0x4b4310(_0x596408[_0x88c6('0x1c')][_0x88c6('0x1b')]);}})[_0x88c6('0x1d')](function(_0x12e07f){logger[_0x88c6('0x18')](_0x88c6('0x1a'),_0x1f0376,_0x12e07f);_0x555e4e(_0x12e07f);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index b9c9859..d280094 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 _0x0eaa=['emit','removeListener','register','./chatInternalMessage.events','save'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x177aa9,_0x262243){_0x177aa9=_0x177aa9-0x0;var _0x27d3e7=_0x0eaa[_0x177aa9];return _0x27d3e7;};'use strict';var ChatInternalMessageEvents=require(_0xa0ea('0x0'));var events=[_0xa0ea('0x1'),'remove','update'];function createListener(_0x17efb8,_0x1fe195){return function(_0x5800e9){_0x1fe195[_0xa0ea('0x2')](_0x17efb8,_0x5800e9);};}function removeListener(_0x1c74b8,_0x30dd52){return function(){ChatInternalMessageEvents[_0xa0ea('0x3')](_0x1c74b8,_0x30dd52);};}exports[_0xa0ea('0x4')]=function(_0x5636ed){for(var _0x3c6586=0x0,_0x521881=events['length'];_0x3c6586<_0x521881;_0x3c6586++){var _0x361178=events[_0x3c6586];var _0x8632a1=createListener('chatInternalMessage:'+_0x361178,_0x5636ed);ChatInternalMessageEvents['on'](_0x361178,_0x8632a1);}}; \ No newline at end of file +var _0xcf1c=['chatInternalMessage:','./chatInternalMessage.events','save','update','removeListener','length'];(function(_0x97d252,_0x5c55aa){var _0x535670=function(_0x636a4a){while(--_0x636a4a){_0x97d252['push'](_0x97d252['shift']());}};_0x535670(++_0x5c55aa);}(_0xcf1c,0x18d));var _0xccf1=function(_0x1a0ef3,_0x535bbf){_0x1a0ef3=_0x1a0ef3-0x0;var _0x2b86da=_0xcf1c[_0x1a0ef3];return _0x2b86da;};'use strict';var ChatInternalMessageEvents=require(_0xccf1('0x0'));var events=[_0xccf1('0x1'),'remove',_0xccf1('0x2')];function createListener(_0x3b9acb,_0x1d0b09){return function(_0x2800a8){_0x1d0b09['emit'](_0x3b9acb,_0x2800a8);};}function removeListener(_0x5d3e85,_0x509c8d){return function(){ChatInternalMessageEvents[_0xccf1('0x3')](_0x5d3e85,_0x509c8d);};}exports['register']=function(_0x17e358){for(var _0x2ee316=0x0,_0x2c381f=events[_0xccf1('0x4')];_0x2ee316<_0x2c381f;_0x2ee316++){var _0x1ee241=events[_0x2ee316];var _0x12ca5d=createListener(_0xccf1('0x5')+_0x1ee241,_0x17e358);ChatInternalMessageEvents['on'](_0x1ee241,_0x12ca5d);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 105d9a3..6493491 100644 --- a/server/api/chatInternalMessage/index.js +++ b/server/api/chatInternalMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','put','update','delete'];(function(_0x5b6207,_0x43eab0){var _0x3de868=function(_0x310743){while(--_0x310743){_0x5b6207['push'](_0x5b6207['shift']());}};_0x3de868(++_0x43eab0);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['get'](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')]('/',auth[_0x3071('0x8')](),controller['create']);router[_0x3071('0x11')](_0x3071('0xe'),controller[_0x3071('0x12')]);router[_0x3071('0x13')](_0x3071('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file +var _0xa9e0=['destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','/users','/:id','show','post','delete'];(function(_0x557c0c,_0x21d92c){var _0x576852=function(_0x4f83c7){while(--_0x4f83c7){_0x557c0c['push'](_0x557c0c['shift']());}};_0x576852(++_0x21d92c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getUsers']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['put']('/:id',controller['update']);router[_0x0a9e('0xe')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xf')]);module[_0x0a9e('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 7340b06..58d8539 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 _0xfa8d=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0xa41c29,_0x34b863){var _0x31b8d0=function(_0x5fb908){while(--_0x5fb908){_0xa41c29['push'](_0xa41c29['shift']());}};_0x31b8d0(++_0x34b863);}(_0xfa8d,0x70));var _0xdfa8=function(_0x3a0c4f,_0x5dd1a3){_0x3a0c4f=_0x3a0c4f-0x0;var _0x247049=_0xfa8d[_0x3a0c4f];return _0x247049;};'use strict';var Sequelize=require('sequelize');module[_0xdfa8('0x0')]={'body':{'type':Sequelize[_0xdfa8('0x1')](_0xdfa8('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xdfa8('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdfa8('0x4')]('in',_0xdfa8('0x5')),'defaultValue':_0xdfa8('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xdfa8('0x6')]}}; \ No newline at end of file +var _0x0693=['BOOLEAN','ENUM','DATE','sequelize','exports','medium'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x0693,0x135));var _0x3069=function(_0x252ca8,_0x19a004){_0x252ca8=_0x252ca8-0x0;var _0x222b2b=_0x0693[_0x252ca8];return _0x222b2b;};'use strict';var Sequelize=require(_0x3069('0x0'));module[_0x3069('0x1')]={'body':{'type':Sequelize['TEXT'](_0x3069('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3069('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3069('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x3069('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index c4953a4..a1376d0 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 _0x29f2=['./chatMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','count','offset','set','Content-Range','reject','update','destroy','end','stack','name','send','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','options','findAll','rows','show','params','fields','includeAll','find','create','body','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','ChatInteraction','ChatInteractionId','interaction','role','null','acceptMessage','manual','interface','SIP/%s','event','EventManager','acceptmessage','parse','formData','agent','RejectMessage','rejectMessage','channel','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter'];(function(_0xd60031,_0x5efb93){var _0x43d00a=function(_0x21ac92){while(--_0x21ac92){_0xd60031['push'](_0xd60031['shift']());}};_0x43d00a(++_0x5efb93);}(_0x29f2,0x159));var _0x229f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29f2[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x229f('0x0'));var emlformat=require(_0x229f('0x1'));var rimraf=require(_0x229f('0x2'));var zipdir=require(_0x229f('0x3'));var jsonpatch=require(_0x229f('0x4'));var rp=require(_0x229f('0x5'));var moment=require(_0x229f('0x6'));var BPromise=require(_0x229f('0x7'));var Mustache=require(_0x229f('0x8'));var util=require(_0x229f('0x9'));var path=require(_0x229f('0xa'));var sox=require('sox');var csv=require(_0x229f('0xb'));var ejs=require(_0x229f('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x229f('0xd'));var crypto=require('crypto');var jsforce=require(_0x229f('0xe'));var deskjs=require(_0x229f('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x229f('0x10'));var authService=require(_0x229f('0x11'));var qs=require(_0x229f('0x12'));var as=require(_0x229f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x229f('0x14'))(_0x229f('0x15'));var utils=require('../../config/utils');var config=require(_0x229f('0x16'));var db=require(_0x229f('0x17'))['db'];config['redis']=_[_0x229f('0x18')](config['redis'],{'host':_0x229f('0x19'),'port':0x18eb});var socket=require(_0x229f('0x1a'))(new Redis(config['redis']));require(_0x229f('0x1b'))[_0x229f('0x1c')](socket);var jayson=require(_0x229f('0x1d'));var client=jayson[_0x229f('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x229f('0x1e')][_0x229f('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x1844cd,_0x1f2b6e,_0x424a86){if(_0x424a86){var _0x4ea9dd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4ea9dd[_0x229f('0x20')](_0x1f2b6e)){return _0x1844cd;}else{throw new db[(_0x229f('0x21'))][(_0x229f('0x22'))](_0x229f('0x23'));}}else{return _0x1844cd;}}function respondWithRpcPromise(_0x4ec2fe,_0x33cd41,_0x74552f,_0x29499f){return new BPromise(function(_0x4609bd,_0x1a6c67){var _0x1d1375=_0x29499f||client;return _0x1d1375[_0x229f('0x24')](_0x4ec2fe,_0x74552f)[_0x229f('0x25')](function(_0x3242bf){logger['info']('ChatMessage,\x20%s,\x20%s',_0x33cd41,_0x229f('0x26'));logger[_0x229f('0x27')](_0x229f('0x28'),_0x33cd41,'request\x20sent',JSON[_0x229f('0x29')](_0x3242bf));if(_0x3242bf[_0x229f('0x2a')]){if(_0x3242bf['error'][_0x229f('0x2b')]===0x1f4){logger[_0x229f('0x2a')](_0x229f('0x2c'),_0x33cd41,_0x3242bf[_0x229f('0x2a')][_0x229f('0x2d')]);return _0x1a6c67(_0x3242bf[_0x229f('0x2a')]['message']);}logger[_0x229f('0x2a')](_0x229f('0x2c'),_0x33cd41,_0x3242bf[_0x229f('0x2a')]['message']);return _0x4609bd(_0x3242bf['error'][_0x229f('0x2d')]);}else{logger[_0x229f('0x2e')](_0x229f('0x2c'),_0x33cd41,_0x229f('0x26'));_0x4609bd(_0x3242bf[_0x229f('0x2f')][_0x229f('0x2d')]);}})[_0x229f('0x30')](function(_0x23f266){logger[_0x229f('0x2a')](_0x229f('0x2c'),_0x33cd41,_0x23f266);_0x1a6c67(_0x23f266);});});}function respondWithStatusCode(_0x49496e,_0x3a10a2){_0x3a10a2=_0x3a10a2||0xcc;return function(_0x575228){if(_0x575228){return _0x49496e[_0x229f('0x31')](_0x3a10a2);}return _0x49496e[_0x229f('0x32')](_0x3a10a2)['end']();};}function respondWithResult(_0x3340f3,_0x231c73){_0x231c73=_0x231c73||0xc8;return function(_0x62a430){if(_0x62a430){return _0x3340f3[_0x229f('0x32')](_0x231c73)['json'](_0x62a430);}};}function respondWithFilteredResult(_0x1dac5e,_0x5cd5a6){return function(_0x11eade){if(_0x11eade){var _0x41c622=_0x11eade[_0x229f('0x33')],_0x17f58a=_0x5cd5a6[_0x229f('0x34')],_0x2544b9=_0x5cd5a6[_0x229f('0x34')]+_0x5cd5a6['limit'],_0xf667a5;if(_0x2544b9>=_0x41c622){_0x2544b9=_0x41c622;_0xf667a5=0xc8;}else{_0xf667a5=0xce;}_0x1dac5e['status'](_0xf667a5);return _0x1dac5e[_0x229f('0x35')](_0x229f('0x36'),_0x17f58a+'-'+_0x2544b9+'/'+_0x41c622)['json'](_0x11eade);}return null;};}function patchUpdates(_0x38b395){return function(_0x31109d){try{jsonpatch['apply'](_0x31109d,_0x38b395,!![]);}catch(_0xa55136){return BPromise[_0x229f('0x37')](_0xa55136);}return _0x31109d['save']();};}function saveUpdates(_0xc92975,_0x838c1e){return function(_0x81ad68){if(_0x81ad68){return _0x81ad68[_0x229f('0x38')](_0xc92975)[_0x229f('0x25')](function(_0x440794){return _0x440794;});}return null;};}function removeEntity(_0x171128,_0x16c9e9){return function(_0x4ab54f){if(_0x4ab54f){return _0x4ab54f[_0x229f('0x39')]()['then'](function(){_0x171128[_0x229f('0x32')](0xcc)[_0x229f('0x3a')]();});}};}function handleEntityNotFound(_0x5abeaa,_0x118a1d){return function(_0x100e23){if(!_0x100e23){_0x5abeaa[_0x229f('0x31')](0x194);}return _0x100e23;};}function handleError(_0x3d593d,_0x4dad4a){_0x4dad4a=_0x4dad4a||0x1f4;return function(_0x1d38b6){logger[_0x229f('0x2a')](_0x1d38b6[_0x229f('0x3b')]);if(_0x1d38b6['name']){delete _0x1d38b6[_0x229f('0x3c')];}_0x3d593d[_0x229f('0x32')](_0x4dad4a)[_0x229f('0x3d')](_0x1d38b6);};}exports['index']=function(_0x3c3d0c,_0x193248){var _0x3f4c31={},_0x3d5aa1={},_0x54f73f={'count':0x0,'rows':[]};var _0xcecd49=_[_0x229f('0x3e')](db[_0x229f('0x3f')][_0x229f('0x40')],function(_0x4d9f4a){return{'name':_0x4d9f4a[_0x229f('0x41')],'type':_0x4d9f4a[_0x229f('0x42')][_0x229f('0x43')]};});_0x3d5aa1[_0x229f('0x44')]=_[_0x229f('0x3e')](_0xcecd49,_0x229f('0x3c'));_0x3d5aa1[_0x229f('0x45')]=_[_0x229f('0x46')](_0x3c3d0c[_0x229f('0x45')]);_0x3d5aa1['filters']=_[_0x229f('0x47')](_0x3d5aa1[_0x229f('0x44')],_0x3d5aa1[_0x229f('0x45')]);_0x3f4c31[_0x229f('0x48')]=_[_0x229f('0x47')](_0x3d5aa1[_0x229f('0x44')],qs['fields'](_0x3c3d0c['query']['fields']));_0x3f4c31[_0x229f('0x48')]=_0x3f4c31[_0x229f('0x48')][_0x229f('0x49')]?_0x3f4c31[_0x229f('0x48')]:_0x3d5aa1[_0x229f('0x44')];if(!_0x3c3d0c[_0x229f('0x45')][_0x229f('0x4a')]('nolimit')){_0x3f4c31[_0x229f('0x4b')]=qs['limit'](_0x3c3d0c['query']['limit']);_0x3f4c31[_0x229f('0x34')]=qs['offset'](_0x3c3d0c['query'][_0x229f('0x34')]);}_0x3f4c31[_0x229f('0x4c')]=qs['sort'](_0x3c3d0c[_0x229f('0x45')][_0x229f('0x4d')]);_0x3f4c31[_0x229f('0x4e')]=qs[_0x229f('0x4f')](_[_0x229f('0x50')](_0x3c3d0c['query'],_0x3d5aa1[_0x229f('0x4f')]),_0xcecd49);if(_0x3c3d0c['query']['filter']){_0x3f4c31[_0x229f('0x4e')]=_['merge'](_0x3f4c31['where'],{'$or':_['map'](_0xcecd49,function(_0x4dc1a4){if(_0x4dc1a4['type']!=='VIRTUAL'){var _0x4a2d8f={};_0x4a2d8f[_0x4dc1a4[_0x229f('0x3c')]]={'$like':'%'+_0x3c3d0c[_0x229f('0x45')][_0x229f('0x51')]+'%'};return _0x4a2d8f;}})});}_0x3f4c31=_[_0x229f('0x52')]({},_0x3f4c31,_0x3c3d0c[_0x229f('0x53')]);var _0x2014ef={'where':_0x3f4c31[_0x229f('0x4e')]};return db['ChatMessage']['count'](_0x2014ef)['then'](function(_0x58d780){_0x54f73f[_0x229f('0x33')]=_0x58d780;if(_0x3c3d0c['query']['includeAll']){_0x3f4c31['include']=[{'all':!![]}];}return db[_0x229f('0x3f')][_0x229f('0x54')](_0x3f4c31);})[_0x229f('0x25')](function(_0x4fb2dd){_0x54f73f[_0x229f('0x55')]=_0x4fb2dd;return _0x54f73f;})['then'](respondWithFilteredResult(_0x193248,_0x3f4c31))[_0x229f('0x30')](handleError(_0x193248,null));};exports[_0x229f('0x56')]=function(_0x367ae2,_0x5b71a4){var _0x2df67e={'raw':!![],'where':{'id':_0x367ae2[_0x229f('0x57')]['id']}},_0x5aac98={};_0x5aac98[_0x229f('0x44')]=_[_0x229f('0x46')](db[_0x229f('0x3f')][_0x229f('0x40')]);_0x5aac98[_0x229f('0x45')]=_[_0x229f('0x46')](_0x367ae2[_0x229f('0x45')]);_0x5aac98[_0x229f('0x4f')]=_[_0x229f('0x47')](_0x5aac98['model'],_0x5aac98['query']);_0x2df67e[_0x229f('0x48')]=_[_0x229f('0x47')](_0x5aac98[_0x229f('0x44')],qs[_0x229f('0x58')](_0x367ae2[_0x229f('0x45')][_0x229f('0x58')]));_0x2df67e[_0x229f('0x48')]=_0x2df67e['attributes'][_0x229f('0x49')]?_0x2df67e[_0x229f('0x48')]:_0x5aac98[_0x229f('0x44')];if(_0x367ae2['query'][_0x229f('0x59')]){_0x2df67e['include']=[{'all':!![]}];}_0x2df67e=_[_0x229f('0x52')]({},_0x2df67e,_0x367ae2[_0x229f('0x53')]);return db['ChatMessage'][_0x229f('0x5a')](_0x2df67e)[_0x229f('0x25')](handleEntityNotFound(_0x5b71a4,null))[_0x229f('0x25')](respondWithResult(_0x5b71a4,null))[_0x229f('0x30')](handleError(_0x5b71a4,null));};exports[_0x229f('0x5b')]=function(_0x5aa012,_0x20d88a){return db['ChatMessage'][_0x229f('0x5b')](_0x5aa012[_0x229f('0x5c')],{})['then'](respondWithResult(_0x20d88a,0xc9))[_0x229f('0x30')](handleError(_0x20d88a,null));};exports['update']=function(_0x1b8496,_0x1e8691){if(_0x1b8496[_0x229f('0x5c')]['id']){delete _0x1b8496[_0x229f('0x5c')]['id'];}return db[_0x229f('0x3f')]['find']({'where':{'id':_0x1b8496[_0x229f('0x57')]['id']}})[_0x229f('0x25')](handleEntityNotFound(_0x1e8691,null))[_0x229f('0x25')](saveUpdates(_0x1b8496[_0x229f('0x5c')],null))[_0x229f('0x25')](respondWithResult(_0x1e8691,null))[_0x229f('0x30')](handleError(_0x1e8691,null));};exports['destroy']=function(_0x2c2da8,_0x325575){return db[_0x229f('0x3f')][_0x229f('0x5a')]({'where':{'id':_0x2c2da8[_0x229f('0x57')]['id']}})[_0x229f('0x25')](handleEntityNotFound(_0x325575,null))[_0x229f('0x25')](removeEntity(_0x325575,null))[_0x229f('0x30')](handleError(_0x325575,null));};exports[_0x229f('0x5d')]=function(_0x4386af,_0x215f53){return db[_0x229f('0x3f')]['describe']()[_0x229f('0x25')](respondWithResult(_0x215f53,null))[_0x229f('0x30')](handleError(_0x215f53,null));};var interaction_log=require(_0x229f('0x14'))(_0x229f('0x5e'));exports[_0x229f('0x5f')]=function(_0x754bb0,_0x4e73ec,_0x5e43cd){var _0x12d973={'channel':_0x229f('0x60')};if(_0x754bb0[_0x229f('0x5c')]['id']){delete _0x754bb0[_0x229f('0x5c')]['id'];}_0x754bb0[_0x229f('0x5c')][_0x229f('0x61')]=!![];_0x754bb0['body'][_0x229f('0x62')]=moment()[_0x229f('0x63')](_0x229f('0x64'));_0x754bb0['body'][_0x229f('0x65')]=_0x754bb0[_0x229f('0x5c')][_0x229f('0x65')]||_0x754bb0[_0x229f('0x66')]['id'];return db[_0x229f('0x3f')][_0x229f('0x5a')]({'where':{'id':_0x754bb0['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x229f('0x67')}]})[_0x229f('0x25')](handleEntityNotFound(_0x4e73ec,null))[_0x229f('0x25')](saveUpdates(_0x754bb0[_0x229f('0x5c')],null))[_0x229f('0x25')](function(_0x160817){if(_0x160817){_0x12d973['message']=_0x160817[_0x229f('0x68')]({'plain':!![]});return db[_0x229f('0x69')][_0x229f('0x5a')]({'where':{'id':_0x160817[_0x229f('0x6a')]}});}return null;})[_0x229f('0x25')](handleEntityNotFound(_0x4e73ec,null))['then'](function(_0x677c4){if(_0x677c4){return _0x677c4[_0x229f('0x38')]({'UserId':_0x754bb0['body'][_0x229f('0x65')],'read1stAt':_['isNil'](_0x677c4['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x229f('0x25')](function(_0x38a9c1){if(_0x38a9c1){_0x12d973[_0x229f('0x6b')]=_0x38a9c1[_0x229f('0x68')]({'plain':!![]});interaction_log[_0x229f('0x2e')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x754bb0[_0x229f('0x66')]['id'],_0x754bb0[_0x229f('0x66')]['name'],_0x754bb0['user'][_0x229f('0x6c')],_0x12d973[_0x229f('0x6b')]['id'],_0x754bb0[_0x229f('0x5c')]?JSON[_0x229f('0x29')](_0x754bb0['body']):_0x229f('0x6d'));return respondWithRpcPromise('AcceptMessage',_0x229f('0x6e'),_0x12d973);}return null;})[_0x229f('0x25')](function(_0xcf1bea){if(_0xcf1bea){if(_0x754bb0['body'][_0x229f('0x6f')]){_0x12d973['message'][_0x229f('0x70')]=util[_0x229f('0x63')](_0x229f('0x71'),_0x754bb0['user'][_0x229f('0x3c')]);_0x12d973[_0x229f('0x2d')]['channel']=_0x12d973['channel'];_0x12d973[_0x229f('0x2d')][_0x229f('0x72')]=_0x229f('0x5f');return respondWithRpcPromise('EventManager',_0x229f('0x73'),{'event':_0x229f('0x74'),'message':_[_0x229f('0x52')](_0x12d973[_0x229f('0x2d')],JSON[_0x229f('0x75')](_0x12d973[_0x229f('0x6b')][_0x229f('0x76')]))},client9002)[_0x229f('0x25')](function(){return _0x12d973;});}return _0x12d973;}return null;})[_0x229f('0x25')](respondWithResult(_0x4e73ec,null))[_0x229f('0x30')](handleError(_0x4e73ec,null));};var interaction_log=require(_0x229f('0x14'))('chat-interactions');exports[_0x229f('0x37')]=function(_0x34e13e,_0x5ad775,_0x5fa19c){var _0x172c73={'agent':{},'channel':_0x229f('0x60')};if(_0x34e13e[_0x229f('0x5c')]['id']){delete _0x34e13e[_0x229f('0x5c')]['id'];}_0x34e13e['body'][_0x229f('0x65')]=_0x34e13e['body'][_0x229f('0x65')]||_0x34e13e[_0x229f('0x66')]['id'];_0x172c73[_0x229f('0x77')]['id']=_0x34e13e['body'][_0x229f('0x65')];return db['ChatMessage'][_0x229f('0x5a')]({'where':{'id':_0x34e13e['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5ad775,null))['then'](function(_0x4e1bdc){if(_0x4e1bdc){_0x172c73['message']=_0x4e1bdc[_0x229f('0x68')]({'plain':!![]});return db[_0x229f('0x69')][_0x229f('0x5a')]({'where':{'id':_0x4e1bdc[_0x229f('0x6a')]}});}return null;})[_0x229f('0x25')](handleEntityNotFound(_0x5ad775,null))['then'](function(_0x278199){if(_0x278199){_0x172c73[_0x229f('0x6b')]=_0x278199['get']({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x34e13e[_0x229f('0x66')]['id'],_0x34e13e[_0x229f('0x66')]['name'],_0x34e13e[_0x229f('0x66')][_0x229f('0x6c')],_0x172c73[_0x229f('0x6b')]['id'],_0x34e13e[_0x229f('0x5c')]?JSON[_0x229f('0x29')](_0x34e13e['body']):'null');return respondWithRpcPromise(_0x229f('0x78'),_0x229f('0x79'),_0x172c73);}return null;})[_0x229f('0x25')](function(_0x554a13){if(_0x554a13){_0x554a13['message'][_0x229f('0x70')]=util[_0x229f('0x63')](_0x229f('0x71'),_0x34e13e['user'][_0x229f('0x3c')]);_0x554a13[_0x229f('0x2d')][_0x229f('0x7a')]=_0x172c73[_0x229f('0x7a')];_0x554a13[_0x229f('0x2d')][_0x229f('0x72')]=_0x229f('0x37');respondWithRpcPromise('EventManager',_0x229f('0x73'),{'event':_0x229f('0x7b'),'message':_0x554a13[_0x229f('0x2d')]},client9002);return _0x172c73;}return null;})[_0x229f('0x25')](respondWithResult(_0x5ad775,null))[_0x229f('0x30')](handleError(_0x5ad775,null));}; \ No newline at end of file +var _0x5717=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ChatMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','end','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','keys','length','include','options','find','create','body','params','describe','chat-interactions','chat','read','readAt','format','UserId','user','Contact','get','ChatInteraction','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','formData','agent','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','interface','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js'];(function(_0x30b0d8,_0x57470c){var _0x459c09=function(_0x5e51b6){while(--_0x5e51b6){_0x30b0d8['push'](_0x30b0d8['shift']());}};_0x459c09(++_0x57470c);}(_0x5717,0xf4));var _0x7571=function(_0x4f389b,_0x59951d){_0x4f389b=_0x4f389b-0x0;var _0x516950=_0x5717[_0x4f389b];return _0x516950;};'use strict';var pdf=require(_0x7571('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7571('0x1'));var zipdir=require(_0x7571('0x2'));var jsonpatch=require(_0x7571('0x3'));var rp=require(_0x7571('0x4'));var moment=require(_0x7571('0x5'));var BPromise=require(_0x7571('0x6'));var Mustache=require(_0x7571('0x7'));var util=require(_0x7571('0x8'));var path=require('path');var sox=require(_0x7571('0x9'));var csv=require(_0x7571('0xa'));var ejs=require(_0x7571('0xb'));var fs=require('fs');var _=require(_0x7571('0xc'));var squel=require(_0x7571('0xd'));var crypto=require('crypto');var jsforce=require(_0x7571('0xe'));var deskjs=require(_0x7571('0xf'));var toCsv=require(_0x7571('0xa'));var querystring=require(_0x7571('0x10'));var Papa=require(_0x7571('0x11'));var Redis=require(_0x7571('0x12'));var authService=require(_0x7571('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7571('0x14'));var hardwareService=require(_0x7571('0x15'));var logger=require(_0x7571('0x16'))(_0x7571('0x17'));var utils=require(_0x7571('0x18'));var config=require(_0x7571('0x19'));var db=require(_0x7571('0x1a'))['db'];config[_0x7571('0x1b')]=_[_0x7571('0x1c')](config['redis'],{'host':_0x7571('0x1d'),'port':0x18eb});var socket=require(_0x7571('0x1e'))(new Redis(config[_0x7571('0x1b')]));require(_0x7571('0x1f'))[_0x7571('0x20')](socket);var jayson=require(_0x7571('0x21'));var client=jayson[_0x7571('0x22')][_0x7571('0x23')]({'port':0x232c});var client9002=jayson[_0x7571('0x22')][_0x7571('0x23')]({'port':0x232a});function checkPasswordPattern(_0x49db42,_0x2c45d9,_0x350c41){if(_0x350c41){var _0x3ec2f6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3ec2f6[_0x7571('0x24')](_0x2c45d9)){return _0x49db42;}else{throw new db[(_0x7571('0x25'))]['ValidationError'](_0x7571('0x26'));}}else{return _0x49db42;}}function respondWithRpcPromise(_0x41d307,_0x33fb3c,_0x5938a8,_0x500348){return new BPromise(function(_0x198aea,_0xcf8d60){var _0x2a6e5f=_0x500348||client;return _0x2a6e5f['request'](_0x41d307,_0x5938a8)[_0x7571('0x27')](function(_0x4d55d){logger[_0x7571('0x28')](_0x7571('0x29'),_0x33fb3c,'request\x20sent');logger[_0x7571('0x2a')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x33fb3c,_0x7571('0x2b'),JSON[_0x7571('0x2c')](_0x4d55d));if(_0x4d55d[_0x7571('0x2d')]){if(_0x4d55d['error'][_0x7571('0x2e')]===0x1f4){logger[_0x7571('0x2d')](_0x7571('0x29'),_0x33fb3c,_0x4d55d[_0x7571('0x2d')]['message']);return _0xcf8d60(_0x4d55d[_0x7571('0x2d')][_0x7571('0x2f')]);}logger[_0x7571('0x2d')]('ChatMessage,\x20%s,\x20%s',_0x33fb3c,_0x4d55d[_0x7571('0x2d')]['message']);return _0x198aea(_0x4d55d[_0x7571('0x2d')][_0x7571('0x2f')]);}else{logger[_0x7571('0x28')]('ChatMessage,\x20%s,\x20%s',_0x33fb3c,_0x7571('0x2b'));_0x198aea(_0x4d55d[_0x7571('0x30')][_0x7571('0x2f')]);}})[_0x7571('0x31')](function(_0x592ef3){logger[_0x7571('0x2d')]('ChatMessage,\x20%s,\x20%s',_0x33fb3c,_0x592ef3);_0xcf8d60(_0x592ef3);});});}function respondWithStatusCode(_0x5c4675,_0x43f152){_0x43f152=_0x43f152||0xcc;return function(_0x34193c){if(_0x34193c){return _0x5c4675[_0x7571('0x32')](_0x43f152);}return _0x5c4675[_0x7571('0x33')](_0x43f152)['end']();};}function respondWithResult(_0xa2e653,_0x1736f5){_0x1736f5=_0x1736f5||0xc8;return function(_0x65ac67){if(_0x65ac67){return _0xa2e653[_0x7571('0x33')](_0x1736f5)['json'](_0x65ac67);}};}function respondWithFilteredResult(_0x5144a4,_0x2da0cd){return function(_0x4befed){if(_0x4befed){var _0x1c51e2=_0x4befed['count'],_0x18261b=_0x2da0cd[_0x7571('0x34')],_0x16afe1=_0x2da0cd[_0x7571('0x34')]+_0x2da0cd[_0x7571('0x35')],_0x1e7a74;if(_0x16afe1>=_0x1c51e2){_0x16afe1=_0x1c51e2;_0x1e7a74=0xc8;}else{_0x1e7a74=0xce;}_0x5144a4[_0x7571('0x33')](_0x1e7a74);return _0x5144a4[_0x7571('0x36')](_0x7571('0x37'),_0x18261b+'-'+_0x16afe1+'/'+_0x1c51e2)[_0x7571('0x38')](_0x4befed);}return null;};}function patchUpdates(_0x50f889){return function(_0x5e9d2a){try{jsonpatch[_0x7571('0x39')](_0x5e9d2a,_0x50f889,!![]);}catch(_0x4247f3){return BPromise[_0x7571('0x3a')](_0x4247f3);}return _0x5e9d2a[_0x7571('0x3b')]();};}function saveUpdates(_0x31fc83,_0x4a28cf){return function(_0x424c4f){if(_0x424c4f){return _0x424c4f[_0x7571('0x3c')](_0x31fc83)['then'](function(_0x435f46){return _0x435f46;});}return null;};}function removeEntity(_0x32f26c,_0x5c6d98){return function(_0x40e26b){if(_0x40e26b){return _0x40e26b[_0x7571('0x3d')]()[_0x7571('0x27')](function(){_0x32f26c[_0x7571('0x33')](0xcc)[_0x7571('0x3e')]();});}};}function handleEntityNotFound(_0x20f52d,_0x78de52){return function(_0x1eec2d){if(!_0x1eec2d){_0x20f52d[_0x7571('0x32')](0x194);}return _0x1eec2d;};}function handleError(_0x90bb73,_0x497f12){_0x497f12=_0x497f12||0x1f4;return function(_0x5ab4c3){logger[_0x7571('0x2d')](_0x5ab4c3[_0x7571('0x3f')]);if(_0x5ab4c3['name']){delete _0x5ab4c3[_0x7571('0x40')];}_0x90bb73[_0x7571('0x33')](_0x497f12)[_0x7571('0x41')](_0x5ab4c3);};}exports[_0x7571('0x42')]=function(_0x36c756,_0x2269f5){var _0x4a0a91={},_0x59c044={},_0x1253a4={'count':0x0,'rows':[]};var _0x135e5e=_[_0x7571('0x43')](db[_0x7571('0x44')][_0x7571('0x45')],function(_0x324b66){return{'name':_0x324b66[_0x7571('0x46')],'type':_0x324b66[_0x7571('0x47')][_0x7571('0x48')]};});_0x59c044[_0x7571('0x49')]=_['map'](_0x135e5e,'name');_0x59c044[_0x7571('0x4a')]=_['keys'](_0x36c756[_0x7571('0x4a')]);_0x59c044['filters']=_[_0x7571('0x4b')](_0x59c044[_0x7571('0x49')],_0x59c044['query']);_0x4a0a91[_0x7571('0x4c')]=_[_0x7571('0x4b')](_0x59c044[_0x7571('0x49')],qs[_0x7571('0x4d')](_0x36c756[_0x7571('0x4a')][_0x7571('0x4d')]));_0x4a0a91['attributes']=_0x4a0a91['attributes']['length']?_0x4a0a91[_0x7571('0x4c')]:_0x59c044['model'];if(!_0x36c756[_0x7571('0x4a')][_0x7571('0x4e')](_0x7571('0x4f'))){_0x4a0a91['limit']=qs[_0x7571('0x35')](_0x36c756[_0x7571('0x4a')]['limit']);_0x4a0a91['offset']=qs[_0x7571('0x34')](_0x36c756[_0x7571('0x4a')]['offset']);}_0x4a0a91[_0x7571('0x50')]=qs['sort'](_0x36c756[_0x7571('0x4a')][_0x7571('0x51')]);_0x4a0a91[_0x7571('0x52')]=qs[_0x7571('0x53')](_[_0x7571('0x54')](_0x36c756[_0x7571('0x4a')],_0x59c044[_0x7571('0x53')]),_0x135e5e);if(_0x36c756[_0x7571('0x4a')][_0x7571('0x55')]){_0x4a0a91[_0x7571('0x52')]=_[_0x7571('0x56')](_0x4a0a91[_0x7571('0x52')],{'$or':_[_0x7571('0x43')](_0x135e5e,function(_0x2ed667){if(_0x2ed667['type']!==_0x7571('0x57')){var _0x3d3684={};_0x3d3684[_0x2ed667[_0x7571('0x40')]]={'$like':'%'+_0x36c756[_0x7571('0x4a')]['filter']+'%'};return _0x3d3684;}})});}_0x4a0a91=_['merge']({},_0x4a0a91,_0x36c756['options']);var _0x1d7ffd={'where':_0x4a0a91[_0x7571('0x52')]};return db[_0x7571('0x44')][_0x7571('0x58')](_0x1d7ffd)['then'](function(_0x12ec3e){_0x1253a4[_0x7571('0x58')]=_0x12ec3e;if(_0x36c756['query'][_0x7571('0x59')]){_0x4a0a91['include']=[{'all':!![]}];}return db['ChatMessage'][_0x7571('0x5a')](_0x4a0a91);})['then'](function(_0x5a776d){_0x1253a4[_0x7571('0x5b')]=_0x5a776d;return _0x1253a4;})[_0x7571('0x27')](respondWithFilteredResult(_0x2269f5,_0x4a0a91))['catch'](handleError(_0x2269f5,null));};exports['show']=function(_0x5c1dd0,_0x3545d5){var _0x4e24bb={'raw':!![],'where':{'id':_0x5c1dd0['params']['id']}},_0x10cbbd={};_0x10cbbd['model']=_['keys'](db[_0x7571('0x44')]['rawAttributes']);_0x10cbbd[_0x7571('0x4a')]=_[_0x7571('0x5c')](_0x5c1dd0[_0x7571('0x4a')]);_0x10cbbd[_0x7571('0x53')]=_[_0x7571('0x4b')](_0x10cbbd[_0x7571('0x49')],_0x10cbbd[_0x7571('0x4a')]);_0x4e24bb['attributes']=_[_0x7571('0x4b')](_0x10cbbd['model'],qs[_0x7571('0x4d')](_0x5c1dd0[_0x7571('0x4a')][_0x7571('0x4d')]));_0x4e24bb[_0x7571('0x4c')]=_0x4e24bb['attributes'][_0x7571('0x5d')]?_0x4e24bb['attributes']:_0x10cbbd[_0x7571('0x49')];if(_0x5c1dd0[_0x7571('0x4a')][_0x7571('0x59')]){_0x4e24bb[_0x7571('0x5e')]=[{'all':!![]}];}_0x4e24bb=_[_0x7571('0x56')]({},_0x4e24bb,_0x5c1dd0[_0x7571('0x5f')]);return db[_0x7571('0x44')][_0x7571('0x60')](_0x4e24bb)[_0x7571('0x27')](handleEntityNotFound(_0x3545d5,null))[_0x7571('0x27')](respondWithResult(_0x3545d5,null))['catch'](handleError(_0x3545d5,null));};exports[_0x7571('0x61')]=function(_0x16261c,_0x404f02){return db[_0x7571('0x44')][_0x7571('0x61')](_0x16261c[_0x7571('0x62')],{})[_0x7571('0x27')](respondWithResult(_0x404f02,0xc9))['catch'](handleError(_0x404f02,null));};exports[_0x7571('0x3c')]=function(_0x4bc455,_0x474ad2){if(_0x4bc455[_0x7571('0x62')]['id']){delete _0x4bc455[_0x7571('0x62')]['id'];}return db[_0x7571('0x44')][_0x7571('0x60')]({'where':{'id':_0x4bc455[_0x7571('0x63')]['id']}})[_0x7571('0x27')](handleEntityNotFound(_0x474ad2,null))[_0x7571('0x27')](saveUpdates(_0x4bc455[_0x7571('0x62')],null))[_0x7571('0x27')](respondWithResult(_0x474ad2,null))[_0x7571('0x31')](handleError(_0x474ad2,null));};exports['destroy']=function(_0x2b25e2,_0x432f4b){return db[_0x7571('0x44')][_0x7571('0x60')]({'where':{'id':_0x2b25e2['params']['id']}})[_0x7571('0x27')](handleEntityNotFound(_0x432f4b,null))[_0x7571('0x27')](removeEntity(_0x432f4b,null))['catch'](handleError(_0x432f4b,null));};exports[_0x7571('0x64')]=function(_0x579c0c,_0x53d407){return db[_0x7571('0x44')][_0x7571('0x64')]()[_0x7571('0x27')](respondWithResult(_0x53d407,null))['catch'](handleError(_0x53d407,null));};var interaction_log=require(_0x7571('0x16'))(_0x7571('0x65'));exports['accept']=function(_0x24a276,_0x1ccf0c,_0x25085a){var _0x5486c9={'channel':_0x7571('0x66')};if(_0x24a276[_0x7571('0x62')]['id']){delete _0x24a276[_0x7571('0x62')]['id'];}_0x24a276[_0x7571('0x62')][_0x7571('0x67')]=!![];_0x24a276[_0x7571('0x62')][_0x7571('0x68')]=moment()[_0x7571('0x69')]('YYYY-MM-DD\x20HH:mm:ss');_0x24a276[_0x7571('0x62')][_0x7571('0x6a')]=_0x24a276[_0x7571('0x62')][_0x7571('0x6a')]||_0x24a276[_0x7571('0x6b')]['id'];return db[_0x7571('0x44')][_0x7571('0x60')]({'where':{'id':_0x24a276['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x7571('0x6c')}]})[_0x7571('0x27')](handleEntityNotFound(_0x1ccf0c,null))[_0x7571('0x27')](saveUpdates(_0x24a276[_0x7571('0x62')],null))['then'](function(_0x4943b9){if(_0x4943b9){_0x5486c9[_0x7571('0x2f')]=_0x4943b9[_0x7571('0x6d')]({'plain':!![]});return db[_0x7571('0x6e')][_0x7571('0x60')]({'where':{'id':_0x4943b9['ChatInteractionId']}});}return null;})[_0x7571('0x27')](handleEntityNotFound(_0x1ccf0c,null))[_0x7571('0x27')](function(_0x34a722){if(_0x34a722){return _0x34a722['update']({'UserId':_0x24a276['body'][_0x7571('0x6a')],'read1stAt':_[_0x7571('0x6f')](_0x34a722[_0x7571('0x70')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x2ba941){if(_0x2ba941){_0x5486c9[_0x7571('0x71')]=_0x2ba941[_0x7571('0x6d')]({'plain':!![]});interaction_log['info'](_0x7571('0x72'),_0x24a276[_0x7571('0x6b')]['id'],_0x24a276[_0x7571('0x6b')][_0x7571('0x40')],_0x24a276[_0x7571('0x6b')][_0x7571('0x73')],_0x5486c9[_0x7571('0x71')]['id'],_0x24a276[_0x7571('0x62')]?JSON['stringify'](_0x24a276[_0x7571('0x62')]):_0x7571('0x74'));return respondWithRpcPromise(_0x7571('0x75'),'acceptMessage',_0x5486c9);}return null;})[_0x7571('0x27')](function(_0x5dfb5a){if(_0x5dfb5a){if(_0x24a276['body'][_0x7571('0x76')]){_0x5486c9[_0x7571('0x2f')]['interface']=util[_0x7571('0x69')](_0x7571('0x77'),_0x24a276['user'][_0x7571('0x40')]);_0x5486c9['message'][_0x7571('0x78')]=_0x5486c9['channel'];_0x5486c9[_0x7571('0x2f')][_0x7571('0x79')]='accept';return respondWithRpcPromise(_0x7571('0x7a'),_0x7571('0x7a'),{'event':_0x7571('0x7b'),'message':_['merge'](_0x5486c9[_0x7571('0x2f')],JSON['parse'](_0x5486c9['interaction'][_0x7571('0x7c')]))},client9002)[_0x7571('0x27')](function(){return _0x5486c9;});}return _0x5486c9;}return null;})[_0x7571('0x27')](respondWithResult(_0x1ccf0c,null))[_0x7571('0x31')](handleError(_0x1ccf0c,null));};var interaction_log=require(_0x7571('0x16'))(_0x7571('0x65'));exports[_0x7571('0x3a')]=function(_0x5e6ba0,_0x5cc940,_0x51cfda){var _0x100950={'agent':{},'channel':_0x7571('0x66')};if(_0x5e6ba0[_0x7571('0x62')]['id']){delete _0x5e6ba0[_0x7571('0x62')]['id'];}_0x5e6ba0[_0x7571('0x62')][_0x7571('0x6a')]=_0x5e6ba0[_0x7571('0x62')][_0x7571('0x6a')]||_0x5e6ba0['user']['id'];_0x100950[_0x7571('0x7d')]['id']=_0x5e6ba0[_0x7571('0x62')][_0x7571('0x6a')];return db[_0x7571('0x44')]['find']({'where':{'id':_0x5e6ba0[_0x7571('0x63')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5cc940,null))[_0x7571('0x27')](function(_0xa3965d){if(_0xa3965d){_0x100950[_0x7571('0x2f')]=_0xa3965d[_0x7571('0x6d')]({'plain':!![]});return db[_0x7571('0x6e')][_0x7571('0x60')]({'where':{'id':_0xa3965d[_0x7571('0x7e')]}});}return null;})[_0x7571('0x27')](handleEntityNotFound(_0x5cc940,null))[_0x7571('0x27')](function(_0x58a462){if(_0x58a462){_0x100950[_0x7571('0x71')]=_0x58a462['get']({'plain':!![]});interaction_log[_0x7571('0x28')](_0x7571('0x7f'),_0x5e6ba0[_0x7571('0x6b')]['id'],_0x5e6ba0[_0x7571('0x6b')][_0x7571('0x40')],_0x5e6ba0['user'][_0x7571('0x73')],_0x100950['interaction']['id'],_0x5e6ba0[_0x7571('0x62')]?JSON[_0x7571('0x2c')](_0x5e6ba0[_0x7571('0x62')]):'null');return respondWithRpcPromise(_0x7571('0x80'),'rejectMessage',_0x100950);}return null;})['then'](function(_0x26e262){if(_0x26e262){_0x26e262[_0x7571('0x2f')][_0x7571('0x81')]=util['format'](_0x7571('0x77'),_0x5e6ba0['user'][_0x7571('0x40')]);_0x26e262[_0x7571('0x2f')][_0x7571('0x78')]=_0x100950[_0x7571('0x78')];_0x26e262[_0x7571('0x2f')][_0x7571('0x79')]=_0x7571('0x3a');respondWithRpcPromise('EventManager',_0x7571('0x7a'),{'event':'rejectmessage','message':_0x26e262['message']},client9002);return _0x100950;}return null;})[_0x7571('0x27')](respondWithResult(_0x5cc940,null))[_0x7571('0x31')](handleError(_0x5cc940,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 18d1ae1..2dce6a3 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 _0xbd0f=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x4a63e0,_0x4d034d){var _0x50a563=function(_0x34bee2){while(--_0x34bee2){_0x4a63e0['push'](_0x4a63e0['shift']());}};_0x50a563(++_0x4d034d);}(_0xbd0f,0x142));var _0xfbd0=function(_0x51d0b1,_0x472818){_0x51d0b1=_0x51d0b1-0x0;var _0x401af7=_0xbd0f[_0x51d0b1];return _0x401af7;};'use strict';var EventEmitter=require(_0xfbd0('0x0'));var ChatMessage=require(_0xfbd0('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xfbd0('0x2')](0x0);var events={'afterCreate':_0xfbd0('0x3'),'afterUpdate':_0xfbd0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4289ab){return function(_0x53ca15,_0x30fe80,_0x56f966){ChatMessageEvents[_0xfbd0('0x5')](_0x4289ab+':'+_0x53ca15['id'],_0x53ca15);ChatMessageEvents[_0xfbd0('0x5')](_0x4289ab,_0x53ca15);_0x56f966(null);};}for(var e in events){if(events[_0xfbd0('0x6')](e)){var event=events[e];ChatMessage[_0xfbd0('0x7')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x7947=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0xf89c3,_0x351bf1){var _0x274fc8=function(_0x5e0c91){while(--_0x5e0c91){_0xf89c3['push'](_0xf89c3['shift']());}};_0x274fc8(++_0x351bf1);}(_0x7947,0x15b));var _0x7794=function(_0x201601,_0x58301d){_0x201601=_0x201601-0x0;var _0x542fa6=_0x7947[_0x201601];return _0x542fa6;};'use strict';var EventEmitter=require(_0x7794('0x0'));var ChatMessage=require(_0x7794('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x7794('0x2')](0x0);var events={'afterCreate':_0x7794('0x3'),'afterUpdate':_0x7794('0x4'),'afterDestroy':_0x7794('0x5')};function emitEvent(_0x4dec9a){return function(_0x2e439c,_0x26271b,_0x2a7a05){ChatMessageEvents[_0x7794('0x6')](_0x4dec9a+':'+_0x2e439c['id'],_0x2e439c);ChatMessageEvents[_0x7794('0x6')](_0x4dec9a,_0x2e439c);_0x2a7a05(null);};}for(var e in events){if(events[_0x7794('0x7')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x7794('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 6a5f797..3ae1565 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 _0xcf0d=['define','ChatMessage','chat_messages','body','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','then','update','createdAt','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports'];(function(_0x27a217,_0x2bc6e8){var _0x4ee9fe=function(_0x21326e){while(--_0x21326e){_0x27a217['push'](_0x27a217['shift']());}};_0x4ee9fe(++_0x2bc6e8);}(_0xcf0d,0x1b9));var _0xdcf0=function(_0x430755,_0x1cff8f){_0x430755=_0x430755-0x0;var _0x3a5e4e=_0xcf0d[_0x430755];return _0x3a5e4e;};'use strict';var _=require(_0xdcf0('0x0'));var util=require(_0xdcf0('0x1'));var logger=require(_0xdcf0('0x2'))(_0xdcf0('0x3'));var moment=require('moment');var BPromise=require(_0xdcf0('0x4'));var rp=require(_0xdcf0('0x5'));var fs=require('fs');var path=require(_0xdcf0('0x6'));var rimraf=require(_0xdcf0('0x7'));var config=require('../../config/environment');var attributes=require('./chatMessage.attributes');module[_0xdcf0('0x8')]=function(_0xaa40cf,_0x212479){return _0xaa40cf[_0xdcf0('0x9')](_0xdcf0('0xa'),attributes,{'tableName':_0xdcf0('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xdcf0('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x266cf2,_0x29dcba,_0x58f3f9){var _0x3798a3=_0xaa40cf['models'];var _0x114ad5=_0x266cf2['get']({'plain':!![]});if(_0x114ad5[_0xdcf0('0xd')][_0xdcf0('0xe')]()==='in'||_0x114ad5['direction'][_0xdcf0('0xe')]()===_0xdcf0('0xf')&&!_0x114ad5[_0xdcf0('0x10')]&&!_[_0xdcf0('0x11')](_0x114ad5[_0xdcf0('0x12')])){_0x3798a3[_0xdcf0('0x13')][_0xdcf0('0x14')]({'where':{'id':_0x114ad5['ChatInteractionId']}})[_0xdcf0('0x15')](function(_0x1f7ea8){if(_0x1f7ea8){_0x1f7ea8[_0xdcf0('0x16')]({'lastMsgAt':_0x114ad5[_0xdcf0('0x17')],'lastMsgDirection':_0x114ad5[_0xdcf0('0xd')][_0xdcf0('0xe')]()});}})['catch'](function(_0x53edda){console['error'](_0x53edda);});}_0x58f3f9();}},'charset':_0xdcf0('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8227=['body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes','exports','define','fti_chat_messages'];(function(_0x3a15eb,_0x619ead){var _0x4c6741=function(_0x55db68){while(--_0x55db68){_0x3a15eb['push'](_0x3a15eb['shift']());}};_0x4c6741(++_0x619ead);}(_0x8227,0x8f));var _0x7822=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8227[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7822('0x0'));var util=require(_0x7822('0x1'));var logger=require('../../config/logger')(_0x7822('0x2'));var moment=require(_0x7822('0x3'));var BPromise=require(_0x7822('0x4'));var rp=require(_0x7822('0x5'));var fs=require('fs');var path=require(_0x7822('0x6'));var rimraf=require(_0x7822('0x7'));var config=require('../../config/environment');var attributes=require(_0x7822('0x8'));module[_0x7822('0x9')]=function(_0x525062,_0x4820aa){return _0x525062[_0x7822('0xa')]('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x7822('0xb'),'fields':[_0x7822('0xc')],'type':_0x7822('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x160a7b,_0x5f1c84,_0x5e9207){var _0x4bd8a6=_0x525062[_0x7822('0xe')];var _0x4585b3=_0x160a7b[_0x7822('0xf')]({'plain':!![]});if(_0x4585b3[_0x7822('0x10')][_0x7822('0x11')]()==='in'||_0x4585b3[_0x7822('0x10')][_0x7822('0x11')]()===_0x7822('0x12')&&!_0x4585b3[_0x7822('0x13')]&&!_[_0x7822('0x14')](_0x4585b3['UserId'])){_0x4bd8a6[_0x7822('0x15')][_0x7822('0x16')]({'where':{'id':_0x4585b3[_0x7822('0x17')]}})[_0x7822('0x18')](function(_0x5dfa13){if(_0x5dfa13){_0x5dfa13[_0x7822('0x19')]({'lastMsgAt':_0x4585b3[_0x7822('0x1a')],'lastMsgDirection':_0x4585b3['direction'][_0x7822('0x11')]()});}})[_0x7822('0x1b')](function(_0x40b321){console[_0x7822('0x1c')](_0x40b321);});}_0x5e9207();}},'charset':_0x7822('0x1d'),'collate':_0x7822('0x1e')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 514696b..b2b8ba1 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 _0xf052=['message','result','catch','ChatMessage','create','body','options','raw','CreateChatMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4f21cd,_0x30f06f){var _0x1af331=function(_0x51145e){while(--_0x51145e){_0x4f21cd['push'](_0x4f21cd['shift']());}};_0x1af331(++_0x30f06f);}(_0xf052,0x144));var _0x2f05=function(_0x4d5a4d,_0x1c7249){_0x4d5a4d=_0x4d5a4d-0x0;var _0x55bb93=_0xf052[_0x4d5a4d];return _0x55bb93;};'use strict';var _=require(_0x2f05('0x0'));var util=require(_0x2f05('0x1'));var moment=require(_0x2f05('0x2'));var BPromise=require(_0x2f05('0x3'));var rs=require(_0x2f05('0x4'));var fs=require('fs');var Redis=require(_0x2f05('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f05('0x6'));var logger=require('../../config/logger')(_0x2f05('0x7'));var config=require(_0x2f05('0x8'));var jayson=require(_0x2f05('0x9'));var client=jayson[_0x2f05('0xa')][_0x2f05('0xb')]({'port':0x232a});config['redis']=_[_0x2f05('0xc')](config[_0x2f05('0xd')],{'host':_0x2f05('0xe'),'port':0x18eb});var socket=require(_0x2f05('0xf'))(new Redis(config[_0x2f05('0xd')]));require(_0x2f05('0x10'))['register'](socket);function respondWithRpcPromise(_0x17b1e2,_0x108500,_0x52e1ad){return new BPromise(function(_0x560989,_0x3a7516){return client['request'](_0x17b1e2,_0x52e1ad)[_0x2f05('0x11')](function(_0x1a1fe8){logger[_0x2f05('0x12')](_0x2f05('0x13'),_0x108500,_0x2f05('0x14'));logger[_0x2f05('0x15')](_0x2f05('0x16'),_0x108500,'request\x20sent',JSON[_0x2f05('0x17')](_0x1a1fe8));if(_0x1a1fe8[_0x2f05('0x18')]){if(_0x1a1fe8[_0x2f05('0x18')][_0x2f05('0x19')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x108500,_0x1a1fe8['error'][_0x2f05('0x1a')]);return _0x3a7516(_0x1a1fe8[_0x2f05('0x18')]['message']);}logger['error'](_0x2f05('0x13'),_0x108500,_0x1a1fe8[_0x2f05('0x18')][_0x2f05('0x1a')]);return _0x560989(_0x1a1fe8[_0x2f05('0x18')][_0x2f05('0x1a')]);}else{logger[_0x2f05('0x12')](_0x2f05('0x13'),_0x108500,_0x2f05('0x14'));_0x560989(_0x1a1fe8[_0x2f05('0x1b')]['message']);}})[_0x2f05('0x1c')](function(_0x207ca7){logger[_0x2f05('0x18')](_0x2f05('0x13'),_0x108500,_0x207ca7);_0x3a7516(_0x207ca7);});});}exports['CreateChatMessage']=function(_0xf5e068){var _0xdab051=this;return new Promise(function(_0x30a2ef,_0x2624f6){return db[_0x2f05('0x1d')][_0x2f05('0x1e')](_0xf5e068[_0x2f05('0x1f')],{'raw':_0xf5e068[_0x2f05('0x20')]?_0xf5e068['options'][_0x2f05('0x21')]===undefined?!![]:![]:!![]})[_0x2f05('0x11')](function(_0x1850fb){logger[_0x2f05('0x12')](_0x2f05('0x22'),_0xf5e068);logger[_0x2f05('0x15')]('CreateChatMessage',_0xf5e068,JSON['stringify'](_0x1850fb));_0x30a2ef(_0x1850fb);})['catch'](function(_0x1346f6){logger[_0x2f05('0x18')](_0x2f05('0x22'),_0x1346f6[_0x2f05('0x1a')],_0xf5e068);_0x2624f6(_0xdab051[_0x2f05('0x18')](0x1f4,_0x1346f6[_0x2f05('0x1a')]));});});}; \ No newline at end of file +var _0x3abd=['create','options','raw','debug','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateChatMessage','ChatMessage'];(function(_0x40bf12,_0x4d03ae){var _0x1b3b01=function(_0x22a537){while(--_0x22a537){_0x40bf12['push'](_0x40bf12['shift']());}};_0x1b3b01(++_0x4d03ae);}(_0x3abd,0x6b));var _0xd3ab=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x3abd[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0xd3ab('0x0'));var util=require(_0xd3ab('0x1'));var moment=require(_0xd3ab('0x2'));var BPromise=require('bluebird');var rs=require(_0xd3ab('0x3'));var fs=require('fs');var Redis=require(_0xd3ab('0x4'));var db=require(_0xd3ab('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd3ab('0x6'))(_0xd3ab('0x7'));var config=require(_0xd3ab('0x8'));var jayson=require(_0xd3ab('0x9'));var client=jayson[_0xd3ab('0xa')][_0xd3ab('0xb')]({'port':0x232a});config[_0xd3ab('0xc')]=_['defaults'](config['redis'],{'host':_0xd3ab('0xd'),'port':0x18eb});var socket=require(_0xd3ab('0xe'))(new Redis(config['redis']));require(_0xd3ab('0xf'))[_0xd3ab('0x10')](socket);function respondWithRpcPromise(_0x1af318,_0x1338fd,_0x17a2bc){return new BPromise(function(_0x3540ef,_0x34291a){return client[_0xd3ab('0x11')](_0x1af318,_0x17a2bc)[_0xd3ab('0x12')](function(_0x40b34e){logger['info'](_0xd3ab('0x13'),_0x1338fd,_0xd3ab('0x14'));logger['debug'](_0xd3ab('0x15'),_0x1338fd,'request\x20sent',JSON[_0xd3ab('0x16')](_0x40b34e));if(_0x40b34e[_0xd3ab('0x17')]){if(_0x40b34e[_0xd3ab('0x17')]['code']===0x1f4){logger['error'](_0xd3ab('0x13'),_0x1338fd,_0x40b34e['error'][_0xd3ab('0x18')]);return _0x34291a(_0x40b34e['error'][_0xd3ab('0x18')]);}logger['error'](_0xd3ab('0x13'),_0x1338fd,_0x40b34e['error'][_0xd3ab('0x18')]);return _0x3540ef(_0x40b34e[_0xd3ab('0x17')][_0xd3ab('0x18')]);}else{logger[_0xd3ab('0x19')](_0xd3ab('0x13'),_0x1338fd,_0xd3ab('0x14'));_0x3540ef(_0x40b34e[_0xd3ab('0x1a')][_0xd3ab('0x18')]);}})['catch'](function(_0x1f5f18){logger[_0xd3ab('0x17')](_0xd3ab('0x13'),_0x1338fd,_0x1f5f18);_0x34291a(_0x1f5f18);});});}exports[_0xd3ab('0x1b')]=function(_0x7beca1){var _0x3c52cd=this;return new Promise(function(_0x56bb9a,_0x4bb5a6){return db[_0xd3ab('0x1c')][_0xd3ab('0x1d')](_0x7beca1['body'],{'raw':_0x7beca1[_0xd3ab('0x1e')]?_0x7beca1['options'][_0xd3ab('0x1f')]===undefined?!![]:![]:!![]})[_0xd3ab('0x12')](function(_0x465c75){logger['info'](_0xd3ab('0x1b'),_0x7beca1);logger[_0xd3ab('0x20')]('CreateChatMessage',_0x7beca1,JSON[_0xd3ab('0x16')](_0x465c75));_0x56bb9a(_0x465c75);})[_0xd3ab('0x21')](function(_0x5a2704){logger[_0xd3ab('0x17')]('CreateChatMessage',_0x5a2704[_0xd3ab('0x18')],_0x7beca1);_0x4bb5a6(_0x3c52cd[_0xd3ab('0x17')](0x1f4,_0x5a2704[_0xd3ab('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 2bd4768..6568a4d 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 _0xadb5=['update','emit','register','length','chatMessage:','save'];(function(_0x5e0e91,_0x200999){var _0xbd1780=function(_0xcb848b){while(--_0xcb848b){_0x5e0e91['push'](_0x5e0e91['shift']());}};_0xbd1780(++_0x200999);}(_0xadb5,0xad));var _0x5adb=function(_0x36aaed,_0x3db8dc){_0x36aaed=_0x36aaed-0x0;var _0x5baf06=_0xadb5[_0x36aaed];return _0x5baf06;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x5adb('0x0'),'remove',_0x5adb('0x1')];function createListener(_0x38f67f,_0x3129c3){return function(_0x4aecec){_0x3129c3[_0x5adb('0x2')](_0x38f67f,_0x4aecec);};}function removeListener(_0x31457,_0x2e3ef4){return function(){ChatMessageEvents['removeListener'](_0x31457,_0x2e3ef4);};}exports[_0x5adb('0x3')]=function(_0x168d89){for(var _0x3e2555=0x0,_0x3213e8=events[_0x5adb('0x4')];_0x3e2555<_0x3213e8;_0x3e2555++){var _0x353885=events[_0x3e2555];var _0x47228a=createListener(_0x5adb('0x5')+_0x353885,_0x168d89);ChatMessageEvents['on'](_0x353885,_0x47228a);}}; \ No newline at end of file +var _0xeda8=['chatMessage:','./chatMessage.events','save','update','emit','removeListener','register'];(function(_0x24d24e,_0x4e17a4){var _0x20e068=function(_0x48d5e5){while(--_0x48d5e5){_0x24d24e['push'](_0x24d24e['shift']());}};_0x20e068(++_0x4e17a4);}(_0xeda8,0x104));var _0x8eda=function(_0x4604d4,_0xa4a64d){_0x4604d4=_0x4604d4-0x0;var _0x4302a1=_0xeda8[_0x4604d4];return _0x4302a1;};'use strict';var ChatMessageEvents=require(_0x8eda('0x0'));var events=[_0x8eda('0x1'),'remove',_0x8eda('0x2')];function createListener(_0xd8b5d5,_0x2090a2){return function(_0xc01211){_0x2090a2[_0x8eda('0x3')](_0xd8b5d5,_0xc01211);};}function removeListener(_0x94b83f,_0x25b19a){return function(){ChatMessageEvents[_0x8eda('0x4')](_0x94b83f,_0x25b19a);};}exports[_0x8eda('0x5')]=function(_0x1f3556){for(var _0x349361=0x0,_0x32abe8=events['length'];_0x349361<_0x32abe8;_0x349361++){var _0x28b721=events[_0x349361];var _0x1b6a1d=createListener(_0x8eda('0x6')+_0x28b721,_0x1f3556);ChatMessageEvents['on'](_0x28b721,_0x1b6a1d);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 444f131..c6bd94a 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 _0x27e8=['accept','/:id/reject','reject','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','post','chat','chatmessage:create','create','put','update','/:id/accept'];(function(_0x478e58,_0x446efe){var _0x2ed30f=function(_0x1c2c38){while(--_0x1c2c38){_0x478e58['push'](_0x478e58['shift']());}};_0x2ed30f(++_0x446efe);}(_0x27e8,0xea));var _0x827e=function(_0x1691bd,_0x6f5284){_0x1691bd=_0x1691bd-0x0;var _0x152dd0=_0x27e8[_0x1691bd];return _0x152dd0;};'use strict';var multer=require(_0x827e('0x0'));var util=require(_0x827e('0x1'));var path=require('path');var timeout=require(_0x827e('0x2'));var express=require(_0x827e('0x3'));var router=express[_0x827e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x827e('0x5'));var config=require('../../config/environment');var controller=require('./chatMessage.controller');router[_0x827e('0x6')]('/',auth[_0x827e('0x7')](),controller[_0x827e('0x8')]);router[_0x827e('0x6')](_0x827e('0x9'),auth[_0x827e('0x7')](),controller['describe']);router[_0x827e('0x6')](_0x827e('0xa'),auth[_0x827e('0x7')](),controller[_0x827e('0xb')]);router[_0x827e('0xc')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x827e('0xd'),_0x827e('0xe')),controller[_0x827e('0xf')]);router[_0x827e('0x10')]('/:id',controller[_0x827e('0x11')]);router['put'](_0x827e('0x12'),auth[_0x827e('0x7')](),controller[_0x827e('0x13')]);router[_0x827e('0x10')](_0x827e('0x14'),auth['isAuthenticated'](),controller[_0x827e('0x15')]);router['delete'](_0x827e('0xa'),auth[_0x827e('0x7')](),controller['destroy']);module[_0x827e('0x16')]=router; \ No newline at end of file +var _0x0c0b=['accept','/:id/reject','reject','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show','post','tracked','chat','create','put','/:id/accept'];(function(_0x378720,_0xa711f1){var _0x47920a=function(_0xc5056){while(--_0xc5056){_0x378720['push'](_0x378720['shift']());}};_0x47920a(++_0xa711f1);}(_0x0c0b,0x81));var _0xb0c0=function(_0x15d9b2,_0x463fe5){_0x15d9b2=_0x15d9b2-0x0;var _0x1b8e8c=_0x0c0b[_0x15d9b2];return _0x1b8e8c;};'use strict';var multer=require(_0xb0c0('0x0'));var util=require('util');var path=require(_0xb0c0('0x1'));var timeout=require(_0xb0c0('0x2'));var express=require(_0xb0c0('0x3'));var router=express[_0xb0c0('0x4')]();var auth=require(_0xb0c0('0x5'));var interaction=require(_0xb0c0('0x6'));var config=require(_0xb0c0('0x7'));var controller=require('./chatMessage.controller');router['get']('/',auth[_0xb0c0('0x8')](),controller[_0xb0c0('0x9')]);router['get'](_0xb0c0('0xa'),auth['isAuthenticated'](),controller[_0xb0c0('0xb')]);router[_0xb0c0('0xc')](_0xb0c0('0xd'),auth['isAuthenticated'](),controller[_0xb0c0('0xe')]);router[_0xb0c0('0xf')]('/',auth[_0xb0c0('0x8')](),interaction[_0xb0c0('0x10')](_0xb0c0('0x11'),'chatmessage:create'),controller[_0xb0c0('0x12')]);router[_0xb0c0('0x13')](_0xb0c0('0xd'),controller['update']);router[_0xb0c0('0x13')](_0xb0c0('0x14'),auth[_0xb0c0('0x8')](),controller[_0xb0c0('0x15')]);router[_0xb0c0('0x13')](_0xb0c0('0x16'),auth['isAuthenticated'](),controller[_0xb0c0('0x17')]);router['delete']('/:id',auth[_0xb0c0('0x8')](),controller[_0xb0c0('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index ad5e70d..e6cfbf8 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 _0x78cd=['medium','exports'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0x78cd,0x199));var _0xd78c=function(_0x1e46a5,_0x5b094e){_0x1e46a5=_0x1e46a5-0x0;var _0x35a2cf=_0x78cd[_0x1e46a5];return _0x35a2cf;};'use strict';var Sequelize=require('sequelize');module[_0xd78c('0x0')]={'body':{'type':Sequelize['TEXT'](_0xd78c('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x1306=['sequelize','exports','TEXT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1306,0x99));var _0x6130=function(_0x19ee6a,_0x42f15e){_0x19ee6a=_0x19ee6a-0x0;var _0x48ffbf=_0x1306[_0x19ee6a];return _0x48ffbf;};'use strict';var Sequelize=require(_0x6130('0x0'));module[_0x6130('0x1')]={'body':{'type':Sequelize[_0x6130('0x2')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 9386d30..2248641 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 _0x5334=['ejs','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','json','count','offset','status','set','apply','update','then','destroy','stack','name','send','index','ChatOfflineMessage','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','show','params','rawAttributes','include','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util'];(function(_0x2f037f,_0x2958c5){var _0x2d1573=function(_0x34146e){while(--_0x34146e){_0x2f037f['push'](_0x2f037f['shift']());}};_0x2d1573(++_0x2958c5);}(_0x5334,0x84));var _0x4533=function(_0x1e7f5e,_0x1402ee){_0x1e7f5e=_0x1e7f5e-0x0;var _0x2bf6f0=_0x5334[_0x1e7f5e];return _0x2bf6f0;};'use strict';var pdf=require(_0x4533('0x0'));var emlformat=require(_0x4533('0x1'));var rimraf=require(_0x4533('0x2'));var zipdir=require(_0x4533('0x3'));var jsonpatch=require(_0x4533('0x4'));var rp=require('request-promise');var moment=require(_0x4533('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4533('0x6'));var util=require(_0x4533('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4533('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4533('0x9'));var deskjs=require(_0x4533('0xa'));var toCsv=require(_0x4533('0xb'));var querystring=require(_0x4533('0xc'));var Papa=require(_0x4533('0xd'));var Redis=require(_0x4533('0xe'));var authService=require(_0x4533('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4533('0x10'));var hardwareService=require(_0x4533('0x11'));var logger=require(_0x4533('0x12'))(_0x4533('0x13'));var utils=require('../../config/utils');var config=require(_0x4533('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc63e3,_0x439210){_0x439210=_0x439210||0xcc;return function(_0x45ba67){if(_0x45ba67){return _0xc63e3[_0x4533('0x15')](_0x439210);}return _0xc63e3['status'](_0x439210)[_0x4533('0x16')]();};}function respondWithResult(_0x3b4856,_0x187f05){_0x187f05=_0x187f05||0xc8;return function(_0x18d4f0){if(_0x18d4f0){return _0x3b4856['status'](_0x187f05)[_0x4533('0x17')](_0x18d4f0);}};}function respondWithFilteredResult(_0x573d84,_0x4c703c){return function(_0x466545){if(_0x466545){var _0x34dea9=_0x466545[_0x4533('0x18')],_0x5da8b8=_0x4c703c['offset'],_0x30c68c=_0x4c703c[_0x4533('0x19')]+_0x4c703c['limit'],_0x1e6a1a;if(_0x30c68c>=_0x34dea9){_0x30c68c=_0x34dea9;_0x1e6a1a=0xc8;}else{_0x1e6a1a=0xce;}_0x573d84[_0x4533('0x1a')](_0x1e6a1a);return _0x573d84[_0x4533('0x1b')]('Content-Range',_0x5da8b8+'-'+_0x30c68c+'/'+_0x34dea9)[_0x4533('0x17')](_0x466545);}return null;};}function patchUpdates(_0x5a4e8f){return function(_0x5c2c9c){try{jsonpatch[_0x4533('0x1c')](_0x5c2c9c,_0x5a4e8f,!![]);}catch(_0x9740a6){return BPromise['reject'](_0x9740a6);}return _0x5c2c9c['save']();};}function saveUpdates(_0x1abe1d,_0x3b18c1){return function(_0x3467ba){if(_0x3467ba){return _0x3467ba[_0x4533('0x1d')](_0x1abe1d)[_0x4533('0x1e')](function(_0xba445b){return _0xba445b;});}return null;};}function removeEntity(_0x12adde,_0x5c3abb){return function(_0x231bae){if(_0x231bae){return _0x231bae[_0x4533('0x1f')]()[_0x4533('0x1e')](function(){_0x12adde['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x138fd9,_0x11e93a){return function(_0x4c640c){if(!_0x4c640c){_0x138fd9['sendStatus'](0x194);}return _0x4c640c;};}function handleError(_0x307bdd,_0x1fa8be){_0x1fa8be=_0x1fa8be||0x1f4;return function(_0xfd9409){logger['error'](_0xfd9409[_0x4533('0x20')]);if(_0xfd9409[_0x4533('0x21')]){delete _0xfd9409[_0x4533('0x21')];}_0x307bdd[_0x4533('0x1a')](_0x1fa8be)[_0x4533('0x22')](_0xfd9409);};}exports[_0x4533('0x23')]=function(_0x474c64,_0x27b653){var _0x45ad98={},_0x5f16bb={},_0x5c1e24={'count':0x0,'rows':[]};var _0xa2e602=_['map'](db[_0x4533('0x24')]['rawAttributes'],function(_0x159fea){return{'name':_0x159fea[_0x4533('0x25')],'type':_0x159fea[_0x4533('0x26')][_0x4533('0x27')]};});_0x5f16bb[_0x4533('0x28')]=_[_0x4533('0x29')](_0xa2e602,_0x4533('0x21'));_0x5f16bb[_0x4533('0x2a')]=_[_0x4533('0x2b')](_0x474c64[_0x4533('0x2a')]);_0x5f16bb[_0x4533('0x2c')]=_[_0x4533('0x2d')](_0x5f16bb[_0x4533('0x28')],_0x5f16bb['query']);_0x45ad98[_0x4533('0x2e')]=_['intersection'](_0x5f16bb[_0x4533('0x28')],qs[_0x4533('0x2f')](_0x474c64[_0x4533('0x2a')][_0x4533('0x2f')]));_0x45ad98[_0x4533('0x2e')]=_0x45ad98[_0x4533('0x2e')][_0x4533('0x30')]?_0x45ad98[_0x4533('0x2e')]:_0x5f16bb[_0x4533('0x28')];if(!_0x474c64[_0x4533('0x2a')][_0x4533('0x31')](_0x4533('0x32'))){_0x45ad98['limit']=qs[_0x4533('0x33')](_0x474c64[_0x4533('0x2a')][_0x4533('0x33')]);_0x45ad98[_0x4533('0x19')]=qs[_0x4533('0x19')](_0x474c64['query'][_0x4533('0x19')]);}_0x45ad98[_0x4533('0x34')]=qs[_0x4533('0x35')](_0x474c64[_0x4533('0x2a')][_0x4533('0x35')]);_0x45ad98[_0x4533('0x36')]=qs['filters'](_[_0x4533('0x37')](_0x474c64[_0x4533('0x2a')],_0x5f16bb['filters']),_0xa2e602);if(_0x474c64[_0x4533('0x2a')][_0x4533('0x38')]){_0x45ad98[_0x4533('0x36')]=_[_0x4533('0x39')](_0x45ad98[_0x4533('0x36')],{'$or':_[_0x4533('0x29')](_0xa2e602,function(_0x424924){if(_0x424924[_0x4533('0x26')]!==_0x4533('0x3a')){var _0x1041d1={};_0x1041d1[_0x424924['name']]={'$like':'%'+_0x474c64[_0x4533('0x2a')][_0x4533('0x38')]+'%'};return _0x1041d1;}})});}_0x45ad98=_[_0x4533('0x39')]({},_0x45ad98,_0x474c64[_0x4533('0x3b')]);var _0x154ca3={'where':_0x45ad98[_0x4533('0x36')]};return db[_0x4533('0x24')][_0x4533('0x18')](_0x154ca3)[_0x4533('0x1e')](function(_0x3179b4){_0x5c1e24[_0x4533('0x18')]=_0x3179b4;if(_0x474c64[_0x4533('0x2a')]['includeAll']){_0x45ad98['include']=[{'all':!![]}];}return db[_0x4533('0x24')]['findAll'](_0x45ad98);})[_0x4533('0x1e')](function(_0x97aa9e){_0x5c1e24[_0x4533('0x3c')]=_0x97aa9e;return _0x5c1e24;})[_0x4533('0x1e')](respondWithFilteredResult(_0x27b653,_0x45ad98))[_0x4533('0x3d')](handleError(_0x27b653,null));};exports[_0x4533('0x3e')]=function(_0x2df795,_0x2686f4){var _0x11bc6b={'raw':!![],'where':{'id':_0x2df795[_0x4533('0x3f')]['id']}},_0x44e754={};_0x44e754[_0x4533('0x28')]=_[_0x4533('0x2b')](db['ChatOfflineMessage'][_0x4533('0x40')]);_0x44e754['query']=_['keys'](_0x2df795['query']);_0x44e754['filters']=_[_0x4533('0x2d')](_0x44e754[_0x4533('0x28')],_0x44e754[_0x4533('0x2a')]);_0x11bc6b[_0x4533('0x2e')]=_['intersection'](_0x44e754[_0x4533('0x28')],qs[_0x4533('0x2f')](_0x2df795[_0x4533('0x2a')][_0x4533('0x2f')]));_0x11bc6b[_0x4533('0x2e')]=_0x11bc6b[_0x4533('0x2e')][_0x4533('0x30')]?_0x11bc6b['attributes']:_0x44e754[_0x4533('0x28')];if(_0x2df795['query']['includeAll']){_0x11bc6b[_0x4533('0x41')]=[{'all':!![]}];}_0x11bc6b=_[_0x4533('0x39')]({},_0x11bc6b,_0x2df795[_0x4533('0x3b')]);return db[_0x4533('0x24')]['find'](_0x11bc6b)['then'](handleEntityNotFound(_0x2686f4,null))[_0x4533('0x1e')](respondWithResult(_0x2686f4,null))['catch'](handleError(_0x2686f4,null));};exports[_0x4533('0x42')]=function(_0x45b729,_0x4e46c5){return db['ChatOfflineMessage']['create'](_0x45b729['body'],{})['then'](respondWithResult(_0x4e46c5,0xc9))[_0x4533('0x3d')](handleError(_0x4e46c5,null));};exports['update']=function(_0x429447,_0x52b36c){if(_0x429447[_0x4533('0x43')]['id']){delete _0x429447['body']['id'];}return db['ChatOfflineMessage'][_0x4533('0x44')]({'where':{'id':_0x429447['params']['id']}})[_0x4533('0x1e')](handleEntityNotFound(_0x52b36c,null))['then'](saveUpdates(_0x429447[_0x4533('0x43')],null))[_0x4533('0x1e')](respondWithResult(_0x52b36c,null))['catch'](handleError(_0x52b36c,null));};exports[_0x4533('0x1f')]=function(_0x4f7d72,_0x37867f){return db[_0x4533('0x24')][_0x4533('0x44')]({'where':{'id':_0x4f7d72['params']['id']}})[_0x4533('0x1e')](handleEntityNotFound(_0x37867f,null))[_0x4533('0x1e')](removeEntity(_0x37867f,null))['catch'](handleError(_0x37867f,null));};exports[_0x4533('0x45')]=function(_0x6f1654,_0x38fcf7){return db[_0x4533('0x24')][_0x4533('0x45')]()[_0x4533('0x1e')](respondWithResult(_0x38fcf7,null))[_0x4533('0x3d')](handleError(_0x38fcf7,null));}; \ No newline at end of file +var _0x1883=['fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','ChatOfflineMessage','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes'];(function(_0x256f51,_0x3092bd){var _0x486ac6=function(_0x46ebe4){while(--_0x46ebe4){_0x256f51['push'](_0x256f51['shift']());}};_0x486ac6(++_0x3092bd);}(_0x1883,0xab));var _0x3188=function(_0x4e04f1,_0x198d5f){_0x4e04f1=_0x4e04f1-0x0;var _0x2c1544=_0x1883[_0x4e04f1];return _0x2c1544;};'use strict';var pdf=require(_0x3188('0x0'));var emlformat=require(_0x3188('0x1'));var rimraf=require(_0x3188('0x2'));var zipdir=require(_0x3188('0x3'));var jsonpatch=require(_0x3188('0x4'));var rp=require(_0x3188('0x5'));var moment=require(_0x3188('0x6'));var BPromise=require(_0x3188('0x7'));var Mustache=require(_0x3188('0x8'));var util=require(_0x3188('0x9'));var path=require(_0x3188('0xa'));var sox=require(_0x3188('0xb'));var csv=require(_0x3188('0xc'));var ejs=require(_0x3188('0xd'));var fs=require('fs');var _=require(_0x3188('0xe'));var squel=require(_0x3188('0xf'));var crypto=require(_0x3188('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3188('0x11'));var toCsv=require(_0x3188('0xc'));var querystring=require('querystring');var Papa=require(_0x3188('0x12'));var Redis=require('ioredis');var authService=require(_0x3188('0x13'));var qs=require(_0x3188('0x14'));var as=require(_0x3188('0x15'));var hardwareService=require(_0x3188('0x16'));var logger=require('../../config/logger')(_0x3188('0x17'));var utils=require(_0x3188('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x339b4a,_0x45e94e){_0x45e94e=_0x45e94e||0xcc;return function(_0x20fef6){if(_0x20fef6){return _0x339b4a[_0x3188('0x19')](_0x45e94e);}return _0x339b4a[_0x3188('0x1a')](_0x45e94e)[_0x3188('0x1b')]();};}function respondWithResult(_0x490104,_0x276d69){_0x276d69=_0x276d69||0xc8;return function(_0x5e0044){if(_0x5e0044){return _0x490104['status'](_0x276d69)[_0x3188('0x1c')](_0x5e0044);}};}function respondWithFilteredResult(_0x53668b,_0x54a87f){return function(_0x32c239){if(_0x32c239){var _0x1beead=_0x32c239[_0x3188('0x1d')],_0xa2269=_0x54a87f['offset'],_0x195d8e=_0x54a87f[_0x3188('0x1e')]+_0x54a87f[_0x3188('0x1f')],_0x145293;if(_0x195d8e>=_0x1beead){_0x195d8e=_0x1beead;_0x145293=0xc8;}else{_0x145293=0xce;}_0x53668b[_0x3188('0x1a')](_0x145293);return _0x53668b[_0x3188('0x20')](_0x3188('0x21'),_0xa2269+'-'+_0x195d8e+'/'+_0x1beead)[_0x3188('0x1c')](_0x32c239);}return null;};}function patchUpdates(_0xac7f48){return function(_0x4602c6){try{jsonpatch['apply'](_0x4602c6,_0xac7f48,!![]);}catch(_0x354338){return BPromise[_0x3188('0x22')](_0x354338);}return _0x4602c6['save']();};}function saveUpdates(_0x518b2f,_0x5d8d62){return function(_0x46a318){if(_0x46a318){return _0x46a318[_0x3188('0x23')](_0x518b2f)[_0x3188('0x24')](function(_0x5980f3){return _0x5980f3;});}return null;};}function removeEntity(_0x48673c,_0x266260){return function(_0x461286){if(_0x461286){return _0x461286[_0x3188('0x25')]()[_0x3188('0x24')](function(){_0x48673c[_0x3188('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30cf2c,_0x33f882){return function(_0x5a2e67){if(!_0x5a2e67){_0x30cf2c[_0x3188('0x19')](0x194);}return _0x5a2e67;};}function handleError(_0x4be6c3,_0x5c69be){_0x5c69be=_0x5c69be||0x1f4;return function(_0x45ae2f){logger[_0x3188('0x26')](_0x45ae2f[_0x3188('0x27')]);if(_0x45ae2f[_0x3188('0x28')]){delete _0x45ae2f[_0x3188('0x28')];}_0x4be6c3[_0x3188('0x1a')](_0x5c69be)[_0x3188('0x29')](_0x45ae2f);};}exports[_0x3188('0x2a')]=function(_0x4b4675,_0x2cc5d9){var _0x2d000a={},_0x52bb13={},_0xd3ee40={'count':0x0,'rows':[]};var _0x14299b=_[_0x3188('0x2b')](db[_0x3188('0x2c')][_0x3188('0x2d')],function(_0x1f1c6f){return{'name':_0x1f1c6f[_0x3188('0x2e')],'type':_0x1f1c6f[_0x3188('0x2f')]['key']};});_0x52bb13[_0x3188('0x30')]=_['map'](_0x14299b,_0x3188('0x28'));_0x52bb13['query']=_[_0x3188('0x31')](_0x4b4675[_0x3188('0x32')]);_0x52bb13[_0x3188('0x33')]=_[_0x3188('0x34')](_0x52bb13[_0x3188('0x30')],_0x52bb13[_0x3188('0x32')]);_0x2d000a[_0x3188('0x35')]=_[_0x3188('0x34')](_0x52bb13[_0x3188('0x30')],qs[_0x3188('0x36')](_0x4b4675[_0x3188('0x32')][_0x3188('0x36')]));_0x2d000a[_0x3188('0x35')]=_0x2d000a[_0x3188('0x35')][_0x3188('0x37')]?_0x2d000a[_0x3188('0x35')]:_0x52bb13[_0x3188('0x30')];if(!_0x4b4675[_0x3188('0x32')]['hasOwnProperty'](_0x3188('0x38'))){_0x2d000a['limit']=qs[_0x3188('0x1f')](_0x4b4675[_0x3188('0x32')]['limit']);_0x2d000a[_0x3188('0x1e')]=qs[_0x3188('0x1e')](_0x4b4675[_0x3188('0x32')][_0x3188('0x1e')]);}_0x2d000a[_0x3188('0x39')]=qs[_0x3188('0x3a')](_0x4b4675[_0x3188('0x32')]['sort']);_0x2d000a['where']=qs[_0x3188('0x33')](_[_0x3188('0x3b')](_0x4b4675[_0x3188('0x32')],_0x52bb13[_0x3188('0x33')]),_0x14299b);if(_0x4b4675['query'][_0x3188('0x3c')]){_0x2d000a[_0x3188('0x3d')]=_[_0x3188('0x3e')](_0x2d000a[_0x3188('0x3d')],{'$or':_['map'](_0x14299b,function(_0x201ef2){if(_0x201ef2['type']!==_0x3188('0x3f')){var _0x57895f={};_0x57895f[_0x201ef2[_0x3188('0x28')]]={'$like':'%'+_0x4b4675[_0x3188('0x32')][_0x3188('0x3c')]+'%'};return _0x57895f;}})});}_0x2d000a=_[_0x3188('0x3e')]({},_0x2d000a,_0x4b4675[_0x3188('0x40')]);var _0x2305bf={'where':_0x2d000a[_0x3188('0x3d')]};return db[_0x3188('0x2c')][_0x3188('0x1d')](_0x2305bf)[_0x3188('0x24')](function(_0x539a0f){_0xd3ee40[_0x3188('0x1d')]=_0x539a0f;if(_0x4b4675[_0x3188('0x32')][_0x3188('0x41')]){_0x2d000a[_0x3188('0x42')]=[{'all':!![]}];}return db[_0x3188('0x2c')][_0x3188('0x43')](_0x2d000a);})['then'](function(_0x6b2347){_0xd3ee40['rows']=_0x6b2347;return _0xd3ee40;})[_0x3188('0x24')](respondWithFilteredResult(_0x2cc5d9,_0x2d000a))[_0x3188('0x44')](handleError(_0x2cc5d9,null));};exports[_0x3188('0x45')]=function(_0x8f3756,_0x42c47b){var _0x549ab2={'raw':!![],'where':{'id':_0x8f3756['params']['id']}},_0x484eeb={};_0x484eeb['model']=_['keys'](db[_0x3188('0x2c')][_0x3188('0x2d')]);_0x484eeb[_0x3188('0x32')]=_[_0x3188('0x31')](_0x8f3756[_0x3188('0x32')]);_0x484eeb['filters']=_[_0x3188('0x34')](_0x484eeb['model'],_0x484eeb[_0x3188('0x32')]);_0x549ab2[_0x3188('0x35')]=_[_0x3188('0x34')](_0x484eeb[_0x3188('0x30')],qs['fields'](_0x8f3756[_0x3188('0x32')][_0x3188('0x36')]));_0x549ab2[_0x3188('0x35')]=_0x549ab2[_0x3188('0x35')][_0x3188('0x37')]?_0x549ab2['attributes']:_0x484eeb['model'];if(_0x8f3756[_0x3188('0x32')][_0x3188('0x41')]){_0x549ab2['include']=[{'all':!![]}];}_0x549ab2=_[_0x3188('0x3e')]({},_0x549ab2,_0x8f3756[_0x3188('0x40')]);return db['ChatOfflineMessage'][_0x3188('0x46')](_0x549ab2)[_0x3188('0x24')](handleEntityNotFound(_0x42c47b,null))[_0x3188('0x24')](respondWithResult(_0x42c47b,null))[_0x3188('0x44')](handleError(_0x42c47b,null));};exports[_0x3188('0x47')]=function(_0x5a3142,_0x467ead){return db['ChatOfflineMessage'][_0x3188('0x47')](_0x5a3142[_0x3188('0x48')],{})[_0x3188('0x24')](respondWithResult(_0x467ead,0xc9))[_0x3188('0x44')](handleError(_0x467ead,null));};exports[_0x3188('0x23')]=function(_0x315524,_0x2aa232){if(_0x315524[_0x3188('0x48')]['id']){delete _0x315524[_0x3188('0x48')]['id'];}return db[_0x3188('0x2c')][_0x3188('0x46')]({'where':{'id':_0x315524['params']['id']}})['then'](handleEntityNotFound(_0x2aa232,null))[_0x3188('0x24')](saveUpdates(_0x315524['body'],null))[_0x3188('0x24')](respondWithResult(_0x2aa232,null))[_0x3188('0x44')](handleError(_0x2aa232,null));};exports['destroy']=function(_0x3abc6b,_0x16417a){return db[_0x3188('0x2c')][_0x3188('0x46')]({'where':{'id':_0x3abc6b[_0x3188('0x49')]['id']}})[_0x3188('0x24')](handleEntityNotFound(_0x16417a,null))[_0x3188('0x24')](removeEntity(_0x16417a,null))[_0x3188('0x44')](handleError(_0x16417a,null));};exports['describe']=function(_0x3b8fe9,_0x3051ce){return db['ChatOfflineMessage'][_0x3188('0x4a')]()['then'](respondWithResult(_0x3051ce,null))[_0x3188('0x44')](handleError(_0x3051ce,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 5dbb978..d7afffe 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 _0x8899=['path','../../config/environment','./chatOfflineMessage.attributes','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1fe559,_0x25fba7){var _0xb5b18c=function(_0x5ca09d){while(--_0x5ca09d){_0x1fe559['push'](_0x1fe559['shift']());}};_0xb5b18c(++_0x25fba7);}(_0x8899,0x13e));var _0x9889=function(_0xe1c1b,_0x336364){_0xe1c1b=_0xe1c1b-0x0;var _0x332f61=_0x8899[_0xe1c1b];return _0x332f61;};'use strict';var _=require(_0x9889('0x0'));var util=require(_0x9889('0x1'));var logger=require('../../config/logger')(_0x9889('0x2'));var moment=require(_0x9889('0x3'));var BPromise=require(_0x9889('0x4'));var rp=require(_0x9889('0x5'));var fs=require('fs');var path=require(_0x9889('0x6'));var rimraf=require('rimraf');var config=require(_0x9889('0x7'));var attributes=require(_0x9889('0x8'));module['exports']=function(_0x52014d,_0x5eef50){return _0x52014d['define']('ChatOfflineMessage',attributes,{'tableName':_0x9889('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9889('0xa'),'collate':_0x9889('0xb')});}; \ No newline at end of file +var _0x867d=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci'];(function(_0x474b2d,_0x3c036d){var _0x28092c=function(_0xeb6467){while(--_0xeb6467){_0x474b2d['push'](_0x474b2d['shift']());}};_0x28092c(++_0x3c036d);}(_0x867d,0x134));var _0xd867=function(_0x2a0cad,_0x27bea2){_0x2a0cad=_0x2a0cad-0x0;var _0x14170b=_0x867d[_0x2a0cad];return _0x14170b;};'use strict';var _=require(_0xd867('0x0'));var util=require(_0xd867('0x1'));var logger=require(_0xd867('0x2'))(_0xd867('0x3'));var moment=require('moment');var BPromise=require(_0xd867('0x4'));var rp=require(_0xd867('0x5'));var fs=require('fs');var path=require(_0xd867('0x6'));var rimraf=require(_0xd867('0x7'));var config=require(_0xd867('0x8'));var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x36d7d9,_0x2fbbe4){return _0x36d7d9[_0xd867('0x9')](_0xd867('0xa'),attributes,{'tableName':_0xd867('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd867('0xc'),'collate':_0xd867('0xd')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 246cfc5..d77d065 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 _0x8e1f=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x6a4771,_0x5ed054){var _0x3c1467=function(_0x504553){while(--_0x504553){_0x6a4771['push'](_0x6a4771['shift']());}};_0x3c1467(++_0x5ed054);}(_0x8e1f,0x109));var _0xf8e1=function(_0x528139,_0x49f0c9){_0x528139=_0x528139-0x0;var _0x10a8c2=_0x8e1f[_0x528139];return _0x10a8c2;};'use strict';var _=require('lodash');var util=require(_0xf8e1('0x0'));var moment=require(_0xf8e1('0x1'));var BPromise=require(_0xf8e1('0x2'));var rs=require(_0xf8e1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8e1('0x4'))['db'];var utils=require(_0xf8e1('0x5'));var logger=require(_0xf8e1('0x6'))(_0xf8e1('0x7'));var config=require(_0xf8e1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf8e1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e53e5,_0x4be1db,_0x135c9f){return new BPromise(function(_0x12307a,_0x36ad8a){return client[_0xf8e1('0xa')](_0x4e53e5,_0x135c9f)[_0xf8e1('0xb')](function(_0x5acfda){logger[_0xf8e1('0xc')](_0xf8e1('0xd'),_0x4be1db,'request\x20sent');logger[_0xf8e1('0xe')](_0xf8e1('0xf'),_0x4be1db,_0xf8e1('0x10'),JSON['stringify'](_0x5acfda));if(_0x5acfda['error']){if(_0x5acfda[_0xf8e1('0x11')][_0xf8e1('0x12')]===0x1f4){logger[_0xf8e1('0x11')](_0xf8e1('0xd'),_0x4be1db,_0x5acfda[_0xf8e1('0x11')][_0xf8e1('0x13')]);return _0x36ad8a(_0x5acfda[_0xf8e1('0x11')][_0xf8e1('0x13')]);}logger[_0xf8e1('0x11')](_0xf8e1('0xd'),_0x4be1db,_0x5acfda[_0xf8e1('0x11')][_0xf8e1('0x13')]);return _0x12307a(_0x5acfda[_0xf8e1('0x11')][_0xf8e1('0x13')]);}else{logger[_0xf8e1('0xc')](_0xf8e1('0xd'),_0x4be1db,_0xf8e1('0x10'));_0x12307a(_0x5acfda[_0xf8e1('0x14')][_0xf8e1('0x13')]);}})[_0xf8e1('0x15')](function(_0x232965){logger[_0xf8e1('0x11')](_0xf8e1('0xd'),_0x4be1db,_0x232965);_0x36ad8a(_0x232965);});});} \ No newline at end of file +var _0x078b=['ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x628eee,_0x3f3fba){var _0x447718=function(_0x38112b){while(--_0x38112b){_0x628eee['push'](_0x628eee['shift']());}};_0x447718(++_0x3f3fba);}(_0x078b,0x1ed));var _0xb078=function(_0x22ad4e,_0x165ba6){_0x22ad4e=_0x22ad4e-0x0;var _0x4750cc=_0x078b[_0x22ad4e];return _0x4750cc;};'use strict';var _=require(_0xb078('0x0'));var util=require(_0xb078('0x1'));var moment=require(_0xb078('0x2'));var BPromise=require('bluebird');var rs=require(_0xb078('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb078('0x4'))['db'];var utils=require(_0xb078('0x5'));var logger=require(_0xb078('0x6'))(_0xb078('0x7'));var config=require(_0xb078('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb078('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ecc79,_0x3a7da2,_0xce5c6){return new BPromise(function(_0x2d043e,_0x2a42a6){return client[_0xb078('0xa')](_0x3ecc79,_0xce5c6)[_0xb078('0xb')](function(_0x4b8fd5){logger[_0xb078('0xc')](_0xb078('0xd'),_0x3a7da2,_0xb078('0xe'));logger[_0xb078('0xf')](_0xb078('0x10'),_0x3a7da2,'request\x20sent',JSON[_0xb078('0x11')](_0x4b8fd5));if(_0x4b8fd5[_0xb078('0x12')]){if(_0x4b8fd5['error']['code']===0x1f4){logger[_0xb078('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3a7da2,_0x4b8fd5[_0xb078('0x12')][_0xb078('0x13')]);return _0x2a42a6(_0x4b8fd5[_0xb078('0x12')]['message']);}logger[_0xb078('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3a7da2,_0x4b8fd5[_0xb078('0x12')][_0xb078('0x13')]);return _0x2d043e(_0x4b8fd5[_0xb078('0x12')][_0xb078('0x13')]);}else{logger[_0xb078('0xc')](_0xb078('0xd'),_0x3a7da2,'request\x20sent');_0x2d043e(_0x4b8fd5[_0xb078('0x14')][_0xb078('0x13')]);}})[_0xb078('0x15')](function(_0x4effcc){logger[_0xb078('0x12')](_0xb078('0xd'),_0x3a7da2,_0x4effcc);_0x2a42a6(_0x4effcc);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index be6e7a0..214f30f 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 _0x4cb0=['Router','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','destroy','exports','multer','util','express'];(function(_0x2ff003,_0x357ffa){var _0x5cea7e=function(_0x3544bd){while(--_0x3544bd){_0x2ff003['push'](_0x2ff003['shift']());}};_0x5cea7e(++_0x357ffa);}(_0x4cb0,0x166));var _0x04cb=function(_0x4241c4,_0x5e8efe){_0x4241c4=_0x4241c4-0x0;var _0x7c22b7=_0x4cb0[_0x4241c4];return _0x7c22b7;};'use strict';var multer=require(_0x04cb('0x0'));var util=require(_0x04cb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x04cb('0x2'));var router=express[_0x04cb('0x3')]();var auth=require(_0x04cb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x04cb('0x5'));var controller=require(_0x04cb('0x6'));router[_0x04cb('0x7')]('/',auth['isAuthenticated'](),controller[_0x04cb('0x8')]);router[_0x04cb('0x7')](_0x04cb('0x9'),auth[_0x04cb('0xa')](),controller[_0x04cb('0xb')]);router[_0x04cb('0x7')](_0x04cb('0xc'),auth[_0x04cb('0xa')](),controller[_0x04cb('0xd')]);router[_0x04cb('0xe')]('/',auth[_0x04cb('0xa')](),controller[_0x04cb('0xf')]);router[_0x04cb('0x10')](_0x04cb('0xc'),auth[_0x04cb('0xa')](),controller['update']);router['delete'](_0x04cb('0xc'),auth[_0x04cb('0xa')](),controller[_0x04cb('0x11')]);module[_0x04cb('0x12')]=router; \ No newline at end of file +var _0x00dd=['isAuthenticated','index','describe','/:id','show','post','create','put','update','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x00dd,0x89));var _0xd00d=function(_0x38c3f3,_0x544c71){_0x38c3f3=_0x38c3f3-0x0;var _0x285b99=_0x00dd[_0x38c3f3];return _0x285b99;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd00d('0x0'));var express=require(_0xd00d('0x1'));var router=express[_0xd00d('0x2')]();var auth=require(_0xd00d('0x3'));var interaction=require(_0xd00d('0x4'));var config=require(_0xd00d('0x5'));var controller=require('./chatOfflineMessage.controller');router[_0xd00d('0x6')]('/',auth[_0xd00d('0x7')](),controller[_0xd00d('0x8')]);router['get']('/describe',auth[_0xd00d('0x7')](),controller[_0xd00d('0x9')]);router['get'](_0xd00d('0xa'),auth[_0xd00d('0x7')](),controller[_0xd00d('0xb')]);router[_0xd00d('0xc')]('/',auth[_0xd00d('0x7')](),controller[_0xd00d('0xd')]);router[_0xd00d('0xe')](_0xd00d('0xa'),auth['isAuthenticated'](),controller[_0xd00d('0xf')]);router['delete'](_0xd00d('0xa'),auth['isAuthenticated'](),controller[_0xd00d('0x10')]);module[_0xd00d('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 7536324..7d15349 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 _0x5bd5=['INTEGER','sequelize','STRING','ENUM','timeout','mouseOver'];(function(_0x2be57b,_0x2182c7){var _0x4ac9fa=function(_0x21e398){while(--_0x21e398){_0x2be57b['push'](_0x2be57b['shift']());}};_0x4ac9fa(++_0x2182c7);}(_0x5bd5,0x9d));var _0x55bd=function(_0x46f3f8,_0x12c74b){_0x46f3f8=_0x46f3f8-0x0;var _0xbc57cd=_0x5bd5[_0x46f3f8];return _0xbc57cd;};'use strict';var Sequelize=require(_0x55bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x55bd('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x55bd('0x2')]('mouseOver',_0x55bd('0x3')),'defaultValue':_0x55bd('0x4')},'selector':{'type':Sequelize[_0x55bd('0x1')]},'timeout':{'type':Sequelize[_0x55bd('0x5')]}}; \ No newline at end of file +var _0xc633=['sequelize','STRING','ENUM','mouseOver'];(function(_0x153efb,_0x19fd9f){var _0x2672ee=function(_0x2a81ef){while(--_0x2a81ef){_0x153efb['push'](_0x153efb['shift']());}};_0x2672ee(++_0x19fd9f);}(_0xc633,0x198));var _0x3c63=function(_0x127775,_0x482d6b){_0x127775=_0x127775-0x0;var _0x1429cc=_0xc633[_0x127775];return _0x1429cc;};'use strict';var Sequelize=require(_0x3c63('0x0'));module['exports']={'name':{'type':Sequelize[_0x3c63('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3c63('0x2')](_0x3c63('0x3'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x3c63('0x1')]},'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 0ddd967..888ad3d 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 _0xa9e0=['keys','ChatProactiveAction','rawAttributes','query','filters','attributes','intersection','fields','length','include','options','find','create','body','catch','params','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','show','model'];(function(_0x591a90,_0x5525b0){var _0x551587=function(_0xd6ad8e){while(--_0xd6ad8e){_0x591a90['push'](_0x591a90['shift']());}};_0x551587(++_0x5525b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={'raw':!![],'where':{'id':_0x526cf3['params']['id']}},_0x45a1e7={};_0x45a1e7[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x45a1e7[_0x0a9e('0x2a')]=_[_0x0a9e('0x27')](_0x526cf3[_0x0a9e('0x2a')]);_0x45a1e7[_0x0a9e('0x2b')]=_['intersection'](_0x45a1e7[_0x0a9e('0x26')],_0x45a1e7[_0x0a9e('0x2a')]);_0x479bc4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x45a1e7['model'],qs[_0x0a9e('0x2e')](_0x526cf3[_0x0a9e('0x2a')][_0x0a9e('0x2e')]));_0x479bc4[_0x0a9e('0x2c')]=_0x479bc4[_0x0a9e('0x2c')][_0x0a9e('0x2f')]?_0x479bc4[_0x0a9e('0x2c')]:_0x45a1e7[_0x0a9e('0x26')];if(_0x526cf3[_0x0a9e('0x2a')]['includeAll']){_0x479bc4[_0x0a9e('0x30')]=[{'all':!![]}];}_0x479bc4=_['merge']({},_0x479bc4,_0x526cf3[_0x0a9e('0x31')]);return db[_0x0a9e('0x28')][_0x0a9e('0x32')](_0x479bc4)[_0x0a9e('0x1f')](handleEntityNotFound(_0x384319,null))[_0x0a9e('0x1f')](respondWithResult(_0x384319,null))['catch'](handleError(_0x384319,null));};exports[_0x0a9e('0x33')]=function(_0x46f0a5,_0x40cb85){return db[_0x0a9e('0x28')][_0x0a9e('0x33')](_0x46f0a5[_0x0a9e('0x34')],{})[_0x0a9e('0x1f')](respondWithResult(_0x40cb85,0xc9))[_0x0a9e('0x35')](handleError(_0x40cb85,null));};exports['update']=function(_0x44295a,_0x5e7238){if(_0x44295a[_0x0a9e('0x34')]['id']){delete _0x44295a[_0x0a9e('0x34')]['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x32')]({'where':{'id':_0x44295a['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x5e7238,null))[_0x0a9e('0x1f')](saveUpdates(_0x44295a[_0x0a9e('0x34')],null))[_0x0a9e('0x1f')](respondWithResult(_0x5e7238,null))['catch'](handleError(_0x5e7238,null));};exports['destroy']=function(_0x1e8694,_0x5640eb){return db[_0x0a9e('0x28')][_0x0a9e('0x32')]({'where':{'id':_0x1e8694[_0x0a9e('0x36')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x5640eb,null))['then'](removeEntity(_0x5640eb,null))[_0x0a9e('0x35')](handleError(_0x5640eb,null));}; \ No newline at end of file +var _0xcb91=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','length','includeAll','merge','options','find','catch','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x232ec0,_0x45fdd0){_0x232ec0=_0x232ec0-0x0;var _0x356705=_0xcb91[_0x232ec0];return _0x356705;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x46af58,_0x5445e1){_0x5445e1=_0x5445e1||0xcc;return function(_0x5e3c19){if(_0x5e3c19){return _0x46af58['sendStatus'](_0x5445e1);}return _0x46af58[_0x1cb9('0x16')](_0x5445e1)[_0x1cb9('0x17')]();};}function respondWithResult(_0x384496,_0x1c714f){_0x1c714f=_0x1c714f||0xc8;return function(_0x56884d){if(_0x56884d){return _0x384496[_0x1cb9('0x16')](_0x1c714f)[_0x1cb9('0x18')](_0x56884d);}};}function respondWithFilteredResult(_0x1b3cd7,_0x8dfa55){return function(_0x3e2d11){if(_0x3e2d11){var _0x5806d8=_0x3e2d11[_0x1cb9('0x19')],_0x5572cb=_0x8dfa55[_0x1cb9('0x1a')],_0xd446a3=_0x8dfa55[_0x1cb9('0x1a')]+_0x8dfa55[_0x1cb9('0x1b')],_0x3cc765;if(_0xd446a3>=_0x5806d8){_0xd446a3=_0x5806d8;_0x3cc765=0xc8;}else{_0x3cc765=0xce;}_0x1b3cd7[_0x1cb9('0x16')](_0x3cc765);return _0x1b3cd7['set']('Content-Range',_0x5572cb+'-'+_0xd446a3+'/'+_0x5806d8)[_0x1cb9('0x18')](_0x3e2d11);}return null;};}function patchUpdates(_0x41ac41){return function(_0x2b2669){try{jsonpatch[_0x1cb9('0x1c')](_0x2b2669,_0x41ac41,!![]);}catch(_0x280a84){return BPromise[_0x1cb9('0x1d')](_0x280a84);}return _0x2b2669[_0x1cb9('0x1e')]();};}function saveUpdates(_0x4ac422,_0x559bcc){return function(_0x1a5a72){if(_0x1a5a72){return _0x1a5a72['update'](_0x4ac422)[_0x1cb9('0x1f')](function(_0x2265ea){return _0x2265ea;});}return null;};}function removeEntity(_0x523b26,_0x599275){return function(_0x2e3854){if(_0x2e3854){return _0x2e3854[_0x1cb9('0x20')]()[_0x1cb9('0x1f')](function(){_0x523b26[_0x1cb9('0x16')](0xcc)[_0x1cb9('0x17')]();});}};}function handleEntityNotFound(_0x27db16,_0x59ebea){return function(_0x55b232){if(!_0x55b232){_0x27db16[_0x1cb9('0x21')](0x194);}return _0x55b232;};}function handleError(_0x557199,_0x10a419){_0x10a419=_0x10a419||0x1f4;return function(_0x2b1275){logger[_0x1cb9('0x22')](_0x2b1275[_0x1cb9('0x23')]);if(_0x2b1275[_0x1cb9('0x24')]){delete _0x2b1275['name'];}_0x557199[_0x1cb9('0x16')](_0x10a419)[_0x1cb9('0x25')](_0x2b1275);};}exports['show']=function(_0xd6891c,_0x21effa){var _0x41a9a0={'raw':!![],'where':{'id':_0xd6891c[_0x1cb9('0x26')]['id']}},_0x1804fd={};_0x1804fd[_0x1cb9('0x27')]=_[_0x1cb9('0x28')](db[_0x1cb9('0x29')][_0x1cb9('0x2a')]);_0x1804fd[_0x1cb9('0x2b')]=_['keys'](_0xd6891c[_0x1cb9('0x2b')]);_0x1804fd['filters']=_[_0x1cb9('0x2c')](_0x1804fd['model'],_0x1804fd[_0x1cb9('0x2b')]);_0x41a9a0[_0x1cb9('0x2d')]=_[_0x1cb9('0x2c')](_0x1804fd[_0x1cb9('0x27')],qs['fields'](_0xd6891c[_0x1cb9('0x2b')]['fields']));_0x41a9a0[_0x1cb9('0x2d')]=_0x41a9a0[_0x1cb9('0x2d')][_0x1cb9('0x2e')]?_0x41a9a0['attributes']:_0x1804fd[_0x1cb9('0x27')];if(_0xd6891c['query'][_0x1cb9('0x2f')]){_0x41a9a0['include']=[{'all':!![]}];}_0x41a9a0=_[_0x1cb9('0x30')]({},_0x41a9a0,_0xd6891c[_0x1cb9('0x31')]);return db[_0x1cb9('0x29')][_0x1cb9('0x32')](_0x41a9a0)['then'](handleEntityNotFound(_0x21effa,null))[_0x1cb9('0x1f')](respondWithResult(_0x21effa,null))[_0x1cb9('0x33')](handleError(_0x21effa,null));};exports[_0x1cb9('0x34')]=function(_0x91a1db,_0xc6784c){return db[_0x1cb9('0x29')][_0x1cb9('0x34')](_0x91a1db[_0x1cb9('0x35')],{})[_0x1cb9('0x1f')](respondWithResult(_0xc6784c,0xc9))[_0x1cb9('0x33')](handleError(_0xc6784c,null));};exports[_0x1cb9('0x36')]=function(_0x26b950,_0x29f149){if(_0x26b950['body']['id']){delete _0x26b950['body']['id'];}return db[_0x1cb9('0x29')][_0x1cb9('0x32')]({'where':{'id':_0x26b950[_0x1cb9('0x26')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x29f149,null))[_0x1cb9('0x1f')](saveUpdates(_0x26b950[_0x1cb9('0x35')],null))[_0x1cb9('0x1f')](respondWithResult(_0x29f149,null))[_0x1cb9('0x33')](handleError(_0x29f149,null));};exports['destroy']=function(_0x2aa59b,_0x1482c4){return db[_0x1cb9('0x29')]['find']({'where':{'id':_0x2aa59b[_0x1cb9('0x26')]['id']}})['then'](handleEntityNotFound(_0x1482c4,null))[_0x1cb9('0x1f')](removeEntity(_0x1482c4,null))['catch'](handleError(_0x1482c4,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 6d2ea43..bcfdc00 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 _0x9282=['chat_proactive_actions','../../config/logger','api','moment','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction'];(function(_0x49e9ee,_0x68fb8d){var _0x503d8e=function(_0x4b3e59){while(--_0x4b3e59){_0x49e9ee['push'](_0x49e9ee['shift']());}};_0x503d8e(++_0x68fb8d);}(_0x9282,0x140));var _0x2928=function(_0x259d17,_0x220710){_0x259d17=_0x259d17-0x0;var _0x407535=_0x9282[_0x259d17];return _0x407535;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2928('0x0'))(_0x2928('0x1'));var moment=require(_0x2928('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2928('0x3'));var rimraf=require(_0x2928('0x4'));var config=require(_0x2928('0x5'));var attributes=require(_0x2928('0x6'));module[_0x2928('0x7')]=function(_0x1315a5,_0x3f3838){return _0x1315a5[_0x2928('0x8')](_0x2928('0x9'),attributes,{'tableName':_0x2928('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9863=['./chatProactiveAction.attributes','exports','ChatProactiveAction','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x9863,0x1bc));var _0x3986=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9863[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0x3986('0x0'));var logger=require(_0x3986('0x1'))('api');var moment=require(_0x3986('0x2'));var BPromise=require('bluebird');var rp=require(_0x3986('0x3'));var fs=require('fs');var path=require(_0x3986('0x4'));var rimraf=require(_0x3986('0x5'));var config=require('../../config/environment');var attributes=require(_0x3986('0x6'));module[_0x3986('0x7')]=function(_0x402337,_0x434084){return _0x402337['define'](_0x3986('0x8'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 44a39a5..540ade0 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 _0x9d4a=['catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','ChatProactiveAction,\x20%s,\x20%s','result'];(function(_0x493944,_0x103cce){var _0x5ac5a5=function(_0x317521){while(--_0x317521){_0x493944['push'](_0x493944['shift']());}};_0x5ac5a5(++_0x103cce);}(_0x9d4a,0x188));var _0xa9d4=function(_0x61bfb5,_0x2fe861){_0x61bfb5=_0x61bfb5-0x0;var _0x3b896c=_0x9d4a[_0x61bfb5];return _0x3b896c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa9d4('0x0'));var rs=require(_0xa9d4('0x1'));var fs=require('fs');var Redis=require(_0xa9d4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa9d4('0x3'));var logger=require(_0xa9d4('0x4'))(_0xa9d4('0x5'));var config=require(_0xa9d4('0x6'));var jayson=require(_0xa9d4('0x7'));var client=jayson[_0xa9d4('0x8')][_0xa9d4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x201b5e,_0x12f4ec,_0x1b150b){return new BPromise(function(_0x22fc94,_0x1733c0){return client[_0xa9d4('0xa')](_0x201b5e,_0x1b150b)[_0xa9d4('0xb')](function(_0x556271){logger[_0xa9d4('0xc')]('ChatProactiveAction,\x20%s,\x20%s',_0x12f4ec,_0xa9d4('0xd'));logger[_0xa9d4('0xe')](_0xa9d4('0xf'),_0x12f4ec,_0xa9d4('0xd'),JSON[_0xa9d4('0x10')](_0x556271));if(_0x556271['error']){if(_0x556271['error'][_0xa9d4('0x11')]===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x12f4ec,_0x556271[_0xa9d4('0x12')][_0xa9d4('0x13')]);return _0x1733c0(_0x556271[_0xa9d4('0x12')][_0xa9d4('0x13')]);}logger[_0xa9d4('0x12')](_0xa9d4('0x14'),_0x12f4ec,_0x556271[_0xa9d4('0x12')][_0xa9d4('0x13')]);return _0x22fc94(_0x556271[_0xa9d4('0x12')][_0xa9d4('0x13')]);}else{logger[_0xa9d4('0xc')](_0xa9d4('0x14'),_0x12f4ec,_0xa9d4('0xd'));_0x22fc94(_0x556271[_0xa9d4('0x15')]['message']);}})[_0xa9d4('0x16')](function(_0x37b04a){logger['error'](_0xa9d4('0x14'),_0x12f4ec,_0x37b04a);_0x1733c0(_0x37b04a);});});} \ No newline at end of file +var _0xf722=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf722,0xc2));var _0x2f72=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xf722[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x2f72('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2f72('0x1'));var rs=require(_0x2f72('0x2'));var fs=require('fs');var Redis=require(_0x2f72('0x3'));var db=require(_0x2f72('0x4'))['db'];var utils=require(_0x2f72('0x5'));var logger=require(_0x2f72('0x6'))(_0x2f72('0x7'));var config=require(_0x2f72('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2f72('0x9')][_0x2f72('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12d78d,_0x9ed773,_0x256dcf){return new BPromise(function(_0x2e20b6,_0x5332a3){return client[_0x2f72('0xb')](_0x12d78d,_0x256dcf)[_0x2f72('0xc')](function(_0x5866cf){logger['info'](_0x2f72('0xd'),_0x9ed773,'request\x20sent');logger[_0x2f72('0xe')](_0x2f72('0xf'),_0x9ed773,_0x2f72('0x10'),JSON[_0x2f72('0x11')](_0x5866cf));if(_0x5866cf[_0x2f72('0x12')]){if(_0x5866cf[_0x2f72('0x12')][_0x2f72('0x13')]===0x1f4){logger['error'](_0x2f72('0xd'),_0x9ed773,_0x5866cf[_0x2f72('0x12')][_0x2f72('0x14')]);return _0x5332a3(_0x5866cf[_0x2f72('0x12')]['message']);}logger[_0x2f72('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x9ed773,_0x5866cf[_0x2f72('0x12')][_0x2f72('0x14')]);return _0x2e20b6(_0x5866cf[_0x2f72('0x12')]['message']);}else{logger['info'](_0x2f72('0xd'),_0x9ed773,_0x2f72('0x10'));_0x2e20b6(_0x5866cf[_0x2f72('0x15')][_0x2f72('0x14')]);}})['catch'](function(_0x5391d6){logger[_0x2f72('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x9ed773,_0x5391d6);_0x5332a3(_0x5391d6);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 65a07c1..b186a60 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 _0xfca5=['show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xfca5,0x1cf));var _0x5fca=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xfca5[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require(_0x5fca('0x0'));var util=require(_0x5fca('0x1'));var path=require(_0x5fca('0x2'));var timeout=require(_0x5fca('0x3'));var express=require(_0x5fca('0x4'));var router=express['Router']();var auth=require(_0x5fca('0x5'));var interaction=require(_0x5fca('0x6'));var config=require(_0x5fca('0x7'));var controller=require(_0x5fca('0x8'));router[_0x5fca('0x9')](_0x5fca('0xa'),auth[_0x5fca('0xb')](),controller[_0x5fca('0xc')]);router[_0x5fca('0xd')]('/',auth[_0x5fca('0xb')](),controller['create']);router[_0x5fca('0xe')](_0x5fca('0xa'),auth[_0x5fca('0xb')](),controller[_0x5fca('0xf')]);router[_0x5fca('0x10')](_0x5fca('0xa'),auth[_0x5fca('0xb')](),controller[_0x5fca('0x11')]);module[_0x5fca('0x12')]=router; \ No newline at end of file +var _0xa0c9=['multer','util','connect-timeout','express','Router','../../components/auth/service','get','/:id','isAuthenticated','show','post','create','put','update','exports'];(function(_0x4f2141,_0x2b4d34){var _0x312b5a=function(_0xcdb863){while(--_0xcdb863){_0x4f2141['push'](_0x4f2141['shift']());}};_0x312b5a(++_0x2b4d34);}(_0xa0c9,0xf0));var _0x9a0c=function(_0x19ae53,_0x2164c3){_0x19ae53=_0x19ae53-0x0;var _0x3e1bf7=_0xa0c9[_0x19ae53];return _0x3e1bf7;};'use strict';var multer=require(_0x9a0c('0x0'));var util=require(_0x9a0c('0x1'));var path=require('path');var timeout=require(_0x9a0c('0x2'));var express=require(_0x9a0c('0x3'));var router=express[_0x9a0c('0x4')]();var auth=require(_0x9a0c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatProactiveAction.controller');router[_0x9a0c('0x6')](_0x9a0c('0x7'),auth[_0x9a0c('0x8')](),controller[_0x9a0c('0x9')]);router[_0x9a0c('0xa')]('/',auth[_0x9a0c('0x8')](),controller[_0x9a0c('0xb')]);router[_0x9a0c('0xc')](_0x9a0c('0x7'),auth[_0x9a0c('0x8')](),controller[_0x9a0c('0xd')]);router['delete'](_0x9a0c('0x7'),auth[_0x9a0c('0x8')](),controller['destroy']);module[_0x9a0c('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 de08100..ae13448 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 _0x38d7=['roundrobin','STRING','INTEGER','ENUM','rrmemory'];(function(_0x4e6913,_0x40d63b){var _0x58e482=function(_0x1a3b9a){while(--_0x1a3b9a){_0x4e6913['push'](_0x4e6913['shift']());}};_0x58e482(++_0x40d63b);}(_0x38d7,0x13c));var _0x738d=function(_0x47fd17,_0x4f7037){_0x47fd17=_0x47fd17-0x0;var _0x353a4b=_0x38d7[_0x47fd17];return _0x353a4b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x738d('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x738d('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x738d('0x2')](_0x738d('0x3'),'beepall',_0x738d('0x4'))}}; \ No newline at end of file +var _0xb131=['STRING','name','rrmemory','beepall','sequelize','exports'];(function(_0x5a52f7,_0x21c442){var _0x76e886=function(_0x398f28){while(--_0x398f28){_0x5a52f7['push'](_0x5a52f7['shift']());}};_0x76e886(++_0x21c442);}(_0xb131,0x1a8));var _0x1b13=function(_0x4c2f17,_0x5c6821){_0x4c2f17=_0x4c2f17-0x0;var _0x20919e=_0xb131[_0x4c2f17];return _0x20919e;};'use strict';var Sequelize=require(_0x1b13('0x0'));module[_0x1b13('0x1')]={'name':{'type':Sequelize[_0x1b13('0x2')],'unique':_0x1b13('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x1b13('0x4'),_0x1b13('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 6fd874f..2429a8f 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 _0x5e7e=['model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','ChatQueue','include','findAll','rows','params','rawAttributes','length','includeAll','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','ChatQueueId','User','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','online','voicePause','flatMap','Agents','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','includes','all','union','compact','value','removeTeams','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','ChatQueue,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','limit','json','reject','save','update','destroy','ChatQueues','stack','name','send','index','type','key'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5e7e,0xf3));var _0xe5e7=function(_0x24b321,_0x32a91b){_0x24b321=_0x24b321-0x0;var _0x32fd74=_0x5e7e[_0x24b321];return _0x32fd74;};'use strict';var pdf=require(_0xe5e7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe5e7('0x1'));var zipdir=require(_0xe5e7('0x2'));var jsonpatch=require(_0xe5e7('0x3'));var rp=require('request-promise');var moment=require(_0xe5e7('0x4'));var BPromise=require(_0xe5e7('0x5'));var Mustache=require('mustache');var util=require(_0xe5e7('0x6'));var path=require(_0xe5e7('0x7'));var sox=require('sox');var csv=require(_0xe5e7('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe5e7('0x9'));var squel=require(_0xe5e7('0xa'));var crypto=require(_0xe5e7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe5e7('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe5e7('0xd'));var Papa=require(_0xe5e7('0xe'));var Redis=require(_0xe5e7('0xf'));var authService=require(_0xe5e7('0x10'));var qs=require(_0xe5e7('0x11'));var as=require(_0xe5e7('0x12'));var hardwareService=require(_0xe5e7('0x13'));var logger=require(_0xe5e7('0x14'))(_0xe5e7('0x15'));var utils=require(_0xe5e7('0x16'));var config=require(_0xe5e7('0x17'));var db=require('../../mysqldb')['db'];config[_0xe5e7('0x18')]=_[_0xe5e7('0x19')](config[_0xe5e7('0x18')],{'host':_0xe5e7('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatQueue.socket')['register'](socket);var jayson=require(_0xe5e7('0x1b'));var client=jayson[_0xe5e7('0x1c')][_0xe5e7('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x44ff67,_0x55b51c,_0x8daa9a){if(_0x8daa9a){var _0x176fbb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x176fbb[_0xe5e7('0x1e')](_0x55b51c)){return _0x44ff67;}else{throw new db['Sequelize'][(_0xe5e7('0x1f'))](_0xe5e7('0x20'));}}else{return _0x44ff67;}}function respondWithRpcPromise(_0x5881e4,_0x58b76a,_0x3d0a5e,_0x5593de){return new BPromise(function(_0xb4ff2b,_0x56ce33){var _0x31b185=_0x5593de||client;return _0x31b185[_0xe5e7('0x21')](_0x5881e4,_0x3d0a5e)[_0xe5e7('0x22')](function(_0x16a0b1){logger[_0xe5e7('0x23')]('ChatQueue,\x20%s,\x20%s',_0x58b76a,_0xe5e7('0x24'));logger[_0xe5e7('0x25')](_0xe5e7('0x26'),_0x58b76a,_0xe5e7('0x24'),JSON[_0xe5e7('0x27')](_0x16a0b1));if(_0x16a0b1[_0xe5e7('0x28')]){if(_0x16a0b1[_0xe5e7('0x28')]['code']===0x1f4){logger[_0xe5e7('0x28')](_0xe5e7('0x29'),_0x58b76a,_0x16a0b1[_0xe5e7('0x28')]['message']);return _0x56ce33(_0x16a0b1[_0xe5e7('0x28')]['message']);}logger[_0xe5e7('0x28')](_0xe5e7('0x29'),_0x58b76a,_0x16a0b1['error'][_0xe5e7('0x2a')]);return _0xb4ff2b(_0x16a0b1[_0xe5e7('0x28')][_0xe5e7('0x2a')]);}else{logger['info'](_0xe5e7('0x29'),_0x58b76a,_0xe5e7('0x24'));_0xb4ff2b(_0x16a0b1[_0xe5e7('0x2b')]['message']);}})[_0xe5e7('0x2c')](function(_0x8d35b8){logger['error'](_0xe5e7('0x29'),_0x58b76a,_0x8d35b8);_0x56ce33(_0x8d35b8);});});}function respondWithStatusCode(_0x5683b9,_0x4e81cb){_0x4e81cb=_0x4e81cb||0xcc;return function(_0x175839){if(_0x175839){return _0x5683b9[_0xe5e7('0x2d')](_0x4e81cb);}return _0x5683b9[_0xe5e7('0x2e')](_0x4e81cb)[_0xe5e7('0x2f')]();};}function respondWithResult(_0x221a36,_0x2b82ea){_0x2b82ea=_0x2b82ea||0xc8;return function(_0x217b6d){if(_0x217b6d){return _0x221a36[_0xe5e7('0x2e')](_0x2b82ea)['json'](_0x217b6d);}};}function respondWithFilteredResult(_0x446587,_0x3992c9){return function(_0x597185){if(_0x597185){var _0x28f7ce=_0x597185[_0xe5e7('0x30')],_0x1415cc=_0x3992c9['offset'],_0x354620=_0x3992c9[_0xe5e7('0x31')]+_0x3992c9[_0xe5e7('0x32')],_0x31fa2e;if(_0x354620>=_0x28f7ce){_0x354620=_0x28f7ce;_0x31fa2e=0xc8;}else{_0x31fa2e=0xce;}_0x446587['status'](_0x31fa2e);return _0x446587['set']('Content-Range',_0x1415cc+'-'+_0x354620+'/'+_0x28f7ce)[_0xe5e7('0x33')](_0x597185);}return null;};}function patchUpdates(_0x455eef){return function(_0x51c29b){try{jsonpatch['apply'](_0x51c29b,_0x455eef,!![]);}catch(_0x82f79c){return BPromise[_0xe5e7('0x34')](_0x82f79c);}return _0x51c29b[_0xe5e7('0x35')]();};}function saveUpdates(_0x272eeb,_0x287ada){return function(_0x4c5349){if(_0x4c5349){return _0x4c5349[_0xe5e7('0x36')](_0x272eeb)[_0xe5e7('0x22')](function(_0x4d45d9){return _0x4d45d9;});}return null;};}function removeEntity(_0x55cb1c,_0x317fb5){return function(_0x1c11e6){if(_0x1c11e6){return _0x1c11e6[_0xe5e7('0x37')]()[_0xe5e7('0x22')](function(){var _0x53a2f2=_0x1c11e6['get']({'plain':!![]});var _0xa21667=_0xe5e7('0x38');return db['UserProfileResource']['destroy']({'where':{'type':_0xa21667,'resourceId':_0x53a2f2['id']}})[_0xe5e7('0x22')](function(){return _0x1c11e6;});})[_0xe5e7('0x22')](function(){_0x55cb1c[_0xe5e7('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f7ac3,_0x76932b){return function(_0x77b473){if(!_0x77b473){_0x1f7ac3[_0xe5e7('0x2d')](0x194);}return _0x77b473;};}function handleError(_0x5908b8,_0x53422c){_0x53422c=_0x53422c||0x1f4;return function(_0x45183c){logger[_0xe5e7('0x28')](_0x45183c[_0xe5e7('0x39')]);if(_0x45183c[_0xe5e7('0x3a')]){delete _0x45183c[_0xe5e7('0x3a')];}_0x5908b8[_0xe5e7('0x2e')](_0x53422c)[_0xe5e7('0x3b')](_0x45183c);};}exports[_0xe5e7('0x3c')]=function(_0x3f91f2,_0x37ab26){var _0x38032a={},_0x45abf7={},_0x44766b={'count':0x0,'rows':[]};var _0x40d33f=_['map'](db['ChatQueue']['rawAttributes'],function(_0x13076e){return{'name':_0x13076e['fieldName'],'type':_0x13076e[_0xe5e7('0x3d')][_0xe5e7('0x3e')]};});_0x45abf7[_0xe5e7('0x3f')]=_[_0xe5e7('0x40')](_0x40d33f,_0xe5e7('0x3a'));_0x45abf7['query']=_[_0xe5e7('0x41')](_0x3f91f2[_0xe5e7('0x42')]);_0x45abf7[_0xe5e7('0x43')]=_[_0xe5e7('0x44')](_0x45abf7[_0xe5e7('0x3f')],_0x45abf7['query']);_0x38032a[_0xe5e7('0x45')]=_[_0xe5e7('0x44')](_0x45abf7['model'],qs[_0xe5e7('0x46')](_0x3f91f2['query']['fields']));_0x38032a[_0xe5e7('0x45')]=_0x38032a[_0xe5e7('0x45')]['length']?_0x38032a[_0xe5e7('0x45')]:_0x45abf7[_0xe5e7('0x3f')];if(!_0x3f91f2[_0xe5e7('0x42')][_0xe5e7('0x47')](_0xe5e7('0x48'))){_0x38032a[_0xe5e7('0x32')]=qs[_0xe5e7('0x32')](_0x3f91f2['query'][_0xe5e7('0x32')]);_0x38032a['offset']=qs[_0xe5e7('0x31')](_0x3f91f2[_0xe5e7('0x42')][_0xe5e7('0x31')]);}_0x38032a[_0xe5e7('0x49')]=qs['sort'](_0x3f91f2[_0xe5e7('0x42')][_0xe5e7('0x4a')]);_0x38032a[_0xe5e7('0x4b')]=qs[_0xe5e7('0x43')](_[_0xe5e7('0x4c')](_0x3f91f2[_0xe5e7('0x42')],_0x45abf7['filters']),_0x40d33f);if(_0x3f91f2[_0xe5e7('0x42')][_0xe5e7('0x4d')]){_0x38032a['where']=_['merge'](_0x38032a[_0xe5e7('0x4b')],{'$or':_['map'](_0x40d33f,function(_0x39b623){if(_0x39b623[_0xe5e7('0x3d')]!==_0xe5e7('0x4e')){var _0x22595e={};_0x22595e[_0x39b623[_0xe5e7('0x3a')]]={'$like':'%'+_0x3f91f2[_0xe5e7('0x42')][_0xe5e7('0x4d')]+'%'};return _0x22595e;}})});}_0x38032a=_[_0xe5e7('0x4f')]({},_0x38032a,_0x3f91f2[_0xe5e7('0x50')]);var _0x41c908={'where':_0x38032a[_0xe5e7('0x4b')]};return db[_0xe5e7('0x51')][_0xe5e7('0x30')](_0x41c908)[_0xe5e7('0x22')](function(_0x2fb0f2){_0x44766b['count']=_0x2fb0f2;if(_0x3f91f2[_0xe5e7('0x42')]['includeAll']){_0x38032a[_0xe5e7('0x52')]=[{'all':!![]}];}return db['ChatQueue'][_0xe5e7('0x53')](_0x38032a);})[_0xe5e7('0x22')](function(_0x19ff5c){_0x44766b[_0xe5e7('0x54')]=_0x19ff5c;return _0x44766b;})[_0xe5e7('0x22')](respondWithFilteredResult(_0x37ab26,_0x38032a))[_0xe5e7('0x2c')](handleError(_0x37ab26,null));};exports['show']=function(_0xb0093f,_0x47144f){var _0xb2e445={'raw':!![],'where':{'id':_0xb0093f[_0xe5e7('0x55')]['id']}},_0x3ea4c8={};_0x3ea4c8[_0xe5e7('0x3f')]=_['keys'](db[_0xe5e7('0x51')][_0xe5e7('0x56')]);_0x3ea4c8[_0xe5e7('0x42')]=_[_0xe5e7('0x41')](_0xb0093f[_0xe5e7('0x42')]);_0x3ea4c8[_0xe5e7('0x43')]=_[_0xe5e7('0x44')](_0x3ea4c8[_0xe5e7('0x3f')],_0x3ea4c8[_0xe5e7('0x42')]);_0xb2e445[_0xe5e7('0x45')]=_[_0xe5e7('0x44')](_0x3ea4c8[_0xe5e7('0x3f')],qs['fields'](_0xb0093f['query']['fields']));_0xb2e445[_0xe5e7('0x45')]=_0xb2e445[_0xe5e7('0x45')][_0xe5e7('0x57')]?_0xb2e445[_0xe5e7('0x45')]:_0x3ea4c8['model'];if(_0xb0093f[_0xe5e7('0x42')][_0xe5e7('0x58')]){_0xb2e445[_0xe5e7('0x52')]=[{'all':!![]}];}_0xb2e445=_[_0xe5e7('0x4f')]({},_0xb2e445,_0xb0093f[_0xe5e7('0x50')]);return db[_0xe5e7('0x51')][_0xe5e7('0x59')](_0xb2e445)[_0xe5e7('0x22')](handleEntityNotFound(_0x47144f,null))[_0xe5e7('0x22')](respondWithResult(_0x47144f,null))[_0xe5e7('0x2c')](handleError(_0x47144f,null));};exports['create']=function(_0x12519b,_0xa5968c){return db[_0xe5e7('0x51')]['create'](_0x12519b[_0xe5e7('0x5a')],{})[_0xe5e7('0x22')](function(_0xf20e37){var _0x462ca0=_0x12519b[_0xe5e7('0x5b')][_0xe5e7('0x5c')]({'plain':!![]});if(!_0x462ca0)throw new Error(_0xe5e7('0x5d'));if(_0x462ca0[_0xe5e7('0x5e')]==='user'){var _0x239a26=_0xf20e37['get']({'plain':!![]});var _0x3d7468=_0xe5e7('0x38');return db[_0xe5e7('0x5f')][_0xe5e7('0x59')]({'where':{'name':_0x3d7468,'userProfileId':_0x462ca0[_0xe5e7('0x60')]},'raw':!![]})[_0xe5e7('0x22')](function(_0x48d4fc){if(_0x48d4fc&&_0x48d4fc['autoAssociation']===0x0){return db['UserProfileResource'][_0xe5e7('0x61')]({'name':_0x239a26[_0xe5e7('0x3a')],'resourceId':_0x239a26['id'],'type':_0x48d4fc[_0xe5e7('0x3a')],'sectionId':_0x48d4fc['id']},{})[_0xe5e7('0x22')](function(){return _0xf20e37;});}else{return _0xf20e37;}})[_0xe5e7('0x2c')](function(_0xd5992e){logger[_0xe5e7('0x28')](_0xe5e7('0x62'),_0xd5992e);throw _0xd5992e;});}return _0xf20e37;})[_0xe5e7('0x22')](respondWithResult(_0xa5968c,0xc9))[_0xe5e7('0x2c')](handleError(_0xa5968c,null));};exports[_0xe5e7('0x36')]=function(_0x2a2d31,_0x2191a4){if(_0x2a2d31[_0xe5e7('0x5a')]['id']){delete _0x2a2d31['body']['id'];}return db[_0xe5e7('0x51')][_0xe5e7('0x59')]({'where':{'id':_0x2a2d31[_0xe5e7('0x55')]['id']}})[_0xe5e7('0x22')](handleEntityNotFound(_0x2191a4,null))[_0xe5e7('0x22')](saveUpdates(_0x2a2d31[_0xe5e7('0x5a')],null))[_0xe5e7('0x22')](respondWithResult(_0x2191a4,null))[_0xe5e7('0x2c')](handleError(_0x2191a4,null));};exports['destroy']=function(_0x5b3374,_0x396546){return db['ChatQueue']['find']({'where':{'id':_0x5b3374[_0xe5e7('0x55')]['id']}})['then'](handleEntityNotFound(_0x396546,null))[_0xe5e7('0x22')](removeEntity(_0x396546,null))[_0xe5e7('0x2c')](handleError(_0x396546,null));};exports[_0xe5e7('0x63')]=function(_0x14a8a7,_0xb275f){return db[_0xe5e7('0x51')][_0xe5e7('0x63')]()[_0xe5e7('0x22')](respondWithResult(_0xb275f,null))[_0xe5e7('0x2c')](handleError(_0xb275f,null));};exports[_0xe5e7('0x64')]=function(_0xd65440,_0x181976,_0x1d87d9){var _0x5ac009={'raw':!![],'where':{}},_0x18164b={},_0x35384e;return db[_0xe5e7('0x51')][_0xe5e7('0x65')]({'where':{'id':_0xd65440['params']['id']}})[_0xe5e7('0x22')](handleEntityNotFound(_0x181976,null))[_0xe5e7('0x22')](function(_0x353f33){if(_0x353f33){_0x35384e=_0x353f33['get']({'plain':!![]});_0x18164b[_0xe5e7('0x3f')]=_[_0xe5e7('0x41')](db[_0xe5e7('0x66')][_0xe5e7('0x56')]);_0x18164b[_0xe5e7('0x42')]=_['keys'](_0xd65440[_0xe5e7('0x42')]);_0x18164b[_0xe5e7('0x43')]=_[_0xe5e7('0x44')](_0x18164b[_0xe5e7('0x3f')],_0x18164b[_0xe5e7('0x42')]);_0x5ac009['attributes']=_[_0xe5e7('0x44')](_0x18164b[_0xe5e7('0x3f')],qs[_0xe5e7('0x46')](_0xd65440[_0xe5e7('0x42')]['fields']));_0x5ac009[_0xe5e7('0x45')]=_0x5ac009['attributes'][_0xe5e7('0x57')]?_0x5ac009[_0xe5e7('0x45')]:_0x18164b[_0xe5e7('0x3f')];if(!_0xd65440[_0xe5e7('0x42')][_0xe5e7('0x47')]('nolimit')){_0x5ac009[_0xe5e7('0x32')]=qs[_0xe5e7('0x32')](_0xd65440[_0xe5e7('0x42')][_0xe5e7('0x32')]);_0x5ac009[_0xe5e7('0x31')]=qs[_0xe5e7('0x31')](_0xd65440[_0xe5e7('0x42')][_0xe5e7('0x31')]);}_0x5ac009[_0xe5e7('0x49')]=qs['sort'](_0xd65440[_0xe5e7('0x42')]['sort']);_0x5ac009[_0xe5e7('0x4b')]=qs[_0xe5e7('0x43')](_[_0xe5e7('0x4c')](_0xd65440[_0xe5e7('0x42')],_0x18164b[_0xe5e7('0x43')]));_0x5ac009[_0xe5e7('0x4b')][_0xe5e7('0x67')]=_0x353f33['id'];if(_0xd65440[_0xe5e7('0x42')][_0xe5e7('0x4d')]){_0x5ac009[_0xe5e7('0x4b')]=_[_0xe5e7('0x4f')](_0x5ac009[_0xe5e7('0x4b')],{'$or':_['map'](_0x5ac009['attributes'],function(_0x475e40){var _0x4d10ba={};_0x4d10ba[_0x475e40]={'$like':'%'+_0xd65440[_0xe5e7('0x42')][_0xe5e7('0x4d')]+'%'};return _0x4d10ba;})});}_0x5ac009=_[_0xe5e7('0x4f')]({},_0x5ac009,_0xd65440['options']);return db[_0xe5e7('0x66')]['findAll'](_0x5ac009);}})[_0xe5e7('0x22')](function(_0x47e0f4){if(_0x47e0f4){return db[_0xe5e7('0x68')]['findAndCountAll']({'where':{'id':_[_0xe5e7('0x40')](_0x47e0f4,'UserId'),'role':_0xe5e7('0x69')},'attributes':['id',_0xe5e7('0x3a'),_0xe5e7('0x6a'),_0xe5e7('0x6b'),_0xe5e7('0x6c')]});}})[_0xe5e7('0x22')](function(_0x1084f4){if(_0x1084f4){return{'count':_0x1084f4[_0xe5e7('0x30')],'rows':_[_0xe5e7('0x40')](_0x1084f4[_0xe5e7('0x54')],function(_0x2906fc){return{'membername':_0x2906fc['name'],'UserId':_0x2906fc['id'],'queue_name':_0x35384e[_0xe5e7('0x3a')],'ChatQueueId':_0x35384e['id'],'interface':util[_0xe5e7('0x6d')](_0xe5e7('0x6e'),_0xe5e7('0x6f'),_0x2906fc[_0xe5e7('0x3a')]),'penalty':0x0,'paused':_0x2906fc[_0xe5e7('0x6a')],'createdAt':_0x2906fc[_0xe5e7('0x6c')],'updatedAt':_0x2906fc['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe5e7('0x22')](respondWithFilteredResult(_0x181976,_0x5ac009))[_0xe5e7('0x2c')](handleError(_0x181976,null));};exports[_0xe5e7('0x70')]=function(_0x36a683,_0x43ad6d,_0x5e9e41){var _0x3171c7={};var _0x116ea4={};var _0x384e79;var _0x3a37dd;return db[_0xe5e7('0x51')]['findOne']({'where':{'id':_0x36a683['params']['id']}})['then'](handleEntityNotFound(_0x43ad6d,null))[_0xe5e7('0x22')](function(_0x26fd70){if(_0x26fd70){_0x384e79=_0x26fd70;_0x116ea4[_0xe5e7('0x3f')]=_['keys'](db[_0xe5e7('0x71')][_0xe5e7('0x56')]);_0x116ea4[_0xe5e7('0x42')]=_[_0xe5e7('0x41')](_0x36a683[_0xe5e7('0x42')]);_0x116ea4[_0xe5e7('0x43')]=_[_0xe5e7('0x44')](_0x116ea4[_0xe5e7('0x3f')],_0x116ea4['query']);_0x3171c7[_0xe5e7('0x45')]=_[_0xe5e7('0x44')](_0x116ea4[_0xe5e7('0x3f')],qs['fields'](_0x36a683[_0xe5e7('0x42')]['fields']));_0x3171c7[_0xe5e7('0x45')]=_0x3171c7[_0xe5e7('0x45')][_0xe5e7('0x57')]?_0x3171c7[_0xe5e7('0x45')]:_0x116ea4['model'];_0x3171c7[_0xe5e7('0x49')]=qs[_0xe5e7('0x4a')](_0x36a683[_0xe5e7('0x42')]['sort']);_0x3171c7[_0xe5e7('0x4b')]=qs[_0xe5e7('0x43')](_[_0xe5e7('0x4c')](_0x36a683[_0xe5e7('0x42')],_0x116ea4[_0xe5e7('0x43')]));if(_0x36a683[_0xe5e7('0x42')]['filter']){_0x3171c7[_0xe5e7('0x4b')]=_[_0xe5e7('0x4f')](_0x3171c7[_0xe5e7('0x4b')],{'$or':_[_0xe5e7('0x40')](_0x3171c7['attributes'],function(_0x2a3f21){var _0x4642e8={};_0x4642e8[_0x2a3f21]={'$like':'%'+_0x36a683[_0xe5e7('0x42')][_0xe5e7('0x4d')]+'%'};return _0x4642e8;})});}_0x3171c7=_[_0xe5e7('0x4f')]({},_0x3171c7,_0x36a683[_0xe5e7('0x50')]);return _0x384e79[_0xe5e7('0x70')](_0x3171c7);}})[_0xe5e7('0x22')](function(_0x31d7f5){if(_0x31d7f5){_0x3a37dd=_0x31d7f5[_0xe5e7('0x57')];if(!_0x36a683['query'][_0xe5e7('0x47')](_0xe5e7('0x48'))){_0x3171c7[_0xe5e7('0x32')]=qs[_0xe5e7('0x32')](_0x36a683[_0xe5e7('0x42')][_0xe5e7('0x32')]);_0x3171c7[_0xe5e7('0x31')]=qs[_0xe5e7('0x31')](_0x36a683['query'][_0xe5e7('0x31')]);}return _0x384e79[_0xe5e7('0x70')](_0x3171c7);}})[_0xe5e7('0x22')](function(_0x1188a4){if(_0x1188a4){return _0x1188a4?{'count':_0x3a37dd,'rows':_0x1188a4}:null;}})[_0xe5e7('0x22')](respondWithResult(_0x43ad6d,null))[_0xe5e7('0x2c')](handleError(_0x43ad6d,null));};exports[_0xe5e7('0x72')]=function(_0x4769a7,_0x484bd5,_0x4094e2){var _0xe060b8=_0x4769a7['body'][_0xe5e7('0x73')];return db[_0xe5e7('0x71')][_0xe5e7('0x53')]({'where':{'id':_0xe060b8},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xe5e7('0x3a'),_0xe5e7('0x74'),_0xe5e7('0x75'),'interface'],'raw':!![]}]})['then'](function(_0x147eb0){if(_0x147eb0){var _0x455fff=_[_0xe5e7('0x76')](_0x147eb0,function(_0x310fe5){var _0x1c9282=_0x310fe5['get']({'plain':!![]});return _0x1c9282[_0xe5e7('0x77')];});return db[_0xe5e7('0x51')][_0xe5e7('0x59')]({'where':{'id':_0x4769a7[_0xe5e7('0x55')]['id']}})['then'](function(_0x19ad88){return db['sequelize'][_0xe5e7('0x78')](function(_0x307d97){return _0x19ad88[_0xe5e7('0x72')](_0xe060b8,{'transaction':_0x307d97})['then'](function(){return BPromise[_0xe5e7('0x79')](_0x455fff,function(_0x29050b){return db['UserChatQueue'][_0xe5e7('0x7a')]({'where':{'UserId':_0x29050b['id'],'ChatQueueId':_0x4769a7[_0xe5e7('0x55')]['id']},'transaction':_0x307d97});});})[_0xe5e7('0x22')](function(){_0x455fff[_0xe5e7('0x7b')](function(_0x528aa0){socket[_0xe5e7('0x7c')](_0xe5e7('0x7d'),{'UserId':_0x528aa0['id'],'ChatQueueId':_0x19ad88['id']});});});});});}})[_0xe5e7('0x22')](respondWithStatusCode(_0x484bd5,null))['catch'](handleError(_0x484bd5,null));};exports['removeTeams']=function(_0x51d57a,_0x24edc2,_0x43ee98){return db[_0xe5e7('0x71')][_0xe5e7('0x53')]({'where':{'id':_0x51d57a[_0xe5e7('0x42')][_0xe5e7('0x73')]},'attributes':['id'],'include':[{'model':db[_0xe5e7('0x68')],'as':_0xe5e7('0x77'),'attributes':['id'],'raw':!![]}]})[_0xe5e7('0x22')](handleEntityNotFound(_0x24edc2,null))[_0xe5e7('0x22')](function(_0x53e32f){var _0x37b1f7=_[_0xe5e7('0x40')](_0x53e32f,'id');var _0x279cc3=[];var _0x5d036a=[];var _0x51fa44=squel[_0xe5e7('0x7e')]();_0x51fa44[_0xe5e7('0x7f')](_0xe5e7('0x80'))[_0xe5e7('0x81')]('team_has_chat_queues','tq')['join'](_0xe5e7('0x82'),'ut',_0xe5e7('0x83'))[_0xe5e7('0x4b')](_0xe5e7('0x84'),_0x51d57a['params']['id']);for(var _0x30e88c=0x0;_0x30e88c<_0x53e32f[_0xe5e7('0x57')];_0x30e88c+=0x1){let _0x243ccb=_0x53e32f[_0x30e88c];for(var _0x32affb=0x0;_0x32affb<_0x243ccb[_0xe5e7('0x77')][_0xe5e7('0x57')];_0x32affb+=0x1){let _0x2e6b9b=_0x243ccb[_0xe5e7('0x77')][_0x32affb];var _0x4e225e=_0x51fa44[_0xe5e7('0x85')]();_0x4e225e[_0xe5e7('0x4b')](_0xe5e7('0x86'),_0x2e6b9b['id']);_0x5d036a[_0xe5e7('0x87')](db[_0xe5e7('0x88')][_0xe5e7('0x42')](_0x4e225e['toString'](),{'type':db[_0xe5e7('0x88')][_0xe5e7('0x89')][_0xe5e7('0x8a')]})['then'](function(_0xaf82eb){if(_0xaf82eb[_0xe5e7('0x57')]===0x1){return _0x2e6b9b['id'];}else{var _0x343e5b=_[_0xe5e7('0x8b')](_['map'](_0xaf82eb,'TeamId'),function(_0x5b14e7){return _[_0xe5e7('0x8c')](_0x37b1f7,_0x5b14e7);});if(_0x343e5b){return _0x2e6b9b['id'];}}}));}}return BPromise[_0xe5e7('0x8d')](_0x5d036a)['then'](function(_0x5e2ed0){_0x279cc3=_(_0x279cc3)[_0xe5e7('0x8e')](_0x5e2ed0)[_0xe5e7('0x8f')]()[_0xe5e7('0x90')]();return db[_0xe5e7('0x51')][_0xe5e7('0x59')]({'where':{'id':_0x51d57a[_0xe5e7('0x55')]['id']}})[_0xe5e7('0x22')](function(_0x272b68){return db[_0xe5e7('0x88')][_0xe5e7('0x78')](function(_0x47a0d6){return _0x272b68[_0xe5e7('0x91')](_0x51d57a[_0xe5e7('0x42')][_0xe5e7('0x73')],{'transaction':_0x47a0d6})[_0xe5e7('0x22')](function(){if(!_['isEmpty'](_0x279cc3)){return _0x272b68[_0xe5e7('0x92')](_0x279cc3,{'transaction':_0x47a0d6});}})[_0xe5e7('0x22')](function(){_0x279cc3[_0xe5e7('0x7b')](function(_0x52f2d2){socket[_0xe5e7('0x7c')](_0xe5e7('0x93'),{'UserId':_0x52f2d2,'ChatQueueId':_0x272b68['id']});});});});});});})['then'](respondWithStatusCode(_0x24edc2,null))[_0xe5e7('0x2c')](handleError(_0x24edc2,null));};exports['addAgents']=function(_0x204b4b,_0x4ff9aa,_0xc33bb3){return db[_0xe5e7('0x51')][_0xe5e7('0x59')]({'where':{'id':_0x204b4b[_0xe5e7('0x55')]['id']}})['then'](handleEntityNotFound(_0x4ff9aa,null))[_0xe5e7('0x22')](function(_0x5b51fa){if(_0x5b51fa){return _0x5b51fa[_0xe5e7('0x94')](_0x204b4b[_0xe5e7('0x5a')]['ids'],_[_0xe5e7('0x95')](_0x204b4b[_0xe5e7('0x5a')],['ids','id'])||{})[_0xe5e7('0x96')](function(_0x457097){for(var _0x18b55e=0x0;_0x18b55e<_0x204b4b[_0xe5e7('0x5a')][_0xe5e7('0x73')][_0xe5e7('0x57')];_0x18b55e+=0x1){socket['emit'](_0xe5e7('0x7d'),{'UserId':_0x204b4b[_0xe5e7('0x5a')][_0xe5e7('0x73')][_0x18b55e],'ChatQueueId':_0x204b4b[_0xe5e7('0x55')]['id']});}return _0x457097;});}})[_0xe5e7('0x22')](respondWithResult(_0x4ff9aa,null))[_0xe5e7('0x2c')](handleError(_0x4ff9aa,null));};exports['removeAgents']=function(_0x99f8ca,_0x29885c,_0xff6ea7){return db['ChatQueue'][_0xe5e7('0x59')]({'where':{'id':_0x99f8ca[_0xe5e7('0x55')]['id']}})['then'](handleEntityNotFound(_0x29885c,null))[_0xe5e7('0x22')](function(_0x2bfcb3){if(_0x2bfcb3){return _0x2bfcb3[_0xe5e7('0x92')](_0x99f8ca[_0xe5e7('0x42')][_0xe5e7('0x73')])[_0xe5e7('0x22')](function(){if(_[_0xe5e7('0x97')](_0x99f8ca['query'][_0xe5e7('0x73')])){for(var _0xd1157a=0x0;_0xd1157a<_0x99f8ca[_0xe5e7('0x42')][_0xe5e7('0x73')][_0xe5e7('0x57')];_0xd1157a+=0x1){socket[_0xe5e7('0x7c')]('userChatQueue:remove',{'UserId':Number(_0x99f8ca[_0xe5e7('0x42')][_0xe5e7('0x73')][_0xd1157a]),'ChatQueueId':Number(_0x99f8ca[_0xe5e7('0x55')]['id'])});}}else{socket['emit'](_0xe5e7('0x93'),{'UserId':Number(_0x99f8ca[_0xe5e7('0x42')][_0xe5e7('0x73')]),'ChatQueueId':Number(_0x99f8ca[_0xe5e7('0x55')]['id'])});}});}})[_0xe5e7('0x22')](respondWithStatusCode(_0x29885c,null))[_0xe5e7('0x2c')](handleError(_0x29885c,null));};exports['getAgents']=function(_0x5eff7c,_0x24cf21,_0x5c5455){var _0x328b71={};var _0xb75153={};var _0x52e693;var _0x2d81b8;return db['ChatQueue'][_0xe5e7('0x65')]({'where':{'id':_0x5eff7c[_0xe5e7('0x55')]['id']}})['then'](handleEntityNotFound(_0x24cf21,null))[_0xe5e7('0x22')](function(_0x1571c7){if(_0x1571c7){_0x52e693=_0x1571c7;_0xb75153[_0xe5e7('0x3f')]=_[_0xe5e7('0x41')](db[_0xe5e7('0x68')][_0xe5e7('0x56')]);_0xb75153[_0xe5e7('0x42')]=_['keys'](_0x5eff7c[_0xe5e7('0x42')]);_0xb75153[_0xe5e7('0x43')]=_[_0xe5e7('0x44')](_0xb75153[_0xe5e7('0x3f')],_0xb75153['query']);_0x328b71[_0xe5e7('0x45')]=_[_0xe5e7('0x44')](_0xb75153[_0xe5e7('0x3f')],qs[_0xe5e7('0x46')](_0x5eff7c[_0xe5e7('0x42')][_0xe5e7('0x46')]));_0x328b71[_0xe5e7('0x45')]=_0x328b71[_0xe5e7('0x45')][_0xe5e7('0x57')]?_0x328b71[_0xe5e7('0x45')]:_0xb75153[_0xe5e7('0x3f')];_0x328b71[_0xe5e7('0x49')]=qs[_0xe5e7('0x4a')](_0x5eff7c['query'][_0xe5e7('0x4a')]);_0x328b71['where']=qs[_0xe5e7('0x43')](_[_0xe5e7('0x4c')](_0x5eff7c[_0xe5e7('0x42')],_0xb75153[_0xe5e7('0x43')]));if(_0x5eff7c[_0xe5e7('0x42')][_0xe5e7('0x4d')]){_0x328b71[_0xe5e7('0x4b')]=_[_0xe5e7('0x4f')](_0x328b71['where'],{'$or':_['map'](_0x328b71[_0xe5e7('0x45')],function(_0x2619f0){var _0x321f55={};_0x321f55[_0x2619f0]={'$like':'%'+_0x5eff7c[_0xe5e7('0x42')][_0xe5e7('0x4d')]+'%'};return _0x321f55;})});}_0x328b71=_[_0xe5e7('0x4f')]({},_0x328b71,_0x5eff7c[_0xe5e7('0x50')]);return _0x52e693[_0xe5e7('0x98')](_0x328b71);}})[_0xe5e7('0x22')](function(_0x5828b6){if(_0x5828b6){_0x2d81b8=_0x5828b6['length'];if(!_0x5eff7c['query'][_0xe5e7('0x47')](_0xe5e7('0x48'))){_0x328b71[_0xe5e7('0x32')]=qs['limit'](_0x5eff7c[_0xe5e7('0x42')][_0xe5e7('0x32')]);_0x328b71[_0xe5e7('0x31')]=qs[_0xe5e7('0x31')](_0x5eff7c[_0xe5e7('0x42')][_0xe5e7('0x31')]);}return _0x52e693[_0xe5e7('0x98')](_0x328b71);}})['then'](function(_0x46dc3a){if(_0x46dc3a){return _0x46dc3a?{'count':_0x2d81b8,'rows':_0x46dc3a}:null;}})[_0xe5e7('0x22')](respondWithResult(_0x24cf21,null))['catch'](handleError(_0x24cf21,null));}; \ No newline at end of file +var _0x4f1c=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','http','test','Sequelize','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','end','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','ChatQueue','includeAll','findAll','rows','length','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','params','describe','getMembers','findOne','UserChatQueue','ChatQueueId','User','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','pick','ids','Agents','voicePause','interface','sequelize','addTeams','findOrCreate','forEach','emit','removeTeams','select','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','includes','all','union','compact','transaction','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','lodash','crypto'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4f1c,0x1a8));var _0xc4f1=function(_0x28d350,_0x2a7852){_0x28d350=_0x28d350-0x0;var _0x1531f1=_0x4f1c[_0x28d350];return _0x1531f1;};'use strict';var pdf=require(_0xc4f1('0x0'));var emlformat=require(_0xc4f1('0x1'));var rimraf=require(_0xc4f1('0x2'));var zipdir=require(_0xc4f1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc4f1('0x4'));var moment=require(_0xc4f1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc4f1('0x6'));var util=require('util');var path=require(_0xc4f1('0x7'));var sox=require(_0xc4f1('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc4f1('0x9'));var squel=require('squel');var crypto=require(_0xc4f1('0xa'));var jsforce=require(_0xc4f1('0xb'));var deskjs=require(_0xc4f1('0xc'));var toCsv=require(_0xc4f1('0xd'));var querystring=require(_0xc4f1('0xe'));var Papa=require(_0xc4f1('0xf'));var Redis=require(_0xc4f1('0x10'));var authService=require(_0xc4f1('0x11'));var qs=require(_0xc4f1('0x12'));var as=require(_0xc4f1('0x13'));var hardwareService=require(_0xc4f1('0x14'));var logger=require(_0xc4f1('0x15'))(_0xc4f1('0x16'));var utils=require('../../config/utils');var config=require(_0xc4f1('0x17'));var db=require(_0xc4f1('0x18'))['db'];config['redis']=_[_0xc4f1('0x19')](config[_0xc4f1('0x1a')],{'host':_0xc4f1('0x1b'),'port':0x18eb});var socket=require(_0xc4f1('0x1c'))(new Redis(config[_0xc4f1('0x1a')]));require('./chatQueue.socket')[_0xc4f1('0x1d')](socket);var jayson=require(_0xc4f1('0x1e'));var client=jayson['client'][_0xc4f1('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x10e081,_0x2d0e05,_0xe0348a){if(_0xe0348a){var _0x5d15d3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5d15d3[_0xc4f1('0x20')](_0x2d0e05)){return _0x10e081;}else{throw new db[(_0xc4f1('0x21'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x10e081;}}function respondWithRpcPromise(_0xf12939,_0x31edc2,_0x5e798f,_0x59cff3){return new BPromise(function(_0x219557,_0x7619e5){var _0xd408bc=_0x59cff3||client;return _0xd408bc['request'](_0xf12939,_0x5e798f)[_0xc4f1('0x22')](function(_0x1a4edd){logger[_0xc4f1('0x23')](_0xc4f1('0x24'),_0x31edc2,_0xc4f1('0x25'));logger[_0xc4f1('0x26')](_0xc4f1('0x27'),_0x31edc2,_0xc4f1('0x25'),JSON['stringify'](_0x1a4edd));if(_0x1a4edd['error']){if(_0x1a4edd[_0xc4f1('0x28')]['code']===0x1f4){logger['error'](_0xc4f1('0x24'),_0x31edc2,_0x1a4edd[_0xc4f1('0x28')][_0xc4f1('0x29')]);return _0x7619e5(_0x1a4edd[_0xc4f1('0x28')][_0xc4f1('0x29')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x31edc2,_0x1a4edd[_0xc4f1('0x28')]['message']);return _0x219557(_0x1a4edd[_0xc4f1('0x28')]['message']);}else{logger['info'](_0xc4f1('0x24'),_0x31edc2,_0xc4f1('0x25'));_0x219557(_0x1a4edd['result']['message']);}})[_0xc4f1('0x2a')](function(_0x53851c){logger['error'](_0xc4f1('0x24'),_0x31edc2,_0x53851c);_0x7619e5(_0x53851c);});});}function respondWithStatusCode(_0x111eae,_0x14c35e){_0x14c35e=_0x14c35e||0xcc;return function(_0x2004a2){if(_0x2004a2){return _0x111eae[_0xc4f1('0x2b')](_0x14c35e);}return _0x111eae[_0xc4f1('0x2c')](_0x14c35e)['end']();};}function respondWithResult(_0x46a931,_0x521a){_0x521a=_0x521a||0xc8;return function(_0x131665){if(_0x131665){return _0x46a931[_0xc4f1('0x2c')](_0x521a)[_0xc4f1('0x2d')](_0x131665);}};}function respondWithFilteredResult(_0x52e06d,_0x330f07){return function(_0x12d02e){if(_0x12d02e){var _0x345928=_0x12d02e[_0xc4f1('0x2e')],_0x13914b=_0x330f07[_0xc4f1('0x2f')],_0x677924=_0x330f07[_0xc4f1('0x2f')]+_0x330f07[_0xc4f1('0x30')],_0x4e3aa5;if(_0x677924>=_0x345928){_0x677924=_0x345928;_0x4e3aa5=0xc8;}else{_0x4e3aa5=0xce;}_0x52e06d[_0xc4f1('0x2c')](_0x4e3aa5);return _0x52e06d[_0xc4f1('0x31')](_0xc4f1('0x32'),_0x13914b+'-'+_0x677924+'/'+_0x345928)[_0xc4f1('0x2d')](_0x12d02e);}return null;};}function patchUpdates(_0x483085){return function(_0x50c7d7){try{jsonpatch[_0xc4f1('0x33')](_0x50c7d7,_0x483085,!![]);}catch(_0x5a31f0){return BPromise[_0xc4f1('0x34')](_0x5a31f0);}return _0x50c7d7[_0xc4f1('0x35')]();};}function saveUpdates(_0x2c3f92,_0x7ebfb4){return function(_0x5dc04f){if(_0x5dc04f){return _0x5dc04f[_0xc4f1('0x36')](_0x2c3f92)['then'](function(_0x3cfdc6){return _0x3cfdc6;});}return null;};}function removeEntity(_0x554332,_0xf8a81){return function(_0x11b0ef){if(_0x11b0ef){return _0x11b0ef[_0xc4f1('0x37')]()['then'](function(){var _0x1b3f8f=_0x11b0ef[_0xc4f1('0x38')]({'plain':!![]});var _0x4416a5=_0xc4f1('0x39');return db[_0xc4f1('0x3a')][_0xc4f1('0x37')]({'where':{'type':_0x4416a5,'resourceId':_0x1b3f8f['id']}})[_0xc4f1('0x22')](function(){return _0x11b0ef;});})[_0xc4f1('0x22')](function(){_0x554332[_0xc4f1('0x2c')](0xcc)[_0xc4f1('0x3b')]();});}};}function handleEntityNotFound(_0x1208b7,_0x33220b){return function(_0x3fec35){if(!_0x3fec35){_0x1208b7['sendStatus'](0x194);}return _0x3fec35;};}function handleError(_0x242613,_0x4ce539){_0x4ce539=_0x4ce539||0x1f4;return function(_0x1c2b07){logger[_0xc4f1('0x28')](_0x1c2b07[_0xc4f1('0x3c')]);if(_0x1c2b07[_0xc4f1('0x3d')]){delete _0x1c2b07[_0xc4f1('0x3d')];}_0x242613[_0xc4f1('0x2c')](_0x4ce539)[_0xc4f1('0x3e')](_0x1c2b07);};}exports[_0xc4f1('0x3f')]=function(_0x270d0f,_0x2f898f){var _0x44b8bc={},_0x3f88ec={},_0xd8e484={'count':0x0,'rows':[]};var _0x48d4df=_[_0xc4f1('0x40')](db['ChatQueue'][_0xc4f1('0x41')],function(_0x49e71a){return{'name':_0x49e71a['fieldName'],'type':_0x49e71a['type'][_0xc4f1('0x42')]};});_0x3f88ec[_0xc4f1('0x43')]=_[_0xc4f1('0x40')](_0x48d4df,_0xc4f1('0x3d'));_0x3f88ec[_0xc4f1('0x44')]=_[_0xc4f1('0x45')](_0x270d0f[_0xc4f1('0x44')]);_0x3f88ec[_0xc4f1('0x46')]=_[_0xc4f1('0x47')](_0x3f88ec[_0xc4f1('0x43')],_0x3f88ec[_0xc4f1('0x44')]);_0x44b8bc[_0xc4f1('0x48')]=_[_0xc4f1('0x47')](_0x3f88ec[_0xc4f1('0x43')],qs[_0xc4f1('0x49')](_0x270d0f[_0xc4f1('0x44')]['fields']));_0x44b8bc[_0xc4f1('0x48')]=_0x44b8bc[_0xc4f1('0x48')]['length']?_0x44b8bc[_0xc4f1('0x48')]:_0x3f88ec[_0xc4f1('0x43')];if(!_0x270d0f[_0xc4f1('0x44')][_0xc4f1('0x4a')](_0xc4f1('0x4b'))){_0x44b8bc[_0xc4f1('0x30')]=qs['limit'](_0x270d0f[_0xc4f1('0x44')][_0xc4f1('0x30')]);_0x44b8bc[_0xc4f1('0x2f')]=qs[_0xc4f1('0x2f')](_0x270d0f[_0xc4f1('0x44')][_0xc4f1('0x2f')]);}_0x44b8bc[_0xc4f1('0x4c')]=qs[_0xc4f1('0x4d')](_0x270d0f[_0xc4f1('0x44')][_0xc4f1('0x4d')]);_0x44b8bc[_0xc4f1('0x4e')]=qs[_0xc4f1('0x46')](_['pick'](_0x270d0f['query'],_0x3f88ec[_0xc4f1('0x46')]),_0x48d4df);if(_0x270d0f['query'][_0xc4f1('0x4f')]){_0x44b8bc[_0xc4f1('0x4e')]=_['merge'](_0x44b8bc[_0xc4f1('0x4e')],{'$or':_[_0xc4f1('0x40')](_0x48d4df,function(_0x416c04){if(_0x416c04['type']!==_0xc4f1('0x50')){var _0x244c6d={};_0x244c6d[_0x416c04[_0xc4f1('0x3d')]]={'$like':'%'+_0x270d0f[_0xc4f1('0x44')]['filter']+'%'};return _0x244c6d;}})});}_0x44b8bc=_[_0xc4f1('0x51')]({},_0x44b8bc,_0x270d0f[_0xc4f1('0x52')]);var _0x3adf51={'where':_0x44b8bc['where']};return db[_0xc4f1('0x53')][_0xc4f1('0x2e')](_0x3adf51)[_0xc4f1('0x22')](function(_0x2b2ec4){_0xd8e484[_0xc4f1('0x2e')]=_0x2b2ec4;if(_0x270d0f[_0xc4f1('0x44')][_0xc4f1('0x54')]){_0x44b8bc['include']=[{'all':!![]}];}return db[_0xc4f1('0x53')][_0xc4f1('0x55')](_0x44b8bc);})[_0xc4f1('0x22')](function(_0x1361bb){_0xd8e484[_0xc4f1('0x56')]=_0x1361bb;return _0xd8e484;})[_0xc4f1('0x22')](respondWithFilteredResult(_0x2f898f,_0x44b8bc))['catch'](handleError(_0x2f898f,null));};exports['show']=function(_0xcd33d,_0x2ef941){var _0x3a2154={'raw':!![],'where':{'id':_0xcd33d['params']['id']}},_0x54aa1b={};_0x54aa1b[_0xc4f1('0x43')]=_[_0xc4f1('0x45')](db[_0xc4f1('0x53')][_0xc4f1('0x41')]);_0x54aa1b[_0xc4f1('0x44')]=_[_0xc4f1('0x45')](_0xcd33d[_0xc4f1('0x44')]);_0x54aa1b['filters']=_['intersection'](_0x54aa1b[_0xc4f1('0x43')],_0x54aa1b[_0xc4f1('0x44')]);_0x3a2154[_0xc4f1('0x48')]=_['intersection'](_0x54aa1b['model'],qs[_0xc4f1('0x49')](_0xcd33d['query'][_0xc4f1('0x49')]));_0x3a2154[_0xc4f1('0x48')]=_0x3a2154['attributes'][_0xc4f1('0x57')]?_0x3a2154[_0xc4f1('0x48')]:_0x54aa1b[_0xc4f1('0x43')];if(_0xcd33d[_0xc4f1('0x44')]['includeAll']){_0x3a2154[_0xc4f1('0x58')]=[{'all':!![]}];}_0x3a2154=_['merge']({},_0x3a2154,_0xcd33d[_0xc4f1('0x52')]);return db[_0xc4f1('0x53')]['find'](_0x3a2154)[_0xc4f1('0x22')](handleEntityNotFound(_0x2ef941,null))[_0xc4f1('0x22')](respondWithResult(_0x2ef941,null))[_0xc4f1('0x2a')](handleError(_0x2ef941,null));};exports[_0xc4f1('0x59')]=function(_0x4f6dc4,_0x5398ff){return db['ChatQueue'][_0xc4f1('0x59')](_0x4f6dc4[_0xc4f1('0x5a')],{})['then'](function(_0x204e42){var _0x492b80=_0x4f6dc4[_0xc4f1('0x5b')][_0xc4f1('0x38')]({'plain':!![]});if(!_0x492b80)throw new Error(_0xc4f1('0x5c'));if(_0x492b80['role']===_0xc4f1('0x5b')){var _0x11d004=_0x204e42['get']({'plain':!![]});var _0x26de7c=_0xc4f1('0x39');return db[_0xc4f1('0x5d')][_0xc4f1('0x5e')]({'where':{'name':_0x26de7c,'userProfileId':_0x492b80['userProfileId']},'raw':!![]})['then'](function(_0x263e45){if(_0x263e45&&_0x263e45['autoAssociation']===0x0){return db[_0xc4f1('0x3a')][_0xc4f1('0x59')]({'name':_0x11d004['name'],'resourceId':_0x11d004['id'],'type':_0x263e45[_0xc4f1('0x3d')],'sectionId':_0x263e45['id']},{})[_0xc4f1('0x22')](function(){return _0x204e42;});}else{return _0x204e42;}})[_0xc4f1('0x2a')](function(_0x422b36){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x422b36);throw _0x422b36;});}return _0x204e42;})[_0xc4f1('0x22')](respondWithResult(_0x5398ff,0xc9))['catch'](handleError(_0x5398ff,null));};exports['update']=function(_0x3c4286,_0x43916b){if(_0x3c4286[_0xc4f1('0x5a')]['id']){delete _0x3c4286['body']['id'];}return db['ChatQueue'][_0xc4f1('0x5e')]({'where':{'id':_0x3c4286[_0xc4f1('0x5f')]['id']}})['then'](handleEntityNotFound(_0x43916b,null))[_0xc4f1('0x22')](saveUpdates(_0x3c4286[_0xc4f1('0x5a')],null))['then'](respondWithResult(_0x43916b,null))['catch'](handleError(_0x43916b,null));};exports[_0xc4f1('0x37')]=function(_0x248a69,_0x330828){return db[_0xc4f1('0x53')][_0xc4f1('0x5e')]({'where':{'id':_0x248a69[_0xc4f1('0x5f')]['id']}})[_0xc4f1('0x22')](handleEntityNotFound(_0x330828,null))[_0xc4f1('0x22')](removeEntity(_0x330828,null))[_0xc4f1('0x2a')](handleError(_0x330828,null));};exports[_0xc4f1('0x60')]=function(_0x52cc07,_0x39e0a8){return db[_0xc4f1('0x53')]['describe']()['then'](respondWithResult(_0x39e0a8,null))[_0xc4f1('0x2a')](handleError(_0x39e0a8,null));};exports[_0xc4f1('0x61')]=function(_0x5596d3,_0x1f5255,_0x1a58a6){var _0x2ebdfe={'raw':!![],'where':{}},_0x545ef0={},_0x2f39f4;return db['ChatQueue'][_0xc4f1('0x62')]({'where':{'id':_0x5596d3[_0xc4f1('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1f5255,null))[_0xc4f1('0x22')](function(_0x25dce9){if(_0x25dce9){_0x2f39f4=_0x25dce9[_0xc4f1('0x38')]({'plain':!![]});_0x545ef0['model']=_['keys'](db[_0xc4f1('0x63')][_0xc4f1('0x41')]);_0x545ef0[_0xc4f1('0x44')]=_[_0xc4f1('0x45')](_0x5596d3[_0xc4f1('0x44')]);_0x545ef0['filters']=_[_0xc4f1('0x47')](_0x545ef0[_0xc4f1('0x43')],_0x545ef0[_0xc4f1('0x44')]);_0x2ebdfe['attributes']=_[_0xc4f1('0x47')](_0x545ef0[_0xc4f1('0x43')],qs['fields'](_0x5596d3[_0xc4f1('0x44')]['fields']));_0x2ebdfe['attributes']=_0x2ebdfe[_0xc4f1('0x48')][_0xc4f1('0x57')]?_0x2ebdfe['attributes']:_0x545ef0[_0xc4f1('0x43')];if(!_0x5596d3[_0xc4f1('0x44')][_0xc4f1('0x4a')](_0xc4f1('0x4b'))){_0x2ebdfe[_0xc4f1('0x30')]=qs['limit'](_0x5596d3[_0xc4f1('0x44')][_0xc4f1('0x30')]);_0x2ebdfe[_0xc4f1('0x2f')]=qs[_0xc4f1('0x2f')](_0x5596d3[_0xc4f1('0x44')][_0xc4f1('0x2f')]);}_0x2ebdfe[_0xc4f1('0x4c')]=qs[_0xc4f1('0x4d')](_0x5596d3[_0xc4f1('0x44')][_0xc4f1('0x4d')]);_0x2ebdfe['where']=qs[_0xc4f1('0x46')](_['pick'](_0x5596d3[_0xc4f1('0x44')],_0x545ef0[_0xc4f1('0x46')]));_0x2ebdfe[_0xc4f1('0x4e')][_0xc4f1('0x64')]=_0x25dce9['id'];if(_0x5596d3[_0xc4f1('0x44')][_0xc4f1('0x4f')]){_0x2ebdfe['where']=_['merge'](_0x2ebdfe[_0xc4f1('0x4e')],{'$or':_[_0xc4f1('0x40')](_0x2ebdfe[_0xc4f1('0x48')],function(_0x2bb4f8){var _0x999beb={};_0x999beb[_0x2bb4f8]={'$like':'%'+_0x5596d3['query'][_0xc4f1('0x4f')]+'%'};return _0x999beb;})});}_0x2ebdfe=_['merge']({},_0x2ebdfe,_0x5596d3[_0xc4f1('0x52')]);return db[_0xc4f1('0x63')][_0xc4f1('0x55')](_0x2ebdfe);}})[_0xc4f1('0x22')](function(_0x55d750){if(_0x55d750){return db[_0xc4f1('0x65')]['findAndCountAll']({'where':{'id':_[_0xc4f1('0x40')](_0x55d750,'UserId'),'role':'agent'},'attributes':['id',_0xc4f1('0x3d'),_0xc4f1('0x66'),_0xc4f1('0x67'),_0xc4f1('0x68')]});}})[_0xc4f1('0x22')](function(_0x396715){if(_0x396715){return{'count':_0x396715[_0xc4f1('0x2e')],'rows':_[_0xc4f1('0x40')](_0x396715[_0xc4f1('0x56')],function(_0x40b2ce){return{'membername':_0x40b2ce['name'],'UserId':_0x40b2ce['id'],'queue_name':_0x2f39f4[_0xc4f1('0x3d')],'ChatQueueId':_0x2f39f4['id'],'interface':util['format'](_0xc4f1('0x69'),_0xc4f1('0x6a'),_0x40b2ce['name']),'penalty':0x0,'paused':_0x40b2ce['chatPause'],'createdAt':_0x40b2ce[_0xc4f1('0x68')],'updatedAt':_0x40b2ce[_0xc4f1('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x1f5255,_0x2ebdfe))[_0xc4f1('0x2a')](handleError(_0x1f5255,null));};exports[_0xc4f1('0x6b')]=function(_0x4fc132,_0xd5cd05,_0x145c5c){var _0x3e9f12={};var _0x5da3ba={};var _0x4e54d2;var _0x155cb7;return db[_0xc4f1('0x53')]['findOne']({'where':{'id':_0x4fc132['params']['id']}})[_0xc4f1('0x22')](handleEntityNotFound(_0xd5cd05,null))[_0xc4f1('0x22')](function(_0x120dbc){if(_0x120dbc){_0x4e54d2=_0x120dbc;_0x5da3ba[_0xc4f1('0x43')]=_[_0xc4f1('0x45')](db[_0xc4f1('0x6c')][_0xc4f1('0x41')]);_0x5da3ba['query']=_['keys'](_0x4fc132[_0xc4f1('0x44')]);_0x5da3ba['filters']=_[_0xc4f1('0x47')](_0x5da3ba[_0xc4f1('0x43')],_0x5da3ba[_0xc4f1('0x44')]);_0x3e9f12[_0xc4f1('0x48')]=_[_0xc4f1('0x47')](_0x5da3ba[_0xc4f1('0x43')],qs[_0xc4f1('0x49')](_0x4fc132[_0xc4f1('0x44')][_0xc4f1('0x49')]));_0x3e9f12[_0xc4f1('0x48')]=_0x3e9f12[_0xc4f1('0x48')][_0xc4f1('0x57')]?_0x3e9f12['attributes']:_0x5da3ba[_0xc4f1('0x43')];_0x3e9f12['order']=qs[_0xc4f1('0x4d')](_0x4fc132['query'][_0xc4f1('0x4d')]);_0x3e9f12[_0xc4f1('0x4e')]=qs[_0xc4f1('0x46')](_[_0xc4f1('0x6d')](_0x4fc132[_0xc4f1('0x44')],_0x5da3ba[_0xc4f1('0x46')]));if(_0x4fc132[_0xc4f1('0x44')][_0xc4f1('0x4f')]){_0x3e9f12[_0xc4f1('0x4e')]=_[_0xc4f1('0x51')](_0x3e9f12[_0xc4f1('0x4e')],{'$or':_['map'](_0x3e9f12[_0xc4f1('0x48')],function(_0x45be22){var _0x3321c8={};_0x3321c8[_0x45be22]={'$like':'%'+_0x4fc132[_0xc4f1('0x44')][_0xc4f1('0x4f')]+'%'};return _0x3321c8;})});}_0x3e9f12=_[_0xc4f1('0x51')]({},_0x3e9f12,_0x4fc132[_0xc4f1('0x52')]);return _0x4e54d2['getTeams'](_0x3e9f12);}})['then'](function(_0x22d731){if(_0x22d731){_0x155cb7=_0x22d731['length'];if(!_0x4fc132[_0xc4f1('0x44')][_0xc4f1('0x4a')](_0xc4f1('0x4b'))){_0x3e9f12['limit']=qs[_0xc4f1('0x30')](_0x4fc132[_0xc4f1('0x44')][_0xc4f1('0x30')]);_0x3e9f12[_0xc4f1('0x2f')]=qs[_0xc4f1('0x2f')](_0x4fc132[_0xc4f1('0x44')][_0xc4f1('0x2f')]);}return _0x4e54d2[_0xc4f1('0x6b')](_0x3e9f12);}})[_0xc4f1('0x22')](function(_0xcd9048){if(_0xcd9048){return _0xcd9048?{'count':_0x155cb7,'rows':_0xcd9048}:null;}})[_0xc4f1('0x22')](respondWithResult(_0xd5cd05,null))[_0xc4f1('0x2a')](handleError(_0xd5cd05,null));};exports['addTeams']=function(_0x6f1951,_0x57609b,_0x5cfd71){var _0x453f3d=_0x6f1951[_0xc4f1('0x5a')][_0xc4f1('0x6e')];return db[_0xc4f1('0x6c')]['findAll']({'where':{'id':_0x453f3d},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc4f1('0x6f'),'attributes':['id','name','online',_0xc4f1('0x70'),_0xc4f1('0x71')],'raw':!![]}]})[_0xc4f1('0x22')](function(_0x36c979){if(_0x36c979){var _0x421f4a=_['flatMap'](_0x36c979,function(_0x21e2d3){var _0x2a7767=_0x21e2d3['get']({'plain':!![]});return _0x2a7767[_0xc4f1('0x6f')];});return db[_0xc4f1('0x53')][_0xc4f1('0x5e')]({'where':{'id':_0x6f1951[_0xc4f1('0x5f')]['id']}})[_0xc4f1('0x22')](function(_0x369ab8){return db[_0xc4f1('0x72')]['transaction'](function(_0x136863){return _0x369ab8[_0xc4f1('0x73')](_0x453f3d,{'transaction':_0x136863})[_0xc4f1('0x22')](function(){return BPromise['each'](_0x421f4a,function(_0x3fcc5f){return db['UserChatQueue'][_0xc4f1('0x74')]({'where':{'UserId':_0x3fcc5f['id'],'ChatQueueId':_0x6f1951[_0xc4f1('0x5f')]['id']},'transaction':_0x136863});});})[_0xc4f1('0x22')](function(){_0x421f4a[_0xc4f1('0x75')](function(_0x593a7d){socket[_0xc4f1('0x76')]('userChatQueue:save',{'UserId':_0x593a7d['id'],'ChatQueueId':_0x369ab8['id']});});});});});}})[_0xc4f1('0x22')](respondWithStatusCode(_0x57609b,null))[_0xc4f1('0x2a')](handleError(_0x57609b,null));};exports[_0xc4f1('0x77')]=function(_0x29e617,_0x546fa5,_0x416599){return db['Team'][_0xc4f1('0x55')]({'where':{'id':_0x29e617[_0xc4f1('0x44')][_0xc4f1('0x6e')]},'attributes':['id'],'include':[{'model':db[_0xc4f1('0x65')],'as':_0xc4f1('0x6f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x546fa5,null))[_0xc4f1('0x22')](function(_0x26d0c2){var _0x1dda73=_['map'](_0x26d0c2,'id');var _0xb1bf8e=[];var _0x271f4a=[];var _0x77ecc9=squel[_0xc4f1('0x78')]();_0x77ecc9['field'](_0xc4f1('0x79'))[_0xc4f1('0x7a')](_0xc4f1('0x7b'),'tq')[_0xc4f1('0x7c')](_0xc4f1('0x7d'),'ut',_0xc4f1('0x7e'))[_0xc4f1('0x4e')](_0xc4f1('0x7f'),_0x29e617['params']['id']);for(var _0x28dfdb=0x0;_0x28dfdb<_0x26d0c2[_0xc4f1('0x57')];_0x28dfdb+=0x1){let _0x2c6f25=_0x26d0c2[_0x28dfdb];for(var _0x74cea6=0x0;_0x74cea6<_0x2c6f25[_0xc4f1('0x6f')][_0xc4f1('0x57')];_0x74cea6+=0x1){let _0x4f16bb=_0x2c6f25[_0xc4f1('0x6f')][_0x74cea6];var _0x41c161=_0x77ecc9['clone']();_0x41c161['where'](_0xc4f1('0x80'),_0x4f16bb['id']);_0x271f4a[_0xc4f1('0x81')](db['sequelize'][_0xc4f1('0x44')](_0x41c161[_0xc4f1('0x82')](),{'type':db[_0xc4f1('0x72')][_0xc4f1('0x83')]['SELECT']})[_0xc4f1('0x22')](function(_0x727350){if(_0x727350['length']===0x1){return _0x4f16bb['id'];}else{var _0x25915c=_[_0xc4f1('0x84')](_[_0xc4f1('0x40')](_0x727350,'TeamId'),function(_0xbb0b84){return _[_0xc4f1('0x85')](_0x1dda73,_0xbb0b84);});if(_0x25915c){return _0x4f16bb['id'];}}}));}}return BPromise[_0xc4f1('0x86')](_0x271f4a)[_0xc4f1('0x22')](function(_0x37bb0e){_0xb1bf8e=_(_0xb1bf8e)[_0xc4f1('0x87')](_0x37bb0e)[_0xc4f1('0x88')]()['value']();return db[_0xc4f1('0x53')]['find']({'where':{'id':_0x29e617['params']['id']}})[_0xc4f1('0x22')](function(_0x1cda6e){return db[_0xc4f1('0x72')][_0xc4f1('0x89')](function(_0x2dcf09){return _0x1cda6e[_0xc4f1('0x77')](_0x29e617[_0xc4f1('0x44')]['ids'],{'transaction':_0x2dcf09})[_0xc4f1('0x22')](function(){if(!_[_0xc4f1('0x8a')](_0xb1bf8e)){return _0x1cda6e[_0xc4f1('0x8b')](_0xb1bf8e,{'transaction':_0x2dcf09});}})[_0xc4f1('0x22')](function(){_0xb1bf8e[_0xc4f1('0x75')](function(_0x2e710f){socket['emit'](_0xc4f1('0x8c'),{'UserId':_0x2e710f,'ChatQueueId':_0x1cda6e['id']});});});});});});})['then'](respondWithStatusCode(_0x546fa5,null))[_0xc4f1('0x2a')](handleError(_0x546fa5,null));};exports[_0xc4f1('0x8d')]=function(_0x29c6cf,_0x26d379,_0x2c5cd6){return db[_0xc4f1('0x53')][_0xc4f1('0x5e')]({'where':{'id':_0x29c6cf[_0xc4f1('0x5f')]['id']}})[_0xc4f1('0x22')](handleEntityNotFound(_0x26d379,null))[_0xc4f1('0x22')](function(_0x546d18){if(_0x546d18){return _0x546d18[_0xc4f1('0x8d')](_0x29c6cf[_0xc4f1('0x5a')]['ids'],_[_0xc4f1('0x8e')](_0x29c6cf[_0xc4f1('0x5a')],['ids','id'])||{})[_0xc4f1('0x8f')](function(_0x590da0){for(var _0xc44005=0x0;_0xc44005<_0x29c6cf[_0xc4f1('0x5a')][_0xc4f1('0x6e')][_0xc4f1('0x57')];_0xc44005+=0x1){socket[_0xc4f1('0x76')]('userChatQueue:save',{'UserId':_0x29c6cf[_0xc4f1('0x5a')][_0xc4f1('0x6e')][_0xc44005],'ChatQueueId':_0x29c6cf[_0xc4f1('0x5f')]['id']});}return _0x590da0;});}})[_0xc4f1('0x22')](respondWithResult(_0x26d379,null))[_0xc4f1('0x2a')](handleError(_0x26d379,null));};exports['removeAgents']=function(_0x4767a5,_0x59b04b,_0x160575){return db[_0xc4f1('0x53')][_0xc4f1('0x5e')]({'where':{'id':_0x4767a5['params']['id']}})[_0xc4f1('0x22')](handleEntityNotFound(_0x59b04b,null))[_0xc4f1('0x22')](function(_0x5a1c03){if(_0x5a1c03){return _0x5a1c03['removeAgents'](_0x4767a5[_0xc4f1('0x44')]['ids'])['then'](function(){if(_['isArray'](_0x4767a5[_0xc4f1('0x44')][_0xc4f1('0x6e')])){for(var _0xde668f=0x0;_0xde668f<_0x4767a5['query'][_0xc4f1('0x6e')][_0xc4f1('0x57')];_0xde668f+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x4767a5[_0xc4f1('0x44')][_0xc4f1('0x6e')][_0xde668f]),'ChatQueueId':Number(_0x4767a5[_0xc4f1('0x5f')]['id'])});}}else{socket['emit'](_0xc4f1('0x8c'),{'UserId':Number(_0x4767a5['query'][_0xc4f1('0x6e')]),'ChatQueueId':Number(_0x4767a5[_0xc4f1('0x5f')]['id'])});}});}})[_0xc4f1('0x22')](respondWithStatusCode(_0x59b04b,null))[_0xc4f1('0x2a')](handleError(_0x59b04b,null));};exports[_0xc4f1('0x90')]=function(_0x29dbf4,_0x225d5b,_0x411cf6){var _0x58ed67={};var _0x56b61e={};var _0x3299dc;var _0x3f6d8b;return db[_0xc4f1('0x53')][_0xc4f1('0x62')]({'where':{'id':_0x29dbf4['params']['id']}})['then'](handleEntityNotFound(_0x225d5b,null))[_0xc4f1('0x22')](function(_0x1d23cd){if(_0x1d23cd){_0x3299dc=_0x1d23cd;_0x56b61e[_0xc4f1('0x43')]=_['keys'](db[_0xc4f1('0x65')][_0xc4f1('0x41')]);_0x56b61e[_0xc4f1('0x44')]=_['keys'](_0x29dbf4['query']);_0x56b61e[_0xc4f1('0x46')]=_[_0xc4f1('0x47')](_0x56b61e[_0xc4f1('0x43')],_0x56b61e[_0xc4f1('0x44')]);_0x58ed67[_0xc4f1('0x48')]=_[_0xc4f1('0x47')](_0x56b61e[_0xc4f1('0x43')],qs['fields'](_0x29dbf4['query']['fields']));_0x58ed67[_0xc4f1('0x48')]=_0x58ed67[_0xc4f1('0x48')][_0xc4f1('0x57')]?_0x58ed67[_0xc4f1('0x48')]:_0x56b61e['model'];_0x58ed67[_0xc4f1('0x4c')]=qs[_0xc4f1('0x4d')](_0x29dbf4['query'][_0xc4f1('0x4d')]);_0x58ed67[_0xc4f1('0x4e')]=qs[_0xc4f1('0x46')](_[_0xc4f1('0x6d')](_0x29dbf4['query'],_0x56b61e[_0xc4f1('0x46')]));if(_0x29dbf4['query']['filter']){_0x58ed67['where']=_[_0xc4f1('0x51')](_0x58ed67[_0xc4f1('0x4e')],{'$or':_[_0xc4f1('0x40')](_0x58ed67[_0xc4f1('0x48')],function(_0x14d040){var _0x10db1e={};_0x10db1e[_0x14d040]={'$like':'%'+_0x29dbf4[_0xc4f1('0x44')][_0xc4f1('0x4f')]+'%'};return _0x10db1e;})});}_0x58ed67=_['merge']({},_0x58ed67,_0x29dbf4['options']);return _0x3299dc['getAgents'](_0x58ed67);}})[_0xc4f1('0x22')](function(_0x2605d6){if(_0x2605d6){_0x3f6d8b=_0x2605d6['length'];if(!_0x29dbf4[_0xc4f1('0x44')][_0xc4f1('0x4a')](_0xc4f1('0x4b'))){_0x58ed67[_0xc4f1('0x30')]=qs['limit'](_0x29dbf4[_0xc4f1('0x44')]['limit']);_0x58ed67[_0xc4f1('0x2f')]=qs[_0xc4f1('0x2f')](_0x29dbf4[_0xc4f1('0x44')]['offset']);}return _0x3299dc[_0xc4f1('0x90')](_0x58ed67);}})[_0xc4f1('0x22')](function(_0x396f30){if(_0x396f30){return _0x396f30?{'count':_0x3f6d8b,'rows':_0x396f30}:null;}})[_0xc4f1('0x22')](respondWithResult(_0x225d5b,null))[_0xc4f1('0x2a')](handleError(_0x225d5b,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index c35f1be..9c42e80 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x54df02,_0x445545){var _0x433d63=function(_0x20f5e3){while(--_0x20f5e3){_0x54df02['push'](_0x54df02['shift']());}};_0x433d63(++_0x445545);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5c5a8b,_0x498279){_0x5c5a8b=_0x5c5a8b-0x0;var _0x41ea35=_0x5f2f[_0x5c5a8b];return _0x41ea35;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x12aaee,_0x5bf50c){var _0x37c350=function(_0x182775){while(--_0x182775){_0x12aaee['push'](_0x12aaee['shift']());}};_0x37c350(++_0x5bf50c);}(_0xadb5,0xad));var _0x5adb=function(_0x49ad0d,_0x9286ba){_0x49ad0d=_0x49ad0d-0x0;var _0x2677b6=_0xadb5[_0x49ad0d];return _0x2677b6;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x5adb('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatQueueEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatQueueEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatQueue[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 95deedc..1b76c0f 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 _0xb7f0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','api'];(function(_0x1eebbb,_0xfa953f){var _0x20be0a=function(_0x3e38a2){while(--_0x3e38a2){_0x1eebbb['push'](_0x1eebbb['shift']());}};_0x20be0a(++_0xfa953f);}(_0xb7f0,0xfb));var _0x0b7f=function(_0x2bfa88,_0xc64230){_0x2bfa88=_0x2bfa88-0x0;var _0x2e7039=_0xb7f0[_0x2bfa88];return _0x2e7039;};'use strict';var _=require(_0x0b7f('0x0'));var util=require(_0x0b7f('0x1'));var logger=require(_0x0b7f('0x2'))(_0x0b7f('0x3'));var moment=require(_0x0b7f('0x4'));var BPromise=require(_0x0b7f('0x5'));var rp=require(_0x0b7f('0x6'));var fs=require('fs');var path=require(_0x0b7f('0x7'));var rimraf=require(_0x0b7f('0x8'));var config=require(_0x0b7f('0x9'));var attributes=require(_0x0b7f('0xa'));module[_0x0b7f('0xb')]=function(_0x2cb95c,_0x283cc9){return _0x2cb95c[_0x0b7f('0xc')](_0x0b7f('0xd'),attributes,{'tableName':_0x0b7f('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf820=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatQueue.attributes','ChatQueue','chat_queues'];(function(_0x30faee,_0x1c3794){var _0x3a90ab=function(_0x11129b){while(--_0x11129b){_0x30faee['push'](_0x30faee['shift']());}};_0x3a90ab(++_0x1c3794);}(_0xf820,0x1d6));var _0x0f82=function(_0x1c9085,_0x8956c){_0x1c9085=_0x1c9085-0x0;var _0x2c4e8e=_0xf820[_0x1c9085];return _0x2c4e8e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0f82('0x0'))(_0x0f82('0x1'));var moment=require(_0x0f82('0x2'));var BPromise=require(_0x0f82('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f82('0x4'));var rimraf=require(_0x0f82('0x5'));var config=require(_0x0f82('0x6'));var attributes=require(_0x0f82('0x7'));module['exports']=function(_0x421fd8,_0xb84a96){return _0x421fd8['define'](_0x0f82('0x8'),attributes,{'tableName':_0x0f82('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 a1343e6..04c8ca7 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 _0x11e3=['localhost','socket.io-emitter','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','catch','find','ShowChatQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults'];(function(_0x3bb4cb,_0x4c13da){var _0x6f328=function(_0x14182a){while(--_0x14182a){_0x3bb4cb['push'](_0x3bb4cb['shift']());}};_0x6f328(++_0x4c13da);}(_0x11e3,0x6f));var _0x311e=function(_0x39bdad,_0x59f337){_0x39bdad=_0x39bdad-0x0;var _0x1a1d9e=_0x11e3[_0x39bdad];return _0x1a1d9e;};'use strict';var _=require(_0x311e('0x0'));var util=require(_0x311e('0x1'));var moment=require(_0x311e('0x2'));var BPromise=require(_0x311e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x311e('0x4'));var db=require(_0x311e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x311e('0x6'))(_0x311e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x311e('0x8')][_0x311e('0x9')]({'port':0x232a});config[_0x311e('0xa')]=_[_0x311e('0xb')](config[_0x311e('0xa')],{'host':_0x311e('0xc'),'port':0x18eb});var socket=require(_0x311e('0xd'))(new Redis(config[_0x311e('0xa')]));require(_0x311e('0xe'))[_0x311e('0xf')](socket);function respondWithRpcPromise(_0x36b445,_0x2bde9f,_0x107912){return new BPromise(function(_0x5efdec,_0x3bab9b){return client['request'](_0x36b445,_0x107912)[_0x311e('0x10')](function(_0x33c300){logger[_0x311e('0x11')](_0x311e('0x12'),_0x2bde9f,'request\x20sent');logger['debug'](_0x311e('0x13'),_0x2bde9f,'request\x20sent',JSON['stringify'](_0x33c300));if(_0x33c300[_0x311e('0x14')]){if(_0x33c300[_0x311e('0x14')][_0x311e('0x15')]===0x1f4){logger[_0x311e('0x14')](_0x311e('0x12'),_0x2bde9f,_0x33c300[_0x311e('0x14')]['message']);return _0x3bab9b(_0x33c300[_0x311e('0x14')]['message']);}logger['error'](_0x311e('0x12'),_0x2bde9f,_0x33c300['error'][_0x311e('0x16')]);return _0x5efdec(_0x33c300['error'][_0x311e('0x16')]);}else{logger[_0x311e('0x11')]('ChatQueue,\x20%s,\x20%s',_0x2bde9f,_0x311e('0x17'));_0x5efdec(_0x33c300[_0x311e('0x18')][_0x311e('0x16')]);}})['catch'](function(_0x30b7b4){logger[_0x311e('0x14')](_0x311e('0x12'),_0x2bde9f,_0x30b7b4);_0x3bab9b(_0x30b7b4);});});}exports[_0x311e('0x19')]=function(_0x399fc2){var _0x47f42f=this;return new Promise(function(_0x3a6ccd,_0x5c0a69){return db[_0x311e('0x1a')][_0x311e('0x1b')]({'raw':_0x399fc2[_0x311e('0x1c')]?_0x399fc2['options'][_0x311e('0x1d')]===undefined?!![]:![]:!![],'where':_0x399fc2['options']?_0x399fc2[_0x311e('0x1c')][_0x311e('0x1e')]||null:null,'attributes':_0x399fc2[_0x311e('0x1c')]?_0x399fc2[_0x311e('0x1c')][_0x311e('0x1f')]||null:null,'limit':_0x399fc2[_0x311e('0x1c')]?_0x399fc2['options'][_0x311e('0x20')]||null:null,'include':_0x399fc2['options']?_0x399fc2[_0x311e('0x1c')][_0x311e('0x21')]?_[_0x311e('0x22')](_0x399fc2[_0x311e('0x1c')]['include'],function(_0x45c3b6){return{'model':db[_0x45c3b6['model']],'as':_0x45c3b6['as'],'attributes':_0x45c3b6[_0x311e('0x1f')],'include':_0x45c3b6['include']?_[_0x311e('0x22')](_0x45c3b6[_0x311e('0x21')],function(_0x5e9fe2){return{'model':db[_0x5e9fe2[_0x311e('0x23')]],'as':_0x5e9fe2['as'],'attributes':_0x5e9fe2[_0x311e('0x1f')],'include':_0x5e9fe2[_0x311e('0x21')]?_[_0x311e('0x22')](_0x5e9fe2[_0x311e('0x21')],function(_0xb03d19){return{'model':db[_0xb03d19[_0x311e('0x23')]],'as':_0xb03d19['as'],'attributes':_0xb03d19[_0x311e('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ae602){logger[_0x311e('0x11')](_0x311e('0x19'),_0x399fc2);logger[_0x311e('0x24')](_0x311e('0x19'),_0x399fc2,JSON[_0x311e('0x25')](_0x3ae602));_0x3a6ccd(_0x3ae602);})[_0x311e('0x26')](function(_0x2af62a){logger[_0x311e('0x14')](_0x311e('0x19'),_0x2af62a[_0x311e('0x16')],_0x399fc2);_0x5c0a69(_0x47f42f[_0x311e('0x14')](0x1f4,_0x2af62a[_0x311e('0x16')]));});});};exports['ShowChatQueue']=function(_0xa3139f){var _0x31ce52=this;return new Promise(function(_0x3cd5da,_0x272684){return db[_0x311e('0x1a')][_0x311e('0x27')]({'raw':_0xa3139f[_0x311e('0x1c')]?_0xa3139f['options']['raw']===undefined?!![]:![]:!![],'where':_0xa3139f[_0x311e('0x1c')]?_0xa3139f['options'][_0x311e('0x1e')]||null:null,'attributes':_0xa3139f[_0x311e('0x1c')]?_0xa3139f[_0x311e('0x1c')][_0x311e('0x1f')]||null:null,'include':_0xa3139f['options']?_0xa3139f[_0x311e('0x1c')][_0x311e('0x21')]?_[_0x311e('0x22')](_0xa3139f[_0x311e('0x1c')]['include'],function(_0x2bd663){return{'model':db[_0x2bd663[_0x311e('0x23')]],'as':_0x2bd663['as'],'attributes':_0x2bd663[_0x311e('0x1f')],'include':_0x2bd663[_0x311e('0x21')]?_[_0x311e('0x22')](_0x2bd663[_0x311e('0x21')],function(_0xd6fafe){return{'model':db[_0xd6fafe['model']],'as':_0xd6fafe['as'],'attributes':_0xd6fafe[_0x311e('0x1f')],'include':_0xd6fafe[_0x311e('0x21')]?_[_0x311e('0x22')](_0xd6fafe['include'],function(_0x251b6f){return{'model':db[_0x251b6f[_0x311e('0x23')]],'as':_0x251b6f['as'],'attributes':_0x251b6f[_0x311e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x311e('0x10')](function(_0xb12896){logger[_0x311e('0x11')](_0x311e('0x28'),_0xa3139f);logger[_0x311e('0x24')](_0x311e('0x28'),_0xa3139f,JSON['stringify'](_0xb12896));_0x3cd5da(_0xb12896);})[_0x311e('0x26')](function(_0x20149f){logger[_0x311e('0x14')](_0x311e('0x28'),_0x20149f['message'],_0xa3139f);_0x272684(_0x31ce52['error'](0x1f4,_0x20149f[_0x311e('0x16')]));});});}; \ No newline at end of file +var _0xa7fa=['code','message','info','ChatQueue,\x20%s,\x20%s','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetChatQueue','ShowChatQueue','ChatQueue','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./chatQueue.socket','register','request','then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x423e73,_0x499c66){var _0x5bed62=function(_0x5c43b0){while(--_0x5c43b0){_0x423e73['push'](_0x423e73['shift']());}};_0x5bed62(++_0x499c66);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaa7f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaa7f('0x1'));var rs=require(_0xaa7f('0x2'));var fs=require('fs');var Redis=require(_0xaa7f('0x3'));var db=require(_0xaa7f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa7f('0x5'))(_0xaa7f('0x6'));var config=require(_0xaa7f('0x7'));var jayson=require(_0xaa7f('0x8'));var client=jayson['client'][_0xaa7f('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xaa7f('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa7f('0xb'))(new Redis(config[_0xaa7f('0xa')]));require(_0xaa7f('0xc'))[_0xaa7f('0xd')](socket);function respondWithRpcPromise(_0x5de597,_0x38c907,_0x3e7148){return new BPromise(function(_0x5692a7,_0x471fdc){return client[_0xaa7f('0xe')](_0x5de597,_0x3e7148)[_0xaa7f('0xf')](function(_0x17cd90){logger['info']('ChatQueue,\x20%s,\x20%s',_0x38c907,_0xaa7f('0x10'));logger[_0xaa7f('0x11')](_0xaa7f('0x12'),_0x38c907,_0xaa7f('0x10'),JSON[_0xaa7f('0x13')](_0x17cd90));if(_0x17cd90[_0xaa7f('0x14')]){if(_0x17cd90[_0xaa7f('0x14')][_0xaa7f('0x15')]===0x1f4){logger[_0xaa7f('0x14')]('ChatQueue,\x20%s,\x20%s',_0x38c907,_0x17cd90[_0xaa7f('0x14')]['message']);return _0x471fdc(_0x17cd90[_0xaa7f('0x14')][_0xaa7f('0x16')]);}logger[_0xaa7f('0x14')]('ChatQueue,\x20%s,\x20%s',_0x38c907,_0x17cd90[_0xaa7f('0x14')][_0xaa7f('0x16')]);return _0x5692a7(_0x17cd90[_0xaa7f('0x14')][_0xaa7f('0x16')]);}else{logger[_0xaa7f('0x17')](_0xaa7f('0x18'),_0x38c907,_0xaa7f('0x10'));_0x5692a7(_0x17cd90['result'][_0xaa7f('0x16')]);}})[_0xaa7f('0x19')](function(_0x132382){logger[_0xaa7f('0x14')]('ChatQueue,\x20%s,\x20%s',_0x38c907,_0x132382);_0x471fdc(_0x132382);});});}exports['GetChatQueue']=function(_0x182476){var _0x4cded6=this;return new Promise(function(_0x2a0980,_0x21e870){return db['ChatQueue'][_0xaa7f('0x1a')]({'raw':_0x182476['options']?_0x182476[_0xaa7f('0x1b')][_0xaa7f('0x1c')]===undefined?!![]:![]:!![],'where':_0x182476[_0xaa7f('0x1b')]?_0x182476['options'][_0xaa7f('0x1d')]||null:null,'attributes':_0x182476[_0xaa7f('0x1b')]?_0x182476[_0xaa7f('0x1b')][_0xaa7f('0x1e')]||null:null,'limit':_0x182476['options']?_0x182476['options'][_0xaa7f('0x1f')]||null:null,'include':_0x182476[_0xaa7f('0x1b')]?_0x182476[_0xaa7f('0x1b')][_0xaa7f('0x20')]?_[_0xaa7f('0x21')](_0x182476[_0xaa7f('0x1b')]['include'],function(_0x5442e2){return{'model':db[_0x5442e2['model']],'as':_0x5442e2['as'],'attributes':_0x5442e2[_0xaa7f('0x1e')],'include':_0x5442e2['include']?_[_0xaa7f('0x21')](_0x5442e2[_0xaa7f('0x20')],function(_0x4c79fa){return{'model':db[_0x4c79fa[_0xaa7f('0x22')]],'as':_0x4c79fa['as'],'attributes':_0x4c79fa['attributes'],'include':_0x4c79fa[_0xaa7f('0x20')]?_[_0xaa7f('0x21')](_0x4c79fa[_0xaa7f('0x20')],function(_0xfcf172){return{'model':db[_0xfcf172[_0xaa7f('0x22')]],'as':_0xfcf172['as'],'attributes':_0xfcf172['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa7f('0xf')](function(_0x3e0223){logger[_0xaa7f('0x17')]('GetChatQueue',_0x182476);logger[_0xaa7f('0x11')](_0xaa7f('0x23'),_0x182476,JSON[_0xaa7f('0x13')](_0x3e0223));_0x2a0980(_0x3e0223);})[_0xaa7f('0x19')](function(_0x3ba5e5){logger[_0xaa7f('0x14')]('GetChatQueue',_0x3ba5e5[_0xaa7f('0x16')],_0x182476);_0x21e870(_0x4cded6[_0xaa7f('0x14')](0x1f4,_0x3ba5e5['message']));});});};exports[_0xaa7f('0x24')]=function(_0x1593cb){var _0x403ead=this;return new Promise(function(_0xcf8a2b,_0x182770){return db[_0xaa7f('0x25')][_0xaa7f('0x26')]({'raw':_0x1593cb[_0xaa7f('0x1b')]?_0x1593cb[_0xaa7f('0x1b')][_0xaa7f('0x1c')]===undefined?!![]:![]:!![],'where':_0x1593cb[_0xaa7f('0x1b')]?_0x1593cb[_0xaa7f('0x1b')][_0xaa7f('0x1d')]||null:null,'attributes':_0x1593cb[_0xaa7f('0x1b')]?_0x1593cb[_0xaa7f('0x1b')]['attributes']||null:null,'include':_0x1593cb[_0xaa7f('0x1b')]?_0x1593cb['options'][_0xaa7f('0x20')]?_[_0xaa7f('0x21')](_0x1593cb['options'][_0xaa7f('0x20')],function(_0x293407){return{'model':db[_0x293407['model']],'as':_0x293407['as'],'attributes':_0x293407[_0xaa7f('0x1e')],'include':_0x293407[_0xaa7f('0x20')]?_['map'](_0x293407['include'],function(_0x5ca758){return{'model':db[_0x5ca758[_0xaa7f('0x22')]],'as':_0x5ca758['as'],'attributes':_0x5ca758[_0xaa7f('0x1e')],'include':_0x5ca758[_0xaa7f('0x20')]?_[_0xaa7f('0x21')](_0x5ca758['include'],function(_0x56eab0){return{'model':db[_0x56eab0[_0xaa7f('0x22')]],'as':_0x56eab0['as'],'attributes':_0x56eab0[_0xaa7f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xaa7f('0xf')](function(_0x1fb281){logger[_0xaa7f('0x17')](_0xaa7f('0x24'),_0x1593cb);logger[_0xaa7f('0x11')]('ShowChatQueue',_0x1593cb,JSON[_0xaa7f('0x13')](_0x1fb281));_0xcf8a2b(_0x1fb281);})[_0xaa7f('0x19')](function(_0x349e02){logger[_0xaa7f('0x14')](_0xaa7f('0x24'),_0x349e02[_0xaa7f('0x16')],_0x1593cb);_0x182770(_0x403ead[_0xaa7f('0x14')](0x1f4,_0x349e02[_0xaa7f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index becdeec..a378b6c 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 _0xb10b=['emit','removeListener','register','chatQueue:','./chatQueue.events','remove','update'];(function(_0x435044,_0x36ab8e){var _0x33d4c6=function(_0x15efa0){while(--_0x15efa0){_0x435044['push'](_0x435044['shift']());}};_0x33d4c6(++_0x36ab8e);}(_0xb10b,0x12a));var _0xbb10=function(_0x308a1d,_0x3d379d){_0x308a1d=_0x308a1d-0x0;var _0x5eb875=_0xb10b[_0x308a1d];return _0x5eb875;};'use strict';var ChatQueueEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatQueueEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatQueueEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x3d89ce,_0x5d5e4b){var _0x494a2e=function(_0x1222b8){while(--_0x1222b8){_0x3d89ce['push'](_0x3d89ce['shift']());}};_0x494a2e(++_0x5d5e4b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x372b53,_0x376a30){_0x372b53=_0x372b53-0x0;var _0x10b540=_0x5f2f[_0x372b53];return _0x10b540;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index fa8baf9..b81a1fc 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 _0xf918=['getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','/:id','destroy','removeAgents','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','/describe','isAuthenticated','describe','show','/:id/members'];(function(_0x397c8d,_0xf0a1a4){var _0x1c5b0a=function(_0x4585d8){while(--_0x4585d8){_0x397c8d['push'](_0x397c8d['shift']());}};_0x1c5b0a(++_0xf0a1a4);}(_0xf918,0xe7));var _0x8f91=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0xf918[_0x5e709a];return _0x57401a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x8f91('0x0'));var express=require('express');var router=express[_0x8f91('0x1')]();var auth=require(_0x8f91('0x2'));var interaction=require(_0x8f91('0x3'));var config=require(_0x8f91('0x4'));var controller=require(_0x8f91('0x5'));router[_0x8f91('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8f91('0x6')](_0x8f91('0x7'),auth[_0x8f91('0x8')](),controller[_0x8f91('0x9')]);router[_0x8f91('0x6')]('/:id',auth[_0x8f91('0x8')](),controller[_0x8f91('0xa')]);router[_0x8f91('0x6')](_0x8f91('0xb'),auth[_0x8f91('0x8')](),controller[_0x8f91('0xc')]);router[_0x8f91('0x6')](_0x8f91('0xd'),auth['isAuthenticated'](),controller[_0x8f91('0xe')]);router['get'](_0x8f91('0xf'),auth['isAuthenticated'](),controller[_0x8f91('0x10')]);router[_0x8f91('0x11')]('/',auth[_0x8f91('0x8')](),controller[_0x8f91('0x12')]);router[_0x8f91('0x11')](_0x8f91('0xd'),auth['isAuthenticated'](),controller[_0x8f91('0x13')]);router[_0x8f91('0x11')](_0x8f91('0xf'),auth[_0x8f91('0x8')](),controller['addAgents']);router[_0x8f91('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x8f91('0x15')]);router[_0x8f91('0x16')](_0x8f91('0x17'),auth[_0x8f91('0x8')](),controller[_0x8f91('0x18')]);router['delete'](_0x8f91('0xd'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x8f91('0x16')](_0x8f91('0xf'),auth[_0x8f91('0x8')](),controller[_0x8f91('0x19')]);module[_0x8f91('0x1a')]=router; \ No newline at end of file +var _0xe417=['../../components/interaction/service','get','index','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','update','/:id','destroy','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xe417,0x86));var _0x7e41=function(_0x2fbd0e,_0x3460a9){_0x2fbd0e=_0x2fbd0e-0x0;var _0x481c9f=_0xe417[_0x2fbd0e];return _0x481c9f;};'use strict';var multer=require(_0x7e41('0x0'));var util=require(_0x7e41('0x1'));var path=require(_0x7e41('0x2'));var timeout=require(_0x7e41('0x3'));var express=require('express');var router=express[_0x7e41('0x4')]();var auth=require(_0x7e41('0x5'));var interaction=require(_0x7e41('0x6'));var config=require('../../config/environment');var controller=require('./chatQueue.controller');router[_0x7e41('0x7')]('/',auth['isAuthenticated'](),controller[_0x7e41('0x8')]);router['get']('/describe',auth[_0x7e41('0x9')](),controller[_0x7e41('0xa')]);router[_0x7e41('0x7')]('/:id',auth[_0x7e41('0x9')](),controller[_0x7e41('0xb')]);router['get'](_0x7e41('0xc'),auth[_0x7e41('0x9')](),controller[_0x7e41('0xd')]);router['get'](_0x7e41('0xe'),auth['isAuthenticated'](),controller[_0x7e41('0xf')]);router[_0x7e41('0x7')](_0x7e41('0x10'),auth[_0x7e41('0x9')](),controller[_0x7e41('0x11')]);router[_0x7e41('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7e41('0x12')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x7e41('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0x7e41('0x13')]);router[_0x7e41('0x14')]('/:id',auth[_0x7e41('0x9')](),controller[_0x7e41('0x15')]);router['delete'](_0x7e41('0x16'),auth[_0x7e41('0x9')](),controller[_0x7e41('0x17')]);router[_0x7e41('0x18')](_0x7e41('0xe'),auth[_0x7e41('0x9')](),controller[_0x7e41('0x19')]);router[_0x7e41('0x18')](_0x7e41('0x10'),auth[_0x7e41('0x9')](),controller[_0x7e41('0x1a')]);module[_0x7e41('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index eef271f..272ffc2 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 _0x359f=['DATE','sequelize','exports','STRING'];(function(_0x4f212d,_0x281219){var _0x9a9dd9=function(_0x5a93f3){while(--_0x5a93f3){_0x4f212d['push'](_0x4f212d['shift']());}};_0x9a9dd9(++_0x281219);}(_0x359f,0x145));var _0xf359=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x359f[_0x20a584];return _0x4b41a8;};'use strict';var moment=require('moment');var Sequelize=require(_0xf359('0x0'));module[_0xf359('0x1')]={'uniqueid':{'type':Sequelize[_0xf359('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf359('0x3')]},'leaveAt':{'type':Sequelize[_0xf359('0x3')]},'acceptAt':{'type':Sequelize[_0xf359('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcded=['STRING','DATE','moment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcded,0x92));var _0xdcde=function(_0x195577,_0x5de53a){_0x195577=_0x195577-0x0;var _0x13c367=_0xcded[_0x195577];return _0x13c367;};'use strict';var moment=require(_0xdcde('0x0'));var Sequelize=require('sequelize');module[_0xdcde('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xdcde('0x2')]},'joinAt':{'type':Sequelize[_0xdcde('0x3')]},'leaveAt':{'type':Sequelize[_0xdcde('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xdcde('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index ad0f919..7e6cfc0 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 _0xbaf0=['crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x5abae2,_0x593f5b){var _0x485d1a=function(_0x5e4815){while(--_0x5e4815){_0x5abae2['push'](_0x5abae2['shift']());}};_0x485d1a(++_0x593f5b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0baf('0x0'));var rimraf=require(_0x0baf('0x1'));var zipdir=require(_0x0baf('0x2'));var jsonpatch=require(_0x0baf('0x3'));var rp=require(_0x0baf('0x4'));var moment=require(_0x0baf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0baf('0x6'));var util=require(_0x0baf('0x7'));var path=require(_0x0baf('0x8'));var sox=require(_0x0baf('0x9'));var csv=require(_0x0baf('0xa'));var ejs=require(_0x0baf('0xb'));var fs=require('fs');var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a53e2,_0x465dd7){_0x465dd7=_0x465dd7||0xcc;return function(_0xe4378c){if(_0xe4378c){return _0x5a53e2[_0x0baf('0x1b')](_0x465dd7);}return _0x5a53e2[_0x0baf('0x1c')](_0x465dd7)['end']();};}function respondWithResult(_0x2ab33e,_0x49e44b){_0x49e44b=_0x49e44b||0xc8;return function(_0x1c76a8){if(_0x1c76a8){return _0x2ab33e[_0x0baf('0x1c')](_0x49e44b)[_0x0baf('0x1d')](_0x1c76a8);}};}function respondWithFilteredResult(_0x2bc381,_0xb8339e){return function(_0x469599){if(_0x469599){var _0x4f80a8=_0x469599[_0x0baf('0x1e')],_0x4cd79d=_0xb8339e[_0x0baf('0x1f')],_0x2312c7=_0xb8339e[_0x0baf('0x1f')]+_0xb8339e[_0x0baf('0x20')],_0x38395b;if(_0x2312c7>=_0x4f80a8){_0x2312c7=_0x4f80a8;_0x38395b=0xc8;}else{_0x38395b=0xce;}_0x2bc381['status'](_0x38395b);return _0x2bc381[_0x0baf('0x21')](_0x0baf('0x22'),_0x4cd79d+'-'+_0x2312c7+'/'+_0x4f80a8)[_0x0baf('0x1d')](_0x469599);}return null;};}function patchUpdates(_0x3e9cb4){return function(_0x47070d){try{jsonpatch[_0x0baf('0x23')](_0x47070d,_0x3e9cb4,!![]);}catch(_0x4ff793){return BPromise['reject'](_0x4ff793);}return _0x47070d[_0x0baf('0x24')]();};}function saveUpdates(_0x154f48,_0x32e839){return function(_0x1848e8){if(_0x1848e8){return _0x1848e8[_0x0baf('0x25')](_0x154f48)[_0x0baf('0x26')](function(_0x210cd8){return _0x210cd8;});}return null;};}function removeEntity(_0x636a13,_0x2c42e2){return function(_0x15a2c3){if(_0x15a2c3){return _0x15a2c3['destroy']()[_0x0baf('0x26')](function(){_0x636a13['status'](0xcc)[_0x0baf('0x27')]();});}};}function handleEntityNotFound(_0x5dbf00,_0x4de74c){return function(_0x2ef0aa){if(!_0x2ef0aa){_0x5dbf00['sendStatus'](0x194);}return _0x2ef0aa;};}function handleError(_0x4be1b9,_0x47c4b){_0x47c4b=_0x47c4b||0x1f4;return function(_0x27b59c){logger[_0x0baf('0x28')](_0x27b59c[_0x0baf('0x29')]);if(_0x27b59c[_0x0baf('0x2a')]){delete _0x27b59c['name'];}_0x4be1b9[_0x0baf('0x1c')](_0x47c4b)[_0x0baf('0x2b')](_0x27b59c);};}exports[_0x0baf('0x2c')]=function(_0x366e71,_0x3843b8){var _0x3b9b31={},_0x453525={},_0x549fd0={'count':0x0,'rows':[]};var _0x1590b4=_[_0x0baf('0x2d')](db[_0x0baf('0x2e')][_0x0baf('0x2f')],function(_0x55c715){return{'name':_0x55c715[_0x0baf('0x30')],'type':_0x55c715[_0x0baf('0x31')]['key']};});_0x453525[_0x0baf('0x32')]=_[_0x0baf('0x2d')](_0x1590b4,_0x0baf('0x2a'));_0x453525[_0x0baf('0x33')]=_[_0x0baf('0x34')](_0x366e71[_0x0baf('0x33')]);_0x453525[_0x0baf('0x35')]=_['intersection'](_0x453525[_0x0baf('0x32')],_0x453525[_0x0baf('0x33')]);_0x3b9b31[_0x0baf('0x36')]=_[_0x0baf('0x37')](_0x453525[_0x0baf('0x32')],qs[_0x0baf('0x38')](_0x366e71[_0x0baf('0x33')][_0x0baf('0x38')]));_0x3b9b31[_0x0baf('0x36')]=_0x3b9b31[_0x0baf('0x36')][_0x0baf('0x39')]?_0x3b9b31[_0x0baf('0x36')]:_0x453525[_0x0baf('0x32')];if(!_0x366e71[_0x0baf('0x33')]['hasOwnProperty'](_0x0baf('0x3a'))){_0x3b9b31['limit']=qs[_0x0baf('0x20')](_0x366e71[_0x0baf('0x33')][_0x0baf('0x20')]);_0x3b9b31[_0x0baf('0x1f')]=qs['offset'](_0x366e71[_0x0baf('0x33')][_0x0baf('0x1f')]);}_0x3b9b31['order']=qs[_0x0baf('0x3b')](_0x366e71[_0x0baf('0x33')][_0x0baf('0x3b')]);_0x3b9b31[_0x0baf('0x3c')]=qs[_0x0baf('0x35')](_[_0x0baf('0x3d')](_0x366e71[_0x0baf('0x33')],_0x453525[_0x0baf('0x35')]),_0x1590b4);if(_0x366e71['query'][_0x0baf('0x3e')]){_0x3b9b31[_0x0baf('0x3c')]=_['merge'](_0x3b9b31[_0x0baf('0x3c')],{'$or':_['map'](_0x1590b4,function(_0x5c545f){if(_0x5c545f[_0x0baf('0x31')]!==_0x0baf('0x3f')){var _0x5d3ad1={};_0x5d3ad1[_0x5c545f['name']]={'$like':'%'+_0x366e71[_0x0baf('0x33')][_0x0baf('0x3e')]+'%'};return _0x5d3ad1;}})});}_0x3b9b31=_[_0x0baf('0x40')]({},_0x3b9b31,_0x366e71[_0x0baf('0x41')]);var _0x15eb5c={'where':_0x3b9b31[_0x0baf('0x3c')]};return db[_0x0baf('0x2e')][_0x0baf('0x1e')](_0x15eb5c)[_0x0baf('0x26')](function(_0x36c6d2){_0x549fd0[_0x0baf('0x1e')]=_0x36c6d2;if(_0x366e71[_0x0baf('0x33')][_0x0baf('0x42')]){_0x3b9b31[_0x0baf('0x43')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x0baf('0x44')](_0x3b9b31);})[_0x0baf('0x26')](function(_0x4f1de9){_0x549fd0[_0x0baf('0x45')]=_0x4f1de9;return _0x549fd0;})[_0x0baf('0x26')](respondWithFilteredResult(_0x3843b8,_0x3b9b31))[_0x0baf('0x46')](handleError(_0x3843b8,null));};exports[_0x0baf('0x47')]=function(_0x2e20c8,_0x456d0b){var _0x57b581={'raw':!![],'where':{'id':_0x2e20c8[_0x0baf('0x48')]['id']}},_0x23ad34={};_0x23ad34['model']=_[_0x0baf('0x34')](db[_0x0baf('0x2e')][_0x0baf('0x2f')]);_0x23ad34[_0x0baf('0x33')]=_['keys'](_0x2e20c8[_0x0baf('0x33')]);_0x23ad34[_0x0baf('0x35')]=_[_0x0baf('0x37')](_0x23ad34[_0x0baf('0x32')],_0x23ad34[_0x0baf('0x33')]);_0x57b581[_0x0baf('0x36')]=_[_0x0baf('0x37')](_0x23ad34[_0x0baf('0x32')],qs[_0x0baf('0x38')](_0x2e20c8[_0x0baf('0x33')]['fields']));_0x57b581[_0x0baf('0x36')]=_0x57b581[_0x0baf('0x36')][_0x0baf('0x39')]?_0x57b581[_0x0baf('0x36')]:_0x23ad34[_0x0baf('0x32')];if(_0x2e20c8['query'][_0x0baf('0x42')]){_0x57b581[_0x0baf('0x43')]=[{'all':!![]}];}_0x57b581=_[_0x0baf('0x40')]({},_0x57b581,_0x2e20c8[_0x0baf('0x41')]);return db[_0x0baf('0x2e')]['find'](_0x57b581)[_0x0baf('0x26')](handleEntityNotFound(_0x456d0b,null))[_0x0baf('0x26')](respondWithResult(_0x456d0b,null))[_0x0baf('0x46')](handleError(_0x456d0b,null));};exports[_0x0baf('0x49')]=function(_0x41599f,_0x22d10f){return db[_0x0baf('0x2e')]['create'](_0x41599f[_0x0baf('0x4a')],{})[_0x0baf('0x26')](respondWithResult(_0x22d10f,0xc9))[_0x0baf('0x46')](handleError(_0x22d10f,null));};exports['update']=function(_0x3c9de3,_0x2222b6){if(_0x3c9de3[_0x0baf('0x4a')]['id']){delete _0x3c9de3[_0x0baf('0x4a')]['id'];}return db[_0x0baf('0x2e')][_0x0baf('0x4b')]({'where':{'id':_0x3c9de3[_0x0baf('0x48')]['id']}})['then'](handleEntityNotFound(_0x2222b6,null))[_0x0baf('0x26')](saveUpdates(_0x3c9de3[_0x0baf('0x4a')],null))[_0x0baf('0x26')](respondWithResult(_0x2222b6,null))[_0x0baf('0x46')](handleError(_0x2222b6,null));};exports[_0x0baf('0x4c')]=function(_0xc427b2,_0x40d4a6){return db[_0x0baf('0x2e')][_0x0baf('0x4b')]({'where':{'id':_0xc427b2[_0x0baf('0x48')]['id']}})[_0x0baf('0x26')](handleEntityNotFound(_0x40d4a6,null))['then'](removeEntity(_0x40d4a6,null))['catch'](handleError(_0x40d4a6,null));};exports[_0x0baf('0x4d')]=function(_0x3d6b19,_0x1cd114){return db[_0x0baf('0x2e')][_0x0baf('0x4d')]()[_0x0baf('0x26')](respondWithResult(_0x1cd114,null))[_0x0baf('0x46')](handleError(_0x1cd114,null));}; \ No newline at end of file +var _0xb7e7=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','ChatQueueReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','create','body','describe','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','ejs','lodash','squel','jsforce'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xb7e7[_0x13d07a];return _0x5ee0ee;};'use strict';var pdf=require(_0x7b7e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7b7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7b7e('0x2'));var rp=require('request-promise');var moment=require(_0x7b7e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7b7e('0x4'));var util=require(_0x7b7e('0x5'));var path=require(_0x7b7e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7b7e('0x7'));var fs=require('fs');var _=require(_0x7b7e('0x8'));var squel=require(_0x7b7e('0x9'));var crypto=require('crypto');var jsforce=require(_0x7b7e('0xa'));var deskjs=require(_0x7b7e('0xb'));var toCsv=require(_0x7b7e('0xc'));var querystring=require(_0x7b7e('0xd'));var Papa=require(_0x7b7e('0xe'));var Redis=require(_0x7b7e('0xf'));var authService=require(_0x7b7e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b7e('0x11'));var hardwareService=require(_0x7b7e('0x12'));var logger=require(_0x7b7e('0x13'))(_0x7b7e('0x14'));var utils=require(_0x7b7e('0x15'));var config=require(_0x7b7e('0x16'));var db=require(_0x7b7e('0x17'))['db'];function respondWithStatusCode(_0x55620b,_0xaadda){_0xaadda=_0xaadda||0xcc;return function(_0x54d8ce){if(_0x54d8ce){return _0x55620b[_0x7b7e('0x18')](_0xaadda);}return _0x55620b[_0x7b7e('0x19')](_0xaadda)['end']();};}function respondWithResult(_0x422d3a,_0x5976ac){_0x5976ac=_0x5976ac||0xc8;return function(_0x4c6011){if(_0x4c6011){return _0x422d3a[_0x7b7e('0x19')](_0x5976ac)[_0x7b7e('0x1a')](_0x4c6011);}};}function respondWithFilteredResult(_0xf067da,_0x457ec5){return function(_0x3d2fb2){if(_0x3d2fb2){var _0x5703fd=_0x3d2fb2[_0x7b7e('0x1b')],_0x51baf6=_0x457ec5[_0x7b7e('0x1c')],_0xc7f087=_0x457ec5[_0x7b7e('0x1c')]+_0x457ec5[_0x7b7e('0x1d')],_0x36444d;if(_0xc7f087>=_0x5703fd){_0xc7f087=_0x5703fd;_0x36444d=0xc8;}else{_0x36444d=0xce;}_0xf067da[_0x7b7e('0x19')](_0x36444d);return _0xf067da[_0x7b7e('0x1e')](_0x7b7e('0x1f'),_0x51baf6+'-'+_0xc7f087+'/'+_0x5703fd)[_0x7b7e('0x1a')](_0x3d2fb2);}return null;};}function patchUpdates(_0x12e8e9){return function(_0x14f4fe){try{jsonpatch[_0x7b7e('0x20')](_0x14f4fe,_0x12e8e9,!![]);}catch(_0x3bec7d){return BPromise[_0x7b7e('0x21')](_0x3bec7d);}return _0x14f4fe[_0x7b7e('0x22')]();};}function saveUpdates(_0x3a7b8b,_0x49eddb){return function(_0x69262b){if(_0x69262b){return _0x69262b[_0x7b7e('0x23')](_0x3a7b8b)[_0x7b7e('0x24')](function(_0x4c0647){return _0x4c0647;});}return null;};}function removeEntity(_0x313122,_0xbf0cb3){return function(_0x14243b){if(_0x14243b){return _0x14243b[_0x7b7e('0x25')]()[_0x7b7e('0x24')](function(){_0x313122[_0x7b7e('0x19')](0xcc)[_0x7b7e('0x26')]();});}};}function handleEntityNotFound(_0x10a66a,_0x53bbb3){return function(_0x5d6215){if(!_0x5d6215){_0x10a66a['sendStatus'](0x194);}return _0x5d6215;};}function handleError(_0x26ee14,_0x22598e){_0x22598e=_0x22598e||0x1f4;return function(_0x23bfa3){logger['error'](_0x23bfa3['stack']);if(_0x23bfa3['name']){delete _0x23bfa3[_0x7b7e('0x27')];}_0x26ee14[_0x7b7e('0x19')](_0x22598e)[_0x7b7e('0x28')](_0x23bfa3);};}exports[_0x7b7e('0x29')]=function(_0x3ceaf5,_0x48fad1){var _0x6a1e71={},_0x21a15={},_0x4c46b8={'count':0x0,'rows':[]};var _0x57b9da=_['map'](db[_0x7b7e('0x2a')][_0x7b7e('0x2b')],function(_0x503625){return{'name':_0x503625[_0x7b7e('0x2c')],'type':_0x503625['type'][_0x7b7e('0x2d')]};});_0x21a15[_0x7b7e('0x2e')]=_[_0x7b7e('0x2f')](_0x57b9da,'name');_0x21a15[_0x7b7e('0x30')]=_[_0x7b7e('0x31')](_0x3ceaf5[_0x7b7e('0x30')]);_0x21a15[_0x7b7e('0x32')]=_[_0x7b7e('0x33')](_0x21a15['model'],_0x21a15[_0x7b7e('0x30')]);_0x6a1e71['attributes']=_[_0x7b7e('0x33')](_0x21a15[_0x7b7e('0x2e')],qs[_0x7b7e('0x34')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x34')]));_0x6a1e71[_0x7b7e('0x35')]=_0x6a1e71[_0x7b7e('0x35')]['length']?_0x6a1e71['attributes']:_0x21a15[_0x7b7e('0x2e')];if(!_0x3ceaf5[_0x7b7e('0x30')]['hasOwnProperty'](_0x7b7e('0x36'))){_0x6a1e71[_0x7b7e('0x1d')]=qs[_0x7b7e('0x1d')](_0x3ceaf5['query'][_0x7b7e('0x1d')]);_0x6a1e71[_0x7b7e('0x1c')]=qs[_0x7b7e('0x1c')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x1c')]);}_0x6a1e71[_0x7b7e('0x37')]=qs[_0x7b7e('0x38')](_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x38')]);_0x6a1e71[_0x7b7e('0x39')]=qs[_0x7b7e('0x32')](_[_0x7b7e('0x3a')](_0x3ceaf5[_0x7b7e('0x30')],_0x21a15[_0x7b7e('0x32')]),_0x57b9da);if(_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x3b')]){_0x6a1e71['where']=_[_0x7b7e('0x3c')](_0x6a1e71[_0x7b7e('0x39')],{'$or':_[_0x7b7e('0x2f')](_0x57b9da,function(_0x242609){if(_0x242609[_0x7b7e('0x3d')]!==_0x7b7e('0x3e')){var _0x7f15={};_0x7f15[_0x242609[_0x7b7e('0x27')]]={'$like':'%'+_0x3ceaf5[_0x7b7e('0x30')][_0x7b7e('0x3b')]+'%'};return _0x7f15;}})});}_0x6a1e71=_['merge']({},_0x6a1e71,_0x3ceaf5[_0x7b7e('0x3f')]);var _0x1fa75b={'where':_0x6a1e71[_0x7b7e('0x39')]};return db[_0x7b7e('0x2a')]['count'](_0x1fa75b)[_0x7b7e('0x24')](function(_0x35b31a){_0x4c46b8[_0x7b7e('0x1b')]=_0x35b31a;if(_0x3ceaf5['query']['includeAll']){_0x6a1e71[_0x7b7e('0x40')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x7b7e('0x41')](_0x6a1e71);})[_0x7b7e('0x24')](function(_0x4de331){_0x4c46b8[_0x7b7e('0x42')]=_0x4de331;return _0x4c46b8;})[_0x7b7e('0x24')](respondWithFilteredResult(_0x48fad1,_0x6a1e71))[_0x7b7e('0x43')](handleError(_0x48fad1,null));};exports[_0x7b7e('0x44')]=function(_0x38d32f,_0x435de5){var _0xc888e4={'raw':!![],'where':{'id':_0x38d32f[_0x7b7e('0x45')]['id']}},_0x1d9bb9={};_0x1d9bb9['model']=_['keys'](db[_0x7b7e('0x2a')]['rawAttributes']);_0x1d9bb9[_0x7b7e('0x30')]=_['keys'](_0x38d32f['query']);_0x1d9bb9[_0x7b7e('0x32')]=_['intersection'](_0x1d9bb9[_0x7b7e('0x2e')],_0x1d9bb9['query']);_0xc888e4[_0x7b7e('0x35')]=_[_0x7b7e('0x33')](_0x1d9bb9[_0x7b7e('0x2e')],qs[_0x7b7e('0x34')](_0x38d32f['query'][_0x7b7e('0x34')]));_0xc888e4[_0x7b7e('0x35')]=_0xc888e4[_0x7b7e('0x35')][_0x7b7e('0x46')]?_0xc888e4[_0x7b7e('0x35')]:_0x1d9bb9[_0x7b7e('0x2e')];if(_0x38d32f['query']['includeAll']){_0xc888e4['include']=[{'all':!![]}];}_0xc888e4=_[_0x7b7e('0x3c')]({},_0xc888e4,_0x38d32f[_0x7b7e('0x3f')]);return db[_0x7b7e('0x2a')][_0x7b7e('0x47')](_0xc888e4)[_0x7b7e('0x24')](handleEntityNotFound(_0x435de5,null))[_0x7b7e('0x24')](respondWithResult(_0x435de5,null))['catch'](handleError(_0x435de5,null));};exports[_0x7b7e('0x48')]=function(_0x42e560,_0x5a0832){return db['ChatQueueReport'][_0x7b7e('0x48')](_0x42e560[_0x7b7e('0x49')],{})[_0x7b7e('0x24')](respondWithResult(_0x5a0832,0xc9))[_0x7b7e('0x43')](handleError(_0x5a0832,null));};exports[_0x7b7e('0x23')]=function(_0xb46776,_0x590154){if(_0xb46776[_0x7b7e('0x49')]['id']){delete _0xb46776['body']['id'];}return db[_0x7b7e('0x2a')][_0x7b7e('0x47')]({'where':{'id':_0xb46776[_0x7b7e('0x45')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x590154,null))['then'](saveUpdates(_0xb46776[_0x7b7e('0x49')],null))[_0x7b7e('0x24')](respondWithResult(_0x590154,null))[_0x7b7e('0x43')](handleError(_0x590154,null));};exports[_0x7b7e('0x25')]=function(_0x1f9d0f,_0x5cce7c){return db[_0x7b7e('0x2a')][_0x7b7e('0x47')]({'where':{'id':_0x1f9d0f[_0x7b7e('0x45')]['id']}})[_0x7b7e('0x24')](handleEntityNotFound(_0x5cce7c,null))[_0x7b7e('0x24')](removeEntity(_0x5cce7c,null))['catch'](handleError(_0x5cce7c,null));};exports[_0x7b7e('0x4a')]=function(_0x29024e,_0x46d4ee){return db[_0x7b7e('0x2a')][_0x7b7e('0x4a')]()[_0x7b7e('0x24')](respondWithResult(_0x46d4ee,null))[_0x7b7e('0x43')](handleError(_0x46d4ee,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index f857a4c..3e2df0d 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 _0x7073=['define','ChatQueueReport','uniqueid','lodash','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes'];(function(_0x94f0be,_0x14f2dd){var _0x7700b0=function(_0x11390b){while(--_0x11390b){_0x94f0be['push'](_0x94f0be['shift']());}};_0x7700b0(++_0x14f2dd);}(_0x7073,0xf3));var _0x3707=function(_0x4a4ec8,_0x2e2e9b){_0x4a4ec8=_0x4a4ec8-0x0;var _0x12241a=_0x7073[_0x4a4ec8];return _0x12241a;};'use strict';var _=require(_0x3707('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3707('0x1'));var BPromise=require('bluebird');var rp=require(_0x3707('0x2'));var fs=require('fs');var path=require(_0x3707('0x3'));var rimraf=require(_0x3707('0x4'));var config=require(_0x3707('0x5'));var attributes=require(_0x3707('0x6'));module['exports']=function(_0xd8b04c,_0xcec3b3){return _0xd8b04c[_0x3707('0x7')](_0x3707('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x3707('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1c47=['ChatQueueReport','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','exports','define'];(function(_0x2e997e,_0x4edf31){var _0x5a6cb1=function(_0x3904da){while(--_0x3904da){_0x2e997e['push'](_0x2e997e['shift']());}};_0x5a6cb1(++_0x4edf31);}(_0x1c47,0x86));var _0x71c4=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x1c47[_0x163040];return _0x364667;};'use strict';var _=require(_0x71c4('0x0'));var util=require(_0x71c4('0x1'));var logger=require(_0x71c4('0x2'))('api');var moment=require(_0x71c4('0x3'));var BPromise=require(_0x71c4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x71c4('0x5'));var rimraf=require('rimraf');var config=require(_0x71c4('0x6'));var attributes=require('./chatQueueReport.attributes');module[_0x71c4('0x7')]=function(_0x28c289,_0x1f067f){return _0x28c289[_0x71c4('0x8')](_0x71c4('0x9'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x71c4('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 094ff68..bf4c02b 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 _0xc75f=['info','result','catch','CreateChatQueueReport','create','body','options','raw','debug','UpdateChatQueueReport','ChatQueueReport','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message'];(function(_0x5d6c3e,_0x409a3e){var _0x44ecb7=function(_0x936b6a){while(--_0x936b6a){_0x5d6c3e['push'](_0x5d6c3e['shift']());}};_0x44ecb7(++_0x409a3e);}(_0xc75f,0x12d));var _0xfc75=function(_0x5f0209,_0x4d0422){_0x5f0209=_0x5f0209-0x0;var _0x116987=_0xc75f[_0x5f0209];return _0x116987;};'use strict';var _=require(_0xfc75('0x0'));var util=require(_0xfc75('0x1'));var moment=require(_0xfc75('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc75('0x3'));var db=require(_0xfc75('0x4'))['db'];var utils=require(_0xfc75('0x5'));var logger=require(_0xfc75('0x6'))('rpc');var config=require(_0xfc75('0x7'));var jayson=require(_0xfc75('0x8'));var client=jayson['client'][_0xfc75('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d43f0,_0x1b97bf,_0x1fd911){return new BPromise(function(_0x292000,_0x211d98){return client[_0xfc75('0xa')](_0x2d43f0,_0x1fd911)[_0xfc75('0xb')](function(_0x441c8e){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x1b97bf,_0xfc75('0xc'));logger['debug'](_0xfc75('0xd'),_0x1b97bf,_0xfc75('0xc'),JSON[_0xfc75('0xe')](_0x441c8e));if(_0x441c8e['error']){if(_0x441c8e[_0xfc75('0xf')][_0xfc75('0x10')]===0x1f4){logger[_0xfc75('0xf')](_0xfc75('0x11'),_0x1b97bf,_0x441c8e[_0xfc75('0xf')]['message']);return _0x211d98(_0x441c8e['error'][_0xfc75('0x12')]);}logger['error'](_0xfc75('0x11'),_0x1b97bf,_0x441c8e[_0xfc75('0xf')][_0xfc75('0x12')]);return _0x292000(_0x441c8e[_0xfc75('0xf')]['message']);}else{logger[_0xfc75('0x13')](_0xfc75('0x11'),_0x1b97bf,'request\x20sent');_0x292000(_0x441c8e[_0xfc75('0x14')][_0xfc75('0x12')]);}})[_0xfc75('0x15')](function(_0x63a304){logger[_0xfc75('0xf')](_0xfc75('0x11'),_0x1b97bf,_0x63a304);_0x211d98(_0x63a304);});});}exports[_0xfc75('0x16')]=function(_0x14250b){var _0x2efe70=this;return new Promise(function(_0x531595,_0x12126a){return db['ChatQueueReport'][_0xfc75('0x17')](_0x14250b[_0xfc75('0x18')],{'raw':_0x14250b[_0xfc75('0x19')]?_0x14250b[_0xfc75('0x19')][_0xfc75('0x1a')]===undefined?!![]:![]:!![]})[_0xfc75('0xb')](function(_0x2f2c38){logger[_0xfc75('0x13')](_0xfc75('0x16'),_0x14250b);logger[_0xfc75('0x1b')](_0xfc75('0x16'),_0x14250b,JSON['stringify'](_0x2f2c38));_0x531595(_0x2f2c38);})[_0xfc75('0x15')](function(_0xc9a883){logger[_0xfc75('0xf')](_0xfc75('0x16'),_0xc9a883[_0xfc75('0x12')],_0x14250b);_0x12126a(_0x2efe70[_0xfc75('0xf')](0x1f4,_0xc9a883['message']));});});};exports[_0xfc75('0x1c')]=function(_0x5d05e7){var _0x45d250=this;return new Promise(function(_0x514e8a,_0x315f4e){return db[_0xfc75('0x1d')]['update'](_0x5d05e7[_0xfc75('0x18')],{'raw':_0x5d05e7['options']?_0x5d05e7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d05e7[_0xfc75('0x19')]?_0x5d05e7[_0xfc75('0x19')]['where']||null:null,'attributes':_0x5d05e7[_0xfc75('0x19')]?_0x5d05e7['options'][_0xfc75('0x1e')]||null:null,'limit':_0x5d05e7[_0xfc75('0x19')]?_0x5d05e7[_0xfc75('0x19')][_0xfc75('0x1f')]||null:null})[_0xfc75('0xb')](function(_0x34b111){logger[_0xfc75('0x13')](_0xfc75('0x1c'),_0x5d05e7);logger[_0xfc75('0x1b')](_0xfc75('0x1c'),_0x5d05e7,JSON['stringify'](_0x34b111));_0x514e8a(_0x34b111);})[_0xfc75('0x15')](function(_0x551d77){logger[_0xfc75('0xf')](_0xfc75('0x1c'),_0x551d77[_0xfc75('0x12')],_0x5d05e7);_0x315f4e(_0x45d250['error'](0x1f4,_0x551d77['message']));});});}; \ No newline at end of file +var _0x4b36=['../../config/utils','rpc','jayson/promise','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','stringify','UpdateChatQueueReport','update','body','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x242849,_0x5e7b64){var _0x14aab6=function(_0x13fcfe){while(--_0x13fcfe){_0x242849['push'](_0x242849['shift']());}};_0x14aab6(++_0x5e7b64);}(_0x4b36,0xf2));var _0x64b3=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x4b36[_0xc4001c];return _0x49f7bc;};'use strict';var _=require(_0x64b3('0x0'));var util=require(_0x64b3('0x1'));var moment=require(_0x64b3('0x2'));var BPromise=require('bluebird');var rs=require(_0x64b3('0x3'));var fs=require('fs');var Redis=require(_0x64b3('0x4'));var db=require(_0x64b3('0x5'))['db'];var utils=require(_0x64b3('0x6'));var logger=require('../../config/logger')(_0x64b3('0x7'));var config=require('../../config/environment');var jayson=require(_0x64b3('0x8'));var client=jayson['client'][_0x64b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21a19a,_0xbf6a62,_0x4d2399){return new BPromise(function(_0x15f7f6,_0x440c08){return client[_0x64b3('0xa')](_0x21a19a,_0x4d2399)[_0x64b3('0xb')](function(_0xbbdd56){logger[_0x64b3('0xc')](_0x64b3('0xd'),_0xbf6a62,'request\x20sent');logger[_0x64b3('0xe')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0xbf6a62,_0x64b3('0xf'),JSON['stringify'](_0xbbdd56));if(_0xbbdd56[_0x64b3('0x10')]){if(_0xbbdd56[_0x64b3('0x10')][_0x64b3('0x11')]===0x1f4){logger[_0x64b3('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0xbf6a62,_0xbbdd56[_0x64b3('0x10')][_0x64b3('0x12')]);return _0x440c08(_0xbbdd56[_0x64b3('0x10')][_0x64b3('0x12')]);}logger[_0x64b3('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0xbf6a62,_0xbbdd56['error'][_0x64b3('0x12')]);return _0x15f7f6(_0xbbdd56[_0x64b3('0x10')]['message']);}else{logger[_0x64b3('0xc')](_0x64b3('0xd'),_0xbf6a62,_0x64b3('0xf'));_0x15f7f6(_0xbbdd56[_0x64b3('0x13')][_0x64b3('0x12')]);}})[_0x64b3('0x14')](function(_0x2e0795){logger[_0x64b3('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0xbf6a62,_0x2e0795);_0x440c08(_0x2e0795);});});}exports[_0x64b3('0x15')]=function(_0x485693){var _0x507a53=this;return new Promise(function(_0x1bb27f,_0x3f099c){return db[_0x64b3('0x16')][_0x64b3('0x17')](_0x485693['body'],{'raw':_0x485693[_0x64b3('0x18')]?_0x485693[_0x64b3('0x18')][_0x64b3('0x19')]===undefined?!![]:![]:!![]})[_0x64b3('0xb')](function(_0x17549a){logger[_0x64b3('0xc')](_0x64b3('0x15'),_0x485693);logger[_0x64b3('0xe')](_0x64b3('0x15'),_0x485693,JSON[_0x64b3('0x1a')](_0x17549a));_0x1bb27f(_0x17549a);})['catch'](function(_0x2505cb){logger[_0x64b3('0x10')]('CreateChatQueueReport',_0x2505cb[_0x64b3('0x12')],_0x485693);_0x3f099c(_0x507a53[_0x64b3('0x10')](0x1f4,_0x2505cb[_0x64b3('0x12')]));});});};exports[_0x64b3('0x1b')]=function(_0xf3a813){var _0x33b7c1=this;return new Promise(function(_0x561e7c,_0x2fe2db){return db[_0x64b3('0x16')][_0x64b3('0x1c')](_0xf3a813[_0x64b3('0x1d')],{'raw':_0xf3a813[_0x64b3('0x18')]?_0xf3a813[_0x64b3('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf3a813['options']?_0xf3a813['options']['where']||null:null,'attributes':_0xf3a813[_0x64b3('0x18')]?_0xf3a813[_0x64b3('0x18')][_0x64b3('0x1e')]||null:null,'limit':_0xf3a813[_0x64b3('0x18')]?_0xf3a813['options']['limit']||null:null})['then'](function(_0x20c401){logger[_0x64b3('0xc')](_0x64b3('0x1b'),_0xf3a813);logger[_0x64b3('0xe')](_0x64b3('0x1b'),_0xf3a813,JSON[_0x64b3('0x1a')](_0x20c401));_0x561e7c(_0x20c401);})['catch'](function(_0x13d328){logger[_0x64b3('0x10')]('UpdateChatQueueReport',_0x13d328['message'],_0xf3a813);_0x2fe2db(_0x33b7c1[_0x64b3('0x10')](0x1f4,_0x13d328['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index d915685..83221ca 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 _0x94b9=['../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','post','put','/:id','update','delete','util','path','connect-timeout','express','Router'];(function(_0x5371ad,_0x1e308b){var _0x54982b=function(_0x3e778f){while(--_0x3e778f){_0x5371ad['push'](_0x5371ad['shift']());}};_0x54982b(++_0x1e308b);}(_0x94b9,0xd3));var _0x994b=function(_0x32929d,_0x103b9d){_0x32929d=_0x32929d-0x0;var _0x13df73=_0x94b9[_0x32929d];return _0x13df73;};'use strict';var multer=require('multer');var util=require(_0x994b('0x0'));var path=require(_0x994b('0x1'));var timeout=require(_0x994b('0x2'));var express=require(_0x994b('0x3'));var router=express[_0x994b('0x4')]();var auth=require(_0x994b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x994b('0x6'));var controller=require(_0x994b('0x7'));router[_0x994b('0x8')]('/',auth[_0x994b('0x9')](),controller[_0x994b('0xa')]);router[_0x994b('0x8')](_0x994b('0xb'),auth['isAuthenticated'](),controller[_0x994b('0xc')]);router[_0x994b('0x8')]('/:id',auth[_0x994b('0x9')](),controller['show']);router[_0x994b('0xd')]('/',auth[_0x994b('0x9')](),controller['create']);router[_0x994b('0xe')](_0x994b('0xf'),auth[_0x994b('0x9')](),controller[_0x994b('0x10')]);router[_0x994b('0x11')](_0x994b('0xf'),auth[_0x994b('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1b78=['/describe','describe','/:id','show','post','put','update','destroy','exports','multer','path','connect-timeout','../../config/environment','get','isAuthenticated'];(function(_0x58ab22,_0x42c988){var _0x3bedba=function(_0x121f16){while(--_0x121f16){_0x58ab22['push'](_0x58ab22['shift']());}};_0x3bedba(++_0x42c988);}(_0x1b78,0x108));var _0x81b7=function(_0x423a79,_0x41b567){_0x423a79=_0x423a79-0x0;var _0x172e87=_0x1b78[_0x423a79];return _0x172e87;};'use strict';var multer=require(_0x81b7('0x0'));var util=require('util');var path=require(_0x81b7('0x1'));var timeout=require(_0x81b7('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x81b7('0x3'));var controller=require('./chatQueueReport.controller');router[_0x81b7('0x4')]('/',auth[_0x81b7('0x5')](),controller['index']);router[_0x81b7('0x4')](_0x81b7('0x6'),auth[_0x81b7('0x5')](),controller[_0x81b7('0x7')]);router['get'](_0x81b7('0x8'),auth[_0x81b7('0x5')](),controller[_0x81b7('0x9')]);router[_0x81b7('0xa')]('/',auth[_0x81b7('0x5')](),controller['create']);router[_0x81b7('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x81b7('0xc')]);router['delete'](_0x81b7('0x8'),auth[_0x81b7('0x5')](),controller[_0x81b7('0xd')]);module[_0x81b7('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index ecbf616..b81df54 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 _0x054b=['queue','moment','exports','STRING','account','agent'];(function(_0x3fcf5c,_0x6d237){var _0x40ce14=function(_0x22f303){while(--_0x22f303){_0x3fcf5c['push'](_0x3fcf5c['shift']());}};_0x40ce14(++_0x6d237);}(_0x054b,0x1ab));var _0xb054=function(_0x291ee4,_0x97db5c){_0x291ee4=_0x291ee4-0x0;var _0x9ef907=_0x054b[_0x291ee4];return _0x9ef907;};'use strict';var moment=require(_0xb054('0x0'));var Sequelize=require('sequelize');module[_0xb054('0x1')]={'uniqueid':{'type':Sequelize[_0xb054('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xb054('0x3'),_0xb054('0x4'),_0xb054('0x5')),'allowNull':![],'defaultValue':_0xb054('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x6b53=['agent','DATE','NOW','ENUM','account'];(function(_0x2b1bb9,_0x3f85cc){var _0x59f401=function(_0x14ac15){while(--_0x14ac15){_0x2b1bb9['push'](_0x2b1bb9['shift']());}};_0x59f401(++_0x3f85cc);}(_0x6b53,0x120));var _0x36b5=function(_0x5b9f30,_0x196843){_0x5b9f30=_0x5b9f30-0x0;var _0x30fd79=_0x6b53[_0x5b9f30];return _0x30fd79;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x36b5('0x0')](_0x36b5('0x1'),_0x36b5('0x2'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x36b5('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x36b5('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 47762ed..e2343f2 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 _0xdb72=['status','count','offset','limit','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','intersection','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x452370,_0x4bd618){var _0x486d72=function(_0x464b2b){while(--_0x464b2b){_0x452370['push'](_0x452370['shift']());}};_0x486d72(++_0x4bd618);}(_0xdb72,0x147));var _0x2db7=function(_0x13cab0,_0x14d825){_0x13cab0=_0x13cab0-0x0;var _0x38804f=_0xdb72[_0x13cab0];return _0x38804f;};'use strict';var pdf=require(_0x2db7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2db7('0x1'));var zipdir=require(_0x2db7('0x2'));var jsonpatch=require(_0x2db7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2db7('0x4'));var Mustache=require(_0x2db7('0x5'));var util=require(_0x2db7('0x6'));var path=require('path');var sox=require(_0x2db7('0x7'));var csv=require(_0x2db7('0x8'));var ejs=require(_0x2db7('0x9'));var fs=require('fs');var _=require(_0x2db7('0xa'));var squel=require(_0x2db7('0xb'));var crypto=require('crypto');var jsforce=require(_0x2db7('0xc'));var deskjs=require(_0x2db7('0xd'));var toCsv=require(_0x2db7('0x8'));var querystring=require(_0x2db7('0xe'));var Papa=require(_0x2db7('0xf'));var Redis=require(_0x2db7('0x10'));var authService=require(_0x2db7('0x11'));var qs=require(_0x2db7('0x12'));var as=require(_0x2db7('0x13'));var hardwareService=require(_0x2db7('0x14'));var logger=require('../../config/logger')(_0x2db7('0x15'));var utils=require('../../config/utils');var config=require(_0x2db7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x273579,_0x44ee02){_0x44ee02=_0x44ee02||0xcc;return function(_0x3c1390){if(_0x3c1390){return _0x273579['sendStatus'](_0x44ee02);}return _0x273579[_0x2db7('0x17')](_0x44ee02)['end']();};}function respondWithResult(_0x4a204b,_0x5834bd){_0x5834bd=_0x5834bd||0xc8;return function(_0x2a7810){if(_0x2a7810){return _0x4a204b['status'](_0x5834bd)['json'](_0x2a7810);}};}function respondWithFilteredResult(_0x34c55d,_0x388c72){return function(_0x376d1e){if(_0x376d1e){var _0x16d64e=_0x376d1e[_0x2db7('0x18')],_0x2bed2f=_0x388c72[_0x2db7('0x19')],_0x2a92e7=_0x388c72[_0x2db7('0x19')]+_0x388c72[_0x2db7('0x1a')],_0x1604db;if(_0x2a92e7>=_0x16d64e){_0x2a92e7=_0x16d64e;_0x1604db=0xc8;}else{_0x1604db=0xce;}_0x34c55d[_0x2db7('0x17')](_0x1604db);return _0x34c55d['set']('Content-Range',_0x2bed2f+'-'+_0x2a92e7+'/'+_0x16d64e)[_0x2db7('0x1b')](_0x376d1e);}return null;};}function patchUpdates(_0x3dd676){return function(_0x19943b){try{jsonpatch[_0x2db7('0x1c')](_0x19943b,_0x3dd676,!![]);}catch(_0x5d0f3d){return BPromise[_0x2db7('0x1d')](_0x5d0f3d);}return _0x19943b[_0x2db7('0x1e')]();};}function saveUpdates(_0x1df7d0,_0x4b9c16){return function(_0x4bcda6){if(_0x4bcda6){return _0x4bcda6[_0x2db7('0x1f')](_0x1df7d0)[_0x2db7('0x20')](function(_0x509e17){return _0x509e17;});}return null;};}function removeEntity(_0x413f25,_0xb4ba29){return function(_0x2158b7){if(_0x2158b7){return _0x2158b7[_0x2db7('0x21')]()[_0x2db7('0x20')](function(){_0x413f25[_0x2db7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5beb46,_0x111af7){return function(_0x45cd74){if(!_0x45cd74){_0x5beb46[_0x2db7('0x22')](0x194);}return _0x45cd74;};}function handleError(_0x54f23f,_0x16f618){_0x16f618=_0x16f618||0x1f4;return function(_0x14ac72){logger[_0x2db7('0x23')](_0x14ac72[_0x2db7('0x24')]);if(_0x14ac72[_0x2db7('0x25')]){delete _0x14ac72['name'];}_0x54f23f[_0x2db7('0x17')](_0x16f618)[_0x2db7('0x26')](_0x14ac72);};}exports[_0x2db7('0x27')]=function(_0x3074f5,_0x3183dc){var _0x119c83={},_0x4a7b11={},_0x280487={'count':0x0,'rows':[]};var _0x4bb2c5=_[_0x2db7('0x28')](db[_0x2db7('0x29')][_0x2db7('0x2a')],function(_0x169dfc){return{'name':_0x169dfc['fieldName'],'type':_0x169dfc['type'][_0x2db7('0x2b')]};});_0x4a7b11[_0x2db7('0x2c')]=_[_0x2db7('0x28')](_0x4bb2c5,'name');_0x4a7b11[_0x2db7('0x2d')]=_['keys'](_0x3074f5[_0x2db7('0x2d')]);_0x4a7b11[_0x2db7('0x2e')]=_['intersection'](_0x4a7b11[_0x2db7('0x2c')],_0x4a7b11[_0x2db7('0x2d')]);_0x119c83[_0x2db7('0x2f')]=_['intersection'](_0x4a7b11[_0x2db7('0x2c')],qs[_0x2db7('0x30')](_0x3074f5[_0x2db7('0x2d')][_0x2db7('0x30')]));_0x119c83[_0x2db7('0x2f')]=_0x119c83['attributes']['length']?_0x119c83['attributes']:_0x4a7b11[_0x2db7('0x2c')];if(!_0x3074f5[_0x2db7('0x2d')][_0x2db7('0x31')](_0x2db7('0x32'))){_0x119c83[_0x2db7('0x1a')]=qs['limit'](_0x3074f5['query'][_0x2db7('0x1a')]);_0x119c83['offset']=qs[_0x2db7('0x19')](_0x3074f5['query'][_0x2db7('0x19')]);}_0x119c83['order']=qs[_0x2db7('0x33')](_0x3074f5[_0x2db7('0x2d')][_0x2db7('0x33')]);_0x119c83[_0x2db7('0x34')]=qs[_0x2db7('0x2e')](_[_0x2db7('0x35')](_0x3074f5['query'],_0x4a7b11[_0x2db7('0x2e')]),_0x4bb2c5);if(_0x3074f5[_0x2db7('0x2d')][_0x2db7('0x36')]){_0x119c83[_0x2db7('0x34')]=_[_0x2db7('0x37')](_0x119c83[_0x2db7('0x34')],{'$or':_[_0x2db7('0x28')](_0x4bb2c5,function(_0x38d71c){if(_0x38d71c['type']!==_0x2db7('0x38')){var _0xac1261={};_0xac1261[_0x38d71c['name']]={'$like':'%'+_0x3074f5[_0x2db7('0x2d')][_0x2db7('0x36')]+'%'};return _0xac1261;}})});}_0x119c83=_[_0x2db7('0x37')]({},_0x119c83,_0x3074f5[_0x2db7('0x39')]);var _0x537114={'where':_0x119c83[_0x2db7('0x34')]};return db[_0x2db7('0x29')]['count'](_0x537114)[_0x2db7('0x20')](function(_0x4b73ff){_0x280487[_0x2db7('0x18')]=_0x4b73ff;if(_0x3074f5[_0x2db7('0x2d')][_0x2db7('0x3a')]){_0x119c83[_0x2db7('0x3b')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x2db7('0x3c')](_0x119c83);})[_0x2db7('0x20')](function(_0x5a17d0){_0x280487['rows']=_0x5a17d0;return _0x280487;})[_0x2db7('0x20')](respondWithFilteredResult(_0x3183dc,_0x119c83))[_0x2db7('0x3d')](handleError(_0x3183dc,null));};exports[_0x2db7('0x3e')]=function(_0x26b94e,_0x16c58a){var _0x2a06aa={'raw':!![],'where':{'id':_0x26b94e[_0x2db7('0x3f')]['id']}},_0x121b47={};_0x121b47[_0x2db7('0x2c')]=_[_0x2db7('0x40')](db[_0x2db7('0x29')][_0x2db7('0x2a')]);_0x121b47[_0x2db7('0x2d')]=_['keys'](_0x26b94e[_0x2db7('0x2d')]);_0x121b47['filters']=_[_0x2db7('0x41')](_0x121b47[_0x2db7('0x2c')],_0x121b47[_0x2db7('0x2d')]);_0x2a06aa[_0x2db7('0x2f')]=_['intersection'](_0x121b47[_0x2db7('0x2c')],qs['fields'](_0x26b94e['query']['fields']));_0x2a06aa[_0x2db7('0x2f')]=_0x2a06aa[_0x2db7('0x2f')]['length']?_0x2a06aa[_0x2db7('0x2f')]:_0x121b47[_0x2db7('0x2c')];if(_0x26b94e['query'][_0x2db7('0x3a')]){_0x2a06aa[_0x2db7('0x3b')]=[{'all':!![]}];}_0x2a06aa=_[_0x2db7('0x37')]({},_0x2a06aa,_0x26b94e[_0x2db7('0x39')]);return db[_0x2db7('0x29')][_0x2db7('0x42')](_0x2a06aa)[_0x2db7('0x20')](handleEntityNotFound(_0x16c58a,null))['then'](respondWithResult(_0x16c58a,null))[_0x2db7('0x3d')](handleError(_0x16c58a,null));};exports[_0x2db7('0x43')]=function(_0x35c370,_0x4c0147){return db[_0x2db7('0x29')]['create'](_0x35c370[_0x2db7('0x44')],{})[_0x2db7('0x20')](respondWithResult(_0x4c0147,0xc9))[_0x2db7('0x3d')](handleError(_0x4c0147,null));};exports[_0x2db7('0x1f')]=function(_0x3bf1c6,_0x56642f){if(_0x3bf1c6[_0x2db7('0x44')]['id']){delete _0x3bf1c6[_0x2db7('0x44')]['id'];}return db[_0x2db7('0x29')]['find']({'where':{'id':_0x3bf1c6[_0x2db7('0x3f')]['id']}})[_0x2db7('0x20')](handleEntityNotFound(_0x56642f,null))['then'](saveUpdates(_0x3bf1c6[_0x2db7('0x44')],null))[_0x2db7('0x20')](respondWithResult(_0x56642f,null))[_0x2db7('0x3d')](handleError(_0x56642f,null));};exports[_0x2db7('0x21')]=function(_0x4c6281,_0x50c2e7){return db[_0x2db7('0x29')][_0x2db7('0x42')]({'where':{'id':_0x4c6281['params']['id']}})['then'](handleEntityNotFound(_0x50c2e7,null))[_0x2db7('0x20')](removeEntity(_0x50c2e7,null))[_0x2db7('0x3d')](handleError(_0x50c2e7,null));};exports[_0x2db7('0x45')]=function(_0x10ab85,_0x1760a2){return db[_0x2db7('0x29')][_0x2db7('0x45')]()[_0x2db7('0x20')](respondWithResult(_0x1760a2,null))[_0x2db7('0x3d')](handleError(_0x1760a2,null));}; \ No newline at end of file +var _0x9c6d=['create','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','ChatTransferReport','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','rawAttributes','length','includeAll'];(function(_0x2c2aaa,_0x27673e){var _0x43f6fa=function(_0x59c73f){while(--_0x59c73f){_0x2c2aaa['push'](_0x2c2aaa['shift']());}};_0x43f6fa(++_0x27673e);}(_0x9c6d,0xe5));var _0xd9c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c6d[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xd9c6('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd9c6('0x1'));var zipdir=require(_0xd9c6('0x2'));var jsonpatch=require(_0xd9c6('0x3'));var rp=require(_0xd9c6('0x4'));var moment=require(_0xd9c6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd9c6('0x6'));var util=require(_0xd9c6('0x7'));var path=require('path');var sox=require(_0xd9c6('0x8'));var csv=require(_0xd9c6('0x9'));var ejs=require(_0xd9c6('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd9c6('0xb'));var deskjs=require(_0xd9c6('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd9c6('0xd'));var Redis=require(_0xd9c6('0xe'));var authService=require(_0xd9c6('0xf'));var qs=require(_0xd9c6('0x10'));var as=require(_0xd9c6('0x11'));var hardwareService=require(_0xd9c6('0x12'));var logger=require(_0xd9c6('0x13'))(_0xd9c6('0x14'));var utils=require(_0xd9c6('0x15'));var config=require(_0xd9c6('0x16'));var db=require(_0xd9c6('0x17'))['db'];function respondWithStatusCode(_0xd9ce6c,_0x51ac9b){_0x51ac9b=_0x51ac9b||0xcc;return function(_0xd45301){if(_0xd45301){return _0xd9ce6c[_0xd9c6('0x18')](_0x51ac9b);}return _0xd9ce6c[_0xd9c6('0x19')](_0x51ac9b)[_0xd9c6('0x1a')]();};}function respondWithResult(_0x2f4fb9,_0x3fa118){_0x3fa118=_0x3fa118||0xc8;return function(_0x5d986a){if(_0x5d986a){return _0x2f4fb9[_0xd9c6('0x19')](_0x3fa118)[_0xd9c6('0x1b')](_0x5d986a);}};}function respondWithFilteredResult(_0x44766d,_0x1165f9){return function(_0x56fb44){if(_0x56fb44){var _0x4904c1=_0x56fb44[_0xd9c6('0x1c')],_0xc62365=_0x1165f9['offset'],_0x149537=_0x1165f9[_0xd9c6('0x1d')]+_0x1165f9['limit'],_0x2f6c21;if(_0x149537>=_0x4904c1){_0x149537=_0x4904c1;_0x2f6c21=0xc8;}else{_0x2f6c21=0xce;}_0x44766d['status'](_0x2f6c21);return _0x44766d[_0xd9c6('0x1e')](_0xd9c6('0x1f'),_0xc62365+'-'+_0x149537+'/'+_0x4904c1)[_0xd9c6('0x1b')](_0x56fb44);}return null;};}function patchUpdates(_0x441fe8){return function(_0x5948a1){try{jsonpatch[_0xd9c6('0x20')](_0x5948a1,_0x441fe8,!![]);}catch(_0x9fc293){return BPromise[_0xd9c6('0x21')](_0x9fc293);}return _0x5948a1['save']();};}function saveUpdates(_0x43cd09,_0x4e3dcf){return function(_0x3f24e2){if(_0x3f24e2){return _0x3f24e2[_0xd9c6('0x22')](_0x43cd09)[_0xd9c6('0x23')](function(_0x20f887){return _0x20f887;});}return null;};}function removeEntity(_0x4234fe,_0x4e47ee){return function(_0x1f57d0){if(_0x1f57d0){return _0x1f57d0[_0xd9c6('0x24')]()['then'](function(){_0x4234fe[_0xd9c6('0x19')](0xcc)[_0xd9c6('0x1a')]();});}};}function handleEntityNotFound(_0x43cdce,_0x284274){return function(_0x953469){if(!_0x953469){_0x43cdce[_0xd9c6('0x18')](0x194);}return _0x953469;};}function handleError(_0x3c0bb1,_0x5dee27){_0x5dee27=_0x5dee27||0x1f4;return function(_0x5e093f){logger['error'](_0x5e093f[_0xd9c6('0x25')]);if(_0x5e093f[_0xd9c6('0x26')]){delete _0x5e093f['name'];}_0x3c0bb1[_0xd9c6('0x19')](_0x5dee27)[_0xd9c6('0x27')](_0x5e093f);};}exports['index']=function(_0x5d702a,_0x5acb07){var _0x2272df={},_0x36239e={},_0x1cdcd8={'count':0x0,'rows':[]};var _0x10ec78=_['map'](db[_0xd9c6('0x28')]['rawAttributes'],function(_0xec1667){return{'name':_0xec1667[_0xd9c6('0x29')],'type':_0xec1667[_0xd9c6('0x2a')]['key']};});_0x36239e[_0xd9c6('0x2b')]=_[_0xd9c6('0x2c')](_0x10ec78,_0xd9c6('0x26'));_0x36239e[_0xd9c6('0x2d')]=_['keys'](_0x5d702a[_0xd9c6('0x2d')]);_0x36239e[_0xd9c6('0x2e')]=_[_0xd9c6('0x2f')](_0x36239e[_0xd9c6('0x2b')],_0x36239e[_0xd9c6('0x2d')]);_0x2272df[_0xd9c6('0x30')]=_['intersection'](_0x36239e[_0xd9c6('0x2b')],qs[_0xd9c6('0x31')](_0x5d702a[_0xd9c6('0x2d')]['fields']));_0x2272df[_0xd9c6('0x30')]=_0x2272df['attributes']['length']?_0x2272df['attributes']:_0x36239e[_0xd9c6('0x2b')];if(!_0x5d702a[_0xd9c6('0x2d')][_0xd9c6('0x32')](_0xd9c6('0x33'))){_0x2272df[_0xd9c6('0x34')]=qs['limit'](_0x5d702a[_0xd9c6('0x2d')][_0xd9c6('0x34')]);_0x2272df[_0xd9c6('0x1d')]=qs[_0xd9c6('0x1d')](_0x5d702a[_0xd9c6('0x2d')][_0xd9c6('0x1d')]);}_0x2272df[_0xd9c6('0x35')]=qs[_0xd9c6('0x36')](_0x5d702a[_0xd9c6('0x2d')][_0xd9c6('0x36')]);_0x2272df[_0xd9c6('0x37')]=qs[_0xd9c6('0x2e')](_[_0xd9c6('0x38')](_0x5d702a['query'],_0x36239e[_0xd9c6('0x2e')]),_0x10ec78);if(_0x5d702a['query'][_0xd9c6('0x39')]){_0x2272df[_0xd9c6('0x37')]=_[_0xd9c6('0x3a')](_0x2272df[_0xd9c6('0x37')],{'$or':_[_0xd9c6('0x2c')](_0x10ec78,function(_0xfbf116){if(_0xfbf116[_0xd9c6('0x2a')]!==_0xd9c6('0x3b')){var _0x389924={};_0x389924[_0xfbf116[_0xd9c6('0x26')]]={'$like':'%'+_0x5d702a['query'][_0xd9c6('0x39')]+'%'};return _0x389924;}})});}_0x2272df=_[_0xd9c6('0x3a')]({},_0x2272df,_0x5d702a[_0xd9c6('0x3c')]);var _0x84ee7e={'where':_0x2272df[_0xd9c6('0x37')]};return db[_0xd9c6('0x28')]['count'](_0x84ee7e)[_0xd9c6('0x23')](function(_0x324433){_0x1cdcd8[_0xd9c6('0x1c')]=_0x324433;if(_0x5d702a[_0xd9c6('0x2d')]['includeAll']){_0x2272df[_0xd9c6('0x3d')]=[{'all':!![]}];}return db[_0xd9c6('0x28')][_0xd9c6('0x3e')](_0x2272df);})[_0xd9c6('0x23')](function(_0x3389d2){_0x1cdcd8[_0xd9c6('0x3f')]=_0x3389d2;return _0x1cdcd8;})[_0xd9c6('0x23')](respondWithFilteredResult(_0x5acb07,_0x2272df))[_0xd9c6('0x40')](handleError(_0x5acb07,null));};exports[_0xd9c6('0x41')]=function(_0x571a13,_0x5254e1){var _0x1dbf6b={'raw':!![],'where':{'id':_0x571a13[_0xd9c6('0x42')]['id']}},_0x1c837f={};_0x1c837f['model']=_[_0xd9c6('0x43')](db[_0xd9c6('0x28')][_0xd9c6('0x44')]);_0x1c837f[_0xd9c6('0x2d')]=_[_0xd9c6('0x43')](_0x571a13['query']);_0x1c837f[_0xd9c6('0x2e')]=_[_0xd9c6('0x2f')](_0x1c837f[_0xd9c6('0x2b')],_0x1c837f[_0xd9c6('0x2d')]);_0x1dbf6b[_0xd9c6('0x30')]=_[_0xd9c6('0x2f')](_0x1c837f[_0xd9c6('0x2b')],qs['fields'](_0x571a13[_0xd9c6('0x2d')][_0xd9c6('0x31')]));_0x1dbf6b['attributes']=_0x1dbf6b[_0xd9c6('0x30')][_0xd9c6('0x45')]?_0x1dbf6b[_0xd9c6('0x30')]:_0x1c837f['model'];if(_0x571a13['query'][_0xd9c6('0x46')]){_0x1dbf6b[_0xd9c6('0x3d')]=[{'all':!![]}];}_0x1dbf6b=_[_0xd9c6('0x3a')]({},_0x1dbf6b,_0x571a13[_0xd9c6('0x3c')]);return db[_0xd9c6('0x28')]['find'](_0x1dbf6b)[_0xd9c6('0x23')](handleEntityNotFound(_0x5254e1,null))[_0xd9c6('0x23')](respondWithResult(_0x5254e1,null))[_0xd9c6('0x40')](handleError(_0x5254e1,null));};exports[_0xd9c6('0x47')]=function(_0x2b50db,_0x4d3fd0){return db['ChatTransferReport'][_0xd9c6('0x47')](_0x2b50db[_0xd9c6('0x48')],{})['then'](respondWithResult(_0x4d3fd0,0xc9))[_0xd9c6('0x40')](handleError(_0x4d3fd0,null));};exports[_0xd9c6('0x22')]=function(_0x4f4b2d,_0x1a6c18){if(_0x4f4b2d['body']['id']){delete _0x4f4b2d[_0xd9c6('0x48')]['id'];}return db[_0xd9c6('0x28')][_0xd9c6('0x49')]({'where':{'id':_0x4f4b2d[_0xd9c6('0x42')]['id']}})['then'](handleEntityNotFound(_0x1a6c18,null))[_0xd9c6('0x23')](saveUpdates(_0x4f4b2d[_0xd9c6('0x48')],null))[_0xd9c6('0x23')](respondWithResult(_0x1a6c18,null))[_0xd9c6('0x40')](handleError(_0x1a6c18,null));};exports[_0xd9c6('0x24')]=function(_0x4565a9,_0x2eb3fa){return db['ChatTransferReport'][_0xd9c6('0x49')]({'where':{'id':_0x4565a9['params']['id']}})['then'](handleEntityNotFound(_0x2eb3fa,null))['then'](removeEntity(_0x2eb3fa,null))[_0xd9c6('0x40')](handleError(_0x2eb3fa,null));};exports['describe']=function(_0x41c0b3,_0xb9e07d){return db['ChatTransferReport'][_0xd9c6('0x4a')]()[_0xd9c6('0x23')](respondWithResult(_0xb9e07d,null))[_0xd9c6('0x40')](handleError(_0xb9e07d,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index d5937a3..05541a5 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 _0x00bb=['define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./chatTransferReport.attributes'];(function(_0x2b9c0c,_0x4678a3){var _0xd8577b=function(_0x2dd9eb){while(--_0x2dd9eb){_0x2b9c0c['push'](_0x2b9c0c['shift']());}};_0xd8577b(++_0x4678a3);}(_0x00bb,0x1d8));var _0xb00b=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x00bb[_0x33032e];return _0x13316b;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('0xa'),'paranoid':![],'indexes':[{'name':_0xb00b('0xb'),'fields':[_0xb00b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid'];(function(_0x1aa83b,_0x78f627){var _0x3e6dcf=function(_0x4606a3){while(--_0x4606a3){_0x1aa83b['push'](_0x1aa83b['shift']());}};_0x3e6dcf(++_0x78f627);}(_0x008c,0x188));var _0xc008=function(_0x5480fd,_0x46600d){_0x5480fd=_0x5480fd-0x0;var _0x2ec312=_0x008c[_0x5480fd];return _0x2ec312;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('ChatTransferReport',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc008('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 37e3922..dc24bdf 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 _0x66f2=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','ChatTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch'];(function(_0x4cbd4d,_0x172f3e){var _0x4d2f0a=function(_0x59184b){while(--_0x59184b){_0x4cbd4d['push'](_0x4cbd4d['shift']());}};_0x4d2f0a(++_0x172f3e);}(_0x66f2,0x1cc));var _0x266f=function(_0x276468,_0x29685a){_0x276468=_0x276468-0x0;var _0x36dc3a=_0x66f2[_0x276468];return _0x36dc3a;};'use strict';var _=require(_0x266f('0x0'));var util=require(_0x266f('0x1'));var moment=require(_0x266f('0x2'));var BPromise=require(_0x266f('0x3'));var rs=require(_0x266f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x266f('0x5'));var logger=require(_0x266f('0x6'))(_0x266f('0x7'));var config=require(_0x266f('0x8'));var jayson=require(_0x266f('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ebd82,_0xc33adc,_0x13912f){return new BPromise(function(_0x3d66a5,_0xd2cdd3){return client['request'](_0x4ebd82,_0x13912f)['then'](function(_0x21eb52){logger[_0x266f('0xa')](_0x266f('0xb'),_0xc33adc,'request\x20sent');logger[_0x266f('0xc')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0xc33adc,_0x266f('0xd'),JSON[_0x266f('0xe')](_0x21eb52));if(_0x21eb52['error']){if(_0x21eb52['error'][_0x266f('0xf')]===0x1f4){logger['error'](_0x266f('0xb'),_0xc33adc,_0x21eb52[_0x266f('0x10')][_0x266f('0x11')]);return _0xd2cdd3(_0x21eb52[_0x266f('0x10')][_0x266f('0x11')]);}logger[_0x266f('0x10')](_0x266f('0xb'),_0xc33adc,_0x21eb52[_0x266f('0x10')][_0x266f('0x11')]);return _0x3d66a5(_0x21eb52[_0x266f('0x10')]['message']);}else{logger[_0x266f('0xa')]('ChatTransferReport,\x20%s,\x20%s',_0xc33adc,_0x266f('0xd'));_0x3d66a5(_0x21eb52[_0x266f('0x12')][_0x266f('0x11')]);}})[_0x266f('0x13')](function(_0x5ceef6){logger[_0x266f('0x10')](_0x266f('0xb'),_0xc33adc,_0x5ceef6);_0xd2cdd3(_0x5ceef6);});});} \ No newline at end of file +var _0x6bb4=['then','ChatTransferReport,\x20%s,\x20%s','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6bb4,0x77));var _0x46bb=function(_0x56deed,_0x276cc2){_0x56deed=_0x56deed-0x0;var _0x48d933=_0x6bb4[_0x56deed];return _0x48d933;};'use strict';var _=require(_0x46bb('0x0'));var util=require(_0x46bb('0x1'));var moment=require(_0x46bb('0x2'));var BPromise=require(_0x46bb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46bb('0x4'));var db=require(_0x46bb('0x5'))['db'];var utils=require(_0x46bb('0x6'));var logger=require(_0x46bb('0x7'))(_0x46bb('0x8'));var config=require(_0x46bb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46bb('0xa')][_0x46bb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b5508,_0x5a4228,_0x421df1){return new BPromise(function(_0x5c76a2,_0x4e4d5f){return client[_0x46bb('0xc')](_0x5b5508,_0x421df1)[_0x46bb('0xd')](function(_0x30d2e6){logger['info'](_0x46bb('0xe'),_0x5a4228,'request\x20sent');logger['debug'](_0x46bb('0xf'),_0x5a4228,_0x46bb('0x10'),JSON[_0x46bb('0x11')](_0x30d2e6));if(_0x30d2e6['error']){if(_0x30d2e6['error']['code']===0x1f4){logger[_0x46bb('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x5a4228,_0x30d2e6['error'][_0x46bb('0x13')]);return _0x4e4d5f(_0x30d2e6[_0x46bb('0x12')][_0x46bb('0x13')]);}logger[_0x46bb('0x12')](_0x46bb('0xe'),_0x5a4228,_0x30d2e6[_0x46bb('0x12')][_0x46bb('0x13')]);return _0x5c76a2(_0x30d2e6[_0x46bb('0x12')][_0x46bb('0x13')]);}else{logger[_0x46bb('0x14')](_0x46bb('0xe'),_0x5a4228,'request\x20sent');_0x5c76a2(_0x30d2e6['result']['message']);}})[_0x46bb('0x15')](function(_0x13ae57){logger[_0x46bb('0x12')](_0x46bb('0xe'),_0x5a4228,_0x13ae57);_0x4e4d5f(_0x13ae57);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 2ab0fcf..4d8d1bb 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 _0x757a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','util','path'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0x757a,0xde));var _0xa757=function(_0x44d260,_0x474cca){_0x44d260=_0x44d260-0x0;var _0x54547e=_0x757a[_0x44d260];return _0x54547e;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0xa757('0x2'));var interaction=require(_0xa757('0x3'));var config=require(_0xa757('0x4'));var controller=require(_0xa757('0x5'));router[_0xa757('0x6')]('/',auth[_0xa757('0x7')](),controller['index']);router[_0xa757('0x6')](_0xa757('0x8'),auth['isAuthenticated'](),controller[_0xa757('0x9')]);router[_0xa757('0x6')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xb')]);router['post']('/',auth[_0xa757('0x7')](),controller[_0xa757('0xc')]);router[_0xa757('0xd')](_0xa757('0xa'),auth[_0xa757('0x7')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x474e31,_0xeb809d){var _0x5d38a6=function(_0x8caf5e){while(--_0x8caf5e){_0x474e31['push'](_0x474e31['shift']());}};_0x5d38a6(++_0xeb809d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x27e6c4,_0x5c26dd){_0x27e6c4=_0x27e6c4-0x0;var _0x33011c=_0x5f2f[_0x27e6c4];return _0x33011c;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 07058cc..9ffff12 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 _0xa7e6=['ENUM','star','thumb','stringify','name','text','getDataValue','parse','setDataValue','onlineForm','textarea','Comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','bottom_right','#fafafa','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','squared','rounded','We\x20are\x20here!','Send','BOOLEAN','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','Feedback'];(function(_0x2c1aee,_0x1a494f){var _0x5e3b51=function(_0x4f3703){while(--_0x4f3703){_0x2c1aee['push'](_0x2c1aee['shift']());}};_0x5e3b51(++_0x1a494f);}(_0xa7e6,0x74));var _0x6a7e=function(_0x211c72,_0x22b9c8){_0x211c72=_0x211c72-0x0;var _0x230d74=_0xa7e6[_0x211c72];return _0x230d74;};'use strict';var Sequelize=require(_0x6a7e('0x0'));var rs=require(_0x6a7e('0x1'));module[_0x6a7e('0x2')]={'name':{'type':Sequelize[_0x6a7e('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x6a7e('0x3')],'allowNull':![],'unique':_0x6a7e('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x6a7e('0x3')],'defaultValue':_0x6a7e('0x5')},'mapKeyOffline':{'type':Sequelize[_0x6a7e('0x3')],'defaultValue':_0x6a7e('0x5')},'key':{'type':Sequelize[_0x6a7e('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x6a7e('0x6')},'customerAlias':{'type':Sequelize[_0x6a7e('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6a7e('0x3')],'allowNull':![],'defaultValue':_0x6a7e('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x6a7e('0x3')],'allowNull':![],'defaultValue':_0x6a7e('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6a7e('0x3')],'allowNull':![],'defaultValue':_0x6a7e('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x6a7e('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0x6a7e('0xa')),'defaultValue':_0x6a7e('0xb')},'header_online':{'type':Sequelize[_0x6a7e('0x3')],'defaultValue':_0x6a7e('0xc')},'start_chat_button':{'type':Sequelize[_0x6a7e('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x6a7e('0x3')],'defaultValue':_0x6a7e('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x6a7e('0xe')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x6a7e('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x6a7e('0x3')],'defaultValue':_0x6a7e('0xf')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x6a7e('0x10')]},'closingQuestion':{'type':Sequelize[_0x6a7e('0x3')],'defaultValue':_0x6a7e('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x6a7e('0x3')],'defaultValue':_0x6a7e('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6a7e('0x13')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x6a7e('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x6a7e('0x3')],'defaultValue':_0x6a7e('0x14')},'closingMessageButton':{'type':Sequelize[_0x6a7e('0x3')],'defaultValue':_0x6a7e('0xd')},'skipMessageButton':{'type':Sequelize[_0x6a7e('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6a7e('0xe')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x6a7e('0xe')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x6a7e('0x3')],'defaultValue':_0x6a7e('0x15')},'ratingType':{'type':Sequelize[_0x6a7e('0x16')](_0x6a7e('0x17'),_0x6a7e('0x18')),'defaultValue':_0x6a7e('0x17')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6a7e('0x10')],'defaultValue':function(){return JSON[_0x6a7e('0x19')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x6a7e('0x1a'),'type':_0x6a7e('0x1b'),'required':!![]},'props':{'title':_0x6a7e('0x1a'),'helpText':''}},{'type':'input','props':{'title':_0x6a7e('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x6a7e('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x6a7e('0x1c')]('onlineForm')?JSON[_0x6a7e('0x1d')](this[_0x6a7e('0x1c')]('onlineForm')):{};},'set':function(_0x29db13){return this[_0x6a7e('0x1e')](_0x6a7e('0x1f'),JSON[_0x6a7e('0x19')](_0x29db13));}},'offlineForm':{'type':Sequelize[_0x6a7e('0x10')],'defaultValue':function(){return JSON[_0x6a7e('0x19')]({'items':[{'type':'input','props':{'title':_0x6a7e('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x6a7e('0x5'),'type':_0x6a7e('0x5')},'variable':null},{'type':_0x6a7e('0x20'),'config':{'placeholder':_0x6a7e('0x21')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x6a7e('0x1c')](_0x6a7e('0x22'))?JSON[_0x6a7e('0x1d')](this['getDataValue'](_0x6a7e('0x22'))):{};},'set':function(_0x57e642){return this[_0x6a7e('0x1e')]('offlineForm',JSON['stringify'](_0x57e642));}},'token':{'type':Sequelize[_0x6a7e('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x6a7e('0xe')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x6a7e('0x3')]},'forwardOffline':{'type':Sequelize[_0x6a7e('0xe')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x6a7e('0x3')]},'waitingTitle':{'type':Sequelize[_0x6a7e('0x3')],'defaultValue':_0x6a7e('0x23')},'waitingMessage':{'type':Sequelize[_0x6a7e('0x3')],'defaultValue':_0x6a7e('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x6a7e('0x3')],'defaultValue':_0x6a7e('0x25')},'offlineMessageBody':{'type':Sequelize[_0x6a7e('0x3')],'defaultValue':_0x6a7e('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x6a7e('0xe')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6a7e('0x27')},'skipUnmanaged':{'type':Sequelize[_0x6a7e('0x3')],'defaultValue':_0x6a7e('0x28')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x6a7e('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x6a7e('0xe')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x6a7e('0xe')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x6a7e('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x6a7e('0xe')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x6a7e('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x6a7e('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x6a7e('0xe')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x6a7e('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x6a7e('0x29')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x6a7e('0x10')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6a7e('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x6a7e('0x3')],'allowNull':![],'defaultValue':_0x6a7e('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x6a7e('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6a7e('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6a7e('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x6a7e('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0x6a7e('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6a7e('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x6a7e('0xe')],'defaultValue':![],'comment':_0x6a7e('0x2b'),'set':function(_0x34b0ef){if(!_0x34b0ef)this[_0x6a7e('0x1e')](_0x6a7e('0x2c'),null);this[_0x6a7e('0x1e')](_0x6a7e('0x2d'),_0x34b0ef);}},'vidaooEscalation':{'type':Sequelize[_0x6a7e('0xe')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x6a7e('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x2873=['squared','We\x20are\x20here!','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','parse','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','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}}','website_alias','bottom_right','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded'];(function(_0x155751,_0x31c85d){var _0x126e7b=function(_0x491a1a){while(--_0x491a1a){_0x155751['push'](_0x155751['shift']());}};_0x126e7b(++_0x31c85d);}(_0x2873,0x1f2));var _0x3287=function(_0x3aeea0,_0x1dd1fd){_0x3aeea0=_0x3aeea0-0x0;var _0x6bab4d=_0x2873[_0x3aeea0];return _0x6bab4d;};'use strict';var Sequelize=require(_0x3287('0x0'));var rs=require(_0x3287('0x1'));module[_0x3287('0x2')]={'name':{'type':Sequelize[_0x3287('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3287('0x4')},'description':{'type':Sequelize[_0x3287('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x3287('0x5')},'mapKeyOffline':{'type':Sequelize[_0x3287('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x3287('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x3287('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x3287('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3287('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x3287('0x3')],'allowNull':![],'defaultValue':_0x3287('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x3287('0x3')],'allowNull':![],'defaultValue':_0x3287('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x3287('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x3287('0x3')]},'animation':{'type':Sequelize[_0x3287('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x3287('0xa')](_0x3287('0xb'),_0x3287('0xc')),'defaultValue':_0x3287('0xb')},'header_online':{'type':Sequelize[_0x3287('0x3')],'defaultValue':_0x3287('0xd')},'start_chat_button':{'type':Sequelize[_0x3287('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x3287('0xe')},'header_offline':{'type':Sequelize[_0x3287('0x3')],'defaultValue':_0x3287('0xf')},'download_transcript':{'type':Sequelize[_0x3287('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x3287('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x3287('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x3287('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x3287('0x11')]},'closingQuestion':{'type':Sequelize[_0x3287('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x3287('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x3287('0x3')],'defaultValue':_0x3287('0x12')},'noteTitle':{'type':Sequelize[_0x3287('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x3287('0x3')],'defaultValue':_0x3287('0x13')},'closingMessage':{'type':Sequelize[_0x3287('0x3')],'defaultValue':_0x3287('0x14')},'closingMessageButton':{'type':Sequelize[_0x3287('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x3287('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x3287('0x16')},'ratingType':{'type':Sequelize[_0x3287('0xa')](_0x3287('0x17'),_0x3287('0x18')),'defaultValue':_0x3287('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x3287('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x3287('0x11')],'defaultValue':function(){return JSON[_0x3287('0x19')]({'items':[{'type':_0x3287('0x1a'),'variable':null,'config':{'placeholder':_0x3287('0x1b'),'type':_0x3287('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':_0x3287('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x3287('0x5'),'type':_0x3287('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x3287('0x1d')](_0x3287('0x1e'))?JSON['parse'](this[_0x3287('0x1d')](_0x3287('0x1e'))):{};},'set':function(_0x1955c6){return this[_0x3287('0x1f')](_0x3287('0x1e'),JSON[_0x3287('0x19')](_0x1955c6));}},'offlineForm':{'type':Sequelize[_0x3287('0x11')],'defaultValue':function(){return JSON[_0x3287('0x19')]({'items':[{'type':'input','props':{'title':_0x3287('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x3287('0x5'),'type':'email'},'variable':null},{'type':_0x3287('0x20'),'config':{'placeholder':_0x3287('0x21')},'props':{'title':_0x3287('0x21'),'helpText':_0x3287('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x3287('0x1d')]('offlineForm')?JSON[_0x3287('0x23')](this[_0x3287('0x1d')]('offlineForm')):{};},'set':function(_0x32ef52){return this[_0x3287('0x1f')](_0x3287('0x24'),JSON[_0x3287('0x19')](_0x32ef52));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x3287('0x25')]();}},'autoclose':{'type':Sequelize[_0x3287('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x3287('0x3')]},'waitingTitle':{'type':Sequelize[_0x3287('0x3')],'defaultValue':_0x3287('0x26')},'waitingMessage':{'type':Sequelize[_0x3287('0x3')],'defaultValue':_0x3287('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x3287('0x3')],'defaultValue':_0x3287('0x28')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x3287('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x3287('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x3287('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x3287('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x3287('0x3')],'defaultValue':_0x3287('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x3287('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x3287('0x3')]},'notificationTemplate':{'type':Sequelize[_0x3287('0x11')],'defaultValue':function(){return _0x3287('0x2a');}},'notificationSound':{'type':Sequelize[_0x3287('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x3287('0x3')],'defaultValue':_0x3287('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x3287('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x3287('0x3')],'defaultValue':_0x3287('0x2c')},'verticalAlignment':{'type':Sequelize[_0x3287('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x3287('0x2d')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x3287('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x3287('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x3287('0x3')],'allowNull':![],'defaultValue':_0x3287('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3287('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3287('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x3287('0x3')],'defaultValue':_0x3287('0x2f')},'systemAvatar':{'type':Sequelize[_0x3287('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![],'comment':_0x3287('0x30'),'set':function(_0x482bfd){if(!_0x482bfd)this[_0x3287('0x1f')](_0x3287('0x31'),null);this[_0x3287('0x1f')](_0x3287('0x32'),_0x482bfd);}},'vidaooEscalation':{'type':Sequelize[_0x3287('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index dfdec8b..fb0942c 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 _0x044c=['squel','jsforce','desk.js','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','apply','save','update','destroy','get','ChatWebsites','UserProfileResource','end','name','send','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','ChatWebsite','includeAll','findAll','show','params','Pause','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','findOne','hasOwnProperty','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','root','../../config/license/util','getLicense','custom','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','CmContact','no\x20available\x20attributes','difference','updatedAt','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','ChatApplication','account','applications','list','orderBy','priority','asc','Applications','defaults','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','contact','lastName','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','EventManager','createdAt','CompanyId','from\x20is\x20mandatory','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','CmList','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','offlineMessageBody','ChatOfflineMessage','MailAccount','Smtp','forwardOfflineAddress','service','host','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','getInteractions','Owner','internal','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','License','chatLicenseExceeded','all','some','utf8','remote','x-real-ip','referer','replace','render','textColor','sequelize','bulkCreate','findAndCountAll','getApplications','chatProactiveAction','ChatProactiveAction','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs'];(function(_0x2c0142,_0x7ad665){var _0x292393=function(_0x266ee8){while(--_0x266ee8){_0x2c0142['push'](_0x2c0142['shift']());}};_0x292393(++_0x7ad665);}(_0x044c,0x109));var _0xc044=function(_0x1aaee5,_0x24d737){_0x1aaee5=_0x1aaee5-0x0;var _0x1985a2=_0x044c[_0x1aaee5];return _0x1985a2;};'use strict';var pdf=require(_0xc044('0x0'));var emlformat=require(_0xc044('0x1'));var rimraf=require(_0xc044('0x2'));var zipdir=require(_0xc044('0x3'));var jsonpatch=require(_0xc044('0x4'));var rp=require('request-promise');var moment=require(_0xc044('0x5'));var BPromise=require(_0xc044('0x6'));var Mustache=require(_0xc044('0x7'));var util=require(_0xc044('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xc044('0x9'));var ejs=require(_0xc044('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc044('0xb'));var crypto=require('crypto');var jsforce=require(_0xc044('0xc'));var deskjs=require(_0xc044('0xd'));var toCsv=require(_0xc044('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc044('0xe'));var logger=require(_0xc044('0xf'))(_0xc044('0x10'));var utils=require('../../config/utils');var config=require(_0xc044('0x11'));var db=require('../../mysqldb')['db'];config[_0xc044('0x12')]=_['defaults'](config[_0xc044('0x12')],{'host':_0xc044('0x13'),'port':0x18eb});var socket=require(_0xc044('0x14'))(new Redis(config[_0xc044('0x12')]));require('./chatWebsite.socket')[_0xc044('0x15')](socket);var jayson=require(_0xc044('0x16'));var client=jayson[_0xc044('0x17')][_0xc044('0x18')]({'port':0x232c});var client9002=jayson[_0xc044('0x17')][_0xc044('0x18')]({'port':0x232a});var client9003=jayson[_0xc044('0x17')]['http']({'port':0x232b});function checkPasswordPattern(_0xaf1170,_0x3649ff,_0x982b98){if(_0x982b98){var _0x384da9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x384da9[_0xc044('0x19')](_0x3649ff)){return _0xaf1170;}else{throw new db[(_0xc044('0x1a'))][(_0xc044('0x1b'))](_0xc044('0x1c'));}}else{return _0xaf1170;}}function respondWithRpcPromise(_0x115d5c,_0x2f1764,_0x25b106,_0x704485){return new BPromise(function(_0x4f84f6,_0x1ad686){var _0x286f89=_0x704485||client;return _0x286f89[_0xc044('0x1d')](_0x115d5c,_0x25b106)[_0xc044('0x1e')](function(_0x4108f1){logger[_0xc044('0x1f')](_0xc044('0x20'),_0x2f1764,_0xc044('0x21'));logger[_0xc044('0x22')](_0xc044('0x23'),_0x2f1764,'request\x20sent',JSON[_0xc044('0x24')](_0x4108f1));if(_0x4108f1[_0xc044('0x25')]){if(_0x4108f1[_0xc044('0x25')][_0xc044('0x26')]===0x1f4){logger[_0xc044('0x25')](_0xc044('0x20'),_0x2f1764,_0x4108f1['error'][_0xc044('0x27')]);return _0x1ad686(_0x4108f1['error'][_0xc044('0x27')]);}logger[_0xc044('0x25')](_0xc044('0x20'),_0x2f1764,_0x4108f1[_0xc044('0x25')][_0xc044('0x27')]);return _0x4f84f6(_0x4108f1[_0xc044('0x25')]['message']);}else{logger[_0xc044('0x1f')](_0xc044('0x20'),_0x2f1764,_0xc044('0x21'));_0x4f84f6(_0x4108f1[_0xc044('0x28')][_0xc044('0x27')]);}})[_0xc044('0x29')](function(_0x50ce44){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x2f1764,_0x50ce44);_0x1ad686(_0x50ce44);});});}function respondWithStatusCode(_0x56790e,_0x28899c){_0x28899c=_0x28899c||0xcc;return function(_0x2e9260){if(_0x2e9260){return _0x56790e[_0xc044('0x2a')](_0x28899c);}return _0x56790e['status'](_0x28899c)['end']();};}function respondWithResult(_0xde2cfc,_0x232615){_0x232615=_0x232615||0xc8;return function(_0x3ad0d){if(_0x3ad0d){return _0xde2cfc[_0xc044('0x2b')](_0x232615)['json'](_0x3ad0d);}};}function respondWithFilteredResult(_0x2ccc7a,_0x5afea4){return function(_0x477266){if(_0x477266){var _0x2621a2=_0x477266[_0xc044('0x2c')],_0x225165=_0x5afea4['offset'],_0x364fac=_0x5afea4[_0xc044('0x2d')]+_0x5afea4[_0xc044('0x2e')],_0x2c75f8;if(_0x364fac>=_0x2621a2){_0x364fac=_0x2621a2;_0x2c75f8=0xc8;}else{_0x2c75f8=0xce;}_0x2ccc7a['status'](_0x2c75f8);return _0x2ccc7a[_0xc044('0x2f')](_0xc044('0x30'),_0x225165+'-'+_0x364fac+'/'+_0x2621a2)['json'](_0x477266);}return null;};}function patchUpdates(_0x41d0b2){return function(_0x4d41c0){try{jsonpatch[_0xc044('0x31')](_0x4d41c0,_0x41d0b2,!![]);}catch(_0xfcb740){return BPromise['reject'](_0xfcb740);}return _0x4d41c0[_0xc044('0x32')]();};}function saveUpdates(_0x5185a3,_0x2f9e8b){return function(_0x352c5f){if(_0x352c5f){return _0x352c5f[_0xc044('0x33')](_0x5185a3)[_0xc044('0x1e')](function(_0xe4304f){return _0xe4304f;});}return null;};}function removeEntity(_0x577495,_0x1e6e1c){return function(_0x214a30){if(_0x214a30){return _0x214a30[_0xc044('0x34')]()[_0xc044('0x1e')](function(){var _0x2f43d8=_0x214a30[_0xc044('0x35')]({'plain':!![]});var _0x2b9a11=_0xc044('0x36');return db[_0xc044('0x37')][_0xc044('0x34')]({'where':{'type':_0x2b9a11,'resourceId':_0x2f43d8['id']}})[_0xc044('0x1e')](function(){return _0x214a30;});})[_0xc044('0x1e')](function(){_0x577495['status'](0xcc)[_0xc044('0x38')]();});}};}function handleEntityNotFound(_0x179597,_0x3792c5){return function(_0x5dafb7){if(!_0x5dafb7){_0x179597[_0xc044('0x2a')](0x194);}return _0x5dafb7;};}function handleError(_0x9d8f0d,_0x1b7fba){_0x1b7fba=_0x1b7fba||0x1f4;return function(_0x516e9e){logger[_0xc044('0x25')](_0x516e9e['stack']);if(_0x516e9e[_0xc044('0x39')]){delete _0x516e9e[_0xc044('0x39')];}_0x9d8f0d[_0xc044('0x2b')](_0x1b7fba)[_0xc044('0x3a')](_0x516e9e);};}exports['index']=function(_0x2b0392,_0x27d9f9){var _0x571052={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x55b336={},_0x4ff932={'count':0x0,'rows':[]};var _0x22a8c3=_['map'](db['ChatWebsite'][_0xc044('0x3b')],function(_0x13565c){return{'name':_0x13565c['fieldName'],'type':_0x13565c['type'][_0xc044('0x3c')]};});_0x55b336[_0xc044('0x3d')]=_[_0xc044('0x3e')](_0x22a8c3,_0xc044('0x39'));_0x55b336[_0xc044('0x3f')]=_[_0xc044('0x40')](_0x2b0392[_0xc044('0x3f')]);_0x55b336[_0xc044('0x41')]=_[_0xc044('0x42')](_0x55b336[_0xc044('0x3d')],_0x55b336['query']);_0x571052[_0xc044('0x43')]=_[_0xc044('0x42')](_0x55b336[_0xc044('0x3d')],qs[_0xc044('0x44')](_0x2b0392[_0xc044('0x3f')]['fields']));_0x571052['attributes']=_0x571052[_0xc044('0x43')][_0xc044('0x45')]?_0x571052['attributes']:_0x55b336['model'];if(!_0x2b0392[_0xc044('0x3f')]['hasOwnProperty'](_0xc044('0x46'))){_0x571052[_0xc044('0x2e')]=qs[_0xc044('0x2e')](_0x2b0392[_0xc044('0x3f')][_0xc044('0x2e')]);_0x571052[_0xc044('0x2d')]=qs['offset'](_0x2b0392[_0xc044('0x3f')][_0xc044('0x2d')]);}_0x571052[_0xc044('0x47')]=qs[_0xc044('0x48')](_0x2b0392[_0xc044('0x3f')][_0xc044('0x48')]);_0x571052['where']=qs['filters'](_[_0xc044('0x49')](_0x2b0392[_0xc044('0x3f')],_0x55b336['filters']),_0x22a8c3);if(_0x2b0392['query'][_0xc044('0x4a')]){_0x571052['where']=_[_0xc044('0x4b')](_0x571052[_0xc044('0x4c')],{'$or':_[_0xc044('0x3e')](_0x22a8c3,function(_0xe0188f){if(_0xe0188f[_0xc044('0x4d')]!==_0xc044('0x4e')){var _0xe4f8c4={};_0xe4f8c4[_0xe0188f[_0xc044('0x39')]]={'$like':'%'+_0x2b0392['query'][_0xc044('0x4a')]+'%'};return _0xe4f8c4;}})});}_0x571052=_[_0xc044('0x4b')]({},_0x571052,_0x2b0392[_0xc044('0x4f')]);var _0x2b4967={'where':_0x571052[_0xc044('0x4c')]};return db[_0xc044('0x50')]['count'](_0x2b4967)[_0xc044('0x1e')](function(_0x32df94){_0x4ff932[_0xc044('0x2c')]=_0x32df94;if(_0x2b0392[_0xc044('0x3f')][_0xc044('0x51')]){_0x571052['include']=[{'all':!![]}];}return db['ChatWebsite'][_0xc044('0x52')](_0x571052);})['then'](function(_0x58efb5){_0x4ff932['rows']=_0x58efb5;return _0x4ff932;})[_0xc044('0x1e')](respondWithFilteredResult(_0x27d9f9,_0x571052))[_0xc044('0x29')](handleError(_0x27d9f9,null));};exports[_0xc044('0x53')]=function(_0x1c1de4,_0x347790){var _0x374821={'raw':![],'where':{'id':_0x1c1de4[_0xc044('0x54')]['id']},'include':[{'model':db[_0xc044('0x55')],'as':'mandatoryDispositionPause'}]},_0x2c17e4={};_0x2c17e4[_0xc044('0x3d')]=_[_0xc044('0x40')](db[_0xc044('0x50')][_0xc044('0x3b')]);_0x2c17e4[_0xc044('0x3f')]=_[_0xc044('0x40')](_0x1c1de4[_0xc044('0x3f')]);_0x2c17e4[_0xc044('0x41')]=_[_0xc044('0x42')](_0x2c17e4[_0xc044('0x3d')],_0x2c17e4[_0xc044('0x3f')]);_0x374821['attributes']=_[_0xc044('0x42')](_0x2c17e4[_0xc044('0x3d')],qs[_0xc044('0x44')](_0x1c1de4[_0xc044('0x3f')][_0xc044('0x44')]));_0x374821[_0xc044('0x43')]=_0x374821[_0xc044('0x43')]['length']?_0x374821[_0xc044('0x43')]:_0x2c17e4[_0xc044('0x3d')];if(_0x1c1de4[_0xc044('0x3f')][_0xc044('0x51')]){_0x374821[_0xc044('0x56')]=[{'all':!![]}];}_0x374821=_[_0xc044('0x4b')]({},_0x374821,_0x1c1de4[_0xc044('0x4f')]);return db[_0xc044('0x50')][_0xc044('0x57')](_0x374821)[_0xc044('0x1e')](handleEntityNotFound(_0x347790,null))[_0xc044('0x1e')](respondWithResult(_0x347790,null))[_0xc044('0x29')](handleError(_0x347790,null));};exports[_0xc044('0x58')]=function(_0x120ff4,_0x3a52c7){return db[_0xc044('0x50')][_0xc044('0x58')](_0x120ff4[_0xc044('0x59')],{})[_0xc044('0x1e')](function(_0x143421){var _0x531dbd=_0x120ff4[_0xc044('0x5a')][_0xc044('0x35')]({'plain':!![]});if(!_0x531dbd)throw new Error(_0xc044('0x5b'));if(_0x531dbd[_0xc044('0x5c')]===_0xc044('0x5a')){var _0x28c5dc=_0x143421['get']({'plain':!![]});var _0xc1e46e=_0xc044('0x36');return db[_0xc044('0x5d')][_0xc044('0x57')]({'where':{'name':_0xc1e46e,'userProfileId':_0x531dbd[_0xc044('0x5e')]},'raw':!![]})[_0xc044('0x1e')](function(_0x8528da){if(_0x8528da&&_0x8528da[_0xc044('0x5f')]===0x0){return db[_0xc044('0x37')][_0xc044('0x58')]({'name':_0x28c5dc[_0xc044('0x39')],'resourceId':_0x28c5dc['id'],'type':_0x8528da[_0xc044('0x39')],'sectionId':_0x8528da['id']},{})[_0xc044('0x1e')](function(){return _0x143421;});}else{return _0x143421;}})[_0xc044('0x29')](function(_0x1e9b53){logger['error'](_0xc044('0x60'),_0x1e9b53);throw _0x1e9b53;});}return _0x143421;})['then'](respondWithResult(_0x3a52c7,0xc9))[_0xc044('0x29')](handleError(_0x3a52c7,null));};exports[_0xc044('0x33')]=function(_0x22c51f,_0x2fb961){if(_0x22c51f[_0xc044('0x59')]['id']){delete _0x22c51f[_0xc044('0x59')]['id'];}return db[_0xc044('0x50')][_0xc044('0x57')]({'where':{'id':_0x22c51f[_0xc044('0x54')]['id']},'include':[{'model':db[_0xc044('0x55')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x2fb961,null))[_0xc044('0x1e')](saveUpdates(_0x22c51f[_0xc044('0x59')],null))[_0xc044('0x1e')](respondWithResult(_0x2fb961,null))['catch'](handleError(_0x2fb961,null));};exports[_0xc044('0x34')]=function(_0x45270c,_0x2fd1c0){return db[_0xc044('0x50')]['find']({'where':{'id':_0x45270c[_0xc044('0x54')]['id']}})[_0xc044('0x1e')](handleEntityNotFound(_0x2fd1c0,null))[_0xc044('0x1e')](removeEntity(_0x2fd1c0,null))[_0xc044('0x29')](handleError(_0x2fd1c0,null));};exports[_0xc044('0x61')]=function(_0x3c17fa,_0x597e0c){return db[_0xc044('0x50')][_0xc044('0x61')]()[_0xc044('0x1e')](respondWithResult(_0x597e0c,null))[_0xc044('0x29')](handleError(_0x597e0c,null));};exports[_0xc044('0x62')]=function(_0x41ab96,_0x3f9698,_0x4936ad){if(_0x41ab96[_0xc044('0x59')]['id']){delete _0x41ab96[_0xc044('0x59')]['id'];}return db['ChatWebsite'][_0xc044('0x57')]({'where':{'id':_0x41ab96['params']['id']}})[_0xc044('0x1e')](handleEntityNotFound(_0x3f9698,null))[_0xc044('0x1e')](function(_0x4ebc86){if(_0x4ebc86){_0x41ab96[_0xc044('0x59')][_0xc044('0x63')]=_0x4ebc86['id'];return db[_0xc044('0x64')][_0xc044('0x58')](_0x41ab96[_0xc044('0x59')]);}})[_0xc044('0x1e')](respondWithResult(_0x3f9698,null))[_0xc044('0x29')](handleError(_0x3f9698,null));};exports['getDispositions']=function(_0x5533b9,_0xc03574,_0x398182){var _0x21ed22={'raw':![],'where':{}};var _0x4055d1={};var _0x39a66b={'count':0x0,'rows':[]};return db[_0xc044('0x50')][_0xc044('0x65')]({'where':{'id':_0x5533b9[_0xc044('0x54')]['id']}})[_0xc044('0x1e')](handleEntityNotFound(_0xc03574,null))[_0xc044('0x1e')](function(_0x1225e9){if(_0x1225e9){_0x4055d1[_0xc044('0x3d')]=_[_0xc044('0x40')](db[_0xc044('0x64')][_0xc044('0x3b')]);_0x4055d1[_0xc044('0x3f')]=_[_0xc044('0x40')](_0x5533b9[_0xc044('0x3f')]);_0x4055d1[_0xc044('0x41')]=_['intersection'](_0x4055d1['model'],_0x4055d1[_0xc044('0x3f')]);_0x21ed22[_0xc044('0x43')]=_[_0xc044('0x42')](_0x4055d1[_0xc044('0x3d')],qs[_0xc044('0x44')](_0x5533b9[_0xc044('0x3f')]['fields']));_0x21ed22[_0xc044('0x43')]=_0x21ed22[_0xc044('0x43')][_0xc044('0x45')]?_0x21ed22[_0xc044('0x43')]:_0x4055d1[_0xc044('0x3d')];if(!_0x5533b9[_0xc044('0x3f')][_0xc044('0x66')](_0xc044('0x46'))){_0x21ed22['limit']=qs[_0xc044('0x2e')](_0x5533b9[_0xc044('0x3f')]['limit']);_0x21ed22['offset']=qs[_0xc044('0x2d')](_0x5533b9['query'][_0xc044('0x2d')]);}_0x21ed22[_0xc044('0x47')]=qs['sort'](_0x5533b9['query'][_0xc044('0x48')]);_0x21ed22[_0xc044('0x4c')]=qs[_0xc044('0x41')](_[_0xc044('0x49')](_0x5533b9[_0xc044('0x3f')],_0x4055d1[_0xc044('0x41')]));_0x21ed22[_0xc044('0x4c')][_0xc044('0x63')]=_0x1225e9['id'];if(_0x5533b9[_0xc044('0x3f')][_0xc044('0x4a')]){_0x21ed22['where']=_[_0xc044('0x4b')](_0x21ed22[_0xc044('0x4c')],{'$or':_[_0xc044('0x3e')](_0x21ed22[_0xc044('0x43')],function(_0xc08368){var _0x5a7575={};_0x5a7575[_0xc08368]={'$like':'%'+_0x5533b9[_0xc044('0x3f')][_0xc044('0x4a')]+'%'};return _0x5a7575;})});}_0x21ed22=_[_0xc044('0x4b')]({},_0x21ed22,_0x5533b9[_0xc044('0x4f')]);return db[_0xc044('0x64')][_0xc044('0x2c')]({'where':_0x21ed22['where']})[_0xc044('0x1e')](function(_0x4043b1){_0x39a66b[_0xc044('0x2c')]=_0x4043b1;if(_0x5533b9[_0xc044('0x3f')]['includeAll']){_0x21ed22[_0xc044('0x56')]=[{'all':!![]}];}return db[_0xc044('0x64')][_0xc044('0x52')](_0x21ed22);})[_0xc044('0x1e')](function(_0x5eaa3c){_0x39a66b[_0xc044('0x67')]=_0x5eaa3c;return _0x39a66b;});}})['then'](respondWithFilteredResult(_0xc03574,_0x21ed22))[_0xc044('0x29')](handleError(_0xc03574,null));};exports[_0xc044('0x68')]=function(_0x26db01,_0x1ca411,_0x3c8529){return db[_0xc044('0x50')][_0xc044('0x57')]({'where':{'id':_0x26db01[_0xc044('0x54')]['id']}})[_0xc044('0x1e')](handleEntityNotFound(_0x1ca411,null))[_0xc044('0x1e')](function(_0x2a2d82){if(_0x2a2d82){return _0x2a2d82[_0xc044('0x68')](_0x26db01[_0xc044('0x3f')]['ids']);}})[_0xc044('0x1e')](respondWithStatusCode(_0x1ca411,null))['catch'](handleError(_0x1ca411,null));};exports[_0xc044('0x69')]=function(_0x2b25d5,_0xaa4194,_0x4d2feb){if(_0x2b25d5[_0xc044('0x59')]['id']){delete _0x2b25d5[_0xc044('0x59')]['id'];}return db[_0xc044('0x50')][_0xc044('0x57')]({'where':{'id':_0x2b25d5[_0xc044('0x54')]['id']}})['then'](handleEntityNotFound(_0xaa4194,null))['then'](function(_0x290fc3){if(_0x290fc3){_0x2b25d5[_0xc044('0x59')][_0xc044('0x63')]=_0x290fc3['id'];return db[_0xc044('0x6a')]['create'](_0x2b25d5[_0xc044('0x59')]);}})['then'](respondWithResult(_0xaa4194,null))[_0xc044('0x29')](handleError(_0xaa4194,null));};exports[_0xc044('0x6b')]=function(_0x2b23d1,_0xb40bc2,_0x1e9d89){var _0x36a092={'raw':![],'where':{}};var _0x410825={};var _0x1bf287={'count':0x0,'rows':[]};return db[_0xc044('0x50')]['findOne']({'where':{'id':_0x2b23d1['params']['id']}})[_0xc044('0x1e')](handleEntityNotFound(_0xb40bc2,null))[_0xc044('0x1e')](function(_0x37a47d){if(_0x37a47d){_0x410825['model']=_['keys'](db['CannedAnswer'][_0xc044('0x3b')]);_0x410825[_0xc044('0x3f')]=_['keys'](_0x2b23d1['query']);_0x410825[_0xc044('0x41')]=_[_0xc044('0x42')](_0x410825[_0xc044('0x3d')],_0x410825[_0xc044('0x3f')]);_0x36a092[_0xc044('0x43')]=_[_0xc044('0x42')](_0x410825['model'],qs[_0xc044('0x44')](_0x2b23d1[_0xc044('0x3f')]['fields']));_0x36a092[_0xc044('0x43')]=_0x36a092[_0xc044('0x43')][_0xc044('0x45')]?_0x36a092[_0xc044('0x43')]:_0x410825[_0xc044('0x3d')];if(!_0x2b23d1[_0xc044('0x3f')][_0xc044('0x66')](_0xc044('0x46'))){_0x36a092[_0xc044('0x2e')]=qs[_0xc044('0x2e')](_0x2b23d1[_0xc044('0x3f')][_0xc044('0x2e')]);_0x36a092['offset']=qs[_0xc044('0x2d')](_0x2b23d1[_0xc044('0x3f')][_0xc044('0x2d')]);}_0x36a092[_0xc044('0x47')]=qs[_0xc044('0x48')](_0x2b23d1['query'][_0xc044('0x48')]);_0x36a092['where']=qs[_0xc044('0x41')](_['pick'](_0x2b23d1[_0xc044('0x3f')],_0x410825['filters']));_0x36a092[_0xc044('0x4c')][_0xc044('0x63')]=_0x37a47d['id'];if(_0x2b23d1[_0xc044('0x3f')][_0xc044('0x4a')]){_0x36a092[_0xc044('0x4c')]=_[_0xc044('0x4b')](_0x36a092[_0xc044('0x4c')],{'$or':_[_0xc044('0x3e')](_0x36a092['attributes'],function(_0x2c9136){var _0x1c0fc5={};_0x1c0fc5[_0x2c9136]={'$like':'%'+_0x2b23d1[_0xc044('0x3f')][_0xc044('0x4a')]+'%'};return _0x1c0fc5;})});}_0x36a092=_[_0xc044('0x4b')]({},_0x36a092,_0x2b23d1[_0xc044('0x4f')]);return db[_0xc044('0x6a')][_0xc044('0x2c')]({'where':_0x36a092[_0xc044('0x4c')]})[_0xc044('0x1e')](function(_0x3224ae){_0x1bf287['count']=_0x3224ae;if(_0x2b23d1[_0xc044('0x3f')][_0xc044('0x51')]){_0x36a092[_0xc044('0x56')]=[{'all':!![]}];}return db[_0xc044('0x6a')]['findAll'](_0x36a092);})[_0xc044('0x1e')](function(_0x3e321b){_0x1bf287['rows']=_0x3e321b;return _0x1bf287;});}})[_0xc044('0x1e')](respondWithFilteredResult(_0xb40bc2,_0x36a092))[_0xc044('0x29')](handleError(_0xb40bc2,null));};exports['removeAnswers']=function(_0x30d357,_0x1764c6,_0x508901){return db[_0xc044('0x50')][_0xc044('0x57')]({'where':{'id':_0x30d357[_0xc044('0x54')]['id']}})['then'](handleEntityNotFound(_0x1764c6,null))['then'](function(_0xe52e50){if(_0xe52e50){return _0xe52e50[_0xc044('0x6c')](_0x30d357[_0xc044('0x3f')][_0xc044('0x6d')]);}})[_0xc044('0x1e')](respondWithStatusCode(_0x1764c6,null))['catch'](handleError(_0x1764c6,null));};exports['addLogo']=function(_0x4a2eed,_0x266042,_0xf3f83a){_0x4a2eed['body'][_0xc044('0x6e')]=_0x4a2eed[_0xc044('0x6f')][_0xc044('0x70')];return db[_0xc044('0x50')]['find']({'where':{'id':_0x4a2eed['params']['id']}})[_0xc044('0x1e')](handleEntityNotFound(_0x266042,null))[_0xc044('0x1e')](saveUpdates(_0x4a2eed['body'],null))[_0xc044('0x1e')](respondWithResult(_0x266042,null))[_0xc044('0x29')](handleError(_0x266042,null));};exports[_0xc044('0x71')]=function(_0x24052c,_0x2bd122,_0x41481d){_0x24052c[_0xc044('0x59')][_0xc044('0x72')]=_0x24052c[_0xc044('0x6f')][_0xc044('0x70')];return db[_0xc044('0x50')][_0xc044('0x57')]({'where':{'id':_0x24052c[_0xc044('0x54')]['id']}})[_0xc044('0x1e')](handleEntityNotFound(_0x2bd122,null))[_0xc044('0x1e')](saveUpdates(_0x24052c[_0xc044('0x59')],null))[_0xc044('0x1e')](respondWithResult(_0x2bd122,null))[_0xc044('0x29')](handleError(_0x2bd122,null));};exports[_0xc044('0x73')]=function(_0x384123,_0x2455d4,_0x292087){_0x384123[_0xc044('0x59')][_0xc044('0x74')]=_0x384123['file'][_0xc044('0x70')];return db['ChatWebsite'][_0xc044('0x57')]({'where':{'id':_0x384123[_0xc044('0x54')]['id']}})['then'](handleEntityNotFound(_0x2455d4,null))['then'](saveUpdates(_0x384123['body'],null))['then'](respondWithResult(_0x2455d4,null))[_0xc044('0x29')](handleError(_0x2455d4,null));};exports[_0xc044('0x75')]=function(_0x3f752d,_0x3e9881,_0x5d388b){_0x3f752d['body'][_0xc044('0x76')]=_0x3f752d[_0xc044('0x6f')][_0xc044('0x70')];return db[_0xc044('0x50')][_0xc044('0x57')]({'where':{'id':_0x3f752d[_0xc044('0x54')]['id']}})[_0xc044('0x1e')](handleEntityNotFound(_0x3e9881,null))[_0xc044('0x1e')](saveUpdates(_0x3f752d['body'],null))[_0xc044('0x1e')](respondWithResult(_0x3e9881,null))['catch'](handleError(_0x3e9881,null));};exports['getLogo']=function(_0x293169,_0x37e08b,_0x51d320){var _0x29b33a=path[_0xc044('0x77')](config[_0xc044('0x78')],'server/files/images/logos/default_logo.svg');var _0x3db471={'where':{'id':_0x293169[_0xc044('0x54')]['id']},'attributes':['id',_0xc044('0x6e')],'raw':!![]};var _0x3fbf79=![];return require(_0xc044('0x79'))[_0xc044('0x7a')]()['then'](function(_0x2cf4cd){if(_0x2cf4cd){_0x3fbf79=_0x2cf4cd[_0xc044('0x7b')];}})['then'](function(){return db[_0xc044('0x50')]['find'](_0x3db471);})[_0xc044('0x1e')](handleEntityNotFound(_0x37e08b,null))[_0xc044('0x1e')](function(_0x341de5){if(_0x341de5){if(!_['isNil'](_0x341de5[_0xc044('0x6e')])){if(fs[_0xc044('0x7c')](path['join'](config['root'],_0xc044('0x7d'),_0x341de5[_0xc044('0x6e')]))&&_0x3fbf79){_0x29b33a=path[_0xc044('0x77')](config[_0xc044('0x78')],_0xc044('0x7d'),_0x341de5[_0xc044('0x6e')]);}}return _0x37e08b[_0xc044('0x7e')](_0x29b33a);}})[_0xc044('0x29')](handleError(_0x37e08b,null));};exports['getAvatar']=function(_0xbe4f20,_0x2ac1fe,_0xede61){var _0x502e41=path[_0xc044('0x77')](config['root'],_0xc044('0x7f'));var _0x45b681={'where':{'id':_0xbe4f20['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xc044('0x50')]['find'](_0x45b681)[_0xc044('0x1e')](handleEntityNotFound(_0x2ac1fe,null))['then'](function(_0xfd75c2){if(_0xfd75c2){if(!_[_0xc044('0x80')](_0xfd75c2[_0xc044('0x72')])){if(fs[_0xc044('0x7c')](path['join'](config[_0xc044('0x78')],'server/files/images/avatars/',_0xfd75c2['agentAvatar']))){_0x502e41=path[_0xc044('0x77')](config[_0xc044('0x78')],_0xc044('0x81'),_0xfd75c2[_0xc044('0x72')]);}}return _0x2ac1fe['download'](_0x502e41);}})[_0xc044('0x29')](handleError(_0x2ac1fe,null));};exports[_0xc044('0x82')]=function(_0xe555a,_0x2a1c10,_0x56d913){var _0x23c76f=path[_0xc044('0x77')](config[_0xc044('0x78')],'server/files/images/avatars/customer_avatar.png');var _0x4454cd={'where':{'id':_0xe555a[_0xc044('0x54')]['id']},'attributes':['id','customerAvatar',_0xc044('0x83')],'raw':!![]};return db[_0xc044('0x50')]['find'](_0x4454cd)[_0xc044('0x1e')](handleEntityNotFound(_0x2a1c10,null))[_0xc044('0x1e')](function(_0x38fdae){if(_0x38fdae){if(!_[_0xc044('0x80')](_0x38fdae[_0xc044('0x74')])){if(fs[_0xc044('0x7c')](path[_0xc044('0x77')](config[_0xc044('0x78')],_0xc044('0x81'),_0x38fdae['customerAvatar']))&&_0x38fdae[_0xc044('0x83')]){_0x23c76f=path[_0xc044('0x77')](config['root'],_0xc044('0x81'),_0x38fdae[_0xc044('0x74')]);}}return _0x2a1c10[_0xc044('0x7e')](_0x23c76f);}})[_0xc044('0x29')](handleError(_0x2a1c10,null));};exports[_0xc044('0x84')]=function(_0x45ed72,_0x1f54c4,_0x248b2d){var _0x265ff6=path[_0xc044('0x77')](config[_0xc044('0x78')],_0xc044('0x85'));var _0x57210f={'where':{'id':_0x45ed72[_0xc044('0x54')]['id']},'attributes':['id',_0xc044('0x76')],'raw':!![]};return db[_0xc044('0x50')]['find'](_0x57210f)['then'](handleEntityNotFound(_0x1f54c4,null))[_0xc044('0x1e')](function(_0x33545b){if(_0x33545b){if(!_[_0xc044('0x80')](_0x33545b['systemAvatar'])){if(fs[_0xc044('0x7c')](path[_0xc044('0x77')](config[_0xc044('0x78')],'server/files/images/avatars/',_0x33545b[_0xc044('0x76')]))){_0x265ff6=path[_0xc044('0x77')](config[_0xc044('0x78')],_0xc044('0x81'),_0x33545b[_0xc044('0x76')]);}}return _0x1f54c4['download'](_0x265ff6);}})[_0xc044('0x29')](handleError(_0x1f54c4,null));};exports[_0xc044('0x86')]=function(_0x3626b6,_0x51253f,_0x4fbcf1){var _0x5008dd=require(_0xc044('0x87'));var _0x49dd4a=new _0x5008dd();var _0x1c52c9=_0x49dd4a[_0xc044('0x88')](_0x3626b6[_0xc044('0x89')][_0xc044('0x8a')])[_0xc044('0x8b')]();var _0x129ea3={'body':_0x3626b6[_0xc044('0x59')],'channel':'chat'};var _0x5b442f=[];var _0x1a172c=[];var _0x270d3a={};var _0x379b8c=![];return db[_0xc044('0x8c')][_0xc044('0x61')]()[_0xc044('0x1e')](function(_0x36c5ea){if(!_0x36c5ea){throw new db['Sequelize'][(_0xc044('0x1b'))](_0xc044('0x8d'));}_0x5b442f=_[_0xc044('0x8e')](_['keys'](_0x36c5ea),['createdAt',_0xc044('0x8f')]);_0x1a172c=_[_0xc044('0x8e')](_[_0xc044('0x40')](_0x36c5ea),['createdAt','updatedAt','CompanyId',_0xc044('0x90')]);if(_0x3626b6['body']['id']){delete _0x3626b6[_0xc044('0x59')]['id'];}if(_['isNil'](_0x3626b6[_0xc044('0x59')][_0xc044('0x91')])){throw new db[(_0xc044('0x1a'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xc044('0x80')](_0x3626b6[_0xc044('0x59')][_0xc044('0x59')])||_0x3626b6[_0xc044('0x59')][_0xc044('0x59')]===''){throw new db[(_0xc044('0x1a'))][(_0xc044('0x1b'))](_0xc044('0x92'));}if(_[_0xc044('0x80')](_0x3626b6['body']['mapKey'])){throw new db[(_0xc044('0x1a'))][(_0xc044('0x1b'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1a172c);}if(!_[_0xc044('0x93')](_0x1a172c,_0x3626b6['body'][_0xc044('0x94')])){throw new db[(_0xc044('0x1a'))][(_0xc044('0x1b'))](_0xc044('0x95')+_0x1a172c);}_0x270d3a[_0x3626b6['body']['mapKey']]=_0x3626b6['body'][_0xc044('0x91')];})[_0xc044('0x1e')](function(){return db[_0xc044('0x50')][_0xc044('0x57')]({'where':{'id':_0x3626b6['params']['id']},'include':[{'model':db['CmList'],'as':_0xc044('0x96'),'include':[{'model':db['CmContact'],'as':_0xc044('0x97'),'where':_0x270d3a,'limit':0x1,'order':[[_0xc044('0x8f'),_0xc044('0x98')]]}]},{'model':db[_0xc044('0x99')],'as':'Applications'}]});})[_0xc044('0x1e')](handleEntityNotFound(_0x51253f,null))['then'](function(_0x23864c){if(_0x23864c&&_0x23864c['List']){_0x129ea3[_0xc044('0x9a')]=_0x23864c;_0x129ea3[_0xc044('0x9b')]=_0x23864c['Applications'];_0x129ea3[_0xc044('0x9c')]=_0x23864c[_0xc044('0x96')];_0x129ea3[_0xc044('0x9b')]=_[_0xc044('0x9d')](_0x129ea3[_0xc044('0x9b')],[_0xc044('0x9e')],[_0xc044('0x9f')]);if(_0x129ea3['account'][_0xc044('0xa0')]){delete _0x129ea3[_0xc044('0x9a')][_0xc044('0xa0')];}if(_0x129ea3[_0xc044('0x9a')]['List']&&_0x129ea3[_0xc044('0x9a')][_0xc044('0x96')][_0xc044('0x97')][_0xc044('0x45')]){return _0x129ea3[_0xc044('0x9a')]['List'][_0xc044('0x97')][0x0];}var _0x2f27b5=_[_0xc044('0xa1')](_0x3626b6[_0xc044('0x59')],{'firstName':_0x3626b6[_0xc044('0x59')][_0xc044('0x91')],'ListId':_0x23864c[_0xc044('0x90')]});_0x2f27b5[_0x3626b6['body'][_0xc044('0x94')]]=_0x3626b6[_0xc044('0x59')][_0xc044('0x91')];return db[_0xc044('0x8c')][_0xc044('0x58')](_0x2f27b5,{'fields':_0x5b442f,'raw':!![]});}})[_0xc044('0x1e')](handleEntityNotFound(_0x51253f,null))[_0xc044('0x1e')](function(_0x12007e){_0x129ea3['contact']=_0x12007e;var _0x46bace=_0x3626b6[_0xc044('0x59')]['customerIp'];if(_0x3626b6['headers'][_0xc044('0xa2')]){_0x46bace=_0x3626b6['headers'][_0xc044('0xa2')];}else if(_0x3626b6[_0xc044('0x89')][_0xc044('0xa3')]){_0x46bace=_[_0xc044('0xa4')](_0x3626b6[_0xc044('0x89')][_0xc044('0xa3')][_0xc044('0xa5')](','));}if(_0x12007e){var _0x1db85f={'ContactId':_0x12007e['id'],'ChatWebsiteId':_0x3626b6['params']['id'],'from':(_0x12007e[_0xc044('0xa6')]||'')+'\x20'+(_0x12007e['lastName']||''),'customerIp':_0x46bace,'customerPort':_0x3626b6[_0xc044('0x89')][_0xc044('0xa7')]?_0x3626b6[_0xc044('0x89')][_0xc044('0xa7')]:null,'referer':_0x3626b6[_0xc044('0x59')]['referer'],'browserName':_0x1c52c9[_0xc044('0xa8')][_0xc044('0x39')]&&_0x1c52c9[_0xc044('0xa8')][_0xc044('0xa9')]?util[_0xc044('0xaa')]('%s\x20%s',_0x1c52c9[_0xc044('0xa8')][_0xc044('0x39')],_0x1c52c9['browser'][_0xc044('0xa9')]):_0xc044('0xab'),'browserVersion':_0x1c52c9[_0xc044('0xa8')][_0xc044('0xa9')]||_0xc044('0xab'),'osName':util[_0xc044('0xaa')](_0xc044('0xac'),_0x1c52c9['os'][_0xc044('0x39')],_0x1c52c9['os'][_0xc044('0xa9')]),'osVersion':_0x1c52c9['os']['version'],'deviceModel':_0x1c52c9['device'][_0xc044('0x3d')]&&_0x1c52c9[_0xc044('0xad')][_0xc044('0xae')]?util[_0xc044('0xaa')](_0xc044('0xaf'),_0x1c52c9[_0xc044('0xad')]['model'],_0x1c52c9[_0xc044('0xad')][_0xc044('0xae')],_0x1c52c9[_0xc044('0xad')][_0xc044('0x4d')]):null,'deviceVendor':_0x1c52c9['device'][_0xc044('0xae')],'deviceType':_0x1c52c9[_0xc044('0xad')][_0xc044('0x4d')],'formData':JSON[_0xc044('0x24')](_0x3626b6[_0xc044('0x59')])};var _0x35f957={'ChatWebsiteId':_0x3626b6[_0xc044('0x54')]['id'],'closed':![]};if(_0x3626b6[_0xc044('0x59')][_0xc044('0xb0')]){_0x35f957[_0xc044('0xb0')]=_0x3626b6[_0xc044('0x59')][_0xc044('0xb0')];return db['ChatInteraction'][_0xc044('0x57')]({'where':_0x35f957})[_0xc044('0x1e')](function(_0x382fa1){if(_0x382fa1){return[_0x382fa1,![]];}_0x1db85f[_0xc044('0xb0')]=_0x3626b6[_0xc044('0x59')][_0xc044('0xb0')];_0x1db85f[_0xc044('0xb1')]=_0x3626b6[_0xc044('0x59')]['externalUrl'];return db[_0xc044('0xb2')][_0xc044('0x58')](_0x1db85f)[_0xc044('0x1e')](function(_0x13a7ac){return[_0x13a7ac,!![]];});});}_0x35f957[_0xc044('0xb3')]=_0x12007e['id'];if(_0x3626b6[_0xc044('0x59')][_0xc044('0xb4')]&&_0x3626b6['body'][_0xc044('0xb4')]['id']){_0x35f957['id']=_0x3626b6[_0xc044('0x59')][_0xc044('0xb4')]['id'];return db[_0xc044('0xb2')]['find']({'where':_0x35f957})[_0xc044('0x1e')](function(_0x458d20){if(_0x458d20){return[_0x458d20,![]];}return db[_0xc044('0xb2')][_0xc044('0x58')](_0x1db85f)[_0xc044('0x1e')](function(_0x3b0d77){return[_0x3b0d77,!![]];});});}return db[_0xc044('0xb2')][_0xc044('0x58')](_0x1db85f)['then'](function(_0x11df77){return[_0x11df77,!![]];});}})[_0xc044('0xb5')](function(_0x2e845d,_0x5505f4){if(_0x2e845d){_0x379b8c=_0x5505f4;if(!_0x5505f4){var _0x1eb391={'from':(_0x129ea3[_0xc044('0xb6')][_0xc044('0xa6')]||'')+'\x20'+(_0x129ea3['contact'][_0xc044('0xb7')]||'')};if(_0x3626b6[_0xc044('0x59')][_0xc044('0xb0')]&&_0x3626b6[_0xc044('0x59')][_0xc044('0xb8')]&&_0x3626b6['body'][_0xc044('0xb0')]!=_0x3626b6[_0xc044('0x59')][_0xc044('0xb8')]){_0x1eb391['threadId']=_0x3626b6[_0xc044('0x59')][_0xc044('0xb8')];}return _0x2e845d[_0xc044('0x33')](_0x1eb391);}else{return _0x2e845d;}}})['then'](function(_0x3e7111){_0x129ea3[_0xc044('0xb4')]=_0x3e7111[_0xc044('0x35')]({'plain':!![]});_0x129ea3[_0xc044('0xb4')][_0xc044('0xb9')]=_0x379b8c;if(_0x129ea3[_0xc044('0xb4')][_0xc044('0xb9')]){if(_0x129ea3[_0xc044('0x9a')][_0xc044('0xba')]){_0x129ea3[_0xc044('0x9b')][_0xc044('0xbb')]({'id':0x0,'priority':_0x129ea3[_0xc044('0x9b')][_0xc044('0x45')]+0x1,'app':_0xc044('0xbc'),'appdata':_0xc044('0xbd'),'interval':_0xc044('0xbe')});}}return db['ChatMessage'][_0xc044('0x58')]({'body':_0x3626b6['body'][_0xc044('0x59')],'ChatWebsiteId':_0x3626b6[_0xc044('0x54')]['id'],'ChatInteractionId':_0x3e7111['id'],'direction':'in','ContactId':_0x129ea3[_0xc044('0xb6')]['id'],'AttachmentId':_0x3626b6[_0xc044('0x59')][_0xc044('0xbf')]});})[_0xc044('0x1e')](function(_0x1b7d4d){_0x129ea3[_0xc044('0x27')]=_0x1b7d4d;if(_0x129ea3[_0xc044('0xb4')][_0xc044('0xc0')]){return db[_0xc044('0xc1')][_0xc044('0x57')]({'attributes':['id',_0xc044('0x39')],'where':{'id':_0x129ea3[_0xc044('0xb4')][_0xc044('0xc0')]}})[_0xc044('0x1e')](function(_0x3d80b6){if(_0x3d80b6){_0x129ea3[_0xc044('0x9b')][_0xc044('0xc2')]({'id':0x0,'priority':0x0,'app':_0xc044('0xc3'),'appdata':_0x3d80b6['name']+','+(_0x129ea3[_0xc044('0x9a')][_0xc044('0xc4')]||0xa),'interval':_0xc044('0xbe')});_0x129ea3['forcedOwnership']=!![];}return respondWithRpcPromise('Start',_0xc044('0xc5'),_0x129ea3);});}return respondWithRpcPromise(_0xc044('0xc6'),_0xc044('0xc5'),_0x129ea3);})[_0xc044('0x1e')](function(_0x5d6eb0){respondWithRpcPromise('EventManager',_0xc044('0xc7'),{'event':_0xc044('0x86'),'message':_0x5d6eb0},client9002);return _0x5d6eb0;})[_0xc044('0x1e')](respondWithResult(_0x51253f,null))[_0xc044('0x29')](handleError(_0x51253f,null));};exports['offline']=function(_0x296a9b,_0x9bfc1d,_0x2525ce){var _0x3a7f72,_0x54c6aa,_0x8a277;var _0x278c17=[];var _0x1519e3=[];var _0xe8549a={};return db[_0xc044('0x8c')]['describe']()[_0xc044('0x1e')](function(_0x41ad64){if(!_0x41ad64){throw new db[(_0xc044('0x1a'))][(_0xc044('0x1b'))](_0xc044('0x8d'));}_0x1519e3=_[_0xc044('0x8e')](_[_0xc044('0x40')](_0x41ad64),[_0xc044('0xc8'),_0xc044('0x8f')]);_0x278c17=_[_0xc044('0x8e')](_[_0xc044('0x40')](_0x41ad64),[_0xc044('0xc8'),_0xc044('0x8f'),_0xc044('0xc9'),'ListId']);if(_0x296a9b[_0xc044('0x59')]['id']){delete _0x296a9b[_0xc044('0x59')]['id'];}if(_[_0xc044('0x80')](_0x296a9b[_0xc044('0x59')][_0xc044('0x91')])){throw _0x9bfc1d[_0xc044('0x2b')](0x1f4)['send'](new db[(_0xc044('0x1a'))][(_0xc044('0x1b'))](_0xc044('0xca')));}if(_[_0xc044('0x80')](_0x296a9b['body'][_0xc044('0x59')])||_0x296a9b[_0xc044('0x59')][_0xc044('0x59')]===''){throw _0x9bfc1d[_0xc044('0x2b')](0x1f4)[_0xc044('0x3a')](new db[(_0xc044('0x1a'))][(_0xc044('0x1b'))](_0xc044('0x92')));}if(_[_0xc044('0x80')](_0x296a9b[_0xc044('0x59')]['mapKeyOffline'])){throw _0x9bfc1d['status'](0x1f4)[_0xc044('0x3a')](new db['Sequelize'][(_0xc044('0x1b'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x278c17));}if(!_[_0xc044('0x93')](_0x278c17,_0x296a9b['body']['mapKeyOffline'])){throw _0x9bfc1d[_0xc044('0x2b')](0x1f4)[_0xc044('0x3a')](new db[(_0xc044('0x1a'))][(_0xc044('0x1b'))](_0xc044('0xcb')+_0x278c17));}_0xe8549a[_0x296a9b[_0xc044('0x59')][_0xc044('0xcc')]]=_0x296a9b[_0xc044('0x59')][_0xc044('0x91')];})[_0xc044('0x1e')](function(){return db[_0xc044('0x50')][_0xc044('0x57')]({'where':{'id':_0x296a9b[_0xc044('0x54')]['id']},'include':[{'model':db[_0xc044('0xcd')],'as':_0xc044('0x96')}]});})['then'](handleEntityNotFound(_0x9bfc1d,null))[_0xc044('0x1e')](function(_0x3c5433){if(_0x3c5433&&_0x3c5433['List']){_0x54c6aa=_0x3c5433;var _0x34d237=_[_0xc044('0xa1')](_0x296a9b[_0xc044('0x59')],{'firstName':_0x296a9b[_0xc044('0x59')][_0xc044('0x91')],'phone':_0x296a9b['body'][_0xc044('0x91')],'ListId':_0x3c5433[_0xc044('0x90')]});_0x34d237[_0x296a9b[_0xc044('0x59')][_0xc044('0xcc')]]=_0x296a9b[_0xc044('0x59')]['from'];return db[_0xc044('0x8c')][_0xc044('0xce')]({'where':_0xe8549a,'defaults':_0x34d237});}})[_0xc044('0xb5')](function(_0x5bc2ab){if(_0x5bc2ab){_0x8a277=_0x5bc2ab;var _0x3451d0=fs[_0xc044('0xcf')](path[_0xc044('0x77')](config[_0xc044('0x78')],_0xc044('0xd0')),'utf8');var _0x2751d9=ejs['render'](_0x3451d0,{'body':_['toPairs'](_0x296a9b[_0xc044('0x59')][_0xc044('0x59')]),'bodyTitle':_0x54c6aa[_0xc044('0xd1')]});return db[_0xc044('0xd2')][_0xc044('0x58')]({'body':_0x2751d9,'ContactId':_0x5bc2ab['id'],'ChatWebsiteId':_0x54c6aa['id']});}})['then'](function(_0x5a8cfd){if(_0x5a8cfd){_0x3a7f72=_0x5a8cfd;return db[_0xc044('0xd3')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xc044('0xd4'),'raw':!![]}]});}})[_0xc044('0x1e')](function(_0x104433){if(_0x104433&&_0x104433['Smtp']&&_0x54c6aa[_0xc044('0xd5')]){var _0x225538={'tls':{'rejectUnauthorized':![]}};if(_0x104433[_0xc044('0xd4')]['service']){_0x225538[_0xc044('0xd6')]=_0x104433[_0xc044('0xd4')][_0xc044('0xd6')];}else{_0x225538[_0xc044('0xd7')]=_0x104433['Smtp'][_0xc044('0xd7')];_0x225538['port']=_0x104433['Smtp']['port'];_0x225538[_0xc044('0xd8')]=_0x104433[_0xc044('0xd4')][_0xc044('0xd8')];}if(_0x104433[_0xc044('0xd4')][_0xc044('0xd9')]){_0x225538[_0xc044('0xda')]={'user':_0x104433[_0xc044('0xd4')][_0xc044('0x5a')],'pass':_0x104433[_0xc044('0xd4')]['pass']};}return respondWithRpcPromise(_0xc044('0xdb'),_0xc044('0xdc'),{'account':_0x225538,'message':{'from':util['format'](_0xc044('0xdd'),_0x104433[_0xc044('0x39')],_0x104433[_0xc044('0xde')]||_0x104433['Smtp'][_0xc044('0x5a')]),'to':_0x54c6aa[_0xc044('0xd5')],'subject':_0x54c6aa[_0xc044('0xdf')],'text':_0x3a7f72[_0xc044('0x59')]}},client9003)['then'](function(){return _0x3a7f72;})['catch'](function(_0x177d16){console[_0xc044('0x25')](_0x177d16);});}})[_0xc044('0x1e')](function(){if(_0x3a7f72){return _0x3a7f72;}})[_0xc044('0x1e')](respondWithResult(_0x9bfc1d,null))[_0xc044('0x29')](handleError(_0x9bfc1d,null));};exports[_0xc044('0xe0')]=function(_0x2ee238,_0x1dd468,_0x10252e){return db['ChatInteraction']['find']({'where':{'id':_0x2ee238[_0xc044('0x54')]['id']}})[_0xc044('0x1e')](handleEntityNotFound(_0x1dd468,null))[_0xc044('0x1e')](function(_0x2f2972){if(_0x2f2972){return _0x2f2972['addInteraction'](_0x2ee238[_0xc044('0x59')][_0xc044('0x6d')],_[_0xc044('0xe1')](_0x2ee238[_0xc044('0x59')],[_0xc044('0x6d'),'id'])||{});}})[_0xc044('0x1e')](respondWithResult(_0x1dd468,null))[_0xc044('0x29')](handleError(_0x1dd468,null));};exports[_0xc044('0xe2')]=function(_0x1ad1d7,_0x1e747f,_0x4be4b8){var _0x24daca={'raw':![],'where':{}};var _0xfce4e3={};var _0x3cc3a6={'count':0x0,'rows':[]};return db[_0xc044('0x50')][_0xc044('0x65')]({'where':{'id':_0x1ad1d7[_0xc044('0x54')]['id']}})[_0xc044('0x1e')](handleEntityNotFound(_0x1e747f,null))[_0xc044('0x1e')](function(_0x4b4c7a){if(_0x4b4c7a){_0xfce4e3[_0xc044('0x3d')]=_[_0xc044('0x40')](db[_0xc044('0xb2')][_0xc044('0x3b')]);_0xfce4e3[_0xc044('0x3f')]=_[_0xc044('0x40')](_0x1ad1d7[_0xc044('0x3f')]);_0xfce4e3[_0xc044('0x41')]=_[_0xc044('0x42')](_0xfce4e3[_0xc044('0x3d')],_0xfce4e3[_0xc044('0x3f')]);_0x24daca[_0xc044('0x43')]=_[_0xc044('0x42')](_0xfce4e3[_0xc044('0x3d')],qs[_0xc044('0x44')](_0x1ad1d7[_0xc044('0x3f')][_0xc044('0x44')]));_0x24daca[_0xc044('0x43')]=_0x24daca['attributes'][_0xc044('0x45')]?_0x24daca[_0xc044('0x43')]:_0xfce4e3['model'];if(!_0x1ad1d7[_0xc044('0x3f')][_0xc044('0x66')](_0xc044('0x46'))){_0x24daca[_0xc044('0x2e')]=qs[_0xc044('0x2e')](_0x1ad1d7[_0xc044('0x3f')]['limit']);_0x24daca['offset']=qs[_0xc044('0x2d')](_0x1ad1d7[_0xc044('0x3f')][_0xc044('0x2d')]);}_0x24daca[_0xc044('0x47')]=qs[_0xc044('0x48')](_0x1ad1d7[_0xc044('0x3f')]['sort']);_0x24daca[_0xc044('0x4c')]=qs['filters'](_['pick'](_0x1ad1d7['query'],_0xfce4e3[_0xc044('0x41')]));_0x24daca['where']['ChatWebsiteId']=_0x4b4c7a['id'];if(_0x1ad1d7[_0xc044('0x3f')][_0xc044('0x4a')]){_0x24daca[_0xc044('0x4c')]=_[_0xc044('0x4b')](_0x24daca[_0xc044('0x4c')],{'$or':_[_0xc044('0x3e')](_0x24daca[_0xc044('0x43')],function(_0x339dd5){var _0x34ad3b={};_0x34ad3b[_0x339dd5]={'$like':'%'+_0x1ad1d7[_0xc044('0x3f')][_0xc044('0x4a')]+'%'};return _0x34ad3b;})});}_0x24daca=_[_0xc044('0x4b')]({},_0x24daca,_0x1ad1d7[_0xc044('0x4f')]);return db[_0xc044('0xb2')][_0xc044('0x2c')]({'where':_0x24daca['where']})['then'](function(_0x359a87){_0x3cc3a6[_0xc044('0x2c')]=_0x359a87;if(_0x1ad1d7[_0xc044('0x3f')][_0xc044('0x51')]){_0x24daca[_0xc044('0x56')]=[{'model':db[_0xc044('0x8c')],'as':'Contact','required':![]},{'model':db[_0xc044('0xc1')],'as':_0xc044('0xe3'),'attributes':[_0xc044('0x39'),'fullname',_0xc044('0xe4')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0xc044('0xe5')],'where':_0x1ad1d7[_0xc044('0x3f')][_0xc044('0xe6')]?{'id':_0x1ad1d7['query'][_0xc044('0xe6')]}:undefined,'required':_0x1ad1d7['query'][_0xc044('0xe6')]?!![]:![]}];}return db[_0xc044('0xb2')][_0xc044('0x52')](_0x24daca);})['then'](function(_0x10e70c){_0x3cc3a6['rows']=_0x10e70c;return _0x3cc3a6;});}})[_0xc044('0x1e')](respondWithFilteredResult(_0x1e747f,_0x24daca))['catch'](handleError(_0x1e747f,null));};function iftimePromise(_0x1ca46b,_0x3cc883){return respondWithRpcPromise(_0xc044('0xe7'),_0xc044('0xe8'),{'command':_0x3cc883[_0xc044('0xe9')]?util['format'](_0xc044('0xea'),_0x1ca46b[_0xc044('0xeb')],_0x3cc883[_0xc044('0xe9')]):util[_0xc044('0xaa')](_0xc044('0xec'),_0x1ca46b[_0xc044('0xeb')])},client9002)['then'](function(_0x52584b){var _0x612019=_0x52584b&&_0x52584b['indexOf'](_0xc044('0xed'))>=0x0?!![]:![];logger[_0xc044('0x1f')](_0xc044('0xee'),_0x3cc883['id'],_0x1ca46b['id'],_0x1ca46b['interval'],_0x612019?_0xc044('0xef'):'OFFLINE',_0x3cc883['timezone']?_0x3cc883[_0xc044('0xe9')]:_0xc044('0xf0'));return _0x612019;})[_0xc044('0x29')](function(_0x5478a1){logger['error'](_0xc044('0xee'),_0x3cc883['id'],_0x1ca46b['id'],_0x1ca46b['interval'],util[_0xc044('0xf1')](_0x5478a1,{'showHidden':![],'depth':null}),_0x3cc883[_0xc044('0xe9')]?_0x3cc883['timezone']:_0xc044('0xf0'));return![];});}exports['getSnippet']=function(_0x36479b,_0x194ac6,_0x3e7ea2){var _0x3d41d7=0x0;var _0x1439b0=0x0;var _0x58cb42=![];var _0x1baf4a;var _0x7b6f91;return db[_0xc044('0x50')][_0xc044('0x57')]({'where':{'id':_0x36479b['params']['id']},'include':[{'model':db[_0xc044('0xf2')],'as':_0xc044('0xf2'),'include':[{'model':db[_0xc044('0xf2')],'as':_0xc044('0xf3'),'attributes':['id',_0xc044('0xeb')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x194ac6,null))[_0xc044('0x1e')](function(_0x496917){if(_0x496917){_0x1baf4a=_0x496917;return _0x496917[_0xc044('0xf4')]({'raw':!![]});}})[_0xc044('0x1e')](function(_0x5b437c){if(_0x1baf4a){if(_0x5b437c){_0x7b6f91=_0x5b437c;}}return require(_0xc044('0x79'))[_0xc044('0x7a')]();})['then'](function(_0x5ef6e5){if(_0x5ef6e5){_0x1439b0=_0x5ef6e5[_0xc044('0xf5')];_0x58cb42=_0x5ef6e5[_0xc044('0x7b')];}})[_0xc044('0x1e')](function(){return db[_0xc044('0xb2')][_0xc044('0x2c')]({'where':{'closed':![]}});})[_0xc044('0x1e')](function(_0x1af5c3){_0x3d41d7=_0x1af5c3;if(_0x1439b0&&_0x1af5c3>_0x1439b0){return db[_0xc044('0xf6')][_0xc044('0x65')]({'where':{'id':0x1}})[_0xc044('0x1e')](function(_0x29e7d6){if(_0x29e7d6){_0x29e7d6['increment'](_0xc044('0xf7'));}});}})[_0xc044('0x1e')](function(){if(_0x1baf4a['Interval']&&_0x1baf4a['Interval'][_0xc044('0xf3')]){var _0x1cd85c=[];for(var _0x23846b=0x0;_0x23846b<_0x1baf4a[_0xc044('0xf2')]['Intervals'][_0xc044('0x45')];_0x23846b++){var _0x131c20=_0x1baf4a[_0xc044('0xf2')][_0xc044('0xf3')][_0x23846b][_0xc044('0x35')]({'plain':!![]});_0x1cd85c['push'](iftimePromise(_0x131c20,_0x1baf4a));}return BPromise[_0xc044('0xf8')](_0x1cd85c)[_0xc044('0x1e')](function(_0x31dad9){return _[_0xc044('0xf9')](_0x31dad9);});}else{return!![];}})[_0xc044('0x1e')](function(_0x4956c5){var _0x1f941f=fs[_0xc044('0xcf')](path[_0xc044('0x77')](config['root'],'server/files/chat/iframe.js'),_0xc044('0xfa'));var _0x5145a0={'remote':_0x1baf4a[_0xc044('0xfb')],'query':querystring[_0xc044('0x24')](_['merge'](_0x1baf4a['get']({'plain':!![]}),{'customerIp':_0x36479b[_0xc044('0x89')][_0xc044('0xa3')]||_0x36479b['headers'][_0xc044('0xfc')]||_0x36479b['connection']['remoteAddress']||_0x36479b['ip'],'referer':_0x36479b[_0xc044('0x89')][_0xc044('0xfd')],'openedInteractions':_0x3d41d7,'maxInteractions':_0x1439b0,'virtual':_0x58cb42[_0xc044('0xf5')],'online':_0x4956c5,'custom':_0x58cb42}))[_0xc044('0xfe')](/'/g,'\x5c\x27')};_0x194ac6[_0xc044('0x3a')](ejs[_0xc044('0xff')](Mustache['render'](_0x1f941f,_0x5145a0),{'proactiveActions':_0x7b6f91,'alignment':_0x1baf4a['alignment'],'verticalAlignment':_0x1baf4a['verticalAlignment'],'div_color':_0x1baf4a['color'],'text_color':_0x1baf4a[_0xc044('0x100')]}));})['catch'](handleError(_0x194ac6,null));};exports['addApplications']=function(_0xc7475e,_0xaf2c59,_0x287776){return db[_0xc044('0x50')][_0xc044('0x65')]({'where':{'id':_0xc7475e['params']['id']}})['then'](handleEntityNotFound(_0xaf2c59,null))['then'](function(_0x19c863){if(_0x19c863){return db[_0xc044('0x101')]['transaction'](function(_0x28aec2){return db[_0xc044('0x99')][_0xc044('0x34')]({'where':{'ChatWebsiteId':_0xc7475e[_0xc044('0x54')]['id']},'transaction':_0x28aec2})[_0xc044('0x1e')](function(_0x2c84b9){var _0x3982a9=_[_0xc044('0x3e')](_0xc7475e[_0xc044('0x59')],function(_0x19334b){_0x19334b[_0xc044('0x63')]=_0xc7475e[_0xc044('0x54')]['id'];return _0x19334b;});return db[_0xc044('0x99')][_0xc044('0x102')](_0x3982a9,{'transaction':_0x28aec2});});})[_0xc044('0x1e')](function(){return db['ChatApplication'][_0xc044('0x103')]({'where':{'ChatWebsiteId':_0xc7475e[_0xc044('0x54')]['id']},'order':'priority'});});}})[_0xc044('0x1e')](respondWithResult(_0xaf2c59,null))['catch'](handleError(_0xaf2c59,null));};exports[_0xc044('0x104')]=function(_0x3aa0a8,_0x5464e6,_0x3293a1){var _0x2b2ba8={};var _0x464db6={};var _0x10ad13;var _0x58d58f;return db['ChatWebsite']['findOne']({'where':{'id':_0x3aa0a8[_0xc044('0x54')]['id']}})['then'](handleEntityNotFound(_0x5464e6,null))['then'](function(_0x519493){if(_0x519493){_0x10ad13=_0x519493;_0x464db6['model']=_[_0xc044('0x40')](db[_0xc044('0x99')][_0xc044('0x3b')]);_0x464db6[_0xc044('0x3f')]=_[_0xc044('0x40')](_0x3aa0a8[_0xc044('0x3f')]);_0x464db6['filters']=_[_0xc044('0x42')](_0x464db6[_0xc044('0x3d')],_0x464db6[_0xc044('0x3f')]);_0x2b2ba8['attributes']=_[_0xc044('0x42')](_0x464db6[_0xc044('0x3d')],qs['fields'](_0x3aa0a8[_0xc044('0x3f')]['fields']));_0x2b2ba8['attributes']=_0x2b2ba8['attributes'][_0xc044('0x45')]?_0x2b2ba8[_0xc044('0x43')]:_0x464db6['model'];_0x2b2ba8['order']=qs[_0xc044('0x48')](_0x3aa0a8[_0xc044('0x3f')]['sort']);_0x2b2ba8[_0xc044('0x4c')]=qs[_0xc044('0x41')](_['pick'](_0x3aa0a8[_0xc044('0x3f')],_0x464db6[_0xc044('0x41')]));if(_0x3aa0a8[_0xc044('0x3f')][_0xc044('0x4a')]){_0x2b2ba8[_0xc044('0x4c')]=_[_0xc044('0x4b')](_0x2b2ba8['where'],{'$or':_[_0xc044('0x3e')](_0x2b2ba8[_0xc044('0x43')],function(_0x3340cd){var _0x5cbb79={};_0x5cbb79[_0x3340cd]={'$like':'%'+_0x3aa0a8['query'][_0xc044('0x4a')]+'%'};return _0x5cbb79;})});}_0x2b2ba8=_[_0xc044('0x4b')]({},_0x2b2ba8,_0x3aa0a8['options']);return _0x10ad13[_0xc044('0x104')](_0x2b2ba8);}})[_0xc044('0x1e')](function(_0x57c44f){if(_0x57c44f){_0x58d58f=_0x57c44f[_0xc044('0x45')];if(!_0x3aa0a8[_0xc044('0x3f')][_0xc044('0x66')](_0xc044('0x46'))){_0x2b2ba8[_0xc044('0x2e')]=qs[_0xc044('0x2e')](_0x3aa0a8[_0xc044('0x3f')][_0xc044('0x2e')]);_0x2b2ba8[_0xc044('0x2d')]=qs['offset'](_0x3aa0a8[_0xc044('0x3f')][_0xc044('0x2d')]);}return _0x10ad13[_0xc044('0x104')](_0x2b2ba8);}})[_0xc044('0x1e')](function(_0x289942){if(_0x289942){return _0x289942?{'count':_0x58d58f,'rows':_0x289942}:null;}})[_0xc044('0x1e')](respondWithResult(_0x5464e6,null))[_0xc044('0x29')](handleError(_0x5464e6,null));};exports['addProactiveActions']=function(_0xce92a5,_0x47ce60,_0x2981b4){return db[_0xc044('0x105')]['find']({'where':{'id':_0xce92a5['params']['id']}})[_0xc044('0x1e')](handleEntityNotFound(_0x47ce60,null))[_0xc044('0x1e')](function(_0x4b7afa){if(_0x4b7afa){return _0x4b7afa['addProactiveActions'](_0xce92a5['body'][_0xc044('0x6d')],_[_0xc044('0xe1')](_0xce92a5[_0xc044('0x59')],['ids','id'])||{});}})[_0xc044('0x1e')](respondWithResult(_0x47ce60,null))[_0xc044('0x29')](handleError(_0x47ce60,null));};exports['getProactiveActions']=function(_0x51840c,_0x31c7af,_0x576aa5){var _0x39a28c={};var _0x33e0f3={};var _0x4b8290;var _0x4fa53a;return db[_0xc044('0x50')]['findOne']({'where':{'id':_0x51840c[_0xc044('0x54')]['id']}})[_0xc044('0x1e')](handleEntityNotFound(_0x31c7af,null))['then'](function(_0x224725){if(_0x224725){_0x4b8290=_0x224725;_0x33e0f3[_0xc044('0x3d')]=_[_0xc044('0x40')](db[_0xc044('0x106')][_0xc044('0x3b')]);_0x33e0f3[_0xc044('0x3f')]=_['keys'](_0x51840c[_0xc044('0x3f')]);_0x33e0f3[_0xc044('0x41')]=_['intersection'](_0x33e0f3[_0xc044('0x3d')],_0x33e0f3[_0xc044('0x3f')]);_0x39a28c[_0xc044('0x43')]=_['intersection'](_0x33e0f3['model'],qs['fields'](_0x51840c[_0xc044('0x3f')]['fields']));_0x39a28c[_0xc044('0x43')]=_0x39a28c[_0xc044('0x43')][_0xc044('0x45')]?_0x39a28c[_0xc044('0x43')]:_0x33e0f3[_0xc044('0x3d')];_0x39a28c[_0xc044('0x47')]=qs[_0xc044('0x48')](_0x51840c[_0xc044('0x3f')]['sort']);_0x39a28c[_0xc044('0x4c')]=qs[_0xc044('0x41')](_[_0xc044('0x49')](_0x51840c[_0xc044('0x3f')],_0x33e0f3[_0xc044('0x41')]));if(_0x51840c['query'][_0xc044('0x4a')]){_0x39a28c['where']=_[_0xc044('0x4b')](_0x39a28c[_0xc044('0x4c')],{'$or':_[_0xc044('0x3e')](_0x39a28c[_0xc044('0x43')],function(_0x48fb2d){var _0xcef06a={};_0xcef06a[_0x48fb2d]={'$like':'%'+_0x51840c['query']['filter']+'%'};return _0xcef06a;})});}_0x39a28c=_[_0xc044('0x4b')]({},_0x39a28c,_0x51840c[_0xc044('0x4f')]);return _0x4b8290[_0xc044('0xf4')](_0x39a28c);}})[_0xc044('0x1e')](function(_0x56ab04){if(_0x56ab04){_0x4fa53a=_0x56ab04[_0xc044('0x45')];if(!_0x51840c[_0xc044('0x3f')][_0xc044('0x66')](_0xc044('0x46'))){_0x39a28c[_0xc044('0x2e')]=qs[_0xc044('0x2e')](_0x51840c[_0xc044('0x3f')]['limit']);_0x39a28c['offset']=qs['offset'](_0x51840c[_0xc044('0x3f')][_0xc044('0x2d')]);}return _0x4b8290[_0xc044('0xf4')](_0x39a28c);}})[_0xc044('0x1e')](function(_0x50bb50){if(_0x50bb50){return _0x50bb50?{'count':_0x4fa53a,'rows':_0x50bb50}:null;}})[_0xc044('0x1e')](respondWithResult(_0x31c7af,null))['catch'](handleError(_0x31c7af,null));};exports[_0xc044('0x107')]=function(_0xf15c2c,_0x4733ea,_0x349500){var _0x5eea21=_0xf15c2c['query'][_0xc044('0x108')]==='false'?_0xc044('0x109'):_0xc044('0x10a');return db['ChatWebsite'][_0xc044('0x57')]({'attributes':['id',_0x5eea21],'where':{'id':_0xf15c2c[_0xc044('0x54')]['id']}})[_0xc044('0x1e')](handleEntityNotFound(_0x4733ea,null))['then'](function(_0x38a470){if(_0x38a470){var _0x274a3e=_0x38a470[_0x5eea21];var _0x12ec73=_0x274a3e&&_0x274a3e['items']?_0x274a3e[_0xc044('0x10b')]:[];_0x4733ea[_0xc044('0x3a')]({'fromKey':_[_0xc044('0x80')](_0x274a3e[_0xc044('0x10c')])?undefined:_0x274a3e[_0xc044('0x10c')],'count':_0x12ec73[_0xc044('0x45')],'rows':_0x12ec73});}})[_0xc044('0x29')](handleError(_0x4733ea,null));};exports[_0xc044('0x10d')]=function(_0x188f4a,_0x1c5d0f,_0x50f7bc){var _0x494d03={'raw':![],'where':{}};var _0x19b66e={};var _0x2aeef6={'count':0x0,'rows':[]};return db[_0xc044('0x50')][_0xc044('0x65')]({'where':{'id':_0x188f4a['params']['id']}})[_0xc044('0x1e')](handleEntityNotFound(_0x1c5d0f,null))[_0xc044('0x1e')](function(_0x5920e9){if(_0x5920e9){_0x19b66e[_0xc044('0x3d')]=_[_0xc044('0x40')](db[_0xc044('0xd2')][_0xc044('0x3b')]);_0x19b66e[_0xc044('0x3f')]=_['keys'](_0x188f4a[_0xc044('0x3f')]);_0x19b66e[_0xc044('0x41')]=_[_0xc044('0x42')](_0x19b66e['model'],_0x19b66e[_0xc044('0x3f')]);_0x494d03['attributes']=_[_0xc044('0x42')](_0x19b66e[_0xc044('0x3d')],qs[_0xc044('0x44')](_0x188f4a[_0xc044('0x3f')][_0xc044('0x44')]));_0x494d03[_0xc044('0x43')]=_0x494d03[_0xc044('0x43')][_0xc044('0x45')]?_0x494d03[_0xc044('0x43')]:_0x19b66e[_0xc044('0x3d')];if(!_0x188f4a[_0xc044('0x3f')][_0xc044('0x66')](_0xc044('0x46'))){_0x494d03[_0xc044('0x2e')]=qs['limit'](_0x188f4a[_0xc044('0x3f')][_0xc044('0x2e')]);_0x494d03[_0xc044('0x2d')]=qs['offset'](_0x188f4a[_0xc044('0x3f')][_0xc044('0x2d')]);}_0x494d03[_0xc044('0x47')]=qs['sort'](_0x188f4a[_0xc044('0x3f')][_0xc044('0x48')]);_0x494d03['where']=qs[_0xc044('0x41')](_['pick'](_0x188f4a[_0xc044('0x3f')],_0x19b66e[_0xc044('0x41')]));_0x494d03[_0xc044('0x4c')]['ChatWebsiteId']=_0x5920e9['id'];if(_0x188f4a[_0xc044('0x3f')][_0xc044('0x4a')]){_0x494d03[_0xc044('0x4c')]=_['merge'](_0x494d03['where'],{'$or':_['map'](_0x494d03[_0xc044('0x43')],function(_0x57b9e4){var _0x108f6e={};_0x108f6e[_0x57b9e4]={'$like':'%'+_0x188f4a[_0xc044('0x3f')][_0xc044('0x4a')]+'%'};return _0x108f6e;})});}_0x494d03=_[_0xc044('0x4b')]({},_0x494d03,_0x188f4a['options']);return db[_0xc044('0xd2')][_0xc044('0x2c')]({'where':_0x494d03[_0xc044('0x4c')]})[_0xc044('0x1e')](function(_0x19d295){_0x2aeef6[_0xc044('0x2c')]=_0x19d295;if(_0x188f4a[_0xc044('0x3f')][_0xc044('0x51')]){_0x494d03['include']=[{'all':!![]}];}else{_0x494d03[_0xc044('0x56')]=[{'model':db[_0xc044('0x8c')],'as':'Contact','required':![]}];}return db['ChatOfflineMessage'][_0xc044('0x52')](_0x494d03);})[_0xc044('0x1e')](function(_0x5c9b53){_0x2aeef6[_0xc044('0x67')]=_0x5c9b53;return _0x2aeef6;});}})[_0xc044('0x1e')](respondWithFilteredResult(_0x1c5d0f,_0x494d03))['catch'](handleError(_0x1c5d0f,null));};exports[_0xc044('0x10e')]=function(_0x2fc499,_0x5b5016,_0x5cabac){return db[_0xc044('0x50')][_0xc044('0x57')]({'where':{'id':_0x2fc499[_0xc044('0x54')]['id']}})[_0xc044('0x1e')](handleEntityNotFound(_0x5b5016,null))['then'](function(_0x22611b){if(_0x22611b){return _0x22611b[_0xc044('0x10e')](_0x2fc499[_0xc044('0x59')]['ids'],_['omit'](_0x2fc499['body'],['ids','id'])||{})['spread'](function(_0x2fd07b){for(var _0x3657c0=0x0;_0x3657c0<_0x2fc499[_0xc044('0x59')]['ids'][_0xc044('0x45')];_0x3657c0+=0x1){socket[_0xc044('0x10f')](_0xc044('0x110'),{'UserId':_0x2fc499[_0xc044('0x59')]['ids'][_0x3657c0],'ChatWebsiteId':_0x2fc499[_0xc044('0x54')]['id']});}return _0x2fd07b;});}})[_0xc044('0x1e')](respondWithResult(_0x5b5016,null))[_0xc044('0x29')](handleError(_0x5b5016,null));};exports['removeAgents']=function(_0x12add5,_0x1186f6,_0x35eeb6){return db[_0xc044('0x50')][_0xc044('0x57')]({'where':{'id':_0x12add5[_0xc044('0x54')]['id']}})[_0xc044('0x1e')](handleEntityNotFound(_0x1186f6,null))['then'](function(_0x849dc3){if(_0x849dc3){return _0x849dc3['removeAgents'](_0x12add5[_0xc044('0x3f')][_0xc044('0x6d')])[_0xc044('0x1e')](function(){if(_[_0xc044('0x111')](_0x12add5[_0xc044('0x3f')]['ids'])){for(var _0xcfa5c3=0x0;_0xcfa5c3<_0x12add5[_0xc044('0x3f')]['ids'][_0xc044('0x45')];_0xcfa5c3+=0x1){socket[_0xc044('0x10f')](_0xc044('0x112'),{'UserId':Number(_0x12add5[_0xc044('0x3f')]['ids'][_0xcfa5c3]),'ChatWebsiteId':Number(_0x12add5[_0xc044('0x54')]['id'])});}}else{socket[_0xc044('0x10f')](_0xc044('0x112'),{'UserId':Number(_0x12add5[_0xc044('0x3f')][_0xc044('0x6d')]),'ChatWebsiteId':Number(_0x12add5['params']['id'])});}});}})[_0xc044('0x1e')](respondWithStatusCode(_0x1186f6,null))['catch'](handleError(_0x1186f6,null));};exports[_0xc044('0x113')]=function(_0x4a71ca,_0x1dc92a,_0x3f350a){var _0x10fd71={};var _0x36e972={};var _0x40fe50;var _0x55c6e3;return db[_0xc044('0x50')][_0xc044('0x65')]({'where':{'id':_0x4a71ca[_0xc044('0x54')]['id']}})[_0xc044('0x1e')](handleEntityNotFound(_0x1dc92a,null))['then'](function(_0x4904f4){if(_0x4904f4){_0x40fe50=_0x4904f4;_0x36e972[_0xc044('0x3d')]=_[_0xc044('0x40')](db[_0xc044('0xc1')]['rawAttributes']);_0x36e972[_0xc044('0x3f')]=_[_0xc044('0x40')](_0x4a71ca['query']);_0x36e972[_0xc044('0x41')]=_['intersection'](_0x36e972[_0xc044('0x3d')],_0x36e972[_0xc044('0x3f')]);_0x10fd71['attributes']=_[_0xc044('0x42')](_0x36e972['model'],qs[_0xc044('0x44')](_0x4a71ca[_0xc044('0x3f')]['fields']));_0x10fd71[_0xc044('0x43')]=_0x10fd71[_0xc044('0x43')]['length']?_0x10fd71[_0xc044('0x43')]:_0x36e972[_0xc044('0x3d')];_0x10fd71[_0xc044('0x47')]=qs[_0xc044('0x48')](_0x4a71ca[_0xc044('0x3f')]['sort']);_0x10fd71['where']=qs[_0xc044('0x41')](_[_0xc044('0x49')](_0x4a71ca[_0xc044('0x3f')],_0x36e972['filters']));if(_0x4a71ca[_0xc044('0x3f')][_0xc044('0x4a')]){_0x10fd71[_0xc044('0x4c')]=_[_0xc044('0x4b')](_0x10fd71[_0xc044('0x4c')],{'$or':_[_0xc044('0x3e')](_0x10fd71[_0xc044('0x43')],function(_0x179bf6){var _0x5ce458={};_0x5ce458[_0x179bf6]={'$like':'%'+_0x4a71ca['query'][_0xc044('0x4a')]+'%'};return _0x5ce458;})});}_0x10fd71=_[_0xc044('0x4b')]({},_0x10fd71,_0x4a71ca[_0xc044('0x4f')]);return _0x40fe50[_0xc044('0x113')](_0x10fd71);}})[_0xc044('0x1e')](function(_0xcd04aa){if(_0xcd04aa){_0x55c6e3=_0xcd04aa[_0xc044('0x45')];if(!_0x4a71ca[_0xc044('0x3f')]['hasOwnProperty']('nolimit')){_0x10fd71[_0xc044('0x2e')]=qs['limit'](_0x4a71ca['query'][_0xc044('0x2e')]);_0x10fd71[_0xc044('0x2d')]=qs[_0xc044('0x2d')](_0x4a71ca['query'][_0xc044('0x2d')]);}return _0x40fe50[_0xc044('0x113')](_0x10fd71);}})[_0xc044('0x1e')](function(_0x3fdb6c){if(_0x3fdb6c){return _0x3fdb6c?{'count':_0x55c6e3,'rows':_0x3fdb6c}:null;}})['then'](respondWithResult(_0x1dc92a,null))[_0xc044('0x29')](handleError(_0x1dc92a,null));}; \ No newline at end of file +var _0xcd89=['index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','ChatWebsite','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChatWebsites','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','Disposition','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','order','removeAnswers','addLogo','file','agentAvatar','filename','addCustomerAvatar','addSystemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','sitepic','existsSync','server/files/images/logos/','root','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','systemAvatar','notify','setUA','headers','user-agent','getResult','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','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','CmList','List','CmContact','DESC','Applications','account','applications','list','asc','Contacts','defaults','ListId','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','format','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','update','created','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','offline','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','server/files/templates/chatOfflineMessage.ejs','toPairs','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','addInteraction','omit','Contact','Owner','Tags','color','tag','Command','getSnippet','iftime\x20%s,%s','interval','timezone','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','Interval','getProactiveActions','License','increment','chatLicenseExceeded','Intervals','push','all','some','readFileSync','utf8','x-real-ip','connection','remoteAddress','virtual','alignment','textColor','addApplications','sequelize','transaction','ChatApplication','bulkCreate','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','onlineForm','items','fromKey','getOfflineMessages','addAgents','removeAgents','isArray','userChatWebsite:remove','emit','getAgents','html-pdf','eml-format','fast-json-patch','moment','bluebird','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./chatWebsite.socket','jayson/promise','http','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','end','status','json','count','limit','apply','reject','save','destroy','get','UserProfileResource','send'];(function(_0x47e741,_0x1d44c6){var _0x1f390c=function(_0x46fb59){while(--_0x46fb59){_0x47e741['push'](_0x47e741['shift']());}};_0x1f390c(++_0x1d44c6);}(_0xcd89,0xe8));var _0x9cd8=function(_0x4eff04,_0x290c3b){_0x4eff04=_0x4eff04-0x0;var _0x5255bd=_0xcd89[_0x4eff04];return _0x5255bd;};'use strict';var pdf=require(_0x9cd8('0x0'));var emlformat=require(_0x9cd8('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9cd8('0x2'));var rp=require('request-promise');var moment=require(_0x9cd8('0x3'));var BPromise=require(_0x9cd8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9cd8('0x5'));var sox=require('sox');var csv=require(_0x9cd8('0x6'));var ejs=require(_0x9cd8('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9cd8('0x8'));var crypto=require(_0x9cd8('0x9'));var jsforce=require(_0x9cd8('0xa'));var deskjs=require(_0x9cd8('0xb'));var toCsv=require(_0x9cd8('0x6'));var querystring=require(_0x9cd8('0xc'));var Papa=require(_0x9cd8('0xd'));var Redis=require(_0x9cd8('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9cd8('0xf'));var as=require(_0x9cd8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9cd8('0x11'))(_0x9cd8('0x12'));var utils=require(_0x9cd8('0x13'));var config=require(_0x9cd8('0x14'));var db=require(_0x9cd8('0x15'))['db'];config[_0x9cd8('0x16')]=_['defaults'](config['redis'],{'host':_0x9cd8('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9cd8('0x16')]));require(_0x9cd8('0x18'))['register'](socket);var jayson=require(_0x9cd8('0x19'));var client=jayson['client'][_0x9cd8('0x1a')]({'port':0x232c});var client9002=jayson[_0x9cd8('0x1b')][_0x9cd8('0x1a')]({'port':0x232a});var client9003=jayson[_0x9cd8('0x1b')][_0x9cd8('0x1a')]({'port':0x232b});function checkPasswordPattern(_0x7b689f,_0x34ef7f,_0x1254d1){if(_0x1254d1){var _0x4d14f6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d14f6[_0x9cd8('0x1c')](_0x34ef7f)){return _0x7b689f;}else{throw new db[(_0x9cd8('0x1d'))][(_0x9cd8('0x1e'))](_0x9cd8('0x1f'));}}else{return _0x7b689f;}}function respondWithRpcPromise(_0x5f3686,_0x19a4d1,_0x5367e9,_0x353054){return new BPromise(function(_0x446b04,_0x47c5a1){var _0x50d5f7=_0x353054||client;return _0x50d5f7[_0x9cd8('0x20')](_0x5f3686,_0x5367e9)[_0x9cd8('0x21')](function(_0x54ed4f){logger[_0x9cd8('0x22')](_0x9cd8('0x23'),_0x19a4d1,_0x9cd8('0x24'));logger['debug'](_0x9cd8('0x25'),_0x19a4d1,_0x9cd8('0x24'),JSON['stringify'](_0x54ed4f));if(_0x54ed4f['error']){if(_0x54ed4f[_0x9cd8('0x26')]['code']===0x1f4){logger['error'](_0x9cd8('0x23'),_0x19a4d1,_0x54ed4f[_0x9cd8('0x26')][_0x9cd8('0x27')]);return _0x47c5a1(_0x54ed4f[_0x9cd8('0x26')][_0x9cd8('0x27')]);}logger[_0x9cd8('0x26')]('ChatWebsite,\x20%s,\x20%s',_0x19a4d1,_0x54ed4f[_0x9cd8('0x26')][_0x9cd8('0x27')]);return _0x446b04(_0x54ed4f[_0x9cd8('0x26')][_0x9cd8('0x27')]);}else{logger['info'](_0x9cd8('0x23'),_0x19a4d1,_0x9cd8('0x24'));_0x446b04(_0x54ed4f['result']['message']);}})[_0x9cd8('0x28')](function(_0x592e21){logger[_0x9cd8('0x26')](_0x9cd8('0x23'),_0x19a4d1,_0x592e21);_0x47c5a1(_0x592e21);});});}function respondWithStatusCode(_0x444fec,_0x45449c){_0x45449c=_0x45449c||0xcc;return function(_0x31a9d6){if(_0x31a9d6){return _0x444fec[_0x9cd8('0x29')](_0x45449c);}return _0x444fec['status'](_0x45449c)[_0x9cd8('0x2a')]();};}function respondWithResult(_0x5916ce,_0x3be8a2){_0x3be8a2=_0x3be8a2||0xc8;return function(_0x12a3c0){if(_0x12a3c0){return _0x5916ce[_0x9cd8('0x2b')](_0x3be8a2)[_0x9cd8('0x2c')](_0x12a3c0);}};}function respondWithFilteredResult(_0x152edf,_0x1ebe79){return function(_0x34464f){if(_0x34464f){var _0x580859=_0x34464f[_0x9cd8('0x2d')],_0x47f9a8=_0x1ebe79['offset'],_0x40bd2d=_0x1ebe79['offset']+_0x1ebe79[_0x9cd8('0x2e')],_0x24b469;if(_0x40bd2d>=_0x580859){_0x40bd2d=_0x580859;_0x24b469=0xc8;}else{_0x24b469=0xce;}_0x152edf['status'](_0x24b469);return _0x152edf['set']('Content-Range',_0x47f9a8+'-'+_0x40bd2d+'/'+_0x580859)['json'](_0x34464f);}return null;};}function patchUpdates(_0x3902ac){return function(_0x262fd6){try{jsonpatch[_0x9cd8('0x2f')](_0x262fd6,_0x3902ac,!![]);}catch(_0x1d2fa8){return BPromise[_0x9cd8('0x30')](_0x1d2fa8);}return _0x262fd6[_0x9cd8('0x31')]();};}function saveUpdates(_0x4a0758,_0x225c75){return function(_0x3ef1de){if(_0x3ef1de){return _0x3ef1de['update'](_0x4a0758)[_0x9cd8('0x21')](function(_0x2ee23d){return _0x2ee23d;});}return null;};}function removeEntity(_0x3458e9,_0x1ca935){return function(_0xf2a54f){if(_0xf2a54f){return _0xf2a54f[_0x9cd8('0x32')]()[_0x9cd8('0x21')](function(){var _0x4e7588=_0xf2a54f[_0x9cd8('0x33')]({'plain':!![]});var _0x9170ed='ChatWebsites';return db[_0x9cd8('0x34')]['destroy']({'where':{'type':_0x9170ed,'resourceId':_0x4e7588['id']}})[_0x9cd8('0x21')](function(){return _0xf2a54f;});})[_0x9cd8('0x21')](function(){_0x3458e9[_0x9cd8('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ed366,_0x1d6317){return function(_0x3d3bef){if(!_0x3d3bef){_0x4ed366[_0x9cd8('0x29')](0x194);}return _0x3d3bef;};}function handleError(_0x4436cf,_0x5ead4e){_0x5ead4e=_0x5ead4e||0x1f4;return function(_0x57ec24){logger[_0x9cd8('0x26')](_0x57ec24['stack']);if(_0x57ec24['name']){delete _0x57ec24['name'];}_0x4436cf[_0x9cd8('0x2b')](_0x5ead4e)[_0x9cd8('0x35')](_0x57ec24);};}exports[_0x9cd8('0x36')]=function(_0x502810,_0x1ba63d){var _0x3e7a68={'include':[{'model':db[_0x9cd8('0x37')],'as':_0x9cd8('0x38')}]},_0x1d4ee6={},_0x1b880b={'count':0x0,'rows':[]};var _0x59d225=_[_0x9cd8('0x39')](db['ChatWebsite'][_0x9cd8('0x3a')],function(_0x4b7638){return{'name':_0x4b7638[_0x9cd8('0x3b')],'type':_0x4b7638[_0x9cd8('0x3c')]['key']};});_0x1d4ee6[_0x9cd8('0x3d')]=_[_0x9cd8('0x39')](_0x59d225,_0x9cd8('0x3e'));_0x1d4ee6[_0x9cd8('0x3f')]=_[_0x9cd8('0x40')](_0x502810[_0x9cd8('0x3f')]);_0x1d4ee6[_0x9cd8('0x41')]=_[_0x9cd8('0x42')](_0x1d4ee6['model'],_0x1d4ee6[_0x9cd8('0x3f')]);_0x3e7a68[_0x9cd8('0x43')]=_[_0x9cd8('0x42')](_0x1d4ee6[_0x9cd8('0x3d')],qs[_0x9cd8('0x44')](_0x502810[_0x9cd8('0x3f')][_0x9cd8('0x44')]));_0x3e7a68['attributes']=_0x3e7a68[_0x9cd8('0x43')][_0x9cd8('0x45')]?_0x3e7a68['attributes']:_0x1d4ee6[_0x9cd8('0x3d')];if(!_0x502810['query']['hasOwnProperty'](_0x9cd8('0x46'))){_0x3e7a68[_0x9cd8('0x2e')]=qs[_0x9cd8('0x2e')](_0x502810[_0x9cd8('0x3f')]['limit']);_0x3e7a68[_0x9cd8('0x47')]=qs['offset'](_0x502810[_0x9cd8('0x3f')][_0x9cd8('0x47')]);}_0x3e7a68['order']=qs[_0x9cd8('0x48')](_0x502810[_0x9cd8('0x3f')][_0x9cd8('0x48')]);_0x3e7a68[_0x9cd8('0x49')]=qs['filters'](_[_0x9cd8('0x4a')](_0x502810[_0x9cd8('0x3f')],_0x1d4ee6[_0x9cd8('0x41')]),_0x59d225);if(_0x502810[_0x9cd8('0x3f')][_0x9cd8('0x4b')]){_0x3e7a68[_0x9cd8('0x49')]=_[_0x9cd8('0x4c')](_0x3e7a68[_0x9cd8('0x49')],{'$or':_[_0x9cd8('0x39')](_0x59d225,function(_0x34b47b){if(_0x34b47b[_0x9cd8('0x3c')]!==_0x9cd8('0x4d')){var _0x373b64={};_0x373b64[_0x34b47b['name']]={'$like':'%'+_0x502810[_0x9cd8('0x3f')][_0x9cd8('0x4b')]+'%'};return _0x373b64;}})});}_0x3e7a68=_['merge']({},_0x3e7a68,_0x502810[_0x9cd8('0x4e')]);var _0x24b6c3={'where':_0x3e7a68[_0x9cd8('0x49')]};return db[_0x9cd8('0x4f')]['count'](_0x24b6c3)[_0x9cd8('0x21')](function(_0x2964a0){_0x1b880b[_0x9cd8('0x2d')]=_0x2964a0;if(_0x502810[_0x9cd8('0x3f')][_0x9cd8('0x50')]){_0x3e7a68[_0x9cd8('0x51')]=[{'all':!![]}];}return db['ChatWebsite'][_0x9cd8('0x52')](_0x3e7a68);})[_0x9cd8('0x21')](function(_0x56850e){_0x1b880b[_0x9cd8('0x53')]=_0x56850e;return _0x1b880b;})[_0x9cd8('0x21')](respondWithFilteredResult(_0x1ba63d,_0x3e7a68))[_0x9cd8('0x28')](handleError(_0x1ba63d,null));};exports[_0x9cd8('0x54')]=function(_0x5ada00,_0x1441d9){var _0x5a0808={'raw':![],'where':{'id':_0x5ada00[_0x9cd8('0x55')]['id']},'include':[{'model':db[_0x9cd8('0x37')],'as':_0x9cd8('0x38')}]},_0x3695e8={};_0x3695e8['model']=_['keys'](db[_0x9cd8('0x4f')][_0x9cd8('0x3a')]);_0x3695e8[_0x9cd8('0x3f')]=_[_0x9cd8('0x40')](_0x5ada00['query']);_0x3695e8[_0x9cd8('0x41')]=_[_0x9cd8('0x42')](_0x3695e8['model'],_0x3695e8[_0x9cd8('0x3f')]);_0x5a0808[_0x9cd8('0x43')]=_[_0x9cd8('0x42')](_0x3695e8[_0x9cd8('0x3d')],qs['fields'](_0x5ada00['query'][_0x9cd8('0x44')]));_0x5a0808[_0x9cd8('0x43')]=_0x5a0808[_0x9cd8('0x43')][_0x9cd8('0x45')]?_0x5a0808[_0x9cd8('0x43')]:_0x3695e8[_0x9cd8('0x3d')];if(_0x5ada00[_0x9cd8('0x3f')][_0x9cd8('0x50')]){_0x5a0808[_0x9cd8('0x51')]=[{'all':!![]}];}_0x5a0808=_[_0x9cd8('0x4c')]({},_0x5a0808,_0x5ada00['options']);return db[_0x9cd8('0x4f')][_0x9cd8('0x56')](_0x5a0808)[_0x9cd8('0x21')](handleEntityNotFound(_0x1441d9,null))[_0x9cd8('0x21')](respondWithResult(_0x1441d9,null))[_0x9cd8('0x28')](handleError(_0x1441d9,null));};exports[_0x9cd8('0x57')]=function(_0x315bf6,_0x5382b9){return db[_0x9cd8('0x4f')]['create'](_0x315bf6[_0x9cd8('0x58')],{})[_0x9cd8('0x21')](function(_0x3bc0ba){var _0x16c953=_0x315bf6['user'][_0x9cd8('0x33')]({'plain':!![]});if(!_0x16c953)throw new Error(_0x9cd8('0x59'));if(_0x16c953[_0x9cd8('0x5a')]===_0x9cd8('0x5b')){var _0x49a2b3=_0x3bc0ba['get']({'plain':!![]});var _0x61430b=_0x9cd8('0x5c');return db['UserProfileSection'][_0x9cd8('0x56')]({'where':{'name':_0x61430b,'userProfileId':_0x16c953['userProfileId']},'raw':!![]})[_0x9cd8('0x21')](function(_0x5b9532){if(_0x5b9532&&_0x5b9532['autoAssociation']===0x0){return db['UserProfileResource'][_0x9cd8('0x57')]({'name':_0x49a2b3[_0x9cd8('0x3e')],'resourceId':_0x49a2b3['id'],'type':_0x5b9532[_0x9cd8('0x3e')],'sectionId':_0x5b9532['id']},{})['then'](function(){return _0x3bc0ba;});}else{return _0x3bc0ba;}})[_0x9cd8('0x28')](function(_0x187212){logger[_0x9cd8('0x26')](_0x9cd8('0x5d'),_0x187212);throw _0x187212;});}return _0x3bc0ba;})[_0x9cd8('0x21')](respondWithResult(_0x5382b9,0xc9))[_0x9cd8('0x28')](handleError(_0x5382b9,null));};exports['update']=function(_0x25fc7b,_0x767360){if(_0x25fc7b[_0x9cd8('0x58')]['id']){delete _0x25fc7b[_0x9cd8('0x58')]['id'];}return db[_0x9cd8('0x4f')][_0x9cd8('0x56')]({'where':{'id':_0x25fc7b['params']['id']},'include':[{'model':db[_0x9cd8('0x37')],'as':_0x9cd8('0x38')}]})[_0x9cd8('0x21')](handleEntityNotFound(_0x767360,null))['then'](saveUpdates(_0x25fc7b[_0x9cd8('0x58')],null))['then'](respondWithResult(_0x767360,null))[_0x9cd8('0x28')](handleError(_0x767360,null));};exports[_0x9cd8('0x32')]=function(_0x53534e,_0x179d3f){return db['ChatWebsite'][_0x9cd8('0x56')]({'where':{'id':_0x53534e[_0x9cd8('0x55')]['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x179d3f,null))[_0x9cd8('0x21')](removeEntity(_0x179d3f,null))[_0x9cd8('0x28')](handleError(_0x179d3f,null));};exports[_0x9cd8('0x5e')]=function(_0x4d2637,_0x5f053f){return db[_0x9cd8('0x4f')][_0x9cd8('0x5e')]()[_0x9cd8('0x21')](respondWithResult(_0x5f053f,null))['catch'](handleError(_0x5f053f,null));};exports[_0x9cd8('0x5f')]=function(_0x3bf493,_0x3028bb,_0x495fdc){if(_0x3bf493[_0x9cd8('0x58')]['id']){delete _0x3bf493[_0x9cd8('0x58')]['id'];}return db[_0x9cd8('0x4f')][_0x9cd8('0x56')]({'where':{'id':_0x3bf493['params']['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x3028bb,null))[_0x9cd8('0x21')](function(_0x1cafdd){if(_0x1cafdd){_0x3bf493[_0x9cd8('0x58')][_0x9cd8('0x60')]=_0x1cafdd['id'];return db['Disposition'][_0x9cd8('0x57')](_0x3bf493['body']);}})[_0x9cd8('0x21')](respondWithResult(_0x3028bb,null))[_0x9cd8('0x28')](handleError(_0x3028bb,null));};exports[_0x9cd8('0x61')]=function(_0x2e87c3,_0x17391a,_0x49a708){var _0x356fb8={'raw':![],'where':{}};var _0x5ac0a9={};var _0xe1891c={'count':0x0,'rows':[]};return db[_0x9cd8('0x4f')][_0x9cd8('0x62')]({'where':{'id':_0x2e87c3['params']['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x17391a,null))[_0x9cd8('0x21')](function(_0x3994be){if(_0x3994be){_0x5ac0a9[_0x9cd8('0x3d')]=_[_0x9cd8('0x40')](db[_0x9cd8('0x63')][_0x9cd8('0x3a')]);_0x5ac0a9[_0x9cd8('0x3f')]=_['keys'](_0x2e87c3[_0x9cd8('0x3f')]);_0x5ac0a9[_0x9cd8('0x41')]=_['intersection'](_0x5ac0a9[_0x9cd8('0x3d')],_0x5ac0a9[_0x9cd8('0x3f')]);_0x356fb8[_0x9cd8('0x43')]=_[_0x9cd8('0x42')](_0x5ac0a9[_0x9cd8('0x3d')],qs[_0x9cd8('0x44')](_0x2e87c3[_0x9cd8('0x3f')][_0x9cd8('0x44')]));_0x356fb8[_0x9cd8('0x43')]=_0x356fb8['attributes']['length']?_0x356fb8[_0x9cd8('0x43')]:_0x5ac0a9[_0x9cd8('0x3d')];if(!_0x2e87c3[_0x9cd8('0x3f')][_0x9cd8('0x64')]('nolimit')){_0x356fb8[_0x9cd8('0x2e')]=qs[_0x9cd8('0x2e')](_0x2e87c3[_0x9cd8('0x3f')][_0x9cd8('0x2e')]);_0x356fb8['offset']=qs[_0x9cd8('0x47')](_0x2e87c3['query']['offset']);}_0x356fb8['order']=qs[_0x9cd8('0x48')](_0x2e87c3[_0x9cd8('0x3f')]['sort']);_0x356fb8[_0x9cd8('0x49')]=qs[_0x9cd8('0x41')](_[_0x9cd8('0x4a')](_0x2e87c3[_0x9cd8('0x3f')],_0x5ac0a9[_0x9cd8('0x41')]));_0x356fb8[_0x9cd8('0x49')]['ChatWebsiteId']=_0x3994be['id'];if(_0x2e87c3[_0x9cd8('0x3f')][_0x9cd8('0x4b')]){_0x356fb8['where']=_[_0x9cd8('0x4c')](_0x356fb8[_0x9cd8('0x49')],{'$or':_['map'](_0x356fb8['attributes'],function(_0x3b9e84){var _0x458831={};_0x458831[_0x3b9e84]={'$like':'%'+_0x2e87c3[_0x9cd8('0x3f')]['filter']+'%'};return _0x458831;})});}_0x356fb8=_[_0x9cd8('0x4c')]({},_0x356fb8,_0x2e87c3['options']);return db[_0x9cd8('0x63')][_0x9cd8('0x2d')]({'where':_0x356fb8[_0x9cd8('0x49')]})[_0x9cd8('0x21')](function(_0x1094cb){_0xe1891c['count']=_0x1094cb;if(_0x2e87c3[_0x9cd8('0x3f')][_0x9cd8('0x50')]){_0x356fb8[_0x9cd8('0x51')]=[{'all':!![]}];}return db['Disposition'][_0x9cd8('0x52')](_0x356fb8);})['then'](function(_0x22a381){_0xe1891c[_0x9cd8('0x53')]=_0x22a381;return _0xe1891c;});}})['then'](respondWithFilteredResult(_0x17391a,_0x356fb8))[_0x9cd8('0x28')](handleError(_0x17391a,null));};exports['removeDispositions']=function(_0x2de1dc,_0x21316b,_0x12e558){return db[_0x9cd8('0x4f')]['find']({'where':{'id':_0x2de1dc[_0x9cd8('0x55')]['id']}})['then'](handleEntityNotFound(_0x21316b,null))[_0x9cd8('0x21')](function(_0xa39a0d){if(_0xa39a0d){return _0xa39a0d[_0x9cd8('0x65')](_0x2de1dc[_0x9cd8('0x3f')][_0x9cd8('0x66')]);}})['then'](respondWithStatusCode(_0x21316b,null))[_0x9cd8('0x28')](handleError(_0x21316b,null));};exports[_0x9cd8('0x67')]=function(_0x97e5d6,_0x4c4d8f,_0x439d2d){if(_0x97e5d6[_0x9cd8('0x58')]['id']){delete _0x97e5d6[_0x9cd8('0x58')]['id'];}return db[_0x9cd8('0x4f')]['find']({'where':{'id':_0x97e5d6['params']['id']}})['then'](handleEntityNotFound(_0x4c4d8f,null))[_0x9cd8('0x21')](function(_0x2effd2){if(_0x2effd2){_0x97e5d6[_0x9cd8('0x58')][_0x9cd8('0x60')]=_0x2effd2['id'];return db[_0x9cd8('0x68')][_0x9cd8('0x57')](_0x97e5d6[_0x9cd8('0x58')]);}})['then'](respondWithResult(_0x4c4d8f,null))[_0x9cd8('0x28')](handleError(_0x4c4d8f,null));};exports[_0x9cd8('0x69')]=function(_0x8a03b1,_0x3f1e18,_0x478e73){var _0xfdeb4={'raw':![],'where':{}};var _0x238f85={};var _0x173d7a={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x9cd8('0x62')]({'where':{'id':_0x8a03b1[_0x9cd8('0x55')]['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x3f1e18,null))[_0x9cd8('0x21')](function(_0x3e6aee){if(_0x3e6aee){_0x238f85['model']=_[_0x9cd8('0x40')](db['CannedAnswer'][_0x9cd8('0x3a')]);_0x238f85['query']=_['keys'](_0x8a03b1[_0x9cd8('0x3f')]);_0x238f85[_0x9cd8('0x41')]=_['intersection'](_0x238f85['model'],_0x238f85[_0x9cd8('0x3f')]);_0xfdeb4[_0x9cd8('0x43')]=_['intersection'](_0x238f85['model'],qs[_0x9cd8('0x44')](_0x8a03b1[_0x9cd8('0x3f')][_0x9cd8('0x44')]));_0xfdeb4[_0x9cd8('0x43')]=_0xfdeb4['attributes']['length']?_0xfdeb4[_0x9cd8('0x43')]:_0x238f85[_0x9cd8('0x3d')];if(!_0x8a03b1['query'][_0x9cd8('0x64')](_0x9cd8('0x46'))){_0xfdeb4[_0x9cd8('0x2e')]=qs[_0x9cd8('0x2e')](_0x8a03b1[_0x9cd8('0x3f')]['limit']);_0xfdeb4['offset']=qs[_0x9cd8('0x47')](_0x8a03b1[_0x9cd8('0x3f')][_0x9cd8('0x47')]);}_0xfdeb4[_0x9cd8('0x6a')]=qs[_0x9cd8('0x48')](_0x8a03b1[_0x9cd8('0x3f')][_0x9cd8('0x48')]);_0xfdeb4['where']=qs[_0x9cd8('0x41')](_[_0x9cd8('0x4a')](_0x8a03b1[_0x9cd8('0x3f')],_0x238f85['filters']));_0xfdeb4['where'][_0x9cd8('0x60')]=_0x3e6aee['id'];if(_0x8a03b1[_0x9cd8('0x3f')][_0x9cd8('0x4b')]){_0xfdeb4[_0x9cd8('0x49')]=_[_0x9cd8('0x4c')](_0xfdeb4['where'],{'$or':_[_0x9cd8('0x39')](_0xfdeb4[_0x9cd8('0x43')],function(_0x327eab){var _0x4496b2={};_0x4496b2[_0x327eab]={'$like':'%'+_0x8a03b1[_0x9cd8('0x3f')]['filter']+'%'};return _0x4496b2;})});}_0xfdeb4=_[_0x9cd8('0x4c')]({},_0xfdeb4,_0x8a03b1['options']);return db[_0x9cd8('0x68')][_0x9cd8('0x2d')]({'where':_0xfdeb4[_0x9cd8('0x49')]})['then'](function(_0x5d32a7){_0x173d7a[_0x9cd8('0x2d')]=_0x5d32a7;if(_0x8a03b1[_0x9cd8('0x3f')][_0x9cd8('0x50')]){_0xfdeb4['include']=[{'all':!![]}];}return db[_0x9cd8('0x68')][_0x9cd8('0x52')](_0xfdeb4);})['then'](function(_0x22e2dd){_0x173d7a[_0x9cd8('0x53')]=_0x22e2dd;return _0x173d7a;});}})['then'](respondWithFilteredResult(_0x3f1e18,_0xfdeb4))[_0x9cd8('0x28')](handleError(_0x3f1e18,null));};exports['removeAnswers']=function(_0x38009c,_0x1a6939,_0x38dfc1){return db['ChatWebsite']['find']({'where':{'id':_0x38009c[_0x9cd8('0x55')]['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x1a6939,null))[_0x9cd8('0x21')](function(_0x45b164){if(_0x45b164){return _0x45b164[_0x9cd8('0x6b')](_0x38009c[_0x9cd8('0x3f')][_0x9cd8('0x66')]);}})[_0x9cd8('0x21')](respondWithStatusCode(_0x1a6939,null))[_0x9cd8('0x28')](handleError(_0x1a6939,null));};exports[_0x9cd8('0x6c')]=function(_0x5a065a,_0x580c65,_0x422329){_0x5a065a[_0x9cd8('0x58')]['sitepic']=_0x5a065a[_0x9cd8('0x6d')]['filename'];return db['ChatWebsite'][_0x9cd8('0x56')]({'where':{'id':_0x5a065a['params']['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x580c65,null))[_0x9cd8('0x21')](saveUpdates(_0x5a065a[_0x9cd8('0x58')],null))[_0x9cd8('0x21')](respondWithResult(_0x580c65,null))[_0x9cd8('0x28')](handleError(_0x580c65,null));};exports['addAvatar']=function(_0x2ce955,_0x21c308,_0x37be74){_0x2ce955[_0x9cd8('0x58')][_0x9cd8('0x6e')]=_0x2ce955['file'][_0x9cd8('0x6f')];return db[_0x9cd8('0x4f')][_0x9cd8('0x56')]({'where':{'id':_0x2ce955[_0x9cd8('0x55')]['id']}})['then'](handleEntityNotFound(_0x21c308,null))['then'](saveUpdates(_0x2ce955['body'],null))['then'](respondWithResult(_0x21c308,null))[_0x9cd8('0x28')](handleError(_0x21c308,null));};exports[_0x9cd8('0x70')]=function(_0x31fc56,_0xbcfdd9,_0x19419c){_0x31fc56['body']['customerAvatar']=_0x31fc56[_0x9cd8('0x6d')][_0x9cd8('0x6f')];return db['ChatWebsite'][_0x9cd8('0x56')]({'where':{'id':_0x31fc56['params']['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0xbcfdd9,null))[_0x9cd8('0x21')](saveUpdates(_0x31fc56['body'],null))[_0x9cd8('0x21')](respondWithResult(_0xbcfdd9,null))[_0x9cd8('0x28')](handleError(_0xbcfdd9,null));};exports[_0x9cd8('0x71')]=function(_0xd7267,_0x3fcaac,_0x2718b0){_0xd7267['body']['systemAvatar']=_0xd7267[_0x9cd8('0x6d')][_0x9cd8('0x6f')];return db['ChatWebsite'][_0x9cd8('0x56')]({'where':{'id':_0xd7267[_0x9cd8('0x55')]['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x3fcaac,null))[_0x9cd8('0x21')](saveUpdates(_0xd7267[_0x9cd8('0x58')],null))[_0x9cd8('0x21')](respondWithResult(_0x3fcaac,null))[_0x9cd8('0x28')](handleError(_0x3fcaac,null));};exports[_0x9cd8('0x72')]=function(_0x347f9c,_0x4bfab6,_0x2577a5){var _0x265895=path[_0x9cd8('0x73')](config['root'],_0x9cd8('0x74'));var _0x408b6d={'where':{'id':_0x347f9c[_0x9cd8('0x55')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x5944f4=![];return require(_0x9cd8('0x75'))[_0x9cd8('0x76')]()['then'](function(_0x71947){if(_0x71947){_0x5944f4=_0x71947[_0x9cd8('0x77')];}})[_0x9cd8('0x21')](function(){return db['ChatWebsite'][_0x9cd8('0x56')](_0x408b6d);})[_0x9cd8('0x21')](handleEntityNotFound(_0x4bfab6,null))[_0x9cd8('0x21')](function(_0x548837){if(_0x548837){if(!_[_0x9cd8('0x78')](_0x548837[_0x9cd8('0x79')])){if(fs[_0x9cd8('0x7a')](path['join'](config['root'],_0x9cd8('0x7b'),_0x548837[_0x9cd8('0x79')]))&&_0x5944f4){_0x265895=path['join'](config[_0x9cd8('0x7c')],_0x9cd8('0x7b'),_0x548837[_0x9cd8('0x79')]);}}return _0x4bfab6[_0x9cd8('0x7d')](_0x265895);}})[_0x9cd8('0x28')](handleError(_0x4bfab6,null));};exports[_0x9cd8('0x7e')]=function(_0x413da2,_0x504332,_0x16f057){var _0x1f7315=path[_0x9cd8('0x73')](config['root'],'server/files/images/avatars/default_avatar.png');var _0x489e74={'where':{'id':_0x413da2[_0x9cd8('0x55')]['id']},'attributes':['id',_0x9cd8('0x6e')],'raw':!![]};return db[_0x9cd8('0x4f')][_0x9cd8('0x56')](_0x489e74)['then'](handleEntityNotFound(_0x504332,null))['then'](function(_0x522093){if(_0x522093){if(!_[_0x9cd8('0x78')](_0x522093[_0x9cd8('0x6e')])){if(fs[_0x9cd8('0x7a')](path[_0x9cd8('0x73')](config[_0x9cd8('0x7c')],_0x9cd8('0x7f'),_0x522093['agentAvatar']))){_0x1f7315=path[_0x9cd8('0x73')](config['root'],_0x9cd8('0x7f'),_0x522093[_0x9cd8('0x6e')]);}}return _0x504332['download'](_0x1f7315);}})['catch'](handleError(_0x504332,null));};exports[_0x9cd8('0x80')]=function(_0x22d184,_0x46a11a,_0x289f5a){var _0x33c66c=path[_0x9cd8('0x73')](config['root'],_0x9cd8('0x81'));var _0x464aca={'where':{'id':_0x22d184[_0x9cd8('0x55')]['id']},'attributes':['id',_0x9cd8('0x82'),_0x9cd8('0x83')],'raw':!![]};return db[_0x9cd8('0x4f')][_0x9cd8('0x56')](_0x464aca)[_0x9cd8('0x21')](handleEntityNotFound(_0x46a11a,null))[_0x9cd8('0x21')](function(_0x3262a1){if(_0x3262a1){if(!_[_0x9cd8('0x78')](_0x3262a1[_0x9cd8('0x82')])){if(fs[_0x9cd8('0x7a')](path['join'](config[_0x9cd8('0x7c')],'server/files/images/avatars/',_0x3262a1['customerAvatar']))&&_0x3262a1['showCustomerAvatar']){_0x33c66c=path['join'](config[_0x9cd8('0x7c')],_0x9cd8('0x7f'),_0x3262a1[_0x9cd8('0x82')]);}}return _0x46a11a[_0x9cd8('0x7d')](_0x33c66c);}})[_0x9cd8('0x28')](handleError(_0x46a11a,null));};exports[_0x9cd8('0x84')]=function(_0x50e752,_0x5be84b,_0x129089){var _0x3b632f=path[_0x9cd8('0x73')](config[_0x9cd8('0x7c')],'server/files/images/avatars/system_avatar.png');var _0xb898f2={'where':{'id':_0x50e752[_0x9cd8('0x55')]['id']},'attributes':['id',_0x9cd8('0x85')],'raw':!![]};return db[_0x9cd8('0x4f')][_0x9cd8('0x56')](_0xb898f2)['then'](handleEntityNotFound(_0x5be84b,null))[_0x9cd8('0x21')](function(_0x41f74f){if(_0x41f74f){if(!_[_0x9cd8('0x78')](_0x41f74f['systemAvatar'])){if(fs[_0x9cd8('0x7a')](path[_0x9cd8('0x73')](config[_0x9cd8('0x7c')],_0x9cd8('0x7f'),_0x41f74f[_0x9cd8('0x85')]))){_0x3b632f=path['join'](config[_0x9cd8('0x7c')],_0x9cd8('0x7f'),_0x41f74f['systemAvatar']);}}return _0x5be84b[_0x9cd8('0x7d')](_0x3b632f);}})[_0x9cd8('0x28')](handleError(_0x5be84b,null));};exports[_0x9cd8('0x86')]=function(_0x1d3066,_0x4ce01c,_0x5af59c){var _0x2db4b0=require('user-agent-parser');var _0x1d1025=new _0x2db4b0();var _0x2d1491=_0x1d1025[_0x9cd8('0x87')](_0x1d3066[_0x9cd8('0x88')][_0x9cd8('0x89')])[_0x9cd8('0x8a')]();var _0x561b9d={'body':_0x1d3066[_0x9cd8('0x58')],'channel':'chat'};var _0x336df1=[];var _0xe1c04b=[];var _0x31d1ea={};var _0x3033f4=![];return db['CmContact'][_0x9cd8('0x5e')]()[_0x9cd8('0x21')](function(_0x23ec3b){if(!_0x23ec3b){throw new db[(_0x9cd8('0x1d'))][(_0x9cd8('0x1e'))](_0x9cd8('0x8b'));}_0x336df1=_[_0x9cd8('0x8c')](_[_0x9cd8('0x40')](_0x23ec3b),[_0x9cd8('0x8d'),_0x9cd8('0x8e')]);_0xe1c04b=_[_0x9cd8('0x8c')](_[_0x9cd8('0x40')](_0x23ec3b),[_0x9cd8('0x8d'),'updatedAt',_0x9cd8('0x8f'),'ListId']);if(_0x1d3066[_0x9cd8('0x58')]['id']){delete _0x1d3066[_0x9cd8('0x58')]['id'];}if(_['isNil'](_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0x90')])){throw new db['Sequelize'][(_0x9cd8('0x1e'))](_0x9cd8('0x91'));}if(_['isNil'](_0x1d3066[_0x9cd8('0x58')]['body'])||_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0x58')]===''){throw new db[(_0x9cd8('0x1d'))][(_0x9cd8('0x1e'))](_0x9cd8('0x92'));}if(_[_0x9cd8('0x78')](_0x1d3066[_0x9cd8('0x58')]['mapKey'])){throw new db[(_0x9cd8('0x1d'))][(_0x9cd8('0x1e'))](_0x9cd8('0x93')+_0xe1c04b);}if(!_[_0x9cd8('0x94')](_0xe1c04b,_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0x95')])){throw new db[(_0x9cd8('0x1d'))][(_0x9cd8('0x1e'))](_0x9cd8('0x96')+_0xe1c04b);}_0x31d1ea[_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0x95')]]=_0x1d3066[_0x9cd8('0x58')]['from'];})[_0x9cd8('0x21')](function(){return db[_0x9cd8('0x4f')][_0x9cd8('0x56')]({'where':{'id':_0x1d3066[_0x9cd8('0x55')]['id']},'include':[{'model':db[_0x9cd8('0x97')],'as':_0x9cd8('0x98'),'include':[{'model':db[_0x9cd8('0x99')],'as':'Contacts','where':_0x31d1ea,'limit':0x1,'order':[[_0x9cd8('0x8e'),_0x9cd8('0x9a')]]}]},{'model':db['ChatApplication'],'as':_0x9cd8('0x9b')}]});})['then'](handleEntityNotFound(_0x4ce01c,null))['then'](function(_0x30fb6e){if(_0x30fb6e&&_0x30fb6e[_0x9cd8('0x98')]){_0x561b9d[_0x9cd8('0x9c')]=_0x30fb6e;_0x561b9d[_0x9cd8('0x9d')]=_0x30fb6e[_0x9cd8('0x9b')];_0x561b9d[_0x9cd8('0x9e')]=_0x30fb6e['List'];_0x561b9d[_0x9cd8('0x9d')]=_['orderBy'](_0x561b9d[_0x9cd8('0x9d')],['priority'],[_0x9cd8('0x9f')]);if(_0x561b9d['account'][_0x9cd8('0x9b')]){delete _0x561b9d['account'][_0x9cd8('0x9b')];}if(_0x561b9d[_0x9cd8('0x9c')]['List']&&_0x561b9d[_0x9cd8('0x9c')][_0x9cd8('0x98')]['Contacts'][_0x9cd8('0x45')]){return _0x561b9d['account'][_0x9cd8('0x98')][_0x9cd8('0xa0')][0x0];}var _0x3fe13f=_[_0x9cd8('0xa1')](_0x1d3066[_0x9cd8('0x58')],{'firstName':_0x1d3066['body']['from'],'ListId':_0x30fb6e[_0x9cd8('0xa2')]});_0x3fe13f[_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0x95')]]=_0x1d3066['body'][_0x9cd8('0x90')];return db[_0x9cd8('0x99')]['create'](_0x3fe13f,{'fields':_0x336df1,'raw':!![]});}})[_0x9cd8('0x21')](handleEntityNotFound(_0x4ce01c,null))['then'](function(_0x16402d){_0x561b9d[_0x9cd8('0xa3')]=_0x16402d;var _0x3ca282=_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0xa4')];if(_0x1d3066[_0x9cd8('0x88')][_0x9cd8('0xa5')]){_0x3ca282=_0x1d3066[_0x9cd8('0x88')]['cf-connecting-ip'];}else if(_0x1d3066[_0x9cd8('0x88')]['x-forwarded-for']){_0x3ca282=_[_0x9cd8('0xa6')](_0x1d3066[_0x9cd8('0x88')][_0x9cd8('0xa7')][_0x9cd8('0xa8')](','));}if(_0x16402d){var _0x450bf8={'ContactId':_0x16402d['id'],'ChatWebsiteId':_0x1d3066['params']['id'],'from':(_0x16402d[_0x9cd8('0xa9')]||'')+'\x20'+(_0x16402d[_0x9cd8('0xaa')]||''),'customerIp':_0x3ca282,'customerPort':_0x1d3066[_0x9cd8('0x88')][_0x9cd8('0xab')]?_0x1d3066[_0x9cd8('0x88')][_0x9cd8('0xab')]:null,'referer':_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0xac')],'browserName':_0x2d1491[_0x9cd8('0xad')][_0x9cd8('0x3e')]&&_0x2d1491['browser'][_0x9cd8('0xae')]?util['format'](_0x9cd8('0xaf'),_0x2d1491[_0x9cd8('0xad')][_0x9cd8('0x3e')],_0x2d1491[_0x9cd8('0xad')][_0x9cd8('0xae')]):_0x9cd8('0xb0'),'browserVersion':_0x2d1491[_0x9cd8('0xad')][_0x9cd8('0xae')]||_0x9cd8('0xb0'),'osName':util[_0x9cd8('0xb1')](_0x9cd8('0xaf'),_0x2d1491['os'][_0x9cd8('0x3e')],_0x2d1491['os'][_0x9cd8('0xae')]),'osVersion':_0x2d1491['os'][_0x9cd8('0xae')],'deviceModel':_0x2d1491[_0x9cd8('0xb2')]['model']&&_0x2d1491[_0x9cd8('0xb2')][_0x9cd8('0xb3')]?util[_0x9cd8('0xb1')](_0x9cd8('0xb4'),_0x2d1491['device']['model'],_0x2d1491[_0x9cd8('0xb2')]['vendor'],_0x2d1491['device']['type']):null,'deviceVendor':_0x2d1491[_0x9cd8('0xb2')][_0x9cd8('0xb3')],'deviceType':_0x2d1491[_0x9cd8('0xb2')][_0x9cd8('0x3c')],'formData':JSON[_0x9cd8('0xb5')](_0x1d3066[_0x9cd8('0x58')])};var _0x26b3ad={'ChatWebsiteId':_0x1d3066['params']['id'],'closed':![]};if(_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0xb6')]){_0x26b3ad[_0x9cd8('0xb6')]=_0x1d3066['body']['threadId'];return db[_0x9cd8('0xb7')][_0x9cd8('0x56')]({'where':_0x26b3ad})[_0x9cd8('0x21')](function(_0x1a9fff){if(_0x1a9fff){return[_0x1a9fff,![]];}_0x450bf8['threadId']=_0x1d3066['body'][_0x9cd8('0xb6')];_0x450bf8['externalUrl']=_0x1d3066['body'][_0x9cd8('0xb8')];return db[_0x9cd8('0xb7')][_0x9cd8('0x57')](_0x450bf8)[_0x9cd8('0x21')](function(_0x246480){return[_0x246480,!![]];});});}_0x26b3ad[_0x9cd8('0xb9')]=_0x16402d['id'];if(_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0xba')]&&_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0xba')]['id']){_0x26b3ad['id']=_0x1d3066[_0x9cd8('0x58')]['interaction']['id'];return db[_0x9cd8('0xb7')][_0x9cd8('0x56')]({'where':_0x26b3ad})['then'](function(_0x8cd0fc){if(_0x8cd0fc){return[_0x8cd0fc,![]];}return db[_0x9cd8('0xb7')][_0x9cd8('0x57')](_0x450bf8)[_0x9cd8('0x21')](function(_0x434e9e){return[_0x434e9e,!![]];});});}return db[_0x9cd8('0xb7')][_0x9cd8('0x57')](_0x450bf8)['then'](function(_0x1f4c09){return[_0x1f4c09,!![]];});}})[_0x9cd8('0xbb')](function(_0x1a8c47,_0x88fe0e){if(_0x1a8c47){_0x3033f4=_0x88fe0e;if(!_0x88fe0e){var _0xc3a323={'from':(_0x561b9d[_0x9cd8('0xa3')][_0x9cd8('0xa9')]||'')+'\x20'+(_0x561b9d['contact'][_0x9cd8('0xaa')]||'')};if(_0x1d3066['body'][_0x9cd8('0xb6')]&&_0x1d3066[_0x9cd8('0x58')]['messageId']&&_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0xb6')]!=_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0xbc')]){_0xc3a323[_0x9cd8('0xb6')]=_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0xbc')];}return _0x1a8c47[_0x9cd8('0xbd')](_0xc3a323);}else{return _0x1a8c47;}}})[_0x9cd8('0x21')](function(_0x493b8e){_0x561b9d[_0x9cd8('0xba')]=_0x493b8e[_0x9cd8('0x33')]({'plain':!![]});_0x561b9d[_0x9cd8('0xba')][_0x9cd8('0xbe')]=_0x3033f4;if(_0x561b9d[_0x9cd8('0xba')][_0x9cd8('0xbe')]){if(_0x561b9d[_0x9cd8('0x9c')]['autoclose']){_0x561b9d[_0x9cd8('0x9d')]['push']({'id':0x0,'priority':_0x561b9d[_0x9cd8('0x9d')][_0x9cd8('0x45')]+0x1,'app':_0x9cd8('0xbf'),'appdata':_0x9cd8('0xc0'),'interval':_0x9cd8('0xc1')});}}return db['ChatMessage'][_0x9cd8('0x57')]({'body':_0x1d3066['body']['body'],'ChatWebsiteId':_0x1d3066[_0x9cd8('0x55')]['id'],'ChatInteractionId':_0x493b8e['id'],'direction':'in','ContactId':_0x561b9d['contact']['id'],'AttachmentId':_0x1d3066[_0x9cd8('0x58')][_0x9cd8('0xc2')]});})[_0x9cd8('0x21')](function(_0x639475){_0x561b9d[_0x9cd8('0x27')]=_0x639475;if(_0x561b9d[_0x9cd8('0xba')][_0x9cd8('0xc3')]){return db[_0x9cd8('0xc4')][_0x9cd8('0x56')]({'attributes':['id',_0x9cd8('0x3e')],'where':{'id':_0x561b9d['interaction'][_0x9cd8('0xc3')]}})['then'](function(_0x418b09){if(_0x418b09){_0x561b9d[_0x9cd8('0x9d')][_0x9cd8('0xc5')]({'id':0x0,'priority':0x0,'app':_0x9cd8('0xc6'),'appdata':_0x418b09[_0x9cd8('0x3e')]+','+(_0x561b9d[_0x9cd8('0x9c')][_0x9cd8('0xc7')]||0xa),'interval':'*,*,*,*'});_0x561b9d[_0x9cd8('0xc8')]=!![];}return respondWithRpcPromise('Start',_0x9cd8('0xc9'),_0x561b9d);});}return respondWithRpcPromise(_0x9cd8('0xca'),_0x9cd8('0xc9'),_0x561b9d);})[_0x9cd8('0x21')](function(_0x1f79f2){respondWithRpcPromise(_0x9cd8('0xcb'),_0x9cd8('0xcb'),{'event':_0x9cd8('0x86'),'message':_0x1f79f2},client9002);return _0x1f79f2;})['then'](respondWithResult(_0x4ce01c,null))[_0x9cd8('0x28')](handleError(_0x4ce01c,null));};exports[_0x9cd8('0xcc')]=function(_0x1bc1d7,_0x102809,_0x5777d9){var _0xaabf64,_0x5bfb0b,_0x4b9b3c;var _0x1761cc=[];var _0x51e689=[];var _0x55b095={};return db[_0x9cd8('0x99')][_0x9cd8('0x5e')]()[_0x9cd8('0x21')](function(_0x2f94d2){if(!_0x2f94d2){throw new db[(_0x9cd8('0x1d'))][(_0x9cd8('0x1e'))]('no\x20available\x20attributes');}_0x51e689=_[_0x9cd8('0x8c')](_[_0x9cd8('0x40')](_0x2f94d2),[_0x9cd8('0x8d'),'updatedAt']);_0x1761cc=_[_0x9cd8('0x8c')](_[_0x9cd8('0x40')](_0x2f94d2),[_0x9cd8('0x8d'),'updatedAt',_0x9cd8('0x8f'),_0x9cd8('0xa2')]);if(_0x1bc1d7[_0x9cd8('0x58')]['id']){delete _0x1bc1d7[_0x9cd8('0x58')]['id'];}if(_[_0x9cd8('0x78')](_0x1bc1d7[_0x9cd8('0x58')][_0x9cd8('0x90')])){throw _0x102809[_0x9cd8('0x2b')](0x1f4)[_0x9cd8('0x35')](new db[(_0x9cd8('0x1d'))][(_0x9cd8('0x1e'))](_0x9cd8('0x91')));}if(_[_0x9cd8('0x78')](_0x1bc1d7[_0x9cd8('0x58')]['body'])||_0x1bc1d7[_0x9cd8('0x58')][_0x9cd8('0x58')]===''){throw _0x102809[_0x9cd8('0x2b')](0x1f4)['send'](new db[(_0x9cd8('0x1d'))][(_0x9cd8('0x1e'))](_0x9cd8('0x92')));}if(_[_0x9cd8('0x78')](_0x1bc1d7[_0x9cd8('0x58')][_0x9cd8('0xcd')])){throw _0x102809['status'](0x1f4)['send'](new db[(_0x9cd8('0x1d'))][(_0x9cd8('0x1e'))](_0x9cd8('0xce')+_0x1761cc));}if(!_[_0x9cd8('0x94')](_0x1761cc,_0x1bc1d7['body'][_0x9cd8('0xcd')])){throw _0x102809[_0x9cd8('0x2b')](0x1f4)[_0x9cd8('0x35')](new db[(_0x9cd8('0x1d'))][(_0x9cd8('0x1e'))](_0x9cd8('0xcf')+_0x1761cc));}_0x55b095[_0x1bc1d7['body']['mapKeyOffline']]=_0x1bc1d7[_0x9cd8('0x58')][_0x9cd8('0x90')];})[_0x9cd8('0x21')](function(){return db[_0x9cd8('0x4f')][_0x9cd8('0x56')]({'where':{'id':_0x1bc1d7[_0x9cd8('0x55')]['id']},'include':[{'model':db[_0x9cd8('0x97')],'as':_0x9cd8('0x98')}]});})['then'](handleEntityNotFound(_0x102809,null))[_0x9cd8('0x21')](function(_0x5dbb6a){if(_0x5dbb6a&&_0x5dbb6a['List']){_0x5bfb0b=_0x5dbb6a;var _0x1e6d76=_[_0x9cd8('0xa1')](_0x1bc1d7[_0x9cd8('0x58')],{'firstName':_0x1bc1d7[_0x9cd8('0x58')][_0x9cd8('0x90')],'phone':_0x1bc1d7[_0x9cd8('0x58')][_0x9cd8('0x90')],'ListId':_0x5dbb6a[_0x9cd8('0xa2')]});_0x1e6d76[_0x1bc1d7[_0x9cd8('0x58')][_0x9cd8('0xcd')]]=_0x1bc1d7[_0x9cd8('0x58')][_0x9cd8('0x90')];return db[_0x9cd8('0x99')][_0x9cd8('0xd0')]({'where':_0x55b095,'defaults':_0x1e6d76});}})[_0x9cd8('0xbb')](function(_0x303afe){if(_0x303afe){_0x4b9b3c=_0x303afe;var _0x2e96ed=fs['readFileSync'](path[_0x9cd8('0x73')](config[_0x9cd8('0x7c')],_0x9cd8('0xd1')),'utf8');var _0x38778f=ejs['render'](_0x2e96ed,{'body':_[_0x9cd8('0xd2')](_0x1bc1d7[_0x9cd8('0x58')][_0x9cd8('0x58')]),'bodyTitle':_0x5bfb0b['offlineMessageBody']});return db[_0x9cd8('0xd3')][_0x9cd8('0x57')]({'body':_0x38778f,'ContactId':_0x303afe['id'],'ChatWebsiteId':_0x5bfb0b['id']});}})[_0x9cd8('0x21')](function(_0x4cd014){if(_0x4cd014){_0xaabf64=_0x4cd014;return db[_0x9cd8('0xd4')][_0x9cd8('0x62')]({'where':{'service':!![]},'include':[{'model':db[_0x9cd8('0xd5')],'as':_0x9cd8('0xd6'),'raw':!![]}]});}})[_0x9cd8('0x21')](function(_0x41f6ee){if(_0x41f6ee&&_0x41f6ee[_0x9cd8('0xd6')]&&_0x5bfb0b[_0x9cd8('0xd7')]){var _0x199e65={'tls':{'rejectUnauthorized':![]}};if(_0x41f6ee[_0x9cd8('0xd6')][_0x9cd8('0xd8')]){_0x199e65[_0x9cd8('0xd8')]=_0x41f6ee['Smtp']['service'];}else{_0x199e65[_0x9cd8('0xd9')]=_0x41f6ee[_0x9cd8('0xd6')][_0x9cd8('0xd9')];_0x199e65[_0x9cd8('0xda')]=_0x41f6ee[_0x9cd8('0xd6')][_0x9cd8('0xda')];_0x199e65[_0x9cd8('0xdb')]=_0x41f6ee[_0x9cd8('0xd6')][_0x9cd8('0xdb')];}if(_0x41f6ee[_0x9cd8('0xd6')][_0x9cd8('0xdc')]){_0x199e65[_0x9cd8('0xdd')]={'user':_0x41f6ee[_0x9cd8('0xd6')]['user'],'pass':_0x41f6ee[_0x9cd8('0xd6')][_0x9cd8('0xde')]};}return respondWithRpcPromise(_0x9cd8('0xdf'),_0x9cd8('0xe0'),{'account':_0x199e65,'message':{'from':util['format'](_0x9cd8('0xe1'),_0x41f6ee[_0x9cd8('0x3e')],_0x41f6ee[_0x9cd8('0xe2')]||_0x41f6ee[_0x9cd8('0xd6')][_0x9cd8('0x5b')]),'to':_0x5bfb0b[_0x9cd8('0xd7')],'subject':_0x5bfb0b['offlineMessageSubject'],'text':_0xaabf64[_0x9cd8('0x58')]}},client9003)[_0x9cd8('0x21')](function(){return _0xaabf64;})[_0x9cd8('0x28')](function(_0x5b9497){console['error'](_0x5b9497);});}})[_0x9cd8('0x21')](function(){if(_0xaabf64){return _0xaabf64;}})[_0x9cd8('0x21')](respondWithResult(_0x102809,null))[_0x9cd8('0x28')](handleError(_0x102809,null));};exports['addInteraction']=function(_0x41be5a,_0x15e715,_0x47475c){return db['ChatInteraction'][_0x9cd8('0x56')]({'where':{'id':_0x41be5a[_0x9cd8('0x55')]['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x15e715,null))[_0x9cd8('0x21')](function(_0x48ec7e){if(_0x48ec7e){return _0x48ec7e[_0x9cd8('0xe3')](_0x41be5a[_0x9cd8('0x58')][_0x9cd8('0x66')],_[_0x9cd8('0xe4')](_0x41be5a[_0x9cd8('0x58')],[_0x9cd8('0x66'),'id'])||{});}})['then'](respondWithResult(_0x15e715,null))[_0x9cd8('0x28')](handleError(_0x15e715,null));};exports['getInteractions']=function(_0x3c4bff,_0x211d48,_0xccba44){var _0x999246={'raw':![],'where':{}};var _0x679e36={};var _0x1306de={'count':0x0,'rows':[]};return db[_0x9cd8('0x4f')][_0x9cd8('0x62')]({'where':{'id':_0x3c4bff['params']['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x211d48,null))[_0x9cd8('0x21')](function(_0x408bf8){if(_0x408bf8){_0x679e36[_0x9cd8('0x3d')]=_['keys'](db[_0x9cd8('0xb7')][_0x9cd8('0x3a')]);_0x679e36[_0x9cd8('0x3f')]=_[_0x9cd8('0x40')](_0x3c4bff[_0x9cd8('0x3f')]);_0x679e36[_0x9cd8('0x41')]=_['intersection'](_0x679e36[_0x9cd8('0x3d')],_0x679e36[_0x9cd8('0x3f')]);_0x999246[_0x9cd8('0x43')]=_[_0x9cd8('0x42')](_0x679e36['model'],qs['fields'](_0x3c4bff[_0x9cd8('0x3f')][_0x9cd8('0x44')]));_0x999246[_0x9cd8('0x43')]=_0x999246[_0x9cd8('0x43')][_0x9cd8('0x45')]?_0x999246[_0x9cd8('0x43')]:_0x679e36[_0x9cd8('0x3d')];if(!_0x3c4bff['query']['hasOwnProperty']('nolimit')){_0x999246['limit']=qs[_0x9cd8('0x2e')](_0x3c4bff[_0x9cd8('0x3f')][_0x9cd8('0x2e')]);_0x999246[_0x9cd8('0x47')]=qs[_0x9cd8('0x47')](_0x3c4bff['query'][_0x9cd8('0x47')]);}_0x999246[_0x9cd8('0x6a')]=qs[_0x9cd8('0x48')](_0x3c4bff[_0x9cd8('0x3f')][_0x9cd8('0x48')]);_0x999246[_0x9cd8('0x49')]=qs['filters'](_[_0x9cd8('0x4a')](_0x3c4bff[_0x9cd8('0x3f')],_0x679e36[_0x9cd8('0x41')]));_0x999246[_0x9cd8('0x49')]['ChatWebsiteId']=_0x408bf8['id'];if(_0x3c4bff[_0x9cd8('0x3f')]['filter']){_0x999246[_0x9cd8('0x49')]=_['merge'](_0x999246[_0x9cd8('0x49')],{'$or':_['map'](_0x999246[_0x9cd8('0x43')],function(_0x37112b){var _0x4217a5={};_0x4217a5[_0x37112b]={'$like':'%'+_0x3c4bff[_0x9cd8('0x3f')][_0x9cd8('0x4b')]+'%'};return _0x4217a5;})});}_0x999246=_[_0x9cd8('0x4c')]({},_0x999246,_0x3c4bff[_0x9cd8('0x4e')]);return db['ChatInteraction'][_0x9cd8('0x2d')]({'where':_0x999246[_0x9cd8('0x49')]})[_0x9cd8('0x21')](function(_0x2745e7){_0x1306de[_0x9cd8('0x2d')]=_0x2745e7;if(_0x3c4bff[_0x9cd8('0x3f')][_0x9cd8('0x50')]){_0x999246[_0x9cd8('0x51')]=[{'model':db['CmContact'],'as':_0x9cd8('0xe5'),'required':![]},{'model':db['User'],'as':_0x9cd8('0xe6'),'attributes':[_0x9cd8('0x3e'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x9cd8('0xe7'),'attributes':['id','name',_0x9cd8('0xe8')],'where':_0x3c4bff[_0x9cd8('0x3f')][_0x9cd8('0xe9')]?{'id':_0x3c4bff[_0x9cd8('0x3f')]['tag']}:undefined,'required':_0x3c4bff[_0x9cd8('0x3f')][_0x9cd8('0xe9')]?!![]:![]}];}return db[_0x9cd8('0xb7')][_0x9cd8('0x52')](_0x999246);})[_0x9cd8('0x21')](function(_0x9a3877){_0x1306de[_0x9cd8('0x53')]=_0x9a3877;return _0x1306de;});}})['then'](respondWithFilteredResult(_0x211d48,_0x999246))[_0x9cd8('0x28')](handleError(_0x211d48,null));};function iftimePromise(_0xd6d306,_0x404bd8){return respondWithRpcPromise(_0x9cd8('0xea'),_0x9cd8('0xeb'),{'command':_0x404bd8['timezone']?util['format'](_0x9cd8('0xec'),_0xd6d306[_0x9cd8('0xed')],_0x404bd8[_0x9cd8('0xee')]):util[_0x9cd8('0xb1')](_0x9cd8('0xef'),_0xd6d306[_0x9cd8('0xed')])},client9002)[_0x9cd8('0x21')](function(_0x4fefb3){var _0xf8e629=_0x4fefb3&&_0x4fefb3['indexOf'](_0x9cd8('0xf0'))>=0x0?!![]:![];logger[_0x9cd8('0x22')](_0x9cd8('0xf1'),_0x404bd8['id'],_0xd6d306['id'],_0xd6d306[_0x9cd8('0xed')],_0xf8e629?_0x9cd8('0xf2'):_0x9cd8('0xf3'),_0x404bd8[_0x9cd8('0xee')]?_0x404bd8[_0x9cd8('0xee')]:'No\x20timezone');return _0xf8e629;})[_0x9cd8('0x28')](function(_0x14f21b){logger[_0x9cd8('0x26')](_0x9cd8('0xf1'),_0x404bd8['id'],_0xd6d306['id'],_0xd6d306[_0x9cd8('0xed')],util[_0x9cd8('0xf4')](_0x14f21b,{'showHidden':![],'depth':null}),_0x404bd8[_0x9cd8('0xee')]?_0x404bd8[_0x9cd8('0xee')]:_0x9cd8('0xf5'));return![];});}exports['getSnippet']=function(_0x1bfa88,_0x151464,_0x153e19){var _0x57b831=0x0;var _0x599336=0x0;var _0x650b65=![];var _0x13fa29;var _0x5bb707;return db['ChatWebsite']['find']({'where':{'id':_0x1bfa88['params']['id']},'include':[{'model':db[_0x9cd8('0xf6')],'as':_0x9cd8('0xf6'),'include':[{'model':db[_0x9cd8('0xf6')],'as':'Intervals','attributes':['id',_0x9cd8('0xed')],'raw':!![]}]}]})[_0x9cd8('0x21')](handleEntityNotFound(_0x151464,null))[_0x9cd8('0x21')](function(_0x3f8373){if(_0x3f8373){_0x13fa29=_0x3f8373;return _0x3f8373[_0x9cd8('0xf7')]({'raw':!![]});}})[_0x9cd8('0x21')](function(_0x2dd0cc){if(_0x13fa29){if(_0x2dd0cc){_0x5bb707=_0x2dd0cc;}}return require(_0x9cd8('0x75'))['getLicense']();})[_0x9cd8('0x21')](function(_0x137170){if(_0x137170){_0x599336=_0x137170['virtual'];_0x650b65=_0x137170[_0x9cd8('0x77')];}})[_0x9cd8('0x21')](function(){return db[_0x9cd8('0xb7')]['count']({'where':{'closed':![]}});})[_0x9cd8('0x21')](function(_0x5b8de2){_0x57b831=_0x5b8de2;if(_0x599336&&_0x5b8de2>_0x599336){return db[_0x9cd8('0xf8')][_0x9cd8('0x62')]({'where':{'id':0x1}})['then'](function(_0xa59181){if(_0xa59181){_0xa59181[_0x9cd8('0xf9')](_0x9cd8('0xfa'));}});}})['then'](function(){if(_0x13fa29[_0x9cd8('0xf6')]&&_0x13fa29['Interval'][_0x9cd8('0xfb')]){var _0x612d6c=[];for(var _0x172afc=0x0;_0x172afc<_0x13fa29[_0x9cd8('0xf6')][_0x9cd8('0xfb')][_0x9cd8('0x45')];_0x172afc++){var _0x469d33=_0x13fa29[_0x9cd8('0xf6')][_0x9cd8('0xfb')][_0x172afc][_0x9cd8('0x33')]({'plain':!![]});_0x612d6c[_0x9cd8('0xfc')](iftimePromise(_0x469d33,_0x13fa29));}return BPromise[_0x9cd8('0xfd')](_0x612d6c)[_0x9cd8('0x21')](function(_0x3bb621){return _[_0x9cd8('0xfe')](_0x3bb621);});}else{return!![];}})[_0x9cd8('0x21')](function(_0x44229d){var _0x1f8c90=fs[_0x9cd8('0xff')](path[_0x9cd8('0x73')](config[_0x9cd8('0x7c')],'server/files/chat/iframe.js'),_0x9cd8('0x100'));var _0x5666f9={'remote':_0x13fa29['remote'],'query':querystring[_0x9cd8('0xb5')](_[_0x9cd8('0x4c')](_0x13fa29[_0x9cd8('0x33')]({'plain':!![]}),{'customerIp':_0x1bfa88[_0x9cd8('0x88')][_0x9cd8('0xa7')]||_0x1bfa88[_0x9cd8('0x88')][_0x9cd8('0x101')]||_0x1bfa88[_0x9cd8('0x102')][_0x9cd8('0x103')]||_0x1bfa88['ip'],'referer':_0x1bfa88[_0x9cd8('0x88')]['referer'],'openedInteractions':_0x57b831,'maxInteractions':_0x599336,'virtual':_0x650b65[_0x9cd8('0x104')],'online':_0x44229d,'custom':_0x650b65}))['replace'](/'/g,'\x5c\x27')};_0x151464[_0x9cd8('0x35')](ejs['render'](Mustache['render'](_0x1f8c90,_0x5666f9),{'proactiveActions':_0x5bb707,'alignment':_0x13fa29[_0x9cd8('0x105')],'verticalAlignment':_0x13fa29['verticalAlignment'],'div_color':_0x13fa29['color'],'text_color':_0x13fa29[_0x9cd8('0x106')]}));})[_0x9cd8('0x28')](handleError(_0x151464,null));};exports[_0x9cd8('0x107')]=function(_0x1c9e01,_0xa4d3b9,_0x24af91){return db[_0x9cd8('0x4f')][_0x9cd8('0x62')]({'where':{'id':_0x1c9e01[_0x9cd8('0x55')]['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0xa4d3b9,null))['then'](function(_0x17be46){if(_0x17be46){return db[_0x9cd8('0x108')][_0x9cd8('0x109')](function(_0x225780){return db[_0x9cd8('0x10a')]['destroy']({'where':{'ChatWebsiteId':_0x1c9e01[_0x9cd8('0x55')]['id']},'transaction':_0x225780})[_0x9cd8('0x21')](function(_0x14e44e){var _0x5b0b7f=_[_0x9cd8('0x39')](_0x1c9e01[_0x9cd8('0x58')],function(_0x2999c5){_0x2999c5['ChatWebsiteId']=_0x1c9e01[_0x9cd8('0x55')]['id'];return _0x2999c5;});return db[_0x9cd8('0x10a')][_0x9cd8('0x10b')](_0x5b0b7f,{'transaction':_0x225780});});})['then'](function(){return db[_0x9cd8('0x10a')][_0x9cd8('0x10c')]({'where':{'ChatWebsiteId':_0x1c9e01[_0x9cd8('0x55')]['id']},'order':_0x9cd8('0x10d')});});}})[_0x9cd8('0x21')](respondWithResult(_0xa4d3b9,null))['catch'](handleError(_0xa4d3b9,null));};exports['getApplications']=function(_0x35144e,_0x2eac36,_0x4d4cb8){var _0x47ea8c={};var _0x5bf1a7={};var _0x28f89c;var _0x100bf3;return db[_0x9cd8('0x4f')][_0x9cd8('0x62')]({'where':{'id':_0x35144e[_0x9cd8('0x55')]['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x2eac36,null))['then'](function(_0x31970f){if(_0x31970f){_0x28f89c=_0x31970f;_0x5bf1a7[_0x9cd8('0x3d')]=_[_0x9cd8('0x40')](db[_0x9cd8('0x10a')][_0x9cd8('0x3a')]);_0x5bf1a7[_0x9cd8('0x3f')]=_['keys'](_0x35144e[_0x9cd8('0x3f')]);_0x5bf1a7[_0x9cd8('0x41')]=_[_0x9cd8('0x42')](_0x5bf1a7['model'],_0x5bf1a7['query']);_0x47ea8c[_0x9cd8('0x43')]=_[_0x9cd8('0x42')](_0x5bf1a7[_0x9cd8('0x3d')],qs[_0x9cd8('0x44')](_0x35144e[_0x9cd8('0x3f')][_0x9cd8('0x44')]));_0x47ea8c[_0x9cd8('0x43')]=_0x47ea8c[_0x9cd8('0x43')]['length']?_0x47ea8c[_0x9cd8('0x43')]:_0x5bf1a7[_0x9cd8('0x3d')];_0x47ea8c[_0x9cd8('0x6a')]=qs[_0x9cd8('0x48')](_0x35144e['query'][_0x9cd8('0x48')]);_0x47ea8c[_0x9cd8('0x49')]=qs[_0x9cd8('0x41')](_[_0x9cd8('0x4a')](_0x35144e[_0x9cd8('0x3f')],_0x5bf1a7['filters']));if(_0x35144e[_0x9cd8('0x3f')][_0x9cd8('0x4b')]){_0x47ea8c[_0x9cd8('0x49')]=_[_0x9cd8('0x4c')](_0x47ea8c[_0x9cd8('0x49')],{'$or':_[_0x9cd8('0x39')](_0x47ea8c[_0x9cd8('0x43')],function(_0x217a98){var _0x3fc75f={};_0x3fc75f[_0x217a98]={'$like':'%'+_0x35144e['query'][_0x9cd8('0x4b')]+'%'};return _0x3fc75f;})});}_0x47ea8c=_['merge']({},_0x47ea8c,_0x35144e['options']);return _0x28f89c[_0x9cd8('0x10e')](_0x47ea8c);}})[_0x9cd8('0x21')](function(_0x30b299){if(_0x30b299){_0x100bf3=_0x30b299[_0x9cd8('0x45')];if(!_0x35144e['query']['hasOwnProperty']('nolimit')){_0x47ea8c['limit']=qs[_0x9cd8('0x2e')](_0x35144e[_0x9cd8('0x3f')][_0x9cd8('0x2e')]);_0x47ea8c[_0x9cd8('0x47')]=qs[_0x9cd8('0x47')](_0x35144e[_0x9cd8('0x3f')]['offset']);}return _0x28f89c[_0x9cd8('0x10e')](_0x47ea8c);}})[_0x9cd8('0x21')](function(_0x5d8944){if(_0x5d8944){return _0x5d8944?{'count':_0x100bf3,'rows':_0x5d8944}:null;}})[_0x9cd8('0x21')](respondWithResult(_0x2eac36,null))[_0x9cd8('0x28')](handleError(_0x2eac36,null));};exports[_0x9cd8('0x10f')]=function(_0x1c49f6,_0x5ee47f,_0x41bff6){return db[_0x9cd8('0x110')][_0x9cd8('0x56')]({'where':{'id':_0x1c49f6[_0x9cd8('0x55')]['id']}})['then'](handleEntityNotFound(_0x5ee47f,null))[_0x9cd8('0x21')](function(_0x29bb5f){if(_0x29bb5f){return _0x29bb5f[_0x9cd8('0x10f')](_0x1c49f6['body']['ids'],_[_0x9cd8('0xe4')](_0x1c49f6[_0x9cd8('0x58')],[_0x9cd8('0x66'),'id'])||{});}})['then'](respondWithResult(_0x5ee47f,null))['catch'](handleError(_0x5ee47f,null));};exports[_0x9cd8('0xf7')]=function(_0x5649b9,_0x249380,_0x3bf374){var _0x7ad271={};var _0x36d299={};var _0xf6a042;var _0x109e0d;return db[_0x9cd8('0x4f')][_0x9cd8('0x62')]({'where':{'id':_0x5649b9[_0x9cd8('0x55')]['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x249380,null))[_0x9cd8('0x21')](function(_0x4c097d){if(_0x4c097d){_0xf6a042=_0x4c097d;_0x36d299[_0x9cd8('0x3d')]=_['keys'](db[_0x9cd8('0x111')][_0x9cd8('0x3a')]);_0x36d299[_0x9cd8('0x3f')]=_[_0x9cd8('0x40')](_0x5649b9[_0x9cd8('0x3f')]);_0x36d299[_0x9cd8('0x41')]=_['intersection'](_0x36d299[_0x9cd8('0x3d')],_0x36d299[_0x9cd8('0x3f')]);_0x7ad271['attributes']=_['intersection'](_0x36d299[_0x9cd8('0x3d')],qs[_0x9cd8('0x44')](_0x5649b9[_0x9cd8('0x3f')][_0x9cd8('0x44')]));_0x7ad271['attributes']=_0x7ad271['attributes'][_0x9cd8('0x45')]?_0x7ad271[_0x9cd8('0x43')]:_0x36d299[_0x9cd8('0x3d')];_0x7ad271[_0x9cd8('0x6a')]=qs[_0x9cd8('0x48')](_0x5649b9[_0x9cd8('0x3f')][_0x9cd8('0x48')]);_0x7ad271['where']=qs[_0x9cd8('0x41')](_[_0x9cd8('0x4a')](_0x5649b9[_0x9cd8('0x3f')],_0x36d299[_0x9cd8('0x41')]));if(_0x5649b9['query'][_0x9cd8('0x4b')]){_0x7ad271[_0x9cd8('0x49')]=_[_0x9cd8('0x4c')](_0x7ad271[_0x9cd8('0x49')],{'$or':_['map'](_0x7ad271[_0x9cd8('0x43')],function(_0x305407){var _0x418476={};_0x418476[_0x305407]={'$like':'%'+_0x5649b9[_0x9cd8('0x3f')][_0x9cd8('0x4b')]+'%'};return _0x418476;})});}_0x7ad271=_[_0x9cd8('0x4c')]({},_0x7ad271,_0x5649b9[_0x9cd8('0x4e')]);return _0xf6a042[_0x9cd8('0xf7')](_0x7ad271);}})[_0x9cd8('0x21')](function(_0x545f7a){if(_0x545f7a){_0x109e0d=_0x545f7a[_0x9cd8('0x45')];if(!_0x5649b9[_0x9cd8('0x3f')][_0x9cd8('0x64')](_0x9cd8('0x46'))){_0x7ad271[_0x9cd8('0x2e')]=qs['limit'](_0x5649b9[_0x9cd8('0x3f')]['limit']);_0x7ad271[_0x9cd8('0x47')]=qs['offset'](_0x5649b9['query'][_0x9cd8('0x47')]);}return _0xf6a042['getProactiveActions'](_0x7ad271);}})['then'](function(_0x4e7945){if(_0x4e7945){return _0x4e7945?{'count':_0x109e0d,'rows':_0x4e7945}:null;}})[_0x9cd8('0x21')](respondWithResult(_0x249380,null))['catch'](handleError(_0x249380,null));};exports[_0x9cd8('0x112')]=function(_0xb1e4df,_0x3ebbe2,_0x5d29db){var _0x2e7af5=_0xb1e4df['query']['online']===_0x9cd8('0x113')?'offlineForm':_0x9cd8('0x114');return db[_0x9cd8('0x4f')][_0x9cd8('0x56')]({'attributes':['id',_0x2e7af5],'where':{'id':_0xb1e4df['params']['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x3ebbe2,null))[_0x9cd8('0x21')](function(_0x18e819){if(_0x18e819){var _0x5769b7=_0x18e819[_0x2e7af5];var _0x732c23=_0x5769b7&&_0x5769b7[_0x9cd8('0x115')]?_0x5769b7['items']:[];_0x3ebbe2['send']({'fromKey':_['isNil'](_0x5769b7[_0x9cd8('0x116')])?undefined:_0x5769b7['fromKey'],'count':_0x732c23[_0x9cd8('0x45')],'rows':_0x732c23});}})[_0x9cd8('0x28')](handleError(_0x3ebbe2,null));};exports[_0x9cd8('0x117')]=function(_0x2dd971,_0xc9bc87,_0x51f333){var _0x3bf7de={'raw':![],'where':{}};var _0x5734bc={};var _0x4c0176={'count':0x0,'rows':[]};return db[_0x9cd8('0x4f')]['findOne']({'where':{'id':_0x2dd971['params']['id']}})['then'](handleEntityNotFound(_0xc9bc87,null))[_0x9cd8('0x21')](function(_0x556c7e){if(_0x556c7e){_0x5734bc[_0x9cd8('0x3d')]=_[_0x9cd8('0x40')](db['ChatOfflineMessage'][_0x9cd8('0x3a')]);_0x5734bc[_0x9cd8('0x3f')]=_[_0x9cd8('0x40')](_0x2dd971[_0x9cd8('0x3f')]);_0x5734bc[_0x9cd8('0x41')]=_[_0x9cd8('0x42')](_0x5734bc[_0x9cd8('0x3d')],_0x5734bc[_0x9cd8('0x3f')]);_0x3bf7de[_0x9cd8('0x43')]=_[_0x9cd8('0x42')](_0x5734bc[_0x9cd8('0x3d')],qs[_0x9cd8('0x44')](_0x2dd971[_0x9cd8('0x3f')][_0x9cd8('0x44')]));_0x3bf7de[_0x9cd8('0x43')]=_0x3bf7de[_0x9cd8('0x43')][_0x9cd8('0x45')]?_0x3bf7de[_0x9cd8('0x43')]:_0x5734bc['model'];if(!_0x2dd971[_0x9cd8('0x3f')][_0x9cd8('0x64')](_0x9cd8('0x46'))){_0x3bf7de['limit']=qs[_0x9cd8('0x2e')](_0x2dd971[_0x9cd8('0x3f')][_0x9cd8('0x2e')]);_0x3bf7de[_0x9cd8('0x47')]=qs['offset'](_0x2dd971[_0x9cd8('0x3f')]['offset']);}_0x3bf7de[_0x9cd8('0x6a')]=qs[_0x9cd8('0x48')](_0x2dd971['query']['sort']);_0x3bf7de['where']=qs['filters'](_['pick'](_0x2dd971[_0x9cd8('0x3f')],_0x5734bc[_0x9cd8('0x41')]));_0x3bf7de[_0x9cd8('0x49')][_0x9cd8('0x60')]=_0x556c7e['id'];if(_0x2dd971[_0x9cd8('0x3f')][_0x9cd8('0x4b')]){_0x3bf7de[_0x9cd8('0x49')]=_['merge'](_0x3bf7de[_0x9cd8('0x49')],{'$or':_[_0x9cd8('0x39')](_0x3bf7de[_0x9cd8('0x43')],function(_0x4e46a9){var _0x42a732={};_0x42a732[_0x4e46a9]={'$like':'%'+_0x2dd971['query'][_0x9cd8('0x4b')]+'%'};return _0x42a732;})});}_0x3bf7de=_[_0x9cd8('0x4c')]({},_0x3bf7de,_0x2dd971['options']);return db[_0x9cd8('0xd3')][_0x9cd8('0x2d')]({'where':_0x3bf7de[_0x9cd8('0x49')]})[_0x9cd8('0x21')](function(_0x17f11f){_0x4c0176[_0x9cd8('0x2d')]=_0x17f11f;if(_0x2dd971[_0x9cd8('0x3f')][_0x9cd8('0x50')]){_0x3bf7de[_0x9cd8('0x51')]=[{'all':!![]}];}else{_0x3bf7de[_0x9cd8('0x51')]=[{'model':db[_0x9cd8('0x99')],'as':_0x9cd8('0xe5'),'required':![]}];}return db[_0x9cd8('0xd3')]['findAll'](_0x3bf7de);})[_0x9cd8('0x21')](function(_0x5d50af){_0x4c0176['rows']=_0x5d50af;return _0x4c0176;});}})[_0x9cd8('0x21')](respondWithFilteredResult(_0xc9bc87,_0x3bf7de))[_0x9cd8('0x28')](handleError(_0xc9bc87,null));};exports[_0x9cd8('0x118')]=function(_0x18bd8a,_0x409f98,_0x32cdde){return db[_0x9cd8('0x4f')][_0x9cd8('0x56')]({'where':{'id':_0x18bd8a[_0x9cd8('0x55')]['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x409f98,null))[_0x9cd8('0x21')](function(_0x335ccb){if(_0x335ccb){return _0x335ccb['addAgents'](_0x18bd8a['body']['ids'],_[_0x9cd8('0xe4')](_0x18bd8a[_0x9cd8('0x58')],[_0x9cd8('0x66'),'id'])||{})[_0x9cd8('0xbb')](function(_0x16c00d){for(var _0x45e30f=0x0;_0x45e30f<_0x18bd8a[_0x9cd8('0x58')]['ids']['length'];_0x45e30f+=0x1){socket['emit']('userChatWebsite:save',{'UserId':_0x18bd8a[_0x9cd8('0x58')]['ids'][_0x45e30f],'ChatWebsiteId':_0x18bd8a[_0x9cd8('0x55')]['id']});}return _0x16c00d;});}})[_0x9cd8('0x21')](respondWithResult(_0x409f98,null))[_0x9cd8('0x28')](handleError(_0x409f98,null));};exports[_0x9cd8('0x119')]=function(_0x496733,_0x4e2aae,_0x4732da){return db[_0x9cd8('0x4f')][_0x9cd8('0x56')]({'where':{'id':_0x496733['params']['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x4e2aae,null))[_0x9cd8('0x21')](function(_0xb1c3a7){if(_0xb1c3a7){return _0xb1c3a7[_0x9cd8('0x119')](_0x496733[_0x9cd8('0x3f')][_0x9cd8('0x66')])[_0x9cd8('0x21')](function(){if(_[_0x9cd8('0x11a')](_0x496733[_0x9cd8('0x3f')]['ids'])){for(var _0x597c9d=0x0;_0x597c9d<_0x496733[_0x9cd8('0x3f')][_0x9cd8('0x66')][_0x9cd8('0x45')];_0x597c9d+=0x1){socket['emit'](_0x9cd8('0x11b'),{'UserId':Number(_0x496733[_0x9cd8('0x3f')][_0x9cd8('0x66')][_0x597c9d]),'ChatWebsiteId':Number(_0x496733[_0x9cd8('0x55')]['id'])});}}else{socket[_0x9cd8('0x11c')](_0x9cd8('0x11b'),{'UserId':Number(_0x496733['query'][_0x9cd8('0x66')]),'ChatWebsiteId':Number(_0x496733[_0x9cd8('0x55')]['id'])});}});}})[_0x9cd8('0x21')](respondWithStatusCode(_0x4e2aae,null))[_0x9cd8('0x28')](handleError(_0x4e2aae,null));};exports[_0x9cd8('0x11d')]=function(_0x2329de,_0x5177f3,_0x53d97b){var _0x3aff9b={};var _0x138c44={};var _0x27d6a3;var _0x4eb8b5;return db[_0x9cd8('0x4f')][_0x9cd8('0x62')]({'where':{'id':_0x2329de['params']['id']}})[_0x9cd8('0x21')](handleEntityNotFound(_0x5177f3,null))[_0x9cd8('0x21')](function(_0x586b63){if(_0x586b63){_0x27d6a3=_0x586b63;_0x138c44[_0x9cd8('0x3d')]=_[_0x9cd8('0x40')](db[_0x9cd8('0xc4')][_0x9cd8('0x3a')]);_0x138c44['query']=_[_0x9cd8('0x40')](_0x2329de[_0x9cd8('0x3f')]);_0x138c44['filters']=_['intersection'](_0x138c44[_0x9cd8('0x3d')],_0x138c44[_0x9cd8('0x3f')]);_0x3aff9b[_0x9cd8('0x43')]=_['intersection'](_0x138c44[_0x9cd8('0x3d')],qs['fields'](_0x2329de[_0x9cd8('0x3f')][_0x9cd8('0x44')]));_0x3aff9b[_0x9cd8('0x43')]=_0x3aff9b[_0x9cd8('0x43')]['length']?_0x3aff9b[_0x9cd8('0x43')]:_0x138c44['model'];_0x3aff9b[_0x9cd8('0x6a')]=qs[_0x9cd8('0x48')](_0x2329de['query'][_0x9cd8('0x48')]);_0x3aff9b[_0x9cd8('0x49')]=qs[_0x9cd8('0x41')](_[_0x9cd8('0x4a')](_0x2329de['query'],_0x138c44['filters']));if(_0x2329de[_0x9cd8('0x3f')][_0x9cd8('0x4b')]){_0x3aff9b[_0x9cd8('0x49')]=_[_0x9cd8('0x4c')](_0x3aff9b['where'],{'$or':_['map'](_0x3aff9b[_0x9cd8('0x43')],function(_0x2c44b7){var _0x15d913={};_0x15d913[_0x2c44b7]={'$like':'%'+_0x2329de[_0x9cd8('0x3f')]['filter']+'%'};return _0x15d913;})});}_0x3aff9b=_[_0x9cd8('0x4c')]({},_0x3aff9b,_0x2329de['options']);return _0x27d6a3['getAgents'](_0x3aff9b);}})[_0x9cd8('0x21')](function(_0x52462f){if(_0x52462f){_0x4eb8b5=_0x52462f[_0x9cd8('0x45')];if(!_0x2329de['query'][_0x9cd8('0x64')](_0x9cd8('0x46'))){_0x3aff9b[_0x9cd8('0x2e')]=qs[_0x9cd8('0x2e')](_0x2329de[_0x9cd8('0x3f')][_0x9cd8('0x2e')]);_0x3aff9b[_0x9cd8('0x47')]=qs[_0x9cd8('0x47')](_0x2329de[_0x9cd8('0x3f')]['offset']);}return _0x27d6a3[_0x9cd8('0x11d')](_0x3aff9b);}})[_0x9cd8('0x21')](function(_0x1cbb7f){if(_0x1cbb7f){return _0x1cbb7f?{'count':_0x4eb8b5,'rows':_0x1cbb7f}:null;}})[_0x9cd8('0x21')](respondWithResult(_0x5177f3,null))[_0x9cd8('0x28')](handleError(_0x5177f3,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index eb5ee89..1accff1 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 _0x8f9e=['events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x54d58f,_0x29c0df){var _0x4b364f=function(_0x100f46){while(--_0x100f46){_0x54d58f['push'](_0x54d58f['shift']());}};_0x4b364f(++_0x29c0df);}(_0x8f9e,0x160));var _0xe8f9=function(_0x18dd15,_0x252692){_0x18dd15=_0x18dd15-0x0;var _0x46719e=_0x8f9e[_0x18dd15];return _0x46719e;};'use strict';var EventEmitter=require(_0xe8f9('0x0'));var ChatWebsite=require(_0xe8f9('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xe8f9('0x2')](0x0);var events={'afterCreate':_0xe8f9('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5dd679){return function(_0x21b698,_0x4ad97b,_0x3d2953){ChatWebsiteEvents[_0xe8f9('0x4')](_0x5dd679+':'+_0x21b698['id'],_0x21b698);ChatWebsiteEvents[_0xe8f9('0x4')](_0x5dd679,_0x21b698);_0x3d2953(null);};}for(var e in events){if(events[_0xe8f9('0x5')](e)){var event=events[e];ChatWebsite[_0xe8f9('0x6')](e,emitEvent(event));}}module[_0xe8f9('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0xbeff=['setMaxListeners','save','update','emit','hasOwnProperty','hook','../../mysqldb','ChatWebsite'];(function(_0xb8baa9,_0x3fcc6a){var _0x464bd0=function(_0x3db1c6){while(--_0x3db1c6){_0xb8baa9['push'](_0xb8baa9['shift']());}};_0x464bd0(++_0x3fcc6a);}(_0xbeff,0x8e));var _0xfbef=function(_0x18787c,_0xc3b5f7){_0x18787c=_0x18787c-0x0;var _0x52b24e=_0xbeff[_0x18787c];return _0x52b24e;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xfbef('0x0'))['db'][_0xfbef('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xfbef('0x2')](0x0);var events={'afterCreate':_0xfbef('0x3'),'afterUpdate':_0xfbef('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4f6ba4){return function(_0x474798,_0x387be8,_0x367559){ChatWebsiteEvents[_0xfbef('0x5')](_0x4f6ba4+':'+_0x474798['id'],_0x474798);ChatWebsiteEvents['emit'](_0x4f6ba4,_0x474798);_0x367559(null);};}for(var e in events){if(events[_0xfbef('0x6')](e)){var event=events[e];ChatWebsite[_0xfbef('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 5579cf5..7ba983a 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 _0x7980=['ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','define'];(function(_0x5efddc,_0x2208a8){var _0x372f30=function(_0x2fc532){while(--_0x2fc532){_0x5efddc['push'](_0x5efddc['shift']());}};_0x372f30(++_0x2208a8);}(_0x7980,0xab));var _0x0798=function(_0xf7f62c,_0x34e3e9){_0xf7f62c=_0xf7f62c-0x0;var _0x1fa89e=_0x7980[_0xf7f62c];return _0x1fa89e;};'use strict';var _=require(_0x0798('0x0'));var util=require(_0x0798('0x1'));var logger=require(_0x0798('0x2'))(_0x0798('0x3'));var moment=require(_0x0798('0x4'));var BPromise=require('bluebird');var rp=require(_0x0798('0x5'));var fs=require('fs');var path=require(_0x0798('0x6'));var rimraf=require(_0x0798('0x7'));var config=require(_0x0798('0x8'));var attributes=require(_0x0798('0x9'));module['exports']=function(_0x22a0f0,_0x557325){return _0x22a0f0[_0x0798('0xa')](_0x0798('0xb'),attributes,{'tableName':_0x0798('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./chatWebsite.attributes','exports','define','chat_websites','../../config/logger','api','moment','bluebird','path'];(function(_0x5061a3,_0x59da29){var _0x34cc76=function(_0xb87e8a){while(--_0xb87e8a){_0x5061a3['push'](_0x5061a3['shift']());}};_0x34cc76(++_0x59da29);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x34f545,_0x2bd2ee){_0x34f545=_0x34f545-0x0;var _0x1ff6b8=_0xcb91[_0x34f545];return _0x1ff6b8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatWebsite',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 385123e..054e5fd 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 _0x6d38=['catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result'];(function(_0x47fae1,_0x49b27a){var _0x4b0c3b=function(_0x3728d5){while(--_0x3728d5){_0x47fae1['push'](_0x47fae1['shift']());}};_0x4b0c3b(++_0x49b27a);}(_0x6d38,0x1ef));var _0x86d3=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6d38[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});config[_0x86d3('0x9')]=_[_0x86d3('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x86d3('0xb'))(new Redis(config[_0x86d3('0x9')]));require(_0x86d3('0xc'))['register'](socket);function respondWithRpcPromise(_0x4a277e,_0x3ed317,_0x555e6d){return new BPromise(function(_0x49b436,_0x5606eb){return client[_0x86d3('0xd')](_0x4a277e,_0x555e6d)[_0x86d3('0xe')](function(_0x4f216c){logger[_0x86d3('0xf')]('ChatWebsite,\x20%s,\x20%s',_0x3ed317,_0x86d3('0x10'));logger[_0x86d3('0x11')](_0x86d3('0x12'),_0x3ed317,_0x86d3('0x10'),JSON[_0x86d3('0x13')](_0x4f216c));if(_0x4f216c[_0x86d3('0x14')]){if(_0x4f216c[_0x86d3('0x14')][_0x86d3('0x15')]===0x1f4){logger['error'](_0x86d3('0x16'),_0x3ed317,_0x4f216c[_0x86d3('0x14')][_0x86d3('0x17')]);return _0x5606eb(_0x4f216c[_0x86d3('0x14')][_0x86d3('0x17')]);}logger[_0x86d3('0x14')](_0x86d3('0x16'),_0x3ed317,_0x4f216c[_0x86d3('0x14')]['message']);return _0x49b436(_0x4f216c[_0x86d3('0x14')][_0x86d3('0x17')]);}else{logger[_0x86d3('0xf')](_0x86d3('0x16'),_0x3ed317,_0x86d3('0x10'));_0x49b436(_0x4f216c[_0x86d3('0x18')][_0x86d3('0x17')]);}})[_0x86d3('0x19')](function(_0x9b76f2){logger['error'](_0x86d3('0x16'),_0x3ed317,_0x9b76f2);_0x5606eb(_0x9b76f2);});});} \ No newline at end of file +var _0x1a37=['rpc','jayson/promise','http','redis','defaults','register','request','then','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x450fe1,_0x2aa8a6){var _0x7cd4b7=function(_0x4eb25b){while(--_0x4eb25b){_0x450fe1['push'](_0x450fe1['shift']());}};_0x7cd4b7(++_0x2aa8a6);}(_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 moment=require(_0x71a3('0x2'));var BPromise=require(_0x71a3('0x3'));var rs=require(_0x71a3('0x4'));var fs=require('fs');var Redis=require(_0x71a3('0x5'));var db=require(_0x71a3('0x6'))['db'];var utils=require(_0x71a3('0x7'));var logger=require(_0x71a3('0x8'))(_0x71a3('0x9'));var config=require('../../config/environment');var jayson=require(_0x71a3('0xa'));var client=jayson['client'][_0x71a3('0xb')]({'port':0x232a});config[_0x71a3('0xc')]=_[_0x71a3('0xd')](config[_0x71a3('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatWebsite.socket')[_0x71a3('0xe')](socket);function respondWithRpcPromise(_0x18320a,_0x3709bc,_0x3aeb48){return new BPromise(function(_0x3a7fc1,_0x2215f2){return client[_0x71a3('0xf')](_0x18320a,_0x3aeb48)[_0x71a3('0x10')](function(_0x5c464c){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x3709bc,_0x71a3('0x11'));logger[_0x71a3('0x12')](_0x71a3('0x13'),_0x3709bc,_0x71a3('0x11'),JSON[_0x71a3('0x14')](_0x5c464c));if(_0x5c464c[_0x71a3('0x15')]){if(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x16')]===0x1f4){logger[_0x71a3('0x15')](_0x71a3('0x17'),_0x3709bc,_0x5c464c[_0x71a3('0x15')]['message']);return _0x2215f2(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x3709bc,_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);return _0x3a7fc1(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);}else{logger[_0x71a3('0x19')](_0x71a3('0x17'),_0x3709bc,'request\x20sent');_0x3a7fc1(_0x5c464c[_0x71a3('0x1a')][_0x71a3('0x18')]);}})['catch'](function(_0x5f4562){logger[_0x71a3('0x15')](_0x71a3('0x17'),_0x3709bc,_0x5f4562);_0x2215f2(_0x5f4562);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 964d74d..f0e7df7 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x253c95,_0x39fd4a){var _0x5934d4=function(_0x214023){while(--_0x214023){_0x253c95['push'](_0x253c95['shift']());}};_0x5934d4(++_0x39fd4a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2b045e,_0xb70f89){_0x2b045e=_0x2b045e-0x0;var _0x5329cf=_0x5f2f[_0x2b045e];return _0x5329cf;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x52d303,_0x26f460){var _0x42d1c6=function(_0x23d305){while(--_0x23d305){_0x52d303['push'](_0x52d303['shift']());}};_0x42d1c6(++_0x26f460);}(_0xb10b,0x12a));var _0xbb10=function(_0x3bfdde,_0x306be4){_0x3bfdde=_0x3bfdde-0x0;var _0x3f752a=_0xb10b[_0x3bfdde];return _0x3f752a;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 6b413ef..23cf06c 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 _0xca08=['removeDispositions','removeAnswers','removeAgents','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','index','get','/describe','describe','show','/:id/dispositions','/:id/canned_answers','isAuthenticated','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','getInteractions','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','diskStorage','join','server/files/images/logos/','format','%s-%s','single','addLogo','server/files/images/avatars/','/:id/avatar','file','addAvatar','root','now','addCustomerAvatar','originalname','/:id/system_avatar','addSystemAvatar','notify','/:id/offline','offline','/:id/interactions','addInteraction','/:id/applications','addApplications','addProactiveActions','addAgents','/:id','update','delete','destroy'];(function(_0x128e43,_0x341a35){var _0x5f38ba=function(_0x5f5795){while(--_0x5f5795){_0x128e43['push'](_0x128e43['shift']());}};_0x5f38ba(++_0x341a35);}(_0xca08,0x87));var _0x8ca0=function(_0x135b26,_0x55cf7e){_0x135b26=_0x135b26-0x0;var _0x2170f7=_0xca08[_0x135b26];return _0x2170f7;};'use strict';var multer=require(_0x8ca0('0x0'));var util=require(_0x8ca0('0x1'));var path=require(_0x8ca0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8ca0('0x3')]();var auth=require(_0x8ca0('0x4'));var interaction=require(_0x8ca0('0x5'));var config=require('../../config/environment');var controller=require(_0x8ca0('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x8ca0('0x7')]);router[_0x8ca0('0x8')](_0x8ca0('0x9'),auth['isAuthenticated'](),controller[_0x8ca0('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8ca0('0xb')]);router[_0x8ca0('0x8')](_0x8ca0('0xc'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x8ca0('0x8')](_0x8ca0('0xd'),auth[_0x8ca0('0xe')](),controller[_0x8ca0('0xf')]);router[_0x8ca0('0x8')](_0x8ca0('0x10'),controller[_0x8ca0('0x11')]);router[_0x8ca0('0x8')]('/:id/avatar',controller[_0x8ca0('0x12')]);router[_0x8ca0('0x8')](_0x8ca0('0x13'),controller[_0x8ca0('0x14')]);router[_0x8ca0('0x8')]('/:id/system_avatar',controller['getSystemAvatar']);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x8ca0('0x15')]);router[_0x8ca0('0x8')]('/:id/snippet',controller[_0x8ca0('0x16')]);router['get']('/:id/applications',auth[_0x8ca0('0xe')](),controller[_0x8ca0('0x17')]);router['get'](_0x8ca0('0x18'),auth['isAuthenticated'](),controller[_0x8ca0('0x19')]);router['get']('/:id/fields',controller['getFields']);router[_0x8ca0('0x8')](_0x8ca0('0x1a'),auth[_0x8ca0('0xe')](),controller[_0x8ca0('0x1b')]);router[_0x8ca0('0x8')](_0x8ca0('0x1c'),auth['isAuthenticated'](),controller[_0x8ca0('0x1d')]);router[_0x8ca0('0x1e')]('/',auth[_0x8ca0('0xe')](),controller[_0x8ca0('0x1f')]);router[_0x8ca0('0x1e')](_0x8ca0('0xc'),auth[_0x8ca0('0xe')](),controller[_0x8ca0('0x20')]);router[_0x8ca0('0x1e')](_0x8ca0('0xd'),auth[_0x8ca0('0xe')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x8ca0('0x21')]({'destination':function(_0x24d77c,_0x5f26df,_0x2dee16){_0x2dee16(null,path[_0x8ca0('0x22')](config['root'],_0x8ca0('0x23')));},'filename':function(_0x3800e5,_0x1329f2,_0x505185){_0x505185(null,util[_0x8ca0('0x24')](_0x8ca0('0x25'),Date['now'](),_0x1329f2['originalname']));}})});router[_0x8ca0('0x1e')](_0x8ca0('0x10'),upload[_0x8ca0('0x26')]('file'),controller[_0x8ca0('0x27')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x32f755,_0x32e625,_0xe2bca4){_0xe2bca4(null,path[_0x8ca0('0x22')](config['root'],_0x8ca0('0x28')));},'filename':function(_0x462fda,_0x9e0cd4,_0x1c9c09){_0x1c9c09(null,util['format'](_0x8ca0('0x25'),Date['now'](),_0x9e0cd4['originalname']));}})});router['post'](_0x8ca0('0x29'),upload[_0x8ca0('0x26')](_0x8ca0('0x2a')),controller[_0x8ca0('0x2b')]);var upload=multer({'storage':multer[_0x8ca0('0x21')]({'destination':function(_0xac98ce,_0x57755c,_0x42755e){_0x42755e(null,path[_0x8ca0('0x22')](config[_0x8ca0('0x2c')],'server/files/images/avatars/'));},'filename':function(_0x59b55e,_0x3b93c3,_0x37ef7f){_0x37ef7f(null,util[_0x8ca0('0x24')](_0x8ca0('0x25'),Date[_0x8ca0('0x2d')](),_0x3b93c3['originalname']));}})});router[_0x8ca0('0x1e')](_0x8ca0('0x13'),upload['single'](_0x8ca0('0x2a')),controller[_0x8ca0('0x2e')]);var upload=multer({'storage':multer[_0x8ca0('0x21')]({'destination':function(_0xc493d5,_0x5ec317,_0x52a22b){_0x52a22b(null,path[_0x8ca0('0x22')](config[_0x8ca0('0x2c')],_0x8ca0('0x28')));},'filename':function(_0xee4949,_0x50052c,_0x49f88e){_0x49f88e(null,util[_0x8ca0('0x24')](_0x8ca0('0x25'),Date[_0x8ca0('0x2d')](),_0x50052c[_0x8ca0('0x2f')]));}})});router[_0x8ca0('0x1e')](_0x8ca0('0x30'),upload[_0x8ca0('0x26')]('file'),controller[_0x8ca0('0x31')]);router[_0x8ca0('0x1e')]('/:id/notify',controller[_0x8ca0('0x32')]);router['post'](_0x8ca0('0x33'),controller[_0x8ca0('0x34')]);router[_0x8ca0('0x1e')](_0x8ca0('0x35'),auth[_0x8ca0('0xe')](),controller[_0x8ca0('0x36')]);router[_0x8ca0('0x1e')](_0x8ca0('0x37'),auth['isAuthenticated'](),controller[_0x8ca0('0x38')]);router[_0x8ca0('0x1e')](_0x8ca0('0x18'),auth[_0x8ca0('0xe')](),controller[_0x8ca0('0x39')]);router[_0x8ca0('0x1e')](_0x8ca0('0x1c'),auth[_0x8ca0('0xe')](),controller[_0x8ca0('0x3a')]);router['put'](_0x8ca0('0x3b'),auth['isAuthenticated'](),controller[_0x8ca0('0x3c')]);router[_0x8ca0('0x3d')]('/:id',auth[_0x8ca0('0xe')](),controller[_0x8ca0('0x3e')]);router[_0x8ca0('0x3d')](_0x8ca0('0xc'),auth['isAuthenticated'](),controller[_0x8ca0('0x3f')]);router[_0x8ca0('0x3d')](_0x8ca0('0xd'),auth[_0x8ca0('0xe')](),controller[_0x8ca0('0x40')]);router[_0x8ca0('0x3d')](_0x8ca0('0x1c'),auth[_0x8ca0('0xe')](),controller[_0x8ca0('0x41')]);module['exports']=router; \ No newline at end of file +var _0x20fa=['getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getProactiveActions','getFields','getOfflineMessages','/:id/users','post','create','addDisposition','addAnswer','diskStorage','join','server/files/images/logos/','format','%s-%s','originalname','addLogo','root','server/files/images/avatars/','addAvatar','now','single','file','/:id/notify','notify','/:id/offline','addInteraction','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','update','delete','removeDispositions','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar'];(function(_0x3ed617,_0x281d6e){var _0x23238f=function(_0x169661){while(--_0x169661){_0x3ed617['push'](_0x3ed617['shift']());}};_0x23238f(++_0x281d6e);}(_0x20fa,0xea));var _0xa20f=function(_0x4ded65,_0xc8d7c1){_0x4ded65=_0x4ded65-0x0;var _0x5864fb=_0x20fa[_0x4ded65];return _0x5864fb;};'use strict';var multer=require(_0xa20f('0x0'));var util=require(_0xa20f('0x1'));var path=require('path');var timeout=require(_0xa20f('0x2'));var express=require(_0xa20f('0x3'));var router=express[_0xa20f('0x4')]();var auth=require(_0xa20f('0x5'));var interaction=require(_0xa20f('0x6'));var config=require(_0xa20f('0x7'));var controller=require(_0xa20f('0x8'));router['get']('/',auth[_0xa20f('0x9')](),controller[_0xa20f('0xa')]);router[_0xa20f('0xb')](_0xa20f('0xc'),auth[_0xa20f('0x9')](),controller['describe']);router[_0xa20f('0xb')](_0xa20f('0xd'),auth[_0xa20f('0x9')](),controller[_0xa20f('0xe')]);router[_0xa20f('0xb')](_0xa20f('0xf'),auth[_0xa20f('0x9')](),controller['getDispositions']);router[_0xa20f('0xb')](_0xa20f('0x10'),auth['isAuthenticated'](),controller[_0xa20f('0x11')]);router[_0xa20f('0xb')](_0xa20f('0x12'),controller[_0xa20f('0x13')]);router[_0xa20f('0xb')](_0xa20f('0x14'),controller['getAvatar']);router[_0xa20f('0xb')](_0xa20f('0x15'),controller[_0xa20f('0x16')]);router[_0xa20f('0xb')](_0xa20f('0x17'),controller[_0xa20f('0x18')]);router[_0xa20f('0xb')](_0xa20f('0x19'),auth['isAuthenticated'](),controller[_0xa20f('0x1a')]);router['get'](_0xa20f('0x1b'),controller[_0xa20f('0x1c')]);router[_0xa20f('0xb')](_0xa20f('0x1d'),auth[_0xa20f('0x9')](),controller['getApplications']);router[_0xa20f('0xb')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xa20f('0x1e')]);router['get']('/:id/fields',controller[_0xa20f('0x1f')]);router[_0xa20f('0xb')]('/:id/offline_messages',auth[_0xa20f('0x9')](),controller[_0xa20f('0x20')]);router[_0xa20f('0xb')](_0xa20f('0x21'),auth['isAuthenticated'](),controller['getAgents']);router[_0xa20f('0x22')]('/',auth[_0xa20f('0x9')](),controller[_0xa20f('0x23')]);router['post'](_0xa20f('0xf'),auth['isAuthenticated'](),controller[_0xa20f('0x24')]);router['post'](_0xa20f('0x10'),auth['isAuthenticated'](),controller[_0xa20f('0x25')]);var upload=multer({'storage':multer[_0xa20f('0x26')]({'destination':function(_0x4e5521,_0x5d9bfd,_0x48bdb4){_0x48bdb4(null,path[_0xa20f('0x27')](config['root'],_0xa20f('0x28')));},'filename':function(_0x4b271d,_0x5653f1,_0x5ebd88){_0x5ebd88(null,util[_0xa20f('0x29')](_0xa20f('0x2a'),Date['now'](),_0x5653f1[_0xa20f('0x2b')]));}})});router[_0xa20f('0x22')](_0xa20f('0x12'),upload['single']('file'),controller[_0xa20f('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x16c83a,_0x17634c,_0x3b24bb){_0x3b24bb(null,path[_0xa20f('0x27')](config[_0xa20f('0x2d')],_0xa20f('0x2e')));},'filename':function(_0x4be8f2,_0x36ef15,_0x3617f3){_0x3617f3(null,util[_0xa20f('0x29')](_0xa20f('0x2a'),Date['now'](),_0x36ef15[_0xa20f('0x2b')]));}})});router[_0xa20f('0x22')](_0xa20f('0x14'),upload['single']('file'),controller[_0xa20f('0x2f')]);var upload=multer({'storage':multer[_0xa20f('0x26')]({'destination':function(_0x3f46c4,_0x5611f1,_0x8b5090){_0x8b5090(null,path[_0xa20f('0x27')](config['root'],_0xa20f('0x2e')));},'filename':function(_0x43c239,_0x2d814b,_0x56d7f6){_0x56d7f6(null,util[_0xa20f('0x29')](_0xa20f('0x2a'),Date[_0xa20f('0x30')](),_0x2d814b[_0xa20f('0x2b')]));}})});router[_0xa20f('0x22')](_0xa20f('0x15'),upload[_0xa20f('0x31')](_0xa20f('0x32')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xa20f('0x26')]({'destination':function(_0x4537a1,_0x51a405,_0x3d29fe){_0x3d29fe(null,path['join'](config['root'],_0xa20f('0x2e')));},'filename':function(_0x347aea,_0x2d146b,_0x34c39f){_0x34c39f(null,util[_0xa20f('0x29')](_0xa20f('0x2a'),Date['now'](),_0x2d146b['originalname']));}})});router['post']('/:id/system_avatar',upload[_0xa20f('0x31')](_0xa20f('0x32')),controller['addSystemAvatar']);router['post'](_0xa20f('0x33'),controller[_0xa20f('0x34')]);router[_0xa20f('0x22')](_0xa20f('0x35'),controller['offline']);router[_0xa20f('0x22')](_0xa20f('0x19'),auth['isAuthenticated'](),controller[_0xa20f('0x36')]);router['post']('/:id/applications',auth[_0xa20f('0x9')](),controller[_0xa20f('0x37')]);router['post'](_0xa20f('0x38'),auth[_0xa20f('0x9')](),controller[_0xa20f('0x39')]);router[_0xa20f('0x22')](_0xa20f('0x21'),auth[_0xa20f('0x9')](),controller[_0xa20f('0x3a')]);router['put'](_0xa20f('0xd'),auth[_0xa20f('0x9')](),controller[_0xa20f('0x3b')]);router[_0xa20f('0x3c')](_0xa20f('0xd'),auth[_0xa20f('0x9')](),controller['destroy']);router[_0xa20f('0x3c')](_0xa20f('0xf'),auth[_0xa20f('0x9')](),controller[_0xa20f('0x3d')]);router[_0xa20f('0x3c')](_0xa20f('0x10'),auth[_0xa20f('0x9')](),controller['removeAnswers']);router[_0xa20f('0x3c')]('/:id/users',auth[_0xa20f('0x9')](),controller[_0xa20f('0x3e')]);module[_0xa20f('0x3f')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 534049d..7448f8b 100644 --- a/server/api/cloudProvider/cloudProvider.attributes.js +++ b/server/api/cloudProvider/cloudProvider.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9865=['STRING','ENUM','AmazonAWS','Google','sequelize','exports'];(function(_0x20fd5b,_0x4b19d4){var _0xd00980=function(_0x455e83){while(--_0x455e83){_0x20fd5b['push'](_0x20fd5b['shift']());}};_0xd00980(++_0x4b19d4);}(_0x9865,0x1ba));var _0x5986=function(_0x259028,_0x2ef571){_0x259028=_0x259028-0x0;var _0x115a30=_0x9865[_0x259028];return _0x115a30;};'use strict';var Sequelize=require(_0x5986('0x0'));module[_0x5986('0x1')]={'name':{'type':Sequelize[_0x5986('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x5986('0x3')](_0x5986('0x4'),_0x5986('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x5986('0x2')]},'data2':{'type':Sequelize[_0x5986('0x2')]}}; \ No newline at end of file +var _0xadf0=['Google','exports','STRING','ENUM','AmazonAWS'];(function(_0x217779,_0x34e5b5){var _0x386998=function(_0x16f248){while(--_0x16f248){_0x217779['push'](_0x217779['shift']());}};_0x386998(++_0x34e5b5);}(_0xadf0,0x12d));var _0x0adf=function(_0x204584,_0x356ecf){_0x204584=_0x204584-0x0;var _0x461f8f=_0xadf0[_0x204584];return _0x461f8f;};'use strict';var Sequelize=require('sequelize');module[_0x0adf('0x0')]={'name':{'type':Sequelize[_0x0adf('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x0adf('0x2')](_0x0adf('0x3'),_0x0adf('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x0adf('0x1')]},'data2':{'type':Sequelize[_0x0adf('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 40e59a5..c893762 100644 --- a/server/api/cloudProvider/cloudProvider.controller.js +++ b/server/api/cloudProvider/cloudProvider.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x46db=['limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','CloudProvider','count','includeAll','include','findAll','rows','params','length','merge','options','find','create','body','catch','rimraf','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset'];(function(_0x53ea77,_0x3edf7e){var _0xfc6ae3=function(_0x5e05c7){while(--_0x5e05c7){_0x53ea77['push'](_0x53ea77['shift']());}};_0xfc6ae3(++_0x3edf7e);}(_0x46db,0x19c));var _0xb46d=function(_0x5a6376,_0x260ff6){_0x5a6376=_0x5a6376-0x0;var _0x433156=_0x46db[_0x5a6376];return _0x433156;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xb46d('0x0'));var zipdir=require(_0xb46d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb46d('0x2'));var moment=require('moment');var BPromise=require(_0xb46d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb46d('0x4'));var sox=require(_0xb46d('0x5'));var csv=require(_0xb46d('0x6'));var ejs=require(_0xb46d('0x7'));var fs=require('fs');var _=require(_0xb46d('0x8'));var squel=require('squel');var crypto=require(_0xb46d('0x9'));var jsforce=require(_0xb46d('0xa'));var deskjs=require(_0xb46d('0xb'));var toCsv=require('to-csv');var querystring=require(_0xb46d('0xc'));var Papa=require(_0xb46d('0xd'));var Redis=require(_0xb46d('0xe'));var authService=require(_0xb46d('0xf'));var qs=require(_0xb46d('0x10'));var as=require(_0xb46d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb46d('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xb46d('0x13'));var db=require(_0xb46d('0x14'))['db'];function respondWithStatusCode(_0x51e4f8,_0x103467){_0x103467=_0x103467||0xcc;return function(_0x5de17b){if(_0x5de17b){return _0x51e4f8[_0xb46d('0x15')](_0x103467);}return _0x51e4f8['status'](_0x103467)[_0xb46d('0x16')]();};}function respondWithResult(_0x19675c,_0x1ec9d0){_0x1ec9d0=_0x1ec9d0||0xc8;return function(_0x5e161b){if(_0x5e161b){return _0x19675c[_0xb46d('0x17')](_0x1ec9d0)[_0xb46d('0x18')](_0x5e161b);}};}function respondWithFilteredResult(_0x3f2b8a,_0x40a834){return function(_0x5093fe){if(_0x5093fe){var _0x268355=_0x5093fe['count'],_0x103016=_0x40a834[_0xb46d('0x19')],_0x9d176a=_0x40a834['offset']+_0x40a834[_0xb46d('0x1a')],_0x2f3bb1;if(_0x9d176a>=_0x268355){_0x9d176a=_0x268355;_0x2f3bb1=0xc8;}else{_0x2f3bb1=0xce;}_0x3f2b8a[_0xb46d('0x17')](_0x2f3bb1);return _0x3f2b8a[_0xb46d('0x1b')](_0xb46d('0x1c'),_0x103016+'-'+_0x9d176a+'/'+_0x268355)[_0xb46d('0x18')](_0x5093fe);}return null;};}function patchUpdates(_0x54d683){return function(_0x3adbb9){try{jsonpatch[_0xb46d('0x1d')](_0x3adbb9,_0x54d683,!![]);}catch(_0x1a1b34){return BPromise[_0xb46d('0x1e')](_0x1a1b34);}return _0x3adbb9[_0xb46d('0x1f')]();};}function saveUpdates(_0x3e8aa6,_0x1f0285){return function(_0x2803db){if(_0x2803db){return _0x2803db[_0xb46d('0x20')](_0x3e8aa6)[_0xb46d('0x21')](function(_0x535175){return _0x535175;});}return null;};}function removeEntity(_0x2dd429,_0x55a8cc){return function(_0x511316){if(_0x511316){return _0x511316[_0xb46d('0x22')]()[_0xb46d('0x21')](function(){_0x2dd429[_0xb46d('0x17')](0xcc)[_0xb46d('0x16')]();});}};}function handleEntityNotFound(_0x4dd43e,_0x3083f8){return function(_0x563f4a){if(!_0x563f4a){_0x4dd43e[_0xb46d('0x15')](0x194);}return _0x563f4a;};}function handleError(_0x42c9cd,_0x417ea4){_0x417ea4=_0x417ea4||0x1f4;return function(_0x54c5fc){logger[_0xb46d('0x23')](_0x54c5fc[_0xb46d('0x24')]);if(_0x54c5fc[_0xb46d('0x25')]){delete _0x54c5fc[_0xb46d('0x25')];}_0x42c9cd['status'](_0x417ea4)[_0xb46d('0x26')](_0x54c5fc);};}exports[_0xb46d('0x27')]=function(_0x2038a9,_0x2e5e72){var _0x4d6d7c={},_0x11b1c6={},_0x5dc0da={'count':0x0,'rows':[]};var _0x37ddef=_[_0xb46d('0x28')](db['CloudProvider'][_0xb46d('0x29')],function(_0x1042a8){return{'name':_0x1042a8['fieldName'],'type':_0x1042a8['type'][_0xb46d('0x2a')]};});_0x11b1c6[_0xb46d('0x2b')]=_[_0xb46d('0x28')](_0x37ddef,_0xb46d('0x25'));_0x11b1c6['query']=_[_0xb46d('0x2c')](_0x2038a9[_0xb46d('0x2d')]);_0x11b1c6[_0xb46d('0x2e')]=_[_0xb46d('0x2f')](_0x11b1c6['model'],_0x11b1c6[_0xb46d('0x2d')]);_0x4d6d7c[_0xb46d('0x30')]=_[_0xb46d('0x2f')](_0x11b1c6[_0xb46d('0x2b')],qs[_0xb46d('0x31')](_0x2038a9['query']['fields']));_0x4d6d7c['attributes']=_0x4d6d7c['attributes']['length']?_0x4d6d7c[_0xb46d('0x30')]:_0x11b1c6['model'];if(!_0x2038a9['query'][_0xb46d('0x32')](_0xb46d('0x33'))){_0x4d6d7c['limit']=qs[_0xb46d('0x1a')](_0x2038a9[_0xb46d('0x2d')]['limit']);_0x4d6d7c['offset']=qs[_0xb46d('0x19')](_0x2038a9[_0xb46d('0x2d')]['offset']);}_0x4d6d7c[_0xb46d('0x34')]=qs[_0xb46d('0x35')](_0x2038a9[_0xb46d('0x2d')][_0xb46d('0x35')]);_0x4d6d7c[_0xb46d('0x36')]=qs[_0xb46d('0x2e')](_[_0xb46d('0x37')](_0x2038a9[_0xb46d('0x2d')],_0x11b1c6['filters']),_0x37ddef);if(_0x2038a9['query'][_0xb46d('0x38')]){_0x4d6d7c[_0xb46d('0x36')]=_['merge'](_0x4d6d7c['where'],{'$or':_[_0xb46d('0x28')](_0x37ddef,function(_0x54904e){if(_0x54904e[_0xb46d('0x39')]!==_0xb46d('0x3a')){var _0x4ad885={};_0x4ad885[_0x54904e[_0xb46d('0x25')]]={'$like':'%'+_0x2038a9[_0xb46d('0x2d')][_0xb46d('0x38')]+'%'};return _0x4ad885;}})});}_0x4d6d7c=_['merge']({},_0x4d6d7c,_0x2038a9['options']);var _0x4f3997={'where':_0x4d6d7c['where']};return db[_0xb46d('0x3b')][_0xb46d('0x3c')](_0x4f3997)[_0xb46d('0x21')](function(_0x4f8cf3){_0x5dc0da[_0xb46d('0x3c')]=_0x4f8cf3;if(_0x2038a9[_0xb46d('0x2d')][_0xb46d('0x3d')]){_0x4d6d7c[_0xb46d('0x3e')]=[{'all':!![]}];}return db[_0xb46d('0x3b')][_0xb46d('0x3f')](_0x4d6d7c);})['then'](function(_0x101144){_0x5dc0da[_0xb46d('0x40')]=_0x101144;return _0x5dc0da;})['then'](respondWithFilteredResult(_0x2e5e72,_0x4d6d7c))['catch'](handleError(_0x2e5e72,null));};exports['show']=function(_0x4708c6,_0xd37a19){var _0x1f40c6={'raw':!![],'where':{'id':_0x4708c6[_0xb46d('0x41')]['id']}},_0x1c42d0={};_0x1c42d0['model']=_[_0xb46d('0x2c')](db['CloudProvider'][_0xb46d('0x29')]);_0x1c42d0[_0xb46d('0x2d')]=_['keys'](_0x4708c6[_0xb46d('0x2d')]);_0x1c42d0[_0xb46d('0x2e')]=_[_0xb46d('0x2f')](_0x1c42d0[_0xb46d('0x2b')],_0x1c42d0[_0xb46d('0x2d')]);_0x1f40c6['attributes']=_[_0xb46d('0x2f')](_0x1c42d0[_0xb46d('0x2b')],qs[_0xb46d('0x31')](_0x4708c6[_0xb46d('0x2d')][_0xb46d('0x31')]));_0x1f40c6[_0xb46d('0x30')]=_0x1f40c6[_0xb46d('0x30')][_0xb46d('0x42')]?_0x1f40c6[_0xb46d('0x30')]:_0x1c42d0['model'];if(_0x4708c6[_0xb46d('0x2d')]['includeAll']){_0x1f40c6[_0xb46d('0x3e')]=[{'all':!![]}];}_0x1f40c6=_[_0xb46d('0x43')]({},_0x1f40c6,_0x4708c6[_0xb46d('0x44')]);return db[_0xb46d('0x3b')][_0xb46d('0x45')](_0x1f40c6)[_0xb46d('0x21')](handleEntityNotFound(_0xd37a19,null))[_0xb46d('0x21')](respondWithResult(_0xd37a19,null))['catch'](handleError(_0xd37a19,null));};exports[_0xb46d('0x46')]=function(_0x1b0133,_0x5e3f28){return db[_0xb46d('0x3b')]['create'](_0x1b0133[_0xb46d('0x47')],{})[_0xb46d('0x21')](respondWithResult(_0x5e3f28,0xc9))[_0xb46d('0x48')](handleError(_0x5e3f28,null));};exports[_0xb46d('0x20')]=function(_0xd4f175,_0x440c0b){if(_0xd4f175['body']['id']){delete _0xd4f175['body']['id'];}return db[_0xb46d('0x3b')][_0xb46d('0x45')]({'where':{'id':_0xd4f175['params']['id']}})['then'](handleEntityNotFound(_0x440c0b,null))[_0xb46d('0x21')](saveUpdates(_0xd4f175[_0xb46d('0x47')],null))[_0xb46d('0x21')](respondWithResult(_0x440c0b,null))[_0xb46d('0x48')](handleError(_0x440c0b,null));};exports[_0xb46d('0x22')]=function(_0x27f93b,_0x3f9815){return db[_0xb46d('0x3b')][_0xb46d('0x45')]({'where':{'id':_0x27f93b[_0xb46d('0x41')]['id']}})['then'](handleEntityNotFound(_0x3f9815,null))[_0xb46d('0x21')](removeEntity(_0x3f9815,null))[_0xb46d('0x48')](handleError(_0x3f9815,null));}; \ No newline at end of file +var _0xb355=['fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','VIRTUAL','options','CloudProvider','then','includeAll','rows','catch','show','params','keys','rawAttributes','include','create','body','find','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x4f46f6,_0x54e2ad){var _0x4f6337=function(_0x56d80d){while(--_0x56d80d){_0x4f46f6['push'](_0x4f46f6['shift']());}};_0x4f6337(++_0x54e2ad);}(_0xb355,0x1d1));var _0x5b35=function(_0x47f7a9,_0x4c8770){_0x47f7a9=_0x47f7a9-0x0;var _0x2dcc4d=_0xb355[_0x47f7a9];return _0x2dcc4d;};'use strict';var pdf=require(_0x5b35('0x0'));var emlformat=require(_0x5b35('0x1'));var rimraf=require(_0x5b35('0x2'));var zipdir=require(_0x5b35('0x3'));var jsonpatch=require(_0x5b35('0x4'));var rp=require(_0x5b35('0x5'));var moment=require(_0x5b35('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5b35('0x7'));var sox=require(_0x5b35('0x8'));var csv=require(_0x5b35('0x9'));var ejs=require(_0x5b35('0xa'));var fs=require('fs');var _=require(_0x5b35('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5b35('0xc'));var deskjs=require(_0x5b35('0xd'));var toCsv=require(_0x5b35('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5b35('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5b35('0xf'));var logger=require(_0x5b35('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x5b35('0x11'));var db=require(_0x5b35('0x12'))['db'];function respondWithStatusCode(_0x228b85,_0x444349){_0x444349=_0x444349||0xcc;return function(_0xb7ccbb){if(_0xb7ccbb){return _0x228b85[_0x5b35('0x13')](_0x444349);}return _0x228b85[_0x5b35('0x14')](_0x444349)[_0x5b35('0x15')]();};}function respondWithResult(_0x370889,_0x35123a){_0x35123a=_0x35123a||0xc8;return function(_0x321c45){if(_0x321c45){return _0x370889['status'](_0x35123a)[_0x5b35('0x16')](_0x321c45);}};}function respondWithFilteredResult(_0x4a57b1,_0x2d837a){return function(_0x4ad4fa){if(_0x4ad4fa){var _0x311757=_0x4ad4fa[_0x5b35('0x17')],_0x246406=_0x2d837a[_0x5b35('0x18')],_0x57077e=_0x2d837a[_0x5b35('0x18')]+_0x2d837a['limit'],_0x3cd1b3;if(_0x57077e>=_0x311757){_0x57077e=_0x311757;_0x3cd1b3=0xc8;}else{_0x3cd1b3=0xce;}_0x4a57b1[_0x5b35('0x14')](_0x3cd1b3);return _0x4a57b1[_0x5b35('0x19')](_0x5b35('0x1a'),_0x246406+'-'+_0x57077e+'/'+_0x311757)[_0x5b35('0x16')](_0x4ad4fa);}return null;};}function patchUpdates(_0x2014f1){return function(_0x58010c){try{jsonpatch[_0x5b35('0x1b')](_0x58010c,_0x2014f1,!![]);}catch(_0x1b6e7f){return BPromise[_0x5b35('0x1c')](_0x1b6e7f);}return _0x58010c['save']();};}function saveUpdates(_0x4922e9,_0x2bada6){return function(_0x43c07e){if(_0x43c07e){return _0x43c07e[_0x5b35('0x1d')](_0x4922e9)['then'](function(_0x27e822){return _0x27e822;});}return null;};}function removeEntity(_0x58e348,_0x3c4978){return function(_0x428412){if(_0x428412){return _0x428412[_0x5b35('0x1e')]()['then'](function(){_0x58e348[_0x5b35('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2494f0,_0x231526){return function(_0x2fd493){if(!_0x2fd493){_0x2494f0[_0x5b35('0x13')](0x194);}return _0x2fd493;};}function handleError(_0x3c7a0d,_0x2f0d31){_0x2f0d31=_0x2f0d31||0x1f4;return function(_0x36b984){logger['error'](_0x36b984[_0x5b35('0x1f')]);if(_0x36b984[_0x5b35('0x20')]){delete _0x36b984['name'];}_0x3c7a0d[_0x5b35('0x14')](_0x2f0d31)[_0x5b35('0x21')](_0x36b984);};}exports[_0x5b35('0x22')]=function(_0x69db,_0x9c4663){var _0x5b47e6={},_0x42461a={},_0x5bf62c={'count':0x0,'rows':[]};var _0x210dee=_[_0x5b35('0x23')](db['CloudProvider']['rawAttributes'],function(_0x3ddda1){return{'name':_0x3ddda1['fieldName'],'type':_0x3ddda1[_0x5b35('0x24')][_0x5b35('0x25')]};});_0x42461a[_0x5b35('0x26')]=_[_0x5b35('0x23')](_0x210dee,_0x5b35('0x20'));_0x42461a[_0x5b35('0x27')]=_['keys'](_0x69db['query']);_0x42461a[_0x5b35('0x28')]=_[_0x5b35('0x29')](_0x42461a['model'],_0x42461a[_0x5b35('0x27')]);_0x5b47e6['attributes']=_[_0x5b35('0x29')](_0x42461a[_0x5b35('0x26')],qs['fields'](_0x69db['query'][_0x5b35('0x2a')]));_0x5b47e6['attributes']=_0x5b47e6[_0x5b35('0x2b')][_0x5b35('0x2c')]?_0x5b47e6[_0x5b35('0x2b')]:_0x42461a['model'];if(!_0x69db[_0x5b35('0x27')][_0x5b35('0x2d')](_0x5b35('0x2e'))){_0x5b47e6[_0x5b35('0x2f')]=qs[_0x5b35('0x2f')](_0x69db[_0x5b35('0x27')][_0x5b35('0x2f')]);_0x5b47e6[_0x5b35('0x18')]=qs[_0x5b35('0x18')](_0x69db[_0x5b35('0x27')][_0x5b35('0x18')]);}_0x5b47e6[_0x5b35('0x30')]=qs['sort'](_0x69db['query']['sort']);_0x5b47e6[_0x5b35('0x31')]=qs[_0x5b35('0x28')](_[_0x5b35('0x32')](_0x69db[_0x5b35('0x27')],_0x42461a[_0x5b35('0x28')]),_0x210dee);if(_0x69db['query'][_0x5b35('0x33')]){_0x5b47e6[_0x5b35('0x31')]=_['merge'](_0x5b47e6[_0x5b35('0x31')],{'$or':_['map'](_0x210dee,function(_0x41e7c8){if(_0x41e7c8[_0x5b35('0x24')]!==_0x5b35('0x34')){var _0x414726={};_0x414726[_0x41e7c8[_0x5b35('0x20')]]={'$like':'%'+_0x69db[_0x5b35('0x27')][_0x5b35('0x33')]+'%'};return _0x414726;}})});}_0x5b47e6=_['merge']({},_0x5b47e6,_0x69db[_0x5b35('0x35')]);var _0x5e19ad={'where':_0x5b47e6['where']};return db[_0x5b35('0x36')]['count'](_0x5e19ad)[_0x5b35('0x37')](function(_0x328d3b){_0x5bf62c[_0x5b35('0x17')]=_0x328d3b;if(_0x69db[_0x5b35('0x27')][_0x5b35('0x38')]){_0x5b47e6['include']=[{'all':!![]}];}return db[_0x5b35('0x36')]['findAll'](_0x5b47e6);})['then'](function(_0x13de1d){_0x5bf62c[_0x5b35('0x39')]=_0x13de1d;return _0x5bf62c;})[_0x5b35('0x37')](respondWithFilteredResult(_0x9c4663,_0x5b47e6))[_0x5b35('0x3a')](handleError(_0x9c4663,null));};exports[_0x5b35('0x3b')]=function(_0xdb9daa,_0x38086d){var _0x1936ac={'raw':!![],'where':{'id':_0xdb9daa[_0x5b35('0x3c')]['id']}},_0x399c34={};_0x399c34[_0x5b35('0x26')]=_[_0x5b35('0x3d')](db[_0x5b35('0x36')][_0x5b35('0x3e')]);_0x399c34['query']=_[_0x5b35('0x3d')](_0xdb9daa[_0x5b35('0x27')]);_0x399c34[_0x5b35('0x28')]=_[_0x5b35('0x29')](_0x399c34['model'],_0x399c34['query']);_0x1936ac['attributes']=_[_0x5b35('0x29')](_0x399c34[_0x5b35('0x26')],qs[_0x5b35('0x2a')](_0xdb9daa[_0x5b35('0x27')][_0x5b35('0x2a')]));_0x1936ac[_0x5b35('0x2b')]=_0x1936ac[_0x5b35('0x2b')][_0x5b35('0x2c')]?_0x1936ac[_0x5b35('0x2b')]:_0x399c34['model'];if(_0xdb9daa[_0x5b35('0x27')][_0x5b35('0x38')]){_0x1936ac[_0x5b35('0x3f')]=[{'all':!![]}];}_0x1936ac=_['merge']({},_0x1936ac,_0xdb9daa['options']);return db[_0x5b35('0x36')]['find'](_0x1936ac)[_0x5b35('0x37')](handleEntityNotFound(_0x38086d,null))[_0x5b35('0x37')](respondWithResult(_0x38086d,null))[_0x5b35('0x3a')](handleError(_0x38086d,null));};exports[_0x5b35('0x40')]=function(_0xc79e67,_0xc1133a){return db[_0x5b35('0x36')]['create'](_0xc79e67[_0x5b35('0x41')],{})['then'](respondWithResult(_0xc1133a,0xc9))[_0x5b35('0x3a')](handleError(_0xc1133a,null));};exports[_0x5b35('0x1d')]=function(_0x5ecfe0,_0x1a3a2c){if(_0x5ecfe0[_0x5b35('0x41')]['id']){delete _0x5ecfe0[_0x5b35('0x41')]['id'];}return db[_0x5b35('0x36')][_0x5b35('0x42')]({'where':{'id':_0x5ecfe0[_0x5b35('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1a3a2c,null))[_0x5b35('0x37')](saveUpdates(_0x5ecfe0[_0x5b35('0x41')],null))[_0x5b35('0x37')](respondWithResult(_0x1a3a2c,null))[_0x5b35('0x3a')](handleError(_0x1a3a2c,null));};exports[_0x5b35('0x1e')]=function(_0x3e6a8d,_0x2e7d02){return db['CloudProvider'][_0x5b35('0x42')]({'where':{'id':_0x3e6a8d[_0x5b35('0x3c')]['id']}})[_0x5b35('0x37')](handleEntityNotFound(_0x2e7d02,null))['then'](removeEntity(_0x2e7d02,null))[_0x5b35('0x3a')](handleError(_0x2e7d02,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 89f4e8c..4d1f96b 100644 --- a/server/api/cloudProvider/cloudProvider.model.js +++ b/server/api/cloudProvider/cloudProvider.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2659=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers'];(function(_0x396883,_0x5851ff){var _0x3b64d4=function(_0x3f271f){while(--_0x3f271f){_0x396883['push'](_0x396883['shift']());}};_0x3b64d4(++_0x5851ff);}(_0x2659,0x8f));var _0x9265=function(_0x586fa2,_0x1a45bc){_0x586fa2=_0x586fa2-0x0;var _0x515be9=_0x2659[_0x586fa2];return _0x515be9;};'use strict';var _=require(_0x9265('0x0'));var util=require(_0x9265('0x1'));var logger=require(_0x9265('0x2'))(_0x9265('0x3'));var moment=require('moment');var BPromise=require(_0x9265('0x4'));var rp=require(_0x9265('0x5'));var fs=require('fs');var path=require(_0x9265('0x6'));var rimraf=require('rimraf');var config=require(_0x9265('0x7'));var attributes=require(_0x9265('0x8'));module[_0x9265('0x9')]=function(_0x12e412,_0x1c780a){return _0x12e412[_0x9265('0xa')](_0x9265('0xb'),attributes,{'tableName':_0x9265('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1493=['exports','define','cloud_providers','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cloudProvider.attributes'];(function(_0x22b5ec,_0x76491a){var _0x62895b=function(_0x85a7b){while(--_0x85a7b){_0x22b5ec['push'](_0x22b5ec['shift']());}};_0x62895b(++_0x76491a);}(_0x1493,0x87));var _0x3149=function(_0x20a541,_0x15adcb){_0x20a541=_0x20a541-0x0;var _0x11264c=_0x1493[_0x20a541];return _0x11264c;};'use strict';var _=require('lodash');var util=require(_0x3149('0x0'));var logger=require(_0x3149('0x1'))(_0x3149('0x2'));var moment=require(_0x3149('0x3'));var BPromise=require(_0x3149('0x4'));var rp=require(_0x3149('0x5'));var fs=require('fs');var path=require(_0x3149('0x6'));var rimraf=require(_0x3149('0x7'));var config=require('../../config/environment');var attributes=require(_0x3149('0x8'));module[_0x3149('0x9')]=function(_0x58ee59,_0x3d09f5){return _0x58ee59[_0x3149('0xa')]('CloudProvider',attributes,{'tableName':_0x3149('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 7fbd788..0790d7f 100644 --- a/server/api/cloudProvider/cloudProvider.rpc.js +++ b/server/api/cloudProvider/cloudProvider.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e37=['../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3fc86a,_0x519c23){var _0x1ff0d2=function(_0x1e6d5e){while(--_0x1e6d5e){_0x3fc86a['push'](_0x3fc86a['shift']());}};_0x1ff0d2(++_0x519c23);}(_0x0e37,0x160));var _0x70e3=function(_0x861c02,_0x59eefd){_0x861c02=_0x861c02-0x0;var _0x2bfd8b=_0x0e37[_0x861c02];return _0x2bfd8b;};'use strict';var _=require(_0x70e3('0x0'));var util=require(_0x70e3('0x1'));var moment=require(_0x70e3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x70e3('0x3'));var db=require(_0x70e3('0x4'))['db'];var utils=require(_0x70e3('0x5'));var logger=require(_0x70e3('0x6'))(_0x70e3('0x7'));var config=require(_0x70e3('0x8'));var jayson=require(_0x70e3('0x9'));var client=jayson[_0x70e3('0xa')][_0x70e3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41378c,_0x20ae88,_0x1d1765){return new BPromise(function(_0x482038,_0xb70b15){return client[_0x70e3('0xc')](_0x41378c,_0x1d1765)[_0x70e3('0xd')](function(_0x4ef177){logger[_0x70e3('0xe')](_0x70e3('0xf'),_0x20ae88,_0x70e3('0x10'));logger[_0x70e3('0x11')](_0x70e3('0x12'),_0x20ae88,_0x70e3('0x10'),JSON[_0x70e3('0x13')](_0x4ef177));if(_0x4ef177[_0x70e3('0x14')]){if(_0x4ef177[_0x70e3('0x14')][_0x70e3('0x15')]===0x1f4){logger[_0x70e3('0x14')]('CloudProvider,\x20%s,\x20%s',_0x20ae88,_0x4ef177[_0x70e3('0x14')][_0x70e3('0x16')]);return _0xb70b15(_0x4ef177[_0x70e3('0x14')][_0x70e3('0x16')]);}logger['error'](_0x70e3('0xf'),_0x20ae88,_0x4ef177[_0x70e3('0x14')][_0x70e3('0x16')]);return _0x482038(_0x4ef177[_0x70e3('0x14')][_0x70e3('0x16')]);}else{logger[_0x70e3('0xe')]('CloudProvider,\x20%s,\x20%s',_0x20ae88,'request\x20sent');_0x482038(_0x4ef177[_0x70e3('0x17')][_0x70e3('0x16')]);}})['catch'](function(_0x1948ca){logger[_0x70e3('0x14')](_0x70e3('0xf'),_0x20ae88,_0x1948ca);_0xb70b15(_0x1948ca);});});} \ No newline at end of file +var _0xf05e=['lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x26ef7b,_0x578a7f){var _0x3a8e98=function(_0x403309){while(--_0x403309){_0x26ef7b['push'](_0x26ef7b['shift']());}};_0x3a8e98(++_0x578a7f);}(_0xf05e,0xd8));var _0xef05=function(_0x320610,_0x21802d){_0x320610=_0x320610-0x0;var _0x275cc4=_0xf05e[_0x320610];return _0x275cc4;};'use strict';var _=require(_0xef05('0x0'));var util=require(_0xef05('0x1'));var moment=require(_0xef05('0x2'));var BPromise=require(_0xef05('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xef05('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xef05('0x5'));var logger=require(_0xef05('0x6'))(_0xef05('0x7'));var config=require(_0xef05('0x8'));var jayson=require(_0xef05('0x9'));var client=jayson[_0xef05('0xa')][_0xef05('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x292121,_0x506f19,_0x2572ea){return new BPromise(function(_0x4c9a0c,_0x2748a5){return client[_0xef05('0xc')](_0x292121,_0x2572ea)[_0xef05('0xd')](function(_0x42aa76){logger[_0xef05('0xe')](_0xef05('0xf'),_0x506f19,_0xef05('0x10'));logger[_0xef05('0x11')](_0xef05('0x12'),_0x506f19,_0xef05('0x10'),JSON[_0xef05('0x13')](_0x42aa76));if(_0x42aa76[_0xef05('0x14')]){if(_0x42aa76[_0xef05('0x14')][_0xef05('0x15')]===0x1f4){logger[_0xef05('0x14')](_0xef05('0xf'),_0x506f19,_0x42aa76[_0xef05('0x14')]['message']);return _0x2748a5(_0x42aa76[_0xef05('0x14')][_0xef05('0x16')]);}logger[_0xef05('0x14')](_0xef05('0xf'),_0x506f19,_0x42aa76['error'][_0xef05('0x16')]);return _0x4c9a0c(_0x42aa76[_0xef05('0x14')][_0xef05('0x16')]);}else{logger[_0xef05('0xe')](_0xef05('0xf'),_0x506f19,'request\x20sent');_0x4c9a0c(_0x42aa76[_0xef05('0x17')][_0xef05('0x16')]);}})['catch'](function(_0x1f340d){logger[_0xef05('0x14')](_0xef05('0xf'),_0x506f19,_0x1f340d);_0x2748a5(_0x1f340d);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 4b3bc79..e4c56bb 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa4e5=['get','isAuthenticated','index','show','post','put','/:id','update','multer','util','path','connect-timeout','express','../../config/environment','./cloudProvider.controller'];(function(_0x1ce73e,_0x1441e5){var _0x188f94=function(_0x5372a9){while(--_0x5372a9){_0x1ce73e['push'](_0x1ce73e['shift']());}};_0x188f94(++_0x1441e5);}(_0xa4e5,0xe9));var _0x5a4e=function(_0x26f1cf,_0x3ed15f){_0x26f1cf=_0x26f1cf-0x0;var _0x6674e8=_0xa4e5[_0x26f1cf];return _0x6674e8;};'use strict';var multer=require(_0x5a4e('0x0'));var util=require(_0x5a4e('0x1'));var path=require(_0x5a4e('0x2'));var timeout=require(_0x5a4e('0x3'));var express=require(_0x5a4e('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5a4e('0x5'));var controller=require(_0x5a4e('0x6'));router[_0x5a4e('0x7')]('/',auth[_0x5a4e('0x8')](),controller[_0x5a4e('0x9')]);router['get']('/:id',auth[_0x5a4e('0x8')](),controller[_0x5a4e('0xa')]);router[_0x5a4e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5a4e('0xc')](_0x5a4e('0xd'),auth[_0x5a4e('0x8')](),controller[_0x5a4e('0xe')]);router['delete'](_0x5a4e('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x88ba=['/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','index','get'];(function(_0x4cea4b,_0x371227){var _0x161856=function(_0x545400){while(--_0x545400){_0x4cea4b['push'](_0x4cea4b['shift']());}};_0x161856(++_0x371227);}(_0x88ba,0xbd));var _0xa88b=function(_0x309991,_0x457e73){_0x309991=_0x309991-0x0;var _0x4ca94d=_0x88ba[_0x309991];return _0x4ca94d;};'use strict';var multer=require(_0xa88b('0x0'));var util=require(_0xa88b('0x1'));var path=require('path');var timeout=require(_0xa88b('0x2'));var express=require(_0xa88b('0x3'));var router=express[_0xa88b('0x4')]();var auth=require(_0xa88b('0x5'));var interaction=require(_0xa88b('0x6'));var config=require(_0xa88b('0x7'));var controller=require(_0xa88b('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa88b('0x9')]);router[_0xa88b('0xa')](_0xa88b('0xb'),auth[_0xa88b('0xc')](),controller['show']);router[_0xa88b('0xd')]('/',auth[_0xa88b('0xc')](),controller[_0xa88b('0xe')]);router[_0xa88b('0xf')](_0xa88b('0xb'),auth[_0xa88b('0xc')](),controller[_0xa88b('0x10')]);router[_0xa88b('0x11')]('/:id',auth[_0xa88b('0xc')](),controller[_0xa88b('0x12')]);module[_0xa88b('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 8a28181..db1486f 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 _0xd28d=['name','sequelize','exports','STRING'];(function(_0x27ca0d,_0x53230f){var _0x38a570=function(_0x29e565){while(--_0x29e565){_0x27ca0d['push'](_0x27ca0d['shift']());}};_0x38a570(++_0x53230f);}(_0xd28d,0x105));var _0xdd28=function(_0x2430b1,_0x5a2a78){_0x2430b1=_0x2430b1-0x0;var _0x5c0fb0=_0xd28d[_0x2430b1];return _0x5c0fb0;};'use strict';var Sequelize=require(_0xdd28('0x0'));module[_0xdd28('0x1')]={'name':{'type':Sequelize[_0xdd28('0x2')],'unique':_0xdd28('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xdd28('0x2')]},'companyId':{'type':Sequelize[_0xdd28('0x2')]},'website':{'type':Sequelize[_0xdd28('0x2')]},'phone':{'type':Sequelize[_0xdd28('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xdd28('0x2')]},'postalCode':{'type':Sequelize[_0xdd28('0x2')]},'city':{'type':Sequelize[_0xdd28('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xdd28('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xdd28('0x2')]},'sStreet':{'type':Sequelize[_0xdd28('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xdd28('0x2')]},'description':{'type':Sequelize[_0xdd28('0x2')]}}; \ No newline at end of file +var _0x1f3b=['exports','STRING','name','sequelize'];(function(_0x62ce2d,_0x4f4ef9){var _0x2984d8=function(_0x1b45a4){while(--_0x1b45a4){_0x62ce2d['push'](_0x62ce2d['shift']());}};_0x2984d8(++_0x4f4ef9);}(_0x1f3b,0x163));var _0xb1f3=function(_0x5eaa6a,_0x41d4f9){_0x5eaa6a=_0x5eaa6a-0x0;var _0x332a98=_0x1f3b[_0x5eaa6a];return _0x332a98;};'use strict';var Sequelize=require(_0xb1f3('0x0'));module[_0xb1f3('0x1')]={'name':{'type':Sequelize[_0xb1f3('0x2')],'unique':_0xb1f3('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xb1f3('0x2')]},'companyId':{'type':Sequelize[_0xb1f3('0x2')]},'website':{'type':Sequelize[_0xb1f3('0x2')]},'phone':{'type':Sequelize[_0xb1f3('0x2')]},'fax':{'type':Sequelize[_0xb1f3('0x2')]},'type':{'type':Sequelize[_0xb1f3('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xb1f3('0x2')]},'city':{'type':Sequelize[_0xb1f3('0x2')]},'country':{'type':Sequelize[_0xb1f3('0x2')]},'email':{'type':Sequelize[_0xb1f3('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xb1f3('0x2')]},'sStreet':{'type':Sequelize[_0xb1f3('0x2')]},'sPostalCode':{'type':Sequelize[_0xb1f3('0x2')]},'sCity':{'type':Sequelize[_0xb1f3('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb1f3('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 374fefc..cc8c44c 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 _0xb026=['filter','where','merge','map','options','CmCompany','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','create','body','user','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContact','ids','omit','getContacts','findOne','hasOwnProperty','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','describe','model','keys','query','filters','intersection','length','attributes','nolimit','order','sort','pick'];(function(_0x389c94,_0x2a93d9){var _0x1455cb=function(_0x5903d6){while(--_0x5903d6){_0x389c94['push'](_0x389c94['shift']());}};_0x1455cb(++_0x2a93d9);}(_0xb026,0x1ca));var _0x6b02=function(_0x16a101,_0x12caba){_0x16a101=_0x16a101-0x0;var _0x47b258=_0xb026[_0x16a101];return _0x47b258;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6b02('0x0'));var rimraf=require(_0x6b02('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6b02('0x2'));var BPromise=require(_0x6b02('0x3'));var Mustache=require(_0x6b02('0x4'));var util=require(_0x6b02('0x5'));var path=require(_0x6b02('0x6'));var sox=require(_0x6b02('0x7'));var csv=require(_0x6b02('0x8'));var ejs=require(_0x6b02('0x9'));var fs=require('fs');var _=require(_0x6b02('0xa'));var squel=require(_0x6b02('0xb'));var crypto=require(_0x6b02('0xc'));var jsforce=require(_0x6b02('0xd'));var deskjs=require(_0x6b02('0xe'));var toCsv=require(_0x6b02('0x8'));var querystring=require('querystring');var Papa=require(_0x6b02('0xf'));var Redis=require(_0x6b02('0x10'));var authService=require(_0x6b02('0x11'));var qs=require(_0x6b02('0x12'));var as=require(_0x6b02('0x13'));var hardwareService=require(_0x6b02('0x14'));var logger=require(_0x6b02('0x15'))(_0x6b02('0x16'));var utils=require(_0x6b02('0x17'));var config=require(_0x6b02('0x18'));var db=require(_0x6b02('0x19'))['db'];function respondWithStatusCode(_0x5e4c41,_0x4c5826){_0x4c5826=_0x4c5826||0xcc;return function(_0x2bc3dd){if(_0x2bc3dd){return _0x5e4c41[_0x6b02('0x1a')](_0x4c5826);}return _0x5e4c41[_0x6b02('0x1b')](_0x4c5826)[_0x6b02('0x1c')]();};}function respondWithResult(_0x4e4a53,_0x5b97cb){_0x5b97cb=_0x5b97cb||0xc8;return function(_0x3cb325){if(_0x3cb325){return _0x4e4a53[_0x6b02('0x1b')](_0x5b97cb)['json'](_0x3cb325);}};}function respondWithFilteredResult(_0x5eb09b,_0x30d38a){return function(_0x101e1d){if(_0x101e1d){var _0x59a604=_0x101e1d[_0x6b02('0x1d')],_0x2f9310=_0x30d38a[_0x6b02('0x1e')],_0x1efde9=_0x30d38a['offset']+_0x30d38a[_0x6b02('0x1f')],_0x3f4d4b;if(_0x1efde9>=_0x59a604){_0x1efde9=_0x59a604;_0x3f4d4b=0xc8;}else{_0x3f4d4b=0xce;}_0x5eb09b['status'](_0x3f4d4b);return _0x5eb09b[_0x6b02('0x20')](_0x6b02('0x21'),_0x2f9310+'-'+_0x1efde9+'/'+_0x59a604)['json'](_0x101e1d);}return null;};}function patchUpdates(_0x2300ac){return function(_0x5c1794){try{jsonpatch[_0x6b02('0x22')](_0x5c1794,_0x2300ac,!![]);}catch(_0x404267){return BPromise[_0x6b02('0x23')](_0x404267);}return _0x5c1794[_0x6b02('0x24')]();};}function saveUpdates(_0xafc247,_0x1594e7){return function(_0xb7f4b1){if(_0xb7f4b1){return _0xb7f4b1[_0x6b02('0x25')](_0xafc247)[_0x6b02('0x26')](function(_0x19d3e1){return _0x19d3e1;});}return null;};}function removeEntity(_0x37a917,_0x52c944){return function(_0x181bab){if(_0x181bab){return _0x181bab[_0x6b02('0x27')]()[_0x6b02('0x26')](function(){var _0x26d6f1=_0x181bab[_0x6b02('0x28')]({'plain':!![]});var _0x5befb4='Companies';return db[_0x6b02('0x29')][_0x6b02('0x27')]({'where':{'type':_0x5befb4,'resourceId':_0x26d6f1['id']}})[_0x6b02('0x26')](function(){return _0x181bab;});})[_0x6b02('0x26')](function(){_0x37a917[_0x6b02('0x1b')](0xcc)[_0x6b02('0x1c')]();});}};}function handleEntityNotFound(_0x48b5db,_0xe64b4d){return function(_0x4e27a6){if(!_0x4e27a6){_0x48b5db[_0x6b02('0x1a')](0x194);}return _0x4e27a6;};}function handleError(_0x1fe0a8,_0x36fb73){_0x36fb73=_0x36fb73||0x1f4;return function(_0x4de072){logger['error'](_0x4de072[_0x6b02('0x2a')]);if(_0x4de072[_0x6b02('0x2b')]){delete _0x4de072[_0x6b02('0x2b')];}_0x1fe0a8[_0x6b02('0x1b')](_0x36fb73)[_0x6b02('0x2c')](_0x4de072);};}exports[_0x6b02('0x2d')]=function(_0xa197b1,_0x3b3fee){var _0x2650a4={},_0x3f64be={},_0x271190={'count':0x0,'rows':[]};return db['CmCompany'][_0x6b02('0x2e')]()['then'](function(_0x28e77b){_0x3f64be[_0x6b02('0x2f')]=_[_0x6b02('0x30')](_0x28e77b);_0x3f64be[_0x6b02('0x31')]=_[_0x6b02('0x30')](_0xa197b1[_0x6b02('0x31')]);_0x3f64be[_0x6b02('0x32')]=_[_0x6b02('0x33')](_0x3f64be[_0x6b02('0x2f')],_0x3f64be['query']);_0x2650a4['attributes']=_[_0x6b02('0x33')](_0x3f64be[_0x6b02('0x2f')],qs['fields'](_0xa197b1[_0x6b02('0x31')]['fields']));_0x2650a4['attributes']=_0x2650a4['attributes'][_0x6b02('0x34')]?_0x2650a4[_0x6b02('0x35')]:_0x3f64be['model'];if(!_0xa197b1[_0x6b02('0x31')]['hasOwnProperty'](_0x6b02('0x36'))){_0x2650a4[_0x6b02('0x1f')]=qs['limit'](_0xa197b1[_0x6b02('0x31')]['limit']);_0x2650a4[_0x6b02('0x1e')]=qs[_0x6b02('0x1e')](_0xa197b1[_0x6b02('0x31')][_0x6b02('0x1e')]);}_0x2650a4[_0x6b02('0x37')]=qs[_0x6b02('0x38')](_0xa197b1[_0x6b02('0x31')][_0x6b02('0x38')]);_0x2650a4['where']=qs[_0x6b02('0x32')](_[_0x6b02('0x39')](_0xa197b1[_0x6b02('0x31')],_0x3f64be[_0x6b02('0x32')]),_0x28e77b);if(_0xa197b1[_0x6b02('0x31')][_0x6b02('0x3a')]){_0x2650a4[_0x6b02('0x3b')]=_[_0x6b02('0x3c')](_0x2650a4[_0x6b02('0x3b')],{'$or':_[_0x6b02('0x3d')](_0x2650a4[_0x6b02('0x35')],function(_0x10cc5b){var _0x4a5ca8={};_0x4a5ca8[_0x10cc5b]={'$like':'%'+_0xa197b1[_0x6b02('0x31')][_0x6b02('0x3a')]+'%'};return _0x4a5ca8;})});}_0x2650a4=_['merge']({},_0x2650a4,_0xa197b1[_0x6b02('0x3e')]);var _0x13f59b={'where':_0x2650a4['where']};return db[_0x6b02('0x3f')]['count'](_0x13f59b)[_0x6b02('0x26')](function(_0x2b0891){_0x271190[_0x6b02('0x1d')]=_0x2b0891;if(_0xa197b1[_0x6b02('0x31')][_0x6b02('0x40')]){_0x2650a4[_0x6b02('0x41')]=[{'all':!![]}];}return db[_0x6b02('0x3f')][_0x6b02('0x42')](_0x2650a4);})[_0x6b02('0x26')](function(_0x4f7bca){_0x271190[_0x6b02('0x43')]=_0x4f7bca;return _0x271190;})[_0x6b02('0x26')](respondWithFilteredResult(_0x3b3fee,_0x2650a4))[_0x6b02('0x44')](handleError(_0x3b3fee,null));})['catch'](handleError(_0x3b3fee,null));};exports[_0x6b02('0x45')]=function(_0x33fd36,_0x37c69a){var _0x5a38c9={'raw':![],'where':{'id':_0x33fd36[_0x6b02('0x46')]['id']}},_0x5188c2={};_0x5188c2['model']=_[_0x6b02('0x30')](db[_0x6b02('0x3f')][_0x6b02('0x47')]);_0x5188c2['query']=_['keys'](_0x33fd36[_0x6b02('0x31')]);_0x5188c2['filters']=_[_0x6b02('0x33')](_0x5188c2['model'],_0x5188c2[_0x6b02('0x31')]);_0x5a38c9[_0x6b02('0x35')]=_[_0x6b02('0x33')](_0x5188c2[_0x6b02('0x2f')],qs[_0x6b02('0x48')](_0x33fd36[_0x6b02('0x31')][_0x6b02('0x48')]));_0x5a38c9[_0x6b02('0x35')]=_0x5a38c9[_0x6b02('0x35')][_0x6b02('0x34')]?_0x5a38c9[_0x6b02('0x35')]:_0x5188c2[_0x6b02('0x2f')];if(_0x33fd36[_0x6b02('0x31')]['includeAll']){_0x5a38c9[_0x6b02('0x41')]=[{'all':!![]}];}_0x5a38c9=_[_0x6b02('0x3c')]({},_0x5a38c9,_0x33fd36[_0x6b02('0x3e')]);return db[_0x6b02('0x3f')]['find'](_0x5a38c9)[_0x6b02('0x26')](handleEntityNotFound(_0x37c69a,null))[_0x6b02('0x26')](respondWithResult(_0x37c69a,null))[_0x6b02('0x44')](handleError(_0x37c69a,null));};exports[_0x6b02('0x49')]=function(_0x573be0,_0x1c88dc){return db[_0x6b02('0x3f')][_0x6b02('0x49')](_0x573be0[_0x6b02('0x4a')],{})['then'](function(_0x4742e5){var _0x4c3f7a=_0x573be0['user']['get']({'plain':!![]});if(!_0x4c3f7a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c3f7a['role']===_0x6b02('0x4b')){var _0x2fb98e=_0x4742e5[_0x6b02('0x28')]({'plain':!![]});var _0x2e9105='Companies';return db[_0x6b02('0x4c')][_0x6b02('0x4d')]({'where':{'name':_0x2e9105,'userProfileId':_0x4c3f7a['userProfileId']},'raw':!![]})['then'](function(_0x41c7ec){if(_0x41c7ec&&_0x41c7ec['autoAssociation']===0x0){return db[_0x6b02('0x29')][_0x6b02('0x49')]({'name':_0x2fb98e[_0x6b02('0x2b')],'resourceId':_0x2fb98e['id'],'type':_0x41c7ec[_0x6b02('0x2b')],'sectionId':_0x41c7ec['id']},{})['then'](function(){return _0x4742e5;});}else{return _0x4742e5;}})[_0x6b02('0x44')](function(_0x115038){logger[_0x6b02('0x4e')](_0x6b02('0x4f'),_0x115038);throw _0x115038;});}return _0x4742e5;})['then'](respondWithResult(_0x1c88dc,0xc9))[_0x6b02('0x44')](handleError(_0x1c88dc,null));};exports[_0x6b02('0x25')]=function(_0x30eeb0,_0x110ecd){if(_0x30eeb0[_0x6b02('0x4a')]['id']){delete _0x30eeb0['body']['id'];}return db[_0x6b02('0x3f')]['find']({'where':{'id':_0x30eeb0[_0x6b02('0x46')]['id']}})['then'](handleEntityNotFound(_0x110ecd,null))[_0x6b02('0x26')](saveUpdates(_0x30eeb0['body'],null))[_0x6b02('0x26')](respondWithResult(_0x110ecd,null))[_0x6b02('0x44')](handleError(_0x110ecd,null));};exports[_0x6b02('0x27')]=function(_0x5a48d7,_0x2733d1){return db[_0x6b02('0x3f')][_0x6b02('0x4d')]({'where':{'id':_0x5a48d7[_0x6b02('0x46')]['id']}})[_0x6b02('0x26')](handleEntityNotFound(_0x2733d1,null))[_0x6b02('0x26')](removeEntity(_0x2733d1,null))[_0x6b02('0x44')](handleError(_0x2733d1,null));};exports[_0x6b02('0x2e')]=function(_0x2b47ac,_0x292f7d){return db[_0x6b02('0x3f')][_0x6b02('0x2e')]()[_0x6b02('0x26')](respondWithResult(_0x292f7d,null))[_0x6b02('0x44')](handleError(_0x292f7d,null));};exports['addContacts']=function(_0x46400d,_0x3f4f51,_0x3bac42){return db[_0x6b02('0x50')]['find']({'where':{'id':_0x46400d[_0x6b02('0x46')]['id']}})[_0x6b02('0x26')](handleEntityNotFound(_0x3f4f51,null))[_0x6b02('0x26')](function(_0x286d30){if(_0x286d30){return _0x286d30['addContacts'](_0x46400d['body'][_0x6b02('0x51')],_[_0x6b02('0x52')](_0x46400d[_0x6b02('0x4a')],[_0x6b02('0x51'),'id'])||{});}})[_0x6b02('0x26')](respondWithResult(_0x3f4f51,null))['catch'](handleError(_0x3f4f51,null));};exports[_0x6b02('0x53')]=function(_0x163fe3,_0x461e7b,_0x5343d0){var _0x6e7236={};var _0x4895df={};var _0x47310b;var _0x53f959;return db[_0x6b02('0x3f')][_0x6b02('0x54')]({'where':{'id':_0x163fe3['params']['id']}})[_0x6b02('0x26')](handleEntityNotFound(_0x461e7b,null))[_0x6b02('0x26')](function(_0x54e735){if(_0x54e735){_0x47310b=_0x54e735;_0x4895df[_0x6b02('0x2f')]=_[_0x6b02('0x30')](db[_0x6b02('0x50')][_0x6b02('0x47')]);_0x4895df['query']=_['keys'](_0x163fe3[_0x6b02('0x31')]);_0x4895df[_0x6b02('0x32')]=_['intersection'](_0x4895df[_0x6b02('0x2f')],_0x4895df['query']);_0x6e7236[_0x6b02('0x35')]=_[_0x6b02('0x33')](_0x4895df[_0x6b02('0x2f')],qs[_0x6b02('0x48')](_0x163fe3[_0x6b02('0x31')][_0x6b02('0x48')]));_0x6e7236[_0x6b02('0x35')]=_0x6e7236[_0x6b02('0x35')][_0x6b02('0x34')]?_0x6e7236[_0x6b02('0x35')]:_0x4895df[_0x6b02('0x2f')];_0x6e7236[_0x6b02('0x37')]=qs[_0x6b02('0x38')](_0x163fe3[_0x6b02('0x31')][_0x6b02('0x38')]);_0x6e7236[_0x6b02('0x3b')]=qs[_0x6b02('0x32')](_['pick'](_0x163fe3[_0x6b02('0x31')],_0x4895df[_0x6b02('0x32')]));if(_0x163fe3['query']['filter']){_0x6e7236['where']=_[_0x6b02('0x3c')](_0x6e7236[_0x6b02('0x3b')],{'$or':_[_0x6b02('0x3d')](_0x6e7236['attributes'],function(_0x100d8c){var _0x44849b={};_0x44849b[_0x100d8c]={'$like':'%'+_0x163fe3[_0x6b02('0x31')][_0x6b02('0x3a')]+'%'};return _0x44849b;})});}_0x6e7236=_['merge']({},_0x6e7236,_0x163fe3[_0x6b02('0x3e')]);return _0x47310b[_0x6b02('0x53')](_0x6e7236);}})[_0x6b02('0x26')](function(_0x5cb2ff){if(_0x5cb2ff){_0x53f959=_0x5cb2ff[_0x6b02('0x34')];if(!_0x163fe3[_0x6b02('0x31')][_0x6b02('0x55')](_0x6b02('0x36'))){_0x6e7236[_0x6b02('0x1f')]=qs['limit'](_0x163fe3['query']['limit']);_0x6e7236[_0x6b02('0x1e')]=qs[_0x6b02('0x1e')](_0x163fe3[_0x6b02('0x31')][_0x6b02('0x1e')]);}return _0x47310b[_0x6b02('0x53')](_0x6e7236);}})[_0x6b02('0x26')](function(_0x4b4b68){if(_0x4b4b68){return _0x4b4b68?{'count':_0x53f959,'rows':_0x4b4b68}:null;}})[_0x6b02('0x26')](respondWithResult(_0x461e7b,null))[_0x6b02('0x44')](handleError(_0x461e7b,null));}; \ No newline at end of file +var _0x84ad=['Companies','UserProfileResource','error','stack','name','send','CmCompany','describe','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','options','count','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','omit','getContacts','map','nolimit','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','destroy','then'];(function(_0x37d1da,_0x21a138){var _0x5344d4=function(_0x37cf85){while(--_0x37cf85){_0x37d1da['push'](_0x37d1da['shift']());}};_0x5344d4(++_0x21a138);}(_0x84ad,0x1d3));var _0xd84a=function(_0x2a99ea,_0x1bfb13){_0x2a99ea=_0x2a99ea-0x0;var _0x5887ae=_0x84ad[_0x2a99ea];return _0x5887ae;};'use strict';var pdf=require(_0xd84a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd84a('0x1'));var zipdir=require(_0xd84a('0x2'));var jsonpatch=require(_0xd84a('0x3'));var rp=require('request-promise');var moment=require(_0xd84a('0x4'));var BPromise=require(_0xd84a('0x5'));var Mustache=require(_0xd84a('0x6'));var util=require(_0xd84a('0x7'));var path=require(_0xd84a('0x8'));var sox=require(_0xd84a('0x9'));var csv=require(_0xd84a('0xa'));var ejs=require(_0xd84a('0xb'));var fs=require('fs');var _=require(_0xd84a('0xc'));var squel=require('squel');var crypto=require(_0xd84a('0xd'));var jsforce=require(_0xd84a('0xe'));var deskjs=require(_0xd84a('0xf'));var toCsv=require(_0xd84a('0xa'));var querystring=require('querystring');var Papa=require(_0xd84a('0x10'));var Redis=require(_0xd84a('0x11'));var authService=require(_0xd84a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd84a('0x13'));var hardwareService=require(_0xd84a('0x14'));var logger=require(_0xd84a('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xd84a('0x16'));var db=require(_0xd84a('0x17'))['db'];function respondWithStatusCode(_0x162170,_0x24c08f){_0x24c08f=_0x24c08f||0xcc;return function(_0x3ef7a9){if(_0x3ef7a9){return _0x162170[_0xd84a('0x18')](_0x24c08f);}return _0x162170[_0xd84a('0x19')](_0x24c08f)[_0xd84a('0x1a')]();};}function respondWithResult(_0x47c17a,_0x2c5153){_0x2c5153=_0x2c5153||0xc8;return function(_0x2ab51c){if(_0x2ab51c){return _0x47c17a['status'](_0x2c5153)[_0xd84a('0x1b')](_0x2ab51c);}};}function respondWithFilteredResult(_0x222f7c,_0x2cf044){return function(_0x558908){if(_0x558908){var _0x370e6d=_0x558908['count'],_0x38c8b3=_0x2cf044[_0xd84a('0x1c')],_0x5a00bf=_0x2cf044['offset']+_0x2cf044[_0xd84a('0x1d')],_0x34a93c;if(_0x5a00bf>=_0x370e6d){_0x5a00bf=_0x370e6d;_0x34a93c=0xc8;}else{_0x34a93c=0xce;}_0x222f7c[_0xd84a('0x19')](_0x34a93c);return _0x222f7c[_0xd84a('0x1e')](_0xd84a('0x1f'),_0x38c8b3+'-'+_0x5a00bf+'/'+_0x370e6d)['json'](_0x558908);}return null;};}function patchUpdates(_0x2b3a9c){return function(_0x45e709){try{jsonpatch[_0xd84a('0x20')](_0x45e709,_0x2b3a9c,!![]);}catch(_0x33f552){return BPromise['reject'](_0x33f552);}return _0x45e709[_0xd84a('0x21')]();};}function saveUpdates(_0x286337,_0x4efd96){return function(_0x20cf8c){if(_0x20cf8c){return _0x20cf8c[_0xd84a('0x22')](_0x286337)['then'](function(_0x57f882){return _0x57f882;});}return null;};}function removeEntity(_0x10fd92,_0x2cce12){return function(_0x4c58b7){if(_0x4c58b7){return _0x4c58b7[_0xd84a('0x23')]()[_0xd84a('0x24')](function(){var _0x477778=_0x4c58b7['get']({'plain':!![]});var _0x13c4e8=_0xd84a('0x25');return db[_0xd84a('0x26')][_0xd84a('0x23')]({'where':{'type':_0x13c4e8,'resourceId':_0x477778['id']}})['then'](function(){return _0x4c58b7;});})[_0xd84a('0x24')](function(){_0x10fd92[_0xd84a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b6be9,_0x15d384){return function(_0x12d27e){if(!_0x12d27e){_0x5b6be9['sendStatus'](0x194);}return _0x12d27e;};}function handleError(_0x46ea24,_0x388da8){_0x388da8=_0x388da8||0x1f4;return function(_0x47491c){logger[_0xd84a('0x27')](_0x47491c[_0xd84a('0x28')]);if(_0x47491c[_0xd84a('0x29')]){delete _0x47491c[_0xd84a('0x29')];}_0x46ea24[_0xd84a('0x19')](_0x388da8)[_0xd84a('0x2a')](_0x47491c);};}exports['index']=function(_0x3cf1da,_0x569dff){var _0x70fb7={},_0x128374={},_0x45d8af={'count':0x0,'rows':[]};return db[_0xd84a('0x2b')][_0xd84a('0x2c')]()[_0xd84a('0x24')](function(_0x2d2797){_0x128374[_0xd84a('0x2d')]=_[_0xd84a('0x2e')](_0x2d2797);_0x128374[_0xd84a('0x2f')]=_[_0xd84a('0x2e')](_0x3cf1da['query']);_0x128374[_0xd84a('0x30')]=_['intersection'](_0x128374[_0xd84a('0x2d')],_0x128374[_0xd84a('0x2f')]);_0x70fb7[_0xd84a('0x31')]=_[_0xd84a('0x32')](_0x128374['model'],qs['fields'](_0x3cf1da[_0xd84a('0x2f')][_0xd84a('0x33')]));_0x70fb7[_0xd84a('0x31')]=_0x70fb7[_0xd84a('0x31')][_0xd84a('0x34')]?_0x70fb7[_0xd84a('0x31')]:_0x128374[_0xd84a('0x2d')];if(!_0x3cf1da[_0xd84a('0x2f')][_0xd84a('0x35')]('nolimit')){_0x70fb7[_0xd84a('0x1d')]=qs['limit'](_0x3cf1da[_0xd84a('0x2f')]['limit']);_0x70fb7['offset']=qs[_0xd84a('0x1c')](_0x3cf1da[_0xd84a('0x2f')][_0xd84a('0x1c')]);}_0x70fb7[_0xd84a('0x36')]=qs[_0xd84a('0x37')](_0x3cf1da[_0xd84a('0x2f')][_0xd84a('0x37')]);_0x70fb7['where']=qs[_0xd84a('0x30')](_[_0xd84a('0x38')](_0x3cf1da[_0xd84a('0x2f')],_0x128374[_0xd84a('0x30')]),_0x2d2797);if(_0x3cf1da[_0xd84a('0x2f')][_0xd84a('0x39')]){_0x70fb7['where']=_[_0xd84a('0x3a')](_0x70fb7[_0xd84a('0x3b')],{'$or':_['map'](_0x70fb7[_0xd84a('0x31')],function(_0x3dbad2){var _0x6f7da3={};_0x6f7da3[_0x3dbad2]={'$like':'%'+_0x3cf1da[_0xd84a('0x2f')]['filter']+'%'};return _0x6f7da3;})});}_0x70fb7=_[_0xd84a('0x3a')]({},_0x70fb7,_0x3cf1da[_0xd84a('0x3c')]);var _0x5d5cee={'where':_0x70fb7[_0xd84a('0x3b')]};return db[_0xd84a('0x2b')][_0xd84a('0x3d')](_0x5d5cee)[_0xd84a('0x24')](function(_0x524e58){_0x45d8af['count']=_0x524e58;if(_0x3cf1da['query'][_0xd84a('0x3e')]){_0x70fb7[_0xd84a('0x3f')]=[{'all':!![]}];}return db[_0xd84a('0x2b')][_0xd84a('0x40')](_0x70fb7);})[_0xd84a('0x24')](function(_0x259a31){_0x45d8af['rows']=_0x259a31;return _0x45d8af;})[_0xd84a('0x24')](respondWithFilteredResult(_0x569dff,_0x70fb7))[_0xd84a('0x41')](handleError(_0x569dff,null));})[_0xd84a('0x41')](handleError(_0x569dff,null));};exports['show']=function(_0x4fac38,_0xb82835){var _0x29bdd8={'raw':![],'where':{'id':_0x4fac38[_0xd84a('0x42')]['id']}},_0x3e8534={};_0x3e8534['model']=_[_0xd84a('0x2e')](db[_0xd84a('0x2b')][_0xd84a('0x43')]);_0x3e8534['query']=_[_0xd84a('0x2e')](_0x4fac38[_0xd84a('0x2f')]);_0x3e8534[_0xd84a('0x30')]=_[_0xd84a('0x32')](_0x3e8534[_0xd84a('0x2d')],_0x3e8534[_0xd84a('0x2f')]);_0x29bdd8[_0xd84a('0x31')]=_[_0xd84a('0x32')](_0x3e8534[_0xd84a('0x2d')],qs[_0xd84a('0x33')](_0x4fac38[_0xd84a('0x2f')][_0xd84a('0x33')]));_0x29bdd8[_0xd84a('0x31')]=_0x29bdd8[_0xd84a('0x31')][_0xd84a('0x34')]?_0x29bdd8[_0xd84a('0x31')]:_0x3e8534[_0xd84a('0x2d')];if(_0x4fac38[_0xd84a('0x2f')]['includeAll']){_0x29bdd8[_0xd84a('0x3f')]=[{'all':!![]}];}_0x29bdd8=_[_0xd84a('0x3a')]({},_0x29bdd8,_0x4fac38[_0xd84a('0x3c')]);return db['CmCompany'][_0xd84a('0x44')](_0x29bdd8)[_0xd84a('0x24')](handleEntityNotFound(_0xb82835,null))['then'](respondWithResult(_0xb82835,null))[_0xd84a('0x41')](handleError(_0xb82835,null));};exports[_0xd84a('0x45')]=function(_0x295d53,_0x374806){return db[_0xd84a('0x2b')][_0xd84a('0x45')](_0x295d53[_0xd84a('0x46')],{})[_0xd84a('0x24')](function(_0x367a52){var _0x3f6a6b=_0x295d53[_0xd84a('0x47')][_0xd84a('0x48')]({'plain':!![]});if(!_0x3f6a6b)throw new Error(_0xd84a('0x49'));if(_0x3f6a6b['role']===_0xd84a('0x47')){var _0x1c6ec3=_0x367a52['get']({'plain':!![]});var _0x5294db=_0xd84a('0x25');return db[_0xd84a('0x4a')]['find']({'where':{'name':_0x5294db,'userProfileId':_0x3f6a6b[_0xd84a('0x4b')]},'raw':!![]})[_0xd84a('0x24')](function(_0x1e117f){if(_0x1e117f&&_0x1e117f[_0xd84a('0x4c')]===0x0){return db[_0xd84a('0x26')][_0xd84a('0x45')]({'name':_0x1c6ec3[_0xd84a('0x29')],'resourceId':_0x1c6ec3['id'],'type':_0x1e117f['name'],'sectionId':_0x1e117f['id']},{})[_0xd84a('0x24')](function(){return _0x367a52;});}else{return _0x367a52;}})[_0xd84a('0x41')](function(_0x292eef){logger['error'](_0xd84a('0x4d'),_0x292eef);throw _0x292eef;});}return _0x367a52;})['then'](respondWithResult(_0x374806,0xc9))[_0xd84a('0x41')](handleError(_0x374806,null));};exports['update']=function(_0x14d75e,_0x4c7b44){if(_0x14d75e['body']['id']){delete _0x14d75e[_0xd84a('0x46')]['id'];}return db['CmCompany'][_0xd84a('0x44')]({'where':{'id':_0x14d75e[_0xd84a('0x42')]['id']}})[_0xd84a('0x24')](handleEntityNotFound(_0x4c7b44,null))[_0xd84a('0x24')](saveUpdates(_0x14d75e[_0xd84a('0x46')],null))[_0xd84a('0x24')](respondWithResult(_0x4c7b44,null))['catch'](handleError(_0x4c7b44,null));};exports[_0xd84a('0x23')]=function(_0x3f565f,_0x51a3ab){return db['CmCompany'][_0xd84a('0x44')]({'where':{'id':_0x3f565f[_0xd84a('0x42')]['id']}})[_0xd84a('0x24')](handleEntityNotFound(_0x51a3ab,null))['then'](removeEntity(_0x51a3ab,null))['catch'](handleError(_0x51a3ab,null));};exports['describe']=function(_0x4a0a85,_0x3db359){return db[_0xd84a('0x2b')]['describe']()[_0xd84a('0x24')](respondWithResult(_0x3db359,null))[_0xd84a('0x41')](handleError(_0x3db359,null));};exports[_0xd84a('0x4e')]=function(_0x3a1e2d,_0x15a452,_0x4999d9){return db['CmContact'][_0xd84a('0x44')]({'where':{'id':_0x3a1e2d['params']['id']}})[_0xd84a('0x24')](handleEntityNotFound(_0x15a452,null))['then'](function(_0x43434e){if(_0x43434e){return _0x43434e[_0xd84a('0x4e')](_0x3a1e2d[_0xd84a('0x46')][_0xd84a('0x4f')],_[_0xd84a('0x50')](_0x3a1e2d[_0xd84a('0x46')],['ids','id'])||{});}})[_0xd84a('0x24')](respondWithResult(_0x15a452,null))[_0xd84a('0x41')](handleError(_0x15a452,null));};exports[_0xd84a('0x51')]=function(_0x4d0806,_0x4f2c46,_0x30c54d){var _0x2a2228={};var _0x1d32f1={};var _0x573b9a;var _0x12befc;return db['CmCompany']['findOne']({'where':{'id':_0x4d0806[_0xd84a('0x42')]['id']}})[_0xd84a('0x24')](handleEntityNotFound(_0x4f2c46,null))[_0xd84a('0x24')](function(_0x4860b7){if(_0x4860b7){_0x573b9a=_0x4860b7;_0x1d32f1['model']=_[_0xd84a('0x2e')](db['CmContact'][_0xd84a('0x43')]);_0x1d32f1[_0xd84a('0x2f')]=_[_0xd84a('0x2e')](_0x4d0806[_0xd84a('0x2f')]);_0x1d32f1[_0xd84a('0x30')]=_[_0xd84a('0x32')](_0x1d32f1[_0xd84a('0x2d')],_0x1d32f1[_0xd84a('0x2f')]);_0x2a2228['attributes']=_[_0xd84a('0x32')](_0x1d32f1[_0xd84a('0x2d')],qs[_0xd84a('0x33')](_0x4d0806[_0xd84a('0x2f')][_0xd84a('0x33')]));_0x2a2228[_0xd84a('0x31')]=_0x2a2228[_0xd84a('0x31')][_0xd84a('0x34')]?_0x2a2228[_0xd84a('0x31')]:_0x1d32f1[_0xd84a('0x2d')];_0x2a2228[_0xd84a('0x36')]=qs[_0xd84a('0x37')](_0x4d0806[_0xd84a('0x2f')][_0xd84a('0x37')]);_0x2a2228['where']=qs[_0xd84a('0x30')](_[_0xd84a('0x38')](_0x4d0806[_0xd84a('0x2f')],_0x1d32f1[_0xd84a('0x30')]));if(_0x4d0806['query'][_0xd84a('0x39')]){_0x2a2228[_0xd84a('0x3b')]=_['merge'](_0x2a2228[_0xd84a('0x3b')],{'$or':_[_0xd84a('0x52')](_0x2a2228['attributes'],function(_0xb82e5d){var _0x43c040={};_0x43c040[_0xb82e5d]={'$like':'%'+_0x4d0806[_0xd84a('0x2f')][_0xd84a('0x39')]+'%'};return _0x43c040;})});}_0x2a2228=_['merge']({},_0x2a2228,_0x4d0806['options']);return _0x573b9a[_0xd84a('0x51')](_0x2a2228);}})[_0xd84a('0x24')](function(_0x29046b){if(_0x29046b){_0x12befc=_0x29046b[_0xd84a('0x34')];if(!_0x4d0806[_0xd84a('0x2f')][_0xd84a('0x35')](_0xd84a('0x53'))){_0x2a2228[_0xd84a('0x1d')]=qs[_0xd84a('0x1d')](_0x4d0806[_0xd84a('0x2f')][_0xd84a('0x1d')]);_0x2a2228[_0xd84a('0x1c')]=qs[_0xd84a('0x1c')](_0x4d0806[_0xd84a('0x2f')][_0xd84a('0x1c')]);}return _0x573b9a['getContacts'](_0x2a2228);}})[_0xd84a('0x24')](function(_0x1dcb8c){if(_0x1dcb8c){return _0x1dcb8c?{'count':_0x12befc,'rows':_0x1dcb8c}:null;}})[_0xd84a('0x24')](respondWithResult(_0x4f2c46,null))[_0xd84a('0x41')](handleError(_0x4f2c46,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 21b7f81..3175688 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 _0x9161=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','CmCompany','lodash','util'];(function(_0x251c4b,_0xa07c4f){var _0x46d928=function(_0x298998){while(--_0x298998){_0x251c4b['push'](_0x251c4b['shift']());}};_0x46d928(++_0xa07c4f);}(_0x9161,0x102));var _0x1916=function(_0xe15ec2,_0xfbae18){_0xe15ec2=_0xe15ec2-0x0;var _0xb5f313=_0x9161[_0xe15ec2];return _0xb5f313;};'use strict';var _=require(_0x1916('0x0'));var util=require(_0x1916('0x1'));var logger=require(_0x1916('0x2'))(_0x1916('0x3'));var moment=require(_0x1916('0x4'));var BPromise=require(_0x1916('0x5'));var rp=require(_0x1916('0x6'));var fs=require('fs');var path=require(_0x1916('0x7'));var rimraf=require(_0x1916('0x8'));var config=require(_0x1916('0x9'));var attributes=require(_0x1916('0xa'));module[_0x1916('0xb')]=function(_0x43c858,_0x5de519){return _0x43c858['define'](_0x1916('0xc'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83e0=['exports','CmCompany','cm_companies','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0xcbdea2,_0x89553f){var _0x45f09=function(_0x563505){while(--_0x563505){_0xcbdea2['push'](_0xcbdea2['shift']());}};_0x45f09(++_0x89553f);}(_0x83e0,0x175));var _0x083e=function(_0x5bec15,_0x26dea5){_0x5bec15=_0x5bec15-0x0;var _0x46307b=_0x83e0[_0x5bec15];return _0x46307b;};'use strict';var _=require(_0x083e('0x0'));var util=require(_0x083e('0x1'));var logger=require(_0x083e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x083e('0x3'));var rp=require(_0x083e('0x4'));var fs=require('fs');var path=require(_0x083e('0x5'));var rimraf=require('rimraf');var config=require(_0x083e('0x6'));var attributes=require('./cmCompany.attributes');module[_0x083e('0x7')]=function(_0xd5b216,_0x4da81d){return _0xd5b216['define'](_0x083e('0x8'),attributes,{'tableName':_0x083e('0x9'),'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 27d8b67..ad85220 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 _0x286f=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x2be517,_0xf7e767){var _0x9c5011=function(_0x3de1ac){while(--_0x3de1ac){_0x2be517['push'](_0x2be517['shift']());}};_0x9c5011(++_0xf7e767);}(_0x286f,0xc3));var _0xf286=function(_0x1c15b3,_0x36b7e6){_0x1c15b3=_0x1c15b3-0x0;var _0x147d4f=_0x286f[_0x1c15b3];return _0x147d4f;};'use strict';var _=require('lodash');var util=require(_0xf286('0x0'));var moment=require(_0xf286('0x1'));var BPromise=require(_0xf286('0x2'));var rs=require(_0xf286('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf286('0x4'))['db'];var utils=require(_0xf286('0x5'));var logger=require(_0xf286('0x6'))('rpc');var config=require(_0xf286('0x7'));var jayson=require(_0xf286('0x8'));var client=jayson['client'][_0xf286('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ba510,_0x5679f1,_0x1b242e){return new BPromise(function(_0x1faebf,_0x49fa87){return client[_0xf286('0xa')](_0x1ba510,_0x1b242e)['then'](function(_0x57778e){logger['info'](_0xf286('0xb'),_0x5679f1,_0xf286('0xc'));logger[_0xf286('0xd')](_0xf286('0xe'),_0x5679f1,_0xf286('0xc'),JSON[_0xf286('0xf')](_0x57778e));if(_0x57778e[_0xf286('0x10')]){if(_0x57778e['error'][_0xf286('0x11')]===0x1f4){logger[_0xf286('0x10')](_0xf286('0xb'),_0x5679f1,_0x57778e[_0xf286('0x10')][_0xf286('0x12')]);return _0x49fa87(_0x57778e['error'][_0xf286('0x12')]);}logger[_0xf286('0x10')]('CmCompany,\x20%s,\x20%s',_0x5679f1,_0x57778e[_0xf286('0x10')][_0xf286('0x12')]);return _0x1faebf(_0x57778e[_0xf286('0x10')][_0xf286('0x12')]);}else{logger[_0xf286('0x13')]('CmCompany,\x20%s,\x20%s',_0x5679f1,'request\x20sent');_0x1faebf(_0x57778e[_0xf286('0x14')]['message']);}})[_0xf286('0x15')](function(_0x3f77e2){logger[_0xf286('0x10')](_0xf286('0xb'),_0x5679f1,_0x3f77e2);_0x49fa87(_0x3f77e2);});});} \ No newline at end of file +var _0x06e2=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment'];(function(_0x597c16,_0x2292fe){var _0x30cc2c=function(_0x26cb58){while(--_0x26cb58){_0x597c16['push'](_0x597c16['shift']());}};_0x30cc2c(++_0x2292fe);}(_0x06e2,0xf9));var _0x206e=function(_0x17dfba,_0x4f3f41){_0x17dfba=_0x17dfba-0x0;var _0x4dc37e=_0x06e2[_0x17dfba];return _0x4dc37e;};'use strict';var _=require(_0x206e('0x0'));var util=require(_0x206e('0x1'));var moment=require(_0x206e('0x2'));var BPromise=require('bluebird');var rs=require(_0x206e('0x3'));var fs=require('fs');var Redis=require(_0x206e('0x4'));var db=require(_0x206e('0x5'))['db'];var utils=require(_0x206e('0x6'));var logger=require(_0x206e('0x7'))('rpc');var config=require(_0x206e('0x8'));var jayson=require(_0x206e('0x9'));var client=jayson[_0x206e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fbf62,_0x5b4387,_0x31d354){return new BPromise(function(_0x44ef19,_0x501e95){return client[_0x206e('0xb')](_0x4fbf62,_0x31d354)['then'](function(_0x343b03){logger[_0x206e('0xc')](_0x206e('0xd'),_0x5b4387,_0x206e('0xe'));logger[_0x206e('0xf')](_0x206e('0x10'),_0x5b4387,_0x206e('0xe'),JSON[_0x206e('0x11')](_0x343b03));if(_0x343b03[_0x206e('0x12')]){if(_0x343b03[_0x206e('0x12')]['code']===0x1f4){logger[_0x206e('0x12')](_0x206e('0xd'),_0x5b4387,_0x343b03[_0x206e('0x12')]['message']);return _0x501e95(_0x343b03[_0x206e('0x12')][_0x206e('0x13')]);}logger[_0x206e('0x12')](_0x206e('0xd'),_0x5b4387,_0x343b03[_0x206e('0x12')][_0x206e('0x13')]);return _0x44ef19(_0x343b03['error'][_0x206e('0x13')]);}else{logger[_0x206e('0xc')]('CmCompany,\x20%s,\x20%s',_0x5b4387,'request\x20sent');_0x44ef19(_0x343b03[_0x206e('0x14')][_0x206e('0x13')]);}})['catch'](function(_0x30b881){logger[_0x206e('0x12')](_0x206e('0xd'),_0x5b4387,_0x30b881);_0x501e95(_0x30b881);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 50d13a5..e69be0e 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 _0x55ca=['multer','util','Router','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','show','getContacts','post','create','/:id/contacts','addContacts','put','update','destroy','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x55ca,0x126));var _0xa55c=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x55ca[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['get']('/:id/contacts',auth[_0xa55c('0x7')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0xe')]);router[_0xa55c('0xd')](_0xa55c('0xf'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x10')]);router[_0xa55c('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);module[_0xa55c('0x14')]=router; \ No newline at end of file +var _0x3e74=['isAuthenticated','index','describe','/:id','getContacts','post','create','/:id/contacts','put','update','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./cmCompany.controller','get'];(function(_0x1e1a40,_0x120381){var _0x233c8e=function(_0x134c29){while(--_0x134c29){_0x1e1a40['push'](_0x1e1a40['shift']());}};_0x233c8e(++_0x120381);}(_0x3e74,0x175));var _0x43e7=function(_0x35c8ee,_0x10527a){_0x35c8ee=_0x35c8ee-0x0;var _0x5f1981=_0x3e74[_0x35c8ee];return _0x5f1981;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x43e7('0x4'));var config=require('../../config/environment');var controller=require(_0x43e7('0x5'));router[_0x43e7('0x6')]('/',auth[_0x43e7('0x7')](),controller[_0x43e7('0x8')]);router[_0x43e7('0x6')]('/describe',auth[_0x43e7('0x7')](),controller[_0x43e7('0x9')]);router[_0x43e7('0x6')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller['show']);router[_0x43e7('0x6')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['post'](_0x43e7('0xe'),auth[_0x43e7('0x7')](),controller['addContacts']);router[_0x43e7('0xf')](_0x43e7('0xa'),auth[_0x43e7('0x7')](),controller[_0x43e7('0x10')]);router['delete']('/:id',auth[_0x43e7('0x7')](),controller[_0x43e7('0x11')]);module[_0x43e7('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index d2d7439..ab4bc2b 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 _0xfae3=['DATE','lodash','sequelize','STRING','INTEGER','UNSIGNED'];(function(_0x2c96c7,_0x3ae4d9){var _0x28927b=function(_0x29eb4e){while(--_0x29eb4e){_0x2c96c7['push'](_0x2c96c7['shift']());}};_0x28927b(++_0x3ae4d9);}(_0xfae3,0x12d));var _0x3fae=function(_0x3de8a2,_0x1c8615){_0x3de8a2=_0x3de8a2-0x0;var _0x267573=_0xfae3[_0x3de8a2];return _0x267573;};'use strict';var _=require(_0x3fae('0x0'));var Sequelize=require(_0x3fae('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x3fae('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x3fae('0x2')]},'street':{'type':Sequelize[_0x3fae('0x2')]},'postalCode':{'type':Sequelize[_0x3fae('0x2')]},'city':{'type':Sequelize[_0x3fae('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x3fae('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x3fae('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x3fae('0x2')]},'email':{'type':Sequelize[_0x3fae('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x3fae('0x2')]},'fb_data':{'type':Sequelize[_0x3fae('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x3fae('0x2')]},'teams':{'type':Sequelize[_0x3fae('0x2')]},'viber':{'type':Sequelize[_0x3fae('0x2')]},'line':{'type':Sequelize[_0x3fae('0x2')]},'wechat':{'type':Sequelize[_0x3fae('0x2')]},'telegram':{'type':Sequelize[_0x3fae('0x2')]},'UserId':{'type':Sequelize[_0x3fae('0x3')]},'priority':{'type':Sequelize[_0x3fae('0x3')](0x2)[_0x3fae('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x3fae('0x5')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x3fae('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x3fb1=['DATE','NOW','lodash','sequelize','exports','STRING','INTEGER'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x3fb1,0x80));var _0x13fb=function(_0x5b6957,_0x763e24){_0x5b6957=_0x5b6957-0x0;var _0x2f526c=_0x3fb1[_0x5b6957];return _0x2f526c;};'use strict';var _=require(_0x13fb('0x0'));var Sequelize=require(_0x13fb('0x1'));module[_0x13fb('0x2')]={'firstName':{'type':Sequelize[_0x13fb('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x13fb('0x3')]},'street':{'type':Sequelize[_0x13fb('0x3')]},'postalCode':{'type':Sequelize[_0x13fb('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x13fb('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x13fb('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x13fb('0x3')]},'email':{'type':Sequelize[_0x13fb('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x13fb('0x3')]},'fb_data':{'type':Sequelize[_0x13fb('0x3')]},'twitter':{'type':Sequelize[_0x13fb('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x13fb('0x3')]},'viber':{'type':Sequelize[_0x13fb('0x3')]},'line':{'type':Sequelize[_0x13fb('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x13fb('0x4')]},'priority':{'type':Sequelize[_0x13fb('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x13fb('0x5')],'defaultValue':Sequelize[_0x13fb('0x6')]},'dialTimezone':{'type':Sequelize[_0x13fb('0x3')]},'utcOffset':{'type':Sequelize[_0x13fb('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index e5fd734..979e2c5 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 _0x2f16=['uc.UserId\x20=\x20?','dateOfBirth','type','text','start','filter','isNil','Contact','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','isArray','tag','forEach','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','clone','DESC','isEmpty','t.id\x20IN\x20?','resolve','some','conditions','User','user','getLists','toString','keyBy','merge','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','sequelize','Tags','rows','params','catch','describe','tags','displayName','findAll','columnName','alias','custom','values','body','get','mergeWith','join','info','CmHopper','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','bulkCreate','each','duplicates','$or','findOrCreate','spread','omit','format','$and','pickBy','cf_%d','table','setFields','id\x20=\x20?','toParam','phone','getTags','rawAttributes','options','setTags','getHoppers','ContactId','includeAll','include','getHopperHistories','getHopperFinals','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','file','filename','chmodSync','child_process','fork','CompanyId','upload','binding','stringify','message','start\x20child\x20process\x20correctly!','pid','error\x20child\x20process','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./cmContact.socket','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','CmContact','keys','startsWith','cf_','push','CmCustomField','findOne','trimStart','all','length','fieldType','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','field','color','from','cm_contacts','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','left_join','tools_tags','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','sqlOperator','find','Tag','value','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','and'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x2f16,0x8f));var _0x62f1=function(_0x35ef3d,_0x70b00d){_0x35ef3d=_0x35ef3d-0x0;var _0x3aa54a=_0x2f16[_0x35ef3d];return _0x3aa54a;};'use strict';var pdf=require(_0x62f1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x62f1('0x1'));var zipdir=require(_0x62f1('0x2'));var jsonpatch=require(_0x62f1('0x3'));var rp=require(_0x62f1('0x4'));var moment=require(_0x62f1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x62f1('0x6'));var util=require('util');var path=require(_0x62f1('0x7'));var sox=require(_0x62f1('0x8'));var csv=require(_0x62f1('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x62f1('0xa'));var squel=require('squel');var crypto=require(_0x62f1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x62f1('0xc'));var toCsv=require(_0x62f1('0x9'));var querystring=require(_0x62f1('0xd'));var Papa=require(_0x62f1('0xe'));var Redis=require(_0x62f1('0xf'));var authService=require(_0x62f1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x62f1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x62f1('0x12'))(_0x62f1('0x13'));var utils=require(_0x62f1('0x14'));var config=require(_0x62f1('0x15'));var db=require('../../mysqldb')['db'];config[_0x62f1('0x16')]=_[_0x62f1('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x62f1('0x18'))(new Redis(config['redis']));require(_0x62f1('0x19'))['register'](socket);function respondWithStatusCode(_0x344b8c,_0x576c7a){_0x576c7a=_0x576c7a||0xcc;return function(_0x59e42d){if(_0x59e42d){return _0x344b8c[_0x62f1('0x1a')](_0x576c7a);}return _0x344b8c[_0x62f1('0x1b')](_0x576c7a)[_0x62f1('0x1c')]();};}function respondWithResult(_0x35666a,_0x5befb2){_0x5befb2=_0x5befb2||0xc8;return function(_0x2adaf4){if(_0x2adaf4){return _0x35666a[_0x62f1('0x1b')](_0x5befb2)[_0x62f1('0x1d')](_0x2adaf4);}};}function respondWithFilteredResult(_0x1a7e32,_0x1ddd4e){return function(_0x27fe7c){if(_0x27fe7c){var _0x37eb16=_0x27fe7c[_0x62f1('0x1e')],_0xf40386=_0x1ddd4e[_0x62f1('0x1f')],_0x1f4fda=_0x1ddd4e[_0x62f1('0x1f')]+_0x1ddd4e[_0x62f1('0x20')],_0xa622e;if(_0x1f4fda>=_0x37eb16){_0x1f4fda=_0x37eb16;_0xa622e=0xc8;}else{_0xa622e=0xce;}_0x1a7e32[_0x62f1('0x1b')](_0xa622e);return _0x1a7e32[_0x62f1('0x21')]('Content-Range',_0xf40386+'-'+_0x1f4fda+'/'+_0x37eb16)[_0x62f1('0x1d')](_0x27fe7c);}return null;};}function patchUpdates(_0x1b6a2b){return function(_0x1c8b8a){try{jsonpatch[_0x62f1('0x22')](_0x1c8b8a,_0x1b6a2b,!![]);}catch(_0x1b038b){return BPromise[_0x62f1('0x23')](_0x1b038b);}return _0x1c8b8a[_0x62f1('0x24')]();};}function saveUpdates(_0x5429cc,_0x4cbbc3){return function(_0x19c215){if(_0x19c215){return _0x19c215[_0x62f1('0x25')](_0x5429cc)[_0x62f1('0x26')](function(_0x5bef86){return _0x5bef86;});}return null;};}function removeEntity(_0x9847e8,_0x537f48){return function(_0x1ebf42){if(_0x1ebf42){return _0x1ebf42[_0x62f1('0x27')]()[_0x62f1('0x26')](function(){_0x9847e8[_0x62f1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x230b86,_0x44706a){return function(_0x33e8aa){if(!_0x33e8aa){_0x230b86['sendStatus'](0x194);}return _0x33e8aa;};}function handleError(_0xda58d9,_0xf20353){_0xf20353=_0xf20353||0x1f4;return function(_0x4ffa52){logger[_0x62f1('0x28')](_0x4ffa52[_0x62f1('0x29')]);if(_0x4ffa52[_0x62f1('0x2a')]){delete _0x4ffa52[_0x62f1('0x2a')];}_0xda58d9['status'](_0xf20353)[_0x62f1('0x2b')](_0x4ffa52);};}exports[_0x62f1('0x2c')]=function(_0x43600e,_0x4fefb0){var _0x3a1153={},_0x467871={},_0x5150ad={'count':0x0,'rows':[]};return db[_0x62f1('0x2d')]['describe']()['then'](function(_0x2c1e1c){var _0x3f4bc3=[];for(var _0x197589=0x0;_0x1975890x1){_0x255179['or'](_0x62f1('0x6c'),qs[_0x62f1('0x6d')](_0x424573),null);}else{if(qs[_0x62f1('0x6e')](_0x424573)){_0x255179['or'](_0x62f1('0x6f'),_0x424573+'%');_0x255179['or'](_0x62f1('0x70'),_0x424573+'%');_0x255179['or'](_0x62f1('0x71'),_0x424573+'%');_0x255179['or'](_0x62f1('0x72'),_0x424573+'%');}else if(qs['isEmail'](_0x424573)){_0x255179['or']('c.email\x20LIKE\x20?',_0x424573+'%');}else{_0x255179['or']('c.firstName\x20LIKE\x20?','%'+_0x424573+'%');_0x255179['or'](_0x62f1('0x73'),'%'+_0x424573+'%');_0x255179['or']('c.email\x20LIKE\x20?','%'+_0x424573+'%');}}}}_0x1f9be2[_0x62f1('0x41')](_0x255179);_0x1f9be2[_0x62f1('0x74')](_0x62f1('0x75'));var _0x46bac8={'type':db[_0x62f1('0x76')][_0x62f1('0x77')][_0x62f1('0x78')],'raw':!![]};var _0x4e6b47=_0x1f9be2[_0x62f1('0x79')]()[_0x62f1('0x44')](_0x62f1('0x75'));if(_0x3a1153[_0x62f1('0x3f')]){_0x3a1153['order']['forEach'](function(_0x267a3f){_0x1f9be2[_0x62f1('0x3f')]('c.'+_0x267a3f[0x0],_0x267a3f[0x1]===_0x62f1('0x7a')?![]:!![]);});}if(!_[_0x62f1('0x7b')](_0x455455)){_0x1f9be2['having'](_0x14afad);_0x4e6b47[_0x62f1('0x41')](_0x62f1('0x7c'),_0x455455);}BPromise[_0x62f1('0x7d')]()[_0x62f1('0x26')](function(){if(_0x5ea4c8&&!_[_0x62f1('0x7e')](_0x5ea4c8[_0x62f1('0x7f')],[_0x62f1('0x44'),_0x62f1('0x80')])){return _0x43600e[_0x62f1('0x81')][_0x62f1('0x82')]({'attributes':['id'],'raw':!![]})[_0x62f1('0x26')](function(_0x5359f7){if(_[_0x62f1('0x7b')](_0x5359f7)){_0x4e6b47[_0x62f1('0x41')]('c.ListId\x20IS\x20NULL');_0x1f9be2[_0x62f1('0x41')]('c.ListId\x20IS\x20NULL');}else{_0x4e6b47['where'](_0x62f1('0x63'),_['map'](_0x5359f7,'id'));_0x1f9be2[_0x62f1('0x41')](_0x62f1('0x63'),_[_0x62f1('0x56')](_0x5359f7,'id'));}});}else{return;}})[_0x62f1('0x26')](function(){db['sequelize'][_0x62f1('0x39')](_0x4e6b47[_0x62f1('0x83')](),_0x46bac8)[_0x62f1('0x26')](function(_0x13e837){_0x5150ad[_0x62f1('0x1e')]=_0x13e837[_0x62f1('0x36')];if(_0x5150ad[_0x62f1('0x1e')]===0x0)return[];return db['sequelize']['query'](_0x31bd41['toString'](),_0x46bac8);})[_0x62f1('0x26')](function(_0x2da68f){_0x5315f7=_[_0x62f1('0x84')](_0x2da68f,'id');_0x46bac8=_[_0x62f1('0x85')](_0x46bac8,{'model':db[_0x62f1('0x2d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x43600e[_0x62f1('0x39')][_0x62f1('0x3b')]){_0x3a1153['attributes']['forEach'](function(_0x9232bc){_0x1f9be2[_0x62f1('0x44')]('c.'+_0x9232bc);});}else{_0x1f9be2['field'](_0x62f1('0x75'));_0x1f9be2[_0x62f1('0x44')](_0x62f1('0x86'));_0x1f9be2[_0x62f1('0x44')](_0x62f1('0x87'));_0x1f9be2[_0x62f1('0x44')](_0x62f1('0x88'));_0x1f9be2[_0x62f1('0x44')](_0x62f1('0x89'));_0x1f9be2[_0x62f1('0x44')](_0x62f1('0x8a'));_0x1f9be2['field'](_0x62f1('0x8b'));_0x1f9be2['field'](_0x62f1('0x8c'));_0x1f9be2[_0x62f1('0x44')](_0x62f1('0x8d'));_0x1f9be2[_0x62f1('0x44')](_0x62f1('0x8e'),_0x62f1('0x8f'));}if(_0x3a1153[_0x62f1('0x20')])_0x1f9be2[_0x62f1('0x20')](_0x3a1153[_0x62f1('0x20')]);if(_0x3a1153[_0x62f1('0x1f')])_0x1f9be2['offset'](_0x3a1153[_0x62f1('0x1f')]);return db[_0x62f1('0x90')][_0x62f1('0x39')](_0x1f9be2[_0x62f1('0x83')](),_0x46bac8);})['then'](function(_0x2e19b1){_0x2e19b1[_0x62f1('0x69')](function(_0x119452){if(_0x119452[_0x62f1('0x8f')]){_0x119452[_0x62f1('0x91')]=[];_0x119452[_0x62f1('0x8f')][_0x62f1('0x6b')](',')['forEach'](function(_0x19c616){_0x119452[_0x62f1('0x91')][_0x62f1('0x31')](_0x5315f7[_0x19c616]);});}delete _0x119452[_0x62f1('0x8f')];});_0x5150ad[_0x62f1('0x92')]=_0x2e19b1;return _0x5150ad;})[_0x62f1('0x26')](respondWithFilteredResult(_0x4fefb0,_0x3a1153));});})['catch'](handleError(_0x4fefb0,null));};exports[_0x62f1('0x27')]=function(_0x1a3683,_0xa4da1){return db['CmContact'][_0x62f1('0x53')]({'where':{'id':_0x1a3683[_0x62f1('0x93')]['id']}})['then'](handleEntityNotFound(_0xa4da1,null))[_0x62f1('0x26')](removeEntity(_0xa4da1,null))[_0x62f1('0x94')](handleError(_0xa4da1,null));};exports[_0x62f1('0x95')]=function(_0x178d5d,_0x366550){return db['CmContact'][_0x62f1('0x95')]()[_0x62f1('0x26')](function(_0x373722){delete _0x373722[_0x62f1('0x96')];for(var _0x57ca1d=0x0;_0x57ca1d=_0x1ddef9){_0x3c1ed7=_0x1ddef9;_0x353e24=0xc8;}else{_0x353e24=0xce;}_0x5bcc22['status'](_0x353e24);return _0x5bcc22['set'](_0xc308('0x25'),_0x5e2414+'-'+_0x3c1ed7+'/'+_0x1ddef9)[_0xc308('0x21')](_0x5f2d41);}return null;};}function patchUpdates(_0x565a79){return function(_0x291d1f){try{jsonpatch[_0xc308('0x26')](_0x291d1f,_0x565a79,!![]);}catch(_0x37f30e){return BPromise['reject'](_0x37f30e);}return _0x291d1f[_0xc308('0x27')]();};}function saveUpdates(_0x290930,_0x49ea55){return function(_0x2d7c48){if(_0x2d7c48){return _0x2d7c48[_0xc308('0x28')](_0x290930)[_0xc308('0x29')](function(_0x25e135){return _0x25e135;});}return null;};}function removeEntity(_0x580200,_0x56cb29){return function(_0x2bbb86){if(_0x2bbb86){return _0x2bbb86['destroy']()['then'](function(){_0x580200['status'](0xcc)[_0xc308('0x2a')]();});}};}function handleEntityNotFound(_0x589b8b,_0x5578ed){return function(_0x471913){if(!_0x471913){_0x589b8b[_0xc308('0x1f')](0x194);}return _0x471913;};}function handleError(_0x367a02,_0x5817a4){_0x5817a4=_0x5817a4||0x1f4;return function(_0x279f6b){logger[_0xc308('0x2b')](_0x279f6b[_0xc308('0x2c')]);if(_0x279f6b[_0xc308('0x2d')]){delete _0x279f6b[_0xc308('0x2d')];}_0x367a02[_0xc308('0x20')](_0x5817a4)[_0xc308('0x2e')](_0x279f6b);};}exports[_0xc308('0x2f')]=function(_0x9a3c52,_0x1ea8c5){var _0xa645c0={},_0x2a510c={},_0x405f09={'count':0x0,'rows':[]};return db['CmContact'][_0xc308('0x30')]()[_0xc308('0x29')](function(_0x58e779){var _0xf6245f=[];for(var _0x3dcdd9=0x0;_0x3dcdd90x1){_0x492cb3['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc308('0x72')](_0x20eae8),null);}else{if(qs[_0xc308('0x73')](_0x20eae8)){_0x492cb3['or'](_0xc308('0x74'),_0x20eae8+'%');_0x492cb3['or'](_0xc308('0x75'),_0x20eae8+'%');_0x492cb3['or'](_0xc308('0x76'),_0x20eae8+'%');_0x492cb3['or'](_0xc308('0x77'),_0x20eae8+'%');}else if(qs[_0xc308('0x78')](_0x20eae8)){_0x492cb3['or'](_0xc308('0x79'),_0x20eae8+'%');}else{_0x492cb3['or'](_0xc308('0x7a'),'%'+_0x20eae8+'%');_0x492cb3['or']('c.lastName\x20LIKE\x20?','%'+_0x20eae8+'%');_0x492cb3['or'](_0xc308('0x79'),'%'+_0x20eae8+'%');}}}}_0x1e738b[_0xc308('0x4f')](_0x492cb3);_0x1e738b[_0xc308('0x7b')](_0xc308('0x7c'));var _0x2e535b={'type':db[_0xc308('0x7d')]['QueryTypes'][_0xc308('0x7e')],'raw':!![]};var _0x2937f6=_0x1e738b[_0xc308('0x7f')]()['field']('c.id');if(_0xa645c0['order']){_0xa645c0[_0xc308('0x80')][_0xc308('0x5b')](function(_0xf6819a){_0x1e738b[_0xc308('0x80')]('c.'+_0xf6819a[0x0],_0xf6819a[0x1]===_0xc308('0x81')?![]:!![]);});}if(!_[_0xc308('0x67')](_0x4d28df)){_0x1e738b['having'](_0x1c8f92);_0x2937f6[_0xc308('0x4f')]('t.id\x20IN\x20?',_0x4d28df);}BPromise[_0xc308('0x82')]()['then'](function(){if(_0x383252&&!_[_0xc308('0x83')](_0x383252[_0xc308('0x55')],[_0xc308('0x44'),_0xc308('0x84')])){return _0x9a3c52['user'][_0xc308('0x85')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4cda2a){if(_[_0xc308('0x67')](_0x4cda2a)){_0x2937f6[_0xc308('0x4f')](_0xc308('0x86'));_0x1e738b['where'](_0xc308('0x86'));}else{_0x2937f6['where'](_0xc308('0x87'),_['map'](_0x4cda2a,'id'));_0x1e738b['where'](_0xc308('0x87'),_[_0xc308('0x5a')](_0x4cda2a,'id'));}});}else{return;}})['then'](function(){db[_0xc308('0x88')]['query'](_0x2937f6['toString'](),_0x2e535b)[_0xc308('0x29')](function(_0x7a675a){_0x405f09['count']=_0x7a675a[_0xc308('0x38')];if(_0x405f09[_0xc308('0x22')]===0x0)return[];return db[_0xc308('0x88')][_0xc308('0x3a')](_0x349f1e['toString'](),_0x2e535b);})[_0xc308('0x29')](function(_0x3eeb55){_0x33b253=_[_0xc308('0x89')](_0x3eeb55,'id');_0x2e535b=_[_0xc308('0x8a')](_0x2e535b,{'model':db[_0xc308('0x8b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x9a3c52[_0xc308('0x3a')][_0xc308('0x3e')]){_0xa645c0['attributes'][_0xc308('0x5b')](function(_0x219dab){_0x1e738b[_0xc308('0x44')]('c.'+_0x219dab);});}else{_0x1e738b[_0xc308('0x44')](_0xc308('0x7c'));_0x1e738b[_0xc308('0x44')](_0xc308('0x8c'));_0x1e738b[_0xc308('0x44')]('c.lastName');_0x1e738b[_0xc308('0x44')]('c.phone');_0x1e738b[_0xc308('0x44')](_0xc308('0x8d'));_0x1e738b['field']('c.fax');_0x1e738b[_0xc308('0x44')](_0xc308('0x8e'));_0x1e738b['field'](_0xc308('0x8f'));_0x1e738b[_0xc308('0x44')](_0xc308('0x90'));_0x1e738b['field'](_0xc308('0x91'),'TagIds');}if(_0xa645c0[_0xc308('0x24')])_0x1e738b[_0xc308('0x24')](_0xa645c0['limit']);if(_0xa645c0['offset'])_0x1e738b[_0xc308('0x23')](_0xa645c0[_0xc308('0x23')]);return db['sequelize'][_0xc308('0x3a')](_0x1e738b[_0xc308('0x92')](),_0x2e535b);})[_0xc308('0x29')](function(_0x6e6426){_0x6e6426[_0xc308('0x5b')](function(_0x3ba19c){if(_0x3ba19c[_0xc308('0x93')]){_0x3ba19c[_0xc308('0x94')]=[];_0x3ba19c[_0xc308('0x93')][_0xc308('0x59')](',')[_0xc308('0x5b')](function(_0x36b324){_0x3ba19c[_0xc308('0x94')]['push'](_0x33b253[_0x36b324]);});}delete _0x3ba19c[_0xc308('0x93')];});_0x405f09[_0xc308('0x95')]=_0x6e6426;return _0x405f09;})['then'](respondWithFilteredResult(_0x1ea8c5,_0xa645c0));});})[_0xc308('0x96')](handleError(_0x1ea8c5,null));};exports['destroy']=function(_0x22ded7,_0x1c2e6b){return db['CmContact']['find']({'where':{'id':_0x22ded7[_0xc308('0x97')]['id']}})[_0xc308('0x29')](handleEntityNotFound(_0x1c2e6b,null))[_0xc308('0x29')](removeEntity(_0x1c2e6b,null))[_0xc308('0x96')](handleError(_0x1c2e6b,null));};exports[_0xc308('0x30')]=function(_0x54e085,_0x22dbbe){return db[_0xc308('0x8b')]['describe']()[_0xc308('0x29')](function(_0x562d7a){delete _0x562d7a[_0xc308('0x98')];for(var _0x593607=0x0;_0x593607{}\s\\|]/g,'-');_0x3daf43(null,util[_0x8895('0x1e')](_0x8895('0x1f'),path[_0x8895('0x20')](_0x4fcbc3[_0x8895('0x1c')],path['extname'](_0x4fcbc3[_0x8895('0x1c')])),Date[_0x8895('0x21')](),path[_0x8895('0x22')](_0x4fcbc3[_0x8895('0x1c')])));}})});router[_0x8895('0x13')]('/csv',upload['single'](_0x8895('0x23')),controller[_0x8895('0x24')]);var upload=multer({'storage':multer[_0x8895('0x19')]({'destination':function(_0x24a376,_0x4fc150,_0x25da11){_0x25da11(null,path[_0x8895('0x1a')](config[_0x8895('0x1b')],'server/files/tmp'));},'filename':function(_0x4aee03,_0x78b57,_0x555e60){_0x78b57[_0x8895('0x1c')]=_0x78b57[_0x8895('0x1c')][_0x8895('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x555e60(null,util[_0x8895('0x1e')](_0x8895('0x1f'),path['basename'](_0x78b57['originalname'],path[_0x8895('0x22')](_0x78b57[_0x8895('0x1c')])),Date[_0x8895('0x21')](),path[_0x8895('0x22')](_0x78b57[_0x8895('0x1c')])));}})});router['post']('/upload',upload[_0x8895('0x25')](_0x8895('0x23')),controller[_0x8895('0x26')]);router[_0x8895('0x13')](_0x8895('0x27'),auth['isAuthenticated'](),controller[_0x8895('0x28')]);router['put'](_0x8895('0x9'),auth['isAuthenticated'](),controller[_0x8895('0x29')]);router[_0x8895('0x2a')](_0x8895('0x9'),auth[_0x8895('0x7')](),controller[_0x8895('0x2b')]);module['exports']=router; \ No newline at end of file +var _0x5fc3=['/:id','show','/:id/tags','getTags','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','post','create','/create_many','setTags','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','now','extname','single','file','server/files/tmp','upload','/upload/:id','import','put','update','delete','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmContact.controller','get','isAuthenticated','/describe','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fc3,0xa8));var _0x35fc=function(_0x30d87a,_0xf3a07f){_0x30d87a=_0x30d87a-0x0;var _0x48f64b=_0x5fc3[_0x30d87a];return _0x48f64b;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var auth=require(_0x35fc('0x5'));var interaction=require(_0x35fc('0x6'));var config=require('../../config/environment');var controller=require(_0x35fc('0x7'));router[_0x35fc('0x8')]('/',auth[_0x35fc('0x9')](),controller['index']);router['get'](_0x35fc('0xa'),auth['isAuthenticated'](),controller[_0x35fc('0xb')]);router[_0x35fc('0x8')](_0x35fc('0xc'),auth[_0x35fc('0x9')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x8')](_0x35fc('0xe'),auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x8')]('/:id/hoppers',auth[_0x35fc('0x9')](),controller[_0x35fc('0x10')]);router['get'](_0x35fc('0x11'),auth[_0x35fc('0x9')](),controller['getHopperHistories']);router['get'](_0x35fc('0x12'),auth['isAuthenticated'](),controller[_0x35fc('0x13')]);router[_0x35fc('0x8')](_0x35fc('0x14'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x15')]);router['post']('/merge',auth['isAuthenticated'](),controller['merge']);router[_0x35fc('0x16')]('/',auth[_0x35fc('0x9')](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')](_0x35fc('0x18'),auth[_0x35fc('0x9')](),controller['bulkCreate']);router[_0x35fc('0x16')](_0x35fc('0xe'),auth['isAuthenticated'](),controller[_0x35fc('0x19')]);var upload=multer({'storage':multer[_0x35fc('0x1a')]({'destination':function(_0x2e513b,_0x5f56c6,_0x1a86e9){_0x1a86e9(null,path[_0x35fc('0x1b')](config[_0x35fc('0x1c')],'server/files/tmp'));},'filename':function(_0x402cff,_0x350a27,_0x3229d1){_0x350a27[_0x35fc('0x1d')]=_0x350a27[_0x35fc('0x1d')][_0x35fc('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3229d1(null,util[_0x35fc('0x1f')](_0x35fc('0x20'),path[_0x35fc('0x21')](_0x350a27[_0x35fc('0x1d')],path['extname'](_0x350a27[_0x35fc('0x1d')])),Date[_0x35fc('0x22')](),path[_0x35fc('0x23')](_0x350a27[_0x35fc('0x1d')])));}})});router[_0x35fc('0x16')]('/csv',upload[_0x35fc('0x24')](_0x35fc('0x25')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x35fc('0x1a')]({'destination':function(_0x5a93df,_0x3d4a98,_0x51cfec){_0x51cfec(null,path[_0x35fc('0x1b')](config['root'],_0x35fc('0x26')));},'filename':function(_0xdfab9f,_0x5cb986,_0x519264){_0x5cb986[_0x35fc('0x1d')]=_0x5cb986['originalname'][_0x35fc('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x519264(null,util[_0x35fc('0x1f')]('%s-%s%s',path[_0x35fc('0x21')](_0x5cb986[_0x35fc('0x1d')],path[_0x35fc('0x23')](_0x5cb986[_0x35fc('0x1d')])),Date[_0x35fc('0x22')](),path[_0x35fc('0x23')](_0x5cb986[_0x35fc('0x1d')])));}})});router[_0x35fc('0x16')]('/upload',upload[_0x35fc('0x24')](_0x35fc('0x25')),controller[_0x35fc('0x27')]);router['post'](_0x35fc('0x28'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x29')]);router[_0x35fc('0x2a')](_0x35fc('0xc'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x2b')]);router[_0x35fc('0x2c')](_0x35fc('0xc'),auth[_0x35fc('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index a82ed0e..970e7da 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x363e=['INTEGER','PHONE','sequelize','exports','STRING'];(function(_0x20583c,_0x16ae1d){var _0x12125a=function(_0x37dcdb){while(--_0x37dcdb){_0x20583c['push'](_0x20583c['shift']());}};_0x12125a(++_0x16ae1d);}(_0x363e,0x179));var _0xe363=function(_0xb370b7,_0x54c22c){_0xb370b7=_0xb370b7-0x0;var _0x25f4fd=_0x363e[_0xb370b7];return _0x25f4fd;};'use strict';var Sequelize=require(_0xe363('0x0'));module[_0xe363('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xe363('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xe363('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xe363('0x2')],'defaultValue':_0xe363('0x4')},'OrderBy':{'type':Sequelize[_0xe363('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x8bc3=['STRING','sequelize','INTEGER'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x8bc3,0x82));var _0x38bc=function(_0x54bb5e,_0xc9513a){_0x54bb5e=_0x54bb5e-0x0;var _0x2cfe75=_0x8bc3[_0x54bb5e];return _0x2cfe75;};'use strict';var Sequelize=require(_0x38bc('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x38bc('0x1')],'primaryKey':!![]},'item':{'type':Sequelize['STRING'],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x38bc('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x38bc('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x38bc('0x1')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index de063ea..e0363bf 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7e03=['fields','length','limit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasItems','UserProfileSection','find','autoAssociation','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','index','CmContactHasItem','key','query','keys','filters','intersection','model','attributes'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7e03,0x102));var _0x37e0=function(_0x24b072,_0x1b776e){_0x24b072=_0x24b072-0x0;var _0x399c4d=_0x7e03[_0x24b072];return _0x399c4d;};'use strict';var pdf=require(_0x37e0('0x0'));var emlformat=require(_0x37e0('0x1'));var rimraf=require(_0x37e0('0x2'));var zipdir=require(_0x37e0('0x3'));var jsonpatch=require(_0x37e0('0x4'));var rp=require(_0x37e0('0x5'));var moment=require(_0x37e0('0x6'));var BPromise=require(_0x37e0('0x7'));var Mustache=require('mustache');var util=require(_0x37e0('0x8'));var path=require('path');var sox=require(_0x37e0('0x9'));var csv=require(_0x37e0('0xa'));var ejs=require(_0x37e0('0xb'));var fs=require('fs');var _=require(_0x37e0('0xc'));var squel=require(_0x37e0('0xd'));var crypto=require(_0x37e0('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x37e0('0xa'));var querystring=require(_0x37e0('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x37e0('0x10'));var qs=require(_0x37e0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x37e0('0x12'))(_0x37e0('0x13'));var utils=require('../../config/utils');var config=require(_0x37e0('0x14'));var db=require(_0x37e0('0x15'))['db'];function respondWithStatusCode(_0x4da6cb,_0x564dc3){_0x564dc3=_0x564dc3||0xcc;return function(_0x3e1e9f){if(_0x3e1e9f){return _0x4da6cb[_0x37e0('0x16')](_0x564dc3);}return _0x4da6cb[_0x37e0('0x17')](_0x564dc3)['end']();};}function respondWithResult(_0xda2a03,_0x5cbca8){_0x5cbca8=_0x5cbca8||0xc8;return function(_0x4139b1){if(_0x4139b1){return _0xda2a03[_0x37e0('0x17')](_0x5cbca8)[_0x37e0('0x18')](_0x4139b1);}};}function respondWithFilteredResult(_0x234656,_0x4aa016){return function(_0xbf3774){if(_0xbf3774){var _0x4abc20=_0xbf3774[_0x37e0('0x19')],_0xf99170=_0x4aa016[_0x37e0('0x1a')],_0x35970a=_0x4aa016[_0x37e0('0x1a')]+_0x4aa016['limit'],_0x5f24bd;if(_0x35970a>=_0x4abc20){_0x35970a=_0x4abc20;_0x5f24bd=0xc8;}else{_0x5f24bd=0xce;}_0x234656[_0x37e0('0x17')](_0x5f24bd);return _0x234656[_0x37e0('0x1b')](_0x37e0('0x1c'),_0xf99170+'-'+_0x35970a+'/'+_0x4abc20)[_0x37e0('0x18')](_0xbf3774);}return null;};}function patchUpdates(_0x949b29){return function(_0x59652e){try{jsonpatch[_0x37e0('0x1d')](_0x59652e,_0x949b29,!![]);}catch(_0xedec6e){return BPromise[_0x37e0('0x1e')](_0xedec6e);}return _0x59652e[_0x37e0('0x1f')]();};}function saveUpdates(_0x51a5f5,_0x561b47){return function(_0x32c47d){if(_0x32c47d){return _0x32c47d[_0x37e0('0x20')](_0x51a5f5)[_0x37e0('0x21')](function(_0x390006){return _0x390006;});}return null;};}function removeEntity(_0x1b2f12,_0x5e6acc){return function(_0x5f5cae){if(_0x5f5cae){return _0x5f5cae['destroy']()[_0x37e0('0x21')](function(){var _0xe0ed13=_0x5f5cae[_0x37e0('0x22')]({'plain':!![]});var _0x1e0f6a='CmContactHasItems';return db[_0x37e0('0x23')][_0x37e0('0x24')]({'where':{'type':_0x1e0f6a,'resourceId':_0xe0ed13['id']}})[_0x37e0('0x21')](function(){return _0x5f5cae;});})[_0x37e0('0x21')](function(){_0x1b2f12[_0x37e0('0x17')](0xcc)[_0x37e0('0x25')]();});}};}function handleEntityNotFound(_0x181797,_0x56a45b){return function(_0x47c892){if(!_0x47c892){_0x181797[_0x37e0('0x16')](0x194);}return _0x47c892;};}function handleError(_0x57bb34,_0x400de9){_0x400de9=_0x400de9||0x1f4;return function(_0x27915c){logger[_0x37e0('0x26')](_0x27915c[_0x37e0('0x27')]);if(_0x27915c[_0x37e0('0x28')]){delete _0x27915c[_0x37e0('0x28')];}_0x57bb34['status'](_0x400de9)['send'](_0x27915c);};}exports[_0x37e0('0x29')]=function(_0x1f4511,_0x4ffc9b){var _0x1eb0e3={},_0x32e26f={},_0x259a13={'count':0x0,'rows':[]};var _0x1ece64=_['map'](db[_0x37e0('0x2a')]['rawAttributes'],function(_0x57b3a7){return{'name':_0x57b3a7['fieldName'],'type':_0x57b3a7['type'][_0x37e0('0x2b')]};});_0x32e26f['model']=_['map'](_0x1ece64,_0x37e0('0x28'));_0x32e26f[_0x37e0('0x2c')]=_[_0x37e0('0x2d')](_0x1f4511[_0x37e0('0x2c')]);_0x32e26f[_0x37e0('0x2e')]=_[_0x37e0('0x2f')](_0x32e26f[_0x37e0('0x30')],_0x32e26f[_0x37e0('0x2c')]);_0x1eb0e3[_0x37e0('0x31')]=_[_0x37e0('0x2f')](_0x32e26f[_0x37e0('0x30')],qs[_0x37e0('0x32')](_0x1f4511['query']['fields']));_0x1eb0e3[_0x37e0('0x31')]=_0x1eb0e3[_0x37e0('0x31')][_0x37e0('0x33')]?_0x1eb0e3[_0x37e0('0x31')]:_0x32e26f[_0x37e0('0x30')];if(!_0x1f4511[_0x37e0('0x2c')]['hasOwnProperty']('nolimit')){_0x1eb0e3[_0x37e0('0x34')]=qs[_0x37e0('0x34')](_0x1f4511[_0x37e0('0x2c')]['limit']);_0x1eb0e3[_0x37e0('0x1a')]=qs[_0x37e0('0x1a')](_0x1f4511[_0x37e0('0x2c')][_0x37e0('0x1a')]);}_0x1eb0e3[_0x37e0('0x35')]=qs['sort'](_0x1f4511['query'][_0x37e0('0x36')]);_0x1eb0e3['where']=qs[_0x37e0('0x2e')](_[_0x37e0('0x37')](_0x1f4511[_0x37e0('0x2c')],_0x32e26f['filters']),_0x1ece64);if(_0x1f4511[_0x37e0('0x2c')][_0x37e0('0x38')]){_0x1eb0e3[_0x37e0('0x39')]=_[_0x37e0('0x3a')](_0x1eb0e3[_0x37e0('0x39')],{'$or':_[_0x37e0('0x3b')](_0x1ece64,function(_0x14a75f){if(_0x14a75f['type']!==_0x37e0('0x3c')){var _0x50c3de={};_0x50c3de[_0x14a75f[_0x37e0('0x28')]]={'$like':'%'+_0x1f4511[_0x37e0('0x2c')][_0x37e0('0x38')]+'%'};return _0x50c3de;}})});}_0x1eb0e3=_[_0x37e0('0x3a')]({},_0x1eb0e3,_0x1f4511[_0x37e0('0x3d')]);var _0x1c067b={'where':_0x1eb0e3[_0x37e0('0x39')]};return db[_0x37e0('0x2a')][_0x37e0('0x19')](_0x1c067b)[_0x37e0('0x21')](function(_0x4686cd){_0x259a13[_0x37e0('0x19')]=_0x4686cd;if(_0x1f4511[_0x37e0('0x2c')]['includeAll']){_0x1eb0e3['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0x37e0('0x3e')](_0x1eb0e3);})['then'](function(_0x52a477){_0x259a13[_0x37e0('0x3f')]=_0x52a477;return _0x259a13;})[_0x37e0('0x21')](respondWithFilteredResult(_0x4ffc9b,_0x1eb0e3))[_0x37e0('0x40')](handleError(_0x4ffc9b,null));};exports[_0x37e0('0x41')]=function(_0x364c95,_0x1a3738){var _0x11ca78={'raw':!![],'where':{'id':_0x364c95[_0x37e0('0x42')]['id']}},_0x22cbeb={};_0x22cbeb['model']=_[_0x37e0('0x2d')](db[_0x37e0('0x2a')][_0x37e0('0x43')]);_0x22cbeb[_0x37e0('0x2c')]=_[_0x37e0('0x2d')](_0x364c95[_0x37e0('0x2c')]);_0x22cbeb['filters']=_[_0x37e0('0x2f')](_0x22cbeb[_0x37e0('0x30')],_0x22cbeb[_0x37e0('0x2c')]);_0x11ca78[_0x37e0('0x31')]=_[_0x37e0('0x2f')](_0x22cbeb[_0x37e0('0x30')],qs[_0x37e0('0x32')](_0x364c95[_0x37e0('0x2c')][_0x37e0('0x32')]));_0x11ca78['attributes']=_0x11ca78[_0x37e0('0x31')]['length']?_0x11ca78[_0x37e0('0x31')]:_0x22cbeb['model'];if(_0x364c95['query']['includeAll']){_0x11ca78[_0x37e0('0x44')]=[{'all':!![]}];}_0x11ca78=_[_0x37e0('0x3a')]({},_0x11ca78,_0x364c95[_0x37e0('0x3d')]);return db[_0x37e0('0x2a')]['find'](_0x11ca78)[_0x37e0('0x21')](handleEntityNotFound(_0x1a3738,null))[_0x37e0('0x21')](respondWithResult(_0x1a3738,null))['catch'](handleError(_0x1a3738,null));};exports[_0x37e0('0x45')]=function(_0x1ea649,_0x8dfd5){return db[_0x37e0('0x2a')]['create'](_0x1ea649[_0x37e0('0x46')],{})[_0x37e0('0x21')](function(_0x1bbe97){var _0x383592=_0x1ea649['user'][_0x37e0('0x22')]({'plain':!![]});if(!_0x383592)throw new Error(_0x37e0('0x47'));if(_0x383592[_0x37e0('0x48')]==='user'){var _0x197f4=_0x1bbe97[_0x37e0('0x22')]({'plain':!![]});var _0x3dbef7=_0x37e0('0x49');return db[_0x37e0('0x4a')][_0x37e0('0x4b')]({'where':{'name':_0x3dbef7,'userProfileId':_0x383592['userProfileId']},'raw':!![]})[_0x37e0('0x21')](function(_0x25b71f){if(_0x25b71f&&_0x25b71f[_0x37e0('0x4c')]===0x0){return db[_0x37e0('0x23')][_0x37e0('0x45')]({'name':_0x197f4[_0x37e0('0x28')],'resourceId':_0x197f4['id'],'type':_0x25b71f[_0x37e0('0x28')],'sectionId':_0x25b71f['id']},{})[_0x37e0('0x21')](function(){return _0x1bbe97;});}else{return _0x1bbe97;}})[_0x37e0('0x40')](function(_0x511ec0){logger[_0x37e0('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x511ec0);throw _0x511ec0;});}return _0x1bbe97;})[_0x37e0('0x21')](respondWithResult(_0x8dfd5,0xc9))['catch'](handleError(_0x8dfd5,null));};exports[_0x37e0('0x20')]=function(_0x449b8d,_0x397ec3){if(_0x449b8d[_0x37e0('0x46')]['id']){delete _0x449b8d[_0x37e0('0x46')]['id'];}return db['CmContactHasItem'][_0x37e0('0x4b')]({'where':{'id':_0x449b8d[_0x37e0('0x42')]['id']}})[_0x37e0('0x21')](handleEntityNotFound(_0x397ec3,null))[_0x37e0('0x21')](saveUpdates(_0x449b8d[_0x37e0('0x46')],null))[_0x37e0('0x21')](respondWithResult(_0x397ec3,null))[_0x37e0('0x40')](handleError(_0x397ec3,null));};exports[_0x37e0('0x24')]=function(_0x5c0750,_0x4044aa){return db['CmContactHasItem'][_0x37e0('0x4b')]({'where':{'id':_0x5c0750[_0x37e0('0x42')]['id']}})[_0x37e0('0x21')](handleEntityNotFound(_0x4044aa,null))[_0x37e0('0x21')](removeEntity(_0x4044aa,null))[_0x37e0('0x40')](handleError(_0x4044aa,null));}; \ No newline at end of file +var _0x483a=['mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird'];(function(_0x1d42ca,_0x12f27c){var _0x156a11=function(_0x1dc4e){while(--_0x1dc4e){_0x1d42ca['push'](_0x1d42ca['shift']());}};_0x156a11(++_0x12f27c);}(_0x483a,0x156));var _0xa483=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x483a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xa483('0x0'));var emlformat=require(_0xa483('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa483('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa483('0x3'));var moment=require(_0xa483('0x4'));var BPromise=require(_0xa483('0x5'));var Mustache=require(_0xa483('0x6'));var util=require(_0xa483('0x7'));var path=require('path');var sox=require(_0xa483('0x8'));var csv=require(_0xa483('0x9'));var ejs=require(_0xa483('0xa'));var fs=require('fs');var _=require(_0xa483('0xb'));var squel=require(_0xa483('0xc'));var crypto=require(_0xa483('0xd'));var jsforce=require(_0xa483('0xe'));var deskjs=require(_0xa483('0xf'));var toCsv=require(_0xa483('0x9'));var querystring=require(_0xa483('0x10'));var Papa=require(_0xa483('0x11'));var Redis=require('ioredis');var authService=require(_0xa483('0x12'));var qs=require(_0xa483('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa483('0x14'));var logger=require(_0xa483('0x15'))(_0xa483('0x16'));var utils=require(_0xa483('0x17'));var config=require(_0xa483('0x18'));var db=require(_0xa483('0x19'))['db'];function respondWithStatusCode(_0x2d460d,_0x5cc23e){_0x5cc23e=_0x5cc23e||0xcc;return function(_0x4a8b82){if(_0x4a8b82){return _0x2d460d[_0xa483('0x1a')](_0x5cc23e);}return _0x2d460d[_0xa483('0x1b')](_0x5cc23e)[_0xa483('0x1c')]();};}function respondWithResult(_0x4077b5,_0x3da9e0){_0x3da9e0=_0x3da9e0||0xc8;return function(_0x296d79){if(_0x296d79){return _0x4077b5[_0xa483('0x1b')](_0x3da9e0)[_0xa483('0x1d')](_0x296d79);}};}function respondWithFilteredResult(_0x7b5150,_0x178114){return function(_0x5f4595){if(_0x5f4595){var _0x169c89=_0x5f4595[_0xa483('0x1e')],_0x234a6b=_0x178114['offset'],_0x1656d2=_0x178114[_0xa483('0x1f')]+_0x178114['limit'],_0x19f89d;if(_0x1656d2>=_0x169c89){_0x1656d2=_0x169c89;_0x19f89d=0xc8;}else{_0x19f89d=0xce;}_0x7b5150[_0xa483('0x1b')](_0x19f89d);return _0x7b5150[_0xa483('0x20')](_0xa483('0x21'),_0x234a6b+'-'+_0x1656d2+'/'+_0x169c89)[_0xa483('0x1d')](_0x5f4595);}return null;};}function patchUpdates(_0x18ac58){return function(_0x11ec9d){try{jsonpatch[_0xa483('0x22')](_0x11ec9d,_0x18ac58,!![]);}catch(_0x405936){return BPromise[_0xa483('0x23')](_0x405936);}return _0x11ec9d[_0xa483('0x24')]();};}function saveUpdates(_0x31da12,_0x15ef11){return function(_0x4fe08b){if(_0x4fe08b){return _0x4fe08b[_0xa483('0x25')](_0x31da12)[_0xa483('0x26')](function(_0x3572f6){return _0x3572f6;});}return null;};}function removeEntity(_0x3ec5e2,_0x18949a){return function(_0x4125e6){if(_0x4125e6){return _0x4125e6[_0xa483('0x27')]()[_0xa483('0x26')](function(){var _0x2477be=_0x4125e6[_0xa483('0x28')]({'plain':!![]});var _0x199184=_0xa483('0x29');return db[_0xa483('0x2a')]['destroy']({'where':{'type':_0x199184,'resourceId':_0x2477be['id']}})[_0xa483('0x26')](function(){return _0x4125e6;});})['then'](function(){_0x3ec5e2[_0xa483('0x1b')](0xcc)[_0xa483('0x1c')]();});}};}function handleEntityNotFound(_0x476d70,_0x561486){return function(_0x390ba0){if(!_0x390ba0){_0x476d70['sendStatus'](0x194);}return _0x390ba0;};}function handleError(_0x32ed75,_0xbb004c){_0xbb004c=_0xbb004c||0x1f4;return function(_0x7511db){logger[_0xa483('0x2b')](_0x7511db[_0xa483('0x2c')]);if(_0x7511db[_0xa483('0x2d')]){delete _0x7511db[_0xa483('0x2d')];}_0x32ed75[_0xa483('0x1b')](_0xbb004c)[_0xa483('0x2e')](_0x7511db);};}exports[_0xa483('0x2f')]=function(_0x500195,_0xdf25){var _0x80116d={},_0x38ec56={},_0x330ebf={'count':0x0,'rows':[]};var _0xcd32ab=_[_0xa483('0x30')](db[_0xa483('0x31')][_0xa483('0x32')],function(_0x3bc775){return{'name':_0x3bc775[_0xa483('0x33')],'type':_0x3bc775[_0xa483('0x34')][_0xa483('0x35')]};});_0x38ec56['model']=_[_0xa483('0x30')](_0xcd32ab,'name');_0x38ec56[_0xa483('0x36')]=_[_0xa483('0x37')](_0x500195[_0xa483('0x36')]);_0x38ec56[_0xa483('0x38')]=_[_0xa483('0x39')](_0x38ec56[_0xa483('0x3a')],_0x38ec56[_0xa483('0x36')]);_0x80116d[_0xa483('0x3b')]=_[_0xa483('0x39')](_0x38ec56[_0xa483('0x3a')],qs[_0xa483('0x3c')](_0x500195['query'][_0xa483('0x3c')]));_0x80116d['attributes']=_0x80116d[_0xa483('0x3b')][_0xa483('0x3d')]?_0x80116d[_0xa483('0x3b')]:_0x38ec56[_0xa483('0x3a')];if(!_0x500195['query'][_0xa483('0x3e')](_0xa483('0x3f'))){_0x80116d[_0xa483('0x40')]=qs[_0xa483('0x40')](_0x500195['query'][_0xa483('0x40')]);_0x80116d['offset']=qs['offset'](_0x500195[_0xa483('0x36')]['offset']);}_0x80116d['order']=qs[_0xa483('0x41')](_0x500195[_0xa483('0x36')][_0xa483('0x41')]);_0x80116d[_0xa483('0x42')]=qs[_0xa483('0x38')](_[_0xa483('0x43')](_0x500195[_0xa483('0x36')],_0x38ec56['filters']),_0xcd32ab);if(_0x500195[_0xa483('0x36')][_0xa483('0x44')]){_0x80116d[_0xa483('0x42')]=_[_0xa483('0x45')](_0x80116d[_0xa483('0x42')],{'$or':_[_0xa483('0x30')](_0xcd32ab,function(_0x18b3af){if(_0x18b3af[_0xa483('0x34')]!==_0xa483('0x46')){var _0x1eadf4={};_0x1eadf4[_0x18b3af[_0xa483('0x2d')]]={'$like':'%'+_0x500195[_0xa483('0x36')][_0xa483('0x44')]+'%'};return _0x1eadf4;}})});}_0x80116d=_[_0xa483('0x45')]({},_0x80116d,_0x500195[_0xa483('0x47')]);var _0x267a48={'where':_0x80116d[_0xa483('0x42')]};return db['CmContactHasItem'][_0xa483('0x1e')](_0x267a48)[_0xa483('0x26')](function(_0xe0ca3b){_0x330ebf['count']=_0xe0ca3b;if(_0x500195[_0xa483('0x36')]['includeAll']){_0x80116d[_0xa483('0x48')]=[{'all':!![]}];}return db[_0xa483('0x31')]['findAll'](_0x80116d);})[_0xa483('0x26')](function(_0xca70ae){_0x330ebf[_0xa483('0x49')]=_0xca70ae;return _0x330ebf;})[_0xa483('0x26')](respondWithFilteredResult(_0xdf25,_0x80116d))[_0xa483('0x4a')](handleError(_0xdf25,null));};exports[_0xa483('0x4b')]=function(_0x2397ed,_0x25f9b3){var _0x47a9a4={'raw':!![],'where':{'id':_0x2397ed[_0xa483('0x4c')]['id']}},_0xcf3439={};_0xcf3439['model']=_['keys'](db['CmContactHasItem'][_0xa483('0x32')]);_0xcf3439['query']=_[_0xa483('0x37')](_0x2397ed[_0xa483('0x36')]);_0xcf3439[_0xa483('0x38')]=_[_0xa483('0x39')](_0xcf3439[_0xa483('0x3a')],_0xcf3439[_0xa483('0x36')]);_0x47a9a4[_0xa483('0x3b')]=_[_0xa483('0x39')](_0xcf3439[_0xa483('0x3a')],qs[_0xa483('0x3c')](_0x2397ed[_0xa483('0x36')][_0xa483('0x3c')]));_0x47a9a4['attributes']=_0x47a9a4[_0xa483('0x3b')][_0xa483('0x3d')]?_0x47a9a4[_0xa483('0x3b')]:_0xcf3439[_0xa483('0x3a')];if(_0x2397ed[_0xa483('0x36')][_0xa483('0x4d')]){_0x47a9a4[_0xa483('0x48')]=[{'all':!![]}];}_0x47a9a4=_['merge']({},_0x47a9a4,_0x2397ed['options']);return db[_0xa483('0x31')]['find'](_0x47a9a4)[_0xa483('0x26')](handleEntityNotFound(_0x25f9b3,null))[_0xa483('0x26')](respondWithResult(_0x25f9b3,null))['catch'](handleError(_0x25f9b3,null));};exports['create']=function(_0x578a3c,_0x4b074f){return db[_0xa483('0x31')]['create'](_0x578a3c[_0xa483('0x4e')],{})[_0xa483('0x26')](function(_0x1a9b94){var _0x3a4e24=_0x578a3c[_0xa483('0x4f')][_0xa483('0x28')]({'plain':!![]});if(!_0x3a4e24)throw new Error(_0xa483('0x50'));if(_0x3a4e24[_0xa483('0x51')]===_0xa483('0x4f')){var _0x6f2918=_0x1a9b94[_0xa483('0x28')]({'plain':!![]});var _0xf45f9b=_0xa483('0x29');return db[_0xa483('0x52')][_0xa483('0x53')]({'where':{'name':_0xf45f9b,'userProfileId':_0x3a4e24[_0xa483('0x54')]},'raw':!![]})[_0xa483('0x26')](function(_0x265cfa){if(_0x265cfa&&_0x265cfa['autoAssociation']===0x0){return db['UserProfileResource'][_0xa483('0x55')]({'name':_0x6f2918[_0xa483('0x2d')],'resourceId':_0x6f2918['id'],'type':_0x265cfa[_0xa483('0x2d')],'sectionId':_0x265cfa['id']},{})[_0xa483('0x26')](function(){return _0x1a9b94;});}else{return _0x1a9b94;}})[_0xa483('0x4a')](function(_0x544a24){logger[_0xa483('0x2b')](_0xa483('0x56'),_0x544a24);throw _0x544a24;});}return _0x1a9b94;})[_0xa483('0x26')](respondWithResult(_0x4b074f,0xc9))[_0xa483('0x4a')](handleError(_0x4b074f,null));};exports[_0xa483('0x25')]=function(_0x2ea8c1,_0x19a27a){if(_0x2ea8c1['body']['id']){delete _0x2ea8c1['body']['id'];}return db[_0xa483('0x31')]['find']({'where':{'id':_0x2ea8c1[_0xa483('0x4c')]['id']}})[_0xa483('0x26')](handleEntityNotFound(_0x19a27a,null))[_0xa483('0x26')](saveUpdates(_0x2ea8c1[_0xa483('0x4e')],null))[_0xa483('0x26')](respondWithResult(_0x19a27a,null))[_0xa483('0x4a')](handleError(_0x19a27a,null));};exports['destroy']=function(_0x31e390,_0x2865a9){return db[_0xa483('0x31')][_0xa483('0x53')]({'where':{'id':_0x31e390[_0xa483('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2865a9,null))['then'](removeEntity(_0x2865a9,null))[_0xa483('0x4a')](handleError(_0x2865a9,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 9d7da23..d58f292 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./cmContactHasItem.attributes','define','cm_contact_has_items','lodash'];(function(_0x2a3b4d,_0x151237){var _0x3b875d=function(_0x3e39a4){while(--_0x3e39a4){_0x2a3b4d['push'](_0x2a3b4d['shift']());}};_0x3b875d(++_0x151237);}(_0x5496,0x175));var _0x6549=function(_0x3f9b84,_0x2bc7dd){_0x3f9b84=_0x3f9b84-0x0;var _0x7f0ffa=_0x5496[_0x3f9b84];return _0x7f0ffa;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('CmContactHasItem',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1db9=['CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define'];(function(_0x26f03d,_0x4866c2){var _0x42dc9f=function(_0x110528){while(--_0x110528){_0x26f03d['push'](_0x26f03d['shift']());}};_0x42dc9f(++_0x4866c2);}(_0x1db9,0x176));var _0x91db=function(_0x21f83a,_0x156c7d){_0x21f83a=_0x21f83a-0x0;var _0x44cc7e=_0x1db9[_0x21f83a];return _0x44cc7e;};'use strict';var _=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var logger=require(_0x91db('0x2'))(_0x91db('0x3'));var moment=require(_0x91db('0x4'));var BPromise=require(_0x91db('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91db('0x6'));var rimraf=require(_0x91db('0x7'));var config=require('../../config/environment');var attributes=require('./cmContactHasItem.attributes');module[_0x91db('0x8')]=function(_0x4b3f5c,_0x5e69d9){return _0x4b3f5c[_0x91db('0x9')](_0x91db('0xa'),attributes,{'tableName':_0x91db('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 6b13f95..c6ec54f 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6590=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','error','CmContactHasItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x5b65b6,_0x6c6971){var _0x1f53d2=function(_0x4f6027){while(--_0x4f6027){_0x5b65b6['push'](_0x5b65b6['shift']());}};_0x1f53d2(++_0x6c6971);}(_0x6590,0xa5));var _0x0659=function(_0xe15270,_0x227d06){_0xe15270=_0xe15270-0x0;var _0x1e813b=_0x6590[_0xe15270];return _0x1e813b;};'use strict';var _=require(_0x0659('0x0'));var util=require(_0x0659('0x1'));var moment=require(_0x0659('0x2'));var BPromise=require('bluebird');var rs=require(_0x0659('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0659('0x4'))['db'];var utils=require(_0x0659('0x5'));var logger=require(_0x0659('0x6'))(_0x0659('0x7'));var config=require(_0x0659('0x8'));var jayson=require(_0x0659('0x9'));var client=jayson[_0x0659('0xa')][_0x0659('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x404d3d,_0x262c2c,_0x131982){return new BPromise(function(_0x3a473e,_0x13515c){return client[_0x0659('0xc')](_0x404d3d,_0x131982)[_0x0659('0xd')](function(_0x2e3740){logger[_0x0659('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x262c2c,_0x0659('0xf'));logger['debug']('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x262c2c,_0x0659('0xf'),JSON['stringify'](_0x2e3740));if(_0x2e3740[_0x0659('0x10')]){if(_0x2e3740[_0x0659('0x10')]['code']===0x1f4){logger['error'](_0x0659('0x11'),_0x262c2c,_0x2e3740[_0x0659('0x10')][_0x0659('0x12')]);return _0x13515c(_0x2e3740[_0x0659('0x10')]['message']);}logger[_0x0659('0x10')](_0x0659('0x11'),_0x262c2c,_0x2e3740[_0x0659('0x10')][_0x0659('0x12')]);return _0x3a473e(_0x2e3740[_0x0659('0x10')]['message']);}else{logger[_0x0659('0xe')](_0x0659('0x11'),_0x262c2c,'request\x20sent');_0x3a473e(_0x2e3740[_0x0659('0x13')][_0x0659('0x12')]);}})[_0x0659('0x14')](function(_0x1fecdd){logger[_0x0659('0x10')](_0x0659('0x11'),_0x262c2c,_0x1fecdd);_0x13515c(_0x1fecdd);});});} \ No newline at end of file +var _0xe826=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util'];(function(_0xb9580,_0x441821){var _0x532515=function(_0x32ef38){while(--_0x32ef38){_0xb9580['push'](_0xb9580['shift']());}};_0x532515(++_0x441821);}(_0xe826,0x14e));var _0x6e82=function(_0x4331f8,_0xe06640){_0x4331f8=_0x4331f8-0x0;var _0x44a1a5=_0xe826[_0x4331f8];return _0x44a1a5;};'use strict';var _=require(_0x6e82('0x0'));var util=require(_0x6e82('0x1'));var moment=require(_0x6e82('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e82('0x3'));var fs=require('fs');var Redis=require(_0x6e82('0x4'));var db=require(_0x6e82('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6e82('0x6'))(_0x6e82('0x7'));var config=require(_0x6e82('0x8'));var jayson=require(_0x6e82('0x9'));var client=jayson[_0x6e82('0xa')][_0x6e82('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14df8f,_0x30d952,_0x41e9b0){return new BPromise(function(_0x3ebce2,_0x18c7d2){return client['request'](_0x14df8f,_0x41e9b0)[_0x6e82('0xc')](function(_0x1fc4d2){logger[_0x6e82('0xd')](_0x6e82('0xe'),_0x30d952,_0x6e82('0xf'));logger[_0x6e82('0x10')](_0x6e82('0x11'),_0x30d952,_0x6e82('0xf'),JSON['stringify'](_0x1fc4d2));if(_0x1fc4d2[_0x6e82('0x12')]){if(_0x1fc4d2[_0x6e82('0x12')]['code']===0x1f4){logger[_0x6e82('0x12')](_0x6e82('0xe'),_0x30d952,_0x1fc4d2[_0x6e82('0x12')]['message']);return _0x18c7d2(_0x1fc4d2[_0x6e82('0x12')][_0x6e82('0x13')]);}logger[_0x6e82('0x12')](_0x6e82('0xe'),_0x30d952,_0x1fc4d2['error'][_0x6e82('0x13')]);return _0x3ebce2(_0x1fc4d2['error'][_0x6e82('0x13')]);}else{logger['info'](_0x6e82('0xe'),_0x30d952,_0x6e82('0xf'));_0x3ebce2(_0x1fc4d2[_0x6e82('0x14')]['message']);}})['catch'](function(_0x4c1f9a){logger[_0x6e82('0x12')](_0x6e82('0xe'),_0x30d952,_0x4c1f9a);_0x18c7d2(_0x4c1f9a);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 7cccf9a..7000924 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6dc3=['connect-timeout','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer','util','path'];(function(_0x1c42fd,_0x2588e9){var _0x111bf4=function(_0x396ce4){while(--_0x396ce4){_0x1c42fd['push'](_0x1c42fd['shift']());}};_0x111bf4(++_0x2588e9);}(_0x6dc3,0xb8));var _0x36dc=function(_0x1bbb51,_0xd73551){_0x1bbb51=_0x1bbb51-0x0;var _0x3eba03=_0x6dc3[_0x1bbb51];return _0x3eba03;};'use strict';var multer=require(_0x36dc('0x0'));var util=require(_0x36dc('0x1'));var path=require(_0x36dc('0x2'));var timeout=require(_0x36dc('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x36dc('0x4'));var config=require(_0x36dc('0x5'));var controller=require(_0x36dc('0x6'));router[_0x36dc('0x7')]('/',auth[_0x36dc('0x8')](),controller[_0x36dc('0x9')]);router[_0x36dc('0x7')](_0x36dc('0xa'),auth[_0x36dc('0x8')](),controller[_0x36dc('0xb')]);router[_0x36dc('0xc')]('/',auth[_0x36dc('0x8')](),controller['create']);router[_0x36dc('0xd')](_0x36dc('0xa'),auth[_0x36dc('0x8')](),controller[_0x36dc('0xe')]);router[_0x36dc('0xf')]('/:id',auth[_0x36dc('0x8')](),controller['destroy']);module[_0x36dc('0x10')]=router; \ No newline at end of file +var _0x7416=['update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','get','index','/:id','isAuthenticated','show','post','put'];(function(_0x131b26,_0x20b4ad){var _0x513652=function(_0x15badc){while(--_0x15badc){_0x131b26['push'](_0x131b26['shift']());}};_0x513652(++_0x20b4ad);}(_0x7416,0x94));var _0x6741=function(_0x1b7ea6,_0x195a62){_0x1b7ea6=_0x1b7ea6-0x0;var _0x4fcea6=_0x7416[_0x1b7ea6];return _0x4fcea6;};'use strict';var multer=require(_0x6741('0x0'));var util=require(_0x6741('0x1'));var path=require('path');var timeout=require(_0x6741('0x2'));var express=require('express');var router=express[_0x6741('0x3')]();var auth=require(_0x6741('0x4'));var interaction=require(_0x6741('0x5'));var config=require('../../config/environment');var controller=require(_0x6741('0x6'));router[_0x6741('0x7')]('/',auth['isAuthenticated'](),controller[_0x6741('0x8')]);router[_0x6741('0x7')](_0x6741('0x9'),auth[_0x6741('0xa')](),controller[_0x6741('0xb')]);router[_0x6741('0xc')]('/',auth[_0x6741('0xa')](),controller['create']);router[_0x6741('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x6741('0xe')]);router[_0x6741('0xf')](_0x6741('0x9'),auth[_0x6741('0xa')](),controller[_0x6741('0x10')]);module[_0x6741('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index 0fd93a2..f07f5bb 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8561=['sequelize','exports','INTEGER','STRING'];(function(_0x58dc03,_0x1c0b28){var _0x2f14bb=function(_0x29e209){while(--_0x29e209){_0x58dc03['push'](_0x58dc03['shift']());}};_0x2f14bb(++_0x1c0b28);}(_0x8561,0xa8));var _0x1856=function(_0x5a14dd,_0x55e143){_0x5a14dd=_0x5a14dd-0x0;var _0x43d8f6=_0x8561[_0x5a14dd];return _0x43d8f6;};'use strict';var Sequelize=require(_0x1856('0x0'));module[_0x1856('0x1')]={'CmContactId':{'type':Sequelize[_0x1856('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x1856('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file +var _0xa8a6=['INTEGER','STRING','sequelize','exports'];(function(_0x3855fc,_0x57685d){var _0x416286=function(_0x5d9b46){while(--_0x5d9b46){_0x3855fc['push'](_0x3855fc['shift']());}};_0x416286(++_0x57685d);}(_0xa8a6,0x102));var _0x6a8a=function(_0x26f300,_0x3115c0){_0x26f300=_0x26f300-0x0;var _0x53bf7c=_0xa8a6[_0x26f300];return _0x53bf7c;};'use strict';var Sequelize=require(_0x6a8a('0x0'));module[_0x6a8a('0x1')]={'CmContactId':{'type':Sequelize[_0x6a8a('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0x6a8a('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js index 55f76e0..e74717d 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb3a9=['filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','count','limit','set','Content-Range','apply','reject','update','then','get','CmContactHasPhones','destroy','end','sendStatus','error','stack','name','send','index','map','CmContactHasPhone','type','key','model','keys','intersection','fields','query','attributes','hasOwnProperty','nolimit','offset','order','sort','where','filters'];(function(_0x33c52a,_0x5b275a){var _0x543541=function(_0x4354cd){while(--_0x4354cd){_0x33c52a['push'](_0x33c52a['shift']());}};_0x543541(++_0x5b275a);}(_0xb3a9,0x142));var _0x9b3a=function(_0x96fc8b,_0x370288){_0x96fc8b=_0x96fc8b-0x0;var _0x1476f8=_0xb3a9[_0x96fc8b];return _0x1476f8;};'use strict';var pdf=require(_0x9b3a('0x0'));var emlformat=require(_0x9b3a('0x1'));var rimraf=require(_0x9b3a('0x2'));var zipdir=require(_0x9b3a('0x3'));var jsonpatch=require(_0x9b3a('0x4'));var rp=require(_0x9b3a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9b3a('0x6'));var util=require(_0x9b3a('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x9b3a('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9b3a('0x9'));var squel=require(_0x9b3a('0xa'));var crypto=require(_0x9b3a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9b3a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9b3a('0xd'));var Papa=require('papaparse');var Redis=require(_0x9b3a('0xe'));var authService=require(_0x9b3a('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9b3a('0x10'));var logger=require(_0x9b3a('0x11'))('api');var utils=require(_0x9b3a('0x12'));var config=require(_0x9b3a('0x13'));var db=require(_0x9b3a('0x14'))['db'];function respondWithStatusCode(_0x4a4398,_0x3e111c){_0x3e111c=_0x3e111c||0xcc;return function(_0x576496){if(_0x576496){return _0x4a4398['sendStatus'](_0x3e111c);}return _0x4a4398['status'](_0x3e111c)['end']();};}function respondWithResult(_0x1bf6bc,_0x590d34){_0x590d34=_0x590d34||0xc8;return function(_0x304a69){if(_0x304a69){return _0x1bf6bc[_0x9b3a('0x15')](_0x590d34)[_0x9b3a('0x16')](_0x304a69);}};}function respondWithFilteredResult(_0x2d6137,_0x3bda9f){return function(_0x37083b){if(_0x37083b){var _0x5a9c59=_0x37083b[_0x9b3a('0x17')],_0x2f880d=_0x3bda9f['offset'],_0x32b5f1=_0x3bda9f['offset']+_0x3bda9f[_0x9b3a('0x18')],_0x1413ed;if(_0x32b5f1>=_0x5a9c59){_0x32b5f1=_0x5a9c59;_0x1413ed=0xc8;}else{_0x1413ed=0xce;}_0x2d6137[_0x9b3a('0x15')](_0x1413ed);return _0x2d6137[_0x9b3a('0x19')](_0x9b3a('0x1a'),_0x2f880d+'-'+_0x32b5f1+'/'+_0x5a9c59)[_0x9b3a('0x16')](_0x37083b);}return null;};}function patchUpdates(_0x58f54a){return function(_0x5c2adb){try{jsonpatch[_0x9b3a('0x1b')](_0x5c2adb,_0x58f54a,!![]);}catch(_0x40c138){return BPromise[_0x9b3a('0x1c')](_0x40c138);}return _0x5c2adb['save']();};}function saveUpdates(_0x5a58fa,_0x1a99be){return function(_0x3c041b){if(_0x3c041b){return _0x3c041b[_0x9b3a('0x1d')](_0x5a58fa)[_0x9b3a('0x1e')](function(_0x43888e){return _0x43888e;});}return null;};}function removeEntity(_0x2b252f,_0x207cbd){return function(_0x50b88b){if(_0x50b88b){return _0x50b88b['destroy']()[_0x9b3a('0x1e')](function(){var _0x2273b7=_0x50b88b[_0x9b3a('0x1f')]({'plain':!![]});var _0x24bace=_0x9b3a('0x20');return db['UserProfileResource'][_0x9b3a('0x21')]({'where':{'type':_0x24bace,'resourceId':_0x2273b7['id']}})[_0x9b3a('0x1e')](function(){return _0x50b88b;});})[_0x9b3a('0x1e')](function(){_0x2b252f[_0x9b3a('0x15')](0xcc)[_0x9b3a('0x22')]();});}};}function handleEntityNotFound(_0x26032c,_0x31cc4d){return function(_0x40deed){if(!_0x40deed){_0x26032c[_0x9b3a('0x23')](0x194);}return _0x40deed;};}function handleError(_0x1a1f60,_0x3c03ac){_0x3c03ac=_0x3c03ac||0x1f4;return function(_0x4e545d){logger[_0x9b3a('0x24')](_0x4e545d[_0x9b3a('0x25')]);if(_0x4e545d[_0x9b3a('0x26')]){delete _0x4e545d[_0x9b3a('0x26')];}_0x1a1f60[_0x9b3a('0x15')](_0x3c03ac)[_0x9b3a('0x27')](_0x4e545d);};}exports[_0x9b3a('0x28')]=function(_0x15cfc2,_0x92aff7){var _0x37b0d9={},_0x2f4807={},_0x4fd965={'count':0x0,'rows':[]};var _0x5090ce=_[_0x9b3a('0x29')](db[_0x9b3a('0x2a')]['rawAttributes'],function(_0x592e7f){return{'name':_0x592e7f['fieldName'],'type':_0x592e7f[_0x9b3a('0x2b')][_0x9b3a('0x2c')]};});_0x2f4807[_0x9b3a('0x2d')]=_[_0x9b3a('0x29')](_0x5090ce,_0x9b3a('0x26'));_0x2f4807['query']=_[_0x9b3a('0x2e')](_0x15cfc2['query']);_0x2f4807['filters']=_[_0x9b3a('0x2f')](_0x2f4807['model'],_0x2f4807['query']);_0x37b0d9['attributes']=_[_0x9b3a('0x2f')](_0x2f4807[_0x9b3a('0x2d')],qs[_0x9b3a('0x30')](_0x15cfc2[_0x9b3a('0x31')][_0x9b3a('0x30')]));_0x37b0d9[_0x9b3a('0x32')]=_0x37b0d9[_0x9b3a('0x32')]['length']?_0x37b0d9[_0x9b3a('0x32')]:_0x2f4807[_0x9b3a('0x2d')];if(!_0x15cfc2[_0x9b3a('0x31')][_0x9b3a('0x33')](_0x9b3a('0x34'))){_0x37b0d9[_0x9b3a('0x18')]=qs[_0x9b3a('0x18')](_0x15cfc2[_0x9b3a('0x31')][_0x9b3a('0x18')]);_0x37b0d9[_0x9b3a('0x35')]=qs[_0x9b3a('0x35')](_0x15cfc2[_0x9b3a('0x31')][_0x9b3a('0x35')]);}_0x37b0d9[_0x9b3a('0x36')]=qs[_0x9b3a('0x37')](_0x15cfc2[_0x9b3a('0x31')][_0x9b3a('0x37')]);_0x37b0d9[_0x9b3a('0x38')]=qs[_0x9b3a('0x39')](_['pick'](_0x15cfc2[_0x9b3a('0x31')],_0x2f4807['filters']),_0x5090ce);if(_0x15cfc2[_0x9b3a('0x31')][_0x9b3a('0x3a')]){_0x37b0d9[_0x9b3a('0x38')]=_[_0x9b3a('0x3b')](_0x37b0d9[_0x9b3a('0x38')],{'$or':_[_0x9b3a('0x29')](_0x5090ce,function(_0x3c09cf){if(_0x3c09cf[_0x9b3a('0x2b')]!==_0x9b3a('0x3c')){var _0x41709={};_0x41709[_0x3c09cf[_0x9b3a('0x26')]]={'$like':'%'+_0x15cfc2[_0x9b3a('0x31')][_0x9b3a('0x3a')]+'%'};return _0x41709;}})});}_0x37b0d9=_['merge']({},_0x37b0d9,_0x15cfc2[_0x9b3a('0x3d')]);var _0x2156d9={'where':_0x37b0d9[_0x9b3a('0x38')]};return db[_0x9b3a('0x2a')][_0x9b3a('0x17')](_0x2156d9)[_0x9b3a('0x1e')](function(_0x159c10){_0x4fd965['count']=_0x159c10;if(_0x15cfc2[_0x9b3a('0x31')]['includeAll']){_0x37b0d9[_0x9b3a('0x3e')]=[{'all':!![]}];}return db[_0x9b3a('0x2a')][_0x9b3a('0x3f')](_0x37b0d9);})[_0x9b3a('0x1e')](function(_0x3e3746){_0x4fd965[_0x9b3a('0x40')]=_0x3e3746;return _0x4fd965;})[_0x9b3a('0x1e')](respondWithFilteredResult(_0x92aff7,_0x37b0d9))[_0x9b3a('0x41')](handleError(_0x92aff7,null));};exports[_0x9b3a('0x42')]=function(_0x3205ea,_0x5a1b21){var _0x2addea={'raw':!![],'where':{'id':_0x3205ea['params']['id']}},_0x426eba={};_0x426eba[_0x9b3a('0x2d')]=_[_0x9b3a('0x2e')](db['CmContactHasPhone']['rawAttributes']);_0x426eba[_0x9b3a('0x31')]=_['keys'](_0x3205ea['query']);_0x426eba[_0x9b3a('0x39')]=_['intersection'](_0x426eba[_0x9b3a('0x2d')],_0x426eba[_0x9b3a('0x31')]);_0x2addea[_0x9b3a('0x32')]=_['intersection'](_0x426eba[_0x9b3a('0x2d')],qs[_0x9b3a('0x30')](_0x3205ea[_0x9b3a('0x31')]['fields']));_0x2addea[_0x9b3a('0x32')]=_0x2addea[_0x9b3a('0x32')]['length']?_0x2addea['attributes']:_0x426eba[_0x9b3a('0x2d')];if(_0x3205ea[_0x9b3a('0x31')]['includeAll']){_0x2addea['include']=[{'all':!![]}];}_0x2addea=_[_0x9b3a('0x3b')]({},_0x2addea,_0x3205ea[_0x9b3a('0x3d')]);return db[_0x9b3a('0x2a')]['find'](_0x2addea)[_0x9b3a('0x1e')](handleEntityNotFound(_0x5a1b21,null))[_0x9b3a('0x1e')](respondWithResult(_0x5a1b21,null))[_0x9b3a('0x41')](handleError(_0x5a1b21,null));};exports[_0x9b3a('0x43')]=function(_0x2e920d,_0x3ec191){return db[_0x9b3a('0x2a')]['create'](_0x2e920d[_0x9b3a('0x44')],{})[_0x9b3a('0x1e')](function(_0xcbe0fe){var _0x24f3a7=_0x2e920d['user'][_0x9b3a('0x1f')]({'plain':!![]});if(!_0x24f3a7)throw new Error(_0x9b3a('0x45'));if(_0x24f3a7[_0x9b3a('0x46')]==='user'){var _0x3fe78f=_0xcbe0fe[_0x9b3a('0x1f')]({'plain':!![]});var _0x5f269d=_0x9b3a('0x20');return db[_0x9b3a('0x47')][_0x9b3a('0x48')]({'where':{'name':_0x5f269d,'userProfileId':_0x24f3a7['userProfileId']},'raw':!![]})['then'](function(_0x21b761){if(_0x21b761&&_0x21b761['autoAssociation']===0x0){return db[_0x9b3a('0x49')][_0x9b3a('0x43')]({'name':_0x3fe78f[_0x9b3a('0x26')],'resourceId':_0x3fe78f['id'],'type':_0x21b761[_0x9b3a('0x26')],'sectionId':_0x21b761['id']},{})['then'](function(){return _0xcbe0fe;});}else{return _0xcbe0fe;}})['catch'](function(_0xac4b0d){logger[_0x9b3a('0x24')](_0x9b3a('0x4a'),_0xac4b0d);throw _0xac4b0d;});}return _0xcbe0fe;})[_0x9b3a('0x1e')](respondWithResult(_0x3ec191,0xc9))['catch'](handleError(_0x3ec191,null));};exports[_0x9b3a('0x1d')]=function(_0x55de66,_0x362d76){if(_0x55de66[_0x9b3a('0x44')]['id']){delete _0x55de66['body']['id'];}return db[_0x9b3a('0x2a')]['find']({'where':{'id':_0x55de66['params']['id']}})['then'](handleEntityNotFound(_0x362d76,null))[_0x9b3a('0x1e')](saveUpdates(_0x55de66[_0x9b3a('0x44')],null))['then'](respondWithResult(_0x362d76,null))[_0x9b3a('0x41')](handleError(_0x362d76,null));};exports[_0x9b3a('0x21')]=function(_0x1d1589,_0x17d4d0){return db[_0x9b3a('0x2a')][_0x9b3a('0x48')]({'where':{'id':_0x1d1589[_0x9b3a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x17d4d0,null))[_0x9b3a('0x1e')](removeEntity(_0x17d4d0,null))[_0x9b3a('0x41')](handleError(_0x17d4d0,null));}; \ No newline at end of file +var _0x08d1=['stack','name','send','index','CmContactHasPhone','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','count','include','rows','catch','params','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','update','destroy','then','CmContactHasPhones','UserProfileResource','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x08d1,0x112));var _0x108d=function(_0x38907b,_0x352cab){_0x38907b=_0x38907b-0x0;var _0xa64806=_0x08d1[_0x38907b];return _0xa64806;};'use strict';var pdf=require(_0x108d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x108d('0x1'));var zipdir=require(_0x108d('0x2'));var jsonpatch=require(_0x108d('0x3'));var rp=require(_0x108d('0x4'));var moment=require(_0x108d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x108d('0x6'));var util=require('util');var path=require(_0x108d('0x7'));var sox=require(_0x108d('0x8'));var csv=require(_0x108d('0x9'));var ejs=require(_0x108d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x108d('0xb'));var crypto=require(_0x108d('0xc'));var jsforce=require(_0x108d('0xd'));var deskjs=require(_0x108d('0xe'));var toCsv=require(_0x108d('0x9'));var querystring=require(_0x108d('0xf'));var Papa=require(_0x108d('0x10'));var Redis=require(_0x108d('0x11'));var authService=require(_0x108d('0x12'));var qs=require(_0x108d('0x13'));var as=require(_0x108d('0x14'));var hardwareService=require(_0x108d('0x15'));var logger=require(_0x108d('0x16'))(_0x108d('0x17'));var utils=require(_0x108d('0x18'));var config=require('../../config/environment');var db=require(_0x108d('0x19'))['db'];function respondWithStatusCode(_0x411d8a,_0x23aac5){_0x23aac5=_0x23aac5||0xcc;return function(_0x530525){if(_0x530525){return _0x411d8a[_0x108d('0x1a')](_0x23aac5);}return _0x411d8a[_0x108d('0x1b')](_0x23aac5)[_0x108d('0x1c')]();};}function respondWithResult(_0x5167ab,_0x2c5a57){_0x2c5a57=_0x2c5a57||0xc8;return function(_0xdbc535){if(_0xdbc535){return _0x5167ab['status'](_0x2c5a57)['json'](_0xdbc535);}};}function respondWithFilteredResult(_0x35ebfd,_0x32f753){return function(_0x4f5d05){if(_0x4f5d05){var _0x4529aa=_0x4f5d05['count'],_0x28e404=_0x32f753[_0x108d('0x1d')],_0x2e2fa3=_0x32f753['offset']+_0x32f753[_0x108d('0x1e')],_0x52f281;if(_0x2e2fa3>=_0x4529aa){_0x2e2fa3=_0x4529aa;_0x52f281=0xc8;}else{_0x52f281=0xce;}_0x35ebfd['status'](_0x52f281);return _0x35ebfd['set'](_0x108d('0x1f'),_0x28e404+'-'+_0x2e2fa3+'/'+_0x4529aa)['json'](_0x4f5d05);}return null;};}function patchUpdates(_0x333f69){return function(_0x36717d){try{jsonpatch['apply'](_0x36717d,_0x333f69,!![]);}catch(_0x1f1d8e){return BPromise['reject'](_0x1f1d8e);}return _0x36717d['save']();};}function saveUpdates(_0xb2664c,_0x4bf3cc){return function(_0x589e0f){if(_0x589e0f){return _0x589e0f[_0x108d('0x20')](_0xb2664c)['then'](function(_0x349547){return _0x349547;});}return null;};}function removeEntity(_0x5b3d84,_0x2a7872){return function(_0x3fa2da){if(_0x3fa2da){return _0x3fa2da[_0x108d('0x21')]()[_0x108d('0x22')](function(){var _0x2db9b4=_0x3fa2da['get']({'plain':!![]});var _0x2142ae=_0x108d('0x23');return db[_0x108d('0x24')][_0x108d('0x21')]({'where':{'type':_0x2142ae,'resourceId':_0x2db9b4['id']}})[_0x108d('0x22')](function(){return _0x3fa2da;});})['then'](function(){_0x5b3d84[_0x108d('0x1b')](0xcc)[_0x108d('0x1c')]();});}};}function handleEntityNotFound(_0x4b549c,_0x591e10){return function(_0x8b5297){if(!_0x8b5297){_0x4b549c[_0x108d('0x1a')](0x194);}return _0x8b5297;};}function handleError(_0x12ceec,_0x30ad47){_0x30ad47=_0x30ad47||0x1f4;return function(_0x3a61d7){logger[_0x108d('0x25')](_0x3a61d7[_0x108d('0x26')]);if(_0x3a61d7[_0x108d('0x27')]){delete _0x3a61d7['name'];}_0x12ceec[_0x108d('0x1b')](_0x30ad47)[_0x108d('0x28')](_0x3a61d7);};}exports[_0x108d('0x29')]=function(_0x42d732,_0x125133){var _0x853011={},_0x29f657={},_0x141fd4={'count':0x0,'rows':[]};var _0x33af8e=_['map'](db[_0x108d('0x2a')][_0x108d('0x2b')],function(_0x5074f2){return{'name':_0x5074f2['fieldName'],'type':_0x5074f2[_0x108d('0x2c')][_0x108d('0x2d')]};});_0x29f657[_0x108d('0x2e')]=_['map'](_0x33af8e,_0x108d('0x27'));_0x29f657['query']=_[_0x108d('0x2f')](_0x42d732['query']);_0x29f657[_0x108d('0x30')]=_[_0x108d('0x31')](_0x29f657[_0x108d('0x2e')],_0x29f657[_0x108d('0x32')]);_0x853011[_0x108d('0x33')]=_[_0x108d('0x31')](_0x29f657[_0x108d('0x2e')],qs[_0x108d('0x34')](_0x42d732[_0x108d('0x32')][_0x108d('0x34')]));_0x853011[_0x108d('0x33')]=_0x853011[_0x108d('0x33')][_0x108d('0x35')]?_0x853011[_0x108d('0x33')]:_0x29f657[_0x108d('0x2e')];if(!_0x42d732[_0x108d('0x32')]['hasOwnProperty'](_0x108d('0x36'))){_0x853011[_0x108d('0x1e')]=qs['limit'](_0x42d732[_0x108d('0x32')][_0x108d('0x1e')]);_0x853011[_0x108d('0x1d')]=qs[_0x108d('0x1d')](_0x42d732[_0x108d('0x32')][_0x108d('0x1d')]);}_0x853011[_0x108d('0x37')]=qs['sort'](_0x42d732[_0x108d('0x32')][_0x108d('0x38')]);_0x853011['where']=qs[_0x108d('0x30')](_[_0x108d('0x39')](_0x42d732[_0x108d('0x32')],_0x29f657[_0x108d('0x30')]),_0x33af8e);if(_0x42d732['query']['filter']){_0x853011[_0x108d('0x3a')]=_[_0x108d('0x3b')](_0x853011[_0x108d('0x3a')],{'$or':_['map'](_0x33af8e,function(_0x4868a3){if(_0x4868a3[_0x108d('0x2c')]!==_0x108d('0x3c')){var _0x7d01a4={};_0x7d01a4[_0x4868a3[_0x108d('0x27')]]={'$like':'%'+_0x42d732[_0x108d('0x32')][_0x108d('0x3d')]+'%'};return _0x7d01a4;}})});}_0x853011=_[_0x108d('0x3b')]({},_0x853011,_0x42d732['options']);var _0x547ce2={'where':_0x853011[_0x108d('0x3a')]};return db['CmContactHasPhone'][_0x108d('0x3e')](_0x547ce2)[_0x108d('0x22')](function(_0x5460b7){_0x141fd4[_0x108d('0x3e')]=_0x5460b7;if(_0x42d732['query']['includeAll']){_0x853011[_0x108d('0x3f')]=[{'all':!![]}];}return db[_0x108d('0x2a')]['findAll'](_0x853011);})[_0x108d('0x22')](function(_0x34bed0){_0x141fd4[_0x108d('0x40')]=_0x34bed0;return _0x141fd4;})[_0x108d('0x22')](respondWithFilteredResult(_0x125133,_0x853011))[_0x108d('0x41')](handleError(_0x125133,null));};exports['show']=function(_0x4e7623,_0x2d3d1d){var _0x354eab={'raw':!![],'where':{'id':_0x4e7623[_0x108d('0x42')]['id']}},_0xfcf283={};_0xfcf283[_0x108d('0x2e')]=_[_0x108d('0x2f')](db[_0x108d('0x2a')][_0x108d('0x2b')]);_0xfcf283[_0x108d('0x32')]=_[_0x108d('0x2f')](_0x4e7623[_0x108d('0x32')]);_0xfcf283[_0x108d('0x30')]=_[_0x108d('0x31')](_0xfcf283['model'],_0xfcf283[_0x108d('0x32')]);_0x354eab[_0x108d('0x33')]=_[_0x108d('0x31')](_0xfcf283[_0x108d('0x2e')],qs[_0x108d('0x34')](_0x4e7623['query'][_0x108d('0x34')]));_0x354eab['attributes']=_0x354eab[_0x108d('0x33')]['length']?_0x354eab['attributes']:_0xfcf283[_0x108d('0x2e')];if(_0x4e7623[_0x108d('0x32')][_0x108d('0x43')]){_0x354eab[_0x108d('0x3f')]=[{'all':!![]}];}_0x354eab=_[_0x108d('0x3b')]({},_0x354eab,_0x4e7623['options']);return db[_0x108d('0x2a')][_0x108d('0x44')](_0x354eab)['then'](handleEntityNotFound(_0x2d3d1d,null))['then'](respondWithResult(_0x2d3d1d,null))['catch'](handleError(_0x2d3d1d,null));};exports['create']=function(_0x40d033,_0xd09acf){return db[_0x108d('0x2a')][_0x108d('0x45')](_0x40d033[_0x108d('0x46')],{})[_0x108d('0x22')](function(_0x4f403f){var _0x2f049a=_0x40d033['user'][_0x108d('0x47')]({'plain':!![]});if(!_0x2f049a)throw new Error(_0x108d('0x48'));if(_0x2f049a[_0x108d('0x49')]===_0x108d('0x4a')){var _0x4d3257=_0x4f403f[_0x108d('0x47')]({'plain':!![]});var _0x3f384d=_0x108d('0x23');return db[_0x108d('0x4b')][_0x108d('0x44')]({'where':{'name':_0x3f384d,'userProfileId':_0x2f049a[_0x108d('0x4c')]},'raw':!![]})[_0x108d('0x22')](function(_0x209ee0){if(_0x209ee0&&_0x209ee0[_0x108d('0x4d')]===0x0){return db[_0x108d('0x24')]['create']({'name':_0x4d3257[_0x108d('0x27')],'resourceId':_0x4d3257['id'],'type':_0x209ee0[_0x108d('0x27')],'sectionId':_0x209ee0['id']},{})[_0x108d('0x22')](function(){return _0x4f403f;});}else{return _0x4f403f;}})[_0x108d('0x41')](function(_0x4fb364){logger[_0x108d('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fb364);throw _0x4fb364;});}return _0x4f403f;})['then'](respondWithResult(_0xd09acf,0xc9))[_0x108d('0x41')](handleError(_0xd09acf,null));};exports[_0x108d('0x20')]=function(_0xcbd958,_0x4efb2f){if(_0xcbd958[_0x108d('0x46')]['id']){delete _0xcbd958['body']['id'];}return db[_0x108d('0x2a')][_0x108d('0x44')]({'where':{'id':_0xcbd958[_0x108d('0x42')]['id']}})[_0x108d('0x22')](handleEntityNotFound(_0x4efb2f,null))[_0x108d('0x22')](saveUpdates(_0xcbd958[_0x108d('0x46')],null))['then'](respondWithResult(_0x4efb2f,null))[_0x108d('0x41')](handleError(_0x4efb2f,null));};exports[_0x108d('0x21')]=function(_0xeb201f,_0x106d52){return db[_0x108d('0x2a')][_0x108d('0x44')]({'where':{'id':_0xeb201f[_0x108d('0x42')]['id']}})[_0x108d('0x22')](handleEntityNotFound(_0x106d52,null))[_0x108d('0x22')](removeEntity(_0x106d52,null))[_0x108d('0x41')](handleError(_0x106d52,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index e6a5596..24a0a3b 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.model.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x15a9=['CmContactHasPhone','cm_contact_has_phones','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasPhone.attributes','exports','define'];(function(_0x5b5c0e,_0x57747d){var _0x3ca8e0=function(_0x26ef70){while(--_0x26ef70){_0x5b5c0e['push'](_0x5b5c0e['shift']());}};_0x3ca8e0(++_0x57747d);}(_0x15a9,0x18a));var _0x915a=function(_0x40a4cd,_0x23636e){_0x40a4cd=_0x40a4cd-0x0;var _0xc0ac8a=_0x15a9[_0x40a4cd];return _0xc0ac8a;};'use strict';var _=require(_0x915a('0x0'));var util=require(_0x915a('0x1'));var logger=require(_0x915a('0x2'))(_0x915a('0x3'));var moment=require('moment');var BPromise=require(_0x915a('0x4'));var rp=require(_0x915a('0x5'));var fs=require('fs');var path=require(_0x915a('0x6'));var rimraf=require(_0x915a('0x7'));var config=require(_0x915a('0x8'));var attributes=require(_0x915a('0x9'));module[_0x915a('0xa')]=function(_0x40c3a7,_0x39e6ea){return _0x40c3a7[_0x915a('0xb')](_0x915a('0xc'),attributes,{'tableName':_0x915a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07dc=['exports','define','CmContactHasPhone','cm_contact_has_phones','util','moment','request-promise','../../config/environment'];(function(_0x782302,_0x2d7d7c){var _0x244e6f=function(_0x3e1e10){while(--_0x3e1e10){_0x782302['push'](_0x782302['shift']());}};_0x244e6f(++_0x2d7d7c);}(_0x07dc,0x174));var _0xc07d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x07dc[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0xc07d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc07d('0x1'));var BPromise=require('bluebird');var rp=require(_0xc07d('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc07d('0x3'));var attributes=require('./cmContactHasPhone.attributes');module[_0xc07d('0x4')]=function(_0x24a973,_0xb21120){return _0x24a973[_0xc07d('0x5')](_0xc07d('0x6'),attributes,{'tableName':_0xc07d('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js index cfa540e..47489fc 100644 --- a/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js +++ b/server/api/cmContactHasPhone/cmContactHasPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb84=['request\x20sent','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmContactHasPhone,\x20%s,\x20%s'];(function(_0x81e1f8,_0x3c1d3f){var _0x17aaa6=function(_0x163821){while(--_0x163821){_0x81e1f8['push'](_0x81e1f8['shift']());}};_0x17aaa6(++_0x3c1d3f);}(_0xeb84,0x103));var _0x4eb8=function(_0x199bc4,_0x338105){_0x199bc4=_0x199bc4-0x0;var _0x136ffb=_0xeb84[_0x199bc4];return _0x136ffb;};'use strict';var _=require(_0x4eb8('0x0'));var util=require(_0x4eb8('0x1'));var moment=require(_0x4eb8('0x2'));var BPromise=require(_0x4eb8('0x3'));var rs=require(_0x4eb8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4eb8('0x5'))['db'];var utils=require(_0x4eb8('0x6'));var logger=require(_0x4eb8('0x7'))(_0x4eb8('0x8'));var config=require(_0x4eb8('0x9'));var jayson=require(_0x4eb8('0xa'));var client=jayson[_0x4eb8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x209be3,_0x23e3b6,_0x448419){return new BPromise(function(_0x2b1459,_0xc8eadc){return client[_0x4eb8('0xc')](_0x209be3,_0x448419)[_0x4eb8('0xd')](function(_0x1e8842){logger[_0x4eb8('0xe')](_0x4eb8('0xf'),_0x23e3b6,_0x4eb8('0x10'));logger[_0x4eb8('0x11')](_0x4eb8('0x12'),_0x23e3b6,'request\x20sent',JSON[_0x4eb8('0x13')](_0x1e8842));if(_0x1e8842[_0x4eb8('0x14')]){if(_0x1e8842[_0x4eb8('0x14')][_0x4eb8('0x15')]===0x1f4){logger[_0x4eb8('0x14')]('CmContactHasPhone,\x20%s,\x20%s',_0x23e3b6,_0x1e8842[_0x4eb8('0x14')][_0x4eb8('0x16')]);return _0xc8eadc(_0x1e8842['error'][_0x4eb8('0x16')]);}logger[_0x4eb8('0x14')](_0x4eb8('0xf'),_0x23e3b6,_0x1e8842[_0x4eb8('0x14')][_0x4eb8('0x16')]);return _0x2b1459(_0x1e8842[_0x4eb8('0x14')]['message']);}else{logger[_0x4eb8('0xe')](_0x4eb8('0xf'),_0x23e3b6,_0x4eb8('0x10'));_0x2b1459(_0x1e8842[_0x4eb8('0x17')][_0x4eb8('0x16')]);}})[_0x4eb8('0x18')](function(_0x358949){logger[_0x4eb8('0x14')](_0x4eb8('0xf'),_0x23e3b6,_0x358949);_0xc8eadc(_0x358949);});});} \ No newline at end of file +var _0x5dbc=['error','code','message','CmContactHasPhone,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','request\x20sent','CmContactHasPhone,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x937a27,_0x2f6f62){var _0x4d7ea8=function(_0x10901d){while(--_0x10901d){_0x937a27['push'](_0x937a27['shift']());}};_0x4d7ea8(++_0x2f6f62);}(_0x5dbc,0x166));var _0xc5db=function(_0x1d61c8,_0x420cde){_0x1d61c8=_0x1d61c8-0x0;var _0x196fac=_0x5dbc[_0x1d61c8];return _0x196fac;};'use strict';var _=require(_0xc5db('0x0'));var util=require('util');var moment=require(_0xc5db('0x1'));var BPromise=require(_0xc5db('0x2'));var rs=require(_0xc5db('0x3'));var fs=require('fs');var Redis=require(_0xc5db('0x4'));var db=require(_0xc5db('0x5'))['db'];var utils=require(_0xc5db('0x6'));var logger=require(_0xc5db('0x7'))(_0xc5db('0x8'));var config=require('../../config/environment');var jayson=require(_0xc5db('0x9'));var client=jayson[_0xc5db('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a9dc8,_0x30f81f,_0xc5a688){return new BPromise(function(_0x1314e3,_0x1fc796){return client['request'](_0x3a9dc8,_0xc5a688)[_0xc5db('0xb')](function(_0x34f3bb){logger[_0xc5db('0xc')]('CmContactHasPhone,\x20%s,\x20%s',_0x30f81f,_0xc5db('0xd'));logger['debug'](_0xc5db('0xe'),_0x30f81f,_0xc5db('0xd'),JSON[_0xc5db('0xf')](_0x34f3bb));if(_0x34f3bb[_0xc5db('0x10')]){if(_0x34f3bb[_0xc5db('0x10')][_0xc5db('0x11')]===0x1f4){logger[_0xc5db('0x10')]('CmContactHasPhone,\x20%s,\x20%s',_0x30f81f,_0x34f3bb[_0xc5db('0x10')][_0xc5db('0x12')]);return _0x1fc796(_0x34f3bb[_0xc5db('0x10')][_0xc5db('0x12')]);}logger[_0xc5db('0x10')](_0xc5db('0x13'),_0x30f81f,_0x34f3bb[_0xc5db('0x10')][_0xc5db('0x12')]);return _0x1314e3(_0x34f3bb[_0xc5db('0x10')][_0xc5db('0x12')]);}else{logger[_0xc5db('0xc')](_0xc5db('0x13'),_0x30f81f,_0xc5db('0xd'));_0x1314e3(_0x34f3bb[_0xc5db('0x14')][_0xc5db('0x12')]);}})[_0xc5db('0x15')](function(_0x2a926c){logger[_0xc5db('0x10')]('CmContactHasPhone,\x20%s,\x20%s',_0x30f81f,_0x2a926c);_0x1fc796(_0x2a926c);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index 95c33a7..4db8e29 100644 --- a/server/api/cmContactHasPhone/index.js +++ b/server/api/cmContactHasPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe6d=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','multer'];(function(_0x3e961c,_0x5747e7){var _0x474f9c=function(_0x33f8ea){while(--_0x33f8ea){_0x3e961c['push'](_0x3e961c['shift']());}};_0x474f9c(++_0x5747e7);}(_0xfe6d,0xaf));var _0xdfe6=function(_0x5b013d,_0xc7691c){_0x5b013d=_0x5b013d-0x0;var _0x2b6eef=_0xfe6d[_0x5b013d];return _0x2b6eef;};'use strict';var multer=require(_0xdfe6('0x0'));var util=require(_0xdfe6('0x1'));var path=require(_0xdfe6('0x2'));var timeout=require(_0xdfe6('0x3'));var express=require(_0xdfe6('0x4'));var router=express[_0xdfe6('0x5')]();var auth=require(_0xdfe6('0x6'));var interaction=require(_0xdfe6('0x7'));var config=require(_0xdfe6('0x8'));var controller=require(_0xdfe6('0x9'));router[_0xdfe6('0xa')]('/',auth['isAuthenticated'](),controller[_0xdfe6('0xb')]);router[_0xdfe6('0xa')](_0xdfe6('0xc'),auth['isAuthenticated'](),controller[_0xdfe6('0xd')]);router[_0xdfe6('0xe')]('/',auth[_0xdfe6('0xf')](),controller[_0xdfe6('0x10')]);router[_0xdfe6('0x11')](_0xdfe6('0xc'),auth[_0xdfe6('0xf')](),controller[_0xdfe6('0x12')]);router[_0xdfe6('0x13')](_0xdfe6('0xc'),auth['isAuthenticated'](),controller[_0xdfe6('0x14')]);module[_0xdfe6('0x15')]=router; \ No newline at end of file +var _0x03ae=['/:id','show','post','create','put','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x5c69c8,_0x5f0729){var _0x3e97ba=function(_0x427b37){while(--_0x427b37){_0x5c69c8['push'](_0x5c69c8['shift']());}};_0x3e97ba(++_0x5f0729);}(_0x03ae,0x15f));var _0xe03a=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x03ae[_0x45d3f0];return _0x314b79;};'use strict';var multer=require('multer');var util=require(_0xe03a('0x0'));var path=require(_0xe03a('0x1'));var timeout=require(_0xe03a('0x2'));var express=require('express');var router=express[_0xe03a('0x3')]();var auth=require(_0xe03a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe03a('0x5'));var controller=require('./cmContactHasPhone.controller');router[_0xe03a('0x6')]('/',auth[_0xe03a('0x7')](),controller[_0xe03a('0x8')]);router[_0xe03a('0x6')](_0xe03a('0x9'),auth[_0xe03a('0x7')](),controller[_0xe03a('0xa')]);router[_0xe03a('0xb')]('/',auth[_0xe03a('0x7')](),controller[_0xe03a('0xc')]);router[_0xe03a('0xd')](_0xe03a('0x9'),auth[_0xe03a('0x7')](),controller['update']);router['delete']('/:id',auth[_0xe03a('0x7')](),controller[_0xe03a('0xe')]);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 1748690..0cd79e5 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 _0x06fe=['exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','type','select','parse','values','isArray','BOOLEAN','sequelize','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x06fe,0xec));var _0xe06f=function(_0x4a73dd,_0x58e46c){_0x4a73dd=_0x4a73dd-0x0;var _0x279e6b=_0x06fe[_0x4a73dd];return _0x279e6b;};'use strict';var Sequelize=require(_0xe06f('0x0'));var _=require(_0xe06f('0x1'));module[_0xe06f('0x2')]={'name':{'type':Sequelize[_0xe06f('0x3')],'get':function(_0x5a6912){return this[_0xe06f('0x4')](_0xe06f('0x5'));}},'alias':{'type':Sequelize[_0xe06f('0x6')],'allowNull':![],'set':function(_0xf16a7e){this[_0xe06f('0x7')](_0xe06f('0x5'),_0xf16a7e?_0xf16a7e:this[_0xe06f('0x4')](_0xe06f('0x8')));}},'type':{'type':Sequelize[_0xe06f('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xe06f('0x9')](_0xe06f('0xa')),'get':function(){if(this[_0xe06f('0x4')](_0xe06f('0xb'))===_0xe06f('0xc')){return JSON[_0xe06f('0xd')](this[_0xe06f('0x4')](_0xe06f('0xe')));}else{return this[_0xe06f('0x4')]('values');}},'set':function(_0x2f9666){if(Array[_0xe06f('0xf')](_0x2f9666)){this[_0xe06f('0x7')](_0xe06f('0xe'),JSON['stringify'](_0x2f9666));}else{this[_0xe06f('0x7')](_0xe06f('0xe'),_0x2f9666);}}},'required':{'type':Sequelize[_0xe06f('0x10')],'defaultValue':![]}}; \ No newline at end of file +var _0x2034=['BOOLEAN','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','name','STRING','TEXT','long','type','select','values','isArray','stringify'];(function(_0x3b7911,_0x3d8c28){var _0x193910=function(_0x26df8c){while(--_0x26df8c){_0x3b7911['push'](_0x3b7911['shift']());}};_0x193910(++_0x3d8c28);}(_0x2034,0x133));var _0x4203=function(_0x55ad1d,_0x101d17){_0x55ad1d=_0x55ad1d-0x0;var _0x324bc0=_0x2034[_0x55ad1d];return _0x324bc0;};'use strict';var Sequelize=require(_0x4203('0x0'));var _=require(_0x4203('0x1'));module[_0x4203('0x2')]={'name':{'type':Sequelize[_0x4203('0x3')],'get':function(_0x334c6b){return this[_0x4203('0x4')](_0x4203('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x360713){this[_0x4203('0x6')](_0x4203('0x5'),_0x360713?_0x360713:this[_0x4203('0x4')](_0x4203('0x7')));}},'type':{'type':Sequelize[_0x4203('0x8')],'allowNull':![]},'values':{'type':Sequelize[_0x4203('0x9')](_0x4203('0xa')),'get':function(){if(this[_0x4203('0x4')](_0x4203('0xb'))===_0x4203('0xc')){return JSON['parse'](this[_0x4203('0x4')](_0x4203('0xd')));}else{return this[_0x4203('0x4')](_0x4203('0xd'));}},'set':function(_0x57c61f){if(Array[_0x4203('0xe')](_0x57c61f)){this[_0x4203('0x6')](_0x4203('0xd'),JSON[_0x4203('0xf')](_0x57c61f));}else{this[_0x4203('0x6')]('values',_0x57c61f);}}},'required':{'type':Sequelize[_0x4203('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 5e9bf8c..0d43d50 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 _0x6bb9=['number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%d','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','name','index','map','CmCustomField','rawAttributes','fieldName','key','model','differenceBy','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filters','type','merge','includeAll','include','findAll','rows','show','params','keys','catch','body','find','create','sequelize','transaction','Sequelize','text','TEXT'];(function(_0xbb1b71,_0x20b571){var _0x5d4500=function(_0x1c60d5){while(--_0x1c60d5){_0xbb1b71['push'](_0xbb1b71['shift']());}};_0x5d4500(++_0x20b571);}(_0x6bb9,0x101));var _0x96bb=function(_0x80e32c,_0x45b0bf){_0x80e32c=_0x80e32c-0x0;var _0x5a31af=_0x6bb9[_0x80e32c];return _0x5a31af;};'use strict';var pdf=require(_0x96bb('0x0'));var emlformat=require(_0x96bb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x96bb('0x2'));var jsonpatch=require(_0x96bb('0x3'));var rp=require('request-promise');var moment=require(_0x96bb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x96bb('0x5'));var util=require(_0x96bb('0x6'));var path=require(_0x96bb('0x7'));var sox=require(_0x96bb('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x96bb('0x9'));var squel=require(_0x96bb('0xa'));var crypto=require(_0x96bb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x96bb('0xc'));var toCsv=require(_0x96bb('0xd'));var querystring=require(_0x96bb('0xe'));var Papa=require('papaparse');var Redis=require(_0x96bb('0xf'));var authService=require(_0x96bb('0x10'));var qs=require(_0x96bb('0x11'));var as=require(_0x96bb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x96bb('0x13'))('api');var utils=require(_0x96bb('0x14'));var config=require(_0x96bb('0x15'));var db=require(_0x96bb('0x16'))['db'];function respondWithStatusCode(_0xc0a7f2,_0x4d1869){_0x4d1869=_0x4d1869||0xcc;return function(_0x168680){if(_0x168680){return _0xc0a7f2['sendStatus'](_0x4d1869);}return _0xc0a7f2[_0x96bb('0x17')](_0x4d1869)[_0x96bb('0x18')]();};}function respondWithResult(_0x2643f9,_0x464406){_0x464406=_0x464406||0xc8;return function(_0x26d34a){if(_0x26d34a){return _0x2643f9['status'](_0x464406)['json'](_0x26d34a);}};}function respondWithFilteredResult(_0x66180,_0x11834c){return function(_0x4ef4dd){if(_0x4ef4dd){var _0x3cb225=_0x4ef4dd[_0x96bb('0x19')],_0x5a120f=_0x11834c[_0x96bb('0x1a')],_0x2f36fe=_0x11834c['offset']+_0x11834c[_0x96bb('0x1b')],_0x3b421d;if(_0x2f36fe>=_0x3cb225){_0x2f36fe=_0x3cb225;_0x3b421d=0xc8;}else{_0x3b421d=0xce;}_0x66180[_0x96bb('0x17')](_0x3b421d);return _0x66180[_0x96bb('0x1c')](_0x96bb('0x1d'),_0x5a120f+'-'+_0x2f36fe+'/'+_0x3cb225)['json'](_0x4ef4dd);}return null;};}function patchUpdates(_0x15ca7e){return function(_0x3f456b){try{jsonpatch[_0x96bb('0x1e')](_0x3f456b,_0x15ca7e,!![]);}catch(_0x5925c5){return BPromise[_0x96bb('0x1f')](_0x5925c5);}return _0x3f456b['save']();};}function saveUpdates(_0x4318aa,_0x35bcf1){return function(_0x503192){if(_0x503192){return _0x503192[_0x96bb('0x20')](_0x4318aa)[_0x96bb('0x21')](function(_0x20b614){return _0x20b614;});}return null;};}function removeEntity(_0x4ced2a,_0x3426ea){return function(_0x4d3e91){if(_0x4d3e91){return _0x4d3e91[_0x96bb('0x22')]()['then'](function(){_0x4ced2a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26005a,_0x573fd5){return function(_0x28a099){if(!_0x28a099){_0x26005a[_0x96bb('0x23')](0x194);}return _0x28a099;};}function handleError(_0x362903,_0x11cbbe){_0x11cbbe=_0x11cbbe||0x1f4;return function(_0x3a4730){logger[_0x96bb('0x24')](_0x3a4730['stack']);if(_0x3a4730[_0x96bb('0x25')]){delete _0x3a4730[_0x96bb('0x25')];}_0x362903[_0x96bb('0x17')](_0x11cbbe)['send'](_0x3a4730);};}exports[_0x96bb('0x26')]=function(_0x385634,_0x35c36d){var _0x461b4d={},_0x55cba4={},_0x1f04a3={'count':0x0,'rows':[]};var _0x565b94=_[_0x96bb('0x27')](db[_0x96bb('0x28')][_0x96bb('0x29')],function(_0x329a49){return{'name':_0x329a49[_0x96bb('0x2a')],'type':_0x329a49['type'][_0x96bb('0x2b')]};});_0x55cba4[_0x96bb('0x2c')]=_[_0x96bb('0x2d')](_[_0x96bb('0x27')](_0x565b94,_0x96bb('0x25')),[_0x96bb('0x25')]);_0x55cba4['query']=_['keys'](_0x385634[_0x96bb('0x2e')]);_0x55cba4['filters']=_[_0x96bb('0x2f')](_0x55cba4['model'],_0x55cba4[_0x96bb('0x2e')]);_0x461b4d[_0x96bb('0x30')]=_[_0x96bb('0x2f')](_0x55cba4[_0x96bb('0x2c')],qs[_0x96bb('0x31')](_0x385634[_0x96bb('0x2e')][_0x96bb('0x31')]));_0x461b4d[_0x96bb('0x30')]=_0x461b4d['attributes'][_0x96bb('0x32')]?_0x461b4d[_0x96bb('0x30')]:_0x55cba4[_0x96bb('0x2c')];if(!_0x385634[_0x96bb('0x2e')][_0x96bb('0x33')](_0x96bb('0x34'))){_0x461b4d[_0x96bb('0x1b')]=qs[_0x96bb('0x1b')](_0x385634[_0x96bb('0x2e')][_0x96bb('0x1b')]);_0x461b4d[_0x96bb('0x1a')]=qs['offset'](_0x385634[_0x96bb('0x2e')][_0x96bb('0x1a')]);}_0x461b4d[_0x96bb('0x35')]=qs['sort'](_0x385634[_0x96bb('0x2e')]['sort']);_0x461b4d[_0x96bb('0x36')]=qs['filters'](_[_0x96bb('0x37')](_0x385634[_0x96bb('0x2e')],_0x55cba4[_0x96bb('0x38')]),_0x565b94);if(_0x385634['query']['filter']){_0x461b4d['where']=_['merge'](_0x461b4d[_0x96bb('0x36')],{'$or':_['map'](_0x565b94,function(_0x19ee2b){if(_0x19ee2b[_0x96bb('0x39')]!=='VIRTUAL'){var _0xa228bd={};_0xa228bd[_0x19ee2b['name']]={'$like':'%'+_0x385634[_0x96bb('0x2e')]['filter']+'%'};return _0xa228bd;}})});}_0x461b4d=_[_0x96bb('0x3a')]({},_0x461b4d,_0x385634['options']);var _0x267102={'where':_0x461b4d['where']};return db[_0x96bb('0x28')][_0x96bb('0x19')](_0x267102)[_0x96bb('0x21')](function(_0x342688){_0x1f04a3['count']=_0x342688;if(_0x385634['query'][_0x96bb('0x3b')]){_0x461b4d[_0x96bb('0x3c')]=[{'all':!![]}];}return db[_0x96bb('0x28')][_0x96bb('0x3d')](_0x461b4d);})[_0x96bb('0x21')](function(_0x4de0b8){_0x1f04a3[_0x96bb('0x3e')]=_0x4de0b8;return _0x1f04a3;})[_0x96bb('0x21')](respondWithFilteredResult(_0x35c36d,_0x461b4d))['catch'](handleError(_0x35c36d,null));};exports[_0x96bb('0x3f')]=function(_0x3b9c6b,_0x7987b6){var _0x41eff7={'raw':!![],'where':{'id':_0x3b9c6b[_0x96bb('0x40')]['id']}},_0x68a4fd={};_0x68a4fd['model']=_['keys'](db[_0x96bb('0x28')][_0x96bb('0x29')]);_0x68a4fd[_0x96bb('0x2e')]=_[_0x96bb('0x41')](_0x3b9c6b['query']);_0x68a4fd[_0x96bb('0x38')]=_[_0x96bb('0x2f')](_0x68a4fd[_0x96bb('0x2c')],_0x68a4fd[_0x96bb('0x2e')]);_0x41eff7[_0x96bb('0x30')]=_[_0x96bb('0x2f')](_0x68a4fd['model'],qs[_0x96bb('0x31')](_0x3b9c6b[_0x96bb('0x2e')][_0x96bb('0x31')]));_0x41eff7[_0x96bb('0x30')]=_0x41eff7['attributes'][_0x96bb('0x32')]?_0x41eff7[_0x96bb('0x30')]:_0x68a4fd['model'];if(_0x3b9c6b[_0x96bb('0x2e')]['includeAll']){_0x41eff7[_0x96bb('0x3c')]=[{'all':!![]}];}_0x41eff7=_[_0x96bb('0x3a')]({},_0x41eff7,_0x3b9c6b['options']);return db[_0x96bb('0x28')]['find'](_0x41eff7)[_0x96bb('0x21')](handleEntityNotFound(_0x7987b6,null))['then'](respondWithResult(_0x7987b6,null))[_0x96bb('0x42')](handleError(_0x7987b6,null));};exports[_0x96bb('0x20')]=function(_0x28b211,_0x1ca3d5){if(_0x28b211[_0x96bb('0x43')]['id']){delete _0x28b211[_0x96bb('0x43')]['id'];}return db[_0x96bb('0x28')][_0x96bb('0x44')]({'where':{'id':_0x28b211[_0x96bb('0x40')]['id']}})['then'](handleEntityNotFound(_0x1ca3d5,null))[_0x96bb('0x21')](saveUpdates(_0x28b211['body'],null))[_0x96bb('0x21')](respondWithResult(_0x1ca3d5,null))[_0x96bb('0x42')](handleError(_0x1ca3d5,null));};exports[_0x96bb('0x22')]=function(_0x1cb3b2,_0xd5f9be){return db[_0x96bb('0x28')][_0x96bb('0x44')]({'where':{'id':_0x1cb3b2['params']['id']}})[_0x96bb('0x21')](handleEntityNotFound(_0xd5f9be,null))[_0x96bb('0x21')](removeEntity(_0xd5f9be,null))[_0x96bb('0x42')](handleError(_0xd5f9be,null));};exports[_0x96bb('0x45')]=function(_0x541a6f,_0x236f4c){var _0x3e2241;return db[_0x96bb('0x46')][_0x96bb('0x47')](function(_0x236afe){return db['CmCustomField'][_0x96bb('0x45')](_0x541a6f[_0x96bb('0x43')],{'transaction':_0x236afe})[_0x96bb('0x21')](function(_0x208988){_0x3e2241=_0x208988;var _0x3d74a3={'type':db[_0x96bb('0x48')]['TEXT'],'transaction':_0x236afe};switch(_0x541a6f[_0x96bb('0x43')][_0x96bb('0x39')]){case _0x96bb('0x49'):_0x3d74a3[_0x96bb('0x39')]=db[_0x96bb('0x48')][_0x96bb('0x4a')];break;case _0x96bb('0x4b'):_0x3d74a3[_0x96bb('0x39')]=db['Sequelize'][_0x96bb('0x4c')];break;case _0x96bb('0x4d'):_0x3d74a3[_0x96bb('0x39')]=db[_0x96bb('0x48')][_0x96bb('0x4e')];_0x3d74a3[_0x96bb('0x4f')]=![];break;default:}return db[_0x96bb('0x46')][_0x96bb('0x50')][_0x96bb('0x51')]('cm_contacts',util['format'](_0x96bb('0x52'),_0x3e2241['id']),_0x3d74a3);})[_0x96bb('0x21')](function(){return _0x3e2241;});})[_0x96bb('0x21')](respondWithResult(_0x236f4c,0xc9))[_0x96bb('0x42')](handleError(_0x236f4c,null));}; \ No newline at end of file +var _0x9539=['rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','CmCustomField','rawAttributes','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','catch','body','find','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','html-pdf','eml-format'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x9539,0x14a));var _0x9953=function(_0x3b3b56,_0xd3d724){_0x3b3b56=_0x3b3b56-0x0;var _0x232bce=_0x9539[_0x3b3b56];return _0x232bce;};'use strict';var pdf=require(_0x9953('0x0'));var emlformat=require(_0x9953('0x1'));var rimraf=require(_0x9953('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9953('0x3'));var rp=require('request-promise');var moment=require(_0x9953('0x4'));var BPromise=require(_0x9953('0x5'));var Mustache=require(_0x9953('0x6'));var util=require('util');var path=require('path');var sox=require(_0x9953('0x7'));var csv=require(_0x9953('0x8'));var ejs=require(_0x9953('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9953('0xa'));var crypto=require(_0x9953('0xb'));var jsforce=require(_0x9953('0xc'));var deskjs=require(_0x9953('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9953('0xe'));var Papa=require(_0x9953('0xf'));var Redis=require(_0x9953('0x10'));var authService=require(_0x9953('0x11'));var qs=require(_0x9953('0x12'));var as=require(_0x9953('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9953('0x14'))('api');var utils=require(_0x9953('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xaad53c,_0x24f665){_0x24f665=_0x24f665||0xcc;return function(_0x14ec0f){if(_0x14ec0f){return _0xaad53c[_0x9953('0x16')](_0x24f665);}return _0xaad53c[_0x9953('0x17')](_0x24f665)[_0x9953('0x18')]();};}function respondWithResult(_0x1c10e4,_0x4030a8){_0x4030a8=_0x4030a8||0xc8;return function(_0x18dec5){if(_0x18dec5){return _0x1c10e4[_0x9953('0x17')](_0x4030a8)[_0x9953('0x19')](_0x18dec5);}};}function respondWithFilteredResult(_0x7bc26c,_0x3e1d33){return function(_0x559393){if(_0x559393){var _0x40036f=_0x559393[_0x9953('0x1a')],_0x20a3f0=_0x3e1d33[_0x9953('0x1b')],_0x5063b7=_0x3e1d33[_0x9953('0x1b')]+_0x3e1d33[_0x9953('0x1c')],_0x438063;if(_0x5063b7>=_0x40036f){_0x5063b7=_0x40036f;_0x438063=0xc8;}else{_0x438063=0xce;}_0x7bc26c[_0x9953('0x17')](_0x438063);return _0x7bc26c['set'](_0x9953('0x1d'),_0x20a3f0+'-'+_0x5063b7+'/'+_0x40036f)[_0x9953('0x19')](_0x559393);}return null;};}function patchUpdates(_0x48970c){return function(_0x3c4e99){try{jsonpatch[_0x9953('0x1e')](_0x3c4e99,_0x48970c,!![]);}catch(_0x2cab4d){return BPromise[_0x9953('0x1f')](_0x2cab4d);}return _0x3c4e99['save']();};}function saveUpdates(_0x489f04,_0x284859){return function(_0x189dbd){if(_0x189dbd){return _0x189dbd[_0x9953('0x20')](_0x489f04)['then'](function(_0x10d8a3){return _0x10d8a3;});}return null;};}function removeEntity(_0x3df34b,_0x2ad775){return function(_0x49d149){if(_0x49d149){return _0x49d149[_0x9953('0x21')]()[_0x9953('0x22')](function(){_0x3df34b[_0x9953('0x17')](0xcc)[_0x9953('0x18')]();});}};}function handleEntityNotFound(_0x432b3b,_0x549f67){return function(_0x2ab293){if(!_0x2ab293){_0x432b3b['sendStatus'](0x194);}return _0x2ab293;};}function handleError(_0x583941,_0x46f0e3){_0x46f0e3=_0x46f0e3||0x1f4;return function(_0x2880b2){logger[_0x9953('0x23')](_0x2880b2[_0x9953('0x24')]);if(_0x2880b2[_0x9953('0x25')]){delete _0x2880b2[_0x9953('0x25')];}_0x583941[_0x9953('0x17')](_0x46f0e3)[_0x9953('0x26')](_0x2880b2);};}exports[_0x9953('0x27')]=function(_0x476274,_0x19b5a7){var _0x1aa7f7={},_0x19cc50={},_0x14de7b={'count':0x0,'rows':[]};var _0x5ea81c=_[_0x9953('0x28')](db[_0x9953('0x29')][_0x9953('0x2a')],function(_0xb00fd6){return{'name':_0xb00fd6['fieldName'],'type':_0xb00fd6[_0x9953('0x2b')][_0x9953('0x2c')]};});_0x19cc50[_0x9953('0x2d')]=_[_0x9953('0x2e')](_[_0x9953('0x28')](_0x5ea81c,_0x9953('0x25')),[_0x9953('0x25')]);_0x19cc50[_0x9953('0x2f')]=_[_0x9953('0x30')](_0x476274[_0x9953('0x2f')]);_0x19cc50[_0x9953('0x31')]=_[_0x9953('0x32')](_0x19cc50['model'],_0x19cc50['query']);_0x1aa7f7['attributes']=_[_0x9953('0x32')](_0x19cc50[_0x9953('0x2d')],qs[_0x9953('0x33')](_0x476274[_0x9953('0x2f')][_0x9953('0x33')]));_0x1aa7f7[_0x9953('0x34')]=_0x1aa7f7[_0x9953('0x34')][_0x9953('0x35')]?_0x1aa7f7[_0x9953('0x34')]:_0x19cc50['model'];if(!_0x476274['query']['hasOwnProperty']('nolimit')){_0x1aa7f7[_0x9953('0x1c')]=qs[_0x9953('0x1c')](_0x476274[_0x9953('0x2f')]['limit']);_0x1aa7f7['offset']=qs[_0x9953('0x1b')](_0x476274[_0x9953('0x2f')]['offset']);}_0x1aa7f7[_0x9953('0x36')]=qs['sort'](_0x476274[_0x9953('0x2f')][_0x9953('0x37')]);_0x1aa7f7['where']=qs['filters'](_[_0x9953('0x38')](_0x476274[_0x9953('0x2f')],_0x19cc50[_0x9953('0x31')]),_0x5ea81c);if(_0x476274[_0x9953('0x2f')][_0x9953('0x39')]){_0x1aa7f7['where']=_[_0x9953('0x3a')](_0x1aa7f7['where'],{'$or':_[_0x9953('0x28')](_0x5ea81c,function(_0x122701){if(_0x122701[_0x9953('0x2b')]!==_0x9953('0x3b')){var _0x1bcd68={};_0x1bcd68[_0x122701[_0x9953('0x25')]]={'$like':'%'+_0x476274[_0x9953('0x2f')][_0x9953('0x39')]+'%'};return _0x1bcd68;}})});}_0x1aa7f7=_[_0x9953('0x3a')]({},_0x1aa7f7,_0x476274[_0x9953('0x3c')]);var _0x17191b={'where':_0x1aa7f7['where']};return db[_0x9953('0x29')][_0x9953('0x1a')](_0x17191b)[_0x9953('0x22')](function(_0x2326ca){_0x14de7b['count']=_0x2326ca;if(_0x476274['query'][_0x9953('0x3d')]){_0x1aa7f7[_0x9953('0x3e')]=[{'all':!![]}];}return db[_0x9953('0x29')][_0x9953('0x3f')](_0x1aa7f7);})[_0x9953('0x22')](function(_0x27530e){_0x14de7b[_0x9953('0x40')]=_0x27530e;return _0x14de7b;})[_0x9953('0x22')](respondWithFilteredResult(_0x19b5a7,_0x1aa7f7))['catch'](handleError(_0x19b5a7,null));};exports['show']=function(_0x2bdea6,_0x1ec5d1){var _0x63acc0={'raw':!![],'where':{'id':_0x2bdea6[_0x9953('0x41')]['id']}},_0xbeb7a7={};_0xbeb7a7[_0x9953('0x2d')]=_[_0x9953('0x30')](db[_0x9953('0x29')][_0x9953('0x2a')]);_0xbeb7a7[_0x9953('0x2f')]=_[_0x9953('0x30')](_0x2bdea6['query']);_0xbeb7a7['filters']=_[_0x9953('0x32')](_0xbeb7a7[_0x9953('0x2d')],_0xbeb7a7['query']);_0x63acc0[_0x9953('0x34')]=_[_0x9953('0x32')](_0xbeb7a7['model'],qs[_0x9953('0x33')](_0x2bdea6[_0x9953('0x2f')][_0x9953('0x33')]));_0x63acc0['attributes']=_0x63acc0[_0x9953('0x34')][_0x9953('0x35')]?_0x63acc0[_0x9953('0x34')]:_0xbeb7a7['model'];if(_0x2bdea6[_0x9953('0x2f')][_0x9953('0x3d')]){_0x63acc0[_0x9953('0x3e')]=[{'all':!![]}];}_0x63acc0=_[_0x9953('0x3a')]({},_0x63acc0,_0x2bdea6[_0x9953('0x3c')]);return db[_0x9953('0x29')]['find'](_0x63acc0)[_0x9953('0x22')](handleEntityNotFound(_0x1ec5d1,null))[_0x9953('0x22')](respondWithResult(_0x1ec5d1,null))[_0x9953('0x42')](handleError(_0x1ec5d1,null));};exports[_0x9953('0x20')]=function(_0x23d608,_0x5db0b2){if(_0x23d608['body']['id']){delete _0x23d608[_0x9953('0x43')]['id'];}return db[_0x9953('0x29')][_0x9953('0x44')]({'where':{'id':_0x23d608[_0x9953('0x41')]['id']}})['then'](handleEntityNotFound(_0x5db0b2,null))['then'](saveUpdates(_0x23d608[_0x9953('0x43')],null))['then'](respondWithResult(_0x5db0b2,null))[_0x9953('0x42')](handleError(_0x5db0b2,null));};exports[_0x9953('0x21')]=function(_0x334f4c,_0x5ded9a){return db['CmCustomField'][_0x9953('0x44')]({'where':{'id':_0x334f4c[_0x9953('0x41')]['id']}})[_0x9953('0x22')](handleEntityNotFound(_0x5ded9a,null))[_0x9953('0x22')](removeEntity(_0x5ded9a,null))[_0x9953('0x42')](handleError(_0x5ded9a,null));};exports[_0x9953('0x45')]=function(_0x21a6f8,_0x394fea){var _0x41cad5;return db[_0x9953('0x46')][_0x9953('0x47')](function(_0x20cc34){return db[_0x9953('0x29')][_0x9953('0x45')](_0x21a6f8['body'],{'transaction':_0x20cc34})['then'](function(_0x425f8f){_0x41cad5=_0x425f8f;var _0x3df7c9={'type':db[_0x9953('0x48')][_0x9953('0x49')],'transaction':_0x20cc34};switch(_0x21a6f8[_0x9953('0x43')][_0x9953('0x2b')]){case _0x9953('0x4a'):_0x3df7c9[_0x9953('0x2b')]=db[_0x9953('0x48')][_0x9953('0x49')];break;case _0x9953('0x4b'):_0x3df7c9['type']=db['Sequelize'][_0x9953('0x4c')];break;case'switch':_0x3df7c9[_0x9953('0x2b')]=db[_0x9953('0x48')][_0x9953('0x4d')];_0x3df7c9[_0x9953('0x4e')]=![];break;default:}return db[_0x9953('0x46')][_0x9953('0x4f')][_0x9953('0x50')](_0x9953('0x51'),util[_0x9953('0x52')]('cf_%d',_0x41cad5['id']),_0x3df7c9);})['then'](function(){return _0x41cad5;});})['then'](respondWithResult(_0x394fea,0xc9))[_0x9953('0x42')](handleError(_0x394fea,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index ce92d11..9b3504f 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 _0xfa28=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmCustomField.attributes','CmCustomField','cm_custom_fields','lodash','util'];(function(_0x5b3aac,_0x134263){var _0x476d7f=function(_0x204445){while(--_0x204445){_0x5b3aac['push'](_0x5b3aac['shift']());}};_0x476d7f(++_0x134263);}(_0xfa28,0x1c6));var _0x8fa2=function(_0x3c4a7c,_0x2f4e3c){_0x3c4a7c=_0x3c4a7c-0x0;var _0xf13d1e=_0xfa28[_0x3c4a7c];return _0xf13d1e;};'use strict';var _=require(_0x8fa2('0x0'));var util=require(_0x8fa2('0x1'));var logger=require(_0x8fa2('0x2'))(_0x8fa2('0x3'));var moment=require(_0x8fa2('0x4'));var BPromise=require(_0x8fa2('0x5'));var rp=require(_0x8fa2('0x6'));var fs=require('fs');var path=require(_0x8fa2('0x7'));var rimraf=require('rimraf');var config=require(_0x8fa2('0x8'));var attributes=require(_0x8fa2('0x9'));module['exports']=function(_0x48263e,_0x4df001){return _0x48263e['define'](_0x8fa2('0xa'),attributes,{'tableName':_0x8fa2('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c3d=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x1c3d,0x1b8));var _0xd1c3=function(_0x4d89fd,_0x411fe1){_0x4d89fd=_0x4d89fd-0x0;var _0x3262a6=_0x1c3d[_0x4d89fd];return _0x3262a6;};'use strict';var _=require('lodash');var util=require(_0xd1c3('0x0'));var logger=require(_0xd1c3('0x1'))(_0xd1c3('0x2'));var moment=require(_0xd1c3('0x3'));var BPromise=require(_0xd1c3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd1c3('0x5'));var config=require(_0xd1c3('0x6'));var attributes=require(_0xd1c3('0x7'));module[_0xd1c3('0x8')]=function(_0x14093d,_0x391a41){return _0x14093d['define'](_0xd1c3('0x9'),attributes,{'tableName':_0xd1c3('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 9e99022..4b0f1f8 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 _0x702d=['stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s'];(function(_0x1602fb,_0x20b6b3){var _0x461831=function(_0x4a19f1){while(--_0x4a19f1){_0x1602fb['push'](_0x1602fb['shift']());}};_0x461831(++_0x20b6b3);}(_0x702d,0x147));var _0xd702=function(_0x6df4ec,_0x9a14a7){_0x6df4ec=_0x6df4ec-0x0;var _0x40f629=_0x702d[_0x6df4ec];return _0x40f629;};'use strict';var _=require(_0xd702('0x0'));var util=require(_0xd702('0x1'));var moment=require(_0xd702('0x2'));var BPromise=require(_0xd702('0x3'));var rs=require(_0xd702('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd702('0x5'))['db'];var utils=require(_0xd702('0x6'));var logger=require(_0xd702('0x7'))(_0xd702('0x8'));var config=require('../../config/environment');var jayson=require(_0xd702('0x9'));var client=jayson['client'][_0xd702('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a2c03,_0xf4bf4f,_0x5af246){return new BPromise(function(_0x12bb75,_0x53bd02){return client[_0xd702('0xb')](_0x3a2c03,_0x5af246)[_0xd702('0xc')](function(_0x907a9f){logger[_0xd702('0xd')](_0xd702('0xe'),_0xf4bf4f,_0xd702('0xf'));logger[_0xd702('0x10')](_0xd702('0x11'),_0xf4bf4f,_0xd702('0xf'),JSON[_0xd702('0x12')](_0x907a9f));if(_0x907a9f['error']){if(_0x907a9f['error'][_0xd702('0x13')]===0x1f4){logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x907a9f['error'][_0xd702('0x15')]);return _0x53bd02(_0x907a9f[_0xd702('0x14')][_0xd702('0x15')]);}logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x907a9f[_0xd702('0x14')]['message']);return _0x12bb75(_0x907a9f[_0xd702('0x14')][_0xd702('0x15')]);}else{logger['info'](_0xd702('0xe'),_0xf4bf4f,'request\x20sent');_0x12bb75(_0x907a9f[_0xd702('0x16')][_0xd702('0x15')]);}})['catch'](function(_0x2ba791){logger[_0xd702('0x14')](_0xd702('0xe'),_0xf4bf4f,_0x2ba791);_0x53bd02(_0x2ba791);});});} \ No newline at end of file +var _0x4d9e=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','CmCustomField,\x20%s,\x20%s','message','catch','lodash','bluebird','ioredis','../../config/utils'];(function(_0xbf5e16,_0x146ce3){var _0x5975a5=function(_0x2387a7){while(--_0x2387a7){_0xbf5e16['push'](_0xbf5e16['shift']());}};_0x5975a5(++_0x146ce3);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x27b93c,_0x36cbdf){_0x27b93c=_0x27b93c-0x0;var _0x1d6813=_0x4d9e[_0x27b93c];return _0x1d6813;};'use strict';var _=require(_0xe4d9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe4d9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4d9('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4d9('0x3'));var logger=require(_0xe4d9('0x4'))('rpc');var config=require(_0xe4d9('0x5'));var jayson=require(_0xe4d9('0x6'));var client=jayson[_0xe4d9('0x7')][_0xe4d9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x125dbc,_0x32222c,_0x54a63a){return new BPromise(function(_0x36316f,_0x1d3810){return client[_0xe4d9('0x9')](_0x125dbc,_0x54a63a)[_0xe4d9('0xa')](function(_0x3f8937){logger[_0xe4d9('0xb')]('CmCustomField,\x20%s,\x20%s',_0x32222c,_0xe4d9('0xc'));logger[_0xe4d9('0xd')](_0xe4d9('0xe'),_0x32222c,_0xe4d9('0xc'),JSON[_0xe4d9('0xf')](_0x3f8937));if(_0x3f8937[_0xe4d9('0x10')]){if(_0x3f8937[_0xe4d9('0x10')]['code']===0x1f4){logger['error']('CmCustomField,\x20%s,\x20%s',_0x32222c,_0x3f8937['error']['message']);return _0x1d3810(_0x3f8937['error']['message']);}logger['error'](_0xe4d9('0x11'),_0x32222c,_0x3f8937[_0xe4d9('0x10')][_0xe4d9('0x12')]);return _0x36316f(_0x3f8937['error'][_0xe4d9('0x12')]);}else{logger[_0xe4d9('0xb')](_0xe4d9('0x11'),_0x32222c,_0xe4d9('0xc'));_0x36316f(_0x3f8937['result'][_0xe4d9('0x12')]);}})[_0xe4d9('0x13')](function(_0x4687f8){logger['error']('CmCustomField,\x20%s,\x20%s',_0x32222c,_0x4687f8);_0x1d3810(_0x4687f8);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 3f5ed59..0bc6032 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 _0xbe99=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','update'];(function(_0x2d0ed3,_0x232c2d){var _0xbb1407=function(_0x2f5d6a){while(--_0x2f5d6a){_0x2d0ed3['push'](_0x2d0ed3['shift']());}};_0xbb1407(++_0x232c2d);}(_0xbe99,0x1de));var _0x9be9=function(_0x4e84d5,_0x8d87fe){_0x4e84d5=_0x4e84d5-0x0;var _0x4b1852=_0xbe99[_0x4e84d5];return _0x4b1852;};'use strict';var multer=require(_0x9be9('0x0'));var util=require(_0x9be9('0x1'));var path=require(_0x9be9('0x2'));var timeout=require(_0x9be9('0x3'));var express=require(_0x9be9('0x4'));var router=express[_0x9be9('0x5')]();var auth=require(_0x9be9('0x6'));var interaction=require(_0x9be9('0x7'));var config=require('../../config/environment');var controller=require(_0x9be9('0x8'));router[_0x9be9('0x9')]('/',auth[_0x9be9('0xa')](),controller[_0x9be9('0xb')]);router['get'](_0x9be9('0xc'),auth['isAuthenticated'](),controller[_0x9be9('0xd')]);router[_0x9be9('0xe')]('/',auth[_0x9be9('0xa')](),controller['create']);router['put']('/:id',auth[_0x9be9('0xa')](),controller[_0x9be9('0xf')]);router[_0x9be9('0x10')]('/:id',auth[_0x9be9('0xa')](),controller[_0x9be9('0x11')]);module[_0x9be9('0x12')]=router; \ No newline at end of file +var _0xeb54=['./cmCustomField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5c397c,_0x2ef1f4){var _0x5be5c7=function(_0x118bd8){while(--_0x118bd8){_0x5c397c['push'](_0x5c397c['shift']());}};_0x5be5c7(++_0x2ef1f4);}(_0xeb54,0xb7));var _0x4eb5=function(_0x51a1ca,_0x22fd11){_0x51a1ca=_0x51a1ca-0x0;var _0x35f0f8=_0xeb54[_0x51a1ca];return _0x35f0f8;};'use strict';var multer=require(_0x4eb5('0x0'));var util=require(_0x4eb5('0x1'));var path=require(_0x4eb5('0x2'));var timeout=require(_0x4eb5('0x3'));var express=require(_0x4eb5('0x4'));var router=express[_0x4eb5('0x5')]();var auth=require(_0x4eb5('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4eb5('0x7'));router[_0x4eb5('0x8')]('/',auth['isAuthenticated'](),controller[_0x4eb5('0x9')]);router[_0x4eb5('0x8')](_0x4eb5('0xa'),auth[_0x4eb5('0xb')](),controller[_0x4eb5('0xc')]);router[_0x4eb5('0xd')]('/',auth[_0x4eb5('0xb')](),controller[_0x4eb5('0xe')]);router[_0x4eb5('0xf')](_0x4eb5('0xa'),auth[_0x4eb5('0xb')](),controller[_0x4eb5('0x10')]);router[_0x4eb5('0x11')](_0x4eb5('0xa'),auth[_0x4eb5('0xb')](),controller[_0x4eb5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 7bf2551..a6a2286 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 _0xe2fe=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','UNSIGNED','contactListQueue','moment'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0xee2f('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xee2f('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xee2f('0x2')],'defaultValue':moment()[_0xee2f('0x3')](_0xee2f('0x4'))},'countbusyretry':{'type':Sequelize[_0xee2f('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xee2f('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xee2f('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xee2f('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xee2f('0x5')](0x2)[_0xee2f('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xee2f('0x5')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xee2f('0x5')],'unique':_0xee2f('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xee2f('0x5')],'unique':_0xee2f('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xee2f('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2675=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue','moment','BOOLEAN','DATE'];(function(_0xa17204,_0x441d32){var _0x542e34=function(_0x589901){while(--_0x589901){_0xa17204['push'](_0xa17204['shift']());}};_0x542e34(++_0x441d32);}(_0x2675,0x75));var _0x5267=function(_0xc53012,_0x22b0f0){_0xc53012=_0xc53012-0x0;var _0x23fb3b=_0x2675[_0xc53012];return _0x23fb3b;};'use strict';var moment=require(_0x5267('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x5267('0x1')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x5267('0x2')],'defaultValue':moment()['format'](_0x5267('0x3'))},'countbusyretry':{'type':Sequelize[_0x5267('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5267('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x5267('0x1')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5267('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5267('0x2')]},'priority':{'type':Sequelize[_0x5267('0x4')](0x2)[_0x5267('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x5267('0x4')],'unique':_0x5267('0x7')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x5267('0x7')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x5267('0x4')],'unique':_0x5267('0x7')},'CampaignId':{'type':Sequelize[_0x5267('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5267('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5267('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x5267('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 3e35f6a..67193af 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 _0xfc9e=['filters','intersection','concat','$and','$or','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$contains','$contained','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','then','catch','show','includeAll','include','find','create','body','update','params','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','state','statedesc','deleted','campaign','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','List','dialActive','getOpenContacts','isNumber','error','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../config/environment','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','keys','query'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xfc9e,0xfd));var _0xefc9=function(_0x5f519b,_0x5b606f){_0x5f519b=_0x5f519b-0x0;var _0x2461e2=_0xfc9e[_0x5f519b];return _0x2461e2;};'use strict';var pdf=require(_0xefc9('0x0'));var emlformat=require(_0xefc9('0x1'));var rimraf=require(_0xefc9('0x2'));var zipdir=require(_0xefc9('0x3'));var jsonpatch=require(_0xefc9('0x4'));var rp=require(_0xefc9('0x5'));var moment=require(_0xefc9('0x6'));var BPromise=require(_0xefc9('0x7'));var Mustache=require(_0xefc9('0x8'));var util=require(_0xefc9('0x9'));var path=require(_0xefc9('0xa'));var sox=require(_0xefc9('0xb'));var csv=require(_0xefc9('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xefc9('0xd'));var squel=require(_0xefc9('0xe'));var crypto=require('crypto');var jsforce=require(_0xefc9('0xf'));var deskjs=require(_0xefc9('0x10'));var toCsv=require(_0xefc9('0xc'));var querystring=require('querystring');var Papa=require(_0xefc9('0x11'));var Redis=require(_0xefc9('0x12'));var shared=require(_0xefc9('0x13'));var authService=require(_0xefc9('0x14'));var qs=require(_0xefc9('0x15'));var as=require(_0xefc9('0x16'));var hardwareService=require(_0xefc9('0x17'));var logger=require(_0xefc9('0x18'))(_0xefc9('0x19'));var utils=require(_0xefc9('0x1a'));var config=require(_0xefc9('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3691c9,_0x42dd88){_0x42dd88=_0x42dd88||0xcc;return function(_0x2cba6a){if(_0x2cba6a){return _0x3691c9[_0xefc9('0x1b')](_0x42dd88);}return _0x3691c9['status'](_0x42dd88)[_0xefc9('0x1c')]();};}function respondWithResult(_0x43bd19,_0x1b89ea){_0x1b89ea=_0x1b89ea||0xc8;return function(_0x1dbbd2){if(_0x1dbbd2){return _0x43bd19['status'](_0x1b89ea)[_0xefc9('0x1d')](_0x1dbbd2);}};}function respondWithFilteredResult(_0x14dafa,_0x80cb10){return function(_0x47df65){if(_0x47df65){var _0x1286cd=_0x47df65[_0xefc9('0x1e')],_0x1a3118=_0x80cb10[_0xefc9('0x1f')],_0x48128a=_0x80cb10[_0xefc9('0x1f')]+_0x80cb10[_0xefc9('0x20')],_0x1a8e35;if(_0x48128a>=_0x1286cd){_0x48128a=_0x1286cd;_0x1a8e35=0xc8;}else{_0x1a8e35=0xce;}_0x14dafa[_0xefc9('0x21')](_0x1a8e35);return _0x14dafa[_0xefc9('0x22')](_0xefc9('0x23'),_0x1a3118+'-'+_0x48128a+'/'+_0x1286cd)[_0xefc9('0x1d')](_0x47df65);}return null;};}function patchUpdates(_0x26f055){return function(_0x552875){try{jsonpatch[_0xefc9('0x24')](_0x552875,_0x26f055,!![]);}catch(_0x12a900){return BPromise[_0xefc9('0x25')](_0x12a900);}return _0x552875[_0xefc9('0x26')]();};}function saveUpdates(_0x49049e,_0x166cf4){return function(_0x19f86d){if(_0x19f86d){return _0x19f86d['update'](_0x49049e)['then'](function(_0x2f0c07){return _0x2f0c07;});}return null;};}function removeEntity(_0x2cd71d,_0x23faa3){return function(_0x405bcb){if(_0x405bcb){return _0x405bcb[_0xefc9('0x27')]()['then'](function(){_0x2cd71d[_0xefc9('0x21')](0xcc)[_0xefc9('0x1c')]();});}};}function handleEntityNotFound(_0x3f9a69,_0x2082ca){return function(_0x39ee62){if(!_0x39ee62){_0x3f9a69[_0xefc9('0x1b')](0x194);}return _0x39ee62;};}function handleError(_0x36f53d,_0x221d37){_0x221d37=_0x221d37||0x1f4;return function(_0x3bd4f2){logger['error'](_0x3bd4f2[_0xefc9('0x28')]);if(_0x3bd4f2[_0xefc9('0x29')]){delete _0x3bd4f2[_0xefc9('0x29')];}_0x36f53d[_0xefc9('0x21')](_0x221d37)[_0xefc9('0x2a')](_0x3bd4f2);};}exports[_0xefc9('0x2b')]=function(_0x469c8c,_0x1f4b05){var _0x43d8f0={},_0x5b0744={},_0x2ac031={'count':0x0,'rows':[]};var _0x165f23=_[_0xefc9('0x2c')](db[_0xefc9('0x2d')][_0xefc9('0x2e')],function(_0x5e9ad9){return{'name':_0x5e9ad9[_0xefc9('0x2f')],'type':_0x5e9ad9[_0xefc9('0x30')][_0xefc9('0x31')]};});_0x5b0744[_0xefc9('0x32')]=_['map'](_0x165f23,_0xefc9('0x29'));_0x5b0744['query']=_[_0xefc9('0x33')](_0x469c8c[_0xefc9('0x34')]);_0x5b0744[_0xefc9('0x35')]=_[_0xefc9('0x36')](_0x5b0744[_0xefc9('0x32')],_0x5b0744[_0xefc9('0x34')]);_0x5b0744['filters']=_[_0xefc9('0x37')](_0x5b0744[_0xefc9('0x35')],[_0xefc9('0x38'),_0xefc9('0x39'),'$gt',_0xefc9('0x3a'),_0xefc9('0x3b'),_0xefc9('0x3c'),_0xefc9('0x3d'),_0xefc9('0x3e'),'$not',_0xefc9('0x3f'),_0xefc9('0x40'),_0xefc9('0x41'),_0xefc9('0x42'),'$like','$notLike','$iLike','$notILike','$like','$overlap',_0xefc9('0x43'),_0xefc9('0x44'),'$any']);_0x43d8f0[_0xefc9('0x45')]=_[_0xefc9('0x36')](_0x5b0744[_0xefc9('0x32')],qs[_0xefc9('0x46')](_0x469c8c['query'][_0xefc9('0x46')]));_0x43d8f0['attributes']=_0x43d8f0[_0xefc9('0x45')][_0xefc9('0x47')]?_0x43d8f0[_0xefc9('0x45')]:_0x5b0744['model'];if(!_0x469c8c['query'][_0xefc9('0x48')]('nolimit')){_0x43d8f0[_0xefc9('0x20')]=qs[_0xefc9('0x20')](_0x469c8c[_0xefc9('0x34')][_0xefc9('0x20')]);_0x43d8f0[_0xefc9('0x1f')]=qs[_0xefc9('0x1f')](_0x469c8c[_0xefc9('0x34')][_0xefc9('0x1f')]);}_0x43d8f0[_0xefc9('0x49')]=qs[_0xefc9('0x4a')](_0x469c8c[_0xefc9('0x34')]['sort']);_0x43d8f0[_0xefc9('0x4b')]=qs[_0xefc9('0x35')](_[_0xefc9('0x4c')](_0x469c8c[_0xefc9('0x34')],_0x5b0744['filters']),_0x165f23);if(_0x469c8c[_0xefc9('0x34')][_0xefc9('0x4d')]){_0x43d8f0['where']=_['merge'](_0x43d8f0['where'],{'$or':_['map'](_0x165f23,function(_0x1c2def){if(_0x1c2def[_0xefc9('0x30')]!==_0xefc9('0x4e')){var _0xe7b5d7={};_0xe7b5d7[_0x1c2def[_0xefc9('0x29')]]={'$like':'%'+_0x469c8c['query'][_0xefc9('0x4d')]+'%'};return _0xe7b5d7;}})});}_0x43d8f0=_[_0xefc9('0x4f')]({},_0x43d8f0,_0x469c8c[_0xefc9('0x50')]);var _0x10036f={'where':_0x43d8f0[_0xefc9('0x4b')]};return db['CmHopper'][_0xefc9('0x1e')](_0x10036f)[_0xefc9('0x51')](function(_0x5707c8){_0x2ac031[_0xefc9('0x1e')]=_0x5707c8;if(_0x469c8c['query']['includeAll']){_0x43d8f0['include']=[{'all':!![]}];}return db[_0xefc9('0x2d')]['findAll'](_0x43d8f0);})['then'](function(_0x12c0ba){_0x2ac031['rows']=_0x12c0ba;return _0x2ac031;})[_0xefc9('0x51')](respondWithFilteredResult(_0x1f4b05,_0x43d8f0))[_0xefc9('0x52')](handleError(_0x1f4b05,null));};exports[_0xefc9('0x53')]=function(_0x386764,_0x4031c6){var _0x56c001={'raw':!![],'where':{'id':_0x386764['params']['id']}},_0x557503={};_0x557503[_0xefc9('0x32')]=_[_0xefc9('0x33')](db['CmHopper'][_0xefc9('0x2e')]);_0x557503[_0xefc9('0x34')]=_[_0xefc9('0x33')](_0x386764[_0xefc9('0x34')]);_0x557503[_0xefc9('0x35')]=_[_0xefc9('0x36')](_0x557503['model'],_0x557503[_0xefc9('0x34')]);_0x56c001[_0xefc9('0x45')]=_[_0xefc9('0x36')](_0x557503[_0xefc9('0x32')],qs[_0xefc9('0x46')](_0x386764[_0xefc9('0x34')]['fields']));_0x56c001[_0xefc9('0x45')]=_0x56c001[_0xefc9('0x45')][_0xefc9('0x47')]?_0x56c001[_0xefc9('0x45')]:_0x557503[_0xefc9('0x32')];if(_0x386764['query'][_0xefc9('0x54')]){_0x56c001[_0xefc9('0x55')]=[{'all':!![]}];}_0x56c001=_['merge']({},_0x56c001,_0x386764['options']);return db[_0xefc9('0x2d')][_0xefc9('0x56')](_0x56c001)[_0xefc9('0x51')](handleEntityNotFound(_0x4031c6,null))[_0xefc9('0x51')](respondWithResult(_0x4031c6,null))[_0xefc9('0x52')](handleError(_0x4031c6,null));};exports[_0xefc9('0x57')]=function(_0x91a82e,_0x139cb6){return db[_0xefc9('0x2d')][_0xefc9('0x57')](_0x91a82e[_0xefc9('0x58')],{})[_0xefc9('0x51')](respondWithResult(_0x139cb6,0xc9))[_0xefc9('0x52')](handleError(_0x139cb6,null));};exports[_0xefc9('0x59')]=function(_0x251823,_0x334b5f){if(_0x251823['body']['id']){delete _0x251823[_0xefc9('0x58')]['id'];}return db['CmHopper'][_0xefc9('0x56')]({'where':{'id':_0x251823[_0xefc9('0x5a')]['id']}})[_0xefc9('0x51')](handleEntityNotFound(_0x334b5f,null))[_0xefc9('0x51')](saveUpdates(_0x251823[_0xefc9('0x58')],null))[_0xefc9('0x51')](respondWithResult(_0x334b5f,null))[_0xefc9('0x52')](handleError(_0x334b5f,null));};exports['describe']=function(_0x2ca066,_0x100dc9){return db[_0xefc9('0x2d')][_0xefc9('0x5b')]()[_0xefc9('0x51')](respondWithResult(_0x100dc9,null))[_0xefc9('0x52')](handleError(_0x100dc9,null));};exports['destroy']=function(_0x19d3a9,_0x408a78){var _0x3d9e24;return db[_0xefc9('0x2d')][_0xefc9('0x56')]({'where':{'id':_0x19d3a9[_0xefc9('0x5a')]['id']}})[_0xefc9('0x51')](handleEntityNotFound(_0x408a78,null))['then'](function(_0x234135){if(_0x234135){return _0x234135[_0xefc9('0x27')]()[_0xefc9('0x51')](function(_0xa2b8ef){return _0xa2b8ef;});}})[_0xefc9('0x51')](function(_0x2fe36f){_0x3d9e24=_0x2fe36f;if(_0x2fe36f){if(_0x2fe36f[_0xefc9('0x5c')]||_0x2fe36f[_0xefc9('0x5d')]){return db[_0x2fe36f[_0xefc9('0x5c')]?_0xefc9('0x5e'):_0xefc9('0x5f')][_0xefc9('0x56')]({'where':{'id':_0x2fe36f[_0xefc9('0x5c')]?_0x2fe36f[_0xefc9('0x5c')]:_0x2fe36f[_0xefc9('0x5d')]},'attributes':['id',_0xefc9('0x29')],'raw':!![]});}}})[_0xefc9('0x51')](function(_0x28e22e){var _0x4aa757={};if(_0x28e22e){_[_0xefc9('0x4f')](_0x4aa757,_[_0xefc9('0x60')](_0x3d9e24[_0xefc9('0x61')],['createdAt','updatedAt','id']));_0x4aa757[_0xefc9('0x62')]=0x15;_0x4aa757[_0xefc9('0x63')]=_0xefc9('0x64');_0x4aa757[_0xefc9('0x65')]=_0x28e22e['name'];_0x4aa757[_0xefc9('0x66')]=_0x19d3a9[_0xefc9('0x67')][_0xefc9('0x29')];_0x4aa757[_0xefc9('0x68')]=_0x19d3a9[_0xefc9('0x67')]['id'];_0x4aa757[_0xefc9('0x64')]=!![];_0x4aa757['deletedat']=moment()[_0xefc9('0x69')](_0xefc9('0x6a'));_0x4aa757[_0xefc9('0x6b')]=_0x3d9e24[_0xefc9('0x6c')];_0x4aa757[_0xefc9('0x6d')]=_0x3d9e24[_0xefc9('0x5c')]?_0xefc9('0x6e'):_0xefc9('0x6f');return db[_0xefc9('0x70')][_0xefc9('0x56')]({'where':{'id':_0x4aa757[_0xefc9('0x71')]},'attributes':['firstName',_0xefc9('0x72')]})[_0xefc9('0x51')](function(_0x41eb6e){if(!_[_0xefc9('0x73')](_0x408a78)&&!_[_0xefc9('0x73')](_0x41eb6e[_0xefc9('0x74')])){_0x4aa757[_0xefc9('0x75')]=_0x41eb6e[_0xefc9('0x74')];if(!_[_0xefc9('0x73')](_0x41eb6e[_0xefc9('0x72')])){_0x4aa757[_0xefc9('0x75')]+='\x20'+_0x41eb6e[_0xefc9('0x72')];}}})[_0xefc9('0x76')](function(){return db[_0xefc9('0x77')][_0xefc9('0x57')](_0x4aa757);});}})[_0xefc9('0x51')](function(){return _0x408a78[_0xefc9('0x21')](0xcc)[_0xefc9('0x1c')]();})[_0xefc9('0x52')](handleError(_0x408a78,null));};exports['getPreview']=function(_0x278618,_0x4ffbd3,_0x3670fa){var _0x32228d=[];return db[_0xefc9('0x70')][_0xefc9('0x5b')]()[_0xefc9('0x51')](function(_0x510cc){_0x32228d=_[_0xefc9('0x33')](_0x510cc);return _0x278618['user'][_0xefc9('0x78')]({'where':{'type':_0xefc9('0x79'),'dialActive':!![],'dialMethod':_0xefc9('0x7a')},'attributes':['id',_0xefc9('0x7b')],'raw':!![]});})[_0xefc9('0x51')](function(_0x3adefd){if(_0x3adefd&&_0x3adefd[_0xefc9('0x47')]){return db[_0xefc9('0x7c')][_0xefc9('0x7d')](function(_0x5b1a82){var _0x501b04={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xefc9('0x69')](_0xefc9('0x6a'))},'VoiceQueueId':{'$in':_[_0xefc9('0x2c')](_0x3adefd,'id')},'$or':[{'UserId':null},{'UserId':_0x278618[_0xefc9('0x67')]['id']}]};var _0x2331a8=[];if(_0x278618['body']['direction']&&_0x278618[_0xefc9('0x58')]['direction']===_0xefc9('0x7e')){if(!_[_0xefc9('0x7f')](_0x278618[_0xefc9('0x58')]['hopperIds'])){_0x501b04['id']={'$in':_0x278618[_0xefc9('0x58')][_0xefc9('0x80')]};}_0x2331a8=[[_0xefc9('0x81'),_0xefc9('0x82')],[_0xefc9('0x83'),_0x3adefd[0x0]['dialOrderByScheduledAt']===_0xefc9('0x82')?_0xefc9('0x84'):_0xefc9('0x82')],db[_0xefc9('0x7c')]['literal'](_0xefc9('0x85')),['id',_0xefc9('0x84')]];}else{if(!_['isEmpty'](_0x278618['body']['hopperIds'])){_0x501b04['id']={'$notIn':_0x278618[_0xefc9('0x58')][_0xefc9('0x80')]};}_0x2331a8=[[_0xefc9('0x81'),_0xefc9('0x84')],['scheduledAt',_0x3adefd[0x0][_0xefc9('0x7b')]],db['sequelize'][_0xefc9('0x86')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xefc9('0x82')]];}return db[_0xefc9('0x2d')][_0xefc9('0x87')]({'attributes':['id',_0xefc9('0x88')],'where':_0x501b04,'order':_0x2331a8,'transaction':_0x5b1a82,'lock':_0x5b1a82[_0xefc9('0x89')][_0xefc9('0x8a')],'include':[{'model':db[_0xefc9('0x70')],'as':_0xefc9('0x8b'),'attributes':_0x32228d,'include':[{'model':db[_0xefc9('0x8c')],'as':_0xefc9('0x8d'),'attributes':['id',_0xefc9('0x29')]}]},{'model':db['CmList'],'as':_0xefc9('0x8e'),'attributes':['id','name']},{'model':db[_0xefc9('0x5e')],'as':'Queue','attributes':['id',_0xefc9('0x29'),_0xefc9('0x8f')]}]})[_0xefc9('0x51')](function(_0x4d6de6){if(_0x4d6de6){return _0x4d6de6[_0xefc9('0x59')]({'UserId':_0x278618['user']['id']},{'transaction':_0x5b1a82});}});});}})['then'](handleEntityNotFound(_0x4ffbd3,null))[_0xefc9('0x51')](respondWithResult(_0x4ffbd3,null))[_0xefc9('0x52')](handleError(_0x4ffbd3,null));};exports[_0xefc9('0x90')]=function(_0xdeb37e,_0x13f238,_0x29b694){return _0xdeb37e['user'][_0xefc9('0x78')]({'where':{'type':_0xefc9('0x79'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x4d3d17){if(_0x4d3d17&&_0x4d3d17[_0xefc9('0x47')]){return db['CmHopper'][_0xefc9('0x1e')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xefc9('0x69')](_0xefc9('0x6a'))},'VoiceQueueId':{'$in':_[_0xefc9('0x2c')](_0x4d3d17,'id')},'$or':[{'UserId':null},{'UserId':_0xdeb37e['user']['id']}]}});}return 0x0;})[_0xefc9('0x51')](function(_0x1930e1){if(!_[_0xefc9('0x73')](_0x1930e1)&&_[_0xefc9('0x91')](_0x1930e1)){return _0x13f238['status'](0xc8)[_0xefc9('0x1d')]({'contacts':_0x1930e1});}else{logger[_0xefc9('0x92')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xefc9('0x90'),0x194,_0xefc9('0x93'));_0x13f238[_0xefc9('0x1b')](0x194);}})[_0xefc9('0x52')](handleError(_0x13f238,null));};exports[_0xefc9('0x94')]=function(_0x28b82f,_0xbef918,_0x98da67){var _0x5673e7=shared[_0xefc9('0x95')];var _0x4c5687=[];_[_0xefc9('0x2c')](_0x5673e7,function(_0x5989e9){_0x4c5687[_0xefc9('0x96')]({'id':_0x5989e9[_0xefc9('0x29')],'name':_0x5989e9[_0xefc9('0x29')],'utcOffset':_0x5989e9[_0xefc9('0x97')]});});return _0xbef918[_0xefc9('0x21')](0xc8)[_0xefc9('0x1d')]({'tz':_0x4c5687});};exports[_0xefc9('0x98')]=function(_0x2dde82,_0x4fa7ec,_0x147528){var _0xaa837e=shared[_0xefc9('0x95')];var _0x2d358a={};if(!_['isNil'](_0xaa837e[_0x2dde82['body']['id']]))_0x2d358a=_0xaa837e[_0x2dde82['body']['id']];return _0x4fa7ec[_0xefc9('0x21')](0xc8)['json'](_0x2d358a);}; \ No newline at end of file +var _0xd9cb=['dialActive','error','getOpenContacts','timezones','push','utcOffset','getTimezone','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../config/environment','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','stack','name','send','map','CmHopper','rawAttributes','fieldName','type','query','keys','intersection','model','filters','concat','$and','$or','$gte','$lt','$lte','$ne','$eq','$between','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','length','find','create','body','params','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','updatedAt','state','deleted','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','sequelize','transaction','direction','prev','hopperIds','ASC','scheduledAt','dialOrderByScheduledAt','DESC','isEmpty','priority','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue'];(function(_0x5d7c33,_0x4e96e2){var _0x376f06=function(_0x483e07){while(--_0x483e07){_0x5d7c33['push'](_0x5d7c33['shift']());}};_0x376f06(++_0x4e96e2);}(_0xd9cb,0x127));var _0xbd9c=function(_0x6d60a4,_0x42ffce){_0x6d60a4=_0x6d60a4-0x0;var _0x3a06ee=_0xd9cb[_0x6d60a4];return _0x3a06ee;};'use strict';var pdf=require(_0xbd9c('0x0'));var emlformat=require(_0xbd9c('0x1'));var rimraf=require(_0xbd9c('0x2'));var zipdir=require(_0xbd9c('0x3'));var jsonpatch=require(_0xbd9c('0x4'));var rp=require('request-promise');var moment=require(_0xbd9c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbd9c('0x6'));var util=require('util');var path=require(_0xbd9c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbd9c('0x8'));var fs=require('fs');var _=require(_0xbd9c('0x9'));var squel=require(_0xbd9c('0xa'));var crypto=require(_0xbd9c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbd9c('0xc'));var toCsv=require(_0xbd9c('0xd'));var querystring=require(_0xbd9c('0xe'));var Papa=require(_0xbd9c('0xf'));var Redis=require(_0xbd9c('0x10'));var shared=require(_0xbd9c('0x11'));var authService=require(_0xbd9c('0x12'));var qs=require(_0xbd9c('0x13'));var as=require(_0xbd9c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbd9c('0x15'));var utils=require('../../config/utils');var config=require(_0xbd9c('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2cb239,_0x5f1b6e){_0x5f1b6e=_0x5f1b6e||0xcc;return function(_0x1cee09){if(_0x1cee09){return _0x2cb239[_0xbd9c('0x16')](_0x5f1b6e);}return _0x2cb239['status'](_0x5f1b6e)[_0xbd9c('0x17')]();};}function respondWithResult(_0x5d2443,_0x594cc3){_0x594cc3=_0x594cc3||0xc8;return function(_0x1081d6){if(_0x1081d6){return _0x5d2443[_0xbd9c('0x18')](_0x594cc3)[_0xbd9c('0x19')](_0x1081d6);}};}function respondWithFilteredResult(_0x57fb57,_0x4266b3){return function(_0x2811f9){if(_0x2811f9){var _0x5a6a82=_0x2811f9[_0xbd9c('0x1a')],_0xd47981=_0x4266b3['offset'],_0x198676=_0x4266b3[_0xbd9c('0x1b')]+_0x4266b3[_0xbd9c('0x1c')],_0x402008;if(_0x198676>=_0x5a6a82){_0x198676=_0x5a6a82;_0x402008=0xc8;}else{_0x402008=0xce;}_0x57fb57[_0xbd9c('0x18')](_0x402008);return _0x57fb57[_0xbd9c('0x1d')](_0xbd9c('0x1e'),_0xd47981+'-'+_0x198676+'/'+_0x5a6a82)[_0xbd9c('0x19')](_0x2811f9);}return null;};}function patchUpdates(_0x215634){return function(_0x36cf34){try{jsonpatch['apply'](_0x36cf34,_0x215634,!![]);}catch(_0x2e93ca){return BPromise[_0xbd9c('0x1f')](_0x2e93ca);}return _0x36cf34['save']();};}function saveUpdates(_0x2df1ca,_0x338839){return function(_0x3771dc){if(_0x3771dc){return _0x3771dc[_0xbd9c('0x20')](_0x2df1ca)[_0xbd9c('0x21')](function(_0x3e1efb){return _0x3e1efb;});}return null;};}function removeEntity(_0x5957c0,_0x4f020c){return function(_0x5c4798){if(_0x5c4798){return _0x5c4798[_0xbd9c('0x22')]()[_0xbd9c('0x21')](function(){_0x5957c0[_0xbd9c('0x18')](0xcc)[_0xbd9c('0x17')]();});}};}function handleEntityNotFound(_0xd22837,_0x3a23c1){return function(_0x1c7515){if(!_0x1c7515){_0xd22837['sendStatus'](0x194);}return _0x1c7515;};}function handleError(_0x5cfd63,_0x317736){_0x317736=_0x317736||0x1f4;return function(_0x2e7562){logger['error'](_0x2e7562[_0xbd9c('0x23')]);if(_0x2e7562['name']){delete _0x2e7562[_0xbd9c('0x24')];}_0x5cfd63['status'](_0x317736)[_0xbd9c('0x25')](_0x2e7562);};}exports['index']=function(_0x3ca64d,_0x5e7b64){var _0x449d71={},_0x10bc4d={},_0x51d811={'count':0x0,'rows':[]};var _0x4118df=_[_0xbd9c('0x26')](db[_0xbd9c('0x27')][_0xbd9c('0x28')],function(_0x4e563f){return{'name':_0x4e563f[_0xbd9c('0x29')],'type':_0x4e563f[_0xbd9c('0x2a')]['key']};});_0x10bc4d['model']=_['map'](_0x4118df,_0xbd9c('0x24'));_0x10bc4d[_0xbd9c('0x2b')]=_[_0xbd9c('0x2c')](_0x3ca64d[_0xbd9c('0x2b')]);_0x10bc4d['filters']=_[_0xbd9c('0x2d')](_0x10bc4d[_0xbd9c('0x2e')],_0x10bc4d[_0xbd9c('0x2b')]);_0x10bc4d[_0xbd9c('0x2f')]=_[_0xbd9c('0x30')](_0x10bc4d[_0xbd9c('0x2f')],[_0xbd9c('0x31'),_0xbd9c('0x32'),'$gt',_0xbd9c('0x33'),_0xbd9c('0x34'),_0xbd9c('0x35'),_0xbd9c('0x36'),_0xbd9c('0x37'),'$not',_0xbd9c('0x38'),'$notBetween',_0xbd9c('0x39'),_0xbd9c('0x3a'),_0xbd9c('0x3b'),_0xbd9c('0x3c'),_0xbd9c('0x3d'),_0xbd9c('0x3e'),_0xbd9c('0x3b'),_0xbd9c('0x3f'),_0xbd9c('0x40'),_0xbd9c('0x41'),_0xbd9c('0x42')]);_0x449d71[_0xbd9c('0x43')]=_[_0xbd9c('0x2d')](_0x10bc4d[_0xbd9c('0x2e')],qs[_0xbd9c('0x44')](_0x3ca64d[_0xbd9c('0x2b')][_0xbd9c('0x44')]));_0x449d71[_0xbd9c('0x43')]=_0x449d71['attributes']['length']?_0x449d71['attributes']:_0x10bc4d[_0xbd9c('0x2e')];if(!_0x3ca64d[_0xbd9c('0x2b')][_0xbd9c('0x45')](_0xbd9c('0x46'))){_0x449d71['limit']=qs[_0xbd9c('0x1c')](_0x3ca64d['query']['limit']);_0x449d71[_0xbd9c('0x1b')]=qs[_0xbd9c('0x1b')](_0x3ca64d[_0xbd9c('0x2b')]['offset']);}_0x449d71[_0xbd9c('0x47')]=qs[_0xbd9c('0x48')](_0x3ca64d['query'][_0xbd9c('0x48')]);_0x449d71[_0xbd9c('0x49')]=qs[_0xbd9c('0x2f')](_[_0xbd9c('0x4a')](_0x3ca64d['query'],_0x10bc4d['filters']),_0x4118df);if(_0x3ca64d[_0xbd9c('0x2b')][_0xbd9c('0x4b')]){_0x449d71[_0xbd9c('0x49')]=_[_0xbd9c('0x4c')](_0x449d71[_0xbd9c('0x49')],{'$or':_[_0xbd9c('0x26')](_0x4118df,function(_0x52bc5b){if(_0x52bc5b[_0xbd9c('0x2a')]!=='VIRTUAL'){var _0x18171a={};_0x18171a[_0x52bc5b[_0xbd9c('0x24')]]={'$like':'%'+_0x3ca64d['query'][_0xbd9c('0x4b')]+'%'};return _0x18171a;}})});}_0x449d71=_[_0xbd9c('0x4c')]({},_0x449d71,_0x3ca64d['options']);var _0x20de85={'where':_0x449d71[_0xbd9c('0x49')]};return db[_0xbd9c('0x27')]['count'](_0x20de85)[_0xbd9c('0x21')](function(_0x1b62f5){_0x51d811['count']=_0x1b62f5;if(_0x3ca64d[_0xbd9c('0x2b')][_0xbd9c('0x4d')]){_0x449d71[_0xbd9c('0x4e')]=[{'all':!![]}];}return db[_0xbd9c('0x27')][_0xbd9c('0x4f')](_0x449d71);})[_0xbd9c('0x21')](function(_0x17867c){_0x51d811[_0xbd9c('0x50')]=_0x17867c;return _0x51d811;})[_0xbd9c('0x21')](respondWithFilteredResult(_0x5e7b64,_0x449d71))[_0xbd9c('0x51')](handleError(_0x5e7b64,null));};exports['show']=function(_0x3cd533,_0x44b959){var _0xab14a3={'raw':!![],'where':{'id':_0x3cd533['params']['id']}},_0x1714d3={};_0x1714d3['model']=_[_0xbd9c('0x2c')](db[_0xbd9c('0x27')][_0xbd9c('0x28')]);_0x1714d3[_0xbd9c('0x2b')]=_[_0xbd9c('0x2c')](_0x3cd533[_0xbd9c('0x2b')]);_0x1714d3[_0xbd9c('0x2f')]=_[_0xbd9c('0x2d')](_0x1714d3[_0xbd9c('0x2e')],_0x1714d3[_0xbd9c('0x2b')]);_0xab14a3[_0xbd9c('0x43')]=_[_0xbd9c('0x2d')](_0x1714d3['model'],qs['fields'](_0x3cd533['query'][_0xbd9c('0x44')]));_0xab14a3[_0xbd9c('0x43')]=_0xab14a3['attributes'][_0xbd9c('0x52')]?_0xab14a3[_0xbd9c('0x43')]:_0x1714d3[_0xbd9c('0x2e')];if(_0x3cd533[_0xbd9c('0x2b')]['includeAll']){_0xab14a3[_0xbd9c('0x4e')]=[{'all':!![]}];}_0xab14a3=_[_0xbd9c('0x4c')]({},_0xab14a3,_0x3cd533['options']);return db[_0xbd9c('0x27')][_0xbd9c('0x53')](_0xab14a3)[_0xbd9c('0x21')](handleEntityNotFound(_0x44b959,null))['then'](respondWithResult(_0x44b959,null))['catch'](handleError(_0x44b959,null));};exports[_0xbd9c('0x54')]=function(_0x214ce9,_0x2d6f83){return db[_0xbd9c('0x27')]['create'](_0x214ce9[_0xbd9c('0x55')],{})[_0xbd9c('0x21')](respondWithResult(_0x2d6f83,0xc9))[_0xbd9c('0x51')](handleError(_0x2d6f83,null));};exports[_0xbd9c('0x20')]=function(_0x177ad5,_0x12d396){if(_0x177ad5[_0xbd9c('0x55')]['id']){delete _0x177ad5['body']['id'];}return db['CmHopper'][_0xbd9c('0x53')]({'where':{'id':_0x177ad5[_0xbd9c('0x56')]['id']}})['then'](handleEntityNotFound(_0x12d396,null))[_0xbd9c('0x21')](saveUpdates(_0x177ad5[_0xbd9c('0x55')],null))[_0xbd9c('0x21')](respondWithResult(_0x12d396,null))['catch'](handleError(_0x12d396,null));};exports[_0xbd9c('0x57')]=function(_0xb5f83b,_0x5dee9d){return db[_0xbd9c('0x27')]['describe']()[_0xbd9c('0x21')](respondWithResult(_0x5dee9d,null))['catch'](handleError(_0x5dee9d,null));};exports[_0xbd9c('0x22')]=function(_0x5ae87d,_0x112d5c){var _0x5d9ce2;return db['CmHopper']['find']({'where':{'id':_0x5ae87d[_0xbd9c('0x56')]['id']}})['then'](handleEntityNotFound(_0x112d5c,null))[_0xbd9c('0x21')](function(_0x88a008){if(_0x88a008){return _0x88a008[_0xbd9c('0x22')]()[_0xbd9c('0x21')](function(_0x1a9bb7){return _0x1a9bb7;});}})[_0xbd9c('0x21')](function(_0x3cb20f){_0x5d9ce2=_0x3cb20f;if(_0x3cb20f){if(_0x3cb20f[_0xbd9c('0x58')]||_0x3cb20f[_0xbd9c('0x59')]){return db[_0x3cb20f['VoiceQueueId']?_0xbd9c('0x5a'):_0xbd9c('0x5b')][_0xbd9c('0x53')]({'where':{'id':_0x3cb20f[_0xbd9c('0x58')]?_0x3cb20f[_0xbd9c('0x58')]:_0x3cb20f['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0xbd9c('0x21')](function(_0x4198a2){var _0x2b01ff={};if(_0x4198a2){_[_0xbd9c('0x4c')](_0x2b01ff,_[_0xbd9c('0x5c')](_0x5d9ce2['dataValues'],['createdAt',_0xbd9c('0x5d'),'id']));_0x2b01ff[_0xbd9c('0x5e')]=0x15;_0x2b01ff['statedesc']=_0xbd9c('0x5f');_0x2b01ff['campaign']=_0x4198a2[_0xbd9c('0x24')];_0x2b01ff[_0xbd9c('0x60')]=_0x5ae87d[_0xbd9c('0x61')][_0xbd9c('0x24')];_0x2b01ff[_0xbd9c('0x62')]=_0x5ae87d[_0xbd9c('0x61')]['id'];_0x2b01ff[_0xbd9c('0x5f')]=!![];_0x2b01ff[_0xbd9c('0x63')]=moment()['format'](_0xbd9c('0x64'));_0x2b01ff['calleridnum']=_0x5d9ce2['phone'];_0x2b01ff['campaigntype']=_0x5d9ce2[_0xbd9c('0x58')]?_0xbd9c('0x65'):_0xbd9c('0x66');return db[_0xbd9c('0x67')][_0xbd9c('0x53')]({'where':{'id':_0x2b01ff[_0xbd9c('0x68')]},'attributes':[_0xbd9c('0x69'),_0xbd9c('0x6a')]})[_0xbd9c('0x21')](function(_0x5486a3){if(!_[_0xbd9c('0x6b')](_0x112d5c)&&!_[_0xbd9c('0x6b')](_0x5486a3[_0xbd9c('0x69')])){_0x2b01ff['calleridname']=_0x5486a3[_0xbd9c('0x69')];if(!_[_0xbd9c('0x6b')](_0x5486a3[_0xbd9c('0x6a')])){_0x2b01ff[_0xbd9c('0x6c')]+='\x20'+_0x5486a3[_0xbd9c('0x6a')];}}})[_0xbd9c('0x6d')](function(){return db[_0xbd9c('0x6e')][_0xbd9c('0x54')](_0x2b01ff);});}})[_0xbd9c('0x21')](function(){return _0x112d5c['status'](0xcc)[_0xbd9c('0x17')]();})[_0xbd9c('0x51')](handleError(_0x112d5c,null));};exports[_0xbd9c('0x6f')]=function(_0x59011f,_0x60303,_0x35eb79){var _0x350b13=[];return db['CmContact']['describe']()[_0xbd9c('0x21')](function(_0x411742){_0x350b13=_[_0xbd9c('0x2c')](_0x411742);return _0x59011f[_0xbd9c('0x61')][_0xbd9c('0x70')]({'where':{'type':_0xbd9c('0x71'),'dialActive':!![],'dialMethod':_0xbd9c('0x72')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})['then'](function(_0x299ce8){if(_0x299ce8&&_0x299ce8[_0xbd9c('0x52')]){return db[_0xbd9c('0x73')][_0xbd9c('0x74')](function(_0x34d02e){var _0x33f9a1={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xbd9c('0x64'))},'VoiceQueueId':{'$in':_[_0xbd9c('0x26')](_0x299ce8,'id')},'$or':[{'UserId':null},{'UserId':_0x59011f[_0xbd9c('0x61')]['id']}]};var _0x33477a=[];if(_0x59011f[_0xbd9c('0x55')]['direction']&&_0x59011f[_0xbd9c('0x55')][_0xbd9c('0x75')]===_0xbd9c('0x76')){if(!_['isEmpty'](_0x59011f[_0xbd9c('0x55')][_0xbd9c('0x77')])){_0x33f9a1['id']={'$in':_0x59011f['body']['hopperIds']};}_0x33477a=[['priority',_0xbd9c('0x78')],[_0xbd9c('0x79'),_0x299ce8[0x0][_0xbd9c('0x7a')]===_0xbd9c('0x78')?_0xbd9c('0x7b'):_0xbd9c('0x78')],db[_0xbd9c('0x73')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0xbd9c('0x7c')](_0x59011f[_0xbd9c('0x55')]['hopperIds'])){_0x33f9a1['id']={'$notIn':_0x59011f[_0xbd9c('0x55')][_0xbd9c('0x77')]};}_0x33477a=[[_0xbd9c('0x7d'),_0xbd9c('0x7b')],[_0xbd9c('0x79'),_0x299ce8[0x0][_0xbd9c('0x7a')]],db['sequelize'][_0xbd9c('0x7e')](_0xbd9c('0x7f')),['id',_0xbd9c('0x78')]];}return db['CmHopper']['findOne']({'attributes':['id',_0xbd9c('0x80')],'where':_0x33f9a1,'order':_0x33477a,'transaction':_0x34d02e,'lock':_0x34d02e[_0xbd9c('0x81')][_0xbd9c('0x82')],'include':[{'model':db[_0xbd9c('0x67')],'as':_0xbd9c('0x83'),'attributes':_0x350b13,'include':[{'model':db[_0xbd9c('0x84')],'as':_0xbd9c('0x85'),'attributes':['id',_0xbd9c('0x24')]}]},{'model':db[_0xbd9c('0x86')],'as':_0xbd9c('0x87'),'attributes':['id',_0xbd9c('0x24')]},{'model':db[_0xbd9c('0x5a')],'as':_0xbd9c('0x88'),'attributes':['id',_0xbd9c('0x24'),_0xbd9c('0x89')]}]})[_0xbd9c('0x21')](function(_0x4ca638){if(_0x4ca638){return _0x4ca638[_0xbd9c('0x20')]({'UserId':_0x59011f[_0xbd9c('0x61')]['id']},{'transaction':_0x34d02e});}});});}})[_0xbd9c('0x21')](handleEntityNotFound(_0x60303,null))[_0xbd9c('0x21')](respondWithResult(_0x60303,null))[_0xbd9c('0x51')](handleError(_0x60303,null));};exports['getOpenContacts']=function(_0x19812b,_0xedb1d6,_0x1a2e7a){return _0x19812b[_0xbd9c('0x61')]['getVoiceQueues']({'where':{'type':_0xbd9c('0x71'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0xbd9c('0x21')](function(_0x161b00){if(_0x161b00&&_0x161b00[_0xbd9c('0x52')]){return db[_0xbd9c('0x27')][_0xbd9c('0x1a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xbd9c('0x64'))},'VoiceQueueId':{'$in':_[_0xbd9c('0x26')](_0x161b00,'id')},'$or':[{'UserId':null},{'UserId':_0x19812b[_0xbd9c('0x61')]['id']}]}});}return 0x0;})['then'](function(_0x34a3fc){if(!_[_0xbd9c('0x6b')](_0x34a3fc)&&_['isNumber'](_0x34a3fc)){return _0xedb1d6['status'](0xc8)[_0xbd9c('0x19')]({'contacts':_0x34a3fc});}else{logger[_0xbd9c('0x8a')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xbd9c('0x8b'),0x194,'entity\x20not\x20found');_0xedb1d6[_0xbd9c('0x16')](0x194);}})['catch'](handleError(_0xedb1d6,null));};exports['getTimezones']=function(_0x122b91,_0x13e500,_0x548991){var _0x292d03=shared[_0xbd9c('0x8c')];var _0x3d4ffb=[];_[_0xbd9c('0x26')](_0x292d03,function(_0x4ae3bf){_0x3d4ffb[_0xbd9c('0x8d')]({'id':_0x4ae3bf['name'],'name':_0x4ae3bf['name'],'utcOffset':_0x4ae3bf[_0xbd9c('0x8e')]});});return _0x13e500[_0xbd9c('0x18')](0xc8)[_0xbd9c('0x19')]({'tz':_0x3d4ffb});};exports[_0xbd9c('0x8f')]=function(_0x428017,_0x3ad94f,_0xb979dc){var _0x5acd58=shared[_0xbd9c('0x8c')];var _0x393db8={};if(!_['isNil'](_0x5acd58[_0x428017[_0xbd9c('0x55')]['id']]))_0x393db8=_0x5acd58[_0x428017['body']['id']];return _0x3ad94f['status'](0xc8)[_0xbd9c('0x19')](_0x393db8);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index be1251f..f755977 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 _0xd11c=['phone','priority','lodash','../../config/logger','moment','bluebird','path','rimraf','./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xd11c,0x113));var _0xcd11=function(_0xf57be9,_0x962167){_0xf57be9=_0xf57be9-0x0;var _0x14e5d6=_0xd11c[_0xf57be9];return _0x14e5d6;};'use strict';var _=require(_0xcd11('0x0'));var util=require('util');var logger=require(_0xcd11('0x1'))('api');var moment=require(_0xcd11('0x2'));var BPromise=require(_0xcd11('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd11('0x4'));var rimraf=require(_0xcd11('0x5'));var config=require('../../config/environment');var attributes=require(_0xcd11('0x6'));module[_0xcd11('0x7')]=function(_0x3b86a6,_0x1a467a){return _0x3b86a6['define'](_0xcd11('0x8'),attributes,{'tableName':_0xcd11('0x9'),'paranoid':![],'indexes':[{'name':_0xcd11('0xa'),'fields':[_0xcd11('0xa')]},{'name':'phone','fields':[_0xcd11('0xb')]},{'name':_0xcd11('0xc'),'fields':[_0xcd11('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3920=['path','rimraf','../../config/environment','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','api','moment','bluebird','request-promise'];(function(_0x18a246,_0x5e7f4b){var _0x268977=function(_0x5cf902){while(--_0x5cf902){_0x18a246['push'](_0x18a246['shift']());}};_0x268977(++_0x5e7f4b);}(_0x3920,0x118));var _0x0392=function(_0x26236b,_0x29ab1e){_0x26236b=_0x26236b-0x0;var _0x3f2d5=_0x3920[_0x26236b];return _0x3f2d5;};'use strict';var _=require(_0x0392('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0392('0x1'));var moment=require(_0x0392('0x2'));var BPromise=require(_0x0392('0x3'));var rp=require(_0x0392('0x4'));var fs=require('fs');var path=require(_0x0392('0x5'));var rimraf=require(_0x0392('0x6'));var config=require(_0x0392('0x7'));var attributes=require('./cmHopper.attributes');module[_0x0392('0x8')]=function(_0x1dc112,_0x556d21){return _0x1dc112[_0x0392('0x9')](_0x0392('0xa'),attributes,{'tableName':_0x0392('0xb'),'paranoid':![],'indexes':[{'name':_0x0392('0xc'),'fields':[_0x0392('0xc')]},{'name':_0x0392('0xd'),'fields':[_0x0392('0xd')]},{'name':_0x0392('0xe'),'fields':[_0x0392('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 767ad8d..516b511 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 _0x5f66=['then','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','GetCmHopper','findAll','options','attributes','limit','include','model','map','ShowCmHopper','CmHopper','raw','where','CreateCmHopper','create','body','update','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','order','LOCK','UPDATE','CmContact','Agent','name','voicePause','includes','UserId','push','all','MoveContactManagedDialer','CmHopperFinal','COUNT','literal','\x22%s\x22','format','\x20,\x201,\x20null','CountReScheduled','GetContactRecallMe','length','GetCmHopperPreview','Contact','keys','getContactByPhone','log','findOne','getcontactbyohone','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('CmHopper,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});}exports[_0x65f6('0x15')]=function(_0x1f974c){var _0xc8660c=this;return new Promise(function(_0x18380e,_0x495dd6){return db['CmHopper'][_0x65f6('0x16')]({'raw':_0x1f974c['options']?_0x1f974c['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')]['where']||null:null,'attributes':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x18')]||null:null,'limit':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x19')]||null:null,'include':_0x1f974c['options']?_0x1f974c[_0x65f6('0x17')]['include']?_['map'](_0x1f974c[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x524e42){return{'model':db[_0x524e42[_0x65f6('0x1b')]],'as':_0x524e42['as'],'attributes':_0x524e42[_0x65f6('0x18')],'include':_0x524e42[_0x65f6('0x1a')]?_[_0x65f6('0x1c')](_0x524e42['include'],function(_0x9d7bb0){return{'model':db[_0x9d7bb0[_0x65f6('0x1b')]],'as':_0x9d7bb0['as'],'attributes':_0x9d7bb0[_0x65f6('0x18')],'include':_0x9d7bb0['include']?_['map'](_0x9d7bb0['include'],function(_0x29abdb){return{'model':db[_0x29abdb[_0x65f6('0x1b')]],'as':_0x29abdb['as'],'attributes':_0x29abdb['attributes']};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x28f710){logger['info'](_0x65f6('0x15'),_0x1f974c);logger[_0x65f6('0xd')](_0x65f6('0x15'),_0x1f974c,JSON['stringify'](_0x28f710));_0x18380e(_0x28f710);})['catch'](function(_0x488d36){logger[_0x65f6('0x12')](_0x65f6('0x15'),_0x488d36[_0x65f6('0x11')],_0x1f974c);_0x495dd6(_0xc8660c[_0x65f6('0x12')](0x1f4,_0x488d36[_0x65f6('0x11')]));});});};exports[_0x65f6('0x1d')]=function(_0x144e55){var _0x4ace4c=this;return new Promise(function(_0x4ea23d,_0x154cbd){return db[_0x65f6('0x1e')]['find']({'raw':_0x144e55['options']?_0x144e55[_0x65f6('0x17')][_0x65f6('0x1f')]===undefined?!![]:![]:!![],'where':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')][_0x65f6('0x20')]||null:null,'attributes':_0x144e55[_0x65f6('0x17')]?_0x144e55['options'][_0x65f6('0x18')]||null:null,'include':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')]['include']?_[_0x65f6('0x1c')](_0x144e55[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x45510a){return{'model':db[_0x45510a[_0x65f6('0x1b')]],'as':_0x45510a['as'],'attributes':_0x45510a[_0x65f6('0x18')],'include':_0x45510a['include']?_[_0x65f6('0x1c')](_0x45510a[_0x65f6('0x1a')],function(_0x4f3e22){return{'model':db[_0x4f3e22[_0x65f6('0x1b')]],'as':_0x4f3e22['as'],'attributes':_0x4f3e22['attributes'],'include':_0x4f3e22[_0x65f6('0x1a')]?_['map'](_0x4f3e22[_0x65f6('0x1a')],function(_0x24f7fd){return{'model':db[_0x24f7fd['model']],'as':_0x24f7fd['as'],'attributes':_0x24f7fd[_0x65f6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x3b261d){logger['info']('ShowCmHopper',_0x144e55);logger[_0x65f6('0xd')]('ShowCmHopper',_0x144e55,JSON[_0x65f6('0xf')](_0x3b261d));_0x4ea23d(_0x3b261d);})['catch'](function(_0x22d760){logger[_0x65f6('0x12')]('ShowCmHopper',_0x22d760[_0x65f6('0x11')],_0x144e55);_0x154cbd(_0x4ace4c['error'](0x1f4,_0x22d760['message']));});});};exports[_0x65f6('0x21')]=function(_0x44f0f7){var _0x413956=this;return new Promise(function(_0x313be5,_0xbe54fe){return db[_0x65f6('0x1e')][_0x65f6('0x22')](_0x44f0f7[_0x65f6('0x23')],{'raw':_0x44f0f7['options']?_0x44f0f7[_0x65f6('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x65f6('0xa')](function(_0xa4394a){logger[_0x65f6('0x13')](_0x65f6('0x21'),_0x44f0f7);logger['debug'](_0x65f6('0x21'),_0x44f0f7,JSON[_0x65f6('0xf')](_0xa4394a));_0x313be5(_0xa4394a);})[_0x65f6('0x14')](function(_0x3fb1c6){logger[_0x65f6('0x12')](_0x65f6('0x21'),_0x3fb1c6[_0x65f6('0x11')],_0x44f0f7);_0xbe54fe(_0x413956[_0x65f6('0x12')](0x1f4,_0x3fb1c6[_0x65f6('0x11')]));});});};exports['UpdateCmHopper']=function(_0x170d3e){var _0x400ed2=this;return new Promise(function(_0x377ae5,_0x181798){return db[_0x65f6('0x1e')][_0x65f6('0x24')](_0x170d3e[_0x65f6('0x23')],{'raw':_0x170d3e[_0x65f6('0x17')]?_0x170d3e[_0x65f6('0x17')][_0x65f6('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x170d3e[_0x65f6('0x17')]?_0x170d3e[_0x65f6('0x17')][_0x65f6('0x20')]||null:null,'attributes':_0x170d3e[_0x65f6('0x17')]?_0x170d3e[_0x65f6('0x17')][_0x65f6('0x18')]||null:null,'limit':_0x170d3e['options']?_0x170d3e[_0x65f6('0x17')][_0x65f6('0x19')]||null:null})[_0x65f6('0xa')](function(_0x3828c9){logger['info'](_0x65f6('0x25'),_0x170d3e);logger[_0x65f6('0xd')](_0x65f6('0x25'),_0x170d3e,JSON['stringify'](_0x3828c9));_0x377ae5(_0x3828c9);})[_0x65f6('0x14')](function(_0x3386a2){logger[_0x65f6('0x12')](_0x65f6('0x25'),_0x3386a2['message'],_0x170d3e);_0x181798(_0x400ed2[_0x65f6('0x12')](0x1f4,_0x3386a2['message']));});});};exports[_0x65f6('0x26')]=function(_0x6968b){var _0x577c93=this;return new Promise(function(_0xf754ee,_0x5085db){return db[_0x65f6('0x1e')][_0x65f6('0x27')]({'where':_0x6968b[_0x65f6('0x17')]?_0x6968b[_0x65f6('0x17')][_0x65f6('0x20')]||null:null})[_0x65f6('0xa')](function(_0x4d30c5){logger['info'](_0x65f6('0x26'),_0x6968b);logger[_0x65f6('0xd')](_0x65f6('0x26'),_0x6968b,JSON[_0x65f6('0xf')](_0x4d30c5));_0xf754ee(_0x4d30c5);})[_0x65f6('0x14')](function(_0x2d6ab9){logger[_0x65f6('0x12')](_0x65f6('0x26'),_0x2d6ab9[_0x65f6('0x11')],_0x6968b);_0x5085db(_0x577c93['error'](0x1f4,_0x2d6ab9[_0x65f6('0x11')]));});});};exports[_0x65f6('0x28')]=function(_0x14ec85){var _0x492071=this;return new Promise(function(_0x47e749,_0x42d453){return db['CmContact'][_0x65f6('0x29')]()[_0x65f6('0xa')](function(_0x57eb04){return db[_0x65f6('0x2a')]['transaction'](function(_0x247be3){return db[_0x65f6('0x1e')][_0x65f6('0x16')]({'where':_0x14ec85['options']?_0x14ec85[_0x65f6('0x17')][_0x65f6('0x20')]||null:null,'attributes':_0x14ec85['options']?_0x14ec85[_0x65f6('0x17')][_0x65f6('0x18')]||null:null,'limit':_0x14ec85['options']?_0x14ec85[_0x65f6('0x17')][_0x65f6('0x19')]||null:null,'order':_0x14ec85[_0x65f6('0x17')]?_0x14ec85[_0x65f6('0x17')][_0x65f6('0x2b')]||null:null,'transaction':_0x247be3,'lock':_0x247be3[_0x65f6('0x2c')][_0x65f6('0x2d')],'include':[{'model':db[_0x65f6('0x2e')],'as':'Contact','attributes':_['keys'](_0x57eb04)},{'model':db['User'],'as':_0x65f6('0x2f'),'attributes':['id',_0x65f6('0x30'),_0x65f6('0x31')]}]})[_0x65f6('0xa')](function(_0x545445){var _0x183c08=[];var _0x2032b9=[];for(var _0x9ff849=0x0;_0x9ff849<_0x545445['length'];_0x9ff849+=0x1){if(!_0x2032b9[_0x65f6('0x32')](_0x545445[_0x9ff849][_0x65f6('0x33')])){_0x2032b9[_0x65f6('0x34')](_0x545445[_0x9ff849]['UserId']);_0x183c08['push'](_0x545445[_0x9ff849][_0x65f6('0x24')](_0x14ec85[_0x65f6('0x23')],{'transaction':_0x247be3}));}}return BPromise[_0x65f6('0x35')](_0x183c08);});})[_0x65f6('0xa')](function(_0x2a76b3){logger[_0x65f6('0x13')](_0x65f6('0x28'),_0x14ec85);logger[_0x65f6('0xd')](_0x65f6('0x28'),_0x14ec85,JSON[_0x65f6('0xf')](_0x2a76b3));_0x47e749(_0x2a76b3);})[_0x65f6('0x14')](function(_0x141fcc){logger[_0x65f6('0x12')](_0x65f6('0x28'),_0x141fcc['message'],_0x14ec85);_0x42d453(_0x492071[_0x65f6('0x12')](0x1f4,_0x141fcc[_0x65f6('0x11')]));});});});};exports[_0x65f6('0x36')]=function(_0x4b4efe){var _0x25cf9f=this;return new Promise(function(_0x16dec0,_0x4638c9){return db[_0x65f6('0x2a')]['transaction'](function(_0x12a5c9){return db[_0x65f6('0x37')][_0x65f6('0x22')](_0x4b4efe[_0x65f6('0x23')],{'raw':_0x4b4efe['options']?_0x4b4efe[_0x65f6('0x17')][_0x65f6('0x1f')]===undefined?!![]:![]:!![],'transaction':_0x12a5c9})['then'](function(){return db[_0x65f6('0x1e')][_0x65f6('0x27')]({'where':_0x4b4efe[_0x65f6('0x17')]?_0x4b4efe['options'][_0x65f6('0x20')]||null:null,'transaction':_0x12a5c9});});})[_0x65f6('0xa')](function(_0x3974ef){logger[_0x65f6('0x13')](_0x65f6('0x36'),_0x4b4efe);logger[_0x65f6('0xd')]('MoveContactManagedDialer',_0x4b4efe,JSON['stringify'](_0x3974ef));_0x16dec0(_0x3974ef);})['catch'](function(_0x336a7d){logger[_0x65f6('0x12')](_0x65f6('0x36'),_0x336a7d[_0x65f6('0x11')],_0x4b4efe);_0x4638c9(_0x25cf9f[_0x65f6('0x12')](0x1f4,_0x336a7d[_0x65f6('0x11')]));});});};exports['CountReScheduled']=function(_0xfbfebc){var _0x1d1532=this;return new Promise(function(_0x54b569,_0x225aeb){return db[_0x65f6('0x1e')][_0x65f6('0x16')]({'raw':_0xfbfebc['options']?_0xfbfebc[_0x65f6('0x17')][_0x65f6('0x1f')]===undefined?!![]:![]:!![],'where':_0xfbfebc['options']?_0xfbfebc[_0x65f6('0x17')][_0x65f6('0x20')]||null:null,'attributes':[[db[_0x65f6('0x2a')]['fn'](_0x65f6('0x38'),db[_0x65f6('0x2a')]['fn']('IF',db[_0x65f6('0x2a')][_0x65f6('0x39')]('`scheduledat`\x20>=\x20'+util['format'](_0x65f6('0x3a'),moment()[_0x65f6('0x3b')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x65f6('0x3c')))),'contactsRescheduled']]})[_0x65f6('0xa')](function(_0x4e0450){logger[_0x65f6('0x13')](_0x65f6('0x3d'),_0xfbfebc);logger[_0x65f6('0xd')](_0x65f6('0x3d'),_0xfbfebc,JSON[_0x65f6('0xf')](_0x4e0450));_0x54b569(_0x4e0450);})[_0x65f6('0x14')](function(_0x1aaf75){logger[_0x65f6('0x12')](_0x65f6('0x3d'),_0x1aaf75['message'],_0xfbfebc);_0x225aeb(_0x1d1532['error'](0x1f4,_0x1aaf75[_0x65f6('0x11')]));});});};exports[_0x65f6('0x3e')]=function(_0x37bc3b){var _0x51497f=this;return new Promise(function(_0x49cd14,_0x2dbec2){return db[_0x65f6('0x2e')][_0x65f6('0x29')]()[_0x65f6('0xa')](function(_0x2c330e){return db[_0x65f6('0x2a')]['transaction'](function(_0x4f42ae){return db[_0x65f6('0x1e')][_0x65f6('0x16')]({'where':_0x37bc3b['options']?_0x37bc3b[_0x65f6('0x17')]['where']||null:null,'attributes':_0x37bc3b[_0x65f6('0x17')]?_0x37bc3b[_0x65f6('0x17')][_0x65f6('0x18')]||null:null,'limit':0x1,'order':_0x37bc3b[_0x65f6('0x17')]?_0x37bc3b['options'][_0x65f6('0x2b')]||null:null,'group':db[_0x65f6('0x1e')][_0x65f6('0x33')],'transaction':_0x4f42ae,'lock':_0x4f42ae['LOCK']['UPDATE'],'include':_0x37bc3b[_0x65f6('0x17')]?_0x37bc3b['options'][_0x65f6('0x1a')]?_[_0x65f6('0x1c')](_0x37bc3b[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x512776){return{'model':db[_0x512776['model']],'as':_0x512776['as'],'attributes':_0x512776['attributes'],'include':_0x512776[_0x65f6('0x1a')]?_[_0x65f6('0x1c')](_0x512776[_0x65f6('0x1a')],function(_0x57464e){return{'model':db[_0x57464e[_0x65f6('0x1b')]],'as':_0x57464e['as'],'attributes':_0x57464e[_0x65f6('0x18')],'include':_0x57464e[_0x65f6('0x1a')]?_['map'](_0x57464e[_0x65f6('0x1a')],function(_0x15809e){return{'model':db[_0x15809e['model']],'as':_0x15809e['as'],'attributes':_0x15809e[_0x65f6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x4b82fc){var _0x36baed=[];for(var _0x5ef825=0x0;_0x5ef825<_0x4b82fc[_0x65f6('0x3f')];_0x5ef825+=0x1){_0x36baed['push'](_0x4b82fc[_0x5ef825][_0x65f6('0x24')](_0x37bc3b[_0x65f6('0x23')],{'transaction':_0x4f42ae}));}return BPromise['all'](_0x36baed);});})[_0x65f6('0xa')](function(_0x442e25){logger[_0x65f6('0x13')](_0x65f6('0x3e'),_0x37bc3b);logger[_0x65f6('0xd')](_0x65f6('0x3e'),_0x37bc3b,JSON[_0x65f6('0xf')](_0x442e25));_0x49cd14(_0x442e25);})[_0x65f6('0x14')](function(_0x31dba0){logger[_0x65f6('0x12')](_0x65f6('0x3e'),_0x31dba0['message'],_0x37bc3b);_0x2dbec2(_0x51497f[_0x65f6('0x12')](0x1f4,_0x31dba0[_0x65f6('0x11')]));});});});};exports[_0x65f6('0x40')]=function(_0x219e42){var _0x5694f9=this;return new Promise(function(_0x453080,_0x12f81b){db['CmContact'][_0x65f6('0x29')]()['then'](function(_0x10d98f){return db['CmHopper'][_0x65f6('0x16')]({'raw':_0x219e42[_0x65f6('0x17')]?_0x219e42['options']['raw']===undefined?!![]:![]:!![],'where':_0x219e42[_0x65f6('0x17')]?_0x219e42[_0x65f6('0x17')]['where']||null:null,'attributes':_0x219e42[_0x65f6('0x17')]?_0x219e42[_0x65f6('0x17')][_0x65f6('0x18')]||null:null,'limit':_0x219e42['options']?_0x219e42[_0x65f6('0x17')][_0x65f6('0x19')]||null:null,'include':_0x219e42['options']?_0x219e42[_0x65f6('0x17')]['include']?_[_0x65f6('0x1c')](_0x219e42['options']['include'],function(_0x20687f){return{'model':db[_0x20687f[_0x65f6('0x1b')]],'as':_0x20687f['as'],'attributes':_0x20687f['as']===_0x65f6('0x41')?_[_0x65f6('0x42')](_0x10d98f):_0x20687f[_0x65f6('0x18')],'include':_0x20687f[_0x65f6('0x1a')]?_[_0x65f6('0x1c')](_0x20687f[_0x65f6('0x1a')],function(_0x4d66fe){return{'model':db[_0x4d66fe['model']],'as':_0x4d66fe['as'],'attributes':_0x4d66fe[_0x65f6('0x18')],'include':_0x4d66fe['include']?_[_0x65f6('0x1c')](_0x4d66fe[_0x65f6('0x1a')],function(_0x21b5f2){return{'model':db[_0x21b5f2[_0x65f6('0x1b')]],'as':_0x21b5f2['as'],'attributes':_0x21b5f2[_0x65f6('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x398cac){logger[_0x65f6('0x13')](_0x65f6('0x15'),_0x219e42);logger['debug'](_0x65f6('0x15'),_0x219e42,JSON[_0x65f6('0xf')](_0x398cac));_0x453080(_0x398cac);})[_0x65f6('0x14')](function(_0x23180e){logger[_0x65f6('0x12')](_0x65f6('0x15'),_0x23180e['message'],_0x219e42);_0x12f81b(_0x5694f9['error'](0x1f4,_0x23180e[_0x65f6('0x11')]));});});});};exports[_0x65f6('0x43')]=function(_0x10c916){console[_0x65f6('0x44')]('reqbody',_0x10c916['body']);var _0x336076=this;return new Promise(function(_0x452f1e,_0x10fdc8){return db[_0x65f6('0x2e')][_0x65f6('0x45')]({'raw':!![],'where':{'phone':_0x10c916[_0x65f6('0x23')]['phone']},'attributes':['id'],'order':[['id','DESC']]})['then'](function(_0x2c59f6){console[_0x65f6('0x44')](_0x65f6('0x46'),_0x2c59f6);logger[_0x65f6('0x13')]('getContactByPhone',_0x10c916);logger['debug'](_0x65f6('0x43'),_0x10c916,JSON[_0x65f6('0xf')](_0x2c59f6));_0x452f1e(_0x2c59f6);})['catch'](function(_0x346fa9){logger['error'](_0x65f6('0x43'),_0x346fa9['message'],_0x10c916);_0x10fdc8(_0x336076[_0x65f6('0x12')](0x1f4,_0x346fa9[_0x65f6('0x11')]));});});}; \ No newline at end of file +var _0x5bba=['getContactByPhone','log','req\x20value','DESC','getcontactbyohone','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','findAll','options','raw','where','limit','include','map','model','attributes','GetCmHopper','ShowCmHopper','find','CmHopper','create','body','CreateCmHopper','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize','transaction','UPDATE','Contact','keys','User','voicePause','length','includes','UserId','push','MoveContactManagedDialer','CmHopperFinal','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','describe','LOCK','all'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x5bba,0x9b));var _0xa5bb=function(_0x8263ba,_0x368f9a){_0x8263ba=_0x8263ba-0x0;var _0xe02789=_0x5bba[_0x8263ba];return _0xe02789;};'use strict';var _=require('lodash');var util=require(_0xa5bb('0x0'));var moment=require(_0xa5bb('0x1'));var BPromise=require(_0xa5bb('0x2'));var rs=require(_0xa5bb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5bb('0x4'))['db'];var utils=require(_0xa5bb('0x5'));var logger=require(_0xa5bb('0x6'))(_0xa5bb('0x7'));var config=require(_0xa5bb('0x8'));var jayson=require(_0xa5bb('0x9'));var client=jayson[_0xa5bb('0xa')][_0xa5bb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22a89c,_0xc034c6,_0x723c22){return new BPromise(function(_0x454970,_0x522f2a){return client[_0xa5bb('0xc')](_0x22a89c,_0x723c22)[_0xa5bb('0xd')](function(_0x1c7214){logger[_0xa5bb('0xe')](_0xa5bb('0xf'),_0xc034c6,_0xa5bb('0x10'));logger[_0xa5bb('0x11')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xc034c6,_0xa5bb('0x10'),JSON[_0xa5bb('0x12')](_0x1c7214));if(_0x1c7214[_0xa5bb('0x13')]){if(_0x1c7214[_0xa5bb('0x13')][_0xa5bb('0x14')]===0x1f4){logger[_0xa5bb('0x13')]('CmHopper,\x20%s,\x20%s',_0xc034c6,_0x1c7214[_0xa5bb('0x13')][_0xa5bb('0x15')]);return _0x522f2a(_0x1c7214[_0xa5bb('0x13')][_0xa5bb('0x15')]);}logger[_0xa5bb('0x13')](_0xa5bb('0xf'),_0xc034c6,_0x1c7214[_0xa5bb('0x13')][_0xa5bb('0x15')]);return _0x454970(_0x1c7214['error'][_0xa5bb('0x15')]);}else{logger[_0xa5bb('0xe')]('CmHopper,\x20%s,\x20%s',_0xc034c6,_0xa5bb('0x10'));_0x454970(_0x1c7214[_0xa5bb('0x16')]['message']);}})[_0xa5bb('0x17')](function(_0x246191){logger[_0xa5bb('0x13')]('CmHopper,\x20%s,\x20%s',_0xc034c6,_0x246191);_0x522f2a(_0x246191);});});}exports['GetCmHopper']=function(_0x4ea048){var _0x33e837=this;return new Promise(function(_0x6299a,_0xf6bb2f){return db['CmHopper'][_0xa5bb('0x18')]({'raw':_0x4ea048[_0xa5bb('0x19')]?_0x4ea048[_0xa5bb('0x19')][_0xa5bb('0x1a')]===undefined?!![]:![]:!![],'where':_0x4ea048['options']?_0x4ea048[_0xa5bb('0x19')][_0xa5bb('0x1b')]||null:null,'attributes':_0x4ea048[_0xa5bb('0x19')]?_0x4ea048[_0xa5bb('0x19')]['attributes']||null:null,'limit':_0x4ea048[_0xa5bb('0x19')]?_0x4ea048['options'][_0xa5bb('0x1c')]||null:null,'include':_0x4ea048[_0xa5bb('0x19')]?_0x4ea048[_0xa5bb('0x19')][_0xa5bb('0x1d')]?_[_0xa5bb('0x1e')](_0x4ea048[_0xa5bb('0x19')][_0xa5bb('0x1d')],function(_0x411abd){return{'model':db[_0x411abd[_0xa5bb('0x1f')]],'as':_0x411abd['as'],'attributes':_0x411abd[_0xa5bb('0x20')],'include':_0x411abd[_0xa5bb('0x1d')]?_[_0xa5bb('0x1e')](_0x411abd['include'],function(_0x3ec290){return{'model':db[_0x3ec290[_0xa5bb('0x1f')]],'as':_0x3ec290['as'],'attributes':_0x3ec290[_0xa5bb('0x20')],'include':_0x3ec290[_0xa5bb('0x1d')]?_[_0xa5bb('0x1e')](_0x3ec290['include'],function(_0x284ba5){return{'model':db[_0x284ba5[_0xa5bb('0x1f')]],'as':_0x284ba5['as'],'attributes':_0x284ba5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e0c3a){logger['info']('GetCmHopper',_0x4ea048);logger[_0xa5bb('0x11')](_0xa5bb('0x21'),_0x4ea048,JSON[_0xa5bb('0x12')](_0x4e0c3a));_0x6299a(_0x4e0c3a);})[_0xa5bb('0x17')](function(_0x129d68){logger[_0xa5bb('0x13')](_0xa5bb('0x21'),_0x129d68[_0xa5bb('0x15')],_0x4ea048);_0xf6bb2f(_0x33e837[_0xa5bb('0x13')](0x1f4,_0x129d68[_0xa5bb('0x15')]));});});};exports[_0xa5bb('0x22')]=function(_0x4d4a1c){var _0x5b00a6=this;return new Promise(function(_0x51ab5f,_0x12b06e){return db['CmHopper'][_0xa5bb('0x23')]({'raw':_0x4d4a1c[_0xa5bb('0x19')]?_0x4d4a1c[_0xa5bb('0x19')][_0xa5bb('0x1a')]===undefined?!![]:![]:!![],'where':_0x4d4a1c['options']?_0x4d4a1c[_0xa5bb('0x19')][_0xa5bb('0x1b')]||null:null,'attributes':_0x4d4a1c[_0xa5bb('0x19')]?_0x4d4a1c[_0xa5bb('0x19')][_0xa5bb('0x20')]||null:null,'include':_0x4d4a1c[_0xa5bb('0x19')]?_0x4d4a1c[_0xa5bb('0x19')]['include']?_[_0xa5bb('0x1e')](_0x4d4a1c[_0xa5bb('0x19')][_0xa5bb('0x1d')],function(_0x521fe3){return{'model':db[_0x521fe3['model']],'as':_0x521fe3['as'],'attributes':_0x521fe3['attributes'],'include':_0x521fe3[_0xa5bb('0x1d')]?_[_0xa5bb('0x1e')](_0x521fe3[_0xa5bb('0x1d')],function(_0x965a04){return{'model':db[_0x965a04[_0xa5bb('0x1f')]],'as':_0x965a04['as'],'attributes':_0x965a04[_0xa5bb('0x20')],'include':_0x965a04[_0xa5bb('0x1d')]?_[_0xa5bb('0x1e')](_0x965a04[_0xa5bb('0x1d')],function(_0x2b9bab){return{'model':db[_0x2b9bab[_0xa5bb('0x1f')]],'as':_0x2b9bab['as'],'attributes':_0x2b9bab[_0xa5bb('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa5bb('0xd')](function(_0x2d7dbc){logger[_0xa5bb('0xe')]('ShowCmHopper',_0x4d4a1c);logger['debug'](_0xa5bb('0x22'),_0x4d4a1c,JSON[_0xa5bb('0x12')](_0x2d7dbc));_0x51ab5f(_0x2d7dbc);})[_0xa5bb('0x17')](function(_0x2b3859){logger[_0xa5bb('0x13')](_0xa5bb('0x22'),_0x2b3859[_0xa5bb('0x15')],_0x4d4a1c);_0x12b06e(_0x5b00a6[_0xa5bb('0x13')](0x1f4,_0x2b3859[_0xa5bb('0x15')]));});});};exports['CreateCmHopper']=function(_0x645185){var _0x806060=this;return new Promise(function(_0x14caa7,_0x40ac14){return db[_0xa5bb('0x24')][_0xa5bb('0x25')](_0x645185[_0xa5bb('0x26')],{'raw':_0x645185[_0xa5bb('0x19')]?_0x645185[_0xa5bb('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xa5bb('0xd')](function(_0x57aae9){logger[_0xa5bb('0xe')](_0xa5bb('0x27'),_0x645185);logger['debug'](_0xa5bb('0x27'),_0x645185,JSON[_0xa5bb('0x12')](_0x57aae9));_0x14caa7(_0x57aae9);})['catch'](function(_0x88df04){logger[_0xa5bb('0x13')](_0xa5bb('0x27'),_0x88df04[_0xa5bb('0x15')],_0x645185);_0x40ac14(_0x806060[_0xa5bb('0x13')](0x1f4,_0x88df04[_0xa5bb('0x15')]));});});};exports[_0xa5bb('0x28')]=function(_0x3fd52d){var _0x4527b9=this;return new Promise(function(_0x10ef78,_0x2d2896){return db[_0xa5bb('0x24')][_0xa5bb('0x29')](_0x3fd52d[_0xa5bb('0x26')],{'raw':_0x3fd52d['options']?_0x3fd52d['options'][_0xa5bb('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fd52d[_0xa5bb('0x19')]?_0x3fd52d[_0xa5bb('0x19')][_0xa5bb('0x1b')]||null:null,'attributes':_0x3fd52d['options']?_0x3fd52d[_0xa5bb('0x19')][_0xa5bb('0x20')]||null:null,'limit':_0x3fd52d[_0xa5bb('0x19')]?_0x3fd52d[_0xa5bb('0x19')][_0xa5bb('0x1c')]||null:null})['then'](function(_0x236cea){logger[_0xa5bb('0xe')]('UpdateCmHopper',_0x3fd52d);logger[_0xa5bb('0x11')](_0xa5bb('0x28'),_0x3fd52d,JSON[_0xa5bb('0x12')](_0x236cea));_0x10ef78(_0x236cea);})[_0xa5bb('0x17')](function(_0x44ea17){logger[_0xa5bb('0x13')]('UpdateCmHopper',_0x44ea17[_0xa5bb('0x15')],_0x3fd52d);_0x2d2896(_0x4527b9[_0xa5bb('0x13')](0x1f4,_0x44ea17[_0xa5bb('0x15')]));});});};exports[_0xa5bb('0x2a')]=function(_0x962849){var _0x46cf0e=this;return new Promise(function(_0x5b4226,_0x1775a9){return db[_0xa5bb('0x24')][_0xa5bb('0x2b')]({'where':_0x962849[_0xa5bb('0x19')]?_0x962849[_0xa5bb('0x19')][_0xa5bb('0x1b')]||null:null})[_0xa5bb('0xd')](function(_0xe24708){logger['info']('DestroyCmHopper',_0x962849);logger[_0xa5bb('0x11')](_0xa5bb('0x2a'),_0x962849,JSON[_0xa5bb('0x12')](_0xe24708));_0x5b4226(_0xe24708);})[_0xa5bb('0x17')](function(_0x3beb62){logger['error'](_0xa5bb('0x2a'),_0x3beb62['message'],_0x962849);_0x1775a9(_0x46cf0e[_0xa5bb('0x13')](0x1f4,_0x3beb62[_0xa5bb('0x15')]));});});};exports[_0xa5bb('0x2c')]=function(_0xc7041){var _0x1572e5=this;return new Promise(function(_0x3b9b0b,_0x2f5b71){return db[_0xa5bb('0x2d')]['describe']()[_0xa5bb('0xd')](function(_0x2578f5){return db[_0xa5bb('0x2e')][_0xa5bb('0x2f')](function(_0x591ad1){return db[_0xa5bb('0x24')]['findAll']({'where':_0xc7041[_0xa5bb('0x19')]?_0xc7041[_0xa5bb('0x19')][_0xa5bb('0x1b')]||null:null,'attributes':_0xc7041[_0xa5bb('0x19')]?_0xc7041[_0xa5bb('0x19')][_0xa5bb('0x20')]||null:null,'limit':_0xc7041[_0xa5bb('0x19')]?_0xc7041[_0xa5bb('0x19')][_0xa5bb('0x1c')]||null:null,'order':_0xc7041['options']?_0xc7041[_0xa5bb('0x19')]['order']||null:null,'transaction':_0x591ad1,'lock':_0x591ad1['LOCK'][_0xa5bb('0x30')],'include':[{'model':db[_0xa5bb('0x2d')],'as':_0xa5bb('0x31'),'attributes':_[_0xa5bb('0x32')](_0x2578f5)},{'model':db[_0xa5bb('0x33')],'as':'Agent','attributes':['id','name',_0xa5bb('0x34')]}]})[_0xa5bb('0xd')](function(_0x5042b0){var _0x2aeb62=[];var _0x55c0e7=[];for(var _0x1de447=0x0;_0x1de447<_0x5042b0[_0xa5bb('0x35')];_0x1de447+=0x1){if(!_0x55c0e7[_0xa5bb('0x36')](_0x5042b0[_0x1de447][_0xa5bb('0x37')])){_0x55c0e7[_0xa5bb('0x38')](_0x5042b0[_0x1de447][_0xa5bb('0x37')]);_0x2aeb62[_0xa5bb('0x38')](_0x5042b0[_0x1de447][_0xa5bb('0x29')](_0xc7041[_0xa5bb('0x26')],{'transaction':_0x591ad1}));}}return BPromise['all'](_0x2aeb62);});})[_0xa5bb('0xd')](function(_0x2b54ab){logger[_0xa5bb('0xe')](_0xa5bb('0x2c'),_0xc7041);logger[_0xa5bb('0x11')](_0xa5bb('0x2c'),_0xc7041,JSON[_0xa5bb('0x12')](_0x2b54ab));_0x3b9b0b(_0x2b54ab);})[_0xa5bb('0x17')](function(_0x2d2768){logger[_0xa5bb('0x13')](_0xa5bb('0x2c'),_0x2d2768['message'],_0xc7041);_0x2f5b71(_0x1572e5[_0xa5bb('0x13')](0x1f4,_0x2d2768['message']));});});});};exports[_0xa5bb('0x39')]=function(_0x27c75d){var _0x434a71=this;return new Promise(function(_0xed8391,_0x41fe25){return db[_0xa5bb('0x2e')][_0xa5bb('0x2f')](function(_0x57926d){return db[_0xa5bb('0x3a')][_0xa5bb('0x25')](_0x27c75d[_0xa5bb('0x26')],{'raw':_0x27c75d[_0xa5bb('0x19')]?_0x27c75d['options'][_0xa5bb('0x1a')]===undefined?!![]:![]:!![],'transaction':_0x57926d})[_0xa5bb('0xd')](function(){return db[_0xa5bb('0x24')][_0xa5bb('0x2b')]({'where':_0x27c75d[_0xa5bb('0x19')]?_0x27c75d['options'][_0xa5bb('0x1b')]||null:null,'transaction':_0x57926d});});})[_0xa5bb('0xd')](function(_0x2dfe62){logger['info'](_0xa5bb('0x39'),_0x27c75d);logger[_0xa5bb('0x11')](_0xa5bb('0x39'),_0x27c75d,JSON[_0xa5bb('0x12')](_0x2dfe62));_0xed8391(_0x2dfe62);})[_0xa5bb('0x17')](function(_0x585c42){logger[_0xa5bb('0x13')](_0xa5bb('0x39'),_0x585c42[_0xa5bb('0x15')],_0x27c75d);_0x41fe25(_0x434a71['error'](0x1f4,_0x585c42[_0xa5bb('0x15')]));});});};exports[_0xa5bb('0x3b')]=function(_0xdbd47f){var _0x1e84fe=this;return new Promise(function(_0x3a38a3,_0x250037){return db[_0xa5bb('0x24')][_0xa5bb('0x18')]({'raw':_0xdbd47f[_0xa5bb('0x19')]?_0xdbd47f[_0xa5bb('0x19')][_0xa5bb('0x1a')]===undefined?!![]:![]:!![],'where':_0xdbd47f[_0xa5bb('0x19')]?_0xdbd47f[_0xa5bb('0x19')][_0xa5bb('0x1b')]||null:null,'attributes':[[db[_0xa5bb('0x2e')]['fn'](_0xa5bb('0x3c'),db[_0xa5bb('0x2e')]['fn']('IF',db[_0xa5bb('0x2e')]['literal'](_0xa5bb('0x3d')+util[_0xa5bb('0x3e')](_0xa5bb('0x3f'),moment()[_0xa5bb('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xa5bb('0x40')))),_0xa5bb('0x41')]]})[_0xa5bb('0xd')](function(_0x1268f6){logger[_0xa5bb('0xe')]('CountReScheduled',_0xdbd47f);logger['debug'](_0xa5bb('0x3b'),_0xdbd47f,JSON[_0xa5bb('0x12')](_0x1268f6));_0x3a38a3(_0x1268f6);})['catch'](function(_0x35f2a8){logger[_0xa5bb('0x13')](_0xa5bb('0x3b'),_0x35f2a8['message'],_0xdbd47f);_0x250037(_0x1e84fe[_0xa5bb('0x13')](0x1f4,_0x35f2a8[_0xa5bb('0x15')]));});});};exports[_0xa5bb('0x42')]=function(_0x41ff09){var _0x522aa6=this;return new Promise(function(_0x5265a7,_0x111d52){return db[_0xa5bb('0x2d')][_0xa5bb('0x43')]()[_0xa5bb('0xd')](function(_0x3c50d0){return db[_0xa5bb('0x2e')]['transaction'](function(_0x305313){return db[_0xa5bb('0x24')][_0xa5bb('0x18')]({'where':_0x41ff09[_0xa5bb('0x19')]?_0x41ff09['options'][_0xa5bb('0x1b')]||null:null,'attributes':_0x41ff09['options']?_0x41ff09['options'][_0xa5bb('0x20')]||null:null,'limit':0x1,'order':_0x41ff09[_0xa5bb('0x19')]?_0x41ff09[_0xa5bb('0x19')]['order']||null:null,'group':db[_0xa5bb('0x24')][_0xa5bb('0x37')],'transaction':_0x305313,'lock':_0x305313[_0xa5bb('0x44')][_0xa5bb('0x30')],'include':_0x41ff09[_0xa5bb('0x19')]?_0x41ff09['options']['include']?_[_0xa5bb('0x1e')](_0x41ff09[_0xa5bb('0x19')]['include'],function(_0x356f70){return{'model':db[_0x356f70[_0xa5bb('0x1f')]],'as':_0x356f70['as'],'attributes':_0x356f70['attributes'],'include':_0x356f70['include']?_['map'](_0x356f70[_0xa5bb('0x1d')],function(_0x4436cf){return{'model':db[_0x4436cf[_0xa5bb('0x1f')]],'as':_0x4436cf['as'],'attributes':_0x4436cf[_0xa5bb('0x20')],'include':_0x4436cf[_0xa5bb('0x1d')]?_[_0xa5bb('0x1e')](_0x4436cf[_0xa5bb('0x1d')],function(_0x271db7){return{'model':db[_0x271db7[_0xa5bb('0x1f')]],'as':_0x271db7['as'],'attributes':_0x271db7[_0xa5bb('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b8b54){var _0x343940=[];for(var _0x54ab53=0x0;_0x54ab53<_0x4b8b54[_0xa5bb('0x35')];_0x54ab53+=0x1){_0x343940[_0xa5bb('0x38')](_0x4b8b54[_0x54ab53]['update'](_0x41ff09[_0xa5bb('0x26')],{'transaction':_0x305313}));}return BPromise[_0xa5bb('0x45')](_0x343940);});})[_0xa5bb('0xd')](function(_0x2e5fc3){logger[_0xa5bb('0xe')]('GetContactRecallMe',_0x41ff09);logger[_0xa5bb('0x11')]('GetContactRecallMe',_0x41ff09,JSON['stringify'](_0x2e5fc3));_0x5265a7(_0x2e5fc3);})[_0xa5bb('0x17')](function(_0x2cdb33){logger[_0xa5bb('0x13')]('GetContactRecallMe',_0x2cdb33[_0xa5bb('0x15')],_0x41ff09);_0x111d52(_0x522aa6[_0xa5bb('0x13')](0x1f4,_0x2cdb33[_0xa5bb('0x15')]));});});});};exports['GetCmHopperPreview']=function(_0x5b5037){var _0x717771=this;return new Promise(function(_0x4a2c75,_0x474e41){db['CmContact'][_0xa5bb('0x43')]()[_0xa5bb('0xd')](function(_0x38917f){return db['CmHopper'][_0xa5bb('0x18')]({'raw':_0x5b5037[_0xa5bb('0x19')]?_0x5b5037['options'][_0xa5bb('0x1a')]===undefined?!![]:![]:!![],'where':_0x5b5037['options']?_0x5b5037[_0xa5bb('0x19')]['where']||null:null,'attributes':_0x5b5037['options']?_0x5b5037[_0xa5bb('0x19')][_0xa5bb('0x20')]||null:null,'limit':_0x5b5037[_0xa5bb('0x19')]?_0x5b5037['options'][_0xa5bb('0x1c')]||null:null,'include':_0x5b5037['options']?_0x5b5037[_0xa5bb('0x19')][_0xa5bb('0x1d')]?_[_0xa5bb('0x1e')](_0x5b5037[_0xa5bb('0x19')][_0xa5bb('0x1d')],function(_0x477ed4){return{'model':db[_0x477ed4[_0xa5bb('0x1f')]],'as':_0x477ed4['as'],'attributes':_0x477ed4['as']==='Contact'?_['keys'](_0x38917f):_0x477ed4[_0xa5bb('0x20')],'include':_0x477ed4['include']?_[_0xa5bb('0x1e')](_0x477ed4[_0xa5bb('0x1d')],function(_0x203647){return{'model':db[_0x203647[_0xa5bb('0x1f')]],'as':_0x203647['as'],'attributes':_0x203647[_0xa5bb('0x20')],'include':_0x203647[_0xa5bb('0x1d')]?_['map'](_0x203647[_0xa5bb('0x1d')],function(_0x202ab0){return{'model':db[_0x202ab0[_0xa5bb('0x1f')]],'as':_0x202ab0['as'],'attributes':_0x202ab0[_0xa5bb('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa5bb('0xd')](function(_0x52ae8c){logger[_0xa5bb('0xe')](_0xa5bb('0x21'),_0x5b5037);logger[_0xa5bb('0x11')]('GetCmHopper',_0x5b5037,JSON[_0xa5bb('0x12')](_0x52ae8c));_0x4a2c75(_0x52ae8c);})[_0xa5bb('0x17')](function(_0x5b98b2){logger['error'](_0xa5bb('0x21'),_0x5b98b2[_0xa5bb('0x15')],_0x5b5037);_0x474e41(_0x717771[_0xa5bb('0x13')](0x1f4,_0x5b98b2[_0xa5bb('0x15')]));});});});};exports[_0xa5bb('0x46')]=function(_0x524649){console[_0xa5bb('0x47')](_0xa5bb('0x48'),_0x524649);var _0x365a7e=this;return new Promise(function(_0x2bdc1f,_0x18c765){return db[_0xa5bb('0x2d')]['findOne']({'raw':!![],'where':{'phone':_0x524649[_0xa5bb('0x26')]['phone']},'attributes':['id'],'order':[['id',_0xa5bb('0x49')]]})[_0xa5bb('0xd')](function(_0x734439){console[_0xa5bb('0x47')](_0xa5bb('0x4a'),_0x734439);logger[_0xa5bb('0xe')](_0xa5bb('0x46'),_0x524649);logger[_0xa5bb('0x11')](_0xa5bb('0x46'),_0x524649,JSON[_0xa5bb('0x12')](_0x734439));_0x2bdc1f(_0x734439);})['catch'](function(_0x256606){logger['error'](_0xa5bb('0x46'),_0x256606[_0xa5bb('0x15')],_0x524649);_0x18c765(_0x365a7e[_0xa5bb('0x13')](0x1f4,_0x256606[_0xa5bb('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 5f0991c..45d4f6f 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 _0x1cb9=['../../config/environment','get','isAuthenticated','index','/describe','/timezones','getTimezones','/:id','show','post','/preview','getPreview','/timezone','destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x41995c,_0x23a6f3){var _0x1dd52b=function(_0x219ebb){while(--_0x219ebb){_0x41995c['push'](_0x41995c['shift']());}};_0x1dd52b(++_0x23a6f3);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2ab3bc,_0x39f666){_0x2ab3bc=_0x2ab3bc-0x0;var _0x128463=_0x1cb9[_0x2ab3bc];return _0x128463;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x91cb('0x5'));var config=require(_0x91cb('0x6'));var controller=require('./cmHopper.controller');router[_0x91cb('0x7')]('/',auth[_0x91cb('0x8')](),controller[_0x91cb('0x9')]);router[_0x91cb('0x7')](_0x91cb('0xa'),auth[_0x91cb('0x8')](),controller['describe']);router[_0x91cb('0x7')]('/opencontacts',auth[_0x91cb('0x8')](),controller['getOpenContacts']);router[_0x91cb('0x7')](_0x91cb('0xb'),auth[_0x91cb('0x8')](),controller[_0x91cb('0xc')]);router[_0x91cb('0x7')](_0x91cb('0xd'),auth[_0x91cb('0x8')](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')]('/',auth[_0x91cb('0x8')](),controller['create']);router[_0x91cb('0xf')](_0x91cb('0x10'),auth['isAuthenticated'](),controller[_0x91cb('0x11')]);router[_0x91cb('0xf')](_0x91cb('0x12'),auth[_0x91cb('0x8')](),controller['getTimezone']);router['put'](_0x91cb('0xd'),auth[_0x91cb('0x8')](),controller['update']);router['delete'](_0x91cb('0xd'),auth[_0x91cb('0x8')](),controller[_0x91cb('0x13')]);module['exports']=router; \ No newline at end of file +var _0xbd50=['/describe','isAuthenticated','describe','getOpenContacts','getTimezones','/:id','post','create','/preview','getPreview','/timezone','getTimezone','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get'];(function(_0x5ae21a,_0xe0ada){var _0x327e75=function(_0x11d070){while(--_0x11d070){_0x5ae21a['push'](_0x5ae21a['shift']());}};_0x327e75(++_0xe0ada);}(_0xbd50,0x196));var _0x0bd5=function(_0x898cc2,_0x346605){_0x898cc2=_0x898cc2-0x0;var _0x10ec50=_0xbd50[_0x898cc2];return _0x10ec50;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var auth=require(_0x0bd5('0x5'));var interaction=require(_0x0bd5('0x6'));var config=require(_0x0bd5('0x7'));var controller=require('./cmHopper.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0bd5('0x8')]);router[_0x0bd5('0x9')](_0x0bd5('0xa'),auth[_0x0bd5('0xb')](),controller[_0x0bd5('0xc')]);router['get']('/opencontacts',auth[_0x0bd5('0xb')](),controller[_0x0bd5('0xd')]);router[_0x0bd5('0x9')]('/timezones',auth[_0x0bd5('0xb')](),controller[_0x0bd5('0xe')]);router['get'](_0x0bd5('0xf'),auth[_0x0bd5('0xb')](),controller['show']);router[_0x0bd5('0x10')]('/',auth[_0x0bd5('0xb')](),controller[_0x0bd5('0x11')]);router['post'](_0x0bd5('0x12'),auth[_0x0bd5('0xb')](),controller[_0x0bd5('0x13')]);router[_0x0bd5('0x10')](_0x0bd5('0x14'),auth[_0x0bd5('0xb')](),controller[_0x0bd5('0x15')]);router[_0x0bd5('0x16')]('/:id',auth[_0x0bd5('0xb')](),controller[_0x0bd5('0x17')]);router['delete'](_0x0bd5('0xf'),auth[_0x0bd5('0xb')](),controller[_0x0bd5('0x18')]);module[_0x0bd5('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index f1bb121..2738f55 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4345=['sequelize','STRING','INTEGER','format','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x5b1f0f,_0x4220cc){var _0xf4f6f6=function(_0x16e9ed){while(--_0x16e9ed){_0x5b1f0f['push'](_0x5b1f0f['shift']());}};_0xf4f6f6(++_0x4220cc);}(_0x4345,0x167));var _0x5434=function(_0x4afc90,_0x38721d){_0x4afc90=_0x4afc90-0x0;var _0x5c0b31=_0x4345[_0x4afc90];return _0x5c0b31;};'use strict';var moment=require(_0x5434('0x0'));var Sequelize=require(_0x5434('0x1'));module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x5434('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x5434('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x5434('0x4')](_0x5434('0x5'))},'countbusyretry':{'type':Sequelize[_0x5434('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5434('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5434('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5434('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x55d3=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','STRING','INTEGER','format'];(function(_0x8184d7,_0x5e09e4){var _0x2b4303=function(_0x5a0096){while(--_0x5a0096){_0x8184d7['push'](_0x8184d7['shift']());}};_0x2b4303(++_0x5e09e4);}(_0x55d3,0xc7));var _0x355d=function(_0x2ef8a3,_0x1dbf49){_0x2ef8a3=_0x2ef8a3-0x0;var _0x2c771d=_0x55d3[_0x2ef8a3];return _0x2c771d;};'use strict';var moment=require(_0x355d('0x0'));var Sequelize=require(_0x355d('0x1'));module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x355d('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x355d('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x355d('0x4')](_0x355d('0x5'))},'countbusyretry':{'type':Sequelize[_0x355d('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x355d('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x355d('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x355d('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x355d('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x355d('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index c0fddfa..2e3189e 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x550f=['type','model','map','query','keys','filters','intersection','attributes','length','nolimit','limit','sort','where','pick','filter','VIRTUAL','include','rows','show','params','rawAttributes','fields','includeAll','merge','options','create','body','user','role','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','count','offset','status','set','Content-Range','json','reject','save','update','then','destroy','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','index','CmHopperAdditionalPhone'];(function(_0x2fe539,_0x4322f6){var _0xf16796=function(_0x4f030d){while(--_0x4f030d){_0x2fe539['push'](_0x2fe539['shift']());}};_0xf16796(++_0x4322f6);}(_0x550f,0x6d));var _0xf550=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x550f[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf550('0x0'));var jsonpatch=require(_0xf550('0x1'));var rp=require(_0xf550('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf550('0x3'));var path=require('path');var sox=require(_0xf550('0x4'));var csv=require(_0xf550('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf550('0x6'));var squel=require(_0xf550('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf550('0x8'));var toCsv=require(_0xf550('0x5'));var querystring=require(_0xf550('0x9'));var Papa=require(_0xf550('0xa'));var Redis=require(_0xf550('0xb'));var authService=require(_0xf550('0xc'));var qs=require(_0xf550('0xd'));var as=require(_0xf550('0xe'));var hardwareService=require(_0xf550('0xf'));var logger=require(_0xf550('0x10'))(_0xf550('0x11'));var utils=require('../../config/utils');var config=require(_0xf550('0x12'));var db=require(_0xf550('0x13'))['db'];function respondWithStatusCode(_0x993c13,_0x19091b){_0x19091b=_0x19091b||0xcc;return function(_0x4b2141){if(_0x4b2141){return _0x993c13[_0xf550('0x14')](_0x19091b);}return _0x993c13['status'](_0x19091b)[_0xf550('0x15')]();};}function respondWithResult(_0x27deb6,_0x3c1840){_0x3c1840=_0x3c1840||0xc8;return function(_0x2c1cbd){if(_0x2c1cbd){return _0x27deb6['status'](_0x3c1840)['json'](_0x2c1cbd);}};}function respondWithFilteredResult(_0x81403e,_0x2b8d53){return function(_0x2bd966){if(_0x2bd966){var _0x2ae725=_0x2bd966[_0xf550('0x16')],_0x2512f1=_0x2b8d53[_0xf550('0x17')],_0x5a8c43=_0x2b8d53['offset']+_0x2b8d53['limit'],_0xaa3b8d;if(_0x5a8c43>=_0x2ae725){_0x5a8c43=_0x2ae725;_0xaa3b8d=0xc8;}else{_0xaa3b8d=0xce;}_0x81403e[_0xf550('0x18')](_0xaa3b8d);return _0x81403e[_0xf550('0x19')](_0xf550('0x1a'),_0x2512f1+'-'+_0x5a8c43+'/'+_0x2ae725)[_0xf550('0x1b')](_0x2bd966);}return null;};}function patchUpdates(_0x23000a){return function(_0x114fdb){try{jsonpatch['apply'](_0x114fdb,_0x23000a,!![]);}catch(_0x28707a){return BPromise[_0xf550('0x1c')](_0x28707a);}return _0x114fdb[_0xf550('0x1d')]();};}function saveUpdates(_0x374528,_0x226891){return function(_0x1360f2){if(_0x1360f2){return _0x1360f2[_0xf550('0x1e')](_0x374528)[_0xf550('0x1f')](function(_0x124417){return _0x124417;});}return null;};}function removeEntity(_0x2aa2c3,_0x105907){return function(_0x4fe089){if(_0x4fe089){return _0x4fe089[_0xf550('0x20')]()[_0xf550('0x1f')](function(){var _0x18087c=_0x4fe089['get']({'plain':!![]});var _0xf2d9c9=_0xf550('0x21');return db[_0xf550('0x22')]['destroy']({'where':{'type':_0xf2d9c9,'resourceId':_0x18087c['id']}})[_0xf550('0x1f')](function(){return _0x4fe089;});})[_0xf550('0x1f')](function(){_0x2aa2c3[_0xf550('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b98f4,_0x9f14e9){return function(_0x1308aa){if(!_0x1308aa){_0x5b98f4[_0xf550('0x14')](0x194);}return _0x1308aa;};}function handleError(_0x405148,_0x28418d){_0x28418d=_0x28418d||0x1f4;return function(_0x54efbf){logger[_0xf550('0x23')](_0x54efbf[_0xf550('0x24')]);if(_0x54efbf[_0xf550('0x25')]){delete _0x54efbf['name'];}_0x405148['status'](_0x28418d)[_0xf550('0x26')](_0x54efbf);};}exports[_0xf550('0x27')]=function(_0x55d489,_0x1b7368){var _0x2b7e54={},_0x18784f={},_0x51dab3={'count':0x0,'rows':[]};var _0xc62edb=_['map'](db[_0xf550('0x28')]['rawAttributes'],function(_0x1e3ae0){return{'name':_0x1e3ae0['fieldName'],'type':_0x1e3ae0[_0xf550('0x29')]['key']};});_0x18784f[_0xf550('0x2a')]=_[_0xf550('0x2b')](_0xc62edb,_0xf550('0x25'));_0x18784f[_0xf550('0x2c')]=_[_0xf550('0x2d')](_0x55d489[_0xf550('0x2c')]);_0x18784f[_0xf550('0x2e')]=_[_0xf550('0x2f')](_0x18784f[_0xf550('0x2a')],_0x18784f[_0xf550('0x2c')]);_0x2b7e54['attributes']=_[_0xf550('0x2f')](_0x18784f[_0xf550('0x2a')],qs['fields'](_0x55d489[_0xf550('0x2c')]['fields']));_0x2b7e54[_0xf550('0x30')]=_0x2b7e54[_0xf550('0x30')][_0xf550('0x31')]?_0x2b7e54[_0xf550('0x30')]:_0x18784f[_0xf550('0x2a')];if(!_0x55d489[_0xf550('0x2c')]['hasOwnProperty'](_0xf550('0x32'))){_0x2b7e54[_0xf550('0x33')]=qs['limit'](_0x55d489['query'][_0xf550('0x33')]);_0x2b7e54[_0xf550('0x17')]=qs[_0xf550('0x17')](_0x55d489[_0xf550('0x2c')][_0xf550('0x17')]);}_0x2b7e54['order']=qs[_0xf550('0x34')](_0x55d489[_0xf550('0x2c')][_0xf550('0x34')]);_0x2b7e54[_0xf550('0x35')]=qs[_0xf550('0x2e')](_[_0xf550('0x36')](_0x55d489[_0xf550('0x2c')],_0x18784f[_0xf550('0x2e')]),_0xc62edb);if(_0x55d489[_0xf550('0x2c')][_0xf550('0x37')]){_0x2b7e54['where']=_['merge'](_0x2b7e54[_0xf550('0x35')],{'$or':_['map'](_0xc62edb,function(_0x55497){if(_0x55497[_0xf550('0x29')]!==_0xf550('0x38')){var _0x39ec44={};_0x39ec44[_0x55497[_0xf550('0x25')]]={'$like':'%'+_0x55d489['query'][_0xf550('0x37')]+'%'};return _0x39ec44;}})});}_0x2b7e54=_['merge']({},_0x2b7e54,_0x55d489['options']);var _0x11e392={'where':_0x2b7e54[_0xf550('0x35')]};return db['CmHopperAdditionalPhone'][_0xf550('0x16')](_0x11e392)[_0xf550('0x1f')](function(_0x3f25af){_0x51dab3[_0xf550('0x16')]=_0x3f25af;if(_0x55d489[_0xf550('0x2c')]['includeAll']){_0x2b7e54[_0xf550('0x39')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0x2b7e54);})[_0xf550('0x1f')](function(_0x4621c5){_0x51dab3[_0xf550('0x3a')]=_0x4621c5;return _0x51dab3;})['then'](respondWithFilteredResult(_0x1b7368,_0x2b7e54))['catch'](handleError(_0x1b7368,null));};exports[_0xf550('0x3b')]=function(_0x56cfa5,_0x47baab){var _0x100a8e={'raw':!![],'where':{'id':_0x56cfa5[_0xf550('0x3c')]['id']}},_0x59b438={};_0x59b438[_0xf550('0x2a')]=_['keys'](db[_0xf550('0x28')][_0xf550('0x3d')]);_0x59b438['query']=_[_0xf550('0x2d')](_0x56cfa5[_0xf550('0x2c')]);_0x59b438[_0xf550('0x2e')]=_[_0xf550('0x2f')](_0x59b438[_0xf550('0x2a')],_0x59b438[_0xf550('0x2c')]);_0x100a8e['attributes']=_[_0xf550('0x2f')](_0x59b438[_0xf550('0x2a')],qs['fields'](_0x56cfa5[_0xf550('0x2c')][_0xf550('0x3e')]));_0x100a8e[_0xf550('0x30')]=_0x100a8e[_0xf550('0x30')]['length']?_0x100a8e[_0xf550('0x30')]:_0x59b438[_0xf550('0x2a')];if(_0x56cfa5[_0xf550('0x2c')][_0xf550('0x3f')]){_0x100a8e[_0xf550('0x39')]=[{'all':!![]}];}_0x100a8e=_[_0xf550('0x40')]({},_0x100a8e,_0x56cfa5[_0xf550('0x41')]);return db[_0xf550('0x28')]['find'](_0x100a8e)[_0xf550('0x1f')](handleEntityNotFound(_0x47baab,null))['then'](respondWithResult(_0x47baab,null))['catch'](handleError(_0x47baab,null));};exports[_0xf550('0x42')]=function(_0x4759ca,_0x362cca){return db[_0xf550('0x28')]['create'](_0x4759ca[_0xf550('0x43')],{})[_0xf550('0x1f')](function(_0x66caa0){var _0x1c76d1=_0x4759ca[_0xf550('0x44')]['get']({'plain':!![]});if(!_0x1c76d1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c76d1[_0xf550('0x45')]==='user'){var _0x30bd23=_0x66caa0['get']({'plain':!![]});var _0x24f55f=_0xf550('0x21');return db['UserProfileSection'][_0xf550('0x46')]({'where':{'name':_0x24f55f,'userProfileId':_0x1c76d1[_0xf550('0x47')]},'raw':!![]})[_0xf550('0x1f')](function(_0x384482){if(_0x384482&&_0x384482[_0xf550('0x48')]===0x0){return db[_0xf550('0x22')][_0xf550('0x42')]({'name':_0x30bd23[_0xf550('0x25')],'resourceId':_0x30bd23['id'],'type':_0x384482[_0xf550('0x25')],'sectionId':_0x384482['id']},{})[_0xf550('0x1f')](function(){return _0x66caa0;});}else{return _0x66caa0;}})[_0xf550('0x49')](function(_0x5c3706){logger['error'](_0xf550('0x4a'),_0x5c3706);throw _0x5c3706;});}return _0x66caa0;})[_0xf550('0x1f')](respondWithResult(_0x362cca,0xc9))[_0xf550('0x49')](handleError(_0x362cca,null));};exports[_0xf550('0x1e')]=function(_0x363618,_0x13f606){if(_0x363618[_0xf550('0x43')]['id']){delete _0x363618[_0xf550('0x43')]['id'];}return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x363618['params']['id']}})[_0xf550('0x1f')](handleEntityNotFound(_0x13f606,null))[_0xf550('0x1f')](saveUpdates(_0x363618['body'],null))[_0xf550('0x1f')](respondWithResult(_0x13f606,null))[_0xf550('0x49')](handleError(_0x13f606,null));};exports[_0xf550('0x20')]=function(_0x27560a,_0x493edc){return db[_0xf550('0x28')][_0xf550('0x46')]({'where':{'id':_0x27560a[_0xf550('0x3c')]['id']}})[_0xf550('0x1f')](handleEntityNotFound(_0x493edc,null))[_0xf550('0x1f')](removeEntity(_0x493edc,null))[_0xf550('0x49')](handleError(_0x493edc,null));}; \ No newline at end of file +var _0xfdb6=['lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','api','../../config/utils','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','CmHopperAdditionalPhones','UserProfileResource','sendStatus','error','name','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName','key','keys','query','attributes','intersection','model','fields','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','findAll','rows','catch','params','length','include','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x2a8c21,_0x163576){var _0x5f3061=function(_0x4dc8eb){while(--_0x4dc8eb){_0x2a8c21['push'](_0x2a8c21['shift']());}};_0x5f3061(++_0x163576);}(_0xfdb6,0x1cb));var _0x6fdb=function(_0x229060,_0x54534b){_0x229060=_0x229060-0x0;var _0x46d71b=_0xfdb6[_0x229060];return _0x46d71b;};'use strict';var pdf=require(_0x6fdb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6fdb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6fdb('0x2'));var rp=require(_0x6fdb('0x3'));var moment=require(_0x6fdb('0x4'));var BPromise=require(_0x6fdb('0x5'));var Mustache=require(_0x6fdb('0x6'));var util=require('util');var path=require(_0x6fdb('0x7'));var sox=require(_0x6fdb('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6fdb('0x9'));var squel=require(_0x6fdb('0xa'));var crypto=require(_0x6fdb('0xb'));var jsforce=require(_0x6fdb('0xc'));var deskjs=require(_0x6fdb('0xd'));var toCsv=require(_0x6fdb('0xe'));var querystring=require('querystring');var Papa=require(_0x6fdb('0xf'));var Redis=require(_0x6fdb('0x10'));var authService=require(_0x6fdb('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6fdb('0x12'));var utils=require(_0x6fdb('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x516a24,_0x4d8f24){_0x4d8f24=_0x4d8f24||0xcc;return function(_0x2bfb34){if(_0x2bfb34){return _0x516a24['sendStatus'](_0x4d8f24);}return _0x516a24[_0x6fdb('0x14')](_0x4d8f24)[_0x6fdb('0x15')]();};}function respondWithResult(_0x53aff5,_0xdf4496){_0xdf4496=_0xdf4496||0xc8;return function(_0x4263c2){if(_0x4263c2){return _0x53aff5[_0x6fdb('0x14')](_0xdf4496)[_0x6fdb('0x16')](_0x4263c2);}};}function respondWithFilteredResult(_0x157e9d,_0x10cfc6){return function(_0x16e79f){if(_0x16e79f){var _0x511977=_0x16e79f[_0x6fdb('0x17')],_0x3b9eee=_0x10cfc6[_0x6fdb('0x18')],_0x1b8fe2=_0x10cfc6[_0x6fdb('0x18')]+_0x10cfc6[_0x6fdb('0x19')],_0x98cb7c;if(_0x1b8fe2>=_0x511977){_0x1b8fe2=_0x511977;_0x98cb7c=0xc8;}else{_0x98cb7c=0xce;}_0x157e9d[_0x6fdb('0x14')](_0x98cb7c);return _0x157e9d['set'](_0x6fdb('0x1a'),_0x3b9eee+'-'+_0x1b8fe2+'/'+_0x511977)[_0x6fdb('0x16')](_0x16e79f);}return null;};}function patchUpdates(_0x2b82ac){return function(_0x48d61d){try{jsonpatch[_0x6fdb('0x1b')](_0x48d61d,_0x2b82ac,!![]);}catch(_0x176902){return BPromise[_0x6fdb('0x1c')](_0x176902);}return _0x48d61d[_0x6fdb('0x1d')]();};}function saveUpdates(_0x56dd7c,_0xac0da9){return function(_0x1d1bb9){if(_0x1d1bb9){return _0x1d1bb9[_0x6fdb('0x1e')](_0x56dd7c)[_0x6fdb('0x1f')](function(_0x1a712f){return _0x1a712f;});}return null;};}function removeEntity(_0x119dae,_0x5d1872){return function(_0x5741e1){if(_0x5741e1){return _0x5741e1[_0x6fdb('0x20')]()['then'](function(){var _0x848388=_0x5741e1['get']({'plain':!![]});var _0x42b662=_0x6fdb('0x21');return db[_0x6fdb('0x22')][_0x6fdb('0x20')]({'where':{'type':_0x42b662,'resourceId':_0x848388['id']}})[_0x6fdb('0x1f')](function(){return _0x5741e1;});})[_0x6fdb('0x1f')](function(){_0x119dae[_0x6fdb('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x101961,_0x34be0e){return function(_0x49cba4){if(!_0x49cba4){_0x101961[_0x6fdb('0x23')](0x194);}return _0x49cba4;};}function handleError(_0x4d3d43,_0x2a14d1){_0x2a14d1=_0x2a14d1||0x1f4;return function(_0x1cd1cc){logger[_0x6fdb('0x24')](_0x1cd1cc['stack']);if(_0x1cd1cc[_0x6fdb('0x25')]){delete _0x1cd1cc[_0x6fdb('0x25')];}_0x4d3d43[_0x6fdb('0x14')](_0x2a14d1)[_0x6fdb('0x26')](_0x1cd1cc);};}exports['index']=function(_0x53f3c0,_0x306b52){var _0x28316f={},_0x257d58={},_0x592547={'count':0x0,'rows':[]};var _0x4505d3=_[_0x6fdb('0x27')](db[_0x6fdb('0x28')][_0x6fdb('0x29')],function(_0x3c9924){return{'name':_0x3c9924[_0x6fdb('0x2a')],'type':_0x3c9924['type'][_0x6fdb('0x2b')]};});_0x257d58['model']=_[_0x6fdb('0x27')](_0x4505d3,_0x6fdb('0x25'));_0x257d58['query']=_[_0x6fdb('0x2c')](_0x53f3c0['query']);_0x257d58['filters']=_['intersection'](_0x257d58['model'],_0x257d58[_0x6fdb('0x2d')]);_0x28316f[_0x6fdb('0x2e')]=_[_0x6fdb('0x2f')](_0x257d58[_0x6fdb('0x30')],qs[_0x6fdb('0x31')](_0x53f3c0[_0x6fdb('0x2d')][_0x6fdb('0x31')]));_0x28316f[_0x6fdb('0x2e')]=_0x28316f['attributes']['length']?_0x28316f['attributes']:_0x257d58[_0x6fdb('0x30')];if(!_0x53f3c0[_0x6fdb('0x2d')][_0x6fdb('0x32')](_0x6fdb('0x33'))){_0x28316f[_0x6fdb('0x19')]=qs[_0x6fdb('0x19')](_0x53f3c0['query'][_0x6fdb('0x19')]);_0x28316f['offset']=qs[_0x6fdb('0x18')](_0x53f3c0[_0x6fdb('0x2d')][_0x6fdb('0x18')]);}_0x28316f[_0x6fdb('0x34')]=qs[_0x6fdb('0x35')](_0x53f3c0['query']['sort']);_0x28316f['where']=qs[_0x6fdb('0x36')](_['pick'](_0x53f3c0['query'],_0x257d58[_0x6fdb('0x36')]),_0x4505d3);if(_0x53f3c0['query'][_0x6fdb('0x37')]){_0x28316f[_0x6fdb('0x38')]=_[_0x6fdb('0x39')](_0x28316f['where'],{'$or':_['map'](_0x4505d3,function(_0x828aa9){if(_0x828aa9[_0x6fdb('0x3a')]!==_0x6fdb('0x3b')){var _0x590159={};_0x590159[_0x828aa9[_0x6fdb('0x25')]]={'$like':'%'+_0x53f3c0[_0x6fdb('0x2d')][_0x6fdb('0x37')]+'%'};return _0x590159;}})});}_0x28316f=_[_0x6fdb('0x39')]({},_0x28316f,_0x53f3c0[_0x6fdb('0x3c')]);var _0x4eed26={'where':_0x28316f['where']};return db[_0x6fdb('0x28')][_0x6fdb('0x17')](_0x4eed26)['then'](function(_0x1c51b0){_0x592547[_0x6fdb('0x17')]=_0x1c51b0;if(_0x53f3c0[_0x6fdb('0x2d')]['includeAll']){_0x28316f['include']=[{'all':!![]}];}return db[_0x6fdb('0x28')][_0x6fdb('0x3d')](_0x28316f);})[_0x6fdb('0x1f')](function(_0x6850db){_0x592547[_0x6fdb('0x3e')]=_0x6850db;return _0x592547;})[_0x6fdb('0x1f')](respondWithFilteredResult(_0x306b52,_0x28316f))[_0x6fdb('0x3f')](handleError(_0x306b52,null));};exports['show']=function(_0x4c2601,_0x5e1fd3){var _0x27806a={'raw':!![],'where':{'id':_0x4c2601[_0x6fdb('0x40')]['id']}},_0x3559e8={};_0x3559e8[_0x6fdb('0x30')]=_['keys'](db[_0x6fdb('0x28')][_0x6fdb('0x29')]);_0x3559e8[_0x6fdb('0x2d')]=_['keys'](_0x4c2601[_0x6fdb('0x2d')]);_0x3559e8[_0x6fdb('0x36')]=_[_0x6fdb('0x2f')](_0x3559e8[_0x6fdb('0x30')],_0x3559e8[_0x6fdb('0x2d')]);_0x27806a[_0x6fdb('0x2e')]=_[_0x6fdb('0x2f')](_0x3559e8['model'],qs[_0x6fdb('0x31')](_0x4c2601[_0x6fdb('0x2d')][_0x6fdb('0x31')]));_0x27806a[_0x6fdb('0x2e')]=_0x27806a[_0x6fdb('0x2e')][_0x6fdb('0x41')]?_0x27806a[_0x6fdb('0x2e')]:_0x3559e8[_0x6fdb('0x30')];if(_0x4c2601[_0x6fdb('0x2d')]['includeAll']){_0x27806a[_0x6fdb('0x42')]=[{'all':!![]}];}_0x27806a=_[_0x6fdb('0x39')]({},_0x27806a,_0x4c2601['options']);return db['CmHopperAdditionalPhone'][_0x6fdb('0x43')](_0x27806a)['then'](handleEntityNotFound(_0x5e1fd3,null))['then'](respondWithResult(_0x5e1fd3,null))[_0x6fdb('0x3f')](handleError(_0x5e1fd3,null));};exports['create']=function(_0x2476ea,_0x15090b){return db[_0x6fdb('0x28')]['create'](_0x2476ea['body'],{})[_0x6fdb('0x1f')](function(_0x146ecd){var _0x58f590=_0x2476ea[_0x6fdb('0x44')][_0x6fdb('0x45')]({'plain':!![]});if(!_0x58f590)throw new Error(_0x6fdb('0x46'));if(_0x58f590[_0x6fdb('0x47')]==='user'){var _0x4c0f48=_0x146ecd['get']({'plain':!![]});var _0x538e95='CmHopperAdditionalPhones';return db[_0x6fdb('0x48')]['find']({'where':{'name':_0x538e95,'userProfileId':_0x58f590[_0x6fdb('0x49')]},'raw':!![]})['then'](function(_0x52b7c4){if(_0x52b7c4&&_0x52b7c4[_0x6fdb('0x4a')]===0x0){return db[_0x6fdb('0x22')][_0x6fdb('0x4b')]({'name':_0x4c0f48['name'],'resourceId':_0x4c0f48['id'],'type':_0x52b7c4[_0x6fdb('0x25')],'sectionId':_0x52b7c4['id']},{})[_0x6fdb('0x1f')](function(){return _0x146ecd;});}else{return _0x146ecd;}})[_0x6fdb('0x3f')](function(_0x1bb494){logger[_0x6fdb('0x24')](_0x6fdb('0x4c'),_0x1bb494);throw _0x1bb494;});}return _0x146ecd;})['then'](respondWithResult(_0x15090b,0xc9))[_0x6fdb('0x3f')](handleError(_0x15090b,null));};exports[_0x6fdb('0x1e')]=function(_0x5e7428,_0x47238c){if(_0x5e7428[_0x6fdb('0x4d')]['id']){delete _0x5e7428[_0x6fdb('0x4d')]['id'];}return db[_0x6fdb('0x28')][_0x6fdb('0x43')]({'where':{'id':_0x5e7428[_0x6fdb('0x40')]['id']}})[_0x6fdb('0x1f')](handleEntityNotFound(_0x47238c,null))[_0x6fdb('0x1f')](saveUpdates(_0x5e7428[_0x6fdb('0x4d')],null))[_0x6fdb('0x1f')](respondWithResult(_0x47238c,null))['catch'](handleError(_0x47238c,null));};exports['destroy']=function(_0x2e8d2d,_0x55c125){return db[_0x6fdb('0x28')]['find']({'where':{'id':_0x2e8d2d[_0x6fdb('0x40')]['id']}})[_0x6fdb('0x1f')](handleEntityNotFound(_0x55c125,null))[_0x6fdb('0x1f')](removeEntity(_0x55c125,null))[_0x6fdb('0x3f')](handleError(_0x55c125,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 5067a20..12e4b35 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeeec=['exports','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes'];(function(_0xea3365,_0x5bbb06){var _0x47c98b=function(_0x14f44c){while(--_0x14f44c){_0xea3365['push'](_0xea3365['shift']());}};_0x47c98b(++_0x5bbb06);}(_0xeeec,0xc7));var _0xceee=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0xeeec[_0x2db12b];return _0x20990b;};'use strict';var _=require(_0xceee('0x0'));var util=require(_0xceee('0x1'));var logger=require(_0xceee('0x2'))(_0xceee('0x3'));var moment=require('moment');var BPromise=require(_0xceee('0x4'));var rp=require(_0xceee('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xceee('0x6'));var config=require(_0xceee('0x7'));var attributes=require(_0xceee('0x8'));module[_0xceee('0x9')]=function(_0x4d36b9,_0x10219e){return _0x4d36b9[_0xceee('0xa')](_0xceee('0xb'),attributes,{'tableName':_0xceee('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2087=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','lodash'];(function(_0x13bad3,_0x4a7f19){var _0x49292c=function(_0x443290){while(--_0x443290){_0x13bad3['push'](_0x13bad3['shift']());}};_0x49292c(++_0x4a7f19);}(_0x2087,0x11f));var _0x7208=function(_0x139c3e,_0x584ed6){_0x139c3e=_0x139c3e-0x0;var _0x1fe091=_0x2087[_0x139c3e];return _0x1fe091;};'use strict';var _=require(_0x7208('0x0'));var util=require('util');var logger=require(_0x7208('0x1'))(_0x7208('0x2'));var moment=require(_0x7208('0x3'));var BPromise=require(_0x7208('0x4'));var rp=require(_0x7208('0x5'));var fs=require('fs');var path=require(_0x7208('0x6'));var rimraf=require(_0x7208('0x7'));var config=require(_0x7208('0x8'));var attributes=require(_0x7208('0x9'));module[_0x7208('0xa')]=function(_0x5dc4e5,_0x2f502e){return _0x5dc4e5[_0x7208('0xb')]('CmHopperAdditionalPhone',attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 4f71c92..5e8d7e8 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd3e=['CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countnoanswerretry','countnosuchnumberretry','VerifyAdditionalPhones','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','phone','isNil','createdAt','updatedAt','hopperToAdd','additionalToHop','sequelize','transaction','update','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperAdditionalPhone,\x20%s,\x20%s','message','request\x20sent','result','catch','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId'];(function(_0x370370,_0x2660d8){var _0x3ce26b=function(_0x16d1f2){while(--_0x16d1f2){_0x370370['push'](_0x370370['shift']());}};_0x3ce26b(++_0x2660d8);}(_0xbd3e,0xda));var _0xebd3=function(_0x4c6829,_0x30a514){_0x4c6829=_0x4c6829-0x0;var _0x8dd2ca=_0xbd3e[_0x4c6829];return _0x8dd2ca;};'use strict';var _=require(_0xebd3('0x0'));var util=require(_0xebd3('0x1'));var moment=require(_0xebd3('0x2'));var BPromise=require(_0xebd3('0x3'));var rs=require(_0xebd3('0x4'));var fs=require('fs');var Redis=require(_0xebd3('0x5'));var db=require(_0xebd3('0x6'))['db'];var utils=require(_0xebd3('0x7'));var logger=require(_0xebd3('0x8'))(_0xebd3('0x9'));var config=require(_0xebd3('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xebd3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d6612,_0x2ddb20,_0x4c1c38){return new BPromise(function(_0xd0e351,_0x4866fd){return client[_0xebd3('0xc')](_0x1d6612,_0x4c1c38)[_0xebd3('0xd')](function(_0x3668c6){logger[_0xebd3('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2ddb20,'request\x20sent');logger[_0xebd3('0xf')](_0xebd3('0x10'),_0x2ddb20,'request\x20sent',JSON[_0xebd3('0x11')](_0x3668c6));if(_0x3668c6['error']){if(_0x3668c6[_0xebd3('0x12')]['code']===0x1f4){logger['error'](_0xebd3('0x13'),_0x2ddb20,_0x3668c6[_0xebd3('0x12')][_0xebd3('0x14')]);return _0x4866fd(_0x3668c6[_0xebd3('0x12')][_0xebd3('0x14')]);}logger['error'](_0xebd3('0x13'),_0x2ddb20,_0x3668c6[_0xebd3('0x12')][_0xebd3('0x14')]);return _0xd0e351(_0x3668c6['error'][_0xebd3('0x14')]);}else{logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2ddb20,_0xebd3('0x15'));_0xd0e351(_0x3668c6[_0xebd3('0x16')][_0xebd3('0x14')]);}})[_0xebd3('0x17')](function(_0x3e37a2){logger[_0xebd3('0x12')](_0xebd3('0x13'),_0x2ddb20,_0x3e37a2);_0x4866fd(_0x3e37a2);});});}exports['VerifyAdditionalPhones']=function(_0x3c48fe){var _0x1edf89=this;return new Promise(function(_0xbaea40,_0x17a062){return db[_0xebd3('0x18')][_0xebd3('0x19')]({'raw':!![],'where':{'ContactId':_0x3c48fe[_0xebd3('0x1a')][_0xebd3('0x1b')],'ListId':_0x3c48fe['body'][_0xebd3('0x1c')],'VoiceQueueId':_0x3c48fe[_0xebd3('0x1a')][_0xebd3('0x1d')]===undefined?null:_0x3c48fe[_0xebd3('0x1a')][_0xebd3('0x1d')],'CampaignId':_0x3c48fe['body'][_0xebd3('0x1e')]===undefined?null:_0x3c48fe[_0xebd3('0x1a')][_0xebd3('0x1e')]}})[_0xebd3('0xd')](function(_0x19379b){if(_0x19379b!=null){return db[_0xebd3('0x1f')][_0xebd3('0x19')]({'raw':!![],'where':{'CmHopperId':_0x19379b['id'],'OrderBy':{'$gt':_0x19379b['OrderBy']}},'order':[[_0xebd3('0x20'),_0xebd3('0x21')]]})['then'](function(_0x386ed7){var _0x4254a2=0x0;if(_0x386ed7){if(_0x386ed7[_0xebd3('0x22')]+_0x386ed7[_0xebd3('0x23')]+_0x386ed7['countnoanswerretry']+_0x386ed7['countnosuchnumberretry']+_0x386ed7[_0xebd3('0x24')]+_0x386ed7[_0xebd3('0x25')]+_0x386ed7[_0xebd3('0x26')]+_0x386ed7[_0xebd3('0x27')]<_0x3c48fe[_0xebd3('0x28')][_0xebd3('0x29')])_0x4254a2=0x1;_0xbaea40({'additional':_0x4254a2});}else{return db[_0xebd3('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x19379b['id']},'order':[[_0xebd3('0x20'),'ASC']]})[_0xebd3('0xd')](function(_0x191e6b){var _0x4f3c08=0x0;if(_0x191e6b){if(_0x191e6b[_0xebd3('0x22')]+_0x191e6b['countcongestionretry']+_0x191e6b[_0xebd3('0x2a')]+_0x191e6b[_0xebd3('0x2b')]+_0x191e6b[_0xebd3('0x24')]+_0x191e6b['countabandonedretry']+_0x191e6b[_0xebd3('0x26')]+_0x191e6b[_0xebd3('0x27')]<_0x3c48fe[_0xebd3('0x28')][_0xebd3('0x29')])_0x4f3c08=0x1;_0xbaea40({'additional':_0x4f3c08});}else{_0xbaea40({'additional':0x0});}})[_0xebd3('0x17')](function(_0x515e28){logger['error'](_0xebd3('0x2c'),_0x515e28[_0xebd3('0x14')],_0x3c48fe);_0x17a062(_0x1edf89['error'](0x1f4,_0x515e28[_0xebd3('0x14')]));});}})['catch'](function(_0x4d1d8d){logger[_0xebd3('0x12')](_0xebd3('0x2c'),_0x4d1d8d['message'],_0x3c48fe);_0x17a062(_0x1edf89[_0xebd3('0x12')](0x1f4,_0x4d1d8d[_0xebd3('0x14')]));});}else _0xbaea40({'additional':0x0});});});};exports[_0xebd3('0x2d')]=function(_0x49fa23){var _0x353573=this;return new Promise(function(_0x817e1b,_0xd2c384){return db['CmHopper'][_0xebd3('0x19')]({'raw':!![],'where':{'ContactId':_0x49fa23[_0xebd3('0x1a')]['ContactId'],'ListId':_0x49fa23[_0xebd3('0x1a')][_0xebd3('0x1c')],'VoiceQueueId':_0x49fa23[_0xebd3('0x1a')][_0xebd3('0x1d')]===undefined?null:_0x49fa23[_0xebd3('0x1a')]['VoiceQueueId'],'CampaignId':_0x49fa23[_0xebd3('0x1a')][_0xebd3('0x1e')]===undefined?null:_0x49fa23['body'][_0xebd3('0x1e')]}})[_0xebd3('0xd')](function(_0x2ce7d4){if(_0x2ce7d4!=null){return db[_0xebd3('0x1f')][_0xebd3('0x19')]({'raw':!![],'where':{'CmHopperId':_0x2ce7d4['id'],'OrderBy':{'$gt':_0x2ce7d4[_0xebd3('0x20')]}},'order':[[_0xebd3('0x20'),_0xebd3('0x21')]]})['then'](function(_0x6cde22){if(_0x6cde22)return activateAdditionalPhone(_0x2ce7d4,_0x49fa23['body'],_0x6cde22,_0x49fa23[_0xebd3('0x2e')],_0x49fa23['waitTime'])['then'](function(_0x2dd89c){_0x817e1b(_0x2dd89c);});else{return db[_0xebd3('0x1f')][_0xebd3('0x19')]({'raw':!![],'where':{'CmHopperId':_0x2ce7d4['id']},'order':[[_0xebd3('0x20'),_0xebd3('0x21')]]})[_0xebd3('0xd')](function(_0x5c1e66){if(_0x5c1e66)return activateAdditionalPhone(_0x2ce7d4,_0x49fa23[_0xebd3('0x1a')],_0x5c1e66,_0x49fa23[_0xebd3('0x2e')],_0x49fa23[_0xebd3('0x2f')])['then'](function(_0x97d112){_0x817e1b(_0x97d112);});else{_0x817e1b({'id':_0x2ce7d4['id'],'phone':''});}})[_0xebd3('0x17')](function(_0x2ca12b){logger[_0xebd3('0x12')](_0xebd3('0x2c'),_0x2ca12b['message'],_0x49fa23);_0xd2c384(_0x353573[_0xebd3('0x12')](0x1f4,_0x2ca12b[_0xebd3('0x14')]));});}})[_0xebd3('0x17')](function(_0x488d2d){logger[_0xebd3('0x12')](_0xebd3('0x2c'),_0x488d2d['message'],_0x49fa23);_0xd2c384(_0x353573[_0xebd3('0x12')](0x1f4,_0x488d2d['message']));});}else _0x817e1b(0x1);});});};function activateAdditionalPhone(_0x3d8268,_0x4982d9,_0x4fc433,_0x42e8ad,_0x4ebff4){return new Promise(function(_0x97f66c,_0x1dfc51){logger[_0xebd3('0xe')](_0xebd3('0x2c'),_0x4fc433);var _0xe6c79a;if(moment()>moment(_0x4fc433[_0xebd3('0x30')])){_0xe6c79a=moment()[_0xebd3('0x31')](_0x4ebff4||0x3,_0xebd3('0x32'));}else{if(_0x4fc433[_0xebd3('0x20')]==0x0){_0xe6c79a=moment(_0x4fc433[_0xebd3('0x30')]);}else{_0xe6c79a=moment()[_0xebd3('0x31')](_0x4ebff4||0x3,'minutes');}}var _0x5168c4={'phone':_0x3d8268[_0xebd3('0x33')],'active':0x0,'OrderBy':_[_0xebd3('0x34')](_0x3d8268[_0xebd3('0x20')])?0x0:_0x3d8268[_0xebd3('0x20')],'scheduledat':moment()[_0xebd3('0x31')](_0x42e8ad||0x1,_0xebd3('0x32')),'countbusyretry':_0x4982d9['countbusyretry'],'countcongestionretry':_0x4982d9[_0xebd3('0x23')],'countnoanswerretry':_0x4982d9[_0xebd3('0x2a')],'countnosuchnumberretry':_0x4982d9[_0xebd3('0x2b')],'countdropretry':_0x4982d9[_0xebd3('0x24')],'countabandonedretry':_0x4982d9[_0xebd3('0x25')],'countmachineretry':_0x4982d9[_0xebd3('0x26')],'countagentrejectretry':_0x4982d9[_0xebd3('0x27')],'createdAt':_0x4982d9[_0xebd3('0x35')],'updatedAt':_0x4982d9['updatedAt']};var _0x1332cc={'CmHopperId':_0x3d8268['id'],'phone':_0x4fc433[_0xebd3('0x33')],'active':0x0,'OrderBy':_[_0xebd3('0x34')](_0x4fc433[_0xebd3('0x20')])?0x0:_0x4fc433[_0xebd3('0x20')],'scheduledat':_0xe6c79a,'countbusyretry':_0x4fc433['countbusyretry'],'countcongestionretry':_0x4fc433[_0xebd3('0x23')],'countnoanswerretry':_0x4fc433[_0xebd3('0x2a')],'countnosuchnumberretry':_0x4982d9[_0xebd3('0x2b')],'countdropretry':_0x4982d9[_0xebd3('0x24')],'countabandonedretry':_0x4982d9['countabandonedretry'],'countmachineretry':_0x4982d9[_0xebd3('0x26')],'countagentrejectretry':_0x4982d9[_0xebd3('0x27')],'createdAt':_0x4fc433['createdAt'],'updatedAt':_0x4fc433[_0xebd3('0x36')]};logger[_0xebd3('0xe')](_0xebd3('0x37'),_0x5168c4);logger[_0xebd3('0xe')](_0xebd3('0x38'),_0x1332cc);return db[_0xebd3('0x39')][_0xebd3('0x3a')](function(_0xe5de62){return db[_0xebd3('0x1f')][_0xebd3('0x3b')](_0x5168c4,{'where':{'id':_0x4fc433['id']}},{'transaction':_0xe5de62})[_0xebd3('0xd')](function(){return db[_0xebd3('0x18')][_0xebd3('0x3b')](_0x1332cc,{'where':{'id':_0x3d8268['id']}},{'transaction':_0xe5de62});});})[_0xebd3('0xd')](function(_0x390491){_0x97f66c({'id':_0x3d8268['id'],'phone':_0x4fc433[_0xebd3('0x33')]});})[_0xebd3('0x17')](function(_0x33bda4){logger['error'](_0xebd3('0x2c'),_0x33bda4[_0xebd3('0x14')],req);_0x1dfc51(_this[_0xebd3('0x12')](0x1f4,_0x33bda4[_0xebd3('0x14')]));});});}exports[_0xebd3('0x3c')]=function(_0x2e20a0){var _0x585e98=this;return new Promise(function(_0x3e6ad4,_0xe01db0){return db['CmHopper'][_0xebd3('0x3b')](_0x2e20a0[_0xebd3('0x1a')][_0xebd3('0x3d')],{'where':{'id':_0x2e20a0['body']['id']}})[_0xebd3('0xd')](function(_0x40ddc9){_0x3e6ad4(_0x40ddc9);})[_0xebd3('0x17')](function(_0x5063ed){logger[_0xebd3('0x12')](_0xebd3('0x3c'),_0x5063ed['message'],_0x2e20a0);_0xe01db0(_0x585e98['error'](0x1f4,_0x5063ed[_0xebd3('0x14')]));});});}; \ No newline at end of file +var _0x5273=['info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','countdropretry','SwapAdditionalPhones','waitTime','scheduledat','add','minutes','phone','isNil','countnosuchnumberretry','createdAt','updatedAt','hopperToAdd','transaction','update','IncrementPreviewCounters','field','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x4fa665,_0x1ae12a){var _0x62ccff=function(_0x4f0bb8){while(--_0x4f0bb8){_0x4fa665['push'](_0x4fa665['shift']());}};_0x62ccff(++_0x1ae12a);}(_0x5273,0x1eb));var _0x3527=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5273[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3527('0x0'));var util=require(_0x3527('0x1'));var moment=require(_0x3527('0x2'));var BPromise=require(_0x3527('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3527('0x4'));var db=require(_0x3527('0x5'))['db'];var utils=require(_0x3527('0x6'));var logger=require('../../config/logger')(_0x3527('0x7'));var config=require(_0x3527('0x8'));var jayson=require(_0x3527('0x9'));var client=jayson[_0x3527('0xa')][_0x3527('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d6718,_0x5c4092,_0x3973bd){return new BPromise(function(_0x5cf7a3,_0x28ad1e){return client['request'](_0x2d6718,_0x3973bd)[_0x3527('0xc')](function(_0x172c51){logger[_0x3527('0xd')](_0x3527('0xe'),_0x5c4092,'request\x20sent');logger[_0x3527('0xf')](_0x3527('0x10'),_0x5c4092,_0x3527('0x11'),JSON[_0x3527('0x12')](_0x172c51));if(_0x172c51[_0x3527('0x13')]){if(_0x172c51[_0x3527('0x13')]['code']===0x1f4){logger['error'](_0x3527('0xe'),_0x5c4092,_0x172c51['error'][_0x3527('0x14')]);return _0x28ad1e(_0x172c51['error']['message']);}logger[_0x3527('0x13')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5c4092,_0x172c51[_0x3527('0x13')]['message']);return _0x5cf7a3(_0x172c51[_0x3527('0x13')][_0x3527('0x14')]);}else{logger[_0x3527('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5c4092,_0x3527('0x11'));_0x5cf7a3(_0x172c51[_0x3527('0x15')][_0x3527('0x14')]);}})[_0x3527('0x16')](function(_0x546576){logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x5c4092,_0x546576);_0x28ad1e(_0x546576);});});}exports[_0x3527('0x17')]=function(_0x2a2226){var _0x2e9ab9=this;return new Promise(function(_0x25f3f7,_0x5621eb){return db[_0x3527('0x18')][_0x3527('0x19')]({'raw':!![],'where':{'ContactId':_0x2a2226[_0x3527('0x1a')]['ContactId'],'ListId':_0x2a2226[_0x3527('0x1a')][_0x3527('0x1b')],'VoiceQueueId':_0x2a2226['body'][_0x3527('0x1c')]===undefined?null:_0x2a2226['body']['VoiceQueueId'],'CampaignId':_0x2a2226[_0x3527('0x1a')][_0x3527('0x1d')]===undefined?null:_0x2a2226[_0x3527('0x1a')][_0x3527('0x1d')]}})[_0x3527('0xc')](function(_0x589c11){if(_0x589c11!=null){return db[_0x3527('0x1e')][_0x3527('0x19')]({'raw':!![],'where':{'CmHopperId':_0x589c11['id'],'OrderBy':{'$gt':_0x589c11[_0x3527('0x1f')]}},'order':[[_0x3527('0x1f'),_0x3527('0x20')]]})[_0x3527('0xc')](function(_0x5905d3){var _0x2aef6a=0x0;if(_0x5905d3){if(_0x5905d3[_0x3527('0x21')]+_0x5905d3[_0x3527('0x22')]+_0x5905d3[_0x3527('0x23')]+_0x5905d3['countnosuchnumberretry']+_0x5905d3['countdropretry']+_0x5905d3[_0x3527('0x24')]+_0x5905d3[_0x3527('0x25')]+_0x5905d3[_0x3527('0x26')]<_0x2a2226['entity'][_0x3527('0x27')])_0x2aef6a=0x1;_0x25f3f7({'additional':_0x2aef6a});}else{return db[_0x3527('0x1e')][_0x3527('0x19')]({'raw':!![],'where':{'CmHopperId':_0x589c11['id']},'order':[[_0x3527('0x1f'),_0x3527('0x20')]]})[_0x3527('0xc')](function(_0x202695){var _0x45af1e=0x0;if(_0x202695){if(_0x202695['countbusyretry']+_0x202695[_0x3527('0x22')]+_0x202695[_0x3527('0x23')]+_0x202695['countnosuchnumberretry']+_0x202695[_0x3527('0x28')]+_0x202695[_0x3527('0x24')]+_0x202695[_0x3527('0x25')]+_0x202695[_0x3527('0x26')]<_0x2a2226['entity'][_0x3527('0x27')])_0x45af1e=0x1;_0x25f3f7({'additional':_0x45af1e});}else{_0x25f3f7({'additional':0x0});}})[_0x3527('0x16')](function(_0x474071){logger['error'](_0x3527('0x17'),_0x474071[_0x3527('0x14')],_0x2a2226);_0x5621eb(_0x2e9ab9[_0x3527('0x13')](0x1f4,_0x474071[_0x3527('0x14')]));});}})[_0x3527('0x16')](function(_0x4d90bd){logger[_0x3527('0x13')](_0x3527('0x17'),_0x4d90bd['message'],_0x2a2226);_0x5621eb(_0x2e9ab9['error'](0x1f4,_0x4d90bd['message']));});}else _0x25f3f7({'additional':0x0});});});};exports[_0x3527('0x29')]=function(_0x66f919){var _0x59def1=this;return new Promise(function(_0x32ac7f,_0x48e1f2){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x66f919[_0x3527('0x1a')]['ContactId'],'ListId':_0x66f919[_0x3527('0x1a')][_0x3527('0x1b')],'VoiceQueueId':_0x66f919['body'][_0x3527('0x1c')]===undefined?null:_0x66f919[_0x3527('0x1a')]['VoiceQueueId'],'CampaignId':_0x66f919[_0x3527('0x1a')][_0x3527('0x1d')]===undefined?null:_0x66f919[_0x3527('0x1a')]['CampaignId']}})['then'](function(_0x42bc32){if(_0x42bc32!=null){return db['CmHopperAdditionalPhone'][_0x3527('0x19')]({'raw':!![],'where':{'CmHopperId':_0x42bc32['id'],'OrderBy':{'$gt':_0x42bc32[_0x3527('0x1f')]}},'order':[['OrderBy','ASC']]})[_0x3527('0xc')](function(_0x544f6f){if(_0x544f6f)return activateAdditionalPhone(_0x42bc32,_0x66f919['body'],_0x544f6f,_0x66f919['duration'],_0x66f919['waitTime'])[_0x3527('0xc')](function(_0x17bf30){_0x32ac7f(_0x17bf30);});else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x42bc32['id']},'order':[[_0x3527('0x1f'),_0x3527('0x20')]]})[_0x3527('0xc')](function(_0x1e92de){if(_0x1e92de)return activateAdditionalPhone(_0x42bc32,_0x66f919[_0x3527('0x1a')],_0x1e92de,_0x66f919['duration'],_0x66f919[_0x3527('0x2a')])[_0x3527('0xc')](function(_0x424301){_0x32ac7f(_0x424301);});else{_0x32ac7f({'id':_0x42bc32['id'],'phone':''});}})[_0x3527('0x16')](function(_0x25ffc6){logger[_0x3527('0x13')]('VerifyAdditionalPhones',_0x25ffc6['message'],_0x66f919);_0x48e1f2(_0x59def1[_0x3527('0x13')](0x1f4,_0x25ffc6[_0x3527('0x14')]));});}})[_0x3527('0x16')](function(_0x3de451){logger['error'](_0x3527('0x17'),_0x3de451[_0x3527('0x14')],_0x66f919);_0x48e1f2(_0x59def1['error'](0x1f4,_0x3de451[_0x3527('0x14')]));});}else _0x32ac7f(0x1);});});};function activateAdditionalPhone(_0x34cf19,_0x3d9195,_0x46d1d9,_0x22a751,_0x1728fc){return new Promise(function(_0x2ad202,_0x505028){logger[_0x3527('0xd')]('VerifyAdditionalPhones',_0x46d1d9);var _0x448844;if(moment()>moment(_0x46d1d9[_0x3527('0x2b')])){_0x448844=moment()[_0x3527('0x2c')](_0x1728fc||0x3,_0x3527('0x2d'));}else{if(_0x46d1d9[_0x3527('0x1f')]==0x0){_0x448844=moment(_0x46d1d9[_0x3527('0x2b')]);}else{_0x448844=moment()['add'](_0x1728fc||0x3,_0x3527('0x2d'));}}var _0x340218={'phone':_0x34cf19[_0x3527('0x2e')],'active':0x0,'OrderBy':_[_0x3527('0x2f')](_0x34cf19[_0x3527('0x1f')])?0x0:_0x34cf19[_0x3527('0x1f')],'scheduledat':moment()[_0x3527('0x2c')](_0x22a751||0x1,_0x3527('0x2d')),'countbusyretry':_0x3d9195[_0x3527('0x21')],'countcongestionretry':_0x3d9195[_0x3527('0x22')],'countnoanswerretry':_0x3d9195[_0x3527('0x23')],'countnosuchnumberretry':_0x3d9195[_0x3527('0x30')],'countdropretry':_0x3d9195[_0x3527('0x28')],'countabandonedretry':_0x3d9195[_0x3527('0x24')],'countmachineretry':_0x3d9195[_0x3527('0x25')],'countagentrejectretry':_0x3d9195[_0x3527('0x26')],'createdAt':_0x3d9195[_0x3527('0x31')],'updatedAt':_0x3d9195[_0x3527('0x32')]};var _0x22631d={'CmHopperId':_0x34cf19['id'],'phone':_0x46d1d9[_0x3527('0x2e')],'active':0x0,'OrderBy':_['isNil'](_0x46d1d9[_0x3527('0x1f')])?0x0:_0x46d1d9[_0x3527('0x1f')],'scheduledat':_0x448844,'countbusyretry':_0x46d1d9[_0x3527('0x21')],'countcongestionretry':_0x46d1d9['countcongestionretry'],'countnoanswerretry':_0x46d1d9['countnoanswerretry'],'countnosuchnumberretry':_0x3d9195['countnosuchnumberretry'],'countdropretry':_0x3d9195[_0x3527('0x28')],'countabandonedretry':_0x3d9195['countabandonedretry'],'countmachineretry':_0x3d9195[_0x3527('0x25')],'countagentrejectretry':_0x3d9195[_0x3527('0x26')],'createdAt':_0x46d1d9[_0x3527('0x31')],'updatedAt':_0x46d1d9[_0x3527('0x32')]};logger[_0x3527('0xd')](_0x3527('0x33'),_0x340218);logger[_0x3527('0xd')]('additionalToHop',_0x22631d);return db['sequelize'][_0x3527('0x34')](function(_0x59b1cc){return db[_0x3527('0x1e')][_0x3527('0x35')](_0x340218,{'where':{'id':_0x46d1d9['id']}},{'transaction':_0x59b1cc})[_0x3527('0xc')](function(){return db[_0x3527('0x18')][_0x3527('0x35')](_0x22631d,{'where':{'id':_0x34cf19['id']}},{'transaction':_0x59b1cc});});})['then'](function(_0xb4f1ac){_0x2ad202({'id':_0x34cf19['id'],'phone':_0x46d1d9['phone']});})[_0x3527('0x16')](function(_0x49dcc1){logger[_0x3527('0x13')]('VerifyAdditionalPhones',_0x49dcc1['message'],req);_0x505028(_this[_0x3527('0x13')](0x1f4,_0x49dcc1[_0x3527('0x14')]));});});}exports[_0x3527('0x36')]=function(_0x58a92e){var _0x528dee=this;return new Promise(function(_0xf59c35,_0xbfa23c){return db['CmHopper'][_0x3527('0x35')](_0x58a92e[_0x3527('0x1a')][_0x3527('0x37')],{'where':{'id':_0x58a92e[_0x3527('0x1a')]['id']}})['then'](function(_0x499205){_0xf59c35(_0x499205);})['catch'](function(_0x538a42){logger[_0x3527('0x13')](_0x3527('0x36'),_0x538a42[_0x3527('0x14')],_0x58a92e);_0xbfa23c(_0x528dee[_0x3527('0x13')](0x1f4,_0x538a42[_0x3527('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 4826106..45c2e2b 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x47b1=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy'];(function(_0x109fda,_0x5d9c34){var _0xc3a898=function(_0x5c1850){while(--_0x5c1850){_0x109fda['push'](_0x109fda['shift']());}};_0xc3a898(++_0x5d9c34);}(_0x47b1,0x143));var _0x147b=function(_0x1b0280,_0x35e0b8){_0x1b0280=_0x1b0280-0x0;var _0x415860=_0x47b1[_0x1b0280];return _0x415860;};'use strict';var multer=require('multer');var util=require(_0x147b('0x0'));var path=require(_0x147b('0x1'));var timeout=require(_0x147b('0x2'));var express=require(_0x147b('0x3'));var router=express[_0x147b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x147b('0x5'));var config=require(_0x147b('0x6'));var controller=require(_0x147b('0x7'));router[_0x147b('0x8')]('/',auth[_0x147b('0x9')](),controller[_0x147b('0xa')]);router[_0x147b('0x8')](_0x147b('0xb'),auth[_0x147b('0x9')](),controller[_0x147b('0xc')]);router['post']('/',auth[_0x147b('0x9')](),controller[_0x147b('0xd')]);router[_0x147b('0xe')](_0x147b('0xb'),auth[_0x147b('0x9')](),controller['update']);router[_0x147b('0xf')](_0x147b('0xb'),auth['isAuthenticated'](),controller[_0x147b('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8ce5=['../../config/environment','./cmHopperAdditionalPhone.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','util','Router','../../components/auth/service'];(function(_0x72feca,_0x4d6730){var _0x2ec5a9=function(_0x2d3b6e){while(--_0x2d3b6e){_0x72feca['push'](_0x72feca['shift']());}};_0x2ec5a9(++_0x4d6730);}(_0x8ce5,0x17d));var _0x58ce=function(_0x31508e,_0x46c25e){_0x31508e=_0x31508e-0x0;var _0x226068=_0x8ce5[_0x31508e];return _0x226068;};'use strict';var multer=require('multer');var util=require(_0x58ce('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x58ce('0x1')]();var auth=require(_0x58ce('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x58ce('0x3'));var controller=require(_0x58ce('0x4'));router[_0x58ce('0x5')]('/',auth['isAuthenticated'](),controller[_0x58ce('0x6')]);router[_0x58ce('0x5')](_0x58ce('0x7'),auth[_0x58ce('0x8')](),controller[_0x58ce('0x9')]);router[_0x58ce('0xa')]('/',auth[_0x58ce('0x8')](),controller[_0x58ce('0xb')]);router[_0x58ce('0xc')](_0x58ce('0x7'),auth[_0x58ce('0x8')](),controller['update']);router[_0x58ce('0xd')](_0x58ce('0x7'),auth[_0x58ce('0x8')](),controller[_0x58ce('0xe')]);module[_0x58ce('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 267f047..2afb31a 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 _0xf45d=['moment','sequelize','INTEGER','contactListQueue'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xf45d,0x128));var _0xdf45=function(_0x233414,_0x1c0f22){_0x233414=_0x233414-0x0;var _0x18f78e=_0xf45d[_0x233414];return _0x18f78e;};'use strict';var moment=require(_0xdf45('0x0'));var Sequelize=require(_0xdf45('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xdf45('0x2')],'unique':_0xdf45('0x3')},'ListId':{'type':Sequelize[_0xdf45('0x2')],'unique':_0xdf45('0x3')},'VoiceQueueId':{'type':Sequelize[_0xdf45('0x2')],'unique':_0xdf45('0x3')}}; \ No newline at end of file +var _0xc917=['sequelize','STRING','INTEGER','contactListQueue','moment'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xc917,0xd1));var _0x7c91=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0xc917[_0x511bd1];return _0x4c48ec;};'use strict';var moment=require(_0x7c91('0x0'));var Sequelize=require(_0x7c91('0x1'));module['exports']={'phone':{'type':Sequelize[_0x7c91('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x7c91('0x3')],'unique':_0x7c91('0x4')},'ListId':{'type':Sequelize[_0x7c91('0x3')],'unique':_0x7c91('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x7c91('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 398804f..29f1d3e 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 _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x526ad7,_0x2a99c0){var _0x4f64e6=function(_0x4ddc32){while(--_0x4ddc32){_0x526ad7['push'](_0x526ad7['shift']());}};_0x4f64e6(++_0x2a99c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','body','find','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x1ad1e2,_0x5746b2){var _0xfeab08=function(_0x3c4c55){while(--_0x3c4c55){_0x1ad1e2['push'](_0x1ad1e2['shift']());}};_0xfeab08(++_0x5746b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x1e')]=function(_0x2e8caf,_0xbe9d19){if(_0x2e8caf[_0x0a9e('0x42')]['id']){delete _0x2e8caf[_0x0a9e('0x42')]['id'];}return db['CmHopperBlack'][_0x0a9e('0x43')]({'where':{'id':_0x2e8caf['params']['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0xbe9d19,null))[_0x0a9e('0x1f')](saveUpdates(_0x2e8caf[_0x0a9e('0x42')],null))['then'](respondWithResult(_0xbe9d19,null))[_0x0a9e('0x3f')](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x20')]=function(_0x4774f4,_0x34aa5a){return db[_0x0a9e('0x27')][_0x0a9e('0x43')]({'where':{'id':_0x4774f4[_0x0a9e('0x40')]['id']}})['then'](handleEntityNotFound(_0x34aa5a,null))[_0x0a9e('0x1f')](removeEntity(_0x34aa5a,null))[_0x0a9e('0x3f')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x44')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]()[_0x0a9e('0x1f')](respondWithResult(_0x409789,null))[_0x0a9e('0x3f')](handleError(_0x409789,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index a662a02..8f9390b 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 _0xa9e0=['../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1238db,_0xc6094e){var _0x2b26c=function(_0xa64bc){while(--_0xa64bc){_0x1238db['push'](_0x1238db['shift']());}};_0x2b26c(++_0xc6094e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./cmHopperBlack.attributes','exports','define','cm_hopper_black','../../config/logger','api','moment','bluebird','path'];(function(_0x1dcace,_0x8b01c1){var _0xefd218=function(_0x50d063){while(--_0x50d063){_0x1dcace['push'](_0x1dcace['shift']());}};_0xefd218(++_0x8b01c1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xcb91[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('CmHopperBlack',attributes,{'tableName':_0x1cb9('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 829953c..6b940b2 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 _0x2d14=['request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','findAll','options','raw','where','limit','include','map','model','attributes','then','GetCmHopperBlack','UpdateCmHopperBlack','CmHopperBlack','update','catch','DestroyCmHopperBlack','destroy','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','info','CmHopperBlack,\x20%s,\x20%s'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0x2d14,0xa7));var _0x42d1=function(_0x25ad8e,_0x19756a){_0x25ad8e=_0x25ad8e-0x0;var _0xf9405d=_0x2d14[_0x25ad8e];return _0xf9405d;};'use strict';var _=require(_0x42d1('0x0'));var util=require(_0x42d1('0x1'));var moment=require(_0x42d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x42d1('0x3'));var fs=require('fs');var Redis=require(_0x42d1('0x4'));var db=require(_0x42d1('0x5'))['db'];var utils=require(_0x42d1('0x6'));var logger=require(_0x42d1('0x7'))(_0x42d1('0x8'));var config=require(_0x42d1('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x126911,_0xcb0235,_0x2c29e0){return new BPromise(function(_0x2c4e85,_0x8cd57c){return client[_0x42d1('0xa')](_0x126911,_0x2c29e0)['then'](function(_0x3b9c41){logger[_0x42d1('0xb')](_0x42d1('0xc'),_0xcb0235,_0x42d1('0xd'));logger[_0x42d1('0xe')](_0x42d1('0xf'),_0xcb0235,'request\x20sent',JSON[_0x42d1('0x10')](_0x3b9c41));if(_0x3b9c41[_0x42d1('0x11')]){if(_0x3b9c41['error']['code']===0x1f4){logger[_0x42d1('0x11')](_0x42d1('0xc'),_0xcb0235,_0x3b9c41[_0x42d1('0x11')][_0x42d1('0x12')]);return _0x8cd57c(_0x3b9c41[_0x42d1('0x11')][_0x42d1('0x12')]);}logger[_0x42d1('0x11')](_0x42d1('0xc'),_0xcb0235,_0x3b9c41[_0x42d1('0x11')]['message']);return _0x2c4e85(_0x3b9c41[_0x42d1('0x11')][_0x42d1('0x12')]);}else{logger['info'](_0x42d1('0xc'),_0xcb0235,_0x42d1('0xd'));_0x2c4e85(_0x3b9c41['result'][_0x42d1('0x12')]);}})['catch'](function(_0x5c3769){logger[_0x42d1('0x11')](_0x42d1('0xc'),_0xcb0235,_0x5c3769);_0x8cd57c(_0x5c3769);});});}exports['GetCmHopperBlack']=function(_0x2ab4db){var _0x4e9613=this;return new Promise(function(_0x4a482a,_0x3f4d02){return db['CmHopperBlack'][_0x42d1('0x13')]({'raw':_0x2ab4db[_0x42d1('0x14')]?_0x2ab4db['options'][_0x42d1('0x15')]===undefined?!![]:![]:!![],'where':_0x2ab4db[_0x42d1('0x14')]?_0x2ab4db[_0x42d1('0x14')][_0x42d1('0x16')]||null:null,'attributes':_0x2ab4db['options']?_0x2ab4db[_0x42d1('0x14')]['attributes']||null:null,'limit':_0x2ab4db[_0x42d1('0x14')]?_0x2ab4db['options'][_0x42d1('0x17')]||null:null,'include':_0x2ab4db[_0x42d1('0x14')]?_0x2ab4db[_0x42d1('0x14')][_0x42d1('0x18')]?_[_0x42d1('0x19')](_0x2ab4db[_0x42d1('0x14')][_0x42d1('0x18')],function(_0x45dcf3){return{'model':db[_0x45dcf3[_0x42d1('0x1a')]],'as':_0x45dcf3['as'],'attributes':_0x45dcf3[_0x42d1('0x1b')],'include':_0x45dcf3['include']?_['map'](_0x45dcf3[_0x42d1('0x18')],function(_0x339f98){return{'model':db[_0x339f98['model']],'as':_0x339f98['as'],'attributes':_0x339f98[_0x42d1('0x1b')],'include':_0x339f98[_0x42d1('0x18')]?_[_0x42d1('0x19')](_0x339f98[_0x42d1('0x18')],function(_0x5b5827){return{'model':db[_0x5b5827[_0x42d1('0x1a')]],'as':_0x5b5827['as'],'attributes':_0x5b5827['attributes']};}):[]};}):[]};}):[]:[]})[_0x42d1('0x1c')](function(_0x3deee7){logger['info'](_0x42d1('0x1d'),_0x2ab4db);logger[_0x42d1('0xe')](_0x42d1('0x1d'),_0x2ab4db,JSON[_0x42d1('0x10')](_0x3deee7));_0x4a482a(_0x3deee7);})['catch'](function(_0x12c47d){logger[_0x42d1('0x11')]('GetCmHopperBlack',_0x12c47d[_0x42d1('0x12')],_0x2ab4db);_0x3f4d02(_0x4e9613[_0x42d1('0x11')](0x1f4,_0x12c47d['message']));});});};exports[_0x42d1('0x1e')]=function(_0x568b46){var _0x2007eb=this;return new Promise(function(_0x1fe039,_0x26ec8b){return db[_0x42d1('0x1f')][_0x42d1('0x20')](_0x568b46['body'],{'raw':_0x568b46[_0x42d1('0x14')]?_0x568b46[_0x42d1('0x14')][_0x42d1('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x568b46[_0x42d1('0x14')]?_0x568b46['options']['where']||null:null,'attributes':_0x568b46[_0x42d1('0x14')]?_0x568b46[_0x42d1('0x14')][_0x42d1('0x1b')]||null:null,'limit':_0x568b46[_0x42d1('0x14')]?_0x568b46['options'][_0x42d1('0x17')]||null:null})[_0x42d1('0x1c')](function(_0x2bfcc1){logger[_0x42d1('0xb')](_0x42d1('0x1e'),_0x568b46);logger[_0x42d1('0xe')](_0x42d1('0x1e'),_0x568b46,JSON[_0x42d1('0x10')](_0x2bfcc1));_0x1fe039(_0x2bfcc1);})[_0x42d1('0x21')](function(_0x410d05){logger[_0x42d1('0x11')]('UpdateCmHopperBlack',_0x410d05[_0x42d1('0x12')],_0x568b46);_0x26ec8b(_0x2007eb[_0x42d1('0x11')](0x1f4,_0x410d05[_0x42d1('0x12')]));});});};exports[_0x42d1('0x22')]=function(_0x25a821){var _0x151765=this;return new Promise(function(_0x183b54,_0x1f1224){return db['CmHopperBlack'][_0x42d1('0x23')]({'where':_0x25a821[_0x42d1('0x14')]?_0x25a821[_0x42d1('0x14')][_0x42d1('0x16')]||null:null})['then'](function(_0x2b1675){logger[_0x42d1('0xb')](_0x42d1('0x22'),_0x25a821);logger[_0x42d1('0xe')]('DestroyCmHopperBlack',_0x25a821,JSON['stringify'](_0x2b1675));_0x183b54(_0x2b1675);})[_0x42d1('0x21')](function(_0x125b73){logger[_0x42d1('0x11')]('DestroyCmHopperBlack',_0x125b73[_0x42d1('0x12')],_0x25a821);_0x1f1224(_0x151765[_0x42d1('0x11')](0x1f4,_0x125b73[_0x42d1('0x12')]));});});}; \ No newline at end of file +var _0xff0e=['moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','include','model','debug','UpdateCmHopperBlack','update','DestroyCmHopperBlack','destroy','util'];(function(_0x12065e,_0x483306){var _0x1b4f98=function(_0x53f19d){while(--_0x53f19d){_0x12065e['push'](_0x12065e['shift']());}};_0x1b4f98(++_0x483306);}(_0xff0e,0x18b));var _0xeff0=function(_0x33fcc0,_0x1e66c6){_0x33fcc0=_0x33fcc0-0x0;var _0x49b9ad=_0xff0e[_0x33fcc0];return _0x49b9ad;};'use strict';var _=require('lodash');var util=require(_0xeff0('0x0'));var moment=require(_0xeff0('0x1'));var BPromise=require(_0xeff0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeff0('0x3'));var logger=require(_0xeff0('0x4'))(_0xeff0('0x5'));var config=require(_0xeff0('0x6'));var jayson=require(_0xeff0('0x7'));var client=jayson[_0xeff0('0x8')][_0xeff0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35939a,_0x35dfa8,_0x5a6990){return new BPromise(function(_0x403f4c,_0x43e331){return client[_0xeff0('0xa')](_0x35939a,_0x5a6990)[_0xeff0('0xb')](function(_0x42c2d6){logger[_0xeff0('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x35dfa8,_0xeff0('0xd'));logger['debug'](_0xeff0('0xe'),_0x35dfa8,_0xeff0('0xd'),JSON[_0xeff0('0xf')](_0x42c2d6));if(_0x42c2d6[_0xeff0('0x10')]){if(_0x42c2d6[_0xeff0('0x10')][_0xeff0('0x11')]===0x1f4){logger['error'](_0xeff0('0x12'),_0x35dfa8,_0x42c2d6[_0xeff0('0x10')][_0xeff0('0x13')]);return _0x43e331(_0x42c2d6[_0xeff0('0x10')][_0xeff0('0x13')]);}logger[_0xeff0('0x10')](_0xeff0('0x12'),_0x35dfa8,_0x42c2d6[_0xeff0('0x10')]['message']);return _0x403f4c(_0x42c2d6[_0xeff0('0x10')][_0xeff0('0x13')]);}else{logger[_0xeff0('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x35dfa8,_0xeff0('0xd'));_0x403f4c(_0x42c2d6[_0xeff0('0x14')][_0xeff0('0x13')]);}})[_0xeff0('0x15')](function(_0x3ea53c){logger[_0xeff0('0x10')](_0xeff0('0x12'),_0x35dfa8,_0x3ea53c);_0x43e331(_0x3ea53c);});});}exports[_0xeff0('0x16')]=function(_0x461205){var _0x4afe03=this;return new Promise(function(_0x564501,_0x43b2f4){return db[_0xeff0('0x17')]['findAll']({'raw':_0x461205[_0xeff0('0x18')]?_0x461205['options'][_0xeff0('0x19')]===undefined?!![]:![]:!![],'where':_0x461205[_0xeff0('0x18')]?_0x461205['options'][_0xeff0('0x1a')]||null:null,'attributes':_0x461205[_0xeff0('0x18')]?_0x461205[_0xeff0('0x18')][_0xeff0('0x1b')]||null:null,'limit':_0x461205[_0xeff0('0x18')]?_0x461205[_0xeff0('0x18')][_0xeff0('0x1c')]||null:null,'include':_0x461205['options']?_0x461205['options'][_0xeff0('0x1d')]?_['map'](_0x461205[_0xeff0('0x18')][_0xeff0('0x1d')],function(_0x1f87bf){return{'model':db[_0x1f87bf[_0xeff0('0x1e')]],'as':_0x1f87bf['as'],'attributes':_0x1f87bf[_0xeff0('0x1b')],'include':_0x1f87bf[_0xeff0('0x1d')]?_['map'](_0x1f87bf[_0xeff0('0x1d')],function(_0x2f10fd){return{'model':db[_0x2f10fd[_0xeff0('0x1e')]],'as':_0x2f10fd['as'],'attributes':_0x2f10fd[_0xeff0('0x1b')],'include':_0x2f10fd[_0xeff0('0x1d')]?_['map'](_0x2f10fd[_0xeff0('0x1d')],function(_0x263115){return{'model':db[_0x263115[_0xeff0('0x1e')]],'as':_0x263115['as'],'attributes':_0x263115[_0xeff0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xeff0('0xb')](function(_0x41cee5){logger[_0xeff0('0xc')]('GetCmHopperBlack',_0x461205);logger[_0xeff0('0x1f')](_0xeff0('0x16'),_0x461205,JSON[_0xeff0('0xf')](_0x41cee5));_0x564501(_0x41cee5);})['catch'](function(_0x355e7f){logger[_0xeff0('0x10')](_0xeff0('0x16'),_0x355e7f[_0xeff0('0x13')],_0x461205);_0x43b2f4(_0x4afe03['error'](0x1f4,_0x355e7f['message']));});});};exports[_0xeff0('0x20')]=function(_0x32b3d1){var _0x461194=this;return new Promise(function(_0x5abaf0,_0x9c1bda){return db[_0xeff0('0x17')][_0xeff0('0x21')](_0x32b3d1['body'],{'raw':_0x32b3d1[_0xeff0('0x18')]?_0x32b3d1['options'][_0xeff0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32b3d1[_0xeff0('0x18')]?_0x32b3d1[_0xeff0('0x18')]['where']||null:null,'attributes':_0x32b3d1['options']?_0x32b3d1[_0xeff0('0x18')]['attributes']||null:null,'limit':_0x32b3d1[_0xeff0('0x18')]?_0x32b3d1['options'][_0xeff0('0x1c')]||null:null})['then'](function(_0x209920){logger[_0xeff0('0xc')](_0xeff0('0x20'),_0x32b3d1);logger[_0xeff0('0x1f')](_0xeff0('0x20'),_0x32b3d1,JSON[_0xeff0('0xf')](_0x209920));_0x5abaf0(_0x209920);})['catch'](function(_0xf5c6a9){logger[_0xeff0('0x10')]('UpdateCmHopperBlack',_0xf5c6a9[_0xeff0('0x13')],_0x32b3d1);_0x9c1bda(_0x461194[_0xeff0('0x10')](0x1f4,_0xf5c6a9[_0xeff0('0x13')]));});});};exports[_0xeff0('0x22')]=function(_0x45ae8c){var _0x2a2f26=this;return new Promise(function(_0x3faaa5,_0x5ab2d9){return db['CmHopperBlack'][_0xeff0('0x23')]({'where':_0x45ae8c['options']?_0x45ae8c[_0xeff0('0x18')][_0xeff0('0x1a')]||null:null})['then'](function(_0x1b0376){logger[_0xeff0('0xc')](_0xeff0('0x22'),_0x45ae8c);logger[_0xeff0('0x1f')](_0xeff0('0x22'),_0x45ae8c,JSON[_0xeff0('0xf')](_0x1b0376));_0x3faaa5(_0x1b0376);})[_0xeff0('0x15')](function(_0x3260d5){logger[_0xeff0('0x10')](_0xeff0('0x22'),_0x3260d5[_0xeff0('0x13')],_0x45ae8c);_0x5ab2d9(_0x2a2f26[_0xeff0('0x10')](0x1f4,_0x3260d5[_0xeff0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 38c34d5..cb39b27 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 _0xedd9=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','update','delete','destroy','util','path','connect-timeout','express'];(function(_0x30eef7,_0x424367){var _0x1f40c8=function(_0x10bf67){while(--_0x10bf67){_0x30eef7['push'](_0x30eef7['shift']());}};_0x1f40c8(++_0x424367);}(_0xedd9,0xfc));var _0x9edd=function(_0x6d3cdf,_0x5aa799){_0x6d3cdf=_0x6d3cdf-0x0;var _0x310807=_0xedd9[_0x6d3cdf];return _0x310807;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./cmHopperBlack.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/describe',auth[_0x9edd('0x9')](),controller['describe']);router[_0x9edd('0x8')](_0x9edd('0xb'),auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router['put'](_0x9edd('0xb'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/:id',auth[_0x9edd('0x9')](),controller[_0x9edd('0xf')]);module['exports']=router; \ No newline at end of file +var _0x7217=['multer','path','connect-timeout','express','Router','../../components/auth/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','delete','destroy','exports'];(function(_0x2885db,_0x19d7f9){var _0xb365d8=function(_0x81f0e6){while(--_0x81f0e6){_0x2885db['push'](_0x2885db['shift']());}};_0xb365d8(++_0x19d7f9);}(_0x7217,0x19e));var _0x7721=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x7217[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var auth=require(_0x7721('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7721('0x6'));router[_0x7721('0x7')]('/',auth[_0x7721('0x8')](),controller[_0x7721('0x9')]);router[_0x7721('0x7')](_0x7721('0xa'),auth[_0x7721('0x8')](),controller[_0x7721('0xb')]);router[_0x7721('0x7')](_0x7721('0xc'),auth[_0x7721('0x8')](),controller[_0x7721('0xd')]);router[_0x7721('0xe')](_0x7721('0xc'),auth[_0x7721('0x8')](),controller['update']);router[_0x7721('0xf')](_0x7721('0xc'),auth[_0x7721('0x8')](),controller[_0x7721('0x10')]);module[_0x7721('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 68bb435..7d7dbe4 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 _0x6819=['getDataValue','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE'];(function(_0x189ede,_0x4dcb05){var _0x111291=function(_0x2554b1){while(--_0x2554b1){_0x189ede['push'](_0x189ede['shift']());}};_0x111291(++_0x4dcb05);}(_0x6819,0x66));var _0x9681=function(_0x2273b2,_0x49bd07){_0x2273b2=_0x2273b2-0x0;var _0xd7adf2=_0x6819[_0x2273b2];return _0xd7adf2;};'use strict';var Sequelize=require(_0x9681('0x0'));var moment=require(_0x9681('0x1'));module[_0x9681('0x2')]={'state':{'type':Sequelize[_0x9681('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x9681('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9681('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9681('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x9681('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x9681('0x4')]},'originatecalleridname':{'type':Sequelize[_0x9681('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9681('0x4')]},'starttime':{'type':Sequelize[_0x9681('0x5')]},'responsetime':{'type':Sequelize[_0x9681('0x5')]},'answertime':{'type':Sequelize[_0x9681('0x5')]},'droptime':{'type':Sequelize[_0x9681('0x5')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x9681('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x9681('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x9681('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9681('0x4')]},'campaign':{'type':Sequelize[_0x9681('0x4')]},'campaigntype':{'type':Sequelize[_0x9681('0x4')]},'membername':{'type':Sequelize[_0x9681('0x4')]},'reason':{'type':Sequelize[_0x9681('0x4')]},'disposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x9681('0x5')],'set':function(_0x429698){var _0x33ac77=this[_0x9681('0x6')]('endtime');if(_0x33ac77&&_0x429698){this[_0x9681('0x7')](_0x9681('0x8'),moment(_0x429698)[_0x9681('0x9')](moment(_0x33ac77),_0x9681('0xa')));}return this[_0x9681('0x7')]('dispositionat',_0x429698);}},'amd':{'type':Sequelize[_0x9681('0xb')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x9681('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x9681('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x9681('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9681('0x5')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x9681('0x5')]},'recallme':{'type':Sequelize[_0x9681('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x9681('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x9681('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9681('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9681('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9681('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xcbd8=['dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','DATE','STRING','endtime','setDataValue','followuptime','seconds'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xcbd8,0x92));var _0x8cbd=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcbd8[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x8cbd('0x0'));var moment=require(_0x8cbd('0x1'));module[_0x8cbd('0x2')]={'state':{'type':Sequelize[_0x8cbd('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x8cbd('0x4')]},'countbusyretry':{'type':Sequelize[_0x8cbd('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8cbd('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8cbd('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x8cbd('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8cbd('0x5')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x8cbd('0x5')]},'calleridname':{'type':Sequelize[_0x8cbd('0x5')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x8cbd('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x8cbd('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8cbd('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8cbd('0x5')]},'campaign':{'type':Sequelize[_0x8cbd('0x5')]},'campaigntype':{'type':Sequelize[_0x8cbd('0x5')]},'membername':{'type':Sequelize[_0x8cbd('0x5')]},'reason':{'type':Sequelize[_0x8cbd('0x5')]},'disposition':{'type':Sequelize[_0x8cbd('0x5')]},'dispositionat':{'type':Sequelize[_0x8cbd('0x4')],'set':function(_0x162a28){var _0x214e40=this['getDataValue'](_0x8cbd('0x6'));if(_0x214e40&&_0x162a28){this[_0x8cbd('0x7')](_0x8cbd('0x8'),moment(_0x162a28)['diff'](moment(_0x214e40),_0x8cbd('0x9')));}return this[_0x8cbd('0x7')](_0x8cbd('0xa'),_0x162a28);}},'amd':{'type':Sequelize[_0x8cbd('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8cbd('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x8cbd('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x8cbd('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x8cbd('0x4')]},'callback':{'type':Sequelize[_0x8cbd('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8cbd('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x8cbd('0x5')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x8cbd('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x8cbd('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x8cbd('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8cbd('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8cbd('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8cbd('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index b5a5ff9..3d58d85 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 _0xed54=['path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','CmHopperFinal','includeAll','include','findAll','show','params','options','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','abandonedContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','dropContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0xd70bc9,_0x5851fd){var _0x3707de=function(_0x2ef33a){while(--_0x2ef33a){_0xd70bc9['push'](_0xd70bc9['shift']());}};_0x3707de(++_0x5851fd);}(_0xed54,0xfc));var _0x4ed5=function(_0x578a1a,_0x4e9f3d){_0x578a1a=_0x578a1a-0x0;var _0x1064f5=_0xed54[_0x578a1a];return _0x1064f5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4ed5('0x0'));var rimraf=require(_0x4ed5('0x1'));var zipdir=require(_0x4ed5('0x2'));var jsonpatch=require(_0x4ed5('0x3'));var rp=require('request-promise');var moment=require(_0x4ed5('0x4'));var BPromise=require(_0x4ed5('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4ed5('0x6'));var sox=require(_0x4ed5('0x7'));var csv=require(_0x4ed5('0x8'));var ejs=require(_0x4ed5('0x9'));var fs=require('fs');var _=require(_0x4ed5('0xa'));var squel=require(_0x4ed5('0xb'));var crypto=require(_0x4ed5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x4ed5('0xd'));var toCsv=require(_0x4ed5('0x8'));var querystring=require(_0x4ed5('0xe'));var Papa=require(_0x4ed5('0xf'));var Redis=require(_0x4ed5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4ed5('0x11'));var as=require(_0x4ed5('0x12'));var hardwareService=require(_0x4ed5('0x13'));var logger=require(_0x4ed5('0x14'))(_0x4ed5('0x15'));var utils=require('../../config/utils');var config=require(_0x4ed5('0x16'));var db=require(_0x4ed5('0x17'))['db'];function respondWithStatusCode(_0x279222,_0x72b1bd){_0x72b1bd=_0x72b1bd||0xcc;return function(_0x409d5b){if(_0x409d5b){return _0x279222[_0x4ed5('0x18')](_0x72b1bd);}return _0x279222[_0x4ed5('0x19')](_0x72b1bd)[_0x4ed5('0x1a')]();};}function respondWithResult(_0x4fe36b,_0x4c9fc0){_0x4c9fc0=_0x4c9fc0||0xc8;return function(_0xc946a1){if(_0xc946a1){return _0x4fe36b[_0x4ed5('0x19')](_0x4c9fc0)[_0x4ed5('0x1b')](_0xc946a1);}};}function respondWithFilteredResult(_0x4511f7,_0x27469b){return function(_0x148458){if(_0x148458){var _0x44b770=_0x148458[_0x4ed5('0x1c')],_0x234373=_0x27469b[_0x4ed5('0x1d')],_0x3997f3=_0x27469b[_0x4ed5('0x1d')]+_0x27469b[_0x4ed5('0x1e')],_0x218134;if(_0x3997f3>=_0x44b770){_0x3997f3=_0x44b770;_0x218134=0xc8;}else{_0x218134=0xce;}_0x4511f7[_0x4ed5('0x19')](_0x218134);return _0x4511f7[_0x4ed5('0x1f')]('Content-Range',_0x234373+'-'+_0x3997f3+'/'+_0x44b770)[_0x4ed5('0x1b')](_0x148458);}return null;};}function patchUpdates(_0x374c13){return function(_0x3bcbc4){try{jsonpatch['apply'](_0x3bcbc4,_0x374c13,!![]);}catch(_0x347bda){return BPromise[_0x4ed5('0x20')](_0x347bda);}return _0x3bcbc4[_0x4ed5('0x21')]();};}function saveUpdates(_0x1ffced,_0x1b4707){return function(_0xb734f7){if(_0xb734f7){return _0xb734f7[_0x4ed5('0x22')](_0x1ffced)[_0x4ed5('0x23')](function(_0x4d202e){return _0x4d202e;});}return null;};}function removeEntity(_0x2d6495,_0x2a2166){return function(_0x4f59d2){if(_0x4f59d2){return _0x4f59d2[_0x4ed5('0x24')]()['then'](function(){_0x2d6495['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1377ef,_0x506906){return function(_0x367593){if(!_0x367593){_0x1377ef[_0x4ed5('0x18')](0x194);}return _0x367593;};}function handleError(_0x3f1bd3,_0x2d59cd){_0x2d59cd=_0x2d59cd||0x1f4;return function(_0x3070a3){logger[_0x4ed5('0x25')](_0x3070a3[_0x4ed5('0x26')]);if(_0x3070a3['name']){delete _0x3070a3[_0x4ed5('0x27')];}_0x3f1bd3[_0x4ed5('0x19')](_0x2d59cd)[_0x4ed5('0x28')](_0x3070a3);};}exports[_0x4ed5('0x29')]=function(_0x438728,_0x47abe6){var _0x1dc880={},_0x204be7={},_0x34285f={'count':0x0,'rows':[]};var _0x5b302b=_[_0x4ed5('0x2a')](db['CmHopperFinal']['rawAttributes'],function(_0x2f3f5b){return{'name':_0x2f3f5b[_0x4ed5('0x2b')],'type':_0x2f3f5b['type'][_0x4ed5('0x2c')]};});_0x204be7[_0x4ed5('0x2d')]=_['map'](_0x5b302b,'name');_0x204be7[_0x4ed5('0x2e')]=_[_0x4ed5('0x2f')](_0x438728[_0x4ed5('0x2e')]);_0x204be7[_0x4ed5('0x30')]=_['intersection'](_0x204be7[_0x4ed5('0x2d')],_0x204be7[_0x4ed5('0x2e')]);_0x1dc880[_0x4ed5('0x31')]=_[_0x4ed5('0x32')](_0x204be7['model'],qs[_0x4ed5('0x33')](_0x438728['query']['fields']));_0x1dc880[_0x4ed5('0x31')]=_0x1dc880[_0x4ed5('0x31')]['length']?_0x1dc880['attributes']:_0x204be7[_0x4ed5('0x2d')];if(!_0x438728[_0x4ed5('0x2e')][_0x4ed5('0x34')]('nolimit')){_0x1dc880[_0x4ed5('0x1e')]=qs[_0x4ed5('0x1e')](_0x438728[_0x4ed5('0x2e')]['limit']);_0x1dc880['offset']=qs['offset'](_0x438728[_0x4ed5('0x2e')][_0x4ed5('0x1d')]);}_0x1dc880['order']=qs[_0x4ed5('0x35')](_0x438728['query']['sort']);_0x1dc880[_0x4ed5('0x36')]=qs['filters'](_[_0x4ed5('0x37')](_0x438728[_0x4ed5('0x2e')],_0x204be7[_0x4ed5('0x30')]),_0x5b302b);if(_0x438728[_0x4ed5('0x2e')][_0x4ed5('0x38')]){_0x1dc880[_0x4ed5('0x36')]=_[_0x4ed5('0x39')](_0x1dc880[_0x4ed5('0x36')],{'$or':_[_0x4ed5('0x2a')](_0x5b302b,function(_0x4f21a0){if(_0x4f21a0[_0x4ed5('0x3a')]!==_0x4ed5('0x3b')){var _0x16b201={};_0x16b201[_0x4f21a0['name']]={'$like':'%'+_0x438728['query']['filter']+'%'};return _0x16b201;}})});}_0x1dc880=_[_0x4ed5('0x39')]({},_0x1dc880,_0x438728['options']);var _0x4e33b1={'where':_0x1dc880[_0x4ed5('0x36')]};return db[_0x4ed5('0x3c')][_0x4ed5('0x1c')](_0x4e33b1)[_0x4ed5('0x23')](function(_0x2243cb){_0x34285f[_0x4ed5('0x1c')]=_0x2243cb;if(_0x438728[_0x4ed5('0x2e')][_0x4ed5('0x3d')]){_0x1dc880[_0x4ed5('0x3e')]=[{'all':!![]}];}return db[_0x4ed5('0x3c')][_0x4ed5('0x3f')](_0x1dc880);})[_0x4ed5('0x23')](function(_0x3f23c7){_0x34285f['rows']=_0x3f23c7;return _0x34285f;})['then'](respondWithFilteredResult(_0x47abe6,_0x1dc880))['catch'](handleError(_0x47abe6,null));};exports[_0x4ed5('0x40')]=function(_0x582874,_0x14d921){var _0xbf9c15={'raw':!![],'where':{'id':_0x582874[_0x4ed5('0x41')]['id']}},_0x4b8ca1={};_0x4b8ca1[_0x4ed5('0x2d')]=_['keys'](db[_0x4ed5('0x3c')]['rawAttributes']);_0x4b8ca1[_0x4ed5('0x2e')]=_[_0x4ed5('0x2f')](_0x582874[_0x4ed5('0x2e')]);_0x4b8ca1[_0x4ed5('0x30')]=_[_0x4ed5('0x32')](_0x4b8ca1[_0x4ed5('0x2d')],_0x4b8ca1[_0x4ed5('0x2e')]);_0xbf9c15[_0x4ed5('0x31')]=_[_0x4ed5('0x32')](_0x4b8ca1[_0x4ed5('0x2d')],qs[_0x4ed5('0x33')](_0x582874['query'][_0x4ed5('0x33')]));_0xbf9c15['attributes']=_0xbf9c15['attributes']['length']?_0xbf9c15[_0x4ed5('0x31')]:_0x4b8ca1[_0x4ed5('0x2d')];if(_0x582874[_0x4ed5('0x2e')][_0x4ed5('0x3d')]){_0xbf9c15[_0x4ed5('0x3e')]=[{'all':!![]}];}_0xbf9c15=_['merge']({},_0xbf9c15,_0x582874[_0x4ed5('0x42')]);return db[_0x4ed5('0x3c')][_0x4ed5('0x43')](_0xbf9c15)[_0x4ed5('0x23')](handleEntityNotFound(_0x14d921,null))[_0x4ed5('0x23')](respondWithResult(_0x14d921,null))[_0x4ed5('0x44')](handleError(_0x14d921,null));};exports[_0x4ed5('0x45')]=function(_0x48e87b,_0x1c4b29){return db[_0x4ed5('0x3c')][_0x4ed5('0x45')]()['then'](respondWithResult(_0x1c4b29,null))[_0x4ed5('0x44')](handleError(_0x1c4b29,null));};exports['update']=function(_0x19ea01,_0x5c71ec){if(_0x19ea01[_0x4ed5('0x46')][_0x4ed5('0x47')]){delete _0x19ea01['body'][_0x4ed5('0x47')];}return db[_0x4ed5('0x3c')][_0x4ed5('0x43')]({'where':{'uniqueid':_0x19ea01['params']['id']}})[_0x4ed5('0x23')](handleEntityNotFound(_0x5c71ec,null))[_0x4ed5('0x23')](saveUpdates(_0x19ea01[_0x4ed5('0x46')],null))[_0x4ed5('0x23')](respondWithResult(_0x5c71ec,null))[_0x4ed5('0x44')](handleError(_0x5c71ec,null));};exports[_0x4ed5('0x48')]=function(_0x3a241d,_0x23b9fa,_0x5a0c56){return db['CmHopperFinal'][_0x4ed5('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x3a241d['params']['id']},'attributes':[[db[_0x4ed5('0x49')]['fn'](_0x4ed5('0x4a'),db[_0x4ed5('0x49')]['fn']('IF',db[_0x4ed5('0x49')]['literal'](_0x4ed5('0x4b')))),_0x4ed5('0x4c')],[db[_0x4ed5('0x49')]['fn'](_0x4ed5('0x4a'),db[_0x4ed5('0x49')]['fn']('IF',db[_0x4ed5('0x49')][_0x4ed5('0x4d')](_0x4ed5('0x4e')))),_0x4ed5('0x4f')],[db[_0x4ed5('0x49')]['fn'](_0x4ed5('0x4a'),db[_0x4ed5('0x49')]['fn']('IF',db[_0x4ed5('0x49')][_0x4ed5('0x4d')](_0x4ed5('0x50')))),_0x4ed5('0x51')],[db[_0x4ed5('0x49')]['fn'](_0x4ed5('0x4a'),db['sequelize']['fn']('IF',db[_0x4ed5('0x49')][_0x4ed5('0x4d')](_0x4ed5('0x52')))),_0x4ed5('0x53')],[db['sequelize']['fn'](_0x4ed5('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0x4ed5('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db[_0x4ed5('0x49')]['fn'](_0x4ed5('0x4a'),db['sequelize']['fn']('IF',db[_0x4ed5('0x49')][_0x4ed5('0x4d')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x4ed5('0x54')],[db['sequelize']['fn']('COUNT',db[_0x4ed5('0x49')]['fn']('IF',db[_0x4ed5('0x49')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x4ed5('0x49')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4ed5('0x49')][_0x4ed5('0x4d')](_0x4ed5('0x55')))),_0x4ed5('0x56')]]})[_0x4ed5('0x23')](handleEntityNotFound(_0x23b9fa,null))[_0x4ed5('0x23')](respondWithResult(_0x23b9fa,null))[_0x4ed5('0x44')](handleError(_0x23b9fa,null));};exports[_0x4ed5('0x57')]=function(_0x3f780d,_0x409d8f,_0x133e39){return db['CmHopperFinal'][_0x4ed5('0x3f')]({'raw':![],'where':{'CampaignId':_0x3f780d['params']['id']},'attributes':[[db[_0x4ed5('0x49')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4ed5('0x49')][_0x4ed5('0x4d')](_0x4ed5('0x4b')))),_0x4ed5('0x4c')],[db['sequelize']['fn']('COUNT',db[_0x4ed5('0x49')]['fn']('IF',db[_0x4ed5('0x49')]['literal'](_0x4ed5('0x4e')))),_0x4ed5('0x4f')],[db[_0x4ed5('0x49')]['fn']('COUNT',db[_0x4ed5('0x49')]['fn']('IF',db['sequelize'][_0x4ed5('0x4d')](_0x4ed5('0x50')))),_0x4ed5('0x51')],[db[_0x4ed5('0x49')]['fn'](_0x4ed5('0x4a'),db[_0x4ed5('0x49')]['fn']('IF',db[_0x4ed5('0x49')][_0x4ed5('0x4d')](_0x4ed5('0x52')))),_0x4ed5('0x53')],[db[_0x4ed5('0x49')]['fn'](_0x4ed5('0x4a'),db[_0x4ed5('0x49')]['fn']('IF',db['sequelize'][_0x4ed5('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x4ed5('0x58')],[db['sequelize']['fn']('COUNT',db[_0x4ed5('0x49')]['fn']('IF',db['sequelize'][_0x4ed5('0x4d')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x4ed5('0x54')],[db[_0x4ed5('0x49')]['fn'](_0x4ed5('0x4a'),db['sequelize']['fn']('IF',db[_0x4ed5('0x49')]['literal'](_0x4ed5('0x59')))),_0x4ed5('0x5a')],[db['sequelize']['fn'](_0x4ed5('0x4a'),db['sequelize']['fn']('IF',db[_0x4ed5('0x49')][_0x4ed5('0x4d')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x4ed5('0x23')](handleEntityNotFound(_0x409d8f,null))[_0x4ed5('0x23')](respondWithResult(_0x409d8f,null))[_0x4ed5('0x44')](handleError(_0x409d8f,null));};exports[_0x4ed5('0x5b')]=function(_0x23d806,_0x2b0eb8,_0xee76c5){return db[_0x4ed5('0x5c')][_0x4ed5('0x43')]({'where':{'id':_0x23d806[_0x4ed5('0x41')]['id']}})[_0x4ed5('0x23')](handleEntityNotFound(_0x2b0eb8,null))[_0x4ed5('0x23')](function(_0x1e960c){var _0x1b0099;if(_0x1e960c){_0x1b0099=squel[_0x4ed5('0x5d')]()[_0x4ed5('0x5e')](_0x4ed5('0x5f'))[_0x4ed5('0x60')]([_0x4ed5('0x61'),_0x4ed5('0x62'),_0x4ed5('0x63'),_0x4ed5('0x64'),_0x4ed5('0x65'),'createdAt',_0x4ed5('0x66')],squel['select']()[_0x4ed5('0x67')](_0x4ed5('0x68'),_0x4ed5('0x61'))[_0x4ed5('0x67')](_0x4ed5('0x69'),_0x4ed5('0x62'))['field'](_0x4ed5('0x6a'),_0x4ed5('0x63'))['field'](_0x4ed5('0x6b'),_0x4ed5('0x64'))['field'](_0x4ed5('0x6c'),_0x4ed5('0x65'))['field'](_0x4ed5('0x69'),_0x4ed5('0x6d'))[_0x4ed5('0x67')](_0x4ed5('0x69'),_0x4ed5('0x66'))[_0x4ed5('0x6e')](_0x4ed5('0x6f'))['where'](_0x4ed5('0x70'),_0x23d806[_0x4ed5('0x41')]['id'][_0x4ed5('0x71')]())['where']('state\x20=\x20?',_0x23d806[_0x4ed5('0x46')][_0x4ed5('0x72')][_0x4ed5('0x71')]())[_0x4ed5('0x36')](_0x4ed5('0x73'))[_0x4ed5('0x36')](_0x4ed5('0x74'),squel[_0x4ed5('0x75')]()[_0x4ed5('0x67')](_0x4ed5('0x61'))[_0x4ed5('0x6e')]('cm_hopper')[_0x4ed5('0x36')]('VoiceQueueId\x20=\x20?',_0x23d806[_0x4ed5('0x41')]['id'][_0x4ed5('0x71')]()))['where'](_0x4ed5('0x74'),squel['select']()['field'](_0x4ed5('0x76'))['from'](_0x4ed5('0x6f'))['where'](_0x4ed5('0x70'),_0x23d806[_0x4ed5('0x41')]['id'][_0x4ed5('0x71')]())['where'](_0x4ed5('0x77')))[_0x4ed5('0x78')]('ContactId'))[_0x4ed5('0x71')]();return db[_0x4ed5('0x49')][_0x4ed5('0x2e')](_0x1b0099);}return[];})[_0x4ed5('0x23')](respondWithResult(_0x2b0eb8,null))[_0x4ed5('0x44')](handleError(_0x2b0eb8,null));};exports[_0x4ed5('0x79')]=function(_0xb1914e,_0x179186,_0xebef08){return db['Campaign'][_0x4ed5('0x43')]({'where':{'id':_0xb1914e['params']['id']}})[_0x4ed5('0x23')](handleEntityNotFound(_0x179186,null))[_0x4ed5('0x23')](function(_0xe4575b){var _0x598ec2;if(_0xe4575b){_0x598ec2=squel['insert']()[_0x4ed5('0x5e')](_0x4ed5('0x5f'))[_0x4ed5('0x60')]([_0x4ed5('0x61'),_0x4ed5('0x62'),_0x4ed5('0x63'),_0x4ed5('0x64'),_0x4ed5('0x7a'),_0x4ed5('0x6d'),_0x4ed5('0x66')],squel[_0x4ed5('0x75')]()[_0x4ed5('0x67')](_0x4ed5('0x68'),'phone')[_0x4ed5('0x67')](_0x4ed5('0x69'),_0x4ed5('0x62'))['field'](_0x4ed5('0x6a'),_0x4ed5('0x63'))[_0x4ed5('0x67')](_0x4ed5('0x6b'),_0x4ed5('0x64'))[_0x4ed5('0x67')](_0x4ed5('0x7b'),_0x4ed5('0x7a'))[_0x4ed5('0x67')]('NOW()','createdAt')[_0x4ed5('0x67')](_0x4ed5('0x69'),'updatedAt')[_0x4ed5('0x6e')](_0x4ed5('0x6f'))[_0x4ed5('0x36')](_0x4ed5('0x7c'),_0xb1914e[_0x4ed5('0x41')]['id'][_0x4ed5('0x71')]())[_0x4ed5('0x36')](_0x4ed5('0x7d'),_0xb1914e[_0x4ed5('0x46')]['state'][_0x4ed5('0x71')]())['where'](_0x4ed5('0x73'))['where'](_0x4ed5('0x74'),squel[_0x4ed5('0x75')]()[_0x4ed5('0x67')](_0x4ed5('0x61'))[_0x4ed5('0x6e')](_0x4ed5('0x5f'))[_0x4ed5('0x36')]('CampaignId\x20=\x20?',_0xb1914e[_0x4ed5('0x41')]['id'][_0x4ed5('0x71')]()))[_0x4ed5('0x36')](_0x4ed5('0x74'),squel[_0x4ed5('0x75')]()[_0x4ed5('0x67')](_0x4ed5('0x76'))[_0x4ed5('0x6e')](_0x4ed5('0x6f'))[_0x4ed5('0x36')](_0x4ed5('0x7c'),_0xb1914e[_0x4ed5('0x41')]['id'][_0x4ed5('0x71')]())[_0x4ed5('0x36')](_0x4ed5('0x77')))['group'](_0x4ed5('0x63')))['toString']();return db[_0x4ed5('0x49')][_0x4ed5('0x2e')](_0x598ec2);}return[];})['then'](respondWithResult(_0x179186,null))[_0x4ed5('0x44')](handleError(_0x179186,null));};exports[_0x4ed5('0x7e')]=function(_0x496c8b,_0x440b17,_0x3299d8){return db[_0x4ed5('0x7f')][_0x4ed5('0x80')]({'where':{'VoiceQueueId':_0x496c8b[_0x4ed5('0x46')][_0x4ed5('0x65')],'CampaignId':_0x496c8b['body'][_0x4ed5('0x7a')],'ContactId':_0x496c8b['body']['ContactId']}})[_0x4ed5('0x23')](handleEntityNotFound(_0x440b17,null))[_0x4ed5('0x23')](function(_0x19943f){if(_0x19943f){return _0x19943f;}return null;})['then'](respondWithResult(_0x440b17,null))[_0x4ed5('0x44')](handleError(_0x440b17,null));}; \ No newline at end of file +var _0xd1ca=['where','filters','pick','filter','merge','count','includeAll','include','catch','show','params','keys','options','find','describe','body','uniqueid','findAll','sequelize','COUNT','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`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','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','busyContacts','reCallContacts','answeringMachine','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','from','cm_hopper_final','state\x20=\x20?','toString','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId','state','calleridnum\x20IS\x20NOT\x20NULL','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','request-promise','moment','bluebird','util','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopperFinal','fieldName','type','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x2ce4d2,_0x4d8688){var _0x95af01=function(_0x3fd77b){while(--_0x3fd77b){_0x2ce4d2['push'](_0x2ce4d2['shift']());}};_0x95af01(++_0x4d8688);}(_0xd1ca,0x140));var _0xad1c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd1ca[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0xad1c('0x0'));var emlformat=require(_0xad1c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xad1c('0x2'));var moment=require(_0xad1c('0x3'));var BPromise=require(_0xad1c('0x4'));var Mustache=require('mustache');var util=require(_0xad1c('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xad1c('0x6'));var ejs=require(_0xad1c('0x7'));var fs=require('fs');var _=require(_0xad1c('0x8'));var squel=require('squel');var crypto=require(_0xad1c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xad1c('0xa'));var toCsv=require(_0xad1c('0x6'));var querystring=require(_0xad1c('0xb'));var Papa=require(_0xad1c('0xc'));var Redis=require(_0xad1c('0xd'));var authService=require(_0xad1c('0xe'));var qs=require(_0xad1c('0xf'));var as=require(_0xad1c('0x10'));var hardwareService=require(_0xad1c('0x11'));var logger=require(_0xad1c('0x12'))('api');var utils=require(_0xad1c('0x13'));var config=require(_0xad1c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4615a4,_0x7494c3){_0x7494c3=_0x7494c3||0xcc;return function(_0xd5bdd7){if(_0xd5bdd7){return _0x4615a4[_0xad1c('0x15')](_0x7494c3);}return _0x4615a4[_0xad1c('0x16')](_0x7494c3)[_0xad1c('0x17')]();};}function respondWithResult(_0xeebfde,_0x4ce86e){_0x4ce86e=_0x4ce86e||0xc8;return function(_0x324030){if(_0x324030){return _0xeebfde[_0xad1c('0x16')](_0x4ce86e)[_0xad1c('0x18')](_0x324030);}};}function respondWithFilteredResult(_0x5b6015,_0x210eba){return function(_0x494b59){if(_0x494b59){var _0x4194c0=_0x494b59['count'],_0x48c651=_0x210eba[_0xad1c('0x19')],_0x2173e5=_0x210eba['offset']+_0x210eba[_0xad1c('0x1a')],_0x8420de;if(_0x2173e5>=_0x4194c0){_0x2173e5=_0x4194c0;_0x8420de=0xc8;}else{_0x8420de=0xce;}_0x5b6015[_0xad1c('0x16')](_0x8420de);return _0x5b6015['set']('Content-Range',_0x48c651+'-'+_0x2173e5+'/'+_0x4194c0)[_0xad1c('0x18')](_0x494b59);}return null;};}function patchUpdates(_0xa353d8){return function(_0x20850d){try{jsonpatch[_0xad1c('0x1b')](_0x20850d,_0xa353d8,!![]);}catch(_0x519d1b){return BPromise[_0xad1c('0x1c')](_0x519d1b);}return _0x20850d[_0xad1c('0x1d')]();};}function saveUpdates(_0xa80469,_0x51d25c){return function(_0x5e2d17){if(_0x5e2d17){return _0x5e2d17[_0xad1c('0x1e')](_0xa80469)[_0xad1c('0x1f')](function(_0x328b63){return _0x328b63;});}return null;};}function removeEntity(_0x2b23eb,_0x1008c3){return function(_0x16f940){if(_0x16f940){return _0x16f940[_0xad1c('0x20')]()['then'](function(){_0x2b23eb[_0xad1c('0x16')](0xcc)[_0xad1c('0x17')]();});}};}function handleEntityNotFound(_0x2b33ab,_0x509c13){return function(_0x42e527){if(!_0x42e527){_0x2b33ab[_0xad1c('0x15')](0x194);}return _0x42e527;};}function handleError(_0x518a14,_0x3b3bf3){_0x3b3bf3=_0x3b3bf3||0x1f4;return function(_0x58b727){logger[_0xad1c('0x21')](_0x58b727[_0xad1c('0x22')]);if(_0x58b727[_0xad1c('0x23')]){delete _0x58b727[_0xad1c('0x23')];}_0x518a14['status'](_0x3b3bf3)[_0xad1c('0x24')](_0x58b727);};}exports[_0xad1c('0x25')]=function(_0x44a938,_0x345174){var _0x30abaa={},_0x5c1203={},_0x2a26c0={'count':0x0,'rows':[]};var _0x5518e0=_[_0xad1c('0x26')](db[_0xad1c('0x27')]['rawAttributes'],function(_0x35406d){return{'name':_0x35406d[_0xad1c('0x28')],'type':_0x35406d[_0xad1c('0x29')]['key']};});_0x5c1203['model']=_[_0xad1c('0x26')](_0x5518e0,'name');_0x5c1203[_0xad1c('0x2a')]=_['keys'](_0x44a938[_0xad1c('0x2a')]);_0x5c1203['filters']=_[_0xad1c('0x2b')](_0x5c1203[_0xad1c('0x2c')],_0x5c1203[_0xad1c('0x2a')]);_0x30abaa[_0xad1c('0x2d')]=_[_0xad1c('0x2b')](_0x5c1203[_0xad1c('0x2c')],qs[_0xad1c('0x2e')](_0x44a938[_0xad1c('0x2a')][_0xad1c('0x2e')]));_0x30abaa[_0xad1c('0x2d')]=_0x30abaa['attributes'][_0xad1c('0x2f')]?_0x30abaa[_0xad1c('0x2d')]:_0x5c1203['model'];if(!_0x44a938[_0xad1c('0x2a')][_0xad1c('0x30')](_0xad1c('0x31'))){_0x30abaa['limit']=qs['limit'](_0x44a938[_0xad1c('0x2a')]['limit']);_0x30abaa[_0xad1c('0x19')]=qs[_0xad1c('0x19')](_0x44a938[_0xad1c('0x2a')][_0xad1c('0x19')]);}_0x30abaa[_0xad1c('0x32')]=qs['sort'](_0x44a938[_0xad1c('0x2a')][_0xad1c('0x33')]);_0x30abaa[_0xad1c('0x34')]=qs[_0xad1c('0x35')](_[_0xad1c('0x36')](_0x44a938['query'],_0x5c1203[_0xad1c('0x35')]),_0x5518e0);if(_0x44a938[_0xad1c('0x2a')][_0xad1c('0x37')]){_0x30abaa[_0xad1c('0x34')]=_[_0xad1c('0x38')](_0x30abaa[_0xad1c('0x34')],{'$or':_[_0xad1c('0x26')](_0x5518e0,function(_0x28c80e){if(_0x28c80e[_0xad1c('0x29')]!=='VIRTUAL'){var _0x1c44c7={};_0x1c44c7[_0x28c80e[_0xad1c('0x23')]]={'$like':'%'+_0x44a938[_0xad1c('0x2a')]['filter']+'%'};return _0x1c44c7;}})});}_0x30abaa=_[_0xad1c('0x38')]({},_0x30abaa,_0x44a938['options']);var _0x562ceb={'where':_0x30abaa[_0xad1c('0x34')]};return db[_0xad1c('0x27')][_0xad1c('0x39')](_0x562ceb)[_0xad1c('0x1f')](function(_0x36f821){_0x2a26c0[_0xad1c('0x39')]=_0x36f821;if(_0x44a938['query'][_0xad1c('0x3a')]){_0x30abaa[_0xad1c('0x3b')]=[{'all':!![]}];}return db[_0xad1c('0x27')]['findAll'](_0x30abaa);})['then'](function(_0xaf9013){_0x2a26c0['rows']=_0xaf9013;return _0x2a26c0;})[_0xad1c('0x1f')](respondWithFilteredResult(_0x345174,_0x30abaa))[_0xad1c('0x3c')](handleError(_0x345174,null));};exports[_0xad1c('0x3d')]=function(_0x6ad690,_0x5a2301){var _0x1b5a1a={'raw':!![],'where':{'id':_0x6ad690[_0xad1c('0x3e')]['id']}},_0x1f91d4={};_0x1f91d4[_0xad1c('0x2c')]=_[_0xad1c('0x3f')](db['CmHopperFinal']['rawAttributes']);_0x1f91d4['query']=_[_0xad1c('0x3f')](_0x6ad690[_0xad1c('0x2a')]);_0x1f91d4[_0xad1c('0x35')]=_[_0xad1c('0x2b')](_0x1f91d4[_0xad1c('0x2c')],_0x1f91d4[_0xad1c('0x2a')]);_0x1b5a1a[_0xad1c('0x2d')]=_[_0xad1c('0x2b')](_0x1f91d4[_0xad1c('0x2c')],qs[_0xad1c('0x2e')](_0x6ad690[_0xad1c('0x2a')][_0xad1c('0x2e')]));_0x1b5a1a[_0xad1c('0x2d')]=_0x1b5a1a[_0xad1c('0x2d')][_0xad1c('0x2f')]?_0x1b5a1a['attributes']:_0x1f91d4[_0xad1c('0x2c')];if(_0x6ad690['query'][_0xad1c('0x3a')]){_0x1b5a1a[_0xad1c('0x3b')]=[{'all':!![]}];}_0x1b5a1a=_[_0xad1c('0x38')]({},_0x1b5a1a,_0x6ad690[_0xad1c('0x40')]);return db[_0xad1c('0x27')][_0xad1c('0x41')](_0x1b5a1a)[_0xad1c('0x1f')](handleEntityNotFound(_0x5a2301,null))['then'](respondWithResult(_0x5a2301,null))['catch'](handleError(_0x5a2301,null));};exports[_0xad1c('0x42')]=function(_0x233a1b,_0x2d97af){return db['CmHopperFinal'][_0xad1c('0x42')]()['then'](respondWithResult(_0x2d97af,null))['catch'](handleError(_0x2d97af,null));};exports[_0xad1c('0x1e')]=function(_0x1d4e86,_0x39d597){if(_0x1d4e86[_0xad1c('0x43')][_0xad1c('0x44')]){delete _0x1d4e86[_0xad1c('0x43')][_0xad1c('0x44')];}return db['CmHopperFinal']['find']({'where':{'uniqueid':_0x1d4e86[_0xad1c('0x3e')]['id']}})[_0xad1c('0x1f')](handleEntityNotFound(_0x39d597,null))[_0xad1c('0x1f')](saveUpdates(_0x1d4e86[_0xad1c('0x43')],null))[_0xad1c('0x1f')](respondWithResult(_0x39d597,null))[_0xad1c('0x3c')](handleError(_0x39d597,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x19cd6f,_0x357c21,_0x222049){return db[_0xad1c('0x27')][_0xad1c('0x45')]({'raw':![],'where':{'VoiceQueueId':_0x19cd6f[_0xad1c('0x3e')]['id']},'attributes':[[db[_0xad1c('0x46')]['fn'](_0xad1c('0x47'),db['sequelize']['fn']('IF',db[_0xad1c('0x46')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0xad1c('0x48')],[db['sequelize']['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x4a')))),_0xad1c('0x4b')],[db[_0xad1c('0x46')]['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x4c')))),'busyContacts'],[db['sequelize']['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x4d')))),_0xad1c('0x4e')],[db[_0xad1c('0x46')]['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')]['literal'](_0xad1c('0x4f')))),_0xad1c('0x50')],[db['sequelize']['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db['sequelize'][_0xad1c('0x49')](_0xad1c('0x51')))),_0xad1c('0x52')],[db[_0xad1c('0x46')]['fn']('COUNT',db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x53')))),'reCallContacts'],[db[_0xad1c('0x46')]['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x54')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x357c21,null))[_0xad1c('0x1f')](respondWithResult(_0x357c21,null))[_0xad1c('0x3c')](handleError(_0x357c21,null));};exports[_0xad1c('0x55')]=function(_0xb12705,_0x3b98f7,_0x19c879){return db[_0xad1c('0x27')]['findAll']({'raw':![],'where':{'CampaignId':_0xb12705['params']['id']},'attributes':[[db['sequelize']['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db['sequelize']['literal'](_0xad1c('0x56')))),_0xad1c('0x48')],[db[_0xad1c('0x46')]['fn']('COUNT',db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x4a')))),_0xad1c('0x4b')],[db[_0xad1c('0x46')]['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x4c')))),_0xad1c('0x57')],[db[_0xad1c('0x46')]['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db['sequelize'][_0xad1c('0x49')](_0xad1c('0x4d')))),_0xad1c('0x4e')],[db['sequelize']['fn']('COUNT',db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xad1c('0x50')],[db[_0xad1c('0x46')]['fn'](_0xad1c('0x47'),db['sequelize']['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x51')))),_0xad1c('0x52')],[db[_0xad1c('0x46')]['fn']('COUNT',db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')][_0xad1c('0x49')](_0xad1c('0x53')))),_0xad1c('0x58')],[db[_0xad1c('0x46')]['fn'](_0xad1c('0x47'),db[_0xad1c('0x46')]['fn']('IF',db[_0xad1c('0x46')]['literal'](_0xad1c('0x54')))),_0xad1c('0x59')]]})[_0xad1c('0x1f')](handleEntityNotFound(_0x3b98f7,null))[_0xad1c('0x1f')](respondWithResult(_0x3b98f7,null))['catch'](handleError(_0x3b98f7,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x2dd27a,_0x2940af,_0x5df53a){return db[_0xad1c('0x5a')]['find']({'where':{'id':_0x2dd27a[_0xad1c('0x3e')]['id']}})[_0xad1c('0x1f')](handleEntityNotFound(_0x2940af,null))[_0xad1c('0x1f')](function(_0x1eea0f){var _0x46a365;if(_0x1eea0f){_0x46a365=squel[_0xad1c('0x5b')]()[_0xad1c('0x5c')](_0xad1c('0x5d'))[_0xad1c('0x5e')]([_0xad1c('0x5f'),_0xad1c('0x60'),_0xad1c('0x61'),_0xad1c('0x62'),_0xad1c('0x63'),_0xad1c('0x64'),_0xad1c('0x65')],squel[_0xad1c('0x66')]()[_0xad1c('0x67')](_0xad1c('0x68'),_0xad1c('0x5f'))[_0xad1c('0x67')]('NOW()',_0xad1c('0x60'))['field']('ANY_VALUE(ContactId)',_0xad1c('0x61'))[_0xad1c('0x67')]('ANY_VALUE(ListId)',_0xad1c('0x62'))[_0xad1c('0x67')]('ANY_VALUE(VoiceQueueId)',_0xad1c('0x63'))['field']('NOW()',_0xad1c('0x64'))['field'](_0xad1c('0x69'),_0xad1c('0x65'))[_0xad1c('0x6a')](_0xad1c('0x6b'))[_0xad1c('0x34')]('VoiceQueueId\x20=\x20?',_0x2dd27a['params']['id']['toString']())[_0xad1c('0x34')](_0xad1c('0x6c'),_0x2dd27a['body']['state'][_0xad1c('0x6d')]())[_0xad1c('0x34')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xad1c('0x34')](_0xad1c('0x6e'),squel[_0xad1c('0x66')]()[_0xad1c('0x67')](_0xad1c('0x5f'))[_0xad1c('0x6a')](_0xad1c('0x5d'))[_0xad1c('0x34')](_0xad1c('0x6f'),_0x2dd27a[_0xad1c('0x3e')]['id']['toString']()))[_0xad1c('0x34')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field']('calleridnum')[_0xad1c('0x6a')](_0xad1c('0x6b'))[_0xad1c('0x34')](_0xad1c('0x6f'),_0x2dd27a['params']['id'][_0xad1c('0x6d')]())[_0xad1c('0x34')](_0xad1c('0x70')))[_0xad1c('0x71')]('ContactId'))['toString']();return db[_0xad1c('0x46')][_0xad1c('0x2a')](_0x46a365);}return[];})['then'](respondWithResult(_0x2940af,null))[_0xad1c('0x3c')](handleError(_0x2940af,null));};exports[_0xad1c('0x72')]=function(_0x2db5c8,_0x7b7f7b,_0xf5f219){return db[_0xad1c('0x73')][_0xad1c('0x41')]({'where':{'id':_0x2db5c8[_0xad1c('0x3e')]['id']}})[_0xad1c('0x1f')](handleEntityNotFound(_0x7b7f7b,null))[_0xad1c('0x1f')](function(_0x565a15){var _0x39911f;if(_0x565a15){_0x39911f=squel[_0xad1c('0x5b')]()[_0xad1c('0x5c')]('cm_hopper')['fromQuery']([_0xad1c('0x5f'),'scheduledAt',_0xad1c('0x61'),_0xad1c('0x62'),'CampaignId',_0xad1c('0x64'),_0xad1c('0x65')],squel[_0xad1c('0x66')]()[_0xad1c('0x67')]('ANY_VALUE(calleridnum)',_0xad1c('0x5f'))[_0xad1c('0x67')](_0xad1c('0x69'),_0xad1c('0x60'))[_0xad1c('0x67')]('ANY_VALUE(ContactId)',_0xad1c('0x61'))[_0xad1c('0x67')](_0xad1c('0x74'),_0xad1c('0x62'))['field'](_0xad1c('0x75'),_0xad1c('0x76'))['field']('NOW()',_0xad1c('0x64'))['field'](_0xad1c('0x69'),_0xad1c('0x65'))[_0xad1c('0x6a')](_0xad1c('0x6b'))[_0xad1c('0x34')]('CampaignId\x20=\x20?',_0x2db5c8[_0xad1c('0x3e')]['id'][_0xad1c('0x6d')]())['where']('state\x20=\x20?',_0x2db5c8['body'][_0xad1c('0x77')][_0xad1c('0x6d')]())[_0xad1c('0x34')](_0xad1c('0x78'))[_0xad1c('0x34')](_0xad1c('0x6e'),squel[_0xad1c('0x66')]()[_0xad1c('0x67')](_0xad1c('0x5f'))['from'](_0xad1c('0x5d'))[_0xad1c('0x34')]('CampaignId\x20=\x20?',_0x2db5c8['params']['id'][_0xad1c('0x6d')]()))[_0xad1c('0x34')](_0xad1c('0x6e'),squel[_0xad1c('0x66')]()['field']('calleridnum')[_0xad1c('0x6a')](_0xad1c('0x6b'))[_0xad1c('0x34')]('CampaignId\x20=\x20?',_0x2db5c8[_0xad1c('0x3e')]['id'][_0xad1c('0x6d')]())[_0xad1c('0x34')]('state\x20=\x204'))[_0xad1c('0x71')]('ContactId'))['toString']();return db['sequelize']['query'](_0x39911f);}return[];})[_0xad1c('0x1f')](respondWithResult(_0x7b7f7b,null))[_0xad1c('0x3c')](handleError(_0x7b7f7b,null));};exports[_0xad1c('0x79')]=function(_0x1203d2,_0x1df7e9,_0x32e3b4){return db[_0xad1c('0x7a')][_0xad1c('0x7b')]({'where':{'VoiceQueueId':_0x1203d2[_0xad1c('0x43')][_0xad1c('0x63')],'CampaignId':_0x1203d2[_0xad1c('0x43')][_0xad1c('0x76')],'ContactId':_0x1203d2[_0xad1c('0x43')][_0xad1c('0x61')]}})['then'](handleEntityNotFound(_0x1df7e9,null))[_0xad1c('0x1f')](function(_0x3c8941){if(_0x3c8941){return _0x3c8941;}return null;})[_0xad1c('0x1f')](respondWithResult(_0x1df7e9,null))[_0xad1c('0x3c')](handleError(_0x1df7e9,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index fbb2497..7518c11 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 _0xc2cc=['cm_hopper_final','calleridnum','util','../../config/logger','api','bluebird','path','../../config/environment','exports','define'];(function(_0x4e5552,_0x19ec4e){var _0x60a338=function(_0x40c70e){while(--_0x40c70e){_0x4e5552['push'](_0x4e5552['shift']());}};_0x60a338(++_0x19ec4e);}(_0xc2cc,0x70));var _0xcc2c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc2cc[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0xcc2c('0x0'));var logger=require(_0xcc2c('0x1'))(_0xcc2c('0x2'));var moment=require('moment');var BPromise=require(_0xcc2c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc2c('0x4'));var rimraf=require('rimraf');var config=require(_0xcc2c('0x5'));var attributes=require('./cmHopperFinal.attributes');module[_0xcc2c('0x6')]=function(_0x539095,_0x5855cc){return _0x539095[_0xcc2c('0x7')]('CmHopperFinal',attributes,{'tableName':_0xcc2c('0x8'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xcc2c('0x9')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5db8=['exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./cmHopperFinal.attributes'];(function(_0x50a3fe,_0x396f4a){var _0x2edb0e=function(_0x20cd39){while(--_0x20cd39){_0x50a3fe['push'](_0x50a3fe['shift']());}};_0x2edb0e(++_0x396f4a);}(_0x5db8,0xbb));var _0x85db=function(_0x118733,_0x2bd820){_0x118733=_0x118733-0x0;var _0x4777af=_0x5db8[_0x118733];return _0x4777af;};'use strict';var _=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var logger=require(_0x85db('0x2'))('api');var moment=require(_0x85db('0x3'));var BPromise=require(_0x85db('0x4'));var rp=require(_0x85db('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x85db('0x6'));var attributes=require(_0x85db('0x7'));module[_0x85db('0x8')]=function(_0x34d71f,_0x48bf16){return _0x34d71f['define'](_0x85db('0x9'),attributes,{'tableName':_0x85db('0xa'),'paranoid':![],'indexes':[{'name':_0x85db('0xb'),'fields':[_0x85db('0xb')]},{'name':'uniqueid','fields':[_0x85db('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 605e59c..8035f89 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 _0x9af6=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','CmHopperFinal,\x20%s,\x20%s','message','result','catch','create','body','options','raw','then','CreateCmHopperFinal','debug','lodash','util','moment','bluebird','randomstring'];(function(_0x6fd730,_0x3b1344){var _0x2cb7d7=function(_0x513997){while(--_0x513997){_0x6fd730['push'](_0x6fd730['shift']());}};_0x2cb7d7(++_0x3b1344);}(_0x9af6,0xb5));var _0x69af=function(_0x4ffd61,_0x4bf2b9){_0x4ffd61=_0x4ffd61-0x0;var _0x5f91e0=_0x9af6[_0x4ffd61];return _0x5f91e0;};'use strict';var _=require(_0x69af('0x0'));var util=require(_0x69af('0x1'));var moment=require(_0x69af('0x2'));var BPromise=require(_0x69af('0x3'));var rs=require(_0x69af('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x69af('0x5'))['db'];var utils=require(_0x69af('0x6'));var logger=require(_0x69af('0x7'))(_0x69af('0x8'));var config=require(_0x69af('0x9'));var jayson=require(_0x69af('0xa'));var client=jayson[_0x69af('0xb')][_0x69af('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x536523,_0x28dfe4,_0x1ff312){return new BPromise(function(_0x50b5fb,_0x264332){return client[_0x69af('0xd')](_0x536523,_0x1ff312)['then'](function(_0x18e9e0){logger[_0x69af('0xe')]('CmHopperFinal,\x20%s,\x20%s',_0x28dfe4,'request\x20sent');logger['debug'](_0x69af('0xf'),_0x28dfe4,_0x69af('0x10'),JSON[_0x69af('0x11')](_0x18e9e0));if(_0x18e9e0['error']){if(_0x18e9e0['error'][_0x69af('0x12')]===0x1f4){logger[_0x69af('0x13')](_0x69af('0x14'),_0x28dfe4,_0x18e9e0[_0x69af('0x13')][_0x69af('0x15')]);return _0x264332(_0x18e9e0[_0x69af('0x13')][_0x69af('0x15')]);}logger[_0x69af('0x13')](_0x69af('0x14'),_0x28dfe4,_0x18e9e0[_0x69af('0x13')][_0x69af('0x15')]);return _0x50b5fb(_0x18e9e0['error'][_0x69af('0x15')]);}else{logger['info'](_0x69af('0x14'),_0x28dfe4,'request\x20sent');_0x50b5fb(_0x18e9e0[_0x69af('0x16')]['message']);}})[_0x69af('0x17')](function(_0x4367d1){logger[_0x69af('0x13')](_0x69af('0x14'),_0x28dfe4,_0x4367d1);_0x264332(_0x4367d1);});});}exports['CreateCmHopperFinal']=function(_0x396a36){var _0x515a53=this;return new Promise(function(_0x19f9b,_0x1115cf){return db['CmHopperFinal'][_0x69af('0x18')](_0x396a36[_0x69af('0x19')],{'raw':_0x396a36[_0x69af('0x1a')]?_0x396a36['options'][_0x69af('0x1b')]===undefined?!![]:![]:!![]})[_0x69af('0x1c')](function(_0xd7d1d){logger['info'](_0x69af('0x1d'),_0x396a36);logger[_0x69af('0x1e')](_0x69af('0x1d'),_0x396a36,JSON[_0x69af('0x11')](_0xd7d1d));_0x19f9b(_0xd7d1d);})['catch'](function(_0x59d142){logger[_0x69af('0x13')](_0x69af('0x1d'),_0x59d142['message'],_0x396a36);_0x1115cf(_0x515a53[_0x69af('0x13')](0x1f4,_0x59d142['message']));});});}; \ No newline at end of file +var _0x011c=['debug','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CreateCmHopperFinal','create','body','options','raw'];(function(_0x292423,_0x1759b7){var _0x2801cb=function(_0x23c821){while(--_0x23c821){_0x292423['push'](_0x292423['shift']());}};_0x2801cb(++_0x1759b7);}(_0x011c,0x8e));var _0xc011=function(_0x497a6a,_0x25b228){_0x497a6a=_0x497a6a-0x0;var _0x2b43c8=_0x011c[_0x497a6a];return _0x2b43c8;};'use strict';var _=require(_0xc011('0x0'));var util=require(_0xc011('0x1'));var moment=require(_0xc011('0x2'));var BPromise=require(_0xc011('0x3'));var rs=require(_0xc011('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc011('0x5'))['db'];var utils=require(_0xc011('0x6'));var logger=require(_0xc011('0x7'))(_0xc011('0x8'));var config=require(_0xc011('0x9'));var jayson=require(_0xc011('0xa'));var client=jayson['client'][_0xc011('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19b4ac,_0x5788e4,_0x56f9b7){return new BPromise(function(_0x26e24c,_0x57421d){return client[_0xc011('0xc')](_0x19b4ac,_0x56f9b7)[_0xc011('0xd')](function(_0x370c6b){logger[_0xc011('0xe')](_0xc011('0xf'),_0x5788e4,_0xc011('0x10'));logger['debug']('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x5788e4,'request\x20sent',JSON[_0xc011('0x11')](_0x370c6b));if(_0x370c6b[_0xc011('0x12')]){if(_0x370c6b['error'][_0xc011('0x13')]===0x1f4){logger['error'](_0xc011('0xf'),_0x5788e4,_0x370c6b[_0xc011('0x12')]['message']);return _0x57421d(_0x370c6b['error'][_0xc011('0x14')]);}logger['error'](_0xc011('0xf'),_0x5788e4,_0x370c6b[_0xc011('0x12')][_0xc011('0x14')]);return _0x26e24c(_0x370c6b[_0xc011('0x12')][_0xc011('0x14')]);}else{logger[_0xc011('0xe')](_0xc011('0xf'),_0x5788e4,_0xc011('0x10'));_0x26e24c(_0x370c6b['result']['message']);}})['catch'](function(_0x455e79){logger[_0xc011('0x12')](_0xc011('0xf'),_0x5788e4,_0x455e79);_0x57421d(_0x455e79);});});}exports[_0xc011('0x15')]=function(_0x3d491e){var _0x20d89f=this;return new Promise(function(_0x23fbf4,_0x3ee5ed){return db['CmHopperFinal'][_0xc011('0x16')](_0x3d491e[_0xc011('0x17')],{'raw':_0x3d491e['options']?_0x3d491e[_0xc011('0x18')][_0xc011('0x19')]===undefined?!![]:![]:!![]})[_0xc011('0xd')](function(_0x5756fd){logger[_0xc011('0xe')](_0xc011('0x15'),_0x3d491e);logger[_0xc011('0x1a')]('CreateCmHopperFinal',_0x3d491e,JSON[_0xc011('0x11')](_0x5756fd));_0x23fbf4(_0x5756fd);})[_0xc011('0x1b')](function(_0x271de8){logger['error'](_0xc011('0x15'),_0x271de8['message'],_0x3d491e);_0x3ee5ed(_0x20d89f[_0xc011('0x12')](0x1f4,_0x271de8[_0xc011('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index b21583f..35cf3d5 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 _0x4fc3=['/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','update','multer','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3845dd,_0x2a131b){var _0x155a98=function(_0x165ef1){while(--_0x165ef1){_0x3845dd['push'](_0x3845dd['shift']());}};_0x155a98(++_0x2a131b);}(_0x4fc3,0x100));var _0x34fc=function(_0x4ccd15,_0x1c338a){_0x4ccd15=_0x4ccd15-0x0;var _0x4532b9=_0x4fc3[_0x4ccd15];return _0x4532b9;};'use strict';var multer=require(_0x34fc('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x34fc('0x1'));var router=express[_0x34fc('0x2')]();var auth=require(_0x34fc('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x34fc('0x4'));var controller=require('./cmHopperFinal.controller');router[_0x34fc('0x5')]('/',auth[_0x34fc('0x6')](),controller[_0x34fc('0x7')]);router[_0x34fc('0x5')](_0x34fc('0x8'),auth[_0x34fc('0x6')](),controller[_0x34fc('0x9')]);router[_0x34fc('0x5')](_0x34fc('0xa'),auth[_0x34fc('0x6')](),controller[_0x34fc('0xb')]);router[_0x34fc('0x5')](_0x34fc('0xc'),auth['isAuthenticated'](),controller[_0x34fc('0xd')]);router['get'](_0x34fc('0xe'),auth['isAuthenticated'](),controller[_0x34fc('0xf')]);router[_0x34fc('0x10')](_0x34fc('0x11'),auth['isAuthenticated'](),controller[_0x34fc('0x12')]);router[_0x34fc('0x10')](_0x34fc('0x13'),auth[_0x34fc('0x6')](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0x34fc('0x14'),auth[_0x34fc('0x6')](),controller[_0x34fc('0x15')]);router[_0x34fc('0x16')](_0x34fc('0xa'),auth['isAuthenticated'](),controller[_0x34fc('0x17')]);module['exports']=router; \ No newline at end of file +var _0xc348=['/voice/queue/moveContacts/:id','checkContactHopper','put','/:id','update','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get','/describe','describe','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post'];(function(_0x3d2cab,_0x4baf9c){var _0x49feb9=function(_0x3133c3){while(--_0x3133c3){_0x3d2cab['push'](_0x3d2cab['shift']());}};_0x49feb9(++_0x4baf9c);}(_0xc348,0xd5));var _0x8c34=function(_0x9b0064,_0x4b5ef7){_0x9b0064=_0x9b0064-0x0;var _0xe356a0=_0xc348[_0x9b0064];return _0xe356a0;};'use strict';var multer=require(_0x8c34('0x0'));var util=require(_0x8c34('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c34('0x2')]();var auth=require(_0x8c34('0x3'));var interaction=require(_0x8c34('0x4'));var config=require(_0x8c34('0x5'));var controller=require(_0x8c34('0x6'));router['get']('/',auth[_0x8c34('0x7')](),controller[_0x8c34('0x8')]);router[_0x8c34('0x9')](_0x8c34('0xa'),auth['isAuthenticated'](),controller[_0x8c34('0xb')]);router['get']('/:id',auth[_0x8c34('0x7')](),controller[_0x8c34('0xc')]);router[_0x8c34('0x9')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0x8c34('0xd')]);router[_0x8c34('0x9')](_0x8c34('0xe'),auth[_0x8c34('0x7')](),controller[_0x8c34('0xf')]);router[_0x8c34('0x10')](_0x8c34('0x11'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x8c34('0x10')]('/voice/campaign/moveContacts/:id',auth[_0x8c34('0x7')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x8c34('0x10')]('/checkContactHopper',auth['isAuthenticated'](),controller[_0x8c34('0x12')]);router[_0x8c34('0x13')](_0x8c34('0x14'),auth[_0x8c34('0x7')](),controller[_0x8c34('0x15')]);module[_0x8c34('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 7534648..b316940 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 _0x084f=['STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x5a08f4,_0x470a9){var _0x28eb4a=function(_0x30979d){while(--_0x30979d){_0x5a08f4['push'](_0x5a08f4['shift']());}};_0x28eb4a(++_0x470a9);}(_0x084f,0xd6));var _0xf084=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x084f[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0xf084('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xf084('0x1')]},'scheduledat':{'type':Sequelize[_0xf084('0x2')]},'countbusyretry':{'type':Sequelize[_0xf084('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf084('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf084('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xf084('0x1')]},'originatecalleridname':{'type':Sequelize[_0xf084('0x1')]},'calleridnum':{'type':Sequelize[_0xf084('0x1')]},'calleridname':{'type':Sequelize[_0xf084('0x1')]},'starttime':{'type':Sequelize[_0xf084('0x2')]},'responsetime':{'type':Sequelize[_0xf084('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xf084('0x2')]},'endtime':{'type':Sequelize[_0xf084('0x2')]},'ringtime':{'type':Sequelize[_0xf084('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf084('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf084('0x1')]},'campaign':{'type':Sequelize[_0xf084('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xf084('0x1')]},'amd':{'type':Sequelize[_0xf084('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xf084('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf084('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf084('0x2')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xf084('0x2')]},'edited':{'type':Sequelize[_0xf084('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xf084('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf084('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf084('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf084('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf084('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xf084('0x1')]}}; \ No newline at end of file +var _0x2e17=['BOOLEAN','exports','DATE','INTEGER','STRING'];(function(_0x4e2272,_0x2e1ae0){var _0x45511c=function(_0x285414){while(--_0x285414){_0x4e2272['push'](_0x4e2272['shift']());}};_0x45511c(++_0x2e1ae0);}(_0x2e17,0x14b));var _0x72e1=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x2e17[_0x342700];return _0x53406f;};'use strict';var Sequelize=require('sequelize');module[_0x72e1('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x72e1('0x1')]},'countbusyretry':{'type':Sequelize[_0x72e1('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x72e1('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x72e1('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x72e1('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x72e1('0x3')]},'originatecalleridname':{'type':Sequelize[_0x72e1('0x3')]},'calleridnum':{'type':Sequelize[_0x72e1('0x3')]},'calleridname':{'type':Sequelize[_0x72e1('0x3')]},'starttime':{'type':Sequelize[_0x72e1('0x1')]},'responsetime':{'type':Sequelize[_0x72e1('0x1')]},'answertime':{'type':Sequelize[_0x72e1('0x1')]},'droptime':{'type':Sequelize[_0x72e1('0x1')]},'endtime':{'type':Sequelize[_0x72e1('0x1')]},'ringtime':{'type':Sequelize[_0x72e1('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x72e1('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x72e1('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x72e1('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x72e1('0x3')]},'reason':{'type':Sequelize[_0x72e1('0x3')]},'amd':{'type':Sequelize[_0x72e1('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x72e1('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x72e1('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x72e1('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x72e1('0x1')]},'recallme':{'type':Sequelize[_0x72e1('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x72e1('0x1')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x72e1('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x72e1('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x72e1('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x72e1('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index f0f4496..2b52bb2 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 _0xe514=['rawAttributes','catch','create','body','describe','uniqueid','find','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','update','then','destroy','error','name','index','CmHopperHistory','fieldName','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','show'];(function(_0x46b832,_0x454e18){var _0x42b328=function(_0x204e99){while(--_0x204e99){_0x46b832['push'](_0x46b832['shift']());}};_0x42b328(++_0x454e18);}(_0xe514,0x175));var _0x4e51=function(_0x354c0,_0x5f4b16){_0x354c0=_0x354c0-0x0;var _0x2fb394=_0xe514[_0x354c0];return _0x2fb394;};'use strict';var pdf=require(_0x4e51('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4e51('0x1'));var zipdir=require(_0x4e51('0x2'));var jsonpatch=require(_0x4e51('0x3'));var rp=require(_0x4e51('0x4'));var moment=require('moment');var BPromise=require(_0x4e51('0x5'));var Mustache=require('mustache');var util=require(_0x4e51('0x6'));var path=require('path');var sox=require(_0x4e51('0x7'));var csv=require(_0x4e51('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4e51('0x9'));var squel=require(_0x4e51('0xa'));var crypto=require(_0x4e51('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4e51('0xc'));var toCsv=require(_0x4e51('0x8'));var querystring=require(_0x4e51('0xd'));var Papa=require(_0x4e51('0xe'));var Redis=require(_0x4e51('0xf'));var authService=require(_0x4e51('0x10'));var qs=require(_0x4e51('0x11'));var as=require(_0x4e51('0x12'));var hardwareService=require(_0x4e51('0x13'));var logger=require('../../config/logger')(_0x4e51('0x14'));var utils=require(_0x4e51('0x15'));var config=require('../../config/environment');var db=require(_0x4e51('0x16'))['db'];function respondWithStatusCode(_0x7f7c15,_0x555ced){_0x555ced=_0x555ced||0xcc;return function(_0x5d0142){if(_0x5d0142){return _0x7f7c15[_0x4e51('0x17')](_0x555ced);}return _0x7f7c15[_0x4e51('0x18')](_0x555ced)[_0x4e51('0x19')]();};}function respondWithResult(_0x1e652e,_0x539e8f){_0x539e8f=_0x539e8f||0xc8;return function(_0x429662){if(_0x429662){return _0x1e652e[_0x4e51('0x18')](_0x539e8f)[_0x4e51('0x1a')](_0x429662);}};}function respondWithFilteredResult(_0x2b397c,_0x99ccb){return function(_0x49da26){if(_0x49da26){var _0x11f86e=_0x49da26[_0x4e51('0x1b')],_0xab91b5=_0x99ccb['offset'],_0x151f5c=_0x99ccb[_0x4e51('0x1c')]+_0x99ccb['limit'],_0x249aad;if(_0x151f5c>=_0x11f86e){_0x151f5c=_0x11f86e;_0x249aad=0xc8;}else{_0x249aad=0xce;}_0x2b397c['status'](_0x249aad);return _0x2b397c[_0x4e51('0x1d')]('Content-Range',_0xab91b5+'-'+_0x151f5c+'/'+_0x11f86e)[_0x4e51('0x1a')](_0x49da26);}return null;};}function patchUpdates(_0x4a4ea0){return function(_0x21a36e){try{jsonpatch['apply'](_0x21a36e,_0x4a4ea0,!![]);}catch(_0x29ddcc){return BPromise[_0x4e51('0x1e')](_0x29ddcc);}return _0x21a36e[_0x4e51('0x1f')]();};}function saveUpdates(_0x429956,_0x4174c4){return function(_0x47b93f){if(_0x47b93f){return _0x47b93f[_0x4e51('0x20')](_0x429956)[_0x4e51('0x21')](function(_0x4b363e){return _0x4b363e;});}return null;};}function removeEntity(_0x2dbd01,_0x4347ca){return function(_0x39baf4){if(_0x39baf4){return _0x39baf4[_0x4e51('0x22')]()[_0x4e51('0x21')](function(){_0x2dbd01[_0x4e51('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ab93f,_0xb3686a){return function(_0x1bb25b){if(!_0x1bb25b){_0x2ab93f['sendStatus'](0x194);}return _0x1bb25b;};}function handleError(_0x531e18,_0x5075d4){_0x5075d4=_0x5075d4||0x1f4;return function(_0x5bbda0){logger[_0x4e51('0x23')](_0x5bbda0['stack']);if(_0x5bbda0[_0x4e51('0x24')]){delete _0x5bbda0[_0x4e51('0x24')];}_0x531e18['status'](_0x5075d4)['send'](_0x5bbda0);};}exports[_0x4e51('0x25')]=function(_0x16cff6,_0x43329c){var _0xe1be65={},_0x4cc64f={},_0x2bf0f9={'count':0x0,'rows':[]};var _0xab4d46=_['map'](db[_0x4e51('0x26')]['rawAttributes'],function(_0x5db45b){return{'name':_0x5db45b[_0x4e51('0x27')],'type':_0x5db45b['type']['key']};});_0x4cc64f[_0x4e51('0x28')]=_[_0x4e51('0x29')](_0xab4d46,_0x4e51('0x24'));_0x4cc64f[_0x4e51('0x2a')]=_[_0x4e51('0x2b')](_0x16cff6['query']);_0x4cc64f[_0x4e51('0x2c')]=_[_0x4e51('0x2d')](_0x4cc64f[_0x4e51('0x28')],_0x4cc64f[_0x4e51('0x2a')]);_0xe1be65['attributes']=_[_0x4e51('0x2d')](_0x4cc64f[_0x4e51('0x28')],qs[_0x4e51('0x2e')](_0x16cff6[_0x4e51('0x2a')][_0x4e51('0x2e')]));_0xe1be65['attributes']=_0xe1be65['attributes'][_0x4e51('0x2f')]?_0xe1be65[_0x4e51('0x30')]:_0x4cc64f[_0x4e51('0x28')];if(!_0x16cff6['query'][_0x4e51('0x31')](_0x4e51('0x32'))){_0xe1be65[_0x4e51('0x33')]=qs[_0x4e51('0x33')](_0x16cff6[_0x4e51('0x2a')][_0x4e51('0x33')]);_0xe1be65[_0x4e51('0x1c')]=qs[_0x4e51('0x1c')](_0x16cff6[_0x4e51('0x2a')][_0x4e51('0x1c')]);}_0xe1be65[_0x4e51('0x34')]=qs[_0x4e51('0x35')](_0x16cff6[_0x4e51('0x2a')][_0x4e51('0x35')]);_0xe1be65[_0x4e51('0x36')]=qs[_0x4e51('0x2c')](_[_0x4e51('0x37')](_0x16cff6[_0x4e51('0x2a')],_0x4cc64f[_0x4e51('0x2c')]),_0xab4d46);if(_0x16cff6[_0x4e51('0x2a')][_0x4e51('0x38')]){_0xe1be65[_0x4e51('0x36')]=_[_0x4e51('0x39')](_0xe1be65[_0x4e51('0x36')],{'$or':_[_0x4e51('0x29')](_0xab4d46,function(_0x1bc3c5){if(_0x1bc3c5[_0x4e51('0x3a')]!==_0x4e51('0x3b')){var _0x70b53b={};_0x70b53b[_0x1bc3c5[_0x4e51('0x24')]]={'$like':'%'+_0x16cff6[_0x4e51('0x2a')]['filter']+'%'};return _0x70b53b;}})});}_0xe1be65=_[_0x4e51('0x39')]({},_0xe1be65,_0x16cff6[_0x4e51('0x3c')]);var _0x3acfbe={'where':_0xe1be65[_0x4e51('0x36')]};return db[_0x4e51('0x26')][_0x4e51('0x1b')](_0x3acfbe)['then'](function(_0x2e58f2){_0x2bf0f9[_0x4e51('0x1b')]=_0x2e58f2;if(_0x16cff6[_0x4e51('0x2a')][_0x4e51('0x3d')]){_0xe1be65[_0x4e51('0x3e')]=[{'all':!![]}];}return db[_0x4e51('0x26')][_0x4e51('0x3f')](_0xe1be65);})[_0x4e51('0x21')](function(_0x32cc34){_0x2bf0f9['rows']=_0x32cc34;return _0x2bf0f9;})[_0x4e51('0x21')](respondWithFilteredResult(_0x43329c,_0xe1be65))['catch'](handleError(_0x43329c,null));};exports[_0x4e51('0x40')]=function(_0x4c3ad8,_0x268c97){var _0x2d0e0c={'raw':!![],'where':{'id':_0x4c3ad8['params']['id']}},_0x908e6a={};_0x908e6a[_0x4e51('0x28')]=_[_0x4e51('0x2b')](db['CmHopperHistory'][_0x4e51('0x41')]);_0x908e6a[_0x4e51('0x2a')]=_['keys'](_0x4c3ad8[_0x4e51('0x2a')]);_0x908e6a[_0x4e51('0x2c')]=_[_0x4e51('0x2d')](_0x908e6a[_0x4e51('0x28')],_0x908e6a[_0x4e51('0x2a')]);_0x2d0e0c[_0x4e51('0x30')]=_[_0x4e51('0x2d')](_0x908e6a[_0x4e51('0x28')],qs['fields'](_0x4c3ad8[_0x4e51('0x2a')][_0x4e51('0x2e')]));_0x2d0e0c[_0x4e51('0x30')]=_0x2d0e0c[_0x4e51('0x30')][_0x4e51('0x2f')]?_0x2d0e0c[_0x4e51('0x30')]:_0x908e6a[_0x4e51('0x28')];if(_0x4c3ad8['query'][_0x4e51('0x3d')]){_0x2d0e0c[_0x4e51('0x3e')]=[{'all':!![]}];}_0x2d0e0c=_[_0x4e51('0x39')]({},_0x2d0e0c,_0x4c3ad8['options']);return db[_0x4e51('0x26')]['find'](_0x2d0e0c)[_0x4e51('0x21')](handleEntityNotFound(_0x268c97,null))[_0x4e51('0x21')](respondWithResult(_0x268c97,null))[_0x4e51('0x42')](handleError(_0x268c97,null));};exports[_0x4e51('0x43')]=function(_0x1aa93f,_0x3dd960){return db[_0x4e51('0x26')]['create'](_0x1aa93f[_0x4e51('0x44')],{})[_0x4e51('0x21')](respondWithResult(_0x3dd960,0xc9))[_0x4e51('0x42')](handleError(_0x3dd960,null));};exports[_0x4e51('0x45')]=function(_0x4ce0f3,_0x3060e8){return db[_0x4e51('0x26')]['describe']()[_0x4e51('0x21')](respondWithResult(_0x3060e8,null))[_0x4e51('0x42')](handleError(_0x3060e8,null));};exports['update']=function(_0x55f6a7,_0x487e26){if(_0x55f6a7[_0x4e51('0x44')][_0x4e51('0x46')]){delete _0x55f6a7['body'][_0x4e51('0x46')];}return db['CmHopperHistory'][_0x4e51('0x47')]({'where':{'uniqueid':_0x55f6a7[_0x4e51('0x48')]['id']}})['then'](handleEntityNotFound(_0x487e26,null))[_0x4e51('0x21')](saveUpdates(_0x55f6a7['body'],null))['then'](respondWithResult(_0x487e26,null))[_0x4e51('0x42')](handleError(_0x487e26,null));}; \ No newline at end of file +var _0xb6b6=['find','create','describe','body','uniqueid','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','json','apply','update','then','destroy','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys'];(function(_0x257855,_0x41ec3c){var _0x393025=function(_0x5acc0d){while(--_0x5acc0d){_0x257855['push'](_0x257855['shift']());}};_0x393025(++_0x41ec3c);}(_0xb6b6,0x1b5));var _0x6b6b=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xb6b6[_0x4b055c];return _0x4b62bb;};'use strict';var pdf=require(_0x6b6b('0x0'));var emlformat=require(_0x6b6b('0x1'));var rimraf=require(_0x6b6b('0x2'));var zipdir=require(_0x6b6b('0x3'));var jsonpatch=require(_0x6b6b('0x4'));var rp=require(_0x6b6b('0x5'));var moment=require(_0x6b6b('0x6'));var BPromise=require(_0x6b6b('0x7'));var Mustache=require(_0x6b6b('0x8'));var util=require(_0x6b6b('0x9'));var path=require(_0x6b6b('0xa'));var sox=require('sox');var csv=require(_0x6b6b('0xb'));var ejs=require(_0x6b6b('0xc'));var fs=require('fs');var _=require(_0x6b6b('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6b6b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b6b('0xf'));var Papa=require('papaparse');var Redis=require(_0x6b6b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6b6b('0x11'));var as=require(_0x6b6b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b6b('0x13'))('api');var utils=require(_0x6b6b('0x14'));var config=require(_0x6b6b('0x15'));var db=require(_0x6b6b('0x16'))['db'];function respondWithStatusCode(_0x1744e0,_0x6766b){_0x6766b=_0x6766b||0xcc;return function(_0xd93007){if(_0xd93007){return _0x1744e0[_0x6b6b('0x17')](_0x6766b);}return _0x1744e0[_0x6b6b('0x18')](_0x6766b)[_0x6b6b('0x19')]();};}function respondWithResult(_0x34365d,_0x2c35af){_0x2c35af=_0x2c35af||0xc8;return function(_0x3a0dca){if(_0x3a0dca){return _0x34365d[_0x6b6b('0x18')](_0x2c35af)['json'](_0x3a0dca);}};}function respondWithFilteredResult(_0xca274,_0x1b1a4e){return function(_0x2a0e92){if(_0x2a0e92){var _0x38c15c=_0x2a0e92[_0x6b6b('0x1a')],_0x29bf20=_0x1b1a4e[_0x6b6b('0x1b')],_0x5a745a=_0x1b1a4e[_0x6b6b('0x1b')]+_0x1b1a4e[_0x6b6b('0x1c')],_0x173208;if(_0x5a745a>=_0x38c15c){_0x5a745a=_0x38c15c;_0x173208=0xc8;}else{_0x173208=0xce;}_0xca274['status'](_0x173208);return _0xca274['set']('Content-Range',_0x29bf20+'-'+_0x5a745a+'/'+_0x38c15c)[_0x6b6b('0x1d')](_0x2a0e92);}return null;};}function patchUpdates(_0x38978e){return function(_0x3bbaa0){try{jsonpatch[_0x6b6b('0x1e')](_0x3bbaa0,_0x38978e,!![]);}catch(_0x4de08f){return BPromise['reject'](_0x4de08f);}return _0x3bbaa0['save']();};}function saveUpdates(_0x1edbd7,_0x586776){return function(_0x432785){if(_0x432785){return _0x432785[_0x6b6b('0x1f')](_0x1edbd7)[_0x6b6b('0x20')](function(_0x1a6e78){return _0x1a6e78;});}return null;};}function removeEntity(_0x3d528e,_0x3b523f){return function(_0x458468){if(_0x458468){return _0x458468[_0x6b6b('0x21')]()[_0x6b6b('0x20')](function(){_0x3d528e[_0x6b6b('0x18')](0xcc)[_0x6b6b('0x19')]();});}};}function handleEntityNotFound(_0x20120e,_0x206a62){return function(_0x43a81b){if(!_0x43a81b){_0x20120e['sendStatus'](0x194);}return _0x43a81b;};}function handleError(_0x401914,_0x36ba4b){_0x36ba4b=_0x36ba4b||0x1f4;return function(_0x35be7e){logger[_0x6b6b('0x22')](_0x35be7e[_0x6b6b('0x23')]);if(_0x35be7e[_0x6b6b('0x24')]){delete _0x35be7e[_0x6b6b('0x24')];}_0x401914[_0x6b6b('0x18')](_0x36ba4b)[_0x6b6b('0x25')](_0x35be7e);};}exports[_0x6b6b('0x26')]=function(_0x3395d3,_0x1fd6c1){var _0x2aab53={},_0x305eb9={},_0x29c613={'count':0x0,'rows':[]};var _0x40022b=_[_0x6b6b('0x27')](db[_0x6b6b('0x28')][_0x6b6b('0x29')],function(_0x54a30a){return{'name':_0x54a30a[_0x6b6b('0x2a')],'type':_0x54a30a[_0x6b6b('0x2b')][_0x6b6b('0x2c')]};});_0x305eb9[_0x6b6b('0x2d')]=_['map'](_0x40022b,_0x6b6b('0x24'));_0x305eb9[_0x6b6b('0x2e')]=_['keys'](_0x3395d3['query']);_0x305eb9[_0x6b6b('0x2f')]=_[_0x6b6b('0x30')](_0x305eb9[_0x6b6b('0x2d')],_0x305eb9['query']);_0x2aab53[_0x6b6b('0x31')]=_['intersection'](_0x305eb9['model'],qs[_0x6b6b('0x32')](_0x3395d3[_0x6b6b('0x2e')]['fields']));_0x2aab53[_0x6b6b('0x31')]=_0x2aab53[_0x6b6b('0x31')][_0x6b6b('0x33')]?_0x2aab53[_0x6b6b('0x31')]:_0x305eb9[_0x6b6b('0x2d')];if(!_0x3395d3['query']['hasOwnProperty'](_0x6b6b('0x34'))){_0x2aab53[_0x6b6b('0x1c')]=qs[_0x6b6b('0x1c')](_0x3395d3[_0x6b6b('0x2e')][_0x6b6b('0x1c')]);_0x2aab53[_0x6b6b('0x1b')]=qs[_0x6b6b('0x1b')](_0x3395d3[_0x6b6b('0x2e')]['offset']);}_0x2aab53[_0x6b6b('0x35')]=qs[_0x6b6b('0x36')](_0x3395d3[_0x6b6b('0x2e')][_0x6b6b('0x36')]);_0x2aab53[_0x6b6b('0x37')]=qs[_0x6b6b('0x2f')](_[_0x6b6b('0x38')](_0x3395d3['query'],_0x305eb9[_0x6b6b('0x2f')]),_0x40022b);if(_0x3395d3[_0x6b6b('0x2e')][_0x6b6b('0x39')]){_0x2aab53[_0x6b6b('0x37')]=_[_0x6b6b('0x3a')](_0x2aab53[_0x6b6b('0x37')],{'$or':_['map'](_0x40022b,function(_0x38c69c){if(_0x38c69c[_0x6b6b('0x2b')]!==_0x6b6b('0x3b')){var _0x2f39ef={};_0x2f39ef[_0x38c69c[_0x6b6b('0x24')]]={'$like':'%'+_0x3395d3[_0x6b6b('0x2e')][_0x6b6b('0x39')]+'%'};return _0x2f39ef;}})});}_0x2aab53=_[_0x6b6b('0x3a')]({},_0x2aab53,_0x3395d3['options']);var _0x27e6d4={'where':_0x2aab53[_0x6b6b('0x37')]};return db[_0x6b6b('0x28')][_0x6b6b('0x1a')](_0x27e6d4)[_0x6b6b('0x20')](function(_0x2ff6ae){_0x29c613[_0x6b6b('0x1a')]=_0x2ff6ae;if(_0x3395d3[_0x6b6b('0x2e')][_0x6b6b('0x3c')]){_0x2aab53[_0x6b6b('0x3d')]=[{'all':!![]}];}return db[_0x6b6b('0x28')][_0x6b6b('0x3e')](_0x2aab53);})[_0x6b6b('0x20')](function(_0x28edf8){_0x29c613[_0x6b6b('0x3f')]=_0x28edf8;return _0x29c613;})['then'](respondWithFilteredResult(_0x1fd6c1,_0x2aab53))[_0x6b6b('0x40')](handleError(_0x1fd6c1,null));};exports['show']=function(_0x22070e,_0x2ebd39){var _0xa20963={'raw':!![],'where':{'id':_0x22070e[_0x6b6b('0x41')]['id']}},_0x1e6927={};_0x1e6927[_0x6b6b('0x2d')]=_[_0x6b6b('0x42')](db[_0x6b6b('0x28')]['rawAttributes']);_0x1e6927[_0x6b6b('0x2e')]=_[_0x6b6b('0x42')](_0x22070e[_0x6b6b('0x2e')]);_0x1e6927[_0x6b6b('0x2f')]=_[_0x6b6b('0x30')](_0x1e6927['model'],_0x1e6927[_0x6b6b('0x2e')]);_0xa20963[_0x6b6b('0x31')]=_[_0x6b6b('0x30')](_0x1e6927[_0x6b6b('0x2d')],qs[_0x6b6b('0x32')](_0x22070e['query'][_0x6b6b('0x32')]));_0xa20963['attributes']=_0xa20963[_0x6b6b('0x31')][_0x6b6b('0x33')]?_0xa20963[_0x6b6b('0x31')]:_0x1e6927[_0x6b6b('0x2d')];if(_0x22070e[_0x6b6b('0x2e')][_0x6b6b('0x3c')]){_0xa20963[_0x6b6b('0x3d')]=[{'all':!![]}];}_0xa20963=_['merge']({},_0xa20963,_0x22070e['options']);return db[_0x6b6b('0x28')][_0x6b6b('0x43')](_0xa20963)[_0x6b6b('0x20')](handleEntityNotFound(_0x2ebd39,null))[_0x6b6b('0x20')](respondWithResult(_0x2ebd39,null))['catch'](handleError(_0x2ebd39,null));};exports[_0x6b6b('0x44')]=function(_0x309cfc,_0x94609a){return db['CmHopperHistory'][_0x6b6b('0x44')](_0x309cfc['body'],{})['then'](respondWithResult(_0x94609a,0xc9))[_0x6b6b('0x40')](handleError(_0x94609a,null));};exports[_0x6b6b('0x45')]=function(_0xdeeb33,_0x3385a3){return db['CmHopperHistory']['describe']()[_0x6b6b('0x20')](respondWithResult(_0x3385a3,null))[_0x6b6b('0x40')](handleError(_0x3385a3,null));};exports[_0x6b6b('0x1f')]=function(_0x417743,_0x469e22){if(_0x417743[_0x6b6b('0x46')][_0x6b6b('0x47')]){delete _0x417743[_0x6b6b('0x46')][_0x6b6b('0x47')];}return db[_0x6b6b('0x28')][_0x6b6b('0x43')]({'where':{'uniqueid':_0x417743[_0x6b6b('0x41')]['id']}})[_0x6b6b('0x20')](handleEntityNotFound(_0x469e22,null))['then'](saveUpdates(_0x417743[_0x6b6b('0x46')],null))[_0x6b6b('0x20')](respondWithResult(_0x469e22,null))[_0x6b6b('0x40')](handleError(_0x469e22,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 904a6de..350f86c 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 _0x28ef=['rimraf','../../config/environment','./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x325655,_0x210a05){var _0x1ae7a0=function(_0x472c63){while(--_0x472c63){_0x325655['push'](_0x325655['shift']());}};_0x1ae7a0(++_0x210a05);}(_0x28ef,0x1ac));var _0xf28e=function(_0x3a15b9,_0x529285){_0x3a15b9=_0x3a15b9-0x0;var _0x3ab20d=_0x28ef[_0x3a15b9];return _0x3ab20d;};'use strict';var _=require(_0xf28e('0x0'));var util=require(_0xf28e('0x1'));var logger=require(_0xf28e('0x2'))(_0xf28e('0x3'));var moment=require('moment');var BPromise=require(_0xf28e('0x4'));var rp=require(_0xf28e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf28e('0x6'));var config=require(_0xf28e('0x7'));var attributes=require(_0xf28e('0x8'));module[_0xf28e('0x9')]=function(_0x5e0423,_0x55670c){return _0x5e0423['define'](_0xf28e('0xa'),attributes,{'tableName':_0xf28e('0xb'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xf28e('0xc')]},{'name':_0xf28e('0xd'),'fields':[_0xf28e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe855=['request-promise','./cmHopperHistory.attributes','exports','define','CmHopperHistory','endtime','uniqueid','lodash','util','api','bluebird'];(function(_0x40fcc0,_0x4c9766){var _0x5004cb=function(_0x3d8b8e){while(--_0x3d8b8e){_0x40fcc0['push'](_0x40fcc0['shift']());}};_0x5004cb(++_0x4c9766);}(_0xe855,0x130));var _0x5e85=function(_0x5aae53,_0x33c6d4){_0x5aae53=_0x5aae53-0x0;var _0x11a64d=_0xe855[_0x5aae53];return _0x11a64d;};'use strict';var _=require(_0x5e85('0x0'));var util=require(_0x5e85('0x1'));var logger=require('../../config/logger')(_0x5e85('0x2'));var moment=require('moment');var BPromise=require(_0x5e85('0x3'));var rp=require(_0x5e85('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5e85('0x5'));module[_0x5e85('0x6')]=function(_0x5a732b,_0x531c84){return _0x5a732b[_0x5e85('0x7')](_0x5e85('0x8'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x5e85('0x9'),'fields':[_0x5e85('0x9')]},{'name':_0x5e85('0xa'),'fields':[_0x5e85('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 81bf341..1c2273d 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 _0x0abf=['`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`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','ivrTotalCallsDays','GetCampaignHopperHistory','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','then','AvgHandleTime','where','sequelize','COUNT','col','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','debug','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay'];(function(_0x136cdd,_0x5495b3){var _0x4d7b76=function(_0x2c3132){while(--_0x2c3132){_0x136cdd['push'](_0x136cdd['shift']());}};_0x4d7b76(++_0x5495b3);}(_0x0abf,0xe8));var _0xf0ab=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0abf[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var moment=require(_0xf0ab('0x1'));var BPromise=require(_0xf0ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0ab('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0ab('0x4'))(_0xf0ab('0x5'));var config=require(_0xf0ab('0x6'));var jayson=require(_0xf0ab('0x7'));var client=jayson[_0xf0ab('0x8')][_0xf0ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x233afe,_0x57ff3b,_0x2c4628){return new BPromise(function(_0x3f7e2b,_0x3ca099){return client[_0xf0ab('0xa')](_0x233afe,_0x2c4628)['then'](function(_0x472508){logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,'request\x20sent');logger['debug'](_0xf0ab('0xd'),_0x57ff3b,'request\x20sent',JSON[_0xf0ab('0xe')](_0x472508));if(_0x472508[_0xf0ab('0xf')]){if(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x10')]===0x1f4){logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')]['message']);return _0x3ca099(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);return _0x3f7e2b(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}else{logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,_0xf0ab('0x12'));_0x3f7e2b(_0x472508[_0xf0ab('0x13')][_0xf0ab('0x11')]);}})[_0xf0ab('0x14')](function(_0x230f40){logger['error'](_0xf0ab('0xc'),_0x57ff3b,_0x230f40);_0x3ca099(_0x230f40);});});}exports[_0xf0ab('0x15')]=function(_0x1803f0){var _0x1ffeb5=this;return new Promise(function(_0x776619,_0xb9a33){return db[_0xf0ab('0x16')][_0xf0ab('0x17')](_0x1803f0[_0xf0ab('0x18')],{'raw':_0x1803f0[_0xf0ab('0x19')]?_0x1803f0[_0xf0ab('0x19')][_0xf0ab('0x1a')]===undefined?!![]:![]:!![]})[_0xf0ab('0x1b')](function(_0x22a205){logger[_0xf0ab('0xb')](_0xf0ab('0x15'),_0x1803f0);logger['debug'](_0xf0ab('0x15'),_0x1803f0,JSON[_0xf0ab('0xe')](_0x22a205));_0x776619(_0x22a205);})[_0xf0ab('0x14')](function(_0x11ab3a){logger[_0xf0ab('0xf')](_0xf0ab('0x15'),_0x11ab3a[_0xf0ab('0x11')],_0x1803f0);_0xb9a33(_0x1ffeb5[_0xf0ab('0xf')](0x1f4,_0x11ab3a[_0xf0ab('0x11')]));});});};exports[_0xf0ab('0x1c')]=function(_0x43119f){var _0x5645b2=this;return new Promise(function(_0x585841,_0x4eee21){return db[_0xf0ab('0x16')]['findAll']({'raw':_0x43119f[_0xf0ab('0x19')]?_0x43119f[_0xf0ab('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x43119f[_0xf0ab('0x19')]?_0x43119f[_0xf0ab('0x19')][_0xf0ab('0x1d')]||null:null,'attributes':[[db[_0xf0ab('0x1e')]['fn'](_0xf0ab('0x1f'),db['sequelize'][_0xf0ab('0x20')]('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')]['fn']('IF',db[_0xf0ab('0x1e')][_0xf0ab('0x21')](_0xf0ab('0x22')))),_0xf0ab('0x23')],[db[_0xf0ab('0x1e')]['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')]['fn']('IF',db[_0xf0ab('0x1e')][_0xf0ab('0x21')](_0xf0ab('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xf0ab('0x1e')]['fn'](_0xf0ab('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0xf0ab('0x21')](_0xf0ab('0x25')))),_0xf0ab('0x26')],[db['sequelize']['fn']('AVG',db[_0xf0ab('0x1e')]['fn']('IF',db['sequelize'][_0xf0ab('0x21')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0xf0ab('0x27')],[db[_0xf0ab('0x1e')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0xf0ab('0x1e')][_0xf0ab('0x21')](_0xf0ab('0x28')))),_0xf0ab('0x29')]]})[_0xf0ab('0x1b')](function(_0x36195d){logger[_0xf0ab('0xb')](_0xf0ab('0x1c'),_0x43119f);logger[_0xf0ab('0x2a')](_0xf0ab('0x1c'),_0x43119f,JSON[_0xf0ab('0xe')](_0x36195d));_0x585841(_0x36195d);})[_0xf0ab('0x14')](function(_0x22dcfe){logger[_0xf0ab('0xf')]('AvgHandleTime',_0x22dcfe[_0xf0ab('0x11')],_0x43119f);_0x4eee21(_0x5645b2[_0xf0ab('0xf')](0x1f4,_0x22dcfe[_0xf0ab('0x11')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x9e38af){var _0xe4d58b=this;return new Promise(function(_0x5d99e7,_0x58bc85){return db[_0xf0ab('0x16')]['findAll']({'raw':_0x9e38af[_0xf0ab('0x19')]?_0x9e38af['options'][_0xf0ab('0x1a')]===undefined?!![]:![]:!![],'where':_0x9e38af[_0xf0ab('0x19')]?_0x9e38af[_0xf0ab('0x19')][_0xf0ab('0x1d')]||null:null,'attributes':[[_0xf0ab('0x2b'),_0xf0ab('0x2c')],[db['sequelize']['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')]['fn']('IF',db['sequelize'][_0xf0ab('0x21')](_0xf0ab('0x2d')))),_0xf0ab('0x2e')],[db[_0xf0ab('0x1e')]['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')]['fn']('IF',db[_0xf0ab('0x1e')]['literal'](_0xf0ab('0x2f')))),_0xf0ab('0x30')],[db[_0xf0ab('0x1e')]['fn']('COUNT',db[_0xf0ab('0x1e')]['fn']('IF',db[_0xf0ab('0x1e')][_0xf0ab('0x21')](_0xf0ab('0x22')))),_0xf0ab('0x31')],[db['sequelize']['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')]['fn']('IF',db[_0xf0ab('0x1e')][_0xf0ab('0x21')](_0xf0ab('0x32')))),_0xf0ab('0x33')],[db[_0xf0ab('0x1e')]['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')]['fn']('IF',db[_0xf0ab('0x1e')][_0xf0ab('0x21')](_0xf0ab('0x34')))),_0xf0ab('0x35')],[db['sequelize']['fn']('COUNT',db[_0xf0ab('0x1e')]['fn']('IF',db['sequelize'][_0xf0ab('0x21')](_0xf0ab('0x36')))),'outboundDropCallsDayTimeout'],[db[_0xf0ab('0x1e')]['fn'](_0xf0ab('0x1f'),db['sequelize']['fn']('IF',db[_0xf0ab('0x1e')][_0xf0ab('0x21')](_0xf0ab('0x37')))),_0xf0ab('0x38')],[db[_0xf0ab('0x1e')]['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')]['fn']('IF',db[_0xf0ab('0x1e')][_0xf0ab('0x21')](_0xf0ab('0x39')))),_0xf0ab('0x3a')],[db[_0xf0ab('0x1e')]['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')]['fn']('IF',db['sequelize']['literal'](_0xf0ab('0x3b')))),'outboundBlacklistCallsDay'],[db['sequelize']['fn']('COUNT',db[_0xf0ab('0x1e')]['fn']('IF',db[_0xf0ab('0x1e')][_0xf0ab('0x21')](_0xf0ab('0x3c')))),_0xf0ab('0x3d')],[db[_0xf0ab('0x1e')]['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')]['fn']('IF',db[_0xf0ab('0x1e')][_0xf0ab('0x21')](_0xf0ab('0x3e')))),_0xf0ab('0x3f')],[db['sequelize']['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')]['fn']('IF',db[_0xf0ab('0x1e')][_0xf0ab('0x21')](_0xf0ab('0x40')))),_0xf0ab('0x41')],[db[_0xf0ab('0x1e')]['fn'](_0xf0ab('0x1f'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xf0ab('0x42')))),_0xf0ab('0x3f')],[db['sequelize']['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')]['fn']('IF',db['sequelize'][_0xf0ab('0x21')](_0xf0ab('0x43')))),_0xf0ab('0x44')]],'group':[_0xf0ab('0x2b')]})[_0xf0ab('0x1b')](function(_0x33112b){logger[_0xf0ab('0xb')]('GetVoiceQueueHopperHistory',_0x9e38af);logger[_0xf0ab('0x2a')]('GetVoiceQueueHopperHistory',_0x9e38af,JSON[_0xf0ab('0xe')](_0x33112b));_0x5d99e7(_0x33112b);})['catch'](function(_0x1a402b){logger['error']('GetVoiceQueueHopperHistory',_0x1a402b[_0xf0ab('0x11')],_0x9e38af);_0x58bc85(_0xe4d58b['error'](0x1f4,_0x1a402b[_0xf0ab('0x11')]));});});};exports['GetCampaignHopperHistory']=function(_0x2eff07){var _0x488001=this;return new Promise(function(_0x42331c,_0x2114f0){return db[_0xf0ab('0x16')]['findAll']({'raw':_0x2eff07['options']?_0x2eff07['options'][_0xf0ab('0x1a')]===undefined?!![]:![]:!![],'where':_0x2eff07[_0xf0ab('0x19')]?_0x2eff07['options']['where']||null:null,'attributes':[[_0xf0ab('0x2b'),_0xf0ab('0x2c')],[db[_0xf0ab('0x1e')]['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')][_0xf0ab('0x20')]('id')),_0xf0ab('0x45')],[db[_0xf0ab('0x1e')]['fn'](_0xf0ab('0x1f'),db[_0xf0ab('0x1e')]['fn']('IF',db[_0xf0ab('0x1e')]['literal'](_0xf0ab('0x22')))),'ivrAnswerCallsDay']],'group':[_0xf0ab('0x2b')]})[_0xf0ab('0x1b')](function(_0x14e4ee){logger[_0xf0ab('0xb')](_0xf0ab('0x46'),_0x2eff07);logger[_0xf0ab('0x2a')](_0xf0ab('0x46'),_0x2eff07,JSON[_0xf0ab('0xe')](_0x14e4ee));_0x42331c(_0x14e4ee);})[_0xf0ab('0x14')](function(_0x180ee6){logger['error'](_0xf0ab('0x46'),_0x180ee6[_0xf0ab('0x11')],_0x2eff07);_0x2114f0(_0x488001[_0xf0ab('0xf')](0x1f4,_0x180ee6[_0xf0ab('0x11')]));});});}; \ No newline at end of file +var _0xda3f=['COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','GetVoiceQueueHopperHistory','findAll','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','campaign','GetCampaignHopperHistory','ivrTotalCallsDays','util','moment','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','where'];(function(_0x10b757,_0x3cf7ca){var _0x5fffd2=function(_0xd83dbc){while(--_0xd83dbc){_0x10b757['push'](_0x10b757['shift']());}};_0x5fffd2(++_0x3cf7ca);}(_0xda3f,0xec));var _0xfda3=function(_0x30f8cd,_0x359d9a){_0x30f8cd=_0x30f8cd-0x0;var _0x159537=_0xda3f[_0x30f8cd];return _0x159537;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});}exports[_0xfda3('0x14')]=function(_0x4680bf){var _0xc62ae6=this;return new Promise(function(_0x54a7c6,_0x15ddb9){return db[_0xfda3('0x15')][_0xfda3('0x16')](_0x4680bf[_0xfda3('0x17')],{'raw':_0x4680bf['options']?_0x4680bf[_0xfda3('0x18')][_0xfda3('0x19')]===undefined?!![]:![]:!![]})[_0xfda3('0x8')](function(_0x51e731){logger['info'](_0xfda3('0x14'),_0x4680bf);logger[_0xfda3('0xc')](_0xfda3('0x14'),_0x4680bf,JSON['stringify'](_0x51e731));_0x54a7c6(_0x51e731);})[_0xfda3('0x13')](function(_0xef2535){logger[_0xfda3('0xf')](_0xfda3('0x14'),_0xef2535[_0xfda3('0x11')],_0x4680bf);_0x15ddb9(_0xc62ae6[_0xfda3('0xf')](0x1f4,_0xef2535[_0xfda3('0x11')]));});});};exports[_0xfda3('0x1a')]=function(_0x16eaa6){var _0x5499f5=this;return new Promise(function(_0x82341b,_0x2d5b44){return db[_0xfda3('0x15')]['findAll']({'raw':_0x16eaa6[_0xfda3('0x18')]?_0x16eaa6[_0xfda3('0x18')][_0xfda3('0x19')]===undefined?!![]:![]:!![],'where':_0x16eaa6[_0xfda3('0x18')]?_0x16eaa6[_0xfda3('0x18')][_0xfda3('0x1b')]||null:null,'attributes':[[db['sequelize']['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')][_0xfda3('0x1e')]('id')),_0xfda3('0x1f')],[db[_0xfda3('0x1d')]['fn']('COUNT',db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')](_0xfda3('0x21')))),_0xfda3('0x22')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db['sequelize']['fn']('IF',db['sequelize'][_0xfda3('0x20')]('`state`\x20=\x2010,\x201,\x20null'))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')](_0xfda3('0x23')))),_0xfda3('0x24')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x25'),db['sequelize']['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')](_0xfda3('0x26')))),_0xfda3('0x27')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x25'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0xfda3('0x8')](function(_0x17cccb){logger['info'](_0xfda3('0x1a'),_0x16eaa6);logger[_0xfda3('0xc')](_0xfda3('0x1a'),_0x16eaa6,JSON['stringify'](_0x17cccb));_0x82341b(_0x17cccb);})[_0xfda3('0x13')](function(_0x378bf0){logger[_0xfda3('0xf')](_0xfda3('0x1a'),_0x378bf0[_0xfda3('0x11')],_0x16eaa6);_0x2d5b44(_0x5499f5['error'](0x1f4,_0x378bf0[_0xfda3('0x11')]));});});};exports[_0xfda3('0x28')]=function(_0x33bdfb){var _0x56bed2=this;return new Promise(function(_0x373c96,_0x4854b1){return db[_0xfda3('0x15')][_0xfda3('0x29')]({'raw':_0x33bdfb[_0xfda3('0x18')]?_0x33bdfb[_0xfda3('0x18')][_0xfda3('0x19')]===undefined?!![]:![]:!![],'where':_0x33bdfb[_0xfda3('0x18')]?_0x33bdfb[_0xfda3('0x18')][_0xfda3('0x1b')]||null:null,'attributes':[['campaign',_0xfda3('0x2a')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db['sequelize'][_0xfda3('0x20')](_0xfda3('0x2b')))),_0xfda3('0x2c')],[db['sequelize']['fn']('COUNT',db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')](_0xfda3('0x2d')))),_0xfda3('0x2e')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0xfda3('0x2f')],[db[_0xfda3('0x1d')]['fn']('COUNT',db[_0xfda3('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xfda3('0x30')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db['sequelize'][_0xfda3('0x20')](_0xfda3('0x31')))),_0xfda3('0x32')],[db[_0xfda3('0x1d')]['fn']('COUNT',db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')](_0xfda3('0x33')))),_0xfda3('0x34')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')](_0xfda3('0x35')))),_0xfda3('0x36')],[db['sequelize']['fn']('COUNT',db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')](_0xfda3('0x37')))),_0xfda3('0x38')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')]('`state`\x20=\x2014,\x201,\x20null'))),_0xfda3('0x39')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')]['literal'](_0xfda3('0x3a')))),_0xfda3('0x3b')],[db[_0xfda3('0x1d')]['fn']('COUNT',db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')]('`state`\x20=\x2016,\x201,\x20null'))),_0xfda3('0x3c')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')]['literal'](_0xfda3('0x3d')))),'outboundRejectCallsDay'],[db[_0xfda3('0x1d')]['fn']('COUNT',db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')](_0xfda3('0x3e')))),'outboundReCallsDay']],'group':[_0xfda3('0x3f')]})[_0xfda3('0x8')](function(_0x2f2c32){logger[_0xfda3('0x9')](_0xfda3('0x28'),_0x33bdfb);logger[_0xfda3('0xc')](_0xfda3('0x28'),_0x33bdfb,JSON['stringify'](_0x2f2c32));_0x373c96(_0x2f2c32);})['catch'](function(_0x4fb214){logger[_0xfda3('0xf')](_0xfda3('0x28'),_0x4fb214['message'],_0x33bdfb);_0x4854b1(_0x56bed2['error'](0x1f4,_0x4fb214[_0xfda3('0x11')]));});});};exports[_0xfda3('0x40')]=function(_0x10ee1b){var _0x421e02=this;return new Promise(function(_0x2fcbe7,_0x4bc976){return db[_0xfda3('0x15')][_0xfda3('0x29')]({'raw':_0x10ee1b[_0xfda3('0x18')]?_0x10ee1b[_0xfda3('0x18')][_0xfda3('0x19')]===undefined?!![]:![]:!![],'where':_0x10ee1b[_0xfda3('0x18')]?_0x10ee1b[_0xfda3('0x18')][_0xfda3('0x1b')]||null:null,'attributes':[[_0xfda3('0x3f'),_0xfda3('0x2a')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db['sequelize'][_0xfda3('0x1e')]('id')),_0xfda3('0x41')],[db[_0xfda3('0x1d')]['fn'](_0xfda3('0x1c'),db[_0xfda3('0x1d')]['fn']('IF',db[_0xfda3('0x1d')][_0xfda3('0x20')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0xfda3('0x3f')]})[_0xfda3('0x8')](function(_0x486e55){logger[_0xfda3('0x9')](_0xfda3('0x40'),_0x10ee1b);logger[_0xfda3('0xc')](_0xfda3('0x40'),_0x10ee1b,JSON['stringify'](_0x486e55));_0x2fcbe7(_0x486e55);})['catch'](function(_0xb61f7c){logger[_0xfda3('0xf')](_0xfda3('0x40'),_0xb61f7c['message'],_0x10ee1b);_0x4bc976(_0x421e02[_0xfda3('0xf')](0x1f4,_0xb61f7c['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 326a3bc..23e4294 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 _0xade9=['isAuthenticated','/describe','describe','/:id','show','put','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x5754d5,_0x37eae5){var _0x867c04=function(_0x29b4ac){while(--_0x29b4ac){_0x5754d5['push'](_0x5754d5['shift']());}};_0x867c04(++_0x37eae5);}(_0xade9,0x1e7));var _0x9ade=function(_0x181cbd,_0x51a26e){_0x181cbd=_0x181cbd-0x0;var _0x45b84c=_0xade9[_0x181cbd];return _0x45b84c;};'use strict';var multer=require('multer');var util=require(_0x9ade('0x0'));var path=require(_0x9ade('0x1'));var timeout=require(_0x9ade('0x2'));var express=require(_0x9ade('0x3'));var router=express[_0x9ade('0x4')]();var auth=require(_0x9ade('0x5'));var interaction=require(_0x9ade('0x6'));var config=require(_0x9ade('0x7'));var controller=require('./cmHopperHistory.controller');router[_0x9ade('0x8')]('/',auth[_0x9ade('0x9')](),controller['index']);router[_0x9ade('0x8')](_0x9ade('0xa'),auth['isAuthenticated'](),controller[_0x9ade('0xb')]);router[_0x9ade('0x8')](_0x9ade('0xc'),auth['isAuthenticated'](),controller[_0x9ade('0xd')]);router['post']('/',auth[_0x9ade('0x9')](),controller['create']);router[_0x9ade('0xe')](_0x9ade('0xc'),auth[_0x9ade('0x9')](),controller['update']);module[_0x9ade('0xf')]=router; \ No newline at end of file +var _0x1e6f=['get','/describe','describe','create','/:id','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index'];(function(_0xec2cd8,_0x286998){var _0xfc393f=function(_0x1057c0){while(--_0x1057c0){_0xec2cd8['push'](_0xec2cd8['shift']());}};_0xfc393f(++_0x286998);}(_0x1e6f,0xb6));var _0xf1e6=function(_0x475113,_0x20b08d){_0x475113=_0x475113-0x0;var _0x40df07=_0x1e6f[_0x475113];return _0x40df07;};'use strict';var multer=require(_0xf1e6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf1e6('0x1'));var express=require(_0xf1e6('0x2'));var router=express[_0xf1e6('0x3')]();var auth=require(_0xf1e6('0x4'));var interaction=require(_0xf1e6('0x5'));var config=require(_0xf1e6('0x6'));var controller=require(_0xf1e6('0x7'));router['get']('/',auth[_0xf1e6('0x8')](),controller[_0xf1e6('0x9')]);router[_0xf1e6('0xa')](_0xf1e6('0xb'),auth[_0xf1e6('0x8')](),controller[_0xf1e6('0xc')]);router[_0xf1e6('0xa')]('/:id',auth[_0xf1e6('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xf1e6('0xd')]);router['put'](_0xf1e6('0xe'),auth['isAuthenticated'](),controller['update']);module[_0xf1e6('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 8d480c9..ad2e3f9 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 _0x2ee7=['exports','STRING','name','sequelize'];(function(_0x1c07cf,_0x1e0337){var _0x791c03=function(_0x27080d){while(--_0x27080d){_0x1c07cf['push'](_0x1c07cf['shift']());}};_0x791c03(++_0x1e0337);}(_0x2ee7,0xab));var _0x72ee=function(_0x53200f,_0x322acd){_0x53200f=_0x53200f-0x0;var _0x1cb714=_0x2ee7[_0x53200f];return _0x1cb714;};'use strict';var Sequelize=require(_0x72ee('0x0'));module[_0x72ee('0x1')]={'name':{'type':Sequelize[_0x72ee('0x2')],'unique':_0x72ee('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x72ee('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf2af=['name','STRING'];(function(_0x56f3d5,_0xe55685){var _0x27aaee=function(_0x254208){while(--_0x254208){_0x56f3d5['push'](_0x56f3d5['shift']());}};_0x27aaee(++_0xe55685);}(_0xf2af,0x109));var _0xff2a=function(_0x2ef87d,_0x29d48d){_0x2ef87d=_0x2ef87d-0x0;var _0x49d160=_0xf2af[_0x2ef87d];return _0x49d160;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xff2a('0x0')],'unique':_0xff2a('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xff2a('0x0')]},'dialPrefix':{'type':Sequelize[_0xff2a('0x0')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 034655d..8fa88f0 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 _0x2acc=['emit','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','then','UserProfileResource','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','model','fields','attributes','length','order','sort','filters','filter','where','merge','VIRTUAL','options','CmList','includeAll','include','findAll','catch','show','params','intersection','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','update','destroy','describe','ListId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','pick','rows','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','push','each','omit','success','dataValues','errors','getContacts','CmCustomField','CustomFields','format','cf_%d','raw','getContactsCsv','concat','isEmpty','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','/tmp/list_%d_%s.csv','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','text','number','BOOLEAN','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','addAgents','spread','removeAgents'];(function(_0x2c6eae,_0x4ebae0){var _0x5e2722=function(_0x5e2ede){while(--_0x5e2ede){_0x2c6eae['push'](_0x2c6eae['shift']());}};_0x5e2722(++_0x4ebae0);}(_0x2acc,0x91));var _0xc2ac=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2acc[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc2ac('0x0'));var rimraf=require(_0xc2ac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc2ac('0x2'));var rp=require(_0xc2ac('0x3'));var moment=require(_0xc2ac('0x4'));var BPromise=require(_0xc2ac('0x5'));var Mustache=require(_0xc2ac('0x6'));var util=require(_0xc2ac('0x7'));var path=require(_0xc2ac('0x8'));var sox=require(_0xc2ac('0x9'));var csv=require(_0xc2ac('0xa'));var ejs=require(_0xc2ac('0xb'));var fs=require('fs');var _=require(_0xc2ac('0xc'));var squel=require('squel');var crypto=require(_0xc2ac('0xd'));var jsforce=require(_0xc2ac('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc2ac('0xa'));var querystring=require(_0xc2ac('0xf'));var Papa=require(_0xc2ac('0x10'));var Redis=require(_0xc2ac('0x11'));var authService=require(_0xc2ac('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc2ac('0x13'));var hardwareService=require(_0xc2ac('0x14'));var logger=require(_0xc2ac('0x15'))(_0xc2ac('0x16'));var utils=require(_0xc2ac('0x17'));var config=require(_0xc2ac('0x18'));var db=require(_0xc2ac('0x19'))['db'];config[_0xc2ac('0x1a')]=_[_0xc2ac('0x1b')](config['redis'],{'host':_0xc2ac('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./cmList.socket')[_0xc2ac('0x1d')](socket);function respondWithStatusCode(_0x15d79f,_0xc857ea){_0xc857ea=_0xc857ea||0xcc;return function(_0x132644){if(_0x132644){return _0x15d79f[_0xc2ac('0x1e')](_0xc857ea);}return _0x15d79f[_0xc2ac('0x1f')](_0xc857ea)['end']();};}function respondWithResult(_0x2c7f15,_0x49d464){_0x49d464=_0x49d464||0xc8;return function(_0x440662){if(_0x440662){return _0x2c7f15[_0xc2ac('0x1f')](_0x49d464)[_0xc2ac('0x20')](_0x440662);}};}function respondWithFilteredResult(_0xa6cde9,_0x381314){return function(_0x77a8d7){if(_0x77a8d7){var _0x32d130=_0x77a8d7[_0xc2ac('0x21')],_0x142b5f=_0x381314[_0xc2ac('0x22')],_0x2e3dc7=_0x381314[_0xc2ac('0x22')]+_0x381314[_0xc2ac('0x23')],_0x2c27f9;if(_0x2e3dc7>=_0x32d130){_0x2e3dc7=_0x32d130;_0x2c27f9=0xc8;}else{_0x2c27f9=0xce;}_0xa6cde9[_0xc2ac('0x1f')](_0x2c27f9);return _0xa6cde9[_0xc2ac('0x24')](_0xc2ac('0x25'),_0x142b5f+'-'+_0x2e3dc7+'/'+_0x32d130)[_0xc2ac('0x20')](_0x77a8d7);}return null;};}function patchUpdates(_0x1a0bc3){return function(_0x2b9ba6){try{jsonpatch['apply'](_0x2b9ba6,_0x1a0bc3,!![]);}catch(_0xc9755b){return BPromise[_0xc2ac('0x26')](_0xc9755b);}return _0x2b9ba6[_0xc2ac('0x27')]();};}function saveUpdates(_0xb73902,_0x3b3145){return function(_0xf617b4){if(_0xf617b4){return _0xf617b4['update'](_0xb73902)[_0xc2ac('0x28')](function(_0x35a71e){return _0x35a71e;});}return null;};}function removeEntity(_0x4e71c5,_0x4b2940){return function(_0x34ad86){if(_0x34ad86){return _0x34ad86['destroy']()[_0xc2ac('0x28')](function(){var _0x3b544d=_0x34ad86['get']({'plain':!![]});var _0x14a21e='Lists';return db[_0xc2ac('0x29')]['destroy']({'where':{'type':_0x14a21e,'resourceId':_0x3b544d['id']}})['then'](function(){return _0x34ad86;});})[_0xc2ac('0x28')](function(){_0x4e71c5[_0xc2ac('0x1f')](0xcc)[_0xc2ac('0x2a')]();});}};}function handleEntityNotFound(_0x2f5ed8,_0x2ffb0f){return function(_0x56abc4){if(!_0x56abc4){_0x2f5ed8[_0xc2ac('0x1e')](0x194);}return _0x56abc4;};}function handleError(_0x43dfe7,_0x278607){_0x278607=_0x278607||0x1f4;return function(_0x317d){logger[_0xc2ac('0x2b')](_0x317d[_0xc2ac('0x2c')]);if(_0x317d[_0xc2ac('0x2d')]){delete _0x317d['name'];}_0x43dfe7[_0xc2ac('0x1f')](_0x278607)['send'](_0x317d);};}exports[_0xc2ac('0x2e')]=function(_0x3772fd,_0xaa053d){var _0x41bb66={},_0x101be0={},_0x52fce9={'count':0x0,'rows':[]};var _0x37906e=_[_0xc2ac('0x2f')](db['CmList'][_0xc2ac('0x30')],function(_0x58595b){return{'name':_0x58595b[_0xc2ac('0x31')],'type':_0x58595b[_0xc2ac('0x32')][_0xc2ac('0x33')]};});_0x101be0['model']=_['map'](_0x37906e,_0xc2ac('0x2d'));_0x101be0[_0xc2ac('0x34')]=_[_0xc2ac('0x35')](_0x3772fd[_0xc2ac('0x34')]);_0x101be0['filters']=_['intersection'](_0x101be0['model'],_0x101be0[_0xc2ac('0x34')]);_0x41bb66['attributes']=_['intersection'](_0x101be0[_0xc2ac('0x36')],qs[_0xc2ac('0x37')](_0x3772fd['query'][_0xc2ac('0x37')]));_0x41bb66[_0xc2ac('0x38')]=_0x41bb66[_0xc2ac('0x38')][_0xc2ac('0x39')]?_0x41bb66['attributes']:_0x101be0[_0xc2ac('0x36')];if(!_0x3772fd['query']['hasOwnProperty']('nolimit')){_0x41bb66[_0xc2ac('0x23')]=qs['limit'](_0x3772fd['query'][_0xc2ac('0x23')]);_0x41bb66[_0xc2ac('0x22')]=qs[_0xc2ac('0x22')](_0x3772fd[_0xc2ac('0x34')][_0xc2ac('0x22')]);}_0x41bb66[_0xc2ac('0x3a')]=qs[_0xc2ac('0x3b')](_0x3772fd['query'][_0xc2ac('0x3b')]);_0x41bb66['where']=qs['filters'](_['pick'](_0x3772fd[_0xc2ac('0x34')],_0x101be0[_0xc2ac('0x3c')]),_0x37906e);if(_0x3772fd[_0xc2ac('0x34')][_0xc2ac('0x3d')]){_0x41bb66[_0xc2ac('0x3e')]=_[_0xc2ac('0x3f')](_0x41bb66[_0xc2ac('0x3e')],{'$or':_[_0xc2ac('0x2f')](_0x37906e,function(_0x4d6b06){if(_0x4d6b06[_0xc2ac('0x32')]!==_0xc2ac('0x40')){var _0x5deb7b={};_0x5deb7b[_0x4d6b06['name']]={'$like':'%'+_0x3772fd[_0xc2ac('0x34')][_0xc2ac('0x3d')]+'%'};return _0x5deb7b;}})});}_0x41bb66=_[_0xc2ac('0x3f')]({},_0x41bb66,_0x3772fd[_0xc2ac('0x41')]);var _0x4b99ac={'where':_0x41bb66[_0xc2ac('0x3e')]};return db[_0xc2ac('0x42')]['count'](_0x4b99ac)[_0xc2ac('0x28')](function(_0x5afb01){_0x52fce9['count']=_0x5afb01;if(_0x3772fd['query'][_0xc2ac('0x43')]){_0x41bb66[_0xc2ac('0x44')]=[{'all':!![]}];}return db[_0xc2ac('0x42')][_0xc2ac('0x45')](_0x41bb66);})['then'](function(_0x48bab5){_0x52fce9['rows']=_0x48bab5;return _0x52fce9;})[_0xc2ac('0x28')](respondWithFilteredResult(_0xaa053d,_0x41bb66))[_0xc2ac('0x46')](handleError(_0xaa053d,null));};exports[_0xc2ac('0x47')]=function(_0xf8240d,_0x281ec8){var _0x296609={'raw':![],'where':{'id':_0xf8240d[_0xc2ac('0x48')]['id']}},_0x4578f0={};_0x4578f0['model']=_[_0xc2ac('0x35')](db['CmList']['rawAttributes']);_0x4578f0[_0xc2ac('0x34')]=_[_0xc2ac('0x35')](_0xf8240d['query']);_0x4578f0['filters']=_[_0xc2ac('0x49')](_0x4578f0['model'],_0x4578f0[_0xc2ac('0x34')]);_0x296609['attributes']=_['intersection'](_0x4578f0[_0xc2ac('0x36')],qs[_0xc2ac('0x37')](_0xf8240d[_0xc2ac('0x34')]['fields']));_0x296609['attributes']=_0x296609[_0xc2ac('0x38')][_0xc2ac('0x39')]?_0x296609[_0xc2ac('0x38')]:_0x4578f0[_0xc2ac('0x36')];if(_0xf8240d[_0xc2ac('0x34')]['includeAll']){_0x296609['include']=[{'all':!![]}];}_0x296609=_[_0xc2ac('0x3f')]({},_0x296609,_0xf8240d[_0xc2ac('0x41')]);return db[_0xc2ac('0x42')]['find'](_0x296609)[_0xc2ac('0x28')](handleEntityNotFound(_0x281ec8,null))[_0xc2ac('0x28')](respondWithResult(_0x281ec8,null))[_0xc2ac('0x46')](handleError(_0x281ec8,null));};exports['create']=function(_0x2f0d42,_0x19daac){return db[_0xc2ac('0x42')][_0xc2ac('0x4a')](_0x2f0d42[_0xc2ac('0x4b')],{})[_0xc2ac('0x28')](function(_0x55f4fb){var _0x41b94a=_0x2f0d42[_0xc2ac('0x4c')][_0xc2ac('0x4d')]({'plain':!![]});if(!_0x41b94a)throw new Error(_0xc2ac('0x4e'));if(_0x41b94a[_0xc2ac('0x4f')]===_0xc2ac('0x4c')){var _0x28e346=_0x55f4fb[_0xc2ac('0x4d')]({'plain':!![]});var _0x33d53b='Lists';return db[_0xc2ac('0x50')][_0xc2ac('0x51')]({'where':{'name':_0x33d53b,'userProfileId':_0x41b94a['userProfileId']},'raw':!![]})[_0xc2ac('0x28')](function(_0x57fb5b){if(_0x57fb5b&&_0x57fb5b[_0xc2ac('0x52')]===0x0){return db[_0xc2ac('0x29')][_0xc2ac('0x4a')]({'name':_0x28e346[_0xc2ac('0x2d')],'resourceId':_0x28e346['id'],'type':_0x57fb5b[_0xc2ac('0x2d')],'sectionId':_0x57fb5b['id']},{})[_0xc2ac('0x28')](function(){return _0x55f4fb;});}else{return _0x55f4fb;}})[_0xc2ac('0x46')](function(_0x36676c){logger[_0xc2ac('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36676c);throw _0x36676c;});}return _0x55f4fb;})[_0xc2ac('0x28')](respondWithResult(_0x19daac,0xc9))[_0xc2ac('0x46')](handleError(_0x19daac,null));};exports[_0xc2ac('0x53')]=function(_0x43ddfc,_0x5dbee2){if(_0x43ddfc[_0xc2ac('0x4b')]['id']){delete _0x43ddfc[_0xc2ac('0x4b')]['id'];}return db['CmList'][_0xc2ac('0x51')]({'where':{'id':_0x43ddfc[_0xc2ac('0x48')]['id']}})[_0xc2ac('0x28')](handleEntityNotFound(_0x5dbee2,null))[_0xc2ac('0x28')](saveUpdates(_0x43ddfc[_0xc2ac('0x4b')],null))[_0xc2ac('0x28')](respondWithResult(_0x5dbee2,null))[_0xc2ac('0x46')](handleError(_0x5dbee2,null));};exports[_0xc2ac('0x54')]=function(_0x10c7f6,_0x5a54b2){return db[_0xc2ac('0x42')][_0xc2ac('0x51')]({'where':{'id':_0x10c7f6[_0xc2ac('0x48')]['id']}})[_0xc2ac('0x28')](handleEntityNotFound(_0x5a54b2,null))[_0xc2ac('0x28')](removeEntity(_0x5a54b2,null))[_0xc2ac('0x46')](handleError(_0x5a54b2,null));};exports['describe']=function(_0x43c0e4,_0x271ad3){return db[_0xc2ac('0x42')][_0xc2ac('0x55')]()['then'](respondWithResult(_0x271ad3,null))[_0xc2ac('0x46')](handleError(_0x271ad3,null));};exports['addDisposition']=function(_0x3e5544,_0x1d3379,_0x2b197e){if(_0x3e5544[_0xc2ac('0x4b')]['id']){delete _0x3e5544['body']['id'];}return db[_0xc2ac('0x42')][_0xc2ac('0x51')]({'where':{'id':_0x3e5544[_0xc2ac('0x48')]['id']}})[_0xc2ac('0x28')](handleEntityNotFound(_0x1d3379,null))[_0xc2ac('0x28')](function(_0x3073ad){if(_0x3073ad){_0x3e5544[_0xc2ac('0x4b')][_0xc2ac('0x56')]=_0x3073ad['id'];return db[_0xc2ac('0x57')][_0xc2ac('0x4a')](_0x3e5544['body']);}})['then'](respondWithResult(_0x1d3379,null))['catch'](handleError(_0x1d3379,null));};exports[_0xc2ac('0x58')]=function(_0x1eec0b,_0x299a6e,_0x1a086){var _0x3c4fc4={'raw':![],'where':{}};var _0x41394f={};var _0x21297c={'count':0x0,'rows':[]};return db[_0xc2ac('0x42')][_0xc2ac('0x59')]({'where':{'id':_0x1eec0b[_0xc2ac('0x48')]['id']}})[_0xc2ac('0x28')](handleEntityNotFound(_0x299a6e,null))[_0xc2ac('0x28')](function(_0x5e69fc){if(_0x5e69fc){_0x41394f[_0xc2ac('0x36')]=_['keys'](db[_0xc2ac('0x57')][_0xc2ac('0x30')]);_0x41394f[_0xc2ac('0x34')]=_['keys'](_0x1eec0b['query']);_0x41394f[_0xc2ac('0x3c')]=_[_0xc2ac('0x49')](_0x41394f[_0xc2ac('0x36')],_0x41394f[_0xc2ac('0x34')]);_0x3c4fc4['attributes']=_[_0xc2ac('0x49')](_0x41394f[_0xc2ac('0x36')],qs[_0xc2ac('0x37')](_0x1eec0b[_0xc2ac('0x34')][_0xc2ac('0x37')]));_0x3c4fc4['attributes']=_0x3c4fc4[_0xc2ac('0x38')][_0xc2ac('0x39')]?_0x3c4fc4[_0xc2ac('0x38')]:_0x41394f[_0xc2ac('0x36')];if(!_0x1eec0b['query'][_0xc2ac('0x5a')](_0xc2ac('0x5b'))){_0x3c4fc4[_0xc2ac('0x23')]=qs[_0xc2ac('0x23')](_0x1eec0b[_0xc2ac('0x34')]['limit']);_0x3c4fc4[_0xc2ac('0x22')]=qs['offset'](_0x1eec0b[_0xc2ac('0x34')][_0xc2ac('0x22')]);}_0x3c4fc4[_0xc2ac('0x3a')]=qs['sort'](_0x1eec0b[_0xc2ac('0x34')]['sort']);_0x3c4fc4[_0xc2ac('0x3e')]=qs[_0xc2ac('0x3c')](_[_0xc2ac('0x5c')](_0x1eec0b[_0xc2ac('0x34')],_0x41394f[_0xc2ac('0x3c')]));_0x3c4fc4[_0xc2ac('0x3e')][_0xc2ac('0x56')]=_0x5e69fc['id'];if(_0x1eec0b[_0xc2ac('0x34')][_0xc2ac('0x3d')]){_0x3c4fc4[_0xc2ac('0x3e')]=_[_0xc2ac('0x3f')](_0x3c4fc4['where'],{'$or':_[_0xc2ac('0x2f')](_0x3c4fc4[_0xc2ac('0x38')],function(_0x59cdb2){var _0x5bed1b={};_0x5bed1b[_0x59cdb2]={'$like':'%'+_0x1eec0b[_0xc2ac('0x34')][_0xc2ac('0x3d')]+'%'};return _0x5bed1b;})});}_0x3c4fc4=_[_0xc2ac('0x3f')]({},_0x3c4fc4,_0x1eec0b[_0xc2ac('0x41')]);return db[_0xc2ac('0x57')][_0xc2ac('0x21')]({'where':_0x3c4fc4['where']})[_0xc2ac('0x28')](function(_0x55cc2d){_0x21297c[_0xc2ac('0x21')]=_0x55cc2d;if(_0x1eec0b[_0xc2ac('0x34')][_0xc2ac('0x43')]){_0x3c4fc4[_0xc2ac('0x44')]=[{'all':!![]}];}return db['Disposition'][_0xc2ac('0x45')](_0x3c4fc4);})[_0xc2ac('0x28')](function(_0x5a48a7){_0x21297c[_0xc2ac('0x5d')]=_0x5a48a7;return _0x21297c;});}})[_0xc2ac('0x28')](respondWithFilteredResult(_0x299a6e,_0x3c4fc4))[_0xc2ac('0x46')](handleError(_0x299a6e,null));};exports[_0xc2ac('0x5e')]=function(_0x11784c,_0x266834,_0x22bc3f){return db['CmList']['find']({'where':{'id':_0x11784c[_0xc2ac('0x48')]['id']}})[_0xc2ac('0x28')](handleEntityNotFound(_0x266834,null))[_0xc2ac('0x28')](function(_0x1a322c){if(_0x1a322c){return _0x1a322c['removeDispositions'](_0x11784c[_0xc2ac('0x34')][_0xc2ac('0x5f')]);}})[_0xc2ac('0x28')](respondWithStatusCode(_0x266834,null))[_0xc2ac('0x46')](handleError(_0x266834,null));};exports[_0xc2ac('0x60')]=function(_0x385428,_0x15183f,_0x1838ee){return db[_0xc2ac('0x42')][_0xc2ac('0x51')]({'where':{'id':_0x385428[_0xc2ac('0x48')]['id']}})[_0xc2ac('0x28')](handleEntityNotFound(_0x15183f,null))['then'](function(_0x113d92){if(_0x113d92){var _0x426411=[];var _0x1fa7b1={'success':[],'errors':[]};return db[_0xc2ac('0x61')][_0xc2ac('0x55')]()[_0xc2ac('0x28')](function(_0x36dd0e){if(_0x385428['body']['tags']&&_[_0xc2ac('0x62')](_0x385428[_0xc2ac('0x4b')]['tags'])){if(_0x385428[_0xc2ac('0x4b')][_0xc2ac('0x63')][_0xc2ac('0x39')]){_0x385428[_0xc2ac('0x4b')][_0xc2ac('0x63')]=_0x385428[_0xc2ac('0x4b')]['tags'][_0xc2ac('0x64')](';')+';';}else{_0x385428[_0xc2ac('0x4b')]['tags']=null;}}else{_0x385428['body'][_0xc2ac('0x63')]=null;}if(_0x385428[_0xc2ac('0x4b')]&&_[_0xc2ac('0x62')](_0x385428[_0xc2ac('0x4b')])){for(var _0x5c24e8=0x0;_0x5c24e8<_0x385428['body'][_0xc2ac('0x39')];_0x5c24e8+=0x1){_0x385428[_0xc2ac('0x4b')][_0x5c24e8]['ListId']=_0x385428[_0xc2ac('0x48')]['id'];_0x426411[_0xc2ac('0x65')](_0x385428[_0xc2ac('0x4b')][_0x5c24e8]);}return BPromise[_0xc2ac('0x66')](_0x426411,function(_0x429981){return db[_0xc2ac('0x61')][_0xc2ac('0x4a')](_[_0xc2ac('0x67')](_0x429981,[_0xc2ac('0x5f'),'id'])||{},{'fields':_[_0xc2ac('0x35')](_0x36dd0e),'raw':!![]})[_0xc2ac('0x28')](function(_0x1574b6){_0x1fa7b1[_0xc2ac('0x68')][_0xc2ac('0x65')](_0x1574b6[_0xc2ac('0x69')]);})[_0xc2ac('0x46')](function(_0x3432d0){_0x1fa7b1[_0xc2ac('0x6a')][_0xc2ac('0x65')]({'data':_0x429981,'error':_0x3432d0['message']});});})[_0xc2ac('0x28')](function(_0x506682){return _0x1fa7b1;})[_0xc2ac('0x46')](function(_0x91132b){return _0x91132b;});}else{_0x15183f[_0xc2ac('0x1f')](0x190)[_0xc2ac('0x20')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xc2ac('0x28')](respondWithResult(_0x15183f,null))[_0xc2ac('0x46')](handleError(_0x15183f,null));};exports[_0xc2ac('0x6b')]=function(_0x24a0fc,_0x31bcb8,_0x2037e8){var _0x5d18f3;return db[_0xc2ac('0x42')][_0xc2ac('0x51')]({'where':{'id':_0x24a0fc[_0xc2ac('0x48')]['id']},'include':[{'model':db[_0xc2ac('0x6c')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x31bcb8,null))[_0xc2ac('0x28')](function(_0x26b0af){if(_0x26b0af){_0x5d18f3=_0x26b0af;return db[_0xc2ac('0x61')][_0xc2ac('0x30')];}})[_0xc2ac('0x28')](function(_0xea8c4d){if(_0xea8c4d){var _0x36bb3b={};var _0xa12ae3={};_0xa12ae3[_0xc2ac('0x36')]=_['concat'](_['keys'](_0xea8c4d),_[_0xc2ac('0x2f')](_0x5d18f3[_0xc2ac('0x6d')],function(_0x3c475a){return util[_0xc2ac('0x6e')](_0xc2ac('0x6f'),_0x3c475a['id']);}));_0xa12ae3[_0xc2ac('0x34')]=_['keys'](_0x24a0fc[_0xc2ac('0x34')]);_0xa12ae3['filters']=_['intersection'](_0xa12ae3[_0xc2ac('0x36')],_0xa12ae3[_0xc2ac('0x34')]);_0x36bb3b[_0xc2ac('0x38')]=_[_0xc2ac('0x49')](_0xa12ae3[_0xc2ac('0x36')],qs[_0xc2ac('0x37')](_0x24a0fc[_0xc2ac('0x34')][_0xc2ac('0x37')]));_0x36bb3b[_0xc2ac('0x38')]=_0x36bb3b[_0xc2ac('0x38')][_0xc2ac('0x39')]?_0x36bb3b['attributes']:_0xa12ae3[_0xc2ac('0x36')];if(!_0x24a0fc[_0xc2ac('0x34')][_0xc2ac('0x5a')](_0xc2ac('0x5b'))){_0x36bb3b[_0xc2ac('0x23')]=qs[_0xc2ac('0x23')](_0x24a0fc['query']['limit']);_0x36bb3b[_0xc2ac('0x22')]=qs[_0xc2ac('0x22')](_0x24a0fc[_0xc2ac('0x34')][_0xc2ac('0x22')]);}_0x36bb3b[_0xc2ac('0x3a')]=qs['sort'](_0x24a0fc['query'][_0xc2ac('0x3b')]);_0x36bb3b[_0xc2ac('0x3e')]=qs[_0xc2ac('0x3c')](_[_0xc2ac('0x5c')](_0x24a0fc[_0xc2ac('0x34')],_0xa12ae3[_0xc2ac('0x3c')]));_0x36bb3b[_0xc2ac('0x70')]=!![];if(_0x24a0fc[_0xc2ac('0x34')][_0xc2ac('0x3d')]){_0x36bb3b[_0xc2ac('0x3e')]=_[_0xc2ac('0x3f')](_0x36bb3b['where'],{'$or':_[_0xc2ac('0x2f')](_0x36bb3b[_0xc2ac('0x38')],function(_0xc67852){var _0x44a952={};_0x44a952[_0xc67852]={'$like':'%'+_0x24a0fc[_0xc2ac('0x34')][_0xc2ac('0x3d')]+'%'};return _0x44a952;})});}_0x36bb3b=_[_0xc2ac('0x3f')]({},_0x36bb3b,_0x24a0fc[_0xc2ac('0x41')]);return _0x5d18f3[_0xc2ac('0x6b')](_0x36bb3b);}})['then'](respondWithResult(_0x31bcb8,null))['catch'](handleError(_0x31bcb8,null));};exports[_0xc2ac('0x71')]=function(_0x441c61,_0x46d25b,_0x462e8f){var _0x10a52c;return db[_0xc2ac('0x42')]['find']({'where':{'id':_0x441c61[_0xc2ac('0x48')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xc2ac('0x6d')}]})[_0xc2ac('0x28')](handleEntityNotFound(_0x46d25b,null))[_0xc2ac('0x28')](function(_0x200284){if(_0x200284){_0x10a52c=_0x200284;return db[_0xc2ac('0x61')][_0xc2ac('0x30')];}})[_0xc2ac('0x28')](function(_0x2662ec){if(_0x2662ec){var _0x1228bc={};var _0x1d8e78={};_0x1d8e78['model']=_[_0xc2ac('0x72')](_['keys'](_0x2662ec),_['map'](_0x10a52c[_0xc2ac('0x6d')],function(_0x3e0222){return util[_0xc2ac('0x6e')](_0xc2ac('0x6f'),_0x3e0222['id']);}));_0x1d8e78[_0xc2ac('0x34')]=_[_0xc2ac('0x35')](_0x441c61['query']);_0x1d8e78[_0xc2ac('0x3c')]=_[_0xc2ac('0x49')](_0x1d8e78[_0xc2ac('0x36')],_0x1d8e78[_0xc2ac('0x34')]);_0x1228bc[_0xc2ac('0x38')]=_['intersection'](_0x1d8e78[_0xc2ac('0x36')],qs[_0xc2ac('0x37')](_0x441c61['query'][_0xc2ac('0x37')]));_0x1228bc['attributes']=_0x1228bc[_0xc2ac('0x38')][_0xc2ac('0x39')]?_0x1228bc[_0xc2ac('0x38')]:_0x1d8e78[_0xc2ac('0x36')];if(!_0x441c61[_0xc2ac('0x34')][_0xc2ac('0x5a')](_0xc2ac('0x5b'))){_0x1228bc[_0xc2ac('0x23')]=qs['limit'](_0x441c61[_0xc2ac('0x34')]['limit']);_0x1228bc[_0xc2ac('0x22')]=qs[_0xc2ac('0x22')](_0x441c61['query'][_0xc2ac('0x22')]);}_0x1228bc[_0xc2ac('0x3a')]=qs[_0xc2ac('0x3b')](_0x441c61[_0xc2ac('0x34')][_0xc2ac('0x3b')]);_0x1228bc['where']=qs['filters'](_['pick'](_0x441c61[_0xc2ac('0x34')],_0x1d8e78[_0xc2ac('0x3c')]));_0x1228bc['raw']=!![];if(_0x441c61[_0xc2ac('0x34')][_0xc2ac('0x3d')]){_0x1228bc['where']=_[_0xc2ac('0x3f')](_0x1228bc[_0xc2ac('0x3e')],{'$or':_[_0xc2ac('0x2f')](_0x1228bc['attributes'],function(_0x525360){var _0x1cf255={};_0x1cf255[_0x525360]={'$like':'%'+_0x441c61[_0xc2ac('0x34')][_0xc2ac('0x3d')]+'%'};return _0x1cf255;})});}_0x1228bc=_['merge']({},_0x1228bc,_0x441c61[_0xc2ac('0x41')]);return _0x10a52c[_0xc2ac('0x6b')](_0x1228bc);}})[_0xc2ac('0x28')](function(_0x1656b8){if(!_[_0xc2ac('0x73')](_0x1656b8)){var _0x1c1e39=toCsv(_0x1656b8);var _0x16de51=Date['now']();fs[_0xc2ac('0x74')](util[_0xc2ac('0x6e')]('/tmp/list_%d_%s.csv',_0x10a52c['id'],_0x16de51),_0x1c1e39);_0x46d25b[_0xc2ac('0x75')](_0xc2ac('0x76'),_0xc2ac('0x77')+util[_0xc2ac('0x6e')](_0xc2ac('0x78'),_0x10a52c['id'],_0x16de51));_0x46d25b[_0xc2ac('0x75')](_0xc2ac('0x79'),_0xc2ac('0x7a'));return _0x46d25b[_0xc2ac('0x7b')](util[_0xc2ac('0x6e')](_0xc2ac('0x7c'),_0x10a52c['id'],_0x16de51));}else{return _0x46d25b['sendStatus'](0xcc);}})[_0xc2ac('0x46')](handleError(_0x46d25b,null));};exports[_0xc2ac('0x7d')]=function(_0x461009,_0x9cf20c,_0x2ec87b){var _0x24a9f1;delete _0x461009['body']['id'];return db[_0xc2ac('0x42')]['findOne']({'where':{'id':_0x461009[_0xc2ac('0x48')]['id']}})[_0xc2ac('0x28')](handleEntityNotFound(_0x9cf20c,null))[_0xc2ac('0x28')](function(_0x5b9b55){if(_0x5b9b55){return db[_0xc2ac('0x7e')]['transaction'](function(_0x57ba9b){return db['CmCustomField']['create'](_0x461009['body'],{'transaction':_0x57ba9b})[_0xc2ac('0x28')](function(_0x589a5c){_0x24a9f1=_0x589a5c;return _0x5b9b55[_0xc2ac('0x7f')](_0x589a5c,{'transaction':_0x57ba9b});})['then'](function(){var _0x8c7e56={'type':db[_0xc2ac('0x80')][_0xc2ac('0x81')],'transaction':_0x57ba9b};switch(_0x461009[_0xc2ac('0x4b')][_0xc2ac('0x32')]){case _0xc2ac('0x82'):_0x8c7e56['type']=db[_0xc2ac('0x80')][_0xc2ac('0x81')];break;case _0xc2ac('0x83'):_0x8c7e56[_0xc2ac('0x32')]=db[_0xc2ac('0x80')]['INTEGER'];break;case'switch':_0x8c7e56['type']=db['Sequelize'][_0xc2ac('0x84')];_0x8c7e56['defaultValue']=![];break;default:}return db[_0xc2ac('0x7e')][_0xc2ac('0x85')][_0xc2ac('0x86')](_0xc2ac('0x87'),util[_0xc2ac('0x6e')](_0xc2ac('0x88'),_0x24a9f1['id']),_0x8c7e56);})['then'](function(){return _0x24a9f1;});});}})['then'](respondWithResult(_0x9cf20c,null))['catch'](handleError(_0x9cf20c,null));};exports[_0xc2ac('0x89')]=function(_0x1b12a0,_0x2fa6c2,_0x473d46){var _0x42dd48={};var _0xd4be4c={};var _0x4b7776;var _0x559543;return db[_0xc2ac('0x42')]['findOne']({'where':{'id':_0x1b12a0[_0xc2ac('0x48')]['id']}})[_0xc2ac('0x28')](handleEntityNotFound(_0x2fa6c2,null))[_0xc2ac('0x28')](function(_0x4a1fe0){if(_0x4a1fe0){_0x4b7776=_0x4a1fe0;_0xd4be4c[_0xc2ac('0x36')]=_[_0xc2ac('0x35')](db[_0xc2ac('0x6c')][_0xc2ac('0x30')]);_0xd4be4c[_0xc2ac('0x34')]=_[_0xc2ac('0x35')](_0x1b12a0[_0xc2ac('0x34')]);_0xd4be4c[_0xc2ac('0x3c')]=_[_0xc2ac('0x49')](_0xd4be4c[_0xc2ac('0x36')],_0xd4be4c[_0xc2ac('0x34')]);_0x42dd48['attributes']=_['intersection'](_0xd4be4c['model'],qs[_0xc2ac('0x37')](_0x1b12a0[_0xc2ac('0x34')][_0xc2ac('0x37')]));_0x42dd48[_0xc2ac('0x38')]=_0x42dd48[_0xc2ac('0x38')][_0xc2ac('0x39')]?_0x42dd48[_0xc2ac('0x38')]:_0xd4be4c[_0xc2ac('0x36')];_0x42dd48[_0xc2ac('0x3a')]=qs[_0xc2ac('0x3b')](_0x1b12a0[_0xc2ac('0x34')][_0xc2ac('0x3b')]);_0x42dd48[_0xc2ac('0x3e')]=qs[_0xc2ac('0x3c')](_[_0xc2ac('0x5c')](_0x1b12a0[_0xc2ac('0x34')],_0xd4be4c[_0xc2ac('0x3c')]));_0x42dd48[_0xc2ac('0x3e')]=_['merge'](_0x42dd48[_0xc2ac('0x3e')],{'$or':[{'ListId':_0x4a1fe0['id']},{'ListId':null}]});if(_0x1b12a0[_0xc2ac('0x34')][_0xc2ac('0x3d')]){_0x42dd48[_0xc2ac('0x3e')]=_[_0xc2ac('0x3f')](_0x42dd48[_0xc2ac('0x3e')],{'$or':_[_0xc2ac('0x2f')](_0x42dd48[_0xc2ac('0x38')],function(_0x2cdc1e){var _0x2b0e20={};_0x2b0e20[_0x2cdc1e]={'$like':'%'+_0x1b12a0[_0xc2ac('0x34')][_0xc2ac('0x3d')]+'%'};return _0x2b0e20;})});}_0x42dd48=_[_0xc2ac('0x3f')]({},_0x42dd48,_0x1b12a0[_0xc2ac('0x41')]);return db[_0xc2ac('0x6c')]['findAndCountAll'](_0x42dd48);}})[_0xc2ac('0x28')](respondWithResult(_0x2fa6c2,null))[_0xc2ac('0x46')](handleError(_0x2fa6c2,null));};exports['addAgents']=function(_0x58157e,_0x59430d,_0x552ce0){return db['CmList'][_0xc2ac('0x51')]({'where':{'id':_0x58157e[_0xc2ac('0x48')]['id']}})['then'](handleEntityNotFound(_0x59430d,null))[_0xc2ac('0x28')](function(_0xb0deb3){if(_0xb0deb3){return _0xb0deb3[_0xc2ac('0x8a')](_0x58157e['body']['ids'],_[_0xc2ac('0x67')](_0x58157e[_0xc2ac('0x4b')],[_0xc2ac('0x5f'),'id'])||{})[_0xc2ac('0x8b')](function(_0x48b710){for(var _0x501d97=0x0;_0x501d97<_0x58157e['body'][_0xc2ac('0x5f')]['length'];_0x501d97+=0x1){socket['emit']('userCmList:save',{'UserId':_0x58157e['body'][_0xc2ac('0x5f')][_0x501d97],'CmListId':_0x58157e['params']['id']});}return _0x48b710;});}})[_0xc2ac('0x28')](respondWithResult(_0x59430d,null))[_0xc2ac('0x46')](handleError(_0x59430d,null));};exports[_0xc2ac('0x8c')]=function(_0x4ceca0,_0xe16762,_0x4d7f9c){return db['CmList'][_0xc2ac('0x51')]({'where':{'id':_0x4ceca0[_0xc2ac('0x48')]['id']}})['then'](handleEntityNotFound(_0xe16762,null))[_0xc2ac('0x28')](function(_0x577a2d){if(_0x577a2d){return _0x577a2d['removeAgents'](_0x4ceca0['query']['ids'])[_0xc2ac('0x28')](function(){if(_[_0xc2ac('0x62')](_0x4ceca0[_0xc2ac('0x34')]['ids'])){for(var _0x36dd17=0x0;_0x36dd17<_0x4ceca0[_0xc2ac('0x34')][_0xc2ac('0x5f')]['length'];_0x36dd17+=0x1){socket[_0xc2ac('0x8d')]('userCmList:remove',{'UserId':Number(_0x4ceca0[_0xc2ac('0x34')][_0xc2ac('0x5f')][_0x36dd17]),'CmListId':Number(_0x4ceca0[_0xc2ac('0x48')]['id'])});}}else{socket[_0xc2ac('0x8d')]('userCmList:remove',{'UserId':Number(_0x4ceca0[_0xc2ac('0x34')][_0xc2ac('0x5f')]),'CmListId':Number(_0x4ceca0['params']['id'])});}});}})[_0xc2ac('0x28')](respondWithStatusCode(_0xe16762,null))['catch'](handleError(_0xe16762,null));};exports['getAgents']=function(_0x48b7ec,_0xebfbad,_0x4471b9){var _0x3ed68={};var _0x3f061c={};var _0xcfb809;var _0x5201e6;return db[_0xc2ac('0x42')]['findOne']({'where':{'id':_0x48b7ec[_0xc2ac('0x48')]['id']}})[_0xc2ac('0x28')](handleEntityNotFound(_0xebfbad,null))['then'](function(_0x57d75b){if(_0x57d75b){_0xcfb809=_0x57d75b;_0x3f061c[_0xc2ac('0x36')]=_[_0xc2ac('0x35')](db['User'][_0xc2ac('0x30')]);_0x3f061c[_0xc2ac('0x34')]=_[_0xc2ac('0x35')](_0x48b7ec[_0xc2ac('0x34')]);_0x3f061c[_0xc2ac('0x3c')]=_['intersection'](_0x3f061c[_0xc2ac('0x36')],_0x3f061c[_0xc2ac('0x34')]);_0x3ed68[_0xc2ac('0x38')]=_[_0xc2ac('0x49')](_0x3f061c[_0xc2ac('0x36')],qs[_0xc2ac('0x37')](_0x48b7ec['query'][_0xc2ac('0x37')]));_0x3ed68[_0xc2ac('0x38')]=_0x3ed68[_0xc2ac('0x38')][_0xc2ac('0x39')]?_0x3ed68[_0xc2ac('0x38')]:_0x3f061c[_0xc2ac('0x36')];_0x3ed68['order']=qs[_0xc2ac('0x3b')](_0x48b7ec[_0xc2ac('0x34')]['sort']);_0x3ed68[_0xc2ac('0x3e')]=qs[_0xc2ac('0x3c')](_[_0xc2ac('0x5c')](_0x48b7ec[_0xc2ac('0x34')],_0x3f061c[_0xc2ac('0x3c')]));if(_0x48b7ec[_0xc2ac('0x34')][_0xc2ac('0x3d')]){_0x3ed68['where']=_[_0xc2ac('0x3f')](_0x3ed68[_0xc2ac('0x3e')],{'$or':_[_0xc2ac('0x2f')](_0x3ed68['attributes'],function(_0x257c8c){var _0x27a5b1={};_0x27a5b1[_0x257c8c]={'$like':'%'+_0x48b7ec[_0xc2ac('0x34')][_0xc2ac('0x3d')]+'%'};return _0x27a5b1;})});}_0x3ed68=_['merge']({},_0x3ed68,_0x48b7ec[_0xc2ac('0x41')]);return _0xcfb809['getAgents'](_0x3ed68);}})[_0xc2ac('0x28')](function(_0x3668d7){if(_0x3668d7){_0x5201e6=_0x3668d7[_0xc2ac('0x39')];if(!_0x48b7ec[_0xc2ac('0x34')][_0xc2ac('0x5a')](_0xc2ac('0x5b'))){_0x3ed68[_0xc2ac('0x23')]=qs[_0xc2ac('0x23')](_0x48b7ec[_0xc2ac('0x34')][_0xc2ac('0x23')]);_0x3ed68[_0xc2ac('0x22')]=qs[_0xc2ac('0x22')](_0x48b7ec['query']['offset']);}return _0xcfb809[_0xc2ac('0x8e')](_0x3ed68);}})[_0xc2ac('0x28')](function(_0x5ad968){if(_0x5ad968){return _0x5ad968?{'count':_0x5201e6,'rows':_0x5ad968}:null;}})[_0xc2ac('0x28')](respondWithResult(_0xebfbad,null))['catch'](handleError(_0xebfbad,null));}; \ No newline at end of file +var _0x0533=['squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./cmList.socket','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','CmList','rawAttributes','type','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','Disposition','getDispositions','findAll','ids','addContacts','isArray','tags','join','each','CmContact','success','dataValues','CmCustomField','CustomFields','concat','format','cf_%d','getContacts','raw','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','findOne','sequelize','transaction','addCustomFields','Sequelize','text','INTEGER','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','omit','emit','removeAgents','userCmList:remove','getAgents','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash'];(function(_0x453a97,_0x244a78){var _0x30548d=function(_0x1c58d2){while(--_0x1c58d2){_0x453a97['push'](_0x453a97['shift']());}};_0x30548d(++_0x244a78);}(_0x0533,0x7d));var _0x3053=function(_0x5a0410,_0x277e8a){_0x5a0410=_0x5a0410-0x0;var _0x4bb75b=_0x0533[_0x5a0410];return _0x4bb75b;};'use strict';var pdf=require(_0x3053('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3053('0x1'));var jsonpatch=require(_0x3053('0x2'));var rp=require(_0x3053('0x3'));var moment=require(_0x3053('0x4'));var BPromise=require(_0x3053('0x5'));var Mustache=require('mustache');var util=require(_0x3053('0x6'));var path=require(_0x3053('0x7'));var sox=require(_0x3053('0x8'));var csv=require(_0x3053('0x9'));var ejs=require(_0x3053('0xa'));var fs=require('fs');var _=require(_0x3053('0xb'));var squel=require(_0x3053('0xc'));var crypto=require(_0x3053('0xd'));var jsforce=require(_0x3053('0xe'));var deskjs=require(_0x3053('0xf'));var toCsv=require(_0x3053('0x9'));var querystring=require('querystring');var Papa=require(_0x3053('0x10'));var Redis=require('ioredis');var authService=require(_0x3053('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3053('0x12'));var hardwareService=require(_0x3053('0x13'));var logger=require(_0x3053('0x14'))('api');var utils=require(_0x3053('0x15'));var config=require(_0x3053('0x16'));var db=require(_0x3053('0x17'))['db'];config[_0x3053('0x18')]=_[_0x3053('0x19')](config[_0x3053('0x18')],{'host':_0x3053('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3053('0x1b'))['register'](socket);function respondWithStatusCode(_0x38bd37,_0x27af4d){_0x27af4d=_0x27af4d||0xcc;return function(_0x4d1076){if(_0x4d1076){return _0x38bd37[_0x3053('0x1c')](_0x27af4d);}return _0x38bd37[_0x3053('0x1d')](_0x27af4d)[_0x3053('0x1e')]();};}function respondWithResult(_0x538825,_0x5699aa){_0x5699aa=_0x5699aa||0xc8;return function(_0x352bf9){if(_0x352bf9){return _0x538825['status'](_0x5699aa)[_0x3053('0x1f')](_0x352bf9);}};}function respondWithFilteredResult(_0x25fb00,_0x1388f0){return function(_0x575841){if(_0x575841){var _0x1ebf3e=_0x575841[_0x3053('0x20')],_0x2e0fcb=_0x1388f0[_0x3053('0x21')],_0x49e57d=_0x1388f0['offset']+_0x1388f0[_0x3053('0x22')],_0x2f5152;if(_0x49e57d>=_0x1ebf3e){_0x49e57d=_0x1ebf3e;_0x2f5152=0xc8;}else{_0x2f5152=0xce;}_0x25fb00[_0x3053('0x1d')](_0x2f5152);return _0x25fb00[_0x3053('0x23')]('Content-Range',_0x2e0fcb+'-'+_0x49e57d+'/'+_0x1ebf3e)[_0x3053('0x1f')](_0x575841);}return null;};}function patchUpdates(_0x4add87){return function(_0x2e29c7){try{jsonpatch[_0x3053('0x24')](_0x2e29c7,_0x4add87,!![]);}catch(_0x5bfa67){return BPromise[_0x3053('0x25')](_0x5bfa67);}return _0x2e29c7[_0x3053('0x26')]();};}function saveUpdates(_0xf6cffd,_0x233e05){return function(_0x1e4ddf){if(_0x1e4ddf){return _0x1e4ddf[_0x3053('0x27')](_0xf6cffd)[_0x3053('0x28')](function(_0x13e2af){return _0x13e2af;});}return null;};}function removeEntity(_0x597377,_0x20e84d){return function(_0x471bbb){if(_0x471bbb){return _0x471bbb[_0x3053('0x29')]()[_0x3053('0x28')](function(){var _0x371aef=_0x471bbb[_0x3053('0x2a')]({'plain':!![]});var _0x4d4588=_0x3053('0x2b');return db[_0x3053('0x2c')][_0x3053('0x29')]({'where':{'type':_0x4d4588,'resourceId':_0x371aef['id']}})[_0x3053('0x28')](function(){return _0x471bbb;});})['then'](function(){_0x597377[_0x3053('0x1d')](0xcc)[_0x3053('0x1e')]();});}};}function handleEntityNotFound(_0x1e5694,_0x1a43c9){return function(_0x241726){if(!_0x241726){_0x1e5694[_0x3053('0x1c')](0x194);}return _0x241726;};}function handleError(_0x320a2d,_0x4a5d85){_0x4a5d85=_0x4a5d85||0x1f4;return function(_0x3756a8){logger[_0x3053('0x2d')](_0x3756a8[_0x3053('0x2e')]);if(_0x3756a8[_0x3053('0x2f')]){delete _0x3756a8['name'];}_0x320a2d['status'](_0x4a5d85)[_0x3053('0x30')](_0x3756a8);};}exports[_0x3053('0x31')]=function(_0x1b6603,_0x2e5cec){var _0x36e83c={},_0xf0a6b7={},_0x1ed5b7={'count':0x0,'rows':[]};var _0x339bbc=_['map'](db[_0x3053('0x32')][_0x3053('0x33')],function(_0x295d03){return{'name':_0x295d03['fieldName'],'type':_0x295d03[_0x3053('0x34')]['key']};});_0xf0a6b7[_0x3053('0x35')]=_[_0x3053('0x36')](_0x339bbc,_0x3053('0x2f'));_0xf0a6b7['query']=_[_0x3053('0x37')](_0x1b6603[_0x3053('0x38')]);_0xf0a6b7[_0x3053('0x39')]=_['intersection'](_0xf0a6b7[_0x3053('0x35')],_0xf0a6b7[_0x3053('0x38')]);_0x36e83c[_0x3053('0x3a')]=_[_0x3053('0x3b')](_0xf0a6b7['model'],qs['fields'](_0x1b6603['query'][_0x3053('0x3c')]));_0x36e83c[_0x3053('0x3a')]=_0x36e83c[_0x3053('0x3a')][_0x3053('0x3d')]?_0x36e83c['attributes']:_0xf0a6b7['model'];if(!_0x1b6603[_0x3053('0x38')][_0x3053('0x3e')](_0x3053('0x3f'))){_0x36e83c['limit']=qs[_0x3053('0x22')](_0x1b6603[_0x3053('0x38')][_0x3053('0x22')]);_0x36e83c['offset']=qs['offset'](_0x1b6603[_0x3053('0x38')][_0x3053('0x21')]);}_0x36e83c[_0x3053('0x40')]=qs[_0x3053('0x41')](_0x1b6603[_0x3053('0x38')]['sort']);_0x36e83c[_0x3053('0x42')]=qs[_0x3053('0x39')](_[_0x3053('0x43')](_0x1b6603[_0x3053('0x38')],_0xf0a6b7[_0x3053('0x39')]),_0x339bbc);if(_0x1b6603[_0x3053('0x38')][_0x3053('0x44')]){_0x36e83c[_0x3053('0x42')]=_[_0x3053('0x45')](_0x36e83c[_0x3053('0x42')],{'$or':_[_0x3053('0x36')](_0x339bbc,function(_0x3f6c6f){if(_0x3f6c6f['type']!==_0x3053('0x46')){var _0x1305c6={};_0x1305c6[_0x3f6c6f['name']]={'$like':'%'+_0x1b6603[_0x3053('0x38')][_0x3053('0x44')]+'%'};return _0x1305c6;}})});}_0x36e83c=_[_0x3053('0x45')]({},_0x36e83c,_0x1b6603[_0x3053('0x47')]);var _0x3e15ec={'where':_0x36e83c[_0x3053('0x42')]};return db[_0x3053('0x32')][_0x3053('0x20')](_0x3e15ec)['then'](function(_0x8714c1){_0x1ed5b7['count']=_0x8714c1;if(_0x1b6603[_0x3053('0x38')][_0x3053('0x48')]){_0x36e83c[_0x3053('0x49')]=[{'all':!![]}];}return db[_0x3053('0x32')]['findAll'](_0x36e83c);})[_0x3053('0x28')](function(_0xda5bc4){_0x1ed5b7[_0x3053('0x4a')]=_0xda5bc4;return _0x1ed5b7;})[_0x3053('0x28')](respondWithFilteredResult(_0x2e5cec,_0x36e83c))[_0x3053('0x4b')](handleError(_0x2e5cec,null));};exports['show']=function(_0x34a222,_0x139c62){var _0x520fd7={'raw':![],'where':{'id':_0x34a222['params']['id']}},_0x1fe12d={};_0x1fe12d['model']=_[_0x3053('0x37')](db[_0x3053('0x32')][_0x3053('0x33')]);_0x1fe12d[_0x3053('0x38')]=_[_0x3053('0x37')](_0x34a222[_0x3053('0x38')]);_0x1fe12d[_0x3053('0x39')]=_[_0x3053('0x3b')](_0x1fe12d[_0x3053('0x35')],_0x1fe12d['query']);_0x520fd7[_0x3053('0x3a')]=_[_0x3053('0x3b')](_0x1fe12d[_0x3053('0x35')],qs[_0x3053('0x3c')](_0x34a222[_0x3053('0x38')]['fields']));_0x520fd7[_0x3053('0x3a')]=_0x520fd7['attributes']['length']?_0x520fd7[_0x3053('0x3a')]:_0x1fe12d[_0x3053('0x35')];if(_0x34a222[_0x3053('0x38')][_0x3053('0x48')]){_0x520fd7['include']=[{'all':!![]}];}_0x520fd7=_[_0x3053('0x45')]({},_0x520fd7,_0x34a222['options']);return db[_0x3053('0x32')][_0x3053('0x4c')](_0x520fd7)[_0x3053('0x28')](handleEntityNotFound(_0x139c62,null))[_0x3053('0x28')](respondWithResult(_0x139c62,null))[_0x3053('0x4b')](handleError(_0x139c62,null));};exports['create']=function(_0x1a5205,_0x4b3e09){return db[_0x3053('0x32')][_0x3053('0x4d')](_0x1a5205[_0x3053('0x4e')],{})['then'](function(_0x30889b){var _0x3e6a9d=_0x1a5205[_0x3053('0x4f')][_0x3053('0x2a')]({'plain':!![]});if(!_0x3e6a9d)throw new Error(_0x3053('0x50'));if(_0x3e6a9d[_0x3053('0x51')]===_0x3053('0x4f')){var _0x5817ef=_0x30889b['get']({'plain':!![]});var _0x4636a4=_0x3053('0x2b');return db['UserProfileSection'][_0x3053('0x4c')]({'where':{'name':_0x4636a4,'userProfileId':_0x3e6a9d['userProfileId']},'raw':!![]})[_0x3053('0x28')](function(_0x5c2ca6){if(_0x5c2ca6&&_0x5c2ca6[_0x3053('0x52')]===0x0){return db[_0x3053('0x2c')][_0x3053('0x4d')]({'name':_0x5817ef['name'],'resourceId':_0x5817ef['id'],'type':_0x5c2ca6[_0x3053('0x2f')],'sectionId':_0x5c2ca6['id']},{})[_0x3053('0x28')](function(){return _0x30889b;});}else{return _0x30889b;}})[_0x3053('0x4b')](function(_0x174522){logger[_0x3053('0x2d')](_0x3053('0x53'),_0x174522);throw _0x174522;});}return _0x30889b;})[_0x3053('0x28')](respondWithResult(_0x4b3e09,0xc9))[_0x3053('0x4b')](handleError(_0x4b3e09,null));};exports[_0x3053('0x27')]=function(_0x217c94,_0xd33ab4){if(_0x217c94['body']['id']){delete _0x217c94[_0x3053('0x4e')]['id'];}return db[_0x3053('0x32')]['find']({'where':{'id':_0x217c94[_0x3053('0x54')]['id']}})['then'](handleEntityNotFound(_0xd33ab4,null))['then'](saveUpdates(_0x217c94[_0x3053('0x4e')],null))[_0x3053('0x28')](respondWithResult(_0xd33ab4,null))[_0x3053('0x4b')](handleError(_0xd33ab4,null));};exports[_0x3053('0x29')]=function(_0x11361e,_0x2dd7d5){return db[_0x3053('0x32')][_0x3053('0x4c')]({'where':{'id':_0x11361e[_0x3053('0x54')]['id']}})[_0x3053('0x28')](handleEntityNotFound(_0x2dd7d5,null))[_0x3053('0x28')](removeEntity(_0x2dd7d5,null))[_0x3053('0x4b')](handleError(_0x2dd7d5,null));};exports[_0x3053('0x55')]=function(_0x4f6f87,_0x17a0bc){return db[_0x3053('0x32')][_0x3053('0x55')]()[_0x3053('0x28')](respondWithResult(_0x17a0bc,null))['catch'](handleError(_0x17a0bc,null));};exports[_0x3053('0x56')]=function(_0x2d607d,_0x1bc1a1,_0x2d22ec){if(_0x2d607d[_0x3053('0x4e')]['id']){delete _0x2d607d[_0x3053('0x4e')]['id'];}return db[_0x3053('0x32')][_0x3053('0x4c')]({'where':{'id':_0x2d607d[_0x3053('0x54')]['id']}})[_0x3053('0x28')](handleEntityNotFound(_0x1bc1a1,null))[_0x3053('0x28')](function(_0x45d08b){if(_0x45d08b){_0x2d607d[_0x3053('0x4e')][_0x3053('0x57')]=_0x45d08b['id'];return db[_0x3053('0x58')][_0x3053('0x4d')](_0x2d607d[_0x3053('0x4e')]);}})['then'](respondWithResult(_0x1bc1a1,null))[_0x3053('0x4b')](handleError(_0x1bc1a1,null));};exports[_0x3053('0x59')]=function(_0x5748f8,_0x32e7dd,_0x4e22e8){var _0x3e05e6={'raw':![],'where':{}};var _0x381ce8={};var _0x48550c={'count':0x0,'rows':[]};return db[_0x3053('0x32')]['findOne']({'where':{'id':_0x5748f8[_0x3053('0x54')]['id']}})['then'](handleEntityNotFound(_0x32e7dd,null))['then'](function(_0x202474){if(_0x202474){_0x381ce8[_0x3053('0x35')]=_[_0x3053('0x37')](db['Disposition'][_0x3053('0x33')]);_0x381ce8[_0x3053('0x38')]=_[_0x3053('0x37')](_0x5748f8[_0x3053('0x38')]);_0x381ce8[_0x3053('0x39')]=_['intersection'](_0x381ce8['model'],_0x381ce8['query']);_0x3e05e6[_0x3053('0x3a')]=_[_0x3053('0x3b')](_0x381ce8[_0x3053('0x35')],qs[_0x3053('0x3c')](_0x5748f8[_0x3053('0x38')][_0x3053('0x3c')]));_0x3e05e6[_0x3053('0x3a')]=_0x3e05e6[_0x3053('0x3a')][_0x3053('0x3d')]?_0x3e05e6[_0x3053('0x3a')]:_0x381ce8['model'];if(!_0x5748f8['query'][_0x3053('0x3e')](_0x3053('0x3f'))){_0x3e05e6['limit']=qs[_0x3053('0x22')](_0x5748f8[_0x3053('0x38')]['limit']);_0x3e05e6[_0x3053('0x21')]=qs[_0x3053('0x21')](_0x5748f8[_0x3053('0x38')][_0x3053('0x21')]);}_0x3e05e6[_0x3053('0x40')]=qs[_0x3053('0x41')](_0x5748f8[_0x3053('0x38')]['sort']);_0x3e05e6['where']=qs[_0x3053('0x39')](_['pick'](_0x5748f8[_0x3053('0x38')],_0x381ce8[_0x3053('0x39')]));_0x3e05e6['where'][_0x3053('0x57')]=_0x202474['id'];if(_0x5748f8[_0x3053('0x38')]['filter']){_0x3e05e6['where']=_[_0x3053('0x45')](_0x3e05e6[_0x3053('0x42')],{'$or':_[_0x3053('0x36')](_0x3e05e6[_0x3053('0x3a')],function(_0x297841){var _0x2572b1={};_0x2572b1[_0x297841]={'$like':'%'+_0x5748f8[_0x3053('0x38')][_0x3053('0x44')]+'%'};return _0x2572b1;})});}_0x3e05e6=_[_0x3053('0x45')]({},_0x3e05e6,_0x5748f8[_0x3053('0x47')]);return db[_0x3053('0x58')]['count']({'where':_0x3e05e6[_0x3053('0x42')]})[_0x3053('0x28')](function(_0x12a799){_0x48550c[_0x3053('0x20')]=_0x12a799;if(_0x5748f8[_0x3053('0x38')]['includeAll']){_0x3e05e6[_0x3053('0x49')]=[{'all':!![]}];}return db[_0x3053('0x58')][_0x3053('0x5a')](_0x3e05e6);})[_0x3053('0x28')](function(_0x4db908){_0x48550c[_0x3053('0x4a')]=_0x4db908;return _0x48550c;});}})[_0x3053('0x28')](respondWithFilteredResult(_0x32e7dd,_0x3e05e6))[_0x3053('0x4b')](handleError(_0x32e7dd,null));};exports['removeDispositions']=function(_0x3d8e8a,_0x3ab2cc,_0x284f6e){return db[_0x3053('0x32')][_0x3053('0x4c')]({'where':{'id':_0x3d8e8a[_0x3053('0x54')]['id']}})[_0x3053('0x28')](handleEntityNotFound(_0x3ab2cc,null))['then'](function(_0x48d06a){if(_0x48d06a){return _0x48d06a['removeDispositions'](_0x3d8e8a['query'][_0x3053('0x5b')]);}})['then'](respondWithStatusCode(_0x3ab2cc,null))[_0x3053('0x4b')](handleError(_0x3ab2cc,null));};exports[_0x3053('0x5c')]=function(_0x1608fd,_0x48b0ff,_0x40bd59){return db['CmList']['find']({'where':{'id':_0x1608fd[_0x3053('0x54')]['id']}})[_0x3053('0x28')](handleEntityNotFound(_0x48b0ff,null))[_0x3053('0x28')](function(_0xf8f2a6){if(_0xf8f2a6){var _0x350b26=[];var _0x9f59a7={'success':[],'errors':[]};return db['CmContact'][_0x3053('0x55')]()[_0x3053('0x28')](function(_0x125447){if(_0x1608fd[_0x3053('0x4e')]['tags']&&_[_0x3053('0x5d')](_0x1608fd[_0x3053('0x4e')]['tags'])){if(_0x1608fd[_0x3053('0x4e')][_0x3053('0x5e')][_0x3053('0x3d')]){_0x1608fd[_0x3053('0x4e')]['tags']=_0x1608fd[_0x3053('0x4e')][_0x3053('0x5e')][_0x3053('0x5f')](';')+';';}else{_0x1608fd[_0x3053('0x4e')][_0x3053('0x5e')]=null;}}else{_0x1608fd['body'][_0x3053('0x5e')]=null;}if(_0x1608fd[_0x3053('0x4e')]&&_[_0x3053('0x5d')](_0x1608fd['body'])){for(var _0x345ea9=0x0;_0x345ea9<_0x1608fd[_0x3053('0x4e')]['length'];_0x345ea9+=0x1){_0x1608fd[_0x3053('0x4e')][_0x345ea9][_0x3053('0x57')]=_0x1608fd['params']['id'];_0x350b26['push'](_0x1608fd[_0x3053('0x4e')][_0x345ea9]);}return BPromise[_0x3053('0x60')](_0x350b26,function(_0x13c4fe){return db[_0x3053('0x61')][_0x3053('0x4d')](_['omit'](_0x13c4fe,[_0x3053('0x5b'),'id'])||{},{'fields':_[_0x3053('0x37')](_0x125447),'raw':!![]})[_0x3053('0x28')](function(_0x446d04){_0x9f59a7[_0x3053('0x62')]['push'](_0x446d04[_0x3053('0x63')]);})[_0x3053('0x4b')](function(_0x54798f){_0x9f59a7['errors']['push']({'data':_0x13c4fe,'error':_0x54798f['message']});});})[_0x3053('0x28')](function(_0x5c738d){return _0x9f59a7;})[_0x3053('0x4b')](function(_0x934362){return _0x934362;});}else{_0x48b0ff[_0x3053('0x1d')](0x190)[_0x3053('0x1f')]({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x48b0ff,null))[_0x3053('0x4b')](handleError(_0x48b0ff,null));};exports['getContacts']=function(_0x39a044,_0x3d4350,_0x35fefc){var _0x53fc32;return db['CmList'][_0x3053('0x4c')]({'where':{'id':_0x39a044[_0x3053('0x54')]['id']},'include':[{'model':db[_0x3053('0x64')],'as':_0x3053('0x65')}]})[_0x3053('0x28')](handleEntityNotFound(_0x3d4350,null))[_0x3053('0x28')](function(_0x2262b5){if(_0x2262b5){_0x53fc32=_0x2262b5;return db[_0x3053('0x61')][_0x3053('0x33')];}})[_0x3053('0x28')](function(_0x5e59b6){if(_0x5e59b6){var _0x1d0918={};var _0x114319={};_0x114319['model']=_[_0x3053('0x66')](_[_0x3053('0x37')](_0x5e59b6),_[_0x3053('0x36')](_0x53fc32[_0x3053('0x65')],function(_0x3884c3){return util[_0x3053('0x67')](_0x3053('0x68'),_0x3884c3['id']);}));_0x114319[_0x3053('0x38')]=_[_0x3053('0x37')](_0x39a044[_0x3053('0x38')]);_0x114319['filters']=_[_0x3053('0x3b')](_0x114319[_0x3053('0x35')],_0x114319[_0x3053('0x38')]);_0x1d0918[_0x3053('0x3a')]=_['intersection'](_0x114319['model'],qs[_0x3053('0x3c')](_0x39a044[_0x3053('0x38')][_0x3053('0x3c')]));_0x1d0918['attributes']=_0x1d0918[_0x3053('0x3a')][_0x3053('0x3d')]?_0x1d0918['attributes']:_0x114319[_0x3053('0x35')];if(!_0x39a044['query']['hasOwnProperty']('nolimit')){_0x1d0918[_0x3053('0x22')]=qs[_0x3053('0x22')](_0x39a044[_0x3053('0x38')]['limit']);_0x1d0918['offset']=qs[_0x3053('0x21')](_0x39a044['query'][_0x3053('0x21')]);}_0x1d0918[_0x3053('0x40')]=qs[_0x3053('0x41')](_0x39a044[_0x3053('0x38')][_0x3053('0x41')]);_0x1d0918['where']=qs['filters'](_['pick'](_0x39a044[_0x3053('0x38')],_0x114319[_0x3053('0x39')]));_0x1d0918['raw']=!![];if(_0x39a044[_0x3053('0x38')]['filter']){_0x1d0918[_0x3053('0x42')]=_['merge'](_0x1d0918[_0x3053('0x42')],{'$or':_[_0x3053('0x36')](_0x1d0918['attributes'],function(_0x595f7c){var _0x15f78e={};_0x15f78e[_0x595f7c]={'$like':'%'+_0x39a044['query'][_0x3053('0x44')]+'%'};return _0x15f78e;})});}_0x1d0918=_['merge']({},_0x1d0918,_0x39a044[_0x3053('0x47')]);return _0x53fc32[_0x3053('0x69')](_0x1d0918);}})['then'](respondWithResult(_0x3d4350,null))[_0x3053('0x4b')](handleError(_0x3d4350,null));};exports['getContactsCsv']=function(_0x1e6616,_0x23b99a,_0x568254){var _0x8fd99c;return db[_0x3053('0x32')][_0x3053('0x4c')]({'where':{'id':_0x1e6616[_0x3053('0x54')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0x3053('0x28')](handleEntityNotFound(_0x23b99a,null))[_0x3053('0x28')](function(_0x45af3f){if(_0x45af3f){_0x8fd99c=_0x45af3f;return db[_0x3053('0x61')][_0x3053('0x33')];}})[_0x3053('0x28')](function(_0x172043){if(_0x172043){var _0xea007a={};var _0x275194={};_0x275194[_0x3053('0x35')]=_[_0x3053('0x66')](_['keys'](_0x172043),_[_0x3053('0x36')](_0x8fd99c[_0x3053('0x65')],function(_0x431ca6){return util[_0x3053('0x67')](_0x3053('0x68'),_0x431ca6['id']);}));_0x275194['query']=_[_0x3053('0x37')](_0x1e6616[_0x3053('0x38')]);_0x275194[_0x3053('0x39')]=_[_0x3053('0x3b')](_0x275194[_0x3053('0x35')],_0x275194['query']);_0xea007a[_0x3053('0x3a')]=_[_0x3053('0x3b')](_0x275194[_0x3053('0x35')],qs[_0x3053('0x3c')](_0x1e6616[_0x3053('0x38')][_0x3053('0x3c')]));_0xea007a['attributes']=_0xea007a[_0x3053('0x3a')][_0x3053('0x3d')]?_0xea007a[_0x3053('0x3a')]:_0x275194[_0x3053('0x35')];if(!_0x1e6616[_0x3053('0x38')][_0x3053('0x3e')](_0x3053('0x3f'))){_0xea007a[_0x3053('0x22')]=qs[_0x3053('0x22')](_0x1e6616[_0x3053('0x38')][_0x3053('0x22')]);_0xea007a[_0x3053('0x21')]=qs[_0x3053('0x21')](_0x1e6616['query']['offset']);}_0xea007a['order']=qs['sort'](_0x1e6616[_0x3053('0x38')][_0x3053('0x41')]);_0xea007a[_0x3053('0x42')]=qs['filters'](_['pick'](_0x1e6616[_0x3053('0x38')],_0x275194[_0x3053('0x39')]));_0xea007a[_0x3053('0x6a')]=!![];if(_0x1e6616[_0x3053('0x38')][_0x3053('0x44')]){_0xea007a['where']=_['merge'](_0xea007a[_0x3053('0x42')],{'$or':_[_0x3053('0x36')](_0xea007a[_0x3053('0x3a')],function(_0x280ae0){var _0x45fe76={};_0x45fe76[_0x280ae0]={'$like':'%'+_0x1e6616[_0x3053('0x38')][_0x3053('0x44')]+'%'};return _0x45fe76;})});}_0xea007a=_['merge']({},_0xea007a,_0x1e6616['options']);return _0x8fd99c[_0x3053('0x69')](_0xea007a);}})[_0x3053('0x28')](function(_0x599b02){if(!_['isEmpty'](_0x599b02)){var _0x513830=toCsv(_0x599b02);var _0x27b9ca=Date[_0x3053('0x6b')]();fs[_0x3053('0x6c')](util[_0x3053('0x67')](_0x3053('0x6d'),_0x8fd99c['id'],_0x27b9ca),_0x513830);_0x23b99a[_0x3053('0x6e')](_0x3053('0x6f'),_0x3053('0x70')+util[_0x3053('0x67')](_0x3053('0x71'),_0x8fd99c['id'],_0x27b9ca));_0x23b99a[_0x3053('0x6e')](_0x3053('0x72'),_0x3053('0x73'));return _0x23b99a[_0x3053('0x74')](util[_0x3053('0x67')]('/tmp/list_%d_%s.csv',_0x8fd99c['id'],_0x27b9ca));}else{return _0x23b99a['sendStatus'](0xcc);}})[_0x3053('0x4b')](handleError(_0x23b99a,null));};exports['addCustomField']=function(_0x36a467,_0xddef6c,_0x25a89f){var _0x1cc4b9;delete _0x36a467['body']['id'];return db[_0x3053('0x32')][_0x3053('0x75')]({'where':{'id':_0x36a467[_0x3053('0x54')]['id']}})[_0x3053('0x28')](handleEntityNotFound(_0xddef6c,null))[_0x3053('0x28')](function(_0x1e0309){if(_0x1e0309){return db[_0x3053('0x76')][_0x3053('0x77')](function(_0x14d555){return db['CmCustomField'][_0x3053('0x4d')](_0x36a467[_0x3053('0x4e')],{'transaction':_0x14d555})['then'](function(_0x47a0a9){_0x1cc4b9=_0x47a0a9;return _0x1e0309[_0x3053('0x78')](_0x47a0a9,{'transaction':_0x14d555});})[_0x3053('0x28')](function(){var _0x9dcaff={'type':db[_0x3053('0x79')]['TEXT'],'transaction':_0x14d555};switch(_0x36a467[_0x3053('0x4e')][_0x3053('0x34')]){case _0x3053('0x7a'):_0x9dcaff[_0x3053('0x34')]=db[_0x3053('0x79')]['TEXT'];break;case'number':_0x9dcaff['type']=db[_0x3053('0x79')][_0x3053('0x7b')];break;case'switch':_0x9dcaff[_0x3053('0x34')]=db['Sequelize']['BOOLEAN'];_0x9dcaff[_0x3053('0x7c')]=![];break;default:}return db[_0x3053('0x76')][_0x3053('0x7d')][_0x3053('0x7e')](_0x3053('0x7f'),util['format'](_0x3053('0x80'),_0x1cc4b9['id']),_0x9dcaff);})[_0x3053('0x28')](function(){return _0x1cc4b9;});});}})[_0x3053('0x28')](respondWithResult(_0xddef6c,null))[_0x3053('0x4b')](handleError(_0xddef6c,null));};exports[_0x3053('0x81')]=function(_0x214dd7,_0x35d6ee,_0xe00ea3){var _0x57b823={};var _0x52c829={};var _0x372a6c;var _0x17688c;return db['CmList'][_0x3053('0x75')]({'where':{'id':_0x214dd7['params']['id']}})[_0x3053('0x28')](handleEntityNotFound(_0x35d6ee,null))[_0x3053('0x28')](function(_0x236f0a){if(_0x236f0a){_0x372a6c=_0x236f0a;_0x52c829[_0x3053('0x35')]=_['keys'](db[_0x3053('0x64')]['rawAttributes']);_0x52c829[_0x3053('0x38')]=_[_0x3053('0x37')](_0x214dd7[_0x3053('0x38')]);_0x52c829[_0x3053('0x39')]=_[_0x3053('0x3b')](_0x52c829[_0x3053('0x35')],_0x52c829[_0x3053('0x38')]);_0x57b823['attributes']=_[_0x3053('0x3b')](_0x52c829[_0x3053('0x35')],qs[_0x3053('0x3c')](_0x214dd7[_0x3053('0x38')][_0x3053('0x3c')]));_0x57b823['attributes']=_0x57b823[_0x3053('0x3a')]['length']?_0x57b823[_0x3053('0x3a')]:_0x52c829[_0x3053('0x35')];_0x57b823[_0x3053('0x40')]=qs[_0x3053('0x41')](_0x214dd7[_0x3053('0x38')][_0x3053('0x41')]);_0x57b823[_0x3053('0x42')]=qs[_0x3053('0x39')](_[_0x3053('0x43')](_0x214dd7[_0x3053('0x38')],_0x52c829[_0x3053('0x39')]));_0x57b823[_0x3053('0x42')]=_[_0x3053('0x45')](_0x57b823[_0x3053('0x42')],{'$or':[{'ListId':_0x236f0a['id']},{'ListId':null}]});if(_0x214dd7[_0x3053('0x38')][_0x3053('0x44')]){_0x57b823[_0x3053('0x42')]=_['merge'](_0x57b823['where'],{'$or':_[_0x3053('0x36')](_0x57b823[_0x3053('0x3a')],function(_0xc813be){var _0x10d595={};_0x10d595[_0xc813be]={'$like':'%'+_0x214dd7[_0x3053('0x38')][_0x3053('0x44')]+'%'};return _0x10d595;})});}_0x57b823=_[_0x3053('0x45')]({},_0x57b823,_0x214dd7['options']);return db[_0x3053('0x64')][_0x3053('0x82')](_0x57b823);}})[_0x3053('0x28')](respondWithResult(_0x35d6ee,null))[_0x3053('0x4b')](handleError(_0x35d6ee,null));};exports[_0x3053('0x83')]=function(_0x2982ef,_0x39fdd7,_0x2040f5){return db[_0x3053('0x32')][_0x3053('0x4c')]({'where':{'id':_0x2982ef[_0x3053('0x54')]['id']}})[_0x3053('0x28')](handleEntityNotFound(_0x39fdd7,null))[_0x3053('0x28')](function(_0x1176f4){if(_0x1176f4){return _0x1176f4[_0x3053('0x83')](_0x2982ef[_0x3053('0x4e')][_0x3053('0x5b')],_[_0x3053('0x84')](_0x2982ef[_0x3053('0x4e')],[_0x3053('0x5b'),'id'])||{})['spread'](function(_0x3b80e6){for(var _0x543262=0x0;_0x543262<_0x2982ef[_0x3053('0x4e')][_0x3053('0x5b')][_0x3053('0x3d')];_0x543262+=0x1){socket[_0x3053('0x85')]('userCmList:save',{'UserId':_0x2982ef['body'][_0x3053('0x5b')][_0x543262],'CmListId':_0x2982ef[_0x3053('0x54')]['id']});}return _0x3b80e6;});}})[_0x3053('0x28')](respondWithResult(_0x39fdd7,null))[_0x3053('0x4b')](handleError(_0x39fdd7,null));};exports[_0x3053('0x86')]=function(_0x898f3c,_0x539276,_0x450a57){return db['CmList'][_0x3053('0x4c')]({'where':{'id':_0x898f3c[_0x3053('0x54')]['id']}})['then'](handleEntityNotFound(_0x539276,null))[_0x3053('0x28')](function(_0x1fce0b){if(_0x1fce0b){return _0x1fce0b[_0x3053('0x86')](_0x898f3c['query'][_0x3053('0x5b')])['then'](function(){if(_[_0x3053('0x5d')](_0x898f3c[_0x3053('0x38')][_0x3053('0x5b')])){for(var _0x2c4639=0x0;_0x2c4639<_0x898f3c['query']['ids']['length'];_0x2c4639+=0x1){socket[_0x3053('0x85')]('userCmList:remove',{'UserId':Number(_0x898f3c['query']['ids'][_0x2c4639]),'CmListId':Number(_0x898f3c[_0x3053('0x54')]['id'])});}}else{socket['emit'](_0x3053('0x87'),{'UserId':Number(_0x898f3c['query'][_0x3053('0x5b')]),'CmListId':Number(_0x898f3c[_0x3053('0x54')]['id'])});}});}})[_0x3053('0x28')](respondWithStatusCode(_0x539276,null))['catch'](handleError(_0x539276,null));};exports[_0x3053('0x88')]=function(_0x29743e,_0x143a9f,_0x550ba0){var _0x522559={};var _0x31c581={};var _0x538906;var _0x1e1625;return db[_0x3053('0x32')][_0x3053('0x75')]({'where':{'id':_0x29743e['params']['id']}})[_0x3053('0x28')](handleEntityNotFound(_0x143a9f,null))[_0x3053('0x28')](function(_0x580b38){if(_0x580b38){_0x538906=_0x580b38;_0x31c581['model']=_[_0x3053('0x37')](db['User']['rawAttributes']);_0x31c581['query']=_[_0x3053('0x37')](_0x29743e['query']);_0x31c581[_0x3053('0x39')]=_[_0x3053('0x3b')](_0x31c581[_0x3053('0x35')],_0x31c581[_0x3053('0x38')]);_0x522559[_0x3053('0x3a')]=_[_0x3053('0x3b')](_0x31c581[_0x3053('0x35')],qs[_0x3053('0x3c')](_0x29743e[_0x3053('0x38')][_0x3053('0x3c')]));_0x522559[_0x3053('0x3a')]=_0x522559[_0x3053('0x3a')]['length']?_0x522559[_0x3053('0x3a')]:_0x31c581[_0x3053('0x35')];_0x522559[_0x3053('0x40')]=qs[_0x3053('0x41')](_0x29743e[_0x3053('0x38')]['sort']);_0x522559['where']=qs['filters'](_[_0x3053('0x43')](_0x29743e['query'],_0x31c581['filters']));if(_0x29743e[_0x3053('0x38')][_0x3053('0x44')]){_0x522559['where']=_[_0x3053('0x45')](_0x522559['where'],{'$or':_[_0x3053('0x36')](_0x522559[_0x3053('0x3a')],function(_0x410995){var _0x2e43ae={};_0x2e43ae[_0x410995]={'$like':'%'+_0x29743e['query'][_0x3053('0x44')]+'%'};return _0x2e43ae;})});}_0x522559=_[_0x3053('0x45')]({},_0x522559,_0x29743e['options']);return _0x538906[_0x3053('0x88')](_0x522559);}})[_0x3053('0x28')](function(_0x48baa8){if(_0x48baa8){_0x1e1625=_0x48baa8[_0x3053('0x3d')];if(!_0x29743e[_0x3053('0x38')]['hasOwnProperty'](_0x3053('0x3f'))){_0x522559[_0x3053('0x22')]=qs[_0x3053('0x22')](_0x29743e[_0x3053('0x38')]['limit']);_0x522559[_0x3053('0x21')]=qs[_0x3053('0x21')](_0x29743e[_0x3053('0x38')]['offset']);}return _0x538906['getAgents'](_0x522559);}})[_0x3053('0x28')](function(_0x37f73e){if(_0x37f73e){return _0x37f73e?{'count':_0x1e1625,'rows':_0x37f73e}:null;}})[_0x3053('0x28')](respondWithResult(_0x143a9f,null))[_0x3053('0x4b')](handleError(_0x143a9f,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index ff406f5..1dc02e6 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 _0x467b=['CmList','save','update','emit','hook','events','../../mysqldb'];(function(_0x123876,_0x322dc8){var _0xefb957=function(_0x5582cc){while(--_0x5582cc){_0x123876['push'](_0x123876['shift']());}};_0xefb957(++_0x322dc8);}(_0x467b,0x1da));var _0xb467=function(_0x120a31,_0x5a55d6){_0x120a31=_0x120a31-0x0;var _0x452b6c=_0x467b[_0x120a31];return _0x452b6c;};'use strict';var EventEmitter=require(_0xb467('0x0'));var CmList=require(_0xb467('0x1'))['db'][_0xb467('0x2')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb467('0x3'),'afterUpdate':_0xb467('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5a2d15){return function(_0x4fcffd,_0xffb8cc,_0x502323){CmListEvents['emit'](_0x5a2d15+':'+_0x4fcffd['id'],_0x4fcffd);CmListEvents[_0xb467('0x5')](_0x5a2d15,_0x4fcffd);_0x502323(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb467('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x2e36=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0xf6e75d,_0xc70967){var _0x27514d=function(_0xc2c6dd){while(--_0xc2c6dd){_0xf6e75d['push'](_0xf6e75d['shift']());}};_0x27514d(++_0xc70967);}(_0x2e36,0xd4));var _0x62e3=function(_0x47ead2,_0xfb55ad){_0x47ead2=_0x47ead2-0x0;var _0x4a54e8=_0x2e36[_0x47ead2];return _0x4a54e8;};'use strict';var EventEmitter=require(_0x62e3('0x0'));var CmList=require(_0x62e3('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x62e3('0x2')](0x0);var events={'afterCreate':_0x62e3('0x3'),'afterUpdate':_0x62e3('0x4'),'afterDestroy':'remove'};function emitEvent(_0xbb7b20){return function(_0x790fdc,_0x5b242c,_0x319aa8){CmListEvents['emit'](_0xbb7b20+':'+_0x790fdc['id'],_0x790fdc);CmListEvents['emit'](_0xbb7b20,_0x790fdc);_0x319aa8(null);};}for(var e in events){if(events[_0x62e3('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x62e3('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 78fb1c4..fb59679 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 _0xf578=['exports','define','CmList','cm_lists','util','../../config/logger','request-promise','path','../../config/environment','./cmList.attributes'];(function(_0xdb1ed6,_0x256dd5){var _0x1ef726=function(_0x1230b4){while(--_0x1230b4){_0xdb1ed6['push'](_0xdb1ed6['shift']());}};_0x1ef726(++_0x256dd5);}(_0xf578,0x7c));var _0x8f57=function(_0x53ad58,_0x3fb489){_0x53ad58=_0x53ad58-0x0;var _0x554b03=_0xf578[_0x53ad58];return _0x554b03;};'use strict';var _=require('lodash');var util=require(_0x8f57('0x0'));var logger=require(_0x8f57('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8f57('0x2'));var fs=require('fs');var path=require(_0x8f57('0x3'));var rimraf=require('rimraf');var config=require(_0x8f57('0x4'));var attributes=require(_0x8f57('0x5'));module[_0x8f57('0x6')]=function(_0x414f0a,_0xbd6e23){return _0x414f0a[_0x8f57('0x7')](_0x8f57('0x8'),attributes,{'tableName':_0x8f57('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57d2=['define','CmList','cm_lists','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports'];(function(_0x2ac41e,_0x1a5137){var _0x3e0589=function(_0x2b9b01){while(--_0x2b9b01){_0x2ac41e['push'](_0x2ac41e['shift']());}};_0x3e0589(++_0x1a5137);}(_0x57d2,0x65));var _0x257d=function(_0x113f32,_0x4b7c3a){_0x113f32=_0x113f32-0x0;var _0x4a6ec5=_0x57d2[_0x113f32];return _0x4a6ec5;};'use strict';var _=require(_0x257d('0x0'));var util=require(_0x257d('0x1'));var logger=require(_0x257d('0x2'))(_0x257d('0x3'));var moment=require(_0x257d('0x4'));var BPromise=require('bluebird');var rp=require(_0x257d('0x5'));var fs=require('fs');var path=require(_0x257d('0x6'));var rimraf=require(_0x257d('0x7'));var config=require(_0x257d('0x8'));var attributes=require(_0x257d('0x9'));module[_0x257d('0xa')]=function(_0xda71d1,_0x3a52eb){return _0xda71d1[_0x257d('0xb')](_0x257d('0xc'),attributes,{'tableName':_0x257d('0xd'),'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 f0c3b72..8ce821a 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 _0xdf89=['client','http','redis','localhost','./cmList.socket','register','request','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','CmList,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1c6cb8,_0x525767){var _0x1afe4a=function(_0x541e4f){while(--_0x541e4f){_0x1c6cb8['push'](_0x1c6cb8['shift']());}};_0x1afe4a(++_0x525767);}(_0xdf89,0x16f));var _0x9df8=function(_0x2bc12d,_0x25dab8){_0x2bc12d=_0x2bc12d-0x0;var _0x31cd4b=_0xdf89[_0x2bc12d];return _0x31cd4b;};'use strict';var _=require(_0x9df8('0x0'));var util=require(_0x9df8('0x1'));var moment=require(_0x9df8('0x2'));var BPromise=require(_0x9df8('0x3'));var rs=require(_0x9df8('0x4'));var fs=require('fs');var Redis=require(_0x9df8('0x5'));var db=require(_0x9df8('0x6'))['db'];var utils=require(_0x9df8('0x7'));var logger=require(_0x9df8('0x8'))('rpc');var config=require(_0x9df8('0x9'));var jayson=require(_0x9df8('0xa'));var client=jayson[_0x9df8('0xb')][_0x9df8('0xc')]({'port':0x232a});config[_0x9df8('0xd')]=_['defaults'](config[_0x9df8('0xd')],{'host':_0x9df8('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9df8('0xd')]));require(_0x9df8('0xf'))[_0x9df8('0x10')](socket);function respondWithRpcPromise(_0x1b632b,_0x5dc398,_0x5bf548){return new BPromise(function(_0x1e0bca,_0x1b9532){return client[_0x9df8('0x11')](_0x1b632b,_0x5bf548)[_0x9df8('0x12')](function(_0x50d7f5){logger[_0x9df8('0x13')]('CmList,\x20%s,\x20%s',_0x5dc398,_0x9df8('0x14'));logger[_0x9df8('0x15')](_0x9df8('0x16'),_0x5dc398,_0x9df8('0x14'),JSON['stringify'](_0x50d7f5));if(_0x50d7f5[_0x9df8('0x17')]){if(_0x50d7f5['error']['code']===0x1f4){logger[_0x9df8('0x17')](_0x9df8('0x18'),_0x5dc398,_0x50d7f5['error']['message']);return _0x1b9532(_0x50d7f5[_0x9df8('0x17')]['message']);}logger[_0x9df8('0x17')]('CmList,\x20%s,\x20%s',_0x5dc398,_0x50d7f5[_0x9df8('0x17')][_0x9df8('0x19')]);return _0x1e0bca(_0x50d7f5[_0x9df8('0x17')][_0x9df8('0x19')]);}else{logger[_0x9df8('0x13')](_0x9df8('0x18'),_0x5dc398,_0x9df8('0x14'));_0x1e0bca(_0x50d7f5['result'][_0x9df8('0x19')]);}})[_0x9df8('0x1a')](function(_0x39e715){logger[_0x9df8('0x17')]('CmList,\x20%s,\x20%s',_0x5dc398,_0x39e715);_0x1b9532(_0x39e715);});});} \ No newline at end of file +var _0xd651=['rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','register','request','then','info','CmList,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger'];(function(_0x3b33fc,_0x211491){var _0x1c2e91=function(_0x1d431f){while(--_0x1d431f){_0x3b33fc['push'](_0x3b33fc['shift']());}};_0x1c2e91(++_0x211491);}(_0xd651,0x18a));var _0x1d65=function(_0xe25179,_0x58199e){_0xe25179=_0xe25179-0x0;var _0x3ee18f=_0xd651[_0xe25179];return _0x3ee18f;};'use strict';var _=require(_0x1d65('0x0'));var util=require(_0x1d65('0x1'));var moment=require(_0x1d65('0x2'));var BPromise=require('bluebird');var rs=require(_0x1d65('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d65('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1d65('0x5'))(_0x1d65('0x6'));var config=require(_0x1d65('0x7'));var jayson=require(_0x1d65('0x8'));var client=jayson[_0x1d65('0x9')][_0x1d65('0xa')]({'port':0x232a});config['redis']=_[_0x1d65('0xb')](config['redis'],{'host':_0x1d65('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./cmList.socket')[_0x1d65('0xd')](socket);function respondWithRpcPromise(_0x22119a,_0x5862c5,_0x52c636){return new BPromise(function(_0x10d864,_0x4ad4b0){return client[_0x1d65('0xe')](_0x22119a,_0x52c636)[_0x1d65('0xf')](function(_0x35726e){logger[_0x1d65('0x10')](_0x1d65('0x11'),_0x5862c5,'request\x20sent');logger[_0x1d65('0x12')]('CmList,\x20%s,\x20%s,\x20%s',_0x5862c5,'request\x20sent',JSON[_0x1d65('0x13')](_0x35726e));if(_0x35726e[_0x1d65('0x14')]){if(_0x35726e[_0x1d65('0x14')]['code']===0x1f4){logger['error'](_0x1d65('0x11'),_0x5862c5,_0x35726e['error']['message']);return _0x4ad4b0(_0x35726e[_0x1d65('0x14')]['message']);}logger[_0x1d65('0x14')](_0x1d65('0x11'),_0x5862c5,_0x35726e['error'][_0x1d65('0x15')]);return _0x10d864(_0x35726e[_0x1d65('0x14')]['message']);}else{logger['info'](_0x1d65('0x11'),_0x5862c5,_0x1d65('0x16'));_0x10d864(_0x35726e[_0x1d65('0x17')]['message']);}})[_0x1d65('0x18')](function(_0x3fddf7){logger[_0x1d65('0x14')](_0x1d65('0x11'),_0x5862c5,_0x3fddf7);_0x4ad4b0(_0x3fddf7);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 7bc6779..95183cf 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 _0x27a0=['length','cmList:','save','remove','update','removeListener','register'];(function(_0x5bd741,_0x481b9c){var _0xd3be3d=function(_0x4fc75c){while(--_0x4fc75c){_0x5bd741['push'](_0x5bd741['shift']());}};_0xd3be3d(++_0x481b9c);}(_0x27a0,0xbf));var _0x027a=function(_0x4b7245,_0x1e8148){_0x4b7245=_0x4b7245-0x0;var _0x44fb0b=_0x27a0[_0x4b7245];return _0x44fb0b;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x027a('0x0'),_0x027a('0x1'),_0x027a('0x2')];function createListener(_0x352dd7,_0x32e5e0){return function(_0x59cd58){_0x32e5e0['emit'](_0x352dd7,_0x59cd58);};}function removeListener(_0x4e8d6b,_0x47cd65){return function(){CmListEvents[_0x027a('0x3')](_0x4e8d6b,_0x47cd65);};}exports[_0x027a('0x4')]=function(_0x137b09){for(var _0x639bec=0x0,_0xe233ed=events[_0x027a('0x5')];_0x639bec<_0xe233ed;_0x639bec++){var _0x550fbb=events[_0x639bec];var _0x3d1429=createListener(_0x027a('0x6')+_0x550fbb,_0x137b09);CmListEvents['on'](_0x550fbb,_0x3d1429);}}; \ No newline at end of file +var _0x6c7b=['register','cmList:','./cmList.events','emit','removeListener'];(function(_0xda501a,_0x159d6a){var _0x44be3a=function(_0x5c1c5f){while(--_0x5c1c5f){_0xda501a['push'](_0xda501a['shift']());}};_0x44be3a(++_0x159d6a);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x36d14b,_0x1ba5eb){_0x36d14b=_0x36d14b-0x0;var _0x4be643=_0x6c7b[_0x36d14b];return _0x4be643;};'use strict';var CmListEvents=require(_0xb6c7('0x0'));var events=['save','remove','update'];function createListener(_0x3f3910,_0x5528b3){return function(_0x2b678a){_0x5528b3[_0xb6c7('0x1')](_0x3f3910,_0x2b678a);};}function removeListener(_0x35674b,_0x5857e0){return function(){CmListEvents[_0xb6c7('0x2')](_0x35674b,_0x5857e0);};}exports[_0xb6c7('0x3')]=function(_0xfe3eb9){for(var _0x219abc=0x0,_0xb889c3=events['length'];_0x219abc<_0xb889c3;_0x219abc++){var _0x12e97e=events[_0x219abc];var _0x41a5a5=createListener(_0xb6c7('0x4')+_0x12e97e,_0xfe3eb9);CmListEvents['on'](_0x12e97e,_0x41a5a5);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 7414d31..4517660 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 _0x6d38=['delete','exports','util','path','connect-timeout','../../components/auth/service','../../config/environment','./cmList.controller','get','index','/describe','isAuthenticated','/:id','show','getDispositions','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','create','/:id/dispositions','addDisposition','addContacts','addCustomField','put','destroy'];(function(_0x34b89a,_0x4cb1fc){var _0x5c7e87=function(_0x5f4cc8){while(--_0x5f4cc8){_0x34b89a['push'](_0x34b89a['shift']());}};_0x5c7e87(++_0x4cb1fc);}(_0x6d38,0x1ef));var _0x86d3=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6d38[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x86d3('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x86d3('0x4'));var controller=require(_0x86d3('0x5'));router[_0x86d3('0x6')]('/',auth['isAuthenticated'](),controller[_0x86d3('0x7')]);router[_0x86d3('0x6')](_0x86d3('0x8'),auth[_0x86d3('0x9')](),controller['describe']);router['get'](_0x86d3('0xa'),auth[_0x86d3('0x9')](),controller[_0x86d3('0xb')]);router['get']('/:id/dispositions',auth[_0x86d3('0x9')](),controller[_0x86d3('0xc')]);router['get']('/:id/contacts',auth[_0x86d3('0x9')](),controller[_0x86d3('0xd')]);router['get'](_0x86d3('0xe'),auth['isAuthenticated'](),controller[_0x86d3('0xf')]);router[_0x86d3('0x6')](_0x86d3('0x10'),auth[_0x86d3('0x9')](),controller[_0x86d3('0x11')]);router[_0x86d3('0x6')](_0x86d3('0x12'),auth[_0x86d3('0x9')](),controller['getAgents']);router[_0x86d3('0x13')]('/',auth[_0x86d3('0x9')](),controller[_0x86d3('0x14')]);router[_0x86d3('0x13')](_0x86d3('0x15'),auth[_0x86d3('0x9')](),controller[_0x86d3('0x16')]);router[_0x86d3('0x13')]('/:id/contacts',auth[_0x86d3('0x9')](),controller[_0x86d3('0x17')]);router[_0x86d3('0x13')](_0x86d3('0x10'),auth[_0x86d3('0x9')](),controller[_0x86d3('0x18')]);router[_0x86d3('0x13')](_0x86d3('0x12'),auth[_0x86d3('0x9')](),controller['addAgents']);router[_0x86d3('0x19')]('/:id',auth[_0x86d3('0x9')](),controller['update']);router['delete'](_0x86d3('0xa'),auth[_0x86d3('0x9')](),controller[_0x86d3('0x1a')]);router[_0x86d3('0x1b')]('/:id/dispositions',auth[_0x86d3('0x9')](),controller['removeDispositions']);router[_0x86d3('0x1b')](_0x86d3('0x12'),auth[_0x86d3('0x9')](),controller['removeAgents']);module[_0x86d3('0x1c')]=router; \ No newline at end of file +var _0x4095=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getAgents','create','post','addContacts','/:id/users','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util'];(function(_0x41e159,_0x54b1be){var _0x2f896b=function(_0x44783c){while(--_0x44783c){_0x41e159['push'](_0x41e159['shift']());}};_0x2f896b(++_0x54b1be);}(_0x4095,0x152));var _0x5409=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x4095[_0x1eda20];return _0x31b953;};'use strict';var multer=require(_0x5409('0x0'));var util=require(_0x5409('0x1'));var path=require(_0x5409('0x2'));var timeout=require(_0x5409('0x3'));var express=require(_0x5409('0x4'));var router=express[_0x5409('0x5')]();var auth=require(_0x5409('0x6'));var interaction=require(_0x5409('0x7'));var config=require('../../config/environment');var controller=require(_0x5409('0x8'));router[_0x5409('0x9')]('/',auth['isAuthenticated'](),controller[_0x5409('0xa')]);router[_0x5409('0x9')](_0x5409('0xb'),auth[_0x5409('0xc')](),controller['describe']);router[_0x5409('0x9')](_0x5409('0xd'),auth[_0x5409('0xc')](),controller[_0x5409('0xe')]);router['get'](_0x5409('0xf'),auth[_0x5409('0xc')](),controller[_0x5409('0x10')]);router['get'](_0x5409('0x11'),auth['isAuthenticated'](),controller[_0x5409('0x12')]);router[_0x5409('0x9')](_0x5409('0x13'),auth[_0x5409('0xc')](),controller[_0x5409('0x14')]);router['get'](_0x5409('0x15'),auth[_0x5409('0xc')](),controller['getCustomFields']);router[_0x5409('0x9')]('/:id/users',auth[_0x5409('0xc')](),controller[_0x5409('0x16')]);router['post']('/',auth[_0x5409('0xc')](),controller[_0x5409('0x17')]);router[_0x5409('0x18')](_0x5409('0xf'),auth[_0x5409('0xc')](),controller['addDisposition']);router[_0x5409('0x18')](_0x5409('0x11'),auth[_0x5409('0xc')](),controller[_0x5409('0x19')]);router[_0x5409('0x18')](_0x5409('0x15'),auth[_0x5409('0xc')](),controller['addCustomField']);router[_0x5409('0x18')](_0x5409('0x1a'),auth[_0x5409('0xc')](),controller[_0x5409('0x1b')]);router[_0x5409('0x1c')](_0x5409('0xd'),auth[_0x5409('0xc')](),controller[_0x5409('0x1d')]);router[_0x5409('0x1e')](_0x5409('0xd'),auth[_0x5409('0xc')](),controller[_0x5409('0x1f')]);router[_0x5409('0x1e')]('/:id/dispositions',auth[_0x5409('0xc')](),controller['removeDispositions']);router[_0x5409('0x1e')](_0x5409('0x1a'),auth[_0x5409('0xc')](),controller[_0x5409('0x20')]);module[_0x5409('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index e8d7970..a6c0900 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x5864b0,_0x2bf240){var _0x24ef52=function(_0x374dd2){while(--_0x374dd2){_0x5864b0['push'](_0x5864b0['shift']());}};_0x24ef52(++_0x2bf240);}(_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')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x366487,_0x58e80f){var _0x51b11d=function(_0x515cea){while(--_0x515cea){_0x366487['push'](_0x366487['shift']());}};_0x51b11d(++_0x58e80f);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'get':function(_0x10a05d){return this['getDataValue'](_0x7995('0x3'));}},'field':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x7995('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 56fe061..435c197 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 _0x4d05=['to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','json','apply','reject','update','then','destroy','error','stack','name','send','body','Condition','find','params','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x4d05,0xee));var _0x54d0=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4d05[_0x3bf83f];return _0x22c4a9;};'use strict';var pdf=require(_0x54d0('0x0'));var emlformat=require(_0x54d0('0x1'));var rimraf=require(_0x54d0('0x2'));var zipdir=require(_0x54d0('0x3'));var jsonpatch=require(_0x54d0('0x4'));var rp=require(_0x54d0('0x5'));var moment=require(_0x54d0('0x6'));var BPromise=require(_0x54d0('0x7'));var Mustache=require(_0x54d0('0x8'));var util=require(_0x54d0('0x9'));var path=require(_0x54d0('0xa'));var sox=require(_0x54d0('0xb'));var csv=require(_0x54d0('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x54d0('0xd'));var squel=require(_0x54d0('0xe'));var crypto=require(_0x54d0('0xf'));var jsforce=require(_0x54d0('0x10'));var deskjs=require(_0x54d0('0x11'));var toCsv=require(_0x54d0('0xc'));var querystring=require(_0x54d0('0x12'));var Papa=require(_0x54d0('0x13'));var Redis=require(_0x54d0('0x14'));var authService=require(_0x54d0('0x15'));var qs=require(_0x54d0('0x16'));var as=require(_0x54d0('0x17'));var hardwareService=require(_0x54d0('0x18'));var logger=require(_0x54d0('0x19'))(_0x54d0('0x1a'));var utils=require(_0x54d0('0x1b'));var config=require(_0x54d0('0x1c'));var db=require(_0x54d0('0x1d'))['db'];function respondWithStatusCode(_0x43e535,_0x3c9ca7){_0x3c9ca7=_0x3c9ca7||0xcc;return function(_0x6bbd13){if(_0x6bbd13){return _0x43e535[_0x54d0('0x1e')](_0x3c9ca7);}return _0x43e535[_0x54d0('0x1f')](_0x3c9ca7)[_0x54d0('0x20')]();};}function respondWithResult(_0x8e8fd5,_0xcf008d){_0xcf008d=_0xcf008d||0xc8;return function(_0x45b0b9){if(_0x45b0b9){return _0x8e8fd5[_0x54d0('0x1f')](_0xcf008d)['json'](_0x45b0b9);}};}function respondWithFilteredResult(_0x1e346f,_0x155bd4){return function(_0x44c042){if(_0x44c042){var _0x135338=_0x44c042['count'],_0x4f1870=_0x155bd4['offset'],_0x37cc5a=_0x155bd4[_0x54d0('0x21')]+_0x155bd4[_0x54d0('0x22')],_0x407c0c;if(_0x37cc5a>=_0x135338){_0x37cc5a=_0x135338;_0x407c0c=0xc8;}else{_0x407c0c=0xce;}_0x1e346f['status'](_0x407c0c);return _0x1e346f['set']('Content-Range',_0x4f1870+'-'+_0x37cc5a+'/'+_0x135338)[_0x54d0('0x23')](_0x44c042);}return null;};}function patchUpdates(_0x1fb969){return function(_0x44941c){try{jsonpatch[_0x54d0('0x24')](_0x44941c,_0x1fb969,!![]);}catch(_0x41c088){return BPromise[_0x54d0('0x25')](_0x41c088);}return _0x44941c['save']();};}function saveUpdates(_0x55c414,_0x2a6133){return function(_0x3bcf2c){if(_0x3bcf2c){return _0x3bcf2c[_0x54d0('0x26')](_0x55c414)[_0x54d0('0x27')](function(_0x276d7a){return _0x276d7a;});}return null;};}function removeEntity(_0x1ceac3,_0x19db20){return function(_0x43cf3c){if(_0x43cf3c){return _0x43cf3c[_0x54d0('0x28')]()['then'](function(){_0x1ceac3[_0x54d0('0x1f')](0xcc)[_0x54d0('0x20')]();});}};}function handleEntityNotFound(_0x487707,_0x4b8c0a){return function(_0x142b19){if(!_0x142b19){_0x487707[_0x54d0('0x1e')](0x194);}return _0x142b19;};}function handleError(_0x2ac2f6,_0x519faf){_0x519faf=_0x519faf||0x1f4;return function(_0x23cb56){logger[_0x54d0('0x29')](_0x23cb56[_0x54d0('0x2a')]);if(_0x23cb56[_0x54d0('0x2b')]){delete _0x23cb56['name'];}_0x2ac2f6[_0x54d0('0x1f')](_0x519faf)[_0x54d0('0x2c')](_0x23cb56);};}exports[_0x54d0('0x26')]=function(_0x2cca8d,_0x2340e4){if(_0x2cca8d[_0x54d0('0x2d')]['id']){delete _0x2cca8d[_0x54d0('0x2d')]['id'];}return db[_0x54d0('0x2e')][_0x54d0('0x2f')]({'where':{'id':_0x2cca8d[_0x54d0('0x30')]['id']}})[_0x54d0('0x27')](handleEntityNotFound(_0x2340e4,null))[_0x54d0('0x27')](saveUpdates(_0x2cca8d[_0x54d0('0x2d')],null))['then'](respondWithResult(_0x2340e4,null))['catch'](handleError(_0x2340e4,null));};exports['destroy']=function(_0x391647,_0x2b117b){return db[_0x54d0('0x2e')][_0x54d0('0x2f')]({'where':{'id':_0x391647[_0x54d0('0x30')]['id']}})['then'](handleEntityNotFound(_0x2b117b,null))[_0x54d0('0x27')](removeEntity(_0x2b117b,null))[_0x54d0('0x31')](handleError(_0x2b117b,null));}; \ No newline at end of file +var _0xf56c=['error','name','send','update','body','Condition','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then'];(function(_0xf2726b,_0x87deb7){var _0xa61a5=function(_0x27759c){while(--_0x27759c){_0xf2726b['push'](_0xf2726b['shift']());}};_0xa61a5(++_0x87deb7);}(_0xf56c,0x67));var _0xcf56=function(_0x3ba39c,_0x2b71ec){_0x3ba39c=_0x3ba39c-0x0;var _0x32a3a8=_0xf56c[_0x3ba39c];return _0x32a3a8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcf56('0x0'));var rimraf=require(_0xcf56('0x1'));var zipdir=require(_0xcf56('0x2'));var jsonpatch=require(_0xcf56('0x3'));var rp=require('request-promise');var moment=require(_0xcf56('0x4'));var BPromise=require(_0xcf56('0x5'));var Mustache=require(_0xcf56('0x6'));var util=require(_0xcf56('0x7'));var path=require(_0xcf56('0x8'));var sox=require(_0xcf56('0x9'));var csv=require(_0xcf56('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcf56('0xb'));var squel=require('squel');var crypto=require(_0xcf56('0xc'));var jsforce=require(_0xcf56('0xd'));var deskjs=require(_0xcf56('0xe'));var toCsv=require(_0xcf56('0xa'));var querystring=require(_0xcf56('0xf'));var Papa=require('papaparse');var Redis=require(_0xcf56('0x10'));var authService=require(_0xcf56('0x11'));var qs=require(_0xcf56('0x12'));var as=require(_0xcf56('0x13'));var hardwareService=require(_0xcf56('0x14'));var logger=require(_0xcf56('0x15'))(_0xcf56('0x16'));var utils=require('../../config/utils');var config=require(_0xcf56('0x17'));var db=require(_0xcf56('0x18'))['db'];function respondWithStatusCode(_0x4bc40a,_0x1baa30){_0x1baa30=_0x1baa30||0xcc;return function(_0x197ce0){if(_0x197ce0){return _0x4bc40a[_0xcf56('0x19')](_0x1baa30);}return _0x4bc40a['status'](_0x1baa30)[_0xcf56('0x1a')]();};}function respondWithResult(_0x2bd938,_0x1f92e7){_0x1f92e7=_0x1f92e7||0xc8;return function(_0x4088ca){if(_0x4088ca){return _0x2bd938['status'](_0x1f92e7)[_0xcf56('0x1b')](_0x4088ca);}};}function respondWithFilteredResult(_0x4f71a4,_0x3ace8f){return function(_0x19c136){if(_0x19c136){var _0x53ba6e=_0x19c136[_0xcf56('0x1c')],_0x136eaf=_0x3ace8f['offset'],_0x25573e=_0x3ace8f[_0xcf56('0x1d')]+_0x3ace8f[_0xcf56('0x1e')],_0x3014cc;if(_0x25573e>=_0x53ba6e){_0x25573e=_0x53ba6e;_0x3014cc=0xc8;}else{_0x3014cc=0xce;}_0x4f71a4[_0xcf56('0x1f')](_0x3014cc);return _0x4f71a4[_0xcf56('0x20')](_0xcf56('0x21'),_0x136eaf+'-'+_0x25573e+'/'+_0x53ba6e)['json'](_0x19c136);}return null;};}function patchUpdates(_0x582eb8){return function(_0x51fc83){try{jsonpatch[_0xcf56('0x22')](_0x51fc83,_0x582eb8,!![]);}catch(_0x5c22e9){return BPromise[_0xcf56('0x23')](_0x5c22e9);}return _0x51fc83[_0xcf56('0x24')]();};}function saveUpdates(_0x3e9024,_0x2e561f){return function(_0x5ec0c3){if(_0x5ec0c3){return _0x5ec0c3['update'](_0x3e9024)[_0xcf56('0x25')](function(_0x174b6d){return _0x174b6d;});}return null;};}function removeEntity(_0x2287cf,_0x380845){return function(_0x4a75a3){if(_0x4a75a3){return _0x4a75a3['destroy']()[_0xcf56('0x25')](function(){_0x2287cf[_0xcf56('0x1f')](0xcc)[_0xcf56('0x1a')]();});}};}function handleEntityNotFound(_0x47733f,_0x2cb514){return function(_0x512f0b){if(!_0x512f0b){_0x47733f[_0xcf56('0x19')](0x194);}return _0x512f0b;};}function handleError(_0x2c7c8e,_0x32bc14){_0x32bc14=_0x32bc14||0x1f4;return function(_0x53b72a){logger[_0xcf56('0x26')](_0x53b72a['stack']);if(_0x53b72a[_0xcf56('0x27')]){delete _0x53b72a[_0xcf56('0x27')];}_0x2c7c8e[_0xcf56('0x1f')](_0x32bc14)[_0xcf56('0x28')](_0x53b72a);};}exports[_0xcf56('0x29')]=function(_0x49f38e,_0x2078b0){if(_0x49f38e[_0xcf56('0x2a')]['id']){delete _0x49f38e[_0xcf56('0x2a')]['id'];}return db[_0xcf56('0x2b')][_0xcf56('0x2c')]({'where':{'id':_0x49f38e[_0xcf56('0x2d')]['id']}})[_0xcf56('0x25')](handleEntityNotFound(_0x2078b0,null))[_0xcf56('0x25')](saveUpdates(_0x49f38e['body'],null))[_0xcf56('0x25')](respondWithResult(_0x2078b0,null))[_0xcf56('0x2e')](handleError(_0x2078b0,null));};exports['destroy']=function(_0x419085,_0x43831b){return db[_0xcf56('0x2b')][_0xcf56('0x2c')]({'where':{'id':_0x419085['params']['id']}})['then'](handleEntityNotFound(_0x43831b,null))['then'](removeEntity(_0x43831b,null))[_0xcf56('0x2e')](handleError(_0x43831b,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 83d90a1..a00874b 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 _0x790a=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','Condition','tools_conditions','lodash','util'];(function(_0x1781f2,_0x182e66){var _0x6fa702=function(_0x7ccf00){while(--_0x7ccf00){_0x1781f2['push'](_0x1781f2['shift']());}};_0x6fa702(++_0x182e66);}(_0x790a,0x1ec));var _0xa790=function(_0x3f6962,_0x2e558b){_0x3f6962=_0x3f6962-0x0;var _0x3565a7=_0x790a[_0x3f6962];return _0x3565a7;};'use strict';var _=require(_0xa790('0x0'));var util=require(_0xa790('0x1'));var logger=require(_0xa790('0x2'))(_0xa790('0x3'));var moment=require(_0xa790('0x4'));var BPromise=require(_0xa790('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa790('0x6'));var rimraf=require(_0xa790('0x7'));var config=require(_0xa790('0x8'));var attributes=require('./condition.attributes');module[_0xa790('0x9')]=function(_0x530c0e,_0x1bf307){return _0x530c0e[_0xa790('0xa')](_0xa790('0xb'),attributes,{'tableName':_0xa790('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ab1=['define','Condition','tools_conditions','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./condition.attributes'];(function(_0x44160a,_0x535111){var _0x48b5f8=function(_0x2170b1){while(--_0x2170b1){_0x44160a['push'](_0x44160a['shift']());}};_0x48b5f8(++_0x535111);}(_0x2ab1,0x13b));var _0x12ab=function(_0x53c145,_0x2451b4){_0x53c145=_0x53c145-0x0;var _0xacaca3=_0x2ab1[_0x53c145];return _0xacaca3;};'use strict';var _=require(_0x12ab('0x0'));var util=require(_0x12ab('0x1'));var logger=require(_0x12ab('0x2'))(_0x12ab('0x3'));var moment=require('moment');var BPromise=require(_0x12ab('0x4'));var rp=require(_0x12ab('0x5'));var fs=require('fs');var path=require(_0x12ab('0x6'));var rimraf=require('rimraf');var config=require(_0x12ab('0x7'));var attributes=require(_0x12ab('0x8'));module['exports']=function(_0x21c9f2,_0x4648a7){return _0x21c9f2[_0x12ab('0x9')](_0x12ab('0xa'),attributes,{'tableName':_0x12ab('0xb'),'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 bfd7444..99735d4 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 _0xd35d=['request','then','info','request\x20sent','debug','stringify','error','code','Condition,\x20%s,\x20%s','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x265007,_0x3caeb9){var _0x43ce5e=function(_0x37626b){while(--_0x37626b){_0x265007['push'](_0x265007['shift']());}};_0x43ce5e(++_0x3caeb9);}(_0xd35d,0x15b));var _0xdd35=function(_0x3c4062,_0x3767fc){_0x3c4062=_0x3c4062-0x0;var _0x3f5bf3=_0xd35d[_0x3c4062];return _0x3f5bf3;};'use strict';var _=require(_0xdd35('0x0'));var util=require(_0xdd35('0x1'));var moment=require('moment');var BPromise=require(_0xdd35('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdd35('0x3'));var db=require(_0xdd35('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd35('0x5'))(_0xdd35('0x6'));var config=require(_0xdd35('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdd35('0x8')][_0xdd35('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e58b9,_0x1f0817,_0x144c50){return new BPromise(function(_0x4b6560,_0x46127c){return client[_0xdd35('0xa')](_0x3e58b9,_0x144c50)[_0xdd35('0xb')](function(_0x547dde){logger[_0xdd35('0xc')]('Condition,\x20%s,\x20%s',_0x1f0817,_0xdd35('0xd'));logger[_0xdd35('0xe')]('Condition,\x20%s,\x20%s,\x20%s',_0x1f0817,_0xdd35('0xd'),JSON[_0xdd35('0xf')](_0x547dde));if(_0x547dde[_0xdd35('0x10')]){if(_0x547dde[_0xdd35('0x10')][_0xdd35('0x11')]===0x1f4){logger[_0xdd35('0x10')](_0xdd35('0x12'),_0x1f0817,_0x547dde[_0xdd35('0x10')]['message']);return _0x46127c(_0x547dde[_0xdd35('0x10')]['message']);}logger[_0xdd35('0x10')](_0xdd35('0x12'),_0x1f0817,_0x547dde[_0xdd35('0x10')]['message']);return _0x4b6560(_0x547dde['error']['message']);}else{logger[_0xdd35('0xc')](_0xdd35('0x12'),_0x1f0817,_0xdd35('0xd'));_0x4b6560(_0x547dde[_0xdd35('0x13')]['message']);}})[_0xdd35('0x14')](function(_0x29bb27){logger[_0xdd35('0x10')](_0xdd35('0x12'),_0x1f0817,_0x29bb27);_0x46127c(_0x29bb27);});});} \ No newline at end of file +var _0xabc4=['code','message','request\x20sent','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','Condition,\x20%s,\x20%s','stringify','error'];(function(_0x4bd349,_0x5b041e){var _0x4c40b4=function(_0x1a9de5){while(--_0x1a9de5){_0x4bd349['push'](_0x4bd349['shift']());}};_0x4c40b4(++_0x5b041e);}(_0xabc4,0x192));var _0x4abc=function(_0x46ee1c,_0x45a091){_0x46ee1c=_0x46ee1c-0x0;var _0x23d17b=_0xabc4[_0x46ee1c];return _0x23d17b;};'use strict';var _=require(_0x4abc('0x0'));var util=require(_0x4abc('0x1'));var moment=require(_0x4abc('0x2'));var BPromise=require(_0x4abc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4abc('0x4'));var db=require(_0x4abc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4abc('0x6'))(_0x4abc('0x7'));var config=require(_0x4abc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4abc('0x9')][_0x4abc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1daefe,_0x2b5729,_0x4fe29f){return new BPromise(function(_0x245923,_0xa6e8b){return client[_0x4abc('0xb')](_0x1daefe,_0x4fe29f)[_0x4abc('0xc')](function(_0x14ac30){logger['info'](_0x4abc('0xd'),_0x2b5729,'request\x20sent');logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x2b5729,'request\x20sent',JSON[_0x4abc('0xe')](_0x14ac30));if(_0x14ac30[_0x4abc('0xf')]){if(_0x14ac30[_0x4abc('0xf')][_0x4abc('0x10')]===0x1f4){logger[_0x4abc('0xf')](_0x4abc('0xd'),_0x2b5729,_0x14ac30['error'][_0x4abc('0x11')]);return _0xa6e8b(_0x14ac30[_0x4abc('0xf')]['message']);}logger['error'](_0x4abc('0xd'),_0x2b5729,_0x14ac30['error']['message']);return _0x245923(_0x14ac30['error']['message']);}else{logger['info']('Condition,\x20%s,\x20%s',_0x2b5729,_0x4abc('0x12'));_0x245923(_0x14ac30['result']['message']);}})['catch'](function(_0x1d12fb){logger['error']('Condition,\x20%s,\x20%s',_0x2b5729,_0x1d12fb);_0xa6e8b(_0x1d12fb);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 5e0a5fe..e398438 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 _0xefb7=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','exports'];(function(_0x339d94,_0xf77330){var _0x58ae7a=function(_0x38a661){while(--_0x38a661){_0x339d94['push'](_0x339d94['shift']());}};_0x58ae7a(++_0xf77330);}(_0xefb7,0x180));var _0x7efb=function(_0x509273,_0x13fc9f){_0x509273=_0x509273-0x0;var _0x38ef40=_0xefb7[_0x509273];return _0x38ef40;};'use strict';var multer=require(_0x7efb('0x0'));var util=require(_0x7efb('0x1'));var path=require(_0x7efb('0x2'));var timeout=require(_0x7efb('0x3'));var express=require(_0x7efb('0x4'));var router=express[_0x7efb('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7efb('0x6'));var config=require(_0x7efb('0x7'));var controller=require(_0x7efb('0x8'));router[_0x7efb('0x9')](_0x7efb('0xa'),auth[_0x7efb('0xb')](),controller[_0x7efb('0xc')]);router[_0x7efb('0xd')](_0x7efb('0xa'),auth['isAuthenticated'](),controller[_0x7efb('0xe')]);module[_0x7efb('0xf')]=router; \ No newline at end of file +var _0x7e78=['/:id','update','delete','isAuthenticated','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put'];(function(_0x1b9080,_0x25d543){var _0x4ce6ee=function(_0x4cccf8){while(--_0x4cccf8){_0x1b9080['push'](_0x1b9080['shift']());}};_0x4ce6ee(++_0x25d543);}(_0x7e78,0x139));var _0x87e7=function(_0x425a53,_0x56ef6c){_0x425a53=_0x425a53-0x0;var _0xeb3b49=_0x7e78[_0x425a53];return _0xeb3b49;};'use strict';var multer=require(_0x87e7('0x0'));var util=require('util');var path=require(_0x87e7('0x1'));var timeout=require('connect-timeout');var express=require(_0x87e7('0x2'));var router=express[_0x87e7('0x3')]();var auth=require(_0x87e7('0x4'));var interaction=require(_0x87e7('0x5'));var config=require(_0x87e7('0x6'));var controller=require(_0x87e7('0x7'));router[_0x87e7('0x8')](_0x87e7('0x9'),auth['isAuthenticated'](),controller[_0x87e7('0xa')]);router[_0x87e7('0xb')](_0x87e7('0x9'),auth[_0x87e7('0xc')](),controller['destroy']);module[_0x87e7('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index fe07bbd..4af7691 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf041=['name','INTEGER','STRING'];(function(_0x55dc91,_0x4bcf2d){var _0x23bffe=function(_0x3a1a13){while(--_0x3a1a13){_0x55dc91['push'](_0x55dc91['shift']());}};_0x23bffe(++_0x4bcf2d);}(_0xf041,0x15b));var _0x1f04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf041[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1f04('0x0')],'allowNull':![],'unique':_0x1f04('0x1')},'OrderBy':{'type':Sequelize[_0x1f04('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x1f04('0x0')],'allowNull':!![]}}; \ No newline at end of file +var _0xc01b=['name','sequelize','exports','STRING'];(function(_0x34c267,_0x4b2774){var _0x595460=function(_0x19d80d){while(--_0x19d80d){_0x34c267['push'](_0x34c267['shift']());}};_0x595460(++_0x4b2774);}(_0xc01b,0x65));var _0xbc01=function(_0x3506a5,_0x1a500e){_0x3506a5=_0x3506a5-0x0;var _0x511a36=_0xc01b[_0x3506a5];return _0x511a36;};'use strict';var Sequelize=require(_0xbc01('0x0'));module[_0xbc01('0x1')]={'name':{'type':Sequelize[_0xbc01('0x2')],'allowNull':![],'unique':_0xbc01('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xbc01('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 81f2588..8ed329d 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['include','rows','show','params','intersection','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll'];(function(_0x9bfc6c,_0x159ef2){var _0x1f8376=function(_0x475856){while(--_0x475856){_0x9bfc6c['push'](_0x9bfc6c['shift']());}};_0x1f8376(++_0x159ef2);}(_0xedd9,0xfc));var _0x9edd=function(_0x263b70,_0x21fd4a){_0x263b70=_0x263b70-0x0;var _0x1ab742=_0xedd9[_0x263b70];return _0x1ab742;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9edd('0x0'));var rimraf=require(_0x9edd('0x1'));var zipdir=require(_0x9edd('0x2'));var jsonpatch=require(_0x9edd('0x3'));var rp=require(_0x9edd('0x4'));var moment=require(_0x9edd('0x5'));var BPromise=require(_0x9edd('0x6'));var Mustache=require(_0x9edd('0x7'));var util=require('util');var path=require(_0x9edd('0x8'));var sox=require(_0x9edd('0x9'));var csv=require(_0x9edd('0xa'));var ejs=require(_0x9edd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0xa'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var db=require(_0x9edd('0x16'))['db'];function respondWithStatusCode(_0x25e64c,_0xfd544a){_0xfd544a=_0xfd544a||0xcc;return function(_0x287ddd){if(_0x287ddd){return _0x25e64c[_0x9edd('0x17')](_0xfd544a);}return _0x25e64c[_0x9edd('0x18')](_0xfd544a)[_0x9edd('0x19')]();};}function respondWithResult(_0x47eb64,_0x176bfa){_0x176bfa=_0x176bfa||0xc8;return function(_0x44fc7c){if(_0x44fc7c){return _0x47eb64[_0x9edd('0x18')](_0x176bfa)[_0x9edd('0x1a')](_0x44fc7c);}};}function respondWithFilteredResult(_0x13b6b6,_0x338f3c){return function(_0x1042aa){if(_0x1042aa){var _0x75a4ab=_0x1042aa[_0x9edd('0x1b')],_0x4ea60f=_0x338f3c['offset'],_0x5f5bf4=_0x338f3c[_0x9edd('0x1c')]+_0x338f3c[_0x9edd('0x1d')],_0x448996;if(_0x5f5bf4>=_0x75a4ab){_0x5f5bf4=_0x75a4ab;_0x448996=0xc8;}else{_0x448996=0xce;}_0x13b6b6[_0x9edd('0x18')](_0x448996);return _0x13b6b6['set'](_0x9edd('0x1e'),_0x4ea60f+'-'+_0x5f5bf4+'/'+_0x75a4ab)['json'](_0x1042aa);}return null;};}function patchUpdates(_0x2cdcef){return function(_0x1083e4){try{jsonpatch['apply'](_0x1083e4,_0x2cdcef,!![]);}catch(_0x498977){return BPromise[_0x9edd('0x1f')](_0x498977);}return _0x1083e4['save']();};}function saveUpdates(_0x27a95a,_0x54a03f){return function(_0x535f37){if(_0x535f37){return _0x535f37[_0x9edd('0x20')](_0x27a95a)[_0x9edd('0x21')](function(_0x4fb7bf){return _0x4fb7bf;});}return null;};}function removeEntity(_0x5823bc,_0x341d67){return function(_0x186186){if(_0x186186){return _0x186186[_0x9edd('0x22')]()['then'](function(){var _0x3741c8=_0x186186[_0x9edd('0x23')]({'plain':!![]});var _0x44a6c1=_0x9edd('0x24');return db[_0x9edd('0x25')]['destroy']({'where':{'type':_0x44a6c1,'resourceId':_0x3741c8['id']}})[_0x9edd('0x21')](function(){return _0x186186;});})[_0x9edd('0x21')](function(){_0x5823bc[_0x9edd('0x18')](0xcc)[_0x9edd('0x19')]();});}};}function handleEntityNotFound(_0x310a4d,_0x4d507f){return function(_0x4b3d1b){if(!_0x4b3d1b){_0x310a4d[_0x9edd('0x17')](0x194);}return _0x4b3d1b;};}function handleError(_0xfeca7b,_0x8d67aa){_0x8d67aa=_0x8d67aa||0x1f4;return function(_0x25e135){logger[_0x9edd('0x26')](_0x25e135['stack']);if(_0x25e135['name']){delete _0x25e135[_0x9edd('0x27')];}_0xfeca7b[_0x9edd('0x18')](_0x8d67aa)[_0x9edd('0x28')](_0x25e135);};}exports['index']=function(_0x238b22,_0x28cfae){var _0x2ae8dd={},_0x41af53={},_0x5eccfb={'count':0x0,'rows':[]};var _0x2155a1=_[_0x9edd('0x29')](db[_0x9edd('0x2a')][_0x9edd('0x2b')],function(_0xbbf08f){return{'name':_0xbbf08f[_0x9edd('0x2c')],'type':_0xbbf08f[_0x9edd('0x2d')][_0x9edd('0x2e')]};});_0x41af53[_0x9edd('0x2f')]=_[_0x9edd('0x29')](_0x2155a1,_0x9edd('0x27'));_0x41af53[_0x9edd('0x30')]=_[_0x9edd('0x31')](_0x238b22[_0x9edd('0x30')]);_0x41af53[_0x9edd('0x32')]=_['intersection'](_0x41af53[_0x9edd('0x2f')],_0x41af53[_0x9edd('0x30')]);_0x2ae8dd[_0x9edd('0x33')]=_['intersection'](_0x41af53[_0x9edd('0x2f')],qs[_0x9edd('0x34')](_0x238b22[_0x9edd('0x30')][_0x9edd('0x34')]));_0x2ae8dd[_0x9edd('0x33')]=_0x2ae8dd[_0x9edd('0x33')][_0x9edd('0x35')]?_0x2ae8dd[_0x9edd('0x33')]:_0x41af53[_0x9edd('0x2f')];if(!_0x238b22[_0x9edd('0x30')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x2ae8dd[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x238b22['query'][_0x9edd('0x1d')]);_0x2ae8dd['offset']=qs[_0x9edd('0x1c')](_0x238b22[_0x9edd('0x30')][_0x9edd('0x1c')]);}_0x2ae8dd[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x238b22['query'][_0x9edd('0x39')]);_0x2ae8dd[_0x9edd('0x3a')]=qs[_0x9edd('0x32')](_[_0x9edd('0x3b')](_0x238b22[_0x9edd('0x30')],_0x41af53[_0x9edd('0x32')]),_0x2155a1);if(_0x238b22[_0x9edd('0x30')][_0x9edd('0x3c')]){_0x2ae8dd[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x2ae8dd['where'],{'$or':_[_0x9edd('0x29')](_0x2155a1,function(_0x56a228){if(_0x56a228[_0x9edd('0x2d')]!=='VIRTUAL'){var _0x30883e={};_0x30883e[_0x56a228[_0x9edd('0x27')]]={'$like':'%'+_0x238b22[_0x9edd('0x30')]['filter']+'%'};return _0x30883e;}})});}_0x2ae8dd=_[_0x9edd('0x3d')]({},_0x2ae8dd,_0x238b22[_0x9edd('0x3e')]);var _0x2f8f61={'where':_0x2ae8dd['where']};return db[_0x9edd('0x2a')]['count'](_0x2f8f61)[_0x9edd('0x21')](function(_0xfbc492){_0x5eccfb['count']=_0xfbc492;if(_0x238b22[_0x9edd('0x30')][_0x9edd('0x3f')]){_0x2ae8dd[_0x9edd('0x40')]=[{'all':!![]}];}return db[_0x9edd('0x2a')]['findAll'](_0x2ae8dd);})[_0x9edd('0x21')](function(_0x5bbdf8){_0x5eccfb[_0x9edd('0x41')]=_0x5bbdf8;return _0x5eccfb;})[_0x9edd('0x21')](respondWithFilteredResult(_0x28cfae,_0x2ae8dd))['catch'](handleError(_0x28cfae,null));};exports[_0x9edd('0x42')]=function(_0x49a128,_0x548299){var _0x369b69={'raw':!![],'where':{'id':_0x49a128[_0x9edd('0x43')]['id']}},_0x9cab86={};_0x9cab86[_0x9edd('0x2f')]=_[_0x9edd('0x31')](db[_0x9edd('0x2a')][_0x9edd('0x2b')]);_0x9cab86[_0x9edd('0x30')]=_[_0x9edd('0x31')](_0x49a128[_0x9edd('0x30')]);_0x9cab86[_0x9edd('0x32')]=_[_0x9edd('0x44')](_0x9cab86[_0x9edd('0x2f')],_0x9cab86[_0x9edd('0x30')]);_0x369b69[_0x9edd('0x33')]=_['intersection'](_0x9cab86[_0x9edd('0x2f')],qs[_0x9edd('0x34')](_0x49a128[_0x9edd('0x30')][_0x9edd('0x34')]));_0x369b69[_0x9edd('0x33')]=_0x369b69[_0x9edd('0x33')][_0x9edd('0x35')]?_0x369b69['attributes']:_0x9cab86['model'];if(_0x49a128['query'][_0x9edd('0x3f')]){_0x369b69['include']=[{'all':!![]}];}_0x369b69=_[_0x9edd('0x3d')]({},_0x369b69,_0x49a128[_0x9edd('0x3e')]);return db[_0x9edd('0x2a')][_0x9edd('0x45')](_0x369b69)[_0x9edd('0x21')](handleEntityNotFound(_0x548299,null))['then'](respondWithResult(_0x548299,null))[_0x9edd('0x46')](handleError(_0x548299,null));};exports[_0x9edd('0x47')]=function(_0x40e33d,_0x4a89ae){return db[_0x9edd('0x2a')][_0x9edd('0x47')](_0x40e33d[_0x9edd('0x48')],{})[_0x9edd('0x21')](function(_0x1d78c4){var _0x35bdec=_0x40e33d['user'][_0x9edd('0x23')]({'plain':!![]});if(!_0x35bdec)throw new Error(_0x9edd('0x49'));if(_0x35bdec['role']===_0x9edd('0x4a')){var _0x8d8701=_0x1d78c4['get']({'plain':!![]});var _0x2bd089=_0x9edd('0x24');return db[_0x9edd('0x4b')]['find']({'where':{'name':_0x2bd089,'userProfileId':_0x35bdec[_0x9edd('0x4c')]},'raw':!![]})[_0x9edd('0x21')](function(_0x317a60){if(_0x317a60&&_0x317a60[_0x9edd('0x4d')]===0x0){return db['UserProfileResource'][_0x9edd('0x47')]({'name':_0x8d8701[_0x9edd('0x27')],'resourceId':_0x8d8701['id'],'type':_0x317a60[_0x9edd('0x27')],'sectionId':_0x317a60['id']},{})['then'](function(){return _0x1d78c4;});}else{return _0x1d78c4;}})[_0x9edd('0x46')](function(_0x21f6ce){logger['error'](_0x9edd('0x4e'),_0x21f6ce);throw _0x21f6ce;});}return _0x1d78c4;})['then'](respondWithResult(_0x4a89ae,0xc9))[_0x9edd('0x46')](handleError(_0x4a89ae,null));};exports[_0x9edd('0x20')]=function(_0x24245f,_0x3fcdf5){if(_0x24245f[_0x9edd('0x48')]['id']){delete _0x24245f[_0x9edd('0x48')]['id'];}return db[_0x9edd('0x2a')][_0x9edd('0x45')]({'where':{'id':_0x24245f[_0x9edd('0x43')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x3fcdf5,null))[_0x9edd('0x21')](saveUpdates(_0x24245f['body'],null))[_0x9edd('0x21')](respondWithResult(_0x3fcdf5,null))[_0x9edd('0x46')](handleError(_0x3fcdf5,null));};exports[_0x9edd('0x22')]=function(_0x58fe29,_0xe96d6a){return db['ContactItemType']['find']({'where':{'id':_0x58fe29['params']['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0xe96d6a,null))[_0x9edd('0x21')](removeEntity(_0xe96d6a,null))[_0x9edd('0x46')](handleError(_0xe96d6a,null));}; \ No newline at end of file +var _0xf3cd=['findAll','rows','catch','keys','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','ContactItemTypes','UserProfileResource','end','name','map','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','where','pick','filter','merge','VIRTUAL','options','ContactItemType','includeAll'];(function(_0xd3cebe,_0x15b670){var _0x373ea8=function(_0x3306a0){while(--_0x3306a0){_0xd3cebe['push'](_0xd3cebe['shift']());}};_0x373ea8(++_0x15b670);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3ad9b3,_0x5c76e9){_0x3ad9b3=_0x3ad9b3-0x0;var _0x4ef8d1=_0xf3cd[_0x3ad9b3];return _0x4ef8d1;};'use strict';var pdf=require(_0xdf3c('0x0'));var emlformat=require(_0xdf3c('0x1'));var rimraf=require(_0xdf3c('0x2'));var zipdir=require(_0xdf3c('0x3'));var jsonpatch=require(_0xdf3c('0x4'));var rp=require(_0xdf3c('0x5'));var moment=require('moment');var BPromise=require(_0xdf3c('0x6'));var Mustache=require(_0xdf3c('0x7'));var util=require(_0xdf3c('0x8'));var path=require('path');var sox=require(_0xdf3c('0x9'));var csv=require(_0xdf3c('0xa'));var ejs=require(_0xdf3c('0xb'));var fs=require('fs');var _=require(_0xdf3c('0xc'));var squel=require(_0xdf3c('0xd'));var crypto=require(_0xdf3c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdf3c('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdf3c('0x10'));var Redis=require(_0xdf3c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdf3c('0x12'));var as=require(_0xdf3c('0x13'));var hardwareService=require(_0xdf3c('0x14'));var logger=require(_0xdf3c('0x15'))(_0xdf3c('0x16'));var utils=require(_0xdf3c('0x17'));var config=require(_0xdf3c('0x18'));var db=require(_0xdf3c('0x19'))['db'];function respondWithStatusCode(_0x5e8925,_0x1d483c){_0x1d483c=_0x1d483c||0xcc;return function(_0x166ae5){if(_0x166ae5){return _0x5e8925[_0xdf3c('0x1a')](_0x1d483c);}return _0x5e8925[_0xdf3c('0x1b')](_0x1d483c)['end']();};}function respondWithResult(_0x2ae4ad,_0x461079){_0x461079=_0x461079||0xc8;return function(_0x13ea5f){if(_0x13ea5f){return _0x2ae4ad['status'](_0x461079)[_0xdf3c('0x1c')](_0x13ea5f);}};}function respondWithFilteredResult(_0x38b01d,_0x173041){return function(_0x4274fd){if(_0x4274fd){var _0x21e587=_0x4274fd[_0xdf3c('0x1d')],_0x1a7a5a=_0x173041[_0xdf3c('0x1e')],_0x305ea5=_0x173041['offset']+_0x173041[_0xdf3c('0x1f')],_0x92008b;if(_0x305ea5>=_0x21e587){_0x305ea5=_0x21e587;_0x92008b=0xc8;}else{_0x92008b=0xce;}_0x38b01d[_0xdf3c('0x1b')](_0x92008b);return _0x38b01d[_0xdf3c('0x20')](_0xdf3c('0x21'),_0x1a7a5a+'-'+_0x305ea5+'/'+_0x21e587)[_0xdf3c('0x1c')](_0x4274fd);}return null;};}function patchUpdates(_0x113b56){return function(_0x16b02b){try{jsonpatch[_0xdf3c('0x22')](_0x16b02b,_0x113b56,!![]);}catch(_0x426f3a){return BPromise[_0xdf3c('0x23')](_0x426f3a);}return _0x16b02b[_0xdf3c('0x24')]();};}function saveUpdates(_0x3d14cc,_0x25487c){return function(_0x5d2390){if(_0x5d2390){return _0x5d2390['update'](_0x3d14cc)[_0xdf3c('0x25')](function(_0x583ce4){return _0x583ce4;});}return null;};}function removeEntity(_0x15776c,_0x40e7ec){return function(_0x36552e){if(_0x36552e){return _0x36552e[_0xdf3c('0x26')]()[_0xdf3c('0x25')](function(){var _0x36ba1c=_0x36552e['get']({'plain':!![]});var _0x22a164=_0xdf3c('0x27');return db[_0xdf3c('0x28')][_0xdf3c('0x26')]({'where':{'type':_0x22a164,'resourceId':_0x36ba1c['id']}})[_0xdf3c('0x25')](function(){return _0x36552e;});})[_0xdf3c('0x25')](function(){_0x15776c[_0xdf3c('0x1b')](0xcc)[_0xdf3c('0x29')]();});}};}function handleEntityNotFound(_0x18cb46,_0x1adee4){return function(_0x4c076c){if(!_0x4c076c){_0x18cb46[_0xdf3c('0x1a')](0x194);}return _0x4c076c;};}function handleError(_0x153daa,_0x4b57a4){_0x4b57a4=_0x4b57a4||0x1f4;return function(_0xdc8962){logger['error'](_0xdc8962['stack']);if(_0xdc8962['name']){delete _0xdc8962[_0xdf3c('0x2a')];}_0x153daa[_0xdf3c('0x1b')](_0x4b57a4)['send'](_0xdc8962);};}exports['index']=function(_0x37ecfd,_0x1f2ce4){var _0xd3cfcb={},_0x1ccdd4={},_0x5c98a2={'count':0x0,'rows':[]};var _0x43ce06=_[_0xdf3c('0x2b')](db['ContactItemType']['rawAttributes'],function(_0x1f1d8a){return{'name':_0x1f1d8a[_0xdf3c('0x2c')],'type':_0x1f1d8a[_0xdf3c('0x2d')]['key']};});_0x1ccdd4[_0xdf3c('0x2e')]=_[_0xdf3c('0x2b')](_0x43ce06,_0xdf3c('0x2a'));_0x1ccdd4[_0xdf3c('0x2f')]=_['keys'](_0x37ecfd[_0xdf3c('0x2f')]);_0x1ccdd4[_0xdf3c('0x30')]=_['intersection'](_0x1ccdd4[_0xdf3c('0x2e')],_0x1ccdd4[_0xdf3c('0x2f')]);_0xd3cfcb[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x1ccdd4['model'],qs[_0xdf3c('0x33')](_0x37ecfd[_0xdf3c('0x2f')][_0xdf3c('0x33')]));_0xd3cfcb[_0xdf3c('0x31')]=_0xd3cfcb['attributes'][_0xdf3c('0x34')]?_0xd3cfcb[_0xdf3c('0x31')]:_0x1ccdd4['model'];if(!_0x37ecfd['query'][_0xdf3c('0x35')]('nolimit')){_0xd3cfcb[_0xdf3c('0x1f')]=qs['limit'](_0x37ecfd['query']['limit']);_0xd3cfcb[_0xdf3c('0x1e')]=qs[_0xdf3c('0x1e')](_0x37ecfd[_0xdf3c('0x2f')][_0xdf3c('0x1e')]);}_0xd3cfcb['order']=qs['sort'](_0x37ecfd[_0xdf3c('0x2f')]['sort']);_0xd3cfcb[_0xdf3c('0x36')]=qs[_0xdf3c('0x30')](_[_0xdf3c('0x37')](_0x37ecfd[_0xdf3c('0x2f')],_0x1ccdd4[_0xdf3c('0x30')]),_0x43ce06);if(_0x37ecfd[_0xdf3c('0x2f')][_0xdf3c('0x38')]){_0xd3cfcb[_0xdf3c('0x36')]=_[_0xdf3c('0x39')](_0xd3cfcb['where'],{'$or':_[_0xdf3c('0x2b')](_0x43ce06,function(_0x54e689){if(_0x54e689['type']!==_0xdf3c('0x3a')){var _0x47f760={};_0x47f760[_0x54e689[_0xdf3c('0x2a')]]={'$like':'%'+_0x37ecfd['query'][_0xdf3c('0x38')]+'%'};return _0x47f760;}})});}_0xd3cfcb=_[_0xdf3c('0x39')]({},_0xd3cfcb,_0x37ecfd[_0xdf3c('0x3b')]);var _0x1349a4={'where':_0xd3cfcb[_0xdf3c('0x36')]};return db[_0xdf3c('0x3c')][_0xdf3c('0x1d')](_0x1349a4)[_0xdf3c('0x25')](function(_0x3cf131){_0x5c98a2[_0xdf3c('0x1d')]=_0x3cf131;if(_0x37ecfd[_0xdf3c('0x2f')][_0xdf3c('0x3d')]){_0xd3cfcb['include']=[{'all':!![]}];}return db['ContactItemType'][_0xdf3c('0x3e')](_0xd3cfcb);})['then'](function(_0x3a6527){_0x5c98a2[_0xdf3c('0x3f')]=_0x3a6527;return _0x5c98a2;})[_0xdf3c('0x25')](respondWithFilteredResult(_0x1f2ce4,_0xd3cfcb))[_0xdf3c('0x40')](handleError(_0x1f2ce4,null));};exports['show']=function(_0x563d31,_0x335c1b){var _0x33edab={'raw':!![],'where':{'id':_0x563d31['params']['id']}},_0x106975={};_0x106975[_0xdf3c('0x2e')]=_[_0xdf3c('0x41')](db[_0xdf3c('0x3c')][_0xdf3c('0x42')]);_0x106975['query']=_[_0xdf3c('0x41')](_0x563d31[_0xdf3c('0x2f')]);_0x106975[_0xdf3c('0x30')]=_[_0xdf3c('0x32')](_0x106975[_0xdf3c('0x2e')],_0x106975['query']);_0x33edab[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x106975[_0xdf3c('0x2e')],qs[_0xdf3c('0x33')](_0x563d31[_0xdf3c('0x2f')][_0xdf3c('0x33')]));_0x33edab['attributes']=_0x33edab['attributes'][_0xdf3c('0x34')]?_0x33edab[_0xdf3c('0x31')]:_0x106975['model'];if(_0x563d31['query'][_0xdf3c('0x3d')]){_0x33edab[_0xdf3c('0x43')]=[{'all':!![]}];}_0x33edab=_[_0xdf3c('0x39')]({},_0x33edab,_0x563d31[_0xdf3c('0x3b')]);return db[_0xdf3c('0x3c')][_0xdf3c('0x44')](_0x33edab)[_0xdf3c('0x25')](handleEntityNotFound(_0x335c1b,null))[_0xdf3c('0x25')](respondWithResult(_0x335c1b,null))[_0xdf3c('0x40')](handleError(_0x335c1b,null));};exports['create']=function(_0x129c2a,_0x2cfdb2){return db[_0xdf3c('0x3c')][_0xdf3c('0x45')](_0x129c2a[_0xdf3c('0x46')],{})[_0xdf3c('0x25')](function(_0x28a468){var _0x553f70=_0x129c2a[_0xdf3c('0x47')]['get']({'plain':!![]});if(!_0x553f70)throw new Error(_0xdf3c('0x48'));if(_0x553f70['role']===_0xdf3c('0x47')){var _0x28144f=_0x28a468[_0xdf3c('0x49')]({'plain':!![]});var _0x94c5b9='ContactItemTypes';return db['UserProfileSection']['find']({'where':{'name':_0x94c5b9,'userProfileId':_0x553f70[_0xdf3c('0x4a')]},'raw':!![]})['then'](function(_0x31c600){if(_0x31c600&&_0x31c600[_0xdf3c('0x4b')]===0x0){return db[_0xdf3c('0x28')][_0xdf3c('0x45')]({'name':_0x28144f[_0xdf3c('0x2a')],'resourceId':_0x28144f['id'],'type':_0x31c600['name'],'sectionId':_0x31c600['id']},{})['then'](function(){return _0x28a468;});}else{return _0x28a468;}})[_0xdf3c('0x40')](function(_0x27a541){logger['error'](_0xdf3c('0x4c'),_0x27a541);throw _0x27a541;});}return _0x28a468;})[_0xdf3c('0x25')](respondWithResult(_0x2cfdb2,0xc9))[_0xdf3c('0x40')](handleError(_0x2cfdb2,null));};exports[_0xdf3c('0x4d')]=function(_0x38de63,_0x46dfb1){if(_0x38de63[_0xdf3c('0x46')]['id']){delete _0x38de63['body']['id'];}return db['ContactItemType'][_0xdf3c('0x44')]({'where':{'id':_0x38de63[_0xdf3c('0x4e')]['id']}})[_0xdf3c('0x25')](handleEntityNotFound(_0x46dfb1,null))[_0xdf3c('0x25')](saveUpdates(_0x38de63[_0xdf3c('0x46')],null))[_0xdf3c('0x25')](respondWithResult(_0x46dfb1,null))[_0xdf3c('0x40')](handleError(_0x46dfb1,null));};exports[_0xdf3c('0x26')]=function(_0x143d01,_0x31624a){return db[_0xdf3c('0x3c')]['find']({'where':{'id':_0x143d01[_0xdf3c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x31624a,null))['then'](removeEntity(_0x31624a,null))['catch'](handleError(_0x31624a,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 23b827b..8ede58d 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb091=['moment','request-promise','../../config/environment','./contactItemType.attributes','define','tools_contact_item_types','util','../../config/logger','api'];(function(_0x5853d6,_0x4d1dba){var _0xac5624=function(_0x686a49){while(--_0x686a49){_0x5853d6['push'](_0x5853d6['shift']());}};_0xac5624(++_0x4d1dba);}(_0xb091,0x16e));var _0x1b09=function(_0x40e9c8,_0x466e65){_0x40e9c8=_0x40e9c8-0x0;var _0x386669=_0xb091[_0x40e9c8];return _0x386669;};'use strict';var _=require('lodash');var util=require(_0x1b09('0x0'));var logger=require(_0x1b09('0x1'))(_0x1b09('0x2'));var moment=require(_0x1b09('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b09('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b09('0x5'));var attributes=require(_0x1b09('0x6'));module['exports']=function(_0xda8caa,_0x5fa348){return _0xda8caa[_0x1b09('0x7')]('ContactItemType',attributes,{'tableName':_0x1b09('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3dd6=['request-promise','path','rimraf','./contactItemType.attributes','define','ContactItemType','tools_contact_item_types','api','moment','bluebird'];(function(_0x377c53,_0x526c6c){var _0xb34630=function(_0x43f0d2){while(--_0x43f0d2){_0x377c53['push'](_0x377c53['shift']());}};_0xb34630(++_0x526c6c);}(_0x3dd6,0xcf));var _0x63dd=function(_0x32e8f2,_0x33cff3){_0x32e8f2=_0x32e8f2-0x0;var _0xefd2e6=_0x3dd6[_0x32e8f2];return _0xefd2e6;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x63dd('0x0'));var moment=require(_0x63dd('0x1'));var BPromise=require(_0x63dd('0x2'));var rp=require(_0x63dd('0x3'));var fs=require('fs');var path=require(_0x63dd('0x4'));var rimraf=require(_0x63dd('0x5'));var config=require('../../config/environment');var attributes=require(_0x63dd('0x6'));module['exports']=function(_0x32bad9,_0xf7e03e){return _0x32bad9[_0x63dd('0x7')](_0x63dd('0x8'),attributes,{'tableName':_0x63dd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index bf553b7..fd10cf4 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb201=['rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','error','code','ContactItemType,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4bdda0,_0x34f799){var _0x558fff=function(_0x2f3592){while(--_0x2f3592){_0x4bdda0['push'](_0x4bdda0['shift']());}};_0x558fff(++_0x34f799);}(_0xb201,0x1b1));var _0x1b20=function(_0x1227c6,_0x4bc155){_0x1227c6=_0x1227c6-0x0;var _0xcdd4d8=_0xb201[_0x1227c6];return _0xcdd4d8;};'use strict';var _=require(_0x1b20('0x0'));var util=require('util');var moment=require(_0x1b20('0x1'));var BPromise=require(_0x1b20('0x2'));var rs=require(_0x1b20('0x3'));var fs=require('fs');var Redis=require(_0x1b20('0x4'));var db=require(_0x1b20('0x5'))['db'];var utils=require(_0x1b20('0x6'));var logger=require('../../config/logger')(_0x1b20('0x7'));var config=require(_0x1b20('0x8'));var jayson=require(_0x1b20('0x9'));var client=jayson['client'][_0x1b20('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50cdbc,_0x34304b,_0x2a184f){return new BPromise(function(_0x3cc600,_0x426ae9){return client['request'](_0x50cdbc,_0x2a184f)[_0x1b20('0xb')](function(_0x1f5ae4){logger[_0x1b20('0xc')]('ContactItemType,\x20%s,\x20%s',_0x34304b,_0x1b20('0xd'));logger['debug'](_0x1b20('0xe'),_0x34304b,'request\x20sent',JSON['stringify'](_0x1f5ae4));if(_0x1f5ae4[_0x1b20('0xf')]){if(_0x1f5ae4[_0x1b20('0xf')][_0x1b20('0x10')]===0x1f4){logger[_0x1b20('0xf')](_0x1b20('0x11'),_0x34304b,_0x1f5ae4['error'][_0x1b20('0x12')]);return _0x426ae9(_0x1f5ae4[_0x1b20('0xf')][_0x1b20('0x12')]);}logger[_0x1b20('0xf')](_0x1b20('0x11'),_0x34304b,_0x1f5ae4['error'][_0x1b20('0x12')]);return _0x3cc600(_0x1f5ae4[_0x1b20('0xf')][_0x1b20('0x12')]);}else{logger['info'](_0x1b20('0x11'),_0x34304b,'request\x20sent');_0x3cc600(_0x1f5ae4[_0x1b20('0x13')][_0x1b20('0x12')]);}})['catch'](function(_0x44e713){logger[_0x1b20('0xf')](_0x1b20('0x11'),_0x34304b,_0x44e713);_0x426ae9(_0x44e713);});});} \ No newline at end of file +var _0x0439=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x5cdca0,_0x242f29){var _0xcdc240=function(_0x28f168){while(--_0x28f168){_0x5cdca0['push'](_0x5cdca0['shift']());}};_0xcdc240(++_0x242f29);}(_0x0439,0xdd));var _0x9043=function(_0x4e1a49,_0x4da738){_0x4e1a49=_0x4e1a49-0x0;var _0x136aae=_0x0439[_0x4e1a49];return _0x136aae;};'use strict';var _=require(_0x9043('0x0'));var util=require(_0x9043('0x1'));var moment=require(_0x9043('0x2'));var BPromise=require(_0x9043('0x3'));var rs=require(_0x9043('0x4'));var fs=require('fs');var Redis=require(_0x9043('0x5'));var db=require(_0x9043('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9043('0x7'))(_0x9043('0x8'));var config=require(_0x9043('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9043('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f79c2,_0x2fe4da,_0x19bf02){return new BPromise(function(_0x5bea98,_0x135a40){return client['request'](_0x4f79c2,_0x19bf02)[_0x9043('0xb')](function(_0x36a5cb){logger['info'](_0x9043('0xc'),_0x2fe4da,_0x9043('0xd'));logger[_0x9043('0xe')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x2fe4da,'request\x20sent',JSON[_0x9043('0xf')](_0x36a5cb));if(_0x36a5cb[_0x9043('0x10')]){if(_0x36a5cb['error'][_0x9043('0x11')]===0x1f4){logger[_0x9043('0x10')](_0x9043('0xc'),_0x2fe4da,_0x36a5cb[_0x9043('0x10')][_0x9043('0x12')]);return _0x135a40(_0x36a5cb[_0x9043('0x10')]['message']);}logger[_0x9043('0x10')](_0x9043('0xc'),_0x2fe4da,_0x36a5cb['error'][_0x9043('0x12')]);return _0x5bea98(_0x36a5cb[_0x9043('0x10')]['message']);}else{logger[_0x9043('0x13')](_0x9043('0xc'),_0x2fe4da,_0x9043('0xd'));_0x5bea98(_0x36a5cb[_0x9043('0x14')][_0x9043('0x12')]);}})[_0x9043('0x15')](function(_0x13b613){logger[_0x9043('0x10')](_0x9043('0xc'),_0x2fe4da,_0x13b613);_0x135a40(_0x13b613);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index c93420a..1a5cb48 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9853=['connect-timeout','Router','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','create','put','update','delete','destroy','util','path'];(function(_0x4bbd99,_0x53aa06){var _0x4011e9=function(_0xeea628){while(--_0xeea628){_0x4bbd99['push'](_0x4bbd99['shift']());}};_0x4011e9(++_0x53aa06);}(_0x9853,0x148));var _0x3985=function(_0x8dc04d,_0xaa7559){_0x8dc04d=_0x8dc04d-0x0;var _0x2f5f28=_0x9853[_0x8dc04d];return _0x2f5f28;};'use strict';var multer=require('multer');var util=require(_0x3985('0x0'));var path=require(_0x3985('0x1'));var timeout=require(_0x3985('0x2'));var express=require('express');var router=express[_0x3985('0x3')]();var auth=require(_0x3985('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3985('0x5'));var controller=require('./contactItemType.controller');router[_0x3985('0x6')]('/',auth['isAuthenticated'](),controller[_0x3985('0x7')]);router['get'](_0x3985('0x8'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x3985('0x9')](),controller[_0x3985('0xa')]);router[_0x3985('0xb')](_0x3985('0x8'),auth[_0x3985('0x9')](),controller[_0x3985('0xc')]);router[_0x3985('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x3985('0xe')]);module['exports']=router; \ No newline at end of file +var _0x34ef=['/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','../../config/environment','./contactItemType.controller','get','index','isAuthenticated','post','create','put'];(function(_0xb75b5b,_0x3e79e0){var _0x4b6d76=function(_0x19b3fa){while(--_0x19b3fa){_0xb75b5b['push'](_0xb75b5b['shift']());}};_0x4b6d76(++_0x3e79e0);}(_0x34ef,0xc0));var _0xf34e=function(_0x428bcb,_0x2e5365){_0x428bcb=_0x428bcb-0x0;var _0x2bbd41=_0x34ef[_0x428bcb];return _0x2bbd41;};'use strict';var multer=require(_0xf34e('0x0'));var util=require('util');var path=require(_0xf34e('0x1'));var timeout=require(_0xf34e('0x2'));var express=require(_0xf34e('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf34e('0x4'));var controller=require(_0xf34e('0x5'));router[_0xf34e('0x6')]('/',auth['isAuthenticated'](),controller[_0xf34e('0x7')]);router['get']('/:id',auth[_0xf34e('0x8')](),controller['show']);router[_0xf34e('0x9')]('/',auth[_0xf34e('0x8')](),controller[_0xf34e('0xa')]);router[_0xf34e('0xb')](_0xf34e('0xc'),auth[_0xf34e('0x8')](),controller[_0xf34e('0xd')]);router[_0xf34e('0xe')](_0xf34e('0xc'),auth[_0xf34e('0x8')](),controller[_0xf34e('0xf')]);module[_0xf34e('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 636952f..f78ba4f 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 _0x0d64=['STRING','name','sequelize'];(function(_0x358938,_0x42b23d){var _0xfeda46=function(_0x4155a6){while(--_0x4155a6){_0x358938['push'](_0x358938['shift']());}};_0xfeda46(++_0x42b23d);}(_0x0d64,0x77));var _0x40d6=function(_0xef9edb,_0x406d7b){_0xef9edb=_0xef9edb-0x0;var _0x3583e3=_0x0d64[_0xef9edb];return _0x3583e3;};'use strict';var Sequelize=require(_0x40d6('0x0'));module['exports']={'name':{'type':Sequelize[_0x40d6('0x1')],'allowNull':![],'unique':_0x40d6('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0e6a=['name','exports','STRING'];(function(_0x6e4f10,_0x649a11){var _0x280287=function(_0x1f8346){while(--_0x1f8346){_0x6e4f10['push'](_0x6e4f10['shift']());}};_0x280287(++_0x649a11);}(_0x0e6a,0x100));var _0xa0e6=function(_0x3a3b6a,_0x51e1e5){_0x3a3b6a=_0x3a3b6a-0x0;var _0x2c5061=_0x0e6a[_0x3a3b6a];return _0x2c5061;};'use strict';var Sequelize=require('sequelize');module[_0xa0e6('0x0')]={'name':{'type':Sequelize[_0xa0e6('0x1')],'allowNull':![],'unique':_0xa0e6('0x2')},'description':{'type':Sequelize[_0xa0e6('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 152f389..5522034 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 _0xd86e=['options','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','error','clone','find','omit','updatedAt','createdAt','create','role','autoAssociation','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','filter','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./dashboard.socket','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','CustomDashboards','UserProfileResource','end','name','index','map','Dashboard','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL'];(function(_0x10a187,_0xd916cd){var _0x505e94=function(_0x351e24){while(--_0x351e24){_0x10a187['push'](_0x10a187['shift']());}};_0x505e94(++_0xd916cd);}(_0xd86e,0x125));var _0xed86=function(_0x5ec64b,_0x30a4d6){_0x5ec64b=_0x5ec64b-0x0;var _0x113c36=_0xd86e[_0x5ec64b];return _0x113c36;};'use strict';var pdf=require(_0xed86('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xed86('0x1'));var zipdir=require(_0xed86('0x2'));var jsonpatch=require(_0xed86('0x3'));var rp=require(_0xed86('0x4'));var moment=require('moment');var BPromise=require(_0xed86('0x5'));var Mustache=require(_0xed86('0x6'));var util=require(_0xed86('0x7'));var path=require(_0xed86('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xed86('0x9'));var fs=require('fs');var _=require(_0xed86('0xa'));var squel=require('squel');var crypto=require(_0xed86('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xed86('0xc'));var authService=require(_0xed86('0xd'));var qs=require(_0xed86('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xed86('0xf'));var logger=require('../../config/logger')(_0xed86('0x10'));var utils=require(_0xed86('0x11'));var config=require(_0xed86('0x12'));var db=require('../../mysqldb')['db'];config[_0xed86('0x13')]=_[_0xed86('0x14')](config[_0xed86('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0xed86('0x15'))(new Redis(config[_0xed86('0x13')]));require(_0xed86('0x16'))['register'](socket);function respondWithStatusCode(_0x369da1,_0x37b100){_0x37b100=_0x37b100||0xcc;return function(_0x3b2adc){if(_0x3b2adc){return _0x369da1[_0xed86('0x17')](_0x37b100);}return _0x369da1[_0xed86('0x18')](_0x37b100)['end']();};}function respondWithResult(_0x18e039,_0x28b503){_0x28b503=_0x28b503||0xc8;return function(_0x13d45b){if(_0x13d45b){return _0x18e039[_0xed86('0x18')](_0x28b503)['json'](_0x13d45b);}};}function respondWithFilteredResult(_0x9cca6,_0x3cb773){return function(_0x3dcb9e){if(_0x3dcb9e){var _0x397443=_0x3dcb9e['count'],_0x44b3fc=_0x3cb773[_0xed86('0x19')],_0x2ddb15=_0x3cb773[_0xed86('0x19')]+_0x3cb773[_0xed86('0x1a')],_0xcd51ec;if(_0x2ddb15>=_0x397443){_0x2ddb15=_0x397443;_0xcd51ec=0xc8;}else{_0xcd51ec=0xce;}_0x9cca6['status'](_0xcd51ec);return _0x9cca6[_0xed86('0x1b')](_0xed86('0x1c'),_0x44b3fc+'-'+_0x2ddb15+'/'+_0x397443)[_0xed86('0x1d')](_0x3dcb9e);}return null;};}function patchUpdates(_0x525041){return function(_0x1a3606){try{jsonpatch[_0xed86('0x1e')](_0x1a3606,_0x525041,!![]);}catch(_0x5d6e3c){return BPromise[_0xed86('0x1f')](_0x5d6e3c);}return _0x1a3606['save']();};}function saveUpdates(_0x5eb8ad,_0x194b70){return function(_0x27f78b){if(_0x27f78b){return _0x27f78b[_0xed86('0x20')](_0x5eb8ad)[_0xed86('0x21')](function(_0x486878){return _0x486878;});}return null;};}function removeEntity(_0x34ffb8,_0x7fe4d3){return function(_0x57dcfb){if(_0x57dcfb){return _0x57dcfb[_0xed86('0x22')]()[_0xed86('0x21')](function(){var _0xae2526=_0x57dcfb[_0xed86('0x23')]({'plain':!![]});var _0x21c7fc=_0xed86('0x24');return db[_0xed86('0x25')][_0xed86('0x22')]({'where':{'type':_0x21c7fc,'resourceId':_0xae2526['id']}})[_0xed86('0x21')](function(){return _0x57dcfb;});})['then'](function(){_0x34ffb8['status'](0xcc)[_0xed86('0x26')]();});}};}function handleEntityNotFound(_0x18a851,_0x1e82cf){return function(_0x1ed527){if(!_0x1ed527){_0x18a851[_0xed86('0x17')](0x194);}return _0x1ed527;};}function handleError(_0x54d547,_0x2e7242){_0x2e7242=_0x2e7242||0x1f4;return function(_0x3e737f){logger['error'](_0x3e737f['stack']);if(_0x3e737f[_0xed86('0x27')]){delete _0x3e737f['name'];}_0x54d547[_0xed86('0x18')](_0x2e7242)['send'](_0x3e737f);};}exports[_0xed86('0x28')]=function(_0x172b23,_0x79453f){var _0x285128={},_0x282527={},_0x4f25d5={'count':0x0,'rows':[]};var _0x6bd623=_[_0xed86('0x29')](db[_0xed86('0x2a')]['rawAttributes'],function(_0x5ed629){return{'name':_0x5ed629[_0xed86('0x2b')],'type':_0x5ed629[_0xed86('0x2c')][_0xed86('0x2d')]};});_0x282527[_0xed86('0x2e')]=_[_0xed86('0x29')](_0x6bd623,'name');_0x282527[_0xed86('0x2f')]=_['keys'](_0x172b23[_0xed86('0x2f')]);_0x282527['filters']=_[_0xed86('0x30')](_0x282527[_0xed86('0x2e')],_0x282527[_0xed86('0x2f')]);_0x285128[_0xed86('0x31')]=_[_0xed86('0x30')](_0x282527[_0xed86('0x2e')],qs['fields'](_0x172b23[_0xed86('0x2f')][_0xed86('0x32')]));_0x285128[_0xed86('0x31')]=_0x285128['attributes'][_0xed86('0x33')]?_0x285128['attributes']:_0x282527[_0xed86('0x2e')];if(!_0x172b23['query'][_0xed86('0x34')](_0xed86('0x35'))){_0x285128['limit']=qs['limit'](_0x172b23['query'][_0xed86('0x1a')]);_0x285128[_0xed86('0x19')]=qs[_0xed86('0x19')](_0x172b23[_0xed86('0x2f')][_0xed86('0x19')]);}_0x285128[_0xed86('0x36')]=qs[_0xed86('0x37')](_0x172b23[_0xed86('0x2f')][_0xed86('0x37')]);_0x285128[_0xed86('0x38')]=qs[_0xed86('0x39')](_[_0xed86('0x3a')](_0x172b23[_0xed86('0x2f')],_0x282527[_0xed86('0x39')]),_0x6bd623);if(_0x172b23['query']['filter']){_0x285128[_0xed86('0x38')]=_[_0xed86('0x3b')](_0x285128[_0xed86('0x38')],{'$or':_['map'](_0x6bd623,function(_0x33347b){if(_0x33347b[_0xed86('0x2c')]!==_0xed86('0x3c')){var _0xfb37f9={};_0xfb37f9[_0x33347b['name']]={'$like':'%'+_0x172b23['query']['filter']+'%'};return _0xfb37f9;}})});}_0x285128=_[_0xed86('0x3b')]({},_0x285128,_0x172b23[_0xed86('0x3d')]);var _0x388e9f={'where':_0x285128[_0xed86('0x38')]};return db[_0xed86('0x2a')]['count'](_0x388e9f)['then'](function(_0x522eee){_0x4f25d5[_0xed86('0x3e')]=_0x522eee;if(_0x172b23['query'][_0xed86('0x3f')]){_0x285128[_0xed86('0x40')]=[{'all':!![]}];}return db['Dashboard'][_0xed86('0x41')](_0x285128);})['then'](function(_0x58af9a){_0x4f25d5[_0xed86('0x42')]=_0x58af9a;return _0x4f25d5;})[_0xed86('0x21')](respondWithFilteredResult(_0x79453f,_0x285128))[_0xed86('0x43')](handleError(_0x79453f,null));};exports[_0xed86('0x44')]=function(_0x41eddd,_0x379190){var _0x5eaa91={'raw':![],'where':{'id':_0x41eddd[_0xed86('0x45')]['id']}},_0x14fa43={};_0x14fa43['model']=_[_0xed86('0x46')](db[_0xed86('0x2a')][_0xed86('0x47')]);_0x14fa43[_0xed86('0x2f')]=_[_0xed86('0x46')](_0x41eddd['query']);_0x14fa43[_0xed86('0x39')]=_['intersection'](_0x14fa43['model'],_0x14fa43[_0xed86('0x2f')]);_0x5eaa91[_0xed86('0x31')]=_[_0xed86('0x30')](_0x14fa43[_0xed86('0x2e')],qs[_0xed86('0x32')](_0x41eddd['query'][_0xed86('0x32')]));_0x5eaa91[_0xed86('0x31')]=_0x5eaa91[_0xed86('0x31')][_0xed86('0x33')]?_0x5eaa91[_0xed86('0x31')]:_0x14fa43[_0xed86('0x2e')];if(_0x41eddd[_0xed86('0x2f')][_0xed86('0x3f')]){_0x5eaa91[_0xed86('0x40')]=[{'all':!![]}];}_0x5eaa91=_['merge']({},_0x5eaa91,_0x41eddd[_0xed86('0x3d')]);return db[_0xed86('0x2a')]['find'](_0x5eaa91)[_0xed86('0x21')](handleEntityNotFound(_0x379190,null))[_0xed86('0x21')](respondWithResult(_0x379190,null))[_0xed86('0x43')](handleError(_0x379190,null));};exports['create']=function(_0x224782,_0x33ecd9){return db[_0xed86('0x2a')]['create'](_0x224782[_0xed86('0x48')],{})[_0xed86('0x21')](function(_0x3fc695){var _0x116cdd=_0x224782['user'][_0xed86('0x23')]({'plain':!![]});if(!_0x116cdd)throw new Error(_0xed86('0x49'));if(_0x116cdd['role']===_0xed86('0x4a')){var _0x2a685a=_0x3fc695[_0xed86('0x23')]({'plain':!![]});var _0x125669=_0xed86('0x24');return db[_0xed86('0x4b')]['find']({'where':{'name':_0x125669,'userProfileId':_0x116cdd[_0xed86('0x4c')]},'raw':!![]})[_0xed86('0x21')](function(_0x4c5bb2){if(_0x4c5bb2&&_0x4c5bb2['autoAssociation']===0x0){return db[_0xed86('0x25')]['create']({'name':_0x2a685a[_0xed86('0x27')],'resourceId':_0x2a685a['id'],'type':_0x4c5bb2[_0xed86('0x27')],'sectionId':_0x4c5bb2['id']},{})[_0xed86('0x21')](function(){return _0x3fc695;});}else{return _0x3fc695;}})[_0xed86('0x43')](function(_0x162c0a){logger[_0xed86('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x162c0a);throw _0x162c0a;});}return _0x3fc695;})[_0xed86('0x21')](respondWithResult(_0x33ecd9,0xc9))[_0xed86('0x43')](handleError(_0x33ecd9,null));};exports[_0xed86('0x4e')]=function(_0x2c81bc,_0x1ca57d){var _0x1138c9={'where':{'id':_0x2c81bc[_0xed86('0x45')]['id']}},_0x7a11de={};_0x7a11de['model']=_[_0xed86('0x46')](db[_0xed86('0x2a')]['rawAttributes']);_0x1138c9['attributes']=_[_0xed86('0x30')](_0x7a11de[_0xed86('0x2e')],qs['fields'](_0x2c81bc[_0xed86('0x2f')]['fields']));_0x1138c9['attributes']=_0x1138c9[_0xed86('0x31')][_0xed86('0x33')]?_0x1138c9[_0xed86('0x31')]:_0x7a11de['model'];if(_0x2c81bc[_0xed86('0x2f')][_0xed86('0x3f')]){_0x1138c9[_0xed86('0x40')]=[{'all':!![]}];}_0x1138c9=_[_0xed86('0x3b')]({},_0x1138c9,_0x2c81bc[_0xed86('0x3d')]);return db['Dashboard'][_0xed86('0x4f')](_0x1138c9)[_0xed86('0x21')](handleEntityNotFound(_0x1ca57d,null))[_0xed86('0x21')](function(_0x35d1ee){if(_0x35d1ee){var _0x2e5a32=_0x35d1ee[_0xed86('0x23')]({'plain':!![]});_0x2e5a32=qs[_0xed86('0x50')](_0x2e5a32,['id','createdAt',_0xed86('0x51')]);_0x2c81bc[_0xed86('0x48')]=_[_0xed86('0x50')](_0x2c81bc[_0xed86('0x48')],['id',_0xed86('0x52'),_0xed86('0x51')]);return db['Dashboard'][_0xed86('0x53')](_['merge'](_0x2e5a32,_0x2c81bc[_0xed86('0x48')]),{'include':_0x2c81bc[_0xed86('0x2f')][_0xed86('0x3f')]?[{'all':!![]}]:undefined})[_0xed86('0x21')](function(_0x25cf60){var _0x525841=_0x2c81bc[_0xed86('0x4a')][_0xed86('0x23')]({'plain':!![]});if(!_0x525841)throw new Error(_0xed86('0x49'));if(_0x525841[_0xed86('0x54')]===_0xed86('0x4a')){var _0x3010c1=_0x25cf60[_0xed86('0x23')]({'plain':!![]});var _0x27efc6=_0xed86('0x24');return db[_0xed86('0x4b')][_0xed86('0x4f')]({'where':{'name':_0x27efc6,'userProfileId':_0x525841[_0xed86('0x4c')]},'raw':!![]})[_0xed86('0x21')](function(_0x3b2e41){if(_0x3b2e41&&_0x3b2e41[_0xed86('0x55')]===0x0){return db[_0xed86('0x25')]['create']({'name':_0x3010c1[_0xed86('0x27')],'resourceId':_0x3010c1['id'],'type':_0x3b2e41['name'],'sectionId':_0x3b2e41['id']},{})[_0xed86('0x21')](function(){return _0x25cf60;});}else{return _0x25cf60;}})[_0xed86('0x43')](function(_0x3ec544){logger[_0xed86('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ec544);throw _0x3ec544;});}return _0x25cf60;});}})[_0xed86('0x21')](respondWithResult(_0x1ca57d,0xc9))[_0xed86('0x43')](handleError(_0x1ca57d,null));};exports['update']=function(_0x162261,_0x47607b){if(_0x162261[_0xed86('0x48')]['id']){delete _0x162261[_0xed86('0x48')]['id'];}return db[_0xed86('0x2a')][_0xed86('0x4f')]({'where':{'id':_0x162261[_0xed86('0x45')]['id']}})['then'](handleEntityNotFound(_0x47607b,null))[_0xed86('0x21')](saveUpdates(_0x162261['body'],null))[_0xed86('0x21')](respondWithResult(_0x47607b,null))[_0xed86('0x43')](handleError(_0x47607b,null));};exports['destroy']=function(_0x67d0ab,_0x80f818){return db[_0xed86('0x2a')][_0xed86('0x4f')]({'where':{'id':_0x67d0ab[_0xed86('0x45')]['id']}})[_0xed86('0x21')](handleEntityNotFound(_0x80f818,null))[_0xed86('0x21')](removeEntity(_0x80f818,null))['catch'](handleError(_0x80f818,null));};function widgetAttributes(_0x45225a){try{switch(_0x45225a[_0xed86('0x2c')]){case _0xed86('0x56'):return[{'name':_0xed86('0x57'),'value':_0x45225a['attrUrl']||(_0x45225a[_0xed86('0x58')]&&_0x45225a['attrs'][0x0]?_0x45225a[_0xed86('0x58')][0x0][_0xed86('0x59')]:undefined)||_0xed86('0x5a')}];case _0xed86('0x5b'):return[{'name':_0xed86('0x5c'),'value':_0x45225a[_0xed86('0x5c')]||(_0x45225a['attrs']&&_0x45225a[_0xed86('0x58')][0x0]?_0x45225a[_0xed86('0x58')][0x0][_0xed86('0x59')]:undefined)||''}];case'clock':return[{'name':_0xed86('0x5d'),'value':_0x45225a[_0xed86('0x5d')]||(_0x45225a[_0xed86('0x58')]&&_0x45225a[_0xed86('0x58')][0x0]?_0x45225a[_0xed86('0x58')][0x0][_0xed86('0x59')]:undefined)||_0xed86('0x5e')},{'name':_0xed86('0x5f'),'value':_0x45225a['attrTimezone']||(_0x45225a[_0xed86('0x58')]&&_0x45225a['attrs'][0x1]?_0x45225a[_0xed86('0x58')][0x1][_0xed86('0x59')]:undefined)||_0xed86('0x60')},{'name':'attrFontSize','value':_0x45225a[_0xed86('0x61')]||(_0x45225a['attrs']&&_0x45225a[_0xed86('0x58')][0x2]?_0x45225a[_0xed86('0x58')][0x2][_0xed86('0x59')]:undefined)||0xc}];case _0xed86('0x62'):return[{'name':_0xed86('0x63'),'value':_0x45225a[_0xed86('0x63')]||(_0x45225a['attrs']&&_0x45225a[_0xed86('0x58')][0x0]?_0x45225a[_0xed86('0x58')][0x0]['value']:undefined)||'total'},{'name':_0xed86('0x64'),'value':_0x45225a[_0xed86('0x64')]||(_0x45225a['attrs']&&_0x45225a[_0xed86('0x58')][0x1]?_0x45225a['attrs'][0x1][_0xed86('0x59')]:undefined)||[]},{'name':'attrFontSize','value':_0x45225a[_0xed86('0x61')]||(_0x45225a[_0xed86('0x58')]&&_0x45225a[_0xed86('0x58')][0x2]?_0x45225a[_0xed86('0x58')][0x2][_0xed86('0x59')]:undefined)||0x14}];case _0xed86('0x65'):case _0xed86('0x66'):return[{'name':_0xed86('0x67'),'value':_0x45225a['attrSerie1']||(_0x45225a[_0xed86('0x58')]&&_0x45225a[_0xed86('0x58')][0x0]?_0x45225a[_0xed86('0x58')][0x0][_0xed86('0x59')]:undefined)||_0xed86('0x68')},{'name':_0xed86('0x69'),'value':_0x45225a[_0xed86('0x69')]||(_0x45225a[_0xed86('0x58')]&&_0x45225a['attrs'][0x1]?_0x45225a[_0xed86('0x58')][0x1][_0xed86('0x59')]:undefined)||null},{'name':_0xed86('0x6a'),'value':_0x45225a[_0xed86('0x6a')]||(_0x45225a[_0xed86('0x58')]&&_0x45225a[_0xed86('0x58')][0x2]?_0x45225a[_0xed86('0x58')][0x2][_0xed86('0x59')]:undefined)||null},{'name':_0xed86('0x64'),'value':_0x45225a[_0xed86('0x64')]||(_0x45225a[_0xed86('0x58')]&&_0x45225a[_0xed86('0x58')][0x3]?_0x45225a['attrs'][0x3]['value']:undefined)||[]}];case _0xed86('0x6b'):return[{'name':_0xed86('0x6c'),'type':_0x45225a[_0xed86('0x6d')]||(_0x45225a[_0xed86('0x58')]&&_0x45225a[_0xed86('0x58')][0x0]?_0x45225a[_0xed86('0x58')][0x0][_0xed86('0x2c')]:undefined)||null,'value':_0x45225a['attrReport']||(_0x45225a['attrs']&&_0x45225a[_0xed86('0x58')][0x0]?_0x45225a[_0xed86('0x58')][0x0][_0xed86('0x59')]:undefined)||null},{'name':_0xed86('0x6e'),'value':_0x45225a[_0xed86('0x6e')]||(_0x45225a[_0xed86('0x58')]&&_0x45225a['attrs'][0x1]?_0x45225a['attrs'][0x1][_0xed86('0x59')]:undefined)||0x0}];default:return[];}}catch(_0x4f63e8){logger[_0xed86('0x4d')](_0xed86('0x6f'),JSON['stringify'](_0x4f63e8));return[];}}exports[_0xed86('0x70')]=function(_0x2f4448,_0x416904,_0x384e4b){if(_0x2f4448[_0xed86('0x48')]['id']){delete _0x2f4448[_0xed86('0x48')]['id'];}return db['Dashboard'][_0xed86('0x4f')]({'where':{'id':_0x2f4448['params']['id']}})[_0xed86('0x21')](handleEntityNotFound(_0x416904,null))[_0xed86('0x21')](function(_0x4e2280){if(_0x4e2280){_0x2f4448['body'][_0xed86('0x71')]=_0x4e2280['id'];_0x2f4448[_0xed86('0x48')][_0xed86('0x58')]=widgetAttributes(_0x2f4448[_0xed86('0x48')]);return db[_0xed86('0x72')][_0xed86('0x53')](_0x2f4448[_0xed86('0x48')]);}})[_0xed86('0x21')](respondWithResult(_0x416904,null))[_0xed86('0x43')](handleError(_0x416904,null));};exports[_0xed86('0x73')]=function(_0x1a2405,_0x3f21c7,_0x58a96e){var _0x2a1152={};var _0x1250bb={};var _0x115048;var _0x2c896c;return db[_0xed86('0x2a')][_0xed86('0x74')]({'where':{'id':_0x1a2405[_0xed86('0x45')]['id']}})[_0xed86('0x21')](handleEntityNotFound(_0x3f21c7,null))[_0xed86('0x21')](function(_0x115223){if(_0x115223){_0x115048=_0x115223;_0x1250bb[_0xed86('0x2e')]=_[_0xed86('0x46')](db[_0xed86('0x72')][_0xed86('0x47')]);_0x1250bb[_0xed86('0x2f')]=_[_0xed86('0x46')](_0x1a2405['query']);_0x1250bb[_0xed86('0x39')]=_['intersection'](_0x1250bb[_0xed86('0x2e')],_0x1250bb[_0xed86('0x2f')]);_0x2a1152[_0xed86('0x31')]=_[_0xed86('0x30')](_0x1250bb[_0xed86('0x2e')],qs[_0xed86('0x32')](_0x1a2405[_0xed86('0x2f')][_0xed86('0x32')]));_0x2a1152[_0xed86('0x31')]=_0x2a1152['attributes']['length']?_0x2a1152['attributes']:_0x1250bb['model'];_0x2a1152['order']=qs['sort'](_0x1a2405[_0xed86('0x2f')][_0xed86('0x37')]);_0x2a1152[_0xed86('0x38')]=qs[_0xed86('0x39')](_[_0xed86('0x3a')](_0x1a2405[_0xed86('0x2f')],_0x1250bb[_0xed86('0x39')]));if(_0x1a2405['query'][_0xed86('0x75')]){_0x2a1152['where']=_['merge'](_0x2a1152[_0xed86('0x38')],{'$or':_[_0xed86('0x29')](_0x2a1152[_0xed86('0x31')],function(_0x34274a){var _0xe28987={};_0xe28987[_0x34274a]={'$like':'%'+_0x1a2405[_0xed86('0x2f')][_0xed86('0x75')]+'%'};return _0xe28987;})});}_0x2a1152=_['merge']({},_0x2a1152,_0x1a2405['options']);return _0x115048[_0xed86('0x73')](_0x2a1152);}})[_0xed86('0x21')](function(_0x5de916){if(_0x5de916){_0x2c896c=_0x5de916['length'];if(!_0x1a2405[_0xed86('0x2f')]['hasOwnProperty']('nolimit')){_0x2a1152[_0xed86('0x1a')]=qs[_0xed86('0x1a')](_0x1a2405[_0xed86('0x2f')][_0xed86('0x1a')]);_0x2a1152['offset']=qs[_0xed86('0x19')](_0x1a2405[_0xed86('0x2f')]['offset']);}return _0x115048[_0xed86('0x73')](_0x2a1152);}})[_0xed86('0x21')](function(_0x226561){if(_0x226561){return _0x226561?{'count':_0x2c896c,'rows':_0x226561}:null;}})[_0xed86('0x21')](respondWithResult(_0x3f21c7,null))[_0xed86('0x43')](handleError(_0x3f21c7,null));}; \ No newline at end of file +var _0x187e=['error','iframe','attrUrl','attrs','https://','custom','attrPath','value','attrHourFormat','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','hasOwnProperty','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','sendStatus','stack','name','send','index','map','Dashboard','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','rows','show','params','keys','rawAttributes','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','options','omit','createdAt','updatedAt'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x187e,0x18d));var _0xe187=function(_0x234d19,_0xb2f44b){_0x234d19=_0x234d19-0x0;var _0x1fe212=_0x187e[_0x234d19];return _0x1fe212;};'use strict';var pdf=require(_0xe187('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe187('0x1'));var zipdir=require(_0xe187('0x2'));var jsonpatch=require(_0xe187('0x3'));var rp=require(_0xe187('0x4'));var moment=require(_0xe187('0x5'));var BPromise=require(_0xe187('0x6'));var Mustache=require('mustache');var util=require(_0xe187('0x7'));var path=require(_0xe187('0x8'));var sox=require(_0xe187('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe187('0xa'));var squel=require(_0xe187('0xb'));var crypto=require(_0xe187('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe187('0xd'));var toCsv=require(_0xe187('0xe'));var querystring=require('querystring');var Papa=require(_0xe187('0xf'));var Redis=require(_0xe187('0x10'));var authService=require(_0xe187('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe187('0x12'));var hardwareService=require(_0xe187('0x13'));var logger=require(_0xe187('0x14'))(_0xe187('0x15'));var utils=require(_0xe187('0x16'));var config=require('../../config/environment');var db=require(_0xe187('0x17'))['db'];config[_0xe187('0x18')]=_[_0xe187('0x19')](config[_0xe187('0x18')],{'host':_0xe187('0x1a'),'port':0x18eb});var socket=require(_0xe187('0x1b'))(new Redis(config[_0xe187('0x18')]));require(_0xe187('0x1c'))[_0xe187('0x1d')](socket);function respondWithStatusCode(_0x56258c,_0x1902b7){_0x1902b7=_0x1902b7||0xcc;return function(_0x554c8e){if(_0x554c8e){return _0x56258c['sendStatus'](_0x1902b7);}return _0x56258c[_0xe187('0x1e')](_0x1902b7)[_0xe187('0x1f')]();};}function respondWithResult(_0x5a47a4,_0x6af385){_0x6af385=_0x6af385||0xc8;return function(_0x3e7024){if(_0x3e7024){return _0x5a47a4[_0xe187('0x1e')](_0x6af385)[_0xe187('0x20')](_0x3e7024);}};}function respondWithFilteredResult(_0x4c7bcc,_0x5bedb8){return function(_0x57b454){if(_0x57b454){var _0x316fd2=_0x57b454[_0xe187('0x21')],_0x26aeb2=_0x5bedb8[_0xe187('0x22')],_0x452e54=_0x5bedb8[_0xe187('0x22')]+_0x5bedb8[_0xe187('0x23')],_0x597fb2;if(_0x452e54>=_0x316fd2){_0x452e54=_0x316fd2;_0x597fb2=0xc8;}else{_0x597fb2=0xce;}_0x4c7bcc[_0xe187('0x1e')](_0x597fb2);return _0x4c7bcc[_0xe187('0x24')](_0xe187('0x25'),_0x26aeb2+'-'+_0x452e54+'/'+_0x316fd2)[_0xe187('0x20')](_0x57b454);}return null;};}function patchUpdates(_0x471ec4){return function(_0x28666f){try{jsonpatch[_0xe187('0x26')](_0x28666f,_0x471ec4,!![]);}catch(_0x2060c0){return BPromise[_0xe187('0x27')](_0x2060c0);}return _0x28666f[_0xe187('0x28')]();};}function saveUpdates(_0x4904ed,_0x15830f){return function(_0x58edeb){if(_0x58edeb){return _0x58edeb[_0xe187('0x29')](_0x4904ed)[_0xe187('0x2a')](function(_0x574321){return _0x574321;});}return null;};}function removeEntity(_0x55779a,_0x2900b1){return function(_0x255bc4){if(_0x255bc4){return _0x255bc4[_0xe187('0x2b')]()[_0xe187('0x2a')](function(){var _0x37318c=_0x255bc4[_0xe187('0x2c')]({'plain':!![]});var _0xb57471=_0xe187('0x2d');return db[_0xe187('0x2e')][_0xe187('0x2b')]({'where':{'type':_0xb57471,'resourceId':_0x37318c['id']}})[_0xe187('0x2a')](function(){return _0x255bc4;});})['then'](function(){_0x55779a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x10512b,_0x17fd93){return function(_0x5c4d94){if(!_0x5c4d94){_0x10512b[_0xe187('0x2f')](0x194);}return _0x5c4d94;};}function handleError(_0x12cc62,_0x58c077){_0x58c077=_0x58c077||0x1f4;return function(_0x38fd94){logger['error'](_0x38fd94[_0xe187('0x30')]);if(_0x38fd94['name']){delete _0x38fd94[_0xe187('0x31')];}_0x12cc62[_0xe187('0x1e')](_0x58c077)[_0xe187('0x32')](_0x38fd94);};}exports[_0xe187('0x33')]=function(_0x1dff59,_0x3701d1){var _0x306ac6={},_0x4d2666={},_0x18bc4c={'count':0x0,'rows':[]};var _0x9f1c45=_[_0xe187('0x34')](db[_0xe187('0x35')]['rawAttributes'],function(_0x46da77){return{'name':_0x46da77[_0xe187('0x36')],'type':_0x46da77[_0xe187('0x37')][_0xe187('0x38')]};});_0x4d2666[_0xe187('0x39')]=_['map'](_0x9f1c45,'name');_0x4d2666[_0xe187('0x3a')]=_['keys'](_0x1dff59[_0xe187('0x3a')]);_0x4d2666[_0xe187('0x3b')]=_[_0xe187('0x3c')](_0x4d2666[_0xe187('0x39')],_0x4d2666[_0xe187('0x3a')]);_0x306ac6[_0xe187('0x3d')]=_['intersection'](_0x4d2666[_0xe187('0x39')],qs[_0xe187('0x3e')](_0x1dff59[_0xe187('0x3a')][_0xe187('0x3e')]));_0x306ac6[_0xe187('0x3d')]=_0x306ac6['attributes']['length']?_0x306ac6['attributes']:_0x4d2666[_0xe187('0x39')];if(!_0x1dff59[_0xe187('0x3a')]['hasOwnProperty'](_0xe187('0x3f'))){_0x306ac6[_0xe187('0x23')]=qs[_0xe187('0x23')](_0x1dff59[_0xe187('0x3a')][_0xe187('0x23')]);_0x306ac6[_0xe187('0x22')]=qs[_0xe187('0x22')](_0x1dff59[_0xe187('0x3a')][_0xe187('0x22')]);}_0x306ac6[_0xe187('0x40')]=qs[_0xe187('0x41')](_0x1dff59[_0xe187('0x3a')]['sort']);_0x306ac6[_0xe187('0x42')]=qs[_0xe187('0x3b')](_[_0xe187('0x43')](_0x1dff59[_0xe187('0x3a')],_0x4d2666['filters']),_0x9f1c45);if(_0x1dff59['query'][_0xe187('0x44')]){_0x306ac6[_0xe187('0x42')]=_['merge'](_0x306ac6[_0xe187('0x42')],{'$or':_['map'](_0x9f1c45,function(_0x379d4d){if(_0x379d4d[_0xe187('0x37')]!=='VIRTUAL'){var _0x16d8d9={};_0x16d8d9[_0x379d4d[_0xe187('0x31')]]={'$like':'%'+_0x1dff59['query']['filter']+'%'};return _0x16d8d9;}})});}_0x306ac6=_[_0xe187('0x45')]({},_0x306ac6,_0x1dff59['options']);var _0x2af640={'where':_0x306ac6[_0xe187('0x42')]};return db[_0xe187('0x35')][_0xe187('0x21')](_0x2af640)[_0xe187('0x2a')](function(_0x222f0c){_0x18bc4c[_0xe187('0x21')]=_0x222f0c;if(_0x1dff59[_0xe187('0x3a')][_0xe187('0x46')]){_0x306ac6['include']=[{'all':!![]}];}return db[_0xe187('0x35')][_0xe187('0x47')](_0x306ac6);})[_0xe187('0x2a')](function(_0x416b25){_0x18bc4c[_0xe187('0x48')]=_0x416b25;return _0x18bc4c;})[_0xe187('0x2a')](respondWithFilteredResult(_0x3701d1,_0x306ac6))['catch'](handleError(_0x3701d1,null));};exports[_0xe187('0x49')]=function(_0x327c9a,_0x271d3d){var _0x433abe={'raw':![],'where':{'id':_0x327c9a[_0xe187('0x4a')]['id']}},_0x4e0360={};_0x4e0360[_0xe187('0x39')]=_[_0xe187('0x4b')](db[_0xe187('0x35')][_0xe187('0x4c')]);_0x4e0360[_0xe187('0x3a')]=_['keys'](_0x327c9a[_0xe187('0x3a')]);_0x4e0360['filters']=_[_0xe187('0x3c')](_0x4e0360[_0xe187('0x39')],_0x4e0360[_0xe187('0x3a')]);_0x433abe['attributes']=_[_0xe187('0x3c')](_0x4e0360[_0xe187('0x39')],qs[_0xe187('0x3e')](_0x327c9a[_0xe187('0x3a')]['fields']));_0x433abe[_0xe187('0x3d')]=_0x433abe[_0xe187('0x3d')]['length']?_0x433abe[_0xe187('0x3d')]:_0x4e0360[_0xe187('0x39')];if(_0x327c9a['query'][_0xe187('0x46')]){_0x433abe[_0xe187('0x4d')]=[{'all':!![]}];}_0x433abe=_[_0xe187('0x45')]({},_0x433abe,_0x327c9a['options']);return db['Dashboard'][_0xe187('0x4e')](_0x433abe)['then'](handleEntityNotFound(_0x271d3d,null))[_0xe187('0x2a')](respondWithResult(_0x271d3d,null))[_0xe187('0x4f')](handleError(_0x271d3d,null));};exports[_0xe187('0x50')]=function(_0x87d3d8,_0x465b8d){return db[_0xe187('0x35')]['create'](_0x87d3d8[_0xe187('0x51')],{})[_0xe187('0x2a')](function(_0x4eaa1f){var _0x53daaf=_0x87d3d8[_0xe187('0x52')][_0xe187('0x2c')]({'plain':!![]});if(!_0x53daaf)throw new Error(_0xe187('0x53'));if(_0x53daaf[_0xe187('0x54')]===_0xe187('0x52')){var _0x436932=_0x4eaa1f[_0xe187('0x2c')]({'plain':!![]});var _0x306691=_0xe187('0x2d');return db[_0xe187('0x55')][_0xe187('0x4e')]({'where':{'name':_0x306691,'userProfileId':_0x53daaf[_0xe187('0x56')]},'raw':!![]})[_0xe187('0x2a')](function(_0x334af7){if(_0x334af7&&_0x334af7[_0xe187('0x57')]===0x0){return db[_0xe187('0x2e')][_0xe187('0x50')]({'name':_0x436932[_0xe187('0x31')],'resourceId':_0x436932['id'],'type':_0x334af7[_0xe187('0x31')],'sectionId':_0x334af7['id']},{})[_0xe187('0x2a')](function(){return _0x4eaa1f;});}else{return _0x4eaa1f;}})[_0xe187('0x4f')](function(_0x4441f5){logger['error'](_0xe187('0x58'),_0x4441f5);throw _0x4441f5;});}return _0x4eaa1f;})[_0xe187('0x2a')](respondWithResult(_0x465b8d,0xc9))[_0xe187('0x4f')](handleError(_0x465b8d,null));};exports[_0xe187('0x59')]=function(_0x224ce6,_0x3c4b62){var _0x169854={'where':{'id':_0x224ce6[_0xe187('0x4a')]['id']}},_0x3e6a1d={};_0x3e6a1d[_0xe187('0x39')]=_[_0xe187('0x4b')](db[_0xe187('0x35')][_0xe187('0x4c')]);_0x169854[_0xe187('0x3d')]=_[_0xe187('0x3c')](_0x3e6a1d[_0xe187('0x39')],qs[_0xe187('0x3e')](_0x224ce6[_0xe187('0x3a')][_0xe187('0x3e')]));_0x169854['attributes']=_0x169854[_0xe187('0x3d')][_0xe187('0x5a')]?_0x169854[_0xe187('0x3d')]:_0x3e6a1d[_0xe187('0x39')];if(_0x224ce6[_0xe187('0x3a')][_0xe187('0x46')]){_0x169854[_0xe187('0x4d')]=[{'all':!![]}];}_0x169854=_[_0xe187('0x45')]({},_0x169854,_0x224ce6[_0xe187('0x5b')]);return db[_0xe187('0x35')][_0xe187('0x4e')](_0x169854)[_0xe187('0x2a')](handleEntityNotFound(_0x3c4b62,null))[_0xe187('0x2a')](function(_0x162ac3){if(_0x162ac3){var _0x1ff357=_0x162ac3[_0xe187('0x2c')]({'plain':!![]});_0x1ff357=qs[_0xe187('0x5c')](_0x1ff357,['id',_0xe187('0x5d'),_0xe187('0x5e')]);_0x224ce6['body']=_[_0xe187('0x5c')](_0x224ce6[_0xe187('0x51')],['id',_0xe187('0x5d'),_0xe187('0x5e')]);return db[_0xe187('0x35')]['create'](_[_0xe187('0x45')](_0x1ff357,_0x224ce6['body']),{'include':_0x224ce6[_0xe187('0x3a')][_0xe187('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x47519b){var _0x318f6d=_0x224ce6[_0xe187('0x52')][_0xe187('0x2c')]({'plain':!![]});if(!_0x318f6d)throw new Error(_0xe187('0x53'));if(_0x318f6d[_0xe187('0x54')]==='user'){var _0xb5675d=_0x47519b[_0xe187('0x2c')]({'plain':!![]});var _0x2bd7ab=_0xe187('0x2d');return db[_0xe187('0x55')][_0xe187('0x4e')]({'where':{'name':_0x2bd7ab,'userProfileId':_0x318f6d[_0xe187('0x56')]},'raw':!![]})[_0xe187('0x2a')](function(_0x268317){if(_0x268317&&_0x268317[_0xe187('0x57')]===0x0){return db[_0xe187('0x2e')]['create']({'name':_0xb5675d['name'],'resourceId':_0xb5675d['id'],'type':_0x268317[_0xe187('0x31')],'sectionId':_0x268317['id']},{})[_0xe187('0x2a')](function(){return _0x47519b;});}else{return _0x47519b;}})[_0xe187('0x4f')](function(_0x1acec6){logger[_0xe187('0x5f')](_0xe187('0x58'),_0x1acec6);throw _0x1acec6;});}return _0x47519b;});}})[_0xe187('0x2a')](respondWithResult(_0x3c4b62,0xc9))[_0xe187('0x4f')](handleError(_0x3c4b62,null));};exports[_0xe187('0x29')]=function(_0x4898ba,_0x4d07c4){if(_0x4898ba['body']['id']){delete _0x4898ba[_0xe187('0x51')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x4898ba['params']['id']}})[_0xe187('0x2a')](handleEntityNotFound(_0x4d07c4,null))['then'](saveUpdates(_0x4898ba[_0xe187('0x51')],null))['then'](respondWithResult(_0x4d07c4,null))[_0xe187('0x4f')](handleError(_0x4d07c4,null));};exports[_0xe187('0x2b')]=function(_0x26b693,_0x42ddae){return db['Dashboard'][_0xe187('0x4e')]({'where':{'id':_0x26b693[_0xe187('0x4a')]['id']}})[_0xe187('0x2a')](handleEntityNotFound(_0x42ddae,null))[_0xe187('0x2a')](removeEntity(_0x42ddae,null))[_0xe187('0x4f')](handleError(_0x42ddae,null));};function widgetAttributes(_0x4cfdb3){try{switch(_0x4cfdb3[_0xe187('0x37')]){case _0xe187('0x60'):return[{'name':_0xe187('0x61'),'value':_0x4cfdb3[_0xe187('0x61')]||(_0x4cfdb3[_0xe187('0x62')]&&_0x4cfdb3['attrs'][0x0]?_0x4cfdb3[_0xe187('0x62')][0x0]['value']:undefined)||_0xe187('0x63')}];case _0xe187('0x64'):return[{'name':_0xe187('0x65'),'value':_0x4cfdb3[_0xe187('0x65')]||(_0x4cfdb3[_0xe187('0x62')]&&_0x4cfdb3[_0xe187('0x62')][0x0]?_0x4cfdb3[_0xe187('0x62')][0x0][_0xe187('0x66')]:undefined)||''}];case'clock':return[{'name':_0xe187('0x67'),'value':_0x4cfdb3['attrHourFormat']||(_0x4cfdb3[_0xe187('0x62')]&&_0x4cfdb3[_0xe187('0x62')][0x0]?_0x4cfdb3['attrs'][0x0]['value']:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x4cfdb3['attrTimezone']||(_0x4cfdb3[_0xe187('0x62')]&&_0x4cfdb3[_0xe187('0x62')][0x1]?_0x4cfdb3['attrs'][0x1][_0xe187('0x66')]:undefined)||'0.00'},{'name':_0xe187('0x68'),'value':_0x4cfdb3[_0xe187('0x68')]||(_0x4cfdb3[_0xe187('0x62')]&&_0x4cfdb3[_0xe187('0x62')][0x2]?_0x4cfdb3[_0xe187('0x62')][0x2]['value']:undefined)||0xc}];case _0xe187('0x69'):return[{'name':_0xe187('0x6a'),'value':_0x4cfdb3[_0xe187('0x6a')]||(_0x4cfdb3['attrs']&&_0x4cfdb3[_0xe187('0x62')][0x0]?_0x4cfdb3[_0xe187('0x62')][0x0][_0xe187('0x66')]:undefined)||'total'},{'name':_0xe187('0x6b'),'value':_0x4cfdb3[_0xe187('0x6b')]||(_0x4cfdb3['attrs']&&_0x4cfdb3[_0xe187('0x62')][0x1]?_0x4cfdb3[_0xe187('0x62')][0x1][_0xe187('0x66')]:undefined)||[]},{'name':'attrFontSize','value':_0x4cfdb3[_0xe187('0x68')]||(_0x4cfdb3[_0xe187('0x62')]&&_0x4cfdb3['attrs'][0x2]?_0x4cfdb3[_0xe187('0x62')][0x2]['value']:undefined)||0x14}];case _0xe187('0x6c'):case _0xe187('0x6d'):return[{'name':_0xe187('0x6e'),'value':_0x4cfdb3[_0xe187('0x6e')]||(_0x4cfdb3[_0xe187('0x62')]&&_0x4cfdb3[_0xe187('0x62')][0x0]?_0x4cfdb3[_0xe187('0x62')][0x0][_0xe187('0x66')]:undefined)||'total'},{'name':_0xe187('0x6f'),'value':_0x4cfdb3[_0xe187('0x6f')]||(_0x4cfdb3[_0xe187('0x62')]&&_0x4cfdb3[_0xe187('0x62')][0x1]?_0x4cfdb3['attrs'][0x1][_0xe187('0x66')]:undefined)||null},{'name':_0xe187('0x70'),'value':_0x4cfdb3[_0xe187('0x70')]||(_0x4cfdb3[_0xe187('0x62')]&&_0x4cfdb3[_0xe187('0x62')][0x2]?_0x4cfdb3['attrs'][0x2][_0xe187('0x66')]:undefined)||null},{'name':_0xe187('0x6b'),'value':_0x4cfdb3[_0xe187('0x6b')]||(_0x4cfdb3[_0xe187('0x62')]&&_0x4cfdb3[_0xe187('0x62')][0x3]?_0x4cfdb3[_0xe187('0x62')][0x3][_0xe187('0x66')]:undefined)||[]}];case'web-report':return[{'name':_0xe187('0x71'),'type':_0x4cfdb3[_0xe187('0x72')]||(_0x4cfdb3[_0xe187('0x62')]&&_0x4cfdb3[_0xe187('0x62')][0x0]?_0x4cfdb3[_0xe187('0x62')][0x0]['type']:undefined)||null,'value':_0x4cfdb3[_0xe187('0x71')]||(_0x4cfdb3['attrs']&&_0x4cfdb3['attrs'][0x0]?_0x4cfdb3[_0xe187('0x62')][0x0][_0xe187('0x66')]:undefined)||null},{'name':_0xe187('0x73'),'value':_0x4cfdb3['attrRefresh']||(_0x4cfdb3[_0xe187('0x62')]&&_0x4cfdb3[_0xe187('0x62')][0x1]?_0x4cfdb3[_0xe187('0x62')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x35d2e8){logger[_0xe187('0x5f')](_0xe187('0x74'),JSON[_0xe187('0x75')](_0x35d2e8));return[];}}exports['addItem']=function(_0x284466,_0x1c2885,_0xaf39a2){if(_0x284466['body']['id']){delete _0x284466[_0xe187('0x51')]['id'];}return db[_0xe187('0x35')][_0xe187('0x4e')]({'where':{'id':_0x284466[_0xe187('0x4a')]['id']}})[_0xe187('0x2a')](handleEntityNotFound(_0x1c2885,null))[_0xe187('0x2a')](function(_0x221f7c){if(_0x221f7c){_0x284466[_0xe187('0x51')][_0xe187('0x76')]=_0x221f7c['id'];_0x284466[_0xe187('0x51')]['attrs']=widgetAttributes(_0x284466[_0xe187('0x51')]);return db[_0xe187('0x77')][_0xe187('0x50')](_0x284466[_0xe187('0x51')]);}})[_0xe187('0x2a')](respondWithResult(_0x1c2885,null))[_0xe187('0x4f')](handleError(_0x1c2885,null));};exports[_0xe187('0x78')]=function(_0x2f182e,_0x413fa6,_0x225849){var _0x1be5dc={};var _0x436fc7={};var _0xce693c;var _0x732273;return db['Dashboard'][_0xe187('0x79')]({'where':{'id':_0x2f182e['params']['id']}})[_0xe187('0x2a')](handleEntityNotFound(_0x413fa6,null))['then'](function(_0x1ba213){if(_0x1ba213){_0xce693c=_0x1ba213;_0x436fc7[_0xe187('0x39')]=_[_0xe187('0x4b')](db[_0xe187('0x77')]['rawAttributes']);_0x436fc7[_0xe187('0x3a')]=_['keys'](_0x2f182e['query']);_0x436fc7[_0xe187('0x3b')]=_['intersection'](_0x436fc7[_0xe187('0x39')],_0x436fc7[_0xe187('0x3a')]);_0x1be5dc[_0xe187('0x3d')]=_[_0xe187('0x3c')](_0x436fc7['model'],qs['fields'](_0x2f182e['query'][_0xe187('0x3e')]));_0x1be5dc[_0xe187('0x3d')]=_0x1be5dc['attributes'][_0xe187('0x5a')]?_0x1be5dc[_0xe187('0x3d')]:_0x436fc7['model'];_0x1be5dc['order']=qs[_0xe187('0x41')](_0x2f182e['query'][_0xe187('0x41')]);_0x1be5dc[_0xe187('0x42')]=qs[_0xe187('0x3b')](_[_0xe187('0x43')](_0x2f182e['query'],_0x436fc7[_0xe187('0x3b')]));if(_0x2f182e[_0xe187('0x3a')][_0xe187('0x44')]){_0x1be5dc['where']=_['merge'](_0x1be5dc[_0xe187('0x42')],{'$or':_[_0xe187('0x34')](_0x1be5dc['attributes'],function(_0x43cf03){var _0x4c0f48={};_0x4c0f48[_0x43cf03]={'$like':'%'+_0x2f182e['query'][_0xe187('0x44')]+'%'};return _0x4c0f48;})});}_0x1be5dc=_[_0xe187('0x45')]({},_0x1be5dc,_0x2f182e[_0xe187('0x5b')]);return _0xce693c[_0xe187('0x78')](_0x1be5dc);}})[_0xe187('0x2a')](function(_0x245c42){if(_0x245c42){_0x732273=_0x245c42[_0xe187('0x5a')];if(!_0x2f182e[_0xe187('0x3a')][_0xe187('0x7a')](_0xe187('0x3f'))){_0x1be5dc[_0xe187('0x23')]=qs[_0xe187('0x23')](_0x2f182e[_0xe187('0x3a')]['limit']);_0x1be5dc[_0xe187('0x22')]=qs[_0xe187('0x22')](_0x2f182e[_0xe187('0x3a')][_0xe187('0x22')]);}return _0xce693c[_0xe187('0x78')](_0x1be5dc);}})[_0xe187('0x2a')](function(_0x4fc3e5){if(_0x4fc3e5){return _0x4fc3e5?{'count':_0x732273,'rows':_0x4fc3e5}:null;}})[_0xe187('0x2a')](respondWithResult(_0x413fa6,null))[_0xe187('0x4f')](handleError(_0x413fa6,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 01ac447..00dd87c 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 _0x1613=['save','update','emit','hasOwnProperty','exports','events','../../mysqldb','Dashboard','setMaxListeners'];(function(_0x2fef7c,_0x1e72c9){var _0x3a6212=function(_0x5f27a7){while(--_0x5f27a7){_0x2fef7c['push'](_0x2fef7c['shift']());}};_0x3a6212(++_0x1e72c9);}(_0x1613,0x137));var _0x3161=function(_0x132a7d,_0x4fb28d){_0x132a7d=_0x132a7d-0x0;var _0x39246c=_0x1613[_0x132a7d];return _0x39246c;};'use strict';var EventEmitter=require(_0x3161('0x0'));var Dashboard=require(_0x3161('0x1'))['db'][_0x3161('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x3161('0x3')](0x0);var events={'afterCreate':_0x3161('0x4'),'afterUpdate':_0x3161('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5004e0){return function(_0x3e9a61,_0x3b0908,_0x1e477d){DashboardEvents['emit'](_0x5004e0+':'+_0x3e9a61['id'],_0x3e9a61);DashboardEvents[_0x3161('0x6')](_0x5004e0,_0x3e9a61);_0x1e477d(null);};}for(var e in events){if(events[_0x3161('0x7')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0x3161('0x8')]=DashboardEvents; \ No newline at end of file +var _0x0adf=['Dashboard','setMaxListeners','save','update','emit','hook','exports','../../mysqldb'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0x0adf,0xdf));var _0xf0ad=function(_0x49a81c,_0x157493){_0x49a81c=_0x49a81c-0x0;var _0x1cff10=_0x0adf[_0x49a81c];return _0x1cff10;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xf0ad('0x0'))['db'][_0xf0ad('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xf0ad('0x2')](0x0);var events={'afterCreate':_0xf0ad('0x3'),'afterUpdate':_0xf0ad('0x4'),'afterDestroy':'remove'};function emitEvent(_0x111860){return function(_0x472b97,_0x28c32b,_0x4345b7){DashboardEvents[_0xf0ad('0x5')](_0x111860+':'+_0x472b97['id'],_0x472b97);DashboardEvents[_0xf0ad('0x5')](_0x111860,_0x472b97);_0x4345b7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0xf0ad('0x6')](e,emitEvent(event));}}module[_0xf0ad('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 688d656..bd44282 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 _0xbb84=['./dashboard.attributes','exports','define','Dashboard','dashboards','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1165e9,_0x28887d){var _0x29e417=function(_0x402e6a){while(--_0x402e6a){_0x1165e9['push'](_0x1165e9['shift']());}};_0x29e417(++_0x28887d);}(_0xbb84,0xd5));var _0x4bb8=function(_0x4dbdda,_0x11f07c){_0x4dbdda=_0x4dbdda-0x0;var _0x1acbf1=_0xbb84[_0x4dbdda];return _0x1acbf1;};'use strict';var _=require('lodash');var util=require(_0x4bb8('0x0'));var logger=require(_0x4bb8('0x1'))(_0x4bb8('0x2'));var moment=require(_0x4bb8('0x3'));var BPromise=require(_0x4bb8('0x4'));var rp=require(_0x4bb8('0x5'));var fs=require('fs');var path=require(_0x4bb8('0x6'));var rimraf=require(_0x4bb8('0x7'));var config=require('../../config/environment');var attributes=require(_0x4bb8('0x8'));module[_0x4bb8('0x9')]=function(_0x460a82,_0x32bbf4){return _0x460a82[_0x4bb8('0xa')](_0x4bb8('0xb'),attributes,{'tableName':_0x4bb8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9916=['request-promise','path','rimraf','../../config/environment','exports','define','Dashboard','dashboards','util','../../config/logger','api','moment','bluebird'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x9916,0x1dc));var _0x6991=function(_0x52198b,_0x11e264){_0x52198b=_0x52198b-0x0;var _0x1553c6=_0x9916[_0x52198b];return _0x1553c6;};'use strict';var _=require('lodash');var util=require(_0x6991('0x0'));var logger=require(_0x6991('0x1'))(_0x6991('0x2'));var moment=require(_0x6991('0x3'));var BPromise=require(_0x6991('0x4'));var rp=require(_0x6991('0x5'));var fs=require('fs');var path=require(_0x6991('0x6'));var rimraf=require(_0x6991('0x7'));var config=require(_0x6991('0x8'));var attributes=require('./dashboard.attributes');module[_0x6991('0x9')]=function(_0x5d61c1,_0x56fbcd){return _0x5d61c1[_0x6991('0xa')](_0x6991('0xb'),attributes,{'tableName':_0x6991('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 7093599..9c6fcef 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 _0xecfa=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment'];(function(_0x50ae74,_0x18590a){var _0x1514ab=function(_0x542a58){while(--_0x542a58){_0x50ae74['push'](_0x50ae74['shift']());}};_0x1514ab(++_0x18590a);}(_0xecfa,0x1c9));var _0xaecf=function(_0x4a8c22,_0x21fb3d){_0x4a8c22=_0x4a8c22-0x0;var _0x2a2a00=_0xecfa[_0x4a8c22];return _0x2a2a00;};'use strict';var _=require(_0xaecf('0x0'));var util=require('util');var moment=require(_0xaecf('0x1'));var BPromise=require(_0xaecf('0x2'));var rs=require(_0xaecf('0x3'));var fs=require('fs');var Redis=require(_0xaecf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaecf('0x5'));var logger=require(_0xaecf('0x6'))(_0xaecf('0x7'));var config=require(_0xaecf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaecf('0x9')]['http']({'port':0x232a});config[_0xaecf('0xa')]=_[_0xaecf('0xb')](config['redis'],{'host':_0xaecf('0xc'),'port':0x18eb});var socket=require(_0xaecf('0xd'))(new Redis(config[_0xaecf('0xa')]));require(_0xaecf('0xe'))[_0xaecf('0xf')](socket);function respondWithRpcPromise(_0x1b39c7,_0x464d47,_0x207735){return new BPromise(function(_0x1df071,_0x1a9367){return client[_0xaecf('0x10')](_0x1b39c7,_0x207735)[_0xaecf('0x11')](function(_0x5b80ce){logger[_0xaecf('0x12')](_0xaecf('0x13'),_0x464d47,_0xaecf('0x14'));logger[_0xaecf('0x15')](_0xaecf('0x16'),_0x464d47,_0xaecf('0x14'),JSON['stringify'](_0x5b80ce));if(_0x5b80ce['error']){if(_0x5b80ce[_0xaecf('0x17')][_0xaecf('0x18')]===0x1f4){logger[_0xaecf('0x17')](_0xaecf('0x13'),_0x464d47,_0x5b80ce[_0xaecf('0x17')]['message']);return _0x1a9367(_0x5b80ce['error'][_0xaecf('0x19')]);}logger[_0xaecf('0x17')](_0xaecf('0x13'),_0x464d47,_0x5b80ce[_0xaecf('0x17')][_0xaecf('0x19')]);return _0x1df071(_0x5b80ce['error'][_0xaecf('0x19')]);}else{logger[_0xaecf('0x12')](_0xaecf('0x13'),_0x464d47,'request\x20sent');_0x1df071(_0x5b80ce[_0xaecf('0x1a')][_0xaecf('0x19')]);}})['catch'](function(_0x4881c3){logger[_0xaecf('0x17')](_0xaecf('0x13'),_0x464d47,_0x4881c3);_0x1a9367(_0x4881c3);});});} \ No newline at end of file +var _0x8684=['stringify','error','code','message','Dashboard,\x20%s,\x20%s','result','lodash','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','redis','defaults','localhost','./dashboard.socket','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s'];(function(_0x52355b,_0x89404e){var _0xf86f90=function(_0x146a84){while(--_0x146a84){_0x52355b['push'](_0x52355b['shift']());}};_0xf86f90(++_0x89404e);}(_0x8684,0x150));var _0x4868=function(_0x4e8b80,_0x4d66e2){_0x4e8b80=_0x4e8b80-0x0;var _0x94200a=_0x8684[_0x4e8b80];return _0x94200a;};'use strict';var _=require(_0x4868('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4868('0x1'));var rs=require(_0x4868('0x2'));var fs=require('fs');var Redis=require(_0x4868('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4868('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4868('0x5'));var client=jayson[_0x4868('0x6')]['http']({'port':0x232a});config[_0x4868('0x7')]=_[_0x4868('0x8')](config[_0x4868('0x7')],{'host':_0x4868('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4868('0x7')]));require(_0x4868('0xa'))['register'](socket);function respondWithRpcPromise(_0x6c9549,_0x42c142,_0xf7bf8b){return new BPromise(function(_0xd2612e,_0x2f33c9){return client['request'](_0x6c9549,_0xf7bf8b)[_0x4868('0xb')](function(_0x55741f){logger[_0x4868('0xc')]('Dashboard,\x20%s,\x20%s',_0x42c142,_0x4868('0xd'));logger[_0x4868('0xe')](_0x4868('0xf'),_0x42c142,'request\x20sent',JSON[_0x4868('0x10')](_0x55741f));if(_0x55741f['error']){if(_0x55741f[_0x4868('0x11')][_0x4868('0x12')]===0x1f4){logger[_0x4868('0x11')]('Dashboard,\x20%s,\x20%s',_0x42c142,_0x55741f[_0x4868('0x11')][_0x4868('0x13')]);return _0x2f33c9(_0x55741f[_0x4868('0x11')][_0x4868('0x13')]);}logger[_0x4868('0x11')](_0x4868('0x14'),_0x42c142,_0x55741f[_0x4868('0x11')][_0x4868('0x13')]);return _0xd2612e(_0x55741f['error'][_0x4868('0x13')]);}else{logger[_0x4868('0xc')]('Dashboard,\x20%s,\x20%s',_0x42c142,'request\x20sent');_0xd2612e(_0x55741f[_0x4868('0x15')][_0x4868('0x13')]);}})['catch'](function(_0x50df50){logger[_0x4868('0x11')](_0x4868('0x14'),_0x42c142,_0x50df50);_0x2f33c9(_0x50df50);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index e66b01e..2666fd0 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 _0xa338=['./dashboard.events','save','remove','update','emit','removeListener','register','dashboard:'];(function(_0x12f5f7,_0xa58b52){var _0x345c1b=function(_0x306035){while(--_0x306035){_0x12f5f7['push'](_0x12f5f7['shift']());}};_0x345c1b(++_0xa58b52);}(_0xa338,0x1a8));var _0x8a33=function(_0x21fdec,_0x695850){_0x21fdec=_0x21fdec-0x0;var _0x10f45f=_0xa338[_0x21fdec];return _0x10f45f;};'use strict';var DashboardEvents=require(_0x8a33('0x0'));var events=[_0x8a33('0x1'),_0x8a33('0x2'),_0x8a33('0x3')];function createListener(_0x30d28d,_0x346ff6){return function(_0x3c9090){_0x346ff6[_0x8a33('0x4')](_0x30d28d,_0x3c9090);};}function removeListener(_0x609c96,_0x49f76f){return function(){DashboardEvents[_0x8a33('0x5')](_0x609c96,_0x49f76f);};}exports[_0x8a33('0x6')]=function(_0x28537e){for(var _0x496acd=0x0,_0x284385=events['length'];_0x496acd<_0x284385;_0x496acd++){var _0x357f59=events[_0x496acd];var _0x4e0ecc=createListener(_0x8a33('0x7')+_0x357f59,_0x28537e);DashboardEvents['on'](_0x357f59,_0x4e0ecc);}}; \ No newline at end of file +var _0x3ae2=['dashboard:','./dashboard.events','remove','update','emit','removeListener','register','length'];(function(_0x542850,_0x272d61){var _0x3a56c5=function(_0x14cc69){while(--_0x14cc69){_0x542850['push'](_0x542850['shift']());}};_0x3a56c5(++_0x272d61);}(_0x3ae2,0x89));var _0x23ae=function(_0x240261,_0x4fe66c){_0x240261=_0x240261-0x0;var _0x45c332=_0x3ae2[_0x240261];return _0x45c332;};'use strict';var DashboardEvents=require(_0x23ae('0x0'));var events=['save',_0x23ae('0x1'),_0x23ae('0x2')];function createListener(_0x5b3841,_0x2789aa){return function(_0x268d05){_0x2789aa[_0x23ae('0x3')](_0x5b3841,_0x268d05);};}function removeListener(_0x49b823,_0x3c52bd){return function(){DashboardEvents[_0x23ae('0x4')](_0x49b823,_0x3c52bd);};}exports[_0x23ae('0x5')]=function(_0x4a666e){for(var _0x2487d6=0x0,_0x1b2660=events[_0x23ae('0x6')];_0x2487d6<_0x1b2660;_0x2487d6++){var _0x22a237=events[_0x2487d6];var _0x366a41=createListener(_0x23ae('0x7')+_0x22a237,_0x4a666e);DashboardEvents['on'](_0x22a237,_0x366a41);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 8c72b22..32485ac 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 _0xd8b0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','index','get','/:id','show','isAuthenticated','getItems','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','Router'];(function(_0x3dc538,_0x4f7702){var _0x72c2fd=function(_0x5a7260){while(--_0x5a7260){_0x3dc538['push'](_0x3dc538['shift']());}};_0x72c2fd(++_0x4f7702);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xd')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller['clone']);router[_0x0d8b('0xd')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0x11')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x14')]);module[_0x0d8b('0x15')]=router; \ No newline at end of file +var _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post','/:id/clone','addItem','put','update'];(function(_0x3ee810,_0x22540d){var _0x2788d2=function(_0x470c50){while(--_0x470c50){_0x3ee810['push'](_0x3ee810['shift']());}};_0x2788d2(++_0x22540d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['post']('/',auth[_0x3071('0x8')](),controller[_0x3071('0xe')]);router[_0x3071('0xf')](_0x3071('0x10'),auth[_0x3071('0x8')](),controller['clone']);router[_0x3071('0xf')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0x11')]);router[_0x3071('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['delete'](_0x3071('0xa'),auth[_0x3071('0x8')](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 8254e4c..1a77237 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 _0xb360=['INTEGER','#ffffff','#2196f3','exports','STRING','TEXT','long','parse','getDataValue','setDataValue','attrs','stringify'];(function(_0x540160,_0x24c6b6){var _0x476120=function(_0x28046c){while(--_0x28046c){_0x540160['push'](_0x540160['shift']());}};_0x476120(++_0x24c6b6);}(_0xb360,0x183));var _0x0b36=function(_0x55b26a,_0x20927d){_0x55b26a=_0x55b26a-0x0;var _0xd0a069=_0xb360[_0x55b26a];return _0xd0a069;};'use strict';var Sequelize=require('sequelize');var squel=require('squel');var _=require('lodash');module[_0x0b36('0x0')]={'title':{'type':Sequelize[_0x0b36('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0b36('0x1')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x0b36('0x2')](_0x0b36('0x3')),'get':function(){try{return JSON[_0x0b36('0x4')](this[_0x0b36('0x5')]('attrs'));}catch(_0x3de365){return[];}},'set':function(_0x231564){try{this[_0x0b36('0x6')](_0x0b36('0x7'),JSON[_0x0b36('0x8')](_0x231564));}catch(_0x106e40){this[_0x0b36('0x6')](_0x0b36('0x7'),JSON[_0x0b36('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x0b36('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x0b36('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x0b36('0x9')]},'background':{'type':Sequelize[_0x0b36('0x1')],'allowNull':![],'defaultValue':_0x0b36('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0b36('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x0b36('0x1')]}}; \ No newline at end of file +var _0x3713=['exports','STRING','TEXT','long','parse','getDataValue','setDataValue','attrs','INTEGER','#2196f3','sequelize','lodash'];(function(_0x2d69c0,_0x364d57){var _0x593cdc=function(_0x2a7a30){while(--_0x2a7a30){_0x2d69c0['push'](_0x2d69c0['shift']());}};_0x593cdc(++_0x364d57);}(_0x3713,0x18a));var _0x3371=function(_0x1e2b10,_0xf3c1ca){_0x1e2b10=_0x1e2b10-0x0;var _0x166bc8=_0x3713[_0x1e2b10];return _0x166bc8;};'use strict';var Sequelize=require(_0x3371('0x0'));var squel=require('squel');var _=require(_0x3371('0x1'));module[_0x3371('0x2')]={'title':{'type':Sequelize[_0x3371('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x3371('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x3371('0x4')](_0x3371('0x5')),'get':function(){try{return JSON[_0x3371('0x6')](this[_0x3371('0x7')]('attrs'));}catch(_0x2736fd){return[];}},'set':function(_0x1bbaf4){try{this[_0x3371('0x8')](_0x3371('0x9'),JSON['stringify'](_0x1bbaf4));}catch(_0x1840ce){this[_0x3371('0x8')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x3371('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x3371('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x3371('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x3371('0x3')],'allowNull':![],'defaultValue':_0x3371('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x3371('0x3')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index ece748c..a35c35e 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 _0x0c40=['iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','type','attrRefresh','error','widgetAttributes:\x20%s','body','create','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','set','apply','reject','save','then','destroy','end','stack','name','send','show','params','model','keys','DashboardItem','query','filters','intersection','fields','attributes','merge','find','catch'];(function(_0x1f86ae,_0x33b97f){var _0x552932=function(_0x4b2369){while(--_0x4b2369){_0x1f86ae['push'](_0x1f86ae['shift']());}};_0x552932(++_0x33b97f);}(_0x0c40,0xc5));var _0x00c4=function(_0x36ece1,_0x9e1dc7){_0x36ece1=_0x36ece1-0x0;var _0x10b964=_0x0c40[_0x36ece1];return _0x10b964;};'use strict';var pdf=require(_0x00c4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x00c4('0x1'));var zipdir=require(_0x00c4('0x2'));var jsonpatch=require(_0x00c4('0x3'));var rp=require(_0x00c4('0x4'));var moment=require(_0x00c4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x00c4('0x6'));var util=require(_0x00c4('0x7'));var path=require(_0x00c4('0x8'));var sox=require(_0x00c4('0x9'));var csv=require('to-csv');var ejs=require(_0x00c4('0xa'));var fs=require('fs');var _=require(_0x00c4('0xb'));var squel=require(_0x00c4('0xc'));var crypto=require(_0x00c4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x00c4('0xe'));var toCsv=require(_0x00c4('0xf'));var querystring=require(_0x00c4('0x10'));var Papa=require(_0x00c4('0x11'));var Redis=require('ioredis');var authService=require(_0x00c4('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x00c4('0x13'))(_0x00c4('0x14'));var utils=require('../../config/utils');var config=require(_0x00c4('0x15'));var db=require(_0x00c4('0x16'))['db'];config[_0x00c4('0x17')]=_[_0x00c4('0x18')](config['redis'],{'host':_0x00c4('0x19'),'port':0x18eb});var socket=require(_0x00c4('0x1a'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0x00c4('0x1b')](socket);function respondWithStatusCode(_0xaaec64,_0x332af1){_0x332af1=_0x332af1||0xcc;return function(_0x4e5d28){if(_0x4e5d28){return _0xaaec64[_0x00c4('0x1c')](_0x332af1);}return _0xaaec64['status'](_0x332af1)['end']();};}function respondWithResult(_0x3f4f71,_0x144064){_0x144064=_0x144064||0xc8;return function(_0x5cc306){if(_0x5cc306){return _0x3f4f71[_0x00c4('0x1d')](_0x144064)[_0x00c4('0x1e')](_0x5cc306);}};}function respondWithFilteredResult(_0x159f8f,_0x48921c){return function(_0x577623){if(_0x577623){var _0x268ee8=_0x577623['count'],_0x7313aa=_0x48921c[_0x00c4('0x1f')],_0x5c5d00=_0x48921c[_0x00c4('0x1f')]+_0x48921c['limit'],_0xf71ee1;if(_0x5c5d00>=_0x268ee8){_0x5c5d00=_0x268ee8;_0xf71ee1=0xc8;}else{_0xf71ee1=0xce;}_0x159f8f[_0x00c4('0x1d')](_0xf71ee1);return _0x159f8f[_0x00c4('0x20')]('Content-Range',_0x7313aa+'-'+_0x5c5d00+'/'+_0x268ee8)[_0x00c4('0x1e')](_0x577623);}return null;};}function patchUpdates(_0x30f218){return function(_0x1fe3f6){try{jsonpatch[_0x00c4('0x21')](_0x1fe3f6,_0x30f218,!![]);}catch(_0xecccf2){return BPromise[_0x00c4('0x22')](_0xecccf2);}return _0x1fe3f6[_0x00c4('0x23')]();};}function saveUpdates(_0x56d024,_0x1c1c26){return function(_0x1124d1){if(_0x1124d1){return _0x1124d1['update'](_0x56d024)[_0x00c4('0x24')](function(_0x3264f5){return _0x3264f5;});}return null;};}function removeEntity(_0x4bdf3b,_0x1029d2){return function(_0x49e4a8){if(_0x49e4a8){return _0x49e4a8[_0x00c4('0x25')]()[_0x00c4('0x24')](function(){_0x4bdf3b[_0x00c4('0x1d')](0xcc)[_0x00c4('0x26')]();});}};}function handleEntityNotFound(_0x4c5da9,_0x591a42){return function(_0x195df6){if(!_0x195df6){_0x4c5da9[_0x00c4('0x1c')](0x194);}return _0x195df6;};}function handleError(_0x2fee87,_0x538d81){_0x538d81=_0x538d81||0x1f4;return function(_0x3866e0){logger['error'](_0x3866e0[_0x00c4('0x27')]);if(_0x3866e0[_0x00c4('0x28')]){delete _0x3866e0[_0x00c4('0x28')];}_0x2fee87['status'](_0x538d81)[_0x00c4('0x29')](_0x3866e0);};}exports[_0x00c4('0x2a')]=function(_0x468b84,_0x106863){var _0x3bfef1={'raw':![],'where':{'id':_0x468b84[_0x00c4('0x2b')]['id']}},_0x177058={};_0x177058[_0x00c4('0x2c')]=_[_0x00c4('0x2d')](db[_0x00c4('0x2e')]['rawAttributes']);_0x177058[_0x00c4('0x2f')]=_[_0x00c4('0x2d')](_0x468b84[_0x00c4('0x2f')]);_0x177058[_0x00c4('0x30')]=_[_0x00c4('0x31')](_0x177058[_0x00c4('0x2c')],_0x177058[_0x00c4('0x2f')]);_0x3bfef1['attributes']=_['intersection'](_0x177058[_0x00c4('0x2c')],qs[_0x00c4('0x32')](_0x468b84[_0x00c4('0x2f')]['fields']));_0x3bfef1[_0x00c4('0x33')]=_0x3bfef1[_0x00c4('0x33')]['length']?_0x3bfef1['attributes']:_0x177058[_0x00c4('0x2c')];if(_0x468b84[_0x00c4('0x2f')]['includeAll']){_0x3bfef1['include']=[{'all':!![]}];}_0x3bfef1=_[_0x00c4('0x34')]({},_0x3bfef1,_0x468b84['options']);return db[_0x00c4('0x2e')][_0x00c4('0x35')](_0x3bfef1)[_0x00c4('0x24')](handleEntityNotFound(_0x106863,null))[_0x00c4('0x24')](respondWithResult(_0x106863,null))['catch'](handleError(_0x106863,null));};exports[_0x00c4('0x25')]=function(_0x5a5bad,_0x1ea386){return db[_0x00c4('0x2e')][_0x00c4('0x35')]({'where':{'id':_0x5a5bad[_0x00c4('0x2b')]['id']}})['then'](handleEntityNotFound(_0x1ea386,null))[_0x00c4('0x24')](removeEntity(_0x1ea386,null))[_0x00c4('0x36')](handleError(_0x1ea386,null));};function widgetAttributes(_0x49458e){try{switch(_0x49458e['type']){case _0x00c4('0x37'):return[{'name':_0x00c4('0x38'),'value':_0x49458e[_0x00c4('0x38')]||(_0x49458e[_0x00c4('0x39')]&&_0x49458e[_0x00c4('0x39')][0x0]?_0x49458e[_0x00c4('0x39')][0x0][_0x00c4('0x3a')]:undefined)||_0x00c4('0x3b')}];case _0x00c4('0x3c'):return[{'name':_0x00c4('0x3d'),'value':_0x49458e[_0x00c4('0x3d')]||(_0x49458e[_0x00c4('0x39')]&&_0x49458e[_0x00c4('0x39')][0x0]?_0x49458e['attrs'][0x0][_0x00c4('0x3a')]:undefined)||''}];case _0x00c4('0x3e'):return[{'name':_0x00c4('0x3f'),'value':_0x49458e[_0x00c4('0x3f')]||(_0x49458e[_0x00c4('0x39')]&&_0x49458e[_0x00c4('0x39')][0x0]?_0x49458e[_0x00c4('0x39')][0x0]['value']:undefined)||_0x00c4('0x40')},{'name':_0x00c4('0x41'),'value':_0x49458e[_0x00c4('0x41')]||(_0x49458e[_0x00c4('0x39')]&&_0x49458e['attrs'][0x1]?_0x49458e['attrs'][0x1]['value']:undefined)||_0x00c4('0x42')},{'name':_0x00c4('0x43'),'value':_0x49458e['attrFontSize']||(_0x49458e[_0x00c4('0x39')]&&_0x49458e[_0x00c4('0x39')][0x2]?_0x49458e['attrs'][0x2][_0x00c4('0x3a')]:undefined)||0xc}];case'counter':return[{'name':_0x00c4('0x44'),'value':_0x49458e['attrMetric']||(_0x49458e['attrs']&&_0x49458e[_0x00c4('0x39')][0x0]?_0x49458e[_0x00c4('0x39')][0x0]['value']:undefined)||_0x00c4('0x45')},{'name':'attrVoiceQueues','value':_0x49458e[_0x00c4('0x46')]||(_0x49458e[_0x00c4('0x39')]&&_0x49458e['attrs'][0x1]?_0x49458e[_0x00c4('0x39')][0x1][_0x00c4('0x3a')]:undefined)||[]},{'name':_0x00c4('0x43'),'value':_0x49458e['attrFontSize']||(_0x49458e['attrs']&&_0x49458e['attrs'][0x2]?_0x49458e['attrs'][0x2][_0x00c4('0x3a')]:undefined)||0x14}];case _0x00c4('0x47'):case'pie-chart':return[{'name':_0x00c4('0x48'),'value':_0x49458e['attrSerie1']||(_0x49458e[_0x00c4('0x39')]&&_0x49458e[_0x00c4('0x39')][0x0]?_0x49458e[_0x00c4('0x39')][0x0][_0x00c4('0x3a')]:undefined)||'total'},{'name':_0x00c4('0x49'),'value':_0x49458e[_0x00c4('0x49')]||(_0x49458e[_0x00c4('0x39')]&&_0x49458e[_0x00c4('0x39')][0x1]?_0x49458e[_0x00c4('0x39')][0x1][_0x00c4('0x3a')]:undefined)||null},{'name':'attrSerie3','value':_0x49458e[_0x00c4('0x4a')]||(_0x49458e['attrs']&&_0x49458e['attrs'][0x2]?_0x49458e[_0x00c4('0x39')][0x2]['value']:undefined)||null},{'name':_0x00c4('0x46'),'value':_0x49458e[_0x00c4('0x46')]||(_0x49458e[_0x00c4('0x39')]&&_0x49458e[_0x00c4('0x39')][0x3]?_0x49458e[_0x00c4('0x39')][0x3][_0x00c4('0x3a')]:undefined)||[]}];case _0x00c4('0x4b'):return[{'name':_0x00c4('0x4c'),'type':_0x49458e[_0x00c4('0x4d')]||(_0x49458e[_0x00c4('0x39')]&&_0x49458e[_0x00c4('0x39')][0x0]?_0x49458e[_0x00c4('0x39')][0x0][_0x00c4('0x4e')]:undefined)||null,'value':_0x49458e[_0x00c4('0x4c')]||(_0x49458e[_0x00c4('0x39')]&&_0x49458e[_0x00c4('0x39')][0x0]?_0x49458e[_0x00c4('0x39')][0x0][_0x00c4('0x3a')]:undefined)||null},{'name':_0x00c4('0x4f'),'value':_0x49458e['attrRefresh']||(_0x49458e[_0x00c4('0x39')]&&_0x49458e[_0x00c4('0x39')][0x1]?_0x49458e[_0x00c4('0x39')][0x1][_0x00c4('0x3a')]:undefined)||0x0}];default:return[];}}catch(_0x1f3e64){logger[_0x00c4('0x50')](_0x00c4('0x51'),JSON['stringify'](_0x1f3e64));return[];}}exports['create']=function(_0xaab2b4,_0xb899c4){if(_0xaab2b4['body']){_0xaab2b4['body']['attrs']=widgetAttributes(_0xaab2b4[_0x00c4('0x52')]);}return db['DashboardItem'][_0x00c4('0x53')](_0xaab2b4[_0x00c4('0x52')],{})[_0x00c4('0x24')](respondWithResult(_0xb899c4,0xc9))[_0x00c4('0x36')](handleError(_0xb899c4,null));};exports['update']=function(_0x1182ac,_0x19d32b){if(_0x1182ac[_0x00c4('0x52')]['id']){delete _0x1182ac['body']['id'];}_0x1182ac[_0x00c4('0x52')][_0x00c4('0x39')]=widgetAttributes(_0x1182ac[_0x00c4('0x52')]);return db['DashboardItem'][_0x00c4('0x35')]({'where':{'id':_0x1182ac[_0x00c4('0x2b')]['id']}})['then'](handleEntityNotFound(_0x19d32b,null))[_0x00c4('0x24')](saveUpdates(_0x1182ac['body'],null))['then'](respondWithResult(_0x19d32b,null))[_0x00c4('0x36')](handleError(_0x19d32b,null));}; \ No newline at end of file +var _0xd8e4=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','include','merge','options','DashboardItem','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x2ed396,_0x4e4dea){var _0x2adc27=function(_0x2a300e){while(--_0x2a300e){_0x2ed396['push'](_0x2ed396['shift']());}};_0x2adc27(++_0x4e4dea);}(_0xd8e4,0xa3));var _0x4d8e=function(_0x232e87,_0x203795){_0x232e87=_0x232e87-0x0;var _0x18c3ba=_0xd8e4[_0x232e87];return _0x18c3ba;};'use strict';var pdf=require(_0x4d8e('0x0'));var emlformat=require(_0x4d8e('0x1'));var rimraf=require(_0x4d8e('0x2'));var zipdir=require(_0x4d8e('0x3'));var jsonpatch=require(_0x4d8e('0x4'));var rp=require(_0x4d8e('0x5'));var moment=require(_0x4d8e('0x6'));var BPromise=require(_0x4d8e('0x7'));var Mustache=require(_0x4d8e('0x8'));var util=require(_0x4d8e('0x9'));var path=require(_0x4d8e('0xa'));var sox=require(_0x4d8e('0xb'));var csv=require(_0x4d8e('0xc'));var ejs=require(_0x4d8e('0xd'));var fs=require('fs');var _=require(_0x4d8e('0xe'));var squel=require(_0x4d8e('0xf'));var crypto=require(_0x4d8e('0x10'));var jsforce=require(_0x4d8e('0x11'));var deskjs=require(_0x4d8e('0x12'));var toCsv=require(_0x4d8e('0xc'));var querystring=require(_0x4d8e('0x13'));var Papa=require(_0x4d8e('0x14'));var Redis=require(_0x4d8e('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x4d8e('0x16'));var as=require(_0x4d8e('0x17'));var hardwareService=require(_0x4d8e('0x18'));var logger=require(_0x4d8e('0x19'))(_0x4d8e('0x1a'));var utils=require(_0x4d8e('0x1b'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x4d8e('0x1c')]=_['defaults'](config[_0x4d8e('0x1c')],{'host':_0x4d8e('0x1d'),'port':0x18eb});var socket=require(_0x4d8e('0x1e'))(new Redis(config['redis']));require(_0x4d8e('0x1f'))['register'](socket);function respondWithStatusCode(_0x3b930e,_0x536747){_0x536747=_0x536747||0xcc;return function(_0x40c7c8){if(_0x40c7c8){return _0x3b930e[_0x4d8e('0x20')](_0x536747);}return _0x3b930e[_0x4d8e('0x21')](_0x536747)[_0x4d8e('0x22')]();};}function respondWithResult(_0x411a5b,_0x36eb12){_0x36eb12=_0x36eb12||0xc8;return function(_0x3a286f){if(_0x3a286f){return _0x411a5b[_0x4d8e('0x21')](_0x36eb12)[_0x4d8e('0x23')](_0x3a286f);}};}function respondWithFilteredResult(_0x3e7c46,_0x3f13e1){return function(_0x55dfbc){if(_0x55dfbc){var _0x35c617=_0x55dfbc[_0x4d8e('0x24')],_0x3a761a=_0x3f13e1[_0x4d8e('0x25')],_0x272c70=_0x3f13e1[_0x4d8e('0x25')]+_0x3f13e1['limit'],_0x55625e;if(_0x272c70>=_0x35c617){_0x272c70=_0x35c617;_0x55625e=0xc8;}else{_0x55625e=0xce;}_0x3e7c46[_0x4d8e('0x21')](_0x55625e);return _0x3e7c46['set'](_0x4d8e('0x26'),_0x3a761a+'-'+_0x272c70+'/'+_0x35c617)['json'](_0x55dfbc);}return null;};}function patchUpdates(_0x23063d){return function(_0x23985c){try{jsonpatch[_0x4d8e('0x27')](_0x23985c,_0x23063d,!![]);}catch(_0x1e1b63){return BPromise[_0x4d8e('0x28')](_0x1e1b63);}return _0x23985c[_0x4d8e('0x29')]();};}function saveUpdates(_0xc15534,_0x10ff80){return function(_0x2a3080){if(_0x2a3080){return _0x2a3080['update'](_0xc15534)[_0x4d8e('0x2a')](function(_0xe7f972){return _0xe7f972;});}return null;};}function removeEntity(_0x3cabbc,_0x4787f4){return function(_0x27465b){if(_0x27465b){return _0x27465b[_0x4d8e('0x2b')]()['then'](function(){_0x3cabbc[_0x4d8e('0x21')](0xcc)[_0x4d8e('0x22')]();});}};}function handleEntityNotFound(_0x4932e3,_0x566852){return function(_0x3113c2){if(!_0x3113c2){_0x4932e3[_0x4d8e('0x20')](0x194);}return _0x3113c2;};}function handleError(_0x8840d,_0x1e9b85){_0x1e9b85=_0x1e9b85||0x1f4;return function(_0x3605f4){logger[_0x4d8e('0x2c')](_0x3605f4[_0x4d8e('0x2d')]);if(_0x3605f4[_0x4d8e('0x2e')]){delete _0x3605f4[_0x4d8e('0x2e')];}_0x8840d[_0x4d8e('0x21')](_0x1e9b85)[_0x4d8e('0x2f')](_0x3605f4);};}exports[_0x4d8e('0x30')]=function(_0x2ef8d6,_0x277547){var _0x505ee4={'raw':![],'where':{'id':_0x2ef8d6[_0x4d8e('0x31')]['id']}},_0x2cf9f9={};_0x2cf9f9[_0x4d8e('0x32')]=_[_0x4d8e('0x33')](db['DashboardItem'][_0x4d8e('0x34')]);_0x2cf9f9[_0x4d8e('0x35')]=_[_0x4d8e('0x33')](_0x2ef8d6[_0x4d8e('0x35')]);_0x2cf9f9[_0x4d8e('0x36')]=_['intersection'](_0x2cf9f9['model'],_0x2cf9f9['query']);_0x505ee4['attributes']=_[_0x4d8e('0x37')](_0x2cf9f9[_0x4d8e('0x32')],qs[_0x4d8e('0x38')](_0x2ef8d6['query'][_0x4d8e('0x38')]));_0x505ee4['attributes']=_0x505ee4[_0x4d8e('0x39')][_0x4d8e('0x3a')]?_0x505ee4[_0x4d8e('0x39')]:_0x2cf9f9['model'];if(_0x2ef8d6[_0x4d8e('0x35')]['includeAll']){_0x505ee4[_0x4d8e('0x3b')]=[{'all':!![]}];}_0x505ee4=_[_0x4d8e('0x3c')]({},_0x505ee4,_0x2ef8d6[_0x4d8e('0x3d')]);return db[_0x4d8e('0x3e')][_0x4d8e('0x3f')](_0x505ee4)[_0x4d8e('0x2a')](handleEntityNotFound(_0x277547,null))[_0x4d8e('0x2a')](respondWithResult(_0x277547,null))[_0x4d8e('0x40')](handleError(_0x277547,null));};exports[_0x4d8e('0x2b')]=function(_0x40f5a1,_0x40427e){return db[_0x4d8e('0x3e')][_0x4d8e('0x3f')]({'where':{'id':_0x40f5a1['params']['id']}})[_0x4d8e('0x2a')](handleEntityNotFound(_0x40427e,null))[_0x4d8e('0x2a')](removeEntity(_0x40427e,null))[_0x4d8e('0x40')](handleError(_0x40427e,null));};function widgetAttributes(_0x1bbc60){try{switch(_0x1bbc60[_0x4d8e('0x41')]){case _0x4d8e('0x42'):return[{'name':'attrUrl','value':_0x1bbc60[_0x4d8e('0x43')]||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60[_0x4d8e('0x44')][0x0]?_0x1bbc60['attrs'][0x0][_0x4d8e('0x45')]:undefined)||_0x4d8e('0x46')}];case _0x4d8e('0x47'):return[{'name':_0x4d8e('0x48'),'value':_0x1bbc60[_0x4d8e('0x48')]||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60['attrs'][0x0]?_0x1bbc60[_0x4d8e('0x44')][0x0][_0x4d8e('0x45')]:undefined)||''}];case'clock':return[{'name':_0x4d8e('0x49'),'value':_0x1bbc60[_0x4d8e('0x49')]||(_0x1bbc60['attrs']&&_0x1bbc60[_0x4d8e('0x44')][0x0]?_0x1bbc60['attrs'][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x4d8e('0x4a'),'value':_0x1bbc60[_0x4d8e('0x4a')]||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60['attrs'][0x1]?_0x1bbc60[_0x4d8e('0x44')][0x1][_0x4d8e('0x45')]:undefined)||_0x4d8e('0x4b')},{'name':'attrFontSize','value':_0x1bbc60[_0x4d8e('0x4c')]||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60[_0x4d8e('0x44')][0x2]?_0x1bbc60['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x4d8e('0x4d'),'value':_0x1bbc60[_0x4d8e('0x4d')]||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60[_0x4d8e('0x44')][0x0]?_0x1bbc60[_0x4d8e('0x44')][0x0]['value']:undefined)||_0x4d8e('0x4e')},{'name':'attrVoiceQueues','value':_0x1bbc60[_0x4d8e('0x4f')]||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60['attrs'][0x1]?_0x1bbc60[_0x4d8e('0x44')][0x1]['value']:undefined)||[]},{'name':_0x4d8e('0x4c'),'value':_0x1bbc60[_0x4d8e('0x4c')]||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60[_0x4d8e('0x44')][0x2]?_0x1bbc60['attrs'][0x2][_0x4d8e('0x45')]:undefined)||0x14}];case _0x4d8e('0x50'):case'pie-chart':return[{'name':'attrSerie1','value':_0x1bbc60['attrSerie1']||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60[_0x4d8e('0x44')][0x0]?_0x1bbc60[_0x4d8e('0x44')][0x0]['value']:undefined)||'total'},{'name':_0x4d8e('0x51'),'value':_0x1bbc60[_0x4d8e('0x51')]||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60[_0x4d8e('0x44')][0x1]?_0x1bbc60[_0x4d8e('0x44')][0x1][_0x4d8e('0x45')]:undefined)||null},{'name':_0x4d8e('0x52'),'value':_0x1bbc60[_0x4d8e('0x52')]||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60[_0x4d8e('0x44')][0x2]?_0x1bbc60[_0x4d8e('0x44')][0x2][_0x4d8e('0x45')]:undefined)||null},{'name':_0x4d8e('0x4f'),'value':_0x1bbc60[_0x4d8e('0x4f')]||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60[_0x4d8e('0x44')][0x3]?_0x1bbc60[_0x4d8e('0x44')][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':_0x4d8e('0x53'),'type':_0x1bbc60['reportType']||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60[_0x4d8e('0x44')][0x0]?_0x1bbc60[_0x4d8e('0x44')][0x0][_0x4d8e('0x41')]:undefined)||null,'value':_0x1bbc60[_0x4d8e('0x53')]||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60[_0x4d8e('0x44')][0x0]?_0x1bbc60[_0x4d8e('0x44')][0x0]['value']:undefined)||null},{'name':_0x4d8e('0x54'),'value':_0x1bbc60['attrRefresh']||(_0x1bbc60[_0x4d8e('0x44')]&&_0x1bbc60['attrs'][0x1]?_0x1bbc60[_0x4d8e('0x44')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x718d97){logger[_0x4d8e('0x2c')](_0x4d8e('0x55'),JSON[_0x4d8e('0x56')](_0x718d97));return[];}}exports['create']=function(_0x3e7596,_0x192b62){if(_0x3e7596[_0x4d8e('0x57')]){_0x3e7596['body'][_0x4d8e('0x44')]=widgetAttributes(_0x3e7596[_0x4d8e('0x57')]);}return db[_0x4d8e('0x3e')][_0x4d8e('0x58')](_0x3e7596[_0x4d8e('0x57')],{})['then'](respondWithResult(_0x192b62,0xc9))[_0x4d8e('0x40')](handleError(_0x192b62,null));};exports[_0x4d8e('0x59')]=function(_0x243716,_0x2d0a85){if(_0x243716[_0x4d8e('0x57')]['id']){delete _0x243716[_0x4d8e('0x57')]['id'];}_0x243716[_0x4d8e('0x57')][_0x4d8e('0x44')]=widgetAttributes(_0x243716['body']);return db[_0x4d8e('0x3e')][_0x4d8e('0x3f')]({'where':{'id':_0x243716['params']['id']}})['then'](handleEntityNotFound(_0x2d0a85,null))[_0x4d8e('0x2a')](saveUpdates(_0x243716[_0x4d8e('0x57')],null))['then'](respondWithResult(_0x2d0a85,null))[_0x4d8e('0x40')](handleError(_0x2d0a85,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 3266dad..2b68eb5 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 _0x37af=['save','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x5e0fff,_0x203fe0){var _0x2748c0=function(_0x34a5db){while(--_0x34a5db){_0x5e0fff['push'](_0x5e0fff['shift']());}};_0x2748c0(++_0x203fe0);}(_0x37af,0x18d));var _0xf37a=function(_0x18affb,_0xac5ebe){_0x18affb=_0x18affb-0x0;var _0xef4588=_0x37af[_0x18affb];return _0xef4588;};'use strict';var EventEmitter=require(_0xf37a('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xf37a('0x1')](0x0);var events={'afterCreate':_0xf37a('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3e98c2){return function(_0x44db8d,_0x595d3a,_0x184b5e){DashboardItemEvents['emit'](_0x3e98c2+':'+_0x44db8d['id'],_0x44db8d);DashboardItemEvents[_0xf37a('0x3')](_0x3e98c2,_0x44db8d);_0x184b5e(null);};}for(var e in events){if(events[_0xf37a('0x4')](e)){var event=events[e];DashboardItem[_0xf37a('0x5')](e,emitEvent(event));}}module[_0xf37a('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0x25f6=['../../mysqldb','DashboardItem','setMaxListeners','remove','hasOwnProperty','hook','exports','events'];(function(_0x19c59d,_0x53c490){var _0x26374a=function(_0x47d5eb){while(--_0x47d5eb){_0x19c59d['push'](_0x19c59d['shift']());}};_0x26374a(++_0x53c490);}(_0x25f6,0x197));var _0x625f=function(_0x28b3d7,_0x17b41d){_0x28b3d7=_0x28b3d7-0x0;var _0x49619d=_0x25f6[_0x28b3d7];return _0x49619d;};'use strict';var EventEmitter=require(_0x625f('0x0'));var DashboardItem=require(_0x625f('0x1'))['db'][_0x625f('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x625f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x625f('0x4')};function emitEvent(_0x2e8d99){return function(_0x4b8d99,_0x442e7b,_0x148e21){DashboardItemEvents['emit'](_0x2e8d99+':'+_0x4b8d99['id'],_0x4b8d99);DashboardItemEvents['emit'](_0x2e8d99,_0x4b8d99);_0x148e21(null);};}for(var e in events){if(events[_0x625f('0x5')](e)){var event=events[e];DashboardItem[_0x625f('0x6')](e,emitEvent(event));}}module[_0x625f('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index ef058b6..55366bb 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 _0x95fb=['define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes'];(function(_0x8f9c49,_0x1c7520){var _0x49e938=function(_0x2448f9){while(--_0x2448f9){_0x8f9c49['push'](_0x8f9c49['shift']());}};_0x49e938(++_0x1c7520);}(_0x95fb,0x1d7));var _0xb95f=function(_0x32c022,_0x53de13){_0x32c022=_0x32c022-0x0;var _0x2918bb=_0x95fb[_0x32c022];return _0x2918bb;};'use strict';var _=require(_0xb95f('0x0'));var util=require(_0xb95f('0x1'));var logger=require(_0xb95f('0x2'))(_0xb95f('0x3'));var moment=require('moment');var BPromise=require(_0xb95f('0x4'));var rp=require(_0xb95f('0x5'));var fs=require('fs');var path=require(_0xb95f('0x6'));var rimraf=require(_0xb95f('0x7'));var config=require(_0xb95f('0x8'));var attributes=require(_0xb95f('0x9'));module['exports']=function(_0x41b5ab,_0x3db2e4){return _0x41b5ab[_0xb95f('0xa')](_0xb95f('0xb'),attributes,{'tableName':_0xb95f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c44=['path','../../config/environment','./dashboardItem.attributes','exports','define','dashboard_items','lodash','util','api','bluebird'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x1c44,0x1b4));var _0x41c4=function(_0x42d744,_0x411795){_0x42d744=_0x42d744-0x0;var _0xa28b89=_0x1c44[_0x42d744];return _0xa28b89;};'use strict';var _=require(_0x41c4('0x0'));var util=require(_0x41c4('0x1'));var logger=require('../../config/logger')(_0x41c4('0x2'));var moment=require('moment');var BPromise=require(_0x41c4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x41c4('0x4'));var rimraf=require('rimraf');var config=require(_0x41c4('0x5'));var attributes=require(_0x41c4('0x6'));module[_0x41c4('0x7')]=function(_0x5a4681,_0x161a0c){return _0x5a4681[_0x41c4('0x8')]('DashboardItem',attributes,{'tableName':_0x41c4('0x9'),'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 332171d..a4ea356 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 _0x211f=['stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x211f,0x8c));var _0xf211=function(_0xe779,_0x1a1b29){_0xe779=_0xe779-0x0;var _0x5201de=_0x211f[_0xe779];return _0x5201de;};'use strict';var _=require(_0xf211('0x0'));var util=require(_0xf211('0x1'));var moment=require(_0xf211('0x2'));var BPromise=require('bluebird');var rs=require(_0xf211('0x3'));var fs=require('fs');var Redis=require(_0xf211('0x4'));var db=require(_0xf211('0x5'))['db'];var utils=require(_0xf211('0x6'));var logger=require(_0xf211('0x7'))(_0xf211('0x8'));var config=require(_0xf211('0x9'));var jayson=require(_0xf211('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xf211('0xb')]=_[_0xf211('0xc')](config[_0xf211('0xb')],{'host':_0xf211('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf211('0xb')]));require(_0xf211('0xe'))['register'](socket);function respondWithRpcPromise(_0x232d7a,_0x31da92,_0x2cb302){return new BPromise(function(_0x5d7b56,_0x18fd2e){return client[_0xf211('0xf')](_0x232d7a,_0x2cb302)[_0xf211('0x10')](function(_0x54ef75){logger[_0xf211('0x11')](_0xf211('0x12'),_0x31da92,'request\x20sent');logger[_0xf211('0x13')](_0xf211('0x14'),_0x31da92,_0xf211('0x15'),JSON[_0xf211('0x16')](_0x54ef75));if(_0x54ef75[_0xf211('0x17')]){if(_0x54ef75[_0xf211('0x17')]['code']===0x1f4){logger[_0xf211('0x17')](_0xf211('0x12'),_0x31da92,_0x54ef75[_0xf211('0x17')][_0xf211('0x18')]);return _0x18fd2e(_0x54ef75[_0xf211('0x17')][_0xf211('0x18')]);}logger[_0xf211('0x17')](_0xf211('0x12'),_0x31da92,_0x54ef75[_0xf211('0x17')][_0xf211('0x18')]);return _0x5d7b56(_0x54ef75[_0xf211('0x17')]['message']);}else{logger[_0xf211('0x11')](_0xf211('0x12'),_0x31da92,_0xf211('0x15'));_0x5d7b56(_0x54ef75[_0xf211('0x19')][_0xf211('0x18')]);}})[_0xf211('0x1a')](function(_0x2835b8){logger['error'](_0xf211('0x12'),_0x31da92,_0x2835b8);_0x18fd2e(_0x2835b8);});});} \ No newline at end of file +var _0x55cb=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x3fc2df,_0x276585){var _0x55427d=function(_0xf617dd){while(--_0xf617dd){_0x3fc2df['push'](_0x3fc2df['shift']());}};_0x55427d(++_0x276585);}(_0x55cb,0x13c));var _0xb55c=function(_0x45f6cb,_0x531af6){_0x45f6cb=_0x45f6cb-0x0;var _0x5b7f93=_0x55cb[_0x45f6cb];return _0x5b7f93;};'use strict';var _=require(_0xb55c('0x0'));var util=require(_0xb55c('0x1'));var moment=require(_0xb55c('0x2'));var BPromise=require(_0xb55c('0x3'));var rs=require(_0xb55c('0x4'));var fs=require('fs');var Redis=require(_0xb55c('0x5'));var db=require(_0xb55c('0x6'))['db'];var utils=require(_0xb55c('0x7'));var logger=require(_0xb55c('0x8'))(_0xb55c('0x9'));var config=require(_0xb55c('0xa'));var jayson=require(_0xb55c('0xb'));var client=jayson['client'][_0xb55c('0xc')]({'port':0x232a});config[_0xb55c('0xd')]=_[_0xb55c('0xe')](config[_0xb55c('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xb55c('0xf'))(new Redis(config[_0xb55c('0xd')]));require('./dashboardItem.socket')[_0xb55c('0x10')](socket);function respondWithRpcPromise(_0x34931b,_0x3c4831,_0x505c94){return new BPromise(function(_0x547d6f,_0xe33c01){return client[_0xb55c('0x11')](_0x34931b,_0x505c94)[_0xb55c('0x12')](function(_0x2b9f5f){logger[_0xb55c('0x13')]('DashboardItem,\x20%s,\x20%s',_0x3c4831,_0xb55c('0x14'));logger[_0xb55c('0x15')](_0xb55c('0x16'),_0x3c4831,'request\x20sent',JSON['stringify'](_0x2b9f5f));if(_0x2b9f5f[_0xb55c('0x17')]){if(_0x2b9f5f[_0xb55c('0x17')][_0xb55c('0x18')]===0x1f4){logger[_0xb55c('0x17')](_0xb55c('0x19'),_0x3c4831,_0x2b9f5f[_0xb55c('0x17')][_0xb55c('0x1a')]);return _0xe33c01(_0x2b9f5f[_0xb55c('0x17')][_0xb55c('0x1a')]);}logger[_0xb55c('0x17')](_0xb55c('0x19'),_0x3c4831,_0x2b9f5f[_0xb55c('0x17')][_0xb55c('0x1a')]);return _0x547d6f(_0x2b9f5f[_0xb55c('0x17')][_0xb55c('0x1a')]);}else{logger[_0xb55c('0x13')](_0xb55c('0x19'),_0x3c4831,'request\x20sent');_0x547d6f(_0x2b9f5f[_0xb55c('0x1b')]['message']);}})[_0xb55c('0x1c')](function(_0x3bfca0){logger[_0xb55c('0x17')]('DashboardItem,\x20%s,\x20%s',_0x3c4831,_0x3bfca0);_0xe33c01(_0x3bfca0);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 3661ed4..378fa16 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 _0xd17e=['dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener','length'];(function(_0x463f44,_0xc071ff){var _0x304163=function(_0x1cede6){while(--_0x1cede6){_0x463f44['push'](_0x463f44['shift']());}};_0x304163(++_0xc071ff);}(_0xd17e,0x81));var _0xed17=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd17e[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardItemEvents=require(_0xed17('0x0'));var events=[_0xed17('0x1'),_0xed17('0x2'),_0xed17('0x3')];function createListener(_0x1e2f3c,_0x592876){return function(_0x34755d){_0x592876[_0xed17('0x4')](_0x1e2f3c,_0x34755d);};}function removeListener(_0xee92e1,_0x4eaa1a){return function(){DashboardItemEvents[_0xed17('0x5')](_0xee92e1,_0x4eaa1a);};}exports['register']=function(_0x35ba09){for(var _0x1c6613=0x0,_0x3c0556=events[_0xed17('0x6')];_0x1c6613<_0x3c0556;_0x1c6613++){var _0x32ea88=events[_0x1c6613];var _0x5c51d5=createListener(_0xed17('0x7')+_0x32ea88,_0x35ba09);DashboardItemEvents['on'](_0x32ea88,_0x5c51d5);}}; \ No newline at end of file +var _0xf9a2=['length','dashboardItem:','./dashboardItem.events','save','emit','removeListener','register'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xf9a2,0x72));var _0x2f9a=function(_0x4f7a5a,_0x2b8b5b){_0x4f7a5a=_0x4f7a5a-0x0;var _0x101223=_0xf9a2[_0x4f7a5a];return _0x101223;};'use strict';var DashboardItemEvents=require(_0x2f9a('0x0'));var events=[_0x2f9a('0x1'),'remove','update'];function createListener(_0x144d67,_0x439d25){return function(_0x3b7c31){_0x439d25[_0x2f9a('0x2')](_0x144d67,_0x3b7c31);};}function removeListener(_0x393083,_0x155d0a){return function(){DashboardItemEvents[_0x2f9a('0x3')](_0x393083,_0x155d0a);};}exports[_0x2f9a('0x4')]=function(_0x52d045){for(var _0x5d0e2a=0x0,_0x21c277=events[_0x2f9a('0x5')];_0x5d0e2a<_0x21c277;_0x5d0e2a++){var _0xcbef73=events[_0x5d0e2a];var _0x44f73d=createListener(_0x2f9a('0x6')+_0xcbef73,_0x52d045);DashboardItemEvents['on'](_0xcbef73,_0x44f73d);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index da3344f..aa2ef85 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 _0xf2ca=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','post','create','put','delete'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x1221e8,_0x2e7229){_0x1221e8=_0x1221e8-0x0;var _0x3f3041=_0xf2ca[_0x1221e8];return _0x3f3041;};'use strict';var multer=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var path=require(_0xaf2c('0x2'));var timeout=require('connect-timeout');var express=require(_0xaf2c('0x3'));var router=express[_0xaf2c('0x4')]();var auth=require(_0xaf2c('0x5'));var interaction=require(_0xaf2c('0x6'));var config=require(_0xaf2c('0x7'));var controller=require(_0xaf2c('0x8'));router['get'](_0xaf2c('0x9'),auth[_0xaf2c('0xa')](),controller[_0xaf2c('0xb')]);router[_0xaf2c('0xc')]('/',auth['isAuthenticated'](),controller[_0xaf2c('0xd')]);router[_0xaf2c('0xe')]('/:id',auth[_0xaf2c('0xa')](),controller['update']);router[_0xaf2c('0xf')]('/:id',auth[_0xaf2c('0xa')](),controller[_0xaf2c('0x10')]);module[_0xaf2c('0x11')]=router; \ No newline at end of file +var _0x7fbe=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','put','update','destroy','exports','path'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x3de01a,_0xcc1fd4){_0x3de01a=_0x3de01a-0x0;var _0x43f31e=_0x7fbe[_0x3de01a];return _0x43f31e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var auth=require(_0xe7fb('0x4'));var interaction=require(_0xe7fb('0x5'));var config=require(_0xe7fb('0x6'));var controller=require(_0xe7fb('0x7'));router[_0xe7fb('0x8')](_0xe7fb('0x9'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0xc')]('/',auth[_0xe7fb('0xa')](),controller['create']);router[_0xe7fb('0xd')](_0xe7fb('0x9'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xe')]);router['delete']('/:id',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);module[_0xe7fb('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index f86c4ef..c2cc1eb 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 _0x92f2=['exports','STRING','sequelize'];(function(_0x4070eb,_0x3dbe65){var _0x6602f4=function(_0x3c5f86){while(--_0x3c5f86){_0x4070eb['push'](_0x4070eb['shift']());}};_0x6602f4(++_0x3dbe65);}(_0x92f2,0x14c));var _0x292f=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x92f2[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x292f('0x0'));module[_0x292f('0x1')]={'name':{'type':Sequelize[_0x292f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x63a9=['sequelize','STRING'];(function(_0x281353,_0x5d53a9){var _0x4f4e7b=function(_0x43ade6){while(--_0x43ade6){_0x281353['push'](_0x281353['shift']());}};_0x4f4e7b(++_0x5d53a9);}(_0x63a9,0x192));var _0x963a=function(_0x1c3701,_0x57a048){_0x1c3701=_0x1c3701-0x0;var _0x489349=_0x63a9[_0x1c3701];return _0x489349;};'use strict';var Sequelize=require(_0x963a('0x0'));module['exports']={'name':{'type':Sequelize[_0x963a('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 6bb511f..4b66d5d 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 _0x0385=['includeAll','include','findAll','catch','show','params','keys','find','create','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','apply','save','update','destroy','get','UserProfileResource','then','error','stack','index','map','Disposition','rawAttributes','type','key','model','name','query','intersection','fields','attributes','length','limit','sort','where','filters','merge','VIRTUAL','filter','options'];(function(_0x404bba,_0x566859){var _0x214e84=function(_0x1735e9){while(--_0x1735e9){_0x404bba['push'](_0x404bba['shift']());}};_0x214e84(++_0x566859);}(_0x0385,0x133));var _0x5038=function(_0x12bd5f,_0x46ed10){_0x12bd5f=_0x12bd5f-0x0;var _0x2f348e=_0x0385[_0x12bd5f];return _0x2f348e;};'use strict';var pdf=require(_0x5038('0x0'));var emlformat=require(_0x5038('0x1'));var rimraf=require(_0x5038('0x2'));var zipdir=require(_0x5038('0x3'));var jsonpatch=require(_0x5038('0x4'));var rp=require(_0x5038('0x5'));var moment=require(_0x5038('0x6'));var BPromise=require(_0x5038('0x7'));var Mustache=require(_0x5038('0x8'));var util=require(_0x5038('0x9'));var path=require(_0x5038('0xa'));var sox=require(_0x5038('0xb'));var csv=require('to-csv');var ejs=require(_0x5038('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5038('0xd'));var crypto=require(_0x5038('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5038('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5038('0x10'));var authService=require(_0x5038('0x11'));var qs=require(_0x5038('0x12'));var as=require(_0x5038('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x5038('0x14'));var db=require(_0x5038('0x15'))['db'];function respondWithStatusCode(_0x155afb,_0x63bc57){_0x63bc57=_0x63bc57||0xcc;return function(_0x48a05f){if(_0x48a05f){return _0x155afb[_0x5038('0x16')](_0x63bc57);}return _0x155afb[_0x5038('0x17')](_0x63bc57)[_0x5038('0x18')]();};}function respondWithResult(_0x8ee37e,_0x478870){_0x478870=_0x478870||0xc8;return function(_0x22f957){if(_0x22f957){return _0x8ee37e[_0x5038('0x17')](_0x478870)['json'](_0x22f957);}};}function respondWithFilteredResult(_0x1cdb98,_0x355b73){return function(_0x2ad23a){if(_0x2ad23a){var _0xf9cf54=_0x2ad23a[_0x5038('0x19')],_0x52c45e=_0x355b73['offset'],_0x1aa21b=_0x355b73[_0x5038('0x1a')]+_0x355b73['limit'],_0x4144e3;if(_0x1aa21b>=_0xf9cf54){_0x1aa21b=_0xf9cf54;_0x4144e3=0xc8;}else{_0x4144e3=0xce;}_0x1cdb98[_0x5038('0x17')](_0x4144e3);return _0x1cdb98[_0x5038('0x1b')]('Content-Range',_0x52c45e+'-'+_0x1aa21b+'/'+_0xf9cf54)['json'](_0x2ad23a);}return null;};}function patchUpdates(_0x4fc7d7){return function(_0x808de6){try{jsonpatch[_0x5038('0x1c')](_0x808de6,_0x4fc7d7,!![]);}catch(_0x2bca3c){return BPromise['reject'](_0x2bca3c);}return _0x808de6[_0x5038('0x1d')]();};}function saveUpdates(_0x3c817f,_0x21cde6){return function(_0x188a65){if(_0x188a65){return _0x188a65[_0x5038('0x1e')](_0x3c817f)['then'](function(_0x18cc88){return _0x18cc88;});}return null;};}function removeEntity(_0x13149a,_0x2dab07){return function(_0x295375){if(_0x295375){return _0x295375[_0x5038('0x1f')]()['then'](function(){var _0xe1f9ea=_0x295375[_0x5038('0x20')]({'plain':!![]});var _0x472db1='Dispositions';return db[_0x5038('0x21')][_0x5038('0x1f')]({'where':{'type':_0x472db1,'resourceId':_0xe1f9ea['id']}})[_0x5038('0x22')](function(){return _0x295375;});})['then'](function(){_0x13149a['status'](0xcc)[_0x5038('0x18')]();});}};}function handleEntityNotFound(_0x39aad8,_0x30f64b){return function(_0x47555f){if(!_0x47555f){_0x39aad8[_0x5038('0x16')](0x194);}return _0x47555f;};}function handleError(_0x27e711,_0x2c507a){_0x2c507a=_0x2c507a||0x1f4;return function(_0x5f021c){logger[_0x5038('0x23')](_0x5f021c[_0x5038('0x24')]);if(_0x5f021c['name']){delete _0x5f021c['name'];}_0x27e711[_0x5038('0x17')](_0x2c507a)['send'](_0x5f021c);};}exports[_0x5038('0x25')]=function(_0x53362e,_0x1e3a83){var _0x40b73d={},_0x4474de={},_0x376a84={'count':0x0,'rows':[]};var _0x4098b9=_[_0x5038('0x26')](db[_0x5038('0x27')][_0x5038('0x28')],function(_0x5bcc75){return{'name':_0x5bcc75['fieldName'],'type':_0x5bcc75[_0x5038('0x29')][_0x5038('0x2a')]};});_0x4474de[_0x5038('0x2b')]=_[_0x5038('0x26')](_0x4098b9,_0x5038('0x2c'));_0x4474de[_0x5038('0x2d')]=_['keys'](_0x53362e['query']);_0x4474de['filters']=_[_0x5038('0x2e')](_0x4474de['model'],_0x4474de[_0x5038('0x2d')]);_0x40b73d['attributes']=_[_0x5038('0x2e')](_0x4474de['model'],qs[_0x5038('0x2f')](_0x53362e[_0x5038('0x2d')][_0x5038('0x2f')]));_0x40b73d[_0x5038('0x30')]=_0x40b73d[_0x5038('0x30')][_0x5038('0x31')]?_0x40b73d['attributes']:_0x4474de[_0x5038('0x2b')];if(!_0x53362e[_0x5038('0x2d')]['hasOwnProperty']('nolimit')){_0x40b73d[_0x5038('0x32')]=qs[_0x5038('0x32')](_0x53362e[_0x5038('0x2d')][_0x5038('0x32')]);_0x40b73d[_0x5038('0x1a')]=qs['offset'](_0x53362e['query'][_0x5038('0x1a')]);}_0x40b73d['order']=qs[_0x5038('0x33')](_0x53362e['query']['sort']);_0x40b73d[_0x5038('0x34')]=qs[_0x5038('0x35')](_['pick'](_0x53362e[_0x5038('0x2d')],_0x4474de[_0x5038('0x35')]),_0x4098b9);if(_0x53362e[_0x5038('0x2d')]['filter']){_0x40b73d[_0x5038('0x34')]=_[_0x5038('0x36')](_0x40b73d[_0x5038('0x34')],{'$or':_[_0x5038('0x26')](_0x4098b9,function(_0x58f369){if(_0x58f369[_0x5038('0x29')]!==_0x5038('0x37')){var _0x50a2a2={};_0x50a2a2[_0x58f369['name']]={'$like':'%'+_0x53362e[_0x5038('0x2d')][_0x5038('0x38')]+'%'};return _0x50a2a2;}})});}_0x40b73d=_['merge']({},_0x40b73d,_0x53362e[_0x5038('0x39')]);var _0x5cda9f={'where':_0x40b73d[_0x5038('0x34')]};return db[_0x5038('0x27')][_0x5038('0x19')](_0x5cda9f)[_0x5038('0x22')](function(_0x43205b){_0x376a84[_0x5038('0x19')]=_0x43205b;if(_0x53362e[_0x5038('0x2d')][_0x5038('0x3a')]){_0x40b73d[_0x5038('0x3b')]=[{'all':!![]}];}return db[_0x5038('0x27')][_0x5038('0x3c')](_0x40b73d);})['then'](function(_0x10a091){_0x376a84['rows']=_0x10a091;return _0x376a84;})[_0x5038('0x22')](respondWithFilteredResult(_0x1e3a83,_0x40b73d))[_0x5038('0x3d')](handleError(_0x1e3a83,null));};exports[_0x5038('0x3e')]=function(_0x274935,_0x216972){var _0x339d64={'raw':!![],'where':{'id':_0x274935[_0x5038('0x3f')]['id']}},_0x3f2f91={};_0x3f2f91['model']=_['keys'](db[_0x5038('0x27')]['rawAttributes']);_0x3f2f91[_0x5038('0x2d')]=_[_0x5038('0x40')](_0x274935[_0x5038('0x2d')]);_0x3f2f91[_0x5038('0x35')]=_['intersection'](_0x3f2f91[_0x5038('0x2b')],_0x3f2f91[_0x5038('0x2d')]);_0x339d64[_0x5038('0x30')]=_[_0x5038('0x2e')](_0x3f2f91[_0x5038('0x2b')],qs[_0x5038('0x2f')](_0x274935[_0x5038('0x2d')][_0x5038('0x2f')]));_0x339d64[_0x5038('0x30')]=_0x339d64[_0x5038('0x30')][_0x5038('0x31')]?_0x339d64[_0x5038('0x30')]:_0x3f2f91[_0x5038('0x2b')];if(_0x274935[_0x5038('0x2d')][_0x5038('0x3a')]){_0x339d64[_0x5038('0x3b')]=[{'all':!![]}];}_0x339d64=_[_0x5038('0x36')]({},_0x339d64,_0x274935[_0x5038('0x39')]);return db[_0x5038('0x27')][_0x5038('0x41')](_0x339d64)['then'](handleEntityNotFound(_0x216972,null))['then'](respondWithResult(_0x216972,null))[_0x5038('0x3d')](handleError(_0x216972,null));};exports[_0x5038('0x42')]=function(_0x54637c,_0x35fbc7){return db[_0x5038('0x27')][_0x5038('0x42')](_0x54637c['body'],{})[_0x5038('0x22')](function(_0x1b472c){var _0x39713b=_0x54637c[_0x5038('0x43')][_0x5038('0x20')]({'plain':!![]});if(!_0x39713b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39713b[_0x5038('0x44')]===_0x5038('0x43')){var _0x514f15=_0x1b472c[_0x5038('0x20')]({'plain':!![]});var _0x4c30c7='Dispositions';return db['UserProfileSection'][_0x5038('0x41')]({'where':{'name':_0x4c30c7,'userProfileId':_0x39713b[_0x5038('0x45')]},'raw':!![]})[_0x5038('0x22')](function(_0x11f8b2){if(_0x11f8b2&&_0x11f8b2[_0x5038('0x46')]===0x0){return db[_0x5038('0x21')][_0x5038('0x42')]({'name':_0x514f15['name'],'resourceId':_0x514f15['id'],'type':_0x11f8b2[_0x5038('0x2c')],'sectionId':_0x11f8b2['id']},{})['then'](function(){return _0x1b472c;});}else{return _0x1b472c;}})[_0x5038('0x3d')](function(_0x4ada99){logger['error'](_0x5038('0x47'),_0x4ada99);throw _0x4ada99;});}return _0x1b472c;})['then'](respondWithResult(_0x35fbc7,0xc9))[_0x5038('0x3d')](handleError(_0x35fbc7,null));};exports[_0x5038('0x1e')]=function(_0x5909d7,_0x55c454){if(_0x5909d7['body']['id']){delete _0x5909d7[_0x5038('0x48')]['id'];}return db[_0x5038('0x27')][_0x5038('0x41')]({'where':{'id':_0x5909d7[_0x5038('0x3f')]['id']}})[_0x5038('0x22')](handleEntityNotFound(_0x55c454,null))['then'](saveUpdates(_0x5909d7['body'],null))[_0x5038('0x22')](respondWithResult(_0x55c454,null))['catch'](handleError(_0x55c454,null));};exports[_0x5038('0x1f')]=function(_0xb2d107,_0x3b3c94){return db[_0x5038('0x27')][_0x5038('0x41')]({'where':{'id':_0xb2d107[_0x5038('0x3f')]['id']}})[_0x5038('0x22')](handleEntityNotFound(_0x3b3c94,null))['then'](removeEntity(_0x3b3c94,null))['catch'](handleError(_0x3b3c94,null));}; \ No newline at end of file +var _0x7065=['querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','save','then','destroy','get','Dispositions','error','stack','name','send','index','Disposition','rawAttributes','fieldName','type','map','query','keys','intersection','attributes','fields','length','model','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','to-csv'];(function(_0x25707b,_0x125df2){var _0xa18ef6=function(_0x1cd94f){while(--_0x1cd94f){_0x25707b['push'](_0x25707b['shift']());}};_0xa18ef6(++_0x125df2);}(_0x7065,0x8e));var _0x5706=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7065[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x5706('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5706('0x1'));var jsonpatch=require(_0x5706('0x2'));var rp=require(_0x5706('0x3'));var moment=require(_0x5706('0x4'));var BPromise=require(_0x5706('0x5'));var Mustache=require(_0x5706('0x6'));var util=require('util');var path=require(_0x5706('0x7'));var sox=require(_0x5706('0x8'));var csv=require('to-csv');var ejs=require(_0x5706('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5706('0xa'));var crypto=require(_0x5706('0xb'));var jsforce=require(_0x5706('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5706('0xd'));var querystring=require(_0x5706('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5706('0xf'));var as=require(_0x5706('0x10'));var hardwareService=require(_0x5706('0x11'));var logger=require(_0x5706('0x12'))(_0x5706('0x13'));var utils=require(_0x5706('0x14'));var config=require(_0x5706('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x354951,_0x1c3a1b){_0x1c3a1b=_0x1c3a1b||0xcc;return function(_0x278cee){if(_0x278cee){return _0x354951[_0x5706('0x16')](_0x1c3a1b);}return _0x354951[_0x5706('0x17')](_0x1c3a1b)[_0x5706('0x18')]();};}function respondWithResult(_0x5a4af1,_0x3a14f3){_0x3a14f3=_0x3a14f3||0xc8;return function(_0x28767b){if(_0x28767b){return _0x5a4af1['status'](_0x3a14f3)[_0x5706('0x19')](_0x28767b);}};}function respondWithFilteredResult(_0x1df967,_0x371224){return function(_0x82d366){if(_0x82d366){var _0x14de9d=_0x82d366[_0x5706('0x1a')],_0x53793d=_0x371224[_0x5706('0x1b')],_0x14a77f=_0x371224[_0x5706('0x1b')]+_0x371224['limit'],_0x5aa784;if(_0x14a77f>=_0x14de9d){_0x14a77f=_0x14de9d;_0x5aa784=0xc8;}else{_0x5aa784=0xce;}_0x1df967[_0x5706('0x17')](_0x5aa784);return _0x1df967[_0x5706('0x1c')](_0x5706('0x1d'),_0x53793d+'-'+_0x14a77f+'/'+_0x14de9d)['json'](_0x82d366);}return null;};}function patchUpdates(_0x5ca198){return function(_0x5c3067){try{jsonpatch['apply'](_0x5c3067,_0x5ca198,!![]);}catch(_0x34c075){return BPromise['reject'](_0x34c075);}return _0x5c3067[_0x5706('0x1e')]();};}function saveUpdates(_0x292973,_0x1faf59){return function(_0x44235c){if(_0x44235c){return _0x44235c['update'](_0x292973)[_0x5706('0x1f')](function(_0x576971){return _0x576971;});}return null;};}function removeEntity(_0x34c016,_0x1aebf5){return function(_0x20723){if(_0x20723){return _0x20723[_0x5706('0x20')]()[_0x5706('0x1f')](function(){var _0x3ffec6=_0x20723[_0x5706('0x21')]({'plain':!![]});var _0x59e448=_0x5706('0x22');return db['UserProfileResource'][_0x5706('0x20')]({'where':{'type':_0x59e448,'resourceId':_0x3ffec6['id']}})[_0x5706('0x1f')](function(){return _0x20723;});})[_0x5706('0x1f')](function(){_0x34c016['status'](0xcc)[_0x5706('0x18')]();});}};}function handleEntityNotFound(_0x4531bd,_0x21a4f6){return function(_0x303e90){if(!_0x303e90){_0x4531bd[_0x5706('0x16')](0x194);}return _0x303e90;};}function handleError(_0x563832,_0xe397bc){_0xe397bc=_0xe397bc||0x1f4;return function(_0x492b51){logger[_0x5706('0x23')](_0x492b51[_0x5706('0x24')]);if(_0x492b51[_0x5706('0x25')]){delete _0x492b51[_0x5706('0x25')];}_0x563832[_0x5706('0x17')](_0xe397bc)[_0x5706('0x26')](_0x492b51);};}exports[_0x5706('0x27')]=function(_0x2a0567,_0xe0590a){var _0x594d64={},_0x5238e7={},_0xe5b8ef={'count':0x0,'rows':[]};var _0x5904ce=_['map'](db[_0x5706('0x28')][_0x5706('0x29')],function(_0x2ada32){return{'name':_0x2ada32[_0x5706('0x2a')],'type':_0x2ada32[_0x5706('0x2b')]['key']};});_0x5238e7['model']=_[_0x5706('0x2c')](_0x5904ce,_0x5706('0x25'));_0x5238e7[_0x5706('0x2d')]=_[_0x5706('0x2e')](_0x2a0567[_0x5706('0x2d')]);_0x5238e7['filters']=_[_0x5706('0x2f')](_0x5238e7['model'],_0x5238e7[_0x5706('0x2d')]);_0x594d64[_0x5706('0x30')]=_['intersection'](_0x5238e7['model'],qs['fields'](_0x2a0567[_0x5706('0x2d')][_0x5706('0x31')]));_0x594d64[_0x5706('0x30')]=_0x594d64['attributes'][_0x5706('0x32')]?_0x594d64[_0x5706('0x30')]:_0x5238e7[_0x5706('0x33')];if(!_0x2a0567[_0x5706('0x2d')]['hasOwnProperty']('nolimit')){_0x594d64[_0x5706('0x34')]=qs[_0x5706('0x34')](_0x2a0567[_0x5706('0x2d')][_0x5706('0x34')]);_0x594d64[_0x5706('0x1b')]=qs['offset'](_0x2a0567['query'][_0x5706('0x1b')]);}_0x594d64[_0x5706('0x35')]=qs[_0x5706('0x36')](_0x2a0567['query'][_0x5706('0x36')]);_0x594d64[_0x5706('0x37')]=qs[_0x5706('0x38')](_[_0x5706('0x39')](_0x2a0567[_0x5706('0x2d')],_0x5238e7[_0x5706('0x38')]),_0x5904ce);if(_0x2a0567['query'][_0x5706('0x3a')]){_0x594d64['where']=_[_0x5706('0x3b')](_0x594d64[_0x5706('0x37')],{'$or':_[_0x5706('0x2c')](_0x5904ce,function(_0x108015){if(_0x108015[_0x5706('0x2b')]!==_0x5706('0x3c')){var _0x37e061={};_0x37e061[_0x108015['name']]={'$like':'%'+_0x2a0567[_0x5706('0x2d')][_0x5706('0x3a')]+'%'};return _0x37e061;}})});}_0x594d64=_[_0x5706('0x3b')]({},_0x594d64,_0x2a0567[_0x5706('0x3d')]);var _0x47573a={'where':_0x594d64[_0x5706('0x37')]};return db[_0x5706('0x28')][_0x5706('0x1a')](_0x47573a)[_0x5706('0x1f')](function(_0x3578d3){_0xe5b8ef[_0x5706('0x1a')]=_0x3578d3;if(_0x2a0567['query'][_0x5706('0x3e')]){_0x594d64[_0x5706('0x3f')]=[{'all':!![]}];}return db[_0x5706('0x28')]['findAll'](_0x594d64);})[_0x5706('0x1f')](function(_0x350453){_0xe5b8ef[_0x5706('0x40')]=_0x350453;return _0xe5b8ef;})[_0x5706('0x1f')](respondWithFilteredResult(_0xe0590a,_0x594d64))[_0x5706('0x41')](handleError(_0xe0590a,null));};exports[_0x5706('0x42')]=function(_0x2e309e,_0x433aa1){var _0x5e2d0f={'raw':!![],'where':{'id':_0x2e309e['params']['id']}},_0xf97743={};_0xf97743[_0x5706('0x33')]=_['keys'](db['Disposition']['rawAttributes']);_0xf97743[_0x5706('0x2d')]=_[_0x5706('0x2e')](_0x2e309e[_0x5706('0x2d')]);_0xf97743[_0x5706('0x38')]=_['intersection'](_0xf97743['model'],_0xf97743['query']);_0x5e2d0f[_0x5706('0x30')]=_['intersection'](_0xf97743[_0x5706('0x33')],qs[_0x5706('0x31')](_0x2e309e[_0x5706('0x2d')][_0x5706('0x31')]));_0x5e2d0f[_0x5706('0x30')]=_0x5e2d0f[_0x5706('0x30')][_0x5706('0x32')]?_0x5e2d0f[_0x5706('0x30')]:_0xf97743[_0x5706('0x33')];if(_0x2e309e[_0x5706('0x2d')][_0x5706('0x3e')]){_0x5e2d0f[_0x5706('0x3f')]=[{'all':!![]}];}_0x5e2d0f=_[_0x5706('0x3b')]({},_0x5e2d0f,_0x2e309e[_0x5706('0x3d')]);return db['Disposition'][_0x5706('0x43')](_0x5e2d0f)[_0x5706('0x1f')](handleEntityNotFound(_0x433aa1,null))['then'](respondWithResult(_0x433aa1,null))[_0x5706('0x41')](handleError(_0x433aa1,null));};exports[_0x5706('0x44')]=function(_0x1d5912,_0x43a887){return db['Disposition']['create'](_0x1d5912[_0x5706('0x45')],{})[_0x5706('0x1f')](function(_0x2b273a){var _0x1f7916=_0x1d5912[_0x5706('0x46')][_0x5706('0x21')]({'plain':!![]});if(!_0x1f7916)throw new Error(_0x5706('0x47'));if(_0x1f7916[_0x5706('0x48')]===_0x5706('0x46')){var _0x4213e9=_0x2b273a['get']({'plain':!![]});var _0x2b732c=_0x5706('0x22');return db[_0x5706('0x49')][_0x5706('0x43')]({'where':{'name':_0x2b732c,'userProfileId':_0x1f7916['userProfileId']},'raw':!![]})['then'](function(_0x2d2998){if(_0x2d2998&&_0x2d2998[_0x5706('0x4a')]===0x0){return db['UserProfileResource'][_0x5706('0x44')]({'name':_0x4213e9[_0x5706('0x25')],'resourceId':_0x4213e9['id'],'type':_0x2d2998[_0x5706('0x25')],'sectionId':_0x2d2998['id']},{})[_0x5706('0x1f')](function(){return _0x2b273a;});}else{return _0x2b273a;}})[_0x5706('0x41')](function(_0x39597c){logger['error'](_0x5706('0x4b'),_0x39597c);throw _0x39597c;});}return _0x2b273a;})[_0x5706('0x1f')](respondWithResult(_0x43a887,0xc9))['catch'](handleError(_0x43a887,null));};exports[_0x5706('0x4c')]=function(_0x191cb9,_0x5db59b){if(_0x191cb9[_0x5706('0x45')]['id']){delete _0x191cb9['body']['id'];}return db[_0x5706('0x28')][_0x5706('0x43')]({'where':{'id':_0x191cb9['params']['id']}})['then'](handleEntityNotFound(_0x5db59b,null))[_0x5706('0x1f')](saveUpdates(_0x191cb9[_0x5706('0x45')],null))[_0x5706('0x1f')](respondWithResult(_0x5db59b,null))['catch'](handleError(_0x5db59b,null));};exports[_0x5706('0x20')]=function(_0x56a9f1,_0x47089b){return db[_0x5706('0x28')][_0x5706('0x43')]({'where':{'id':_0x56a9f1[_0x5706('0x4d')]['id']}})['then'](handleEntityNotFound(_0x47089b,null))[_0x5706('0x1f')](removeEntity(_0x47089b,null))[_0x5706('0x41')](handleError(_0x47089b,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index a8ee684..f2e1e3e 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 _0x3cb3=['path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','name_chat','name_sms','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x1f81d1,_0x50207e){var _0x53442e=function(_0x2329bc){while(--_0x2329bc){_0x1f81d1['push'](_0x1f81d1['shift']());}};_0x53442e(++_0x50207e);}(_0x3cb3,0x13c));var _0x33cb=function(_0x2f4f21,_0x41d7f2){_0x2f4f21=_0x2f4f21-0x0;var _0x30fa58=_0x3cb3[_0x2f4f21];return _0x30fa58;};'use strict';var _=require(_0x33cb('0x0'));var util=require(_0x33cb('0x1'));var logger=require(_0x33cb('0x2'))('api');var moment=require(_0x33cb('0x3'));var BPromise=require(_0x33cb('0x4'));var rp=require(_0x33cb('0x5'));var fs=require('fs');var path=require(_0x33cb('0x6'));var rimraf=require(_0x33cb('0x7'));var config=require(_0x33cb('0x8'));var attributes=require(_0x33cb('0x9'));module[_0x33cb('0xa')]=function(_0x1f8d5f,_0x3eb5e1){return _0x1f8d5f[_0x33cb('0xb')](_0x33cb('0xc'),attributes,{'tableName':_0x33cb('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x33cb('0xe'),'fields':[_0x33cb('0xf'),'ListId']},{'unique':!![],'name':_0x33cb('0x10'),'fields':[_0x33cb('0xf'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0x33cb('0xf'),'MailAccountId']},{'unique':!![],'name':_0x33cb('0x11'),'fields':['name','SmsAccountId']},{'unique':!![],'name':_0x33cb('0x12'),'fields':[_0x33cb('0xf'),'FaxAccountId']},{'unique':!![],'name':_0x33cb('0x13'),'fields':[_0x33cb('0xf'),_0x33cb('0x14')]},{'unique':!![],'name':_0x33cb('0x15'),'fields':[_0x33cb('0xf'),_0x33cb('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6305=['rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','name','ListId','name_chat','name_mail','SmsAccountId','name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','../../config/logger','api','moment','bluebird','path'];(function(_0x4c165f,_0x368235){var _0x22e906=function(_0x35836a){while(--_0x35836a){_0x4c165f['push'](_0x4c165f['shift']());}};_0x22e906(++_0x368235);}(_0x6305,0x10c));var _0x5630=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6305[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5630('0x0'))(_0x5630('0x1'));var moment=require(_0x5630('0x2'));var BPromise=require(_0x5630('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5630('0x4'));var rimraf=require(_0x5630('0x5'));var config=require(_0x5630('0x6'));var attributes=require(_0x5630('0x7'));module[_0x5630('0x8')]=function(_0x280c25,_0x28bcd7){return _0x280c25[_0x5630('0x9')](_0x5630('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x5630('0xb'),_0x5630('0xc')]},{'unique':!![],'name':_0x5630('0xd'),'fields':[_0x5630('0xb'),'ChatWebsiteId']},{'unique':!![],'name':_0x5630('0xe'),'fields':['name','MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0x5630('0xb'),_0x5630('0xf')]},{'unique':!![],'name':_0x5630('0x10'),'fields':[_0x5630('0xb'),_0x5630('0x11')]},{'unique':!![],'name':_0x5630('0x12'),'fields':[_0x5630('0xb'),'OpenchannelAccountId']},{'unique':!![],'name':_0x5630('0x13'),'fields':[_0x5630('0xb'),_0x5630('0x14')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index f64ac09..bc9dfca 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 _0x3002=['Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x3002,0x15a));var _0x2300=function(_0x347d1a,_0x2ee55f){_0x347d1a=_0x347d1a-0x0;var _0x175e96=_0x3002[_0x347d1a];return _0x175e96;};'use strict';var _=require(_0x2300('0x0'));var util=require(_0x2300('0x1'));var moment=require(_0x2300('0x2'));var BPromise=require('bluebird');var rs=require(_0x2300('0x3'));var fs=require('fs');var Redis=require(_0x2300('0x4'));var db=require(_0x2300('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2300('0x6'))(_0x2300('0x7'));var config=require(_0x2300('0x8'));var jayson=require(_0x2300('0x9'));var client=jayson[_0x2300('0xa')][_0x2300('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ffdab,_0x51a049,_0x5c10f8){return new BPromise(function(_0x4002ad,_0x253474){return client[_0x2300('0xc')](_0x1ffdab,_0x5c10f8)['then'](function(_0x5c13b1){logger[_0x2300('0xd')](_0x2300('0xe'),_0x51a049,_0x2300('0xf'));logger[_0x2300('0x10')](_0x2300('0x11'),_0x51a049,'request\x20sent',JSON[_0x2300('0x12')](_0x5c13b1));if(_0x5c13b1[_0x2300('0x13')]){if(_0x5c13b1[_0x2300('0x13')][_0x2300('0x14')]===0x1f4){logger[_0x2300('0x13')](_0x2300('0xe'),_0x51a049,_0x5c13b1['error'][_0x2300('0x15')]);return _0x253474(_0x5c13b1['error'][_0x2300('0x15')]);}logger[_0x2300('0x13')](_0x2300('0xe'),_0x51a049,_0x5c13b1['error'][_0x2300('0x15')]);return _0x4002ad(_0x5c13b1[_0x2300('0x13')][_0x2300('0x15')]);}else{logger['info']('Disposition,\x20%s,\x20%s',_0x51a049,'request\x20sent');_0x4002ad(_0x5c13b1[_0x2300('0x16')][_0x2300('0x15')]);}})[_0x2300('0x17')](function(_0x398421){logger[_0x2300('0x13')](_0x2300('0xe'),_0x51a049,_0x398421);_0x253474(_0x398421);});});} \ No newline at end of file +var _0xf239=['debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Disposition,\x20%s,\x20%s','request\x20sent'];(function(_0x4b5d4a,_0x1a3b8f){var _0x307ce4=function(_0x53c585){while(--_0x53c585){_0x4b5d4a['push'](_0x4b5d4a['shift']());}};_0x307ce4(++_0x1a3b8f);}(_0xf239,0x1b8));var _0x9f23=function(_0x3daad2,_0x25d5c9){_0x3daad2=_0x3daad2-0x0;var _0x41e91c=_0xf239[_0x3daad2];return _0x41e91c;};'use strict';var _=require(_0x9f23('0x0'));var util=require(_0x9f23('0x1'));var moment=require(_0x9f23('0x2'));var BPromise=require(_0x9f23('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f23('0x4'));var db=require(_0x9f23('0x5'))['db'];var utils=require(_0x9f23('0x6'));var logger=require(_0x9f23('0x7'))(_0x9f23('0x8'));var config=require(_0x9f23('0x9'));var jayson=require(_0x9f23('0xa'));var client=jayson[_0x9f23('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf3901a,_0x3517d4,_0x2da513){return new BPromise(function(_0x3197ac,_0x31e275){return client[_0x9f23('0xc')](_0xf3901a,_0x2da513)[_0x9f23('0xd')](function(_0x221a72){logger['info'](_0x9f23('0xe'),_0x3517d4,_0x9f23('0xf'));logger[_0x9f23('0x10')](_0x9f23('0x11'),_0x3517d4,'request\x20sent',JSON[_0x9f23('0x12')](_0x221a72));if(_0x221a72[_0x9f23('0x13')]){if(_0x221a72[_0x9f23('0x13')]['code']===0x1f4){logger[_0x9f23('0x13')](_0x9f23('0xe'),_0x3517d4,_0x221a72[_0x9f23('0x13')][_0x9f23('0x14')]);return _0x31e275(_0x221a72[_0x9f23('0x13')][_0x9f23('0x14')]);}logger[_0x9f23('0x13')](_0x9f23('0xe'),_0x3517d4,_0x221a72['error'][_0x9f23('0x14')]);return _0x3197ac(_0x221a72[_0x9f23('0x13')][_0x9f23('0x14')]);}else{logger[_0x9f23('0x15')](_0x9f23('0xe'),_0x3517d4,_0x9f23('0xf'));_0x3197ac(_0x221a72[_0x9f23('0x16')][_0x9f23('0x14')]);}})[_0x9f23('0x17')](function(_0x4419d3){logger[_0x9f23('0x13')]('Disposition,\x20%s,\x20%s',_0x3517d4,_0x4419d3);_0x31e275(_0x4419d3);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index e44e8a9..c20d136 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 _0x119c=['../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','get','show','post','create','put','/:id','update','delete','destroy','util','connect-timeout','express','Router'];(function(_0x42c58f,_0x5cfb7e){var _0x296295=function(_0x55df05){while(--_0x55df05){_0x42c58f['push'](_0x42c58f['shift']());}};_0x296295(++_0x5cfb7e);}(_0x119c,0xea));var _0xc119=function(_0x3e69ae,_0x366e8d){_0x3e69ae=_0x3e69ae-0x0;var _0x3d7f42=_0x119c[_0x3e69ae];return _0x3d7f42;};'use strict';var multer=require('multer');var util=require(_0xc119('0x0'));var path=require('path');var timeout=require(_0xc119('0x1'));var express=require(_0xc119('0x2'));var router=express[_0xc119('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc119('0x4'));var config=require(_0xc119('0x5'));var controller=require(_0xc119('0x6'));router['get']('/',auth[_0xc119('0x7')](),controller['index']);router[_0xc119('0x8')]('/:id',auth[_0xc119('0x7')](),controller[_0xc119('0x9')]);router[_0xc119('0xa')]('/',auth[_0xc119('0x7')](),controller[_0xc119('0xb')]);router[_0xc119('0xc')](_0xc119('0xd'),auth[_0xc119('0x7')](),controller[_0xc119('0xe')]);router[_0xc119('0xf')](_0xc119('0xd'),auth['isAuthenticated'](),controller[_0xc119('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8f25=['/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','./disposition.controller','get','isAuthenticated'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x8f25,0x14b));var _0x58f2=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x8f25[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x58f2('0x0'));var util=require(_0x58f2('0x1'));var path=require(_0x58f2('0x2'));var timeout=require(_0x58f2('0x3'));var express=require(_0x58f2('0x4'));var router=express[_0x58f2('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x58f2('0x6'));router[_0x58f2('0x7')]('/',auth[_0x58f2('0x8')](),controller['index']);router[_0x58f2('0x7')](_0x58f2('0x9'),auth[_0x58f2('0x8')](),controller[_0x58f2('0xa')]);router[_0x58f2('0xb')]('/',auth[_0x58f2('0x8')](),controller[_0x58f2('0xc')]);router[_0x58f2('0xd')]('/:id',auth[_0x58f2('0x8')](),controller[_0x58f2('0xe')]);router[_0x58f2('0xf')](_0x58f2('0x9'),auth[_0x58f2('0x8')](),controller['destroy']);module[_0x58f2('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index d201336..65e853f 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 _0x689a=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','12000','14400','ENUM','v17,v27,v29','INTEGER','SIP','IAX','KHOMP','TEXT'];(function(_0x3e4fac,_0x6f96a5){var _0x46a742=function(_0x41d16a){while(--_0x41d16a){_0x3e4fac['push'](_0x3e4fac['shift']());}};_0x46a742(++_0x6f96a5);}(_0x689a,0x90));var _0xa689=function(_0x5e622f,_0x274b7e){_0x5e622f=_0x5e622f-0x0;var _0x378127=_0x689a[_0x5e622f];return _0x378127;};'use strict';var Sequelize=require(_0xa689('0x0'));module['exports']={'name':{'type':Sequelize[_0xa689('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa689('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0xa689('0x2'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xa689('0x1')],'defaultValue':_0xa689('0x3')},'localstationid':{'type':Sequelize[_0xa689('0x1')],'unique':_0xa689('0x4')},'minrate':{'type':Sequelize['ENUM'](_0xa689('0x5'),_0xa689('0x6'),_0xa689('0x7'),'9600',_0xa689('0x8'),_0xa689('0x9')),'defaultValue':_0xa689('0x6')},'maxrate':{'type':Sequelize[_0xa689('0xa')]('2400',_0xa689('0x6'),_0xa689('0x7'),'9600',_0xa689('0x8'),_0xa689('0x9')),'defaultValue':_0xa689('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xa689('0xb')},'gateway':{'type':Sequelize[_0xa689('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xa689('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xa689('0xa')](_0xa689('0xd'),_0xa689('0xe'),'DADHI',_0xa689('0xf')),'defaultValue':_0xa689('0xd')},'key':{'type':Sequelize[_0xa689('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa689('0x10')],'defaultValue':function(){return _0xa689('0x11');}},'notificationSound':{'type':Sequelize[_0xa689('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa689('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa689('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa689('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa689('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa689('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa689('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa689('0xc')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xa689('0x13'),'set':function(_0x49a66a){if(!_0x49a66a)this[_0xa689('0x14')](_0xa689('0x15'),null);this['setDataValue'](_0xa689('0x16'),_0x49a66a);}}}; \ No newline at end of file +var _0x4da3=['localstationid','4800','7200','12000','9600','14400','v17,v27,v29','INTEGER','SIP','IAX','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax'];(function(_0x1e8fc8,_0x11a543){var _0xc54186=function(_0x2003f9){while(--_0x2003f9){_0x1e8fc8['push'](_0x1e8fc8['shift']());}};_0xc54186(++_0x11a543);}(_0x4da3,0x121));var _0x34da=function(_0x31206d,_0x2d5200){_0x31206d=_0x31206d-0x0;var _0x58d2bc=_0x4da3[_0x31206d];return _0x58d2bc;};'use strict';var Sequelize=require('sequelize');module[_0x34da('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x34da('0x1')]},'ecm':{'type':Sequelize[_0x34da('0x2')](_0x34da('0x3'),'no'),'defaultValue':_0x34da('0x3')},'headerinfo':{'type':Sequelize[_0x34da('0x1')],'defaultValue':_0x34da('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x34da('0x5')},'minrate':{'type':Sequelize[_0x34da('0x2')]('2400',_0x34da('0x6'),_0x34da('0x7'),'9600',_0x34da('0x8'),'14400'),'defaultValue':_0x34da('0x6')},'maxrate':{'type':Sequelize[_0x34da('0x2')]('2400','4800',_0x34da('0x7'),_0x34da('0x9'),'12000',_0x34da('0xa')),'defaultValue':_0x34da('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x34da('0xb')},'gateway':{'type':Sequelize[_0x34da('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x34da('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x34da('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x34da('0xd'),_0x34da('0xe'),'DADHI','KHOMP'),'defaultValue':_0x34da('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x34da('0xf')],'defaultValue':function(){return _0x34da('0x10');}},'notificationSound':{'type':Sequelize[_0x34da('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x34da('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x34da('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x34da('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x34da('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x34da('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x34da('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x34da('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x34da('0x11')],'defaultValue':![],'comment':_0x34da('0x13'),'set':function(_0x169fd5){if(!_0x169fd5)this['setDataValue'](_0x34da('0x14'),null);this['setDataValue']('mandatoryDisposition',_0x169fd5);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index e9ca5f6..bcf282b 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 _0xcdea=['catch','sendStatus','status','json','count','offset','limit','set','apply','reject','update','destroy','FaxAccounts','end','stack','name','index','mandatoryDispositionPause','map','FaxAccount','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','params','Pause','find','create','body','user','get','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','findOne','rawAttributes','hasOwnProperty','nolimit','order','FaxAccountId','options','includeAll','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','push','Answer','CDR(type)=inbound-fax','Set','ecm','faxdetect','maxrate','minrate','modem','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','updateAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','CmContact','Contacts','DESC','attachments','join','root','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x2aab98,_0x35e152){var _0x18c26f=function(_0x6056ef){while(--_0x6056ef){_0x2aab98['push'](_0x2aab98['shift']());}};_0x18c26f(++_0x35e152);}(_0xcdea,0x154));var _0xacde=function(_0x34d275,_0x5d84ee){_0x34d275=_0x34d275-0x0;var _0x1379cc=_0xcdea[_0x34d275];return _0x1379cc;};'use strict';var pdf=require(_0xacde('0x0'));var emlformat=require(_0xacde('0x1'));var rimraf=require(_0xacde('0x2'));var zipdir=require(_0xacde('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xacde('0x4'));var BPromise=require(_0xacde('0x5'));var Mustache=require(_0xacde('0x6'));var util=require(_0xacde('0x7'));var path=require(_0xacde('0x8'));var sox=require(_0xacde('0x9'));var csv=require(_0xacde('0xa'));var ejs=require(_0xacde('0xb'));var fs=require('fs');var _=require(_0xacde('0xc'));var squel=require(_0xacde('0xd'));var crypto=require(_0xacde('0xe'));var jsforce=require(_0xacde('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xacde('0xa'));var querystring=require(_0xacde('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xacde('0x11'));var as=require(_0xacde('0x12'));var hardwareService=require(_0xacde('0x13'));var logger=require(_0xacde('0x14'))(_0xacde('0x15'));var utils=require(_0xacde('0x16'));var config=require(_0xacde('0x17'));var db=require(_0xacde('0x18'))['db'];config[_0xacde('0x19')]=_[_0xacde('0x1a')](config['redis'],{'host':_0xacde('0x1b'),'port':0x18eb});var socket=require(_0xacde('0x1c'))(new Redis(config['redis']));require(_0xacde('0x1d'))[_0xacde('0x1e')](socket);var jayson=require(_0xacde('0x1f'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x5257d8,_0x5269eb,_0x472a3d){if(_0x472a3d){var _0x4fcf27=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4fcf27['test'](_0x5269eb)){return _0x5257d8;}else{throw new db[(_0xacde('0x20'))][(_0xacde('0x21'))](_0xacde('0x22'));}}else{return _0x5257d8;}}function respondWithRpcPromise(_0x16f5d0,_0x15c0ca,_0x24d9ad,_0x2b3549){return new BPromise(function(_0x4b1edf,_0x2f09a9){var _0x584e79=_0x2b3549||client;return _0x584e79['request'](_0x16f5d0,_0x24d9ad)[_0xacde('0x23')](function(_0x4efd1f){logger[_0xacde('0x24')](_0xacde('0x25'),_0x15c0ca,_0xacde('0x26'));logger['debug'](_0xacde('0x27'),_0x15c0ca,_0xacde('0x26'),JSON[_0xacde('0x28')](_0x4efd1f));if(_0x4efd1f['error']){if(_0x4efd1f[_0xacde('0x29')]['code']===0x1f4){logger[_0xacde('0x29')]('FaxAccount,\x20%s,\x20%s',_0x15c0ca,_0x4efd1f[_0xacde('0x29')]['message']);return _0x2f09a9(_0x4efd1f[_0xacde('0x29')][_0xacde('0x2a')]);}logger['error'](_0xacde('0x25'),_0x15c0ca,_0x4efd1f['error'][_0xacde('0x2a')]);return _0x4b1edf(_0x4efd1f['error']['message']);}else{logger[_0xacde('0x24')](_0xacde('0x25'),_0x15c0ca,_0xacde('0x26'));_0x4b1edf(_0x4efd1f[_0xacde('0x2b')]['message']);}})[_0xacde('0x2c')](function(_0x4c32e5){logger[_0xacde('0x29')]('FaxAccount,\x20%s,\x20%s',_0x15c0ca,_0x4c32e5);_0x2f09a9(_0x4c32e5);});});}function respondWithStatusCode(_0x4315d6,_0x53e904){_0x53e904=_0x53e904||0xcc;return function(_0x42362c){if(_0x42362c){return _0x4315d6[_0xacde('0x2d')](_0x53e904);}return _0x4315d6[_0xacde('0x2e')](_0x53e904)['end']();};}function respondWithResult(_0x12326d,_0x271968){_0x271968=_0x271968||0xc8;return function(_0xb0b4f0){if(_0xb0b4f0){return _0x12326d[_0xacde('0x2e')](_0x271968)[_0xacde('0x2f')](_0xb0b4f0);}};}function respondWithFilteredResult(_0x1b73f4,_0x44196f){return function(_0x15df7f){if(_0x15df7f){var _0xa9b5ae=_0x15df7f[_0xacde('0x30')],_0x29f38=_0x44196f[_0xacde('0x31')],_0x197bc1=_0x44196f[_0xacde('0x31')]+_0x44196f[_0xacde('0x32')],_0xda35f6;if(_0x197bc1>=_0xa9b5ae){_0x197bc1=_0xa9b5ae;_0xda35f6=0xc8;}else{_0xda35f6=0xce;}_0x1b73f4[_0xacde('0x2e')](_0xda35f6);return _0x1b73f4[_0xacde('0x33')]('Content-Range',_0x29f38+'-'+_0x197bc1+'/'+_0xa9b5ae)[_0xacde('0x2f')](_0x15df7f);}return null;};}function patchUpdates(_0x5251a8){return function(_0xb83556){try{jsonpatch[_0xacde('0x34')](_0xb83556,_0x5251a8,!![]);}catch(_0x4f2485){return BPromise[_0xacde('0x35')](_0x4f2485);}return _0xb83556['save']();};}function saveUpdates(_0x3debb9,_0x22e003){return function(_0x291dcf){if(_0x291dcf){return _0x291dcf[_0xacde('0x36')](_0x3debb9)[_0xacde('0x23')](function(_0x548b47){return _0x548b47;});}return null;};}function removeEntity(_0x53d860,_0x182a36){return function(_0x5beba7){if(_0x5beba7){return _0x5beba7[_0xacde('0x37')]()[_0xacde('0x23')](function(){var _0x132104=_0x5beba7['get']({'plain':!![]});var _0x21bed7=_0xacde('0x38');return db['UserProfileResource'][_0xacde('0x37')]({'where':{'type':_0x21bed7,'resourceId':_0x132104['id']}})[_0xacde('0x23')](function(){return _0x5beba7;});})[_0xacde('0x23')](function(){_0x53d860[_0xacde('0x2e')](0xcc)[_0xacde('0x39')]();});}};}function handleEntityNotFound(_0x31222d,_0x113c81){return function(_0x3811a7){if(!_0x3811a7){_0x31222d[_0xacde('0x2d')](0x194);}return _0x3811a7;};}function handleError(_0x1c03cf,_0x54acd2){_0x54acd2=_0x54acd2||0x1f4;return function(_0x1039df){logger[_0xacde('0x29')](_0x1039df[_0xacde('0x3a')]);if(_0x1039df[_0xacde('0x3b')]){delete _0x1039df[_0xacde('0x3b')];}_0x1c03cf[_0xacde('0x2e')](_0x54acd2)['send'](_0x1039df);};}exports[_0xacde('0x3c')]=function(_0x3e2c20,_0x11b549){var _0xdaddd6={'include':[{'model':db['Pause'],'as':_0xacde('0x3d')}]},_0x368c8d={},_0x375961={'count':0x0,'rows':[]};var _0x568e6d=_[_0xacde('0x3e')](db[_0xacde('0x3f')]['rawAttributes'],function(_0x314ea6){return{'name':_0x314ea6[_0xacde('0x40')],'type':_0x314ea6[_0xacde('0x41')][_0xacde('0x42')]};});_0x368c8d[_0xacde('0x43')]=_[_0xacde('0x3e')](_0x568e6d,_0xacde('0x3b'));_0x368c8d[_0xacde('0x44')]=_[_0xacde('0x45')](_0x3e2c20[_0xacde('0x44')]);_0x368c8d[_0xacde('0x46')]=_[_0xacde('0x47')](_0x368c8d[_0xacde('0x43')],_0x368c8d[_0xacde('0x44')]);_0xdaddd6['attributes']=_[_0xacde('0x47')](_0x368c8d[_0xacde('0x43')],qs[_0xacde('0x48')](_0x3e2c20['query']['fields']));_0xdaddd6[_0xacde('0x49')]=_0xdaddd6['attributes'][_0xacde('0x4a')]?_0xdaddd6[_0xacde('0x49')]:_0x368c8d[_0xacde('0x43')];if(!_0x3e2c20[_0xacde('0x44')]['hasOwnProperty']('nolimit')){_0xdaddd6['limit']=qs[_0xacde('0x32')](_0x3e2c20[_0xacde('0x44')]['limit']);_0xdaddd6['offset']=qs['offset'](_0x3e2c20[_0xacde('0x44')]['offset']);}_0xdaddd6['order']=qs[_0xacde('0x4b')](_0x3e2c20['query']['sort']);_0xdaddd6[_0xacde('0x4c')]=qs['filters'](_[_0xacde('0x4d')](_0x3e2c20[_0xacde('0x44')],_0x368c8d['filters']),_0x568e6d);if(_0x3e2c20[_0xacde('0x44')]['filter']){_0xdaddd6[_0xacde('0x4c')]=_[_0xacde('0x4e')](_0xdaddd6[_0xacde('0x4c')],{'$or':_[_0xacde('0x3e')](_0x568e6d,function(_0x10cf35){if(_0x10cf35[_0xacde('0x41')]!==_0xacde('0x4f')){var _0x3568bf={};_0x3568bf[_0x10cf35[_0xacde('0x3b')]]={'$like':'%'+_0x3e2c20[_0xacde('0x44')][_0xacde('0x50')]+'%'};return _0x3568bf;}})});}_0xdaddd6=_[_0xacde('0x4e')]({},_0xdaddd6,_0x3e2c20['options']);var _0x369f7a={'where':_0xdaddd6[_0xacde('0x4c')]};return db[_0xacde('0x3f')]['count'](_0x369f7a)['then'](function(_0x3d3098){_0x375961[_0xacde('0x30')]=_0x3d3098;if(_0x3e2c20[_0xacde('0x44')]['includeAll']){_0xdaddd6[_0xacde('0x51')]=[{'all':!![]}];}return db[_0xacde('0x3f')][_0xacde('0x52')](_0xdaddd6);})['then'](function(_0x51bb42){_0x375961[_0xacde('0x53')]=_0x51bb42;return _0x375961;})[_0xacde('0x23')](respondWithFilteredResult(_0x11b549,_0xdaddd6))[_0xacde('0x2c')](handleError(_0x11b549,null));};exports['show']=function(_0x4aeb68,_0xa9966c){var _0x12b139={'raw':![],'where':{'id':_0x4aeb68[_0xacde('0x54')]['id']},'include':[{'model':db[_0xacde('0x55')],'as':'mandatoryDispositionPause'}]},_0x3effa9={};_0x3effa9[_0xacde('0x43')]=_[_0xacde('0x45')](db[_0xacde('0x3f')]['rawAttributes']);_0x3effa9['query']=_[_0xacde('0x45')](_0x4aeb68['query']);_0x3effa9[_0xacde('0x46')]=_['intersection'](_0x3effa9[_0xacde('0x43')],_0x3effa9[_0xacde('0x44')]);_0x12b139[_0xacde('0x49')]=_[_0xacde('0x47')](_0x3effa9[_0xacde('0x43')],qs[_0xacde('0x48')](_0x4aeb68[_0xacde('0x44')]['fields']));_0x12b139[_0xacde('0x49')]=_0x12b139['attributes'][_0xacde('0x4a')]?_0x12b139['attributes']:_0x3effa9[_0xacde('0x43')];if(_0x4aeb68[_0xacde('0x44')]['includeAll']){_0x12b139[_0xacde('0x51')]=[{'all':!![]}];}_0x12b139=_['merge']({},_0x12b139,_0x4aeb68['options']);return db[_0xacde('0x3f')][_0xacde('0x56')](_0x12b139)['then'](handleEntityNotFound(_0xa9966c,null))['then'](respondWithResult(_0xa9966c,null))['catch'](handleError(_0xa9966c,null));};exports[_0xacde('0x57')]=function(_0x44fc23,_0x11e4e1){return db['FaxAccount'][_0xacde('0x57')](_0x44fc23[_0xacde('0x58')],{})[_0xacde('0x23')](function(_0x431050){var _0x5328da=_0x44fc23[_0xacde('0x59')][_0xacde('0x5a')]({'plain':!![]});if(!_0x5328da)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5328da[_0xacde('0x5b')]===_0xacde('0x59')){var _0x271119=_0x431050['get']({'plain':!![]});var _0x5e0754=_0xacde('0x38');return db[_0xacde('0x5c')][_0xacde('0x56')]({'where':{'name':_0x5e0754,'userProfileId':_0x5328da['userProfileId']},'raw':!![]})[_0xacde('0x23')](function(_0x41867f){if(_0x41867f&&_0x41867f['autoAssociation']===0x0){return db[_0xacde('0x5d')][_0xacde('0x57')]({'name':_0x271119[_0xacde('0x3b')],'resourceId':_0x271119['id'],'type':_0x41867f['name'],'sectionId':_0x41867f['id']},{})['then'](function(){return _0x431050;});}else{return _0x431050;}})[_0xacde('0x2c')](function(_0x30bd58){logger[_0xacde('0x29')](_0xacde('0x5e'),_0x30bd58);throw _0x30bd58;});}return _0x431050;})[_0xacde('0x23')](respondWithResult(_0x11e4e1,0xc9))[_0xacde('0x2c')](handleError(_0x11e4e1,null));};exports[_0xacde('0x36')]=function(_0x6adc56,_0x29aaf1){if(_0x6adc56[_0xacde('0x58')]['id']){delete _0x6adc56[_0xacde('0x58')]['id'];}return db['FaxAccount'][_0xacde('0x56')]({'where':{'id':_0x6adc56[_0xacde('0x54')]['id']},'include':[{'model':db[_0xacde('0x55')],'as':_0xacde('0x3d')}]})[_0xacde('0x23')](handleEntityNotFound(_0x29aaf1,null))[_0xacde('0x23')](saveUpdates(_0x6adc56[_0xacde('0x58')],null))[_0xacde('0x23')](respondWithResult(_0x29aaf1,null))[_0xacde('0x2c')](handleError(_0x29aaf1,null));};exports[_0xacde('0x37')]=function(_0xe2dc0f,_0x559a34){return db['FaxAccount'][_0xacde('0x56')]({'where':{'id':_0xe2dc0f[_0xacde('0x54')]['id']}})['then'](handleEntityNotFound(_0x559a34,null))[_0xacde('0x23')](removeEntity(_0x559a34,null))[_0xacde('0x2c')](handleError(_0x559a34,null));};exports[_0xacde('0x5f')]=function(_0x53aa33,_0x273fc0){return db[_0xacde('0x3f')][_0xacde('0x5f')]()['then'](respondWithResult(_0x273fc0,null))[_0xacde('0x2c')](handleError(_0x273fc0,null));};exports[_0xacde('0x60')]=function(_0x1769de,_0x39cf6c,_0x1be2b2){if(_0x1769de[_0xacde('0x58')]['id']){delete _0x1769de[_0xacde('0x58')]['id'];}return db[_0xacde('0x3f')][_0xacde('0x56')]({'where':{'id':_0x1769de[_0xacde('0x54')]['id']}})['then'](handleEntityNotFound(_0x39cf6c,null))[_0xacde('0x23')](function(_0x4734ef){if(_0x4734ef){_0x1769de[_0xacde('0x58')]['FaxAccountId']=_0x4734ef['id'];return db[_0xacde('0x61')][_0xacde('0x57')](_0x1769de[_0xacde('0x58')]);}})['then'](respondWithResult(_0x39cf6c,null))[_0xacde('0x2c')](handleError(_0x39cf6c,null));};exports['getDispositions']=function(_0x5b2eb6,_0x524ce7,_0x579089){var _0x58408b={'raw':![],'where':{}};var _0x4af33d={};var _0x1230ac={'count':0x0,'rows':[]};return db[_0xacde('0x3f')][_0xacde('0x62')]({'where':{'id':_0x5b2eb6[_0xacde('0x54')]['id']}})[_0xacde('0x23')](handleEntityNotFound(_0x524ce7,null))[_0xacde('0x23')](function(_0x22b641){if(_0x22b641){_0x4af33d[_0xacde('0x43')]=_['keys'](db[_0xacde('0x61')][_0xacde('0x63')]);_0x4af33d['query']=_['keys'](_0x5b2eb6[_0xacde('0x44')]);_0x4af33d[_0xacde('0x46')]=_[_0xacde('0x47')](_0x4af33d[_0xacde('0x43')],_0x4af33d[_0xacde('0x44')]);_0x58408b[_0xacde('0x49')]=_['intersection'](_0x4af33d[_0xacde('0x43')],qs[_0xacde('0x48')](_0x5b2eb6['query'][_0xacde('0x48')]));_0x58408b[_0xacde('0x49')]=_0x58408b[_0xacde('0x49')][_0xacde('0x4a')]?_0x58408b[_0xacde('0x49')]:_0x4af33d['model'];if(!_0x5b2eb6[_0xacde('0x44')][_0xacde('0x64')](_0xacde('0x65'))){_0x58408b[_0xacde('0x32')]=qs[_0xacde('0x32')](_0x5b2eb6[_0xacde('0x44')][_0xacde('0x32')]);_0x58408b['offset']=qs['offset'](_0x5b2eb6['query'][_0xacde('0x31')]);}_0x58408b[_0xacde('0x66')]=qs[_0xacde('0x4b')](_0x5b2eb6[_0xacde('0x44')]['sort']);_0x58408b[_0xacde('0x4c')]=qs['filters'](_[_0xacde('0x4d')](_0x5b2eb6[_0xacde('0x44')],_0x4af33d['filters']));_0x58408b[_0xacde('0x4c')][_0xacde('0x67')]=_0x22b641['id'];if(_0x5b2eb6[_0xacde('0x44')][_0xacde('0x50')]){_0x58408b[_0xacde('0x4c')]=_[_0xacde('0x4e')](_0x58408b[_0xacde('0x4c')],{'$or':_['map'](_0x58408b['attributes'],function(_0x5c7897){var _0x39b7de={};_0x39b7de[_0x5c7897]={'$like':'%'+_0x5b2eb6['query'][_0xacde('0x50')]+'%'};return _0x39b7de;})});}_0x58408b=_[_0xacde('0x4e')]({},_0x58408b,_0x5b2eb6[_0xacde('0x68')]);return db[_0xacde('0x61')][_0xacde('0x30')]({'where':_0x58408b['where']})['then'](function(_0x509a55){_0x1230ac[_0xacde('0x30')]=_0x509a55;if(_0x5b2eb6[_0xacde('0x44')][_0xacde('0x69')]){_0x58408b[_0xacde('0x51')]=[{'all':!![]}];}return db[_0xacde('0x61')][_0xacde('0x52')](_0x58408b);})[_0xacde('0x23')](function(_0x142604){_0x1230ac[_0xacde('0x53')]=_0x142604;return _0x1230ac;});}})[_0xacde('0x23')](respondWithFilteredResult(_0x524ce7,_0x58408b))[_0xacde('0x2c')](handleError(_0x524ce7,null));};exports[_0xacde('0x6a')]=function(_0x51afc1,_0x211d20,_0xb6e3ea){return db['FaxAccount'][_0xacde('0x56')]({'where':{'id':_0x51afc1['params']['id']}})[_0xacde('0x23')](handleEntityNotFound(_0x211d20,null))[_0xacde('0x23')](function(_0x9d209b){if(_0x9d209b){return _0x9d209b[_0xacde('0x6a')](_0x51afc1[_0xacde('0x44')]['ids']);}})[_0xacde('0x23')](respondWithStatusCode(_0x211d20,null))[_0xacde('0x2c')](handleError(_0x211d20,null));};exports[_0xacde('0x6b')]=function(_0x2ca528,_0x1ff4f6,_0x24bbf1){if(_0x2ca528['body']['id']){delete _0x2ca528[_0xacde('0x58')]['id'];}return db[_0xacde('0x3f')]['find']({'where':{'id':_0x2ca528[_0xacde('0x54')]['id']}})['then'](handleEntityNotFound(_0x1ff4f6,null))[_0xacde('0x23')](function(_0x546870){if(_0x546870){_0x2ca528['body'][_0xacde('0x67')]=_0x546870['id'];return db[_0xacde('0x6c')][_0xacde('0x57')](_0x2ca528[_0xacde('0x58')]);}})[_0xacde('0x23')](respondWithResult(_0x1ff4f6,null))[_0xacde('0x2c')](handleError(_0x1ff4f6,null));};exports['getAnswers']=function(_0x415d4f,_0x37e4db,_0x2ba5ed){var _0x15a045={'raw':![],'where':{}};var _0x1443df={};var _0x33f23c={'count':0x0,'rows':[]};return db['FaxAccount'][_0xacde('0x62')]({'where':{'id':_0x415d4f[_0xacde('0x54')]['id']}})[_0xacde('0x23')](handleEntityNotFound(_0x37e4db,null))[_0xacde('0x23')](function(_0x10c052){if(_0x10c052){_0x1443df[_0xacde('0x43')]=_['keys'](db[_0xacde('0x6c')][_0xacde('0x63')]);_0x1443df[_0xacde('0x44')]=_['keys'](_0x415d4f[_0xacde('0x44')]);_0x1443df['filters']=_[_0xacde('0x47')](_0x1443df['model'],_0x1443df[_0xacde('0x44')]);_0x15a045['attributes']=_[_0xacde('0x47')](_0x1443df[_0xacde('0x43')],qs['fields'](_0x415d4f['query'][_0xacde('0x48')]));_0x15a045['attributes']=_0x15a045[_0xacde('0x49')][_0xacde('0x4a')]?_0x15a045[_0xacde('0x49')]:_0x1443df[_0xacde('0x43')];if(!_0x415d4f[_0xacde('0x44')][_0xacde('0x64')](_0xacde('0x65'))){_0x15a045['limit']=qs[_0xacde('0x32')](_0x415d4f[_0xacde('0x44')]['limit']);_0x15a045['offset']=qs[_0xacde('0x31')](_0x415d4f[_0xacde('0x44')][_0xacde('0x31')]);}_0x15a045[_0xacde('0x66')]=qs[_0xacde('0x4b')](_0x415d4f[_0xacde('0x44')][_0xacde('0x4b')]);_0x15a045[_0xacde('0x4c')]=qs['filters'](_[_0xacde('0x4d')](_0x415d4f[_0xacde('0x44')],_0x1443df[_0xacde('0x46')]));_0x15a045['where'][_0xacde('0x67')]=_0x10c052['id'];if(_0x415d4f[_0xacde('0x44')][_0xacde('0x50')]){_0x15a045[_0xacde('0x4c')]=_[_0xacde('0x4e')](_0x15a045['where'],{'$or':_[_0xacde('0x3e')](_0x15a045[_0xacde('0x49')],function(_0x49ae1d){var _0x10bd15={};_0x10bd15[_0x49ae1d]={'$like':'%'+_0x415d4f[_0xacde('0x44')][_0xacde('0x50')]+'%'};return _0x10bd15;})});}_0x15a045=_[_0xacde('0x4e')]({},_0x15a045,_0x415d4f[_0xacde('0x68')]);return db[_0xacde('0x6c')][_0xacde('0x30')]({'where':_0x15a045['where']})[_0xacde('0x23')](function(_0x318d9b){_0x33f23c[_0xacde('0x30')]=_0x318d9b;if(_0x415d4f[_0xacde('0x44')][_0xacde('0x69')]){_0x15a045[_0xacde('0x51')]=[{'all':!![]}];}return db[_0xacde('0x6c')]['findAll'](_0x15a045);})[_0xacde('0x23')](function(_0x2ad981){_0x33f23c[_0xacde('0x53')]=_0x2ad981;return _0x33f23c;});}})['then'](respondWithFilteredResult(_0x37e4db,_0x15a045))[_0xacde('0x2c')](handleError(_0x37e4db,null));};exports[_0xacde('0x6d')]=function(_0x5982ec,_0x326730,_0x4f90ee){return db[_0xacde('0x3f')]['find']({'where':{'id':_0x5982ec[_0xacde('0x54')]['id']}})[_0xacde('0x23')](handleEntityNotFound(_0x326730,null))[_0xacde('0x23')](function(_0x2ce8ab){if(_0x2ce8ab){return _0x2ce8ab['removeAnswers'](_0x5982ec[_0xacde('0x44')][_0xacde('0x6e')]);}})[_0xacde('0x23')](respondWithStatusCode(_0x326730,null))['catch'](handleError(_0x326730,null));};exports[_0xacde('0x6f')]=function(_0x104adf,_0x3ca5f8,_0x4d2ec3){return db[_0xacde('0x70')][_0xacde('0x56')]({'where':{'id':_0x104adf['params']['id']}})[_0xacde('0x23')](handleEntityNotFound(_0x3ca5f8,null))[_0xacde('0x23')](function(_0x541458){if(_0x541458){return _0x541458['addInteraction'](_0x104adf[_0xacde('0x58')][_0xacde('0x6e')],_[_0xacde('0x71')](_0x104adf[_0xacde('0x58')],[_0xacde('0x6e'),'id'])||{});}})['then'](respondWithResult(_0x3ca5f8,null))[_0xacde('0x2c')](handleError(_0x3ca5f8,null));};exports[_0xacde('0x72')]=function(_0x340a6a,_0xaefbe7,_0x733a6a){var _0x3d671a={'raw':![],'where':{}};var _0x353075={};var _0x508b0a={'count':0x0,'rows':[]};return db[_0xacde('0x3f')][_0xacde('0x62')]({'where':{'id':_0x340a6a[_0xacde('0x54')]['id']}})[_0xacde('0x23')](handleEntityNotFound(_0xaefbe7,null))['then'](function(_0x409f35){if(_0x409f35){_0x353075[_0xacde('0x43')]=_['keys'](db[_0xacde('0x70')][_0xacde('0x63')]);_0x353075[_0xacde('0x44')]=_[_0xacde('0x45')](_0x340a6a[_0xacde('0x44')]);_0x353075[_0xacde('0x46')]=_[_0xacde('0x47')](_0x353075[_0xacde('0x43')],_0x353075[_0xacde('0x44')]);_0x3d671a['attributes']=_['intersection'](_0x353075[_0xacde('0x43')],qs[_0xacde('0x48')](_0x340a6a['query']['fields']));_0x3d671a[_0xacde('0x49')]=_0x3d671a[_0xacde('0x49')]['length']?_0x3d671a[_0xacde('0x49')]:_0x353075[_0xacde('0x43')];if(!_0x340a6a[_0xacde('0x44')][_0xacde('0x64')](_0xacde('0x65'))){_0x3d671a[_0xacde('0x32')]=qs[_0xacde('0x32')](_0x340a6a['query'][_0xacde('0x32')]);_0x3d671a[_0xacde('0x31')]=qs[_0xacde('0x31')](_0x340a6a[_0xacde('0x44')][_0xacde('0x31')]);}_0x3d671a[_0xacde('0x66')]=qs[_0xacde('0x4b')](_0x340a6a['query'][_0xacde('0x4b')]);_0x3d671a[_0xacde('0x4c')]=qs['filters'](_['pick'](_0x340a6a[_0xacde('0x44')],_0x353075[_0xacde('0x46')]));_0x3d671a['where'][_0xacde('0x67')]=_0x409f35['id'];if(_0x340a6a[_0xacde('0x44')]['filter']){_0x3d671a[_0xacde('0x4c')]=_[_0xacde('0x4e')](_0x3d671a['where'],{'$or':_[_0xacde('0x3e')](_0x3d671a['attributes'],function(_0x540593){var _0x5654c5={};_0x5654c5[_0x540593]={'$like':'%'+_0x340a6a[_0xacde('0x44')][_0xacde('0x50')]+'%'};return _0x5654c5;})});}_0x3d671a=_[_0xacde('0x4e')]({},_0x3d671a,_0x340a6a[_0xacde('0x68')]);return db[_0xacde('0x70')][_0xacde('0x30')]({'where':_0x3d671a[_0xacde('0x4c')]})[_0xacde('0x23')](function(_0x43af1c){_0x508b0a[_0xacde('0x30')]=_0x43af1c;if(_0x340a6a[_0xacde('0x44')]['includeAll']){_0x3d671a['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0xacde('0x73'),'attributes':[_0xacde('0x3b'),_0xacde('0x74'),_0xacde('0x75')],'required':![]},{'model':db[_0xacde('0x76')],'as':_0xacde('0x77'),'attributes':['id',_0xacde('0x3b'),_0xacde('0x78')],'where':_0x340a6a['query'][_0xacde('0x79')]?{'id':_0x340a6a[_0xacde('0x44')][_0xacde('0x79')]}:undefined,'required':_0x340a6a[_0xacde('0x44')][_0xacde('0x79')]?!![]:![]}];}return db[_0xacde('0x70')][_0xacde('0x52')](_0x3d671a);})[_0xacde('0x23')](function(_0xbbf5ae){_0x508b0a['rows']=_0xbbf5ae;return _0x508b0a;});}})[_0xacde('0x23')](respondWithFilteredResult(_0xaefbe7,_0x3d671a))[_0xacde('0x2c')](handleError(_0xaefbe7,null));};exports[_0xacde('0x7a')]=function(_0x29b124,_0x5d76ac,_0xdd7ef6){return db[_0xacde('0x3f')][_0xacde('0x62')]({'where':{'id':_0x29b124['params']['id']}})[_0xacde('0x23')](handleEntityNotFound(_0x5d76ac,null))[_0xacde('0x23')](function(_0x4fe116){if(_0x4fe116){return db['sequelize'][_0xacde('0x7b')](function(_0x405df4){return db['FaxApplication'][_0xacde('0x37')]({'where':{'FaxAccountId':_0x29b124['params']['id']},'transaction':_0x405df4})[_0xacde('0x23')](function(_0x1ac957){var _0x5ae1e0=_[_0xacde('0x3e')](_0x29b124[_0xacde('0x58')],function(_0x24a559){_0x24a559[_0xacde('0x67')]=_0x29b124[_0xacde('0x54')]['id'];return _0x24a559;});return db[_0xacde('0x7c')][_0xacde('0x7d')](_0x5ae1e0,{'transaction':_0x405df4});});})[_0xacde('0x23')](function(){return db[_0xacde('0x7c')][_0xacde('0x7e')]({'where':{'FaxAccountId':_0x29b124[_0xacde('0x54')]['id']},'order':_0xacde('0x7f')});});}})[_0xacde('0x23')](respondWithResult(_0x5d76ac,null))[_0xacde('0x2c')](handleError(_0x5d76ac,null));};exports[_0xacde('0x80')]=function(_0x1575d3,_0x57a11e,_0x5eab91){var _0x5c0d63={};var _0x5996f3={};var _0x2ffead;var _0x195e15;return db['FaxAccount']['findOne']({'where':{'id':_0x1575d3[_0xacde('0x54')]['id']}})[_0xacde('0x23')](handleEntityNotFound(_0x57a11e,null))[_0xacde('0x23')](function(_0x2a50d0){if(_0x2a50d0){_0x2ffead=_0x2a50d0;_0x5996f3[_0xacde('0x43')]=_[_0xacde('0x45')](db[_0xacde('0x7c')]['rawAttributes']);_0x5996f3[_0xacde('0x44')]=_[_0xacde('0x45')](_0x1575d3[_0xacde('0x44')]);_0x5996f3['filters']=_[_0xacde('0x47')](_0x5996f3[_0xacde('0x43')],_0x5996f3[_0xacde('0x44')]);_0x5c0d63[_0xacde('0x49')]=_[_0xacde('0x47')](_0x5996f3['model'],qs['fields'](_0x1575d3[_0xacde('0x44')][_0xacde('0x48')]));_0x5c0d63[_0xacde('0x49')]=_0x5c0d63[_0xacde('0x49')][_0xacde('0x4a')]?_0x5c0d63[_0xacde('0x49')]:_0x5996f3[_0xacde('0x43')];_0x5c0d63[_0xacde('0x66')]=qs[_0xacde('0x4b')](_0x1575d3[_0xacde('0x44')][_0xacde('0x4b')]);_0x5c0d63['where']=qs[_0xacde('0x46')](_[_0xacde('0x4d')](_0x1575d3[_0xacde('0x44')],_0x5996f3[_0xacde('0x46')]));if(_0x1575d3[_0xacde('0x44')][_0xacde('0x50')]){_0x5c0d63[_0xacde('0x4c')]=_[_0xacde('0x4e')](_0x5c0d63['where'],{'$or':_['map'](_0x5c0d63[_0xacde('0x49')],function(_0x573bf2){var _0x19aa1e={};_0x19aa1e[_0x573bf2]={'$like':'%'+_0x1575d3[_0xacde('0x44')][_0xacde('0x50')]+'%'};return _0x19aa1e;})});}_0x5c0d63=_[_0xacde('0x4e')]({},_0x5c0d63,_0x1575d3[_0xacde('0x68')]);return _0x2ffead[_0xacde('0x80')](_0x5c0d63);}})[_0xacde('0x23')](function(_0x456c0a){if(_0x456c0a){_0x195e15=_0x456c0a[_0xacde('0x4a')];if(!_0x1575d3[_0xacde('0x44')][_0xacde('0x64')]('nolimit')){_0x5c0d63['limit']=qs[_0xacde('0x32')](_0x1575d3['query'][_0xacde('0x32')]);_0x5c0d63[_0xacde('0x31')]=qs['offset'](_0x1575d3[_0xacde('0x44')]['offset']);}return _0x2ffead[_0xacde('0x80')](_0x5c0d63);}})[_0xacde('0x23')](function(_0x3fc587){if(_0x3fc587){return _0x3fc587?{'count':_0x195e15,'rows':_0x3fc587}:null;}})['then'](respondWithResult(_0x57a11e,null))[_0xacde('0x2c')](handleError(_0x57a11e,null));};function Extension(_0x27019b,_0x3c9be5,_0x455780,_0x1d9d1c){this[_0xacde('0x81')]=_0xacde('0x82');this[_0xacde('0x83')]=_0x27019b[_0xacde('0x84')];this[_0xacde('0x85')]=_0x1d9d1c;this[_0xacde('0x41')]=_0xacde('0x86');this['description']='Fax\x20Extension';this[_0xacde('0x67')]=_0x27019b['id'];this[_0xacde('0x7f')]=_0x3c9be5;this['appdata']=_0x455780;}function createExtensionsReciveFax(_0x33ddd3){var _0x3a6663=0x1;var _0x3c3162=[];_0x3c3162[_0xacde('0x87')](new Extension(_0x33ddd3,_0x3a6663,'',_0xacde('0x88')));_0x3a6663+=0x1;_0x3c3162[_0xacde('0x87')](new Extension(_0x33ddd3,_0x3a6663,_0xacde('0x89'),_0xacde('0x8a')));_0x3a6663+=0x1;for(var _0x4adf40 in _0x33ddd3){if(_0x33ddd3[_0xacde('0x64')](_0x4adf40)&&(_0x4adf40===_0xacde('0x8b')||_0x4adf40===_0xacde('0x84')||_0x4adf40==='gateway'||_0x4adf40===_0xacde('0x8c')||_0x4adf40==='headerinfo'||_0x4adf40===_0xacde('0x8d')||_0x4adf40===_0xacde('0x8e')||_0x4adf40===_0xacde('0x8f')||_0x4adf40==='t38timeout')){_0x3c3162[_0xacde('0x87')](new Extension(_0x33ddd3,_0x3a6663,_0xacde('0x90')+_0x4adf40+')='+_0x33ddd3[_0x4adf40],_0xacde('0x8a')));_0x3a6663+=0x1;}}_0x3c3162[_0xacde('0x87')](new Extension(_0x33ddd3,_0x3a6663,'6',_0xacde('0x91')));_0x3a6663+=0x1;_0x3c3162[_0xacde('0x87')](new Extension(_0x33ddd3,_0x3a6663,_0xacde('0x92'),_0xacde('0x93')));_0x3a6663=0x0;return _0x3c3162;}exports['addAccountApplications']=function(_0x10d54f,_0x3139ab,_0x40abc4){var _0x168790;return db['sequelize'][_0xacde('0x7b')](function(_0x323328){return db[_0xacde('0x3f')]['create'](_0x10d54f[_0xacde('0x58')],{'transaction':_0x323328})[_0xacde('0x23')](function(_0x2949ea){_0x168790=_0x2949ea[_0xacde('0x5a')]({'plain':!![]});return db['VoiceExtension'][_0xacde('0x7d')](createExtensionsReciveFax(_0x168790),{'transaction':_0x323328});});})[_0xacde('0x23')](function(){return _0x168790;})['then'](respondWithResult(_0x3139ab,null))['catch'](handleError(_0x3139ab,null));};exports[_0xacde('0x94')]=function(_0x15a8b1,_0x5ae407,_0x276763){var _0x287688;return db['sequelize'][_0xacde('0x7b')](function(_0x14e3bc){return db[_0xacde('0x3f')]['update'](_0x15a8b1[_0xacde('0x58')],{'where':{'id':_0x15a8b1[_0xacde('0x58')]['id']},'transaction':_0x14e3bc})[_0xacde('0x23')](function(_0x10d814){return db[_0xacde('0x95')][_0xacde('0x37')]({'where':{'FaxAccountId':_0x15a8b1[_0xacde('0x58')]['id']},'transaction':_0x14e3bc})[_0xacde('0x23')](function(_0xbc69b0){return db['VoiceExtension'][_0xacde('0x7d')](createExtensionsReciveFax(_[_0xacde('0x71')](_0x15a8b1[_0xacde('0x58')],[_0xacde('0x96'),_0xacde('0x42'),_0xacde('0x97'),_0xacde('0x98'),_0xacde('0x99'),_0xacde('0x9a')])),{'transaction':_0x14e3bc});});});})[_0xacde('0x23')](function(){return db[_0xacde('0x3f')][_0xacde('0x9b')](_0x15a8b1[_0xacde('0x58')]['id']);})[_0xacde('0x23')](respondWithResult(_0x5ae407,null))[_0xacde('0x2c')](handleError(_0x5ae407,null));};exports[_0xacde('0x9c')]=function(_0x4d8386,_0xf6b040,_0x4e78da){var _0xc5f987={'raw':!![],'where':{}};var _0x83e64d={};var _0x4ca0c0={'count':0x0,'rows':[]};return db['FaxAccount'][_0xacde('0x62')]({'where':{'id':_0x4d8386[_0xacde('0x54')]['id']}})['then'](handleEntityNotFound(_0xf6b040,null))['then'](function(_0x50bbbe){if(_0x50bbbe){_0x83e64d['model']=_[_0xacde('0x45')](db['FaxMessage'][_0xacde('0x63')]);_0x83e64d[_0xacde('0x44')]=_[_0xacde('0x45')](_0x4d8386[_0xacde('0x44')]);_0x83e64d[_0xacde('0x46')]=_[_0xacde('0x47')](_0x83e64d[_0xacde('0x43')],_0x83e64d[_0xacde('0x44')]);_0xc5f987[_0xacde('0x49')]=_[_0xacde('0x47')](_0x83e64d[_0xacde('0x43')],qs[_0xacde('0x48')](_0x4d8386[_0xacde('0x44')][_0xacde('0x48')]));_0xc5f987['attributes']=_0xc5f987[_0xacde('0x49')]['length']?_0xc5f987[_0xacde('0x49')]:_0x83e64d[_0xacde('0x43')];if(!_0x4d8386[_0xacde('0x44')][_0xacde('0x64')](_0xacde('0x65'))){_0xc5f987[_0xacde('0x32')]=qs[_0xacde('0x32')](_0x4d8386[_0xacde('0x44')][_0xacde('0x32')]);_0xc5f987['offset']=qs[_0xacde('0x31')](_0x4d8386[_0xacde('0x44')][_0xacde('0x31')]);}_0xc5f987[_0xacde('0x66')]=qs['sort'](_0x4d8386[_0xacde('0x44')][_0xacde('0x4b')]);_0xc5f987[_0xacde('0x4c')]=qs[_0xacde('0x46')](_[_0xacde('0x4d')](_0x4d8386[_0xacde('0x44')],_0x83e64d[_0xacde('0x46')]));_0xc5f987['where']['FaxAccountId']=_0x50bbbe['id'];if(_0x4d8386['query'][_0xacde('0x50')]){_0xc5f987[_0xacde('0x4c')]=_['merge'](_0xc5f987[_0xacde('0x4c')],{'$or':_[_0xacde('0x3e')](_0xc5f987[_0xacde('0x49')],function(_0x555de4){var _0x2aa0d6={};_0x2aa0d6[_0x555de4]={'$like':'%'+_0x4d8386[_0xacde('0x44')]['filter']+'%'};return _0x2aa0d6;})});}if(_0x4d8386['query'][_0xacde('0x9d')]){var _0x294dfa=_0x4d8386[_0xacde('0x44')][_0xacde('0x9d')][_0xacde('0x9e')](',');var _0x40e8f9={};_0x40e8f9[_0x294dfa[0x0]]={'$gte':moment(_0x294dfa[0x1])[_0xacde('0x9f')](_0xacde('0xa0'))};_0xc5f987[_0xacde('0x4c')]=_[_0xacde('0x4e')](_0xc5f987[_0xacde('0x4c')],_0x40e8f9);}_0xc5f987=_[_0xacde('0x4e')]({},_0xc5f987,_0x4d8386[_0xacde('0x68')]);return db[_0xacde('0xa1')][_0xacde('0x30')]({'where':_0xc5f987[_0xacde('0x4c')]})[_0xacde('0x23')](function(_0x51c285){_0x4ca0c0[_0xacde('0x30')]=_0x51c285;if(_0x4d8386['query'][_0xacde('0x69')]){_0xc5f987[_0xacde('0x51')]=[{'all':!![]}];}return db[_0xacde('0xa1')][_0xacde('0x52')](_0xc5f987);})[_0xacde('0x23')](function(_0x3780a0){_0x4ca0c0['rows']=_0x3780a0;return _0x4ca0c0;});}})[_0xacde('0x23')](respondWithFilteredResult(_0xf6b040,_0xc5f987))['catch'](handleError(_0xf6b040,null));};exports['send']=function(_0x53d689,_0x1cf57d,_0x2264ed){var _0x4cfe4b,_0x14d0b5={},_0x4d0a3f;if(_0x53d689[_0xacde('0x58')]['to']){_0x4d0a3f=_0x53d689['body']['to'][0x0];}return db[_0xacde('0x3f')][_0xacde('0x56')]({'where':{'id':_0x53d689[_0xacde('0x54')]['id']},'include':[{'model':db[_0xacde('0xa2')],'as':_0xacde('0xa3'),'include':[{'model':db[_0xacde('0xa4')],'as':_0xacde('0xa5'),'where':{'fax':_0x4d0a3f},'limit':0x1,'order':[[_0xacde('0x98'),_0xacde('0xa6')]]}]}]})[_0xacde('0x23')](handleEntityNotFound(_0x1cf57d,null))[_0xacde('0x23')](function(_0x189046){_0x4cfe4b=_0x189046;if(_0x53d689[_0xacde('0x58')][_0xacde('0xa7')]&&_0x53d689['body'][_0xacde('0xa7')][_0xacde('0x4a')]){for(var _0x3e134b=0x0;_0x3e134b<_0x53d689[_0xacde('0x58')][_0xacde('0xa7')][_0xacde('0x4a')];_0x3e134b+=0x1){_0x53d689[_0xacde('0x58')][_0xacde('0xa7')][_0x3e134b]={'filename':_0x53d689[_0xacde('0x58')]['attachments'][_0x3e134b][_0xacde('0x3b')],'id':_0x53d689[_0xacde('0x58')][_0xacde('0xa7')][_0x3e134b]['id'],'path':path[_0xacde('0xa8')](config[_0xacde('0xa9')],'server/files/attachments',_0x53d689[_0xacde('0x58')][_0xacde('0xa7')][_0x3e134b][_0xacde('0xaa')])};}}return respondWithRpcPromise(_0xacde('0xab'),_0xacde('0xab'),{'FaxAccountId':_[_0xacde('0xac')](_0x53d689[_0xacde('0x54')]['id'])?undefined:_0x53d689[_0xacde('0x54')]['id'],'path':_[_0xacde('0xac')](_0x53d689['body'][_0xacde('0xa7')][0x0]['path'])?undefined:_0x53d689[_0xacde('0x58')][_0xacde('0xa7')][0x0][_0xacde('0x8')],'fax':_[_0xacde('0xac')](_0x53d689[_0xacde('0x58')]['to'][0x0])?undefined:_0x53d689['body']['to'][0x0]},client9002);})[_0xacde('0x23')](function(){if(_0x4cfe4b){if(_[_0xacde('0xac')](_0x53d689[_0xacde('0x58')][_0xacde('0xad')])){_0x53d689[_0xacde('0x58')][_0xacde('0xad')]=util[_0xacde('0x9f')](_0xacde('0xae'),_0x4cfe4b[_0xacde('0x3b')],_0x4cfe4b['fax']);}if(_0x4cfe4b[_0xacde('0xa3')]){if(_0x4cfe4b['List'][_0xacde('0xa5')][_0xacde('0x4a')]){return _0x4cfe4b['List']['Contacts'][0x0];}else{return db[_0xacde('0xa4')][_0xacde('0x57')](_[_0xacde('0x1a')](_0x53d689['body'],{'firstName':_0x53d689[_0xacde('0x58')]['to'][0x0],'phone':_0x53d689['body']['to'][0x0],'fax':_0x53d689['body']['to'][0x0],'ListId':_0x4cfe4b[_0xacde('0x9a')]}));}}else{throw new Error(_0xacde('0xaf'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xacde('0x23')](function(_0x101364){if(_0x101364){return db[_0xacde('0x70')][_0xacde('0x56')]({'where':{'ContactId':_0x101364['id'],'closed':![],'FaxAccountId':_0x4cfe4b['id']}})[_0xacde('0x23')](function(_0x5f0c24){if(_0x5f0c24){return[_0x5f0c24,![]];}return db[_0xacde('0x70')]['create']({'UserId':_0x53d689['user']['id'],'ContactId':_0x101364['id'],'FaxAccountId':_0x4cfe4b['id'],'fax':_0x53d689[_0xacde('0x58')]['to'][0x0],'firstMsgDirection':_0xacde('0xb0'),'Messages':[_[_0xacde('0x4e')](_0x53d689[_0xacde('0x58')],{'read':![],'body':_0x53d689[_0xacde('0x58')][_0xacde('0xa7')][0x0][_0xacde('0xb1')],'FaxAccountId':_0x4cfe4b['id'],'UserId':_0x53d689[_0xacde('0x59')]['id'],'ContactId':_0x101364['id'],'AttachmentId':_0x53d689['body'][_0xacde('0xa7')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xacde('0xb2')}]})[_0xacde('0x23')](function(_0x4eaca8){return[_0x4eaca8,!![]];});});}else{throw new Error(_0xacde('0xb3'));}})[_0xacde('0xb4')](function(_0x128002,_0x44ce8f){if(_0x44ce8f){return _0x128002;}return db[_0xacde('0xa1')][_0xacde('0x57')]({'direction':_0xacde('0xb0'),'read':![],'body':_0x53d689['body'][_0xacde('0xa7')][0x0][_0xacde('0xb1')],'FaxAccountId':_0x4cfe4b['id'],'FaxInteractionId':_0x128002['id'],'UserId':_0x53d689['user']['id'],'ContactId':_0x128002[_0xacde('0xb5')],'AttachmentId':_0x53d689[_0xacde('0x58')][_0xacde('0xa7')][0x0]['id']})[_0xacde('0x23')](function(_0x5c1fbb){_0x128002[_0xacde('0xb6')]['Messages']=[];_0x128002[_0xacde('0xb6')][_0xacde('0xb2')]['push'](_0x5c1fbb[_0xacde('0xb6')]);return _0x128002;});})[_0xacde('0x23')](function(_0x4ed941){respondWithRpcPromise(_0xacde('0xb7'),_0xacde('0xb7'),{'FaxAccountId':_[_0xacde('0xac')](_0x53d689[_0xacde('0x54')]['id'])?undefined:_0x53d689[_0xacde('0x54')]['id'],'path':_[_0xacde('0xac')](_0x53d689['body']['attachments'][0x0][_0xacde('0x8')])?undefined:_0x53d689[_0xacde('0x58')][_0xacde('0xa7')][0x0][_0xacde('0x8')],'fax':_[_0xacde('0xac')](_0x53d689[_0xacde('0x58')]['to'][0x0])?undefined:_0x53d689[_0xacde('0x58')]['to'][0x0],'AttachmentId':_0x53d689[_0xacde('0x58')][_0xacde('0xa7')][0x0]['id']},client9002)[_0xacde('0x23')](function(_0x47eb9f){logger[_0xacde('0x24')](_0xacde('0xb8'),_0x47eb9f);})['catch'](function(_0xbd9e5b){logger['info'](_0xacde('0xb8'),_0xbd9e5b);});return _0x4ed941;})[_0xacde('0x23')](respondWithResult(_0x1cf57d,null))[_0xacde('0x2c')](handleError(_0x1cf57d,null));};exports[_0xacde('0xb9')]=function(_0x2fae77,_0x88da71,_0x5016f7){return db['FaxAccount'][_0xacde('0x56')]({'where':{'id':_0x2fae77[_0xacde('0x54')]['id']}})[_0xacde('0x23')](handleEntityNotFound(_0x88da71,null))[_0xacde('0x23')](function(_0x488c80){if(_0x488c80){return _0x488c80[_0xacde('0xb9')](_0x2fae77[_0xacde('0x58')]['ids'],_[_0xacde('0x71')](_0x2fae77[_0xacde('0x58')],[_0xacde('0x6e'),'id'])||{})[_0xacde('0xb4')](function(_0x42df2d){for(var _0x34f9fb=0x0;_0x34f9fb<_0x2fae77['body'][_0xacde('0x6e')][_0xacde('0x4a')];_0x34f9fb+=0x1){socket[_0xacde('0xba')](_0xacde('0xbb'),{'UserId':_0x2fae77['body'][_0xacde('0x6e')][_0x34f9fb],'FaxAccountId':_0x2fae77[_0xacde('0x54')]['id']});}return _0x42df2d;});}})[_0xacde('0x23')](respondWithResult(_0x88da71,null))[_0xacde('0x2c')](handleError(_0x88da71,null));};exports[_0xacde('0xbc')]=function(_0x59c33b,_0x51d967,_0x51cb65){return db[_0xacde('0x3f')][_0xacde('0x56')]({'where':{'id':_0x59c33b[_0xacde('0x54')]['id']}})['then'](handleEntityNotFound(_0x51d967,null))[_0xacde('0x23')](function(_0x2f69d4){if(_0x2f69d4){return _0x2f69d4['removeAgents'](_0x59c33b['query'][_0xacde('0x6e')])[_0xacde('0x23')](function(){if(_[_0xacde('0xbd')](_0x59c33b[_0xacde('0x44')]['ids'])){for(var _0x1d7ebf=0x0;_0x1d7ebf<_0x59c33b['query'][_0xacde('0x6e')]['length'];_0x1d7ebf+=0x1){socket[_0xacde('0xba')](_0xacde('0xbe'),{'UserId':Number(_0x59c33b['query'][_0xacde('0x6e')][_0x1d7ebf]),'FaxAccountId':Number(_0x59c33b['params']['id'])});}}else{socket[_0xacde('0xba')](_0xacde('0xbe'),{'UserId':Number(_0x59c33b[_0xacde('0x44')]['ids']),'FaxAccountId':Number(_0x59c33b[_0xacde('0x54')]['id'])});}});}})[_0xacde('0x23')](respondWithStatusCode(_0x51d967,null))[_0xacde('0x2c')](handleError(_0x51d967,null));};exports[_0xacde('0xbf')]=function(_0x5e7055,_0x39432a,_0x105c2c){var _0x548ba3={};var _0x25645d={};var _0x31feed;var _0x2682a3;return db[_0xacde('0x3f')]['findOne']({'where':{'id':_0x5e7055[_0xacde('0x54')]['id']}})[_0xacde('0x23')](handleEntityNotFound(_0x39432a,null))[_0xacde('0x23')](function(_0x33e9b5){if(_0x33e9b5){_0x31feed=_0x33e9b5;_0x25645d[_0xacde('0x43')]=_[_0xacde('0x45')](db['User']['rawAttributes']);_0x25645d[_0xacde('0x44')]=_[_0xacde('0x45')](_0x5e7055['query']);_0x25645d[_0xacde('0x46')]=_['intersection'](_0x25645d[_0xacde('0x43')],_0x25645d[_0xacde('0x44')]);_0x548ba3['attributes']=_[_0xacde('0x47')](_0x25645d[_0xacde('0x43')],qs[_0xacde('0x48')](_0x5e7055[_0xacde('0x44')]['fields']));_0x548ba3[_0xacde('0x49')]=_0x548ba3['attributes'][_0xacde('0x4a')]?_0x548ba3[_0xacde('0x49')]:_0x25645d[_0xacde('0x43')];_0x548ba3[_0xacde('0x66')]=qs[_0xacde('0x4b')](_0x5e7055['query']['sort']);_0x548ba3[_0xacde('0x4c')]=qs[_0xacde('0x46')](_[_0xacde('0x4d')](_0x5e7055[_0xacde('0x44')],_0x25645d[_0xacde('0x46')]));if(_0x5e7055[_0xacde('0x44')][_0xacde('0x50')]){_0x548ba3['where']=_[_0xacde('0x4e')](_0x548ba3['where'],{'$or':_['map'](_0x548ba3[_0xacde('0x49')],function(_0x590944){var _0x384408={};_0x384408[_0x590944]={'$like':'%'+_0x5e7055[_0xacde('0x44')][_0xacde('0x50')]+'%'};return _0x384408;})});}_0x548ba3=_[_0xacde('0x4e')]({},_0x548ba3,_0x5e7055['options']);return _0x31feed['getAgents'](_0x548ba3);}})[_0xacde('0x23')](function(_0x1c0087){if(_0x1c0087){_0x2682a3=_0x1c0087[_0xacde('0x4a')];if(!_0x5e7055['query'][_0xacde('0x64')](_0xacde('0x65'))){_0x548ba3[_0xacde('0x32')]=qs[_0xacde('0x32')](_0x5e7055[_0xacde('0x44')]['limit']);_0x548ba3[_0xacde('0x31')]=qs[_0xacde('0x31')](_0x5e7055['query'][_0xacde('0x31')]);}return _0x31feed[_0xacde('0xbf')](_0x548ba3);}})[_0xacde('0x23')](function(_0x5dc73a){if(_0x5dc73a){return _0x5dc73a?{'count':_0x2682a3,'rows':_0x5dc73a}:null;}})['then'](respondWithResult(_0x39432a,null))[_0xacde('0x2c')](handleError(_0x39432a,null));}; \ No newline at end of file +var _0x094e=['stringify','code','error','message','result','status','end','json','offset','limit','set','Content-Range','apply','save','destroy','FaxAccounts','UserProfileResource','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','FaxAccount','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','count','includeAll','findAll','catch','show','params','rawAttributes','filters','include','options','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','FaxAccountId','Disposition','create','getDispositions','findOne','map','rows','removeDispositions','ids','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','exten','app','system','description','Fax\x20Extension','priority','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','gateway','faxdetect','maxrate','modem','FAXOPT(','Wait','ReceiveFax','VoiceExtension','updateAccountApplications','tech','TrunkId','ListId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','updatedAt','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','FaxMessage','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s'];(function(_0x17cfdc,_0x4d6016){var _0x125059=function(_0x566e3b){while(--_0x566e3b){_0x17cfdc['push'](_0x17cfdc['shift']());}};_0x125059(++_0x4d6016);}(_0x094e,0x164));var _0xe094=function(_0x156df1,_0x580693){_0x156df1=_0x156df1-0x0;var _0x2f5007=_0x094e[_0x156df1];return _0x2f5007;};'use strict';var pdf=require(_0xe094('0x0'));var emlformat=require(_0xe094('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe094('0x2'));var moment=require(_0xe094('0x3'));var BPromise=require(_0xe094('0x4'));var Mustache=require(_0xe094('0x5'));var util=require(_0xe094('0x6'));var path=require(_0xe094('0x7'));var sox=require(_0xe094('0x8'));var csv=require(_0xe094('0x9'));var ejs=require(_0xe094('0xa'));var fs=require('fs');var _=require(_0xe094('0xb'));var squel=require(_0xe094('0xc'));var crypto=require(_0xe094('0xd'));var jsforce=require(_0xe094('0xe'));var deskjs=require(_0xe094('0xf'));var toCsv=require(_0xe094('0x9'));var querystring=require(_0xe094('0x10'));var Papa=require('papaparse');var Redis=require(_0xe094('0x11'));var authService=require(_0xe094('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe094('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe094('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xe094('0x15'));var db=require(_0xe094('0x16'))['db'];config[_0xe094('0x17')]=_[_0xe094('0x18')](config[_0xe094('0x17')],{'host':_0xe094('0x19'),'port':0x18eb});var socket=require(_0xe094('0x1a'))(new Redis(config[_0xe094('0x17')]));require(_0xe094('0x1b'))[_0xe094('0x1c')](socket);var jayson=require(_0xe094('0x1d'));var client=jayson[_0xe094('0x1e')][_0xe094('0x1f')]({'port':0x232c});var client9002=jayson[_0xe094('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0x3409ec,_0x19a28a,_0x548f53){if(_0x548f53){var _0x2ca402=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2ca402[_0xe094('0x20')](_0x19a28a)){return _0x3409ec;}else{throw new db['Sequelize'][(_0xe094('0x21'))](_0xe094('0x22'));}}else{return _0x3409ec;}}function respondWithRpcPromise(_0x4e860a,_0x2782f9,_0x9132a7,_0x8ab457){return new BPromise(function(_0x254f4c,_0x46472d){var _0x551d6c=_0x8ab457||client;return _0x551d6c[_0xe094('0x23')](_0x4e860a,_0x9132a7)[_0xe094('0x24')](function(_0x2672b6){logger[_0xe094('0x25')](_0xe094('0x26'),_0x2782f9,_0xe094('0x27'));logger[_0xe094('0x28')](_0xe094('0x29'),_0x2782f9,_0xe094('0x27'),JSON[_0xe094('0x2a')](_0x2672b6));if(_0x2672b6['error']){if(_0x2672b6['error'][_0xe094('0x2b')]===0x1f4){logger['error'](_0xe094('0x26'),_0x2782f9,_0x2672b6[_0xe094('0x2c')]['message']);return _0x46472d(_0x2672b6[_0xe094('0x2c')][_0xe094('0x2d')]);}logger[_0xe094('0x2c')](_0xe094('0x26'),_0x2782f9,_0x2672b6['error'][_0xe094('0x2d')]);return _0x254f4c(_0x2672b6[_0xe094('0x2c')][_0xe094('0x2d')]);}else{logger[_0xe094('0x25')](_0xe094('0x26'),_0x2782f9,_0xe094('0x27'));_0x254f4c(_0x2672b6[_0xe094('0x2e')][_0xe094('0x2d')]);}})['catch'](function(_0x1b7265){logger['error'](_0xe094('0x26'),_0x2782f9,_0x1b7265);_0x46472d(_0x1b7265);});});}function respondWithStatusCode(_0x2363f5,_0x4ab07a){_0x4ab07a=_0x4ab07a||0xcc;return function(_0xd7c448){if(_0xd7c448){return _0x2363f5['sendStatus'](_0x4ab07a);}return _0x2363f5[_0xe094('0x2f')](_0x4ab07a)[_0xe094('0x30')]();};}function respondWithResult(_0x786ada,_0x42e822){_0x42e822=_0x42e822||0xc8;return function(_0x2777ea){if(_0x2777ea){return _0x786ada[_0xe094('0x2f')](_0x42e822)[_0xe094('0x31')](_0x2777ea);}};}function respondWithFilteredResult(_0x18b181,_0x94288f){return function(_0x560e5a){if(_0x560e5a){var _0x27d31d=_0x560e5a['count'],_0x1efc11=_0x94288f[_0xe094('0x32')],_0x436218=_0x94288f['offset']+_0x94288f[_0xe094('0x33')],_0x4bfa11;if(_0x436218>=_0x27d31d){_0x436218=_0x27d31d;_0x4bfa11=0xc8;}else{_0x4bfa11=0xce;}_0x18b181['status'](_0x4bfa11);return _0x18b181[_0xe094('0x34')](_0xe094('0x35'),_0x1efc11+'-'+_0x436218+'/'+_0x27d31d)[_0xe094('0x31')](_0x560e5a);}return null;};}function patchUpdates(_0x13343f){return function(_0x38b0eb){try{jsonpatch[_0xe094('0x36')](_0x38b0eb,_0x13343f,!![]);}catch(_0x50c54d){return BPromise['reject'](_0x50c54d);}return _0x38b0eb[_0xe094('0x37')]();};}function saveUpdates(_0x8e9eb5,_0x2bf43c){return function(_0xd75a9e){if(_0xd75a9e){return _0xd75a9e['update'](_0x8e9eb5)[_0xe094('0x24')](function(_0x4e2065){return _0x4e2065;});}return null;};}function removeEntity(_0x530e5e,_0x4b7b4d){return function(_0x3d60ff){if(_0x3d60ff){return _0x3d60ff[_0xe094('0x38')]()[_0xe094('0x24')](function(){var _0x4cf212=_0x3d60ff['get']({'plain':!![]});var _0x143843=_0xe094('0x39');return db[_0xe094('0x3a')][_0xe094('0x38')]({'where':{'type':_0x143843,'resourceId':_0x4cf212['id']}})['then'](function(){return _0x3d60ff;});})['then'](function(){_0x530e5e[_0xe094('0x2f')](0xcc)[_0xe094('0x30')]();});}};}function handleEntityNotFound(_0x29ca79,_0x291c94){return function(_0x90b292){if(!_0x90b292){_0x29ca79[_0xe094('0x3b')](0x194);}return _0x90b292;};}function handleError(_0x2de511,_0x20f0be){_0x20f0be=_0x20f0be||0x1f4;return function(_0x226122){logger['error'](_0x226122[_0xe094('0x3c')]);if(_0x226122[_0xe094('0x3d')]){delete _0x226122[_0xe094('0x3d')];}_0x2de511[_0xe094('0x2f')](_0x20f0be)[_0xe094('0x3e')](_0x226122);};}exports['index']=function(_0x1f0843,_0x5755f0){var _0x1f1ba4={'include':[{'model':db[_0xe094('0x3f')],'as':_0xe094('0x40')}]},_0x23c24a={},_0x422f67={'count':0x0,'rows':[]};var _0x4cd1e7=_['map'](db[_0xe094('0x41')]['rawAttributes'],function(_0x2962a9){return{'name':_0x2962a9['fieldName'],'type':_0x2962a9['type'][_0xe094('0x42')]};});_0x23c24a[_0xe094('0x43')]=_['map'](_0x4cd1e7,'name');_0x23c24a[_0xe094('0x44')]=_[_0xe094('0x45')](_0x1f0843[_0xe094('0x44')]);_0x23c24a['filters']=_[_0xe094('0x46')](_0x23c24a[_0xe094('0x43')],_0x23c24a[_0xe094('0x44')]);_0x1f1ba4['attributes']=_[_0xe094('0x46')](_0x23c24a['model'],qs['fields'](_0x1f0843[_0xe094('0x44')][_0xe094('0x47')]));_0x1f1ba4[_0xe094('0x48')]=_0x1f1ba4[_0xe094('0x48')][_0xe094('0x49')]?_0x1f1ba4[_0xe094('0x48')]:_0x23c24a[_0xe094('0x43')];if(!_0x1f0843[_0xe094('0x44')][_0xe094('0x4a')](_0xe094('0x4b'))){_0x1f1ba4[_0xe094('0x33')]=qs[_0xe094('0x33')](_0x1f0843[_0xe094('0x44')][_0xe094('0x33')]);_0x1f1ba4[_0xe094('0x32')]=qs[_0xe094('0x32')](_0x1f0843[_0xe094('0x44')]['offset']);}_0x1f1ba4[_0xe094('0x4c')]=qs[_0xe094('0x4d')](_0x1f0843[_0xe094('0x44')][_0xe094('0x4d')]);_0x1f1ba4[_0xe094('0x4e')]=qs['filters'](_[_0xe094('0x4f')](_0x1f0843[_0xe094('0x44')],_0x23c24a['filters']),_0x4cd1e7);if(_0x1f0843[_0xe094('0x44')][_0xe094('0x50')]){_0x1f1ba4['where']=_[_0xe094('0x51')](_0x1f1ba4[_0xe094('0x4e')],{'$or':_['map'](_0x4cd1e7,function(_0x2605a1){if(_0x2605a1[_0xe094('0x52')]!==_0xe094('0x53')){var _0x1987c0={};_0x1987c0[_0x2605a1[_0xe094('0x3d')]]={'$like':'%'+_0x1f0843[_0xe094('0x44')][_0xe094('0x50')]+'%'};return _0x1987c0;}})});}_0x1f1ba4=_[_0xe094('0x51')]({},_0x1f1ba4,_0x1f0843['options']);var _0x2fc806={'where':_0x1f1ba4[_0xe094('0x4e')]};return db[_0xe094('0x41')][_0xe094('0x54')](_0x2fc806)[_0xe094('0x24')](function(_0x30444c){_0x422f67[_0xe094('0x54')]=_0x30444c;if(_0x1f0843[_0xe094('0x44')][_0xe094('0x55')]){_0x1f1ba4['include']=[{'all':!![]}];}return db[_0xe094('0x41')][_0xe094('0x56')](_0x1f1ba4);})[_0xe094('0x24')](function(_0xb069a3){_0x422f67['rows']=_0xb069a3;return _0x422f67;})[_0xe094('0x24')](respondWithFilteredResult(_0x5755f0,_0x1f1ba4))[_0xe094('0x57')](handleError(_0x5755f0,null));};exports[_0xe094('0x58')]=function(_0x11f3d1,_0x35a66a){var _0x2e9ca1={'raw':![],'where':{'id':_0x11f3d1[_0xe094('0x59')]['id']},'include':[{'model':db[_0xe094('0x3f')],'as':_0xe094('0x40')}]},_0x127d39={};_0x127d39['model']=_[_0xe094('0x45')](db[_0xe094('0x41')][_0xe094('0x5a')]);_0x127d39[_0xe094('0x44')]=_[_0xe094('0x45')](_0x11f3d1[_0xe094('0x44')]);_0x127d39[_0xe094('0x5b')]=_[_0xe094('0x46')](_0x127d39[_0xe094('0x43')],_0x127d39[_0xe094('0x44')]);_0x2e9ca1['attributes']=_[_0xe094('0x46')](_0x127d39['model'],qs[_0xe094('0x47')](_0x11f3d1[_0xe094('0x44')][_0xe094('0x47')]));_0x2e9ca1[_0xe094('0x48')]=_0x2e9ca1[_0xe094('0x48')][_0xe094('0x49')]?_0x2e9ca1[_0xe094('0x48')]:_0x127d39[_0xe094('0x43')];if(_0x11f3d1['query'][_0xe094('0x55')]){_0x2e9ca1[_0xe094('0x5c')]=[{'all':!![]}];}_0x2e9ca1=_[_0xe094('0x51')]({},_0x2e9ca1,_0x11f3d1[_0xe094('0x5d')]);return db[_0xe094('0x41')][_0xe094('0x5e')](_0x2e9ca1)[_0xe094('0x24')](handleEntityNotFound(_0x35a66a,null))[_0xe094('0x24')](respondWithResult(_0x35a66a,null))[_0xe094('0x57')](handleError(_0x35a66a,null));};exports['create']=function(_0x5f4de7,_0x5ccae4){return db[_0xe094('0x41')]['create'](_0x5f4de7['body'],{})['then'](function(_0xbfe4de){var _0x1c754a=_0x5f4de7[_0xe094('0x5f')][_0xe094('0x60')]({'plain':!![]});if(!_0x1c754a)throw new Error(_0xe094('0x61'));if(_0x1c754a['role']===_0xe094('0x5f')){var _0x49c259=_0xbfe4de[_0xe094('0x60')]({'plain':!![]});var _0x58f7df=_0xe094('0x39');return db[_0xe094('0x62')][_0xe094('0x5e')]({'where':{'name':_0x58f7df,'userProfileId':_0x1c754a[_0xe094('0x63')]},'raw':!![]})[_0xe094('0x24')](function(_0x38dee6){if(_0x38dee6&&_0x38dee6[_0xe094('0x64')]===0x0){return db[_0xe094('0x3a')]['create']({'name':_0x49c259[_0xe094('0x3d')],'resourceId':_0x49c259['id'],'type':_0x38dee6[_0xe094('0x3d')],'sectionId':_0x38dee6['id']},{})['then'](function(){return _0xbfe4de;});}else{return _0xbfe4de;}})[_0xe094('0x57')](function(_0x305463){logger[_0xe094('0x2c')](_0xe094('0x65'),_0x305463);throw _0x305463;});}return _0xbfe4de;})['then'](respondWithResult(_0x5ccae4,0xc9))[_0xe094('0x57')](handleError(_0x5ccae4,null));};exports[_0xe094('0x66')]=function(_0x199cd6,_0x801c0d){if(_0x199cd6['body']['id']){delete _0x199cd6[_0xe094('0x67')]['id'];}return db[_0xe094('0x41')]['find']({'where':{'id':_0x199cd6[_0xe094('0x59')]['id']},'include':[{'model':db[_0xe094('0x3f')],'as':_0xe094('0x40')}]})['then'](handleEntityNotFound(_0x801c0d,null))['then'](saveUpdates(_0x199cd6[_0xe094('0x67')],null))['then'](respondWithResult(_0x801c0d,null))['catch'](handleError(_0x801c0d,null));};exports['destroy']=function(_0x478fee,_0x51e53f){return db[_0xe094('0x41')][_0xe094('0x5e')]({'where':{'id':_0x478fee[_0xe094('0x59')]['id']}})[_0xe094('0x24')](handleEntityNotFound(_0x51e53f,null))[_0xe094('0x24')](removeEntity(_0x51e53f,null))[_0xe094('0x57')](handleError(_0x51e53f,null));};exports[_0xe094('0x68')]=function(_0x5b6ad3,_0x11d654){return db[_0xe094('0x41')][_0xe094('0x68')]()[_0xe094('0x24')](respondWithResult(_0x11d654,null))[_0xe094('0x57')](handleError(_0x11d654,null));};exports['addDisposition']=function(_0x11a298,_0x2f59f1,_0xf3d2f){if(_0x11a298[_0xe094('0x67')]['id']){delete _0x11a298[_0xe094('0x67')]['id'];}return db[_0xe094('0x41')][_0xe094('0x5e')]({'where':{'id':_0x11a298[_0xe094('0x59')]['id']}})[_0xe094('0x24')](handleEntityNotFound(_0x2f59f1,null))[_0xe094('0x24')](function(_0x2cc298){if(_0x2cc298){_0x11a298['body'][_0xe094('0x69')]=_0x2cc298['id'];return db[_0xe094('0x6a')][_0xe094('0x6b')](_0x11a298[_0xe094('0x67')]);}})[_0xe094('0x24')](respondWithResult(_0x2f59f1,null))[_0xe094('0x57')](handleError(_0x2f59f1,null));};exports[_0xe094('0x6c')]=function(_0xeea9cb,_0x455896,_0xfcde90){var _0x2a0664={'raw':![],'where':{}};var _0x2b696a={};var _0x5c03a4={'count':0x0,'rows':[]};return db[_0xe094('0x41')][_0xe094('0x6d')]({'where':{'id':_0xeea9cb[_0xe094('0x59')]['id']}})['then'](handleEntityNotFound(_0x455896,null))[_0xe094('0x24')](function(_0x365062){if(_0x365062){_0x2b696a[_0xe094('0x43')]=_[_0xe094('0x45')](db[_0xe094('0x6a')][_0xe094('0x5a')]);_0x2b696a['query']=_['keys'](_0xeea9cb[_0xe094('0x44')]);_0x2b696a[_0xe094('0x5b')]=_[_0xe094('0x46')](_0x2b696a[_0xe094('0x43')],_0x2b696a[_0xe094('0x44')]);_0x2a0664[_0xe094('0x48')]=_[_0xe094('0x46')](_0x2b696a['model'],qs['fields'](_0xeea9cb[_0xe094('0x44')]['fields']));_0x2a0664[_0xe094('0x48')]=_0x2a0664[_0xe094('0x48')][_0xe094('0x49')]?_0x2a0664[_0xe094('0x48')]:_0x2b696a[_0xe094('0x43')];if(!_0xeea9cb[_0xe094('0x44')][_0xe094('0x4a')]('nolimit')){_0x2a0664['limit']=qs[_0xe094('0x33')](_0xeea9cb[_0xe094('0x44')][_0xe094('0x33')]);_0x2a0664[_0xe094('0x32')]=qs[_0xe094('0x32')](_0xeea9cb[_0xe094('0x44')][_0xe094('0x32')]);}_0x2a0664[_0xe094('0x4c')]=qs[_0xe094('0x4d')](_0xeea9cb[_0xe094('0x44')][_0xe094('0x4d')]);_0x2a0664['where']=qs[_0xe094('0x5b')](_[_0xe094('0x4f')](_0xeea9cb['query'],_0x2b696a[_0xe094('0x5b')]));_0x2a0664['where'][_0xe094('0x69')]=_0x365062['id'];if(_0xeea9cb[_0xe094('0x44')][_0xe094('0x50')]){_0x2a0664['where']=_['merge'](_0x2a0664[_0xe094('0x4e')],{'$or':_[_0xe094('0x6e')](_0x2a0664[_0xe094('0x48')],function(_0x2926e0){var _0xcd42c7={};_0xcd42c7[_0x2926e0]={'$like':'%'+_0xeea9cb[_0xe094('0x44')][_0xe094('0x50')]+'%'};return _0xcd42c7;})});}_0x2a0664=_[_0xe094('0x51')]({},_0x2a0664,_0xeea9cb[_0xe094('0x5d')]);return db['Disposition']['count']({'where':_0x2a0664[_0xe094('0x4e')]})[_0xe094('0x24')](function(_0x2ee411){_0x5c03a4[_0xe094('0x54')]=_0x2ee411;if(_0xeea9cb['query'][_0xe094('0x55')]){_0x2a0664[_0xe094('0x5c')]=[{'all':!![]}];}return db['Disposition'][_0xe094('0x56')](_0x2a0664);})[_0xe094('0x24')](function(_0x55f87b){_0x5c03a4[_0xe094('0x6f')]=_0x55f87b;return _0x5c03a4;});}})[_0xe094('0x24')](respondWithFilteredResult(_0x455896,_0x2a0664))['catch'](handleError(_0x455896,null));};exports['removeDispositions']=function(_0x255ea5,_0x30e6c7,_0x5332e1){return db[_0xe094('0x41')][_0xe094('0x5e')]({'where':{'id':_0x255ea5[_0xe094('0x59')]['id']}})[_0xe094('0x24')](handleEntityNotFound(_0x30e6c7,null))['then'](function(_0x45911a){if(_0x45911a){return _0x45911a[_0xe094('0x70')](_0x255ea5[_0xe094('0x44')][_0xe094('0x71')]);}})[_0xe094('0x24')](respondWithStatusCode(_0x30e6c7,null))[_0xe094('0x57')](handleError(_0x30e6c7,null));};exports['addAnswer']=function(_0x5a9845,_0x304ac6,_0x384187){if(_0x5a9845[_0xe094('0x67')]['id']){delete _0x5a9845[_0xe094('0x67')]['id'];}return db[_0xe094('0x41')][_0xe094('0x5e')]({'where':{'id':_0x5a9845[_0xe094('0x59')]['id']}})[_0xe094('0x24')](handleEntityNotFound(_0x304ac6,null))['then'](function(_0x3da9eb){if(_0x3da9eb){_0x5a9845['body'][_0xe094('0x69')]=_0x3da9eb['id'];return db[_0xe094('0x72')]['create'](_0x5a9845[_0xe094('0x67')]);}})[_0xe094('0x24')](respondWithResult(_0x304ac6,null))[_0xe094('0x57')](handleError(_0x304ac6,null));};exports['getAnswers']=function(_0x157225,_0x3b918a,_0xee4480){var _0x537a35={'raw':![],'where':{}};var _0x107156={};var _0x534cb1={'count':0x0,'rows':[]};return db['FaxAccount'][_0xe094('0x6d')]({'where':{'id':_0x157225['params']['id']}})['then'](handleEntityNotFound(_0x3b918a,null))[_0xe094('0x24')](function(_0x4e2aa7){if(_0x4e2aa7){_0x107156[_0xe094('0x43')]=_[_0xe094('0x45')](db['CannedAnswer'][_0xe094('0x5a')]);_0x107156[_0xe094('0x44')]=_[_0xe094('0x45')](_0x157225[_0xe094('0x44')]);_0x107156['filters']=_[_0xe094('0x46')](_0x107156[_0xe094('0x43')],_0x107156['query']);_0x537a35[_0xe094('0x48')]=_[_0xe094('0x46')](_0x107156[_0xe094('0x43')],qs[_0xe094('0x47')](_0x157225[_0xe094('0x44')][_0xe094('0x47')]));_0x537a35['attributes']=_0x537a35[_0xe094('0x48')][_0xe094('0x49')]?_0x537a35[_0xe094('0x48')]:_0x107156[_0xe094('0x43')];if(!_0x157225[_0xe094('0x44')][_0xe094('0x4a')]('nolimit')){_0x537a35[_0xe094('0x33')]=qs['limit'](_0x157225[_0xe094('0x44')]['limit']);_0x537a35[_0xe094('0x32')]=qs[_0xe094('0x32')](_0x157225[_0xe094('0x44')][_0xe094('0x32')]);}_0x537a35['order']=qs['sort'](_0x157225[_0xe094('0x44')][_0xe094('0x4d')]);_0x537a35[_0xe094('0x4e')]=qs[_0xe094('0x5b')](_[_0xe094('0x4f')](_0x157225[_0xe094('0x44')],_0x107156[_0xe094('0x5b')]));_0x537a35[_0xe094('0x4e')]['FaxAccountId']=_0x4e2aa7['id'];if(_0x157225[_0xe094('0x44')][_0xe094('0x50')]){_0x537a35[_0xe094('0x4e')]=_[_0xe094('0x51')](_0x537a35[_0xe094('0x4e')],{'$or':_[_0xe094('0x6e')](_0x537a35[_0xe094('0x48')],function(_0x5b5192){var _0x541ca9={};_0x541ca9[_0x5b5192]={'$like':'%'+_0x157225[_0xe094('0x44')][_0xe094('0x50')]+'%'};return _0x541ca9;})});}_0x537a35=_[_0xe094('0x51')]({},_0x537a35,_0x157225['options']);return db[_0xe094('0x72')][_0xe094('0x54')]({'where':_0x537a35[_0xe094('0x4e')]})[_0xe094('0x24')](function(_0x1c0e76){_0x534cb1[_0xe094('0x54')]=_0x1c0e76;if(_0x157225[_0xe094('0x44')][_0xe094('0x55')]){_0x537a35[_0xe094('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0xe094('0x56')](_0x537a35);})[_0xe094('0x24')](function(_0x536c78){_0x534cb1['rows']=_0x536c78;return _0x534cb1;});}})[_0xe094('0x24')](respondWithFilteredResult(_0x3b918a,_0x537a35))['catch'](handleError(_0x3b918a,null));};exports[_0xe094('0x73')]=function(_0x467ae1,_0x590ef6,_0x275d16){return db[_0xe094('0x41')][_0xe094('0x5e')]({'where':{'id':_0x467ae1['params']['id']}})[_0xe094('0x24')](handleEntityNotFound(_0x590ef6,null))[_0xe094('0x24')](function(_0x5a22bc){if(_0x5a22bc){return _0x5a22bc[_0xe094('0x73')](_0x467ae1[_0xe094('0x44')][_0xe094('0x71')]);}})[_0xe094('0x24')](respondWithStatusCode(_0x590ef6,null))[_0xe094('0x57')](handleError(_0x590ef6,null));};exports[_0xe094('0x74')]=function(_0x2f8e6f,_0x2655bc,_0x377676){return db[_0xe094('0x75')][_0xe094('0x5e')]({'where':{'id':_0x2f8e6f[_0xe094('0x59')]['id']}})[_0xe094('0x24')](handleEntityNotFound(_0x2655bc,null))[_0xe094('0x24')](function(_0x3bd157){if(_0x3bd157){return _0x3bd157[_0xe094('0x74')](_0x2f8e6f[_0xe094('0x67')]['ids'],_[_0xe094('0x76')](_0x2f8e6f['body'],[_0xe094('0x71'),'id'])||{});}})['then'](respondWithResult(_0x2655bc,null))['catch'](handleError(_0x2655bc,null));};exports[_0xe094('0x77')]=function(_0x113037,_0x5b0faa,_0x1de96b){var _0x51b3ec={'raw':![],'where':{}};var _0xbf606d={};var _0x2fc103={'count':0x0,'rows':[]};return db['FaxAccount'][_0xe094('0x6d')]({'where':{'id':_0x113037['params']['id']}})[_0xe094('0x24')](handleEntityNotFound(_0x5b0faa,null))[_0xe094('0x24')](function(_0x4466ff){if(_0x4466ff){_0xbf606d[_0xe094('0x43')]=_['keys'](db[_0xe094('0x75')][_0xe094('0x5a')]);_0xbf606d[_0xe094('0x44')]=_[_0xe094('0x45')](_0x113037[_0xe094('0x44')]);_0xbf606d[_0xe094('0x5b')]=_[_0xe094('0x46')](_0xbf606d['model'],_0xbf606d[_0xe094('0x44')]);_0x51b3ec[_0xe094('0x48')]=_[_0xe094('0x46')](_0xbf606d[_0xe094('0x43')],qs[_0xe094('0x47')](_0x113037[_0xe094('0x44')][_0xe094('0x47')]));_0x51b3ec[_0xe094('0x48')]=_0x51b3ec[_0xe094('0x48')][_0xe094('0x49')]?_0x51b3ec[_0xe094('0x48')]:_0xbf606d[_0xe094('0x43')];if(!_0x113037[_0xe094('0x44')][_0xe094('0x4a')](_0xe094('0x4b'))){_0x51b3ec[_0xe094('0x33')]=qs[_0xe094('0x33')](_0x113037[_0xe094('0x44')]['limit']);_0x51b3ec[_0xe094('0x32')]=qs[_0xe094('0x32')](_0x113037['query']['offset']);}_0x51b3ec['order']=qs[_0xe094('0x4d')](_0x113037['query'][_0xe094('0x4d')]);_0x51b3ec[_0xe094('0x4e')]=qs['filters'](_[_0xe094('0x4f')](_0x113037[_0xe094('0x44')],_0xbf606d[_0xe094('0x5b')]));_0x51b3ec['where'][_0xe094('0x69')]=_0x4466ff['id'];if(_0x113037[_0xe094('0x44')]['filter']){_0x51b3ec[_0xe094('0x4e')]=_[_0xe094('0x51')](_0x51b3ec['where'],{'$or':_[_0xe094('0x6e')](_0x51b3ec[_0xe094('0x48')],function(_0x1f8e7c){var _0x30f1d2={};_0x30f1d2[_0x1f8e7c]={'$like':'%'+_0x113037[_0xe094('0x44')][_0xe094('0x50')]+'%'};return _0x30f1d2;})});}_0x51b3ec=_[_0xe094('0x51')]({},_0x51b3ec,_0x113037[_0xe094('0x5d')]);return db[_0xe094('0x75')]['count']({'where':_0x51b3ec['where']})['then'](function(_0x50dfa1){_0x2fc103[_0xe094('0x54')]=_0x50dfa1;if(_0x113037[_0xe094('0x44')][_0xe094('0x55')]){_0x51b3ec['include']=[{'model':db[_0xe094('0x78')],'as':_0xe094('0x79'),'required':![]},{'model':db['User'],'as':_0xe094('0x7a'),'attributes':[_0xe094('0x3d'),_0xe094('0x7b'),_0xe094('0x7c')],'required':![]},{'model':db[_0xe094('0x7d')],'as':_0xe094('0x7e'),'attributes':['id','name',_0xe094('0x7f')],'where':_0x113037[_0xe094('0x44')][_0xe094('0x80')]?{'id':_0x113037[_0xe094('0x44')][_0xe094('0x80')]}:undefined,'required':_0x113037[_0xe094('0x44')][_0xe094('0x80')]?!![]:![]}];}return db[_0xe094('0x75')][_0xe094('0x56')](_0x51b3ec);})['then'](function(_0x4335a0){_0x2fc103[_0xe094('0x6f')]=_0x4335a0;return _0x2fc103;});}})[_0xe094('0x24')](respondWithFilteredResult(_0x5b0faa,_0x51b3ec))[_0xe094('0x57')](handleError(_0x5b0faa,null));};exports[_0xe094('0x81')]=function(_0x256a0a,_0x31c436,_0x8af5a6){return db[_0xe094('0x41')][_0xe094('0x6d')]({'where':{'id':_0x256a0a[_0xe094('0x59')]['id']}})[_0xe094('0x24')](handleEntityNotFound(_0x31c436,null))[_0xe094('0x24')](function(_0x39908f){if(_0x39908f){return db[_0xe094('0x82')][_0xe094('0x83')](function(_0x18c875){return db['FaxApplication'][_0xe094('0x38')]({'where':{'FaxAccountId':_0x256a0a[_0xe094('0x59')]['id']},'transaction':_0x18c875})['then'](function(_0x2346c6){var _0x475cd5=_[_0xe094('0x6e')](_0x256a0a[_0xe094('0x67')],function(_0x433e8c){_0x433e8c['FaxAccountId']=_0x256a0a[_0xe094('0x59')]['id'];return _0x433e8c;});return db[_0xe094('0x84')][_0xe094('0x85')](_0x475cd5,{'transaction':_0x18c875});});})[_0xe094('0x24')](function(){return db['FaxApplication'][_0xe094('0x86')]({'where':{'FaxAccountId':_0x256a0a[_0xe094('0x59')]['id']},'order':'priority'});});}})[_0xe094('0x24')](respondWithResult(_0x31c436,null))[_0xe094('0x57')](handleError(_0x31c436,null));};exports[_0xe094('0x87')]=function(_0xfdc422,_0x70d50,_0xfabb36){var _0x508d12={};var _0x38089d={};var _0x434668;var _0xb4bc4c;return db[_0xe094('0x41')]['findOne']({'where':{'id':_0xfdc422[_0xe094('0x59')]['id']}})[_0xe094('0x24')](handleEntityNotFound(_0x70d50,null))['then'](function(_0x76ec0b){if(_0x76ec0b){_0x434668=_0x76ec0b;_0x38089d['model']=_[_0xe094('0x45')](db[_0xe094('0x84')][_0xe094('0x5a')]);_0x38089d[_0xe094('0x44')]=_[_0xe094('0x45')](_0xfdc422[_0xe094('0x44')]);_0x38089d[_0xe094('0x5b')]=_[_0xe094('0x46')](_0x38089d['model'],_0x38089d[_0xe094('0x44')]);_0x508d12[_0xe094('0x48')]=_['intersection'](_0x38089d['model'],qs['fields'](_0xfdc422[_0xe094('0x44')][_0xe094('0x47')]));_0x508d12[_0xe094('0x48')]=_0x508d12['attributes'][_0xe094('0x49')]?_0x508d12[_0xe094('0x48')]:_0x38089d[_0xe094('0x43')];_0x508d12[_0xe094('0x4c')]=qs[_0xe094('0x4d')](_0xfdc422[_0xe094('0x44')][_0xe094('0x4d')]);_0x508d12[_0xe094('0x4e')]=qs[_0xe094('0x5b')](_[_0xe094('0x4f')](_0xfdc422[_0xe094('0x44')],_0x38089d[_0xe094('0x5b')]));if(_0xfdc422['query'][_0xe094('0x50')]){_0x508d12['where']=_[_0xe094('0x51')](_0x508d12[_0xe094('0x4e')],{'$or':_[_0xe094('0x6e')](_0x508d12[_0xe094('0x48')],function(_0x1bb4bc){var _0x46995a={};_0x46995a[_0x1bb4bc]={'$like':'%'+_0xfdc422[_0xe094('0x44')]['filter']+'%'};return _0x46995a;})});}_0x508d12=_['merge']({},_0x508d12,_0xfdc422['options']);return _0x434668[_0xe094('0x87')](_0x508d12);}})[_0xe094('0x24')](function(_0x563522){if(_0x563522){_0xb4bc4c=_0x563522['length'];if(!_0xfdc422[_0xe094('0x44')][_0xe094('0x4a')](_0xe094('0x4b'))){_0x508d12['limit']=qs[_0xe094('0x33')](_0xfdc422[_0xe094('0x44')][_0xe094('0x33')]);_0x508d12[_0xe094('0x32')]=qs['offset'](_0xfdc422['query'][_0xe094('0x32')]);}return _0x434668[_0xe094('0x87')](_0x508d12);}})[_0xe094('0x24')](function(_0x229866){if(_0x229866){return _0x229866?{'count':_0xb4bc4c,'rows':_0x229866}:null;}})[_0xe094('0x24')](respondWithResult(_0x70d50,null))[_0xe094('0x57')](handleError(_0x70d50,null));};function Extension(_0x287936,_0x2fbd42,_0xaa8526,_0x1eec74){this[_0xe094('0x88')]='from-voip-provider';this[_0xe094('0x89')]=_0x287936['localstationid'];this[_0xe094('0x8a')]=_0x1eec74;this[_0xe094('0x52')]=_0xe094('0x8b');this[_0xe094('0x8c')]=_0xe094('0x8d');this[_0xe094('0x69')]=_0x287936['id'];this[_0xe094('0x8e')]=_0x2fbd42;this[_0xe094('0x8f')]=_0xaa8526;}function createExtensionsReciveFax(_0x105fbe){var _0x577c2e=0x1;var _0x167e18=[];_0x167e18[_0xe094('0x90')](new Extension(_0x105fbe,_0x577c2e,'',_0xe094('0x91')));_0x577c2e+=0x1;_0x167e18[_0xe094('0x90')](new Extension(_0x105fbe,_0x577c2e,_0xe094('0x92'),_0xe094('0x93')));_0x577c2e+=0x1;for(var _0x57e452 in _0x105fbe){if(_0x105fbe[_0xe094('0x4a')](_0x57e452)&&(_0x57e452===_0xe094('0x94')||_0x57e452===_0xe094('0x95')||_0x57e452===_0xe094('0x96')||_0x57e452===_0xe094('0x97')||_0x57e452==='headerinfo'||_0x57e452===_0xe094('0x98')||_0x57e452==='minrate'||_0x57e452===_0xe094('0x99')||_0x57e452==='t38timeout')){_0x167e18[_0xe094('0x90')](new Extension(_0x105fbe,_0x577c2e,_0xe094('0x9a')+_0x57e452+')='+_0x105fbe[_0x57e452],_0xe094('0x93')));_0x577c2e+=0x1;}}_0x167e18[_0xe094('0x90')](new Extension(_0x105fbe,_0x577c2e,'6',_0xe094('0x9b')));_0x577c2e+=0x1;_0x167e18[_0xe094('0x90')](new Extension(_0x105fbe,_0x577c2e,'/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',_0xe094('0x9c')));_0x577c2e=0x0;return _0x167e18;}exports['addAccountApplications']=function(_0x3e6b60,_0x237b85,_0x5c3026){var _0x51557c;return db['sequelize']['transaction'](function(_0x589c74){return db[_0xe094('0x41')][_0xe094('0x6b')](_0x3e6b60[_0xe094('0x67')],{'transaction':_0x589c74})[_0xe094('0x24')](function(_0x22b056){_0x51557c=_0x22b056[_0xe094('0x60')]({'plain':!![]});return db[_0xe094('0x9d')]['bulkCreate'](createExtensionsReciveFax(_0x51557c),{'transaction':_0x589c74});});})[_0xe094('0x24')](function(){return _0x51557c;})[_0xe094('0x24')](respondWithResult(_0x237b85,null))[_0xe094('0x57')](handleError(_0x237b85,null));};exports[_0xe094('0x9e')]=function(_0x4990e2,_0xc64403,_0x281bab){var _0x241eb7;return db[_0xe094('0x82')][_0xe094('0x83')](function(_0x3cdd6a){return db['FaxAccount']['update'](_0x4990e2[_0xe094('0x67')],{'where':{'id':_0x4990e2[_0xe094('0x67')]['id']},'transaction':_0x3cdd6a})['then'](function(_0x2ba227){return db[_0xe094('0x9d')][_0xe094('0x38')]({'where':{'FaxAccountId':_0x4990e2[_0xe094('0x67')]['id']},'transaction':_0x3cdd6a})[_0xe094('0x24')](function(_0x358e79){return db[_0xe094('0x9d')][_0xe094('0x85')](createExtensionsReciveFax(_['omit'](_0x4990e2[_0xe094('0x67')],[_0xe094('0x9f'),'key','createdAt','updatedAt',_0xe094('0xa0'),_0xe094('0xa1')])),{'transaction':_0x3cdd6a});});});})[_0xe094('0x24')](function(){return db[_0xe094('0x41')]['findById'](_0x4990e2['body']['id']);})['then'](respondWithResult(_0xc64403,null))[_0xe094('0x57')](handleError(_0xc64403,null));};exports['getMessages']=function(_0x4d72ac,_0x42a789,_0x421628){var _0x35300f={'raw':!![],'where':{}};var _0x9c3ba7={};var _0x602023={'count':0x0,'rows':[]};return db[_0xe094('0x41')]['findOne']({'where':{'id':_0x4d72ac['params']['id']}})[_0xe094('0x24')](handleEntityNotFound(_0x42a789,null))[_0xe094('0x24')](function(_0x45fd9b){if(_0x45fd9b){_0x9c3ba7[_0xe094('0x43')]=_['keys'](db['FaxMessage'][_0xe094('0x5a')]);_0x9c3ba7['query']=_[_0xe094('0x45')](_0x4d72ac[_0xe094('0x44')]);_0x9c3ba7[_0xe094('0x5b')]=_[_0xe094('0x46')](_0x9c3ba7[_0xe094('0x43')],_0x9c3ba7['query']);_0x35300f[_0xe094('0x48')]=_[_0xe094('0x46')](_0x9c3ba7['model'],qs[_0xe094('0x47')](_0x4d72ac[_0xe094('0x44')][_0xe094('0x47')]));_0x35300f[_0xe094('0x48')]=_0x35300f[_0xe094('0x48')]['length']?_0x35300f[_0xe094('0x48')]:_0x9c3ba7['model'];if(!_0x4d72ac[_0xe094('0x44')]['hasOwnProperty'](_0xe094('0x4b'))){_0x35300f[_0xe094('0x33')]=qs[_0xe094('0x33')](_0x4d72ac[_0xe094('0x44')]['limit']);_0x35300f['offset']=qs[_0xe094('0x32')](_0x4d72ac[_0xe094('0x44')][_0xe094('0x32')]);}_0x35300f[_0xe094('0x4c')]=qs['sort'](_0x4d72ac[_0xe094('0x44')][_0xe094('0x4d')]);_0x35300f[_0xe094('0x4e')]=qs['filters'](_['pick'](_0x4d72ac[_0xe094('0x44')],_0x9c3ba7['filters']));_0x35300f['where'][_0xe094('0x69')]=_0x45fd9b['id'];if(_0x4d72ac['query'][_0xe094('0x50')]){_0x35300f[_0xe094('0x4e')]=_[_0xe094('0x51')](_0x35300f[_0xe094('0x4e')],{'$or':_[_0xe094('0x6e')](_0x35300f[_0xe094('0x48')],function(_0x2aa92c){var _0x1a360a={};_0x1a360a[_0x2aa92c]={'$like':'%'+_0x4d72ac['query']['filter']+'%'};return _0x1a360a;})});}if(_0x4d72ac[_0xe094('0x44')][_0xe094('0xa2')]){var _0x373cff=_0x4d72ac[_0xe094('0x44')][_0xe094('0xa2')][_0xe094('0xa3')](',');var _0x265f2d={};_0x265f2d[_0x373cff[0x0]]={'$gte':moment(_0x373cff[0x1])[_0xe094('0xa4')](_0xe094('0xa5'))};_0x35300f[_0xe094('0x4e')]=_[_0xe094('0x51')](_0x35300f['where'],_0x265f2d);}_0x35300f=_[_0xe094('0x51')]({},_0x35300f,_0x4d72ac[_0xe094('0x5d')]);return db['FaxMessage'][_0xe094('0x54')]({'where':_0x35300f['where']})[_0xe094('0x24')](function(_0x37a052){_0x602023['count']=_0x37a052;if(_0x4d72ac['query'][_0xe094('0x55')]){_0x35300f[_0xe094('0x5c')]=[{'all':!![]}];}return db['FaxMessage'][_0xe094('0x56')](_0x35300f);})[_0xe094('0x24')](function(_0x177b2b){_0x602023[_0xe094('0x6f')]=_0x177b2b;return _0x602023;});}})[_0xe094('0x24')](respondWithFilteredResult(_0x42a789,_0x35300f))[_0xe094('0x57')](handleError(_0x42a789,null));};exports[_0xe094('0x3e')]=function(_0x2d9086,_0x476583,_0x3e2810){var _0x27494a,_0x26c53a={},_0x1a7570;if(_0x2d9086[_0xe094('0x67')]['to']){_0x1a7570=_0x2d9086[_0xe094('0x67')]['to'][0x0];}return db[_0xe094('0x41')][_0xe094('0x5e')]({'where':{'id':_0x2d9086[_0xe094('0x59')]['id']},'include':[{'model':db[_0xe094('0xa6')],'as':'List','include':[{'model':db[_0xe094('0x78')],'as':_0xe094('0xa7'),'where':{'fax':_0x1a7570},'limit':0x1,'order':[[_0xe094('0xa8'),_0xe094('0xa9')]]}]}]})[_0xe094('0x24')](handleEntityNotFound(_0x476583,null))['then'](function(_0x2d5c19){_0x27494a=_0x2d5c19;if(_0x2d9086[_0xe094('0x67')][_0xe094('0xaa')]&&_0x2d9086[_0xe094('0x67')]['attachments'][_0xe094('0x49')]){for(var _0x2f164c=0x0;_0x2f164c<_0x2d9086[_0xe094('0x67')][_0xe094('0xaa')][_0xe094('0x49')];_0x2f164c+=0x1){_0x2d9086[_0xe094('0x67')][_0xe094('0xaa')][_0x2f164c]={'filename':_0x2d9086[_0xe094('0x67')][_0xe094('0xaa')][_0x2f164c][_0xe094('0x3d')],'id':_0x2d9086[_0xe094('0x67')][_0xe094('0xaa')][_0x2f164c]['id'],'path':path[_0xe094('0xab')](config[_0xe094('0xac')],_0xe094('0xad'),_0x2d9086[_0xe094('0x67')][_0xe094('0xaa')][_0x2f164c][_0xe094('0xae')])};}}return respondWithRpcPromise(_0xe094('0xaf'),_0xe094('0xaf'),{'FaxAccountId':_[_0xe094('0xb0')](_0x2d9086[_0xe094('0x59')]['id'])?undefined:_0x2d9086[_0xe094('0x59')]['id'],'path':_[_0xe094('0xb0')](_0x2d9086['body'][_0xe094('0xaa')][0x0][_0xe094('0x7')])?undefined:_0x2d9086[_0xe094('0x67')][_0xe094('0xaa')][0x0][_0xe094('0x7')],'fax':_[_0xe094('0xb0')](_0x2d9086['body']['to'][0x0])?undefined:_0x2d9086[_0xe094('0x67')]['to'][0x0]},client9002);})[_0xe094('0x24')](function(){if(_0x27494a){if(_[_0xe094('0xb0')](_0x2d9086[_0xe094('0x67')]['from'])){_0x2d9086[_0xe094('0x67')]['from']=util[_0xe094('0xa4')](_0xe094('0xb1'),_0x27494a['name'],_0x27494a[_0xe094('0xb2')]);}if(_0x27494a[_0xe094('0xb3')]){if(_0x27494a['List'][_0xe094('0xa7')][_0xe094('0x49')]){return _0x27494a[_0xe094('0xb3')][_0xe094('0xa7')][0x0];}else{return db[_0xe094('0x78')][_0xe094('0x6b')](_[_0xe094('0x18')](_0x2d9086[_0xe094('0x67')],{'firstName':_0x2d9086[_0xe094('0x67')]['to'][0x0],'phone':_0x2d9086[_0xe094('0x67')]['to'][0x0],'fax':_0x2d9086['body']['to'][0x0],'ListId':_0x27494a[_0xe094('0xa1')]}));}}else{throw new Error(_0xe094('0xb4'));}}else{throw new Error(_0xe094('0xb5'));}})['then'](function(_0xbcca88){if(_0xbcca88){return db[_0xe094('0x75')]['find']({'where':{'ContactId':_0xbcca88['id'],'closed':![],'FaxAccountId':_0x27494a['id']}})[_0xe094('0x24')](function(_0x56b1b1){if(_0x56b1b1){return[_0x56b1b1,![]];}return db[_0xe094('0x75')][_0xe094('0x6b')]({'UserId':_0x2d9086[_0xe094('0x5f')]['id'],'ContactId':_0xbcca88['id'],'FaxAccountId':_0x27494a['id'],'fax':_0x2d9086[_0xe094('0x67')]['to'][0x0],'firstMsgDirection':_0xe094('0xb6'),'Messages':[_['merge'](_0x2d9086['body'],{'read':![],'body':_0x2d9086[_0xe094('0x67')][_0xe094('0xaa')][0x0][_0xe094('0xb7')],'FaxAccountId':_0x27494a['id'],'UserId':_0x2d9086[_0xe094('0x5f')]['id'],'ContactId':_0xbcca88['id'],'AttachmentId':_0x2d9086['body'][_0xe094('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0xe094('0xb8')],'as':'Messages'}]})[_0xe094('0x24')](function(_0x309449){return[_0x309449,!![]];});});}else{throw new Error(_0xe094('0xb9'));}})[_0xe094('0xba')](function(_0x54cdc0,_0x35c0c9){if(_0x35c0c9){return _0x54cdc0;}return db[_0xe094('0xb8')][_0xe094('0x6b')]({'direction':_0xe094('0xb6'),'read':![],'body':_0x2d9086['body'][_0xe094('0xaa')][0x0][_0xe094('0xb7')],'FaxAccountId':_0x27494a['id'],'FaxInteractionId':_0x54cdc0['id'],'UserId':_0x2d9086[_0xe094('0x5f')]['id'],'ContactId':_0x54cdc0[_0xe094('0xbb')],'AttachmentId':_0x2d9086['body'][_0xe094('0xaa')][0x0]['id']})['then'](function(_0x2e1cb5){_0x54cdc0[_0xe094('0xbc')][_0xe094('0xbd')]=[];_0x54cdc0['dataValues']['Messages'][_0xe094('0x90')](_0x2e1cb5[_0xe094('0xbc')]);return _0x54cdc0;});})['then'](function(_0x491c0a){respondWithRpcPromise(_0xe094('0xbe'),_0xe094('0xbe'),{'FaxAccountId':_['isNil'](_0x2d9086[_0xe094('0x59')]['id'])?undefined:_0x2d9086[_0xe094('0x59')]['id'],'path':_[_0xe094('0xb0')](_0x2d9086[_0xe094('0x67')][_0xe094('0xaa')][0x0][_0xe094('0x7')])?undefined:_0x2d9086[_0xe094('0x67')]['attachments'][0x0][_0xe094('0x7')],'fax':_['isNil'](_0x2d9086[_0xe094('0x67')]['to'][0x0])?undefined:_0x2d9086[_0xe094('0x67')]['to'][0x0],'AttachmentId':_0x2d9086['body'][_0xe094('0xaa')][0x0]['id']},client9002)[_0xe094('0x24')](function(_0x2ad463){logger[_0xe094('0x25')](_0xe094('0xbf'),_0x2ad463);})['catch'](function(_0x4ca6a0){logger[_0xe094('0x25')]('SendFaxRpc,\x20%s',_0x4ca6a0);});return _0x491c0a;})[_0xe094('0x24')](respondWithResult(_0x476583,null))[_0xe094('0x57')](handleError(_0x476583,null));};exports['addAgents']=function(_0x15f8dd,_0x43fdf7,_0x26da55){return db['FaxAccount'][_0xe094('0x5e')]({'where':{'id':_0x15f8dd[_0xe094('0x59')]['id']}})[_0xe094('0x24')](handleEntityNotFound(_0x43fdf7,null))[_0xe094('0x24')](function(_0x5081ed){if(_0x5081ed){return _0x5081ed[_0xe094('0xc0')](_0x15f8dd['body'][_0xe094('0x71')],_['omit'](_0x15f8dd['body'],['ids','id'])||{})[_0xe094('0xba')](function(_0xa3e69c){for(var _0x3dbe62=0x0;_0x3dbe62<_0x15f8dd[_0xe094('0x67')][_0xe094('0x71')][_0xe094('0x49')];_0x3dbe62+=0x1){socket[_0xe094('0xc1')](_0xe094('0xc2'),{'UserId':_0x15f8dd[_0xe094('0x67')]['ids'][_0x3dbe62],'FaxAccountId':_0x15f8dd[_0xe094('0x59')]['id']});}return _0xa3e69c;});}})[_0xe094('0x24')](respondWithResult(_0x43fdf7,null))[_0xe094('0x57')](handleError(_0x43fdf7,null));};exports[_0xe094('0xc3')]=function(_0x52209f,_0x224ed6,_0x332f79){return db[_0xe094('0x41')][_0xe094('0x5e')]({'where':{'id':_0x52209f[_0xe094('0x59')]['id']}})['then'](handleEntityNotFound(_0x224ed6,null))['then'](function(_0x4a711c){if(_0x4a711c){return _0x4a711c[_0xe094('0xc3')](_0x52209f[_0xe094('0x44')][_0xe094('0x71')])[_0xe094('0x24')](function(){if(_[_0xe094('0xc4')](_0x52209f[_0xe094('0x44')][_0xe094('0x71')])){for(var _0x2a232e=0x0;_0x2a232e<_0x52209f[_0xe094('0x44')][_0xe094('0x71')][_0xe094('0x49')];_0x2a232e+=0x1){socket['emit'](_0xe094('0xc5'),{'UserId':Number(_0x52209f['query'][_0xe094('0x71')][_0x2a232e]),'FaxAccountId':Number(_0x52209f[_0xe094('0x59')]['id'])});}}else{socket['emit'](_0xe094('0xc5'),{'UserId':Number(_0x52209f[_0xe094('0x44')][_0xe094('0x71')]),'FaxAccountId':Number(_0x52209f[_0xe094('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x224ed6,null))[_0xe094('0x57')](handleError(_0x224ed6,null));};exports[_0xe094('0xc6')]=function(_0x22a0cd,_0x155f88,_0x583750){var _0x2e0ef5={};var _0xdb8b7d={};var _0x41b021;var _0xff4ee8;return db['FaxAccount'][_0xe094('0x6d')]({'where':{'id':_0x22a0cd[_0xe094('0x59')]['id']}})['then'](handleEntityNotFound(_0x155f88,null))[_0xe094('0x24')](function(_0x1e509c){if(_0x1e509c){_0x41b021=_0x1e509c;_0xdb8b7d[_0xe094('0x43')]=_[_0xe094('0x45')](db['User'][_0xe094('0x5a')]);_0xdb8b7d[_0xe094('0x44')]=_[_0xe094('0x45')](_0x22a0cd[_0xe094('0x44')]);_0xdb8b7d[_0xe094('0x5b')]=_[_0xe094('0x46')](_0xdb8b7d[_0xe094('0x43')],_0xdb8b7d[_0xe094('0x44')]);_0x2e0ef5[_0xe094('0x48')]=_['intersection'](_0xdb8b7d[_0xe094('0x43')],qs[_0xe094('0x47')](_0x22a0cd[_0xe094('0x44')][_0xe094('0x47')]));_0x2e0ef5['attributes']=_0x2e0ef5['attributes'][_0xe094('0x49')]?_0x2e0ef5[_0xe094('0x48')]:_0xdb8b7d[_0xe094('0x43')];_0x2e0ef5[_0xe094('0x4c')]=qs[_0xe094('0x4d')](_0x22a0cd[_0xe094('0x44')][_0xe094('0x4d')]);_0x2e0ef5['where']=qs['filters'](_['pick'](_0x22a0cd[_0xe094('0x44')],_0xdb8b7d['filters']));if(_0x22a0cd[_0xe094('0x44')]['filter']){_0x2e0ef5[_0xe094('0x4e')]=_['merge'](_0x2e0ef5[_0xe094('0x4e')],{'$or':_[_0xe094('0x6e')](_0x2e0ef5[_0xe094('0x48')],function(_0x271801){var _0x419891={};_0x419891[_0x271801]={'$like':'%'+_0x22a0cd[_0xe094('0x44')][_0xe094('0x50')]+'%'};return _0x419891;})});}_0x2e0ef5=_[_0xe094('0x51')]({},_0x2e0ef5,_0x22a0cd[_0xe094('0x5d')]);return _0x41b021[_0xe094('0xc6')](_0x2e0ef5);}})[_0xe094('0x24')](function(_0xd256d9){if(_0xd256d9){_0xff4ee8=_0xd256d9[_0xe094('0x49')];if(!_0x22a0cd[_0xe094('0x44')][_0xe094('0x4a')](_0xe094('0x4b'))){_0x2e0ef5[_0xe094('0x33')]=qs[_0xe094('0x33')](_0x22a0cd[_0xe094('0x44')][_0xe094('0x33')]);_0x2e0ef5[_0xe094('0x32')]=qs['offset'](_0x22a0cd[_0xe094('0x44')]['offset']);}return _0x41b021[_0xe094('0xc6')](_0x2e0ef5);}})['then'](function(_0x31f7fe){if(_0x31f7fe){return _0x31f7fe?{'count':_0xff4ee8,'rows':_0x31f7fe}:null;}})[_0xe094('0x24')](respondWithResult(_0x155f88,null))[_0xe094('0x57')](handleError(_0x155f88,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index c426df7..4825078 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 _0x0faa=['../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x54f3b3,_0x4d0c8f){var _0x570b52=function(_0x4cacf5){while(--_0x4cacf5){_0x54f3b3['push'](_0x54f3b3['shift']());}};_0x570b52(++_0x4d0c8f);}(_0x0faa,0x13f));var _0xa0fa=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x0faa[_0x2d7f0e];return _0x110b07;};'use strict';var EventEmitter=require(_0xa0fa('0x0'));var FaxAccount=require(_0xa0fa('0x1'))['db'][_0xa0fa('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xa0fa('0x3')](0x0);var events={'afterCreate':_0xa0fa('0x4'),'afterUpdate':_0xa0fa('0x5'),'afterDestroy':_0xa0fa('0x6')};function emitEvent(_0x2bf8b2){return function(_0xbbc2b6,_0x56ac0d,_0x29c256){FaxAccountEvents[_0xa0fa('0x7')](_0x2bf8b2+':'+_0xbbc2b6['id'],_0xbbc2b6);FaxAccountEvents[_0xa0fa('0x7')](_0x2bf8b2,_0xbbc2b6);_0x29c256(null);};}for(var e in events){if(events[_0xa0fa('0x8')](e)){var event=events[e];FaxAccount[_0xa0fa('0x9')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x60eb=['hasOwnProperty','hook','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','emit'];(function(_0x262be8,_0x599c41){var _0x594485=function(_0x436faf){while(--_0x436faf){_0x262be8['push'](_0x262be8['shift']());}};_0x594485(++_0x599c41);}(_0x60eb,0x142));var _0xb60e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x60eb[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0xb60e('0x0'));var FaxAccount=require(_0xb60e('0x1'))['db'][_0xb60e('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xb60e('0x3')](0x0);var events={'afterCreate':_0xb60e('0x4'),'afterUpdate':_0xb60e('0x5'),'afterDestroy':_0xb60e('0x6')};function emitEvent(_0x436838){return function(_0x3df4e6,_0x16f04e,_0x14b10d){FaxAccountEvents[_0xb60e('0x7')](_0x436838+':'+_0x3df4e6['id'],_0x3df4e6);FaxAccountEvents[_0xb60e('0x7')](_0x436838,_0x3df4e6);_0x14b10d(null);};}for(var e in events){if(events[_0xb60e('0x8')](e)){var event=events[e];FaxAccount[_0xb60e('0x9')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index bac329c..cf690d1 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 _0x78f5=['request-promise','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','util','api','moment','bluebird'];(function(_0x496529,_0x4a9696){var _0x4d5219=function(_0x476b6d){while(--_0x476b6d){_0x496529['push'](_0x496529['shift']());}};_0x4d5219(++_0x4a9696);}(_0x78f5,0x171));var _0x578f=function(_0x5a2358,_0x16bfff){_0x5a2358=_0x5a2358-0x0;var _0x2be9f1=_0x78f5[_0x5a2358];return _0x2be9f1;};'use strict';var _=require(_0x578f('0x0'));var util=require(_0x578f('0x1'));var logger=require('../../config/logger')(_0x578f('0x2'));var moment=require(_0x578f('0x3'));var BPromise=require(_0x578f('0x4'));var rp=require(_0x578f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x578f('0x6'));module[_0x578f('0x7')]=function(_0x37a9d0,_0x46dfc0){return _0x37a9d0[_0x578f('0x8')](_0x578f('0x9'),attributes,{'tableName':_0x578f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d5b=['request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x1c60ef,_0x51da79){var _0x5b6b80=function(_0x1df436){while(--_0x1df436){_0x1c60ef['push'](_0x1c60ef['shift']());}};_0x5b6b80(++_0x51da79);}(_0x0d5b,0x87));var _0xb0d5=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x0d5b[_0x50007c];return _0x5c1ec7;};'use strict';var _=require('lodash');var util=require(_0xb0d5('0x0'));var logger=require(_0xb0d5('0x1'))(_0xb0d5('0x2'));var moment=require(_0xb0d5('0x3'));var BPromise=require(_0xb0d5('0x4'));var rp=require(_0xb0d5('0x5'));var fs=require('fs');var path=require(_0xb0d5('0x6'));var rimraf=require(_0xb0d5('0x7'));var config=require(_0xb0d5('0x8'));var attributes=require(_0xb0d5('0x9'));module[_0xb0d5('0xa')]=function(_0x7f533a,_0x59809f){return _0x7f533a[_0xb0d5('0xb')](_0xb0d5('0xc'),attributes,{'tableName':_0xb0d5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index 9193d69..257436c 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 _0x5fc5=['no\x20available\x20attributes','difference','createdAt','updatedAt','keys','CompanyId','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','List','CmContact','Contacts','get','applications','Applications','list','orderBy','priority','asc','account','length','ListId','from','create','contact','FaxInteraction','Contact\x20not\x20found','push','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','FaxAccount','findAll','options','attributes','limit','include','model','map','GetFaxAccount','stringify','NotifyFaxAccount','body','fax','describe','then','Sequelize'];(function(_0x48aab1,_0x40c4ff){var _0x3f6f07=function(_0x2131b4){while(--_0x2131b4){_0x48aab1['push'](_0x48aab1['shift']());}};_0x3f6f07(++_0x40c4ff);}(_0x5fc5,0xe6));var _0x55fc=function(_0x5bb914,_0x30da26){_0x5bb914=_0x5bb914-0x0;var _0x345270=_0x5fc5[_0x5bb914];return _0x345270;};'use strict';var _=require(_0x55fc('0x0'));var util=require(_0x55fc('0x1'));var moment=require(_0x55fc('0x2'));var BPromise=require(_0x55fc('0x3'));var rs=require(_0x55fc('0x4'));var fs=require('fs');var Redis=require(_0x55fc('0x5'));var db=require(_0x55fc('0x6'))['db'];var utils=require(_0x55fc('0x7'));var logger=require(_0x55fc('0x8'))(_0x55fc('0x9'));var config=require(_0x55fc('0xa'));var jayson=require(_0x55fc('0xb'));var client=jayson[_0x55fc('0xc')][_0x55fc('0xd')]({'port':0x232c});config[_0x55fc('0xe')]=_['defaults'](config[_0x55fc('0xe')],{'host':_0x55fc('0xf'),'port':0x18eb});var socket=require(_0x55fc('0x10'))(new Redis(config['redis']));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x10811d,_0x4816ff,_0x65a9a7){return new BPromise(function(_0x197da9,_0x4e96a4){return client[_0x55fc('0x11')](_0x10811d,_0x65a9a7)['then'](function(_0x18bd45){logger[_0x55fc('0x12')](_0x55fc('0x13'),_0x4816ff,'request\x20sent');logger[_0x55fc('0x14')](_0x55fc('0x15'),_0x4816ff,_0x55fc('0x16'),JSON['stringify'](_0x18bd45));if(_0x18bd45[_0x55fc('0x17')]){if(_0x18bd45['error'][_0x55fc('0x18')]===0x1f4){logger[_0x55fc('0x17')](_0x55fc('0x13'),_0x4816ff,_0x18bd45[_0x55fc('0x17')][_0x55fc('0x19')]);return _0x4e96a4(_0x18bd45[_0x55fc('0x17')][_0x55fc('0x19')]);}logger[_0x55fc('0x17')]('FaxAccount,\x20%s,\x20%s',_0x4816ff,_0x18bd45[_0x55fc('0x17')]['message']);return _0x197da9(_0x18bd45[_0x55fc('0x17')][_0x55fc('0x19')]);}else{logger[_0x55fc('0x12')](_0x55fc('0x13'),_0x4816ff,_0x55fc('0x16'));_0x197da9(_0x18bd45['result'][_0x55fc('0x19')]);}})[_0x55fc('0x1a')](function(_0xd7fe87){logger[_0x55fc('0x17')]('FaxAccount,\x20%s,\x20%s',_0x4816ff,_0xd7fe87);_0x4e96a4(_0xd7fe87);});});}exports['GetFaxAccount']=function(_0x139506){var _0xfe01a3=this;return new Promise(function(_0x5a9686,_0x6107b6){return db[_0x55fc('0x1b')][_0x55fc('0x1c')]({'raw':_0x139506[_0x55fc('0x1d')]?_0x139506[_0x55fc('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x139506[_0x55fc('0x1d')]?_0x139506[_0x55fc('0x1d')]['where']||null:null,'attributes':_0x139506[_0x55fc('0x1d')]?_0x139506['options'][_0x55fc('0x1e')]||null:null,'limit':_0x139506['options']?_0x139506[_0x55fc('0x1d')][_0x55fc('0x1f')]||null:null,'include':_0x139506[_0x55fc('0x1d')]?_0x139506[_0x55fc('0x1d')][_0x55fc('0x20')]?_['map'](_0x139506[_0x55fc('0x1d')][_0x55fc('0x20')],function(_0x3a6c83){return{'model':db[_0x3a6c83['model']],'as':_0x3a6c83['as'],'attributes':_0x3a6c83[_0x55fc('0x1e')],'include':_0x3a6c83[_0x55fc('0x20')]?_['map'](_0x3a6c83[_0x55fc('0x20')],function(_0x38b4f3){return{'model':db[_0x38b4f3[_0x55fc('0x21')]],'as':_0x38b4f3['as'],'attributes':_0x38b4f3['attributes'],'include':_0x38b4f3[_0x55fc('0x20')]?_[_0x55fc('0x22')](_0x38b4f3[_0x55fc('0x20')],function(_0x52b1a5){return{'model':db[_0x52b1a5['model']],'as':_0x52b1a5['as'],'attributes':_0x52b1a5[_0x55fc('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a18b8){logger['info'](_0x55fc('0x23'),_0x139506);logger[_0x55fc('0x14')](_0x55fc('0x23'),_0x139506,JSON[_0x55fc('0x24')](_0x4a18b8));_0x5a9686(_0x4a18b8);})['catch'](function(_0xa8ed8){logger[_0x55fc('0x17')](_0x55fc('0x23'),_0xa8ed8[_0x55fc('0x19')],_0x139506);_0x6107b6(_0xfe01a3[_0x55fc('0x17')](0x1f4,_0xa8ed8[_0x55fc('0x19')]));});});};exports[_0x55fc('0x25')]=function(_0x2871c0,_0x192498,_0x1d51e5){var _0x1316eb=this;return new Promise(function(_0x48bf33,_0xad0c41){var _0x425c67={'body':_0x2871c0[_0x55fc('0x26')],'channel':_0x55fc('0x27')};var _0x355866=[];var _0x4066e4=[];var _0x46d9cf={};return db['CmContact'][_0x55fc('0x28')]()[_0x55fc('0x29')](function(_0x2a97de){if(!_0x2a97de){throw new db[(_0x55fc('0x2a'))]['ValidationError'](_0x55fc('0x2b'));}_0x355866=_[_0x55fc('0x2c')](_['keys'](_0x2a97de),[_0x55fc('0x2d'),_0x55fc('0x2e')]);_0x4066e4=_[_0x55fc('0x2c')](_[_0x55fc('0x2f')](_0x2a97de),[_0x55fc('0x2d'),'updatedAt',_0x55fc('0x30'),'ListId']);if(_0x2871c0[_0x55fc('0x26')]['id']){delete _0x2871c0[_0x55fc('0x26')]['id'];}if(_[_0x55fc('0x31')](_0x2871c0[_0x55fc('0x26')]['from'])){throw new db[(_0x55fc('0x2a'))][(_0x55fc('0x32'))](_0x55fc('0x33'));}if(_[_0x55fc('0x31')](_0x2871c0['body']['body'])||_0x2871c0[_0x55fc('0x26')][_0x55fc('0x26')]===''){throw new db['Sequelize']['ValidationError'](_0x55fc('0x34'));}if(_[_0x55fc('0x31')](_0x2871c0[_0x55fc('0x26')][_0x55fc('0x35')])){throw new db[(_0x55fc('0x2a'))][(_0x55fc('0x32'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4066e4);}if(!_[_0x55fc('0x36')](_0x4066e4,_0x2871c0[_0x55fc('0x26')]['mapKey'])){throw new db['Sequelize'][(_0x55fc('0x32'))](_0x55fc('0x37')+_0x4066e4);}_0x46d9cf[_0x2871c0[_0x55fc('0x26')][_0x55fc('0x35')]]=_0x2871c0[_0x55fc('0x26')]['from'];})[_0x55fc('0x29')](function(){return db[_0x55fc('0x1b')][_0x55fc('0x38')]({'where':{'id':_0x2871c0['account']['id']},'include':[{'model':db['CmList'],'as':_0x55fc('0x39'),'include':[{'model':db[_0x55fc('0x3a')],'as':_0x55fc('0x3b'),'where':_0x46d9cf,'limit':0x1,'order':[[_0x55fc('0x2e'),'DESC']]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})[_0x55fc('0x29')](function(_0x2d247f){if(_0x2d247f&&_0x2d247f['List']){var _0x2bb0cb=_0x2d247f[_0x55fc('0x3c')]({'plain':!![]});_0x425c67['account']=_0x2bb0cb;_0x425c67[_0x55fc('0x3d')]=_0x2bb0cb[_0x55fc('0x3e')];_0x425c67[_0x55fc('0x3f')]=_0x2bb0cb[_0x55fc('0x39')];_0x425c67[_0x55fc('0x3d')]=_[_0x55fc('0x40')](_0x425c67[_0x55fc('0x3d')],[_0x55fc('0x41')],[_0x55fc('0x42')]);if(_0x425c67[_0x55fc('0x43')]['Applications']){delete _0x425c67[_0x55fc('0x43')][_0x55fc('0x3e')];}if(_0x425c67['account'][_0x55fc('0x39')]&&_0x425c67[_0x55fc('0x43')]['List'][_0x55fc('0x3b')][_0x55fc('0x44')]){return _0x425c67['account'][_0x55fc('0x39')][_0x55fc('0x3b')][0x0];}var _0x4748ee=_['defaults'](_0x2871c0['body'],{'firstName':_0x2871c0['body']['from'],'ListId':_0x2bb0cb[_0x55fc('0x45')]});_0x4748ee[_0x2871c0[_0x55fc('0x26')]['mapKey']]=_0x2871c0[_0x55fc('0x26')][_0x55fc('0x46')];return db[_0x55fc('0x3a')][_0x55fc('0x47')](_0x4748ee,{'fields':_0x355866,'raw':!![]});}})[_0x55fc('0x29')](function(_0x25c2d6){_0x425c67[_0x55fc('0x48')]=_0x25c2d6;if(_0x25c2d6){var _0x5b78e5={'ContactId':_0x25c2d6['id'],'FaxAccountId':_0x2871c0['account']['id'],'fax':_0x25c2d6[_0x55fc('0x27')]};return db['FaxInteraction'][_0x55fc('0x38')]({'where':{'ContactId':_0x25c2d6['id'],'closed':![],'FaxAccountId':_0x2871c0['account']['id']}})[_0x55fc('0x29')](function(_0x25155e){if(_0x25155e){return[_0x25155e,![]];}return db[_0x55fc('0x49')]['create'](_0x5b78e5)[_0x55fc('0x29')](function(_0x26e811){return[_0x26e811,!![]];});});}else{throw new Error(_0x55fc('0x4a'));}})['spread'](function(_0x4d906e,_0x2e0c53){var _0x395014=_0x4d906e[_0x55fc('0x3c')]({'plain':!![]});if(_0x2e0c53){if(_0x425c67[_0x55fc('0x43')]['autoclose']){_0x425c67[_0x55fc('0x3d')][_0x55fc('0x4b')]({'id':0x0,'priority':_0x425c67[_0x55fc('0x3d')][_0x55fc('0x44')]+0x1,'app':_0x55fc('0x4c'),'appdata':_0x55fc('0x4d'),'interval':_0x55fc('0x4e')});}_0x395014[_0x55fc('0x4f')]=!![];}else{_0x395014[_0x55fc('0x4f')]=![];}_0x425c67[_0x55fc('0x50')]=_0x395014;return db[_0x55fc('0x51')][_0x55fc('0x47')]({'body':_0x2871c0['body'][_0x55fc('0x26')],'FaxAccountId':_0x2871c0['account']['id'],'FaxInteractionId':_0x4d906e['id'],'direction':'in','ContactId':_0x4d906e[_0x55fc('0x52')],'AttachmentId':_0x2871c0[_0x55fc('0x26')]['AttachmentId']});})[_0x55fc('0x29')](function(_0x2db645){_0x425c67[_0x55fc('0x19')]=_0x2db645;if(_0x425c67[_0x55fc('0x50')][_0x55fc('0x53')]){return db[_0x55fc('0x54')][_0x55fc('0x38')]({'attributes':['id',_0x55fc('0x55')],'where':{'id':_0x425c67[_0x55fc('0x50')][_0x55fc('0x53')]}})['then'](function(_0x3d3d5b){if(_0x3d3d5b){_0x425c67['applications'][_0x55fc('0x56')]({'id':0x0,'priority':0x0,'app':_0x55fc('0x57'),'appdata':_0x3d3d5b['name']+','+(_0x425c67['account'][_0x55fc('0x58')]||0xa),'interval':_0x55fc('0x4e')});}return respondWithRpcPromise(_0x55fc('0x59'),_0x55fc('0x5a'),_0x425c67);});}return respondWithRpcPromise(_0x55fc('0x59'),'startRouting',_0x425c67);})['then'](function(_0x568c52){_0x48bf33(_0x568c52);})[_0x55fc('0x1a')](function(_0x428794){_0xad0c41(_0x1316eb[_0x55fc('0x17')](0x1f4,_0x428794[_0x55fc('0x19')]));});});}; \ No newline at end of file +var _0x0186=['fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','isNil','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','Contacts','DESC','FaxApplication','Applications','get','account','list','applications','orderBy','priority','asc','create','contact','FaxInteraction','Contact\x20not\x20found','spread','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','User','name','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','redis','defaults','socket.io-emitter','./faxAccount.socket','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','GetFaxAccount','FaxAccount','findAll','options','where','attributes','limit','include','model','map','NotifyFaxAccount','body'];(function(_0x398945,_0x513743){var _0xc73f30=function(_0x12bcd8){while(--_0x12bcd8){_0x398945['push'](_0x398945['shift']());}};_0xc73f30(++_0x513743);}(_0x0186,0xe5));var _0x6018=function(_0x5c8187,_0x14d623){_0x5c8187=_0x5c8187-0x0;var _0x28fd43=_0x0186[_0x5c8187];return _0x28fd43;};'use strict';var _=require(_0x6018('0x0'));var util=require(_0x6018('0x1'));var moment=require(_0x6018('0x2'));var BPromise=require(_0x6018('0x3'));var rs=require(_0x6018('0x4'));var fs=require('fs');var Redis=require(_0x6018('0x5'));var db=require(_0x6018('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6018('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6018('0x8'));var client=jayson['client'][_0x6018('0x9')]({'port':0x232c});config[_0x6018('0xa')]=_[_0x6018('0xb')](config[_0x6018('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x6018('0xc'))(new Redis(config[_0x6018('0xa')]));require(_0x6018('0xd'))[_0x6018('0xe')](socket);function respondWithRpcPromise(_0x5765a3,_0x3ed283,_0x498199){return new BPromise(function(_0x3e7485,_0x3a1e6c){return client[_0x6018('0xf')](_0x5765a3,_0x498199)[_0x6018('0x10')](function(_0x2cdf0e){logger['info'](_0x6018('0x11'),_0x3ed283,_0x6018('0x12'));logger[_0x6018('0x13')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3ed283,'request\x20sent',JSON[_0x6018('0x14')](_0x2cdf0e));if(_0x2cdf0e[_0x6018('0x15')]){if(_0x2cdf0e[_0x6018('0x15')]['code']===0x1f4){logger[_0x6018('0x15')](_0x6018('0x11'),_0x3ed283,_0x2cdf0e['error']['message']);return _0x3a1e6c(_0x2cdf0e[_0x6018('0x15')][_0x6018('0x16')]);}logger[_0x6018('0x15')](_0x6018('0x11'),_0x3ed283,_0x2cdf0e[_0x6018('0x15')][_0x6018('0x16')]);return _0x3e7485(_0x2cdf0e[_0x6018('0x15')]['message']);}else{logger[_0x6018('0x17')](_0x6018('0x11'),_0x3ed283,_0x6018('0x12'));_0x3e7485(_0x2cdf0e[_0x6018('0x18')][_0x6018('0x16')]);}})[_0x6018('0x19')](function(_0xdb3620){logger['error'](_0x6018('0x11'),_0x3ed283,_0xdb3620);_0x3a1e6c(_0xdb3620);});});}exports[_0x6018('0x1a')]=function(_0x65262b){var _0x5d7615=this;return new Promise(function(_0x1fff9b,_0x516d46){return db[_0x6018('0x1b')][_0x6018('0x1c')]({'raw':_0x65262b[_0x6018('0x1d')]?_0x65262b[_0x6018('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x65262b[_0x6018('0x1d')]?_0x65262b[_0x6018('0x1d')][_0x6018('0x1e')]||null:null,'attributes':_0x65262b[_0x6018('0x1d')]?_0x65262b['options'][_0x6018('0x1f')]||null:null,'limit':_0x65262b[_0x6018('0x1d')]?_0x65262b[_0x6018('0x1d')][_0x6018('0x20')]||null:null,'include':_0x65262b[_0x6018('0x1d')]?_0x65262b[_0x6018('0x1d')][_0x6018('0x21')]?_['map'](_0x65262b[_0x6018('0x1d')][_0x6018('0x21')],function(_0x204b32){return{'model':db[_0x204b32[_0x6018('0x22')]],'as':_0x204b32['as'],'attributes':_0x204b32[_0x6018('0x1f')],'include':_0x204b32['include']?_[_0x6018('0x23')](_0x204b32['include'],function(_0x257f94){return{'model':db[_0x257f94[_0x6018('0x22')]],'as':_0x257f94['as'],'attributes':_0x257f94['attributes'],'include':_0x257f94[_0x6018('0x21')]?_[_0x6018('0x23')](_0x257f94[_0x6018('0x21')],function(_0x54030a){return{'model':db[_0x54030a[_0x6018('0x22')]],'as':_0x54030a['as'],'attributes':_0x54030a[_0x6018('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6018('0x10')](function(_0x36f87a){logger['info'](_0x6018('0x1a'),_0x65262b);logger['debug'](_0x6018('0x1a'),_0x65262b,JSON[_0x6018('0x14')](_0x36f87a));_0x1fff9b(_0x36f87a);})[_0x6018('0x19')](function(_0x15627a){logger['error'](_0x6018('0x1a'),_0x15627a[_0x6018('0x16')],_0x65262b);_0x516d46(_0x5d7615[_0x6018('0x15')](0x1f4,_0x15627a[_0x6018('0x16')]));});});};exports[_0x6018('0x24')]=function(_0x42a537,_0x5a0a47,_0x4a35d2){var _0x20d2d0=this;return new Promise(function(_0x295b8c,_0x2e75a0){var _0x2f8e07={'body':_0x42a537[_0x6018('0x25')],'channel':_0x6018('0x26')};var _0x419525=[];var _0x4b0d30=[];var _0x1e320b={};return db[_0x6018('0x27')][_0x6018('0x28')]()[_0x6018('0x10')](function(_0x30d60e){if(!_0x30d60e){throw new db[(_0x6018('0x29'))][(_0x6018('0x2a'))](_0x6018('0x2b'));}_0x419525=_[_0x6018('0x2c')](_[_0x6018('0x2d')](_0x30d60e),[_0x6018('0x2e'),_0x6018('0x2f')]);_0x4b0d30=_[_0x6018('0x2c')](_[_0x6018('0x2d')](_0x30d60e),[_0x6018('0x2e'),_0x6018('0x2f'),_0x6018('0x30'),_0x6018('0x31')]);if(_0x42a537[_0x6018('0x25')]['id']){delete _0x42a537[_0x6018('0x25')]['id'];}if(_['isNil'](_0x42a537['body'][_0x6018('0x32')])){throw new db[(_0x6018('0x29'))][(_0x6018('0x2a'))]('from\x20is\x20mandatory');}if(_[_0x6018('0x33')](_0x42a537[_0x6018('0x25')][_0x6018('0x25')])||_0x42a537[_0x6018('0x25')][_0x6018('0x25')]===''){throw new db['Sequelize'][(_0x6018('0x2a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x6018('0x33')](_0x42a537['body']['mapKey'])){throw new db[(_0x6018('0x29'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4b0d30);}if(!_[_0x6018('0x34')](_0x4b0d30,_0x42a537['body'][_0x6018('0x35')])){throw new db[(_0x6018('0x29'))][(_0x6018('0x2a'))](_0x6018('0x36')+_0x4b0d30);}_0x1e320b[_0x42a537['body'][_0x6018('0x35')]]=_0x42a537[_0x6018('0x25')][_0x6018('0x32')];})[_0x6018('0x10')](function(){return db[_0x6018('0x1b')][_0x6018('0x37')]({'where':{'id':_0x42a537['account']['id']},'include':[{'model':db[_0x6018('0x38')],'as':_0x6018('0x39'),'include':[{'model':db[_0x6018('0x27')],'as':_0x6018('0x3a'),'where':_0x1e320b,'limit':0x1,'order':[[_0x6018('0x2f'),_0x6018('0x3b')]]}]},{'model':db[_0x6018('0x3c')],'as':_0x6018('0x3d')}]});})['then'](function(_0x2ae8ae){if(_0x2ae8ae&&_0x2ae8ae['List']){var _0x3e077f=_0x2ae8ae[_0x6018('0x3e')]({'plain':!![]});_0x2f8e07[_0x6018('0x3f')]=_0x3e077f;_0x2f8e07['applications']=_0x3e077f[_0x6018('0x3d')];_0x2f8e07[_0x6018('0x40')]=_0x3e077f['List'];_0x2f8e07[_0x6018('0x41')]=_[_0x6018('0x42')](_0x2f8e07[_0x6018('0x41')],[_0x6018('0x43')],[_0x6018('0x44')]);if(_0x2f8e07[_0x6018('0x3f')][_0x6018('0x3d')]){delete _0x2f8e07['account'][_0x6018('0x3d')];}if(_0x2f8e07[_0x6018('0x3f')][_0x6018('0x39')]&&_0x2f8e07[_0x6018('0x3f')]['List'][_0x6018('0x3a')]['length']){return _0x2f8e07[_0x6018('0x3f')][_0x6018('0x39')][_0x6018('0x3a')][0x0];}var _0x488375=_[_0x6018('0xb')](_0x42a537['body'],{'firstName':_0x42a537[_0x6018('0x25')][_0x6018('0x32')],'ListId':_0x3e077f['ListId']});_0x488375[_0x42a537[_0x6018('0x25')][_0x6018('0x35')]]=_0x42a537[_0x6018('0x25')]['from'];return db[_0x6018('0x27')][_0x6018('0x45')](_0x488375,{'fields':_0x419525,'raw':!![]});}})[_0x6018('0x10')](function(_0x582f4f){_0x2f8e07[_0x6018('0x46')]=_0x582f4f;if(_0x582f4f){var _0x21d2f4={'ContactId':_0x582f4f['id'],'FaxAccountId':_0x42a537[_0x6018('0x3f')]['id'],'fax':_0x582f4f[_0x6018('0x26')]};return db[_0x6018('0x47')][_0x6018('0x37')]({'where':{'ContactId':_0x582f4f['id'],'closed':![],'FaxAccountId':_0x42a537[_0x6018('0x3f')]['id']}})[_0x6018('0x10')](function(_0x194026){if(_0x194026){return[_0x194026,![]];}return db[_0x6018('0x47')][_0x6018('0x45')](_0x21d2f4)['then'](function(_0x275a63){return[_0x275a63,!![]];});});}else{throw new Error(_0x6018('0x48'));}})[_0x6018('0x49')](function(_0xc1318,_0x35f3c0){var _0x180dd2=_0xc1318['get']({'plain':!![]});if(_0x35f3c0){if(_0x2f8e07[_0x6018('0x3f')]['autoclose']){_0x2f8e07[_0x6018('0x41')]['push']({'id':0x0,'priority':_0x2f8e07[_0x6018('0x41')]['length']+0x1,'app':_0x6018('0x4a'),'appdata':_0x6018('0x4b'),'interval':_0x6018('0x4c')});}_0x180dd2['created']=!![];}else{_0x180dd2[_0x6018('0x4d')]=![];}_0x2f8e07[_0x6018('0x4e')]=_0x180dd2;return db[_0x6018('0x4f')]['create']({'body':_0x42a537[_0x6018('0x25')][_0x6018('0x25')],'FaxAccountId':_0x42a537[_0x6018('0x3f')]['id'],'FaxInteractionId':_0xc1318['id'],'direction':'in','ContactId':_0xc1318[_0x6018('0x50')],'AttachmentId':_0x42a537[_0x6018('0x25')][_0x6018('0x51')]});})[_0x6018('0x10')](function(_0x563bec){_0x2f8e07[_0x6018('0x16')]=_0x563bec;if(_0x2f8e07['interaction']['UserId']){return db[_0x6018('0x52')]['find']({'attributes':['id',_0x6018('0x53')],'where':{'id':_0x2f8e07[_0x6018('0x4e')][_0x6018('0x54')]}})[_0x6018('0x10')](function(_0x23188f){if(_0x23188f){_0x2f8e07[_0x6018('0x41')][_0x6018('0x55')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x23188f[_0x6018('0x53')]+','+(_0x2f8e07[_0x6018('0x3f')][_0x6018('0x56')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x6018('0x57'),_0x6018('0x58'),_0x2f8e07);});}return respondWithRpcPromise(_0x6018('0x57'),'startRouting',_0x2f8e07);})[_0x6018('0x10')](function(_0x4dc395){_0x295b8c(_0x4dc395);})[_0x6018('0x19')](function(_0x54228c){_0x2e75a0(_0x20d2d0[_0x6018('0x15')](0x1f4,_0x54228c[_0x6018('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 50bce3e..3c2e82d 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 _0x7278=['length','faxAccount:','./faxAccount.events','save','remove','update','emit','removeListener','register'];(function(_0x1ed010,_0x734e0b){var _0x6e22bf=function(_0x1ffe15){while(--_0x1ffe15){_0x1ed010['push'](_0x1ed010['shift']());}};_0x6e22bf(++_0x734e0b);}(_0x7278,0x161));var _0x8727=function(_0x5c9ee9,_0x3f2ac4){_0x5c9ee9=_0x5c9ee9-0x0;var _0x210db0=_0x7278[_0x5c9ee9];return _0x210db0;};'use strict';var FaxAccountEvents=require(_0x8727('0x0'));var events=[_0x8727('0x1'),_0x8727('0x2'),_0x8727('0x3')];function createListener(_0x2ee64e,_0x5822da){return function(_0x1ddbe9){_0x5822da[_0x8727('0x4')](_0x2ee64e,_0x1ddbe9);};}function removeListener(_0x6007de,_0x221021){return function(){FaxAccountEvents[_0x8727('0x5')](_0x6007de,_0x221021);};}exports[_0x8727('0x6')]=function(_0x180b71){for(var _0x5549d5=0x0,_0xfd1902=events[_0x8727('0x7')];_0x5549d5<_0xfd1902;_0x5549d5++){var _0xffd783=events[_0x5549d5];var _0x435911=createListener(_0x8727('0x8')+_0xffd783,_0x180b71);FaxAccountEvents['on'](_0xffd783,_0x435911);}}; \ No newline at end of file +var _0x7046=['./faxAccount.events','save','remove','update','emit','removeListener','register','length','faxAccount:'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x7046,0x144));var _0x6704=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7046[_0x2641f9];return _0x585741;};'use strict';var FaxAccountEvents=require(_0x6704('0x0'));var events=[_0x6704('0x1'),_0x6704('0x2'),_0x6704('0x3')];function createListener(_0x54a895,_0x1fd895){return function(_0x4399c6){_0x1fd895[_0x6704('0x4')](_0x54a895,_0x4399c6);};}function removeListener(_0x5258e7,_0x1e9b2a){return function(){FaxAccountEvents[_0x6704('0x5')](_0x5258e7,_0x1e9b2a);};}exports[_0x6704('0x6')]=function(_0x626a14){for(var _0x2917be=0x0,_0x4badf8=events[_0x6704('0x7')];_0x2917be<_0x4badf8;_0x2917be++){var _0x49b8b6=events[_0x2917be];var _0x56b1ff=createListener(_0x6704('0x8')+_0x49b8b6,_0x626a14);FaxAccountEvents['on'](_0x49b8b6,_0x56b1ff);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 710d873..17c07fd 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 _0x977a=['/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getApplications','/:id/messages','getMessages','/:id/users','post','create','addDisposition','/:id/canned_answers','addAnswer','addInteraction','/:id/applications','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','/:id/send','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxAccount.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x4dfd99,_0x291698){var _0x598bc2=function(_0x466ed2){while(--_0x466ed2){_0x4dfd99['push'](_0x4dfd99['shift']());}};_0x598bc2(++_0x291698);}(_0x977a,0x72));var _0xa977=function(_0x3ca7ff,_0x5b4460){_0x3ca7ff=_0x3ca7ff-0x0;var _0x5037da=_0x977a[_0x3ca7ff];return _0x5037da;};'use strict';var multer=require(_0xa977('0x0'));var util=require(_0xa977('0x1'));var path=require(_0xa977('0x2'));var timeout=require(_0xa977('0x3'));var express=require(_0xa977('0x4'));var router=express[_0xa977('0x5')]();var auth=require(_0xa977('0x6'));var interaction=require(_0xa977('0x7'));var config=require('../../config/environment');var controller=require(_0xa977('0x8'));router[_0xa977('0x9')]('/',auth[_0xa977('0xa')](),controller['index']);router[_0xa977('0x9')](_0xa977('0xb'),auth[_0xa977('0xa')](),controller[_0xa977('0xc')]);router[_0xa977('0x9')](_0xa977('0xd'),auth[_0xa977('0xa')](),controller[_0xa977('0xe')]);router['get'](_0xa977('0xf'),auth[_0xa977('0xa')](),controller[_0xa977('0x10')]);router['get']('/:id/canned_answers',auth[_0xa977('0xa')](),controller[_0xa977('0x11')]);router[_0xa977('0x9')](_0xa977('0x12'),auth['isAuthenticated'](),controller['getInteractions']);router['get']('/:id/applications',auth[_0xa977('0xa')](),controller[_0xa977('0x13')]);router['get'](_0xa977('0x14'),auth['isAuthenticated'](),controller[_0xa977('0x15')]);router[_0xa977('0x9')](_0xa977('0x16'),auth[_0xa977('0xa')](),controller['getAgents']);router[_0xa977('0x17')]('/',auth[_0xa977('0xa')](),controller[_0xa977('0x18')]);router['post'](_0xa977('0xf'),auth[_0xa977('0xa')](),controller[_0xa977('0x19')]);router[_0xa977('0x17')](_0xa977('0x1a'),auth[_0xa977('0xa')](),controller[_0xa977('0x1b')]);router[_0xa977('0x17')]('/:id/interactions',auth[_0xa977('0xa')](),controller[_0xa977('0x1c')]);router[_0xa977('0x17')](_0xa977('0x1d'),auth[_0xa977('0xa')](),controller[_0xa977('0x1e')]);router[_0xa977('0x17')](_0xa977('0x1f'),auth[_0xa977('0xa')](),controller[_0xa977('0x20')]);router[_0xa977('0x17')](_0xa977('0x21'),auth[_0xa977('0xa')](),controller['updateAccountApplications']);router['post'](_0xa977('0x22'),auth['isAuthenticated'](),controller['send']);router[_0xa977('0x17')](_0xa977('0x16'),auth[_0xa977('0xa')](),controller[_0xa977('0x23')]);router[_0xa977('0x24')](_0xa977('0xd'),auth[_0xa977('0xa')](),controller[_0xa977('0x25')]);router['delete']('/:id',auth[_0xa977('0xa')](),controller[_0xa977('0x26')]);router[_0xa977('0x27')]('/:id/dispositions',auth[_0xa977('0xa')](),controller[_0xa977('0x28')]);router['delete']('/:id/canned_answers',auth[_0xa977('0xa')](),controller[_0xa977('0x29')]);router[_0xa977('0x27')]('/:id/users',auth[_0xa977('0xa')](),controller['removeAgents']);module[_0xa977('0x2a')]=router; \ No newline at end of file +var _0xe4fa=['post','/:id/dispositions','addAnswer','/:id/interactions','addInteraction','/:id/applications','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','/:id/send','send','addAgents','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','getInteractions','/:id/messages','getMessages','/:id/users','getAgents'];(function(_0x171bde,_0x15afe7){var _0x42fb16=function(_0xfc00f1){while(--_0xfc00f1){_0x171bde['push'](_0x171bde['shift']());}};_0x42fb16(++_0x15afe7);}(_0xe4fa,0x15a));var _0xae4f=function(_0x2c9057,_0x2b3d6f){_0x2c9057=_0x2c9057-0x0;var _0x578dc6=_0xe4fa[_0x2c9057];return _0x578dc6;};'use strict';var multer=require(_0xae4f('0x0'));var util=require('util');var path=require(_0xae4f('0x1'));var timeout=require(_0xae4f('0x2'));var express=require(_0xae4f('0x3'));var router=express[_0xae4f('0x4')]();var auth=require(_0xae4f('0x5'));var interaction=require(_0xae4f('0x6'));var config=require(_0xae4f('0x7'));var controller=require(_0xae4f('0x8'));router[_0xae4f('0x9')]('/',auth[_0xae4f('0xa')](),controller[_0xae4f('0xb')]);router[_0xae4f('0x9')](_0xae4f('0xc'),auth[_0xae4f('0xa')](),controller['describe']);router[_0xae4f('0x9')](_0xae4f('0xd'),auth['isAuthenticated'](),controller[_0xae4f('0xe')]);router['get']('/:id/dispositions',auth[_0xae4f('0xa')](),controller[_0xae4f('0xf')]);router['get'](_0xae4f('0x10'),auth[_0xae4f('0xa')](),controller[_0xae4f('0x11')]);router[_0xae4f('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xae4f('0x12')]);router[_0xae4f('0x9')]('/:id/applications',auth[_0xae4f('0xa')](),controller['getApplications']);router['get'](_0xae4f('0x13'),auth[_0xae4f('0xa')](),controller[_0xae4f('0x14')]);router[_0xae4f('0x9')](_0xae4f('0x15'),auth['isAuthenticated'](),controller[_0xae4f('0x16')]);router[_0xae4f('0x17')]('/',auth[_0xae4f('0xa')](),controller['create']);router[_0xae4f('0x17')](_0xae4f('0x18'),auth[_0xae4f('0xa')](),controller['addDisposition']);router[_0xae4f('0x17')](_0xae4f('0x10'),auth['isAuthenticated'](),controller[_0xae4f('0x19')]);router['post'](_0xae4f('0x1a'),auth['isAuthenticated'](),controller[_0xae4f('0x1b')]);router[_0xae4f('0x17')](_0xae4f('0x1c'),auth[_0xae4f('0xa')](),controller[_0xae4f('0x1d')]);router[_0xae4f('0x17')](_0xae4f('0x1e'),auth['isAuthenticated'](),controller[_0xae4f('0x1f')]);router[_0xae4f('0x17')]('/updateaccountapplications',auth[_0xae4f('0xa')](),controller[_0xae4f('0x20')]);router[_0xae4f('0x17')](_0xae4f('0x21'),auth[_0xae4f('0xa')](),controller[_0xae4f('0x22')]);router[_0xae4f('0x17')]('/:id/users',auth[_0xae4f('0xa')](),controller[_0xae4f('0x23')]);router[_0xae4f('0x24')]('/:id',auth['isAuthenticated'](),controller[_0xae4f('0x25')]);router[_0xae4f('0x26')](_0xae4f('0xd'),auth[_0xae4f('0xa')](),controller[_0xae4f('0x27')]);router[_0xae4f('0x26')](_0xae4f('0x18'),auth[_0xae4f('0xa')](),controller['removeDispositions']);router[_0xae4f('0x26')]('/:id/canned_answers',auth[_0xae4f('0xa')](),controller['removeAnswers']);router['delete']('/:id/users',auth[_0xae4f('0xa')](),controller['removeAgents']);module[_0xae4f('0x28')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index f7519e8..e1ee4fb 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 _0x6659=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x22e271,_0x3bb5e1){var _0x14b267=function(_0x4c52a0){while(--_0x4c52a0){_0x22e271['push'](_0x22e271['shift']());}};_0x14b267(++_0x3bb5e1);}(_0x6659,0x169));var _0x9665=function(_0x4d708a,_0x1fb23b){_0x4d708a=_0x4d708a-0x0;var _0x150df6=_0x6659[_0x4d708a];return _0x150df6;};'use strict';var Sequelize=require(_0x9665('0x0'));module[_0x9665('0x1')]={'priority':{'type':Sequelize[_0x9665('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9665('0x3')],'allowNull':![],'defaultValue':_0x9665('0x4')},'appdata':{'type':Sequelize[_0x9665('0x5')]()},'description':{'type':Sequelize[_0x9665('0x3')]},'interval':{'type':Sequelize[_0x9665('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xf3dc=['TEXT','INTEGER','STRING','noop'];(function(_0x1c8314,_0x512e7e){var _0x4bfc4b=function(_0x2d8410){while(--_0x2d8410){_0x1c8314['push'](_0x1c8314['shift']());}};_0x4bfc4b(++_0x512e7e);}(_0xf3dc,0x1a5));var _0xcf3d=function(_0x12c98e,_0x2d0b4b){_0x12c98e=_0x12c98e-0x0;var _0x198b35=_0xf3dc[_0x12c98e];return _0x198b35;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xcf3d('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xcf3d('0x1')],'allowNull':![],'defaultValue':_0xcf3d('0x2')},'appdata':{'type':Sequelize[_0xcf3d('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 5f4d34a..fb54bbc 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 _0x4975=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','FaxApplication','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0x4975,0x86));var _0x5497=function(_0x4fef37,_0x5ab16e){_0x4fef37=_0x4fef37-0x0;var _0x3ea929=_0x4975[_0x4fef37];return _0x3ea929;};'use strict';var pdf=require(_0x5497('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5497('0x1'));var zipdir=require(_0x5497('0x2'));var jsonpatch=require(_0x5497('0x3'));var rp=require(_0x5497('0x4'));var moment=require(_0x5497('0x5'));var BPromise=require(_0x5497('0x6'));var Mustache=require(_0x5497('0x7'));var util=require(_0x5497('0x8'));var path=require(_0x5497('0x9'));var sox=require(_0x5497('0xa'));var csv=require('to-csv');var ejs=require(_0x5497('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xf'));var querystring=require('querystring');var Papa=require(_0x5497('0x10'));var Redis=require(_0x5497('0x11'));var authService=require(_0x5497('0x12'));var qs=require(_0x5497('0x13'));var as=require(_0x5497('0x14'));var hardwareService=require(_0x5497('0x15'));var logger=require(_0x5497('0x16'))(_0x5497('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc250bb,_0x1b23df){_0x1b23df=_0x1b23df||0xcc;return function(_0x1bb794){if(_0x1bb794){return _0xc250bb[_0x5497('0x18')](_0x1b23df);}return _0xc250bb[_0x5497('0x19')](_0x1b23df)[_0x5497('0x1a')]();};}function respondWithResult(_0x1f7169,_0xaca97d){_0xaca97d=_0xaca97d||0xc8;return function(_0x363a5b){if(_0x363a5b){return _0x1f7169[_0x5497('0x19')](_0xaca97d)['json'](_0x363a5b);}};}function respondWithFilteredResult(_0x11b0a9,_0x4fb8e9){return function(_0x4237a9){if(_0x4237a9){var _0x2bfd8a=_0x4237a9[_0x5497('0x1b')],_0x19e5f3=_0x4fb8e9[_0x5497('0x1c')],_0x3ce50b=_0x4fb8e9['offset']+_0x4fb8e9['limit'],_0x37c18e;if(_0x3ce50b>=_0x2bfd8a){_0x3ce50b=_0x2bfd8a;_0x37c18e=0xc8;}else{_0x37c18e=0xce;}_0x11b0a9[_0x5497('0x19')](_0x37c18e);return _0x11b0a9[_0x5497('0x1d')](_0x5497('0x1e'),_0x19e5f3+'-'+_0x3ce50b+'/'+_0x2bfd8a)['json'](_0x4237a9);}return null;};}function patchUpdates(_0xbf1ba7){return function(_0xcbd71d){try{jsonpatch[_0x5497('0x1f')](_0xcbd71d,_0xbf1ba7,!![]);}catch(_0x43da2c){return BPromise[_0x5497('0x20')](_0x43da2c);}return _0xcbd71d[_0x5497('0x21')]();};}function saveUpdates(_0x16d378,_0x10226f){return function(_0x2e3960){if(_0x2e3960){return _0x2e3960[_0x5497('0x22')](_0x16d378)[_0x5497('0x23')](function(_0x52c049){return _0x52c049;});}return null;};}function removeEntity(_0x720767,_0x4d1b27){return function(_0x19200a){if(_0x19200a){return _0x19200a[_0x5497('0x24')]()[_0x5497('0x23')](function(){_0x720767[_0x5497('0x19')](0xcc)[_0x5497('0x1a')]();});}};}function handleEntityNotFound(_0x3b2fbc,_0x5018fa){return function(_0x54043a){if(!_0x54043a){_0x3b2fbc[_0x5497('0x18')](0x194);}return _0x54043a;};}function handleError(_0x34b97f,_0x24482a){_0x24482a=_0x24482a||0x1f4;return function(_0x281155){logger['error'](_0x281155[_0x5497('0x25')]);if(_0x281155['name']){delete _0x281155[_0x5497('0x26')];}_0x34b97f[_0x5497('0x19')](_0x24482a)[_0x5497('0x27')](_0x281155);};}exports[_0x5497('0x28')]=function(_0x163a30,_0x31cd01){var _0x48b835={},_0x4af5f4={},_0x5406e2={'count':0x0,'rows':[]};var _0x583d06=_['map'](db[_0x5497('0x29')]['rawAttributes'],function(_0x5e9356){return{'name':_0x5e9356[_0x5497('0x2a')],'type':_0x5e9356[_0x5497('0x2b')][_0x5497('0x2c')]};});_0x4af5f4['model']=_['map'](_0x583d06,'name');_0x4af5f4[_0x5497('0x2d')]=_[_0x5497('0x2e')](_0x163a30[_0x5497('0x2d')]);_0x4af5f4['filters']=_['intersection'](_0x4af5f4['model'],_0x4af5f4[_0x5497('0x2d')]);_0x48b835['attributes']=_[_0x5497('0x2f')](_0x4af5f4[_0x5497('0x30')],qs[_0x5497('0x31')](_0x163a30['query'][_0x5497('0x31')]));_0x48b835[_0x5497('0x32')]=_0x48b835['attributes'][_0x5497('0x33')]?_0x48b835[_0x5497('0x32')]:_0x4af5f4[_0x5497('0x30')];if(!_0x163a30['query'][_0x5497('0x34')](_0x5497('0x35'))){_0x48b835[_0x5497('0x36')]=qs[_0x5497('0x36')](_0x163a30[_0x5497('0x2d')]['limit']);_0x48b835[_0x5497('0x1c')]=qs[_0x5497('0x1c')](_0x163a30['query'][_0x5497('0x1c')]);}_0x48b835[_0x5497('0x37')]=qs[_0x5497('0x38')](_0x163a30[_0x5497('0x2d')][_0x5497('0x38')]);_0x48b835[_0x5497('0x39')]=qs['filters'](_[_0x5497('0x3a')](_0x163a30['query'],_0x4af5f4[_0x5497('0x3b')]),_0x583d06);if(_0x163a30[_0x5497('0x2d')][_0x5497('0x3c')]){_0x48b835['where']=_['merge'](_0x48b835[_0x5497('0x39')],{'$or':_[_0x5497('0x3d')](_0x583d06,function(_0x326d48){if(_0x326d48[_0x5497('0x2b')]!==_0x5497('0x3e')){var _0xc8a689={};_0xc8a689[_0x326d48['name']]={'$like':'%'+_0x163a30[_0x5497('0x2d')][_0x5497('0x3c')]+'%'};return _0xc8a689;}})});}_0x48b835=_[_0x5497('0x3f')]({},_0x48b835,_0x163a30[_0x5497('0x40')]);var _0x275aa7={'where':_0x48b835[_0x5497('0x39')]};return db[_0x5497('0x29')][_0x5497('0x1b')](_0x275aa7)[_0x5497('0x23')](function(_0x544065){_0x5406e2[_0x5497('0x1b')]=_0x544065;if(_0x163a30[_0x5497('0x2d')][_0x5497('0x41')]){_0x48b835[_0x5497('0x42')]=[{'all':!![]}];}return db[_0x5497('0x29')][_0x5497('0x43')](_0x48b835);})[_0x5497('0x23')](function(_0x59ed13){_0x5406e2[_0x5497('0x44')]=_0x59ed13;return _0x5406e2;})[_0x5497('0x23')](respondWithFilteredResult(_0x31cd01,_0x48b835))[_0x5497('0x45')](handleError(_0x31cd01,null));};exports[_0x5497('0x46')]=function(_0x1b251b,_0x125526){var _0x114471={'raw':!![],'where':{'id':_0x1b251b[_0x5497('0x47')]['id']}},_0x547437={};_0x547437[_0x5497('0x30')]=_[_0x5497('0x2e')](db[_0x5497('0x29')][_0x5497('0x48')]);_0x547437[_0x5497('0x2d')]=_[_0x5497('0x2e')](_0x1b251b[_0x5497('0x2d')]);_0x547437[_0x5497('0x3b')]=_[_0x5497('0x2f')](_0x547437['model'],_0x547437[_0x5497('0x2d')]);_0x114471['attributes']=_[_0x5497('0x2f')](_0x547437[_0x5497('0x30')],qs[_0x5497('0x31')](_0x1b251b[_0x5497('0x2d')][_0x5497('0x31')]));_0x114471['attributes']=_0x114471[_0x5497('0x32')][_0x5497('0x33')]?_0x114471['attributes']:_0x547437[_0x5497('0x30')];if(_0x1b251b['query'][_0x5497('0x41')]){_0x114471['include']=[{'all':!![]}];}_0x114471=_[_0x5497('0x3f')]({},_0x114471,_0x1b251b[_0x5497('0x40')]);return db[_0x5497('0x29')][_0x5497('0x49')](_0x114471)[_0x5497('0x23')](handleEntityNotFound(_0x125526,null))['then'](respondWithResult(_0x125526,null))['catch'](handleError(_0x125526,null));};exports['create']=function(_0x55f654,_0x3cbe4b){return db[_0x5497('0x29')][_0x5497('0x4a')](_0x55f654[_0x5497('0x4b')],{})[_0x5497('0x23')](respondWithResult(_0x3cbe4b,0xc9))[_0x5497('0x45')](handleError(_0x3cbe4b,null));};exports[_0x5497('0x22')]=function(_0x466287,_0x2626bf){if(_0x466287['body']['id']){delete _0x466287[_0x5497('0x4b')]['id'];}return db[_0x5497('0x29')][_0x5497('0x49')]({'where':{'id':_0x466287['params']['id']}})[_0x5497('0x23')](handleEntityNotFound(_0x2626bf,null))['then'](saveUpdates(_0x466287[_0x5497('0x4b')],null))[_0x5497('0x23')](respondWithResult(_0x2626bf,null))[_0x5497('0x45')](handleError(_0x2626bf,null));};exports['destroy']=function(_0x43bebe,_0x356d61){return db['FaxApplication'][_0x5497('0x49')]({'where':{'id':_0x43bebe['params']['id']}})[_0x5497('0x23')](handleEntityNotFound(_0x356d61,null))['then'](removeEntity(_0x356d61,null))[_0x5497('0x45')](handleError(_0x356d61,null));}; \ No newline at end of file +var _0xc4aa=['destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','index','map','FaxApplication','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body'];(function(_0xd816e2,_0x5edac2){var _0x1f5924=function(_0x1bcbf0){while(--_0x1bcbf0){_0xd816e2['push'](_0xd816e2['shift']());}};_0x1f5924(++_0x5edac2);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xc4aa[_0x17b6e3];return _0x3906f3;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];function respondWithStatusCode(_0x2a0776,_0x24291d){_0x24291d=_0x24291d||0xcc;return function(_0x5e16aa){if(_0x5e16aa){return _0x2a0776[_0xac4a('0x16')](_0x24291d);}return _0x2a0776[_0xac4a('0x17')](_0x24291d)[_0xac4a('0x18')]();};}function respondWithResult(_0x6e00d4,_0x1b4313){_0x1b4313=_0x1b4313||0xc8;return function(_0x3b71c0){if(_0x3b71c0){return _0x6e00d4[_0xac4a('0x17')](_0x1b4313)[_0xac4a('0x19')](_0x3b71c0);}};}function respondWithFilteredResult(_0x190418,_0x42c7fc){return function(_0x11e101){if(_0x11e101){var _0x26dbb8=_0x11e101[_0xac4a('0x1a')],_0x4a2119=_0x42c7fc[_0xac4a('0x1b')],_0x402fff=_0x42c7fc[_0xac4a('0x1b')]+_0x42c7fc[_0xac4a('0x1c')],_0x34d797;if(_0x402fff>=_0x26dbb8){_0x402fff=_0x26dbb8;_0x34d797=0xc8;}else{_0x34d797=0xce;}_0x190418[_0xac4a('0x17')](_0x34d797);return _0x190418[_0xac4a('0x1d')]('Content-Range',_0x4a2119+'-'+_0x402fff+'/'+_0x26dbb8)['json'](_0x11e101);}return null;};}function patchUpdates(_0x21a729){return function(_0x13c8eb){try{jsonpatch[_0xac4a('0x1e')](_0x13c8eb,_0x21a729,!![]);}catch(_0x4d837c){return BPromise[_0xac4a('0x1f')](_0x4d837c);}return _0x13c8eb[_0xac4a('0x20')]();};}function saveUpdates(_0x3752e4,_0x3a3cdb){return function(_0x123694){if(_0x123694){return _0x123694[_0xac4a('0x21')](_0x3752e4)[_0xac4a('0x22')](function(_0x3ca790){return _0x3ca790;});}return null;};}function removeEntity(_0x534092,_0x3d8f0a){return function(_0x3204ad){if(_0x3204ad){return _0x3204ad['destroy']()[_0xac4a('0x22')](function(){_0x534092[_0xac4a('0x17')](0xcc)[_0xac4a('0x18')]();});}};}function handleEntityNotFound(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(!_0x1b7998){_0x947d8e[_0xac4a('0x16')](0x194);}return _0x1b7998;};}function handleError(_0x15435c,_0x412494){_0x412494=_0x412494||0x1f4;return function(_0x594f36){logger[_0xac4a('0x23')](_0x594f36[_0xac4a('0x24')]);if(_0x594f36[_0xac4a('0x25')]){delete _0x594f36[_0xac4a('0x25')];}_0x15435c[_0xac4a('0x17')](_0x412494)[_0xac4a('0x26')](_0x594f36);};}exports[_0xac4a('0x27')]=function(_0x14832b,_0x472c57){var _0x1c13dc={},_0x20202c={},_0x4e17ce={'count':0x0,'rows':[]};var _0x23b061=_[_0xac4a('0x28')](db[_0xac4a('0x29')][_0xac4a('0x2a')],function(_0x116700){return{'name':_0x116700['fieldName'],'type':_0x116700['type'][_0xac4a('0x2b')]};});_0x20202c[_0xac4a('0x2c')]=_[_0xac4a('0x28')](_0x23b061,'name');_0x20202c['query']=_[_0xac4a('0x2d')](_0x14832b[_0xac4a('0x2e')]);_0x20202c[_0xac4a('0x2f')]=_[_0xac4a('0x30')](_0x20202c[_0xac4a('0x2c')],_0x20202c['query']);_0x1c13dc[_0xac4a('0x31')]=_['intersection'](_0x20202c[_0xac4a('0x2c')],qs['fields'](_0x14832b[_0xac4a('0x2e')][_0xac4a('0x32')]));_0x1c13dc[_0xac4a('0x31')]=_0x1c13dc[_0xac4a('0x31')][_0xac4a('0x33')]?_0x1c13dc[_0xac4a('0x31')]:_0x20202c[_0xac4a('0x2c')];if(!_0x14832b[_0xac4a('0x2e')][_0xac4a('0x34')](_0xac4a('0x35'))){_0x1c13dc[_0xac4a('0x1c')]=qs[_0xac4a('0x1c')](_0x14832b[_0xac4a('0x2e')][_0xac4a('0x1c')]);_0x1c13dc['offset']=qs[_0xac4a('0x1b')](_0x14832b[_0xac4a('0x2e')]['offset']);}_0x1c13dc[_0xac4a('0x36')]=qs[_0xac4a('0x37')](_0x14832b['query']['sort']);_0x1c13dc[_0xac4a('0x38')]=qs[_0xac4a('0x2f')](_[_0xac4a('0x39')](_0x14832b[_0xac4a('0x2e')],_0x20202c['filters']),_0x23b061);if(_0x14832b[_0xac4a('0x2e')][_0xac4a('0x3a')]){_0x1c13dc['where']=_[_0xac4a('0x3b')](_0x1c13dc[_0xac4a('0x38')],{'$or':_[_0xac4a('0x28')](_0x23b061,function(_0x5f0eb8){if(_0x5f0eb8[_0xac4a('0x3c')]!==_0xac4a('0x3d')){var _0x1b5427={};_0x1b5427[_0x5f0eb8['name']]={'$like':'%'+_0x14832b[_0xac4a('0x2e')][_0xac4a('0x3a')]+'%'};return _0x1b5427;}})});}_0x1c13dc=_['merge']({},_0x1c13dc,_0x14832b['options']);var _0x4319a1={'where':_0x1c13dc['where']};return db['FaxApplication']['count'](_0x4319a1)['then'](function(_0x41b757){_0x4e17ce[_0xac4a('0x1a')]=_0x41b757;if(_0x14832b[_0xac4a('0x2e')][_0xac4a('0x3e')]){_0x1c13dc[_0xac4a('0x3f')]=[{'all':!![]}];}return db[_0xac4a('0x29')][_0xac4a('0x40')](_0x1c13dc);})[_0xac4a('0x22')](function(_0x28292c){_0x4e17ce[_0xac4a('0x41')]=_0x28292c;return _0x4e17ce;})[_0xac4a('0x22')](respondWithFilteredResult(_0x472c57,_0x1c13dc))[_0xac4a('0x42')](handleError(_0x472c57,null));};exports['show']=function(_0x5086ff,_0x5cd24f){var _0x1e1cc5={'raw':!![],'where':{'id':_0x5086ff[_0xac4a('0x43')]['id']}},_0x5c46a={};_0x5c46a[_0xac4a('0x2c')]=_[_0xac4a('0x2d')](db[_0xac4a('0x29')][_0xac4a('0x2a')]);_0x5c46a[_0xac4a('0x2e')]=_[_0xac4a('0x2d')](_0x5086ff[_0xac4a('0x2e')]);_0x5c46a['filters']=_[_0xac4a('0x30')](_0x5c46a[_0xac4a('0x2c')],_0x5c46a[_0xac4a('0x2e')]);_0x1e1cc5[_0xac4a('0x31')]=_[_0xac4a('0x30')](_0x5c46a['model'],qs[_0xac4a('0x32')](_0x5086ff[_0xac4a('0x2e')]['fields']));_0x1e1cc5[_0xac4a('0x31')]=_0x1e1cc5['attributes'][_0xac4a('0x33')]?_0x1e1cc5[_0xac4a('0x31')]:_0x5c46a[_0xac4a('0x2c')];if(_0x5086ff[_0xac4a('0x2e')][_0xac4a('0x3e')]){_0x1e1cc5[_0xac4a('0x3f')]=[{'all':!![]}];}_0x1e1cc5=_[_0xac4a('0x3b')]({},_0x1e1cc5,_0x5086ff[_0xac4a('0x44')]);return db[_0xac4a('0x29')][_0xac4a('0x45')](_0x1e1cc5)[_0xac4a('0x22')](handleEntityNotFound(_0x5cd24f,null))[_0xac4a('0x22')](respondWithResult(_0x5cd24f,null))['catch'](handleError(_0x5cd24f,null));};exports[_0xac4a('0x46')]=function(_0x41d11d,_0xeca4e9){return db['FaxApplication'][_0xac4a('0x46')](_0x41d11d[_0xac4a('0x47')],{})['then'](respondWithResult(_0xeca4e9,0xc9))[_0xac4a('0x42')](handleError(_0xeca4e9,null));};exports['update']=function(_0x244950,_0xe620f6){if(_0x244950[_0xac4a('0x47')]['id']){delete _0x244950['body']['id'];}return db['FaxApplication'][_0xac4a('0x45')]({'where':{'id':_0x244950['params']['id']}})[_0xac4a('0x22')](handleEntityNotFound(_0xe620f6,null))['then'](saveUpdates(_0x244950[_0xac4a('0x47')],null))['then'](respondWithResult(_0xe620f6,null))[_0xac4a('0x42')](handleError(_0xe620f6,null));};exports[_0xac4a('0x48')]=function(_0x424f9b,_0x1c8c39){return db['FaxApplication'][_0xac4a('0x45')]({'where':{'id':_0x424f9b[_0xac4a('0x43')]['id']}})[_0xac4a('0x22')](handleEntityNotFound(_0x1c8c39,null))[_0xac4a('0x22')](removeEntity(_0x1c8c39,null))[_0xac4a('0x42')](handleError(_0x1c8c39,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index cd49090..ea1a600 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 _0x0676=['request-promise','path','rimraf','../../config/environment','define','utf8mb4','lodash','util','../../config/logger','moment'];(function(_0x43d619,_0x25c8af){var _0x32720c=function(_0x10badb){while(--_0x10badb){_0x43d619['push'](_0x43d619['shift']());}};_0x32720c(++_0x25c8af);}(_0x0676,0x1be));var _0x6067=function(_0x4e0a79,_0x299232){_0x4e0a79=_0x4e0a79-0x0;var _0x469ee0=_0x0676[_0x4e0a79];return _0x469ee0;};'use strict';var _=require(_0x6067('0x0'));var util=require(_0x6067('0x1'));var logger=require(_0x6067('0x2'))('api');var moment=require(_0x6067('0x3'));var BPromise=require('bluebird');var rp=require(_0x6067('0x4'));var fs=require('fs');var path=require(_0x6067('0x5'));var rimraf=require(_0x6067('0x6'));var config=require(_0x6067('0x7'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0x52e986,_0x5ed8e3){return _0x52e986[_0x6067('0x8')]('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6067('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8250=['api','bluebird','request-promise','rimraf','./faxApplication.attributes','define','fax_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8250,0xfa));var _0x0825=function(_0xa0033a,_0x51bef2){_0xa0033a=_0xa0033a-0x0;var _0x79d94e=_0x8250[_0xa0033a];return _0x79d94e;};'use strict';var _=require(_0x0825('0x0'));var util=require(_0x0825('0x1'));var logger=require(_0x0825('0x2'))(_0x0825('0x3'));var moment=require('moment');var BPromise=require(_0x0825('0x4'));var rp=require(_0x0825('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0825('0x6'));var config=require('../../config/environment');var attributes=require(_0x0825('0x7'));module['exports']=function(_0x18733,_0x1a3bf8){return _0x18733[_0x0825('0x8')]('FaxApplication',attributes,{'tableName':_0x0825('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0825('0xa')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 05e2df5..f5476c5 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 _0x7b84=['FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','FaxApplication','update','body','options','attributes','limit','UpdateFaxApplication','debug','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x22f164,_0xaa4f80){var _0x51ab95=function(_0x190b68){while(--_0x190b68){_0x22f164['push'](_0x22f164['shift']());}};_0x51ab95(++_0xaa4f80);}(_0x7b84,0x109));var _0x47b8=function(_0x7958d3,_0x374913){_0x7958d3=_0x7958d3-0x0;var _0x180a26=_0x7b84[_0x7958d3];return _0x180a26;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var moment=require('moment');var BPromise=require(_0x47b8('0x2'));var rs=require(_0x47b8('0x3'));var fs=require('fs');var Redis=require(_0x47b8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47b8('0x5'));var logger=require(_0x47b8('0x6'))(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var jayson=require(_0x47b8('0x9'));var client=jayson[_0x47b8('0xa')][_0x47b8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47c9ee,_0x39e7db,_0x4ea728){return new BPromise(function(_0x10a3fc,_0xc8133b){return client[_0x47b8('0xc')](_0x47c9ee,_0x4ea728)[_0x47b8('0xd')](function(_0x2dd828){logger['info'](_0x47b8('0xe'),_0x39e7db,_0x47b8('0xf'));logger['debug'](_0x47b8('0x10'),_0x39e7db,_0x47b8('0xf'),JSON[_0x47b8('0x11')](_0x2dd828));if(_0x2dd828[_0x47b8('0x12')]){if(_0x2dd828[_0x47b8('0x12')][_0x47b8('0x13')]===0x1f4){logger[_0x47b8('0x12')](_0x47b8('0xe'),_0x39e7db,_0x2dd828[_0x47b8('0x12')][_0x47b8('0x14')]);return _0xc8133b(_0x2dd828['error'][_0x47b8('0x14')]);}logger[_0x47b8('0x12')](_0x47b8('0xe'),_0x39e7db,_0x2dd828[_0x47b8('0x12')][_0x47b8('0x14')]);return _0x10a3fc(_0x2dd828[_0x47b8('0x12')][_0x47b8('0x14')]);}else{logger[_0x47b8('0x15')](_0x47b8('0xe'),_0x39e7db,_0x47b8('0xf'));_0x10a3fc(_0x2dd828['result'][_0x47b8('0x14')]);}})['catch'](function(_0x251d4b){logger[_0x47b8('0x12')]('FaxApplication,\x20%s,\x20%s',_0x39e7db,_0x251d4b);_0xc8133b(_0x251d4b);});});}exports['UpdateFaxApplication']=function(_0x2d8c6d){var _0xbdaf46=this;return new Promise(function(_0x102352,_0x28868a){return db[_0x47b8('0x16')][_0x47b8('0x17')](_0x2d8c6d[_0x47b8('0x18')],{'raw':_0x2d8c6d['options']?_0x2d8c6d[_0x47b8('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d8c6d[_0x47b8('0x19')]?_0x2d8c6d[_0x47b8('0x19')]['where']||null:null,'attributes':_0x2d8c6d[_0x47b8('0x19')]?_0x2d8c6d[_0x47b8('0x19')][_0x47b8('0x1a')]||null:null,'limit':_0x2d8c6d[_0x47b8('0x19')]?_0x2d8c6d['options'][_0x47b8('0x1b')]||null:null})[_0x47b8('0xd')](function(_0x4058cf){logger['info'](_0x47b8('0x1c'),_0x2d8c6d);logger[_0x47b8('0x1d')](_0x47b8('0x1c'),_0x2d8c6d,JSON['stringify'](_0x4058cf));_0x102352(_0x4058cf);})[_0x47b8('0x1e')](function(_0x4928c5){logger[_0x47b8('0x12')](_0x47b8('0x1c'),_0x4928c5[_0x47b8('0x14')],_0x2d8c6d);_0x28868a(_0xbdaf46[_0x47b8('0x12')](0x1f4,_0x4928c5[_0x47b8('0x14')]));});});}; \ No newline at end of file +var _0xb524=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication','update','body','options','raw','where','attributes','limit','debug','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x4d788d,_0x2d34ac){var _0x4f3efa=function(_0x7e7c26){while(--_0x7e7c26){_0x4d788d['push'](_0x4d788d['shift']());}};_0x4f3efa(++_0x2d34ac);}(_0xb524,0x112));var _0x4b52=function(_0x19844d,_0xff414f){_0x19844d=_0x19844d-0x0;var _0x524499=_0xb524[_0x19844d];return _0x524499;};'use strict';var _=require(_0x4b52('0x0'));var util=require('util');var moment=require(_0x4b52('0x1'));var BPromise=require('bluebird');var rs=require(_0x4b52('0x2'));var fs=require('fs');var Redis=require(_0x4b52('0x3'));var db=require(_0x4b52('0x4'))['db'];var utils=require(_0x4b52('0x5'));var logger=require(_0x4b52('0x6'))(_0x4b52('0x7'));var config=require(_0x4b52('0x8'));var jayson=require(_0x4b52('0x9'));var client=jayson[_0x4b52('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x997683,_0x24f29,_0x571ecb){return new BPromise(function(_0x7210a5,_0x29d6de){return client[_0x4b52('0xb')](_0x997683,_0x571ecb)[_0x4b52('0xc')](function(_0x357d27){logger[_0x4b52('0xd')](_0x4b52('0xe'),_0x24f29,_0x4b52('0xf'));logger['debug'](_0x4b52('0x10'),_0x24f29,'request\x20sent',JSON[_0x4b52('0x11')](_0x357d27));if(_0x357d27[_0x4b52('0x12')]){if(_0x357d27[_0x4b52('0x12')]['code']===0x1f4){logger[_0x4b52('0x12')]('FaxApplication,\x20%s,\x20%s',_0x24f29,_0x357d27[_0x4b52('0x12')][_0x4b52('0x13')]);return _0x29d6de(_0x357d27[_0x4b52('0x12')]['message']);}logger[_0x4b52('0x12')]('FaxApplication,\x20%s,\x20%s',_0x24f29,_0x357d27['error'][_0x4b52('0x13')]);return _0x7210a5(_0x357d27['error'][_0x4b52('0x13')]);}else{logger[_0x4b52('0xd')](_0x4b52('0xe'),_0x24f29,_0x4b52('0xf'));_0x7210a5(_0x357d27[_0x4b52('0x14')]['message']);}})[_0x4b52('0x15')](function(_0x55eb02){logger[_0x4b52('0x12')](_0x4b52('0xe'),_0x24f29,_0x55eb02);_0x29d6de(_0x55eb02);});});}exports[_0x4b52('0x16')]=function(_0x26290f){var _0x419eb2=this;return new Promise(function(_0x201557,_0x5b8281){return db['FaxApplication'][_0x4b52('0x17')](_0x26290f[_0x4b52('0x18')],{'raw':_0x26290f[_0x4b52('0x19')]?_0x26290f[_0x4b52('0x19')][_0x4b52('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26290f[_0x4b52('0x19')]?_0x26290f[_0x4b52('0x19')][_0x4b52('0x1b')]||null:null,'attributes':_0x26290f['options']?_0x26290f[_0x4b52('0x19')][_0x4b52('0x1c')]||null:null,'limit':_0x26290f[_0x4b52('0x19')]?_0x26290f[_0x4b52('0x19')][_0x4b52('0x1d')]||null:null})[_0x4b52('0xc')](function(_0x3dd987){logger['info'](_0x4b52('0x16'),_0x26290f);logger[_0x4b52('0x1e')](_0x4b52('0x16'),_0x26290f,JSON[_0x4b52('0x11')](_0x3dd987));_0x201557(_0x3dd987);})[_0x4b52('0x15')](function(_0x5273d3){logger[_0x4b52('0x12')](_0x4b52('0x16'),_0x5273d3[_0x4b52('0x13')],_0x26290f);_0x5b8281(_0x419eb2[_0x4b52('0x12')](0x1f4,_0x5273d3[_0x4b52('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index ec3d0e1..09c9a79 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 _0xeec6=['get','index','isAuthenticated','show','post','put','/:id','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller'];(function(_0xe1a3a5,_0xd3e341){var _0x362646=function(_0xdcef03){while(--_0xdcef03){_0xe1a3a5['push'](_0xe1a3a5['shift']());}};_0x362646(++_0xd3e341);}(_0xeec6,0x1c2));var _0x6eec=function(_0x20ae13,_0x2a0c8e){_0x20ae13=_0x20ae13-0x0;var _0x533fd5=_0xeec6[_0x20ae13];return _0x533fd5;};'use strict';var multer=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var path=require(_0x6eec('0x2'));var timeout=require(_0x6eec('0x3'));var express=require('express');var router=express[_0x6eec('0x4')]();var auth=require(_0x6eec('0x5'));var interaction=require(_0x6eec('0x6'));var config=require(_0x6eec('0x7'));var controller=require(_0x6eec('0x8'));router[_0x6eec('0x9')]('/',auth['isAuthenticated'](),controller[_0x6eec('0xa')]);router[_0x6eec('0x9')]('/:id',auth[_0x6eec('0xb')](),controller[_0x6eec('0xc')]);router[_0x6eec('0xd')]('/',auth[_0x6eec('0xb')](),controller['create']);router[_0x6eec('0xe')](_0x6eec('0xf'),auth[_0x6eec('0xb')](),controller['update']);router['delete']('/:id',auth[_0x6eec('0xb')](),controller[_0x6eec('0x10')]);module['exports']=router; \ No newline at end of file +var _0x53ec=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./faxApplication.controller','get','index','/:id','isAuthenticated'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x53ec,0x192));var _0xc53e=function(_0x4def98,_0x421f3f){_0x4def98=_0x4def98-0x0;var _0x40f8cc=_0x53ec[_0x4def98];return _0x40f8cc;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xc53e('0x6'));var config=require('../../config/environment');var controller=require(_0xc53e('0x7'));router[_0xc53e('0x8')]('/',auth['isAuthenticated'](),controller[_0xc53e('0x9')]);router['get'](_0xc53e('0xa'),auth[_0xc53e('0xb')](),controller['show']);router[_0xc53e('0xc')]('/',auth[_0xc53e('0xb')](),controller[_0xc53e('0xd')]);router[_0xc53e('0xe')](_0xc53e('0xa'),auth[_0xc53e('0xb')](),controller[_0xc53e('0xf')]);router[_0xc53e('0x10')](_0xc53e('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xc53e('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 1487a95..231a013 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 _0x2566=['DATE','STRING','out','ENUM','sequelize','BOOLEAN'];(function(_0x2f3f1b,_0x40b09b){var _0x551dd1=function(_0x4eca96){while(--_0x4eca96){_0x2f3f1b['push'](_0x2f3f1b['shift']());}};_0x551dd1(++_0x40b09b);}(_0x2566,0x172));var _0x6256=function(_0x129c20,_0x584460){_0x129c20=_0x129c20-0x0;var _0x23f761=_0x2566[_0x129c20];return _0x23f761;};'use strict';var Sequelize=require(_0x6256('0x0'));module['exports']={'closed':{'type':Sequelize[_0x6256('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6256('0x2')]},'disposition':{'type':Sequelize[_0x6256('0x3')]},'note':{'type':Sequelize[_0x6256('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x6256('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6256('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6256('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x6256('0x5')]('in',_0x6256('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xdb80=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0xd511d,_0x3546b9){var _0x3f148e=function(_0x51f35f){while(--_0x51f35f){_0xd511d['push'](_0xd511d['shift']());}};_0x3f148e(++_0x3546b9);}(_0xdb80,0x1f0));var _0x0db8=function(_0x52aa1d,_0x2c150f){_0x52aa1d=_0x52aa1d-0x0;var _0x8024f8=_0xdb80[_0x52aa1d];return _0x8024f8;};'use strict';var Sequelize=require(_0x0db8('0x0'));module[_0x0db8('0x1')]={'closed':{'type':Sequelize[_0x0db8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0db8('0x3')]},'disposition':{'type':Sequelize[_0x0db8('0x4')]},'note':{'type':Sequelize[_0x0db8('0x4')]},'read1stAt':{'type':Sequelize[_0x0db8('0x3')]},'fax':{'type':Sequelize[_0x0db8('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x0db8('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0db8('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0db8('0x5')]('in',_0x0db8('0x6')),'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 f64bc38..8078ea7 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 _0xd1d3=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','push','index','FaxInteraction','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','`\x20=\x200','having','`\x20>\x200','Contact','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','compact','isEmpty','concat','createdAt','$gte','parse','$lte','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','DESC','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','all','catch','show','params','include','options','create','describe','addMessage','FaxMessage','ids','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','omit','spread','findAll','faxInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','html-pdf'];(function(_0x3f52ae,_0x422463){var _0x48dceb=function(_0x55c041){while(--_0x55c041){_0x3f52ae['push'](_0x3f52ae['shift']());}};_0x48dceb(++_0x422463);}(_0xd1d3,0xd7));var _0x3d1d=function(_0x38842b,_0x126ec9){_0x38842b=_0x38842b-0x0;var _0x4b56f7=_0xd1d3[_0x38842b];return _0x4b56f7;};'use strict';var pdf=require(_0x3d1d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3d1d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3d1d('0x2'));var rp=require(_0x3d1d('0x3'));var moment=require(_0x3d1d('0x4'));var BPromise=require(_0x3d1d('0x5'));var Mustache=require(_0x3d1d('0x6'));var util=require('util');var path=require(_0x3d1d('0x7'));var sox=require(_0x3d1d('0x8'));var csv=require('to-csv');var ejs=require(_0x3d1d('0x9'));var fs=require('fs');var _=require(_0x3d1d('0xa'));var squel=require('squel');var crypto=require(_0x3d1d('0xb'));var jsforce=require(_0x3d1d('0xc'));var deskjs=require(_0x3d1d('0xd'));var toCsv=require(_0x3d1d('0xe'));var querystring=require(_0x3d1d('0xf'));var Papa=require(_0x3d1d('0x10'));var Redis=require(_0x3d1d('0x11'));var authService=require(_0x3d1d('0x12'));var qs=require(_0x3d1d('0x13'));var as=require(_0x3d1d('0x14'));var hardwareService=require(_0x3d1d('0x15'));var logger=require(_0x3d1d('0x16'))(_0x3d1d('0x17'));var utils=require(_0x3d1d('0x18'));var config=require(_0x3d1d('0x19'));var db=require(_0x3d1d('0x1a'))['db'];config[_0x3d1d('0x1b')]=_[_0x3d1d('0x1c')](config[_0x3d1d('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x3d1d('0x1d'))(new Redis(config[_0x3d1d('0x1b')]));require(_0x3d1d('0x1e'))[_0x3d1d('0x1f')](socket);function respondWithStatusCode(_0x461a0a,_0x12dd84){_0x12dd84=_0x12dd84||0xcc;return function(_0x4751b9){if(_0x4751b9){return _0x461a0a[_0x3d1d('0x20')](_0x12dd84);}return _0x461a0a['status'](_0x12dd84)[_0x3d1d('0x21')]();};}function respondWithResult(_0x128f51,_0x5d6a51){_0x5d6a51=_0x5d6a51||0xc8;return function(_0x5786df){if(_0x5786df){return _0x128f51[_0x3d1d('0x22')](_0x5d6a51)[_0x3d1d('0x23')](_0x5786df);}};}function respondWithFilteredResult(_0x1e71cf,_0x2f984c){return function(_0x4e8b8d){if(_0x4e8b8d){var _0x1898ce=_0x4e8b8d[_0x3d1d('0x24')],_0x46bc02=_0x2f984c[_0x3d1d('0x25')],_0x1f6035=_0x2f984c['offset']+_0x2f984c['limit'],_0x328374;if(_0x1f6035>=_0x1898ce){_0x1f6035=_0x1898ce;_0x328374=0xc8;}else{_0x328374=0xce;}_0x1e71cf['status'](_0x328374);return _0x1e71cf[_0x3d1d('0x26')](_0x3d1d('0x27'),_0x46bc02+'-'+_0x1f6035+'/'+_0x1898ce)[_0x3d1d('0x23')](_0x4e8b8d);}return null;};}function patchUpdates(_0xedf825){return function(_0x1f5c7c){try{jsonpatch[_0x3d1d('0x28')](_0x1f5c7c,_0xedf825,!![]);}catch(_0x2c8b68){return BPromise[_0x3d1d('0x29')](_0x2c8b68);}return _0x1f5c7c[_0x3d1d('0x2a')]();};}function saveUpdates(_0x4bbb58,_0x553fa1){return function(_0x292392){if(_0x292392){return _0x292392[_0x3d1d('0x2b')](_0x4bbb58)[_0x3d1d('0x2c')](function(_0x550bb5){return _0x550bb5;});}return null;};}function removeEntity(_0x228735,_0x3dae29){return function(_0x4760a4){if(_0x4760a4){return _0x4760a4[_0x3d1d('0x2d')]()[_0x3d1d('0x2c')](function(){_0x228735['status'](0xcc)[_0x3d1d('0x21')]();});}};}function handleEntityNotFound(_0x1542e3,_0x1a7c18){return function(_0x2e0339){if(!_0x2e0339){_0x1542e3[_0x3d1d('0x20')](0x194);}return _0x2e0339;};}function handleError(_0xbda25a,_0x49b800){_0x49b800=_0x49b800||0x1f4;return function(_0x5c07e2){logger['error'](_0x5c07e2[_0x3d1d('0x2e')]);if(_0x5c07e2[_0x3d1d('0x2f')]){delete _0x5c07e2[_0x3d1d('0x2f')];}_0xbda25a[_0x3d1d('0x22')](_0x49b800)['send'](_0x5c07e2);};}function getInteractionUsers(_0x4a4623,_0x8aaf8){return new BPromise(function(_0x5ea525,_0x181d71){try{if(_0x8aaf8[_0x4a4623['id']]){_0x4a4623[_0x3d1d('0x30')]=_[_0x3d1d('0x31')](_0x8aaf8[_0x4a4623['id']],function(_0x3d61ad){return{'id':_0x3d61ad['id'],'fullname':_0x3d61ad[_0x3d1d('0x32')]};});}}catch(_0x151ded){_0x181d71(_0x151ded);}_0x5ea525(_0x4a4623);});}function getInteractionTags(_0x1d2bb5,_0x635ca5){return new BPromise(function(_0x33bbed,_0x58b541){try{if(_0x1d2bb5[_0x3d1d('0x33')]){_0x1d2bb5[_0x3d1d('0x34')]=[];_0x1d2bb5[_0x3d1d('0x33')][_0x3d1d('0x35')](',')[_0x3d1d('0x36')](function(_0x33f880){_0x1d2bb5[_0x3d1d('0x34')][_0x3d1d('0x37')](_0x635ca5[_0x33f880]);});}delete _0x1d2bb5['TagIds'];}catch(_0x2b3bd3){_0x58b541(_0x2b3bd3);}_0x33bbed(_0x1d2bb5);});}function updateFaxInteraction(_0x115294,_0xf53b40,_0x20111a){return new BPromise(function(_0x122a0b,_0x26033e){return getInteractionUsers(_0x115294,_0x20111a)[_0x3d1d('0x2c')](function(_0x67334f){return getInteractionTags(_0x67334f,_0xf53b40);})[_0x3d1d('0x2c')](function(_0xb65cbc){_0x122a0b(_0xb65cbc);})['catch'](function(_0x277e30){_0x26033e(_0x277e30);});});}exports[_0x3d1d('0x38')]=function(_0x144f00,_0xaedceb){var _0x183063={},_0x17db7b={},_0x43a778={'count':0x0,'rows':[]};var _0x2cdf4=_[_0x3d1d('0x31')](db[_0x3d1d('0x39')][_0x3d1d('0x3a')],function(_0x42070c){return{'name':_0x42070c['fieldName'],'type':_0x42070c[_0x3d1d('0x3b')][_0x3d1d('0x3c')]};});_0x17db7b[_0x3d1d('0x3d')]=_['map'](_0x2cdf4,_0x3d1d('0x2f'));_0x17db7b[_0x3d1d('0x3e')]=_[_0x3d1d('0x3f')](_0x144f00['query']);_0x17db7b['filters']=_[_0x3d1d('0x40')](_0x17db7b['model'],_0x17db7b['query']);_0x183063[_0x3d1d('0x41')]=_[_0x3d1d('0x40')](_0x17db7b[_0x3d1d('0x3d')],qs[_0x3d1d('0x42')](_0x144f00['query'][_0x3d1d('0x42')]));_0x183063[_0x3d1d('0x41')]=_0x183063[_0x3d1d('0x41')]['length']?_0x183063[_0x3d1d('0x41')]:_0x17db7b[_0x3d1d('0x3d')];if(!_0x144f00[_0x3d1d('0x3e')][_0x3d1d('0x43')](_0x3d1d('0x44'))){_0x183063[_0x3d1d('0x45')]=qs[_0x3d1d('0x45')](_0x144f00['query'][_0x3d1d('0x45')]);_0x183063[_0x3d1d('0x25')]=qs[_0x3d1d('0x25')](_0x144f00[_0x3d1d('0x3e')][_0x3d1d('0x25')]);}_0x183063[_0x3d1d('0x46')]=qs[_0x3d1d('0x47')](_0x144f00[_0x3d1d('0x3e')][_0x3d1d('0x47')]);_0x183063[_0x3d1d('0x48')]=qs[_0x3d1d('0x49')](_[_0x3d1d('0x4a')](_0x144f00['query'],_0x17db7b['filters']),_0x2cdf4);var _0x29643f=[];var _0x493175=squel[_0x3d1d('0x4b')]()['field']('id')['field'](_0x3d1d('0x2f'))[_0x3d1d('0x4c')](_0x3d1d('0x4d'))[_0x3d1d('0x4e')](_0x3d1d('0x4f'));var _0x3cde3f=squel[_0x3d1d('0x4b')]()[_0x3d1d('0x4c')](_0x3d1d('0x50'))[_0x3d1d('0x4c')](_0x3d1d('0x51'))[_0x3d1d('0x4c')](_0x3d1d('0x52'))['from'](_0x3d1d('0x53'),'ui')[_0x3d1d('0x54')](_0x3d1d('0x55'),'u',_0x3d1d('0x56'));var _0x1f6d64=squel[_0x3d1d('0x4b')]()[_0x3d1d('0x4e')]('fax_interactions','i')['left_join']('cm_contacts','c',_0x3d1d('0x57'))[_0x3d1d('0x54')](_0x3d1d('0x55'),'o','o.id\x20=\x20i.UserId')[_0x3d1d('0x54')](_0x3d1d('0x58'),'a',_0x3d1d('0x59'))[_0x3d1d('0x54')](_0x3d1d('0x5a'),'me',_0x3d1d('0x5b'))[_0x3d1d('0x54')](_0x3d1d('0x5c'),'it',_0x3d1d('0x5d'))[_0x3d1d('0x54')](_0x3d1d('0x4f'),'t',_0x3d1d('0x5e'));var _0x2330fe=squel['expr']();var _0x48c88f=[];var _0x1b2e2d=squel[_0x3d1d('0x5f')]();var _0x5579ad;if(_0x144f00[_0x3d1d('0x3e')][_0x3d1d('0x60')]){_0x5579ad=as[_0x3d1d('0x61')](_0x144f00[_0x3d1d('0x3e')][_0x3d1d('0x60')]);var _0x25158f=_0x5579ad[_0x3d1d('0x62')];for(var _0x250a1c=0x0;_0x250a1c<_0x5579ad[_0x3d1d('0x63')][_0x3d1d('0x64')];_0x250a1c++){var _0x5c5ea5=_0x5579ad[_0x3d1d('0x63')][_0x250a1c];var _0x1bc5bb='i';var _0x5454f8=_[_0x3d1d('0x65')](_0x2cdf4,[_0x3d1d('0x2f'),_0x5c5ea5[_0x3d1d('0x4c')]]);if(!_0x5454f8){switch(_0x5c5ea5['field']){case _0x3d1d('0x66'):if(_0x5c5ea5['value']==0x1){_0x1f6d64['having']('`'+_0x5c5ea5['field']+_0x3d1d('0x67'));}else{_0x1f6d64[_0x3d1d('0x68')]('`'+_0x5c5ea5[_0x3d1d('0x4c')]+_0x3d1d('0x69'));}break;case _0x3d1d('0x6a'):if(_0x5c5ea5['operator']===_0x3d1d('0x6b')){if(_0x5c5ea5[_0x3d1d('0x6c')]['split']('\x20')['length']>0x1){_0x2330fe[_0x25158f](_0x3d1d('0x6d'),qs[_0x3d1d('0x6e')](_0x5c5ea5[_0x3d1d('0x6c')]),null);}else{var _0x57ec9d='%'+_0x5c5ea5[_0x3d1d('0x6c')]+'%';_0x2330fe[_0x25158f](_0x3d1d('0x6f'),_0x57ec9d,_0x57ec9d,_0x57ec9d);}}else{_0x5454f8=_['find'](_0x2cdf4,[_0x3d1d('0x2f'),_0x3d1d('0x70')]);_0x5c5ea5[_0x3d1d('0x4c')]='ContactId';_0x26c51e=as[_0x3d1d('0x71')](_0x1bc5bb,_0x5454f8[_0x3d1d('0x3b')],_0x5c5ea5);_0x2330fe[_0x25158f](_0x26c51e[_0x3d1d('0x72')],_0x26c51e['value'][_0x3d1d('0x73')],_0x26c51e['value']['end']);}break;case _0x3d1d('0x74'):var _0x1bc3eb=_0x5c5ea5['value'][_0x3d1d('0x35')](',')['map'](function(_0x32b48d){return Number(_0x32b48d);});_0x1bc3eb['forEach'](function(_0x1a15aa){_0x1b2e2d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1a15aa+',%');});_0x48c88f=_[_0x3d1d('0x75')](_0x48c88f,_0x1bc3eb);break;case'User':if(_0x5c5ea5[_0x3d1d('0x76')]===_0x3d1d('0x6b')){_0x2330fe[_0x25158f](_0x3d1d('0x77'),'%'+_0x5c5ea5[_0x3d1d('0x6c')]+'%',null);}else{_0x5454f8=_[_0x3d1d('0x65')](_0x2cdf4,[_0x3d1d('0x2f'),'UserId']);_0x5c5ea5[_0x3d1d('0x4c')]=_0x3d1d('0x78');_0x26c51e=as[_0x3d1d('0x71')](_0x1bc5bb,_0x5454f8[_0x3d1d('0x3b')],_0x5c5ea5);_0x2330fe[_0x25158f](_0x26c51e['text'],_0x26c51e[_0x3d1d('0x6c')][_0x3d1d('0x73')],_0x26c51e[_0x3d1d('0x6c')][_0x3d1d('0x21')]);}break;case _0x3d1d('0x79'):_0x26c51e=as[_0x3d1d('0x71')]('me',null,_0x5c5ea5);_0x2330fe[_0x25158f](_0x26c51e[_0x3d1d('0x72')],_0x26c51e[_0x3d1d('0x6c')][_0x3d1d('0x73')],_0x26c51e[_0x3d1d('0x6c')][_0x3d1d('0x21')]);break;}}else{var _0x26c51e=as[_0x3d1d('0x71')](_0x1bc5bb,_0x5454f8['type'],_0x5c5ea5);_0x2330fe[_0x25158f](_0x26c51e[_0x3d1d('0x72')],_0x26c51e[_0x3d1d('0x6c')]['start'],_0x26c51e[_0x3d1d('0x6c')][_0x3d1d('0x21')]);}}}else{var _0x9d2089=_(_0x144f00[_0x3d1d('0x3e')])[_0x3d1d('0x3f')]()['map'](function(_0x932e60){return _['some'](_0x2cdf4,[_0x3d1d('0x2f'),_0x932e60])?_0x932e60:undefined;})[_0x3d1d('0x7a')]()[_0x3d1d('0x6c')]();if(!_[_0x3d1d('0x7b')](_0x9d2089)){_0x9d2089['forEach'](function(_0x52c994){if(_0x52c994==='FaxAccountId'){_0x1f6d64[_0x3d1d('0x48')]('i.FaxAccountId\x20IN\x20?',[][_0x3d1d('0x7c')](_0x144f00['query'][_0x52c994]));}else if(_0x52c994===_0x3d1d('0x7d')){var _0x30d32c=JSON['parse'](_0x144f00[_0x3d1d('0x3e')][_0x52c994])[_0x3d1d('0x7e')];var _0x4ad51b=JSON[_0x3d1d('0x7f')](_0x144f00[_0x3d1d('0x3e')][_0x52c994])[_0x3d1d('0x80')];_0x1f6d64['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x30d32c,_0x4ad51b);}else{if(_0x144f00[_0x3d1d('0x3e')][_0x52c994]===_0x3d1d('0x81')){_0x1f6d64['where']('i.'+_0x52c994+'\x20IS\x20NULL');}else{_0x1f6d64['where']('i.'+_0x52c994+'\x20=\x20?',_0x144f00[_0x3d1d('0x3e')][_0x52c994]);}}});}if(_0x144f00[_0x3d1d('0x3e')]['read']){if(_0x144f00[_0x3d1d('0x3e')][_0x3d1d('0x82')]==0x1){_0x1f6d64[_0x3d1d('0x68')](_0x3d1d('0x83'));}else{_0x1f6d64[_0x3d1d('0x68')](_0x3d1d('0x84'));}}if(_0x144f00[_0x3d1d('0x3e')]['tag']){_0x48c88f=_[_0x3d1d('0x85')](_0x144f00[_0x3d1d('0x3e')][_0x3d1d('0x86')])?_0x144f00['query']['tag']:new Array(_0x144f00[_0x3d1d('0x3e')][_0x3d1d('0x86')]);_0x48c88f[_0x3d1d('0x36')](function(_0x1294f9){_0x1b2e2d['or'](_0x3d1d('0x87'),'%,'+_0x1294f9+',%');});}if(_0x144f00[_0x3d1d('0x3e')][_0x3d1d('0x88')]){var _0x54b8de=_0x144f00['query'][_0x3d1d('0x88')][_0x3d1d('0x89')]('\x5c','\x5c\x5c')[_0x3d1d('0x89')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x3d1d('0x8a')](_0x54b8de)){_0x2330fe['or']('i.id\x20LIKE\x20?',_0x54b8de+'%')['or']('i.fax\x20LIKE\x20?',_0x54b8de+'%');}_0x2330fe['or'](_0x3d1d('0x8b'),_0x54b8de+'%');}}_0x1f6d64[_0x3d1d('0x48')](_0x2330fe);_0x1f6d64[_0x3d1d('0x8c')](_0x3d1d('0x8d'));var _0x12188d={'type':db['Sequelize'][_0x3d1d('0x8e')][_0x3d1d('0x8f')],'raw':!![]};var _0x47a0a0=_0x1f6d64[_0x3d1d('0x90')]();_0x47a0a0['field']('i.id');_0x47a0a0['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x3d1d('0x66'));if(_0x183063[_0x3d1d('0x46')]){_0x183063[_0x3d1d('0x46')][_0x3d1d('0x36')](function(_0x4707d0){_0x1f6d64[_0x3d1d('0x46')]('i.'+_0x4707d0[0x0],_0x4707d0[0x1]===_0x3d1d('0x91')?![]:!![]);});}if(!_[_0x3d1d('0x7b')](_0x48c88f)){_0x1f6d64[_0x3d1d('0x68')](_0x1b2e2d);_0x47a0a0[_0x3d1d('0x48')]('t.id\x20IN\x20?',_0x48c88f);}BPromise[_0x3d1d('0x92')]()['then'](function(){if(!_0x5579ad){if(_0x144f00[_0x3d1d('0x3e')]['FaxAccountId']||_0x144f00[_0x3d1d('0x3e')][_0x3d1d('0x93')])return;_0x47a0a0[_0x3d1d('0x48')](_0x3d1d('0x94'));_0x1f6d64['where'](_0x3d1d('0x94'));return;}return _0x144f00[_0x3d1d('0x95')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x3d1d('0x2c')](function(_0x28c220){if(_[_0x3d1d('0x7b')](_0x28c220)){_0x47a0a0['where'](_0x3d1d('0x96'));_0x1f6d64[_0x3d1d('0x48')](_0x3d1d('0x96'));}else{_0x47a0a0['where'](_0x3d1d('0x97'),_[_0x3d1d('0x31')](_0x28c220,'id'));_0x1f6d64[_0x3d1d('0x48')](_0x3d1d('0x97'),_['map'](_0x28c220,'id'));}});})[_0x3d1d('0x2c')](function(){db[_0x3d1d('0x98')][_0x3d1d('0x3e')](_0x47a0a0['toString'](),_0x12188d)['then'](function(_0x206967){_0x43a778['count']=_0x206967['length'];if(_0x43a778[_0x3d1d('0x24')]===0x0)return[];return db[_0x3d1d('0x98')]['query'](_0x493175[_0x3d1d('0x99')](),_0x12188d)[_0x3d1d('0x2c')](function(_0x4859fb){_0x29643f=_[_0x3d1d('0x9a')](_0x4859fb,'id');_0x12188d=_[_0x3d1d('0x9b')](_0x12188d,{'model':db[_0x3d1d('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x144f00[_0x3d1d('0x3e')]['fields']){_0x183063['attributes']['forEach'](function(_0x46338d){_0x1f6d64[_0x3d1d('0x4c')]('i.'+_0x46338d);});}else{_0x1f6d64[_0x3d1d('0x4c')](_0x3d1d('0x9c'),_0x3d1d('0x66'));_0x1f6d64['field']('a.key','Account.key');_0x1f6d64[_0x3d1d('0x4c')](_0x3d1d('0x9d'),_0x3d1d('0x9e'));_0x1f6d64[_0x3d1d('0x4c')](_0x3d1d('0x9f'));_0x1f6d64[_0x3d1d('0x4c')]('c.firstName',_0x3d1d('0xa0'));_0x1f6d64['field'](_0x3d1d('0xa1'),_0x3d1d('0xa2'));_0x1f6d64['field'](_0x3d1d('0xa3'),'Contact.email');_0x1f6d64[_0x3d1d('0x4c')]('c.phone',_0x3d1d('0xa4'));_0x1f6d64[_0x3d1d('0x4c')](_0x3d1d('0xa5'),'Contact.mobile');_0x1f6d64[_0x3d1d('0x4c')](_0x3d1d('0xa6'),_0x3d1d('0xa7'));_0x1f6d64[_0x3d1d('0x4c')](_0x3d1d('0xa8'),_0x3d1d('0xa9'));_0x1f6d64[_0x3d1d('0x4c')](_0x3d1d('0xaa'),'Owner.internal');_0x1f6d64[_0x3d1d('0x4c')](_0x3d1d('0xab'),_0x3d1d('0x33'));}if(_0x183063['limit'])_0x1f6d64[_0x3d1d('0x45')](_0x183063['limit']);if(_0x183063[_0x3d1d('0x25')])_0x1f6d64[_0x3d1d('0x25')](_0x183063[_0x3d1d('0x25')]);return db[_0x3d1d('0x98')]['query'](_0x1f6d64[_0x3d1d('0x99')](),_0x12188d);})[_0x3d1d('0x2c')](function(_0x49fc82){_0x3cde3f[_0x3d1d('0x48')]('ui.FaxInteractionId\x20IN\x20?',_[_0x3d1d('0x31')](_0x49fc82,'id'));return db['sequelize']['query'](_0x3cde3f[_0x3d1d('0x99')](),_0x12188d)['then'](function(_0x110fbd){var _0xd6f4d2=_[_0x3d1d('0xac')](_0x110fbd,_0x3d1d('0xad'));var _0x2da422=[];_0x49fc82[_0x3d1d('0x36')](function(_0x22de2f){_0x2da422[_0x3d1d('0x37')](updateFaxInteraction(_0x22de2f,_0x29643f,_0xd6f4d2));});return BPromise[_0x3d1d('0xae')](_0x2da422);});});})['then'](function(_0x338302){_0x43a778['rows']=_0x338302;return _0x43a778;})[_0x3d1d('0x2c')](respondWithFilteredResult(_0xaedceb,_0x183063));})[_0x3d1d('0xaf')](handleError(_0xaedceb,null));};exports[_0x3d1d('0xb0')]=function(_0x3b6cc7,_0x5c6a36){var _0x23a40c={'raw':![],'where':{'id':_0x3b6cc7[_0x3d1d('0xb1')]['id']}},_0x2ce583={};_0x2ce583[_0x3d1d('0x3d')]=_[_0x3d1d('0x3f')](db[_0x3d1d('0x39')][_0x3d1d('0x3a')]);_0x2ce583[_0x3d1d('0x3e')]=_[_0x3d1d('0x3f')](_0x3b6cc7[_0x3d1d('0x3e')]);_0x2ce583['filters']=_[_0x3d1d('0x40')](_0x2ce583[_0x3d1d('0x3d')],_0x2ce583[_0x3d1d('0x3e')]);_0x23a40c[_0x3d1d('0x41')]=_[_0x3d1d('0x40')](_0x2ce583[_0x3d1d('0x3d')],qs[_0x3d1d('0x42')](_0x3b6cc7[_0x3d1d('0x3e')]['fields']));_0x23a40c[_0x3d1d('0x41')]=_0x23a40c[_0x3d1d('0x41')][_0x3d1d('0x64')]?_0x23a40c[_0x3d1d('0x41')]:_0x2ce583[_0x3d1d('0x3d')];if(_0x3b6cc7[_0x3d1d('0x3e')]['includeAll']){_0x23a40c[_0x3d1d('0xb2')]=[{'all':!![]}];}_0x23a40c=_[_0x3d1d('0x9b')]({},_0x23a40c,_0x3b6cc7[_0x3d1d('0xb3')]);return db['FaxInteraction'][_0x3d1d('0x65')](_0x23a40c)['then'](handleEntityNotFound(_0x5c6a36,null))[_0x3d1d('0x2c')](respondWithResult(_0x5c6a36,null))[_0x3d1d('0xaf')](handleError(_0x5c6a36,null));};exports[_0x3d1d('0xb4')]=function(_0x211c0b,_0x3ee2d5){return db[_0x3d1d('0x39')]['create'](_0x211c0b[_0x3d1d('0x79')],{})[_0x3d1d('0x2c')](respondWithResult(_0x3ee2d5,0xc9))['catch'](handleError(_0x3ee2d5,null));};exports['update']=function(_0x222849,_0x27ed78){if(_0x222849[_0x3d1d('0x79')]['id']){delete _0x222849[_0x3d1d('0x79')]['id'];}return db[_0x3d1d('0x39')][_0x3d1d('0x65')]({'where':{'id':_0x222849[_0x3d1d('0xb1')]['id']}})['then'](handleEntityNotFound(_0x27ed78,null))['then'](saveUpdates(_0x222849['body'],null))['then'](respondWithResult(_0x27ed78,null))[_0x3d1d('0xaf')](handleError(_0x27ed78,null));};exports['destroy']=function(_0x2a3a6f,_0x201629){return db[_0x3d1d('0x39')][_0x3d1d('0x65')]({'where':{'id':_0x2a3a6f['params']['id']}})[_0x3d1d('0x2c')](handleEntityNotFound(_0x201629,null))['then'](removeEntity(_0x201629,null))[_0x3d1d('0xaf')](handleError(_0x201629,null));};exports[_0x3d1d('0xb5')]=function(_0x1f49e5,_0xf18151){return db['FaxInteraction']['describe']()[_0x3d1d('0x2c')](respondWithResult(_0xf18151,null))[_0x3d1d('0xaf')](handleError(_0xf18151,null));};exports[_0x3d1d('0xb6')]=function(_0x40dcd7,_0x3cbed5,_0x28bcad){return db[_0x3d1d('0xb7')][_0x3d1d('0x65')]({'where':{'id':_0x40dcd7['params']['id']}})['then'](handleEntityNotFound(_0x3cbed5,null))[_0x3d1d('0x2c')](function(_0x191d9c){if(_0x191d9c){return _0x191d9c[_0x3d1d('0xb6')](_0x40dcd7['body'][_0x3d1d('0xb8')],_['omit'](_0x40dcd7[_0x3d1d('0x79')],[_0x3d1d('0xb8'),'id'])||{});}})[_0x3d1d('0x2c')](respondWithResult(_0x3cbed5,null))[_0x3d1d('0xaf')](handleError(_0x3cbed5,null));};exports['getMessages']=function(_0x51813c,_0x2195a2,_0x12bee7){var _0x6807c9={'raw':![],'where':{}};var _0xe1ab59={};var _0x1aafa8={'count':0x0,'rows':[]};return db[_0x3d1d('0x39')]['findOne']({'where':{'id':_0x51813c[_0x3d1d('0xb1')]['id']}})['then'](handleEntityNotFound(_0x2195a2,null))['then'](function(_0x459eab){if(_0x459eab){_0xe1ab59[_0x3d1d('0x3d')]=_[_0x3d1d('0x3f')](db[_0x3d1d('0xb7')][_0x3d1d('0x3a')]);_0xe1ab59[_0x3d1d('0x3e')]=_[_0x3d1d('0x3f')](_0x51813c[_0x3d1d('0x3e')]);_0xe1ab59[_0x3d1d('0x49')]=_[_0x3d1d('0x40')](_0xe1ab59['model'],_0xe1ab59[_0x3d1d('0x3e')]);_0x6807c9[_0x3d1d('0x41')]=_[_0x3d1d('0x40')](_0xe1ab59['model'],qs[_0x3d1d('0x42')](_0x51813c[_0x3d1d('0x3e')][_0x3d1d('0x42')]));_0x6807c9[_0x3d1d('0x41')]=_0x6807c9['attributes']['length']?_0x6807c9[_0x3d1d('0x41')]:_0xe1ab59['model'];if(!_0x51813c[_0x3d1d('0x3e')][_0x3d1d('0x43')](_0x3d1d('0x44'))){_0x6807c9[_0x3d1d('0x45')]=qs[_0x3d1d('0x45')](_0x51813c[_0x3d1d('0x3e')]['limit']);_0x6807c9['offset']=qs[_0x3d1d('0x25')](_0x51813c[_0x3d1d('0x3e')][_0x3d1d('0x25')]);}_0x6807c9[_0x3d1d('0x46')]=qs[_0x3d1d('0x47')](_0x51813c[_0x3d1d('0x3e')][_0x3d1d('0x47')]);_0x6807c9[_0x3d1d('0x48')]=qs[_0x3d1d('0x49')](_['pick'](_0x51813c[_0x3d1d('0x3e')],_0xe1ab59[_0x3d1d('0x49')]));_0x6807c9[_0x3d1d('0x48')][_0x3d1d('0xad')]=_0x459eab['id'];if(_0x51813c[_0x3d1d('0x3e')][_0x3d1d('0x88')]){_0x6807c9[_0x3d1d('0x48')]=_[_0x3d1d('0x9b')](_0x6807c9[_0x3d1d('0x48')],{'$or':_['map'](_0x6807c9[_0x3d1d('0x41')],function(_0xa9c4ff){var _0x51f0db={};_0x51f0db[_0xa9c4ff]={'$like':'%'+_0x51813c['query'][_0x3d1d('0x88')]+'%'};return _0x51f0db;})});}if(_0x51813c[_0x3d1d('0x3e')][_0x3d1d('0x7e')]){var _0x510cb9=_0x51813c[_0x3d1d('0x3e')][_0x3d1d('0x7e')][_0x3d1d('0x35')](',');var _0xe0d5a={};_0xe0d5a[_0x510cb9[0x0]]={'$gte':moment(_0x510cb9[0x1])[_0x3d1d('0xb9')](_0x3d1d('0xba'))};_0x6807c9[_0x3d1d('0x48')]=_['merge'](_0x6807c9[_0x3d1d('0x48')],_0xe0d5a);}_0x6807c9=_[_0x3d1d('0x9b')]({},_0x6807c9,_0x51813c[_0x3d1d('0xb3')]);return db[_0x3d1d('0xb7')]['count']({'where':_0x6807c9[_0x3d1d('0x48')]})[_0x3d1d('0x2c')](function(_0x1eba3c){_0x1aafa8[_0x3d1d('0x24')]=_0x1eba3c;if(_0x51813c[_0x3d1d('0x3e')][_0x3d1d('0xbb')]){_0x6807c9[_0x3d1d('0xb2')]=[{'all':!![]}];}return db[_0x3d1d('0xb7')]['findAll'](_0x6807c9);})['then'](function(_0x184e2a){_0x1aafa8[_0x3d1d('0xbc')]=_0x184e2a;return _0x1aafa8;});}})['then'](respondWithFilteredResult(_0x2195a2,_0x6807c9))[_0x3d1d('0xaf')](handleError(_0x2195a2,null));};exports[_0x3d1d('0xbd')]=function(_0x4a2219,_0x3450ec,_0x3abe47){return db[_0x3d1d('0x39')][_0x3d1d('0x65')]({'where':{'id':_0x4a2219[_0x3d1d('0xb1')]['id']}})['then'](handleEntityNotFound(_0x3450ec,null))[_0x3d1d('0x2c')](function(_0x4ecd89){if(_0x4ecd89){return _0x4ecd89[_0x3d1d('0xbe')](_0x4a2219['body'][_0x3d1d('0xb8')],_[_0x3d1d('0xbf')](_0x4a2219[_0x3d1d('0x79')],[_0x3d1d('0xb8'),'id'])||{})[_0x3d1d('0xc0')](function(){return db['Tag'][_0x3d1d('0xc1')]({'attributes':['id','name',_0x3d1d('0x4d')],'where':{'id':_0x4a2219[_0x3d1d('0x79')][_0x3d1d('0xb8')]}});})[_0x3d1d('0x2c')](function(_0x32b947){socket['emit'](_0x3d1d('0xc2'),{'id':Number(_0x4a2219[_0x3d1d('0xb1')]['id']),'tags':_0x32b947||[]});return{'id':Number(_0x4a2219[_0x3d1d('0xb1')]['id']),'tags':_0x32b947||[]};});}})[_0x3d1d('0x2c')](respondWithResult(_0x3450ec,null))['catch'](handleError(_0x3450ec,null));};exports[_0x3d1d('0xc3')]=function(_0x4f464c,_0x45d3de,_0x5e6a5f){return db[_0x3d1d('0x39')][_0x3d1d('0x65')]({'where':{'id':_0x4f464c[_0x3d1d('0xb1')]['id']}})[_0x3d1d('0x2c')](handleEntityNotFound(_0x45d3de,null))[_0x3d1d('0x2c')](function(_0x1df5b3){if(_0x1df5b3){return _0x1df5b3[_0x3d1d('0xc3')](_0x4f464c[_0x3d1d('0x3e')][_0x3d1d('0xb8')]);}})['then'](respondWithStatusCode(_0x45d3de,null))[_0x3d1d('0xaf')](handleError(_0x45d3de,null));};exports[_0x3d1d('0xc4')]=function(_0x2ed9dd,_0x546f15){var _0x3a6a41=moment()['unix']()['toString']();var _0x40a005=path[_0x3d1d('0xc5')](config[_0x3d1d('0xc6')],_0x3d1d('0xc7'),_0x3d1d('0xc8'),_0x3d1d('0xc9'));var _0x168f78=path[_0x3d1d('0xc5')](config[_0x3d1d('0xc6')],_0x3d1d('0xc7'),_0x3d1d('0xc8'),_0x3d1d('0xca'));var _0x55f0b4=path['join'](_0x40a005,_0x3a6a41);var _0x3a6332=util[_0x3d1d('0xb9')](_0x3d1d('0xcb'),_0x2ed9dd['params']['id'],_0x3a6a41);var _0x243dd1=path[_0x3d1d('0xc5')](_0x40a005,_0x3a6332);var _0x4fd278=[];_0x4fd278[_0x3d1d('0x37')]({'model':db[_0x3d1d('0xcc')],'as':_0x3d1d('0xcc'),'raw':!![]});var _0x31dace=[{'model':db[_0x3d1d('0xb7')],'as':_0x3d1d('0xcd'),'attributes':['id',_0x3d1d('0x79'),_0x3d1d('0x7d')],'include':_0x4fd278}];return db[_0x3d1d('0x39')][_0x3d1d('0x65')]({'where':{'id':_0x2ed9dd[_0x3d1d('0xb1')]['id']},'include':_0x31dace})['then'](handleEntityNotFound(_0x546f15,null))[_0x3d1d('0x2c')](function(_0x3ad47b){if(_0x3ad47b&&_0x3ad47b[_0x3d1d('0xcd')]){var _0x592120=_0x3ad47b[_0x3d1d('0xce')]({'plain':!![]});fs[_0x3d1d('0xcf')](_0x55f0b4);for(var _0x59940c=0x0;_0x59940c<_0x592120[_0x3d1d('0xcd')][_0x3d1d('0x64')];_0x59940c++){var _0x368d94=_0x592120[_0x3d1d('0xcd')][_0x59940c][_0x3d1d('0xcc')];if(_0x368d94){var _0x5c7e6f=path[_0x3d1d('0xc5')](_0x168f78,_0x368d94[_0x3d1d('0xd0')]);if(fs[_0x3d1d('0xd1')](_0x5c7e6f)){fs[_0x3d1d('0xd2')](_0x5c7e6f)[_0x3d1d('0xd3')](fs[_0x3d1d('0xd4')](path[_0x3d1d('0xc5')](_0x55f0b4,_0x368d94[_0x3d1d('0xd0')])));}}}return BPromise[_0x3d1d('0x92')]()[_0x3d1d('0x2c')](function(){return new BPromise(function(_0x1ac444,_0x41d40b){zipdir(_0x55f0b4,{'saveTo':_0x243dd1},function(_0x33a15c,_0x40ff42){if(_0x33a15c)return _0x41d40b(_0x33a15c);return _0x1ac444(_0x40ff42);});})[_0x3d1d('0x2c')](function(){return new BPromise(function(_0x386709,_0x1bf9e5){rimraf(_0x55f0b4,function(_0x564537){if(_0x564537)_0x1bf9e5(_0x564537);return _0x386709();});});})[_0x3d1d('0x2c')](function(){return _0x546f15['download'](_0x243dd1,_0x3a6332,function(_0x1cb947){if(_0x1cb947){console[_0x3d1d('0xd5')](_0x3d1d('0xd6'),_0x1cb947);}else{fs[_0x3d1d('0xd7')](_0x243dd1);}});});});}else{return _0x546f15['sendStatus'](0xc8);}})[_0x3d1d('0xaf')](handleError(_0x546f15,null));}; \ No newline at end of file +var _0xf12a=['color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','users','u.id\x20=\x20ui.UserId','fax_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','type','text','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','some','compact','isEmpty','FaxAccountId','where','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','toString','keyBy','a.key','Account.key','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','ui.FaxInteractionId\x20IN\x20?','sequelize','FaxInteractionId','all','rows','params','include','merge','options','create','describe','addMessage','FaxMessage','omit','ids','findOne','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','format','Attachment','Messages','get','existsSync','createReadStream','pipe','createWriteStream','basename','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','TagIds','split','push','catch','index','FaxInteraction','fieldName','key','map','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','select','field'];(function(_0x29ca12,_0x436440){var _0x27900e=function(_0x1139c6){while(--_0x1139c6){_0x29ca12['push'](_0x29ca12['shift']());}};_0x27900e(++_0x436440);}(_0xf12a,0x8e));var _0xaf12=function(_0x1c2404,_0x120c50){_0x1c2404=_0x1c2404-0x0;var _0x389702=_0xf12a[_0x1c2404];return _0x389702;};'use strict';var pdf=require(_0xaf12('0x0'));var emlformat=require(_0xaf12('0x1'));var rimraf=require(_0xaf12('0x2'));var zipdir=require(_0xaf12('0x3'));var jsonpatch=require(_0xaf12('0x4'));var rp=require(_0xaf12('0x5'));var moment=require(_0xaf12('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaf12('0x7'));var path=require('path');var sox=require(_0xaf12('0x8'));var csv=require('to-csv');var ejs=require(_0xaf12('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xaf12('0xa'));var crypto=require(_0xaf12('0xb'));var jsforce=require(_0xaf12('0xc'));var deskjs=require(_0xaf12('0xd'));var toCsv=require(_0xaf12('0xe'));var querystring=require(_0xaf12('0xf'));var Papa=require(_0xaf12('0x10'));var Redis=require(_0xaf12('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xaf12('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaf12('0x13'));var logger=require('../../config/logger')(_0xaf12('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xaf12('0x15'))['db'];config[_0xaf12('0x16')]=_[_0xaf12('0x17')](config[_0xaf12('0x16')],{'host':_0xaf12('0x18'),'port':0x18eb});var socket=require(_0xaf12('0x19'))(new Redis(config[_0xaf12('0x16')]));require(_0xaf12('0x1a'))[_0xaf12('0x1b')](socket);function respondWithStatusCode(_0x3f1476,_0xa41e71){_0xa41e71=_0xa41e71||0xcc;return function(_0x627227){if(_0x627227){return _0x3f1476[_0xaf12('0x1c')](_0xa41e71);}return _0x3f1476[_0xaf12('0x1d')](_0xa41e71)[_0xaf12('0x1e')]();};}function respondWithResult(_0x3205ae,_0x450cd2){_0x450cd2=_0x450cd2||0xc8;return function(_0x5107e7){if(_0x5107e7){return _0x3205ae[_0xaf12('0x1d')](_0x450cd2)[_0xaf12('0x1f')](_0x5107e7);}};}function respondWithFilteredResult(_0x4b6d83,_0x4bc03e){return function(_0x4c8541){if(_0x4c8541){var _0xd0c5f=_0x4c8541[_0xaf12('0x20')],_0x4cc0a4=_0x4bc03e[_0xaf12('0x21')],_0x3530a8=_0x4bc03e[_0xaf12('0x21')]+_0x4bc03e[_0xaf12('0x22')],_0x516bad;if(_0x3530a8>=_0xd0c5f){_0x3530a8=_0xd0c5f;_0x516bad=0xc8;}else{_0x516bad=0xce;}_0x4b6d83['status'](_0x516bad);return _0x4b6d83[_0xaf12('0x23')](_0xaf12('0x24'),_0x4cc0a4+'-'+_0x3530a8+'/'+_0xd0c5f)[_0xaf12('0x1f')](_0x4c8541);}return null;};}function patchUpdates(_0x18c4e0){return function(_0x1982c7){try{jsonpatch[_0xaf12('0x25')](_0x1982c7,_0x18c4e0,!![]);}catch(_0x656675){return BPromise[_0xaf12('0x26')](_0x656675);}return _0x1982c7[_0xaf12('0x27')]();};}function saveUpdates(_0x41f9f7,_0x2c3a93){return function(_0x374e3c){if(_0x374e3c){return _0x374e3c[_0xaf12('0x28')](_0x41f9f7)['then'](function(_0x2c9ba3){return _0x2c9ba3;});}return null;};}function removeEntity(_0x566109,_0x576fd4){return function(_0x26e97a){if(_0x26e97a){return _0x26e97a[_0xaf12('0x29')]()[_0xaf12('0x2a')](function(){_0x566109['status'](0xcc)[_0xaf12('0x1e')]();});}};}function handleEntityNotFound(_0x3dbc35,_0x5c32bf){return function(_0x439409){if(!_0x439409){_0x3dbc35[_0xaf12('0x1c')](0x194);}return _0x439409;};}function handleError(_0x478286,_0x2ed53d){_0x2ed53d=_0x2ed53d||0x1f4;return function(_0x22f46f){logger[_0xaf12('0x2b')](_0x22f46f[_0xaf12('0x2c')]);if(_0x22f46f[_0xaf12('0x2d')]){delete _0x22f46f[_0xaf12('0x2d')];}_0x478286['status'](_0x2ed53d)[_0xaf12('0x2e')](_0x22f46f);};}function getInteractionUsers(_0x59328c,_0x39b12f){return new BPromise(function(_0x23e4d6,_0xb975f5){try{if(_0x39b12f[_0x59328c['id']]){_0x59328c['Users']=_['map'](_0x39b12f[_0x59328c['id']],function(_0x51ddae){return{'id':_0x51ddae['id'],'fullname':_0x51ddae['fullname']};});}}catch(_0x5484c8){_0xb975f5(_0x5484c8);}_0x23e4d6(_0x59328c);});}function getInteractionTags(_0x53401b,_0x64625){return new BPromise(function(_0x32abc3,_0x2fd548){try{if(_0x53401b[_0xaf12('0x2f')]){_0x53401b['Tags']=[];_0x53401b[_0xaf12('0x2f')][_0xaf12('0x30')](',')['forEach'](function(_0x384cad){_0x53401b['Tags'][_0xaf12('0x31')](_0x64625[_0x384cad]);});}delete _0x53401b[_0xaf12('0x2f')];}catch(_0x45e5db){_0x2fd548(_0x45e5db);}_0x32abc3(_0x53401b);});}function updateFaxInteraction(_0x182a6e,_0xddd4ec,_0x562132){return new BPromise(function(_0x406c32,_0x19d394){return getInteractionUsers(_0x182a6e,_0x562132)[_0xaf12('0x2a')](function(_0x173bfb){return getInteractionTags(_0x173bfb,_0xddd4ec);})[_0xaf12('0x2a')](function(_0x1e9744){_0x406c32(_0x1e9744);})[_0xaf12('0x32')](function(_0xe5def6){_0x19d394(_0xe5def6);});});}exports[_0xaf12('0x33')]=function(_0x55f694,_0x5d7936){var _0x4d7448={},_0x2f0fb9={},_0x59f131={'count':0x0,'rows':[]};var _0x4a907b=_['map'](db[_0xaf12('0x34')]['rawAttributes'],function(_0x47dec9){return{'name':_0x47dec9[_0xaf12('0x35')],'type':_0x47dec9['type'][_0xaf12('0x36')]};});_0x2f0fb9['model']=_[_0xaf12('0x37')](_0x4a907b,_0xaf12('0x2d'));_0x2f0fb9['query']=_[_0xaf12('0x38')](_0x55f694['query']);_0x2f0fb9['filters']=_[_0xaf12('0x39')](_0x2f0fb9[_0xaf12('0x3a')],_0x2f0fb9[_0xaf12('0x3b')]);_0x4d7448[_0xaf12('0x3c')]=_[_0xaf12('0x39')](_0x2f0fb9[_0xaf12('0x3a')],qs[_0xaf12('0x3d')](_0x55f694[_0xaf12('0x3b')][_0xaf12('0x3d')]));_0x4d7448['attributes']=_0x4d7448['attributes'][_0xaf12('0x3e')]?_0x4d7448[_0xaf12('0x3c')]:_0x2f0fb9[_0xaf12('0x3a')];if(!_0x55f694[_0xaf12('0x3b')][_0xaf12('0x3f')](_0xaf12('0x40'))){_0x4d7448[_0xaf12('0x22')]=qs['limit'](_0x55f694[_0xaf12('0x3b')][_0xaf12('0x22')]);_0x4d7448[_0xaf12('0x21')]=qs[_0xaf12('0x21')](_0x55f694[_0xaf12('0x3b')][_0xaf12('0x21')]);}_0x4d7448[_0xaf12('0x41')]=qs[_0xaf12('0x42')](_0x55f694[_0xaf12('0x3b')][_0xaf12('0x42')]);_0x4d7448['where']=qs[_0xaf12('0x43')](_[_0xaf12('0x44')](_0x55f694['query'],_0x2f0fb9['filters']),_0x4a907b);var _0x16784c=[];var _0x387c96=squel[_0xaf12('0x45')]()['field']('id')[_0xaf12('0x46')](_0xaf12('0x2d'))[_0xaf12('0x46')](_0xaf12('0x47'))[_0xaf12('0x48')](_0xaf12('0x49'));var _0x3c4678=squel['select']()[_0xaf12('0x46')](_0xaf12('0x4a'))[_0xaf12('0x46')](_0xaf12('0x4b'))[_0xaf12('0x46')](_0xaf12('0x4c'))[_0xaf12('0x48')]('user_has_fax_interactions','ui')['left_join'](_0xaf12('0x4d'),'u',_0xaf12('0x4e'));var _0x1fed3c=squel[_0xaf12('0x45')]()['from'](_0xaf12('0x4f'),'i')[_0xaf12('0x50')](_0xaf12('0x51'),'c',_0xaf12('0x52'))['left_join'](_0xaf12('0x4d'),'o',_0xaf12('0x53'))[_0xaf12('0x50')]('fax_accounts','a',_0xaf12('0x54'))[_0xaf12('0x50')](_0xaf12('0x55'),'me',_0xaf12('0x56'))['left_join'](_0xaf12('0x57'),'it','it.FaxInteractionId\x20=\x20i.id')[_0xaf12('0x50')](_0xaf12('0x49'),'t',_0xaf12('0x58'));var _0x271c34=squel[_0xaf12('0x59')]();var _0x98f195=[];var _0x418004=squel['expr']();var _0x178107;if(_0x55f694['query']['search']){_0x178107=as[_0xaf12('0x5a')](_0x55f694[_0xaf12('0x3b')]['search']);var _0x2063b1=_0x178107[_0xaf12('0x5b')];for(var _0x2add43=0x0;_0x2add43<_0x178107['conditions'][_0xaf12('0x3e')];_0x2add43++){var _0x3a984a=_0x178107['conditions'][_0x2add43];var _0x348170='i';var _0x4ab493=_[_0xaf12('0x5c')](_0x4a907b,['name',_0x3a984a[_0xaf12('0x46')]]);if(!_0x4ab493){switch(_0x3a984a[_0xaf12('0x46')]){case _0xaf12('0x5d'):if(_0x3a984a[_0xaf12('0x5e')]==0x1){_0x1fed3c[_0xaf12('0x5f')]('`'+_0x3a984a[_0xaf12('0x46')]+_0xaf12('0x60'));}else{_0x1fed3c[_0xaf12('0x5f')]('`'+_0x3a984a[_0xaf12('0x46')]+_0xaf12('0x61'));}break;case _0xaf12('0x62'):if(_0x3a984a[_0xaf12('0x63')]===_0xaf12('0x64')){if(_0x3a984a['value']['split']('\x20')[_0xaf12('0x3e')]>0x1){_0x271c34[_0x2063b1](_0xaf12('0x65'),qs[_0xaf12('0x66')](_0x3a984a[_0xaf12('0x5e')]),null);}else{var _0xbdb7db='%'+_0x3a984a[_0xaf12('0x5e')]+'%';_0x271c34[_0x2063b1]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xbdb7db,_0xbdb7db,_0xbdb7db);}}else{_0x4ab493=_[_0xaf12('0x5c')](_0x4a907b,[_0xaf12('0x2d'),'ContactId']);_0x3a984a[_0xaf12('0x46')]=_0xaf12('0x67');_0x2b04cc=as[_0xaf12('0x68')](_0x348170,_0x4ab493[_0xaf12('0x69')],_0x3a984a);_0x271c34[_0x2063b1](_0x2b04cc[_0xaf12('0x6a')],_0x2b04cc[_0xaf12('0x5e')]['start'],_0x2b04cc[_0xaf12('0x5e')]['end']);}break;case _0xaf12('0x6b'):var _0x2cd4a8=_0x3a984a[_0xaf12('0x5e')][_0xaf12('0x30')](',')[_0xaf12('0x37')](function(_0x5263aa){return Number(_0x5263aa);});_0x2cd4a8[_0xaf12('0x6c')](function(_0x916cc7){_0x418004['or'](_0xaf12('0x6d'),'%,'+_0x916cc7+',%');});_0x98f195=_[_0xaf12('0x6e')](_0x98f195,_0x2cd4a8);break;case'User':if(_0x3a984a[_0xaf12('0x63')]===_0xaf12('0x64')){_0x271c34[_0x2063b1](_0xaf12('0x6f'),'%'+_0x3a984a[_0xaf12('0x5e')]+'%',null);}else{_0x4ab493=_[_0xaf12('0x5c')](_0x4a907b,['name',_0xaf12('0x70')]);_0x3a984a['field']=_0xaf12('0x70');_0x2b04cc=as[_0xaf12('0x68')](_0x348170,_0x4ab493['type'],_0x3a984a);_0x271c34[_0x2063b1](_0x2b04cc['text'],_0x2b04cc[_0xaf12('0x5e')][_0xaf12('0x71')],_0x2b04cc[_0xaf12('0x5e')][_0xaf12('0x1e')]);}break;case _0xaf12('0x72'):_0x2b04cc=as[_0xaf12('0x68')]('me',null,_0x3a984a);_0x271c34[_0x2063b1](_0x2b04cc['text'],_0x2b04cc[_0xaf12('0x5e')]['start'],_0x2b04cc['value'][_0xaf12('0x1e')]);break;}}else{var _0x2b04cc=as[_0xaf12('0x68')](_0x348170,_0x4ab493[_0xaf12('0x69')],_0x3a984a);_0x271c34[_0x2063b1](_0x2b04cc[_0xaf12('0x6a')],_0x2b04cc[_0xaf12('0x5e')][_0xaf12('0x71')],_0x2b04cc[_0xaf12('0x5e')][_0xaf12('0x1e')]);}}}else{var _0x27bebc=_(_0x55f694[_0xaf12('0x3b')])[_0xaf12('0x38')]()[_0xaf12('0x37')](function(_0x4fcd15){return _[_0xaf12('0x73')](_0x4a907b,[_0xaf12('0x2d'),_0x4fcd15])?_0x4fcd15:undefined;})[_0xaf12('0x74')]()[_0xaf12('0x5e')]();if(!_[_0xaf12('0x75')](_0x27bebc)){_0x27bebc[_0xaf12('0x6c')](function(_0x315f6a){if(_0x315f6a===_0xaf12('0x76')){_0x1fed3c[_0xaf12('0x77')]('i.FaxAccountId\x20IN\x20?',[][_0xaf12('0x78')](_0x55f694['query'][_0x315f6a]));}else if(_0x315f6a===_0xaf12('0x79')){var _0x2a7ca4=JSON[_0xaf12('0x7a')](_0x55f694[_0xaf12('0x3b')][_0x315f6a])[_0xaf12('0x7b')];var _0x4364f8=JSON['parse'](_0x55f694[_0xaf12('0x3b')][_0x315f6a])[_0xaf12('0x7c')];_0x1fed3c[_0xaf12('0x77')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2a7ca4,_0x4364f8);}else{if(_0x55f694[_0xaf12('0x3b')][_0x315f6a]===_0xaf12('0x7d')){_0x1fed3c[_0xaf12('0x77')]('i.'+_0x315f6a+_0xaf12('0x7e'));}else{_0x1fed3c[_0xaf12('0x77')]('i.'+_0x315f6a+_0xaf12('0x7f'),_0x55f694[_0xaf12('0x3b')][_0x315f6a]);}}});}if(_0x55f694['query']['read']){if(_0x55f694[_0xaf12('0x3b')][_0xaf12('0x80')]==0x1){_0x1fed3c[_0xaf12('0x5f')](_0xaf12('0x81'));}else{_0x1fed3c[_0xaf12('0x5f')](_0xaf12('0x82'));}}if(_0x55f694[_0xaf12('0x3b')][_0xaf12('0x83')]){_0x98f195=_[_0xaf12('0x84')](_0x55f694[_0xaf12('0x3b')][_0xaf12('0x83')])?_0x55f694[_0xaf12('0x3b')][_0xaf12('0x83')]:new Array(_0x55f694[_0xaf12('0x3b')][_0xaf12('0x83')]);_0x98f195['forEach'](function(_0x2bf73c){_0x418004['or'](_0xaf12('0x6d'),'%,'+_0x2bf73c+',%');});}if(_0x55f694['query'][_0xaf12('0x85')]){var _0x4f4947=_0x55f694[_0xaf12('0x3b')][_0xaf12('0x85')][_0xaf12('0x86')]('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0xaf12('0x87')](_0x4f4947)){_0x271c34['or'](_0xaf12('0x88'),_0x4f4947+'%')['or'](_0xaf12('0x89'),_0x4f4947+'%');}_0x271c34['or'](_0xaf12('0x8a'),_0x4f4947+'%');}}_0x1fed3c['where'](_0x271c34);_0x1fed3c[_0xaf12('0x8b')](_0xaf12('0x8c'));var _0x5605d6={'type':db[_0xaf12('0x8d')][_0xaf12('0x8e')][_0xaf12('0x8f')],'raw':!![]};var _0x4965ca=_0x1fed3c[_0xaf12('0x90')]();_0x4965ca[_0xaf12('0x46')](_0xaf12('0x8c'));_0x4965ca['field'](_0xaf12('0x91'),_0xaf12('0x5d'));if(_0x4d7448['order']){_0x4d7448[_0xaf12('0x41')][_0xaf12('0x6c')](function(_0x551340){_0x1fed3c[_0xaf12('0x41')]('i.'+_0x551340[0x0],_0x551340[0x1]===_0xaf12('0x92')?![]:!![]);});}if(!_['isEmpty'](_0x98f195)){_0x1fed3c[_0xaf12('0x5f')](_0x418004);_0x4965ca[_0xaf12('0x77')](_0xaf12('0x93'),_0x98f195);}BPromise[_0xaf12('0x94')]()[_0xaf12('0x2a')](function(){if(!_0x178107){if(_0x55f694[_0xaf12('0x3b')][_0xaf12('0x76')]||_0x55f694[_0xaf12('0x3b')][_0xaf12('0x95')])return;_0x4965ca['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x1fed3c[_0xaf12('0x77')](_0xaf12('0x96'));return;}return _0x55f694[_0xaf12('0x97')][_0xaf12('0x98')]({'attributes':['id'],'raw':!![]})[_0xaf12('0x2a')](function(_0x40de6a){if(_[_0xaf12('0x75')](_0x40de6a)){_0x4965ca[_0xaf12('0x77')](_0xaf12('0x99'));_0x1fed3c[_0xaf12('0x77')](_0xaf12('0x99'));}else{_0x4965ca['where'](_0xaf12('0x9a'),_[_0xaf12('0x37')](_0x40de6a,'id'));_0x1fed3c['where']('i.FaxAccountId\x20IN\x20?',_['map'](_0x40de6a,'id'));}});})['then'](function(){db['sequelize'][_0xaf12('0x3b')](_0x4965ca[_0xaf12('0x9b')](),_0x5605d6)[_0xaf12('0x2a')](function(_0x3729a6){_0x59f131[_0xaf12('0x20')]=_0x3729a6[_0xaf12('0x3e')];if(_0x59f131[_0xaf12('0x20')]===0x0)return[];return db['sequelize']['query'](_0x387c96['toString'](),_0x5605d6)[_0xaf12('0x2a')](function(_0x5adfc0){_0x16784c=_[_0xaf12('0x9c')](_0x5adfc0,'id');_0x5605d6=_['merge'](_0x5605d6,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x55f694[_0xaf12('0x3b')][_0xaf12('0x3d')]){_0x4d7448[_0xaf12('0x3c')]['forEach'](function(_0x21c2e1){_0x1fed3c['field']('i.'+_0x21c2e1);});}else{_0x1fed3c['field'](_0xaf12('0x91'),_0xaf12('0x5d'));_0x1fed3c[_0xaf12('0x46')](_0xaf12('0x9d'),_0xaf12('0x9e'));_0x1fed3c[_0xaf12('0x46')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x1fed3c['field']('i.*');_0x1fed3c[_0xaf12('0x46')](_0xaf12('0x9f'),_0xaf12('0xa0'));_0x1fed3c[_0xaf12('0x46')](_0xaf12('0xa1'),_0xaf12('0xa2'));_0x1fed3c[_0xaf12('0x46')](_0xaf12('0xa3'),_0xaf12('0xa4'));_0x1fed3c[_0xaf12('0x46')](_0xaf12('0xa5'),_0xaf12('0xa6'));_0x1fed3c[_0xaf12('0x46')](_0xaf12('0xa7'),_0xaf12('0xa8'));_0x1fed3c[_0xaf12('0x46')](_0xaf12('0xa9'),_0xaf12('0xaa'));_0x1fed3c[_0xaf12('0x46')]('o.fullname','Owner.fullname');_0x1fed3c[_0xaf12('0x46')](_0xaf12('0xab'),_0xaf12('0xac'));_0x1fed3c['field']('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x4d7448[_0xaf12('0x22')])_0x1fed3c[_0xaf12('0x22')](_0x4d7448[_0xaf12('0x22')]);if(_0x4d7448[_0xaf12('0x21')])_0x1fed3c[_0xaf12('0x21')](_0x4d7448[_0xaf12('0x21')]);return db['sequelize']['query'](_0x1fed3c[_0xaf12('0x9b')](),_0x5605d6);})[_0xaf12('0x2a')](function(_0x336a14){_0x3c4678[_0xaf12('0x77')](_0xaf12('0xad'),_[_0xaf12('0x37')](_0x336a14,'id'));return db[_0xaf12('0xae')][_0xaf12('0x3b')](_0x3c4678[_0xaf12('0x9b')](),_0x5605d6)['then'](function(_0x236f59){var _0x14ecd4=_['groupBy'](_0x236f59,_0xaf12('0xaf'));var _0x59ac28=[];_0x336a14['forEach'](function(_0x1888ae){_0x59ac28[_0xaf12('0x31')](updateFaxInteraction(_0x1888ae,_0x16784c,_0x14ecd4));});return BPromise[_0xaf12('0xb0')](_0x59ac28);});});})[_0xaf12('0x2a')](function(_0x56ca2b){_0x59f131[_0xaf12('0xb1')]=_0x56ca2b;return _0x59f131;})[_0xaf12('0x2a')](respondWithFilteredResult(_0x5d7936,_0x4d7448));})[_0xaf12('0x32')](handleError(_0x5d7936,null));};exports['show']=function(_0x2408c2,_0x59d6d0){var _0xda38b4={'raw':![],'where':{'id':_0x2408c2[_0xaf12('0xb2')]['id']}},_0x1b9a13={};_0x1b9a13[_0xaf12('0x3a')]=_[_0xaf12('0x38')](db[_0xaf12('0x34')]['rawAttributes']);_0x1b9a13['query']=_[_0xaf12('0x38')](_0x2408c2[_0xaf12('0x3b')]);_0x1b9a13[_0xaf12('0x43')]=_[_0xaf12('0x39')](_0x1b9a13['model'],_0x1b9a13['query']);_0xda38b4[_0xaf12('0x3c')]=_[_0xaf12('0x39')](_0x1b9a13['model'],qs[_0xaf12('0x3d')](_0x2408c2[_0xaf12('0x3b')][_0xaf12('0x3d')]));_0xda38b4[_0xaf12('0x3c')]=_0xda38b4[_0xaf12('0x3c')][_0xaf12('0x3e')]?_0xda38b4[_0xaf12('0x3c')]:_0x1b9a13[_0xaf12('0x3a')];if(_0x2408c2['query']['includeAll']){_0xda38b4[_0xaf12('0xb3')]=[{'all':!![]}];}_0xda38b4=_[_0xaf12('0xb4')]({},_0xda38b4,_0x2408c2[_0xaf12('0xb5')]);return db[_0xaf12('0x34')][_0xaf12('0x5c')](_0xda38b4)[_0xaf12('0x2a')](handleEntityNotFound(_0x59d6d0,null))['then'](respondWithResult(_0x59d6d0,null))['catch'](handleError(_0x59d6d0,null));};exports[_0xaf12('0xb6')]=function(_0x3a8e2b,_0x3e4bb5){return db[_0xaf12('0x34')][_0xaf12('0xb6')](_0x3a8e2b['body'],{})[_0xaf12('0x2a')](respondWithResult(_0x3e4bb5,0xc9))['catch'](handleError(_0x3e4bb5,null));};exports[_0xaf12('0x28')]=function(_0x3b13bd,_0xe37e4a){if(_0x3b13bd['body']['id']){delete _0x3b13bd[_0xaf12('0x72')]['id'];}return db[_0xaf12('0x34')][_0xaf12('0x5c')]({'where':{'id':_0x3b13bd[_0xaf12('0xb2')]['id']}})[_0xaf12('0x2a')](handleEntityNotFound(_0xe37e4a,null))[_0xaf12('0x2a')](saveUpdates(_0x3b13bd[_0xaf12('0x72')],null))[_0xaf12('0x2a')](respondWithResult(_0xe37e4a,null))[_0xaf12('0x32')](handleError(_0xe37e4a,null));};exports['destroy']=function(_0x48f528,_0x1df12f){return db['FaxInteraction'][_0xaf12('0x5c')]({'where':{'id':_0x48f528['params']['id']}})['then'](handleEntityNotFound(_0x1df12f,null))[_0xaf12('0x2a')](removeEntity(_0x1df12f,null))[_0xaf12('0x32')](handleError(_0x1df12f,null));};exports[_0xaf12('0xb7')]=function(_0x389807,_0x402eb0){return db[_0xaf12('0x34')][_0xaf12('0xb7')]()[_0xaf12('0x2a')](respondWithResult(_0x402eb0,null))[_0xaf12('0x32')](handleError(_0x402eb0,null));};exports[_0xaf12('0xb8')]=function(_0x15961d,_0x3d43e5,_0x230573){return db[_0xaf12('0xb9')][_0xaf12('0x5c')]({'where':{'id':_0x15961d['params']['id']}})[_0xaf12('0x2a')](handleEntityNotFound(_0x3d43e5,null))[_0xaf12('0x2a')](function(_0x1b3417){if(_0x1b3417){return _0x1b3417[_0xaf12('0xb8')](_0x15961d['body']['ids'],_[_0xaf12('0xba')](_0x15961d[_0xaf12('0x72')],[_0xaf12('0xbb'),'id'])||{});}})[_0xaf12('0x2a')](respondWithResult(_0x3d43e5,null))[_0xaf12('0x32')](handleError(_0x3d43e5,null));};exports['getMessages']=function(_0x12ea07,_0x3f41f1,_0x3a03ad){var _0x29f49f={'raw':![],'where':{}};var _0x5bc9a3={};var _0x33d1d9={'count':0x0,'rows':[]};return db[_0xaf12('0x34')][_0xaf12('0xbc')]({'where':{'id':_0x12ea07[_0xaf12('0xb2')]['id']}})[_0xaf12('0x2a')](handleEntityNotFound(_0x3f41f1,null))[_0xaf12('0x2a')](function(_0x32fd46){if(_0x32fd46){_0x5bc9a3['model']=_[_0xaf12('0x38')](db['FaxMessage']['rawAttributes']);_0x5bc9a3[_0xaf12('0x3b')]=_[_0xaf12('0x38')](_0x12ea07[_0xaf12('0x3b')]);_0x5bc9a3['filters']=_[_0xaf12('0x39')](_0x5bc9a3[_0xaf12('0x3a')],_0x5bc9a3[_0xaf12('0x3b')]);_0x29f49f[_0xaf12('0x3c')]=_[_0xaf12('0x39')](_0x5bc9a3[_0xaf12('0x3a')],qs[_0xaf12('0x3d')](_0x12ea07[_0xaf12('0x3b')][_0xaf12('0x3d')]));_0x29f49f[_0xaf12('0x3c')]=_0x29f49f[_0xaf12('0x3c')][_0xaf12('0x3e')]?_0x29f49f[_0xaf12('0x3c')]:_0x5bc9a3[_0xaf12('0x3a')];if(!_0x12ea07[_0xaf12('0x3b')][_0xaf12('0x3f')]('nolimit')){_0x29f49f['limit']=qs[_0xaf12('0x22')](_0x12ea07['query'][_0xaf12('0x22')]);_0x29f49f['offset']=qs[_0xaf12('0x21')](_0x12ea07[_0xaf12('0x3b')][_0xaf12('0x21')]);}_0x29f49f[_0xaf12('0x41')]=qs[_0xaf12('0x42')](_0x12ea07[_0xaf12('0x3b')][_0xaf12('0x42')]);_0x29f49f['where']=qs['filters'](_[_0xaf12('0x44')](_0x12ea07['query'],_0x5bc9a3['filters']));_0x29f49f[_0xaf12('0x77')][_0xaf12('0xaf')]=_0x32fd46['id'];if(_0x12ea07[_0xaf12('0x3b')][_0xaf12('0x85')]){_0x29f49f[_0xaf12('0x77')]=_[_0xaf12('0xb4')](_0x29f49f[_0xaf12('0x77')],{'$or':_[_0xaf12('0x37')](_0x29f49f[_0xaf12('0x3c')],function(_0x3e9385){var _0x517b53={};_0x517b53[_0x3e9385]={'$like':'%'+_0x12ea07['query'][_0xaf12('0x85')]+'%'};return _0x517b53;})});}if(_0x12ea07[_0xaf12('0x3b')][_0xaf12('0x7b')]){var _0x24188c=_0x12ea07[_0xaf12('0x3b')][_0xaf12('0x7b')][_0xaf12('0x30')](',');var _0x449e4a={};_0x449e4a[_0x24188c[0x0]]={'$gte':moment(_0x24188c[0x1])['format'](_0xaf12('0xbd'))};_0x29f49f[_0xaf12('0x77')]=_[_0xaf12('0xb4')](_0x29f49f['where'],_0x449e4a);}_0x29f49f=_[_0xaf12('0xb4')]({},_0x29f49f,_0x12ea07['options']);return db[_0xaf12('0xb9')][_0xaf12('0x20')]({'where':_0x29f49f[_0xaf12('0x77')]})[_0xaf12('0x2a')](function(_0x118552){_0x33d1d9[_0xaf12('0x20')]=_0x118552;if(_0x12ea07['query'][_0xaf12('0xbe')]){_0x29f49f[_0xaf12('0xb3')]=[{'all':!![]}];}return db[_0xaf12('0xb9')][_0xaf12('0xbf')](_0x29f49f);})[_0xaf12('0x2a')](function(_0x5e9d0e){_0x33d1d9[_0xaf12('0xb1')]=_0x5e9d0e;return _0x33d1d9;});}})[_0xaf12('0x2a')](respondWithFilteredResult(_0x3f41f1,_0x29f49f))['catch'](handleError(_0x3f41f1,null));};exports['addTags']=function(_0x4dfcf1,_0x590a1a,_0x55d189){return db[_0xaf12('0x34')][_0xaf12('0x5c')]({'where':{'id':_0x4dfcf1[_0xaf12('0xb2')]['id']}})['then'](handleEntityNotFound(_0x590a1a,null))[_0xaf12('0x2a')](function(_0x23fd78){if(_0x23fd78){return _0x23fd78['setTags'](_0x4dfcf1['body']['ids'],_[_0xaf12('0xba')](_0x4dfcf1[_0xaf12('0x72')],[_0xaf12('0xbb'),'id'])||{})['spread'](function(){return db[_0xaf12('0x6b')][_0xaf12('0xbf')]({'attributes':['id',_0xaf12('0x2d'),_0xaf12('0x47')],'where':{'id':_0x4dfcf1['body'][_0xaf12('0xbb')]}});})[_0xaf12('0x2a')](function(_0x143af3){socket[_0xaf12('0xc0')]('faxInteractionTags:save',{'id':Number(_0x4dfcf1[_0xaf12('0xb2')]['id']),'tags':_0x143af3||[]});return{'id':Number(_0x4dfcf1[_0xaf12('0xb2')]['id']),'tags':_0x143af3||[]};});}})[_0xaf12('0x2a')](respondWithResult(_0x590a1a,null))[_0xaf12('0x32')](handleError(_0x590a1a,null));};exports[_0xaf12('0xc1')]=function(_0xeedd4c,_0x174151,_0x40e457){return db[_0xaf12('0x34')]['find']({'where':{'id':_0xeedd4c[_0xaf12('0xb2')]['id']}})[_0xaf12('0x2a')](handleEntityNotFound(_0x174151,null))[_0xaf12('0x2a')](function(_0x320110){if(_0x320110){return _0x320110['removeTags'](_0xeedd4c[_0xaf12('0x3b')][_0xaf12('0xbb')]);}})[_0xaf12('0x2a')](respondWithStatusCode(_0x174151,null))['catch'](handleError(_0x174151,null));};exports[_0xaf12('0xc2')]=function(_0x1fafb2,_0x290c37){var _0xff0d29=moment()[_0xaf12('0xc3')]()['toString']();var _0x2ba073=path[_0xaf12('0xc4')](config[_0xaf12('0xc5')],_0xaf12('0xc6'),_0xaf12('0xc7'),_0xaf12('0xc8'));var _0x2ad6ef=path[_0xaf12('0xc4')](config[_0xaf12('0xc5')],_0xaf12('0xc6'),_0xaf12('0xc7'),_0xaf12('0xc9'));var _0x38d0ce=path['join'](_0x2ba073,_0xff0d29);var _0x34c271=util[_0xaf12('0xca')]('transcript-%d-%s.zip',_0x1fafb2['params']['id'],_0xff0d29);var _0x1c5290=path[_0xaf12('0xc4')](_0x2ba073,_0x34c271);var _0x5d42f6=[];_0x5d42f6[_0xaf12('0x31')]({'model':db['Attachment'],'as':_0xaf12('0xcb'),'raw':!![]});var _0x2aed08=[{'model':db[_0xaf12('0xb9')],'as':_0xaf12('0xcc'),'attributes':['id','body','createdAt'],'include':_0x5d42f6}];return db['FaxInteraction'][_0xaf12('0x5c')]({'where':{'id':_0x1fafb2[_0xaf12('0xb2')]['id']},'include':_0x2aed08})[_0xaf12('0x2a')](handleEntityNotFound(_0x290c37,null))[_0xaf12('0x2a')](function(_0x4ade24){if(_0x4ade24&&_0x4ade24['Messages']){var _0x31b760=_0x4ade24[_0xaf12('0xcd')]({'plain':!![]});fs['mkdirSync'](_0x38d0ce);for(var _0x4c49e5=0x0;_0x4c49e5<_0x31b760[_0xaf12('0xcc')][_0xaf12('0x3e')];_0x4c49e5++){var _0x5f3fb9=_0x31b760[_0xaf12('0xcc')][_0x4c49e5]['Attachment'];if(_0x5f3fb9){var _0x2743b9=path[_0xaf12('0xc4')](_0x2ad6ef,_0x5f3fb9['basename']);if(fs[_0xaf12('0xce')](_0x2743b9)){fs[_0xaf12('0xcf')](_0x2743b9)[_0xaf12('0xd0')](fs[_0xaf12('0xd1')](path[_0xaf12('0xc4')](_0x38d0ce,_0x5f3fb9[_0xaf12('0xd2')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x7ba374,_0x57848d){zipdir(_0x38d0ce,{'saveTo':_0x1c5290},function(_0x4884e4,_0x26ac41){if(_0x4884e4)return _0x57848d(_0x4884e4);return _0x7ba374(_0x26ac41);});})['then'](function(){return new BPromise(function(_0x323edd,_0x51f714){rimraf(_0x38d0ce,function(_0x2369a9){if(_0x2369a9)_0x51f714(_0x2369a9);return _0x323edd();});});})[_0xaf12('0x2a')](function(){return _0x290c37['download'](_0x1c5290,_0x34c271,function(_0x36f152){if(_0x36f152){console['log'](_0xaf12('0xd3'),_0x36f152);}else{fs[_0xaf12('0xd4')](_0x1c5290);}});});});}else{return _0x290c37['sendStatus'](0xc8);}})[_0xaf12('0x32')](handleError(_0x290c37,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index baf0003..9c10fcf 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 _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x249dfc,_0xe9e478){var _0x4b39f1=function(_0x4dabbe){while(--_0x4dabbe){_0x249dfc['push'](_0x249dfc['shift']());}};_0x4b39f1(++_0xe9e478);}(_0x1261,0x144));var _0x1126=function(_0x3e6647,_0x2c0d09){_0x3e6647=_0x3e6647-0x0;var _0x46bddd=_0x1261[_0x3e6647];return _0x46bddd;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x1126('0x0'))['db'][_0x1126('0x1')];var FaxMessage=require(_0x1126('0x0'))['db'][_0x1126('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x1126('0x3')](0x0);var events={'afterCreate':_0x1126('0x4'),'afterUpdate':_0x1126('0x5'),'afterDestroy':_0x1126('0x6')};function emitEvent(_0x21a480){return function(_0x75a851,_0x5a2189,_0x5c68c8){_0x75a851[_0x1126('0x7')]({'attributes':['id'],'raw':!![]})[_0x1126('0x8')](function(_0x4f239c){_0x75a851[_0x1126('0x9')](_0x1126('0xa'),_0x4f239c[_0x1126('0xb')](function(_0x3abb0b){return{'id':_0x3abb0b['id']};}));return FaxMessage[_0x1126('0xc')]({'where':{'FaxInteractionId':_0x75a851['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f09ac){_0x75a851[_0x1126('0x9')](_0x1126('0xd'),_0x3f09ac['length']);FaxInteractionEvents[_0x1126('0xe')](_0x21a480+':'+_0x75a851['id'],_0x75a851);FaxInteractionEvents['emit'](_0x21a480,_0x75a851);_0x5c68c8(null);})['catch'](_0x5c68c8(null));};}for(var e in events){if(events[_0x1126('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x1126('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0x326f=['../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','unreadMessages','length','emit','hasOwnProperty','exports','events'];(function(_0x4e5242,_0x1164f8){var _0x311688=function(_0x2355cc){while(--_0x2355cc){_0x4e5242['push'](_0x4e5242['shift']());}};_0x311688(++_0x1164f8);}(_0x326f,0xd1));var _0xf326=function(_0x2c6da8,_0x1c2dd4){_0x2c6da8=_0x2c6da8-0x0;var _0x501f8f=_0x326f[_0x2c6da8];return _0x501f8f;};'use strict';var EventEmitter=require(_0xf326('0x0'));var FaxInteraction=require('../../mysqldb')['db']['FaxInteraction'];var FaxMessage=require(_0xf326('0x1'))['db'][_0xf326('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xf326('0x3')](0x0);var events={'afterCreate':_0xf326('0x4'),'afterUpdate':_0xf326('0x5'),'afterDestroy':_0xf326('0x6')};function emitEvent(_0x9445c6){return function(_0xf1c243,_0x1b5a56,_0x3ace29){_0xf1c243['getUsers']({'attributes':['id'],'raw':!![]})[_0xf326('0x7')](function(_0x3851eb){_0xf1c243[_0xf326('0x8')](_0xf326('0x9'),_0x3851eb['map'](function(_0x4c206c){return{'id':_0x4c206c['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0xf1c243['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf326('0x7')](function(_0x1fc80e){_0xf1c243[_0xf326('0x8')](_0xf326('0xa'),_0x1fc80e[_0xf326('0xb')]);FaxInteractionEvents['emit'](_0x9445c6+':'+_0xf1c243['id'],_0xf1c243);FaxInteractionEvents[_0xf326('0xc')](_0x9445c6,_0xf1c243);_0x3ace29(null);})['catch'](_0x3ace29(null));};}for(var e in events){if(events[_0xf326('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xf326('0xe')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 00fa548..adeda5b 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 _0x750a=['FaxInteraction','fax_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define'];(function(_0xe8cd19,_0x190b1c){var _0x6c0d53=function(_0x4f36ef){while(--_0x4f36ef){_0xe8cd19['push'](_0xe8cd19['shift']());}};_0x6c0d53(++_0x190b1c);}(_0x750a,0x140));var _0xa750=function(_0x54483e,_0x207a77){_0x54483e=_0x54483e-0x0;var _0x286d76=_0x750a[_0x54483e];return _0x286d76;};'use strict';var _=require('lodash');var util=require(_0xa750('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa750('0x1'));var BPromise=require(_0xa750('0x2'));var rp=require(_0xa750('0x3'));var fs=require('fs');var path=require(_0xa750('0x4'));var rimraf=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var attributes=require(_0xa750('0x7'));module[_0xa750('0x8')]=function(_0x10b4d9,_0x2497df){return _0x10b4d9[_0xa750('0x9')](_0xa750('0xa'),attributes,{'tableName':_0xa750('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47a4dd,_0x53f2cb,_0x2678ff){if(_0x47a4dd['changed'](_0xa750('0xc'))){_0x47a4dd[_0xa750('0xd')]=moment()['format'](_0xa750('0xe'));}_0x2678ff(null,_0x47a4dd);}}});}; \ No newline at end of file +var _0xb821=['../../config/logger','bluebird','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x2c0bf2,_0x1339af){var _0x59b9db=function(_0x10ca7f){while(--_0x10ca7f){_0x2c0bf2['push'](_0x2c0bf2['shift']());}};_0x59b9db(++_0x1339af);}(_0xb821,0xa7));var _0x1b82=function(_0x439a99,_0xbfad39){_0x439a99=_0x439a99-0x0;var _0x3837c9=_0xb821[_0x439a99];return _0x3837c9;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x18f45f,_0x7b87e8,_0x161155){if(_0x18f45f[_0x1b82('0xa')](_0x1b82('0xb'))){_0x18f45f['closedAt']=moment()[_0x1b82('0xc')](_0x1b82('0xd'));}_0x161155(null,_0x18f45f);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index f861c01..a8dd0fa 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 _0xed7f=['defaults','socket.io-emitter','./faxInteraction.socket','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','where','attributes','limit','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x440de6,_0x2fbc65){var _0x4ce7d9=function(_0x4e23fd){while(--_0x4e23fd){_0x440de6['push'](_0x440de6['shift']());}};_0x4ce7d9(++_0x2fbc65);}(_0xed7f,0xca));var _0xfed7=function(_0x529964,_0x435c59){_0x529964=_0x529964-0x0;var _0x3c722c=_0xed7f[_0x529964];return _0x3c722c;};'use strict';var _=require(_0xfed7('0x0'));var util=require(_0xfed7('0x1'));var moment=require(_0xfed7('0x2'));var BPromise=require(_0xfed7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfed7('0x4'));var db=require(_0xfed7('0x5'))['db'];var utils=require(_0xfed7('0x6'));var logger=require(_0xfed7('0x7'))('rpc');var config=require(_0xfed7('0x8'));var jayson=require(_0xfed7('0x9'));var client=jayson[_0xfed7('0xa')][_0xfed7('0xb')]({'port':0x232a});config[_0xfed7('0xc')]=_[_0xfed7('0xd')](config[_0xfed7('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xfed7('0xe'))(new Redis(config[_0xfed7('0xc')]));require(_0xfed7('0xf'))['register'](socket);function respondWithRpcPromise(_0x3fe596,_0x5ab271,_0x4272da){return new BPromise(function(_0x3e590d,_0x5a2434){return client[_0xfed7('0x10')](_0x3fe596,_0x4272da)[_0xfed7('0x11')](function(_0xda86db){logger[_0xfed7('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x5ab271,_0xfed7('0x13'));logger[_0xfed7('0x14')](_0xfed7('0x15'),_0x5ab271,_0xfed7('0x13'),JSON[_0xfed7('0x16')](_0xda86db));if(_0xda86db[_0xfed7('0x17')]){if(_0xda86db[_0xfed7('0x17')][_0xfed7('0x18')]===0x1f4){logger[_0xfed7('0x17')](_0xfed7('0x19'),_0x5ab271,_0xda86db[_0xfed7('0x17')][_0xfed7('0x1a')]);return _0x5a2434(_0xda86db[_0xfed7('0x17')][_0xfed7('0x1a')]);}logger[_0xfed7('0x17')](_0xfed7('0x19'),_0x5ab271,_0xda86db[_0xfed7('0x17')][_0xfed7('0x1a')]);return _0x3e590d(_0xda86db[_0xfed7('0x17')][_0xfed7('0x1a')]);}else{logger['info'](_0xfed7('0x19'),_0x5ab271,_0xfed7('0x13'));_0x3e590d(_0xda86db['result']['message']);}})[_0xfed7('0x1b')](function(_0x5d1fee){logger['error'](_0xfed7('0x19'),_0x5ab271,_0x5d1fee);_0x5a2434(_0x5d1fee);});});}exports[_0xfed7('0x1c')]=function(_0x11d8a8){var _0x4a2ecf=this;return new Promise(function(_0x2ffc43,_0x3b3fce){return db[_0xfed7('0x1d')][_0xfed7('0x1e')](_0x11d8a8['body'],{'raw':_0x11d8a8[_0xfed7('0x1f')]?_0x11d8a8['options'][_0xfed7('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11d8a8[_0xfed7('0x1f')]?_0x11d8a8[_0xfed7('0x1f')][_0xfed7('0x21')]||null:null,'attributes':_0x11d8a8['options']?_0x11d8a8['options'][_0xfed7('0x22')]||null:null,'limit':_0x11d8a8[_0xfed7('0x1f')]?_0x11d8a8['options'][_0xfed7('0x23')]||null:null})[_0xfed7('0x11')](function(_0x3719c3){logger[_0xfed7('0x12')]('UpdateFaxInteraction',_0x11d8a8);logger[_0xfed7('0x14')](_0xfed7('0x1c'),_0x11d8a8,JSON[_0xfed7('0x16')](_0x3719c3));_0x2ffc43(_0x3719c3);})[_0xfed7('0x1b')](function(_0x212f1c){logger['error'](_0xfed7('0x1c'),_0x212f1c[_0xfed7('0x1a')],_0x11d8a8);_0x3b3fce(_0x4a2ecf[_0xfed7('0x17')](0x1f4,_0x212f1c['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x3bc7fd){return new Promise(function(_0x3a9b16,_0x6c1230){return db[_0xfed7('0x1d')][_0xfed7('0x24')]({'where':_0x3bc7fd[_0xfed7('0x1f')]?_0x3bc7fd['options'][_0xfed7('0x21')]||null:null})[_0xfed7('0x11')](function(_0x436c97){if(_0x436c97){return _0x436c97[_0xfed7('0x25')](_0x3bc7fd[_0xfed7('0x26')][_0xfed7('0x27')],_[_0xfed7('0x28')](_0x3bc7fd[_0xfed7('0x26')],[_0xfed7('0x27'),'id'])||{});}})[_0xfed7('0x29')](function(_0x232aa1){logger['info']('AddTags',_0x3bc7fd);logger[_0xfed7('0x14')](_0xfed7('0x2a'),_0x3bc7fd,JSON[_0xfed7('0x16')](_0x232aa1));_0x3a9b16(_0x232aa1);})[_0xfed7('0x1b')](function(_0x248d32){logger[_0xfed7('0x17')](_0xfed7('0x2a'),_0x248d32[_0xfed7('0x1a')],_0x3bc7fd);_0x6c1230(_this[_0xfed7('0x17')](0x1f4,_0x248d32[_0xfed7('0x1a')]));});});}; \ No newline at end of file +var _0x8350=['localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','FaxInteraction,\x20%s,\x20%s','message','UpdateFaxInteraction','FaxInteraction','options','raw','where','attributes','limit','catch','body','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x472ee2,_0x295444){var _0x18387b=function(_0x320611){while(--_0x320611){_0x472ee2['push'](_0x472ee2['shift']());}};_0x18387b(++_0x295444);}(_0x8350,0x68));var _0x0835=function(_0x547b27,_0x146be0){_0x547b27=_0x547b27-0x0;var _0x3ed0eb=_0x8350[_0x547b27];return _0x3ed0eb;};'use strict';var _=require(_0x0835('0x0'));var util=require('util');var moment=require(_0x0835('0x1'));var BPromise=require(_0x0835('0x2'));var rs=require(_0x0835('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0835('0x4'))['db'];var utils=require(_0x0835('0x5'));var logger=require('../../config/logger')(_0x0835('0x6'));var config=require(_0x0835('0x7'));var jayson=require(_0x0835('0x8'));var client=jayson[_0x0835('0x9')][_0x0835('0xa')]({'port':0x232a});config[_0x0835('0xb')]=_[_0x0835('0xc')](config[_0x0835('0xb')],{'host':_0x0835('0xd'),'port':0x18eb});var socket=require(_0x0835('0xe'))(new Redis(config[_0x0835('0xb')]));require('./faxInteraction.socket')[_0x0835('0xf')](socket);function respondWithRpcPromise(_0x1b251e,_0x5025ef,_0x3ab924){return new BPromise(function(_0x509274,_0x56efc4){return client[_0x0835('0x10')](_0x1b251e,_0x3ab924)[_0x0835('0x11')](function(_0x47c5e1){logger[_0x0835('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x5025ef,_0x0835('0x13'));logger[_0x0835('0x14')](_0x0835('0x15'),_0x5025ef,_0x0835('0x13'),JSON['stringify'](_0x47c5e1));if(_0x47c5e1[_0x0835('0x16')]){if(_0x47c5e1[_0x0835('0x16')][_0x0835('0x17')]===0x1f4){logger[_0x0835('0x16')](_0x0835('0x18'),_0x5025ef,_0x47c5e1[_0x0835('0x16')][_0x0835('0x19')]);return _0x56efc4(_0x47c5e1['error'][_0x0835('0x19')]);}logger[_0x0835('0x16')](_0x0835('0x18'),_0x5025ef,_0x47c5e1[_0x0835('0x16')][_0x0835('0x19')]);return _0x509274(_0x47c5e1[_0x0835('0x16')][_0x0835('0x19')]);}else{logger[_0x0835('0x12')](_0x0835('0x18'),_0x5025ef,_0x0835('0x13'));_0x509274(_0x47c5e1['result'][_0x0835('0x19')]);}})['catch'](function(_0x2990cf){logger[_0x0835('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x5025ef,_0x2990cf);_0x56efc4(_0x2990cf);});});}exports[_0x0835('0x1a')]=function(_0x3a3e6d){var _0xceb2db=this;return new Promise(function(_0x2ebc8d,_0x55e99b){return db[_0x0835('0x1b')]['update'](_0x3a3e6d['body'],{'raw':_0x3a3e6d[_0x0835('0x1c')]?_0x3a3e6d[_0x0835('0x1c')][_0x0835('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a3e6d[_0x0835('0x1c')]?_0x3a3e6d[_0x0835('0x1c')][_0x0835('0x1e')]||null:null,'attributes':_0x3a3e6d[_0x0835('0x1c')]?_0x3a3e6d['options'][_0x0835('0x1f')]||null:null,'limit':_0x3a3e6d[_0x0835('0x1c')]?_0x3a3e6d[_0x0835('0x1c')][_0x0835('0x20')]||null:null})[_0x0835('0x11')](function(_0x20ee6f){logger[_0x0835('0x12')](_0x0835('0x1a'),_0x3a3e6d);logger[_0x0835('0x14')](_0x0835('0x1a'),_0x3a3e6d,JSON['stringify'](_0x20ee6f));_0x2ebc8d(_0x20ee6f);})[_0x0835('0x21')](function(_0x1a8690){logger[_0x0835('0x16')](_0x0835('0x1a'),_0x1a8690[_0x0835('0x19')],_0x3a3e6d);_0x55e99b(_0xceb2db[_0x0835('0x16')](0x1f4,_0x1a8690[_0x0835('0x19')]));});});};exports['AddTagsToFaxInteraction']=function(_0x16bdf8){return new Promise(function(_0xd8d5a0,_0x116ac2){return db[_0x0835('0x1b')]['find']({'where':_0x16bdf8['options']?_0x16bdf8[_0x0835('0x1c')][_0x0835('0x1e')]||null:null})[_0x0835('0x11')](function(_0x1e329b){if(_0x1e329b){return _0x1e329b['addTags'](_0x16bdf8[_0x0835('0x22')][_0x0835('0x23')],_[_0x0835('0x24')](_0x16bdf8['body'],['ids','id'])||{});}})[_0x0835('0x25')](function(_0x2b0495){logger[_0x0835('0x12')](_0x0835('0x26'),_0x16bdf8);logger[_0x0835('0x14')](_0x0835('0x26'),_0x16bdf8,JSON['stringify'](_0x2b0495));_0xd8d5a0(_0x2b0495);})[_0x0835('0x21')](function(_0x2ebc0a){logger[_0x0835('0x16')]('AddTags',_0x2ebc0a['message'],_0x16bdf8);_0x116ac2(_this[_0x0835('0x16')](0x1f4,_0x2ebc0a['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 3b26e45..1696f36 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 _0x4a9c=['register','length','faxInteraction:','./faxInteraction.events','save','remove','update','emit'];(function(_0x3e6cf4,_0x23e523){var _0x3bdfc7=function(_0x25f4b2){while(--_0x25f4b2){_0x3e6cf4['push'](_0x3e6cf4['shift']());}};_0x3bdfc7(++_0x23e523);}(_0x4a9c,0x1d3));var _0xc4a9=function(_0x1795bd,_0x93f8f4){_0x1795bd=_0x1795bd-0x0;var _0x46fa82=_0x4a9c[_0x1795bd];return _0x46fa82;};'use strict';var FaxInteractionEvents=require(_0xc4a9('0x0'));var events=[_0xc4a9('0x1'),_0xc4a9('0x2'),_0xc4a9('0x3')];function createListener(_0x355736,_0x5d824d){return function(_0x30649e){_0x5d824d[_0xc4a9('0x4')](_0x355736,_0x30649e);};}function removeListener(_0x20db97,_0x6952ec){return function(){FaxInteractionEvents['removeListener'](_0x20db97,_0x6952ec);};}exports[_0xc4a9('0x5')]=function(_0x566b43){for(var _0x49fb79=0x0,_0x217d74=events[_0xc4a9('0x6')];_0x49fb79<_0x217d74;_0x49fb79++){var _0x173b4b=events[_0x49fb79];var _0x49dbab=createListener(_0xc4a9('0x7')+_0x173b4b,_0x566b43);FaxInteractionEvents['on'](_0x173b4b,_0x49dbab);}}; \ No newline at end of file +var _0x14ea=['faxInteraction:','./faxInteraction.events','save','remove','update','emit','length'];(function(_0x323088,_0x18ced6){var _0x4b6c08=function(_0x1b951f){while(--_0x1b951f){_0x323088['push'](_0x323088['shift']());}};_0x4b6c08(++_0x18ced6);}(_0x14ea,0x189));var _0xa14e=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0x14ea[_0x1cd47d];return _0x29d52f;};'use strict';var FaxInteractionEvents=require(_0xa14e('0x0'));var events=[_0xa14e('0x1'),_0xa14e('0x2'),_0xa14e('0x3')];function createListener(_0x24ab87,_0x382b7a){return function(_0x1961d5){_0x382b7a[_0xa14e('0x4')](_0x24ab87,_0x1961d5);};}function removeListener(_0x5c3cfe,_0x3e4cff){return function(){FaxInteractionEvents['removeListener'](_0x5c3cfe,_0x3e4cff);};}exports['register']=function(_0x11acf0){for(var _0x5e5198=0x0,_0x4976ad=events[_0xa14e('0x5')];_0x5e5198<_0x4976ad;_0x5e5198++){var _0xc0223e=events[_0x5e5198];var _0x43c39c=createListener(_0xa14e('0x6')+_0xc0223e,_0x11acf0);FaxInteractionEvents['on'](_0xc0223e,_0x43c39c);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index bbbffc7..e3cc219 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 _0x88c9=['tracked','faxinteraction:destroy','destroy','/:id/tags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./faxInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','download','post','create','faxinteraction:addtags','put','fax','faxinteraction:update','update','delete'];(function(_0x17908c,_0x405e8a){var _0x2d1e71=function(_0x155282){while(--_0x155282){_0x17908c['push'](_0x17908c['shift']());}};_0x2d1e71(++_0x405e8a);}(_0x88c9,0x1f2));var _0x988c=function(_0x40c488,_0x2d7e2d){_0x40c488=_0x40c488-0x0;var _0x20fabc=_0x88c9[_0x40c488];return _0x20fabc;};'use strict';var multer=require(_0x988c('0x0'));var util=require(_0x988c('0x1'));var path=require(_0x988c('0x2'));var timeout=require(_0x988c('0x3'));var express=require(_0x988c('0x4'));var router=express['Router']();var auth=require(_0x988c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x988c('0x6'));router[_0x988c('0x7')]('/',auth[_0x988c('0x8')](),controller[_0x988c('0x9')]);router[_0x988c('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x988c('0xa')]);router[_0x988c('0x7')](_0x988c('0xb'),auth[_0x988c('0x8')](),controller[_0x988c('0xc')]);router[_0x988c('0x7')](_0x988c('0xd'),auth[_0x988c('0x8')](),controller[_0x988c('0xe')]);router[_0x988c('0x7')]('/:id/download',auth[_0x988c('0x8')](),controller[_0x988c('0xf')]);router[_0x988c('0x10')]('/',auth[_0x988c('0x8')](),controller[_0x988c('0x11')]);router[_0x988c('0x10')](_0x988c('0xd'),auth['isAuthenticated'](),controller['addMessage']);router['post']('/:id/tags',auth[_0x988c('0x8')](),interaction['tracked']('fax',_0x988c('0x12')),controller['addTags']);router[_0x988c('0x13')](_0x988c('0xb'),auth[_0x988c('0x8')](),interaction['tracked'](_0x988c('0x14'),_0x988c('0x15')),controller[_0x988c('0x16')]);router[_0x988c('0x17')](_0x988c('0xb'),auth[_0x988c('0x8')](),interaction[_0x988c('0x18')](_0x988c('0x14'),_0x988c('0x19')),controller[_0x988c('0x1a')]);router['delete'](_0x988c('0x1b'),auth[_0x988c('0x8')](),controller['removeTags']);module[_0x988c('0x1c')]=router; \ No newline at end of file +var _0x4fb6=['path','connect-timeout','express','Router','./faxInteraction.controller','index','get','/describe','isAuthenticated','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','/:id','faxinteraction:update','delete','destroy','removeTags'];(function(_0x1c6f0e,_0x5cb576){var _0x1ab876=function(_0x29a858){while(--_0x29a858){_0x1c6f0e['push'](_0x1c6f0e['shift']());}};_0x1ab876(++_0x5cb576);}(_0x4fb6,0x15f));var _0x64fb=function(_0x50f6e5,_0x151ccb){_0x50f6e5=_0x50f6e5-0x0;var _0x5988c5=_0x4fb6[_0x50f6e5];return _0x5988c5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x64fb('0x0'));var timeout=require(_0x64fb('0x1'));var express=require(_0x64fb('0x2'));var router=express[_0x64fb('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x64fb('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x64fb('0x5')]);router[_0x64fb('0x6')](_0x64fb('0x7'),auth[_0x64fb('0x8')](),controller[_0x64fb('0x9')]);router[_0x64fb('0x6')]('/:id',auth[_0x64fb('0x8')](),controller[_0x64fb('0xa')]);router['get'](_0x64fb('0xb'),auth['isAuthenticated'](),controller[_0x64fb('0xc')]);router[_0x64fb('0x6')](_0x64fb('0xd'),auth['isAuthenticated'](),controller[_0x64fb('0xe')]);router[_0x64fb('0xf')]('/',auth[_0x64fb('0x8')](),controller[_0x64fb('0x10')]);router[_0x64fb('0xf')]('/:id/messages',auth[_0x64fb('0x8')](),controller['addMessage']);router[_0x64fb('0xf')](_0x64fb('0x11'),auth[_0x64fb('0x8')](),interaction[_0x64fb('0x12')](_0x64fb('0x13'),_0x64fb('0x14')),controller[_0x64fb('0x15')]);router['put'](_0x64fb('0x16'),auth[_0x64fb('0x8')](),interaction[_0x64fb('0x12')](_0x64fb('0x13'),_0x64fb('0x17')),controller['update']);router[_0x64fb('0x18')](_0x64fb('0x16'),auth[_0x64fb('0x8')](),interaction[_0x64fb('0x12')](_0x64fb('0x13'),'faxinteraction:destroy'),controller[_0x64fb('0x19')]);router[_0x64fb('0x18')]('/:id/tags',auth['isAuthenticated'](),controller[_0x64fb('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index f2c3501..9efabe5 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 _0x58f3=['ENUM','out','TEXT','DATE','sequelize','medium','BOOLEAN'];(function(_0x1a8188,_0x55d92d){var _0x44c9c3=function(_0x498db2){while(--_0x498db2){_0x1a8188['push'](_0x1a8188['shift']());}};_0x44c9c3(++_0x55d92d);}(_0x58f3,0x18c));var _0x358f=function(_0xeeebcc,_0x2ad1b9){_0xeeebcc=_0xeeebcc-0x0;var _0x536a6f=_0x58f3[_0xeeebcc];return _0x536a6f;};'use strict';var Sequelize=require(_0x358f('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x358f('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x358f('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x358f('0x3')]('in',_0x358f('0x4')),'defaultValue':_0x358f('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x358f('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0x358f('0x6')]}}; \ No newline at end of file +var _0x0721=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x5af112,_0x4e673b){var _0x4afe0f=function(_0x45cb30){while(--_0x45cb30){_0x5af112['push'](_0x5af112['shift']());}};_0x4afe0f(++_0x4e673b);}(_0x0721,0x169));var _0x1072=function(_0x422baa,_0x98d34a){_0x422baa=_0x422baa-0x0;var _0x31c810=_0x0721[_0x422baa];return _0x31c810;};'use strict';var Sequelize=require(_0x1072('0x0'));module[_0x1072('0x1')]={'body':{'type':Sequelize[_0x1072('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x1072('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1072('0x4')]('in',_0x1072('0x5')),'defaultValue':_0x1072('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x1072('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x1072('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 69c03e7..caa1125 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 _0x4f93=['root','server','files','attachments','join','basename','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','test','Sequelize','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','status','end','json','offset','limit','set','Content-Range','reject','update','destroy','sendStatus','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','params','body','find','describe','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','FaxInteraction','FaxInteractionId','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','channel','EventManager','acceptmessage','agent','SIP/%s','event','rejectmessage','create','findOne','ContactId','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','fax','download'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x4f93,0x114));var _0x34f9=function(_0x5859d3,_0x26b667){_0x5859d3=_0x5859d3-0x0;var _0x1698f0=_0x4f93[_0x5859d3];return _0x1698f0;};'use strict';var pdf=require(_0x34f9('0x0'));var emlformat=require(_0x34f9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x34f9('0x2'));var jsonpatch=require(_0x34f9('0x3'));var rp=require(_0x34f9('0x4'));var moment=require(_0x34f9('0x5'));var BPromise=require(_0x34f9('0x6'));var Mustache=require('mustache');var util=require(_0x34f9('0x7'));var path=require(_0x34f9('0x8'));var sox=require(_0x34f9('0x9'));var csv=require(_0x34f9('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x34f9('0xb'));var squel=require(_0x34f9('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x34f9('0xa'));var querystring=require(_0x34f9('0xd'));var Papa=require(_0x34f9('0xe'));var Redis=require(_0x34f9('0xf'));var authService=require(_0x34f9('0x10'));var qs=require(_0x34f9('0x11'));var as=require(_0x34f9('0x12'));var hardwareService=require(_0x34f9('0x13'));var logger=require(_0x34f9('0x14'))(_0x34f9('0x15'));var utils=require(_0x34f9('0x16'));var config=require(_0x34f9('0x17'));var db=require(_0x34f9('0x18'))['db'];config[_0x34f9('0x19')]=_[_0x34f9('0x1a')](config[_0x34f9('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x34f9('0x1b'))(new Redis(config[_0x34f9('0x19')]));require(_0x34f9('0x1c'))[_0x34f9('0x1d')](socket);var jayson=require(_0x34f9('0x1e'));var client=jayson[_0x34f9('0x1f')][_0x34f9('0x20')]({'port':0x232c});var client9002=jayson[_0x34f9('0x1f')][_0x34f9('0x20')]({'port':0x232a});function checkPasswordPattern(_0x2357ec,_0x5ba9b9,_0x371e35){if(_0x371e35){var _0x303571=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x303571[_0x34f9('0x21')](_0x5ba9b9)){return _0x2357ec;}else{throw new db[(_0x34f9('0x22'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2357ec;}}function respondWithRpcPromise(_0x4b6fb7,_0x1e4833,_0x50bc81,_0x425a14){return new BPromise(function(_0x1229c7,_0x57373d){var _0x3d1ef4=_0x425a14||client;return _0x3d1ef4['request'](_0x4b6fb7,_0x50bc81)[_0x34f9('0x23')](function(_0x15e3fd){logger['info'](_0x34f9('0x24'),_0x1e4833,_0x34f9('0x25'));logger[_0x34f9('0x26')](_0x34f9('0x27'),_0x1e4833,_0x34f9('0x25'),JSON[_0x34f9('0x28')](_0x15e3fd));if(_0x15e3fd[_0x34f9('0x29')]){if(_0x15e3fd[_0x34f9('0x29')]['code']===0x1f4){logger['error'](_0x34f9('0x24'),_0x1e4833,_0x15e3fd[_0x34f9('0x29')][_0x34f9('0x2a')]);return _0x57373d(_0x15e3fd['error'][_0x34f9('0x2a')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x1e4833,_0x15e3fd['error']['message']);return _0x1229c7(_0x15e3fd[_0x34f9('0x29')]['message']);}else{logger[_0x34f9('0x2b')](_0x34f9('0x24'),_0x1e4833,_0x34f9('0x25'));_0x1229c7(_0x15e3fd['result'][_0x34f9('0x2a')]);}})['catch'](function(_0x231714){logger[_0x34f9('0x29')]('FaxMessage,\x20%s,\x20%s',_0x1e4833,_0x231714);_0x57373d(_0x231714);});});}function respondWithStatusCode(_0x5bde45,_0x10cc1e){_0x10cc1e=_0x10cc1e||0xcc;return function(_0x24faec){if(_0x24faec){return _0x5bde45['sendStatus'](_0x10cc1e);}return _0x5bde45[_0x34f9('0x2c')](_0x10cc1e)[_0x34f9('0x2d')]();};}function respondWithResult(_0x17f9db,_0x3f78db){_0x3f78db=_0x3f78db||0xc8;return function(_0xeece63){if(_0xeece63){return _0x17f9db['status'](_0x3f78db)[_0x34f9('0x2e')](_0xeece63);}};}function respondWithFilteredResult(_0x1f76ec,_0x2f793e){return function(_0x40fa57){if(_0x40fa57){var _0x116294=_0x40fa57['count'],_0x11b24c=_0x2f793e[_0x34f9('0x2f')],_0x569f48=_0x2f793e['offset']+_0x2f793e[_0x34f9('0x30')],_0x166591;if(_0x569f48>=_0x116294){_0x569f48=_0x116294;_0x166591=0xc8;}else{_0x166591=0xce;}_0x1f76ec[_0x34f9('0x2c')](_0x166591);return _0x1f76ec[_0x34f9('0x31')](_0x34f9('0x32'),_0x11b24c+'-'+_0x569f48+'/'+_0x116294)[_0x34f9('0x2e')](_0x40fa57);}return null;};}function patchUpdates(_0x410c9d){return function(_0x959d5d){try{jsonpatch['apply'](_0x959d5d,_0x410c9d,!![]);}catch(_0x4ff3e9){return BPromise[_0x34f9('0x33')](_0x4ff3e9);}return _0x959d5d['save']();};}function saveUpdates(_0x547c9c,_0x2853b5){return function(_0x3a1afa){if(_0x3a1afa){return _0x3a1afa[_0x34f9('0x34')](_0x547c9c)['then'](function(_0x25d7ce){return _0x25d7ce;});}return null;};}function removeEntity(_0x2c6186,_0x518d34){return function(_0xa9aa16){if(_0xa9aa16){return _0xa9aa16[_0x34f9('0x35')]()['then'](function(){_0x2c6186['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fc50d,_0x34cdfe){return function(_0x36f5f6){if(!_0x36f5f6){_0x3fc50d[_0x34f9('0x36')](0x194);}return _0x36f5f6;};}function handleError(_0x388305,_0x3d903c){_0x3d903c=_0x3d903c||0x1f4;return function(_0x3fa3a4){logger['error'](_0x3fa3a4[_0x34f9('0x37')]);if(_0x3fa3a4[_0x34f9('0x38')]){delete _0x3fa3a4[_0x34f9('0x38')];}_0x388305[_0x34f9('0x2c')](_0x3d903c)[_0x34f9('0x39')](_0x3fa3a4);};}exports[_0x34f9('0x3a')]=function(_0x43a8ef,_0x3d2c8f){var _0x287bf6={},_0x57a1f6={},_0x24149d={'count':0x0,'rows':[]};var _0x2fea6d=_[_0x34f9('0x3b')](db[_0x34f9('0x3c')][_0x34f9('0x3d')],function(_0x50b7c6){return{'name':_0x50b7c6[_0x34f9('0x3e')],'type':_0x50b7c6[_0x34f9('0x3f')][_0x34f9('0x40')]};});_0x57a1f6[_0x34f9('0x41')]=_[_0x34f9('0x3b')](_0x2fea6d,'name');_0x57a1f6['query']=_[_0x34f9('0x42')](_0x43a8ef[_0x34f9('0x43')]);_0x57a1f6[_0x34f9('0x44')]=_[_0x34f9('0x45')](_0x57a1f6[_0x34f9('0x41')],_0x57a1f6['query']);_0x287bf6[_0x34f9('0x46')]=_[_0x34f9('0x45')](_0x57a1f6[_0x34f9('0x41')],qs[_0x34f9('0x47')](_0x43a8ef['query'][_0x34f9('0x47')]));_0x287bf6['attributes']=_0x287bf6[_0x34f9('0x46')][_0x34f9('0x48')]?_0x287bf6[_0x34f9('0x46')]:_0x57a1f6[_0x34f9('0x41')];if(!_0x43a8ef[_0x34f9('0x43')][_0x34f9('0x49')]('nolimit')){_0x287bf6[_0x34f9('0x30')]=qs['limit'](_0x43a8ef[_0x34f9('0x43')]['limit']);_0x287bf6[_0x34f9('0x2f')]=qs['offset'](_0x43a8ef[_0x34f9('0x43')]['offset']);}_0x287bf6['order']=qs['sort'](_0x43a8ef[_0x34f9('0x43')]['sort']);_0x287bf6[_0x34f9('0x4a')]=qs['filters'](_[_0x34f9('0x4b')](_0x43a8ef[_0x34f9('0x43')],_0x57a1f6['filters']),_0x2fea6d);if(_0x43a8ef['query'][_0x34f9('0x4c')]){_0x287bf6[_0x34f9('0x4a')]=_['merge'](_0x287bf6[_0x34f9('0x4a')],{'$or':_['map'](_0x2fea6d,function(_0xf3ebff){if(_0xf3ebff[_0x34f9('0x3f')]!==_0x34f9('0x4d')){var _0x54315f={};_0x54315f[_0xf3ebff[_0x34f9('0x38')]]={'$like':'%'+_0x43a8ef['query']['filter']+'%'};return _0x54315f;}})});}_0x287bf6=_[_0x34f9('0x4e')]({},_0x287bf6,_0x43a8ef[_0x34f9('0x4f')]);var _0x200e9d={'where':_0x287bf6['where']};return db[_0x34f9('0x3c')][_0x34f9('0x50')](_0x200e9d)['then'](function(_0x1ea6a6){_0x24149d['count']=_0x1ea6a6;if(_0x43a8ef[_0x34f9('0x43')][_0x34f9('0x51')]){_0x287bf6[_0x34f9('0x52')]=[{'all':!![]}];}return db[_0x34f9('0x3c')][_0x34f9('0x53')](_0x287bf6);})[_0x34f9('0x23')](function(_0x26fd46){_0x24149d[_0x34f9('0x54')]=_0x26fd46;return _0x24149d;})[_0x34f9('0x23')](respondWithFilteredResult(_0x3d2c8f,_0x287bf6))[_0x34f9('0x55')](handleError(_0x3d2c8f,null));};exports[_0x34f9('0x56')]=function(_0x124bf3,_0x182ed8){var _0x16a619={'raw':!![],'where':{'id':_0x124bf3[_0x34f9('0x57')]['id']}},_0x37d05d={};_0x37d05d[_0x34f9('0x41')]=_['keys'](db['FaxMessage'][_0x34f9('0x3d')]);_0x37d05d['query']=_[_0x34f9('0x42')](_0x124bf3[_0x34f9('0x43')]);_0x37d05d['filters']=_['intersection'](_0x37d05d[_0x34f9('0x41')],_0x37d05d['query']);_0x16a619[_0x34f9('0x46')]=_['intersection'](_0x37d05d[_0x34f9('0x41')],qs['fields'](_0x124bf3[_0x34f9('0x43')]['fields']));_0x16a619[_0x34f9('0x46')]=_0x16a619['attributes']['length']?_0x16a619[_0x34f9('0x46')]:_0x37d05d[_0x34f9('0x41')];if(_0x124bf3[_0x34f9('0x43')][_0x34f9('0x51')]){_0x16a619['include']=[{'all':!![]}];}_0x16a619=_['merge']({},_0x16a619,_0x124bf3[_0x34f9('0x4f')]);return db['FaxMessage']['find'](_0x16a619)[_0x34f9('0x23')](handleEntityNotFound(_0x182ed8,null))[_0x34f9('0x23')](respondWithResult(_0x182ed8,null))[_0x34f9('0x55')](handleError(_0x182ed8,null));};exports['update']=function(_0x1190f8,_0x4f00b6){if(_0x1190f8[_0x34f9('0x58')]['id']){delete _0x1190f8[_0x34f9('0x58')]['id'];}return db[_0x34f9('0x3c')]['find']({'where':{'id':_0x1190f8['params']['id']}})['then'](handleEntityNotFound(_0x4f00b6,null))[_0x34f9('0x23')](saveUpdates(_0x1190f8[_0x34f9('0x58')],null))['then'](respondWithResult(_0x4f00b6,null))[_0x34f9('0x55')](handleError(_0x4f00b6,null));};exports['destroy']=function(_0x3cd307,_0x480aaf){return db[_0x34f9('0x3c')][_0x34f9('0x59')]({'where':{'id':_0x3cd307[_0x34f9('0x57')]['id']}})[_0x34f9('0x23')](handleEntityNotFound(_0x480aaf,null))['then'](removeEntity(_0x480aaf,null))[_0x34f9('0x55')](handleError(_0x480aaf,null));};exports[_0x34f9('0x5a')]=function(_0x54950e,_0x355d78){return db[_0x34f9('0x3c')][_0x34f9('0x5a')]()[_0x34f9('0x23')](respondWithResult(_0x355d78,null))['catch'](handleError(_0x355d78,null));};var interaction_log=require(_0x34f9('0x14'))(_0x34f9('0x5b'));exports[_0x34f9('0x5c')]=function(_0x2cdf68,_0x20a8f6,_0x17632c){var _0x17dff6={'channel':'fax'};if(_0x2cdf68['body']['id']){delete _0x2cdf68[_0x34f9('0x58')]['id'];}_0x2cdf68[_0x34f9('0x58')][_0x34f9('0x5d')]=!![];_0x2cdf68['body'][_0x34f9('0x5e')]=moment()[_0x34f9('0x5f')](_0x34f9('0x60'));_0x2cdf68['body']['UserId']=_0x2cdf68[_0x34f9('0x58')][_0x34f9('0x61')]||_0x2cdf68[_0x34f9('0x62')]['id'];return db[_0x34f9('0x3c')][_0x34f9('0x59')]({'where':{'id':_0x2cdf68[_0x34f9('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x34f9('0x63')],'as':_0x34f9('0x64')}]})[_0x34f9('0x23')](handleEntityNotFound(_0x20a8f6,null))['then'](saveUpdates(_0x2cdf68[_0x34f9('0x58')],null))[_0x34f9('0x23')](function(_0x275d67){if(_0x275d67){_0x17dff6['message']=_0x275d67[_0x34f9('0x65')]({'plain':!![]});return db[_0x34f9('0x66')][_0x34f9('0x59')]({'where':{'id':_0x275d67[_0x34f9('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x20a8f6,null))[_0x34f9('0x23')](function(_0x26bf8b){if(_0x26bf8b){return _0x26bf8b[_0x34f9('0x34')]({'UserId':_0x2cdf68[_0x34f9('0x58')][_0x34f9('0x61')],'read1stAt':_[_0x34f9('0x68')](_0x26bf8b['read1stAt'])?moment()[_0x34f9('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x34f9('0x23')](function(_0x2cef04){if(_0x2cef04){_0x17dff6[_0x34f9('0x69')]=_0x2cef04[_0x34f9('0x65')]({'plain':!![]});interaction_log[_0x34f9('0x2b')](_0x34f9('0x6a'),_0x2cdf68['user']['id'],_0x2cdf68[_0x34f9('0x62')][_0x34f9('0x38')],_0x2cdf68[_0x34f9('0x62')][_0x34f9('0x6b')],_0x17dff6[_0x34f9('0x69')]['id'],_0x2cdf68[_0x34f9('0x58')]?JSON[_0x34f9('0x28')](_0x2cdf68[_0x34f9('0x58')]):_0x34f9('0x6c'));return respondWithRpcPromise(_0x34f9('0x6d'),_0x34f9('0x6e'),_0x17dff6);}return null;})[_0x34f9('0x23')](function(_0x429fe0){if(_0x429fe0){if(_0x2cdf68[_0x34f9('0x58')]['manual']){_0x17dff6[_0x34f9('0x2a')][_0x34f9('0x6f')]=util['format']('SIP/%s',_0x2cdf68[_0x34f9('0x62')][_0x34f9('0x38')]);_0x17dff6[_0x34f9('0x2a')][_0x34f9('0x70')]=_0x17dff6[_0x34f9('0x70')];_0x17dff6[_0x34f9('0x2a')]['event']='accept';return respondWithRpcPromise(_0x34f9('0x71'),_0x34f9('0x71'),{'event':_0x34f9('0x72'),'message':_0x17dff6[_0x34f9('0x2a')]},client9002)[_0x34f9('0x23')](function(){return _0x17dff6;});}return _0x17dff6;}return null;})[_0x34f9('0x23')](respondWithResult(_0x20a8f6,null))[_0x34f9('0x55')](handleError(_0x20a8f6,null));};var interaction_log=require('../../config/logger')(_0x34f9('0x5b'));exports[_0x34f9('0x33')]=function(_0x53d1c9,_0x2f76a3,_0x25d6eb){var _0x2d1c0b={'agent':{},'channel':'fax'};if(_0x53d1c9[_0x34f9('0x58')]['id']){delete _0x53d1c9[_0x34f9('0x58')]['id'];}_0x53d1c9[_0x34f9('0x58')][_0x34f9('0x61')]=_0x53d1c9[_0x34f9('0x58')][_0x34f9('0x61')]||_0x53d1c9[_0x34f9('0x62')]['id'];_0x2d1c0b[_0x34f9('0x73')]['id']=_0x53d1c9['body'][_0x34f9('0x61')];return db[_0x34f9('0x3c')]['find']({'where':{'id':_0x53d1c9[_0x34f9('0x57')]['id'],'UserId':null}})[_0x34f9('0x23')](handleEntityNotFound(_0x2f76a3,null))['then'](function(_0x9d9b8f){if(_0x9d9b8f){_0x2d1c0b[_0x34f9('0x2a')]=_0x9d9b8f[_0x34f9('0x65')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x9d9b8f[_0x34f9('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x2f76a3,null))[_0x34f9('0x23')](function(_0x269d9e){if(_0x269d9e){_0x2d1c0b[_0x34f9('0x69')]=_0x269d9e[_0x34f9('0x65')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x53d1c9['user']['id'],_0x53d1c9[_0x34f9('0x62')]['name'],_0x53d1c9[_0x34f9('0x62')][_0x34f9('0x6b')],_0x2d1c0b[_0x34f9('0x69')]['id'],_0x53d1c9[_0x34f9('0x58')]?JSON['stringify'](_0x53d1c9[_0x34f9('0x58')]):_0x34f9('0x6c'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x2d1c0b);}return null;})[_0x34f9('0x23')](function(_0x281b03){if(_0x281b03){_0x281b03[_0x34f9('0x2a')][_0x34f9('0x6f')]=util['format'](_0x34f9('0x74'),_0x53d1c9[_0x34f9('0x62')][_0x34f9('0x38')]);_0x281b03[_0x34f9('0x2a')][_0x34f9('0x70')]=_0x2d1c0b[_0x34f9('0x70')];_0x281b03['message'][_0x34f9('0x75')]=_0x34f9('0x33');respondWithRpcPromise(_0x34f9('0x71'),_0x34f9('0x71'),{'event':_0x34f9('0x76'),'message':_0x281b03[_0x34f9('0x2a')]},client9002);return _0x2d1c0b;}return null;})['then'](respondWithResult(_0x2f76a3,null))[_0x34f9('0x55')](handleError(_0x2f76a3,null));};exports['create']=function(_0x5db066,_0x458aa6){var _0x50dd3e;return db[_0x34f9('0x3c')][_0x34f9('0x77')](_0x5db066[_0x34f9('0x58')],{})[_0x34f9('0x23')](function(_0x3c5042){_0x50dd3e=_0x3c5042;return db[_0x34f9('0x63')][_0x34f9('0x78')]({'where':{'id':_0x50dd3e[_0x34f9('0x79')]}});})[_0x34f9('0x23')](function(_0x4ecc77){if(_[_0x34f9('0x68')](_0x4ecc77)){return;}else{_0x50dd3e['fax']=_0x4ecc77['fax'];return db[_0x34f9('0x7a')][_0x34f9('0x78')]({'where':{'id':_0x50dd3e[_0x34f9('0x7b')]}});}})[_0x34f9('0x23')](function(_0x8b8153){return respondWithRpcPromise('SendFax',_0x34f9('0x7c'),{'FaxAccountId':_['isNil'](_0x5db066[_0x34f9('0x58')])?undefined:_0x5db066[_0x34f9('0x58')][_0x34f9('0x7d')],'path':_[_0x34f9('0x68')](_0x8b8153)?undefined:util[_0x34f9('0x5f')](_0x34f9('0x7e'),_0x8b8153['basename']),'fax':_['isNil'](_0x50dd3e[_0x34f9('0x7f')])?undefined:_0x50dd3e[_0x34f9('0x7f')],'AttachmentId':_0x50dd3e[_0x34f9('0x7b')]},client9002);})[_0x34f9('0x23')](respondWithResult(_0x458aa6,0xc9))[_0x34f9('0x55')](handleError(_0x458aa6,null));};exports[_0x34f9('0x80')]=function(_0x216827,_0x3be443){var _0x48daa1=path['join'](config[_0x34f9('0x81')],_0x34f9('0x82'),_0x34f9('0x83'),_0x34f9('0x84'));return db[_0x34f9('0x3c')]['find']({'where':{'id':_0x216827[_0x34f9('0x57')]['id']},'include':[{'model':db[_0x34f9('0x7a')],'as':_0x34f9('0x7a')}]})[_0x34f9('0x23')](handleEntityNotFound(_0x3be443,null))[_0x34f9('0x23')](function(_0x449b22){if(_0x449b22){return _0x3be443[_0x34f9('0x80')](path[_0x34f9('0x85')](_0x48daa1,_0x449b22[_0x34f9('0x7a')][_0x34f9('0x86')]));}})[_0x34f9('0x55')](handleError(_0x3be443,null));}; \ No newline at end of file +var _0x488b=['files','attachments','download','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','code','error','message','catch','status','json','offset','limit','set','Content-Range','save','update','end','sendStatus','map','FaxMessage','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','findAll','params','rawAttributes','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','CmContact','FaxInteraction','FaxInteractionId','read1stAt','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','name','stringify','null','AcceptMessage','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','reject','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','SIP/%s','rejectmessage','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','isNil','/var/opt/motion2/server/files/attachments/%s','basename','join','server'];(function(_0xe96711,_0x3c2895){var _0x311cc5=function(_0xf27035){while(--_0xf27035){_0xe96711['push'](_0xe96711['shift']());}};_0x311cc5(++_0x3c2895);}(_0x488b,0x10b));var _0xb488=function(_0x2f01d5,_0x4fca5e){_0x2f01d5=_0x2f01d5-0x0;var _0x3cc6ee=_0x488b[_0x2f01d5];return _0x3cc6ee;};'use strict';var pdf=require(_0xb488('0x0'));var emlformat=require(_0xb488('0x1'));var rimraf=require(_0xb488('0x2'));var zipdir=require(_0xb488('0x3'));var jsonpatch=require(_0xb488('0x4'));var rp=require(_0xb488('0x5'));var moment=require(_0xb488('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xb488('0x7'));var util=require(_0xb488('0x8'));var path=require(_0xb488('0x9'));var sox=require(_0xb488('0xa'));var csv=require(_0xb488('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb488('0xc'));var squel=require(_0xb488('0xd'));var crypto=require(_0xb488('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb488('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb488('0x10'));var Redis=require(_0xb488('0x11'));var authService=require(_0xb488('0x12'));var qs=require(_0xb488('0x13'));var as=require(_0xb488('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb488('0x15'))(_0xb488('0x16'));var utils=require(_0xb488('0x17'));var config=require(_0xb488('0x18'));var db=require('../../mysqldb')['db'];config[_0xb488('0x19')]=_[_0xb488('0x1a')](config['redis'],{'host':_0xb488('0x1b'),'port':0x18eb});var socket=require(_0xb488('0x1c'))(new Redis(config[_0xb488('0x19')]));require('./faxMessage.socket')['register'](socket);var jayson=require(_0xb488('0x1d'));var client=jayson[_0xb488('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xb488('0x1e')][_0xb488('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x52e7ac,_0x17d490,_0xe40fdf){if(_0xe40fdf){var _0x1bb315=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1bb315[_0xb488('0x20')](_0x17d490)){return _0x52e7ac;}else{throw new db['Sequelize'][(_0xb488('0x21'))](_0xb488('0x22'));}}else{return _0x52e7ac;}}function respondWithRpcPromise(_0x19def7,_0x36c393,_0x468934,_0x578a6d){return new BPromise(function(_0x5e4441,_0x423a6e){var _0xa01bce=_0x578a6d||client;return _0xa01bce[_0xb488('0x23')](_0x19def7,_0x468934)[_0xb488('0x24')](function(_0x22ba96){logger[_0xb488('0x25')](_0xb488('0x26'),_0x36c393,_0xb488('0x27'));logger[_0xb488('0x28')](_0xb488('0x29'),_0x36c393,_0xb488('0x27'),JSON['stringify'](_0x22ba96));if(_0x22ba96['error']){if(_0x22ba96['error'][_0xb488('0x2a')]===0x1f4){logger[_0xb488('0x2b')](_0xb488('0x26'),_0x36c393,_0x22ba96[_0xb488('0x2b')][_0xb488('0x2c')]);return _0x423a6e(_0x22ba96[_0xb488('0x2b')][_0xb488('0x2c')]);}logger[_0xb488('0x2b')](_0xb488('0x26'),_0x36c393,_0x22ba96[_0xb488('0x2b')][_0xb488('0x2c')]);return _0x5e4441(_0x22ba96[_0xb488('0x2b')][_0xb488('0x2c')]);}else{logger['info'](_0xb488('0x26'),_0x36c393,_0xb488('0x27'));_0x5e4441(_0x22ba96['result'][_0xb488('0x2c')]);}})[_0xb488('0x2d')](function(_0x2ff0da){logger[_0xb488('0x2b')](_0xb488('0x26'),_0x36c393,_0x2ff0da);_0x423a6e(_0x2ff0da);});});}function respondWithStatusCode(_0x5b9260,_0x405287){_0x405287=_0x405287||0xcc;return function(_0x549238){if(_0x549238){return _0x5b9260['sendStatus'](_0x405287);}return _0x5b9260[_0xb488('0x2e')](_0x405287)['end']();};}function respondWithResult(_0x241459,_0x4b90c2){_0x4b90c2=_0x4b90c2||0xc8;return function(_0x306899){if(_0x306899){return _0x241459[_0xb488('0x2e')](_0x4b90c2)[_0xb488('0x2f')](_0x306899);}};}function respondWithFilteredResult(_0x10654d,_0x28d2f2){return function(_0x4666b1){if(_0x4666b1){var _0x3079d3=_0x4666b1['count'],_0x1eb819=_0x28d2f2[_0xb488('0x30')],_0x3438d5=_0x28d2f2[_0xb488('0x30')]+_0x28d2f2[_0xb488('0x31')],_0x507c14;if(_0x3438d5>=_0x3079d3){_0x3438d5=_0x3079d3;_0x507c14=0xc8;}else{_0x507c14=0xce;}_0x10654d[_0xb488('0x2e')](_0x507c14);return _0x10654d[_0xb488('0x32')](_0xb488('0x33'),_0x1eb819+'-'+_0x3438d5+'/'+_0x3079d3)[_0xb488('0x2f')](_0x4666b1);}return null;};}function patchUpdates(_0x4db4a5){return function(_0x51d70b){try{jsonpatch['apply'](_0x51d70b,_0x4db4a5,!![]);}catch(_0x491714){return BPromise['reject'](_0x491714);}return _0x51d70b[_0xb488('0x34')]();};}function saveUpdates(_0x2d7348,_0x30599a){return function(_0x1b5347){if(_0x1b5347){return _0x1b5347[_0xb488('0x35')](_0x2d7348)[_0xb488('0x24')](function(_0x3cde0c){return _0x3cde0c;});}return null;};}function removeEntity(_0x478ff1,_0x2968d1){return function(_0x2f35ba){if(_0x2f35ba){return _0x2f35ba['destroy']()['then'](function(){_0x478ff1[_0xb488('0x2e')](0xcc)[_0xb488('0x36')]();});}};}function handleEntityNotFound(_0xa37733,_0x80cd09){return function(_0x171c0f){if(!_0x171c0f){_0xa37733[_0xb488('0x37')](0x194);}return _0x171c0f;};}function handleError(_0x3fb91e,_0xf78c2e){_0xf78c2e=_0xf78c2e||0x1f4;return function(_0xe32b98){logger[_0xb488('0x2b')](_0xe32b98['stack']);if(_0xe32b98['name']){delete _0xe32b98['name'];}_0x3fb91e['status'](_0xf78c2e)['send'](_0xe32b98);};}exports['index']=function(_0x212c49,_0xe0fcf0){var _0x152ff5={},_0x167d5a={},_0x5353d4={'count':0x0,'rows':[]};var _0x17e5d4=_[_0xb488('0x38')](db[_0xb488('0x39')]['rawAttributes'],function(_0x1759bf){return{'name':_0x1759bf['fieldName'],'type':_0x1759bf[_0xb488('0x3a')][_0xb488('0x3b')]};});_0x167d5a['model']=_[_0xb488('0x38')](_0x17e5d4,'name');_0x167d5a[_0xb488('0x3c')]=_[_0xb488('0x3d')](_0x212c49['query']);_0x167d5a[_0xb488('0x3e')]=_[_0xb488('0x3f')](_0x167d5a['model'],_0x167d5a[_0xb488('0x3c')]);_0x152ff5[_0xb488('0x40')]=_['intersection'](_0x167d5a[_0xb488('0x41')],qs[_0xb488('0x42')](_0x212c49[_0xb488('0x3c')][_0xb488('0x42')]));_0x152ff5[_0xb488('0x40')]=_0x152ff5[_0xb488('0x40')][_0xb488('0x43')]?_0x152ff5[_0xb488('0x40')]:_0x167d5a[_0xb488('0x41')];if(!_0x212c49[_0xb488('0x3c')][_0xb488('0x44')](_0xb488('0x45'))){_0x152ff5[_0xb488('0x31')]=qs[_0xb488('0x31')](_0x212c49[_0xb488('0x3c')][_0xb488('0x31')]);_0x152ff5[_0xb488('0x30')]=qs[_0xb488('0x30')](_0x212c49[_0xb488('0x3c')]['offset']);}_0x152ff5[_0xb488('0x46')]=qs[_0xb488('0x47')](_0x212c49[_0xb488('0x3c')][_0xb488('0x47')]);_0x152ff5[_0xb488('0x48')]=qs['filters'](_['pick'](_0x212c49[_0xb488('0x3c')],_0x167d5a[_0xb488('0x3e')]),_0x17e5d4);if(_0x212c49['query'][_0xb488('0x49')]){_0x152ff5['where']=_[_0xb488('0x4a')](_0x152ff5['where'],{'$or':_['map'](_0x17e5d4,function(_0x35946f){if(_0x35946f[_0xb488('0x3a')]!=='VIRTUAL'){var _0x134c26={};_0x134c26[_0x35946f['name']]={'$like':'%'+_0x212c49[_0xb488('0x3c')][_0xb488('0x49')]+'%'};return _0x134c26;}})});}_0x152ff5=_[_0xb488('0x4a')]({},_0x152ff5,_0x212c49[_0xb488('0x4b')]);var _0x5ba6f3={'where':_0x152ff5[_0xb488('0x48')]};return db[_0xb488('0x39')][_0xb488('0x4c')](_0x5ba6f3)[_0xb488('0x24')](function(_0x84a3ef){_0x5353d4[_0xb488('0x4c')]=_0x84a3ef;if(_0x212c49[_0xb488('0x3c')][_0xb488('0x4d')]){_0x152ff5[_0xb488('0x4e')]=[{'all':!![]}];}return db[_0xb488('0x39')][_0xb488('0x4f')](_0x152ff5);})['then'](function(_0x40292d){_0x5353d4['rows']=_0x40292d;return _0x5353d4;})[_0xb488('0x24')](respondWithFilteredResult(_0xe0fcf0,_0x152ff5))[_0xb488('0x2d')](handleError(_0xe0fcf0,null));};exports['show']=function(_0x41862b,_0x4d3e95){var _0x421c1c={'raw':!![],'where':{'id':_0x41862b[_0xb488('0x50')]['id']}},_0x488bc8={};_0x488bc8[_0xb488('0x41')]=_[_0xb488('0x3d')](db['FaxMessage'][_0xb488('0x51')]);_0x488bc8['query']=_[_0xb488('0x3d')](_0x41862b[_0xb488('0x3c')]);_0x488bc8[_0xb488('0x3e')]=_['intersection'](_0x488bc8[_0xb488('0x41')],_0x488bc8['query']);_0x421c1c[_0xb488('0x40')]=_[_0xb488('0x3f')](_0x488bc8[_0xb488('0x41')],qs[_0xb488('0x42')](_0x41862b['query'][_0xb488('0x42')]));_0x421c1c['attributes']=_0x421c1c[_0xb488('0x40')][_0xb488('0x43')]?_0x421c1c[_0xb488('0x40')]:_0x488bc8['model'];if(_0x41862b['query']['includeAll']){_0x421c1c[_0xb488('0x4e')]=[{'all':!![]}];}_0x421c1c=_[_0xb488('0x4a')]({},_0x421c1c,_0x41862b['options']);return db[_0xb488('0x39')][_0xb488('0x52')](_0x421c1c)['then'](handleEntityNotFound(_0x4d3e95,null))[_0xb488('0x24')](respondWithResult(_0x4d3e95,null))['catch'](handleError(_0x4d3e95,null));};exports[_0xb488('0x35')]=function(_0x196f6,_0x4d49a5){if(_0x196f6[_0xb488('0x53')]['id']){delete _0x196f6[_0xb488('0x53')]['id'];}return db[_0xb488('0x39')][_0xb488('0x52')]({'where':{'id':_0x196f6['params']['id']}})['then'](handleEntityNotFound(_0x4d49a5,null))[_0xb488('0x24')](saveUpdates(_0x196f6['body'],null))[_0xb488('0x24')](respondWithResult(_0x4d49a5,null))[_0xb488('0x2d')](handleError(_0x4d49a5,null));};exports['destroy']=function(_0x168915,_0x91ffce){return db[_0xb488('0x39')][_0xb488('0x52')]({'where':{'id':_0x168915['params']['id']}})['then'](handleEntityNotFound(_0x91ffce,null))[_0xb488('0x24')](removeEntity(_0x91ffce,null))[_0xb488('0x2d')](handleError(_0x91ffce,null));};exports[_0xb488('0x54')]=function(_0x236923,_0x241179){return db[_0xb488('0x39')][_0xb488('0x54')]()[_0xb488('0x24')](respondWithResult(_0x241179,null))[_0xb488('0x2d')](handleError(_0x241179,null));};var interaction_log=require('../../config/logger')(_0xb488('0x55'));exports[_0xb488('0x56')]=function(_0x1ecb2c,_0x25d88c,_0x3a8f25){var _0x19ad33={'channel':_0xb488('0x57')};if(_0x1ecb2c['body']['id']){delete _0x1ecb2c[_0xb488('0x53')]['id'];}_0x1ecb2c[_0xb488('0x53')][_0xb488('0x58')]=!![];_0x1ecb2c[_0xb488('0x53')][_0xb488('0x59')]=moment()[_0xb488('0x5a')](_0xb488('0x5b'));_0x1ecb2c[_0xb488('0x53')][_0xb488('0x5c')]=_0x1ecb2c[_0xb488('0x53')][_0xb488('0x5c')]||_0x1ecb2c['user']['id'];return db[_0xb488('0x39')][_0xb488('0x52')]({'where':{'id':_0x1ecb2c[_0xb488('0x50')]['id'],'UserId':null},'include':[{'model':db[_0xb488('0x5d')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x25d88c,null))[_0xb488('0x24')](saveUpdates(_0x1ecb2c[_0xb488('0x53')],null))[_0xb488('0x24')](function(_0x52dc4b){if(_0x52dc4b){_0x19ad33[_0xb488('0x2c')]=_0x52dc4b['get']({'plain':!![]});return db[_0xb488('0x5e')][_0xb488('0x52')]({'where':{'id':_0x52dc4b[_0xb488('0x5f')]}});}return null;})[_0xb488('0x24')](handleEntityNotFound(_0x25d88c,null))[_0xb488('0x24')](function(_0x460258){if(_0x460258){return _0x460258[_0xb488('0x35')]({'UserId':_0x1ecb2c[_0xb488('0x53')]['UserId'],'read1stAt':_['isNil'](_0x460258[_0xb488('0x60')])?moment()[_0xb488('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x5168cf){if(_0x5168cf){_0x19ad33[_0xb488('0x61')]=_0x5168cf[_0xb488('0x62')]({'plain':!![]});interaction_log[_0xb488('0x25')](_0xb488('0x63'),_0x1ecb2c[_0xb488('0x64')]['id'],_0x1ecb2c[_0xb488('0x64')][_0xb488('0x65')],_0x1ecb2c[_0xb488('0x64')]['role'],_0x19ad33['interaction']['id'],_0x1ecb2c[_0xb488('0x53')]?JSON[_0xb488('0x66')](_0x1ecb2c[_0xb488('0x53')]):_0xb488('0x67'));return respondWithRpcPromise(_0xb488('0x68'),_0xb488('0x69'),_0x19ad33);}return null;})[_0xb488('0x24')](function(_0x4b2bf3){if(_0x4b2bf3){if(_0x1ecb2c[_0xb488('0x53')][_0xb488('0x6a')]){_0x19ad33[_0xb488('0x2c')][_0xb488('0x6b')]=util[_0xb488('0x5a')]('SIP/%s',_0x1ecb2c['user'][_0xb488('0x65')]);_0x19ad33[_0xb488('0x2c')][_0xb488('0x6c')]=_0x19ad33[_0xb488('0x6c')];_0x19ad33[_0xb488('0x2c')][_0xb488('0x6d')]=_0xb488('0x56');return respondWithRpcPromise('EventManager',_0xb488('0x6e'),{'event':_0xb488('0x6f'),'message':_0x19ad33['message']},client9002)[_0xb488('0x24')](function(){return _0x19ad33;});}return _0x19ad33;}return null;})[_0xb488('0x24')](respondWithResult(_0x25d88c,null))[_0xb488('0x2d')](handleError(_0x25d88c,null));};var interaction_log=require('../../config/logger')(_0xb488('0x55'));exports[_0xb488('0x70')]=function(_0x55d4c6,_0xb72ae6,_0xe3a3b5){var _0x2270c4={'agent':{},'channel':_0xb488('0x57')};if(_0x55d4c6[_0xb488('0x53')]['id']){delete _0x55d4c6[_0xb488('0x53')]['id'];}_0x55d4c6['body'][_0xb488('0x5c')]=_0x55d4c6['body']['UserId']||_0x55d4c6[_0xb488('0x64')]['id'];_0x2270c4[_0xb488('0x71')]['id']=_0x55d4c6[_0xb488('0x53')][_0xb488('0x5c')];return db[_0xb488('0x39')][_0xb488('0x52')]({'where':{'id':_0x55d4c6[_0xb488('0x50')]['id'],'UserId':null}})[_0xb488('0x24')](handleEntityNotFound(_0xb72ae6,null))[_0xb488('0x24')](function(_0x2d8e02){if(_0x2d8e02){_0x2270c4[_0xb488('0x2c')]=_0x2d8e02['get']({'plain':!![]});return db['FaxInteraction'][_0xb488('0x52')]({'where':{'id':_0x2d8e02[_0xb488('0x5f')]}});}return null;})[_0xb488('0x24')](handleEntityNotFound(_0xb72ae6,null))[_0xb488('0x24')](function(_0xd99e99){if(_0xd99e99){_0x2270c4[_0xb488('0x61')]=_0xd99e99['get']({'plain':!![]});interaction_log[_0xb488('0x25')](_0xb488('0x72'),_0x55d4c6[_0xb488('0x64')]['id'],_0x55d4c6[_0xb488('0x64')][_0xb488('0x65')],_0x55d4c6[_0xb488('0x64')][_0xb488('0x73')],_0x2270c4['interaction']['id'],_0x55d4c6['body']?JSON[_0xb488('0x66')](_0x55d4c6['body']):_0xb488('0x67'));return respondWithRpcPromise(_0xb488('0x74'),'rejectMessage',_0x2270c4);}return null;})[_0xb488('0x24')](function(_0x45d8a5){if(_0x45d8a5){_0x45d8a5[_0xb488('0x2c')][_0xb488('0x6b')]=util['format'](_0xb488('0x75'),_0x55d4c6[_0xb488('0x64')]['name']);_0x45d8a5[_0xb488('0x2c')]['channel']=_0x2270c4[_0xb488('0x6c')];_0x45d8a5[_0xb488('0x2c')][_0xb488('0x6d')]='reject';respondWithRpcPromise(_0xb488('0x6e'),_0xb488('0x6e'),{'event':_0xb488('0x76'),'message':_0x45d8a5[_0xb488('0x2c')]},client9002);return _0x2270c4;}return null;})[_0xb488('0x24')](respondWithResult(_0xb72ae6,null))['catch'](handleError(_0xb72ae6,null));};exports['create']=function(_0x17dd93,_0x26e724){var _0x24b31c;return db[_0xb488('0x39')]['create'](_0x17dd93[_0xb488('0x53')],{})['then'](function(_0x6611c1){_0x24b31c=_0x6611c1;return db['CmContact'][_0xb488('0x77')]({'where':{'id':_0x24b31c['ContactId']}});})[_0xb488('0x24')](function(_0x413545){if(_['isNil'](_0x413545)){return;}else{_0x24b31c['fax']=_0x413545[_0xb488('0x57')];return db[_0xb488('0x78')]['findOne']({'where':{'id':_0x24b31c[_0xb488('0x79')]}});}})[_0xb488('0x24')](function(_0x21ab06){return respondWithRpcPromise(_0xb488('0x7a'),_0xb488('0x7a'),{'FaxAccountId':_['isNil'](_0x17dd93[_0xb488('0x53')])?undefined:_0x17dd93['body'][_0xb488('0x7b')],'path':_[_0xb488('0x7c')](_0x21ab06)?undefined:util[_0xb488('0x5a')](_0xb488('0x7d'),_0x21ab06[_0xb488('0x7e')]),'fax':_[_0xb488('0x7c')](_0x24b31c[_0xb488('0x57')])?undefined:_0x24b31c[_0xb488('0x57')],'AttachmentId':_0x24b31c[_0xb488('0x79')]},client9002);})[_0xb488('0x24')](respondWithResult(_0x26e724,0xc9))[_0xb488('0x2d')](handleError(_0x26e724,null));};exports['download']=function(_0x145804,_0x46be01){var _0x16fc59=path[_0xb488('0x7f')](config['root'],_0xb488('0x80'),_0xb488('0x81'),_0xb488('0x82'));return db[_0xb488('0x39')][_0xb488('0x52')]({'where':{'id':_0x145804[_0xb488('0x50')]['id']},'include':[{'model':db['Attachment'],'as':_0xb488('0x78')}]})['then'](handleEntityNotFound(_0x46be01,null))['then'](function(_0x4e2e24){if(_0x4e2e24){return _0x46be01[_0xb488('0x83')](path[_0xb488('0x7f')](_0x16fc59,_0x4e2e24['Attachment'][_0xb488('0x7e')]));}})[_0xb488('0x2d')](handleError(_0x46be01,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 0d8070b..11a638b 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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x2abaa9,_0x3aa6e8){var _0x39df51=function(_0xcac79f){while(--_0xcac79f){_0x2abaa9['push'](_0x2abaa9['shift']());}};_0x39df51(++_0x3aa6e8);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var EventEmitter=require(_0x7995('0x0'));var FaxMessage=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){FaxMessageEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);FaxMessageEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];FaxMessage[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe14b,0x93));var _0xbe14=function(_0x4b6cbe,_0x5a061e){_0x4b6cbe=_0x4b6cbe-0x0;var _0x106364=_0xe14b[_0x4b6cbe];return _0x106364;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var FaxMessage=require(_0xbe14('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){FaxMessageEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);FaxMessageEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];FaxMessage[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 81bb509..a5d5439 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 _0x9279=['direction','toLowerCase','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','get'];(function(_0x47ac8a,_0x404603){var _0xbab4d4=function(_0x485ed2){while(--_0x485ed2){_0x47ac8a['push'](_0x47ac8a['shift']());}};_0xbab4d4(++_0x404603);}(_0x9279,0x134));var _0x9927=function(_0x58ae8a,_0x3c619e){_0x58ae8a=_0x58ae8a-0x0;var _0x2f0b6b=_0x9279[_0x58ae8a];return _0x2f0b6b;};'use strict';var _=require(_0x9927('0x0'));var util=require(_0x9927('0x1'));var logger=require(_0x9927('0x2'))(_0x9927('0x3'));var moment=require(_0x9927('0x4'));var BPromise=require('bluebird');var rp=require(_0x9927('0x5'));var fs=require('fs');var path=require(_0x9927('0x6'));var rimraf=require('rimraf');var config=require(_0x9927('0x7'));var attributes=require(_0x9927('0x8'));module[_0x9927('0x9')]=function(_0x334018,_0x2c3151){return _0x334018[_0x9927('0xa')](_0x9927('0xb'),attributes,{'tableName':_0x9927('0xc'),'paranoid':![],'indexes':[{'name':_0x9927('0xd'),'fields':['body'],'type':_0x9927('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x13dd4b,_0x1dcdf5,_0x3b5217){var _0x3ccb7a=_0x334018['models'];var _0x20898c=_0x13dd4b[_0x9927('0xf')]({'plain':!![]});if(_0x20898c[_0x9927('0x10')][_0x9927('0x11')]()==='in'||_0x20898c[_0x9927('0x10')][_0x9927('0x11')]()==='out'&&!_0x20898c['secret']&&!_['isNil'](_0x20898c[_0x9927('0x12')])){_0x3ccb7a[_0x9927('0x13')][_0x9927('0x14')]({'where':{'id':_0x20898c[_0x9927('0x15')]}})[_0x9927('0x16')](function(_0x583ad3){if(_0x583ad3){_0x583ad3[_0x9927('0x17')]({'lastMsgAt':_0x20898c['createdAt'],'lastMsgDirection':_0x20898c[_0x9927('0x10')][_0x9927('0x11')]()});}})[_0x9927('0x18')](function(_0x1ab534){console[_0x9927('0x19')](_0x1ab534);});}_0x3b5217();}},'charset':'utf8mb4','collate':_0x9927('0x1a')});}; \ No newline at end of file +var _0xe238=['rimraf','./faxMessage.attributes','FaxMessage','fax_messages','fti_fax_messages','body','models','direction','toLowerCase','out','secret','FaxInteraction','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird'];(function(_0x222ac5,_0x5e14da){var _0x4bc51e=function(_0x8f98b3){while(--_0x8f98b3){_0x222ac5['push'](_0x222ac5['shift']());}};_0x4bc51e(++_0x5e14da);}(_0xe238,0x1c9));var _0x8e23=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xe238[_0x11005e];return _0x29338f;};'use strict';var _=require('lodash');var util=require(_0x8e23('0x0'));var logger=require('../../config/logger')(_0x8e23('0x1'));var moment=require('moment');var BPromise=require(_0x8e23('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8e23('0x3'));var config=require('../../config/environment');var attributes=require(_0x8e23('0x4'));module['exports']=function(_0x5f568d,_0x54f92d){return _0x5f568d['define'](_0x8e23('0x5'),attributes,{'tableName':_0x8e23('0x6'),'paranoid':![],'indexes':[{'name':_0x8e23('0x7'),'fields':[_0x8e23('0x8')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x269004,_0x95cd2a,_0x55ac45){var _0x352410=_0x5f568d[_0x8e23('0x9')];var _0x401aa6=_0x269004['get']({'plain':!![]});if(_0x401aa6['direction']['toLowerCase']()==='in'||_0x401aa6[_0x8e23('0xa')][_0x8e23('0xb')]()===_0x8e23('0xc')&&!_0x401aa6[_0x8e23('0xd')]&&!_['isNil'](_0x401aa6['UserId'])){_0x352410[_0x8e23('0xe')]['findOne']({'where':{'id':_0x401aa6[_0x8e23('0xf')]}})[_0x8e23('0x10')](function(_0x39fc61){if(_0x39fc61){_0x39fc61[_0x8e23('0x11')]({'lastMsgAt':_0x401aa6[_0x8e23('0x12')],'lastMsgDirection':_0x401aa6[_0x8e23('0xa')]['toLowerCase']()});}})[_0x8e23('0x13')](function(_0x9aeb12){console[_0x8e23('0x14')](_0x9aeb12);});}_0x55ac45();}},'charset':_0x8e23('0x15'),'collate':_0x8e23('0x16')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 90312d9..0aa7720 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 _0x8e24=['jayson/promise','http','redis','defaults','localhost','./faxMessage.socket','register','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateFaxMessage','FaxMessage','body','options','raw','then','UpdateFaxMessage','update','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x611295,_0x5654f4){var _0x5af903=function(_0x3cae2c){while(--_0x3cae2c){_0x611295['push'](_0x611295['shift']());}};_0x5af903(++_0x5654f4);}(_0x8e24,0x66));var _0x48e2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8e24[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x48e2('0x0'));var moment=require(_0x48e2('0x1'));var BPromise=require(_0x48e2('0x2'));var rs=require(_0x48e2('0x3'));var fs=require('fs');var Redis=require(_0x48e2('0x4'));var db=require(_0x48e2('0x5'))['db'];var utils=require(_0x48e2('0x6'));var logger=require('../../config/logger')(_0x48e2('0x7'));var config=require(_0x48e2('0x8'));var jayson=require(_0x48e2('0x9'));var client=jayson['client'][_0x48e2('0xa')]({'port':0x232a});config[_0x48e2('0xb')]=_[_0x48e2('0xc')](config[_0x48e2('0xb')],{'host':_0x48e2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x48e2('0xb')]));require(_0x48e2('0xe'))[_0x48e2('0xf')](socket);function respondWithRpcPromise(_0xe59279,_0x2c65bd,_0xb87693){return new BPromise(function(_0xbc1b01,_0xa1ee48){return client['request'](_0xe59279,_0xb87693)['then'](function(_0x454a52){logger[_0x48e2('0x10')](_0x48e2('0x11'),_0x2c65bd,_0x48e2('0x12'));logger[_0x48e2('0x13')](_0x48e2('0x14'),_0x2c65bd,_0x48e2('0x12'),JSON[_0x48e2('0x15')](_0x454a52));if(_0x454a52[_0x48e2('0x16')]){if(_0x454a52[_0x48e2('0x16')]['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x2c65bd,_0x454a52[_0x48e2('0x16')]['message']);return _0xa1ee48(_0x454a52[_0x48e2('0x16')]['message']);}logger[_0x48e2('0x16')](_0x48e2('0x11'),_0x2c65bd,_0x454a52[_0x48e2('0x16')][_0x48e2('0x17')]);return _0xbc1b01(_0x454a52[_0x48e2('0x16')]['message']);}else{logger[_0x48e2('0x10')]('FaxMessage,\x20%s,\x20%s',_0x2c65bd,'request\x20sent');_0xbc1b01(_0x454a52[_0x48e2('0x18')][_0x48e2('0x17')]);}})[_0x48e2('0x19')](function(_0x149749){logger[_0x48e2('0x16')](_0x48e2('0x11'),_0x2c65bd,_0x149749);_0xa1ee48(_0x149749);});});}exports[_0x48e2('0x1a')]=function(_0x2a515a){var _0x28a86c=this;return new Promise(function(_0x48e812,_0x3310d4){return db[_0x48e2('0x1b')]['create'](_0x2a515a[_0x48e2('0x1c')],{'raw':_0x2a515a[_0x48e2('0x1d')]?_0x2a515a[_0x48e2('0x1d')][_0x48e2('0x1e')]===undefined?!![]:![]:!![]})[_0x48e2('0x1f')](function(_0x3838c2){logger[_0x48e2('0x10')]('CreateFaxMessage',_0x2a515a);logger['debug'](_0x48e2('0x1a'),_0x2a515a,JSON[_0x48e2('0x15')](_0x3838c2));_0x48e812(_0x3838c2);})['catch'](function(_0x389039){logger[_0x48e2('0x16')](_0x48e2('0x1a'),_0x389039['message'],_0x2a515a);_0x3310d4(_0x28a86c['error'](0x1f4,_0x389039['message']));});});};exports[_0x48e2('0x20')]=function(_0x550064){var _0x1f82dd=this;return new Promise(function(_0x2217ca,_0x56a2fb){return db[_0x48e2('0x1b')][_0x48e2('0x21')](_0x550064['body'],{'raw':_0x550064[_0x48e2('0x1d')]?_0x550064[_0x48e2('0x1d')][_0x48e2('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x550064[_0x48e2('0x1d')]?_0x550064['options'][_0x48e2('0x22')]||null:null,'attributes':_0x550064[_0x48e2('0x1d')]?_0x550064[_0x48e2('0x1d')][_0x48e2('0x23')]||null:null,'limit':_0x550064[_0x48e2('0x1d')]?_0x550064[_0x48e2('0x1d')][_0x48e2('0x24')]||null:null})[_0x48e2('0x1f')](function(_0x37a27c){logger[_0x48e2('0x10')](_0x48e2('0x20'),_0x550064);logger[_0x48e2('0x13')](_0x48e2('0x20'),_0x550064,JSON[_0x48e2('0x15')](_0x37a27c));_0x2217ca(_0x37a27c);})[_0x48e2('0x19')](function(_0x25b08d){logger['error'](_0x48e2('0x20'),_0x25b08d[_0x48e2('0x17')],_0x550064);_0x56a2fb(_0x1f82dd['error'](0x1f4,_0x25b08d[_0x48e2('0x17')]));});});}; \ No newline at end of file +var _0x81e8=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','redis','localhost','socket.io-emitter','./faxMessage.socket','request','then','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','info','request\x20sent','result','CreateFaxMessage','FaxMessage','create','options','catch','UpdateFaxMessage','update','body','raw','where','limit','moment'];(function(_0x2338c2,_0xeca855){var _0x149734=function(_0x514eb0){while(--_0x514eb0){_0x2338c2['push'](_0x2338c2['shift']());}};_0x149734(++_0xeca855);}(_0x81e8,0x1db));var _0x881e=function(_0x170134,_0x4b7948){_0x170134=_0x170134-0x0;var _0x1d5033=_0x81e8[_0x170134];return _0x1d5033;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x881e('0x0'));var BPromise=require(_0x881e('0x1'));var rs=require(_0x881e('0x2'));var fs=require('fs');var Redis=require(_0x881e('0x3'));var db=require(_0x881e('0x4'))['db'];var utils=require(_0x881e('0x5'));var logger=require(_0x881e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x881e('0x7')]=_['defaults'](config['redis'],{'host':_0x881e('0x8'),'port':0x18eb});var socket=require(_0x881e('0x9'))(new Redis(config[_0x881e('0x7')]));require(_0x881e('0xa'))['register'](socket);function respondWithRpcPromise(_0xf44d27,_0x2db310,_0x1e3b58){return new BPromise(function(_0x21c0e3,_0x160470){return client[_0x881e('0xb')](_0xf44d27,_0x1e3b58)[_0x881e('0xc')](function(_0xcb74fd){logger['info']('FaxMessage,\x20%s,\x20%s',_0x2db310,'request\x20sent');logger[_0x881e('0xd')](_0x881e('0xe'),_0x2db310,'request\x20sent',JSON[_0x881e('0xf')](_0xcb74fd));if(_0xcb74fd[_0x881e('0x10')]){if(_0xcb74fd[_0x881e('0x10')][_0x881e('0x11')]===0x1f4){logger[_0x881e('0x10')](_0x881e('0x12'),_0x2db310,_0xcb74fd[_0x881e('0x10')][_0x881e('0x13')]);return _0x160470(_0xcb74fd[_0x881e('0x10')][_0x881e('0x13')]);}logger['error'](_0x881e('0x12'),_0x2db310,_0xcb74fd[_0x881e('0x10')][_0x881e('0x13')]);return _0x21c0e3(_0xcb74fd[_0x881e('0x10')]['message']);}else{logger[_0x881e('0x14')](_0x881e('0x12'),_0x2db310,_0x881e('0x15'));_0x21c0e3(_0xcb74fd[_0x881e('0x16')][_0x881e('0x13')]);}})['catch'](function(_0x414a47){logger['error'](_0x881e('0x12'),_0x2db310,_0x414a47);_0x160470(_0x414a47);});});}exports[_0x881e('0x17')]=function(_0x214847){var _0x32c90f=this;return new Promise(function(_0x4d208f,_0x36b30){return db[_0x881e('0x18')][_0x881e('0x19')](_0x214847['body'],{'raw':_0x214847[_0x881e('0x1a')]?_0x214847[_0x881e('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x881e('0xc')](function(_0x23e937){logger[_0x881e('0x14')](_0x881e('0x17'),_0x214847);logger[_0x881e('0xd')](_0x881e('0x17'),_0x214847,JSON[_0x881e('0xf')](_0x23e937));_0x4d208f(_0x23e937);})[_0x881e('0x1b')](function(_0x5a11c3){logger[_0x881e('0x10')]('CreateFaxMessage',_0x5a11c3[_0x881e('0x13')],_0x214847);_0x36b30(_0x32c90f[_0x881e('0x10')](0x1f4,_0x5a11c3[_0x881e('0x13')]));});});};exports[_0x881e('0x1c')]=function(_0x19ef96){var _0x53b8d9=this;return new Promise(function(_0x530abf,_0x43c33c){return db[_0x881e('0x18')][_0x881e('0x1d')](_0x19ef96[_0x881e('0x1e')],{'raw':_0x19ef96[_0x881e('0x1a')]?_0x19ef96['options'][_0x881e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19ef96[_0x881e('0x1a')]?_0x19ef96[_0x881e('0x1a')][_0x881e('0x20')]||null:null,'attributes':_0x19ef96['options']?_0x19ef96[_0x881e('0x1a')]['attributes']||null:null,'limit':_0x19ef96['options']?_0x19ef96[_0x881e('0x1a')][_0x881e('0x21')]||null:null})[_0x881e('0xc')](function(_0x44286f){logger[_0x881e('0x14')](_0x881e('0x1c'),_0x19ef96);logger['debug']('UpdateFaxMessage',_0x19ef96,JSON['stringify'](_0x44286f));_0x530abf(_0x44286f);})[_0x881e('0x1b')](function(_0x227df6){logger[_0x881e('0x10')]('UpdateFaxMessage',_0x227df6['message'],_0x19ef96);_0x43c33c(_0x53b8d9[_0x881e('0x10')](0x1f4,_0x227df6[_0x881e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 7b3599e..a2c47c3 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x3239f5,_0x50e77c){var _0x3559c8=function(_0x4f9f83){while(--_0x4f9f83){_0x3239f5['push'](_0x3239f5['shift']());}};_0x3559c8(++_0x50e77c);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var FaxMessageEvents=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(){FaxMessageEvents[_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);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 3f76d10..1928c6f 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 _0x9b87=['show','/:id/download','download','post','faxmessage:create','create','put','/:id','update','/:id/accept','accept','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x3f17fc,_0x472b6f){var _0x551c06=function(_0x463224){while(--_0x463224){_0x3f17fc['push'](_0x3f17fc['shift']());}};_0x551c06(++_0x472b6f);}(_0x9b87,0x8e));var _0x79b8=function(_0x3f4360,_0x23645b){_0x3f4360=_0x3f4360-0x0;var _0x4d6135=_0x9b87[_0x3f4360];return _0x4d6135;};'use strict';var multer=require(_0x79b8('0x0'));var util=require(_0x79b8('0x1'));var path=require(_0x79b8('0x2'));var timeout=require(_0x79b8('0x3'));var express=require(_0x79b8('0x4'));var router=express[_0x79b8('0x5')]();var auth=require(_0x79b8('0x6'));var interaction=require(_0x79b8('0x7'));var config=require(_0x79b8('0x8'));var controller=require(_0x79b8('0x9'));router[_0x79b8('0xa')]('/',auth[_0x79b8('0xb')](),controller[_0x79b8('0xc')]);router[_0x79b8('0xa')](_0x79b8('0xd'),auth[_0x79b8('0xb')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x79b8('0xe')]);router[_0x79b8('0xa')](_0x79b8('0xf'),auth['isAuthenticated'](),controller[_0x79b8('0x10')]);router[_0x79b8('0x11')]('/',auth[_0x79b8('0xb')](),interaction['tracked']('fax',_0x79b8('0x12')),controller[_0x79b8('0x13')]);router[_0x79b8('0x14')](_0x79b8('0x15'),auth[_0x79b8('0xb')](),controller[_0x79b8('0x16')]);router[_0x79b8('0x14')](_0x79b8('0x17'),auth[_0x79b8('0xb')](),controller[_0x79b8('0x18')]);router[_0x79b8('0x14')]('/:id/reject',auth[_0x79b8('0xb')](),controller['reject']);router['delete'](_0x79b8('0x15'),auth[_0x79b8('0xb')](),controller[_0x79b8('0x19')]);module['exports']=router; \ No newline at end of file +var _0xf492=['./faxMessage.controller','get','isAuthenticated','describe','/:id','show','download','tracked','fax','faxmessage:create','put','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3481a0,_0x3e4f09){var _0x141b2b=function(_0x31cc9d){while(--_0x31cc9d){_0x3481a0['push'](_0x3481a0['shift']());}};_0x141b2b(++_0x3e4f09);}(_0xf492,0xb2));var _0x2f49=function(_0x189e16,_0x1af32a){_0x189e16=_0x189e16-0x0;var _0xc870ec=_0xf492[_0x189e16];return _0xc870ec;};'use strict';var multer=require(_0x2f49('0x0'));var util=require('util');var path=require(_0x2f49('0x1'));var timeout=require(_0x2f49('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x2f49('0x3'));var interaction=require(_0x2f49('0x4'));var config=require(_0x2f49('0x5'));var controller=require(_0x2f49('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2f49('0x7')]('/describe',auth[_0x2f49('0x8')](),controller[_0x2f49('0x9')]);router['get'](_0x2f49('0xa'),auth['isAuthenticated'](),controller[_0x2f49('0xb')]);router[_0x2f49('0x7')]('/:id/download',auth[_0x2f49('0x8')](),controller[_0x2f49('0xc')]);router['post']('/',auth[_0x2f49('0x8')](),interaction[_0x2f49('0xd')](_0x2f49('0xe'),_0x2f49('0xf')),controller['create']);router[_0x2f49('0x10')](_0x2f49('0xa'),auth[_0x2f49('0x8')](),controller['update']);router['put']('/:id/accept',auth[_0x2f49('0x8')](),controller[_0x2f49('0x11')]);router[_0x2f49('0x10')](_0x2f49('0x12'),auth[_0x2f49('0x8')](),controller[_0x2f49('0x13')]);router[_0x2f49('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x2f49('0x15')]);module[_0x2f49('0x16')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 41fe78d..fb0eb31 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 _0x5c4c=['beepall','roundrobin','exports','name','STRING','INTEGER','ENUM'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5c4c,0x95));var _0xc5c4=function(_0x302084,_0x5caee5){_0x302084=_0x302084-0x0;var _0xfbe105=_0x5c4c[_0x302084];return _0xfbe105;};'use strict';var Sequelize=require('sequelize');module[_0xc5c4('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xc5c4('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc5c4('0x2')]},'timeout':{'type':Sequelize[_0xc5c4('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc5c4('0x4')]('rrmemory',_0xc5c4('0x5'),_0xc5c4('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xc5c4('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2b39=['ENUM','rrmemory','roundrobin','INTEGER','sequelize','exports','STRING','name'];(function(_0x5e786d,_0x5ddc59){var _0x5536f6=function(_0x21dcf9){while(--_0x21dcf9){_0x5e786d['push'](_0x5e786d['shift']());}};_0x5536f6(++_0x5ddc59);}(_0x2b39,0x11c));var _0x92b3=function(_0x366961,_0x3a976d){_0x366961=_0x366961-0x0;var _0x24d566=_0x2b39[_0x366961];return _0x24d566;};'use strict';var Sequelize=require(_0x92b3('0x0'));module[_0x92b3('0x1')]={'name':{'type':Sequelize[_0x92b3('0x2')],'unique':_0x92b3('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x92b3('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x92b3('0x4')](_0x92b3('0x5'),'beepall',_0x92b3('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x92b3('0x7')],'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 50f7ff0..f4f17b5 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 _0xc0a6=['VIRTUAL','FaxQueue','includeAll','include','rows','catch','show','params','options','find','create','body','user','role','UserProfileSection','autoAssociation','UserProfileResource','update','describe','findOne','UserFaxQueue','findAll','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','transaction','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','TeamId','includes','all','compact','value','isEmpty','removeAgents','addAgents','spread','userFaxQueue:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','json','count','offset','set','reject','save','then','destroy','get','FaxQueues','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge'];(function(_0x227bef,_0x4cbe42){var _0x4f9e8b=function(_0x508bb2){while(--_0x508bb2){_0x227bef['push'](_0x227bef['shift']());}};_0x4f9e8b(++_0x4cbe42);}(_0xc0a6,0xcb));var _0x6c0a=function(_0x34d121,_0x4bffcc){_0x34d121=_0x34d121-0x0;var _0xc18d42=_0xc0a6[_0x34d121];return _0xc18d42;};'use strict';var pdf=require(_0x6c0a('0x0'));var emlformat=require(_0x6c0a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6c0a('0x2'));var jsonpatch=require(_0x6c0a('0x3'));var rp=require(_0x6c0a('0x4'));var moment=require(_0x6c0a('0x5'));var BPromise=require(_0x6c0a('0x6'));var Mustache=require(_0x6c0a('0x7'));var util=require(_0x6c0a('0x8'));var path=require(_0x6c0a('0x9'));var sox=require('sox');var csv=require(_0x6c0a('0xa'));var ejs=require(_0x6c0a('0xb'));var fs=require('fs');var _=require(_0x6c0a('0xc'));var squel=require(_0x6c0a('0xd'));var crypto=require('crypto');var jsforce=require(_0x6c0a('0xe'));var deskjs=require(_0x6c0a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6c0a('0x10'));var Papa=require('papaparse');var Redis=require(_0x6c0a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c0a('0x12'))('api');var utils=require(_0x6c0a('0x13'));var config=require(_0x6c0a('0x14'));var db=require(_0x6c0a('0x15'))['db'];config['redis']=_[_0x6c0a('0x16')](config[_0x6c0a('0x17')],{'host':_0x6c0a('0x18'),'port':0x18eb});var socket=require(_0x6c0a('0x19'))(new Redis(config[_0x6c0a('0x17')]));require(_0x6c0a('0x1a'))['register'](socket);function respondWithStatusCode(_0xa29638,_0x25db3e){_0x25db3e=_0x25db3e||0xcc;return function(_0x1df2c5){if(_0x1df2c5){return _0xa29638[_0x6c0a('0x1b')](_0x25db3e);}return _0xa29638[_0x6c0a('0x1c')](_0x25db3e)[_0x6c0a('0x1d')]();};}function respondWithResult(_0x3ac03a,_0x1aea9e){_0x1aea9e=_0x1aea9e||0xc8;return function(_0x38de86){if(_0x38de86){return _0x3ac03a[_0x6c0a('0x1c')](_0x1aea9e)[_0x6c0a('0x1e')](_0x38de86);}};}function respondWithFilteredResult(_0xa85779,_0x4d3831){return function(_0x44933a){if(_0x44933a){var _0x373988=_0x44933a[_0x6c0a('0x1f')],_0x394b67=_0x4d3831[_0x6c0a('0x20')],_0x3038d8=_0x4d3831[_0x6c0a('0x20')]+_0x4d3831['limit'],_0x20c261;if(_0x3038d8>=_0x373988){_0x3038d8=_0x373988;_0x20c261=0xc8;}else{_0x20c261=0xce;}_0xa85779[_0x6c0a('0x1c')](_0x20c261);return _0xa85779[_0x6c0a('0x21')]('Content-Range',_0x394b67+'-'+_0x3038d8+'/'+_0x373988)['json'](_0x44933a);}return null;};}function patchUpdates(_0xe4d2bd){return function(_0x139b09){try{jsonpatch['apply'](_0x139b09,_0xe4d2bd,!![]);}catch(_0x49abf1){return BPromise[_0x6c0a('0x22')](_0x49abf1);}return _0x139b09[_0x6c0a('0x23')]();};}function saveUpdates(_0x3c385b,_0x166f0a){return function(_0x549174){if(_0x549174){return _0x549174['update'](_0x3c385b)[_0x6c0a('0x24')](function(_0x57e253){return _0x57e253;});}return null;};}function removeEntity(_0x307fbb,_0x8d64d7){return function(_0x32c21d){if(_0x32c21d){return _0x32c21d[_0x6c0a('0x25')]()[_0x6c0a('0x24')](function(){var _0xb291d=_0x32c21d[_0x6c0a('0x26')]({'plain':!![]});var _0x12b6e0=_0x6c0a('0x27');return db['UserProfileResource'][_0x6c0a('0x25')]({'where':{'type':_0x12b6e0,'resourceId':_0xb291d['id']}})[_0x6c0a('0x24')](function(){return _0x32c21d;});})[_0x6c0a('0x24')](function(){_0x307fbb[_0x6c0a('0x1c')](0xcc)[_0x6c0a('0x1d')]();});}};}function handleEntityNotFound(_0x22d47b,_0x3b27be){return function(_0x35283c){if(!_0x35283c){_0x22d47b[_0x6c0a('0x1b')](0x194);}return _0x35283c;};}function handleError(_0x29a037,_0x1695c5){_0x1695c5=_0x1695c5||0x1f4;return function(_0x1aee5c){logger[_0x6c0a('0x28')](_0x1aee5c[_0x6c0a('0x29')]);if(_0x1aee5c[_0x6c0a('0x2a')]){delete _0x1aee5c['name'];}_0x29a037['status'](_0x1695c5)['send'](_0x1aee5c);};}exports[_0x6c0a('0x2b')]=function(_0x261a01,_0x3711b0){var _0x4c5b27={},_0x4a758f={},_0xc57a79={'count':0x0,'rows':[]};var _0x3ecda9=_[_0x6c0a('0x2c')](db['FaxQueue'][_0x6c0a('0x2d')],function(_0x1f2ecd){return{'name':_0x1f2ecd['fieldName'],'type':_0x1f2ecd[_0x6c0a('0x2e')][_0x6c0a('0x2f')]};});_0x4a758f[_0x6c0a('0x30')]=_[_0x6c0a('0x2c')](_0x3ecda9,_0x6c0a('0x2a'));_0x4a758f[_0x6c0a('0x31')]=_[_0x6c0a('0x32')](_0x261a01[_0x6c0a('0x31')]);_0x4a758f[_0x6c0a('0x33')]=_[_0x6c0a('0x34')](_0x4a758f[_0x6c0a('0x30')],_0x4a758f['query']);_0x4c5b27[_0x6c0a('0x35')]=_[_0x6c0a('0x34')](_0x4a758f[_0x6c0a('0x30')],qs[_0x6c0a('0x36')](_0x261a01[_0x6c0a('0x31')][_0x6c0a('0x36')]));_0x4c5b27[_0x6c0a('0x35')]=_0x4c5b27[_0x6c0a('0x35')][_0x6c0a('0x37')]?_0x4c5b27[_0x6c0a('0x35')]:_0x4a758f[_0x6c0a('0x30')];if(!_0x261a01[_0x6c0a('0x31')][_0x6c0a('0x38')](_0x6c0a('0x39'))){_0x4c5b27[_0x6c0a('0x3a')]=qs[_0x6c0a('0x3a')](_0x261a01[_0x6c0a('0x31')]['limit']);_0x4c5b27['offset']=qs[_0x6c0a('0x20')](_0x261a01[_0x6c0a('0x31')][_0x6c0a('0x20')]);}_0x4c5b27[_0x6c0a('0x3b')]=qs[_0x6c0a('0x3c')](_0x261a01['query'][_0x6c0a('0x3c')]);_0x4c5b27[_0x6c0a('0x3d')]=qs[_0x6c0a('0x33')](_[_0x6c0a('0x3e')](_0x261a01['query'],_0x4a758f['filters']),_0x3ecda9);if(_0x261a01[_0x6c0a('0x31')][_0x6c0a('0x3f')]){_0x4c5b27[_0x6c0a('0x3d')]=_[_0x6c0a('0x40')](_0x4c5b27[_0x6c0a('0x3d')],{'$or':_[_0x6c0a('0x2c')](_0x3ecda9,function(_0x42e492){if(_0x42e492[_0x6c0a('0x2e')]!==_0x6c0a('0x41')){var _0x45d6fe={};_0x45d6fe[_0x42e492[_0x6c0a('0x2a')]]={'$like':'%'+_0x261a01[_0x6c0a('0x31')][_0x6c0a('0x3f')]+'%'};return _0x45d6fe;}})});}_0x4c5b27=_[_0x6c0a('0x40')]({},_0x4c5b27,_0x261a01['options']);var _0xed26e3={'where':_0x4c5b27[_0x6c0a('0x3d')]};return db[_0x6c0a('0x42')][_0x6c0a('0x1f')](_0xed26e3)['then'](function(_0x52a326){_0xc57a79['count']=_0x52a326;if(_0x261a01[_0x6c0a('0x31')][_0x6c0a('0x43')]){_0x4c5b27[_0x6c0a('0x44')]=[{'all':!![]}];}return db[_0x6c0a('0x42')]['findAll'](_0x4c5b27);})[_0x6c0a('0x24')](function(_0x2eb800){_0xc57a79[_0x6c0a('0x45')]=_0x2eb800;return _0xc57a79;})[_0x6c0a('0x24')](respondWithFilteredResult(_0x3711b0,_0x4c5b27))[_0x6c0a('0x46')](handleError(_0x3711b0,null));};exports[_0x6c0a('0x47')]=function(_0xd91458,_0x4e64bf){var _0x22c42c={'raw':!![],'where':{'id':_0xd91458[_0x6c0a('0x48')]['id']}},_0x3e5e3b={};_0x3e5e3b[_0x6c0a('0x30')]=_[_0x6c0a('0x32')](db[_0x6c0a('0x42')][_0x6c0a('0x2d')]);_0x3e5e3b['query']=_[_0x6c0a('0x32')](_0xd91458[_0x6c0a('0x31')]);_0x3e5e3b[_0x6c0a('0x33')]=_['intersection'](_0x3e5e3b[_0x6c0a('0x30')],_0x3e5e3b[_0x6c0a('0x31')]);_0x22c42c[_0x6c0a('0x35')]=_[_0x6c0a('0x34')](_0x3e5e3b[_0x6c0a('0x30')],qs[_0x6c0a('0x36')](_0xd91458[_0x6c0a('0x31')]['fields']));_0x22c42c['attributes']=_0x22c42c[_0x6c0a('0x35')][_0x6c0a('0x37')]?_0x22c42c[_0x6c0a('0x35')]:_0x3e5e3b[_0x6c0a('0x30')];if(_0xd91458['query'][_0x6c0a('0x43')]){_0x22c42c[_0x6c0a('0x44')]=[{'all':!![]}];}_0x22c42c=_[_0x6c0a('0x40')]({},_0x22c42c,_0xd91458[_0x6c0a('0x49')]);return db[_0x6c0a('0x42')][_0x6c0a('0x4a')](_0x22c42c)[_0x6c0a('0x24')](handleEntityNotFound(_0x4e64bf,null))[_0x6c0a('0x24')](respondWithResult(_0x4e64bf,null))[_0x6c0a('0x46')](handleError(_0x4e64bf,null));};exports[_0x6c0a('0x4b')]=function(_0x5b681d,_0x339f92){return db[_0x6c0a('0x42')][_0x6c0a('0x4b')](_0x5b681d[_0x6c0a('0x4c')],{})[_0x6c0a('0x24')](function(_0x44fec9){var _0x1444f0=_0x5b681d[_0x6c0a('0x4d')][_0x6c0a('0x26')]({'plain':!![]});if(!_0x1444f0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1444f0[_0x6c0a('0x4e')]===_0x6c0a('0x4d')){var _0x46c3ad=_0x44fec9['get']({'plain':!![]});var _0x211a16=_0x6c0a('0x27');return db[_0x6c0a('0x4f')][_0x6c0a('0x4a')]({'where':{'name':_0x211a16,'userProfileId':_0x1444f0['userProfileId']},'raw':!![]})[_0x6c0a('0x24')](function(_0xe205f3){if(_0xe205f3&&_0xe205f3[_0x6c0a('0x50')]===0x0){return db[_0x6c0a('0x51')]['create']({'name':_0x46c3ad[_0x6c0a('0x2a')],'resourceId':_0x46c3ad['id'],'type':_0xe205f3[_0x6c0a('0x2a')],'sectionId':_0xe205f3['id']},{})['then'](function(){return _0x44fec9;});}else{return _0x44fec9;}})[_0x6c0a('0x46')](function(_0x5d8df9){logger[_0x6c0a('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d8df9);throw _0x5d8df9;});}return _0x44fec9;})[_0x6c0a('0x24')](respondWithResult(_0x339f92,0xc9))[_0x6c0a('0x46')](handleError(_0x339f92,null));};exports[_0x6c0a('0x52')]=function(_0x5ed23d,_0x54cdcf){if(_0x5ed23d[_0x6c0a('0x4c')]['id']){delete _0x5ed23d[_0x6c0a('0x4c')]['id'];}return db[_0x6c0a('0x42')][_0x6c0a('0x4a')]({'where':{'id':_0x5ed23d[_0x6c0a('0x48')]['id']}})[_0x6c0a('0x24')](handleEntityNotFound(_0x54cdcf,null))[_0x6c0a('0x24')](saveUpdates(_0x5ed23d[_0x6c0a('0x4c')],null))['then'](respondWithResult(_0x54cdcf,null))[_0x6c0a('0x46')](handleError(_0x54cdcf,null));};exports['destroy']=function(_0x58b51f,_0x3657f7){return db[_0x6c0a('0x42')][_0x6c0a('0x4a')]({'where':{'id':_0x58b51f['params']['id']}})[_0x6c0a('0x24')](handleEntityNotFound(_0x3657f7,null))[_0x6c0a('0x24')](removeEntity(_0x3657f7,null))['catch'](handleError(_0x3657f7,null));};exports[_0x6c0a('0x53')]=function(_0x4f22ff,_0x4f0bb2){return db[_0x6c0a('0x42')][_0x6c0a('0x53')]()[_0x6c0a('0x24')](respondWithResult(_0x4f0bb2,null))[_0x6c0a('0x46')](handleError(_0x4f0bb2,null));};exports['getMembers']=function(_0x4d4c37,_0x415743,_0x344133){var _0x1264f4={'raw':!![],'where':{}},_0x4396a3={},_0x243ab8;return db[_0x6c0a('0x42')][_0x6c0a('0x54')]({'where':{'id':_0x4d4c37[_0x6c0a('0x48')]['id']}})['then'](handleEntityNotFound(_0x415743,null))['then'](function(_0xb7c7ca){if(_0xb7c7ca){_0x243ab8=_0xb7c7ca[_0x6c0a('0x26')]({'plain':!![]});_0x4396a3[_0x6c0a('0x30')]=_[_0x6c0a('0x32')](db[_0x6c0a('0x55')]['rawAttributes']);_0x4396a3[_0x6c0a('0x31')]=_[_0x6c0a('0x32')](_0x4d4c37['query']);_0x4396a3[_0x6c0a('0x33')]=_['intersection'](_0x4396a3[_0x6c0a('0x30')],_0x4396a3[_0x6c0a('0x31')]);_0x1264f4[_0x6c0a('0x35')]=_['intersection'](_0x4396a3['model'],qs[_0x6c0a('0x36')](_0x4d4c37[_0x6c0a('0x31')]['fields']));_0x1264f4[_0x6c0a('0x35')]=_0x1264f4[_0x6c0a('0x35')][_0x6c0a('0x37')]?_0x1264f4[_0x6c0a('0x35')]:_0x4396a3[_0x6c0a('0x30')];if(!_0x4d4c37[_0x6c0a('0x31')][_0x6c0a('0x38')](_0x6c0a('0x39'))){_0x1264f4[_0x6c0a('0x3a')]=qs[_0x6c0a('0x3a')](_0x4d4c37['query'][_0x6c0a('0x3a')]);_0x1264f4['offset']=qs[_0x6c0a('0x20')](_0x4d4c37[_0x6c0a('0x31')]['offset']);}_0x1264f4['order']=qs[_0x6c0a('0x3c')](_0x4d4c37['query'][_0x6c0a('0x3c')]);_0x1264f4['where']=qs[_0x6c0a('0x33')](_['pick'](_0x4d4c37[_0x6c0a('0x31')],_0x4396a3[_0x6c0a('0x33')]));_0x1264f4[_0x6c0a('0x3d')]['FaxQueueId']=_0xb7c7ca['id'];if(_0x4d4c37[_0x6c0a('0x31')][_0x6c0a('0x3f')]){_0x1264f4[_0x6c0a('0x3d')]=_[_0x6c0a('0x40')](_0x1264f4[_0x6c0a('0x3d')],{'$or':_['map'](_0x1264f4[_0x6c0a('0x35')],function(_0x51b6b0){var _0x3e3d0d={};_0x3e3d0d[_0x51b6b0]={'$like':'%'+_0x4d4c37[_0x6c0a('0x31')][_0x6c0a('0x3f')]+'%'};return _0x3e3d0d;})});}_0x1264f4=_[_0x6c0a('0x40')]({},_0x1264f4,_0x4d4c37[_0x6c0a('0x49')]);return db[_0x6c0a('0x55')][_0x6c0a('0x56')](_0x1264f4);}})[_0x6c0a('0x24')](function(_0x381710){if(_0x381710){return db[_0x6c0a('0x57')][_0x6c0a('0x58')]({'where':{'id':_[_0x6c0a('0x2c')](_0x381710,_0x6c0a('0x59')),'role':_0x6c0a('0x5a')},'attributes':['id',_0x6c0a('0x2a'),_0x6c0a('0x5b'),_0x6c0a('0x5c'),_0x6c0a('0x5d')]});}})[_0x6c0a('0x24')](function(_0x3c1e03){if(_0x3c1e03){return{'count':_0x3c1e03['count'],'rows':_['map'](_0x3c1e03['rows'],function(_0x46a6dc){return{'membername':_0x46a6dc[_0x6c0a('0x2a')],'UserId':_0x46a6dc['id'],'queue_name':_0x243ab8[_0x6c0a('0x2a')],'FaxQueueId':_0x243ab8['id'],'interface':util[_0x6c0a('0x5e')](_0x6c0a('0x5f'),_0x6c0a('0x60'),_0x46a6dc[_0x6c0a('0x2a')]),'penalty':0x0,'paused':_0x46a6dc[_0x6c0a('0x5b')],'createdAt':_0x46a6dc[_0x6c0a('0x5d')],'updatedAt':_0x46a6dc[_0x6c0a('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6c0a('0x24')](respondWithFilteredResult(_0x415743,_0x1264f4))[_0x6c0a('0x46')](handleError(_0x415743,null));};exports[_0x6c0a('0x61')]=function(_0x42c0a6,_0x2aeacc,_0x4450fe){var _0x577523={};var _0xcff018={};var _0x166ec7;var _0x25ce11;return db[_0x6c0a('0x42')]['findOne']({'where':{'id':_0x42c0a6['params']['id']}})[_0x6c0a('0x24')](handleEntityNotFound(_0x2aeacc,null))[_0x6c0a('0x24')](function(_0x23aea9){if(_0x23aea9){_0x166ec7=_0x23aea9;_0xcff018[_0x6c0a('0x30')]=_[_0x6c0a('0x32')](db['Team'][_0x6c0a('0x2d')]);_0xcff018[_0x6c0a('0x31')]=_['keys'](_0x42c0a6[_0x6c0a('0x31')]);_0xcff018[_0x6c0a('0x33')]=_[_0x6c0a('0x34')](_0xcff018[_0x6c0a('0x30')],_0xcff018['query']);_0x577523[_0x6c0a('0x35')]=_[_0x6c0a('0x34')](_0xcff018['model'],qs[_0x6c0a('0x36')](_0x42c0a6['query'][_0x6c0a('0x36')]));_0x577523[_0x6c0a('0x35')]=_0x577523[_0x6c0a('0x35')]['length']?_0x577523['attributes']:_0xcff018[_0x6c0a('0x30')];_0x577523['order']=qs[_0x6c0a('0x3c')](_0x42c0a6[_0x6c0a('0x31')][_0x6c0a('0x3c')]);_0x577523[_0x6c0a('0x3d')]=qs[_0x6c0a('0x33')](_[_0x6c0a('0x3e')](_0x42c0a6['query'],_0xcff018[_0x6c0a('0x33')]));if(_0x42c0a6[_0x6c0a('0x31')][_0x6c0a('0x3f')]){_0x577523[_0x6c0a('0x3d')]=_[_0x6c0a('0x40')](_0x577523[_0x6c0a('0x3d')],{'$or':_[_0x6c0a('0x2c')](_0x577523[_0x6c0a('0x35')],function(_0x4deb6b){var _0x42e67a={};_0x42e67a[_0x4deb6b]={'$like':'%'+_0x42c0a6[_0x6c0a('0x31')]['filter']+'%'};return _0x42e67a;})});}_0x577523=_[_0x6c0a('0x40')]({},_0x577523,_0x42c0a6[_0x6c0a('0x49')]);return _0x166ec7[_0x6c0a('0x61')](_0x577523);}})[_0x6c0a('0x24')](function(_0x2aa6d5){if(_0x2aa6d5){_0x25ce11=_0x2aa6d5[_0x6c0a('0x37')];if(!_0x42c0a6[_0x6c0a('0x31')][_0x6c0a('0x38')](_0x6c0a('0x39'))){_0x577523['limit']=qs[_0x6c0a('0x3a')](_0x42c0a6['query']['limit']);_0x577523[_0x6c0a('0x20')]=qs[_0x6c0a('0x20')](_0x42c0a6[_0x6c0a('0x31')]['offset']);}return _0x166ec7[_0x6c0a('0x61')](_0x577523);}})['then'](function(_0xddc3b){if(_0xddc3b){return _0xddc3b?{'count':_0x25ce11,'rows':_0xddc3b}:null;}})[_0x6c0a('0x24')](respondWithResult(_0x2aeacc,null))[_0x6c0a('0x46')](handleError(_0x2aeacc,null));};exports[_0x6c0a('0x62')]=function(_0x37fbbb,_0x38ab6a,_0x2cf9a6){var _0x3a5e8d=_0x37fbbb[_0x6c0a('0x4c')][_0x6c0a('0x63')];return db[_0x6c0a('0x64')][_0x6c0a('0x56')]({'where':{'id':_0x3a5e8d},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6c0a('0x65'),'attributes':['id',_0x6c0a('0x2a'),_0x6c0a('0x66'),_0x6c0a('0x67'),_0x6c0a('0x68')],'raw':!![]}]})[_0x6c0a('0x24')](function(_0x1bbe66){if(_0x1bbe66){var _0x3b95ee=_[_0x6c0a('0x69')](_0x1bbe66,function(_0x41ca7b){var _0x38b4af=_0x41ca7b[_0x6c0a('0x26')]({'plain':!![]});return _0x38b4af['Agents'];});return db[_0x6c0a('0x42')][_0x6c0a('0x4a')]({'where':{'id':_0x37fbbb[_0x6c0a('0x48')]['id']}})[_0x6c0a('0x24')](function(_0x31aa39){return db['sequelize'][_0x6c0a('0x6a')](function(_0x544ad6){return _0x31aa39[_0x6c0a('0x62')](_0x3a5e8d,{'transaction':_0x544ad6})['then'](function(){return BPromise['each'](_0x3b95ee,function(_0x12088b){return db[_0x6c0a('0x55')][_0x6c0a('0x6b')]({'where':{'UserId':_0x12088b['id'],'FaxQueueId':_0x37fbbb[_0x6c0a('0x48')]['id']},'transaction':_0x544ad6});});})[_0x6c0a('0x24')](function(){_0x3b95ee[_0x6c0a('0x6c')](function(_0x5522cc){socket[_0x6c0a('0x6d')](_0x6c0a('0x6e'),{'UserId':_0x5522cc['id'],'FaxQueueId':_0x31aa39['id']});});});});});}})[_0x6c0a('0x24')](respondWithStatusCode(_0x38ab6a,null))[_0x6c0a('0x46')](handleError(_0x38ab6a,null));};exports[_0x6c0a('0x6f')]=function(_0x10eae2,_0x3e9274,_0x7b6610){return db[_0x6c0a('0x64')][_0x6c0a('0x56')]({'where':{'id':_0x10eae2[_0x6c0a('0x31')][_0x6c0a('0x63')]},'attributes':['id'],'include':[{'model':db[_0x6c0a('0x57')],'as':_0x6c0a('0x65'),'attributes':['id'],'raw':!![]}]})[_0x6c0a('0x24')](handleEntityNotFound(_0x3e9274,null))[_0x6c0a('0x24')](function(_0x30cdc8){var _0x56fd9c=_[_0x6c0a('0x2c')](_0x30cdc8,'id');var _0xeb41b9=[];var _0x1fb421=[];var _0x2dd617=squel[_0x6c0a('0x70')]();_0x2dd617['field']('tq.TeamId')['from'](_0x6c0a('0x71'),'tq')[_0x6c0a('0x72')]('user_has_teams','ut',_0x6c0a('0x73'))[_0x6c0a('0x3d')](_0x6c0a('0x74'),_0x10eae2[_0x6c0a('0x48')]['id']);for(var _0x27b1ec=0x0;_0x27b1ec<_0x30cdc8[_0x6c0a('0x37')];_0x27b1ec+=0x1){let _0x5456c7=_0x30cdc8[_0x27b1ec];for(var _0x361643=0x0;_0x361643<_0x5456c7['Agents'][_0x6c0a('0x37')];_0x361643+=0x1){let _0x1806b9=_0x5456c7[_0x6c0a('0x65')][_0x361643];var _0x9f5099=_0x2dd617[_0x6c0a('0x75')]();_0x9f5099[_0x6c0a('0x3d')](_0x6c0a('0x76'),_0x1806b9['id']);_0x1fb421[_0x6c0a('0x77')](db[_0x6c0a('0x78')][_0x6c0a('0x31')](_0x9f5099[_0x6c0a('0x79')](),{'type':db[_0x6c0a('0x78')]['QueryTypes'][_0x6c0a('0x7a')]})[_0x6c0a('0x24')](function(_0x5001e7){if(_0x5001e7['length']===0x1){return _0x1806b9['id'];}else{var _0x16451b=_['every'](_[_0x6c0a('0x2c')](_0x5001e7,_0x6c0a('0x7b')),function(_0x267319){return _[_0x6c0a('0x7c')](_0x56fd9c,_0x267319);});if(_0x16451b){return _0x1806b9['id'];}}}));}}return BPromise[_0x6c0a('0x7d')](_0x1fb421)[_0x6c0a('0x24')](function(_0x30b7f4){_0xeb41b9=_(_0xeb41b9)['union'](_0x30b7f4)[_0x6c0a('0x7e')]()[_0x6c0a('0x7f')]();return db[_0x6c0a('0x42')][_0x6c0a('0x4a')]({'where':{'id':_0x10eae2[_0x6c0a('0x48')]['id']}})[_0x6c0a('0x24')](function(_0x54aab9){return db[_0x6c0a('0x78')][_0x6c0a('0x6a')](function(_0x2bb39f){return _0x54aab9[_0x6c0a('0x6f')](_0x10eae2[_0x6c0a('0x31')][_0x6c0a('0x63')],{'transaction':_0x2bb39f})[_0x6c0a('0x24')](function(){if(!_[_0x6c0a('0x80')](_0xeb41b9)){return _0x54aab9[_0x6c0a('0x81')](_0xeb41b9,{'transaction':_0x2bb39f});}})[_0x6c0a('0x24')](function(){_0xeb41b9[_0x6c0a('0x6c')](function(_0x3f04e6){socket[_0x6c0a('0x6d')]('userFaxQueue:remove',{'UserId':_0x3f04e6,'FaxQueueId':_0x54aab9['id']});});});});});});})[_0x6c0a('0x24')](respondWithStatusCode(_0x3e9274,null))[_0x6c0a('0x46')](handleError(_0x3e9274,null));};exports[_0x6c0a('0x82')]=function(_0x22dbd9,_0x5426b5,_0x2df8fb){return db[_0x6c0a('0x42')][_0x6c0a('0x4a')]({'where':{'id':_0x22dbd9[_0x6c0a('0x48')]['id']}})[_0x6c0a('0x24')](handleEntityNotFound(_0x5426b5,null))[_0x6c0a('0x24')](function(_0x11b414){if(_0x11b414){return _0x11b414[_0x6c0a('0x82')](_0x22dbd9[_0x6c0a('0x4c')][_0x6c0a('0x63')],_['omit'](_0x22dbd9[_0x6c0a('0x4c')],['ids','id'])||{})[_0x6c0a('0x83')](function(_0x5906de){for(var _0xe59e5e=0x0;_0xe59e5e<_0x22dbd9[_0x6c0a('0x4c')][_0x6c0a('0x63')]['length'];_0xe59e5e+=0x1){socket['emit']('userFaxQueue:save',{'UserId':_0x22dbd9[_0x6c0a('0x4c')][_0x6c0a('0x63')][_0xe59e5e],'FaxQueueId':_0x22dbd9['params']['id']});}return _0x5906de;});}})[_0x6c0a('0x24')](respondWithResult(_0x5426b5,null))[_0x6c0a('0x46')](handleError(_0x5426b5,null));};exports['removeAgents']=function(_0x5d3d93,_0x3d97da,_0x51ffe4){return db[_0x6c0a('0x42')][_0x6c0a('0x4a')]({'where':{'id':_0x5d3d93[_0x6c0a('0x48')]['id']}})[_0x6c0a('0x24')](handleEntityNotFound(_0x3d97da,null))[_0x6c0a('0x24')](function(_0x2d5f54){if(_0x2d5f54){return _0x2d5f54[_0x6c0a('0x81')](_0x5d3d93[_0x6c0a('0x31')]['ids'])['then'](function(){if(_['isArray'](_0x5d3d93[_0x6c0a('0x31')]['ids'])){for(var _0x11e427=0x0;_0x11e427<_0x5d3d93[_0x6c0a('0x31')][_0x6c0a('0x63')][_0x6c0a('0x37')];_0x11e427+=0x1){socket[_0x6c0a('0x6d')](_0x6c0a('0x84'),{'UserId':Number(_0x5d3d93['query']['ids'][_0x11e427]),'FaxQueueId':Number(_0x5d3d93['params']['id'])});}}else{socket[_0x6c0a('0x6d')](_0x6c0a('0x84'),{'UserId':Number(_0x5d3d93['query'][_0x6c0a('0x63')]),'FaxQueueId':Number(_0x5d3d93[_0x6c0a('0x48')]['id'])});}});}})[_0x6c0a('0x24')](respondWithStatusCode(_0x3d97da,null))[_0x6c0a('0x46')](handleError(_0x3d97da,null));};exports['getAgents']=function(_0x189b2b,_0x2d6076,_0x17c313){var _0x1e5717={};var _0x458330={};var _0x4304b6;var _0x4ccf38;return db[_0x6c0a('0x42')][_0x6c0a('0x54')]({'where':{'id':_0x189b2b[_0x6c0a('0x48')]['id']}})[_0x6c0a('0x24')](handleEntityNotFound(_0x2d6076,null))[_0x6c0a('0x24')](function(_0x4f3c54){if(_0x4f3c54){_0x4304b6=_0x4f3c54;_0x458330[_0x6c0a('0x30')]=_[_0x6c0a('0x32')](db[_0x6c0a('0x57')][_0x6c0a('0x2d')]);_0x458330[_0x6c0a('0x31')]=_[_0x6c0a('0x32')](_0x189b2b[_0x6c0a('0x31')]);_0x458330['filters']=_['intersection'](_0x458330[_0x6c0a('0x30')],_0x458330[_0x6c0a('0x31')]);_0x1e5717[_0x6c0a('0x35')]=_['intersection'](_0x458330[_0x6c0a('0x30')],qs[_0x6c0a('0x36')](_0x189b2b['query'][_0x6c0a('0x36')]));_0x1e5717['attributes']=_0x1e5717[_0x6c0a('0x35')][_0x6c0a('0x37')]?_0x1e5717['attributes']:_0x458330[_0x6c0a('0x30')];_0x1e5717[_0x6c0a('0x3b')]=qs[_0x6c0a('0x3c')](_0x189b2b[_0x6c0a('0x31')][_0x6c0a('0x3c')]);_0x1e5717[_0x6c0a('0x3d')]=qs[_0x6c0a('0x33')](_['pick'](_0x189b2b[_0x6c0a('0x31')],_0x458330[_0x6c0a('0x33')]));if(_0x189b2b[_0x6c0a('0x31')]['filter']){_0x1e5717[_0x6c0a('0x3d')]=_['merge'](_0x1e5717['where'],{'$or':_[_0x6c0a('0x2c')](_0x1e5717[_0x6c0a('0x35')],function(_0x27f5c8){var _0x26f393={};_0x26f393[_0x27f5c8]={'$like':'%'+_0x189b2b[_0x6c0a('0x31')][_0x6c0a('0x3f')]+'%'};return _0x26f393;})});}_0x1e5717=_['merge']({},_0x1e5717,_0x189b2b[_0x6c0a('0x49')]);return _0x4304b6['getAgents'](_0x1e5717);}})[_0x6c0a('0x24')](function(_0x3cdc6b){if(_0x3cdc6b){_0x4ccf38=_0x3cdc6b[_0x6c0a('0x37')];if(!_0x189b2b[_0x6c0a('0x31')]['hasOwnProperty']('nolimit')){_0x1e5717[_0x6c0a('0x3a')]=qs[_0x6c0a('0x3a')](_0x189b2b[_0x6c0a('0x31')]['limit']);_0x1e5717[_0x6c0a('0x20')]=qs[_0x6c0a('0x20')](_0x189b2b[_0x6c0a('0x31')][_0x6c0a('0x20')]);}return _0x4304b6[_0x6c0a('0x85')](_0x1e5717);}})[_0x6c0a('0x24')](function(_0x44a6e4){if(_0x44a6e4){return _0x44a6e4?{'count':_0x4ccf38,'rows':_0x44a6e4}:null;}})[_0x6c0a('0x24')](respondWithResult(_0x2d6076,null))[_0x6c0a('0x46')](handleError(_0x2d6076,null));}; \ No newline at end of file +var _0x1184=['pick','addTeams','ids','findAll','User','Agents','online','flatMap','sequelize','transaction','findOrCreate','emit','userFaxQueue:save','field','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','toString','QueryTypes','SELECT','TeamId','includes','union','compact','removeTeams','isEmpty','removeAgents','forEach','addAgents','userFaxQueue:remove','getAgents','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','defaults','socket.io-emitter','redis','./faxQueue.socket','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','get','FaxQueues','destroy','end','error','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','catch','show','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','findOne','UserFaxQueue','hasOwnProperty','FaxQueueId','findAndCountAll','UserId','faxPause','updatedAt','createdAt','format','%s/%s','getTeams','Team'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1184,0xa0));var _0x4118=function(_0x25d6cc,_0x28228d){_0x25d6cc=_0x25d6cc-0x0;var _0x2e8731=_0x1184[_0x25d6cc];return _0x2e8731;};'use strict';var pdf=require(_0x4118('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4118('0x1'));var zipdir=require(_0x4118('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4118('0x3'));var moment=require(_0x4118('0x4'));var BPromise=require(_0x4118('0x5'));var Mustache=require(_0x4118('0x6'));var util=require('util');var path=require(_0x4118('0x7'));var sox=require(_0x4118('0x8'));var csv=require(_0x4118('0x9'));var ejs=require(_0x4118('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4118('0xb'));var crypto=require(_0x4118('0xc'));var jsforce=require(_0x4118('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4118('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4118('0xf'));var qs=require(_0x4118('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4118('0x11'));var utils=require('../../config/utils');var config=require(_0x4118('0x12'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4118('0x13')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4118('0x14'))(new Redis(config[_0x4118('0x15')]));require(_0x4118('0x16'))['register'](socket);function respondWithStatusCode(_0x292086,_0xc9fee9){_0xc9fee9=_0xc9fee9||0xcc;return function(_0x3c077d){if(_0x3c077d){return _0x292086['sendStatus'](_0xc9fee9);}return _0x292086[_0x4118('0x17')](_0xc9fee9)['end']();};}function respondWithResult(_0x18d135,_0x45ec56){_0x45ec56=_0x45ec56||0xc8;return function(_0x38189b){if(_0x38189b){return _0x18d135['status'](_0x45ec56)[_0x4118('0x18')](_0x38189b);}};}function respondWithFilteredResult(_0x458887,_0x33eb6d){return function(_0xa88d23){if(_0xa88d23){var _0x1fb629=_0xa88d23[_0x4118('0x19')],_0x49ee6d=_0x33eb6d[_0x4118('0x1a')],_0x2d48ec=_0x33eb6d[_0x4118('0x1a')]+_0x33eb6d['limit'],_0x2c3e5c;if(_0x2d48ec>=_0x1fb629){_0x2d48ec=_0x1fb629;_0x2c3e5c=0xc8;}else{_0x2c3e5c=0xce;}_0x458887[_0x4118('0x17')](_0x2c3e5c);return _0x458887[_0x4118('0x1b')](_0x4118('0x1c'),_0x49ee6d+'-'+_0x2d48ec+'/'+_0x1fb629)['json'](_0xa88d23);}return null;};}function patchUpdates(_0x34c62f){return function(_0x2c19c9){try{jsonpatch[_0x4118('0x1d')](_0x2c19c9,_0x34c62f,!![]);}catch(_0xe0329b){return BPromise[_0x4118('0x1e')](_0xe0329b);}return _0x2c19c9[_0x4118('0x1f')]();};}function saveUpdates(_0x5dc4a7,_0x70906e){return function(_0x29ec36){if(_0x29ec36){return _0x29ec36[_0x4118('0x20')](_0x5dc4a7)[_0x4118('0x21')](function(_0xa6c615){return _0xa6c615;});}return null;};}function removeEntity(_0x4b49b0,_0x4af9c5){return function(_0x4e69f4){if(_0x4e69f4){return _0x4e69f4['destroy']()['then'](function(){var _0x20c3d0=_0x4e69f4[_0x4118('0x22')]({'plain':!![]});var _0x1cf952=_0x4118('0x23');return db['UserProfileResource'][_0x4118('0x24')]({'where':{'type':_0x1cf952,'resourceId':_0x20c3d0['id']}})['then'](function(){return _0x4e69f4;});})[_0x4118('0x21')](function(){_0x4b49b0[_0x4118('0x17')](0xcc)[_0x4118('0x25')]();});}};}function handleEntityNotFound(_0x2773b2,_0x35d809){return function(_0x36edea){if(!_0x36edea){_0x2773b2['sendStatus'](0x194);}return _0x36edea;};}function handleError(_0x138df2,_0x170a67){_0x170a67=_0x170a67||0x1f4;return function(_0x34507e){logger[_0x4118('0x26')](_0x34507e['stack']);if(_0x34507e['name']){delete _0x34507e[_0x4118('0x27')];}_0x138df2[_0x4118('0x17')](_0x170a67)[_0x4118('0x28')](_0x34507e);};}exports[_0x4118('0x29')]=function(_0x132e76,_0x5949c5){var _0x5f115e={},_0x2462d1={},_0x36f0c5={'count':0x0,'rows':[]};var _0x478598=_[_0x4118('0x2a')](db[_0x4118('0x2b')][_0x4118('0x2c')],function(_0x194dfa){return{'name':_0x194dfa[_0x4118('0x2d')],'type':_0x194dfa[_0x4118('0x2e')][_0x4118('0x2f')]};});_0x2462d1[_0x4118('0x30')]=_[_0x4118('0x2a')](_0x478598,_0x4118('0x27'));_0x2462d1[_0x4118('0x31')]=_[_0x4118('0x32')](_0x132e76[_0x4118('0x31')]);_0x2462d1[_0x4118('0x33')]=_[_0x4118('0x34')](_0x2462d1[_0x4118('0x30')],_0x2462d1['query']);_0x5f115e[_0x4118('0x35')]=_[_0x4118('0x34')](_0x2462d1[_0x4118('0x30')],qs[_0x4118('0x36')](_0x132e76[_0x4118('0x31')][_0x4118('0x36')]));_0x5f115e['attributes']=_0x5f115e[_0x4118('0x35')]['length']?_0x5f115e['attributes']:_0x2462d1[_0x4118('0x30')];if(!_0x132e76[_0x4118('0x31')]['hasOwnProperty'](_0x4118('0x37'))){_0x5f115e[_0x4118('0x38')]=qs[_0x4118('0x38')](_0x132e76['query'][_0x4118('0x38')]);_0x5f115e[_0x4118('0x1a')]=qs[_0x4118('0x1a')](_0x132e76['query']['offset']);}_0x5f115e[_0x4118('0x39')]=qs[_0x4118('0x3a')](_0x132e76[_0x4118('0x31')][_0x4118('0x3a')]);_0x5f115e[_0x4118('0x3b')]=qs[_0x4118('0x33')](_['pick'](_0x132e76[_0x4118('0x31')],_0x2462d1['filters']),_0x478598);if(_0x132e76['query'][_0x4118('0x3c')]){_0x5f115e['where']=_[_0x4118('0x3d')](_0x5f115e[_0x4118('0x3b')],{'$or':_[_0x4118('0x2a')](_0x478598,function(_0x509f1c){if(_0x509f1c[_0x4118('0x2e')]!==_0x4118('0x3e')){var _0x33db2c={};_0x33db2c[_0x509f1c[_0x4118('0x27')]]={'$like':'%'+_0x132e76[_0x4118('0x31')][_0x4118('0x3c')]+'%'};return _0x33db2c;}})});}_0x5f115e=_[_0x4118('0x3d')]({},_0x5f115e,_0x132e76[_0x4118('0x3f')]);var _0x485d0c={'where':_0x5f115e[_0x4118('0x3b')]};return db[_0x4118('0x2b')][_0x4118('0x19')](_0x485d0c)[_0x4118('0x21')](function(_0x25252c){_0x36f0c5[_0x4118('0x19')]=_0x25252c;if(_0x132e76[_0x4118('0x31')][_0x4118('0x40')]){_0x5f115e['include']=[{'all':!![]}];}return db[_0x4118('0x2b')]['findAll'](_0x5f115e);})[_0x4118('0x21')](function(_0x10cc8d){_0x36f0c5['rows']=_0x10cc8d;return _0x36f0c5;})['then'](respondWithFilteredResult(_0x5949c5,_0x5f115e))[_0x4118('0x41')](handleError(_0x5949c5,null));};exports[_0x4118('0x42')]=function(_0x3c929f,_0x2b24ac){var _0x5e72a1={'raw':!![],'where':{'id':_0x3c929f['params']['id']}},_0x47b72d={};_0x47b72d['model']=_[_0x4118('0x32')](db['FaxQueue'][_0x4118('0x2c')]);_0x47b72d[_0x4118('0x31')]=_[_0x4118('0x32')](_0x3c929f[_0x4118('0x31')]);_0x47b72d[_0x4118('0x33')]=_[_0x4118('0x34')](_0x47b72d['model'],_0x47b72d[_0x4118('0x31')]);_0x5e72a1[_0x4118('0x35')]=_[_0x4118('0x34')](_0x47b72d[_0x4118('0x30')],qs[_0x4118('0x36')](_0x3c929f[_0x4118('0x31')]['fields']));_0x5e72a1['attributes']=_0x5e72a1['attributes'][_0x4118('0x43')]?_0x5e72a1[_0x4118('0x35')]:_0x47b72d['model'];if(_0x3c929f[_0x4118('0x31')][_0x4118('0x40')]){_0x5e72a1[_0x4118('0x44')]=[{'all':!![]}];}_0x5e72a1=_[_0x4118('0x3d')]({},_0x5e72a1,_0x3c929f['options']);return db[_0x4118('0x2b')][_0x4118('0x45')](_0x5e72a1)[_0x4118('0x21')](handleEntityNotFound(_0x2b24ac,null))[_0x4118('0x21')](respondWithResult(_0x2b24ac,null))[_0x4118('0x41')](handleError(_0x2b24ac,null));};exports[_0x4118('0x46')]=function(_0x4421d6,_0x113f6d){return db[_0x4118('0x2b')][_0x4118('0x46')](_0x4421d6[_0x4118('0x47')],{})['then'](function(_0x5970e1){var _0x4a974b=_0x4421d6[_0x4118('0x48')][_0x4118('0x22')]({'plain':!![]});if(!_0x4a974b)throw new Error(_0x4118('0x49'));if(_0x4a974b[_0x4118('0x4a')]==='user'){var _0x1059f5=_0x5970e1[_0x4118('0x22')]({'plain':!![]});var _0x35254b=_0x4118('0x23');return db[_0x4118('0x4b')][_0x4118('0x45')]({'where':{'name':_0x35254b,'userProfileId':_0x4a974b[_0x4118('0x4c')]},'raw':!![]})[_0x4118('0x21')](function(_0x3f4dd7){if(_0x3f4dd7&&_0x3f4dd7[_0x4118('0x4d')]===0x0){return db[_0x4118('0x4e')]['create']({'name':_0x1059f5[_0x4118('0x27')],'resourceId':_0x1059f5['id'],'type':_0x3f4dd7[_0x4118('0x27')],'sectionId':_0x3f4dd7['id']},{})['then'](function(){return _0x5970e1;});}else{return _0x5970e1;}})[_0x4118('0x41')](function(_0x5e6b09){logger['error'](_0x4118('0x4f'),_0x5e6b09);throw _0x5e6b09;});}return _0x5970e1;})[_0x4118('0x21')](respondWithResult(_0x113f6d,0xc9))[_0x4118('0x41')](handleError(_0x113f6d,null));};exports['update']=function(_0x2e195c,_0x5377a8){if(_0x2e195c['body']['id']){delete _0x2e195c[_0x4118('0x47')]['id'];}return db['FaxQueue'][_0x4118('0x45')]({'where':{'id':_0x2e195c[_0x4118('0x50')]['id']}})[_0x4118('0x21')](handleEntityNotFound(_0x5377a8,null))['then'](saveUpdates(_0x2e195c[_0x4118('0x47')],null))['then'](respondWithResult(_0x5377a8,null))[_0x4118('0x41')](handleError(_0x5377a8,null));};exports['destroy']=function(_0x1c8ca3,_0x41a694){return db[_0x4118('0x2b')][_0x4118('0x45')]({'where':{'id':_0x1c8ca3[_0x4118('0x50')]['id']}})[_0x4118('0x21')](handleEntityNotFound(_0x41a694,null))[_0x4118('0x21')](removeEntity(_0x41a694,null))[_0x4118('0x41')](handleError(_0x41a694,null));};exports['describe']=function(_0x370cd4,_0x1d3317){return db['FaxQueue']['describe']()[_0x4118('0x21')](respondWithResult(_0x1d3317,null))['catch'](handleError(_0x1d3317,null));};exports['getMembers']=function(_0x5f34aa,_0x3be9e7,_0x52861a){var _0x4b4ed4={'raw':!![],'where':{}},_0xb4df93={},_0x1727a1;return db['FaxQueue'][_0x4118('0x51')]({'where':{'id':_0x5f34aa['params']['id']}})[_0x4118('0x21')](handleEntityNotFound(_0x3be9e7,null))['then'](function(_0x2c4e31){if(_0x2c4e31){_0x1727a1=_0x2c4e31['get']({'plain':!![]});_0xb4df93['model']=_[_0x4118('0x32')](db[_0x4118('0x52')]['rawAttributes']);_0xb4df93['query']=_['keys'](_0x5f34aa[_0x4118('0x31')]);_0xb4df93['filters']=_[_0x4118('0x34')](_0xb4df93[_0x4118('0x30')],_0xb4df93[_0x4118('0x31')]);_0x4b4ed4[_0x4118('0x35')]=_[_0x4118('0x34')](_0xb4df93[_0x4118('0x30')],qs[_0x4118('0x36')](_0x5f34aa[_0x4118('0x31')][_0x4118('0x36')]));_0x4b4ed4[_0x4118('0x35')]=_0x4b4ed4[_0x4118('0x35')][_0x4118('0x43')]?_0x4b4ed4[_0x4118('0x35')]:_0xb4df93[_0x4118('0x30')];if(!_0x5f34aa[_0x4118('0x31')][_0x4118('0x53')](_0x4118('0x37'))){_0x4b4ed4[_0x4118('0x38')]=qs['limit'](_0x5f34aa[_0x4118('0x31')]['limit']);_0x4b4ed4[_0x4118('0x1a')]=qs['offset'](_0x5f34aa[_0x4118('0x31')][_0x4118('0x1a')]);}_0x4b4ed4['order']=qs[_0x4118('0x3a')](_0x5f34aa['query']['sort']);_0x4b4ed4[_0x4118('0x3b')]=qs[_0x4118('0x33')](_['pick'](_0x5f34aa[_0x4118('0x31')],_0xb4df93[_0x4118('0x33')]));_0x4b4ed4[_0x4118('0x3b')][_0x4118('0x54')]=_0x2c4e31['id'];if(_0x5f34aa[_0x4118('0x31')][_0x4118('0x3c')]){_0x4b4ed4[_0x4118('0x3b')]=_['merge'](_0x4b4ed4[_0x4118('0x3b')],{'$or':_['map'](_0x4b4ed4[_0x4118('0x35')],function(_0x409318){var _0x939e05={};_0x939e05[_0x409318]={'$like':'%'+_0x5f34aa[_0x4118('0x31')][_0x4118('0x3c')]+'%'};return _0x939e05;})});}_0x4b4ed4=_[_0x4118('0x3d')]({},_0x4b4ed4,_0x5f34aa[_0x4118('0x3f')]);return db['UserFaxQueue']['findAll'](_0x4b4ed4);}})[_0x4118('0x21')](function(_0x2e31ed){if(_0x2e31ed){return db['User'][_0x4118('0x55')]({'where':{'id':_[_0x4118('0x2a')](_0x2e31ed,_0x4118('0x56')),'role':'agent'},'attributes':['id','name',_0x4118('0x57'),_0x4118('0x58'),_0x4118('0x59')]});}})[_0x4118('0x21')](function(_0x382bcf){if(_0x382bcf){return{'count':_0x382bcf[_0x4118('0x19')],'rows':_[_0x4118('0x2a')](_0x382bcf['rows'],function(_0x34013c){return{'membername':_0x34013c[_0x4118('0x27')],'UserId':_0x34013c['id'],'queue_name':_0x1727a1[_0x4118('0x27')],'FaxQueueId':_0x1727a1['id'],'interface':util[_0x4118('0x5a')](_0x4118('0x5b'),'SIP',_0x34013c[_0x4118('0x27')]),'penalty':0x0,'paused':_0x34013c[_0x4118('0x57')],'createdAt':_0x34013c[_0x4118('0x59')],'updatedAt':_0x34013c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x4118('0x21')](respondWithFilteredResult(_0x3be9e7,_0x4b4ed4))['catch'](handleError(_0x3be9e7,null));};exports[_0x4118('0x5c')]=function(_0x383a9f,_0x459156,_0x4d3736){var _0x35571c={};var _0x5a2b27={};var _0x5e4ede;var _0x16b394;return db[_0x4118('0x2b')][_0x4118('0x51')]({'where':{'id':_0x383a9f[_0x4118('0x50')]['id']}})[_0x4118('0x21')](handleEntityNotFound(_0x459156,null))[_0x4118('0x21')](function(_0x41d036){if(_0x41d036){_0x5e4ede=_0x41d036;_0x5a2b27['model']=_[_0x4118('0x32')](db[_0x4118('0x5d')][_0x4118('0x2c')]);_0x5a2b27[_0x4118('0x31')]=_[_0x4118('0x32')](_0x383a9f[_0x4118('0x31')]);_0x5a2b27[_0x4118('0x33')]=_[_0x4118('0x34')](_0x5a2b27[_0x4118('0x30')],_0x5a2b27[_0x4118('0x31')]);_0x35571c['attributes']=_['intersection'](_0x5a2b27[_0x4118('0x30')],qs[_0x4118('0x36')](_0x383a9f[_0x4118('0x31')][_0x4118('0x36')]));_0x35571c[_0x4118('0x35')]=_0x35571c[_0x4118('0x35')]['length']?_0x35571c['attributes']:_0x5a2b27[_0x4118('0x30')];_0x35571c[_0x4118('0x39')]=qs[_0x4118('0x3a')](_0x383a9f[_0x4118('0x31')][_0x4118('0x3a')]);_0x35571c[_0x4118('0x3b')]=qs[_0x4118('0x33')](_[_0x4118('0x5e')](_0x383a9f['query'],_0x5a2b27['filters']));if(_0x383a9f['query'][_0x4118('0x3c')]){_0x35571c[_0x4118('0x3b')]=_[_0x4118('0x3d')](_0x35571c['where'],{'$or':_[_0x4118('0x2a')](_0x35571c[_0x4118('0x35')],function(_0x5932c1){var _0x2029d6={};_0x2029d6[_0x5932c1]={'$like':'%'+_0x383a9f['query'][_0x4118('0x3c')]+'%'};return _0x2029d6;})});}_0x35571c=_['merge']({},_0x35571c,_0x383a9f[_0x4118('0x3f')]);return _0x5e4ede['getTeams'](_0x35571c);}})['then'](function(_0x4b98bd){if(_0x4b98bd){_0x16b394=_0x4b98bd[_0x4118('0x43')];if(!_0x383a9f[_0x4118('0x31')]['hasOwnProperty'](_0x4118('0x37'))){_0x35571c[_0x4118('0x38')]=qs[_0x4118('0x38')](_0x383a9f[_0x4118('0x31')][_0x4118('0x38')]);_0x35571c[_0x4118('0x1a')]=qs[_0x4118('0x1a')](_0x383a9f[_0x4118('0x31')][_0x4118('0x1a')]);}return _0x5e4ede[_0x4118('0x5c')](_0x35571c);}})[_0x4118('0x21')](function(_0x39cfac){if(_0x39cfac){return _0x39cfac?{'count':_0x16b394,'rows':_0x39cfac}:null;}})[_0x4118('0x21')](respondWithResult(_0x459156,null))[_0x4118('0x41')](handleError(_0x459156,null));};exports[_0x4118('0x5f')]=function(_0x15bc79,_0xffcd9c,_0x4d4bd2){var _0x59f5c7=_0x15bc79[_0x4118('0x47')][_0x4118('0x60')];return db[_0x4118('0x5d')][_0x4118('0x61')]({'where':{'id':_0x59f5c7},'attributes':['id'],'include':[{'model':db[_0x4118('0x62')],'as':_0x4118('0x63'),'attributes':['id',_0x4118('0x27'),_0x4118('0x64'),'voicePause','interface'],'raw':!![]}]})[_0x4118('0x21')](function(_0x2ac388){if(_0x2ac388){var _0x5a08a7=_[_0x4118('0x65')](_0x2ac388,function(_0x58eb99){var _0x4bb857=_0x58eb99[_0x4118('0x22')]({'plain':!![]});return _0x4bb857['Agents'];});return db[_0x4118('0x2b')][_0x4118('0x45')]({'where':{'id':_0x15bc79[_0x4118('0x50')]['id']}})[_0x4118('0x21')](function(_0x29a17c){return db[_0x4118('0x66')][_0x4118('0x67')](function(_0x901b1){return _0x29a17c[_0x4118('0x5f')](_0x59f5c7,{'transaction':_0x901b1})[_0x4118('0x21')](function(){return BPromise['each'](_0x5a08a7,function(_0x47b0a0){return db[_0x4118('0x52')][_0x4118('0x68')]({'where':{'UserId':_0x47b0a0['id'],'FaxQueueId':_0x15bc79['params']['id']},'transaction':_0x901b1});});})['then'](function(){_0x5a08a7['forEach'](function(_0x317cad){socket[_0x4118('0x69')](_0x4118('0x6a'),{'UserId':_0x317cad['id'],'FaxQueueId':_0x29a17c['id']});});});});});}})[_0x4118('0x21')](respondWithStatusCode(_0xffcd9c,null))[_0x4118('0x41')](handleError(_0xffcd9c,null));};exports['removeTeams']=function(_0xdfb630,_0x5c35ef,_0x5e5812){return db['Team'][_0x4118('0x61')]({'where':{'id':_0xdfb630[_0x4118('0x31')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4118('0x62')],'as':_0x4118('0x63'),'attributes':['id'],'raw':!![]}]})[_0x4118('0x21')](handleEntityNotFound(_0x5c35ef,null))[_0x4118('0x21')](function(_0x42c45d){var _0x237886=_[_0x4118('0x2a')](_0x42c45d,'id');var _0x3af3e8=[];var _0x4f8e5f=[];var _0x34be6e=squel['select']();_0x34be6e[_0x4118('0x6b')]('tq.TeamId')[_0x4118('0x6c')](_0x4118('0x6d'),'tq')[_0x4118('0x6e')]('user_has_teams','ut',_0x4118('0x6f'))[_0x4118('0x3b')]('FaxQueueId\x20=\x20?',_0xdfb630[_0x4118('0x50')]['id']);for(var _0x4f7426=0x0;_0x4f7426<_0x42c45d['length'];_0x4f7426+=0x1){let _0x11eb2d=_0x42c45d[_0x4f7426];for(var _0x407c74=0x0;_0x407c74<_0x11eb2d[_0x4118('0x63')][_0x4118('0x43')];_0x407c74+=0x1){let _0x25fa12=_0x11eb2d[_0x4118('0x63')][_0x407c74];var _0x58c464=_0x34be6e[_0x4118('0x70')]();_0x58c464[_0x4118('0x3b')]('ut.UserId\x20=\x20?',_0x25fa12['id']);_0x4f8e5f['push'](db[_0x4118('0x66')][_0x4118('0x31')](_0x58c464[_0x4118('0x71')](),{'type':db[_0x4118('0x66')][_0x4118('0x72')][_0x4118('0x73')]})['then'](function(_0x5f479d){if(_0x5f479d['length']===0x1){return _0x25fa12['id'];}else{var _0x33bad0=_['every'](_['map'](_0x5f479d,_0x4118('0x74')),function(_0x17356d){return _[_0x4118('0x75')](_0x237886,_0x17356d);});if(_0x33bad0){return _0x25fa12['id'];}}}));}}return BPromise['all'](_0x4f8e5f)[_0x4118('0x21')](function(_0x1581b1){_0x3af3e8=_(_0x3af3e8)[_0x4118('0x76')](_0x1581b1)[_0x4118('0x77')]()['value']();return db[_0x4118('0x2b')][_0x4118('0x45')]({'where':{'id':_0xdfb630['params']['id']}})[_0x4118('0x21')](function(_0x4a1b75){return db['sequelize']['transaction'](function(_0xac2f61){return _0x4a1b75[_0x4118('0x78')](_0xdfb630[_0x4118('0x31')][_0x4118('0x60')],{'transaction':_0xac2f61})[_0x4118('0x21')](function(){if(!_[_0x4118('0x79')](_0x3af3e8)){return _0x4a1b75[_0x4118('0x7a')](_0x3af3e8,{'transaction':_0xac2f61});}})[_0x4118('0x21')](function(){_0x3af3e8[_0x4118('0x7b')](function(_0x4b590f){socket[_0x4118('0x69')]('userFaxQueue:remove',{'UserId':_0x4b590f,'FaxQueueId':_0x4a1b75['id']});});});});});});})[_0x4118('0x21')](respondWithStatusCode(_0x5c35ef,null))['catch'](handleError(_0x5c35ef,null));};exports[_0x4118('0x7c')]=function(_0x5dbedd,_0xa3682f,_0x224ca2){return db[_0x4118('0x2b')][_0x4118('0x45')]({'where':{'id':_0x5dbedd[_0x4118('0x50')]['id']}})[_0x4118('0x21')](handleEntityNotFound(_0xa3682f,null))[_0x4118('0x21')](function(_0x4ba3f0){if(_0x4ba3f0){return _0x4ba3f0['addAgents'](_0x5dbedd[_0x4118('0x47')][_0x4118('0x60')],_['omit'](_0x5dbedd[_0x4118('0x47')],[_0x4118('0x60'),'id'])||{})['spread'](function(_0x2174c4){for(var _0x2c48c6=0x0;_0x2c48c6<_0x5dbedd[_0x4118('0x47')][_0x4118('0x60')][_0x4118('0x43')];_0x2c48c6+=0x1){socket[_0x4118('0x69')]('userFaxQueue:save',{'UserId':_0x5dbedd[_0x4118('0x47')][_0x4118('0x60')][_0x2c48c6],'FaxQueueId':_0x5dbedd[_0x4118('0x50')]['id']});}return _0x2174c4;});}})[_0x4118('0x21')](respondWithResult(_0xa3682f,null))['catch'](handleError(_0xa3682f,null));};exports[_0x4118('0x7a')]=function(_0x19f6ab,_0x2c84e6,_0x58ca6d){return db[_0x4118('0x2b')][_0x4118('0x45')]({'where':{'id':_0x19f6ab[_0x4118('0x50')]['id']}})[_0x4118('0x21')](handleEntityNotFound(_0x2c84e6,null))[_0x4118('0x21')](function(_0xe4a39a){if(_0xe4a39a){return _0xe4a39a[_0x4118('0x7a')](_0x19f6ab[_0x4118('0x31')]['ids'])[_0x4118('0x21')](function(){if(_['isArray'](_0x19f6ab[_0x4118('0x31')][_0x4118('0x60')])){for(var _0x4f53e8=0x0;_0x4f53e8<_0x19f6ab[_0x4118('0x31')][_0x4118('0x60')][_0x4118('0x43')];_0x4f53e8+=0x1){socket[_0x4118('0x69')](_0x4118('0x7d'),{'UserId':Number(_0x19f6ab[_0x4118('0x31')][_0x4118('0x60')][_0x4f53e8]),'FaxQueueId':Number(_0x19f6ab[_0x4118('0x50')]['id'])});}}else{socket[_0x4118('0x69')]('userFaxQueue:remove',{'UserId':Number(_0x19f6ab[_0x4118('0x31')][_0x4118('0x60')]),'FaxQueueId':Number(_0x19f6ab[_0x4118('0x50')]['id'])});}});}})[_0x4118('0x21')](respondWithStatusCode(_0x2c84e6,null))[_0x4118('0x41')](handleError(_0x2c84e6,null));};exports[_0x4118('0x7e')]=function(_0x211775,_0x4bab3f,_0x1a7874){var _0x5e1fff={};var _0x1c9b71={};var _0x285a54;var _0x256242;return db['FaxQueue'][_0x4118('0x51')]({'where':{'id':_0x211775[_0x4118('0x50')]['id']}})['then'](handleEntityNotFound(_0x4bab3f,null))[_0x4118('0x21')](function(_0x12a171){if(_0x12a171){_0x285a54=_0x12a171;_0x1c9b71[_0x4118('0x30')]=_[_0x4118('0x32')](db[_0x4118('0x62')][_0x4118('0x2c')]);_0x1c9b71['query']=_[_0x4118('0x32')](_0x211775[_0x4118('0x31')]);_0x1c9b71[_0x4118('0x33')]=_['intersection'](_0x1c9b71['model'],_0x1c9b71[_0x4118('0x31')]);_0x5e1fff['attributes']=_['intersection'](_0x1c9b71[_0x4118('0x30')],qs[_0x4118('0x36')](_0x211775[_0x4118('0x31')]['fields']));_0x5e1fff[_0x4118('0x35')]=_0x5e1fff[_0x4118('0x35')][_0x4118('0x43')]?_0x5e1fff[_0x4118('0x35')]:_0x1c9b71[_0x4118('0x30')];_0x5e1fff['order']=qs[_0x4118('0x3a')](_0x211775[_0x4118('0x31')]['sort']);_0x5e1fff[_0x4118('0x3b')]=qs['filters'](_[_0x4118('0x5e')](_0x211775[_0x4118('0x31')],_0x1c9b71['filters']));if(_0x211775[_0x4118('0x31')][_0x4118('0x3c')]){_0x5e1fff['where']=_[_0x4118('0x3d')](_0x5e1fff['where'],{'$or':_['map'](_0x5e1fff[_0x4118('0x35')],function(_0x3b168b){var _0x8f9ff={};_0x8f9ff[_0x3b168b]={'$like':'%'+_0x211775['query']['filter']+'%'};return _0x8f9ff;})});}_0x5e1fff=_['merge']({},_0x5e1fff,_0x211775[_0x4118('0x3f')]);return _0x285a54[_0x4118('0x7e')](_0x5e1fff);}})['then'](function(_0x5b55fd){if(_0x5b55fd){_0x256242=_0x5b55fd[_0x4118('0x43')];if(!_0x211775['query'][_0x4118('0x53')](_0x4118('0x37'))){_0x5e1fff[_0x4118('0x38')]=qs[_0x4118('0x38')](_0x211775[_0x4118('0x31')][_0x4118('0x38')]);_0x5e1fff[_0x4118('0x1a')]=qs[_0x4118('0x1a')](_0x211775[_0x4118('0x31')][_0x4118('0x1a')]);}return _0x285a54[_0x4118('0x7e')](_0x5e1fff);}})[_0x4118('0x21')](function(_0x501ffa){if(_0x501ffa){return _0x501ffa?{'count':_0x256242,'rows':_0x501ffa}:null;}})['then'](respondWithResult(_0x4bab3f,null))[_0x4118('0x41')](handleError(_0x4bab3f,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 0a40e6e..23e4c47 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 _0x4228=['update','remove','emit','hasOwnProperty','../../mysqldb','FaxQueue','setMaxListeners','save'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x4228,0x1bc));var _0x8422=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4228[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x8422('0x0'))['db'][_0x8422('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x8422('0x2')](0x0);var events={'afterCreate':_0x8422('0x3'),'afterUpdate':_0x8422('0x4'),'afterDestroy':_0x8422('0x5')};function emitEvent(_0x2b23ff){return function(_0x3d3bfa,_0x1da771,_0x327b28){FaxQueueEvents[_0x8422('0x6')](_0x2b23ff+':'+_0x3d3bfa['id'],_0x3d3bfa);FaxQueueEvents[_0x8422('0x6')](_0x2b23ff,_0x3d3bfa);_0x327b28(null);};}for(var e in events){if(events[_0x8422('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x9035=['save','update','remove','emit','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x9035,0x132));var _0x5903=function(_0x171e90,_0x5a3122){_0x171e90=_0x171e90-0x0;var _0x58e4b7=_0x9035[_0x171e90];return _0x58e4b7;};'use strict';var EventEmitter=require(_0x5903('0x0'));var FaxQueue=require(_0x5903('0x1'))['db'][_0x5903('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x5903('0x3')](0x0);var events={'afterCreate':_0x5903('0x4'),'afterUpdate':_0x5903('0x5'),'afterDestroy':_0x5903('0x6')};function emitEvent(_0x23fd18){return function(_0x507ef9,_0x519dd2,_0x4c0632){FaxQueueEvents[_0x5903('0x7')](_0x23fd18+':'+_0x507ef9['id'],_0x507ef9);FaxQueueEvents[_0x5903('0x7')](_0x23fd18,_0x507ef9);_0x4c0632(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x5903('0x8')](e,emitEvent(event));}}module[_0x5903('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 455044e..2ffa1df 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 _0xf675=['moment','request-promise','../../config/environment','./faxQueue.attributes','exports','FaxQueue','fax_queues','lodash','util','api'];(function(_0x873429,_0x1337e9){var _0x4f4589=function(_0x16d594){while(--_0x16d594){_0x873429['push'](_0x873429['shift']());}};_0x4f4589(++_0x1337e9);}(_0xf675,0xf7));var _0x5f67=function(_0x280bb5,_0x4a1aff){_0x280bb5=_0x280bb5-0x0;var _0x2b760c=_0xf675[_0x280bb5];return _0x2b760c;};'use strict';var _=require(_0x5f67('0x0'));var util=require(_0x5f67('0x1'));var logger=require('../../config/logger')(_0x5f67('0x2'));var moment=require(_0x5f67('0x3'));var BPromise=require('bluebird');var rp=require(_0x5f67('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5f67('0x5'));var attributes=require(_0x5f67('0x6'));module[_0x5f67('0x7')]=function(_0x34307d,_0x9c7655){return _0x34307d['define'](_0x5f67('0x8'),attributes,{'tableName':_0x5f67('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87c4=['FaxQueue','fax_queues','util','../../config/logger','request-promise','path','../../config/environment','./faxQueue.attributes','exports','define'];(function(_0x34b8ae,_0x5bbdf0){var _0x1a6654=function(_0x23cbc2){while(--_0x23cbc2){_0x34b8ae['push'](_0x34b8ae['shift']());}};_0x1a6654(++_0x5bbdf0);}(_0x87c4,0x1e2));var _0x487c=function(_0x1b6d3e,_0x474505){_0x1b6d3e=_0x1b6d3e-0x0;var _0x2960ab=_0x87c4[_0x1b6d3e];return _0x2960ab;};'use strict';var _=require('lodash');var util=require(_0x487c('0x0'));var logger=require(_0x487c('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x487c('0x2'));var fs=require('fs');var path=require(_0x487c('0x3'));var rimraf=require('rimraf');var config=require(_0x487c('0x4'));var attributes=require(_0x487c('0x5'));module[_0x487c('0x6')]=function(_0x437214,_0xab4c21){return _0x437214[_0x487c('0x7')](_0x487c('0x8'),attributes,{'tableName':_0x487c('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 978ff91..cf9394a 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 _0xbf8c=['find','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue'];(function(_0x2ea46f,_0x33cfea){var _0x5d40fd=function(_0x51737c){while(--_0x51737c){_0x2ea46f['push'](_0x2ea46f['shift']());}};_0x5d40fd(++_0x33cfea);}(_0xbf8c,0x141));var _0xcbf8=function(_0xfb0cfd,_0x500179){_0xfb0cfd=_0xfb0cfd-0x0;var _0x2fd8aa=_0xbf8c[_0xfb0cfd];return _0x2fd8aa;};'use strict';var _=require(_0xcbf8('0x0'));var util=require('util');var moment=require(_0xcbf8('0x1'));var BPromise=require(_0xcbf8('0x2'));var rs=require(_0xcbf8('0x3'));var fs=require('fs');var Redis=require(_0xcbf8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcbf8('0x5'));var logger=require(_0xcbf8('0x6'))(_0xcbf8('0x7'));var config=require(_0xcbf8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcbf8('0x9')]['http']({'port':0x232a});config[_0xcbf8('0xa')]=_['defaults'](config[_0xcbf8('0xa')],{'host':_0xcbf8('0xb'),'port':0x18eb});var socket=require(_0xcbf8('0xc'))(new Redis(config[_0xcbf8('0xa')]));require(_0xcbf8('0xd'))[_0xcbf8('0xe')](socket);function respondWithRpcPromise(_0x6a746f,_0x5f0152,_0xbc1c64){return new BPromise(function(_0x5a17cb,_0x12c9c5){return client['request'](_0x6a746f,_0xbc1c64)[_0xcbf8('0xf')](function(_0x353d2d){logger[_0xcbf8('0x10')](_0xcbf8('0x11'),_0x5f0152,_0xcbf8('0x12'));logger[_0xcbf8('0x13')](_0xcbf8('0x14'),_0x5f0152,_0xcbf8('0x12'),JSON[_0xcbf8('0x15')](_0x353d2d));if(_0x353d2d[_0xcbf8('0x16')]){if(_0x353d2d[_0xcbf8('0x16')][_0xcbf8('0x17')]===0x1f4){logger[_0xcbf8('0x16')](_0xcbf8('0x11'),_0x5f0152,_0x353d2d[_0xcbf8('0x16')]['message']);return _0x12c9c5(_0x353d2d[_0xcbf8('0x16')]['message']);}logger[_0xcbf8('0x16')](_0xcbf8('0x11'),_0x5f0152,_0x353d2d[_0xcbf8('0x16')][_0xcbf8('0x18')]);return _0x5a17cb(_0x353d2d[_0xcbf8('0x16')][_0xcbf8('0x18')]);}else{logger[_0xcbf8('0x10')](_0xcbf8('0x11'),_0x5f0152,_0xcbf8('0x12'));_0x5a17cb(_0x353d2d[_0xcbf8('0x19')]['message']);}})[_0xcbf8('0x1a')](function(_0x5657a8){logger[_0xcbf8('0x16')](_0xcbf8('0x11'),_0x5f0152,_0x5657a8);_0x12c9c5(_0x5657a8);});});}exports[_0xcbf8('0x1b')]=function(_0x4d4d4c){var _0x23c7c5=this;return new Promise(function(_0x5a8df7,_0x2ec8a4){return db[_0xcbf8('0x1c')][_0xcbf8('0x1d')]({'raw':_0x4d4d4c[_0xcbf8('0x1e')]?_0x4d4d4c[_0xcbf8('0x1e')][_0xcbf8('0x1f')]===undefined?!![]:![]:!![],'where':_0x4d4d4c[_0xcbf8('0x1e')]?_0x4d4d4c[_0xcbf8('0x1e')][_0xcbf8('0x20')]||null:null,'attributes':_0x4d4d4c[_0xcbf8('0x1e')]?_0x4d4d4c[_0xcbf8('0x1e')][_0xcbf8('0x21')]||null:null,'limit':_0x4d4d4c[_0xcbf8('0x1e')]?_0x4d4d4c[_0xcbf8('0x1e')][_0xcbf8('0x22')]||null:null,'include':_0x4d4d4c[_0xcbf8('0x1e')]?_0x4d4d4c[_0xcbf8('0x1e')][_0xcbf8('0x23')]?_[_0xcbf8('0x24')](_0x4d4d4c['options'][_0xcbf8('0x23')],function(_0x555f30){return{'model':db[_0x555f30[_0xcbf8('0x25')]],'as':_0x555f30['as'],'attributes':_0x555f30[_0xcbf8('0x21')],'include':_0x555f30[_0xcbf8('0x23')]?_[_0xcbf8('0x24')](_0x555f30[_0xcbf8('0x23')],function(_0xd3a47c){return{'model':db[_0xd3a47c[_0xcbf8('0x25')]],'as':_0xd3a47c['as'],'attributes':_0xd3a47c[_0xcbf8('0x21')],'include':_0xd3a47c[_0xcbf8('0x23')]?_[_0xcbf8('0x24')](_0xd3a47c[_0xcbf8('0x23')],function(_0x45e356){return{'model':db[_0x45e356[_0xcbf8('0x25')]],'as':_0x45e356['as'],'attributes':_0x45e356[_0xcbf8('0x21')]};}):[]};}):[]};}):[]:[]})[_0xcbf8('0xf')](function(_0x33d3c5){logger[_0xcbf8('0x10')](_0xcbf8('0x1b'),_0x4d4d4c);logger[_0xcbf8('0x13')]('GetFaxQueue',_0x4d4d4c,JSON['stringify'](_0x33d3c5));_0x5a8df7(_0x33d3c5);})[_0xcbf8('0x1a')](function(_0x24fe1a){logger['error'](_0xcbf8('0x1b'),_0x24fe1a[_0xcbf8('0x18')],_0x4d4d4c);_0x2ec8a4(_0x23c7c5[_0xcbf8('0x16')](0x1f4,_0x24fe1a['message']));});});};exports[_0xcbf8('0x26')]=function(_0x25716e){var _0x4e2640=this;return new Promise(function(_0x5d327c,_0x195399){return db[_0xcbf8('0x1c')][_0xcbf8('0x27')]({'raw':_0x25716e[_0xcbf8('0x1e')]?_0x25716e[_0xcbf8('0x1e')][_0xcbf8('0x1f')]===undefined?!![]:![]:!![],'where':_0x25716e['options']?_0x25716e[_0xcbf8('0x1e')]['where']||null:null,'attributes':_0x25716e['options']?_0x25716e[_0xcbf8('0x1e')][_0xcbf8('0x21')]||null:null,'include':_0x25716e[_0xcbf8('0x1e')]?_0x25716e['options'][_0xcbf8('0x23')]?_['map'](_0x25716e[_0xcbf8('0x1e')][_0xcbf8('0x23')],function(_0x380745){return{'model':db[_0x380745['model']],'as':_0x380745['as'],'attributes':_0x380745[_0xcbf8('0x21')],'include':_0x380745[_0xcbf8('0x23')]?_[_0xcbf8('0x24')](_0x380745[_0xcbf8('0x23')],function(_0x41c94c){return{'model':db[_0x41c94c[_0xcbf8('0x25')]],'as':_0x41c94c['as'],'attributes':_0x41c94c['attributes'],'include':_0x41c94c['include']?_['map'](_0x41c94c[_0xcbf8('0x23')],function(_0xdeb1ec){return{'model':db[_0xdeb1ec[_0xcbf8('0x25')]],'as':_0xdeb1ec['as'],'attributes':_0xdeb1ec['attributes']};}):[]};}):[]};}):[]:[]})[_0xcbf8('0xf')](function(_0x49eac1){logger[_0xcbf8('0x10')]('ShowFaxQueue',_0x25716e);logger[_0xcbf8('0x13')](_0xcbf8('0x26'),_0x25716e,JSON[_0xcbf8('0x15')](_0x49eac1));_0x5d327c(_0x49eac1);})['catch'](function(_0x106a90){logger[_0xcbf8('0x16')](_0xcbf8('0x26'),_0x106a90[_0xcbf8('0x18')],_0x25716e);_0x195399(_0x4e2640['error'](0x1f4,_0x106a90[_0xcbf8('0x18')]));});});}; \ No newline at end of file +var _0x2455=['rpc','../../config/environment','client','http','defaults','redis','socket.io-emitter','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','map','include','model','find','ShowFaxQueue','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2941c3,_0x4f143f){var _0x4c1d51=function(_0x213ed7){while(--_0x213ed7){_0x2941c3['push'](_0x2941c3['shift']());}};_0x4c1d51(++_0x4f143f);}(_0x2455,0x128));var _0x5245=function(_0x54784f,_0x2a24d8){_0x54784f=_0x54784f-0x0;var _0x241e1b=_0x2455[_0x54784f];return _0x241e1b;};'use strict';var _=require(_0x5245('0x0'));var util=require(_0x5245('0x1'));var moment=require(_0x5245('0x2'));var BPromise=require(_0x5245('0x3'));var rs=require(_0x5245('0x4'));var fs=require('fs');var Redis=require(_0x5245('0x5'));var db=require(_0x5245('0x6'))['db'];var utils=require(_0x5245('0x7'));var logger=require('../../config/logger')(_0x5245('0x8'));var config=require(_0x5245('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5245('0xa')][_0x5245('0xb')]({'port':0x232a});config['redis']=_[_0x5245('0xc')](config[_0x5245('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x5245('0xe'))(new Redis(config[_0x5245('0xd')]));require('./faxQueue.socket')[_0x5245('0xf')](socket);function respondWithRpcPromise(_0x11eb8d,_0x3394b4,_0x10541e){return new BPromise(function(_0x4eb140,_0x35afe4){return client['request'](_0x11eb8d,_0x10541e)[_0x5245('0x10')](function(_0x4a701a){logger[_0x5245('0x11')](_0x5245('0x12'),_0x3394b4,_0x5245('0x13'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x3394b4,_0x5245('0x13'),JSON[_0x5245('0x14')](_0x4a701a));if(_0x4a701a[_0x5245('0x15')]){if(_0x4a701a['error']['code']===0x1f4){logger[_0x5245('0x15')](_0x5245('0x12'),_0x3394b4,_0x4a701a['error'][_0x5245('0x16')]);return _0x35afe4(_0x4a701a[_0x5245('0x15')][_0x5245('0x16')]);}logger['error'](_0x5245('0x12'),_0x3394b4,_0x4a701a[_0x5245('0x15')]['message']);return _0x4eb140(_0x4a701a[_0x5245('0x15')][_0x5245('0x16')]);}else{logger[_0x5245('0x11')](_0x5245('0x12'),_0x3394b4,_0x5245('0x13'));_0x4eb140(_0x4a701a['result'][_0x5245('0x16')]);}})[_0x5245('0x17')](function(_0x22d3d5){logger[_0x5245('0x15')](_0x5245('0x12'),_0x3394b4,_0x22d3d5);_0x35afe4(_0x22d3d5);});});}exports[_0x5245('0x18')]=function(_0x15d66e){var _0x28316c=this;return new Promise(function(_0x42b2c2,_0x4313df){return db[_0x5245('0x19')][_0x5245('0x1a')]({'raw':_0x15d66e['options']?_0x15d66e[_0x5245('0x1b')][_0x5245('0x1c')]===undefined?!![]:![]:!![],'where':_0x15d66e['options']?_0x15d66e[_0x5245('0x1b')][_0x5245('0x1d')]||null:null,'attributes':_0x15d66e[_0x5245('0x1b')]?_0x15d66e[_0x5245('0x1b')][_0x5245('0x1e')]||null:null,'limit':_0x15d66e[_0x5245('0x1b')]?_0x15d66e[_0x5245('0x1b')][_0x5245('0x1f')]||null:null,'include':_0x15d66e[_0x5245('0x1b')]?_0x15d66e[_0x5245('0x1b')]['include']?_[_0x5245('0x20')](_0x15d66e[_0x5245('0x1b')][_0x5245('0x21')],function(_0xe2964f){return{'model':db[_0xe2964f[_0x5245('0x22')]],'as':_0xe2964f['as'],'attributes':_0xe2964f['attributes'],'include':_0xe2964f['include']?_[_0x5245('0x20')](_0xe2964f[_0x5245('0x21')],function(_0x1e84bd){return{'model':db[_0x1e84bd[_0x5245('0x22')]],'as':_0x1e84bd['as'],'attributes':_0x1e84bd[_0x5245('0x1e')],'include':_0x1e84bd[_0x5245('0x21')]?_[_0x5245('0x20')](_0x1e84bd[_0x5245('0x21')],function(_0x3ca94c){return{'model':db[_0x3ca94c['model']],'as':_0x3ca94c['as'],'attributes':_0x3ca94c[_0x5245('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5245('0x10')](function(_0x113a91){logger['info'](_0x5245('0x18'),_0x15d66e);logger['debug']('GetFaxQueue',_0x15d66e,JSON['stringify'](_0x113a91));_0x42b2c2(_0x113a91);})['catch'](function(_0x27d70c){logger[_0x5245('0x15')](_0x5245('0x18'),_0x27d70c[_0x5245('0x16')],_0x15d66e);_0x4313df(_0x28316c[_0x5245('0x15')](0x1f4,_0x27d70c[_0x5245('0x16')]));});});};exports['ShowFaxQueue']=function(_0x506390){var _0x54ce13=this;return new Promise(function(_0x5ca3dd,_0x4efdc5){return db[_0x5245('0x19')][_0x5245('0x23')]({'raw':_0x506390['options']?_0x506390['options']['raw']===undefined?!![]:![]:!![],'where':_0x506390[_0x5245('0x1b')]?_0x506390[_0x5245('0x1b')][_0x5245('0x1d')]||null:null,'attributes':_0x506390[_0x5245('0x1b')]?_0x506390['options']['attributes']||null:null,'include':_0x506390[_0x5245('0x1b')]?_0x506390['options'][_0x5245('0x21')]?_[_0x5245('0x20')](_0x506390[_0x5245('0x1b')]['include'],function(_0x41c60b){return{'model':db[_0x41c60b['model']],'as':_0x41c60b['as'],'attributes':_0x41c60b[_0x5245('0x1e')],'include':_0x41c60b[_0x5245('0x21')]?_[_0x5245('0x20')](_0x41c60b[_0x5245('0x21')],function(_0x13f25a){return{'model':db[_0x13f25a[_0x5245('0x22')]],'as':_0x13f25a['as'],'attributes':_0x13f25a[_0x5245('0x1e')],'include':_0x13f25a[_0x5245('0x21')]?_[_0x5245('0x20')](_0x13f25a[_0x5245('0x21')],function(_0x23cb1f){return{'model':db[_0x23cb1f[_0x5245('0x22')]],'as':_0x23cb1f['as'],'attributes':_0x23cb1f[_0x5245('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5245('0x10')](function(_0x177e6c){logger[_0x5245('0x11')](_0x5245('0x24'),_0x506390);logger[_0x5245('0x25')](_0x5245('0x24'),_0x506390,JSON[_0x5245('0x14')](_0x177e6c));_0x5ca3dd(_0x177e6c);})[_0x5245('0x17')](function(_0x4917d0){logger[_0x5245('0x15')]('ShowFaxQueue',_0x4917d0[_0x5245('0x16')],_0x506390);_0x4efdc5(_0x54ce13[_0x5245('0x15')](0x1f4,_0x4917d0['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 80f0e3d..55c65ae 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 _0x20e3=['./faxQueue.events','remove','update','emit','removeListener','length'];(function(_0x196ddc,_0x514491){var _0x5d15f2=function(_0x5bcf05){while(--_0x5bcf05){_0x196ddc['push'](_0x196ddc['shift']());}};_0x5d15f2(++_0x514491);}(_0x20e3,0x15c));var _0x320e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x20e3[_0x59ee6f];return _0x4c0979;};'use strict';var FaxQueueEvents=require(_0x320e('0x0'));var events=['save',_0x320e('0x1'),_0x320e('0x2')];function createListener(_0x314226,_0x59f1ac){return function(_0x59dfb5){_0x59f1ac[_0x320e('0x3')](_0x314226,_0x59dfb5);};}function removeListener(_0x5818d9,_0x23c3cb){return function(){FaxQueueEvents[_0x320e('0x4')](_0x5818d9,_0x23c3cb);};}exports['register']=function(_0x344d68){for(var _0x57045f=0x0,_0x3d98c3=events[_0x320e('0x5')];_0x57045f<_0x3d98c3;_0x57045f++){var _0x1bf7dd=events[_0x57045f];var _0x49d96e=createListener('faxQueue:'+_0x1bf7dd,_0x344d68);FaxQueueEvents['on'](_0x1bf7dd,_0x49d96e);}}; \ No newline at end of file +var _0x74fe=['./faxQueue.events','save','update','length'];(function(_0x51f574,_0x43e008){var _0x10d93b=function(_0x13f501){while(--_0x13f501){_0x51f574['push'](_0x51f574['shift']());}};_0x10d93b(++_0x43e008);}(_0x74fe,0x84));var _0xe74f=function(_0x2bc0db,_0x3a381a){_0x2bc0db=_0x2bc0db-0x0;var _0x3d475f=_0x74fe[_0x2bc0db];return _0x3d475f;};'use strict';var FaxQueueEvents=require(_0xe74f('0x0'));var events=[_0xe74f('0x1'),'remove',_0xe74f('0x2')];function createListener(_0x19af91,_0x3d73cf){return function(_0x5d28b3){_0x3d73cf['emit'](_0x19af91,_0x5d28b3);};}function removeListener(_0xab433f,_0xde88){return function(){FaxQueueEvents['removeListener'](_0xab433f,_0xde88);};}exports['register']=function(_0x651832){for(var _0x4afcdd=0x0,_0x3c16e8=events[_0xe74f('0x3')];_0x4afcdd<_0x3c16e8;_0x4afcdd++){var _0x3ec151=events[_0x4afcdd];var _0x5bf82c=createListener('faxQueue:'+_0x3ec151,_0x651832);FaxQueueEvents['on'](_0x3ec151,_0x5bf82c);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 5d557ec..c918eb0 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 _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c815e,_0x3d8105){_0x3c815e=_0x3c815e-0x0;var _0xf66654=_0xb10b[_0x3c815e];return _0xf66654;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xb10b,0x12a));var _0xbb10=function(_0x6f2ce5,_0x4231eb){_0x6f2ce5=_0x6f2ce5-0x0;var _0x28a54a=_0xb10b[_0x6f2ce5];return _0x28a54a;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index f2e3eed..ba9b50b 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 _0x2fc5=['DATE','STRING','sequelize'];(function(_0x48f183,_0x5d7f9f){var _0x3d5361=function(_0x214aa3){while(--_0x214aa3){_0x48f183['push'](_0x48f183['shift']());}};_0x3d5361(++_0x5d7f9f);}(_0x2fc5,0x107));var _0x52fc=function(_0xf80b3,_0x25d5f3){_0xf80b3=_0xf80b3-0x0;var _0x10c489=_0x2fc5[_0xf80b3];return _0x10c489;};'use strict';var moment=require('moment');var Sequelize=require(_0x52fc('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x52fc('0x1')]},'leaveAt':{'type':Sequelize[_0x52fc('0x1')]},'acceptAt':{'type':Sequelize[_0x52fc('0x1')]},'exitAt':{'type':Sequelize[_0x52fc('0x1')]},'reason':{'type':Sequelize[_0x52fc('0x2')]}}; \ No newline at end of file +var _0xaf1e=['STRING','DATE','moment'];(function(_0x521e81,_0x48a6fb){var _0x23d85f=function(_0x2b66ba){while(--_0x2b66ba){_0x521e81['push'](_0x521e81['shift']());}};_0x23d85f(++_0x48a6fb);}(_0xaf1e,0x110));var _0xeaf1=function(_0x857aa4,_0x5608f6){_0x857aa4=_0x857aa4-0x0;var _0x313d1e=_0xaf1e[_0x857aa4];return _0x313d1e;};'use strict';var moment=require(_0xeaf1('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xeaf1('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xeaf1('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xeaf1('0x2')]},'reason':{'type':Sequelize[_0xeaf1('0x1')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 42384aa..6dfa8d4 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 _0x835c=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxQueueReport','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','sort','where','filter','VIRTUAL','options','includeAll','catch','params','rawAttributes','include','merge','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit'];(function(_0x56c70f,_0x4e4493){var _0x3812ed=function(_0x25460f){while(--_0x25460f){_0x56c70f['push'](_0x56c70f['shift']());}};_0x3812ed(++_0x4e4493);}(_0x835c,0x1ba));var _0xc835=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x835c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xc835('0x0'));var emlformat=require(_0xc835('0x1'));var rimraf=require(_0xc835('0x2'));var zipdir=require(_0xc835('0x3'));var jsonpatch=require(_0xc835('0x4'));var rp=require(_0xc835('0x5'));var moment=require(_0xc835('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc835('0x7'));var sox=require('sox');var csv=require(_0xc835('0x8'));var ejs=require(_0xc835('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc835('0xa'));var jsforce=require(_0xc835('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc835('0x8'));var querystring=require(_0xc835('0xc'));var Papa=require(_0xc835('0xd'));var Redis=require(_0xc835('0xe'));var authService=require(_0xc835('0xf'));var qs=require(_0xc835('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc835('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xc835('0x12'));var config=require('../../config/environment');var db=require(_0xc835('0x13'))['db'];function respondWithStatusCode(_0x435e6f,_0x589bf3){_0x589bf3=_0x589bf3||0xcc;return function(_0x110660){if(_0x110660){return _0x435e6f[_0xc835('0x14')](_0x589bf3);}return _0x435e6f[_0xc835('0x15')](_0x589bf3)[_0xc835('0x16')]();};}function respondWithResult(_0x30e73b,_0x1e0ee5){_0x1e0ee5=_0x1e0ee5||0xc8;return function(_0x59ff28){if(_0x59ff28){return _0x30e73b[_0xc835('0x15')](_0x1e0ee5)[_0xc835('0x17')](_0x59ff28);}};}function respondWithFilteredResult(_0x319147,_0x1f0012){return function(_0x292787){if(_0x292787){var _0x1ff8ec=_0x292787[_0xc835('0x18')],_0x178cde=_0x1f0012[_0xc835('0x19')],_0x776832=_0x1f0012[_0xc835('0x19')]+_0x1f0012[_0xc835('0x1a')],_0x28991c;if(_0x776832>=_0x1ff8ec){_0x776832=_0x1ff8ec;_0x28991c=0xc8;}else{_0x28991c=0xce;}_0x319147[_0xc835('0x15')](_0x28991c);return _0x319147['set'](_0xc835('0x1b'),_0x178cde+'-'+_0x776832+'/'+_0x1ff8ec)[_0xc835('0x17')](_0x292787);}return null;};}function patchUpdates(_0x4cf584){return function(_0x4488d7){try{jsonpatch[_0xc835('0x1c')](_0x4488d7,_0x4cf584,!![]);}catch(_0x3ed1a4){return BPromise[_0xc835('0x1d')](_0x3ed1a4);}return _0x4488d7[_0xc835('0x1e')]();};}function saveUpdates(_0x1c0d80,_0x4043a6){return function(_0x36c604){if(_0x36c604){return _0x36c604[_0xc835('0x1f')](_0x1c0d80)[_0xc835('0x20')](function(_0x42b2d3){return _0x42b2d3;});}return null;};}function removeEntity(_0x5b8612,_0x496351){return function(_0x31949b){if(_0x31949b){return _0x31949b[_0xc835('0x21')]()[_0xc835('0x20')](function(){_0x5b8612['status'](0xcc)[_0xc835('0x16')]();});}};}function handleEntityNotFound(_0x3932c4,_0x26f625){return function(_0x42d5fe){if(!_0x42d5fe){_0x3932c4[_0xc835('0x14')](0x194);}return _0x42d5fe;};}function handleError(_0x2295f9,_0x24657a){_0x24657a=_0x24657a||0x1f4;return function(_0x17c5b9){logger[_0xc835('0x22')](_0x17c5b9[_0xc835('0x23')]);if(_0x17c5b9[_0xc835('0x24')]){delete _0x17c5b9[_0xc835('0x24')];}_0x2295f9['status'](_0x24657a)[_0xc835('0x25')](_0x17c5b9);};}exports[_0xc835('0x26')]=function(_0x38f793,_0x378623){var _0x188a98={},_0x467107={},_0x31da29={'count':0x0,'rows':[]};var _0x3e5231=_[_0xc835('0x27')](db[_0xc835('0x28')]['rawAttributes'],function(_0x6af798){return{'name':_0x6af798['fieldName'],'type':_0x6af798[_0xc835('0x29')][_0xc835('0x2a')]};});_0x467107['model']=_[_0xc835('0x27')](_0x3e5231,'name');_0x467107[_0xc835('0x2b')]=_[_0xc835('0x2c')](_0x38f793[_0xc835('0x2b')]);_0x467107[_0xc835('0x2d')]=_['intersection'](_0x467107['model'],_0x467107[_0xc835('0x2b')]);_0x188a98[_0xc835('0x2e')]=_[_0xc835('0x2f')](_0x467107[_0xc835('0x30')],qs['fields'](_0x38f793['query'][_0xc835('0x31')]));_0x188a98[_0xc835('0x2e')]=_0x188a98[_0xc835('0x2e')][_0xc835('0x32')]?_0x188a98[_0xc835('0x2e')]:_0x467107['model'];if(!_0x38f793['query'][_0xc835('0x33')]('nolimit')){_0x188a98['limit']=qs[_0xc835('0x1a')](_0x38f793[_0xc835('0x2b')]['limit']);_0x188a98['offset']=qs[_0xc835('0x19')](_0x38f793[_0xc835('0x2b')]['offset']);}_0x188a98['order']=qs['sort'](_0x38f793[_0xc835('0x2b')][_0xc835('0x34')]);_0x188a98[_0xc835('0x35')]=qs[_0xc835('0x2d')](_['pick'](_0x38f793[_0xc835('0x2b')],_0x467107[_0xc835('0x2d')]),_0x3e5231);if(_0x38f793[_0xc835('0x2b')][_0xc835('0x36')]){_0x188a98['where']=_['merge'](_0x188a98['where'],{'$or':_[_0xc835('0x27')](_0x3e5231,function(_0x19ec32){if(_0x19ec32[_0xc835('0x29')]!==_0xc835('0x37')){var _0x5cb171={};_0x5cb171[_0x19ec32[_0xc835('0x24')]]={'$like':'%'+_0x38f793['query']['filter']+'%'};return _0x5cb171;}})});}_0x188a98=_['merge']({},_0x188a98,_0x38f793[_0xc835('0x38')]);var _0x21f653={'where':_0x188a98[_0xc835('0x35')]};return db[_0xc835('0x28')][_0xc835('0x18')](_0x21f653)[_0xc835('0x20')](function(_0x4e8679){_0x31da29[_0xc835('0x18')]=_0x4e8679;if(_0x38f793[_0xc835('0x2b')][_0xc835('0x39')]){_0x188a98['include']=[{'all':!![]}];}return db[_0xc835('0x28')]['findAll'](_0x188a98);})['then'](function(_0x402738){_0x31da29['rows']=_0x402738;return _0x31da29;})[_0xc835('0x20')](respondWithFilteredResult(_0x378623,_0x188a98))[_0xc835('0x3a')](handleError(_0x378623,null));};exports['show']=function(_0x59b2f5,_0x31e5a6){var _0x3fbf12={'raw':!![],'where':{'id':_0x59b2f5[_0xc835('0x3b')]['id']}},_0xde0230={};_0xde0230[_0xc835('0x30')]=_['keys'](db[_0xc835('0x28')][_0xc835('0x3c')]);_0xde0230[_0xc835('0x2b')]=_[_0xc835('0x2c')](_0x59b2f5[_0xc835('0x2b')]);_0xde0230[_0xc835('0x2d')]=_['intersection'](_0xde0230[_0xc835('0x30')],_0xde0230['query']);_0x3fbf12['attributes']=_[_0xc835('0x2f')](_0xde0230[_0xc835('0x30')],qs['fields'](_0x59b2f5['query'][_0xc835('0x31')]));_0x3fbf12[_0xc835('0x2e')]=_0x3fbf12['attributes'][_0xc835('0x32')]?_0x3fbf12[_0xc835('0x2e')]:_0xde0230[_0xc835('0x30')];if(_0x59b2f5[_0xc835('0x2b')][_0xc835('0x39')]){_0x3fbf12[_0xc835('0x3d')]=[{'all':!![]}];}_0x3fbf12=_[_0xc835('0x3e')]({},_0x3fbf12,_0x59b2f5[_0xc835('0x38')]);return db[_0xc835('0x28')][_0xc835('0x3f')](_0x3fbf12)[_0xc835('0x20')](handleEntityNotFound(_0x31e5a6,null))['then'](respondWithResult(_0x31e5a6,null))[_0xc835('0x3a')](handleError(_0x31e5a6,null));};exports[_0xc835('0x40')]=function(_0x3d07c7,_0x524c2e){return db['FaxQueueReport']['create'](_0x3d07c7[_0xc835('0x41')],{})[_0xc835('0x20')](respondWithResult(_0x524c2e,0xc9))[_0xc835('0x3a')](handleError(_0x524c2e,null));};exports[_0xc835('0x1f')]=function(_0x5ee97f,_0x4ba095){if(_0x5ee97f['body']['id']){delete _0x5ee97f[_0xc835('0x41')]['id'];}return db[_0xc835('0x28')][_0xc835('0x3f')]({'where':{'id':_0x5ee97f[_0xc835('0x3b')]['id']}})['then'](handleEntityNotFound(_0x4ba095,null))['then'](saveUpdates(_0x5ee97f[_0xc835('0x41')],null))[_0xc835('0x20')](respondWithResult(_0x4ba095,null))[_0xc835('0x3a')](handleError(_0x4ba095,null));};exports[_0xc835('0x21')]=function(_0x201a5a,_0x117bb4){return db[_0xc835('0x28')][_0xc835('0x3f')]({'where':{'id':_0x201a5a['params']['id']}})[_0xc835('0x20')](handleEntityNotFound(_0x117bb4,null))[_0xc835('0x20')](removeEntity(_0x117bb4,null))['catch'](handleError(_0x117bb4,null));};exports[_0xc835('0x42')]=function(_0x11df51,_0x3eefbf){return db[_0xc835('0x28')][_0xc835('0x42')]()[_0xc835('0x20')](respondWithResult(_0x3eefbf,null))[_0xc835('0x3a')](handleError(_0x3eefbf,null));}; \ No newline at end of file +var _0x519a=['filter','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','update','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','set','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','send','map','FaxQueueReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','offset','order','sort','where','pick','VIRTUAL'];(function(_0x56fd29,_0x17790b){var _0x2a0bf7=function(_0x568f20){while(--_0x568f20){_0x56fd29['push'](_0x56fd29['shift']());}};_0x2a0bf7(++_0x17790b);}(_0x519a,0xa1));var _0xa519=function(_0x21af3a,_0x386e1d){_0x21af3a=_0x21af3a-0x0;var _0x268a49=_0x519a[_0x21af3a];return _0x268a49;};'use strict';var pdf=require(_0xa519('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa519('0x1'));var zipdir=require(_0xa519('0x2'));var jsonpatch=require(_0xa519('0x3'));var rp=require(_0xa519('0x4'));var moment=require('moment');var BPromise=require(_0xa519('0x5'));var Mustache=require('mustache');var util=require(_0xa519('0x6'));var path=require(_0xa519('0x7'));var sox=require(_0xa519('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa519('0x9'));var squel=require(_0xa519('0xa'));var crypto=require(_0xa519('0xb'));var jsforce=require(_0xa519('0xc'));var deskjs=require(_0xa519('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa519('0xe'));var Papa=require('papaparse');var Redis=require(_0xa519('0xf'));var authService=require(_0xa519('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa519('0x11'));var hardwareService=require(_0xa519('0x12'));var logger=require(_0xa519('0x13'))(_0xa519('0x14'));var utils=require(_0xa519('0x15'));var config=require(_0xa519('0x16'));var db=require(_0xa519('0x17'))['db'];function respondWithStatusCode(_0x1bf586,_0x23f2b6){_0x23f2b6=_0x23f2b6||0xcc;return function(_0x5d0ece){if(_0x5d0ece){return _0x1bf586['sendStatus'](_0x23f2b6);}return _0x1bf586[_0xa519('0x18')](_0x23f2b6)[_0xa519('0x19')]();};}function respondWithResult(_0x3fc1ba,_0x244b25){_0x244b25=_0x244b25||0xc8;return function(_0x4f86f2){if(_0x4f86f2){return _0x3fc1ba[_0xa519('0x18')](_0x244b25)['json'](_0x4f86f2);}};}function respondWithFilteredResult(_0x352642,_0x432d02){return function(_0x340323){if(_0x340323){var _0x48ddb3=_0x340323[_0xa519('0x1a')],_0x89534e=_0x432d02['offset'],_0x4b597f=_0x432d02['offset']+_0x432d02['limit'],_0x5ac0e4;if(_0x4b597f>=_0x48ddb3){_0x4b597f=_0x48ddb3;_0x5ac0e4=0xc8;}else{_0x5ac0e4=0xce;}_0x352642[_0xa519('0x18')](_0x5ac0e4);return _0x352642[_0xa519('0x1b')](_0xa519('0x1c'),_0x89534e+'-'+_0x4b597f+'/'+_0x48ddb3)['json'](_0x340323);}return null;};}function patchUpdates(_0x22e5c7){return function(_0x373677){try{jsonpatch[_0xa519('0x1d')](_0x373677,_0x22e5c7,!![]);}catch(_0x53d5d9){return BPromise[_0xa519('0x1e')](_0x53d5d9);}return _0x373677['save']();};}function saveUpdates(_0x2bd7c1,_0x5150ba){return function(_0x5d46af){if(_0x5d46af){return _0x5d46af['update'](_0x2bd7c1)[_0xa519('0x1f')](function(_0x308a90){return _0x308a90;});}return null;};}function removeEntity(_0x36c293,_0x376fb2){return function(_0x4e8e1f){if(_0x4e8e1f){return _0x4e8e1f[_0xa519('0x20')]()['then'](function(){_0x36c293[_0xa519('0x18')](0xcc)[_0xa519('0x19')]();});}};}function handleEntityNotFound(_0x56c841,_0x1d84b2){return function(_0x435d13){if(!_0x435d13){_0x56c841[_0xa519('0x21')](0x194);}return _0x435d13;};}function handleError(_0x5a08cf,_0x243060){_0x243060=_0x243060||0x1f4;return function(_0x12a9b5){logger[_0xa519('0x22')](_0x12a9b5[_0xa519('0x23')]);if(_0x12a9b5[_0xa519('0x24')]){delete _0x12a9b5['name'];}_0x5a08cf[_0xa519('0x18')](_0x243060)[_0xa519('0x25')](_0x12a9b5);};}exports['index']=function(_0x4f63b7,_0x5d2c84){var _0xbcf7a4={},_0x9b9a6a={},_0x298746={'count':0x0,'rows':[]};var _0x37bd0d=_[_0xa519('0x26')](db[_0xa519('0x27')]['rawAttributes'],function(_0x4f6353){return{'name':_0x4f6353[_0xa519('0x28')],'type':_0x4f6353[_0xa519('0x29')]['key']};});_0x9b9a6a[_0xa519('0x2a')]=_['map'](_0x37bd0d,_0xa519('0x24'));_0x9b9a6a[_0xa519('0x2b')]=_[_0xa519('0x2c')](_0x4f63b7[_0xa519('0x2b')]);_0x9b9a6a[_0xa519('0x2d')]=_[_0xa519('0x2e')](_0x9b9a6a[_0xa519('0x2a')],_0x9b9a6a[_0xa519('0x2b')]);_0xbcf7a4[_0xa519('0x2f')]=_['intersection'](_0x9b9a6a[_0xa519('0x2a')],qs[_0xa519('0x30')](_0x4f63b7['query']['fields']));_0xbcf7a4[_0xa519('0x2f')]=_0xbcf7a4[_0xa519('0x2f')][_0xa519('0x31')]?_0xbcf7a4[_0xa519('0x2f')]:_0x9b9a6a['model'];if(!_0x4f63b7[_0xa519('0x2b')]['hasOwnProperty'](_0xa519('0x32'))){_0xbcf7a4[_0xa519('0x33')]=qs['limit'](_0x4f63b7[_0xa519('0x2b')][_0xa519('0x33')]);_0xbcf7a4[_0xa519('0x34')]=qs[_0xa519('0x34')](_0x4f63b7[_0xa519('0x2b')][_0xa519('0x34')]);}_0xbcf7a4[_0xa519('0x35')]=qs['sort'](_0x4f63b7[_0xa519('0x2b')][_0xa519('0x36')]);_0xbcf7a4[_0xa519('0x37')]=qs[_0xa519('0x2d')](_[_0xa519('0x38')](_0x4f63b7[_0xa519('0x2b')],_0x9b9a6a['filters']),_0x37bd0d);if(_0x4f63b7['query']['filter']){_0xbcf7a4[_0xa519('0x37')]=_['merge'](_0xbcf7a4['where'],{'$or':_[_0xa519('0x26')](_0x37bd0d,function(_0x25825a){if(_0x25825a[_0xa519('0x29')]!==_0xa519('0x39')){var _0x1e7d2e={};_0x1e7d2e[_0x25825a['name']]={'$like':'%'+_0x4f63b7[_0xa519('0x2b')][_0xa519('0x3a')]+'%'};return _0x1e7d2e;}})});}_0xbcf7a4=_['merge']({},_0xbcf7a4,_0x4f63b7[_0xa519('0x3b')]);var _0x21d36d={'where':_0xbcf7a4[_0xa519('0x37')]};return db[_0xa519('0x27')][_0xa519('0x1a')](_0x21d36d)[_0xa519('0x1f')](function(_0x284cff){_0x298746[_0xa519('0x1a')]=_0x284cff;if(_0x4f63b7[_0xa519('0x2b')][_0xa519('0x3c')]){_0xbcf7a4[_0xa519('0x3d')]=[{'all':!![]}];}return db[_0xa519('0x27')][_0xa519('0x3e')](_0xbcf7a4);})[_0xa519('0x1f')](function(_0x15365e){_0x298746[_0xa519('0x3f')]=_0x15365e;return _0x298746;})[_0xa519('0x1f')](respondWithFilteredResult(_0x5d2c84,_0xbcf7a4))[_0xa519('0x40')](handleError(_0x5d2c84,null));};exports[_0xa519('0x41')]=function(_0x287298,_0x5c2569){var _0x4ec511={'raw':!![],'where':{'id':_0x287298[_0xa519('0x42')]['id']}},_0x4a79c6={};_0x4a79c6[_0xa519('0x2a')]=_[_0xa519('0x2c')](db['FaxQueueReport']['rawAttributes']);_0x4a79c6['query']=_[_0xa519('0x2c')](_0x287298['query']);_0x4a79c6[_0xa519('0x2d')]=_[_0xa519('0x2e')](_0x4a79c6['model'],_0x4a79c6[_0xa519('0x2b')]);_0x4ec511['attributes']=_[_0xa519('0x2e')](_0x4a79c6[_0xa519('0x2a')],qs[_0xa519('0x30')](_0x287298['query'][_0xa519('0x30')]));_0x4ec511['attributes']=_0x4ec511['attributes'][_0xa519('0x31')]?_0x4ec511['attributes']:_0x4a79c6[_0xa519('0x2a')];if(_0x287298[_0xa519('0x2b')][_0xa519('0x3c')]){_0x4ec511[_0xa519('0x3d')]=[{'all':!![]}];}_0x4ec511=_[_0xa519('0x43')]({},_0x4ec511,_0x287298[_0xa519('0x3b')]);return db[_0xa519('0x27')][_0xa519('0x44')](_0x4ec511)[_0xa519('0x1f')](handleEntityNotFound(_0x5c2569,null))[_0xa519('0x1f')](respondWithResult(_0x5c2569,null))['catch'](handleError(_0x5c2569,null));};exports[_0xa519('0x45')]=function(_0xfd348f,_0xce99b9){return db[_0xa519('0x27')][_0xa519('0x45')](_0xfd348f[_0xa519('0x46')],{})[_0xa519('0x1f')](respondWithResult(_0xce99b9,0xc9))[_0xa519('0x40')](handleError(_0xce99b9,null));};exports[_0xa519('0x47')]=function(_0xd01d30,_0x3526e5){if(_0xd01d30['body']['id']){delete _0xd01d30[_0xa519('0x46')]['id'];}return db[_0xa519('0x27')][_0xa519('0x44')]({'where':{'id':_0xd01d30[_0xa519('0x42')]['id']}})[_0xa519('0x1f')](handleEntityNotFound(_0x3526e5,null))[_0xa519('0x1f')](saveUpdates(_0xd01d30[_0xa519('0x46')],null))['then'](respondWithResult(_0x3526e5,null))['catch'](handleError(_0x3526e5,null));};exports['destroy']=function(_0xa6902d,_0x5c8d6a){return db['FaxQueueReport'][_0xa519('0x44')]({'where':{'id':_0xa6902d[_0xa519('0x42')]['id']}})[_0xa519('0x1f')](handleEntityNotFound(_0x5c8d6a,null))[_0xa519('0x1f')](removeEntity(_0x5c8d6a,null))[_0xa519('0x40')](handleError(_0x5c8d6a,null));};exports[_0xa519('0x48')]=function(_0x35e66b,_0xa24256){return db[_0xa519('0x27')]['describe']()[_0xa519('0x1f')](respondWithResult(_0xa24256,null))[_0xa519('0x40')](handleError(_0xa24256,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index f38251e..7414a0c 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 _0xa6ce=['api','bluebird','request-promise','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','lodash','../../config/logger'];(function(_0x4bf41c,_0x21bf88){var _0xc9ee45=function(_0x2a9bee){while(--_0x2a9bee){_0x4bf41c['push'](_0x4bf41c['shift']());}};_0xc9ee45(++_0x21bf88);}(_0xa6ce,0x15e));var _0xea6c=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xa6ce[_0x17928f];return _0x500b63;};'use strict';var _=require(_0xea6c('0x0'));var util=require('util');var logger=require(_0xea6c('0x1'))(_0xea6c('0x2'));var moment=require('moment');var BPromise=require(_0xea6c('0x3'));var rp=require(_0xea6c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xea6c('0x5'));var attributes=require(_0xea6c('0x6'));module[_0xea6c('0x7')]=function(_0x236ed9,_0x267f26){return _0x236ed9[_0xea6c('0x8')]('FaxQueueReport',attributes,{'tableName':_0xea6c('0x9'),'paranoid':![],'indexes':[{'name':_0xea6c('0xa'),'fields':[_0xea6c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x09df=['../../config/environment','./faxQueueReport.attributes','define','report_fax_queue','uniqueid','lodash','util','api','request-promise'];(function(_0x32c074,_0x121556){var _0x3a966a=function(_0x3cf551){while(--_0x3cf551){_0x32c074['push'](_0x32c074['shift']());}};_0x3a966a(++_0x121556);}(_0x09df,0x164));var _0xf09d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x09df[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xf09d('0x0'));var util=require(_0xf09d('0x1'));var logger=require('../../config/logger')(_0xf09d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf09d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf09d('0x4'));var attributes=require(_0xf09d('0x5'));module['exports']=function(_0x4db4e7,_0x4b452b){return _0x4db4e7[_0xf09d('0x6')]('FaxQueueReport',attributes,{'tableName':_0xf09d('0x7'),'paranoid':![],'indexes':[{'name':_0xf09d('0x8'),'fields':[_0xf09d('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index b36fe19..618d52a 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 _0x361b=['debug','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateFaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','FaxQueueReport','update','where','attributes'];(function(_0x5254b5,_0x53ebdb){var _0x17f66a=function(_0x57051d){while(--_0x57051d){_0x5254b5['push'](_0x5254b5['shift']());}};_0x17f66a(++_0x53ebdb);}(_0x361b,0x8a));var _0xb361=function(_0x24e29c,_0x2a53d7){_0x24e29c=_0x24e29c-0x0;var _0x18721b=_0x361b[_0x24e29c];return _0x18721b;};'use strict';var _=require(_0xb361('0x0'));var util=require(_0xb361('0x1'));var moment=require('moment');var BPromise=require(_0xb361('0x2'));var rs=require(_0xb361('0x3'));var fs=require('fs');var Redis=require(_0xb361('0x4'));var db=require(_0xb361('0x5'))['db'];var utils=require(_0xb361('0x6'));var logger=require(_0xb361('0x7'))('rpc');var config=require(_0xb361('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb361('0x9')][_0xb361('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x327205,_0xff31,_0x1e2493){return new BPromise(function(_0x2910c4,_0x4fc320){return client[_0xb361('0xb')](_0x327205,_0x1e2493)[_0xb361('0xc')](function(_0x2a34f3){logger[_0xb361('0xd')](_0xb361('0xe'),_0xff31,_0xb361('0xf'));logger['debug'](_0xb361('0x10'),_0xff31,_0xb361('0xf'),JSON[_0xb361('0x11')](_0x2a34f3));if(_0x2a34f3[_0xb361('0x12')]){if(_0x2a34f3[_0xb361('0x12')][_0xb361('0x13')]===0x1f4){logger[_0xb361('0x12')](_0xb361('0xe'),_0xff31,_0x2a34f3['error'][_0xb361('0x14')]);return _0x4fc320(_0x2a34f3[_0xb361('0x12')]['message']);}logger[_0xb361('0x12')](_0xb361('0xe'),_0xff31,_0x2a34f3[_0xb361('0x12')][_0xb361('0x14')]);return _0x2910c4(_0x2a34f3['error'][_0xb361('0x14')]);}else{logger[_0xb361('0xd')](_0xb361('0xe'),_0xff31,_0xb361('0xf'));_0x2910c4(_0x2a34f3[_0xb361('0x15')][_0xb361('0x14')]);}})['catch'](function(_0x114ad1){logger[_0xb361('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0xff31,_0x114ad1);_0x4fc320(_0x114ad1);});});}exports[_0xb361('0x16')]=function(_0x481a47){var _0x1fd882=this;return new Promise(function(_0x741274,_0x1058f1){return db['FaxQueueReport'][_0xb361('0x17')](_0x481a47[_0xb361('0x18')],{'raw':_0x481a47[_0xb361('0x19')]?_0x481a47[_0xb361('0x19')][_0xb361('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x26d5f5){logger['info'](_0xb361('0x16'),_0x481a47);logger['debug'](_0xb361('0x16'),_0x481a47,JSON[_0xb361('0x11')](_0x26d5f5));_0x741274(_0x26d5f5);})['catch'](function(_0x3e8201){logger[_0xb361('0x12')](_0xb361('0x16'),_0x3e8201[_0xb361('0x14')],_0x481a47);_0x1058f1(_0x1fd882[_0xb361('0x12')](0x1f4,_0x3e8201[_0xb361('0x14')]));});});};exports[_0xb361('0x1b')]=function(_0x34fb7e){var _0x24d5c3=this;return new Promise(function(_0x8bc8b8,_0x313f75){return db[_0xb361('0x1c')][_0xb361('0x1d')](_0x34fb7e[_0xb361('0x18')],{'raw':_0x34fb7e[_0xb361('0x19')]?_0x34fb7e[_0xb361('0x19')][_0xb361('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34fb7e['options']?_0x34fb7e[_0xb361('0x19')][_0xb361('0x1e')]||null:null,'attributes':_0x34fb7e['options']?_0x34fb7e[_0xb361('0x19')][_0xb361('0x1f')]||null:null,'limit':_0x34fb7e[_0xb361('0x19')]?_0x34fb7e[_0xb361('0x19')]['limit']||null:null})['then'](function(_0x37267b){logger[_0xb361('0xd')]('UpdateFaxQueueReport',_0x34fb7e);logger[_0xb361('0x20')](_0xb361('0x1b'),_0x34fb7e,JSON[_0xb361('0x11')](_0x37267b));_0x8bc8b8(_0x37267b);})[_0xb361('0x21')](function(_0x949a2f){logger[_0xb361('0x12')]('UpdateFaxQueueReport',_0x949a2f[_0xb361('0x14')],_0x34fb7e);_0x313f75(_0x24d5c3[_0xb361('0x12')](0x1f4,_0x949a2f[_0xb361('0x14')]));});});}; \ No newline at end of file +var _0xcb87=['UpdateFaxQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','debug'];(function(_0x56dac8,_0xf9f741){var _0x1c0ad6=function(_0x220f2b){while(--_0x220f2b){_0x56dac8['push'](_0x56dac8['shift']());}};_0x1c0ad6(++_0xf9f741);}(_0xcb87,0x125));var _0x7cb8=function(_0x51bda1,_0x44f80d){_0x51bda1=_0x51bda1-0x0;var _0x1ce08c=_0xcb87[_0x51bda1];return _0x1ce08c;};'use strict';var _=require(_0x7cb8('0x0'));var util=require(_0x7cb8('0x1'));var moment=require(_0x7cb8('0x2'));var BPromise=require(_0x7cb8('0x3'));var rs=require(_0x7cb8('0x4'));var fs=require('fs');var Redis=require(_0x7cb8('0x5'));var db=require(_0x7cb8('0x6'))['db'];var utils=require(_0x7cb8('0x7'));var logger=require(_0x7cb8('0x8'))('rpc');var config=require(_0x7cb8('0x9'));var jayson=require(_0x7cb8('0xa'));var client=jayson[_0x7cb8('0xb')][_0x7cb8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4fd89c,_0x399705,_0x1b18f8){return new BPromise(function(_0x63b6fb,_0x17b27d){return client[_0x7cb8('0xd')](_0x4fd89c,_0x1b18f8)[_0x7cb8('0xe')](function(_0x3da5da){logger[_0x7cb8('0xf')](_0x7cb8('0x10'),_0x399705,_0x7cb8('0x11'));logger['debug'](_0x7cb8('0x12'),_0x399705,_0x7cb8('0x11'),JSON[_0x7cb8('0x13')](_0x3da5da));if(_0x3da5da[_0x7cb8('0x14')]){if(_0x3da5da[_0x7cb8('0x14')][_0x7cb8('0x15')]===0x1f4){logger['error'](_0x7cb8('0x10'),_0x399705,_0x3da5da[_0x7cb8('0x14')][_0x7cb8('0x16')]);return _0x17b27d(_0x3da5da[_0x7cb8('0x14')][_0x7cb8('0x16')]);}logger['error'](_0x7cb8('0x10'),_0x399705,_0x3da5da[_0x7cb8('0x14')][_0x7cb8('0x16')]);return _0x63b6fb(_0x3da5da[_0x7cb8('0x14')][_0x7cb8('0x16')]);}else{logger[_0x7cb8('0xf')](_0x7cb8('0x10'),_0x399705,'request\x20sent');_0x63b6fb(_0x3da5da['result'][_0x7cb8('0x16')]);}})[_0x7cb8('0x17')](function(_0x5e7851){logger[_0x7cb8('0x14')](_0x7cb8('0x10'),_0x399705,_0x5e7851);_0x17b27d(_0x5e7851);});});}exports[_0x7cb8('0x18')]=function(_0x38a2c6){var _0xc5169b=this;return new Promise(function(_0x17aa22,_0x406af0){return db[_0x7cb8('0x19')][_0x7cb8('0x1a')](_0x38a2c6[_0x7cb8('0x1b')],{'raw':_0x38a2c6[_0x7cb8('0x1c')]?_0x38a2c6['options'][_0x7cb8('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x3760f3){logger['info']('CreateFaxQueueReport',_0x38a2c6);logger[_0x7cb8('0x1e')](_0x7cb8('0x18'),_0x38a2c6,JSON[_0x7cb8('0x13')](_0x3760f3));_0x17aa22(_0x3760f3);})['catch'](function(_0x272cca){logger[_0x7cb8('0x14')](_0x7cb8('0x18'),_0x272cca[_0x7cb8('0x16')],_0x38a2c6);_0x406af0(_0xc5169b[_0x7cb8('0x14')](0x1f4,_0x272cca['message']));});});};exports[_0x7cb8('0x1f')]=function(_0x4d9108){var _0x222991=this;return new Promise(function(_0x47094c,_0x449907){return db[_0x7cb8('0x19')][_0x7cb8('0x20')](_0x4d9108[_0x7cb8('0x1b')],{'raw':_0x4d9108[_0x7cb8('0x1c')]?_0x4d9108[_0x7cb8('0x1c')][_0x7cb8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d9108[_0x7cb8('0x1c')]?_0x4d9108[_0x7cb8('0x1c')][_0x7cb8('0x21')]||null:null,'attributes':_0x4d9108[_0x7cb8('0x1c')]?_0x4d9108[_0x7cb8('0x1c')][_0x7cb8('0x22')]||null:null,'limit':_0x4d9108['options']?_0x4d9108[_0x7cb8('0x1c')][_0x7cb8('0x23')]||null:null})[_0x7cb8('0xe')](function(_0x32b7c5){logger['info'](_0x7cb8('0x1f'),_0x4d9108);logger[_0x7cb8('0x1e')](_0x7cb8('0x1f'),_0x4d9108,JSON[_0x7cb8('0x13')](_0x32b7c5));_0x47094c(_0x32b7c5);})[_0x7cb8('0x17')](function(_0x44a3aa){logger[_0x7cb8('0x14')](_0x7cb8('0x1f'),_0x44a3aa[_0x7cb8('0x16')],_0x4d9108);_0x449907(_0x222991['error'](0x1f4,_0x44a3aa['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index ce2ac18..198a560 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 _0xade6=['util','express','Router','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete','exports'];(function(_0x5f0ff3,_0xf76a10){var _0x2955e5=function(_0x3e20aa){while(--_0x3e20aa){_0x5f0ff3['push'](_0x5f0ff3['shift']());}};_0x2955e5(++_0xf76a10);}(_0xade6,0xbe));var _0x6ade=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0xade6[_0x533e4e];return _0x1f14bb;};'use strict';var multer=require('multer');var util=require(_0x6ade('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6ade('0x1'));var router=express[_0x6ade('0x2')]();var auth=require(_0x6ade('0x3'));var interaction=require(_0x6ade('0x4'));var config=require('../../config/environment');var controller=require(_0x6ade('0x5'));router[_0x6ade('0x6')]('/',auth[_0x6ade('0x7')](),controller[_0x6ade('0x8')]);router[_0x6ade('0x6')](_0x6ade('0x9'),auth['isAuthenticated'](),controller[_0x6ade('0xa')]);router[_0x6ade('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x6ade('0xb')]);router[_0x6ade('0xc')]('/',auth[_0x6ade('0x7')](),controller[_0x6ade('0xd')]);router[_0x6ade('0xe')](_0x6ade('0xf'),auth['isAuthenticated'](),controller[_0x6ade('0x10')]);router[_0x6ade('0x11')](_0x6ade('0xf'),auth[_0x6ade('0x7')](),controller['destroy']);module[_0x6ade('0x12')]=router; \ No newline at end of file +var _0x1557=['post','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','/describe','describe','get','/:id','show'];(function(_0x431247,_0x4777c7){var _0x361f2a=function(_0x11fe73){while(--_0x11fe73){_0x431247['push'](_0x431247['shift']());}};_0x361f2a(++_0x4777c7);}(_0x1557,0x77));var _0x7155=function(_0x51fa53,_0x437eb2){_0x51fa53=_0x51fa53-0x0;var _0x40144a=_0x1557[_0x51fa53];return _0x40144a;};'use strict';var multer=require(_0x7155('0x0'));var util=require('util');var path=require(_0x7155('0x1'));var timeout=require(_0x7155('0x2'));var express=require(_0x7155('0x3'));var router=express[_0x7155('0x4')]();var auth=require(_0x7155('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7155('0x6'));var controller=require(_0x7155('0x7'));router['get']('/',auth[_0x7155('0x8')](),controller['index']);router['get'](_0x7155('0x9'),auth[_0x7155('0x8')](),controller[_0x7155('0xa')]);router[_0x7155('0xb')](_0x7155('0xc'),auth['isAuthenticated'](),controller[_0x7155('0xd')]);router[_0x7155('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x7155('0x8')](),controller[_0x7155('0xf')]);router[_0x7155('0x10')]('/:id',auth[_0x7155('0x8')](),controller[_0x7155('0x11')]);module[_0x7155('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 3ed4721..f6ed58a 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 _0x7bd6=['account','agent','DATE','NOW','sequelize'];(function(_0x442b00,_0xb5aba8){var _0x22c43c=function(_0x2bef29){while(--_0x2bef29){_0x442b00['push'](_0x442b00['shift']());}};_0x22c43c(++_0xb5aba8);}(_0x7bd6,0xcc));var _0x67bd=function(_0x4a0e68,_0x45c08c){_0x4a0e68=_0x4a0e68-0x0;var _0x4fb274=_0x7bd6[_0x4a0e68];return _0x4fb274;};'use strict';var moment=require('moment');var Sequelize=require(_0x67bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x67bd('0x1'),_0x67bd('0x2'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x67bd('0x3')],'allowNull':![],'defaultValue':Sequelize[_0x67bd('0x4')]}}; \ No newline at end of file +var _0xc812=['ENUM','account','agent','queue','NOW','sequelize','exports'];(function(_0x1d4f6d,_0x2d86a3){var _0x5c515f=function(_0x56805d){while(--_0x56805d){_0x1d4f6d['push'](_0x1d4f6d['shift']());}};_0x5c515f(++_0x2d86a3);}(_0xc812,0x1d3));var _0x2c81=function(_0x32704f,_0x7fad76){_0x32704f=_0x32704f-0x0;var _0x5bdc34=_0xc812[_0x32704f];return _0x5bdc34;};'use strict';var moment=require('moment');var Sequelize=require(_0x2c81('0x0'));module[_0x2c81('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2c81('0x2')](_0x2c81('0x3'),_0x2c81('0x4'),_0x2c81('0x5')),'allowNull':![],'defaultValue':_0x2c81('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x2c81('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 9ba0bb1..465a0e5 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 _0x5f2f=['set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','fieldName','type','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','FaxTransferReport','then','include','rows','catch','show','params','intersection','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1ea87b,_0x2eaa91){_0x1ea87b=_0x1ea87b-0x0;var _0x333b57=_0x5f2f[_0x1ea87b];return _0x333b57;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var db=require(_0xf5f2('0x16'))['db'];function respondWithStatusCode(_0x14b51f,_0x331482){_0x331482=_0x331482||0xcc;return function(_0x3f2997){if(_0x3f2997){return _0x14b51f[_0xf5f2('0x17')](_0x331482);}return _0x14b51f[_0xf5f2('0x18')](_0x331482)['end']();};}function respondWithResult(_0x5850f4,_0xea612c){_0xea612c=_0xea612c||0xc8;return function(_0x269909){if(_0x269909){return _0x5850f4[_0xf5f2('0x18')](_0xea612c)[_0xf5f2('0x19')](_0x269909);}};}function respondWithFilteredResult(_0x4d97fc,_0xafe430){return function(_0x286197){if(_0x286197){var _0x17d656=_0x286197[_0xf5f2('0x1a')],_0x1b6dd2=_0xafe430[_0xf5f2('0x1b')],_0x23e23a=_0xafe430[_0xf5f2('0x1b')]+_0xafe430[_0xf5f2('0x1c')],_0x3a9dbb;if(_0x23e23a>=_0x17d656){_0x23e23a=_0x17d656;_0x3a9dbb=0xc8;}else{_0x3a9dbb=0xce;}_0x4d97fc[_0xf5f2('0x18')](_0x3a9dbb);return _0x4d97fc[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x1b6dd2+'-'+_0x23e23a+'/'+_0x17d656)[_0xf5f2('0x19')](_0x286197);}return null;};}function patchUpdates(_0x3cf5ea){return function(_0x626999){try{jsonpatch[_0xf5f2('0x1f')](_0x626999,_0x3cf5ea,!![]);}catch(_0x56acc5){return BPromise[_0xf5f2('0x20')](_0x56acc5);}return _0x626999[_0xf5f2('0x21')]();};}function saveUpdates(_0x49dac2,_0x47acfc){return function(_0x2d2805){if(_0x2d2805){return _0x2d2805[_0xf5f2('0x22')](_0x49dac2)['then'](function(_0x45b74f){return _0x45b74f;});}return null;};}function removeEntity(_0x170042,_0x39e44a){return function(_0x39c024){if(_0x39c024){return _0x39c024[_0xf5f2('0x23')]()['then'](function(){_0x170042[_0xf5f2('0x18')](0xcc)[_0xf5f2('0x24')]();});}};}function handleEntityNotFound(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(!_0x287ad5){_0x4e8bda['sendStatus'](0x194);}return _0x287ad5;};}function handleError(_0x529f07,_0x5f1124){_0x5f1124=_0x5f1124||0x1f4;return function(_0x3f79d5){logger[_0xf5f2('0x25')](_0x3f79d5[_0xf5f2('0x26')]);if(_0x3f79d5[_0xf5f2('0x27')]){delete _0x3f79d5[_0xf5f2('0x27')];}_0x529f07[_0xf5f2('0x18')](_0x5f1124)[_0xf5f2('0x28')](_0x3f79d5);};}exports[_0xf5f2('0x29')]=function(_0x4ab014,_0xaa2602){var _0x102449={},_0x375ca8={},_0x31bfcb={'count':0x0,'rows':[]};var _0x198c73=_[_0xf5f2('0x2a')](db['FaxTransferReport']['rawAttributes'],function(_0x22c826){return{'name':_0x22c826[_0xf5f2('0x2b')],'type':_0x22c826[_0xf5f2('0x2c')]['key']};});_0x375ca8['model']=_[_0xf5f2('0x2a')](_0x198c73,_0xf5f2('0x27'));_0x375ca8[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x4ab014[_0xf5f2('0x2d')]);_0x375ca8['filters']=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],_0x375ca8['query']);_0x102449[_0xf5f2('0x30')]=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x102449[_0xf5f2('0x30')]=_0x102449[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x102449[_0xf5f2('0x30')]:_0x375ca8['model'];if(!_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x33')](_0xf5f2('0x34'))){_0x102449[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x1c')]);_0x102449['offset']=qs[_0xf5f2('0x1b')](_0x4ab014[_0xf5f2('0x2d')]['offset']);}_0x102449[_0xf5f2('0x35')]=qs['sort'](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x36')]);_0x102449[_0xf5f2('0x37')]=qs[_0xf5f2('0x38')](_['pick'](_0x4ab014['query'],_0x375ca8[_0xf5f2('0x38')]),_0x198c73);if(_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]){_0x102449['where']=_[_0xf5f2('0x3a')](_0x102449['where'],{'$or':_[_0xf5f2('0x2a')](_0x198c73,function(_0x566c47){if(_0x566c47[_0xf5f2('0x2c')]!==_0xf5f2('0x3b')){var _0x5337a6={};_0x5337a6[_0x566c47[_0xf5f2('0x27')]]={'$like':'%'+_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]+'%'};return _0x5337a6;}})});}_0x102449=_[_0xf5f2('0x3a')]({},_0x102449,_0x4ab014['options']);var _0x5d2d82={'where':_0x102449[_0xf5f2('0x37')]};return db[_0xf5f2('0x3c')][_0xf5f2('0x1a')](_0x5d2d82)[_0xf5f2('0x3d')](function(_0x2c7f65){_0x31bfcb[_0xf5f2('0x1a')]=_0x2c7f65;if(_0x4ab014[_0xf5f2('0x2d')]['includeAll']){_0x102449[_0xf5f2('0x3e')]=[{'all':!![]}];}return db[_0xf5f2('0x3c')]['findAll'](_0x102449);})[_0xf5f2('0x3d')](function(_0x3f3895){_0x31bfcb[_0xf5f2('0x3f')]=_0x3f3895;return _0x31bfcb;})[_0xf5f2('0x3d')](respondWithFilteredResult(_0xaa2602,_0x102449))[_0xf5f2('0x40')](handleError(_0xaa2602,null));};exports[_0xf5f2('0x41')]=function(_0x462ea3,_0x2083b3){var _0x574f24={'raw':!![],'where':{'id':_0x462ea3[_0xf5f2('0x42')]['id']}},_0x31c3c={};_0x31c3c[_0xf5f2('0x2f')]=_['keys'](db['FaxTransferReport']['rawAttributes']);_0x31c3c[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x462ea3['query']);_0x31c3c[_0xf5f2('0x38')]=_[_0xf5f2('0x43')](_0x31c3c[_0xf5f2('0x2f')],_0x31c3c[_0xf5f2('0x2d')]);_0x574f24[_0xf5f2('0x30')]=_[_0xf5f2('0x43')](_0x31c3c[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x462ea3[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x574f24[_0xf5f2('0x30')]=_0x574f24[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x574f24[_0xf5f2('0x30')]:_0x31c3c['model'];if(_0x462ea3[_0xf5f2('0x2d')]['includeAll']){_0x574f24[_0xf5f2('0x3e')]=[{'all':!![]}];}_0x574f24=_[_0xf5f2('0x3a')]({},_0x574f24,_0x462ea3[_0xf5f2('0x44')]);return db[_0xf5f2('0x3c')][_0xf5f2('0x45')](_0x574f24)[_0xf5f2('0x3d')](handleEntityNotFound(_0x2083b3,null))['then'](respondWithResult(_0x2083b3,null))[_0xf5f2('0x40')](handleError(_0x2083b3,null));};exports[_0xf5f2('0x46')]=function(_0x1c1497,_0x29b108){return db[_0xf5f2('0x3c')][_0xf5f2('0x46')](_0x1c1497[_0xf5f2('0x47')],{})[_0xf5f2('0x3d')](respondWithResult(_0x29b108,0xc9))['catch'](handleError(_0x29b108,null));};exports[_0xf5f2('0x22')]=function(_0x33ec29,_0x45db9a){if(_0x33ec29['body']['id']){delete _0x33ec29[_0xf5f2('0x47')]['id'];}return db[_0xf5f2('0x3c')][_0xf5f2('0x45')]({'where':{'id':_0x33ec29['params']['id']}})['then'](handleEntityNotFound(_0x45db9a,null))[_0xf5f2('0x3d')](saveUpdates(_0x33ec29[_0xf5f2('0x47')],null))['then'](respondWithResult(_0x45db9a,null))[_0xf5f2('0x40')](handleError(_0x45db9a,null));};exports['destroy']=function(_0x740321,_0x497eb8){return db[_0xf5f2('0x3c')]['find']({'where':{'id':_0x740321[_0xf5f2('0x42')]['id']}})[_0xf5f2('0x3d')](handleEntityNotFound(_0x497eb8,null))[_0xf5f2('0x3d')](removeEntity(_0x497eb8,null))[_0xf5f2('0x40')](handleError(_0x497eb8,null));};exports['describe']=function(_0x3154c1,_0x2b782f){return db['FaxTransferReport']['describe']()[_0xf5f2('0x3d')](respondWithResult(_0x2b782f,null))[_0xf5f2('0x40')](handleError(_0x2b782f,null));}; \ No newline at end of file +var _0x2ef3=['send','index','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','sort','pick','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','limit','set','apply','reject','save','update','destroy','then','stack','name'];(function(_0x24a8e3,_0x31ee31){var _0x392f80=function(_0x3a845d){while(--_0x3a845d){_0x24a8e3['push'](_0x24a8e3['shift']());}};_0x392f80(++_0x31ee31);}(_0x2ef3,0xba));var _0x32ef=function(_0x39f078,_0xe663f6){_0x39f078=_0x39f078-0x0;var _0x311263=_0x2ef3[_0x39f078];return _0x311263;};'use strict';var pdf=require(_0x32ef('0x0'));var emlformat=require(_0x32ef('0x1'));var rimraf=require(_0x32ef('0x2'));var zipdir=require(_0x32ef('0x3'));var jsonpatch=require(_0x32ef('0x4'));var rp=require(_0x32ef('0x5'));var moment=require('moment');var BPromise=require(_0x32ef('0x6'));var Mustache=require(_0x32ef('0x7'));var util=require('util');var path=require(_0x32ef('0x8'));var sox=require(_0x32ef('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0xf'));var querystring=require(_0x32ef('0x10'));var Papa=require(_0x32ef('0x11'));var Redis=require(_0x32ef('0x12'));var authService=require(_0x32ef('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x14'));var logger=require(_0x32ef('0x15'))(_0x32ef('0x16'));var utils=require(_0x32ef('0x17'));var config=require('../../config/environment');var db=require(_0x32ef('0x18'))['db'];function respondWithStatusCode(_0x5afcc2,_0x1a5106){_0x1a5106=_0x1a5106||0xcc;return function(_0x49d590){if(_0x49d590){return _0x5afcc2[_0x32ef('0x19')](_0x1a5106);}return _0x5afcc2[_0x32ef('0x1a')](_0x1a5106)['end']();};}function respondWithResult(_0x539d18,_0x19ce1){_0x19ce1=_0x19ce1||0xc8;return function(_0x4d8009){if(_0x4d8009){return _0x539d18[_0x32ef('0x1a')](_0x19ce1)[_0x32ef('0x1b')](_0x4d8009);}};}function respondWithFilteredResult(_0x93d492,_0x54c7f5){return function(_0x57aff1){if(_0x57aff1){var _0x55bf0b=_0x57aff1[_0x32ef('0x1c')],_0x531e30=_0x54c7f5['offset'],_0x13db1a=_0x54c7f5['offset']+_0x54c7f5[_0x32ef('0x1d')],_0x3950e6;if(_0x13db1a>=_0x55bf0b){_0x13db1a=_0x55bf0b;_0x3950e6=0xc8;}else{_0x3950e6=0xce;}_0x93d492[_0x32ef('0x1a')](_0x3950e6);return _0x93d492[_0x32ef('0x1e')]('Content-Range',_0x531e30+'-'+_0x13db1a+'/'+_0x55bf0b)[_0x32ef('0x1b')](_0x57aff1);}return null;};}function patchUpdates(_0x33e230){return function(_0x4f4c98){try{jsonpatch[_0x32ef('0x1f')](_0x4f4c98,_0x33e230,!![]);}catch(_0x314ef1){return BPromise[_0x32ef('0x20')](_0x314ef1);}return _0x4f4c98[_0x32ef('0x21')]();};}function saveUpdates(_0x445cda,_0x3aec05){return function(_0x4de441){if(_0x4de441){return _0x4de441[_0x32ef('0x22')](_0x445cda)['then'](function(_0x309866){return _0x309866;});}return null;};}function removeEntity(_0x3a20ca,_0x49f2d8){return function(_0x1af371){if(_0x1af371){return _0x1af371[_0x32ef('0x23')]()[_0x32ef('0x24')](function(){_0x3a20ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(!_0x225feb){_0x22f2d7['sendStatus'](0x194);}return _0x225feb;};}function handleError(_0x59585f,_0x19ea6){_0x19ea6=_0x19ea6||0x1f4;return function(_0x4d584b){logger['error'](_0x4d584b[_0x32ef('0x25')]);if(_0x4d584b[_0x32ef('0x26')]){delete _0x4d584b[_0x32ef('0x26')];}_0x59585f[_0x32ef('0x1a')](_0x19ea6)[_0x32ef('0x27')](_0x4d584b);};}exports[_0x32ef('0x28')]=function(_0x1874ea,_0x38aed5){var _0x338f19={},_0x2f52d7={},_0x1335e2={'count':0x0,'rows':[]};var _0xba4b3f=_['map'](db[_0x32ef('0x29')][_0x32ef('0x2a')],function(_0x5a04cd){return{'name':_0x5a04cd[_0x32ef('0x2b')],'type':_0x5a04cd[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x2f52d7[_0x32ef('0x2e')]=_['map'](_0xba4b3f,_0x32ef('0x26'));_0x2f52d7[_0x32ef('0x2f')]=_[_0x32ef('0x30')](_0x1874ea[_0x32ef('0x2f')]);_0x2f52d7[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2f52d7[_0x32ef('0x2e')],_0x2f52d7['query']);_0x338f19[_0x32ef('0x33')]=_['intersection'](_0x2f52d7[_0x32ef('0x2e')],qs[_0x32ef('0x34')](_0x1874ea['query'][_0x32ef('0x34')]));_0x338f19[_0x32ef('0x33')]=_0x338f19[_0x32ef('0x33')][_0x32ef('0x35')]?_0x338f19[_0x32ef('0x33')]:_0x2f52d7['model'];if(!_0x1874ea['query'][_0x32ef('0x36')]('nolimit')){_0x338f19[_0x32ef('0x1d')]=qs[_0x32ef('0x1d')](_0x1874ea[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x338f19[_0x32ef('0x37')]=qs[_0x32ef('0x37')](_0x1874ea['query']['offset']);}_0x338f19['order']=qs[_0x32ef('0x38')](_0x1874ea[_0x32ef('0x2f')][_0x32ef('0x38')]);_0x338f19['where']=qs['filters'](_[_0x32ef('0x39')](_0x1874ea[_0x32ef('0x2f')],_0x2f52d7[_0x32ef('0x31')]),_0xba4b3f);if(_0x1874ea['query']['filter']){_0x338f19[_0x32ef('0x3a')]=_[_0x32ef('0x3b')](_0x338f19[_0x32ef('0x3a')],{'$or':_[_0x32ef('0x3c')](_0xba4b3f,function(_0x3a7c49){if(_0x3a7c49[_0x32ef('0x2c')]!==_0x32ef('0x3d')){var _0x21da90={};_0x21da90[_0x3a7c49[_0x32ef('0x26')]]={'$like':'%'+_0x1874ea['query'][_0x32ef('0x3e')]+'%'};return _0x21da90;}})});}_0x338f19=_[_0x32ef('0x3b')]({},_0x338f19,_0x1874ea[_0x32ef('0x3f')]);var _0x4b97dc={'where':_0x338f19[_0x32ef('0x3a')]};return db[_0x32ef('0x29')][_0x32ef('0x1c')](_0x4b97dc)[_0x32ef('0x24')](function(_0x1faf72){_0x1335e2[_0x32ef('0x1c')]=_0x1faf72;if(_0x1874ea[_0x32ef('0x2f')][_0x32ef('0x40')]){_0x338f19[_0x32ef('0x41')]=[{'all':!![]}];}return db[_0x32ef('0x29')][_0x32ef('0x42')](_0x338f19);})[_0x32ef('0x24')](function(_0x48e071){_0x1335e2[_0x32ef('0x43')]=_0x48e071;return _0x1335e2;})[_0x32ef('0x24')](respondWithFilteredResult(_0x38aed5,_0x338f19))[_0x32ef('0x44')](handleError(_0x38aed5,null));};exports[_0x32ef('0x45')]=function(_0x2f92f5,_0x2ca66b){var _0x3c0e44={'raw':!![],'where':{'id':_0x2f92f5['params']['id']}},_0x596d5a={};_0x596d5a[_0x32ef('0x2e')]=_[_0x32ef('0x30')](db[_0x32ef('0x29')][_0x32ef('0x2a')]);_0x596d5a['query']=_[_0x32ef('0x30')](_0x2f92f5[_0x32ef('0x2f')]);_0x596d5a['filters']=_[_0x32ef('0x32')](_0x596d5a['model'],_0x596d5a[_0x32ef('0x2f')]);_0x3c0e44[_0x32ef('0x33')]=_[_0x32ef('0x32')](_0x596d5a[_0x32ef('0x2e')],qs[_0x32ef('0x34')](_0x2f92f5[_0x32ef('0x2f')][_0x32ef('0x34')]));_0x3c0e44[_0x32ef('0x33')]=_0x3c0e44[_0x32ef('0x33')][_0x32ef('0x35')]?_0x3c0e44['attributes']:_0x596d5a[_0x32ef('0x2e')];if(_0x2f92f5['query'][_0x32ef('0x40')]){_0x3c0e44[_0x32ef('0x41')]=[{'all':!![]}];}_0x3c0e44=_[_0x32ef('0x3b')]({},_0x3c0e44,_0x2f92f5['options']);return db[_0x32ef('0x29')][_0x32ef('0x46')](_0x3c0e44)[_0x32ef('0x24')](handleEntityNotFound(_0x2ca66b,null))[_0x32ef('0x24')](respondWithResult(_0x2ca66b,null))[_0x32ef('0x44')](handleError(_0x2ca66b,null));};exports[_0x32ef('0x47')]=function(_0x12c9e6,_0x47dbe1){return db['FaxTransferReport'][_0x32ef('0x47')](_0x12c9e6[_0x32ef('0x48')],{})[_0x32ef('0x24')](respondWithResult(_0x47dbe1,0xc9))[_0x32ef('0x44')](handleError(_0x47dbe1,null));};exports[_0x32ef('0x22')]=function(_0xd67dc9,_0x44ad11){if(_0xd67dc9[_0x32ef('0x48')]['id']){delete _0xd67dc9[_0x32ef('0x48')]['id'];}return db[_0x32ef('0x29')][_0x32ef('0x46')]({'where':{'id':_0xd67dc9[_0x32ef('0x49')]['id']}})[_0x32ef('0x24')](handleEntityNotFound(_0x44ad11,null))['then'](saveUpdates(_0xd67dc9[_0x32ef('0x48')],null))[_0x32ef('0x24')](respondWithResult(_0x44ad11,null))[_0x32ef('0x44')](handleError(_0x44ad11,null));};exports[_0x32ef('0x23')]=function(_0x1cc9f3,_0x4353f0){return db[_0x32ef('0x29')][_0x32ef('0x46')]({'where':{'id':_0x1cc9f3[_0x32ef('0x49')]['id']}})[_0x32ef('0x24')](handleEntityNotFound(_0x4353f0,null))[_0x32ef('0x24')](removeEntity(_0x4353f0,null))[_0x32ef('0x44')](handleError(_0x4353f0,null));};exports[_0x32ef('0x4a')]=function(_0x326445,_0x307ac8){return db[_0x32ef('0x29')][_0x32ef('0x4a')]()[_0x32ef('0x24')](respondWithResult(_0x307ac8,null))['catch'](handleError(_0x307ac8,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index eb69f44..e8ea9de 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 _0x8149=['bluebird','request-promise','path','rimraf','../../config/environment','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','api','moment'];(function(_0x2f1718,_0x493cef){var _0x358266=function(_0x53834e){while(--_0x53834e){_0x2f1718['push'](_0x2f1718['shift']());}};_0x358266(++_0x493cef);}(_0x8149,0xe6));var _0x9814=function(_0x527b5e,_0x538bac){_0x527b5e=_0x527b5e-0x0;var _0xc812ad=_0x8149[_0x527b5e];return _0xc812ad;};'use strict';var _=require(_0x9814('0x0'));var util=require(_0x9814('0x1'));var logger=require('../../config/logger')(_0x9814('0x2'));var moment=require(_0x9814('0x3'));var BPromise=require(_0x9814('0x4'));var rp=require(_0x9814('0x5'));var fs=require('fs');var path=require(_0x9814('0x6'));var rimraf=require(_0x9814('0x7'));var config=require(_0x9814('0x8'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x2f2711,_0x513264){return _0x2f2711[_0x9814('0x9')](_0x9814('0xa'),attributes,{'tableName':_0x9814('0xb'),'paranoid':![],'indexes':[{'name':_0x9814('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x47c0=['request-promise','path','rimraf','../../config/environment','exports','define','report_fax_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0xa7056,_0x4245a3){var _0xc8452d=function(_0x34f537){while(--_0x34f537){_0xa7056['push'](_0xa7056['shift']());}};_0xc8452d(++_0x4245a3);}(_0x47c0,0x1dc));var _0x047c=function(_0x18fd05,_0x47d555){_0x18fd05=_0x18fd05-0x0;var _0x2c76b6=_0x47c0[_0x18fd05];return _0x2c76b6;};'use strict';var _=require(_0x047c('0x0'));var util=require(_0x047c('0x1'));var logger=require(_0x047c('0x2'))('api');var moment=require(_0x047c('0x3'));var BPromise=require(_0x047c('0x4'));var rp=require(_0x047c('0x5'));var fs=require('fs');var path=require(_0x047c('0x6'));var rimraf=require(_0x047c('0x7'));var config=require(_0x047c('0x8'));var attributes=require('./faxTransferReport.attributes');module[_0x047c('0x9')]=function(_0x521b31,_0x11344f){return _0x521b31[_0x047c('0xa')]('FaxTransferReport',attributes,{'tableName':_0x047c('0xb'),'paranoid':![],'indexes':[{'name':_0x047c('0xc'),'fields':[_0x047c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index b76beec..17f7653 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 _0x3648=['jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5f2079,_0x21d9cc){var _0x29cdd4=function(_0x2f59e0){while(--_0x2f59e0){_0x5f2079['push'](_0x5f2079['shift']());}};_0x29cdd4(++_0x21d9cc);}(_0x3648,0x109));var _0x8364=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3648[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8364('0x0'));var util=require(_0x8364('0x1'));var moment=require(_0x8364('0x2'));var BPromise=require(_0x8364('0x3'));var rs=require(_0x8364('0x4'));var fs=require('fs');var Redis=require(_0x8364('0x5'));var db=require(_0x8364('0x6'))['db'];var utils=require(_0x8364('0x7'));var logger=require(_0x8364('0x8'))(_0x8364('0x9'));var config=require('../../config/environment');var jayson=require(_0x8364('0xa'));var client=jayson[_0x8364('0xb')][_0x8364('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ed66c,_0x29816f,_0x56087a){return new BPromise(function(_0x4e9279,_0x534eec){return client[_0x8364('0xd')](_0x2ed66c,_0x56087a)[_0x8364('0xe')](function(_0x26ea44){logger[_0x8364('0xf')](_0x8364('0x10'),_0x29816f,_0x8364('0x11'));logger[_0x8364('0x12')](_0x8364('0x13'),_0x29816f,'request\x20sent',JSON['stringify'](_0x26ea44));if(_0x26ea44[_0x8364('0x14')]){if(_0x26ea44['error'][_0x8364('0x15')]===0x1f4){logger[_0x8364('0x14')](_0x8364('0x10'),_0x29816f,_0x26ea44['error'][_0x8364('0x16')]);return _0x534eec(_0x26ea44['error'][_0x8364('0x16')]);}logger[_0x8364('0x14')](_0x8364('0x10'),_0x29816f,_0x26ea44[_0x8364('0x14')]['message']);return _0x4e9279(_0x26ea44[_0x8364('0x14')][_0x8364('0x16')]);}else{logger['info'](_0x8364('0x10'),_0x29816f,_0x8364('0x11'));_0x4e9279(_0x26ea44[_0x8364('0x17')][_0x8364('0x16')]);}})[_0x8364('0x18')](function(_0x5f0309){logger[_0x8364('0x14')](_0x8364('0x10'),_0x29816f,_0x5f0309);_0x534eec(_0x5f0309);});});} \ No newline at end of file +var _0x4cdc=['jayson/promise','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','info','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1dbb97,_0xc2e02f){var _0x57612f=function(_0x5e9ffc){while(--_0x5e9ffc){_0x1dbb97['push'](_0x1dbb97['shift']());}};_0x57612f(++_0xc2e02f);}(_0x4cdc,0xb5));var _0xc4cd=function(_0x2cd706,_0x48112d){_0x2cd706=_0x2cd706-0x0;var _0x446369=_0x4cdc[_0x2cd706];return _0x446369;};'use strict';var _=require(_0xc4cd('0x0'));var util=require(_0xc4cd('0x1'));var moment=require('moment');var BPromise=require(_0xc4cd('0x2'));var rs=require(_0xc4cd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc4cd('0x4'))['db'];var utils=require(_0xc4cd('0x5'));var logger=require(_0xc4cd('0x6'))(_0xc4cd('0x7'));var config=require('../../config/environment');var jayson=require(_0xc4cd('0x8'));var client=jayson['client'][_0xc4cd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x412f09,_0x37570a,_0x1609bb){return new BPromise(function(_0x23f5b0,_0x1da3b0){return client[_0xc4cd('0xa')](_0x412f09,_0x1609bb)[_0xc4cd('0xb')](function(_0x356303){logger['info'](_0xc4cd('0xc'),_0x37570a,_0xc4cd('0xd'));logger[_0xc4cd('0xe')](_0xc4cd('0xf'),_0x37570a,'request\x20sent',JSON['stringify'](_0x356303));if(_0x356303['error']){if(_0x356303['error'][_0xc4cd('0x10')]===0x1f4){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x37570a,_0x356303[_0xc4cd('0x11')][_0xc4cd('0x12')]);return _0x1da3b0(_0x356303['error'][_0xc4cd('0x12')]);}logger[_0xc4cd('0x11')](_0xc4cd('0xc'),_0x37570a,_0x356303[_0xc4cd('0x11')][_0xc4cd('0x12')]);return _0x23f5b0(_0x356303[_0xc4cd('0x11')]['message']);}else{logger[_0xc4cd('0x13')](_0xc4cd('0xc'),_0x37570a,_0xc4cd('0xd'));_0x23f5b0(_0x356303['result'][_0xc4cd('0x12')]);}})[_0xc4cd('0x14')](function(_0x48888c){logger[_0xc4cd('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x37570a,_0x48888c);_0x1da3b0(_0x48888c);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 9247be9..6f1c158 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 _0x66ad=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','index','get','/describe','describe','/:id','show','isAuthenticated','create','put','update','destroy','exports','multer','path'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x66ad,0x1a2));var _0xd66a=function(_0x5bc901,_0x2ccdb5){_0x5bc901=_0x5bc901-0x0;var _0x516f31=_0x66ad[_0x5bc901];return _0x516f31;};'use strict';var multer=require(_0xd66a('0x0'));var util=require('util');var path=require(_0xd66a('0x1'));var timeout=require(_0xd66a('0x2'));var express=require(_0xd66a('0x3'));var router=express['Router']();var auth=require(_0xd66a('0x4'));var interaction=require(_0xd66a('0x5'));var config=require(_0xd66a('0x6'));var controller=require(_0xd66a('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd66a('0x8')]);router[_0xd66a('0x9')](_0xd66a('0xa'),auth['isAuthenticated'](),controller[_0xd66a('0xb')]);router[_0xd66a('0x9')](_0xd66a('0xc'),auth['isAuthenticated'](),controller[_0xd66a('0xd')]);router['post']('/',auth[_0xd66a('0xe')](),controller[_0xd66a('0xf')]);router[_0xd66a('0x10')](_0xd66a('0xc'),auth['isAuthenticated'](),controller[_0xd66a('0x11')]);router['delete']('/:id',auth[_0xd66a('0xe')](),controller[_0xd66a('0x12')]);module[_0xd66a('0x13')]=router; \ No newline at end of file +var _0x6128=['show','post','create','put','destroy','exports','multer','connect-timeout','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x6128,0x7e));var _0x8612=function(_0x3f93aa,_0x18c17c){_0x3f93aa=_0x3f93aa-0x0;var _0x5453cf=_0x6128[_0x3f93aa];return _0x5453cf;};'use strict';var multer=require(_0x8612('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8612('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8612('0x2'));var config=require(_0x8612('0x3'));var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0x8612('0x4')](),controller[_0x8612('0x5')]);router[_0x8612('0x6')]('/describe',auth[_0x8612('0x4')](),controller[_0x8612('0x7')]);router[_0x8612('0x6')](_0x8612('0x8'),auth['isAuthenticated'](),controller[_0x8612('0x9')]);router[_0x8612('0xa')]('/',auth[_0x8612('0x4')](),controller[_0x8612('0xb')]);router[_0x8612('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x8612('0x8'),auth[_0x8612('0x4')](),controller[_0x8612('0xd')]);module[_0x8612('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 0269251..80a6227 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 _0x4300=['destroy','exports','multer','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','get','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','/:id'];(function(_0x549943,_0x222088){var _0x4947b7=function(_0xa74e4a){while(--_0xa74e4a){_0x549943['push'](_0x549943['shift']());}};_0x4947b7(++_0x222088);}(_0x4300,0x1a6));var _0x0430=function(_0x5a46c5,_0x5f1cfe){_0x5a46c5=_0x5a46c5-0x0;var _0xe2768a=_0x4300[_0x5a46c5];return _0xe2768a;};'use strict';var multer=require(_0x0430('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0430('0x1')]();var auth=require(_0x0430('0x2'));var interaction=require(_0x0430('0x3'));var config=require(_0x0430('0x4'));var controller=require(_0x0430('0x5'));router['get']('/',auth[_0x0430('0x6')](),controller['index']);router[_0x0430('0x7')]('/:id',auth[_0x0430('0x6')](),controller[_0x0430('0x8')]);router[_0x0430('0x7')](_0x0430('0x9'),auth[_0x0430('0x6')](),controller[_0x0430('0xa')]);router[_0x0430('0x7')](_0x0430('0xb'),auth[_0x0430('0x6')](),controller['getFields']);router[_0x0430('0xc')]('/',auth[_0x0430('0x6')](),controller[_0x0430('0xd')]);router[_0x0430('0xc')](_0x0430('0x9'),auth[_0x0430('0x6')](),controller[_0x0430('0xe')]);router[_0x0430('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x0430('0x10')]);router[_0x0430('0x11')](_0x0430('0x12'),auth[_0x0430('0x6')](),controller[_0x0430('0x13')]);module[_0x0430('0x14')]=router; \ No newline at end of file +var _0x6f47=['destroy','util','path','express','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','delete'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x6f47,0xc7));var _0x76f4=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6f47[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x76f4('0x0'));var path=require(_0x76f4('0x1'));var timeout=require('connect-timeout');var express=require(_0x76f4('0x2'));var router=express['Router']();var auth=require(_0x76f4('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x76f4('0x4'));var controller=require(_0x76f4('0x5'));router[_0x76f4('0x6')]('/',auth[_0x76f4('0x7')](),controller['index']);router[_0x76f4('0x6')](_0x76f4('0x8'),auth[_0x76f4('0x7')](),controller['show']);router[_0x76f4('0x6')](_0x76f4('0x9'),auth[_0x76f4('0x7')](),controller[_0x76f4('0xa')]);router[_0x76f4('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0x76f4('0xb')]);router[_0x76f4('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x76f4('0xc')](_0x76f4('0x9'),auth[_0x76f4('0x7')](),controller[_0x76f4('0xd')]);router[_0x76f4('0xe')](_0x76f4('0x8'),auth[_0x76f4('0x7')](),controller[_0x76f4('0xf')]);router[_0x76f4('0x10')]('/:id',auth[_0x76f4('0x7')](),controller[_0x76f4('0x11')]);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 86a0ea4..00a3f02 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 _0xde94=['sequelize','exports','STRING','ENUM','basic','integrationTab'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xde94,0x144));var _0x4de9=function(_0x13c1bc,_0x50f416){_0x13c1bc=_0x13c1bc-0x0;var _0x1d3cbc=_0xde94[_0x13c1bc];return _0x1d3cbc;};'use strict';var Sequelize=require(_0x4de9('0x0'));module[_0x4de9('0x1')]={'name':{'type':Sequelize[_0x4de9('0x2')]},'description':{'type':Sequelize[_0x4de9('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4de9('0x2')]},'authType':{'type':Sequelize[_0x4de9('0x3')](_0x4de9('0x4')),'defaultValue':_0x4de9('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x4de9('0x2')]},'consumerSecret':{'type':Sequelize[_0x4de9('0x2')]},'token':{'type':Sequelize[_0x4de9('0x2')]},'tokenSecret':{'type':Sequelize[_0x4de9('0x2')]},'serverUrl':{'type':Sequelize[_0x4de9('0x2')]},'type':{'type':Sequelize[_0x4de9('0x3')](_0x4de9('0x5'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x40b4=['exports','STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x40b4,0x76));var _0x440b=function(_0x1f77be,_0x1ea03c){_0x1f77be=_0x1f77be-0x0;var _0x349b38=_0x40b4[_0x1f77be];return _0x349b38;};'use strict';var Sequelize=require(_0x440b('0x0'));module[_0x440b('0x1')]={'name':{'type':Sequelize[_0x440b('0x2')]},'description':{'type':Sequelize[_0x440b('0x2')]},'username':{'type':Sequelize[_0x440b('0x2')]},'remoteUri':{'type':Sequelize[_0x440b('0x2')]},'authType':{'type':Sequelize[_0x440b('0x3')]('basic'),'defaultValue':_0x440b('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x440b('0x2')]},'consumerSecret':{'type':Sequelize[_0x440b('0x2')]},'token':{'type':Sequelize[_0x440b('0x2')]},'tokenSecret':{'type':Sequelize[_0x440b('0x2')]},'serverUrl':{'type':Sequelize[_0x440b('0x2')]},'type':{'type':Sequelize[_0x440b('0x3')](_0x440b('0x5'),_0x440b('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 89d47f2..84cc2e9 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 _0x8cb0=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','debug','request\x20sent','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','status','end','json','offset','set','Content-Range','apply','reject','save','destroy','sendStatus','send','index','DeskAccount','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','count','includeAll','include','show','params','rawAttributes','find','catch','create','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','authType','username','password','consumerSecret','token','tokenSecret','remoteUri','substring','format','%s/custom_fields','application/json','Authorization','Basic\x20%s','%s:%s','toString','base64','_embedded','entries','name','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x54cb5c,_0x4a446a){var _0x154f9c=function(_0x1e0958){while(--_0x1e0958){_0x54cb5c['push'](_0x54cb5c['shift']());}};_0x154f9c(++_0x4a446a);}(_0x8cb0,0xe3));var _0x08cb=function(_0x385cac,_0x14bb54){_0x385cac=_0x385cac-0x0;var _0x1b212f=_0x8cb0[_0x385cac];return _0x1b212f;};'use strict';var pdf=require(_0x08cb('0x0'));var emlformat=require(_0x08cb('0x1'));var rimraf=require(_0x08cb('0x2'));var zipdir=require(_0x08cb('0x3'));var jsonpatch=require(_0x08cb('0x4'));var rp=require(_0x08cb('0x5'));var moment=require(_0x08cb('0x6'));var BPromise=require(_0x08cb('0x7'));var Mustache=require(_0x08cb('0x8'));var util=require(_0x08cb('0x9'));var path=require(_0x08cb('0xa'));var sox=require(_0x08cb('0xb'));var csv=require(_0x08cb('0xc'));var ejs=require(_0x08cb('0xd'));var fs=require('fs');var _=require(_0x08cb('0xe'));var squel=require(_0x08cb('0xf'));var crypto=require('crypto');var jsforce=require(_0x08cb('0x10'));var deskjs=require(_0x08cb('0x11'));var toCsv=require(_0x08cb('0xc'));var querystring=require(_0x08cb('0x12'));var Papa=require(_0x08cb('0x13'));var Redis=require(_0x08cb('0x14'));var authService=require(_0x08cb('0x15'));var qs=require(_0x08cb('0x16'));var as=require(_0x08cb('0x17'));var hardwareService=require(_0x08cb('0x18'));var logger=require(_0x08cb('0x19'))('api');var utils=require(_0x08cb('0x1a'));var config=require('../../config/environment');var db=require(_0x08cb('0x1b'))['db'];var integrations=require(_0x08cb('0x1c'));var jayson=require(_0x08cb('0x1d'));var client=jayson[_0x08cb('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0x54a969,_0x27fd2a,_0x116593){if(_0x116593){var _0x4efa8f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4efa8f[_0x08cb('0x1f')](_0x27fd2a)){return _0x54a969;}else{throw new db[(_0x08cb('0x20'))]['ValidationError'](_0x08cb('0x21'));}}else{return _0x54a969;}}function respondWithRpcPromise(_0x1cc127,_0x5a5634,_0x1f60b2,_0x1a622c){return new BPromise(function(_0x4c20b8,_0x459203){var _0x253432=_0x1a622c||client;return _0x253432[_0x08cb('0x22')](_0x1cc127,_0x1f60b2)[_0x08cb('0x23')](function(_0x378815){logger[_0x08cb('0x24')]('DeskAccount,\x20%s,\x20%s',_0x5a5634,'request\x20sent');logger[_0x08cb('0x25')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x5a5634,_0x08cb('0x26'),JSON[_0x08cb('0x27')](_0x378815));if(_0x378815[_0x08cb('0x28')]){if(_0x378815[_0x08cb('0x28')][_0x08cb('0x29')]===0x1f4){logger[_0x08cb('0x28')](_0x08cb('0x2a'),_0x5a5634,_0x378815[_0x08cb('0x28')][_0x08cb('0x2b')]);return _0x459203(_0x378815[_0x08cb('0x28')][_0x08cb('0x2b')]);}logger['error'](_0x08cb('0x2a'),_0x5a5634,_0x378815[_0x08cb('0x28')][_0x08cb('0x2b')]);return _0x4c20b8(_0x378815['error'][_0x08cb('0x2b')]);}else{logger['info'](_0x08cb('0x2a'),_0x5a5634,_0x08cb('0x26'));_0x4c20b8(_0x378815[_0x08cb('0x2c')]['message']);}})['catch'](function(_0x43231a){logger[_0x08cb('0x28')](_0x08cb('0x2a'),_0x5a5634,_0x43231a);_0x459203(_0x43231a);});});}function respondWithStatusCode(_0xbcc784,_0x394a0b){_0x394a0b=_0x394a0b||0xcc;return function(_0x107b8a){if(_0x107b8a){return _0xbcc784['sendStatus'](_0x394a0b);}return _0xbcc784[_0x08cb('0x2d')](_0x394a0b)[_0x08cb('0x2e')]();};}function respondWithResult(_0x1efe8f,_0x25c3fe){_0x25c3fe=_0x25c3fe||0xc8;return function(_0x5c4b65){if(_0x5c4b65){return _0x1efe8f[_0x08cb('0x2d')](_0x25c3fe)[_0x08cb('0x2f')](_0x5c4b65);}};}function respondWithFilteredResult(_0x180cf6,_0x1ebbb4){return function(_0x4cf2aa){if(_0x4cf2aa){var _0x550576=_0x4cf2aa['count'],_0x1193f1=_0x1ebbb4[_0x08cb('0x30')],_0x4f4e46=_0x1ebbb4['offset']+_0x1ebbb4['limit'],_0x549a83;if(_0x4f4e46>=_0x550576){_0x4f4e46=_0x550576;_0x549a83=0xc8;}else{_0x549a83=0xce;}_0x180cf6[_0x08cb('0x2d')](_0x549a83);return _0x180cf6[_0x08cb('0x31')](_0x08cb('0x32'),_0x1193f1+'-'+_0x4f4e46+'/'+_0x550576)[_0x08cb('0x2f')](_0x4cf2aa);}return null;};}function patchUpdates(_0x52f165){return function(_0x40bf17){try{jsonpatch[_0x08cb('0x33')](_0x40bf17,_0x52f165,!![]);}catch(_0x83a31f){return BPromise[_0x08cb('0x34')](_0x83a31f);}return _0x40bf17[_0x08cb('0x35')]();};}function saveUpdates(_0x5c5fbc,_0x1c1ab1){return function(_0x1fcd77){if(_0x1fcd77){return _0x1fcd77['update'](_0x5c5fbc)[_0x08cb('0x23')](function(_0x23076e){return _0x23076e;});}return null;};}function removeEntity(_0x38bd7c,_0x576b6b){return function(_0xbe9e2c){if(_0xbe9e2c){return _0xbe9e2c[_0x08cb('0x36')]()[_0x08cb('0x23')](function(){_0x38bd7c[_0x08cb('0x2d')](0xcc)[_0x08cb('0x2e')]();});}};}function handleEntityNotFound(_0x485548,_0x4bc17e){return function(_0x1b6f6b){if(!_0x1b6f6b){_0x485548[_0x08cb('0x37')](0x194);}return _0x1b6f6b;};}function handleError(_0xe35cae,_0x5cd41e){_0x5cd41e=_0x5cd41e||0x1f4;return function(_0x36e21f){logger[_0x08cb('0x28')](_0x36e21f['stack']);if(_0x36e21f['name']){delete _0x36e21f['name'];}_0xe35cae['status'](_0x5cd41e)[_0x08cb('0x38')](_0x36e21f);};}exports[_0x08cb('0x39')]=function(_0x33c758,_0x590e13){var _0x112294={},_0x361390={},_0x2daa13={'count':0x0,'rows':[]};var _0x1e604d=_['map'](db[_0x08cb('0x3a')]['rawAttributes'],function(_0x49b36a){return{'name':_0x49b36a[_0x08cb('0x3b')],'type':_0x49b36a[_0x08cb('0x3c')]['key']};});_0x361390[_0x08cb('0x3d')]=_[_0x08cb('0x3e')](_0x1e604d,'name');_0x361390[_0x08cb('0x3f')]=_[_0x08cb('0x40')](_0x33c758[_0x08cb('0x3f')]);_0x361390[_0x08cb('0x41')]=_[_0x08cb('0x42')](_0x361390['model'],_0x361390['query']);_0x112294[_0x08cb('0x43')]=_[_0x08cb('0x42')](_0x361390[_0x08cb('0x3d')],qs[_0x08cb('0x44')](_0x33c758[_0x08cb('0x3f')][_0x08cb('0x44')]));_0x112294[_0x08cb('0x43')]=_0x112294[_0x08cb('0x43')][_0x08cb('0x45')]?_0x112294[_0x08cb('0x43')]:_0x361390['model'];if(!_0x33c758['query'][_0x08cb('0x46')](_0x08cb('0x47'))){_0x112294[_0x08cb('0x48')]=qs[_0x08cb('0x48')](_0x33c758[_0x08cb('0x3f')][_0x08cb('0x48')]);_0x112294[_0x08cb('0x30')]=qs[_0x08cb('0x30')](_0x33c758[_0x08cb('0x3f')][_0x08cb('0x30')]);}_0x112294[_0x08cb('0x49')]=qs['sort'](_0x33c758[_0x08cb('0x3f')][_0x08cb('0x4a')]);_0x112294[_0x08cb('0x4b')]=qs['filters'](_[_0x08cb('0x4c')](_0x33c758['query'],_0x361390[_0x08cb('0x41')]),_0x1e604d);if(_0x33c758[_0x08cb('0x3f')][_0x08cb('0x4d')]){_0x112294[_0x08cb('0x4b')]=_['merge'](_0x112294[_0x08cb('0x4b')],{'$or':_[_0x08cb('0x3e')](_0x1e604d,function(_0x516e04){if(_0x516e04[_0x08cb('0x3c')]!=='VIRTUAL'){var _0x5337b0={};_0x5337b0[_0x516e04['name']]={'$like':'%'+_0x33c758[_0x08cb('0x3f')][_0x08cb('0x4d')]+'%'};return _0x5337b0;}})});}_0x112294=_[_0x08cb('0x4e')]({},_0x112294,_0x33c758[_0x08cb('0x4f')]);var _0x4273c5={'where':_0x112294[_0x08cb('0x4b')]};return db[_0x08cb('0x3a')][_0x08cb('0x50')](_0x4273c5)[_0x08cb('0x23')](function(_0x239b19){_0x2daa13[_0x08cb('0x50')]=_0x239b19;if(_0x33c758[_0x08cb('0x3f')][_0x08cb('0x51')]){_0x112294[_0x08cb('0x52')]=[{'all':!![]}];}return db[_0x08cb('0x3a')]['findAll'](_0x112294);})[_0x08cb('0x23')](function(_0x19dab5){_0x2daa13['rows']=_0x19dab5;return _0x2daa13;})[_0x08cb('0x23')](respondWithFilteredResult(_0x590e13,_0x112294))['catch'](handleError(_0x590e13,null));};exports[_0x08cb('0x53')]=function(_0x4064ad,_0x1ab2fe){var _0x1381ea={'raw':![],'where':{'id':_0x4064ad[_0x08cb('0x54')]['id']}},_0x44a9c5={};_0x44a9c5['model']=_[_0x08cb('0x40')](db[_0x08cb('0x3a')][_0x08cb('0x55')]);_0x44a9c5['query']=_[_0x08cb('0x40')](_0x4064ad['query']);_0x44a9c5[_0x08cb('0x41')]=_[_0x08cb('0x42')](_0x44a9c5[_0x08cb('0x3d')],_0x44a9c5[_0x08cb('0x3f')]);_0x1381ea[_0x08cb('0x43')]=_[_0x08cb('0x42')](_0x44a9c5[_0x08cb('0x3d')],qs[_0x08cb('0x44')](_0x4064ad['query'][_0x08cb('0x44')]));_0x1381ea[_0x08cb('0x43')]=_0x1381ea[_0x08cb('0x43')][_0x08cb('0x45')]?_0x1381ea['attributes']:_0x44a9c5[_0x08cb('0x3d')];if(_0x4064ad[_0x08cb('0x3f')][_0x08cb('0x51')]){_0x1381ea['include']=[{'all':!![]}];}_0x1381ea=_[_0x08cb('0x4e')]({},_0x1381ea,_0x4064ad[_0x08cb('0x4f')]);return db[_0x08cb('0x3a')][_0x08cb('0x56')](_0x1381ea)[_0x08cb('0x23')](handleEntityNotFound(_0x1ab2fe,null))[_0x08cb('0x23')](respondWithResult(_0x1ab2fe,null))[_0x08cb('0x57')](handleError(_0x1ab2fe,null));};exports[_0x08cb('0x58')]=function(_0xf06d76,_0x582465){return db[_0x08cb('0x3a')]['create'](_0xf06d76[_0x08cb('0x59')],{})[_0x08cb('0x23')](respondWithResult(_0x582465,0xc9))[_0x08cb('0x57')](handleError(_0x582465,null));};exports['update']=function(_0xb158e9,_0x2eb1d3){if(_0xb158e9[_0x08cb('0x59')]['id']){delete _0xb158e9[_0x08cb('0x59')]['id'];}return db[_0x08cb('0x3a')][_0x08cb('0x56')]({'where':{'id':_0xb158e9[_0x08cb('0x54')]['id']}})[_0x08cb('0x23')](handleEntityNotFound(_0x2eb1d3,null))[_0x08cb('0x23')](saveUpdates(_0xb158e9[_0x08cb('0x59')],null))['then'](respondWithResult(_0x2eb1d3,null))[_0x08cb('0x57')](handleError(_0x2eb1d3,null));};exports['destroy']=function(_0x48eeed,_0x483536){return db[_0x08cb('0x3a')][_0x08cb('0x56')]({'where':{'id':_0x48eeed['params']['id']}})[_0x08cb('0x23')](handleEntityNotFound(_0x483536,null))[_0x08cb('0x23')](removeEntity(_0x483536,null))[_0x08cb('0x57')](handleError(_0x483536,null));};exports[_0x08cb('0x5a')]=function(_0x1c48c7,_0xd75c42,_0x16c020){var _0x2b8fed={};var _0x20a0e2={};var _0x194749;var _0x107eea;return db[_0x08cb('0x3a')][_0x08cb('0x5b')]({'where':{'id':_0x1c48c7[_0x08cb('0x54')]['id']}})[_0x08cb('0x23')](handleEntityNotFound(_0xd75c42,null))[_0x08cb('0x23')](function(_0x5397e4){if(_0x5397e4){_0x194749=_0x5397e4;_0x20a0e2[_0x08cb('0x3d')]=_[_0x08cb('0x40')](db[_0x08cb('0x5c')][_0x08cb('0x55')]);_0x20a0e2['query']=_[_0x08cb('0x40')](_0x1c48c7[_0x08cb('0x3f')]);_0x20a0e2[_0x08cb('0x41')]=_['intersection'](_0x20a0e2['model'],_0x20a0e2['query']);_0x2b8fed[_0x08cb('0x43')]=_[_0x08cb('0x42')](_0x20a0e2[_0x08cb('0x3d')],qs['fields'](_0x1c48c7[_0x08cb('0x3f')][_0x08cb('0x44')]));_0x2b8fed[_0x08cb('0x43')]=_0x2b8fed[_0x08cb('0x43')]['length']?_0x2b8fed[_0x08cb('0x43')]:_0x20a0e2['model'];_0x2b8fed[_0x08cb('0x49')]=qs[_0x08cb('0x4a')](_0x1c48c7[_0x08cb('0x3f')][_0x08cb('0x4a')]);_0x2b8fed['where']=qs['filters'](_['pick'](_0x1c48c7[_0x08cb('0x3f')],_0x20a0e2['filters']));if(_0x1c48c7[_0x08cb('0x3f')][_0x08cb('0x4d')]){_0x2b8fed[_0x08cb('0x4b')]=_[_0x08cb('0x4e')](_0x2b8fed[_0x08cb('0x4b')],{'$or':_['map'](_0x2b8fed['attributes'],function(_0x424abf){var _0x28902d={};_0x28902d[_0x424abf]={'$like':'%'+_0x1c48c7['query'][_0x08cb('0x4d')]+'%'};return _0x28902d;})});}_0x2b8fed=_[_0x08cb('0x4e')]({},_0x2b8fed,_0x1c48c7['options']);return _0x194749['getConfigurations'](_0x2b8fed);}})['then'](function(_0x27c4c6){if(_0x27c4c6){_0x107eea=_0x27c4c6[_0x08cb('0x45')];if(!_0x1c48c7[_0x08cb('0x3f')][_0x08cb('0x46')](_0x08cb('0x47'))){_0x2b8fed['limit']=qs[_0x08cb('0x48')](_0x1c48c7['query'][_0x08cb('0x48')]);_0x2b8fed[_0x08cb('0x30')]=qs['offset'](_0x1c48c7[_0x08cb('0x3f')][_0x08cb('0x30')]);}return _0x194749[_0x08cb('0x5a')](_0x2b8fed);}})['then'](function(_0xd9f197){if(_0xd9f197){return _0xd9f197?{'count':_0x107eea,'rows':_0xd9f197}:null;}})[_0x08cb('0x23')](respondWithResult(_0xd75c42,null))[_0x08cb('0x57')](handleError(_0xd75c42,null));};exports[_0x08cb('0x5d')]=function(_0x3b8750,_0x275fd6,_0x5cf56d){if(_0x3b8750[_0x08cb('0x59')]['id']){delete _0x3b8750['body']['id'];}return db[_0x08cb('0x3a')][_0x08cb('0x5b')]({'where':{'id':_0x3b8750[_0x08cb('0x54')]['id']}})[_0x08cb('0x23')](handleEntityNotFound(_0x275fd6,null))[_0x08cb('0x23')](function(_0x5cf2f8){if(_0x5cf2f8){_0x3b8750[_0x08cb('0x59')]['AccountId']=_0x5cf2f8['id'];_0x3b8750[_0x08cb('0x59')][_0x08cb('0x5e')]=integrations[_0x08cb('0x5f')](_0x3b8750[_0x08cb('0x59')][_0x08cb('0x60')],_0x3b8750[_0x08cb('0x59')][_0x08cb('0x3c')]);_0x3b8750[_0x08cb('0x59')][_0x08cb('0x61')]=integrations[_0x08cb('0x62')](_0x3b8750[_0x08cb('0x59')][_0x08cb('0x60')],_0x3b8750[_0x08cb('0x59')][_0x08cb('0x3c')]);return db[_0x08cb('0x5c')][_0x08cb('0x58')](_0x3b8750[_0x08cb('0x59')],{'include':[{'model':db[_0x08cb('0x63')],'as':'Subjects'},{'model':db['DeskField'],'as':_0x08cb('0x61')}]});}return null;})[_0x08cb('0x23')](respondWithResult(_0x275fd6,null))[_0x08cb('0x57')](handleError(_0x275fd6,null));};exports[_0x08cb('0x64')]=function(_0xfc42e8,_0x25f436,_0x9e0754){var _0x5218ca=[{'name':_0x08cb('0x65'),'label':_0x08cb('0x65'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x25a0fc='';return db[_0x08cb('0x3a')][_0x08cb('0x5b')]({'where':{'id':_0xfc42e8[_0x08cb('0x54')]['id']},'attributes':['id','remoteUri',_0x08cb('0x66'),_0x08cb('0x67'),_0x08cb('0x68'),'consumerKey',_0x08cb('0x69'),_0x08cb('0x6a'),_0x08cb('0x6b')]})[_0x08cb('0x23')](handleEntityNotFound(_0x25f436,null))[_0x08cb('0x23')](function(_0x1341b7){if(_0x1341b7){_0x25a0fc=_0x1341b7[_0x08cb('0x6c')];var _0x3e00db=_0x25a0fc['slice'](-0x1);if(_0x3e00db==='/'){_0x25a0fc=_0x25a0fc[_0x08cb('0x6d')](0x0,_0x25a0fc['lastIndexOf'](_0x3e00db));}var _0xd07115={'method':'GET','uri':util[_0x08cb('0x6e')](_0x08cb('0x6f'),_0x25a0fc),'headers':{'Content-Type':_0x08cb('0x70'),'Accept':_0x08cb('0x70')},'json':!![]};if(_0x1341b7[_0x08cb('0x66')]==='basic'){_0xd07115['headers'][_0x08cb('0x71')]=util[_0x08cb('0x6e')](_0x08cb('0x72'),new Buffer(util[_0x08cb('0x6e')](_0x08cb('0x73'),_0x1341b7[_0x08cb('0x67')],_0x1341b7['password']))[_0x08cb('0x74')](_0x08cb('0x75')));}return rp(_0xd07115)[_0x08cb('0x23')](function(_0x401c5e){return _0x5218ca['concat'](_['map'](_0x401c5e[_0x08cb('0x76')][_0x08cb('0x77')],function(_0x4aded3){return{'id':_0x4aded3[_0x08cb('0x78')],'name':_0x4aded3['name'],'type':_0x4aded3['type'],'active':_0x4aded3['active'],'label':_0x4aded3[_0x08cb('0x79')],'custom':!![]};}));});}})[_0x08cb('0x23')](function(_0x8bca09){return{'count':_0x8bca09[_0x08cb('0x45')],'rows':_0x8bca09};})[_0x08cb('0x23')](respondWithResult(_0x25f436,null))[_0x08cb('0x57')](function(_0x2851fc){var _0x1c7f00=_0xfc42e8['query'][_0x08cb('0x1f')]?0x1f4:_0x2851fc[_0x08cb('0x7a')]||0x1f4;logger['error'](_0x08cb('0x7b'),_0x08cb('0x64'),_0x1c7f00,JSON[_0x08cb('0x27')](_0x2851fc));delete _0x2851fc[_0x08cb('0x78')];if(_0x1c7f00===0x191){_0x1c7f00=0x190;}_0x25f436['status'](_0x1c7f00)[_0x08cb('0x38')](_0xfc42e8['query'][_0x08cb('0x1f')]?{'message':_0x08cb('0x7c'),'statusCode':_0x2851fc[_0x08cb('0x7a')]}:_0x2851fc);});}; \ No newline at end of file +var _0xb625=['filter','merge','map','options','DeskAccount','findAll','rows','show','params','includeAll','include','find','create','body','update','getConfigurations','findOne','DeskConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','username','consumerSecret','token','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','Basic\x20%s','%s:%s','password','toString','base64','concat','_embedded','active','label','statusCode','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','destroy','stack','name','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick'];(function(_0x74e789,_0x2915ef){var _0x31161c=function(_0x2dfcab){while(--_0x2dfcab){_0x74e789['push'](_0x74e789['shift']());}};_0x31161c(++_0x2915ef);}(_0xb625,0x12f));var _0x5b62=function(_0x25e65e,_0x2039aa){_0x25e65e=_0x25e65e-0x0;var _0x5c69a6=_0xb625[_0x25e65e];return _0x5c69a6;};'use strict';var pdf=require(_0x5b62('0x0'));var emlformat=require(_0x5b62('0x1'));var rimraf=require(_0x5b62('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5b62('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5b62('0x4'));var Mustache=require('mustache');var util=require(_0x5b62('0x5'));var path=require(_0x5b62('0x6'));var sox=require(_0x5b62('0x7'));var csv=require('to-csv');var ejs=require(_0x5b62('0x8'));var fs=require('fs');var _=require(_0x5b62('0x9'));var squel=require(_0x5b62('0xa'));var crypto=require(_0x5b62('0xb'));var jsforce=require(_0x5b62('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5b62('0xd'));var querystring=require(_0x5b62('0xe'));var Papa=require(_0x5b62('0xf'));var Redis=require(_0x5b62('0x10'));var authService=require(_0x5b62('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5b62('0x12'));var hardwareService=require(_0x5b62('0x13'));var logger=require(_0x5b62('0x14'))(_0x5b62('0x15'));var utils=require(_0x5b62('0x16'));var config=require(_0x5b62('0x17'));var db=require(_0x5b62('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x5b62('0x19'));var client=jayson[_0x5b62('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x1428a7,_0x2ece20,_0x5bea17){if(_0x5bea17){var _0x111034=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x111034[_0x5b62('0x1b')](_0x2ece20)){return _0x1428a7;}else{throw new db['Sequelize']['ValidationError'](_0x5b62('0x1c'));}}else{return _0x1428a7;}}function respondWithRpcPromise(_0x1be3e8,_0x532952,_0x63be5,_0x1dc744){return new BPromise(function(_0x2ff40e,_0x1fe73c){var _0x2bf88a=_0x1dc744||client;return _0x2bf88a[_0x5b62('0x1d')](_0x1be3e8,_0x63be5)[_0x5b62('0x1e')](function(_0x50b96e){logger[_0x5b62('0x1f')](_0x5b62('0x20'),_0x532952,_0x5b62('0x21'));logger['debug'](_0x5b62('0x22'),_0x532952,_0x5b62('0x21'),JSON[_0x5b62('0x23')](_0x50b96e));if(_0x50b96e[_0x5b62('0x24')]){if(_0x50b96e['error'][_0x5b62('0x25')]===0x1f4){logger[_0x5b62('0x24')]('DeskAccount,\x20%s,\x20%s',_0x532952,_0x50b96e['error'][_0x5b62('0x26')]);return _0x1fe73c(_0x50b96e[_0x5b62('0x24')][_0x5b62('0x26')]);}logger[_0x5b62('0x24')](_0x5b62('0x20'),_0x532952,_0x50b96e[_0x5b62('0x24')][_0x5b62('0x26')]);return _0x2ff40e(_0x50b96e[_0x5b62('0x24')][_0x5b62('0x26')]);}else{logger[_0x5b62('0x1f')](_0x5b62('0x20'),_0x532952,'request\x20sent');_0x2ff40e(_0x50b96e[_0x5b62('0x27')][_0x5b62('0x26')]);}})[_0x5b62('0x28')](function(_0x262457){logger['error'](_0x5b62('0x20'),_0x532952,_0x262457);_0x1fe73c(_0x262457);});});}function respondWithStatusCode(_0x349805,_0x20a64a){_0x20a64a=_0x20a64a||0xcc;return function(_0x390f6e){if(_0x390f6e){return _0x349805[_0x5b62('0x29')](_0x20a64a);}return _0x349805[_0x5b62('0x2a')](_0x20a64a)[_0x5b62('0x2b')]();};}function respondWithResult(_0x19579a,_0x28a452){_0x28a452=_0x28a452||0xc8;return function(_0x2f5e2a){if(_0x2f5e2a){return _0x19579a[_0x5b62('0x2a')](_0x28a452)[_0x5b62('0x2c')](_0x2f5e2a);}};}function respondWithFilteredResult(_0x44bbeb,_0x437b1f){return function(_0x102d5b){if(_0x102d5b){var _0x3c9cb9=_0x102d5b[_0x5b62('0x2d')],_0x1daedd=_0x437b1f[_0x5b62('0x2e')],_0x5cda23=_0x437b1f[_0x5b62('0x2e')]+_0x437b1f[_0x5b62('0x2f')],_0x177c84;if(_0x5cda23>=_0x3c9cb9){_0x5cda23=_0x3c9cb9;_0x177c84=0xc8;}else{_0x177c84=0xce;}_0x44bbeb[_0x5b62('0x2a')](_0x177c84);return _0x44bbeb['set'](_0x5b62('0x30'),_0x1daedd+'-'+_0x5cda23+'/'+_0x3c9cb9)[_0x5b62('0x2c')](_0x102d5b);}return null;};}function patchUpdates(_0x5ad9c4){return function(_0x30cb5a){try{jsonpatch[_0x5b62('0x31')](_0x30cb5a,_0x5ad9c4,!![]);}catch(_0x26c826){return BPromise[_0x5b62('0x32')](_0x26c826);}return _0x30cb5a['save']();};}function saveUpdates(_0x15e5da,_0x40f804){return function(_0x1dc6e1){if(_0x1dc6e1){return _0x1dc6e1['update'](_0x15e5da)['then'](function(_0x3b0f3c){return _0x3b0f3c;});}return null;};}function removeEntity(_0x4e1731,_0x34b67f){return function(_0x47d7d5){if(_0x47d7d5){return _0x47d7d5[_0x5b62('0x33')]()[_0x5b62('0x1e')](function(){_0x4e1731['status'](0xcc)[_0x5b62('0x2b')]();});}};}function handleEntityNotFound(_0x256b31,_0x1b2b44){return function(_0x1eb100){if(!_0x1eb100){_0x256b31[_0x5b62('0x29')](0x194);}return _0x1eb100;};}function handleError(_0x262e6a,_0x29c285){_0x29c285=_0x29c285||0x1f4;return function(_0x18ffb6){logger['error'](_0x18ffb6[_0x5b62('0x34')]);if(_0x18ffb6['name']){delete _0x18ffb6[_0x5b62('0x35')];}_0x262e6a[_0x5b62('0x2a')](_0x29c285)['send'](_0x18ffb6);};}exports['index']=function(_0x517ef1,_0x2fadb2){var _0x1eb5eb={},_0x449581={},_0x31035f={'count':0x0,'rows':[]};var _0x2423f5=_['map'](db['DeskAccount'][_0x5b62('0x36')],function(_0x140336){return{'name':_0x140336['fieldName'],'type':_0x140336[_0x5b62('0x37')][_0x5b62('0x38')]};});_0x449581[_0x5b62('0x39')]=_['map'](_0x2423f5,_0x5b62('0x35'));_0x449581[_0x5b62('0x3a')]=_[_0x5b62('0x3b')](_0x517ef1[_0x5b62('0x3a')]);_0x449581[_0x5b62('0x3c')]=_[_0x5b62('0x3d')](_0x449581['model'],_0x449581[_0x5b62('0x3a')]);_0x1eb5eb[_0x5b62('0x3e')]=_['intersection'](_0x449581['model'],qs[_0x5b62('0x3f')](_0x517ef1[_0x5b62('0x3a')][_0x5b62('0x3f')]));_0x1eb5eb['attributes']=_0x1eb5eb[_0x5b62('0x3e')][_0x5b62('0x40')]?_0x1eb5eb[_0x5b62('0x3e')]:_0x449581[_0x5b62('0x39')];if(!_0x517ef1[_0x5b62('0x3a')]['hasOwnProperty']('nolimit')){_0x1eb5eb[_0x5b62('0x2f')]=qs[_0x5b62('0x2f')](_0x517ef1[_0x5b62('0x3a')][_0x5b62('0x2f')]);_0x1eb5eb[_0x5b62('0x2e')]=qs[_0x5b62('0x2e')](_0x517ef1[_0x5b62('0x3a')]['offset']);}_0x1eb5eb[_0x5b62('0x41')]=qs['sort'](_0x517ef1['query'][_0x5b62('0x42')]);_0x1eb5eb[_0x5b62('0x43')]=qs[_0x5b62('0x3c')](_[_0x5b62('0x44')](_0x517ef1['query'],_0x449581[_0x5b62('0x3c')]),_0x2423f5);if(_0x517ef1[_0x5b62('0x3a')][_0x5b62('0x45')]){_0x1eb5eb[_0x5b62('0x43')]=_[_0x5b62('0x46')](_0x1eb5eb[_0x5b62('0x43')],{'$or':_[_0x5b62('0x47')](_0x2423f5,function(_0x278a1){if(_0x278a1[_0x5b62('0x37')]!=='VIRTUAL'){var _0x1fa865={};_0x1fa865[_0x278a1['name']]={'$like':'%'+_0x517ef1[_0x5b62('0x3a')][_0x5b62('0x45')]+'%'};return _0x1fa865;}})});}_0x1eb5eb=_[_0x5b62('0x46')]({},_0x1eb5eb,_0x517ef1[_0x5b62('0x48')]);var _0x53586f={'where':_0x1eb5eb[_0x5b62('0x43')]};return db[_0x5b62('0x49')][_0x5b62('0x2d')](_0x53586f)[_0x5b62('0x1e')](function(_0x2253be){_0x31035f['count']=_0x2253be;if(_0x517ef1[_0x5b62('0x3a')]['includeAll']){_0x1eb5eb['include']=[{'all':!![]}];}return db['DeskAccount'][_0x5b62('0x4a')](_0x1eb5eb);})[_0x5b62('0x1e')](function(_0x25c5b5){_0x31035f[_0x5b62('0x4b')]=_0x25c5b5;return _0x31035f;})[_0x5b62('0x1e')](respondWithFilteredResult(_0x2fadb2,_0x1eb5eb))['catch'](handleError(_0x2fadb2,null));};exports[_0x5b62('0x4c')]=function(_0x2fe3c5,_0x4a10a2){var _0x1e0ffa={'raw':![],'where':{'id':_0x2fe3c5[_0x5b62('0x4d')]['id']}},_0x2c7235={};_0x2c7235[_0x5b62('0x39')]=_['keys'](db[_0x5b62('0x49')][_0x5b62('0x36')]);_0x2c7235[_0x5b62('0x3a')]=_['keys'](_0x2fe3c5['query']);_0x2c7235['filters']=_[_0x5b62('0x3d')](_0x2c7235[_0x5b62('0x39')],_0x2c7235[_0x5b62('0x3a')]);_0x1e0ffa[_0x5b62('0x3e')]=_[_0x5b62('0x3d')](_0x2c7235[_0x5b62('0x39')],qs['fields'](_0x2fe3c5[_0x5b62('0x3a')][_0x5b62('0x3f')]));_0x1e0ffa[_0x5b62('0x3e')]=_0x1e0ffa[_0x5b62('0x3e')][_0x5b62('0x40')]?_0x1e0ffa[_0x5b62('0x3e')]:_0x2c7235[_0x5b62('0x39')];if(_0x2fe3c5[_0x5b62('0x3a')][_0x5b62('0x4e')]){_0x1e0ffa[_0x5b62('0x4f')]=[{'all':!![]}];}_0x1e0ffa=_[_0x5b62('0x46')]({},_0x1e0ffa,_0x2fe3c5['options']);return db[_0x5b62('0x49')][_0x5b62('0x50')](_0x1e0ffa)[_0x5b62('0x1e')](handleEntityNotFound(_0x4a10a2,null))[_0x5b62('0x1e')](respondWithResult(_0x4a10a2,null))['catch'](handleError(_0x4a10a2,null));};exports[_0x5b62('0x51')]=function(_0x3d4798,_0x1c4a3f){return db[_0x5b62('0x49')][_0x5b62('0x51')](_0x3d4798[_0x5b62('0x52')],{})['then'](respondWithResult(_0x1c4a3f,0xc9))['catch'](handleError(_0x1c4a3f,null));};exports[_0x5b62('0x53')]=function(_0x208899,_0x22f867){if(_0x208899[_0x5b62('0x52')]['id']){delete _0x208899['body']['id'];}return db[_0x5b62('0x49')][_0x5b62('0x50')]({'where':{'id':_0x208899[_0x5b62('0x4d')]['id']}})[_0x5b62('0x1e')](handleEntityNotFound(_0x22f867,null))[_0x5b62('0x1e')](saveUpdates(_0x208899[_0x5b62('0x52')],null))[_0x5b62('0x1e')](respondWithResult(_0x22f867,null))[_0x5b62('0x28')](handleError(_0x22f867,null));};exports[_0x5b62('0x33')]=function(_0x5ec8e8,_0x4dda31){return db[_0x5b62('0x49')][_0x5b62('0x50')]({'where':{'id':_0x5ec8e8[_0x5b62('0x4d')]['id']}})[_0x5b62('0x1e')](handleEntityNotFound(_0x4dda31,null))[_0x5b62('0x1e')](removeEntity(_0x4dda31,null))[_0x5b62('0x28')](handleError(_0x4dda31,null));};exports[_0x5b62('0x54')]=function(_0x203913,_0x5ab9d2,_0x36fb02){var _0x506920={};var _0x5fd0d2={};var _0x53b721;var _0x38e6cb;return db[_0x5b62('0x49')][_0x5b62('0x55')]({'where':{'id':_0x203913[_0x5b62('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5ab9d2,null))[_0x5b62('0x1e')](function(_0x1c8dbc){if(_0x1c8dbc){_0x53b721=_0x1c8dbc;_0x5fd0d2[_0x5b62('0x39')]=_[_0x5b62('0x3b')](db[_0x5b62('0x56')][_0x5b62('0x36')]);_0x5fd0d2['query']=_[_0x5b62('0x3b')](_0x203913[_0x5b62('0x3a')]);_0x5fd0d2[_0x5b62('0x3c')]=_[_0x5b62('0x3d')](_0x5fd0d2['model'],_0x5fd0d2['query']);_0x506920['attributes']=_[_0x5b62('0x3d')](_0x5fd0d2[_0x5b62('0x39')],qs[_0x5b62('0x3f')](_0x203913['query'][_0x5b62('0x3f')]));_0x506920[_0x5b62('0x3e')]=_0x506920[_0x5b62('0x3e')][_0x5b62('0x40')]?_0x506920[_0x5b62('0x3e')]:_0x5fd0d2[_0x5b62('0x39')];_0x506920[_0x5b62('0x41')]=qs[_0x5b62('0x42')](_0x203913['query'][_0x5b62('0x42')]);_0x506920['where']=qs['filters'](_[_0x5b62('0x44')](_0x203913['query'],_0x5fd0d2[_0x5b62('0x3c')]));if(_0x203913['query'][_0x5b62('0x45')]){_0x506920[_0x5b62('0x43')]=_[_0x5b62('0x46')](_0x506920['where'],{'$or':_[_0x5b62('0x47')](_0x506920['attributes'],function(_0x4b9142){var _0x2b7696={};_0x2b7696[_0x4b9142]={'$like':'%'+_0x203913[_0x5b62('0x3a')]['filter']+'%'};return _0x2b7696;})});}_0x506920=_[_0x5b62('0x46')]({},_0x506920,_0x203913['options']);return _0x53b721['getConfigurations'](_0x506920);}})[_0x5b62('0x1e')](function(_0x490f4c){if(_0x490f4c){_0x38e6cb=_0x490f4c[_0x5b62('0x40')];if(!_0x203913['query'][_0x5b62('0x57')]('nolimit')){_0x506920[_0x5b62('0x2f')]=qs[_0x5b62('0x2f')](_0x203913[_0x5b62('0x3a')]['limit']);_0x506920['offset']=qs[_0x5b62('0x2e')](_0x203913['query'][_0x5b62('0x2e')]);}return _0x53b721[_0x5b62('0x54')](_0x506920);}})[_0x5b62('0x1e')](function(_0x1152e5){if(_0x1152e5){return _0x1152e5?{'count':_0x38e6cb,'rows':_0x1152e5}:null;}})[_0x5b62('0x1e')](respondWithResult(_0x5ab9d2,null))[_0x5b62('0x28')](handleError(_0x5ab9d2,null));};exports[_0x5b62('0x58')]=function(_0x41f9c4,_0x56979d,_0x46436e){if(_0x41f9c4[_0x5b62('0x52')]['id']){delete _0x41f9c4['body']['id'];}return db[_0x5b62('0x49')][_0x5b62('0x55')]({'where':{'id':_0x41f9c4[_0x5b62('0x4d')]['id']}})[_0x5b62('0x1e')](handleEntityNotFound(_0x56979d,null))[_0x5b62('0x1e')](function(_0x5d5b8f){if(_0x5d5b8f){_0x41f9c4[_0x5b62('0x52')][_0x5b62('0x59')]=_0x5d5b8f['id'];_0x41f9c4[_0x5b62('0x52')][_0x5b62('0x5a')]=integrations[_0x5b62('0x5b')](_0x41f9c4['body'][_0x5b62('0x5c')],_0x41f9c4['body']['type']);_0x41f9c4[_0x5b62('0x52')][_0x5b62('0x5d')]=integrations[_0x5b62('0x5e')](_0x41f9c4[_0x5b62('0x52')][_0x5b62('0x5c')],_0x41f9c4[_0x5b62('0x52')][_0x5b62('0x37')]);return db[_0x5b62('0x56')][_0x5b62('0x51')](_0x41f9c4[_0x5b62('0x52')],{'include':[{'model':db[_0x5b62('0x5f')],'as':_0x5b62('0x5a')},{'model':db[_0x5b62('0x5f')],'as':_0x5b62('0x5d')}]});}return null;})[_0x5b62('0x1e')](respondWithResult(_0x56979d,null))[_0x5b62('0x28')](handleError(_0x56979d,null));};exports[_0x5b62('0x60')]=function(_0x108415,_0x341211,_0x7db8c0){var _0x291ffd=[{'name':_0x5b62('0x61'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x281d44='';return db['DeskAccount']['findOne']({'where':{'id':_0x108415[_0x5b62('0x4d')]['id']},'attributes':['id',_0x5b62('0x62'),'authType',_0x5b62('0x63'),'password','consumerKey',_0x5b62('0x64'),_0x5b62('0x65'),'tokenSecret']})[_0x5b62('0x1e')](handleEntityNotFound(_0x341211,null))[_0x5b62('0x1e')](function(_0xa491b0){if(_0xa491b0){_0x281d44=_0xa491b0['remoteUri'];var _0x3f5015=_0x281d44['slice'](-0x1);if(_0x3f5015==='/'){_0x281d44=_0x281d44[_0x5b62('0x66')](0x0,_0x281d44[_0x5b62('0x67')](_0x3f5015));}var _0x3a1e06={'method':_0x5b62('0x68'),'uri':util[_0x5b62('0x69')](_0x5b62('0x6a'),_0x281d44),'headers':{'Content-Type':'application/json','Accept':_0x5b62('0x6b')},'json':!![]};if(_0xa491b0[_0x5b62('0x6c')]===_0x5b62('0x6d')){_0x3a1e06[_0x5b62('0x6e')][_0x5b62('0x6f')]=util[_0x5b62('0x69')](_0x5b62('0x70'),new Buffer(util[_0x5b62('0x69')](_0x5b62('0x71'),_0xa491b0[_0x5b62('0x63')],_0xa491b0[_0x5b62('0x72')]))[_0x5b62('0x73')](_0x5b62('0x74')));}return rp(_0x3a1e06)[_0x5b62('0x1e')](function(_0x2e9728){return _0x291ffd[_0x5b62('0x75')](_['map'](_0x2e9728[_0x5b62('0x76')]['entries'],function(_0x3eb1be){return{'id':_0x3eb1be[_0x5b62('0x35')],'name':_0x3eb1be[_0x5b62('0x35')],'type':_0x3eb1be[_0x5b62('0x37')],'active':_0x3eb1be[_0x5b62('0x77')],'label':_0x3eb1be[_0x5b62('0x78')],'custom':!![]};}));});}})[_0x5b62('0x1e')](function(_0x534cf0){return{'count':_0x534cf0['length'],'rows':_0x534cf0};})['then'](respondWithResult(_0x341211,null))['catch'](function(_0x48df73){var _0x38f444=_0x108415[_0x5b62('0x3a')][_0x5b62('0x1b')]?0x1f4:_0x48df73[_0x5b62('0x79')]||0x1f4;logger[_0x5b62('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x5b62('0x60'),_0x38f444,JSON[_0x5b62('0x23')](_0x48df73));delete _0x48df73[_0x5b62('0x35')];if(_0x38f444===0x191){_0x38f444=0x190;}_0x341211['status'](_0x38f444)[_0x5b62('0x7a')](_0x108415[_0x5b62('0x3a')][_0x5b62('0x1b')]?{'message':_0x5b62('0x7b'),'statusCode':_0x48df73[_0x5b62('0x79')]}:_0x48df73);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index e99099d..0911382 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 _0x318d=['rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x13c6fc,_0xdd1d85){var _0x10b4d4=function(_0x356fd0){while(--_0x356fd0){_0x13c6fc['push'](_0x13c6fc['shift']());}};_0x10b4d4(++_0xdd1d85);}(_0x318d,0x7d));var _0xd318=function(_0x21c3ac,_0x2a46bb){_0x21c3ac=_0x21c3ac-0x0;var _0x3c45ad=_0x318d[_0x21c3ac];return _0x3c45ad;};'use strict';var _=require(_0xd318('0x0'));var util=require(_0xd318('0x1'));var logger=require(_0xd318('0x2'))('api');var moment=require(_0xd318('0x3'));var BPromise=require(_0xd318('0x4'));var rp=require(_0xd318('0x5'));var fs=require('fs');var path=require(_0xd318('0x6'));var rimraf=require(_0xd318('0x7'));var config=require('../../config/environment');var attributes=require(_0xd318('0x8'));var integrations=require(_0xd318('0x9'));module['exports']=function(_0x4e3cfc,_0x285f8f){return _0x4e3cfc[_0xd318('0xa')](_0xd318('0xb'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffe2=['define','DeskAccount','int_desk_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration'];(function(_0x459aa6,_0x4c82bc){var _0x2af938=function(_0x5abd60){while(--_0x5abd60){_0x459aa6['push'](_0x459aa6['shift']());}};_0x2af938(++_0x4c82bc);}(_0xffe2,0x1b0));var _0x2ffe=function(_0x4f90e,_0x3b6af2){_0x4f90e=_0x4f90e-0x0;var _0x32ec9f=_0xffe2[_0x4f90e];return _0x32ec9f;};'use strict';var _=require(_0x2ffe('0x0'));var util=require('util');var logger=require(_0x2ffe('0x1'))('api');var moment=require(_0x2ffe('0x2'));var BPromise=require(_0x2ffe('0x3'));var rp=require(_0x2ffe('0x4'));var fs=require('fs');var path=require(_0x2ffe('0x5'));var rimraf=require(_0x2ffe('0x6'));var config=require(_0x2ffe('0x7'));var attributes=require(_0x2ffe('0x8'));var integrations=require(_0x2ffe('0x9'));module['exports']=function(_0x5f46e7,_0x572a05){return _0x5f46e7[_0x2ffe('0xa')](_0x2ffe('0xb'),attributes,{'tableName':_0x2ffe('0xc'),'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 ee725e0..4e3246d 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 _0x4745=['request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetDeskAccount','findAll','raw','options','where','attributes','include','map','model','then','stringify','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s'];(function(_0x316239,_0x3cc5a5){var _0x458eb4=function(_0x431c1f){while(--_0x431c1f){_0x316239['push'](_0x316239['shift']());}};_0x458eb4(++_0x3cc5a5);}(_0x4745,0x172));var _0x5474=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x4745[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var moment=require(_0x5474('0x2'));var BPromise=require(_0x5474('0x3'));var rs=require(_0x5474('0x4'));var fs=require('fs');var Redis=require(_0x5474('0x5'));var db=require(_0x5474('0x6'))['db'];var utils=require(_0x5474('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x5474('0x8'));var jayson=require(_0x5474('0x9'));var client=jayson[_0x5474('0xa')][_0x5474('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc3c5f3,_0x5bfd42,_0x4b78bd){return new BPromise(function(_0x2f40ec,_0xca8c53){return client[_0x5474('0xc')](_0xc3c5f3,_0x4b78bd)['then'](function(_0x47a73d){logger[_0x5474('0xd')](_0x5474('0xe'),_0x5bfd42,_0x5474('0xf'));logger[_0x5474('0x10')](_0x5474('0x11'),_0x5bfd42,'request\x20sent',JSON['stringify'](_0x47a73d));if(_0x47a73d['error']){if(_0x47a73d[_0x5474('0x12')][_0x5474('0x13')]===0x1f4){logger[_0x5474('0x12')](_0x5474('0xe'),_0x5bfd42,_0x47a73d[_0x5474('0x12')][_0x5474('0x14')]);return _0xca8c53(_0x47a73d[_0x5474('0x12')][_0x5474('0x14')]);}logger[_0x5474('0x12')](_0x5474('0xe'),_0x5bfd42,_0x47a73d[_0x5474('0x12')][_0x5474('0x14')]);return _0x2f40ec(_0x47a73d['error']['message']);}else{logger[_0x5474('0xd')](_0x5474('0xe'),_0x5bfd42,_0x5474('0xf'));_0x2f40ec(_0x47a73d['result'][_0x5474('0x14')]);}})[_0x5474('0x15')](function(_0xeba579){logger[_0x5474('0x12')](_0x5474('0xe'),_0x5bfd42,_0xeba579);_0xca8c53(_0xeba579);});});}exports[_0x5474('0x16')]=function(_0x1a985c){var _0x155eef=this;return new Promise(function(_0x2ba6bb,_0x3f086d){return db['DeskAccount'][_0x5474('0x17')]({'raw':_0x1a985c['options']?_0x1a985c['options'][_0x5474('0x18')]===undefined?!![]:![]:!![],'where':_0x1a985c[_0x5474('0x19')]?_0x1a985c[_0x5474('0x19')][_0x5474('0x1a')]||null:null,'attributes':_0x1a985c[_0x5474('0x19')]?_0x1a985c[_0x5474('0x19')][_0x5474('0x1b')]||null:null,'limit':_0x1a985c[_0x5474('0x19')]?_0x1a985c[_0x5474('0x19')]['limit']||null:null,'include':_0x1a985c[_0x5474('0x19')]?_0x1a985c[_0x5474('0x19')][_0x5474('0x1c')]?_[_0x5474('0x1d')](_0x1a985c[_0x5474('0x19')][_0x5474('0x1c')],function(_0x4820ab){return{'model':db[_0x4820ab[_0x5474('0x1e')]],'as':_0x4820ab['as'],'attributes':_0x4820ab['attributes'],'include':_0x4820ab['include']?_['map'](_0x4820ab[_0x5474('0x1c')],function(_0x59a03a){return{'model':db[_0x59a03a[_0x5474('0x1e')]],'as':_0x59a03a['as'],'attributes':_0x59a03a[_0x5474('0x1b')],'include':_0x59a03a[_0x5474('0x1c')]?_[_0x5474('0x1d')](_0x59a03a[_0x5474('0x1c')],function(_0x2425cd){return{'model':db[_0x2425cd[_0x5474('0x1e')]],'as':_0x2425cd['as'],'attributes':_0x2425cd[_0x5474('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5474('0x1f')](function(_0x328fc5){logger[_0x5474('0xd')](_0x5474('0x16'),_0x1a985c);logger['debug'](_0x5474('0x16'),_0x1a985c,JSON[_0x5474('0x20')](_0x328fc5));_0x2ba6bb(_0x328fc5);})[_0x5474('0x15')](function(_0x4e85fc){logger[_0x5474('0x12')]('GetDeskAccount',_0x4e85fc[_0x5474('0x14')],_0x1a985c);_0x3f086d(_0x155eef[_0x5474('0x12')](0x1f4,_0x4e85fc[_0x5474('0x14')]));});});};exports[_0x5474('0x21')]=function(_0x55cfae){var _0x36c931=this;return new Promise(function(_0x4e6cbb,_0x2c8989){return db['DeskAccount'][_0x5474('0x22')]({'raw':_0x55cfae['options']?_0x55cfae['options'][_0x5474('0x18')]===undefined?!![]:![]:!![],'where':_0x55cfae[_0x5474('0x19')]?_0x55cfae[_0x5474('0x19')][_0x5474('0x1a')]||null:null,'attributes':_0x55cfae[_0x5474('0x19')]?_0x55cfae[_0x5474('0x19')][_0x5474('0x1b')]||null:null,'include':_0x55cfae[_0x5474('0x19')]?_0x55cfae['options'][_0x5474('0x1c')]?_[_0x5474('0x1d')](_0x55cfae[_0x5474('0x19')][_0x5474('0x1c')],function(_0xa0390){return{'model':db[_0xa0390[_0x5474('0x1e')]],'as':_0xa0390['as'],'attributes':_0xa0390[_0x5474('0x1b')],'include':_0xa0390[_0x5474('0x1c')]?_[_0x5474('0x1d')](_0xa0390[_0x5474('0x1c')],function(_0x437003){return{'model':db[_0x437003[_0x5474('0x1e')]],'as':_0x437003['as'],'attributes':_0x437003[_0x5474('0x1b')],'include':_0x437003[_0x5474('0x1c')]?_[_0x5474('0x1d')](_0x437003[_0x5474('0x1c')],function(_0xfed34a){return{'model':db[_0xfed34a[_0x5474('0x1e')]],'as':_0xfed34a['as'],'attributes':_0xfed34a[_0x5474('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5474('0x1f')](function(_0x41288c){logger['info'](_0x5474('0x21'),_0x55cfae);logger[_0x5474('0x10')]('ShowDeskAccount',_0x55cfae,JSON[_0x5474('0x20')](_0x41288c));_0x4e6cbb(_0x41288c);})[_0x5474('0x15')](function(_0x15c172){logger[_0x5474('0x12')]('ShowDeskAccount',_0x15c172[_0x5474('0x14')],_0x55cfae);_0x2c8989(_0x36c931[_0x5474('0x12')](0x1f4,_0x15c172[_0x5474('0x14')]));});});}; \ No newline at end of file +var _0x2ada=['http','request','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','DeskAccount','options','raw','where','attributes','limit','include','map','model','then','GetDeskAccount','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2ada,0x1bd));var _0xa2ad=function(_0x33dcf7,_0x3d5390){_0x33dcf7=_0x33dcf7-0x0;var _0x542d4e=_0x2ada[_0x33dcf7];return _0x542d4e;};'use strict';var _=require(_0xa2ad('0x0'));var util=require(_0xa2ad('0x1'));var moment=require(_0xa2ad('0x2'));var BPromise=require(_0xa2ad('0x3'));var rs=require(_0xa2ad('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa2ad('0x5'));var logger=require(_0xa2ad('0x6'))('rpc');var config=require(_0xa2ad('0x7'));var jayson=require(_0xa2ad('0x8'));var client=jayson[_0xa2ad('0x9')][_0xa2ad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x212dd3,_0x543aab,_0x2634ad){return new BPromise(function(_0x2316bd,_0x282b63){return client[_0xa2ad('0xb')](_0x212dd3,_0x2634ad)['then'](function(_0x5a6cb6){logger[_0xa2ad('0xc')](_0xa2ad('0xd'),_0x543aab,'request\x20sent');logger[_0xa2ad('0xe')](_0xa2ad('0xf'),_0x543aab,'request\x20sent',JSON[_0xa2ad('0x10')](_0x5a6cb6));if(_0x5a6cb6[_0xa2ad('0x11')]){if(_0x5a6cb6['error'][_0xa2ad('0x12')]===0x1f4){logger[_0xa2ad('0x11')](_0xa2ad('0xd'),_0x543aab,_0x5a6cb6[_0xa2ad('0x11')]['message']);return _0x282b63(_0x5a6cb6[_0xa2ad('0x11')][_0xa2ad('0x13')]);}logger[_0xa2ad('0x11')](_0xa2ad('0xd'),_0x543aab,_0x5a6cb6['error']['message']);return _0x2316bd(_0x5a6cb6[_0xa2ad('0x11')][_0xa2ad('0x13')]);}else{logger[_0xa2ad('0xc')]('DeskAccount,\x20%s,\x20%s',_0x543aab,_0xa2ad('0x14'));_0x2316bd(_0x5a6cb6['result'][_0xa2ad('0x13')]);}})[_0xa2ad('0x15')](function(_0x253e5d){logger[_0xa2ad('0x11')](_0xa2ad('0xd'),_0x543aab,_0x253e5d);_0x282b63(_0x253e5d);});});}exports['GetDeskAccount']=function(_0x3623f5){var _0x35e034=this;return new Promise(function(_0x22ce34,_0x3e5849){return db[_0xa2ad('0x16')]['findAll']({'raw':_0x3623f5[_0xa2ad('0x17')]?_0x3623f5[_0xa2ad('0x17')][_0xa2ad('0x18')]===undefined?!![]:![]:!![],'where':_0x3623f5[_0xa2ad('0x17')]?_0x3623f5['options'][_0xa2ad('0x19')]||null:null,'attributes':_0x3623f5[_0xa2ad('0x17')]?_0x3623f5[_0xa2ad('0x17')][_0xa2ad('0x1a')]||null:null,'limit':_0x3623f5[_0xa2ad('0x17')]?_0x3623f5[_0xa2ad('0x17')][_0xa2ad('0x1b')]||null:null,'include':_0x3623f5['options']?_0x3623f5[_0xa2ad('0x17')][_0xa2ad('0x1c')]?_[_0xa2ad('0x1d')](_0x3623f5[_0xa2ad('0x17')]['include'],function(_0x253bff){return{'model':db[_0x253bff['model']],'as':_0x253bff['as'],'attributes':_0x253bff['attributes'],'include':_0x253bff[_0xa2ad('0x1c')]?_[_0xa2ad('0x1d')](_0x253bff[_0xa2ad('0x1c')],function(_0x2fb32a){return{'model':db[_0x2fb32a[_0xa2ad('0x1e')]],'as':_0x2fb32a['as'],'attributes':_0x2fb32a[_0xa2ad('0x1a')],'include':_0x2fb32a[_0xa2ad('0x1c')]?_['map'](_0x2fb32a[_0xa2ad('0x1c')],function(_0x154326){return{'model':db[_0x154326[_0xa2ad('0x1e')]],'as':_0x154326['as'],'attributes':_0x154326['attributes']};}):[]};}):[]};}):[]:[]})[_0xa2ad('0x1f')](function(_0x197217){logger[_0xa2ad('0xc')](_0xa2ad('0x20'),_0x3623f5);logger['debug']('GetDeskAccount',_0x3623f5,JSON[_0xa2ad('0x10')](_0x197217));_0x22ce34(_0x197217);})['catch'](function(_0x5f0140){logger['error']('GetDeskAccount',_0x5f0140[_0xa2ad('0x13')],_0x3623f5);_0x3e5849(_0x35e034[_0xa2ad('0x11')](0x1f4,_0x5f0140[_0xa2ad('0x13')]));});});};exports[_0xa2ad('0x21')]=function(_0x3929c1){var _0x1b0bbb=this;return new Promise(function(_0x335036,_0x281f42){return db['DeskAccount'][_0xa2ad('0x22')]({'raw':_0x3929c1[_0xa2ad('0x17')]?_0x3929c1[_0xa2ad('0x17')][_0xa2ad('0x18')]===undefined?!![]:![]:!![],'where':_0x3929c1[_0xa2ad('0x17')]?_0x3929c1[_0xa2ad('0x17')]['where']||null:null,'attributes':_0x3929c1['options']?_0x3929c1[_0xa2ad('0x17')]['attributes']||null:null,'include':_0x3929c1['options']?_0x3929c1[_0xa2ad('0x17')]['include']?_[_0xa2ad('0x1d')](_0x3929c1['options']['include'],function(_0x24193e){return{'model':db[_0x24193e['model']],'as':_0x24193e['as'],'attributes':_0x24193e[_0xa2ad('0x1a')],'include':_0x24193e[_0xa2ad('0x1c')]?_[_0xa2ad('0x1d')](_0x24193e[_0xa2ad('0x1c')],function(_0x7cfb12){return{'model':db[_0x7cfb12[_0xa2ad('0x1e')]],'as':_0x7cfb12['as'],'attributes':_0x7cfb12[_0xa2ad('0x1a')],'include':_0x7cfb12[_0xa2ad('0x1c')]?_['map'](_0x7cfb12[_0xa2ad('0x1c')],function(_0x1cab83){return{'model':db[_0x1cab83['model']],'as':_0x1cab83['as'],'attributes':_0x1cab83[_0xa2ad('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa2ad('0x1f')](function(_0x5a55f9){logger[_0xa2ad('0xc')](_0xa2ad('0x21'),_0x3929c1);logger[_0xa2ad('0xe')](_0xa2ad('0x21'),_0x3929c1,JSON['stringify'](_0x5a55f9));_0x335036(_0x5a55f9);})[_0xa2ad('0x15')](function(_0x3ca0bc){logger[_0xa2ad('0x11')](_0xa2ad('0x21'),_0x3ca0bc[_0xa2ad('0x13')],_0x3929c1);_0x281f42(_0x1b0bbb['error'](0x1f4,_0x3ca0bc[_0xa2ad('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index a804790..99a20a5 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 _0x524e=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','update','delete','exports'];(function(_0x55f06f,_0xdabf4){var _0x563d17=function(_0x523486){while(--_0x523486){_0x55f06f['push'](_0x55f06f['shift']());}};_0x563d17(++_0xdabf4);}(_0x524e,0x15e));var _0xe524=function(_0x5a2447,_0x4ca382){_0x5a2447=_0x5a2447-0x0;var _0x49368e=_0x524e[_0x5a2447];return _0x49368e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var auth=require(_0xe524('0x4'));var interaction=require(_0xe524('0x5'));var config=require(_0xe524('0x6'));var controller=require(_0xe524('0x7'));router[_0xe524('0x8')]('/',auth[_0xe524('0x9')](),controller['index']);router[_0xe524('0x8')](_0xe524('0xa'),auth[_0xe524('0x9')](),controller['show']);router[_0xe524('0x8')](_0xe524('0xb'),auth[_0xe524('0x9')](),controller[_0xe524('0xc')]);router[_0xe524('0x8')](_0xe524('0xd'),auth[_0xe524('0x9')](),controller[_0xe524('0xe')]);router[_0xe524('0x8')](_0xe524('0xf'),auth[_0xe524('0x9')](),controller[_0xe524('0x10')]);router[_0xe524('0x8')](_0xe524('0x11'),auth[_0xe524('0x9')](),controller[_0xe524('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe524('0x13')]);router[_0xe524('0x14')](_0xe524('0x11'),auth[_0xe524('0x9')](),controller[_0xe524('0x15')]);router['put'](_0xe524('0xa'),auth['isAuthenticated'](),controller[_0xe524('0x16')]);router[_0xe524('0x17')]('/:id',auth[_0xe524('0x9')](),controller['destroy']);module[_0xe524('0x18')]=router; \ No newline at end of file +var _0x1267=['update','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','put'];(function(_0x460e9c,_0xd3f252){var _0x390a5c=function(_0x19503b){while(--_0x19503b){_0x460e9c['push'](_0x460e9c['shift']());}};_0x390a5c(++_0xd3f252);}(_0x1267,0xb5));var _0x7126=function(_0x54a358,_0x34e54c){_0x54a358=_0x54a358-0x0;var _0x54006d=_0x1267[_0x54a358];return _0x54006d;};'use strict';var multer=require(_0x7126('0x0'));var util=require(_0x7126('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7126('0x2'));var router=express[_0x7126('0x3')]();var auth=require(_0x7126('0x4'));var interaction=require(_0x7126('0x5'));var config=require(_0x7126('0x6'));var controller=require(_0x7126('0x7'));router[_0x7126('0x8')]('/',auth['isAuthenticated'](),controller[_0x7126('0x9')]);router[_0x7126('0x8')](_0x7126('0xa'),auth[_0x7126('0xb')](),controller['show']);router[_0x7126('0x8')]('/:id/fields',auth[_0x7126('0xb')](),controller['getFields']);router[_0x7126('0x8')](_0x7126('0xc'),auth[_0x7126('0xb')](),controller[_0x7126('0xd')]);router[_0x7126('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x7126('0xe')]);router[_0x7126('0x8')](_0x7126('0xf'),auth[_0x7126('0xb')](),controller[_0x7126('0x10')]);router[_0x7126('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7126('0x11')](_0x7126('0xf'),auth['isAuthenticated'](),controller['setTags']);router[_0x7126('0x12')](_0x7126('0xa'),auth['isAuthenticated'](),controller[_0x7126('0x13')]);router['delete'](_0x7126('0xa'),auth[_0x7126('0xb')](),controller['destroy']);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 1a51f36..ee57996 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 _0xb4ac=['exports','STRING','sequelize'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xb4ac,0x179));var _0xcb4a=function(_0x4958c6,_0x91e324){_0x4958c6=_0x4958c6-0x0;var _0x33553c=_0xb4ac[_0x4958c6];return _0x33553c;};'use strict';var Sequelize=require(_0xcb4a('0x0'));module[_0xcb4a('0x1')]={'name':{'type':Sequelize[_0xcb4a('0x2')]},'description':{'type':Sequelize[_0xcb4a('0x2')]}}; \ No newline at end of file +var _0x718e=['exports','STRING','sequelize'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x718e,0x1a9));var _0xe718=function(_0x56e813,_0x2f7fe0){_0x56e813=_0x56e813-0x0;var _0x2ae2a4=_0x718e[_0x56e813];return _0x2ae2a4;};'use strict';var Sequelize=require(_0xe718('0x0'));module[_0xe718('0x1')]={'name':{'type':Sequelize[_0xe718('0x2')]},'description':{'type':Sequelize[_0xe718('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 378d278..01c62fe 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 _0xf7f3=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','show','params','create','body','find','getFields','findOne','map','getSubjects','DeskField','pick','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','ejs','lodash','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','stringify','error','DeskConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','save','update','destroy','stack','name','send','index','DeskConfiguration','rawAttributes','type','key','model','query','keys','filters'];(function(_0x1e9d62,_0x25bb8e){var _0x56c490=function(_0x19f4e7){while(--_0x19f4e7){_0x1e9d62['push'](_0x1e9d62['shift']());}};_0x56c490(++_0x25bb8e);}(_0xf7f3,0x12a));var _0x3f7f=function(_0xee89d0,_0x429f2e){_0xee89d0=_0xee89d0-0x0;var _0x1be501=_0xf7f3[_0xee89d0];return _0x1be501;};'use strict';var pdf=require(_0x3f7f('0x0'));var emlformat=require(_0x3f7f('0x1'));var rimraf=require(_0x3f7f('0x2'));var zipdir=require(_0x3f7f('0x3'));var jsonpatch=require(_0x3f7f('0x4'));var rp=require(_0x3f7f('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3f7f('0x6'));var util=require(_0x3f7f('0x7'));var path=require('path');var sox=require(_0x3f7f('0x8'));var csv=require('to-csv');var ejs=require(_0x3f7f('0x9'));var fs=require('fs');var _=require(_0x3f7f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3f7f('0xb'));var querystring=require(_0x3f7f('0xc'));var Papa=require(_0x3f7f('0xd'));var Redis=require(_0x3f7f('0xe'));var authService=require(_0x3f7f('0xf'));var qs=require(_0x3f7f('0x10'));var as=require(_0x3f7f('0x11'));var hardwareService=require(_0x3f7f('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x3f7f('0x13'));var config=require(_0x3f7f('0x14'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x3f7f('0x15')][_0x3f7f('0x16')]({'port':0x232a});function checkPasswordPattern(_0x5b9d49,_0x25e5fe,_0x30b064){if(_0x30b064){var _0x1aa642=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1aa642['test'](_0x25e5fe)){return _0x5b9d49;}else{throw new db[(_0x3f7f('0x17'))][(_0x3f7f('0x18'))](_0x3f7f('0x19'));}}else{return _0x5b9d49;}}function respondWithRpcPromise(_0x125198,_0x3d8963,_0x53c24b,_0x14c08e){return new BPromise(function(_0x5c7e42,_0x2356fc){var _0x434694=_0x14c08e||client;return _0x434694['request'](_0x125198,_0x53c24b)[_0x3f7f('0x1a')](function(_0x59fd8b){logger[_0x3f7f('0x1b')]('DeskConfiguration,\x20%s,\x20%s',_0x3d8963,'request\x20sent');logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3d8963,_0x3f7f('0x1c'),JSON[_0x3f7f('0x1d')](_0x59fd8b));if(_0x59fd8b[_0x3f7f('0x1e')]){if(_0x59fd8b[_0x3f7f('0x1e')]['code']===0x1f4){logger[_0x3f7f('0x1e')](_0x3f7f('0x1f'),_0x3d8963,_0x59fd8b[_0x3f7f('0x1e')][_0x3f7f('0x20')]);return _0x2356fc(_0x59fd8b[_0x3f7f('0x1e')][_0x3f7f('0x20')]);}logger[_0x3f7f('0x1e')](_0x3f7f('0x1f'),_0x3d8963,_0x59fd8b['error']['message']);return _0x5c7e42(_0x59fd8b[_0x3f7f('0x1e')][_0x3f7f('0x20')]);}else{logger[_0x3f7f('0x1b')]('DeskConfiguration,\x20%s,\x20%s',_0x3d8963,'request\x20sent');_0x5c7e42(_0x59fd8b['result'][_0x3f7f('0x20')]);}})[_0x3f7f('0x21')](function(_0xa96c1f){logger[_0x3f7f('0x1e')]('DeskConfiguration,\x20%s,\x20%s',_0x3d8963,_0xa96c1f);_0x2356fc(_0xa96c1f);});});}function respondWithStatusCode(_0x351bfc,_0x286784){_0x286784=_0x286784||0xcc;return function(_0x913eda){if(_0x913eda){return _0x351bfc[_0x3f7f('0x22')](_0x286784);}return _0x351bfc[_0x3f7f('0x23')](_0x286784)[_0x3f7f('0x24')]();};}function respondWithResult(_0x487dea,_0x219fda){_0x219fda=_0x219fda||0xc8;return function(_0x5e9ad3){if(_0x5e9ad3){return _0x487dea[_0x3f7f('0x23')](_0x219fda)['json'](_0x5e9ad3);}};}function respondWithFilteredResult(_0x207444,_0x1dcd36){return function(_0xb0d442){if(_0xb0d442){var _0x182b52=_0xb0d442[_0x3f7f('0x25')],_0xc1f65c=_0x1dcd36[_0x3f7f('0x26')],_0x10ac1f=_0x1dcd36[_0x3f7f('0x26')]+_0x1dcd36[_0x3f7f('0x27')],_0x1167b8;if(_0x10ac1f>=_0x182b52){_0x10ac1f=_0x182b52;_0x1167b8=0xc8;}else{_0x1167b8=0xce;}_0x207444['status'](_0x1167b8);return _0x207444['set'](_0x3f7f('0x28'),_0xc1f65c+'-'+_0x10ac1f+'/'+_0x182b52)[_0x3f7f('0x29')](_0xb0d442);}return null;};}function patchUpdates(_0x51ac41){return function(_0x1eba4e){try{jsonpatch[_0x3f7f('0x2a')](_0x1eba4e,_0x51ac41,!![]);}catch(_0x2bd11c){return BPromise['reject'](_0x2bd11c);}return _0x1eba4e[_0x3f7f('0x2b')]();};}function saveUpdates(_0x2bf332,_0x472905){return function(_0x5741ba){if(_0x5741ba){return _0x5741ba[_0x3f7f('0x2c')](_0x2bf332)['then'](function(_0x2311a2){return _0x2311a2;});}return null;};}function removeEntity(_0x399663,_0x27a4af){return function(_0x508d67){if(_0x508d67){return _0x508d67[_0x3f7f('0x2d')]()[_0x3f7f('0x1a')](function(){_0x399663[_0x3f7f('0x23')](0xcc)[_0x3f7f('0x24')]();});}};}function handleEntityNotFound(_0x87c07c,_0x41becc){return function(_0xac1127){if(!_0xac1127){_0x87c07c[_0x3f7f('0x22')](0x194);}return _0xac1127;};}function handleError(_0x5b95b4,_0x2c1eb9){_0x2c1eb9=_0x2c1eb9||0x1f4;return function(_0x5acdb2){logger['error'](_0x5acdb2[_0x3f7f('0x2e')]);if(_0x5acdb2[_0x3f7f('0x2f')]){delete _0x5acdb2[_0x3f7f('0x2f')];}_0x5b95b4[_0x3f7f('0x23')](_0x2c1eb9)[_0x3f7f('0x30')](_0x5acdb2);};}exports[_0x3f7f('0x31')]=function(_0x568461,_0x5111d6){var _0x3ce5dc={},_0x256289={},_0x2c46b4={'count':0x0,'rows':[]};var _0x162dd4=_['map'](db[_0x3f7f('0x32')][_0x3f7f('0x33')],function(_0x2abc5c){return{'name':_0x2abc5c['fieldName'],'type':_0x2abc5c[_0x3f7f('0x34')][_0x3f7f('0x35')]};});_0x256289[_0x3f7f('0x36')]=_['map'](_0x162dd4,_0x3f7f('0x2f'));_0x256289[_0x3f7f('0x37')]=_[_0x3f7f('0x38')](_0x568461['query']);_0x256289[_0x3f7f('0x39')]=_[_0x3f7f('0x3a')](_0x256289[_0x3f7f('0x36')],_0x256289[_0x3f7f('0x37')]);_0x3ce5dc[_0x3f7f('0x3b')]=_['intersection'](_0x256289[_0x3f7f('0x36')],qs[_0x3f7f('0x3c')](_0x568461['query']['fields']));_0x3ce5dc[_0x3f7f('0x3b')]=_0x3ce5dc['attributes'][_0x3f7f('0x3d')]?_0x3ce5dc[_0x3f7f('0x3b')]:_0x256289['model'];if(!_0x568461[_0x3f7f('0x37')][_0x3f7f('0x3e')](_0x3f7f('0x3f'))){_0x3ce5dc['limit']=qs[_0x3f7f('0x27')](_0x568461[_0x3f7f('0x37')][_0x3f7f('0x27')]);_0x3ce5dc['offset']=qs[_0x3f7f('0x26')](_0x568461[_0x3f7f('0x37')][_0x3f7f('0x26')]);}_0x3ce5dc[_0x3f7f('0x40')]=qs[_0x3f7f('0x41')](_0x568461[_0x3f7f('0x37')][_0x3f7f('0x41')]);_0x3ce5dc[_0x3f7f('0x42')]=qs[_0x3f7f('0x39')](_['pick'](_0x568461[_0x3f7f('0x37')],_0x256289['filters']),_0x162dd4);if(_0x568461[_0x3f7f('0x37')][_0x3f7f('0x43')]){_0x3ce5dc[_0x3f7f('0x42')]=_[_0x3f7f('0x44')](_0x3ce5dc['where'],{'$or':_['map'](_0x162dd4,function(_0x1e2f7b){if(_0x1e2f7b['type']!=='VIRTUAL'){var _0xb7c3b={};_0xb7c3b[_0x1e2f7b[_0x3f7f('0x2f')]]={'$like':'%'+_0x568461[_0x3f7f('0x37')][_0x3f7f('0x43')]+'%'};return _0xb7c3b;}})});}_0x3ce5dc=_['merge']({},_0x3ce5dc,_0x568461[_0x3f7f('0x45')]);var _0x874eaa={'where':_0x3ce5dc[_0x3f7f('0x42')]};return db[_0x3f7f('0x32')][_0x3f7f('0x25')](_0x874eaa)[_0x3f7f('0x1a')](function(_0x4057a2){_0x2c46b4[_0x3f7f('0x25')]=_0x4057a2;if(_0x568461[_0x3f7f('0x37')][_0x3f7f('0x46')]){_0x3ce5dc[_0x3f7f('0x47')]=[{'all':!![]}];}return db[_0x3f7f('0x32')]['findAll'](_0x3ce5dc);})['then'](function(_0x5dc51c){_0x2c46b4[_0x3f7f('0x48')]=_0x5dc51c;return _0x2c46b4;})[_0x3f7f('0x1a')](respondWithFilteredResult(_0x5111d6,_0x3ce5dc))['catch'](handleError(_0x5111d6,null));};exports[_0x3f7f('0x49')]=function(_0x765da4,_0x3d8dc0){var _0x35f35e={'raw':![],'where':{'id':_0x765da4[_0x3f7f('0x4a')]['id']}},_0x50981f={};_0x50981f[_0x3f7f('0x36')]=_[_0x3f7f('0x38')](db[_0x3f7f('0x32')][_0x3f7f('0x33')]);_0x50981f['query']=_[_0x3f7f('0x38')](_0x765da4[_0x3f7f('0x37')]);_0x50981f[_0x3f7f('0x39')]=_[_0x3f7f('0x3a')](_0x50981f[_0x3f7f('0x36')],_0x50981f[_0x3f7f('0x37')]);_0x35f35e[_0x3f7f('0x3b')]=_[_0x3f7f('0x3a')](_0x50981f[_0x3f7f('0x36')],qs[_0x3f7f('0x3c')](_0x765da4[_0x3f7f('0x37')]['fields']));_0x35f35e[_0x3f7f('0x3b')]=_0x35f35e[_0x3f7f('0x3b')]['length']?_0x35f35e[_0x3f7f('0x3b')]:_0x50981f['model'];if(_0x765da4[_0x3f7f('0x37')]['includeAll']){_0x35f35e[_0x3f7f('0x47')]=[{'all':!![]}];}_0x35f35e=_[_0x3f7f('0x44')]({},_0x35f35e,_0x765da4['options']);return db['DeskConfiguration']['find'](_0x35f35e)[_0x3f7f('0x1a')](handleEntityNotFound(_0x3d8dc0,null))[_0x3f7f('0x1a')](respondWithResult(_0x3d8dc0,null))[_0x3f7f('0x21')](handleError(_0x3d8dc0,null));};exports[_0x3f7f('0x4b')]=function(_0x3c58f9,_0x23c783){return db[_0x3f7f('0x32')]['create'](_0x3c58f9[_0x3f7f('0x4c')],{})[_0x3f7f('0x1a')](respondWithResult(_0x23c783,0xc9))['catch'](handleError(_0x23c783,null));};exports[_0x3f7f('0x2c')]=function(_0x6e6f2d,_0x1ce448){if(_0x6e6f2d[_0x3f7f('0x4c')]['id']){delete _0x6e6f2d['body']['id'];}return db[_0x3f7f('0x32')]['find']({'where':{'id':_0x6e6f2d[_0x3f7f('0x4a')]['id']}})[_0x3f7f('0x1a')](handleEntityNotFound(_0x1ce448,null))[_0x3f7f('0x1a')](saveUpdates(_0x6e6f2d[_0x3f7f('0x4c')],null))[_0x3f7f('0x1a')](respondWithResult(_0x1ce448,null))[_0x3f7f('0x21')](handleError(_0x1ce448,null));};exports['destroy']=function(_0x41fa38,_0x3de831){return db[_0x3f7f('0x32')][_0x3f7f('0x4d')]({'where':{'id':_0x41fa38[_0x3f7f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3de831,null))['then'](removeEntity(_0x3de831,null))[_0x3f7f('0x21')](handleError(_0x3de831,null));};exports[_0x3f7f('0x4e')]=function(_0x2f6206,_0x353356,_0x21f303){var _0x208fa5={};var _0x3a69d8={};var _0x326e4b;var _0x25fa86;return db[_0x3f7f('0x32')][_0x3f7f('0x4f')]({'where':{'id':_0x2f6206[_0x3f7f('0x4a')]['id']}})[_0x3f7f('0x1a')](handleEntityNotFound(_0x353356,null))[_0x3f7f('0x1a')](function(_0x4eab49){if(_0x4eab49){_0x326e4b=_0x4eab49;_0x3a69d8[_0x3f7f('0x36')]=_[_0x3f7f('0x38')](db['DeskField']['rawAttributes']);_0x3a69d8[_0x3f7f('0x37')]=_[_0x3f7f('0x38')](_0x2f6206[_0x3f7f('0x37')]);_0x3a69d8[_0x3f7f('0x39')]=_[_0x3f7f('0x3a')](_0x3a69d8[_0x3f7f('0x36')],_0x3a69d8[_0x3f7f('0x37')]);_0x208fa5[_0x3f7f('0x3b')]=_['intersection'](_0x3a69d8['model'],qs[_0x3f7f('0x3c')](_0x2f6206[_0x3f7f('0x37')]['fields']));_0x208fa5[_0x3f7f('0x3b')]=_0x208fa5[_0x3f7f('0x3b')]['length']?_0x208fa5['attributes']:_0x3a69d8[_0x3f7f('0x36')];_0x208fa5['order']=qs[_0x3f7f('0x41')](_0x2f6206[_0x3f7f('0x37')][_0x3f7f('0x41')]);_0x208fa5[_0x3f7f('0x42')]=qs['filters'](_['pick'](_0x2f6206['query'],_0x3a69d8[_0x3f7f('0x39')]));if(_0x2f6206[_0x3f7f('0x37')][_0x3f7f('0x43')]){_0x208fa5['where']=_[_0x3f7f('0x44')](_0x208fa5[_0x3f7f('0x42')],{'$or':_[_0x3f7f('0x50')](_0x208fa5[_0x3f7f('0x3b')],function(_0x42256a){var _0x31f65f={};_0x31f65f[_0x42256a]={'$like':'%'+_0x2f6206[_0x3f7f('0x37')][_0x3f7f('0x43')]+'%'};return _0x31f65f;})});}_0x208fa5=_[_0x3f7f('0x44')]({},_0x208fa5,_0x2f6206[_0x3f7f('0x45')]);return _0x326e4b[_0x3f7f('0x4e')](_0x208fa5);}})[_0x3f7f('0x1a')](function(_0xd986d5){if(_0xd986d5){_0x25fa86=_0xd986d5['length'];if(!_0x2f6206[_0x3f7f('0x37')]['hasOwnProperty']('nolimit')){_0x208fa5['limit']=qs[_0x3f7f('0x27')](_0x2f6206[_0x3f7f('0x37')][_0x3f7f('0x27')]);_0x208fa5['offset']=qs[_0x3f7f('0x26')](_0x2f6206[_0x3f7f('0x37')][_0x3f7f('0x26')]);}return _0x326e4b['getFields'](_0x208fa5);}})[_0x3f7f('0x1a')](function(_0x2bbff6){if(_0x2bbff6){return _0x2bbff6?{'count':_0x25fa86,'rows':_0x2bbff6}:null;}})[_0x3f7f('0x1a')](respondWithResult(_0x353356,null))['catch'](handleError(_0x353356,null));};exports[_0x3f7f('0x51')]=function(_0x55961a,_0x291067,_0x4edd4b){var _0x26d2a9={};var _0x204082={};var _0x551f32;var _0x4b890e;return db[_0x3f7f('0x32')][_0x3f7f('0x4f')]({'where':{'id':_0x55961a[_0x3f7f('0x4a')]['id']}})[_0x3f7f('0x1a')](handleEntityNotFound(_0x291067,null))[_0x3f7f('0x1a')](function(_0x1c993b){if(_0x1c993b){_0x551f32=_0x1c993b;_0x204082['model']=_[_0x3f7f('0x38')](db[_0x3f7f('0x52')][_0x3f7f('0x33')]);_0x204082[_0x3f7f('0x37')]=_[_0x3f7f('0x38')](_0x55961a[_0x3f7f('0x37')]);_0x204082[_0x3f7f('0x39')]=_[_0x3f7f('0x3a')](_0x204082[_0x3f7f('0x36')],_0x204082[_0x3f7f('0x37')]);_0x26d2a9[_0x3f7f('0x3b')]=_[_0x3f7f('0x3a')](_0x204082[_0x3f7f('0x36')],qs[_0x3f7f('0x3c')](_0x55961a[_0x3f7f('0x37')][_0x3f7f('0x3c')]));_0x26d2a9['attributes']=_0x26d2a9['attributes']['length']?_0x26d2a9['attributes']:_0x204082['model'];_0x26d2a9[_0x3f7f('0x40')]=qs['sort'](_0x55961a[_0x3f7f('0x37')][_0x3f7f('0x41')]);_0x26d2a9['where']=qs[_0x3f7f('0x39')](_[_0x3f7f('0x53')](_0x55961a['query'],_0x204082[_0x3f7f('0x39')]));if(_0x55961a['query'][_0x3f7f('0x43')]){_0x26d2a9['where']=_['merge'](_0x26d2a9['where'],{'$or':_['map'](_0x26d2a9['attributes'],function(_0x5c693f){var _0x2ba885={};_0x2ba885[_0x5c693f]={'$like':'%'+_0x55961a[_0x3f7f('0x37')]['filter']+'%'};return _0x2ba885;})});}_0x26d2a9=_[_0x3f7f('0x44')]({},_0x26d2a9,_0x55961a['options']);return _0x551f32[_0x3f7f('0x51')](_0x26d2a9);}})['then'](function(_0x198b7f){if(_0x198b7f){_0x4b890e=_0x198b7f[_0x3f7f('0x3d')];if(!_0x55961a[_0x3f7f('0x37')]['hasOwnProperty'](_0x3f7f('0x3f'))){_0x26d2a9[_0x3f7f('0x27')]=qs[_0x3f7f('0x27')](_0x55961a[_0x3f7f('0x37')][_0x3f7f('0x27')]);_0x26d2a9[_0x3f7f('0x26')]=qs['offset'](_0x55961a[_0x3f7f('0x37')][_0x3f7f('0x26')]);}return _0x551f32[_0x3f7f('0x51')](_0x26d2a9);}})[_0x3f7f('0x1a')](function(_0x2b8308){if(_0x2b8308){return _0x2b8308?{'count':_0x4b890e,'rows':_0x2b8308}:null;}})[_0x3f7f('0x1a')](respondWithResult(_0x291067,null))[_0x3f7f('0x21')](handleError(_0x291067,null));};exports[_0x3f7f('0x54')]=function(_0xf7f773,_0x5f1f87,_0x3e395){var _0x29893f={};var _0x380c1f={};var _0x69ac7e;var _0x29db7b;return db[_0x3f7f('0x32')][_0x3f7f('0x4f')]({'where':{'id':_0xf7f773[_0x3f7f('0x4a')]['id']}})[_0x3f7f('0x1a')](handleEntityNotFound(_0x5f1f87,null))[_0x3f7f('0x1a')](function(_0x550fe8){if(_0x550fe8){_0x69ac7e=_0x550fe8;_0x380c1f[_0x3f7f('0x36')]=_['keys'](db[_0x3f7f('0x52')][_0x3f7f('0x33')]);_0x380c1f[_0x3f7f('0x37')]=_[_0x3f7f('0x38')](_0xf7f773['query']);_0x380c1f[_0x3f7f('0x39')]=_['intersection'](_0x380c1f[_0x3f7f('0x36')],_0x380c1f[_0x3f7f('0x37')]);_0x29893f[_0x3f7f('0x3b')]=_[_0x3f7f('0x3a')](_0x380c1f[_0x3f7f('0x36')],qs[_0x3f7f('0x3c')](_0xf7f773[_0x3f7f('0x37')]['fields']));_0x29893f[_0x3f7f('0x3b')]=_0x29893f[_0x3f7f('0x3b')][_0x3f7f('0x3d')]?_0x29893f[_0x3f7f('0x3b')]:_0x380c1f[_0x3f7f('0x36')];_0x29893f[_0x3f7f('0x40')]=qs[_0x3f7f('0x41')](_0xf7f773['query'][_0x3f7f('0x41')]);_0x29893f[_0x3f7f('0x42')]=qs[_0x3f7f('0x39')](_['pick'](_0xf7f773[_0x3f7f('0x37')],_0x380c1f[_0x3f7f('0x39')]));if(_0xf7f773['query'][_0x3f7f('0x43')]){_0x29893f[_0x3f7f('0x42')]=_[_0x3f7f('0x44')](_0x29893f[_0x3f7f('0x42')],{'$or':_[_0x3f7f('0x50')](_0x29893f[_0x3f7f('0x3b')],function(_0x318bd6){var _0x331c17={};_0x331c17[_0x318bd6]={'$like':'%'+_0xf7f773[_0x3f7f('0x37')][_0x3f7f('0x43')]+'%'};return _0x331c17;})});}_0x29893f=_['merge']({},_0x29893f,_0xf7f773[_0x3f7f('0x45')]);return _0x69ac7e[_0x3f7f('0x54')](_0x29893f);}})['then'](function(_0x335816){if(_0x335816){_0x29db7b=_0x335816[_0x3f7f('0x3d')];if(!_0xf7f773[_0x3f7f('0x37')][_0x3f7f('0x3e')](_0x3f7f('0x3f'))){_0x29893f[_0x3f7f('0x27')]=qs[_0x3f7f('0x27')](_0xf7f773['query'][_0x3f7f('0x27')]);_0x29893f['offset']=qs['offset'](_0xf7f773[_0x3f7f('0x37')][_0x3f7f('0x26')]);}return _0x69ac7e[_0x3f7f('0x54')](_0x29893f);}})[_0x3f7f('0x1a')](function(_0x3dbc72){if(_0x3dbc72){return _0x3dbc72?{'count':_0x29db7b,'rows':_0x3dbc72}:null;}})[_0x3f7f('0x1a')](respondWithResult(_0x5f1f87,null))[_0x3f7f('0x21')](handleError(_0x5f1f87,null));};exports[_0x3f7f('0x55')]=function(_0x13b078,_0x23dd76,_0x16e238){var _0x39c415={};var _0x10e0c9={};var _0x14b9f8;var _0x558101;return db['DeskConfiguration'][_0x3f7f('0x4f')]({'where':{'id':_0x13b078['params']['id']}})[_0x3f7f('0x1a')](handleEntityNotFound(_0x23dd76,null))[_0x3f7f('0x1a')](function(_0x5ce1e9){if(_0x5ce1e9){_0x14b9f8=_0x5ce1e9;_0x10e0c9[_0x3f7f('0x36')]=_['keys'](db[_0x3f7f('0x56')][_0x3f7f('0x33')]);_0x10e0c9[_0x3f7f('0x37')]=_[_0x3f7f('0x38')](_0x13b078['query']);_0x10e0c9[_0x3f7f('0x39')]=_[_0x3f7f('0x3a')](_0x10e0c9[_0x3f7f('0x36')],_0x10e0c9['query']);_0x39c415[_0x3f7f('0x3b')]=_['intersection'](_0x10e0c9[_0x3f7f('0x36')],qs[_0x3f7f('0x3c')](_0x13b078[_0x3f7f('0x37')][_0x3f7f('0x3c')]));_0x39c415[_0x3f7f('0x3b')]=_0x39c415[_0x3f7f('0x3b')]['length']?_0x39c415['attributes']:_0x10e0c9[_0x3f7f('0x36')];_0x39c415[_0x3f7f('0x40')]=qs[_0x3f7f('0x41')](_0x13b078[_0x3f7f('0x37')][_0x3f7f('0x41')]);_0x39c415[_0x3f7f('0x42')]=qs[_0x3f7f('0x39')](_[_0x3f7f('0x53')](_0x13b078[_0x3f7f('0x37')],_0x10e0c9[_0x3f7f('0x39')]));if(_0x13b078[_0x3f7f('0x37')]['filter']){_0x39c415[_0x3f7f('0x42')]=_[_0x3f7f('0x44')](_0x39c415[_0x3f7f('0x42')],{'$or':_['map'](_0x39c415[_0x3f7f('0x3b')],function(_0xa9e7c6){var _0x6fb56a={};_0x6fb56a[_0xa9e7c6]={'$like':'%'+_0x13b078[_0x3f7f('0x37')][_0x3f7f('0x43')]+'%'};return _0x6fb56a;})});}_0x39c415=_[_0x3f7f('0x44')]({},_0x39c415,_0x13b078[_0x3f7f('0x45')]);return _0x14b9f8[_0x3f7f('0x55')](_0x39c415);}})['then'](function(_0x18119c){if(_0x18119c){_0x558101=_0x18119c[_0x3f7f('0x3d')];if(!_0x13b078[_0x3f7f('0x37')]['hasOwnProperty']('nolimit')){_0x39c415['limit']=qs[_0x3f7f('0x27')](_0x13b078[_0x3f7f('0x37')][_0x3f7f('0x27')]);_0x39c415['offset']=qs['offset'](_0x13b078[_0x3f7f('0x37')][_0x3f7f('0x26')]);}return _0x14b9f8['getTags'](_0x39c415);}})['then'](function(_0xec273c){if(_0xec273c){return _0xec273c?{'count':_0x558101,'rows':_0xec273c}:null;}})['then'](respondWithResult(_0x23dd76,null))['catch'](handleError(_0x23dd76,null));};exports[_0x3f7f('0x57')]=function(_0x593330,_0xf665ce,_0x39e2ef){if(_0x593330[_0x3f7f('0x4c')]['id']){delete _0x593330['body']['id'];}return db[_0x3f7f('0x32')][_0x3f7f('0x4f')]({'where':{'id':_0x593330[_0x3f7f('0x4a')]['id']}})[_0x3f7f('0x1a')](handleEntityNotFound(_0xf665ce,null))[_0x3f7f('0x1a')](function(_0x4fbebc){if(_0x4fbebc){return _0x4fbebc[_0x3f7f('0x57')](_0x593330[_0x3f7f('0x4c')][_0x3f7f('0x58')]||[]);}return null;})['then'](respondWithResult(_0xf665ce,null))[_0x3f7f('0x21')](handleError(_0xf665ce,null));}; \ No newline at end of file +var _0xcb81=['end','stack','name','send','index','DeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','filters','include','create','body','find','getFields','findOne','DeskField','pick','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','zip-dir','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','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','json','count','offset','limit','set','apply','save','update'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xcb81,0x154));var _0x1cb8=function(_0x3e6b2f,_0x1ffa07){_0x3e6b2f=_0x3e6b2f-0x0;var _0x323215=_0xcb81[_0x3e6b2f];return _0x323215;};'use strict';var pdf=require(_0x1cb8('0x0'));var emlformat=require(_0x1cb8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1cb8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1cb8('0x3'));var Mustache=require(_0x1cb8('0x4'));var util=require(_0x1cb8('0x5'));var path=require(_0x1cb8('0x6'));var sox=require(_0x1cb8('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb8('0x8'));var fs=require('fs');var _=require(_0x1cb8('0x9'));var squel=require('squel');var crypto=require(_0x1cb8('0xa'));var jsforce=require(_0x1cb8('0xb'));var deskjs=require(_0x1cb8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1cb8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1cb8('0xe'));var qs=require(_0x1cb8('0xf'));var as=require(_0x1cb8('0x10'));var hardwareService=require(_0x1cb8('0x11'));var logger=require(_0x1cb8('0x12'))(_0x1cb8('0x13'));var utils=require(_0x1cb8('0x14'));var config=require(_0x1cb8('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x1cb8('0x16'));var client=jayson[_0x1cb8('0x17')][_0x1cb8('0x18')]({'port':0x232a});function checkPasswordPattern(_0x299eea,_0x1371cb,_0x5dfde1){if(_0x5dfde1){var _0x389c12=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x389c12[_0x1cb8('0x19')](_0x1371cb)){return _0x299eea;}else{throw new db[(_0x1cb8('0x1a'))][(_0x1cb8('0x1b'))](_0x1cb8('0x1c'));}}else{return _0x299eea;}}function respondWithRpcPromise(_0xe5402a,_0x339ad0,_0x243930,_0x5af4a3){return new BPromise(function(_0x17a95d,_0x4b4917){var _0xf6b347=_0x5af4a3||client;return _0xf6b347[_0x1cb8('0x1d')](_0xe5402a,_0x243930)[_0x1cb8('0x1e')](function(_0x46abd0){logger[_0x1cb8('0x1f')](_0x1cb8('0x20'),_0x339ad0,_0x1cb8('0x21'));logger[_0x1cb8('0x22')](_0x1cb8('0x23'),_0x339ad0,_0x1cb8('0x21'),JSON[_0x1cb8('0x24')](_0x46abd0));if(_0x46abd0[_0x1cb8('0x25')]){if(_0x46abd0['error'][_0x1cb8('0x26')]===0x1f4){logger[_0x1cb8('0x25')](_0x1cb8('0x20'),_0x339ad0,_0x46abd0[_0x1cb8('0x25')]['message']);return _0x4b4917(_0x46abd0[_0x1cb8('0x25')]['message']);}logger[_0x1cb8('0x25')](_0x1cb8('0x20'),_0x339ad0,_0x46abd0[_0x1cb8('0x25')][_0x1cb8('0x27')]);return _0x17a95d(_0x46abd0['error']['message']);}else{logger[_0x1cb8('0x1f')](_0x1cb8('0x20'),_0x339ad0,_0x1cb8('0x21'));_0x17a95d(_0x46abd0[_0x1cb8('0x28')][_0x1cb8('0x27')]);}})[_0x1cb8('0x29')](function(_0x144b66){logger['error'](_0x1cb8('0x20'),_0x339ad0,_0x144b66);_0x4b4917(_0x144b66);});});}function respondWithStatusCode(_0x4554d5,_0x35c890){_0x35c890=_0x35c890||0xcc;return function(_0xeeb21d){if(_0xeeb21d){return _0x4554d5[_0x1cb8('0x2a')](_0x35c890);}return _0x4554d5[_0x1cb8('0x2b')](_0x35c890)['end']();};}function respondWithResult(_0x1ec995,_0x23ac21){_0x23ac21=_0x23ac21||0xc8;return function(_0xfdfb31){if(_0xfdfb31){return _0x1ec995[_0x1cb8('0x2b')](_0x23ac21)[_0x1cb8('0x2c')](_0xfdfb31);}};}function respondWithFilteredResult(_0x4a9b74,_0xed576b){return function(_0x2e3adf){if(_0x2e3adf){var _0x3a8b53=_0x2e3adf[_0x1cb8('0x2d')],_0x21c17a=_0xed576b[_0x1cb8('0x2e')],_0x4fda96=_0xed576b['offset']+_0xed576b[_0x1cb8('0x2f')],_0x2a79e0;if(_0x4fda96>=_0x3a8b53){_0x4fda96=_0x3a8b53;_0x2a79e0=0xc8;}else{_0x2a79e0=0xce;}_0x4a9b74[_0x1cb8('0x2b')](_0x2a79e0);return _0x4a9b74[_0x1cb8('0x30')]('Content-Range',_0x21c17a+'-'+_0x4fda96+'/'+_0x3a8b53)[_0x1cb8('0x2c')](_0x2e3adf);}return null;};}function patchUpdates(_0x3e2af4){return function(_0x239c62){try{jsonpatch[_0x1cb8('0x31')](_0x239c62,_0x3e2af4,!![]);}catch(_0x36f63d){return BPromise['reject'](_0x36f63d);}return _0x239c62[_0x1cb8('0x32')]();};}function saveUpdates(_0x1de806,_0x21fde7){return function(_0x1413a2){if(_0x1413a2){return _0x1413a2[_0x1cb8('0x33')](_0x1de806)[_0x1cb8('0x1e')](function(_0x145f75){return _0x145f75;});}return null;};}function removeEntity(_0x18cc99,_0x1aaae4){return function(_0x562975){if(_0x562975){return _0x562975['destroy']()[_0x1cb8('0x1e')](function(){_0x18cc99[_0x1cb8('0x2b')](0xcc)[_0x1cb8('0x34')]();});}};}function handleEntityNotFound(_0x5be4b7,_0x5f04e3){return function(_0x20fca9){if(!_0x20fca9){_0x5be4b7[_0x1cb8('0x2a')](0x194);}return _0x20fca9;};}function handleError(_0x9cdbed,_0xb21715){_0xb21715=_0xb21715||0x1f4;return function(_0x198848){logger[_0x1cb8('0x25')](_0x198848[_0x1cb8('0x35')]);if(_0x198848[_0x1cb8('0x36')]){delete _0x198848['name'];}_0x9cdbed[_0x1cb8('0x2b')](_0xb21715)[_0x1cb8('0x37')](_0x198848);};}exports[_0x1cb8('0x38')]=function(_0x328b7c,_0x1bf06d){var _0x421ce7={},_0xb5bc3c={},_0x2ad7f6={'count':0x0,'rows':[]};var _0x2e6ddb=_['map'](db[_0x1cb8('0x39')][_0x1cb8('0x3a')],function(_0x5e9f5f){return{'name':_0x5e9f5f[_0x1cb8('0x3b')],'type':_0x5e9f5f[_0x1cb8('0x3c')][_0x1cb8('0x3d')]};});_0xb5bc3c[_0x1cb8('0x3e')]=_[_0x1cb8('0x3f')](_0x2e6ddb,'name');_0xb5bc3c[_0x1cb8('0x40')]=_[_0x1cb8('0x41')](_0x328b7c[_0x1cb8('0x40')]);_0xb5bc3c['filters']=_['intersection'](_0xb5bc3c['model'],_0xb5bc3c[_0x1cb8('0x40')]);_0x421ce7[_0x1cb8('0x42')]=_[_0x1cb8('0x43')](_0xb5bc3c[_0x1cb8('0x3e')],qs['fields'](_0x328b7c['query'][_0x1cb8('0x44')]));_0x421ce7[_0x1cb8('0x42')]=_0x421ce7[_0x1cb8('0x42')][_0x1cb8('0x45')]?_0x421ce7[_0x1cb8('0x42')]:_0xb5bc3c[_0x1cb8('0x3e')];if(!_0x328b7c[_0x1cb8('0x40')][_0x1cb8('0x46')]('nolimit')){_0x421ce7[_0x1cb8('0x2f')]=qs[_0x1cb8('0x2f')](_0x328b7c[_0x1cb8('0x40')][_0x1cb8('0x2f')]);_0x421ce7['offset']=qs[_0x1cb8('0x2e')](_0x328b7c['query'][_0x1cb8('0x2e')]);}_0x421ce7[_0x1cb8('0x47')]=qs['sort'](_0x328b7c[_0x1cb8('0x40')][_0x1cb8('0x48')]);_0x421ce7[_0x1cb8('0x49')]=qs['filters'](_['pick'](_0x328b7c[_0x1cb8('0x40')],_0xb5bc3c['filters']),_0x2e6ddb);if(_0x328b7c[_0x1cb8('0x40')][_0x1cb8('0x4a')]){_0x421ce7[_0x1cb8('0x49')]=_[_0x1cb8('0x4b')](_0x421ce7[_0x1cb8('0x49')],{'$or':_[_0x1cb8('0x3f')](_0x2e6ddb,function(_0x15e960){if(_0x15e960['type']!==_0x1cb8('0x4c')){var _0x1df9cb={};_0x1df9cb[_0x15e960[_0x1cb8('0x36')]]={'$like':'%'+_0x328b7c[_0x1cb8('0x40')]['filter']+'%'};return _0x1df9cb;}})});}_0x421ce7=_[_0x1cb8('0x4b')]({},_0x421ce7,_0x328b7c[_0x1cb8('0x4d')]);var _0x1b83a6={'where':_0x421ce7[_0x1cb8('0x49')]};return db[_0x1cb8('0x39')]['count'](_0x1b83a6)[_0x1cb8('0x1e')](function(_0x4452ba){_0x2ad7f6[_0x1cb8('0x2d')]=_0x4452ba;if(_0x328b7c[_0x1cb8('0x40')][_0x1cb8('0x4e')]){_0x421ce7['include']=[{'all':!![]}];}return db[_0x1cb8('0x39')][_0x1cb8('0x4f')](_0x421ce7);})['then'](function(_0x423916){_0x2ad7f6[_0x1cb8('0x50')]=_0x423916;return _0x2ad7f6;})[_0x1cb8('0x1e')](respondWithFilteredResult(_0x1bf06d,_0x421ce7))[_0x1cb8('0x29')](handleError(_0x1bf06d,null));};exports[_0x1cb8('0x51')]=function(_0x4564aa,_0x3b063c){var _0x219541={'raw':![],'where':{'id':_0x4564aa[_0x1cb8('0x52')]['id']}},_0xd530f8={};_0xd530f8[_0x1cb8('0x3e')]=_[_0x1cb8('0x41')](db[_0x1cb8('0x39')][_0x1cb8('0x3a')]);_0xd530f8['query']=_[_0x1cb8('0x41')](_0x4564aa[_0x1cb8('0x40')]);_0xd530f8[_0x1cb8('0x53')]=_[_0x1cb8('0x43')](_0xd530f8[_0x1cb8('0x3e')],_0xd530f8[_0x1cb8('0x40')]);_0x219541[_0x1cb8('0x42')]=_['intersection'](_0xd530f8[_0x1cb8('0x3e')],qs[_0x1cb8('0x44')](_0x4564aa[_0x1cb8('0x40')]['fields']));_0x219541['attributes']=_0x219541[_0x1cb8('0x42')][_0x1cb8('0x45')]?_0x219541[_0x1cb8('0x42')]:_0xd530f8[_0x1cb8('0x3e')];if(_0x4564aa[_0x1cb8('0x40')]['includeAll']){_0x219541[_0x1cb8('0x54')]=[{'all':!![]}];}_0x219541=_[_0x1cb8('0x4b')]({},_0x219541,_0x4564aa[_0x1cb8('0x4d')]);return db['DeskConfiguration']['find'](_0x219541)['then'](handleEntityNotFound(_0x3b063c,null))[_0x1cb8('0x1e')](respondWithResult(_0x3b063c,null))['catch'](handleError(_0x3b063c,null));};exports[_0x1cb8('0x55')]=function(_0x34d5d1,_0xcd5fe2){return db[_0x1cb8('0x39')][_0x1cb8('0x55')](_0x34d5d1['body'],{})[_0x1cb8('0x1e')](respondWithResult(_0xcd5fe2,0xc9))[_0x1cb8('0x29')](handleError(_0xcd5fe2,null));};exports[_0x1cb8('0x33')]=function(_0x1d179b,_0x43585c){if(_0x1d179b[_0x1cb8('0x56')]['id']){delete _0x1d179b[_0x1cb8('0x56')]['id'];}return db['DeskConfiguration'][_0x1cb8('0x57')]({'where':{'id':_0x1d179b[_0x1cb8('0x52')]['id']}})[_0x1cb8('0x1e')](handleEntityNotFound(_0x43585c,null))[_0x1cb8('0x1e')](saveUpdates(_0x1d179b[_0x1cb8('0x56')],null))[_0x1cb8('0x1e')](respondWithResult(_0x43585c,null))[_0x1cb8('0x29')](handleError(_0x43585c,null));};exports['destroy']=function(_0x542064,_0x56ee83){return db[_0x1cb8('0x39')]['find']({'where':{'id':_0x542064[_0x1cb8('0x52')]['id']}})[_0x1cb8('0x1e')](handleEntityNotFound(_0x56ee83,null))[_0x1cb8('0x1e')](removeEntity(_0x56ee83,null))[_0x1cb8('0x29')](handleError(_0x56ee83,null));};exports[_0x1cb8('0x58')]=function(_0x5d736c,_0x579d54,_0x5de2b2){var _0x38e3d9={};var _0x3f8cba={};var _0x482d4f;var _0x2dc31b;return db['DeskConfiguration'][_0x1cb8('0x59')]({'where':{'id':_0x5d736c[_0x1cb8('0x52')]['id']}})['then'](handleEntityNotFound(_0x579d54,null))[_0x1cb8('0x1e')](function(_0x19f3f0){if(_0x19f3f0){_0x482d4f=_0x19f3f0;_0x3f8cba[_0x1cb8('0x3e')]=_[_0x1cb8('0x41')](db[_0x1cb8('0x5a')][_0x1cb8('0x3a')]);_0x3f8cba[_0x1cb8('0x40')]=_[_0x1cb8('0x41')](_0x5d736c[_0x1cb8('0x40')]);_0x3f8cba[_0x1cb8('0x53')]=_[_0x1cb8('0x43')](_0x3f8cba[_0x1cb8('0x3e')],_0x3f8cba[_0x1cb8('0x40')]);_0x38e3d9['attributes']=_[_0x1cb8('0x43')](_0x3f8cba[_0x1cb8('0x3e')],qs[_0x1cb8('0x44')](_0x5d736c['query'][_0x1cb8('0x44')]));_0x38e3d9[_0x1cb8('0x42')]=_0x38e3d9[_0x1cb8('0x42')][_0x1cb8('0x45')]?_0x38e3d9['attributes']:_0x3f8cba[_0x1cb8('0x3e')];_0x38e3d9[_0x1cb8('0x47')]=qs['sort'](_0x5d736c[_0x1cb8('0x40')][_0x1cb8('0x48')]);_0x38e3d9['where']=qs[_0x1cb8('0x53')](_[_0x1cb8('0x5b')](_0x5d736c[_0x1cb8('0x40')],_0x3f8cba[_0x1cb8('0x53')]));if(_0x5d736c['query']['filter']){_0x38e3d9['where']=_[_0x1cb8('0x4b')](_0x38e3d9[_0x1cb8('0x49')],{'$or':_[_0x1cb8('0x3f')](_0x38e3d9[_0x1cb8('0x42')],function(_0x2e2d1c){var _0x2f8cea={};_0x2f8cea[_0x2e2d1c]={'$like':'%'+_0x5d736c[_0x1cb8('0x40')]['filter']+'%'};return _0x2f8cea;})});}_0x38e3d9=_[_0x1cb8('0x4b')]({},_0x38e3d9,_0x5d736c[_0x1cb8('0x4d')]);return _0x482d4f[_0x1cb8('0x58')](_0x38e3d9);}})['then'](function(_0x3ed577){if(_0x3ed577){_0x2dc31b=_0x3ed577[_0x1cb8('0x45')];if(!_0x5d736c[_0x1cb8('0x40')][_0x1cb8('0x46')](_0x1cb8('0x5c'))){_0x38e3d9['limit']=qs[_0x1cb8('0x2f')](_0x5d736c[_0x1cb8('0x40')][_0x1cb8('0x2f')]);_0x38e3d9['offset']=qs[_0x1cb8('0x2e')](_0x5d736c[_0x1cb8('0x40')]['offset']);}return _0x482d4f[_0x1cb8('0x58')](_0x38e3d9);}})['then'](function(_0x5b3517){if(_0x5b3517){return _0x5b3517?{'count':_0x2dc31b,'rows':_0x5b3517}:null;}})[_0x1cb8('0x1e')](respondWithResult(_0x579d54,null))[_0x1cb8('0x29')](handleError(_0x579d54,null));};exports[_0x1cb8('0x5d')]=function(_0x4eba1a,_0x4945c9,_0x5943d5){var _0x6ac83={};var _0x2c40f1={};var _0x2b1cca;var _0x3ff46e;return db[_0x1cb8('0x39')][_0x1cb8('0x59')]({'where':{'id':_0x4eba1a[_0x1cb8('0x52')]['id']}})['then'](handleEntityNotFound(_0x4945c9,null))['then'](function(_0x524d5c){if(_0x524d5c){_0x2b1cca=_0x524d5c;_0x2c40f1['model']=_[_0x1cb8('0x41')](db['DeskField'][_0x1cb8('0x3a')]);_0x2c40f1['query']=_['keys'](_0x4eba1a['query']);_0x2c40f1[_0x1cb8('0x53')]=_[_0x1cb8('0x43')](_0x2c40f1[_0x1cb8('0x3e')],_0x2c40f1[_0x1cb8('0x40')]);_0x6ac83[_0x1cb8('0x42')]=_[_0x1cb8('0x43')](_0x2c40f1[_0x1cb8('0x3e')],qs[_0x1cb8('0x44')](_0x4eba1a[_0x1cb8('0x40')][_0x1cb8('0x44')]));_0x6ac83[_0x1cb8('0x42')]=_0x6ac83[_0x1cb8('0x42')][_0x1cb8('0x45')]?_0x6ac83[_0x1cb8('0x42')]:_0x2c40f1[_0x1cb8('0x3e')];_0x6ac83[_0x1cb8('0x47')]=qs['sort'](_0x4eba1a[_0x1cb8('0x40')][_0x1cb8('0x48')]);_0x6ac83[_0x1cb8('0x49')]=qs[_0x1cb8('0x53')](_[_0x1cb8('0x5b')](_0x4eba1a[_0x1cb8('0x40')],_0x2c40f1['filters']));if(_0x4eba1a[_0x1cb8('0x40')][_0x1cb8('0x4a')]){_0x6ac83[_0x1cb8('0x49')]=_[_0x1cb8('0x4b')](_0x6ac83[_0x1cb8('0x49')],{'$or':_['map'](_0x6ac83[_0x1cb8('0x42')],function(_0x34094c){var _0x5bfe0c={};_0x5bfe0c[_0x34094c]={'$like':'%'+_0x4eba1a[_0x1cb8('0x40')]['filter']+'%'};return _0x5bfe0c;})});}_0x6ac83=_[_0x1cb8('0x4b')]({},_0x6ac83,_0x4eba1a[_0x1cb8('0x4d')]);return _0x2b1cca[_0x1cb8('0x5d')](_0x6ac83);}})['then'](function(_0x44b951){if(_0x44b951){_0x3ff46e=_0x44b951[_0x1cb8('0x45')];if(!_0x4eba1a['query']['hasOwnProperty'](_0x1cb8('0x5c'))){_0x6ac83[_0x1cb8('0x2f')]=qs['limit'](_0x4eba1a[_0x1cb8('0x40')][_0x1cb8('0x2f')]);_0x6ac83[_0x1cb8('0x2e')]=qs[_0x1cb8('0x2e')](_0x4eba1a[_0x1cb8('0x40')][_0x1cb8('0x2e')]);}return _0x2b1cca[_0x1cb8('0x5d')](_0x6ac83);}})['then'](function(_0x438d49){if(_0x438d49){return _0x438d49?{'count':_0x3ff46e,'rows':_0x438d49}:null;}})['then'](respondWithResult(_0x4945c9,null))['catch'](handleError(_0x4945c9,null));};exports['getDescriptions']=function(_0x3a7740,_0x217178,_0x4ab060){var _0x1d30e1={};var _0xa0b86={};var _0x5a04b3;var _0x4822cc;return db['DeskConfiguration'][_0x1cb8('0x59')]({'where':{'id':_0x3a7740['params']['id']}})[_0x1cb8('0x1e')](handleEntityNotFound(_0x217178,null))[_0x1cb8('0x1e')](function(_0x2e392f){if(_0x2e392f){_0x5a04b3=_0x2e392f;_0xa0b86['model']=_['keys'](db[_0x1cb8('0x5a')]['rawAttributes']);_0xa0b86[_0x1cb8('0x40')]=_[_0x1cb8('0x41')](_0x3a7740[_0x1cb8('0x40')]);_0xa0b86[_0x1cb8('0x53')]=_[_0x1cb8('0x43')](_0xa0b86[_0x1cb8('0x3e')],_0xa0b86[_0x1cb8('0x40')]);_0x1d30e1[_0x1cb8('0x42')]=_[_0x1cb8('0x43')](_0xa0b86[_0x1cb8('0x3e')],qs[_0x1cb8('0x44')](_0x3a7740[_0x1cb8('0x40')][_0x1cb8('0x44')]));_0x1d30e1['attributes']=_0x1d30e1['attributes'][_0x1cb8('0x45')]?_0x1d30e1[_0x1cb8('0x42')]:_0xa0b86[_0x1cb8('0x3e')];_0x1d30e1[_0x1cb8('0x47')]=qs['sort'](_0x3a7740[_0x1cb8('0x40')][_0x1cb8('0x48')]);_0x1d30e1[_0x1cb8('0x49')]=qs[_0x1cb8('0x53')](_[_0x1cb8('0x5b')](_0x3a7740['query'],_0xa0b86[_0x1cb8('0x53')]));if(_0x3a7740[_0x1cb8('0x40')][_0x1cb8('0x4a')]){_0x1d30e1[_0x1cb8('0x49')]=_[_0x1cb8('0x4b')](_0x1d30e1[_0x1cb8('0x49')],{'$or':_[_0x1cb8('0x3f')](_0x1d30e1[_0x1cb8('0x42')],function(_0x3c0da5){var _0x7e24da={};_0x7e24da[_0x3c0da5]={'$like':'%'+_0x3a7740['query'][_0x1cb8('0x4a')]+'%'};return _0x7e24da;})});}_0x1d30e1=_[_0x1cb8('0x4b')]({},_0x1d30e1,_0x3a7740['options']);return _0x5a04b3['getDescriptions'](_0x1d30e1);}})[_0x1cb8('0x1e')](function(_0x5bbb90){if(_0x5bbb90){_0x4822cc=_0x5bbb90['length'];if(!_0x3a7740[_0x1cb8('0x40')][_0x1cb8('0x46')]('nolimit')){_0x1d30e1['limit']=qs[_0x1cb8('0x2f')](_0x3a7740['query'][_0x1cb8('0x2f')]);_0x1d30e1['offset']=qs[_0x1cb8('0x2e')](_0x3a7740[_0x1cb8('0x40')]['offset']);}return _0x5a04b3[_0x1cb8('0x5e')](_0x1d30e1);}})[_0x1cb8('0x1e')](function(_0x17615b){if(_0x17615b){return _0x17615b?{'count':_0x4822cc,'rows':_0x17615b}:null;}})[_0x1cb8('0x1e')](respondWithResult(_0x217178,null))[_0x1cb8('0x29')](handleError(_0x217178,null));};exports[_0x1cb8('0x5f')]=function(_0xeea4ce,_0x1f76d9,_0x4ef049){var _0x2025ec={};var _0x5de093={};var _0x1b90c6;var _0x24852e;return db[_0x1cb8('0x39')]['findOne']({'where':{'id':_0xeea4ce['params']['id']}})[_0x1cb8('0x1e')](handleEntityNotFound(_0x1f76d9,null))[_0x1cb8('0x1e')](function(_0x3868f4){if(_0x3868f4){_0x1b90c6=_0x3868f4;_0x5de093['model']=_['keys'](db['Tag']['rawAttributes']);_0x5de093[_0x1cb8('0x40')]=_[_0x1cb8('0x41')](_0xeea4ce[_0x1cb8('0x40')]);_0x5de093[_0x1cb8('0x53')]=_[_0x1cb8('0x43')](_0x5de093[_0x1cb8('0x3e')],_0x5de093['query']);_0x2025ec[_0x1cb8('0x42')]=_[_0x1cb8('0x43')](_0x5de093[_0x1cb8('0x3e')],qs[_0x1cb8('0x44')](_0xeea4ce[_0x1cb8('0x40')]['fields']));_0x2025ec[_0x1cb8('0x42')]=_0x2025ec[_0x1cb8('0x42')][_0x1cb8('0x45')]?_0x2025ec[_0x1cb8('0x42')]:_0x5de093[_0x1cb8('0x3e')];_0x2025ec[_0x1cb8('0x47')]=qs[_0x1cb8('0x48')](_0xeea4ce['query']['sort']);_0x2025ec['where']=qs[_0x1cb8('0x53')](_[_0x1cb8('0x5b')](_0xeea4ce[_0x1cb8('0x40')],_0x5de093[_0x1cb8('0x53')]));if(_0xeea4ce['query'][_0x1cb8('0x4a')]){_0x2025ec['where']=_[_0x1cb8('0x4b')](_0x2025ec[_0x1cb8('0x49')],{'$or':_[_0x1cb8('0x3f')](_0x2025ec['attributes'],function(_0x5e6b36){var _0x26190e={};_0x26190e[_0x5e6b36]={'$like':'%'+_0xeea4ce[_0x1cb8('0x40')][_0x1cb8('0x4a')]+'%'};return _0x26190e;})});}_0x2025ec=_[_0x1cb8('0x4b')]({},_0x2025ec,_0xeea4ce['options']);return _0x1b90c6[_0x1cb8('0x5f')](_0x2025ec);}})[_0x1cb8('0x1e')](function(_0x2fd2b2){if(_0x2fd2b2){_0x24852e=_0x2fd2b2['length'];if(!_0xeea4ce[_0x1cb8('0x40')][_0x1cb8('0x46')](_0x1cb8('0x5c'))){_0x2025ec[_0x1cb8('0x2f')]=qs[_0x1cb8('0x2f')](_0xeea4ce['query']['limit']);_0x2025ec[_0x1cb8('0x2e')]=qs['offset'](_0xeea4ce[_0x1cb8('0x40')][_0x1cb8('0x2e')]);}return _0x1b90c6['getTags'](_0x2025ec);}})[_0x1cb8('0x1e')](function(_0x1280c2){if(_0x1280c2){return _0x1280c2?{'count':_0x24852e,'rows':_0x1280c2}:null;}})[_0x1cb8('0x1e')](respondWithResult(_0x1f76d9,null))[_0x1cb8('0x29')](handleError(_0x1f76d9,null));};exports[_0x1cb8('0x60')]=function(_0x4cd7d8,_0x1a8ac0,_0x1a700d){if(_0x4cd7d8[_0x1cb8('0x56')]['id']){delete _0x4cd7d8[_0x1cb8('0x56')]['id'];}return db['DeskConfiguration'][_0x1cb8('0x59')]({'where':{'id':_0x4cd7d8[_0x1cb8('0x52')]['id']}})[_0x1cb8('0x1e')](handleEntityNotFound(_0x1a8ac0,null))[_0x1cb8('0x1e')](function(_0x5933c6){if(_0x5933c6){return _0x5933c6['setTags'](_0x4cd7d8['body'][_0x1cb8('0x61')]||[]);}return null;})[_0x1cb8('0x1e')](respondWithResult(_0x1a8ac0,null))[_0x1cb8('0x29')](handleError(_0x1a8ac0,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index a60b4c4..6407d2e 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 _0x167b=['request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','DeskConfiguration','int_desk_configurations','lodash','../../config/logger','moment','bluebird'];(function(_0x2bfde2,_0x3c4486){var _0x39fe35=function(_0x5336f3){while(--_0x5336f3){_0x2bfde2['push'](_0x2bfde2['shift']());}};_0x39fe35(++_0x3c4486);}(_0x167b,0x167));var _0xb167=function(_0x38dc8b,_0x128585){_0x38dc8b=_0x38dc8b-0x0;var _0x26492e=_0x167b[_0x38dc8b];return _0x26492e;};'use strict';var _=require(_0xb167('0x0'));var util=require('util');var logger=require(_0xb167('0x1'))('api');var moment=require(_0xb167('0x2'));var BPromise=require(_0xb167('0x3'));var rp=require(_0xb167('0x4'));var fs=require('fs');var path=require(_0xb167('0x5'));var rimraf=require(_0xb167('0x6'));var config=require(_0xb167('0x7'));var attributes=require(_0xb167('0x8'));module['exports']=function(_0x487311,_0x9ff591){return _0x487311['define'](_0xb167('0x9'),attributes,{'tableName':_0xb167('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd314=['moment','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','../../config/logger','api'];(function(_0x52d847,_0x54130f){var _0x4272d7=function(_0x3a92eb){while(--_0x3a92eb){_0x52d847['push'](_0x52d847['shift']());}};_0x4272d7(++_0x54130f);}(_0xd314,0x1dd));var _0x4d31=function(_0x260554,_0xa38304){_0x260554=_0x260554-0x0;var _0x392cf6=_0xd314[_0x260554];return _0x392cf6;};'use strict';var _=require(_0x4d31('0x0'));var util=require('util');var logger=require(_0x4d31('0x1'))(_0x4d31('0x2'));var moment=require(_0x4d31('0x3'));var BPromise=require('bluebird');var rp=require(_0x4d31('0x4'));var fs=require('fs');var path=require(_0x4d31('0x5'));var rimraf=require('rimraf');var config=require(_0x4d31('0x6'));var attributes=require(_0x4d31('0x7'));module[_0x4d31('0x8')]=function(_0x195af9,_0x5c772d){return _0x195af9[_0x4d31('0x9')](_0x4d31('0xa'),attributes,{'tableName':_0x4d31('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index a200740..dd9c388 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 _0x2a41=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x298fa9,_0x214e11){var _0x47bef3=function(_0x19271e){while(--_0x19271e){_0x298fa9['push'](_0x298fa9['shift']());}};_0x47bef3(++_0x214e11);}(_0x2a41,0x126));var _0x12a4=function(_0x1eb4e0,_0x4ebc2d){_0x1eb4e0=_0x1eb4e0-0x0;var _0x18ec21=_0x2a41[_0x1eb4e0];return _0x18ec21;};'use strict';var _=require(_0x12a4('0x0'));var util=require('util');var moment=require(_0x12a4('0x1'));var BPromise=require(_0x12a4('0x2'));var rs=require(_0x12a4('0x3'));var fs=require('fs');var Redis=require(_0x12a4('0x4'));var db=require(_0x12a4('0x5'))['db'];var utils=require(_0x12a4('0x6'));var logger=require(_0x12a4('0x7'))(_0x12a4('0x8'));var config=require(_0x12a4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x12a4('0xa')][_0x12a4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58fffc,_0x5d2353,_0x2042cc){return new BPromise(function(_0x5ae867,_0x23bb59){return client[_0x12a4('0xc')](_0x58fffc,_0x2042cc)[_0x12a4('0xd')](function(_0x38d894){logger[_0x12a4('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x5d2353,_0x12a4('0xf'));logger[_0x12a4('0x10')](_0x12a4('0x11'),_0x5d2353,_0x12a4('0xf'),JSON[_0x12a4('0x12')](_0x38d894));if(_0x38d894[_0x12a4('0x13')]){if(_0x38d894[_0x12a4('0x13')][_0x12a4('0x14')]===0x1f4){logger[_0x12a4('0x13')](_0x12a4('0x15'),_0x5d2353,_0x38d894[_0x12a4('0x13')][_0x12a4('0x16')]);return _0x23bb59(_0x38d894['error'][_0x12a4('0x16')]);}logger[_0x12a4('0x13')](_0x12a4('0x15'),_0x5d2353,_0x38d894[_0x12a4('0x13')][_0x12a4('0x16')]);return _0x5ae867(_0x38d894['error']['message']);}else{logger[_0x12a4('0xe')](_0x12a4('0x15'),_0x5d2353,_0x12a4('0xf'));_0x5ae867(_0x38d894[_0x12a4('0x17')]['message']);}})[_0x12a4('0x18')](function(_0x28d311){logger[_0x12a4('0x13')](_0x12a4('0x15'),_0x5d2353,_0x28d311);_0x23bb59(_0x28d311);});});} \ No newline at end of file +var _0x5712=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x2842b4,_0x2b1b7b){var _0x2b9521=function(_0x3613b8){while(--_0x3613b8){_0x2842b4['push'](_0x2842b4['shift']());}};_0x2b9521(++_0x2b1b7b);}(_0x5712,0x140));var _0x2571=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5712[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x2571('0x0'));var util=require(_0x2571('0x1'));var moment=require(_0x2571('0x2'));var BPromise=require(_0x2571('0x3'));var rs=require(_0x2571('0x4'));var fs=require('fs');var Redis=require(_0x2571('0x5'));var db=require(_0x2571('0x6'))['db'];var utils=require(_0x2571('0x7'));var logger=require(_0x2571('0x8'))(_0x2571('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2571('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e19b2,_0x251ee6,_0x3ca885){return new BPromise(function(_0x204ecc,_0xda659a){return client[_0x2571('0xb')](_0x3e19b2,_0x3ca885)['then'](function(_0x1f0c98){logger['info'](_0x2571('0xc'),_0x251ee6,_0x2571('0xd'));logger[_0x2571('0xe')](_0x2571('0xf'),_0x251ee6,_0x2571('0xd'),JSON[_0x2571('0x10')](_0x1f0c98));if(_0x1f0c98[_0x2571('0x11')]){if(_0x1f0c98[_0x2571('0x11')]['code']===0x1f4){logger['error'](_0x2571('0xc'),_0x251ee6,_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);return _0xda659a(_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);}logger[_0x2571('0x11')](_0x2571('0xc'),_0x251ee6,_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);return _0x204ecc(_0x1f0c98[_0x2571('0x11')][_0x2571('0x12')]);}else{logger[_0x2571('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x251ee6,_0x2571('0xd'));_0x204ecc(_0x1f0c98['result']['message']);}})['catch'](function(_0x4c3e11){logger[_0x2571('0x11')](_0x2571('0xc'),_0x251ee6,_0x4c3e11);_0xda659a(_0x4c3e11);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 836dd38..5bc89b9 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 _0xad2e=['create','put','update','destroy','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','isAuthenticated'];(function(_0x41b9f0,_0x5a306a){var _0x1e565b=function(_0x168072){while(--_0x168072){_0x41b9f0['push'](_0x41b9f0['shift']());}};_0x1e565b(++_0x5a306a);}(_0xad2e,0xf2));var _0xead2=function(_0x2f30b1,_0x11ed62){_0x2f30b1=_0x2f30b1-0x0;var _0x20f5fc=_0xad2e[_0x2f30b1];return _0x20f5fc;};'use strict';var multer=require('multer');var util=require(_0xead2('0x0'));var path=require('path');var timeout=require(_0xead2('0x1'));var express=require('express');var router=express[_0xead2('0x2')]();var auth=require(_0xead2('0x3'));var interaction=require(_0xead2('0x4'));var config=require(_0xead2('0x5'));var controller=require('./intDeskField.controller');router[_0xead2('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xead2('0x7'),auth['isAuthenticated'](),controller[_0xead2('0x8')]);router['post']('/',auth[_0xead2('0x9')](),controller[_0xead2('0xa')]);router[_0xead2('0xb')](_0xead2('0x7'),auth[_0xead2('0x9')](),controller[_0xead2('0xc')]);router['delete'](_0xead2('0x7'),auth[_0xead2('0x9')](),controller[_0xead2('0xd')]);module['exports']=router; \ No newline at end of file +var _0xce71=['isAuthenticated','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','index','get'];(function(_0x2a390b,_0xf49f9b){var _0x5df10a=function(_0x115dbe){while(--_0x115dbe){_0x2a390b['push'](_0x2a390b['shift']());}};_0x5df10a(++_0xf49f9b);}(_0xce71,0xf9));var _0x1ce7=function(_0x2e6724,_0xee938a){_0x2e6724=_0x2e6724-0x0;var _0x3eb41b=_0xce71[_0x2e6724];return _0x3eb41b;};'use strict';var multer=require(_0x1ce7('0x0'));var util=require(_0x1ce7('0x1'));var path=require(_0x1ce7('0x2'));var timeout=require(_0x1ce7('0x3'));var express=require(_0x1ce7('0x4'));var router=express[_0x1ce7('0x5')]();var auth=require(_0x1ce7('0x6'));var interaction=require(_0x1ce7('0x7'));var config=require('../../config/environment');var controller=require(_0x1ce7('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1ce7('0x9')]);router[_0x1ce7('0xa')]('/:id',auth[_0x1ce7('0xb')](),controller[_0x1ce7('0xc')]);router[_0x1ce7('0xd')]('/',auth[_0x1ce7('0xb')](),controller[_0x1ce7('0xe')]);router[_0x1ce7('0xf')](_0x1ce7('0x10'),auth[_0x1ce7('0xb')](),controller[_0x1ce7('0x11')]);router['delete'](_0x1ce7('0x10'),auth[_0x1ce7('0xb')](),controller[_0x1ce7('0x12')]);module[_0x1ce7('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 7be1b6d..c2eeb84 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 _0x311e=['string','variable','keyValue','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x49f5e2,_0x8d1b76){var _0x1fbc27=function(_0x17a135){while(--_0x17a135){_0x49f5e2['push'](_0x49f5e2['shift']());}};_0x1fbc27(++_0x8d1b76);}(_0x311e,0x1e3));var _0xe311=function(_0x457152,_0x12b788){_0x457152=_0x457152-0x0;var _0x394514=_0x311e[_0x457152];return _0x394514;};'use strict';var Sequelize=require(_0xe311('0x0'));module[_0xe311('0x1')]={'type':{'type':Sequelize[_0xe311('0x2')](_0xe311('0x3'),_0xe311('0x4'),'customVariable',_0xe311('0x5')),'defaultValue':_0xe311('0x3')},'content':{'type':Sequelize[_0xe311('0x6')]},'key':{'type':Sequelize[_0xe311('0x6')]},'keyType':{'type':Sequelize[_0xe311('0x2')](_0xe311('0x3'),_0xe311('0x4'),_0xe311('0x7'))},'keyContent':{'type':Sequelize[_0xe311('0x6')]},'idField':{'type':Sequelize[_0xe311('0x6')]},'nameField':{'type':Sequelize[_0xe311('0x6')]},'customField':{'type':Sequelize[_0xe311('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe311('0x6')]}}; \ No newline at end of file +var _0x61ba=['ENUM','variable','BOOLEAN','sequelize','string','customVariable','keyValue','STRING'];(function(_0xcd15de,_0x4de4a8){var _0x3d87a0=function(_0x4037a0){while(--_0x4037a0){_0xcd15de['push'](_0xcd15de['shift']());}};_0x3d87a0(++_0x4de4a8);}(_0x61ba,0x163));var _0xa61b=function(_0x3daac,_0x3b5fb5){_0x3daac=_0x3daac-0x0;var _0x4877d1=_0x61ba[_0x3daac];return _0x4877d1;};'use strict';var Sequelize=require(_0xa61b('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xa61b('0x1'),'variable',_0xa61b('0x2'),_0xa61b('0x3')),'defaultValue':_0xa61b('0x1')},'content':{'type':Sequelize[_0xa61b('0x4')]},'key':{'type':Sequelize[_0xa61b('0x4')]},'keyType':{'type':Sequelize[_0xa61b('0x5')](_0xa61b('0x1'),_0xa61b('0x6'),_0xa61b('0x2'))},'keyContent':{'type':Sequelize[_0xa61b('0x4')]},'idField':{'type':Sequelize[_0xa61b('0x4')]},'nameField':{'type':Sequelize[_0xa61b('0x4')]},'customField':{'type':Sequelize[_0xa61b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa61b('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 701e201..b122acb 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 _0x8bb8=['ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x5ee4f6,_0x392d57){var _0x517d03=function(_0x2b5b71){while(--_0x2b5b71){_0x5ee4f6['push'](_0x5ee4f6['shift']());}};_0x517d03(++_0x392d57);}(_0x8bb8,0x168));var _0x88bb=function(_0x4ad387,_0x244189){_0x4ad387=_0x4ad387-0x0;var _0x25a6e3=_0x8bb8[_0x4ad387];return _0x25a6e3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x88bb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x88bb('0x1'));var rp=require(_0x88bb('0x2'));var moment=require(_0x88bb('0x3'));var BPromise=require(_0x88bb('0x4'));var Mustache=require(_0x88bb('0x5'));var util=require(_0x88bb('0x6'));var path=require(_0x88bb('0x7'));var sox=require(_0x88bb('0x8'));var csv=require(_0x88bb('0x9'));var ejs=require(_0x88bb('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x88bb('0xb'));var crypto=require(_0x88bb('0xc'));var jsforce=require(_0x88bb('0xd'));var deskjs=require(_0x88bb('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x88bb('0xf'));var Redis=require(_0x88bb('0x10'));var authService=require(_0x88bb('0x11'));var qs=require(_0x88bb('0x12'));var as=require(_0x88bb('0x13'));var hardwareService=require(_0x88bb('0x14'));var logger=require(_0x88bb('0x15'))(_0x88bb('0x16'));var utils=require(_0x88bb('0x17'));var config=require(_0x88bb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa1bfd3,_0x418c45){_0x418c45=_0x418c45||0xcc;return function(_0xfbfce0){if(_0xfbfce0){return _0xa1bfd3['sendStatus'](_0x418c45);}return _0xa1bfd3[_0x88bb('0x19')](_0x418c45)[_0x88bb('0x1a')]();};}function respondWithResult(_0x38011b,_0x3576b8){_0x3576b8=_0x3576b8||0xc8;return function(_0x94f5a8){if(_0x94f5a8){return _0x38011b[_0x88bb('0x19')](_0x3576b8)[_0x88bb('0x1b')](_0x94f5a8);}};}function respondWithFilteredResult(_0x4f4116,_0x293952){return function(_0x4e963d){if(_0x4e963d){var _0x5b303b=_0x4e963d[_0x88bb('0x1c')],_0x4a692f=_0x293952[_0x88bb('0x1d')],_0x5c34b9=_0x293952['offset']+_0x293952[_0x88bb('0x1e')],_0x18e78c;if(_0x5c34b9>=_0x5b303b){_0x5c34b9=_0x5b303b;_0x18e78c=0xc8;}else{_0x18e78c=0xce;}_0x4f4116[_0x88bb('0x19')](_0x18e78c);return _0x4f4116[_0x88bb('0x1f')](_0x88bb('0x20'),_0x4a692f+'-'+_0x5c34b9+'/'+_0x5b303b)[_0x88bb('0x1b')](_0x4e963d);}return null;};}function patchUpdates(_0x56c092){return function(_0x43746e){try{jsonpatch[_0x88bb('0x21')](_0x43746e,_0x56c092,!![]);}catch(_0x470795){return BPromise['reject'](_0x470795);}return _0x43746e['save']();};}function saveUpdates(_0x3b8c89,_0xb06fd9){return function(_0x4bbdb7){if(_0x4bbdb7){return _0x4bbdb7[_0x88bb('0x22')](_0x3b8c89)[_0x88bb('0x23')](function(_0x293a10){return _0x293a10;});}return null;};}function removeEntity(_0x2bcc8b,_0x5ef330){return function(_0x552c55){if(_0x552c55){return _0x552c55[_0x88bb('0x24')]()[_0x88bb('0x23')](function(){_0x2bcc8b[_0x88bb('0x19')](0xcc)[_0x88bb('0x1a')]();});}};}function handleEntityNotFound(_0x4eebb5,_0x4b8a01){return function(_0xfdb90a){if(!_0xfdb90a){_0x4eebb5['sendStatus'](0x194);}return _0xfdb90a;};}function handleError(_0x57c4de,_0x200b7a){_0x200b7a=_0x200b7a||0x1f4;return function(_0x3bf419){logger[_0x88bb('0x25')](_0x3bf419[_0x88bb('0x26')]);if(_0x3bf419[_0x88bb('0x27')]){delete _0x3bf419['name'];}_0x57c4de['status'](_0x200b7a)[_0x88bb('0x28')](_0x3bf419);};}exports[_0x88bb('0x29')]=function(_0x5c5bd7,_0x1eabd4){var _0xc89d48={},_0x45ff41={},_0x7453d1={'count':0x0,'rows':[]};var _0x5e27f7=_[_0x88bb('0x2a')](db[_0x88bb('0x2b')][_0x88bb('0x2c')],function(_0x186a4a){return{'name':_0x186a4a[_0x88bb('0x2d')],'type':_0x186a4a[_0x88bb('0x2e')][_0x88bb('0x2f')]};});_0x45ff41[_0x88bb('0x30')]=_['map'](_0x5e27f7,_0x88bb('0x27'));_0x45ff41[_0x88bb('0x31')]=_[_0x88bb('0x32')](_0x5c5bd7[_0x88bb('0x31')]);_0x45ff41[_0x88bb('0x33')]=_[_0x88bb('0x34')](_0x45ff41[_0x88bb('0x30')],_0x45ff41[_0x88bb('0x31')]);_0xc89d48[_0x88bb('0x35')]=_['intersection'](_0x45ff41[_0x88bb('0x30')],qs[_0x88bb('0x36')](_0x5c5bd7[_0x88bb('0x31')]['fields']));_0xc89d48[_0x88bb('0x35')]=_0xc89d48[_0x88bb('0x35')]['length']?_0xc89d48[_0x88bb('0x35')]:_0x45ff41[_0x88bb('0x30')];if(!_0x5c5bd7[_0x88bb('0x31')][_0x88bb('0x37')](_0x88bb('0x38'))){_0xc89d48['limit']=qs[_0x88bb('0x1e')](_0x5c5bd7[_0x88bb('0x31')][_0x88bb('0x1e')]);_0xc89d48[_0x88bb('0x1d')]=qs[_0x88bb('0x1d')](_0x5c5bd7[_0x88bb('0x31')][_0x88bb('0x1d')]);}_0xc89d48[_0x88bb('0x39')]=qs['sort'](_0x5c5bd7[_0x88bb('0x31')][_0x88bb('0x3a')]);_0xc89d48['where']=qs[_0x88bb('0x33')](_['pick'](_0x5c5bd7[_0x88bb('0x31')],_0x45ff41[_0x88bb('0x33')]),_0x5e27f7);if(_0x5c5bd7[_0x88bb('0x31')]['filter']){_0xc89d48[_0x88bb('0x3b')]=_[_0x88bb('0x3c')](_0xc89d48[_0x88bb('0x3b')],{'$or':_[_0x88bb('0x2a')](_0x5e27f7,function(_0x10fe8b){if(_0x10fe8b[_0x88bb('0x2e')]!==_0x88bb('0x3d')){var _0x27dc1d={};_0x27dc1d[_0x10fe8b['name']]={'$like':'%'+_0x5c5bd7[_0x88bb('0x31')]['filter']+'%'};return _0x27dc1d;}})});}_0xc89d48=_[_0x88bb('0x3c')]({},_0xc89d48,_0x5c5bd7[_0x88bb('0x3e')]);var _0x16d5ab={'where':_0xc89d48['where']};return db['DeskField'][_0x88bb('0x1c')](_0x16d5ab)[_0x88bb('0x23')](function(_0x580d7b){_0x7453d1[_0x88bb('0x1c')]=_0x580d7b;if(_0x5c5bd7[_0x88bb('0x31')][_0x88bb('0x3f')]){_0xc89d48[_0x88bb('0x40')]=[{'all':!![]}];}return db['DeskField'][_0x88bb('0x41')](_0xc89d48);})[_0x88bb('0x23')](function(_0x28e1cc){_0x7453d1[_0x88bb('0x42')]=_0x28e1cc;return _0x7453d1;})[_0x88bb('0x23')](respondWithFilteredResult(_0x1eabd4,_0xc89d48))[_0x88bb('0x43')](handleError(_0x1eabd4,null));};exports[_0x88bb('0x44')]=function(_0x4930b2,_0x40fae0){var _0x113b86={'raw':!![],'where':{'id':_0x4930b2[_0x88bb('0x45')]['id']}},_0x2c7637={};_0x2c7637['model']=_['keys'](db[_0x88bb('0x2b')][_0x88bb('0x2c')]);_0x2c7637[_0x88bb('0x31')]=_['keys'](_0x4930b2[_0x88bb('0x31')]);_0x2c7637[_0x88bb('0x33')]=_[_0x88bb('0x34')](_0x2c7637['model'],_0x2c7637[_0x88bb('0x31')]);_0x113b86[_0x88bb('0x35')]=_[_0x88bb('0x34')](_0x2c7637[_0x88bb('0x30')],qs[_0x88bb('0x36')](_0x4930b2[_0x88bb('0x31')][_0x88bb('0x36')]));_0x113b86['attributes']=_0x113b86[_0x88bb('0x35')][_0x88bb('0x46')]?_0x113b86['attributes']:_0x2c7637['model'];if(_0x4930b2[_0x88bb('0x31')][_0x88bb('0x3f')]){_0x113b86[_0x88bb('0x40')]=[{'all':!![]}];}_0x113b86=_[_0x88bb('0x3c')]({},_0x113b86,_0x4930b2[_0x88bb('0x3e')]);return db['DeskField']['find'](_0x113b86)[_0x88bb('0x23')](handleEntityNotFound(_0x40fae0,null))[_0x88bb('0x23')](respondWithResult(_0x40fae0,null))['catch'](handleError(_0x40fae0,null));};exports[_0x88bb('0x47')]=function(_0x3facb8,_0x23a336){return db[_0x88bb('0x2b')][_0x88bb('0x47')](_0x3facb8[_0x88bb('0x48')],{})['then'](respondWithResult(_0x23a336,0xc9))[_0x88bb('0x43')](handleError(_0x23a336,null));};exports['update']=function(_0x55ca0e,_0x2b8203){if(_0x55ca0e['body']['id']){delete _0x55ca0e['body']['id'];}return db[_0x88bb('0x2b')][_0x88bb('0x49')]({'where':{'id':_0x55ca0e[_0x88bb('0x45')]['id']}})[_0x88bb('0x23')](handleEntityNotFound(_0x2b8203,null))[_0x88bb('0x23')](saveUpdates(_0x55ca0e[_0x88bb('0x48')],null))[_0x88bb('0x23')](respondWithResult(_0x2b8203,null))[_0x88bb('0x43')](handleError(_0x2b8203,null));};exports['destroy']=function(_0x14f694,_0x19ec41){return db[_0x88bb('0x2b')][_0x88bb('0x49')]({'where':{'id':_0x14f694[_0x88bb('0x45')]['id']}})[_0x88bb('0x23')](handleEntityNotFound(_0x19ec41,null))[_0x88bb('0x23')](removeEntity(_0x19ec41,null))[_0x88bb('0x43')](handleError(_0x19ec41,null));}; \ No newline at end of file +var _0x375c=['params','includeAll','find','body','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','end','sendStatus','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','filter','options','then','include','rows','catch'];(function(_0x54934d,_0x5e4b3a){var _0x37b414=function(_0x505c22){while(--_0x505c22){_0x54934d['push'](_0x54934d['shift']());}};_0x37b414(++_0x5e4b3a);}(_0x375c,0x130));var _0xc375=function(_0x213127,_0x1a0287){_0x213127=_0x213127-0x0;var _0x535b4e=_0x375c[_0x213127];return _0x535b4e;};'use strict';var pdf=require(_0xc375('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc375('0x1'));var jsonpatch=require(_0xc375('0x2'));var rp=require(_0xc375('0x3'));var moment=require('moment');var BPromise=require(_0xc375('0x4'));var Mustache=require(_0xc375('0x5'));var util=require(_0xc375('0x6'));var path=require(_0xc375('0x7'));var sox=require(_0xc375('0x8'));var csv=require(_0xc375('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc375('0xa'));var jsforce=require(_0xc375('0xb'));var deskjs=require(_0xc375('0xc'));var toCsv=require(_0xc375('0x9'));var querystring=require(_0xc375('0xd'));var Papa=require(_0xc375('0xe'));var Redis=require(_0xc375('0xf'));var authService=require(_0xc375('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc375('0x11'));var hardwareService=require(_0xc375('0x12'));var logger=require(_0xc375('0x13'))(_0xc375('0x14'));var utils=require(_0xc375('0x15'));var config=require(_0xc375('0x16'));var db=require(_0xc375('0x17'))['db'];function respondWithStatusCode(_0x20acdc,_0x10895d){_0x10895d=_0x10895d||0xcc;return function(_0x1a21ff){if(_0x1a21ff){return _0x20acdc['sendStatus'](_0x10895d);}return _0x20acdc[_0xc375('0x18')](_0x10895d)['end']();};}function respondWithResult(_0x4ecf66,_0x47cab5){_0x47cab5=_0x47cab5||0xc8;return function(_0x2ddbdb){if(_0x2ddbdb){return _0x4ecf66[_0xc375('0x18')](_0x47cab5)['json'](_0x2ddbdb);}};}function respondWithFilteredResult(_0x2a788d,_0x3b5cc0){return function(_0x856eab){if(_0x856eab){var _0x38a3e5=_0x856eab[_0xc375('0x19')],_0x1bc300=_0x3b5cc0['offset'],_0x54dd4a=_0x3b5cc0['offset']+_0x3b5cc0[_0xc375('0x1a')],_0x2fb19c;if(_0x54dd4a>=_0x38a3e5){_0x54dd4a=_0x38a3e5;_0x2fb19c=0xc8;}else{_0x2fb19c=0xce;}_0x2a788d[_0xc375('0x18')](_0x2fb19c);return _0x2a788d[_0xc375('0x1b')](_0xc375('0x1c'),_0x1bc300+'-'+_0x54dd4a+'/'+_0x38a3e5)[_0xc375('0x1d')](_0x856eab);}return null;};}function patchUpdates(_0x1d6e6f){return function(_0x595031){try{jsonpatch[_0xc375('0x1e')](_0x595031,_0x1d6e6f,!![]);}catch(_0x466954){return BPromise[_0xc375('0x1f')](_0x466954);}return _0x595031[_0xc375('0x20')]();};}function saveUpdates(_0x153b42,_0xa2ac87){return function(_0x5b1fc1){if(_0x5b1fc1){return _0x5b1fc1[_0xc375('0x21')](_0x153b42)['then'](function(_0x6b836f){return _0x6b836f;});}return null;};}function removeEntity(_0x3d4e5e,_0x238004){return function(_0x40d8c5){if(_0x40d8c5){return _0x40d8c5[_0xc375('0x22')]()['then'](function(){_0x3d4e5e['status'](0xcc)[_0xc375('0x23')]();});}};}function handleEntityNotFound(_0x1d783d,_0x59ed20){return function(_0x531068){if(!_0x531068){_0x1d783d[_0xc375('0x24')](0x194);}return _0x531068;};}function handleError(_0x3c711c,_0x347cb7){_0x347cb7=_0x347cb7||0x1f4;return function(_0x37280e){logger[_0xc375('0x25')](_0x37280e[_0xc375('0x26')]);if(_0x37280e['name']){delete _0x37280e[_0xc375('0x27')];}_0x3c711c[_0xc375('0x18')](_0x347cb7)[_0xc375('0x28')](_0x37280e);};}exports[_0xc375('0x29')]=function(_0x3f622b,_0x45f3d9){var _0xf061be={},_0x3a9a05={},_0x491fd8={'count':0x0,'rows':[]};var _0x6c7d2e=_[_0xc375('0x2a')](db[_0xc375('0x2b')][_0xc375('0x2c')],function(_0x2648e6){return{'name':_0x2648e6[_0xc375('0x2d')],'type':_0x2648e6[_0xc375('0x2e')][_0xc375('0x2f')]};});_0x3a9a05[_0xc375('0x30')]=_[_0xc375('0x2a')](_0x6c7d2e,'name');_0x3a9a05[_0xc375('0x31')]=_[_0xc375('0x32')](_0x3f622b[_0xc375('0x31')]);_0x3a9a05[_0xc375('0x33')]=_[_0xc375('0x34')](_0x3a9a05[_0xc375('0x30')],_0x3a9a05['query']);_0xf061be[_0xc375('0x35')]=_['intersection'](_0x3a9a05['model'],qs[_0xc375('0x36')](_0x3f622b[_0xc375('0x31')]['fields']));_0xf061be['attributes']=_0xf061be[_0xc375('0x35')][_0xc375('0x37')]?_0xf061be['attributes']:_0x3a9a05['model'];if(!_0x3f622b['query'][_0xc375('0x38')](_0xc375('0x39'))){_0xf061be[_0xc375('0x1a')]=qs[_0xc375('0x1a')](_0x3f622b[_0xc375('0x31')][_0xc375('0x1a')]);_0xf061be['offset']=qs[_0xc375('0x3a')](_0x3f622b[_0xc375('0x31')][_0xc375('0x3a')]);}_0xf061be[_0xc375('0x3b')]=qs[_0xc375('0x3c')](_0x3f622b[_0xc375('0x31')][_0xc375('0x3c')]);_0xf061be[_0xc375('0x3d')]=qs['filters'](_[_0xc375('0x3e')](_0x3f622b[_0xc375('0x31')],_0x3a9a05[_0xc375('0x33')]),_0x6c7d2e);if(_0x3f622b[_0xc375('0x31')]['filter']){_0xf061be[_0xc375('0x3d')]=_[_0xc375('0x3f')](_0xf061be[_0xc375('0x3d')],{'$or':_[_0xc375('0x2a')](_0x6c7d2e,function(_0x217de9){if(_0x217de9[_0xc375('0x2e')]!==_0xc375('0x40')){var _0x1d9f8b={};_0x1d9f8b[_0x217de9[_0xc375('0x27')]]={'$like':'%'+_0x3f622b[_0xc375('0x31')][_0xc375('0x41')]+'%'};return _0x1d9f8b;}})});}_0xf061be=_[_0xc375('0x3f')]({},_0xf061be,_0x3f622b[_0xc375('0x42')]);var _0x56ae6f={'where':_0xf061be[_0xc375('0x3d')]};return db[_0xc375('0x2b')]['count'](_0x56ae6f)[_0xc375('0x43')](function(_0x2e2a68){_0x491fd8[_0xc375('0x19')]=_0x2e2a68;if(_0x3f622b[_0xc375('0x31')]['includeAll']){_0xf061be[_0xc375('0x44')]=[{'all':!![]}];}return db['DeskField']['findAll'](_0xf061be);})[_0xc375('0x43')](function(_0x3896f9){_0x491fd8[_0xc375('0x45')]=_0x3896f9;return _0x491fd8;})[_0xc375('0x43')](respondWithFilteredResult(_0x45f3d9,_0xf061be))[_0xc375('0x46')](handleError(_0x45f3d9,null));};exports['show']=function(_0xc64849,_0x43144b){var _0x164860={'raw':!![],'where':{'id':_0xc64849[_0xc375('0x47')]['id']}},_0x4edf81={};_0x4edf81[_0xc375('0x30')]=_[_0xc375('0x32')](db[_0xc375('0x2b')][_0xc375('0x2c')]);_0x4edf81[_0xc375('0x31')]=_['keys'](_0xc64849[_0xc375('0x31')]);_0x4edf81[_0xc375('0x33')]=_['intersection'](_0x4edf81[_0xc375('0x30')],_0x4edf81[_0xc375('0x31')]);_0x164860[_0xc375('0x35')]=_[_0xc375('0x34')](_0x4edf81['model'],qs[_0xc375('0x36')](_0xc64849[_0xc375('0x31')]['fields']));_0x164860['attributes']=_0x164860['attributes'][_0xc375('0x37')]?_0x164860[_0xc375('0x35')]:_0x4edf81[_0xc375('0x30')];if(_0xc64849[_0xc375('0x31')][_0xc375('0x48')]){_0x164860[_0xc375('0x44')]=[{'all':!![]}];}_0x164860=_[_0xc375('0x3f')]({},_0x164860,_0xc64849[_0xc375('0x42')]);return db[_0xc375('0x2b')][_0xc375('0x49')](_0x164860)[_0xc375('0x43')](handleEntityNotFound(_0x43144b,null))[_0xc375('0x43')](respondWithResult(_0x43144b,null))[_0xc375('0x46')](handleError(_0x43144b,null));};exports['create']=function(_0x1fc37e,_0x3b6e5a){return db['DeskField']['create'](_0x1fc37e[_0xc375('0x4a')],{})['then'](respondWithResult(_0x3b6e5a,0xc9))['catch'](handleError(_0x3b6e5a,null));};exports[_0xc375('0x21')]=function(_0x4767e4,_0x1431df){if(_0x4767e4[_0xc375('0x4a')]['id']){delete _0x4767e4[_0xc375('0x4a')]['id'];}return db[_0xc375('0x2b')][_0xc375('0x49')]({'where':{'id':_0x4767e4['params']['id']}})['then'](handleEntityNotFound(_0x1431df,null))[_0xc375('0x43')](saveUpdates(_0x4767e4[_0xc375('0x4a')],null))[_0xc375('0x43')](respondWithResult(_0x1431df,null))['catch'](handleError(_0x1431df,null));};exports[_0xc375('0x22')]=function(_0x56ad54,_0x41197c){return db[_0xc375('0x2b')][_0xc375('0x49')]({'where':{'id':_0x56ad54[_0xc375('0x47')]['id']}})[_0xc375('0x43')](handleEntityNotFound(_0x41197c,null))[_0xc375('0x43')](removeEntity(_0x41197c,null))['catch'](handleError(_0x41197c,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 560c94d..9c5775e 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 _0xbfbd=['lodash','util','../../config/logger','api','moment','path','rimraf','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId'];(function(_0x12e4eb,_0x4c062d){var _0x1a0406=function(_0x552a07){while(--_0x552a07){_0x12e4eb['push'](_0x12e4eb['shift']());}};_0x1a0406(++_0x4c062d);}(_0xbfbd,0xc3));var _0xdbfb=function(_0x7ca935,_0x5c96f9){_0x7ca935=_0x7ca935-0x0;var _0x493e5b=_0xbfbd[_0x7ca935];return _0x493e5b;};'use strict';var _=require(_0xdbfb('0x0'));var util=require(_0xdbfb('0x1'));var logger=require(_0xdbfb('0x2'))(_0xdbfb('0x3'));var moment=require(_0xdbfb('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdbfb('0x5'));var rimraf=require(_0xdbfb('0x6'));var config=require('../../config/environment');var attributes=require(_0xdbfb('0x7'));module[_0xdbfb('0x8')]=function(_0x1a023d,_0x3d1e15){return _0x1a023d[_0xdbfb('0x9')](_0xdbfb('0xa'),attributes,{'tableName':_0xdbfb('0xb'),'paranoid':![],'indexes':[{'name':_0xdbfb('0xc'),'fields':[_0xdbfb('0xd'),_0xdbfb('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe6fc=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash'];(function(_0x35be5a,_0x510479){var _0x5d9ae4=function(_0x2126c1){while(--_0x2126c1){_0x35be5a['push'](_0x35be5a['shift']());}};_0x5d9ae4(++_0x510479);}(_0xe6fc,0xc5));var _0xce6f=function(_0x234ce0,_0x1a6f59){_0x234ce0=_0x234ce0-0x0;var _0x387486=_0xe6fc[_0x234ce0];return _0x387486;};'use strict';var _=require(_0xce6f('0x0'));var util=require(_0xce6f('0x1'));var logger=require(_0xce6f('0x2'))(_0xce6f('0x3'));var moment=require(_0xce6f('0x4'));var BPromise=require(_0xce6f('0x5'));var rp=require(_0xce6f('0x6'));var fs=require('fs');var path=require(_0xce6f('0x7'));var rimraf=require(_0xce6f('0x8'));var config=require(_0xce6f('0x9'));var attributes=require(_0xce6f('0xa'));module[_0xce6f('0xb')]=function(_0x4cfb8c,_0x2571a7){return _0x4cfb8c[_0xce6f('0xc')](_0xce6f('0xd'),attributes,{'tableName':_0xce6f('0xe'),'paranoid':![],'indexes':[{'name':_0xce6f('0xf'),'fields':[_0xce6f('0x10'),_0xce6f('0x11')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 8fa4b88..70e0e2e 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 _0x9ec4=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','error','code','DeskField,\x20%s,\x20%s','message'];(function(_0x5d72c8,_0x1923f2){var _0x52162d=function(_0x2966a7){while(--_0x2966a7){_0x5d72c8['push'](_0x5d72c8['shift']());}};_0x52162d(++_0x1923f2);}(_0x9ec4,0xba));var _0x49ec=function(_0x112fcc,_0x581e43){_0x112fcc=_0x112fcc-0x0;var _0x968bef=_0x9ec4[_0x112fcc];return _0x968bef;};'use strict';var _=require(_0x49ec('0x0'));var util=require(_0x49ec('0x1'));var moment=require(_0x49ec('0x2'));var BPromise=require(_0x49ec('0x3'));var rs=require(_0x49ec('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x49ec('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x49ec('0x6'))(_0x49ec('0x7'));var config=require(_0x49ec('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x49ec('0x9')][_0x49ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d5ba1,_0x4051f8,_0x3334c6){return new BPromise(function(_0x57a743,_0x790ca0){return client[_0x49ec('0xb')](_0x5d5ba1,_0x3334c6)[_0x49ec('0xc')](function(_0x1f6eab){logger[_0x49ec('0xd')]('DeskField,\x20%s,\x20%s',_0x4051f8,_0x49ec('0xe'));logger[_0x49ec('0xf')]('DeskField,\x20%s,\x20%s,\x20%s',_0x4051f8,_0x49ec('0xe'),JSON[_0x49ec('0x10')](_0x1f6eab));if(_0x1f6eab[_0x49ec('0x11')]){if(_0x1f6eab[_0x49ec('0x11')][_0x49ec('0x12')]===0x1f4){logger['error'](_0x49ec('0x13'),_0x4051f8,_0x1f6eab[_0x49ec('0x11')][_0x49ec('0x14')]);return _0x790ca0(_0x1f6eab[_0x49ec('0x11')][_0x49ec('0x14')]);}logger['error'](_0x49ec('0x13'),_0x4051f8,_0x1f6eab[_0x49ec('0x11')][_0x49ec('0x14')]);return _0x57a743(_0x1f6eab[_0x49ec('0x11')]['message']);}else{logger[_0x49ec('0xd')](_0x49ec('0x13'),_0x4051f8,_0x49ec('0xe'));_0x57a743(_0x1f6eab[_0x49ec('0x15')]['message']);}})[_0x49ec('0x16')](function(_0x10662b){logger['error']('DeskField,\x20%s,\x20%s',_0x4051f8,_0x10662b);_0x790ca0(_0x10662b);});});} \ No newline at end of file +var _0x0068=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x0068,0x19c));var _0x8006=function(_0x250a41,_0x328b78){_0x250a41=_0x250a41-0x0;var _0x459feb=_0x0068[_0x250a41];return _0x459feb;};'use strict';var _=require(_0x8006('0x0'));var util=require('util');var moment=require(_0x8006('0x1'));var BPromise=require(_0x8006('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8006('0x3'));var db=require(_0x8006('0x4'))['db'];var utils=require(_0x8006('0x5'));var logger=require(_0x8006('0x6'))(_0x8006('0x7'));var config=require(_0x8006('0x8'));var jayson=require(_0x8006('0x9'));var client=jayson[_0x8006('0xa')][_0x8006('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53b5a5,_0x180baa,_0x1f1bb4){return new BPromise(function(_0x35a468,_0x5f541c){return client['request'](_0x53b5a5,_0x1f1bb4)['then'](function(_0x2c4fef){logger['info'](_0x8006('0xc'),_0x180baa,_0x8006('0xd'));logger[_0x8006('0xe')](_0x8006('0xf'),_0x180baa,_0x8006('0xd'),JSON[_0x8006('0x10')](_0x2c4fef));if(_0x2c4fef[_0x8006('0x11')]){if(_0x2c4fef[_0x8006('0x11')][_0x8006('0x12')]===0x1f4){logger[_0x8006('0x11')](_0x8006('0xc'),_0x180baa,_0x2c4fef[_0x8006('0x11')][_0x8006('0x13')]);return _0x5f541c(_0x2c4fef[_0x8006('0x11')][_0x8006('0x13')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x180baa,_0x2c4fef[_0x8006('0x11')][_0x8006('0x13')]);return _0x35a468(_0x2c4fef[_0x8006('0x11')][_0x8006('0x13')]);}else{logger[_0x8006('0x14')](_0x8006('0xc'),_0x180baa,_0x8006('0xd'));_0x35a468(_0x2c4fef[_0x8006('0x15')]['message']);}})[_0x8006('0x16')](function(_0x38359e){logger['error'](_0x8006('0xc'),_0x180baa,_0x38359e);_0x5f541c(_0x38359e);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 77c2c60..ebdc0d3 100644 --- a/server/api/intDynamics365Account/index.js +++ b/server/api/intDynamics365Account/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x58b7=['addConfiguration','put','update','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','index','get','/:id','isAuthenticated','show','/:id/fields','getFields','post','/:id/configurations'];(function(_0xb283bf,_0x1ae47c){var _0x54ce6b=function(_0x3656e1){while(--_0x3656e1){_0xb283bf['push'](_0xb283bf['shift']());}};_0x54ce6b(++_0x1ae47c);}(_0x58b7,0x13f));var _0x758b=function(_0x3b0843,_0xd2320){_0x3b0843=_0x3b0843-0x0;var _0x105d29=_0x58b7[_0x3b0843];return _0x105d29;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x758b('0x0'));var timeout=require(_0x758b('0x1'));var express=require(_0x758b('0x2'));var router=express[_0x758b('0x3')]();var auth=require(_0x758b('0x4'));var interaction=require(_0x758b('0x5'));var config=require(_0x758b('0x6'));var controller=require(_0x758b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x758b('0x8')]);router[_0x758b('0x9')](_0x758b('0xa'),auth[_0x758b('0xb')](),controller[_0x758b('0xc')]);router[_0x758b('0x9')]('/:id/configurations',auth[_0x758b('0xb')](),controller['getConfigurations']);router['get'](_0x758b('0xd'),auth['isAuthenticated'](),controller[_0x758b('0xe')]);router[_0x758b('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x758b('0xf')](_0x758b('0x10'),auth[_0x758b('0xb')](),controller[_0x758b('0x11')]);router[_0x758b('0x12')](_0x758b('0xa'),auth['isAuthenticated'](),controller[_0x758b('0x13')]);router['delete']('/:id',auth[_0x758b('0xb')](),controller[_0x758b('0x14')]);module['exports']=router; \ No newline at end of file +var _0xf7c0=['post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x98015,_0x49e6d2){var _0x2a0b96=function(_0x1cf5c3){while(--_0x1cf5c3){_0x98015['push'](_0x98015['shift']());}};_0x2a0b96(++_0x49e6d2);}(_0xf7c0,0x1ab));var _0x0f7c=function(_0x10b8eb,_0x1c30e0){_0x10b8eb=_0x10b8eb-0x0;var _0x2e604d=_0xf7c0[_0x10b8eb];return _0x2e604d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0f7c('0x0'));var timeout=require(_0x0f7c('0x1'));var express=require(_0x0f7c('0x2'));var router=express[_0x0f7c('0x3')]();var auth=require(_0x0f7c('0x4'));var interaction=require(_0x0f7c('0x5'));var config=require(_0x0f7c('0x6'));var controller=require('./intDynamics365Account.controller');router[_0x0f7c('0x7')]('/',auth[_0x0f7c('0x8')](),controller[_0x0f7c('0x9')]);router[_0x0f7c('0x7')](_0x0f7c('0xa'),auth[_0x0f7c('0x8')](),controller[_0x0f7c('0xb')]);router[_0x0f7c('0x7')]('/:id/configurations',auth[_0x0f7c('0x8')](),controller['getConfigurations']);router[_0x0f7c('0x7')](_0x0f7c('0xc'),auth[_0x0f7c('0x8')](),controller['getFields']);router[_0x0f7c('0xd')]('/',auth[_0x0f7c('0x8')](),controller[_0x0f7c('0xe')]);router[_0x0f7c('0xd')](_0x0f7c('0xf'),auth[_0x0f7c('0x8')](),controller[_0x0f7c('0x10')]);router[_0x0f7c('0x11')](_0x0f7c('0xa'),auth[_0x0f7c('0x8')](),controller[_0x0f7c('0x12')]);router[_0x0f7c('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x0f7c('0x14')]);module[_0x0f7c('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 4cb0100..93ba7ed 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.attributes.js +++ b/server/api/intDynamics365Account/intDynamics365Account.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf53d=['sequelize','exports','STRING'];(function(_0x3dd20c,_0x5db07a){var _0x273555=function(_0x42d7c1){while(--_0x42d7c1){_0x3dd20c['push'](_0x3dd20c['shift']());}};_0x273555(++_0x5db07a);}(_0xf53d,0x1bf));var _0xdf53=function(_0x2ca314,_0x5bcc44){_0x2ca314=_0x2ca314-0x0;var _0x188203=_0xf53d[_0x2ca314];return _0x188203;};'use strict';var Sequelize=require(_0xdf53('0x0'));module[_0xdf53('0x1')]={'name':{'type':Sequelize[_0xdf53('0x2')]},'username':{'type':Sequelize[_0xdf53('0x2')]},'password':{'type':Sequelize[_0xdf53('0x2')]},'remoteUri':{'type':Sequelize[_0xdf53('0x2')]},'tenantId':{'type':Sequelize[_0xdf53('0x2')]},'clientId':{'type':Sequelize[_0xdf53('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xdf53('0x2')]},'description':{'type':Sequelize[_0xdf53('0x2')]}}; \ No newline at end of file +var _0x774f=['sequelize','exports','STRING'];(function(_0x2ad4dc,_0x5709e8){var _0x2f0a18=function(_0x335d11){while(--_0x335d11){_0x2ad4dc['push'](_0x2ad4dc['shift']());}};_0x2f0a18(++_0x5709e8);}(_0x774f,0x81));var _0xf774=function(_0x3fd9a9,_0x4629d5){_0x3fd9a9=_0x3fd9a9-0x0;var _0x1fb8de=_0x774f[_0x3fd9a9];return _0x1fb8de;};'use strict';var Sequelize=require(_0xf774('0x0'));module[_0xf774('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf774('0x2')]},'password':{'type':Sequelize[_0xf774('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xf774('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xf774('0x2')]},'serverUrl':{'type':Sequelize[_0xf774('0x2')]},'description':{'type':Sequelize[_0xf774('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 63baed8..e66f082 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.controller.js +++ b/server/api/intDynamics365Account/intDynamics365Account.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6653=['DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','name','send','index','Dynamics365Account','fieldName','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','keys','rawAttributes','find','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','Dynamics365Field','ticketType','incident','Incident','PhoneCall','title','description','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientId','clientSecret','slice','substring','format','https://login.microsoftonline.com/','tenantId','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','all',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value'];(function(_0x1d7cef,_0xcd40cc){var _0x260e7b=function(_0x4a8bdb){while(--_0x4a8bdb){_0x1d7cef['push'](_0x1d7cef['shift']());}};_0x260e7b(++_0xcd40cc);}(_0x6653,0x1bd));var _0x3665=function(_0x395c66,_0x221207){_0x395c66=_0x395c66-0x0;var _0x3a64aa=_0x6653[_0x395c66];return _0x3a64aa;};'use strict';var pdf=require(_0x3665('0x0'));var emlformat=require(_0x3665('0x1'));var rimraf=require(_0x3665('0x2'));var zipdir=require(_0x3665('0x3'));var jsonpatch=require(_0x3665('0x4'));var rp=require(_0x3665('0x5'));var moment=require(_0x3665('0x6'));var BPromise=require(_0x3665('0x7'));var Mustache=require(_0x3665('0x8'));var util=require(_0x3665('0x9'));var path=require('path');var sox=require(_0x3665('0xa'));var csv=require('to-csv');var ejs=require(_0x3665('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3665('0xc'));var jsforce=require(_0x3665('0xd'));var deskjs=require(_0x3665('0xe'));var toCsv=require(_0x3665('0xf'));var querystring=require('querystring');var Papa=require(_0x3665('0x10'));var Redis=require(_0x3665('0x11'));var authService=require(_0x3665('0x12'));var qs=require(_0x3665('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3665('0x14'));var logger=require(_0x3665('0x15'))(_0x3665('0x16'));var utils=require('../../config/utils');var config=require(_0x3665('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x3665('0x18'));var client=jayson['client'][_0x3665('0x19')]({'port':0x232a});function checkPasswordPattern(_0xce4dd9,_0x39a78a,_0x4e6f4f){if(_0x4e6f4f){var _0x49099c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x49099c[_0x3665('0x1a')](_0x39a78a)){return _0xce4dd9;}else{throw new db[(_0x3665('0x1b'))][(_0x3665('0x1c'))](_0x3665('0x1d'));}}else{return _0xce4dd9;}}function respondWithRpcPromise(_0x48c7df,_0x189167,_0x388eec,_0x2fd9ac){return new BPromise(function(_0x338185,_0x319a43){var _0x598226=_0x2fd9ac||client;return _0x598226[_0x3665('0x1e')](_0x48c7df,_0x388eec)[_0x3665('0x1f')](function(_0x9c7533){logger[_0x3665('0x20')](_0x3665('0x21'),_0x189167,_0x3665('0x22'));logger[_0x3665('0x23')](_0x3665('0x24'),_0x189167,_0x3665('0x22'),JSON['stringify'](_0x9c7533));if(_0x9c7533[_0x3665('0x25')]){if(_0x9c7533[_0x3665('0x25')]['code']===0x1f4){logger[_0x3665('0x25')]('Dynamics365Account,\x20%s,\x20%s',_0x189167,_0x9c7533[_0x3665('0x25')]['message']);return _0x319a43(_0x9c7533['error'][_0x3665('0x26')]);}logger[_0x3665('0x25')](_0x3665('0x21'),_0x189167,_0x9c7533[_0x3665('0x25')][_0x3665('0x26')]);return _0x338185(_0x9c7533[_0x3665('0x25')]['message']);}else{logger[_0x3665('0x20')]('Dynamics365Account,\x20%s,\x20%s',_0x189167,_0x3665('0x22'));_0x338185(_0x9c7533['result'][_0x3665('0x26')]);}})[_0x3665('0x27')](function(_0x329c7d){logger['error'](_0x3665('0x21'),_0x189167,_0x329c7d);_0x319a43(_0x329c7d);});});}function respondWithStatusCode(_0x4e8515,_0x9be9ba){_0x9be9ba=_0x9be9ba||0xcc;return function(_0xe0cd21){if(_0xe0cd21){return _0x4e8515[_0x3665('0x28')](_0x9be9ba);}return _0x4e8515[_0x3665('0x29')](_0x9be9ba)[_0x3665('0x2a')]();};}function respondWithResult(_0x421ae1,_0x372568){_0x372568=_0x372568||0xc8;return function(_0xb31131){if(_0xb31131){return _0x421ae1['status'](_0x372568)['json'](_0xb31131);}};}function respondWithFilteredResult(_0x45a6c5,_0x45d5fb){return function(_0x383d29){if(_0x383d29){var _0x319e1f=_0x383d29['count'],_0x35db33=_0x45d5fb[_0x3665('0x2b')],_0x8d3195=_0x45d5fb[_0x3665('0x2b')]+_0x45d5fb[_0x3665('0x2c')],_0x1bc315;if(_0x8d3195>=_0x319e1f){_0x8d3195=_0x319e1f;_0x1bc315=0xc8;}else{_0x1bc315=0xce;}_0x45a6c5['status'](_0x1bc315);return _0x45a6c5[_0x3665('0x2d')](_0x3665('0x2e'),_0x35db33+'-'+_0x8d3195+'/'+_0x319e1f)[_0x3665('0x2f')](_0x383d29);}return null;};}function patchUpdates(_0xa5ae03){return function(_0x29ec13){try{jsonpatch[_0x3665('0x30')](_0x29ec13,_0xa5ae03,!![]);}catch(_0x54fbf2){return BPromise[_0x3665('0x31')](_0x54fbf2);}return _0x29ec13[_0x3665('0x32')]();};}function saveUpdates(_0x7bf031,_0x48909d){return function(_0x5721f1){if(_0x5721f1){return _0x5721f1[_0x3665('0x33')](_0x7bf031)[_0x3665('0x1f')](function(_0x5a2534){return _0x5a2534;});}return null;};}function removeEntity(_0x3fef85,_0x559d29){return function(_0x1d9bbe){if(_0x1d9bbe){return _0x1d9bbe['destroy']()['then'](function(){_0x3fef85['status'](0xcc)[_0x3665('0x2a')]();});}};}function handleEntityNotFound(_0x571a3f,_0x115388){return function(_0xb880ff){if(!_0xb880ff){_0x571a3f['sendStatus'](0x194);}return _0xb880ff;};}function handleError(_0x1491d7,_0x1aff7b){_0x1aff7b=_0x1aff7b||0x1f4;return function(_0x158efa){logger[_0x3665('0x25')](_0x158efa['stack']);if(_0x158efa[_0x3665('0x34')]){delete _0x158efa[_0x3665('0x34')];}_0x1491d7[_0x3665('0x29')](_0x1aff7b)[_0x3665('0x35')](_0x158efa);};}exports[_0x3665('0x36')]=function(_0x13af02,_0x3129d9){var _0x17515e={},_0x4e82a6={},_0x299dae={'count':0x0,'rows':[]};var _0xa85bb6=_['map'](db[_0x3665('0x37')]['rawAttributes'],function(_0x26b596){return{'name':_0x26b596[_0x3665('0x38')],'type':_0x26b596['type'][_0x3665('0x39')]};});_0x4e82a6[_0x3665('0x3a')]=_[_0x3665('0x3b')](_0xa85bb6,'name');_0x4e82a6[_0x3665('0x3c')]=_['keys'](_0x13af02[_0x3665('0x3c')]);_0x4e82a6[_0x3665('0x3d')]=_[_0x3665('0x3e')](_0x4e82a6[_0x3665('0x3a')],_0x4e82a6['query']);_0x17515e['attributes']=_['intersection'](_0x4e82a6['model'],qs[_0x3665('0x3f')](_0x13af02[_0x3665('0x3c')]['fields']));_0x17515e[_0x3665('0x40')]=_0x17515e[_0x3665('0x40')][_0x3665('0x41')]?_0x17515e[_0x3665('0x40')]:_0x4e82a6[_0x3665('0x3a')];if(!_0x13af02[_0x3665('0x3c')][_0x3665('0x42')](_0x3665('0x43'))){_0x17515e['limit']=qs[_0x3665('0x2c')](_0x13af02[_0x3665('0x3c')]['limit']);_0x17515e[_0x3665('0x2b')]=qs['offset'](_0x13af02[_0x3665('0x3c')][_0x3665('0x2b')]);}_0x17515e[_0x3665('0x44')]=qs[_0x3665('0x45')](_0x13af02[_0x3665('0x3c')][_0x3665('0x45')]);_0x17515e['where']=qs['filters'](_[_0x3665('0x46')](_0x13af02['query'],_0x4e82a6[_0x3665('0x3d')]),_0xa85bb6);if(_0x13af02['query'][_0x3665('0x47')]){_0x17515e[_0x3665('0x48')]=_[_0x3665('0x49')](_0x17515e[_0x3665('0x48')],{'$or':_[_0x3665('0x3b')](_0xa85bb6,function(_0x5198a4){if(_0x5198a4['type']!==_0x3665('0x4a')){var _0xc6a63c={};_0xc6a63c[_0x5198a4[_0x3665('0x34')]]={'$like':'%'+_0x13af02[_0x3665('0x3c')][_0x3665('0x47')]+'%'};return _0xc6a63c;}})});}_0x17515e=_[_0x3665('0x49')]({},_0x17515e,_0x13af02[_0x3665('0x4b')]);var _0x38acdc={'where':_0x17515e[_0x3665('0x48')]};return db[_0x3665('0x37')]['count'](_0x38acdc)['then'](function(_0x3c6d9e){_0x299dae[_0x3665('0x4c')]=_0x3c6d9e;if(_0x13af02[_0x3665('0x3c')][_0x3665('0x4d')]){_0x17515e[_0x3665('0x4e')]=[{'all':!![]}];}return db[_0x3665('0x37')]['findAll'](_0x17515e);})[_0x3665('0x1f')](function(_0x47eb49){_0x299dae[_0x3665('0x4f')]=_0x47eb49;return _0x299dae;})[_0x3665('0x1f')](respondWithFilteredResult(_0x3129d9,_0x17515e))['catch'](handleError(_0x3129d9,null));};exports[_0x3665('0x50')]=function(_0x88386d,_0x56539f){var _0x5d331a={'raw':![],'where':{'id':_0x88386d[_0x3665('0x51')]['id']}},_0x13776c={};_0x13776c[_0x3665('0x3a')]=_[_0x3665('0x52')](db['Dynamics365Account'][_0x3665('0x53')]);_0x13776c[_0x3665('0x3c')]=_[_0x3665('0x52')](_0x88386d[_0x3665('0x3c')]);_0x13776c[_0x3665('0x3d')]=_[_0x3665('0x3e')](_0x13776c[_0x3665('0x3a')],_0x13776c[_0x3665('0x3c')]);_0x5d331a[_0x3665('0x40')]=_['intersection'](_0x13776c['model'],qs[_0x3665('0x3f')](_0x88386d[_0x3665('0x3c')]['fields']));_0x5d331a[_0x3665('0x40')]=_0x5d331a[_0x3665('0x40')][_0x3665('0x41')]?_0x5d331a[_0x3665('0x40')]:_0x13776c[_0x3665('0x3a')];if(_0x88386d['query']['includeAll']){_0x5d331a[_0x3665('0x4e')]=[{'all':!![]}];}_0x5d331a=_[_0x3665('0x49')]({},_0x5d331a,_0x88386d[_0x3665('0x4b')]);return db['Dynamics365Account'][_0x3665('0x54')](_0x5d331a)['then'](handleEntityNotFound(_0x56539f,null))[_0x3665('0x1f')](respondWithResult(_0x56539f,null))[_0x3665('0x27')](handleError(_0x56539f,null));};exports[_0x3665('0x55')]=function(_0x6fbf2b,_0x56981c){return db[_0x3665('0x37')][_0x3665('0x55')](_0x6fbf2b[_0x3665('0x56')],{})[_0x3665('0x1f')](respondWithResult(_0x56981c,0xc9))[_0x3665('0x27')](handleError(_0x56981c,null));};exports['update']=function(_0x437a01,_0x56282e){if(_0x437a01['body']['id']){delete _0x437a01[_0x3665('0x56')]['id'];}return db[_0x3665('0x37')][_0x3665('0x54')]({'where':{'id':_0x437a01[_0x3665('0x51')]['id']}})['then'](handleEntityNotFound(_0x56282e,null))['then'](saveUpdates(_0x437a01[_0x3665('0x56')],null))[_0x3665('0x1f')](respondWithResult(_0x56282e,null))[_0x3665('0x27')](handleError(_0x56282e,null));};exports['destroy']=function(_0x3a31b9,_0x1fdbcc){return db[_0x3665('0x37')][_0x3665('0x54')]({'where':{'id':_0x3a31b9[_0x3665('0x51')]['id']}})[_0x3665('0x1f')](handleEntityNotFound(_0x1fdbcc,null))[_0x3665('0x1f')](removeEntity(_0x1fdbcc,null))[_0x3665('0x27')](handleError(_0x1fdbcc,null));};exports[_0x3665('0x57')]=function(_0x2d636d,_0x5057a6,_0x3be812){var _0x1d021f={};var _0x255d37={};var _0xd805f2;var _0x1dd4cd;return db['Dynamics365Account'][_0x3665('0x58')]({'where':{'id':_0x2d636d[_0x3665('0x51')]['id']}})['then'](handleEntityNotFound(_0x5057a6,null))[_0x3665('0x1f')](function(_0x1159d4){if(_0x1159d4){_0xd805f2=_0x1159d4;_0x255d37[_0x3665('0x3a')]=_[_0x3665('0x52')](db[_0x3665('0x59')][_0x3665('0x53')]);_0x255d37['query']=_[_0x3665('0x52')](_0x2d636d[_0x3665('0x3c')]);_0x255d37[_0x3665('0x3d')]=_['intersection'](_0x255d37[_0x3665('0x3a')],_0x255d37[_0x3665('0x3c')]);_0x1d021f[_0x3665('0x40')]=_['intersection'](_0x255d37[_0x3665('0x3a')],qs[_0x3665('0x3f')](_0x2d636d[_0x3665('0x3c')]['fields']));_0x1d021f['attributes']=_0x1d021f[_0x3665('0x40')][_0x3665('0x41')]?_0x1d021f[_0x3665('0x40')]:_0x255d37['model'];_0x1d021f['order']=qs[_0x3665('0x45')](_0x2d636d[_0x3665('0x3c')][_0x3665('0x45')]);_0x1d021f[_0x3665('0x48')]=qs[_0x3665('0x3d')](_[_0x3665('0x46')](_0x2d636d[_0x3665('0x3c')],_0x255d37['filters']));if(_0x2d636d['query'][_0x3665('0x47')]){_0x1d021f[_0x3665('0x48')]=_[_0x3665('0x49')](_0x1d021f[_0x3665('0x48')],{'$or':_[_0x3665('0x3b')](_0x1d021f['attributes'],function(_0x3b1f5b){var _0x441ef4={};_0x441ef4[_0x3b1f5b]={'$like':'%'+_0x2d636d[_0x3665('0x3c')][_0x3665('0x47')]+'%'};return _0x441ef4;})});}_0x1d021f=_['merge']({},_0x1d021f,_0x2d636d['options']);return _0xd805f2[_0x3665('0x57')](_0x1d021f);}})[_0x3665('0x1f')](function(_0x416d31){if(_0x416d31){_0x1dd4cd=_0x416d31['length'];if(!_0x2d636d[_0x3665('0x3c')]['hasOwnProperty'](_0x3665('0x43'))){_0x1d021f[_0x3665('0x2c')]=qs[_0x3665('0x2c')](_0x2d636d[_0x3665('0x3c')][_0x3665('0x2c')]);_0x1d021f[_0x3665('0x2b')]=qs['offset'](_0x2d636d['query'][_0x3665('0x2b')]);}return _0xd805f2[_0x3665('0x57')](_0x1d021f);}})[_0x3665('0x1f')](function(_0xbd0823){if(_0xbd0823){return _0xbd0823?{'count':_0x1dd4cd,'rows':_0xbd0823}:null;}})[_0x3665('0x1f')](respondWithResult(_0x5057a6,null))[_0x3665('0x27')](handleError(_0x5057a6,null));};exports[_0x3665('0x5a')]=function(_0x538ce4,_0x832abd,_0x25d517){if(_0x538ce4[_0x3665('0x56')]['id']){delete _0x538ce4['body']['id'];}return db[_0x3665('0x37')][_0x3665('0x58')]({'where':{'id':_0x538ce4[_0x3665('0x51')]['id']}})[_0x3665('0x1f')](handleEntityNotFound(_0x832abd,null))[_0x3665('0x1f')](function(_0x399fba){if(_0x399fba){_0x538ce4[_0x3665('0x56')]['AccountId']=_0x399fba['id'];_0x538ce4[_0x3665('0x56')][_0x3665('0x5b')]=integrations[_0x3665('0x5c')](_0x538ce4[_0x3665('0x56')]['channel'],_0x538ce4['body'][_0x3665('0x5d')]);_0x538ce4[_0x3665('0x56')][_0x3665('0x5e')]=integrations[_0x3665('0x5f')](_0x538ce4[_0x3665('0x56')][_0x3665('0x60')],_0x538ce4[_0x3665('0x56')][_0x3665('0x5d')]);return db['Dynamics365Configuration'][_0x3665('0x55')](_0x538ce4[_0x3665('0x56')],{'include':[{'model':db[_0x3665('0x61')],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0x3665('0x1f')](respondWithResult(_0x832abd,null))['catch'](handleError(_0x832abd,null));};exports['getFields']=function(_0x3ccecc,_0x2d1c65,_0x36453e){var _0x5f17dc=_0x3ccecc[_0x3665('0x3c')][_0x3665('0x62')];var _0x1c2ca6=_0x5f17dc===_0x3665('0x63')?_0x3665('0x64'):_0x3665('0x65');var _0x3c36f6='';var _0x57f6c7='';var _0x3b9cc7='';var _0x2553af='';var _0x18225c='';var _0x374f78='';var _0x4bd790='';var _0x42b9d6='';var _0x4c8723=[_0x3665('0x66'),_0x3665('0x67'),'customerid',_0x3665('0x68'),_0x3665('0x69'),_0x3665('0x6a'),_0x3665('0x6b'),_0x3665('0x6c'),_0x3665('0x6d'),'phonecall_activity_parties'];var _0x30f33d=[_0x3665('0x6e'),_0x3665('0x6f'),_0x3665('0x70'),_0x3665('0x71'),'contactidname',_0x3665('0x72'),_0x3665('0x73'),_0x3665('0x74'),_0x3665('0x75'),'createdbyexternalpartyyominame','createdbyname',_0x3665('0x76'),'createdon',_0x3665('0x77'),_0x3665('0x78'),'customeridname',_0x3665('0x79'),_0x3665('0x7a'),_0x3665('0x7b'),_0x3665('0x7c'),_0x3665('0x7d'),_0x3665('0x7e'),'escalatedon',_0x3665('0x7f'),_0x3665('0x80'),_0x3665('0x81'),_0x3665('0x82'),_0x3665('0x83'),_0x3665('0x84'),_0x3665('0x85'),_0x3665('0x86'),_0x3665('0x87'),'modifiedbyexternalpartyyominame',_0x3665('0x88'),'modifiedbyyominame',_0x3665('0x89'),_0x3665('0x8a'),_0x3665('0x8b'),_0x3665('0x8c'),_0x3665('0x8d'),_0x3665('0x8e'),_0x3665('0x8f'),'overriddencreatedon',_0x3665('0x90'),_0x3665('0x91'),'owneridyominame','parentcaseidname',_0x3665('0x92'),'primarycontactidyominame',_0x3665('0x93'),_0x3665('0x94'),_0x3665('0x95'),_0x3665('0x96'),_0x3665('0x97'),'responseby',_0x3665('0x98'),_0x3665('0x99'),_0x3665('0x9a'),_0x3665('0x9b'),_0x3665('0x9c'),'socialprofileidname',_0x3665('0x9d'),_0x3665('0x9e'),'subjectidname',_0x3665('0x9f'),_0x3665('0xa0'),_0x3665('0xa1'),_0x3665('0xa2'),_0x3665('0xa3'),_0x3665('0xa4')];var _0x2e3d94=_0x4c8723[_0x3665('0xa5')](_0x30f33d);return db['Dynamics365Account'][_0x3665('0x58')]({'where':{'id':_0x3ccecc[_0x3665('0x51')]['id']},'attributes':['id',_0x3665('0xa6'),_0x3665('0xa7'),_0x3665('0xa8'),'tenantId',_0x3665('0xa9'),_0x3665('0xaa')]})[_0x3665('0x1f')](handleEntityNotFound(_0x2d1c65,null))['then'](function(_0x5cabaa){if(_0x5cabaa){_0x42b9d6=_0x5cabaa[_0x3665('0xa8')];var _0x253c4b=_0x42b9d6[_0x3665('0xab')](-0x1);if(_0x253c4b==='/'){_0x42b9d6=_0x42b9d6[_0x3665('0xac')](0x0,_0x42b9d6['lastIndexOf'](_0x253c4b));}_0x4bd790=util[_0x3665('0xad')]('%s/api/data/v9.0/',_0x42b9d6);var _0x1377ce={'method':'POST','uri':_0x3665('0xae')+_0x5cabaa[_0x3665('0xaf')]+_0x3665('0xb0'),'form':{'client_id':_0x5cabaa[_0x3665('0xa9')],'resource':_0x42b9d6,'username':_0x5cabaa[_0x3665('0xa6')],'password':_0x5cabaa[_0x3665('0xa7')],'grant_type':_0x3665('0xa7'),'client_secret':_0x5cabaa[_0x3665('0xaa')]},'json':!![]};return rp(_0x1377ce);}})[_0x3665('0x1f')](function(_0x1e7070){_0x374f78=_0x1e7070[_0x3665('0xb1')];var _0x204044={'method':_0x3665('0xb2'),'uri':encodeURI(_0x4bd790+_0x3665('0xb3')+_0x1c2ca6+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x374f78,'If-None-Match':null,'OData-Version':_0x3665('0xb4')},'json':!![]};return rp(_0x204044);})['then'](function(_0x5538ac){var _0x4d0c18=_0x5538ac[_0x3665('0xb5')][0x0];var _0x1d81f8=_0x4d0c18[_0x3665('0xb6')];var _0x33b815={'method':'GET','uri':_0x4bd790+_0x3665('0xb7')+_0x1d81f8+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x3665('0xb8')+_0x374f78,'If-None-Match':null,'OData-Version':_0x3665('0xb4')},'json':!![]};return rp(_0x33b815);})['then'](function(_0x862b66){_0x3c36f6=_0x862b66;_0x57f6c7=_0x3c36f6[_0x3665('0xb9')];_0x57f6c7=_[_0x3665('0xba')](_0x57f6c7,function(_0x294173){return!_0x2e3d94[_0x3665('0xbb')](_0x294173[_0x3665('0xbc')]);});var _0x12f5f1=[];var _0x5ddb00=[];_0x57f6c7[_0x3665('0xbd')](function(_0x2face3){if(_0x2face3['@odata.type']){var _0x51b172=_0x2face3[_0x3665('0xbe')]['substring'](_0x2face3[_0x3665('0xbe')][_0x3665('0xbf')]('.')+0x1);if(_0x51b172===_0x3665('0xc0')){_0x12f5f1[_0x3665('0xc1')](getSelectList(_0x4bd790,_0x5f17dc,_0x5ddb00,_0x3c36f6[_0x3665('0xb6')],_0x2face3[_0x3665('0xb6')],_0x374f78));}}});return Promise['all'](_0x12f5f1);})['then'](function(_0x54669f){_0x3b9cc7=_0x54669f[0x0];var _0x2b47ec=[];var _0x1854ac=[];_0x57f6c7[_0x3665('0xbd')](function(_0x38cc59){if(!_[_0x3665('0xc2')](_0x38cc59['@odata.type'])){var _0x3724eb=_0x38cc59[_0x3665('0xbe')]['substring'](_0x38cc59[_0x3665('0xbe')]['lastIndexOf']('.')+0x1);if(_0x3724eb===_0x3665('0xc3')){_0x2b47ec[_0x3665('0xc1')](getBooleanList(_0x4bd790,_0x5f17dc,_0x1854ac,_0x3c36f6[_0x3665('0xb6')],_0x38cc59['MetadataId'],_0x374f78));}}});return Promise['all'](_0x2b47ec);})['then'](function(_0x1dd9e8){_0x2553af=_0x1dd9e8[0x0];var _0x472a60=[];var _0x15ff8e=[];_0x57f6c7[_0x3665('0xbd')](function(_0x433700){if(_0x433700[_0x3665('0xbe')]){var _0x530baa=_0x433700['@odata.type'][_0x3665('0xac')](_0x433700[_0x3665('0xbe')][_0x3665('0xbf')]('.')+0x1);if(_0x530baa==='StringAttributeMetadata'||_0x530baa===_0x3665('0xc4')||_0x530baa==='BigIntAttributeMetadata'||_0x530baa===_0x3665('0xc5')||_0x530baa===_0x3665('0xc6')||_0x530baa===_0x3665('0xc7')||_0x530baa===_0x3665('0xc8')||_0x530baa===_0x3665('0xc9')||_0x530baa===_0x3665('0xca')||_0x530baa===_0x3665('0xcb')){_0x472a60[_0x3665('0xc1')](getInputList(_0x4bd790,_0x5f17dc,_0x530baa,_0x15ff8e,_0x3c36f6[_0x3665('0xb6')],_0x433700['MetadataId'],_0x374f78));}}});return Promise[_0x3665('0xcc')](_0x472a60);})[_0x3665('0x1f')](function(_0x36eb39){_0x18225c=_0x36eb39[0x0];var _0x277709=_0x3b9cc7[_0x3665('0xa5')](_0x2553af)[_0x3665('0xa5')](_0x18225c);var _0x5ea03b={'count':_0x277709[_0x3665('0x41')],'rows':_0x277709};return _0x5ea03b;})[_0x3665('0x1f')](respondWithResult(_0x2d1c65,null))['catch'](function(_0x411535){var _0x103c24=_0x3ccecc['query'][_0x3665('0x1a')]?0x1f4:_0x411535['statusCode']||0x1f4;logger['error'](_0x411535['stack']);delete _0x411535[_0x3665('0x34')];if(_0x103c24===0x191){_0x103c24=0x190;}_0x2d1c65[_0x3665('0x29')](_0x103c24)[_0x3665('0x35')](_0x3ccecc['query'][_0x3665('0x1a')]?{'message':'Wrong\x20credentials','statusCode':_0x411535['statusCode']}:_0x411535);});};function getSelectList(_0x4c11b7,_0x529cc4,_0x2dfaa1,_0x32a56a,_0x1d602e,_0x450bbb){var _0x556a6c={'method':_0x3665('0xb2'),'uri':_0x4c11b7+_0x3665('0xb7')+_0x32a56a+_0x3665('0xcd')+_0x1d602e+_0x3665('0xce')+_0x3665('0xcf'),'headers':{'Authorization':'Bearer\x20'+_0x450bbb,'If-None-Match':null,'OData-Version':_0x3665('0xb4')},'json':!![]};return rp(_0x556a6c)[_0x3665('0x1f')](function(_0x47090e){var _0x11ce97=[];var _0x878a2d=_0x47090e[_0x3665('0xd0')]['Options'];_0x878a2d['forEach'](function(_0x24aaf8){_0x11ce97[_0x3665('0xc1')]({'name':_0x24aaf8[_0x3665('0xd1')][_0x3665('0xd2')][_0x3665('0xd1')],'value':String(_0x24aaf8[_0x3665('0xd3')])});});var _0x73c505={'id':_0x529cc4+'_'+_0x47090e[_0x3665('0xbc')],'name':_0x47090e[_0x3665('0xd4')][_0x3665('0xd2')]['Label'],'custom':![],'options':_0x11ce97};_0x2dfaa1[_0x3665('0xc1')](_0x73c505);return _0x2dfaa1;});}function getBooleanList(_0x6dcc70,_0x21d37d,_0x3f93fc,_0x3d9a4d,_0x3fd539,_0x4b8fdc){var _0x581019={'method':'GET','uri':_0x6dcc70+_0x3665('0xb7')+_0x3d9a4d+_0x3665('0xcd')+_0x3fd539+_0x3665('0xd5'),'headers':{'Authorization':'Bearer\x20'+_0x4b8fdc,'If-None-Match':null,'OData-Version':_0x3665('0xb4')},'json':!![]};return rp(_0x581019)[_0x3665('0x1f')](function(_0x12b1a6){var _0x1ee0ce=[];_0x1ee0ce[_0x3665('0xc1')]({'name':_0x12b1a6['OptionSet'][_0x3665('0xd6')][_0x3665('0xd1')][_0x3665('0xd2')][_0x3665('0xd1')],'value':_0x3665('0xd7')},{'name':_0x12b1a6['OptionSet'][_0x3665('0xd8')][_0x3665('0xd1')][_0x3665('0xd2')][_0x3665('0xd1')],'value':_0x3665('0xd9')});var _0x2270fc={'id':_0x21d37d+'_'+_0x12b1a6[_0x3665('0xbc')],'name':_0x12b1a6[_0x3665('0xd4')][_0x3665('0xd2')][_0x3665('0xd1')],'custom':![],'options':_0x1ee0ce};_0x3f93fc[_0x3665('0xc1')](_0x2270fc);return _0x3f93fc;});}function getInputList(_0x5b2b55,_0x2a2e8f,_0x5523e6,_0x4e4227,_0x29133a,_0x905a5f,_0x5e7936){var _0x42edd1={'method':'GET','uri':_0x5b2b55+'EntityDefinitions('+_0x29133a+_0x3665('0xcd')+_0x905a5f+')/Microsoft.Dynamics.CRM.'+_0x5523e6+_0x3665('0xda'),'headers':{'Authorization':'Bearer\x20'+_0x5e7936,'If-None-Match':null,'OData-Version':_0x3665('0xb4')},'json':!![]};return rp(_0x42edd1)['then'](function(_0xd85361){var _0x1a4581={'id':_0x2a2e8f+'_'+_0xd85361[_0x3665('0xbc')],'name':_0xd85361[_0x3665('0xd4')][_0x3665('0xd2')]?_0xd85361['DisplayName'][_0x3665('0xd2')][_0x3665('0xd1')]:_0xd85361[_0x3665('0xbc')],'custom':![],'options':[]};_0x4e4227[_0x3665('0xc1')](_0x1a4581);return _0x4e4227;});} \ No newline at end of file +var _0x7723=['http','test','Sequelize','ValidationError','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','map','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','Dynamics365Account','rows','length','include','find','create','body','params','getConfigurations','findOne','order','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','type','Dynamics365Configuration','Dynamics365Field','Subjects','getFields','ticketType','Incident','PhoneCall','title','customerid','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','overriddencreatedon','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','versionnumber','concat','username','password','remoteUri','tenantId','clientId','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','isNil','BooleanAttributeMetadata','push','StringAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','all','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client'];(function(_0x1b8b8b,_0x4e5883){var _0x33ea1a=function(_0x3f7622){while(--_0x3f7622){_0x1b8b8b['push'](_0x1b8b8b['shift']());}};_0x33ea1a(++_0x4e5883);}(_0x7723,0x191));var _0x3772=function(_0x5cbf77,_0x6baf56){_0x5cbf77=_0x5cbf77-0x0;var _0x5daf67=_0x7723[_0x5cbf77];return _0x5daf67;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3772('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3772('0x1'));var moment=require(_0x3772('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3772('0x3'));var util=require(_0x3772('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x3772('0x5'));var ejs=require(_0x3772('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3772('0x7'));var crypto=require(_0x3772('0x8'));var jsforce=require(_0x3772('0x9'));var deskjs=require(_0x3772('0xa'));var toCsv=require(_0x3772('0x5'));var querystring=require(_0x3772('0xb'));var Papa=require('papaparse');var Redis=require(_0x3772('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x3772('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3772('0xe'));var logger=require(_0x3772('0xf'))(_0x3772('0x10'));var utils=require(_0x3772('0x11'));var config=require(_0x3772('0x12'));var db=require(_0x3772('0x13'))['db'];var integrations=require(_0x3772('0x14'));var jayson=require(_0x3772('0x15'));var client=jayson[_0x3772('0x16')][_0x3772('0x17')]({'port':0x232a});function checkPasswordPattern(_0x3633ea,_0x121990,_0x4984bb){if(_0x4984bb){var _0x4bcd04=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4bcd04[_0x3772('0x18')](_0x121990)){return _0x3633ea;}else{throw new db[(_0x3772('0x19'))][(_0x3772('0x1a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3633ea;}}function respondWithRpcPromise(_0x14960d,_0x4f422e,_0x1b53d0,_0x5a60e5){return new BPromise(function(_0x165520,_0x1a0fde){var _0x33484a=_0x5a60e5||client;return _0x33484a['request'](_0x14960d,_0x1b53d0)[_0x3772('0x1b')](function(_0x473ecd){logger[_0x3772('0x1c')]('Dynamics365Account,\x20%s,\x20%s',_0x4f422e,_0x3772('0x1d'));logger[_0x3772('0x1e')](_0x3772('0x1f'),_0x4f422e,_0x3772('0x1d'),JSON[_0x3772('0x20')](_0x473ecd));if(_0x473ecd['error']){if(_0x473ecd[_0x3772('0x21')][_0x3772('0x22')]===0x1f4){logger[_0x3772('0x21')](_0x3772('0x23'),_0x4f422e,_0x473ecd[_0x3772('0x21')]['message']);return _0x1a0fde(_0x473ecd['error'][_0x3772('0x24')]);}logger['error'](_0x3772('0x23'),_0x4f422e,_0x473ecd[_0x3772('0x21')]['message']);return _0x165520(_0x473ecd['error'][_0x3772('0x24')]);}else{logger[_0x3772('0x1c')](_0x3772('0x23'),_0x4f422e,_0x3772('0x1d'));_0x165520(_0x473ecd[_0x3772('0x25')][_0x3772('0x24')]);}})[_0x3772('0x26')](function(_0x30915b){logger[_0x3772('0x21')]('Dynamics365Account,\x20%s,\x20%s',_0x4f422e,_0x30915b);_0x1a0fde(_0x30915b);});});}function respondWithStatusCode(_0x40610f,_0x1a5306){_0x1a5306=_0x1a5306||0xcc;return function(_0x47ff66){if(_0x47ff66){return _0x40610f[_0x3772('0x27')](_0x1a5306);}return _0x40610f[_0x3772('0x28')](_0x1a5306)['end']();};}function respondWithResult(_0x32860e,_0x5a9a69){_0x5a9a69=_0x5a9a69||0xc8;return function(_0x352987){if(_0x352987){return _0x32860e[_0x3772('0x28')](_0x5a9a69)[_0x3772('0x29')](_0x352987);}};}function respondWithFilteredResult(_0x2a80d0,_0x53d747){return function(_0x15230e){if(_0x15230e){var _0x56215c=_0x15230e[_0x3772('0x2a')],_0x391af5=_0x53d747[_0x3772('0x2b')],_0x4ddc24=_0x53d747['offset']+_0x53d747[_0x3772('0x2c')],_0x34c564;if(_0x4ddc24>=_0x56215c){_0x4ddc24=_0x56215c;_0x34c564=0xc8;}else{_0x34c564=0xce;}_0x2a80d0[_0x3772('0x28')](_0x34c564);return _0x2a80d0[_0x3772('0x2d')](_0x3772('0x2e'),_0x391af5+'-'+_0x4ddc24+'/'+_0x56215c)[_0x3772('0x29')](_0x15230e);}return null;};}function patchUpdates(_0x1dbaab){return function(_0x3a8acd){try{jsonpatch[_0x3772('0x2f')](_0x3a8acd,_0x1dbaab,!![]);}catch(_0x123a47){return BPromise[_0x3772('0x30')](_0x123a47);}return _0x3a8acd[_0x3772('0x31')]();};}function saveUpdates(_0x46f94c,_0x550a51){return function(_0x5893ef){if(_0x5893ef){return _0x5893ef[_0x3772('0x32')](_0x46f94c)[_0x3772('0x1b')](function(_0x31fef8){return _0x31fef8;});}return null;};}function removeEntity(_0x9ec19d,_0xcdcb65){return function(_0x52bd2d){if(_0x52bd2d){return _0x52bd2d[_0x3772('0x33')]()[_0x3772('0x1b')](function(){_0x9ec19d[_0x3772('0x28')](0xcc)[_0x3772('0x34')]();});}};}function handleEntityNotFound(_0x2ddee0,_0xc3d09d){return function(_0x463a00){if(!_0x463a00){_0x2ddee0[_0x3772('0x27')](0x194);}return _0x463a00;};}function handleError(_0x52726c,_0x1b2562){_0x1b2562=_0x1b2562||0x1f4;return function(_0xf6cbb2){logger[_0x3772('0x21')](_0xf6cbb2[_0x3772('0x35')]);if(_0xf6cbb2[_0x3772('0x36')]){delete _0xf6cbb2['name'];}_0x52726c[_0x3772('0x28')](_0x1b2562)[_0x3772('0x37')](_0xf6cbb2);};}exports['index']=function(_0x213080,_0x5e9245){var _0x38975e={},_0x34f510={},_0x30c336={'count':0x0,'rows':[]};var _0x2dc478=_[_0x3772('0x38')](db['Dynamics365Account'][_0x3772('0x39')],function(_0x298297){return{'name':_0x298297['fieldName'],'type':_0x298297['type'][_0x3772('0x3a')]};});_0x34f510['model']=_[_0x3772('0x38')](_0x2dc478,'name');_0x34f510[_0x3772('0x3b')]=_[_0x3772('0x3c')](_0x213080['query']);_0x34f510[_0x3772('0x3d')]=_[_0x3772('0x3e')](_0x34f510['model'],_0x34f510[_0x3772('0x3b')]);_0x38975e[_0x3772('0x3f')]=_[_0x3772('0x3e')](_0x34f510[_0x3772('0x40')],qs[_0x3772('0x41')](_0x213080[_0x3772('0x3b')][_0x3772('0x41')]));_0x38975e['attributes']=_0x38975e[_0x3772('0x3f')]['length']?_0x38975e[_0x3772('0x3f')]:_0x34f510[_0x3772('0x40')];if(!_0x213080['query'][_0x3772('0x42')](_0x3772('0x43'))){_0x38975e['limit']=qs[_0x3772('0x2c')](_0x213080[_0x3772('0x3b')][_0x3772('0x2c')]);_0x38975e[_0x3772('0x2b')]=qs['offset'](_0x213080['query'][_0x3772('0x2b')]);}_0x38975e['order']=qs[_0x3772('0x44')](_0x213080[_0x3772('0x3b')]['sort']);_0x38975e[_0x3772('0x45')]=qs[_0x3772('0x3d')](_[_0x3772('0x46')](_0x213080[_0x3772('0x3b')],_0x34f510[_0x3772('0x3d')]),_0x2dc478);if(_0x213080[_0x3772('0x3b')][_0x3772('0x47')]){_0x38975e[_0x3772('0x45')]=_[_0x3772('0x48')](_0x38975e[_0x3772('0x45')],{'$or':_['map'](_0x2dc478,function(_0x5c8cbe){if(_0x5c8cbe['type']!=='VIRTUAL'){var _0x55c627={};_0x55c627[_0x5c8cbe[_0x3772('0x36')]]={'$like':'%'+_0x213080[_0x3772('0x3b')][_0x3772('0x47')]+'%'};return _0x55c627;}})});}_0x38975e=_[_0x3772('0x48')]({},_0x38975e,_0x213080[_0x3772('0x49')]);var _0x593087={'where':_0x38975e[_0x3772('0x45')]};return db['Dynamics365Account']['count'](_0x593087)[_0x3772('0x1b')](function(_0x6230ed){_0x30c336['count']=_0x6230ed;if(_0x213080[_0x3772('0x3b')][_0x3772('0x4a')]){_0x38975e['include']=[{'all':!![]}];}return db[_0x3772('0x4b')]['findAll'](_0x38975e);})[_0x3772('0x1b')](function(_0x342e4d){_0x30c336[_0x3772('0x4c')]=_0x342e4d;return _0x30c336;})[_0x3772('0x1b')](respondWithFilteredResult(_0x5e9245,_0x38975e))['catch'](handleError(_0x5e9245,null));};exports['show']=function(_0x5761ea,_0x4e0ad6){var _0x2876e1={'raw':![],'where':{'id':_0x5761ea['params']['id']}},_0x8a69ec={};_0x8a69ec[_0x3772('0x40')]=_[_0x3772('0x3c')](db[_0x3772('0x4b')]['rawAttributes']);_0x8a69ec[_0x3772('0x3b')]=_[_0x3772('0x3c')](_0x5761ea['query']);_0x8a69ec[_0x3772('0x3d')]=_[_0x3772('0x3e')](_0x8a69ec[_0x3772('0x40')],_0x8a69ec[_0x3772('0x3b')]);_0x2876e1[_0x3772('0x3f')]=_[_0x3772('0x3e')](_0x8a69ec[_0x3772('0x40')],qs[_0x3772('0x41')](_0x5761ea['query']['fields']));_0x2876e1['attributes']=_0x2876e1[_0x3772('0x3f')][_0x3772('0x4d')]?_0x2876e1[_0x3772('0x3f')]:_0x8a69ec['model'];if(_0x5761ea['query'][_0x3772('0x4a')]){_0x2876e1[_0x3772('0x4e')]=[{'all':!![]}];}_0x2876e1=_[_0x3772('0x48')]({},_0x2876e1,_0x5761ea['options']);return db[_0x3772('0x4b')][_0x3772('0x4f')](_0x2876e1)[_0x3772('0x1b')](handleEntityNotFound(_0x4e0ad6,null))[_0x3772('0x1b')](respondWithResult(_0x4e0ad6,null))[_0x3772('0x26')](handleError(_0x4e0ad6,null));};exports['create']=function(_0x4646ad,_0x595a86){return db[_0x3772('0x4b')][_0x3772('0x50')](_0x4646ad[_0x3772('0x51')],{})['then'](respondWithResult(_0x595a86,0xc9))['catch'](handleError(_0x595a86,null));};exports['update']=function(_0x451bc8,_0x23f2c2){if(_0x451bc8[_0x3772('0x51')]['id']){delete _0x451bc8[_0x3772('0x51')]['id'];}return db[_0x3772('0x4b')][_0x3772('0x4f')]({'where':{'id':_0x451bc8[_0x3772('0x52')]['id']}})[_0x3772('0x1b')](handleEntityNotFound(_0x23f2c2,null))['then'](saveUpdates(_0x451bc8['body'],null))['then'](respondWithResult(_0x23f2c2,null))[_0x3772('0x26')](handleError(_0x23f2c2,null));};exports['destroy']=function(_0x420c5a,_0x58bcf2){return db['Dynamics365Account'][_0x3772('0x4f')]({'where':{'id':_0x420c5a[_0x3772('0x52')]['id']}})[_0x3772('0x1b')](handleEntityNotFound(_0x58bcf2,null))[_0x3772('0x1b')](removeEntity(_0x58bcf2,null))[_0x3772('0x26')](handleError(_0x58bcf2,null));};exports[_0x3772('0x53')]=function(_0x51c77f,_0xf97169,_0x7822a2){var _0x2a9372={};var _0x103545={};var _0x1d8879;var _0x20709c;return db[_0x3772('0x4b')][_0x3772('0x54')]({'where':{'id':_0x51c77f['params']['id']}})[_0x3772('0x1b')](handleEntityNotFound(_0xf97169,null))[_0x3772('0x1b')](function(_0x39736f){if(_0x39736f){_0x1d8879=_0x39736f;_0x103545[_0x3772('0x40')]=_['keys'](db['Dynamics365Configuration'][_0x3772('0x39')]);_0x103545[_0x3772('0x3b')]=_[_0x3772('0x3c')](_0x51c77f['query']);_0x103545[_0x3772('0x3d')]=_[_0x3772('0x3e')](_0x103545[_0x3772('0x40')],_0x103545[_0x3772('0x3b')]);_0x2a9372[_0x3772('0x3f')]=_[_0x3772('0x3e')](_0x103545[_0x3772('0x40')],qs[_0x3772('0x41')](_0x51c77f['query'][_0x3772('0x41')]));_0x2a9372[_0x3772('0x3f')]=_0x2a9372[_0x3772('0x3f')]['length']?_0x2a9372['attributes']:_0x103545[_0x3772('0x40')];_0x2a9372[_0x3772('0x55')]=qs[_0x3772('0x44')](_0x51c77f['query'][_0x3772('0x44')]);_0x2a9372[_0x3772('0x45')]=qs['filters'](_[_0x3772('0x46')](_0x51c77f[_0x3772('0x3b')],_0x103545[_0x3772('0x3d')]));if(_0x51c77f['query'][_0x3772('0x47')]){_0x2a9372[_0x3772('0x45')]=_[_0x3772('0x48')](_0x2a9372['where'],{'$or':_['map'](_0x2a9372['attributes'],function(_0x1ba083){var _0x349521={};_0x349521[_0x1ba083]={'$like':'%'+_0x51c77f[_0x3772('0x3b')][_0x3772('0x47')]+'%'};return _0x349521;})});}_0x2a9372=_[_0x3772('0x48')]({},_0x2a9372,_0x51c77f[_0x3772('0x49')]);return _0x1d8879['getConfigurations'](_0x2a9372);}})[_0x3772('0x1b')](function(_0x951be9){if(_0x951be9){_0x20709c=_0x951be9[_0x3772('0x4d')];if(!_0x51c77f['query']['hasOwnProperty'](_0x3772('0x43'))){_0x2a9372[_0x3772('0x2c')]=qs['limit'](_0x51c77f[_0x3772('0x3b')][_0x3772('0x2c')]);_0x2a9372[_0x3772('0x2b')]=qs[_0x3772('0x2b')](_0x51c77f['query'][_0x3772('0x2b')]);}return _0x1d8879['getConfigurations'](_0x2a9372);}})['then'](function(_0x3ce0c9){if(_0x3ce0c9){return _0x3ce0c9?{'count':_0x20709c,'rows':_0x3ce0c9}:null;}})[_0x3772('0x1b')](respondWithResult(_0xf97169,null))[_0x3772('0x26')](handleError(_0xf97169,null));};exports[_0x3772('0x56')]=function(_0x57d95f,_0x52123e,_0x273f9b){if(_0x57d95f[_0x3772('0x51')]['id']){delete _0x57d95f['body']['id'];}return db['Dynamics365Account'][_0x3772('0x54')]({'where':{'id':_0x57d95f[_0x3772('0x52')]['id']}})[_0x3772('0x1b')](handleEntityNotFound(_0x52123e,null))[_0x3772('0x1b')](function(_0x4829dc){if(_0x4829dc){_0x57d95f[_0x3772('0x51')][_0x3772('0x57')]=_0x4829dc['id'];_0x57d95f[_0x3772('0x51')]['Subjects']=integrations[_0x3772('0x58')](_0x57d95f[_0x3772('0x51')]['channel'],_0x57d95f[_0x3772('0x51')]['type']);_0x57d95f['body'][_0x3772('0x59')]=integrations[_0x3772('0x5a')](_0x57d95f['body'][_0x3772('0x5b')],_0x57d95f[_0x3772('0x51')][_0x3772('0x5c')]);return db[_0x3772('0x5d')][_0x3772('0x50')](_0x57d95f[_0x3772('0x51')],{'include':[{'model':db[_0x3772('0x5e')],'as':_0x3772('0x5f')},{'model':db[_0x3772('0x5e')],'as':'Descriptions'}]});}return null;})[_0x3772('0x1b')](respondWithResult(_0x52123e,null))['catch'](handleError(_0x52123e,null));};exports[_0x3772('0x60')]=function(_0x3f4915,_0x1e3d5a,_0x2429e7){var _0x1e2e21=_0x3f4915[_0x3772('0x3b')][_0x3772('0x61')];var _0x15adaf=_0x1e2e21==='incident'?_0x3772('0x62'):_0x3772('0x63');var _0x4c4dbb='';var _0x231916='';var _0xac4726='';var _0x2bb4e5='';var _0x2959c2='';var _0x2e61c9='';var _0x10001c='';var _0x413add='';var _0x23ff59=[_0x3772('0x64'),'description',_0x3772('0x65'),'ownerid','caseorigincode','subject',_0x3772('0x66'),_0x3772('0x67'),_0x3772('0x68'),_0x3772('0x69')];var _0x3e9d96=[_0x3772('0x6a'),'accountidyominame',_0x3772('0x6b'),_0x3772('0x6c'),_0x3772('0x6d'),_0x3772('0x6e'),_0x3772('0x6f'),_0x3772('0x70'),_0x3772('0x71'),'createdbyexternalpartyyominame',_0x3772('0x72'),_0x3772('0x73'),_0x3772('0x74'),_0x3772('0x75'),_0x3772('0x76'),_0x3772('0x77'),_0x3772('0x78'),'customeridyominame',_0x3772('0x79'),_0x3772('0x7a'),_0x3772('0x7b'),_0x3772('0x7c'),'escalatedon',_0x3772('0x7d'),_0x3772('0x7e'),_0x3772('0x7f'),_0x3772('0x80'),'influencescore','kbarticleidname',_0x3772('0x81'),_0x3772('0x82'),_0x3772('0x83'),_0x3772('0x84'),'modifiedbyname','modifiedbyyominame',_0x3772('0x85'),_0x3772('0x86'),_0x3772('0x87'),_0x3772('0x88'),'msdyn_iotalertname',_0x3772('0x89'),'onholdtime',_0x3772('0x8a'),'owneridname','owneridtype',_0x3772('0x8b'),_0x3772('0x8c'),_0x3772('0x8d'),_0x3772('0x8e'),'prioritycodename',_0x3772('0x8f'),_0x3772('0x90'),'resolveby',_0x3772('0x91'),_0x3772('0x92'),'responsiblecontactidname',_0x3772('0x93'),'sentimentvalue',_0x3772('0x94'),_0x3772('0x95'),_0x3772('0x96'),'statecode',_0x3772('0x97'),_0x3772('0x98'),_0x3772('0x99'),_0x3772('0x9a'),_0x3772('0x9b'),'traversedpath','utcconversiontimezonecode',_0x3772('0x9c')];var _0xb44cf3=_0x23ff59[_0x3772('0x9d')](_0x3e9d96);return db['Dynamics365Account'][_0x3772('0x54')]({'where':{'id':_0x3f4915['params']['id']},'attributes':['id',_0x3772('0x9e'),_0x3772('0x9f'),_0x3772('0xa0'),_0x3772('0xa1'),_0x3772('0xa2'),'clientSecret']})[_0x3772('0x1b')](handleEntityNotFound(_0x1e3d5a,null))[_0x3772('0x1b')](function(_0x9f74c7){if(_0x9f74c7){_0x413add=_0x9f74c7[_0x3772('0xa0')];var _0x4a44dc=_0x413add[_0x3772('0xa3')](-0x1);if(_0x4a44dc==='/'){_0x413add=_0x413add[_0x3772('0xa4')](0x0,_0x413add[_0x3772('0xa5')](_0x4a44dc));}_0x10001c=util[_0x3772('0xa6')](_0x3772('0xa7'),_0x413add);var _0x513fcc={'method':_0x3772('0xa8'),'uri':_0x3772('0xa9')+_0x9f74c7['tenantId']+_0x3772('0xaa'),'form':{'client_id':_0x9f74c7[_0x3772('0xa2')],'resource':_0x413add,'username':_0x9f74c7['username'],'password':_0x9f74c7[_0x3772('0x9f')],'grant_type':_0x3772('0x9f'),'client_secret':_0x9f74c7[_0x3772('0xab')]},'json':!![]};return rp(_0x513fcc);}})['then'](function(_0x29acf2){_0x2e61c9=_0x29acf2['access_token'];var _0xfdbcad={'method':_0x3772('0xac'),'uri':encodeURI(_0x10001c+_0x3772('0xad')+_0x15adaf+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x2e61c9,'If-None-Match':null,'OData-Version':_0x3772('0xae')},'json':!![]};return rp(_0xfdbcad);})['then'](function(_0x31e89f){var _0x25d96d=_0x31e89f[_0x3772('0xaf')][0x0];var _0x72172a=_0x25d96d[_0x3772('0xb0')];var _0x908bd3={'method':_0x3772('0xac'),'uri':_0x10001c+_0x3772('0xb1')+_0x72172a+_0x3772('0xb2'),'headers':{'Authorization':_0x3772('0xb3')+_0x2e61c9,'If-None-Match':null,'OData-Version':_0x3772('0xae')},'json':!![]};return rp(_0x908bd3);})[_0x3772('0x1b')](function(_0x2e5285){_0x4c4dbb=_0x2e5285;_0x231916=_0x4c4dbb['Attributes'];_0x231916=_[_0x3772('0xb4')](_0x231916,function(_0x286136){return!_0xb44cf3[_0x3772('0xb5')](_0x286136[_0x3772('0xb6')]);});var _0x5f338e=[];var _0x9a3c86=[];_0x231916[_0x3772('0xb7')](function(_0x15b943){if(_0x15b943['@odata.type']){var _0x33b469=_0x15b943[_0x3772('0xb8')][_0x3772('0xa4')](_0x15b943['@odata.type'][_0x3772('0xa5')]('.')+0x1);if(_0x33b469===_0x3772('0xb9')){_0x5f338e['push'](getSelectList(_0x10001c,_0x1e2e21,_0x9a3c86,_0x4c4dbb['MetadataId'],_0x15b943[_0x3772('0xb0')],_0x2e61c9));}}});return Promise['all'](_0x5f338e);})[_0x3772('0x1b')](function(_0x602c4d){_0xac4726=_0x602c4d[0x0];var _0x5ac0d0=[];var _0x201a2c=[];_0x231916[_0x3772('0xb7')](function(_0x26ea93){if(!_[_0x3772('0xba')](_0x26ea93[_0x3772('0xb8')])){var _0x2f8da2=_0x26ea93['@odata.type'][_0x3772('0xa4')](_0x26ea93['@odata.type'][_0x3772('0xa5')]('.')+0x1);if(_0x2f8da2===_0x3772('0xbb')){_0x5ac0d0[_0x3772('0xbc')](getBooleanList(_0x10001c,_0x1e2e21,_0x201a2c,_0x4c4dbb[_0x3772('0xb0')],_0x26ea93['MetadataId'],_0x2e61c9));}}});return Promise['all'](_0x5ac0d0);})[_0x3772('0x1b')](function(_0x288a4d){_0x2bb4e5=_0x288a4d[0x0];var _0x576e9d=[];var _0x1d27d6=[];_0x231916['forEach'](function(_0x556837){if(_0x556837[_0x3772('0xb8')]){var _0xfa3305=_0x556837[_0x3772('0xb8')][_0x3772('0xa4')](_0x556837[_0x3772('0xb8')][_0x3772('0xa5')]('.')+0x1);if(_0xfa3305===_0x3772('0xbd')||_0xfa3305==='DoubleAttributeMetadata'||_0xfa3305==='BigIntAttributeMetadata'||_0xfa3305===_0x3772('0xbe')||_0xfa3305===_0x3772('0xbf')||_0xfa3305===_0x3772('0xc0')||_0xfa3305==='StatusAttributeMetadata'||_0xfa3305===_0x3772('0xc1')||_0xfa3305==='StateAttributeMetadata'||_0xfa3305===_0x3772('0xc2')){_0x576e9d[_0x3772('0xbc')](getInputList(_0x10001c,_0x1e2e21,_0xfa3305,_0x1d27d6,_0x4c4dbb[_0x3772('0xb0')],_0x556837[_0x3772('0xb0')],_0x2e61c9));}}});return Promise[_0x3772('0xc3')](_0x576e9d);})[_0x3772('0x1b')](function(_0x3953d4){_0x2959c2=_0x3953d4[0x0];var _0x30f8ad=_0xac4726[_0x3772('0x9d')](_0x2bb4e5)[_0x3772('0x9d')](_0x2959c2);var _0x5ca95a={'count':_0x30f8ad[_0x3772('0x4d')],'rows':_0x30f8ad};return _0x5ca95a;})[_0x3772('0x1b')](respondWithResult(_0x1e3d5a,null))[_0x3772('0x26')](function(_0x28155b){var _0x141578=_0x3f4915[_0x3772('0x3b')][_0x3772('0x18')]?0x1f4:_0x28155b[_0x3772('0xc4')]||0x1f4;logger[_0x3772('0x21')](_0x28155b['stack']);delete _0x28155b[_0x3772('0x36')];if(_0x141578===0x191){_0x141578=0x190;}_0x1e3d5a[_0x3772('0x28')](_0x141578)[_0x3772('0x37')](_0x3f4915[_0x3772('0x3b')][_0x3772('0x18')]?{'message':_0x3772('0xc5'),'statusCode':_0x28155b[_0x3772('0xc4')]}:_0x28155b);});};function getSelectList(_0x1de8c5,_0x47c979,_0x38ea7d,_0x30fcd6,_0x52f438,_0x3503e5){var _0x5330c6={'method':_0x3772('0xac'),'uri':_0x1de8c5+_0x3772('0xb1')+_0x30fcd6+_0x3772('0xc6')+_0x52f438+_0x3772('0xc7')+_0x3772('0xc8'),'headers':{'Authorization':_0x3772('0xb3')+_0x3503e5,'If-None-Match':null,'OData-Version':_0x3772('0xae')},'json':!![]};return rp(_0x5330c6)[_0x3772('0x1b')](function(_0x3fa316){var _0x2cac18=[];var _0x28f0fc=_0x3fa316[_0x3772('0xc9')]['Options'];_0x28f0fc[_0x3772('0xb7')](function(_0x4de829){_0x2cac18[_0x3772('0xbc')]({'name':_0x4de829[_0x3772('0xca')][_0x3772('0xcb')]['Label'],'value':String(_0x4de829[_0x3772('0xcc')])});});var _0x70c8c4={'id':_0x47c979+'_'+_0x3fa316[_0x3772('0xb6')],'name':_0x3fa316['DisplayName']['UserLocalizedLabel'][_0x3772('0xca')],'custom':![],'options':_0x2cac18};_0x38ea7d[_0x3772('0xbc')](_0x70c8c4);return _0x38ea7d;});}function getBooleanList(_0x4f3f29,_0x495e08,_0x2614b1,_0x5369d9,_0x53ca41,_0x2879c6){var _0x15a789={'method':_0x3772('0xac'),'uri':_0x4f3f29+_0x3772('0xb1')+_0x5369d9+_0x3772('0xc6')+_0x53ca41+_0x3772('0xcd'),'headers':{'Authorization':_0x3772('0xb3')+_0x2879c6,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x15a789)[_0x3772('0x1b')](function(_0x5ce061){var _0x4478ab=[];_0x4478ab[_0x3772('0xbc')]({'name':_0x5ce061['OptionSet']['TrueOption'][_0x3772('0xca')][_0x3772('0xcb')]['Label'],'value':_0x3772('0xce')},{'name':_0x5ce061[_0x3772('0xc9')][_0x3772('0xcf')]['Label'][_0x3772('0xcb')][_0x3772('0xca')],'value':_0x3772('0xd0')});var _0xc976ba={'id':_0x495e08+'_'+_0x5ce061[_0x3772('0xb6')],'name':_0x5ce061[_0x3772('0xd1')][_0x3772('0xcb')][_0x3772('0xca')],'custom':![],'options':_0x4478ab};_0x2614b1[_0x3772('0xbc')](_0xc976ba);return _0x2614b1;});}function getInputList(_0x18d889,_0x2143f7,_0x5ab7d7,_0x2234b8,_0x2ef1ac,_0x44d81c,_0x315574){var _0x326841={'method':_0x3772('0xac'),'uri':_0x18d889+_0x3772('0xb1')+_0x2ef1ac+_0x3772('0xc6')+_0x44d81c+_0x3772('0xd2')+_0x5ab7d7+_0x3772('0xd3'),'headers':{'Authorization':'Bearer\x20'+_0x315574,'If-None-Match':null,'OData-Version':_0x3772('0xae')},'json':!![]};return rp(_0x326841)[_0x3772('0x1b')](function(_0x2dec4c){var _0x367b21={'id':_0x2143f7+'_'+_0x2dec4c[_0x3772('0xb6')],'name':_0x2dec4c[_0x3772('0xd1')][_0x3772('0xcb')]?_0x2dec4c[_0x3772('0xd1')][_0x3772('0xcb')][_0x3772('0xca')]:_0x2dec4c[_0x3772('0xb6')],'custom':![],'options':[]};_0x2234b8[_0x3772('0xbc')](_0x367b21);return _0x2234b8;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index d0df927..01d09fe 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81b7=['api','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','int_dynamics365_accounts','util','../../config/logger'];(function(_0x2dd7fc,_0x42c03c){var _0x1eac5d=function(_0x48fe12){while(--_0x48fe12){_0x2dd7fc['push'](_0x2dd7fc['shift']());}};_0x1eac5d(++_0x42c03c);}(_0x81b7,0x1f2));var _0x781b=function(_0x809e3,_0x2ffadf){_0x809e3=_0x809e3-0x0;var _0x480f88=_0x81b7[_0x809e3];return _0x480f88;};'use strict';var _=require('lodash');var util=require(_0x781b('0x0'));var logger=require(_0x781b('0x1'))(_0x781b('0x2'));var moment=require(_0x781b('0x3'));var BPromise=require('bluebird');var rp=require(_0x781b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x781b('0x5'));var config=require(_0x781b('0x6'));var attributes=require(_0x781b('0x7'));var integrations=require(_0x781b('0x8'));module['exports']=function(_0x3d9d36,_0xd9d633){return _0x3d9d36['define']('Dynamics365Account',attributes,{'tableName':_0x781b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30e4=['api','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','util','../../config/logger'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x30e4,0xa7));var _0x430e=function(_0x2227e0,_0x31c0c9){_0x2227e0=_0x2227e0-0x0;var _0x141b72=_0x30e4[_0x2227e0];return _0x141b72;};'use strict';var _=require('lodash');var util=require(_0x430e('0x0'));var logger=require(_0x430e('0x1'))(_0x430e('0x2'));var moment=require('moment');var BPromise=require(_0x430e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x430e('0x4'));var rimraf=require(_0x430e('0x5'));var config=require(_0x430e('0x6'));var attributes=require(_0x430e('0x7'));var integrations=require(_0x430e('0x8'));module[_0x430e('0x9')]=function(_0x373345,_0x10ae1b){return _0x373345[_0x430e('0xa')](_0x430e('0xb'),attributes,{'tableName':_0x430e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index b9c0bbc..da98bba 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.rpc.js +++ b/server/api/intDynamics365Account/intDynamics365Account.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa5aa=['debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','limit','include','map','model','attributes','stringify','ShowDynamics365Account','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent'];(function(_0x442606,_0x19e1ea){var _0x50b9fc=function(_0x3a7832){while(--_0x3a7832){_0x442606['push'](_0x442606['shift']());}};_0x50b9fc(++_0x19e1ea);}(_0xa5aa,0x1ac));var _0xaa5a=function(_0x63799e,_0x110a28){_0x63799e=_0x63799e-0x0;var _0x3aa13e=_0xa5aa[_0x63799e];return _0x3aa13e;};'use strict';var _=require(_0xaa5a('0x0'));var util=require(_0xaa5a('0x1'));var moment=require('moment');var BPromise=require(_0xaa5a('0x2'));var rs=require(_0xaa5a('0x3'));var fs=require('fs');var Redis=require(_0xaa5a('0x4'));var db=require(_0xaa5a('0x5'))['db'];var utils=require(_0xaa5a('0x6'));var logger=require(_0xaa5a('0x7'))('rpc');var config=require(_0xaa5a('0x8'));var jayson=require(_0xaa5a('0x9'));var client=jayson[_0xaa5a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ca487,_0x26e49b,_0x3ec50a){return new BPromise(function(_0x4daa9a,_0x8f2d83){return client[_0xaa5a('0xb')](_0x5ca487,_0x3ec50a)[_0xaa5a('0xc')](function(_0x5d1b4b){logger[_0xaa5a('0xd')](_0xaa5a('0xe'),_0x26e49b,_0xaa5a('0xf'));logger[_0xaa5a('0x10')](_0xaa5a('0x11'),_0x26e49b,_0xaa5a('0xf'),JSON['stringify'](_0x5d1b4b));if(_0x5d1b4b[_0xaa5a('0x12')]){if(_0x5d1b4b[_0xaa5a('0x12')][_0xaa5a('0x13')]===0x1f4){logger[_0xaa5a('0x12')](_0xaa5a('0xe'),_0x26e49b,_0x5d1b4b[_0xaa5a('0x12')][_0xaa5a('0x14')]);return _0x8f2d83(_0x5d1b4b[_0xaa5a('0x12')][_0xaa5a('0x14')]);}logger[_0xaa5a('0x12')](_0xaa5a('0xe'),_0x26e49b,_0x5d1b4b[_0xaa5a('0x12')]['message']);return _0x4daa9a(_0x5d1b4b[_0xaa5a('0x12')][_0xaa5a('0x14')]);}else{logger[_0xaa5a('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x26e49b,_0xaa5a('0xf'));_0x4daa9a(_0x5d1b4b[_0xaa5a('0x15')][_0xaa5a('0x14')]);}})[_0xaa5a('0x16')](function(_0x8e1dde){logger[_0xaa5a('0x12')](_0xaa5a('0xe'),_0x26e49b,_0x8e1dde);_0x8f2d83(_0x8e1dde);});});}exports[_0xaa5a('0x17')]=function(_0xef5dd3){var _0x3a8ccf=this;return new Promise(function(_0x8799a4,_0x1c613d){return db[_0xaa5a('0x18')][_0xaa5a('0x19')]({'raw':_0xef5dd3[_0xaa5a('0x1a')]?_0xef5dd3[_0xaa5a('0x1a')][_0xaa5a('0x1b')]===undefined?!![]:![]:!![],'where':_0xef5dd3['options']?_0xef5dd3[_0xaa5a('0x1a')][_0xaa5a('0x1c')]||null:null,'attributes':_0xef5dd3[_0xaa5a('0x1a')]?_0xef5dd3[_0xaa5a('0x1a')]['attributes']||null:null,'limit':_0xef5dd3[_0xaa5a('0x1a')]?_0xef5dd3[_0xaa5a('0x1a')][_0xaa5a('0x1d')]||null:null,'include':_0xef5dd3[_0xaa5a('0x1a')]?_0xef5dd3[_0xaa5a('0x1a')][_0xaa5a('0x1e')]?_[_0xaa5a('0x1f')](_0xef5dd3[_0xaa5a('0x1a')][_0xaa5a('0x1e')],function(_0x5a9993){return{'model':db[_0x5a9993[_0xaa5a('0x20')]],'as':_0x5a9993['as'],'attributes':_0x5a9993['attributes'],'include':_0x5a9993[_0xaa5a('0x1e')]?_[_0xaa5a('0x1f')](_0x5a9993[_0xaa5a('0x1e')],function(_0x3e6ac1){return{'model':db[_0x3e6ac1[_0xaa5a('0x20')]],'as':_0x3e6ac1['as'],'attributes':_0x3e6ac1['attributes'],'include':_0x3e6ac1[_0xaa5a('0x1e')]?_[_0xaa5a('0x1f')](_0x3e6ac1['include'],function(_0x46e035){return{'model':db[_0x46e035['model']],'as':_0x46e035['as'],'attributes':_0x46e035[_0xaa5a('0x21')]};}):[]};}):[]};}):[]:[]})[_0xaa5a('0xc')](function(_0x24c8e5){logger[_0xaa5a('0xd')](_0xaa5a('0x17'),_0xef5dd3);logger[_0xaa5a('0x10')]('GetDynamics365Account',_0xef5dd3,JSON[_0xaa5a('0x22')](_0x24c8e5));_0x8799a4(_0x24c8e5);})[_0xaa5a('0x16')](function(_0x50996f){logger[_0xaa5a('0x12')](_0xaa5a('0x17'),_0x50996f['message'],_0xef5dd3);_0x1c613d(_0x3a8ccf[_0xaa5a('0x12')](0x1f4,_0x50996f[_0xaa5a('0x14')]));});});};exports[_0xaa5a('0x23')]=function(_0x115f03){var _0x24ff37=this;return new Promise(function(_0xa01478,_0x4b49af){return db[_0xaa5a('0x18')][_0xaa5a('0x24')]({'raw':_0x115f03[_0xaa5a('0x1a')]?_0x115f03[_0xaa5a('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x115f03['options']?_0x115f03[_0xaa5a('0x1a')][_0xaa5a('0x1c')]||null:null,'attributes':_0x115f03['options']?_0x115f03[_0xaa5a('0x1a')]['attributes']||null:null,'include':_0x115f03['options']?_0x115f03[_0xaa5a('0x1a')][_0xaa5a('0x1e')]?_[_0xaa5a('0x1f')](_0x115f03[_0xaa5a('0x1a')][_0xaa5a('0x1e')],function(_0x34f94a){return{'model':db[_0x34f94a[_0xaa5a('0x20')]],'as':_0x34f94a['as'],'attributes':_0x34f94a['attributes'],'include':_0x34f94a[_0xaa5a('0x1e')]?_[_0xaa5a('0x1f')](_0x34f94a[_0xaa5a('0x1e')],function(_0x59bd16){return{'model':db[_0x59bd16[_0xaa5a('0x20')]],'as':_0x59bd16['as'],'attributes':_0x59bd16['attributes'],'include':_0x59bd16[_0xaa5a('0x1e')]?_['map'](_0x59bd16['include'],function(_0x368a6d){return{'model':db[_0x368a6d[_0xaa5a('0x20')]],'as':_0x368a6d['as'],'attributes':_0x368a6d[_0xaa5a('0x21')]};}):[]};}):[]};}):[]:[]})[_0xaa5a('0xc')](function(_0x401fb8){logger[_0xaa5a('0xd')](_0xaa5a('0x23'),_0x115f03);logger[_0xaa5a('0x10')]('ShowDynamics365Account',_0x115f03,JSON['stringify'](_0x401fb8));_0xa01478(_0x401fb8);})['catch'](function(_0xbb00cc){logger[_0xaa5a('0x12')](_0xaa5a('0x23'),_0xbb00cc[_0xaa5a('0x14')],_0x115f03);_0x4b49af(_0x24ff37[_0xaa5a('0x12')](0x1f4,_0xbb00cc[_0xaa5a('0x14')]));});});}; \ No newline at end of file +var _0xc1dc=['Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','ShowDynamics365Account','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xc1dc,0x84));var _0xcc1d=function(_0x2c2da2,_0x2155f0){_0x2c2da2=_0x2c2da2-0x0;var _0x253aa8=_0xc1dc[_0x2c2da2];return _0x253aa8;};'use strict';var _=require(_0xcc1d('0x0'));var util=require(_0xcc1d('0x1'));var moment=require(_0xcc1d('0x2'));var BPromise=require('bluebird');var rs=require(_0xcc1d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc1d('0x4'))['db'];var utils=require(_0xcc1d('0x5'));var logger=require('../../config/logger')(_0xcc1d('0x6'));var config=require(_0xcc1d('0x7'));var jayson=require(_0xcc1d('0x8'));var client=jayson[_0xcc1d('0x9')][_0xcc1d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x597eb8,_0x4dc8ee,_0x23e085){return new BPromise(function(_0x24d561,_0x6e9800){return client[_0xcc1d('0xb')](_0x597eb8,_0x23e085)[_0xcc1d('0xc')](function(_0x171592){logger['info'](_0xcc1d('0xd'),_0x4dc8ee,_0xcc1d('0xe'));logger[_0xcc1d('0xf')](_0xcc1d('0x10'),_0x4dc8ee,_0xcc1d('0xe'),JSON[_0xcc1d('0x11')](_0x171592));if(_0x171592['error']){if(_0x171592[_0xcc1d('0x12')][_0xcc1d('0x13')]===0x1f4){logger['error'](_0xcc1d('0xd'),_0x4dc8ee,_0x171592[_0xcc1d('0x12')][_0xcc1d('0x14')]);return _0x6e9800(_0x171592[_0xcc1d('0x12')][_0xcc1d('0x14')]);}logger[_0xcc1d('0x12')](_0xcc1d('0xd'),_0x4dc8ee,_0x171592['error']['message']);return _0x24d561(_0x171592[_0xcc1d('0x12')]['message']);}else{logger[_0xcc1d('0x15')](_0xcc1d('0xd'),_0x4dc8ee,_0xcc1d('0xe'));_0x24d561(_0x171592[_0xcc1d('0x16')][_0xcc1d('0x14')]);}})[_0xcc1d('0x17')](function(_0x1f9737){logger[_0xcc1d('0x12')](_0xcc1d('0xd'),_0x4dc8ee,_0x1f9737);_0x6e9800(_0x1f9737);});});}exports[_0xcc1d('0x18')]=function(_0x483963){var _0x57a551=this;return new Promise(function(_0x2ee388,_0x536641){return db[_0xcc1d('0x19')][_0xcc1d('0x1a')]({'raw':_0x483963[_0xcc1d('0x1b')]?_0x483963[_0xcc1d('0x1b')][_0xcc1d('0x1c')]===undefined?!![]:![]:!![],'where':_0x483963[_0xcc1d('0x1b')]?_0x483963[_0xcc1d('0x1b')][_0xcc1d('0x1d')]||null:null,'attributes':_0x483963[_0xcc1d('0x1b')]?_0x483963['options'][_0xcc1d('0x1e')]||null:null,'limit':_0x483963['options']?_0x483963[_0xcc1d('0x1b')][_0xcc1d('0x1f')]||null:null,'include':_0x483963[_0xcc1d('0x1b')]?_0x483963['options'][_0xcc1d('0x20')]?_[_0xcc1d('0x21')](_0x483963[_0xcc1d('0x1b')][_0xcc1d('0x20')],function(_0xac9e86){return{'model':db[_0xac9e86['model']],'as':_0xac9e86['as'],'attributes':_0xac9e86[_0xcc1d('0x1e')],'include':_0xac9e86['include']?_[_0xcc1d('0x21')](_0xac9e86[_0xcc1d('0x20')],function(_0x3f8b30){return{'model':db[_0x3f8b30[_0xcc1d('0x22')]],'as':_0x3f8b30['as'],'attributes':_0x3f8b30[_0xcc1d('0x1e')],'include':_0x3f8b30['include']?_[_0xcc1d('0x21')](_0x3f8b30[_0xcc1d('0x20')],function(_0xec0667){return{'model':db[_0xec0667['model']],'as':_0xec0667['as'],'attributes':_0xec0667[_0xcc1d('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d2b0c){logger['info'](_0xcc1d('0x18'),_0x483963);logger[_0xcc1d('0xf')](_0xcc1d('0x18'),_0x483963,JSON['stringify'](_0x2d2b0c));_0x2ee388(_0x2d2b0c);})[_0xcc1d('0x17')](function(_0x10f5d3){logger[_0xcc1d('0x12')]('GetDynamics365Account',_0x10f5d3[_0xcc1d('0x14')],_0x483963);_0x536641(_0x57a551['error'](0x1f4,_0x10f5d3[_0xcc1d('0x14')]));});});};exports[_0xcc1d('0x23')]=function(_0x14a4d4){var _0x380bd2=this;return new Promise(function(_0x5f70cc,_0x5d9163){return db[_0xcc1d('0x19')][_0xcc1d('0x24')]({'raw':_0x14a4d4['options']?_0x14a4d4[_0xcc1d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x14a4d4[_0xcc1d('0x1b')]?_0x14a4d4['options']['where']||null:null,'attributes':_0x14a4d4[_0xcc1d('0x1b')]?_0x14a4d4['options'][_0xcc1d('0x1e')]||null:null,'include':_0x14a4d4[_0xcc1d('0x1b')]?_0x14a4d4[_0xcc1d('0x1b')][_0xcc1d('0x20')]?_[_0xcc1d('0x21')](_0x14a4d4[_0xcc1d('0x1b')]['include'],function(_0x1610f9){return{'model':db[_0x1610f9['model']],'as':_0x1610f9['as'],'attributes':_0x1610f9[_0xcc1d('0x1e')],'include':_0x1610f9[_0xcc1d('0x20')]?_[_0xcc1d('0x21')](_0x1610f9[_0xcc1d('0x20')],function(_0x5864a9){return{'model':db[_0x5864a9[_0xcc1d('0x22')]],'as':_0x5864a9['as'],'attributes':_0x5864a9[_0xcc1d('0x1e')],'include':_0x5864a9[_0xcc1d('0x20')]?_[_0xcc1d('0x21')](_0x5864a9[_0xcc1d('0x20')],function(_0x26910c){return{'model':db[_0x26910c[_0xcc1d('0x22')]],'as':_0x26910c['as'],'attributes':_0x26910c[_0xcc1d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcc1d('0xc')](function(_0x21af60){logger['info']('ShowDynamics365Account',_0x14a4d4);logger[_0xcc1d('0xf')](_0xcc1d('0x23'),_0x14a4d4,JSON['stringify'](_0x21af60));_0x5f70cc(_0x21af60);})['catch'](function(_0x5e2df9){logger[_0xcc1d('0x12')](_0xcc1d('0x23'),_0x5e2df9[_0xcc1d('0x14')],_0x14a4d4);_0x5d9163(_0x380bd2[_0xcc1d('0x12')](0x1f4,_0x5e2df9[_0xcc1d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 2aff62a..95a34f5 100644 --- a/server/api/intDynamics365Configuration/index.js +++ b/server/api/intDynamics365Configuration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf618=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','delete','multer','express','Router'];(function(_0x2633c7,_0x4db8b3){var _0xbb644=function(_0x3b63e0){while(--_0x3b63e0){_0x2633c7['push'](_0x2633c7['shift']());}};_0xbb644(++_0x4db8b3);}(_0xf618,0x162));var _0x8f61=function(_0x2cd135,_0x2c42e1){_0x2cd135=_0x2cd135-0x0;var _0x5e92e1=_0xf618[_0x2cd135];return _0x5e92e1;};'use strict';var multer=require(_0x8f61('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8f61('0x1'));var router=express[_0x8f61('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x8f61('0x3'));var config=require(_0x8f61('0x4'));var controller=require('./intDynamics365Configuration.controller');router[_0x8f61('0x5')]('/',auth[_0x8f61('0x6')](),controller[_0x8f61('0x7')]);router['get'](_0x8f61('0x8'),auth['isAuthenticated'](),controller[_0x8f61('0x9')]);router['get']('/:id/fields',auth[_0x8f61('0x6')](),controller[_0x8f61('0xa')]);router[_0x8f61('0x5')](_0x8f61('0xb'),auth[_0x8f61('0x6')](),controller[_0x8f61('0xc')]);router['get']('/:id/descriptions',auth[_0x8f61('0x6')](),controller[_0x8f61('0xd')]);router[_0x8f61('0xe')]('/',auth[_0x8f61('0x6')](),controller['create']);router[_0x8f61('0xf')](_0x8f61('0x8'),auth[_0x8f61('0x6')](),controller['update']);router[_0x8f61('0x10')](_0x8f61('0x8'),auth[_0x8f61('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x33ce=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x33ce,0x199));var _0xe33c=function(_0x5f2813,_0xc66ba9){_0x5f2813=_0x5f2813-0x0;var _0x2eb408=_0x33ce[_0x5f2813];return _0x2eb408;};'use strict';var multer=require(_0xe33c('0x0'));var util=require(_0xe33c('0x1'));var path=require(_0xe33c('0x2'));var timeout=require(_0xe33c('0x3'));var express=require(_0xe33c('0x4'));var router=express[_0xe33c('0x5')]();var auth=require(_0xe33c('0x6'));var interaction=require(_0xe33c('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0xe33c('0x8')]('/',auth[_0xe33c('0x9')](),controller[_0xe33c('0xa')]);router['get'](_0xe33c('0xb'),auth[_0xe33c('0x9')](),controller[_0xe33c('0xc')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['get'](_0xe33c('0xd'),auth[_0xe33c('0x9')](),controller[_0xe33c('0xe')]);router[_0xe33c('0x8')](_0xe33c('0xf'),auth[_0xe33c('0x9')](),controller[_0xe33c('0x10')]);router[_0xe33c('0x11')]('/',auth['isAuthenticated'](),controller[_0xe33c('0x12')]);router[_0xe33c('0x13')](_0xe33c('0xb'),auth[_0xe33c('0x9')](),controller[_0xe33c('0x14')]);router[_0xe33c('0x15')]('/:id',auth[_0xe33c('0x9')](),controller[_0xe33c('0x16')]);module[_0xe33c('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 44cce9b..c0f3e81 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e37=['phonecall','exports','ENUM','incident'];(function(_0xec559f,_0x73f48){var _0x39e04d=function(_0x369d4b){while(--_0x369d4b){_0xec559f['push'](_0xec559f['shift']());}};_0x39e04d(++_0x73f48);}(_0x0e37,0x6d));var _0x70e3=function(_0x5a1cbd,_0xb4ed72){_0x5a1cbd=_0x5a1cbd-0x0;var _0x2fb384=_0x0e37[_0x5a1cbd];return _0x2fb384;};'use strict';var Sequelize=require('sequelize');module[_0x70e3('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x70e3('0x1')](_0x70e3('0x2'),_0x70e3('0x3')),'defaultValue':_0x70e3('0x2')}}; \ No newline at end of file +var _0xe4f7=['incident','phonecall','exports','STRING','ENUM'];(function(_0x477598,_0x4dab5c){var _0x4c7ffb=function(_0x1be044){while(--_0x1be044){_0x477598['push'](_0x477598['shift']());}};_0x4c7ffb(++_0x4dab5c);}(_0xe4f7,0xc5));var _0x7e4f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xe4f7[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require('sequelize');module[_0x7e4f('0x0')]={'name':{'type':Sequelize[_0x7e4f('0x1')]},'description':{'type':Sequelize[_0x7e4f('0x1')]},'ticketType':{'type':Sequelize[_0x7e4f('0x2')](_0x7e4f('0x3'),_0x7e4f('0x4')),'defaultValue':_0x7e4f('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index c6acfb2..1775b7f 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ae2=['fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','rawAttributes','find','create','body','update','getFields','order','pick','Dynamics365Field','getSubjects','getDescriptions','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','count','offset','limit','set','json','apply','reject','save','destroy','end','stack','name','index','map','Dynamics365Configuration','fieldName','type','key','query','keys','filters','intersection','model','attributes'];(function(_0x302366,_0x14a777){var _0x128bca=function(_0x35605b){while(--_0x35605b){_0x302366['push'](_0x302366['shift']());}};_0x128bca(++_0x14a777);}(_0x4ae2,0x77));var _0x24ae=function(_0x258919,_0x1754e6){_0x258919=_0x258919-0x0;var _0xfbd68b=_0x4ae2[_0x258919];return _0xfbd68b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x24ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x24ae('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x24ae('0x2'));var moment=require('moment');var BPromise=require(_0x24ae('0x3'));var Mustache=require(_0x24ae('0x4'));var util=require(_0x24ae('0x5'));var path=require(_0x24ae('0x6'));var sox=require('sox');var csv=require(_0x24ae('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x24ae('0x8'));var squel=require(_0x24ae('0x9'));var crypto=require(_0x24ae('0xa'));var jsforce=require(_0x24ae('0xb'));var deskjs=require(_0x24ae('0xc'));var toCsv=require('to-csv');var querystring=require(_0x24ae('0xd'));var Papa=require(_0x24ae('0xe'));var Redis=require(_0x24ae('0xf'));var authService=require(_0x24ae('0x10'));var qs=require(_0x24ae('0x11'));var as=require(_0x24ae('0x12'));var hardwareService=require(_0x24ae('0x13'));var logger=require(_0x24ae('0x14'))(_0x24ae('0x15'));var utils=require('../../config/utils');var config=require(_0x24ae('0x16'));var db=require(_0x24ae('0x17'))['db'];var jayson=require(_0x24ae('0x18'));var client=jayson['client'][_0x24ae('0x19')]({'port':0x232a});function checkPasswordPattern(_0xcaa1f1,_0x55590c,_0x2023f9){if(_0x2023f9){var _0x41fdb5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x41fdb5[_0x24ae('0x1a')](_0x55590c)){return _0xcaa1f1;}else{throw new db[(_0x24ae('0x1b'))][(_0x24ae('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0xcaa1f1;}}function respondWithRpcPromise(_0x3f3efb,_0x16e530,_0x2d2cd0,_0x2ab751){return new BPromise(function(_0x3d4e04,_0x392546){var _0x4eee93=_0x2ab751||client;return _0x4eee93[_0x24ae('0x1d')](_0x3f3efb,_0x2d2cd0)[_0x24ae('0x1e')](function(_0x184f27){logger[_0x24ae('0x1f')](_0x24ae('0x20'),_0x16e530,_0x24ae('0x21'));logger[_0x24ae('0x22')](_0x24ae('0x23'),_0x16e530,_0x24ae('0x21'),JSON[_0x24ae('0x24')](_0x184f27));if(_0x184f27['error']){if(_0x184f27[_0x24ae('0x25')]['code']===0x1f4){logger[_0x24ae('0x25')](_0x24ae('0x20'),_0x16e530,_0x184f27[_0x24ae('0x25')][_0x24ae('0x26')]);return _0x392546(_0x184f27[_0x24ae('0x25')]['message']);}logger[_0x24ae('0x25')](_0x24ae('0x20'),_0x16e530,_0x184f27[_0x24ae('0x25')][_0x24ae('0x26')]);return _0x3d4e04(_0x184f27[_0x24ae('0x25')]['message']);}else{logger[_0x24ae('0x1f')](_0x24ae('0x20'),_0x16e530,'request\x20sent');_0x3d4e04(_0x184f27[_0x24ae('0x27')][_0x24ae('0x26')]);}})[_0x24ae('0x28')](function(_0x482750){logger[_0x24ae('0x25')](_0x24ae('0x20'),_0x16e530,_0x482750);_0x392546(_0x482750);});});}function respondWithStatusCode(_0x121608,_0x1a44c0){_0x1a44c0=_0x1a44c0||0xcc;return function(_0x3d3f44){if(_0x3d3f44){return _0x121608[_0x24ae('0x29')](_0x1a44c0);}return _0x121608[_0x24ae('0x2a')](_0x1a44c0)['end']();};}function respondWithResult(_0x42dd48,_0x20bf9b){_0x20bf9b=_0x20bf9b||0xc8;return function(_0x517d6e){if(_0x517d6e){return _0x42dd48[_0x24ae('0x2a')](_0x20bf9b)['json'](_0x517d6e);}};}function respondWithFilteredResult(_0x117f69,_0x5039b8){return function(_0x298a58){if(_0x298a58){var _0x2ae78d=_0x298a58[_0x24ae('0x2b')],_0x3ccde5=_0x5039b8[_0x24ae('0x2c')],_0x853034=_0x5039b8[_0x24ae('0x2c')]+_0x5039b8[_0x24ae('0x2d')],_0x20755e;if(_0x853034>=_0x2ae78d){_0x853034=_0x2ae78d;_0x20755e=0xc8;}else{_0x20755e=0xce;}_0x117f69[_0x24ae('0x2a')](_0x20755e);return _0x117f69[_0x24ae('0x2e')]('Content-Range',_0x3ccde5+'-'+_0x853034+'/'+_0x2ae78d)[_0x24ae('0x2f')](_0x298a58);}return null;};}function patchUpdates(_0x360e7c){return function(_0x1c5cff){try{jsonpatch[_0x24ae('0x30')](_0x1c5cff,_0x360e7c,!![]);}catch(_0x593cce){return BPromise[_0x24ae('0x31')](_0x593cce);}return _0x1c5cff[_0x24ae('0x32')]();};}function saveUpdates(_0x2669b4,_0x1484af){return function(_0x8f93a8){if(_0x8f93a8){return _0x8f93a8['update'](_0x2669b4)[_0x24ae('0x1e')](function(_0x3b0a26){return _0x3b0a26;});}return null;};}function removeEntity(_0xa3f0ee,_0x8f3044){return function(_0x48754b){if(_0x48754b){return _0x48754b[_0x24ae('0x33')]()[_0x24ae('0x1e')](function(){_0xa3f0ee[_0x24ae('0x2a')](0xcc)[_0x24ae('0x34')]();});}};}function handleEntityNotFound(_0xcc4857,_0x49ae7c){return function(_0xfc79ff){if(!_0xfc79ff){_0xcc4857[_0x24ae('0x29')](0x194);}return _0xfc79ff;};}function handleError(_0x206e3a,_0x5e69c1){_0x5e69c1=_0x5e69c1||0x1f4;return function(_0x4ac3ab){logger[_0x24ae('0x25')](_0x4ac3ab[_0x24ae('0x35')]);if(_0x4ac3ab['name']){delete _0x4ac3ab[_0x24ae('0x36')];}_0x206e3a[_0x24ae('0x2a')](_0x5e69c1)['send'](_0x4ac3ab);};}exports[_0x24ae('0x37')]=function(_0x22cb86,_0x4527a9){var _0x1d6754={},_0x3ec492={},_0x255960={'count':0x0,'rows':[]};var _0x3a10d6=_[_0x24ae('0x38')](db[_0x24ae('0x39')]['rawAttributes'],function(_0x27d8f0){return{'name':_0x27d8f0[_0x24ae('0x3a')],'type':_0x27d8f0[_0x24ae('0x3b')][_0x24ae('0x3c')]};});_0x3ec492['model']=_[_0x24ae('0x38')](_0x3a10d6,_0x24ae('0x36'));_0x3ec492[_0x24ae('0x3d')]=_[_0x24ae('0x3e')](_0x22cb86[_0x24ae('0x3d')]);_0x3ec492[_0x24ae('0x3f')]=_[_0x24ae('0x40')](_0x3ec492[_0x24ae('0x41')],_0x3ec492[_0x24ae('0x3d')]);_0x1d6754[_0x24ae('0x42')]=_[_0x24ae('0x40')](_0x3ec492['model'],qs[_0x24ae('0x43')](_0x22cb86['query']['fields']));_0x1d6754['attributes']=_0x1d6754['attributes'][_0x24ae('0x44')]?_0x1d6754[_0x24ae('0x42')]:_0x3ec492[_0x24ae('0x41')];if(!_0x22cb86[_0x24ae('0x3d')][_0x24ae('0x45')](_0x24ae('0x46'))){_0x1d6754[_0x24ae('0x2d')]=qs[_0x24ae('0x2d')](_0x22cb86['query'][_0x24ae('0x2d')]);_0x1d6754[_0x24ae('0x2c')]=qs[_0x24ae('0x2c')](_0x22cb86[_0x24ae('0x3d')][_0x24ae('0x2c')]);}_0x1d6754['order']=qs[_0x24ae('0x47')](_0x22cb86[_0x24ae('0x3d')]['sort']);_0x1d6754[_0x24ae('0x48')]=qs[_0x24ae('0x3f')](_['pick'](_0x22cb86[_0x24ae('0x3d')],_0x3ec492[_0x24ae('0x3f')]),_0x3a10d6);if(_0x22cb86['query']['filter']){_0x1d6754['where']=_[_0x24ae('0x49')](_0x1d6754[_0x24ae('0x48')],{'$or':_['map'](_0x3a10d6,function(_0x21d53f){if(_0x21d53f[_0x24ae('0x3b')]!==_0x24ae('0x4a')){var _0x3b7f31={};_0x3b7f31[_0x21d53f[_0x24ae('0x36')]]={'$like':'%'+_0x22cb86[_0x24ae('0x3d')][_0x24ae('0x4b')]+'%'};return _0x3b7f31;}})});}_0x1d6754=_['merge']({},_0x1d6754,_0x22cb86[_0x24ae('0x4c')]);var _0x5d099c={'where':_0x1d6754[_0x24ae('0x48')]};return db[_0x24ae('0x39')][_0x24ae('0x2b')](_0x5d099c)[_0x24ae('0x1e')](function(_0x409bbc){_0x255960['count']=_0x409bbc;if(_0x22cb86['query']['includeAll']){_0x1d6754[_0x24ae('0x4d')]=[{'all':!![]}];}return db[_0x24ae('0x39')][_0x24ae('0x4e')](_0x1d6754);})['then'](function(_0x59c5c6){_0x255960[_0x24ae('0x4f')]=_0x59c5c6;return _0x255960;})[_0x24ae('0x1e')](respondWithFilteredResult(_0x4527a9,_0x1d6754))['catch'](handleError(_0x4527a9,null));};exports[_0x24ae('0x50')]=function(_0x2e2815,_0x59c094){var _0x398b82={'raw':![],'where':{'id':_0x2e2815[_0x24ae('0x51')]['id']}},_0x135567={};_0x135567[_0x24ae('0x41')]=_[_0x24ae('0x3e')](db['Dynamics365Configuration'][_0x24ae('0x52')]);_0x135567['query']=_[_0x24ae('0x3e')](_0x2e2815[_0x24ae('0x3d')]);_0x135567['filters']=_[_0x24ae('0x40')](_0x135567[_0x24ae('0x41')],_0x135567[_0x24ae('0x3d')]);_0x398b82[_0x24ae('0x42')]=_[_0x24ae('0x40')](_0x135567['model'],qs[_0x24ae('0x43')](_0x2e2815[_0x24ae('0x3d')][_0x24ae('0x43')]));_0x398b82[_0x24ae('0x42')]=_0x398b82['attributes'][_0x24ae('0x44')]?_0x398b82[_0x24ae('0x42')]:_0x135567['model'];if(_0x2e2815[_0x24ae('0x3d')]['includeAll']){_0x398b82[_0x24ae('0x4d')]=[{'all':!![]}];}_0x398b82=_[_0x24ae('0x49')]({},_0x398b82,_0x2e2815[_0x24ae('0x4c')]);return db['Dynamics365Configuration'][_0x24ae('0x53')](_0x398b82)[_0x24ae('0x1e')](handleEntityNotFound(_0x59c094,null))[_0x24ae('0x1e')](respondWithResult(_0x59c094,null))['catch'](handleError(_0x59c094,null));};exports[_0x24ae('0x54')]=function(_0xa6b325,_0x4f336d){return db[_0x24ae('0x39')]['create'](_0xa6b325[_0x24ae('0x55')],{})[_0x24ae('0x1e')](respondWithResult(_0x4f336d,0xc9))[_0x24ae('0x28')](handleError(_0x4f336d,null));};exports[_0x24ae('0x56')]=function(_0x186f67,_0x5b286b){if(_0x186f67['body']['id']){delete _0x186f67['body']['id'];}return db[_0x24ae('0x39')][_0x24ae('0x53')]({'where':{'id':_0x186f67[_0x24ae('0x51')]['id']}})[_0x24ae('0x1e')](handleEntityNotFound(_0x5b286b,null))[_0x24ae('0x1e')](saveUpdates(_0x186f67[_0x24ae('0x55')],null))['then'](respondWithResult(_0x5b286b,null))['catch'](handleError(_0x5b286b,null));};exports['destroy']=function(_0x189608,_0x23027e){return db['Dynamics365Configuration']['find']({'where':{'id':_0x189608[_0x24ae('0x51')]['id']}})['then'](handleEntityNotFound(_0x23027e,null))[_0x24ae('0x1e')](removeEntity(_0x23027e,null))[_0x24ae('0x28')](handleError(_0x23027e,null));};exports[_0x24ae('0x57')]=function(_0x22a057,_0x3c66b1,_0x4f9868){var _0x2d2d14={};var _0x3a207d={};var _0x2074ec;var _0x14b264;return db[_0x24ae('0x39')]['findOne']({'where':{'id':_0x22a057['params']['id']}})[_0x24ae('0x1e')](handleEntityNotFound(_0x3c66b1,null))[_0x24ae('0x1e')](function(_0x4da0a5){if(_0x4da0a5){_0x2074ec=_0x4da0a5;_0x3a207d[_0x24ae('0x41')]=_[_0x24ae('0x3e')](db['Dynamics365Field']['rawAttributes']);_0x3a207d[_0x24ae('0x3d')]=_[_0x24ae('0x3e')](_0x22a057[_0x24ae('0x3d')]);_0x3a207d[_0x24ae('0x3f')]=_['intersection'](_0x3a207d[_0x24ae('0x41')],_0x3a207d[_0x24ae('0x3d')]);_0x2d2d14[_0x24ae('0x42')]=_[_0x24ae('0x40')](_0x3a207d['model'],qs[_0x24ae('0x43')](_0x22a057[_0x24ae('0x3d')][_0x24ae('0x43')]));_0x2d2d14[_0x24ae('0x42')]=_0x2d2d14[_0x24ae('0x42')][_0x24ae('0x44')]?_0x2d2d14[_0x24ae('0x42')]:_0x3a207d[_0x24ae('0x41')];_0x2d2d14[_0x24ae('0x58')]=qs[_0x24ae('0x47')](_0x22a057[_0x24ae('0x3d')][_0x24ae('0x47')]);_0x2d2d14['where']=qs[_0x24ae('0x3f')](_[_0x24ae('0x59')](_0x22a057[_0x24ae('0x3d')],_0x3a207d[_0x24ae('0x3f')]));if(_0x22a057[_0x24ae('0x3d')][_0x24ae('0x4b')]){_0x2d2d14[_0x24ae('0x48')]=_[_0x24ae('0x49')](_0x2d2d14[_0x24ae('0x48')],{'$or':_['map'](_0x2d2d14[_0x24ae('0x42')],function(_0x2e55c2){var _0xac70ff={};_0xac70ff[_0x2e55c2]={'$like':'%'+_0x22a057['query']['filter']+'%'};return _0xac70ff;})});}_0x2d2d14=_[_0x24ae('0x49')]({},_0x2d2d14,_0x22a057[_0x24ae('0x4c')]);return _0x2074ec[_0x24ae('0x57')](_0x2d2d14);}})[_0x24ae('0x1e')](function(_0x150fd3){if(_0x150fd3){_0x14b264=_0x150fd3[_0x24ae('0x44')];if(!_0x22a057[_0x24ae('0x3d')]['hasOwnProperty'](_0x24ae('0x46'))){_0x2d2d14[_0x24ae('0x2d')]=qs[_0x24ae('0x2d')](_0x22a057[_0x24ae('0x3d')]['limit']);_0x2d2d14[_0x24ae('0x2c')]=qs[_0x24ae('0x2c')](_0x22a057[_0x24ae('0x3d')][_0x24ae('0x2c')]);}return _0x2074ec[_0x24ae('0x57')](_0x2d2d14);}})[_0x24ae('0x1e')](function(_0x11d02d){if(_0x11d02d){return _0x11d02d?{'count':_0x14b264,'rows':_0x11d02d}:null;}})[_0x24ae('0x1e')](respondWithResult(_0x3c66b1,null))[_0x24ae('0x28')](handleError(_0x3c66b1,null));};exports['getSubjects']=function(_0x30ee77,_0x285056,_0x60c087){var _0x3e4c9d={};var _0x26a211={};var _0x219b42;var _0x1b08f0;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x30ee77['params']['id']}})[_0x24ae('0x1e')](handleEntityNotFound(_0x285056,null))[_0x24ae('0x1e')](function(_0x346c32){if(_0x346c32){_0x219b42=_0x346c32;_0x26a211[_0x24ae('0x41')]=_[_0x24ae('0x3e')](db[_0x24ae('0x5a')][_0x24ae('0x52')]);_0x26a211['query']=_['keys'](_0x30ee77['query']);_0x26a211[_0x24ae('0x3f')]=_[_0x24ae('0x40')](_0x26a211['model'],_0x26a211[_0x24ae('0x3d')]);_0x3e4c9d[_0x24ae('0x42')]=_['intersection'](_0x26a211[_0x24ae('0x41')],qs[_0x24ae('0x43')](_0x30ee77[_0x24ae('0x3d')]['fields']));_0x3e4c9d['attributes']=_0x3e4c9d['attributes']['length']?_0x3e4c9d[_0x24ae('0x42')]:_0x26a211[_0x24ae('0x41')];_0x3e4c9d[_0x24ae('0x58')]=qs[_0x24ae('0x47')](_0x30ee77['query']['sort']);_0x3e4c9d[_0x24ae('0x48')]=qs['filters'](_[_0x24ae('0x59')](_0x30ee77['query'],_0x26a211['filters']));if(_0x30ee77['query'][_0x24ae('0x4b')]){_0x3e4c9d[_0x24ae('0x48')]=_[_0x24ae('0x49')](_0x3e4c9d['where'],{'$or':_[_0x24ae('0x38')](_0x3e4c9d['attributes'],function(_0x53e0df){var _0x2343ac={};_0x2343ac[_0x53e0df]={'$like':'%'+_0x30ee77[_0x24ae('0x3d')][_0x24ae('0x4b')]+'%'};return _0x2343ac;})});}_0x3e4c9d=_[_0x24ae('0x49')]({},_0x3e4c9d,_0x30ee77['options']);return _0x219b42[_0x24ae('0x5b')](_0x3e4c9d);}})['then'](function(_0x17c59f){if(_0x17c59f){_0x1b08f0=_0x17c59f[_0x24ae('0x44')];if(!_0x30ee77[_0x24ae('0x3d')][_0x24ae('0x45')](_0x24ae('0x46'))){_0x3e4c9d[_0x24ae('0x2d')]=qs['limit'](_0x30ee77[_0x24ae('0x3d')][_0x24ae('0x2d')]);_0x3e4c9d[_0x24ae('0x2c')]=qs[_0x24ae('0x2c')](_0x30ee77[_0x24ae('0x3d')][_0x24ae('0x2c')]);}return _0x219b42[_0x24ae('0x5b')](_0x3e4c9d);}})[_0x24ae('0x1e')](function(_0x2477c1){if(_0x2477c1){return _0x2477c1?{'count':_0x1b08f0,'rows':_0x2477c1}:null;}})[_0x24ae('0x1e')](respondWithResult(_0x285056,null))[_0x24ae('0x28')](handleError(_0x285056,null));};exports[_0x24ae('0x5c')]=function(_0x4c4b1e,_0x4f2aab,_0x1901dc){var _0x37c107={};var _0x1e9621={};var _0x8f4265;var _0x45cdf1;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x4c4b1e[_0x24ae('0x51')]['id']}})[_0x24ae('0x1e')](handleEntityNotFound(_0x4f2aab,null))[_0x24ae('0x1e')](function(_0x935e73){if(_0x935e73){_0x8f4265=_0x935e73;_0x1e9621['model']=_['keys'](db['Dynamics365Field'][_0x24ae('0x52')]);_0x1e9621[_0x24ae('0x3d')]=_[_0x24ae('0x3e')](_0x4c4b1e[_0x24ae('0x3d')]);_0x1e9621['filters']=_[_0x24ae('0x40')](_0x1e9621['model'],_0x1e9621[_0x24ae('0x3d')]);_0x37c107[_0x24ae('0x42')]=_['intersection'](_0x1e9621[_0x24ae('0x41')],qs[_0x24ae('0x43')](_0x4c4b1e['query']['fields']));_0x37c107[_0x24ae('0x42')]=_0x37c107[_0x24ae('0x42')][_0x24ae('0x44')]?_0x37c107['attributes']:_0x1e9621[_0x24ae('0x41')];_0x37c107[_0x24ae('0x58')]=qs[_0x24ae('0x47')](_0x4c4b1e[_0x24ae('0x3d')][_0x24ae('0x47')]);_0x37c107['where']=qs[_0x24ae('0x3f')](_[_0x24ae('0x59')](_0x4c4b1e[_0x24ae('0x3d')],_0x1e9621['filters']));if(_0x4c4b1e['query'][_0x24ae('0x4b')]){_0x37c107['where']=_[_0x24ae('0x49')](_0x37c107[_0x24ae('0x48')],{'$or':_[_0x24ae('0x38')](_0x37c107[_0x24ae('0x42')],function(_0x2ff730){var _0x3bdeb5={};_0x3bdeb5[_0x2ff730]={'$like':'%'+_0x4c4b1e[_0x24ae('0x3d')][_0x24ae('0x4b')]+'%'};return _0x3bdeb5;})});}_0x37c107=_[_0x24ae('0x49')]({},_0x37c107,_0x4c4b1e[_0x24ae('0x4c')]);return _0x8f4265[_0x24ae('0x5c')](_0x37c107);}})['then'](function(_0x2021a9){if(_0x2021a9){_0x45cdf1=_0x2021a9[_0x24ae('0x44')];if(!_0x4c4b1e[_0x24ae('0x3d')]['hasOwnProperty'](_0x24ae('0x46'))){_0x37c107[_0x24ae('0x2d')]=qs[_0x24ae('0x2d')](_0x4c4b1e[_0x24ae('0x3d')][_0x24ae('0x2d')]);_0x37c107['offset']=qs[_0x24ae('0x2c')](_0x4c4b1e[_0x24ae('0x3d')]['offset']);}return _0x8f4265['getDescriptions'](_0x37c107);}})[_0x24ae('0x1e')](function(_0x100582){if(_0x100582){return _0x100582?{'count':_0x45cdf1,'rows':_0x100582}:null;}})[_0x24ae('0x1e')](respondWithResult(_0x4f2aab,null))[_0x24ae('0x28')](handleError(_0x4f2aab,null));}; \ No newline at end of file +var _0x288b=['catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','then','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','findOne','Dynamics365Field','length','pick','getFields','getSubjects','getDescriptions','html-pdf','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent'];(function(_0x49f158,_0x5102b0){var _0x334058=function(_0x4a6023){while(--_0x4a6023){_0x49f158['push'](_0x49f158['shift']());}};_0x334058(++_0x5102b0);}(_0x288b,0x95));var _0xb288=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x288b[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xb288('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb288('0x1'));var moment=require('moment');var BPromise=require(_0xb288('0x2'));var Mustache=require('mustache');var util=require(_0xb288('0x3'));var path=require(_0xb288('0x4'));var sox=require(_0xb288('0x5'));var csv=require(_0xb288('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb288('0x7'));var squel=require(_0xb288('0x8'));var crypto=require(_0xb288('0x9'));var jsforce=require(_0xb288('0xa'));var deskjs=require(_0xb288('0xb'));var toCsv=require(_0xb288('0x6'));var querystring=require(_0xb288('0xc'));var Papa=require('papaparse');var Redis=require(_0xb288('0xd'));var authService=require(_0xb288('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb288('0xf'));var logger=require(_0xb288('0x10'))(_0xb288('0x11'));var utils=require(_0xb288('0x12'));var config=require(_0xb288('0x13'));var db=require(_0xb288('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xb288('0x15')][_0xb288('0x16')]({'port':0x232a});function checkPasswordPattern(_0x5479a2,_0xb8c9a4,_0x2e0361){if(_0x2e0361){var _0x4a4447=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4a4447[_0xb288('0x17')](_0xb8c9a4)){return _0x5479a2;}else{throw new db[(_0xb288('0x18'))]['ValidationError'](_0xb288('0x19'));}}else{return _0x5479a2;}}function respondWithRpcPromise(_0x5ae3a9,_0x5a75ab,_0x23e5d4,_0x5093e4){return new BPromise(function(_0x32d70b,_0x516d68){var _0x22ae7a=_0x5093e4||client;return _0x22ae7a[_0xb288('0x1a')](_0x5ae3a9,_0x23e5d4)['then'](function(_0x5a6dc4){logger[_0xb288('0x1b')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5a75ab,'request\x20sent');logger[_0xb288('0x1c')](_0xb288('0x1d'),_0x5a75ab,'request\x20sent',JSON[_0xb288('0x1e')](_0x5a6dc4));if(_0x5a6dc4[_0xb288('0x1f')]){if(_0x5a6dc4['error']['code']===0x1f4){logger[_0xb288('0x1f')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5a75ab,_0x5a6dc4[_0xb288('0x1f')][_0xb288('0x20')]);return _0x516d68(_0x5a6dc4[_0xb288('0x1f')][_0xb288('0x20')]);}logger[_0xb288('0x1f')](_0xb288('0x21'),_0x5a75ab,_0x5a6dc4[_0xb288('0x1f')][_0xb288('0x20')]);return _0x32d70b(_0x5a6dc4[_0xb288('0x1f')][_0xb288('0x20')]);}else{logger[_0xb288('0x1b')](_0xb288('0x21'),_0x5a75ab,_0xb288('0x22'));_0x32d70b(_0x5a6dc4['result'][_0xb288('0x20')]);}})[_0xb288('0x23')](function(_0x8bc3c6){logger[_0xb288('0x1f')](_0xb288('0x21'),_0x5a75ab,_0x8bc3c6);_0x516d68(_0x8bc3c6);});});}function respondWithStatusCode(_0x3cdce8,_0x40d8b8){_0x40d8b8=_0x40d8b8||0xcc;return function(_0x3c7a5d){if(_0x3c7a5d){return _0x3cdce8[_0xb288('0x24')](_0x40d8b8);}return _0x3cdce8[_0xb288('0x25')](_0x40d8b8)[_0xb288('0x26')]();};}function respondWithResult(_0x4a5971,_0x4be60c){_0x4be60c=_0x4be60c||0xc8;return function(_0x4b262e){if(_0x4b262e){return _0x4a5971[_0xb288('0x25')](_0x4be60c)[_0xb288('0x27')](_0x4b262e);}};}function respondWithFilteredResult(_0x7419e1,_0x2d13f1){return function(_0x3c55e0){if(_0x3c55e0){var _0x3116b1=_0x3c55e0[_0xb288('0x28')],_0xa79e11=_0x2d13f1['offset'],_0x4afb2a=_0x2d13f1[_0xb288('0x29')]+_0x2d13f1[_0xb288('0x2a')],_0x159cf8;if(_0x4afb2a>=_0x3116b1){_0x4afb2a=_0x3116b1;_0x159cf8=0xc8;}else{_0x159cf8=0xce;}_0x7419e1[_0xb288('0x25')](_0x159cf8);return _0x7419e1[_0xb288('0x2b')]('Content-Range',_0xa79e11+'-'+_0x4afb2a+'/'+_0x3116b1)[_0xb288('0x27')](_0x3c55e0);}return null;};}function patchUpdates(_0x2f8d36){return function(_0x56d0a9){try{jsonpatch[_0xb288('0x2c')](_0x56d0a9,_0x2f8d36,!![]);}catch(_0x3ee8fb){return BPromise[_0xb288('0x2d')](_0x3ee8fb);}return _0x56d0a9[_0xb288('0x2e')]();};}function saveUpdates(_0xa48881,_0x2bee27){return function(_0x40758e){if(_0x40758e){return _0x40758e[_0xb288('0x2f')](_0xa48881)['then'](function(_0x13d19d){return _0x13d19d;});}return null;};}function removeEntity(_0x55d41e,_0x23fd57){return function(_0x14831d){if(_0x14831d){return _0x14831d[_0xb288('0x30')]()[_0xb288('0x31')](function(){_0x55d41e[_0xb288('0x25')](0xcc)[_0xb288('0x26')]();});}};}function handleEntityNotFound(_0x310646,_0x23405e){return function(_0x31bdb0){if(!_0x31bdb0){_0x310646['sendStatus'](0x194);}return _0x31bdb0;};}function handleError(_0x4b3788,_0x4bbd75){_0x4bbd75=_0x4bbd75||0x1f4;return function(_0x2672e6){logger[_0xb288('0x1f')](_0x2672e6[_0xb288('0x32')]);if(_0x2672e6[_0xb288('0x33')]){delete _0x2672e6['name'];}_0x4b3788['status'](_0x4bbd75)[_0xb288('0x34')](_0x2672e6);};}exports[_0xb288('0x35')]=function(_0x32e130,_0x3b6596){var _0x412157={},_0x4eb06f={},_0x3b3992={'count':0x0,'rows':[]};var _0x1d2672=_[_0xb288('0x36')](db[_0xb288('0x37')][_0xb288('0x38')],function(_0x4fad0a){return{'name':_0x4fad0a[_0xb288('0x39')],'type':_0x4fad0a[_0xb288('0x3a')][_0xb288('0x3b')]};});_0x4eb06f[_0xb288('0x3c')]=_['map'](_0x1d2672,_0xb288('0x33'));_0x4eb06f[_0xb288('0x3d')]=_['keys'](_0x32e130['query']);_0x4eb06f[_0xb288('0x3e')]=_[_0xb288('0x3f')](_0x4eb06f[_0xb288('0x3c')],_0x4eb06f[_0xb288('0x3d')]);_0x412157[_0xb288('0x40')]=_[_0xb288('0x3f')](_0x4eb06f[_0xb288('0x3c')],qs[_0xb288('0x41')](_0x32e130['query'][_0xb288('0x41')]));_0x412157[_0xb288('0x40')]=_0x412157[_0xb288('0x40')]['length']?_0x412157['attributes']:_0x4eb06f[_0xb288('0x3c')];if(!_0x32e130[_0xb288('0x3d')][_0xb288('0x42')](_0xb288('0x43'))){_0x412157[_0xb288('0x2a')]=qs[_0xb288('0x2a')](_0x32e130[_0xb288('0x3d')][_0xb288('0x2a')]);_0x412157['offset']=qs[_0xb288('0x29')](_0x32e130[_0xb288('0x3d')]['offset']);}_0x412157[_0xb288('0x44')]=qs[_0xb288('0x45')](_0x32e130[_0xb288('0x3d')]['sort']);_0x412157['where']=qs[_0xb288('0x3e')](_['pick'](_0x32e130['query'],_0x4eb06f[_0xb288('0x3e')]),_0x1d2672);if(_0x32e130[_0xb288('0x3d')][_0xb288('0x46')]){_0x412157['where']=_['merge'](_0x412157[_0xb288('0x47')],{'$or':_[_0xb288('0x36')](_0x1d2672,function(_0xdbb1f1){if(_0xdbb1f1[_0xb288('0x3a')]!==_0xb288('0x48')){var _0x26bb7b={};_0x26bb7b[_0xdbb1f1[_0xb288('0x33')]]={'$like':'%'+_0x32e130[_0xb288('0x3d')][_0xb288('0x46')]+'%'};return _0x26bb7b;}})});}_0x412157=_[_0xb288('0x49')]({},_0x412157,_0x32e130[_0xb288('0x4a')]);var _0x479404={'where':_0x412157[_0xb288('0x47')]};return db[_0xb288('0x37')][_0xb288('0x28')](_0x479404)[_0xb288('0x31')](function(_0x43ab58){_0x3b3992[_0xb288('0x28')]=_0x43ab58;if(_0x32e130[_0xb288('0x3d')][_0xb288('0x4b')]){_0x412157[_0xb288('0x4c')]=[{'all':!![]}];}return db[_0xb288('0x37')][_0xb288('0x4d')](_0x412157);})[_0xb288('0x31')](function(_0x1ad6d1){_0x3b3992[_0xb288('0x4e')]=_0x1ad6d1;return _0x3b3992;})[_0xb288('0x31')](respondWithFilteredResult(_0x3b6596,_0x412157))[_0xb288('0x23')](handleError(_0x3b6596,null));};exports[_0xb288('0x4f')]=function(_0x5da3d2,_0x4343c6){var _0x3c8af3={'raw':![],'where':{'id':_0x5da3d2[_0xb288('0x50')]['id']}},_0x9ec3b0={};_0x9ec3b0[_0xb288('0x3c')]=_[_0xb288('0x51')](db[_0xb288('0x37')][_0xb288('0x38')]);_0x9ec3b0[_0xb288('0x3d')]=_[_0xb288('0x51')](_0x5da3d2[_0xb288('0x3d')]);_0x9ec3b0[_0xb288('0x3e')]=_['intersection'](_0x9ec3b0[_0xb288('0x3c')],_0x9ec3b0[_0xb288('0x3d')]);_0x3c8af3[_0xb288('0x40')]=_['intersection'](_0x9ec3b0[_0xb288('0x3c')],qs[_0xb288('0x41')](_0x5da3d2[_0xb288('0x3d')][_0xb288('0x41')]));_0x3c8af3['attributes']=_0x3c8af3['attributes']['length']?_0x3c8af3[_0xb288('0x40')]:_0x9ec3b0[_0xb288('0x3c')];if(_0x5da3d2[_0xb288('0x3d')][_0xb288('0x4b')]){_0x3c8af3['include']=[{'all':!![]}];}_0x3c8af3=_['merge']({},_0x3c8af3,_0x5da3d2['options']);return db[_0xb288('0x37')][_0xb288('0x52')](_0x3c8af3)[_0xb288('0x31')](handleEntityNotFound(_0x4343c6,null))[_0xb288('0x31')](respondWithResult(_0x4343c6,null))['catch'](handleError(_0x4343c6,null));};exports[_0xb288('0x53')]=function(_0x168c0a,_0x1b74a7){return db[_0xb288('0x37')]['create'](_0x168c0a[_0xb288('0x54')],{})['then'](respondWithResult(_0x1b74a7,0xc9))['catch'](handleError(_0x1b74a7,null));};exports[_0xb288('0x2f')]=function(_0x5e5db3,_0x526714){if(_0x5e5db3[_0xb288('0x54')]['id']){delete _0x5e5db3[_0xb288('0x54')]['id'];}return db['Dynamics365Configuration'][_0xb288('0x52')]({'where':{'id':_0x5e5db3[_0xb288('0x50')]['id']}})[_0xb288('0x31')](handleEntityNotFound(_0x526714,null))['then'](saveUpdates(_0x5e5db3[_0xb288('0x54')],null))[_0xb288('0x31')](respondWithResult(_0x526714,null))[_0xb288('0x23')](handleError(_0x526714,null));};exports[_0xb288('0x30')]=function(_0xe9d228,_0x5730bd){return db[_0xb288('0x37')][_0xb288('0x52')]({'where':{'id':_0xe9d228[_0xb288('0x50')]['id']}})[_0xb288('0x31')](handleEntityNotFound(_0x5730bd,null))[_0xb288('0x31')](removeEntity(_0x5730bd,null))[_0xb288('0x23')](handleError(_0x5730bd,null));};exports['getFields']=function(_0x28163e,_0x381ed1,_0x44a7f2){var _0xbed8c4={};var _0x57170a={};var _0x20e21f;var _0x27253c;return db[_0xb288('0x37')][_0xb288('0x55')]({'where':{'id':_0x28163e[_0xb288('0x50')]['id']}})[_0xb288('0x31')](handleEntityNotFound(_0x381ed1,null))[_0xb288('0x31')](function(_0x140ac0){if(_0x140ac0){_0x20e21f=_0x140ac0;_0x57170a[_0xb288('0x3c')]=_[_0xb288('0x51')](db[_0xb288('0x56')][_0xb288('0x38')]);_0x57170a[_0xb288('0x3d')]=_['keys'](_0x28163e[_0xb288('0x3d')]);_0x57170a[_0xb288('0x3e')]=_[_0xb288('0x3f')](_0x57170a[_0xb288('0x3c')],_0x57170a[_0xb288('0x3d')]);_0xbed8c4['attributes']=_[_0xb288('0x3f')](_0x57170a[_0xb288('0x3c')],qs['fields'](_0x28163e[_0xb288('0x3d')]['fields']));_0xbed8c4[_0xb288('0x40')]=_0xbed8c4['attributes'][_0xb288('0x57')]?_0xbed8c4[_0xb288('0x40')]:_0x57170a[_0xb288('0x3c')];_0xbed8c4[_0xb288('0x44')]=qs[_0xb288('0x45')](_0x28163e[_0xb288('0x3d')]['sort']);_0xbed8c4[_0xb288('0x47')]=qs[_0xb288('0x3e')](_[_0xb288('0x58')](_0x28163e[_0xb288('0x3d')],_0x57170a[_0xb288('0x3e')]));if(_0x28163e[_0xb288('0x3d')][_0xb288('0x46')]){_0xbed8c4[_0xb288('0x47')]=_[_0xb288('0x49')](_0xbed8c4[_0xb288('0x47')],{'$or':_[_0xb288('0x36')](_0xbed8c4[_0xb288('0x40')],function(_0x109d7f){var _0x337a38={};_0x337a38[_0x109d7f]={'$like':'%'+_0x28163e[_0xb288('0x3d')]['filter']+'%'};return _0x337a38;})});}_0xbed8c4=_[_0xb288('0x49')]({},_0xbed8c4,_0x28163e[_0xb288('0x4a')]);return _0x20e21f[_0xb288('0x59')](_0xbed8c4);}})[_0xb288('0x31')](function(_0xd6f9fe){if(_0xd6f9fe){_0x27253c=_0xd6f9fe[_0xb288('0x57')];if(!_0x28163e[_0xb288('0x3d')][_0xb288('0x42')](_0xb288('0x43'))){_0xbed8c4['limit']=qs[_0xb288('0x2a')](_0x28163e[_0xb288('0x3d')][_0xb288('0x2a')]);_0xbed8c4[_0xb288('0x29')]=qs[_0xb288('0x29')](_0x28163e['query'][_0xb288('0x29')]);}return _0x20e21f[_0xb288('0x59')](_0xbed8c4);}})[_0xb288('0x31')](function(_0x2a8d4d){if(_0x2a8d4d){return _0x2a8d4d?{'count':_0x27253c,'rows':_0x2a8d4d}:null;}})[_0xb288('0x31')](respondWithResult(_0x381ed1,null))[_0xb288('0x23')](handleError(_0x381ed1,null));};exports[_0xb288('0x5a')]=function(_0x5019ab,_0x2a7ab3,_0x25d264){var _0x4c1271={};var _0x395279={};var _0x32baf6;var _0x4c760c;return db[_0xb288('0x37')][_0xb288('0x55')]({'where':{'id':_0x5019ab[_0xb288('0x50')]['id']}})[_0xb288('0x31')](handleEntityNotFound(_0x2a7ab3,null))[_0xb288('0x31')](function(_0x2698c9){if(_0x2698c9){_0x32baf6=_0x2698c9;_0x395279[_0xb288('0x3c')]=_['keys'](db[_0xb288('0x56')][_0xb288('0x38')]);_0x395279['query']=_[_0xb288('0x51')](_0x5019ab[_0xb288('0x3d')]);_0x395279['filters']=_[_0xb288('0x3f')](_0x395279[_0xb288('0x3c')],_0x395279['query']);_0x4c1271['attributes']=_['intersection'](_0x395279['model'],qs[_0xb288('0x41')](_0x5019ab[_0xb288('0x3d')][_0xb288('0x41')]));_0x4c1271[_0xb288('0x40')]=_0x4c1271[_0xb288('0x40')][_0xb288('0x57')]?_0x4c1271[_0xb288('0x40')]:_0x395279['model'];_0x4c1271[_0xb288('0x44')]=qs['sort'](_0x5019ab[_0xb288('0x3d')][_0xb288('0x45')]);_0x4c1271['where']=qs[_0xb288('0x3e')](_[_0xb288('0x58')](_0x5019ab[_0xb288('0x3d')],_0x395279['filters']));if(_0x5019ab[_0xb288('0x3d')][_0xb288('0x46')]){_0x4c1271[_0xb288('0x47')]=_[_0xb288('0x49')](_0x4c1271[_0xb288('0x47')],{'$or':_[_0xb288('0x36')](_0x4c1271[_0xb288('0x40')],function(_0x552559){var _0x18b69d={};_0x18b69d[_0x552559]={'$like':'%'+_0x5019ab[_0xb288('0x3d')][_0xb288('0x46')]+'%'};return _0x18b69d;})});}_0x4c1271=_['merge']({},_0x4c1271,_0x5019ab['options']);return _0x32baf6['getSubjects'](_0x4c1271);}})[_0xb288('0x31')](function(_0x32f17a){if(_0x32f17a){_0x4c760c=_0x32f17a[_0xb288('0x57')];if(!_0x5019ab[_0xb288('0x3d')][_0xb288('0x42')](_0xb288('0x43'))){_0x4c1271['limit']=qs[_0xb288('0x2a')](_0x5019ab['query']['limit']);_0x4c1271[_0xb288('0x29')]=qs[_0xb288('0x29')](_0x5019ab['query'][_0xb288('0x29')]);}return _0x32baf6[_0xb288('0x5a')](_0x4c1271);}})[_0xb288('0x31')](function(_0x38bd86){if(_0x38bd86){return _0x38bd86?{'count':_0x4c760c,'rows':_0x38bd86}:null;}})[_0xb288('0x31')](respondWithResult(_0x2a7ab3,null))[_0xb288('0x23')](handleError(_0x2a7ab3,null));};exports[_0xb288('0x5b')]=function(_0x248b89,_0x33d80c,_0x18fdf9){var _0x51fdc2={};var _0x1544af={};var _0xf8d9dc;var _0x2c2525;return db[_0xb288('0x37')]['findOne']({'where':{'id':_0x248b89[_0xb288('0x50')]['id']}})[_0xb288('0x31')](handleEntityNotFound(_0x33d80c,null))[_0xb288('0x31')](function(_0x29f896){if(_0x29f896){_0xf8d9dc=_0x29f896;_0x1544af['model']=_[_0xb288('0x51')](db[_0xb288('0x56')][_0xb288('0x38')]);_0x1544af[_0xb288('0x3d')]=_[_0xb288('0x51')](_0x248b89[_0xb288('0x3d')]);_0x1544af['filters']=_[_0xb288('0x3f')](_0x1544af['model'],_0x1544af['query']);_0x51fdc2[_0xb288('0x40')]=_[_0xb288('0x3f')](_0x1544af[_0xb288('0x3c')],qs['fields'](_0x248b89[_0xb288('0x3d')][_0xb288('0x41')]));_0x51fdc2['attributes']=_0x51fdc2[_0xb288('0x40')][_0xb288('0x57')]?_0x51fdc2[_0xb288('0x40')]:_0x1544af['model'];_0x51fdc2['order']=qs[_0xb288('0x45')](_0x248b89[_0xb288('0x3d')][_0xb288('0x45')]);_0x51fdc2[_0xb288('0x47')]=qs['filters'](_[_0xb288('0x58')](_0x248b89[_0xb288('0x3d')],_0x1544af['filters']));if(_0x248b89[_0xb288('0x3d')]['filter']){_0x51fdc2[_0xb288('0x47')]=_[_0xb288('0x49')](_0x51fdc2[_0xb288('0x47')],{'$or':_[_0xb288('0x36')](_0x51fdc2[_0xb288('0x40')],function(_0x5125d4){var _0x416943={};_0x416943[_0x5125d4]={'$like':'%'+_0x248b89[_0xb288('0x3d')][_0xb288('0x46')]+'%'};return _0x416943;})});}_0x51fdc2=_['merge']({},_0x51fdc2,_0x248b89['options']);return _0xf8d9dc[_0xb288('0x5b')](_0x51fdc2);}})[_0xb288('0x31')](function(_0x338d3c){if(_0x338d3c){_0x2c2525=_0x338d3c[_0xb288('0x57')];if(!_0x248b89[_0xb288('0x3d')][_0xb288('0x42')](_0xb288('0x43'))){_0x51fdc2[_0xb288('0x2a')]=qs[_0xb288('0x2a')](_0x248b89[_0xb288('0x3d')]['limit']);_0x51fdc2['offset']=qs[_0xb288('0x29')](_0x248b89[_0xb288('0x3d')][_0xb288('0x29')]);}return _0xf8d9dc[_0xb288('0x5b')](_0x51fdc2);}})[_0xb288('0x31')](function(_0x3534bd){if(_0x3534bd){return _0x3534bd?{'count':_0x2c2525,'rows':_0x3534bd}:null;}})[_0xb288('0x31')](respondWithResult(_0x33d80c,null))['catch'](handleError(_0x33d80c,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 8d87f15..1eb0e78 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8c7=['../../config/environment','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x221272,_0x29146a){var _0xe0a9d7=function(_0x44ee43){while(--_0x44ee43){_0x221272['push'](_0x221272['shift']());}};_0xe0a9d7(++_0x29146a);}(_0xa8c7,0x130));var _0x7a8c=function(_0x3a781b,_0x1fc442){_0x3a781b=_0x3a781b-0x0;var _0x1bc468=_0xa8c7[_0x3a781b];return _0x1bc468;};'use strict';var _=require(_0x7a8c('0x0'));var util=require('util');var logger=require(_0x7a8c('0x1'))(_0x7a8c('0x2'));var moment=require(_0x7a8c('0x3'));var BPromise=require(_0x7a8c('0x4'));var rp=require(_0x7a8c('0x5'));var fs=require('fs');var path=require(_0x7a8c('0x6'));var rimraf=require(_0x7a8c('0x7'));var config=require(_0x7a8c('0x8'));var attributes=require('./intDynamics365Configuration.attributes');module[_0x7a8c('0x9')]=function(_0x74d646,_0x10899d){return _0x74d646[_0x7a8c('0xa')](_0x7a8c('0xb'),attributes,{'tableName':_0x7a8c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d1a=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger','api','moment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5d1a,0x7e));var _0xa5d1=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0x5d1a[_0x52f1e6];return _0x21f104;};'use strict';var _=require(_0xa5d1('0x0'));var util=require('util');var logger=require(_0xa5d1('0x1'))(_0xa5d1('0x2'));var moment=require(_0xa5d1('0x3'));var BPromise=require(_0xa5d1('0x4'));var rp=require(_0xa5d1('0x5'));var fs=require('fs');var path=require(_0xa5d1('0x6'));var rimraf=require(_0xa5d1('0x7'));var config=require(_0xa5d1('0x8'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xa5d1('0x9')]=function(_0x5dafd9,_0x25e8f0){return _0x5dafd9[_0xa5d1('0xa')](_0xa5d1('0xb'),attributes,{'tableName':_0xa5d1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 5522177..5788085 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x850e=['../../config/utils','rpc','../../config/environment','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x850e,0x1f3));var _0xe850=function(_0x239d3c,_0x43868f){_0x239d3c=_0x239d3c-0x0;var _0x1ed344=_0x850e[_0x239d3c];return _0x1ed344;};'use strict';var _=require(_0xe850('0x0'));var util=require(_0xe850('0x1'));var moment=require(_0xe850('0x2'));var BPromise=require(_0xe850('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe850('0x4'))['db'];var utils=require(_0xe850('0x5'));var logger=require('../../config/logger')(_0xe850('0x6'));var config=require(_0xe850('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe850('0x8')][_0xe850('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6a42,_0x4db31f,_0x45e8c9){return new BPromise(function(_0x4a5cdb,_0x3666b1){return client[_0xe850('0xa')](_0x4a6a42,_0x45e8c9)['then'](function(_0x22d5a9){logger[_0xe850('0xb')](_0xe850('0xc'),_0x4db31f,_0xe850('0xd'));logger[_0xe850('0xe')](_0xe850('0xf'),_0x4db31f,_0xe850('0xd'),JSON[_0xe850('0x10')](_0x22d5a9));if(_0x22d5a9[_0xe850('0x11')]){if(_0x22d5a9['error'][_0xe850('0x12')]===0x1f4){logger[_0xe850('0x11')](_0xe850('0xc'),_0x4db31f,_0x22d5a9['error'][_0xe850('0x13')]);return _0x3666b1(_0x22d5a9[_0xe850('0x11')][_0xe850('0x13')]);}logger[_0xe850('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4db31f,_0x22d5a9[_0xe850('0x11')][_0xe850('0x13')]);return _0x4a5cdb(_0x22d5a9[_0xe850('0x11')][_0xe850('0x13')]);}else{logger[_0xe850('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4db31f,'request\x20sent');_0x4a5cdb(_0x22d5a9[_0xe850('0x14')][_0xe850('0x13')]);}})['catch'](function(_0x18a27f){logger[_0xe850('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x4db31f,_0x18a27f);_0x3666b1(_0x18a27f);});});} \ No newline at end of file +var _0x9e7e=['rpc','../../config/environment','jayson/promise','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3db97b,_0x3fdb22){var _0x362c74=function(_0xf56b){while(--_0xf56b){_0x3db97b['push'](_0x3db97b['shift']());}};_0x362c74(++_0x3fdb22);}(_0x9e7e,0x16d));var _0xe9e7=function(_0x205e5b,_0x3d9293){_0x205e5b=_0x205e5b-0x0;var _0x2e60db=_0x9e7e[_0x205e5b];return _0x2e60db;};'use strict';var _=require(_0xe9e7('0x0'));var util=require(_0xe9e7('0x1'));var moment=require(_0xe9e7('0x2'));var BPromise=require(_0xe9e7('0x3'));var rs=require(_0xe9e7('0x4'));var fs=require('fs');var Redis=require(_0xe9e7('0x5'));var db=require(_0xe9e7('0x6'))['db'];var utils=require(_0xe9e7('0x7'));var logger=require(_0xe9e7('0x8'))(_0xe9e7('0x9'));var config=require(_0xe9e7('0xa'));var jayson=require(_0xe9e7('0xb'));var client=jayson['client'][_0xe9e7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4cac51,_0x217b23,_0x5f1c9b){return new BPromise(function(_0x4ad0bf,_0xd79c8b){return client[_0xe9e7('0xd')](_0x4cac51,_0x5f1c9b)['then'](function(_0x4d14c5){logger[_0xe9e7('0xe')](_0xe9e7('0xf'),_0x217b23,'request\x20sent');logger[_0xe9e7('0x10')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x217b23,_0xe9e7('0x11'),JSON[_0xe9e7('0x12')](_0x4d14c5));if(_0x4d14c5['error']){if(_0x4d14c5[_0xe9e7('0x13')]['code']===0x1f4){logger[_0xe9e7('0x13')](_0xe9e7('0xf'),_0x217b23,_0x4d14c5[_0xe9e7('0x13')][_0xe9e7('0x14')]);return _0xd79c8b(_0x4d14c5[_0xe9e7('0x13')][_0xe9e7('0x14')]);}logger[_0xe9e7('0x13')](_0xe9e7('0xf'),_0x217b23,_0x4d14c5[_0xe9e7('0x13')][_0xe9e7('0x14')]);return _0x4ad0bf(_0x4d14c5[_0xe9e7('0x13')][_0xe9e7('0x14')]);}else{logger[_0xe9e7('0xe')](_0xe9e7('0xf'),_0x217b23,_0xe9e7('0x11'));_0x4ad0bf(_0x4d14c5['result'][_0xe9e7('0x14')]);}})[_0xe9e7('0x15')](function(_0x1c2433){logger[_0xe9e7('0x13')](_0xe9e7('0xf'),_0x217b23,_0x1c2433);_0xd79c8b(_0x1c2433);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 60978f1..3be1436 100644 --- a/server/api/intDynamics365Field/index.js +++ b/server/api/intDynamics365Field/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7c8=['Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x5c986d,_0x117755){var _0x18a0c9=function(_0x215d6c){while(--_0x215d6c){_0x5c986d['push'](_0x5c986d['shift']());}};_0x18a0c9(++_0x117755);}(_0xb7c8,0x119));var _0x8b7c=function(_0x500216,_0x5f441c){_0x500216=_0x500216-0x0;var _0x18f85b=_0xb7c8[_0x500216];return _0x18f85b;};'use strict';var multer=require('multer');var util=require(_0x8b7c('0x0'));var path=require(_0x8b7c('0x1'));var timeout=require(_0x8b7c('0x2'));var express=require(_0x8b7c('0x3'));var router=express[_0x8b7c('0x4')]();var auth=require(_0x8b7c('0x5'));var interaction=require(_0x8b7c('0x6'));var config=require('../../config/environment');var controller=require(_0x8b7c('0x7'));router[_0x8b7c('0x8')]('/',auth[_0x8b7c('0x9')](),controller[_0x8b7c('0xa')]);router[_0x8b7c('0x8')](_0x8b7c('0xb'),auth[_0x8b7c('0x9')](),controller[_0x8b7c('0xc')]);router[_0x8b7c('0xd')]('/',auth[_0x8b7c('0x9')](),controller[_0x8b7c('0xe')]);router[_0x8b7c('0xf')]('/:id',auth[_0x8b7c('0x9')](),controller['update']);router[_0x8b7c('0x10')](_0x8b7c('0xb'),auth['isAuthenticated'](),controller[_0x8b7c('0x11')]);module[_0x8b7c('0x12')]=router; \ No newline at end of file +var _0xbe02=['/:id','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0xb3b452,_0x582e8e){var _0x238983=function(_0x3bc866){while(--_0x3bc866){_0xb3b452['push'](_0xb3b452['shift']());}};_0x238983(++_0x582e8e);}(_0xbe02,0x146));var _0x2be0=function(_0x3bb949,_0x3caa7a){_0x3bb949=_0x3bb949-0x0;var _0x421bb7=_0xbe02[_0x3bb949];return _0x421bb7;};'use strict';var multer=require(_0x2be0('0x0'));var util=require(_0x2be0('0x1'));var path=require(_0x2be0('0x2'));var timeout=require(_0x2be0('0x3'));var express=require('express');var router=express[_0x2be0('0x4')]();var auth=require(_0x2be0('0x5'));var interaction=require(_0x2be0('0x6'));var config=require(_0x2be0('0x7'));var controller=require(_0x2be0('0x8'));router[_0x2be0('0x9')]('/',auth[_0x2be0('0xa')](),controller[_0x2be0('0xb')]);router[_0x2be0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x2be0('0xc')]);router[_0x2be0('0xd')]('/',auth[_0x2be0('0xa')](),controller[_0x2be0('0xe')]);router[_0x2be0('0xf')](_0x2be0('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2be0('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 85a8e22..e21c297 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.attributes.js +++ b/server/api/intDynamics365Field/intDynamics365Field.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd3c6=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x3b4985,_0x266e54){var _0x4b3235=function(_0x119342){while(--_0x119342){_0x3b4985['push'](_0x3b4985['shift']());}};_0x4b3235(++_0x266e54);}(_0xd3c6,0x121));var _0x6d3c=function(_0x914326,_0x16d6b5){_0x914326=_0x914326-0x0;var _0x1855d0=_0xd3c6[_0x914326];return _0x1855d0;};'use strict';var Sequelize=require(_0x6d3c('0x0'));module[_0x6d3c('0x1')]={'type':{'type':Sequelize[_0x6d3c('0x2')](_0x6d3c('0x3'),_0x6d3c('0x4'),_0x6d3c('0x5'),_0x6d3c('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6d3c('0x7')]},'key':{'type':Sequelize[_0x6d3c('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x6d3c('0x3'),_0x6d3c('0x4'),_0x6d3c('0x5'))},'keyContent':{'type':Sequelize[_0x6d3c('0x7')]},'idField':{'type':Sequelize[_0x6d3c('0x7')]},'nameField':{'type':Sequelize[_0x6d3c('0x7')]},'customField':{'type':Sequelize[_0x6d3c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6d3c('0x7')]}}; \ No newline at end of file +var _0xb7e9=['keyValue','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable'];(function(_0x5ba9d2,_0x802c3c){var _0x151e37=function(_0x5dc950){while(--_0x5dc950){_0x5ba9d2['push'](_0x5ba9d2['shift']());}};_0x151e37(++_0x802c3c);}(_0xb7e9,0x67));var _0x9b7e=function(_0x4c82af,_0x5ca362){_0x4c82af=_0x4c82af-0x0;var _0x260354=_0xb7e9[_0x4c82af];return _0x260354;};'use strict';var Sequelize=require(_0x9b7e('0x0'));module[_0x9b7e('0x1')]={'type':{'type':Sequelize[_0x9b7e('0x2')](_0x9b7e('0x3'),'variable',_0x9b7e('0x4'),_0x9b7e('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9b7e('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x9b7e('0x3'),_0x9b7e('0x7'),_0x9b7e('0x4'))},'keyContent':{'type':Sequelize[_0x9b7e('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9b7e('0x6')]},'customField':{'type':Sequelize[_0x9b7e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9b7e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 38379e6..0ca80b7 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.controller.js +++ b/server/api/intDynamics365Field/intDynamics365Field.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5147=['key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','length','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','apply','reject','update','then','error','stack','name','send','index','Dynamics365Field','rawAttributes','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5147,0x191));var _0x7514=function(_0x1f9b3f,_0x4036e1){_0x1f9b3f=_0x1f9b3f-0x0;var _0x4d046d=_0x5147[_0x1f9b3f];return _0x4d046d;};'use strict';var pdf=require(_0x7514('0x0'));var emlformat=require(_0x7514('0x1'));var rimraf=require(_0x7514('0x2'));var zipdir=require(_0x7514('0x3'));var jsonpatch=require(_0x7514('0x4'));var rp=require(_0x7514('0x5'));var moment=require(_0x7514('0x6'));var BPromise=require(_0x7514('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7514('0x8'));var sox=require('sox');var csv=require(_0x7514('0x9'));var ejs=require(_0x7514('0xa'));var fs=require('fs');var _=require(_0x7514('0xb'));var squel=require(_0x7514('0xc'));var crypto=require(_0x7514('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7514('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7514('0xf'));var Redis=require(_0x7514('0x10'));var authService=require(_0x7514('0x11'));var qs=require(_0x7514('0x12'));var as=require(_0x7514('0x13'));var hardwareService=require(_0x7514('0x14'));var logger=require(_0x7514('0x15'))(_0x7514('0x16'));var utils=require('../../config/utils');var config=require(_0x7514('0x17'));var db=require(_0x7514('0x18'))['db'];function respondWithStatusCode(_0x1cc9ae,_0x432d03){_0x432d03=_0x432d03||0xcc;return function(_0x26a8ca){if(_0x26a8ca){return _0x1cc9ae[_0x7514('0x19')](_0x432d03);}return _0x1cc9ae[_0x7514('0x1a')](_0x432d03)[_0x7514('0x1b')]();};}function respondWithResult(_0x119415,_0x4546a6){_0x4546a6=_0x4546a6||0xc8;return function(_0x43c7ac){if(_0x43c7ac){return _0x119415[_0x7514('0x1a')](_0x4546a6)[_0x7514('0x1c')](_0x43c7ac);}};}function respondWithFilteredResult(_0x4201bc,_0x2d6e12){return function(_0x231080){if(_0x231080){var _0x276908=_0x231080['count'],_0x5d7741=_0x2d6e12[_0x7514('0x1d')],_0x57fe61=_0x2d6e12[_0x7514('0x1d')]+_0x2d6e12['limit'],_0x263882;if(_0x57fe61>=_0x276908){_0x57fe61=_0x276908;_0x263882=0xc8;}else{_0x263882=0xce;}_0x4201bc[_0x7514('0x1a')](_0x263882);return _0x4201bc[_0x7514('0x1e')]('Content-Range',_0x5d7741+'-'+_0x57fe61+'/'+_0x276908)[_0x7514('0x1c')](_0x231080);}return null;};}function patchUpdates(_0x52f9da){return function(_0x3ec916){try{jsonpatch[_0x7514('0x1f')](_0x3ec916,_0x52f9da,!![]);}catch(_0xf9010){return BPromise[_0x7514('0x20')](_0xf9010);}return _0x3ec916['save']();};}function saveUpdates(_0x20f447,_0x466a0d){return function(_0x31917b){if(_0x31917b){return _0x31917b[_0x7514('0x21')](_0x20f447)[_0x7514('0x22')](function(_0x43a98b){return _0x43a98b;});}return null;};}function removeEntity(_0x2b3967,_0x26233f){return function(_0x331c83){if(_0x331c83){return _0x331c83['destroy']()['then'](function(){_0x2b3967[_0x7514('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7976e0,_0x4b853f){return function(_0x4f2592){if(!_0x4f2592){_0x7976e0[_0x7514('0x19')](0x194);}return _0x4f2592;};}function handleError(_0x54aeeb,_0x3a14bf){_0x3a14bf=_0x3a14bf||0x1f4;return function(_0x1742c7){logger[_0x7514('0x23')](_0x1742c7[_0x7514('0x24')]);if(_0x1742c7['name']){delete _0x1742c7[_0x7514('0x25')];}_0x54aeeb['status'](_0x3a14bf)[_0x7514('0x26')](_0x1742c7);};}exports[_0x7514('0x27')]=function(_0x2d05e5,_0x106983){var _0x6a1474={},_0x3613be={},_0x4926d8={'count':0x0,'rows':[]};var _0x1663fa=_['map'](db[_0x7514('0x28')][_0x7514('0x29')],function(_0x1664d2){return{'name':_0x1664d2['fieldName'],'type':_0x1664d2[_0x7514('0x2a')][_0x7514('0x2b')]};});_0x3613be[_0x7514('0x2c')]=_[_0x7514('0x2d')](_0x1663fa,_0x7514('0x25'));_0x3613be[_0x7514('0x2e')]=_[_0x7514('0x2f')](_0x2d05e5['query']);_0x3613be[_0x7514('0x30')]=_[_0x7514('0x31')](_0x3613be[_0x7514('0x2c')],_0x3613be[_0x7514('0x2e')]);_0x6a1474[_0x7514('0x32')]=_[_0x7514('0x31')](_0x3613be[_0x7514('0x2c')],qs[_0x7514('0x33')](_0x2d05e5[_0x7514('0x2e')][_0x7514('0x33')]));_0x6a1474['attributes']=_0x6a1474[_0x7514('0x32')]['length']?_0x6a1474[_0x7514('0x32')]:_0x3613be['model'];if(!_0x2d05e5[_0x7514('0x2e')][_0x7514('0x34')](_0x7514('0x35'))){_0x6a1474[_0x7514('0x36')]=qs[_0x7514('0x36')](_0x2d05e5['query']['limit']);_0x6a1474['offset']=qs[_0x7514('0x1d')](_0x2d05e5['query'][_0x7514('0x1d')]);}_0x6a1474[_0x7514('0x37')]=qs[_0x7514('0x38')](_0x2d05e5[_0x7514('0x2e')][_0x7514('0x38')]);_0x6a1474[_0x7514('0x39')]=qs[_0x7514('0x30')](_[_0x7514('0x3a')](_0x2d05e5['query'],_0x3613be['filters']),_0x1663fa);if(_0x2d05e5[_0x7514('0x2e')][_0x7514('0x3b')]){_0x6a1474['where']=_[_0x7514('0x3c')](_0x6a1474[_0x7514('0x39')],{'$or':_[_0x7514('0x2d')](_0x1663fa,function(_0x3a7d27){if(_0x3a7d27['type']!==_0x7514('0x3d')){var _0x6d0752={};_0x6d0752[_0x3a7d27[_0x7514('0x25')]]={'$like':'%'+_0x2d05e5['query'][_0x7514('0x3b')]+'%'};return _0x6d0752;}})});}_0x6a1474=_[_0x7514('0x3c')]({},_0x6a1474,_0x2d05e5['options']);var _0x59e006={'where':_0x6a1474['where']};return db[_0x7514('0x28')][_0x7514('0x3e')](_0x59e006)[_0x7514('0x22')](function(_0x2cc819){_0x4926d8[_0x7514('0x3e')]=_0x2cc819;if(_0x2d05e5[_0x7514('0x2e')][_0x7514('0x3f')]){_0x6a1474[_0x7514('0x40')]=[{'all':!![]}];}return db[_0x7514('0x28')][_0x7514('0x41')](_0x6a1474);})[_0x7514('0x22')](function(_0x5fcd3f){_0x4926d8[_0x7514('0x42')]=_0x5fcd3f;return _0x4926d8;})[_0x7514('0x22')](respondWithFilteredResult(_0x106983,_0x6a1474))[_0x7514('0x43')](handleError(_0x106983,null));};exports['show']=function(_0xa52f9e,_0xbace91){var _0x3e860c={'raw':!![],'where':{'id':_0xa52f9e[_0x7514('0x44')]['id']}},_0x58c11e={};_0x58c11e[_0x7514('0x2c')]=_[_0x7514('0x2f')](db[_0x7514('0x28')][_0x7514('0x29')]);_0x58c11e['query']=_[_0x7514('0x2f')](_0xa52f9e['query']);_0x58c11e[_0x7514('0x30')]=_[_0x7514('0x31')](_0x58c11e[_0x7514('0x2c')],_0x58c11e['query']);_0x3e860c[_0x7514('0x32')]=_[_0x7514('0x31')](_0x58c11e['model'],qs['fields'](_0xa52f9e[_0x7514('0x2e')][_0x7514('0x33')]));_0x3e860c[_0x7514('0x32')]=_0x3e860c['attributes'][_0x7514('0x45')]?_0x3e860c[_0x7514('0x32')]:_0x58c11e[_0x7514('0x2c')];if(_0xa52f9e[_0x7514('0x2e')][_0x7514('0x3f')]){_0x3e860c[_0x7514('0x40')]=[{'all':!![]}];}_0x3e860c=_['merge']({},_0x3e860c,_0xa52f9e['options']);return db[_0x7514('0x28')][_0x7514('0x46')](_0x3e860c)[_0x7514('0x22')](handleEntityNotFound(_0xbace91,null))[_0x7514('0x22')](respondWithResult(_0xbace91,null))['catch'](handleError(_0xbace91,null));};exports[_0x7514('0x47')]=function(_0x23bba9,_0x48126c){return db['Dynamics365Field']['create'](_0x23bba9[_0x7514('0x48')],{})[_0x7514('0x22')](respondWithResult(_0x48126c,0xc9))['catch'](handleError(_0x48126c,null));};exports['update']=function(_0x479e1e,_0x35d950){if(_0x479e1e['body']['id']){delete _0x479e1e[_0x7514('0x48')]['id'];}return db[_0x7514('0x28')][_0x7514('0x46')]({'where':{'id':_0x479e1e[_0x7514('0x44')]['id']}})[_0x7514('0x22')](handleEntityNotFound(_0x35d950,null))['then'](saveUpdates(_0x479e1e['body'],null))[_0x7514('0x22')](respondWithResult(_0x35d950,null))[_0x7514('0x43')](handleError(_0x35d950,null));};exports[_0x7514('0x49')]=function(_0x44a6c2,_0x5f584a){return db[_0x7514('0x28')]['find']({'where':{'id':_0x44a6c2[_0x7514('0x44')]['id']}})[_0x7514('0x22')](handleEntityNotFound(_0x5f584a,null))[_0x7514('0x22')](removeEntity(_0x5f584a,null))[_0x7514('0x43')](handleError(_0x5f584a,null));}; \ No newline at end of file +var _0x11f7=['include','findAll','rows','catch','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','Dynamics365Field','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','count','includeAll'];(function(_0x3933cf,_0x4e07b3){var _0x46e6c9=function(_0xc69c9c){while(--_0xc69c9c){_0x3933cf['push'](_0x3933cf['shift']());}};_0x46e6c9(++_0x4e07b3);}(_0x11f7,0xda));var _0x711f=function(_0x32e82a,_0x588a72){_0x32e82a=_0x32e82a-0x0;var _0x33841d=_0x11f7[_0x32e82a];return _0x33841d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x711f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x711f('0x1'));var jsonpatch=require(_0x711f('0x2'));var rp=require(_0x711f('0x3'));var moment=require('moment');var BPromise=require(_0x711f('0x4'));var Mustache=require(_0x711f('0x5'));var util=require('util');var path=require(_0x711f('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x711f('0x7'));var fs=require('fs');var _=require(_0x711f('0x8'));var squel=require('squel');var crypto=require(_0x711f('0x9'));var jsforce=require(_0x711f('0xa'));var deskjs=require(_0x711f('0xb'));var toCsv=require(_0x711f('0xc'));var querystring=require(_0x711f('0xd'));var Papa=require('papaparse');var Redis=require(_0x711f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x711f('0xf'));var as=require(_0x711f('0x10'));var hardwareService=require(_0x711f('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x711f('0x12'));var db=require(_0x711f('0x13'))['db'];function respondWithStatusCode(_0x2a9872,_0x30af98){_0x30af98=_0x30af98||0xcc;return function(_0x1bf550){if(_0x1bf550){return _0x2a9872[_0x711f('0x14')](_0x30af98);}return _0x2a9872['status'](_0x30af98)[_0x711f('0x15')]();};}function respondWithResult(_0x5f5d97,_0x3d7d07){_0x3d7d07=_0x3d7d07||0xc8;return function(_0x2cad23){if(_0x2cad23){return _0x5f5d97[_0x711f('0x16')](_0x3d7d07)[_0x711f('0x17')](_0x2cad23);}};}function respondWithFilteredResult(_0x540dc8,_0x3580cc){return function(_0x3e4216){if(_0x3e4216){var _0x49a9d2=_0x3e4216['count'],_0x619787=_0x3580cc['offset'],_0x2f0928=_0x3580cc[_0x711f('0x18')]+_0x3580cc['limit'],_0x21f474;if(_0x2f0928>=_0x49a9d2){_0x2f0928=_0x49a9d2;_0x21f474=0xc8;}else{_0x21f474=0xce;}_0x540dc8['status'](_0x21f474);return _0x540dc8[_0x711f('0x19')](_0x711f('0x1a'),_0x619787+'-'+_0x2f0928+'/'+_0x49a9d2)[_0x711f('0x17')](_0x3e4216);}return null;};}function patchUpdates(_0x2b56cd){return function(_0x459a0d){try{jsonpatch[_0x711f('0x1b')](_0x459a0d,_0x2b56cd,!![]);}catch(_0x9b2ba2){return BPromise[_0x711f('0x1c')](_0x9b2ba2);}return _0x459a0d['save']();};}function saveUpdates(_0x44fb1a,_0x331ee3){return function(_0x1f384b){if(_0x1f384b){return _0x1f384b[_0x711f('0x1d')](_0x44fb1a)[_0x711f('0x1e')](function(_0x544f37){return _0x544f37;});}return null;};}function removeEntity(_0x20c83d,_0xccdd66){return function(_0x34914e){if(_0x34914e){return _0x34914e[_0x711f('0x1f')]()[_0x711f('0x1e')](function(){_0x20c83d[_0x711f('0x16')](0xcc)[_0x711f('0x15')]();});}};}function handleEntityNotFound(_0x378bd4,_0x59ed0c){return function(_0x590b0d){if(!_0x590b0d){_0x378bd4[_0x711f('0x14')](0x194);}return _0x590b0d;};}function handleError(_0x21b694,_0x3723bf){_0x3723bf=_0x3723bf||0x1f4;return function(_0x3c9dbd){logger[_0x711f('0x20')](_0x3c9dbd['stack']);if(_0x3c9dbd['name']){delete _0x3c9dbd[_0x711f('0x21')];}_0x21b694['status'](_0x3723bf)[_0x711f('0x22')](_0x3c9dbd);};}exports[_0x711f('0x23')]=function(_0x31a25b,_0x227f69){var _0x291687={},_0xa03171={},_0x4e7247={'count':0x0,'rows':[]};var _0x474040=_['map'](db[_0x711f('0x24')][_0x711f('0x25')],function(_0x531f36){return{'name':_0x531f36[_0x711f('0x26')],'type':_0x531f36[_0x711f('0x27')][_0x711f('0x28')]};});_0xa03171['model']=_[_0x711f('0x29')](_0x474040,'name');_0xa03171[_0x711f('0x2a')]=_[_0x711f('0x2b')](_0x31a25b[_0x711f('0x2a')]);_0xa03171[_0x711f('0x2c')]=_[_0x711f('0x2d')](_0xa03171[_0x711f('0x2e')],_0xa03171[_0x711f('0x2a')]);_0x291687[_0x711f('0x2f')]=_[_0x711f('0x2d')](_0xa03171['model'],qs[_0x711f('0x30')](_0x31a25b[_0x711f('0x2a')][_0x711f('0x30')]));_0x291687['attributes']=_0x291687[_0x711f('0x2f')][_0x711f('0x31')]?_0x291687[_0x711f('0x2f')]:_0xa03171['model'];if(!_0x31a25b['query'][_0x711f('0x32')](_0x711f('0x33'))){_0x291687[_0x711f('0x34')]=qs[_0x711f('0x34')](_0x31a25b[_0x711f('0x2a')][_0x711f('0x34')]);_0x291687[_0x711f('0x18')]=qs[_0x711f('0x18')](_0x31a25b['query'][_0x711f('0x18')]);}_0x291687[_0x711f('0x35')]=qs['sort'](_0x31a25b[_0x711f('0x2a')][_0x711f('0x36')]);_0x291687[_0x711f('0x37')]=qs[_0x711f('0x2c')](_[_0x711f('0x38')](_0x31a25b['query'],_0xa03171['filters']),_0x474040);if(_0x31a25b[_0x711f('0x2a')]['filter']){_0x291687[_0x711f('0x37')]=_[_0x711f('0x39')](_0x291687['where'],{'$or':_[_0x711f('0x29')](_0x474040,function(_0x442db4){if(_0x442db4[_0x711f('0x27')]!==_0x711f('0x3a')){var _0x2d61dd={};_0x2d61dd[_0x442db4[_0x711f('0x21')]]={'$like':'%'+_0x31a25b[_0x711f('0x2a')][_0x711f('0x3b')]+'%'};return _0x2d61dd;}})});}_0x291687=_['merge']({},_0x291687,_0x31a25b['options']);var _0x2c67a1={'where':_0x291687[_0x711f('0x37')]};return db['Dynamics365Field'][_0x711f('0x3c')](_0x2c67a1)[_0x711f('0x1e')](function(_0x1c8c13){_0x4e7247[_0x711f('0x3c')]=_0x1c8c13;if(_0x31a25b['query'][_0x711f('0x3d')]){_0x291687[_0x711f('0x3e')]=[{'all':!![]}];}return db[_0x711f('0x24')][_0x711f('0x3f')](_0x291687);})['then'](function(_0x1a698e){_0x4e7247[_0x711f('0x40')]=_0x1a698e;return _0x4e7247;})['then'](respondWithFilteredResult(_0x227f69,_0x291687))[_0x711f('0x41')](handleError(_0x227f69,null));};exports['show']=function(_0x574efe,_0x4c6e31){var _0x147d03={'raw':!![],'where':{'id':_0x574efe[_0x711f('0x42')]['id']}},_0x590e70={};_0x590e70['model']=_['keys'](db['Dynamics365Field'][_0x711f('0x25')]);_0x590e70['query']=_[_0x711f('0x2b')](_0x574efe[_0x711f('0x2a')]);_0x590e70[_0x711f('0x2c')]=_[_0x711f('0x2d')](_0x590e70['model'],_0x590e70['query']);_0x147d03['attributes']=_[_0x711f('0x2d')](_0x590e70['model'],qs[_0x711f('0x30')](_0x574efe[_0x711f('0x2a')][_0x711f('0x30')]));_0x147d03['attributes']=_0x147d03[_0x711f('0x2f')][_0x711f('0x31')]?_0x147d03[_0x711f('0x2f')]:_0x590e70['model'];if(_0x574efe[_0x711f('0x2a')][_0x711f('0x3d')]){_0x147d03[_0x711f('0x3e')]=[{'all':!![]}];}_0x147d03=_[_0x711f('0x39')]({},_0x147d03,_0x574efe['options']);return db[_0x711f('0x24')][_0x711f('0x43')](_0x147d03)[_0x711f('0x1e')](handleEntityNotFound(_0x4c6e31,null))[_0x711f('0x1e')](respondWithResult(_0x4c6e31,null))[_0x711f('0x41')](handleError(_0x4c6e31,null));};exports[_0x711f('0x44')]=function(_0x462096,_0x55255a){return db[_0x711f('0x24')][_0x711f('0x44')](_0x462096['body'],{})[_0x711f('0x1e')](respondWithResult(_0x55255a,0xc9))[_0x711f('0x41')](handleError(_0x55255a,null));};exports[_0x711f('0x1d')]=function(_0x3bcc5c,_0x4049c4){if(_0x3bcc5c[_0x711f('0x45')]['id']){delete _0x3bcc5c[_0x711f('0x45')]['id'];}return db[_0x711f('0x24')][_0x711f('0x43')]({'where':{'id':_0x3bcc5c[_0x711f('0x42')]['id']}})[_0x711f('0x1e')](handleEntityNotFound(_0x4049c4,null))[_0x711f('0x1e')](saveUpdates(_0x3bcc5c['body'],null))['then'](respondWithResult(_0x4049c4,null))[_0x711f('0x41')](handleError(_0x4049c4,null));};exports[_0x711f('0x1f')]=function(_0xb855d,_0x55bdc4){return db[_0x711f('0x24')]['find']({'where':{'id':_0xb855d[_0x711f('0x42')]['id']}})['then'](handleEntityNotFound(_0x55bdc4,null))[_0x711f('0x1e')](removeEntity(_0x55bdc4,null))[_0x711f('0x41')](handleError(_0x55bdc4,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index c583dc9..90ecb6d 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.model.js +++ b/server/api/intDynamics365Field/intDynamics365Field.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf49f=['./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','api','moment','bluebird','path','../../config/environment'];(function(_0x9376c6,_0x3a25dd){var _0x20a7c5=function(_0x5ad284){while(--_0x5ad284){_0x9376c6['push'](_0x9376c6['shift']());}};_0x20a7c5(++_0x3a25dd);}(_0xf49f,0xbe));var _0xff49=function(_0x5130bb,_0x38f6c6){_0x5130bb=_0x5130bb-0x0;var _0x2a1b2b=_0xf49f[_0x5130bb];return _0x2a1b2b;};'use strict';var _=require(_0xff49('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xff49('0x1'));var moment=require(_0xff49('0x2'));var BPromise=require(_0xff49('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xff49('0x4'));var rimraf=require('rimraf');var config=require(_0xff49('0x5'));var attributes=require(_0xff49('0x6'));module[_0xff49('0x7')]=function(_0x5efc90,_0x7b3290){return _0x5efc90[_0xff49('0x8')](_0xff49('0x9'),attributes,{'tableName':_0xff49('0xa'),'paranoid':![],'indexes':[{'name':_0xff49('0xb'),'fields':[_0xff49('0xc'),_0xff49('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xad73=['moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xad73,0x1ac));var _0x3ad7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xad73[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3ad7('0x0'));var util=require(_0x3ad7('0x1'));var logger=require(_0x3ad7('0x2'))(_0x3ad7('0x3'));var moment=require(_0x3ad7('0x4'));var BPromise=require(_0x3ad7('0x5'));var rp=require(_0x3ad7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3ad7('0x7'));var config=require(_0x3ad7('0x8'));var attributes=require(_0x3ad7('0x9'));module[_0x3ad7('0xa')]=function(_0x582ea1,_0x2ad6fd){return _0x582ea1[_0x3ad7('0xb')]('Dynamics365Field',attributes,{'tableName':_0x3ad7('0xc'),'paranoid':![],'indexes':[{'name':_0x3ad7('0xd'),'fields':[_0x3ad7('0xe'),_0x3ad7('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 69a12a4..54c1fe0 100644 --- a/server/api/intDynamics365Field/intDynamics365Field.rpc.js +++ b/server/api/intDynamics365Field/intDynamics365Field.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x82c4=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0x82c4,0x1ca));var _0x482c=function(_0x22e817,_0x289e3c){_0x22e817=_0x22e817-0x0;var _0x1c6b40=_0x82c4[_0x22e817];return _0x1c6b40;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var moment=require(_0x482c('0x2'));var BPromise=require(_0x482c('0x3'));var rs=require(_0x482c('0x4'));var fs=require('fs');var Redis=require(_0x482c('0x5'));var db=require(_0x482c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x482c('0x7'))('rpc');var config=require(_0x482c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x482c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfdb92,_0x32a503,_0x35cdab){return new BPromise(function(_0x1c10f2,_0x3846d8){return client['request'](_0xfdb92,_0x35cdab)[_0x482c('0xa')](function(_0x135cc1){logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));logger[_0x482c('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x32a503,_0x482c('0xd'),JSON[_0x482c('0xf')](_0x135cc1));if(_0x135cc1[_0x482c('0x10')]){if(_0x135cc1['error'][_0x482c('0x11')]===0x1f4){logger[_0x482c('0x10')](_0x482c('0xc'),_0x32a503,_0x135cc1['error']['message']);return _0x3846d8(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x32a503,_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);return _0x1c10f2(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}else{logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));_0x1c10f2(_0x135cc1[_0x482c('0x13')][_0x482c('0x12')]);}})[_0x482c('0x14')](function(_0x363403){logger[_0x482c('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x32a503,_0x363403);_0x3846d8(_0x363403);});});} \ No newline at end of file +var _0xfdcd=['debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent'];(function(_0xd0cd54,_0x613e58){var _0x5f3f4f=function(_0x4fb920){while(--_0x4fb920){_0xd0cd54['push'](_0xd0cd54['shift']());}};_0x5f3f4f(++_0x613e58);}(_0xfdcd,0xe9));var _0xdfdc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfdcd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xdfdc('0x0'));var moment=require(_0xdfdc('0x1'));var BPromise=require(_0xdfdc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdfdc('0x3'));var db=require(_0xdfdc('0x4'))['db'];var utils=require(_0xdfdc('0x5'));var logger=require(_0xdfdc('0x6'))(_0xdfdc('0x7'));var config=require(_0xdfdc('0x8'));var jayson=require(_0xdfdc('0x9'));var client=jayson[_0xdfdc('0xa')][_0xdfdc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f2529,_0x13ab53,_0x18691e){return new BPromise(function(_0xf45350,_0x580fc7){return client[_0xdfdc('0xc')](_0x1f2529,_0x18691e)[_0xdfdc('0xd')](function(_0x4fb1fd){logger[_0xdfdc('0xe')](_0xdfdc('0xf'),_0x13ab53,_0xdfdc('0x10'));logger[_0xdfdc('0x11')](_0xdfdc('0x12'),_0x13ab53,'request\x20sent',JSON[_0xdfdc('0x13')](_0x4fb1fd));if(_0x4fb1fd['error']){if(_0x4fb1fd['error'][_0xdfdc('0x14')]===0x1f4){logger[_0xdfdc('0x15')](_0xdfdc('0xf'),_0x13ab53,_0x4fb1fd[_0xdfdc('0x15')][_0xdfdc('0x16')]);return _0x580fc7(_0x4fb1fd[_0xdfdc('0x15')][_0xdfdc('0x16')]);}logger['error'](_0xdfdc('0xf'),_0x13ab53,_0x4fb1fd[_0xdfdc('0x15')][_0xdfdc('0x16')]);return _0xf45350(_0x4fb1fd['error'][_0xdfdc('0x16')]);}else{logger[_0xdfdc('0xe')](_0xdfdc('0xf'),_0x13ab53,'request\x20sent');_0xf45350(_0x4fb1fd[_0xdfdc('0x17')]['message']);}})[_0xdfdc('0x18')](function(_0x36aae5){logger['error'](_0xdfdc('0xf'),_0x13ab53,_0x36aae5);_0x580fc7(_0x36aae5);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index b2113d6..e03ce6e 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 _0x3f60=['/:id/fields','post','create','/:id/configurations','put','update','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','/:id','isAuthenticated','show','getConfigurations'];(function(_0x1a78e9,_0x1e5ae9){var _0x4f9236=function(_0x345ba6){while(--_0x345ba6){_0x1a78e9['push'](_0x1a78e9['shift']());}};_0x4f9236(++_0x1e5ae9);}(_0x3f60,0x12f));var _0x03f6=function(_0x6465b0,_0x45653a){_0x6465b0=_0x6465b0-0x0;var _0x4884fe=_0x3f60[_0x6465b0];return _0x4884fe;};'use strict';var multer=require(_0x03f6('0x0'));var util=require('util');var path=require(_0x03f6('0x1'));var timeout=require(_0x03f6('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x03f6('0x3'));var interaction=require(_0x03f6('0x4'));var config=require(_0x03f6('0x5'));var controller=require(_0x03f6('0x6'));router[_0x03f6('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x03f6('0x7')](_0x03f6('0x8'),auth[_0x03f6('0x9')](),controller[_0x03f6('0xa')]);router[_0x03f6('0x7')]('/:id/configurations',auth[_0x03f6('0x9')](),controller[_0x03f6('0xb')]);router[_0x03f6('0x7')](_0x03f6('0xc'),auth[_0x03f6('0x9')](),controller['getFields']);router[_0x03f6('0xd')]('/',auth[_0x03f6('0x9')](),controller[_0x03f6('0xe')]);router[_0x03f6('0xd')](_0x03f6('0xf'),auth[_0x03f6('0x9')](),controller['addConfiguration']);router[_0x03f6('0x10')](_0x03f6('0x8'),auth[_0x03f6('0x9')](),controller[_0x03f6('0x11')]);router[_0x03f6('0x12')](_0x03f6('0x8'),auth[_0x03f6('0x9')](),controller[_0x03f6('0x13')]);module[_0x03f6('0x14')]=router; \ No newline at end of file +var _0x4bae=['getFields','post','create','put','update','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x5b2433,_0x55e16e){var _0x43dfe0=function(_0x41bc6c){while(--_0x41bc6c){_0x5b2433['push'](_0x5b2433['shift']());}};_0x43dfe0(++_0x55e16e);}(_0x4bae,0x152));var _0xe4ba=function(_0x31991b,_0xaf75d2){_0x31991b=_0x31991b-0x0;var _0x307304=_0x4bae[_0x31991b];return _0x307304;};'use strict';var multer=require(_0xe4ba('0x0'));var util=require(_0xe4ba('0x1'));var path=require(_0xe4ba('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe4ba('0x3')]();var auth=require(_0xe4ba('0x4'));var interaction=require(_0xe4ba('0x5'));var config=require('../../config/environment');var controller=require(_0xe4ba('0x6'));router[_0xe4ba('0x7')]('/',auth[_0xe4ba('0x8')](),controller[_0xe4ba('0x9')]);router[_0xe4ba('0x7')]('/:id',auth[_0xe4ba('0x8')](),controller[_0xe4ba('0xa')]);router['get'](_0xe4ba('0xb'),auth[_0xe4ba('0x8')](),controller[_0xe4ba('0xc')]);router[_0xe4ba('0x7')](_0xe4ba('0xd'),auth[_0xe4ba('0x8')](),controller[_0xe4ba('0xe')]);router[_0xe4ba('0xf')]('/',auth[_0xe4ba('0x8')](),controller[_0xe4ba('0x10')]);router[_0xe4ba('0xf')](_0xe4ba('0xb'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xe4ba('0x11')]('/:id',auth[_0xe4ba('0x8')](),controller[_0xe4ba('0x12')]);router['delete'](_0xe4ba('0x13'),auth[_0xe4ba('0x8')](),controller[_0xe4ba('0x14')]);module[_0xe4ba('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 818ceb5..0934167 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 _0x4cb5=['STRING','username','remoteUri','sequelize','exports'];(function(_0x506381,_0x1c51bb){var _0x149505=function(_0x20f615){while(--_0x20f615){_0x506381['push'](_0x506381['shift']());}};_0x149505(++_0x1c51bb);}(_0x4cb5,0x8f));var _0x54cb=function(_0x120801,_0x2e5aa0){_0x120801=_0x120801-0x0;var _0x401e55=_0x4cb5[_0x120801];return _0x401e55;};'use strict';var Sequelize=require(_0x54cb('0x0'));module[_0x54cb('0x1')]={'name':{'type':Sequelize[_0x54cb('0x2')]},'description':{'type':Sequelize[_0x54cb('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x54cb('0x3')},'apiKey':{'type':Sequelize[_0x54cb('0x2')]},'remoteUri':{'type':Sequelize[_0x54cb('0x2')],'unique':_0x54cb('0x4')},'serverUrl':{'type':Sequelize[_0x54cb('0x2')]}}; \ No newline at end of file +var _0x9666=['STRING','username','sequelize','exports'];(function(_0x148055,_0x10ebf9){var _0x1abbee=function(_0x1f4809){while(--_0x1f4809){_0x148055['push'](_0x148055['shift']());}};_0x1abbee(++_0x10ebf9);}(_0x9666,0x17a));var _0x6966=function(_0x5bc792,_0x362580){_0x5bc792=_0x5bc792-0x0;var _0x4a1970=_0x9666[_0x5bc792];return _0x4a1970;};'use strict';var Sequelize=require(_0x6966('0x0'));module[_0x6966('0x1')]={'name':{'type':Sequelize[_0x6966('0x2')]},'description':{'type':Sequelize[_0x6966('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6966('0x3')},'apiKey':{'type':Sequelize[_0x6966('0x2')]},'remoteUri':{'type':Sequelize[_0x6966('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index d413e16..d780043 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 _0x7217=['Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','source','ticket_type','group','remove','includes','default','custom_text','custom_dropdown','label','capitalize','statusCode','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','merge','map','VIRTUAL','options','FreshdeskAccount','include','findAll','catch','params','rawAttributes','includeAll','find','create','body','update','getConfigurations','FreshdeskConfiguration','filter','nolimit','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields'];(function(_0x2d9f8f,_0x40bc79){var _0x240df4=function(_0x397d13){while(--_0x397d13){_0x2d9f8f['push'](_0x2d9f8f['shift']());}};_0x240df4(++_0x40bc79);}(_0x7217,0x19e));var _0x7721=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x7217[_0x4fc9e6];return _0x551d28;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x9'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var db=require(_0x7721('0x1a'))['db'];var integrations=require(_0x7721('0x1b'));var jayson=require('jayson/promise');var client=jayson[_0x7721('0x1c')][_0x7721('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x57ff6d,_0x109900,_0x30da54){if(_0x30da54){var _0x3f01c5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3f01c5[_0x7721('0x1e')](_0x109900)){return _0x57ff6d;}else{throw new db['Sequelize'][(_0x7721('0x1f'))](_0x7721('0x20'));}}else{return _0x57ff6d;}}function respondWithRpcPromise(_0x534f1b,_0x4e199a,_0x4b183e,_0x5ed54){return new BPromise(function(_0x25a628,_0x3cc909){var _0x32550d=_0x5ed54||client;return _0x32550d['request'](_0x534f1b,_0x4b183e)[_0x7721('0x21')](function(_0x54a838){logger[_0x7721('0x22')]('FreshdeskAccount,\x20%s,\x20%s',_0x4e199a,_0x7721('0x23'));logger[_0x7721('0x24')](_0x7721('0x25'),_0x4e199a,_0x7721('0x23'),JSON[_0x7721('0x26')](_0x54a838));if(_0x54a838[_0x7721('0x27')]){if(_0x54a838[_0x7721('0x27')][_0x7721('0x28')]===0x1f4){logger[_0x7721('0x27')](_0x7721('0x29'),_0x4e199a,_0x54a838['error'][_0x7721('0x2a')]);return _0x3cc909(_0x54a838[_0x7721('0x27')][_0x7721('0x2a')]);}logger[_0x7721('0x27')]('FreshdeskAccount,\x20%s,\x20%s',_0x4e199a,_0x54a838[_0x7721('0x27')]['message']);return _0x25a628(_0x54a838[_0x7721('0x27')][_0x7721('0x2a')]);}else{logger[_0x7721('0x22')](_0x7721('0x29'),_0x4e199a,_0x7721('0x23'));_0x25a628(_0x54a838[_0x7721('0x2b')][_0x7721('0x2a')]);}})['catch'](function(_0x216f20){logger[_0x7721('0x27')](_0x7721('0x29'),_0x4e199a,_0x216f20);_0x3cc909(_0x216f20);});});}function respondWithStatusCode(_0x1f67c7,_0x40d550){_0x40d550=_0x40d550||0xcc;return function(_0x16355a){if(_0x16355a){return _0x1f67c7[_0x7721('0x2c')](_0x40d550);}return _0x1f67c7[_0x7721('0x2d')](_0x40d550)[_0x7721('0x2e')]();};}function respondWithResult(_0x52316e,_0x258ddf){_0x258ddf=_0x258ddf||0xc8;return function(_0x5b0551){if(_0x5b0551){return _0x52316e['status'](_0x258ddf)[_0x7721('0x2f')](_0x5b0551);}};}function respondWithFilteredResult(_0x343c19,_0x53c904){return function(_0x158d98){if(_0x158d98){var _0x1ea4d=_0x158d98['count'],_0x37b9f0=_0x53c904[_0x7721('0x30')],_0xd7d703=_0x53c904[_0x7721('0x30')]+_0x53c904['limit'],_0x1da2d8;if(_0xd7d703>=_0x1ea4d){_0xd7d703=_0x1ea4d;_0x1da2d8=0xc8;}else{_0x1da2d8=0xce;}_0x343c19['status'](_0x1da2d8);return _0x343c19[_0x7721('0x31')](_0x7721('0x32'),_0x37b9f0+'-'+_0xd7d703+'/'+_0x1ea4d)['json'](_0x158d98);}return null;};}function patchUpdates(_0x46f772){return function(_0x4651b5){try{jsonpatch[_0x7721('0x33')](_0x4651b5,_0x46f772,!![]);}catch(_0x58d54b){return BPromise[_0x7721('0x34')](_0x58d54b);}return _0x4651b5[_0x7721('0x35')]();};}function saveUpdates(_0x1492d4,_0x3f15e2){return function(_0xc0f3c4){if(_0xc0f3c4){return _0xc0f3c4['update'](_0x1492d4)[_0x7721('0x21')](function(_0x3e4e56){return _0x3e4e56;});}return null;};}function removeEntity(_0xb2386d,_0x5c5b33){return function(_0x35de7a){if(_0x35de7a){return _0x35de7a[_0x7721('0x36')]()['then'](function(){_0xb2386d[_0x7721('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d6ba0,_0x326c50){return function(_0x19d082){if(!_0x19d082){_0x2d6ba0[_0x7721('0x2c')](0x194);}return _0x19d082;};}function handleError(_0x1c84c0,_0x13c635){_0x13c635=_0x13c635||0x1f4;return function(_0x2f1fe0){logger[_0x7721('0x27')](_0x2f1fe0[_0x7721('0x37')]);if(_0x2f1fe0[_0x7721('0x38')]){delete _0x2f1fe0[_0x7721('0x38')];}_0x1c84c0['status'](_0x13c635)[_0x7721('0x39')](_0x2f1fe0);};}exports['index']=function(_0x212384,_0x35614c){var _0x7942f7={},_0x1d03de={},_0x3968f3={'count':0x0,'rows':[]};var _0x378ba5=_['map'](db['FreshdeskAccount']['rawAttributes'],function(_0x539560){return{'name':_0x539560[_0x7721('0x3a')],'type':_0x539560[_0x7721('0x3b')][_0x7721('0x3c')]};});_0x1d03de[_0x7721('0x3d')]=_['map'](_0x378ba5,_0x7721('0x38'));_0x1d03de['query']=_[_0x7721('0x3e')](_0x212384[_0x7721('0x3f')]);_0x1d03de['filters']=_[_0x7721('0x40')](_0x1d03de[_0x7721('0x3d')],_0x1d03de['query']);_0x7942f7['attributes']=_[_0x7721('0x40')](_0x1d03de[_0x7721('0x3d')],qs[_0x7721('0x41')](_0x212384[_0x7721('0x3f')]['fields']));_0x7942f7[_0x7721('0x42')]=_0x7942f7[_0x7721('0x42')][_0x7721('0x43')]?_0x7942f7[_0x7721('0x42')]:_0x1d03de[_0x7721('0x3d')];if(!_0x212384['query'][_0x7721('0x44')]('nolimit')){_0x7942f7[_0x7721('0x45')]=qs['limit'](_0x212384[_0x7721('0x3f')][_0x7721('0x45')]);_0x7942f7[_0x7721('0x30')]=qs['offset'](_0x212384[_0x7721('0x3f')][_0x7721('0x30')]);}_0x7942f7[_0x7721('0x46')]=qs['sort'](_0x212384[_0x7721('0x3f')][_0x7721('0x47')]);_0x7942f7[_0x7721('0x48')]=qs[_0x7721('0x49')](_[_0x7721('0x4a')](_0x212384[_0x7721('0x3f')],_0x1d03de[_0x7721('0x49')]),_0x378ba5);if(_0x212384['query']['filter']){_0x7942f7[_0x7721('0x48')]=_[_0x7721('0x4b')](_0x7942f7[_0x7721('0x48')],{'$or':_[_0x7721('0x4c')](_0x378ba5,function(_0x335145){if(_0x335145[_0x7721('0x3b')]!==_0x7721('0x4d')){var _0x2966fe={};_0x2966fe[_0x335145[_0x7721('0x38')]]={'$like':'%'+_0x212384[_0x7721('0x3f')]['filter']+'%'};return _0x2966fe;}})});}_0x7942f7=_['merge']({},_0x7942f7,_0x212384[_0x7721('0x4e')]);var _0x6a4664={'where':_0x7942f7[_0x7721('0x48')]};return db[_0x7721('0x4f')]['count'](_0x6a4664)[_0x7721('0x21')](function(_0x2d5a88){_0x3968f3['count']=_0x2d5a88;if(_0x212384[_0x7721('0x3f')]['includeAll']){_0x7942f7[_0x7721('0x50')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x7721('0x51')](_0x7942f7);})[_0x7721('0x21')](function(_0xf17c40){_0x3968f3['rows']=_0xf17c40;return _0x3968f3;})[_0x7721('0x21')](respondWithFilteredResult(_0x35614c,_0x7942f7))[_0x7721('0x52')](handleError(_0x35614c,null));};exports['show']=function(_0x223d93,_0x1196c2){var _0xf88e8c={'raw':![],'where':{'id':_0x223d93[_0x7721('0x53')]['id']}},_0x5c4078={};_0x5c4078['model']=_[_0x7721('0x3e')](db[_0x7721('0x4f')][_0x7721('0x54')]);_0x5c4078[_0x7721('0x3f')]=_[_0x7721('0x3e')](_0x223d93[_0x7721('0x3f')]);_0x5c4078[_0x7721('0x49')]=_[_0x7721('0x40')](_0x5c4078[_0x7721('0x3d')],_0x5c4078[_0x7721('0x3f')]);_0xf88e8c[_0x7721('0x42')]=_[_0x7721('0x40')](_0x5c4078[_0x7721('0x3d')],qs[_0x7721('0x41')](_0x223d93[_0x7721('0x3f')]['fields']));_0xf88e8c[_0x7721('0x42')]=_0xf88e8c[_0x7721('0x42')][_0x7721('0x43')]?_0xf88e8c[_0x7721('0x42')]:_0x5c4078[_0x7721('0x3d')];if(_0x223d93[_0x7721('0x3f')][_0x7721('0x55')]){_0xf88e8c['include']=[{'all':!![]}];}_0xf88e8c=_[_0x7721('0x4b')]({},_0xf88e8c,_0x223d93[_0x7721('0x4e')]);return db[_0x7721('0x4f')][_0x7721('0x56')](_0xf88e8c)[_0x7721('0x21')](handleEntityNotFound(_0x1196c2,null))[_0x7721('0x21')](respondWithResult(_0x1196c2,null))[_0x7721('0x52')](handleError(_0x1196c2,null));};exports[_0x7721('0x57')]=function(_0x11b300,_0x3b968d){return db[_0x7721('0x4f')]['create'](_0x11b300[_0x7721('0x58')],{})[_0x7721('0x21')](respondWithResult(_0x3b968d,0xc9))[_0x7721('0x52')](handleError(_0x3b968d,null));};exports[_0x7721('0x59')]=function(_0x15ed3b,_0x3e7918){if(_0x15ed3b[_0x7721('0x58')]['id']){delete _0x15ed3b[_0x7721('0x58')]['id'];}return db[_0x7721('0x4f')][_0x7721('0x56')]({'where':{'id':_0x15ed3b[_0x7721('0x53')]['id']}})[_0x7721('0x21')](handleEntityNotFound(_0x3e7918,null))[_0x7721('0x21')](saveUpdates(_0x15ed3b[_0x7721('0x58')],null))[_0x7721('0x21')](respondWithResult(_0x3e7918,null))['catch'](handleError(_0x3e7918,null));};exports['destroy']=function(_0x4e112e,_0x885a3a){return db['FreshdeskAccount']['find']({'where':{'id':_0x4e112e['params']['id']}})['then'](handleEntityNotFound(_0x885a3a,null))[_0x7721('0x21')](removeEntity(_0x885a3a,null))[_0x7721('0x52')](handleError(_0x885a3a,null));};exports[_0x7721('0x5a')]=function(_0x5343a1,_0x5181d7,_0x5925b7){var _0x51a3a2={};var _0x484b8e={};var _0x24d1dc;var _0x4f0d38;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x5343a1[_0x7721('0x53')]['id']}})[_0x7721('0x21')](handleEntityNotFound(_0x5181d7,null))[_0x7721('0x21')](function(_0x4a94c8){if(_0x4a94c8){_0x24d1dc=_0x4a94c8;_0x484b8e[_0x7721('0x3d')]=_[_0x7721('0x3e')](db[_0x7721('0x5b')][_0x7721('0x54')]);_0x484b8e[_0x7721('0x3f')]=_[_0x7721('0x3e')](_0x5343a1[_0x7721('0x3f')]);_0x484b8e[_0x7721('0x49')]=_[_0x7721('0x40')](_0x484b8e[_0x7721('0x3d')],_0x484b8e[_0x7721('0x3f')]);_0x51a3a2[_0x7721('0x42')]=_[_0x7721('0x40')](_0x484b8e[_0x7721('0x3d')],qs[_0x7721('0x41')](_0x5343a1['query'][_0x7721('0x41')]));_0x51a3a2[_0x7721('0x42')]=_0x51a3a2[_0x7721('0x42')][_0x7721('0x43')]?_0x51a3a2['attributes']:_0x484b8e[_0x7721('0x3d')];_0x51a3a2[_0x7721('0x46')]=qs['sort'](_0x5343a1[_0x7721('0x3f')]['sort']);_0x51a3a2[_0x7721('0x48')]=qs[_0x7721('0x49')](_[_0x7721('0x4a')](_0x5343a1[_0x7721('0x3f')],_0x484b8e[_0x7721('0x49')]));if(_0x5343a1[_0x7721('0x3f')][_0x7721('0x5c')]){_0x51a3a2[_0x7721('0x48')]=_[_0x7721('0x4b')](_0x51a3a2['where'],{'$or':_[_0x7721('0x4c')](_0x51a3a2[_0x7721('0x42')],function(_0x112033){var _0x3a11e2={};_0x3a11e2[_0x112033]={'$like':'%'+_0x5343a1[_0x7721('0x3f')][_0x7721('0x5c')]+'%'};return _0x3a11e2;})});}_0x51a3a2=_[_0x7721('0x4b')]({},_0x51a3a2,_0x5343a1['options']);return _0x24d1dc[_0x7721('0x5a')](_0x51a3a2);}})[_0x7721('0x21')](function(_0x53c918){if(_0x53c918){_0x4f0d38=_0x53c918[_0x7721('0x43')];if(!_0x5343a1['query'][_0x7721('0x44')](_0x7721('0x5d'))){_0x51a3a2[_0x7721('0x45')]=qs[_0x7721('0x45')](_0x5343a1[_0x7721('0x3f')][_0x7721('0x45')]);_0x51a3a2[_0x7721('0x30')]=qs['offset'](_0x5343a1[_0x7721('0x3f')][_0x7721('0x30')]);}return _0x24d1dc[_0x7721('0x5a')](_0x51a3a2);}})['then'](function(_0x5cef5a){if(_0x5cef5a){return _0x5cef5a?{'count':_0x4f0d38,'rows':_0x5cef5a}:null;}})['then'](respondWithResult(_0x5181d7,null))['catch'](handleError(_0x5181d7,null));};exports['addConfiguration']=function(_0x1fc5f7,_0x2645dd,_0x580473){if(_0x1fc5f7[_0x7721('0x58')]['id']){delete _0x1fc5f7[_0x7721('0x58')]['id'];}return db[_0x7721('0x4f')][_0x7721('0x5e')]({'where':{'id':_0x1fc5f7['params']['id']}})[_0x7721('0x21')](handleEntityNotFound(_0x2645dd,null))[_0x7721('0x21')](function(_0x322afc){if(_0x322afc){_0x1fc5f7[_0x7721('0x58')][_0x7721('0x5f')]=_0x322afc['id'];_0x1fc5f7['body'][_0x7721('0x60')]=integrations[_0x7721('0x61')](_0x1fc5f7[_0x7721('0x58')]['channel'],_0x1fc5f7['body'][_0x7721('0x3b')]);_0x1fc5f7[_0x7721('0x58')][_0x7721('0x62')]=integrations[_0x7721('0x63')](_0x1fc5f7[_0x7721('0x58')]['channel'],_0x1fc5f7['body'][_0x7721('0x3b')]);return db[_0x7721('0x5b')][_0x7721('0x57')](_0x1fc5f7[_0x7721('0x58')],{'include':[{'model':db[_0x7721('0x64')],'as':_0x7721('0x60')},{'model':db[_0x7721('0x64')],'as':'Descriptions'}]});}return null;})[_0x7721('0x21')](respondWithResult(_0x2645dd,null))[_0x7721('0x52')](handleError(_0x2645dd,null));};exports[_0x7721('0x65')]=function(_0x5e85d9,_0xdc60ee,_0x1a53d6){var _0xdcd3e0='';return db[_0x7721('0x4f')]['findOne']({'where':{'id':_0x5e85d9['params']['id']},'attributes':['id',_0x7721('0x66'),_0x7721('0x67')]})[_0x7721('0x21')](handleEntityNotFound(_0xdc60ee,null))[_0x7721('0x21')](function(_0x3605cb){if(_0x3605cb){_0xdcd3e0=_0x3605cb[_0x7721('0x66')];var _0x59e80c=_0xdcd3e0[_0x7721('0x68')](-0x1);if(_0x59e80c==='/'){_0xdcd3e0=_0xdcd3e0[_0x7721('0x69')](0x0,_0xdcd3e0[_0x7721('0x6a')](_0x59e80c));}return rp({'method':'GET','uri':util[_0x7721('0x6b')](_0x7721('0x6c'),_0xdcd3e0,_0x7721('0x6d')),'headers':{'Authorization':util[_0x7721('0x6b')](_0x7721('0x6e'),new Buffer(util['format'](_0x7721('0x6f'),_0x3605cb['apiKey']))[_0x7721('0x70')](_0x7721('0x71')))},'json':!![]});}})[_0x7721('0x21')](function(_0x7f0598){if(_0x7f0598){var _0x963dbe=[_0x7721('0x72'),_0x7721('0x73'),_0x7721('0x74'),_0x7721('0x75'),_0x7721('0x2d'),_0x7721('0x76'),'group',_0x7721('0x77'),_0x7721('0x78'),_0x7721('0x79'),'company'];_[_0x7721('0x7a')](_0x7f0598,function(_0x26b2cc){return _0x963dbe[_0x7721('0x7b')](_0x26b2cc[_0x7721('0x38')])||!_0x26b2cc[_0x7721('0x7c')]&&_0x26b2cc['type']!==_0x7721('0x7d')&&_0x26b2cc[_0x7721('0x3b')]!==_0x7721('0x7e');});return{'count':_0x7f0598[_0x7721('0x43')],'rows':_[_0x7721('0x4c')](_0x7f0598,function(_0x51f3d7){return{'id':_0x51f3d7['name'],'name':_0x51f3d7[_0x7721('0x7f')],'custom':!_0x51f3d7[_0x7721('0x7c')],'options':_0x51f3d7['choices']?_[_0x7721('0x4c')](_0x51f3d7['choices'],function(_0x453792){return{'name':_[_0x7721('0x80')](_0x453792),'value':_0x453792};}):[]};})};}})['then'](respondWithResult(_0xdc60ee,null))[_0x7721('0x52')](function(_0x5209e1){var _0x56069f=_0x5e85d9['query'][_0x7721('0x1e')]?0x1f4:_0x5209e1[_0x7721('0x81')]||0x1f4;logger[_0x7721('0x27')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x56069f,JSON['stringify'](_0x5209e1));delete _0x5209e1[_0x7721('0x38')];if(_0x56069f===0x191){_0x56069f=0x190;}_0xdc60ee[_0x7721('0x2d')](_0x56069f)[_0x7721('0x39')](_0x5e85d9[_0x7721('0x3f')][_0x7721('0x1e')]?{'message':_0x7721('0x82'),'statusCode':_0x5209e1['statusCode']}:_0x5209e1);});}; \ No newline at end of file +var _0xabce=['%s/%s','api/v2/ticket_fields','base64','requester','agent','priority','source','company','remove','includes','custom_text','custom_dropdown','label','default','choices','test','stringify','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','update','stack','name','send','FreshdeskAccount','map','query','keys','filters','model','attributes','intersection','length','hasOwnProperty','order','sort','pick','merge','VIRTUAL','filter','options','where','includeAll','include','rows','show','params','rawAttributes','fields','find','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','getSubjects','channel','getDescriptions','type','FreshdeskField','Subjects','Descriptions','getFields','remoteUri','slice','substring','GET','format'];(function(_0x2773e9,_0x151bf8){var _0x528097=function(_0x4ba289){while(--_0x4ba289){_0x2773e9['push'](_0x2773e9['shift']());}};_0x528097(++_0x151bf8);}(_0xabce,0x103));var _0xeabc=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xabce[_0x4e1d03];return _0x362d4b;};'use strict';var pdf=require(_0xeabc('0x0'));var emlformat=require(_0xeabc('0x1'));var rimraf=require(_0xeabc('0x2'));var zipdir=require(_0xeabc('0x3'));var jsonpatch=require(_0xeabc('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeabc('0x5'));var Mustache=require(_0xeabc('0x6'));var util=require(_0xeabc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeabc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var db=require(_0xeabc('0x18'))['db'];var integrations=require(_0xeabc('0x19'));var jayson=require(_0xeabc('0x1a'));var client=jayson[_0xeabc('0x1b')][_0xeabc('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x53df9c,_0x235c2d,_0x1319f3){if(_0x1319f3){var _0x3251c6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3251c6['test'](_0x235c2d)){return _0x53df9c;}else{throw new db['Sequelize'][(_0xeabc('0x1d'))](_0xeabc('0x1e'));}}else{return _0x53df9c;}}function respondWithRpcPromise(_0x326bac,_0x53d5cb,_0xf913d7,_0x638976){return new BPromise(function(_0x49f2d8,_0x53fe28){var _0x10fa8e=_0x638976||client;return _0x10fa8e['request'](_0x326bac,_0xf913d7)[_0xeabc('0x1f')](function(_0x1b64b9){logger[_0xeabc('0x20')](_0xeabc('0x21'),_0x53d5cb,_0xeabc('0x22'));logger[_0xeabc('0x23')](_0xeabc('0x24'),_0x53d5cb,_0xeabc('0x22'),JSON['stringify'](_0x1b64b9));if(_0x1b64b9[_0xeabc('0x25')]){if(_0x1b64b9['error'][_0xeabc('0x26')]===0x1f4){logger[_0xeabc('0x25')]('FreshdeskAccount,\x20%s,\x20%s',_0x53d5cb,_0x1b64b9[_0xeabc('0x25')][_0xeabc('0x27')]);return _0x53fe28(_0x1b64b9[_0xeabc('0x25')][_0xeabc('0x27')]);}logger[_0xeabc('0x25')]('FreshdeskAccount,\x20%s,\x20%s',_0x53d5cb,_0x1b64b9[_0xeabc('0x25')][_0xeabc('0x27')]);return _0x49f2d8(_0x1b64b9[_0xeabc('0x25')]['message']);}else{logger[_0xeabc('0x20')](_0xeabc('0x21'),_0x53d5cb,_0xeabc('0x22'));_0x49f2d8(_0x1b64b9[_0xeabc('0x28')]['message']);}})[_0xeabc('0x29')](function(_0x480440){logger[_0xeabc('0x25')]('FreshdeskAccount,\x20%s,\x20%s',_0x53d5cb,_0x480440);_0x53fe28(_0x480440);});});}function respondWithStatusCode(_0x811f0d,_0x12acbd){_0x12acbd=_0x12acbd||0xcc;return function(_0x269621){if(_0x269621){return _0x811f0d[_0xeabc('0x2a')](_0x12acbd);}return _0x811f0d[_0xeabc('0x2b')](_0x12acbd)[_0xeabc('0x2c')]();};}function respondWithResult(_0x131722,_0x4c2693){_0x4c2693=_0x4c2693||0xc8;return function(_0x5b2934){if(_0x5b2934){return _0x131722[_0xeabc('0x2b')](_0x4c2693)['json'](_0x5b2934);}};}function respondWithFilteredResult(_0x3c1b5b,_0x2b342c){return function(_0x48fb52){if(_0x48fb52){var _0x2163e6=_0x48fb52[_0xeabc('0x2d')],_0x38572d=_0x2b342c[_0xeabc('0x2e')],_0x2b568f=_0x2b342c[_0xeabc('0x2e')]+_0x2b342c[_0xeabc('0x2f')],_0x2f8633;if(_0x2b568f>=_0x2163e6){_0x2b568f=_0x2163e6;_0x2f8633=0xc8;}else{_0x2f8633=0xce;}_0x3c1b5b[_0xeabc('0x2b')](_0x2f8633);return _0x3c1b5b['set'](_0xeabc('0x30'),_0x38572d+'-'+_0x2b568f+'/'+_0x2163e6)['json'](_0x48fb52);}return null;};}function patchUpdates(_0x2f03e8){return function(_0x2d027e){try{jsonpatch[_0xeabc('0x31')](_0x2d027e,_0x2f03e8,!![]);}catch(_0x3c606a){return BPromise[_0xeabc('0x32')](_0x3c606a);}return _0x2d027e[_0xeabc('0x33')]();};}function saveUpdates(_0x61c0af,_0x545d7f){return function(_0x78510a){if(_0x78510a){return _0x78510a[_0xeabc('0x34')](_0x61c0af)[_0xeabc('0x1f')](function(_0x4918e2){return _0x4918e2;});}return null;};}function removeEntity(_0x1e74ca,_0x3777c1){return function(_0x4492fd){if(_0x4492fd){return _0x4492fd['destroy']()[_0xeabc('0x1f')](function(){_0x1e74ca[_0xeabc('0x2b')](0xcc)[_0xeabc('0x2c')]();});}};}function handleEntityNotFound(_0x521091,_0xf98c7c){return function(_0x286203){if(!_0x286203){_0x521091['sendStatus'](0x194);}return _0x286203;};}function handleError(_0x50cca2,_0x254568){_0x254568=_0x254568||0x1f4;return function(_0x3829a9){logger['error'](_0x3829a9[_0xeabc('0x35')]);if(_0x3829a9[_0xeabc('0x36')]){delete _0x3829a9[_0xeabc('0x36')];}_0x50cca2[_0xeabc('0x2b')](_0x254568)[_0xeabc('0x37')](_0x3829a9);};}exports['index']=function(_0x353e48,_0x5b61fa){var _0x31ee7a={},_0x2bda29={},_0x311291={'count':0x0,'rows':[]};var _0x5b52c4=_['map'](db[_0xeabc('0x38')]['rawAttributes'],function(_0x113d5a){return{'name':_0x113d5a['fieldName'],'type':_0x113d5a['type']['key']};});_0x2bda29['model']=_[_0xeabc('0x39')](_0x5b52c4,'name');_0x2bda29[_0xeabc('0x3a')]=_[_0xeabc('0x3b')](_0x353e48['query']);_0x2bda29[_0xeabc('0x3c')]=_['intersection'](_0x2bda29[_0xeabc('0x3d')],_0x2bda29['query']);_0x31ee7a[_0xeabc('0x3e')]=_[_0xeabc('0x3f')](_0x2bda29[_0xeabc('0x3d')],qs['fields'](_0x353e48['query']['fields']));_0x31ee7a[_0xeabc('0x3e')]=_0x31ee7a[_0xeabc('0x3e')][_0xeabc('0x40')]?_0x31ee7a['attributes']:_0x2bda29['model'];if(!_0x353e48[_0xeabc('0x3a')][_0xeabc('0x41')]('nolimit')){_0x31ee7a[_0xeabc('0x2f')]=qs['limit'](_0x353e48[_0xeabc('0x3a')]['limit']);_0x31ee7a['offset']=qs['offset'](_0x353e48[_0xeabc('0x3a')][_0xeabc('0x2e')]);}_0x31ee7a[_0xeabc('0x42')]=qs[_0xeabc('0x43')](_0x353e48['query'][_0xeabc('0x43')]);_0x31ee7a['where']=qs[_0xeabc('0x3c')](_[_0xeabc('0x44')](_0x353e48[_0xeabc('0x3a')],_0x2bda29[_0xeabc('0x3c')]),_0x5b52c4);if(_0x353e48[_0xeabc('0x3a')]['filter']){_0x31ee7a['where']=_[_0xeabc('0x45')](_0x31ee7a['where'],{'$or':_[_0xeabc('0x39')](_0x5b52c4,function(_0x2cdf59){if(_0x2cdf59['type']!==_0xeabc('0x46')){var _0x2b3c28={};_0x2b3c28[_0x2cdf59[_0xeabc('0x36')]]={'$like':'%'+_0x353e48[_0xeabc('0x3a')][_0xeabc('0x47')]+'%'};return _0x2b3c28;}})});}_0x31ee7a=_[_0xeabc('0x45')]({},_0x31ee7a,_0x353e48[_0xeabc('0x48')]);var _0x4b2fb6={'where':_0x31ee7a[_0xeabc('0x49')]};return db[_0xeabc('0x38')][_0xeabc('0x2d')](_0x4b2fb6)[_0xeabc('0x1f')](function(_0x271f8c){_0x311291[_0xeabc('0x2d')]=_0x271f8c;if(_0x353e48[_0xeabc('0x3a')][_0xeabc('0x4a')]){_0x31ee7a[_0xeabc('0x4b')]=[{'all':!![]}];}return db[_0xeabc('0x38')]['findAll'](_0x31ee7a);})[_0xeabc('0x1f')](function(_0x2e6efb){_0x311291[_0xeabc('0x4c')]=_0x2e6efb;return _0x311291;})[_0xeabc('0x1f')](respondWithFilteredResult(_0x5b61fa,_0x31ee7a))[_0xeabc('0x29')](handleError(_0x5b61fa,null));};exports[_0xeabc('0x4d')]=function(_0x268d95,_0x48df43){var _0x766743={'raw':![],'where':{'id':_0x268d95[_0xeabc('0x4e')]['id']}},_0x32e09b={};_0x32e09b[_0xeabc('0x3d')]=_[_0xeabc('0x3b')](db['FreshdeskAccount'][_0xeabc('0x4f')]);_0x32e09b[_0xeabc('0x3a')]=_[_0xeabc('0x3b')](_0x268d95[_0xeabc('0x3a')]);_0x32e09b['filters']=_[_0xeabc('0x3f')](_0x32e09b[_0xeabc('0x3d')],_0x32e09b['query']);_0x766743[_0xeabc('0x3e')]=_['intersection'](_0x32e09b[_0xeabc('0x3d')],qs['fields'](_0x268d95[_0xeabc('0x3a')][_0xeabc('0x50')]));_0x766743[_0xeabc('0x3e')]=_0x766743[_0xeabc('0x3e')][_0xeabc('0x40')]?_0x766743[_0xeabc('0x3e')]:_0x32e09b[_0xeabc('0x3d')];if(_0x268d95[_0xeabc('0x3a')][_0xeabc('0x4a')]){_0x766743[_0xeabc('0x4b')]=[{'all':!![]}];}_0x766743=_['merge']({},_0x766743,_0x268d95[_0xeabc('0x48')]);return db[_0xeabc('0x38')][_0xeabc('0x51')](_0x766743)[_0xeabc('0x1f')](handleEntityNotFound(_0x48df43,null))['then'](respondWithResult(_0x48df43,null))[_0xeabc('0x29')](handleError(_0x48df43,null));};exports[_0xeabc('0x52')]=function(_0x10d56f,_0x21f972){return db['FreshdeskAccount'][_0xeabc('0x52')](_0x10d56f[_0xeabc('0x53')],{})[_0xeabc('0x1f')](respondWithResult(_0x21f972,0xc9))[_0xeabc('0x29')](handleError(_0x21f972,null));};exports[_0xeabc('0x34')]=function(_0x3b5e94,_0x14c322){if(_0x3b5e94[_0xeabc('0x53')]['id']){delete _0x3b5e94[_0xeabc('0x53')]['id'];}return db['FreshdeskAccount'][_0xeabc('0x51')]({'where':{'id':_0x3b5e94['params']['id']}})['then'](handleEntityNotFound(_0x14c322,null))['then'](saveUpdates(_0x3b5e94[_0xeabc('0x53')],null))[_0xeabc('0x1f')](respondWithResult(_0x14c322,null))[_0xeabc('0x29')](handleError(_0x14c322,null));};exports[_0xeabc('0x54')]=function(_0xe89728,_0x2f78f3){return db['FreshdeskAccount'][_0xeabc('0x51')]({'where':{'id':_0xe89728[_0xeabc('0x4e')]['id']}})[_0xeabc('0x1f')](handleEntityNotFound(_0x2f78f3,null))[_0xeabc('0x1f')](removeEntity(_0x2f78f3,null))[_0xeabc('0x29')](handleError(_0x2f78f3,null));};exports[_0xeabc('0x55')]=function(_0x1750e9,_0x25c728,_0x5820ca){var _0x5b8370={};var _0x180e62={};var _0x340520;var _0x2c0894;return db['FreshdeskAccount'][_0xeabc('0x56')]({'where':{'id':_0x1750e9['params']['id']}})['then'](handleEntityNotFound(_0x25c728,null))[_0xeabc('0x1f')](function(_0x1fca99){if(_0x1fca99){_0x340520=_0x1fca99;_0x180e62[_0xeabc('0x3d')]=_[_0xeabc('0x3b')](db[_0xeabc('0x57')][_0xeabc('0x4f')]);_0x180e62['query']=_[_0xeabc('0x3b')](_0x1750e9[_0xeabc('0x3a')]);_0x180e62[_0xeabc('0x3c')]=_[_0xeabc('0x3f')](_0x180e62[_0xeabc('0x3d')],_0x180e62[_0xeabc('0x3a')]);_0x5b8370['attributes']=_[_0xeabc('0x3f')](_0x180e62[_0xeabc('0x3d')],qs[_0xeabc('0x50')](_0x1750e9[_0xeabc('0x3a')][_0xeabc('0x50')]));_0x5b8370[_0xeabc('0x3e')]=_0x5b8370[_0xeabc('0x3e')][_0xeabc('0x40')]?_0x5b8370[_0xeabc('0x3e')]:_0x180e62['model'];_0x5b8370[_0xeabc('0x42')]=qs['sort'](_0x1750e9[_0xeabc('0x3a')][_0xeabc('0x43')]);_0x5b8370[_0xeabc('0x49')]=qs[_0xeabc('0x3c')](_[_0xeabc('0x44')](_0x1750e9[_0xeabc('0x3a')],_0x180e62[_0xeabc('0x3c')]));if(_0x1750e9[_0xeabc('0x3a')][_0xeabc('0x47')]){_0x5b8370[_0xeabc('0x49')]=_['merge'](_0x5b8370[_0xeabc('0x49')],{'$or':_[_0xeabc('0x39')](_0x5b8370[_0xeabc('0x3e')],function(_0x41cad5){var _0x5b4430={};_0x5b4430[_0x41cad5]={'$like':'%'+_0x1750e9[_0xeabc('0x3a')]['filter']+'%'};return _0x5b4430;})});}_0x5b8370=_['merge']({},_0x5b8370,_0x1750e9[_0xeabc('0x48')]);return _0x340520[_0xeabc('0x55')](_0x5b8370);}})[_0xeabc('0x1f')](function(_0x1c91e4){if(_0x1c91e4){_0x2c0894=_0x1c91e4['length'];if(!_0x1750e9['query'][_0xeabc('0x41')]('nolimit')){_0x5b8370['limit']=qs[_0xeabc('0x2f')](_0x1750e9['query']['limit']);_0x5b8370[_0xeabc('0x2e')]=qs[_0xeabc('0x2e')](_0x1750e9['query']['offset']);}return _0x340520[_0xeabc('0x55')](_0x5b8370);}})['then'](function(_0x238e2d){if(_0x238e2d){return _0x238e2d?{'count':_0x2c0894,'rows':_0x238e2d}:null;}})[_0xeabc('0x1f')](respondWithResult(_0x25c728,null))['catch'](handleError(_0x25c728,null));};exports['addConfiguration']=function(_0x24365a,_0x74f5ac,_0xd86ea7){if(_0x24365a[_0xeabc('0x53')]['id']){delete _0x24365a[_0xeabc('0x53')]['id'];}return db['FreshdeskAccount']['findOne']({'where':{'id':_0x24365a[_0xeabc('0x4e')]['id']}})['then'](handleEntityNotFound(_0x74f5ac,null))[_0xeabc('0x1f')](function(_0x5086c6){if(_0x5086c6){_0x24365a[_0xeabc('0x53')]['AccountId']=_0x5086c6['id'];_0x24365a[_0xeabc('0x53')]['Subjects']=integrations[_0xeabc('0x58')](_0x24365a[_0xeabc('0x53')][_0xeabc('0x59')],_0x24365a[_0xeabc('0x53')]['type']);_0x24365a[_0xeabc('0x53')]['Descriptions']=integrations[_0xeabc('0x5a')](_0x24365a[_0xeabc('0x53')][_0xeabc('0x59')],_0x24365a[_0xeabc('0x53')][_0xeabc('0x5b')]);return db['FreshdeskConfiguration'][_0xeabc('0x52')](_0x24365a[_0xeabc('0x53')],{'include':[{'model':db[_0xeabc('0x5c')],'as':_0xeabc('0x5d')},{'model':db['FreshdeskField'],'as':_0xeabc('0x5e')}]});}return null;})[_0xeabc('0x1f')](respondWithResult(_0x74f5ac,null))[_0xeabc('0x29')](handleError(_0x74f5ac,null));};exports[_0xeabc('0x5f')]=function(_0x5bacbb,_0xb9b460,_0x368cd4){var _0x287f88='';return db[_0xeabc('0x38')]['findOne']({'where':{'id':_0x5bacbb['params']['id']},'attributes':['id',_0xeabc('0x60'),'apiKey']})['then'](handleEntityNotFound(_0xb9b460,null))[_0xeabc('0x1f')](function(_0x460f07){if(_0x460f07){_0x287f88=_0x460f07[_0xeabc('0x60')];var _0x49679d=_0x287f88[_0xeabc('0x61')](-0x1);if(_0x49679d==='/'){_0x287f88=_0x287f88[_0xeabc('0x62')](0x0,_0x287f88['lastIndexOf'](_0x49679d));}return rp({'method':_0xeabc('0x63'),'uri':util[_0xeabc('0x64')](_0xeabc('0x65'),_0x287f88,_0xeabc('0x66')),'headers':{'Authorization':util[_0xeabc('0x64')]('Basic\x20%s',new Buffer(util[_0xeabc('0x64')]('%s:X',_0x460f07['apiKey']))['toString'](_0xeabc('0x67')))},'json':!![]});}})[_0xeabc('0x1f')](function(_0x1b6e9e){if(_0x1b6e9e){var _0x4424ce=[_0xeabc('0x68'),'subject',_0xeabc('0x69'),'description',_0xeabc('0x2b'),_0xeabc('0x6a'),'group',_0xeabc('0x6b'),'ticket_type','group',_0xeabc('0x6c')];_[_0xeabc('0x6d')](_0x1b6e9e,function(_0x439a48){return _0x4424ce[_0xeabc('0x6e')](_0x439a48[_0xeabc('0x36')])||!_0x439a48['default']&&_0x439a48[_0xeabc('0x5b')]!==_0xeabc('0x6f')&&_0x439a48[_0xeabc('0x5b')]!==_0xeabc('0x70');});return{'count':_0x1b6e9e[_0xeabc('0x40')],'rows':_[_0xeabc('0x39')](_0x1b6e9e,function(_0x2d05b4){return{'id':_0x2d05b4[_0xeabc('0x36')],'name':_0x2d05b4[_0xeabc('0x71')],'custom':!_0x2d05b4[_0xeabc('0x72')],'options':_0x2d05b4['choices']?_[_0xeabc('0x39')](_0x2d05b4[_0xeabc('0x73')],function(_0xba29f){return{'name':_['capitalize'](_0xba29f),'value':_0xba29f};}):[]};})};}})['then'](respondWithResult(_0xb9b460,null))[_0xeabc('0x29')](function(_0x273ca5){var _0xe90200=_0x5bacbb[_0xeabc('0x3a')][_0xeabc('0x74')]?0x1f4:_0x273ca5['statusCode']||0x1f4;logger[_0xeabc('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0xe90200,JSON[_0xeabc('0x75')](_0x273ca5));delete _0x273ca5[_0xeabc('0x36')];if(_0xe90200===0x191){_0xe90200=0x190;}_0xb9b460['status'](_0xe90200)[_0xeabc('0x37')](_0x5bacbb[_0xeabc('0x3a')][_0xeabc('0x74')]?{'message':_0xeabc('0x76'),'statusCode':_0x273ca5[_0xeabc('0x77')]}:_0x273ca5);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 4b86f88..fabf8c1 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 _0x315c=['util','../../config/logger','api','moment','request-promise','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0xd22d95,_0xc59f8f){var _0x15d7a3=function(_0x3db95c){while(--_0x3db95c){_0xd22d95['push'](_0xd22d95['shift']());}};_0x15d7a3(++_0xc59f8f);}(_0x315c,0xe4));var _0xc315=function(_0x12c16e,_0x51cc83){_0x12c16e=_0x12c16e-0x0;var _0xb43ffe=_0x315c[_0x12c16e];return _0xb43ffe;};'use strict';var _=require('lodash');var util=require(_0xc315('0x0'));var logger=require(_0xc315('0x1'))(_0xc315('0x2'));var moment=require(_0xc315('0x3'));var BPromise=require('bluebird');var rp=require(_0xc315('0x4'));var fs=require('fs');var path=require(_0xc315('0x5'));var rimraf=require(_0xc315('0x6'));var config=require('../../config/environment');var attributes=require(_0xc315('0x7'));var integrations=require(_0xc315('0x8'));module['exports']=function(_0x5dfcd9,_0x4d2a84){return _0x5dfcd9[_0xc315('0x9')](_0xc315('0xa'),attributes,{'tableName':_0xc315('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15af=['lodash','util','../../config/logger','api','path','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','int_freshdesk_accounts'];(function(_0x5ebe9e,_0x1bbf95){var _0xe7db7=function(_0x153009){while(--_0x153009){_0x5ebe9e['push'](_0x5ebe9e['shift']());}};_0xe7db7(++_0x1bbf95);}(_0x15af,0x181));var _0xf15a=function(_0x4bc428,_0xf56dd9){_0x4bc428=_0x4bc428-0x0;var _0x3ca37f=_0x15af[_0x4bc428];return _0x3ca37f;};'use strict';var _=require(_0xf15a('0x0'));var util=require(_0xf15a('0x1'));var logger=require(_0xf15a('0x2'))(_0xf15a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf15a('0x4'));var rimraf=require('rimraf');var config=require(_0xf15a('0x5'));var attributes=require(_0xf15a('0x6'));var integrations=require(_0xf15a('0x7'));module[_0xf15a('0x8')]=function(_0x3ece23,_0x1bb4bd){return _0x3ece23[_0xf15a('0x9')]('FreshdeskAccount',attributes,{'tableName':_0xf15a('0xa'),'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 bddb1b9..3d76df6 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 _0xf55a=['request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetFreshdeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','stringify','catch','ShowFreshdeskAccount','FreshdeskAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','FreshdeskAccount,\x20%s,\x20%s'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xf55a,0x189));var _0xaf55=function(_0x3396d5,_0x3961ac){_0x3396d5=_0x3396d5-0x0;var _0x2b0554=_0xf55a[_0x3396d5];return _0x2b0554;};'use strict';var _=require(_0xaf55('0x0'));var util=require(_0xaf55('0x1'));var moment=require(_0xaf55('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf55('0x3'));var fs=require('fs');var Redis=require(_0xaf55('0x4'));var db=require(_0xaf55('0x5'))['db'];var utils=require(_0xaf55('0x6'));var logger=require(_0xaf55('0x7'))(_0xaf55('0x8'));var config=require('../../config/environment');var jayson=require(_0xaf55('0x9'));var client=jayson['client'][_0xaf55('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d53ac,_0x436dac,_0x118f51){return new BPromise(function(_0x15312b,_0x3c1a82){return client[_0xaf55('0xb')](_0x4d53ac,_0x118f51)[_0xaf55('0xc')](function(_0xe4961){logger['info'](_0xaf55('0xd'),_0x436dac,_0xaf55('0xe'));logger[_0xaf55('0xf')](_0xaf55('0x10'),_0x436dac,_0xaf55('0xe'),JSON['stringify'](_0xe4961));if(_0xe4961[_0xaf55('0x11')]){if(_0xe4961[_0xaf55('0x11')][_0xaf55('0x12')]===0x1f4){logger[_0xaf55('0x11')](_0xaf55('0xd'),_0x436dac,_0xe4961['error'][_0xaf55('0x13')]);return _0x3c1a82(_0xe4961[_0xaf55('0x11')][_0xaf55('0x13')]);}logger['error'](_0xaf55('0xd'),_0x436dac,_0xe4961['error'][_0xaf55('0x13')]);return _0x15312b(_0xe4961[_0xaf55('0x11')][_0xaf55('0x13')]);}else{logger[_0xaf55('0x14')](_0xaf55('0xd'),_0x436dac,_0xaf55('0xe'));_0x15312b(_0xe4961[_0xaf55('0x15')][_0xaf55('0x13')]);}})['catch'](function(_0x7f850f){logger[_0xaf55('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x436dac,_0x7f850f);_0x3c1a82(_0x7f850f);});});}exports[_0xaf55('0x16')]=function(_0x34e813){var _0x3e3151=this;return new Promise(function(_0x3cebf1,_0x4247bf){return db['FreshdeskAccount'][_0xaf55('0x17')]({'raw':_0x34e813[_0xaf55('0x18')]?_0x34e813[_0xaf55('0x18')][_0xaf55('0x19')]===undefined?!![]:![]:!![],'where':_0x34e813[_0xaf55('0x18')]?_0x34e813[_0xaf55('0x18')][_0xaf55('0x1a')]||null:null,'attributes':_0x34e813['options']?_0x34e813[_0xaf55('0x18')]['attributes']||null:null,'limit':_0x34e813[_0xaf55('0x18')]?_0x34e813[_0xaf55('0x18')][_0xaf55('0x1b')]||null:null,'include':_0x34e813[_0xaf55('0x18')]?_0x34e813['options'][_0xaf55('0x1c')]?_[_0xaf55('0x1d')](_0x34e813['options'][_0xaf55('0x1c')],function(_0x1d308a){return{'model':db[_0x1d308a[_0xaf55('0x1e')]],'as':_0x1d308a['as'],'attributes':_0x1d308a[_0xaf55('0x1f')],'include':_0x1d308a[_0xaf55('0x1c')]?_[_0xaf55('0x1d')](_0x1d308a[_0xaf55('0x1c')],function(_0xb11b39){return{'model':db[_0xb11b39[_0xaf55('0x1e')]],'as':_0xb11b39['as'],'attributes':_0xb11b39[_0xaf55('0x1f')],'include':_0xb11b39[_0xaf55('0x1c')]?_[_0xaf55('0x1d')](_0xb11b39[_0xaf55('0x1c')],function(_0x251c5a){return{'model':db[_0x251c5a[_0xaf55('0x1e')]],'as':_0x251c5a['as'],'attributes':_0x251c5a[_0xaf55('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xaf55('0xc')](function(_0x5a5255){logger['info']('GetFreshdeskAccount',_0x34e813);logger[_0xaf55('0xf')](_0xaf55('0x16'),_0x34e813,JSON[_0xaf55('0x20')](_0x5a5255));_0x3cebf1(_0x5a5255);})[_0xaf55('0x21')](function(_0x10df77){logger[_0xaf55('0x11')](_0xaf55('0x16'),_0x10df77[_0xaf55('0x13')],_0x34e813);_0x4247bf(_0x3e3151[_0xaf55('0x11')](0x1f4,_0x10df77[_0xaf55('0x13')]));});});};exports[_0xaf55('0x22')]=function(_0x441122){var _0x3d9c03=this;return new Promise(function(_0x2d6887,_0x3279d9){return db[_0xaf55('0x23')][_0xaf55('0x24')]({'raw':_0x441122['options']?_0x441122[_0xaf55('0x18')][_0xaf55('0x19')]===undefined?!![]:![]:!![],'where':_0x441122[_0xaf55('0x18')]?_0x441122[_0xaf55('0x18')][_0xaf55('0x1a')]||null:null,'attributes':_0x441122['options']?_0x441122[_0xaf55('0x18')][_0xaf55('0x1f')]||null:null,'include':_0x441122['options']?_0x441122['options'][_0xaf55('0x1c')]?_[_0xaf55('0x1d')](_0x441122[_0xaf55('0x18')][_0xaf55('0x1c')],function(_0x301634){return{'model':db[_0x301634[_0xaf55('0x1e')]],'as':_0x301634['as'],'attributes':_0x301634['attributes'],'include':_0x301634['include']?_[_0xaf55('0x1d')](_0x301634[_0xaf55('0x1c')],function(_0x2afb1e){return{'model':db[_0x2afb1e[_0xaf55('0x1e')]],'as':_0x2afb1e['as'],'attributes':_0x2afb1e['attributes'],'include':_0x2afb1e[_0xaf55('0x1c')]?_['map'](_0x2afb1e[_0xaf55('0x1c')],function(_0x334784){return{'model':db[_0x334784[_0xaf55('0x1e')]],'as':_0x334784['as'],'attributes':_0x334784[_0xaf55('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xaf55('0xc')](function(_0x36a12a){logger[_0xaf55('0x14')](_0xaf55('0x22'),_0x441122);logger[_0xaf55('0xf')]('ShowFreshdeskAccount',_0x441122,JSON[_0xaf55('0x20')](_0x36a12a));_0x2d6887(_0x36a12a);})[_0xaf55('0x21')](function(_0x32c953){logger[_0xaf55('0x11')]('ShowFreshdeskAccount',_0x32c953[_0xaf55('0x13')],_0x441122);_0x3279d9(_0x3d9c03['error'](0x1f4,_0x32c953['message']));});});}; \ No newline at end of file +var _0x18d5=['options','raw','where','attributes','limit','include','map','model','debug','GetFreshdeskAccount','stringify','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','findAll'];(function(_0x538389,_0xe259ea){var _0x4006a5=function(_0x21db8b){while(--_0x21db8b){_0x538389['push'](_0x538389['shift']());}};_0x4006a5(++_0xe259ea);}(_0x18d5,0xb1));var _0x518d=function(_0x2d78c5,_0x215b4e){_0x2d78c5=_0x2d78c5-0x0;var _0x6a419=_0x18d5[_0x2d78c5];return _0x6a419;};'use strict';var _=require(_0x518d('0x0'));var util=require(_0x518d('0x1'));var moment=require(_0x518d('0x2'));var BPromise=require(_0x518d('0x3'));var rs=require(_0x518d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x518d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x518d('0x6'))(_0x518d('0x7'));var config=require(_0x518d('0x8'));var jayson=require(_0x518d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ac232,_0x38c85c,_0x399667){return new BPromise(function(_0x21ef47,_0x29c997){return client[_0x518d('0xa')](_0x4ac232,_0x399667)[_0x518d('0xb')](function(_0x142600){logger[_0x518d('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x38c85c,'request\x20sent');logger['debug'](_0x518d('0xd'),_0x38c85c,_0x518d('0xe'),JSON['stringify'](_0x142600));if(_0x142600[_0x518d('0xf')]){if(_0x142600[_0x518d('0xf')]['code']===0x1f4){logger['error'](_0x518d('0x10'),_0x38c85c,_0x142600[_0x518d('0xf')][_0x518d('0x11')]);return _0x29c997(_0x142600[_0x518d('0xf')][_0x518d('0x11')]);}logger[_0x518d('0xf')](_0x518d('0x10'),_0x38c85c,_0x142600[_0x518d('0xf')]['message']);return _0x21ef47(_0x142600['error'][_0x518d('0x11')]);}else{logger[_0x518d('0xc')](_0x518d('0x10'),_0x38c85c,_0x518d('0xe'));_0x21ef47(_0x142600[_0x518d('0x12')][_0x518d('0x11')]);}})[_0x518d('0x13')](function(_0x19eba7){logger[_0x518d('0xf')](_0x518d('0x10'),_0x38c85c,_0x19eba7);_0x29c997(_0x19eba7);});});}exports['GetFreshdeskAccount']=function(_0x59825a){var _0x26e7b9=this;return new Promise(function(_0x443f07,_0x2cf89e){return db['FreshdeskAccount'][_0x518d('0x14')]({'raw':_0x59825a[_0x518d('0x15')]?_0x59825a[_0x518d('0x15')][_0x518d('0x16')]===undefined?!![]:![]:!![],'where':_0x59825a[_0x518d('0x15')]?_0x59825a[_0x518d('0x15')][_0x518d('0x17')]||null:null,'attributes':_0x59825a[_0x518d('0x15')]?_0x59825a['options'][_0x518d('0x18')]||null:null,'limit':_0x59825a[_0x518d('0x15')]?_0x59825a[_0x518d('0x15')][_0x518d('0x19')]||null:null,'include':_0x59825a['options']?_0x59825a[_0x518d('0x15')][_0x518d('0x1a')]?_[_0x518d('0x1b')](_0x59825a['options']['include'],function(_0x4fe88f){return{'model':db[_0x4fe88f[_0x518d('0x1c')]],'as':_0x4fe88f['as'],'attributes':_0x4fe88f[_0x518d('0x18')],'include':_0x4fe88f[_0x518d('0x1a')]?_[_0x518d('0x1b')](_0x4fe88f[_0x518d('0x1a')],function(_0x4b307f){return{'model':db[_0x4b307f[_0x518d('0x1c')]],'as':_0x4b307f['as'],'attributes':_0x4b307f[_0x518d('0x18')],'include':_0x4b307f[_0x518d('0x1a')]?_[_0x518d('0x1b')](_0x4b307f[_0x518d('0x1a')],function(_0x9c58f1){return{'model':db[_0x9c58f1[_0x518d('0x1c')]],'as':_0x9c58f1['as'],'attributes':_0x9c58f1['attributes']};}):[]};}):[]};}):[]:[]})[_0x518d('0xb')](function(_0x5415bf){logger[_0x518d('0xc')]('GetFreshdeskAccount',_0x59825a);logger[_0x518d('0x1d')](_0x518d('0x1e'),_0x59825a,JSON[_0x518d('0x1f')](_0x5415bf));_0x443f07(_0x5415bf);})['catch'](function(_0x86e9db){logger[_0x518d('0xf')](_0x518d('0x1e'),_0x86e9db[_0x518d('0x11')],_0x59825a);_0x2cf89e(_0x26e7b9['error'](0x1f4,_0x86e9db[_0x518d('0x11')]));});});};exports[_0x518d('0x20')]=function(_0x4813b1){var _0x2b8194=this;return new Promise(function(_0x40ae7c,_0x2960bd){return db['FreshdeskAccount']['find']({'raw':_0x4813b1[_0x518d('0x15')]?_0x4813b1[_0x518d('0x15')][_0x518d('0x16')]===undefined?!![]:![]:!![],'where':_0x4813b1[_0x518d('0x15')]?_0x4813b1[_0x518d('0x15')]['where']||null:null,'attributes':_0x4813b1[_0x518d('0x15')]?_0x4813b1[_0x518d('0x15')][_0x518d('0x18')]||null:null,'include':_0x4813b1[_0x518d('0x15')]?_0x4813b1[_0x518d('0x15')]['include']?_[_0x518d('0x1b')](_0x4813b1[_0x518d('0x15')]['include'],function(_0x2cfe6b){return{'model':db[_0x2cfe6b[_0x518d('0x1c')]],'as':_0x2cfe6b['as'],'attributes':_0x2cfe6b['attributes'],'include':_0x2cfe6b[_0x518d('0x1a')]?_[_0x518d('0x1b')](_0x2cfe6b[_0x518d('0x1a')],function(_0x5c5e0e){return{'model':db[_0x5c5e0e['model']],'as':_0x5c5e0e['as'],'attributes':_0x5c5e0e[_0x518d('0x18')],'include':_0x5c5e0e[_0x518d('0x1a')]?_[_0x518d('0x1b')](_0x5c5e0e[_0x518d('0x1a')],function(_0x2da571){return{'model':db[_0x2da571[_0x518d('0x1c')]],'as':_0x2da571['as'],'attributes':_0x2da571[_0x518d('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bae38){logger[_0x518d('0xc')](_0x518d('0x20'),_0x4813b1);logger['debug'](_0x518d('0x20'),_0x4813b1,JSON[_0x518d('0x1f')](_0x3bae38));_0x40ae7c(_0x3bae38);})['catch'](function(_0x5afb6e){logger[_0x518d('0xf')](_0x518d('0x20'),_0x5afb6e[_0x518d('0x11')],_0x4813b1);_0x2960bd(_0x2b8194[_0x518d('0xf')](0x1f4,_0x5afb6e['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index fb268b2..96ca9e5 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 _0x5a01=['get','isAuthenticated','/:id','/:id/fields','/:id/subjects','/:id/tags','getTags','post','put','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller'];(function(_0x49a354,_0x5297d4){var _0x4cdf0b=function(_0xe84f06){while(--_0xe84f06){_0x49a354['push'](_0x49a354['shift']());}};_0x4cdf0b(++_0x5297d4);}(_0x5a01,0x13c));var _0x15a0=function(_0xadd417,_0x207028){_0xadd417=_0xadd417-0x0;var _0x5c79e7=_0x5a01[_0xadd417];return _0x5c79e7;};'use strict';var multer=require('multer');var util=require(_0x15a0('0x0'));var path=require(_0x15a0('0x1'));var timeout=require(_0x15a0('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x15a0('0x3'));var interaction=require(_0x15a0('0x4'));var config=require(_0x15a0('0x5'));var controller=require(_0x15a0('0x6'));router[_0x15a0('0x7')]('/',auth[_0x15a0('0x8')](),controller['index']);router[_0x15a0('0x7')](_0x15a0('0x9'),auth[_0x15a0('0x8')](),controller['show']);router['get'](_0x15a0('0xa'),auth[_0x15a0('0x8')](),controller['getFields']);router[_0x15a0('0x7')](_0x15a0('0xb'),auth[_0x15a0('0x8')](),controller['getSubjects']);router[_0x15a0('0x7')]('/:id/descriptions',auth[_0x15a0('0x8')](),controller['getDescriptions']);router[_0x15a0('0x7')](_0x15a0('0xc'),auth[_0x15a0('0x8')](),controller[_0x15a0('0xd')]);router[_0x15a0('0xe')]('/',auth[_0x15a0('0x8')](),controller['create']);router['post'](_0x15a0('0xc'),auth[_0x15a0('0x8')](),controller['setTags']);router[_0x15a0('0xf')](_0x15a0('0x9'),auth[_0x15a0('0x8')](),controller['update']);router[_0x15a0('0x10')]('/:id',auth[_0x15a0('0x8')](),controller[_0x15a0('0x11')]);module[_0x15a0('0x12')]=router; \ No newline at end of file +var _0xca36=['isAuthenticated','index','/:id','show','get','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','put','exports','util','path','express','Router','../../components/auth/service'];(function(_0x4c66d4,_0x40f224){var _0x3f953a=function(_0x37f0e6){while(--_0x37f0e6){_0x4c66d4['push'](_0x4c66d4['shift']());}};_0x3f953a(++_0x40f224);}(_0xca36,0x1e9));var _0x6ca3=function(_0x1f122f,_0x29d11f){_0x1f122f=_0x1f122f-0x0;var _0x2333a0=_0xca36[_0x1f122f];return _0x2333a0;};'use strict';var multer=require('multer');var util=require(_0x6ca3('0x0'));var path=require(_0x6ca3('0x1'));var timeout=require('connect-timeout');var express=require(_0x6ca3('0x2'));var router=express[_0x6ca3('0x3')]();var auth=require(_0x6ca3('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth[_0x6ca3('0x5')](),controller[_0x6ca3('0x6')]);router['get'](_0x6ca3('0x7'),auth[_0x6ca3('0x5')](),controller[_0x6ca3('0x8')]);router['get']('/:id/fields',auth[_0x6ca3('0x5')](),controller['getFields']);router[_0x6ca3('0x9')](_0x6ca3('0xa'),auth[_0x6ca3('0x5')](),controller[_0x6ca3('0xb')]);router[_0x6ca3('0x9')](_0x6ca3('0xc'),auth[_0x6ca3('0x5')](),controller[_0x6ca3('0xd')]);router['get'](_0x6ca3('0xe'),auth['isAuthenticated'](),controller['getTags']);router['post']('/',auth['isAuthenticated'](),controller[_0x6ca3('0xf')]);router[_0x6ca3('0x10')]('/:id/tags',auth[_0x6ca3('0x5')](),controller['setTags']);router[_0x6ca3('0x11')](_0x6ca3('0x7'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6ca3('0x7'),auth[_0x6ca3('0x5')](),controller['destroy']);module[_0x6ca3('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 011007e..3563a18 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 _0xd5e2=['sequelize','exports','STRING'];(function(_0xdfb2df,_0x20a1b8){var _0x532a95=function(_0xaabbe2){while(--_0xaabbe2){_0xdfb2df['push'](_0xdfb2df['shift']());}};_0x532a95(++_0x20a1b8);}(_0xd5e2,0x1bf));var _0x2d5e=function(_0x3fe280,_0x1d8260){_0x3fe280=_0x3fe280-0x0;var _0x2e833f=_0xd5e2[_0x3fe280];return _0x2e833f;};'use strict';var Sequelize=require(_0x2d5e('0x0'));module[_0x2d5e('0x1')]={'name':{'type':Sequelize[_0x2d5e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa20b=['STRING','sequelize','exports'];(function(_0x71b765,_0x3053f8){var _0x34cb24=function(_0x2dd237){while(--_0x2dd237){_0x71b765['push'](_0x71b765['shift']());}};_0x34cb24(++_0x3053f8);}(_0xa20b,0x18a));var _0xba20=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa20b[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xba20('0x0'));module[_0xba20('0x1')]={'name':{'type':Sequelize[_0xba20('0x2')]},'description':{'type':Sequelize[_0xba20('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 2287454..b6d1887 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 _0x9275=['FreshdeskField','getDescriptions','getTags','findOne','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','client','test','Sequelize','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','findAll','rows','show','params','rawAttributes','includeAll','include','options','FreshdeskConfiguration','find','create','body','destroy','getFields','hasOwnProperty','getSubjects'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x9275,0x130));var _0x5927=function(_0x296809,_0x1c9665){_0x296809=_0x296809-0x0;var _0x18c0d3=_0x9275[_0x296809];return _0x18c0d3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5927('0x0'));var rimraf=require(_0x5927('0x1'));var zipdir=require(_0x5927('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5927('0x3'));var moment=require(_0x5927('0x4'));var BPromise=require(_0x5927('0x5'));var Mustache=require(_0x5927('0x6'));var util=require(_0x5927('0x7'));var path=require('path');var sox=require(_0x5927('0x8'));var csv=require('to-csv');var ejs=require(_0x5927('0x9'));var fs=require('fs');var _=require(_0x5927('0xa'));var squel=require(_0x5927('0xb'));var crypto=require(_0x5927('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5927('0xd'));var toCsv=require(_0x5927('0xe'));var querystring=require(_0x5927('0xf'));var Papa=require(_0x5927('0x10'));var Redis=require(_0x5927('0x11'));var authService=require(_0x5927('0x12'));var qs=require(_0x5927('0x13'));var as=require(_0x5927('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5927('0x15'));var utils=require(_0x5927('0x16'));var config=require(_0x5927('0x17'));var db=require(_0x5927('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5927('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x16aa41,_0x1ec05b,_0x415f6b){if(_0x415f6b){var _0x2e39cc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2e39cc[_0x5927('0x1a')](_0x1ec05b)){return _0x16aa41;}else{throw new db[(_0x5927('0x1b'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x16aa41;}}function respondWithRpcPromise(_0xb69751,_0x41ce6c,_0x83e981,_0xd80a6a){return new BPromise(function(_0x4b2aaa,_0x3949c2){var _0x5d22f9=_0xd80a6a||client;return _0x5d22f9[_0x5927('0x1c')](_0xb69751,_0x83e981)[_0x5927('0x1d')](function(_0x268b8d){logger[_0x5927('0x1e')](_0x5927('0x1f'),_0x41ce6c,_0x5927('0x20'));logger[_0x5927('0x21')](_0x5927('0x22'),_0x41ce6c,_0x5927('0x20'),JSON[_0x5927('0x23')](_0x268b8d));if(_0x268b8d[_0x5927('0x24')]){if(_0x268b8d[_0x5927('0x24')][_0x5927('0x25')]===0x1f4){logger[_0x5927('0x24')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x41ce6c,_0x268b8d[_0x5927('0x24')][_0x5927('0x26')]);return _0x3949c2(_0x268b8d['error'][_0x5927('0x26')]);}logger[_0x5927('0x24')](_0x5927('0x1f'),_0x41ce6c,_0x268b8d[_0x5927('0x24')][_0x5927('0x26')]);return _0x4b2aaa(_0x268b8d[_0x5927('0x24')][_0x5927('0x26')]);}else{logger['info'](_0x5927('0x1f'),_0x41ce6c,_0x5927('0x20'));_0x4b2aaa(_0x268b8d[_0x5927('0x27')][_0x5927('0x26')]);}})[_0x5927('0x28')](function(_0x705d90){logger['error'](_0x5927('0x1f'),_0x41ce6c,_0x705d90);_0x3949c2(_0x705d90);});});}function respondWithStatusCode(_0xaed621,_0xffba83){_0xffba83=_0xffba83||0xcc;return function(_0xce49e3){if(_0xce49e3){return _0xaed621[_0x5927('0x29')](_0xffba83);}return _0xaed621[_0x5927('0x2a')](_0xffba83)[_0x5927('0x2b')]();};}function respondWithResult(_0x52ab9d,_0x1769bb){_0x1769bb=_0x1769bb||0xc8;return function(_0x158c01){if(_0x158c01){return _0x52ab9d[_0x5927('0x2a')](_0x1769bb)[_0x5927('0x2c')](_0x158c01);}};}function respondWithFilteredResult(_0x15a1a9,_0x668612){return function(_0xe4aec4){if(_0xe4aec4){var _0x43d8c2=_0xe4aec4[_0x5927('0x2d')],_0x37f33e=_0x668612[_0x5927('0x2e')],_0xa54868=_0x668612[_0x5927('0x2e')]+_0x668612['limit'],_0x244565;if(_0xa54868>=_0x43d8c2){_0xa54868=_0x43d8c2;_0x244565=0xc8;}else{_0x244565=0xce;}_0x15a1a9['status'](_0x244565);return _0x15a1a9[_0x5927('0x2f')](_0x5927('0x30'),_0x37f33e+'-'+_0xa54868+'/'+_0x43d8c2)['json'](_0xe4aec4);}return null;};}function patchUpdates(_0x59bddf){return function(_0x4a25c7){try{jsonpatch[_0x5927('0x31')](_0x4a25c7,_0x59bddf,!![]);}catch(_0x4a3f9e){return BPromise[_0x5927('0x32')](_0x4a3f9e);}return _0x4a25c7['save']();};}function saveUpdates(_0x38c52a,_0x1c33b4){return function(_0x2cd415){if(_0x2cd415){return _0x2cd415[_0x5927('0x33')](_0x38c52a)['then'](function(_0xdb091a){return _0xdb091a;});}return null;};}function removeEntity(_0xb93c83,_0x56bd64){return function(_0x4f136a){if(_0x4f136a){return _0x4f136a['destroy']()[_0x5927('0x1d')](function(){_0xb93c83[_0x5927('0x2a')](0xcc)[_0x5927('0x2b')]();});}};}function handleEntityNotFound(_0x56cbec,_0x2ed80e){return function(_0x5cd0c5){if(!_0x5cd0c5){_0x56cbec[_0x5927('0x29')](0x194);}return _0x5cd0c5;};}function handleError(_0x2ee5ac,_0x4a31b0){_0x4a31b0=_0x4a31b0||0x1f4;return function(_0x472903){logger['error'](_0x472903[_0x5927('0x34')]);if(_0x472903[_0x5927('0x35')]){delete _0x472903[_0x5927('0x35')];}_0x2ee5ac[_0x5927('0x2a')](_0x4a31b0)[_0x5927('0x36')](_0x472903);};}exports[_0x5927('0x37')]=function(_0x221a0a,_0x27cf7f){var _0x2695ff={},_0x58c701={},_0x40f532={'count':0x0,'rows':[]};var _0x36aa09=_[_0x5927('0x38')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x2baebd){return{'name':_0x2baebd[_0x5927('0x39')],'type':_0x2baebd[_0x5927('0x3a')]['key']};});_0x58c701[_0x5927('0x3b')]=_[_0x5927('0x38')](_0x36aa09,_0x5927('0x35'));_0x58c701[_0x5927('0x3c')]=_[_0x5927('0x3d')](_0x221a0a[_0x5927('0x3c')]);_0x58c701[_0x5927('0x3e')]=_[_0x5927('0x3f')](_0x58c701[_0x5927('0x3b')],_0x58c701[_0x5927('0x3c')]);_0x2695ff[_0x5927('0x40')]=_[_0x5927('0x3f')](_0x58c701[_0x5927('0x3b')],qs[_0x5927('0x41')](_0x221a0a['query'][_0x5927('0x41')]));_0x2695ff[_0x5927('0x40')]=_0x2695ff[_0x5927('0x40')][_0x5927('0x42')]?_0x2695ff['attributes']:_0x58c701['model'];if(!_0x221a0a[_0x5927('0x3c')]['hasOwnProperty'](_0x5927('0x43'))){_0x2695ff[_0x5927('0x44')]=qs['limit'](_0x221a0a[_0x5927('0x3c')][_0x5927('0x44')]);_0x2695ff['offset']=qs[_0x5927('0x2e')](_0x221a0a['query']['offset']);}_0x2695ff[_0x5927('0x45')]=qs[_0x5927('0x46')](_0x221a0a[_0x5927('0x3c')][_0x5927('0x46')]);_0x2695ff['where']=qs['filters'](_[_0x5927('0x47')](_0x221a0a[_0x5927('0x3c')],_0x58c701[_0x5927('0x3e')]),_0x36aa09);if(_0x221a0a[_0x5927('0x3c')][_0x5927('0x48')]){_0x2695ff[_0x5927('0x49')]=_['merge'](_0x2695ff[_0x5927('0x49')],{'$or':_[_0x5927('0x38')](_0x36aa09,function(_0x11c5ac){if(_0x11c5ac[_0x5927('0x3a')]!==_0x5927('0x4a')){var _0x1911d5={};_0x1911d5[_0x11c5ac[_0x5927('0x35')]]={'$like':'%'+_0x221a0a[_0x5927('0x3c')][_0x5927('0x48')]+'%'};return _0x1911d5;}})});}_0x2695ff=_[_0x5927('0x4b')]({},_0x2695ff,_0x221a0a['options']);var _0x3a2452={'where':_0x2695ff[_0x5927('0x49')]};return db['FreshdeskConfiguration'][_0x5927('0x2d')](_0x3a2452)[_0x5927('0x1d')](function(_0x4d0d1a){_0x40f532[_0x5927('0x2d')]=_0x4d0d1a;if(_0x221a0a[_0x5927('0x3c')]['includeAll']){_0x2695ff['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x5927('0x4c')](_0x2695ff);})['then'](function(_0x5c4290){_0x40f532[_0x5927('0x4d')]=_0x5c4290;return _0x40f532;})[_0x5927('0x1d')](respondWithFilteredResult(_0x27cf7f,_0x2695ff))[_0x5927('0x28')](handleError(_0x27cf7f,null));};exports[_0x5927('0x4e')]=function(_0x28a68a,_0x232bc6){var _0x2ce3d3={'raw':![],'where':{'id':_0x28a68a[_0x5927('0x4f')]['id']}},_0x43e861={};_0x43e861[_0x5927('0x3b')]=_[_0x5927('0x3d')](db['FreshdeskConfiguration'][_0x5927('0x50')]);_0x43e861[_0x5927('0x3c')]=_[_0x5927('0x3d')](_0x28a68a[_0x5927('0x3c')]);_0x43e861['filters']=_[_0x5927('0x3f')](_0x43e861['model'],_0x43e861[_0x5927('0x3c')]);_0x2ce3d3[_0x5927('0x40')]=_[_0x5927('0x3f')](_0x43e861['model'],qs[_0x5927('0x41')](_0x28a68a[_0x5927('0x3c')][_0x5927('0x41')]));_0x2ce3d3['attributes']=_0x2ce3d3[_0x5927('0x40')][_0x5927('0x42')]?_0x2ce3d3[_0x5927('0x40')]:_0x43e861[_0x5927('0x3b')];if(_0x28a68a[_0x5927('0x3c')][_0x5927('0x51')]){_0x2ce3d3[_0x5927('0x52')]=[{'all':!![]}];}_0x2ce3d3=_['merge']({},_0x2ce3d3,_0x28a68a[_0x5927('0x53')]);return db[_0x5927('0x54')][_0x5927('0x55')](_0x2ce3d3)['then'](handleEntityNotFound(_0x232bc6,null))[_0x5927('0x1d')](respondWithResult(_0x232bc6,null))[_0x5927('0x28')](handleError(_0x232bc6,null));};exports[_0x5927('0x56')]=function(_0x4703b7,_0x2313d4){return db[_0x5927('0x54')][_0x5927('0x56')](_0x4703b7[_0x5927('0x57')],{})[_0x5927('0x1d')](respondWithResult(_0x2313d4,0xc9))[_0x5927('0x28')](handleError(_0x2313d4,null));};exports['update']=function(_0x2b7548,_0x36c116){if(_0x2b7548[_0x5927('0x57')]['id']){delete _0x2b7548[_0x5927('0x57')]['id'];}return db[_0x5927('0x54')][_0x5927('0x55')]({'where':{'id':_0x2b7548[_0x5927('0x4f')]['id']}})['then'](handleEntityNotFound(_0x36c116,null))['then'](saveUpdates(_0x2b7548['body'],null))[_0x5927('0x1d')](respondWithResult(_0x36c116,null))[_0x5927('0x28')](handleError(_0x36c116,null));};exports[_0x5927('0x58')]=function(_0x25b827,_0x22d0f8){return db[_0x5927('0x54')][_0x5927('0x55')]({'where':{'id':_0x25b827['params']['id']}})['then'](handleEntityNotFound(_0x22d0f8,null))[_0x5927('0x1d')](removeEntity(_0x22d0f8,null))[_0x5927('0x28')](handleError(_0x22d0f8,null));};exports[_0x5927('0x59')]=function(_0x1e5d7b,_0x10250d,_0xe5eeb3){var _0x54e64f={};var _0x18da32={};var _0x35874e;var _0x5573de;return db[_0x5927('0x54')]['findOne']({'where':{'id':_0x1e5d7b[_0x5927('0x4f')]['id']}})[_0x5927('0x1d')](handleEntityNotFound(_0x10250d,null))[_0x5927('0x1d')](function(_0x1fb1cd){if(_0x1fb1cd){_0x35874e=_0x1fb1cd;_0x18da32['model']=_[_0x5927('0x3d')](db['FreshdeskField'][_0x5927('0x50')]);_0x18da32[_0x5927('0x3c')]=_['keys'](_0x1e5d7b[_0x5927('0x3c')]);_0x18da32[_0x5927('0x3e')]=_[_0x5927('0x3f')](_0x18da32[_0x5927('0x3b')],_0x18da32['query']);_0x54e64f[_0x5927('0x40')]=_['intersection'](_0x18da32[_0x5927('0x3b')],qs[_0x5927('0x41')](_0x1e5d7b[_0x5927('0x3c')]['fields']));_0x54e64f[_0x5927('0x40')]=_0x54e64f[_0x5927('0x40')]['length']?_0x54e64f['attributes']:_0x18da32[_0x5927('0x3b')];_0x54e64f['order']=qs['sort'](_0x1e5d7b[_0x5927('0x3c')][_0x5927('0x46')]);_0x54e64f[_0x5927('0x49')]=qs[_0x5927('0x3e')](_[_0x5927('0x47')](_0x1e5d7b[_0x5927('0x3c')],_0x18da32[_0x5927('0x3e')]));if(_0x1e5d7b['query'][_0x5927('0x48')]){_0x54e64f[_0x5927('0x49')]=_[_0x5927('0x4b')](_0x54e64f[_0x5927('0x49')],{'$or':_['map'](_0x54e64f['attributes'],function(_0x2dd1d8){var _0x11855c={};_0x11855c[_0x2dd1d8]={'$like':'%'+_0x1e5d7b[_0x5927('0x3c')][_0x5927('0x48')]+'%'};return _0x11855c;})});}_0x54e64f=_[_0x5927('0x4b')]({},_0x54e64f,_0x1e5d7b[_0x5927('0x53')]);return _0x35874e[_0x5927('0x59')](_0x54e64f);}})[_0x5927('0x1d')](function(_0x2cff80){if(_0x2cff80){_0x5573de=_0x2cff80['length'];if(!_0x1e5d7b['query'][_0x5927('0x5a')](_0x5927('0x43'))){_0x54e64f['limit']=qs[_0x5927('0x44')](_0x1e5d7b[_0x5927('0x3c')][_0x5927('0x44')]);_0x54e64f['offset']=qs[_0x5927('0x2e')](_0x1e5d7b[_0x5927('0x3c')][_0x5927('0x2e')]);}return _0x35874e['getFields'](_0x54e64f);}})[_0x5927('0x1d')](function(_0x116357){if(_0x116357){return _0x116357?{'count':_0x5573de,'rows':_0x116357}:null;}})[_0x5927('0x1d')](respondWithResult(_0x10250d,null))['catch'](handleError(_0x10250d,null));};exports[_0x5927('0x5b')]=function(_0x1ab966,_0x1b4fed,_0x142765){var _0x52986d={};var _0x21eecb={};var _0x4e28dc;var _0x488f78;return db[_0x5927('0x54')]['findOne']({'where':{'id':_0x1ab966[_0x5927('0x4f')]['id']}})[_0x5927('0x1d')](handleEntityNotFound(_0x1b4fed,null))[_0x5927('0x1d')](function(_0x49b8fe){if(_0x49b8fe){_0x4e28dc=_0x49b8fe;_0x21eecb[_0x5927('0x3b')]=_['keys'](db[_0x5927('0x5c')]['rawAttributes']);_0x21eecb[_0x5927('0x3c')]=_[_0x5927('0x3d')](_0x1ab966['query']);_0x21eecb[_0x5927('0x3e')]=_[_0x5927('0x3f')](_0x21eecb[_0x5927('0x3b')],_0x21eecb['query']);_0x52986d[_0x5927('0x40')]=_['intersection'](_0x21eecb[_0x5927('0x3b')],qs[_0x5927('0x41')](_0x1ab966['query'][_0x5927('0x41')]));_0x52986d[_0x5927('0x40')]=_0x52986d[_0x5927('0x40')]['length']?_0x52986d[_0x5927('0x40')]:_0x21eecb[_0x5927('0x3b')];_0x52986d['order']=qs[_0x5927('0x46')](_0x1ab966[_0x5927('0x3c')]['sort']);_0x52986d[_0x5927('0x49')]=qs['filters'](_[_0x5927('0x47')](_0x1ab966[_0x5927('0x3c')],_0x21eecb[_0x5927('0x3e')]));if(_0x1ab966[_0x5927('0x3c')][_0x5927('0x48')]){_0x52986d['where']=_[_0x5927('0x4b')](_0x52986d[_0x5927('0x49')],{'$or':_['map'](_0x52986d[_0x5927('0x40')],function(_0x5eeb1f){var _0x3ff076={};_0x3ff076[_0x5eeb1f]={'$like':'%'+_0x1ab966[_0x5927('0x3c')][_0x5927('0x48')]+'%'};return _0x3ff076;})});}_0x52986d=_[_0x5927('0x4b')]({},_0x52986d,_0x1ab966['options']);return _0x4e28dc[_0x5927('0x5b')](_0x52986d);}})['then'](function(_0x2731cb){if(_0x2731cb){_0x488f78=_0x2731cb[_0x5927('0x42')];if(!_0x1ab966['query'][_0x5927('0x5a')](_0x5927('0x43'))){_0x52986d[_0x5927('0x44')]=qs['limit'](_0x1ab966[_0x5927('0x3c')][_0x5927('0x44')]);_0x52986d[_0x5927('0x2e')]=qs[_0x5927('0x2e')](_0x1ab966[_0x5927('0x3c')][_0x5927('0x2e')]);}return _0x4e28dc['getSubjects'](_0x52986d);}})[_0x5927('0x1d')](function(_0x1c8531){if(_0x1c8531){return _0x1c8531?{'count':_0x488f78,'rows':_0x1c8531}:null;}})[_0x5927('0x1d')](respondWithResult(_0x1b4fed,null))['catch'](handleError(_0x1b4fed,null));};exports[_0x5927('0x5d')]=function(_0x19d63d,_0x3d1015,_0x2963f4){var _0x39579e={};var _0x3745bc={};var _0x9fb680;var _0x3773ce;return db[_0x5927('0x54')]['findOne']({'where':{'id':_0x19d63d[_0x5927('0x4f')]['id']}})[_0x5927('0x1d')](handleEntityNotFound(_0x3d1015,null))['then'](function(_0x2008ff){if(_0x2008ff){_0x9fb680=_0x2008ff;_0x3745bc[_0x5927('0x3b')]=_[_0x5927('0x3d')](db[_0x5927('0x5c')]['rawAttributes']);_0x3745bc[_0x5927('0x3c')]=_['keys'](_0x19d63d[_0x5927('0x3c')]);_0x3745bc[_0x5927('0x3e')]=_[_0x5927('0x3f')](_0x3745bc[_0x5927('0x3b')],_0x3745bc[_0x5927('0x3c')]);_0x39579e[_0x5927('0x40')]=_['intersection'](_0x3745bc[_0x5927('0x3b')],qs[_0x5927('0x41')](_0x19d63d[_0x5927('0x3c')][_0x5927('0x41')]));_0x39579e[_0x5927('0x40')]=_0x39579e[_0x5927('0x40')]['length']?_0x39579e[_0x5927('0x40')]:_0x3745bc[_0x5927('0x3b')];_0x39579e[_0x5927('0x45')]=qs['sort'](_0x19d63d[_0x5927('0x3c')][_0x5927('0x46')]);_0x39579e[_0x5927('0x49')]=qs['filters'](_['pick'](_0x19d63d[_0x5927('0x3c')],_0x3745bc[_0x5927('0x3e')]));if(_0x19d63d[_0x5927('0x3c')]['filter']){_0x39579e[_0x5927('0x49')]=_['merge'](_0x39579e[_0x5927('0x49')],{'$or':_[_0x5927('0x38')](_0x39579e[_0x5927('0x40')],function(_0x397759){var _0x4214df={};_0x4214df[_0x397759]={'$like':'%'+_0x19d63d[_0x5927('0x3c')][_0x5927('0x48')]+'%'};return _0x4214df;})});}_0x39579e=_['merge']({},_0x39579e,_0x19d63d[_0x5927('0x53')]);return _0x9fb680[_0x5927('0x5d')](_0x39579e);}})['then'](function(_0xed0cc){if(_0xed0cc){_0x3773ce=_0xed0cc[_0x5927('0x42')];if(!_0x19d63d[_0x5927('0x3c')][_0x5927('0x5a')](_0x5927('0x43'))){_0x39579e['limit']=qs[_0x5927('0x44')](_0x19d63d[_0x5927('0x3c')]['limit']);_0x39579e['offset']=qs[_0x5927('0x2e')](_0x19d63d['query'][_0x5927('0x2e')]);}return _0x9fb680['getDescriptions'](_0x39579e);}})[_0x5927('0x1d')](function(_0x329ba2){if(_0x329ba2){return _0x329ba2?{'count':_0x3773ce,'rows':_0x329ba2}:null;}})['then'](respondWithResult(_0x3d1015,null))[_0x5927('0x28')](handleError(_0x3d1015,null));};exports[_0x5927('0x5e')]=function(_0x46135b,_0xed732d,_0x14b34c){var _0x1a4743={};var _0x20f201={};var _0x2a3f8a;var _0x36822e;return db[_0x5927('0x54')][_0x5927('0x5f')]({'where':{'id':_0x46135b[_0x5927('0x4f')]['id']}})[_0x5927('0x1d')](handleEntityNotFound(_0xed732d,null))[_0x5927('0x1d')](function(_0x439aef){if(_0x439aef){_0x2a3f8a=_0x439aef;_0x20f201[_0x5927('0x3b')]=_[_0x5927('0x3d')](db[_0x5927('0x60')][_0x5927('0x50')]);_0x20f201['query']=_[_0x5927('0x3d')](_0x46135b[_0x5927('0x3c')]);_0x20f201[_0x5927('0x3e')]=_[_0x5927('0x3f')](_0x20f201[_0x5927('0x3b')],_0x20f201[_0x5927('0x3c')]);_0x1a4743[_0x5927('0x40')]=_['intersection'](_0x20f201[_0x5927('0x3b')],qs[_0x5927('0x41')](_0x46135b[_0x5927('0x3c')]['fields']));_0x1a4743[_0x5927('0x40')]=_0x1a4743['attributes']['length']?_0x1a4743[_0x5927('0x40')]:_0x20f201[_0x5927('0x3b')];_0x1a4743[_0x5927('0x45')]=qs[_0x5927('0x46')](_0x46135b[_0x5927('0x3c')]['sort']);_0x1a4743['where']=qs[_0x5927('0x3e')](_[_0x5927('0x47')](_0x46135b[_0x5927('0x3c')],_0x20f201[_0x5927('0x3e')]));if(_0x46135b[_0x5927('0x3c')][_0x5927('0x48')]){_0x1a4743[_0x5927('0x49')]=_[_0x5927('0x4b')](_0x1a4743[_0x5927('0x49')],{'$or':_[_0x5927('0x38')](_0x1a4743[_0x5927('0x40')],function(_0x4a610b){var _0x3405fc={};_0x3405fc[_0x4a610b]={'$like':'%'+_0x46135b[_0x5927('0x3c')][_0x5927('0x48')]+'%'};return _0x3405fc;})});}_0x1a4743=_[_0x5927('0x4b')]({},_0x1a4743,_0x46135b['options']);return _0x2a3f8a['getTags'](_0x1a4743);}})[_0x5927('0x1d')](function(_0x276adc){if(_0x276adc){_0x36822e=_0x276adc[_0x5927('0x42')];if(!_0x46135b[_0x5927('0x3c')]['hasOwnProperty'](_0x5927('0x43'))){_0x1a4743[_0x5927('0x44')]=qs[_0x5927('0x44')](_0x46135b[_0x5927('0x3c')]['limit']);_0x1a4743[_0x5927('0x2e')]=qs[_0x5927('0x2e')](_0x46135b[_0x5927('0x3c')]['offset']);}return _0x2a3f8a[_0x5927('0x5e')](_0x1a4743);}})[_0x5927('0x1d')](function(_0x37939e){if(_0x37939e){return _0x37939e?{'count':_0x36822e,'rows':_0x37939e}:null;}})[_0x5927('0x1d')](respondWithResult(_0xed732d,null))['catch'](handleError(_0xed732d,null));};exports['setTags']=function(_0x456db9,_0x568cd5,_0x552dd6){if(_0x456db9[_0x5927('0x57')]['id']){delete _0x456db9[_0x5927('0x57')]['id'];}return db[_0x5927('0x54')][_0x5927('0x5f')]({'where':{'id':_0x456db9[_0x5927('0x4f')]['id']}})['then'](handleEntityNotFound(_0x568cd5,null))[_0x5927('0x1d')](function(_0x38b9f6){if(_0x38b9f6){return _0x38b9f6[_0x5927('0x61')](_0x456db9[_0x5927('0x57')][_0x5927('0x62')]||[]);}return null;})[_0x5927('0x1d')](respondWithResult(_0x568cd5,null))[_0x5927('0x28')](handleError(_0x568cd5,null));}; \ No newline at end of file +var _0x3cd8=['index','FreshdeskConfiguration','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','VIRTUAL','includeAll','findAll','show','params','include','find','create','body','getFields','findOne','FreshdeskField','filter','getSubjects','options','getDescriptions','Tag','getTags','setTags','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','update','destroy','name','send'];(function(_0x336a53,_0x3a309b){var _0x2b396a=function(_0x373785){while(--_0x373785){_0x336a53['push'](_0x336a53['shift']());}};_0x2b396a(++_0x3a309b);}(_0x3cd8,0x150));var _0x83cd=function(_0x1a89ca,_0x27394b){_0x1a89ca=_0x1a89ca-0x0;var _0x29cbb2=_0x3cd8[_0x1a89ca];return _0x29cbb2;};'use strict';var pdf=require(_0x83cd('0x0'));var emlformat=require(_0x83cd('0x1'));var rimraf=require(_0x83cd('0x2'));var zipdir=require(_0x83cd('0x3'));var jsonpatch=require(_0x83cd('0x4'));var rp=require(_0x83cd('0x5'));var moment=require(_0x83cd('0x6'));var BPromise=require(_0x83cd('0x7'));var Mustache=require('mustache');var util=require(_0x83cd('0x8'));var path=require(_0x83cd('0x9'));var sox=require(_0x83cd('0xa'));var csv=require(_0x83cd('0xb'));var ejs=require(_0x83cd('0xc'));var fs=require('fs');var _=require(_0x83cd('0xd'));var squel=require(_0x83cd('0xe'));var crypto=require(_0x83cd('0xf'));var jsforce=require(_0x83cd('0x10'));var deskjs=require(_0x83cd('0x11'));var toCsv=require(_0x83cd('0xb'));var querystring=require(_0x83cd('0x12'));var Papa=require(_0x83cd('0x13'));var Redis=require(_0x83cd('0x14'));var authService=require(_0x83cd('0x15'));var qs=require(_0x83cd('0x16'));var as=require(_0x83cd('0x17'));var hardwareService=require(_0x83cd('0x18'));var logger=require(_0x83cd('0x19'))(_0x83cd('0x1a'));var utils=require('../../config/utils');var config=require(_0x83cd('0x1b'));var db=require(_0x83cd('0x1c'))['db'];var jayson=require(_0x83cd('0x1d'));var client=jayson[_0x83cd('0x1e')][_0x83cd('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x1d4114,_0x29e094,_0x1af3f1){if(_0x1af3f1){var _0x4c3ed7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4c3ed7[_0x83cd('0x20')](_0x29e094)){return _0x1d4114;}else{throw new db[(_0x83cd('0x21'))][(_0x83cd('0x22'))](_0x83cd('0x23'));}}else{return _0x1d4114;}}function respondWithRpcPromise(_0x2adc87,_0x385166,_0x501688,_0x4df635){return new BPromise(function(_0x268f58,_0x40ba0f){var _0x2eafe7=_0x4df635||client;return _0x2eafe7[_0x83cd('0x24')](_0x2adc87,_0x501688)[_0x83cd('0x25')](function(_0x3d6303){logger[_0x83cd('0x26')](_0x83cd('0x27'),_0x385166,'request\x20sent');logger[_0x83cd('0x28')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x385166,_0x83cd('0x29'),JSON[_0x83cd('0x2a')](_0x3d6303));if(_0x3d6303[_0x83cd('0x2b')]){if(_0x3d6303['error']['code']===0x1f4){logger[_0x83cd('0x2b')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x385166,_0x3d6303[_0x83cd('0x2b')][_0x83cd('0x2c')]);return _0x40ba0f(_0x3d6303['error'][_0x83cd('0x2c')]);}logger[_0x83cd('0x2b')](_0x83cd('0x27'),_0x385166,_0x3d6303[_0x83cd('0x2b')][_0x83cd('0x2c')]);return _0x268f58(_0x3d6303[_0x83cd('0x2b')][_0x83cd('0x2c')]);}else{logger[_0x83cd('0x26')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x385166,'request\x20sent');_0x268f58(_0x3d6303[_0x83cd('0x2d')]['message']);}})[_0x83cd('0x2e')](function(_0x2a99aa){logger[_0x83cd('0x2b')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x385166,_0x2a99aa);_0x40ba0f(_0x2a99aa);});});}function respondWithStatusCode(_0x30c29e,_0x33bb16){_0x33bb16=_0x33bb16||0xcc;return function(_0x3558fa){if(_0x3558fa){return _0x30c29e[_0x83cd('0x2f')](_0x33bb16);}return _0x30c29e[_0x83cd('0x30')](_0x33bb16)[_0x83cd('0x31')]();};}function respondWithResult(_0x14ab2e,_0x40b03d){_0x40b03d=_0x40b03d||0xc8;return function(_0x5a9899){if(_0x5a9899){return _0x14ab2e[_0x83cd('0x30')](_0x40b03d)[_0x83cd('0x32')](_0x5a9899);}};}function respondWithFilteredResult(_0x55f5c6,_0x3e468e){return function(_0x78734f){if(_0x78734f){var _0x9dbb16=_0x78734f[_0x83cd('0x33')],_0x317546=_0x3e468e[_0x83cd('0x34')],_0x1df0ef=_0x3e468e['offset']+_0x3e468e[_0x83cd('0x35')],_0x3eb69c;if(_0x1df0ef>=_0x9dbb16){_0x1df0ef=_0x9dbb16;_0x3eb69c=0xc8;}else{_0x3eb69c=0xce;}_0x55f5c6[_0x83cd('0x30')](_0x3eb69c);return _0x55f5c6['set'](_0x83cd('0x36'),_0x317546+'-'+_0x1df0ef+'/'+_0x9dbb16)[_0x83cd('0x32')](_0x78734f);}return null;};}function patchUpdates(_0x58cbe8){return function(_0x5eede6){try{jsonpatch['apply'](_0x5eede6,_0x58cbe8,!![]);}catch(_0x418452){return BPromise[_0x83cd('0x37')](_0x418452);}return _0x5eede6['save']();};}function saveUpdates(_0xce66f5,_0x3abd40){return function(_0x256984){if(_0x256984){return _0x256984[_0x83cd('0x38')](_0xce66f5)[_0x83cd('0x25')](function(_0x228f82){return _0x228f82;});}return null;};}function removeEntity(_0x1600ca,_0x27a88a){return function(_0x3a7a1e){if(_0x3a7a1e){return _0x3a7a1e[_0x83cd('0x39')]()[_0x83cd('0x25')](function(){_0x1600ca['status'](0xcc)[_0x83cd('0x31')]();});}};}function handleEntityNotFound(_0x1c9785,_0xbe4d9d){return function(_0x3d26c3){if(!_0x3d26c3){_0x1c9785['sendStatus'](0x194);}return _0x3d26c3;};}function handleError(_0x5edb25,_0x513cf0){_0x513cf0=_0x513cf0||0x1f4;return function(_0x4aec79){logger['error'](_0x4aec79['stack']);if(_0x4aec79['name']){delete _0x4aec79[_0x83cd('0x3a')];}_0x5edb25[_0x83cd('0x30')](_0x513cf0)[_0x83cd('0x3b')](_0x4aec79);};}exports[_0x83cd('0x3c')]=function(_0x40f941,_0x2c87aa){var _0x58a782={},_0x8f801a={},_0x3c2bc9={'count':0x0,'rows':[]};var _0xc4c9f6=_['map'](db[_0x83cd('0x3d')][_0x83cd('0x3e')],function(_0x40a206){return{'name':_0x40a206['fieldName'],'type':_0x40a206['type'][_0x83cd('0x3f')]};});_0x8f801a[_0x83cd('0x40')]=_['map'](_0xc4c9f6,_0x83cd('0x3a'));_0x8f801a[_0x83cd('0x41')]=_[_0x83cd('0x42')](_0x40f941[_0x83cd('0x41')]);_0x8f801a[_0x83cd('0x43')]=_['intersection'](_0x8f801a[_0x83cd('0x40')],_0x8f801a['query']);_0x58a782[_0x83cd('0x44')]=_[_0x83cd('0x45')](_0x8f801a[_0x83cd('0x40')],qs[_0x83cd('0x46')](_0x40f941['query'][_0x83cd('0x46')]));_0x58a782[_0x83cd('0x44')]=_0x58a782['attributes'][_0x83cd('0x47')]?_0x58a782[_0x83cd('0x44')]:_0x8f801a['model'];if(!_0x40f941['query'][_0x83cd('0x48')](_0x83cd('0x49'))){_0x58a782[_0x83cd('0x35')]=qs['limit'](_0x40f941[_0x83cd('0x41')][_0x83cd('0x35')]);_0x58a782[_0x83cd('0x34')]=qs['offset'](_0x40f941['query'][_0x83cd('0x34')]);}_0x58a782[_0x83cd('0x4a')]=qs[_0x83cd('0x4b')](_0x40f941[_0x83cd('0x41')]['sort']);_0x58a782['where']=qs[_0x83cd('0x43')](_[_0x83cd('0x4c')](_0x40f941['query'],_0x8f801a[_0x83cd('0x43')]),_0xc4c9f6);if(_0x40f941[_0x83cd('0x41')]['filter']){_0x58a782[_0x83cd('0x4d')]=_[_0x83cd('0x4e')](_0x58a782[_0x83cd('0x4d')],{'$or':_[_0x83cd('0x4f')](_0xc4c9f6,function(_0x241de0){if(_0x241de0['type']!==_0x83cd('0x50')){var _0x48e259={};_0x48e259[_0x241de0['name']]={'$like':'%'+_0x40f941['query']['filter']+'%'};return _0x48e259;}})});}_0x58a782=_[_0x83cd('0x4e')]({},_0x58a782,_0x40f941['options']);var _0x11ecae={'where':_0x58a782['where']};return db['FreshdeskConfiguration'][_0x83cd('0x33')](_0x11ecae)[_0x83cd('0x25')](function(_0x5edb06){_0x3c2bc9['count']=_0x5edb06;if(_0x40f941[_0x83cd('0x41')][_0x83cd('0x51')]){_0x58a782['include']=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x83cd('0x52')](_0x58a782);})[_0x83cd('0x25')](function(_0x38c9af){_0x3c2bc9['rows']=_0x38c9af;return _0x3c2bc9;})[_0x83cd('0x25')](respondWithFilteredResult(_0x2c87aa,_0x58a782))[_0x83cd('0x2e')](handleError(_0x2c87aa,null));};exports[_0x83cd('0x53')]=function(_0x3d04a1,_0x1df0d4){var _0x1e01af={'raw':![],'where':{'id':_0x3d04a1[_0x83cd('0x54')]['id']}},_0x130222={};_0x130222[_0x83cd('0x40')]=_['keys'](db[_0x83cd('0x3d')][_0x83cd('0x3e')]);_0x130222['query']=_[_0x83cd('0x42')](_0x3d04a1['query']);_0x130222['filters']=_['intersection'](_0x130222[_0x83cd('0x40')],_0x130222[_0x83cd('0x41')]);_0x1e01af[_0x83cd('0x44')]=_['intersection'](_0x130222[_0x83cd('0x40')],qs[_0x83cd('0x46')](_0x3d04a1['query'][_0x83cd('0x46')]));_0x1e01af['attributes']=_0x1e01af['attributes'][_0x83cd('0x47')]?_0x1e01af[_0x83cd('0x44')]:_0x130222[_0x83cd('0x40')];if(_0x3d04a1[_0x83cd('0x41')][_0x83cd('0x51')]){_0x1e01af[_0x83cd('0x55')]=[{'all':!![]}];}_0x1e01af=_[_0x83cd('0x4e')]({},_0x1e01af,_0x3d04a1['options']);return db[_0x83cd('0x3d')][_0x83cd('0x56')](_0x1e01af)[_0x83cd('0x25')](handleEntityNotFound(_0x1df0d4,null))[_0x83cd('0x25')](respondWithResult(_0x1df0d4,null))[_0x83cd('0x2e')](handleError(_0x1df0d4,null));};exports[_0x83cd('0x57')]=function(_0x5e351a,_0x14c335){return db[_0x83cd('0x3d')][_0x83cd('0x57')](_0x5e351a[_0x83cd('0x58')],{})[_0x83cd('0x25')](respondWithResult(_0x14c335,0xc9))[_0x83cd('0x2e')](handleError(_0x14c335,null));};exports['update']=function(_0x672299,_0x41508d){if(_0x672299[_0x83cd('0x58')]['id']){delete _0x672299[_0x83cd('0x58')]['id'];}return db['FreshdeskConfiguration'][_0x83cd('0x56')]({'where':{'id':_0x672299['params']['id']}})[_0x83cd('0x25')](handleEntityNotFound(_0x41508d,null))[_0x83cd('0x25')](saveUpdates(_0x672299[_0x83cd('0x58')],null))[_0x83cd('0x25')](respondWithResult(_0x41508d,null))[_0x83cd('0x2e')](handleError(_0x41508d,null));};exports['destroy']=function(_0x18997c,_0x202c48){return db[_0x83cd('0x3d')][_0x83cd('0x56')]({'where':{'id':_0x18997c[_0x83cd('0x54')]['id']}})[_0x83cd('0x25')](handleEntityNotFound(_0x202c48,null))[_0x83cd('0x25')](removeEntity(_0x202c48,null))[_0x83cd('0x2e')](handleError(_0x202c48,null));};exports[_0x83cd('0x59')]=function(_0x2591c9,_0x171b38,_0x3a247d){var _0x488e59={};var _0x7675ce={};var _0x31cdf5;var _0x4bb33a;return db[_0x83cd('0x3d')][_0x83cd('0x5a')]({'where':{'id':_0x2591c9['params']['id']}})[_0x83cd('0x25')](handleEntityNotFound(_0x171b38,null))['then'](function(_0x2f0d05){if(_0x2f0d05){_0x31cdf5=_0x2f0d05;_0x7675ce[_0x83cd('0x40')]=_['keys'](db[_0x83cd('0x5b')][_0x83cd('0x3e')]);_0x7675ce[_0x83cd('0x41')]=_['keys'](_0x2591c9[_0x83cd('0x41')]);_0x7675ce[_0x83cd('0x43')]=_['intersection'](_0x7675ce[_0x83cd('0x40')],_0x7675ce[_0x83cd('0x41')]);_0x488e59['attributes']=_['intersection'](_0x7675ce[_0x83cd('0x40')],qs['fields'](_0x2591c9['query'][_0x83cd('0x46')]));_0x488e59[_0x83cd('0x44')]=_0x488e59[_0x83cd('0x44')][_0x83cd('0x47')]?_0x488e59[_0x83cd('0x44')]:_0x7675ce[_0x83cd('0x40')];_0x488e59[_0x83cd('0x4a')]=qs[_0x83cd('0x4b')](_0x2591c9[_0x83cd('0x41')][_0x83cd('0x4b')]);_0x488e59[_0x83cd('0x4d')]=qs[_0x83cd('0x43')](_[_0x83cd('0x4c')](_0x2591c9['query'],_0x7675ce[_0x83cd('0x43')]));if(_0x2591c9[_0x83cd('0x41')][_0x83cd('0x5c')]){_0x488e59['where']=_[_0x83cd('0x4e')](_0x488e59[_0x83cd('0x4d')],{'$or':_[_0x83cd('0x4f')](_0x488e59[_0x83cd('0x44')],function(_0x1e9a0a){var _0x319e7a={};_0x319e7a[_0x1e9a0a]={'$like':'%'+_0x2591c9[_0x83cd('0x41')]['filter']+'%'};return _0x319e7a;})});}_0x488e59=_[_0x83cd('0x4e')]({},_0x488e59,_0x2591c9['options']);return _0x31cdf5[_0x83cd('0x59')](_0x488e59);}})[_0x83cd('0x25')](function(_0x35e8d8){if(_0x35e8d8){_0x4bb33a=_0x35e8d8[_0x83cd('0x47')];if(!_0x2591c9[_0x83cd('0x41')]['hasOwnProperty'](_0x83cd('0x49'))){_0x488e59['limit']=qs[_0x83cd('0x35')](_0x2591c9['query'][_0x83cd('0x35')]);_0x488e59[_0x83cd('0x34')]=qs[_0x83cd('0x34')](_0x2591c9[_0x83cd('0x41')]['offset']);}return _0x31cdf5[_0x83cd('0x59')](_0x488e59);}})[_0x83cd('0x25')](function(_0x4e2aef){if(_0x4e2aef){return _0x4e2aef?{'count':_0x4bb33a,'rows':_0x4e2aef}:null;}})[_0x83cd('0x25')](respondWithResult(_0x171b38,null))[_0x83cd('0x2e')](handleError(_0x171b38,null));};exports[_0x83cd('0x5d')]=function(_0x753451,_0x4f3eba,_0x8d3739){var _0x570239={};var _0x558635={};var _0x2281d5;var _0x2259f3;return db[_0x83cd('0x3d')][_0x83cd('0x5a')]({'where':{'id':_0x753451[_0x83cd('0x54')]['id']}})[_0x83cd('0x25')](handleEntityNotFound(_0x4f3eba,null))['then'](function(_0x2faada){if(_0x2faada){_0x2281d5=_0x2faada;_0x558635[_0x83cd('0x40')]=_[_0x83cd('0x42')](db['FreshdeskField']['rawAttributes']);_0x558635[_0x83cd('0x41')]=_[_0x83cd('0x42')](_0x753451[_0x83cd('0x41')]);_0x558635['filters']=_[_0x83cd('0x45')](_0x558635[_0x83cd('0x40')],_0x558635[_0x83cd('0x41')]);_0x570239[_0x83cd('0x44')]=_[_0x83cd('0x45')](_0x558635[_0x83cd('0x40')],qs[_0x83cd('0x46')](_0x753451[_0x83cd('0x41')][_0x83cd('0x46')]));_0x570239['attributes']=_0x570239[_0x83cd('0x44')][_0x83cd('0x47')]?_0x570239[_0x83cd('0x44')]:_0x558635[_0x83cd('0x40')];_0x570239[_0x83cd('0x4a')]=qs['sort'](_0x753451[_0x83cd('0x41')]['sort']);_0x570239['where']=qs[_0x83cd('0x43')](_[_0x83cd('0x4c')](_0x753451[_0x83cd('0x41')],_0x558635[_0x83cd('0x43')]));if(_0x753451[_0x83cd('0x41')][_0x83cd('0x5c')]){_0x570239['where']=_[_0x83cd('0x4e')](_0x570239[_0x83cd('0x4d')],{'$or':_[_0x83cd('0x4f')](_0x570239[_0x83cd('0x44')],function(_0x715c84){var _0xe0afd4={};_0xe0afd4[_0x715c84]={'$like':'%'+_0x753451['query'][_0x83cd('0x5c')]+'%'};return _0xe0afd4;})});}_0x570239=_['merge']({},_0x570239,_0x753451[_0x83cd('0x5e')]);return _0x2281d5['getSubjects'](_0x570239);}})[_0x83cd('0x25')](function(_0xc60887){if(_0xc60887){_0x2259f3=_0xc60887[_0x83cd('0x47')];if(!_0x753451[_0x83cd('0x41')][_0x83cd('0x48')](_0x83cd('0x49'))){_0x570239[_0x83cd('0x35')]=qs[_0x83cd('0x35')](_0x753451[_0x83cd('0x41')][_0x83cd('0x35')]);_0x570239[_0x83cd('0x34')]=qs[_0x83cd('0x34')](_0x753451['query'][_0x83cd('0x34')]);}return _0x2281d5[_0x83cd('0x5d')](_0x570239);}})[_0x83cd('0x25')](function(_0x485824){if(_0x485824){return _0x485824?{'count':_0x2259f3,'rows':_0x485824}:null;}})[_0x83cd('0x25')](respondWithResult(_0x4f3eba,null))[_0x83cd('0x2e')](handleError(_0x4f3eba,null));};exports['getDescriptions']=function(_0xfceed0,_0x343394,_0x31a47d){var _0x5cc770={};var _0x50460b={};var _0x52440d;var _0x18df75;return db['FreshdeskConfiguration'][_0x83cd('0x5a')]({'where':{'id':_0xfceed0[_0x83cd('0x54')]['id']}})[_0x83cd('0x25')](handleEntityNotFound(_0x343394,null))[_0x83cd('0x25')](function(_0x949740){if(_0x949740){_0x52440d=_0x949740;_0x50460b[_0x83cd('0x40')]=_[_0x83cd('0x42')](db[_0x83cd('0x5b')][_0x83cd('0x3e')]);_0x50460b[_0x83cd('0x41')]=_['keys'](_0xfceed0[_0x83cd('0x41')]);_0x50460b[_0x83cd('0x43')]=_[_0x83cd('0x45')](_0x50460b['model'],_0x50460b[_0x83cd('0x41')]);_0x5cc770[_0x83cd('0x44')]=_[_0x83cd('0x45')](_0x50460b[_0x83cd('0x40')],qs['fields'](_0xfceed0[_0x83cd('0x41')][_0x83cd('0x46')]));_0x5cc770[_0x83cd('0x44')]=_0x5cc770[_0x83cd('0x44')][_0x83cd('0x47')]?_0x5cc770['attributes']:_0x50460b[_0x83cd('0x40')];_0x5cc770[_0x83cd('0x4a')]=qs[_0x83cd('0x4b')](_0xfceed0[_0x83cd('0x41')][_0x83cd('0x4b')]);_0x5cc770['where']=qs[_0x83cd('0x43')](_[_0x83cd('0x4c')](_0xfceed0[_0x83cd('0x41')],_0x50460b[_0x83cd('0x43')]));if(_0xfceed0[_0x83cd('0x41')][_0x83cd('0x5c')]){_0x5cc770[_0x83cd('0x4d')]=_[_0x83cd('0x4e')](_0x5cc770[_0x83cd('0x4d')],{'$or':_[_0x83cd('0x4f')](_0x5cc770[_0x83cd('0x44')],function(_0xee9ec2){var _0x4f3424={};_0x4f3424[_0xee9ec2]={'$like':'%'+_0xfceed0[_0x83cd('0x41')][_0x83cd('0x5c')]+'%'};return _0x4f3424;})});}_0x5cc770=_['merge']({},_0x5cc770,_0xfceed0[_0x83cd('0x5e')]);return _0x52440d[_0x83cd('0x5f')](_0x5cc770);}})['then'](function(_0x204b8c){if(_0x204b8c){_0x18df75=_0x204b8c[_0x83cd('0x47')];if(!_0xfceed0[_0x83cd('0x41')]['hasOwnProperty']('nolimit')){_0x5cc770['limit']=qs[_0x83cd('0x35')](_0xfceed0[_0x83cd('0x41')][_0x83cd('0x35')]);_0x5cc770[_0x83cd('0x34')]=qs[_0x83cd('0x34')](_0xfceed0[_0x83cd('0x41')][_0x83cd('0x34')]);}return _0x52440d[_0x83cd('0x5f')](_0x5cc770);}})['then'](function(_0x4a3cbf){if(_0x4a3cbf){return _0x4a3cbf?{'count':_0x18df75,'rows':_0x4a3cbf}:null;}})[_0x83cd('0x25')](respondWithResult(_0x343394,null))[_0x83cd('0x2e')](handleError(_0x343394,null));};exports['getTags']=function(_0x373fc7,_0x1aed0d,_0x29c1d7){var _0x58f4fe={};var _0x21463c={};var _0x38b4f4;var _0x1cd499;return db['FreshdeskConfiguration'][_0x83cd('0x5a')]({'where':{'id':_0x373fc7['params']['id']}})[_0x83cd('0x25')](handleEntityNotFound(_0x1aed0d,null))['then'](function(_0x3ab840){if(_0x3ab840){_0x38b4f4=_0x3ab840;_0x21463c[_0x83cd('0x40')]=_[_0x83cd('0x42')](db[_0x83cd('0x60')][_0x83cd('0x3e')]);_0x21463c[_0x83cd('0x41')]=_['keys'](_0x373fc7[_0x83cd('0x41')]);_0x21463c['filters']=_[_0x83cd('0x45')](_0x21463c[_0x83cd('0x40')],_0x21463c['query']);_0x58f4fe[_0x83cd('0x44')]=_[_0x83cd('0x45')](_0x21463c['model'],qs[_0x83cd('0x46')](_0x373fc7['query'][_0x83cd('0x46')]));_0x58f4fe[_0x83cd('0x44')]=_0x58f4fe[_0x83cd('0x44')][_0x83cd('0x47')]?_0x58f4fe[_0x83cd('0x44')]:_0x21463c[_0x83cd('0x40')];_0x58f4fe[_0x83cd('0x4a')]=qs[_0x83cd('0x4b')](_0x373fc7[_0x83cd('0x41')]['sort']);_0x58f4fe[_0x83cd('0x4d')]=qs[_0x83cd('0x43')](_[_0x83cd('0x4c')](_0x373fc7[_0x83cd('0x41')],_0x21463c['filters']));if(_0x373fc7[_0x83cd('0x41')]['filter']){_0x58f4fe[_0x83cd('0x4d')]=_[_0x83cd('0x4e')](_0x58f4fe[_0x83cd('0x4d')],{'$or':_[_0x83cd('0x4f')](_0x58f4fe[_0x83cd('0x44')],function(_0x17b240){var _0xed0375={};_0xed0375[_0x17b240]={'$like':'%'+_0x373fc7[_0x83cd('0x41')]['filter']+'%'};return _0xed0375;})});}_0x58f4fe=_[_0x83cd('0x4e')]({},_0x58f4fe,_0x373fc7['options']);return _0x38b4f4['getTags'](_0x58f4fe);}})[_0x83cd('0x25')](function(_0x12bafe){if(_0x12bafe){_0x1cd499=_0x12bafe[_0x83cd('0x47')];if(!_0x373fc7['query']['hasOwnProperty'](_0x83cd('0x49'))){_0x58f4fe[_0x83cd('0x35')]=qs[_0x83cd('0x35')](_0x373fc7[_0x83cd('0x41')][_0x83cd('0x35')]);_0x58f4fe['offset']=qs[_0x83cd('0x34')](_0x373fc7[_0x83cd('0x41')][_0x83cd('0x34')]);}return _0x38b4f4[_0x83cd('0x61')](_0x58f4fe);}})[_0x83cd('0x25')](function(_0x31aa33){if(_0x31aa33){return _0x31aa33?{'count':_0x1cd499,'rows':_0x31aa33}:null;}})[_0x83cd('0x25')](respondWithResult(_0x1aed0d,null))['catch'](handleError(_0x1aed0d,null));};exports[_0x83cd('0x62')]=function(_0x1bd2ff,_0x222d4a,_0x56a931){if(_0x1bd2ff[_0x83cd('0x58')]['id']){delete _0x1bd2ff[_0x83cd('0x58')]['id'];}return db[_0x83cd('0x3d')][_0x83cd('0x5a')]({'where':{'id':_0x1bd2ff['params']['id']}})[_0x83cd('0x25')](handleEntityNotFound(_0x222d4a,null))[_0x83cd('0x25')](function(_0x736436){if(_0x736436){return _0x736436[_0x83cd('0x62')](_0x1bd2ff['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x222d4a,null))[_0x83cd('0x2e')](handleError(_0x222d4a,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 01c0c99..cd94481 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 _0x1cb9=['./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x525e2e,_0x4fbc46){var _0x21dc34=function(_0xfda188){while(--_0xfda188){_0x525e2e['push'](_0x525e2e['shift']());}};_0x21dc34(++_0x4fbc46);}(_0x1cb9,0x14e));var _0x91cb=function(_0xb63d7a,_0x423aa0){_0xb63d7a=_0xb63d7a-0x0;var _0x1f2c65=_0x1cb9[_0xb63d7a];return _0x1f2c65;};'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 fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','int_freshdesk_configurations'];(function(_0x42609e,_0x327305){var _0x158166=function(_0x5a9647){while(--_0x5a9647){_0x42609e['push'](_0x42609e['shift']());}};_0x158166(++_0x327305);}(_0x5fc3,0xa8));var _0x35fc=function(_0x39ffd1,_0x299703){_0x39ffd1=_0x39ffd1-0x0;var _0x31267e=_0x5fc3[_0x39ffd1];return _0x31267e;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('FreshdeskConfiguration',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index bafe8a2..cc15f8a 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 _0x263c=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','then','info','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','moment','ioredis'];(function(_0x2ea74f,_0x358a70){var _0x448bdc=function(_0x4db43c){while(--_0x4db43c){_0x2ea74f['push'](_0x2ea74f['shift']());}};_0x448bdc(++_0x358a70);}(_0x263c,0x174));var _0xc263=function(_0x234ae1,_0x42bdd6){_0x234ae1=_0x234ae1-0x0;var _0x227ba0=_0x263c[_0x234ae1];return _0x227ba0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc263('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc263('0x1'));var db=require(_0xc263('0x2'))['db'];var utils=require(_0xc263('0x3'));var logger=require(_0xc263('0x4'))('rpc');var config=require(_0xc263('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x21d590,_0xd5ceb,_0xfa7bba){return new BPromise(function(_0x315830,_0x33faa7){return client['request'](_0x21d590,_0xfa7bba)[_0xc263('0x6')](function(_0x395500){logger[_0xc263('0x7')](_0xc263('0x8'),_0xd5ceb,'request\x20sent');logger['debug'](_0xc263('0x9'),_0xd5ceb,'request\x20sent',JSON[_0xc263('0xa')](_0x395500));if(_0x395500[_0xc263('0xb')]){if(_0x395500[_0xc263('0xb')][_0xc263('0xc')]===0x1f4){logger[_0xc263('0xb')](_0xc263('0x8'),_0xd5ceb,_0x395500[_0xc263('0xb')][_0xc263('0xd')]);return _0x33faa7(_0x395500[_0xc263('0xb')][_0xc263('0xd')]);}logger[_0xc263('0xb')](_0xc263('0x8'),_0xd5ceb,_0x395500[_0xc263('0xb')][_0xc263('0xd')]);return _0x315830(_0x395500[_0xc263('0xb')]['message']);}else{logger[_0xc263('0x7')](_0xc263('0x8'),_0xd5ceb,_0xc263('0xe'));_0x315830(_0x395500[_0xc263('0xf')][_0xc263('0xd')]);}})[_0xc263('0x10')](function(_0x5db343){logger[_0xc263('0xb')](_0xc263('0x8'),_0xd5ceb,_0x5db343);_0x33faa7(_0x5db343);});});} \ No newline at end of file +var _0xad82=['stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x433971,_0x16e715){var _0x1d48e1=function(_0x1a94f0){while(--_0x1a94f0){_0x433971['push'](_0x433971['shift']());}};_0x1d48e1(++_0x16e715);}(_0xad82,0xec));var _0x2ad8=function(_0x10a889,_0x220612){_0x10a889=_0x10a889-0x0;var _0x3b5ed3=_0xad82[_0x10a889];return _0x3b5ed3;};'use strict';var _=require(_0x2ad8('0x0'));var util=require(_0x2ad8('0x1'));var moment=require(_0x2ad8('0x2'));var BPromise=require(_0x2ad8('0x3'));var rs=require(_0x2ad8('0x4'));var fs=require('fs');var Redis=require(_0x2ad8('0x5'));var db=require(_0x2ad8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ad8('0x7'))(_0x2ad8('0x8'));var config=require('../../config/environment');var jayson=require(_0x2ad8('0x9'));var client=jayson[_0x2ad8('0xa')][_0x2ad8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cb14f,_0x5037b5,_0x26273d){return new BPromise(function(_0x5d6298,_0x493939){return client[_0x2ad8('0xc')](_0x4cb14f,_0x26273d)[_0x2ad8('0xd')](function(_0x79e45a){logger['info'](_0x2ad8('0xe'),_0x5037b5,'request\x20sent');logger['debug'](_0x2ad8('0xf'),_0x5037b5,_0x2ad8('0x10'),JSON[_0x2ad8('0x11')](_0x79e45a));if(_0x79e45a['error']){if(_0x79e45a[_0x2ad8('0x12')]['code']===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x5037b5,_0x79e45a[_0x2ad8('0x12')][_0x2ad8('0x13')]);return _0x493939(_0x79e45a['error'][_0x2ad8('0x13')]);}logger[_0x2ad8('0x12')](_0x2ad8('0xe'),_0x5037b5,_0x79e45a[_0x2ad8('0x12')][_0x2ad8('0x13')]);return _0x5d6298(_0x79e45a['error'][_0x2ad8('0x13')]);}else{logger[_0x2ad8('0x14')](_0x2ad8('0xe'),_0x5037b5,_0x2ad8('0x10'));_0x5d6298(_0x79e45a[_0x2ad8('0x15')][_0x2ad8('0x13')]);}})[_0x2ad8('0x16')](function(_0xbd066){logger[_0x2ad8('0x12')](_0x2ad8('0xe'),_0x5037b5,_0xbd066);_0x493939(_0xbd066);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 412e2f0..75a1c82 100644 --- a/server/api/intFreshdeskField/index.js +++ b/server/api/intFreshdeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['show','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x44b3df,_0x3d8525){var _0x4fea62=function(_0x5f0178){while(--_0x5f0178){_0x44b3df['push'](_0x44b3df['shift']());}};_0x4fea62(++_0x3d8525);}(_0x008c,0x188));var _0xc008=function(_0xa7429c,_0x3f6c95){_0xa7429c=_0xa7429c-0x0;var _0x57aacc=_0x008c[_0xa7429c];return _0x57aacc;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['post']('/',auth[_0xc008('0xa')](),controller['create']);router['put'](_0xc008('0xc'),auth[_0xc008('0xa')](),controller['update']);router['delete']('/:id',auth[_0xc008('0xa')](),controller[_0xc008('0xe')]);module['exports']=router; \ No newline at end of file +var _0x34e8=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x5db657,_0x2f40b3){var _0x2d6e70=function(_0x358ed2){while(--_0x358ed2){_0x5db657['push'](_0x5db657['shift']());}};_0x2d6e70(++_0x2f40b3);}(_0x34e8,0x12c));var _0x834e=function(_0x57ec9e,_0x55be7f){_0x57ec9e=_0x57ec9e-0x0;var _0x52c2ee=_0x34e8[_0x57ec9e];return _0x52c2ee;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0xc')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')](_0x834e('0xf'),auth[_0x834e('0xa')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xf'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);module[_0x834e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 9339f34..82f51ee 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 _0xd2bb=['ENUM','BOOLEAN','exports','string','variable','customVariable','keyValue','STRING'];(function(_0x17e076,_0xd3924d){var _0x534f58=function(_0xb9bd09){while(--_0xb9bd09){_0x17e076['push'](_0x17e076['shift']());}};_0x534f58(++_0xd3924d);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x3d397e,_0x5ef8de){_0x3d397e=_0x3d397e-0x0;var _0x2c319d=_0xd2bb[_0x3d397e];return _0x2c319d;};'use strict';var Sequelize=require('sequelize');module[_0xbd2b('0x0')]={'type':{'type':Sequelize['ENUM'](_0xbd2b('0x1'),_0xbd2b('0x2'),_0xbd2b('0x3'),_0xbd2b('0x4')),'defaultValue':_0xbd2b('0x1')},'content':{'type':Sequelize[_0xbd2b('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xbd2b('0x6')](_0xbd2b('0x1'),_0xbd2b('0x2'),_0xbd2b('0x3'))},'keyContent':{'type':Sequelize[_0xbd2b('0x5')]},'idField':{'type':Sequelize[_0xbd2b('0x5')]},'nameField':{'type':Sequelize[_0xbd2b('0x5')]},'customField':{'type':Sequelize[_0xbd2b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbd2b('0x5')]}}; \ No newline at end of file +var _0x2d97=['BOOLEAN','exports','string','variable','keyValue','STRING','ENUM','customVariable'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x2d97,0x1f1));var _0x72d9=function(_0x37c2f,_0x2d5b93){_0x37c2f=_0x37c2f-0x0;var _0x1e2529=_0x2d97[_0x37c2f];return _0x1e2529;};'use strict';var Sequelize=require('sequelize');module[_0x72d9('0x0')]={'type':{'type':Sequelize['ENUM'](_0x72d9('0x1'),_0x72d9('0x2'),'customVariable',_0x72d9('0x3')),'defaultValue':_0x72d9('0x1')},'content':{'type':Sequelize[_0x72d9('0x4')]},'key':{'type':Sequelize[_0x72d9('0x4')]},'keyType':{'type':Sequelize[_0x72d9('0x5')](_0x72d9('0x1'),'variable',_0x72d9('0x6'))},'keyContent':{'type':Sequelize[_0x72d9('0x4')]},'idField':{'type':Sequelize[_0x72d9('0x4')]},'nameField':{'type':Sequelize[_0x72d9('0x4')]},'customField':{'type':Sequelize[_0x72d9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 2230e02..8107947 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 _0xcf13=['rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','show','params','intersection','include','options','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','FreshdeskField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcf13,0x67));var _0x3cf1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf13[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3cf1('0x0'));var rimraf=require(_0x3cf1('0x1'));var zipdir=require(_0x3cf1('0x2'));var jsonpatch=require(_0x3cf1('0x3'));var rp=require(_0x3cf1('0x4'));var moment=require(_0x3cf1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3cf1('0x6'));var util=require(_0x3cf1('0x7'));var path=require('path');var sox=require(_0x3cf1('0x8'));var csv=require(_0x3cf1('0x9'));var ejs=require(_0x3cf1('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3cf1('0xb'));var crypto=require(_0x3cf1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3cf1('0xd'));var toCsv=require(_0x3cf1('0x9'));var querystring=require(_0x3cf1('0xe'));var Papa=require(_0x3cf1('0xf'));var Redis=require(_0x3cf1('0x10'));var authService=require(_0x3cf1('0x11'));var qs=require(_0x3cf1('0x12'));var as=require(_0x3cf1('0x13'));var hardwareService=require(_0x3cf1('0x14'));var logger=require(_0x3cf1('0x15'))(_0x3cf1('0x16'));var utils=require('../../config/utils');var config=require(_0x3cf1('0x17'));var db=require(_0x3cf1('0x18'))['db'];function respondWithStatusCode(_0x10fd3a,_0x1a115f){_0x1a115f=_0x1a115f||0xcc;return function(_0x4bafb7){if(_0x4bafb7){return _0x10fd3a[_0x3cf1('0x19')](_0x1a115f);}return _0x10fd3a[_0x3cf1('0x1a')](_0x1a115f)[_0x3cf1('0x1b')]();};}function respondWithResult(_0x1c4a8b,_0x2627e5){_0x2627e5=_0x2627e5||0xc8;return function(_0x140268){if(_0x140268){return _0x1c4a8b[_0x3cf1('0x1a')](_0x2627e5)[_0x3cf1('0x1c')](_0x140268);}};}function respondWithFilteredResult(_0x3b971c,_0x3761cb){return function(_0x4cbf69){if(_0x4cbf69){var _0x1d252a=_0x4cbf69[_0x3cf1('0x1d')],_0x1d7fb2=_0x3761cb[_0x3cf1('0x1e')],_0xd74a15=_0x3761cb['offset']+_0x3761cb[_0x3cf1('0x1f')],_0x51984c;if(_0xd74a15>=_0x1d252a){_0xd74a15=_0x1d252a;_0x51984c=0xc8;}else{_0x51984c=0xce;}_0x3b971c[_0x3cf1('0x1a')](_0x51984c);return _0x3b971c[_0x3cf1('0x20')](_0x3cf1('0x21'),_0x1d7fb2+'-'+_0xd74a15+'/'+_0x1d252a)['json'](_0x4cbf69);}return null;};}function patchUpdates(_0x12f067){return function(_0x12696c){try{jsonpatch['apply'](_0x12696c,_0x12f067,!![]);}catch(_0x3ee52f){return BPromise[_0x3cf1('0x22')](_0x3ee52f);}return _0x12696c[_0x3cf1('0x23')]();};}function saveUpdates(_0x153fbd,_0x2dd43d){return function(_0x3ab0fe){if(_0x3ab0fe){return _0x3ab0fe[_0x3cf1('0x24')](_0x153fbd)[_0x3cf1('0x25')](function(_0x31eb5c){return _0x31eb5c;});}return null;};}function removeEntity(_0x20fbbb,_0x29c194){return function(_0xf0419c){if(_0xf0419c){return _0xf0419c[_0x3cf1('0x26')]()[_0x3cf1('0x25')](function(){_0x20fbbb[_0x3cf1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x286bc1,_0x54f897){return function(_0x2de428){if(!_0x2de428){_0x286bc1[_0x3cf1('0x19')](0x194);}return _0x2de428;};}function handleError(_0x8962d3,_0x2536bc){_0x2536bc=_0x2536bc||0x1f4;return function(_0x2b72df){logger[_0x3cf1('0x27')](_0x2b72df['stack']);if(_0x2b72df[_0x3cf1('0x28')]){delete _0x2b72df[_0x3cf1('0x28')];}_0x8962d3[_0x3cf1('0x1a')](_0x2536bc)[_0x3cf1('0x29')](_0x2b72df);};}exports[_0x3cf1('0x2a')]=function(_0x734cd6,_0x426497){var _0x1ab73c={},_0x4c9a3d={},_0x289c71={'count':0x0,'rows':[]};var _0x1d1bf3=_[_0x3cf1('0x2b')](db[_0x3cf1('0x2c')][_0x3cf1('0x2d')],function(_0x2b785e){return{'name':_0x2b785e[_0x3cf1('0x2e')],'type':_0x2b785e['type']['key']};});_0x4c9a3d[_0x3cf1('0x2f')]=_['map'](_0x1d1bf3,_0x3cf1('0x28'));_0x4c9a3d[_0x3cf1('0x30')]=_[_0x3cf1('0x31')](_0x734cd6[_0x3cf1('0x30')]);_0x4c9a3d[_0x3cf1('0x32')]=_['intersection'](_0x4c9a3d[_0x3cf1('0x2f')],_0x4c9a3d[_0x3cf1('0x30')]);_0x1ab73c[_0x3cf1('0x33')]=_['intersection'](_0x4c9a3d['model'],qs[_0x3cf1('0x34')](_0x734cd6['query']['fields']));_0x1ab73c[_0x3cf1('0x33')]=_0x1ab73c['attributes'][_0x3cf1('0x35')]?_0x1ab73c['attributes']:_0x4c9a3d[_0x3cf1('0x2f')];if(!_0x734cd6[_0x3cf1('0x30')][_0x3cf1('0x36')]('nolimit')){_0x1ab73c['limit']=qs[_0x3cf1('0x1f')](_0x734cd6['query'][_0x3cf1('0x1f')]);_0x1ab73c['offset']=qs[_0x3cf1('0x1e')](_0x734cd6['query'][_0x3cf1('0x1e')]);}_0x1ab73c[_0x3cf1('0x37')]=qs['sort'](_0x734cd6[_0x3cf1('0x30')][_0x3cf1('0x38')]);_0x1ab73c['where']=qs[_0x3cf1('0x32')](_[_0x3cf1('0x39')](_0x734cd6[_0x3cf1('0x30')],_0x4c9a3d[_0x3cf1('0x32')]),_0x1d1bf3);if(_0x734cd6[_0x3cf1('0x30')][_0x3cf1('0x3a')]){_0x1ab73c[_0x3cf1('0x3b')]=_[_0x3cf1('0x3c')](_0x1ab73c['where'],{'$or':_[_0x3cf1('0x2b')](_0x1d1bf3,function(_0x569976){if(_0x569976['type']!==_0x3cf1('0x3d')){var _0x3af695={};_0x3af695[_0x569976['name']]={'$like':'%'+_0x734cd6['query'][_0x3cf1('0x3a')]+'%'};return _0x3af695;}})});}_0x1ab73c=_[_0x3cf1('0x3c')]({},_0x1ab73c,_0x734cd6['options']);var _0x3fbbfa={'where':_0x1ab73c[_0x3cf1('0x3b')]};return db[_0x3cf1('0x2c')][_0x3cf1('0x1d')](_0x3fbbfa)['then'](function(_0x3d99a1){_0x289c71['count']=_0x3d99a1;if(_0x734cd6[_0x3cf1('0x30')][_0x3cf1('0x3e')]){_0x1ab73c['include']=[{'all':!![]}];}return db[_0x3cf1('0x2c')][_0x3cf1('0x3f')](_0x1ab73c);})['then'](function(_0x513d27){_0x289c71[_0x3cf1('0x40')]=_0x513d27;return _0x289c71;})['then'](respondWithFilteredResult(_0x426497,_0x1ab73c))['catch'](handleError(_0x426497,null));};exports[_0x3cf1('0x41')]=function(_0x4c9ac3,_0xafbdaf){var _0x496435={'raw':!![],'where':{'id':_0x4c9ac3[_0x3cf1('0x42')]['id']}},_0x561e49={};_0x561e49[_0x3cf1('0x2f')]=_['keys'](db['FreshdeskField'][_0x3cf1('0x2d')]);_0x561e49['query']=_[_0x3cf1('0x31')](_0x4c9ac3['query']);_0x561e49[_0x3cf1('0x32')]=_[_0x3cf1('0x43')](_0x561e49['model'],_0x561e49[_0x3cf1('0x30')]);_0x496435[_0x3cf1('0x33')]=_[_0x3cf1('0x43')](_0x561e49['model'],qs['fields'](_0x4c9ac3[_0x3cf1('0x30')][_0x3cf1('0x34')]));_0x496435['attributes']=_0x496435[_0x3cf1('0x33')]['length']?_0x496435['attributes']:_0x561e49[_0x3cf1('0x2f')];if(_0x4c9ac3[_0x3cf1('0x30')][_0x3cf1('0x3e')]){_0x496435[_0x3cf1('0x44')]=[{'all':!![]}];}_0x496435=_[_0x3cf1('0x3c')]({},_0x496435,_0x4c9ac3[_0x3cf1('0x45')]);return db[_0x3cf1('0x2c')][_0x3cf1('0x46')](_0x496435)[_0x3cf1('0x25')](handleEntityNotFound(_0xafbdaf,null))[_0x3cf1('0x25')](respondWithResult(_0xafbdaf,null))['catch'](handleError(_0xafbdaf,null));};exports[_0x3cf1('0x47')]=function(_0x400098,_0x5d2be6){return db['FreshdeskField'][_0x3cf1('0x47')](_0x400098[_0x3cf1('0x48')],{})[_0x3cf1('0x25')](respondWithResult(_0x5d2be6,0xc9))['catch'](handleError(_0x5d2be6,null));};exports[_0x3cf1('0x24')]=function(_0x64b454,_0x5249de){if(_0x64b454[_0x3cf1('0x48')]['id']){delete _0x64b454[_0x3cf1('0x48')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x64b454[_0x3cf1('0x42')]['id']}})[_0x3cf1('0x25')](handleEntityNotFound(_0x5249de,null))['then'](saveUpdates(_0x64b454['body'],null))['then'](respondWithResult(_0x5249de,null))[_0x3cf1('0x49')](handleError(_0x5249de,null));};exports[_0x3cf1('0x26')]=function(_0x240e93,_0x5792e8){return db[_0x3cf1('0x2c')][_0x3cf1('0x46')]({'where':{'id':_0x240e93[_0x3cf1('0x42')]['id']}})[_0x3cf1('0x25')](handleEntityNotFound(_0x5792e8,null))['then'](removeEntity(_0x5792e8,null))[_0x3cf1('0x49')](handleError(_0x5792e8,null));}; \ No newline at end of file +var _0x2781=['query','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','FreshdeskField','findAll','rows','catch','show','params','keys','length','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','map','fieldName','type','key'];(function(_0x2f7853,_0x3a0b63){var _0x3af417=function(_0x29eb0e){while(--_0x29eb0e){_0x2f7853['push'](_0x2f7853['shift']());}};_0x3af417(++_0x3a0b63);}(_0x2781,0x65));var _0x1278=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2781[_0x3ab51d];return _0x29a04e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1278('0x0'));var rimraf=require(_0x1278('0x1'));var zipdir=require(_0x1278('0x2'));var jsonpatch=require(_0x1278('0x3'));var rp=require('request-promise');var moment=require(_0x1278('0x4'));var BPromise=require(_0x1278('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1278('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1278('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1278('0x8'));var crypto=require('crypto');var jsforce=require(_0x1278('0x9'));var deskjs=require(_0x1278('0xa'));var toCsv=require('to-csv');var querystring=require(_0x1278('0xb'));var Papa=require(_0x1278('0xc'));var Redis=require(_0x1278('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1278('0xe'));var hardwareService=require(_0x1278('0xf'));var logger=require(_0x1278('0x10'))(_0x1278('0x11'));var utils=require(_0x1278('0x12'));var config=require(_0x1278('0x13'));var db=require(_0x1278('0x14'))['db'];function respondWithStatusCode(_0x73b643,_0x1f6468){_0x1f6468=_0x1f6468||0xcc;return function(_0x4a1460){if(_0x4a1460){return _0x73b643[_0x1278('0x15')](_0x1f6468);}return _0x73b643[_0x1278('0x16')](_0x1f6468)['end']();};}function respondWithResult(_0x280450,_0x3f575c){_0x3f575c=_0x3f575c||0xc8;return function(_0x3a95dc){if(_0x3a95dc){return _0x280450['status'](_0x3f575c)[_0x1278('0x17')](_0x3a95dc);}};}function respondWithFilteredResult(_0x2c42a2,_0x4713b8){return function(_0x326827){if(_0x326827){var _0xf508f3=_0x326827[_0x1278('0x18')],_0x4df5f8=_0x4713b8[_0x1278('0x19')],_0x1d42dc=_0x4713b8['offset']+_0x4713b8[_0x1278('0x1a')],_0x1acaa4;if(_0x1d42dc>=_0xf508f3){_0x1d42dc=_0xf508f3;_0x1acaa4=0xc8;}else{_0x1acaa4=0xce;}_0x2c42a2[_0x1278('0x16')](_0x1acaa4);return _0x2c42a2[_0x1278('0x1b')]('Content-Range',_0x4df5f8+'-'+_0x1d42dc+'/'+_0xf508f3)[_0x1278('0x17')](_0x326827);}return null;};}function patchUpdates(_0x1825c6){return function(_0x265475){try{jsonpatch[_0x1278('0x1c')](_0x265475,_0x1825c6,!![]);}catch(_0x454d1f){return BPromise[_0x1278('0x1d')](_0x454d1f);}return _0x265475[_0x1278('0x1e')]();};}function saveUpdates(_0x9e7b92,_0x256d0f){return function(_0xe466d8){if(_0xe466d8){return _0xe466d8[_0x1278('0x1f')](_0x9e7b92)[_0x1278('0x20')](function(_0x3ddff7){return _0x3ddff7;});}return null;};}function removeEntity(_0x4b9d60,_0x2ac512){return function(_0x47be0e){if(_0x47be0e){return _0x47be0e['destroy']()[_0x1278('0x20')](function(){_0x4b9d60[_0x1278('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18b101,_0x328360){return function(_0xc841ec){if(!_0xc841ec){_0x18b101[_0x1278('0x15')](0x194);}return _0xc841ec;};}function handleError(_0x5de090,_0x1accdd){_0x1accdd=_0x1accdd||0x1f4;return function(_0x44aeb4){logger[_0x1278('0x21')](_0x44aeb4[_0x1278('0x22')]);if(_0x44aeb4[_0x1278('0x23')]){delete _0x44aeb4[_0x1278('0x23')];}_0x5de090['status'](_0x1accdd)[_0x1278('0x24')](_0x44aeb4);};}exports['index']=function(_0x27b7e0,_0x52470e){var _0x7eb07b={},_0x4b337a={},_0x2e6774={'count':0x0,'rows':[]};var _0x174b4e=_[_0x1278('0x25')](db['FreshdeskField']['rawAttributes'],function(_0x105d3c){return{'name':_0x105d3c[_0x1278('0x26')],'type':_0x105d3c[_0x1278('0x27')][_0x1278('0x28')]};});_0x4b337a['model']=_['map'](_0x174b4e,_0x1278('0x23'));_0x4b337a['query']=_['keys'](_0x27b7e0[_0x1278('0x29')]);_0x4b337a[_0x1278('0x2a')]=_[_0x1278('0x2b')](_0x4b337a['model'],_0x4b337a['query']);_0x7eb07b[_0x1278('0x2c')]=_[_0x1278('0x2b')](_0x4b337a['model'],qs[_0x1278('0x2d')](_0x27b7e0['query'][_0x1278('0x2d')]));_0x7eb07b['attributes']=_0x7eb07b['attributes']['length']?_0x7eb07b['attributes']:_0x4b337a[_0x1278('0x2e')];if(!_0x27b7e0[_0x1278('0x29')][_0x1278('0x2f')](_0x1278('0x30'))){_0x7eb07b['limit']=qs['limit'](_0x27b7e0[_0x1278('0x29')][_0x1278('0x1a')]);_0x7eb07b[_0x1278('0x19')]=qs[_0x1278('0x19')](_0x27b7e0[_0x1278('0x29')][_0x1278('0x19')]);}_0x7eb07b[_0x1278('0x31')]=qs[_0x1278('0x32')](_0x27b7e0[_0x1278('0x29')]['sort']);_0x7eb07b[_0x1278('0x33')]=qs[_0x1278('0x2a')](_[_0x1278('0x34')](_0x27b7e0[_0x1278('0x29')],_0x4b337a[_0x1278('0x2a')]),_0x174b4e);if(_0x27b7e0[_0x1278('0x29')][_0x1278('0x35')]){_0x7eb07b[_0x1278('0x33')]=_[_0x1278('0x36')](_0x7eb07b[_0x1278('0x33')],{'$or':_[_0x1278('0x25')](_0x174b4e,function(_0x5c9b76){if(_0x5c9b76[_0x1278('0x27')]!==_0x1278('0x37')){var _0x8f6656={};_0x8f6656[_0x5c9b76[_0x1278('0x23')]]={'$like':'%'+_0x27b7e0[_0x1278('0x29')]['filter']+'%'};return _0x8f6656;}})});}_0x7eb07b=_['merge']({},_0x7eb07b,_0x27b7e0[_0x1278('0x38')]);var _0x41063b={'where':_0x7eb07b[_0x1278('0x33')]};return db['FreshdeskField'][_0x1278('0x18')](_0x41063b)[_0x1278('0x20')](function(_0x511af3){_0x2e6774['count']=_0x511af3;if(_0x27b7e0[_0x1278('0x29')][_0x1278('0x39')]){_0x7eb07b[_0x1278('0x3a')]=[{'all':!![]}];}return db[_0x1278('0x3b')][_0x1278('0x3c')](_0x7eb07b);})[_0x1278('0x20')](function(_0x3ab5b8){_0x2e6774[_0x1278('0x3d')]=_0x3ab5b8;return _0x2e6774;})[_0x1278('0x20')](respondWithFilteredResult(_0x52470e,_0x7eb07b))[_0x1278('0x3e')](handleError(_0x52470e,null));};exports[_0x1278('0x3f')]=function(_0x3e2cc9,_0x56217a){var _0x133251={'raw':!![],'where':{'id':_0x3e2cc9[_0x1278('0x40')]['id']}},_0x4eaf67={};_0x4eaf67[_0x1278('0x2e')]=_[_0x1278('0x41')](db[_0x1278('0x3b')]['rawAttributes']);_0x4eaf67[_0x1278('0x29')]=_['keys'](_0x3e2cc9[_0x1278('0x29')]);_0x4eaf67[_0x1278('0x2a')]=_[_0x1278('0x2b')](_0x4eaf67[_0x1278('0x2e')],_0x4eaf67[_0x1278('0x29')]);_0x133251[_0x1278('0x2c')]=_[_0x1278('0x2b')](_0x4eaf67[_0x1278('0x2e')],qs['fields'](_0x3e2cc9[_0x1278('0x29')][_0x1278('0x2d')]));_0x133251[_0x1278('0x2c')]=_0x133251['attributes'][_0x1278('0x42')]?_0x133251[_0x1278('0x2c')]:_0x4eaf67[_0x1278('0x2e')];if(_0x3e2cc9[_0x1278('0x29')][_0x1278('0x39')]){_0x133251[_0x1278('0x3a')]=[{'all':!![]}];}_0x133251=_[_0x1278('0x36')]({},_0x133251,_0x3e2cc9[_0x1278('0x38')]);return db[_0x1278('0x3b')][_0x1278('0x43')](_0x133251)[_0x1278('0x20')](handleEntityNotFound(_0x56217a,null))[_0x1278('0x20')](respondWithResult(_0x56217a,null))[_0x1278('0x3e')](handleError(_0x56217a,null));};exports[_0x1278('0x44')]=function(_0x1a79af,_0x72108d){return db['FreshdeskField'][_0x1278('0x44')](_0x1a79af[_0x1278('0x45')],{})[_0x1278('0x20')](respondWithResult(_0x72108d,0xc9))[_0x1278('0x3e')](handleError(_0x72108d,null));};exports[_0x1278('0x1f')]=function(_0x46bba5,_0x186e9d){if(_0x46bba5['body']['id']){delete _0x46bba5[_0x1278('0x45')]['id'];}return db[_0x1278('0x3b')][_0x1278('0x43')]({'where':{'id':_0x46bba5[_0x1278('0x40')]['id']}})[_0x1278('0x20')](handleEntityNotFound(_0x186e9d,null))['then'](saveUpdates(_0x46bba5[_0x1278('0x45')],null))[_0x1278('0x20')](respondWithResult(_0x186e9d,null))[_0x1278('0x3e')](handleError(_0x186e9d,null));};exports[_0x1278('0x46')]=function(_0x20d38c,_0x5c5637){return db[_0x1278('0x3b')][_0x1278('0x43')]({'where':{'id':_0x20d38c[_0x1278('0x40')]['id']}})[_0x1278('0x20')](handleEntityNotFound(_0x5c5637,null))[_0x1278('0x20')](removeEntity(_0x5c5637,null))[_0x1278('0x3e')](handleError(_0x5c5637,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 5cd9f44..0f204f4 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 _0xf7a3=['lodash','../../config/logger','moment','bluebird','path','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','idField','FieldId'];(function(_0x572d5b,_0x22cddf){var _0x300f52=function(_0x38f4c6){while(--_0x38f4c6){_0x572d5b['push'](_0x572d5b['shift']());}};_0x300f52(++_0x22cddf);}(_0xf7a3,0xfc));var _0x3f7a=function(_0x3be7ff,_0x12e714){_0x3be7ff=_0x3be7ff-0x0;var _0x186721=_0xf7a3[_0x3be7ff];return _0x186721;};'use strict';var _=require(_0x3f7a('0x0'));var util=require('util');var logger=require(_0x3f7a('0x1'))('api');var moment=require(_0x3f7a('0x2'));var BPromise=require(_0x3f7a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f7a('0x4'));var rimraf=require('rimraf');var config=require(_0x3f7a('0x5'));var attributes=require(_0x3f7a('0x6'));module[_0x3f7a('0x7')]=function(_0x3883a3,_0x524a6d){return _0x3883a3['define'](_0x3f7a('0x8'),attributes,{'tableName':_0x3f7a('0x9'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x3f7a('0xa'),_0x3f7a('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf359=['lodash','util','../../config/logger','path','rimraf','../../config/environment','./intFreshdeskField.attributes','define','int_freshdesk_fields','freshdesk_unique_index','FieldId'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xf359,0x129));var _0x9f35=function(_0xbe6e12,_0x42b2d0){_0xbe6e12=_0xbe6e12-0x0;var _0xb41ba9=_0xf359[_0xbe6e12];return _0xb41ba9;};'use strict';var _=require(_0x9f35('0x0'));var util=require(_0x9f35('0x1'));var logger=require(_0x9f35('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f35('0x3'));var rimraf=require(_0x9f35('0x4'));var config=require(_0x9f35('0x5'));var attributes=require(_0x9f35('0x6'));module['exports']=function(_0x403220,_0x2dd35c){return _0x403220[_0x9f35('0x7')]('FreshdeskField',attributes,{'tableName':_0x9f35('0x8'),'paranoid':![],'indexes':[{'name':_0x9f35('0x9'),'fields':['idField',_0x9f35('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 710b1bd..f33b26d 100644 --- a/server/api/intFreshdeskField/intFreshdeskField.rpc.js +++ b/server/api/intFreshdeskField/intFreshdeskField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x26e859,_0x5beda0){var _0x3e7626=function(_0x242fe5){while(--_0x242fe5){_0x26e859['push'](_0x26e859['shift']());}};_0x3e7626(++_0x5beda0);}(_0xb10b,0x12a));var _0xbb10=function(_0x173336,_0x3f98c4){_0x173336=_0x173336-0x0;var _0x12dc79=_0xb10b[_0x173336];return _0x12dc79;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x7e029,_0x4e500a){var _0x21912d=function(_0x2f219d){while(--_0x2f219d){_0x7e029['push'](_0x7e029['shift']());}};_0x21912d(++_0x4e500a);}(_0xb10b,0x12a));var _0xbb10=function(_0x4bfab7,_0x1f92fc){_0x4bfab7=_0x4bfab7-0x0;var _0x232fd7=_0xb10b[_0x4bfab7];return _0x232fd7;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 2685c2b..69a6ba5 100644 --- a/server/api/intFreshsalesAccount/index.js +++ b/server/api/intFreshsalesAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x73da=['util','express','Router','../../components/auth/service','./intFreshsalesAccount.controller','/:id','show','get','/:id/configurations','getConfigurations','isAuthenticated','getFields','post','addConfiguration','put','update','delete','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x73da,0x1a1));var _0xa73d=function(_0x2bae44,_0x33f37a){_0x2bae44=_0x2bae44-0x0;var _0x1e111b=_0x73da[_0x2bae44];return _0x1e111b;};'use strict';var multer=require(_0xa73d('0x0'));var util=require(_0xa73d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa73d('0x2'));var router=express[_0xa73d('0x3')]();var auth=require(_0xa73d('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa73d('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa73d('0x6'),auth['isAuthenticated'](),controller[_0xa73d('0x7')]);router[_0xa73d('0x8')](_0xa73d('0x9'),auth['isAuthenticated'](),controller[_0xa73d('0xa')]);router['get']('/:id/fields',auth[_0xa73d('0xb')](),controller[_0xa73d('0xc')]);router[_0xa73d('0xd')]('/',auth[_0xa73d('0xb')](),controller['create']);router['post'](_0xa73d('0x9'),auth[_0xa73d('0xb')](),controller[_0xa73d('0xe')]);router[_0xa73d('0xf')](_0xa73d('0x6'),auth['isAuthenticated'](),controller[_0xa73d('0x10')]);router[_0xa73d('0x11')](_0xa73d('0x6'),auth['isAuthenticated'](),controller['destroy']);module[_0xa73d('0x12')]=router; \ No newline at end of file +var _0x904f=['getFields','post','create','addConfiguration','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields'];(function(_0x232e16,_0x1328d3){var _0x29719c=function(_0x2b9aa8){while(--_0x2b9aa8){_0x232e16['push'](_0x232e16['shift']());}};_0x29719c(++_0x1328d3);}(_0x904f,0xe3));var _0xf904=function(_0x4db7c2,_0x2b3466){_0x4db7c2=_0x4db7c2-0x0;var _0x136afe=_0x904f[_0x4db7c2];return _0x136afe;};'use strict';var multer=require(_0xf904('0x0'));var util=require(_0xf904('0x1'));var path=require(_0xf904('0x2'));var timeout=require(_0xf904('0x3'));var express=require(_0xf904('0x4'));var router=express[_0xf904('0x5')]();var auth=require(_0xf904('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf904('0x7'));var controller=require(_0xf904('0x8'));router[_0xf904('0x9')]('/',auth[_0xf904('0xa')](),controller['index']);router['get'](_0xf904('0xb'),auth['isAuthenticated'](),controller[_0xf904('0xc')]);router[_0xf904('0x9')](_0xf904('0xd'),auth[_0xf904('0xa')](),controller['getConfigurations']);router['get'](_0xf904('0xe'),auth[_0xf904('0xa')](),controller[_0xf904('0xf')]);router[_0xf904('0x10')]('/',auth[_0xf904('0xa')](),controller[_0xf904('0x11')]);router[_0xf904('0x10')]('/:id/configurations',auth[_0xf904('0xa')](),controller[_0xf904('0x12')]);router[_0xf904('0x13')](_0xf904('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xf904('0xa')](),controller[_0xf904('0x14')]);module[_0xf904('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 7afb0d6..73d6595 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x68a5=['sequelize','STRING','username','remoteUri'];(function(_0x545e45,_0xfd490f){var _0x17502d=function(_0x4c0985){while(--_0x4c0985){_0x545e45['push'](_0x545e45['shift']());}};_0x17502d(++_0xfd490f);}(_0x68a5,0xfc));var _0x568a=function(_0x15a033,_0x379888){_0x15a033=_0x15a033-0x0;var _0x44b426=_0x68a5[_0x15a033];return _0x44b426;};'use strict';var Sequelize=require(_0x568a('0x0'));module['exports']={'name':{'type':Sequelize[_0x568a('0x1')]},'description':{'type':Sequelize[_0x568a('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x568a('0x2')},'apiKey':{'type':Sequelize[_0x568a('0x1')]},'remoteUri':{'type':Sequelize[_0x568a('0x1')],'unique':_0x568a('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa3db=['STRING','username','remoteUri','sequelize','exports'];(function(_0x1f579d,_0x2a8ef4){var _0x424609=function(_0x3b1893){while(--_0x3b1893){_0x1f579d['push'](_0x1f579d['shift']());}};_0x424609(++_0x2a8ef4);}(_0xa3db,0x10c));var _0xba3d=function(_0x204dc5,_0x6130e5){_0x204dc5=_0x204dc5-0x0;var _0x4bfe65=_0xa3db[_0x204dc5];return _0x4bfe65;};'use strict';var Sequelize=require(_0xba3d('0x0'));module[_0xba3d('0x1')]={'name':{'type':Sequelize[_0xba3d('0x2')]},'description':{'type':Sequelize[_0xba3d('0x2')]},'username':{'type':Sequelize[_0xba3d('0x2')],'unique':_0xba3d('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xba3d('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 5b5f977..82e3d6d 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x04aa=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','include','rows','params','rawAttributes','includeAll','find','create','body','getConfigurations','findOne','pick','addConfiguration','Subjects','getSubjects','channel','Descriptions','FreshsalesConfiguration','FreshsalesField','getFields','remoteUri','slice','substring','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','FreshsalesAccount','type','model','keys'];(function(_0x40321f,_0x118f14){var _0x1dc3da=function(_0x2392e2){while(--_0x2392e2){_0x40321f['push'](_0x40321f['shift']());}};_0x1dc3da(++_0x118f14);}(_0x04aa,0x178));var _0xa04a=function(_0x1aeceb,_0x202cb8){_0x1aeceb=_0x1aeceb-0x0;var _0x402a43=_0x04aa[_0x1aeceb];return _0x402a43;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa04a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa04a('0x1'));var rp=require(_0xa04a('0x2'));var moment=require(_0xa04a('0x3'));var BPromise=require(_0xa04a('0x4'));var Mustache=require(_0xa04a('0x5'));var util=require(_0xa04a('0x6'));var path=require(_0xa04a('0x7'));var sox=require('sox');var csv=require(_0xa04a('0x8'));var ejs=require(_0xa04a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa04a('0xa'));var jsforce=require(_0xa04a('0xb'));var deskjs=require(_0xa04a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa04a('0xd'));var Papa=require('papaparse');var Redis=require(_0xa04a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa04a('0xf'));var as=require(_0xa04a('0x10'));var hardwareService=require(_0xa04a('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xa04a('0x12'));var config=require('../../config/environment');var db=require(_0xa04a('0x13'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xa04a('0x14'));var client=jayson[_0xa04a('0x15')][_0xa04a('0x16')]({'port':0x232a});function checkPasswordPattern(_0x4160e4,_0x99818f,_0x22323f){if(_0x22323f){var _0x4b8d6a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b8d6a['test'](_0x99818f)){return _0x4160e4;}else{throw new db[(_0xa04a('0x17'))][(_0xa04a('0x18'))](_0xa04a('0x19'));}}else{return _0x4160e4;}}function respondWithRpcPromise(_0x23f50b,_0x21460e,_0x14ba2a,_0xee72ac){return new BPromise(function(_0x130275,_0x488da5){var _0x1c20c7=_0xee72ac||client;return _0x1c20c7[_0xa04a('0x1a')](_0x23f50b,_0x14ba2a)[_0xa04a('0x1b')](function(_0x373fc9){logger['info'](_0xa04a('0x1c'),_0x21460e,_0xa04a('0x1d'));logger[_0xa04a('0x1e')](_0xa04a('0x1f'),_0x21460e,_0xa04a('0x1d'),JSON[_0xa04a('0x20')](_0x373fc9));if(_0x373fc9[_0xa04a('0x21')]){if(_0x373fc9['error'][_0xa04a('0x22')]===0x1f4){logger[_0xa04a('0x21')](_0xa04a('0x1c'),_0x21460e,_0x373fc9[_0xa04a('0x21')]['message']);return _0x488da5(_0x373fc9[_0xa04a('0x21')][_0xa04a('0x23')]);}logger[_0xa04a('0x21')](_0xa04a('0x1c'),_0x21460e,_0x373fc9[_0xa04a('0x21')][_0xa04a('0x23')]);return _0x130275(_0x373fc9[_0xa04a('0x21')][_0xa04a('0x23')]);}else{logger[_0xa04a('0x24')](_0xa04a('0x1c'),_0x21460e,'request\x20sent');_0x130275(_0x373fc9[_0xa04a('0x25')]['message']);}})[_0xa04a('0x26')](function(_0x1690fb){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x21460e,_0x1690fb);_0x488da5(_0x1690fb);});});}function respondWithStatusCode(_0x3e783f,_0x14ebff){_0x14ebff=_0x14ebff||0xcc;return function(_0x3c1a67){if(_0x3c1a67){return _0x3e783f[_0xa04a('0x27')](_0x14ebff);}return _0x3e783f[_0xa04a('0x28')](_0x14ebff)[_0xa04a('0x29')]();};}function respondWithResult(_0x46af0f,_0x25a634){_0x25a634=_0x25a634||0xc8;return function(_0x43a0b7){if(_0x43a0b7){return _0x46af0f['status'](_0x25a634)[_0xa04a('0x2a')](_0x43a0b7);}};}function respondWithFilteredResult(_0x2cdab7,_0x384c1e){return function(_0x451d56){if(_0x451d56){var _0x14982b=_0x451d56[_0xa04a('0x2b')],_0x177350=_0x384c1e[_0xa04a('0x2c')],_0x433331=_0x384c1e[_0xa04a('0x2c')]+_0x384c1e['limit'],_0x28cd35;if(_0x433331>=_0x14982b){_0x433331=_0x14982b;_0x28cd35=0xc8;}else{_0x28cd35=0xce;}_0x2cdab7[_0xa04a('0x28')](_0x28cd35);return _0x2cdab7[_0xa04a('0x2d')](_0xa04a('0x2e'),_0x177350+'-'+_0x433331+'/'+_0x14982b)[_0xa04a('0x2a')](_0x451d56);}return null;};}function patchUpdates(_0x58892a){return function(_0x251095){try{jsonpatch['apply'](_0x251095,_0x58892a,!![]);}catch(_0xcd857e){return BPromise[_0xa04a('0x2f')](_0xcd857e);}return _0x251095[_0xa04a('0x30')]();};}function saveUpdates(_0x28ceb4,_0x52dd7c){return function(_0x2f3c43){if(_0x2f3c43){return _0x2f3c43[_0xa04a('0x31')](_0x28ceb4)['then'](function(_0x25c2b4){return _0x25c2b4;});}return null;};}function removeEntity(_0x3758df,_0x5ef4ce){return function(_0x106bfd){if(_0x106bfd){return _0x106bfd[_0xa04a('0x32')]()[_0xa04a('0x1b')](function(){_0x3758df[_0xa04a('0x28')](0xcc)[_0xa04a('0x29')]();});}};}function handleEntityNotFound(_0x551fce,_0x4d4586){return function(_0x313f1f){if(!_0x313f1f){_0x551fce[_0xa04a('0x27')](0x194);}return _0x313f1f;};}function handleError(_0x3321f1,_0x27cd25){_0x27cd25=_0x27cd25||0x1f4;return function(_0x5301b2){logger['error'](_0x5301b2[_0xa04a('0x33')]);if(_0x5301b2[_0xa04a('0x34')]){delete _0x5301b2[_0xa04a('0x34')];}_0x3321f1[_0xa04a('0x28')](_0x27cd25)[_0xa04a('0x35')](_0x5301b2);};}exports[_0xa04a('0x36')]=function(_0xaae17e,_0x398d7b){var _0x395933={},_0x322c80={},_0x277de1={'count':0x0,'rows':[]};var _0x31ecc6=_[_0xa04a('0x37')](db[_0xa04a('0x38')]['rawAttributes'],function(_0x5c5fc4){return{'name':_0x5c5fc4['fieldName'],'type':_0x5c5fc4[_0xa04a('0x39')]['key']};});_0x322c80[_0xa04a('0x3a')]=_[_0xa04a('0x37')](_0x31ecc6,_0xa04a('0x34'));_0x322c80['query']=_[_0xa04a('0x3b')](_0xaae17e[_0xa04a('0x3c')]);_0x322c80[_0xa04a('0x3d')]=_[_0xa04a('0x3e')](_0x322c80[_0xa04a('0x3a')],_0x322c80[_0xa04a('0x3c')]);_0x395933[_0xa04a('0x3f')]=_[_0xa04a('0x3e')](_0x322c80[_0xa04a('0x3a')],qs[_0xa04a('0x40')](_0xaae17e[_0xa04a('0x3c')][_0xa04a('0x40')]));_0x395933['attributes']=_0x395933[_0xa04a('0x3f')][_0xa04a('0x41')]?_0x395933['attributes']:_0x322c80[_0xa04a('0x3a')];if(!_0xaae17e[_0xa04a('0x3c')][_0xa04a('0x42')](_0xa04a('0x43'))){_0x395933[_0xa04a('0x44')]=qs['limit'](_0xaae17e[_0xa04a('0x3c')][_0xa04a('0x44')]);_0x395933[_0xa04a('0x2c')]=qs[_0xa04a('0x2c')](_0xaae17e[_0xa04a('0x3c')]['offset']);}_0x395933[_0xa04a('0x45')]=qs[_0xa04a('0x46')](_0xaae17e[_0xa04a('0x3c')][_0xa04a('0x46')]);_0x395933[_0xa04a('0x47')]=qs[_0xa04a('0x3d')](_['pick'](_0xaae17e[_0xa04a('0x3c')],_0x322c80[_0xa04a('0x3d')]),_0x31ecc6);if(_0xaae17e[_0xa04a('0x3c')][_0xa04a('0x48')]){_0x395933[_0xa04a('0x47')]=_[_0xa04a('0x49')](_0x395933['where'],{'$or':_[_0xa04a('0x37')](_0x31ecc6,function(_0x3661a4){if(_0x3661a4['type']!==_0xa04a('0x4a')){var _0x43f2b1={};_0x43f2b1[_0x3661a4[_0xa04a('0x34')]]={'$like':'%'+_0xaae17e[_0xa04a('0x3c')][_0xa04a('0x48')]+'%'};return _0x43f2b1;}})});}_0x395933=_[_0xa04a('0x49')]({},_0x395933,_0xaae17e[_0xa04a('0x4b')]);var _0x57e5c3={'where':_0x395933['where']};return db[_0xa04a('0x38')][_0xa04a('0x2b')](_0x57e5c3)[_0xa04a('0x1b')](function(_0x2f1b4d){_0x277de1[_0xa04a('0x2b')]=_0x2f1b4d;if(_0xaae17e['query']['includeAll']){_0x395933[_0xa04a('0x4c')]=[{'all':!![]}];}return db[_0xa04a('0x38')]['findAll'](_0x395933);})[_0xa04a('0x1b')](function(_0x12ff67){_0x277de1[_0xa04a('0x4d')]=_0x12ff67;return _0x277de1;})[_0xa04a('0x1b')](respondWithFilteredResult(_0x398d7b,_0x395933))[_0xa04a('0x26')](handleError(_0x398d7b,null));};exports['show']=function(_0x284c21,_0x1ea0d1){var _0x22631c={'raw':![],'where':{'id':_0x284c21[_0xa04a('0x4e')]['id']}},_0x405d7f={};_0x405d7f[_0xa04a('0x3a')]=_[_0xa04a('0x3b')](db[_0xa04a('0x38')][_0xa04a('0x4f')]);_0x405d7f['query']=_['keys'](_0x284c21[_0xa04a('0x3c')]);_0x405d7f[_0xa04a('0x3d')]=_[_0xa04a('0x3e')](_0x405d7f[_0xa04a('0x3a')],_0x405d7f['query']);_0x22631c[_0xa04a('0x3f')]=_[_0xa04a('0x3e')](_0x405d7f[_0xa04a('0x3a')],qs[_0xa04a('0x40')](_0x284c21[_0xa04a('0x3c')][_0xa04a('0x40')]));_0x22631c['attributes']=_0x22631c[_0xa04a('0x3f')][_0xa04a('0x41')]?_0x22631c[_0xa04a('0x3f')]:_0x405d7f[_0xa04a('0x3a')];if(_0x284c21[_0xa04a('0x3c')][_0xa04a('0x50')]){_0x22631c['include']=[{'all':!![]}];}_0x22631c=_['merge']({},_0x22631c,_0x284c21[_0xa04a('0x4b')]);return db['FreshsalesAccount'][_0xa04a('0x51')](_0x22631c)[_0xa04a('0x1b')](handleEntityNotFound(_0x1ea0d1,null))[_0xa04a('0x1b')](respondWithResult(_0x1ea0d1,null))[_0xa04a('0x26')](handleError(_0x1ea0d1,null));};exports['create']=function(_0xb299d6,_0xff9290){return db[_0xa04a('0x38')][_0xa04a('0x52')](_0xb299d6['body'],{})[_0xa04a('0x1b')](respondWithResult(_0xff9290,0xc9))[_0xa04a('0x26')](handleError(_0xff9290,null));};exports[_0xa04a('0x31')]=function(_0x44a751,_0x1ca37d){if(_0x44a751[_0xa04a('0x53')]['id']){delete _0x44a751[_0xa04a('0x53')]['id'];}return db[_0xa04a('0x38')][_0xa04a('0x51')]({'where':{'id':_0x44a751[_0xa04a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1ca37d,null))['then'](saveUpdates(_0x44a751[_0xa04a('0x53')],null))[_0xa04a('0x1b')](respondWithResult(_0x1ca37d,null))['catch'](handleError(_0x1ca37d,null));};exports['destroy']=function(_0x46d8ae,_0x2c0ea6){return db[_0xa04a('0x38')]['find']({'where':{'id':_0x46d8ae['params']['id']}})[_0xa04a('0x1b')](handleEntityNotFound(_0x2c0ea6,null))[_0xa04a('0x1b')](removeEntity(_0x2c0ea6,null))[_0xa04a('0x26')](handleError(_0x2c0ea6,null));};exports[_0xa04a('0x54')]=function(_0xdb9275,_0x3a6ed7,_0x58c386){var _0x3c85e3={};var _0xcb0fda={};var _0x45bd6b;var _0x50767d;return db[_0xa04a('0x38')][_0xa04a('0x55')]({'where':{'id':_0xdb9275[_0xa04a('0x4e')]['id']}})[_0xa04a('0x1b')](handleEntityNotFound(_0x3a6ed7,null))[_0xa04a('0x1b')](function(_0x592cbc){if(_0x592cbc){_0x45bd6b=_0x592cbc;_0xcb0fda[_0xa04a('0x3a')]=_[_0xa04a('0x3b')](db['FreshsalesConfiguration'][_0xa04a('0x4f')]);_0xcb0fda[_0xa04a('0x3c')]=_[_0xa04a('0x3b')](_0xdb9275['query']);_0xcb0fda['filters']=_['intersection'](_0xcb0fda['model'],_0xcb0fda['query']);_0x3c85e3[_0xa04a('0x3f')]=_[_0xa04a('0x3e')](_0xcb0fda[_0xa04a('0x3a')],qs[_0xa04a('0x40')](_0xdb9275[_0xa04a('0x3c')][_0xa04a('0x40')]));_0x3c85e3[_0xa04a('0x3f')]=_0x3c85e3[_0xa04a('0x3f')]['length']?_0x3c85e3[_0xa04a('0x3f')]:_0xcb0fda[_0xa04a('0x3a')];_0x3c85e3[_0xa04a('0x45')]=qs[_0xa04a('0x46')](_0xdb9275[_0xa04a('0x3c')]['sort']);_0x3c85e3[_0xa04a('0x47')]=qs[_0xa04a('0x3d')](_[_0xa04a('0x56')](_0xdb9275[_0xa04a('0x3c')],_0xcb0fda[_0xa04a('0x3d')]));if(_0xdb9275['query'][_0xa04a('0x48')]){_0x3c85e3[_0xa04a('0x47')]=_[_0xa04a('0x49')](_0x3c85e3[_0xa04a('0x47')],{'$or':_[_0xa04a('0x37')](_0x3c85e3['attributes'],function(_0x3475fc){var _0x576761={};_0x576761[_0x3475fc]={'$like':'%'+_0xdb9275[_0xa04a('0x3c')]['filter']+'%'};return _0x576761;})});}_0x3c85e3=_['merge']({},_0x3c85e3,_0xdb9275['options']);return _0x45bd6b['getConfigurations'](_0x3c85e3);}})[_0xa04a('0x1b')](function(_0x3c2568){if(_0x3c2568){_0x50767d=_0x3c2568[_0xa04a('0x41')];if(!_0xdb9275['query']['hasOwnProperty']('nolimit')){_0x3c85e3[_0xa04a('0x44')]=qs[_0xa04a('0x44')](_0xdb9275[_0xa04a('0x3c')][_0xa04a('0x44')]);_0x3c85e3[_0xa04a('0x2c')]=qs[_0xa04a('0x2c')](_0xdb9275[_0xa04a('0x3c')][_0xa04a('0x2c')]);}return _0x45bd6b[_0xa04a('0x54')](_0x3c85e3);}})[_0xa04a('0x1b')](function(_0x3ccd5b){if(_0x3ccd5b){return _0x3ccd5b?{'count':_0x50767d,'rows':_0x3ccd5b}:null;}})[_0xa04a('0x1b')](respondWithResult(_0x3a6ed7,null))[_0xa04a('0x26')](handleError(_0x3a6ed7,null));};exports[_0xa04a('0x57')]=function(_0x28d2b8,_0x1a587c,_0x167616){if(_0x28d2b8['body']['id']){delete _0x28d2b8[_0xa04a('0x53')]['id'];}return db[_0xa04a('0x38')][_0xa04a('0x55')]({'where':{'id':_0x28d2b8['params']['id']}})[_0xa04a('0x1b')](handleEntityNotFound(_0x1a587c,null))['then'](function(_0x55a0f9){if(_0x55a0f9){_0x28d2b8[_0xa04a('0x53')]['AccountId']=_0x55a0f9['id'];_0x28d2b8[_0xa04a('0x53')][_0xa04a('0x58')]=integrations[_0xa04a('0x59')](_0x28d2b8[_0xa04a('0x53')][_0xa04a('0x5a')],_0x28d2b8['body'][_0xa04a('0x39')]);_0x28d2b8[_0xa04a('0x53')][_0xa04a('0x5b')]=integrations['getDescriptions'](_0x28d2b8[_0xa04a('0x53')][_0xa04a('0x5a')],_0x28d2b8[_0xa04a('0x53')][_0xa04a('0x39')]);return db[_0xa04a('0x5c')][_0xa04a('0x52')](_0x28d2b8[_0xa04a('0x53')],{'include':[{'model':db['FreshsalesField'],'as':'Subjects'},{'model':db[_0xa04a('0x5d')],'as':'Descriptions'}]});}return null;})[_0xa04a('0x1b')](respondWithResult(_0x1a587c,null))[_0xa04a('0x26')](handleError(_0x1a587c,null));};exports[_0xa04a('0x5e')]=function(_0x53c68b,_0x5ae5bd,_0x9d27e1){var _0x455de0='';var _0x225aea='';return db['FreshsalesAccount'][_0xa04a('0x55')]({'where':{'id':_0x53c68b[_0xa04a('0x4e')]['id']},'attributes':['id','username','remoteUri','apiKey']})[_0xa04a('0x1b')](handleEntityNotFound(_0x5ae5bd,null))['then'](function(_0x13f24c){if(_0x13f24c){_0x225aea=_0x13f24c['username'];_0x455de0=_0x13f24c[_0xa04a('0x5f')];var _0x4357fb=_0x13f24c[_0xa04a('0x5f')][_0xa04a('0x60')](-0x1);if(_0x4357fb==='/'){_0x455de0=_0x455de0[_0xa04a('0x61')](0x0,_0x455de0[_0xa04a('0x62')](_0x4357fb));}return rp({'method':'GET','uri':util[_0xa04a('0x63')](_0xa04a('0x64'),_0x455de0,_0xa04a('0x65')),'headers':{'Authorization':_0xa04a('0x66')+_0x13f24c['apiKey']},'json':!![]});}})[_0xa04a('0x1b')](function(_0x49c00c){if(_0x49c00c){var _0x5071d4=_0x49c00c['users'];var _0x330673=![];var _0x59adf6=null;for(_0x59adf6=0x0;_0x59adf6<_0x5071d4[_0xa04a('0x41')];_0x59adf6++){if(_0x5071d4[_0x59adf6][_0xa04a('0x67')]===_0x225aea){_0x330673=!![];}}if(_0x330673){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xa04a('0x68')});}}})[_0xa04a('0x1b')](respondWithResult(_0x5ae5bd,null))[_0xa04a('0x26')](function(_0x38c4f6){var _0x1b5877=_0x53c68b[_0xa04a('0x3c')][_0xa04a('0x69')]?0x1f4:_0x38c4f6[_0xa04a('0x6a')]||0x1f4;logger[_0xa04a('0x21')](_0xa04a('0x6b'),_0xa04a('0x5e'),_0x1b5877,JSON[_0xa04a('0x20')](_0x38c4f6));delete _0x38c4f6['name'];if(_0x1b5877===0x191){_0x1b5877=0x190;}_0x5ae5bd[_0xa04a('0x28')](_0x1b5877)['send'](_0x53c68b['query'][_0xa04a('0x69')]?{'message':_0xa04a('0x6c'),'statusCode':_0x38c4f6[_0xa04a('0x6a')]}:_0x38c4f6);});}; \ No newline at end of file +var _0xd3eb=['rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','pick','Subjects','getSubjects','channel','Descriptions','FreshsalesField','username','remoteUri','slice','lastIndexOf','GET','%s%s','/api/selector/owners','apiKey','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../components/integrations/configuration','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','update','destroy','stack','name','send','index','map','FreshsalesAccount'];(function(_0x5f128d,_0x50de2b){var _0x245d2=function(_0x4ff92a){while(--_0x4ff92a){_0x5f128d['push'](_0x5f128d['shift']());}};_0x245d2(++_0x50de2b);}(_0xd3eb,0x1f1));var _0xbd3e=function(_0xfd9b19,_0x21d75f){_0xfd9b19=_0xfd9b19-0x0;var _0x514918=_0xd3eb[_0xfd9b19];return _0x514918;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbd3e('0x0'));var rimraf=require(_0xbd3e('0x1'));var zipdir=require(_0xbd3e('0x2'));var jsonpatch=require(_0xbd3e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbd3e('0x4'));var Mustache=require(_0xbd3e('0x5'));var util=require(_0xbd3e('0x6'));var path=require('path');var sox=require(_0xbd3e('0x7'));var csv=require(_0xbd3e('0x8'));var ejs=require(_0xbd3e('0x9'));var fs=require('fs');var _=require(_0xbd3e('0xa'));var squel=require(_0xbd3e('0xb'));var crypto=require(_0xbd3e('0xc'));var jsforce=require(_0xbd3e('0xd'));var deskjs=require(_0xbd3e('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbd3e('0xf'));var Redis=require(_0xbd3e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbd3e('0x11'));var as=require(_0xbd3e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd3e('0x13'))(_0xbd3e('0x14'));var utils=require(_0xbd3e('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0xbd3e('0x16'));var jayson=require('jayson/promise');var client=jayson[_0xbd3e('0x17')][_0xbd3e('0x18')]({'port':0x232a});function checkPasswordPattern(_0x16b088,_0x27ea11,_0x5a75da){if(_0x5a75da){var _0x3816a2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3816a2[_0xbd3e('0x19')](_0x27ea11)){return _0x16b088;}else{throw new db[(_0xbd3e('0x1a'))][(_0xbd3e('0x1b'))](_0xbd3e('0x1c'));}}else{return _0x16b088;}}function respondWithRpcPromise(_0x16fa15,_0x4235c3,_0x583ba7,_0x15e1da){return new BPromise(function(_0x4541e2,_0xa084ca){var _0x243cab=_0x15e1da||client;return _0x243cab[_0xbd3e('0x1d')](_0x16fa15,_0x583ba7)[_0xbd3e('0x1e')](function(_0x567461){logger[_0xbd3e('0x1f')](_0xbd3e('0x20'),_0x4235c3,_0xbd3e('0x21'));logger[_0xbd3e('0x22')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x4235c3,_0xbd3e('0x21'),JSON[_0xbd3e('0x23')](_0x567461));if(_0x567461['error']){if(_0x567461['error'][_0xbd3e('0x24')]===0x1f4){logger['error'](_0xbd3e('0x20'),_0x4235c3,_0x567461[_0xbd3e('0x25')]['message']);return _0xa084ca(_0x567461[_0xbd3e('0x25')][_0xbd3e('0x26')]);}logger[_0xbd3e('0x25')](_0xbd3e('0x20'),_0x4235c3,_0x567461['error'][_0xbd3e('0x26')]);return _0x4541e2(_0x567461[_0xbd3e('0x25')][_0xbd3e('0x26')]);}else{logger[_0xbd3e('0x1f')](_0xbd3e('0x20'),_0x4235c3,'request\x20sent');_0x4541e2(_0x567461[_0xbd3e('0x27')][_0xbd3e('0x26')]);}})[_0xbd3e('0x28')](function(_0x399373){logger[_0xbd3e('0x25')]('FreshsalesAccount,\x20%s,\x20%s',_0x4235c3,_0x399373);_0xa084ca(_0x399373);});});}function respondWithStatusCode(_0x2af765,_0x10c528){_0x10c528=_0x10c528||0xcc;return function(_0x5c8059){if(_0x5c8059){return _0x2af765[_0xbd3e('0x29')](_0x10c528);}return _0x2af765['status'](_0x10c528)[_0xbd3e('0x2a')]();};}function respondWithResult(_0x3c3070,_0xfcaf14){_0xfcaf14=_0xfcaf14||0xc8;return function(_0x1eba24){if(_0x1eba24){return _0x3c3070[_0xbd3e('0x2b')](_0xfcaf14)['json'](_0x1eba24);}};}function respondWithFilteredResult(_0x4889d6,_0x43ab0e){return function(_0x4873fd){if(_0x4873fd){var _0x45de3a=_0x4873fd['count'],_0x6162e5=_0x43ab0e[_0xbd3e('0x2c')],_0x23c258=_0x43ab0e[_0xbd3e('0x2c')]+_0x43ab0e[_0xbd3e('0x2d')],_0x18858f;if(_0x23c258>=_0x45de3a){_0x23c258=_0x45de3a;_0x18858f=0xc8;}else{_0x18858f=0xce;}_0x4889d6['status'](_0x18858f);return _0x4889d6[_0xbd3e('0x2e')](_0xbd3e('0x2f'),_0x6162e5+'-'+_0x23c258+'/'+_0x45de3a)[_0xbd3e('0x30')](_0x4873fd);}return null;};}function patchUpdates(_0x5d21a8){return function(_0x41ea83){try{jsonpatch[_0xbd3e('0x31')](_0x41ea83,_0x5d21a8,!![]);}catch(_0x2c8464){return BPromise['reject'](_0x2c8464);}return _0x41ea83['save']();};}function saveUpdates(_0x867cc3,_0x2f4d01){return function(_0x22201c){if(_0x22201c){return _0x22201c[_0xbd3e('0x32')](_0x867cc3)[_0xbd3e('0x1e')](function(_0x56b17c){return _0x56b17c;});}return null;};}function removeEntity(_0x47d8e4,_0x178474){return function(_0x441909){if(_0x441909){return _0x441909[_0xbd3e('0x33')]()['then'](function(){_0x47d8e4[_0xbd3e('0x2b')](0xcc)[_0xbd3e('0x2a')]();});}};}function handleEntityNotFound(_0x44aead,_0x535347){return function(_0x159d49){if(!_0x159d49){_0x44aead[_0xbd3e('0x29')](0x194);}return _0x159d49;};}function handleError(_0x35933b,_0x54e5c3){_0x54e5c3=_0x54e5c3||0x1f4;return function(_0x4d1257){logger['error'](_0x4d1257[_0xbd3e('0x34')]);if(_0x4d1257[_0xbd3e('0x35')]){delete _0x4d1257['name'];}_0x35933b[_0xbd3e('0x2b')](_0x54e5c3)[_0xbd3e('0x36')](_0x4d1257);};}exports[_0xbd3e('0x37')]=function(_0x39f481,_0x16f7cb){var _0xe40f5={},_0x2c731e={},_0x4ed6e1={'count':0x0,'rows':[]};var _0x2c9fee=_[_0xbd3e('0x38')](db[_0xbd3e('0x39')][_0xbd3e('0x3a')],function(_0x9acb21){return{'name':_0x9acb21[_0xbd3e('0x3b')],'type':_0x9acb21[_0xbd3e('0x3c')]['key']};});_0x2c731e[_0xbd3e('0x3d')]=_['map'](_0x2c9fee,_0xbd3e('0x35'));_0x2c731e[_0xbd3e('0x3e')]=_[_0xbd3e('0x3f')](_0x39f481[_0xbd3e('0x3e')]);_0x2c731e[_0xbd3e('0x40')]=_[_0xbd3e('0x41')](_0x2c731e[_0xbd3e('0x3d')],_0x2c731e['query']);_0xe40f5[_0xbd3e('0x42')]=_['intersection'](_0x2c731e[_0xbd3e('0x3d')],qs['fields'](_0x39f481[_0xbd3e('0x3e')][_0xbd3e('0x43')]));_0xe40f5['attributes']=_0xe40f5[_0xbd3e('0x42')][_0xbd3e('0x44')]?_0xe40f5[_0xbd3e('0x42')]:_0x2c731e[_0xbd3e('0x3d')];if(!_0x39f481[_0xbd3e('0x3e')][_0xbd3e('0x45')](_0xbd3e('0x46'))){_0xe40f5['limit']=qs[_0xbd3e('0x2d')](_0x39f481[_0xbd3e('0x3e')][_0xbd3e('0x2d')]);_0xe40f5['offset']=qs[_0xbd3e('0x2c')](_0x39f481[_0xbd3e('0x3e')][_0xbd3e('0x2c')]);}_0xe40f5[_0xbd3e('0x47')]=qs[_0xbd3e('0x48')](_0x39f481[_0xbd3e('0x3e')][_0xbd3e('0x48')]);_0xe40f5[_0xbd3e('0x49')]=qs[_0xbd3e('0x40')](_['pick'](_0x39f481[_0xbd3e('0x3e')],_0x2c731e[_0xbd3e('0x40')]),_0x2c9fee);if(_0x39f481[_0xbd3e('0x3e')][_0xbd3e('0x4a')]){_0xe40f5[_0xbd3e('0x49')]=_[_0xbd3e('0x4b')](_0xe40f5[_0xbd3e('0x49')],{'$or':_['map'](_0x2c9fee,function(_0x317093){if(_0x317093[_0xbd3e('0x3c')]!==_0xbd3e('0x4c')){var _0x17fc24={};_0x17fc24[_0x317093['name']]={'$like':'%'+_0x39f481['query'][_0xbd3e('0x4a')]+'%'};return _0x17fc24;}})});}_0xe40f5=_[_0xbd3e('0x4b')]({},_0xe40f5,_0x39f481[_0xbd3e('0x4d')]);var _0x24ff53={'where':_0xe40f5[_0xbd3e('0x49')]};return db['FreshsalesAccount'][_0xbd3e('0x4e')](_0x24ff53)['then'](function(_0x310541){_0x4ed6e1[_0xbd3e('0x4e')]=_0x310541;if(_0x39f481[_0xbd3e('0x3e')][_0xbd3e('0x4f')]){_0xe40f5[_0xbd3e('0x50')]=[{'all':!![]}];}return db[_0xbd3e('0x39')][_0xbd3e('0x51')](_0xe40f5);})[_0xbd3e('0x1e')](function(_0x2e9805){_0x4ed6e1['rows']=_0x2e9805;return _0x4ed6e1;})[_0xbd3e('0x1e')](respondWithFilteredResult(_0x16f7cb,_0xe40f5))['catch'](handleError(_0x16f7cb,null));};exports[_0xbd3e('0x52')]=function(_0x3844cb,_0x337bc5){var _0x17d08a={'raw':![],'where':{'id':_0x3844cb[_0xbd3e('0x53')]['id']}},_0x42495e={};_0x42495e['model']=_[_0xbd3e('0x3f')](db[_0xbd3e('0x39')]['rawAttributes']);_0x42495e[_0xbd3e('0x3e')]=_[_0xbd3e('0x3f')](_0x3844cb['query']);_0x42495e[_0xbd3e('0x40')]=_[_0xbd3e('0x41')](_0x42495e[_0xbd3e('0x3d')],_0x42495e[_0xbd3e('0x3e')]);_0x17d08a[_0xbd3e('0x42')]=_[_0xbd3e('0x41')](_0x42495e['model'],qs[_0xbd3e('0x43')](_0x3844cb[_0xbd3e('0x3e')]['fields']));_0x17d08a[_0xbd3e('0x42')]=_0x17d08a[_0xbd3e('0x42')][_0xbd3e('0x44')]?_0x17d08a[_0xbd3e('0x42')]:_0x42495e['model'];if(_0x3844cb[_0xbd3e('0x3e')][_0xbd3e('0x4f')]){_0x17d08a[_0xbd3e('0x50')]=[{'all':!![]}];}_0x17d08a=_[_0xbd3e('0x4b')]({},_0x17d08a,_0x3844cb['options']);return db[_0xbd3e('0x39')][_0xbd3e('0x54')](_0x17d08a)[_0xbd3e('0x1e')](handleEntityNotFound(_0x337bc5,null))[_0xbd3e('0x1e')](respondWithResult(_0x337bc5,null))[_0xbd3e('0x28')](handleError(_0x337bc5,null));};exports['create']=function(_0x50f8cd,_0x1c4dbb){return db[_0xbd3e('0x39')][_0xbd3e('0x55')](_0x50f8cd['body'],{})['then'](respondWithResult(_0x1c4dbb,0xc9))[_0xbd3e('0x28')](handleError(_0x1c4dbb,null));};exports[_0xbd3e('0x32')]=function(_0x321f09,_0x112e8e){if(_0x321f09[_0xbd3e('0x56')]['id']){delete _0x321f09[_0xbd3e('0x56')]['id'];}return db[_0xbd3e('0x39')][_0xbd3e('0x54')]({'where':{'id':_0x321f09[_0xbd3e('0x53')]['id']}})[_0xbd3e('0x1e')](handleEntityNotFound(_0x112e8e,null))['then'](saveUpdates(_0x321f09['body'],null))[_0xbd3e('0x1e')](respondWithResult(_0x112e8e,null))[_0xbd3e('0x28')](handleError(_0x112e8e,null));};exports['destroy']=function(_0x2276d0,_0x590960){return db[_0xbd3e('0x39')][_0xbd3e('0x54')]({'where':{'id':_0x2276d0['params']['id']}})[_0xbd3e('0x1e')](handleEntityNotFound(_0x590960,null))[_0xbd3e('0x1e')](removeEntity(_0x590960,null))[_0xbd3e('0x28')](handleError(_0x590960,null));};exports[_0xbd3e('0x57')]=function(_0x40e5dd,_0x54ad6a,_0x4f5d9a){var _0x41c273={};var _0x122339={};var _0x30a690;var _0x356bff;return db[_0xbd3e('0x39')][_0xbd3e('0x58')]({'where':{'id':_0x40e5dd[_0xbd3e('0x53')]['id']}})['then'](handleEntityNotFound(_0x54ad6a,null))[_0xbd3e('0x1e')](function(_0x4f95f3){if(_0x4f95f3){_0x30a690=_0x4f95f3;_0x122339[_0xbd3e('0x3d')]=_[_0xbd3e('0x3f')](db[_0xbd3e('0x59')]['rawAttributes']);_0x122339['query']=_['keys'](_0x40e5dd[_0xbd3e('0x3e')]);_0x122339[_0xbd3e('0x40')]=_[_0xbd3e('0x41')](_0x122339[_0xbd3e('0x3d')],_0x122339[_0xbd3e('0x3e')]);_0x41c273[_0xbd3e('0x42')]=_[_0xbd3e('0x41')](_0x122339['model'],qs[_0xbd3e('0x43')](_0x40e5dd[_0xbd3e('0x3e')][_0xbd3e('0x43')]));_0x41c273[_0xbd3e('0x42')]=_0x41c273[_0xbd3e('0x42')][_0xbd3e('0x44')]?_0x41c273[_0xbd3e('0x42')]:_0x122339[_0xbd3e('0x3d')];_0x41c273[_0xbd3e('0x47')]=qs[_0xbd3e('0x48')](_0x40e5dd[_0xbd3e('0x3e')][_0xbd3e('0x48')]);_0x41c273[_0xbd3e('0x49')]=qs['filters'](_[_0xbd3e('0x5a')](_0x40e5dd[_0xbd3e('0x3e')],_0x122339[_0xbd3e('0x40')]));if(_0x40e5dd[_0xbd3e('0x3e')]['filter']){_0x41c273[_0xbd3e('0x49')]=_[_0xbd3e('0x4b')](_0x41c273['where'],{'$or':_['map'](_0x41c273['attributes'],function(_0x28b65d){var _0xa077aa={};_0xa077aa[_0x28b65d]={'$like':'%'+_0x40e5dd[_0xbd3e('0x3e')][_0xbd3e('0x4a')]+'%'};return _0xa077aa;})});}_0x41c273=_['merge']({},_0x41c273,_0x40e5dd[_0xbd3e('0x4d')]);return _0x30a690[_0xbd3e('0x57')](_0x41c273);}})['then'](function(_0x1640d0){if(_0x1640d0){_0x356bff=_0x1640d0['length'];if(!_0x40e5dd[_0xbd3e('0x3e')][_0xbd3e('0x45')](_0xbd3e('0x46'))){_0x41c273['limit']=qs[_0xbd3e('0x2d')](_0x40e5dd['query']['limit']);_0x41c273['offset']=qs[_0xbd3e('0x2c')](_0x40e5dd[_0xbd3e('0x3e')][_0xbd3e('0x2c')]);}return _0x30a690[_0xbd3e('0x57')](_0x41c273);}})[_0xbd3e('0x1e')](function(_0x1080ee){if(_0x1080ee){return _0x1080ee?{'count':_0x356bff,'rows':_0x1080ee}:null;}})[_0xbd3e('0x1e')](respondWithResult(_0x54ad6a,null))[_0xbd3e('0x28')](handleError(_0x54ad6a,null));};exports['addConfiguration']=function(_0x1b3c83,_0x5f33c1,_0x3c028f){if(_0x1b3c83[_0xbd3e('0x56')]['id']){delete _0x1b3c83[_0xbd3e('0x56')]['id'];}return db[_0xbd3e('0x39')][_0xbd3e('0x58')]({'where':{'id':_0x1b3c83[_0xbd3e('0x53')]['id']}})['then'](handleEntityNotFound(_0x5f33c1,null))[_0xbd3e('0x1e')](function(_0x1eb040){if(_0x1eb040){_0x1b3c83[_0xbd3e('0x56')]['AccountId']=_0x1eb040['id'];_0x1b3c83['body'][_0xbd3e('0x5b')]=integrations[_0xbd3e('0x5c')](_0x1b3c83[_0xbd3e('0x56')][_0xbd3e('0x5d')],_0x1b3c83['body'][_0xbd3e('0x3c')]);_0x1b3c83['body'][_0xbd3e('0x5e')]=integrations['getDescriptions'](_0x1b3c83[_0xbd3e('0x56')]['channel'],_0x1b3c83[_0xbd3e('0x56')][_0xbd3e('0x3c')]);return db['FreshsalesConfiguration'][_0xbd3e('0x55')](_0x1b3c83[_0xbd3e('0x56')],{'include':[{'model':db['FreshsalesField'],'as':_0xbd3e('0x5b')},{'model':db[_0xbd3e('0x5f')],'as':_0xbd3e('0x5e')}]});}return null;})['then'](respondWithResult(_0x5f33c1,null))[_0xbd3e('0x28')](handleError(_0x5f33c1,null));};exports['getFields']=function(_0x1a8633,_0x2ab9b8,_0xec7a66){var _0x19511d='';var _0x2f83d5='';return db[_0xbd3e('0x39')][_0xbd3e('0x58')]({'where':{'id':_0x1a8633[_0xbd3e('0x53')]['id']},'attributes':['id',_0xbd3e('0x60'),_0xbd3e('0x61'),'apiKey']})[_0xbd3e('0x1e')](handleEntityNotFound(_0x2ab9b8,null))[_0xbd3e('0x1e')](function(_0x4a176a){if(_0x4a176a){_0x2f83d5=_0x4a176a[_0xbd3e('0x60')];_0x19511d=_0x4a176a[_0xbd3e('0x61')];var _0x1654a3=_0x4a176a[_0xbd3e('0x61')][_0xbd3e('0x62')](-0x1);if(_0x1654a3==='/'){_0x19511d=_0x19511d['substring'](0x0,_0x19511d[_0xbd3e('0x63')](_0x1654a3));}return rp({'method':_0xbd3e('0x64'),'uri':util['format'](_0xbd3e('0x65'),_0x19511d,_0xbd3e('0x66')),'headers':{'Authorization':'Token\x20token='+_0x4a176a[_0xbd3e('0x67')]},'json':!![]});}})[_0xbd3e('0x1e')](function(_0x4b0b42){if(_0x4b0b42){var _0x4ddfac=_0x4b0b42[_0xbd3e('0x68')];var _0x337416=![];var _0x3a74e2=null;for(_0x3a74e2=0x0;_0x3a74e2<_0x4ddfac['length'];_0x3a74e2++){if(_0x4ddfac[_0x3a74e2][_0xbd3e('0x69')]===_0x2f83d5){_0x337416=!![];}}if(_0x337416){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xbd3e('0x6a')});}}})[_0xbd3e('0x1e')](respondWithResult(_0x2ab9b8,null))[_0xbd3e('0x28')](function(_0x27730d){var _0x26339e=_0x1a8633[_0xbd3e('0x3e')][_0xbd3e('0x19')]?0x1f4:_0x27730d[_0xbd3e('0x6b')]||0x1f4;logger[_0xbd3e('0x25')](_0xbd3e('0x6c'),_0xbd3e('0x6d'),_0x26339e,JSON['stringify'](_0x27730d));delete _0x27730d[_0xbd3e('0x35')];if(_0x26339e===0x191){_0x26339e=0x190;}_0x2ab9b8[_0xbd3e('0x2b')](_0x26339e)[_0xbd3e('0x36')](_0x1a8633[_0xbd3e('0x3e')]['test']?{'message':_0xbd3e('0x6e'),'statusCode':_0x27730d[_0xbd3e('0x6b')]}:_0x27730d);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index fe818fa..9da7694 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d9e=['rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','api','bluebird','path'];(function(_0x43b8ed,_0x1fefed){var _0x2d9fd4=function(_0x289531){while(--_0x289531){_0x43b8ed['push'](_0x43b8ed['shift']());}};_0x2d9fd4(++_0x1fefed);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x46a2c2,_0x14b9dd){_0x46a2c2=_0x46a2c2-0x0;var _0x5b64cd=_0x4d9e[_0x46a2c2];return _0x5b64cd;};'use strict';var _=require(_0xe4d9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe4d9('0x1'));var moment=require('moment');var BPromise=require(_0xe4d9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe4d9('0x3'));var rimraf=require(_0xe4d9('0x4'));var config=require('../../config/environment');var attributes=require(_0xe4d9('0x5'));var integrations=require(_0xe4d9('0x6'));module[_0xe4d9('0x7')]=function(_0x34c2a2,_0x125dbc){return _0x34c2a2[_0xe4d9('0x8')]('FreshsalesAccount',attributes,{'tableName':_0xe4d9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bc3=['rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','int_freshsales_accounts','lodash','util','api','moment','request-promise','path'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x4bc3,0x16e));var _0x34bc=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x4bc3[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var logger=require('../../config/logger')(_0x34bc('0x2'));var moment=require(_0x34bc('0x3'));var BPromise=require('bluebird');var rp=require(_0x34bc('0x4'));var fs=require('fs');var path=require(_0x34bc('0x5'));var rimraf=require(_0x34bc('0x6'));var config=require(_0x34bc('0x7'));var attributes=require(_0x34bc('0x8'));var integrations=require(_0x34bc('0x9'));module[_0x34bc('0xa')]=function(_0x4c63a1,_0x21451b){return _0x4c63a1['define']('FreshsalesAccount',attributes,{'tableName':_0x34bc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 67d6901..6e495e9 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf79e=['message','result','catch','GetFreshsalesAccount','findAll','options','attributes','limit','include','map','model','ShowFreshsalesAccount','FreshsalesAccount','raw','where','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x203211,_0x34e672){var _0x7d6f5c=function(_0x325cac){while(--_0x325cac){_0x203211['push'](_0x203211['shift']());}};_0x7d6f5c(++_0x34e672);}(_0xf79e,0x185));var _0xef79=function(_0x21e418,_0xcedbf5){_0x21e418=_0x21e418-0x0;var _0x3e5bc7=_0xf79e[_0x21e418];return _0x3e5bc7;};'use strict';var _=require('lodash');var util=require(_0xef79('0x0'));var moment=require(_0xef79('0x1'));var BPromise=require(_0xef79('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xef79('0x3'));var db=require(_0xef79('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xef79('0x5'));var config=require(_0xef79('0x6'));var jayson=require(_0xef79('0x7'));var client=jayson[_0xef79('0x8')][_0xef79('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fa668,_0x49d0ea,_0x1e7443){return new BPromise(function(_0x4a8de0,_0x33b384){return client[_0xef79('0xa')](_0x2fa668,_0x1e7443)['then'](function(_0x42dee6){logger[_0xef79('0xb')](_0xef79('0xc'),_0x49d0ea,_0xef79('0xd'));logger[_0xef79('0xe')](_0xef79('0xf'),_0x49d0ea,_0xef79('0xd'),JSON[_0xef79('0x10')](_0x42dee6));if(_0x42dee6['error']){if(_0x42dee6[_0xef79('0x11')][_0xef79('0x12')]===0x1f4){logger[_0xef79('0x11')](_0xef79('0xc'),_0x49d0ea,_0x42dee6[_0xef79('0x11')][_0xef79('0x13')]);return _0x33b384(_0x42dee6[_0xef79('0x11')][_0xef79('0x13')]);}logger[_0xef79('0x11')](_0xef79('0xc'),_0x49d0ea,_0x42dee6['error']['message']);return _0x4a8de0(_0x42dee6['error']['message']);}else{logger[_0xef79('0xb')](_0xef79('0xc'),_0x49d0ea,_0xef79('0xd'));_0x4a8de0(_0x42dee6[_0xef79('0x14')]['message']);}})[_0xef79('0x15')](function(_0x6a689c){logger['error'](_0xef79('0xc'),_0x49d0ea,_0x6a689c);_0x33b384(_0x6a689c);});});}exports[_0xef79('0x16')]=function(_0x249a8c){var _0x406ca2=this;return new Promise(function(_0x55492c,_0x276b8b){return db['FreshsalesAccount'][_0xef79('0x17')]({'raw':_0x249a8c[_0xef79('0x18')]?_0x249a8c[_0xef79('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x249a8c[_0xef79('0x18')]?_0x249a8c[_0xef79('0x18')]['where']||null:null,'attributes':_0x249a8c['options']?_0x249a8c[_0xef79('0x18')][_0xef79('0x19')]||null:null,'limit':_0x249a8c['options']?_0x249a8c[_0xef79('0x18')][_0xef79('0x1a')]||null:null,'include':_0x249a8c[_0xef79('0x18')]?_0x249a8c['options'][_0xef79('0x1b')]?_['map'](_0x249a8c['options'][_0xef79('0x1b')],function(_0x196672){return{'model':db[_0x196672['model']],'as':_0x196672['as'],'attributes':_0x196672[_0xef79('0x19')],'include':_0x196672[_0xef79('0x1b')]?_[_0xef79('0x1c')](_0x196672[_0xef79('0x1b')],function(_0x5b4017){return{'model':db[_0x5b4017[_0xef79('0x1d')]],'as':_0x5b4017['as'],'attributes':_0x5b4017[_0xef79('0x19')],'include':_0x5b4017[_0xef79('0x1b')]?_[_0xef79('0x1c')](_0x5b4017['include'],function(_0x38ec60){return{'model':db[_0x38ec60['model']],'as':_0x38ec60['as'],'attributes':_0x38ec60[_0xef79('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x102d6f){logger[_0xef79('0xb')](_0xef79('0x16'),_0x249a8c);logger[_0xef79('0xe')](_0xef79('0x16'),_0x249a8c,JSON[_0xef79('0x10')](_0x102d6f));_0x55492c(_0x102d6f);})[_0xef79('0x15')](function(_0x2e3bbf){logger['error'](_0xef79('0x16'),_0x2e3bbf['message'],_0x249a8c);_0x276b8b(_0x406ca2[_0xef79('0x11')](0x1f4,_0x2e3bbf[_0xef79('0x13')]));});});};exports[_0xef79('0x1e')]=function(_0x34db2f){var _0x84ad52=this;return new Promise(function(_0x3bb745,_0x2d70ce){return db[_0xef79('0x1f')]['find']({'raw':_0x34db2f[_0xef79('0x18')]?_0x34db2f[_0xef79('0x18')][_0xef79('0x20')]===undefined?!![]:![]:!![],'where':_0x34db2f[_0xef79('0x18')]?_0x34db2f[_0xef79('0x18')][_0xef79('0x21')]||null:null,'attributes':_0x34db2f[_0xef79('0x18')]?_0x34db2f['options'][_0xef79('0x19')]||null:null,'include':_0x34db2f[_0xef79('0x18')]?_0x34db2f[_0xef79('0x18')][_0xef79('0x1b')]?_[_0xef79('0x1c')](_0x34db2f[_0xef79('0x18')][_0xef79('0x1b')],function(_0x360b28){return{'model':db[_0x360b28[_0xef79('0x1d')]],'as':_0x360b28['as'],'attributes':_0x360b28[_0xef79('0x19')],'include':_0x360b28[_0xef79('0x1b')]?_[_0xef79('0x1c')](_0x360b28[_0xef79('0x1b')],function(_0x41d36b){return{'model':db[_0x41d36b[_0xef79('0x1d')]],'as':_0x41d36b['as'],'attributes':_0x41d36b[_0xef79('0x19')],'include':_0x41d36b[_0xef79('0x1b')]?_[_0xef79('0x1c')](_0x41d36b[_0xef79('0x1b')],function(_0x565cf1){return{'model':db[_0x565cf1['model']],'as':_0x565cf1['as'],'attributes':_0x565cf1[_0xef79('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4bc12a){logger['info'](_0xef79('0x1e'),_0x34db2f);logger[_0xef79('0xe')]('ShowFreshsalesAccount',_0x34db2f,JSON[_0xef79('0x10')](_0x4bc12a));_0x3bb745(_0x4bc12a);})['catch'](function(_0x529bb4){logger['error'](_0xef79('0x1e'),_0x529bb4[_0xef79('0x13')],_0x34db2f);_0x2d70ce(_0x84ad52[_0xef79('0x11')](0x1f4,_0x529bb4[_0xef79('0x13')]));});});}; \ No newline at end of file +var _0xafcd=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','map','include','model','stringify','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x5614cb,_0x523e23){var _0xa68aa1=function(_0x3eac8f){while(--_0x3eac8f){_0x5614cb['push'](_0x5614cb['shift']());}};_0xa68aa1(++_0x523e23);}(_0xafcd,0x157));var _0xdafc=function(_0x37464d,_0x29bf11){_0x37464d=_0x37464d-0x0;var _0x4e7573=_0xafcd[_0x37464d];return _0x4e7573;};'use strict';var _=require(_0xdafc('0x0'));var util=require(_0xdafc('0x1'));var moment=require(_0xdafc('0x2'));var BPromise=require(_0xdafc('0x3'));var rs=require(_0xdafc('0x4'));var fs=require('fs');var Redis=require(_0xdafc('0x5'));var db=require(_0xdafc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdafc('0x7'))(_0xdafc('0x8'));var config=require(_0xdafc('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdafc('0xa')][_0xdafc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33adc9,_0x52872c,_0x24f2e7){return new BPromise(function(_0x255125,_0x397db6){return client[_0xdafc('0xc')](_0x33adc9,_0x24f2e7)[_0xdafc('0xd')](function(_0x241787){logger[_0xdafc('0xe')](_0xdafc('0xf'),_0x52872c,_0xdafc('0x10'));logger[_0xdafc('0x11')](_0xdafc('0x12'),_0x52872c,'request\x20sent',JSON['stringify'](_0x241787));if(_0x241787[_0xdafc('0x13')]){if(_0x241787[_0xdafc('0x13')][_0xdafc('0x14')]===0x1f4){logger[_0xdafc('0x13')](_0xdafc('0xf'),_0x52872c,_0x241787['error']['message']);return _0x397db6(_0x241787['error'][_0xdafc('0x15')]);}logger['error'](_0xdafc('0xf'),_0x52872c,_0x241787['error'][_0xdafc('0x15')]);return _0x255125(_0x241787[_0xdafc('0x13')][_0xdafc('0x15')]);}else{logger[_0xdafc('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x52872c,'request\x20sent');_0x255125(_0x241787[_0xdafc('0x16')][_0xdafc('0x15')]);}})[_0xdafc('0x17')](function(_0x5bfac1){logger['error'](_0xdafc('0xf'),_0x52872c,_0x5bfac1);_0x397db6(_0x5bfac1);});});}exports[_0xdafc('0x18')]=function(_0xdab843){var _0x2fef1b=this;return new Promise(function(_0x17136e,_0x3d2274){return db[_0xdafc('0x19')][_0xdafc('0x1a')]({'raw':_0xdab843['options']?_0xdab843[_0xdafc('0x1b')][_0xdafc('0x1c')]===undefined?!![]:![]:!![],'where':_0xdab843['options']?_0xdab843[_0xdafc('0x1b')][_0xdafc('0x1d')]||null:null,'attributes':_0xdab843[_0xdafc('0x1b')]?_0xdab843[_0xdafc('0x1b')][_0xdafc('0x1e')]||null:null,'limit':_0xdab843[_0xdafc('0x1b')]?_0xdab843['options']['limit']||null:null,'include':_0xdab843['options']?_0xdab843[_0xdafc('0x1b')]['include']?_[_0xdafc('0x1f')](_0xdab843[_0xdafc('0x1b')][_0xdafc('0x20')],function(_0x17c2f6){return{'model':db[_0x17c2f6['model']],'as':_0x17c2f6['as'],'attributes':_0x17c2f6[_0xdafc('0x1e')],'include':_0x17c2f6[_0xdafc('0x20')]?_['map'](_0x17c2f6[_0xdafc('0x20')],function(_0x320aec){return{'model':db[_0x320aec[_0xdafc('0x21')]],'as':_0x320aec['as'],'attributes':_0x320aec[_0xdafc('0x1e')],'include':_0x320aec[_0xdafc('0x20')]?_[_0xdafc('0x1f')](_0x320aec[_0xdafc('0x20')],function(_0x4a98c5){return{'model':db[_0x4a98c5[_0xdafc('0x21')]],'as':_0x4a98c5['as'],'attributes':_0x4a98c5[_0xdafc('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29b376){logger['info']('GetFreshsalesAccount',_0xdab843);logger[_0xdafc('0x11')]('GetFreshsalesAccount',_0xdab843,JSON[_0xdafc('0x22')](_0x29b376));_0x17136e(_0x29b376);})[_0xdafc('0x17')](function(_0x5d62e1){logger[_0xdafc('0x13')]('GetFreshsalesAccount',_0x5d62e1['message'],_0xdab843);_0x3d2274(_0x2fef1b['error'](0x1f4,_0x5d62e1[_0xdafc('0x15')]));});});};exports[_0xdafc('0x23')]=function(_0x1fe569){var _0x219e1e=this;return new Promise(function(_0x2def88,_0x100ca6){return db[_0xdafc('0x19')]['find']({'raw':_0x1fe569[_0xdafc('0x1b')]?_0x1fe569[_0xdafc('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x1fe569['options']?_0x1fe569[_0xdafc('0x1b')][_0xdafc('0x1d')]||null:null,'attributes':_0x1fe569['options']?_0x1fe569['options'][_0xdafc('0x1e')]||null:null,'include':_0x1fe569[_0xdafc('0x1b')]?_0x1fe569['options']['include']?_['map'](_0x1fe569['options'][_0xdafc('0x20')],function(_0x552900){return{'model':db[_0x552900[_0xdafc('0x21')]],'as':_0x552900['as'],'attributes':_0x552900[_0xdafc('0x1e')],'include':_0x552900[_0xdafc('0x20')]?_[_0xdafc('0x1f')](_0x552900['include'],function(_0x301155){return{'model':db[_0x301155[_0xdafc('0x21')]],'as':_0x301155['as'],'attributes':_0x301155[_0xdafc('0x1e')],'include':_0x301155[_0xdafc('0x20')]?_[_0xdafc('0x1f')](_0x301155[_0xdafc('0x20')],function(_0x56c87c){return{'model':db[_0x56c87c[_0xdafc('0x21')]],'as':_0x56c87c['as'],'attributes':_0x56c87c[_0xdafc('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xdafc('0xd')](function(_0x5ca6dc){logger[_0xdafc('0xe')]('ShowFreshsalesAccount',_0x1fe569);logger[_0xdafc('0x11')]('ShowFreshsalesAccount',_0x1fe569,JSON[_0xdafc('0x22')](_0x5ca6dc));_0x2def88(_0x5ca6dc);})[_0xdafc('0x17')](function(_0x1e5ab1){logger[_0xdafc('0x13')](_0xdafc('0x23'),_0x1e5ab1[_0xdafc('0x15')],_0x1fe569);_0x100ca6(_0x219e1e[_0xdafc('0x13')](0x1f4,_0x1e5ab1['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 3e8caf5..ec6b4cb 100644 --- a/server/api/intFreshsalesConfiguration/index.js +++ b/server/api/intFreshsalesConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb89b=['post','create','put','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','/:id','show','get','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb89b,0x155));var _0xbb89=function(_0x3794d6,_0x5671ce){_0x3794d6=_0x3794d6-0x0;var _0x1abad8=_0xb89b[_0x3794d6];return _0x1abad8;};'use strict';var multer=require(_0xbb89('0x0'));var util=require(_0xbb89('0x1'));var path=require(_0xbb89('0x2'));var timeout=require(_0xbb89('0x3'));var express=require('express');var router=express[_0xbb89('0x4')]();var auth=require(_0xbb89('0x5'));var interaction=require(_0xbb89('0x6'));var config=require(_0xbb89('0x7'));var controller=require(_0xbb89('0x8'));router['get']('/',auth[_0xbb89('0x9')](),controller[_0xbb89('0xa')]);router['get'](_0xbb89('0xb'),auth[_0xbb89('0x9')](),controller[_0xbb89('0xc')]);router[_0xbb89('0xd')]('/:id/subjects',auth[_0xbb89('0x9')](),controller[_0xbb89('0xe')]);router[_0xbb89('0xd')](_0xbb89('0xf'),auth[_0xbb89('0x9')](),controller[_0xbb89('0x10')]);router[_0xbb89('0xd')](_0xbb89('0x11'),auth[_0xbb89('0x9')](),controller[_0xbb89('0x12')]);router[_0xbb89('0x13')]('/',auth['isAuthenticated'](),controller[_0xbb89('0x14')]);router[_0xbb89('0x15')](_0xbb89('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xbb89('0x16')](_0xbb89('0xb'),auth['isAuthenticated'](),controller[_0xbb89('0x17')]);module['exports']=router; \ No newline at end of file +var _0xd885=['isAuthenticated','/:id','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get'];(function(_0x234d56,_0x4eee01){var _0xd47811=function(_0x52d2e0){while(--_0x52d2e0){_0x234d56['push'](_0x234d56['shift']());}};_0xd47811(++_0x4eee01);}(_0xd885,0x1a6));var _0x5d88=function(_0x442dc9,_0x2ccbe1){_0x442dc9=_0x442dc9-0x0;var _0x30ace6=_0xd885[_0x442dc9];return _0x30ace6;};'use strict';var multer=require(_0x5d88('0x0'));var util=require(_0x5d88('0x1'));var path=require('path');var timeout=require(_0x5d88('0x2'));var express=require(_0x5d88('0x3'));var router=express[_0x5d88('0x4')]();var auth=require(_0x5d88('0x5'));var interaction=require(_0x5d88('0x6'));var config=require(_0x5d88('0x7'));var controller=require(_0x5d88('0x8'));router[_0x5d88('0x9')]('/',auth[_0x5d88('0xa')](),controller['index']);router[_0x5d88('0x9')](_0x5d88('0xb'),auth[_0x5d88('0xa')](),controller['show']);router['get'](_0x5d88('0xc'),auth[_0x5d88('0xa')](),controller['getSubjects']);router[_0x5d88('0x9')](_0x5d88('0xd'),auth[_0x5d88('0xa')](),controller[_0x5d88('0xe')]);router[_0x5d88('0x9')](_0x5d88('0xf'),auth[_0x5d88('0xa')](),controller[_0x5d88('0x10')]);router[_0x5d88('0x11')]('/',auth[_0x5d88('0xa')](),controller[_0x5d88('0x12')]);router[_0x5d88('0x13')](_0x5d88('0xb'),auth[_0x5d88('0xa')](),controller[_0x5d88('0x14')]);router[_0x5d88('0x15')](_0x5d88('0xb'),auth['isAuthenticated'](),controller[_0x5d88('0x16')]);module[_0x5d88('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 903b3c5..5b95e7b 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2366=['STRING','sequelize','exports'];(function(_0x2ee015,_0x3e7447){var _0x5a78a4=function(_0x21ad1d){while(--_0x21ad1d){_0x2ee015['push'](_0x2ee015['shift']());}};_0x5a78a4(++_0x3e7447);}(_0x2366,0x7c));var _0x6236=function(_0x541095,_0x582b30){_0x541095=_0x541095-0x0;var _0x5a2c40=_0x2366[_0x541095];return _0x5a2c40;};'use strict';var Sequelize=require(_0x6236('0x0'));module[_0x6236('0x1')]={'name':{'type':Sequelize[_0x6236('0x2')]},'description':{'type':Sequelize[_0x6236('0x2')]}}; \ No newline at end of file +var _0xd222=['exports','STRING','sequelize'];(function(_0x3997b0,_0x40f471){var _0x85ed2a=function(_0x1ef1c7){while(--_0x1ef1c7){_0x3997b0['push'](_0x3997b0['shift']());}};_0x85ed2a(++_0x40f471);}(_0xd222,0xb6));var _0x2d22=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xd222[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require(_0x2d22('0x0'));module[_0x2d22('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2d22('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 358cc20..acccf44 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8195=['rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','FreshsalesConfiguration','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','FreshsalesField','getSubjects','nolimit','getDescriptions','getFields','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','FreshsalesConfiguration,\x20%s,\x20%s','message','info','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','destroy','stack','name','send','map'];(function(_0x40c387,_0x57506b){var _0x21aa1b=function(_0xc00dd0){while(--_0xc00dd0){_0x40c387['push'](_0x40c387['shift']());}};_0x21aa1b(++_0x57506b);}(_0x8195,0x7f));var _0x5819=function(_0x309cbc,_0x543e8f){_0x309cbc=_0x309cbc-0x0;var _0x2ac832=_0x8195[_0x309cbc];return _0x2ac832;};'use strict';var pdf=require(_0x5819('0x0'));var emlformat=require(_0x5819('0x1'));var rimraf=require(_0x5819('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5819('0x3'));var rp=require(_0x5819('0x4'));var moment=require(_0x5819('0x5'));var BPromise=require(_0x5819('0x6'));var Mustache=require(_0x5819('0x7'));var util=require(_0x5819('0x8'));var path=require(_0x5819('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5819('0xa'));var squel=require('squel');var crypto=require(_0x5819('0xb'));var jsforce=require(_0x5819('0xc'));var deskjs=require(_0x5819('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5819('0xe'));var Papa=require(_0x5819('0xf'));var Redis=require(_0x5819('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5819('0x11'));var hardwareService=require(_0x5819('0x12'));var logger=require('../../config/logger')(_0x5819('0x13'));var utils=require(_0x5819('0x14'));var config=require(_0x5819('0x15'));var db=require(_0x5819('0x16'))['db'];var jayson=require(_0x5819('0x17'));var client=jayson[_0x5819('0x18')][_0x5819('0x19')]({'port':0x232a});function checkPasswordPattern(_0x5f206d,_0x2fa7fd,_0x4d4f7b){if(_0x4d4f7b){var _0x2a174d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a174d['test'](_0x2fa7fd)){return _0x5f206d;}else{throw new db[(_0x5819('0x1a'))][(_0x5819('0x1b'))](_0x5819('0x1c'));}}else{return _0x5f206d;}}function respondWithRpcPromise(_0x364581,_0x512391,_0x2206ff,_0x3e2060){return new BPromise(function(_0x3b2fee,_0x54de53){var _0x469962=_0x3e2060||client;return _0x469962[_0x5819('0x1d')](_0x364581,_0x2206ff)[_0x5819('0x1e')](function(_0x1cea6e){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x512391,_0x5819('0x1f'));logger[_0x5819('0x20')](_0x5819('0x21'),_0x512391,_0x5819('0x1f'),JSON[_0x5819('0x22')](_0x1cea6e));if(_0x1cea6e['error']){if(_0x1cea6e[_0x5819('0x23')]['code']===0x1f4){logger[_0x5819('0x23')](_0x5819('0x24'),_0x512391,_0x1cea6e['error'][_0x5819('0x25')]);return _0x54de53(_0x1cea6e['error'][_0x5819('0x25')]);}logger[_0x5819('0x23')](_0x5819('0x24'),_0x512391,_0x1cea6e[_0x5819('0x23')][_0x5819('0x25')]);return _0x3b2fee(_0x1cea6e['error'][_0x5819('0x25')]);}else{logger[_0x5819('0x26')](_0x5819('0x24'),_0x512391,_0x5819('0x1f'));_0x3b2fee(_0x1cea6e['result']['message']);}})['catch'](function(_0xd065ba){logger[_0x5819('0x23')](_0x5819('0x24'),_0x512391,_0xd065ba);_0x54de53(_0xd065ba);});});}function respondWithStatusCode(_0x3e2e57,_0x18ded1){_0x18ded1=_0x18ded1||0xcc;return function(_0x35af0b){if(_0x35af0b){return _0x3e2e57[_0x5819('0x27')](_0x18ded1);}return _0x3e2e57[_0x5819('0x28')](_0x18ded1)[_0x5819('0x29')]();};}function respondWithResult(_0x5da6be,_0xa459ae){_0xa459ae=_0xa459ae||0xc8;return function(_0x4e38e6){if(_0x4e38e6){return _0x5da6be[_0x5819('0x28')](_0xa459ae)[_0x5819('0x2a')](_0x4e38e6);}};}function respondWithFilteredResult(_0x2baf15,_0x2a14af){return function(_0x291f61){if(_0x291f61){var _0x499674=_0x291f61[_0x5819('0x2b')],_0x583a3a=_0x2a14af['offset'],_0x4517cc=_0x2a14af[_0x5819('0x2c')]+_0x2a14af[_0x5819('0x2d')],_0x5b4617;if(_0x4517cc>=_0x499674){_0x4517cc=_0x499674;_0x5b4617=0xc8;}else{_0x5b4617=0xce;}_0x2baf15[_0x5819('0x28')](_0x5b4617);return _0x2baf15['set']('Content-Range',_0x583a3a+'-'+_0x4517cc+'/'+_0x499674)[_0x5819('0x2a')](_0x291f61);}return null;};}function patchUpdates(_0xca90c0){return function(_0x224295){try{jsonpatch[_0x5819('0x2e')](_0x224295,_0xca90c0,!![]);}catch(_0x1c33df){return BPromise[_0x5819('0x2f')](_0x1c33df);}return _0x224295[_0x5819('0x30')]();};}function saveUpdates(_0x199ca4,_0x40c18c){return function(_0x247606){if(_0x247606){return _0x247606[_0x5819('0x31')](_0x199ca4)[_0x5819('0x1e')](function(_0xa74582){return _0xa74582;});}return null;};}function removeEntity(_0x3214de,_0x1138da){return function(_0xd32abb){if(_0xd32abb){return _0xd32abb[_0x5819('0x32')]()[_0x5819('0x1e')](function(){_0x3214de[_0x5819('0x28')](0xcc)[_0x5819('0x29')]();});}};}function handleEntityNotFound(_0x46dee0,_0x2241c8){return function(_0x2ad046){if(!_0x2ad046){_0x46dee0[_0x5819('0x27')](0x194);}return _0x2ad046;};}function handleError(_0x234fc0,_0x3dfcba){_0x3dfcba=_0x3dfcba||0x1f4;return function(_0x563df5){logger[_0x5819('0x23')](_0x563df5[_0x5819('0x33')]);if(_0x563df5[_0x5819('0x34')]){delete _0x563df5[_0x5819('0x34')];}_0x234fc0[_0x5819('0x28')](_0x3dfcba)[_0x5819('0x35')](_0x563df5);};}exports['index']=function(_0x593756,_0x5ee9af){var _0x22e2f4={},_0x589ac6={},_0x45da41={'count':0x0,'rows':[]};var _0x4bef33=_[_0x5819('0x36')](db['FreshsalesConfiguration'][_0x5819('0x37')],function(_0x52ed57){return{'name':_0x52ed57[_0x5819('0x38')],'type':_0x52ed57[_0x5819('0x39')]['key']};});_0x589ac6[_0x5819('0x3a')]=_[_0x5819('0x36')](_0x4bef33,_0x5819('0x34'));_0x589ac6[_0x5819('0x3b')]=_[_0x5819('0x3c')](_0x593756['query']);_0x589ac6[_0x5819('0x3d')]=_[_0x5819('0x3e')](_0x589ac6['model'],_0x589ac6[_0x5819('0x3b')]);_0x22e2f4[_0x5819('0x3f')]=_['intersection'](_0x589ac6[_0x5819('0x3a')],qs[_0x5819('0x40')](_0x593756[_0x5819('0x3b')]['fields']));_0x22e2f4['attributes']=_0x22e2f4[_0x5819('0x3f')][_0x5819('0x41')]?_0x22e2f4['attributes']:_0x589ac6['model'];if(!_0x593756[_0x5819('0x3b')][_0x5819('0x42')]('nolimit')){_0x22e2f4[_0x5819('0x2d')]=qs[_0x5819('0x2d')](_0x593756[_0x5819('0x3b')][_0x5819('0x2d')]);_0x22e2f4[_0x5819('0x2c')]=qs[_0x5819('0x2c')](_0x593756[_0x5819('0x3b')][_0x5819('0x2c')]);}_0x22e2f4[_0x5819('0x43')]=qs[_0x5819('0x44')](_0x593756['query']['sort']);_0x22e2f4[_0x5819('0x45')]=qs[_0x5819('0x3d')](_[_0x5819('0x46')](_0x593756[_0x5819('0x3b')],_0x589ac6[_0x5819('0x3d')]),_0x4bef33);if(_0x593756[_0x5819('0x3b')]['filter']){_0x22e2f4[_0x5819('0x45')]=_[_0x5819('0x47')](_0x22e2f4[_0x5819('0x45')],{'$or':_[_0x5819('0x36')](_0x4bef33,function(_0x2aae22){if(_0x2aae22[_0x5819('0x39')]!=='VIRTUAL'){var _0x45357e={};_0x45357e[_0x2aae22[_0x5819('0x34')]]={'$like':'%'+_0x593756['query'][_0x5819('0x48')]+'%'};return _0x45357e;}})});}_0x22e2f4=_['merge']({},_0x22e2f4,_0x593756[_0x5819('0x49')]);var _0x57e1c7={'where':_0x22e2f4['where']};return db[_0x5819('0x4a')]['count'](_0x57e1c7)['then'](function(_0x43992e){_0x45da41['count']=_0x43992e;if(_0x593756['query'][_0x5819('0x4b')]){_0x22e2f4[_0x5819('0x4c')]=[{'all':!![]}];}return db[_0x5819('0x4a')][_0x5819('0x4d')](_0x22e2f4);})[_0x5819('0x1e')](function(_0x5d44f5){_0x45da41[_0x5819('0x4e')]=_0x5d44f5;return _0x45da41;})['then'](respondWithFilteredResult(_0x5ee9af,_0x22e2f4))[_0x5819('0x4f')](handleError(_0x5ee9af,null));};exports[_0x5819('0x50')]=function(_0xa5b647,_0x1641a3){var _0x33d159={'raw':![],'where':{'id':_0xa5b647[_0x5819('0x51')]['id']}},_0x47cc74={};_0x47cc74[_0x5819('0x3a')]=_[_0x5819('0x3c')](db[_0x5819('0x4a')][_0x5819('0x37')]);_0x47cc74[_0x5819('0x3b')]=_['keys'](_0xa5b647[_0x5819('0x3b')]);_0x47cc74[_0x5819('0x3d')]=_[_0x5819('0x3e')](_0x47cc74[_0x5819('0x3a')],_0x47cc74[_0x5819('0x3b')]);_0x33d159[_0x5819('0x3f')]=_['intersection'](_0x47cc74[_0x5819('0x3a')],qs[_0x5819('0x40')](_0xa5b647['query'][_0x5819('0x40')]));_0x33d159[_0x5819('0x3f')]=_0x33d159[_0x5819('0x3f')][_0x5819('0x41')]?_0x33d159[_0x5819('0x3f')]:_0x47cc74[_0x5819('0x3a')];if(_0xa5b647[_0x5819('0x3b')][_0x5819('0x4b')]){_0x33d159[_0x5819('0x4c')]=[{'all':!![]}];}_0x33d159=_[_0x5819('0x47')]({},_0x33d159,_0xa5b647['options']);return db[_0x5819('0x4a')][_0x5819('0x52')](_0x33d159)[_0x5819('0x1e')](handleEntityNotFound(_0x1641a3,null))[_0x5819('0x1e')](respondWithResult(_0x1641a3,null))['catch'](handleError(_0x1641a3,null));};exports['create']=function(_0x1af998,_0x407f55){return db[_0x5819('0x4a')][_0x5819('0x53')](_0x1af998['body'],{})[_0x5819('0x1e')](respondWithResult(_0x407f55,0xc9))['catch'](handleError(_0x407f55,null));};exports[_0x5819('0x31')]=function(_0x4153fc,_0x3738c4){if(_0x4153fc[_0x5819('0x54')]['id']){delete _0x4153fc['body']['id'];}return db['FreshsalesConfiguration'][_0x5819('0x52')]({'where':{'id':_0x4153fc[_0x5819('0x51')]['id']}})['then'](handleEntityNotFound(_0x3738c4,null))[_0x5819('0x1e')](saveUpdates(_0x4153fc[_0x5819('0x54')],null))[_0x5819('0x1e')](respondWithResult(_0x3738c4,null))[_0x5819('0x4f')](handleError(_0x3738c4,null));};exports['destroy']=function(_0x74acda,_0xcf9931){return db[_0x5819('0x4a')][_0x5819('0x52')]({'where':{'id':_0x74acda[_0x5819('0x51')]['id']}})[_0x5819('0x1e')](handleEntityNotFound(_0xcf9931,null))[_0x5819('0x1e')](removeEntity(_0xcf9931,null))[_0x5819('0x4f')](handleError(_0xcf9931,null));};exports['getSubjects']=function(_0x558495,_0xeb08fd,_0x2dcae0){var _0x24321f={};var _0x4f2c6e={};var _0x1490f0;var _0x39f1b3;return db['FreshsalesConfiguration'][_0x5819('0x55')]({'where':{'id':_0x558495[_0x5819('0x51')]['id']}})[_0x5819('0x1e')](handleEntityNotFound(_0xeb08fd,null))[_0x5819('0x1e')](function(_0x58692e){if(_0x58692e){_0x1490f0=_0x58692e;_0x4f2c6e['model']=_[_0x5819('0x3c')](db[_0x5819('0x56')][_0x5819('0x37')]);_0x4f2c6e[_0x5819('0x3b')]=_['keys'](_0x558495[_0x5819('0x3b')]);_0x4f2c6e[_0x5819('0x3d')]=_[_0x5819('0x3e')](_0x4f2c6e[_0x5819('0x3a')],_0x4f2c6e[_0x5819('0x3b')]);_0x24321f[_0x5819('0x3f')]=_[_0x5819('0x3e')](_0x4f2c6e['model'],qs[_0x5819('0x40')](_0x558495[_0x5819('0x3b')]['fields']));_0x24321f[_0x5819('0x3f')]=_0x24321f[_0x5819('0x3f')]['length']?_0x24321f[_0x5819('0x3f')]:_0x4f2c6e[_0x5819('0x3a')];_0x24321f[_0x5819('0x43')]=qs[_0x5819('0x44')](_0x558495[_0x5819('0x3b')][_0x5819('0x44')]);_0x24321f[_0x5819('0x45')]=qs['filters'](_[_0x5819('0x46')](_0x558495[_0x5819('0x3b')],_0x4f2c6e[_0x5819('0x3d')]));if(_0x558495[_0x5819('0x3b')][_0x5819('0x48')]){_0x24321f[_0x5819('0x45')]=_[_0x5819('0x47')](_0x24321f[_0x5819('0x45')],{'$or':_[_0x5819('0x36')](_0x24321f[_0x5819('0x3f')],function(_0x56c335){var _0x32ccc9={};_0x32ccc9[_0x56c335]={'$like':'%'+_0x558495[_0x5819('0x3b')][_0x5819('0x48')]+'%'};return _0x32ccc9;})});}_0x24321f=_['merge']({},_0x24321f,_0x558495[_0x5819('0x49')]);return _0x1490f0[_0x5819('0x57')](_0x24321f);}})['then'](function(_0x64dba0){if(_0x64dba0){_0x39f1b3=_0x64dba0[_0x5819('0x41')];if(!_0x558495[_0x5819('0x3b')][_0x5819('0x42')](_0x5819('0x58'))){_0x24321f[_0x5819('0x2d')]=qs[_0x5819('0x2d')](_0x558495[_0x5819('0x3b')][_0x5819('0x2d')]);_0x24321f[_0x5819('0x2c')]=qs['offset'](_0x558495[_0x5819('0x3b')][_0x5819('0x2c')]);}return _0x1490f0[_0x5819('0x57')](_0x24321f);}})['then'](function(_0x4fd083){if(_0x4fd083){return _0x4fd083?{'count':_0x39f1b3,'rows':_0x4fd083}:null;}})[_0x5819('0x1e')](respondWithResult(_0xeb08fd,null))[_0x5819('0x4f')](handleError(_0xeb08fd,null));};exports[_0x5819('0x59')]=function(_0xe1c9f0,_0x35404b,_0x31f40b){var _0x1f65e7={};var _0xf0e9={};var _0x29829b;var _0x473676;return db[_0x5819('0x4a')]['findOne']({'where':{'id':_0xe1c9f0['params']['id']}})[_0x5819('0x1e')](handleEntityNotFound(_0x35404b,null))[_0x5819('0x1e')](function(_0x1f5da4){if(_0x1f5da4){_0x29829b=_0x1f5da4;_0xf0e9['model']=_[_0x5819('0x3c')](db[_0x5819('0x56')][_0x5819('0x37')]);_0xf0e9[_0x5819('0x3b')]=_[_0x5819('0x3c')](_0xe1c9f0[_0x5819('0x3b')]);_0xf0e9[_0x5819('0x3d')]=_['intersection'](_0xf0e9[_0x5819('0x3a')],_0xf0e9[_0x5819('0x3b')]);_0x1f65e7[_0x5819('0x3f')]=_[_0x5819('0x3e')](_0xf0e9[_0x5819('0x3a')],qs['fields'](_0xe1c9f0[_0x5819('0x3b')]['fields']));_0x1f65e7['attributes']=_0x1f65e7[_0x5819('0x3f')]['length']?_0x1f65e7[_0x5819('0x3f')]:_0xf0e9[_0x5819('0x3a')];_0x1f65e7[_0x5819('0x43')]=qs[_0x5819('0x44')](_0xe1c9f0[_0x5819('0x3b')][_0x5819('0x44')]);_0x1f65e7['where']=qs[_0x5819('0x3d')](_['pick'](_0xe1c9f0['query'],_0xf0e9[_0x5819('0x3d')]));if(_0xe1c9f0[_0x5819('0x3b')][_0x5819('0x48')]){_0x1f65e7['where']=_[_0x5819('0x47')](_0x1f65e7[_0x5819('0x45')],{'$or':_[_0x5819('0x36')](_0x1f65e7[_0x5819('0x3f')],function(_0x213fe6){var _0x253007={};_0x253007[_0x213fe6]={'$like':'%'+_0xe1c9f0['query'][_0x5819('0x48')]+'%'};return _0x253007;})});}_0x1f65e7=_[_0x5819('0x47')]({},_0x1f65e7,_0xe1c9f0[_0x5819('0x49')]);return _0x29829b[_0x5819('0x59')](_0x1f65e7);}})['then'](function(_0x5640f2){if(_0x5640f2){_0x473676=_0x5640f2[_0x5819('0x41')];if(!_0xe1c9f0[_0x5819('0x3b')]['hasOwnProperty']('nolimit')){_0x1f65e7[_0x5819('0x2d')]=qs[_0x5819('0x2d')](_0xe1c9f0[_0x5819('0x3b')]['limit']);_0x1f65e7[_0x5819('0x2c')]=qs[_0x5819('0x2c')](_0xe1c9f0['query'][_0x5819('0x2c')]);}return _0x29829b[_0x5819('0x59')](_0x1f65e7);}})['then'](function(_0x53e731){if(_0x53e731){return _0x53e731?{'count':_0x473676,'rows':_0x53e731}:null;}})[_0x5819('0x1e')](respondWithResult(_0x35404b,null))[_0x5819('0x4f')](handleError(_0x35404b,null));};exports['getFields']=function(_0x27dbbe,_0x5e2de3,_0x5c6bb2){var _0x467741={};var _0x964ba3={};var _0x295cb7;var _0x387804;return db[_0x5819('0x4a')][_0x5819('0x55')]({'where':{'id':_0x27dbbe[_0x5819('0x51')]['id']}})[_0x5819('0x1e')](handleEntityNotFound(_0x5e2de3,null))['then'](function(_0x1c0e40){if(_0x1c0e40){_0x295cb7=_0x1c0e40;_0x964ba3[_0x5819('0x3a')]=_[_0x5819('0x3c')](db['FreshsalesField'][_0x5819('0x37')]);_0x964ba3['query']=_[_0x5819('0x3c')](_0x27dbbe[_0x5819('0x3b')]);_0x964ba3['filters']=_[_0x5819('0x3e')](_0x964ba3[_0x5819('0x3a')],_0x964ba3[_0x5819('0x3b')]);_0x467741[_0x5819('0x3f')]=_[_0x5819('0x3e')](_0x964ba3[_0x5819('0x3a')],qs[_0x5819('0x40')](_0x27dbbe[_0x5819('0x3b')][_0x5819('0x40')]));_0x467741[_0x5819('0x3f')]=_0x467741[_0x5819('0x3f')][_0x5819('0x41')]?_0x467741['attributes']:_0x964ba3['model'];_0x467741['order']=qs[_0x5819('0x44')](_0x27dbbe[_0x5819('0x3b')]['sort']);_0x467741[_0x5819('0x45')]=qs[_0x5819('0x3d')](_[_0x5819('0x46')](_0x27dbbe[_0x5819('0x3b')],_0x964ba3[_0x5819('0x3d')]));if(_0x27dbbe[_0x5819('0x3b')][_0x5819('0x48')]){_0x467741[_0x5819('0x45')]=_[_0x5819('0x47')](_0x467741[_0x5819('0x45')],{'$or':_['map'](_0x467741['attributes'],function(_0x2bd60f){var _0x50ee61={};_0x50ee61[_0x2bd60f]={'$like':'%'+_0x27dbbe['query'][_0x5819('0x48')]+'%'};return _0x50ee61;})});}_0x467741=_['merge']({},_0x467741,_0x27dbbe['options']);return _0x295cb7[_0x5819('0x5a')](_0x467741);}})[_0x5819('0x1e')](function(_0x7900f1){if(_0x7900f1){_0x387804=_0x7900f1[_0x5819('0x41')];if(!_0x27dbbe[_0x5819('0x3b')][_0x5819('0x42')](_0x5819('0x58'))){_0x467741['limit']=qs['limit'](_0x27dbbe[_0x5819('0x3b')][_0x5819('0x2d')]);_0x467741[_0x5819('0x2c')]=qs['offset'](_0x27dbbe['query'][_0x5819('0x2c')]);}return _0x295cb7[_0x5819('0x5a')](_0x467741);}})['then'](function(_0x44c9d6){if(_0x44c9d6){return _0x44c9d6?{'count':_0x387804,'rows':_0x44c9d6}:null;}})[_0x5819('0x1e')](respondWithResult(_0x5e2de3,null))[_0x5819('0x4f')](handleError(_0x5e2de3,null));}; \ No newline at end of file +var _0x098a=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','stack','send','index','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','name','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','findOne','order','getSubjects','nolimit','getDescriptions','FreshsalesField','getFields','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service'];(function(_0x58f112,_0x3d0cbc){var _0x5602d3=function(_0x142d70){while(--_0x142d70){_0x58f112['push'](_0x58f112['shift']());}};_0x5602d3(++_0x3d0cbc);}(_0x098a,0x1ce));var _0xa098=function(_0x4af6c9,_0x4c53fc){_0x4af6c9=_0x4af6c9-0x0;var _0x59074b=_0x098a[_0x4af6c9];return _0x59074b;};'use strict';var pdf=require(_0xa098('0x0'));var emlformat=require(_0xa098('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa098('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa098('0x3'));var moment=require(_0xa098('0x4'));var BPromise=require(_0xa098('0x5'));var Mustache=require(_0xa098('0x6'));var util=require(_0xa098('0x7'));var path=require(_0xa098('0x8'));var sox=require(_0xa098('0x9'));var csv=require(_0xa098('0xa'));var ejs=require(_0xa098('0xb'));var fs=require('fs');var _=require(_0xa098('0xc'));var squel=require(_0xa098('0xd'));var crypto=require('crypto');var jsforce=require(_0xa098('0xe'));var deskjs=require(_0xa098('0xf'));var toCsv=require(_0xa098('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa098('0x10'));var authService=require(_0xa098('0x11'));var qs=require(_0xa098('0x12'));var as=require(_0xa098('0x13'));var hardwareService=require(_0xa098('0x14'));var logger=require(_0xa098('0x15'))(_0xa098('0x16'));var utils=require('../../config/utils');var config=require(_0xa098('0x17'));var db=require(_0xa098('0x18'))['db'];var jayson=require(_0xa098('0x19'));var client=jayson['client'][_0xa098('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3ffb0c,_0x70fc68,_0x23505e){if(_0x23505e){var _0x33b0f2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33b0f2[_0xa098('0x1b')](_0x70fc68)){return _0x3ffb0c;}else{throw new db[(_0xa098('0x1c'))]['ValidationError'](_0xa098('0x1d'));}}else{return _0x3ffb0c;}}function respondWithRpcPromise(_0x19501a,_0x29d92e,_0x3e078a,_0xd93de8){return new BPromise(function(_0x2a2377,_0x5682d1){var _0x527693=_0xd93de8||client;return _0x527693['request'](_0x19501a,_0x3e078a)['then'](function(_0x504103){logger[_0xa098('0x1e')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x29d92e,_0xa098('0x1f'));logger[_0xa098('0x20')](_0xa098('0x21'),_0x29d92e,'request\x20sent',JSON[_0xa098('0x22')](_0x504103));if(_0x504103[_0xa098('0x23')]){if(_0x504103[_0xa098('0x23')][_0xa098('0x24')]===0x1f4){logger[_0xa098('0x23')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x29d92e,_0x504103[_0xa098('0x23')]['message']);return _0x5682d1(_0x504103[_0xa098('0x23')][_0xa098('0x25')]);}logger[_0xa098('0x23')](_0xa098('0x26'),_0x29d92e,_0x504103[_0xa098('0x23')][_0xa098('0x25')]);return _0x2a2377(_0x504103[_0xa098('0x23')][_0xa098('0x25')]);}else{logger[_0xa098('0x1e')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x29d92e,_0xa098('0x1f'));_0x2a2377(_0x504103[_0xa098('0x27')]['message']);}})['catch'](function(_0x5dcb2f){logger[_0xa098('0x23')](_0xa098('0x26'),_0x29d92e,_0x5dcb2f);_0x5682d1(_0x5dcb2f);});});}function respondWithStatusCode(_0x42aa79,_0x43d13e){_0x43d13e=_0x43d13e||0xcc;return function(_0x56e4f3){if(_0x56e4f3){return _0x42aa79[_0xa098('0x28')](_0x43d13e);}return _0x42aa79[_0xa098('0x29')](_0x43d13e)[_0xa098('0x2a')]();};}function respondWithResult(_0x585cf4,_0x232d35){_0x232d35=_0x232d35||0xc8;return function(_0x36b9b1){if(_0x36b9b1){return _0x585cf4[_0xa098('0x29')](_0x232d35)[_0xa098('0x2b')](_0x36b9b1);}};}function respondWithFilteredResult(_0x4c7816,_0x55a975){return function(_0x289034){if(_0x289034){var _0x46813e=_0x289034[_0xa098('0x2c')],_0x470c91=_0x55a975[_0xa098('0x2d')],_0xb207b8=_0x55a975[_0xa098('0x2d')]+_0x55a975[_0xa098('0x2e')],_0xcdbe3c;if(_0xb207b8>=_0x46813e){_0xb207b8=_0x46813e;_0xcdbe3c=0xc8;}else{_0xcdbe3c=0xce;}_0x4c7816['status'](_0xcdbe3c);return _0x4c7816[_0xa098('0x2f')]('Content-Range',_0x470c91+'-'+_0xb207b8+'/'+_0x46813e)[_0xa098('0x2b')](_0x289034);}return null;};}function patchUpdates(_0xf305be){return function(_0x389e09){try{jsonpatch[_0xa098('0x30')](_0x389e09,_0xf305be,!![]);}catch(_0x430910){return BPromise[_0xa098('0x31')](_0x430910);}return _0x389e09[_0xa098('0x32')]();};}function saveUpdates(_0x22ff30,_0x4968b6){return function(_0x48191a){if(_0x48191a){return _0x48191a['update'](_0x22ff30)[_0xa098('0x33')](function(_0x2d66f3){return _0x2d66f3;});}return null;};}function removeEntity(_0x996fdb,_0x56fd28){return function(_0xa219dd){if(_0xa219dd){return _0xa219dd['destroy']()['then'](function(){_0x996fdb[_0xa098('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x522783,_0x20dce6){return function(_0x5008d1){if(!_0x5008d1){_0x522783[_0xa098('0x28')](0x194);}return _0x5008d1;};}function handleError(_0x25a2b0,_0x52d36d){_0x52d36d=_0x52d36d||0x1f4;return function(_0x526d5f){logger[_0xa098('0x23')](_0x526d5f[_0xa098('0x34')]);if(_0x526d5f['name']){delete _0x526d5f['name'];}_0x25a2b0[_0xa098('0x29')](_0x52d36d)[_0xa098('0x35')](_0x526d5f);};}exports[_0xa098('0x36')]=function(_0x4f7941,_0x35972c){var _0xa4b876={},_0x17cc36={},_0x44e3d3={'count':0x0,'rows':[]};var _0x36c42a=_['map'](db[_0xa098('0x37')][_0xa098('0x38')],function(_0x3513b6){return{'name':_0x3513b6[_0xa098('0x39')],'type':_0x3513b6[_0xa098('0x3a')][_0xa098('0x3b')]};});_0x17cc36[_0xa098('0x3c')]=_[_0xa098('0x3d')](_0x36c42a,'name');_0x17cc36[_0xa098('0x3e')]=_[_0xa098('0x3f')](_0x4f7941[_0xa098('0x3e')]);_0x17cc36[_0xa098('0x40')]=_[_0xa098('0x41')](_0x17cc36['model'],_0x17cc36['query']);_0xa4b876[_0xa098('0x42')]=_[_0xa098('0x41')](_0x17cc36['model'],qs[_0xa098('0x43')](_0x4f7941['query'][_0xa098('0x43')]));_0xa4b876[_0xa098('0x42')]=_0xa4b876[_0xa098('0x42')][_0xa098('0x44')]?_0xa4b876[_0xa098('0x42')]:_0x17cc36[_0xa098('0x3c')];if(!_0x4f7941[_0xa098('0x3e')][_0xa098('0x45')]('nolimit')){_0xa4b876[_0xa098('0x2e')]=qs[_0xa098('0x2e')](_0x4f7941[_0xa098('0x3e')][_0xa098('0x2e')]);_0xa4b876[_0xa098('0x2d')]=qs[_0xa098('0x2d')](_0x4f7941[_0xa098('0x3e')]['offset']);}_0xa4b876['order']=qs[_0xa098('0x46')](_0x4f7941[_0xa098('0x3e')]['sort']);_0xa4b876['where']=qs['filters'](_[_0xa098('0x47')](_0x4f7941[_0xa098('0x3e')],_0x17cc36[_0xa098('0x40')]),_0x36c42a);if(_0x4f7941['query'][_0xa098('0x48')]){_0xa4b876[_0xa098('0x49')]=_[_0xa098('0x4a')](_0xa4b876[_0xa098('0x49')],{'$or':_['map'](_0x36c42a,function(_0x21cb1b){if(_0x21cb1b[_0xa098('0x3a')]!=='VIRTUAL'){var _0x1ba6dc={};_0x1ba6dc[_0x21cb1b[_0xa098('0x4b')]]={'$like':'%'+_0x4f7941[_0xa098('0x3e')][_0xa098('0x48')]+'%'};return _0x1ba6dc;}})});}_0xa4b876=_[_0xa098('0x4a')]({},_0xa4b876,_0x4f7941[_0xa098('0x4c')]);var _0x181711={'where':_0xa4b876[_0xa098('0x49')]};return db[_0xa098('0x37')]['count'](_0x181711)[_0xa098('0x33')](function(_0x22cf40){_0x44e3d3[_0xa098('0x2c')]=_0x22cf40;if(_0x4f7941[_0xa098('0x3e')][_0xa098('0x4d')]){_0xa4b876[_0xa098('0x4e')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xa098('0x4f')](_0xa4b876);})[_0xa098('0x33')](function(_0x489760){_0x44e3d3[_0xa098('0x50')]=_0x489760;return _0x44e3d3;})[_0xa098('0x33')](respondWithFilteredResult(_0x35972c,_0xa4b876))[_0xa098('0x51')](handleError(_0x35972c,null));};exports[_0xa098('0x52')]=function(_0x3e8480,_0x152682){var _0x560014={'raw':![],'where':{'id':_0x3e8480[_0xa098('0x53')]['id']}},_0x4085e6={};_0x4085e6[_0xa098('0x3c')]=_[_0xa098('0x3f')](db[_0xa098('0x37')][_0xa098('0x38')]);_0x4085e6[_0xa098('0x3e')]=_[_0xa098('0x3f')](_0x3e8480[_0xa098('0x3e')]);_0x4085e6['filters']=_[_0xa098('0x41')](_0x4085e6[_0xa098('0x3c')],_0x4085e6[_0xa098('0x3e')]);_0x560014['attributes']=_[_0xa098('0x41')](_0x4085e6[_0xa098('0x3c')],qs[_0xa098('0x43')](_0x3e8480['query'][_0xa098('0x43')]));_0x560014[_0xa098('0x42')]=_0x560014[_0xa098('0x42')][_0xa098('0x44')]?_0x560014['attributes']:_0x4085e6[_0xa098('0x3c')];if(_0x3e8480[_0xa098('0x3e')][_0xa098('0x4d')]){_0x560014[_0xa098('0x4e')]=[{'all':!![]}];}_0x560014=_[_0xa098('0x4a')]({},_0x560014,_0x3e8480[_0xa098('0x4c')]);return db[_0xa098('0x37')][_0xa098('0x54')](_0x560014)[_0xa098('0x33')](handleEntityNotFound(_0x152682,null))[_0xa098('0x33')](respondWithResult(_0x152682,null))[_0xa098('0x51')](handleError(_0x152682,null));};exports[_0xa098('0x55')]=function(_0x4abbcd,_0x5de711){return db['FreshsalesConfiguration']['create'](_0x4abbcd[_0xa098('0x56')],{})[_0xa098('0x33')](respondWithResult(_0x5de711,0xc9))[_0xa098('0x51')](handleError(_0x5de711,null));};exports[_0xa098('0x57')]=function(_0x439e5d,_0x5f3a65){if(_0x439e5d[_0xa098('0x56')]['id']){delete _0x439e5d[_0xa098('0x56')]['id'];}return db[_0xa098('0x37')]['find']({'where':{'id':_0x439e5d[_0xa098('0x53')]['id']}})[_0xa098('0x33')](handleEntityNotFound(_0x5f3a65,null))['then'](saveUpdates(_0x439e5d[_0xa098('0x56')],null))['then'](respondWithResult(_0x5f3a65,null))['catch'](handleError(_0x5f3a65,null));};exports[_0xa098('0x58')]=function(_0x1dc6ea,_0x14dec9){return db['FreshsalesConfiguration']['find']({'where':{'id':_0x1dc6ea[_0xa098('0x53')]['id']}})[_0xa098('0x33')](handleEntityNotFound(_0x14dec9,null))[_0xa098('0x33')](removeEntity(_0x14dec9,null))['catch'](handleError(_0x14dec9,null));};exports['getSubjects']=function(_0x37732b,_0x1b1213,_0x24207c){var _0x466903={};var _0x417e8a={};var _0x486651;var _0x18a5c8;return db[_0xa098('0x37')][_0xa098('0x59')]({'where':{'id':_0x37732b[_0xa098('0x53')]['id']}})[_0xa098('0x33')](handleEntityNotFound(_0x1b1213,null))['then'](function(_0x1cb6c1){if(_0x1cb6c1){_0x486651=_0x1cb6c1;_0x417e8a[_0xa098('0x3c')]=_[_0xa098('0x3f')](db['FreshsalesField'][_0xa098('0x38')]);_0x417e8a[_0xa098('0x3e')]=_[_0xa098('0x3f')](_0x37732b[_0xa098('0x3e')]);_0x417e8a[_0xa098('0x40')]=_[_0xa098('0x41')](_0x417e8a[_0xa098('0x3c')],_0x417e8a[_0xa098('0x3e')]);_0x466903['attributes']=_[_0xa098('0x41')](_0x417e8a['model'],qs[_0xa098('0x43')](_0x37732b[_0xa098('0x3e')]['fields']));_0x466903[_0xa098('0x42')]=_0x466903['attributes'][_0xa098('0x44')]?_0x466903[_0xa098('0x42')]:_0x417e8a['model'];_0x466903[_0xa098('0x5a')]=qs[_0xa098('0x46')](_0x37732b['query']['sort']);_0x466903[_0xa098('0x49')]=qs[_0xa098('0x40')](_[_0xa098('0x47')](_0x37732b[_0xa098('0x3e')],_0x417e8a[_0xa098('0x40')]));if(_0x37732b[_0xa098('0x3e')]['filter']){_0x466903[_0xa098('0x49')]=_[_0xa098('0x4a')](_0x466903[_0xa098('0x49')],{'$or':_[_0xa098('0x3d')](_0x466903['attributes'],function(_0xbc82a7){var _0x44492a={};_0x44492a[_0xbc82a7]={'$like':'%'+_0x37732b[_0xa098('0x3e')][_0xa098('0x48')]+'%'};return _0x44492a;})});}_0x466903=_[_0xa098('0x4a')]({},_0x466903,_0x37732b[_0xa098('0x4c')]);return _0x486651[_0xa098('0x5b')](_0x466903);}})[_0xa098('0x33')](function(_0x382281){if(_0x382281){_0x18a5c8=_0x382281[_0xa098('0x44')];if(!_0x37732b[_0xa098('0x3e')]['hasOwnProperty'](_0xa098('0x5c'))){_0x466903[_0xa098('0x2e')]=qs[_0xa098('0x2e')](_0x37732b[_0xa098('0x3e')][_0xa098('0x2e')]);_0x466903['offset']=qs[_0xa098('0x2d')](_0x37732b[_0xa098('0x3e')]['offset']);}return _0x486651[_0xa098('0x5b')](_0x466903);}})[_0xa098('0x33')](function(_0x10b50f){if(_0x10b50f){return _0x10b50f?{'count':_0x18a5c8,'rows':_0x10b50f}:null;}})[_0xa098('0x33')](respondWithResult(_0x1b1213,null))[_0xa098('0x51')](handleError(_0x1b1213,null));};exports[_0xa098('0x5d')]=function(_0x19e018,_0x412c54,_0x446763){var _0xd1dfd7={};var _0x390c1c={};var _0x295cf4;var _0x328afb;return db[_0xa098('0x37')][_0xa098('0x59')]({'where':{'id':_0x19e018[_0xa098('0x53')]['id']}})[_0xa098('0x33')](handleEntityNotFound(_0x412c54,null))[_0xa098('0x33')](function(_0x16f045){if(_0x16f045){_0x295cf4=_0x16f045;_0x390c1c[_0xa098('0x3c')]=_[_0xa098('0x3f')](db[_0xa098('0x5e')][_0xa098('0x38')]);_0x390c1c[_0xa098('0x3e')]=_[_0xa098('0x3f')](_0x19e018[_0xa098('0x3e')]);_0x390c1c['filters']=_[_0xa098('0x41')](_0x390c1c[_0xa098('0x3c')],_0x390c1c['query']);_0xd1dfd7['attributes']=_[_0xa098('0x41')](_0x390c1c[_0xa098('0x3c')],qs[_0xa098('0x43')](_0x19e018[_0xa098('0x3e')]['fields']));_0xd1dfd7[_0xa098('0x42')]=_0xd1dfd7['attributes'][_0xa098('0x44')]?_0xd1dfd7['attributes']:_0x390c1c[_0xa098('0x3c')];_0xd1dfd7[_0xa098('0x5a')]=qs['sort'](_0x19e018['query'][_0xa098('0x46')]);_0xd1dfd7[_0xa098('0x49')]=qs['filters'](_['pick'](_0x19e018['query'],_0x390c1c[_0xa098('0x40')]));if(_0x19e018[_0xa098('0x3e')][_0xa098('0x48')]){_0xd1dfd7[_0xa098('0x49')]=_[_0xa098('0x4a')](_0xd1dfd7[_0xa098('0x49')],{'$or':_[_0xa098('0x3d')](_0xd1dfd7[_0xa098('0x42')],function(_0x5d5c1f){var _0xd02518={};_0xd02518[_0x5d5c1f]={'$like':'%'+_0x19e018[_0xa098('0x3e')][_0xa098('0x48')]+'%'};return _0xd02518;})});}_0xd1dfd7=_[_0xa098('0x4a')]({},_0xd1dfd7,_0x19e018[_0xa098('0x4c')]);return _0x295cf4[_0xa098('0x5d')](_0xd1dfd7);}})['then'](function(_0x50fcb8){if(_0x50fcb8){_0x328afb=_0x50fcb8['length'];if(!_0x19e018[_0xa098('0x3e')][_0xa098('0x45')]('nolimit')){_0xd1dfd7['limit']=qs[_0xa098('0x2e')](_0x19e018['query'][_0xa098('0x2e')]);_0xd1dfd7[_0xa098('0x2d')]=qs[_0xa098('0x2d')](_0x19e018[_0xa098('0x3e')][_0xa098('0x2d')]);}return _0x295cf4[_0xa098('0x5d')](_0xd1dfd7);}})[_0xa098('0x33')](function(_0x5c5a5f){if(_0x5c5a5f){return _0x5c5a5f?{'count':_0x328afb,'rows':_0x5c5a5f}:null;}})['then'](respondWithResult(_0x412c54,null))[_0xa098('0x51')](handleError(_0x412c54,null));};exports[_0xa098('0x5f')]=function(_0x5d07c9,_0x589aa4,_0x26890e){var _0xcbe7a6={};var _0x5023d2={};var _0x240411;var _0x1a8ae3;return db['FreshsalesConfiguration'][_0xa098('0x59')]({'where':{'id':_0x5d07c9[_0xa098('0x53')]['id']}})[_0xa098('0x33')](handleEntityNotFound(_0x589aa4,null))[_0xa098('0x33')](function(_0x40ee0c){if(_0x40ee0c){_0x240411=_0x40ee0c;_0x5023d2[_0xa098('0x3c')]=_['keys'](db['FreshsalesField'][_0xa098('0x38')]);_0x5023d2[_0xa098('0x3e')]=_['keys'](_0x5d07c9[_0xa098('0x3e')]);_0x5023d2[_0xa098('0x40')]=_['intersection'](_0x5023d2[_0xa098('0x3c')],_0x5023d2['query']);_0xcbe7a6[_0xa098('0x42')]=_[_0xa098('0x41')](_0x5023d2['model'],qs[_0xa098('0x43')](_0x5d07c9['query'][_0xa098('0x43')]));_0xcbe7a6['attributes']=_0xcbe7a6['attributes'][_0xa098('0x44')]?_0xcbe7a6['attributes']:_0x5023d2['model'];_0xcbe7a6['order']=qs[_0xa098('0x46')](_0x5d07c9[_0xa098('0x3e')][_0xa098('0x46')]);_0xcbe7a6[_0xa098('0x49')]=qs[_0xa098('0x40')](_[_0xa098('0x47')](_0x5d07c9[_0xa098('0x3e')],_0x5023d2[_0xa098('0x40')]));if(_0x5d07c9[_0xa098('0x3e')][_0xa098('0x48')]){_0xcbe7a6['where']=_[_0xa098('0x4a')](_0xcbe7a6[_0xa098('0x49')],{'$or':_[_0xa098('0x3d')](_0xcbe7a6[_0xa098('0x42')],function(_0x4d9576){var _0x34e566={};_0x34e566[_0x4d9576]={'$like':'%'+_0x5d07c9[_0xa098('0x3e')][_0xa098('0x48')]+'%'};return _0x34e566;})});}_0xcbe7a6=_[_0xa098('0x4a')]({},_0xcbe7a6,_0x5d07c9[_0xa098('0x4c')]);return _0x240411[_0xa098('0x5f')](_0xcbe7a6);}})[_0xa098('0x33')](function(_0x41b118){if(_0x41b118){_0x1a8ae3=_0x41b118[_0xa098('0x44')];if(!_0x5d07c9[_0xa098('0x3e')][_0xa098('0x45')](_0xa098('0x5c'))){_0xcbe7a6[_0xa098('0x2e')]=qs['limit'](_0x5d07c9[_0xa098('0x3e')][_0xa098('0x2e')]);_0xcbe7a6[_0xa098('0x2d')]=qs['offset'](_0x5d07c9[_0xa098('0x3e')][_0xa098('0x2d')]);}return _0x240411['getFields'](_0xcbe7a6);}})['then'](function(_0x5c64b1){if(_0x5c64b1){return _0x5c64b1?{'count':_0x1a8ae3,'rows':_0x5c64b1}:null;}})[_0xa098('0x33')](respondWithResult(_0x589aa4,null))['catch'](handleError(_0x589aa4,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 107223e..7657a36 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb065=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x322ea4,_0x4a6c8f){var _0x1aa61f=function(_0x51eb7a){while(--_0x51eb7a){_0x322ea4['push'](_0x322ea4['shift']());}};_0x1aa61f(++_0x4a6c8f);}(_0xb065,0x8c));var _0x5b06=function(_0x529c64,_0x51d374){_0x529c64=_0x529c64-0x0;var _0x38ea52=_0xb065[_0x529c64];return _0x38ea52;};'use strict';var _=require(_0x5b06('0x0'));var util=require(_0x5b06('0x1'));var logger=require('../../config/logger')(_0x5b06('0x2'));var moment=require(_0x5b06('0x3'));var BPromise=require(_0x5b06('0x4'));var rp=require(_0x5b06('0x5'));var fs=require('fs');var path=require(_0x5b06('0x6'));var rimraf=require(_0x5b06('0x7'));var config=require(_0x5b06('0x8'));var attributes=require(_0x5b06('0x9'));module[_0x5b06('0xa')]=function(_0xc9edf9,_0x5eaba9){return _0xc9edf9[_0x5b06('0xb')](_0x5b06('0xc'),attributes,{'tableName':_0x5b06('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13a3=['request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x4a6f35,_0x23be71){var _0x5a8861=function(_0x1683cc){while(--_0x1683cc){_0x4a6f35['push'](_0x4a6f35['shift']());}};_0x5a8861(++_0x23be71);}(_0x13a3,0x19b));var _0x313a=function(_0x42466b,_0x127900){_0x42466b=_0x42466b-0x0;var _0x2dae5b=_0x13a3[_0x42466b];return _0x2dae5b;};'use strict';var _=require(_0x313a('0x0'));var util=require(_0x313a('0x1'));var logger=require(_0x313a('0x2'))(_0x313a('0x3'));var moment=require(_0x313a('0x4'));var BPromise=require('bluebird');var rp=require(_0x313a('0x5'));var fs=require('fs');var path=require(_0x313a('0x6'));var rimraf=require(_0x313a('0x7'));var config=require(_0x313a('0x8'));var attributes=require(_0x313a('0x9'));module['exports']=function(_0x2b8040,_0x177059){return _0x2b8040[_0x313a('0xa')](_0x313a('0xb'),attributes,{'tableName':_0x313a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index b65c531..fad9d33 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf17f=['result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf17f,0x113));var _0xff17=function(_0x12b756,_0x43f6f3){_0x12b756=_0x12b756-0x0;var _0x40cc2e=_0xf17f[_0x12b756];return _0x40cc2e;};'use strict';var _=require(_0xff17('0x0'));var util=require(_0xff17('0x1'));var moment=require(_0xff17('0x2'));var BPromise=require('bluebird');var rs=require(_0xff17('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xff17('0x4'));var logger=require(_0xff17('0x5'))(_0xff17('0x6'));var config=require(_0xff17('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xff17('0x8')][_0xff17('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53788c,_0xdc0d13,_0x3a264d){return new BPromise(function(_0x58e9f8,_0x23d331){return client[_0xff17('0xa')](_0x53788c,_0x3a264d)[_0xff17('0xb')](function(_0x4faa51){logger[_0xff17('0xc')](_0xff17('0xd'),_0xdc0d13,_0xff17('0xe'));logger['debug'](_0xff17('0xf'),_0xdc0d13,_0xff17('0xe'),JSON[_0xff17('0x10')](_0x4faa51));if(_0x4faa51[_0xff17('0x11')]){if(_0x4faa51['error']['code']===0x1f4){logger[_0xff17('0x11')](_0xff17('0xd'),_0xdc0d13,_0x4faa51[_0xff17('0x11')]['message']);return _0x23d331(_0x4faa51[_0xff17('0x11')][_0xff17('0x12')]);}logger['error'](_0xff17('0xd'),_0xdc0d13,_0x4faa51[_0xff17('0x11')]['message']);return _0x58e9f8(_0x4faa51['error']['message']);}else{logger[_0xff17('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xdc0d13,_0xff17('0xe'));_0x58e9f8(_0x4faa51[_0xff17('0x13')][_0xff17('0x12')]);}})[_0xff17('0x14')](function(_0x29aae9){logger['error'](_0xff17('0xd'),_0xdc0d13,_0x29aae9);_0x23d331(_0x29aae9);});});} \ No newline at end of file +var _0xae87=['http','request','then','request\x20sent','debug','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','info','result','catch','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x32fa5f,_0x44198d){var _0x411f12=function(_0x37a087){while(--_0x37a087){_0x32fa5f['push'](_0x32fa5f['shift']());}};_0x411f12(++_0x44198d);}(_0xae87,0x1ce));var _0x7ae8=function(_0x30cc1a,_0x162bbc){_0x30cc1a=_0x30cc1a-0x0;var _0xb3f18f=_0xae87[_0x30cc1a];return _0xb3f18f;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7ae8('0x0'));var fs=require('fs');var Redis=require(_0x7ae8('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ae8('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0x7ae8('0x3'));var jayson=require(_0x7ae8('0x4'));var client=jayson[_0x7ae8('0x5')][_0x7ae8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x57d2f2,_0xcfe30e,_0x2e195a){return new BPromise(function(_0x26d4bb,_0x2aa2d5){return client[_0x7ae8('0x7')](_0x57d2f2,_0x2e195a)[_0x7ae8('0x8')](function(_0x2138eb){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0xcfe30e,_0x7ae8('0x9'));logger[_0x7ae8('0xa')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0xcfe30e,_0x7ae8('0x9'),JSON['stringify'](_0x2138eb));if(_0x2138eb[_0x7ae8('0xb')]){if(_0x2138eb['error'][_0x7ae8('0xc')]===0x1f4){logger['error'](_0x7ae8('0xd'),_0xcfe30e,_0x2138eb[_0x7ae8('0xb')][_0x7ae8('0xe')]);return _0x2aa2d5(_0x2138eb['error'][_0x7ae8('0xe')]);}logger[_0x7ae8('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xcfe30e,_0x2138eb[_0x7ae8('0xb')][_0x7ae8('0xe')]);return _0x26d4bb(_0x2138eb[_0x7ae8('0xb')][_0x7ae8('0xe')]);}else{logger[_0x7ae8('0xf')](_0x7ae8('0xd'),_0xcfe30e,_0x7ae8('0x9'));_0x26d4bb(_0x2138eb[_0x7ae8('0x10')][_0x7ae8('0xe')]);}})[_0x7ae8('0x11')](function(_0x712147){logger[_0x7ae8('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xcfe30e,_0x712147);_0x2aa2d5(_0x712147);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index ec5a3ce..44590d1 100644 --- a/server/api/intFreshsalesField/index.js +++ b/server/api/intFreshsalesField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22db=['index','/:id','show','post','create','put','delete','destroy','exports','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated'];(function(_0x342579,_0x41271a){var _0x5d181f=function(_0x28d5b5){while(--_0x28d5b5){_0x342579['push'](_0x342579['shift']());}};_0x5d181f(++_0x41271a);}(_0x22db,0x15d));var _0xb22d=function(_0x3638fa,_0x4bae8f){_0x3638fa=_0x3638fa-0x0;var _0xc818a7=_0x22db[_0x3638fa];return _0xc818a7;};'use strict';var multer=require('multer');var util=require(_0xb22d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb22d('0x1'));var router=express['Router']();var auth=require(_0xb22d('0x2'));var interaction=require(_0xb22d('0x3'));var config=require(_0xb22d('0x4'));var controller=require(_0xb22d('0x5'));router[_0xb22d('0x6')]('/',auth[_0xb22d('0x7')](),controller[_0xb22d('0x8')]);router['get'](_0xb22d('0x9'),auth[_0xb22d('0x7')](),controller[_0xb22d('0xa')]);router[_0xb22d('0xb')]('/',auth[_0xb22d('0x7')](),controller[_0xb22d('0xc')]);router[_0xb22d('0xd')](_0xb22d('0x9'),auth[_0xb22d('0x7')](),controller['update']);router[_0xb22d('0xe')]('/:id',auth[_0xb22d('0x7')](),controller[_0xb22d('0xf')]);module[_0xb22d('0x10')]=router; \ No newline at end of file +var _0xca3f=['Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xca3f,0xa6));var _0xfca3=function(_0x4e2460,_0x1ab3e3){_0x4e2460=_0x4e2460-0x0;var _0x5cef9b=_0xca3f[_0x4e2460];return _0x5cef9b;};'use strict';var multer=require(_0xfca3('0x0'));var util=require(_0xfca3('0x1'));var path=require(_0xfca3('0x2'));var timeout=require(_0xfca3('0x3'));var express=require(_0xfca3('0x4'));var router=express[_0xfca3('0x5')]();var auth=require(_0xfca3('0x6'));var interaction=require(_0xfca3('0x7'));var config=require('../../config/environment');var controller=require(_0xfca3('0x8'));router[_0xfca3('0x9')]('/',auth[_0xfca3('0xa')](),controller[_0xfca3('0xb')]);router[_0xfca3('0x9')]('/:id',auth[_0xfca3('0xa')](),controller[_0xfca3('0xc')]);router[_0xfca3('0xd')]('/',auth[_0xfca3('0xa')](),controller[_0xfca3('0xe')]);router['put'](_0xfca3('0xf'),auth[_0xfca3('0xa')](),controller[_0xfca3('0x10')]);router[_0xfca3('0x11')](_0xfca3('0xf'),auth[_0xfca3('0xa')](),controller[_0xfca3('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 068016a..2712f82 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.attributes.js +++ b/server/api/intFreshsalesField/intFreshsalesField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8521=['BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x571c1d,_0x3b0586){var _0x33c609=function(_0x226499){while(--_0x226499){_0x571c1d['push'](_0x571c1d['shift']());}};_0x33c609(++_0x3b0586);}(_0x8521,0xf1));var _0x1852=function(_0x3b0bad,_0x2b5687){_0x3b0bad=_0x3b0bad-0x0;var _0x37a1e3=_0x8521[_0x3b0bad];return _0x37a1e3;};'use strict';var Sequelize=require('sequelize');module[_0x1852('0x0')]={'type':{'type':Sequelize[_0x1852('0x1')](_0x1852('0x2'),_0x1852('0x3'),_0x1852('0x4'),_0x1852('0x5')),'defaultValue':_0x1852('0x2')},'content':{'type':Sequelize[_0x1852('0x6')]},'key':{'type':Sequelize[_0x1852('0x6')]},'keyType':{'type':Sequelize[_0x1852('0x1')]('string',_0x1852('0x3'),_0x1852('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1852('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1852('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1852('0x6')]}}; \ No newline at end of file +var _0xccef=['variable','keyValue','STRING','ENUM','customVariable','BOOLEAN','exports','string'];(function(_0x149083,_0x4047b6){var _0x4dc74e=function(_0x1211f9){while(--_0x1211f9){_0x149083['push'](_0x149083['shift']());}};_0x4dc74e(++_0x4047b6);}(_0xccef,0x1ee));var _0xfcce=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xccef[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0xfcce('0x0')]={'type':{'type':Sequelize['ENUM'](_0xfcce('0x1'),_0xfcce('0x2'),'customVariable',_0xfcce('0x3')),'defaultValue':_0xfcce('0x1')},'content':{'type':Sequelize[_0xfcce('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xfcce('0x5')](_0xfcce('0x1'),'variable',_0xfcce('0x6'))},'keyContent':{'type':Sequelize[_0xfcce('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xfcce('0x4')]},'customField':{'type':Sequelize[_0xfcce('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 1ba2acd..f0ac20b 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.controller.js +++ b/server/api/intFreshsalesField/intFreshsalesField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3028=['request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','include','findAll','rows','catch','params','keys','includeAll','options','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x8bca3f,_0x158cf8){var _0x448ab5=function(_0x5b5537){while(--_0x5b5537){_0x8bca3f['push'](_0x8bca3f['shift']());}};_0x448ab5(++_0x158cf8);}(_0x3028,0x1f3));var _0x8302=function(_0x3533ab,_0x2d84a0){_0x3533ab=_0x3533ab-0x0;var _0x54fb06=_0x3028[_0x3533ab];return _0x54fb06;};'use strict';var pdf=require(_0x8302('0x0'));var emlformat=require(_0x8302('0x1'));var rimraf=require(_0x8302('0x2'));var zipdir=require(_0x8302('0x3'));var jsonpatch=require(_0x8302('0x4'));var rp=require(_0x8302('0x5'));var moment=require(_0x8302('0x6'));var BPromise=require(_0x8302('0x7'));var Mustache=require(_0x8302('0x8'));var util=require(_0x8302('0x9'));var path=require(_0x8302('0xa'));var sox=require(_0x8302('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8302('0xc'));var crypto=require(_0x8302('0xd'));var jsforce=require(_0x8302('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8302('0xf'));var querystring=require('querystring');var Papa=require(_0x8302('0x10'));var Redis=require('ioredis');var authService=require(_0x8302('0x11'));var qs=require(_0x8302('0x12'));var as=require(_0x8302('0x13'));var hardwareService=require(_0x8302('0x14'));var logger=require(_0x8302('0x15'))('api');var utils=require(_0x8302('0x16'));var config=require(_0x8302('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cf103,_0x175b90){_0x175b90=_0x175b90||0xcc;return function(_0x15ba06){if(_0x15ba06){return _0x3cf103[_0x8302('0x18')](_0x175b90);}return _0x3cf103['status'](_0x175b90)[_0x8302('0x19')]();};}function respondWithResult(_0x540271,_0x58bb3d){_0x58bb3d=_0x58bb3d||0xc8;return function(_0x3b8e1a){if(_0x3b8e1a){return _0x540271[_0x8302('0x1a')](_0x58bb3d)[_0x8302('0x1b')](_0x3b8e1a);}};}function respondWithFilteredResult(_0x3c9445,_0x5f505b){return function(_0x320c33){if(_0x320c33){var _0x31360c=_0x320c33[_0x8302('0x1c')],_0x30f16a=_0x5f505b[_0x8302('0x1d')],_0x1388fd=_0x5f505b[_0x8302('0x1d')]+_0x5f505b[_0x8302('0x1e')],_0x1e8230;if(_0x1388fd>=_0x31360c){_0x1388fd=_0x31360c;_0x1e8230=0xc8;}else{_0x1e8230=0xce;}_0x3c9445[_0x8302('0x1a')](_0x1e8230);return _0x3c9445[_0x8302('0x1f')](_0x8302('0x20'),_0x30f16a+'-'+_0x1388fd+'/'+_0x31360c)['json'](_0x320c33);}return null;};}function patchUpdates(_0x3e65a7){return function(_0x1ab904){try{jsonpatch['apply'](_0x1ab904,_0x3e65a7,!![]);}catch(_0x4030ee){return BPromise[_0x8302('0x21')](_0x4030ee);}return _0x1ab904[_0x8302('0x22')]();};}function saveUpdates(_0x16f28d,_0x4bd80d){return function(_0x1b4c6a){if(_0x1b4c6a){return _0x1b4c6a[_0x8302('0x23')](_0x16f28d)[_0x8302('0x24')](function(_0x30e26e){return _0x30e26e;});}return null;};}function removeEntity(_0x160c4d,_0x2620ba){return function(_0x348343){if(_0x348343){return _0x348343[_0x8302('0x25')]()[_0x8302('0x24')](function(){_0x160c4d[_0x8302('0x1a')](0xcc)[_0x8302('0x19')]();});}};}function handleEntityNotFound(_0x17a781,_0x8ef14b){return function(_0xfbe4e7){if(!_0xfbe4e7){_0x17a781[_0x8302('0x18')](0x194);}return _0xfbe4e7;};}function handleError(_0x5ac27a,_0x40fce9){_0x40fce9=_0x40fce9||0x1f4;return function(_0x14a912){logger[_0x8302('0x26')](_0x14a912['stack']);if(_0x14a912[_0x8302('0x27')]){delete _0x14a912['name'];}_0x5ac27a[_0x8302('0x1a')](_0x40fce9)[_0x8302('0x28')](_0x14a912);};}exports[_0x8302('0x29')]=function(_0x2be414,_0xc8701a){var _0x5bc267={},_0x2b614b={},_0x68ab0={'count':0x0,'rows':[]};var _0x4d0560=_[_0x8302('0x2a')](db[_0x8302('0x2b')][_0x8302('0x2c')],function(_0xfa28e9){return{'name':_0xfa28e9[_0x8302('0x2d')],'type':_0xfa28e9[_0x8302('0x2e')][_0x8302('0x2f')]};});_0x2b614b['model']=_[_0x8302('0x2a')](_0x4d0560,_0x8302('0x27'));_0x2b614b['query']=_['keys'](_0x2be414[_0x8302('0x30')]);_0x2b614b[_0x8302('0x31')]=_[_0x8302('0x32')](_0x2b614b[_0x8302('0x33')],_0x2b614b[_0x8302('0x30')]);_0x5bc267[_0x8302('0x34')]=_['intersection'](_0x2b614b[_0x8302('0x33')],qs[_0x8302('0x35')](_0x2be414[_0x8302('0x30')][_0x8302('0x35')]));_0x5bc267[_0x8302('0x34')]=_0x5bc267[_0x8302('0x34')][_0x8302('0x36')]?_0x5bc267['attributes']:_0x2b614b['model'];if(!_0x2be414[_0x8302('0x30')][_0x8302('0x37')](_0x8302('0x38'))){_0x5bc267[_0x8302('0x1e')]=qs[_0x8302('0x1e')](_0x2be414[_0x8302('0x30')][_0x8302('0x1e')]);_0x5bc267[_0x8302('0x1d')]=qs[_0x8302('0x1d')](_0x2be414[_0x8302('0x30')][_0x8302('0x1d')]);}_0x5bc267['order']=qs[_0x8302('0x39')](_0x2be414[_0x8302('0x30')]['sort']);_0x5bc267['where']=qs[_0x8302('0x31')](_['pick'](_0x2be414['query'],_0x2b614b[_0x8302('0x31')]),_0x4d0560);if(_0x2be414[_0x8302('0x30')][_0x8302('0x3a')]){_0x5bc267[_0x8302('0x3b')]=_[_0x8302('0x3c')](_0x5bc267[_0x8302('0x3b')],{'$or':_[_0x8302('0x2a')](_0x4d0560,function(_0x449980){if(_0x449980[_0x8302('0x2e')]!=='VIRTUAL'){var _0xf93cb2={};_0xf93cb2[_0x449980[_0x8302('0x27')]]={'$like':'%'+_0x2be414[_0x8302('0x30')][_0x8302('0x3a')]+'%'};return _0xf93cb2;}})});}_0x5bc267=_['merge']({},_0x5bc267,_0x2be414['options']);var _0x25c74c={'where':_0x5bc267[_0x8302('0x3b')]};return db[_0x8302('0x2b')][_0x8302('0x1c')](_0x25c74c)['then'](function(_0x4ff5b7){_0x68ab0[_0x8302('0x1c')]=_0x4ff5b7;if(_0x2be414[_0x8302('0x30')]['includeAll']){_0x5bc267[_0x8302('0x3d')]=[{'all':!![]}];}return db[_0x8302('0x2b')][_0x8302('0x3e')](_0x5bc267);})[_0x8302('0x24')](function(_0x5e616e){_0x68ab0[_0x8302('0x3f')]=_0x5e616e;return _0x68ab0;})[_0x8302('0x24')](respondWithFilteredResult(_0xc8701a,_0x5bc267))[_0x8302('0x40')](handleError(_0xc8701a,null));};exports['show']=function(_0x50a532,_0x472c06){var _0x14d7c6={'raw':!![],'where':{'id':_0x50a532[_0x8302('0x41')]['id']}},_0x52a1fa={};_0x52a1fa['model']=_[_0x8302('0x42')](db[_0x8302('0x2b')][_0x8302('0x2c')]);_0x52a1fa[_0x8302('0x30')]=_['keys'](_0x50a532[_0x8302('0x30')]);_0x52a1fa['filters']=_[_0x8302('0x32')](_0x52a1fa[_0x8302('0x33')],_0x52a1fa[_0x8302('0x30')]);_0x14d7c6[_0x8302('0x34')]=_['intersection'](_0x52a1fa[_0x8302('0x33')],qs['fields'](_0x50a532[_0x8302('0x30')][_0x8302('0x35')]));_0x14d7c6[_0x8302('0x34')]=_0x14d7c6[_0x8302('0x34')][_0x8302('0x36')]?_0x14d7c6[_0x8302('0x34')]:_0x52a1fa[_0x8302('0x33')];if(_0x50a532[_0x8302('0x30')][_0x8302('0x43')]){_0x14d7c6[_0x8302('0x3d')]=[{'all':!![]}];}_0x14d7c6=_[_0x8302('0x3c')]({},_0x14d7c6,_0x50a532[_0x8302('0x44')]);return db[_0x8302('0x2b')]['find'](_0x14d7c6)[_0x8302('0x24')](handleEntityNotFound(_0x472c06,null))[_0x8302('0x24')](respondWithResult(_0x472c06,null))[_0x8302('0x40')](handleError(_0x472c06,null));};exports[_0x8302('0x45')]=function(_0x2540bf,_0x3be9b7){return db[_0x8302('0x2b')][_0x8302('0x45')](_0x2540bf[_0x8302('0x46')],{})[_0x8302('0x24')](respondWithResult(_0x3be9b7,0xc9))[_0x8302('0x40')](handleError(_0x3be9b7,null));};exports[_0x8302('0x23')]=function(_0xcaba63,_0x4cb199){if(_0xcaba63[_0x8302('0x46')]['id']){delete _0xcaba63[_0x8302('0x46')]['id'];}return db[_0x8302('0x2b')][_0x8302('0x47')]({'where':{'id':_0xcaba63[_0x8302('0x41')]['id']}})[_0x8302('0x24')](handleEntityNotFound(_0x4cb199,null))[_0x8302('0x24')](saveUpdates(_0xcaba63[_0x8302('0x46')],null))['then'](respondWithResult(_0x4cb199,null))[_0x8302('0x40')](handleError(_0x4cb199,null));};exports[_0x8302('0x25')]=function(_0x12d263,_0x30df02){return db[_0x8302('0x2b')]['find']({'where':{'id':_0x12d263[_0x8302('0x41')]['id']}})[_0x8302('0x24')](handleEntityNotFound(_0x30df02,null))[_0x8302('0x24')](removeEntity(_0x30df02,null))[_0x8302('0x40')](handleError(_0x30df02,null));}; \ No newline at end of file +var _0x1f28=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','where','pick','filter','merge','VIRTUAL','options','FreshsalesField','include','rows','catch','length','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash'];(function(_0xd91aea,_0x90202d){var _0xed7cb0=function(_0x325633){while(--_0x325633){_0xd91aea['push'](_0xd91aea['shift']());}};_0xed7cb0(++_0x90202d);}(_0x1f28,0x7e));var _0x81f2=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x1f28[_0xfae23b];return _0x200640;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x81f2('0x0'));var rimraf=require(_0x81f2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x81f2('0x2'));var rp=require(_0x81f2('0x3'));var moment=require(_0x81f2('0x4'));var BPromise=require(_0x81f2('0x5'));var Mustache=require('mustache');var util=require(_0x81f2('0x6'));var path=require(_0x81f2('0x7'));var sox=require(_0x81f2('0x8'));var csv=require(_0x81f2('0x9'));var ejs=require(_0x81f2('0xa'));var fs=require('fs');var _=require(_0x81f2('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x81f2('0xc'));var toCsv=require(_0x81f2('0x9'));var querystring=require(_0x81f2('0xd'));var Papa=require('papaparse');var Redis=require(_0x81f2('0xe'));var authService=require(_0x81f2('0xf'));var qs=require(_0x81f2('0x10'));var as=require(_0x81f2('0x11'));var hardwareService=require(_0x81f2('0x12'));var logger=require(_0x81f2('0x13'))(_0x81f2('0x14'));var utils=require(_0x81f2('0x15'));var config=require(_0x81f2('0x16'));var db=require(_0x81f2('0x17'))['db'];function respondWithStatusCode(_0x31e199,_0x1c5673){_0x1c5673=_0x1c5673||0xcc;return function(_0x4ce06c){if(_0x4ce06c){return _0x31e199[_0x81f2('0x18')](_0x1c5673);}return _0x31e199['status'](_0x1c5673)[_0x81f2('0x19')]();};}function respondWithResult(_0x4dcc07,_0x3c8569){_0x3c8569=_0x3c8569||0xc8;return function(_0x17f518){if(_0x17f518){return _0x4dcc07[_0x81f2('0x1a')](_0x3c8569)[_0x81f2('0x1b')](_0x17f518);}};}function respondWithFilteredResult(_0x58ab8d,_0x23e64d){return function(_0x38b8d8){if(_0x38b8d8){var _0x471171=_0x38b8d8[_0x81f2('0x1c')],_0x37ab95=_0x23e64d[_0x81f2('0x1d')],_0x1bf4c4=_0x23e64d['offset']+_0x23e64d[_0x81f2('0x1e')],_0xef6b2a;if(_0x1bf4c4>=_0x471171){_0x1bf4c4=_0x471171;_0xef6b2a=0xc8;}else{_0xef6b2a=0xce;}_0x58ab8d[_0x81f2('0x1a')](_0xef6b2a);return _0x58ab8d['set'](_0x81f2('0x1f'),_0x37ab95+'-'+_0x1bf4c4+'/'+_0x471171)[_0x81f2('0x1b')](_0x38b8d8);}return null;};}function patchUpdates(_0x3ab7b4){return function(_0x54b630){try{jsonpatch[_0x81f2('0x20')](_0x54b630,_0x3ab7b4,!![]);}catch(_0x37fa81){return BPromise[_0x81f2('0x21')](_0x37fa81);}return _0x54b630[_0x81f2('0x22')]();};}function saveUpdates(_0x555977,_0x23b845){return function(_0x393f31){if(_0x393f31){return _0x393f31['update'](_0x555977)[_0x81f2('0x23')](function(_0x5529c4){return _0x5529c4;});}return null;};}function removeEntity(_0x10612a,_0x4f1af5){return function(_0x1c7931){if(_0x1c7931){return _0x1c7931[_0x81f2('0x24')]()[_0x81f2('0x23')](function(){_0x10612a[_0x81f2('0x1a')](0xcc)[_0x81f2('0x19')]();});}};}function handleEntityNotFound(_0x33bc62,_0xe0132e){return function(_0x4311b5){if(!_0x4311b5){_0x33bc62[_0x81f2('0x18')](0x194);}return _0x4311b5;};}function handleError(_0x264abf,_0x51e390){_0x51e390=_0x51e390||0x1f4;return function(_0x36b85d){logger[_0x81f2('0x25')](_0x36b85d[_0x81f2('0x26')]);if(_0x36b85d[_0x81f2('0x27')]){delete _0x36b85d['name'];}_0x264abf[_0x81f2('0x1a')](_0x51e390)[_0x81f2('0x28')](_0x36b85d);};}exports['index']=function(_0x1f93bb,_0x3fa52e){var _0x14d9a2={},_0x28fe20={},_0x478734={'count':0x0,'rows':[]};var _0x2b2d24=_[_0x81f2('0x29')](db['FreshsalesField'][_0x81f2('0x2a')],function(_0x58f971){return{'name':_0x58f971[_0x81f2('0x2b')],'type':_0x58f971[_0x81f2('0x2c')][_0x81f2('0x2d')]};});_0x28fe20[_0x81f2('0x2e')]=_[_0x81f2('0x29')](_0x2b2d24,_0x81f2('0x27'));_0x28fe20[_0x81f2('0x2f')]=_[_0x81f2('0x30')](_0x1f93bb[_0x81f2('0x2f')]);_0x28fe20[_0x81f2('0x31')]=_[_0x81f2('0x32')](_0x28fe20['model'],_0x28fe20[_0x81f2('0x2f')]);_0x14d9a2[_0x81f2('0x33')]=_[_0x81f2('0x32')](_0x28fe20[_0x81f2('0x2e')],qs[_0x81f2('0x34')](_0x1f93bb['query'][_0x81f2('0x34')]));_0x14d9a2[_0x81f2('0x33')]=_0x14d9a2['attributes']['length']?_0x14d9a2[_0x81f2('0x33')]:_0x28fe20['model'];if(!_0x1f93bb[_0x81f2('0x2f')]['hasOwnProperty'](_0x81f2('0x35'))){_0x14d9a2[_0x81f2('0x1e')]=qs[_0x81f2('0x1e')](_0x1f93bb[_0x81f2('0x2f')][_0x81f2('0x1e')]);_0x14d9a2[_0x81f2('0x1d')]=qs[_0x81f2('0x1d')](_0x1f93bb[_0x81f2('0x2f')][_0x81f2('0x1d')]);}_0x14d9a2['order']=qs['sort'](_0x1f93bb[_0x81f2('0x2f')]['sort']);_0x14d9a2[_0x81f2('0x36')]=qs[_0x81f2('0x31')](_[_0x81f2('0x37')](_0x1f93bb[_0x81f2('0x2f')],_0x28fe20[_0x81f2('0x31')]),_0x2b2d24);if(_0x1f93bb['query'][_0x81f2('0x38')]){_0x14d9a2[_0x81f2('0x36')]=_[_0x81f2('0x39')](_0x14d9a2[_0x81f2('0x36')],{'$or':_[_0x81f2('0x29')](_0x2b2d24,function(_0x16d44c){if(_0x16d44c[_0x81f2('0x2c')]!==_0x81f2('0x3a')){var _0xee9225={};_0xee9225[_0x16d44c[_0x81f2('0x27')]]={'$like':'%'+_0x1f93bb[_0x81f2('0x2f')][_0x81f2('0x38')]+'%'};return _0xee9225;}})});}_0x14d9a2=_[_0x81f2('0x39')]({},_0x14d9a2,_0x1f93bb[_0x81f2('0x3b')]);var _0x2e0c2b={'where':_0x14d9a2['where']};return db[_0x81f2('0x3c')][_0x81f2('0x1c')](_0x2e0c2b)[_0x81f2('0x23')](function(_0x219e76){_0x478734[_0x81f2('0x1c')]=_0x219e76;if(_0x1f93bb[_0x81f2('0x2f')]['includeAll']){_0x14d9a2[_0x81f2('0x3d')]=[{'all':!![]}];}return db[_0x81f2('0x3c')]['findAll'](_0x14d9a2);})[_0x81f2('0x23')](function(_0x3c7d74){_0x478734[_0x81f2('0x3e')]=_0x3c7d74;return _0x478734;})[_0x81f2('0x23')](respondWithFilteredResult(_0x3fa52e,_0x14d9a2))[_0x81f2('0x3f')](handleError(_0x3fa52e,null));};exports['show']=function(_0xafd856,_0x44a658){var _0x3a823f={'raw':!![],'where':{'id':_0xafd856['params']['id']}},_0x533bd1={};_0x533bd1[_0x81f2('0x2e')]=_[_0x81f2('0x30')](db[_0x81f2('0x3c')][_0x81f2('0x2a')]);_0x533bd1[_0x81f2('0x2f')]=_['keys'](_0xafd856[_0x81f2('0x2f')]);_0x533bd1['filters']=_[_0x81f2('0x32')](_0x533bd1[_0x81f2('0x2e')],_0x533bd1[_0x81f2('0x2f')]);_0x3a823f[_0x81f2('0x33')]=_['intersection'](_0x533bd1[_0x81f2('0x2e')],qs['fields'](_0xafd856['query'][_0x81f2('0x34')]));_0x3a823f['attributes']=_0x3a823f[_0x81f2('0x33')][_0x81f2('0x40')]?_0x3a823f[_0x81f2('0x33')]:_0x533bd1['model'];if(_0xafd856[_0x81f2('0x2f')]['includeAll']){_0x3a823f[_0x81f2('0x3d')]=[{'all':!![]}];}_0x3a823f=_['merge']({},_0x3a823f,_0xafd856[_0x81f2('0x3b')]);return db[_0x81f2('0x3c')][_0x81f2('0x41')](_0x3a823f)[_0x81f2('0x23')](handleEntityNotFound(_0x44a658,null))['then'](respondWithResult(_0x44a658,null))[_0x81f2('0x3f')](handleError(_0x44a658,null));};exports['create']=function(_0x5ab22b,_0x323fc9){return db[_0x81f2('0x3c')][_0x81f2('0x42')](_0x5ab22b[_0x81f2('0x43')],{})[_0x81f2('0x23')](respondWithResult(_0x323fc9,0xc9))[_0x81f2('0x3f')](handleError(_0x323fc9,null));};exports[_0x81f2('0x44')]=function(_0x766780,_0x39cdc2){if(_0x766780[_0x81f2('0x43')]['id']){delete _0x766780['body']['id'];}return db['FreshsalesField'][_0x81f2('0x41')]({'where':{'id':_0x766780['params']['id']}})[_0x81f2('0x23')](handleEntityNotFound(_0x39cdc2,null))[_0x81f2('0x23')](saveUpdates(_0x766780[_0x81f2('0x43')],null))['then'](respondWithResult(_0x39cdc2,null))[_0x81f2('0x3f')](handleError(_0x39cdc2,null));};exports[_0x81f2('0x24')]=function(_0x74dcec,_0xbfe92){return db['FreshsalesField']['find']({'where':{'id':_0x74dcec['params']['id']}})[_0x81f2('0x23')](handleEntityNotFound(_0xbfe92,null))[_0x81f2('0x23')](removeEntity(_0xbfe92,null))[_0x81f2('0x3f')](handleError(_0xbfe92,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index cf50665..17c04a3 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.model.js +++ b/server/api/intFreshsalesField/intFreshsalesField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6643=['lodash','util','../../config/logger','api','bluebird','../../config/environment','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x6643,0x14a));var _0x3664=function(_0x3cf804,_0x521397){_0x3cf804=_0x3cf804-0x0;var _0x26e0df=_0x6643[_0x3cf804];return _0x26e0df;};'use strict';var _=require(_0x3664('0x0'));var util=require(_0x3664('0x1'));var logger=require(_0x3664('0x2'))(_0x3664('0x3'));var moment=require('moment');var BPromise=require(_0x3664('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3664('0x5'));var attributes=require('./intFreshsalesField.attributes');module[_0x3664('0x6')]=function(_0x63b822,_0x431384){return _0x63b822[_0x3664('0x7')](_0x3664('0x8'),attributes,{'tableName':_0x3664('0x9'),'paranoid':![],'indexes':[{'name':_0x3664('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x00d9=['bluebird','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x450d4e,_0xcacc3){var _0x300304=function(_0x49ab27){while(--_0x49ab27){_0x450d4e['push'](_0x450d4e['shift']());}};_0x300304(++_0xcacc3);}(_0x00d9,0xa5));var _0x900d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x00d9[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x900d('0x0'));var util=require(_0x900d('0x1'));var logger=require(_0x900d('0x2'))(_0x900d('0x3'));var moment=require(_0x900d('0x4'));var BPromise=require(_0x900d('0x5'));var rp=require(_0x900d('0x6'));var fs=require('fs');var path=require(_0x900d('0x7'));var rimraf=require('rimraf');var config=require(_0x900d('0x8'));var attributes=require(_0x900d('0x9'));module[_0x900d('0xa')]=function(_0x2b7a69,_0x50a371){return _0x2b7a69[_0x900d('0xb')](_0x900d('0xc'),attributes,{'tableName':_0x900d('0xd'),'paranoid':![],'indexes':[{'name':_0x900d('0xe'),'fields':[_0x900d('0xf'),_0x900d('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 5eb5810..0e941b3 100644 --- a/server/api/intFreshsalesField/intFreshsalesField.rpc.js +++ b/server/api/intFreshsalesField/intFreshsalesField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bd4=['randomstring','../../config/utils','../../config/logger','../../config/environment','client','request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','catch','moment','bluebird'];(function(_0x36a9c6,_0x4f5fb6){var _0x1e0216=function(_0x1ebdb2){while(--_0x1ebdb2){_0x36a9c6['push'](_0x36a9c6['shift']());}};_0x1e0216(++_0x4f5fb6);}(_0x2bd4,0x8e));var _0x42bd=function(_0x18bbe8,_0x726e43){_0x18bbe8=_0x18bbe8-0x0;var _0x1932be=_0x2bd4[_0x18bbe8];return _0x1932be;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x42bd('0x0'));var BPromise=require(_0x42bd('0x1'));var rs=require(_0x42bd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x42bd('0x3'));var logger=require(_0x42bd('0x4'))('rpc');var config=require(_0x42bd('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x42bd('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3dcd8d,_0xe87879,_0x5942ee){return new BPromise(function(_0x248270,_0x4e53ef){return client[_0x42bd('0x7')](_0x3dcd8d,_0x5942ee)[_0x42bd('0x8')](function(_0x12e053){logger['info'](_0x42bd('0x9'),_0xe87879,_0x42bd('0xa'));logger[_0x42bd('0xb')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0xe87879,_0x42bd('0xa'),JSON[_0x42bd('0xc')](_0x12e053));if(_0x12e053['error']){if(_0x12e053['error'][_0x42bd('0xd')]===0x1f4){logger[_0x42bd('0xe')]('FreshsalesField,\x20%s,\x20%s',_0xe87879,_0x12e053[_0x42bd('0xe')]['message']);return _0x4e53ef(_0x12e053['error'][_0x42bd('0xf')]);}logger[_0x42bd('0xe')]('FreshsalesField,\x20%s,\x20%s',_0xe87879,_0x12e053[_0x42bd('0xe')][_0x42bd('0xf')]);return _0x248270(_0x12e053['error'][_0x42bd('0xf')]);}else{logger[_0x42bd('0x10')](_0x42bd('0x9'),_0xe87879,'request\x20sent');_0x248270(_0x12e053['result']['message']);}})[_0x42bd('0x11')](function(_0x355f3b){logger[_0x42bd('0xe')]('FreshsalesField,\x20%s,\x20%s',_0xe87879,_0x355f3b);_0x4e53ef(_0x355f3b);});});} \ No newline at end of file +var _0xda27=['FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent'];(function(_0x3313e9,_0x57c194){var _0x59acd3=function(_0x306b05){while(--_0x306b05){_0x3313e9['push'](_0x3313e9['shift']());}};_0x59acd3(++_0x57c194);}(_0xda27,0x1cf));var _0x7da2=function(_0x53fbdf,_0x262848){_0x53fbdf=_0x53fbdf-0x0;var _0x16094b=_0xda27[_0x53fbdf];return _0x16094b;};'use strict';var _=require(_0x7da2('0x0'));var util=require(_0x7da2('0x1'));var moment=require(_0x7da2('0x2'));var BPromise=require(_0x7da2('0x3'));var rs=require(_0x7da2('0x4'));var fs=require('fs');var Redis=require(_0x7da2('0x5'));var db=require(_0x7da2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7da2('0x7'))(_0x7da2('0x8'));var config=require(_0x7da2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7da2('0xa')][_0x7da2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb4a9cd,_0x47e1a0,_0x1dea56){return new BPromise(function(_0x17b3dc,_0x52c53b){return client[_0x7da2('0xc')](_0xb4a9cd,_0x1dea56)[_0x7da2('0xd')](function(_0x22bada){logger[_0x7da2('0xe')](_0x7da2('0xf'),_0x47e1a0,_0x7da2('0x10'));logger['debug'](_0x7da2('0x11'),_0x47e1a0,_0x7da2('0x10'),JSON[_0x7da2('0x12')](_0x22bada));if(_0x22bada[_0x7da2('0x13')]){if(_0x22bada[_0x7da2('0x13')][_0x7da2('0x14')]===0x1f4){logger[_0x7da2('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x47e1a0,_0x22bada['error'][_0x7da2('0x15')]);return _0x52c53b(_0x22bada['error']['message']);}logger['error']('FreshsalesField,\x20%s,\x20%s',_0x47e1a0,_0x22bada[_0x7da2('0x13')]['message']);return _0x17b3dc(_0x22bada[_0x7da2('0x13')][_0x7da2('0x15')]);}else{logger[_0x7da2('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x47e1a0,_0x7da2('0x10'));_0x17b3dc(_0x22bada[_0x7da2('0x16')][_0x7da2('0x15')]);}})[_0x7da2('0x17')](function(_0xa33ae9){logger[_0x7da2('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x47e1a0,_0xa33ae9);_0x52c53b(_0xa33ae9);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index e00c9ca..619dbb6 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 _0xcda7=['post','put','/:id','update','delete','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','isAuthenticated','index','show','get','/:id/configurations','getConfigurations','getFields'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xcda7,0xce));var _0x7cda=function(_0xf50db5,_0x32bb17){_0xf50db5=_0xf50db5-0x0;var _0x57c833=_0xcda7[_0xf50db5];return _0x57c833;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x7cda('0x0'));var express=require(_0x7cda('0x1'));var router=express[_0x7cda('0x2')]();var auth=require(_0x7cda('0x3'));var interaction=require(_0x7cda('0x4'));var config=require(_0x7cda('0x5'));var controller=require(_0x7cda('0x6'));router['get']('/',auth[_0x7cda('0x7')](),controller[_0x7cda('0x8')]);router['get']('/:id',auth[_0x7cda('0x7')](),controller[_0x7cda('0x9')]);router[_0x7cda('0xa')](_0x7cda('0xb'),auth[_0x7cda('0x7')](),controller[_0x7cda('0xc')]);router['get']('/:id/fields',auth[_0x7cda('0x7')](),controller[_0x7cda('0xd')]);router[_0x7cda('0xe')]('/',auth[_0x7cda('0x7')](),controller['create']);router[_0x7cda('0xe')]('/:id/configurations',auth[_0x7cda('0x7')](),controller['addConfiguration']);router[_0x7cda('0xf')](_0x7cda('0x10'),auth[_0x7cda('0x7')](),controller[_0x7cda('0x11')]);router[_0x7cda('0x12')](_0x7cda('0x10'),auth[_0x7cda('0x7')](),controller['destroy']);module[_0x7cda('0x13')]=router; \ No newline at end of file +var _0xcc7f=['/:id/configurations','getConfigurations','post','create','addConfiguration','put','update','delete','destroy','exports','multer','express','../../components/interaction/service','./intSalesforceAccount.controller','isAuthenticated','get','/:id','show'];(function(_0x58f363,_0x135c64){var _0xcb2c83=function(_0x55d7fd){while(--_0x55d7fd){_0x58f363['push'](_0x58f363['shift']());}};_0xcb2c83(++_0x135c64);}(_0xcc7f,0x1cc));var _0xfcc7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc7f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfcc7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfcc7('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfcc7('0x2'));var config=require('../../config/environment');var controller=require(_0xfcc7('0x3'));router['get']('/',auth[_0xfcc7('0x4')](),controller['index']);router[_0xfcc7('0x5')](_0xfcc7('0x6'),auth[_0xfcc7('0x4')](),controller[_0xfcc7('0x7')]);router[_0xfcc7('0x5')](_0xfcc7('0x8'),auth['isAuthenticated'](),controller[_0xfcc7('0x9')]);router[_0xfcc7('0x5')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xfcc7('0xa')]('/',auth[_0xfcc7('0x4')](),controller[_0xfcc7('0xb')]);router[_0xfcc7('0xa')](_0xfcc7('0x8'),auth[_0xfcc7('0x4')](),controller[_0xfcc7('0xc')]);router[_0xfcc7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xfcc7('0xe')]);router[_0xfcc7('0xf')](_0xfcc7('0x6'),auth['isAuthenticated'](),controller[_0xfcc7('0x10')]);module[_0xfcc7('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index cc059f2..de0c558 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 _0xc4aa=['STRING','username','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xc4aa[_0x4ff09b];return _0x3f5c2e;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'name':{'type':Sequelize[_0xac4a('0x2')]},'description':{'type':Sequelize[_0xac4a('0x2')]},'username':{'type':Sequelize[_0xac4a('0x2')],'unique':_0xac4a('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xac4a('0x2')]},'securityToken':{'type':Sequelize[_0xac4a('0x2')]},'serverUrl':{'type':Sequelize[_0xac4a('0x2')]},'type':{'type':Sequelize[_0xac4a('0x4')](_0xac4a('0x5'),_0xac4a('0x6')),'defaultValue':_0xac4a('0x5')}}; \ No newline at end of file +var _0x5fab=['username','ENUM','integrationTab','sequelize','exports','STRING'];(function(_0x68ae0c,_0x4e44d7){var _0xe0bc00=function(_0x163faa){while(--_0x163faa){_0x68ae0c['push'](_0x68ae0c['shift']());}};_0xe0bc00(++_0x4e44d7);}(_0x5fab,0x177));var _0xb5fa=function(_0x5c68c7,_0x54ba85){_0x5c68c7=_0x5c68c7-0x0;var _0x4a94fc=_0x5fab[_0x5c68c7];return _0x4a94fc;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb5fa('0x2')]},'username':{'type':Sequelize[_0xb5fa('0x2')],'unique':_0xb5fa('0x3')},'remoteUri':{'type':Sequelize[_0xb5fa('0x2')]},'password':{'type':Sequelize[_0xb5fa('0x2')]},'clientId':{'type':Sequelize[_0xb5fa('0x2')]},'clientSecret':{'type':Sequelize[_0xb5fa('0x2')]},'securityToken':{'type':Sequelize[_0xb5fa('0x2')]},'serverUrl':{'type':Sequelize[_0xb5fa('0x2')]},'type':{'type':Sequelize[_0xb5fa('0x4')]('integrationTab','newTab'),'defaultValue':_0xb5fa('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 9f7b930..803fac1 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 _0xb2a8=['Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','find','body','getConfigurations','SalesforceConfiguration','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','create','SalesforceField','getFields','Task','clientId','clientSecret','username','securityToken','remoteUri','substring','lastIndexOf','password','concat','isNil','ticketType','sobject','describe','CallDisposition','CallDurationInSeconds','IsArchived','Priority','Status','Reason','IsEscalated','SuppliedName','SuppliedCompany','custom','includes','label','picklistValues','value','boolean','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','Sequelize','ValidationError','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','json','count','offset','limit'];(function(_0x1311dd,_0x3fd4e0){var _0x4dafca=function(_0x12a909){while(--_0x12a909){_0x1311dd['push'](_0x1311dd['shift']());}};_0x4dafca(++_0x3fd4e0);}(_0xb2a8,0x16e));var _0x8b2a=function(_0x2911e2,_0x39c3d9){_0x2911e2=_0x2911e2-0x0;var _0x111b30=_0xb2a8[_0x2911e2];return _0x111b30;};'use strict';var pdf=require(_0x8b2a('0x0'));var emlformat=require(_0x8b2a('0x1'));var rimraf=require(_0x8b2a('0x2'));var zipdir=require(_0x8b2a('0x3'));var jsonpatch=require(_0x8b2a('0x4'));var rp=require(_0x8b2a('0x5'));var moment=require(_0x8b2a('0x6'));var BPromise=require(_0x8b2a('0x7'));var Mustache=require('mustache');var util=require(_0x8b2a('0x8'));var path=require(_0x8b2a('0x9'));var sox=require(_0x8b2a('0xa'));var csv=require(_0x8b2a('0xb'));var ejs=require(_0x8b2a('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8b2a('0xd'));var crypto=require(_0x8b2a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8b2a('0xf'));var toCsv=require(_0x8b2a('0xb'));var querystring=require(_0x8b2a('0x10'));var Papa=require(_0x8b2a('0x11'));var Redis=require(_0x8b2a('0x12'));var authService=require(_0x8b2a('0x13'));var qs=require(_0x8b2a('0x14'));var as=require(_0x8b2a('0x15'));var hardwareService=require(_0x8b2a('0x16'));var logger=require(_0x8b2a('0x17'))('api');var utils=require(_0x8b2a('0x18'));var config=require(_0x8b2a('0x19'));var db=require(_0x8b2a('0x1a'))['db'];var integrations=require(_0x8b2a('0x1b'));var jayson=require('jayson/promise');var client=jayson[_0x8b2a('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x505eb7,_0x19ea94,_0xed0842){if(_0xed0842){var _0x35179b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x35179b['test'](_0x19ea94)){return _0x505eb7;}else{throw new db[(_0x8b2a('0x1d'))][(_0x8b2a('0x1e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x505eb7;}}function respondWithRpcPromise(_0x29b06a,_0x276e62,_0x16e3cb,_0x435ce8){return new BPromise(function(_0x4084f3,_0x1d35af){var _0x5de869=_0x435ce8||client;return _0x5de869[_0x8b2a('0x1f')](_0x29b06a,_0x16e3cb)[_0x8b2a('0x20')](function(_0x11d38a){logger[_0x8b2a('0x21')](_0x8b2a('0x22'),_0x276e62,_0x8b2a('0x23'));logger[_0x8b2a('0x24')](_0x8b2a('0x25'),_0x276e62,_0x8b2a('0x23'),JSON[_0x8b2a('0x26')](_0x11d38a));if(_0x11d38a[_0x8b2a('0x27')]){if(_0x11d38a['error'][_0x8b2a('0x28')]===0x1f4){logger['error'](_0x8b2a('0x22'),_0x276e62,_0x11d38a[_0x8b2a('0x27')][_0x8b2a('0x29')]);return _0x1d35af(_0x11d38a[_0x8b2a('0x27')]['message']);}logger[_0x8b2a('0x27')](_0x8b2a('0x22'),_0x276e62,_0x11d38a['error'][_0x8b2a('0x29')]);return _0x4084f3(_0x11d38a[_0x8b2a('0x27')][_0x8b2a('0x29')]);}else{logger[_0x8b2a('0x21')](_0x8b2a('0x22'),_0x276e62,_0x8b2a('0x23'));_0x4084f3(_0x11d38a[_0x8b2a('0x2a')][_0x8b2a('0x29')]);}})[_0x8b2a('0x2b')](function(_0x6ffee){logger[_0x8b2a('0x27')]('SalesforceAccount,\x20%s,\x20%s',_0x276e62,_0x6ffee);_0x1d35af(_0x6ffee);});});}function respondWithStatusCode(_0x4292c9,_0x358b5a){_0x358b5a=_0x358b5a||0xcc;return function(_0x41088c){if(_0x41088c){return _0x4292c9[_0x8b2a('0x2c')](_0x358b5a);}return _0x4292c9[_0x8b2a('0x2d')](_0x358b5a)[_0x8b2a('0x2e')]();};}function respondWithResult(_0x5183db,_0x12e5f3){_0x12e5f3=_0x12e5f3||0xc8;return function(_0x5d3ea0){if(_0x5d3ea0){return _0x5183db[_0x8b2a('0x2d')](_0x12e5f3)[_0x8b2a('0x2f')](_0x5d3ea0);}};}function respondWithFilteredResult(_0x319cd0,_0x5de5c8){return function(_0x376c52){if(_0x376c52){var _0xab1c5f=_0x376c52[_0x8b2a('0x30')],_0x46c59e=_0x5de5c8[_0x8b2a('0x31')],_0x398ba2=_0x5de5c8[_0x8b2a('0x31')]+_0x5de5c8[_0x8b2a('0x32')],_0x598be1;if(_0x398ba2>=_0xab1c5f){_0x398ba2=_0xab1c5f;_0x598be1=0xc8;}else{_0x598be1=0xce;}_0x319cd0[_0x8b2a('0x2d')](_0x598be1);return _0x319cd0['set'](_0x8b2a('0x33'),_0x46c59e+'-'+_0x398ba2+'/'+_0xab1c5f)[_0x8b2a('0x2f')](_0x376c52);}return null;};}function patchUpdates(_0x511cab){return function(_0x2f1962){try{jsonpatch[_0x8b2a('0x34')](_0x2f1962,_0x511cab,!![]);}catch(_0x4a4373){return BPromise[_0x8b2a('0x35')](_0x4a4373);}return _0x2f1962[_0x8b2a('0x36')]();};}function saveUpdates(_0x5c4170,_0x15e2b6){return function(_0x5746b3){if(_0x5746b3){return _0x5746b3[_0x8b2a('0x37')](_0x5c4170)['then'](function(_0x22df46){return _0x22df46;});}return null;};}function removeEntity(_0x53d883,_0x4d6fdb){return function(_0x29641a){if(_0x29641a){return _0x29641a[_0x8b2a('0x38')]()[_0x8b2a('0x20')](function(){_0x53d883[_0x8b2a('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x231a75,_0x1a48f0){return function(_0x271347){if(!_0x271347){_0x231a75[_0x8b2a('0x2c')](0x194);}return _0x271347;};}function handleError(_0x20f9d6,_0x572d73){_0x572d73=_0x572d73||0x1f4;return function(_0x405ace){logger[_0x8b2a('0x27')](_0x405ace[_0x8b2a('0x39')]);if(_0x405ace['name']){delete _0x405ace[_0x8b2a('0x3a')];}_0x20f9d6[_0x8b2a('0x2d')](_0x572d73)[_0x8b2a('0x3b')](_0x405ace);};}exports[_0x8b2a('0x3c')]=function(_0x4db1cf,_0x421167){var _0x473a10={},_0x5c725={},_0x57fe02={'count':0x0,'rows':[]};var _0x3a9f33=_[_0x8b2a('0x3d')](db[_0x8b2a('0x3e')][_0x8b2a('0x3f')],function(_0xf245c6){return{'name':_0xf245c6[_0x8b2a('0x40')],'type':_0xf245c6[_0x8b2a('0x41')]['key']};});_0x5c725[_0x8b2a('0x42')]=_[_0x8b2a('0x3d')](_0x3a9f33,_0x8b2a('0x3a'));_0x5c725[_0x8b2a('0x43')]=_[_0x8b2a('0x44')](_0x4db1cf[_0x8b2a('0x43')]);_0x5c725[_0x8b2a('0x45')]=_['intersection'](_0x5c725[_0x8b2a('0x42')],_0x5c725[_0x8b2a('0x43')]);_0x473a10['attributes']=_[_0x8b2a('0x46')](_0x5c725[_0x8b2a('0x42')],qs[_0x8b2a('0x47')](_0x4db1cf[_0x8b2a('0x43')][_0x8b2a('0x47')]));_0x473a10['attributes']=_0x473a10[_0x8b2a('0x48')]['length']?_0x473a10[_0x8b2a('0x48')]:_0x5c725[_0x8b2a('0x42')];if(!_0x4db1cf[_0x8b2a('0x43')][_0x8b2a('0x49')]('nolimit')){_0x473a10[_0x8b2a('0x32')]=qs[_0x8b2a('0x32')](_0x4db1cf['query']['limit']);_0x473a10[_0x8b2a('0x31')]=qs['offset'](_0x4db1cf[_0x8b2a('0x43')][_0x8b2a('0x31')]);}_0x473a10[_0x8b2a('0x4a')]=qs[_0x8b2a('0x4b')](_0x4db1cf[_0x8b2a('0x43')][_0x8b2a('0x4b')]);_0x473a10[_0x8b2a('0x4c')]=qs[_0x8b2a('0x45')](_[_0x8b2a('0x4d')](_0x4db1cf[_0x8b2a('0x43')],_0x5c725[_0x8b2a('0x45')]),_0x3a9f33);if(_0x4db1cf[_0x8b2a('0x43')][_0x8b2a('0x4e')]){_0x473a10['where']=_[_0x8b2a('0x4f')](_0x473a10[_0x8b2a('0x4c')],{'$or':_[_0x8b2a('0x3d')](_0x3a9f33,function(_0x29a996){if(_0x29a996['type']!==_0x8b2a('0x50')){var _0x51dba7={};_0x51dba7[_0x29a996[_0x8b2a('0x3a')]]={'$like':'%'+_0x4db1cf[_0x8b2a('0x43')]['filter']+'%'};return _0x51dba7;}})});}_0x473a10=_[_0x8b2a('0x4f')]({},_0x473a10,_0x4db1cf[_0x8b2a('0x51')]);var _0x338872={'where':_0x473a10[_0x8b2a('0x4c')]};return db[_0x8b2a('0x3e')][_0x8b2a('0x30')](_0x338872)[_0x8b2a('0x20')](function(_0x1ffd68){_0x57fe02[_0x8b2a('0x30')]=_0x1ffd68;if(_0x4db1cf[_0x8b2a('0x43')][_0x8b2a('0x52')]){_0x473a10[_0x8b2a('0x53')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x8b2a('0x54')](_0x473a10);})[_0x8b2a('0x20')](function(_0x19c6d6){_0x57fe02[_0x8b2a('0x55')]=_0x19c6d6;return _0x57fe02;})[_0x8b2a('0x20')](respondWithFilteredResult(_0x421167,_0x473a10))['catch'](handleError(_0x421167,null));};exports[_0x8b2a('0x56')]=function(_0x51f522,_0x3baeb0){var _0x284f96={'raw':![],'where':{'id':_0x51f522[_0x8b2a('0x57')]['id']}},_0xce9da3={};_0xce9da3[_0x8b2a('0x42')]=_['keys'](db[_0x8b2a('0x3e')]['rawAttributes']);_0xce9da3[_0x8b2a('0x43')]=_[_0x8b2a('0x44')](_0x51f522['query']);_0xce9da3[_0x8b2a('0x45')]=_['intersection'](_0xce9da3['model'],_0xce9da3[_0x8b2a('0x43')]);_0x284f96[_0x8b2a('0x48')]=_[_0x8b2a('0x46')](_0xce9da3[_0x8b2a('0x42')],qs[_0x8b2a('0x47')](_0x51f522['query'][_0x8b2a('0x47')]));_0x284f96[_0x8b2a('0x48')]=_0x284f96[_0x8b2a('0x48')][_0x8b2a('0x58')]?_0x284f96[_0x8b2a('0x48')]:_0xce9da3[_0x8b2a('0x42')];if(_0x51f522[_0x8b2a('0x43')][_0x8b2a('0x52')]){_0x284f96[_0x8b2a('0x53')]=[{'all':!![]}];}_0x284f96=_[_0x8b2a('0x4f')]({},_0x284f96,_0x51f522[_0x8b2a('0x51')]);return db[_0x8b2a('0x3e')][_0x8b2a('0x59')](_0x284f96)['then'](handleEntityNotFound(_0x3baeb0,null))['then'](respondWithResult(_0x3baeb0,null))[_0x8b2a('0x2b')](handleError(_0x3baeb0,null));};exports['create']=function(_0x4d690d,_0x5e27b0){return db[_0x8b2a('0x3e')]['create'](_0x4d690d[_0x8b2a('0x5a')],{})[_0x8b2a('0x20')](respondWithResult(_0x5e27b0,0xc9))[_0x8b2a('0x2b')](handleError(_0x5e27b0,null));};exports['update']=function(_0x270543,_0x46f77b){if(_0x270543[_0x8b2a('0x5a')]['id']){delete _0x270543[_0x8b2a('0x5a')]['id'];}return db['SalesforceAccount'][_0x8b2a('0x59')]({'where':{'id':_0x270543[_0x8b2a('0x57')]['id']}})[_0x8b2a('0x20')](handleEntityNotFound(_0x46f77b,null))[_0x8b2a('0x20')](saveUpdates(_0x270543[_0x8b2a('0x5a')],null))[_0x8b2a('0x20')](respondWithResult(_0x46f77b,null))[_0x8b2a('0x2b')](handleError(_0x46f77b,null));};exports[_0x8b2a('0x38')]=function(_0x6348e5,_0x514a4c){return db[_0x8b2a('0x3e')][_0x8b2a('0x59')]({'where':{'id':_0x6348e5['params']['id']}})['then'](handleEntityNotFound(_0x514a4c,null))[_0x8b2a('0x20')](removeEntity(_0x514a4c,null))[_0x8b2a('0x2b')](handleError(_0x514a4c,null));};exports[_0x8b2a('0x5b')]=function(_0x1297de,_0x1fe2f,_0x1a4b03){var _0x1ee642={};var _0x4f6af5={};var _0xc69f21;var _0x2052c8;return db[_0x8b2a('0x3e')]['findOne']({'where':{'id':_0x1297de['params']['id']}})[_0x8b2a('0x20')](handleEntityNotFound(_0x1fe2f,null))[_0x8b2a('0x20')](function(_0x257390){if(_0x257390){_0xc69f21=_0x257390;_0x4f6af5[_0x8b2a('0x42')]=_[_0x8b2a('0x44')](db[_0x8b2a('0x5c')]['rawAttributes']);_0x4f6af5['query']=_[_0x8b2a('0x44')](_0x1297de['query']);_0x4f6af5[_0x8b2a('0x45')]=_[_0x8b2a('0x46')](_0x4f6af5['model'],_0x4f6af5[_0x8b2a('0x43')]);_0x1ee642[_0x8b2a('0x48')]=_[_0x8b2a('0x46')](_0x4f6af5[_0x8b2a('0x42')],qs[_0x8b2a('0x47')](_0x1297de[_0x8b2a('0x43')][_0x8b2a('0x47')]));_0x1ee642[_0x8b2a('0x48')]=_0x1ee642[_0x8b2a('0x48')][_0x8b2a('0x58')]?_0x1ee642['attributes']:_0x4f6af5['model'];_0x1ee642[_0x8b2a('0x4a')]=qs[_0x8b2a('0x4b')](_0x1297de[_0x8b2a('0x43')]['sort']);_0x1ee642[_0x8b2a('0x4c')]=qs[_0x8b2a('0x45')](_[_0x8b2a('0x4d')](_0x1297de[_0x8b2a('0x43')],_0x4f6af5[_0x8b2a('0x45')]));if(_0x1297de[_0x8b2a('0x43')][_0x8b2a('0x4e')]){_0x1ee642['where']=_['merge'](_0x1ee642[_0x8b2a('0x4c')],{'$or':_['map'](_0x1ee642['attributes'],function(_0x50e8f0){var _0x14651a={};_0x14651a[_0x50e8f0]={'$like':'%'+_0x1297de[_0x8b2a('0x43')][_0x8b2a('0x4e')]+'%'};return _0x14651a;})});}_0x1ee642=_[_0x8b2a('0x4f')]({},_0x1ee642,_0x1297de[_0x8b2a('0x51')]);return _0xc69f21[_0x8b2a('0x5b')](_0x1ee642);}})[_0x8b2a('0x20')](function(_0x3b41b0){if(_0x3b41b0){_0x2052c8=_0x3b41b0[_0x8b2a('0x58')];if(!_0x1297de[_0x8b2a('0x43')][_0x8b2a('0x49')](_0x8b2a('0x5d'))){_0x1ee642[_0x8b2a('0x32')]=qs[_0x8b2a('0x32')](_0x1297de[_0x8b2a('0x43')][_0x8b2a('0x32')]);_0x1ee642[_0x8b2a('0x31')]=qs['offset'](_0x1297de[_0x8b2a('0x43')][_0x8b2a('0x31')]);}return _0xc69f21['getConfigurations'](_0x1ee642);}})[_0x8b2a('0x20')](function(_0x38954e){if(_0x38954e){return _0x38954e?{'count':_0x2052c8,'rows':_0x38954e}:null;}})[_0x8b2a('0x20')](respondWithResult(_0x1fe2f,null))[_0x8b2a('0x2b')](handleError(_0x1fe2f,null));};exports[_0x8b2a('0x5e')]=function(_0x519752,_0x577d5f,_0x456948){if(_0x519752['body']['id']){delete _0x519752[_0x8b2a('0x5a')]['id'];}return db[_0x8b2a('0x3e')][_0x8b2a('0x5f')]({'where':{'id':_0x519752[_0x8b2a('0x57')]['id']}})['then'](handleEntityNotFound(_0x577d5f,null))['then'](function(_0x82d911){if(_0x82d911){_0x519752['body'][_0x8b2a('0x60')]=_0x82d911['id'];_0x519752['body'][_0x8b2a('0x61')]=integrations[_0x8b2a('0x62')](_0x519752[_0x8b2a('0x5a')]['channel'],_0x519752[_0x8b2a('0x5a')][_0x8b2a('0x41')]);_0x519752[_0x8b2a('0x5a')][_0x8b2a('0x63')]=integrations[_0x8b2a('0x64')](_0x519752[_0x8b2a('0x5a')]['channel'],_0x519752[_0x8b2a('0x5a')][_0x8b2a('0x41')]);return db[_0x8b2a('0x5c')][_0x8b2a('0x65')](_0x519752['body'],{'include':[{'model':db[_0x8b2a('0x66')],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0x8b2a('0x63')}]});}return null;})[_0x8b2a('0x20')](respondWithResult(_0x577d5f,null))[_0x8b2a('0x2b')](handleError(_0x577d5f,null));};exports[_0x8b2a('0x67')]=function(_0x359e18,_0x556161,_0x372236){var _0x1f7e2e;var _0x284a71='';var _0x499316=_0x8b2a('0x68');return db['SalesforceAccount']['findOne']({'where':{'id':_0x359e18['params']['id']},'attributes':['id','remoteUri',_0x8b2a('0x69'),_0x8b2a('0x6a'),_0x8b2a('0x6b'),'password',_0x8b2a('0x6c')]})[_0x8b2a('0x20')](handleEntityNotFound(_0x556161,null))['then'](function(_0xbf17b8){if(_0xbf17b8){_0x284a71=_0xbf17b8[_0x8b2a('0x6d')];var _0x281cc7=_0x284a71['slice'](-0x1);if(_0x281cc7==='/'){_0x284a71=_0x284a71[_0x8b2a('0x6e')](0x0,_0x284a71[_0x8b2a('0x6f')](_0x281cc7));}_0x1f7e2e=new jsforce['Connection']({'oauth2':{'loginUrl':_0x284a71,'clientId':_0xbf17b8[_0x8b2a('0x69')],'clientSecret':_0xbf17b8[_0x8b2a('0x6a')]}});return _0x1f7e2e['login'](_0xbf17b8[_0x8b2a('0x6b')],_0xbf17b8[_0x8b2a('0x70')][_0x8b2a('0x71')](_0xbf17b8[_0x8b2a('0x6c')]));}})[_0x8b2a('0x20')](function(_0x34facd){if(_0x34facd){if(!_[_0x8b2a('0x72')](_0x359e18[_0x8b2a('0x43')][_0x8b2a('0x73')])){_0x499316=_0x359e18[_0x8b2a('0x43')]['ticketType'];}return _0x1f7e2e[_0x8b2a('0x74')](_0x499316)[_0x8b2a('0x75')]();}})[_0x8b2a('0x20')](function(_0xeeed64){var _0x326082=[_0x8b2a('0x76'),_0x8b2a('0x77'),'CallObject','CallType',_0x8b2a('0x78'),_0x8b2a('0x79'),_0x8b2a('0x7a'),'Type'];if(!_['isNil'](_0x359e18[_0x8b2a('0x43')][_0x8b2a('0x73')])&&_0x359e18[_0x8b2a('0x43')]['ticketType']==='Case'){_0x326082=['Type','Origin',_0x8b2a('0x7b'),_0x8b2a('0x7a'),_0x8b2a('0x79'),_0x8b2a('0x7c'),_0x8b2a('0x7d'),_0x8b2a('0x7e')];}if(_0xeeed64){_['remove'](_0xeeed64[_0x8b2a('0x47')],function(_0x2c9f66){return _0x2c9f66[_0x8b2a('0x7f')]===![]&&!_0x326082[_0x8b2a('0x80')](_0x2c9f66[_0x8b2a('0x3a')]);});return{'count':_0xeeed64[_0x8b2a('0x47')][_0x8b2a('0x58')],'rows':_[_0x8b2a('0x3d')](_0xeeed64[_0x8b2a('0x47')],function(_0x31068b){return{'id':_0x31068b[_0x8b2a('0x3a')],'name':_0x31068b[_0x8b2a('0x81')],'custom':_0x31068b[_0x8b2a('0x7f')],'options':_0x31068b[_0x8b2a('0x82')][_0x8b2a('0x58')]>0x0?_['map'](_0x31068b[_0x8b2a('0x82')],function(_0x19dfed){return{'name':_0x19dfed[_0x8b2a('0x81')],'value':_0x19dfed[_0x8b2a('0x83')]};}):_0x31068b[_0x8b2a('0x41')]==_0x8b2a('0x84')?[{'name':'True','value':_0x8b2a('0x85')},{'name':_0x8b2a('0x86'),'value':_0x8b2a('0x87')}]:[]};})};}})[_0x8b2a('0x20')](respondWithResult(_0x556161,null))[_0x8b2a('0x2b')](function(_0x5e524c){var _0x42f0fd=_0x359e18[_0x8b2a('0x43')][_0x8b2a('0x88')]?0x1f4:_0x5e524c[_0x8b2a('0x89')]||0x1f4;logger['error'](_0x8b2a('0x8a'),_0x8b2a('0x67'),_0x42f0fd,JSON[_0x8b2a('0x26')](_0x5e524c));delete _0x5e524c[_0x8b2a('0x3a')];if(_0x42f0fd===0x191){_0x42f0fd=0x190;}_0x556161[_0x8b2a('0x2d')](_0x42f0fd)[_0x8b2a('0x3b')](_0x359e18[_0x8b2a('0x43')][_0x8b2a('0x88')]?{'message':'Wrong\x20credentials','statusCode':_0x5e524c[_0x8b2a('0x89')]}:_0x5e524c);});}; \ No newline at end of file +var _0x3295=['path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','offset','limit','apply','update','destroy','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','show','params','find','create','body','findOne','SalesforceConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientSecret','username','password','lastIndexOf','Connection','clientId','login','concat','securityToken','isNil','ticketType','describe','CallDisposition','CallDurationInSeconds','CallObject','CallType','IsArchived','Priority','Status','Type','Case','Reason','IsEscalated','SuppliedName','SuppliedCompany','remove','custom','includes','label','picklistValues','value','boolean','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','moment','mustache','util'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0x3295,0x10d));var _0x5329=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0x3295[_0x37a79c];return _0x561d89;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5329('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5329('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5329('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5329('0x3'));var util=require(_0x5329('0x4'));var path=require(_0x5329('0x5'));var sox=require(_0x5329('0x6'));var csv=require(_0x5329('0x7'));var ejs=require(_0x5329('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5329('0x9'));var crypto=require(_0x5329('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5329('0xb'));var toCsv=require(_0x5329('0x7'));var querystring=require(_0x5329('0xc'));var Papa=require(_0x5329('0xd'));var Redis=require(_0x5329('0xe'));var authService=require(_0x5329('0xf'));var qs=require(_0x5329('0x10'));var as=require(_0x5329('0x11'));var hardwareService=require(_0x5329('0x12'));var logger=require(_0x5329('0x13'))(_0x5329('0x14'));var utils=require(_0x5329('0x15'));var config=require(_0x5329('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5329('0x17'));var jayson=require('jayson/promise');var client=jayson[_0x5329('0x18')][_0x5329('0x19')]({'port':0x232a});function checkPasswordPattern(_0x38c8da,_0x293608,_0x1e87cf){if(_0x1e87cf){var _0x3aabf7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3aabf7[_0x5329('0x1a')](_0x293608)){return _0x38c8da;}else{throw new db[(_0x5329('0x1b'))]['ValidationError'](_0x5329('0x1c'));}}else{return _0x38c8da;}}function respondWithRpcPromise(_0x5b7f37,_0x506501,_0xbb5430,_0x151073){return new BPromise(function(_0x4ecc45,_0x31b351){var _0x1037ff=_0x151073||client;return _0x1037ff[_0x5329('0x1d')](_0x5b7f37,_0xbb5430)[_0x5329('0x1e')](function(_0x97ed61){logger['info'](_0x5329('0x1f'),_0x506501,_0x5329('0x20'));logger[_0x5329('0x21')](_0x5329('0x22'),_0x506501,_0x5329('0x20'),JSON[_0x5329('0x23')](_0x97ed61));if(_0x97ed61[_0x5329('0x24')]){if(_0x97ed61[_0x5329('0x24')][_0x5329('0x25')]===0x1f4){logger[_0x5329('0x24')](_0x5329('0x1f'),_0x506501,_0x97ed61[_0x5329('0x24')][_0x5329('0x26')]);return _0x31b351(_0x97ed61[_0x5329('0x24')][_0x5329('0x26')]);}logger[_0x5329('0x24')](_0x5329('0x1f'),_0x506501,_0x97ed61[_0x5329('0x24')]['message']);return _0x4ecc45(_0x97ed61[_0x5329('0x24')][_0x5329('0x26')]);}else{logger['info'](_0x5329('0x1f'),_0x506501,_0x5329('0x20'));_0x4ecc45(_0x97ed61['result'][_0x5329('0x26')]);}})[_0x5329('0x27')](function(_0x28fac5){logger['error'](_0x5329('0x1f'),_0x506501,_0x28fac5);_0x31b351(_0x28fac5);});});}function respondWithStatusCode(_0x3ab297,_0xfa56b0){_0xfa56b0=_0xfa56b0||0xcc;return function(_0x1bd460){if(_0x1bd460){return _0x3ab297[_0x5329('0x28')](_0xfa56b0);}return _0x3ab297['status'](_0xfa56b0)[_0x5329('0x29')]();};}function respondWithResult(_0x9e9402,_0x1205b6){_0x1205b6=_0x1205b6||0xc8;return function(_0x242e72){if(_0x242e72){return _0x9e9402[_0x5329('0x2a')](_0x1205b6)[_0x5329('0x2b')](_0x242e72);}};}function respondWithFilteredResult(_0x2bcf8c,_0x4990b3){return function(_0x5f2c4c){if(_0x5f2c4c){var _0x1ee494=_0x5f2c4c['count'],_0x1ee0d1=_0x4990b3[_0x5329('0x2c')],_0x4157ec=_0x4990b3['offset']+_0x4990b3[_0x5329('0x2d')],_0x1190e5;if(_0x4157ec>=_0x1ee494){_0x4157ec=_0x1ee494;_0x1190e5=0xc8;}else{_0x1190e5=0xce;}_0x2bcf8c['status'](_0x1190e5);return _0x2bcf8c['set']('Content-Range',_0x1ee0d1+'-'+_0x4157ec+'/'+_0x1ee494)[_0x5329('0x2b')](_0x5f2c4c);}return null;};}function patchUpdates(_0x1d6ddd){return function(_0x446dbd){try{jsonpatch[_0x5329('0x2e')](_0x446dbd,_0x1d6ddd,!![]);}catch(_0x491013){return BPromise['reject'](_0x491013);}return _0x446dbd['save']();};}function saveUpdates(_0x5df100,_0x416f91){return function(_0x252c49){if(_0x252c49){return _0x252c49[_0x5329('0x2f')](_0x5df100)[_0x5329('0x1e')](function(_0x640631){return _0x640631;});}return null;};}function removeEntity(_0x32a1bb,_0x5b7002){return function(_0x2279e2){if(_0x2279e2){return _0x2279e2[_0x5329('0x30')]()['then'](function(){_0x32a1bb[_0x5329('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5751e9,_0x19fe9e){return function(_0x1fe7f3){if(!_0x1fe7f3){_0x5751e9[_0x5329('0x28')](0x194);}return _0x1fe7f3;};}function handleError(_0x418989,_0x45f5b9){_0x45f5b9=_0x45f5b9||0x1f4;return function(_0x19d125){logger[_0x5329('0x24')](_0x19d125[_0x5329('0x31')]);if(_0x19d125[_0x5329('0x32')]){delete _0x19d125[_0x5329('0x32')];}_0x418989[_0x5329('0x2a')](_0x45f5b9)[_0x5329('0x33')](_0x19d125);};}exports[_0x5329('0x34')]=function(_0x7ca55d,_0x15034b){var _0x455402={},_0x2fb0bf={},_0x2f80a0={'count':0x0,'rows':[]};var _0x3f4c3e=_['map'](db[_0x5329('0x35')][_0x5329('0x36')],function(_0x43b08d){return{'name':_0x43b08d[_0x5329('0x37')],'type':_0x43b08d['type'][_0x5329('0x38')]};});_0x2fb0bf[_0x5329('0x39')]=_[_0x5329('0x3a')](_0x3f4c3e,_0x5329('0x32'));_0x2fb0bf[_0x5329('0x3b')]=_[_0x5329('0x3c')](_0x7ca55d[_0x5329('0x3b')]);_0x2fb0bf[_0x5329('0x3d')]=_[_0x5329('0x3e')](_0x2fb0bf[_0x5329('0x39')],_0x2fb0bf[_0x5329('0x3b')]);_0x455402[_0x5329('0x3f')]=_['intersection'](_0x2fb0bf[_0x5329('0x39')],qs[_0x5329('0x40')](_0x7ca55d[_0x5329('0x3b')]['fields']));_0x455402[_0x5329('0x3f')]=_0x455402[_0x5329('0x3f')][_0x5329('0x41')]?_0x455402[_0x5329('0x3f')]:_0x2fb0bf[_0x5329('0x39')];if(!_0x7ca55d['query'][_0x5329('0x42')](_0x5329('0x43'))){_0x455402[_0x5329('0x2d')]=qs[_0x5329('0x2d')](_0x7ca55d[_0x5329('0x3b')]['limit']);_0x455402['offset']=qs['offset'](_0x7ca55d[_0x5329('0x3b')][_0x5329('0x2c')]);}_0x455402[_0x5329('0x44')]=qs[_0x5329('0x45')](_0x7ca55d[_0x5329('0x3b')][_0x5329('0x45')]);_0x455402[_0x5329('0x46')]=qs[_0x5329('0x3d')](_[_0x5329('0x47')](_0x7ca55d['query'],_0x2fb0bf[_0x5329('0x3d')]),_0x3f4c3e);if(_0x7ca55d[_0x5329('0x3b')][_0x5329('0x48')]){_0x455402[_0x5329('0x46')]=_[_0x5329('0x49')](_0x455402['where'],{'$or':_[_0x5329('0x3a')](_0x3f4c3e,function(_0x38b331){if(_0x38b331[_0x5329('0x4a')]!==_0x5329('0x4b')){var _0xaaf54e={};_0xaaf54e[_0x38b331[_0x5329('0x32')]]={'$like':'%'+_0x7ca55d[_0x5329('0x3b')]['filter']+'%'};return _0xaaf54e;}})});}_0x455402=_[_0x5329('0x49')]({},_0x455402,_0x7ca55d[_0x5329('0x4c')]);var _0x56139e={'where':_0x455402[_0x5329('0x46')]};return db['SalesforceAccount'][_0x5329('0x4d')](_0x56139e)[_0x5329('0x1e')](function(_0x569d6d){_0x2f80a0[_0x5329('0x4d')]=_0x569d6d;if(_0x7ca55d[_0x5329('0x3b')][_0x5329('0x4e')]){_0x455402[_0x5329('0x4f')]=[{'all':!![]}];}return db[_0x5329('0x35')][_0x5329('0x50')](_0x455402);})[_0x5329('0x1e')](function(_0x5c5722){_0x2f80a0['rows']=_0x5c5722;return _0x2f80a0;})['then'](respondWithFilteredResult(_0x15034b,_0x455402))[_0x5329('0x27')](handleError(_0x15034b,null));};exports[_0x5329('0x51')]=function(_0x169235,_0x1cbc81){var _0x2b3bfe={'raw':![],'where':{'id':_0x169235[_0x5329('0x52')]['id']}},_0x107bea={};_0x107bea[_0x5329('0x39')]=_[_0x5329('0x3c')](db[_0x5329('0x35')][_0x5329('0x36')]);_0x107bea['query']=_[_0x5329('0x3c')](_0x169235[_0x5329('0x3b')]);_0x107bea[_0x5329('0x3d')]=_['intersection'](_0x107bea['model'],_0x107bea[_0x5329('0x3b')]);_0x2b3bfe[_0x5329('0x3f')]=_['intersection'](_0x107bea[_0x5329('0x39')],qs['fields'](_0x169235[_0x5329('0x3b')][_0x5329('0x40')]));_0x2b3bfe['attributes']=_0x2b3bfe[_0x5329('0x3f')][_0x5329('0x41')]?_0x2b3bfe[_0x5329('0x3f')]:_0x107bea[_0x5329('0x39')];if(_0x169235[_0x5329('0x3b')][_0x5329('0x4e')]){_0x2b3bfe[_0x5329('0x4f')]=[{'all':!![]}];}_0x2b3bfe=_[_0x5329('0x49')]({},_0x2b3bfe,_0x169235[_0x5329('0x4c')]);return db[_0x5329('0x35')][_0x5329('0x53')](_0x2b3bfe)['then'](handleEntityNotFound(_0x1cbc81,null))['then'](respondWithResult(_0x1cbc81,null))[_0x5329('0x27')](handleError(_0x1cbc81,null));};exports[_0x5329('0x54')]=function(_0x5c5df9,_0x29b788){return db['SalesforceAccount'][_0x5329('0x54')](_0x5c5df9[_0x5329('0x55')],{})[_0x5329('0x1e')](respondWithResult(_0x29b788,0xc9))[_0x5329('0x27')](handleError(_0x29b788,null));};exports[_0x5329('0x2f')]=function(_0x403f2c,_0x2632c0){if(_0x403f2c[_0x5329('0x55')]['id']){delete _0x403f2c[_0x5329('0x55')]['id'];}return db[_0x5329('0x35')][_0x5329('0x53')]({'where':{'id':_0x403f2c[_0x5329('0x52')]['id']}})[_0x5329('0x1e')](handleEntityNotFound(_0x2632c0,null))[_0x5329('0x1e')](saveUpdates(_0x403f2c[_0x5329('0x55')],null))[_0x5329('0x1e')](respondWithResult(_0x2632c0,null))[_0x5329('0x27')](handleError(_0x2632c0,null));};exports[_0x5329('0x30')]=function(_0x2dfdf1,_0x6aaa4f){return db[_0x5329('0x35')][_0x5329('0x53')]({'where':{'id':_0x2dfdf1[_0x5329('0x52')]['id']}})['then'](handleEntityNotFound(_0x6aaa4f,null))[_0x5329('0x1e')](removeEntity(_0x6aaa4f,null))[_0x5329('0x27')](handleError(_0x6aaa4f,null));};exports['getConfigurations']=function(_0xc4c34b,_0x51176d,_0x40438a){var _0x44b373={};var _0x1e9262={};var _0x2db479;var _0x108ef2;return db[_0x5329('0x35')][_0x5329('0x56')]({'where':{'id':_0xc4c34b[_0x5329('0x52')]['id']}})[_0x5329('0x1e')](handleEntityNotFound(_0x51176d,null))[_0x5329('0x1e')](function(_0x5d89f6){if(_0x5d89f6){_0x2db479=_0x5d89f6;_0x1e9262['model']=_[_0x5329('0x3c')](db[_0x5329('0x57')][_0x5329('0x36')]);_0x1e9262[_0x5329('0x3b')]=_['keys'](_0xc4c34b['query']);_0x1e9262[_0x5329('0x3d')]=_[_0x5329('0x3e')](_0x1e9262['model'],_0x1e9262[_0x5329('0x3b')]);_0x44b373['attributes']=_[_0x5329('0x3e')](_0x1e9262[_0x5329('0x39')],qs[_0x5329('0x40')](_0xc4c34b['query'][_0x5329('0x40')]));_0x44b373['attributes']=_0x44b373[_0x5329('0x3f')][_0x5329('0x41')]?_0x44b373['attributes']:_0x1e9262['model'];_0x44b373[_0x5329('0x44')]=qs[_0x5329('0x45')](_0xc4c34b['query'][_0x5329('0x45')]);_0x44b373['where']=qs['filters'](_[_0x5329('0x47')](_0xc4c34b['query'],_0x1e9262[_0x5329('0x3d')]));if(_0xc4c34b['query'][_0x5329('0x48')]){_0x44b373[_0x5329('0x46')]=_[_0x5329('0x49')](_0x44b373[_0x5329('0x46')],{'$or':_[_0x5329('0x3a')](_0x44b373['attributes'],function(_0x249efd){var _0x1b4add={};_0x1b4add[_0x249efd]={'$like':'%'+_0xc4c34b['query']['filter']+'%'};return _0x1b4add;})});}_0x44b373=_['merge']({},_0x44b373,_0xc4c34b[_0x5329('0x4c')]);return _0x2db479[_0x5329('0x58')](_0x44b373);}})[_0x5329('0x1e')](function(_0x148432){if(_0x148432){_0x108ef2=_0x148432[_0x5329('0x41')];if(!_0xc4c34b[_0x5329('0x3b')][_0x5329('0x42')]('nolimit')){_0x44b373['limit']=qs['limit'](_0xc4c34b[_0x5329('0x3b')][_0x5329('0x2d')]);_0x44b373[_0x5329('0x2c')]=qs[_0x5329('0x2c')](_0xc4c34b['query'][_0x5329('0x2c')]);}return _0x2db479[_0x5329('0x58')](_0x44b373);}})[_0x5329('0x1e')](function(_0x2c6d8a){if(_0x2c6d8a){return _0x2c6d8a?{'count':_0x108ef2,'rows':_0x2c6d8a}:null;}})[_0x5329('0x1e')](respondWithResult(_0x51176d,null))[_0x5329('0x27')](handleError(_0x51176d,null));};exports[_0x5329('0x59')]=function(_0x36b834,_0xe21c3f,_0x373a1e){if(_0x36b834[_0x5329('0x55')]['id']){delete _0x36b834[_0x5329('0x55')]['id'];}return db[_0x5329('0x35')][_0x5329('0x56')]({'where':{'id':_0x36b834['params']['id']}})[_0x5329('0x1e')](handleEntityNotFound(_0xe21c3f,null))[_0x5329('0x1e')](function(_0x1adbdc){if(_0x1adbdc){_0x36b834[_0x5329('0x55')][_0x5329('0x5a')]=_0x1adbdc['id'];_0x36b834[_0x5329('0x55')][_0x5329('0x5b')]=integrations['getSubjects'](_0x36b834[_0x5329('0x55')][_0x5329('0x5c')],_0x36b834[_0x5329('0x55')][_0x5329('0x4a')]);_0x36b834[_0x5329('0x55')][_0x5329('0x5d')]=integrations[_0x5329('0x5e')](_0x36b834['body']['channel'],_0x36b834[_0x5329('0x55')]['type']);return db[_0x5329('0x57')][_0x5329('0x54')](_0x36b834[_0x5329('0x55')],{'include':[{'model':db['SalesforceField'],'as':_0x5329('0x5b')},{'model':db[_0x5329('0x5f')],'as':'Descriptions'}]});}return null;})[_0x5329('0x1e')](respondWithResult(_0xe21c3f,null))[_0x5329('0x27')](handleError(_0xe21c3f,null));};exports[_0x5329('0x60')]=function(_0x125772,_0x44d4ca,_0x413173){var _0x3eccbb;var _0x12623a='';var _0x1d7762=_0x5329('0x61');return db[_0x5329('0x35')][_0x5329('0x56')]({'where':{'id':_0x125772[_0x5329('0x52')]['id']},'attributes':['id',_0x5329('0x62'),'clientId',_0x5329('0x63'),_0x5329('0x64'),_0x5329('0x65'),'securityToken']})[_0x5329('0x1e')](handleEntityNotFound(_0x44d4ca,null))[_0x5329('0x1e')](function(_0x1c7b40){if(_0x1c7b40){_0x12623a=_0x1c7b40[_0x5329('0x62')];var _0x575011=_0x12623a['slice'](-0x1);if(_0x575011==='/'){_0x12623a=_0x12623a['substring'](0x0,_0x12623a[_0x5329('0x66')](_0x575011));}_0x3eccbb=new jsforce[(_0x5329('0x67'))]({'oauth2':{'loginUrl':_0x12623a,'clientId':_0x1c7b40[_0x5329('0x68')],'clientSecret':_0x1c7b40[_0x5329('0x63')]}});return _0x3eccbb[_0x5329('0x69')](_0x1c7b40[_0x5329('0x64')],_0x1c7b40['password'][_0x5329('0x6a')](_0x1c7b40[_0x5329('0x6b')]));}})[_0x5329('0x1e')](function(_0xcccb4){if(_0xcccb4){if(!_[_0x5329('0x6c')](_0x125772['query'][_0x5329('0x6d')])){_0x1d7762=_0x125772['query'][_0x5329('0x6d')];}return _0x3eccbb['sobject'](_0x1d7762)[_0x5329('0x6e')]();}})[_0x5329('0x1e')](function(_0xa38b6e){var _0x1296d9=[_0x5329('0x6f'),_0x5329('0x70'),_0x5329('0x71'),_0x5329('0x72'),_0x5329('0x73'),_0x5329('0x74'),_0x5329('0x75'),_0x5329('0x76')];if(!_[_0x5329('0x6c')](_0x125772['query'][_0x5329('0x6d')])&&_0x125772[_0x5329('0x3b')][_0x5329('0x6d')]===_0x5329('0x77')){_0x1296d9=[_0x5329('0x76'),'Origin',_0x5329('0x78'),_0x5329('0x75'),'Priority',_0x5329('0x79'),_0x5329('0x7a'),_0x5329('0x7b')];}if(_0xa38b6e){_[_0x5329('0x7c')](_0xa38b6e[_0x5329('0x40')],function(_0x401554){return _0x401554[_0x5329('0x7d')]===![]&&!_0x1296d9[_0x5329('0x7e')](_0x401554[_0x5329('0x32')]);});return{'count':_0xa38b6e['fields'][_0x5329('0x41')],'rows':_[_0x5329('0x3a')](_0xa38b6e['fields'],function(_0x5804ec){return{'id':_0x5804ec[_0x5329('0x32')],'name':_0x5804ec[_0x5329('0x7f')],'custom':_0x5804ec[_0x5329('0x7d')],'options':_0x5804ec[_0x5329('0x80')]['length']>0x0?_[_0x5329('0x3a')](_0x5804ec[_0x5329('0x80')],function(_0x4cd1a3){return{'name':_0x4cd1a3['label'],'value':_0x4cd1a3[_0x5329('0x81')]};}):_0x5804ec[_0x5329('0x4a')]==_0x5329('0x82')?[{'name':'True','value':_0x5329('0x83')},{'name':_0x5329('0x84'),'value':_0x5329('0x85')}]:[]};})};}})[_0x5329('0x1e')](respondWithResult(_0x44d4ca,null))[_0x5329('0x27')](function(_0x21a5b1){var _0x5e0ad3=_0x125772[_0x5329('0x3b')][_0x5329('0x1a')]?0x1f4:_0x21a5b1[_0x5329('0x86')]||0x1f4;logger[_0x5329('0x24')](_0x5329('0x87'),_0x5329('0x60'),_0x5e0ad3,JSON['stringify'](_0x21a5b1));delete _0x21a5b1[_0x5329('0x32')];if(_0x5e0ad3===0x191){_0x5e0ad3=0x190;}_0x44d4ca['status'](_0x5e0ad3)['send'](_0x125772[_0x5329('0x3b')]['test']?{'message':_0x5329('0x88'),'statusCode':_0x21a5b1[_0x5329('0x86')]}:_0x21a5b1);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index bfd9165..2b6c49b 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 _0xe4d7=['lodash','util','api','moment','bluebird','request-promise','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount'];(function(_0x57ca23,_0x289196){var _0x5b4f41=function(_0x526af6){while(--_0x526af6){_0x57ca23['push'](_0x57ca23['shift']());}};_0x5b4f41(++_0x289196);}(_0xe4d7,0xf0));var _0x7e4d=function(_0xc12940,_0x7a16b6){_0xc12940=_0xc12940-0x0;var _0x5ddb37=_0xe4d7[_0xc12940];return _0x5ddb37;};'use strict';var _=require(_0x7e4d('0x0'));var util=require(_0x7e4d('0x1'));var logger=require('../../config/logger')(_0x7e4d('0x2'));var moment=require(_0x7e4d('0x3'));var BPromise=require(_0x7e4d('0x4'));var rp=require(_0x7e4d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7e4d('0x6'));var config=require('../../config/environment');var attributes=require(_0x7e4d('0x7'));var integrations=require(_0x7e4d('0x8'));module[_0x7e4d('0x9')]=function(_0x29a9a9,_0x17c57a){return _0x29a9a9[_0x7e4d('0xa')](_0x7e4d('0xb'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x625d=['SalesforceAccount','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x1af92f,_0x5a448c){var _0x2ce73e=function(_0x198f16){while(--_0x198f16){_0x1af92f['push'](_0x1af92f['shift']());}};_0x2ce73e(++_0x5a448c);}(_0x625d,0x1cf));var _0xd625=function(_0x1eb402,_0x164f02){_0x1eb402=_0x1eb402-0x0;var _0x577f76=_0x625d[_0x1eb402];return _0x577f76;};'use strict';var _=require(_0xd625('0x0'));var util=require(_0xd625('0x1'));var logger=require('../../config/logger')(_0xd625('0x2'));var moment=require(_0xd625('0x3'));var BPromise=require(_0xd625('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd625('0x5'));var rimraf=require(_0xd625('0x6'));var config=require(_0xd625('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xd625('0x8')]=function(_0x21a80a,_0x44f4fc){return _0x21a80a[_0xd625('0x9')](_0xd625('0xa'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 4c9b5e7..edd948b 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 _0xb49a=['info','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','options','attributes','include','map','model','ShowSalesforceAccount','SalesforceAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xb49a,0xfb));var _0xab49=function(_0x135fa5,_0x5068d7){_0x135fa5=_0x135fa5-0x0;var _0x40789f=_0xb49a[_0x135fa5];return _0x40789f;};'use strict';var _=require(_0xab49('0x0'));var util=require(_0xab49('0x1'));var moment=require(_0xab49('0x2'));var BPromise=require(_0xab49('0x3'));var rs=require(_0xab49('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab49('0x5'))['db'];var utils=require(_0xab49('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xab49('0x7'));var jayson=require(_0xab49('0x8'));var client=jayson[_0xab49('0x9')][_0xab49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57ea72,_0x26a98a,_0xd86a5){return new BPromise(function(_0x4d4d00,_0x15f259){return client[_0xab49('0xb')](_0x57ea72,_0xd86a5)[_0xab49('0xc')](function(_0x79f764){logger[_0xab49('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x26a98a,'request\x20sent');logger[_0xab49('0xe')](_0xab49('0xf'),_0x26a98a,_0xab49('0x10'),JSON[_0xab49('0x11')](_0x79f764));if(_0x79f764[_0xab49('0x12')]){if(_0x79f764['error'][_0xab49('0x13')]===0x1f4){logger[_0xab49('0x12')](_0xab49('0x14'),_0x26a98a,_0x79f764[_0xab49('0x12')][_0xab49('0x15')]);return _0x15f259(_0x79f764[_0xab49('0x12')][_0xab49('0x15')]);}logger[_0xab49('0x12')](_0xab49('0x14'),_0x26a98a,_0x79f764[_0xab49('0x12')][_0xab49('0x15')]);return _0x4d4d00(_0x79f764['error'][_0xab49('0x15')]);}else{logger[_0xab49('0xd')](_0xab49('0x14'),_0x26a98a,_0xab49('0x10'));_0x4d4d00(_0x79f764[_0xab49('0x16')]['message']);}})[_0xab49('0x17')](function(_0x2cbcff){logger[_0xab49('0x12')](_0xab49('0x14'),_0x26a98a,_0x2cbcff);_0x15f259(_0x2cbcff);});});}exports[_0xab49('0x18')]=function(_0x47f977){var _0x167a2a=this;return new Promise(function(_0x24cb8f,_0x28449b){return db['SalesforceAccount']['findAll']({'raw':_0x47f977[_0xab49('0x19')]?_0x47f977[_0xab49('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x47f977[_0xab49('0x19')]?_0x47f977[_0xab49('0x19')]['where']||null:null,'attributes':_0x47f977[_0xab49('0x19')]?_0x47f977['options'][_0xab49('0x1a')]||null:null,'limit':_0x47f977[_0xab49('0x19')]?_0x47f977['options']['limit']||null:null,'include':_0x47f977[_0xab49('0x19')]?_0x47f977['options'][_0xab49('0x1b')]?_['map'](_0x47f977[_0xab49('0x19')][_0xab49('0x1b')],function(_0x2ba18a){return{'model':db[_0x2ba18a['model']],'as':_0x2ba18a['as'],'attributes':_0x2ba18a[_0xab49('0x1a')],'include':_0x2ba18a['include']?_[_0xab49('0x1c')](_0x2ba18a[_0xab49('0x1b')],function(_0x5c3d71){return{'model':db[_0x5c3d71[_0xab49('0x1d')]],'as':_0x5c3d71['as'],'attributes':_0x5c3d71[_0xab49('0x1a')],'include':_0x5c3d71['include']?_['map'](_0x5c3d71[_0xab49('0x1b')],function(_0x2e0e37){return{'model':db[_0x2e0e37[_0xab49('0x1d')]],'as':_0x2e0e37['as'],'attributes':_0x2e0e37['attributes']};}):[]};}):[]};}):[]:[]})[_0xab49('0xc')](function(_0x237273){logger['info'](_0xab49('0x18'),_0x47f977);logger[_0xab49('0xe')](_0xab49('0x18'),_0x47f977,JSON['stringify'](_0x237273));_0x24cb8f(_0x237273);})[_0xab49('0x17')](function(_0x550f06){logger[_0xab49('0x12')]('GetSalesforceAccount',_0x550f06[_0xab49('0x15')],_0x47f977);_0x28449b(_0x167a2a['error'](0x1f4,_0x550f06[_0xab49('0x15')]));});});};exports[_0xab49('0x1e')]=function(_0x1c48ef){var _0x211be2=this;return new Promise(function(_0x49f122,_0x6e83f6){return db[_0xab49('0x1f')][_0xab49('0x20')]({'raw':_0x1c48ef['options']?_0x1c48ef[_0xab49('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1c48ef[_0xab49('0x19')]?_0x1c48ef['options']['where']||null:null,'attributes':_0x1c48ef['options']?_0x1c48ef[_0xab49('0x19')]['attributes']||null:null,'include':_0x1c48ef[_0xab49('0x19')]?_0x1c48ef[_0xab49('0x19')][_0xab49('0x1b')]?_['map'](_0x1c48ef[_0xab49('0x19')][_0xab49('0x1b')],function(_0x3cc88b){return{'model':db[_0x3cc88b[_0xab49('0x1d')]],'as':_0x3cc88b['as'],'attributes':_0x3cc88b[_0xab49('0x1a')],'include':_0x3cc88b['include']?_[_0xab49('0x1c')](_0x3cc88b[_0xab49('0x1b')],function(_0x496000){return{'model':db[_0x496000['model']],'as':_0x496000['as'],'attributes':_0x496000[_0xab49('0x1a')],'include':_0x496000[_0xab49('0x1b')]?_[_0xab49('0x1c')](_0x496000[_0xab49('0x1b')],function(_0x325ad9){return{'model':db[_0x325ad9[_0xab49('0x1d')]],'as':_0x325ad9['as'],'attributes':_0x325ad9[_0xab49('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xab49('0xc')](function(_0x459b9d){logger[_0xab49('0xd')](_0xab49('0x1e'),_0x1c48ef);logger[_0xab49('0xe')](_0xab49('0x1e'),_0x1c48ef,JSON['stringify'](_0x459b9d));_0x49f122(_0x459b9d);})[_0xab49('0x17')](function(_0x1803d3){logger[_0xab49('0x12')](_0xab49('0x1e'),_0x1803d3[_0xab49('0x15')],_0x1c48ef);_0x6e83f6(_0x211be2['error'](0x1f4,_0x1803d3[_0xab49('0x15')]));});});}; \ No newline at end of file +var _0x4522=['limit','include','map','model','attributes','info','ShowSalesforceAccount','find','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where'];(function(_0x917152,_0x429f04){var _0x494acf=function(_0x1095ba){while(--_0x1095ba){_0x917152['push'](_0x917152['shift']());}};_0x494acf(++_0x429f04);}(_0x4522,0x1a0));var _0x2452=function(_0x58827a,_0x26e582){_0x58827a=_0x58827a-0x0;var _0x1a54fc=_0x4522[_0x58827a];return _0x1a54fc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2452('0x0'));var BPromise=require(_0x2452('0x1'));var rs=require(_0x2452('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2452('0x3'))['db'];var utils=require(_0x2452('0x4'));var logger=require(_0x2452('0x5'))(_0x2452('0x6'));var config=require(_0x2452('0x7'));var jayson=require(_0x2452('0x8'));var client=jayson[_0x2452('0x9')][_0x2452('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0139,_0x149807,_0x3bc193){return new BPromise(function(_0x33b935,_0x24073f){return client[_0x2452('0xb')](_0x2f0139,_0x3bc193)[_0x2452('0xc')](function(_0x2995b5){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x149807,_0x2452('0xd'));logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x149807,_0x2452('0xd'),JSON[_0x2452('0xe')](_0x2995b5));if(_0x2995b5[_0x2452('0xf')]){if(_0x2995b5[_0x2452('0xf')][_0x2452('0x10')]===0x1f4){logger[_0x2452('0xf')](_0x2452('0x11'),_0x149807,_0x2995b5[_0x2452('0xf')]['message']);return _0x24073f(_0x2995b5['error']['message']);}logger[_0x2452('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x149807,_0x2995b5[_0x2452('0xf')]['message']);return _0x33b935(_0x2995b5[_0x2452('0xf')][_0x2452('0x12')]);}else{logger['info'](_0x2452('0x11'),_0x149807,'request\x20sent');_0x33b935(_0x2995b5[_0x2452('0x13')][_0x2452('0x12')]);}})[_0x2452('0x14')](function(_0xdede20){logger['error'](_0x2452('0x11'),_0x149807,_0xdede20);_0x24073f(_0xdede20);});});}exports[_0x2452('0x15')]=function(_0x59d89a){var _0x4802ad=this;return new Promise(function(_0x1bfb44,_0x37c6a6){return db[_0x2452('0x16')]['findAll']({'raw':_0x59d89a[_0x2452('0x17')]?_0x59d89a[_0x2452('0x17')][_0x2452('0x18')]===undefined?!![]:![]:!![],'where':_0x59d89a[_0x2452('0x17')]?_0x59d89a[_0x2452('0x17')][_0x2452('0x19')]||null:null,'attributes':_0x59d89a[_0x2452('0x17')]?_0x59d89a[_0x2452('0x17')]['attributes']||null:null,'limit':_0x59d89a['options']?_0x59d89a[_0x2452('0x17')][_0x2452('0x1a')]||null:null,'include':_0x59d89a['options']?_0x59d89a[_0x2452('0x17')][_0x2452('0x1b')]?_[_0x2452('0x1c')](_0x59d89a[_0x2452('0x17')][_0x2452('0x1b')],function(_0x397f21){return{'model':db[_0x397f21[_0x2452('0x1d')]],'as':_0x397f21['as'],'attributes':_0x397f21['attributes'],'include':_0x397f21[_0x2452('0x1b')]?_[_0x2452('0x1c')](_0x397f21[_0x2452('0x1b')],function(_0x231410){return{'model':db[_0x231410[_0x2452('0x1d')]],'as':_0x231410['as'],'attributes':_0x231410['attributes'],'include':_0x231410['include']?_[_0x2452('0x1c')](_0x231410[_0x2452('0x1b')],function(_0x46fcbb){return{'model':db[_0x46fcbb[_0x2452('0x1d')]],'as':_0x46fcbb['as'],'attributes':_0x46fcbb[_0x2452('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fba00){logger[_0x2452('0x1f')]('GetSalesforceAccount',_0x59d89a);logger['debug'](_0x2452('0x15'),_0x59d89a,JSON[_0x2452('0xe')](_0x3fba00));_0x1bfb44(_0x3fba00);})[_0x2452('0x14')](function(_0x28e6ea){logger[_0x2452('0xf')](_0x2452('0x15'),_0x28e6ea['message'],_0x59d89a);_0x37c6a6(_0x4802ad['error'](0x1f4,_0x28e6ea[_0x2452('0x12')]));});});};exports[_0x2452('0x20')]=function(_0x130565){var _0x5c36aa=this;return new Promise(function(_0x2fb2ae,_0x586a20){return db['SalesforceAccount'][_0x2452('0x21')]({'raw':_0x130565[_0x2452('0x17')]?_0x130565[_0x2452('0x17')][_0x2452('0x18')]===undefined?!![]:![]:!![],'where':_0x130565[_0x2452('0x17')]?_0x130565[_0x2452('0x17')][_0x2452('0x19')]||null:null,'attributes':_0x130565[_0x2452('0x17')]?_0x130565[_0x2452('0x17')][_0x2452('0x1e')]||null:null,'include':_0x130565[_0x2452('0x17')]?_0x130565[_0x2452('0x17')][_0x2452('0x1b')]?_['map'](_0x130565[_0x2452('0x17')][_0x2452('0x1b')],function(_0x4cd7e2){return{'model':db[_0x4cd7e2[_0x2452('0x1d')]],'as':_0x4cd7e2['as'],'attributes':_0x4cd7e2['attributes'],'include':_0x4cd7e2[_0x2452('0x1b')]?_[_0x2452('0x1c')](_0x4cd7e2['include'],function(_0x645722){return{'model':db[_0x645722[_0x2452('0x1d')]],'as':_0x645722['as'],'attributes':_0x645722[_0x2452('0x1e')],'include':_0x645722['include']?_[_0x2452('0x1c')](_0x645722[_0x2452('0x1b')],function(_0x4ba2ae){return{'model':db[_0x4ba2ae[_0x2452('0x1d')]],'as':_0x4ba2ae['as'],'attributes':_0x4ba2ae[_0x2452('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2452('0xc')](function(_0x26264f){logger[_0x2452('0x1f')]('ShowSalesforceAccount',_0x130565);logger['debug']('ShowSalesforceAccount',_0x130565,JSON[_0x2452('0xe')](_0x26264f));_0x2fb2ae(_0x26264f);})[_0x2452('0x14')](function(_0x64965c){logger[_0x2452('0xf')](_0x2452('0x20'),_0x64965c['message'],_0x130565);_0x586a20(_0x5c36aa[_0x2452('0xf')](0x1f4,_0x64965c['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 5fe9ade..59ff8fd 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 _0x6f5f=['exports','multer','path','Router','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','/:id/descriptions','getDescriptions','post','put','update'];(function(_0x33b9ac,_0x1cd671){var _0x4da2a0=function(_0x62ec6b){while(--_0x62ec6b){_0x33b9ac['push'](_0x33b9ac['shift']());}};_0x4da2a0(++_0x1cd671);}(_0x6f5f,0x111));var _0xf6f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f5f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf6f5('0x0'));var util=require('util');var path=require(_0xf6f5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf6f5('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xf6f5('0x3'));var config=require(_0xf6f5('0x4'));var controller=require(_0xf6f5('0x5'));router[_0xf6f5('0x6')]('/',auth['isAuthenticated'](),controller[_0xf6f5('0x7')]);router[_0xf6f5('0x6')](_0xf6f5('0x8'),auth[_0xf6f5('0x9')](),controller['show']);router['get'](_0xf6f5('0xa'),auth[_0xf6f5('0x9')](),controller['getFields']);router[_0xf6f5('0x6')]('/:id/subjects',auth[_0xf6f5('0x9')](),controller['getSubjects']);router[_0xf6f5('0x6')](_0xf6f5('0xb'),auth[_0xf6f5('0x9')](),controller[_0xf6f5('0xc')]);router[_0xf6f5('0xd')]('/',auth[_0xf6f5('0x9')](),controller['create']);router[_0xf6f5('0xe')](_0xf6f5('0x8'),auth[_0xf6f5('0x9')](),controller[_0xf6f5('0xf')]);router['delete'](_0xf6f5('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xf6f5('0x10')]=router; \ No newline at end of file +var _0xf500=['/:id/descriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x2bef42,_0x788346){var _0x2f1172=function(_0x5d8e17){while(--_0x5d8e17){_0x2bef42['push'](_0x2bef42['shift']());}};_0x2f1172(++_0x788346);}(_0xf500,0x11c));var _0x0f50=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xf500[_0x1477ef];return _0x164acd;};'use strict';var multer=require(_0x0f50('0x0'));var util=require(_0x0f50('0x1'));var path=require(_0x0f50('0x2'));var timeout=require(_0x0f50('0x3'));var express=require('express');var router=express[_0x0f50('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0f50('0x5'));var controller=require(_0x0f50('0x6'));router[_0x0f50('0x7')]('/',auth[_0x0f50('0x8')](),controller[_0x0f50('0x9')]);router['get'](_0x0f50('0xa'),auth[_0x0f50('0x8')](),controller[_0x0f50('0xb')]);router['get'](_0x0f50('0xc'),auth[_0x0f50('0x8')](),controller[_0x0f50('0xd')]);router[_0x0f50('0x7')](_0x0f50('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x0f50('0x7')](_0x0f50('0xf'),auth[_0x0f50('0x8')](),controller['getDescriptions']);router[_0x0f50('0x10')]('/',auth[_0x0f50('0x8')](),controller[_0x0f50('0x11')]);router[_0x0f50('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0f50('0x13')]);router[_0x0f50('0x14')](_0x0f50('0xa'),auth[_0x0f50('0x8')](),controller[_0x0f50('0x15')]);module[_0x0f50('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 99d0e26..e63be73 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 _0xc260=['STRING','ENUM','Case','lead','contact_lead','nothing','contact','sequelize','exports'];(function(_0x1381df,_0xa4f9e9){var _0x3dd915=function(_0x104735){while(--_0x104735){_0x1381df['push'](_0x1381df['shift']());}};_0x3dd915(++_0xa4f9e9);}(_0xc260,0x178));var _0x0c26=function(_0x564ffe,_0x3b6091){_0x564ffe=_0x564ffe-0x0;var _0x524aa2=_0xc260[_0x564ffe];return _0x524aa2;};'use strict';var Sequelize=require(_0x0c26('0x0'));module[_0x0c26('0x1')]={'name':{'type':Sequelize[_0x0c26('0x2')]},'description':{'type':Sequelize[_0x0c26('0x2')]},'ticketType':{'type':Sequelize[_0x0c26('0x3')]('Task',_0x0c26('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x0c26('0x3')]('contact_lead','contact',_0x0c26('0x5')),'defaultValue':_0x0c26('0x6')},'moduleCreate':{'type':Sequelize['ENUM'](_0x0c26('0x7'),_0x0c26('0x8'),_0x0c26('0x5')),'defaultValue':_0x0c26('0x5')}}; \ No newline at end of file +var _0x7d63=['STRING','ENUM','Case','Task','contact','nothing','lead','sequelize'];(function(_0x5c3f6b,_0x2b17e4){var _0x26ece7=function(_0x2c86c6){while(--_0x2c86c6){_0x5c3f6b['push'](_0x5c3f6b['shift']());}};_0x26ece7(++_0x2b17e4);}(_0x7d63,0x97));var _0x37d6=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x7d63[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require(_0x37d6('0x0'));module['exports']={'name':{'type':Sequelize[_0x37d6('0x1')]},'description':{'type':Sequelize[_0x37d6('0x1')]},'ticketType':{'type':Sequelize[_0x37d6('0x2')]('Task',_0x37d6('0x3')),'defaultValue':_0x37d6('0x4')},'moduleSearch':{'type':Sequelize[_0x37d6('0x2')]('contact_lead',_0x37d6('0x5'),'lead'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x37d6('0x2')](_0x37d6('0x6'),_0x37d6('0x5'),_0x37d6('0x7')),'defaultValue':_0x37d6('0x7')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 4182afa..ebc701a 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 _0x3b8b=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','show','params','keys','includeAll','create','body','update','find','findOne','SalesforceField','getFields','nolimit','getSubjects','options','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','jayson/promise','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','status','end','count','offset','limit','set','Content-Range','json','apply','reject','destroy','sendStatus','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','model','query'];(function(_0x24f63e,_0x2cda65){var _0x1c666e=function(_0x44292d){while(--_0x44292d){_0x24f63e['push'](_0x24f63e['shift']());}};_0x1c666e(++_0x2cda65);}(_0x3b8b,0x146));var _0xb3b8=function(_0x2ab3d9,_0x50e716){_0x2ab3d9=_0x2ab3d9-0x0;var _0x210a54=_0x3b8b[_0x2ab3d9];return _0x210a54;};'use strict';var pdf=require(_0xb3b8('0x0'));var emlformat=require(_0xb3b8('0x1'));var rimraf=require(_0xb3b8('0x2'));var zipdir=require(_0xb3b8('0x3'));var jsonpatch=require(_0xb3b8('0x4'));var rp=require(_0xb3b8('0x5'));var moment=require(_0xb3b8('0x6'));var BPromise=require(_0xb3b8('0x7'));var Mustache=require(_0xb3b8('0x8'));var util=require(_0xb3b8('0x9'));var path=require(_0xb3b8('0xa'));var sox=require(_0xb3b8('0xb'));var csv=require(_0xb3b8('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb3b8('0xd'));var squel=require('squel');var crypto=require(_0xb3b8('0xe'));var jsforce=require(_0xb3b8('0xf'));var deskjs=require(_0xb3b8('0x10'));var toCsv=require(_0xb3b8('0xc'));var querystring=require(_0xb3b8('0x11'));var Papa=require(_0xb3b8('0x12'));var Redis=require(_0xb3b8('0x13'));var authService=require(_0xb3b8('0x14'));var qs=require(_0xb3b8('0x15'));var as=require(_0xb3b8('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb3b8('0x17'));var utils=require(_0xb3b8('0x18'));var config=require(_0xb3b8('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb3b8('0x1a'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x144a46,_0x119d58,_0x5c24d8){if(_0x5c24d8){var _0x3da43b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3da43b[_0xb3b8('0x1b')](_0x119d58)){return _0x144a46;}else{throw new db[(_0xb3b8('0x1c'))][(_0xb3b8('0x1d'))](_0xb3b8('0x1e'));}}else{return _0x144a46;}}function respondWithRpcPromise(_0x175401,_0x5cf218,_0x5159fd,_0x1cabe5){return new BPromise(function(_0x27bd80,_0x261360){var _0x3fc087=_0x1cabe5||client;return _0x3fc087[_0xb3b8('0x1f')](_0x175401,_0x5159fd)[_0xb3b8('0x20')](function(_0x566b8f){logger[_0xb3b8('0x21')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5cf218,_0xb3b8('0x22'));logger[_0xb3b8('0x23')](_0xb3b8('0x24'),_0x5cf218,'request\x20sent',JSON[_0xb3b8('0x25')](_0x566b8f));if(_0x566b8f[_0xb3b8('0x26')]){if(_0x566b8f['error'][_0xb3b8('0x27')]===0x1f4){logger[_0xb3b8('0x26')](_0xb3b8('0x28'),_0x5cf218,_0x566b8f[_0xb3b8('0x26')][_0xb3b8('0x29')]);return _0x261360(_0x566b8f[_0xb3b8('0x26')][_0xb3b8('0x29')]);}logger[_0xb3b8('0x26')](_0xb3b8('0x28'),_0x5cf218,_0x566b8f['error'][_0xb3b8('0x29')]);return _0x27bd80(_0x566b8f['error'][_0xb3b8('0x29')]);}else{logger['info'](_0xb3b8('0x28'),_0x5cf218,_0xb3b8('0x22'));_0x27bd80(_0x566b8f[_0xb3b8('0x2a')]['message']);}})[_0xb3b8('0x2b')](function(_0x59d1a4){logger[_0xb3b8('0x26')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5cf218,_0x59d1a4);_0x261360(_0x59d1a4);});});}function respondWithStatusCode(_0x249048,_0x2efcb3){_0x2efcb3=_0x2efcb3||0xcc;return function(_0x4e0278){if(_0x4e0278){return _0x249048['sendStatus'](_0x2efcb3);}return _0x249048[_0xb3b8('0x2c')](_0x2efcb3)[_0xb3b8('0x2d')]();};}function respondWithResult(_0x1ec03c,_0x4c71e8){_0x4c71e8=_0x4c71e8||0xc8;return function(_0x40d54e){if(_0x40d54e){return _0x1ec03c[_0xb3b8('0x2c')](_0x4c71e8)['json'](_0x40d54e);}};}function respondWithFilteredResult(_0x29af50,_0xe6b9e9){return function(_0x2a0bd2){if(_0x2a0bd2){var _0x982747=_0x2a0bd2[_0xb3b8('0x2e')],_0x26ab14=_0xe6b9e9[_0xb3b8('0x2f')],_0x6bacbf=_0xe6b9e9['offset']+_0xe6b9e9[_0xb3b8('0x30')],_0x349a97;if(_0x6bacbf>=_0x982747){_0x6bacbf=_0x982747;_0x349a97=0xc8;}else{_0x349a97=0xce;}_0x29af50[_0xb3b8('0x2c')](_0x349a97);return _0x29af50[_0xb3b8('0x31')](_0xb3b8('0x32'),_0x26ab14+'-'+_0x6bacbf+'/'+_0x982747)[_0xb3b8('0x33')](_0x2a0bd2);}return null;};}function patchUpdates(_0x387a6a){return function(_0x208b01){try{jsonpatch[_0xb3b8('0x34')](_0x208b01,_0x387a6a,!![]);}catch(_0x43ba36){return BPromise[_0xb3b8('0x35')](_0x43ba36);}return _0x208b01['save']();};}function saveUpdates(_0x1450ca,_0x1345f4){return function(_0x4bfa98){if(_0x4bfa98){return _0x4bfa98['update'](_0x1450ca)[_0xb3b8('0x20')](function(_0x13abea){return _0x13abea;});}return null;};}function removeEntity(_0x5b11fc,_0x1a1e54){return function(_0x5b126f){if(_0x5b126f){return _0x5b126f[_0xb3b8('0x36')]()['then'](function(){_0x5b11fc[_0xb3b8('0x2c')](0xcc)[_0xb3b8('0x2d')]();});}};}function handleEntityNotFound(_0x252d63,_0x591a39){return function(_0x17e962){if(!_0x17e962){_0x252d63[_0xb3b8('0x37')](0x194);}return _0x17e962;};}function handleError(_0x314b1f,_0x1909a9){_0x1909a9=_0x1909a9||0x1f4;return function(_0x43eace){logger[_0xb3b8('0x26')](_0x43eace[_0xb3b8('0x38')]);if(_0x43eace[_0xb3b8('0x39')]){delete _0x43eace[_0xb3b8('0x39')];}_0x314b1f[_0xb3b8('0x2c')](_0x1909a9)[_0xb3b8('0x3a')](_0x43eace);};}exports[_0xb3b8('0x3b')]=function(_0x2c5354,_0x336d4d){var _0x472fdd={},_0x36fb4b={},_0x399463={'count':0x0,'rows':[]};var _0x524d55=_[_0xb3b8('0x3c')](db[_0xb3b8('0x3d')][_0xb3b8('0x3e')],function(_0x39ed7b){return{'name':_0x39ed7b[_0xb3b8('0x3f')],'type':_0x39ed7b['type']['key']};});_0x36fb4b[_0xb3b8('0x40')]=_[_0xb3b8('0x3c')](_0x524d55,_0xb3b8('0x39'));_0x36fb4b[_0xb3b8('0x41')]=_['keys'](_0x2c5354[_0xb3b8('0x41')]);_0x36fb4b[_0xb3b8('0x42')]=_[_0xb3b8('0x43')](_0x36fb4b['model'],_0x36fb4b[_0xb3b8('0x41')]);_0x472fdd[_0xb3b8('0x44')]=_['intersection'](_0x36fb4b[_0xb3b8('0x40')],qs[_0xb3b8('0x45')](_0x2c5354[_0xb3b8('0x41')]['fields']));_0x472fdd[_0xb3b8('0x44')]=_0x472fdd['attributes'][_0xb3b8('0x46')]?_0x472fdd['attributes']:_0x36fb4b['model'];if(!_0x2c5354[_0xb3b8('0x41')][_0xb3b8('0x47')]('nolimit')){_0x472fdd[_0xb3b8('0x30')]=qs['limit'](_0x2c5354[_0xb3b8('0x41')][_0xb3b8('0x30')]);_0x472fdd['offset']=qs['offset'](_0x2c5354[_0xb3b8('0x41')][_0xb3b8('0x2f')]);}_0x472fdd[_0xb3b8('0x48')]=qs[_0xb3b8('0x49')](_0x2c5354['query'][_0xb3b8('0x49')]);_0x472fdd[_0xb3b8('0x4a')]=qs['filters'](_[_0xb3b8('0x4b')](_0x2c5354[_0xb3b8('0x41')],_0x36fb4b[_0xb3b8('0x42')]),_0x524d55);if(_0x2c5354[_0xb3b8('0x41')][_0xb3b8('0x4c')]){_0x472fdd[_0xb3b8('0x4a')]=_[_0xb3b8('0x4d')](_0x472fdd['where'],{'$or':_['map'](_0x524d55,function(_0xefbeda){if(_0xefbeda[_0xb3b8('0x4e')]!==_0xb3b8('0x4f')){var _0x557ce5={};_0x557ce5[_0xefbeda[_0xb3b8('0x39')]]={'$like':'%'+_0x2c5354['query'][_0xb3b8('0x4c')]+'%'};return _0x557ce5;}})});}_0x472fdd=_[_0xb3b8('0x4d')]({},_0x472fdd,_0x2c5354['options']);var _0x180e48={'where':_0x472fdd['where']};return db[_0xb3b8('0x3d')]['count'](_0x180e48)[_0xb3b8('0x20')](function(_0x17a4e7){_0x399463[_0xb3b8('0x2e')]=_0x17a4e7;if(_0x2c5354['query']['includeAll']){_0x472fdd[_0xb3b8('0x50')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xb3b8('0x51')](_0x472fdd);})[_0xb3b8('0x20')](function(_0x38db39){_0x399463[_0xb3b8('0x52')]=_0x38db39;return _0x399463;})[_0xb3b8('0x20')](respondWithFilteredResult(_0x336d4d,_0x472fdd))[_0xb3b8('0x2b')](handleError(_0x336d4d,null));};exports[_0xb3b8('0x53')]=function(_0xd9bcd6,_0x53bda0){var _0x524ac0={'raw':![],'where':{'id':_0xd9bcd6[_0xb3b8('0x54')]['id']}},_0x4d0a5c={};_0x4d0a5c['model']=_['keys'](db[_0xb3b8('0x3d')][_0xb3b8('0x3e')]);_0x4d0a5c[_0xb3b8('0x41')]=_[_0xb3b8('0x55')](_0xd9bcd6[_0xb3b8('0x41')]);_0x4d0a5c['filters']=_['intersection'](_0x4d0a5c[_0xb3b8('0x40')],_0x4d0a5c[_0xb3b8('0x41')]);_0x524ac0[_0xb3b8('0x44')]=_[_0xb3b8('0x43')](_0x4d0a5c[_0xb3b8('0x40')],qs['fields'](_0xd9bcd6[_0xb3b8('0x41')]['fields']));_0x524ac0[_0xb3b8('0x44')]=_0x524ac0[_0xb3b8('0x44')][_0xb3b8('0x46')]?_0x524ac0[_0xb3b8('0x44')]:_0x4d0a5c[_0xb3b8('0x40')];if(_0xd9bcd6[_0xb3b8('0x41')][_0xb3b8('0x56')]){_0x524ac0['include']=[{'all':!![]}];}_0x524ac0=_[_0xb3b8('0x4d')]({},_0x524ac0,_0xd9bcd6['options']);return db['SalesforceConfiguration']['find'](_0x524ac0)['then'](handleEntityNotFound(_0x53bda0,null))[_0xb3b8('0x20')](respondWithResult(_0x53bda0,null))[_0xb3b8('0x2b')](handleError(_0x53bda0,null));};exports[_0xb3b8('0x57')]=function(_0x3e3fae,_0x585b4f){return db['SalesforceConfiguration']['create'](_0x3e3fae[_0xb3b8('0x58')],{})[_0xb3b8('0x20')](respondWithResult(_0x585b4f,0xc9))[_0xb3b8('0x2b')](handleError(_0x585b4f,null));};exports[_0xb3b8('0x59')]=function(_0x2ba626,_0x1f57b){if(_0x2ba626[_0xb3b8('0x58')]['id']){delete _0x2ba626[_0xb3b8('0x58')]['id'];}return db[_0xb3b8('0x3d')][_0xb3b8('0x5a')]({'where':{'id':_0x2ba626[_0xb3b8('0x54')]['id']}})[_0xb3b8('0x20')](handleEntityNotFound(_0x1f57b,null))['then'](saveUpdates(_0x2ba626[_0xb3b8('0x58')],null))[_0xb3b8('0x20')](respondWithResult(_0x1f57b,null))[_0xb3b8('0x2b')](handleError(_0x1f57b,null));};exports[_0xb3b8('0x36')]=function(_0x2c6214,_0x2c5d28){return db[_0xb3b8('0x3d')][_0xb3b8('0x5a')]({'where':{'id':_0x2c6214['params']['id']}})['then'](handleEntityNotFound(_0x2c5d28,null))['then'](removeEntity(_0x2c5d28,null))[_0xb3b8('0x2b')](handleError(_0x2c5d28,null));};exports['getFields']=function(_0x546ff1,_0x17350f,_0x358b9c){var _0x5473a9={};var _0x270005={};var _0x2ea2f1;var _0x53c371;return db[_0xb3b8('0x3d')][_0xb3b8('0x5b')]({'where':{'id':_0x546ff1[_0xb3b8('0x54')]['id']}})['then'](handleEntityNotFound(_0x17350f,null))[_0xb3b8('0x20')](function(_0x5bdabc){if(_0x5bdabc){_0x2ea2f1=_0x5bdabc;_0x270005[_0xb3b8('0x40')]=_[_0xb3b8('0x55')](db[_0xb3b8('0x5c')][_0xb3b8('0x3e')]);_0x270005[_0xb3b8('0x41')]=_[_0xb3b8('0x55')](_0x546ff1[_0xb3b8('0x41')]);_0x270005[_0xb3b8('0x42')]=_['intersection'](_0x270005[_0xb3b8('0x40')],_0x270005[_0xb3b8('0x41')]);_0x5473a9['attributes']=_[_0xb3b8('0x43')](_0x270005[_0xb3b8('0x40')],qs['fields'](_0x546ff1['query']['fields']));_0x5473a9[_0xb3b8('0x44')]=_0x5473a9[_0xb3b8('0x44')][_0xb3b8('0x46')]?_0x5473a9['attributes']:_0x270005[_0xb3b8('0x40')];_0x5473a9[_0xb3b8('0x48')]=qs[_0xb3b8('0x49')](_0x546ff1[_0xb3b8('0x41')][_0xb3b8('0x49')]);_0x5473a9[_0xb3b8('0x4a')]=qs[_0xb3b8('0x42')](_[_0xb3b8('0x4b')](_0x546ff1[_0xb3b8('0x41')],_0x270005[_0xb3b8('0x42')]));if(_0x546ff1[_0xb3b8('0x41')][_0xb3b8('0x4c')]){_0x5473a9['where']=_[_0xb3b8('0x4d')](_0x5473a9[_0xb3b8('0x4a')],{'$or':_[_0xb3b8('0x3c')](_0x5473a9['attributes'],function(_0x336f65){var _0x4db2cf={};_0x4db2cf[_0x336f65]={'$like':'%'+_0x546ff1[_0xb3b8('0x41')][_0xb3b8('0x4c')]+'%'};return _0x4db2cf;})});}_0x5473a9=_[_0xb3b8('0x4d')]({},_0x5473a9,_0x546ff1['options']);return _0x2ea2f1[_0xb3b8('0x5d')](_0x5473a9);}})[_0xb3b8('0x20')](function(_0x3b6931){if(_0x3b6931){_0x53c371=_0x3b6931['length'];if(!_0x546ff1[_0xb3b8('0x41')][_0xb3b8('0x47')](_0xb3b8('0x5e'))){_0x5473a9[_0xb3b8('0x30')]=qs[_0xb3b8('0x30')](_0x546ff1[_0xb3b8('0x41')]['limit']);_0x5473a9['offset']=qs['offset'](_0x546ff1[_0xb3b8('0x41')][_0xb3b8('0x2f')]);}return _0x2ea2f1['getFields'](_0x5473a9);}})[_0xb3b8('0x20')](function(_0x2e834c){if(_0x2e834c){return _0x2e834c?{'count':_0x53c371,'rows':_0x2e834c}:null;}})[_0xb3b8('0x20')](respondWithResult(_0x17350f,null))[_0xb3b8('0x2b')](handleError(_0x17350f,null));};exports[_0xb3b8('0x5f')]=function(_0x1cf15f,_0x3d9b32,_0x54de49){var _0x5e88d7={};var _0x2d61b7={};var _0x31fba8;var _0x21406b;return db[_0xb3b8('0x3d')][_0xb3b8('0x5b')]({'where':{'id':_0x1cf15f['params']['id']}})[_0xb3b8('0x20')](handleEntityNotFound(_0x3d9b32,null))['then'](function(_0x4d86e9){if(_0x4d86e9){_0x31fba8=_0x4d86e9;_0x2d61b7['model']=_[_0xb3b8('0x55')](db[_0xb3b8('0x5c')][_0xb3b8('0x3e')]);_0x2d61b7[_0xb3b8('0x41')]=_[_0xb3b8('0x55')](_0x1cf15f[_0xb3b8('0x41')]);_0x2d61b7['filters']=_[_0xb3b8('0x43')](_0x2d61b7[_0xb3b8('0x40')],_0x2d61b7[_0xb3b8('0x41')]);_0x5e88d7[_0xb3b8('0x44')]=_[_0xb3b8('0x43')](_0x2d61b7[_0xb3b8('0x40')],qs['fields'](_0x1cf15f[_0xb3b8('0x41')][_0xb3b8('0x45')]));_0x5e88d7[_0xb3b8('0x44')]=_0x5e88d7[_0xb3b8('0x44')]['length']?_0x5e88d7[_0xb3b8('0x44')]:_0x2d61b7[_0xb3b8('0x40')];_0x5e88d7[_0xb3b8('0x48')]=qs[_0xb3b8('0x49')](_0x1cf15f[_0xb3b8('0x41')][_0xb3b8('0x49')]);_0x5e88d7[_0xb3b8('0x4a')]=qs['filters'](_['pick'](_0x1cf15f['query'],_0x2d61b7[_0xb3b8('0x42')]));if(_0x1cf15f[_0xb3b8('0x41')][_0xb3b8('0x4c')]){_0x5e88d7['where']=_['merge'](_0x5e88d7['where'],{'$or':_[_0xb3b8('0x3c')](_0x5e88d7[_0xb3b8('0x44')],function(_0x53e394){var _0x2e3974={};_0x2e3974[_0x53e394]={'$like':'%'+_0x1cf15f[_0xb3b8('0x41')][_0xb3b8('0x4c')]+'%'};return _0x2e3974;})});}_0x5e88d7=_[_0xb3b8('0x4d')]({},_0x5e88d7,_0x1cf15f[_0xb3b8('0x60')]);return _0x31fba8[_0xb3b8('0x5f')](_0x5e88d7);}})['then'](function(_0x20d5de){if(_0x20d5de){_0x21406b=_0x20d5de['length'];if(!_0x1cf15f['query'][_0xb3b8('0x47')]('nolimit')){_0x5e88d7[_0xb3b8('0x30')]=qs['limit'](_0x1cf15f['query']['limit']);_0x5e88d7[_0xb3b8('0x2f')]=qs[_0xb3b8('0x2f')](_0x1cf15f[_0xb3b8('0x41')][_0xb3b8('0x2f')]);}return _0x31fba8['getSubjects'](_0x5e88d7);}})[_0xb3b8('0x20')](function(_0x255674){if(_0x255674){return _0x255674?{'count':_0x21406b,'rows':_0x255674}:null;}})[_0xb3b8('0x20')](respondWithResult(_0x3d9b32,null))[_0xb3b8('0x2b')](handleError(_0x3d9b32,null));};exports[_0xb3b8('0x61')]=function(_0x40e54b,_0xf3c397,_0x585ea5){var _0x43bfb9={};var _0x171551={};var _0x315e04;var _0x2eb439;return db[_0xb3b8('0x3d')][_0xb3b8('0x5b')]({'where':{'id':_0x40e54b[_0xb3b8('0x54')]['id']}})[_0xb3b8('0x20')](handleEntityNotFound(_0xf3c397,null))[_0xb3b8('0x20')](function(_0x164b68){if(_0x164b68){_0x315e04=_0x164b68;_0x171551['model']=_[_0xb3b8('0x55')](db['SalesforceField']['rawAttributes']);_0x171551[_0xb3b8('0x41')]=_[_0xb3b8('0x55')](_0x40e54b[_0xb3b8('0x41')]);_0x171551['filters']=_[_0xb3b8('0x43')](_0x171551[_0xb3b8('0x40')],_0x171551[_0xb3b8('0x41')]);_0x43bfb9['attributes']=_['intersection'](_0x171551[_0xb3b8('0x40')],qs[_0xb3b8('0x45')](_0x40e54b[_0xb3b8('0x41')][_0xb3b8('0x45')]));_0x43bfb9[_0xb3b8('0x44')]=_0x43bfb9[_0xb3b8('0x44')][_0xb3b8('0x46')]?_0x43bfb9['attributes']:_0x171551[_0xb3b8('0x40')];_0x43bfb9[_0xb3b8('0x48')]=qs[_0xb3b8('0x49')](_0x40e54b[_0xb3b8('0x41')][_0xb3b8('0x49')]);_0x43bfb9['where']=qs['filters'](_[_0xb3b8('0x4b')](_0x40e54b[_0xb3b8('0x41')],_0x171551['filters']));if(_0x40e54b[_0xb3b8('0x41')]['filter']){_0x43bfb9[_0xb3b8('0x4a')]=_[_0xb3b8('0x4d')](_0x43bfb9[_0xb3b8('0x4a')],{'$or':_[_0xb3b8('0x3c')](_0x43bfb9[_0xb3b8('0x44')],function(_0x480bf4){var _0x2275ba={};_0x2275ba[_0x480bf4]={'$like':'%'+_0x40e54b[_0xb3b8('0x41')][_0xb3b8('0x4c')]+'%'};return _0x2275ba;})});}_0x43bfb9=_[_0xb3b8('0x4d')]({},_0x43bfb9,_0x40e54b['options']);return _0x315e04[_0xb3b8('0x61')](_0x43bfb9);}})[_0xb3b8('0x20')](function(_0x3b2a76){if(_0x3b2a76){_0x2eb439=_0x3b2a76[_0xb3b8('0x46')];if(!_0x40e54b[_0xb3b8('0x41')][_0xb3b8('0x47')]('nolimit')){_0x43bfb9[_0xb3b8('0x30')]=qs[_0xb3b8('0x30')](_0x40e54b[_0xb3b8('0x41')][_0xb3b8('0x30')]);_0x43bfb9[_0xb3b8('0x2f')]=qs[_0xb3b8('0x2f')](_0x40e54b[_0xb3b8('0x41')]['offset']);}return _0x315e04[_0xb3b8('0x61')](_0x43bfb9);}})[_0xb3b8('0x20')](function(_0xdff643){if(_0xdff643){return _0xdff643?{'count':_0x2eb439,'rows':_0xdff643}:null;}})['then'](respondWithResult(_0xf3c397,null))[_0xb3b8('0x2b')](handleError(_0xf3c397,null));}; \ No newline at end of file +var _0x4bf4=['debug','stringify','error','code','message','info','result','catch','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','rows','keys','create','body','find','params','destroy','findOne','SalesforceField','getFields','getSubjects','hasOwnProperty','getDescriptions','html-pdf','rimraf','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0x496a35,_0x49ce17){var _0x9157f0=function(_0x3bd7b1){while(--_0x3bd7b1){_0x496a35['push'](_0x496a35['shift']());}};_0x9157f0(++_0x49ce17);}(_0x4bf4,0xef));var _0x44bf=function(_0x220292,_0x39e38b){_0x220292=_0x220292-0x0;var _0x5534b1=_0x4bf4[_0x220292];return _0x5534b1;};'use strict';var pdf=require(_0x44bf('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x44bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44bf('0x2'));var moment=require(_0x44bf('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x44bf('0x4'));var util=require(_0x44bf('0x5'));var path=require(_0x44bf('0x6'));var sox=require(_0x44bf('0x7'));var csv=require('to-csv');var ejs=require(_0x44bf('0x8'));var fs=require('fs');var _=require(_0x44bf('0x9'));var squel=require(_0x44bf('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x44bf('0xb'));var querystring=require(_0x44bf('0xc'));var Papa=require('papaparse');var Redis=require(_0x44bf('0xd'));var authService=require(_0x44bf('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x44bf('0xf'));var hardwareService=require(_0x44bf('0x10'));var logger=require('../../config/logger')(_0x44bf('0x11'));var utils=require(_0x44bf('0x12'));var config=require(_0x44bf('0x13'));var db=require(_0x44bf('0x14'))['db'];var jayson=require(_0x44bf('0x15'));var client=jayson[_0x44bf('0x16')][_0x44bf('0x17')]({'port':0x232a});function checkPasswordPattern(_0x4fd699,_0x483903,_0x3b7d05){if(_0x3b7d05){var _0x3ee676=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3ee676[_0x44bf('0x18')](_0x483903)){return _0x4fd699;}else{throw new db[(_0x44bf('0x19'))][(_0x44bf('0x1a'))](_0x44bf('0x1b'));}}else{return _0x4fd699;}}function respondWithRpcPromise(_0x19b8da,_0x431d95,_0x2776f8,_0x10d48c){return new BPromise(function(_0x4716fd,_0x424c94){var _0x2a32a7=_0x10d48c||client;return _0x2a32a7[_0x44bf('0x1c')](_0x19b8da,_0x2776f8)[_0x44bf('0x1d')](function(_0x586dbe){logger['info'](_0x44bf('0x1e'),_0x431d95,'request\x20sent');logger[_0x44bf('0x1f')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x431d95,'request\x20sent',JSON[_0x44bf('0x20')](_0x586dbe));if(_0x586dbe[_0x44bf('0x21')]){if(_0x586dbe[_0x44bf('0x21')][_0x44bf('0x22')]===0x1f4){logger[_0x44bf('0x21')](_0x44bf('0x1e'),_0x431d95,_0x586dbe[_0x44bf('0x21')][_0x44bf('0x23')]);return _0x424c94(_0x586dbe['error'][_0x44bf('0x23')]);}logger[_0x44bf('0x21')]('SalesforceConfiguration,\x20%s,\x20%s',_0x431d95,_0x586dbe[_0x44bf('0x21')][_0x44bf('0x23')]);return _0x4716fd(_0x586dbe[_0x44bf('0x21')]['message']);}else{logger[_0x44bf('0x24')](_0x44bf('0x1e'),_0x431d95,'request\x20sent');_0x4716fd(_0x586dbe[_0x44bf('0x25')]['message']);}})[_0x44bf('0x26')](function(_0x5d3e07){logger[_0x44bf('0x21')]('SalesforceConfiguration,\x20%s,\x20%s',_0x431d95,_0x5d3e07);_0x424c94(_0x5d3e07);});});}function respondWithStatusCode(_0x493f26,_0x2df029){_0x2df029=_0x2df029||0xcc;return function(_0x2fb9dd){if(_0x2fb9dd){return _0x493f26[_0x44bf('0x27')](_0x2df029);}return _0x493f26[_0x44bf('0x28')](_0x2df029)[_0x44bf('0x29')]();};}function respondWithResult(_0x16bb99,_0x13700f){_0x13700f=_0x13700f||0xc8;return function(_0x146902){if(_0x146902){return _0x16bb99[_0x44bf('0x28')](_0x13700f)['json'](_0x146902);}};}function respondWithFilteredResult(_0x1a89f9,_0x856a30){return function(_0x1f259b){if(_0x1f259b){var _0x662376=_0x1f259b[_0x44bf('0x2a')],_0x40abdf=_0x856a30['offset'],_0x2d2b87=_0x856a30[_0x44bf('0x2b')]+_0x856a30[_0x44bf('0x2c')],_0x5a6205;if(_0x2d2b87>=_0x662376){_0x2d2b87=_0x662376;_0x5a6205=0xc8;}else{_0x5a6205=0xce;}_0x1a89f9[_0x44bf('0x28')](_0x5a6205);return _0x1a89f9[_0x44bf('0x2d')]('Content-Range',_0x40abdf+'-'+_0x2d2b87+'/'+_0x662376)[_0x44bf('0x2e')](_0x1f259b);}return null;};}function patchUpdates(_0x43645e){return function(_0x40708a){try{jsonpatch[_0x44bf('0x2f')](_0x40708a,_0x43645e,!![]);}catch(_0x52ec6e){return BPromise[_0x44bf('0x30')](_0x52ec6e);}return _0x40708a[_0x44bf('0x31')]();};}function saveUpdates(_0x2ab705,_0x2ef248){return function(_0x70f337){if(_0x70f337){return _0x70f337[_0x44bf('0x32')](_0x2ab705)[_0x44bf('0x1d')](function(_0x18daa8){return _0x18daa8;});}return null;};}function removeEntity(_0x2166c9,_0xee5a78){return function(_0x39522f){if(_0x39522f){return _0x39522f['destroy']()[_0x44bf('0x1d')](function(){_0x2166c9[_0x44bf('0x28')](0xcc)[_0x44bf('0x29')]();});}};}function handleEntityNotFound(_0x58af11,_0x302a4){return function(_0x272d05){if(!_0x272d05){_0x58af11['sendStatus'](0x194);}return _0x272d05;};}function handleError(_0x5414be,_0x1f49e9){_0x1f49e9=_0x1f49e9||0x1f4;return function(_0x5997a3){logger['error'](_0x5997a3[_0x44bf('0x33')]);if(_0x5997a3['name']){delete _0x5997a3[_0x44bf('0x34')];}_0x5414be[_0x44bf('0x28')](_0x1f49e9)[_0x44bf('0x35')](_0x5997a3);};}exports['index']=function(_0x187a2d,_0x36729){var _0x544ad3={},_0x2092f9={},_0x28ae97={'count':0x0,'rows':[]};var _0x1765b6=_[_0x44bf('0x36')](db[_0x44bf('0x37')][_0x44bf('0x38')],function(_0x47c805){return{'name':_0x47c805[_0x44bf('0x39')],'type':_0x47c805[_0x44bf('0x3a')][_0x44bf('0x3b')]};});_0x2092f9[_0x44bf('0x3c')]=_[_0x44bf('0x36')](_0x1765b6,_0x44bf('0x34'));_0x2092f9[_0x44bf('0x3d')]=_['keys'](_0x187a2d[_0x44bf('0x3d')]);_0x2092f9['filters']=_[_0x44bf('0x3e')](_0x2092f9[_0x44bf('0x3c')],_0x2092f9[_0x44bf('0x3d')]);_0x544ad3[_0x44bf('0x3f')]=_['intersection'](_0x2092f9[_0x44bf('0x3c')],qs[_0x44bf('0x40')](_0x187a2d[_0x44bf('0x3d')][_0x44bf('0x40')]));_0x544ad3[_0x44bf('0x3f')]=_0x544ad3[_0x44bf('0x3f')][_0x44bf('0x41')]?_0x544ad3[_0x44bf('0x3f')]:_0x2092f9['model'];if(!_0x187a2d[_0x44bf('0x3d')]['hasOwnProperty'](_0x44bf('0x42'))){_0x544ad3[_0x44bf('0x2c')]=qs[_0x44bf('0x2c')](_0x187a2d[_0x44bf('0x3d')][_0x44bf('0x2c')]);_0x544ad3[_0x44bf('0x2b')]=qs[_0x44bf('0x2b')](_0x187a2d['query'][_0x44bf('0x2b')]);}_0x544ad3[_0x44bf('0x43')]=qs[_0x44bf('0x44')](_0x187a2d['query'][_0x44bf('0x44')]);_0x544ad3[_0x44bf('0x45')]=qs[_0x44bf('0x46')](_[_0x44bf('0x47')](_0x187a2d[_0x44bf('0x3d')],_0x2092f9[_0x44bf('0x46')]),_0x1765b6);if(_0x187a2d[_0x44bf('0x3d')]['filter']){_0x544ad3['where']=_[_0x44bf('0x48')](_0x544ad3['where'],{'$or':_[_0x44bf('0x36')](_0x1765b6,function(_0x16e3f2){if(_0x16e3f2['type']!=='VIRTUAL'){var _0x36be0b={};_0x36be0b[_0x16e3f2[_0x44bf('0x34')]]={'$like':'%'+_0x187a2d[_0x44bf('0x3d')][_0x44bf('0x49')]+'%'};return _0x36be0b;}})});}_0x544ad3=_[_0x44bf('0x48')]({},_0x544ad3,_0x187a2d[_0x44bf('0x4a')]);var _0x5d5be9={'where':_0x544ad3[_0x44bf('0x45')]};return db[_0x44bf('0x37')][_0x44bf('0x2a')](_0x5d5be9)[_0x44bf('0x1d')](function(_0x10b6ff){_0x28ae97[_0x44bf('0x2a')]=_0x10b6ff;if(_0x187a2d['query'][_0x44bf('0x4b')]){_0x544ad3[_0x44bf('0x4c')]=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x544ad3);})[_0x44bf('0x1d')](function(_0x241ba6){_0x28ae97[_0x44bf('0x4d')]=_0x241ba6;return _0x28ae97;})[_0x44bf('0x1d')](respondWithFilteredResult(_0x36729,_0x544ad3))[_0x44bf('0x26')](handleError(_0x36729,null));};exports['show']=function(_0x3924c2,_0x2306fd){var _0x3f1109={'raw':![],'where':{'id':_0x3924c2['params']['id']}},_0x5a044d={};_0x5a044d[_0x44bf('0x3c')]=_[_0x44bf('0x4e')](db[_0x44bf('0x37')][_0x44bf('0x38')]);_0x5a044d['query']=_['keys'](_0x3924c2[_0x44bf('0x3d')]);_0x5a044d['filters']=_['intersection'](_0x5a044d[_0x44bf('0x3c')],_0x5a044d[_0x44bf('0x3d')]);_0x3f1109[_0x44bf('0x3f')]=_[_0x44bf('0x3e')](_0x5a044d[_0x44bf('0x3c')],qs[_0x44bf('0x40')](_0x3924c2[_0x44bf('0x3d')]['fields']));_0x3f1109[_0x44bf('0x3f')]=_0x3f1109[_0x44bf('0x3f')][_0x44bf('0x41')]?_0x3f1109[_0x44bf('0x3f')]:_0x5a044d[_0x44bf('0x3c')];if(_0x3924c2[_0x44bf('0x3d')][_0x44bf('0x4b')]){_0x3f1109[_0x44bf('0x4c')]=[{'all':!![]}];}_0x3f1109=_[_0x44bf('0x48')]({},_0x3f1109,_0x3924c2[_0x44bf('0x4a')]);return db['SalesforceConfiguration']['find'](_0x3f1109)[_0x44bf('0x1d')](handleEntityNotFound(_0x2306fd,null))[_0x44bf('0x1d')](respondWithResult(_0x2306fd,null))['catch'](handleError(_0x2306fd,null));};exports[_0x44bf('0x4f')]=function(_0x4515f0,_0x191d73){return db['SalesforceConfiguration']['create'](_0x4515f0[_0x44bf('0x50')],{})[_0x44bf('0x1d')](respondWithResult(_0x191d73,0xc9))[_0x44bf('0x26')](handleError(_0x191d73,null));};exports[_0x44bf('0x32')]=function(_0x3fb16b,_0x18f4d1){if(_0x3fb16b['body']['id']){delete _0x3fb16b[_0x44bf('0x50')]['id'];}return db[_0x44bf('0x37')][_0x44bf('0x51')]({'where':{'id':_0x3fb16b[_0x44bf('0x52')]['id']}})[_0x44bf('0x1d')](handleEntityNotFound(_0x18f4d1,null))[_0x44bf('0x1d')](saveUpdates(_0x3fb16b[_0x44bf('0x50')],null))['then'](respondWithResult(_0x18f4d1,null))[_0x44bf('0x26')](handleError(_0x18f4d1,null));};exports[_0x44bf('0x53')]=function(_0x2292eb,_0x383562){return db[_0x44bf('0x37')][_0x44bf('0x51')]({'where':{'id':_0x2292eb[_0x44bf('0x52')]['id']}})[_0x44bf('0x1d')](handleEntityNotFound(_0x383562,null))[_0x44bf('0x1d')](removeEntity(_0x383562,null))['catch'](handleError(_0x383562,null));};exports['getFields']=function(_0x43c862,_0x23ba25,_0x375328){var _0xedbbe2={};var _0x2110c5={};var _0x491dea;var _0x4911cf;return db[_0x44bf('0x37')][_0x44bf('0x54')]({'where':{'id':_0x43c862[_0x44bf('0x52')]['id']}})['then'](handleEntityNotFound(_0x23ba25,null))[_0x44bf('0x1d')](function(_0x3c2bdf){if(_0x3c2bdf){_0x491dea=_0x3c2bdf;_0x2110c5[_0x44bf('0x3c')]=_['keys'](db[_0x44bf('0x55')][_0x44bf('0x38')]);_0x2110c5[_0x44bf('0x3d')]=_[_0x44bf('0x4e')](_0x43c862[_0x44bf('0x3d')]);_0x2110c5[_0x44bf('0x46')]=_[_0x44bf('0x3e')](_0x2110c5[_0x44bf('0x3c')],_0x2110c5[_0x44bf('0x3d')]);_0xedbbe2['attributes']=_[_0x44bf('0x3e')](_0x2110c5[_0x44bf('0x3c')],qs[_0x44bf('0x40')](_0x43c862['query'][_0x44bf('0x40')]));_0xedbbe2['attributes']=_0xedbbe2[_0x44bf('0x3f')][_0x44bf('0x41')]?_0xedbbe2[_0x44bf('0x3f')]:_0x2110c5['model'];_0xedbbe2[_0x44bf('0x43')]=qs[_0x44bf('0x44')](_0x43c862[_0x44bf('0x3d')][_0x44bf('0x44')]);_0xedbbe2['where']=qs['filters'](_['pick'](_0x43c862[_0x44bf('0x3d')],_0x2110c5[_0x44bf('0x46')]));if(_0x43c862[_0x44bf('0x3d')][_0x44bf('0x49')]){_0xedbbe2[_0x44bf('0x45')]=_[_0x44bf('0x48')](_0xedbbe2[_0x44bf('0x45')],{'$or':_[_0x44bf('0x36')](_0xedbbe2[_0x44bf('0x3f')],function(_0x46aa40){var _0x4d0e20={};_0x4d0e20[_0x46aa40]={'$like':'%'+_0x43c862[_0x44bf('0x3d')][_0x44bf('0x49')]+'%'};return _0x4d0e20;})});}_0xedbbe2=_[_0x44bf('0x48')]({},_0xedbbe2,_0x43c862[_0x44bf('0x4a')]);return _0x491dea[_0x44bf('0x56')](_0xedbbe2);}})['then'](function(_0x26ccfa){if(_0x26ccfa){_0x4911cf=_0x26ccfa[_0x44bf('0x41')];if(!_0x43c862[_0x44bf('0x3d')]['hasOwnProperty']('nolimit')){_0xedbbe2['limit']=qs['limit'](_0x43c862[_0x44bf('0x3d')][_0x44bf('0x2c')]);_0xedbbe2[_0x44bf('0x2b')]=qs[_0x44bf('0x2b')](_0x43c862['query'][_0x44bf('0x2b')]);}return _0x491dea[_0x44bf('0x56')](_0xedbbe2);}})['then'](function(_0x1e7c0d){if(_0x1e7c0d){return _0x1e7c0d?{'count':_0x4911cf,'rows':_0x1e7c0d}:null;}})[_0x44bf('0x1d')](respondWithResult(_0x23ba25,null))['catch'](handleError(_0x23ba25,null));};exports[_0x44bf('0x57')]=function(_0x1017c0,_0x17e6ae,_0x1c75c1){var _0x20592d={};var _0x1a8dba={};var _0x5a3eb6;var _0x1820a7;return db['SalesforceConfiguration'][_0x44bf('0x54')]({'where':{'id':_0x1017c0[_0x44bf('0x52')]['id']}})[_0x44bf('0x1d')](handleEntityNotFound(_0x17e6ae,null))[_0x44bf('0x1d')](function(_0x264024){if(_0x264024){_0x5a3eb6=_0x264024;_0x1a8dba['model']=_[_0x44bf('0x4e')](db[_0x44bf('0x55')][_0x44bf('0x38')]);_0x1a8dba['query']=_['keys'](_0x1017c0[_0x44bf('0x3d')]);_0x1a8dba[_0x44bf('0x46')]=_['intersection'](_0x1a8dba['model'],_0x1a8dba[_0x44bf('0x3d')]);_0x20592d['attributes']=_[_0x44bf('0x3e')](_0x1a8dba[_0x44bf('0x3c')],qs[_0x44bf('0x40')](_0x1017c0[_0x44bf('0x3d')]['fields']));_0x20592d['attributes']=_0x20592d[_0x44bf('0x3f')]['length']?_0x20592d[_0x44bf('0x3f')]:_0x1a8dba[_0x44bf('0x3c')];_0x20592d[_0x44bf('0x43')]=qs[_0x44bf('0x44')](_0x1017c0['query']['sort']);_0x20592d[_0x44bf('0x45')]=qs[_0x44bf('0x46')](_[_0x44bf('0x47')](_0x1017c0['query'],_0x1a8dba[_0x44bf('0x46')]));if(_0x1017c0[_0x44bf('0x3d')][_0x44bf('0x49')]){_0x20592d[_0x44bf('0x45')]=_[_0x44bf('0x48')](_0x20592d['where'],{'$or':_[_0x44bf('0x36')](_0x20592d[_0x44bf('0x3f')],function(_0x465cc3){var _0x2e5fa3={};_0x2e5fa3[_0x465cc3]={'$like':'%'+_0x1017c0['query']['filter']+'%'};return _0x2e5fa3;})});}_0x20592d=_['merge']({},_0x20592d,_0x1017c0['options']);return _0x5a3eb6[_0x44bf('0x57')](_0x20592d);}})['then'](function(_0x31286a){if(_0x31286a){_0x1820a7=_0x31286a[_0x44bf('0x41')];if(!_0x1017c0[_0x44bf('0x3d')][_0x44bf('0x58')](_0x44bf('0x42'))){_0x20592d[_0x44bf('0x2c')]=qs[_0x44bf('0x2c')](_0x1017c0[_0x44bf('0x3d')]['limit']);_0x20592d[_0x44bf('0x2b')]=qs[_0x44bf('0x2b')](_0x1017c0[_0x44bf('0x3d')][_0x44bf('0x2b')]);}return _0x5a3eb6[_0x44bf('0x57')](_0x20592d);}})[_0x44bf('0x1d')](function(_0x5e15b8){if(_0x5e15b8){return _0x5e15b8?{'count':_0x1820a7,'rows':_0x5e15b8}:null;}})[_0x44bf('0x1d')](respondWithResult(_0x17e6ae,null))[_0x44bf('0x26')](handleError(_0x17e6ae,null));};exports[_0x44bf('0x59')]=function(_0x3587f0,_0x4a3a2d,_0x5cbab2){var _0x227145={};var _0xd75acc={};var _0x461241;var _0xc43601;return db[_0x44bf('0x37')][_0x44bf('0x54')]({'where':{'id':_0x3587f0[_0x44bf('0x52')]['id']}})[_0x44bf('0x1d')](handleEntityNotFound(_0x4a3a2d,null))['then'](function(_0x1537e6){if(_0x1537e6){_0x461241=_0x1537e6;_0xd75acc[_0x44bf('0x3c')]=_[_0x44bf('0x4e')](db[_0x44bf('0x55')][_0x44bf('0x38')]);_0xd75acc['query']=_[_0x44bf('0x4e')](_0x3587f0[_0x44bf('0x3d')]);_0xd75acc[_0x44bf('0x46')]=_[_0x44bf('0x3e')](_0xd75acc[_0x44bf('0x3c')],_0xd75acc[_0x44bf('0x3d')]);_0x227145[_0x44bf('0x3f')]=_[_0x44bf('0x3e')](_0xd75acc[_0x44bf('0x3c')],qs['fields'](_0x3587f0['query'][_0x44bf('0x40')]));_0x227145[_0x44bf('0x3f')]=_0x227145[_0x44bf('0x3f')][_0x44bf('0x41')]?_0x227145['attributes']:_0xd75acc['model'];_0x227145[_0x44bf('0x43')]=qs[_0x44bf('0x44')](_0x3587f0[_0x44bf('0x3d')][_0x44bf('0x44')]);_0x227145[_0x44bf('0x45')]=qs[_0x44bf('0x46')](_[_0x44bf('0x47')](_0x3587f0[_0x44bf('0x3d')],_0xd75acc[_0x44bf('0x46')]));if(_0x3587f0[_0x44bf('0x3d')]['filter']){_0x227145['where']=_[_0x44bf('0x48')](_0x227145['where'],{'$or':_[_0x44bf('0x36')](_0x227145[_0x44bf('0x3f')],function(_0x15593a){var _0x3e6f2c={};_0x3e6f2c[_0x15593a]={'$like':'%'+_0x3587f0[_0x44bf('0x3d')][_0x44bf('0x49')]+'%'};return _0x3e6f2c;})});}_0x227145=_[_0x44bf('0x48')]({},_0x227145,_0x3587f0[_0x44bf('0x4a')]);return _0x461241[_0x44bf('0x59')](_0x227145);}})[_0x44bf('0x1d')](function(_0x39e4d0){if(_0x39e4d0){_0xc43601=_0x39e4d0[_0x44bf('0x41')];if(!_0x3587f0['query'][_0x44bf('0x58')](_0x44bf('0x42'))){_0x227145['limit']=qs[_0x44bf('0x2c')](_0x3587f0[_0x44bf('0x3d')][_0x44bf('0x2c')]);_0x227145[_0x44bf('0x2b')]=qs[_0x44bf('0x2b')](_0x3587f0[_0x44bf('0x3d')][_0x44bf('0x2b')]);}return _0x461241[_0x44bf('0x59')](_0x227145);}})[_0x44bf('0x1d')](function(_0x22f391){if(_0x22f391){return _0x22f391?{'count':_0xc43601,'rows':_0x22f391}:null;}})['then'](respondWithResult(_0x4a3a2d,null))['catch'](handleError(_0x4a3a2d,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index b4bbf93..76a73ea 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 _0x3cc5=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','SalesforceConfiguration','int_salesforce_configurations','lodash'];(function(_0x505b35,_0x97cdbc){var _0x5ab758=function(_0x571d9e){while(--_0x571d9e){_0x505b35['push'](_0x505b35['shift']());}};_0x5ab758(++_0x97cdbc);}(_0x3cc5,0x1ac));var _0x53cc=function(_0x2bbadf,_0x494f8e){_0x2bbadf=_0x2bbadf-0x0;var _0xddd552=_0x3cc5[_0x2bbadf];return _0xddd552;};'use strict';var _=require(_0x53cc('0x0'));var util=require(_0x53cc('0x1'));var logger=require(_0x53cc('0x2'))(_0x53cc('0x3'));var moment=require('moment');var BPromise=require(_0x53cc('0x4'));var rp=require(_0x53cc('0x5'));var fs=require('fs');var path=require(_0x53cc('0x6'));var rimraf=require(_0x53cc('0x7'));var config=require(_0x53cc('0x8'));var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x49772a,_0x1c93c1){return _0x49772a['define'](_0x53cc('0x9'),attributes,{'tableName':_0x53cc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3285=['../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x302a64,_0x191bf6){var _0xc4c71e=function(_0xe03a6d){while(--_0xe03a6d){_0x302a64['push'](_0x302a64['shift']());}};_0xc4c71e(++_0x191bf6);}(_0x3285,0x1b3));var _0x5328=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x3285[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x5328('0x0'));var util=require(_0x5328('0x1'));var logger=require('../../config/logger')(_0x5328('0x2'));var moment=require(_0x5328('0x3'));var BPromise=require(_0x5328('0x4'));var rp=require(_0x5328('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5328('0x6'));var config=require(_0x5328('0x7'));var attributes=require(_0x5328('0x8'));module[_0x5328('0x9')]=function(_0x59425b,_0x318b2d){return _0x59425b[_0x5328('0xa')](_0x5328('0xb'),attributes,{'tableName':_0x5328('0xc'),'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 f997a2a..fc7d056 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 _0xa7d3=['debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x1a8b7e,_0x57846c){var _0x301179=function(_0x2a4f24){while(--_0x2a4f24){_0x1a8b7e['push'](_0x1a8b7e['shift']());}};_0x301179(++_0x57846c);}(_0xa7d3,0x110));var _0x3a7d=function(_0x2c25b9,_0x2b9db8){_0x2c25b9=_0x2c25b9-0x0;var _0x2e7005=_0xa7d3[_0x2c25b9];return _0x2e7005;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3a7d('0x0'));var BPromise=require(_0x3a7d('0x1'));var rs=require(_0x3a7d('0x2'));var fs=require('fs');var Redis=require(_0x3a7d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3a7d('0x4'));var logger=require(_0x3a7d('0x5'))(_0x3a7d('0x6'));var config=require(_0x3a7d('0x7'));var jayson=require(_0x3a7d('0x8'));var client=jayson[_0x3a7d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x330a66,_0x179555,_0x5771bf){return new BPromise(function(_0x5d55a2,_0x19fae2){return client[_0x3a7d('0xa')](_0x330a66,_0x5771bf)['then'](function(_0x4f1da9){logger[_0x3a7d('0xb')](_0x3a7d('0xc'),_0x179555,_0x3a7d('0xd'));logger[_0x3a7d('0xe')](_0x3a7d('0xf'),_0x179555,'request\x20sent',JSON[_0x3a7d('0x10')](_0x4f1da9));if(_0x4f1da9['error']){if(_0x4f1da9[_0x3a7d('0x11')][_0x3a7d('0x12')]===0x1f4){logger['error'](_0x3a7d('0xc'),_0x179555,_0x4f1da9['error'][_0x3a7d('0x13')]);return _0x19fae2(_0x4f1da9[_0x3a7d('0x11')]['message']);}logger[_0x3a7d('0x11')](_0x3a7d('0xc'),_0x179555,_0x4f1da9[_0x3a7d('0x11')][_0x3a7d('0x13')]);return _0x5d55a2(_0x4f1da9['error'][_0x3a7d('0x13')]);}else{logger[_0x3a7d('0xb')](_0x3a7d('0xc'),_0x179555,_0x3a7d('0xd'));_0x5d55a2(_0x4f1da9[_0x3a7d('0x14')][_0x3a7d('0x13')]);}})[_0x3a7d('0x15')](function(_0x3150bd){logger[_0x3a7d('0x11')](_0x3a7d('0xc'),_0x179555,_0x3150bd);_0x19fae2(_0x3150bd);});});} \ No newline at end of file +var _0x07ee=['info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceConfiguration,\x20%s,\x20%s','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x4985c5,_0x307430){var _0x7f112a=function(_0x5b47aa){while(--_0x5b47aa){_0x4985c5['push'](_0x4985c5['shift']());}};_0x7f112a(++_0x307430);}(_0x07ee,0x198));var _0xe07e=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x07ee[_0x2555d0];return _0x3bb486;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe07e('0x0'));var BPromise=require(_0xe07e('0x1'));var rs=require(_0xe07e('0x2'));var fs=require('fs');var Redis=require(_0xe07e('0x3'));var db=require(_0xe07e('0x4'))['db'];var utils=require(_0xe07e('0x5'));var logger=require(_0xe07e('0x6'))(_0xe07e('0x7'));var config=require(_0xe07e('0x8'));var jayson=require(_0xe07e('0x9'));var client=jayson[_0xe07e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18e256,_0x3bc3ee,_0x41bcdf){return new BPromise(function(_0x2d8775,_0x5c4d05){return client['request'](_0x18e256,_0x41bcdf)[_0xe07e('0xb')](function(_0x582da4){logger[_0xe07e('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3bc3ee,_0xe07e('0xd'));logger[_0xe07e('0xe')](_0xe07e('0xf'),_0x3bc3ee,_0xe07e('0xd'),JSON[_0xe07e('0x10')](_0x582da4));if(_0x582da4['error']){if(_0x582da4['error']['code']===0x1f4){logger[_0xe07e('0x11')](_0xe07e('0x12'),_0x3bc3ee,_0x582da4['error'][_0xe07e('0x13')]);return _0x5c4d05(_0x582da4[_0xe07e('0x11')][_0xe07e('0x13')]);}logger['error'](_0xe07e('0x12'),_0x3bc3ee,_0x582da4['error'][_0xe07e('0x13')]);return _0x2d8775(_0x582da4['error'][_0xe07e('0x13')]);}else{logger['info'](_0xe07e('0x12'),_0x3bc3ee,_0xe07e('0xd'));_0x2d8775(_0x582da4['result'][_0xe07e('0x13')]);}})[_0xe07e('0x14')](function(_0xcf752b){logger[_0xe07e('0x11')](_0xe07e('0x12'),_0x3bc3ee,_0xcf752b);_0x5c4d05(_0xcf752b);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index b31021b..e092396 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 _0xabce=['post','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','index','/:id','show'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xabce,0x103));var _0xeabc=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xabce[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xeabc('0x5'));var config=require(_0xeabc('0x6'));var controller=require(_0xeabc('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xeabc('0x8')]);router['get'](_0xeabc('0x9'),auth['isAuthenticated'](),controller[_0xeabc('0xa')]);router[_0xeabc('0xb')]('/',auth[_0xeabc('0xc')](),controller['create']);router[_0xeabc('0xd')](_0xeabc('0x9'),auth[_0xeabc('0xc')](),controller[_0xeabc('0xe')]);router[_0xeabc('0xf')](_0xeabc('0x9'),auth[_0xeabc('0xc')](),controller[_0xeabc('0x10')]);module[_0xeabc('0x11')]=router; \ No newline at end of file +var _0x81c6=['index','/:id','create','put','update','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated'];(function(_0xf34109,_0x380779){var _0x570bfc=function(_0x1ad086){while(--_0x1ad086){_0xf34109['push'](_0xf34109['shift']());}};_0x570bfc(++_0x380779);}(_0x81c6,0x1d5));var _0x681c=function(_0x46399a,_0x108f44){_0x46399a=_0x46399a-0x0;var _0x3f97ca=_0x81c6[_0x46399a];return _0x3f97ca;};'use strict';var multer=require('multer');var util=require(_0x681c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x681c('0x1')]();var auth=require(_0x681c('0x2'));var interaction=require(_0x681c('0x3'));var config=require('../../config/environment');var controller=require(_0x681c('0x4'));router[_0x681c('0x5')]('/',auth[_0x681c('0x6')](),controller[_0x681c('0x7')]);router['get'](_0x681c('0x8'),auth[_0x681c('0x6')](),controller['show']);router['post']('/',auth[_0x681c('0x6')](),controller[_0x681c('0x9')]);router[_0x681c('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x681c('0xb')]);router['delete'](_0x681c('0x8'),auth[_0x681c('0x6')](),controller[_0x681c('0xc')]);module[_0x681c('0xd')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index be4a13c..4c28241 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 _0x7c05=['variable','sequelize','exports','string','customVariable','STRING','ENUM'];(function(_0x2dc052,_0x52c7e7){var _0x5ac864=function(_0x59acd3){while(--_0x59acd3){_0x2dc052['push'](_0x2dc052['shift']());}};_0x5ac864(++_0x52c7e7);}(_0x7c05,0xfd));var _0x57c0=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0x7c05[_0x1bc013];return _0x55df36;};'use strict';var Sequelize=require(_0x57c0('0x0'));module[_0x57c0('0x1')]={'type':{'type':Sequelize['ENUM'](_0x57c0('0x2'),'variable',_0x57c0('0x3'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0x57c0('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x57c0('0x5')](_0x57c0('0x2'),_0x57c0('0x6'),_0x57c0('0x3'))},'keyContent':{'type':Sequelize[_0x57c0('0x4')]},'idField':{'type':Sequelize[_0x57c0('0x4')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x140a=['variable','customVariable','keyValue','STRING','sequelize','exports','ENUM','string'];(function(_0x33911e,_0x538136){var _0x20e249=function(_0x503b1b){while(--_0x503b1b){_0x33911e['push'](_0x33911e['shift']());}};_0x20e249(++_0x538136);}(_0x140a,0x1f4));var _0xa140=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x140a[_0x166742];return _0xb7814a;};'use strict';var Sequelize=require(_0xa140('0x0'));module[_0xa140('0x1')]={'type':{'type':Sequelize[_0xa140('0x2')](_0xa140('0x3'),_0xa140('0x4'),_0xa140('0x5'),_0xa140('0x6')),'defaultValue':_0xa140('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa140('0x2')](_0xa140('0x3'),'variable',_0xa140('0x5'))},'keyContent':{'type':Sequelize[_0xa140('0x7')]},'idField':{'type':Sequelize[_0xa140('0x7')]},'variableName':{'type':Sequelize[_0xa140('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 9cdd83e..8a6f1ed 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 _0x710d=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','Content-Range','json','apply','reject','save','then','destroy','end','error','stack','name','send','map','SalesforceField','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','update','params','html-pdf','eml-format','zip-dir','request-promise','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x710d,0x1ab));var _0xd710=function(_0x10291b,_0x518773){_0x10291b=_0x10291b-0x0;var _0x1d5fbe=_0x710d[_0x10291b];return _0x1d5fbe;};'use strict';var pdf=require(_0xd710('0x0'));var emlformat=require(_0xd710('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd710('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd710('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd710('0x4'));var util=require('util');var path=require(_0xd710('0x5'));var sox=require(_0xd710('0x6'));var csv=require('to-csv');var ejs=require(_0xd710('0x7'));var fs=require('fs');var _=require(_0xd710('0x8'));var squel=require(_0xd710('0x9'));var crypto=require('crypto');var jsforce=require(_0xd710('0xa'));var deskjs=require(_0xd710('0xb'));var toCsv=require(_0xd710('0xc'));var querystring=require(_0xd710('0xd'));var Papa=require(_0xd710('0xe'));var Redis=require(_0xd710('0xf'));var authService=require(_0xd710('0x10'));var qs=require(_0xd710('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd710('0x12'));var logger=require(_0xd710('0x13'))(_0xd710('0x14'));var utils=require(_0xd710('0x15'));var config=require(_0xd710('0x16'));var db=require(_0xd710('0x17'))['db'];function respondWithStatusCode(_0x347ae7,_0x1aff56){_0x1aff56=_0x1aff56||0xcc;return function(_0x45c75e){if(_0x45c75e){return _0x347ae7[_0xd710('0x18')](_0x1aff56);}return _0x347ae7[_0xd710('0x19')](_0x1aff56)['end']();};}function respondWithResult(_0x3c3d86,_0x5a9784){_0x5a9784=_0x5a9784||0xc8;return function(_0x205da8){if(_0x205da8){return _0x3c3d86[_0xd710('0x19')](_0x5a9784)['json'](_0x205da8);}};}function respondWithFilteredResult(_0x1b66dd,_0x5690e2){return function(_0x65171a){if(_0x65171a){var _0x1489c8=_0x65171a[_0xd710('0x1a')],_0x538457=_0x5690e2['offset'],_0x4b7dc6=_0x5690e2[_0xd710('0x1b')]+_0x5690e2['limit'],_0x418700;if(_0x4b7dc6>=_0x1489c8){_0x4b7dc6=_0x1489c8;_0x418700=0xc8;}else{_0x418700=0xce;}_0x1b66dd[_0xd710('0x19')](_0x418700);return _0x1b66dd['set'](_0xd710('0x1c'),_0x538457+'-'+_0x4b7dc6+'/'+_0x1489c8)[_0xd710('0x1d')](_0x65171a);}return null;};}function patchUpdates(_0x5a3724){return function(_0x55dac9){try{jsonpatch[_0xd710('0x1e')](_0x55dac9,_0x5a3724,!![]);}catch(_0x542a30){return BPromise[_0xd710('0x1f')](_0x542a30);}return _0x55dac9[_0xd710('0x20')]();};}function saveUpdates(_0x5b645f,_0x4b4344){return function(_0x385355){if(_0x385355){return _0x385355['update'](_0x5b645f)[_0xd710('0x21')](function(_0x3ae172){return _0x3ae172;});}return null;};}function removeEntity(_0x4a2eb1,_0x1cf63f){return function(_0x311f8c){if(_0x311f8c){return _0x311f8c[_0xd710('0x22')]()[_0xd710('0x21')](function(){_0x4a2eb1[_0xd710('0x19')](0xcc)[_0xd710('0x23')]();});}};}function handleEntityNotFound(_0x56cfb4,_0x296a6d){return function(_0x28706c){if(!_0x28706c){_0x56cfb4[_0xd710('0x18')](0x194);}return _0x28706c;};}function handleError(_0x426201,_0xd4aa29){_0xd4aa29=_0xd4aa29||0x1f4;return function(_0x275ba0){logger[_0xd710('0x24')](_0x275ba0[_0xd710('0x25')]);if(_0x275ba0[_0xd710('0x26')]){delete _0x275ba0['name'];}_0x426201[_0xd710('0x19')](_0xd4aa29)[_0xd710('0x27')](_0x275ba0);};}exports['index']=function(_0x3c9886,_0x3bebe0){var _0x2954eb={},_0x25e2e2={},_0x24bdde={'count':0x0,'rows':[]};var _0x2f50f0=_[_0xd710('0x28')](db[_0xd710('0x29')]['rawAttributes'],function(_0x3d8d10){return{'name':_0x3d8d10[_0xd710('0x2a')],'type':_0x3d8d10['type'][_0xd710('0x2b')]};});_0x25e2e2[_0xd710('0x2c')]=_[_0xd710('0x28')](_0x2f50f0,_0xd710('0x26'));_0x25e2e2[_0xd710('0x2d')]=_[_0xd710('0x2e')](_0x3c9886['query']);_0x25e2e2[_0xd710('0x2f')]=_[_0xd710('0x30')](_0x25e2e2[_0xd710('0x2c')],_0x25e2e2[_0xd710('0x2d')]);_0x2954eb[_0xd710('0x31')]=_[_0xd710('0x30')](_0x25e2e2['model'],qs[_0xd710('0x32')](_0x3c9886[_0xd710('0x2d')][_0xd710('0x32')]));_0x2954eb['attributes']=_0x2954eb[_0xd710('0x31')][_0xd710('0x33')]?_0x2954eb[_0xd710('0x31')]:_0x25e2e2[_0xd710('0x2c')];if(!_0x3c9886['query']['hasOwnProperty'](_0xd710('0x34'))){_0x2954eb[_0xd710('0x35')]=qs[_0xd710('0x35')](_0x3c9886[_0xd710('0x2d')][_0xd710('0x35')]);_0x2954eb[_0xd710('0x1b')]=qs[_0xd710('0x1b')](_0x3c9886[_0xd710('0x2d')]['offset']);}_0x2954eb[_0xd710('0x36')]=qs[_0xd710('0x37')](_0x3c9886[_0xd710('0x2d')][_0xd710('0x37')]);_0x2954eb[_0xd710('0x38')]=qs[_0xd710('0x2f')](_[_0xd710('0x39')](_0x3c9886[_0xd710('0x2d')],_0x25e2e2[_0xd710('0x2f')]),_0x2f50f0);if(_0x3c9886['query'][_0xd710('0x3a')]){_0x2954eb['where']=_[_0xd710('0x3b')](_0x2954eb['where'],{'$or':_[_0xd710('0x28')](_0x2f50f0,function(_0xeb872c){if(_0xeb872c['type']!==_0xd710('0x3c')){var _0x2c7812={};_0x2c7812[_0xeb872c[_0xd710('0x26')]]={'$like':'%'+_0x3c9886[_0xd710('0x2d')][_0xd710('0x3a')]+'%'};return _0x2c7812;}})});}_0x2954eb=_[_0xd710('0x3b')]({},_0x2954eb,_0x3c9886[_0xd710('0x3d')]);var _0x2cd586={'where':_0x2954eb[_0xd710('0x38')]};return db[_0xd710('0x29')][_0xd710('0x1a')](_0x2cd586)['then'](function(_0x1c0e05){_0x24bdde[_0xd710('0x1a')]=_0x1c0e05;if(_0x3c9886['query'][_0xd710('0x3e')]){_0x2954eb[_0xd710('0x3f')]=[{'all':!![]}];}return db[_0xd710('0x29')][_0xd710('0x40')](_0x2954eb);})[_0xd710('0x21')](function(_0x14f458){_0x24bdde[_0xd710('0x41')]=_0x14f458;return _0x24bdde;})['then'](respondWithFilteredResult(_0x3bebe0,_0x2954eb))[_0xd710('0x42')](handleError(_0x3bebe0,null));};exports[_0xd710('0x43')]=function(_0x55a171,_0x1668ee){var _0x50b14b={'raw':!![],'where':{'id':_0x55a171['params']['id']}},_0x3d822a={};_0x3d822a['model']=_[_0xd710('0x2e')](db[_0xd710('0x29')][_0xd710('0x44')]);_0x3d822a[_0xd710('0x2d')]=_[_0xd710('0x2e')](_0x55a171[_0xd710('0x2d')]);_0x3d822a[_0xd710('0x2f')]=_['intersection'](_0x3d822a['model'],_0x3d822a[_0xd710('0x2d')]);_0x50b14b[_0xd710('0x31')]=_['intersection'](_0x3d822a[_0xd710('0x2c')],qs[_0xd710('0x32')](_0x55a171[_0xd710('0x2d')]['fields']));_0x50b14b[_0xd710('0x31')]=_0x50b14b['attributes'][_0xd710('0x33')]?_0x50b14b[_0xd710('0x31')]:_0x3d822a[_0xd710('0x2c')];if(_0x55a171[_0xd710('0x2d')]['includeAll']){_0x50b14b[_0xd710('0x3f')]=[{'all':!![]}];}_0x50b14b=_[_0xd710('0x3b')]({},_0x50b14b,_0x55a171[_0xd710('0x3d')]);return db[_0xd710('0x29')][_0xd710('0x45')](_0x50b14b)[_0xd710('0x21')](handleEntityNotFound(_0x1668ee,null))[_0xd710('0x21')](respondWithResult(_0x1668ee,null))[_0xd710('0x42')](handleError(_0x1668ee,null));};exports[_0xd710('0x46')]=function(_0xa9e7aa,_0x4e80eb){return db['SalesforceField']['create'](_0xa9e7aa[_0xd710('0x47')],{})['then'](respondWithResult(_0x4e80eb,0xc9))[_0xd710('0x42')](handleError(_0x4e80eb,null));};exports[_0xd710('0x48')]=function(_0x182527,_0x58182f){if(_0x182527[_0xd710('0x47')]['id']){delete _0x182527[_0xd710('0x47')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x182527[_0xd710('0x49')]['id']}})[_0xd710('0x21')](handleEntityNotFound(_0x58182f,null))['then'](saveUpdates(_0x182527[_0xd710('0x47')],null))['then'](respondWithResult(_0x58182f,null))[_0xd710('0x42')](handleError(_0x58182f,null));};exports['destroy']=function(_0x40d16b,_0x403131){return db[_0xd710('0x29')][_0xd710('0x45')]({'where':{'id':_0x40d16b[_0xd710('0x49')]['id']}})[_0xd710('0x21')](handleEntityNotFound(_0x403131,null))[_0xd710('0x21')](removeEntity(_0x403131,null))['catch'](handleError(_0x403131,null));}; \ No newline at end of file +var _0xdebb=['json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','index','SalesforceField','rawAttributes','fieldName','type','key','map','keys','filters','intersection','query','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','show','params','includeAll','options','find','create','body','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xdebb,0x14f));var _0xbdeb=function(_0x3c80e8,_0x2bb4ff){_0x3c80e8=_0x3c80e8-0x0;var _0xe57191=_0xdebb[_0x3c80e8];return _0xe57191;};'use strict';var pdf=require(_0xbdeb('0x0'));var emlformat=require(_0xbdeb('0x1'));var rimraf=require(_0xbdeb('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbdeb('0x3'));var rp=require(_0xbdeb('0x4'));var moment=require(_0xbdeb('0x5'));var BPromise=require(_0xbdeb('0x6'));var Mustache=require(_0xbdeb('0x7'));var util=require(_0xbdeb('0x8'));var path=require(_0xbdeb('0x9'));var sox=require(_0xbdeb('0xa'));var csv=require(_0xbdeb('0xb'));var ejs=require(_0xbdeb('0xc'));var fs=require('fs');var _=require(_0xbdeb('0xd'));var squel=require(_0xbdeb('0xe'));var crypto=require('crypto');var jsforce=require(_0xbdeb('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbdeb('0x10'));var Redis=require(_0xbdeb('0x11'));var authService=require(_0xbdeb('0x12'));var qs=require(_0xbdeb('0x13'));var as=require(_0xbdeb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xbdeb('0x15'));var db=require(_0xbdeb('0x16'))['db'];function respondWithStatusCode(_0x3ba532,_0x56ab3e){_0x56ab3e=_0x56ab3e||0xcc;return function(_0x2f0d65){if(_0x2f0d65){return _0x3ba532[_0xbdeb('0x17')](_0x56ab3e);}return _0x3ba532['status'](_0x56ab3e)['end']();};}function respondWithResult(_0x575fb2,_0x5c2d59){_0x5c2d59=_0x5c2d59||0xc8;return function(_0x31d4be){if(_0x31d4be){return _0x575fb2[_0xbdeb('0x18')](_0x5c2d59)[_0xbdeb('0x19')](_0x31d4be);}};}function respondWithFilteredResult(_0x48ec95,_0x4e45ce){return function(_0xd55b26){if(_0xd55b26){var _0x173c3c=_0xd55b26['count'],_0x352724=_0x4e45ce[_0xbdeb('0x1a')],_0x4fc420=_0x4e45ce[_0xbdeb('0x1a')]+_0x4e45ce[_0xbdeb('0x1b')],_0x176cc1;if(_0x4fc420>=_0x173c3c){_0x4fc420=_0x173c3c;_0x176cc1=0xc8;}else{_0x176cc1=0xce;}_0x48ec95[_0xbdeb('0x18')](_0x176cc1);return _0x48ec95[_0xbdeb('0x1c')](_0xbdeb('0x1d'),_0x352724+'-'+_0x4fc420+'/'+_0x173c3c)[_0xbdeb('0x19')](_0xd55b26);}return null;};}function patchUpdates(_0x9ce239){return function(_0x12d5dd){try{jsonpatch[_0xbdeb('0x1e')](_0x12d5dd,_0x9ce239,!![]);}catch(_0x3b485f){return BPromise[_0xbdeb('0x1f')](_0x3b485f);}return _0x12d5dd[_0xbdeb('0x20')]();};}function saveUpdates(_0x5dbf96,_0x207da6){return function(_0x38fc11){if(_0x38fc11){return _0x38fc11[_0xbdeb('0x21')](_0x5dbf96)[_0xbdeb('0x22')](function(_0x431263){return _0x431263;});}return null;};}function removeEntity(_0x3f1e79,_0x57a2e7){return function(_0x26eafa){if(_0x26eafa){return _0x26eafa['destroy']()[_0xbdeb('0x22')](function(){_0x3f1e79['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bc444,_0x40a3d5){return function(_0x2ccb8b){if(!_0x2ccb8b){_0x2bc444[_0xbdeb('0x17')](0x194);}return _0x2ccb8b;};}function handleError(_0x2f3203,_0x3e93bb){_0x3e93bb=_0x3e93bb||0x1f4;return function(_0x7ddce5){logger[_0xbdeb('0x23')](_0x7ddce5['stack']);if(_0x7ddce5[_0xbdeb('0x24')]){delete _0x7ddce5[_0xbdeb('0x24')];}_0x2f3203[_0xbdeb('0x18')](_0x3e93bb)['send'](_0x7ddce5);};}exports[_0xbdeb('0x25')]=function(_0x3a64ba,_0x5ba809){var _0x46e433={},_0x46290b={},_0x5f1250={'count':0x0,'rows':[]};var _0x75ca1=_['map'](db[_0xbdeb('0x26')][_0xbdeb('0x27')],function(_0x3efeb8){return{'name':_0x3efeb8[_0xbdeb('0x28')],'type':_0x3efeb8[_0xbdeb('0x29')][_0xbdeb('0x2a')]};});_0x46290b['model']=_[_0xbdeb('0x2b')](_0x75ca1,'name');_0x46290b['query']=_[_0xbdeb('0x2c')](_0x3a64ba['query']);_0x46290b[_0xbdeb('0x2d')]=_[_0xbdeb('0x2e')](_0x46290b['model'],_0x46290b[_0xbdeb('0x2f')]);_0x46e433[_0xbdeb('0x30')]=_[_0xbdeb('0x2e')](_0x46290b['model'],qs[_0xbdeb('0x31')](_0x3a64ba[_0xbdeb('0x2f')][_0xbdeb('0x31')]));_0x46e433['attributes']=_0x46e433[_0xbdeb('0x30')][_0xbdeb('0x32')]?_0x46e433[_0xbdeb('0x30')]:_0x46290b[_0xbdeb('0x33')];if(!_0x3a64ba[_0xbdeb('0x2f')][_0xbdeb('0x34')](_0xbdeb('0x35'))){_0x46e433[_0xbdeb('0x1b')]=qs[_0xbdeb('0x1b')](_0x3a64ba[_0xbdeb('0x2f')][_0xbdeb('0x1b')]);_0x46e433['offset']=qs[_0xbdeb('0x1a')](_0x3a64ba[_0xbdeb('0x2f')][_0xbdeb('0x1a')]);}_0x46e433[_0xbdeb('0x36')]=qs[_0xbdeb('0x37')](_0x3a64ba[_0xbdeb('0x2f')][_0xbdeb('0x37')]);_0x46e433[_0xbdeb('0x38')]=qs[_0xbdeb('0x2d')](_[_0xbdeb('0x39')](_0x3a64ba[_0xbdeb('0x2f')],_0x46290b[_0xbdeb('0x2d')]),_0x75ca1);if(_0x3a64ba[_0xbdeb('0x2f')]['filter']){_0x46e433['where']=_[_0xbdeb('0x3a')](_0x46e433[_0xbdeb('0x38')],{'$or':_['map'](_0x75ca1,function(_0x428d9d){if(_0x428d9d[_0xbdeb('0x29')]!==_0xbdeb('0x3b')){var _0x5aa950={};_0x5aa950[_0x428d9d['name']]={'$like':'%'+_0x3a64ba[_0xbdeb('0x2f')][_0xbdeb('0x3c')]+'%'};return _0x5aa950;}})});}_0x46e433=_[_0xbdeb('0x3a')]({},_0x46e433,_0x3a64ba['options']);var _0xa44aee={'where':_0x46e433['where']};return db[_0xbdeb('0x26')]['count'](_0xa44aee)[_0xbdeb('0x22')](function(_0x279d5){_0x5f1250['count']=_0x279d5;if(_0x3a64ba[_0xbdeb('0x2f')]['includeAll']){_0x46e433[_0xbdeb('0x3d')]=[{'all':!![]}];}return db[_0xbdeb('0x26')][_0xbdeb('0x3e')](_0x46e433);})['then'](function(_0xe11003){_0x5f1250[_0xbdeb('0x3f')]=_0xe11003;return _0x5f1250;})[_0xbdeb('0x22')](respondWithFilteredResult(_0x5ba809,_0x46e433))['catch'](handleError(_0x5ba809,null));};exports[_0xbdeb('0x40')]=function(_0x1935b8,_0x4a3807){var _0x3c0719={'raw':!![],'where':{'id':_0x1935b8[_0xbdeb('0x41')]['id']}},_0x4aed62={};_0x4aed62[_0xbdeb('0x33')]=_[_0xbdeb('0x2c')](db['SalesforceField'][_0xbdeb('0x27')]);_0x4aed62['query']=_['keys'](_0x1935b8[_0xbdeb('0x2f')]);_0x4aed62['filters']=_['intersection'](_0x4aed62[_0xbdeb('0x33')],_0x4aed62[_0xbdeb('0x2f')]);_0x3c0719[_0xbdeb('0x30')]=_[_0xbdeb('0x2e')](_0x4aed62[_0xbdeb('0x33')],qs[_0xbdeb('0x31')](_0x1935b8[_0xbdeb('0x2f')][_0xbdeb('0x31')]));_0x3c0719[_0xbdeb('0x30')]=_0x3c0719['attributes']['length']?_0x3c0719[_0xbdeb('0x30')]:_0x4aed62[_0xbdeb('0x33')];if(_0x1935b8[_0xbdeb('0x2f')][_0xbdeb('0x42')]){_0x3c0719['include']=[{'all':!![]}];}_0x3c0719=_[_0xbdeb('0x3a')]({},_0x3c0719,_0x1935b8[_0xbdeb('0x43')]);return db[_0xbdeb('0x26')][_0xbdeb('0x44')](_0x3c0719)[_0xbdeb('0x22')](handleEntityNotFound(_0x4a3807,null))[_0xbdeb('0x22')](respondWithResult(_0x4a3807,null))['catch'](handleError(_0x4a3807,null));};exports['create']=function(_0x43108f,_0x10e11f){return db[_0xbdeb('0x26')][_0xbdeb('0x45')](_0x43108f[_0xbdeb('0x46')],{})['then'](respondWithResult(_0x10e11f,0xc9))[_0xbdeb('0x47')](handleError(_0x10e11f,null));};exports[_0xbdeb('0x21')]=function(_0x431b18,_0x1b5dd7){if(_0x431b18[_0xbdeb('0x46')]['id']){delete _0x431b18['body']['id'];}return db[_0xbdeb('0x26')][_0xbdeb('0x44')]({'where':{'id':_0x431b18[_0xbdeb('0x41')]['id']}})[_0xbdeb('0x22')](handleEntityNotFound(_0x1b5dd7,null))['then'](saveUpdates(_0x431b18[_0xbdeb('0x46')],null))[_0xbdeb('0x22')](respondWithResult(_0x1b5dd7,null))['catch'](handleError(_0x1b5dd7,null));};exports['destroy']=function(_0x292c54,_0x4ac8c0){return db[_0xbdeb('0x26')]['find']({'where':{'id':_0x292c54[_0xbdeb('0x41')]['id']}})[_0xbdeb('0x22')](handleEntityNotFound(_0x4ac8c0,null))[_0xbdeb('0x22')](removeEntity(_0x4ac8c0,null))[_0xbdeb('0x47')](handleError(_0x4ac8c0,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 5b5218e..f30dc65 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 _0xdfd4=['exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1755ab,_0x13e017){var _0x4cd6b9=function(_0xd8eee7){while(--_0xd8eee7){_0x1755ab['push'](_0x1755ab['shift']());}};_0x4cd6b9(++_0x13e017);}(_0xdfd4,0x84));var _0x4dfd=function(_0x4e4153,_0x52db21){_0x4e4153=_0x4e4153-0x0;var _0x5aea70=_0xdfd4[_0x4e4153];return _0x5aea70;};'use strict';var _=require('lodash');var util=require(_0x4dfd('0x0'));var logger=require(_0x4dfd('0x1'))(_0x4dfd('0x2'));var moment=require('moment');var BPromise=require(_0x4dfd('0x3'));var rp=require(_0x4dfd('0x4'));var fs=require('fs');var path=require(_0x4dfd('0x5'));var rimraf=require(_0x4dfd('0x6'));var config=require(_0x4dfd('0x7'));var attributes=require('./intSalesforceField.attributes');module[_0x4dfd('0x8')]=function(_0x5808e6,_0x5c54c4){return _0x5808e6[_0x4dfd('0x9')](_0x4dfd('0xa'),attributes,{'tableName':_0x4dfd('0xb'),'paranoid':![],'indexes':[{'name':_0x4dfd('0xc'),'fields':['idField',_0x4dfd('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x68a5=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intSalesforceField.attributes','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash'];(function(_0x3c3ad0,_0x43a8fc){var _0x45593d=function(_0x2679f3){while(--_0x2679f3){_0x3c3ad0['push'](_0x3c3ad0['shift']());}};_0x45593d(++_0x43a8fc);}(_0x68a5,0x6f));var _0x568a=function(_0x33eb70,_0x317a3e){_0x33eb70=_0x33eb70-0x0;var _0x437854=_0x68a5[_0x33eb70];return _0x437854;};'use strict';var _=require(_0x568a('0x0'));var util=require(_0x568a('0x1'));var logger=require(_0x568a('0x2'))(_0x568a('0x3'));var moment=require(_0x568a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x568a('0x5'));var rimraf=require(_0x568a('0x6'));var config=require(_0x568a('0x7'));var attributes=require(_0x568a('0x8'));module['exports']=function(_0x401c54,_0x279f3c){return _0x401c54[_0x568a('0x9')]('SalesforceField',attributes,{'tableName':_0x568a('0xa'),'paranoid':![],'indexes':[{'name':_0x568a('0xb'),'fields':[_0x568a('0xc'),_0x568a('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 98e277e..28a449b 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 _0x6f0d=['SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent'];(function(_0x524a0c,_0x2a53b1){var _0x4c36f2=function(_0x1e9043){while(--_0x1e9043){_0x524a0c['push'](_0x524a0c['shift']());}};_0x4c36f2(++_0x2a53b1);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x3c7195,_0x589382){_0x3c7195=_0x3c7195-0x0;var _0x38d8cd=_0x6f0d[_0x3c7195];return _0x38d8cd;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('SalesforceField,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});} \ No newline at end of file +var _0x878f=['../../config/logger','rpc','../../config/environment','jayson/promise','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5b4726,_0x49938a){var _0x2a2a83=function(_0x218d3e){while(--_0x218d3e){_0x5b4726['push'](_0x5b4726['shift']());}};_0x2a2a83(++_0x49938a);}(_0x878f,0x173));var _0xf878=function(_0xcbf769,_0x39f134){_0xcbf769=_0xcbf769-0x0;var _0x255f33=_0x878f[_0xcbf769];return _0x255f33;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var moment=require(_0xf878('0x1'));var BPromise=require(_0xf878('0x2'));var rs=require(_0xf878('0x3'));var fs=require('fs');var Redis=require(_0xf878('0x4'));var db=require(_0xf878('0x5'))['db'];var utils=require(_0xf878('0x6'));var logger=require(_0xf878('0x7'))(_0xf878('0x8'));var config=require(_0xf878('0x9'));var jayson=require(_0xf878('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c5f5c,_0x62b420,_0x59e564){return new BPromise(function(_0x52851e,_0x530767){return client[_0xf878('0xb')](_0x3c5f5c,_0x59e564)['then'](function(_0x4a9d79){logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));logger['debug'](_0xf878('0xf'),_0x62b420,_0xf878('0xe'),JSON['stringify'](_0x4a9d79));if(_0x4a9d79[_0xf878('0x10')]){if(_0x4a9d79['error'][_0xf878('0x11')]===0x1f4){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x4a9d79['error'][_0xf878('0x12')]);return _0x530767(_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);}logger['error'](_0xf878('0xd'),_0x62b420,_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);return _0x52851e(_0x4a9d79['error']['message']);}else{logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));_0x52851e(_0x4a9d79[_0xf878('0x13')][_0xf878('0x12')]);}})[_0xf878('0x14')](function(_0x415056){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x415056);_0x530767(_0x415056);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 83f9ecb..1e91d5c 100644 --- a/server/api/intServicenowAccount/index.js +++ b/server/api/intServicenowAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5243=['post','create','addConfiguration','put','exports','multer','connect-timeout','express','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','getFields'];(function(_0x5c9568,_0x1bfbcf){var _0x264fda=function(_0x1f9abe){while(--_0x1f9abe){_0x5c9568['push'](_0x5c9568['shift']());}};_0x264fda(++_0x1bfbcf);}(_0x5243,0x71));var _0x3524=function(_0x3ee5c6,_0x326a85){_0x3ee5c6=_0x3ee5c6-0x0;var _0x170f6c=_0x5243[_0x3ee5c6];return _0x170f6c;};'use strict';var multer=require(_0x3524('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3524('0x1'));var express=require(_0x3524('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3524('0x3'));var config=require(_0x3524('0x4'));var controller=require('./intServicenowAccount.controller');router[_0x3524('0x5')]('/',auth['isAuthenticated'](),controller[_0x3524('0x6')]);router['get'](_0x3524('0x7'),auth[_0x3524('0x8')](),controller[_0x3524('0x9')]);router[_0x3524('0x5')](_0x3524('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x3524('0x5')](_0x3524('0xb'),auth[_0x3524('0x8')](),controller[_0x3524('0xc')]);router[_0x3524('0xd')]('/',auth['isAuthenticated'](),controller[_0x3524('0xe')]);router[_0x3524('0xd')]('/:id/configurations',auth[_0x3524('0x8')](),controller[_0x3524('0xf')]);router[_0x3524('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x3524('0x7'),auth[_0x3524('0x8')](),controller['destroy']);module[_0x3524('0x11')]=router; \ No newline at end of file +var _0x57d4=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','show','getConfigurations','post','create','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','exports'];(function(_0x56a7dd,_0x3fd9ae){var _0xc7b980=function(_0x34221b){while(--_0x34221b){_0x56a7dd['push'](_0x56a7dd['shift']());}};_0xc7b980(++_0x3fd9ae);}(_0x57d4,0x78));var _0x457d=function(_0x3ae400,_0x1fa29f){_0x3ae400=_0x3ae400-0x0;var _0xbfaa3e=_0x57d4[_0x3ae400];return _0xbfaa3e;};'use strict';var multer=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var path=require('path');var timeout=require(_0x457d('0x2'));var express=require(_0x457d('0x3'));var router=express[_0x457d('0x4')]();var auth=require(_0x457d('0x5'));var interaction=require(_0x457d('0x6'));var config=require(_0x457d('0x7'));var controller=require(_0x457d('0x8'));router[_0x457d('0x9')]('/',auth[_0x457d('0xa')](),controller[_0x457d('0xb')]);router[_0x457d('0x9')]('/:id',auth[_0x457d('0xa')](),controller[_0x457d('0xc')]);router['get']('/:id/configurations',auth[_0x457d('0xa')](),controller[_0x457d('0xd')]);router[_0x457d('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x457d('0xe')]('/',auth[_0x457d('0xa')](),controller[_0x457d('0xf')]);router[_0x457d('0xe')](_0x457d('0x10'),auth[_0x457d('0xa')](),controller[_0x457d('0x11')]);router[_0x457d('0x12')](_0x457d('0x13'),auth['isAuthenticated'](),controller[_0x457d('0x14')]);router[_0x457d('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x457d('0x16')]);module[_0x457d('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index e82f910..5351eeb 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.attributes.js +++ b/server/api/intServicenowAccount/intServicenowAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2081=['sequelize','exports','STRING','username'];(function(_0x16192a,_0x5ebefc){var _0x1274fd=function(_0x6585e8){while(--_0x6585e8){_0x16192a['push'](_0x16192a['shift']());}};_0x1274fd(++_0x5ebefc);}(_0x2081,0x160));var _0x1208=function(_0x1b51ea,_0x394fd9){_0x1b51ea=_0x1b51ea-0x0;var _0x18bbdc=_0x2081[_0x1b51ea];return _0x18bbdc;};'use strict';var Sequelize=require(_0x1208('0x0'));module[_0x1208('0x1')]={'name':{'type':Sequelize[_0x1208('0x2')]},'description':{'type':Sequelize[_0x1208('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x1208('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1208('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf3d2=['exports','STRING','username','remoteUri'];(function(_0x5e1e25,_0xdc1421){var _0x548e5f=function(_0x576360){while(--_0x576360){_0x5e1e25['push'](_0x5e1e25['shift']());}};_0x548e5f(++_0xdc1421);}(_0xf3d2,0x13c));var _0x2f3d=function(_0x5a6de2,_0x5c8b10){_0x5a6de2=_0x5a6de2-0x0;var _0x2c0525=_0xf3d2[_0x5a6de2];return _0x2c0525;};'use strict';var Sequelize=require('sequelize');module[_0x2f3d('0x0')]={'name':{'type':Sequelize[_0x2f3d('0x1')]},'description':{'type':Sequelize[_0x2f3d('0x1')]},'username':{'type':Sequelize[_0x2f3d('0x1')],'unique':_0x2f3d('0x2')},'password':{'type':Sequelize[_0x2f3d('0x1')]},'email':{'type':Sequelize[_0x2f3d('0x1')]},'remoteUri':{'type':Sequelize[_0x2f3d('0x1')],'unique':_0x2f3d('0x3')},'serverUrl':{'type':Sequelize[_0x2f3d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 509138a..a0c2565 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.controller.js +++ b/server/api/intServicenowAccount/intServicenowAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4a87=['ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','json','offset','limit','set','reject','update','then','end','name','send','index','map','ServicenowAccount','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','findOne','ServicenowConfiguration','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','made_sla','hold_reason','knowledge','subcategory','close_code','incident_state','severity','caused_by','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','correlation_display','work_start','business_stc','calendar_duration','notify','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','escalation','upon_approval','correlation_id','location','category','password','remoteUri','serverUrl','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','forEach','label','push','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','all','statusCode','stack','Wrong\x20credentials','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x4a87,0x165));var _0x74a8=function(_0x6d66d4,_0x32ca2e){_0x6d66d4=_0x6d66d4-0x0;var _0x5d7b5d=_0x4a87[_0x6d66d4];return _0x5d7b5d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x74a8('0x0'));var rimraf=require(_0x74a8('0x1'));var zipdir=require(_0x74a8('0x2'));var jsonpatch=require(_0x74a8('0x3'));var rp=require(_0x74a8('0x4'));var moment=require(_0x74a8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x74a8('0x6'));var util=require('util');var path=require(_0x74a8('0x7'));var sox=require(_0x74a8('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x74a8('0x9'));var squel=require(_0x74a8('0xa'));var crypto=require('crypto');var jsforce=require(_0x74a8('0xb'));var deskjs=require(_0x74a8('0xc'));var toCsv=require(_0x74a8('0xd'));var querystring=require(_0x74a8('0xe'));var Papa=require(_0x74a8('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x74a8('0x10'));var as=require(_0x74a8('0x11'));var hardwareService=require(_0x74a8('0x12'));var logger=require(_0x74a8('0x13'))(_0x74a8('0x14'));var utils=require('../../config/utils');var config=require(_0x74a8('0x15'));var db=require(_0x74a8('0x16'))['db'];var integrations=require(_0x74a8('0x17'));var jayson=require(_0x74a8('0x18'));var client=jayson[_0x74a8('0x19')][_0x74a8('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x2dafc7,_0x5498e9,_0x28d0b2){if(_0x28d0b2){var _0x3fa459=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3fa459[_0x74a8('0x1b')](_0x5498e9)){return _0x2dafc7;}else{throw new db[(_0x74a8('0x1c'))][(_0x74a8('0x1d'))](_0x74a8('0x1e'));}}else{return _0x2dafc7;}}function respondWithRpcPromise(_0x5b2ae5,_0x411149,_0x352609,_0xcf62f3){return new BPromise(function(_0xe71da4,_0x3c5ebd){var _0x4b727a=_0xcf62f3||client;return _0x4b727a[_0x74a8('0x1f')](_0x5b2ae5,_0x352609)['then'](function(_0x8d614b){logger[_0x74a8('0x20')](_0x74a8('0x21'),_0x411149,_0x74a8('0x22'));logger['debug'](_0x74a8('0x23'),_0x411149,_0x74a8('0x22'),JSON[_0x74a8('0x24')](_0x8d614b));if(_0x8d614b['error']){if(_0x8d614b[_0x74a8('0x25')][_0x74a8('0x26')]===0x1f4){logger[_0x74a8('0x25')](_0x74a8('0x21'),_0x411149,_0x8d614b[_0x74a8('0x25')]['message']);return _0x3c5ebd(_0x8d614b['error'][_0x74a8('0x27')]);}logger[_0x74a8('0x25')](_0x74a8('0x21'),_0x411149,_0x8d614b[_0x74a8('0x25')][_0x74a8('0x27')]);return _0xe71da4(_0x8d614b[_0x74a8('0x25')]['message']);}else{logger[_0x74a8('0x20')](_0x74a8('0x21'),_0x411149,_0x74a8('0x22'));_0xe71da4(_0x8d614b['result'][_0x74a8('0x27')]);}})['catch'](function(_0x40c16e){logger[_0x74a8('0x25')](_0x74a8('0x21'),_0x411149,_0x40c16e);_0x3c5ebd(_0x40c16e);});});}function respondWithStatusCode(_0x4b2614,_0x1f5dd1){_0x1f5dd1=_0x1f5dd1||0xcc;return function(_0x135f33){if(_0x135f33){return _0x4b2614[_0x74a8('0x28')](_0x1f5dd1);}return _0x4b2614['status'](_0x1f5dd1)['end']();};}function respondWithResult(_0x468aa8,_0x30ace4){_0x30ace4=_0x30ace4||0xc8;return function(_0x9a46a2){if(_0x9a46a2){return _0x468aa8[_0x74a8('0x29')](_0x30ace4)[_0x74a8('0x2a')](_0x9a46a2);}};}function respondWithFilteredResult(_0x40b975,_0x1c89cf){return function(_0x1743cb){if(_0x1743cb){var _0x32c4a2=_0x1743cb['count'],_0x552b7c=_0x1c89cf[_0x74a8('0x2b')],_0x1c477e=_0x1c89cf[_0x74a8('0x2b')]+_0x1c89cf[_0x74a8('0x2c')],_0x1d9a22;if(_0x1c477e>=_0x32c4a2){_0x1c477e=_0x32c4a2;_0x1d9a22=0xc8;}else{_0x1d9a22=0xce;}_0x40b975[_0x74a8('0x29')](_0x1d9a22);return _0x40b975[_0x74a8('0x2d')]('Content-Range',_0x552b7c+'-'+_0x1c477e+'/'+_0x32c4a2)[_0x74a8('0x2a')](_0x1743cb);}return null;};}function patchUpdates(_0x405728){return function(_0x5c0080){try{jsonpatch['apply'](_0x5c0080,_0x405728,!![]);}catch(_0x5d7641){return BPromise[_0x74a8('0x2e')](_0x5d7641);}return _0x5c0080['save']();};}function saveUpdates(_0x12fd00,_0x15e969){return function(_0x71c386){if(_0x71c386){return _0x71c386[_0x74a8('0x2f')](_0x12fd00)[_0x74a8('0x30')](function(_0x4488e3){return _0x4488e3;});}return null;};}function removeEntity(_0x246d49,_0x161ba3){return function(_0x3ed820){if(_0x3ed820){return _0x3ed820['destroy']()[_0x74a8('0x30')](function(){_0x246d49[_0x74a8('0x29')](0xcc)[_0x74a8('0x31')]();});}};}function handleEntityNotFound(_0x460949,_0xa51cee){return function(_0x2b4e1d){if(!_0x2b4e1d){_0x460949[_0x74a8('0x28')](0x194);}return _0x2b4e1d;};}function handleError(_0x34fbce,_0x3d6394){_0x3d6394=_0x3d6394||0x1f4;return function(_0x4cb3d7){logger[_0x74a8('0x25')](_0x4cb3d7['stack']);if(_0x4cb3d7[_0x74a8('0x32')]){delete _0x4cb3d7[_0x74a8('0x32')];}_0x34fbce[_0x74a8('0x29')](_0x3d6394)[_0x74a8('0x33')](_0x4cb3d7);};}exports[_0x74a8('0x34')]=function(_0x53f756,_0x592beb){var _0x9ca277={},_0x18a60b={},_0x316f36={'count':0x0,'rows':[]};var _0x3396a3=_[_0x74a8('0x35')](db[_0x74a8('0x36')][_0x74a8('0x37')],function(_0x5ed8de){return{'name':_0x5ed8de['fieldName'],'type':_0x5ed8de[_0x74a8('0x38')][_0x74a8('0x39')]};});_0x18a60b['model']=_[_0x74a8('0x35')](_0x3396a3,'name');_0x18a60b[_0x74a8('0x3a')]=_[_0x74a8('0x3b')](_0x53f756[_0x74a8('0x3a')]);_0x18a60b[_0x74a8('0x3c')]=_[_0x74a8('0x3d')](_0x18a60b[_0x74a8('0x3e')],_0x18a60b['query']);_0x9ca277[_0x74a8('0x3f')]=_[_0x74a8('0x3d')](_0x18a60b[_0x74a8('0x3e')],qs['fields'](_0x53f756[_0x74a8('0x3a')][_0x74a8('0x40')]));_0x9ca277[_0x74a8('0x3f')]=_0x9ca277[_0x74a8('0x3f')][_0x74a8('0x41')]?_0x9ca277['attributes']:_0x18a60b[_0x74a8('0x3e')];if(!_0x53f756[_0x74a8('0x3a')][_0x74a8('0x42')](_0x74a8('0x43'))){_0x9ca277[_0x74a8('0x2c')]=qs[_0x74a8('0x2c')](_0x53f756[_0x74a8('0x3a')][_0x74a8('0x2c')]);_0x9ca277[_0x74a8('0x2b')]=qs[_0x74a8('0x2b')](_0x53f756[_0x74a8('0x3a')][_0x74a8('0x2b')]);}_0x9ca277[_0x74a8('0x44')]=qs[_0x74a8('0x45')](_0x53f756[_0x74a8('0x3a')][_0x74a8('0x45')]);_0x9ca277['where']=qs[_0x74a8('0x3c')](_[_0x74a8('0x46')](_0x53f756[_0x74a8('0x3a')],_0x18a60b[_0x74a8('0x3c')]),_0x3396a3);if(_0x53f756[_0x74a8('0x3a')][_0x74a8('0x47')]){_0x9ca277[_0x74a8('0x48')]=_[_0x74a8('0x49')](_0x9ca277[_0x74a8('0x48')],{'$or':_[_0x74a8('0x35')](_0x3396a3,function(_0xf05042){if(_0xf05042[_0x74a8('0x38')]!==_0x74a8('0x4a')){var _0x2937a2={};_0x2937a2[_0xf05042[_0x74a8('0x32')]]={'$like':'%'+_0x53f756[_0x74a8('0x3a')]['filter']+'%'};return _0x2937a2;}})});}_0x9ca277=_[_0x74a8('0x49')]({},_0x9ca277,_0x53f756[_0x74a8('0x4b')]);var _0x424712={'where':_0x9ca277['where']};return db[_0x74a8('0x36')][_0x74a8('0x4c')](_0x424712)[_0x74a8('0x30')](function(_0x9837a3){_0x316f36[_0x74a8('0x4c')]=_0x9837a3;if(_0x53f756[_0x74a8('0x3a')][_0x74a8('0x4d')]){_0x9ca277[_0x74a8('0x4e')]=[{'all':!![]}];}return db[_0x74a8('0x36')][_0x74a8('0x4f')](_0x9ca277);})[_0x74a8('0x30')](function(_0x5c20ea){_0x316f36[_0x74a8('0x50')]=_0x5c20ea;return _0x316f36;})[_0x74a8('0x30')](respondWithFilteredResult(_0x592beb,_0x9ca277))[_0x74a8('0x51')](handleError(_0x592beb,null));};exports['show']=function(_0x118d62,_0x4d1051){var _0x368351={'raw':![],'where':{'id':_0x118d62[_0x74a8('0x52')]['id']}},_0x318139={};_0x318139[_0x74a8('0x3e')]=_[_0x74a8('0x3b')](db[_0x74a8('0x36')][_0x74a8('0x37')]);_0x318139[_0x74a8('0x3a')]=_['keys'](_0x118d62[_0x74a8('0x3a')]);_0x318139[_0x74a8('0x3c')]=_['intersection'](_0x318139['model'],_0x318139['query']);_0x368351[_0x74a8('0x3f')]=_['intersection'](_0x318139['model'],qs[_0x74a8('0x40')](_0x118d62[_0x74a8('0x3a')][_0x74a8('0x40')]));_0x368351[_0x74a8('0x3f')]=_0x368351[_0x74a8('0x3f')]['length']?_0x368351[_0x74a8('0x3f')]:_0x318139['model'];if(_0x118d62[_0x74a8('0x3a')][_0x74a8('0x4d')]){_0x368351['include']=[{'all':!![]}];}_0x368351=_[_0x74a8('0x49')]({},_0x368351,_0x118d62['options']);return db['ServicenowAccount'][_0x74a8('0x53')](_0x368351)[_0x74a8('0x30')](handleEntityNotFound(_0x4d1051,null))[_0x74a8('0x30')](respondWithResult(_0x4d1051,null))[_0x74a8('0x51')](handleError(_0x4d1051,null));};exports[_0x74a8('0x54')]=function(_0x4caa74,_0x38d48){return db['ServicenowAccount'][_0x74a8('0x54')](_0x4caa74[_0x74a8('0x55')],{})['then'](respondWithResult(_0x38d48,0xc9))[_0x74a8('0x51')](handleError(_0x38d48,null));};exports[_0x74a8('0x2f')]=function(_0x590fa4,_0x45f7c1){if(_0x590fa4[_0x74a8('0x55')]['id']){delete _0x590fa4[_0x74a8('0x55')]['id'];}return db[_0x74a8('0x36')][_0x74a8('0x53')]({'where':{'id':_0x590fa4['params']['id']}})[_0x74a8('0x30')](handleEntityNotFound(_0x45f7c1,null))[_0x74a8('0x30')](saveUpdates(_0x590fa4[_0x74a8('0x55')],null))[_0x74a8('0x30')](respondWithResult(_0x45f7c1,null))[_0x74a8('0x51')](handleError(_0x45f7c1,null));};exports[_0x74a8('0x56')]=function(_0x1aedba,_0x362dae){return db[_0x74a8('0x36')][_0x74a8('0x53')]({'where':{'id':_0x1aedba['params']['id']}})[_0x74a8('0x30')](handleEntityNotFound(_0x362dae,null))[_0x74a8('0x30')](removeEntity(_0x362dae,null))[_0x74a8('0x51')](handleError(_0x362dae,null));};exports['getConfigurations']=function(_0x1f16d8,_0x15a172,_0xfe22c1){var _0x206ce8={};var _0x46ac4b={};var _0x27695b;var _0x838c10;return db[_0x74a8('0x36')][_0x74a8('0x57')]({'where':{'id':_0x1f16d8[_0x74a8('0x52')]['id']}})[_0x74a8('0x30')](handleEntityNotFound(_0x15a172,null))[_0x74a8('0x30')](function(_0x5a142b){if(_0x5a142b){_0x27695b=_0x5a142b;_0x46ac4b[_0x74a8('0x3e')]=_[_0x74a8('0x3b')](db[_0x74a8('0x58')]['rawAttributes']);_0x46ac4b[_0x74a8('0x3a')]=_[_0x74a8('0x3b')](_0x1f16d8[_0x74a8('0x3a')]);_0x46ac4b[_0x74a8('0x3c')]=_[_0x74a8('0x3d')](_0x46ac4b[_0x74a8('0x3e')],_0x46ac4b[_0x74a8('0x3a')]);_0x206ce8[_0x74a8('0x3f')]=_[_0x74a8('0x3d')](_0x46ac4b[_0x74a8('0x3e')],qs[_0x74a8('0x40')](_0x1f16d8[_0x74a8('0x3a')]['fields']));_0x206ce8[_0x74a8('0x3f')]=_0x206ce8[_0x74a8('0x3f')]['length']?_0x206ce8['attributes']:_0x46ac4b[_0x74a8('0x3e')];_0x206ce8[_0x74a8('0x44')]=qs[_0x74a8('0x45')](_0x1f16d8[_0x74a8('0x3a')][_0x74a8('0x45')]);_0x206ce8[_0x74a8('0x48')]=qs[_0x74a8('0x3c')](_[_0x74a8('0x46')](_0x1f16d8[_0x74a8('0x3a')],_0x46ac4b['filters']));if(_0x1f16d8[_0x74a8('0x3a')][_0x74a8('0x47')]){_0x206ce8[_0x74a8('0x48')]=_['merge'](_0x206ce8[_0x74a8('0x48')],{'$or':_['map'](_0x206ce8[_0x74a8('0x3f')],function(_0x305bf2){var _0xdc4936={};_0xdc4936[_0x305bf2]={'$like':'%'+_0x1f16d8['query'][_0x74a8('0x47')]+'%'};return _0xdc4936;})});}_0x206ce8=_[_0x74a8('0x49')]({},_0x206ce8,_0x1f16d8['options']);return _0x27695b[_0x74a8('0x59')](_0x206ce8);}})[_0x74a8('0x30')](function(_0x1fd5f2){if(_0x1fd5f2){_0x838c10=_0x1fd5f2[_0x74a8('0x41')];if(!_0x1f16d8['query'][_0x74a8('0x42')](_0x74a8('0x43'))){_0x206ce8[_0x74a8('0x2c')]=qs['limit'](_0x1f16d8['query'][_0x74a8('0x2c')]);_0x206ce8[_0x74a8('0x2b')]=qs['offset'](_0x1f16d8['query']['offset']);}return _0x27695b['getConfigurations'](_0x206ce8);}})['then'](function(_0x4864d7){if(_0x4864d7){return _0x4864d7?{'count':_0x838c10,'rows':_0x4864d7}:null;}})[_0x74a8('0x30')](respondWithResult(_0x15a172,null))[_0x74a8('0x51')](handleError(_0x15a172,null));};exports[_0x74a8('0x5a')]=function(_0x1d7c8e,_0x32d499,_0x5fdba5){if(_0x1d7c8e['body']['id']){delete _0x1d7c8e[_0x74a8('0x55')]['id'];}return db[_0x74a8('0x36')][_0x74a8('0x57')]({'where':{'id':_0x1d7c8e['params']['id']}})['then'](handleEntityNotFound(_0x32d499,null))[_0x74a8('0x30')](function(_0x25b7df){if(_0x25b7df){_0x1d7c8e['body']['AccountId']=_0x25b7df['id'];_0x1d7c8e['body'][_0x74a8('0x5b')]=integrations[_0x74a8('0x5c')](_0x1d7c8e[_0x74a8('0x55')][_0x74a8('0x5d')],_0x1d7c8e['body'][_0x74a8('0x38')]);_0x1d7c8e[_0x74a8('0x55')][_0x74a8('0x5e')]=integrations[_0x74a8('0x5f')](_0x1d7c8e[_0x74a8('0x55')][_0x74a8('0x5d')],_0x1d7c8e[_0x74a8('0x55')][_0x74a8('0x38')]);return db[_0x74a8('0x58')][_0x74a8('0x54')](_0x1d7c8e[_0x74a8('0x55')],{'include':[{'model':db[_0x74a8('0x60')],'as':_0x74a8('0x5b')},{'model':db[_0x74a8('0x60')],'as':_0x74a8('0x5e')}]});}return null;})[_0x74a8('0x30')](respondWithResult(_0x32d499,null))[_0x74a8('0x51')](handleError(_0x32d499,null));};exports['getFields']=function(_0x191b6f,_0x5a58f6,_0xa4aafc){var _0x259cae=[_0x74a8('0x61'),_0x74a8('0x62'),_0x74a8('0x63'),_0x74a8('0x64'),_0x74a8('0x65'),'notify',_0x74a8('0x66'),_0x74a8('0x67'),'category'];var _0x164b63=['parent',_0x74a8('0x61'),_0x74a8('0x68'),'watch_list','upon_reject',_0x74a8('0x69'),_0x74a8('0x6a'),_0x74a8('0x62'),'approval_history',_0x74a8('0x6b'),_0x74a8('0x6c'),_0x74a8('0x6d'),_0x74a8('0x6e'),_0x74a8('0x6f'),_0x74a8('0x70'),_0x74a8('0x71'),_0x74a8('0x72'),_0x74a8('0x73'),'knowledge','order',_0x74a8('0x74'),_0x74a8('0x75'),_0x74a8('0x76'),_0x74a8('0x77'),_0x74a8('0x78'),_0x74a8('0x79'),_0x74a8('0x7a'),_0x74a8('0x7b'),_0x74a8('0x7c'),_0x74a8('0x7d'),'rfc',_0x74a8('0x7e'),_0x74a8('0x7f'),_0x74a8('0x80'),_0x74a8('0x81'),_0x74a8('0x82'),_0x74a8('0x83'),_0x74a8('0x84'),_0x74a8('0x85'),_0x74a8('0x86'),_0x74a8('0x87'),'subcategory',_0x74a8('0x88'),'short_description',_0x74a8('0x65'),_0x74a8('0x89'),'delivery_task',_0x74a8('0x8a'),'assignment_group',_0x74a8('0x8b'),'additional_assignee_list','description',_0x74a8('0x8c'),_0x74a8('0x8d'),_0x74a8('0x8e'),'close_notes',_0x74a8('0x8f'),_0x74a8('0x90'),_0x74a8('0x91'),_0x74a8('0x92'),_0x74a8('0x93'),_0x74a8('0x94'),_0x74a8('0x66'),_0x74a8('0x95'),_0x74a8('0x96'),'company',_0x74a8('0x97'),_0x74a8('0x98'),'assigned_to',_0x74a8('0x67'),_0x74a8('0x99'),_0x74a8('0x9a'),_0x74a8('0x9b'),_0x74a8('0x9c'),'due_date','sys_mod_count','reopen_count','sys_tags',_0x74a8('0x9d'),_0x74a8('0x9e'),_0x74a8('0x9f'),_0x74a8('0xa0'),_0x74a8('0xa1')];var _0xf2d768='';var _0x22e8ea='';var _0x1ecc4f=[];var _0x4539f7='';var _0x1c9e99='';var _0x1487f5=[];var _0x208d82='';var _0x3039f1='';var _0xb06178={};var _0x39cbd0='';return db['ServicenowAccount'][_0x74a8('0x57')]({'where':{'id':_0x191b6f[_0x74a8('0x52')]['id']},'attributes':['id','username',_0x74a8('0xa2'),'email',_0x74a8('0xa3'),_0x74a8('0xa4')]})[_0x74a8('0x30')](handleEntityNotFound(_0x5a58f6,null))[_0x74a8('0x30')](function(_0x4ef19a){if(_0x4ef19a){_0x39cbd0=_0x4ef19a[_0x74a8('0xa3')];var _0x2c134c=_0x39cbd0[_0x74a8('0xa5')](-0x1);if(_0x2c134c==='/'){_0x39cbd0=_0x39cbd0[_0x74a8('0xa6')](0x0,_0x39cbd0['lastIndexOf'](_0x2c134c));}_0x3039f1=util[_0x74a8('0xa7')](_0x74a8('0xa8'),_0x39cbd0);_0x208d82=util[_0x74a8('0xa7')](_0x74a8('0xa9'),_0x39cbd0);_0xb06178={'user':_0x4ef19a[_0x74a8('0xaa')],'pass':_0x4ef19a[_0x74a8('0xa2')]};var _0x10fd92={'method':_0x74a8('0xab'),'uri':_0x3039f1+_0x74a8('0xac'),'auth':_0xb06178,'json':!![]};return rp(_0x10fd92);}})[_0x74a8('0x30')](function(_0x5b8149){if(_0x5b8149['result'][_0x74a8('0x41')]>0x0){_0xf2d768=_0x5b8149[_0x74a8('0xad')];}console[_0x74a8('0xae')](_0x74a8('0xaf'),_0xf2d768);_0x1487f5=[];_0x22e8ea=Object[_0x74a8('0xb0')]([],_0xf2d768);_['remove'](_0x22e8ea,function(_0x58a3d5){return!_0x259cae['includes'](_0x58a3d5[_0x74a8('0x32')]);});_0x22e8ea[_0x74a8('0xb1')](function(_0x16a962){var _0x436960=createFieldObject(_0x208d82,_0xb06178,_0x16a962['internalType'],_0x16a962[_0x74a8('0x32')],_0x16a962[_0x74a8('0xb2')],![]);_0x1487f5[_0x74a8('0xb3')](_0x436960);});return Promise['all'](_0x1487f5);})[_0x74a8('0x30')](function(_0x51abbe){_0x1ecc4f=_0x51abbe;_0x4539f7=Object['assign']([],_0xf2d768);console[_0x74a8('0xae')](_0x74a8('0xb4'),_0xf2d768);_['remove'](_0x4539f7,function(_0x3b003d){return _0x164b63[_0x74a8('0xb5')](_0x3b003d[_0x74a8('0x32')]);});console[_0x74a8('0xae')](_0x74a8('0xb6'),_0x4539f7);_0x1487f5=[];_0x4539f7['forEach'](function(_0x489d9f){var _0xc189b1=createFieldObject(_0x208d82,_0xb06178,_0x489d9f[_0x74a8('0xb7')],_0x489d9f[_0x74a8('0x32')],_0x489d9f[_0x74a8('0xb2')],!![]);_0x1487f5['push'](_0xc189b1);});return Promise[_0x74a8('0xb8')](_0x1487f5);})['then'](function(_0x2b3f1a){_0x1c9e99=_0x2b3f1a;var _0x143ea5=_0x1ecc4f['concat'](_0x1c9e99);return{'count':_0x143ea5[_0x74a8('0x41')],'rows':_0x143ea5};})[_0x74a8('0x30')](respondWithResult(_0x5a58f6,null))[_0x74a8('0x51')](function(_0x40b30d){console[_0x74a8('0xae')]('ServiceNow\x20error:\x20'+_0x40b30d);var _0x22c69f=_0x191b6f['query'][_0x74a8('0x1b')]?0x1f4:_0x40b30d[_0x74a8('0xb9')]||0x1f4;logger[_0x74a8('0x25')](_0x40b30d[_0x74a8('0xba')]);delete _0x40b30d[_0x74a8('0x32')];if(_0x22c69f===0x191){_0x22c69f=0x190;}_0x5a58f6[_0x74a8('0x29')](_0x22c69f)[_0x74a8('0x33')](_0x191b6f[_0x74a8('0x3a')][_0x74a8('0x1b')]?{'message':_0x74a8('0xbb'),'statusCode':_0x40b30d[_0x74a8('0xb9')]}:_0x40b30d);});};function createFieldObject(_0x8bc527,_0x528585,_0x2a251b,_0x26ef20,_0xfd6a11,_0x295a84){return new Promise(function(_0x48b7ca,_0x3e86ae){var _0x4e5856={'id':_0x26ef20,'name':_0xfd6a11,'custom':_0x295a84};if(_0x2a251b===_0x74a8('0xbc')){_0x4e5856[_0x74a8('0x4b')]=[{'name':_0x74a8('0xbd'),'value':_0x74a8('0xbe')},{'name':_0x74a8('0xbf'),'value':'false'}];_0x48b7ca(_0x4e5856);}else{var _0x533036={'method':_0x74a8('0xab'),'uri':_0x8bc527+_0x74a8('0xc0')+_0x26ef20,'auth':_0x528585,'json':!![]};return rp(_0x533036)['then'](function(_0x4fd28c){var _0xa3bb1c=[];if(_0x4fd28c[_0x74a8('0xad')]['length']>0x0){_0x4fd28c[_0x74a8('0xad')][_0x74a8('0xb1')](function(_0x451889){if(_0x451889[_0x74a8('0xc1')]==='false'){var _0x1e32fd={'name':_0x451889[_0x74a8('0xb2')],'value':_0x451889[_0x74a8('0xc2')]};_0xa3bb1c[_0x74a8('0xb3')](_0x1e32fd);}});}_0x4e5856[_0x74a8('0x4b')]=_0xa3bb1c;if(_0x4e5856['options']['length']>0x0){_0x48b7ca(_0x4e5856);}else{if(_0x295a84==![]){_0x48b7ca();}else{_0x48b7ca(_0x4e5856);}}});}});} \ No newline at end of file +var _0x177d=['true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','ServicenowAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','find','create','body','getConfigurations','findOne','ServicenowConfiguration','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','knowledge','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','child_incidents','hold_reason','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','business_service','priority','rfc','time_worked','expected_start','work_end','reopened_time','caller_id','subcategory','work_notes','close_code','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','problem_id','company','reassignment_count','activity_due','assigned_to','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','username','password','email','serverUrl','substring','format','%s/api/now/table/','incident?sysparm_display_value=all','log','assign','remove','includes','forEach','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','concat','ServiceNow\x20error:\x20','stack','Wrong\x20credentials','statusCode','boolean'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x177d,0xcd));var _0xd177=function(_0x54bdc1,_0x1f4673){_0x54bdc1=_0x54bdc1-0x0;var _0x2137e5=_0x177d[_0x54bdc1];return _0x2137e5;};'use strict';var pdf=require(_0xd177('0x0'));var emlformat=require(_0xd177('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd177('0x2'));var jsonpatch=require(_0xd177('0x3'));var rp=require(_0xd177('0x4'));var moment=require('moment');var BPromise=require(_0xd177('0x5'));var Mustache=require('mustache');var util=require(_0xd177('0x6'));var path=require(_0xd177('0x7'));var sox=require(_0xd177('0x8'));var csv=require('to-csv');var ejs=require(_0xd177('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd177('0xa'));var crypto=require(_0xd177('0xb'));var jsforce=require(_0xd177('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd177('0xd'));var Redis=require(_0xd177('0xe'));var authService=require(_0xd177('0xf'));var qs=require(_0xd177('0x10'));var as=require(_0xd177('0x11'));var hardwareService=require(_0xd177('0x12'));var logger=require(_0xd177('0x13'))(_0xd177('0x14'));var utils=require(_0xd177('0x15'));var config=require('../../config/environment');var db=require(_0xd177('0x16'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client'][_0xd177('0x17')]({'port':0x232a});function checkPasswordPattern(_0xea9056,_0x3839d8,_0x20da02){if(_0x20da02){var _0x56ee72=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x56ee72[_0xd177('0x18')](_0x3839d8)){return _0xea9056;}else{throw new db[(_0xd177('0x19'))]['ValidationError'](_0xd177('0x1a'));}}else{return _0xea9056;}}function respondWithRpcPromise(_0x4d282e,_0x45fbb8,_0x4e4a74,_0x505b0a){return new BPromise(function(_0x2c4a06,_0x461c16){var _0x16f473=_0x505b0a||client;return _0x16f473[_0xd177('0x1b')](_0x4d282e,_0x4e4a74)[_0xd177('0x1c')](function(_0xbcc985){logger[_0xd177('0x1d')](_0xd177('0x1e'),_0x45fbb8,_0xd177('0x1f'));logger[_0xd177('0x20')](_0xd177('0x21'),_0x45fbb8,_0xd177('0x1f'),JSON[_0xd177('0x22')](_0xbcc985));if(_0xbcc985[_0xd177('0x23')]){if(_0xbcc985['error'][_0xd177('0x24')]===0x1f4){logger[_0xd177('0x23')](_0xd177('0x1e'),_0x45fbb8,_0xbcc985[_0xd177('0x23')][_0xd177('0x25')]);return _0x461c16(_0xbcc985[_0xd177('0x23')]['message']);}logger['error'](_0xd177('0x1e'),_0x45fbb8,_0xbcc985['error'][_0xd177('0x25')]);return _0x2c4a06(_0xbcc985['error']['message']);}else{logger['info'](_0xd177('0x1e'),_0x45fbb8,'request\x20sent');_0x2c4a06(_0xbcc985[_0xd177('0x26')]['message']);}})[_0xd177('0x27')](function(_0x1830b4){logger['error'](_0xd177('0x1e'),_0x45fbb8,_0x1830b4);_0x461c16(_0x1830b4);});});}function respondWithStatusCode(_0x52e070,_0x3f8d4d){_0x3f8d4d=_0x3f8d4d||0xcc;return function(_0x36ff2){if(_0x36ff2){return _0x52e070[_0xd177('0x28')](_0x3f8d4d);}return _0x52e070[_0xd177('0x29')](_0x3f8d4d)[_0xd177('0x2a')]();};}function respondWithResult(_0x3a502f,_0x5efa61){_0x5efa61=_0x5efa61||0xc8;return function(_0xbbf1ff){if(_0xbbf1ff){return _0x3a502f[_0xd177('0x29')](_0x5efa61)[_0xd177('0x2b')](_0xbbf1ff);}};}function respondWithFilteredResult(_0x5f33b9,_0x1682dc){return function(_0x4e4222){if(_0x4e4222){var _0x30d507=_0x4e4222[_0xd177('0x2c')],_0x3efe88=_0x1682dc['offset'],_0x230f8a=_0x1682dc[_0xd177('0x2d')]+_0x1682dc[_0xd177('0x2e')],_0x6ab056;if(_0x230f8a>=_0x30d507){_0x230f8a=_0x30d507;_0x6ab056=0xc8;}else{_0x6ab056=0xce;}_0x5f33b9[_0xd177('0x29')](_0x6ab056);return _0x5f33b9[_0xd177('0x2f')](_0xd177('0x30'),_0x3efe88+'-'+_0x230f8a+'/'+_0x30d507)[_0xd177('0x2b')](_0x4e4222);}return null;};}function patchUpdates(_0x5dee64){return function(_0x5ca875){try{jsonpatch[_0xd177('0x31')](_0x5ca875,_0x5dee64,!![]);}catch(_0x139444){return BPromise[_0xd177('0x32')](_0x139444);}return _0x5ca875[_0xd177('0x33')]();};}function saveUpdates(_0x3465d,_0x3eaa12){return function(_0x4aafd9){if(_0x4aafd9){return _0x4aafd9[_0xd177('0x34')](_0x3465d)[_0xd177('0x1c')](function(_0x197fb6){return _0x197fb6;});}return null;};}function removeEntity(_0x5aeab4,_0x13b6d0){return function(_0x52a9e0){if(_0x52a9e0){return _0x52a9e0[_0xd177('0x35')]()[_0xd177('0x1c')](function(){_0x5aeab4[_0xd177('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51b1fc,_0x583376){return function(_0x4efe0b){if(!_0x4efe0b){_0x51b1fc[_0xd177('0x28')](0x194);}return _0x4efe0b;};}function handleError(_0x252045,_0x3eda57){_0x3eda57=_0x3eda57||0x1f4;return function(_0x593e97){logger[_0xd177('0x23')](_0x593e97['stack']);if(_0x593e97[_0xd177('0x36')]){delete _0x593e97[_0xd177('0x36')];}_0x252045[_0xd177('0x29')](_0x3eda57)[_0xd177('0x37')](_0x593e97);};}exports[_0xd177('0x38')]=function(_0x2addc4,_0x3b435f){var _0x98db85={},_0x3cceb7={},_0x56bc59={'count':0x0,'rows':[]};var _0x50f519=_[_0xd177('0x39')](db[_0xd177('0x3a')]['rawAttributes'],function(_0x59a866){return{'name':_0x59a866[_0xd177('0x3b')],'type':_0x59a866[_0xd177('0x3c')]['key']};});_0x3cceb7[_0xd177('0x3d')]=_[_0xd177('0x39')](_0x50f519,_0xd177('0x36'));_0x3cceb7[_0xd177('0x3e')]=_[_0xd177('0x3f')](_0x2addc4[_0xd177('0x3e')]);_0x3cceb7[_0xd177('0x40')]=_[_0xd177('0x41')](_0x3cceb7[_0xd177('0x3d')],_0x3cceb7[_0xd177('0x3e')]);_0x98db85[_0xd177('0x42')]=_[_0xd177('0x41')](_0x3cceb7[_0xd177('0x3d')],qs[_0xd177('0x43')](_0x2addc4['query'][_0xd177('0x43')]));_0x98db85[_0xd177('0x42')]=_0x98db85[_0xd177('0x42')][_0xd177('0x44')]?_0x98db85[_0xd177('0x42')]:_0x3cceb7[_0xd177('0x3d')];if(!_0x2addc4['query']['hasOwnProperty'](_0xd177('0x45'))){_0x98db85[_0xd177('0x2e')]=qs[_0xd177('0x2e')](_0x2addc4['query']['limit']);_0x98db85[_0xd177('0x2d')]=qs[_0xd177('0x2d')](_0x2addc4['query'][_0xd177('0x2d')]);}_0x98db85['order']=qs['sort'](_0x2addc4['query'][_0xd177('0x46')]);_0x98db85[_0xd177('0x47')]=qs[_0xd177('0x40')](_[_0xd177('0x48')](_0x2addc4[_0xd177('0x3e')],_0x3cceb7[_0xd177('0x40')]),_0x50f519);if(_0x2addc4['query'][_0xd177('0x49')]){_0x98db85['where']=_[_0xd177('0x4a')](_0x98db85[_0xd177('0x47')],{'$or':_[_0xd177('0x39')](_0x50f519,function(_0x1be72b){if(_0x1be72b[_0xd177('0x3c')]!==_0xd177('0x4b')){var _0x3fca76={};_0x3fca76[_0x1be72b[_0xd177('0x36')]]={'$like':'%'+_0x2addc4['query'][_0xd177('0x49')]+'%'};return _0x3fca76;}})});}_0x98db85=_[_0xd177('0x4a')]({},_0x98db85,_0x2addc4[_0xd177('0x4c')]);var _0x314183={'where':_0x98db85[_0xd177('0x47')]};return db[_0xd177('0x3a')][_0xd177('0x2c')](_0x314183)[_0xd177('0x1c')](function(_0x2294af){_0x56bc59[_0xd177('0x2c')]=_0x2294af;if(_0x2addc4[_0xd177('0x3e')][_0xd177('0x4d')]){_0x98db85[_0xd177('0x4e')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xd177('0x4f')](_0x98db85);})[_0xd177('0x1c')](function(_0x53a2df){_0x56bc59['rows']=_0x53a2df;return _0x56bc59;})['then'](respondWithFilteredResult(_0x3b435f,_0x98db85))['catch'](handleError(_0x3b435f,null));};exports[_0xd177('0x50')]=function(_0x501bc0,_0x4f6230){var _0x2ff632={'raw':![],'where':{'id':_0x501bc0[_0xd177('0x51')]['id']}},_0x58d1fb={};_0x58d1fb[_0xd177('0x3d')]=_[_0xd177('0x3f')](db[_0xd177('0x3a')][_0xd177('0x52')]);_0x58d1fb[_0xd177('0x3e')]=_[_0xd177('0x3f')](_0x501bc0['query']);_0x58d1fb[_0xd177('0x40')]=_['intersection'](_0x58d1fb[_0xd177('0x3d')],_0x58d1fb['query']);_0x2ff632['attributes']=_['intersection'](_0x58d1fb[_0xd177('0x3d')],qs['fields'](_0x501bc0[_0xd177('0x3e')][_0xd177('0x43')]));_0x2ff632['attributes']=_0x2ff632['attributes'][_0xd177('0x44')]?_0x2ff632[_0xd177('0x42')]:_0x58d1fb[_0xd177('0x3d')];if(_0x501bc0['query'][_0xd177('0x4d')]){_0x2ff632[_0xd177('0x4e')]=[{'all':!![]}];}_0x2ff632=_[_0xd177('0x4a')]({},_0x2ff632,_0x501bc0[_0xd177('0x4c')]);return db['ServicenowAccount'][_0xd177('0x53')](_0x2ff632)[_0xd177('0x1c')](handleEntityNotFound(_0x4f6230,null))[_0xd177('0x1c')](respondWithResult(_0x4f6230,null))[_0xd177('0x27')](handleError(_0x4f6230,null));};exports[_0xd177('0x54')]=function(_0x146304,_0x28849a){return db[_0xd177('0x3a')][_0xd177('0x54')](_0x146304['body'],{})['then'](respondWithResult(_0x28849a,0xc9))[_0xd177('0x27')](handleError(_0x28849a,null));};exports[_0xd177('0x34')]=function(_0x39c211,_0x2e3699){if(_0x39c211['body']['id']){delete _0x39c211['body']['id'];}return db[_0xd177('0x3a')][_0xd177('0x53')]({'where':{'id':_0x39c211[_0xd177('0x51')]['id']}})[_0xd177('0x1c')](handleEntityNotFound(_0x2e3699,null))[_0xd177('0x1c')](saveUpdates(_0x39c211[_0xd177('0x55')],null))[_0xd177('0x1c')](respondWithResult(_0x2e3699,null))[_0xd177('0x27')](handleError(_0x2e3699,null));};exports['destroy']=function(_0x5592ef,_0x554bb5){return db['ServicenowAccount']['find']({'where':{'id':_0x5592ef[_0xd177('0x51')]['id']}})[_0xd177('0x1c')](handleEntityNotFound(_0x554bb5,null))[_0xd177('0x1c')](removeEntity(_0x554bb5,null))[_0xd177('0x27')](handleError(_0x554bb5,null));};exports[_0xd177('0x56')]=function(_0x3c261e,_0x8785f7,_0x1e975c){var _0x4f7e81={};var _0x2e6075={};var _0x25b694;var _0x58b498;return db[_0xd177('0x3a')][_0xd177('0x57')]({'where':{'id':_0x3c261e[_0xd177('0x51')]['id']}})[_0xd177('0x1c')](handleEntityNotFound(_0x8785f7,null))['then'](function(_0x3a175f){if(_0x3a175f){_0x25b694=_0x3a175f;_0x2e6075[_0xd177('0x3d')]=_[_0xd177('0x3f')](db[_0xd177('0x58')]['rawAttributes']);_0x2e6075[_0xd177('0x3e')]=_[_0xd177('0x3f')](_0x3c261e[_0xd177('0x3e')]);_0x2e6075[_0xd177('0x40')]=_['intersection'](_0x2e6075[_0xd177('0x3d')],_0x2e6075[_0xd177('0x3e')]);_0x4f7e81[_0xd177('0x42')]=_[_0xd177('0x41')](_0x2e6075[_0xd177('0x3d')],qs[_0xd177('0x43')](_0x3c261e[_0xd177('0x3e')][_0xd177('0x43')]));_0x4f7e81[_0xd177('0x42')]=_0x4f7e81[_0xd177('0x42')][_0xd177('0x44')]?_0x4f7e81[_0xd177('0x42')]:_0x2e6075[_0xd177('0x3d')];_0x4f7e81[_0xd177('0x59')]=qs['sort'](_0x3c261e['query'][_0xd177('0x46')]);_0x4f7e81[_0xd177('0x47')]=qs[_0xd177('0x40')](_[_0xd177('0x48')](_0x3c261e['query'],_0x2e6075[_0xd177('0x40')]));if(_0x3c261e[_0xd177('0x3e')][_0xd177('0x49')]){_0x4f7e81[_0xd177('0x47')]=_[_0xd177('0x4a')](_0x4f7e81[_0xd177('0x47')],{'$or':_['map'](_0x4f7e81[_0xd177('0x42')],function(_0x39715a){var _0x49e61a={};_0x49e61a[_0x39715a]={'$like':'%'+_0x3c261e[_0xd177('0x3e')][_0xd177('0x49')]+'%'};return _0x49e61a;})});}_0x4f7e81=_[_0xd177('0x4a')]({},_0x4f7e81,_0x3c261e[_0xd177('0x4c')]);return _0x25b694[_0xd177('0x56')](_0x4f7e81);}})['then'](function(_0x5f0c04){if(_0x5f0c04){_0x58b498=_0x5f0c04['length'];if(!_0x3c261e[_0xd177('0x3e')][_0xd177('0x5a')](_0xd177('0x45'))){_0x4f7e81['limit']=qs['limit'](_0x3c261e['query'][_0xd177('0x2e')]);_0x4f7e81[_0xd177('0x2d')]=qs[_0xd177('0x2d')](_0x3c261e[_0xd177('0x3e')]['offset']);}return _0x25b694[_0xd177('0x56')](_0x4f7e81);}})[_0xd177('0x1c')](function(_0x42f6b6){if(_0x42f6b6){return _0x42f6b6?{'count':_0x58b498,'rows':_0x42f6b6}:null;}})[_0xd177('0x1c')](respondWithResult(_0x8785f7,null))[_0xd177('0x27')](handleError(_0x8785f7,null));};exports[_0xd177('0x5b')]=function(_0x251472,_0x42cb93,_0x376cc4){if(_0x251472[_0xd177('0x55')]['id']){delete _0x251472[_0xd177('0x55')]['id'];}return db['ServicenowAccount'][_0xd177('0x57')]({'where':{'id':_0x251472[_0xd177('0x51')]['id']}})[_0xd177('0x1c')](handleEntityNotFound(_0x42cb93,null))['then'](function(_0x5981d9){if(_0x5981d9){_0x251472['body'][_0xd177('0x5c')]=_0x5981d9['id'];_0x251472[_0xd177('0x55')][_0xd177('0x5d')]=integrations[_0xd177('0x5e')](_0x251472[_0xd177('0x55')][_0xd177('0x5f')],_0x251472[_0xd177('0x55')][_0xd177('0x3c')]);_0x251472[_0xd177('0x55')][_0xd177('0x60')]=integrations[_0xd177('0x61')](_0x251472[_0xd177('0x55')][_0xd177('0x5f')],_0x251472['body']['type']);return db[_0xd177('0x58')]['create'](_0x251472[_0xd177('0x55')],{'include':[{'model':db[_0xd177('0x62')],'as':'Subjects'},{'model':db['ServicenowField'],'as':_0xd177('0x60')}]});}return null;})['then'](respondWithResult(_0x42cb93,null))['catch'](handleError(_0x42cb93,null));};exports[_0xd177('0x63')]=function(_0x1e5d0e,_0x483473,_0x4ea3cd){var _0x116f57=[_0xd177('0x64'),'hold_reason',_0xd177('0x65'),'subcategory','close_code',_0xd177('0x66'),_0xd177('0x67'),_0xd177('0x68'),_0xd177('0x69')];var _0x2db873=[_0xd177('0x6a'),_0xd177('0x64'),_0xd177('0x6b'),_0xd177('0x6c'),_0xd177('0x6d'),'sys_updated_on',_0xd177('0x6e'),_0xd177('0x6f'),_0xd177('0x70'),_0xd177('0x71'),_0xd177('0x72'),_0xd177('0x73'),_0xd177('0x74'),_0xd177('0x75'),'sys_created_on',_0xd177('0x76'),_0xd177('0x77'),_0xd177('0x78'),_0xd177('0x65'),_0xd177('0x59'),_0xd177('0x79'),_0xd177('0x7a'),_0xd177('0x7b'),_0xd177('0x7c'),_0xd177('0x7d'),'active','work_notes_list',_0xd177('0x7e'),_0xd177('0x7f'),'sys_domain_path',_0xd177('0x80'),_0xd177('0x81'),_0xd177('0x82'),'opened_at','business_duration','group_list',_0xd177('0x83'),_0xd177('0x84'),'resolved_at',_0xd177('0x85'),'approval_set',_0xd177('0x86'),_0xd177('0x87'),'short_description',_0xd177('0x88'),_0xd177('0x89'),_0xd177('0x8a'),_0xd177('0x8b'),'assignment_group',_0xd177('0x8c'),_0xd177('0x8d'),'description',_0xd177('0x8e'),_0xd177('0x66'),_0xd177('0x8f'),_0xd177('0x90'),_0xd177('0x91'),_0xd177('0x92'),_0xd177('0x93'),_0xd177('0x94'),_0xd177('0x95'),_0xd177('0x96'),'incident_state','urgency',_0xd177('0x97'),_0xd177('0x98'),_0xd177('0x99'),_0xd177('0x9a'),_0xd177('0x9b'),_0xd177('0x68'),_0xd177('0x9c'),'sla_due',_0xd177('0x9d'),_0xd177('0x9e'),_0xd177('0x9f'),_0xd177('0xa0'),_0xd177('0xa1'),_0xd177('0xa2'),_0xd177('0xa3'),_0xd177('0xa4'),'correlation_id',_0xd177('0xa5'),_0xd177('0x69')];var _0x4bebf7='';var _0x218aa5='';var _0x3ac0f7=[];var _0x135a42='';var _0x3a70fa='';var _0x274313=[];var _0x1a48ee='';var _0x440306='';var _0x1a079d={};var _0x18cfbe='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x1e5d0e[_0xd177('0x51')]['id']},'attributes':['id',_0xd177('0xa6'),_0xd177('0xa7'),_0xd177('0xa8'),'remoteUri',_0xd177('0xa9')]})[_0xd177('0x1c')](handleEntityNotFound(_0x483473,null))[_0xd177('0x1c')](function(_0x238c89){if(_0x238c89){_0x18cfbe=_0x238c89['remoteUri'];var _0x17d415=_0x18cfbe['slice'](-0x1);if(_0x17d415==='/'){_0x18cfbe=_0x18cfbe[_0xd177('0xaa')](0x0,_0x18cfbe['lastIndexOf'](_0x17d415));}_0x440306=util[_0xd177('0xab')]('%s/api/now/doc/table/schema/',_0x18cfbe);_0x1a48ee=util[_0xd177('0xab')](_0xd177('0xac'),_0x18cfbe);_0x1a079d={'user':_0x238c89[_0xd177('0xa6')],'pass':_0x238c89[_0xd177('0xa7')]};var _0x4ecb1a={'method':'GET','uri':_0x440306+_0xd177('0xad'),'auth':_0x1a079d,'json':!![]};return rp(_0x4ecb1a);}})[_0xd177('0x1c')](function(_0xbb4063){if(_0xbb4063[_0xd177('0x26')][_0xd177('0x44')]>0x0){_0x4bebf7=_0xbb4063['result'];}console[_0xd177('0xae')]('incident\x20table\x20objects',_0x4bebf7);_0x274313=[];_0x218aa5=Object[_0xd177('0xaf')]([],_0x4bebf7);_[_0xd177('0xb0')](_0x218aa5,function(_0x40fdfe){return!_0x116f57[_0xd177('0xb1')](_0x40fdfe[_0xd177('0x36')]);});_0x218aa5[_0xd177('0xb2')](function(_0x57ccc6){var _0x401338=createFieldObject(_0x1a48ee,_0x1a079d,_0x57ccc6['internalType'],_0x57ccc6['name'],_0x57ccc6[_0xd177('0xb3')],![]);_0x274313[_0xd177('0xb4')](_0x401338);});return Promise[_0xd177('0xb5')](_0x274313);})[_0xd177('0x1c')](function(_0x2c5a67){_0x3ac0f7=_0x2c5a67;_0x135a42=Object[_0xd177('0xaf')]([],_0x4bebf7);console[_0xd177('0xae')](_0xd177('0xb6'),_0x4bebf7);_[_0xd177('0xb0')](_0x135a42,function(_0x214291){return _0x2db873[_0xd177('0xb1')](_0x214291[_0xd177('0x36')]);});console['log'](_0xd177('0xb7'),_0x135a42);_0x274313=[];_0x135a42[_0xd177('0xb2')](function(_0x5451f3){var _0x301ac1=createFieldObject(_0x1a48ee,_0x1a079d,_0x5451f3[_0xd177('0xb8')],_0x5451f3['name'],_0x5451f3[_0xd177('0xb3')],!![]);_0x274313[_0xd177('0xb4')](_0x301ac1);});return Promise[_0xd177('0xb5')](_0x274313);})[_0xd177('0x1c')](function(_0x59deaf){_0x3a70fa=_0x59deaf;var _0x2a67fc=_0x3ac0f7[_0xd177('0xb9')](_0x3a70fa);return{'count':_0x2a67fc[_0xd177('0x44')],'rows':_0x2a67fc};})['then'](respondWithResult(_0x483473,null))[_0xd177('0x27')](function(_0x50e8c9){console[_0xd177('0xae')](_0xd177('0xba')+_0x50e8c9);var _0x528338=_0x1e5d0e[_0xd177('0x3e')][_0xd177('0x18')]?0x1f4:_0x50e8c9['statusCode']||0x1f4;logger[_0xd177('0x23')](_0x50e8c9[_0xd177('0xbb')]);delete _0x50e8c9[_0xd177('0x36')];if(_0x528338===0x191){_0x528338=0x190;}_0x483473['status'](_0x528338)['send'](_0x1e5d0e['query'][_0xd177('0x18')]?{'message':_0xd177('0xbc'),'statusCode':_0x50e8c9[_0xd177('0xbd')]}:_0x50e8c9);});};function createFieldObject(_0x2be0d6,_0x4fde84,_0x3dd0d9,_0x35621e,_0x1fddc9,_0x101fed){return new Promise(function(_0x20eb81,_0x33436f){var _0x510b4d={'id':_0x35621e,'name':_0x1fddc9,'custom':_0x101fed};if(_0x3dd0d9===_0xd177('0xbe')){_0x510b4d[_0xd177('0x4c')]=[{'name':'True','value':_0xd177('0xbf')},{'name':_0xd177('0xc0'),'value':_0xd177('0xc1')}];_0x20eb81(_0x510b4d);}else{var _0x389a3e={'method':_0xd177('0xc2'),'uri':_0x2be0d6+_0xd177('0xc3')+_0x35621e,'auth':_0x4fde84,'json':!![]};return rp(_0x389a3e)[_0xd177('0x1c')](function(_0x3e8eeb){var _0xae0556=[];if(_0x3e8eeb[_0xd177('0x26')][_0xd177('0x44')]>0x0){_0x3e8eeb[_0xd177('0x26')][_0xd177('0xb2')](function(_0x5af152){if(_0x5af152[_0xd177('0xc4')]===_0xd177('0xc1')){var _0x2bdb2a={'name':_0x5af152[_0xd177('0xb3')],'value':_0x5af152[_0xd177('0xc5')]};_0xae0556[_0xd177('0xb4')](_0x2bdb2a);}});}_0x510b4d[_0xd177('0x4c')]=_0xae0556;if(_0x510b4d['options']['length']>0x0){_0x20eb81(_0x510b4d);}else{if(_0x101fed==![]){_0x20eb81();}else{_0x20eb81(_0x510b4d);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 691c175..2e6cbd6 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.model.js +++ b/server/api/intServicenowAccount/intServicenowAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab1e=['moment','bluebird','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','define','lodash','util','api'];(function(_0x1d5ea9,_0x376bc2){var _0x227511=function(_0x278eb3){while(--_0x278eb3){_0x1d5ea9['push'](_0x1d5ea9['shift']());}};_0x227511(++_0x376bc2);}(_0xab1e,0x173));var _0xeab1=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xab1e[_0x4b7895];return _0x264180;};'use strict';var _=require(_0xeab1('0x0'));var util=require(_0xeab1('0x1'));var logger=require('../../config/logger')(_0xeab1('0x2'));var moment=require(_0xeab1('0x3'));var BPromise=require(_0xeab1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeab1('0x5'));var rimraf=require(_0xeab1('0x6'));var config=require(_0xeab1('0x7'));var attributes=require(_0xeab1('0x8'));var integrations=require(_0xeab1('0x9'));module['exports']=function(_0x10da89,_0x5f1cac){return _0x10da89[_0xeab1('0xa')]('ServicenowAccount',attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1045=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','int_servicenow_accounts'];(function(_0x450b00,_0x1cc659){var _0x219b54=function(_0x46fd91){while(--_0x46fd91){_0x450b00['push'](_0x450b00['shift']());}};_0x219b54(++_0x1cc659);}(_0x1045,0xb4));var _0x5104=function(_0x5d0db2,_0x29d33f){_0x5d0db2=_0x5d0db2-0x0;var _0x2d6bdf=_0x1045[_0x5d0db2];return _0x2d6bdf;};'use strict';var _=require(_0x5104('0x0'));var util=require('util');var logger=require(_0x5104('0x1'))(_0x5104('0x2'));var moment=require(_0x5104('0x3'));var BPromise=require(_0x5104('0x4'));var rp=require(_0x5104('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5104('0x6'));var config=require('../../config/environment');var attributes=require(_0x5104('0x7'));var integrations=require(_0x5104('0x8'));module['exports']=function(_0xfb896b,_0x1c9ad4){return _0xfb896b[_0x5104('0x9')](_0x5104('0xa'),attributes,{'tableName':_0x5104('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 985ec27..b81b325 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.rpc.js +++ b/server/api/intServicenowAccount/intServicenowAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f31=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','ServicenowAccount','findAll','options','where','attributes','map','include','model','GetServicenowAccount','ShowServicenowAccount','find','raw','lodash'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x4f31,0xfb));var _0x14f3=function(_0x36a02f,_0x239521){_0x36a02f=_0x36a02f-0x0;var _0x2b56b3=_0x4f31[_0x36a02f];return _0x2b56b3;};'use strict';var _=require(_0x14f3('0x0'));var util=require(_0x14f3('0x1'));var moment=require(_0x14f3('0x2'));var BPromise=require(_0x14f3('0x3'));var rs=require(_0x14f3('0x4'));var fs=require('fs');var Redis=require(_0x14f3('0x5'));var db=require(_0x14f3('0x6'))['db'];var utils=require(_0x14f3('0x7'));var logger=require('../../config/logger')(_0x14f3('0x8'));var config=require('../../config/environment');var jayson=require(_0x14f3('0x9'));var client=jayson[_0x14f3('0xa')][_0x14f3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ce2de,_0x573e72,_0x35df30){return new BPromise(function(_0x3e0ede,_0x269af2){return client[_0x14f3('0xc')](_0x1ce2de,_0x35df30)[_0x14f3('0xd')](function(_0x36e3cf){logger[_0x14f3('0xe')](_0x14f3('0xf'),_0x573e72,'request\x20sent');logger[_0x14f3('0x10')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x573e72,_0x14f3('0x11'),JSON[_0x14f3('0x12')](_0x36e3cf));if(_0x36e3cf['error']){if(_0x36e3cf[_0x14f3('0x13')][_0x14f3('0x14')]===0x1f4){logger[_0x14f3('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x573e72,_0x36e3cf[_0x14f3('0x13')][_0x14f3('0x15')]);return _0x269af2(_0x36e3cf[_0x14f3('0x13')][_0x14f3('0x15')]);}logger[_0x14f3('0x13')](_0x14f3('0xf'),_0x573e72,_0x36e3cf[_0x14f3('0x13')]['message']);return _0x3e0ede(_0x36e3cf['error']['message']);}else{logger[_0x14f3('0xe')](_0x14f3('0xf'),_0x573e72,'request\x20sent');_0x3e0ede(_0x36e3cf[_0x14f3('0x16')][_0x14f3('0x15')]);}})[_0x14f3('0x17')](function(_0x1fa2b8){logger['error'](_0x14f3('0xf'),_0x573e72,_0x1fa2b8);_0x269af2(_0x1fa2b8);});});}exports['GetServicenowAccount']=function(_0x1a47ba){var _0x555d1f=this;return new Promise(function(_0x27c8d7,_0x1e359c){return db[_0x14f3('0x18')][_0x14f3('0x19')]({'raw':_0x1a47ba[_0x14f3('0x1a')]?_0x1a47ba[_0x14f3('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1a47ba['options']?_0x1a47ba[_0x14f3('0x1a')][_0x14f3('0x1b')]||null:null,'attributes':_0x1a47ba[_0x14f3('0x1a')]?_0x1a47ba[_0x14f3('0x1a')][_0x14f3('0x1c')]||null:null,'limit':_0x1a47ba[_0x14f3('0x1a')]?_0x1a47ba[_0x14f3('0x1a')]['limit']||null:null,'include':_0x1a47ba['options']?_0x1a47ba[_0x14f3('0x1a')]['include']?_[_0x14f3('0x1d')](_0x1a47ba[_0x14f3('0x1a')][_0x14f3('0x1e')],function(_0x2051d2){return{'model':db[_0x2051d2[_0x14f3('0x1f')]],'as':_0x2051d2['as'],'attributes':_0x2051d2['attributes'],'include':_0x2051d2[_0x14f3('0x1e')]?_[_0x14f3('0x1d')](_0x2051d2[_0x14f3('0x1e')],function(_0x30f50b){return{'model':db[_0x30f50b[_0x14f3('0x1f')]],'as':_0x30f50b['as'],'attributes':_0x30f50b['attributes'],'include':_0x30f50b['include']?_[_0x14f3('0x1d')](_0x30f50b[_0x14f3('0x1e')],function(_0xb63786){return{'model':db[_0xb63786['model']],'as':_0xb63786['as'],'attributes':_0xb63786[_0x14f3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x14f3('0xd')](function(_0x73fe9){logger[_0x14f3('0xe')]('GetServicenowAccount',_0x1a47ba);logger[_0x14f3('0x10')](_0x14f3('0x20'),_0x1a47ba,JSON['stringify'](_0x73fe9));_0x27c8d7(_0x73fe9);})[_0x14f3('0x17')](function(_0x519b56){logger['error']('GetServicenowAccount',_0x519b56[_0x14f3('0x15')],_0x1a47ba);_0x1e359c(_0x555d1f[_0x14f3('0x13')](0x1f4,_0x519b56[_0x14f3('0x15')]));});});};exports[_0x14f3('0x21')]=function(_0x5f5cf7){var _0xe8734a=this;return new Promise(function(_0x14a6a8,_0x1d7090){return db[_0x14f3('0x18')][_0x14f3('0x22')]({'raw':_0x5f5cf7[_0x14f3('0x1a')]?_0x5f5cf7[_0x14f3('0x1a')][_0x14f3('0x23')]===undefined?!![]:![]:!![],'where':_0x5f5cf7[_0x14f3('0x1a')]?_0x5f5cf7[_0x14f3('0x1a')][_0x14f3('0x1b')]||null:null,'attributes':_0x5f5cf7[_0x14f3('0x1a')]?_0x5f5cf7['options'][_0x14f3('0x1c')]||null:null,'include':_0x5f5cf7['options']?_0x5f5cf7[_0x14f3('0x1a')][_0x14f3('0x1e')]?_[_0x14f3('0x1d')](_0x5f5cf7[_0x14f3('0x1a')][_0x14f3('0x1e')],function(_0x522ba5){return{'model':db[_0x522ba5[_0x14f3('0x1f')]],'as':_0x522ba5['as'],'attributes':_0x522ba5['attributes'],'include':_0x522ba5[_0x14f3('0x1e')]?_[_0x14f3('0x1d')](_0x522ba5[_0x14f3('0x1e')],function(_0x286dad){return{'model':db[_0x286dad['model']],'as':_0x286dad['as'],'attributes':_0x286dad['attributes'],'include':_0x286dad[_0x14f3('0x1e')]?_[_0x14f3('0x1d')](_0x286dad['include'],function(_0x310a46){return{'model':db[_0x310a46['model']],'as':_0x310a46['as'],'attributes':_0x310a46[_0x14f3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x14f3('0xd')](function(_0x3aaac1){logger[_0x14f3('0xe')](_0x14f3('0x21'),_0x5f5cf7);logger[_0x14f3('0x10')](_0x14f3('0x21'),_0x5f5cf7,JSON['stringify'](_0x3aaac1));_0x14a6a8(_0x3aaac1);})[_0x14f3('0x17')](function(_0x1f73ea){logger[_0x14f3('0x13')](_0x14f3('0x21'),_0x1f73ea['message'],_0x5f5cf7);_0x1d7090(_0xe8734a[_0x14f3('0x13')](0x1f4,_0x1f73ea[_0x14f3('0x15')]));});});}; \ No newline at end of file +var _0x2acd=['findAll','options','raw','where','attributes','include','map','model','debug','ShowServicenowAccount','find','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetServicenowAccount','ServicenowAccount'];(function(_0x5b3820,_0x51889c){var _0x442af8=function(_0x597ee1){while(--_0x597ee1){_0x5b3820['push'](_0x5b3820['shift']());}};_0x442af8(++_0x51889c);}(_0x2acd,0xeb));var _0xd2ac=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2acd[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xd2ac('0x0'));var util=require(_0xd2ac('0x1'));var moment=require(_0xd2ac('0x2'));var BPromise=require('bluebird');var rs=require(_0xd2ac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd2ac('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd2ac('0x5'))(_0xd2ac('0x6'));var config=require(_0xd2ac('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd2ac('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d9aa7,_0x44de04,_0x374075){return new BPromise(function(_0x3c1b76,_0x550609){return client[_0xd2ac('0x9')](_0x1d9aa7,_0x374075)[_0xd2ac('0xa')](function(_0x4a3884){logger[_0xd2ac('0xb')](_0xd2ac('0xc'),_0x44de04,_0xd2ac('0xd'));logger['debug'](_0xd2ac('0xe'),_0x44de04,_0xd2ac('0xd'),JSON[_0xd2ac('0xf')](_0x4a3884));if(_0x4a3884[_0xd2ac('0x10')]){if(_0x4a3884[_0xd2ac('0x10')]['code']===0x1f4){logger[_0xd2ac('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x44de04,_0x4a3884[_0xd2ac('0x10')][_0xd2ac('0x11')]);return _0x550609(_0x4a3884[_0xd2ac('0x10')][_0xd2ac('0x11')]);}logger[_0xd2ac('0x10')](_0xd2ac('0xc'),_0x44de04,_0x4a3884[_0xd2ac('0x10')][_0xd2ac('0x11')]);return _0x3c1b76(_0x4a3884[_0xd2ac('0x10')]['message']);}else{logger[_0xd2ac('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x44de04,_0xd2ac('0xd'));_0x3c1b76(_0x4a3884['result'][_0xd2ac('0x11')]);}})[_0xd2ac('0x12')](function(_0x3fc239){logger['error'](_0xd2ac('0xc'),_0x44de04,_0x3fc239);_0x550609(_0x3fc239);});});}exports[_0xd2ac('0x13')]=function(_0x5b16e9){var _0x434158=this;return new Promise(function(_0x3262bc,_0x4e4d2a){return db[_0xd2ac('0x14')][_0xd2ac('0x15')]({'raw':_0x5b16e9[_0xd2ac('0x16')]?_0x5b16e9[_0xd2ac('0x16')][_0xd2ac('0x17')]===undefined?!![]:![]:!![],'where':_0x5b16e9[_0xd2ac('0x16')]?_0x5b16e9[_0xd2ac('0x16')][_0xd2ac('0x18')]||null:null,'attributes':_0x5b16e9['options']?_0x5b16e9[_0xd2ac('0x16')][_0xd2ac('0x19')]||null:null,'limit':_0x5b16e9[_0xd2ac('0x16')]?_0x5b16e9[_0xd2ac('0x16')]['limit']||null:null,'include':_0x5b16e9[_0xd2ac('0x16')]?_0x5b16e9[_0xd2ac('0x16')][_0xd2ac('0x1a')]?_['map'](_0x5b16e9[_0xd2ac('0x16')]['include'],function(_0x185df2){return{'model':db[_0x185df2['model']],'as':_0x185df2['as'],'attributes':_0x185df2['attributes'],'include':_0x185df2[_0xd2ac('0x1a')]?_[_0xd2ac('0x1b')](_0x185df2[_0xd2ac('0x1a')],function(_0x5d93cf){return{'model':db[_0x5d93cf[_0xd2ac('0x1c')]],'as':_0x5d93cf['as'],'attributes':_0x5d93cf[_0xd2ac('0x19')],'include':_0x5d93cf[_0xd2ac('0x1a')]?_[_0xd2ac('0x1b')](_0x5d93cf['include'],function(_0x560957){return{'model':db[_0x560957[_0xd2ac('0x1c')]],'as':_0x560957['as'],'attributes':_0x560957[_0xd2ac('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd2ac('0xa')](function(_0x4b32b4){logger[_0xd2ac('0xb')](_0xd2ac('0x13'),_0x5b16e9);logger[_0xd2ac('0x1d')](_0xd2ac('0x13'),_0x5b16e9,JSON['stringify'](_0x4b32b4));_0x3262bc(_0x4b32b4);})[_0xd2ac('0x12')](function(_0x589567){logger[_0xd2ac('0x10')](_0xd2ac('0x13'),_0x589567[_0xd2ac('0x11')],_0x5b16e9);_0x4e4d2a(_0x434158[_0xd2ac('0x10')](0x1f4,_0x589567['message']));});});};exports[_0xd2ac('0x1e')]=function(_0x338e3d){var _0x404a88=this;return new Promise(function(_0x36e430,_0x3258f8){return db[_0xd2ac('0x14')][_0xd2ac('0x1f')]({'raw':_0x338e3d[_0xd2ac('0x16')]?_0x338e3d[_0xd2ac('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x338e3d['options']?_0x338e3d[_0xd2ac('0x16')][_0xd2ac('0x18')]||null:null,'attributes':_0x338e3d['options']?_0x338e3d[_0xd2ac('0x16')][_0xd2ac('0x19')]||null:null,'include':_0x338e3d[_0xd2ac('0x16')]?_0x338e3d['options'][_0xd2ac('0x1a')]?_[_0xd2ac('0x1b')](_0x338e3d[_0xd2ac('0x16')]['include'],function(_0x513f2c){return{'model':db[_0x513f2c[_0xd2ac('0x1c')]],'as':_0x513f2c['as'],'attributes':_0x513f2c['attributes'],'include':_0x513f2c[_0xd2ac('0x1a')]?_[_0xd2ac('0x1b')](_0x513f2c[_0xd2ac('0x1a')],function(_0x397f87){return{'model':db[_0x397f87[_0xd2ac('0x1c')]],'as':_0x397f87['as'],'attributes':_0x397f87['attributes'],'include':_0x397f87[_0xd2ac('0x1a')]?_[_0xd2ac('0x1b')](_0x397f87[_0xd2ac('0x1a')],function(_0x39b1a5){return{'model':db[_0x39b1a5[_0xd2ac('0x1c')]],'as':_0x39b1a5['as'],'attributes':_0x39b1a5[_0xd2ac('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd2ac('0xa')](function(_0x313679){logger['info'](_0xd2ac('0x1e'),_0x338e3d);logger['debug'](_0xd2ac('0x1e'),_0x338e3d,JSON['stringify'](_0x313679));_0x36e430(_0x313679);})[_0xd2ac('0x12')](function(_0x5e813e){logger[_0xd2ac('0x10')](_0xd2ac('0x1e'),_0x5e813e[_0xd2ac('0x11')],_0x338e3d);_0x3258f8(_0x404a88[_0xd2ac('0x10')](0x1f4,_0x5e813e['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 46e250b..a49c5ef 100644 --- a/server/api/intServicenowConfiguration/index.js +++ b/server/api/intServicenowConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x496d=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','multer','util','path'];(function(_0x18929d,_0x58140c){var _0x5dee0a=function(_0x4e6e56){while(--_0x4e6e56){_0x18929d['push'](_0x18929d['shift']());}};_0x5dee0a(++_0x58140c);}(_0x496d,0x17d));var _0xd496=function(_0x579e9e,_0x434822){_0x579e9e=_0x579e9e-0x0;var _0x2cc65d=_0x496d[_0x579e9e];return _0x2cc65d;};'use strict';var multer=require(_0xd496('0x0'));var util=require(_0xd496('0x1'));var path=require(_0xd496('0x2'));var timeout=require(_0xd496('0x3'));var express=require(_0xd496('0x4'));var router=express['Router']();var auth=require(_0xd496('0x5'));var interaction=require(_0xd496('0x6'));var config=require(_0xd496('0x7'));var controller=require(_0xd496('0x8'));router[_0xd496('0x9')]('/',auth[_0xd496('0xa')](),controller[_0xd496('0xb')]);router[_0xd496('0x9')](_0xd496('0xc'),auth[_0xd496('0xa')](),controller[_0xd496('0xd')]);router[_0xd496('0x9')](_0xd496('0xe'),auth['isAuthenticated'](),controller[_0xd496('0xf')]);router[_0xd496('0x9')](_0xd496('0x10'),auth[_0xd496('0xa')](),controller['getSubjects']);router['get'](_0xd496('0x11'),auth['isAuthenticated'](),controller[_0xd496('0x12')]);router['post']('/',auth[_0xd496('0xa')](),controller[_0xd496('0x13')]);router[_0xd496('0x14')](_0xd496('0xc'),auth['isAuthenticated'](),controller[_0xd496('0x15')]);router[_0xd496('0x16')](_0xd496('0xc'),auth[_0xd496('0xa')](),controller[_0xd496('0x17')]);module['exports']=router; \ No newline at end of file +var _0x58c6=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','exports','multer','path'];(function(_0x484d70,_0x25cde6){var _0x310b44=function(_0x1d3e41){while(--_0x1d3e41){_0x484d70['push'](_0x484d70['shift']());}};_0x310b44(++_0x25cde6);}(_0x58c6,0xbb));var _0x658c=function(_0x329d13,_0x1aff27){_0x329d13=_0x329d13-0x0;var _0x33efd9=_0x58c6[_0x329d13];return _0x33efd9;};'use strict';var multer=require(_0x658c('0x0'));var util=require('util');var path=require(_0x658c('0x1'));var timeout=require(_0x658c('0x2'));var express=require(_0x658c('0x3'));var router=express['Router']();var auth=require(_0x658c('0x4'));var interaction=require(_0x658c('0x5'));var config=require(_0x658c('0x6'));var controller=require(_0x658c('0x7'));router[_0x658c('0x8')]('/',auth['isAuthenticated'](),controller[_0x658c('0x9')]);router[_0x658c('0x8')](_0x658c('0xa'),auth[_0x658c('0xb')](),controller[_0x658c('0xc')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x658c('0xd')]);router[_0x658c('0x8')](_0x658c('0xe'),auth[_0x658c('0xb')](),controller[_0x658c('0xf')]);router[_0x658c('0x8')](_0x658c('0x10'),auth[_0x658c('0xb')](),controller[_0x658c('0x11')]);router[_0x658c('0x12')]('/',auth['isAuthenticated'](),controller[_0x658c('0x13')]);router['put'](_0x658c('0xa'),auth[_0x658c('0xb')](),controller['update']);router['delete'](_0x658c('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x658c('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 7a02f38..f7b98ab 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xddf1=['STRING','sequelize','exports'];(function(_0xe495f4,_0x34d15b){var _0x16ccc9=function(_0x2b547b){while(--_0x2b547b){_0xe495f4['push'](_0xe495f4['shift']());}};_0x16ccc9(++_0x34d15b);}(_0xddf1,0x169));var _0x1ddf=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xddf1[_0x36884e];return _0x1cc367;};'use strict';var Sequelize=require(_0x1ddf('0x0'));module[_0x1ddf('0x1')]={'name':{'type':Sequelize[_0x1ddf('0x2')]},'description':{'type':Sequelize[_0x1ddf('0x2')]}}; \ No newline at end of file +var _0xe937=['exports'];(function(_0x5853c4,_0x50f8b2){var _0x32c6cf=function(_0x44eefd){while(--_0x44eefd){_0x5853c4['push'](_0x5853c4['shift']());}};_0x32c6cf(++_0x50f8b2);}(_0xe937,0xbc));var _0x7e93=function(_0x3c67cc,_0x4c6c00){_0x3c67cc=_0x3c67cc-0x0;var _0x265be5=_0xe937[_0x3c67cc];return _0x265be5;};'use strict';var Sequelize=require('sequelize');module[_0x7e93('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 0740736..eea2aa3 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['save','update','destroy','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','includeAll','rows','show','params','include','options','catch','create','body','find','findOne','getFields','getSubjects','ServicenowField','getDescriptions','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','ServicenowConfiguration,\x20%s,\x20%s','result','sendStatus','end','json','count','offset','status','set','apply','reject'];(function(_0x512c12,_0x2c5608){var _0x340a33=function(_0x8852e1){while(--_0x8852e1){_0x512c12['push'](_0x512c12['shift']());}};_0x340a33(++_0x2c5608);}(_0x757a,0xde));var _0xa757=function(_0x18a2c1,_0x147893){_0x18a2c1=_0x18a2c1-0x0;var _0x301148=_0x757a[_0x18a2c1];return _0x301148;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa757('0x0'));var rimraf=require(_0xa757('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa757('0x2'));var BPromise=require(_0xa757('0x3'));var Mustache=require(_0xa757('0x4'));var util=require(_0xa757('0x5'));var path=require(_0xa757('0x6'));var sox=require(_0xa757('0x7'));var csv=require('to-csv');var ejs=require(_0xa757('0x8'));var fs=require('fs');var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0xd'));var querystring=require(_0xa757('0xe'));var Papa=require('papaparse');var Redis=require(_0xa757('0xf'));var authService=require(_0xa757('0x10'));var qs=require(_0xa757('0x11'));var as=require(_0xa757('0x12'));var hardwareService=require(_0xa757('0x13'));var logger=require(_0xa757('0x14'))(_0xa757('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa757('0x16')]({'port':0x232a});function checkPasswordPattern(_0x544b45,_0x564187,_0x2ed0d2){if(_0x2ed0d2){var _0x513b1f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x513b1f['test'](_0x564187)){return _0x544b45;}else{throw new db[(_0xa757('0x17'))][(_0xa757('0x18'))](_0xa757('0x19'));}}else{return _0x544b45;}}function respondWithRpcPromise(_0x4a0c38,_0x86abd,_0x31cfd2,_0xf12b68){return new BPromise(function(_0x2f7947,_0x185011){var _0x3df1f9=_0xf12b68||client;return _0x3df1f9['request'](_0x4a0c38,_0x31cfd2)[_0xa757('0x1a')](function(_0x44eab8){logger[_0xa757('0x1b')]('ServicenowConfiguration,\x20%s,\x20%s',_0x86abd,'request\x20sent');logger[_0xa757('0x1c')](_0xa757('0x1d'),_0x86abd,_0xa757('0x1e'),JSON[_0xa757('0x1f')](_0x44eab8));if(_0x44eab8[_0xa757('0x20')]){if(_0x44eab8[_0xa757('0x20')]['code']===0x1f4){logger[_0xa757('0x20')]('ServicenowConfiguration,\x20%s,\x20%s',_0x86abd,_0x44eab8[_0xa757('0x20')][_0xa757('0x21')]);return _0x185011(_0x44eab8[_0xa757('0x20')][_0xa757('0x21')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x86abd,_0x44eab8[_0xa757('0x20')][_0xa757('0x21')]);return _0x2f7947(_0x44eab8[_0xa757('0x20')][_0xa757('0x21')]);}else{logger[_0xa757('0x1b')](_0xa757('0x22'),_0x86abd,_0xa757('0x1e'));_0x2f7947(_0x44eab8[_0xa757('0x23')][_0xa757('0x21')]);}})['catch'](function(_0x3707c1){logger['error'](_0xa757('0x22'),_0x86abd,_0x3707c1);_0x185011(_0x3707c1);});});}function respondWithStatusCode(_0x47903b,_0x40551d){_0x40551d=_0x40551d||0xcc;return function(_0x3859ce){if(_0x3859ce){return _0x47903b[_0xa757('0x24')](_0x40551d);}return _0x47903b['status'](_0x40551d)[_0xa757('0x25')]();};}function respondWithResult(_0xcd98bd,_0x471e84){_0x471e84=_0x471e84||0xc8;return function(_0x3bf7f3){if(_0x3bf7f3){return _0xcd98bd['status'](_0x471e84)[_0xa757('0x26')](_0x3bf7f3);}};}function respondWithFilteredResult(_0x54263b,_0x5a5664){return function(_0x54b75e){if(_0x54b75e){var _0x4f8de2=_0x54b75e[_0xa757('0x27')],_0xfdf69d=_0x5a5664['offset'],_0x596ae2=_0x5a5664[_0xa757('0x28')]+_0x5a5664['limit'],_0x2208f9;if(_0x596ae2>=_0x4f8de2){_0x596ae2=_0x4f8de2;_0x2208f9=0xc8;}else{_0x2208f9=0xce;}_0x54263b[_0xa757('0x29')](_0x2208f9);return _0x54263b[_0xa757('0x2a')]('Content-Range',_0xfdf69d+'-'+_0x596ae2+'/'+_0x4f8de2)[_0xa757('0x26')](_0x54b75e);}return null;};}function patchUpdates(_0x5ade7b){return function(_0x3a4a66){try{jsonpatch[_0xa757('0x2b')](_0x3a4a66,_0x5ade7b,!![]);}catch(_0x458974){return BPromise[_0xa757('0x2c')](_0x458974);}return _0x3a4a66[_0xa757('0x2d')]();};}function saveUpdates(_0x2c1885,_0x1a44a9){return function(_0x2220df){if(_0x2220df){return _0x2220df[_0xa757('0x2e')](_0x2c1885)[_0xa757('0x1a')](function(_0x1f5d5a){return _0x1f5d5a;});}return null;};}function removeEntity(_0x20735f,_0x25dfbb){return function(_0x2dfb33){if(_0x2dfb33){return _0x2dfb33[_0xa757('0x2f')]()[_0xa757('0x1a')](function(){_0x20735f[_0xa757('0x29')](0xcc)[_0xa757('0x25')]();});}};}function handleEntityNotFound(_0x1eacde,_0x29a5ba){return function(_0x3de18f){if(!_0x3de18f){_0x1eacde[_0xa757('0x24')](0x194);}return _0x3de18f;};}function handleError(_0x379de7,_0x3aae1e){_0x3aae1e=_0x3aae1e||0x1f4;return function(_0x59700d){logger[_0xa757('0x20')](_0x59700d[_0xa757('0x30')]);if(_0x59700d[_0xa757('0x31')]){delete _0x59700d[_0xa757('0x31')];}_0x379de7[_0xa757('0x29')](_0x3aae1e)['send'](_0x59700d);};}exports[_0xa757('0x32')]=function(_0x2af470,_0x37b1a3){var _0x2c34b1={},_0xd54446={},_0xc97cb8={'count':0x0,'rows':[]};var _0x499390=_[_0xa757('0x33')](db[_0xa757('0x34')][_0xa757('0x35')],function(_0xc34409){return{'name':_0xc34409[_0xa757('0x36')],'type':_0xc34409[_0xa757('0x37')][_0xa757('0x38')]};});_0xd54446[_0xa757('0x39')]=_[_0xa757('0x33')](_0x499390,'name');_0xd54446[_0xa757('0x3a')]=_[_0xa757('0x3b')](_0x2af470[_0xa757('0x3a')]);_0xd54446[_0xa757('0x3c')]=_[_0xa757('0x3d')](_0xd54446[_0xa757('0x39')],_0xd54446['query']);_0x2c34b1[_0xa757('0x3e')]=_[_0xa757('0x3d')](_0xd54446['model'],qs['fields'](_0x2af470[_0xa757('0x3a')][_0xa757('0x3f')]));_0x2c34b1['attributes']=_0x2c34b1['attributes'][_0xa757('0x40')]?_0x2c34b1[_0xa757('0x3e')]:_0xd54446[_0xa757('0x39')];if(!_0x2af470['query'][_0xa757('0x41')](_0xa757('0x42'))){_0x2c34b1[_0xa757('0x43')]=qs[_0xa757('0x43')](_0x2af470[_0xa757('0x3a')]['limit']);_0x2c34b1[_0xa757('0x28')]=qs['offset'](_0x2af470['query'][_0xa757('0x28')]);}_0x2c34b1[_0xa757('0x44')]=qs[_0xa757('0x45')](_0x2af470[_0xa757('0x3a')][_0xa757('0x45')]);_0x2c34b1['where']=qs['filters'](_[_0xa757('0x46')](_0x2af470[_0xa757('0x3a')],_0xd54446[_0xa757('0x3c')]),_0x499390);if(_0x2af470[_0xa757('0x3a')][_0xa757('0x47')]){_0x2c34b1[_0xa757('0x48')]=_['merge'](_0x2c34b1[_0xa757('0x48')],{'$or':_[_0xa757('0x33')](_0x499390,function(_0x4d66d4){if(_0x4d66d4[_0xa757('0x37')]!=='VIRTUAL'){var _0x2d111e={};_0x2d111e[_0x4d66d4[_0xa757('0x31')]]={'$like':'%'+_0x2af470['query'][_0xa757('0x47')]+'%'};return _0x2d111e;}})});}_0x2c34b1=_[_0xa757('0x49')]({},_0x2c34b1,_0x2af470['options']);var _0x2f4709={'where':_0x2c34b1[_0xa757('0x48')]};return db[_0xa757('0x34')][_0xa757('0x27')](_0x2f4709)['then'](function(_0x199dc9){_0xc97cb8[_0xa757('0x27')]=_0x199dc9;if(_0x2af470[_0xa757('0x3a')][_0xa757('0x4a')]){_0x2c34b1['include']=[{'all':!![]}];}return db[_0xa757('0x34')]['findAll'](_0x2c34b1);})['then'](function(_0x2acf88){_0xc97cb8[_0xa757('0x4b')]=_0x2acf88;return _0xc97cb8;})[_0xa757('0x1a')](respondWithFilteredResult(_0x37b1a3,_0x2c34b1))['catch'](handleError(_0x37b1a3,null));};exports[_0xa757('0x4c')]=function(_0x560c6c,_0x2ed63f){var _0x151cc3={'raw':![],'where':{'id':_0x560c6c[_0xa757('0x4d')]['id']}},_0x265793={};_0x265793[_0xa757('0x39')]=_[_0xa757('0x3b')](db[_0xa757('0x34')][_0xa757('0x35')]);_0x265793['query']=_[_0xa757('0x3b')](_0x560c6c[_0xa757('0x3a')]);_0x265793[_0xa757('0x3c')]=_[_0xa757('0x3d')](_0x265793[_0xa757('0x39')],_0x265793[_0xa757('0x3a')]);_0x151cc3[_0xa757('0x3e')]=_[_0xa757('0x3d')](_0x265793[_0xa757('0x39')],qs[_0xa757('0x3f')](_0x560c6c[_0xa757('0x3a')][_0xa757('0x3f')]));_0x151cc3[_0xa757('0x3e')]=_0x151cc3[_0xa757('0x3e')][_0xa757('0x40')]?_0x151cc3[_0xa757('0x3e')]:_0x265793['model'];if(_0x560c6c[_0xa757('0x3a')]['includeAll']){_0x151cc3[_0xa757('0x4e')]=[{'all':!![]}];}_0x151cc3=_[_0xa757('0x49')]({},_0x151cc3,_0x560c6c[_0xa757('0x4f')]);return db[_0xa757('0x34')]['find'](_0x151cc3)[_0xa757('0x1a')](handleEntityNotFound(_0x2ed63f,null))[_0xa757('0x1a')](respondWithResult(_0x2ed63f,null))[_0xa757('0x50')](handleError(_0x2ed63f,null));};exports[_0xa757('0x51')]=function(_0x595f16,_0x383674){return db[_0xa757('0x34')][_0xa757('0x51')](_0x595f16[_0xa757('0x52')],{})[_0xa757('0x1a')](respondWithResult(_0x383674,0xc9))[_0xa757('0x50')](handleError(_0x383674,null));};exports['update']=function(_0x485100,_0x5d21c1){if(_0x485100['body']['id']){delete _0x485100[_0xa757('0x52')]['id'];}return db[_0xa757('0x34')][_0xa757('0x53')]({'where':{'id':_0x485100[_0xa757('0x4d')]['id']}})[_0xa757('0x1a')](handleEntityNotFound(_0x5d21c1,null))[_0xa757('0x1a')](saveUpdates(_0x485100['body'],null))[_0xa757('0x1a')](respondWithResult(_0x5d21c1,null))[_0xa757('0x50')](handleError(_0x5d21c1,null));};exports[_0xa757('0x2f')]=function(_0x29b2f5,_0x48b578){return db[_0xa757('0x34')][_0xa757('0x53')]({'where':{'id':_0x29b2f5['params']['id']}})[_0xa757('0x1a')](handleEntityNotFound(_0x48b578,null))['then'](removeEntity(_0x48b578,null))[_0xa757('0x50')](handleError(_0x48b578,null));};exports['getFields']=function(_0x51be6e,_0x58633a,_0x4badee){var _0x367b48={};var _0x235c1e={};var _0x1b6058;var _0x1b5db5;return db[_0xa757('0x34')][_0xa757('0x54')]({'where':{'id':_0x51be6e['params']['id']}})['then'](handleEntityNotFound(_0x58633a,null))[_0xa757('0x1a')](function(_0x3afa56){if(_0x3afa56){_0x1b6058=_0x3afa56;_0x235c1e[_0xa757('0x39')]=_['keys'](db['ServicenowField'][_0xa757('0x35')]);_0x235c1e[_0xa757('0x3a')]=_[_0xa757('0x3b')](_0x51be6e[_0xa757('0x3a')]);_0x235c1e[_0xa757('0x3c')]=_[_0xa757('0x3d')](_0x235c1e['model'],_0x235c1e[_0xa757('0x3a')]);_0x367b48[_0xa757('0x3e')]=_[_0xa757('0x3d')](_0x235c1e[_0xa757('0x39')],qs[_0xa757('0x3f')](_0x51be6e[_0xa757('0x3a')][_0xa757('0x3f')]));_0x367b48[_0xa757('0x3e')]=_0x367b48[_0xa757('0x3e')][_0xa757('0x40')]?_0x367b48['attributes']:_0x235c1e[_0xa757('0x39')];_0x367b48['order']=qs['sort'](_0x51be6e[_0xa757('0x3a')][_0xa757('0x45')]);_0x367b48[_0xa757('0x48')]=qs[_0xa757('0x3c')](_[_0xa757('0x46')](_0x51be6e[_0xa757('0x3a')],_0x235c1e[_0xa757('0x3c')]));if(_0x51be6e[_0xa757('0x3a')][_0xa757('0x47')]){_0x367b48[_0xa757('0x48')]=_[_0xa757('0x49')](_0x367b48['where'],{'$or':_[_0xa757('0x33')](_0x367b48[_0xa757('0x3e')],function(_0x5f0b71){var _0x11ebb3={};_0x11ebb3[_0x5f0b71]={'$like':'%'+_0x51be6e[_0xa757('0x3a')][_0xa757('0x47')]+'%'};return _0x11ebb3;})});}_0x367b48=_[_0xa757('0x49')]({},_0x367b48,_0x51be6e[_0xa757('0x4f')]);return _0x1b6058[_0xa757('0x55')](_0x367b48);}})['then'](function(_0x413217){if(_0x413217){_0x1b5db5=_0x413217['length'];if(!_0x51be6e[_0xa757('0x3a')][_0xa757('0x41')](_0xa757('0x42'))){_0x367b48[_0xa757('0x43')]=qs[_0xa757('0x43')](_0x51be6e['query']['limit']);_0x367b48[_0xa757('0x28')]=qs[_0xa757('0x28')](_0x51be6e[_0xa757('0x3a')]['offset']);}return _0x1b6058[_0xa757('0x55')](_0x367b48);}})['then'](function(_0x34982a){if(_0x34982a){return _0x34982a?{'count':_0x1b5db5,'rows':_0x34982a}:null;}})[_0xa757('0x1a')](respondWithResult(_0x58633a,null))[_0xa757('0x50')](handleError(_0x58633a,null));};exports[_0xa757('0x56')]=function(_0x10cb5e,_0x40a79b,_0x54730c){var _0xa28144={};var _0x193233={};var _0x1e15ee;var _0x125bda;return db[_0xa757('0x34')]['findOne']({'where':{'id':_0x10cb5e[_0xa757('0x4d')]['id']}})[_0xa757('0x1a')](handleEntityNotFound(_0x40a79b,null))[_0xa757('0x1a')](function(_0x38724c){if(_0x38724c){_0x1e15ee=_0x38724c;_0x193233[_0xa757('0x39')]=_['keys'](db[_0xa757('0x57')][_0xa757('0x35')]);_0x193233[_0xa757('0x3a')]=_['keys'](_0x10cb5e[_0xa757('0x3a')]);_0x193233[_0xa757('0x3c')]=_[_0xa757('0x3d')](_0x193233[_0xa757('0x39')],_0x193233[_0xa757('0x3a')]);_0xa28144[_0xa757('0x3e')]=_[_0xa757('0x3d')](_0x193233[_0xa757('0x39')],qs[_0xa757('0x3f')](_0x10cb5e[_0xa757('0x3a')][_0xa757('0x3f')]));_0xa28144[_0xa757('0x3e')]=_0xa28144[_0xa757('0x3e')][_0xa757('0x40')]?_0xa28144['attributes']:_0x193233[_0xa757('0x39')];_0xa28144[_0xa757('0x44')]=qs['sort'](_0x10cb5e[_0xa757('0x3a')][_0xa757('0x45')]);_0xa28144['where']=qs[_0xa757('0x3c')](_[_0xa757('0x46')](_0x10cb5e[_0xa757('0x3a')],_0x193233[_0xa757('0x3c')]));if(_0x10cb5e[_0xa757('0x3a')][_0xa757('0x47')]){_0xa28144[_0xa757('0x48')]=_[_0xa757('0x49')](_0xa28144[_0xa757('0x48')],{'$or':_[_0xa757('0x33')](_0xa28144[_0xa757('0x3e')],function(_0x189195){var _0x2c2b40={};_0x2c2b40[_0x189195]={'$like':'%'+_0x10cb5e[_0xa757('0x3a')][_0xa757('0x47')]+'%'};return _0x2c2b40;})});}_0xa28144=_[_0xa757('0x49')]({},_0xa28144,_0x10cb5e['options']);return _0x1e15ee[_0xa757('0x56')](_0xa28144);}})['then'](function(_0x39357f){if(_0x39357f){_0x125bda=_0x39357f[_0xa757('0x40')];if(!_0x10cb5e[_0xa757('0x3a')][_0xa757('0x41')](_0xa757('0x42'))){_0xa28144['limit']=qs[_0xa757('0x43')](_0x10cb5e[_0xa757('0x3a')][_0xa757('0x43')]);_0xa28144['offset']=qs[_0xa757('0x28')](_0x10cb5e[_0xa757('0x3a')][_0xa757('0x28')]);}return _0x1e15ee['getSubjects'](_0xa28144);}})['then'](function(_0x1f437d){if(_0x1f437d){return _0x1f437d?{'count':_0x125bda,'rows':_0x1f437d}:null;}})[_0xa757('0x1a')](respondWithResult(_0x40a79b,null))[_0xa757('0x50')](handleError(_0x40a79b,null));};exports['getDescriptions']=function(_0x5dcd35,_0x4cc1ad,_0x4cfc69){var _0x45b424={};var _0x1adf5a={};var _0x476297;var _0x5bf64b;return db[_0xa757('0x34')][_0xa757('0x54')]({'where':{'id':_0x5dcd35[_0xa757('0x4d')]['id']}})[_0xa757('0x1a')](handleEntityNotFound(_0x4cc1ad,null))[_0xa757('0x1a')](function(_0x2d0ce0){if(_0x2d0ce0){_0x476297=_0x2d0ce0;_0x1adf5a[_0xa757('0x39')]=_[_0xa757('0x3b')](db[_0xa757('0x57')][_0xa757('0x35')]);_0x1adf5a[_0xa757('0x3a')]=_[_0xa757('0x3b')](_0x5dcd35['query']);_0x1adf5a[_0xa757('0x3c')]=_[_0xa757('0x3d')](_0x1adf5a[_0xa757('0x39')],_0x1adf5a[_0xa757('0x3a')]);_0x45b424[_0xa757('0x3e')]=_[_0xa757('0x3d')](_0x1adf5a[_0xa757('0x39')],qs[_0xa757('0x3f')](_0x5dcd35[_0xa757('0x3a')][_0xa757('0x3f')]));_0x45b424[_0xa757('0x3e')]=_0x45b424[_0xa757('0x3e')][_0xa757('0x40')]?_0x45b424[_0xa757('0x3e')]:_0x1adf5a[_0xa757('0x39')];_0x45b424[_0xa757('0x44')]=qs[_0xa757('0x45')](_0x5dcd35[_0xa757('0x3a')][_0xa757('0x45')]);_0x45b424[_0xa757('0x48')]=qs[_0xa757('0x3c')](_[_0xa757('0x46')](_0x5dcd35['query'],_0x1adf5a[_0xa757('0x3c')]));if(_0x5dcd35[_0xa757('0x3a')]['filter']){_0x45b424[_0xa757('0x48')]=_['merge'](_0x45b424[_0xa757('0x48')],{'$or':_[_0xa757('0x33')](_0x45b424['attributes'],function(_0x33a613){var _0x2eac20={};_0x2eac20[_0x33a613]={'$like':'%'+_0x5dcd35[_0xa757('0x3a')][_0xa757('0x47')]+'%'};return _0x2eac20;})});}_0x45b424=_['merge']({},_0x45b424,_0x5dcd35[_0xa757('0x4f')]);return _0x476297[_0xa757('0x58')](_0x45b424);}})['then'](function(_0x30716a){if(_0x30716a){_0x5bf64b=_0x30716a[_0xa757('0x40')];if(!_0x5dcd35['query'][_0xa757('0x41')](_0xa757('0x42'))){_0x45b424[_0xa757('0x43')]=qs[_0xa757('0x43')](_0x5dcd35[_0xa757('0x3a')][_0xa757('0x43')]);_0x45b424[_0xa757('0x28')]=qs[_0xa757('0x28')](_0x5dcd35[_0xa757('0x3a')]['offset']);}return _0x476297['getDescriptions'](_0x45b424);}})[_0xa757('0x1a')](function(_0x770298){if(_0x770298){return _0x770298?{'count':_0x5bf64b,'rows':_0x770298}:null;}})[_0xa757('0x1a')](respondWithResult(_0x4cc1ad,null))[_0xa757('0x50')](handleError(_0x4cc1ad,null));}; \ No newline at end of file +var _0xb10b=['ServicenowConfiguration','findAll','show','params','find','create','body','destroy','getFields','findOne','order','pick','hasOwnProperty','getSubjects','ServicenowField','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','save','update','stack','name','send','map','rawAttributes','model','keys','query','filters','attributes','intersection','fields','length','nolimit','limit','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include'];(function(_0x305cd6,_0xf1a23a){var _0x42fbc7=function(_0x1c2f8a){while(--_0x1c2f8a){_0x305cd6['push'](_0x305cd6['shift']());}};_0x42fbc7(++_0xf1a23a);}(_0xb10b,0x12a));var _0xbb10=function(_0x895358,_0x32f914){_0x895358=_0x895358-0x0;var _0x26e26e=_0xb10b[_0x895358];return _0x26e26e;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xbb10('0x18'));var client=jayson[_0xbb10('0x19')][_0xbb10('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x193a27,_0x442548,_0x147230){if(_0x147230){var _0x58a612=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x58a612[_0xbb10('0x1b')](_0x442548)){return _0x193a27;}else{throw new db[(_0xbb10('0x1c'))][(_0xbb10('0x1d'))](_0xbb10('0x1e'));}}else{return _0x193a27;}}function respondWithRpcPromise(_0x3df17b,_0x2f2ebf,_0x24a57b,_0x36b5e8){return new BPromise(function(_0x3e26f4,_0x2b184e){var _0x4a2bfc=_0x36b5e8||client;return _0x4a2bfc[_0xbb10('0x1f')](_0x3df17b,_0x24a57b)[_0xbb10('0x20')](function(_0x133ac2){logger[_0xbb10('0x21')](_0xbb10('0x22'),_0x2f2ebf,_0xbb10('0x23'));logger[_0xbb10('0x24')](_0xbb10('0x25'),_0x2f2ebf,_0xbb10('0x23'),JSON[_0xbb10('0x26')](_0x133ac2));if(_0x133ac2['error']){if(_0x133ac2[_0xbb10('0x27')][_0xbb10('0x28')]===0x1f4){logger[_0xbb10('0x27')](_0xbb10('0x22'),_0x2f2ebf,_0x133ac2[_0xbb10('0x27')][_0xbb10('0x29')]);return _0x2b184e(_0x133ac2['error'][_0xbb10('0x29')]);}logger[_0xbb10('0x27')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2f2ebf,_0x133ac2['error'][_0xbb10('0x29')]);return _0x3e26f4(_0x133ac2[_0xbb10('0x27')][_0xbb10('0x29')]);}else{logger[_0xbb10('0x21')](_0xbb10('0x22'),_0x2f2ebf,_0xbb10('0x23'));_0x3e26f4(_0x133ac2[_0xbb10('0x2a')][_0xbb10('0x29')]);}})[_0xbb10('0x2b')](function(_0x395404){logger[_0xbb10('0x27')](_0xbb10('0x22'),_0x2f2ebf,_0x395404);_0x2b184e(_0x395404);});});}function respondWithStatusCode(_0x537898,_0x4fedac){_0x4fedac=_0x4fedac||0xcc;return function(_0x4fb5e0){if(_0x4fb5e0){return _0x537898[_0xbb10('0x2c')](_0x4fedac);}return _0x537898[_0xbb10('0x2d')](_0x4fedac)[_0xbb10('0x2e')]();};}function respondWithResult(_0x4e25ff,_0x2fdde9){_0x2fdde9=_0x2fdde9||0xc8;return function(_0x24d586){if(_0x24d586){return _0x4e25ff[_0xbb10('0x2d')](_0x2fdde9)[_0xbb10('0x2f')](_0x24d586);}};}function respondWithFilteredResult(_0x1acce9,_0x20d946){return function(_0x2a0e8b){if(_0x2a0e8b){var _0x4aabb9=_0x2a0e8b[_0xbb10('0x30')],_0x3796c7=_0x20d946[_0xbb10('0x31')],_0x21ac54=_0x20d946[_0xbb10('0x31')]+_0x20d946['limit'],_0xfc3595;if(_0x21ac54>=_0x4aabb9){_0x21ac54=_0x4aabb9;_0xfc3595=0xc8;}else{_0xfc3595=0xce;}_0x1acce9[_0xbb10('0x2d')](_0xfc3595);return _0x1acce9['set'](_0xbb10('0x32'),_0x3796c7+'-'+_0x21ac54+'/'+_0x4aabb9)['json'](_0x2a0e8b);}return null;};}function patchUpdates(_0x16ad2a){return function(_0x1dcc9c){try{jsonpatch[_0xbb10('0x33')](_0x1dcc9c,_0x16ad2a,!![]);}catch(_0x491db4){return BPromise['reject'](_0x491db4);}return _0x1dcc9c[_0xbb10('0x34')]();};}function saveUpdates(_0x34f65e,_0x4f590d){return function(_0x359ad4){if(_0x359ad4){return _0x359ad4[_0xbb10('0x35')](_0x34f65e)[_0xbb10('0x20')](function(_0x1c0b57){return _0x1c0b57;});}return null;};}function removeEntity(_0x37a83f,_0x138bc6){return function(_0xf85197){if(_0xf85197){return _0xf85197['destroy']()[_0xbb10('0x20')](function(){_0x37a83f[_0xbb10('0x2d')](0xcc)[_0xbb10('0x2e')]();});}};}function handleEntityNotFound(_0x8c1ce6,_0xfb2c5e){return function(_0x9de708){if(!_0x9de708){_0x8c1ce6[_0xbb10('0x2c')](0x194);}return _0x9de708;};}function handleError(_0x10202c,_0x3c8d7d){_0x3c8d7d=_0x3c8d7d||0x1f4;return function(_0x56943c){logger[_0xbb10('0x27')](_0x56943c[_0xbb10('0x36')]);if(_0x56943c[_0xbb10('0x37')]){delete _0x56943c[_0xbb10('0x37')];}_0x10202c['status'](_0x3c8d7d)[_0xbb10('0x38')](_0x56943c);};}exports['index']=function(_0x4e2754,_0x3eb3cc){var _0x40c164={},_0x26e76a={},_0x120d21={'count':0x0,'rows':[]};var _0x15d895=_[_0xbb10('0x39')](db['ServicenowConfiguration'][_0xbb10('0x3a')],function(_0x25d72f){return{'name':_0x25d72f['fieldName'],'type':_0x25d72f['type']['key']};});_0x26e76a[_0xbb10('0x3b')]=_[_0xbb10('0x39')](_0x15d895,_0xbb10('0x37'));_0x26e76a['query']=_[_0xbb10('0x3c')](_0x4e2754[_0xbb10('0x3d')]);_0x26e76a[_0xbb10('0x3e')]=_['intersection'](_0x26e76a[_0xbb10('0x3b')],_0x26e76a[_0xbb10('0x3d')]);_0x40c164[_0xbb10('0x3f')]=_[_0xbb10('0x40')](_0x26e76a['model'],qs[_0xbb10('0x41')](_0x4e2754[_0xbb10('0x3d')]['fields']));_0x40c164[_0xbb10('0x3f')]=_0x40c164[_0xbb10('0x3f')][_0xbb10('0x42')]?_0x40c164[_0xbb10('0x3f')]:_0x26e76a[_0xbb10('0x3b')];if(!_0x4e2754[_0xbb10('0x3d')]['hasOwnProperty'](_0xbb10('0x43'))){_0x40c164[_0xbb10('0x44')]=qs[_0xbb10('0x44')](_0x4e2754[_0xbb10('0x3d')]['limit']);_0x40c164[_0xbb10('0x31')]=qs[_0xbb10('0x31')](_0x4e2754[_0xbb10('0x3d')][_0xbb10('0x31')]);}_0x40c164['order']=qs[_0xbb10('0x45')](_0x4e2754[_0xbb10('0x3d')]['sort']);_0x40c164['where']=qs[_0xbb10('0x3e')](_['pick'](_0x4e2754[_0xbb10('0x3d')],_0x26e76a[_0xbb10('0x3e')]),_0x15d895);if(_0x4e2754['query'][_0xbb10('0x46')]){_0x40c164[_0xbb10('0x47')]=_[_0xbb10('0x48')](_0x40c164['where'],{'$or':_[_0xbb10('0x39')](_0x15d895,function(_0xebd70c){if(_0xebd70c[_0xbb10('0x49')]!==_0xbb10('0x4a')){var _0x36e1fa={};_0x36e1fa[_0xebd70c[_0xbb10('0x37')]]={'$like':'%'+_0x4e2754[_0xbb10('0x3d')][_0xbb10('0x46')]+'%'};return _0x36e1fa;}})});}_0x40c164=_[_0xbb10('0x48')]({},_0x40c164,_0x4e2754[_0xbb10('0x4b')]);var _0x197871={'where':_0x40c164[_0xbb10('0x47')]};return db['ServicenowConfiguration'][_0xbb10('0x30')](_0x197871)[_0xbb10('0x20')](function(_0x4a1248){_0x120d21[_0xbb10('0x30')]=_0x4a1248;if(_0x4e2754[_0xbb10('0x3d')][_0xbb10('0x4c')]){_0x40c164[_0xbb10('0x4d')]=[{'all':!![]}];}return db[_0xbb10('0x4e')][_0xbb10('0x4f')](_0x40c164);})[_0xbb10('0x20')](function(_0x5be85e){_0x120d21['rows']=_0x5be85e;return _0x120d21;})[_0xbb10('0x20')](respondWithFilteredResult(_0x3eb3cc,_0x40c164))[_0xbb10('0x2b')](handleError(_0x3eb3cc,null));};exports[_0xbb10('0x50')]=function(_0x57d2c0,_0x5f0c12){var _0x3cd6f3={'raw':![],'where':{'id':_0x57d2c0[_0xbb10('0x51')]['id']}},_0x34cf4e={};_0x34cf4e[_0xbb10('0x3b')]=_[_0xbb10('0x3c')](db[_0xbb10('0x4e')][_0xbb10('0x3a')]);_0x34cf4e[_0xbb10('0x3d')]=_[_0xbb10('0x3c')](_0x57d2c0[_0xbb10('0x3d')]);_0x34cf4e['filters']=_['intersection'](_0x34cf4e[_0xbb10('0x3b')],_0x34cf4e[_0xbb10('0x3d')]);_0x3cd6f3[_0xbb10('0x3f')]=_[_0xbb10('0x40')](_0x34cf4e[_0xbb10('0x3b')],qs[_0xbb10('0x41')](_0x57d2c0[_0xbb10('0x3d')][_0xbb10('0x41')]));_0x3cd6f3[_0xbb10('0x3f')]=_0x3cd6f3[_0xbb10('0x3f')][_0xbb10('0x42')]?_0x3cd6f3[_0xbb10('0x3f')]:_0x34cf4e[_0xbb10('0x3b')];if(_0x57d2c0[_0xbb10('0x3d')][_0xbb10('0x4c')]){_0x3cd6f3['include']=[{'all':!![]}];}_0x3cd6f3=_[_0xbb10('0x48')]({},_0x3cd6f3,_0x57d2c0['options']);return db[_0xbb10('0x4e')][_0xbb10('0x52')](_0x3cd6f3)[_0xbb10('0x20')](handleEntityNotFound(_0x5f0c12,null))[_0xbb10('0x20')](respondWithResult(_0x5f0c12,null))[_0xbb10('0x2b')](handleError(_0x5f0c12,null));};exports[_0xbb10('0x53')]=function(_0x2e3326,_0x44eec1){return db[_0xbb10('0x4e')][_0xbb10('0x53')](_0x2e3326[_0xbb10('0x54')],{})[_0xbb10('0x20')](respondWithResult(_0x44eec1,0xc9))[_0xbb10('0x2b')](handleError(_0x44eec1,null));};exports[_0xbb10('0x35')]=function(_0x4475e1,_0x5de0cc){if(_0x4475e1[_0xbb10('0x54')]['id']){delete _0x4475e1[_0xbb10('0x54')]['id'];}return db[_0xbb10('0x4e')][_0xbb10('0x52')]({'where':{'id':_0x4475e1[_0xbb10('0x51')]['id']}})[_0xbb10('0x20')](handleEntityNotFound(_0x5de0cc,null))['then'](saveUpdates(_0x4475e1[_0xbb10('0x54')],null))[_0xbb10('0x20')](respondWithResult(_0x5de0cc,null))[_0xbb10('0x2b')](handleError(_0x5de0cc,null));};exports[_0xbb10('0x55')]=function(_0x432728,_0x22de7f){return db[_0xbb10('0x4e')][_0xbb10('0x52')]({'where':{'id':_0x432728[_0xbb10('0x51')]['id']}})[_0xbb10('0x20')](handleEntityNotFound(_0x22de7f,null))[_0xbb10('0x20')](removeEntity(_0x22de7f,null))[_0xbb10('0x2b')](handleError(_0x22de7f,null));};exports[_0xbb10('0x56')]=function(_0x4e7fac,_0x4ea1a6,_0x16272d){var _0x3e6338={};var _0x3d0cb7={};var _0x8b0a7d;var _0x5573bb;return db['ServicenowConfiguration'][_0xbb10('0x57')]({'where':{'id':_0x4e7fac[_0xbb10('0x51')]['id']}})[_0xbb10('0x20')](handleEntityNotFound(_0x4ea1a6,null))[_0xbb10('0x20')](function(_0x412f13){if(_0x412f13){_0x8b0a7d=_0x412f13;_0x3d0cb7[_0xbb10('0x3b')]=_[_0xbb10('0x3c')](db['ServicenowField'][_0xbb10('0x3a')]);_0x3d0cb7[_0xbb10('0x3d')]=_['keys'](_0x4e7fac['query']);_0x3d0cb7['filters']=_[_0xbb10('0x40')](_0x3d0cb7[_0xbb10('0x3b')],_0x3d0cb7[_0xbb10('0x3d')]);_0x3e6338['attributes']=_['intersection'](_0x3d0cb7['model'],qs[_0xbb10('0x41')](_0x4e7fac[_0xbb10('0x3d')][_0xbb10('0x41')]));_0x3e6338['attributes']=_0x3e6338[_0xbb10('0x3f')][_0xbb10('0x42')]?_0x3e6338['attributes']:_0x3d0cb7['model'];_0x3e6338[_0xbb10('0x58')]=qs[_0xbb10('0x45')](_0x4e7fac[_0xbb10('0x3d')][_0xbb10('0x45')]);_0x3e6338['where']=qs[_0xbb10('0x3e')](_[_0xbb10('0x59')](_0x4e7fac[_0xbb10('0x3d')],_0x3d0cb7['filters']));if(_0x4e7fac[_0xbb10('0x3d')][_0xbb10('0x46')]){_0x3e6338[_0xbb10('0x47')]=_['merge'](_0x3e6338[_0xbb10('0x47')],{'$or':_[_0xbb10('0x39')](_0x3e6338[_0xbb10('0x3f')],function(_0x37b65f){var _0x5e4a6e={};_0x5e4a6e[_0x37b65f]={'$like':'%'+_0x4e7fac[_0xbb10('0x3d')][_0xbb10('0x46')]+'%'};return _0x5e4a6e;})});}_0x3e6338=_[_0xbb10('0x48')]({},_0x3e6338,_0x4e7fac[_0xbb10('0x4b')]);return _0x8b0a7d['getFields'](_0x3e6338);}})[_0xbb10('0x20')](function(_0x277fe7){if(_0x277fe7){_0x5573bb=_0x277fe7[_0xbb10('0x42')];if(!_0x4e7fac[_0xbb10('0x3d')][_0xbb10('0x5a')](_0xbb10('0x43'))){_0x3e6338[_0xbb10('0x44')]=qs['limit'](_0x4e7fac['query']['limit']);_0x3e6338[_0xbb10('0x31')]=qs[_0xbb10('0x31')](_0x4e7fac[_0xbb10('0x3d')]['offset']);}return _0x8b0a7d['getFields'](_0x3e6338);}})[_0xbb10('0x20')](function(_0x1b11c0){if(_0x1b11c0){return _0x1b11c0?{'count':_0x5573bb,'rows':_0x1b11c0}:null;}})[_0xbb10('0x20')](respondWithResult(_0x4ea1a6,null))[_0xbb10('0x2b')](handleError(_0x4ea1a6,null));};exports[_0xbb10('0x5b')]=function(_0x1ad2ed,_0x4cf2f3,_0x1a5ca5){var _0x15fae2={};var _0x270fdb={};var _0x14f16b;var _0x2aaaa6;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x1ad2ed['params']['id']}})[_0xbb10('0x20')](handleEntityNotFound(_0x4cf2f3,null))[_0xbb10('0x20')](function(_0x36917f){if(_0x36917f){_0x14f16b=_0x36917f;_0x270fdb[_0xbb10('0x3b')]=_[_0xbb10('0x3c')](db[_0xbb10('0x5c')]['rawAttributes']);_0x270fdb[_0xbb10('0x3d')]=_['keys'](_0x1ad2ed['query']);_0x270fdb['filters']=_[_0xbb10('0x40')](_0x270fdb[_0xbb10('0x3b')],_0x270fdb[_0xbb10('0x3d')]);_0x15fae2[_0xbb10('0x3f')]=_['intersection'](_0x270fdb[_0xbb10('0x3b')],qs['fields'](_0x1ad2ed['query'][_0xbb10('0x41')]));_0x15fae2[_0xbb10('0x3f')]=_0x15fae2[_0xbb10('0x3f')][_0xbb10('0x42')]?_0x15fae2[_0xbb10('0x3f')]:_0x270fdb['model'];_0x15fae2[_0xbb10('0x58')]=qs[_0xbb10('0x45')](_0x1ad2ed[_0xbb10('0x3d')][_0xbb10('0x45')]);_0x15fae2[_0xbb10('0x47')]=qs[_0xbb10('0x3e')](_[_0xbb10('0x59')](_0x1ad2ed['query'],_0x270fdb[_0xbb10('0x3e')]));if(_0x1ad2ed[_0xbb10('0x3d')][_0xbb10('0x46')]){_0x15fae2[_0xbb10('0x47')]=_[_0xbb10('0x48')](_0x15fae2[_0xbb10('0x47')],{'$or':_[_0xbb10('0x39')](_0x15fae2[_0xbb10('0x3f')],function(_0x5a4429){var _0x428146={};_0x428146[_0x5a4429]={'$like':'%'+_0x1ad2ed[_0xbb10('0x3d')][_0xbb10('0x46')]+'%'};return _0x428146;})});}_0x15fae2=_['merge']({},_0x15fae2,_0x1ad2ed['options']);return _0x14f16b['getSubjects'](_0x15fae2);}})[_0xbb10('0x20')](function(_0x5a3c44){if(_0x5a3c44){_0x2aaaa6=_0x5a3c44['length'];if(!_0x1ad2ed[_0xbb10('0x3d')][_0xbb10('0x5a')](_0xbb10('0x43'))){_0x15fae2[_0xbb10('0x44')]=qs[_0xbb10('0x44')](_0x1ad2ed[_0xbb10('0x3d')][_0xbb10('0x44')]);_0x15fae2[_0xbb10('0x31')]=qs[_0xbb10('0x31')](_0x1ad2ed['query'][_0xbb10('0x31')]);}return _0x14f16b[_0xbb10('0x5b')](_0x15fae2);}})[_0xbb10('0x20')](function(_0x35b811){if(_0x35b811){return _0x35b811?{'count':_0x2aaaa6,'rows':_0x35b811}:null;}})['then'](respondWithResult(_0x4cf2f3,null))['catch'](handleError(_0x4cf2f3,null));};exports[_0xbb10('0x5d')]=function(_0x2280bd,_0x30f0a4,_0x32bb25){var _0x5ee705={};var _0x17d596={};var _0x275bce;var _0x3f0d74;return db[_0xbb10('0x4e')][_0xbb10('0x57')]({'where':{'id':_0x2280bd['params']['id']}})['then'](handleEntityNotFound(_0x30f0a4,null))[_0xbb10('0x20')](function(_0x53c698){if(_0x53c698){_0x275bce=_0x53c698;_0x17d596[_0xbb10('0x3b')]=_['keys'](db[_0xbb10('0x5c')][_0xbb10('0x3a')]);_0x17d596['query']=_['keys'](_0x2280bd[_0xbb10('0x3d')]);_0x17d596[_0xbb10('0x3e')]=_[_0xbb10('0x40')](_0x17d596['model'],_0x17d596[_0xbb10('0x3d')]);_0x5ee705[_0xbb10('0x3f')]=_[_0xbb10('0x40')](_0x17d596[_0xbb10('0x3b')],qs[_0xbb10('0x41')](_0x2280bd[_0xbb10('0x3d')][_0xbb10('0x41')]));_0x5ee705[_0xbb10('0x3f')]=_0x5ee705[_0xbb10('0x3f')]['length']?_0x5ee705[_0xbb10('0x3f')]:_0x17d596[_0xbb10('0x3b')];_0x5ee705[_0xbb10('0x58')]=qs[_0xbb10('0x45')](_0x2280bd[_0xbb10('0x3d')][_0xbb10('0x45')]);_0x5ee705[_0xbb10('0x47')]=qs[_0xbb10('0x3e')](_[_0xbb10('0x59')](_0x2280bd[_0xbb10('0x3d')],_0x17d596[_0xbb10('0x3e')]));if(_0x2280bd[_0xbb10('0x3d')]['filter']){_0x5ee705['where']=_[_0xbb10('0x48')](_0x5ee705[_0xbb10('0x47')],{'$or':_[_0xbb10('0x39')](_0x5ee705[_0xbb10('0x3f')],function(_0x238c7a){var _0x4a717a={};_0x4a717a[_0x238c7a]={'$like':'%'+_0x2280bd[_0xbb10('0x3d')][_0xbb10('0x46')]+'%'};return _0x4a717a;})});}_0x5ee705=_[_0xbb10('0x48')]({},_0x5ee705,_0x2280bd[_0xbb10('0x4b')]);return _0x275bce[_0xbb10('0x5d')](_0x5ee705);}})[_0xbb10('0x20')](function(_0x546db5){if(_0x546db5){_0x3f0d74=_0x546db5[_0xbb10('0x42')];if(!_0x2280bd[_0xbb10('0x3d')]['hasOwnProperty'](_0xbb10('0x43'))){_0x5ee705['limit']=qs[_0xbb10('0x44')](_0x2280bd[_0xbb10('0x3d')][_0xbb10('0x44')]);_0x5ee705[_0xbb10('0x31')]=qs[_0xbb10('0x31')](_0x2280bd['query'][_0xbb10('0x31')]);}return _0x275bce['getDescriptions'](_0x5ee705);}})[_0xbb10('0x20')](function(_0x37ec93){if(_0x37ec93){return _0x37ec93?{'count':_0x3f0d74,'rows':_0x37ec93}:null;}})['then'](respondWithResult(_0x30f0a4,null))['catch'](handleError(_0x30f0a4,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 0182e2d..c38a2cb 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x218e=['int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x218e,0x1c8));var _0xe218=function(_0x8e7987,_0xb49150){_0x8e7987=_0x8e7987-0x0;var _0x57d7aa=_0x218e[_0x8e7987];return _0x57d7aa;};'use strict';var _=require(_0xe218('0x0'));var util=require(_0xe218('0x1'));var logger=require(_0xe218('0x2'))(_0xe218('0x3'));var moment=require(_0xe218('0x4'));var BPromise=require(_0xe218('0x5'));var rp=require(_0xe218('0x6'));var fs=require('fs');var path=require(_0xe218('0x7'));var rimraf=require(_0xe218('0x8'));var config=require('../../config/environment');var attributes=require(_0xe218('0x9'));module[_0xe218('0xa')]=function(_0x3d2f47,_0x5a8765){return _0x3d2f47['define'](_0xe218('0xb'),attributes,{'tableName':_0xe218('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9632=['./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x39321a,_0x35d871){var _0x58afa3=function(_0xf79959){while(--_0xf79959){_0x39321a['push'](_0x39321a['shift']());}};_0x58afa3(++_0x35d871);}(_0x9632,0x109));var _0x2963=function(_0x5bbe0c,_0x369181){_0x5bbe0c=_0x5bbe0c-0x0;var _0x2ba2b1=_0x9632[_0x5bbe0c];return _0x2ba2b1;};'use strict';var _=require(_0x2963('0x0'));var util=require(_0x2963('0x1'));var logger=require(_0x2963('0x2'))(_0x2963('0x3'));var moment=require(_0x2963('0x4'));var BPromise=require(_0x2963('0x5'));var rp=require(_0x2963('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2963('0x7'));var attributes=require(_0x2963('0x8'));module[_0x2963('0x9')]=function(_0x2fc42a,_0x9621dc){return _0x2fc42a[_0x2963('0xa')](_0x2963('0xb'),attributes,{'tableName':_0x2963('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 7ecd535..760620c 100644 --- a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js +++ b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f34=['client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4eda24,_0x407afa){var _0x5300cf=function(_0x3b3e6f){while(--_0x3b3e6f){_0x4eda24['push'](_0x4eda24['shift']());}};_0x5300cf(++_0x407afa);}(_0x8f34,0xa7));var _0x48f3=function(_0x34be17,_0x5b94e9){_0x34be17=_0x34be17-0x0;var _0x45cbdd=_0x8f34[_0x34be17];return _0x45cbdd;};'use strict';var _=require('lodash');var util=require(_0x48f3('0x0'));var moment=require(_0x48f3('0x1'));var BPromise=require('bluebird');var rs=require(_0x48f3('0x2'));var fs=require('fs');var Redis=require(_0x48f3('0x3'));var db=require(_0x48f3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x48f3('0x5'))(_0x48f3('0x6'));var config=require(_0x48f3('0x7'));var jayson=require(_0x48f3('0x8'));var client=jayson[_0x48f3('0x9')][_0x48f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5356ce,_0x5c20e4,_0x6ff746){return new BPromise(function(_0x5def8b,_0x329259){return client[_0x48f3('0xb')](_0x5356ce,_0x6ff746)[_0x48f3('0xc')](function(_0x202e30){logger[_0x48f3('0xd')](_0x48f3('0xe'),_0x5c20e4,_0x48f3('0xf'));logger['debug'](_0x48f3('0x10'),_0x5c20e4,_0x48f3('0xf'),JSON[_0x48f3('0x11')](_0x202e30));if(_0x202e30[_0x48f3('0x12')]){if(_0x202e30[_0x48f3('0x12')][_0x48f3('0x13')]===0x1f4){logger[_0x48f3('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5c20e4,_0x202e30[_0x48f3('0x12')]['message']);return _0x329259(_0x202e30[_0x48f3('0x12')][_0x48f3('0x14')]);}logger[_0x48f3('0x12')](_0x48f3('0xe'),_0x5c20e4,_0x202e30[_0x48f3('0x12')]['message']);return _0x5def8b(_0x202e30['error'][_0x48f3('0x14')]);}else{logger[_0x48f3('0xd')](_0x48f3('0xe'),_0x5c20e4,'request\x20sent');_0x5def8b(_0x202e30[_0x48f3('0x15')][_0x48f3('0x14')]);}})['catch'](function(_0x5854fb){logger['error'](_0x48f3('0xe'),_0x5c20e4,_0x5854fb);_0x329259(_0x5854fb);});});} \ No newline at end of file +var _0x3a5b=['info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0xc79980,_0x5a7c1e){var _0x9cce53=function(_0xf1eae5){while(--_0xf1eae5){_0xc79980['push'](_0xc79980['shift']());}};_0x9cce53(++_0x5a7c1e);}(_0x3a5b,0xf4));var _0xb3a5=function(_0x11ed52,_0xe2c31f){_0x11ed52=_0x11ed52-0x0;var _0xeee5ea=_0x3a5b[_0x11ed52];return _0xeee5ea;};'use strict';var _=require(_0xb3a5('0x0'));var util=require(_0xb3a5('0x1'));var moment=require(_0xb3a5('0x2'));var BPromise=require(_0xb3a5('0x3'));var rs=require(_0xb3a5('0x4'));var fs=require('fs');var Redis=require(_0xb3a5('0x5'));var db=require(_0xb3a5('0x6'))['db'];var utils=require(_0xb3a5('0x7'));var logger=require(_0xb3a5('0x8'))(_0xb3a5('0x9'));var config=require(_0xb3a5('0xa'));var jayson=require(_0xb3a5('0xb'));var client=jayson[_0xb3a5('0xc')][_0xb3a5('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x320ceb,_0x551ca5,_0x58d7f4){return new BPromise(function(_0x195fc4,_0x104af3){return client[_0xb3a5('0xe')](_0x320ceb,_0x58d7f4)[_0xb3a5('0xf')](function(_0x572ad8){logger[_0xb3a5('0x10')](_0xb3a5('0x11'),_0x551ca5,_0xb3a5('0x12'));logger[_0xb3a5('0x13')](_0xb3a5('0x14'),_0x551ca5,_0xb3a5('0x12'),JSON['stringify'](_0x572ad8));if(_0x572ad8[_0xb3a5('0x15')]){if(_0x572ad8[_0xb3a5('0x15')][_0xb3a5('0x16')]===0x1f4){logger[_0xb3a5('0x15')](_0xb3a5('0x11'),_0x551ca5,_0x572ad8[_0xb3a5('0x15')][_0xb3a5('0x17')]);return _0x104af3(_0x572ad8[_0xb3a5('0x15')][_0xb3a5('0x17')]);}logger[_0xb3a5('0x15')](_0xb3a5('0x11'),_0x551ca5,_0x572ad8[_0xb3a5('0x15')][_0xb3a5('0x17')]);return _0x195fc4(_0x572ad8[_0xb3a5('0x15')][_0xb3a5('0x17')]);}else{logger[_0xb3a5('0x10')](_0xb3a5('0x11'),_0x551ca5,_0xb3a5('0x12'));_0x195fc4(_0x572ad8[_0xb3a5('0x18')][_0xb3a5('0x17')]);}})[_0xb3a5('0x19')](function(_0x426e9b){logger[_0xb3a5('0x15')](_0xb3a5('0x11'),_0x551ca5,_0x426e9b);_0x104af3(_0x426e9b);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 2f58d10..65938fb 100644 --- a/server/api/intServicenowField/index.js +++ b/server/api/intServicenowField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa7b=['Router','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','post','create','put','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x581249,_0x483f03){var _0x284bae=function(_0x2faadd){while(--_0x2faadd){_0x581249['push'](_0x581249['shift']());}};_0x284bae(++_0x483f03);}(_0xfa7b,0x1d8));var _0xbfa7=function(_0x384e15,_0x13a1f2){_0x384e15=_0x384e15-0x0;var _0x1a7809=_0xfa7b[_0x384e15];return _0x1a7809;};'use strict';var multer=require(_0xbfa7('0x0'));var util=require(_0xbfa7('0x1'));var path=require('path');var timeout=require(_0xbfa7('0x2'));var express=require(_0xbfa7('0x3'));var router=express[_0xbfa7('0x4')]();var auth=require(_0xbfa7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbfa7('0x6'));var controller=require(_0xbfa7('0x7'));router[_0xbfa7('0x8')]('/',auth[_0xbfa7('0x9')](),controller['index']);router[_0xbfa7('0x8')](_0xbfa7('0xa'),auth[_0xbfa7('0x9')](),controller['show']);router[_0xbfa7('0xb')]('/',auth['isAuthenticated'](),controller[_0xbfa7('0xc')]);router[_0xbfa7('0xd')](_0xbfa7('0xa'),auth[_0xbfa7('0x9')](),controller[_0xbfa7('0xe')]);router['delete'](_0xbfa7('0xa'),auth[_0xbfa7('0x9')](),controller[_0xbfa7('0xf')]);module[_0xbfa7('0x10')]=router; \ No newline at end of file +var _0xd3bc=['post','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','get','show'];(function(_0x2e8418,_0x58c529){var _0x548fe6=function(_0x2b2877){while(--_0x2b2877){_0x2e8418['push'](_0x2e8418['shift']());}};_0x548fe6(++_0x58c529);}(_0xd3bc,0x1e2));var _0xcd3b=function(_0x34ee5e,_0x5b46ad){_0x34ee5e=_0x34ee5e-0x0;var _0xb0bfbb=_0xd3bc[_0x34ee5e];return _0xb0bfbb;};'use strict';var multer=require(_0xcd3b('0x0'));var util=require(_0xcd3b('0x1'));var path=require('path');var timeout=require(_0xcd3b('0x2'));var express=require(_0xcd3b('0x3'));var router=express[_0xcd3b('0x4')]();var auth=require(_0xcd3b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcd3b('0x6'));var controller=require(_0xcd3b('0x7'));router['get']('/',auth[_0xcd3b('0x8')](),controller[_0xcd3b('0x9')]);router[_0xcd3b('0xa')]('/:id',auth[_0xcd3b('0x8')](),controller[_0xcd3b('0xb')]);router[_0xcd3b('0xc')]('/',auth[_0xcd3b('0x8')](),controller[_0xcd3b('0xd')]);router[_0xcd3b('0xe')](_0xcd3b('0xf'),auth[_0xcd3b('0x8')](),controller[_0xcd3b('0x10')]);router['delete'](_0xcd3b('0xf'),auth[_0xcd3b('0x8')](),controller[_0xcd3b('0x11')]);module[_0xcd3b('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 76f529d..a04cae6 100644 --- a/server/api/intServicenowField/intServicenowField.attributes.js +++ b/server/api/intServicenowField/intServicenowField.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb776=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0xa3e6a6,_0x287742){var _0xab21a7=function(_0x29d8c7){while(--_0x29d8c7){_0xa3e6a6['push'](_0xa3e6a6['shift']());}};_0xab21a7(++_0x287742);}(_0xb776,0x1cc));var _0x6b77=function(_0x343346,_0x216318){_0x343346=_0x343346-0x0;var _0x53e23c=_0xb776[_0x343346];return _0x53e23c;};'use strict';var Sequelize=require(_0x6b77('0x0'));module[_0x6b77('0x1')]={'type':{'type':Sequelize[_0x6b77('0x2')]('string',_0x6b77('0x3'),_0x6b77('0x4'),_0x6b77('0x5')),'defaultValue':_0x6b77('0x6')},'content':{'type':Sequelize[_0x6b77('0x7')]},'key':{'type':Sequelize[_0x6b77('0x7')]},'keyType':{'type':Sequelize[_0x6b77('0x2')](_0x6b77('0x6'),_0x6b77('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x6b77('0x7')]},'idField':{'type':Sequelize[_0x6b77('0x7')]},'nameField':{'type':Sequelize[_0x6b77('0x7')]},'customField':{'type':Sequelize[_0x6b77('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6b77('0x7')]}}; \ No newline at end of file +var _0x5d89=['sequelize','exports','ENUM','variable','string','STRING','customVariable','BOOLEAN'];(function(_0x37f9e,_0x5b7424){var _0x2a79f9=function(_0x37b9d0){while(--_0x37b9d0){_0x37f9e['push'](_0x37f9e['shift']());}};_0x2a79f9(++_0x5b7424);}(_0x5d89,0x1e8));var _0x95d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d89[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x95d8('0x0'));module[_0x95d8('0x1')]={'type':{'type':Sequelize[_0x95d8('0x2')]('string',_0x95d8('0x3'),'customVariable','keyValue'),'defaultValue':_0x95d8('0x4')},'content':{'type':Sequelize[_0x95d8('0x5')]},'key':{'type':Sequelize[_0x95d8('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x95d8('0x4'),_0x95d8('0x3'),_0x95d8('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x95d8('0x5')]},'nameField':{'type':Sequelize[_0x95d8('0x5')]},'customField':{'type':Sequelize[_0x95d8('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x95d8('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index ca546d6..d19c48c 100644 --- a/server/api/intServicenowField/intServicenowField.controller.js +++ b/server/api/intServicenowField/intServicenowField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x990052,_0x28b108){var _0x36f959=function(_0x41fe71){while(--_0x41fe71){_0x990052['push'](_0x990052['shift']());}};_0x36f959(++_0x28b108);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0xc76f3,_0x14dd17){var _0x5b6354=function(_0x42dafd){while(--_0x42dafd){_0xc76f3['push'](_0xc76f3['shift']());}};_0x5b6354(++_0x14dd17);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 9b083fc..2bda2c8 100644 --- a/server/api/intServicenowField/intServicenowField.model.js +++ b/server/api/intServicenowField/intServicenowField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70fd=['./intServicenowField.attributes','exports','define','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x70fd,0x1c2));var _0xd70f=function(_0x4ec119,_0x5e20f7){_0x4ec119=_0x4ec119-0x0;var _0x1f45a9=_0x70fd[_0x4ec119];return _0x1f45a9;};'use strict';var _=require(_0xd70f('0x0'));var util=require(_0xd70f('0x1'));var logger=require(_0xd70f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd70f('0x3'));var rp=require(_0xd70f('0x4'));var fs=require('fs');var path=require(_0xd70f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd70f('0x6'));module[_0xd70f('0x7')]=function(_0x278823,_0x54cfcc){return _0x278823[_0xd70f('0x8')]('ServicenowField',attributes,{'tableName':_0xd70f('0x9'),'paranoid':![],'indexes':[{'name':_0xd70f('0xa'),'fields':['idField',_0xd70f('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9d47=['./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0x9d47,0x77));var _0x79d4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9d47[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x79d4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x79d4('0x1'));var moment=require(_0x79d4('0x2'));var BPromise=require(_0x79d4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x79d4('0x4'));var rimraf=require(_0x79d4('0x5'));var config=require(_0x79d4('0x6'));var attributes=require(_0x79d4('0x7'));module[_0x79d4('0x8')]=function(_0x48711e,_0x5299e0){return _0x48711e[_0x79d4('0x9')](_0x79d4('0xa'),attributes,{'tableName':_0x79d4('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x79d4('0xc'),_0x79d4('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 5a042ea..ba4bc3e 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6326=['stringify','error','code','message','result','lodash','util','moment','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0xd727db,_0x58cdaf){var _0x51b8a4=function(_0x565a30){while(--_0x565a30){_0xd727db['push'](_0xd727db['shift']());}};_0x51b8a4(++_0x58cdaf);}(_0x6326,0x16a));var _0x6632=function(_0x2637c1,_0x3bddbb){_0x2637c1=_0x2637c1-0x0;var _0x10cdf0=_0x6326[_0x2637c1];return _0x10cdf0;};'use strict';var _=require(_0x6632('0x0'));var util=require(_0x6632('0x1'));var moment=require(_0x6632('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6632('0x3'));var logger=require('../../config/logger')(_0x6632('0x4'));var config=require(_0x6632('0x5'));var jayson=require(_0x6632('0x6'));var client=jayson[_0x6632('0x7')][_0x6632('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x37db06,_0x51fd17,_0x44b777){return new BPromise(function(_0x5d2e62,_0x2daac4){return client[_0x6632('0x9')](_0x37db06,_0x44b777)[_0x6632('0xa')](function(_0x1ed1c6){logger[_0x6632('0xb')](_0x6632('0xc'),_0x51fd17,_0x6632('0xd'));logger[_0x6632('0xe')](_0x6632('0xf'),_0x51fd17,_0x6632('0xd'),JSON[_0x6632('0x10')](_0x1ed1c6));if(_0x1ed1c6['error']){if(_0x1ed1c6[_0x6632('0x11')][_0x6632('0x12')]===0x1f4){logger[_0x6632('0x11')]('ServicenowField,\x20%s,\x20%s',_0x51fd17,_0x1ed1c6['error'][_0x6632('0x13')]);return _0x2daac4(_0x1ed1c6[_0x6632('0x11')]['message']);}logger[_0x6632('0x11')](_0x6632('0xc'),_0x51fd17,_0x1ed1c6[_0x6632('0x11')]['message']);return _0x5d2e62(_0x1ed1c6['error']['message']);}else{logger[_0x6632('0xb')]('ServicenowField,\x20%s,\x20%s',_0x51fd17,_0x6632('0xd'));_0x5d2e62(_0x1ed1c6[_0x6632('0x14')][_0x6632('0x13')]);}})['catch'](function(_0x2290ba){logger['error'](_0x6632('0xc'),_0x51fd17,_0x2290ba);_0x2daac4(_0x2290ba);});});} \ No newline at end of file +var _0x14ac=['request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x5670cb,_0xe6e20d){var _0x11dc29=function(_0x42305b){while(--_0x42305b){_0x5670cb['push'](_0x5670cb['shift']());}};_0x11dc29(++_0xe6e20d);}(_0x14ac,0x140));var _0xc14a=function(_0x51302c,_0x376113){_0x51302c=_0x51302c-0x0;var _0x20f6c1=_0x14ac[_0x51302c];return _0x20f6c1;};'use strict';var _=require(_0xc14a('0x0'));var util=require(_0xc14a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc14a('0x2'));var fs=require('fs');var Redis=require(_0xc14a('0x3'));var db=require(_0xc14a('0x4'))['db'];var utils=require(_0xc14a('0x5'));var logger=require(_0xc14a('0x6'))(_0xc14a('0x7'));var config=require('../../config/environment');var jayson=require(_0xc14a('0x8'));var client=jayson['client'][_0xc14a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d0e0e,_0x995eba,_0x5f54b4){return new BPromise(function(_0x2e9747,_0x4a4c73){return client[_0xc14a('0xa')](_0x4d0e0e,_0x5f54b4)[_0xc14a('0xb')](function(_0x5e4c2f){logger[_0xc14a('0xc')](_0xc14a('0xd'),_0x995eba,_0xc14a('0xe'));logger[_0xc14a('0xf')](_0xc14a('0x10'),_0x995eba,'request\x20sent',JSON[_0xc14a('0x11')](_0x5e4c2f));if(_0x5e4c2f[_0xc14a('0x12')]){if(_0x5e4c2f[_0xc14a('0x12')]['code']===0x1f4){logger['error'](_0xc14a('0xd'),_0x995eba,_0x5e4c2f[_0xc14a('0x12')][_0xc14a('0x13')]);return _0x4a4c73(_0x5e4c2f['error'][_0xc14a('0x13')]);}logger[_0xc14a('0x12')](_0xc14a('0xd'),_0x995eba,_0x5e4c2f[_0xc14a('0x12')][_0xc14a('0x13')]);return _0x2e9747(_0x5e4c2f[_0xc14a('0x12')][_0xc14a('0x13')]);}else{logger[_0xc14a('0xc')](_0xc14a('0xd'),_0x995eba,_0xc14a('0xe'));_0x2e9747(_0x5e4c2f[_0xc14a('0x14')][_0xc14a('0x13')]);}})[_0xc14a('0x15')](function(_0x24c098){logger['error'](_0xc14a('0xd'),_0x995eba,_0x24c098);_0x4a4c73(_0x24c098);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 5e82006..e5068ec 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 _0xeafc=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xeafc,0x1ba));var _0xceaf=function(_0x1a3e33,_0xe419f4){_0x1a3e33=_0x1a3e33-0x0;var _0x545085=_0xeafc[_0x1a3e33];return _0x545085;};'use strict';var multer=require(_0xceaf('0x0'));var util=require(_0xceaf('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xceaf('0x2')]();var auth=require(_0xceaf('0x3'));var interaction=require(_0xceaf('0x4'));var config=require('../../config/environment');var controller=require(_0xceaf('0x5'));router[_0xceaf('0x6')]('/',auth[_0xceaf('0x7')](),controller['index']);router['get'](_0xceaf('0x8'),auth['isAuthenticated'](),controller[_0xceaf('0x9')]);router['get'](_0xceaf('0xa'),auth[_0xceaf('0x7')](),controller[_0xceaf('0xb')]);router['get'](_0xceaf('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0xceaf('0xd')]('/',auth[_0xceaf('0x7')](),controller[_0xceaf('0xe')]);router['post'](_0xceaf('0xa'),auth[_0xceaf('0x7')](),controller['addConfiguration']);router[_0xceaf('0xf')](_0xceaf('0x8'),auth[_0xceaf('0x7')](),controller['update']);router['delete'](_0xceaf('0x8'),auth['isAuthenticated'](),controller[_0xceaf('0x10')]);module[_0xceaf('0x11')]=router; \ No newline at end of file +var _0x5f3a=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','show','/:id/configurations','getFields','create','post','addConfiguration','/:id','update','delete','destroy'];(function(_0x2b791d,_0x24010d){var _0x444c21=function(_0x5afa48){while(--_0x5afa48){_0x2b791d['push'](_0x2b791d['shift']());}};_0x444c21(++_0x24010d);}(_0x5f3a,0x14a));var _0xa5f3=function(_0x395742,_0x5c07a8){_0x395742=_0x395742-0x0;var _0x416a94=_0x5f3a[_0x395742];return _0x416a94;};'use strict';var multer=require(_0xa5f3('0x0'));var util=require(_0xa5f3('0x1'));var path=require(_0xa5f3('0x2'));var timeout=require(_0xa5f3('0x3'));var express=require(_0xa5f3('0x4'));var router=express[_0xa5f3('0x5')]();var auth=require(_0xa5f3('0x6'));var interaction=require(_0xa5f3('0x7'));var config=require(_0xa5f3('0x8'));var controller=require(_0xa5f3('0x9'));router[_0xa5f3('0xa')]('/',auth[_0xa5f3('0xb')](),controller['index']);router[_0xa5f3('0xa')]('/:id',auth[_0xa5f3('0xb')](),controller[_0xa5f3('0xc')]);router[_0xa5f3('0xa')](_0xa5f3('0xd'),auth[_0xa5f3('0xb')](),controller['getConfigurations']);router[_0xa5f3('0xa')]('/:id/fields',auth[_0xa5f3('0xb')](),controller[_0xa5f3('0xe')]);router['post']('/',auth[_0xa5f3('0xb')](),controller[_0xa5f3('0xf')]);router[_0xa5f3('0x10')](_0xa5f3('0xd'),auth['isAuthenticated'](),controller[_0xa5f3('0x11')]);router['put'](_0xa5f3('0x12'),auth[_0xa5f3('0xb')](),controller[_0xa5f3('0x13')]);router[_0xa5f3('0x14')](_0xa5f3('0x12'),auth['isAuthenticated'](),controller[_0xa5f3('0x15')]);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 72f1585..a41d331 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 _0x8cd9=['STRING','username','sequelize','exports'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x8cd9,0x112));var _0x98cd=function(_0x2025ef,_0xa1f087){_0x2025ef=_0x2025ef-0x0;var _0x51e788=_0x8cd9[_0x2025ef];return _0x51e788;};'use strict';var Sequelize=require(_0x98cd('0x0'));module[_0x98cd('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x98cd('0x2')],'unique':_0x98cd('0x3')},'password':{'type':Sequelize[_0x98cd('0x2')]},'remoteUri':{'type':Sequelize[_0x98cd('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x98cd('0x2')]}}; \ No newline at end of file +var _0xe57d=['STRING','remoteUri','sequelize'];(function(_0x312b06,_0x5ad05e){var _0x54dd60=function(_0x837599){while(--_0x837599){_0x312b06['push'](_0x312b06['shift']());}};_0x54dd60(++_0x5ad05e);}(_0xe57d,0xd7));var _0xde57=function(_0x2071cc,_0x5d728e){_0x2071cc=_0x2071cc-0x0;var _0x31aa5d=_0xe57d[_0x2071cc];return _0x31aa5d;};'use strict';var Sequelize=require(_0xde57('0x0'));module['exports']={'name':{'type':Sequelize[_0xde57('0x1')]},'description':{'type':Sequelize[_0xde57('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0xde57('0x1')]},'remoteUri':{'type':Sequelize[_0xde57('0x1')],'unique':_0xde57('0x2')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index c08686c..e5be591 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 _0xf85c=['where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','intersection','find','create','body','getConfigurations','SugarcrmConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','%s%s','/service/v4_1/rest.php','login','JSON','stringify','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','format','get_module_fields','Calls','values','remove','includes','endsWith','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','SugarcrmAccount','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x10f904,_0x21d00e){var _0x23eb32=function(_0x5ad43c){while(--_0x5ad43c){_0x10f904['push'](_0x10f904['shift']());}};_0x23eb32(++_0x21d00e);}(_0xf85c,0x156));var _0xcf85=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xf85c[_0xc0a3d3];return _0x3386e8;};'use strict';var pdf=require(_0xcf85('0x0'));var emlformat=require(_0xcf85('0x1'));var rimraf=require(_0xcf85('0x2'));var zipdir=require(_0xcf85('0x3'));var jsonpatch=require(_0xcf85('0x4'));var rp=require(_0xcf85('0x5'));var moment=require(_0xcf85('0x6'));var BPromise=require(_0xcf85('0x7'));var Mustache=require('mustache');var util=require(_0xcf85('0x8'));var path=require(_0xcf85('0x9'));var sox=require('sox');var csv=require(_0xcf85('0xa'));var ejs=require(_0xcf85('0xb'));var fs=require('fs');var _=require(_0xcf85('0xc'));var squel=require(_0xcf85('0xd'));var crypto=require(_0xcf85('0xe'));var jsforce=require(_0xcf85('0xf'));var deskjs=require(_0xcf85('0x10'));var toCsv=require(_0xcf85('0xa'));var querystring=require(_0xcf85('0x11'));var Papa=require(_0xcf85('0x12'));var Redis=require(_0xcf85('0x13'));var authService=require(_0xcf85('0x14'));var qs=require(_0xcf85('0x15'));var as=require(_0xcf85('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcf85('0x17'))(_0xcf85('0x18'));var utils=require(_0xcf85('0x19'));var config=require('../../config/environment');var db=require(_0xcf85('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xcf85('0x1b'));var client=jayson['client'][_0xcf85('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x5ca240,_0x53843b,_0x1ecb5){if(_0x1ecb5){var _0x587426=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x587426[_0xcf85('0x1d')](_0x53843b)){return _0x5ca240;}else{throw new db[(_0xcf85('0x1e'))][(_0xcf85('0x1f'))](_0xcf85('0x20'));}}else{return _0x5ca240;}}function respondWithRpcPromise(_0x27b01d,_0x43960b,_0x2fb5d9,_0x160548){return new BPromise(function(_0x6b41e3,_0x58f73a){var _0x1a88c5=_0x160548||client;return _0x1a88c5['request'](_0x27b01d,_0x2fb5d9)[_0xcf85('0x21')](function(_0x46ba9a){logger['info'](_0xcf85('0x22'),_0x43960b,_0xcf85('0x23'));logger[_0xcf85('0x24')](_0xcf85('0x25'),_0x43960b,'request\x20sent',JSON['stringify'](_0x46ba9a));if(_0x46ba9a[_0xcf85('0x26')]){if(_0x46ba9a['error'][_0xcf85('0x27')]===0x1f4){logger[_0xcf85('0x26')](_0xcf85('0x22'),_0x43960b,_0x46ba9a[_0xcf85('0x26')][_0xcf85('0x28')]);return _0x58f73a(_0x46ba9a[_0xcf85('0x26')][_0xcf85('0x28')]);}logger[_0xcf85('0x26')]('SugarcrmAccount,\x20%s,\x20%s',_0x43960b,_0x46ba9a[_0xcf85('0x26')][_0xcf85('0x28')]);return _0x6b41e3(_0x46ba9a[_0xcf85('0x26')][_0xcf85('0x28')]);}else{logger['info'](_0xcf85('0x22'),_0x43960b,_0xcf85('0x23'));_0x6b41e3(_0x46ba9a['result']['message']);}})['catch'](function(_0x431c4f){logger[_0xcf85('0x26')]('SugarcrmAccount,\x20%s,\x20%s',_0x43960b,_0x431c4f);_0x58f73a(_0x431c4f);});});}function respondWithStatusCode(_0x24dc06,_0x4f4a43){_0x4f4a43=_0x4f4a43||0xcc;return function(_0x34abcd){if(_0x34abcd){return _0x24dc06[_0xcf85('0x29')](_0x4f4a43);}return _0x24dc06[_0xcf85('0x2a')](_0x4f4a43)[_0xcf85('0x2b')]();};}function respondWithResult(_0x4a24b4,_0x13ea95){_0x13ea95=_0x13ea95||0xc8;return function(_0x5817dc){if(_0x5817dc){return _0x4a24b4['status'](_0x13ea95)[_0xcf85('0x2c')](_0x5817dc);}};}function respondWithFilteredResult(_0x587aef,_0x27a433){return function(_0x12fbd8){if(_0x12fbd8){var _0x81779e=_0x12fbd8[_0xcf85('0x2d')],_0x1276d1=_0x27a433['offset'],_0x102a39=_0x27a433[_0xcf85('0x2e')]+_0x27a433[_0xcf85('0x2f')],_0x12608c;if(_0x102a39>=_0x81779e){_0x102a39=_0x81779e;_0x12608c=0xc8;}else{_0x12608c=0xce;}_0x587aef['status'](_0x12608c);return _0x587aef[_0xcf85('0x30')](_0xcf85('0x31'),_0x1276d1+'-'+_0x102a39+'/'+_0x81779e)['json'](_0x12fbd8);}return null;};}function patchUpdates(_0x3b8aa9){return function(_0x4a4502){try{jsonpatch[_0xcf85('0x32')](_0x4a4502,_0x3b8aa9,!![]);}catch(_0x2d58af){return BPromise[_0xcf85('0x33')](_0x2d58af);}return _0x4a4502[_0xcf85('0x34')]();};}function saveUpdates(_0x41415a,_0x28cf35){return function(_0x2ccbb5){if(_0x2ccbb5){return _0x2ccbb5[_0xcf85('0x35')](_0x41415a)[_0xcf85('0x21')](function(_0x17c561){return _0x17c561;});}return null;};}function removeEntity(_0x5861aa,_0x5627fb){return function(_0x36158b){if(_0x36158b){return _0x36158b[_0xcf85('0x36')]()[_0xcf85('0x21')](function(){_0x5861aa[_0xcf85('0x2a')](0xcc)[_0xcf85('0x2b')]();});}};}function handleEntityNotFound(_0x3a3ba9,_0x49cd6c){return function(_0x14753f){if(!_0x14753f){_0x3a3ba9['sendStatus'](0x194);}return _0x14753f;};}function handleError(_0x444794,_0x19b370){_0x19b370=_0x19b370||0x1f4;return function(_0x1973cf){logger[_0xcf85('0x26')](_0x1973cf[_0xcf85('0x37')]);if(_0x1973cf[_0xcf85('0x38')]){delete _0x1973cf[_0xcf85('0x38')];}_0x444794[_0xcf85('0x2a')](_0x19b370)[_0xcf85('0x39')](_0x1973cf);};}exports[_0xcf85('0x3a')]=function(_0x4c6268,_0x43a4af){var _0x171a47={},_0x4d4d34={},_0x5c4808={'count':0x0,'rows':[]};var _0x182051=_[_0xcf85('0x3b')](db[_0xcf85('0x3c')]['rawAttributes'],function(_0x301014){return{'name':_0x301014[_0xcf85('0x3d')],'type':_0x301014[_0xcf85('0x3e')][_0xcf85('0x3f')]};});_0x4d4d34['model']=_[_0xcf85('0x3b')](_0x182051,_0xcf85('0x38'));_0x4d4d34[_0xcf85('0x40')]=_[_0xcf85('0x41')](_0x4c6268[_0xcf85('0x40')]);_0x4d4d34[_0xcf85('0x42')]=_['intersection'](_0x4d4d34[_0xcf85('0x43')],_0x4d4d34['query']);_0x171a47[_0xcf85('0x44')]=_['intersection'](_0x4d4d34[_0xcf85('0x43')],qs[_0xcf85('0x45')](_0x4c6268['query'][_0xcf85('0x45')]));_0x171a47[_0xcf85('0x44')]=_0x171a47[_0xcf85('0x44')][_0xcf85('0x46')]?_0x171a47[_0xcf85('0x44')]:_0x4d4d34[_0xcf85('0x43')];if(!_0x4c6268['query'][_0xcf85('0x47')](_0xcf85('0x48'))){_0x171a47['limit']=qs[_0xcf85('0x2f')](_0x4c6268['query'][_0xcf85('0x2f')]);_0x171a47[_0xcf85('0x2e')]=qs[_0xcf85('0x2e')](_0x4c6268[_0xcf85('0x40')][_0xcf85('0x2e')]);}_0x171a47[_0xcf85('0x49')]=qs[_0xcf85('0x4a')](_0x4c6268[_0xcf85('0x40')]['sort']);_0x171a47[_0xcf85('0x4b')]=qs['filters'](_[_0xcf85('0x4c')](_0x4c6268[_0xcf85('0x40')],_0x4d4d34[_0xcf85('0x42')]),_0x182051);if(_0x4c6268[_0xcf85('0x40')][_0xcf85('0x4d')]){_0x171a47[_0xcf85('0x4b')]=_['merge'](_0x171a47[_0xcf85('0x4b')],{'$or':_[_0xcf85('0x3b')](_0x182051,function(_0x449d55){if(_0x449d55[_0xcf85('0x3e')]!==_0xcf85('0x4e')){var _0x52617a={};_0x52617a[_0x449d55['name']]={'$like':'%'+_0x4c6268['query']['filter']+'%'};return _0x52617a;}})});}_0x171a47=_[_0xcf85('0x4f')]({},_0x171a47,_0x4c6268[_0xcf85('0x50')]);var _0x5d8934={'where':_0x171a47[_0xcf85('0x4b')]};return db[_0xcf85('0x3c')][_0xcf85('0x2d')](_0x5d8934)['then'](function(_0x2ad831){_0x5c4808[_0xcf85('0x2d')]=_0x2ad831;if(_0x4c6268[_0xcf85('0x40')][_0xcf85('0x51')]){_0x171a47[_0xcf85('0x52')]=[{'all':!![]}];}return db[_0xcf85('0x3c')][_0xcf85('0x53')](_0x171a47);})[_0xcf85('0x21')](function(_0x4c5972){_0x5c4808['rows']=_0x4c5972;return _0x5c4808;})[_0xcf85('0x21')](respondWithFilteredResult(_0x43a4af,_0x171a47))[_0xcf85('0x54')](handleError(_0x43a4af,null));};exports[_0xcf85('0x55')]=function(_0x358376,_0x39e825){var _0x2427e4={'raw':![],'where':{'id':_0x358376[_0xcf85('0x56')]['id']}},_0x1b609c={};_0x1b609c[_0xcf85('0x43')]=_[_0xcf85('0x41')](db[_0xcf85('0x3c')][_0xcf85('0x57')]);_0x1b609c[_0xcf85('0x40')]=_[_0xcf85('0x41')](_0x358376['query']);_0x1b609c[_0xcf85('0x42')]=_[_0xcf85('0x58')](_0x1b609c[_0xcf85('0x43')],_0x1b609c[_0xcf85('0x40')]);_0x2427e4[_0xcf85('0x44')]=_['intersection'](_0x1b609c[_0xcf85('0x43')],qs['fields'](_0x358376[_0xcf85('0x40')][_0xcf85('0x45')]));_0x2427e4[_0xcf85('0x44')]=_0x2427e4[_0xcf85('0x44')][_0xcf85('0x46')]?_0x2427e4[_0xcf85('0x44')]:_0x1b609c[_0xcf85('0x43')];if(_0x358376[_0xcf85('0x40')]['includeAll']){_0x2427e4['include']=[{'all':!![]}];}_0x2427e4=_[_0xcf85('0x4f')]({},_0x2427e4,_0x358376[_0xcf85('0x50')]);return db[_0xcf85('0x3c')][_0xcf85('0x59')](_0x2427e4)[_0xcf85('0x21')](handleEntityNotFound(_0x39e825,null))[_0xcf85('0x21')](respondWithResult(_0x39e825,null))[_0xcf85('0x54')](handleError(_0x39e825,null));};exports[_0xcf85('0x5a')]=function(_0x38e69a,_0x36b101){return db[_0xcf85('0x3c')][_0xcf85('0x5a')](_0x38e69a[_0xcf85('0x5b')],{})[_0xcf85('0x21')](respondWithResult(_0x36b101,0xc9))[_0xcf85('0x54')](handleError(_0x36b101,null));};exports[_0xcf85('0x35')]=function(_0x2a93f1,_0x148663){if(_0x2a93f1[_0xcf85('0x5b')]['id']){delete _0x2a93f1[_0xcf85('0x5b')]['id'];}return db[_0xcf85('0x3c')][_0xcf85('0x59')]({'where':{'id':_0x2a93f1['params']['id']}})[_0xcf85('0x21')](handleEntityNotFound(_0x148663,null))['then'](saveUpdates(_0x2a93f1[_0xcf85('0x5b')],null))[_0xcf85('0x21')](respondWithResult(_0x148663,null))[_0xcf85('0x54')](handleError(_0x148663,null));};exports[_0xcf85('0x36')]=function(_0x3b94a2,_0x53151a){return db[_0xcf85('0x3c')][_0xcf85('0x59')]({'where':{'id':_0x3b94a2[_0xcf85('0x56')]['id']}})[_0xcf85('0x21')](handleEntityNotFound(_0x53151a,null))[_0xcf85('0x21')](removeEntity(_0x53151a,null))['catch'](handleError(_0x53151a,null));};exports[_0xcf85('0x5c')]=function(_0x382a0a,_0x2a3127,_0xc5cf28){var _0x38c055={};var _0x10c84e={};var _0x38df46;var _0x162f4f;return db[_0xcf85('0x3c')]['findOne']({'where':{'id':_0x382a0a[_0xcf85('0x56')]['id']}})[_0xcf85('0x21')](handleEntityNotFound(_0x2a3127,null))[_0xcf85('0x21')](function(_0x4cb04a){if(_0x4cb04a){_0x38df46=_0x4cb04a;_0x10c84e[_0xcf85('0x43')]=_[_0xcf85('0x41')](db[_0xcf85('0x5d')][_0xcf85('0x57')]);_0x10c84e[_0xcf85('0x40')]=_['keys'](_0x382a0a['query']);_0x10c84e[_0xcf85('0x42')]=_['intersection'](_0x10c84e[_0xcf85('0x43')],_0x10c84e[_0xcf85('0x40')]);_0x38c055[_0xcf85('0x44')]=_[_0xcf85('0x58')](_0x10c84e[_0xcf85('0x43')],qs[_0xcf85('0x45')](_0x382a0a[_0xcf85('0x40')][_0xcf85('0x45')]));_0x38c055[_0xcf85('0x44')]=_0x38c055[_0xcf85('0x44')][_0xcf85('0x46')]?_0x38c055['attributes']:_0x10c84e[_0xcf85('0x43')];_0x38c055[_0xcf85('0x49')]=qs[_0xcf85('0x4a')](_0x382a0a[_0xcf85('0x40')][_0xcf85('0x4a')]);_0x38c055['where']=qs[_0xcf85('0x42')](_[_0xcf85('0x4c')](_0x382a0a['query'],_0x10c84e[_0xcf85('0x42')]));if(_0x382a0a[_0xcf85('0x40')]['filter']){_0x38c055[_0xcf85('0x4b')]=_['merge'](_0x38c055[_0xcf85('0x4b')],{'$or':_[_0xcf85('0x3b')](_0x38c055[_0xcf85('0x44')],function(_0x1ec83c){var _0x8cdea6={};_0x8cdea6[_0x1ec83c]={'$like':'%'+_0x382a0a[_0xcf85('0x40')][_0xcf85('0x4d')]+'%'};return _0x8cdea6;})});}_0x38c055=_[_0xcf85('0x4f')]({},_0x38c055,_0x382a0a['options']);return _0x38df46['getConfigurations'](_0x38c055);}})['then'](function(_0x3ff681){if(_0x3ff681){_0x162f4f=_0x3ff681[_0xcf85('0x46')];if(!_0x382a0a[_0xcf85('0x40')][_0xcf85('0x47')](_0xcf85('0x48'))){_0x38c055[_0xcf85('0x2f')]=qs[_0xcf85('0x2f')](_0x382a0a[_0xcf85('0x40')][_0xcf85('0x2f')]);_0x38c055[_0xcf85('0x2e')]=qs['offset'](_0x382a0a[_0xcf85('0x40')][_0xcf85('0x2e')]);}return _0x38df46[_0xcf85('0x5c')](_0x38c055);}})[_0xcf85('0x21')](function(_0x28d077){if(_0x28d077){return _0x28d077?{'count':_0x162f4f,'rows':_0x28d077}:null;}})[_0xcf85('0x21')](respondWithResult(_0x2a3127,null))[_0xcf85('0x54')](handleError(_0x2a3127,null));};exports[_0xcf85('0x5e')]=function(_0x110a6a,_0x132753,_0x1a2f9b){if(_0x110a6a['body']['id']){delete _0x110a6a[_0xcf85('0x5b')]['id'];}return db[_0xcf85('0x3c')][_0xcf85('0x5f')]({'where':{'id':_0x110a6a[_0xcf85('0x56')]['id']}})['then'](handleEntityNotFound(_0x132753,null))[_0xcf85('0x21')](function(_0xf56ad0){if(_0xf56ad0){_0x110a6a[_0xcf85('0x5b')][_0xcf85('0x60')]=_0xf56ad0['id'];_0x110a6a[_0xcf85('0x5b')][_0xcf85('0x61')]=integrations[_0xcf85('0x62')](_0x110a6a[_0xcf85('0x5b')]['channel'],_0x110a6a[_0xcf85('0x5b')][_0xcf85('0x3e')]);_0x110a6a[_0xcf85('0x5b')][_0xcf85('0x63')]=integrations[_0xcf85('0x64')](_0x110a6a[_0xcf85('0x5b')][_0xcf85('0x65')],_0x110a6a[_0xcf85('0x5b')]['type']);return db[_0xcf85('0x5d')][_0xcf85('0x5a')](_0x110a6a[_0xcf85('0x5b')],{'include':[{'model':db['SugarcrmField'],'as':_0xcf85('0x61')},{'model':db[_0xcf85('0x66')],'as':_0xcf85('0x63')}]});}return null;})[_0xcf85('0x21')](respondWithResult(_0x132753,null))[_0xcf85('0x54')](handleError(_0x132753,null));};exports[_0xcf85('0x67')]=function(_0x1ff710,_0x4e55ec,_0x4ddb5c){var _0x5defb3='';var _0x206b77=['id','name',_0xcf85('0x68'),'created_by',_0xcf85('0x69'),_0xcf85('0x6a'),_0xcf85('0x6b'),_0xcf85('0x6c'),_0xcf85('0x6d'),_0xcf85('0x6e'),_0xcf85('0x6f'),_0xcf85('0x70')];return db[_0xcf85('0x3c')][_0xcf85('0x5f')]({'where':{'id':_0x1ff710[_0xcf85('0x56')]['id']},'attributes':['id',_0xcf85('0x71'),'password',_0xcf85('0x72')]})[_0xcf85('0x21')](handleEntityNotFound(_0x4e55ec,null))['then'](function(_0x49b629){if(_0x49b629){_0x5defb3=_0x49b629['remoteUri'];var _0x26334d=_0x5defb3[_0xcf85('0x73')](-0x1);if(_0x26334d==='/'){_0x5defb3=_0x5defb3[_0xcf85('0x74')](0x0,_0x5defb3[_0xcf85('0x75')](_0x26334d));}return rp({'method':'POST','uri':util['format'](_0xcf85('0x76'),_0x5defb3,_0xcf85('0x77')),'json':!![],'form':{'method':_0xcf85('0x78'),'input_type':_0xcf85('0x79'),'response_type':_0xcf85('0x79'),'rest_data':JSON[_0xcf85('0x7a')]({'user_auth':{'user_name':_0x49b629[_0xcf85('0x71')],'password':_0x49b629[_0xcf85('0x7b')],'encryption':_0xcf85('0x7c')},'application':_0xcf85('0x7d')})}});}})[_0xcf85('0x21')](function(_0x1756d2){if(_0x1756d2&&_0x1756d2[_0xcf85('0x38')]!==_0xcf85('0x7e')&&_0x1756d2[_0xcf85('0x38')]!==_0xcf85('0x7f')){return rp({'method':_0xcf85('0x80'),'uri':util[_0xcf85('0x81')]('%s%s',_0x5defb3,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xcf85('0x82'),'input_type':_0xcf85('0x79'),'response_type':'JSON','rest_data':JSON[_0xcf85('0x7a')]({'session':_0x1756d2['id'],'module_name':_0xcf85('0x83')})}})[_0xcf85('0x21')](function(_0x106469){if(_0x106469){var _0x3908e1=_[_0xcf85('0x84')](_0x106469['module_fields']);_[_0xcf85('0x85')](_0x3908e1,function(_0x373f85){return _0x206b77[_0xcf85('0x86')](_0x373f85[_0xcf85('0x38')]);});return{'count':_0x3908e1[_0xcf85('0x46')],'rows':_[_0xcf85('0x3b')](_0x3908e1,function(_0x5805b1){return{'id':_0x5805b1[_0xcf85('0x38')],'name':_0x5805b1['label'],'custom':_[_0xcf85('0x87')](_0x5805b1['name'],'_c')?!![]:![],'options':_0x5805b1[_0xcf85('0x50')]?_[_0xcf85('0x3b')](_[_0xcf85('0x84')](_0x5805b1[_0xcf85('0x50')]),function(_0x52ee6b){return{'name':_0x52ee6b['value'],'value':_0x52ee6b[_0xcf85('0x38')]};}):[]};})};}})[_0xcf85('0x21')](respondWithResult(_0x4e55ec,null))['catch'](function(_0x2ce9c0){var _0xb2b472=_0x1ff710[_0xcf85('0x40')]['test']?0x1f4:_0x2ce9c0[_0xcf85('0x88')]||0x1f4;logger[_0xcf85('0x26')](_0xcf85('0x89'),_0xcf85('0x67'),_0xb2b472,JSON['stringify'](_0x2ce9c0));delete _0x2ce9c0['name'];if(_0xb2b472===0x191){_0xb2b472=0x190;}_0x4e55ec[_0xcf85('0x2a')](_0xb2b472)[_0xcf85('0x39')](_0x1ff710[_0xcf85('0x40')][_0xcf85('0x1d')]?{'message':_0xcf85('0x8a'),'statusCode':_0x2ce9c0[_0xcf85('0x88')]}:_0x2ce9c0);});}else{var _0x24c06b=0x1f4;_0x4e55ec[_0xcf85('0x2a')](_0x24c06b)[_0xcf85('0x39')]({'message':_0xcf85('0x8a'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x43b8=['SugarcrmConfiguration','order','pick','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','username','password','remoteUri','slice','substring','lastIndexOf','format','%s%s','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','POST','/service/v4_1/rest.php','values','module_fields','remove','includes','label','value','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','apply','reject','save','update','destroy','name','index','map','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','SugarcrmAccount','count','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','getConfigurations','findOne'];(function(_0x1b2255,_0x3de34f){var _0x33e57d=function(_0x2f9cce){while(--_0x2f9cce){_0x1b2255['push'](_0x1b2255['shift']());}};_0x33e57d(++_0x3de34f);}(_0x43b8,0x1bd));var _0x843b=function(_0x27ea81,_0x12a73f){_0x27ea81=_0x27ea81-0x0;var _0x57ccc0=_0x43b8[_0x27ea81];return _0x57ccc0;};'use strict';var pdf=require(_0x843b('0x0'));var emlformat=require(_0x843b('0x1'));var rimraf=require(_0x843b('0x2'));var zipdir=require(_0x843b('0x3'));var jsonpatch=require(_0x843b('0x4'));var rp=require(_0x843b('0x5'));var moment=require(_0x843b('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x843b('0x7'));var util=require(_0x843b('0x8'));var path=require('path');var sox=require(_0x843b('0x9'));var csv=require(_0x843b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x843b('0xb'));var squel=require('squel');var crypto=require(_0x843b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x843b('0xd'));var toCsv=require(_0x843b('0xa'));var querystring=require(_0x843b('0xe'));var Papa=require(_0x843b('0xf'));var Redis=require(_0x843b('0x10'));var authService=require(_0x843b('0x11'));var qs=require(_0x843b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x843b('0x13'));var logger=require('../../config/logger')(_0x843b('0x14'));var utils=require(_0x843b('0x15'));var config=require(_0x843b('0x16'));var db=require(_0x843b('0x17'))['db'];var integrations=require(_0x843b('0x18'));var jayson=require(_0x843b('0x19'));var client=jayson['client'][_0x843b('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x71a10e,_0x28bc58,_0x408c53){if(_0x408c53){var _0x50d51c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x50d51c[_0x843b('0x1b')](_0x28bc58)){return _0x71a10e;}else{throw new db[(_0x843b('0x1c'))][(_0x843b('0x1d'))](_0x843b('0x1e'));}}else{return _0x71a10e;}}function respondWithRpcPromise(_0x48bb5c,_0x5f3b76,_0x28f84e,_0x269e26){return new BPromise(function(_0x536132,_0x1034c9){var _0x1eef97=_0x269e26||client;return _0x1eef97['request'](_0x48bb5c,_0x28f84e)[_0x843b('0x1f')](function(_0x434e15){logger['info'](_0x843b('0x20'),_0x5f3b76,_0x843b('0x21'));logger[_0x843b('0x22')](_0x843b('0x23'),_0x5f3b76,_0x843b('0x21'),JSON['stringify'](_0x434e15));if(_0x434e15[_0x843b('0x24')]){if(_0x434e15[_0x843b('0x24')][_0x843b('0x25')]===0x1f4){logger[_0x843b('0x24')](_0x843b('0x20'),_0x5f3b76,_0x434e15[_0x843b('0x24')][_0x843b('0x26')]);return _0x1034c9(_0x434e15[_0x843b('0x24')][_0x843b('0x26')]);}logger['error'](_0x843b('0x20'),_0x5f3b76,_0x434e15[_0x843b('0x24')][_0x843b('0x26')]);return _0x536132(_0x434e15[_0x843b('0x24')]['message']);}else{logger[_0x843b('0x27')]('SugarcrmAccount,\x20%s,\x20%s',_0x5f3b76,_0x843b('0x21'));_0x536132(_0x434e15[_0x843b('0x28')][_0x843b('0x26')]);}})[_0x843b('0x29')](function(_0x395860){logger[_0x843b('0x24')](_0x843b('0x20'),_0x5f3b76,_0x395860);_0x1034c9(_0x395860);});});}function respondWithStatusCode(_0x460a4b,_0x34fcbd){_0x34fcbd=_0x34fcbd||0xcc;return function(_0x44f6ae){if(_0x44f6ae){return _0x460a4b[_0x843b('0x2a')](_0x34fcbd);}return _0x460a4b[_0x843b('0x2b')](_0x34fcbd)[_0x843b('0x2c')]();};}function respondWithResult(_0x46474e,_0x461e21){_0x461e21=_0x461e21||0xc8;return function(_0x124ef4){if(_0x124ef4){return _0x46474e[_0x843b('0x2b')](_0x461e21)[_0x843b('0x2d')](_0x124ef4);}};}function respondWithFilteredResult(_0x2733c3,_0x5cd72f){return function(_0x328234){if(_0x328234){var _0x370048=_0x328234['count'],_0x2106d2=_0x5cd72f[_0x843b('0x2e')],_0x3060b3=_0x5cd72f[_0x843b('0x2e')]+_0x5cd72f[_0x843b('0x2f')],_0x4744f3;if(_0x3060b3>=_0x370048){_0x3060b3=_0x370048;_0x4744f3=0xc8;}else{_0x4744f3=0xce;}_0x2733c3['status'](_0x4744f3);return _0x2733c3['set']('Content-Range',_0x2106d2+'-'+_0x3060b3+'/'+_0x370048)[_0x843b('0x2d')](_0x328234);}return null;};}function patchUpdates(_0x374ba4){return function(_0x57744e){try{jsonpatch[_0x843b('0x30')](_0x57744e,_0x374ba4,!![]);}catch(_0x3726d1){return BPromise[_0x843b('0x31')](_0x3726d1);}return _0x57744e[_0x843b('0x32')]();};}function saveUpdates(_0xf24fea,_0x126df9){return function(_0x3319b1){if(_0x3319b1){return _0x3319b1[_0x843b('0x33')](_0xf24fea)[_0x843b('0x1f')](function(_0x3b4639){return _0x3b4639;});}return null;};}function removeEntity(_0x801623,_0x3fa1cf){return function(_0x360206){if(_0x360206){return _0x360206[_0x843b('0x34')]()[_0x843b('0x1f')](function(){_0x801623[_0x843b('0x2b')](0xcc)[_0x843b('0x2c')]();});}};}function handleEntityNotFound(_0x1df5bf,_0x1e891e){return function(_0x4adf2a){if(!_0x4adf2a){_0x1df5bf[_0x843b('0x2a')](0x194);}return _0x4adf2a;};}function handleError(_0x599c27,_0x512a2a){_0x512a2a=_0x512a2a||0x1f4;return function(_0x3a55fc){logger[_0x843b('0x24')](_0x3a55fc['stack']);if(_0x3a55fc['name']){delete _0x3a55fc[_0x843b('0x35')];}_0x599c27[_0x843b('0x2b')](_0x512a2a)['send'](_0x3a55fc);};}exports[_0x843b('0x36')]=function(_0x2a6a6e,_0x1e4182){var _0x5e6c86={},_0x374b3e={},_0x390dd3={'count':0x0,'rows':[]};var _0x726ab3=_[_0x843b('0x37')](db['SugarcrmAccount'][_0x843b('0x38')],function(_0x2a5ef3){return{'name':_0x2a5ef3['fieldName'],'type':_0x2a5ef3[_0x843b('0x39')][_0x843b('0x3a')]};});_0x374b3e[_0x843b('0x3b')]=_[_0x843b('0x37')](_0x726ab3,_0x843b('0x35'));_0x374b3e[_0x843b('0x3c')]=_['keys'](_0x2a6a6e[_0x843b('0x3c')]);_0x374b3e['filters']=_[_0x843b('0x3d')](_0x374b3e[_0x843b('0x3b')],_0x374b3e[_0x843b('0x3c')]);_0x5e6c86[_0x843b('0x3e')]=_['intersection'](_0x374b3e['model'],qs[_0x843b('0x3f')](_0x2a6a6e[_0x843b('0x3c')][_0x843b('0x3f')]));_0x5e6c86[_0x843b('0x3e')]=_0x5e6c86['attributes'][_0x843b('0x40')]?_0x5e6c86[_0x843b('0x3e')]:_0x374b3e[_0x843b('0x3b')];if(!_0x2a6a6e[_0x843b('0x3c')][_0x843b('0x41')]('nolimit')){_0x5e6c86[_0x843b('0x2f')]=qs[_0x843b('0x2f')](_0x2a6a6e[_0x843b('0x3c')][_0x843b('0x2f')]);_0x5e6c86[_0x843b('0x2e')]=qs[_0x843b('0x2e')](_0x2a6a6e[_0x843b('0x3c')]['offset']);}_0x5e6c86['order']=qs[_0x843b('0x42')](_0x2a6a6e[_0x843b('0x3c')][_0x843b('0x42')]);_0x5e6c86[_0x843b('0x43')]=qs[_0x843b('0x44')](_['pick'](_0x2a6a6e['query'],_0x374b3e['filters']),_0x726ab3);if(_0x2a6a6e[_0x843b('0x3c')][_0x843b('0x45')]){_0x5e6c86['where']=_[_0x843b('0x46')](_0x5e6c86[_0x843b('0x43')],{'$or':_[_0x843b('0x37')](_0x726ab3,function(_0x289574){if(_0x289574[_0x843b('0x39')]!==_0x843b('0x47')){var _0x424d4d={};_0x424d4d[_0x289574['name']]={'$like':'%'+_0x2a6a6e[_0x843b('0x3c')][_0x843b('0x45')]+'%'};return _0x424d4d;}})});}_0x5e6c86=_[_0x843b('0x46')]({},_0x5e6c86,_0x2a6a6e['options']);var _0x23e104={'where':_0x5e6c86[_0x843b('0x43')]};return db[_0x843b('0x48')][_0x843b('0x49')](_0x23e104)[_0x843b('0x1f')](function(_0x14342a){_0x390dd3[_0x843b('0x49')]=_0x14342a;if(_0x2a6a6e[_0x843b('0x3c')][_0x843b('0x4a')]){_0x5e6c86[_0x843b('0x4b')]=[{'all':!![]}];}return db[_0x843b('0x48')][_0x843b('0x4c')](_0x5e6c86);})['then'](function(_0x31beb2){_0x390dd3[_0x843b('0x4d')]=_0x31beb2;return _0x390dd3;})[_0x843b('0x1f')](respondWithFilteredResult(_0x1e4182,_0x5e6c86))[_0x843b('0x29')](handleError(_0x1e4182,null));};exports[_0x843b('0x4e')]=function(_0x42faa9,_0x2b90f6){var _0x54f5aa={'raw':![],'where':{'id':_0x42faa9[_0x843b('0x4f')]['id']}},_0x89e933={};_0x89e933[_0x843b('0x3b')]=_[_0x843b('0x50')](db[_0x843b('0x48')][_0x843b('0x38')]);_0x89e933[_0x843b('0x3c')]=_['keys'](_0x42faa9[_0x843b('0x3c')]);_0x89e933['filters']=_[_0x843b('0x3d')](_0x89e933[_0x843b('0x3b')],_0x89e933[_0x843b('0x3c')]);_0x54f5aa[_0x843b('0x3e')]=_[_0x843b('0x3d')](_0x89e933[_0x843b('0x3b')],qs[_0x843b('0x3f')](_0x42faa9['query'][_0x843b('0x3f')]));_0x54f5aa['attributes']=_0x54f5aa[_0x843b('0x3e')]['length']?_0x54f5aa[_0x843b('0x3e')]:_0x89e933['model'];if(_0x42faa9[_0x843b('0x3c')]['includeAll']){_0x54f5aa['include']=[{'all':!![]}];}_0x54f5aa=_[_0x843b('0x46')]({},_0x54f5aa,_0x42faa9[_0x843b('0x51')]);return db[_0x843b('0x48')][_0x843b('0x52')](_0x54f5aa)['then'](handleEntityNotFound(_0x2b90f6,null))['then'](respondWithResult(_0x2b90f6,null))[_0x843b('0x29')](handleError(_0x2b90f6,null));};exports[_0x843b('0x53')]=function(_0x25efda,_0x1aeee3){return db['SugarcrmAccount']['create'](_0x25efda['body'],{})[_0x843b('0x1f')](respondWithResult(_0x1aeee3,0xc9))['catch'](handleError(_0x1aeee3,null));};exports[_0x843b('0x33')]=function(_0x4272c8,_0x572dbf){if(_0x4272c8[_0x843b('0x54')]['id']){delete _0x4272c8[_0x843b('0x54')]['id'];}return db[_0x843b('0x48')][_0x843b('0x52')]({'where':{'id':_0x4272c8[_0x843b('0x4f')]['id']}})[_0x843b('0x1f')](handleEntityNotFound(_0x572dbf,null))[_0x843b('0x1f')](saveUpdates(_0x4272c8[_0x843b('0x54')],null))[_0x843b('0x1f')](respondWithResult(_0x572dbf,null))['catch'](handleError(_0x572dbf,null));};exports['destroy']=function(_0x118bca,_0x179d5e){return db[_0x843b('0x48')]['find']({'where':{'id':_0x118bca['params']['id']}})[_0x843b('0x1f')](handleEntityNotFound(_0x179d5e,null))['then'](removeEntity(_0x179d5e,null))[_0x843b('0x29')](handleError(_0x179d5e,null));};exports[_0x843b('0x55')]=function(_0x5510ea,_0xdbf0b2,_0x15e469){var _0x2622a1={};var _0x171ad6={};var _0x1199fa;var _0x592879;return db[_0x843b('0x48')][_0x843b('0x56')]({'where':{'id':_0x5510ea[_0x843b('0x4f')]['id']}})[_0x843b('0x1f')](handleEntityNotFound(_0xdbf0b2,null))[_0x843b('0x1f')](function(_0x4f5b36){if(_0x4f5b36){_0x1199fa=_0x4f5b36;_0x171ad6['model']=_['keys'](db[_0x843b('0x57')][_0x843b('0x38')]);_0x171ad6[_0x843b('0x3c')]=_[_0x843b('0x50')](_0x5510ea[_0x843b('0x3c')]);_0x171ad6[_0x843b('0x44')]=_[_0x843b('0x3d')](_0x171ad6[_0x843b('0x3b')],_0x171ad6[_0x843b('0x3c')]);_0x2622a1[_0x843b('0x3e')]=_['intersection'](_0x171ad6[_0x843b('0x3b')],qs['fields'](_0x5510ea[_0x843b('0x3c')][_0x843b('0x3f')]));_0x2622a1[_0x843b('0x3e')]=_0x2622a1[_0x843b('0x3e')][_0x843b('0x40')]?_0x2622a1['attributes']:_0x171ad6[_0x843b('0x3b')];_0x2622a1[_0x843b('0x58')]=qs['sort'](_0x5510ea[_0x843b('0x3c')][_0x843b('0x42')]);_0x2622a1[_0x843b('0x43')]=qs[_0x843b('0x44')](_[_0x843b('0x59')](_0x5510ea[_0x843b('0x3c')],_0x171ad6[_0x843b('0x44')]));if(_0x5510ea['query'][_0x843b('0x45')]){_0x2622a1[_0x843b('0x43')]=_['merge'](_0x2622a1['where'],{'$or':_['map'](_0x2622a1[_0x843b('0x3e')],function(_0x268d3e){var _0x49691c={};_0x49691c[_0x268d3e]={'$like':'%'+_0x5510ea[_0x843b('0x3c')][_0x843b('0x45')]+'%'};return _0x49691c;})});}_0x2622a1=_[_0x843b('0x46')]({},_0x2622a1,_0x5510ea[_0x843b('0x51')]);return _0x1199fa[_0x843b('0x55')](_0x2622a1);}})[_0x843b('0x1f')](function(_0x5eec3f){if(_0x5eec3f){_0x592879=_0x5eec3f[_0x843b('0x40')];if(!_0x5510ea[_0x843b('0x3c')][_0x843b('0x41')](_0x843b('0x5a'))){_0x2622a1[_0x843b('0x2f')]=qs['limit'](_0x5510ea['query'][_0x843b('0x2f')]);_0x2622a1[_0x843b('0x2e')]=qs[_0x843b('0x2e')](_0x5510ea[_0x843b('0x3c')][_0x843b('0x2e')]);}return _0x1199fa[_0x843b('0x55')](_0x2622a1);}})[_0x843b('0x1f')](function(_0x3f1b13){if(_0x3f1b13){return _0x3f1b13?{'count':_0x592879,'rows':_0x3f1b13}:null;}})['then'](respondWithResult(_0xdbf0b2,null))['catch'](handleError(_0xdbf0b2,null));};exports[_0x843b('0x5b')]=function(_0x3fe345,_0x11d7a6,_0x282a43){if(_0x3fe345[_0x843b('0x54')]['id']){delete _0x3fe345['body']['id'];}return db['SugarcrmAccount'][_0x843b('0x56')]({'where':{'id':_0x3fe345[_0x843b('0x4f')]['id']}})[_0x843b('0x1f')](handleEntityNotFound(_0x11d7a6,null))['then'](function(_0x5c18c3){if(_0x5c18c3){_0x3fe345[_0x843b('0x54')][_0x843b('0x5c')]=_0x5c18c3['id'];_0x3fe345[_0x843b('0x54')]['Subjects']=integrations[_0x843b('0x5d')](_0x3fe345[_0x843b('0x54')][_0x843b('0x5e')],_0x3fe345['body'][_0x843b('0x39')]);_0x3fe345[_0x843b('0x54')][_0x843b('0x5f')]=integrations[_0x843b('0x60')](_0x3fe345['body']['channel'],_0x3fe345['body'][_0x843b('0x39')]);return db[_0x843b('0x57')][_0x843b('0x53')](_0x3fe345['body'],{'include':[{'model':db[_0x843b('0x61')],'as':_0x843b('0x62')},{'model':db[_0x843b('0x61')],'as':_0x843b('0x5f')}]});}return null;})['then'](respondWithResult(_0x11d7a6,null))['catch'](handleError(_0x11d7a6,null));};exports[_0x843b('0x63')]=function(_0x333cca,_0x221054,_0x3bd8b8){var _0x2abed8='';var _0x2efcf1=['id',_0x843b('0x35'),_0x843b('0x64'),_0x843b('0x65'),'description',_0x843b('0x66'),_0x843b('0x67'),_0x843b('0x68'),_0x843b('0x69'),_0x843b('0x6a'),_0x843b('0x6b'),'direction'];return db[_0x843b('0x48')][_0x843b('0x56')]({'where':{'id':_0x333cca['params']['id']},'attributes':['id',_0x843b('0x6c'),_0x843b('0x6d'),_0x843b('0x6e')]})[_0x843b('0x1f')](handleEntityNotFound(_0x221054,null))['then'](function(_0x3f721b){if(_0x3f721b){_0x2abed8=_0x3f721b[_0x843b('0x6e')];var _0x4bb1bc=_0x2abed8[_0x843b('0x6f')](-0x1);if(_0x4bb1bc==='/'){_0x2abed8=_0x2abed8[_0x843b('0x70')](0x0,_0x2abed8[_0x843b('0x71')](_0x4bb1bc));}return rp({'method':'POST','uri':util[_0x843b('0x72')](_0x843b('0x73'),_0x2abed8,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x843b('0x74'),'input_type':_0x843b('0x75'),'response_type':_0x843b('0x75'),'rest_data':JSON[_0x843b('0x76')]({'user_auth':{'user_name':_0x3f721b[_0x843b('0x6c')],'password':_0x3f721b[_0x843b('0x6d')],'encryption':'PLAIN'},'application':_0x843b('0x77')})}});}})[_0x843b('0x1f')](function(_0x479248){if(_0x479248&&_0x479248[_0x843b('0x35')]!==_0x843b('0x78')&&_0x479248[_0x843b('0x35')]!=='Password\x20Expired'){return rp({'method':_0x843b('0x79'),'uri':util[_0x843b('0x72')](_0x843b('0x73'),_0x2abed8,_0x843b('0x7a')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x843b('0x75'),'response_type':_0x843b('0x75'),'rest_data':JSON['stringify']({'session':_0x479248['id'],'module_name':'Calls'})}})['then'](function(_0x36b196){if(_0x36b196){var _0x16dc52=_[_0x843b('0x7b')](_0x36b196[_0x843b('0x7c')]);_[_0x843b('0x7d')](_0x16dc52,function(_0x341463){return _0x2efcf1[_0x843b('0x7e')](_0x341463[_0x843b('0x35')]);});return{'count':_0x16dc52[_0x843b('0x40')],'rows':_[_0x843b('0x37')](_0x16dc52,function(_0x256059){return{'id':_0x256059[_0x843b('0x35')],'name':_0x256059[_0x843b('0x7f')],'custom':_['endsWith'](_0x256059[_0x843b('0x35')],'_c')?!![]:![],'options':_0x256059[_0x843b('0x51')]?_[_0x843b('0x37')](_[_0x843b('0x7b')](_0x256059[_0x843b('0x51')]),function(_0x17b9d7){return{'name':_0x17b9d7[_0x843b('0x80')],'value':_0x17b9d7[_0x843b('0x35')]};}):[]};})};}})[_0x843b('0x1f')](respondWithResult(_0x221054,null))[_0x843b('0x29')](function(_0x4dff31){var _0x53099c=_0x333cca[_0x843b('0x3c')]['test']?0x1f4:_0x4dff31['statusCode']||0x1f4;logger[_0x843b('0x24')](_0x843b('0x81'),'getFields',_0x53099c,JSON[_0x843b('0x76')](_0x4dff31));delete _0x4dff31[_0x843b('0x35')];if(_0x53099c===0x191){_0x53099c=0x190;}_0x221054[_0x843b('0x2b')](_0x53099c)[_0x843b('0x82')](_0x333cca[_0x843b('0x3c')][_0x843b('0x1b')]?{'message':_0x843b('0x83'),'statusCode':_0x4dff31[_0x843b('0x84')]}:_0x4dff31);});}else{var _0x545ad5=0x1f4;_0x221054['status'](_0x545ad5)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index d46b0c9..002e150 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 _0x2428=['moment','bluebird','request-promise','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','lodash','util','api'];(function(_0x171bb5,_0x4191a2){var _0xead2e7=function(_0x5ebbf4){while(--_0x5ebbf4){_0x171bb5['push'](_0x171bb5['shift']());}};_0xead2e7(++_0x4191a2);}(_0x2428,0x75));var _0x8242=function(_0x482dde,_0x526bd4){_0x482dde=_0x482dde-0x0;var _0x353008=_0x2428[_0x482dde];return _0x353008;};'use strict';var _=require(_0x8242('0x0'));var util=require(_0x8242('0x1'));var logger=require('../../config/logger')(_0x8242('0x2'));var moment=require(_0x8242('0x3'));var BPromise=require(_0x8242('0x4'));var rp=require(_0x8242('0x5'));var fs=require('fs');var path=require(_0x8242('0x6'));var rimraf=require(_0x8242('0x7'));var config=require('../../config/environment');var attributes=require(_0x8242('0x8'));var integrations=require(_0x8242('0x9'));module[_0x8242('0xa')]=function(_0x4016de,_0xd67d97){return _0x4016de['define'](_0x8242('0xb'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x52a5=['api','bluebird','request-promise','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','lodash','util','../../config/logger'];(function(_0x4687df,_0x12099c){var _0x32eaef=function(_0x2387db){while(--_0x2387db){_0x4687df['push'](_0x4687df['shift']());}};_0x32eaef(++_0x12099c);}(_0x52a5,0x1d1));var _0x552a=function(_0x353e2d,_0x2117ee){_0x353e2d=_0x353e2d-0x0;var _0x52e4f2=_0x52a5[_0x353e2d];return _0x52e4f2;};'use strict';var _=require(_0x552a('0x0'));var util=require(_0x552a('0x1'));var logger=require(_0x552a('0x2'))(_0x552a('0x3'));var moment=require('moment');var BPromise=require(_0x552a('0x4'));var rp=require(_0x552a('0x5'));var fs=require('fs');var path=require(_0x552a('0x6'));var rimraf=require(_0x552a('0x7'));var config=require('../../config/environment');var attributes=require(_0x552a('0x8'));var integrations=require(_0x552a('0x9'));module[_0x552a('0xa')]=function(_0x4f10f1,_0x39c6f7){return _0x4f10f1[_0x552a('0xb')](_0x552a('0xc'),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 a776c2e..53aac03 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 _0xd14c=['info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','attributes','map','include','model','ShowSugarcrmAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xd14c,0xe1));var _0xcd14=function(_0x50961c,_0x47d795){_0x50961c=_0x50961c-0x0;var _0x34f303=_0xd14c[_0x50961c];return _0x34f303;};'use strict';var _=require(_0xcd14('0x0'));var util=require(_0xcd14('0x1'));var moment=require(_0xcd14('0x2'));var BPromise=require('bluebird');var rs=require(_0xcd14('0x3'));var fs=require('fs');var Redis=require(_0xcd14('0x4'));var db=require(_0xcd14('0x5'))['db'];var utils=require(_0xcd14('0x6'));var logger=require(_0xcd14('0x7'))('rpc');var config=require(_0xcd14('0x8'));var jayson=require(_0xcd14('0x9'));var client=jayson[_0xcd14('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b6295,_0x2249e6,_0x54b3a8){return new BPromise(function(_0x2398ee,_0x510ea4){return client[_0xcd14('0xb')](_0x1b6295,_0x54b3a8)[_0xcd14('0xc')](function(_0x11160f){logger[_0xcd14('0xd')](_0xcd14('0xe'),_0x2249e6,'request\x20sent');logger[_0xcd14('0xf')](_0xcd14('0x10'),_0x2249e6,_0xcd14('0x11'),JSON[_0xcd14('0x12')](_0x11160f));if(_0x11160f[_0xcd14('0x13')]){if(_0x11160f['error']['code']===0x1f4){logger[_0xcd14('0x13')](_0xcd14('0xe'),_0x2249e6,_0x11160f[_0xcd14('0x13')][_0xcd14('0x14')]);return _0x510ea4(_0x11160f[_0xcd14('0x13')][_0xcd14('0x14')]);}logger[_0xcd14('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x2249e6,_0x11160f[_0xcd14('0x13')][_0xcd14('0x14')]);return _0x2398ee(_0x11160f[_0xcd14('0x13')][_0xcd14('0x14')]);}else{logger['info'](_0xcd14('0xe'),_0x2249e6,'request\x20sent');_0x2398ee(_0x11160f[_0xcd14('0x15')][_0xcd14('0x14')]);}})[_0xcd14('0x16')](function(_0x5944fa){logger[_0xcd14('0x13')](_0xcd14('0xe'),_0x2249e6,_0x5944fa);_0x510ea4(_0x5944fa);});});}exports[_0xcd14('0x17')]=function(_0x33a7eb){var _0x2cde8b=this;return new Promise(function(_0x195248,_0x4012e4){return db[_0xcd14('0x18')][_0xcd14('0x19')]({'raw':_0x33a7eb[_0xcd14('0x1a')]?_0x33a7eb['options'][_0xcd14('0x1b')]===undefined?!![]:![]:!![],'where':_0x33a7eb[_0xcd14('0x1a')]?_0x33a7eb[_0xcd14('0x1a')]['where']||null:null,'attributes':_0x33a7eb[_0xcd14('0x1a')]?_0x33a7eb[_0xcd14('0x1a')][_0xcd14('0x1c')]||null:null,'limit':_0x33a7eb['options']?_0x33a7eb['options']['limit']||null:null,'include':_0x33a7eb[_0xcd14('0x1a')]?_0x33a7eb[_0xcd14('0x1a')]['include']?_[_0xcd14('0x1d')](_0x33a7eb['options'][_0xcd14('0x1e')],function(_0x3171a1){return{'model':db[_0x3171a1[_0xcd14('0x1f')]],'as':_0x3171a1['as'],'attributes':_0x3171a1[_0xcd14('0x1c')],'include':_0x3171a1['include']?_[_0xcd14('0x1d')](_0x3171a1[_0xcd14('0x1e')],function(_0x2387b4){return{'model':db[_0x2387b4[_0xcd14('0x1f')]],'as':_0x2387b4['as'],'attributes':_0x2387b4[_0xcd14('0x1c')],'include':_0x2387b4[_0xcd14('0x1e')]?_[_0xcd14('0x1d')](_0x2387b4[_0xcd14('0x1e')],function(_0x170b63){return{'model':db[_0x170b63[_0xcd14('0x1f')]],'as':_0x170b63['as'],'attributes':_0x170b63['attributes']};}):[]};}):[]};}):[]:[]})[_0xcd14('0xc')](function(_0x124ae7){logger[_0xcd14('0xd')](_0xcd14('0x17'),_0x33a7eb);logger['debug'](_0xcd14('0x17'),_0x33a7eb,JSON[_0xcd14('0x12')](_0x124ae7));_0x195248(_0x124ae7);})[_0xcd14('0x16')](function(_0x1d3c35){logger[_0xcd14('0x13')](_0xcd14('0x17'),_0x1d3c35['message'],_0x33a7eb);_0x4012e4(_0x2cde8b['error'](0x1f4,_0x1d3c35['message']));});});};exports[_0xcd14('0x20')]=function(_0x47bdeb){var _0x4744d3=this;return new Promise(function(_0x493b60,_0x30f138){return db['SugarcrmAccount'][_0xcd14('0x21')]({'raw':_0x47bdeb[_0xcd14('0x1a')]?_0x47bdeb[_0xcd14('0x1a')][_0xcd14('0x1b')]===undefined?!![]:![]:!![],'where':_0x47bdeb[_0xcd14('0x1a')]?_0x47bdeb[_0xcd14('0x1a')]['where']||null:null,'attributes':_0x47bdeb[_0xcd14('0x1a')]?_0x47bdeb[_0xcd14('0x1a')][_0xcd14('0x1c')]||null:null,'include':_0x47bdeb['options']?_0x47bdeb[_0xcd14('0x1a')]['include']?_['map'](_0x47bdeb[_0xcd14('0x1a')][_0xcd14('0x1e')],function(_0x4ab022){return{'model':db[_0x4ab022['model']],'as':_0x4ab022['as'],'attributes':_0x4ab022[_0xcd14('0x1c')],'include':_0x4ab022[_0xcd14('0x1e')]?_[_0xcd14('0x1d')](_0x4ab022[_0xcd14('0x1e')],function(_0x4adf87){return{'model':db[_0x4adf87[_0xcd14('0x1f')]],'as':_0x4adf87['as'],'attributes':_0x4adf87[_0xcd14('0x1c')],'include':_0x4adf87[_0xcd14('0x1e')]?_['map'](_0x4adf87[_0xcd14('0x1e')],function(_0x56a78f){return{'model':db[_0x56a78f[_0xcd14('0x1f')]],'as':_0x56a78f['as'],'attributes':_0x56a78f[_0xcd14('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x536e58){logger['info'](_0xcd14('0x20'),_0x47bdeb);logger[_0xcd14('0xf')](_0xcd14('0x20'),_0x47bdeb,JSON[_0xcd14('0x12')](_0x536e58));_0x493b60(_0x536e58);})[_0xcd14('0x16')](function(_0x3bfebd){logger[_0xcd14('0x13')]('ShowSugarcrmAccount',_0x3bfebd[_0xcd14('0x14')],_0x47bdeb);_0x30f138(_0x4744d3[_0xcd14('0x13')](0x1f4,_0x3bfebd['message']));});});}; \ No newline at end of file +var _0x2a95=['code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','limit','include','map','model','attributes','stringify','find','where','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x40036a,_0xcc1cd8){var _0x4d99f3=function(_0x25cb95){while(--_0x25cb95){_0x40036a['push'](_0x40036a['shift']());}};_0x4d99f3(++_0xcc1cd8);}(_0x2a95,0xf6));var _0x52a9=function(_0x1aab22,_0x46c71f){_0x1aab22=_0x1aab22-0x0;var _0x12b243=_0x2a95[_0x1aab22];return _0x12b243;};'use strict';var _=require(_0x52a9('0x0'));var util=require(_0x52a9('0x1'));var moment=require(_0x52a9('0x2'));var BPromise=require(_0x52a9('0x3'));var rs=require(_0x52a9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x52a9('0x5'))['db'];var utils=require(_0x52a9('0x6'));var logger=require(_0x52a9('0x7'))(_0x52a9('0x8'));var config=require(_0x52a9('0x9'));var jayson=require(_0x52a9('0xa'));var client=jayson['client'][_0x52a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ed962,_0xf4eec6,_0x36b69e){return new BPromise(function(_0x4a9935,_0x5446fb){return client[_0x52a9('0xc')](_0x2ed962,_0x36b69e)[_0x52a9('0xd')](function(_0x4bb50b){logger[_0x52a9('0xe')](_0x52a9('0xf'),_0xf4eec6,_0x52a9('0x10'));logger[_0x52a9('0x11')](_0x52a9('0x12'),_0xf4eec6,_0x52a9('0x10'),JSON['stringify'](_0x4bb50b));if(_0x4bb50b[_0x52a9('0x13')]){if(_0x4bb50b[_0x52a9('0x13')][_0x52a9('0x14')]===0x1f4){logger[_0x52a9('0x13')](_0x52a9('0xf'),_0xf4eec6,_0x4bb50b[_0x52a9('0x13')][_0x52a9('0x15')]);return _0x5446fb(_0x4bb50b[_0x52a9('0x13')][_0x52a9('0x15')]);}logger[_0x52a9('0x13')](_0x52a9('0xf'),_0xf4eec6,_0x4bb50b[_0x52a9('0x13')][_0x52a9('0x15')]);return _0x4a9935(_0x4bb50b['error']['message']);}else{logger[_0x52a9('0xe')](_0x52a9('0xf'),_0xf4eec6,_0x52a9('0x10'));_0x4a9935(_0x4bb50b[_0x52a9('0x16')][_0x52a9('0x15')]);}})[_0x52a9('0x17')](function(_0x46e0f9){logger[_0x52a9('0x13')](_0x52a9('0xf'),_0xf4eec6,_0x46e0f9);_0x5446fb(_0x46e0f9);});});}exports[_0x52a9('0x18')]=function(_0x33011c){var _0x1bfbb9=this;return new Promise(function(_0x41350c,_0x488454){return db[_0x52a9('0x19')][_0x52a9('0x1a')]({'raw':_0x33011c[_0x52a9('0x1b')]?_0x33011c[_0x52a9('0x1b')][_0x52a9('0x1c')]===undefined?!![]:![]:!![],'where':_0x33011c[_0x52a9('0x1b')]?_0x33011c[_0x52a9('0x1b')]['where']||null:null,'attributes':_0x33011c['options']?_0x33011c['options']['attributes']||null:null,'limit':_0x33011c[_0x52a9('0x1b')]?_0x33011c[_0x52a9('0x1b')][_0x52a9('0x1d')]||null:null,'include':_0x33011c[_0x52a9('0x1b')]?_0x33011c[_0x52a9('0x1b')][_0x52a9('0x1e')]?_[_0x52a9('0x1f')](_0x33011c[_0x52a9('0x1b')][_0x52a9('0x1e')],function(_0x54de35){return{'model':db[_0x54de35[_0x52a9('0x20')]],'as':_0x54de35['as'],'attributes':_0x54de35[_0x52a9('0x21')],'include':_0x54de35['include']?_[_0x52a9('0x1f')](_0x54de35[_0x52a9('0x1e')],function(_0x7b81fb){return{'model':db[_0x7b81fb['model']],'as':_0x7b81fb['as'],'attributes':_0x7b81fb['attributes'],'include':_0x7b81fb[_0x52a9('0x1e')]?_['map'](_0x7b81fb['include'],function(_0x10804c){return{'model':db[_0x10804c[_0x52a9('0x20')]],'as':_0x10804c['as'],'attributes':_0x10804c[_0x52a9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x52a9('0xd')](function(_0x5420dc){logger[_0x52a9('0xe')](_0x52a9('0x18'),_0x33011c);logger['debug']('GetSugarcrmAccount',_0x33011c,JSON[_0x52a9('0x22')](_0x5420dc));_0x41350c(_0x5420dc);})[_0x52a9('0x17')](function(_0x2ef35d){logger[_0x52a9('0x13')]('GetSugarcrmAccount',_0x2ef35d[_0x52a9('0x15')],_0x33011c);_0x488454(_0x1bfbb9[_0x52a9('0x13')](0x1f4,_0x2ef35d[_0x52a9('0x15')]));});});};exports['ShowSugarcrmAccount']=function(_0x44aa0a){var _0x144d80=this;return new Promise(function(_0xce1f44,_0x72890b){return db['SugarcrmAccount'][_0x52a9('0x23')]({'raw':_0x44aa0a[_0x52a9('0x1b')]?_0x44aa0a['options'][_0x52a9('0x1c')]===undefined?!![]:![]:!![],'where':_0x44aa0a[_0x52a9('0x1b')]?_0x44aa0a[_0x52a9('0x1b')][_0x52a9('0x24')]||null:null,'attributes':_0x44aa0a['options']?_0x44aa0a['options'][_0x52a9('0x21')]||null:null,'include':_0x44aa0a[_0x52a9('0x1b')]?_0x44aa0a[_0x52a9('0x1b')][_0x52a9('0x1e')]?_[_0x52a9('0x1f')](_0x44aa0a[_0x52a9('0x1b')][_0x52a9('0x1e')],function(_0x2d94e1){return{'model':db[_0x2d94e1[_0x52a9('0x20')]],'as':_0x2d94e1['as'],'attributes':_0x2d94e1[_0x52a9('0x21')],'include':_0x2d94e1[_0x52a9('0x1e')]?_[_0x52a9('0x1f')](_0x2d94e1['include'],function(_0x2c6341){return{'model':db[_0x2c6341[_0x52a9('0x20')]],'as':_0x2c6341['as'],'attributes':_0x2c6341[_0x52a9('0x21')],'include':_0x2c6341[_0x52a9('0x1e')]?_[_0x52a9('0x1f')](_0x2c6341[_0x52a9('0x1e')],function(_0x226981){return{'model':db[_0x226981['model']],'as':_0x226981['as'],'attributes':_0x226981[_0x52a9('0x21')]};}):[]};}):[]};}):[]:[]})[_0x52a9('0xd')](function(_0x58e4b9){logger[_0x52a9('0xe')]('ShowSugarcrmAccount',_0x44aa0a);logger[_0x52a9('0x11')]('ShowSugarcrmAccount',_0x44aa0a,JSON[_0x52a9('0x22')](_0x58e4b9));_0xce1f44(_0x58e4b9);})['catch'](function(_0x56bbec){logger[_0x52a9('0x13')](_0x52a9('0x25'),_0x56bbec[_0x52a9('0x15')],_0x44aa0a);_0x72890b(_0x144d80[_0x52a9('0x13')](0x1f4,_0x56bbec[_0x52a9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 388b0a8..0335e01 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 _0x3e26=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','/:id','show','get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','destroy','exports','multer','util','path'];(function(_0x2aa48b,_0x5a4446){var _0x48caf8=function(_0x13230c){while(--_0x13230c){_0x2aa48b['push'](_0x2aa48b['shift']());}};_0x48caf8(++_0x5a4446);}(_0x3e26,0xad));var _0x63e2=function(_0x2140bd,_0x5cde81){_0x2140bd=_0x2140bd-0x0;var _0x2a6e37=_0x3e26[_0x2140bd];return _0x2a6e37;};'use strict';var multer=require(_0x63e2('0x0'));var util=require(_0x63e2('0x1'));var path=require(_0x63e2('0x2'));var timeout=require(_0x63e2('0x3'));var express=require('express');var router=express[_0x63e2('0x4')]();var auth=require(_0x63e2('0x5'));var interaction=require(_0x63e2('0x6'));var config=require(_0x63e2('0x7'));var controller=require(_0x63e2('0x8'));router['get']('/',auth[_0x63e2('0x9')](),controller['index']);router['get'](_0x63e2('0xa'),auth[_0x63e2('0x9')](),controller[_0x63e2('0xb')]);router[_0x63e2('0xc')](_0x63e2('0xd'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0x63e2('0xe'),auth[_0x63e2('0x9')](),controller[_0x63e2('0xf')]);router[_0x63e2('0xc')](_0x63e2('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x63e2('0x11')]('/',auth[_0x63e2('0x9')](),controller[_0x63e2('0x12')]);router[_0x63e2('0x13')](_0x63e2('0xa'),auth[_0x63e2('0x9')](),controller['update']);router['delete'](_0x63e2('0xa'),auth[_0x63e2('0x9')](),controller[_0x63e2('0x14')]);module[_0x63e2('0x15')]=router; \ No newline at end of file +var _0x8898=['exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getDescriptions','create','put','update','delete','destroy'];(function(_0x2deb38,_0xe86ff8){var _0x560599=function(_0x2c8e37){while(--_0x2c8e37){_0x2deb38['push'](_0x2deb38['shift']());}};_0x560599(++_0xe86ff8);}(_0x8898,0xc7));var _0x8889=function(_0xe83032,_0x2c2509){_0xe83032=_0xe83032-0x0;var _0x303ab6=_0x8898[_0xe83032];return _0x303ab6;};'use strict';var multer=require(_0x8889('0x0'));var util=require('util');var path=require(_0x8889('0x1'));var timeout=require('connect-timeout');var express=require(_0x8889('0x2'));var router=express['Router']();var auth=require(_0x8889('0x3'));var interaction=require(_0x8889('0x4'));var config=require(_0x8889('0x5'));var controller=require(_0x8889('0x6'));router['get']('/',auth[_0x8889('0x7')](),controller[_0x8889('0x8')]);router[_0x8889('0x9')](_0x8889('0xa'),auth['isAuthenticated'](),controller[_0x8889('0xb')]);router[_0x8889('0x9')](_0x8889('0xc'),auth['isAuthenticated'](),controller[_0x8889('0xd')]);router['get'](_0x8889('0xe'),auth[_0x8889('0x7')](),controller['getSubjects']);router[_0x8889('0x9')]('/:id/descriptions',auth[_0x8889('0x7')](),controller[_0x8889('0xf')]);router['post']('/',auth[_0x8889('0x7')](),controller[_0x8889('0x10')]);router[_0x8889('0x11')](_0x8889('0xa'),auth[_0x8889('0x7')](),controller[_0x8889('0x12')]);router[_0x8889('0x13')](_0x8889('0xa'),auth['isAuthenticated'](),controller[_0x8889('0x14')]);module[_0x8889('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 7009454..fc774bf 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 _0xac8b=['exports'];(function(_0x266ddc,_0x45aa52){var _0x39c1d7=function(_0x4cd07c){while(--_0x4cd07c){_0x266ddc['push'](_0x266ddc['shift']());}};_0x39c1d7(++_0x45aa52);}(_0xac8b,0x198));var _0xbac8=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xac8b[_0xbd08b4];return _0x314f1e;};'use strict';var Sequelize=require('sequelize');module[_0xbac8('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x54b7=['STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x54b7,0xdb));var _0x754b=function(_0x29f170,_0x11ceee){_0x29f170=_0x29f170-0x0;var _0x3d91db=_0x54b7[_0x29f170];return _0x3d91db;};'use strict';var Sequelize=require(_0x754b('0x0'));module['exports']={'name':{'type':Sequelize[_0x754b('0x1')]},'description':{'type':Sequelize[_0x754b('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index cfbc275..f917c02 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 _0x72c7=['getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','sendStatus','end','json','count','offset','limit','status','Content-Range','save','update','destroy','stack','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','SugarcrmConfiguration','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','getFields','findOne','getSubjects','SugarcrmField'];(function(_0x404424,_0x1f0460){var _0x443c22=function(_0x176561){while(--_0x176561){_0x404424['push'](_0x404424['shift']());}};_0x443c22(++_0x1f0460);}(_0x72c7,0x109));var _0x772c=function(_0x38f7da,_0x43f950){_0x38f7da=_0x38f7da-0x0;var _0x166c07=_0x72c7[_0x38f7da];return _0x166c07;};'use strict';var pdf=require(_0x772c('0x0'));var emlformat=require(_0x772c('0x1'));var rimraf=require(_0x772c('0x2'));var zipdir=require(_0x772c('0x3'));var jsonpatch=require(_0x772c('0x4'));var rp=require('request-promise');var moment=require(_0x772c('0x5'));var BPromise=require(_0x772c('0x6'));var Mustache=require('mustache');var util=require(_0x772c('0x7'));var path=require(_0x772c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x772c('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x772c('0xa'));var deskjs=require(_0x772c('0xb'));var toCsv=require(_0x772c('0xc'));var querystring=require(_0x772c('0xd'));var Papa=require(_0x772c('0xe'));var Redis=require(_0x772c('0xf'));var authService=require(_0x772c('0x10'));var qs=require(_0x772c('0x11'));var as=require(_0x772c('0x12'));var hardwareService=require(_0x772c('0x13'));var logger=require(_0x772c('0x14'))(_0x772c('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x772c('0x16')][_0x772c('0x17')]({'port':0x232a});function checkPasswordPattern(_0x3b2724,_0x535c36,_0x2c5ab3){if(_0x2c5ab3){var _0x543fdb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x543fdb['test'](_0x535c36)){return _0x3b2724;}else{throw new db[(_0x772c('0x18'))][(_0x772c('0x19'))](_0x772c('0x1a'));}}else{return _0x3b2724;}}function respondWithRpcPromise(_0x5ea087,_0x4f7892,_0x1c05f0,_0x5dfacf){return new BPromise(function(_0x1efbda,_0x311cff){var _0xf37bb=_0x5dfacf||client;return _0xf37bb[_0x772c('0x1b')](_0x5ea087,_0x1c05f0)[_0x772c('0x1c')](function(_0xa6922d){logger['info'](_0x772c('0x1d'),_0x4f7892,_0x772c('0x1e'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x4f7892,_0x772c('0x1e'),JSON[_0x772c('0x1f')](_0xa6922d));if(_0xa6922d['error']){if(_0xa6922d['error'][_0x772c('0x20')]===0x1f4){logger[_0x772c('0x21')](_0x772c('0x1d'),_0x4f7892,_0xa6922d[_0x772c('0x21')]['message']);return _0x311cff(_0xa6922d[_0x772c('0x21')][_0x772c('0x22')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x4f7892,_0xa6922d[_0x772c('0x21')][_0x772c('0x22')]);return _0x1efbda(_0xa6922d[_0x772c('0x21')][_0x772c('0x22')]);}else{logger['info'](_0x772c('0x1d'),_0x4f7892,_0x772c('0x1e'));_0x1efbda(_0xa6922d['result'][_0x772c('0x22')]);}})[_0x772c('0x23')](function(_0x49c065){logger[_0x772c('0x21')](_0x772c('0x1d'),_0x4f7892,_0x49c065);_0x311cff(_0x49c065);});});}function respondWithStatusCode(_0x4c37b6,_0x24b0d0){_0x24b0d0=_0x24b0d0||0xcc;return function(_0x29c185){if(_0x29c185){return _0x4c37b6[_0x772c('0x24')](_0x24b0d0);}return _0x4c37b6['status'](_0x24b0d0)[_0x772c('0x25')]();};}function respondWithResult(_0x91eca7,_0x46bd2c){_0x46bd2c=_0x46bd2c||0xc8;return function(_0x1effef){if(_0x1effef){return _0x91eca7['status'](_0x46bd2c)[_0x772c('0x26')](_0x1effef);}};}function respondWithFilteredResult(_0x2eeae5,_0x1968fe){return function(_0x2ff568){if(_0x2ff568){var _0x3d48ee=_0x2ff568[_0x772c('0x27')],_0xe797da=_0x1968fe[_0x772c('0x28')],_0x5addd4=_0x1968fe['offset']+_0x1968fe[_0x772c('0x29')],_0x49d989;if(_0x5addd4>=_0x3d48ee){_0x5addd4=_0x3d48ee;_0x49d989=0xc8;}else{_0x49d989=0xce;}_0x2eeae5[_0x772c('0x2a')](_0x49d989);return _0x2eeae5['set'](_0x772c('0x2b'),_0xe797da+'-'+_0x5addd4+'/'+_0x3d48ee)[_0x772c('0x26')](_0x2ff568);}return null;};}function patchUpdates(_0x5d77d0){return function(_0x317f1c){try{jsonpatch['apply'](_0x317f1c,_0x5d77d0,!![]);}catch(_0x85a28d){return BPromise['reject'](_0x85a28d);}return _0x317f1c[_0x772c('0x2c')]();};}function saveUpdates(_0xd5c4b,_0x31c37e){return function(_0x45a380){if(_0x45a380){return _0x45a380[_0x772c('0x2d')](_0xd5c4b)['then'](function(_0x5cf881){return _0x5cf881;});}return null;};}function removeEntity(_0x3320d0,_0x4b1011){return function(_0x2c7e81){if(_0x2c7e81){return _0x2c7e81[_0x772c('0x2e')]()[_0x772c('0x1c')](function(){_0x3320d0[_0x772c('0x2a')](0xcc)[_0x772c('0x25')]();});}};}function handleEntityNotFound(_0x572d8e,_0x1e28d6){return function(_0x4762b8){if(!_0x4762b8){_0x572d8e['sendStatus'](0x194);}return _0x4762b8;};}function handleError(_0x347224,_0x54efa2){_0x54efa2=_0x54efa2||0x1f4;return function(_0x52fc39){logger[_0x772c('0x21')](_0x52fc39[_0x772c('0x2f')]);if(_0x52fc39[_0x772c('0x30')]){delete _0x52fc39['name'];}_0x347224[_0x772c('0x2a')](_0x54efa2)['send'](_0x52fc39);};}exports[_0x772c('0x31')]=function(_0x2e1c56,_0x44e839){var _0x1cf2dc={},_0x5a1751={},_0x2c4f00={'count':0x0,'rows':[]};var _0x2b36f9=_[_0x772c('0x32')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x156146){return{'name':_0x156146[_0x772c('0x33')],'type':_0x156146[_0x772c('0x34')][_0x772c('0x35')]};});_0x5a1751[_0x772c('0x36')]=_['map'](_0x2b36f9,_0x772c('0x30'));_0x5a1751[_0x772c('0x37')]=_[_0x772c('0x38')](_0x2e1c56[_0x772c('0x37')]);_0x5a1751[_0x772c('0x39')]=_[_0x772c('0x3a')](_0x5a1751[_0x772c('0x36')],_0x5a1751['query']);_0x1cf2dc['attributes']=_[_0x772c('0x3a')](_0x5a1751[_0x772c('0x36')],qs[_0x772c('0x3b')](_0x2e1c56[_0x772c('0x37')][_0x772c('0x3b')]));_0x1cf2dc[_0x772c('0x3c')]=_0x1cf2dc['attributes'][_0x772c('0x3d')]?_0x1cf2dc['attributes']:_0x5a1751['model'];if(!_0x2e1c56['query'][_0x772c('0x3e')](_0x772c('0x3f'))){_0x1cf2dc['limit']=qs[_0x772c('0x29')](_0x2e1c56[_0x772c('0x37')][_0x772c('0x29')]);_0x1cf2dc['offset']=qs[_0x772c('0x28')](_0x2e1c56[_0x772c('0x37')][_0x772c('0x28')]);}_0x1cf2dc[_0x772c('0x40')]=qs['sort'](_0x2e1c56['query'][_0x772c('0x41')]);_0x1cf2dc[_0x772c('0x42')]=qs[_0x772c('0x39')](_[_0x772c('0x43')](_0x2e1c56[_0x772c('0x37')],_0x5a1751[_0x772c('0x39')]),_0x2b36f9);if(_0x2e1c56[_0x772c('0x37')][_0x772c('0x44')]){_0x1cf2dc[_0x772c('0x42')]=_[_0x772c('0x45')](_0x1cf2dc[_0x772c('0x42')],{'$or':_[_0x772c('0x32')](_0x2b36f9,function(_0x437c61){if(_0x437c61[_0x772c('0x34')]!==_0x772c('0x46')){var _0x328860={};_0x328860[_0x437c61[_0x772c('0x30')]]={'$like':'%'+_0x2e1c56[_0x772c('0x37')][_0x772c('0x44')]+'%'};return _0x328860;}})});}_0x1cf2dc=_[_0x772c('0x45')]({},_0x1cf2dc,_0x2e1c56[_0x772c('0x47')]);var _0x5d3a9b={'where':_0x1cf2dc[_0x772c('0x42')]};return db[_0x772c('0x48')]['count'](_0x5d3a9b)['then'](function(_0x36ae56){_0x2c4f00['count']=_0x36ae56;if(_0x2e1c56[_0x772c('0x37')][_0x772c('0x49')]){_0x1cf2dc[_0x772c('0x4a')]=[{'all':!![]}];}return db[_0x772c('0x48')][_0x772c('0x4b')](_0x1cf2dc);})['then'](function(_0x5778ab){_0x2c4f00[_0x772c('0x4c')]=_0x5778ab;return _0x2c4f00;})['then'](respondWithFilteredResult(_0x44e839,_0x1cf2dc))[_0x772c('0x23')](handleError(_0x44e839,null));};exports[_0x772c('0x4d')]=function(_0x145208,_0x50ece3){var _0x64f0f6={'raw':![],'where':{'id':_0x145208[_0x772c('0x4e')]['id']}},_0x2efdc6={};_0x2efdc6[_0x772c('0x36')]=_[_0x772c('0x38')](db[_0x772c('0x48')][_0x772c('0x4f')]);_0x2efdc6[_0x772c('0x37')]=_[_0x772c('0x38')](_0x145208[_0x772c('0x37')]);_0x2efdc6[_0x772c('0x39')]=_[_0x772c('0x3a')](_0x2efdc6[_0x772c('0x36')],_0x2efdc6[_0x772c('0x37')]);_0x64f0f6['attributes']=_[_0x772c('0x3a')](_0x2efdc6[_0x772c('0x36')],qs[_0x772c('0x3b')](_0x145208[_0x772c('0x37')]['fields']));_0x64f0f6[_0x772c('0x3c')]=_0x64f0f6[_0x772c('0x3c')][_0x772c('0x3d')]?_0x64f0f6[_0x772c('0x3c')]:_0x2efdc6[_0x772c('0x36')];if(_0x145208['query'][_0x772c('0x49')]){_0x64f0f6['include']=[{'all':!![]}];}_0x64f0f6=_[_0x772c('0x45')]({},_0x64f0f6,_0x145208['options']);return db[_0x772c('0x48')][_0x772c('0x50')](_0x64f0f6)[_0x772c('0x1c')](handleEntityNotFound(_0x50ece3,null))[_0x772c('0x1c')](respondWithResult(_0x50ece3,null))[_0x772c('0x23')](handleError(_0x50ece3,null));};exports['create']=function(_0x5788de,_0x257e9e){return db[_0x772c('0x48')][_0x772c('0x51')](_0x5788de[_0x772c('0x52')],{})['then'](respondWithResult(_0x257e9e,0xc9))[_0x772c('0x23')](handleError(_0x257e9e,null));};exports[_0x772c('0x2d')]=function(_0x482a24,_0x3ea19e){if(_0x482a24['body']['id']){delete _0x482a24[_0x772c('0x52')]['id'];}return db[_0x772c('0x48')]['find']({'where':{'id':_0x482a24[_0x772c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3ea19e,null))[_0x772c('0x1c')](saveUpdates(_0x482a24[_0x772c('0x52')],null))[_0x772c('0x1c')](respondWithResult(_0x3ea19e,null))[_0x772c('0x23')](handleError(_0x3ea19e,null));};exports[_0x772c('0x2e')]=function(_0x19cc52,_0x18db39){return db[_0x772c('0x48')][_0x772c('0x50')]({'where':{'id':_0x19cc52[_0x772c('0x4e')]['id']}})[_0x772c('0x1c')](handleEntityNotFound(_0x18db39,null))[_0x772c('0x1c')](removeEntity(_0x18db39,null))[_0x772c('0x23')](handleError(_0x18db39,null));};exports[_0x772c('0x53')]=function(_0x53a917,_0x5cf6fe,_0x5d27a9){var _0x5b3197={};var _0x42017e={};var _0x2c41fd;var _0x51cf19;return db[_0x772c('0x48')][_0x772c('0x54')]({'where':{'id':_0x53a917[_0x772c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5cf6fe,null))['then'](function(_0x1cb168){if(_0x1cb168){_0x2c41fd=_0x1cb168;_0x42017e[_0x772c('0x36')]=_[_0x772c('0x38')](db['SugarcrmField'][_0x772c('0x4f')]);_0x42017e[_0x772c('0x37')]=_[_0x772c('0x38')](_0x53a917[_0x772c('0x37')]);_0x42017e[_0x772c('0x39')]=_['intersection'](_0x42017e[_0x772c('0x36')],_0x42017e[_0x772c('0x37')]);_0x5b3197['attributes']=_[_0x772c('0x3a')](_0x42017e[_0x772c('0x36')],qs[_0x772c('0x3b')](_0x53a917['query'][_0x772c('0x3b')]));_0x5b3197[_0x772c('0x3c')]=_0x5b3197[_0x772c('0x3c')]['length']?_0x5b3197[_0x772c('0x3c')]:_0x42017e[_0x772c('0x36')];_0x5b3197['order']=qs['sort'](_0x53a917[_0x772c('0x37')]['sort']);_0x5b3197[_0x772c('0x42')]=qs[_0x772c('0x39')](_[_0x772c('0x43')](_0x53a917['query'],_0x42017e[_0x772c('0x39')]));if(_0x53a917[_0x772c('0x37')][_0x772c('0x44')]){_0x5b3197[_0x772c('0x42')]=_[_0x772c('0x45')](_0x5b3197[_0x772c('0x42')],{'$or':_[_0x772c('0x32')](_0x5b3197[_0x772c('0x3c')],function(_0x8b99c6){var _0x3d8168={};_0x3d8168[_0x8b99c6]={'$like':'%'+_0x53a917[_0x772c('0x37')][_0x772c('0x44')]+'%'};return _0x3d8168;})});}_0x5b3197=_['merge']({},_0x5b3197,_0x53a917[_0x772c('0x47')]);return _0x2c41fd[_0x772c('0x53')](_0x5b3197);}})[_0x772c('0x1c')](function(_0x10cabe){if(_0x10cabe){_0x51cf19=_0x10cabe['length'];if(!_0x53a917[_0x772c('0x37')]['hasOwnProperty'](_0x772c('0x3f'))){_0x5b3197['limit']=qs[_0x772c('0x29')](_0x53a917[_0x772c('0x37')][_0x772c('0x29')]);_0x5b3197[_0x772c('0x28')]=qs[_0x772c('0x28')](_0x53a917['query'][_0x772c('0x28')]);}return _0x2c41fd[_0x772c('0x53')](_0x5b3197);}})[_0x772c('0x1c')](function(_0x544003){if(_0x544003){return _0x544003?{'count':_0x51cf19,'rows':_0x544003}:null;}})[_0x772c('0x1c')](respondWithResult(_0x5cf6fe,null))[_0x772c('0x23')](handleError(_0x5cf6fe,null));};exports[_0x772c('0x55')]=function(_0x200d96,_0x2e9784,_0x530778){var _0x41fde2={};var _0x4337ec={};var _0x5a1078;var _0x4518d2;return db[_0x772c('0x48')][_0x772c('0x54')]({'where':{'id':_0x200d96[_0x772c('0x4e')]['id']}})[_0x772c('0x1c')](handleEntityNotFound(_0x2e9784,null))[_0x772c('0x1c')](function(_0x23818d){if(_0x23818d){_0x5a1078=_0x23818d;_0x4337ec['model']=_[_0x772c('0x38')](db[_0x772c('0x56')][_0x772c('0x4f')]);_0x4337ec[_0x772c('0x37')]=_['keys'](_0x200d96['query']);_0x4337ec[_0x772c('0x39')]=_[_0x772c('0x3a')](_0x4337ec[_0x772c('0x36')],_0x4337ec[_0x772c('0x37')]);_0x41fde2[_0x772c('0x3c')]=_['intersection'](_0x4337ec[_0x772c('0x36')],qs[_0x772c('0x3b')](_0x200d96[_0x772c('0x37')]['fields']));_0x41fde2[_0x772c('0x3c')]=_0x41fde2['attributes'][_0x772c('0x3d')]?_0x41fde2['attributes']:_0x4337ec[_0x772c('0x36')];_0x41fde2[_0x772c('0x40')]=qs[_0x772c('0x41')](_0x200d96['query']['sort']);_0x41fde2[_0x772c('0x42')]=qs[_0x772c('0x39')](_[_0x772c('0x43')](_0x200d96[_0x772c('0x37')],_0x4337ec['filters']));if(_0x200d96[_0x772c('0x37')][_0x772c('0x44')]){_0x41fde2[_0x772c('0x42')]=_[_0x772c('0x45')](_0x41fde2[_0x772c('0x42')],{'$or':_[_0x772c('0x32')](_0x41fde2[_0x772c('0x3c')],function(_0x37e921){var _0x10a7f0={};_0x10a7f0[_0x37e921]={'$like':'%'+_0x200d96[_0x772c('0x37')]['filter']+'%'};return _0x10a7f0;})});}_0x41fde2=_[_0x772c('0x45')]({},_0x41fde2,_0x200d96[_0x772c('0x47')]);return _0x5a1078[_0x772c('0x55')](_0x41fde2);}})['then'](function(_0x542a62){if(_0x542a62){_0x4518d2=_0x542a62[_0x772c('0x3d')];if(!_0x200d96[_0x772c('0x37')][_0x772c('0x3e')](_0x772c('0x3f'))){_0x41fde2['limit']=qs[_0x772c('0x29')](_0x200d96['query'][_0x772c('0x29')]);_0x41fde2[_0x772c('0x28')]=qs['offset'](_0x200d96[_0x772c('0x37')][_0x772c('0x28')]);}return _0x5a1078[_0x772c('0x55')](_0x41fde2);}})[_0x772c('0x1c')](function(_0x53be92){if(_0x53be92){return _0x53be92?{'count':_0x4518d2,'rows':_0x53be92}:null;}})[_0x772c('0x1c')](respondWithResult(_0x2e9784,null))['catch'](handleError(_0x2e9784,null));};exports[_0x772c('0x57')]=function(_0x161a66,_0x4cde5e,_0x4209fb){var _0x520103={};var _0x46e333={};var _0x590a9e;var _0x3db5b6;return db[_0x772c('0x48')]['findOne']({'where':{'id':_0x161a66[_0x772c('0x4e')]['id']}})[_0x772c('0x1c')](handleEntityNotFound(_0x4cde5e,null))[_0x772c('0x1c')](function(_0x302e56){if(_0x302e56){_0x590a9e=_0x302e56;_0x46e333['model']=_[_0x772c('0x38')](db[_0x772c('0x56')][_0x772c('0x4f')]);_0x46e333[_0x772c('0x37')]=_['keys'](_0x161a66['query']);_0x46e333[_0x772c('0x39')]=_[_0x772c('0x3a')](_0x46e333['model'],_0x46e333[_0x772c('0x37')]);_0x520103[_0x772c('0x3c')]=_[_0x772c('0x3a')](_0x46e333['model'],qs[_0x772c('0x3b')](_0x161a66[_0x772c('0x37')][_0x772c('0x3b')]));_0x520103[_0x772c('0x3c')]=_0x520103[_0x772c('0x3c')]['length']?_0x520103[_0x772c('0x3c')]:_0x46e333[_0x772c('0x36')];_0x520103[_0x772c('0x40')]=qs[_0x772c('0x41')](_0x161a66['query'][_0x772c('0x41')]);_0x520103[_0x772c('0x42')]=qs['filters'](_[_0x772c('0x43')](_0x161a66[_0x772c('0x37')],_0x46e333[_0x772c('0x39')]));if(_0x161a66[_0x772c('0x37')][_0x772c('0x44')]){_0x520103[_0x772c('0x42')]=_[_0x772c('0x45')](_0x520103[_0x772c('0x42')],{'$or':_['map'](_0x520103[_0x772c('0x3c')],function(_0xacd5e4){var _0x26f654={};_0x26f654[_0xacd5e4]={'$like':'%'+_0x161a66[_0x772c('0x37')][_0x772c('0x44')]+'%'};return _0x26f654;})});}_0x520103=_['merge']({},_0x520103,_0x161a66[_0x772c('0x47')]);return _0x590a9e['getDescriptions'](_0x520103);}})['then'](function(_0x517aba){if(_0x517aba){_0x3db5b6=_0x517aba[_0x772c('0x3d')];if(!_0x161a66[_0x772c('0x37')][_0x772c('0x3e')]('nolimit')){_0x520103[_0x772c('0x29')]=qs[_0x772c('0x29')](_0x161a66[_0x772c('0x37')][_0x772c('0x29')]);_0x520103[_0x772c('0x28')]=qs[_0x772c('0x28')](_0x161a66[_0x772c('0x37')][_0x772c('0x28')]);}return _0x590a9e[_0x772c('0x57')](_0x520103);}})[_0x772c('0x1c')](function(_0x5e43f9){if(_0x5e43f9){return _0x5e43f9?{'count':_0x3db5b6,'rows':_0x5e43f9}:null;}})[_0x772c('0x1c')](respondWithResult(_0x4cde5e,null))[_0x772c('0x23')](handleError(_0x4cde5e,null));}; \ No newline at end of file +var _0xa1c4=['info','catch','status','end','json','count','offset','limit','Content-Range','reject','save','destroy','sendStatus','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','SugarcrmConfiguration','includeAll','include','findAll','create','body','update','find','params','getFields','getSubjects','SugarcrmField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','test','Sequelize','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x355c21,_0x31c30d){var _0x1102d5=function(_0x3968d0){while(--_0x3968d0){_0x355c21['push'](_0x355c21['shift']());}};_0x1102d5(++_0x31c30d);}(_0xa1c4,0x91));var _0x4a1c=function(_0x393bf5,_0x225cac){_0x393bf5=_0x393bf5-0x0;var _0xcb023=_0xa1c4[_0x393bf5];return _0xcb023;};'use strict';var pdf=require(_0x4a1c('0x0'));var emlformat=require(_0x4a1c('0x1'));var rimraf=require(_0x4a1c('0x2'));var zipdir=require(_0x4a1c('0x3'));var jsonpatch=require(_0x4a1c('0x4'));var rp=require(_0x4a1c('0x5'));var moment=require(_0x4a1c('0x6'));var BPromise=require(_0x4a1c('0x7'));var Mustache=require(_0x4a1c('0x8'));var util=require(_0x4a1c('0x9'));var path=require(_0x4a1c('0xa'));var sox=require(_0x4a1c('0xb'));var csv=require(_0x4a1c('0xc'));var ejs=require(_0x4a1c('0xd'));var fs=require('fs');var _=require(_0x4a1c('0xe'));var squel=require('squel');var crypto=require(_0x4a1c('0xf'));var jsforce=require(_0x4a1c('0x10'));var deskjs=require(_0x4a1c('0x11'));var toCsv=require(_0x4a1c('0xc'));var querystring=require(_0x4a1c('0x12'));var Papa=require(_0x4a1c('0x13'));var Redis=require('ioredis');var authService=require(_0x4a1c('0x14'));var qs=require(_0x4a1c('0x15'));var as=require(_0x4a1c('0x16'));var hardwareService=require(_0x4a1c('0x17'));var logger=require(_0x4a1c('0x18'))('api');var utils=require(_0x4a1c('0x19'));var config=require('../../config/environment');var db=require(_0x4a1c('0x1a'))['db'];var jayson=require(_0x4a1c('0x1b'));var client=jayson[_0x4a1c('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x2ab10d,_0x206011,_0x2c8ca0){if(_0x2c8ca0){var _0x106c61=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x106c61[_0x4a1c('0x1d')](_0x206011)){return _0x2ab10d;}else{throw new db[(_0x4a1c('0x1e'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2ab10d;}}function respondWithRpcPromise(_0x21e2a7,_0x3628a9,_0x36a191,_0x5d5863){return new BPromise(function(_0x2418f7,_0x216eac){var _0x2bb934=_0x5d5863||client;return _0x2bb934[_0x4a1c('0x1f')](_0x21e2a7,_0x36a191)[_0x4a1c('0x20')](function(_0x17cc13){logger['info'](_0x4a1c('0x21'),_0x3628a9,_0x4a1c('0x22'));logger[_0x4a1c('0x23')](_0x4a1c('0x24'),_0x3628a9,_0x4a1c('0x22'),JSON[_0x4a1c('0x25')](_0x17cc13));if(_0x17cc13['error']){if(_0x17cc13[_0x4a1c('0x26')][_0x4a1c('0x27')]===0x1f4){logger[_0x4a1c('0x26')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3628a9,_0x17cc13[_0x4a1c('0x26')][_0x4a1c('0x28')]);return _0x216eac(_0x17cc13[_0x4a1c('0x26')][_0x4a1c('0x28')]);}logger['error'](_0x4a1c('0x21'),_0x3628a9,_0x17cc13[_0x4a1c('0x26')][_0x4a1c('0x28')]);return _0x2418f7(_0x17cc13[_0x4a1c('0x26')][_0x4a1c('0x28')]);}else{logger[_0x4a1c('0x29')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x3628a9,_0x4a1c('0x22'));_0x2418f7(_0x17cc13['result'][_0x4a1c('0x28')]);}})[_0x4a1c('0x2a')](function(_0x184de5){logger[_0x4a1c('0x26')](_0x4a1c('0x21'),_0x3628a9,_0x184de5);_0x216eac(_0x184de5);});});}function respondWithStatusCode(_0x8905f3,_0x29ecb6){_0x29ecb6=_0x29ecb6||0xcc;return function(_0x4b3004){if(_0x4b3004){return _0x8905f3['sendStatus'](_0x29ecb6);}return _0x8905f3[_0x4a1c('0x2b')](_0x29ecb6)[_0x4a1c('0x2c')]();};}function respondWithResult(_0x115bd8,_0x3a158d){_0x3a158d=_0x3a158d||0xc8;return function(_0x3f50c1){if(_0x3f50c1){return _0x115bd8[_0x4a1c('0x2b')](_0x3a158d)[_0x4a1c('0x2d')](_0x3f50c1);}};}function respondWithFilteredResult(_0xf8f22b,_0x937e82){return function(_0xf6e4fc){if(_0xf6e4fc){var _0x4b3b08=_0xf6e4fc[_0x4a1c('0x2e')],_0x17bc54=_0x937e82[_0x4a1c('0x2f')],_0x34b04a=_0x937e82[_0x4a1c('0x2f')]+_0x937e82[_0x4a1c('0x30')],_0x289ed1;if(_0x34b04a>=_0x4b3b08){_0x34b04a=_0x4b3b08;_0x289ed1=0xc8;}else{_0x289ed1=0xce;}_0xf8f22b['status'](_0x289ed1);return _0xf8f22b['set'](_0x4a1c('0x31'),_0x17bc54+'-'+_0x34b04a+'/'+_0x4b3b08)[_0x4a1c('0x2d')](_0xf6e4fc);}return null;};}function patchUpdates(_0x5af5a4){return function(_0x43607d){try{jsonpatch['apply'](_0x43607d,_0x5af5a4,!![]);}catch(_0x369f8f){return BPromise[_0x4a1c('0x32')](_0x369f8f);}return _0x43607d[_0x4a1c('0x33')]();};}function saveUpdates(_0x3d0ace,_0x121d37){return function(_0x32f5c3){if(_0x32f5c3){return _0x32f5c3['update'](_0x3d0ace)[_0x4a1c('0x20')](function(_0xf4e32c){return _0xf4e32c;});}return null;};}function removeEntity(_0x35229d,_0x5eedb6){return function(_0x43386f){if(_0x43386f){return _0x43386f[_0x4a1c('0x34')]()[_0x4a1c('0x20')](function(){_0x35229d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2950b7,_0xcbd132){return function(_0x12c00c){if(!_0x12c00c){_0x2950b7[_0x4a1c('0x35')](0x194);}return _0x12c00c;};}function handleError(_0x33c129,_0x35ca41){_0x35ca41=_0x35ca41||0x1f4;return function(_0x4bd79f){logger['error'](_0x4bd79f[_0x4a1c('0x36')]);if(_0x4bd79f['name']){delete _0x4bd79f[_0x4a1c('0x37')];}_0x33c129[_0x4a1c('0x2b')](_0x35ca41)[_0x4a1c('0x38')](_0x4bd79f);};}exports['index']=function(_0x4fd249,_0x18df86){var _0x38d05b={},_0x1e3c52={},_0x58fda0={'count':0x0,'rows':[]};var _0x570f60=_['map'](db['SugarcrmConfiguration'][_0x4a1c('0x39')],function(_0x15de16){return{'name':_0x15de16[_0x4a1c('0x3a')],'type':_0x15de16[_0x4a1c('0x3b')][_0x4a1c('0x3c')]};});_0x1e3c52[_0x4a1c('0x3d')]=_[_0x4a1c('0x3e')](_0x570f60,_0x4a1c('0x37'));_0x1e3c52[_0x4a1c('0x3f')]=_[_0x4a1c('0x40')](_0x4fd249['query']);_0x1e3c52[_0x4a1c('0x41')]=_[_0x4a1c('0x42')](_0x1e3c52[_0x4a1c('0x3d')],_0x1e3c52[_0x4a1c('0x3f')]);_0x38d05b[_0x4a1c('0x43')]=_[_0x4a1c('0x42')](_0x1e3c52[_0x4a1c('0x3d')],qs[_0x4a1c('0x44')](_0x4fd249['query'][_0x4a1c('0x44')]));_0x38d05b['attributes']=_0x38d05b[_0x4a1c('0x43')][_0x4a1c('0x45')]?_0x38d05b[_0x4a1c('0x43')]:_0x1e3c52[_0x4a1c('0x3d')];if(!_0x4fd249[_0x4a1c('0x3f')][_0x4a1c('0x46')](_0x4a1c('0x47'))){_0x38d05b[_0x4a1c('0x30')]=qs[_0x4a1c('0x30')](_0x4fd249['query']['limit']);_0x38d05b['offset']=qs[_0x4a1c('0x2f')](_0x4fd249['query']['offset']);}_0x38d05b[_0x4a1c('0x48')]=qs[_0x4a1c('0x49')](_0x4fd249[_0x4a1c('0x3f')][_0x4a1c('0x49')]);_0x38d05b['where']=qs[_0x4a1c('0x41')](_[_0x4a1c('0x4a')](_0x4fd249[_0x4a1c('0x3f')],_0x1e3c52[_0x4a1c('0x41')]),_0x570f60);if(_0x4fd249['query']['filter']){_0x38d05b[_0x4a1c('0x4b')]=_[_0x4a1c('0x4c')](_0x38d05b[_0x4a1c('0x4b')],{'$or':_[_0x4a1c('0x3e')](_0x570f60,function(_0x1b4106){if(_0x1b4106[_0x4a1c('0x3b')]!==_0x4a1c('0x4d')){var _0x259762={};_0x259762[_0x1b4106[_0x4a1c('0x37')]]={'$like':'%'+_0x4fd249[_0x4a1c('0x3f')][_0x4a1c('0x4e')]+'%'};return _0x259762;}})});}_0x38d05b=_[_0x4a1c('0x4c')]({},_0x38d05b,_0x4fd249[_0x4a1c('0x4f')]);var _0x1b66e8={'where':_0x38d05b['where']};return db[_0x4a1c('0x50')][_0x4a1c('0x2e')](_0x1b66e8)[_0x4a1c('0x20')](function(_0x19c0f9){_0x58fda0['count']=_0x19c0f9;if(_0x4fd249['query'][_0x4a1c('0x51')]){_0x38d05b[_0x4a1c('0x52')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x4a1c('0x53')](_0x38d05b);})[_0x4a1c('0x20')](function(_0x837098){_0x58fda0['rows']=_0x837098;return _0x58fda0;})[_0x4a1c('0x20')](respondWithFilteredResult(_0x18df86,_0x38d05b))[_0x4a1c('0x2a')](handleError(_0x18df86,null));};exports['show']=function(_0x2654e9,_0x40505e){var _0x2fa670={'raw':![],'where':{'id':_0x2654e9['params']['id']}},_0x64fa82={};_0x64fa82[_0x4a1c('0x3d')]=_[_0x4a1c('0x40')](db[_0x4a1c('0x50')]['rawAttributes']);_0x64fa82[_0x4a1c('0x3f')]=_[_0x4a1c('0x40')](_0x2654e9['query']);_0x64fa82[_0x4a1c('0x41')]=_[_0x4a1c('0x42')](_0x64fa82[_0x4a1c('0x3d')],_0x64fa82[_0x4a1c('0x3f')]);_0x2fa670['attributes']=_[_0x4a1c('0x42')](_0x64fa82[_0x4a1c('0x3d')],qs['fields'](_0x2654e9[_0x4a1c('0x3f')][_0x4a1c('0x44')]));_0x2fa670[_0x4a1c('0x43')]=_0x2fa670[_0x4a1c('0x43')]['length']?_0x2fa670[_0x4a1c('0x43')]:_0x64fa82[_0x4a1c('0x3d')];if(_0x2654e9[_0x4a1c('0x3f')][_0x4a1c('0x51')]){_0x2fa670[_0x4a1c('0x52')]=[{'all':!![]}];}_0x2fa670=_[_0x4a1c('0x4c')]({},_0x2fa670,_0x2654e9[_0x4a1c('0x4f')]);return db[_0x4a1c('0x50')]['find'](_0x2fa670)[_0x4a1c('0x20')](handleEntityNotFound(_0x40505e,null))[_0x4a1c('0x20')](respondWithResult(_0x40505e,null))[_0x4a1c('0x2a')](handleError(_0x40505e,null));};exports[_0x4a1c('0x54')]=function(_0x6ad717,_0x227157){return db[_0x4a1c('0x50')][_0x4a1c('0x54')](_0x6ad717[_0x4a1c('0x55')],{})[_0x4a1c('0x20')](respondWithResult(_0x227157,0xc9))[_0x4a1c('0x2a')](handleError(_0x227157,null));};exports[_0x4a1c('0x56')]=function(_0x580990,_0x1ec36d){if(_0x580990[_0x4a1c('0x55')]['id']){delete _0x580990[_0x4a1c('0x55')]['id'];}return db[_0x4a1c('0x50')][_0x4a1c('0x57')]({'where':{'id':_0x580990[_0x4a1c('0x58')]['id']}})[_0x4a1c('0x20')](handleEntityNotFound(_0x1ec36d,null))['then'](saveUpdates(_0x580990[_0x4a1c('0x55')],null))['then'](respondWithResult(_0x1ec36d,null))[_0x4a1c('0x2a')](handleError(_0x1ec36d,null));};exports['destroy']=function(_0x353fd1,_0x4e7379){return db['SugarcrmConfiguration'][_0x4a1c('0x57')]({'where':{'id':_0x353fd1[_0x4a1c('0x58')]['id']}})[_0x4a1c('0x20')](handleEntityNotFound(_0x4e7379,null))['then'](removeEntity(_0x4e7379,null))['catch'](handleError(_0x4e7379,null));};exports[_0x4a1c('0x59')]=function(_0x591f33,_0x3be85a,_0x463b2c){var _0x239412={};var _0x3b7af7={};var _0x2c2fa9;var _0x514821;return db[_0x4a1c('0x50')]['findOne']({'where':{'id':_0x591f33[_0x4a1c('0x58')]['id']}})['then'](handleEntityNotFound(_0x3be85a,null))[_0x4a1c('0x20')](function(_0x22d921){if(_0x22d921){_0x2c2fa9=_0x22d921;_0x3b7af7[_0x4a1c('0x3d')]=_[_0x4a1c('0x40')](db['SugarcrmField'][_0x4a1c('0x39')]);_0x3b7af7['query']=_[_0x4a1c('0x40')](_0x591f33[_0x4a1c('0x3f')]);_0x3b7af7[_0x4a1c('0x41')]=_[_0x4a1c('0x42')](_0x3b7af7[_0x4a1c('0x3d')],_0x3b7af7[_0x4a1c('0x3f')]);_0x239412['attributes']=_[_0x4a1c('0x42')](_0x3b7af7[_0x4a1c('0x3d')],qs['fields'](_0x591f33['query'][_0x4a1c('0x44')]));_0x239412[_0x4a1c('0x43')]=_0x239412[_0x4a1c('0x43')][_0x4a1c('0x45')]?_0x239412['attributes']:_0x3b7af7[_0x4a1c('0x3d')];_0x239412[_0x4a1c('0x48')]=qs[_0x4a1c('0x49')](_0x591f33['query'][_0x4a1c('0x49')]);_0x239412[_0x4a1c('0x4b')]=qs[_0x4a1c('0x41')](_['pick'](_0x591f33[_0x4a1c('0x3f')],_0x3b7af7[_0x4a1c('0x41')]));if(_0x591f33[_0x4a1c('0x3f')]['filter']){_0x239412[_0x4a1c('0x4b')]=_[_0x4a1c('0x4c')](_0x239412[_0x4a1c('0x4b')],{'$or':_[_0x4a1c('0x3e')](_0x239412[_0x4a1c('0x43')],function(_0x5e9768){var _0x236d5a={};_0x236d5a[_0x5e9768]={'$like':'%'+_0x591f33[_0x4a1c('0x3f')][_0x4a1c('0x4e')]+'%'};return _0x236d5a;})});}_0x239412=_[_0x4a1c('0x4c')]({},_0x239412,_0x591f33['options']);return _0x2c2fa9['getFields'](_0x239412);}})[_0x4a1c('0x20')](function(_0x515899){if(_0x515899){_0x514821=_0x515899[_0x4a1c('0x45')];if(!_0x591f33[_0x4a1c('0x3f')][_0x4a1c('0x46')](_0x4a1c('0x47'))){_0x239412[_0x4a1c('0x30')]=qs['limit'](_0x591f33[_0x4a1c('0x3f')][_0x4a1c('0x30')]);_0x239412[_0x4a1c('0x2f')]=qs[_0x4a1c('0x2f')](_0x591f33[_0x4a1c('0x3f')][_0x4a1c('0x2f')]);}return _0x2c2fa9['getFields'](_0x239412);}})['then'](function(_0x2423f9){if(_0x2423f9){return _0x2423f9?{'count':_0x514821,'rows':_0x2423f9}:null;}})[_0x4a1c('0x20')](respondWithResult(_0x3be85a,null))[_0x4a1c('0x2a')](handleError(_0x3be85a,null));};exports[_0x4a1c('0x5a')]=function(_0x472c5c,_0x407810,_0x237080){var _0x287b43={};var _0x553059={};var _0x4b8358;var _0x55de44;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x472c5c[_0x4a1c('0x58')]['id']}})['then'](handleEntityNotFound(_0x407810,null))[_0x4a1c('0x20')](function(_0x4fe951){if(_0x4fe951){_0x4b8358=_0x4fe951;_0x553059['model']=_['keys'](db[_0x4a1c('0x5b')]['rawAttributes']);_0x553059[_0x4a1c('0x3f')]=_[_0x4a1c('0x40')](_0x472c5c['query']);_0x553059[_0x4a1c('0x41')]=_[_0x4a1c('0x42')](_0x553059[_0x4a1c('0x3d')],_0x553059[_0x4a1c('0x3f')]);_0x287b43[_0x4a1c('0x43')]=_[_0x4a1c('0x42')](_0x553059[_0x4a1c('0x3d')],qs[_0x4a1c('0x44')](_0x472c5c[_0x4a1c('0x3f')]['fields']));_0x287b43[_0x4a1c('0x43')]=_0x287b43['attributes'][_0x4a1c('0x45')]?_0x287b43[_0x4a1c('0x43')]:_0x553059[_0x4a1c('0x3d')];_0x287b43[_0x4a1c('0x48')]=qs[_0x4a1c('0x49')](_0x472c5c[_0x4a1c('0x3f')][_0x4a1c('0x49')]);_0x287b43[_0x4a1c('0x4b')]=qs[_0x4a1c('0x41')](_[_0x4a1c('0x4a')](_0x472c5c[_0x4a1c('0x3f')],_0x553059['filters']));if(_0x472c5c['query']['filter']){_0x287b43[_0x4a1c('0x4b')]=_[_0x4a1c('0x4c')](_0x287b43[_0x4a1c('0x4b')],{'$or':_[_0x4a1c('0x3e')](_0x287b43[_0x4a1c('0x43')],function(_0x4071eb){var _0x52128d={};_0x52128d[_0x4071eb]={'$like':'%'+_0x472c5c[_0x4a1c('0x3f')][_0x4a1c('0x4e')]+'%'};return _0x52128d;})});}_0x287b43=_[_0x4a1c('0x4c')]({},_0x287b43,_0x472c5c[_0x4a1c('0x4f')]);return _0x4b8358['getSubjects'](_0x287b43);}})['then'](function(_0xa6356f){if(_0xa6356f){_0x55de44=_0xa6356f[_0x4a1c('0x45')];if(!_0x472c5c[_0x4a1c('0x3f')]['hasOwnProperty'](_0x4a1c('0x47'))){_0x287b43[_0x4a1c('0x30')]=qs[_0x4a1c('0x30')](_0x472c5c[_0x4a1c('0x3f')][_0x4a1c('0x30')]);_0x287b43[_0x4a1c('0x2f')]=qs[_0x4a1c('0x2f')](_0x472c5c[_0x4a1c('0x3f')]['offset']);}return _0x4b8358['getSubjects'](_0x287b43);}})[_0x4a1c('0x20')](function(_0x72d909){if(_0x72d909){return _0x72d909?{'count':_0x55de44,'rows':_0x72d909}:null;}})[_0x4a1c('0x20')](respondWithResult(_0x407810,null))[_0x4a1c('0x2a')](handleError(_0x407810,null));};exports[_0x4a1c('0x5c')]=function(_0x555eb4,_0x96ef9a,_0x1f1bb6){var _0x3cc958={};var _0x7026e0={};var _0x320d09;var _0x7e535c;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x555eb4['params']['id']}})[_0x4a1c('0x20')](handleEntityNotFound(_0x96ef9a,null))['then'](function(_0x275ada){if(_0x275ada){_0x320d09=_0x275ada;_0x7026e0[_0x4a1c('0x3d')]=_[_0x4a1c('0x40')](db[_0x4a1c('0x5b')]['rawAttributes']);_0x7026e0[_0x4a1c('0x3f')]=_['keys'](_0x555eb4['query']);_0x7026e0[_0x4a1c('0x41')]=_['intersection'](_0x7026e0[_0x4a1c('0x3d')],_0x7026e0['query']);_0x3cc958['attributes']=_[_0x4a1c('0x42')](_0x7026e0[_0x4a1c('0x3d')],qs[_0x4a1c('0x44')](_0x555eb4['query'][_0x4a1c('0x44')]));_0x3cc958[_0x4a1c('0x43')]=_0x3cc958['attributes']['length']?_0x3cc958[_0x4a1c('0x43')]:_0x7026e0[_0x4a1c('0x3d')];_0x3cc958[_0x4a1c('0x48')]=qs[_0x4a1c('0x49')](_0x555eb4['query'][_0x4a1c('0x49')]);_0x3cc958[_0x4a1c('0x4b')]=qs[_0x4a1c('0x41')](_[_0x4a1c('0x4a')](_0x555eb4['query'],_0x7026e0[_0x4a1c('0x41')]));if(_0x555eb4['query']['filter']){_0x3cc958[_0x4a1c('0x4b')]=_['merge'](_0x3cc958['where'],{'$or':_[_0x4a1c('0x3e')](_0x3cc958[_0x4a1c('0x43')],function(_0x5a3698){var _0x23f7c6={};_0x23f7c6[_0x5a3698]={'$like':'%'+_0x555eb4[_0x4a1c('0x3f')][_0x4a1c('0x4e')]+'%'};return _0x23f7c6;})});}_0x3cc958=_[_0x4a1c('0x4c')]({},_0x3cc958,_0x555eb4[_0x4a1c('0x4f')]);return _0x320d09[_0x4a1c('0x5c')](_0x3cc958);}})[_0x4a1c('0x20')](function(_0x397624){if(_0x397624){_0x7e535c=_0x397624['length'];if(!_0x555eb4[_0x4a1c('0x3f')][_0x4a1c('0x46')](_0x4a1c('0x47'))){_0x3cc958[_0x4a1c('0x30')]=qs['limit'](_0x555eb4[_0x4a1c('0x3f')][_0x4a1c('0x30')]);_0x3cc958[_0x4a1c('0x2f')]=qs[_0x4a1c('0x2f')](_0x555eb4['query'][_0x4a1c('0x2f')]);}return _0x320d09[_0x4a1c('0x5c')](_0x3cc958);}})[_0x4a1c('0x20')](function(_0x2a6585){if(_0x2a6585){return _0x2a6585?{'count':_0x7e535c,'rows':_0x2a6585}:null;}})[_0x4a1c('0x20')](respondWithResult(_0x96ef9a,null))[_0x4a1c('0x2a')](handleError(_0x96ef9a,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index a7de5c3..68647e6 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 _0xcbef=['int_sugarcrm_configurations','lodash','api','moment','bluebird','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration'];(function(_0x24b245,_0x1b3508){var _0x56f828=function(_0x21752a){while(--_0x21752a){_0x24b245['push'](_0x24b245['shift']());}};_0x56f828(++_0x1b3508);}(_0xcbef,0x10f));var _0xfcbe=function(_0x7709d5,_0x3a0bc4){_0x7709d5=_0x7709d5-0x0;var _0x36e23c=_0xcbef[_0x7709d5];return _0x36e23c;};'use strict';var _=require(_0xfcbe('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfcbe('0x1'));var moment=require(_0xfcbe('0x2'));var BPromise=require(_0xfcbe('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfcbe('0x4'));var config=require(_0xfcbe('0x5'));var attributes=require(_0xfcbe('0x6'));module[_0xfcbe('0x7')]=function(_0xf525b5,_0x2597c6){return _0xf525b5['define'](_0xfcbe('0x8'),attributes,{'tableName':_0xfcbe('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56ec=['moment','rimraf','../../config/environment','exports','define','lodash','../../config/logger','api'];(function(_0x2db235,_0x290bda){var _0x5bfc18=function(_0x47f8d6){while(--_0x47f8d6){_0x2db235['push'](_0x2db235['shift']());}};_0x5bfc18(++_0x290bda);}(_0x56ec,0x1ed));var _0xc56e=function(_0xc6af00,_0x5b3a27){_0xc6af00=_0xc6af00-0x0;var _0x787dae=_0x56ec[_0xc6af00];return _0x787dae;};'use strict';var _=require(_0xc56e('0x0'));var util=require('util');var logger=require(_0xc56e('0x1'))(_0xc56e('0x2'));var moment=require(_0xc56e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc56e('0x4'));var config=require(_0xc56e('0x5'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xc56e('0x6')]=function(_0x268f82,_0x526111){return _0x268f82[_0xc56e('0x7')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 5d63c23..8f8a0c2 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 _0x2db5=['client','http','request','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1b4100,_0xc867bd){var _0x131aa1=function(_0x380462){while(--_0x380462){_0x1b4100['push'](_0x1b4100['shift']());}};_0x131aa1(++_0xc867bd);}(_0x2db5,0x174));var _0x52db=function(_0x5e2862,_0x4760eb){_0x5e2862=_0x5e2862-0x0;var _0x8dcad4=_0x2db5[_0x5e2862];return _0x8dcad4;};'use strict';var _=require(_0x52db('0x0'));var util=require('util');var moment=require(_0x52db('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x52db('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x52db('0x3'));var logger=require(_0x52db('0x4'))(_0x52db('0x5'));var config=require(_0x52db('0x6'));var jayson=require(_0x52db('0x7'));var client=jayson[_0x52db('0x8')][_0x52db('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4469f8,_0x4b95a5,_0x4d1ef4){return new BPromise(function(_0x56a666,_0x55d7f7){return client[_0x52db('0xa')](_0x4469f8,_0x4d1ef4)['then'](function(_0x542cb9){logger['info'](_0x52db('0xb'),_0x4b95a5,_0x52db('0xc'));logger[_0x52db('0xd')](_0x52db('0xe'),_0x4b95a5,_0x52db('0xc'),JSON['stringify'](_0x542cb9));if(_0x542cb9[_0x52db('0xf')]){if(_0x542cb9[_0x52db('0xf')]['code']===0x1f4){logger[_0x52db('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4b95a5,_0x542cb9[_0x52db('0xf')][_0x52db('0x10')]);return _0x55d7f7(_0x542cb9[_0x52db('0xf')]['message']);}logger[_0x52db('0xf')](_0x52db('0xb'),_0x4b95a5,_0x542cb9['error']['message']);return _0x56a666(_0x542cb9[_0x52db('0xf')][_0x52db('0x10')]);}else{logger[_0x52db('0x11')](_0x52db('0xb'),_0x4b95a5,_0x52db('0xc'));_0x56a666(_0x542cb9[_0x52db('0x12')][_0x52db('0x10')]);}})[_0x52db('0x13')](function(_0x26f091){logger[_0x52db('0xf')](_0x52db('0xb'),_0x4b95a5,_0x26f091);_0x55d7f7(_0x26f091);});});} \ No newline at end of file +var _0xe73a=['moment','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','info','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','util'];(function(_0xac384a,_0x932349){var _0x5aecae=function(_0x3e6df1){while(--_0x3e6df1){_0xac384a['push'](_0xac384a['shift']());}};_0x5aecae(++_0x932349);}(_0xe73a,0x97));var _0xae73=function(_0x4c9393,_0x20e6de){_0x4c9393=_0x4c9393-0x0;var _0x580eda=_0xe73a[_0x4c9393];return _0x580eda;};'use strict';var _=require('lodash');var util=require(_0xae73('0x0'));var moment=require(_0xae73('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae73('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xae73('0x3'));var logger=require('../../config/logger')(_0xae73('0x4'));var config=require('../../config/environment');var jayson=require(_0xae73('0x5'));var client=jayson[_0xae73('0x6')][_0xae73('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x56547b,_0x4276e8,_0x5df3d3){return new BPromise(function(_0x251489,_0x36dc39){return client[_0xae73('0x8')](_0x56547b,_0x5df3d3)['then'](function(_0x558f84){logger[_0xae73('0x9')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4276e8,'request\x20sent');logger[_0xae73('0xa')](_0xae73('0xb'),_0x4276e8,_0xae73('0xc'),JSON[_0xae73('0xd')](_0x558f84));if(_0x558f84[_0xae73('0xe')]){if(_0x558f84['error'][_0xae73('0xf')]===0x1f4){logger[_0xae73('0xe')](_0xae73('0x10'),_0x4276e8,_0x558f84['error'][_0xae73('0x11')]);return _0x36dc39(_0x558f84['error'][_0xae73('0x11')]);}logger['error'](_0xae73('0x10'),_0x4276e8,_0x558f84[_0xae73('0xe')]['message']);return _0x251489(_0x558f84[_0xae73('0xe')]['message']);}else{logger[_0xae73('0x9')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4276e8,_0xae73('0xc'));_0x251489(_0x558f84[_0xae73('0x12')][_0xae73('0x11')]);}})['catch'](function(_0x211bfa){logger[_0xae73('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4276e8,_0x211bfa);_0x36dc39(_0x211bfa);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 1fb0549..214a5f6 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 _0xa734=['put','update','delete','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x3caf93,_0x2e5788){var _0x51c514=function(_0xb50688){while(--_0xb50688){_0x3caf93['push'](_0x3caf93['shift']());}};_0x51c514(++_0x2e5788);}(_0xa734,0x113));var _0x4a73=function(_0xfe4ad3,_0x1b47bf){_0xfe4ad3=_0xfe4ad3-0x0;var _0x3ee6fc=_0xa734[_0xfe4ad3];return _0x3ee6fc;};'use strict';var multer=require(_0x4a73('0x0'));var util=require('util');var path=require(_0x4a73('0x1'));var timeout=require('connect-timeout');var express=require(_0x4a73('0x2'));var router=express['Router']();var auth=require(_0x4a73('0x3'));var interaction=require(_0x4a73('0x4'));var config=require(_0x4a73('0x5'));var controller=require(_0x4a73('0x6'));router[_0x4a73('0x7')]('/',auth[_0x4a73('0x8')](),controller[_0x4a73('0x9')]);router[_0x4a73('0x7')](_0x4a73('0xa'),auth[_0x4a73('0x8')](),controller[_0x4a73('0xb')]);router['post']('/',auth[_0x4a73('0x8')](),controller[_0x4a73('0xc')]);router[_0x4a73('0xd')](_0x4a73('0xa'),auth['isAuthenticated'](),controller[_0x4a73('0xe')]);router[_0x4a73('0xf')]('/:id',auth[_0x4a73('0x8')](),controller[_0x4a73('0x10')]);module[_0x4a73('0x11')]=router; \ No newline at end of file +var _0x3c01=['/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index'];(function(_0x179c86,_0x4a2006){var _0x5abd7e=function(_0x1068e7){while(--_0x1068e7){_0x179c86['push'](_0x179c86['shift']());}};_0x5abd7e(++_0x4a2006);}(_0x3c01,0x1bd));var _0x13c0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3c01[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x13c0('0x0'));var util=require(_0x13c0('0x1'));var path=require(_0x13c0('0x2'));var timeout=require(_0x13c0('0x3'));var express=require(_0x13c0('0x4'));var router=express[_0x13c0('0x5')]();var auth=require(_0x13c0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x13c0('0x7'));var controller=require(_0x13c0('0x8'));router['get']('/',auth[_0x13c0('0x9')](),controller[_0x13c0('0xa')]);router['get'](_0x13c0('0xb'),auth[_0x13c0('0x9')](),controller[_0x13c0('0xc')]);router[_0x13c0('0xd')]('/',auth[_0x13c0('0x9')](),controller[_0x13c0('0xe')]);router['put'](_0x13c0('0xb'),auth['isAuthenticated'](),controller[_0x13c0('0xf')]);router[_0x13c0('0x10')](_0x13c0('0xb'),auth[_0x13c0('0x9')](),controller[_0x13c0('0x11')]);module[_0x13c0('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index e933372..5c98102 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 _0x15cb=['STRING','ENUM','BOOLEAN','exports','string','customVariable','keyValue'];(function(_0x186d17,_0x9fa8ef){var _0x5d4b89=function(_0x57bd70){while(--_0x57bd70){_0x186d17['push'](_0x186d17['shift']());}};_0x5d4b89(++_0x9fa8ef);}(_0x15cb,0x16f));var _0xb15c=function(_0x254b5d,_0x67f0a5){_0x254b5d=_0x254b5d-0x0;var _0x4a4995=_0x15cb[_0x254b5d];return _0x4a4995;};'use strict';var Sequelize=require('sequelize');module[_0xb15c('0x0')]={'type':{'type':Sequelize['ENUM'](_0xb15c('0x1'),'variable',_0xb15c('0x2'),_0xb15c('0x3')),'defaultValue':_0xb15c('0x1')},'content':{'type':Sequelize[_0xb15c('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb15c('0x5')](_0xb15c('0x1'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xb15c('0x4')]},'idField':{'type':Sequelize[_0xb15c('0x4')]},'nameField':{'type':Sequelize[_0xb15c('0x4')]},'customField':{'type':Sequelize[_0xb15c('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb15c('0x4')]}}; \ No newline at end of file +var _0x6a93=['string','variable','BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','STRING'];(function(_0x5bfdb4,_0x221ba8){var _0x1ee09b=function(_0x4b6ef5){while(--_0x4b6ef5){_0x5bfdb4['push'](_0x5bfdb4['shift']());}};_0x1ee09b(++_0x221ba8);}(_0x6a93,0x1d7));var _0x36a9=function(_0x41a00c,_0x5d6050){_0x41a00c=_0x41a00c-0x0;var _0x2f41c3=_0x6a93[_0x41a00c];return _0x2f41c3;};'use strict';var Sequelize=require(_0x36a9('0x0'));module[_0x36a9('0x1')]={'type':{'type':Sequelize[_0x36a9('0x2')]('string','variable',_0x36a9('0x3'),_0x36a9('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x36a9('0x5')]},'key':{'type':Sequelize[_0x36a9('0x5')]},'keyType':{'type':Sequelize[_0x36a9('0x2')](_0x36a9('0x6'),_0x36a9('0x7'),_0x36a9('0x3'))},'keyContent':{'type':Sequelize[_0x36a9('0x5')]},'idField':{'type':Sequelize[_0x36a9('0x5')]},'nameField':{'type':Sequelize[_0x36a9('0x5')]},'customField':{'type':Sequelize[_0x36a9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x36a9('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 7ccd1a2..bbdf5c8 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 _0x2c6c=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x32f736,_0x40fbf2){var _0x589cc0=function(_0x241ba4){while(--_0x241ba4){_0x32f736['push'](_0x32f736['shift']());}};_0x589cc0(++_0x40fbf2);}(_0x2c6c,0x15d));var _0xc2c6=function(_0x3fb600,_0x2d93eb){_0x3fb600=_0x3fb600-0x0;var _0x56f812=_0x2c6c[_0x3fb600];return _0x56f812;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc2c6('0x0'));var rimraf=require(_0xc2c6('0x1'));var zipdir=require(_0xc2c6('0x2'));var jsonpatch=require(_0xc2c6('0x3'));var rp=require(_0xc2c6('0x4'));var moment=require(_0xc2c6('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc2c6('0x6'));var csv=require(_0xc2c6('0x7'));var ejs=require(_0xc2c6('0x8'));var fs=require('fs');var _=require(_0xc2c6('0x9'));var squel=require(_0xc2c6('0xa'));var crypto=require('crypto');var jsforce=require(_0xc2c6('0xb'));var deskjs=require(_0xc2c6('0xc'));var toCsv=require(_0xc2c6('0x7'));var querystring=require(_0xc2c6('0xd'));var Papa=require('papaparse');var Redis=require(_0xc2c6('0xe'));var authService=require(_0xc2c6('0xf'));var qs=require(_0xc2c6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc2c6('0x11'));var logger=require(_0xc2c6('0x12'))(_0xc2c6('0x13'));var utils=require('../../config/utils');var config=require(_0xc2c6('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x236199,_0x198623){_0x198623=_0x198623||0xcc;return function(_0x1ea870){if(_0x1ea870){return _0x236199[_0xc2c6('0x15')](_0x198623);}return _0x236199['status'](_0x198623)['end']();};}function respondWithResult(_0x3b6890,_0x16e58a){_0x16e58a=_0x16e58a||0xc8;return function(_0x4aacc9){if(_0x4aacc9){return _0x3b6890[_0xc2c6('0x16')](_0x16e58a)[_0xc2c6('0x17')](_0x4aacc9);}};}function respondWithFilteredResult(_0x3b1d4e,_0x14c522){return function(_0x4883f7){if(_0x4883f7){var _0x148466=_0x4883f7[_0xc2c6('0x18')],_0x856ab4=_0x14c522[_0xc2c6('0x19')],_0x3b6ac9=_0x14c522[_0xc2c6('0x19')]+_0x14c522[_0xc2c6('0x1a')],_0x37724e;if(_0x3b6ac9>=_0x148466){_0x3b6ac9=_0x148466;_0x37724e=0xc8;}else{_0x37724e=0xce;}_0x3b1d4e['status'](_0x37724e);return _0x3b1d4e['set'](_0xc2c6('0x1b'),_0x856ab4+'-'+_0x3b6ac9+'/'+_0x148466)[_0xc2c6('0x17')](_0x4883f7);}return null;};}function patchUpdates(_0x50f58e){return function(_0x3cdbbf){try{jsonpatch[_0xc2c6('0x1c')](_0x3cdbbf,_0x50f58e,!![]);}catch(_0x1350e8){return BPromise[_0xc2c6('0x1d')](_0x1350e8);}return _0x3cdbbf[_0xc2c6('0x1e')]();};}function saveUpdates(_0x5cf325,_0x4fca7c){return function(_0x59bab3){if(_0x59bab3){return _0x59bab3[_0xc2c6('0x1f')](_0x5cf325)[_0xc2c6('0x20')](function(_0x49cb48){return _0x49cb48;});}return null;};}function removeEntity(_0x1376a2,_0x253a30){return function(_0x26ad3f){if(_0x26ad3f){return _0x26ad3f[_0xc2c6('0x21')]()[_0xc2c6('0x20')](function(){_0x1376a2[_0xc2c6('0x16')](0xcc)[_0xc2c6('0x22')]();});}};}function handleEntityNotFound(_0x378b2b,_0x375bc7){return function(_0x388d81){if(!_0x388d81){_0x378b2b[_0xc2c6('0x15')](0x194);}return _0x388d81;};}function handleError(_0xf8c14e,_0x4f7249){_0x4f7249=_0x4f7249||0x1f4;return function(_0x65c877){logger[_0xc2c6('0x23')](_0x65c877[_0xc2c6('0x24')]);if(_0x65c877['name']){delete _0x65c877[_0xc2c6('0x25')];}_0xf8c14e[_0xc2c6('0x16')](_0x4f7249)[_0xc2c6('0x26')](_0x65c877);};}exports[_0xc2c6('0x27')]=function(_0x1d4f30,_0x4b8dee){var _0x46a28d={},_0x4449de={},_0x6e5e2f={'count':0x0,'rows':[]};var _0xff6e30=_[_0xc2c6('0x28')](db[_0xc2c6('0x29')][_0xc2c6('0x2a')],function(_0x17f569){return{'name':_0x17f569[_0xc2c6('0x2b')],'type':_0x17f569[_0xc2c6('0x2c')][_0xc2c6('0x2d')]};});_0x4449de[_0xc2c6('0x2e')]=_[_0xc2c6('0x28')](_0xff6e30,_0xc2c6('0x25'));_0x4449de[_0xc2c6('0x2f')]=_[_0xc2c6('0x30')](_0x1d4f30[_0xc2c6('0x2f')]);_0x4449de['filters']=_[_0xc2c6('0x31')](_0x4449de[_0xc2c6('0x2e')],_0x4449de[_0xc2c6('0x2f')]);_0x46a28d[_0xc2c6('0x32')]=_[_0xc2c6('0x31')](_0x4449de[_0xc2c6('0x2e')],qs[_0xc2c6('0x33')](_0x1d4f30[_0xc2c6('0x2f')]['fields']));_0x46a28d['attributes']=_0x46a28d[_0xc2c6('0x32')]['length']?_0x46a28d[_0xc2c6('0x32')]:_0x4449de[_0xc2c6('0x2e')];if(!_0x1d4f30[_0xc2c6('0x2f')][_0xc2c6('0x34')](_0xc2c6('0x35'))){_0x46a28d[_0xc2c6('0x1a')]=qs['limit'](_0x1d4f30[_0xc2c6('0x2f')][_0xc2c6('0x1a')]);_0x46a28d[_0xc2c6('0x19')]=qs[_0xc2c6('0x19')](_0x1d4f30[_0xc2c6('0x2f')][_0xc2c6('0x19')]);}_0x46a28d[_0xc2c6('0x36')]=qs['sort'](_0x1d4f30[_0xc2c6('0x2f')][_0xc2c6('0x37')]);_0x46a28d[_0xc2c6('0x38')]=qs[_0xc2c6('0x39')](_['pick'](_0x1d4f30[_0xc2c6('0x2f')],_0x4449de[_0xc2c6('0x39')]),_0xff6e30);if(_0x1d4f30[_0xc2c6('0x2f')][_0xc2c6('0x3a')]){_0x46a28d[_0xc2c6('0x38')]=_[_0xc2c6('0x3b')](_0x46a28d['where'],{'$or':_['map'](_0xff6e30,function(_0x1015f3){if(_0x1015f3[_0xc2c6('0x2c')]!==_0xc2c6('0x3c')){var _0x245c6b={};_0x245c6b[_0x1015f3[_0xc2c6('0x25')]]={'$like':'%'+_0x1d4f30[_0xc2c6('0x2f')][_0xc2c6('0x3a')]+'%'};return _0x245c6b;}})});}_0x46a28d=_['merge']({},_0x46a28d,_0x1d4f30['options']);var _0x4a1f3c={'where':_0x46a28d[_0xc2c6('0x38')]};return db['SugarcrmField'][_0xc2c6('0x18')](_0x4a1f3c)[_0xc2c6('0x20')](function(_0x18667b){_0x6e5e2f[_0xc2c6('0x18')]=_0x18667b;if(_0x1d4f30[_0xc2c6('0x2f')][_0xc2c6('0x3d')]){_0x46a28d[_0xc2c6('0x3e')]=[{'all':!![]}];}return db[_0xc2c6('0x29')][_0xc2c6('0x3f')](_0x46a28d);})[_0xc2c6('0x20')](function(_0x5469c7){_0x6e5e2f[_0xc2c6('0x40')]=_0x5469c7;return _0x6e5e2f;})[_0xc2c6('0x20')](respondWithFilteredResult(_0x4b8dee,_0x46a28d))[_0xc2c6('0x41')](handleError(_0x4b8dee,null));};exports[_0xc2c6('0x42')]=function(_0x226d56,_0x4ae0bc){var _0x3b354d={'raw':!![],'where':{'id':_0x226d56[_0xc2c6('0x43')]['id']}},_0xda7e57={};_0xda7e57[_0xc2c6('0x2e')]=_[_0xc2c6('0x30')](db[_0xc2c6('0x29')][_0xc2c6('0x2a')]);_0xda7e57[_0xc2c6('0x2f')]=_[_0xc2c6('0x30')](_0x226d56[_0xc2c6('0x2f')]);_0xda7e57[_0xc2c6('0x39')]=_[_0xc2c6('0x31')](_0xda7e57[_0xc2c6('0x2e')],_0xda7e57[_0xc2c6('0x2f')]);_0x3b354d[_0xc2c6('0x32')]=_[_0xc2c6('0x31')](_0xda7e57[_0xc2c6('0x2e')],qs[_0xc2c6('0x33')](_0x226d56[_0xc2c6('0x2f')][_0xc2c6('0x33')]));_0x3b354d[_0xc2c6('0x32')]=_0x3b354d[_0xc2c6('0x32')][_0xc2c6('0x44')]?_0x3b354d['attributes']:_0xda7e57[_0xc2c6('0x2e')];if(_0x226d56[_0xc2c6('0x2f')][_0xc2c6('0x3d')]){_0x3b354d['include']=[{'all':!![]}];}_0x3b354d=_[_0xc2c6('0x3b')]({},_0x3b354d,_0x226d56[_0xc2c6('0x45')]);return db[_0xc2c6('0x29')][_0xc2c6('0x46')](_0x3b354d)[_0xc2c6('0x20')](handleEntityNotFound(_0x4ae0bc,null))[_0xc2c6('0x20')](respondWithResult(_0x4ae0bc,null))[_0xc2c6('0x41')](handleError(_0x4ae0bc,null));};exports['create']=function(_0x61f91a,_0xb004ad){return db[_0xc2c6('0x29')][_0xc2c6('0x47')](_0x61f91a[_0xc2c6('0x48')],{})['then'](respondWithResult(_0xb004ad,0xc9))[_0xc2c6('0x41')](handleError(_0xb004ad,null));};exports[_0xc2c6('0x1f')]=function(_0x1a6cc7,_0x45c5da){if(_0x1a6cc7[_0xc2c6('0x48')]['id']){delete _0x1a6cc7[_0xc2c6('0x48')]['id'];}return db[_0xc2c6('0x29')][_0xc2c6('0x46')]({'where':{'id':_0x1a6cc7['params']['id']}})['then'](handleEntityNotFound(_0x45c5da,null))[_0xc2c6('0x20')](saveUpdates(_0x1a6cc7[_0xc2c6('0x48')],null))[_0xc2c6('0x20')](respondWithResult(_0x45c5da,null))[_0xc2c6('0x41')](handleError(_0x45c5da,null));};exports[_0xc2c6('0x21')]=function(_0x1ff536,_0x26e1a9){return db[_0xc2c6('0x29')][_0xc2c6('0x46')]({'where':{'id':_0x1ff536[_0xc2c6('0x43')]['id']}})[_0xc2c6('0x20')](handleEntityNotFound(_0x26e1a9,null))[_0xc2c6('0x20')](removeEntity(_0x26e1a9,null))[_0xc2c6('0x41')](handleError(_0x26e1a9,null));}; \ No newline at end of file +var _0x9990=['includeAll','include','findAll','catch','show','length','create','body','find','params','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','destroy','stack','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','then'];(function(_0x2d3506,_0x48fdbb){var _0x5af527=function(_0x12c87a){while(--_0x12c87a){_0x2d3506['push'](_0x2d3506['shift']());}};_0x5af527(++_0x48fdbb);}(_0x9990,0x11a));var _0x0999=function(_0x525445,_0x4f8f42){_0x525445=_0x525445-0x0;var _0x48b600=_0x9990[_0x525445];return _0x48b600;};'use strict';var pdf=require(_0x0999('0x0'));var emlformat=require(_0x0999('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0999('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0999('0x3'));var moment=require(_0x0999('0x4'));var BPromise=require(_0x0999('0x5'));var Mustache=require(_0x0999('0x6'));var util=require('util');var path=require(_0x0999('0x7'));var sox=require(_0x0999('0x8'));var csv=require(_0x0999('0x9'));var ejs=require(_0x0999('0xa'));var fs=require('fs');var _=require(_0x0999('0xb'));var squel=require(_0x0999('0xc'));var crypto=require(_0x0999('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0999('0xe'));var toCsv=require(_0x0999('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0999('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0999('0x10'));var hardwareService=require(_0x0999('0x11'));var logger=require(_0x0999('0x12'))(_0x0999('0x13'));var utils=require(_0x0999('0x14'));var config=require(_0x0999('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a65aa,_0x2dc6da){_0x2dc6da=_0x2dc6da||0xcc;return function(_0x5ab590){if(_0x5ab590){return _0x5a65aa[_0x0999('0x16')](_0x2dc6da);}return _0x5a65aa[_0x0999('0x17')](_0x2dc6da)['end']();};}function respondWithResult(_0x36964c,_0x2477d0){_0x2477d0=_0x2477d0||0xc8;return function(_0x375365){if(_0x375365){return _0x36964c[_0x0999('0x17')](_0x2477d0)[_0x0999('0x18')](_0x375365);}};}function respondWithFilteredResult(_0x44bf84,_0x3946a4){return function(_0x3d27a3){if(_0x3d27a3){var _0x288258=_0x3d27a3['count'],_0x1b5522=_0x3946a4[_0x0999('0x19')],_0x4fa3da=_0x3946a4['offset']+_0x3946a4[_0x0999('0x1a')],_0x5ec8ad;if(_0x4fa3da>=_0x288258){_0x4fa3da=_0x288258;_0x5ec8ad=0xc8;}else{_0x5ec8ad=0xce;}_0x44bf84[_0x0999('0x17')](_0x5ec8ad);return _0x44bf84['set'](_0x0999('0x1b'),_0x1b5522+'-'+_0x4fa3da+'/'+_0x288258)[_0x0999('0x18')](_0x3d27a3);}return null;};}function patchUpdates(_0xb395d9){return function(_0x18405f){try{jsonpatch[_0x0999('0x1c')](_0x18405f,_0xb395d9,!![]);}catch(_0x22153f){return BPromise[_0x0999('0x1d')](_0x22153f);}return _0x18405f[_0x0999('0x1e')]();};}function saveUpdates(_0x180ca7,_0x313153){return function(_0x14dada){if(_0x14dada){return _0x14dada['update'](_0x180ca7)['then'](function(_0x526bb2){return _0x526bb2;});}return null;};}function removeEntity(_0x2f9f02,_0x463131){return function(_0x420329){if(_0x420329){return _0x420329[_0x0999('0x1f')]()['then'](function(){_0x2f9f02[_0x0999('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x95664a,_0x237089){return function(_0x2e8a0a){if(!_0x2e8a0a){_0x95664a[_0x0999('0x16')](0x194);}return _0x2e8a0a;};}function handleError(_0x3c6b7f,_0x5b66b5){_0x5b66b5=_0x5b66b5||0x1f4;return function(_0x11b8a0){logger['error'](_0x11b8a0[_0x0999('0x20')]);if(_0x11b8a0[_0x0999('0x21')]){delete _0x11b8a0[_0x0999('0x21')];}_0x3c6b7f['status'](_0x5b66b5)[_0x0999('0x22')](_0x11b8a0);};}exports['index']=function(_0x30c7a8,_0x125431){var _0x33ff27={},_0x2ed0a4={},_0x55ffb2={'count':0x0,'rows':[]};var _0x34386d=_[_0x0999('0x23')](db[_0x0999('0x24')][_0x0999('0x25')],function(_0x52f97c){return{'name':_0x52f97c[_0x0999('0x26')],'type':_0x52f97c[_0x0999('0x27')][_0x0999('0x28')]};});_0x2ed0a4[_0x0999('0x29')]=_[_0x0999('0x23')](_0x34386d,'name');_0x2ed0a4[_0x0999('0x2a')]=_[_0x0999('0x2b')](_0x30c7a8[_0x0999('0x2a')]);_0x2ed0a4[_0x0999('0x2c')]=_[_0x0999('0x2d')](_0x2ed0a4[_0x0999('0x29')],_0x2ed0a4['query']);_0x33ff27[_0x0999('0x2e')]=_['intersection'](_0x2ed0a4[_0x0999('0x29')],qs[_0x0999('0x2f')](_0x30c7a8['query'][_0x0999('0x2f')]));_0x33ff27[_0x0999('0x2e')]=_0x33ff27[_0x0999('0x2e')]['length']?_0x33ff27[_0x0999('0x2e')]:_0x2ed0a4['model'];if(!_0x30c7a8[_0x0999('0x2a')][_0x0999('0x30')](_0x0999('0x31'))){_0x33ff27['limit']=qs[_0x0999('0x1a')](_0x30c7a8[_0x0999('0x2a')][_0x0999('0x1a')]);_0x33ff27['offset']=qs[_0x0999('0x19')](_0x30c7a8['query'][_0x0999('0x19')]);}_0x33ff27[_0x0999('0x32')]=qs[_0x0999('0x33')](_0x30c7a8[_0x0999('0x2a')][_0x0999('0x33')]);_0x33ff27[_0x0999('0x34')]=qs[_0x0999('0x2c')](_['pick'](_0x30c7a8[_0x0999('0x2a')],_0x2ed0a4['filters']),_0x34386d);if(_0x30c7a8[_0x0999('0x2a')][_0x0999('0x35')]){_0x33ff27[_0x0999('0x34')]=_[_0x0999('0x36')](_0x33ff27[_0x0999('0x34')],{'$or':_[_0x0999('0x23')](_0x34386d,function(_0x5c7e7e){if(_0x5c7e7e[_0x0999('0x27')]!==_0x0999('0x37')){var _0xaaa8e3={};_0xaaa8e3[_0x5c7e7e[_0x0999('0x21')]]={'$like':'%'+_0x30c7a8[_0x0999('0x2a')][_0x0999('0x35')]+'%'};return _0xaaa8e3;}})});}_0x33ff27=_[_0x0999('0x36')]({},_0x33ff27,_0x30c7a8[_0x0999('0x38')]);var _0x2e5c9a={'where':_0x33ff27[_0x0999('0x34')]};return db[_0x0999('0x24')]['count'](_0x2e5c9a)[_0x0999('0x39')](function(_0x3525cc){_0x55ffb2['count']=_0x3525cc;if(_0x30c7a8[_0x0999('0x2a')][_0x0999('0x3a')]){_0x33ff27[_0x0999('0x3b')]=[{'all':!![]}];}return db[_0x0999('0x24')][_0x0999('0x3c')](_0x33ff27);})[_0x0999('0x39')](function(_0x5019e1){_0x55ffb2['rows']=_0x5019e1;return _0x55ffb2;})[_0x0999('0x39')](respondWithFilteredResult(_0x125431,_0x33ff27))[_0x0999('0x3d')](handleError(_0x125431,null));};exports[_0x0999('0x3e')]=function(_0x28fd18,_0x148de2){var _0x37a8cb={'raw':!![],'where':{'id':_0x28fd18['params']['id']}},_0x5d24cc={};_0x5d24cc[_0x0999('0x29')]=_[_0x0999('0x2b')](db[_0x0999('0x24')][_0x0999('0x25')]);_0x5d24cc['query']=_['keys'](_0x28fd18[_0x0999('0x2a')]);_0x5d24cc[_0x0999('0x2c')]=_[_0x0999('0x2d')](_0x5d24cc[_0x0999('0x29')],_0x5d24cc[_0x0999('0x2a')]);_0x37a8cb[_0x0999('0x2e')]=_['intersection'](_0x5d24cc['model'],qs['fields'](_0x28fd18[_0x0999('0x2a')][_0x0999('0x2f')]));_0x37a8cb[_0x0999('0x2e')]=_0x37a8cb[_0x0999('0x2e')][_0x0999('0x3f')]?_0x37a8cb[_0x0999('0x2e')]:_0x5d24cc['model'];if(_0x28fd18[_0x0999('0x2a')][_0x0999('0x3a')]){_0x37a8cb[_0x0999('0x3b')]=[{'all':!![]}];}_0x37a8cb=_['merge']({},_0x37a8cb,_0x28fd18['options']);return db[_0x0999('0x24')]['find'](_0x37a8cb)['then'](handleEntityNotFound(_0x148de2,null))[_0x0999('0x39')](respondWithResult(_0x148de2,null))[_0x0999('0x3d')](handleError(_0x148de2,null));};exports[_0x0999('0x40')]=function(_0x1a40b0,_0x4d0603){return db[_0x0999('0x24')][_0x0999('0x40')](_0x1a40b0['body'],{})[_0x0999('0x39')](respondWithResult(_0x4d0603,0xc9))[_0x0999('0x3d')](handleError(_0x4d0603,null));};exports['update']=function(_0x4de4c0,_0x281532){if(_0x4de4c0[_0x0999('0x41')]['id']){delete _0x4de4c0[_0x0999('0x41')]['id'];}return db[_0x0999('0x24')][_0x0999('0x42')]({'where':{'id':_0x4de4c0[_0x0999('0x43')]['id']}})['then'](handleEntityNotFound(_0x281532,null))['then'](saveUpdates(_0x4de4c0[_0x0999('0x41')],null))[_0x0999('0x39')](respondWithResult(_0x281532,null))[_0x0999('0x3d')](handleError(_0x281532,null));};exports[_0x0999('0x1f')]=function(_0x2a4119,_0xc796ad){return db['SugarcrmField'][_0x0999('0x42')]({'where':{'id':_0x2a4119['params']['id']}})[_0x0999('0x39')](handleEntityNotFound(_0xc796ad,null))[_0x0999('0x39')](removeEntity(_0xc796ad,null))[_0x0999('0x3d')](handleError(_0xc796ad,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index a2175f4..b99f0c6 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 _0xaecc=['util','../../config/logger','moment','request-promise','path','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash'];(function(_0x47a27f,_0x38d0aa){var _0x1b1ed3=function(_0x5c499a){while(--_0x5c499a){_0x47a27f['push'](_0x47a27f['shift']());}};_0x1b1ed3(++_0x38d0aa);}(_0xaecc,0xc3));var _0xcaec=function(_0x340172,_0x46c3b8){_0x340172=_0x340172-0x0;var _0x1d9ef6=_0xaecc[_0x340172];return _0x1d9ef6;};'use strict';var _=require(_0xcaec('0x0'));var util=require(_0xcaec('0x1'));var logger=require(_0xcaec('0x2'))('api');var moment=require(_0xcaec('0x3'));var BPromise=require('bluebird');var rp=require(_0xcaec('0x4'));var fs=require('fs');var path=require(_0xcaec('0x5'));var rimraf=require('rimraf');var config=require(_0xcaec('0x6'));var attributes=require(_0xcaec('0x7'));module[_0xcaec('0x8')]=function(_0xcf88fd,_0x52ebf7){return _0xcf88fd['define'](_0xcaec('0x9'),attributes,{'tableName':_0xcaec('0xa'),'paranoid':![],'indexes':[{'name':_0xcaec('0xb'),'fields':[_0xcaec('0xc'),_0xcaec('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x866c=['exports','define','SugarcrmField','int_sugarcrm_fields','FieldId','../../config/logger','api','moment','path','../../config/environment'];(function(_0x32bab2,_0x2f912e){var _0x19efa7=function(_0x5e1898){while(--_0x5e1898){_0x32bab2['push'](_0x32bab2['shift']());}};_0x19efa7(++_0x2f912e);}(_0x866c,0x1bd));var _0xc866=function(_0xb869c3,_0x2989ea){_0xb869c3=_0xb869c3-0x0;var _0x42f9eb=_0x866c[_0xb869c3];return _0x42f9eb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc866('0x0'))(_0xc866('0x1'));var moment=require(_0xc866('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc866('0x3'));var rimraf=require('rimraf');var config=require(_0xc866('0x4'));var attributes=require('./intSugarcrmField.attributes');module[_0xc866('0x5')]=function(_0x3021bc,_0xbda486){return _0x3021bc[_0xc866('0x6')](_0xc866('0x7'),attributes,{'tableName':_0xc866('0x8'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0xc866('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index e278451..af7276f 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 _0x0b0e=['SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','debug'];(function(_0x3da707,_0x30c36d){var _0x342ee7=function(_0x175135){while(--_0x175135){_0x3da707['push'](_0x3da707['shift']());}};_0x342ee7(++_0x30c36d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3f940e,_0x140c3b){_0x3f940e=_0x3f940e-0x0;var _0x424b2e=_0x0b0e[_0x3f940e];return _0x424b2e;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file +var _0x8603=['message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','error'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x8603,0x190));var _0x3860=function(_0x3a9468,_0x2b6266){_0x3a9468=_0x3a9468-0x0;var _0x1d2345=_0x8603[_0x3a9468];return _0x1d2345;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 2198896..803c5e7 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 _0x4b5b=['index','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','./intVtigerAccount.controller','get'];(function(_0x55361c,_0x214c01){var _0x45c5f7=function(_0x328b22){while(--_0x328b22){_0x55361c['push'](_0x55361c['shift']());}};_0x45c5f7(++_0x214c01);}(_0x4b5b,0xbf));var _0xb4b5=function(_0x1c4a5e,_0x4f28e1){_0x1c4a5e=_0x1c4a5e-0x0;var _0x1c0190=_0x4b5b[_0x1c4a5e];return _0x1c0190;};'use strict';var multer=require(_0xb4b5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb4b5('0x1'));var express=require(_0xb4b5('0x2'));var router=express[_0xb4b5('0x3')]();var auth=require(_0xb4b5('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb4b5('0x5'));router[_0xb4b5('0x6')]('/',auth['isAuthenticated'](),controller[_0xb4b5('0x7')]);router['get'](_0xb4b5('0x8'),auth[_0xb4b5('0x9')](),controller['show']);router[_0xb4b5('0x6')](_0xb4b5('0xa'),auth['isAuthenticated'](),controller[_0xb4b5('0xb')]);router[_0xb4b5('0x6')](_0xb4b5('0xc'),auth['isAuthenticated'](),controller[_0xb4b5('0xd')]);router[_0xb4b5('0xe')]('/',auth[_0xb4b5('0x9')](),controller[_0xb4b5('0xf')]);router['post'](_0xb4b5('0xa'),auth[_0xb4b5('0x9')](),controller[_0xb4b5('0x10')]);router[_0xb4b5('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xb4b5('0x12')]);router[_0xb4b5('0x13')](_0xb4b5('0x8'),auth[_0xb4b5('0x9')](),controller[_0xb4b5('0x14')]);module[_0xb4b5('0x15')]=router; \ No newline at end of file +var _0x2b98=['../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','isAuthenticated','getFields','post','put','update','delete','exports','util','path','connect-timeout','Router'];(function(_0x730350,_0x5a48fd){var _0x24baeb=function(_0x2e59ea){while(--_0x2e59ea){_0x730350['push'](_0x730350['shift']());}};_0x24baeb(++_0x5a48fd);}(_0x2b98,0xd8));var _0x82b9=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x2b98[_0x1b828b];return _0x98da1a;};'use strict';var multer=require('multer');var util=require(_0x82b9('0x0'));var path=require(_0x82b9('0x1'));var timeout=require(_0x82b9('0x2'));var express=require('express');var router=express[_0x82b9('0x3')]();var auth=require(_0x82b9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x82b9('0x5'));var controller=require(_0x82b9('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x82b9('0x7')](_0x82b9('0x8'),auth['isAuthenticated'](),controller[_0x82b9('0x9')]);router[_0x82b9('0x7')](_0x82b9('0xa'),auth['isAuthenticated'](),controller[_0x82b9('0xb')]);router[_0x82b9('0x7')](_0x82b9('0xc'),auth[_0x82b9('0xd')](),controller[_0x82b9('0xe')]);router[_0x82b9('0xf')]('/',auth[_0x82b9('0xd')](),controller['create']);router['post'](_0x82b9('0xa'),auth[_0x82b9('0xd')](),controller['addConfiguration']);router[_0x82b9('0x10')](_0x82b9('0x8'),auth[_0x82b9('0xd')](),controller[_0x82b9('0x11')]);router[_0x82b9('0x12')](_0x82b9('0x8'),auth[_0x82b9('0xd')](),controller['destroy']);module[_0x82b9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 3435d84..7607217 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 _0xfe8e=['exports','STRING','HelpDesk'];(function(_0x41ee16,_0xfa94c3){var _0x1f60de=function(_0x1c8ffc){while(--_0x1c8ffc){_0x41ee16['push'](_0x41ee16['shift']());}};_0x1f60de(++_0xfa94c3);}(_0xfe8e,0x147));var _0xefe8=function(_0x2d1971,_0x20b764){_0x2d1971=_0x2d1971-0x0;var _0x4d7759=_0xfe8e[_0x2d1971];return _0x4d7759;};'use strict';var Sequelize=require('sequelize');module[_0xefe8('0x0')]={'name':{'type':Sequelize[_0xefe8('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xefe8('0x1')]},'username':{'type':Sequelize[_0xefe8('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xefe8('0x1')],'allowNull':![],'defaultValue':_0xefe8('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xefe8('0x1')]},'accessKey':{'type':Sequelize[_0xefe8('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x786f=['sequelize','exports','STRING','HelpDesk'];(function(_0x427513,_0x22a741){var _0x454000=function(_0x36d69a){while(--_0x36d69a){_0x427513['push'](_0x427513['shift']());}};_0x454000(++_0x22a741);}(_0x786f,0x10c));var _0xf786=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x786f[_0x4c445a];return _0x2f611c;};'use strict';var Sequelize=require(_0xf786('0x0'));module[_0xf786('0x1')]={'name':{'type':Sequelize[_0xf786('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xf786('0x2')],'allowNull':![],'defaultValue':_0xf786('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING']},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 3649f00..fe458c8 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 _0xc0c1=['show','params','create','body','find','getConfigurations','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerField','md5','findOne','username','moduleName','serverUrl','accessKey','remoteUri','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','token','GET','describe','reference','remove','includes','editable','false','label','startsWith','cf_','picklistValues','value','log','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VtigerAccount,\x20%s,\x20%s','result','catch','status','end','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xc0c1,0x1c5));var _0x1c0c=function(_0x181897,_0x196e9a){_0x181897=_0x181897-0x0;var _0x1e09e5=_0xc0c1[_0x181897];return _0x1e09e5;};'use strict';var pdf=require(_0x1c0c('0x0'));var emlformat=require(_0x1c0c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1c0c('0x2'));var jsonpatch=require(_0x1c0c('0x3'));var rp=require(_0x1c0c('0x4'));var moment=require('moment');var BPromise=require(_0x1c0c('0x5'));var Mustache=require(_0x1c0c('0x6'));var util=require(_0x1c0c('0x7'));var path=require(_0x1c0c('0x8'));var sox=require('sox');var csv=require(_0x1c0c('0x9'));var ejs=require(_0x1c0c('0xa'));var fs=require('fs');var _=require(_0x1c0c('0xb'));var squel=require(_0x1c0c('0xc'));var crypto=require('crypto');var jsforce=require(_0x1c0c('0xd'));var deskjs=require(_0x1c0c('0xe'));var toCsv=require(_0x1c0c('0x9'));var querystring=require(_0x1c0c('0xf'));var Papa=require(_0x1c0c('0x10'));var Redis=require('ioredis');var authService=require(_0x1c0c('0x11'));var qs=require(_0x1c0c('0x12'));var as=require(_0x1c0c('0x13'));var hardwareService=require(_0x1c0c('0x14'));var logger=require(_0x1c0c('0x15'))(_0x1c0c('0x16'));var utils=require(_0x1c0c('0x17'));var config=require(_0x1c0c('0x18'));var db=require(_0x1c0c('0x19'))['db'];var integrations=require(_0x1c0c('0x1a'));var jayson=require(_0x1c0c('0x1b'));var client=jayson[_0x1c0c('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x53f57b,_0x15d625,_0x352a46){if(_0x352a46){var _0x4360b8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4360b8[_0x1c0c('0x1d')](_0x15d625)){return _0x53f57b;}else{throw new db[(_0x1c0c('0x1e'))]['ValidationError'](_0x1c0c('0x1f'));}}else{return _0x53f57b;}}function respondWithRpcPromise(_0x3a7348,_0x212934,_0x4985f5,_0x323efd){return new BPromise(function(_0x97e460,_0x5bf0c9){var _0xf07cf3=_0x323efd||client;return _0xf07cf3[_0x1c0c('0x20')](_0x3a7348,_0x4985f5)['then'](function(_0x281148){logger[_0x1c0c('0x21')]('VtigerAccount,\x20%s,\x20%s',_0x212934,_0x1c0c('0x22'));logger[_0x1c0c('0x23')](_0x1c0c('0x24'),_0x212934,_0x1c0c('0x22'),JSON[_0x1c0c('0x25')](_0x281148));if(_0x281148[_0x1c0c('0x26')]){if(_0x281148[_0x1c0c('0x26')][_0x1c0c('0x27')]===0x1f4){logger[_0x1c0c('0x26')]('VtigerAccount,\x20%s,\x20%s',_0x212934,_0x281148[_0x1c0c('0x26')][_0x1c0c('0x28')]);return _0x5bf0c9(_0x281148[_0x1c0c('0x26')][_0x1c0c('0x28')]);}logger[_0x1c0c('0x26')]('VtigerAccount,\x20%s,\x20%s',_0x212934,_0x281148['error'][_0x1c0c('0x28')]);return _0x97e460(_0x281148['error'][_0x1c0c('0x28')]);}else{logger[_0x1c0c('0x21')](_0x1c0c('0x29'),_0x212934,_0x1c0c('0x22'));_0x97e460(_0x281148[_0x1c0c('0x2a')]['message']);}})[_0x1c0c('0x2b')](function(_0x4dbd6c){logger['error'](_0x1c0c('0x29'),_0x212934,_0x4dbd6c);_0x5bf0c9(_0x4dbd6c);});});}function respondWithStatusCode(_0x2ebd0f,_0x45fdb5){_0x45fdb5=_0x45fdb5||0xcc;return function(_0x2748ec){if(_0x2748ec){return _0x2ebd0f['sendStatus'](_0x45fdb5);}return _0x2ebd0f[_0x1c0c('0x2c')](_0x45fdb5)[_0x1c0c('0x2d')]();};}function respondWithResult(_0xf507d3,_0x299dab){_0x299dab=_0x299dab||0xc8;return function(_0x20441f){if(_0x20441f){return _0xf507d3[_0x1c0c('0x2c')](_0x299dab)['json'](_0x20441f);}};}function respondWithFilteredResult(_0x33a4ae,_0x7f5dea){return function(_0x4b2c7e){if(_0x4b2c7e){var _0x538f80=_0x4b2c7e['count'],_0x3652b6=_0x7f5dea[_0x1c0c('0x2e')],_0x45767b=_0x7f5dea[_0x1c0c('0x2e')]+_0x7f5dea[_0x1c0c('0x2f')],_0x44f74b;if(_0x45767b>=_0x538f80){_0x45767b=_0x538f80;_0x44f74b=0xc8;}else{_0x44f74b=0xce;}_0x33a4ae[_0x1c0c('0x2c')](_0x44f74b);return _0x33a4ae[_0x1c0c('0x30')](_0x1c0c('0x31'),_0x3652b6+'-'+_0x45767b+'/'+_0x538f80)['json'](_0x4b2c7e);}return null;};}function patchUpdates(_0x2a74bc){return function(_0x9a97fe){try{jsonpatch['apply'](_0x9a97fe,_0x2a74bc,!![]);}catch(_0x4311d0){return BPromise[_0x1c0c('0x32')](_0x4311d0);}return _0x9a97fe[_0x1c0c('0x33')]();};}function saveUpdates(_0x5cedd7,_0x5f1a81){return function(_0xd7e65){if(_0xd7e65){return _0xd7e65[_0x1c0c('0x34')](_0x5cedd7)[_0x1c0c('0x35')](function(_0x4beadd){return _0x4beadd;});}return null;};}function removeEntity(_0x3a6e16,_0xb2552c){return function(_0x3d92b8){if(_0x3d92b8){return _0x3d92b8[_0x1c0c('0x36')]()[_0x1c0c('0x35')](function(){_0x3a6e16[_0x1c0c('0x2c')](0xcc)[_0x1c0c('0x2d')]();});}};}function handleEntityNotFound(_0xcb96f2,_0x504d9c){return function(_0x343f86){if(!_0x343f86){_0xcb96f2['sendStatus'](0x194);}return _0x343f86;};}function handleError(_0x4f4ff3,_0x3cba41){_0x3cba41=_0x3cba41||0x1f4;return function(_0x42d7f3){logger[_0x1c0c('0x26')](_0x42d7f3[_0x1c0c('0x37')]);if(_0x42d7f3[_0x1c0c('0x38')]){delete _0x42d7f3[_0x1c0c('0x38')];}_0x4f4ff3[_0x1c0c('0x2c')](_0x3cba41)[_0x1c0c('0x39')](_0x42d7f3);};}exports[_0x1c0c('0x3a')]=function(_0x4e7f34,_0x8c50e7){var _0x1c55d2={},_0x411660={},_0x5e6847={'count':0x0,'rows':[]};var _0x13a0d6=_[_0x1c0c('0x3b')](db[_0x1c0c('0x3c')][_0x1c0c('0x3d')],function(_0x27b488){return{'name':_0x27b488[_0x1c0c('0x3e')],'type':_0x27b488[_0x1c0c('0x3f')][_0x1c0c('0x40')]};});_0x411660[_0x1c0c('0x41')]=_[_0x1c0c('0x3b')](_0x13a0d6,_0x1c0c('0x38'));_0x411660[_0x1c0c('0x42')]=_[_0x1c0c('0x43')](_0x4e7f34[_0x1c0c('0x42')]);_0x411660[_0x1c0c('0x44')]=_[_0x1c0c('0x45')](_0x411660[_0x1c0c('0x41')],_0x411660[_0x1c0c('0x42')]);_0x1c55d2['attributes']=_['intersection'](_0x411660[_0x1c0c('0x41')],qs[_0x1c0c('0x46')](_0x4e7f34[_0x1c0c('0x42')]['fields']));_0x1c55d2[_0x1c0c('0x47')]=_0x1c55d2[_0x1c0c('0x47')][_0x1c0c('0x48')]?_0x1c55d2[_0x1c0c('0x47')]:_0x411660[_0x1c0c('0x41')];if(!_0x4e7f34[_0x1c0c('0x42')]['hasOwnProperty'](_0x1c0c('0x49'))){_0x1c55d2[_0x1c0c('0x2f')]=qs[_0x1c0c('0x2f')](_0x4e7f34[_0x1c0c('0x42')][_0x1c0c('0x2f')]);_0x1c55d2[_0x1c0c('0x2e')]=qs[_0x1c0c('0x2e')](_0x4e7f34[_0x1c0c('0x42')][_0x1c0c('0x2e')]);}_0x1c55d2[_0x1c0c('0x4a')]=qs['sort'](_0x4e7f34[_0x1c0c('0x42')][_0x1c0c('0x4b')]);_0x1c55d2[_0x1c0c('0x4c')]=qs[_0x1c0c('0x44')](_[_0x1c0c('0x4d')](_0x4e7f34[_0x1c0c('0x42')],_0x411660[_0x1c0c('0x44')]),_0x13a0d6);if(_0x4e7f34[_0x1c0c('0x42')][_0x1c0c('0x4e')]){_0x1c55d2[_0x1c0c('0x4c')]=_[_0x1c0c('0x4f')](_0x1c55d2['where'],{'$or':_[_0x1c0c('0x3b')](_0x13a0d6,function(_0x2d11c4){if(_0x2d11c4['type']!==_0x1c0c('0x50')){var _0x3d870d={};_0x3d870d[_0x2d11c4[_0x1c0c('0x38')]]={'$like':'%'+_0x4e7f34[_0x1c0c('0x42')][_0x1c0c('0x4e')]+'%'};return _0x3d870d;}})});}_0x1c55d2=_[_0x1c0c('0x4f')]({},_0x1c55d2,_0x4e7f34[_0x1c0c('0x51')]);var _0x585635={'where':_0x1c55d2['where']};return db[_0x1c0c('0x3c')]['count'](_0x585635)['then'](function(_0xda9607){_0x5e6847[_0x1c0c('0x52')]=_0xda9607;if(_0x4e7f34[_0x1c0c('0x42')][_0x1c0c('0x53')]){_0x1c55d2[_0x1c0c('0x54')]=[{'all':!![]}];}return db[_0x1c0c('0x3c')][_0x1c0c('0x55')](_0x1c55d2);})[_0x1c0c('0x35')](function(_0x3d21d2){_0x5e6847[_0x1c0c('0x56')]=_0x3d21d2;return _0x5e6847;})['then'](respondWithFilteredResult(_0x8c50e7,_0x1c55d2))['catch'](handleError(_0x8c50e7,null));};exports[_0x1c0c('0x57')]=function(_0x4b676e,_0x28ffac){var _0x336e64={'raw':![],'where':{'id':_0x4b676e[_0x1c0c('0x58')]['id']}},_0x267917={};_0x267917['model']=_['keys'](db[_0x1c0c('0x3c')][_0x1c0c('0x3d')]);_0x267917[_0x1c0c('0x42')]=_[_0x1c0c('0x43')](_0x4b676e[_0x1c0c('0x42')]);_0x267917['filters']=_[_0x1c0c('0x45')](_0x267917[_0x1c0c('0x41')],_0x267917[_0x1c0c('0x42')]);_0x336e64[_0x1c0c('0x47')]=_[_0x1c0c('0x45')](_0x267917[_0x1c0c('0x41')],qs[_0x1c0c('0x46')](_0x4b676e[_0x1c0c('0x42')][_0x1c0c('0x46')]));_0x336e64['attributes']=_0x336e64[_0x1c0c('0x47')][_0x1c0c('0x48')]?_0x336e64[_0x1c0c('0x47')]:_0x267917['model'];if(_0x4b676e[_0x1c0c('0x42')]['includeAll']){_0x336e64['include']=[{'all':!![]}];}_0x336e64=_[_0x1c0c('0x4f')]({},_0x336e64,_0x4b676e[_0x1c0c('0x51')]);return db['VtigerAccount']['find'](_0x336e64)['then'](handleEntityNotFound(_0x28ffac,null))[_0x1c0c('0x35')](respondWithResult(_0x28ffac,null))['catch'](handleError(_0x28ffac,null));};exports[_0x1c0c('0x59')]=function(_0x3ffdd9,_0x7c00ee){return db['VtigerAccount'][_0x1c0c('0x59')](_0x3ffdd9['body'],{})[_0x1c0c('0x35')](respondWithResult(_0x7c00ee,0xc9))[_0x1c0c('0x2b')](handleError(_0x7c00ee,null));};exports[_0x1c0c('0x34')]=function(_0x3955a2,_0x50e9ed){if(_0x3955a2[_0x1c0c('0x5a')]['id']){delete _0x3955a2[_0x1c0c('0x5a')]['id'];}return db['VtigerAccount'][_0x1c0c('0x5b')]({'where':{'id':_0x3955a2[_0x1c0c('0x58')]['id']}})[_0x1c0c('0x35')](handleEntityNotFound(_0x50e9ed,null))[_0x1c0c('0x35')](saveUpdates(_0x3955a2['body'],null))['then'](respondWithResult(_0x50e9ed,null))['catch'](handleError(_0x50e9ed,null));};exports[_0x1c0c('0x36')]=function(_0x541065,_0x1ba89f){return db[_0x1c0c('0x3c')][_0x1c0c('0x5b')]({'where':{'id':_0x541065[_0x1c0c('0x58')]['id']}})['then'](handleEntityNotFound(_0x1ba89f,null))[_0x1c0c('0x35')](removeEntity(_0x1ba89f,null))['catch'](handleError(_0x1ba89f,null));};exports[_0x1c0c('0x5c')]=function(_0x5f03d7,_0x2c23b5,_0x288865){var _0x632aee={};var _0x29fbee={};var _0x16f949;var _0x42f9e0;return db[_0x1c0c('0x3c')]['findOne']({'where':{'id':_0x5f03d7[_0x1c0c('0x58')]['id']}})[_0x1c0c('0x35')](handleEntityNotFound(_0x2c23b5,null))['then'](function(_0x293d2f){if(_0x293d2f){_0x16f949=_0x293d2f;_0x29fbee[_0x1c0c('0x41')]=_[_0x1c0c('0x43')](db[_0x1c0c('0x5d')]['rawAttributes']);_0x29fbee[_0x1c0c('0x42')]=_['keys'](_0x5f03d7[_0x1c0c('0x42')]);_0x29fbee[_0x1c0c('0x44')]=_[_0x1c0c('0x45')](_0x29fbee[_0x1c0c('0x41')],_0x29fbee[_0x1c0c('0x42')]);_0x632aee[_0x1c0c('0x47')]=_[_0x1c0c('0x45')](_0x29fbee[_0x1c0c('0x41')],qs[_0x1c0c('0x46')](_0x5f03d7['query'][_0x1c0c('0x46')]));_0x632aee[_0x1c0c('0x47')]=_0x632aee['attributes'][_0x1c0c('0x48')]?_0x632aee[_0x1c0c('0x47')]:_0x29fbee[_0x1c0c('0x41')];_0x632aee[_0x1c0c('0x4a')]=qs[_0x1c0c('0x4b')](_0x5f03d7[_0x1c0c('0x42')][_0x1c0c('0x4b')]);_0x632aee[_0x1c0c('0x4c')]=qs[_0x1c0c('0x44')](_[_0x1c0c('0x4d')](_0x5f03d7[_0x1c0c('0x42')],_0x29fbee['filters']));if(_0x5f03d7[_0x1c0c('0x42')][_0x1c0c('0x4e')]){_0x632aee[_0x1c0c('0x4c')]=_['merge'](_0x632aee['where'],{'$or':_[_0x1c0c('0x3b')](_0x632aee[_0x1c0c('0x47')],function(_0x14ddd2){var _0x31bb8b={};_0x31bb8b[_0x14ddd2]={'$like':'%'+_0x5f03d7['query'][_0x1c0c('0x4e')]+'%'};return _0x31bb8b;})});}_0x632aee=_['merge']({},_0x632aee,_0x5f03d7['options']);return _0x16f949[_0x1c0c('0x5c')](_0x632aee);}})[_0x1c0c('0x35')](function(_0x49dc1a){if(_0x49dc1a){_0x42f9e0=_0x49dc1a['length'];if(!_0x5f03d7['query']['hasOwnProperty'](_0x1c0c('0x49'))){_0x632aee['limit']=qs[_0x1c0c('0x2f')](_0x5f03d7[_0x1c0c('0x42')]['limit']);_0x632aee[_0x1c0c('0x2e')]=qs[_0x1c0c('0x2e')](_0x5f03d7[_0x1c0c('0x42')][_0x1c0c('0x2e')]);}return _0x16f949[_0x1c0c('0x5c')](_0x632aee);}})[_0x1c0c('0x35')](function(_0x38568f){if(_0x38568f){return _0x38568f?{'count':_0x42f9e0,'rows':_0x38568f}:null;}})[_0x1c0c('0x35')](respondWithResult(_0x2c23b5,null))[_0x1c0c('0x2b')](handleError(_0x2c23b5,null));};exports[_0x1c0c('0x5e')]=function(_0x3c241b,_0x1e1c04,_0x42ff4e){if(_0x3c241b[_0x1c0c('0x5a')]['id']){delete _0x3c241b[_0x1c0c('0x5a')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x3c241b[_0x1c0c('0x58')]['id']}})['then'](handleEntityNotFound(_0x1e1c04,null))[_0x1c0c('0x35')](function(_0x388cbf){if(_0x388cbf){_0x3c241b['body'][_0x1c0c('0x5f')]=_0x388cbf['id'];_0x3c241b[_0x1c0c('0x5a')][_0x1c0c('0x60')]=integrations[_0x1c0c('0x61')](_0x3c241b[_0x1c0c('0x5a')]['channel'],_0x3c241b[_0x1c0c('0x5a')][_0x1c0c('0x3f')]);_0x3c241b[_0x1c0c('0x5a')][_0x1c0c('0x62')]=integrations[_0x1c0c('0x63')](_0x3c241b['body'][_0x1c0c('0x64')],_0x3c241b[_0x1c0c('0x5a')]['type']);return db['VtigerConfiguration'][_0x1c0c('0x59')](_0x3c241b[_0x1c0c('0x5a')],{'include':[{'model':db[_0x1c0c('0x65')],'as':_0x1c0c('0x60')},{'model':db['VtigerField'],'as':_0x1c0c('0x62')}]});}return null;})['then'](respondWithResult(_0x1e1c04,null))[_0x1c0c('0x2b')](handleError(_0x1e1c04,null));};var md5=require(_0x1c0c('0x66'));exports['getFields']=function(_0x349126,_0x3e5306,_0x2bfb35){var _0x1e7216=null;var _0x3f5965=null;var _0xabc5c=null;var _0xe01f52=null;var _0x5e3a8b='';return db[_0x1c0c('0x3c')][_0x1c0c('0x67')]({'where':{'id':_0x349126[_0x1c0c('0x58')]['id']},'attributes':['id',_0x1c0c('0x38'),_0x1c0c('0x68'),'description',_0x1c0c('0x69'),'remoteUri',_0x1c0c('0x6a'),_0x1c0c('0x6b')]})[_0x1c0c('0x35')](handleEntityNotFound(_0x3e5306,null))['then'](function(_0x5402da){if(_0x5402da){_0x1e7216=_0x5402da[_0x1c0c('0x68')];_0x3f5965=_0x5402da[_0x1c0c('0x6b')];_0xabc5c=_0x5402da[_0x1c0c('0x69')];_0x5e3a8b=_0x5402da[_0x1c0c('0x6c')];var _0x56fea8=_0x5e3a8b[_0x1c0c('0x6d')](-0x1);if(_0x56fea8==='/'){_0x5e3a8b=_0x5e3a8b[_0x1c0c('0x6e')](0x0,_0x5e3a8b[_0x1c0c('0x6f')](_0x56fea8));}_0xe01f52=util[_0x1c0c('0x70')](_0x1c0c('0x71'),_0x5e3a8b);var _0x38b765={'method':'GET','uri':_0xe01f52,'qs':{'operation':_0x1c0c('0x72'),'username':_0x5402da[_0x1c0c('0x68')]},'json':!![]};return rp(_0x38b765);}})['then'](function(_0x293671){if(_0x293671[_0x1c0c('0x73')]){var _0x51ed19={'method':_0x1c0c('0x74'),'uri':_0xe01f52,'form':{'operation':'login','username':_0x1e7216,'accessKey':md5(_0x293671[_0x1c0c('0x2a')][_0x1c0c('0x75')]+_0x3f5965)},'json':!![]};return rp(_0x51ed19);}})['then'](function(_0x46d1e2){if(_0x46d1e2[_0x1c0c('0x73')]){var _0x2bb6e9={'method':_0x1c0c('0x76'),'uri':_0xe01f52,'qs':{'operation':_0x1c0c('0x77'),'username':_0x1e7216,'sessionName':_0x46d1e2[_0x1c0c('0x2a')]['sessionName'],'elementType':_0xabc5c},'json':!![]};return rp(_0x2bb6e9);}})[_0x1c0c('0x35')](function(_0x5ecd06){if(_0x5ecd06['success']){var _0x1dea26=['autogenerated',_0x1c0c('0x78'),'owner'];_[_0x1c0c('0x79')](_0x5ecd06[_0x1c0c('0x2a')][_0x1c0c('0x46')],function(_0x5eee29){return _0x1dea26[_0x1c0c('0x7a')](_0x5eee29[_0x1c0c('0x3f')][_0x1c0c('0x38')]);});_[_0x1c0c('0x79')](_0x5ecd06[_0x1c0c('0x2a')][_0x1c0c('0x46')],function(_0x78e75){return _0x78e75[_0x1c0c('0x7b')]===_0x1c0c('0x7c');});return{'count':_0x5ecd06['result']['fields'][_0x1c0c('0x48')],'rows':_['map'](_0x5ecd06[_0x1c0c('0x2a')][_0x1c0c('0x46')],function(_0x295a94){return{'id':_0x295a94[_0x1c0c('0x38')],'name':_0x295a94[_0x1c0c('0x7d')],'custom':_[_0x1c0c('0x7e')](_0x295a94[_0x1c0c('0x38')],_0x1c0c('0x7f'))?!![]:![],'options':_0x295a94[_0x1c0c('0x3f')][_0x1c0c('0x38')]==='picklist'&&_0x295a94[_0x1c0c('0x3f')][_0x1c0c('0x80')][_0x1c0c('0x48')]>0x0?_['map'](_0x295a94[_0x1c0c('0x3f')][_0x1c0c('0x80')],function(_0x419bfc){return{'name':_0x419bfc[_0x1c0c('0x7d')],'value':_0x419bfc[_0x1c0c('0x81')]};}):[]};})};}})[_0x1c0c('0x35')](respondWithResult(_0x3e5306,null))[_0x1c0c('0x2b')](function(_0x486a9e){console[_0x1c0c('0x82')]('vTiger\x20error:\x20'+_0x486a9e);var _0x2a88e3=_0x349126[_0x1c0c('0x42')]['test']?0x1f4:_0x486a9e[_0x1c0c('0x83')]||0x1f4;logger[_0x1c0c('0x26')](_0x1c0c('0x84'),_0x1c0c('0x85'),_0x2a88e3,JSON[_0x1c0c('0x25')](_0x486a9e));delete _0x486a9e[_0x1c0c('0x38')];if(_0x2a88e3===0x191){_0x2a88e3=0x190;}_0x3e5306[_0x1c0c('0x2c')](_0x2a88e3)['send'](_0x349126[_0x1c0c('0x42')][_0x1c0c('0x1d')]?{'message':_0x1c0c('0x86'),'statusCode':_0x486a9e['statusCode']}:_0x486a9e);});}; \ No newline at end of file +var _0x3f43=['getFields','description','serverUrl','accessKey','username','remoteUri','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','result','token','sessionName','success','autogenerated','reference','owner','remove','editable','false','label','cf_','picklist','map','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','index','rawAttributes','type','key','model','keys','attributes','fields','query','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','VtigerAccount','rows','show','params','intersection','find','create','body','findOne','VtigerConfiguration','getConfigurations','hasOwnProperty','addConfiguration','AccountId','channel','Descriptions','getDescriptions','VtigerField','Subjects','md5'];(function(_0x10c56b,_0x297995){var _0x5c3889=function(_0x590a77){while(--_0x590a77){_0x10c56b['push'](_0x10c56b['shift']());}};_0x5c3889(++_0x297995);}(_0x3f43,0xa8));var _0x33f4=function(_0x6e2a63,_0x2473e3){_0x6e2a63=_0x6e2a63-0x0;var _0x56952a=_0x3f43[_0x6e2a63];return _0x56952a;};'use strict';var pdf=require(_0x33f4('0x0'));var emlformat=require(_0x33f4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x33f4('0x2'));var jsonpatch=require(_0x33f4('0x3'));var rp=require('request-promise');var moment=require(_0x33f4('0x4'));var BPromise=require(_0x33f4('0x5'));var Mustache=require(_0x33f4('0x6'));var util=require('util');var path=require(_0x33f4('0x7'));var sox=require(_0x33f4('0x8'));var csv=require(_0x33f4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x33f4('0xa'));var squel=require(_0x33f4('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x33f4('0xc'));var toCsv=require(_0x33f4('0x9'));var querystring=require(_0x33f4('0xd'));var Papa=require(_0x33f4('0xe'));var Redis=require(_0x33f4('0xf'));var authService=require(_0x33f4('0x10'));var qs=require(_0x33f4('0x11'));var as=require(_0x33f4('0x12'));var hardwareService=require(_0x33f4('0x13'));var logger=require(_0x33f4('0x14'))(_0x33f4('0x15'));var utils=require(_0x33f4('0x16'));var config=require(_0x33f4('0x17'));var db=require(_0x33f4('0x18'))['db'];var integrations=require(_0x33f4('0x19'));var jayson=require(_0x33f4('0x1a'));var client=jayson[_0x33f4('0x1b')][_0x33f4('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x42c3f5,_0x16b624,_0x182261){if(_0x182261){var _0x245b50=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x245b50[_0x33f4('0x1d')](_0x16b624)){return _0x42c3f5;}else{throw new db[(_0x33f4('0x1e'))][(_0x33f4('0x1f'))](_0x33f4('0x20'));}}else{return _0x42c3f5;}}function respondWithRpcPromise(_0x3f5d91,_0x93df11,_0x466bea,_0x326a15){return new BPromise(function(_0x5109c2,_0x19094a){var _0x5530cb=_0x326a15||client;return _0x5530cb['request'](_0x3f5d91,_0x466bea)['then'](function(_0x380b9e){logger[_0x33f4('0x21')](_0x33f4('0x22'),_0x93df11,_0x33f4('0x23'));logger[_0x33f4('0x24')](_0x33f4('0x25'),_0x93df11,_0x33f4('0x23'),JSON[_0x33f4('0x26')](_0x380b9e));if(_0x380b9e[_0x33f4('0x27')]){if(_0x380b9e[_0x33f4('0x27')][_0x33f4('0x28')]===0x1f4){logger[_0x33f4('0x27')]('VtigerAccount,\x20%s,\x20%s',_0x93df11,_0x380b9e[_0x33f4('0x27')]['message']);return _0x19094a(_0x380b9e[_0x33f4('0x27')][_0x33f4('0x29')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x93df11,_0x380b9e[_0x33f4('0x27')][_0x33f4('0x29')]);return _0x5109c2(_0x380b9e[_0x33f4('0x27')][_0x33f4('0x29')]);}else{logger['info'](_0x33f4('0x22'),_0x93df11,_0x33f4('0x23'));_0x5109c2(_0x380b9e['result'][_0x33f4('0x29')]);}})[_0x33f4('0x2a')](function(_0x177ff3){logger[_0x33f4('0x27')]('VtigerAccount,\x20%s,\x20%s',_0x93df11,_0x177ff3);_0x19094a(_0x177ff3);});});}function respondWithStatusCode(_0x1408a2,_0x435441){_0x435441=_0x435441||0xcc;return function(_0x4c0131){if(_0x4c0131){return _0x1408a2['sendStatus'](_0x435441);}return _0x1408a2[_0x33f4('0x2b')](_0x435441)[_0x33f4('0x2c')]();};}function respondWithResult(_0x964cae,_0x47f465){_0x47f465=_0x47f465||0xc8;return function(_0x4b575b){if(_0x4b575b){return _0x964cae[_0x33f4('0x2b')](_0x47f465)[_0x33f4('0x2d')](_0x4b575b);}};}function respondWithFilteredResult(_0x5b0b2e,_0x2eca08){return function(_0x83e380){if(_0x83e380){var _0x40fc54=_0x83e380[_0x33f4('0x2e')],_0x5ef118=_0x2eca08['offset'],_0x486609=_0x2eca08[_0x33f4('0x2f')]+_0x2eca08[_0x33f4('0x30')],_0x7c3436;if(_0x486609>=_0x40fc54){_0x486609=_0x40fc54;_0x7c3436=0xc8;}else{_0x7c3436=0xce;}_0x5b0b2e['status'](_0x7c3436);return _0x5b0b2e[_0x33f4('0x31')](_0x33f4('0x32'),_0x5ef118+'-'+_0x486609+'/'+_0x40fc54)[_0x33f4('0x2d')](_0x83e380);}return null;};}function patchUpdates(_0x3a5189){return function(_0x2549a9){try{jsonpatch[_0x33f4('0x33')](_0x2549a9,_0x3a5189,!![]);}catch(_0x4864f1){return BPromise['reject'](_0x4864f1);}return _0x2549a9[_0x33f4('0x34')]();};}function saveUpdates(_0x37c3cb,_0x1b9732){return function(_0x24eeb8){if(_0x24eeb8){return _0x24eeb8[_0x33f4('0x35')](_0x37c3cb)[_0x33f4('0x36')](function(_0x57c72a){return _0x57c72a;});}return null;};}function removeEntity(_0x1e20ce,_0xd40edc){return function(_0x450186){if(_0x450186){return _0x450186[_0x33f4('0x37')]()['then'](function(){_0x1e20ce[_0x33f4('0x2b')](0xcc)[_0x33f4('0x2c')]();});}};}function handleEntityNotFound(_0x461aa1,_0x3c3a17){return function(_0x55c5c7){if(!_0x55c5c7){_0x461aa1['sendStatus'](0x194);}return _0x55c5c7;};}function handleError(_0x2c14b7,_0x2d82f5){_0x2d82f5=_0x2d82f5||0x1f4;return function(_0x5d8764){logger['error'](_0x5d8764[_0x33f4('0x38')]);if(_0x5d8764[_0x33f4('0x39')]){delete _0x5d8764[_0x33f4('0x39')];}_0x2c14b7['status'](_0x2d82f5)['send'](_0x5d8764);};}exports[_0x33f4('0x3a')]=function(_0x48eae7,_0x3e9b57){var _0x580751={},_0x1f55a2={},_0x2d8dfd={'count':0x0,'rows':[]};var _0x417f98=_['map'](db['VtigerAccount'][_0x33f4('0x3b')],function(_0x2d38ae){return{'name':_0x2d38ae['fieldName'],'type':_0x2d38ae[_0x33f4('0x3c')][_0x33f4('0x3d')]};});_0x1f55a2[_0x33f4('0x3e')]=_['map'](_0x417f98,'name');_0x1f55a2['query']=_[_0x33f4('0x3f')](_0x48eae7['query']);_0x1f55a2['filters']=_['intersection'](_0x1f55a2[_0x33f4('0x3e')],_0x1f55a2['query']);_0x580751[_0x33f4('0x40')]=_['intersection'](_0x1f55a2[_0x33f4('0x3e')],qs[_0x33f4('0x41')](_0x48eae7[_0x33f4('0x42')][_0x33f4('0x41')]));_0x580751['attributes']=_0x580751[_0x33f4('0x40')][_0x33f4('0x43')]?_0x580751[_0x33f4('0x40')]:_0x1f55a2[_0x33f4('0x3e')];if(!_0x48eae7[_0x33f4('0x42')]['hasOwnProperty'](_0x33f4('0x44'))){_0x580751[_0x33f4('0x30')]=qs[_0x33f4('0x30')](_0x48eae7[_0x33f4('0x42')][_0x33f4('0x30')]);_0x580751[_0x33f4('0x2f')]=qs['offset'](_0x48eae7[_0x33f4('0x42')][_0x33f4('0x2f')]);}_0x580751[_0x33f4('0x45')]=qs[_0x33f4('0x46')](_0x48eae7[_0x33f4('0x42')][_0x33f4('0x46')]);_0x580751[_0x33f4('0x47')]=qs[_0x33f4('0x48')](_[_0x33f4('0x49')](_0x48eae7[_0x33f4('0x42')],_0x1f55a2[_0x33f4('0x48')]),_0x417f98);if(_0x48eae7[_0x33f4('0x42')][_0x33f4('0x4a')]){_0x580751[_0x33f4('0x47')]=_['merge'](_0x580751[_0x33f4('0x47')],{'$or':_['map'](_0x417f98,function(_0x23a401){if(_0x23a401[_0x33f4('0x3c')]!==_0x33f4('0x4b')){var _0x24de5c={};_0x24de5c[_0x23a401[_0x33f4('0x39')]]={'$like':'%'+_0x48eae7[_0x33f4('0x42')][_0x33f4('0x4a')]+'%'};return _0x24de5c;}})});}_0x580751=_[_0x33f4('0x4c')]({},_0x580751,_0x48eae7[_0x33f4('0x4d')]);var _0x130b3d={'where':_0x580751[_0x33f4('0x47')]};return db['VtigerAccount']['count'](_0x130b3d)[_0x33f4('0x36')](function(_0x5bed34){_0x2d8dfd[_0x33f4('0x2e')]=_0x5bed34;if(_0x48eae7[_0x33f4('0x42')][_0x33f4('0x4e')]){_0x580751[_0x33f4('0x4f')]=[{'all':!![]}];}return db[_0x33f4('0x50')]['findAll'](_0x580751);})['then'](function(_0x1ea566){_0x2d8dfd[_0x33f4('0x51')]=_0x1ea566;return _0x2d8dfd;})['then'](respondWithFilteredResult(_0x3e9b57,_0x580751))[_0x33f4('0x2a')](handleError(_0x3e9b57,null));};exports[_0x33f4('0x52')]=function(_0x182be4,_0x17a7db){var _0x62df2c={'raw':![],'where':{'id':_0x182be4[_0x33f4('0x53')]['id']}},_0x36918f={};_0x36918f[_0x33f4('0x3e')]=_[_0x33f4('0x3f')](db['VtigerAccount'][_0x33f4('0x3b')]);_0x36918f[_0x33f4('0x42')]=_[_0x33f4('0x3f')](_0x182be4['query']);_0x36918f[_0x33f4('0x48')]=_[_0x33f4('0x54')](_0x36918f[_0x33f4('0x3e')],_0x36918f[_0x33f4('0x42')]);_0x62df2c['attributes']=_[_0x33f4('0x54')](_0x36918f[_0x33f4('0x3e')],qs['fields'](_0x182be4[_0x33f4('0x42')]['fields']));_0x62df2c['attributes']=_0x62df2c[_0x33f4('0x40')][_0x33f4('0x43')]?_0x62df2c['attributes']:_0x36918f[_0x33f4('0x3e')];if(_0x182be4[_0x33f4('0x42')]['includeAll']){_0x62df2c[_0x33f4('0x4f')]=[{'all':!![]}];}_0x62df2c=_[_0x33f4('0x4c')]({},_0x62df2c,_0x182be4[_0x33f4('0x4d')]);return db[_0x33f4('0x50')][_0x33f4('0x55')](_0x62df2c)[_0x33f4('0x36')](handleEntityNotFound(_0x17a7db,null))['then'](respondWithResult(_0x17a7db,null))[_0x33f4('0x2a')](handleError(_0x17a7db,null));};exports[_0x33f4('0x56')]=function(_0x28de5c,_0x41088c){return db[_0x33f4('0x50')]['create'](_0x28de5c[_0x33f4('0x57')],{})[_0x33f4('0x36')](respondWithResult(_0x41088c,0xc9))['catch'](handleError(_0x41088c,null));};exports[_0x33f4('0x35')]=function(_0x478415,_0x109334){if(_0x478415['body']['id']){delete _0x478415[_0x33f4('0x57')]['id'];}return db[_0x33f4('0x50')][_0x33f4('0x55')]({'where':{'id':_0x478415[_0x33f4('0x53')]['id']}})['then'](handleEntityNotFound(_0x109334,null))[_0x33f4('0x36')](saveUpdates(_0x478415[_0x33f4('0x57')],null))[_0x33f4('0x36')](respondWithResult(_0x109334,null))[_0x33f4('0x2a')](handleError(_0x109334,null));};exports[_0x33f4('0x37')]=function(_0x540155,_0x35dc5f){return db['VtigerAccount'][_0x33f4('0x55')]({'where':{'id':_0x540155['params']['id']}})[_0x33f4('0x36')](handleEntityNotFound(_0x35dc5f,null))[_0x33f4('0x36')](removeEntity(_0x35dc5f,null))['catch'](handleError(_0x35dc5f,null));};exports['getConfigurations']=function(_0x3ccfcc,_0x569166,_0x16314d){var _0x22acb8={};var _0x24dc41={};var _0x558503;var _0xdbacbd;return db['VtigerAccount'][_0x33f4('0x58')]({'where':{'id':_0x3ccfcc[_0x33f4('0x53')]['id']}})['then'](handleEntityNotFound(_0x569166,null))[_0x33f4('0x36')](function(_0x32e105){if(_0x32e105){_0x558503=_0x32e105;_0x24dc41[_0x33f4('0x3e')]=_[_0x33f4('0x3f')](db[_0x33f4('0x59')][_0x33f4('0x3b')]);_0x24dc41['query']=_[_0x33f4('0x3f')](_0x3ccfcc[_0x33f4('0x42')]);_0x24dc41[_0x33f4('0x48')]=_[_0x33f4('0x54')](_0x24dc41[_0x33f4('0x3e')],_0x24dc41['query']);_0x22acb8[_0x33f4('0x40')]=_[_0x33f4('0x54')](_0x24dc41[_0x33f4('0x3e')],qs[_0x33f4('0x41')](_0x3ccfcc[_0x33f4('0x42')][_0x33f4('0x41')]));_0x22acb8[_0x33f4('0x40')]=_0x22acb8[_0x33f4('0x40')][_0x33f4('0x43')]?_0x22acb8[_0x33f4('0x40')]:_0x24dc41[_0x33f4('0x3e')];_0x22acb8[_0x33f4('0x45')]=qs[_0x33f4('0x46')](_0x3ccfcc[_0x33f4('0x42')][_0x33f4('0x46')]);_0x22acb8['where']=qs['filters'](_[_0x33f4('0x49')](_0x3ccfcc[_0x33f4('0x42')],_0x24dc41[_0x33f4('0x48')]));if(_0x3ccfcc[_0x33f4('0x42')][_0x33f4('0x4a')]){_0x22acb8[_0x33f4('0x47')]=_['merge'](_0x22acb8[_0x33f4('0x47')],{'$or':_['map'](_0x22acb8[_0x33f4('0x40')],function(_0x34c7e5){var _0x48c0be={};_0x48c0be[_0x34c7e5]={'$like':'%'+_0x3ccfcc[_0x33f4('0x42')][_0x33f4('0x4a')]+'%'};return _0x48c0be;})});}_0x22acb8=_[_0x33f4('0x4c')]({},_0x22acb8,_0x3ccfcc['options']);return _0x558503[_0x33f4('0x5a')](_0x22acb8);}})[_0x33f4('0x36')](function(_0x5427ed){if(_0x5427ed){_0xdbacbd=_0x5427ed[_0x33f4('0x43')];if(!_0x3ccfcc['query'][_0x33f4('0x5b')](_0x33f4('0x44'))){_0x22acb8['limit']=qs['limit'](_0x3ccfcc[_0x33f4('0x42')][_0x33f4('0x30')]);_0x22acb8['offset']=qs[_0x33f4('0x2f')](_0x3ccfcc[_0x33f4('0x42')][_0x33f4('0x2f')]);}return _0x558503[_0x33f4('0x5a')](_0x22acb8);}})[_0x33f4('0x36')](function(_0x391e92){if(_0x391e92){return _0x391e92?{'count':_0xdbacbd,'rows':_0x391e92}:null;}})['then'](respondWithResult(_0x569166,null))['catch'](handleError(_0x569166,null));};exports[_0x33f4('0x5c')]=function(_0x1577c1,_0x2e9ad1,_0x566860){if(_0x1577c1[_0x33f4('0x57')]['id']){delete _0x1577c1[_0x33f4('0x57')]['id'];}return db[_0x33f4('0x50')]['findOne']({'where':{'id':_0x1577c1[_0x33f4('0x53')]['id']}})['then'](handleEntityNotFound(_0x2e9ad1,null))['then'](function(_0x2ce987){if(_0x2ce987){_0x1577c1[_0x33f4('0x57')][_0x33f4('0x5d')]=_0x2ce987['id'];_0x1577c1['body']['Subjects']=integrations['getSubjects'](_0x1577c1['body'][_0x33f4('0x5e')],_0x1577c1[_0x33f4('0x57')][_0x33f4('0x3c')]);_0x1577c1[_0x33f4('0x57')][_0x33f4('0x5f')]=integrations[_0x33f4('0x60')](_0x1577c1[_0x33f4('0x57')][_0x33f4('0x5e')],_0x1577c1['body']['type']);return db['VtigerConfiguration']['create'](_0x1577c1['body'],{'include':[{'model':db[_0x33f4('0x61')],'as':_0x33f4('0x62')},{'model':db['VtigerField'],'as':_0x33f4('0x5f')}]});}return null;})[_0x33f4('0x36')](respondWithResult(_0x2e9ad1,null))[_0x33f4('0x2a')](handleError(_0x2e9ad1,null));};var md5=require(_0x33f4('0x63'));exports[_0x33f4('0x64')]=function(_0x501230,_0x12ecbb,_0x58ddc0){var _0x1a0090=null;var _0x1b8358=null;var _0x35785b=null;var _0x476c5f=null;var _0x2f9117='';return db['VtigerAccount'][_0x33f4('0x58')]({'where':{'id':_0x501230[_0x33f4('0x53')]['id']},'attributes':['id','name','username',_0x33f4('0x65'),'moduleName','remoteUri',_0x33f4('0x66'),_0x33f4('0x67')]})['then'](handleEntityNotFound(_0x12ecbb,null))[_0x33f4('0x36')](function(_0x494937){if(_0x494937){_0x1a0090=_0x494937[_0x33f4('0x68')];_0x1b8358=_0x494937['accessKey'];_0x35785b=_0x494937['moduleName'];_0x2f9117=_0x494937[_0x33f4('0x69')];var _0x42a1cc=_0x2f9117['slice'](-0x1);if(_0x42a1cc==='/'){_0x2f9117=_0x2f9117['substring'](0x0,_0x2f9117[_0x33f4('0x6a')](_0x42a1cc));}_0x476c5f=util[_0x33f4('0x6b')](_0x33f4('0x6c'),_0x2f9117);var _0x2a4f73={'method':_0x33f4('0x6d'),'uri':_0x476c5f,'qs':{'operation':_0x33f4('0x6e'),'username':_0x494937[_0x33f4('0x68')]},'json':!![]};return rp(_0x2a4f73);}})[_0x33f4('0x36')](function(_0xbe1724){if(_0xbe1724['success']){var _0x276bdd={'method':_0x33f4('0x6f'),'uri':_0x476c5f,'form':{'operation':'login','username':_0x1a0090,'accessKey':md5(_0xbe1724[_0x33f4('0x70')][_0x33f4('0x71')]+_0x1b8358)},'json':!![]};return rp(_0x276bdd);}})[_0x33f4('0x36')](function(_0x39380e){if(_0x39380e['success']){var _0x1e9c29={'method':_0x33f4('0x6d'),'uri':_0x476c5f,'qs':{'operation':'describe','username':_0x1a0090,'sessionName':_0x39380e[_0x33f4('0x70')][_0x33f4('0x72')],'elementType':_0x35785b},'json':!![]};return rp(_0x1e9c29);}})[_0x33f4('0x36')](function(_0x4b1ff7){if(_0x4b1ff7[_0x33f4('0x73')]){var _0x3b5fe2=[_0x33f4('0x74'),_0x33f4('0x75'),_0x33f4('0x76')];_[_0x33f4('0x77')](_0x4b1ff7['result']['fields'],function(_0x359e3c){return _0x3b5fe2['includes'](_0x359e3c[_0x33f4('0x3c')]['name']);});_[_0x33f4('0x77')](_0x4b1ff7[_0x33f4('0x70')][_0x33f4('0x41')],function(_0xdf466b){return _0xdf466b[_0x33f4('0x78')]===_0x33f4('0x79');});return{'count':_0x4b1ff7[_0x33f4('0x70')][_0x33f4('0x41')]['length'],'rows':_['map'](_0x4b1ff7[_0x33f4('0x70')][_0x33f4('0x41')],function(_0x579e9c){return{'id':_0x579e9c[_0x33f4('0x39')],'name':_0x579e9c[_0x33f4('0x7a')],'custom':_['startsWith'](_0x579e9c['name'],_0x33f4('0x7b'))?!![]:![],'options':_0x579e9c[_0x33f4('0x3c')][_0x33f4('0x39')]===_0x33f4('0x7c')&&_0x579e9c[_0x33f4('0x3c')]['picklistValues'][_0x33f4('0x43')]>0x0?_[_0x33f4('0x7d')](_0x579e9c[_0x33f4('0x3c')][_0x33f4('0x7e')],function(_0x236b54){return{'name':_0x236b54['label'],'value':_0x236b54[_0x33f4('0x7f')]};}):[]};})};}})[_0x33f4('0x36')](respondWithResult(_0x12ecbb,null))[_0x33f4('0x2a')](function(_0xe30032){console[_0x33f4('0x80')](_0x33f4('0x81')+_0xe30032);var _0x28a85a=_0x501230[_0x33f4('0x42')][_0x33f4('0x1d')]?0x1f4:_0xe30032[_0x33f4('0x82')]||0x1f4;logger[_0x33f4('0x27')](_0x33f4('0x83'),_0x33f4('0x64'),_0x28a85a,JSON[_0x33f4('0x26')](_0xe30032));delete _0xe30032[_0x33f4('0x39')];if(_0x28a85a===0x191){_0x28a85a=0x190;}_0x12ecbb[_0x33f4('0x2b')](_0x28a85a)[_0x33f4('0x84')](_0x501230[_0x33f4('0x42')][_0x33f4('0x1d')]?{'message':_0x33f4('0x85'),'statusCode':_0xe30032[_0x33f4('0x82')]}:_0xe30032);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 79109d8..4876bde 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 _0x7c96=['path','rimraf','../../config/environment','./intVtigerAccount.attributes','define','int_vtiger_accounts','lodash','util','api','bluebird','request-promise'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x7c96,0x12f));var _0x67c9=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0x7c96[_0x50e593];return _0x3821d0;};'use strict';var _=require(_0x67c9('0x0'));var util=require(_0x67c9('0x1'));var logger=require('../../config/logger')(_0x67c9('0x2'));var moment=require('moment');var BPromise=require(_0x67c9('0x3'));var rp=require(_0x67c9('0x4'));var fs=require('fs');var path=require(_0x67c9('0x5'));var rimraf=require(_0x67c9('0x6'));var config=require(_0x67c9('0x7'));var attributes=require(_0x67c9('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x157102,_0x21c50c){return _0x157102[_0x67c9('0x9')]('VtigerAccount',attributes,{'tableName':_0x67c9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21a2=['rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x15b7a0,_0x5c6b96){var _0x3da336=function(_0x4af0c7){while(--_0x4af0c7){_0x15b7a0['push'](_0x15b7a0['shift']());}};_0x3da336(++_0x5c6b96);}(_0x21a2,0xf8));var _0x221a=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x21a2[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x221a('0x0'));var util=require(_0x221a('0x1'));var logger=require('../../config/logger')(_0x221a('0x2'));var moment=require(_0x221a('0x3'));var BPromise=require(_0x221a('0x4'));var rp=require(_0x221a('0x5'));var fs=require('fs');var path=require(_0x221a('0x6'));var rimraf=require(_0x221a('0x7'));var config=require(_0x221a('0x8'));var attributes=require(_0x221a('0x9'));var integrations=require(_0x221a('0xa'));module[_0x221a('0xb')]=function(_0x127366,_0x2b4499){return _0x127366[_0x221a('0xc')](_0x221a('0xd'),attributes,{'tableName':_0x221a('0xe'),'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 fac02f9..3fcb189 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 _0x1a01=['VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','findAll','options','raw','attributes','limit','include','map','model','GetVtigerAccount','catch','ShowVtigerAccount','find','where','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x1a01,0x75));var _0x11a0=function(_0x25e603,_0x56f117){_0x25e603=_0x25e603-0x0;var _0x301b74=_0x1a01[_0x25e603];return _0x301b74;};'use strict';var _=require('lodash');var util=require(_0x11a0('0x0'));var moment=require(_0x11a0('0x1'));var BPromise=require('bluebird');var rs=require(_0x11a0('0x2'));var fs=require('fs');var Redis=require(_0x11a0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x11a0('0x4'));var logger=require('../../config/logger')(_0x11a0('0x5'));var config=require(_0x11a0('0x6'));var jayson=require(_0x11a0('0x7'));var client=jayson[_0x11a0('0x8')][_0x11a0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x137c4f,_0x2d035a,_0x49ee62){return new BPromise(function(_0x155eef,_0x2b2dc5){return client[_0x11a0('0xa')](_0x137c4f,_0x49ee62)[_0x11a0('0xb')](function(_0x4a57a9){logger[_0x11a0('0xc')](_0x11a0('0xd'),_0x2d035a,_0x11a0('0xe'));logger['debug'](_0x11a0('0xf'),_0x2d035a,'request\x20sent',JSON[_0x11a0('0x10')](_0x4a57a9));if(_0x4a57a9[_0x11a0('0x11')]){if(_0x4a57a9[_0x11a0('0x11')][_0x11a0('0x12')]===0x1f4){logger[_0x11a0('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x2d035a,_0x4a57a9['error'][_0x11a0('0x13')]);return _0x2b2dc5(_0x4a57a9['error'][_0x11a0('0x13')]);}logger[_0x11a0('0x11')](_0x11a0('0xd'),_0x2d035a,_0x4a57a9['error'][_0x11a0('0x13')]);return _0x155eef(_0x4a57a9[_0x11a0('0x11')][_0x11a0('0x13')]);}else{logger[_0x11a0('0xc')](_0x11a0('0xd'),_0x2d035a,_0x11a0('0xe'));_0x155eef(_0x4a57a9['result']['message']);}})['catch'](function(_0x42de9d){logger[_0x11a0('0x11')](_0x11a0('0xd'),_0x2d035a,_0x42de9d);_0x2b2dc5(_0x42de9d);});});}exports['GetVtigerAccount']=function(_0x48d92b){var _0x3bdde4=this;return new Promise(function(_0xd3d914,_0x10d3a9){return db['VtigerAccount'][_0x11a0('0x14')]({'raw':_0x48d92b[_0x11a0('0x15')]?_0x48d92b[_0x11a0('0x15')][_0x11a0('0x16')]===undefined?!![]:![]:!![],'where':_0x48d92b['options']?_0x48d92b['options']['where']||null:null,'attributes':_0x48d92b[_0x11a0('0x15')]?_0x48d92b['options'][_0x11a0('0x17')]||null:null,'limit':_0x48d92b[_0x11a0('0x15')]?_0x48d92b[_0x11a0('0x15')][_0x11a0('0x18')]||null:null,'include':_0x48d92b[_0x11a0('0x15')]?_0x48d92b[_0x11a0('0x15')][_0x11a0('0x19')]?_[_0x11a0('0x1a')](_0x48d92b['options']['include'],function(_0x27e67c){return{'model':db[_0x27e67c[_0x11a0('0x1b')]],'as':_0x27e67c['as'],'attributes':_0x27e67c[_0x11a0('0x17')],'include':_0x27e67c[_0x11a0('0x19')]?_[_0x11a0('0x1a')](_0x27e67c[_0x11a0('0x19')],function(_0x53f5ee){return{'model':db[_0x53f5ee[_0x11a0('0x1b')]],'as':_0x53f5ee['as'],'attributes':_0x53f5ee[_0x11a0('0x17')],'include':_0x53f5ee[_0x11a0('0x19')]?_[_0x11a0('0x1a')](_0x53f5ee[_0x11a0('0x19')],function(_0x4396f8){return{'model':db[_0x4396f8[_0x11a0('0x1b')]],'as':_0x4396f8['as'],'attributes':_0x4396f8[_0x11a0('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c24a2){logger[_0x11a0('0xc')](_0x11a0('0x1c'),_0x48d92b);logger['debug'](_0x11a0('0x1c'),_0x48d92b,JSON[_0x11a0('0x10')](_0x2c24a2));_0xd3d914(_0x2c24a2);})[_0x11a0('0x1d')](function(_0x334483){logger[_0x11a0('0x11')]('GetVtigerAccount',_0x334483['message'],_0x48d92b);_0x10d3a9(_0x3bdde4[_0x11a0('0x11')](0x1f4,_0x334483[_0x11a0('0x13')]));});});};exports[_0x11a0('0x1e')]=function(_0x353978){var _0x19ceda=this;return new Promise(function(_0x19b9cc,_0x10a8c0){return db['VtigerAccount'][_0x11a0('0x1f')]({'raw':_0x353978[_0x11a0('0x15')]?_0x353978[_0x11a0('0x15')][_0x11a0('0x16')]===undefined?!![]:![]:!![],'where':_0x353978[_0x11a0('0x15')]?_0x353978[_0x11a0('0x15')][_0x11a0('0x20')]||null:null,'attributes':_0x353978[_0x11a0('0x15')]?_0x353978['options']['attributes']||null:null,'include':_0x353978['options']?_0x353978[_0x11a0('0x15')][_0x11a0('0x19')]?_[_0x11a0('0x1a')](_0x353978[_0x11a0('0x15')][_0x11a0('0x19')],function(_0xf1cc0b){return{'model':db[_0xf1cc0b[_0x11a0('0x1b')]],'as':_0xf1cc0b['as'],'attributes':_0xf1cc0b['attributes'],'include':_0xf1cc0b['include']?_[_0x11a0('0x1a')](_0xf1cc0b['include'],function(_0xbf6e4){return{'model':db[_0xbf6e4[_0x11a0('0x1b')]],'as':_0xbf6e4['as'],'attributes':_0xbf6e4[_0x11a0('0x17')],'include':_0xbf6e4[_0x11a0('0x19')]?_[_0x11a0('0x1a')](_0xbf6e4[_0x11a0('0x19')],function(_0x1b7231){return{'model':db[_0x1b7231[_0x11a0('0x1b')]],'as':_0x1b7231['as'],'attributes':_0x1b7231[_0x11a0('0x17')]};}):[]};}):[]};}):[]:[]})[_0x11a0('0xb')](function(_0x1aea48){logger[_0x11a0('0xc')](_0x11a0('0x1e'),_0x353978);logger['debug'](_0x11a0('0x1e'),_0x353978,JSON[_0x11a0('0x10')](_0x1aea48));_0x19b9cc(_0x1aea48);})['catch'](function(_0x27f0ff){logger[_0x11a0('0x11')](_0x11a0('0x1e'),_0x27f0ff[_0x11a0('0x13')],_0x353978);_0x10a8c0(_0x19ceda[_0x11a0('0x11')](0x1f4,_0x27f0ff[_0x11a0('0x13')]));});});}; \ No newline at end of file +var _0x5c12=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetVtigerAccount','findAll','options','attributes','map','include','model','ShowVtigerAccount','find','raw','where','lodash','util'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0x5c12,0x1a2));var _0x25c1=function(_0xe2c95e,_0x3e6545){_0xe2c95e=_0xe2c95e-0x0;var _0x42ce6f=_0x5c12[_0xe2c95e];return _0x42ce6f;};'use strict';var _=require(_0x25c1('0x0'));var util=require(_0x25c1('0x1'));var moment=require(_0x25c1('0x2'));var BPromise=require(_0x25c1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x25c1('0x4'));var db=require(_0x25c1('0x5'))['db'];var utils=require(_0x25c1('0x6'));var logger=require(_0x25c1('0x7'))(_0x25c1('0x8'));var config=require(_0x25c1('0x9'));var jayson=require(_0x25c1('0xa'));var client=jayson['client'][_0x25c1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d7c4d,_0x2fe90c,_0x3c0f9c){return new BPromise(function(_0x4c7f09,_0xe6628d){return client['request'](_0x3d7c4d,_0x3c0f9c)[_0x25c1('0xc')](function(_0x4350f7){logger[_0x25c1('0xd')](_0x25c1('0xe'),_0x2fe90c,_0x25c1('0xf'));logger[_0x25c1('0x10')](_0x25c1('0x11'),_0x2fe90c,_0x25c1('0xf'),JSON[_0x25c1('0x12')](_0x4350f7));if(_0x4350f7['error']){if(_0x4350f7['error'][_0x25c1('0x13')]===0x1f4){logger[_0x25c1('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x2fe90c,_0x4350f7['error'][_0x25c1('0x15')]);return _0xe6628d(_0x4350f7[_0x25c1('0x14')]['message']);}logger[_0x25c1('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x2fe90c,_0x4350f7['error'][_0x25c1('0x15')]);return _0x4c7f09(_0x4350f7[_0x25c1('0x14')][_0x25c1('0x15')]);}else{logger[_0x25c1('0xd')](_0x25c1('0xe'),_0x2fe90c,_0x25c1('0xf'));_0x4c7f09(_0x4350f7[_0x25c1('0x16')][_0x25c1('0x15')]);}})[_0x25c1('0x17')](function(_0x488f8c){logger[_0x25c1('0x14')](_0x25c1('0xe'),_0x2fe90c,_0x488f8c);_0xe6628d(_0x488f8c);});});}exports[_0x25c1('0x18')]=function(_0x47e73e){var _0x112fb4=this;return new Promise(function(_0x553d7c,_0x28678d){return db['VtigerAccount'][_0x25c1('0x19')]({'raw':_0x47e73e['options']?_0x47e73e[_0x25c1('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x47e73e[_0x25c1('0x1a')]?_0x47e73e[_0x25c1('0x1a')]['where']||null:null,'attributes':_0x47e73e['options']?_0x47e73e[_0x25c1('0x1a')][_0x25c1('0x1b')]||null:null,'limit':_0x47e73e[_0x25c1('0x1a')]?_0x47e73e['options']['limit']||null:null,'include':_0x47e73e['options']?_0x47e73e[_0x25c1('0x1a')]['include']?_[_0x25c1('0x1c')](_0x47e73e[_0x25c1('0x1a')]['include'],function(_0x236a35){return{'model':db[_0x236a35['model']],'as':_0x236a35['as'],'attributes':_0x236a35['attributes'],'include':_0x236a35[_0x25c1('0x1d')]?_[_0x25c1('0x1c')](_0x236a35[_0x25c1('0x1d')],function(_0x1b12d7){return{'model':db[_0x1b12d7[_0x25c1('0x1e')]],'as':_0x1b12d7['as'],'attributes':_0x1b12d7[_0x25c1('0x1b')],'include':_0x1b12d7[_0x25c1('0x1d')]?_[_0x25c1('0x1c')](_0x1b12d7[_0x25c1('0x1d')],function(_0xce872d){return{'model':db[_0xce872d[_0x25c1('0x1e')]],'as':_0xce872d['as'],'attributes':_0xce872d[_0x25c1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x25c1('0xc')](function(_0x3f9e02){logger[_0x25c1('0xd')](_0x25c1('0x18'),_0x47e73e);logger['debug'](_0x25c1('0x18'),_0x47e73e,JSON['stringify'](_0x3f9e02));_0x553d7c(_0x3f9e02);})[_0x25c1('0x17')](function(_0x2ad670){logger[_0x25c1('0x14')](_0x25c1('0x18'),_0x2ad670[_0x25c1('0x15')],_0x47e73e);_0x28678d(_0x112fb4['error'](0x1f4,_0x2ad670[_0x25c1('0x15')]));});});};exports[_0x25c1('0x1f')]=function(_0x315d3d){var _0x588fdb=this;return new Promise(function(_0x1243f7,_0x2983d3){return db['VtigerAccount'][_0x25c1('0x20')]({'raw':_0x315d3d[_0x25c1('0x1a')]?_0x315d3d[_0x25c1('0x1a')][_0x25c1('0x21')]===undefined?!![]:![]:!![],'where':_0x315d3d[_0x25c1('0x1a')]?_0x315d3d[_0x25c1('0x1a')][_0x25c1('0x22')]||null:null,'attributes':_0x315d3d[_0x25c1('0x1a')]?_0x315d3d['options'][_0x25c1('0x1b')]||null:null,'include':_0x315d3d[_0x25c1('0x1a')]?_0x315d3d[_0x25c1('0x1a')][_0x25c1('0x1d')]?_[_0x25c1('0x1c')](_0x315d3d[_0x25c1('0x1a')][_0x25c1('0x1d')],function(_0x6170ec){return{'model':db[_0x6170ec[_0x25c1('0x1e')]],'as':_0x6170ec['as'],'attributes':_0x6170ec['attributes'],'include':_0x6170ec['include']?_['map'](_0x6170ec[_0x25c1('0x1d')],function(_0xee426b){return{'model':db[_0xee426b[_0x25c1('0x1e')]],'as':_0xee426b['as'],'attributes':_0xee426b[_0x25c1('0x1b')],'include':_0xee426b['include']?_[_0x25c1('0x1c')](_0xee426b[_0x25c1('0x1d')],function(_0x4f5e6a){return{'model':db[_0x4f5e6a[_0x25c1('0x1e')]],'as':_0x4f5e6a['as'],'attributes':_0x4f5e6a[_0x25c1('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c5f50){logger[_0x25c1('0xd')](_0x25c1('0x1f'),_0x315d3d);logger[_0x25c1('0x10')](_0x25c1('0x1f'),_0x315d3d,JSON[_0x25c1('0x12')](_0x4c5f50));_0x1243f7(_0x4c5f50);})[_0x25c1('0x17')](function(_0x242afd){logger[_0x25c1('0x14')](_0x25c1('0x1f'),_0x242afd[_0x25c1('0x15')],_0x315d3d);_0x2983d3(_0x588fdb[_0x25c1('0x14')](0x1f4,_0x242afd['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 3f822a6..78dddf0 100644 --- a/server/api/intVtigerConfiguration/index.js +++ b/server/api/intVtigerConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x153409,_0x133978){var _0x1b71a3=function(_0x3feea1){while(--_0x3feea1){_0x153409['push'](_0x153409['shift']());}};_0x1b71a3(++_0x133978);}(_0xb10b,0x12a));var _0xbb10=function(_0x3199af,_0x339560){_0x3199af=_0x3199af-0x0;var _0x5aa4d0=_0xb10b[_0x3199af];return _0x5aa4d0;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file +var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0xbeda41,_0x26ba7c){var _0x3637b8=function(_0x2ae016){while(--_0x2ae016){_0xbeda41['push'](_0xbeda41['shift']());}};_0x3637b8(++_0x26ba7c);}(_0xb10b,0x12a));var _0xbb10=function(_0x446e61,_0x27e680){_0x446e61=_0x446e61-0x0;var _0x4160a8=_0xb10b[_0x446e61];return _0x4160a8;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 6a07120..34cffdf 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 _0x9cd4=['STRING','exports'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0x9cd4,0xd9));var _0x49cd=function(_0x14a4d0,_0x4c7068){_0x14a4d0=_0x14a4d0-0x0;var _0x18c8ab=_0x9cd4[_0x14a4d0];return _0x18c8ab;};'use strict';var Sequelize=require('sequelize');module[_0x49cd('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x49cd('0x1')]}}; \ No newline at end of file +var _0x8af6=['exports','STRING'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x8af6,0xd6));var _0x68af=function(_0x19bff3,_0x173d8c){_0x19bff3=_0x19bff3-0x0;var _0x473b1c=_0x8af6[_0x19bff3];return _0x473b1c;};'use strict';var Sequelize=require('sequelize');module[_0x68af('0x0')]={'name':{'type':Sequelize[_0x68af('0x1')]},'description':{'type':Sequelize[_0x68af('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index a48d798..c1ed83f 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 _0x4141=['fields','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','rows','show','intersection','length','create','body','params','findOne','VtigerField','order','getFields','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0x2950d9,_0x12e7ba){var _0x11b3e6=function(_0x5893a4){while(--_0x5893a4){_0x2950d9['push'](_0x2950d9['shift']());}};_0x11b3e6(++_0x12e7ba);}(_0x4141,0x197));var _0x1414=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4141[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1414('0x0'));var rimraf=require(_0x1414('0x1'));var zipdir=require(_0x1414('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1414('0x3'));var moment=require('moment');var BPromise=require(_0x1414('0x4'));var Mustache=require(_0x1414('0x5'));var util=require(_0x1414('0x6'));var path=require(_0x1414('0x7'));var sox=require(_0x1414('0x8'));var csv=require(_0x1414('0x9'));var ejs=require(_0x1414('0xa'));var fs=require('fs');var _=require(_0x1414('0xb'));var squel=require(_0x1414('0xc'));var crypto=require('crypto');var jsforce=require(_0x1414('0xd'));var deskjs=require(_0x1414('0xe'));var toCsv=require(_0x1414('0x9'));var querystring=require(_0x1414('0xf'));var Papa=require(_0x1414('0x10'));var Redis=require(_0x1414('0x11'));var authService=require(_0x1414('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1414('0x13'));var hardwareService=require(_0x1414('0x14'));var logger=require(_0x1414('0x15'))(_0x1414('0x16'));var utils=require('../../config/utils');var config=require(_0x1414('0x17'));var db=require(_0x1414('0x18'))['db'];var jayson=require(_0x1414('0x19'));var client=jayson[_0x1414('0x1a')][_0x1414('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x3b80f2,_0x2e5736,_0x1bb5d1){if(_0x1bb5d1){var _0x8d36c3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x8d36c3[_0x1414('0x1c')](_0x2e5736)){return _0x3b80f2;}else{throw new db['Sequelize'][(_0x1414('0x1d'))](_0x1414('0x1e'));}}else{return _0x3b80f2;}}function respondWithRpcPromise(_0x2e71aa,_0x3e3c91,_0x386e8d,_0x1313cf){return new BPromise(function(_0x2c8201,_0x33d329){var _0x2acdfd=_0x1313cf||client;return _0x2acdfd[_0x1414('0x1f')](_0x2e71aa,_0x386e8d)['then'](function(_0x221ce6){logger[_0x1414('0x20')]('VtigerConfiguration,\x20%s,\x20%s',_0x3e3c91,_0x1414('0x21'));logger[_0x1414('0x22')](_0x1414('0x23'),_0x3e3c91,'request\x20sent',JSON['stringify'](_0x221ce6));if(_0x221ce6['error']){if(_0x221ce6[_0x1414('0x24')][_0x1414('0x25')]===0x1f4){logger['error'](_0x1414('0x26'),_0x3e3c91,_0x221ce6[_0x1414('0x24')][_0x1414('0x27')]);return _0x33d329(_0x221ce6[_0x1414('0x24')]['message']);}logger['error'](_0x1414('0x26'),_0x3e3c91,_0x221ce6[_0x1414('0x24')][_0x1414('0x27')]);return _0x2c8201(_0x221ce6[_0x1414('0x24')][_0x1414('0x27')]);}else{logger[_0x1414('0x20')](_0x1414('0x26'),_0x3e3c91,_0x1414('0x21'));_0x2c8201(_0x221ce6[_0x1414('0x28')][_0x1414('0x27')]);}})[_0x1414('0x29')](function(_0xfbd7ee){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x3e3c91,_0xfbd7ee);_0x33d329(_0xfbd7ee);});});}function respondWithStatusCode(_0x43829f,_0x589a65){_0x589a65=_0x589a65||0xcc;return function(_0x572b9c){if(_0x572b9c){return _0x43829f[_0x1414('0x2a')](_0x589a65);}return _0x43829f[_0x1414('0x2b')](_0x589a65)[_0x1414('0x2c')]();};}function respondWithResult(_0x15c25f,_0x1d523d){_0x1d523d=_0x1d523d||0xc8;return function(_0x5c69fd){if(_0x5c69fd){return _0x15c25f[_0x1414('0x2b')](_0x1d523d)['json'](_0x5c69fd);}};}function respondWithFilteredResult(_0x2ce6f8,_0x42225e){return function(_0x12c483){if(_0x12c483){var _0x33c9f6=_0x12c483['count'],_0x40e130=_0x42225e[_0x1414('0x2d')],_0x8badad=_0x42225e['offset']+_0x42225e['limit'],_0x1dd5e7;if(_0x8badad>=_0x33c9f6){_0x8badad=_0x33c9f6;_0x1dd5e7=0xc8;}else{_0x1dd5e7=0xce;}_0x2ce6f8[_0x1414('0x2b')](_0x1dd5e7);return _0x2ce6f8['set'](_0x1414('0x2e'),_0x40e130+'-'+_0x8badad+'/'+_0x33c9f6)['json'](_0x12c483);}return null;};}function patchUpdates(_0x52d2e1){return function(_0x252981){try{jsonpatch[_0x1414('0x2f')](_0x252981,_0x52d2e1,!![]);}catch(_0x362f1d){return BPromise[_0x1414('0x30')](_0x362f1d);}return _0x252981[_0x1414('0x31')]();};}function saveUpdates(_0x5bcd69,_0x3d79bd){return function(_0x3cf979){if(_0x3cf979){return _0x3cf979[_0x1414('0x32')](_0x5bcd69)[_0x1414('0x33')](function(_0x209030){return _0x209030;});}return null;};}function removeEntity(_0x3b53d3,_0x3871bc){return function(_0x3af0c9){if(_0x3af0c9){return _0x3af0c9[_0x1414('0x34')]()[_0x1414('0x33')](function(){_0x3b53d3[_0x1414('0x2b')](0xcc)[_0x1414('0x2c')]();});}};}function handleEntityNotFound(_0x29bdc7,_0x36d605){return function(_0x3f52e3){if(!_0x3f52e3){_0x29bdc7['sendStatus'](0x194);}return _0x3f52e3;};}function handleError(_0x5dbfec,_0xef09ba){_0xef09ba=_0xef09ba||0x1f4;return function(_0x336061){logger['error'](_0x336061[_0x1414('0x35')]);if(_0x336061[_0x1414('0x36')]){delete _0x336061['name'];}_0x5dbfec[_0x1414('0x2b')](_0xef09ba)[_0x1414('0x37')](_0x336061);};}exports[_0x1414('0x38')]=function(_0x4ffe2e,_0x3689ab){var _0x18c117={},_0x527c6c={},_0x55618c={'count':0x0,'rows':[]};var _0x5cbba8=_[_0x1414('0x39')](db[_0x1414('0x3a')][_0x1414('0x3b')],function(_0x5d78c0){return{'name':_0x5d78c0[_0x1414('0x3c')],'type':_0x5d78c0[_0x1414('0x3d')][_0x1414('0x3e')]};});_0x527c6c[_0x1414('0x3f')]=_[_0x1414('0x39')](_0x5cbba8,_0x1414('0x36'));_0x527c6c[_0x1414('0x40')]=_[_0x1414('0x41')](_0x4ffe2e[_0x1414('0x40')]);_0x527c6c[_0x1414('0x42')]=_['intersection'](_0x527c6c[_0x1414('0x3f')],_0x527c6c['query']);_0x18c117[_0x1414('0x43')]=_['intersection'](_0x527c6c[_0x1414('0x3f')],qs[_0x1414('0x44')](_0x4ffe2e[_0x1414('0x40')][_0x1414('0x44')]));_0x18c117['attributes']=_0x18c117['attributes']['length']?_0x18c117[_0x1414('0x43')]:_0x527c6c[_0x1414('0x3f')];if(!_0x4ffe2e[_0x1414('0x40')]['hasOwnProperty'](_0x1414('0x45'))){_0x18c117[_0x1414('0x46')]=qs[_0x1414('0x46')](_0x4ffe2e[_0x1414('0x40')][_0x1414('0x46')]);_0x18c117[_0x1414('0x2d')]=qs[_0x1414('0x2d')](_0x4ffe2e[_0x1414('0x40')][_0x1414('0x2d')]);}_0x18c117['order']=qs[_0x1414('0x47')](_0x4ffe2e[_0x1414('0x40')][_0x1414('0x47')]);_0x18c117[_0x1414('0x48')]=qs[_0x1414('0x42')](_[_0x1414('0x49')](_0x4ffe2e[_0x1414('0x40')],_0x527c6c[_0x1414('0x42')]),_0x5cbba8);if(_0x4ffe2e[_0x1414('0x40')][_0x1414('0x4a')]){_0x18c117[_0x1414('0x48')]=_['merge'](_0x18c117[_0x1414('0x48')],{'$or':_[_0x1414('0x39')](_0x5cbba8,function(_0x297c4e){if(_0x297c4e['type']!==_0x1414('0x4b')){var _0x3d6a50={};_0x3d6a50[_0x297c4e[_0x1414('0x36')]]={'$like':'%'+_0x4ffe2e['query']['filter']+'%'};return _0x3d6a50;}})});}_0x18c117=_[_0x1414('0x4c')]({},_0x18c117,_0x4ffe2e[_0x1414('0x4d')]);var _0x3a73f3={'where':_0x18c117['where']};return db[_0x1414('0x3a')]['count'](_0x3a73f3)[_0x1414('0x33')](function(_0x4c04f0){_0x55618c[_0x1414('0x4e')]=_0x4c04f0;if(_0x4ffe2e['query'][_0x1414('0x4f')]){_0x18c117[_0x1414('0x50')]=[{'all':!![]}];}return db[_0x1414('0x3a')]['findAll'](_0x18c117);})[_0x1414('0x33')](function(_0x42305f){_0x55618c[_0x1414('0x51')]=_0x42305f;return _0x55618c;})[_0x1414('0x33')](respondWithFilteredResult(_0x3689ab,_0x18c117))['catch'](handleError(_0x3689ab,null));};exports[_0x1414('0x52')]=function(_0x4ec7b1,_0x5ca5fe){var _0xd72c24={'raw':![],'where':{'id':_0x4ec7b1['params']['id']}},_0x330098={};_0x330098[_0x1414('0x3f')]=_[_0x1414('0x41')](db[_0x1414('0x3a')][_0x1414('0x3b')]);_0x330098[_0x1414('0x40')]=_[_0x1414('0x41')](_0x4ec7b1[_0x1414('0x40')]);_0x330098[_0x1414('0x42')]=_[_0x1414('0x53')](_0x330098[_0x1414('0x3f')],_0x330098[_0x1414('0x40')]);_0xd72c24[_0x1414('0x43')]=_['intersection'](_0x330098[_0x1414('0x3f')],qs[_0x1414('0x44')](_0x4ec7b1[_0x1414('0x40')][_0x1414('0x44')]));_0xd72c24['attributes']=_0xd72c24['attributes'][_0x1414('0x54')]?_0xd72c24['attributes']:_0x330098['model'];if(_0x4ec7b1[_0x1414('0x40')]['includeAll']){_0xd72c24['include']=[{'all':!![]}];}_0xd72c24=_['merge']({},_0xd72c24,_0x4ec7b1['options']);return db['VtigerConfiguration']['find'](_0xd72c24)[_0x1414('0x33')](handleEntityNotFound(_0x5ca5fe,null))['then'](respondWithResult(_0x5ca5fe,null))[_0x1414('0x29')](handleError(_0x5ca5fe,null));};exports[_0x1414('0x55')]=function(_0x7acd5d,_0x396163){return db[_0x1414('0x3a')][_0x1414('0x55')](_0x7acd5d['body'],{})[_0x1414('0x33')](respondWithResult(_0x396163,0xc9))['catch'](handleError(_0x396163,null));};exports['update']=function(_0x207935,_0x57e019){if(_0x207935[_0x1414('0x56')]['id']){delete _0x207935[_0x1414('0x56')]['id'];}return db[_0x1414('0x3a')]['find']({'where':{'id':_0x207935[_0x1414('0x57')]['id']}})[_0x1414('0x33')](handleEntityNotFound(_0x57e019,null))['then'](saveUpdates(_0x207935[_0x1414('0x56')],null))[_0x1414('0x33')](respondWithResult(_0x57e019,null))[_0x1414('0x29')](handleError(_0x57e019,null));};exports['destroy']=function(_0x3e14de,_0x66d324){return db[_0x1414('0x3a')]['find']({'where':{'id':_0x3e14de[_0x1414('0x57')]['id']}})[_0x1414('0x33')](handleEntityNotFound(_0x66d324,null))['then'](removeEntity(_0x66d324,null))['catch'](handleError(_0x66d324,null));};exports['getFields']=function(_0x22a4c5,_0x330c92,_0x36dac5){var _0x4909bc={};var _0x107483={};var _0x69e190;var _0x2f77d0;return db['VtigerConfiguration'][_0x1414('0x58')]({'where':{'id':_0x22a4c5[_0x1414('0x57')]['id']}})['then'](handleEntityNotFound(_0x330c92,null))[_0x1414('0x33')](function(_0x2e183f){if(_0x2e183f){_0x69e190=_0x2e183f;_0x107483[_0x1414('0x3f')]=_[_0x1414('0x41')](db[_0x1414('0x59')]['rawAttributes']);_0x107483[_0x1414('0x40')]=_[_0x1414('0x41')](_0x22a4c5['query']);_0x107483[_0x1414('0x42')]=_[_0x1414('0x53')](_0x107483['model'],_0x107483[_0x1414('0x40')]);_0x4909bc[_0x1414('0x43')]=_[_0x1414('0x53')](_0x107483[_0x1414('0x3f')],qs[_0x1414('0x44')](_0x22a4c5[_0x1414('0x40')][_0x1414('0x44')]));_0x4909bc[_0x1414('0x43')]=_0x4909bc['attributes'][_0x1414('0x54')]?_0x4909bc['attributes']:_0x107483[_0x1414('0x3f')];_0x4909bc[_0x1414('0x5a')]=qs[_0x1414('0x47')](_0x22a4c5[_0x1414('0x40')][_0x1414('0x47')]);_0x4909bc['where']=qs[_0x1414('0x42')](_[_0x1414('0x49')](_0x22a4c5[_0x1414('0x40')],_0x107483[_0x1414('0x42')]));if(_0x22a4c5[_0x1414('0x40')][_0x1414('0x4a')]){_0x4909bc[_0x1414('0x48')]=_[_0x1414('0x4c')](_0x4909bc[_0x1414('0x48')],{'$or':_[_0x1414('0x39')](_0x4909bc[_0x1414('0x43')],function(_0x34c4a5){var _0x388c13={};_0x388c13[_0x34c4a5]={'$like':'%'+_0x22a4c5['query']['filter']+'%'};return _0x388c13;})});}_0x4909bc=_['merge']({},_0x4909bc,_0x22a4c5[_0x1414('0x4d')]);return _0x69e190[_0x1414('0x5b')](_0x4909bc);}})[_0x1414('0x33')](function(_0x3f0a06){if(_0x3f0a06){_0x2f77d0=_0x3f0a06['length'];if(!_0x22a4c5[_0x1414('0x40')][_0x1414('0x5c')](_0x1414('0x45'))){_0x4909bc[_0x1414('0x46')]=qs[_0x1414('0x46')](_0x22a4c5[_0x1414('0x40')]['limit']);_0x4909bc[_0x1414('0x2d')]=qs[_0x1414('0x2d')](_0x22a4c5[_0x1414('0x40')][_0x1414('0x2d')]);}return _0x69e190['getFields'](_0x4909bc);}})[_0x1414('0x33')](function(_0x526e54){if(_0x526e54){return _0x526e54?{'count':_0x2f77d0,'rows':_0x526e54}:null;}})[_0x1414('0x33')](respondWithResult(_0x330c92,null))[_0x1414('0x29')](handleError(_0x330c92,null));};exports['getSubjects']=function(_0x5d8300,_0x474bae,_0x15a98d){var _0x19c2ff={};var _0x339351={};var _0x1f8479;var _0x1f7f67;return db[_0x1414('0x3a')]['findOne']({'where':{'id':_0x5d8300[_0x1414('0x57')]['id']}})['then'](handleEntityNotFound(_0x474bae,null))[_0x1414('0x33')](function(_0x4cb1ee){if(_0x4cb1ee){_0x1f8479=_0x4cb1ee;_0x339351['model']=_[_0x1414('0x41')](db[_0x1414('0x59')]['rawAttributes']);_0x339351['query']=_['keys'](_0x5d8300['query']);_0x339351['filters']=_[_0x1414('0x53')](_0x339351[_0x1414('0x3f')],_0x339351[_0x1414('0x40')]);_0x19c2ff['attributes']=_[_0x1414('0x53')](_0x339351[_0x1414('0x3f')],qs[_0x1414('0x44')](_0x5d8300['query']['fields']));_0x19c2ff[_0x1414('0x43')]=_0x19c2ff[_0x1414('0x43')][_0x1414('0x54')]?_0x19c2ff[_0x1414('0x43')]:_0x339351[_0x1414('0x3f')];_0x19c2ff[_0x1414('0x5a')]=qs[_0x1414('0x47')](_0x5d8300['query'][_0x1414('0x47')]);_0x19c2ff['where']=qs[_0x1414('0x42')](_['pick'](_0x5d8300[_0x1414('0x40')],_0x339351[_0x1414('0x42')]));if(_0x5d8300[_0x1414('0x40')][_0x1414('0x4a')]){_0x19c2ff['where']=_['merge'](_0x19c2ff['where'],{'$or':_[_0x1414('0x39')](_0x19c2ff[_0x1414('0x43')],function(_0x198276){var _0x9a7bf0={};_0x9a7bf0[_0x198276]={'$like':'%'+_0x5d8300[_0x1414('0x40')][_0x1414('0x4a')]+'%'};return _0x9a7bf0;})});}_0x19c2ff=_[_0x1414('0x4c')]({},_0x19c2ff,_0x5d8300['options']);return _0x1f8479[_0x1414('0x5d')](_0x19c2ff);}})[_0x1414('0x33')](function(_0x4c17a2){if(_0x4c17a2){_0x1f7f67=_0x4c17a2['length'];if(!_0x5d8300['query'][_0x1414('0x5c')]('nolimit')){_0x19c2ff[_0x1414('0x46')]=qs[_0x1414('0x46')](_0x5d8300['query'][_0x1414('0x46')]);_0x19c2ff['offset']=qs[_0x1414('0x2d')](_0x5d8300[_0x1414('0x40')][_0x1414('0x2d')]);}return _0x1f8479[_0x1414('0x5d')](_0x19c2ff);}})[_0x1414('0x33')](function(_0xab4d69){if(_0xab4d69){return _0xab4d69?{'count':_0x1f7f67,'rows':_0xab4d69}:null;}})['then'](respondWithResult(_0x474bae,null))[_0x1414('0x29')](handleError(_0x474bae,null));};exports['getDescriptions']=function(_0x35da6e,_0x219068,_0x2a208f){var _0x3459ef={};var _0x4d4deb={};var _0x1880dd;var _0x45b9a8;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x35da6e[_0x1414('0x57')]['id']}})[_0x1414('0x33')](handleEntityNotFound(_0x219068,null))[_0x1414('0x33')](function(_0x1ec6ad){if(_0x1ec6ad){_0x1880dd=_0x1ec6ad;_0x4d4deb[_0x1414('0x3f')]=_['keys'](db[_0x1414('0x59')]['rawAttributes']);_0x4d4deb[_0x1414('0x40')]=_['keys'](_0x35da6e['query']);_0x4d4deb[_0x1414('0x42')]=_[_0x1414('0x53')](_0x4d4deb['model'],_0x4d4deb[_0x1414('0x40')]);_0x3459ef['attributes']=_['intersection'](_0x4d4deb[_0x1414('0x3f')],qs['fields'](_0x35da6e[_0x1414('0x40')][_0x1414('0x44')]));_0x3459ef['attributes']=_0x3459ef['attributes']['length']?_0x3459ef[_0x1414('0x43')]:_0x4d4deb[_0x1414('0x3f')];_0x3459ef[_0x1414('0x5a')]=qs[_0x1414('0x47')](_0x35da6e['query'][_0x1414('0x47')]);_0x3459ef[_0x1414('0x48')]=qs[_0x1414('0x42')](_['pick'](_0x35da6e[_0x1414('0x40')],_0x4d4deb[_0x1414('0x42')]));if(_0x35da6e[_0x1414('0x40')][_0x1414('0x4a')]){_0x3459ef[_0x1414('0x48')]=_[_0x1414('0x4c')](_0x3459ef[_0x1414('0x48')],{'$or':_[_0x1414('0x39')](_0x3459ef[_0x1414('0x43')],function(_0x19cd85){var _0x34235d={};_0x34235d[_0x19cd85]={'$like':'%'+_0x35da6e[_0x1414('0x40')]['filter']+'%'};return _0x34235d;})});}_0x3459ef=_[_0x1414('0x4c')]({},_0x3459ef,_0x35da6e[_0x1414('0x4d')]);return _0x1880dd['getDescriptions'](_0x3459ef);}})[_0x1414('0x33')](function(_0xf03fa6){if(_0xf03fa6){_0x45b9a8=_0xf03fa6[_0x1414('0x54')];if(!_0x35da6e[_0x1414('0x40')][_0x1414('0x5c')](_0x1414('0x45'))){_0x3459ef['limit']=qs[_0x1414('0x46')](_0x35da6e[_0x1414('0x40')][_0x1414('0x46')]);_0x3459ef[_0x1414('0x2d')]=qs[_0x1414('0x2d')](_0x35da6e['query']['offset']);}return _0x1880dd[_0x1414('0x5e')](_0x3459ef);}})[_0x1414('0x33')](function(_0x197006){if(_0x197006){return _0x197006?{'count':_0x45b9a8,'rows':_0x197006}:null;}})[_0x1414('0x33')](respondWithResult(_0x219068,null))[_0x1414('0x29')](handleError(_0x219068,null));}; \ No newline at end of file +var _0xb945=['findOne','VtigerField','order','getSubjects','pick','getDescriptions','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','VtigerConfiguration','rawAttributes','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','create','body','destroy','getFields'];(function(_0x2cdebe,_0x476f93){var _0x33a6ec=function(_0x3273d7){while(--_0x3273d7){_0x2cdebe['push'](_0x2cdebe['shift']());}};_0x33a6ec(++_0x476f93);}(_0xb945,0x120));var _0x5b94=function(_0x503c5c,_0x38e24d){_0x503c5c=_0x503c5c-0x0;var _0x894667=_0xb945[_0x503c5c];return _0x894667;};'use strict';var pdf=require(_0x5b94('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5b94('0x1'));var zipdir=require(_0x5b94('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5b94('0x3'));var moment=require(_0x5b94('0x4'));var BPromise=require(_0x5b94('0x5'));var Mustache=require(_0x5b94('0x6'));var util=require(_0x5b94('0x7'));var path=require(_0x5b94('0x8'));var sox=require('sox');var csv=require(_0x5b94('0x9'));var ejs=require(_0x5b94('0xa'));var fs=require('fs');var _=require(_0x5b94('0xb'));var squel=require(_0x5b94('0xc'));var crypto=require(_0x5b94('0xd'));var jsforce=require(_0x5b94('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5b94('0x9'));var querystring=require(_0x5b94('0xf'));var Papa=require(_0x5b94('0x10'));var Redis=require(_0x5b94('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5b94('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5b94('0x13'));var logger=require(_0x5b94('0x14'))(_0x5b94('0x15'));var utils=require(_0x5b94('0x16'));var config=require('../../config/environment');var db=require(_0x5b94('0x17'))['db'];var jayson=require(_0x5b94('0x18'));var client=jayson[_0x5b94('0x19')][_0x5b94('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x15b021,_0x1e1083,_0x54a9b0){if(_0x54a9b0){var _0x2babae=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2babae[_0x5b94('0x1b')](_0x1e1083)){return _0x15b021;}else{throw new db[(_0x5b94('0x1c'))]['ValidationError'](_0x5b94('0x1d'));}}else{return _0x15b021;}}function respondWithRpcPromise(_0x6aae31,_0x39c47b,_0x387d16,_0x1f8589){return new BPromise(function(_0x4efecf,_0x46bfaa){var _0x126f6e=_0x1f8589||client;return _0x126f6e['request'](_0x6aae31,_0x387d16)['then'](function(_0x212d98){logger['info'](_0x5b94('0x1e'),_0x39c47b,'request\x20sent');logger[_0x5b94('0x1f')](_0x5b94('0x20'),_0x39c47b,'request\x20sent',JSON[_0x5b94('0x21')](_0x212d98));if(_0x212d98[_0x5b94('0x22')]){if(_0x212d98[_0x5b94('0x22')][_0x5b94('0x23')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x39c47b,_0x212d98[_0x5b94('0x22')][_0x5b94('0x24')]);return _0x46bfaa(_0x212d98[_0x5b94('0x22')][_0x5b94('0x24')]);}logger[_0x5b94('0x22')]('VtigerConfiguration,\x20%s,\x20%s',_0x39c47b,_0x212d98[_0x5b94('0x22')][_0x5b94('0x24')]);return _0x4efecf(_0x212d98[_0x5b94('0x22')][_0x5b94('0x24')]);}else{logger['info'](_0x5b94('0x1e'),_0x39c47b,_0x5b94('0x25'));_0x4efecf(_0x212d98['result'][_0x5b94('0x24')]);}})[_0x5b94('0x26')](function(_0x2af526){logger[_0x5b94('0x22')](_0x5b94('0x1e'),_0x39c47b,_0x2af526);_0x46bfaa(_0x2af526);});});}function respondWithStatusCode(_0x1567d3,_0x20ee89){_0x20ee89=_0x20ee89||0xcc;return function(_0x168548){if(_0x168548){return _0x1567d3[_0x5b94('0x27')](_0x20ee89);}return _0x1567d3[_0x5b94('0x28')](_0x20ee89)[_0x5b94('0x29')]();};}function respondWithResult(_0x587075,_0x5d445a){_0x5d445a=_0x5d445a||0xc8;return function(_0xb8d786){if(_0xb8d786){return _0x587075[_0x5b94('0x28')](_0x5d445a)[_0x5b94('0x2a')](_0xb8d786);}};}function respondWithFilteredResult(_0x3eeaff,_0x3b571d){return function(_0x301e6d){if(_0x301e6d){var _0x1a325c=_0x301e6d[_0x5b94('0x2b')],_0x39444e=_0x3b571d[_0x5b94('0x2c')],_0x45665a=_0x3b571d[_0x5b94('0x2c')]+_0x3b571d[_0x5b94('0x2d')],_0x576712;if(_0x45665a>=_0x1a325c){_0x45665a=_0x1a325c;_0x576712=0xc8;}else{_0x576712=0xce;}_0x3eeaff[_0x5b94('0x28')](_0x576712);return _0x3eeaff[_0x5b94('0x2e')](_0x5b94('0x2f'),_0x39444e+'-'+_0x45665a+'/'+_0x1a325c)['json'](_0x301e6d);}return null;};}function patchUpdates(_0x521f62){return function(_0x34fb5e){try{jsonpatch[_0x5b94('0x30')](_0x34fb5e,_0x521f62,!![]);}catch(_0x3e236b){return BPromise[_0x5b94('0x31')](_0x3e236b);}return _0x34fb5e[_0x5b94('0x32')]();};}function saveUpdates(_0x5af0ce,_0xcb9410){return function(_0x1f9a71){if(_0x1f9a71){return _0x1f9a71[_0x5b94('0x33')](_0x5af0ce)[_0x5b94('0x34')](function(_0x4581b4){return _0x4581b4;});}return null;};}function removeEntity(_0x37b37d,_0x2b9921){return function(_0x5907e4){if(_0x5907e4){return _0x5907e4['destroy']()[_0x5b94('0x34')](function(){_0x37b37d['status'](0xcc)[_0x5b94('0x29')]();});}};}function handleEntityNotFound(_0x21377d,_0x10bc87){return function(_0x59dd86){if(!_0x59dd86){_0x21377d[_0x5b94('0x27')](0x194);}return _0x59dd86;};}function handleError(_0x1c9aa1,_0x4864fb){_0x4864fb=_0x4864fb||0x1f4;return function(_0x433ef9){logger[_0x5b94('0x22')](_0x433ef9[_0x5b94('0x35')]);if(_0x433ef9[_0x5b94('0x36')]){delete _0x433ef9['name'];}_0x1c9aa1[_0x5b94('0x28')](_0x4864fb)[_0x5b94('0x37')](_0x433ef9);};}exports[_0x5b94('0x38')]=function(_0x4b29c6,_0x28c940){var _0x5cccda={},_0x125629={},_0x4578d3={'count':0x0,'rows':[]};var _0x2b7b87=_[_0x5b94('0x39')](db[_0x5b94('0x3a')][_0x5b94('0x3b')],function(_0x15fe37){return{'name':_0x15fe37['fieldName'],'type':_0x15fe37[_0x5b94('0x3c')]['key']};});_0x125629[_0x5b94('0x3d')]=_[_0x5b94('0x39')](_0x2b7b87,_0x5b94('0x36'));_0x125629[_0x5b94('0x3e')]=_[_0x5b94('0x3f')](_0x4b29c6[_0x5b94('0x3e')]);_0x125629['filters']=_['intersection'](_0x125629[_0x5b94('0x3d')],_0x125629[_0x5b94('0x3e')]);_0x5cccda[_0x5b94('0x40')]=_[_0x5b94('0x41')](_0x125629[_0x5b94('0x3d')],qs[_0x5b94('0x42')](_0x4b29c6[_0x5b94('0x3e')][_0x5b94('0x42')]));_0x5cccda[_0x5b94('0x40')]=_0x5cccda['attributes'][_0x5b94('0x43')]?_0x5cccda['attributes']:_0x125629[_0x5b94('0x3d')];if(!_0x4b29c6[_0x5b94('0x3e')][_0x5b94('0x44')](_0x5b94('0x45'))){_0x5cccda[_0x5b94('0x2d')]=qs[_0x5b94('0x2d')](_0x4b29c6['query'][_0x5b94('0x2d')]);_0x5cccda[_0x5b94('0x2c')]=qs[_0x5b94('0x2c')](_0x4b29c6[_0x5b94('0x3e')]['offset']);}_0x5cccda['order']=qs[_0x5b94('0x46')](_0x4b29c6[_0x5b94('0x3e')][_0x5b94('0x46')]);_0x5cccda['where']=qs[_0x5b94('0x47')](_['pick'](_0x4b29c6['query'],_0x125629['filters']),_0x2b7b87);if(_0x4b29c6[_0x5b94('0x3e')][_0x5b94('0x48')]){_0x5cccda[_0x5b94('0x49')]=_[_0x5b94('0x4a')](_0x5cccda[_0x5b94('0x49')],{'$or':_[_0x5b94('0x39')](_0x2b7b87,function(_0x14ddd4){if(_0x14ddd4[_0x5b94('0x3c')]!==_0x5b94('0x4b')){var _0x3019ce={};_0x3019ce[_0x14ddd4[_0x5b94('0x36')]]={'$like':'%'+_0x4b29c6[_0x5b94('0x3e')][_0x5b94('0x48')]+'%'};return _0x3019ce;}})});}_0x5cccda=_[_0x5b94('0x4a')]({},_0x5cccda,_0x4b29c6[_0x5b94('0x4c')]);var _0x469d43={'where':_0x5cccda[_0x5b94('0x49')]};return db[_0x5b94('0x3a')][_0x5b94('0x2b')](_0x469d43)[_0x5b94('0x34')](function(_0x3d652f){_0x4578d3[_0x5b94('0x2b')]=_0x3d652f;if(_0x4b29c6['query']['includeAll']){_0x5cccda[_0x5b94('0x4d')]=[{'all':!![]}];}return db[_0x5b94('0x3a')][_0x5b94('0x4e')](_0x5cccda);})[_0x5b94('0x34')](function(_0x4e913e){_0x4578d3[_0x5b94('0x4f')]=_0x4e913e;return _0x4578d3;})[_0x5b94('0x34')](respondWithFilteredResult(_0x28c940,_0x5cccda))[_0x5b94('0x26')](handleError(_0x28c940,null));};exports[_0x5b94('0x50')]=function(_0x1be9c5,_0x39ef14){var _0x2583d1={'raw':![],'where':{'id':_0x1be9c5[_0x5b94('0x51')]['id']}},_0xe89946={};_0xe89946['model']=_[_0x5b94('0x3f')](db['VtigerConfiguration']['rawAttributes']);_0xe89946[_0x5b94('0x3e')]=_[_0x5b94('0x3f')](_0x1be9c5[_0x5b94('0x3e')]);_0xe89946[_0x5b94('0x47')]=_['intersection'](_0xe89946[_0x5b94('0x3d')],_0xe89946['query']);_0x2583d1[_0x5b94('0x40')]=_['intersection'](_0xe89946[_0x5b94('0x3d')],qs[_0x5b94('0x42')](_0x1be9c5[_0x5b94('0x3e')][_0x5b94('0x42')]));_0x2583d1[_0x5b94('0x40')]=_0x2583d1[_0x5b94('0x40')]['length']?_0x2583d1[_0x5b94('0x40')]:_0xe89946[_0x5b94('0x3d')];if(_0x1be9c5[_0x5b94('0x3e')][_0x5b94('0x52')]){_0x2583d1[_0x5b94('0x4d')]=[{'all':!![]}];}_0x2583d1=_[_0x5b94('0x4a')]({},_0x2583d1,_0x1be9c5[_0x5b94('0x4c')]);return db[_0x5b94('0x3a')][_0x5b94('0x53')](_0x2583d1)[_0x5b94('0x34')](handleEntityNotFound(_0x39ef14,null))['then'](respondWithResult(_0x39ef14,null))[_0x5b94('0x26')](handleError(_0x39ef14,null));};exports[_0x5b94('0x54')]=function(_0x30a38c,_0x8a9cf){return db[_0x5b94('0x3a')][_0x5b94('0x54')](_0x30a38c[_0x5b94('0x55')],{})[_0x5b94('0x34')](respondWithResult(_0x8a9cf,0xc9))['catch'](handleError(_0x8a9cf,null));};exports[_0x5b94('0x33')]=function(_0x39b1b4,_0x144783){if(_0x39b1b4[_0x5b94('0x55')]['id']){delete _0x39b1b4['body']['id'];}return db[_0x5b94('0x3a')][_0x5b94('0x53')]({'where':{'id':_0x39b1b4['params']['id']}})[_0x5b94('0x34')](handleEntityNotFound(_0x144783,null))[_0x5b94('0x34')](saveUpdates(_0x39b1b4[_0x5b94('0x55')],null))[_0x5b94('0x34')](respondWithResult(_0x144783,null))[_0x5b94('0x26')](handleError(_0x144783,null));};exports[_0x5b94('0x56')]=function(_0x387b8a,_0x34899e){return db[_0x5b94('0x3a')]['find']({'where':{'id':_0x387b8a[_0x5b94('0x51')]['id']}})[_0x5b94('0x34')](handleEntityNotFound(_0x34899e,null))[_0x5b94('0x34')](removeEntity(_0x34899e,null))['catch'](handleError(_0x34899e,null));};exports[_0x5b94('0x57')]=function(_0x175387,_0xedf7ae,_0x2d0875){var _0x1ec18a={};var _0x35570e={};var _0x592833;var _0x3c1edf;return db[_0x5b94('0x3a')][_0x5b94('0x58')]({'where':{'id':_0x175387[_0x5b94('0x51')]['id']}})[_0x5b94('0x34')](handleEntityNotFound(_0xedf7ae,null))['then'](function(_0x4557b5){if(_0x4557b5){_0x592833=_0x4557b5;_0x35570e[_0x5b94('0x3d')]=_[_0x5b94('0x3f')](db[_0x5b94('0x59')][_0x5b94('0x3b')]);_0x35570e[_0x5b94('0x3e')]=_[_0x5b94('0x3f')](_0x175387[_0x5b94('0x3e')]);_0x35570e[_0x5b94('0x47')]=_['intersection'](_0x35570e['model'],_0x35570e[_0x5b94('0x3e')]);_0x1ec18a[_0x5b94('0x40')]=_['intersection'](_0x35570e[_0x5b94('0x3d')],qs[_0x5b94('0x42')](_0x175387[_0x5b94('0x3e')][_0x5b94('0x42')]));_0x1ec18a['attributes']=_0x1ec18a[_0x5b94('0x40')][_0x5b94('0x43')]?_0x1ec18a[_0x5b94('0x40')]:_0x35570e[_0x5b94('0x3d')];_0x1ec18a[_0x5b94('0x5a')]=qs[_0x5b94('0x46')](_0x175387[_0x5b94('0x3e')][_0x5b94('0x46')]);_0x1ec18a[_0x5b94('0x49')]=qs[_0x5b94('0x47')](_['pick'](_0x175387[_0x5b94('0x3e')],_0x35570e[_0x5b94('0x47')]));if(_0x175387[_0x5b94('0x3e')][_0x5b94('0x48')]){_0x1ec18a[_0x5b94('0x49')]=_[_0x5b94('0x4a')](_0x1ec18a[_0x5b94('0x49')],{'$or':_[_0x5b94('0x39')](_0x1ec18a[_0x5b94('0x40')],function(_0x5b36a0){var _0x54578f={};_0x54578f[_0x5b36a0]={'$like':'%'+_0x175387[_0x5b94('0x3e')][_0x5b94('0x48')]+'%'};return _0x54578f;})});}_0x1ec18a=_[_0x5b94('0x4a')]({},_0x1ec18a,_0x175387['options']);return _0x592833['getFields'](_0x1ec18a);}})['then'](function(_0x40a5ad){if(_0x40a5ad){_0x3c1edf=_0x40a5ad[_0x5b94('0x43')];if(!_0x175387[_0x5b94('0x3e')]['hasOwnProperty']('nolimit')){_0x1ec18a[_0x5b94('0x2d')]=qs['limit'](_0x175387['query'][_0x5b94('0x2d')]);_0x1ec18a[_0x5b94('0x2c')]=qs['offset'](_0x175387[_0x5b94('0x3e')]['offset']);}return _0x592833[_0x5b94('0x57')](_0x1ec18a);}})['then'](function(_0x1428fe){if(_0x1428fe){return _0x1428fe?{'count':_0x3c1edf,'rows':_0x1428fe}:null;}})['then'](respondWithResult(_0xedf7ae,null))['catch'](handleError(_0xedf7ae,null));};exports[_0x5b94('0x5b')]=function(_0x326e75,_0x348ae1,_0x12f888){var _0x34a05e={};var _0x5ef1b6={};var _0x15be7f;var _0xf93941;return db[_0x5b94('0x3a')]['findOne']({'where':{'id':_0x326e75['params']['id']}})[_0x5b94('0x34')](handleEntityNotFound(_0x348ae1,null))[_0x5b94('0x34')](function(_0x39baf1){if(_0x39baf1){_0x15be7f=_0x39baf1;_0x5ef1b6[_0x5b94('0x3d')]=_[_0x5b94('0x3f')](db[_0x5b94('0x59')][_0x5b94('0x3b')]);_0x5ef1b6[_0x5b94('0x3e')]=_[_0x5b94('0x3f')](_0x326e75['query']);_0x5ef1b6[_0x5b94('0x47')]=_[_0x5b94('0x41')](_0x5ef1b6[_0x5b94('0x3d')],_0x5ef1b6[_0x5b94('0x3e')]);_0x34a05e[_0x5b94('0x40')]=_[_0x5b94('0x41')](_0x5ef1b6[_0x5b94('0x3d')],qs['fields'](_0x326e75[_0x5b94('0x3e')][_0x5b94('0x42')]));_0x34a05e[_0x5b94('0x40')]=_0x34a05e[_0x5b94('0x40')][_0x5b94('0x43')]?_0x34a05e[_0x5b94('0x40')]:_0x5ef1b6['model'];_0x34a05e[_0x5b94('0x5a')]=qs[_0x5b94('0x46')](_0x326e75[_0x5b94('0x3e')][_0x5b94('0x46')]);_0x34a05e[_0x5b94('0x49')]=qs[_0x5b94('0x47')](_[_0x5b94('0x5c')](_0x326e75[_0x5b94('0x3e')],_0x5ef1b6[_0x5b94('0x47')]));if(_0x326e75[_0x5b94('0x3e')]['filter']){_0x34a05e[_0x5b94('0x49')]=_[_0x5b94('0x4a')](_0x34a05e[_0x5b94('0x49')],{'$or':_[_0x5b94('0x39')](_0x34a05e[_0x5b94('0x40')],function(_0x464800){var _0x7703f4={};_0x7703f4[_0x464800]={'$like':'%'+_0x326e75[_0x5b94('0x3e')][_0x5b94('0x48')]+'%'};return _0x7703f4;})});}_0x34a05e=_[_0x5b94('0x4a')]({},_0x34a05e,_0x326e75['options']);return _0x15be7f[_0x5b94('0x5b')](_0x34a05e);}})[_0x5b94('0x34')](function(_0x48fdb7){if(_0x48fdb7){_0xf93941=_0x48fdb7[_0x5b94('0x43')];if(!_0x326e75[_0x5b94('0x3e')][_0x5b94('0x44')](_0x5b94('0x45'))){_0x34a05e['limit']=qs[_0x5b94('0x2d')](_0x326e75['query'][_0x5b94('0x2d')]);_0x34a05e[_0x5b94('0x2c')]=qs[_0x5b94('0x2c')](_0x326e75[_0x5b94('0x3e')][_0x5b94('0x2c')]);}return _0x15be7f[_0x5b94('0x5b')](_0x34a05e);}})[_0x5b94('0x34')](function(_0x32edc6){if(_0x32edc6){return _0x32edc6?{'count':_0xf93941,'rows':_0x32edc6}:null;}})['then'](respondWithResult(_0x348ae1,null))[_0x5b94('0x26')](handleError(_0x348ae1,null));};exports['getDescriptions']=function(_0x1e421b,_0x2970fc,_0x45e953){var _0x5dc501={};var _0x314858={};var _0x132fea;var _0x3e6eec;return db[_0x5b94('0x3a')][_0x5b94('0x58')]({'where':{'id':_0x1e421b[_0x5b94('0x51')]['id']}})[_0x5b94('0x34')](handleEntityNotFound(_0x2970fc,null))[_0x5b94('0x34')](function(_0x1441e3){if(_0x1441e3){_0x132fea=_0x1441e3;_0x314858[_0x5b94('0x3d')]=_[_0x5b94('0x3f')](db[_0x5b94('0x59')][_0x5b94('0x3b')]);_0x314858[_0x5b94('0x3e')]=_['keys'](_0x1e421b['query']);_0x314858[_0x5b94('0x47')]=_[_0x5b94('0x41')](_0x314858[_0x5b94('0x3d')],_0x314858['query']);_0x5dc501[_0x5b94('0x40')]=_[_0x5b94('0x41')](_0x314858[_0x5b94('0x3d')],qs['fields'](_0x1e421b[_0x5b94('0x3e')][_0x5b94('0x42')]));_0x5dc501[_0x5b94('0x40')]=_0x5dc501[_0x5b94('0x40')][_0x5b94('0x43')]?_0x5dc501['attributes']:_0x314858['model'];_0x5dc501[_0x5b94('0x5a')]=qs['sort'](_0x1e421b[_0x5b94('0x3e')][_0x5b94('0x46')]);_0x5dc501[_0x5b94('0x49')]=qs[_0x5b94('0x47')](_[_0x5b94('0x5c')](_0x1e421b['query'],_0x314858[_0x5b94('0x47')]));if(_0x1e421b[_0x5b94('0x3e')][_0x5b94('0x48')]){_0x5dc501['where']=_[_0x5b94('0x4a')](_0x5dc501[_0x5b94('0x49')],{'$or':_[_0x5b94('0x39')](_0x5dc501[_0x5b94('0x40')],function(_0x17ee32){var _0x560f9c={};_0x560f9c[_0x17ee32]={'$like':'%'+_0x1e421b['query']['filter']+'%'};return _0x560f9c;})});}_0x5dc501=_['merge']({},_0x5dc501,_0x1e421b[_0x5b94('0x4c')]);return _0x132fea[_0x5b94('0x5d')](_0x5dc501);}})[_0x5b94('0x34')](function(_0xbb5365){if(_0xbb5365){_0x3e6eec=_0xbb5365[_0x5b94('0x43')];if(!_0x1e421b[_0x5b94('0x3e')]['hasOwnProperty'](_0x5b94('0x45'))){_0x5dc501[_0x5b94('0x2d')]=qs[_0x5b94('0x2d')](_0x1e421b[_0x5b94('0x3e')]['limit']);_0x5dc501[_0x5b94('0x2c')]=qs[_0x5b94('0x2c')](_0x1e421b[_0x5b94('0x3e')]['offset']);}return _0x132fea['getDescriptions'](_0x5dc501);}})[_0x5b94('0x34')](function(_0x3221e6){if(_0x3221e6){return _0x3221e6?{'count':_0x3e6eec,'rows':_0x3221e6}:null;}})[_0x5b94('0x34')](respondWithResult(_0x2970fc,null))[_0x5b94('0x26')](handleError(_0x2970fc,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index dbb2114..ba4333a 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 _0x3460=['../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','lodash','../../config/logger','moment','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3460,0x13b));var _0x0346=function(_0x64d5a9,_0x2f188a){_0x64d5a9=_0x64d5a9-0x0;var _0x4c9521=_0x3460[_0x64d5a9];return _0x4c9521;};'use strict';var _=require(_0x0346('0x0'));var util=require('util');var logger=require(_0x0346('0x1'))('api');var moment=require(_0x0346('0x2'));var BPromise=require('bluebird');var rp=require(_0x0346('0x3'));var fs=require('fs');var path=require(_0x0346('0x4'));var rimraf=require('rimraf');var config=require(_0x0346('0x5'));var attributes=require(_0x0346('0x6'));module['exports']=function(_0x2bd6f3,_0x1a932d){return _0x2bd6f3[_0x0346('0x7')](_0x0346('0x8'),attributes,{'tableName':_0x0346('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1a1=['path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api'];(function(_0x493bda,_0x459212){var _0x40615a=function(_0x5a1aa6){while(--_0x5a1aa6){_0x493bda['push'](_0x493bda['shift']());}};_0x40615a(++_0x459212);}(_0xe1a1,0xa6));var _0x1e1a=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xe1a1[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x1e1a('0x0'));var util=require(_0x1e1a('0x1'));var logger=require(_0x1e1a('0x2'))(_0x1e1a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e1a('0x4'));var rimraf=require(_0x1e1a('0x5'));var config=require(_0x1e1a('0x6'));var attributes=require(_0x1e1a('0x7'));module['exports']=function(_0x4197b1,_0x1639e0){return _0x4197b1['define'](_0x1e1a('0x8'),attributes,{'tableName':_0x1e1a('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 1ebb08f..cf38e1b 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 _0x0378=['rpc','../../config/environment','jayson/promise','http','info','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x33c717,_0xdae8d2){var _0x395d10=function(_0x319d28){while(--_0x319d28){_0x33c717['push'](_0x33c717['shift']());}};_0x395d10(++_0xdae8d2);}(_0x0378,0xfd));var _0x8037=function(_0x315496,_0x33917e){_0x315496=_0x315496-0x0;var _0x348287=_0x0378[_0x315496];return _0x348287;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8037('0x0'));var BPromise=require(_0x8037('0x1'));var rs=require(_0x8037('0x2'));var fs=require('fs');var Redis=require(_0x8037('0x3'));var db=require(_0x8037('0x4'))['db'];var utils=require(_0x8037('0x5'));var logger=require(_0x8037('0x6'))(_0x8037('0x7'));var config=require(_0x8037('0x8'));var jayson=require(_0x8037('0x9'));var client=jayson['client'][_0x8037('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc8ed52,_0x43d67d,_0x594bd1){return new BPromise(function(_0x59f0a5,_0x3e94be){return client['request'](_0xc8ed52,_0x594bd1)['then'](function(_0x1ca81d){logger[_0x8037('0xb')](_0x8037('0xc'),_0x43d67d,'request\x20sent');logger[_0x8037('0xd')](_0x8037('0xe'),_0x43d67d,_0x8037('0xf'),JSON['stringify'](_0x1ca81d));if(_0x1ca81d['error']){if(_0x1ca81d[_0x8037('0x10')][_0x8037('0x11')]===0x1f4){logger[_0x8037('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x43d67d,_0x1ca81d[_0x8037('0x10')][_0x8037('0x12')]);return _0x3e94be(_0x1ca81d[_0x8037('0x10')]['message']);}logger[_0x8037('0x10')](_0x8037('0xc'),_0x43d67d,_0x1ca81d[_0x8037('0x10')][_0x8037('0x12')]);return _0x59f0a5(_0x1ca81d[_0x8037('0x10')][_0x8037('0x12')]);}else{logger[_0x8037('0xb')](_0x8037('0xc'),_0x43d67d,_0x8037('0xf'));_0x59f0a5(_0x1ca81d[_0x8037('0x13')]['message']);}})['catch'](function(_0x28271b){logger[_0x8037('0x10')](_0x8037('0xc'),_0x43d67d,_0x28271b);_0x3e94be(_0x28271b);});});} \ No newline at end of file +var _0x9d3d=['VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x57bb05,_0x3b64fc){var _0x2a1cb1=function(_0x2c63e1){while(--_0x2c63e1){_0x57bb05['push'](_0x57bb05['shift']());}};_0x2a1cb1(++_0x3b64fc);}(_0x9d3d,0x1a4));var _0xd9d3=function(_0xe71b01,_0x354f02){_0xe71b01=_0xe71b01-0x0;var _0x32d60c=_0x9d3d[_0xe71b01];return _0x32d60c;};'use strict';var _=require(_0xd9d3('0x0'));var util=require(_0xd9d3('0x1'));var moment=require(_0xd9d3('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9d3('0x3'));var fs=require('fs');var Redis=require(_0xd9d3('0x4'));var db=require(_0xd9d3('0x5'))['db'];var utils=require(_0xd9d3('0x6'));var logger=require(_0xd9d3('0x7'))('rpc');var config=require(_0xd9d3('0x8'));var jayson=require(_0xd9d3('0x9'));var client=jayson['client'][_0xd9d3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4554a5,_0x19fba9,_0x33bd98){return new BPromise(function(_0x264c67,_0x3fa81c){return client[_0xd9d3('0xb')](_0x4554a5,_0x33bd98)[_0xd9d3('0xc')](function(_0x7f8e69){logger[_0xd9d3('0xd')](_0xd9d3('0xe'),_0x19fba9,_0xd9d3('0xf'));logger[_0xd9d3('0x10')](_0xd9d3('0x11'),_0x19fba9,_0xd9d3('0xf'),JSON[_0xd9d3('0x12')](_0x7f8e69));if(_0x7f8e69[_0xd9d3('0x13')]){if(_0x7f8e69['error'][_0xd9d3('0x14')]===0x1f4){logger[_0xd9d3('0x13')](_0xd9d3('0xe'),_0x19fba9,_0x7f8e69[_0xd9d3('0x13')]['message']);return _0x3fa81c(_0x7f8e69['error'][_0xd9d3('0x15')]);}logger['error'](_0xd9d3('0xe'),_0x19fba9,_0x7f8e69[_0xd9d3('0x13')][_0xd9d3('0x15')]);return _0x264c67(_0x7f8e69[_0xd9d3('0x13')][_0xd9d3('0x15')]);}else{logger[_0xd9d3('0xd')](_0xd9d3('0xe'),_0x19fba9,'request\x20sent');_0x264c67(_0x7f8e69[_0xd9d3('0x16')]['message']);}})['catch'](function(_0x31ff32){logger[_0xd9d3('0x13')](_0xd9d3('0xe'),_0x19fba9,_0x31ff32);_0x3fa81c(_0x31ff32);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 16a63ed..0be15a2 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 _0xe6b2=['update','delete','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','create','put'];(function(_0xf5bd9a,_0x5a0bfb){var _0x30f9ee=function(_0x31d035){while(--_0x31d035){_0xf5bd9a['push'](_0xf5bd9a['shift']());}};_0x30f9ee(++_0x5a0bfb);}(_0xe6b2,0x1c4));var _0x2e6b=function(_0x4a8e76,_0x399c03){_0x4a8e76=_0x4a8e76-0x0;var _0x50546c=_0xe6b2[_0x4a8e76];return _0x50546c;};'use strict';var multer=require('multer');var util=require(_0x2e6b('0x0'));var path=require(_0x2e6b('0x1'));var timeout=require(_0x2e6b('0x2'));var express=require(_0x2e6b('0x3'));var router=express[_0x2e6b('0x4')]();var auth=require(_0x2e6b('0x5'));var interaction=require(_0x2e6b('0x6'));var config=require(_0x2e6b('0x7'));var controller=require(_0x2e6b('0x8'));router[_0x2e6b('0x9')]('/',auth[_0x2e6b('0xa')](),controller[_0x2e6b('0xb')]);router[_0x2e6b('0x9')](_0x2e6b('0xc'),auth[_0x2e6b('0xa')](),controller[_0x2e6b('0xd')]);router['post']('/',auth[_0x2e6b('0xa')](),controller[_0x2e6b('0xe')]);router[_0x2e6b('0xf')]('/:id',auth[_0x2e6b('0xa')](),controller[_0x2e6b('0x10')]);router[_0x2e6b('0x11')](_0x2e6b('0xc'),auth[_0x2e6b('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x794d=['delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','/:id','isAuthenticated','post','create','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x794d,0x17d));var _0xd794=function(_0x33f2fa,_0x1411d5){_0x33f2fa=_0x33f2fa-0x0;var _0xe5b3b3=_0x794d[_0x33f2fa];return _0xe5b3b3;};'use strict';var multer=require('multer');var util=require(_0xd794('0x0'));var path=require(_0xd794('0x1'));var timeout=require(_0xd794('0x2'));var express=require(_0xd794('0x3'));var router=express[_0xd794('0x4')]();var auth=require(_0xd794('0x5'));var interaction=require(_0xd794('0x6'));var config=require(_0xd794('0x7'));var controller=require(_0xd794('0x8'));router[_0xd794('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd794('0x9')](_0xd794('0xa'),auth[_0xd794('0xb')](),controller['show']);router[_0xd794('0xc')]('/',auth[_0xd794('0xb')](),controller[_0xd794('0xd')]);router['put'](_0xd794('0xa'),auth[_0xd794('0xb')](),controller[_0xd794('0xe')]);router[_0xd794('0xf')](_0xd794('0xa'),auth[_0xd794('0xb')](),controller[_0xd794('0x10')]);module[_0xd794('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index ecc6f1a..bc94ba8 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 _0xac47=['exports','ENUM','string','variable','customVariable','STRING','BOOLEAN','sequelize'];(function(_0x4b89e3,_0x134229){var _0x4c4c50=function(_0x37beae){while(--_0x37beae){_0x4b89e3['push'](_0x4b89e3['shift']());}};_0x4c4c50(++_0x134229);}(_0xac47,0x1af));var _0x7ac4=function(_0x4b5f1f,_0x1fee93){_0x4b5f1f=_0x4b5f1f-0x0;var _0x3bb747=_0xac47[_0x4b5f1f];return _0x3bb747;};'use strict';var Sequelize=require(_0x7ac4('0x0'));module[_0x7ac4('0x1')]={'type':{'type':Sequelize[_0x7ac4('0x2')](_0x7ac4('0x3'),_0x7ac4('0x4'),_0x7ac4('0x5'),'keyValue'),'defaultValue':_0x7ac4('0x3')},'content':{'type':Sequelize[_0x7ac4('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7ac4('0x2')](_0x7ac4('0x3'),_0x7ac4('0x4'),_0x7ac4('0x5'))},'keyContent':{'type':Sequelize[_0x7ac4('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7ac4('0x6')]},'customField':{'type':Sequelize[_0x7ac4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7ac4('0x6')]}}; \ No newline at end of file +var _0x8734=['customVariable','STRING','sequelize','ENUM','string','variable'];(function(_0x3cd5e6,_0x3400d8){var _0x567671=function(_0xb77110){while(--_0xb77110){_0x3cd5e6['push'](_0x3cd5e6['shift']());}};_0x567671(++_0x3400d8);}(_0x8734,0x134));var _0x4873=function(_0x3ad737,_0x300131){_0x3ad737=_0x3ad737-0x0;var _0x16c1e2=_0x8734[_0x3ad737];return _0x16c1e2;};'use strict';var Sequelize=require(_0x4873('0x0'));module['exports']={'type':{'type':Sequelize[_0x4873('0x1')](_0x4873('0x2'),_0x4873('0x3'),_0x4873('0x4'),'keyValue'),'defaultValue':_0x4873('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4873('0x5')]},'keyType':{'type':Sequelize[_0x4873('0x1')]('string',_0x4873('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4873('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4873('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 4b4244d..252467c 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 _0x62e4=['moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','map','VtigerField','rawAttributes','fieldName','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x62e4,0x12b));var _0x462e=function(_0x314d43,_0x3ef57b){_0x314d43=_0x314d43-0x0;var _0x2870f4=_0x62e4[_0x314d43];return _0x2870f4;};'use strict';var pdf=require(_0x462e('0x0'));var emlformat=require(_0x462e('0x1'));var rimraf=require(_0x462e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x462e('0x3'));var rp=require(_0x462e('0x4'));var moment=require(_0x462e('0x5'));var BPromise=require(_0x462e('0x6'));var Mustache=require(_0x462e('0x7'));var util=require(_0x462e('0x8'));var path=require(_0x462e('0x9'));var sox=require(_0x462e('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x462e('0xb'));var squel=require(_0x462e('0xc'));var crypto=require(_0x462e('0xd'));var jsforce=require(_0x462e('0xe'));var deskjs=require(_0x462e('0xf'));var toCsv=require('to-csv');var querystring=require(_0x462e('0x10'));var Papa=require('papaparse');var Redis=require(_0x462e('0x11'));var authService=require(_0x462e('0x12'));var qs=require(_0x462e('0x13'));var as=require(_0x462e('0x14'));var hardwareService=require(_0x462e('0x15'));var logger=require(_0x462e('0x16'))(_0x462e('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x462e('0x18'))['db'];function respondWithStatusCode(_0xc20217,_0x29ccc9){_0x29ccc9=_0x29ccc9||0xcc;return function(_0x4d8590){if(_0x4d8590){return _0xc20217['sendStatus'](_0x29ccc9);}return _0xc20217[_0x462e('0x19')](_0x29ccc9)['end']();};}function respondWithResult(_0x5f3d1b,_0x2330dd){_0x2330dd=_0x2330dd||0xc8;return function(_0x560fc0){if(_0x560fc0){return _0x5f3d1b[_0x462e('0x19')](_0x2330dd)[_0x462e('0x1a')](_0x560fc0);}};}function respondWithFilteredResult(_0xda189e,_0x2c4e47){return function(_0x253cb4){if(_0x253cb4){var _0x19da97=_0x253cb4[_0x462e('0x1b')],_0x5d9466=_0x2c4e47[_0x462e('0x1c')],_0x5c344c=_0x2c4e47[_0x462e('0x1c')]+_0x2c4e47[_0x462e('0x1d')],_0x3d8f83;if(_0x5c344c>=_0x19da97){_0x5c344c=_0x19da97;_0x3d8f83=0xc8;}else{_0x3d8f83=0xce;}_0xda189e['status'](_0x3d8f83);return _0xda189e[_0x462e('0x1e')](_0x462e('0x1f'),_0x5d9466+'-'+_0x5c344c+'/'+_0x19da97)[_0x462e('0x1a')](_0x253cb4);}return null;};}function patchUpdates(_0x524cc8){return function(_0x3b8182){try{jsonpatch[_0x462e('0x20')](_0x3b8182,_0x524cc8,!![]);}catch(_0x59551a){return BPromise[_0x462e('0x21')](_0x59551a);}return _0x3b8182[_0x462e('0x22')]();};}function saveUpdates(_0x55101d,_0x5a3393){return function(_0x287410){if(_0x287410){return _0x287410[_0x462e('0x23')](_0x55101d)[_0x462e('0x24')](function(_0x5086e5){return _0x5086e5;});}return null;};}function removeEntity(_0x57c3e0,_0x44615c){return function(_0x2d7906){if(_0x2d7906){return _0x2d7906[_0x462e('0x25')]()['then'](function(){_0x57c3e0['status'](0xcc)[_0x462e('0x26')]();});}};}function handleEntityNotFound(_0x2b0a80,_0x292fc8){return function(_0xf24517){if(!_0xf24517){_0x2b0a80[_0x462e('0x27')](0x194);}return _0xf24517;};}function handleError(_0x5ee25b,_0x36209f){_0x36209f=_0x36209f||0x1f4;return function(_0x57733f){logger[_0x462e('0x28')](_0x57733f['stack']);if(_0x57733f[_0x462e('0x29')]){delete _0x57733f['name'];}_0x5ee25b[_0x462e('0x19')](_0x36209f)[_0x462e('0x2a')](_0x57733f);};}exports['index']=function(_0x20601e,_0xf74972){var _0x33f652={},_0x575467={},_0x3898ec={'count':0x0,'rows':[]};var _0x28d4e6=_[_0x462e('0x2b')](db[_0x462e('0x2c')][_0x462e('0x2d')],function(_0x633c45){return{'name':_0x633c45[_0x462e('0x2e')],'type':_0x633c45['type'][_0x462e('0x2f')]};});_0x575467['model']=_[_0x462e('0x2b')](_0x28d4e6,_0x462e('0x29'));_0x575467[_0x462e('0x30')]=_['keys'](_0x20601e[_0x462e('0x30')]);_0x575467[_0x462e('0x31')]=_['intersection'](_0x575467[_0x462e('0x32')],_0x575467[_0x462e('0x30')]);_0x33f652[_0x462e('0x33')]=_[_0x462e('0x34')](_0x575467['model'],qs[_0x462e('0x35')](_0x20601e[_0x462e('0x30')][_0x462e('0x35')]));_0x33f652['attributes']=_0x33f652['attributes'][_0x462e('0x36')]?_0x33f652[_0x462e('0x33')]:_0x575467[_0x462e('0x32')];if(!_0x20601e[_0x462e('0x30')][_0x462e('0x37')](_0x462e('0x38'))){_0x33f652[_0x462e('0x1d')]=qs[_0x462e('0x1d')](_0x20601e[_0x462e('0x30')][_0x462e('0x1d')]);_0x33f652[_0x462e('0x1c')]=qs[_0x462e('0x1c')](_0x20601e[_0x462e('0x30')][_0x462e('0x1c')]);}_0x33f652['order']=qs[_0x462e('0x39')](_0x20601e[_0x462e('0x30')]['sort']);_0x33f652[_0x462e('0x3a')]=qs['filters'](_[_0x462e('0x3b')](_0x20601e[_0x462e('0x30')],_0x575467[_0x462e('0x31')]),_0x28d4e6);if(_0x20601e[_0x462e('0x30')][_0x462e('0x3c')]){_0x33f652[_0x462e('0x3a')]=_[_0x462e('0x3d')](_0x33f652[_0x462e('0x3a')],{'$or':_['map'](_0x28d4e6,function(_0x1c690a){if(_0x1c690a[_0x462e('0x3e')]!==_0x462e('0x3f')){var _0x280d37={};_0x280d37[_0x1c690a[_0x462e('0x29')]]={'$like':'%'+_0x20601e[_0x462e('0x30')]['filter']+'%'};return _0x280d37;}})});}_0x33f652=_[_0x462e('0x3d')]({},_0x33f652,_0x20601e['options']);var _0x592883={'where':_0x33f652[_0x462e('0x3a')]};return db['VtigerField'][_0x462e('0x1b')](_0x592883)['then'](function(_0x163c14){_0x3898ec[_0x462e('0x1b')]=_0x163c14;if(_0x20601e['query'][_0x462e('0x40')]){_0x33f652[_0x462e('0x41')]=[{'all':!![]}];}return db[_0x462e('0x2c')][_0x462e('0x42')](_0x33f652);})['then'](function(_0x487759){_0x3898ec[_0x462e('0x43')]=_0x487759;return _0x3898ec;})[_0x462e('0x24')](respondWithFilteredResult(_0xf74972,_0x33f652))[_0x462e('0x44')](handleError(_0xf74972,null));};exports[_0x462e('0x45')]=function(_0x1f93f8,_0x1b6325){var _0x40fbbb={'raw':!![],'where':{'id':_0x1f93f8[_0x462e('0x46')]['id']}},_0x17888d={};_0x17888d[_0x462e('0x32')]=_[_0x462e('0x47')](db[_0x462e('0x2c')][_0x462e('0x2d')]);_0x17888d[_0x462e('0x30')]=_[_0x462e('0x47')](_0x1f93f8[_0x462e('0x30')]);_0x17888d[_0x462e('0x31')]=_['intersection'](_0x17888d[_0x462e('0x32')],_0x17888d[_0x462e('0x30')]);_0x40fbbb[_0x462e('0x33')]=_['intersection'](_0x17888d[_0x462e('0x32')],qs['fields'](_0x1f93f8['query']['fields']));_0x40fbbb[_0x462e('0x33')]=_0x40fbbb[_0x462e('0x33')][_0x462e('0x36')]?_0x40fbbb[_0x462e('0x33')]:_0x17888d[_0x462e('0x32')];if(_0x1f93f8[_0x462e('0x30')][_0x462e('0x40')]){_0x40fbbb[_0x462e('0x41')]=[{'all':!![]}];}_0x40fbbb=_[_0x462e('0x3d')]({},_0x40fbbb,_0x1f93f8[_0x462e('0x48')]);return db[_0x462e('0x2c')][_0x462e('0x49')](_0x40fbbb)[_0x462e('0x24')](handleEntityNotFound(_0x1b6325,null))[_0x462e('0x24')](respondWithResult(_0x1b6325,null))['catch'](handleError(_0x1b6325,null));};exports[_0x462e('0x4a')]=function(_0x1346e6,_0x2f7336){return db[_0x462e('0x2c')]['create'](_0x1346e6[_0x462e('0x4b')],{})[_0x462e('0x24')](respondWithResult(_0x2f7336,0xc9))['catch'](handleError(_0x2f7336,null));};exports[_0x462e('0x23')]=function(_0x364e3c,_0x44b7e9){if(_0x364e3c[_0x462e('0x4b')]['id']){delete _0x364e3c[_0x462e('0x4b')]['id'];}return db[_0x462e('0x2c')][_0x462e('0x49')]({'where':{'id':_0x364e3c[_0x462e('0x46')]['id']}})[_0x462e('0x24')](handleEntityNotFound(_0x44b7e9,null))['then'](saveUpdates(_0x364e3c[_0x462e('0x4b')],null))['then'](respondWithResult(_0x44b7e9,null))['catch'](handleError(_0x44b7e9,null));};exports[_0x462e('0x25')]=function(_0x4f3ddb,_0x5219b8){return db[_0x462e('0x2c')][_0x462e('0x49')]({'where':{'id':_0x4f3ddb['params']['id']}})[_0x462e('0x24')](handleEntityNotFound(_0x5219b8,null))[_0x462e('0x24')](removeEntity(_0x5219b8,null))['catch'](handleError(_0x5219b8,null));}; \ No newline at end of file +var _0xa0ad=['rimraf','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','sendStatus','status','end','json','offset','limit','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','VtigerField','count','rows','includeAll','find','catch','create','body','params','destroy','html-pdf','eml-format'];(function(_0x2827d2,_0x5e4c47){var _0x306e07=function(_0x2130dc){while(--_0x2130dc){_0x2827d2['push'](_0x2827d2['shift']());}};_0x306e07(++_0x5e4c47);}(_0xa0ad,0x14d));var _0xda0a=function(_0xea343d,_0x311197){_0xea343d=_0xea343d-0x0;var _0x2c6e9c=_0xa0ad[_0xea343d];return _0x2c6e9c;};'use strict';var pdf=require(_0xda0a('0x0'));var emlformat=require(_0xda0a('0x1'));var rimraf=require(_0xda0a('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda0a('0x3'));var rp=require(_0xda0a('0x4'));var moment=require(_0xda0a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xda0a('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xda0a('0x7'));var ejs=require(_0xda0a('0x8'));var fs=require('fs');var _=require(_0xda0a('0x9'));var squel=require(_0xda0a('0xa'));var crypto=require(_0xda0a('0xb'));var jsforce=require(_0xda0a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xda0a('0x7'));var querystring=require(_0xda0a('0xd'));var Papa=require(_0xda0a('0xe'));var Redis=require(_0xda0a('0xf'));var authService=require(_0xda0a('0x10'));var qs=require(_0xda0a('0x11'));var as=require(_0xda0a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xda0a('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10a850,_0x46d59c){_0x46d59c=_0x46d59c||0xcc;return function(_0x2354c9){if(_0x2354c9){return _0x10a850[_0xda0a('0x14')](_0x46d59c);}return _0x10a850[_0xda0a('0x15')](_0x46d59c)[_0xda0a('0x16')]();};}function respondWithResult(_0x4644a1,_0xeece82){_0xeece82=_0xeece82||0xc8;return function(_0x3f37e2){if(_0x3f37e2){return _0x4644a1['status'](_0xeece82)[_0xda0a('0x17')](_0x3f37e2);}};}function respondWithFilteredResult(_0x20a9d2,_0x10d6db){return function(_0x3855fb){if(_0x3855fb){var _0xf8c5b7=_0x3855fb['count'],_0x22bd0f=_0x10d6db[_0xda0a('0x18')],_0x4d2757=_0x10d6db[_0xda0a('0x18')]+_0x10d6db[_0xda0a('0x19')],_0x2d4fed;if(_0x4d2757>=_0xf8c5b7){_0x4d2757=_0xf8c5b7;_0x2d4fed=0xc8;}else{_0x2d4fed=0xce;}_0x20a9d2['status'](_0x2d4fed);return _0x20a9d2['set'](_0xda0a('0x1a'),_0x22bd0f+'-'+_0x4d2757+'/'+_0xf8c5b7)[_0xda0a('0x17')](_0x3855fb);}return null;};}function patchUpdates(_0x449294){return function(_0x3d968a){try{jsonpatch[_0xda0a('0x1b')](_0x3d968a,_0x449294,!![]);}catch(_0x2fa84a){return BPromise['reject'](_0x2fa84a);}return _0x3d968a[_0xda0a('0x1c')]();};}function saveUpdates(_0x134c19,_0x50d32a){return function(_0x1ca7fb){if(_0x1ca7fb){return _0x1ca7fb[_0xda0a('0x1d')](_0x134c19)['then'](function(_0x5b6280){return _0x5b6280;});}return null;};}function removeEntity(_0x289afb,_0x428921){return function(_0x1dc1cd){if(_0x1dc1cd){return _0x1dc1cd['destroy']()[_0xda0a('0x1e')](function(){_0x289afb[_0xda0a('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ec418,_0x4a8254){return function(_0x38e34d){if(!_0x38e34d){_0x3ec418[_0xda0a('0x14')](0x194);}return _0x38e34d;};}function handleError(_0x141079,_0x16ba50){_0x16ba50=_0x16ba50||0x1f4;return function(_0x5def8f){logger[_0xda0a('0x1f')](_0x5def8f[_0xda0a('0x20')]);if(_0x5def8f[_0xda0a('0x21')]){delete _0x5def8f[_0xda0a('0x21')];}_0x141079[_0xda0a('0x15')](_0x16ba50)[_0xda0a('0x22')](_0x5def8f);};}exports[_0xda0a('0x23')]=function(_0x41b26a,_0x53fe90){var _0x42b52a={},_0x57d4bf={},_0x2e04ee={'count':0x0,'rows':[]};var _0x582a14=_[_0xda0a('0x24')](db['VtigerField'][_0xda0a('0x25')],function(_0x5f4593){return{'name':_0x5f4593[_0xda0a('0x26')],'type':_0x5f4593['type'][_0xda0a('0x27')]};});_0x57d4bf[_0xda0a('0x28')]=_[_0xda0a('0x24')](_0x582a14,_0xda0a('0x21'));_0x57d4bf['query']=_[_0xda0a('0x29')](_0x41b26a[_0xda0a('0x2a')]);_0x57d4bf[_0xda0a('0x2b')]=_['intersection'](_0x57d4bf[_0xda0a('0x28')],_0x57d4bf['query']);_0x42b52a[_0xda0a('0x2c')]=_[_0xda0a('0x2d')](_0x57d4bf[_0xda0a('0x28')],qs[_0xda0a('0x2e')](_0x41b26a[_0xda0a('0x2a')][_0xda0a('0x2e')]));_0x42b52a['attributes']=_0x42b52a[_0xda0a('0x2c')][_0xda0a('0x2f')]?_0x42b52a[_0xda0a('0x2c')]:_0x57d4bf[_0xda0a('0x28')];if(!_0x41b26a[_0xda0a('0x2a')][_0xda0a('0x30')](_0xda0a('0x31'))){_0x42b52a['limit']=qs[_0xda0a('0x19')](_0x41b26a[_0xda0a('0x2a')][_0xda0a('0x19')]);_0x42b52a['offset']=qs[_0xda0a('0x18')](_0x41b26a['query'][_0xda0a('0x18')]);}_0x42b52a[_0xda0a('0x32')]=qs['sort'](_0x41b26a[_0xda0a('0x2a')][_0xda0a('0x33')]);_0x42b52a[_0xda0a('0x34')]=qs['filters'](_[_0xda0a('0x35')](_0x41b26a[_0xda0a('0x2a')],_0x57d4bf[_0xda0a('0x2b')]),_0x582a14);if(_0x41b26a[_0xda0a('0x2a')]['filter']){_0x42b52a['where']=_[_0xda0a('0x36')](_0x42b52a[_0xda0a('0x34')],{'$or':_[_0xda0a('0x24')](_0x582a14,function(_0x1f9eca){if(_0x1f9eca['type']!=='VIRTUAL'){var _0x5b3fb7={};_0x5b3fb7[_0x1f9eca[_0xda0a('0x21')]]={'$like':'%'+_0x41b26a[_0xda0a('0x2a')][_0xda0a('0x37')]+'%'};return _0x5b3fb7;}})});}_0x42b52a=_[_0xda0a('0x36')]({},_0x42b52a,_0x41b26a[_0xda0a('0x38')]);var _0x48f6ad={'where':_0x42b52a[_0xda0a('0x34')]};return db[_0xda0a('0x39')][_0xda0a('0x3a')](_0x48f6ad)[_0xda0a('0x1e')](function(_0x14e2bb){_0x2e04ee[_0xda0a('0x3a')]=_0x14e2bb;if(_0x41b26a['query']['includeAll']){_0x42b52a['include']=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x42b52a);})['then'](function(_0x27acf6){_0x2e04ee[_0xda0a('0x3b')]=_0x27acf6;return _0x2e04ee;})[_0xda0a('0x1e')](respondWithFilteredResult(_0x53fe90,_0x42b52a))['catch'](handleError(_0x53fe90,null));};exports['show']=function(_0x51abb3,_0x38e94b){var _0x175864={'raw':!![],'where':{'id':_0x51abb3['params']['id']}},_0x727f6={};_0x727f6[_0xda0a('0x28')]=_[_0xda0a('0x29')](db[_0xda0a('0x39')][_0xda0a('0x25')]);_0x727f6['query']=_[_0xda0a('0x29')](_0x51abb3[_0xda0a('0x2a')]);_0x727f6['filters']=_[_0xda0a('0x2d')](_0x727f6[_0xda0a('0x28')],_0x727f6[_0xda0a('0x2a')]);_0x175864[_0xda0a('0x2c')]=_['intersection'](_0x727f6[_0xda0a('0x28')],qs['fields'](_0x51abb3['query'][_0xda0a('0x2e')]));_0x175864[_0xda0a('0x2c')]=_0x175864[_0xda0a('0x2c')][_0xda0a('0x2f')]?_0x175864[_0xda0a('0x2c')]:_0x727f6[_0xda0a('0x28')];if(_0x51abb3[_0xda0a('0x2a')][_0xda0a('0x3c')]){_0x175864['include']=[{'all':!![]}];}_0x175864=_[_0xda0a('0x36')]({},_0x175864,_0x51abb3['options']);return db[_0xda0a('0x39')][_0xda0a('0x3d')](_0x175864)[_0xda0a('0x1e')](handleEntityNotFound(_0x38e94b,null))[_0xda0a('0x1e')](respondWithResult(_0x38e94b,null))[_0xda0a('0x3e')](handleError(_0x38e94b,null));};exports[_0xda0a('0x3f')]=function(_0x21fbdd,_0x1afb16){return db[_0xda0a('0x39')][_0xda0a('0x3f')](_0x21fbdd['body'],{})[_0xda0a('0x1e')](respondWithResult(_0x1afb16,0xc9))[_0xda0a('0x3e')](handleError(_0x1afb16,null));};exports[_0xda0a('0x1d')]=function(_0xb93326,_0x42f63a){if(_0xb93326[_0xda0a('0x40')]['id']){delete _0xb93326[_0xda0a('0x40')]['id'];}return db[_0xda0a('0x39')][_0xda0a('0x3d')]({'where':{'id':_0xb93326[_0xda0a('0x41')]['id']}})[_0xda0a('0x1e')](handleEntityNotFound(_0x42f63a,null))['then'](saveUpdates(_0xb93326[_0xda0a('0x40')],null))['then'](respondWithResult(_0x42f63a,null))[_0xda0a('0x3e')](handleError(_0x42f63a,null));};exports[_0xda0a('0x42')]=function(_0x4df65d,_0x3dab3f){return db[_0xda0a('0x39')][_0xda0a('0x3d')]({'where':{'id':_0x4df65d[_0xda0a('0x41')]['id']}})['then'](handleEntityNotFound(_0x3dab3f,null))[_0xda0a('0x1e')](removeEntity(_0x3dab3f,null))['catch'](handleError(_0x3dab3f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 6c9a09f..0b35a98 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 _0x9c44=['VtigerField','int_vtiger_fields','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','./intVtigerField.attributes','define'];(function(_0xfaaf83,_0x52efe9){var _0x10f1a3=function(_0x10975f){while(--_0x10975f){_0xfaaf83['push'](_0xfaaf83['shift']());}};_0x10f1a3(++_0x52efe9);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'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 fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x49c4('0xa'),_0x49c4('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','VtigerField','idField','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports'];(function(_0x42b7b4,_0x1e0f4e){var _0xd17514=function(_0x1f8201){while(--_0x1f8201){_0x42b7b4['push'](_0x42b7b4['shift']());}};_0xd17514(++_0x1e0f4e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x0a9e('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index f239cf1..58565ba 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 _0x38c9=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x894b5,_0x1759d0){var _0x230767=function(_0x5fad3a){while(--_0x5fad3a){_0x894b5['push'](_0x894b5['shift']());}};_0x230767(++_0x1759d0);}(_0x38c9,0x199));var _0x938c=function(_0x5c6299,_0x11bd28){_0x5c6299=_0x5c6299-0x0;var _0x23b564=_0x38c9[_0x5c6299];return _0x23b564;};'use strict';var _=require(_0x938c('0x0'));var util=require(_0x938c('0x1'));var moment=require(_0x938c('0x2'));var BPromise=require('bluebird');var rs=require(_0x938c('0x3'));var fs=require('fs');var Redis=require(_0x938c('0x4'));var db=require(_0x938c('0x5'))['db'];var utils=require(_0x938c('0x6'));var logger=require('../../config/logger')(_0x938c('0x7'));var config=require(_0x938c('0x8'));var jayson=require(_0x938c('0x9'));var client=jayson[_0x938c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x283d42,_0x332b40,_0x412b77){return new BPromise(function(_0x2dd9f4,_0x4aa9a5){return client['request'](_0x283d42,_0x412b77)[_0x938c('0xb')](function(_0x706ab){logger[_0x938c('0xc')](_0x938c('0xd'),_0x332b40,_0x938c('0xe'));logger[_0x938c('0xf')](_0x938c('0x10'),_0x332b40,_0x938c('0xe'),JSON[_0x938c('0x11')](_0x706ab));if(_0x706ab[_0x938c('0x12')]){if(_0x706ab[_0x938c('0x12')][_0x938c('0x13')]===0x1f4){logger[_0x938c('0x12')](_0x938c('0xd'),_0x332b40,_0x706ab[_0x938c('0x12')]['message']);return _0x4aa9a5(_0x706ab[_0x938c('0x12')]['message']);}logger[_0x938c('0x12')](_0x938c('0xd'),_0x332b40,_0x706ab[_0x938c('0x12')]['message']);return _0x2dd9f4(_0x706ab[_0x938c('0x12')][_0x938c('0x14')]);}else{logger['info'](_0x938c('0xd'),_0x332b40,_0x938c('0xe'));_0x2dd9f4(_0x706ab[_0x938c('0x15')][_0x938c('0x14')]);}})[_0x938c('0x16')](function(_0x5b5858){logger[_0x938c('0x12')](_0x938c('0xd'),_0x332b40,_0x5b5858);_0x4aa9a5(_0x5b5858);});});} \ No newline at end of file +var _0x1f81=['message','result','catch','lodash','util','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','stringify','error','code'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x1f81,0xab));var _0x11f8=function(_0x2b5513,_0x3fe5cd){_0x2b5513=_0x2b5513-0x0;var _0x578fd2=_0x1f81[_0x2b5513];return _0x578fd2;};'use strict';var _=require(_0x11f8('0x0'));var util=require(_0x11f8('0x1'));var moment=require('moment');var BPromise=require(_0x11f8('0x2'));var rs=require(_0x11f8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x11f8('0x4'))['db'];var utils=require(_0x11f8('0x5'));var logger=require(_0x11f8('0x6'))(_0x11f8('0x7'));var config=require(_0x11f8('0x8'));var jayson=require(_0x11f8('0x9'));var client=jayson[_0x11f8('0xa')][_0x11f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fd0cf,_0x1d899d,_0x8009d7){return new BPromise(function(_0x1cecbe,_0x1bc74d){return client[_0x11f8('0xc')](_0x4fd0cf,_0x8009d7)[_0x11f8('0xd')](function(_0x5ec20c){logger[_0x11f8('0xe')](_0x11f8('0xf'),_0x1d899d,_0x11f8('0x10'));logger[_0x11f8('0x11')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x1d899d,_0x11f8('0x10'),JSON[_0x11f8('0x12')](_0x5ec20c));if(_0x5ec20c[_0x11f8('0x13')]){if(_0x5ec20c[_0x11f8('0x13')][_0x11f8('0x14')]===0x1f4){logger[_0x11f8('0x13')]('VtigerField,\x20%s,\x20%s',_0x1d899d,_0x5ec20c[_0x11f8('0x13')][_0x11f8('0x15')]);return _0x1bc74d(_0x5ec20c[_0x11f8('0x13')]['message']);}logger[_0x11f8('0x13')](_0x11f8('0xf'),_0x1d899d,_0x5ec20c[_0x11f8('0x13')][_0x11f8('0x15')]);return _0x1cecbe(_0x5ec20c['error'][_0x11f8('0x15')]);}else{logger[_0x11f8('0xe')](_0x11f8('0xf'),_0x1d899d,_0x11f8('0x10'));_0x1cecbe(_0x5ec20c[_0x11f8('0x16')]['message']);}})[_0x11f8('0x17')](function(_0x3e7fb3){logger['error'](_0x11f8('0xf'),_0x1d899d,_0x3e7fb3);_0x1bc74d(_0x3e7fb3);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index a05f7fb..d4d8a56 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 _0xfd8d=['../../components/auth/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','post','addConfiguration','update','delete','/:id','multer','util','path','connect-timeout','express','Router'];(function(_0x33180e,_0x2f111f){var _0x899438=function(_0x54109f){while(--_0x54109f){_0x33180e['push'](_0x33180e['shift']());}};_0x899438(++_0x2f111f);}(_0xfd8d,0xf6));var _0xdfd8=function(_0xc730cc,_0x9b4b4b){_0xc730cc=_0xc730cc-0x0;var _0x3e5b7d=_0xfd8d[_0xc730cc];return _0x3e5b7d;};'use strict';var multer=require(_0xdfd8('0x0'));var util=require(_0xdfd8('0x1'));var path=require(_0xdfd8('0x2'));var timeout=require(_0xdfd8('0x3'));var express=require(_0xdfd8('0x4'));var router=express[_0xdfd8('0x5')]();var auth=require(_0xdfd8('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdfd8('0x7'));router[_0xdfd8('0x8')]('/',auth[_0xdfd8('0x9')](),controller[_0xdfd8('0xa')]);router[_0xdfd8('0x8')]('/:id',auth[_0xdfd8('0x9')](),controller['show']);router[_0xdfd8('0x8')](_0xdfd8('0xb'),auth['isAuthenticated'](),controller[_0xdfd8('0xc')]);router['get']('/:id/fields',auth[_0xdfd8('0x9')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xdfd8('0xd')](_0xdfd8('0xb'),auth[_0xdfd8('0x9')](),controller[_0xdfd8('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xdfd8('0xf')]);router[_0xdfd8('0x10')](_0xdfd8('0x11'),auth[_0xdfd8('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x48a5=['multer','connect-timeout','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports'];(function(_0x284718,_0x36e15a){var _0xbe7d41=function(_0x4903be){while(--_0x4903be){_0x284718['push'](_0x284718['shift']());}};_0xbe7d41(++_0x36e15a);}(_0x48a5,0xb4));var _0x548a=function(_0x40dc15,_0x434092){_0x40dc15=_0x40dc15-0x0;var _0x4f1a5c=_0x48a5[_0x40dc15];return _0x4f1a5c;};'use strict';var multer=require(_0x548a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x548a('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x548a('0x2'));var interaction=require(_0x548a('0x3'));var config=require('../../config/environment');var controller=require(_0x548a('0x4'));router['get']('/',auth[_0x548a('0x5')](),controller[_0x548a('0x6')]);router[_0x548a('0x7')](_0x548a('0x8'),auth[_0x548a('0x5')](),controller['show']);router['get'](_0x548a('0x9'),auth[_0x548a('0x5')](),controller[_0x548a('0xa')]);router[_0x548a('0x7')](_0x548a('0xb'),auth[_0x548a('0x5')](),controller['getFields']);router[_0x548a('0xc')]('/',auth[_0x548a('0x5')](),controller[_0x548a('0xd')]);router[_0x548a('0xc')](_0x548a('0x9'),auth[_0x548a('0x5')](),controller[_0x548a('0xe')]);router[_0x548a('0xf')](_0x548a('0x8'),auth['isAuthenticated'](),controller[_0x548a('0x10')]);router[_0x548a('0x11')]('/:id',auth[_0x548a('0x5')](),controller[_0x548a('0x12')]);module[_0x548a('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index ae87348..39f286f 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 _0xc9bf=['sequelize','exports','STRING','remoteUri','password','token','ENUM','integrationTab','newTab'];(function(_0xd00287,_0x1f029d){var _0x4c0b6b=function(_0x596b94){while(--_0x596b94){_0xd00287['push'](_0xd00287['shift']());}};_0x4c0b6b(++_0x1f029d);}(_0xc9bf,0x129));var _0xfc9b=function(_0x3e03ae,_0x59bfd5){_0x3e03ae=_0x3e03ae-0x0;var _0x4c6b0e=_0xc9bf[_0x3e03ae];return _0x4c6b0e;};'use strict';var Sequelize=require(_0xfc9b('0x0'));module[_0xfc9b('0x1')]={'name':{'type':Sequelize[_0xfc9b('0x2')]},'description':{'type':Sequelize[_0xfc9b('0x2')]},'username':{'type':Sequelize[_0xfc9b('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xfc9b('0x2')]},'token':{'type':Sequelize[_0xfc9b('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xfc9b('0x3')},'authType':{'type':Sequelize['ENUM'](_0xfc9b('0x4'),_0xfc9b('0x5')),'defaultValue':_0xfc9b('0x4')},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xfc9b('0x6')](_0xfc9b('0x7'),_0xfc9b('0x8')),'defaultValue':_0xfc9b('0x7')}}; \ No newline at end of file +var _0xc29e=['sequelize','exports','STRING','username','remoteUri','ENUM','token','password','integrationTab','newTab'];(function(_0x3d6252,_0x52589a){var _0x4c3b36=function(_0x53308c){while(--_0x53308c){_0x3d6252['push'](_0x3d6252['shift']());}};_0x4c3b36(++_0x52589a);}(_0xc29e,0x82));var _0xec29=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc29e[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xec29('0x0'));module[_0xec29('0x1')]={'name':{'type':Sequelize[_0xec29('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xec29('0x3')},'password':{'type':Sequelize[_0xec29('0x2')]},'token':{'type':Sequelize[_0xec29('0x2')]},'remoteUri':{'type':Sequelize[_0xec29('0x2')],'unique':_0xec29('0x4')},'authType':{'type':Sequelize[_0xec29('0x5')]('password',_0xec29('0x6')),'defaultValue':_0xec29('0x7')},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xec29('0x5')](_0xec29('0x8'),_0xec29('0x9')),'defaultValue':_0xec29('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index b432043..2454e1b 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 _0x5f97=['VIRTUAL','includeAll','findAll','show','params','include','options','find','create','body','getConfigurations','findOne','ZendeskConfiguration','order','nolimit','AccountId','Subjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','%s:%s','%s/token:%s','toString','base64','Unknown\x20authentication\x20type','subject','group','assignee','remove','position','title','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','json','count','offset','set','apply','reject','save','update','then','destroy','end','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','pick','filter','merge','where'];(function(_0x1bfecb,_0x1a84bf){var _0x495d2b=function(_0x2b44d7){while(--_0x2b44d7){_0x1bfecb['push'](_0x1bfecb['shift']());}};_0x495d2b(++_0x1a84bf);}(_0x5f97,0x1b1));var _0x75f9=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f97[_0x17d9e3];return _0x14192d;};'use strict';var pdf=require(_0x75f9('0x0'));var emlformat=require(_0x75f9('0x1'));var rimraf=require(_0x75f9('0x2'));var zipdir=require(_0x75f9('0x3'));var jsonpatch=require(_0x75f9('0x4'));var rp=require(_0x75f9('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x75f9('0x6'));var util=require('util');var path=require(_0x75f9('0x7'));var sox=require(_0x75f9('0x8'));var csv=require('to-csv');var ejs=require(_0x75f9('0x9'));var fs=require('fs');var _=require(_0x75f9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x75f9('0xb'));var deskjs=require(_0x75f9('0xc'));var toCsv=require(_0x75f9('0xd'));var querystring=require(_0x75f9('0xe'));var Papa=require(_0x75f9('0xf'));var Redis=require('ioredis');var authService=require(_0x75f9('0x10'));var qs=require(_0x75f9('0x11'));var as=require(_0x75f9('0x12'));var hardwareService=require(_0x75f9('0x13'));var logger=require(_0x75f9('0x14'))('api');var utils=require(_0x75f9('0x15'));var config=require(_0x75f9('0x16'));var db=require(_0x75f9('0x17'))['db'];var integrations=require(_0x75f9('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x75f9('0x19')][_0x75f9('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x50a96d,_0x3fd6b1,_0x1d6481){if(_0x1d6481){var _0x533a33=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x533a33[_0x75f9('0x1b')](_0x3fd6b1)){return _0x50a96d;}else{throw new db[(_0x75f9('0x1c'))][(_0x75f9('0x1d'))](_0x75f9('0x1e'));}}else{return _0x50a96d;}}function respondWithRpcPromise(_0x36fce8,_0x2b3870,_0x5ce398,_0x2bc0dc){return new BPromise(function(_0x1d62fc,_0x24ebe4){var _0x28bcca=_0x2bc0dc||client;return _0x28bcca[_0x75f9('0x1f')](_0x36fce8,_0x5ce398)['then'](function(_0x26ef9e){logger['info'](_0x75f9('0x20'),_0x2b3870,_0x75f9('0x21'));logger[_0x75f9('0x22')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x2b3870,_0x75f9('0x21'),JSON[_0x75f9('0x23')](_0x26ef9e));if(_0x26ef9e[_0x75f9('0x24')]){if(_0x26ef9e[_0x75f9('0x24')][_0x75f9('0x25')]===0x1f4){logger[_0x75f9('0x24')](_0x75f9('0x20'),_0x2b3870,_0x26ef9e[_0x75f9('0x24')][_0x75f9('0x26')]);return _0x24ebe4(_0x26ef9e['error'][_0x75f9('0x26')]);}logger[_0x75f9('0x24')](_0x75f9('0x20'),_0x2b3870,_0x26ef9e['error'][_0x75f9('0x26')]);return _0x1d62fc(_0x26ef9e['error'][_0x75f9('0x26')]);}else{logger[_0x75f9('0x27')]('ZendeskAccount,\x20%s,\x20%s',_0x2b3870,_0x75f9('0x21'));_0x1d62fc(_0x26ef9e[_0x75f9('0x28')][_0x75f9('0x26')]);}})[_0x75f9('0x29')](function(_0x207c63){logger[_0x75f9('0x24')](_0x75f9('0x20'),_0x2b3870,_0x207c63);_0x24ebe4(_0x207c63);});});}function respondWithStatusCode(_0x539879,_0x7bbf46){_0x7bbf46=_0x7bbf46||0xcc;return function(_0x1c8527){if(_0x1c8527){return _0x539879[_0x75f9('0x2a')](_0x7bbf46);}return _0x539879[_0x75f9('0x2b')](_0x7bbf46)['end']();};}function respondWithResult(_0x2ff0c3,_0x18c7be){_0x18c7be=_0x18c7be||0xc8;return function(_0xa41f55){if(_0xa41f55){return _0x2ff0c3[_0x75f9('0x2b')](_0x18c7be)[_0x75f9('0x2c')](_0xa41f55);}};}function respondWithFilteredResult(_0x94c056,_0x2975ca){return function(_0x2a290d){if(_0x2a290d){var _0x48969b=_0x2a290d[_0x75f9('0x2d')],_0x11d07b=_0x2975ca[_0x75f9('0x2e')],_0x5c5611=_0x2975ca[_0x75f9('0x2e')]+_0x2975ca['limit'],_0x466342;if(_0x5c5611>=_0x48969b){_0x5c5611=_0x48969b;_0x466342=0xc8;}else{_0x466342=0xce;}_0x94c056[_0x75f9('0x2b')](_0x466342);return _0x94c056[_0x75f9('0x2f')]('Content-Range',_0x11d07b+'-'+_0x5c5611+'/'+_0x48969b)['json'](_0x2a290d);}return null;};}function patchUpdates(_0x2b606d){return function(_0x59512e){try{jsonpatch[_0x75f9('0x30')](_0x59512e,_0x2b606d,!![]);}catch(_0x35468d){return BPromise[_0x75f9('0x31')](_0x35468d);}return _0x59512e[_0x75f9('0x32')]();};}function saveUpdates(_0x3ab43e,_0x36d53e){return function(_0x10842e){if(_0x10842e){return _0x10842e[_0x75f9('0x33')](_0x3ab43e)[_0x75f9('0x34')](function(_0x25a0d5){return _0x25a0d5;});}return null;};}function removeEntity(_0x41ff13,_0x2f5943){return function(_0x263378){if(_0x263378){return _0x263378[_0x75f9('0x35')]()[_0x75f9('0x34')](function(){_0x41ff13[_0x75f9('0x2b')](0xcc)[_0x75f9('0x36')]();});}};}function handleEntityNotFound(_0x603bb7,_0x23fdfc){return function(_0x289356){if(!_0x289356){_0x603bb7[_0x75f9('0x2a')](0x194);}return _0x289356;};}function handleError(_0x339458,_0x160321){_0x160321=_0x160321||0x1f4;return function(_0xf68fe){logger[_0x75f9('0x24')](_0xf68fe[_0x75f9('0x37')]);if(_0xf68fe[_0x75f9('0x38')]){delete _0xf68fe[_0x75f9('0x38')];}_0x339458[_0x75f9('0x2b')](_0x160321)[_0x75f9('0x39')](_0xf68fe);};}exports[_0x75f9('0x3a')]=function(_0x537197,_0x37d93e){var _0x3da6f7={},_0xb6f342={},_0x34ed07={'count':0x0,'rows':[]};var _0x2c8ce2=_['map'](db[_0x75f9('0x3b')][_0x75f9('0x3c')],function(_0x5cd6b3){return{'name':_0x5cd6b3[_0x75f9('0x3d')],'type':_0x5cd6b3[_0x75f9('0x3e')]['key']};});_0xb6f342[_0x75f9('0x3f')]=_[_0x75f9('0x40')](_0x2c8ce2,_0x75f9('0x38'));_0xb6f342[_0x75f9('0x41')]=_[_0x75f9('0x42')](_0x537197[_0x75f9('0x41')]);_0xb6f342[_0x75f9('0x43')]=_[_0x75f9('0x44')](_0xb6f342[_0x75f9('0x3f')],_0xb6f342[_0x75f9('0x41')]);_0x3da6f7['attributes']=_['intersection'](_0xb6f342['model'],qs[_0x75f9('0x45')](_0x537197['query'][_0x75f9('0x45')]));_0x3da6f7[_0x75f9('0x46')]=_0x3da6f7['attributes'][_0x75f9('0x47')]?_0x3da6f7[_0x75f9('0x46')]:_0xb6f342['model'];if(!_0x537197[_0x75f9('0x41')][_0x75f9('0x48')]('nolimit')){_0x3da6f7[_0x75f9('0x49')]=qs[_0x75f9('0x49')](_0x537197[_0x75f9('0x41')][_0x75f9('0x49')]);_0x3da6f7[_0x75f9('0x2e')]=qs['offset'](_0x537197[_0x75f9('0x41')][_0x75f9('0x2e')]);}_0x3da6f7['order']=qs[_0x75f9('0x4a')](_0x537197['query'][_0x75f9('0x4a')]);_0x3da6f7['where']=qs[_0x75f9('0x43')](_[_0x75f9('0x4b')](_0x537197[_0x75f9('0x41')],_0xb6f342[_0x75f9('0x43')]),_0x2c8ce2);if(_0x537197['query'][_0x75f9('0x4c')]){_0x3da6f7['where']=_[_0x75f9('0x4d')](_0x3da6f7[_0x75f9('0x4e')],{'$or':_[_0x75f9('0x40')](_0x2c8ce2,function(_0x18632a){if(_0x18632a[_0x75f9('0x3e')]!==_0x75f9('0x4f')){var _0x5536e0={};_0x5536e0[_0x18632a[_0x75f9('0x38')]]={'$like':'%'+_0x537197['query'][_0x75f9('0x4c')]+'%'};return _0x5536e0;}})});}_0x3da6f7=_[_0x75f9('0x4d')]({},_0x3da6f7,_0x537197['options']);var _0x41d7ad={'where':_0x3da6f7[_0x75f9('0x4e')]};return db[_0x75f9('0x3b')][_0x75f9('0x2d')](_0x41d7ad)['then'](function(_0x51b0d3){_0x34ed07[_0x75f9('0x2d')]=_0x51b0d3;if(_0x537197[_0x75f9('0x41')][_0x75f9('0x50')]){_0x3da6f7['include']=[{'all':!![]}];}return db[_0x75f9('0x3b')][_0x75f9('0x51')](_0x3da6f7);})[_0x75f9('0x34')](function(_0x5d550f){_0x34ed07['rows']=_0x5d550f;return _0x34ed07;})[_0x75f9('0x34')](respondWithFilteredResult(_0x37d93e,_0x3da6f7))[_0x75f9('0x29')](handleError(_0x37d93e,null));};exports[_0x75f9('0x52')]=function(_0x2c938f,_0xd0b8b1){var _0xb4f689={'raw':![],'where':{'id':_0x2c938f[_0x75f9('0x53')]['id']}},_0x10c272={};_0x10c272[_0x75f9('0x3f')]=_[_0x75f9('0x42')](db[_0x75f9('0x3b')][_0x75f9('0x3c')]);_0x10c272[_0x75f9('0x41')]=_[_0x75f9('0x42')](_0x2c938f[_0x75f9('0x41')]);_0x10c272[_0x75f9('0x43')]=_['intersection'](_0x10c272[_0x75f9('0x3f')],_0x10c272['query']);_0xb4f689['attributes']=_[_0x75f9('0x44')](_0x10c272[_0x75f9('0x3f')],qs[_0x75f9('0x45')](_0x2c938f[_0x75f9('0x41')][_0x75f9('0x45')]));_0xb4f689[_0x75f9('0x46')]=_0xb4f689[_0x75f9('0x46')]['length']?_0xb4f689[_0x75f9('0x46')]:_0x10c272[_0x75f9('0x3f')];if(_0x2c938f[_0x75f9('0x41')][_0x75f9('0x50')]){_0xb4f689[_0x75f9('0x54')]=[{'all':!![]}];}_0xb4f689=_[_0x75f9('0x4d')]({},_0xb4f689,_0x2c938f[_0x75f9('0x55')]);return db[_0x75f9('0x3b')][_0x75f9('0x56')](_0xb4f689)[_0x75f9('0x34')](handleEntityNotFound(_0xd0b8b1,null))[_0x75f9('0x34')](respondWithResult(_0xd0b8b1,null))['catch'](handleError(_0xd0b8b1,null));};exports['create']=function(_0x216d0a,_0x691923){return db['ZendeskAccount'][_0x75f9('0x57')](_0x216d0a[_0x75f9('0x58')],{})['then'](respondWithResult(_0x691923,0xc9))[_0x75f9('0x29')](handleError(_0x691923,null));};exports[_0x75f9('0x33')]=function(_0x3205d3,_0x47c7c5){if(_0x3205d3[_0x75f9('0x58')]['id']){delete _0x3205d3['body']['id'];}return db[_0x75f9('0x3b')][_0x75f9('0x56')]({'where':{'id':_0x3205d3[_0x75f9('0x53')]['id']}})[_0x75f9('0x34')](handleEntityNotFound(_0x47c7c5,null))[_0x75f9('0x34')](saveUpdates(_0x3205d3[_0x75f9('0x58')],null))[_0x75f9('0x34')](respondWithResult(_0x47c7c5,null))[_0x75f9('0x29')](handleError(_0x47c7c5,null));};exports[_0x75f9('0x35')]=function(_0xa3da90,_0x1748e3){return db['ZendeskAccount']['find']({'where':{'id':_0xa3da90[_0x75f9('0x53')]['id']}})[_0x75f9('0x34')](handleEntityNotFound(_0x1748e3,null))[_0x75f9('0x34')](removeEntity(_0x1748e3,null))[_0x75f9('0x29')](handleError(_0x1748e3,null));};exports[_0x75f9('0x59')]=function(_0xbab9f2,_0x58ab09,_0x448f7c){var _0x5f26de={};var _0x5570b2={};var _0x2bf232;var _0x2b671e;return db[_0x75f9('0x3b')][_0x75f9('0x5a')]({'where':{'id':_0xbab9f2[_0x75f9('0x53')]['id']}})[_0x75f9('0x34')](handleEntityNotFound(_0x58ab09,null))[_0x75f9('0x34')](function(_0x5bcede){if(_0x5bcede){_0x2bf232=_0x5bcede;_0x5570b2[_0x75f9('0x3f')]=_['keys'](db[_0x75f9('0x5b')][_0x75f9('0x3c')]);_0x5570b2['query']=_[_0x75f9('0x42')](_0xbab9f2[_0x75f9('0x41')]);_0x5570b2[_0x75f9('0x43')]=_[_0x75f9('0x44')](_0x5570b2['model'],_0x5570b2[_0x75f9('0x41')]);_0x5f26de['attributes']=_['intersection'](_0x5570b2[_0x75f9('0x3f')],qs['fields'](_0xbab9f2[_0x75f9('0x41')][_0x75f9('0x45')]));_0x5f26de[_0x75f9('0x46')]=_0x5f26de[_0x75f9('0x46')][_0x75f9('0x47')]?_0x5f26de[_0x75f9('0x46')]:_0x5570b2['model'];_0x5f26de[_0x75f9('0x5c')]=qs['sort'](_0xbab9f2[_0x75f9('0x41')][_0x75f9('0x4a')]);_0x5f26de['where']=qs[_0x75f9('0x43')](_[_0x75f9('0x4b')](_0xbab9f2['query'],_0x5570b2[_0x75f9('0x43')]));if(_0xbab9f2['query'][_0x75f9('0x4c')]){_0x5f26de[_0x75f9('0x4e')]=_[_0x75f9('0x4d')](_0x5f26de[_0x75f9('0x4e')],{'$or':_['map'](_0x5f26de['attributes'],function(_0x2dfafc){var _0x297ee3={};_0x297ee3[_0x2dfafc]={'$like':'%'+_0xbab9f2[_0x75f9('0x41')][_0x75f9('0x4c')]+'%'};return _0x297ee3;})});}_0x5f26de=_['merge']({},_0x5f26de,_0xbab9f2[_0x75f9('0x55')]);return _0x2bf232['getConfigurations'](_0x5f26de);}})['then'](function(_0x494066){if(_0x494066){_0x2b671e=_0x494066[_0x75f9('0x47')];if(!_0xbab9f2[_0x75f9('0x41')]['hasOwnProperty'](_0x75f9('0x5d'))){_0x5f26de[_0x75f9('0x49')]=qs[_0x75f9('0x49')](_0xbab9f2['query']['limit']);_0x5f26de[_0x75f9('0x2e')]=qs[_0x75f9('0x2e')](_0xbab9f2[_0x75f9('0x41')][_0x75f9('0x2e')]);}return _0x2bf232[_0x75f9('0x59')](_0x5f26de);}})[_0x75f9('0x34')](function(_0x33a71b){if(_0x33a71b){return _0x33a71b?{'count':_0x2b671e,'rows':_0x33a71b}:null;}})[_0x75f9('0x34')](respondWithResult(_0x58ab09,null))[_0x75f9('0x29')](handleError(_0x58ab09,null));};exports['addConfiguration']=function(_0x15efe0,_0x2a2d4a,_0xad2acf){if(_0x15efe0[_0x75f9('0x58')]['id']){delete _0x15efe0['body']['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x15efe0[_0x75f9('0x53')]['id']}})[_0x75f9('0x34')](handleEntityNotFound(_0x2a2d4a,null))[_0x75f9('0x34')](function(_0x103468){if(_0x103468){_0x15efe0[_0x75f9('0x58')][_0x75f9('0x5e')]=_0x103468['id'];_0x15efe0[_0x75f9('0x58')][_0x75f9('0x5f')]=integrations['getSubjects'](_0x15efe0[_0x75f9('0x58')][_0x75f9('0x60')],_0x15efe0[_0x75f9('0x58')][_0x75f9('0x3e')]);_0x15efe0[_0x75f9('0x58')][_0x75f9('0x61')]=integrations[_0x75f9('0x62')](_0x15efe0[_0x75f9('0x58')][_0x75f9('0x60')],_0x15efe0[_0x75f9('0x58')]['type']);return db['ZendeskConfiguration']['create'](_0x15efe0[_0x75f9('0x58')],{'include':[{'model':db[_0x75f9('0x63')],'as':_0x75f9('0x5f')},{'model':db[_0x75f9('0x63')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2a2d4a,null))[_0x75f9('0x29')](handleError(_0x2a2d4a,null));};exports[_0x75f9('0x64')]=function(_0x1c4006,_0x19f29b,_0x554651){var _0x163956='';return db[_0x75f9('0x3b')][_0x75f9('0x5a')]({'where':{'id':_0x1c4006['params']['id']},'attributes':['id',_0x75f9('0x65'),_0x75f9('0x66'),_0x75f9('0x67'),_0x75f9('0x68'),_0x75f9('0x69')]})[_0x75f9('0x34')](handleEntityNotFound(_0x19f29b,null))[_0x75f9('0x34')](function(_0x3ab36e){if(_0x3ab36e){_0x163956=_0x3ab36e[_0x75f9('0x69')];var _0x3e90a2=_0x163956['slice'](-0x1);if(_0x3e90a2==='/'){_0x163956=_0x163956[_0x75f9('0x6a')](0x0,_0x163956[_0x75f9('0x6b')](_0x3e90a2));}var _0x16c43b={'method':_0x75f9('0x6c'),'uri':util[_0x75f9('0x6d')](_0x75f9('0x6e'),_0x163956,_0x75f9('0x6f')),'json':!![]};switch(_0x3ab36e[_0x75f9('0x68')]){case _0x75f9('0x66'):_0x16c43b[_0x75f9('0x70')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x75f9('0x6d')](_0x75f9('0x71'),_0x3ab36e[_0x75f9('0x65')],_0x3ab36e[_0x75f9('0x66')]))['toString']('base64'))};break;case _0x75f9('0x67'):_0x16c43b[_0x75f9('0x70')]={'Authorization':util[_0x75f9('0x6d')]('Basic\x20%s',new Buffer(util[_0x75f9('0x6d')](_0x75f9('0x72'),_0x3ab36e[_0x75f9('0x65')],_0x3ab36e[_0x75f9('0x67')]))[_0x75f9('0x73')](_0x75f9('0x74')))};break;default:throw new db[(_0x75f9('0x1c'))][(_0x75f9('0x1d'))](_0x75f9('0x75'));}return rp(_0x16c43b);}})['then'](function(_0x141691){if(_0x141691){var _0x198b1f=[_0x75f9('0x76'),'description',_0x75f9('0x77'),_0x75f9('0x78')];_[_0x75f9('0x79')](_0x141691[_0x75f9('0x6f')],function(_0x3ba6a8){return _0x198b1f['includes'](_0x3ba6a8[_0x75f9('0x3e')]);});return{'count':_0x141691['ticket_fields'][_0x75f9('0x47')],'rows':_[_0x75f9('0x40')](_0x141691[_0x75f9('0x6f')],function(_0x372b86){return{'id':_0x372b86['id'],'name':_0x372b86[_0x75f9('0x7a')]>0x7?_0x372b86[_0x75f9('0x7b')]:_0x372b86[_0x75f9('0x3e')],'custom':_0x372b86[_0x75f9('0x7a')]>0x7?!![]:![],'options':_0x372b86['system_field_options']?_0x372b86['system_field_options']:_0x372b86['custom_field_options']?_0x372b86[_0x75f9('0x7c')]:[]};})};}})['then'](respondWithResult(_0x19f29b,null))[_0x75f9('0x29')](function(_0x5e3eaf){var _0x1dec61=_0x1c4006[_0x75f9('0x41')]['test']?0x1f4:_0x5e3eaf[_0x75f9('0x7d')]||0x1f4;logger['error'](_0x75f9('0x7e'),_0x75f9('0x64'),_0x1dec61,JSON['stringify'](_0x5e3eaf));delete _0x5e3eaf[_0x75f9('0x38')];if(_0x1dec61===0x191){_0x1dec61=0x190;}_0x19f29b[_0x75f9('0x2b')](_0x1dec61)['send'](_0x1c4006[_0x75f9('0x41')][_0x75f9('0x1b')]?{'message':_0x75f9('0x7f'),'statusCode':_0x5e3eaf[_0x75f9('0x7d')]}:_0x5e3eaf);});}; \ No newline at end of file +var _0xa9cd=['base64','headers','Basic\x20%s','%s/token:%s','token','toString','Sequelize','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','title','system_field_options','custom_field_options','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','destroy','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','keys','find','create','body','params','getConfigurations','ZendeskConfiguration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','getFields','username','password','remoteUri','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','%s:%s'];(function(_0x44dc7f,_0x1e6e7d){var _0x7bada7=function(_0x469b89){while(--_0x469b89){_0x44dc7f['push'](_0x44dc7f['shift']());}};_0x7bada7(++_0x1e6e7d);}(_0xa9cd,0x93));var _0xda9c=function(_0x1768b8,_0x434585){_0x1768b8=_0x1768b8-0x0;var _0x3c5784=_0xa9cd[_0x1768b8];return _0x3c5784;};'use strict';var pdf=require(_0xda9c('0x0'));var emlformat=require(_0xda9c('0x1'));var rimraf=require(_0xda9c('0x2'));var zipdir=require(_0xda9c('0x3'));var jsonpatch=require(_0xda9c('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xda9c('0x5'));var Mustache=require(_0xda9c('0x6'));var util=require(_0xda9c('0x7'));var path=require('path');var sox=require(_0xda9c('0x8'));var csv=require(_0xda9c('0x9'));var ejs=require(_0xda9c('0xa'));var fs=require('fs');var _=require(_0xda9c('0xb'));var squel=require(_0xda9c('0xc'));var crypto=require(_0xda9c('0xd'));var jsforce=require(_0xda9c('0xe'));var deskjs=require(_0xda9c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xda9c('0x10'));var Papa=require(_0xda9c('0x11'));var Redis=require(_0xda9c('0x12'));var authService=require(_0xda9c('0x13'));var qs=require(_0xda9c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda9c('0x15'));var logger=require(_0xda9c('0x16'))('api');var utils=require(_0xda9c('0x17'));var config=require(_0xda9c('0x18'));var db=require(_0xda9c('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xda9c('0x1a'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x32de38,_0x29b1a2,_0x4da961){if(_0x4da961){var _0x4ef9e7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4ef9e7[_0xda9c('0x1b')](_0x29b1a2)){return _0x32de38;}else{throw new db['Sequelize'][(_0xda9c('0x1c'))](_0xda9c('0x1d'));}}else{return _0x32de38;}}function respondWithRpcPromise(_0x1197a1,_0x10a6b6,_0x323b14,_0x206775){return new BPromise(function(_0x35dbf1,_0x4d76db){var _0x3cdd86=_0x206775||client;return _0x3cdd86['request'](_0x1197a1,_0x323b14)[_0xda9c('0x1e')](function(_0x30cbf7){logger[_0xda9c('0x1f')]('ZendeskAccount,\x20%s,\x20%s',_0x10a6b6,_0xda9c('0x20'));logger[_0xda9c('0x21')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x10a6b6,_0xda9c('0x20'),JSON[_0xda9c('0x22')](_0x30cbf7));if(_0x30cbf7[_0xda9c('0x23')]){if(_0x30cbf7[_0xda9c('0x23')][_0xda9c('0x24')]===0x1f4){logger[_0xda9c('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0x10a6b6,_0x30cbf7[_0xda9c('0x23')]['message']);return _0x4d76db(_0x30cbf7[_0xda9c('0x23')][_0xda9c('0x25')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x10a6b6,_0x30cbf7[_0xda9c('0x23')][_0xda9c('0x25')]);return _0x35dbf1(_0x30cbf7['error']['message']);}else{logger[_0xda9c('0x1f')]('ZendeskAccount,\x20%s,\x20%s',_0x10a6b6,_0xda9c('0x20'));_0x35dbf1(_0x30cbf7['result'][_0xda9c('0x25')]);}})[_0xda9c('0x26')](function(_0x1b4156){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x10a6b6,_0x1b4156);_0x4d76db(_0x1b4156);});});}function respondWithStatusCode(_0x2077db,_0x38badd){_0x38badd=_0x38badd||0xcc;return function(_0x59aa54){if(_0x59aa54){return _0x2077db[_0xda9c('0x27')](_0x38badd);}return _0x2077db[_0xda9c('0x28')](_0x38badd)[_0xda9c('0x29')]();};}function respondWithResult(_0x30a4cf,_0x316734){_0x316734=_0x316734||0xc8;return function(_0x3140d3){if(_0x3140d3){return _0x30a4cf[_0xda9c('0x28')](_0x316734)[_0xda9c('0x2a')](_0x3140d3);}};}function respondWithFilteredResult(_0x634bad,_0x3c3eac){return function(_0x33a4c4){if(_0x33a4c4){var _0x38598d=_0x33a4c4[_0xda9c('0x2b')],_0x3d34eb=_0x3c3eac[_0xda9c('0x2c')],_0x2cfeb5=_0x3c3eac['offset']+_0x3c3eac['limit'],_0x49a31d;if(_0x2cfeb5>=_0x38598d){_0x2cfeb5=_0x38598d;_0x49a31d=0xc8;}else{_0x49a31d=0xce;}_0x634bad[_0xda9c('0x28')](_0x49a31d);return _0x634bad[_0xda9c('0x2d')](_0xda9c('0x2e'),_0x3d34eb+'-'+_0x2cfeb5+'/'+_0x38598d)[_0xda9c('0x2a')](_0x33a4c4);}return null;};}function patchUpdates(_0x1bd32a){return function(_0x49ff5a){try{jsonpatch[_0xda9c('0x2f')](_0x49ff5a,_0x1bd32a,!![]);}catch(_0x1e854b){return BPromise[_0xda9c('0x30')](_0x1e854b);}return _0x49ff5a['save']();};}function saveUpdates(_0x160aa2,_0x3d8614){return function(_0x1d7273){if(_0x1d7273){return _0x1d7273['update'](_0x160aa2)[_0xda9c('0x1e')](function(_0x4d64ee){return _0x4d64ee;});}return null;};}function removeEntity(_0x19535e,_0x104058){return function(_0x4cb936){if(_0x4cb936){return _0x4cb936[_0xda9c('0x31')]()[_0xda9c('0x1e')](function(){_0x19535e[_0xda9c('0x28')](0xcc)[_0xda9c('0x29')]();});}};}function handleEntityNotFound(_0x318259,_0x552f07){return function(_0x506197){if(!_0x506197){_0x318259['sendStatus'](0x194);}return _0x506197;};}function handleError(_0x33ffec,_0x4af494){_0x4af494=_0x4af494||0x1f4;return function(_0x1c4112){logger['error'](_0x1c4112[_0xda9c('0x32')]);if(_0x1c4112[_0xda9c('0x33')]){delete _0x1c4112['name'];}_0x33ffec[_0xda9c('0x28')](_0x4af494)[_0xda9c('0x34')](_0x1c4112);};}exports[_0xda9c('0x35')]=function(_0x2ab7e0,_0x3c1440){var _0x1b7ccd={},_0x3e9325={},_0x1cb234={'count':0x0,'rows':[]};var _0x35db19=_[_0xda9c('0x36')](db[_0xda9c('0x37')][_0xda9c('0x38')],function(_0xe7c021){return{'name':_0xe7c021[_0xda9c('0x39')],'type':_0xe7c021[_0xda9c('0x3a')][_0xda9c('0x3b')]};});_0x3e9325['model']=_[_0xda9c('0x36')](_0x35db19,'name');_0x3e9325[_0xda9c('0x3c')]=_['keys'](_0x2ab7e0['query']);_0x3e9325[_0xda9c('0x3d')]=_[_0xda9c('0x3e')](_0x3e9325[_0xda9c('0x3f')],_0x3e9325['query']);_0x1b7ccd[_0xda9c('0x40')]=_['intersection'](_0x3e9325[_0xda9c('0x3f')],qs[_0xda9c('0x41')](_0x2ab7e0[_0xda9c('0x3c')][_0xda9c('0x41')]));_0x1b7ccd['attributes']=_0x1b7ccd['attributes'][_0xda9c('0x42')]?_0x1b7ccd[_0xda9c('0x40')]:_0x3e9325[_0xda9c('0x3f')];if(!_0x2ab7e0[_0xda9c('0x3c')][_0xda9c('0x43')](_0xda9c('0x44'))){_0x1b7ccd[_0xda9c('0x45')]=qs['limit'](_0x2ab7e0['query'][_0xda9c('0x45')]);_0x1b7ccd[_0xda9c('0x2c')]=qs[_0xda9c('0x2c')](_0x2ab7e0[_0xda9c('0x3c')]['offset']);}_0x1b7ccd[_0xda9c('0x46')]=qs[_0xda9c('0x47')](_0x2ab7e0[_0xda9c('0x3c')][_0xda9c('0x47')]);_0x1b7ccd[_0xda9c('0x48')]=qs[_0xda9c('0x3d')](_[_0xda9c('0x49')](_0x2ab7e0[_0xda9c('0x3c')],_0x3e9325[_0xda9c('0x3d')]),_0x35db19);if(_0x2ab7e0[_0xda9c('0x3c')][_0xda9c('0x4a')]){_0x1b7ccd['where']=_['merge'](_0x1b7ccd[_0xda9c('0x48')],{'$or':_[_0xda9c('0x36')](_0x35db19,function(_0x16c756){if(_0x16c756['type']!=='VIRTUAL'){var _0x448baf={};_0x448baf[_0x16c756[_0xda9c('0x33')]]={'$like':'%'+_0x2ab7e0[_0xda9c('0x3c')][_0xda9c('0x4a')]+'%'};return _0x448baf;}})});}_0x1b7ccd=_[_0xda9c('0x4b')]({},_0x1b7ccd,_0x2ab7e0[_0xda9c('0x4c')]);var _0x5a6ba1={'where':_0x1b7ccd[_0xda9c('0x48')]};return db[_0xda9c('0x37')][_0xda9c('0x2b')](_0x5a6ba1)['then'](function(_0x26e28a){_0x1cb234['count']=_0x26e28a;if(_0x2ab7e0['query'][_0xda9c('0x4d')]){_0x1b7ccd[_0xda9c('0x4e')]=[{'all':!![]}];}return db[_0xda9c('0x37')][_0xda9c('0x4f')](_0x1b7ccd);})[_0xda9c('0x1e')](function(_0x799ded){_0x1cb234[_0xda9c('0x50')]=_0x799ded;return _0x1cb234;})[_0xda9c('0x1e')](respondWithFilteredResult(_0x3c1440,_0x1b7ccd))['catch'](handleError(_0x3c1440,null));};exports[_0xda9c('0x51')]=function(_0x566b6d,_0x4a2ceb){var _0x253b42={'raw':![],'where':{'id':_0x566b6d['params']['id']}},_0x5e801b={};_0x5e801b[_0xda9c('0x3f')]=_[_0xda9c('0x52')](db['ZendeskAccount']['rawAttributes']);_0x5e801b[_0xda9c('0x3c')]=_[_0xda9c('0x52')](_0x566b6d[_0xda9c('0x3c')]);_0x5e801b[_0xda9c('0x3d')]=_[_0xda9c('0x3e')](_0x5e801b[_0xda9c('0x3f')],_0x5e801b[_0xda9c('0x3c')]);_0x253b42[_0xda9c('0x40')]=_[_0xda9c('0x3e')](_0x5e801b[_0xda9c('0x3f')],qs[_0xda9c('0x41')](_0x566b6d['query']['fields']));_0x253b42[_0xda9c('0x40')]=_0x253b42[_0xda9c('0x40')][_0xda9c('0x42')]?_0x253b42[_0xda9c('0x40')]:_0x5e801b[_0xda9c('0x3f')];if(_0x566b6d[_0xda9c('0x3c')][_0xda9c('0x4d')]){_0x253b42['include']=[{'all':!![]}];}_0x253b42=_[_0xda9c('0x4b')]({},_0x253b42,_0x566b6d[_0xda9c('0x4c')]);return db[_0xda9c('0x37')][_0xda9c('0x53')](_0x253b42)[_0xda9c('0x1e')](handleEntityNotFound(_0x4a2ceb,null))[_0xda9c('0x1e')](respondWithResult(_0x4a2ceb,null))['catch'](handleError(_0x4a2ceb,null));};exports[_0xda9c('0x54')]=function(_0x19af99,_0x3cb0a8){return db[_0xda9c('0x37')]['create'](_0x19af99['body'],{})['then'](respondWithResult(_0x3cb0a8,0xc9))[_0xda9c('0x26')](handleError(_0x3cb0a8,null));};exports['update']=function(_0x26e784,_0x240de2){if(_0x26e784[_0xda9c('0x55')]['id']){delete _0x26e784['body']['id'];}return db[_0xda9c('0x37')]['find']({'where':{'id':_0x26e784[_0xda9c('0x56')]['id']}})[_0xda9c('0x1e')](handleEntityNotFound(_0x240de2,null))[_0xda9c('0x1e')](saveUpdates(_0x26e784[_0xda9c('0x55')],null))[_0xda9c('0x1e')](respondWithResult(_0x240de2,null))[_0xda9c('0x26')](handleError(_0x240de2,null));};exports[_0xda9c('0x31')]=function(_0x18622a,_0x4fad78){return db['ZendeskAccount'][_0xda9c('0x53')]({'where':{'id':_0x18622a[_0xda9c('0x56')]['id']}})['then'](handleEntityNotFound(_0x4fad78,null))['then'](removeEntity(_0x4fad78,null))[_0xda9c('0x26')](handleError(_0x4fad78,null));};exports[_0xda9c('0x57')]=function(_0x50d35b,_0x31bce6,_0x4b3c4b){var _0x4e8881={};var _0x2048c3={};var _0x48b025;var _0x4c649f;return db[_0xda9c('0x37')]['findOne']({'where':{'id':_0x50d35b['params']['id']}})[_0xda9c('0x1e')](handleEntityNotFound(_0x31bce6,null))[_0xda9c('0x1e')](function(_0x5a2433){if(_0x5a2433){_0x48b025=_0x5a2433;_0x2048c3[_0xda9c('0x3f')]=_[_0xda9c('0x52')](db[_0xda9c('0x58')][_0xda9c('0x38')]);_0x2048c3['query']=_[_0xda9c('0x52')](_0x50d35b[_0xda9c('0x3c')]);_0x2048c3[_0xda9c('0x3d')]=_['intersection'](_0x2048c3[_0xda9c('0x3f')],_0x2048c3[_0xda9c('0x3c')]);_0x4e8881[_0xda9c('0x40')]=_[_0xda9c('0x3e')](_0x2048c3[_0xda9c('0x3f')],qs[_0xda9c('0x41')](_0x50d35b[_0xda9c('0x3c')][_0xda9c('0x41')]));_0x4e8881[_0xda9c('0x40')]=_0x4e8881[_0xda9c('0x40')][_0xda9c('0x42')]?_0x4e8881[_0xda9c('0x40')]:_0x2048c3[_0xda9c('0x3f')];_0x4e8881['order']=qs[_0xda9c('0x47')](_0x50d35b['query'][_0xda9c('0x47')]);_0x4e8881['where']=qs[_0xda9c('0x3d')](_['pick'](_0x50d35b['query'],_0x2048c3['filters']));if(_0x50d35b['query'][_0xda9c('0x4a')]){_0x4e8881[_0xda9c('0x48')]=_[_0xda9c('0x4b')](_0x4e8881[_0xda9c('0x48')],{'$or':_['map'](_0x4e8881[_0xda9c('0x40')],function(_0xa28e29){var _0x7bf09={};_0x7bf09[_0xa28e29]={'$like':'%'+_0x50d35b['query'][_0xda9c('0x4a')]+'%'};return _0x7bf09;})});}_0x4e8881=_[_0xda9c('0x4b')]({},_0x4e8881,_0x50d35b['options']);return _0x48b025[_0xda9c('0x57')](_0x4e8881);}})['then'](function(_0x540910){if(_0x540910){_0x4c649f=_0x540910[_0xda9c('0x42')];if(!_0x50d35b['query'][_0xda9c('0x43')](_0xda9c('0x44'))){_0x4e8881[_0xda9c('0x45')]=qs[_0xda9c('0x45')](_0x50d35b[_0xda9c('0x3c')][_0xda9c('0x45')]);_0x4e8881['offset']=qs[_0xda9c('0x2c')](_0x50d35b['query'][_0xda9c('0x2c')]);}return _0x48b025[_0xda9c('0x57')](_0x4e8881);}})[_0xda9c('0x1e')](function(_0x258402){if(_0x258402){return _0x258402?{'count':_0x4c649f,'rows':_0x258402}:null;}})[_0xda9c('0x1e')](respondWithResult(_0x31bce6,null))['catch'](handleError(_0x31bce6,null));};exports[_0xda9c('0x59')]=function(_0x2e898e,_0x52d767,_0x586aec){if(_0x2e898e[_0xda9c('0x55')]['id']){delete _0x2e898e[_0xda9c('0x55')]['id'];}return db[_0xda9c('0x37')][_0xda9c('0x5a')]({'where':{'id':_0x2e898e[_0xda9c('0x56')]['id']}})[_0xda9c('0x1e')](handleEntityNotFound(_0x52d767,null))[_0xda9c('0x1e')](function(_0x296aa3){if(_0x296aa3){_0x2e898e[_0xda9c('0x55')][_0xda9c('0x5b')]=_0x296aa3['id'];_0x2e898e[_0xda9c('0x55')][_0xda9c('0x5c')]=integrations[_0xda9c('0x5d')](_0x2e898e[_0xda9c('0x55')][_0xda9c('0x5e')],_0x2e898e[_0xda9c('0x55')]['type']);_0x2e898e['body']['Descriptions']=integrations[_0xda9c('0x5f')](_0x2e898e[_0xda9c('0x55')]['channel'],_0x2e898e['body']['type']);return db['ZendeskConfiguration'][_0xda9c('0x54')](_0x2e898e[_0xda9c('0x55')],{'include':[{'model':db[_0xda9c('0x60')],'as':'Subjects'},{'model':db[_0xda9c('0x60')],'as':_0xda9c('0x61')}]});}return null;})[_0xda9c('0x1e')](respondWithResult(_0x52d767,null))[_0xda9c('0x26')](handleError(_0x52d767,null));};exports[_0xda9c('0x62')]=function(_0x137311,_0x2f0b96,_0x3ba927){var _0x277d94='';return db[_0xda9c('0x37')]['findOne']({'where':{'id':_0x137311[_0xda9c('0x56')]['id']},'attributes':['id',_0xda9c('0x63'),_0xda9c('0x64'),'token','authType','remoteUri']})[_0xda9c('0x1e')](handleEntityNotFound(_0x2f0b96,null))[_0xda9c('0x1e')](function(_0x2e139d){if(_0x2e139d){_0x277d94=_0x2e139d[_0xda9c('0x65')];var _0x3cee20=_0x277d94['slice'](-0x1);if(_0x3cee20==='/'){_0x277d94=_0x277d94[_0xda9c('0x66')](0x0,_0x277d94[_0xda9c('0x67')](_0x3cee20));}var _0x20dadd={'method':_0xda9c('0x68'),'uri':util[_0xda9c('0x69')](_0xda9c('0x6a'),_0x277d94,_0xda9c('0x6b')),'json':!![]};switch(_0x2e139d['authType']){case _0xda9c('0x64'):_0x20dadd['headers']={'Authorization':util[_0xda9c('0x69')]('Basic\x20%s',new Buffer(util[_0xda9c('0x69')](_0xda9c('0x6c'),_0x2e139d['username'],_0x2e139d['password']))['toString'](_0xda9c('0x6d')))};break;case'token':_0x20dadd[_0xda9c('0x6e')]={'Authorization':util['format'](_0xda9c('0x6f'),new Buffer(util['format'](_0xda9c('0x70'),_0x2e139d[_0xda9c('0x63')],_0x2e139d[_0xda9c('0x71')]))[_0xda9c('0x72')]('base64'))};break;default:throw new db[(_0xda9c('0x73'))][(_0xda9c('0x1c'))](_0xda9c('0x74'));}return rp(_0x20dadd);}})['then'](function(_0x3eb6cc){if(_0x3eb6cc){var _0x5802ff=[_0xda9c('0x75'),_0xda9c('0x76'),'group',_0xda9c('0x77')];_[_0xda9c('0x78')](_0x3eb6cc['ticket_fields'],function(_0x19bdb3){return _0x5802ff[_0xda9c('0x79')](_0x19bdb3[_0xda9c('0x3a')]);});return{'count':_0x3eb6cc['ticket_fields']['length'],'rows':_[_0xda9c('0x36')](_0x3eb6cc[_0xda9c('0x6b')],function(_0x5b501c){return{'id':_0x5b501c['id'],'name':_0x5b501c[_0xda9c('0x7a')]>0x7?_0x5b501c[_0xda9c('0x7b')]:_0x5b501c['type'],'custom':_0x5b501c['position']>0x7?!![]:![],'options':_0x5b501c[_0xda9c('0x7c')]?_0x5b501c['system_field_options']:_0x5b501c[_0xda9c('0x7d')]?_0x5b501c[_0xda9c('0x7d')]:[]};})};}})[_0xda9c('0x1e')](respondWithResult(_0x2f0b96,null))[_0xda9c('0x26')](function(_0x5a31c0){var _0x51ce97=_0x137311['query'][_0xda9c('0x1b')]?0x1f4:_0x5a31c0[_0xda9c('0x7e')]||0x1f4;logger[_0xda9c('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0xda9c('0x62'),_0x51ce97,JSON[_0xda9c('0x22')](_0x5a31c0));delete _0x5a31c0[_0xda9c('0x33')];if(_0x51ce97===0x191){_0x51ce97=0x190;}_0x2f0b96['status'](_0x51ce97)[_0xda9c('0x34')](_0x137311[_0xda9c('0x3c')][_0xda9c('0x1b')]?{'message':_0xda9c('0x7f'),'statusCode':_0x5a31c0[_0xda9c('0x7e')]}:_0x5a31c0);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index a5bb372..4ae1c9f 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 _0x4df5=['../../config/logger','api','path','rimraf','../../config/environment','./intZendeskAccount.attributes','define','int_zendesk_accounts','util'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x4df5,0x131));var _0x54df=function(_0x36e30a,_0x2cc141){_0x36e30a=_0x36e30a-0x0;var _0x3176b2=_0x4df5[_0x36e30a];return _0x3176b2;};'use strict';var _=require('lodash');var util=require(_0x54df('0x0'));var logger=require(_0x54df('0x1'))(_0x54df('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x54df('0x3'));var rimraf=require(_0x54df('0x4'));var config=require(_0x54df('0x5'));var attributes=require(_0x54df('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x217a61,_0x10260e){return _0x217a61[_0x54df('0x7')]('ZendeskAccount',attributes,{'tableName':_0x54df('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x031a=['../../config/environment','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x3493e8,_0x50e613){var _0x23c1dc=function(_0x14ce4){while(--_0x14ce4){_0x3493e8['push'](_0x3493e8['shift']());}};_0x23c1dc(++_0x50e613);}(_0x031a,0x13e));var _0xa031=function(_0x344281,_0x209ab1){_0x344281=_0x344281-0x0;var _0x5e7acf=_0x031a[_0x344281];return _0x5e7acf;};'use strict';var _=require(_0xa031('0x0'));var util=require(_0xa031('0x1'));var logger=require(_0xa031('0x2'))('api');var moment=require(_0xa031('0x3'));var BPromise=require(_0xa031('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa031('0x5'));var rimraf=require(_0xa031('0x6'));var config=require(_0xa031('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xa031('0x8'));module[_0xa031('0x9')]=function(_0x6f4a60,_0x191c62){return _0x6f4a60[_0xa031('0xa')](_0xa031('0xb'),attributes,{'tableName':_0xa031('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index cd4d501..0eed6b5 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 _0xa9e0=['code','error','message','result','catch','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model','GetZendeskAccount','stringify','ShowZendeskAccount','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x258919,_0x1754e6){var _0xfbd68b=function(_0x3bc3e9){while(--_0x3bc3e9){_0x258919['push'](_0x258919['shift']());}};_0xfbd68b(++_0x1754e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetZendeskAccount']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowZendeskAccount',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xbaf0=['ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','model','map','ShowZendeskAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetZendeskAccount',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowZendeskAccount',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 84669d3..9514f97 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 _0x610c=['get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','setTags','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./intZendeskConfiguration.controller'];(function(_0x48395a,_0x599b9d){var _0x67b3c0=function(_0x1cdb7e){while(--_0x1cdb7e){_0x48395a['push'](_0x48395a['shift']());}};_0x67b3c0(++_0x599b9d);}(_0x610c,0x157));var _0xc610=function(_0x32f12e,_0x2439a8){_0x32f12e=_0x32f12e-0x0;var _0x517bac=_0x610c[_0x32f12e];return _0x517bac;};'use strict';var multer=require('multer');var util=require(_0xc610('0x0'));var path=require(_0xc610('0x1'));var timeout=require(_0xc610('0x2'));var express=require(_0xc610('0x3'));var router=express[_0xc610('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc610('0x5'));var controller=require(_0xc610('0x6'));router[_0xc610('0x7')]('/',auth[_0xc610('0x8')](),controller[_0xc610('0x9')]);router[_0xc610('0x7')](_0xc610('0xa'),auth[_0xc610('0x8')](),controller['show']);router[_0xc610('0x7')](_0xc610('0xb'),auth[_0xc610('0x8')](),controller[_0xc610('0xc')]);router[_0xc610('0x7')](_0xc610('0xd'),auth[_0xc610('0x8')](),controller[_0xc610('0xe')]);router[_0xc610('0x7')](_0xc610('0xf'),auth[_0xc610('0x8')](),controller[_0xc610('0x10')]);router[_0xc610('0x7')](_0xc610('0x11'),auth['isAuthenticated'](),controller['getTags']);router['post']('/',auth[_0xc610('0x8')](),controller[_0xc610('0x12')]);router[_0xc610('0x13')](_0xc610('0x11'),auth[_0xc610('0x8')](),controller[_0xc610('0x14')]);router['put'](_0xc610('0xa'),auth[_0xc610('0x8')](),controller[_0xc610('0x15')]);router[_0xc610('0x16')](_0xc610('0xa'),auth['isAuthenticated'](),controller[_0xc610('0x17')]);module[_0xc610('0x18')]=router; \ No newline at end of file +var _0x271b=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','get','isAuthenticated','index','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','/:id','update','delete','util','path'];(function(_0x56c7c0,_0x463d97){var _0x666b9a=function(_0x56e4a5){while(--_0x56e4a5){_0x56c7c0['push'](_0x56c7c0['shift']());}};_0x666b9a(++_0x463d97);}(_0x271b,0x6c));var _0xb271=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x271b[_0x5b561d];return _0x431060;};'use strict';var multer=require('multer');var util=require(_0xb271('0x0'));var path=require(_0xb271('0x1'));var timeout=require(_0xb271('0x2'));var express=require(_0xb271('0x3'));var router=express[_0xb271('0x4')]();var auth=require(_0xb271('0x5'));var interaction=require(_0xb271('0x6'));var config=require('../../config/environment');var controller=require(_0xb271('0x7'));router[_0xb271('0x8')]('/',auth[_0xb271('0x9')](),controller[_0xb271('0xa')]);router[_0xb271('0x8')]('/:id',auth[_0xb271('0x9')](),controller['show']);router['get']('/:id/fields',auth[_0xb271('0x9')](),controller[_0xb271('0xb')]);router[_0xb271('0x8')]('/:id/subjects',auth[_0xb271('0x9')](),controller[_0xb271('0xc')]);router[_0xb271('0x8')](_0xb271('0xd'),auth['isAuthenticated'](),controller[_0xb271('0xe')]);router[_0xb271('0x8')](_0xb271('0xf'),auth[_0xb271('0x9')](),controller['getTags']);router[_0xb271('0x10')]('/',auth[_0xb271('0x9')](),controller[_0xb271('0x11')]);router[_0xb271('0x10')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0xb271('0x12')](_0xb271('0x13'),auth[_0xb271('0x9')](),controller[_0xb271('0x14')]);router[_0xb271('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 27fc0b9..4027b8d 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 _0x8083=['sequelize','exports','STRING'];(function(_0x164f62,_0x273b05){var _0x7ae05d=function(_0x4613dd){while(--_0x4613dd){_0x164f62['push'](_0x164f62['shift']());}};_0x7ae05d(++_0x273b05);}(_0x8083,0x1bf));var _0x3808=function(_0x4e1a49,_0x4da738){_0x4e1a49=_0x4e1a49-0x0;var _0x136aae=_0x8083[_0x4e1a49];return _0x136aae;};'use strict';var Sequelize=require(_0x3808('0x0'));module[_0x3808('0x1')]={'name':{'type':Sequelize[_0x3808('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc6f2=['sequelize','STRING'];(function(_0x27214c,_0x491dd3){var _0x33a218=function(_0x2d3f98){while(--_0x2d3f98){_0x27214c['push'](_0x27214c['shift']());}};_0x33a218(++_0x491dd3);}(_0xc6f2,0x16e));var _0x2c6f=function(_0x2ead3e,_0x20d65c){_0x2ead3e=_0x2ead3e-0x0;var _0x2618ed=_0xc6f2[_0x2ead3e];return _0x2618ed;};'use strict';var Sequelize=require(_0x2c6f('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2c6f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 0d177cf..ac157db 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 _0xb64b=['path','sox','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','index','map','rawAttributes','fieldName','type','key','model','name','keys','filters','intersection','attributes','fields','query','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','ZendeskConfiguration','findAll','rows','show','params','find','create','body','getFields','findOne','ZendeskField','hasOwnProperty','getSubjects','length','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util'];(function(_0x3c9dbb,_0x51eb6f){var _0x17721b=function(_0x501aed){while(--_0x501aed){_0x3c9dbb['push'](_0x3c9dbb['shift']());}};_0x17721b(++_0x51eb6f);}(_0xb64b,0x1e8));var _0xbb64=function(_0x21e0a9,_0x5edd42){_0x21e0a9=_0x21e0a9-0x0;var _0x2a12f5=_0xb64b[_0x21e0a9];return _0x2a12f5;};'use strict';var pdf=require(_0xbb64('0x0'));var emlformat=require(_0xbb64('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbb64('0x2'));var jsonpatch=require(_0xbb64('0x3'));var rp=require('request-promise');var moment=require(_0xbb64('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb64('0x5'));var util=require(_0xbb64('0x6'));var path=require(_0xbb64('0x7'));var sox=require(_0xbb64('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xbb64('0x9'));var crypto=require('crypto');var jsforce=require(_0xbb64('0xa'));var deskjs=require(_0xbb64('0xb'));var toCsv=require(_0xbb64('0xc'));var querystring=require(_0xbb64('0xd'));var Papa=require(_0xbb64('0xe'));var Redis=require('ioredis');var authService=require(_0xbb64('0xf'));var qs=require(_0xbb64('0x10'));var as=require(_0xbb64('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbb64('0x12'))(_0xbb64('0x13'));var utils=require(_0xbb64('0x14'));var config=require(_0xbb64('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0xbb64('0x16'));var client=jayson['client'][_0xbb64('0x17')]({'port':0x232a});function checkPasswordPattern(_0x20e0cd,_0x6e44e0,_0x47d851){if(_0x47d851){var _0x5addc1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5addc1[_0xbb64('0x18')](_0x6e44e0)){return _0x20e0cd;}else{throw new db[(_0xbb64('0x19'))][(_0xbb64('0x1a'))](_0xbb64('0x1b'));}}else{return _0x20e0cd;}}function respondWithRpcPromise(_0x263fdc,_0x120fd9,_0xc76d56,_0x30f07b){return new BPromise(function(_0x509f91,_0x3e7cbd){var _0x5d3bd6=_0x30f07b||client;return _0x5d3bd6[_0xbb64('0x1c')](_0x263fdc,_0xc76d56)['then'](function(_0x2ef763){logger[_0xbb64('0x1d')](_0xbb64('0x1e'),_0x120fd9,_0xbb64('0x1f'));logger[_0xbb64('0x20')](_0xbb64('0x21'),_0x120fd9,_0xbb64('0x1f'),JSON[_0xbb64('0x22')](_0x2ef763));if(_0x2ef763[_0xbb64('0x23')]){if(_0x2ef763[_0xbb64('0x23')][_0xbb64('0x24')]===0x1f4){logger[_0xbb64('0x23')](_0xbb64('0x1e'),_0x120fd9,_0x2ef763[_0xbb64('0x23')][_0xbb64('0x25')]);return _0x3e7cbd(_0x2ef763[_0xbb64('0x23')][_0xbb64('0x25')]);}logger[_0xbb64('0x23')]('ZendeskConfiguration,\x20%s,\x20%s',_0x120fd9,_0x2ef763[_0xbb64('0x23')][_0xbb64('0x25')]);return _0x509f91(_0x2ef763['error'][_0xbb64('0x25')]);}else{logger[_0xbb64('0x1d')](_0xbb64('0x1e'),_0x120fd9,_0xbb64('0x1f'));_0x509f91(_0x2ef763[_0xbb64('0x26')][_0xbb64('0x25')]);}})[_0xbb64('0x27')](function(_0x3338ed){logger[_0xbb64('0x23')](_0xbb64('0x1e'),_0x120fd9,_0x3338ed);_0x3e7cbd(_0x3338ed);});});}function respondWithStatusCode(_0x21d560,_0x33680a){_0x33680a=_0x33680a||0xcc;return function(_0x3f7be2){if(_0x3f7be2){return _0x21d560['sendStatus'](_0x33680a);}return _0x21d560[_0xbb64('0x28')](_0x33680a)[_0xbb64('0x29')]();};}function respondWithResult(_0x16ed2c,_0x1ab6af){_0x1ab6af=_0x1ab6af||0xc8;return function(_0x5f4dd3){if(_0x5f4dd3){return _0x16ed2c[_0xbb64('0x28')](_0x1ab6af)[_0xbb64('0x2a')](_0x5f4dd3);}};}function respondWithFilteredResult(_0x58a722,_0x588029){return function(_0x30f11f){if(_0x30f11f){var _0x5c2ad1=_0x30f11f[_0xbb64('0x2b')],_0x5d6ea7=_0x588029[_0xbb64('0x2c')],_0x1ed7a9=_0x588029[_0xbb64('0x2c')]+_0x588029[_0xbb64('0x2d')],_0x4418c9;if(_0x1ed7a9>=_0x5c2ad1){_0x1ed7a9=_0x5c2ad1;_0x4418c9=0xc8;}else{_0x4418c9=0xce;}_0x58a722['status'](_0x4418c9);return _0x58a722[_0xbb64('0x2e')](_0xbb64('0x2f'),_0x5d6ea7+'-'+_0x1ed7a9+'/'+_0x5c2ad1)['json'](_0x30f11f);}return null;};}function patchUpdates(_0x3adfa6){return function(_0x1534a9){try{jsonpatch[_0xbb64('0x30')](_0x1534a9,_0x3adfa6,!![]);}catch(_0x1cd6e3){return BPromise[_0xbb64('0x31')](_0x1cd6e3);}return _0x1534a9[_0xbb64('0x32')]();};}function saveUpdates(_0x1b014c,_0x4aea76){return function(_0x43f3b0){if(_0x43f3b0){return _0x43f3b0[_0xbb64('0x33')](_0x1b014c)['then'](function(_0x2e8ac9){return _0x2e8ac9;});}return null;};}function removeEntity(_0xa8f2da,_0x2a99d9){return function(_0x422fa1){if(_0x422fa1){return _0x422fa1[_0xbb64('0x34')]()[_0xbb64('0x35')](function(){_0xa8f2da[_0xbb64('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x491fca,_0x312968){return function(_0x13e054){if(!_0x13e054){_0x491fca[_0xbb64('0x36')](0x194);}return _0x13e054;};}function handleError(_0x407330,_0xed10a0){_0xed10a0=_0xed10a0||0x1f4;return function(_0x17384a){logger['error'](_0x17384a[_0xbb64('0x37')]);if(_0x17384a['name']){delete _0x17384a['name'];}_0x407330[_0xbb64('0x28')](_0xed10a0)['send'](_0x17384a);};}exports[_0xbb64('0x38')]=function(_0x50f14d,_0x584f7c){var _0x536fbb={},_0x341398={},_0x3cd147={'count':0x0,'rows':[]};var _0x53538a=_[_0xbb64('0x39')](db['ZendeskConfiguration'][_0xbb64('0x3a')],function(_0x1b3c88){return{'name':_0x1b3c88[_0xbb64('0x3b')],'type':_0x1b3c88[_0xbb64('0x3c')][_0xbb64('0x3d')]};});_0x341398[_0xbb64('0x3e')]=_[_0xbb64('0x39')](_0x53538a,_0xbb64('0x3f'));_0x341398['query']=_[_0xbb64('0x40')](_0x50f14d['query']);_0x341398[_0xbb64('0x41')]=_[_0xbb64('0x42')](_0x341398[_0xbb64('0x3e')],_0x341398['query']);_0x536fbb[_0xbb64('0x43')]=_[_0xbb64('0x42')](_0x341398[_0xbb64('0x3e')],qs[_0xbb64('0x44')](_0x50f14d[_0xbb64('0x45')][_0xbb64('0x44')]));_0x536fbb['attributes']=_0x536fbb[_0xbb64('0x43')]['length']?_0x536fbb[_0xbb64('0x43')]:_0x341398[_0xbb64('0x3e')];if(!_0x50f14d[_0xbb64('0x45')]['hasOwnProperty'](_0xbb64('0x46'))){_0x536fbb[_0xbb64('0x2d')]=qs[_0xbb64('0x2d')](_0x50f14d[_0xbb64('0x45')]['limit']);_0x536fbb[_0xbb64('0x2c')]=qs['offset'](_0x50f14d['query'][_0xbb64('0x2c')]);}_0x536fbb[_0xbb64('0x47')]=qs[_0xbb64('0x48')](_0x50f14d[_0xbb64('0x45')][_0xbb64('0x48')]);_0x536fbb[_0xbb64('0x49')]=qs[_0xbb64('0x41')](_[_0xbb64('0x4a')](_0x50f14d[_0xbb64('0x45')],_0x341398[_0xbb64('0x41')]),_0x53538a);if(_0x50f14d[_0xbb64('0x45')][_0xbb64('0x4b')]){_0x536fbb[_0xbb64('0x49')]=_[_0xbb64('0x4c')](_0x536fbb['where'],{'$or':_[_0xbb64('0x39')](_0x53538a,function(_0x440704){if(_0x440704[_0xbb64('0x3c')]!==_0xbb64('0x4d')){var _0x1fce58={};_0x1fce58[_0x440704[_0xbb64('0x3f')]]={'$like':'%'+_0x50f14d['query'][_0xbb64('0x4b')]+'%'};return _0x1fce58;}})});}_0x536fbb=_[_0xbb64('0x4c')]({},_0x536fbb,_0x50f14d[_0xbb64('0x4e')]);var _0x4c54cb={'where':_0x536fbb[_0xbb64('0x49')]};return db['ZendeskConfiguration'][_0xbb64('0x2b')](_0x4c54cb)['then'](function(_0x1ce5a0){_0x3cd147['count']=_0x1ce5a0;if(_0x50f14d[_0xbb64('0x45')][_0xbb64('0x4f')]){_0x536fbb[_0xbb64('0x50')]=[{'all':!![]}];}return db[_0xbb64('0x51')][_0xbb64('0x52')](_0x536fbb);})[_0xbb64('0x35')](function(_0x133868){_0x3cd147[_0xbb64('0x53')]=_0x133868;return _0x3cd147;})[_0xbb64('0x35')](respondWithFilteredResult(_0x584f7c,_0x536fbb))[_0xbb64('0x27')](handleError(_0x584f7c,null));};exports[_0xbb64('0x54')]=function(_0x5b0096,_0xb3d587){var _0x3695c3={'raw':![],'where':{'id':_0x5b0096[_0xbb64('0x55')]['id']}},_0x38c0cc={};_0x38c0cc[_0xbb64('0x3e')]=_[_0xbb64('0x40')](db[_0xbb64('0x51')][_0xbb64('0x3a')]);_0x38c0cc[_0xbb64('0x45')]=_[_0xbb64('0x40')](_0x5b0096['query']);_0x38c0cc['filters']=_['intersection'](_0x38c0cc[_0xbb64('0x3e')],_0x38c0cc['query']);_0x3695c3[_0xbb64('0x43')]=_['intersection'](_0x38c0cc['model'],qs[_0xbb64('0x44')](_0x5b0096['query'][_0xbb64('0x44')]));_0x3695c3[_0xbb64('0x43')]=_0x3695c3[_0xbb64('0x43')]['length']?_0x3695c3['attributes']:_0x38c0cc[_0xbb64('0x3e')];if(_0x5b0096[_0xbb64('0x45')][_0xbb64('0x4f')]){_0x3695c3[_0xbb64('0x50')]=[{'all':!![]}];}_0x3695c3=_[_0xbb64('0x4c')]({},_0x3695c3,_0x5b0096['options']);return db['ZendeskConfiguration'][_0xbb64('0x56')](_0x3695c3)['then'](handleEntityNotFound(_0xb3d587,null))['then'](respondWithResult(_0xb3d587,null))[_0xbb64('0x27')](handleError(_0xb3d587,null));};exports['create']=function(_0x558ecc,_0xc9a23d){return db[_0xbb64('0x51')][_0xbb64('0x57')](_0x558ecc['body'],{})[_0xbb64('0x35')](respondWithResult(_0xc9a23d,0xc9))[_0xbb64('0x27')](handleError(_0xc9a23d,null));};exports[_0xbb64('0x33')]=function(_0x24ddb1,_0x52afb5){if(_0x24ddb1[_0xbb64('0x58')]['id']){delete _0x24ddb1[_0xbb64('0x58')]['id'];}return db[_0xbb64('0x51')][_0xbb64('0x56')]({'where':{'id':_0x24ddb1['params']['id']}})[_0xbb64('0x35')](handleEntityNotFound(_0x52afb5,null))[_0xbb64('0x35')](saveUpdates(_0x24ddb1[_0xbb64('0x58')],null))[_0xbb64('0x35')](respondWithResult(_0x52afb5,null))[_0xbb64('0x27')](handleError(_0x52afb5,null));};exports[_0xbb64('0x34')]=function(_0x1b87cb,_0xde9d50){return db[_0xbb64('0x51')][_0xbb64('0x56')]({'where':{'id':_0x1b87cb['params']['id']}})[_0xbb64('0x35')](handleEntityNotFound(_0xde9d50,null))[_0xbb64('0x35')](removeEntity(_0xde9d50,null))[_0xbb64('0x27')](handleError(_0xde9d50,null));};exports[_0xbb64('0x59')]=function(_0x38dd71,_0x361c3f,_0xa861bc){var _0x49aee9={};var _0x1153a7={};var _0x109aae;var _0x11d787;return db[_0xbb64('0x51')][_0xbb64('0x5a')]({'where':{'id':_0x38dd71['params']['id']}})[_0xbb64('0x35')](handleEntityNotFound(_0x361c3f,null))[_0xbb64('0x35')](function(_0xe81714){if(_0xe81714){_0x109aae=_0xe81714;_0x1153a7['model']=_[_0xbb64('0x40')](db[_0xbb64('0x5b')][_0xbb64('0x3a')]);_0x1153a7[_0xbb64('0x45')]=_['keys'](_0x38dd71['query']);_0x1153a7['filters']=_[_0xbb64('0x42')](_0x1153a7[_0xbb64('0x3e')],_0x1153a7[_0xbb64('0x45')]);_0x49aee9[_0xbb64('0x43')]=_[_0xbb64('0x42')](_0x1153a7[_0xbb64('0x3e')],qs[_0xbb64('0x44')](_0x38dd71[_0xbb64('0x45')][_0xbb64('0x44')]));_0x49aee9['attributes']=_0x49aee9[_0xbb64('0x43')]['length']?_0x49aee9[_0xbb64('0x43')]:_0x1153a7[_0xbb64('0x3e')];_0x49aee9[_0xbb64('0x47')]=qs['sort'](_0x38dd71[_0xbb64('0x45')][_0xbb64('0x48')]);_0x49aee9[_0xbb64('0x49')]=qs[_0xbb64('0x41')](_[_0xbb64('0x4a')](_0x38dd71[_0xbb64('0x45')],_0x1153a7[_0xbb64('0x41')]));if(_0x38dd71[_0xbb64('0x45')][_0xbb64('0x4b')]){_0x49aee9[_0xbb64('0x49')]=_[_0xbb64('0x4c')](_0x49aee9[_0xbb64('0x49')],{'$or':_[_0xbb64('0x39')](_0x49aee9[_0xbb64('0x43')],function(_0x2950b9){var _0x3cba7b={};_0x3cba7b[_0x2950b9]={'$like':'%'+_0x38dd71[_0xbb64('0x45')][_0xbb64('0x4b')]+'%'};return _0x3cba7b;})});}_0x49aee9=_[_0xbb64('0x4c')]({},_0x49aee9,_0x38dd71['options']);return _0x109aae[_0xbb64('0x59')](_0x49aee9);}})[_0xbb64('0x35')](function(_0x348836){if(_0x348836){_0x11d787=_0x348836['length'];if(!_0x38dd71['query'][_0xbb64('0x5c')](_0xbb64('0x46'))){_0x49aee9[_0xbb64('0x2d')]=qs[_0xbb64('0x2d')](_0x38dd71[_0xbb64('0x45')][_0xbb64('0x2d')]);_0x49aee9[_0xbb64('0x2c')]=qs[_0xbb64('0x2c')](_0x38dd71['query']['offset']);}return _0x109aae[_0xbb64('0x59')](_0x49aee9);}})[_0xbb64('0x35')](function(_0x32113c){if(_0x32113c){return _0x32113c?{'count':_0x11d787,'rows':_0x32113c}:null;}})[_0xbb64('0x35')](respondWithResult(_0x361c3f,null))[_0xbb64('0x27')](handleError(_0x361c3f,null));};exports[_0xbb64('0x5d')]=function(_0x212e53,_0x3af91f,_0x389864){var _0xb6cfd6={};var _0x31776d={};var _0x16544c;var _0x24fd40;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x212e53[_0xbb64('0x55')]['id']}})[_0xbb64('0x35')](handleEntityNotFound(_0x3af91f,null))[_0xbb64('0x35')](function(_0x3baf72){if(_0x3baf72){_0x16544c=_0x3baf72;_0x31776d['model']=_[_0xbb64('0x40')](db[_0xbb64('0x5b')][_0xbb64('0x3a')]);_0x31776d[_0xbb64('0x45')]=_['keys'](_0x212e53[_0xbb64('0x45')]);_0x31776d[_0xbb64('0x41')]=_[_0xbb64('0x42')](_0x31776d[_0xbb64('0x3e')],_0x31776d['query']);_0xb6cfd6[_0xbb64('0x43')]=_[_0xbb64('0x42')](_0x31776d[_0xbb64('0x3e')],qs[_0xbb64('0x44')](_0x212e53['query']['fields']));_0xb6cfd6[_0xbb64('0x43')]=_0xb6cfd6[_0xbb64('0x43')]['length']?_0xb6cfd6[_0xbb64('0x43')]:_0x31776d[_0xbb64('0x3e')];_0xb6cfd6[_0xbb64('0x47')]=qs[_0xbb64('0x48')](_0x212e53[_0xbb64('0x45')][_0xbb64('0x48')]);_0xb6cfd6[_0xbb64('0x49')]=qs['filters'](_[_0xbb64('0x4a')](_0x212e53[_0xbb64('0x45')],_0x31776d['filters']));if(_0x212e53[_0xbb64('0x45')][_0xbb64('0x4b')]){_0xb6cfd6[_0xbb64('0x49')]=_[_0xbb64('0x4c')](_0xb6cfd6[_0xbb64('0x49')],{'$or':_[_0xbb64('0x39')](_0xb6cfd6[_0xbb64('0x43')],function(_0x6545d0){var _0x1212ee={};_0x1212ee[_0x6545d0]={'$like':'%'+_0x212e53[_0xbb64('0x45')]['filter']+'%'};return _0x1212ee;})});}_0xb6cfd6=_[_0xbb64('0x4c')]({},_0xb6cfd6,_0x212e53[_0xbb64('0x4e')]);return _0x16544c[_0xbb64('0x5d')](_0xb6cfd6);}})[_0xbb64('0x35')](function(_0x2169e8){if(_0x2169e8){_0x24fd40=_0x2169e8['length'];if(!_0x212e53['query'][_0xbb64('0x5c')]('nolimit')){_0xb6cfd6[_0xbb64('0x2d')]=qs['limit'](_0x212e53[_0xbb64('0x45')]['limit']);_0xb6cfd6[_0xbb64('0x2c')]=qs[_0xbb64('0x2c')](_0x212e53[_0xbb64('0x45')]['offset']);}return _0x16544c['getSubjects'](_0xb6cfd6);}})['then'](function(_0x11f68c){if(_0x11f68c){return _0x11f68c?{'count':_0x24fd40,'rows':_0x11f68c}:null;}})[_0xbb64('0x35')](respondWithResult(_0x3af91f,null))['catch'](handleError(_0x3af91f,null));};exports['getDescriptions']=function(_0x835341,_0x4d2746,_0xea3a51){var _0x1f0b9c={};var _0x5e77d4={};var _0x3da9f8;var _0x498450;return db[_0xbb64('0x51')][_0xbb64('0x5a')]({'where':{'id':_0x835341['params']['id']}})['then'](handleEntityNotFound(_0x4d2746,null))[_0xbb64('0x35')](function(_0x535c26){if(_0x535c26){_0x3da9f8=_0x535c26;_0x5e77d4[_0xbb64('0x3e')]=_[_0xbb64('0x40')](db[_0xbb64('0x5b')][_0xbb64('0x3a')]);_0x5e77d4['query']=_[_0xbb64('0x40')](_0x835341[_0xbb64('0x45')]);_0x5e77d4[_0xbb64('0x41')]=_[_0xbb64('0x42')](_0x5e77d4[_0xbb64('0x3e')],_0x5e77d4[_0xbb64('0x45')]);_0x1f0b9c[_0xbb64('0x43')]=_[_0xbb64('0x42')](_0x5e77d4['model'],qs[_0xbb64('0x44')](_0x835341[_0xbb64('0x45')][_0xbb64('0x44')]));_0x1f0b9c['attributes']=_0x1f0b9c[_0xbb64('0x43')][_0xbb64('0x5e')]?_0x1f0b9c['attributes']:_0x5e77d4['model'];_0x1f0b9c['order']=qs[_0xbb64('0x48')](_0x835341[_0xbb64('0x45')][_0xbb64('0x48')]);_0x1f0b9c[_0xbb64('0x49')]=qs[_0xbb64('0x41')](_[_0xbb64('0x4a')](_0x835341[_0xbb64('0x45')],_0x5e77d4[_0xbb64('0x41')]));if(_0x835341[_0xbb64('0x45')][_0xbb64('0x4b')]){_0x1f0b9c[_0xbb64('0x49')]=_[_0xbb64('0x4c')](_0x1f0b9c[_0xbb64('0x49')],{'$or':_[_0xbb64('0x39')](_0x1f0b9c[_0xbb64('0x43')],function(_0xacfeef){var _0x2e60aa={};_0x2e60aa[_0xacfeef]={'$like':'%'+_0x835341['query'][_0xbb64('0x4b')]+'%'};return _0x2e60aa;})});}_0x1f0b9c=_['merge']({},_0x1f0b9c,_0x835341[_0xbb64('0x4e')]);return _0x3da9f8[_0xbb64('0x5f')](_0x1f0b9c);}})[_0xbb64('0x35')](function(_0x446361){if(_0x446361){_0x498450=_0x446361[_0xbb64('0x5e')];if(!_0x835341[_0xbb64('0x45')][_0xbb64('0x5c')]('nolimit')){_0x1f0b9c[_0xbb64('0x2d')]=qs[_0xbb64('0x2d')](_0x835341[_0xbb64('0x45')][_0xbb64('0x2d')]);_0x1f0b9c[_0xbb64('0x2c')]=qs[_0xbb64('0x2c')](_0x835341[_0xbb64('0x45')][_0xbb64('0x2c')]);}return _0x3da9f8[_0xbb64('0x5f')](_0x1f0b9c);}})['then'](function(_0xc6e6ec){if(_0xc6e6ec){return _0xc6e6ec?{'count':_0x498450,'rows':_0xc6e6ec}:null;}})['then'](respondWithResult(_0x4d2746,null))[_0xbb64('0x27')](handleError(_0x4d2746,null));};exports['getTags']=function(_0x42726b,_0x46529,_0x264e75){var _0xfceb97={};var _0x121a9c={};var _0x2703b2;var _0x4e6f08;return db[_0xbb64('0x51')][_0xbb64('0x5a')]({'where':{'id':_0x42726b[_0xbb64('0x55')]['id']}})[_0xbb64('0x35')](handleEntityNotFound(_0x46529,null))[_0xbb64('0x35')](function(_0x36d326){if(_0x36d326){_0x2703b2=_0x36d326;_0x121a9c[_0xbb64('0x3e')]=_['keys'](db['Tag'][_0xbb64('0x3a')]);_0x121a9c['query']=_[_0xbb64('0x40')](_0x42726b[_0xbb64('0x45')]);_0x121a9c[_0xbb64('0x41')]=_['intersection'](_0x121a9c['model'],_0x121a9c[_0xbb64('0x45')]);_0xfceb97[_0xbb64('0x43')]=_[_0xbb64('0x42')](_0x121a9c[_0xbb64('0x3e')],qs['fields'](_0x42726b[_0xbb64('0x45')]['fields']));_0xfceb97[_0xbb64('0x43')]=_0xfceb97['attributes']['length']?_0xfceb97[_0xbb64('0x43')]:_0x121a9c[_0xbb64('0x3e')];_0xfceb97[_0xbb64('0x47')]=qs[_0xbb64('0x48')](_0x42726b[_0xbb64('0x45')]['sort']);_0xfceb97['where']=qs[_0xbb64('0x41')](_[_0xbb64('0x4a')](_0x42726b[_0xbb64('0x45')],_0x121a9c[_0xbb64('0x41')]));if(_0x42726b[_0xbb64('0x45')]['filter']){_0xfceb97[_0xbb64('0x49')]=_[_0xbb64('0x4c')](_0xfceb97[_0xbb64('0x49')],{'$or':_['map'](_0xfceb97[_0xbb64('0x43')],function(_0x379ad2){var _0x2d6600={};_0x2d6600[_0x379ad2]={'$like':'%'+_0x42726b['query'][_0xbb64('0x4b')]+'%'};return _0x2d6600;})});}_0xfceb97=_['merge']({},_0xfceb97,_0x42726b[_0xbb64('0x4e')]);return _0x2703b2[_0xbb64('0x60')](_0xfceb97);}})[_0xbb64('0x35')](function(_0xfd071d){if(_0xfd071d){_0x4e6f08=_0xfd071d[_0xbb64('0x5e')];if(!_0x42726b['query'][_0xbb64('0x5c')]('nolimit')){_0xfceb97[_0xbb64('0x2d')]=qs[_0xbb64('0x2d')](_0x42726b[_0xbb64('0x45')]['limit']);_0xfceb97['offset']=qs[_0xbb64('0x2c')](_0x42726b['query']['offset']);}return _0x2703b2[_0xbb64('0x60')](_0xfceb97);}})[_0xbb64('0x35')](function(_0x892d86){if(_0x892d86){return _0x892d86?{'count':_0x4e6f08,'rows':_0x892d86}:null;}})[_0xbb64('0x35')](respondWithResult(_0x46529,null))[_0xbb64('0x27')](handleError(_0x46529,null));};exports['setTags']=function(_0x52ff0b,_0x3f95b5,_0x4162ce){if(_0x52ff0b['body']['id']){delete _0x52ff0b[_0xbb64('0x58')]['id'];}return db[_0xbb64('0x51')][_0xbb64('0x5a')]({'where':{'id':_0x52ff0b['params']['id']}})['then'](handleEntityNotFound(_0x3f95b5,null))[_0xbb64('0x35')](function(_0x3fa719){if(_0x3fa719){return _0x3fa719[_0xbb64('0x61')](_0x52ff0b[_0xbb64('0x58')][_0xbb64('0x62')]||[]);}return null;})['then'](respondWithResult(_0x3f95b5,null))[_0xbb64('0x27')](handleError(_0x3f95b5,null));}; \ No newline at end of file +var _0xf3f7=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','show','params','length','find','create','body','getFields','findOne','sort','getSubjects','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','zip-dir'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf3f7,0x179));var _0x7f3f=function(_0x2d2613,_0x1c51c2){_0x2d2613=_0x2d2613-0x0;var _0x5638b3=_0xf3f7[_0x2d2613];return _0x5638b3;};'use strict';var pdf=require(_0x7f3f('0x0'));var emlformat=require(_0x7f3f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7f3f('0x2'));var jsonpatch=require(_0x7f3f('0x3'));var rp=require(_0x7f3f('0x4'));var moment=require('moment');var BPromise=require(_0x7f3f('0x5'));var Mustache=require(_0x7f3f('0x6'));var util=require(_0x7f3f('0x7'));var path=require(_0x7f3f('0x8'));var sox=require(_0x7f3f('0x9'));var csv=require(_0x7f3f('0xa'));var ejs=require(_0x7f3f('0xb'));var fs=require('fs');var _=require(_0x7f3f('0xc'));var squel=require(_0x7f3f('0xd'));var crypto=require(_0x7f3f('0xe'));var jsforce=require(_0x7f3f('0xf'));var deskjs=require(_0x7f3f('0x10'));var toCsv=require(_0x7f3f('0xa'));var querystring=require('querystring');var Papa=require(_0x7f3f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7f3f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f3f('0x13'));var logger=require(_0x7f3f('0x14'))(_0x7f3f('0x15'));var utils=require(_0x7f3f('0x16'));var config=require(_0x7f3f('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7f3f('0x18'));var client=jayson['client'][_0x7f3f('0x19')]({'port':0x232a});function checkPasswordPattern(_0x14a3d8,_0x43ad1f,_0x3bd4ab){if(_0x3bd4ab){var _0x24e8a0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x24e8a0[_0x7f3f('0x1a')](_0x43ad1f)){return _0x14a3d8;}else{throw new db[(_0x7f3f('0x1b'))][(_0x7f3f('0x1c'))](_0x7f3f('0x1d'));}}else{return _0x14a3d8;}}function respondWithRpcPromise(_0x8931cc,_0x56f8d4,_0x3542ab,_0x307400){return new BPromise(function(_0x4968f9,_0x36720c){var _0x5d3e59=_0x307400||client;return _0x5d3e59[_0x7f3f('0x1e')](_0x8931cc,_0x3542ab)[_0x7f3f('0x1f')](function(_0x2ce60c){logger[_0x7f3f('0x20')](_0x7f3f('0x21'),_0x56f8d4,_0x7f3f('0x22'));logger['debug'](_0x7f3f('0x23'),_0x56f8d4,_0x7f3f('0x22'),JSON['stringify'](_0x2ce60c));if(_0x2ce60c[_0x7f3f('0x24')]){if(_0x2ce60c[_0x7f3f('0x24')][_0x7f3f('0x25')]===0x1f4){logger[_0x7f3f('0x24')](_0x7f3f('0x21'),_0x56f8d4,_0x2ce60c[_0x7f3f('0x24')][_0x7f3f('0x26')]);return _0x36720c(_0x2ce60c[_0x7f3f('0x24')][_0x7f3f('0x26')]);}logger[_0x7f3f('0x24')]('ZendeskConfiguration,\x20%s,\x20%s',_0x56f8d4,_0x2ce60c[_0x7f3f('0x24')]['message']);return _0x4968f9(_0x2ce60c[_0x7f3f('0x24')]['message']);}else{logger['info'](_0x7f3f('0x21'),_0x56f8d4,_0x7f3f('0x22'));_0x4968f9(_0x2ce60c[_0x7f3f('0x27')][_0x7f3f('0x26')]);}})[_0x7f3f('0x28')](function(_0x584eb8){logger['error'](_0x7f3f('0x21'),_0x56f8d4,_0x584eb8);_0x36720c(_0x584eb8);});});}function respondWithStatusCode(_0x16c1c1,_0x2c6b68){_0x2c6b68=_0x2c6b68||0xcc;return function(_0x2196a3){if(_0x2196a3){return _0x16c1c1[_0x7f3f('0x29')](_0x2c6b68);}return _0x16c1c1[_0x7f3f('0x2a')](_0x2c6b68)[_0x7f3f('0x2b')]();};}function respondWithResult(_0x2c49d9,_0x38bd21){_0x38bd21=_0x38bd21||0xc8;return function(_0x2a7d2a){if(_0x2a7d2a){return _0x2c49d9[_0x7f3f('0x2a')](_0x38bd21)[_0x7f3f('0x2c')](_0x2a7d2a);}};}function respondWithFilteredResult(_0x4c0d8d,_0x388bb3){return function(_0x32ad55){if(_0x32ad55){var _0x10226e=_0x32ad55[_0x7f3f('0x2d')],_0x6b855=_0x388bb3[_0x7f3f('0x2e')],_0x32c88a=_0x388bb3[_0x7f3f('0x2e')]+_0x388bb3[_0x7f3f('0x2f')],_0x480347;if(_0x32c88a>=_0x10226e){_0x32c88a=_0x10226e;_0x480347=0xc8;}else{_0x480347=0xce;}_0x4c0d8d[_0x7f3f('0x2a')](_0x480347);return _0x4c0d8d[_0x7f3f('0x30')](_0x7f3f('0x31'),_0x6b855+'-'+_0x32c88a+'/'+_0x10226e)['json'](_0x32ad55);}return null;};}function patchUpdates(_0xda656b){return function(_0x341b8d){try{jsonpatch[_0x7f3f('0x32')](_0x341b8d,_0xda656b,!![]);}catch(_0x3d59f4){return BPromise[_0x7f3f('0x33')](_0x3d59f4);}return _0x341b8d[_0x7f3f('0x34')]();};}function saveUpdates(_0xeacef1,_0x2b8532){return function(_0x38c7c1){if(_0x38c7c1){return _0x38c7c1[_0x7f3f('0x35')](_0xeacef1)[_0x7f3f('0x1f')](function(_0x439e06){return _0x439e06;});}return null;};}function removeEntity(_0x1913c1,_0x2db444){return function(_0xe1a34b){if(_0xe1a34b){return _0xe1a34b[_0x7f3f('0x36')]()[_0x7f3f('0x1f')](function(){_0x1913c1[_0x7f3f('0x2a')](0xcc)[_0x7f3f('0x2b')]();});}};}function handleEntityNotFound(_0x4fb289,_0x26c33c){return function(_0x337c4a){if(!_0x337c4a){_0x4fb289[_0x7f3f('0x29')](0x194);}return _0x337c4a;};}function handleError(_0xd14a4b,_0x5bed10){_0x5bed10=_0x5bed10||0x1f4;return function(_0xb0cce8){logger[_0x7f3f('0x24')](_0xb0cce8['stack']);if(_0xb0cce8[_0x7f3f('0x37')]){delete _0xb0cce8[_0x7f3f('0x37')];}_0xd14a4b[_0x7f3f('0x2a')](_0x5bed10)[_0x7f3f('0x38')](_0xb0cce8);};}exports[_0x7f3f('0x39')]=function(_0x514a86,_0xea2d76){var _0x28dd87={},_0x11f570={},_0x240737={'count':0x0,'rows':[]};var _0x27d8fd=_[_0x7f3f('0x3a')](db[_0x7f3f('0x3b')][_0x7f3f('0x3c')],function(_0x2d0f77){return{'name':_0x2d0f77[_0x7f3f('0x3d')],'type':_0x2d0f77[_0x7f3f('0x3e')]['key']};});_0x11f570[_0x7f3f('0x3f')]=_[_0x7f3f('0x3a')](_0x27d8fd,_0x7f3f('0x37'));_0x11f570[_0x7f3f('0x40')]=_[_0x7f3f('0x41')](_0x514a86['query']);_0x11f570[_0x7f3f('0x42')]=_[_0x7f3f('0x43')](_0x11f570[_0x7f3f('0x3f')],_0x11f570[_0x7f3f('0x40')]);_0x28dd87[_0x7f3f('0x44')]=_[_0x7f3f('0x43')](_0x11f570[_0x7f3f('0x3f')],qs[_0x7f3f('0x45')](_0x514a86[_0x7f3f('0x40')]['fields']));_0x28dd87['attributes']=_0x28dd87['attributes']['length']?_0x28dd87[_0x7f3f('0x44')]:_0x11f570[_0x7f3f('0x3f')];if(!_0x514a86[_0x7f3f('0x40')][_0x7f3f('0x46')](_0x7f3f('0x47'))){_0x28dd87[_0x7f3f('0x2f')]=qs['limit'](_0x514a86[_0x7f3f('0x40')][_0x7f3f('0x2f')]);_0x28dd87['offset']=qs[_0x7f3f('0x2e')](_0x514a86['query']['offset']);}_0x28dd87[_0x7f3f('0x48')]=qs['sort'](_0x514a86[_0x7f3f('0x40')]['sort']);_0x28dd87[_0x7f3f('0x49')]=qs[_0x7f3f('0x42')](_[_0x7f3f('0x4a')](_0x514a86[_0x7f3f('0x40')],_0x11f570[_0x7f3f('0x42')]),_0x27d8fd);if(_0x514a86[_0x7f3f('0x40')][_0x7f3f('0x4b')]){_0x28dd87[_0x7f3f('0x49')]=_['merge'](_0x28dd87[_0x7f3f('0x49')],{'$or':_['map'](_0x27d8fd,function(_0x53de81){if(_0x53de81[_0x7f3f('0x3e')]!=='VIRTUAL'){var _0x5a4844={};_0x5a4844[_0x53de81[_0x7f3f('0x37')]]={'$like':'%'+_0x514a86['query']['filter']+'%'};return _0x5a4844;}})});}_0x28dd87=_[_0x7f3f('0x4c')]({},_0x28dd87,_0x514a86[_0x7f3f('0x4d')]);var _0x4a228f={'where':_0x28dd87['where']};return db[_0x7f3f('0x3b')][_0x7f3f('0x2d')](_0x4a228f)[_0x7f3f('0x1f')](function(_0x1c419e){_0x240737['count']=_0x1c419e;if(_0x514a86[_0x7f3f('0x40')][_0x7f3f('0x4e')]){_0x28dd87[_0x7f3f('0x4f')]=[{'all':!![]}];}return db[_0x7f3f('0x3b')][_0x7f3f('0x50')](_0x28dd87);})[_0x7f3f('0x1f')](function(_0x117890){_0x240737['rows']=_0x117890;return _0x240737;})[_0x7f3f('0x1f')](respondWithFilteredResult(_0xea2d76,_0x28dd87))[_0x7f3f('0x28')](handleError(_0xea2d76,null));};exports[_0x7f3f('0x51')]=function(_0xc1ca7d,_0x5d3f2b){var _0x2057d8={'raw':![],'where':{'id':_0xc1ca7d[_0x7f3f('0x52')]['id']}},_0xfb669c={};_0xfb669c[_0x7f3f('0x3f')]=_[_0x7f3f('0x41')](db[_0x7f3f('0x3b')]['rawAttributes']);_0xfb669c[_0x7f3f('0x40')]=_[_0x7f3f('0x41')](_0xc1ca7d[_0x7f3f('0x40')]);_0xfb669c[_0x7f3f('0x42')]=_[_0x7f3f('0x43')](_0xfb669c[_0x7f3f('0x3f')],_0xfb669c[_0x7f3f('0x40')]);_0x2057d8[_0x7f3f('0x44')]=_[_0x7f3f('0x43')](_0xfb669c[_0x7f3f('0x3f')],qs[_0x7f3f('0x45')](_0xc1ca7d[_0x7f3f('0x40')]['fields']));_0x2057d8[_0x7f3f('0x44')]=_0x2057d8['attributes'][_0x7f3f('0x53')]?_0x2057d8[_0x7f3f('0x44')]:_0xfb669c['model'];if(_0xc1ca7d[_0x7f3f('0x40')][_0x7f3f('0x4e')]){_0x2057d8[_0x7f3f('0x4f')]=[{'all':!![]}];}_0x2057d8=_[_0x7f3f('0x4c')]({},_0x2057d8,_0xc1ca7d[_0x7f3f('0x4d')]);return db[_0x7f3f('0x3b')][_0x7f3f('0x54')](_0x2057d8)[_0x7f3f('0x1f')](handleEntityNotFound(_0x5d3f2b,null))['then'](respondWithResult(_0x5d3f2b,null))[_0x7f3f('0x28')](handleError(_0x5d3f2b,null));};exports[_0x7f3f('0x55')]=function(_0x287865,_0x324d12){return db[_0x7f3f('0x3b')]['create'](_0x287865[_0x7f3f('0x56')],{})[_0x7f3f('0x1f')](respondWithResult(_0x324d12,0xc9))[_0x7f3f('0x28')](handleError(_0x324d12,null));};exports[_0x7f3f('0x35')]=function(_0x3e8b60,_0x32e9f7){if(_0x3e8b60[_0x7f3f('0x56')]['id']){delete _0x3e8b60['body']['id'];}return db[_0x7f3f('0x3b')][_0x7f3f('0x54')]({'where':{'id':_0x3e8b60[_0x7f3f('0x52')]['id']}})[_0x7f3f('0x1f')](handleEntityNotFound(_0x32e9f7,null))[_0x7f3f('0x1f')](saveUpdates(_0x3e8b60[_0x7f3f('0x56')],null))[_0x7f3f('0x1f')](respondWithResult(_0x32e9f7,null))[_0x7f3f('0x28')](handleError(_0x32e9f7,null));};exports[_0x7f3f('0x36')]=function(_0x161b05,_0x2f7f48){return db[_0x7f3f('0x3b')][_0x7f3f('0x54')]({'where':{'id':_0x161b05[_0x7f3f('0x52')]['id']}})[_0x7f3f('0x1f')](handleEntityNotFound(_0x2f7f48,null))[_0x7f3f('0x1f')](removeEntity(_0x2f7f48,null))[_0x7f3f('0x28')](handleError(_0x2f7f48,null));};exports[_0x7f3f('0x57')]=function(_0xe7f281,_0x1f185c,_0x3af28f){var _0x3a6b5a={};var _0x325d42={};var _0x335f1a;var _0x1a93a0;return db[_0x7f3f('0x3b')][_0x7f3f('0x58')]({'where':{'id':_0xe7f281['params']['id']}})[_0x7f3f('0x1f')](handleEntityNotFound(_0x1f185c,null))[_0x7f3f('0x1f')](function(_0x150a2a){if(_0x150a2a){_0x335f1a=_0x150a2a;_0x325d42[_0x7f3f('0x3f')]=_['keys'](db['ZendeskField'][_0x7f3f('0x3c')]);_0x325d42[_0x7f3f('0x40')]=_['keys'](_0xe7f281[_0x7f3f('0x40')]);_0x325d42[_0x7f3f('0x42')]=_[_0x7f3f('0x43')](_0x325d42[_0x7f3f('0x3f')],_0x325d42[_0x7f3f('0x40')]);_0x3a6b5a['attributes']=_['intersection'](_0x325d42[_0x7f3f('0x3f')],qs[_0x7f3f('0x45')](_0xe7f281['query'][_0x7f3f('0x45')]));_0x3a6b5a[_0x7f3f('0x44')]=_0x3a6b5a['attributes'][_0x7f3f('0x53')]?_0x3a6b5a['attributes']:_0x325d42[_0x7f3f('0x3f')];_0x3a6b5a[_0x7f3f('0x48')]=qs[_0x7f3f('0x59')](_0xe7f281['query'][_0x7f3f('0x59')]);_0x3a6b5a[_0x7f3f('0x49')]=qs[_0x7f3f('0x42')](_[_0x7f3f('0x4a')](_0xe7f281['query'],_0x325d42[_0x7f3f('0x42')]));if(_0xe7f281[_0x7f3f('0x40')][_0x7f3f('0x4b')]){_0x3a6b5a['where']=_[_0x7f3f('0x4c')](_0x3a6b5a[_0x7f3f('0x49')],{'$or':_['map'](_0x3a6b5a['attributes'],function(_0x13c6e8){var _0x5e20ce={};_0x5e20ce[_0x13c6e8]={'$like':'%'+_0xe7f281['query']['filter']+'%'};return _0x5e20ce;})});}_0x3a6b5a=_[_0x7f3f('0x4c')]({},_0x3a6b5a,_0xe7f281[_0x7f3f('0x4d')]);return _0x335f1a[_0x7f3f('0x57')](_0x3a6b5a);}})[_0x7f3f('0x1f')](function(_0x2e943b){if(_0x2e943b){_0x1a93a0=_0x2e943b[_0x7f3f('0x53')];if(!_0xe7f281[_0x7f3f('0x40')][_0x7f3f('0x46')](_0x7f3f('0x47'))){_0x3a6b5a[_0x7f3f('0x2f')]=qs[_0x7f3f('0x2f')](_0xe7f281[_0x7f3f('0x40')]['limit']);_0x3a6b5a['offset']=qs[_0x7f3f('0x2e')](_0xe7f281[_0x7f3f('0x40')][_0x7f3f('0x2e')]);}return _0x335f1a[_0x7f3f('0x57')](_0x3a6b5a);}})[_0x7f3f('0x1f')](function(_0xf24624){if(_0xf24624){return _0xf24624?{'count':_0x1a93a0,'rows':_0xf24624}:null;}})[_0x7f3f('0x1f')](respondWithResult(_0x1f185c,null))[_0x7f3f('0x28')](handleError(_0x1f185c,null));};exports[_0x7f3f('0x5a')]=function(_0x5109df,_0xe6bb5,_0x30d346){var _0x38db21={};var _0x41eb6f={};var _0x48986a;var _0x1b1d81;return db[_0x7f3f('0x3b')][_0x7f3f('0x58')]({'where':{'id':_0x5109df['params']['id']}})[_0x7f3f('0x1f')](handleEntityNotFound(_0xe6bb5,null))[_0x7f3f('0x1f')](function(_0x2fa896){if(_0x2fa896){_0x48986a=_0x2fa896;_0x41eb6f[_0x7f3f('0x3f')]=_[_0x7f3f('0x41')](db['ZendeskField'][_0x7f3f('0x3c')]);_0x41eb6f[_0x7f3f('0x40')]=_['keys'](_0x5109df[_0x7f3f('0x40')]);_0x41eb6f['filters']=_[_0x7f3f('0x43')](_0x41eb6f['model'],_0x41eb6f[_0x7f3f('0x40')]);_0x38db21['attributes']=_['intersection'](_0x41eb6f[_0x7f3f('0x3f')],qs[_0x7f3f('0x45')](_0x5109df[_0x7f3f('0x40')][_0x7f3f('0x45')]));_0x38db21[_0x7f3f('0x44')]=_0x38db21['attributes']['length']?_0x38db21['attributes']:_0x41eb6f[_0x7f3f('0x3f')];_0x38db21[_0x7f3f('0x48')]=qs['sort'](_0x5109df[_0x7f3f('0x40')][_0x7f3f('0x59')]);_0x38db21[_0x7f3f('0x49')]=qs['filters'](_[_0x7f3f('0x4a')](_0x5109df['query'],_0x41eb6f[_0x7f3f('0x42')]));if(_0x5109df[_0x7f3f('0x40')][_0x7f3f('0x4b')]){_0x38db21[_0x7f3f('0x49')]=_[_0x7f3f('0x4c')](_0x38db21[_0x7f3f('0x49')],{'$or':_[_0x7f3f('0x3a')](_0x38db21[_0x7f3f('0x44')],function(_0x3b81a0){var _0x515896={};_0x515896[_0x3b81a0]={'$like':'%'+_0x5109df['query'][_0x7f3f('0x4b')]+'%'};return _0x515896;})});}_0x38db21=_[_0x7f3f('0x4c')]({},_0x38db21,_0x5109df[_0x7f3f('0x4d')]);return _0x48986a[_0x7f3f('0x5a')](_0x38db21);}})[_0x7f3f('0x1f')](function(_0x2da4b4){if(_0x2da4b4){_0x1b1d81=_0x2da4b4[_0x7f3f('0x53')];if(!_0x5109df['query'][_0x7f3f('0x46')](_0x7f3f('0x47'))){_0x38db21[_0x7f3f('0x2f')]=qs[_0x7f3f('0x2f')](_0x5109df[_0x7f3f('0x40')][_0x7f3f('0x2f')]);_0x38db21['offset']=qs[_0x7f3f('0x2e')](_0x5109df[_0x7f3f('0x40')]['offset']);}return _0x48986a['getSubjects'](_0x38db21);}})[_0x7f3f('0x1f')](function(_0x2ffdda){if(_0x2ffdda){return _0x2ffdda?{'count':_0x1b1d81,'rows':_0x2ffdda}:null;}})['then'](respondWithResult(_0xe6bb5,null))[_0x7f3f('0x28')](handleError(_0xe6bb5,null));};exports[_0x7f3f('0x5b')]=function(_0x5e1dd5,_0x17e583,_0x57968a){var _0x18dc3c={};var _0x3a142c={};var _0x5907f6;var _0x149821;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x5e1dd5[_0x7f3f('0x52')]['id']}})['then'](handleEntityNotFound(_0x17e583,null))[_0x7f3f('0x1f')](function(_0x6e11f0){if(_0x6e11f0){_0x5907f6=_0x6e11f0;_0x3a142c[_0x7f3f('0x3f')]=_[_0x7f3f('0x41')](db['ZendeskField'][_0x7f3f('0x3c')]);_0x3a142c[_0x7f3f('0x40')]=_[_0x7f3f('0x41')](_0x5e1dd5[_0x7f3f('0x40')]);_0x3a142c[_0x7f3f('0x42')]=_[_0x7f3f('0x43')](_0x3a142c[_0x7f3f('0x3f')],_0x3a142c[_0x7f3f('0x40')]);_0x18dc3c[_0x7f3f('0x44')]=_[_0x7f3f('0x43')](_0x3a142c[_0x7f3f('0x3f')],qs[_0x7f3f('0x45')](_0x5e1dd5[_0x7f3f('0x40')][_0x7f3f('0x45')]));_0x18dc3c[_0x7f3f('0x44')]=_0x18dc3c['attributes'][_0x7f3f('0x53')]?_0x18dc3c[_0x7f3f('0x44')]:_0x3a142c[_0x7f3f('0x3f')];_0x18dc3c[_0x7f3f('0x48')]=qs['sort'](_0x5e1dd5['query']['sort']);_0x18dc3c['where']=qs[_0x7f3f('0x42')](_[_0x7f3f('0x4a')](_0x5e1dd5[_0x7f3f('0x40')],_0x3a142c['filters']));if(_0x5e1dd5['query'][_0x7f3f('0x4b')]){_0x18dc3c[_0x7f3f('0x49')]=_[_0x7f3f('0x4c')](_0x18dc3c[_0x7f3f('0x49')],{'$or':_[_0x7f3f('0x3a')](_0x18dc3c[_0x7f3f('0x44')],function(_0x28eab2){var _0x262176={};_0x262176[_0x28eab2]={'$like':'%'+_0x5e1dd5[_0x7f3f('0x40')]['filter']+'%'};return _0x262176;})});}_0x18dc3c=_[_0x7f3f('0x4c')]({},_0x18dc3c,_0x5e1dd5[_0x7f3f('0x4d')]);return _0x5907f6[_0x7f3f('0x5b')](_0x18dc3c);}})[_0x7f3f('0x1f')](function(_0x2d9645){if(_0x2d9645){_0x149821=_0x2d9645[_0x7f3f('0x53')];if(!_0x5e1dd5['query'][_0x7f3f('0x46')](_0x7f3f('0x47'))){_0x18dc3c[_0x7f3f('0x2f')]=qs['limit'](_0x5e1dd5[_0x7f3f('0x40')][_0x7f3f('0x2f')]);_0x18dc3c['offset']=qs[_0x7f3f('0x2e')](_0x5e1dd5['query']['offset']);}return _0x5907f6[_0x7f3f('0x5b')](_0x18dc3c);}})[_0x7f3f('0x1f')](function(_0x429099){if(_0x429099){return _0x429099?{'count':_0x149821,'rows':_0x429099}:null;}})[_0x7f3f('0x1f')](respondWithResult(_0x17e583,null))[_0x7f3f('0x28')](handleError(_0x17e583,null));};exports[_0x7f3f('0x5c')]=function(_0x5a00cd,_0x36b1e0,_0x30c90d){var _0x346a57={};var _0x271044={};var _0x3ac774;var _0x11ed52;return db['ZendeskConfiguration'][_0x7f3f('0x58')]({'where':{'id':_0x5a00cd[_0x7f3f('0x52')]['id']}})[_0x7f3f('0x1f')](handleEntityNotFound(_0x36b1e0,null))[_0x7f3f('0x1f')](function(_0x5a89f3){if(_0x5a89f3){_0x3ac774=_0x5a89f3;_0x271044[_0x7f3f('0x3f')]=_[_0x7f3f('0x41')](db['Tag'][_0x7f3f('0x3c')]);_0x271044[_0x7f3f('0x40')]=_[_0x7f3f('0x41')](_0x5a00cd[_0x7f3f('0x40')]);_0x271044[_0x7f3f('0x42')]=_['intersection'](_0x271044[_0x7f3f('0x3f')],_0x271044['query']);_0x346a57['attributes']=_[_0x7f3f('0x43')](_0x271044['model'],qs[_0x7f3f('0x45')](_0x5a00cd['query']['fields']));_0x346a57['attributes']=_0x346a57[_0x7f3f('0x44')]['length']?_0x346a57[_0x7f3f('0x44')]:_0x271044[_0x7f3f('0x3f')];_0x346a57[_0x7f3f('0x48')]=qs['sort'](_0x5a00cd[_0x7f3f('0x40')][_0x7f3f('0x59')]);_0x346a57[_0x7f3f('0x49')]=qs[_0x7f3f('0x42')](_[_0x7f3f('0x4a')](_0x5a00cd[_0x7f3f('0x40')],_0x271044['filters']));if(_0x5a00cd['query'][_0x7f3f('0x4b')]){_0x346a57[_0x7f3f('0x49')]=_[_0x7f3f('0x4c')](_0x346a57[_0x7f3f('0x49')],{'$or':_['map'](_0x346a57['attributes'],function(_0x3ac4b0){var _0x1bcb19={};_0x1bcb19[_0x3ac4b0]={'$like':'%'+_0x5a00cd[_0x7f3f('0x40')]['filter']+'%'};return _0x1bcb19;})});}_0x346a57=_[_0x7f3f('0x4c')]({},_0x346a57,_0x5a00cd[_0x7f3f('0x4d')]);return _0x3ac774[_0x7f3f('0x5c')](_0x346a57);}})[_0x7f3f('0x1f')](function(_0x1c1152){if(_0x1c1152){_0x11ed52=_0x1c1152[_0x7f3f('0x53')];if(!_0x5a00cd[_0x7f3f('0x40')][_0x7f3f('0x46')]('nolimit')){_0x346a57[_0x7f3f('0x2f')]=qs[_0x7f3f('0x2f')](_0x5a00cd[_0x7f3f('0x40')][_0x7f3f('0x2f')]);_0x346a57[_0x7f3f('0x2e')]=qs[_0x7f3f('0x2e')](_0x5a00cd[_0x7f3f('0x40')][_0x7f3f('0x2e')]);}return _0x3ac774[_0x7f3f('0x5c')](_0x346a57);}})['then'](function(_0x4b2e2a){if(_0x4b2e2a){return _0x4b2e2a?{'count':_0x11ed52,'rows':_0x4b2e2a}:null;}})['then'](respondWithResult(_0x36b1e0,null))[_0x7f3f('0x28')](handleError(_0x36b1e0,null));};exports[_0x7f3f('0x5d')]=function(_0x2def82,_0x45b3fc,_0x1f3159){if(_0x2def82['body']['id']){delete _0x2def82[_0x7f3f('0x56')]['id'];}return db[_0x7f3f('0x3b')][_0x7f3f('0x58')]({'where':{'id':_0x2def82[_0x7f3f('0x52')]['id']}})[_0x7f3f('0x1f')](handleEntityNotFound(_0x45b3fc,null))['then'](function(_0x5a2b48){if(_0x5a2b48){return _0x5a2b48[_0x7f3f('0x5d')](_0x2def82[_0x7f3f('0x56')][_0x7f3f('0x5e')]||[]);}return null;})[_0x7f3f('0x1f')](respondWithResult(_0x45b3fc,null))[_0x7f3f('0x28')](handleError(_0x45b3fc,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 54366f1..16d9bfa 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 _0x07ca=['define','int_zendesk_configurations','util','bluebird','path','rimraf','../../config/environment'];(function(_0x3bada5,_0x289a2d){var _0x79f976=function(_0x3dda29){while(--_0x3dda29){_0x3bada5['push'](_0x3bada5['shift']());}};_0x79f976(++_0x289a2d);}(_0x07ca,0xd4));var _0xa07c=function(_0x6cf3b6,_0x4b7560){_0x6cf3b6=_0x6cf3b6-0x0;var _0xdbe948=_0x07ca[_0x6cf3b6];return _0xdbe948;};'use strict';var _=require('lodash');var util=require(_0xa07c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa07c('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa07c('0x2'));var rimraf=require(_0xa07c('0x3'));var config=require(_0xa07c('0x4'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x3de40c,_0x21df32){return _0x3de40c[_0xa07c('0x5')]('ZendeskConfiguration',attributes,{'tableName':_0xa07c('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x615a=['ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','define'];(function(_0x574774,_0x21e068){var _0x34673c=function(_0x982008){while(--_0x982008){_0x574774['push'](_0x574774['shift']());}};_0x34673c(++_0x21e068);}(_0x615a,0x6e));var _0xa615=function(_0x55291a,_0x814018){_0x55291a=_0x55291a-0x0;var _0x3c870c=_0x615a[_0x55291a];return _0x3c870c;};'use strict';var _=require(_0xa615('0x0'));var util=require(_0xa615('0x1'));var logger=require('../../config/logger')(_0xa615('0x2'));var moment=require(_0xa615('0x3'));var BPromise=require(_0xa615('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa615('0x5'));var rimraf=require(_0xa615('0x6'));var config=require(_0xa615('0x7'));var attributes=require(_0xa615('0x8'));module['exports']=function(_0x225fd8,_0x5bd3ed){return _0x225fd8[_0xa615('0x9')](_0xa615('0xa'),attributes,{'tableName':_0xa615('0xb'),'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 1c5144f..4ca77f3 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 _0x8552=['ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','debug'];(function(_0x40d64a,_0x26242b){var _0x5347d8=function(_0x50c98c){while(--_0x50c98c){_0x40d64a['push'](_0x40d64a['shift']());}};_0x5347d8(++_0x26242b);}(_0x8552,0x132));var _0x2855=function(_0x2e4d6a,_0x1c97b2){_0x2e4d6a=_0x2e4d6a-0x0;var _0x596d39=_0x8552[_0x2e4d6a];return _0x596d39;};'use strict';var _=require(_0x2855('0x0'));var util=require(_0x2855('0x1'));var moment=require(_0x2855('0x2'));var BPromise=require(_0x2855('0x3'));var rs=require(_0x2855('0x4'));var fs=require('fs');var Redis=require(_0x2855('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2855('0x6'))(_0x2855('0x7'));var config=require(_0x2855('0x8'));var jayson=require(_0x2855('0x9'));var client=jayson[_0x2855('0xa')][_0x2855('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e262b,_0x51f012,_0x3569d9){return new BPromise(function(_0x221b3a,_0x46834f){return client[_0x2855('0xc')](_0x4e262b,_0x3569d9)[_0x2855('0xd')](function(_0x4195df){logger['info'](_0x2855('0xe'),_0x51f012,'request\x20sent');logger[_0x2855('0xf')](_0x2855('0x10'),_0x51f012,_0x2855('0x11'),JSON[_0x2855('0x12')](_0x4195df));if(_0x4195df[_0x2855('0x13')]){if(_0x4195df[_0x2855('0x13')][_0x2855('0x14')]===0x1f4){logger[_0x2855('0x13')](_0x2855('0xe'),_0x51f012,_0x4195df[_0x2855('0x13')][_0x2855('0x15')]);return _0x46834f(_0x4195df[_0x2855('0x13')][_0x2855('0x15')]);}logger[_0x2855('0x13')](_0x2855('0xe'),_0x51f012,_0x4195df[_0x2855('0x13')][_0x2855('0x15')]);return _0x221b3a(_0x4195df[_0x2855('0x13')][_0x2855('0x15')]);}else{logger['info'](_0x2855('0xe'),_0x51f012,_0x2855('0x11'));_0x221b3a(_0x4195df['result'][_0x2855('0x15')]);}})[_0x2855('0x16')](function(_0x344e4f){logger[_0x2855('0x13')](_0x2855('0xe'),_0x51f012,_0x344e4f);_0x46834f(_0x344e4f);});});} \ No newline at end of file +var _0xe912=['ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','request\x20sent','debug','stringify','code','error'];(function(_0x5d4276,_0x37e98f){var _0x4b21ee=function(_0x522474){while(--_0x522474){_0x5d4276['push'](_0x5d4276['shift']());}};_0x4b21ee(++_0x37e98f);}(_0xe912,0xc1));var _0x2e91=function(_0x2d8d5b,_0x294df8){_0x2d8d5b=_0x2d8d5b-0x0;var _0x332c9c=_0xe912[_0x2d8d5b];return _0x332c9c;};'use strict';var _=require(_0x2e91('0x0'));var util=require(_0x2e91('0x1'));var moment=require(_0x2e91('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e91('0x3'));var db=require(_0x2e91('0x4'))['db'];var utils=require(_0x2e91('0x5'));var logger=require(_0x2e91('0x6'))(_0x2e91('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2e91('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59f97b,_0x34fc44,_0x14918c){return new BPromise(function(_0x63f97d,_0x3bb341){return client[_0x2e91('0x9')](_0x59f97b,_0x14918c)[_0x2e91('0xa')](function(_0x4567a5){logger[_0x2e91('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x34fc44,_0x2e91('0xc'));logger[_0x2e91('0xd')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x34fc44,_0x2e91('0xc'),JSON[_0x2e91('0xe')](_0x4567a5));if(_0x4567a5['error']){if(_0x4567a5['error'][_0x2e91('0xf')]===0x1f4){logger[_0x2e91('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x34fc44,_0x4567a5['error']['message']);return _0x3bb341(_0x4567a5['error']['message']);}logger[_0x2e91('0x10')](_0x2e91('0x11'),_0x34fc44,_0x4567a5[_0x2e91('0x10')][_0x2e91('0x12')]);return _0x63f97d(_0x4567a5[_0x2e91('0x10')][_0x2e91('0x12')]);}else{logger['info'](_0x2e91('0x11'),_0x34fc44,'request\x20sent');_0x63f97d(_0x4567a5[_0x2e91('0x13')][_0x2e91('0x12')]);}})[_0x2e91('0x14')](function(_0x16639b){logger[_0x2e91('0x10')](_0x2e91('0x11'),_0x34fc44,_0x16639b);_0x3bb341(_0x16639b);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 4dfcfa1..46c615d 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 _0x665a=['/:id','show','post','put','delete','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated'];(function(_0x204ad4,_0x502841){var _0x50675f=function(_0x30ad49){while(--_0x30ad49){_0x204ad4['push'](_0x204ad4['shift']());}};_0x50675f(++_0x502841);}(_0x665a,0xbc));var _0xa665=function(_0x5d5ad9,_0x9fe65c){_0x5d5ad9=_0x5d5ad9-0x0;var _0x461f64=_0x665a[_0x5d5ad9];return _0x461f64;};'use strict';var multer=require('multer');var util=require(_0xa665('0x0'));var path=require('path');var timeout=require(_0xa665('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xa665('0x2'));var interaction=require(_0xa665('0x3'));var config=require(_0xa665('0x4'));var controller=require(_0xa665('0x5'));router[_0xa665('0x6')]('/',auth[_0xa665('0x7')](),controller['index']);router[_0xa665('0x6')](_0xa665('0x8'),auth[_0xa665('0x7')](),controller[_0xa665('0x9')]);router[_0xa665('0xa')]('/',auth[_0xa665('0x7')](),controller['create']);router[_0xa665('0xb')](_0xa665('0x8'),auth[_0xa665('0x7')](),controller['update']);router[_0xa665('0xc')](_0xa665('0x8'),auth[_0xa665('0x7')](),controller['destroy']);module[_0xa665('0xd')]=router; \ No newline at end of file +var _0xe9ff=['Router','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','path','connect-timeout','express'];(function(_0x47fb00,_0x288858){var _0x30f079=function(_0x4f4911){while(--_0x4f4911){_0x47fb00['push'](_0x47fb00['shift']());}};_0x30f079(++_0x288858);}(_0xe9ff,0x19a));var _0xfe9f=function(_0x3dd047,_0x46e37e){_0x3dd047=_0x3dd047-0x0;var _0x13006f=_0xe9ff[_0x3dd047];return _0x13006f;};'use strict';var multer=require(_0xfe9f('0x0'));var util=require('util');var path=require(_0xfe9f('0x1'));var timeout=require(_0xfe9f('0x2'));var express=require(_0xfe9f('0x3'));var router=express[_0xfe9f('0x4')]();var auth=require(_0xfe9f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfe9f('0x6'));var controller=require(_0xfe9f('0x7'));router[_0xfe9f('0x8')]('/',auth[_0xfe9f('0x9')](),controller[_0xfe9f('0xa')]);router[_0xfe9f('0x8')](_0xfe9f('0xb'),auth[_0xfe9f('0x9')](),controller['show']);router[_0xfe9f('0xc')]('/',auth[_0xfe9f('0x9')](),controller[_0xfe9f('0xd')]);router[_0xfe9f('0xe')]('/:id',auth[_0xfe9f('0x9')](),controller[_0xfe9f('0xf')]);router[_0xfe9f('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xfe9f('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index a3a7382..a9be6fc 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 _0xe7ad=['BOOLEAN','ENUM','variable','customVariable','STRING','string'];(function(_0x2199db,_0x64fe69){var _0x1823bc=function(_0x4f849b){while(--_0x4f849b){_0x2199db['push'](_0x2199db['shift']());}};_0x1823bc(++_0x64fe69);}(_0xe7ad,0x1b1));var _0xde7a=function(_0x56a003,_0x3dd2d7){_0x56a003=_0x56a003-0x0;var _0x4877c7=_0xe7ad[_0x56a003];return _0x4877c7;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xde7a('0x0')]('string',_0xde7a('0x1'),_0xde7a('0x2'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0xde7a('0x3')]},'key':{'type':Sequelize[_0xde7a('0x3')]},'keyType':{'type':Sequelize[_0xde7a('0x0')](_0xde7a('0x4'),_0xde7a('0x1'),_0xde7a('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xde7a('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xde7a('0x3')]}}; \ No newline at end of file +var _0x1580=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x49800e,_0x9dd2e0){var _0x440134=function(_0x43cbef){while(--_0x43cbef){_0x49800e['push'](_0x49800e['shift']());}};_0x440134(++_0x9dd2e0);}(_0x1580,0x15a));var _0x0158=function(_0x3bc798,_0x1ee6b4){_0x3bc798=_0x3bc798-0x0;var _0x13321c=_0x1580[_0x3bc798];return _0x13321c;};'use strict';var Sequelize=require(_0x0158('0x0'));module[_0x0158('0x1')]={'type':{'type':Sequelize[_0x0158('0x2')](_0x0158('0x3'),_0x0158('0x4'),_0x0158('0x5'),_0x0158('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0158('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0158('0x2')](_0x0158('0x3'),'variable',_0x0158('0x5'))},'keyContent':{'type':Sequelize[_0x0158('0x7')]},'idField':{'type':Sequelize[_0x0158('0x7')]},'nameField':{'type':Sequelize[_0x0158('0x7')]},'customField':{'type':Sequelize[_0x0158('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index af4e2a5..b426b68 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 _0xa5f0=['fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','html-pdf','eml-format','rimraf','request-promise','moment','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','set','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ZendeskField','rawAttributes'];(function(_0x54e924,_0x2fd7d4){var _0x3244c8=function(_0x2f0094){while(--_0x2f0094){_0x54e924['push'](_0x54e924['shift']());}};_0x3244c8(++_0x2fd7d4);}(_0xa5f0,0x18b));var _0x0a5f=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xa5f0[_0x11c573];return _0x6b72de;};'use strict';var pdf=require(_0x0a5f('0x0'));var emlformat=require(_0x0a5f('0x1'));var rimraf=require(_0x0a5f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a5f('0x3'));var moment=require(_0x0a5f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0a5f('0x5'));var util=require('util');var path=require(_0x0a5f('0x6'));var sox=require('sox');var csv=require(_0x0a5f('0x7'));var ejs=require(_0x0a5f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0a5f('0x9'));var crypto=require(_0x0a5f('0xa'));var jsforce=require(_0x0a5f('0xb'));var deskjs=require(_0x0a5f('0xc'));var toCsv=require(_0x0a5f('0x7'));var querystring=require(_0x0a5f('0xd'));var Papa=require(_0x0a5f('0xe'));var Redis=require(_0x0a5f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0a5f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0a5f('0x11'))(_0x0a5f('0x12'));var utils=require(_0x0a5f('0x13'));var config=require(_0x0a5f('0x14'));var db=require(_0x0a5f('0x15'))['db'];function respondWithStatusCode(_0x491de4,_0x8d5569){_0x8d5569=_0x8d5569||0xcc;return function(_0x353c8b){if(_0x353c8b){return _0x491de4['sendStatus'](_0x8d5569);}return _0x491de4[_0x0a5f('0x16')](_0x8d5569)[_0x0a5f('0x17')]();};}function respondWithResult(_0x4b84c7,_0x119924){_0x119924=_0x119924||0xc8;return function(_0x52b210){if(_0x52b210){return _0x4b84c7[_0x0a5f('0x16')](_0x119924)['json'](_0x52b210);}};}function respondWithFilteredResult(_0x41f1a1,_0xd319a9){return function(_0x38fe9a){if(_0x38fe9a){var _0x84092f=_0x38fe9a[_0x0a5f('0x18')],_0x266415=_0xd319a9[_0x0a5f('0x19')],_0xdb53bd=_0xd319a9[_0x0a5f('0x19')]+_0xd319a9['limit'],_0x33fe36;if(_0xdb53bd>=_0x84092f){_0xdb53bd=_0x84092f;_0x33fe36=0xc8;}else{_0x33fe36=0xce;}_0x41f1a1[_0x0a5f('0x16')](_0x33fe36);return _0x41f1a1[_0x0a5f('0x1a')]('Content-Range',_0x266415+'-'+_0xdb53bd+'/'+_0x84092f)[_0x0a5f('0x1b')](_0x38fe9a);}return null;};}function patchUpdates(_0x1484be){return function(_0x28632a){try{jsonpatch[_0x0a5f('0x1c')](_0x28632a,_0x1484be,!![]);}catch(_0xbbd1e9){return BPromise[_0x0a5f('0x1d')](_0xbbd1e9);}return _0x28632a[_0x0a5f('0x1e')]();};}function saveUpdates(_0x301dfa,_0x4c2229){return function(_0x122cdd){if(_0x122cdd){return _0x122cdd[_0x0a5f('0x1f')](_0x301dfa)[_0x0a5f('0x20')](function(_0x4c7fae){return _0x4c7fae;});}return null;};}function removeEntity(_0x18a595,_0x3c9549){return function(_0x459da2){if(_0x459da2){return _0x459da2[_0x0a5f('0x21')]()[_0x0a5f('0x20')](function(){_0x18a595[_0x0a5f('0x16')](0xcc)[_0x0a5f('0x17')]();});}};}function handleEntityNotFound(_0x256fe3,_0xbe492f){return function(_0x17f014){if(!_0x17f014){_0x256fe3[_0x0a5f('0x22')](0x194);}return _0x17f014;};}function handleError(_0xef3360,_0x335c8b){_0x335c8b=_0x335c8b||0x1f4;return function(_0x289689){logger[_0x0a5f('0x23')](_0x289689[_0x0a5f('0x24')]);if(_0x289689[_0x0a5f('0x25')]){delete _0x289689[_0x0a5f('0x25')];}_0xef3360[_0x0a5f('0x16')](_0x335c8b)[_0x0a5f('0x26')](_0x289689);};}exports[_0x0a5f('0x27')]=function(_0x50c0a1,_0x361cc0){var _0x49c684={},_0x1ba2f9={},_0x524878={'count':0x0,'rows':[]};var _0x2a02bc=_[_0x0a5f('0x28')](db[_0x0a5f('0x29')][_0x0a5f('0x2a')],function(_0x40abdd){return{'name':_0x40abdd[_0x0a5f('0x2b')],'type':_0x40abdd[_0x0a5f('0x2c')]['key']};});_0x1ba2f9[_0x0a5f('0x2d')]=_['map'](_0x2a02bc,'name');_0x1ba2f9['query']=_['keys'](_0x50c0a1[_0x0a5f('0x2e')]);_0x1ba2f9[_0x0a5f('0x2f')]=_[_0x0a5f('0x30')](_0x1ba2f9[_0x0a5f('0x2d')],_0x1ba2f9[_0x0a5f('0x2e')]);_0x49c684['attributes']=_[_0x0a5f('0x30')](_0x1ba2f9[_0x0a5f('0x2d')],qs['fields'](_0x50c0a1['query'][_0x0a5f('0x31')]));_0x49c684['attributes']=_0x49c684[_0x0a5f('0x32')][_0x0a5f('0x33')]?_0x49c684[_0x0a5f('0x32')]:_0x1ba2f9[_0x0a5f('0x2d')];if(!_0x50c0a1[_0x0a5f('0x2e')][_0x0a5f('0x34')](_0x0a5f('0x35'))){_0x49c684[_0x0a5f('0x36')]=qs[_0x0a5f('0x36')](_0x50c0a1[_0x0a5f('0x2e')][_0x0a5f('0x36')]);_0x49c684['offset']=qs[_0x0a5f('0x19')](_0x50c0a1['query']['offset']);}_0x49c684['order']=qs[_0x0a5f('0x37')](_0x50c0a1[_0x0a5f('0x2e')][_0x0a5f('0x37')]);_0x49c684[_0x0a5f('0x38')]=qs['filters'](_[_0x0a5f('0x39')](_0x50c0a1[_0x0a5f('0x2e')],_0x1ba2f9[_0x0a5f('0x2f')]),_0x2a02bc);if(_0x50c0a1['query'][_0x0a5f('0x3a')]){_0x49c684[_0x0a5f('0x38')]=_[_0x0a5f('0x3b')](_0x49c684[_0x0a5f('0x38')],{'$or':_['map'](_0x2a02bc,function(_0x1ed384){if(_0x1ed384[_0x0a5f('0x2c')]!==_0x0a5f('0x3c')){var _0x10e54b={};_0x10e54b[_0x1ed384[_0x0a5f('0x25')]]={'$like':'%'+_0x50c0a1[_0x0a5f('0x2e')]['filter']+'%'};return _0x10e54b;}})});}_0x49c684=_[_0x0a5f('0x3b')]({},_0x49c684,_0x50c0a1[_0x0a5f('0x3d')]);var _0x1a615d={'where':_0x49c684[_0x0a5f('0x38')]};return db[_0x0a5f('0x29')][_0x0a5f('0x18')](_0x1a615d)[_0x0a5f('0x20')](function(_0x1fbfdb){_0x524878[_0x0a5f('0x18')]=_0x1fbfdb;if(_0x50c0a1[_0x0a5f('0x2e')][_0x0a5f('0x3e')]){_0x49c684[_0x0a5f('0x3f')]=[{'all':!![]}];}return db[_0x0a5f('0x29')][_0x0a5f('0x40')](_0x49c684);})[_0x0a5f('0x20')](function(_0x3a589e){_0x524878[_0x0a5f('0x41')]=_0x3a589e;return _0x524878;})[_0x0a5f('0x20')](respondWithFilteredResult(_0x361cc0,_0x49c684))[_0x0a5f('0x42')](handleError(_0x361cc0,null));};exports[_0x0a5f('0x43')]=function(_0x36c0fb,_0x18acc7){var _0x58f548={'raw':!![],'where':{'id':_0x36c0fb[_0x0a5f('0x44')]['id']}},_0x3165bc={};_0x3165bc[_0x0a5f('0x2d')]=_[_0x0a5f('0x45')](db[_0x0a5f('0x29')][_0x0a5f('0x2a')]);_0x3165bc[_0x0a5f('0x2e')]=_[_0x0a5f('0x45')](_0x36c0fb['query']);_0x3165bc[_0x0a5f('0x2f')]=_['intersection'](_0x3165bc[_0x0a5f('0x2d')],_0x3165bc[_0x0a5f('0x2e')]);_0x58f548['attributes']=_[_0x0a5f('0x30')](_0x3165bc[_0x0a5f('0x2d')],qs[_0x0a5f('0x31')](_0x36c0fb['query'][_0x0a5f('0x31')]));_0x58f548[_0x0a5f('0x32')]=_0x58f548['attributes'][_0x0a5f('0x33')]?_0x58f548[_0x0a5f('0x32')]:_0x3165bc[_0x0a5f('0x2d')];if(_0x36c0fb[_0x0a5f('0x2e')]['includeAll']){_0x58f548[_0x0a5f('0x3f')]=[{'all':!![]}];}_0x58f548=_[_0x0a5f('0x3b')]({},_0x58f548,_0x36c0fb[_0x0a5f('0x3d')]);return db[_0x0a5f('0x29')]['find'](_0x58f548)[_0x0a5f('0x20')](handleEntityNotFound(_0x18acc7,null))[_0x0a5f('0x20')](respondWithResult(_0x18acc7,null))['catch'](handleError(_0x18acc7,null));};exports[_0x0a5f('0x46')]=function(_0x1188b3,_0x2a4053){return db[_0x0a5f('0x29')]['create'](_0x1188b3[_0x0a5f('0x47')],{})[_0x0a5f('0x20')](respondWithResult(_0x2a4053,0xc9))['catch'](handleError(_0x2a4053,null));};exports['update']=function(_0x2b93c7,_0x45fd70){if(_0x2b93c7[_0x0a5f('0x47')]['id']){delete _0x2b93c7['body']['id'];}return db[_0x0a5f('0x29')][_0x0a5f('0x48')]({'where':{'id':_0x2b93c7[_0x0a5f('0x44')]['id']}})[_0x0a5f('0x20')](handleEntityNotFound(_0x45fd70,null))['then'](saveUpdates(_0x2b93c7[_0x0a5f('0x47')],null))['then'](respondWithResult(_0x45fd70,null))['catch'](handleError(_0x45fd70,null));};exports[_0x0a5f('0x21')]=function(_0x193c00,_0x5b611f){return db['ZendeskField'][_0x0a5f('0x48')]({'where':{'id':_0x193c00['params']['id']}})[_0x0a5f('0x20')](handleEntityNotFound(_0x5b611f,null))[_0x0a5f('0x20')](removeEntity(_0x5b611f,null))['catch'](handleError(_0x5b611f,null));}; \ No newline at end of file +var _0xa7be=['VIRTUAL','options','include','ZendeskField','rows','catch','show','params','keys','includeAll','create','body','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge'];(function(_0x12c7e5,_0x4f82a7){var _0x266fe0=function(_0xe76c9){while(--_0xe76c9){_0x12c7e5['push'](_0x12c7e5['shift']());}};_0x266fe0(++_0x4f82a7);}(_0xa7be,0x170));var _0xea7b=function(_0x5ef89e,_0x4421bd){_0x5ef89e=_0x5ef89e-0x0;var _0x52fd3f=_0xa7be[_0x5ef89e];return _0x52fd3f;};'use strict';var pdf=require(_0xea7b('0x0'));var emlformat=require(_0xea7b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xea7b('0x2'));var jsonpatch=require(_0xea7b('0x3'));var rp=require(_0xea7b('0x4'));var moment=require(_0xea7b('0x5'));var BPromise=require(_0xea7b('0x6'));var Mustache=require(_0xea7b('0x7'));var util=require(_0xea7b('0x8'));var path=require(_0xea7b('0x9'));var sox=require('sox');var csv=require(_0xea7b('0xa'));var ejs=require(_0xea7b('0xb'));var fs=require('fs');var _=require(_0xea7b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xea7b('0xd'));var deskjs=require(_0xea7b('0xe'));var toCsv=require('to-csv');var querystring=require(_0xea7b('0xf'));var Papa=require(_0xea7b('0x10'));var Redis=require(_0xea7b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xea7b('0x12'));var as=require(_0xea7b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea7b('0x14'))(_0xea7b('0x15'));var utils=require(_0xea7b('0x16'));var config=require(_0xea7b('0x17'));var db=require(_0xea7b('0x18'))['db'];function respondWithStatusCode(_0x596670,_0x145647){_0x145647=_0x145647||0xcc;return function(_0xaa5924){if(_0xaa5924){return _0x596670['sendStatus'](_0x145647);}return _0x596670[_0xea7b('0x19')](_0x145647)[_0xea7b('0x1a')]();};}function respondWithResult(_0x331870,_0x12a131){_0x12a131=_0x12a131||0xc8;return function(_0x3e0f74){if(_0x3e0f74){return _0x331870[_0xea7b('0x19')](_0x12a131)[_0xea7b('0x1b')](_0x3e0f74);}};}function respondWithFilteredResult(_0x48184f,_0x480eed){return function(_0x2bc237){if(_0x2bc237){var _0x13918f=_0x2bc237[_0xea7b('0x1c')],_0x4133c6=_0x480eed[_0xea7b('0x1d')],_0x140ebf=_0x480eed[_0xea7b('0x1d')]+_0x480eed[_0xea7b('0x1e')],_0x2f887c;if(_0x140ebf>=_0x13918f){_0x140ebf=_0x13918f;_0x2f887c=0xc8;}else{_0x2f887c=0xce;}_0x48184f[_0xea7b('0x19')](_0x2f887c);return _0x48184f[_0xea7b('0x1f')]('Content-Range',_0x4133c6+'-'+_0x140ebf+'/'+_0x13918f)[_0xea7b('0x1b')](_0x2bc237);}return null;};}function patchUpdates(_0x45f077){return function(_0x18267d){try{jsonpatch[_0xea7b('0x20')](_0x18267d,_0x45f077,!![]);}catch(_0x11f0d8){return BPromise[_0xea7b('0x21')](_0x11f0d8);}return _0x18267d[_0xea7b('0x22')]();};}function saveUpdates(_0x402de9,_0x2a5247){return function(_0x5781e4){if(_0x5781e4){return _0x5781e4[_0xea7b('0x23')](_0x402de9)[_0xea7b('0x24')](function(_0x259374){return _0x259374;});}return null;};}function removeEntity(_0x2c7c8d,_0x67f1f2){return function(_0x225506){if(_0x225506){return _0x225506['destroy']()[_0xea7b('0x24')](function(){_0x2c7c8d[_0xea7b('0x19')](0xcc)[_0xea7b('0x1a')]();});}};}function handleEntityNotFound(_0x48eb1f,_0xd2e57a){return function(_0x3df867){if(!_0x3df867){_0x48eb1f['sendStatus'](0x194);}return _0x3df867;};}function handleError(_0xd5e960,_0x2d02d2){_0x2d02d2=_0x2d02d2||0x1f4;return function(_0x196017){logger[_0xea7b('0x25')](_0x196017[_0xea7b('0x26')]);if(_0x196017[_0xea7b('0x27')]){delete _0x196017[_0xea7b('0x27')];}_0xd5e960[_0xea7b('0x19')](_0x2d02d2)[_0xea7b('0x28')](_0x196017);};}exports['index']=function(_0x1c3814,_0x41ea49){var _0x4c9e3a={},_0x5b5e9c={},_0x148bf4={'count':0x0,'rows':[]};var _0x4240c5=_[_0xea7b('0x29')](db['ZendeskField'][_0xea7b('0x2a')],function(_0x185340){return{'name':_0x185340['fieldName'],'type':_0x185340[_0xea7b('0x2b')][_0xea7b('0x2c')]};});_0x5b5e9c[_0xea7b('0x2d')]=_[_0xea7b('0x29')](_0x4240c5,_0xea7b('0x27'));_0x5b5e9c[_0xea7b('0x2e')]=_['keys'](_0x1c3814[_0xea7b('0x2e')]);_0x5b5e9c[_0xea7b('0x2f')]=_[_0xea7b('0x30')](_0x5b5e9c[_0xea7b('0x2d')],_0x5b5e9c[_0xea7b('0x2e')]);_0x4c9e3a[_0xea7b('0x31')]=_['intersection'](_0x5b5e9c['model'],qs[_0xea7b('0x32')](_0x1c3814['query'][_0xea7b('0x32')]));_0x4c9e3a[_0xea7b('0x31')]=_0x4c9e3a[_0xea7b('0x31')][_0xea7b('0x33')]?_0x4c9e3a[_0xea7b('0x31')]:_0x5b5e9c[_0xea7b('0x2d')];if(!_0x1c3814[_0xea7b('0x2e')][_0xea7b('0x34')]('nolimit')){_0x4c9e3a[_0xea7b('0x1e')]=qs[_0xea7b('0x1e')](_0x1c3814[_0xea7b('0x2e')][_0xea7b('0x1e')]);_0x4c9e3a[_0xea7b('0x1d')]=qs[_0xea7b('0x1d')](_0x1c3814['query']['offset']);}_0x4c9e3a[_0xea7b('0x35')]=qs['sort'](_0x1c3814['query'][_0xea7b('0x36')]);_0x4c9e3a[_0xea7b('0x37')]=qs[_0xea7b('0x2f')](_['pick'](_0x1c3814[_0xea7b('0x2e')],_0x5b5e9c[_0xea7b('0x2f')]),_0x4240c5);if(_0x1c3814[_0xea7b('0x2e')][_0xea7b('0x38')]){_0x4c9e3a[_0xea7b('0x37')]=_[_0xea7b('0x39')](_0x4c9e3a['where'],{'$or':_[_0xea7b('0x29')](_0x4240c5,function(_0x3d0d47){if(_0x3d0d47['type']!==_0xea7b('0x3a')){var _0x5b752e={};_0x5b752e[_0x3d0d47[_0xea7b('0x27')]]={'$like':'%'+_0x1c3814[_0xea7b('0x2e')][_0xea7b('0x38')]+'%'};return _0x5b752e;}})});}_0x4c9e3a=_['merge']({},_0x4c9e3a,_0x1c3814[_0xea7b('0x3b')]);var _0x397181={'where':_0x4c9e3a[_0xea7b('0x37')]};return db['ZendeskField'][_0xea7b('0x1c')](_0x397181)['then'](function(_0x516855){_0x148bf4[_0xea7b('0x1c')]=_0x516855;if(_0x1c3814['query']['includeAll']){_0x4c9e3a[_0xea7b('0x3c')]=[{'all':!![]}];}return db[_0xea7b('0x3d')]['findAll'](_0x4c9e3a);})[_0xea7b('0x24')](function(_0x1dc617){_0x148bf4[_0xea7b('0x3e')]=_0x1dc617;return _0x148bf4;})['then'](respondWithFilteredResult(_0x41ea49,_0x4c9e3a))[_0xea7b('0x3f')](handleError(_0x41ea49,null));};exports[_0xea7b('0x40')]=function(_0xb8e8c3,_0x54dad6){var _0x2c6ab8={'raw':!![],'where':{'id':_0xb8e8c3[_0xea7b('0x41')]['id']}},_0xcd30be={};_0xcd30be[_0xea7b('0x2d')]=_[_0xea7b('0x42')](db[_0xea7b('0x3d')][_0xea7b('0x2a')]);_0xcd30be[_0xea7b('0x2e')]=_[_0xea7b('0x42')](_0xb8e8c3[_0xea7b('0x2e')]);_0xcd30be[_0xea7b('0x2f')]=_[_0xea7b('0x30')](_0xcd30be[_0xea7b('0x2d')],_0xcd30be[_0xea7b('0x2e')]);_0x2c6ab8['attributes']=_['intersection'](_0xcd30be['model'],qs[_0xea7b('0x32')](_0xb8e8c3[_0xea7b('0x2e')][_0xea7b('0x32')]));_0x2c6ab8[_0xea7b('0x31')]=_0x2c6ab8[_0xea7b('0x31')][_0xea7b('0x33')]?_0x2c6ab8['attributes']:_0xcd30be[_0xea7b('0x2d')];if(_0xb8e8c3[_0xea7b('0x2e')][_0xea7b('0x43')]){_0x2c6ab8[_0xea7b('0x3c')]=[{'all':!![]}];}_0x2c6ab8=_[_0xea7b('0x39')]({},_0x2c6ab8,_0xb8e8c3['options']);return db[_0xea7b('0x3d')]['find'](_0x2c6ab8)[_0xea7b('0x24')](handleEntityNotFound(_0x54dad6,null))[_0xea7b('0x24')](respondWithResult(_0x54dad6,null))['catch'](handleError(_0x54dad6,null));};exports[_0xea7b('0x44')]=function(_0x11f6dc,_0xd30e65){return db[_0xea7b('0x3d')][_0xea7b('0x44')](_0x11f6dc['body'],{})[_0xea7b('0x24')](respondWithResult(_0xd30e65,0xc9))[_0xea7b('0x3f')](handleError(_0xd30e65,null));};exports['update']=function(_0xe0e59e,_0x2e369e){if(_0xe0e59e[_0xea7b('0x45')]['id']){delete _0xe0e59e[_0xea7b('0x45')]['id'];}return db['ZendeskField']['find']({'where':{'id':_0xe0e59e['params']['id']}})[_0xea7b('0x24')](handleEntityNotFound(_0x2e369e,null))[_0xea7b('0x24')](saveUpdates(_0xe0e59e[_0xea7b('0x45')],null))[_0xea7b('0x24')](respondWithResult(_0x2e369e,null))[_0xea7b('0x3f')](handleError(_0x2e369e,null));};exports[_0xea7b('0x46')]=function(_0x3f63c4,_0x36b9b2){return db[_0xea7b('0x3d')]['find']({'where':{'id':_0x3f63c4[_0xea7b('0x41')]['id']}})[_0xea7b('0x24')](handleEntityNotFound(_0x36b9b2,null))['then'](removeEntity(_0x36b9b2,null))[_0xea7b('0x3f')](handleError(_0x36b9b2,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index d818000..83373cc 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 _0xb9a7=['path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','idField','FieldId','util','bluebird'];(function(_0x5907df,_0x26720e){var _0x3d4fd3=function(_0x3d3fc6){while(--_0x3d3fc6){_0x5907df['push'](_0x5907df['shift']());}};_0x3d4fd3(++_0x26720e);}(_0xb9a7,0x112));var _0x7b9a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xb9a7[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7b9a('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b9a('0x2'));var rimraf=require(_0x7b9a('0x3'));var config=require(_0x7b9a('0x4'));var attributes=require(_0x7b9a('0x5'));module[_0x7b9a('0x6')]=function(_0xf6dae2,_0x22764f){return _0xf6dae2[_0x7b9a('0x7')](_0x7b9a('0x8'),attributes,{'tableName':_0x7b9a('0x9'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x7b9a('0xa'),_0x7b9a('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x263f=['path','rimraf','../../config/environment','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3efaa5,_0x3f7cdf){var _0x3d8c29=function(_0xc9e0e3){while(--_0xc9e0e3){_0x3efaa5['push'](_0x3efaa5['shift']());}};_0x3d8c29(++_0x3f7cdf);}(_0x263f,0x182));var _0xf263=function(_0x36c560,_0x4595f7){_0x36c560=_0x36c560-0x0;var _0x534f4f=_0x263f[_0x36c560];return _0x534f4f;};'use strict';var _=require(_0xf263('0x0'));var util=require(_0xf263('0x1'));var logger=require(_0xf263('0x2'))(_0xf263('0x3'));var moment=require(_0xf263('0x4'));var BPromise=require(_0xf263('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf263('0x6'));var rimraf=require(_0xf263('0x7'));var config=require(_0xf263('0x8'));var attributes=require('./intZendeskField.attributes');module[_0xf263('0x9')]=function(_0xdb2fc1,_0x4c7ab2){return _0xdb2fc1['define'](_0xf263('0xa'),attributes,{'tableName':_0xf263('0xb'),'paranoid':![],'indexes':[{'name':_0xf263('0xc'),'fields':[_0xf263('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 12e086f..74f93ce 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 _0x930d=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','ZendeskField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird'];(function(_0x3a2ed2,_0x1109c7){var _0x5c12e8=function(_0x2d3a8a){while(--_0x2d3a8a){_0x3a2ed2['push'](_0x3a2ed2['shift']());}};_0x5c12e8(++_0x1109c7);}(_0x930d,0xee));var _0xd930=function(_0x2d3ab3,_0x47d90b){_0x2d3ab3=_0x2d3ab3-0x0;var _0x321f9e=_0x930d[_0x2d3ab3];return _0x321f9e;};'use strict';var _=require(_0xd930('0x0'));var util=require(_0xd930('0x1'));var moment=require(_0xd930('0x2'));var BPromise=require(_0xd930('0x3'));var rs=require(_0xd930('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd930('0x5'))['db'];var utils=require(_0xd930('0x6'));var logger=require(_0xd930('0x7'))('rpc');var config=require(_0xd930('0x8'));var jayson=require(_0xd930('0x9'));var client=jayson[_0xd930('0xa')][_0xd930('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44345d,_0x295166,_0x51c89f){return new BPromise(function(_0x4dbb2a,_0x26e6e1){return client['request'](_0x44345d,_0x51c89f)['then'](function(_0x58a958){logger[_0xd930('0xc')]('ZendeskField,\x20%s,\x20%s',_0x295166,_0xd930('0xd'));logger[_0xd930('0xe')](_0xd930('0xf'),_0x295166,'request\x20sent',JSON[_0xd930('0x10')](_0x58a958));if(_0x58a958[_0xd930('0x11')]){if(_0x58a958[_0xd930('0x11')]['code']===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x295166,_0x58a958[_0xd930('0x11')][_0xd930('0x12')]);return _0x26e6e1(_0x58a958[_0xd930('0x11')][_0xd930('0x12')]);}logger['error']('ZendeskField,\x20%s,\x20%s',_0x295166,_0x58a958['error'][_0xd930('0x12')]);return _0x4dbb2a(_0x58a958['error'][_0xd930('0x12')]);}else{logger['info'](_0xd930('0x13'),_0x295166,_0xd930('0xd'));_0x4dbb2a(_0x58a958[_0xd930('0x14')]['message']);}})[_0xd930('0x15')](function(_0x5cb933){logger[_0xd930('0x11')](_0xd930('0x13'),_0x295166,_0x5cb933);_0x26e6e1(_0x5cb933);});});} \ No newline at end of file +var _0x6442=['catch','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','ZendeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x2fc9bd,_0x2d5cf2){var _0x565c7d=function(_0xaa1074){while(--_0xaa1074){_0x2fc9bd['push'](_0x2fc9bd['shift']());}};_0x565c7d(++_0x2d5cf2);}(_0x6442,0x1f1));var _0x2644=function(_0x3510c2,_0x396bf6){_0x3510c2=_0x3510c2-0x0;var _0x191fb0=_0x6442[_0x3510c2];return _0x191fb0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2644('0x0'));var db=require('../../mysqldb')['db'];var utils=require(_0x2644('0x1'));var logger=require(_0x2644('0x2'))('rpc');var config=require(_0x2644('0x3'));var jayson=require(_0x2644('0x4'));var client=jayson[_0x2644('0x5')][_0x2644('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x303db9,_0x4a4677,_0x1b4c62){return new BPromise(function(_0x353d76,_0x578c08){return client['request'](_0x303db9,_0x1b4c62)['then'](function(_0x4b732f){logger[_0x2644('0x7')](_0x2644('0x8'),_0x4a4677,_0x2644('0x9'));logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x4a4677,'request\x20sent',JSON[_0x2644('0xa')](_0x4b732f));if(_0x4b732f[_0x2644('0xb')]){if(_0x4b732f[_0x2644('0xb')][_0x2644('0xc')]===0x1f4){logger[_0x2644('0xb')](_0x2644('0x8'),_0x4a4677,_0x4b732f[_0x2644('0xb')][_0x2644('0xd')]);return _0x578c08(_0x4b732f['error']['message']);}logger[_0x2644('0xb')](_0x2644('0x8'),_0x4a4677,_0x4b732f[_0x2644('0xb')][_0x2644('0xd')]);return _0x353d76(_0x4b732f['error'][_0x2644('0xd')]);}else{logger[_0x2644('0x7')](_0x2644('0x8'),_0x4a4677,_0x2644('0x9'));_0x353d76(_0x4b732f[_0x2644('0xe')][_0x2644('0xd')]);}})[_0x2644('0xf')](function(_0x2564b6){logger['error'](_0x2644('0x8'),_0x4a4677,_0x2564b6);_0x578c08(_0x2564b6);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 2172fae..42429d6 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 _0x1b63=['/:id','show','get','/:id/configurations','isAuthenticated','getFields','post','create','addConfiguration','put','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller'];(function(_0x278aa7,_0xd13883){var _0x193521=function(_0x3bc345){while(--_0x3bc345){_0x278aa7['push'](_0x278aa7['shift']());}};_0x193521(++_0xd13883);}(_0x1b63,0x66));var _0x31b6=function(_0x1f7996,_0x299a14){_0x1f7996=_0x1f7996-0x0;var _0x584609=_0x1b63[_0x1f7996];return _0x584609;};'use strict';var multer=require(_0x31b6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x31b6('0x1'));var router=express[_0x31b6('0x2')]();var auth=require(_0x31b6('0x3'));var interaction=require(_0x31b6('0x4'));var config=require('../../config/environment');var controller=require(_0x31b6('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x31b6('0x6'),auth['isAuthenticated'](),controller[_0x31b6('0x7')]);router[_0x31b6('0x8')](_0x31b6('0x9'),auth[_0x31b6('0xa')](),controller['getConfigurations']);router[_0x31b6('0x8')]('/:id/fields',auth[_0x31b6('0xa')](),controller[_0x31b6('0xb')]);router[_0x31b6('0xc')]('/',auth['isAuthenticated'](),controller[_0x31b6('0xd')]);router[_0x31b6('0xc')](_0x31b6('0x9'),auth['isAuthenticated'](),controller[_0x31b6('0xe')]);router[_0x31b6('0xf')](_0x31b6('0x6'),auth[_0x31b6('0xa')](),controller['update']);router['delete']('/:id',auth[_0x31b6('0xa')](),controller[_0x31b6('0x10')]);module[_0x31b6('0x11')]=router; \ No newline at end of file +var _0x3297=['create','addConfiguration','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x779496,_0x9b0b0b){var _0x472493=function(_0x18db79){while(--_0x18db79){_0x779496['push'](_0x779496['shift']());}};_0x472493(++_0x9b0b0b);}(_0x3297,0x1a7));var _0x7329=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x3297[_0xbb091];return _0x467a04;};'use strict';var multer=require(_0x7329('0x0'));var util=require(_0x7329('0x1'));var path=require('path');var timeout=require(_0x7329('0x2'));var express=require(_0x7329('0x3'));var router=express[_0x7329('0x4')]();var auth=require(_0x7329('0x5'));var interaction=require(_0x7329('0x6'));var config=require(_0x7329('0x7'));var controller=require('./intZohoAccount.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x7329('0x8'),auth[_0x7329('0x9')](),controller[_0x7329('0xa')]);router[_0x7329('0xb')](_0x7329('0xc'),auth['isAuthenticated'](),controller[_0x7329('0xd')]);router[_0x7329('0xb')](_0x7329('0xe'),auth['isAuthenticated'](),controller[_0x7329('0xf')]);router[_0x7329('0x10')]('/',auth[_0x7329('0x9')](),controller[_0x7329('0x11')]);router[_0x7329('0x10')](_0x7329('0xc'),auth[_0x7329('0x9')](),controller[_0x7329('0x12')]);router['put']('/:id',auth[_0x7329('0x9')](),controller[_0x7329('0x13')]);router[_0x7329('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x7329('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 562a3e2..bb3d4e7 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 _0x4772=['exports','STRING','sequelize'];(function(_0x18c6c4,_0xd1cd38){var _0x149419=function(_0xb21435){while(--_0xb21435){_0x18c6c4['push'](_0x18c6c4['shift']());}};_0x149419(++_0xd1cd38);}(_0x4772,0x98));var _0x2477=function(_0x1cb629,_0xb9d5cf){_0x1cb629=_0x1cb629-0x0;var _0x28908b=_0x4772[_0x1cb629];return _0x28908b;};'use strict';var Sequelize=require(_0x2477('0x0'));module[_0x2477('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2477('0x2')]},'host':{'type':Sequelize[_0x2477('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x2477('0x2')]},'clientSecret':{'type':Sequelize[_0x2477('0x2')]},'serverUrl':{'type':Sequelize[_0x2477('0x2')]},'code':{'type':Sequelize[_0x2477('0x2')]},'refreshToken':{'type':Sequelize[_0x2477('0x2')]}}; \ No newline at end of file +var _0x67b6=['STRING'];(function(_0x21a54a,_0x2ef697){var _0x24fc96=function(_0x581166){while(--_0x581166){_0x21a54a['push'](_0x21a54a['shift']());}};_0x24fc96(++_0x2ef697);}(_0x67b6,0x141));var _0x667b=function(_0x554d0d,_0x23c674){_0x554d0d=_0x554d0d-0x0;var _0x9115fb=_0x67b6[_0x554d0d];return _0x9115fb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x667b('0x0')]},'description':{'type':Sequelize[_0x667b('0x0')]},'host':{'type':Sequelize[_0x667b('0x0')]},'zone':{'type':Sequelize[_0x667b('0x0')]},'clientId':{'type':Sequelize[_0x667b('0x0')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x667b('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 559b5d6..f58a54a 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 _0x5d40=['findOne','ZohoConfiguration','filter','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientSecret','access_token','getFields','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','refreshToken','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','system_mandatory','push','custom_field','data_type','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','status','end','json','offset','limit','set','apply','reject','save','update','sendStatus','stack','name','index','ZohoAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','create','body','destroy','getConfigurations'];(function(_0x3b2c8e,_0x53910b){var _0x3ebe3d=function(_0x57220b){while(--_0x57220b){_0x3b2c8e['push'](_0x3b2c8e['shift']());}};_0x3ebe3d(++_0x53910b);}(_0x5d40,0x157));var _0x05d4=function(_0x40dec2,_0x420490){_0x40dec2=_0x40dec2-0x0;var _0x118642=_0x5d40[_0x40dec2];return _0x118642;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x05d4('0x0'));var zipdir=require(_0x05d4('0x1'));var jsonpatch=require(_0x05d4('0x2'));var rp=require(_0x05d4('0x3'));var moment=require('moment');var BPromise=require(_0x05d4('0x4'));var Mustache=require('mustache');var util=require(_0x05d4('0x5'));var path=require(_0x05d4('0x6'));var sox=require(_0x05d4('0x7'));var csv=require(_0x05d4('0x8'));var ejs=require(_0x05d4('0x9'));var fs=require('fs');var _=require(_0x05d4('0xa'));var squel=require(_0x05d4('0xb'));var crypto=require('crypto');var jsforce=require(_0x05d4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x05d4('0x8'));var querystring=require(_0x05d4('0xd'));var Papa=require(_0x05d4('0xe'));var Redis=require(_0x05d4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x05d4('0x10'));var as=require(_0x05d4('0x11'));var hardwareService=require(_0x05d4('0x12'));var logger=require(_0x05d4('0x13'))(_0x05d4('0x14'));var utils=require(_0x05d4('0x15'));var config=require(_0x05d4('0x16'));var db=require(_0x05d4('0x17'))['db'];var integrations=require(_0x05d4('0x18'));var jayson=require(_0x05d4('0x19'));var client=jayson[_0x05d4('0x1a')][_0x05d4('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x56cd67,_0x542d46,_0x3fd042){if(_0x3fd042){var _0x3cf21b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3cf21b[_0x05d4('0x1c')](_0x542d46)){return _0x56cd67;}else{throw new db[(_0x05d4('0x1d'))][(_0x05d4('0x1e'))](_0x05d4('0x1f'));}}else{return _0x56cd67;}}function respondWithRpcPromise(_0x15005a,_0x4204e1,_0x5631c9,_0x3277b1){return new BPromise(function(_0x4c2409,_0x3f1b06){var _0x4cf7de=_0x3277b1||client;return _0x4cf7de[_0x05d4('0x20')](_0x15005a,_0x5631c9)[_0x05d4('0x21')](function(_0x45573a){logger[_0x05d4('0x22')](_0x05d4('0x23'),_0x4204e1,_0x05d4('0x24'));logger[_0x05d4('0x25')](_0x05d4('0x26'),_0x4204e1,'request\x20sent',JSON['stringify'](_0x45573a));if(_0x45573a['error']){if(_0x45573a['error'][_0x05d4('0x27')]===0x1f4){logger[_0x05d4('0x28')]('ZohoAccount,\x20%s,\x20%s',_0x4204e1,_0x45573a['error']['message']);return _0x3f1b06(_0x45573a['error'][_0x05d4('0x29')]);}logger[_0x05d4('0x28')](_0x05d4('0x23'),_0x4204e1,_0x45573a[_0x05d4('0x28')][_0x05d4('0x29')]);return _0x4c2409(_0x45573a['error']['message']);}else{logger['info'](_0x05d4('0x23'),_0x4204e1,_0x05d4('0x24'));_0x4c2409(_0x45573a[_0x05d4('0x2a')][_0x05d4('0x29')]);}})[_0x05d4('0x2b')](function(_0x22fe4e){logger[_0x05d4('0x28')]('ZohoAccount,\x20%s,\x20%s',_0x4204e1,_0x22fe4e);_0x3f1b06(_0x22fe4e);});});}function respondWithStatusCode(_0x2687d3,_0x23dea7){_0x23dea7=_0x23dea7||0xcc;return function(_0x430fe0){if(_0x430fe0){return _0x2687d3['sendStatus'](_0x23dea7);}return _0x2687d3[_0x05d4('0x2c')](_0x23dea7)[_0x05d4('0x2d')]();};}function respondWithResult(_0x4620f9,_0x51ce2d){_0x51ce2d=_0x51ce2d||0xc8;return function(_0x17c814){if(_0x17c814){return _0x4620f9['status'](_0x51ce2d)[_0x05d4('0x2e')](_0x17c814);}};}function respondWithFilteredResult(_0x10da0b,_0x6b35fd){return function(_0x6b51f6){if(_0x6b51f6){var _0x411fe0=_0x6b51f6['count'],_0x4dbf10=_0x6b35fd['offset'],_0x498433=_0x6b35fd[_0x05d4('0x2f')]+_0x6b35fd[_0x05d4('0x30')],_0x23312e;if(_0x498433>=_0x411fe0){_0x498433=_0x411fe0;_0x23312e=0xc8;}else{_0x23312e=0xce;}_0x10da0b[_0x05d4('0x2c')](_0x23312e);return _0x10da0b[_0x05d4('0x31')]('Content-Range',_0x4dbf10+'-'+_0x498433+'/'+_0x411fe0)[_0x05d4('0x2e')](_0x6b51f6);}return null;};}function patchUpdates(_0x3f5295){return function(_0x5638a2){try{jsonpatch[_0x05d4('0x32')](_0x5638a2,_0x3f5295,!![]);}catch(_0xb896b2){return BPromise[_0x05d4('0x33')](_0xb896b2);}return _0x5638a2[_0x05d4('0x34')]();};}function saveUpdates(_0x3c413d,_0x17c130){return function(_0xea6772){if(_0xea6772){return _0xea6772[_0x05d4('0x35')](_0x3c413d)['then'](function(_0x3b1a78){return _0x3b1a78;});}return null;};}function removeEntity(_0x30ff89,_0x44f7bc){return function(_0x1952b3){if(_0x1952b3){return _0x1952b3['destroy']()['then'](function(){_0x30ff89[_0x05d4('0x2c')](0xcc)[_0x05d4('0x2d')]();});}};}function handleEntityNotFound(_0x442272,_0x33efe8){return function(_0x3ca82b){if(!_0x3ca82b){_0x442272[_0x05d4('0x36')](0x194);}return _0x3ca82b;};}function handleError(_0x5a6c17,_0xf02724){_0xf02724=_0xf02724||0x1f4;return function(_0x370326){logger[_0x05d4('0x28')](_0x370326[_0x05d4('0x37')]);if(_0x370326[_0x05d4('0x38')]){delete _0x370326[_0x05d4('0x38')];}_0x5a6c17[_0x05d4('0x2c')](_0xf02724)['send'](_0x370326);};}exports[_0x05d4('0x39')]=function(_0x122662,_0x3edfe9){var _0x3371ab={},_0x49040d={},_0x90460c={'count':0x0,'rows':[]};var _0x3a83ed=_['map'](db[_0x05d4('0x3a')][_0x05d4('0x3b')],function(_0x39dbc5){return{'name':_0x39dbc5[_0x05d4('0x3c')],'type':_0x39dbc5[_0x05d4('0x3d')][_0x05d4('0x3e')]};});_0x49040d[_0x05d4('0x3f')]=_['map'](_0x3a83ed,'name');_0x49040d[_0x05d4('0x40')]=_[_0x05d4('0x41')](_0x122662[_0x05d4('0x40')]);_0x49040d[_0x05d4('0x42')]=_[_0x05d4('0x43')](_0x49040d['model'],_0x49040d[_0x05d4('0x40')]);_0x3371ab[_0x05d4('0x44')]=_[_0x05d4('0x43')](_0x49040d['model'],qs[_0x05d4('0x45')](_0x122662[_0x05d4('0x40')][_0x05d4('0x45')]));_0x3371ab[_0x05d4('0x44')]=_0x3371ab[_0x05d4('0x44')][_0x05d4('0x46')]?_0x3371ab[_0x05d4('0x44')]:_0x49040d[_0x05d4('0x3f')];if(!_0x122662['query'][_0x05d4('0x47')]('nolimit')){_0x3371ab[_0x05d4('0x30')]=qs[_0x05d4('0x30')](_0x122662[_0x05d4('0x40')]['limit']);_0x3371ab['offset']=qs['offset'](_0x122662[_0x05d4('0x40')]['offset']);}_0x3371ab[_0x05d4('0x48')]=qs[_0x05d4('0x49')](_0x122662[_0x05d4('0x40')]['sort']);_0x3371ab[_0x05d4('0x4a')]=qs[_0x05d4('0x42')](_[_0x05d4('0x4b')](_0x122662['query'],_0x49040d[_0x05d4('0x42')]),_0x3a83ed);if(_0x122662[_0x05d4('0x40')]['filter']){_0x3371ab[_0x05d4('0x4a')]=_[_0x05d4('0x4c')](_0x3371ab[_0x05d4('0x4a')],{'$or':_[_0x05d4('0x4d')](_0x3a83ed,function(_0x1db94b){if(_0x1db94b[_0x05d4('0x3d')]!==_0x05d4('0x4e')){var _0x413507={};_0x413507[_0x1db94b[_0x05d4('0x38')]]={'$like':'%'+_0x122662['query']['filter']+'%'};return _0x413507;}})});}_0x3371ab=_[_0x05d4('0x4c')]({},_0x3371ab,_0x122662[_0x05d4('0x4f')]);var _0x4d9559={'where':_0x3371ab[_0x05d4('0x4a')]};return db[_0x05d4('0x3a')]['count'](_0x4d9559)[_0x05d4('0x21')](function(_0x1b7ad3){_0x90460c[_0x05d4('0x50')]=_0x1b7ad3;if(_0x122662[_0x05d4('0x40')][_0x05d4('0x51')]){_0x3371ab[_0x05d4('0x52')]=[{'all':!![]}];}return db[_0x05d4('0x3a')][_0x05d4('0x53')](_0x3371ab);})[_0x05d4('0x21')](function(_0x4769e7){_0x90460c[_0x05d4('0x54')]=_0x4769e7;return _0x90460c;})['then'](respondWithFilteredResult(_0x3edfe9,_0x3371ab))[_0x05d4('0x2b')](handleError(_0x3edfe9,null));};exports[_0x05d4('0x55')]=function(_0x43e826,_0x448092){var _0x330e47={'raw':![],'where':{'id':_0x43e826[_0x05d4('0x56')]['id']}},_0x15f2b9={};_0x15f2b9[_0x05d4('0x3f')]=_[_0x05d4('0x41')](db[_0x05d4('0x3a')][_0x05d4('0x3b')]);_0x15f2b9[_0x05d4('0x40')]=_[_0x05d4('0x41')](_0x43e826[_0x05d4('0x40')]);_0x15f2b9['filters']=_[_0x05d4('0x43')](_0x15f2b9[_0x05d4('0x3f')],_0x15f2b9[_0x05d4('0x40')]);_0x330e47['attributes']=_[_0x05d4('0x43')](_0x15f2b9[_0x05d4('0x3f')],qs[_0x05d4('0x45')](_0x43e826[_0x05d4('0x40')]['fields']));_0x330e47[_0x05d4('0x44')]=_0x330e47[_0x05d4('0x44')][_0x05d4('0x46')]?_0x330e47['attributes']:_0x15f2b9['model'];if(_0x43e826[_0x05d4('0x40')][_0x05d4('0x51')]){_0x330e47[_0x05d4('0x52')]=[{'all':!![]}];}_0x330e47=_['merge']({},_0x330e47,_0x43e826[_0x05d4('0x4f')]);return db[_0x05d4('0x3a')][_0x05d4('0x57')](_0x330e47)[_0x05d4('0x21')](handleEntityNotFound(_0x448092,null))[_0x05d4('0x21')](respondWithResult(_0x448092,null))[_0x05d4('0x2b')](handleError(_0x448092,null));};exports[_0x05d4('0x58')]=function(_0x2c3421,_0x2bca27){return db['ZohoAccount'][_0x05d4('0x58')](_0x2c3421[_0x05d4('0x59')],{})[_0x05d4('0x21')](respondWithResult(_0x2bca27,0xc9))[_0x05d4('0x2b')](handleError(_0x2bca27,null));};exports[_0x05d4('0x35')]=function(_0x39c828,_0x4675f8){if(_0x39c828[_0x05d4('0x59')]['id']){delete _0x39c828[_0x05d4('0x59')]['id'];}return db[_0x05d4('0x3a')]['find']({'where':{'id':_0x39c828[_0x05d4('0x56')]['id']}})[_0x05d4('0x21')](handleEntityNotFound(_0x4675f8,null))[_0x05d4('0x21')](saveUpdates(_0x39c828[_0x05d4('0x59')],null))[_0x05d4('0x21')](respondWithResult(_0x4675f8,null))['catch'](handleError(_0x4675f8,null));};exports[_0x05d4('0x5a')]=function(_0x137d46,_0x1434a4){return db[_0x05d4('0x3a')][_0x05d4('0x57')]({'where':{'id':_0x137d46['params']['id']}})[_0x05d4('0x21')](handleEntityNotFound(_0x1434a4,null))[_0x05d4('0x21')](removeEntity(_0x1434a4,null))[_0x05d4('0x2b')](handleError(_0x1434a4,null));};exports[_0x05d4('0x5b')]=function(_0x36a7d4,_0x223952,_0x11644f){var _0x15a731={};var _0x12a34e={};var _0x28fa6d;var _0x22bf8b;return db[_0x05d4('0x3a')][_0x05d4('0x5c')]({'where':{'id':_0x36a7d4['params']['id']}})[_0x05d4('0x21')](handleEntityNotFound(_0x223952,null))[_0x05d4('0x21')](function(_0x383ff6){if(_0x383ff6){_0x28fa6d=_0x383ff6;_0x12a34e[_0x05d4('0x3f')]=_['keys'](db[_0x05d4('0x5d')][_0x05d4('0x3b')]);_0x12a34e[_0x05d4('0x40')]=_['keys'](_0x36a7d4[_0x05d4('0x40')]);_0x12a34e[_0x05d4('0x42')]=_['intersection'](_0x12a34e[_0x05d4('0x3f')],_0x12a34e[_0x05d4('0x40')]);_0x15a731['attributes']=_[_0x05d4('0x43')](_0x12a34e[_0x05d4('0x3f')],qs[_0x05d4('0x45')](_0x36a7d4[_0x05d4('0x40')]['fields']));_0x15a731[_0x05d4('0x44')]=_0x15a731['attributes'][_0x05d4('0x46')]?_0x15a731[_0x05d4('0x44')]:_0x12a34e[_0x05d4('0x3f')];_0x15a731['order']=qs['sort'](_0x36a7d4[_0x05d4('0x40')][_0x05d4('0x49')]);_0x15a731[_0x05d4('0x4a')]=qs[_0x05d4('0x42')](_['pick'](_0x36a7d4[_0x05d4('0x40')],_0x12a34e[_0x05d4('0x42')]));if(_0x36a7d4[_0x05d4('0x40')][_0x05d4('0x5e')]){_0x15a731['where']=_[_0x05d4('0x4c')](_0x15a731[_0x05d4('0x4a')],{'$or':_[_0x05d4('0x4d')](_0x15a731[_0x05d4('0x44')],function(_0x514eba){var _0x31b94d={};_0x31b94d[_0x514eba]={'$like':'%'+_0x36a7d4[_0x05d4('0x40')][_0x05d4('0x5e')]+'%'};return _0x31b94d;})});}_0x15a731=_[_0x05d4('0x4c')]({},_0x15a731,_0x36a7d4[_0x05d4('0x4f')]);return _0x28fa6d['getConfigurations'](_0x15a731);}})[_0x05d4('0x21')](function(_0x2a9cda){if(_0x2a9cda){_0x22bf8b=_0x2a9cda[_0x05d4('0x46')];if(!_0x36a7d4['query']['hasOwnProperty'](_0x05d4('0x5f'))){_0x15a731[_0x05d4('0x30')]=qs['limit'](_0x36a7d4[_0x05d4('0x40')][_0x05d4('0x30')]);_0x15a731[_0x05d4('0x2f')]=qs['offset'](_0x36a7d4[_0x05d4('0x40')][_0x05d4('0x2f')]);}return _0x28fa6d['getConfigurations'](_0x15a731);}})['then'](function(_0x17eb30){if(_0x17eb30){return _0x17eb30?{'count':_0x22bf8b,'rows':_0x17eb30}:null;}})[_0x05d4('0x21')](respondWithResult(_0x223952,null))[_0x05d4('0x2b')](handleError(_0x223952,null));};exports[_0x05d4('0x60')]=function(_0x220e16,_0x3a1b48,_0x13b5a3){if(_0x220e16['body']['id']){delete _0x220e16[_0x05d4('0x59')]['id'];}return db[_0x05d4('0x3a')][_0x05d4('0x5c')]({'where':{'id':_0x220e16[_0x05d4('0x56')]['id']}})[_0x05d4('0x21')](handleEntityNotFound(_0x3a1b48,null))[_0x05d4('0x21')](function(_0x19b83b){if(_0x19b83b){_0x220e16['body'][_0x05d4('0x61')]=_0x19b83b['id'];_0x220e16['body'][_0x05d4('0x62')]=integrations['getSubjects'](_0x220e16[_0x05d4('0x59')][_0x05d4('0x63')],_0x220e16[_0x05d4('0x59')][_0x05d4('0x3d')]);_0x220e16[_0x05d4('0x59')][_0x05d4('0x64')]=integrations[_0x05d4('0x65')](_0x220e16['body'][_0x05d4('0x63')],_0x220e16[_0x05d4('0x59')]['type']);return db[_0x05d4('0x5d')]['create'](_0x220e16['body'],{'include':[{'model':db['ZohoField'],'as':_0x05d4('0x62')},{'model':db[_0x05d4('0x66')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x3a1b48,null))[_0x05d4('0x2b')](handleError(_0x3a1b48,null));};function getAccessToken(_0x2a4ba5){return new Promise(function(_0x240bf8,_0xfdb846){var _0x2bfd92;switch(_0x2a4ba5[_0x05d4('0x67')]){case'US':_0x2bfd92=_0x05d4('0x68');break;case'AU':_0x2bfd92=_0x05d4('0x69');break;case'EU':_0x2bfd92=_0x05d4('0x6a');break;case'IN':_0x2bfd92=_0x05d4('0x6b');break;case'CN':_0x2bfd92=_0x05d4('0x6c');break;default:_0x2bfd92=_0x05d4('0x6a');break;}var _0x2daed5={'method':_0x05d4('0x6d'),'uri':_0x2bfd92+_0x05d4('0x6e'),'qs':{'refresh_token':_0x2a4ba5['refreshToken'],'client_id':_0x2a4ba5['clientId'],'client_secret':_0x2a4ba5[_0x05d4('0x6f')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x2daed5)[_0x05d4('0x21')](function(_0x4ac067){if(_0x4ac067[_0x05d4('0x70')]){_0x240bf8(_0x4ac067[_0x05d4('0x70')]);}else{_0xfdb846('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x05d4('0x2b')](function(_0x59a4bc){_0xfdb846(_0x59a4bc);});});}exports[_0x05d4('0x71')]=function(_0x188816,_0x8ad667,_0x19452b){var _0x1c6579,_0x4addb3,_0x2ab05a,_0x4d1966,_0x5ecb91;return db['ZohoAccount']['findOne']({'where':{'id':_0x188816['params']['id']},'attributes':['id','host',_0x05d4('0x67'),'clientId',_0x05d4('0x6f'),'serverUrl',_0x05d4('0x27'),'refreshToken']})['then'](handleEntityNotFound(_0x8ad667,null))[_0x05d4('0x21')](function(_0x2ce7bc){_0x5ecb91=_0x2ce7bc;_0x1c6579=_0x5ecb91['host'];_0x4addb3=_0x1c6579===_0x05d4('0x72')?'eu':_0x05d4('0x73');_0x2ab05a=_0x5ecb91[_0x05d4('0x74')];var _0x3146e7=_0x2ab05a[_0x05d4('0x75')](-0x1);if(_0x3146e7==='/'||_0x3146e7==='\x5c'||_0x3146e7===':'){_0x2ab05a=_0x2ab05a[_0x05d4('0x76')](0x0,_0x2ab05a[_0x05d4('0x77')](_0x3146e7));}if(!_0x5ecb91[_0x05d4('0x78')]){throw new Error(_0x05d4('0x79'));}return getAccessToken(_0x5ecb91);})[_0x05d4('0x21')](function(_0x1c6943){if(_0x1c6943){return rp({'method':_0x05d4('0x7a'),'uri':util['format'](_0x05d4('0x7b'),_0x4addb3),'qs':{'module':_0x05d4('0x7c')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1c6943},'json':!![]});}})['then'](function(_0x589cbd){if(_0x589cbd){if(_0x589cbd[_0x05d4('0x7d')]&&_0x589cbd['response'][_0x05d4('0x28')]){throw new Error(_0x589cbd[_0x05d4('0x7d')]['error'][_0x05d4('0x29')]);}var _0x988117=[];var _0xe5f2d6=[];var _0x41540a=[_0x05d4('0x7e'),_0x05d4('0x7f'),_0x05d4('0x80'),_0x05d4('0x81'),_0x05d4('0x82'),_0x05d4('0x83'),_0x05d4('0x84'),_0x05d4('0x85')];_0xe5f2d6=_[_0x05d4('0x86')](_0x589cbd[_0x05d4('0x45')],function(_0x33121a){return _0x41540a['includes'](_0x33121a['api_name']);});for(var _0x18f8d7=0x0;_0x18f8d7<_0xe5f2d6[_0x05d4('0x46')];_0x18f8d7++){if(_0xe5f2d6[_0x18f8d7][_0x05d4('0x87')]===![]){_0x988117[_0x05d4('0x88')]({'id':_0xe5f2d6[_0x18f8d7]['id'],'name':_0xe5f2d6[_0x18f8d7]['display_label'],'custom':_0xe5f2d6[_0x18f8d7][_0x05d4('0x89')],'options':_0xe5f2d6[_0x18f8d7][_0x05d4('0x8a')]==='picklist'&&_0xe5f2d6[_0x18f8d7][_0x05d4('0x8b')][_0x05d4('0x46')]>-0x1?_[_0x05d4('0x4d')](_0xe5f2d6[_0x18f8d7][_0x05d4('0x8b')],function(_0x3417af){return{'name':_0x3417af,'value':_0x3417af};}):[]});}}return{'count':_0x988117[_0x05d4('0x46')],'rows':_0x988117};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x8ad667,null))[_0x05d4('0x2b')](function(_0x309782){var _0x343e8b=_0x188816[_0x05d4('0x40')][_0x05d4('0x1c')]?0x1f4:_0x309782['statusCode']||0x1f4;logger['error'](_0x05d4('0x8c'),_0x05d4('0x71'),_0x343e8b,JSON[_0x05d4('0x8d')](_0x309782));delete _0x309782[_0x05d4('0x38')];if(_0x343e8b===0x191){_0x343e8b=0x190;}_0x8ad667['status'](_0x343e8b)[_0x05d4('0x8e')](_0x188816[_0x05d4('0x40')][_0x05d4('0x1c')]?{'message':_0x05d4('0x8f'),'statusCode':_0x309782[_0x05d4('0x90')]}:_0x309782);});}; \ No newline at end of file +var _0x91e0=['show','params','find','create','body','ZohoConfiguration','pick','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','Descriptions','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','getFields','host','zone','serverUrl','refreshToken','zoho.eu','com','substring','lastIndexOf','GET','format','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','display_label','data_type','picklist','pick_list_values','statusCode','Wrong\x20credentials','html-pdf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','Sequelize','request','info','ZohoAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','then'];(function(_0x31c217,_0xc88f1b){var _0x42cc6d=function(_0x5a073b){while(--_0x5a073b){_0x31c217['push'](_0x31c217['shift']());}};_0x42cc6d(++_0xc88f1b);}(_0x91e0,0x1d2));var _0x091e=function(_0x3c2daa,_0x34e50c){_0x3c2daa=_0x3c2daa-0x0;var _0x2fbe50=_0x91e0[_0x3c2daa];return _0x2fbe50;};'use strict';var pdf=require(_0x091e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x091e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x091e('0x2'));var moment=require(_0x091e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x091e('0x4'));var util=require(_0x091e('0x5'));var path=require(_0x091e('0x6'));var sox=require(_0x091e('0x7'));var csv=require('to-csv');var ejs=require(_0x091e('0x8'));var fs=require('fs');var _=require(_0x091e('0x9'));var squel=require(_0x091e('0xa'));var crypto=require(_0x091e('0xb'));var jsforce=require(_0x091e('0xc'));var deskjs=require(_0x091e('0xd'));var toCsv=require(_0x091e('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x091e('0xf'));var authService=require(_0x091e('0x10'));var qs=require(_0x091e('0x11'));var as=require(_0x091e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x091e('0x13'));var utils=require(_0x091e('0x14'));var config=require('../../config/environment');var db=require(_0x091e('0x15'))['db'];var integrations=require(_0x091e('0x16'));var jayson=require(_0x091e('0x17'));var client=jayson[_0x091e('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x16eadf,_0xa8024d,_0x209503){if(_0x209503){var _0x20a051=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x20a051[_0x091e('0x19')](_0xa8024d)){return _0x16eadf;}else{throw new db[(_0x091e('0x1a'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x16eadf;}}function respondWithRpcPromise(_0x4016e0,_0x1570ef,_0x1953db,_0x4b0e3d){return new BPromise(function(_0x12909c,_0x1c5655){var _0x458b51=_0x4b0e3d||client;return _0x458b51[_0x091e('0x1b')](_0x4016e0,_0x1953db)['then'](function(_0x5f0e19){logger[_0x091e('0x1c')](_0x091e('0x1d'),_0x1570ef,'request\x20sent');logger[_0x091e('0x1e')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x1570ef,_0x091e('0x1f'),JSON[_0x091e('0x20')](_0x5f0e19));if(_0x5f0e19[_0x091e('0x21')]){if(_0x5f0e19[_0x091e('0x21')][_0x091e('0x22')]===0x1f4){logger[_0x091e('0x21')](_0x091e('0x1d'),_0x1570ef,_0x5f0e19[_0x091e('0x21')]['message']);return _0x1c5655(_0x5f0e19[_0x091e('0x21')]['message']);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x1570ef,_0x5f0e19[_0x091e('0x21')][_0x091e('0x23')]);return _0x12909c(_0x5f0e19['error'][_0x091e('0x23')]);}else{logger[_0x091e('0x1c')](_0x091e('0x1d'),_0x1570ef,'request\x20sent');_0x12909c(_0x5f0e19[_0x091e('0x24')]['message']);}})[_0x091e('0x25')](function(_0x261b04){logger[_0x091e('0x21')](_0x091e('0x1d'),_0x1570ef,_0x261b04);_0x1c5655(_0x261b04);});});}function respondWithStatusCode(_0x3673b5,_0x9d92e9){_0x9d92e9=_0x9d92e9||0xcc;return function(_0x28bcad){if(_0x28bcad){return _0x3673b5[_0x091e('0x26')](_0x9d92e9);}return _0x3673b5['status'](_0x9d92e9)[_0x091e('0x27')]();};}function respondWithResult(_0xaf8601,_0x49abdc){_0x49abdc=_0x49abdc||0xc8;return function(_0x2b898b){if(_0x2b898b){return _0xaf8601[_0x091e('0x28')](_0x49abdc)[_0x091e('0x29')](_0x2b898b);}};}function respondWithFilteredResult(_0x5ec295,_0x2abbfe){return function(_0x33a7fd){if(_0x33a7fd){var _0xeb9f2c=_0x33a7fd[_0x091e('0x2a')],_0x2eb52f=_0x2abbfe[_0x091e('0x2b')],_0x5cce30=_0x2abbfe[_0x091e('0x2b')]+_0x2abbfe['limit'],_0x430ff1;if(_0x5cce30>=_0xeb9f2c){_0x5cce30=_0xeb9f2c;_0x430ff1=0xc8;}else{_0x430ff1=0xce;}_0x5ec295[_0x091e('0x28')](_0x430ff1);return _0x5ec295['set'](_0x091e('0x2c'),_0x2eb52f+'-'+_0x5cce30+'/'+_0xeb9f2c)[_0x091e('0x29')](_0x33a7fd);}return null;};}function patchUpdates(_0xb6686a){return function(_0x4f9a22){try{jsonpatch[_0x091e('0x2d')](_0x4f9a22,_0xb6686a,!![]);}catch(_0x1b70d6){return BPromise[_0x091e('0x2e')](_0x1b70d6);}return _0x4f9a22[_0x091e('0x2f')]();};}function saveUpdates(_0x4a7779,_0x169958){return function(_0xea282d){if(_0xea282d){return _0xea282d[_0x091e('0x30')](_0x4a7779)['then'](function(_0x3c0ced){return _0x3c0ced;});}return null;};}function removeEntity(_0x5e5913,_0x4a5c70){return function(_0xae7422){if(_0xae7422){return _0xae7422[_0x091e('0x31')]()['then'](function(){_0x5e5913[_0x091e('0x28')](0xcc)[_0x091e('0x27')]();});}};}function handleEntityNotFound(_0x268fc0,_0x3b7363){return function(_0x19d4ba){if(!_0x19d4ba){_0x268fc0[_0x091e('0x26')](0x194);}return _0x19d4ba;};}function handleError(_0x10a2a7,_0x471984){_0x471984=_0x471984||0x1f4;return function(_0x331641){logger[_0x091e('0x21')](_0x331641[_0x091e('0x32')]);if(_0x331641['name']){delete _0x331641[_0x091e('0x33')];}_0x10a2a7[_0x091e('0x28')](_0x471984)[_0x091e('0x34')](_0x331641);};}exports[_0x091e('0x35')]=function(_0x522cb3,_0x37e74e){var _0x4774fb={},_0x2dcbdb={},_0xe63b49={'count':0x0,'rows':[]};var _0x1a0589=_[_0x091e('0x36')](db[_0x091e('0x37')][_0x091e('0x38')],function(_0x4c9331){return{'name':_0x4c9331[_0x091e('0x39')],'type':_0x4c9331[_0x091e('0x3a')]['key']};});_0x2dcbdb[_0x091e('0x3b')]=_['map'](_0x1a0589,_0x091e('0x33'));_0x2dcbdb[_0x091e('0x3c')]=_[_0x091e('0x3d')](_0x522cb3['query']);_0x2dcbdb[_0x091e('0x3e')]=_[_0x091e('0x3f')](_0x2dcbdb[_0x091e('0x3b')],_0x2dcbdb[_0x091e('0x3c')]);_0x4774fb[_0x091e('0x40')]=_[_0x091e('0x3f')](_0x2dcbdb[_0x091e('0x3b')],qs[_0x091e('0x41')](_0x522cb3[_0x091e('0x3c')]['fields']));_0x4774fb['attributes']=_0x4774fb[_0x091e('0x40')][_0x091e('0x42')]?_0x4774fb['attributes']:_0x2dcbdb[_0x091e('0x3b')];if(!_0x522cb3[_0x091e('0x3c')][_0x091e('0x43')](_0x091e('0x44'))){_0x4774fb[_0x091e('0x45')]=qs[_0x091e('0x45')](_0x522cb3['query'][_0x091e('0x45')]);_0x4774fb[_0x091e('0x2b')]=qs[_0x091e('0x2b')](_0x522cb3[_0x091e('0x3c')]['offset']);}_0x4774fb[_0x091e('0x46')]=qs[_0x091e('0x47')](_0x522cb3[_0x091e('0x3c')][_0x091e('0x47')]);_0x4774fb[_0x091e('0x48')]=qs[_0x091e('0x3e')](_['pick'](_0x522cb3['query'],_0x2dcbdb['filters']),_0x1a0589);if(_0x522cb3[_0x091e('0x3c')][_0x091e('0x49')]){_0x4774fb[_0x091e('0x48')]=_[_0x091e('0x4a')](_0x4774fb['where'],{'$or':_['map'](_0x1a0589,function(_0x12a4eb){if(_0x12a4eb[_0x091e('0x3a')]!==_0x091e('0x4b')){var _0xf77b03={};_0xf77b03[_0x12a4eb[_0x091e('0x33')]]={'$like':'%'+_0x522cb3[_0x091e('0x3c')][_0x091e('0x49')]+'%'};return _0xf77b03;}})});}_0x4774fb=_['merge']({},_0x4774fb,_0x522cb3[_0x091e('0x4c')]);var _0x1f1a1a={'where':_0x4774fb[_0x091e('0x48')]};return db[_0x091e('0x37')][_0x091e('0x2a')](_0x1f1a1a)['then'](function(_0xafda49){_0xe63b49[_0x091e('0x2a')]=_0xafda49;if(_0x522cb3[_0x091e('0x3c')][_0x091e('0x4d')]){_0x4774fb[_0x091e('0x4e')]=[{'all':!![]}];}return db['ZohoAccount'][_0x091e('0x4f')](_0x4774fb);})['then'](function(_0x2d0db1){_0xe63b49[_0x091e('0x50')]=_0x2d0db1;return _0xe63b49;})[_0x091e('0x51')](respondWithFilteredResult(_0x37e74e,_0x4774fb))[_0x091e('0x25')](handleError(_0x37e74e,null));};exports[_0x091e('0x52')]=function(_0x3b52d,_0x5565e8){var _0x266904={'raw':![],'where':{'id':_0x3b52d[_0x091e('0x53')]['id']}},_0x5917d3={};_0x5917d3[_0x091e('0x3b')]=_[_0x091e('0x3d')](db['ZohoAccount'][_0x091e('0x38')]);_0x5917d3['query']=_['keys'](_0x3b52d[_0x091e('0x3c')]);_0x5917d3['filters']=_[_0x091e('0x3f')](_0x5917d3[_0x091e('0x3b')],_0x5917d3[_0x091e('0x3c')]);_0x266904[_0x091e('0x40')]=_[_0x091e('0x3f')](_0x5917d3['model'],qs['fields'](_0x3b52d[_0x091e('0x3c')]['fields']));_0x266904[_0x091e('0x40')]=_0x266904[_0x091e('0x40')][_0x091e('0x42')]?_0x266904[_0x091e('0x40')]:_0x5917d3[_0x091e('0x3b')];if(_0x3b52d[_0x091e('0x3c')]['includeAll']){_0x266904['include']=[{'all':!![]}];}_0x266904=_['merge']({},_0x266904,_0x3b52d[_0x091e('0x4c')]);return db[_0x091e('0x37')][_0x091e('0x54')](_0x266904)[_0x091e('0x51')](handleEntityNotFound(_0x5565e8,null))[_0x091e('0x51')](respondWithResult(_0x5565e8,null))[_0x091e('0x25')](handleError(_0x5565e8,null));};exports[_0x091e('0x55')]=function(_0x5bfba0,_0x150f90){return db['ZohoAccount'][_0x091e('0x55')](_0x5bfba0[_0x091e('0x56')],{})[_0x091e('0x51')](respondWithResult(_0x150f90,0xc9))['catch'](handleError(_0x150f90,null));};exports[_0x091e('0x30')]=function(_0xb92fb9,_0x88536d){if(_0xb92fb9[_0x091e('0x56')]['id']){delete _0xb92fb9[_0x091e('0x56')]['id'];}return db[_0x091e('0x37')][_0x091e('0x54')]({'where':{'id':_0xb92fb9[_0x091e('0x53')]['id']}})[_0x091e('0x51')](handleEntityNotFound(_0x88536d,null))['then'](saveUpdates(_0xb92fb9[_0x091e('0x56')],null))[_0x091e('0x51')](respondWithResult(_0x88536d,null))['catch'](handleError(_0x88536d,null));};exports[_0x091e('0x31')]=function(_0x45df9,_0x345a0d){return db['ZohoAccount']['find']({'where':{'id':_0x45df9[_0x091e('0x53')]['id']}})['then'](handleEntityNotFound(_0x345a0d,null))['then'](removeEntity(_0x345a0d,null))['catch'](handleError(_0x345a0d,null));};exports['getConfigurations']=function(_0x5719a2,_0x111fb5,_0x3c0155){var _0x2a47a9={};var _0x41cbbf={};var _0x59f2c5;var _0x14a9e7;return db[_0x091e('0x37')]['findOne']({'where':{'id':_0x5719a2[_0x091e('0x53')]['id']}})[_0x091e('0x51')](handleEntityNotFound(_0x111fb5,null))[_0x091e('0x51')](function(_0xd8f55b){if(_0xd8f55b){_0x59f2c5=_0xd8f55b;_0x41cbbf['model']=_[_0x091e('0x3d')](db[_0x091e('0x57')]['rawAttributes']);_0x41cbbf[_0x091e('0x3c')]=_[_0x091e('0x3d')](_0x5719a2[_0x091e('0x3c')]);_0x41cbbf[_0x091e('0x3e')]=_['intersection'](_0x41cbbf['model'],_0x41cbbf[_0x091e('0x3c')]);_0x2a47a9[_0x091e('0x40')]=_[_0x091e('0x3f')](_0x41cbbf[_0x091e('0x3b')],qs[_0x091e('0x41')](_0x5719a2[_0x091e('0x3c')][_0x091e('0x41')]));_0x2a47a9['attributes']=_0x2a47a9[_0x091e('0x40')][_0x091e('0x42')]?_0x2a47a9[_0x091e('0x40')]:_0x41cbbf[_0x091e('0x3b')];_0x2a47a9[_0x091e('0x46')]=qs['sort'](_0x5719a2[_0x091e('0x3c')][_0x091e('0x47')]);_0x2a47a9['where']=qs[_0x091e('0x3e')](_[_0x091e('0x58')](_0x5719a2[_0x091e('0x3c')],_0x41cbbf['filters']));if(_0x5719a2[_0x091e('0x3c')][_0x091e('0x49')]){_0x2a47a9[_0x091e('0x48')]=_[_0x091e('0x4a')](_0x2a47a9[_0x091e('0x48')],{'$or':_[_0x091e('0x36')](_0x2a47a9['attributes'],function(_0x26ea93){var _0x263eb1={};_0x263eb1[_0x26ea93]={'$like':'%'+_0x5719a2['query']['filter']+'%'};return _0x263eb1;})});}_0x2a47a9=_[_0x091e('0x4a')]({},_0x2a47a9,_0x5719a2[_0x091e('0x4c')]);return _0x59f2c5[_0x091e('0x59')](_0x2a47a9);}})['then'](function(_0x1d90c4){if(_0x1d90c4){_0x14a9e7=_0x1d90c4['length'];if(!_0x5719a2[_0x091e('0x3c')]['hasOwnProperty'](_0x091e('0x44'))){_0x2a47a9['limit']=qs['limit'](_0x5719a2[_0x091e('0x3c')]['limit']);_0x2a47a9[_0x091e('0x2b')]=qs[_0x091e('0x2b')](_0x5719a2[_0x091e('0x3c')][_0x091e('0x2b')]);}return _0x59f2c5[_0x091e('0x59')](_0x2a47a9);}})['then'](function(_0x1a8c98){if(_0x1a8c98){return _0x1a8c98?{'count':_0x14a9e7,'rows':_0x1a8c98}:null;}})[_0x091e('0x51')](respondWithResult(_0x111fb5,null))[_0x091e('0x25')](handleError(_0x111fb5,null));};exports[_0x091e('0x5a')]=function(_0x15d1f0,_0x47f07c,_0x430830){if(_0x15d1f0[_0x091e('0x56')]['id']){delete _0x15d1f0['body']['id'];}return db[_0x091e('0x37')][_0x091e('0x5b')]({'where':{'id':_0x15d1f0[_0x091e('0x53')]['id']}})[_0x091e('0x51')](handleEntityNotFound(_0x47f07c,null))[_0x091e('0x51')](function(_0x4246d5){if(_0x4246d5){_0x15d1f0['body'][_0x091e('0x5c')]=_0x4246d5['id'];_0x15d1f0[_0x091e('0x56')][_0x091e('0x5d')]=integrations[_0x091e('0x5e')](_0x15d1f0[_0x091e('0x56')][_0x091e('0x5f')],_0x15d1f0['body']['type']);_0x15d1f0[_0x091e('0x56')]['Descriptions']=integrations[_0x091e('0x60')](_0x15d1f0['body']['channel'],_0x15d1f0[_0x091e('0x56')][_0x091e('0x3a')]);return db['ZohoConfiguration'][_0x091e('0x55')](_0x15d1f0[_0x091e('0x56')],{'include':[{'model':db['ZohoField'],'as':_0x091e('0x5d')},{'model':db['ZohoField'],'as':_0x091e('0x61')}]});}return null;})['then'](respondWithResult(_0x47f07c,null))[_0x091e('0x25')](handleError(_0x47f07c,null));};function getAccessToken(_0x288419){return new Promise(function(_0x10b9c9,_0x39c815){var _0x39785a;switch(_0x288419['zone']){case'US':_0x39785a=_0x091e('0x62');break;case'AU':_0x39785a='https://accounts.zoho.com.au';break;case'EU':_0x39785a=_0x091e('0x63');break;case'IN':_0x39785a=_0x091e('0x64');break;case'CN':_0x39785a='https://accounts.zoho.com.cn';break;default:_0x39785a=_0x091e('0x63');break;}var _0x449a64={'method':_0x091e('0x65'),'uri':_0x39785a+_0x091e('0x66'),'qs':{'refresh_token':_0x288419['refreshToken'],'client_id':_0x288419[_0x091e('0x67')],'client_secret':_0x288419[_0x091e('0x68')],'grant_type':_0x091e('0x69')},'json':!![]};return rp(_0x449a64)[_0x091e('0x51')](function(_0x46fd15){if(_0x46fd15[_0x091e('0x6a')]){_0x10b9c9(_0x46fd15[_0x091e('0x6a')]);}else{_0x39c815('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x16b563){_0x39c815(_0x16b563);});});}exports[_0x091e('0x6b')]=function(_0x2c272c,_0x53ad5e,_0x125418){var _0x3ff7bc,_0xa38309,_0x54b8aa,_0xf1eb21,_0x4be4fc;return db[_0x091e('0x37')][_0x091e('0x5b')]({'where':{'id':_0x2c272c[_0x091e('0x53')]['id']},'attributes':['id',_0x091e('0x6c'),_0x091e('0x6d'),_0x091e('0x67'),_0x091e('0x68'),_0x091e('0x6e'),_0x091e('0x22'),_0x091e('0x6f')]})[_0x091e('0x51')](handleEntityNotFound(_0x53ad5e,null))[_0x091e('0x51')](function(_0x17aa8c){_0x4be4fc=_0x17aa8c;_0x3ff7bc=_0x4be4fc[_0x091e('0x6c')];_0xa38309=_0x3ff7bc===_0x091e('0x70')?'eu':_0x091e('0x71');_0x54b8aa=_0x4be4fc['serverUrl'];var _0x29bd42=_0x54b8aa['slice'](-0x1);if(_0x29bd42==='/'||_0x29bd42==='\x5c'||_0x29bd42===':'){_0x54b8aa=_0x54b8aa[_0x091e('0x72')](0x0,_0x54b8aa[_0x091e('0x73')](_0x29bd42));}if(!_0x4be4fc['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x4be4fc);})[_0x091e('0x51')](function(_0x4acfd8){if(_0x4acfd8){return rp({'method':_0x091e('0x74'),'uri':util[_0x091e('0x75')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0xa38309),'qs':{'module':'Calls'},'headers':{'Authorization':_0x091e('0x76')+_0x4acfd8},'json':!![]});}})[_0x091e('0x51')](function(_0x1f0223){if(_0x1f0223){if(_0x1f0223['response']&&_0x1f0223[_0x091e('0x77')][_0x091e('0x21')]){throw new Error(_0x1f0223['response'][_0x091e('0x21')][_0x091e('0x23')]);}var _0x46b9f1=[];var _0x2eea13=[];var _0x5e4e14=[_0x091e('0x78'),_0x091e('0x79'),_0x091e('0x7a'),_0x091e('0x7b'),'Call_Duration',_0x091e('0x7c'),_0x091e('0x7d'),_0x091e('0x7e')];_0x2eea13=_[_0x091e('0x7f')](_0x1f0223[_0x091e('0x41')],function(_0x58e2fb){return _0x5e4e14[_0x091e('0x80')](_0x58e2fb['api_name']);});for(var _0xab6688=0x0;_0xab6688<_0x2eea13[_0x091e('0x42')];_0xab6688++){if(_0x2eea13[_0xab6688][_0x091e('0x81')]===![]){_0x46b9f1[_0x091e('0x82')]({'id':_0x2eea13[_0xab6688]['id'],'name':_0x2eea13[_0xab6688][_0x091e('0x83')],'custom':_0x2eea13[_0xab6688]['custom_field'],'options':_0x2eea13[_0xab6688][_0x091e('0x84')]===_0x091e('0x85')&&_0x2eea13[_0xab6688][_0x091e('0x86')][_0x091e('0x42')]>-0x1?_[_0x091e('0x36')](_0x2eea13[_0xab6688]['pick_list_values'],function(_0x58312){return{'name':_0x58312,'value':_0x58312};}):[]});}}return{'count':_0x46b9f1['length'],'rows':_0x46b9f1};}else{return{'count':0x0,'rows':[]};}})[_0x091e('0x51')](respondWithResult(_0x53ad5e,null))[_0x091e('0x25')](function(_0x2ba992){var _0x4c061e=_0x2c272c[_0x091e('0x3c')][_0x091e('0x19')]?0x1f4:_0x2ba992[_0x091e('0x87')]||0x1f4;logger[_0x091e('0x21')]('getFields,\x20%s,\x20%s,\x20%s',_0x091e('0x6b'),_0x4c061e,JSON[_0x091e('0x20')](_0x2ba992));delete _0x2ba992[_0x091e('0x33')];if(_0x4c061e===0x191){_0x4c061e=0x190;}_0x53ad5e['status'](_0x4c061e)[_0x091e('0x34')](_0x2c272c[_0x091e('0x3c')][_0x091e('0x19')]?{'message':_0x091e('0x88'),'statusCode':_0x2ba992['statusCode']}:_0x2ba992);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index de3a37f..7e979e9 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 _0x26f2=['code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','/oauth/v2/token','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','changed','zone','serverUrl','clientId','clientSecret'];(function(_0x433cf9,_0x475bcf){var _0x7f0543=function(_0x232a7e){while(--_0x232a7e){_0x433cf9['push'](_0x433cf9['shift']());}};_0x7f0543(++_0x475bcf);}(_0x26f2,0x10a));var _0x226f=function(_0x1c0f15,_0xf281c4){_0x1c0f15=_0x1c0f15-0x0;var _0x47e9db=_0x26f2[_0x1c0f15];return _0x47e9db;};'use strict';var _=require(_0x226f('0x0'));var util=require('util');var logger=require(_0x226f('0x1'))(_0x226f('0x2'));var moment=require('moment');var BPromise=require(_0x226f('0x3'));var rp=require(_0x226f('0x4'));var fs=require('fs');var path=require(_0x226f('0x5'));var rimraf=require(_0x226f('0x6'));var config=require(_0x226f('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x17cf1e,_0x238bbf){return _0x17cf1e[_0x226f('0x8')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1d216f,_0x57bfcd,_0x3aeed5){if(_0x1d216f[_0x226f('0x9')](_0x226f('0xa'))||_0x1d216f['changed'](_0x226f('0xb'))||_0x1d216f[_0x226f('0x9')](_0x226f('0xc'))||_0x1d216f[_0x226f('0x9')](_0x226f('0xd'))||_0x1d216f[_0x226f('0x9')](_0x226f('0xe'))||_0x1d216f['changed'](_0x226f('0xf'))){var _0x54c5d5,_0x449943;_0x54c5d5=_0x1d216f[_0x226f('0xb')];var _0x272ff9=_0x54c5d5[_0x226f('0x10')](-0x1);if(_0x272ff9==='/'||_0x272ff9==='\x5c'||_0x272ff9===':'){_0x54c5d5=_0x54c5d5[_0x226f('0x11')](0x0,_0x54c5d5[_0x226f('0x12')](_0x272ff9));}switch(_0x1d216f[_0x226f('0xa')]){case'US':_0x449943=_0x226f('0x13');break;case'AU':_0x449943=_0x226f('0x14');break;case'IN':_0x449943=_0x226f('0x15');break;case'CN':_0x449943=_0x226f('0x16');break;default:_0x449943=_0x226f('0x17');break;}var _0x170858={'method':_0x226f('0x18'),'uri':_0x449943+'/oauth/v2/token','form':{'grant_type':_0x226f('0x19'),'client_id':_0x1d216f[_0x226f('0xc')],'client_secret':_0x1d216f['clientSecret'],'redirect_uri':_0x1d216f['serverUrl'],'code':_0x1d216f[_0x226f('0xe')]},'headers':{'Content-Type':_0x226f('0x1a')}};return rp(_0x170858)[_0x226f('0x1b')](function(_0x5464a7){var _0x7d25cb=JSON[_0x226f('0x1c')](_0x5464a7);if(_0x7d25cb[_0x226f('0x1d')]){_0x1d216f[_0x226f('0x1e')]=_0x7d25cb['refresh_token'];logger[_0x226f('0x1f')](util[_0x226f('0x20')](_0x226f('0x21'),_0x1d216f[_0x226f('0x22')],_0x1d216f['id']));}else{logger[_0x226f('0x23')](util[_0x226f('0x20')](_0x226f('0x24'),_0x1d216f[_0x226f('0x22')],_0x1d216f['id']),util[_0x226f('0x25')](_0x7d25cb,{'showHidden':![],'depth':null}));}return _0x3aeed5(null,_0x57bfcd);})[_0x226f('0x26')](function(_0x58c609){logger['error'](util['format'](_0x226f('0x24'),_0x1d216f[_0x226f('0x22')],_0x1d216f['id']),util[_0x226f('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x3aeed5(_0x58c609);});}else{return _0x3aeed5(null,_0x57bfcd);}},'beforeUpdate':function(_0x249fc5,_0x4cbb58,_0x526ac9){if(_0x249fc5[_0x226f('0x9')](_0x226f('0xa'))||_0x249fc5['changed']('serverUrl')||_0x249fc5[_0x226f('0x9')]('clientId')||_0x249fc5[_0x226f('0x9')](_0x226f('0xd'))||_0x249fc5[_0x226f('0x9')](_0x226f('0xe'))||_0x249fc5['changed'](_0x226f('0xf'))){var _0x1bfe83,_0x43767a;_0x1bfe83=_0x249fc5[_0x226f('0xb')];var _0x26ecd4=_0x1bfe83['slice'](-0x1);if(_0x26ecd4==='/'||_0x26ecd4==='\x5c'||_0x26ecd4===':'){_0x1bfe83=_0x1bfe83[_0x226f('0x11')](0x0,_0x1bfe83[_0x226f('0x12')](_0x26ecd4));}switch(_0x249fc5[_0x226f('0xa')]){case'US':_0x43767a=_0x226f('0x13');break;case'AU':_0x43767a=_0x226f('0x14');break;case'IN':_0x43767a='https://accounts.zoho.in';break;case'CN':_0x43767a=_0x226f('0x16');break;default:_0x43767a='https://accounts.zoho.eu';break;}var _0x2ee0ca={'method':_0x226f('0x18'),'uri':_0x43767a+_0x226f('0x27'),'form':{'grant_type':_0x226f('0x19'),'client_id':_0x249fc5['clientId'],'client_secret':_0x249fc5[_0x226f('0xd')],'redirect_uri':_0x249fc5[_0x226f('0xb')],'code':_0x249fc5[_0x226f('0xe')]},'headers':{'Content-Type':_0x226f('0x1a')}};return rp(_0x2ee0ca)['then'](function(_0x493b94){var _0x67a659=JSON[_0x226f('0x1c')](_0x493b94);if(_0x67a659[_0x226f('0x1d')]){_0x249fc5[_0x226f('0x1e')]=_0x67a659[_0x226f('0x1d')];logger['info'](util[_0x226f('0x20')](_0x226f('0x21'),_0x249fc5[_0x226f('0x22')],_0x249fc5['id']));}else{logger[_0x226f('0x23')](util[_0x226f('0x20')](_0x226f('0x24'),_0x249fc5[_0x226f('0x22')],_0x249fc5['id']),util['inspect'](_0x67a659,{'showHidden':![],'depth':null}));}return _0x526ac9(null,_0x4cbb58);})[_0x226f('0x26')](function(_0x3f7351){logger[_0x226f('0x23')](util['format'](_0x226f('0x24'),_0x249fc5[_0x226f('0x22')],_0x249fc5['id']),util[_0x226f('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x526ac9(_0x3f7351);});}else{return _0x526ac9(null,_0x4cbb58);}}}});}; \ No newline at end of file +var _0x1602=['https://accounts.zoho.eu','application/x-www-form-urlencoded','inspect','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','clientSecret','code','host','serverUrl','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','parse','refreshToken','refresh_token','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch'];(function(_0x142805,_0x25c54d){var _0x14d943=function(_0xdf2e18){while(--_0xdf2e18){_0x142805['push'](_0x142805['shift']());}};_0x14d943(++_0x25c54d);}(_0x1602,0xa7));var _0x2160=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x1602[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x2160('0x0'));var util=require('util');var logger=require(_0x2160('0x1'))(_0x2160('0x2'));var moment=require('moment');var BPromise=require(_0x2160('0x3'));var rp=require(_0x2160('0x4'));var fs=require('fs');var path=require(_0x2160('0x5'));var rimraf=require(_0x2160('0x6'));var config=require(_0x2160('0x7'));var attributes=require(_0x2160('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x2160('0x9')]=function(_0x481a59,_0x3afc1b){return _0x481a59[_0x2160('0xa')](_0x2160('0xb'),attributes,{'tableName':_0x2160('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1ac7da,_0x41092d,_0x53296f){if(_0x1ac7da[_0x2160('0xd')](_0x2160('0xe'))||_0x1ac7da[_0x2160('0xd')]('serverUrl')||_0x1ac7da[_0x2160('0xd')](_0x2160('0xf'))||_0x1ac7da[_0x2160('0xd')](_0x2160('0x10'))||_0x1ac7da[_0x2160('0xd')](_0x2160('0x11'))||_0x1ac7da['changed'](_0x2160('0x12'))){var _0x3480cd,_0x338ed0;_0x3480cd=_0x1ac7da[_0x2160('0x13')];var _0x15dc66=_0x3480cd[_0x2160('0x14')](-0x1);if(_0x15dc66==='/'||_0x15dc66==='\x5c'||_0x15dc66===':'){_0x3480cd=_0x3480cd[_0x2160('0x15')](0x0,_0x3480cd['lastIndexOf'](_0x15dc66));}switch(_0x1ac7da['zone']){case'US':_0x338ed0=_0x2160('0x16');break;case'AU':_0x338ed0=_0x2160('0x17');break;case'IN':_0x338ed0=_0x2160('0x18');break;case'CN':_0x338ed0=_0x2160('0x19');break;default:_0x338ed0='https://accounts.zoho.eu';break;}var _0x278ed9={'method':_0x2160('0x1a'),'uri':_0x338ed0+_0x2160('0x1b'),'form':{'grant_type':_0x2160('0x1c'),'client_id':_0x1ac7da['clientId'],'client_secret':_0x1ac7da[_0x2160('0x10')],'redirect_uri':_0x1ac7da[_0x2160('0x13')],'code':_0x1ac7da[_0x2160('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x278ed9)['then'](function(_0x3e95c6){var _0x53aeb4=JSON[_0x2160('0x1d')](_0x3e95c6);if(_0x53aeb4['refresh_token']){_0x1ac7da[_0x2160('0x1e')]=_0x53aeb4[_0x2160('0x1f')];logger['info'](util[_0x2160('0x20')](_0x2160('0x21'),_0x1ac7da[_0x2160('0x22')],_0x1ac7da['id']));}else{logger[_0x2160('0x23')](util['format'](_0x2160('0x24'),_0x1ac7da['name'],_0x1ac7da['id']),util['inspect'](_0x53aeb4,{'showHidden':![],'depth':null}));}return _0x53296f(null,_0x41092d);})[_0x2160('0x25')](function(_0x5664d2){logger['error'](util[_0x2160('0x20')](_0x2160('0x24'),_0x1ac7da['name'],_0x1ac7da['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x53296f(_0x5664d2);});}else{return _0x53296f(null,_0x41092d);}},'beforeUpdate':function(_0x296ff5,_0x2804bb,_0x141039){if(_0x296ff5[_0x2160('0xd')](_0x2160('0xe'))||_0x296ff5['changed'](_0x2160('0x13'))||_0x296ff5['changed'](_0x2160('0xf'))||_0x296ff5[_0x2160('0xd')](_0x2160('0x10'))||_0x296ff5[_0x2160('0xd')](_0x2160('0x11'))||_0x296ff5['changed']('host')){var _0x36ab39,_0x32593e;_0x36ab39=_0x296ff5['serverUrl'];var _0x45a9b4=_0x36ab39[_0x2160('0x14')](-0x1);if(_0x45a9b4==='/'||_0x45a9b4==='\x5c'||_0x45a9b4===':'){_0x36ab39=_0x36ab39['substring'](0x0,_0x36ab39['lastIndexOf'](_0x45a9b4));}switch(_0x296ff5['zone']){case'US':_0x32593e=_0x2160('0x16');break;case'AU':_0x32593e='https://accounts.zoho.com.au';break;case'IN':_0x32593e=_0x2160('0x18');break;case'CN':_0x32593e=_0x2160('0x19');break;default:_0x32593e=_0x2160('0x26');break;}var _0x270cdb={'method':_0x2160('0x1a'),'uri':_0x32593e+_0x2160('0x1b'),'form':{'grant_type':'authorization_code','client_id':_0x296ff5[_0x2160('0xf')],'client_secret':_0x296ff5['clientSecret'],'redirect_uri':_0x296ff5[_0x2160('0x13')],'code':_0x296ff5[_0x2160('0x11')]},'headers':{'Content-Type':_0x2160('0x27')}};return rp(_0x270cdb)['then'](function(_0x35b432){var _0x53611a=JSON[_0x2160('0x1d')](_0x35b432);if(_0x53611a['refresh_token']){_0x296ff5[_0x2160('0x1e')]=_0x53611a[_0x2160('0x1f')];logger['info'](util[_0x2160('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x296ff5['name'],_0x296ff5['id']));}else{logger[_0x2160('0x23')](util[_0x2160('0x20')](_0x2160('0x24'),_0x296ff5[_0x2160('0x22')],_0x296ff5['id']),util['inspect'](_0x53611a,{'showHidden':![],'depth':null}));}return _0x141039(null,_0x2804bb);})[_0x2160('0x25')](function(_0x25ad56){logger[_0x2160('0x23')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x296ff5[_0x2160('0x22')],_0x296ff5['id']),util[_0x2160('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x141039(_0x25ad56);});}else{return _0x141039(null,_0x2804bb);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index f103e2e..3c53e0f 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 _0x0034=['stringify','error','code','message','result','catch','ZohoAccount','options','raw','where','attributes','map','include','model','GetZohoAccount','find','ShowZohoAccount','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xbda5fd,_0x3dceb6){var _0x5a9267=function(_0x1a9e03){while(--_0x1a9e03){_0xbda5fd['push'](_0xbda5fd['shift']());}};_0x5a9267(++_0x3dceb6);}(_0x0034,0xdd));var _0x4003=function(_0x4ed7,_0x14f3ba){_0x4ed7=_0x4ed7-0x0;var _0x584b32=_0x0034[_0x4ed7];return _0x584b32;};'use strict';var _=require('lodash');var util=require(_0x4003('0x0'));var moment=require('moment');var BPromise=require(_0x4003('0x1'));var rs=require(_0x4003('0x2'));var fs=require('fs');var Redis=require(_0x4003('0x3'));var db=require(_0x4003('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4003('0x5'))(_0x4003('0x6'));var config=require(_0x4003('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4003('0x8')][_0x4003('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c2c2,_0x57d191,_0x1fd692){return new BPromise(function(_0x1346ef,_0x1a8ad3){return client[_0x4003('0xa')](_0x2c2c2,_0x1fd692)[_0x4003('0xb')](function(_0x3b3480){logger[_0x4003('0xc')](_0x4003('0xd'),_0x57d191,'request\x20sent');logger[_0x4003('0xe')](_0x4003('0xf'),_0x57d191,_0x4003('0x10'),JSON[_0x4003('0x11')](_0x3b3480));if(_0x3b3480['error']){if(_0x3b3480[_0x4003('0x12')][_0x4003('0x13')]===0x1f4){logger[_0x4003('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x57d191,_0x3b3480[_0x4003('0x12')][_0x4003('0x14')]);return _0x1a8ad3(_0x3b3480[_0x4003('0x12')]['message']);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x57d191,_0x3b3480['error'][_0x4003('0x14')]);return _0x1346ef(_0x3b3480['error']['message']);}else{logger[_0x4003('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x57d191,_0x4003('0x10'));_0x1346ef(_0x3b3480[_0x4003('0x15')][_0x4003('0x14')]);}})[_0x4003('0x16')](function(_0x83cace){logger[_0x4003('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x57d191,_0x83cace);_0x1a8ad3(_0x83cace);});});}exports['GetZohoAccount']=function(_0x3c1244){var _0x9634bb=this;return new Promise(function(_0xbda17c,_0x50ebd3){return db[_0x4003('0x17')]['findAll']({'raw':_0x3c1244['options']?_0x3c1244[_0x4003('0x18')][_0x4003('0x19')]===undefined?!![]:![]:!![],'where':_0x3c1244['options']?_0x3c1244[_0x4003('0x18')][_0x4003('0x1a')]||null:null,'attributes':_0x3c1244[_0x4003('0x18')]?_0x3c1244['options'][_0x4003('0x1b')]||null:null,'limit':_0x3c1244[_0x4003('0x18')]?_0x3c1244[_0x4003('0x18')]['limit']||null:null,'include':_0x3c1244[_0x4003('0x18')]?_0x3c1244[_0x4003('0x18')]['include']?_[_0x4003('0x1c')](_0x3c1244[_0x4003('0x18')][_0x4003('0x1d')],function(_0x856f00){return{'model':db[_0x856f00[_0x4003('0x1e')]],'as':_0x856f00['as'],'attributes':_0x856f00[_0x4003('0x1b')],'include':_0x856f00[_0x4003('0x1d')]?_[_0x4003('0x1c')](_0x856f00[_0x4003('0x1d')],function(_0x1cace0){return{'model':db[_0x1cace0[_0x4003('0x1e')]],'as':_0x1cace0['as'],'attributes':_0x1cace0['attributes'],'include':_0x1cace0['include']?_[_0x4003('0x1c')](_0x1cace0[_0x4003('0x1d')],function(_0x159cf4){return{'model':db[_0x159cf4[_0x4003('0x1e')]],'as':_0x159cf4['as'],'attributes':_0x159cf4[_0x4003('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4003('0xb')](function(_0x5b648b){logger[_0x4003('0xc')](_0x4003('0x1f'),_0x3c1244);logger['debug'](_0x4003('0x1f'),_0x3c1244,JSON[_0x4003('0x11')](_0x5b648b));_0xbda17c(_0x5b648b);})[_0x4003('0x16')](function(_0x4fd0eb){logger[_0x4003('0x12')]('GetZohoAccount',_0x4fd0eb[_0x4003('0x14')],_0x3c1244);_0x50ebd3(_0x9634bb[_0x4003('0x12')](0x1f4,_0x4fd0eb['message']));});});};exports['ShowZohoAccount']=function(_0x1f10df){var _0x2130aa=this;return new Promise(function(_0x4dfd5a,_0x11c7ad){return db['ZohoAccount'][_0x4003('0x20')]({'raw':_0x1f10df[_0x4003('0x18')]?_0x1f10df[_0x4003('0x18')][_0x4003('0x19')]===undefined?!![]:![]:!![],'where':_0x1f10df[_0x4003('0x18')]?_0x1f10df[_0x4003('0x18')][_0x4003('0x1a')]||null:null,'attributes':_0x1f10df['options']?_0x1f10df[_0x4003('0x18')]['attributes']||null:null,'include':_0x1f10df[_0x4003('0x18')]?_0x1f10df['options']['include']?_['map'](_0x1f10df[_0x4003('0x18')][_0x4003('0x1d')],function(_0x5a9202){return{'model':db[_0x5a9202['model']],'as':_0x5a9202['as'],'attributes':_0x5a9202[_0x4003('0x1b')],'include':_0x5a9202['include']?_[_0x4003('0x1c')](_0x5a9202[_0x4003('0x1d')],function(_0x1bd14a){return{'model':db[_0x1bd14a[_0x4003('0x1e')]],'as':_0x1bd14a['as'],'attributes':_0x1bd14a[_0x4003('0x1b')],'include':_0x1bd14a[_0x4003('0x1d')]?_[_0x4003('0x1c')](_0x1bd14a[_0x4003('0x1d')],function(_0x39429b){return{'model':db[_0x39429b['model']],'as':_0x39429b['as'],'attributes':_0x39429b['attributes']};}):[]};}):[]};}):[]:[]})[_0x4003('0xb')](function(_0x105863){logger[_0x4003('0xc')](_0x4003('0x21'),_0x1f10df);logger[_0x4003('0xe')](_0x4003('0x21'),_0x1f10df,JSON[_0x4003('0x11')](_0x105863));_0x4dfd5a(_0x105863);})[_0x4003('0x16')](function(_0x2b1a84){logger[_0x4003('0x12')](_0x4003('0x21'),_0x2b1a84[_0x4003('0x14')],_0x1f10df);_0x11c7ad(_0x2130aa[_0x4003('0x12')](0x1f4,_0x2b1a84['message']));});});}; \ No newline at end of file +var _0x33cd=['ZohoAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','catch','ShowZohoAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','GetZohoAccount'];(function(_0x5f3dff,_0x39ccb3){var _0x469529=function(_0x114f5b){while(--_0x114f5b){_0x5f3dff['push'](_0x5f3dff['shift']());}};_0x469529(++_0x39ccb3);}(_0x33cd,0x180));var _0xd33c=function(_0x2aec04,_0x2df9bd){_0x2aec04=_0x2aec04-0x0;var _0x4d2324=_0x33cd[_0x2aec04];return _0x4d2324;};'use strict';var _=require(_0xd33c('0x0'));var util=require(_0xd33c('0x1'));var moment=require(_0xd33c('0x2'));var BPromise=require(_0xd33c('0x3'));var rs=require(_0xd33c('0x4'));var fs=require('fs');var Redis=require(_0xd33c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd33c('0x6'))(_0xd33c('0x7'));var config=require(_0xd33c('0x8'));var jayson=require(_0xd33c('0x9'));var client=jayson[_0xd33c('0xa')][_0xd33c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb90a48,_0x2f6c7d,_0x389e89){return new BPromise(function(_0x12202e,_0x1ca40e){return client['request'](_0xb90a48,_0x389e89)['then'](function(_0xe48b2e){logger[_0xd33c('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x2f6c7d,_0xd33c('0xd'));logger[_0xd33c('0xe')](_0xd33c('0xf'),_0x2f6c7d,_0xd33c('0xd'),JSON[_0xd33c('0x10')](_0xe48b2e));if(_0xe48b2e[_0xd33c('0x11')]){if(_0xe48b2e[_0xd33c('0x11')][_0xd33c('0x12')]===0x1f4){logger[_0xd33c('0x11')](_0xd33c('0x13'),_0x2f6c7d,_0xe48b2e[_0xd33c('0x11')][_0xd33c('0x14')]);return _0x1ca40e(_0xe48b2e['error'][_0xd33c('0x14')]);}logger[_0xd33c('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x2f6c7d,_0xe48b2e[_0xd33c('0x11')][_0xd33c('0x14')]);return _0x12202e(_0xe48b2e[_0xd33c('0x11')][_0xd33c('0x14')]);}else{logger['info'](_0xd33c('0x13'),_0x2f6c7d,_0xd33c('0xd'));_0x12202e(_0xe48b2e[_0xd33c('0x15')][_0xd33c('0x14')]);}})['catch'](function(_0x5bce71){logger[_0xd33c('0x11')](_0xd33c('0x13'),_0x2f6c7d,_0x5bce71);_0x1ca40e(_0x5bce71);});});}exports[_0xd33c('0x16')]=function(_0x140c79){var _0xd3f9ff=this;return new Promise(function(_0x41b39a,_0x153a8a){return db[_0xd33c('0x17')][_0xd33c('0x18')]({'raw':_0x140c79[_0xd33c('0x19')]?_0x140c79[_0xd33c('0x19')][_0xd33c('0x1a')]===undefined?!![]:![]:!![],'where':_0x140c79['options']?_0x140c79[_0xd33c('0x19')][_0xd33c('0x1b')]||null:null,'attributes':_0x140c79[_0xd33c('0x19')]?_0x140c79[_0xd33c('0x19')][_0xd33c('0x1c')]||null:null,'limit':_0x140c79['options']?_0x140c79['options'][_0xd33c('0x1d')]||null:null,'include':_0x140c79[_0xd33c('0x19')]?_0x140c79[_0xd33c('0x19')]['include']?_[_0xd33c('0x1e')](_0x140c79[_0xd33c('0x19')][_0xd33c('0x1f')],function(_0x23ed07){return{'model':db[_0x23ed07[_0xd33c('0x20')]],'as':_0x23ed07['as'],'attributes':_0x23ed07['attributes'],'include':_0x23ed07[_0xd33c('0x1f')]?_['map'](_0x23ed07[_0xd33c('0x1f')],function(_0x18a68c){return{'model':db[_0x18a68c[_0xd33c('0x20')]],'as':_0x18a68c['as'],'attributes':_0x18a68c[_0xd33c('0x1c')],'include':_0x18a68c[_0xd33c('0x1f')]?_[_0xd33c('0x1e')](_0x18a68c[_0xd33c('0x1f')],function(_0x327e17){return{'model':db[_0x327e17[_0xd33c('0x20')]],'as':_0x327e17['as'],'attributes':_0x327e17[_0xd33c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd33c('0x21')](function(_0x2ecb27){logger['info'](_0xd33c('0x16'),_0x140c79);logger[_0xd33c('0xe')](_0xd33c('0x16'),_0x140c79,JSON[_0xd33c('0x10')](_0x2ecb27));_0x41b39a(_0x2ecb27);})[_0xd33c('0x22')](function(_0x414dd1){logger[_0xd33c('0x11')](_0xd33c('0x16'),_0x414dd1[_0xd33c('0x14')],_0x140c79);_0x153a8a(_0xd3f9ff['error'](0x1f4,_0x414dd1['message']));});});};exports[_0xd33c('0x23')]=function(_0x164db4){var _0x633d29=this;return new Promise(function(_0x59074a,_0x355126){return db['ZohoAccount'][_0xd33c('0x24')]({'raw':_0x164db4['options']?_0x164db4[_0xd33c('0x19')][_0xd33c('0x1a')]===undefined?!![]:![]:!![],'where':_0x164db4[_0xd33c('0x19')]?_0x164db4['options']['where']||null:null,'attributes':_0x164db4[_0xd33c('0x19')]?_0x164db4[_0xd33c('0x19')]['attributes']||null:null,'include':_0x164db4[_0xd33c('0x19')]?_0x164db4[_0xd33c('0x19')][_0xd33c('0x1f')]?_[_0xd33c('0x1e')](_0x164db4[_0xd33c('0x19')][_0xd33c('0x1f')],function(_0x441cca){return{'model':db[_0x441cca[_0xd33c('0x20')]],'as':_0x441cca['as'],'attributes':_0x441cca['attributes'],'include':_0x441cca['include']?_[_0xd33c('0x1e')](_0x441cca[_0xd33c('0x1f')],function(_0x1b892e){return{'model':db[_0x1b892e[_0xd33c('0x20')]],'as':_0x1b892e['as'],'attributes':_0x1b892e[_0xd33c('0x1c')],'include':_0x1b892e[_0xd33c('0x1f')]?_[_0xd33c('0x1e')](_0x1b892e[_0xd33c('0x1f')],function(_0x4eebd6){return{'model':db[_0x4eebd6[_0xd33c('0x20')]],'as':_0x4eebd6['as'],'attributes':_0x4eebd6[_0xd33c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd33c('0x21')](function(_0x57b383){logger[_0xd33c('0xc')](_0xd33c('0x23'),_0x164db4);logger[_0xd33c('0xe')](_0xd33c('0x23'),_0x164db4,JSON[_0xd33c('0x10')](_0x57b383));_0x59074a(_0x57b383);})[_0xd33c('0x22')](function(_0x441d84){logger[_0xd33c('0x11')](_0xd33c('0x23'),_0x441d84['message'],_0x164db4);_0x355126(_0x633d29[_0xd33c('0x11')](0x1f4,_0x441d84[_0xd33c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index cb5822a..cee8437 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 _0x5fc7=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x227ad0,_0x1b37b1){var _0x3ab036=function(_0x14af2c){while(--_0x14af2c){_0x227ad0['push'](_0x227ad0['shift']());}};_0x3ab036(++_0x1b37b1);}(_0x5fc7,0x1e1));var _0x75fc=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0x5fc7[_0x8a969d];return _0x1d8dc7;};'use strict';var multer=require(_0x75fc('0x0'));var util=require(_0x75fc('0x1'));var path=require(_0x75fc('0x2'));var timeout=require(_0x75fc('0x3'));var express=require(_0x75fc('0x4'));var router=express[_0x75fc('0x5')]();var auth=require(_0x75fc('0x6'));var interaction=require(_0x75fc('0x7'));var config=require(_0x75fc('0x8'));var controller=require(_0x75fc('0x9'));router[_0x75fc('0xa')]('/',auth[_0x75fc('0xb')](),controller['index']);router[_0x75fc('0xa')](_0x75fc('0xc'),auth[_0x75fc('0xb')](),controller[_0x75fc('0xd')]);router[_0x75fc('0xa')](_0x75fc('0xe'),auth[_0x75fc('0xb')](),controller[_0x75fc('0xf')]);router[_0x75fc('0xa')](_0x75fc('0x10'),auth['isAuthenticated'](),controller[_0x75fc('0x11')]);router[_0x75fc('0xa')](_0x75fc('0x12'),auth[_0x75fc('0xb')](),controller['getDescriptions']);router[_0x75fc('0x13')]('/',auth[_0x75fc('0xb')](),controller[_0x75fc('0x14')]);router[_0x75fc('0x15')](_0x75fc('0xc'),auth[_0x75fc('0xb')](),controller[_0x75fc('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x75fc('0x17')]);module[_0x75fc('0x18')]=router; \ No newline at end of file +var _0xd10f=['../../components/interaction/service','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x18ba37,_0x451ca4){var _0x4105d8=function(_0x13e7e8){while(--_0x13e7e8){_0x18ba37['push'](_0x18ba37['shift']());}};_0x4105d8(++_0x451ca4);}(_0xd10f,0x198));var _0xfd10=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd10f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfd10('0x0'));var util=require(_0xfd10('0x1'));var path=require(_0xfd10('0x2'));var timeout=require(_0xfd10('0x3'));var express=require(_0xfd10('0x4'));var router=express['Router']();var auth=require(_0xfd10('0x5'));var interaction=require(_0xfd10('0x6'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0xfd10('0x7')]('/',auth[_0xfd10('0x8')](),controller[_0xfd10('0x9')]);router[_0xfd10('0x7')](_0xfd10('0xa'),auth[_0xfd10('0x8')](),controller[_0xfd10('0xb')]);router[_0xfd10('0x7')]('/:id/fields',auth[_0xfd10('0x8')](),controller[_0xfd10('0xc')]);router['get'](_0xfd10('0xd'),auth[_0xfd10('0x8')](),controller[_0xfd10('0xe')]);router[_0xfd10('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xfd10('0xf')]);router[_0xfd10('0x10')]('/',auth['isAuthenticated'](),controller[_0xfd10('0x11')]);router[_0xfd10('0x12')](_0xfd10('0xa'),auth[_0xfd10('0x8')](),controller[_0xfd10('0x13')]);router[_0xfd10('0x14')](_0xfd10('0xa'),auth[_0xfd10('0x8')](),controller[_0xfd10('0x15')]);module[_0xfd10('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 239cea3..0707e8f 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 _0x602c=['contact','contact_lead','exports','STRING','lead'];(function(_0x2a7f29,_0x2c89dc){var _0x38924b=function(_0x422538){while(--_0x422538){_0x2a7f29['push'](_0x2a7f29['shift']());}};_0x38924b(++_0x2c89dc);}(_0x602c,0x147));var _0xc602=function(_0x387b06,_0x52660f){_0x387b06=_0x387b06-0x0;var _0x229842=_0x602c[_0x387b06];return _0x229842;};'use strict';var Sequelize=require('sequelize');module[_0xc602('0x0')]={'name':{'type':Sequelize[_0xc602('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xc602('0x2'),_0xc602('0x3'),'nothing'),'defaultValue':_0xc602('0x2')},'moduleSearch':{'type':Sequelize['ENUM'](_0xc602('0x4'),_0xc602('0x3'),_0xc602('0x2')),'defaultValue':_0xc602('0x4')},'description':{'type':Sequelize[_0xc602('0x1')]}}; \ No newline at end of file +var _0xd892=['contact_lead','exports','STRING','ENUM','lead','contact','nothing'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xd892,0x135));var _0x2d89=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xd892[_0x513aa5];return _0x1a1a7c;};'use strict';var Sequelize=require('sequelize');module[_0x2d89('0x0')]={'name':{'type':Sequelize[_0x2d89('0x1')]},'moduleCreate':{'type':Sequelize[_0x2d89('0x2')](_0x2d89('0x3'),_0x2d89('0x4'),_0x2d89('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x2d89('0x2')](_0x2d89('0x6'),_0x2d89('0x4'),_0x2d89('0x3')),'defaultValue':_0x2d89('0x6')},'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 2abf305..cde76dc 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 _0xd60f=['../../config/utils','../../mysqldb','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','map','rawAttributes','fieldName','type','key','model','name','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','ZohoConfiguration','includeAll','include','show','params','options','find','create','body','getFields','findOne','ZohoField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0xd60f,0xf8));var _0xfd60=function(_0x29907a,_0x260772){_0x29907a=_0x29907a-0x0;var _0x21f2c7=_0xd60f[_0x29907a];return _0x21f2c7;};'use strict';var pdf=require(_0xfd60('0x0'));var emlformat=require(_0xfd60('0x1'));var rimraf=require(_0xfd60('0x2'));var zipdir=require(_0xfd60('0x3'));var jsonpatch=require(_0xfd60('0x4'));var rp=require(_0xfd60('0x5'));var moment=require('moment');var BPromise=require(_0xfd60('0x6'));var Mustache=require('mustache');var util=require(_0xfd60('0x7'));var path=require(_0xfd60('0x8'));var sox=require(_0xfd60('0x9'));var csv=require('to-csv');var ejs=require(_0xfd60('0xa'));var fs=require('fs');var _=require(_0xfd60('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfd60('0xc'));var deskjs=require(_0xfd60('0xd'));var toCsv=require(_0xfd60('0xe'));var querystring=require(_0xfd60('0xf'));var Papa=require(_0xfd60('0x10'));var Redis=require(_0xfd60('0x11'));var authService=require(_0xfd60('0x12'));var qs=require(_0xfd60('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfd60('0x14'));var logger=require('../../config/logger')(_0xfd60('0x15'));var utils=require(_0xfd60('0x16'));var config=require('../../config/environment');var db=require(_0xfd60('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xfd60('0x18')]({'port':0x232a});function checkPasswordPattern(_0x16e027,_0x358265,_0x5533ae){if(_0x5533ae){var _0x491b33=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x491b33[_0xfd60('0x19')](_0x358265)){return _0x16e027;}else{throw new db['Sequelize'][(_0xfd60('0x1a'))](_0xfd60('0x1b'));}}else{return _0x16e027;}}function respondWithRpcPromise(_0x456b63,_0x1748c9,_0x250105,_0x2491a4){return new BPromise(function(_0x3c6a12,_0x4db93f){var _0x5cf38d=_0x2491a4||client;return _0x5cf38d[_0xfd60('0x1c')](_0x456b63,_0x250105)[_0xfd60('0x1d')](function(_0x3c5aa0){logger[_0xfd60('0x1e')](_0xfd60('0x1f'),_0x1748c9,_0xfd60('0x20'));logger[_0xfd60('0x21')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x1748c9,_0xfd60('0x20'),JSON[_0xfd60('0x22')](_0x3c5aa0));if(_0x3c5aa0[_0xfd60('0x23')]){if(_0x3c5aa0['error'][_0xfd60('0x24')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x1748c9,_0x3c5aa0[_0xfd60('0x23')][_0xfd60('0x25')]);return _0x4db93f(_0x3c5aa0['error'][_0xfd60('0x25')]);}logger['error'](_0xfd60('0x1f'),_0x1748c9,_0x3c5aa0[_0xfd60('0x23')][_0xfd60('0x25')]);return _0x3c6a12(_0x3c5aa0[_0xfd60('0x23')][_0xfd60('0x25')]);}else{logger[_0xfd60('0x1e')](_0xfd60('0x1f'),_0x1748c9,_0xfd60('0x20'));_0x3c6a12(_0x3c5aa0['result']['message']);}})[_0xfd60('0x26')](function(_0x3378c8){logger[_0xfd60('0x23')](_0xfd60('0x1f'),_0x1748c9,_0x3378c8);_0x4db93f(_0x3378c8);});});}function respondWithStatusCode(_0xe65bb6,_0x575638){_0x575638=_0x575638||0xcc;return function(_0x39c651){if(_0x39c651){return _0xe65bb6[_0xfd60('0x27')](_0x575638);}return _0xe65bb6[_0xfd60('0x28')](_0x575638)[_0xfd60('0x29')]();};}function respondWithResult(_0xa41f5,_0x578ce9){_0x578ce9=_0x578ce9||0xc8;return function(_0x149d85){if(_0x149d85){return _0xa41f5[_0xfd60('0x28')](_0x578ce9)[_0xfd60('0x2a')](_0x149d85);}};}function respondWithFilteredResult(_0x5ba061,_0x46df06){return function(_0x197729){if(_0x197729){var _0x54b58e=_0x197729[_0xfd60('0x2b')],_0x5a4239=_0x46df06['offset'],_0x1887f8=_0x46df06[_0xfd60('0x2c')]+_0x46df06[_0xfd60('0x2d')],_0x2ddbd7;if(_0x1887f8>=_0x54b58e){_0x1887f8=_0x54b58e;_0x2ddbd7=0xc8;}else{_0x2ddbd7=0xce;}_0x5ba061['status'](_0x2ddbd7);return _0x5ba061[_0xfd60('0x2e')](_0xfd60('0x2f'),_0x5a4239+'-'+_0x1887f8+'/'+_0x54b58e)[_0xfd60('0x2a')](_0x197729);}return null;};}function patchUpdates(_0x1c5910){return function(_0x3875df){try{jsonpatch['apply'](_0x3875df,_0x1c5910,!![]);}catch(_0x27c1f3){return BPromise[_0xfd60('0x30')](_0x27c1f3);}return _0x3875df[_0xfd60('0x31')]();};}function saveUpdates(_0x3d583d,_0x2bffdb){return function(_0x3113fa){if(_0x3113fa){return _0x3113fa[_0xfd60('0x32')](_0x3d583d)[_0xfd60('0x1d')](function(_0xb3d2d4){return _0xb3d2d4;});}return null;};}function removeEntity(_0x36816b,_0x12d94d){return function(_0x481e8a){if(_0x481e8a){return _0x481e8a[_0xfd60('0x33')]()[_0xfd60('0x1d')](function(){_0x36816b[_0xfd60('0x28')](0xcc)[_0xfd60('0x29')]();});}};}function handleEntityNotFound(_0x51f591,_0x51a370){return function(_0x200b3f){if(!_0x200b3f){_0x51f591[_0xfd60('0x27')](0x194);}return _0x200b3f;};}function handleError(_0x3d5195,_0x387cf1){_0x387cf1=_0x387cf1||0x1f4;return function(_0x96437a){logger[_0xfd60('0x23')](_0x96437a[_0xfd60('0x34')]);if(_0x96437a['name']){delete _0x96437a['name'];}_0x3d5195['status'](_0x387cf1)['send'](_0x96437a);};}exports['index']=function(_0x366531,_0x1cfca6){var _0x378c15={},_0x2956a7={},_0x1334b6={'count':0x0,'rows':[]};var _0x1dbebb=_[_0xfd60('0x35')](db['ZohoConfiguration'][_0xfd60('0x36')],function(_0x4537aa){return{'name':_0x4537aa[_0xfd60('0x37')],'type':_0x4537aa[_0xfd60('0x38')][_0xfd60('0x39')]};});_0x2956a7[_0xfd60('0x3a')]=_['map'](_0x1dbebb,_0xfd60('0x3b'));_0x2956a7['query']=_[_0xfd60('0x3c')](_0x366531['query']);_0x2956a7[_0xfd60('0x3d')]=_[_0xfd60('0x3e')](_0x2956a7[_0xfd60('0x3a')],_0x2956a7[_0xfd60('0x3f')]);_0x378c15['attributes']=_[_0xfd60('0x3e')](_0x2956a7[_0xfd60('0x3a')],qs[_0xfd60('0x40')](_0x366531[_0xfd60('0x3f')]['fields']));_0x378c15['attributes']=_0x378c15[_0xfd60('0x41')][_0xfd60('0x42')]?_0x378c15[_0xfd60('0x41')]:_0x2956a7[_0xfd60('0x3a')];if(!_0x366531[_0xfd60('0x3f')][_0xfd60('0x43')](_0xfd60('0x44'))){_0x378c15[_0xfd60('0x2d')]=qs[_0xfd60('0x2d')](_0x366531[_0xfd60('0x3f')]['limit']);_0x378c15['offset']=qs[_0xfd60('0x2c')](_0x366531[_0xfd60('0x3f')][_0xfd60('0x2c')]);}_0x378c15[_0xfd60('0x45')]=qs[_0xfd60('0x46')](_0x366531[_0xfd60('0x3f')][_0xfd60('0x46')]);_0x378c15['where']=qs[_0xfd60('0x3d')](_[_0xfd60('0x47')](_0x366531['query'],_0x2956a7[_0xfd60('0x3d')]),_0x1dbebb);if(_0x366531['query'][_0xfd60('0x48')]){_0x378c15[_0xfd60('0x49')]=_[_0xfd60('0x4a')](_0x378c15[_0xfd60('0x49')],{'$or':_[_0xfd60('0x35')](_0x1dbebb,function(_0x2cf0e8){if(_0x2cf0e8[_0xfd60('0x38')]!==_0xfd60('0x4b')){var _0x171813={};_0x171813[_0x2cf0e8[_0xfd60('0x3b')]]={'$like':'%'+_0x366531[_0xfd60('0x3f')][_0xfd60('0x48')]+'%'};return _0x171813;}})});}_0x378c15=_[_0xfd60('0x4a')]({},_0x378c15,_0x366531['options']);var _0x47fd52={'where':_0x378c15['where']};return db[_0xfd60('0x4c')][_0xfd60('0x2b')](_0x47fd52)[_0xfd60('0x1d')](function(_0x55e020){_0x1334b6[_0xfd60('0x2b')]=_0x55e020;if(_0x366531['query'][_0xfd60('0x4d')]){_0x378c15[_0xfd60('0x4e')]=[{'all':!![]}];}return db[_0xfd60('0x4c')]['findAll'](_0x378c15);})[_0xfd60('0x1d')](function(_0x115fca){_0x1334b6['rows']=_0x115fca;return _0x1334b6;})['then'](respondWithFilteredResult(_0x1cfca6,_0x378c15))[_0xfd60('0x26')](handleError(_0x1cfca6,null));};exports[_0xfd60('0x4f')]=function(_0x31e4b3,_0x5b7752){var _0x3cb03e={'raw':![],'where':{'id':_0x31e4b3[_0xfd60('0x50')]['id']}},_0x18fd32={};_0x18fd32[_0xfd60('0x3a')]=_[_0xfd60('0x3c')](db[_0xfd60('0x4c')][_0xfd60('0x36')]);_0x18fd32['query']=_[_0xfd60('0x3c')](_0x31e4b3['query']);_0x18fd32[_0xfd60('0x3d')]=_['intersection'](_0x18fd32[_0xfd60('0x3a')],_0x18fd32['query']);_0x3cb03e[_0xfd60('0x41')]=_[_0xfd60('0x3e')](_0x18fd32['model'],qs[_0xfd60('0x40')](_0x31e4b3[_0xfd60('0x3f')]['fields']));_0x3cb03e[_0xfd60('0x41')]=_0x3cb03e[_0xfd60('0x41')][_0xfd60('0x42')]?_0x3cb03e[_0xfd60('0x41')]:_0x18fd32[_0xfd60('0x3a')];if(_0x31e4b3[_0xfd60('0x3f')]['includeAll']){_0x3cb03e['include']=[{'all':!![]}];}_0x3cb03e=_[_0xfd60('0x4a')]({},_0x3cb03e,_0x31e4b3[_0xfd60('0x51')]);return db['ZohoConfiguration'][_0xfd60('0x52')](_0x3cb03e)[_0xfd60('0x1d')](handleEntityNotFound(_0x5b7752,null))[_0xfd60('0x1d')](respondWithResult(_0x5b7752,null))[_0xfd60('0x26')](handleError(_0x5b7752,null));};exports['create']=function(_0x189068,_0x53d81a){return db[_0xfd60('0x4c')][_0xfd60('0x53')](_0x189068[_0xfd60('0x54')],{})[_0xfd60('0x1d')](respondWithResult(_0x53d81a,0xc9))[_0xfd60('0x26')](handleError(_0x53d81a,null));};exports[_0xfd60('0x32')]=function(_0x37f576,_0xb24a7e){if(_0x37f576[_0xfd60('0x54')]['id']){delete _0x37f576[_0xfd60('0x54')]['id'];}return db[_0xfd60('0x4c')][_0xfd60('0x52')]({'where':{'id':_0x37f576[_0xfd60('0x50')]['id']}})[_0xfd60('0x1d')](handleEntityNotFound(_0xb24a7e,null))['then'](saveUpdates(_0x37f576['body'],null))['then'](respondWithResult(_0xb24a7e,null))['catch'](handleError(_0xb24a7e,null));};exports[_0xfd60('0x33')]=function(_0x583b01,_0x110ff2){return db[_0xfd60('0x4c')][_0xfd60('0x52')]({'where':{'id':_0x583b01['params']['id']}})[_0xfd60('0x1d')](handleEntityNotFound(_0x110ff2,null))['then'](removeEntity(_0x110ff2,null))[_0xfd60('0x26')](handleError(_0x110ff2,null));};exports[_0xfd60('0x55')]=function(_0xde332b,_0x6a5094,_0x15bbb6){var _0x572dd0={};var _0x10dbbe={};var _0x3a11c4;var _0x59f883;return db['ZohoConfiguration'][_0xfd60('0x56')]({'where':{'id':_0xde332b[_0xfd60('0x50')]['id']}})['then'](handleEntityNotFound(_0x6a5094,null))[_0xfd60('0x1d')](function(_0x34abde){if(_0x34abde){_0x3a11c4=_0x34abde;_0x10dbbe[_0xfd60('0x3a')]=_[_0xfd60('0x3c')](db['ZohoField'][_0xfd60('0x36')]);_0x10dbbe['query']=_[_0xfd60('0x3c')](_0xde332b[_0xfd60('0x3f')]);_0x10dbbe['filters']=_[_0xfd60('0x3e')](_0x10dbbe[_0xfd60('0x3a')],_0x10dbbe[_0xfd60('0x3f')]);_0x572dd0[_0xfd60('0x41')]=_[_0xfd60('0x3e')](_0x10dbbe[_0xfd60('0x3a')],qs[_0xfd60('0x40')](_0xde332b[_0xfd60('0x3f')][_0xfd60('0x40')]));_0x572dd0[_0xfd60('0x41')]=_0x572dd0['attributes'][_0xfd60('0x42')]?_0x572dd0[_0xfd60('0x41')]:_0x10dbbe[_0xfd60('0x3a')];_0x572dd0[_0xfd60('0x45')]=qs['sort'](_0xde332b[_0xfd60('0x3f')][_0xfd60('0x46')]);_0x572dd0[_0xfd60('0x49')]=qs[_0xfd60('0x3d')](_[_0xfd60('0x47')](_0xde332b[_0xfd60('0x3f')],_0x10dbbe[_0xfd60('0x3d')]));if(_0xde332b[_0xfd60('0x3f')][_0xfd60('0x48')]){_0x572dd0[_0xfd60('0x49')]=_[_0xfd60('0x4a')](_0x572dd0[_0xfd60('0x49')],{'$or':_[_0xfd60('0x35')](_0x572dd0[_0xfd60('0x41')],function(_0x6e35cd){var _0x46bdd2={};_0x46bdd2[_0x6e35cd]={'$like':'%'+_0xde332b[_0xfd60('0x3f')][_0xfd60('0x48')]+'%'};return _0x46bdd2;})});}_0x572dd0=_[_0xfd60('0x4a')]({},_0x572dd0,_0xde332b[_0xfd60('0x51')]);return _0x3a11c4[_0xfd60('0x55')](_0x572dd0);}})[_0xfd60('0x1d')](function(_0x54d0a4){if(_0x54d0a4){_0x59f883=_0x54d0a4['length'];if(!_0xde332b[_0xfd60('0x3f')]['hasOwnProperty'](_0xfd60('0x44'))){_0x572dd0[_0xfd60('0x2d')]=qs[_0xfd60('0x2d')](_0xde332b['query']['limit']);_0x572dd0[_0xfd60('0x2c')]=qs['offset'](_0xde332b[_0xfd60('0x3f')]['offset']);}return _0x3a11c4[_0xfd60('0x55')](_0x572dd0);}})['then'](function(_0x1263cf){if(_0x1263cf){return _0x1263cf?{'count':_0x59f883,'rows':_0x1263cf}:null;}})[_0xfd60('0x1d')](respondWithResult(_0x6a5094,null))[_0xfd60('0x26')](handleError(_0x6a5094,null));};exports['getSubjects']=function(_0x402db2,_0x545751,_0x3f4597){var _0x27e65d={};var _0x107b83={};var _0x55e9c4;var _0x52f935;return db[_0xfd60('0x4c')][_0xfd60('0x56')]({'where':{'id':_0x402db2['params']['id']}})[_0xfd60('0x1d')](handleEntityNotFound(_0x545751,null))['then'](function(_0x5cb70c){if(_0x5cb70c){_0x55e9c4=_0x5cb70c;_0x107b83['model']=_[_0xfd60('0x3c')](db[_0xfd60('0x57')][_0xfd60('0x36')]);_0x107b83['query']=_[_0xfd60('0x3c')](_0x402db2[_0xfd60('0x3f')]);_0x107b83[_0xfd60('0x3d')]=_[_0xfd60('0x3e')](_0x107b83[_0xfd60('0x3a')],_0x107b83[_0xfd60('0x3f')]);_0x27e65d[_0xfd60('0x41')]=_[_0xfd60('0x3e')](_0x107b83['model'],qs['fields'](_0x402db2[_0xfd60('0x3f')][_0xfd60('0x40')]));_0x27e65d[_0xfd60('0x41')]=_0x27e65d[_0xfd60('0x41')]['length']?_0x27e65d[_0xfd60('0x41')]:_0x107b83['model'];_0x27e65d[_0xfd60('0x45')]=qs[_0xfd60('0x46')](_0x402db2[_0xfd60('0x3f')][_0xfd60('0x46')]);_0x27e65d[_0xfd60('0x49')]=qs[_0xfd60('0x3d')](_['pick'](_0x402db2[_0xfd60('0x3f')],_0x107b83[_0xfd60('0x3d')]));if(_0x402db2[_0xfd60('0x3f')][_0xfd60('0x48')]){_0x27e65d[_0xfd60('0x49')]=_['merge'](_0x27e65d[_0xfd60('0x49')],{'$or':_['map'](_0x27e65d[_0xfd60('0x41')],function(_0x270b62){var _0x2cdb6b={};_0x2cdb6b[_0x270b62]={'$like':'%'+_0x402db2['query']['filter']+'%'};return _0x2cdb6b;})});}_0x27e65d=_[_0xfd60('0x4a')]({},_0x27e65d,_0x402db2[_0xfd60('0x51')]);return _0x55e9c4[_0xfd60('0x58')](_0x27e65d);}})[_0xfd60('0x1d')](function(_0x6422c4){if(_0x6422c4){_0x52f935=_0x6422c4[_0xfd60('0x42')];if(!_0x402db2[_0xfd60('0x3f')][_0xfd60('0x43')](_0xfd60('0x44'))){_0x27e65d[_0xfd60('0x2d')]=qs[_0xfd60('0x2d')](_0x402db2[_0xfd60('0x3f')]['limit']);_0x27e65d[_0xfd60('0x2c')]=qs[_0xfd60('0x2c')](_0x402db2[_0xfd60('0x3f')][_0xfd60('0x2c')]);}return _0x55e9c4['getSubjects'](_0x27e65d);}})[_0xfd60('0x1d')](function(_0x40e032){if(_0x40e032){return _0x40e032?{'count':_0x52f935,'rows':_0x40e032}:null;}})[_0xfd60('0x1d')](respondWithResult(_0x545751,null))[_0xfd60('0x26')](handleError(_0x545751,null));};exports[_0xfd60('0x59')]=function(_0x227454,_0x3ed866,_0x57987a){var _0x58940e={};var _0x266989={};var _0x382875;var _0x1db4fe;return db[_0xfd60('0x4c')][_0xfd60('0x56')]({'where':{'id':_0x227454[_0xfd60('0x50')]['id']}})[_0xfd60('0x1d')](handleEntityNotFound(_0x3ed866,null))[_0xfd60('0x1d')](function(_0x1b4b3d){if(_0x1b4b3d){_0x382875=_0x1b4b3d;_0x266989[_0xfd60('0x3a')]=_[_0xfd60('0x3c')](db[_0xfd60('0x57')][_0xfd60('0x36')]);_0x266989[_0xfd60('0x3f')]=_['keys'](_0x227454[_0xfd60('0x3f')]);_0x266989[_0xfd60('0x3d')]=_[_0xfd60('0x3e')](_0x266989[_0xfd60('0x3a')],_0x266989[_0xfd60('0x3f')]);_0x58940e[_0xfd60('0x41')]=_[_0xfd60('0x3e')](_0x266989['model'],qs['fields'](_0x227454[_0xfd60('0x3f')][_0xfd60('0x40')]));_0x58940e['attributes']=_0x58940e[_0xfd60('0x41')][_0xfd60('0x42')]?_0x58940e[_0xfd60('0x41')]:_0x266989['model'];_0x58940e['order']=qs['sort'](_0x227454[_0xfd60('0x3f')]['sort']);_0x58940e[_0xfd60('0x49')]=qs[_0xfd60('0x3d')](_[_0xfd60('0x47')](_0x227454[_0xfd60('0x3f')],_0x266989[_0xfd60('0x3d')]));if(_0x227454[_0xfd60('0x3f')]['filter']){_0x58940e[_0xfd60('0x49')]=_[_0xfd60('0x4a')](_0x58940e[_0xfd60('0x49')],{'$or':_[_0xfd60('0x35')](_0x58940e[_0xfd60('0x41')],function(_0x717969){var _0x5c3c66={};_0x5c3c66[_0x717969]={'$like':'%'+_0x227454[_0xfd60('0x3f')][_0xfd60('0x48')]+'%'};return _0x5c3c66;})});}_0x58940e=_[_0xfd60('0x4a')]({},_0x58940e,_0x227454[_0xfd60('0x51')]);return _0x382875['getDescriptions'](_0x58940e);}})[_0xfd60('0x1d')](function(_0x1610aa){if(_0x1610aa){_0x1db4fe=_0x1610aa['length'];if(!_0x227454['query'][_0xfd60('0x43')](_0xfd60('0x44'))){_0x58940e['limit']=qs['limit'](_0x227454['query'][_0xfd60('0x2d')]);_0x58940e[_0xfd60('0x2c')]=qs['offset'](_0x227454['query'][_0xfd60('0x2c')]);}return _0x382875[_0xfd60('0x59')](_0x58940e);}})[_0xfd60('0x1d')](function(_0x315aa9){if(_0x315aa9){return _0x315aa9?{'count':_0x1db4fe,'rows':_0x315aa9}:null;}})[_0xfd60('0x1d')](respondWithResult(_0x3ed866,null))[_0xfd60('0x26')](handleError(_0x3ed866,null));}; \ No newline at end of file +var _0x070d=['getDescriptions','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','map','ZohoConfiguration','rawAttributes','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','show','params','keys','length','find','create','body','findOne','ZohoField','options','getFields','getSubjects'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x070d,0x109));var _0xd070=function(_0x31c19c,_0xbe4b70){_0x31c19c=_0x31c19c-0x0;var _0x1a87f7=_0x070d[_0x31c19c];return _0x1a87f7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd070('0x0'));var rimraf=require(_0xd070('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd070('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd070('0x3'));var Mustache=require(_0xd070('0x4'));var util=require('util');var path=require(_0xd070('0x5'));var sox=require(_0xd070('0x6'));var csv=require(_0xd070('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd070('0x7'));var querystring=require(_0xd070('0x8'));var Papa=require(_0xd070('0x9'));var Redis=require(_0xd070('0xa'));var authService=require(_0xd070('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0xd070('0xc'));var hardwareService=require(_0xd070('0xd'));var logger=require(_0xd070('0xe'))(_0xd070('0xf'));var utils=require(_0xd070('0x10'));var config=require(_0xd070('0x11'));var db=require(_0xd070('0x12'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xd070('0x13')][_0xd070('0x14')]({'port':0x232a});function checkPasswordPattern(_0x4dba6a,_0x4bdec5,_0x2851b8){if(_0x2851b8){var _0x41f20e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x41f20e[_0xd070('0x15')](_0x4bdec5)){return _0x4dba6a;}else{throw new db[(_0xd070('0x16'))][(_0xd070('0x17'))](_0xd070('0x18'));}}else{return _0x4dba6a;}}function respondWithRpcPromise(_0x1e06e6,_0x4f0ef8,_0x4bf63b,_0xb3fcc8){return new BPromise(function(_0x537af5,_0xd1fe06){var _0x4de058=_0xb3fcc8||client;return _0x4de058[_0xd070('0x19')](_0x1e06e6,_0x4bf63b)[_0xd070('0x1a')](function(_0x1d3e06){logger['info'](_0xd070('0x1b'),_0x4f0ef8,'request\x20sent');logger[_0xd070('0x1c')](_0xd070('0x1d'),_0x4f0ef8,_0xd070('0x1e'),JSON[_0xd070('0x1f')](_0x1d3e06));if(_0x1d3e06[_0xd070('0x20')]){if(_0x1d3e06[_0xd070('0x20')]['code']===0x1f4){logger[_0xd070('0x20')](_0xd070('0x1b'),_0x4f0ef8,_0x1d3e06[_0xd070('0x20')][_0xd070('0x21')]);return _0xd1fe06(_0x1d3e06[_0xd070('0x20')][_0xd070('0x21')]);}logger['error'](_0xd070('0x1b'),_0x4f0ef8,_0x1d3e06[_0xd070('0x20')][_0xd070('0x21')]);return _0x537af5(_0x1d3e06['error'][_0xd070('0x21')]);}else{logger[_0xd070('0x22')](_0xd070('0x1b'),_0x4f0ef8,_0xd070('0x1e'));_0x537af5(_0x1d3e06[_0xd070('0x23')][_0xd070('0x21')]);}})[_0xd070('0x24')](function(_0x37f452){logger[_0xd070('0x20')](_0xd070('0x1b'),_0x4f0ef8,_0x37f452);_0xd1fe06(_0x37f452);});});}function respondWithStatusCode(_0x146a04,_0x4d74c6){_0x4d74c6=_0x4d74c6||0xcc;return function(_0x158433){if(_0x158433){return _0x146a04[_0xd070('0x25')](_0x4d74c6);}return _0x146a04[_0xd070('0x26')](_0x4d74c6)[_0xd070('0x27')]();};}function respondWithResult(_0x61b71a,_0x521271){_0x521271=_0x521271||0xc8;return function(_0xb44096){if(_0xb44096){return _0x61b71a[_0xd070('0x26')](_0x521271)['json'](_0xb44096);}};}function respondWithFilteredResult(_0x37a0ca,_0x4515a4){return function(_0x2fb40d){if(_0x2fb40d){var _0x5487fb=_0x2fb40d[_0xd070('0x28')],_0x3561ad=_0x4515a4[_0xd070('0x29')],_0x49dbbd=_0x4515a4['offset']+_0x4515a4['limit'],_0x21dbe2;if(_0x49dbbd>=_0x5487fb){_0x49dbbd=_0x5487fb;_0x21dbe2=0xc8;}else{_0x21dbe2=0xce;}_0x37a0ca[_0xd070('0x26')](_0x21dbe2);return _0x37a0ca[_0xd070('0x2a')](_0xd070('0x2b'),_0x3561ad+'-'+_0x49dbbd+'/'+_0x5487fb)[_0xd070('0x2c')](_0x2fb40d);}return null;};}function patchUpdates(_0x4db2a2){return function(_0x531643){try{jsonpatch[_0xd070('0x2d')](_0x531643,_0x4db2a2,!![]);}catch(_0x558eb7){return BPromise[_0xd070('0x2e')](_0x558eb7);}return _0x531643[_0xd070('0x2f')]();};}function saveUpdates(_0x483e3d,_0x35e1cc){return function(_0x26ff68){if(_0x26ff68){return _0x26ff68[_0xd070('0x30')](_0x483e3d)['then'](function(_0x4201b6){return _0x4201b6;});}return null;};}function removeEntity(_0x4e3619,_0x26530f){return function(_0x5ebb6d){if(_0x5ebb6d){return _0x5ebb6d[_0xd070('0x31')]()[_0xd070('0x1a')](function(){_0x4e3619[_0xd070('0x26')](0xcc)[_0xd070('0x27')]();});}};}function handleEntityNotFound(_0x30eafb,_0x28723d){return function(_0x264c74){if(!_0x264c74){_0x30eafb[_0xd070('0x25')](0x194);}return _0x264c74;};}function handleError(_0x2e9f39,_0x2f0741){_0x2f0741=_0x2f0741||0x1f4;return function(_0x2c19dc){logger[_0xd070('0x20')](_0x2c19dc[_0xd070('0x32')]);if(_0x2c19dc[_0xd070('0x33')]){delete _0x2c19dc[_0xd070('0x33')];}_0x2e9f39[_0xd070('0x26')](_0x2f0741)[_0xd070('0x34')](_0x2c19dc);};}exports['index']=function(_0x54a6c9,_0x4e3dca){var _0x8aff0e={},_0x5a7e05={},_0x15ba93={'count':0x0,'rows':[]};var _0x32e491=_[_0xd070('0x35')](db[_0xd070('0x36')][_0xd070('0x37')],function(_0x2f09ed){return{'name':_0x2f09ed['fieldName'],'type':_0x2f09ed[_0xd070('0x38')]['key']};});_0x5a7e05[_0xd070('0x39')]=_[_0xd070('0x35')](_0x32e491,_0xd070('0x33'));_0x5a7e05[_0xd070('0x3a')]=_['keys'](_0x54a6c9[_0xd070('0x3a')]);_0x5a7e05[_0xd070('0x3b')]=_[_0xd070('0x3c')](_0x5a7e05['model'],_0x5a7e05[_0xd070('0x3a')]);_0x8aff0e['attributes']=_['intersection'](_0x5a7e05[_0xd070('0x39')],qs[_0xd070('0x3d')](_0x54a6c9['query'][_0xd070('0x3d')]));_0x8aff0e['attributes']=_0x8aff0e[_0xd070('0x3e')]['length']?_0x8aff0e['attributes']:_0x5a7e05[_0xd070('0x39')];if(!_0x54a6c9[_0xd070('0x3a')][_0xd070('0x3f')](_0xd070('0x40'))){_0x8aff0e[_0xd070('0x41')]=qs['limit'](_0x54a6c9[_0xd070('0x3a')]['limit']);_0x8aff0e[_0xd070('0x29')]=qs[_0xd070('0x29')](_0x54a6c9[_0xd070('0x3a')][_0xd070('0x29')]);}_0x8aff0e[_0xd070('0x42')]=qs[_0xd070('0x43')](_0x54a6c9[_0xd070('0x3a')][_0xd070('0x43')]);_0x8aff0e[_0xd070('0x44')]=qs['filters'](_[_0xd070('0x45')](_0x54a6c9[_0xd070('0x3a')],_0x5a7e05['filters']),_0x32e491);if(_0x54a6c9[_0xd070('0x3a')][_0xd070('0x46')]){_0x8aff0e['where']=_['merge'](_0x8aff0e['where'],{'$or':_[_0xd070('0x35')](_0x32e491,function(_0x1781d0){if(_0x1781d0['type']!==_0xd070('0x47')){var _0x4229c3={};_0x4229c3[_0x1781d0[_0xd070('0x33')]]={'$like':'%'+_0x54a6c9[_0xd070('0x3a')][_0xd070('0x46')]+'%'};return _0x4229c3;}})});}_0x8aff0e=_[_0xd070('0x48')]({},_0x8aff0e,_0x54a6c9['options']);var _0x26cd91={'where':_0x8aff0e[_0xd070('0x44')]};return db[_0xd070('0x36')][_0xd070('0x28')](_0x26cd91)[_0xd070('0x1a')](function(_0x45af89){_0x15ba93[_0xd070('0x28')]=_0x45af89;if(_0x54a6c9[_0xd070('0x3a')][_0xd070('0x49')]){_0x8aff0e['include']=[{'all':!![]}];}return db[_0xd070('0x36')][_0xd070('0x4a')](_0x8aff0e);})[_0xd070('0x1a')](function(_0x496e0f){_0x15ba93['rows']=_0x496e0f;return _0x15ba93;})[_0xd070('0x1a')](respondWithFilteredResult(_0x4e3dca,_0x8aff0e))[_0xd070('0x24')](handleError(_0x4e3dca,null));};exports[_0xd070('0x4b')]=function(_0x1edf18,_0x5485ee){var _0x357f9d={'raw':![],'where':{'id':_0x1edf18[_0xd070('0x4c')]['id']}},_0x20a8af={};_0x20a8af[_0xd070('0x39')]=_[_0xd070('0x4d')](db[_0xd070('0x36')][_0xd070('0x37')]);_0x20a8af['query']=_['keys'](_0x1edf18[_0xd070('0x3a')]);_0x20a8af[_0xd070('0x3b')]=_['intersection'](_0x20a8af['model'],_0x20a8af[_0xd070('0x3a')]);_0x357f9d['attributes']=_[_0xd070('0x3c')](_0x20a8af[_0xd070('0x39')],qs['fields'](_0x1edf18['query'][_0xd070('0x3d')]));_0x357f9d['attributes']=_0x357f9d['attributes'][_0xd070('0x4e')]?_0x357f9d[_0xd070('0x3e')]:_0x20a8af[_0xd070('0x39')];if(_0x1edf18['query'][_0xd070('0x49')]){_0x357f9d['include']=[{'all':!![]}];}_0x357f9d=_['merge']({},_0x357f9d,_0x1edf18['options']);return db[_0xd070('0x36')][_0xd070('0x4f')](_0x357f9d)['then'](handleEntityNotFound(_0x5485ee,null))['then'](respondWithResult(_0x5485ee,null))[_0xd070('0x24')](handleError(_0x5485ee,null));};exports['create']=function(_0xb09aee,_0x1980a4){return db[_0xd070('0x36')][_0xd070('0x50')](_0xb09aee['body'],{})[_0xd070('0x1a')](respondWithResult(_0x1980a4,0xc9))[_0xd070('0x24')](handleError(_0x1980a4,null));};exports[_0xd070('0x30')]=function(_0x14a64e,_0x104fa5){if(_0x14a64e['body']['id']){delete _0x14a64e[_0xd070('0x51')]['id'];}return db['ZohoConfiguration']['find']({'where':{'id':_0x14a64e['params']['id']}})[_0xd070('0x1a')](handleEntityNotFound(_0x104fa5,null))[_0xd070('0x1a')](saveUpdates(_0x14a64e['body'],null))[_0xd070('0x1a')](respondWithResult(_0x104fa5,null))[_0xd070('0x24')](handleError(_0x104fa5,null));};exports[_0xd070('0x31')]=function(_0x34129c,_0x4f1bae){return db[_0xd070('0x36')][_0xd070('0x4f')]({'where':{'id':_0x34129c['params']['id']}})[_0xd070('0x1a')](handleEntityNotFound(_0x4f1bae,null))[_0xd070('0x1a')](removeEntity(_0x4f1bae,null))[_0xd070('0x24')](handleError(_0x4f1bae,null));};exports['getFields']=function(_0x81f903,_0x5df99b,_0x57dc53){var _0x54f95e={};var _0x29b8ab={};var _0x3393cb;var _0x92b543;return db['ZohoConfiguration'][_0xd070('0x52')]({'where':{'id':_0x81f903['params']['id']}})[_0xd070('0x1a')](handleEntityNotFound(_0x5df99b,null))[_0xd070('0x1a')](function(_0x41e393){if(_0x41e393){_0x3393cb=_0x41e393;_0x29b8ab[_0xd070('0x39')]=_[_0xd070('0x4d')](db[_0xd070('0x53')][_0xd070('0x37')]);_0x29b8ab[_0xd070('0x3a')]=_[_0xd070('0x4d')](_0x81f903[_0xd070('0x3a')]);_0x29b8ab[_0xd070('0x3b')]=_[_0xd070('0x3c')](_0x29b8ab[_0xd070('0x39')],_0x29b8ab[_0xd070('0x3a')]);_0x54f95e[_0xd070('0x3e')]=_[_0xd070('0x3c')](_0x29b8ab[_0xd070('0x39')],qs[_0xd070('0x3d')](_0x81f903['query'][_0xd070('0x3d')]));_0x54f95e['attributes']=_0x54f95e[_0xd070('0x3e')][_0xd070('0x4e')]?_0x54f95e['attributes']:_0x29b8ab[_0xd070('0x39')];_0x54f95e[_0xd070('0x42')]=qs[_0xd070('0x43')](_0x81f903[_0xd070('0x3a')][_0xd070('0x43')]);_0x54f95e[_0xd070('0x44')]=qs[_0xd070('0x3b')](_[_0xd070('0x45')](_0x81f903['query'],_0x29b8ab[_0xd070('0x3b')]));if(_0x81f903[_0xd070('0x3a')][_0xd070('0x46')]){_0x54f95e['where']=_[_0xd070('0x48')](_0x54f95e[_0xd070('0x44')],{'$or':_[_0xd070('0x35')](_0x54f95e[_0xd070('0x3e')],function(_0xe0626){var _0x447076={};_0x447076[_0xe0626]={'$like':'%'+_0x81f903[_0xd070('0x3a')][_0xd070('0x46')]+'%'};return _0x447076;})});}_0x54f95e=_['merge']({},_0x54f95e,_0x81f903[_0xd070('0x54')]);return _0x3393cb[_0xd070('0x55')](_0x54f95e);}})['then'](function(_0x19c53a){if(_0x19c53a){_0x92b543=_0x19c53a[_0xd070('0x4e')];if(!_0x81f903['query']['hasOwnProperty'](_0xd070('0x40'))){_0x54f95e[_0xd070('0x41')]=qs[_0xd070('0x41')](_0x81f903[_0xd070('0x3a')][_0xd070('0x41')]);_0x54f95e[_0xd070('0x29')]=qs['offset'](_0x81f903['query']['offset']);}return _0x3393cb['getFields'](_0x54f95e);}})[_0xd070('0x1a')](function(_0x53ec9d){if(_0x53ec9d){return _0x53ec9d?{'count':_0x92b543,'rows':_0x53ec9d}:null;}})[_0xd070('0x1a')](respondWithResult(_0x5df99b,null))[_0xd070('0x24')](handleError(_0x5df99b,null));};exports[_0xd070('0x56')]=function(_0x276d1b,_0x4cdc8c,_0x10cf3a){var _0x42aed7={};var _0x5cf8aa={};var _0x347934;var _0x9727a0;return db[_0xd070('0x36')][_0xd070('0x52')]({'where':{'id':_0x276d1b[_0xd070('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4cdc8c,null))[_0xd070('0x1a')](function(_0x3cc789){if(_0x3cc789){_0x347934=_0x3cc789;_0x5cf8aa[_0xd070('0x39')]=_['keys'](db[_0xd070('0x53')][_0xd070('0x37')]);_0x5cf8aa['query']=_[_0xd070('0x4d')](_0x276d1b[_0xd070('0x3a')]);_0x5cf8aa['filters']=_[_0xd070('0x3c')](_0x5cf8aa[_0xd070('0x39')],_0x5cf8aa[_0xd070('0x3a')]);_0x42aed7[_0xd070('0x3e')]=_[_0xd070('0x3c')](_0x5cf8aa[_0xd070('0x39')],qs[_0xd070('0x3d')](_0x276d1b['query']['fields']));_0x42aed7[_0xd070('0x3e')]=_0x42aed7[_0xd070('0x3e')][_0xd070('0x4e')]?_0x42aed7[_0xd070('0x3e')]:_0x5cf8aa[_0xd070('0x39')];_0x42aed7[_0xd070('0x42')]=qs[_0xd070('0x43')](_0x276d1b['query']['sort']);_0x42aed7[_0xd070('0x44')]=qs[_0xd070('0x3b')](_['pick'](_0x276d1b[_0xd070('0x3a')],_0x5cf8aa[_0xd070('0x3b')]));if(_0x276d1b[_0xd070('0x3a')]['filter']){_0x42aed7[_0xd070('0x44')]=_['merge'](_0x42aed7[_0xd070('0x44')],{'$or':_[_0xd070('0x35')](_0x42aed7[_0xd070('0x3e')],function(_0x2253c0){var _0x371286={};_0x371286[_0x2253c0]={'$like':'%'+_0x276d1b[_0xd070('0x3a')]['filter']+'%'};return _0x371286;})});}_0x42aed7=_[_0xd070('0x48')]({},_0x42aed7,_0x276d1b['options']);return _0x347934[_0xd070('0x56')](_0x42aed7);}})[_0xd070('0x1a')](function(_0x25d1e4){if(_0x25d1e4){_0x9727a0=_0x25d1e4[_0xd070('0x4e')];if(!_0x276d1b[_0xd070('0x3a')][_0xd070('0x3f')]('nolimit')){_0x42aed7[_0xd070('0x41')]=qs[_0xd070('0x41')](_0x276d1b[_0xd070('0x3a')][_0xd070('0x41')]);_0x42aed7['offset']=qs[_0xd070('0x29')](_0x276d1b[_0xd070('0x3a')][_0xd070('0x29')]);}return _0x347934[_0xd070('0x56')](_0x42aed7);}})[_0xd070('0x1a')](function(_0x1a216a){if(_0x1a216a){return _0x1a216a?{'count':_0x9727a0,'rows':_0x1a216a}:null;}})[_0xd070('0x1a')](respondWithResult(_0x4cdc8c,null))[_0xd070('0x24')](handleError(_0x4cdc8c,null));};exports[_0xd070('0x57')]=function(_0x4f84b8,_0x66b793,_0x1b4b69){var _0x35b9f2={};var _0x2663d8={};var _0x291749;var _0x47497b;return db['ZohoConfiguration'][_0xd070('0x52')]({'where':{'id':_0x4f84b8['params']['id']}})['then'](handleEntityNotFound(_0x66b793,null))['then'](function(_0x241d81){if(_0x241d81){_0x291749=_0x241d81;_0x2663d8[_0xd070('0x39')]=_[_0xd070('0x4d')](db[_0xd070('0x53')][_0xd070('0x37')]);_0x2663d8['query']=_[_0xd070('0x4d')](_0x4f84b8[_0xd070('0x3a')]);_0x2663d8[_0xd070('0x3b')]=_[_0xd070('0x3c')](_0x2663d8['model'],_0x2663d8[_0xd070('0x3a')]);_0x35b9f2[_0xd070('0x3e')]=_[_0xd070('0x3c')](_0x2663d8[_0xd070('0x39')],qs[_0xd070('0x3d')](_0x4f84b8[_0xd070('0x3a')][_0xd070('0x3d')]));_0x35b9f2[_0xd070('0x3e')]=_0x35b9f2[_0xd070('0x3e')]['length']?_0x35b9f2[_0xd070('0x3e')]:_0x2663d8[_0xd070('0x39')];_0x35b9f2['order']=qs[_0xd070('0x43')](_0x4f84b8[_0xd070('0x3a')][_0xd070('0x43')]);_0x35b9f2[_0xd070('0x44')]=qs[_0xd070('0x3b')](_[_0xd070('0x45')](_0x4f84b8[_0xd070('0x3a')],_0x2663d8[_0xd070('0x3b')]));if(_0x4f84b8[_0xd070('0x3a')][_0xd070('0x46')]){_0x35b9f2[_0xd070('0x44')]=_['merge'](_0x35b9f2['where'],{'$or':_[_0xd070('0x35')](_0x35b9f2[_0xd070('0x3e')],function(_0x4910c6){var _0x14ac0e={};_0x14ac0e[_0x4910c6]={'$like':'%'+_0x4f84b8['query'][_0xd070('0x46')]+'%'};return _0x14ac0e;})});}_0x35b9f2=_[_0xd070('0x48')]({},_0x35b9f2,_0x4f84b8[_0xd070('0x54')]);return _0x291749[_0xd070('0x57')](_0x35b9f2);}})[_0xd070('0x1a')](function(_0x2d59eb){if(_0x2d59eb){_0x47497b=_0x2d59eb[_0xd070('0x4e')];if(!_0x4f84b8[_0xd070('0x3a')][_0xd070('0x3f')](_0xd070('0x40'))){_0x35b9f2['limit']=qs['limit'](_0x4f84b8['query'][_0xd070('0x41')]);_0x35b9f2[_0xd070('0x29')]=qs[_0xd070('0x29')](_0x4f84b8[_0xd070('0x3a')]['offset']);}return _0x291749['getDescriptions'](_0x35b9f2);}})[_0xd070('0x1a')](function(_0x7f3950){if(_0x7f3950){return _0x7f3950?{'count':_0x47497b,'rows':_0x7f3950}:null;}})[_0xd070('0x1a')](respondWithResult(_0x66b793,null))['catch'](handleError(_0x66b793,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 69eae3e..3e2d5db 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 _0xa261=['ZohoConfiguration','int_zoho_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x59250f,_0x5327ee){var _0x36727e=function(_0x59dc37){while(--_0x59dc37){_0x59250f['push'](_0x59250f['shift']());}};_0x36727e(++_0x5327ee);}(_0xa261,0x116));var _0x1a26=function(_0x409855,_0x27db70){_0x409855=_0x409855-0x0;var _0x5de5d2=_0xa261[_0x409855];return _0x5de5d2;};'use strict';var _=require(_0x1a26('0x0'));var util=require(_0x1a26('0x1'));var logger=require('../../config/logger')(_0x1a26('0x2'));var moment=require(_0x1a26('0x3'));var BPromise=require(_0x1a26('0x4'));var rp=require(_0x1a26('0x5'));var fs=require('fs');var path=require(_0x1a26('0x6'));var rimraf=require(_0x1a26('0x7'));var config=require(_0x1a26('0x8'));var attributes=require('./intZohoConfiguration.attributes');module[_0x1a26('0x9')]=function(_0x381673,_0x429163){return _0x381673['define'](_0x1a26('0xa'),attributes,{'tableName':_0x1a26('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x497e=['path','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','api','moment','request-promise'];(function(_0x41915c,_0x469bc1){var _0x382d19=function(_0x4d85a0){while(--_0x4d85a0){_0x41915c['push'](_0x41915c['shift']());}};_0x382d19(++_0x469bc1);}(_0x497e,0x1da));var _0xe497=function(_0x480cea,_0x2b3cd0){_0x480cea=_0x480cea-0x0;var _0x3e5cc9=_0x497e[_0x480cea];return _0x3e5cc9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xe497('0x0'));var moment=require(_0xe497('0x1'));var BPromise=require('bluebird');var rp=require(_0xe497('0x2'));var fs=require('fs');var path=require(_0xe497('0x3'));var rimraf=require('rimraf');var config=require(_0xe497('0x4'));var attributes=require(_0xe497('0x5'));module[_0xe497('0x6')]=function(_0x45421d,_0x35bf11){return _0x45421d[_0xe497('0x7')](_0xe497('0x8'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index f803afe..217713a 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 _0xce87=['then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http'];(function(_0x5b9377,_0x1c547f){var _0xebe952=function(_0x23ea92){while(--_0x23ea92){_0x5b9377['push'](_0x5b9377['shift']());}};_0xebe952(++_0x1c547f);}(_0xce87,0xc9));var _0x7ce8=function(_0x16cbef,_0x3c1ad5){_0x16cbef=_0x16cbef-0x0;var _0x4ab4a6=_0xce87[_0x16cbef];return _0x4ab4a6;};'use strict';var _=require('lodash');var util=require(_0x7ce8('0x0'));var moment=require('moment');var BPromise=require(_0x7ce8('0x1'));var rs=require(_0x7ce8('0x2'));var fs=require('fs');var Redis=require(_0x7ce8('0x3'));var db=require(_0x7ce8('0x4'))['db'];var utils=require(_0x7ce8('0x5'));var logger=require(_0x7ce8('0x6'))(_0x7ce8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7ce8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x451b4d,_0x9941f,_0x2d1d50){return new BPromise(function(_0x2c0014,_0x36d226){return client['request'](_0x451b4d,_0x2d1d50)[_0x7ce8('0x9')](function(_0x2e4ce8){logger[_0x7ce8('0xa')](_0x7ce8('0xb'),_0x9941f,_0x7ce8('0xc'));logger[_0x7ce8('0xd')](_0x7ce8('0xe'),_0x9941f,_0x7ce8('0xc'),JSON[_0x7ce8('0xf')](_0x2e4ce8));if(_0x2e4ce8[_0x7ce8('0x10')]){if(_0x2e4ce8[_0x7ce8('0x10')][_0x7ce8('0x11')]===0x1f4){logger[_0x7ce8('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x9941f,_0x2e4ce8['error'][_0x7ce8('0x12')]);return _0x36d226(_0x2e4ce8[_0x7ce8('0x10')][_0x7ce8('0x12')]);}logger[_0x7ce8('0x10')](_0x7ce8('0xb'),_0x9941f,_0x2e4ce8['error'][_0x7ce8('0x12')]);return _0x2c0014(_0x2e4ce8[_0x7ce8('0x10')][_0x7ce8('0x12')]);}else{logger[_0x7ce8('0xa')](_0x7ce8('0xb'),_0x9941f,'request\x20sent');_0x2c0014(_0x2e4ce8[_0x7ce8('0x13')]['message']);}})[_0x7ce8('0x14')](function(_0x1b5d3c){logger[_0x7ce8('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x9941f,_0x1b5d3c);_0x36d226(_0x1b5d3c);});});} \ No newline at end of file +var _0x2399=['moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x50c9cc,_0x21337c){var _0x49d2e7=function(_0x6487be){while(--_0x6487be){_0x50c9cc['push'](_0x50c9cc['shift']());}};_0x49d2e7(++_0x21337c);}(_0x2399,0x92));var _0x9239=function(_0x32088f,_0x538e0a){_0x32088f=_0x32088f-0x0;var _0x43abf1=_0x2399[_0x32088f];return _0x43abf1;};'use strict';var _=require(_0x9239('0x0'));var util=require('util');var moment=require(_0x9239('0x1'));var BPromise=require(_0x9239('0x2'));var rs=require(_0x9239('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9239('0x4'));var logger=require(_0x9239('0x5'))('rpc');var config=require(_0x9239('0x6'));var jayson=require(_0x9239('0x7'));var client=jayson['client'][_0x9239('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x331228,_0x5a2c33,_0x44251a){return new BPromise(function(_0x1c7252,_0x4d8738){return client[_0x9239('0x9')](_0x331228,_0x44251a)['then'](function(_0xacfa34){logger['info'](_0x9239('0xa'),_0x5a2c33,_0x9239('0xb'));logger[_0x9239('0xc')](_0x9239('0xd'),_0x5a2c33,_0x9239('0xb'),JSON[_0x9239('0xe')](_0xacfa34));if(_0xacfa34[_0x9239('0xf')]){if(_0xacfa34['error'][_0x9239('0x10')]===0x1f4){logger[_0x9239('0xf')](_0x9239('0xa'),_0x5a2c33,_0xacfa34[_0x9239('0xf')][_0x9239('0x11')]);return _0x4d8738(_0xacfa34[_0x9239('0xf')][_0x9239('0x11')]);}logger[_0x9239('0xf')](_0x9239('0xa'),_0x5a2c33,_0xacfa34['error'][_0x9239('0x11')]);return _0x1c7252(_0xacfa34[_0x9239('0xf')][_0x9239('0x11')]);}else{logger[_0x9239('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x5a2c33,_0x9239('0xb'));_0x1c7252(_0xacfa34[_0x9239('0x13')][_0x9239('0x11')]);}})[_0x9239('0x14')](function(_0x1baaa7){logger[_0x9239('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x5a2c33,_0x1baaa7);_0x4d8738(_0x1baaa7);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 063e9d3..3978db8 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 _0xd4a2=['./intZohoField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','multer','connect-timeout','Router','../../components/interaction/service'];(function(_0x7960ae,_0x49d992){var _0x1619d7=function(_0x369e5e){while(--_0x369e5e){_0x7960ae['push'](_0x7960ae['shift']());}};_0x1619d7(++_0x49d992);}(_0xd4a2,0x173));var _0x2d4a=function(_0x176533,_0x54750d){_0x176533=_0x176533-0x0;var _0x120261=_0xd4a2[_0x176533];return _0x120261;};'use strict';var multer=require(_0x2d4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d4a('0x1'));var express=require('express');var router=express[_0x2d4a('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x2d4a('0x3'));var config=require('../../config/environment');var controller=require(_0x2d4a('0x4'));router[_0x2d4a('0x5')]('/',auth[_0x2d4a('0x6')](),controller[_0x2d4a('0x7')]);router[_0x2d4a('0x5')]('/:id',auth[_0x2d4a('0x6')](),controller[_0x2d4a('0x8')]);router[_0x2d4a('0x9')]('/',auth[_0x2d4a('0x6')](),controller[_0x2d4a('0xa')]);router[_0x2d4a('0xb')](_0x2d4a('0xc'),auth[_0x2d4a('0x6')](),controller[_0x2d4a('0xd')]);router[_0x2d4a('0xe')](_0x2d4a('0xc'),auth[_0x2d4a('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf2e3=['show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index','/:id','isAuthenticated'];(function(_0x3cf3fd,_0x2d387d){var _0x27b83b=function(_0x1cc54b){while(--_0x1cc54b){_0x3cf3fd['push'](_0x3cf3fd['shift']());}};_0x27b83b(++_0x2d387d);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xf2e3[_0x56916d];return _0x2b7f1f;};'use strict';var multer=require(_0x3f2e('0x0'));var util=require('util');var path=require(_0x3f2e('0x1'));var timeout=require(_0x3f2e('0x2'));var express=require(_0x3f2e('0x3'));var router=express[_0x3f2e('0x4')]();var auth=require(_0x3f2e('0x5'));var interaction=require(_0x3f2e('0x6'));var config=require(_0x3f2e('0x7'));var controller=require(_0x3f2e('0x8'));router[_0x3f2e('0x9')]('/',auth['isAuthenticated'](),controller[_0x3f2e('0xa')]);router[_0x3f2e('0x9')](_0x3f2e('0xb'),auth[_0x3f2e('0xc')](),controller[_0x3f2e('0xd')]);router[_0x3f2e('0xe')]('/',auth[_0x3f2e('0xc')](),controller[_0x3f2e('0xf')]);router[_0x3f2e('0x10')](_0x3f2e('0xb'),auth[_0x3f2e('0xc')](),controller[_0x3f2e('0x11')]);router[_0x3f2e('0x12')](_0x3f2e('0xb'),auth[_0x3f2e('0xc')](),controller[_0x3f2e('0x13')]);module[_0x3f2e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 626db52..13e4d86 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 _0xd8ee=['customVariable','BOOLEAN','sequelize','ENUM','string','variable','keyValue','STRING'];(function(_0x39999c,_0x52c75a){var _0x58280d=function(_0x33536f){while(--_0x33536f){_0x39999c['push'](_0x39999c['shift']());}};_0x58280d(++_0x52c75a);}(_0xd8ee,0x1f2));var _0xed8e=function(_0x4066e7,_0x14df6f){_0x4066e7=_0x4066e7-0x0;var _0x45e997=_0xd8ee[_0x4066e7];return _0x45e997;};'use strict';var Sequelize=require(_0xed8e('0x0'));module['exports']={'type':{'type':Sequelize[_0xed8e('0x1')](_0xed8e('0x2'),_0xed8e('0x3'),'customVariable',_0xed8e('0x4')),'defaultValue':_0xed8e('0x2')},'content':{'type':Sequelize[_0xed8e('0x5')]},'key':{'type':Sequelize[_0xed8e('0x5')]},'keyType':{'type':Sequelize[_0xed8e('0x1')](_0xed8e('0x2'),'variable',_0xed8e('0x6'))},'keyContent':{'type':Sequelize[_0xed8e('0x5')]},'idField':{'type':Sequelize[_0xed8e('0x5')]},'nameField':{'type':Sequelize[_0xed8e('0x5')]},'customField':{'type':Sequelize[_0xed8e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xed8e('0x5')]}}; \ No newline at end of file +var _0x58f4=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x2a1ab3,_0xe92f95){var _0x21b0fc=function(_0x1e3184){while(--_0x1e3184){_0x2a1ab3['push'](_0x2a1ab3['shift']());}};_0x21b0fc(++_0xe92f95);}(_0x58f4,0x1b2));var _0x458f=function(_0x24914d,_0x5c47e7){_0x24914d=_0x24914d-0x0;var _0x3f59da=_0x58f4[_0x24914d];return _0x3f59da;};'use strict';var Sequelize=require('sequelize');module[_0x458f('0x0')]={'type':{'type':Sequelize[_0x458f('0x1')](_0x458f('0x2'),_0x458f('0x3'),_0x458f('0x4'),_0x458f('0x5')),'defaultValue':_0x458f('0x2')},'content':{'type':Sequelize[_0x458f('0x6')]},'key':{'type':Sequelize[_0x458f('0x6')]},'keyType':{'type':Sequelize[_0x458f('0x1')](_0x458f('0x2'),_0x458f('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x458f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x458f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 6260ae2..b009d2b 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 _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x359ea9,_0x405aeb){var _0x36ae73=function(_0x10d96e){while(--_0x10d96e){_0x359ea9['push'](_0x359ea9['shift']());}};_0x36ae73(++_0x405aeb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x168057,_0x18fae0){var _0x470c2f=function(_0x540df1){while(--_0x540df1){_0x168057['push'](_0x168057['shift']());}};_0x470c2f(++_0x18fae0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 0b298c6..4b43d4a 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 _0x0a2f=['../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','ZohoField','zoho_unique_index','idField','lodash'];(function(_0x2b0d0d,_0x19a500){var _0x530ee1=function(_0x3898ac){while(--_0x3898ac){_0x2b0d0d['push'](_0x2b0d0d['shift']());}};_0x530ee1(++_0x19a500);}(_0x0a2f,0x6b));var _0xf0a2=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0x0a2f[_0x243217];return _0x478029;};'use strict';var _=require(_0xf0a2('0x0'));var util=require('util');var logger=require(_0xf0a2('0x1'))(_0xf0a2('0x2'));var moment=require('moment');var BPromise=require(_0xf0a2('0x3'));var rp=require(_0xf0a2('0x4'));var fs=require('fs');var path=require(_0xf0a2('0x5'));var rimraf=require(_0xf0a2('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0xf0a2('0x7')]=function(_0x57083c,_0x54b43f){return _0x57083c[_0xf0a2('0x8')](_0xf0a2('0x9'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xf0a2('0xa'),'fields':[_0xf0a2('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5c4c=['api','moment','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x19ce40,_0x468ef4){var _0x3e0d9e=function(_0x186930){while(--_0x186930){_0x19ce40['push'](_0x19ce40['shift']());}};_0x3e0d9e(++_0x468ef4);}(_0x5c4c,0x1b7));var _0xc5c4=function(_0x4e67c1,_0x22a567){_0x4e67c1=_0x4e67c1-0x0;var _0x379a39=_0x5c4c[_0x4e67c1];return _0x379a39;};'use strict';var _=require(_0xc5c4('0x0'));var util=require(_0xc5c4('0x1'));var logger=require(_0xc5c4('0x2'))(_0xc5c4('0x3'));var moment=require(_0xc5c4('0x4'));var BPromise=require(_0xc5c4('0x5'));var rp=require(_0xc5c4('0x6'));var fs=require('fs');var path=require(_0xc5c4('0x7'));var rimraf=require('rimraf');var config=require(_0xc5c4('0x8'));var attributes=require(_0xc5c4('0x9'));module[_0xc5c4('0xa')]=function(_0x5f38d0,_0x3a1ae0){return _0x5f38d0[_0xc5c4('0xb')](_0xc5c4('0xc'),attributes,{'tableName':_0xc5c4('0xd'),'paranoid':![],'indexes':[{'name':_0xc5c4('0xe'),'fields':[_0xc5c4('0xf'),_0xc5c4('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 4e7a59b..632be3a 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 _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','ZohoField,\x20%s,\x20%s','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x4fe56c,_0x180057){var _0x495f50=function(_0x3b288){while(--_0x3b288){_0x4fe56c['push'](_0x4fe56c['shift']());}};_0x495f50(++_0x180057);}(_0xe14b,0x93));var _0xbe14=function(_0x517894,_0x1bba74){_0x517894=_0x517894-0x0;var _0x326379=_0xe14b[_0x517894];return _0x326379;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file +var _0x4bc3=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ZohoField,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x560417,_0x413aee){var _0x21ab82=function(_0x99b562){while(--_0x99b562){_0x560417['push'](_0x560417['shift']());}};_0x21ab82(++_0x413aee);}(_0x4bc3,0x16e));var _0x34bc=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x4bc3[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var moment=require('moment');var BPromise=require(_0x34bc('0x2'));var rs=require(_0x34bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34bc('0x4'))['db'];var utils=require(_0x34bc('0x5'));var logger=require(_0x34bc('0x6'))(_0x34bc('0x7'));var config=require(_0x34bc('0x8'));var jayson=require(_0x34bc('0x9'));var client=jayson[_0x34bc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21451b,_0x50320d,_0x502087){return new BPromise(function(_0x18a01c,_0x474108){return client[_0x34bc('0xb')](_0x21451b,_0x502087)[_0x34bc('0xc')](function(_0x409105){logger[_0x34bc('0xd')]('ZohoField,\x20%s,\x20%s',_0x50320d,'request\x20sent');logger[_0x34bc('0xe')](_0x34bc('0xf'),_0x50320d,_0x34bc('0x10'),JSON['stringify'](_0x409105));if(_0x409105[_0x34bc('0x11')]){if(_0x409105['error'][_0x34bc('0x12')]===0x1f4){logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x50320d,_0x409105['error'][_0x34bc('0x14')]);return _0x474108(_0x409105['error'][_0x34bc('0x14')]);}logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x50320d,_0x409105['error']['message']);return _0x18a01c(_0x409105[_0x34bc('0x11')]['message']);}else{logger[_0x34bc('0xd')](_0x34bc('0x13'),_0x50320d,_0x34bc('0x10'));_0x18a01c(_0x409105[_0x34bc('0x15')][_0x34bc('0x14')]);}})[_0x34bc('0x16')](function(_0x5e132d){logger['error']('ZohoField,\x20%s,\x20%s',_0x50320d,_0x5e132d);_0x474108(_0x5e132d);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 9d15544..8a18eec 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 _0x255a=['exports','multer','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3173df,_0x526a36){var _0x5c5198=function(_0x433dff){while(--_0x433dff){_0x3173df['push'](_0x3173df['shift']());}};_0x5c5198(++_0x526a36);}(_0x255a,0x1b7));var _0xa255=function(_0x12a609,_0x4234c8){_0x12a609=_0x12a609-0x0;var _0x30aed0=_0x255a[_0x12a609];return _0x30aed0;};'use strict';var multer=require(_0xa255('0x0'));var util=require('util');var path=require(_0xa255('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa255('0x2')]();var auth=require(_0xa255('0x3'));var interaction=require(_0xa255('0x4'));var config=require('../../config/environment');module[_0xa255('0x5')]=router; \ No newline at end of file +var _0xe1e2=['../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout','express','Router'];(function(_0xd95fd8,_0x48f977){var _0x4142ea=function(_0x29f62c){while(--_0x29f62c){_0xd95fd8['push'](_0xd95fd8['shift']());}};_0x4142ea(++_0x48f977);}(_0xe1e2,0x1e3));var _0x2e1e=function(_0x1e636c,_0x233cdf){_0x1e636c=_0x1e636c-0x0;var _0x566127=_0xe1e2[_0x1e636c];return _0x566127;};'use strict';var multer=require('multer');var util=require(_0x2e1e('0x0'));var path=require(_0x2e1e('0x1'));var timeout=require(_0x2e1e('0x2'));var express=require(_0x2e1e('0x3'));var router=express[_0x2e1e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2e1e('0x5'));var config=require(_0x2e1e('0x6'));module[_0x2e1e('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index be35394..f643e0c 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 _0x8ba1=['sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state'];(function(_0x35daa3,_0x54ee57){var _0x288bd6=function(_0x1d7d05){while(--_0x1d7d05){_0x35daa3['push'](_0x35daa3['shift']());}};_0x288bd6(++_0x54ee57);}(_0x8ba1,0x1a0));var _0x18ba=function(_0x26dcbd,_0x1c2ca3){_0x26dcbd=_0x26dcbd-0x0;var _0x13a0c3=_0x8ba1[_0x26dcbd];return _0x13a0c3;};'use strict';var Sequelize=require(_0x18ba('0x0'));module[_0x18ba('0x1')]={'name':{'type':Sequelize[_0x18ba('0x2')],'allowNull':![],'unique':_0x18ba('0x3')},'version':{'type':Sequelize[_0x18ba('0x2')],'allowNull':![],'unique':_0x18ba('0x3')},'main':{'type':Sequelize[_0x18ba('0x2')],'defaultValue':_0x18ba('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x18ba('0x2')]},'size':{'type':Sequelize[_0x18ba('0x5')]},'active':{'type':Sequelize[_0x18ba('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x18ba('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x18ba('0x2')],'unique':_0x18ba('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x18ba('0x2')]},'remoteUri':{'type':Sequelize[_0x18ba('0x2')]},'link':{'type':Sequelize[_0x18ba('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x0dbb=['STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize','exports'];(function(_0x2e702c,_0x49b529){var _0x1bee63=function(_0x82a81e){while(--_0x82a81e){_0x2e702c['push'](_0x2e702c['shift']());}};_0x1bee63(++_0x49b529);}(_0x0dbb,0x196));var _0xb0db=function(_0x72e72b,_0x1ec2ca){_0x72e72b=_0x72e72b-0x0;var _0x307667=_0x0dbb[_0x72e72b];return _0x307667;};'use strict';var Sequelize=require(_0xb0db('0x0'));module[_0xb0db('0x1')]={'name':{'type':Sequelize[_0xb0db('0x2')],'allowNull':![],'unique':_0xb0db('0x3')},'version':{'type':Sequelize[_0xb0db('0x2')],'allowNull':![],'unique':_0xb0db('0x3')},'main':{'type':Sequelize[_0xb0db('0x2')],'defaultValue':_0xb0db('0x4')},'filename':{'type':Sequelize[_0xb0db('0x2')]},'path':{'type':Sequelize[_0xb0db('0x2')]},'type':{'type':Sequelize[_0xb0db('0x2')]},'size':{'type':Sequelize[_0xb0db('0x5')]},'active':{'type':Sequelize[_0xb0db('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xb0db('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xb0db('0x2')],'unique':_0xb0db('0x7')},'description':{'type':Sequelize[_0xb0db('0x2')]},'title':{'type':Sequelize[_0xb0db('0x2')]},'remoteUri':{'type':Sequelize[_0xb0db('0x2')]},'link':{'type':Sequelize[_0xb0db('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 3cbf332..bfa078f 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 _0xda13=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','error','stack','index','map','fieldName','name','query','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','filter','type','merge','include','Integration','rows','catch','show','model','keys','rawAttributes','fields','options','find','create','body','params','html-pdf'];(function(_0x269a17,_0x36d28d){var _0x2cc518=function(_0x251f73){while(--_0x251f73){_0x269a17['push'](_0x269a17['shift']());}};_0x2cc518(++_0x36d28d);}(_0xda13,0x107));var _0x3da1=function(_0x7e3f06,_0x426f70){_0x7e3f06=_0x7e3f06-0x0;var _0x12b8ff=_0xda13[_0x7e3f06];return _0x12b8ff;};'use strict';var pdf=require(_0x3da1('0x0'));var emlformat=require(_0x3da1('0x1'));var rimraf=require(_0x3da1('0x2'));var zipdir=require(_0x3da1('0x3'));var jsonpatch=require(_0x3da1('0x4'));var rp=require(_0x3da1('0x5'));var moment=require(_0x3da1('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x3da1('0x7'));var util=require('util');var path=require(_0x3da1('0x8'));var sox=require('sox');var csv=require(_0x3da1('0x9'));var ejs=require(_0x3da1('0xa'));var fs=require('fs');var _=require(_0x3da1('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3da1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3da1('0xd'));var Papa=require(_0x3da1('0xe'));var Redis=require('ioredis');var authService=require(_0x3da1('0xf'));var qs=require(_0x3da1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3da1('0x11'));var logger=require(_0x3da1('0x12'))(_0x3da1('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x3da1('0x14'))['db'];function respondWithStatusCode(_0x134cea,_0x1f56de){_0x1f56de=_0x1f56de||0xcc;return function(_0x43c3c0){if(_0x43c3c0){return _0x134cea[_0x3da1('0x15')](_0x1f56de);}return _0x134cea[_0x3da1('0x16')](_0x1f56de)[_0x3da1('0x17')]();};}function respondWithResult(_0xc9f8e5,_0x26e23f){_0x26e23f=_0x26e23f||0xc8;return function(_0x17dfb0){if(_0x17dfb0){return _0xc9f8e5['status'](_0x26e23f)[_0x3da1('0x18')](_0x17dfb0);}};}function respondWithFilteredResult(_0x315f68,_0x387bc4){return function(_0x1fcbca){if(_0x1fcbca){var _0x25c883=_0x1fcbca[_0x3da1('0x19')],_0x140813=_0x387bc4[_0x3da1('0x1a')],_0x20a130=_0x387bc4[_0x3da1('0x1a')]+_0x387bc4[_0x3da1('0x1b')],_0x1eac54;if(_0x20a130>=_0x25c883){_0x20a130=_0x25c883;_0x1eac54=0xc8;}else{_0x1eac54=0xce;}_0x315f68[_0x3da1('0x16')](_0x1eac54);return _0x315f68[_0x3da1('0x1c')]('Content-Range',_0x140813+'-'+_0x20a130+'/'+_0x25c883)['json'](_0x1fcbca);}return null;};}function patchUpdates(_0x40e7df){return function(_0x45caf7){try{jsonpatch[_0x3da1('0x1d')](_0x45caf7,_0x40e7df,!![]);}catch(_0xfff091){return BPromise['reject'](_0xfff091);}return _0x45caf7[_0x3da1('0x1e')]();};}function saveUpdates(_0x121dc9,_0x169a69){return function(_0x1d7270){if(_0x1d7270){return _0x1d7270[_0x3da1('0x1f')](_0x121dc9)[_0x3da1('0x20')](function(_0x3ed623){return _0x3ed623;});}return null;};}function removeEntity(_0x1830b6,_0xd88f8d){return function(_0x57ec89){if(_0x57ec89){return _0x57ec89[_0x3da1('0x21')]()[_0x3da1('0x20')](function(){_0x1830b6[_0x3da1('0x16')](0xcc)[_0x3da1('0x17')]();});}};}function handleEntityNotFound(_0x2ee8e3,_0x4a97fd){return function(_0x527933){if(!_0x527933){_0x2ee8e3[_0x3da1('0x15')](0x194);}return _0x527933;};}function handleError(_0x467306,_0x45fb11){_0x45fb11=_0x45fb11||0x1f4;return function(_0x1c3c40){logger[_0x3da1('0x22')](_0x1c3c40[_0x3da1('0x23')]);if(_0x1c3c40['name']){delete _0x1c3c40['name'];}_0x467306[_0x3da1('0x16')](_0x45fb11)['send'](_0x1c3c40);};}exports[_0x3da1('0x24')]=function(_0x40a1ae,_0x15ae12){var _0xf6b03d={},_0x2b4d65={},_0x478629={'count':0x0,'rows':[]};var _0xaebadb=_[_0x3da1('0x25')](db['Integration']['rawAttributes'],function(_0x134b5f){return{'name':_0x134b5f[_0x3da1('0x26')],'type':_0x134b5f['type']['key']};});_0x2b4d65['model']=_[_0x3da1('0x25')](_0xaebadb,_0x3da1('0x27'));_0x2b4d65[_0x3da1('0x28')]=_['keys'](_0x40a1ae[_0x3da1('0x28')]);_0x2b4d65[_0x3da1('0x29')]=_[_0x3da1('0x2a')](_0x2b4d65['model'],_0x2b4d65[_0x3da1('0x28')]);_0xf6b03d[_0x3da1('0x2b')]=_[_0x3da1('0x2a')](_0x2b4d65['model'],qs['fields'](_0x40a1ae[_0x3da1('0x28')]['fields']));_0xf6b03d['attributes']=_0xf6b03d[_0x3da1('0x2b')][_0x3da1('0x2c')]?_0xf6b03d['attributes']:_0x2b4d65['model'];if(!_0x40a1ae[_0x3da1('0x28')][_0x3da1('0x2d')]('nolimit')){_0xf6b03d[_0x3da1('0x1b')]=qs[_0x3da1('0x1b')](_0x40a1ae[_0x3da1('0x28')][_0x3da1('0x1b')]);_0xf6b03d['offset']=qs['offset'](_0x40a1ae[_0x3da1('0x28')][_0x3da1('0x1a')]);}_0xf6b03d['order']=qs[_0x3da1('0x2e')](_0x40a1ae[_0x3da1('0x28')]['sort']);_0xf6b03d[_0x3da1('0x2f')]=qs['filters'](_[_0x3da1('0x30')](_0x40a1ae['query'],_0x2b4d65[_0x3da1('0x29')]),_0xaebadb);if(_0x40a1ae[_0x3da1('0x28')][_0x3da1('0x31')]){_0xf6b03d[_0x3da1('0x2f')]=_['merge'](_0xf6b03d['where'],{'$or':_[_0x3da1('0x25')](_0xaebadb,function(_0x229554){if(_0x229554[_0x3da1('0x32')]!=='VIRTUAL'){var _0x799bf0={};_0x799bf0[_0x229554[_0x3da1('0x27')]]={'$like':'%'+_0x40a1ae[_0x3da1('0x28')][_0x3da1('0x31')]+'%'};return _0x799bf0;}})});}_0xf6b03d=_[_0x3da1('0x33')]({},_0xf6b03d,_0x40a1ae['options']);var _0x2c621e={'where':_0xf6b03d['where']};return db['Integration'][_0x3da1('0x19')](_0x2c621e)[_0x3da1('0x20')](function(_0x418a44){_0x478629[_0x3da1('0x19')]=_0x418a44;if(_0x40a1ae[_0x3da1('0x28')]['includeAll']){_0xf6b03d[_0x3da1('0x34')]=[{'all':!![]}];}return db[_0x3da1('0x35')]['findAll'](_0xf6b03d);})[_0x3da1('0x20')](function(_0x21f02a){_0x478629[_0x3da1('0x36')]=_0x21f02a;return _0x478629;})[_0x3da1('0x20')](respondWithFilteredResult(_0x15ae12,_0xf6b03d))[_0x3da1('0x37')](handleError(_0x15ae12,null));};exports[_0x3da1('0x38')]=function(_0xd5240a,_0x14921c){var _0x397a00={'raw':![],'where':{'id':_0xd5240a['params']['id']}},_0x310aeb={};_0x310aeb[_0x3da1('0x39')]=_[_0x3da1('0x3a')](db[_0x3da1('0x35')][_0x3da1('0x3b')]);_0x310aeb[_0x3da1('0x28')]=_[_0x3da1('0x3a')](_0xd5240a['query']);_0x310aeb[_0x3da1('0x29')]=_['intersection'](_0x310aeb[_0x3da1('0x39')],_0x310aeb[_0x3da1('0x28')]);_0x397a00[_0x3da1('0x2b')]=_['intersection'](_0x310aeb[_0x3da1('0x39')],qs['fields'](_0xd5240a[_0x3da1('0x28')][_0x3da1('0x3c')]));_0x397a00[_0x3da1('0x2b')]=_0x397a00[_0x3da1('0x2b')]['length']?_0x397a00[_0x3da1('0x2b')]:_0x310aeb[_0x3da1('0x39')];if(_0xd5240a['query']['includeAll']){_0x397a00[_0x3da1('0x34')]=[{'all':!![]}];}_0x397a00=_[_0x3da1('0x33')]({},_0x397a00,_0xd5240a[_0x3da1('0x3d')]);return db[_0x3da1('0x35')][_0x3da1('0x3e')](_0x397a00)[_0x3da1('0x20')](handleEntityNotFound(_0x14921c,null))[_0x3da1('0x20')](respondWithResult(_0x14921c,null))['catch'](handleError(_0x14921c,null));};exports[_0x3da1('0x3f')]=function(_0xacc472,_0x37830f){return db[_0x3da1('0x35')][_0x3da1('0x3f')](_0xacc472[_0x3da1('0x40')],{})[_0x3da1('0x20')](respondWithResult(_0x37830f,0xc9))[_0x3da1('0x37')](handleError(_0x37830f,null));};exports['update']=function(_0xdf0e54,_0x290d2f){if(_0xdf0e54[_0x3da1('0x40')]['id']){delete _0xdf0e54['body']['id'];}return db[_0x3da1('0x35')][_0x3da1('0x3e')]({'where':{'id':_0xdf0e54[_0x3da1('0x41')]['id']}})[_0x3da1('0x20')](handleEntityNotFound(_0x290d2f,null))['then'](saveUpdates(_0xdf0e54[_0x3da1('0x40')],null))[_0x3da1('0x20')](respondWithResult(_0x290d2f,null))[_0x3da1('0x37')](handleError(_0x290d2f,null));};exports[_0x3da1('0x21')]=function(_0x367324,_0x6d75d5){return db[_0x3da1('0x35')][_0x3da1('0x3e')]({'where':{'id':_0x367324['params']['id']}})['then'](handleEntityNotFound(_0x6d75d5,null))['then'](removeEntity(_0x6d75d5,null))[_0x3da1('0x37')](handleError(_0x6d75d5,null));}; \ No newline at end of file +var _0x617c=['length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Integration','includeAll','include','findAll','rows','catch','show','params','fields','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x617c,0x179));var _0xc617=function(_0x422be2,_0x1c439e){_0x422be2=_0x422be2-0x0;var _0x1b820e=_0x617c[_0x422be2];return _0x1b820e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc617('0x0'));var rimraf=require(_0xc617('0x1'));var zipdir=require(_0xc617('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc617('0x3'));var moment=require(_0xc617('0x4'));var BPromise=require(_0xc617('0x5'));var Mustache=require(_0xc617('0x6'));var util=require(_0xc617('0x7'));var path=require(_0xc617('0x8'));var sox=require(_0xc617('0x9'));var csv=require(_0xc617('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc617('0xb'));var squel=require(_0xc617('0xc'));var crypto=require('crypto');var jsforce=require(_0xc617('0xd'));var deskjs=require(_0xc617('0xe'));var toCsv=require(_0xc617('0xa'));var querystring=require(_0xc617('0xf'));var Papa=require(_0xc617('0x10'));var Redis=require(_0xc617('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc617('0x12'));var hardwareService=require(_0xc617('0x13'));var logger=require(_0xc617('0x14'))(_0xc617('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a219e,_0x1b65c8){_0x1b65c8=_0x1b65c8||0xcc;return function(_0x5018a2){if(_0x5018a2){return _0x1a219e[_0xc617('0x16')](_0x1b65c8);}return _0x1a219e[_0xc617('0x17')](_0x1b65c8)[_0xc617('0x18')]();};}function respondWithResult(_0x29b740,_0x5c1a62){_0x5c1a62=_0x5c1a62||0xc8;return function(_0x5da3c7){if(_0x5da3c7){return _0x29b740[_0xc617('0x17')](_0x5c1a62)[_0xc617('0x19')](_0x5da3c7);}};}function respondWithFilteredResult(_0x52e14d,_0x5e9d6e){return function(_0x22f7cf){if(_0x22f7cf){var _0x1f9c33=_0x22f7cf[_0xc617('0x1a')],_0x291429=_0x5e9d6e['offset'],_0x2f6490=_0x5e9d6e[_0xc617('0x1b')]+_0x5e9d6e[_0xc617('0x1c')],_0x17af73;if(_0x2f6490>=_0x1f9c33){_0x2f6490=_0x1f9c33;_0x17af73=0xc8;}else{_0x17af73=0xce;}_0x52e14d['status'](_0x17af73);return _0x52e14d[_0xc617('0x1d')]('Content-Range',_0x291429+'-'+_0x2f6490+'/'+_0x1f9c33)[_0xc617('0x19')](_0x22f7cf);}return null;};}function patchUpdates(_0x11a4e9){return function(_0x31cbbb){try{jsonpatch[_0xc617('0x1e')](_0x31cbbb,_0x11a4e9,!![]);}catch(_0x811ee8){return BPromise[_0xc617('0x1f')](_0x811ee8);}return _0x31cbbb[_0xc617('0x20')]();};}function saveUpdates(_0x25f017,_0x282e37){return function(_0xd22d4c){if(_0xd22d4c){return _0xd22d4c[_0xc617('0x21')](_0x25f017)[_0xc617('0x22')](function(_0x3cc5e1){return _0x3cc5e1;});}return null;};}function removeEntity(_0x2da796,_0x3d1a25){return function(_0x4143f6){if(_0x4143f6){return _0x4143f6[_0xc617('0x23')]()[_0xc617('0x22')](function(){_0x2da796[_0xc617('0x17')](0xcc)[_0xc617('0x18')]();});}};}function handleEntityNotFound(_0x5ed255,_0x2807d2){return function(_0x5024e8){if(!_0x5024e8){_0x5ed255[_0xc617('0x16')](0x194);}return _0x5024e8;};}function handleError(_0x457adb,_0x5baf48){_0x5baf48=_0x5baf48||0x1f4;return function(_0xf49f96){logger[_0xc617('0x24')](_0xf49f96['stack']);if(_0xf49f96[_0xc617('0x25')]){delete _0xf49f96[_0xc617('0x25')];}_0x457adb[_0xc617('0x17')](_0x5baf48)[_0xc617('0x26')](_0xf49f96);};}exports['index']=function(_0x108f23,_0x2874cb){var _0x458144={},_0x2a75e1={},_0x4ad15e={'count':0x0,'rows':[]};var _0x497deb=_[_0xc617('0x27')](db['Integration'][_0xc617('0x28')],function(_0x2f0c3b){return{'name':_0x2f0c3b['fieldName'],'type':_0x2f0c3b[_0xc617('0x29')][_0xc617('0x2a')]};});_0x2a75e1[_0xc617('0x2b')]=_['map'](_0x497deb,_0xc617('0x25'));_0x2a75e1[_0xc617('0x2c')]=_[_0xc617('0x2d')](_0x108f23[_0xc617('0x2c')]);_0x2a75e1[_0xc617('0x2e')]=_[_0xc617('0x2f')](_0x2a75e1[_0xc617('0x2b')],_0x2a75e1[_0xc617('0x2c')]);_0x458144[_0xc617('0x30')]=_[_0xc617('0x2f')](_0x2a75e1[_0xc617('0x2b')],qs['fields'](_0x108f23[_0xc617('0x2c')]['fields']));_0x458144['attributes']=_0x458144[_0xc617('0x30')][_0xc617('0x31')]?_0x458144[_0xc617('0x30')]:_0x2a75e1[_0xc617('0x2b')];if(!_0x108f23[_0xc617('0x2c')][_0xc617('0x32')]('nolimit')){_0x458144['limit']=qs[_0xc617('0x1c')](_0x108f23['query'][_0xc617('0x1c')]);_0x458144['offset']=qs[_0xc617('0x1b')](_0x108f23[_0xc617('0x2c')][_0xc617('0x1b')]);}_0x458144[_0xc617('0x33')]=qs[_0xc617('0x34')](_0x108f23['query']['sort']);_0x458144[_0xc617('0x35')]=qs[_0xc617('0x2e')](_[_0xc617('0x36')](_0x108f23[_0xc617('0x2c')],_0x2a75e1[_0xc617('0x2e')]),_0x497deb);if(_0x108f23[_0xc617('0x2c')][_0xc617('0x37')]){_0x458144['where']=_[_0xc617('0x38')](_0x458144['where'],{'$or':_[_0xc617('0x27')](_0x497deb,function(_0x611f59){if(_0x611f59[_0xc617('0x29')]!==_0xc617('0x39')){var _0x40833d={};_0x40833d[_0x611f59['name']]={'$like':'%'+_0x108f23[_0xc617('0x2c')]['filter']+'%'};return _0x40833d;}})});}_0x458144=_[_0xc617('0x38')]({},_0x458144,_0x108f23[_0xc617('0x3a')]);var _0x1caf81={'where':_0x458144[_0xc617('0x35')]};return db[_0xc617('0x3b')][_0xc617('0x1a')](_0x1caf81)['then'](function(_0x39d7d3){_0x4ad15e[_0xc617('0x1a')]=_0x39d7d3;if(_0x108f23['query'][_0xc617('0x3c')]){_0x458144[_0xc617('0x3d')]=[{'all':!![]}];}return db[_0xc617('0x3b')][_0xc617('0x3e')](_0x458144);})[_0xc617('0x22')](function(_0x56a0f1){_0x4ad15e[_0xc617('0x3f')]=_0x56a0f1;return _0x4ad15e;})[_0xc617('0x22')](respondWithFilteredResult(_0x2874cb,_0x458144))[_0xc617('0x40')](handleError(_0x2874cb,null));};exports[_0xc617('0x41')]=function(_0x54a13f,_0x1503ee){var _0x12f879={'raw':![],'where':{'id':_0x54a13f[_0xc617('0x42')]['id']}},_0x50ba6e={};_0x50ba6e[_0xc617('0x2b')]=_[_0xc617('0x2d')](db[_0xc617('0x3b')][_0xc617('0x28')]);_0x50ba6e[_0xc617('0x2c')]=_[_0xc617('0x2d')](_0x54a13f['query']);_0x50ba6e[_0xc617('0x2e')]=_['intersection'](_0x50ba6e[_0xc617('0x2b')],_0x50ba6e[_0xc617('0x2c')]);_0x12f879[_0xc617('0x30')]=_[_0xc617('0x2f')](_0x50ba6e['model'],qs[_0xc617('0x43')](_0x54a13f[_0xc617('0x2c')][_0xc617('0x43')]));_0x12f879[_0xc617('0x30')]=_0x12f879[_0xc617('0x30')][_0xc617('0x31')]?_0x12f879[_0xc617('0x30')]:_0x50ba6e[_0xc617('0x2b')];if(_0x54a13f[_0xc617('0x2c')][_0xc617('0x3c')]){_0x12f879[_0xc617('0x3d')]=[{'all':!![]}];}_0x12f879=_[_0xc617('0x38')]({},_0x12f879,_0x54a13f[_0xc617('0x3a')]);return db[_0xc617('0x3b')]['find'](_0x12f879)[_0xc617('0x22')](handleEntityNotFound(_0x1503ee,null))[_0xc617('0x22')](respondWithResult(_0x1503ee,null))[_0xc617('0x40')](handleError(_0x1503ee,null));};exports[_0xc617('0x44')]=function(_0x218a42,_0x479637){return db[_0xc617('0x3b')][_0xc617('0x44')](_0x218a42[_0xc617('0x45')],{})[_0xc617('0x22')](respondWithResult(_0x479637,0xc9))[_0xc617('0x40')](handleError(_0x479637,null));};exports[_0xc617('0x21')]=function(_0xeee539,_0x1a6c34){if(_0xeee539[_0xc617('0x45')]['id']){delete _0xeee539[_0xc617('0x45')]['id'];}return db[_0xc617('0x3b')][_0xc617('0x46')]({'where':{'id':_0xeee539[_0xc617('0x42')]['id']}})[_0xc617('0x22')](handleEntityNotFound(_0x1a6c34,null))[_0xc617('0x22')](saveUpdates(_0xeee539['body'],null))[_0xc617('0x22')](respondWithResult(_0x1a6c34,null))['catch'](handleError(_0x1a6c34,null));};exports['destroy']=function(_0x699916,_0xa3cd19){return db[_0xc617('0x3b')][_0xc617('0x46')]({'where':{'id':_0x699916['params']['id']}})[_0xc617('0x22')](handleEntityNotFound(_0xa3cd19,null))[_0xc617('0x22')](removeEntity(_0xa3cd19,null))[_0xc617('0x40')](handleError(_0xa3cd19,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 7896da6..c9cedef 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 _0x4872=['integrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration'];(function(_0x48cac2,_0x483396){var _0xd2a59e=function(_0xbdac60){while(--_0xbdac60){_0x48cac2['push'](_0x48cac2['shift']());}};_0xd2a59e(++_0x483396);}(_0x4872,0x1d2));var _0x2487=function(_0x18a6b1,_0x55cfcb){_0x18a6b1=_0x18a6b1-0x0;var _0x5619c2=_0x4872[_0x18a6b1];return _0x5619c2;};'use strict';var _=require(_0x2487('0x0'));var util=require(_0x2487('0x1'));var logger=require(_0x2487('0x2'))(_0x2487('0x3'));var moment=require(_0x2487('0x4'));var BPromise=require(_0x2487('0x5'));var rp=require(_0x2487('0x6'));var fs=require('fs');var path=require(_0x2487('0x7'));var rimraf=require(_0x2487('0x8'));var config=require(_0x2487('0x9'));var attributes=require(_0x2487('0xa'));module[_0x2487('0xb')]=function(_0x1d6ce9,_0x3f24f1){return _0x1d6ce9[_0x2487('0xc')](_0x2487('0xd'),attributes,{'tableName':_0x2487('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44b5=['../../config/environment','./integration.attributes','define','Integration','integrations','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x12f7d1,_0xea85b3){var _0x17a408=function(_0x38e09a){while(--_0x38e09a){_0x12f7d1['push'](_0x12f7d1['shift']());}};_0x17a408(++_0xea85b3);}(_0x44b5,0x1d9));var _0x544b=function(_0x41aa5d,_0x171a81){_0x41aa5d=_0x41aa5d-0x0;var _0x546166=_0x44b5[_0x41aa5d];return _0x546166;};'use strict';var _=require('lodash');var util=require(_0x544b('0x0'));var logger=require(_0x544b('0x1'))(_0x544b('0x2'));var moment=require(_0x544b('0x3'));var BPromise=require(_0x544b('0x4'));var rp=require(_0x544b('0x5'));var fs=require('fs');var path=require(_0x544b('0x6'));var rimraf=require(_0x544b('0x7'));var config=require(_0x544b('0x8'));var attributes=require(_0x544b('0x9'));module['exports']=function(_0x3acadf,_0x12c101){return _0x3acadf[_0x544b('0xa')](_0x544b('0xb'),attributes,{'tableName':_0x544b('0xc'),'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 506ef26..f4fd9b2 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 _0x046b=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment','bluebird'];(function(_0x524c62,_0x3c094e){var _0x515b7a=function(_0x3dcc6c){while(--_0x3dcc6c){_0x524c62['push'](_0x524c62['shift']());}};_0x515b7a(++_0x3c094e);}(_0x046b,0x147));var _0xb046=function(_0x4f7d19,_0x2c91c7){_0x4f7d19=_0x4f7d19-0x0;var _0xfc8df4=_0x046b[_0x4f7d19];return _0xfc8df4;};'use strict';var _=require('lodash');var util=require(_0xb046('0x0'));var moment=require(_0xb046('0x1'));var BPromise=require(_0xb046('0x2'));var rs=require(_0xb046('0x3'));var fs=require('fs');var Redis=require(_0xb046('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb046('0x5'));var logger=require(_0xb046('0x6'))(_0xb046('0x7'));var config=require(_0xb046('0x8'));var jayson=require(_0xb046('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13203d,_0x1f00c8,_0x190c9a){return new BPromise(function(_0x308e79,_0x3c0678){return client[_0xb046('0xa')](_0x13203d,_0x190c9a)[_0xb046('0xb')](function(_0x170b66){logger['info'](_0xb046('0xc'),_0x1f00c8,'request\x20sent');logger[_0xb046('0xd')](_0xb046('0xe'),_0x1f00c8,_0xb046('0xf'),JSON[_0xb046('0x10')](_0x170b66));if(_0x170b66[_0xb046('0x11')]){if(_0x170b66['error']['code']===0x1f4){logger['error'](_0xb046('0xc'),_0x1f00c8,_0x170b66[_0xb046('0x11')]['message']);return _0x3c0678(_0x170b66[_0xb046('0x11')]['message']);}logger[_0xb046('0x11')](_0xb046('0xc'),_0x1f00c8,_0x170b66['error'][_0xb046('0x12')]);return _0x308e79(_0x170b66[_0xb046('0x11')][_0xb046('0x12')]);}else{logger[_0xb046('0x13')](_0xb046('0xc'),_0x1f00c8,'request\x20sent');_0x308e79(_0x170b66[_0xb046('0x14')][_0xb046('0x12')]);}})[_0xb046('0x15')](function(_0xa3b910){logger[_0xb046('0x11')](_0xb046('0xc'),_0x1f00c8,_0xa3b910);_0x3c0678(_0xa3b910);});});} \ No newline at end of file +var _0xbd50=['Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbd50,0x196));var _0x0bd5=function(_0x2de095,_0x801aff){_0x2de095=_0x2de095-0x0;var _0x1d9a32=_0xbd50[_0x2de095];return _0x1d9a32;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var moment=require(_0x0bd5('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bd5('0x3'));var fs=require('fs');var Redis=require(_0x0bd5('0x4'));var db=require(_0x0bd5('0x5'))['db'];var utils=require(_0x0bd5('0x6'));var logger=require(_0x0bd5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0bd5('0x8')][_0x0bd5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcc6cfa,_0x2c0db1,_0x1b99f3){return new BPromise(function(_0x5ebe64,_0x47e78d){return client[_0x0bd5('0xa')](_0xcc6cfa,_0x1b99f3)[_0x0bd5('0xb')](function(_0x259f4c){logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));logger['debug'](_0x0bd5('0xe'),_0x2c0db1,_0x0bd5('0xd'),JSON['stringify'](_0x259f4c));if(_0x259f4c[_0x0bd5('0xf')]){if(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x10')]===0x1f4){logger['error'](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);return _0x47e78d(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x259f4c[_0x0bd5('0xf')]['message']);return _0x5ebe64(_0x259f4c[_0x0bd5('0xf')][_0x0bd5('0x11')]);}else{logger['info'](_0x0bd5('0xc'),_0x2c0db1,_0x0bd5('0xd'));_0x5ebe64(_0x259f4c[_0x0bd5('0x12')][_0x0bd5('0x11')]);}})['catch'](function(_0x14f32c){logger[_0x0bd5('0xf')](_0x0bd5('0xc'),_0x2c0db1,_0x14f32c);_0x47e78d(_0x14f32c);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 53350f3..825ea51 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 _0xca7b=['Router','../../components/auth/service','../../config/environment','isAuthenticated','get','describe','/:id','show','create','put','update','delete','destroy','exports','path','connect-timeout'];(function(_0x122ca8,_0x49391a){var _0x59ecd3=function(_0x327ac2){while(--_0x327ac2){_0x122ca8['push'](_0x122ca8['shift']());}};_0x59ecd3(++_0x49391a);}(_0xca7b,0x14e));var _0xbca7=function(_0xfd37f6,_0x30732c){_0xfd37f6=_0xfd37f6-0x0;var _0x12b59c=_0xca7b[_0xfd37f6];return _0x12b59c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbca7('0x0'));var timeout=require(_0xbca7('0x1'));var express=require('express');var router=express[_0xbca7('0x2')]();var auth=require(_0xbca7('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xbca7('0x4'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0xbca7('0x5')](),controller['index']);router[_0xbca7('0x6')]('/describe',auth[_0xbca7('0x5')](),controller[_0xbca7('0x7')]);router[_0xbca7('0x6')](_0xbca7('0x8'),auth[_0xbca7('0x5')](),controller[_0xbca7('0x9')]);router['post']('/',auth[_0xbca7('0x5')](),controller[_0xbca7('0xa')]);router[_0xbca7('0xb')](_0xbca7('0x8'),auth['isAuthenticated'](),controller[_0xbca7('0xc')]);router[_0xbca7('0xd')]('/:id',auth[_0xbca7('0x5')](),controller[_0xbca7('0xe')]);module[_0xbca7('0xf')]=router; \ No newline at end of file +var _0xd099=['../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','put','update','multer','util','path','connect-timeout','Router'];(function(_0xad6d46,_0x3f6d68){var _0x1a12a9=function(_0x1d4b62){while(--_0x1d4b62){_0xad6d46['push'](_0xad6d46['shift']());}};_0x1a12a9(++_0x3f6d68);}(_0xd099,0x1bd));var _0x9d09=function(_0x16cb4b,_0x481b00){_0x16cb4b=_0x16cb4b-0x0;var _0x2e1bd8=_0xd099[_0x16cb4b];return _0x2e1bd8;};'use strict';var multer=require(_0x9d09('0x0'));var util=require(_0x9d09('0x1'));var path=require(_0x9d09('0x2'));var timeout=require(_0x9d09('0x3'));var express=require('express');var router=express[_0x9d09('0x4')]();var auth=require(_0x9d09('0x5'));var interaction=require(_0x9d09('0x6'));var config=require(_0x9d09('0x7'));var controller=require(_0x9d09('0x8'));router['get']('/',auth[_0x9d09('0x9')](),controller['index']);router[_0x9d09('0xa')](_0x9d09('0xb'),auth[_0x9d09('0x9')](),controller[_0x9d09('0xc')]);router['get'](_0x9d09('0xd'),auth['isAuthenticated'](),controller[_0x9d09('0xe')]);router[_0x9d09('0xf')]('/',auth[_0x9d09('0x9')](),controller['create']);router[_0x9d09('0x10')](_0x9d09('0xd'),auth[_0x9d09('0x9')](),controller[_0x9d09('0x11')]);router['delete'](_0x9d09('0xd'),auth[_0x9d09('0x9')](),controller['destroy']);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 6b55e2e..059c9b8 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 _0x710a=['SENDING','FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0xac005c,_0x416850){var _0x7ed863=function(_0x368604){while(--_0x368604){_0xac005c['push'](_0xac005c['shift']());}};_0x7ed863(++_0x416850);}(_0x710a,0xa4));var _0xa710=function(_0xf867a9,_0x552ab8){_0xf867a9=_0xf867a9-0x0;var _0x495f0c=_0x710a[_0xf867a9];return _0x495f0c;};'use strict';var Sequelize=require(_0xa710('0x0'));module['exports']={'integration':{'type':Sequelize[_0xa710('0x1')]},'eventChannel':{'type':Sequelize[_0xa710('0x1')]},'exitStatus':{'type':Sequelize[_0xa710('0x1')]},'ticketId':{'type':Sequelize[_0xa710('0x1')]},'integrationId':{'type':Sequelize[_0xa710('0x2')]},'contacts':{'type':Sequelize[_0xa710('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa710('0x1')]},'calleridname':{'type':Sequelize[_0xa710('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xa710('0x1')]},'membername':{'type':Sequelize[_0xa710('0x1')]},'agentcalledAt':{'type':Sequelize[_0xa710('0x3')]},'agentconnectAt':{'type':Sequelize[_0xa710('0x3')]},'holdtime':{'type':Sequelize[_0xa710('0x2')]},'agentcomplete':{'type':Sequelize[_0xa710('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xa710('0x3')]},'talktime':{'type':Sequelize[_0xa710('0x2')]},'agentacw':{'type':Sequelize[_0xa710('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xa710('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xa710('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xa710('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xa710('0x1')]},'channel':{'type':Sequelize[_0xa710('0x1')]},'channelstate':{'type':Sequelize[_0xa710('0x2')]},'channelstatedesc':{'type':Sequelize[_0xa710('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa710('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa710('0x1')]},'accountcode':{'type':Sequelize[_0xa710('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xa710('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xa710('0x1')]},'destchannelstate':{'type':Sequelize[_0xa710('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xa710('0x1')]},'destcalleridnum':{'type':Sequelize[_0xa710('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa710('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xa710('0x1')]},'destlanguage':{'type':Sequelize[_0xa710('0x1')]},'destaccountcode':{'type':Sequelize[_0xa710('0x1')]},'destcontext':{'type':Sequelize[_0xa710('0x1')]},'destexten':{'type':Sequelize[_0xa710('0x1')]},'destpriority':{'type':Sequelize[_0xa710('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xa710('0x1')]},'inReplyTo':{'type':Sequelize[_0xa710('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xa710('0x1')]},'to':{'type':Sequelize[_0xa710('0x1')]},'cc':{'type':Sequelize[_0xa710('0x1')]},'attachment':{'type':Sequelize[_0xa710('0x5')]},'html':{'type':Sequelize[_0xa710('0x5')]},'text':{'type':Sequelize[_0xa710('0x5')]},'status':{'type':Sequelize[_0xa710('0x6')]('SENT',_0xa710('0x7'),'RECEIVED',_0xa710('0x8'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xa710('0x1')]},'appdata':{'type':Sequelize[_0xa710('0x1')]},'projectId':{'type':Sequelize[_0xa710('0x2')]}}; \ No newline at end of file +var _0xa390=['ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x26c7bb,_0x4f432b){var _0x4a7bad=function(_0x50e727){while(--_0x50e727){_0x26c7bb['push'](_0x26c7bb['shift']());}};_0x4a7bad(++_0x4f432b);}(_0xa390,0xf7));var _0x0a39=function(_0x2730b7,_0x369f8b){_0x2730b7=_0x2730b7-0x0;var _0x28f1f4=_0xa390[_0x2730b7];return _0x28f1f4;};'use strict';var Sequelize=require(_0x0a39('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x0a39('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x0a39('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x0a39('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0a39('0x1')]},'queue':{'type':Sequelize[_0x0a39('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x0a39('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x0a39('0x2')]},'agentcomplete':{'type':Sequelize[_0x0a39('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x0a39('0x3')]},'talktime':{'type':Sequelize[_0x0a39('0x2')]},'agentacw':{'type':Sequelize[_0x0a39('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x0a39('0x2')]},'reason':{'type':Sequelize[_0x0a39('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x0a39('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x0a39('0x3')]},'agentdump':{'type':Sequelize[_0x0a39('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x0a39('0x3')]},'lastevent':{'type':Sequelize[_0x0a39('0x1')]},'channel':{'type':Sequelize[_0x0a39('0x1')]},'channelstate':{'type':Sequelize[_0x0a39('0x2')]},'channelstatedesc':{'type':Sequelize[_0x0a39('0x1')]},'connectedlinenum':{'type':Sequelize[_0x0a39('0x1')]},'connectedlinename':{'type':Sequelize[_0x0a39('0x1')]},'language':{'type':Sequelize[_0x0a39('0x1')]},'accountcode':{'type':Sequelize[_0x0a39('0x1')]},'context':{'type':Sequelize[_0x0a39('0x1')]},'exten':{'type':Sequelize[_0x0a39('0x1')]},'priority':{'type':Sequelize[_0x0a39('0x1')]},'destchannel':{'type':Sequelize[_0x0a39('0x1')]},'destchannelstate':{'type':Sequelize[_0x0a39('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x0a39('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x0a39('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x0a39('0x1')]},'destlanguage':{'type':Sequelize[_0x0a39('0x1')]},'destaccountcode':{'type':Sequelize[_0x0a39('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x0a39('0x1')]},'destpriority':{'type':Sequelize[_0x0a39('0x1')]},'destuniqueid':{'type':Sequelize[_0x0a39('0x1')]},'messageId':{'type':Sequelize[_0x0a39('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x0a39('0x1')]},'to':{'type':Sequelize[_0x0a39('0x1')]},'cc':{'type':Sequelize[_0x0a39('0x1')]},'attachment':{'type':Sequelize[_0x0a39('0x5')]},'html':{'type':Sequelize[_0x0a39('0x5')]},'text':{'type':Sequelize[_0x0a39('0x5')]},'status':{'type':Sequelize[_0x0a39('0x6')](_0x0a39('0x7'),_0x0a39('0x8'),_0x0a39('0x9'),_0x0a39('0xa'))},'url':{'type':Sequelize[_0x0a39('0x1')]},'app':{'type':Sequelize[_0x0a39('0x1')]},'appdata':{'type':Sequelize[_0x0a39('0x1')]},'projectId':{'type':Sequelize[_0x0a39('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 78f52b2..cacf32a 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 _0x4857=['fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','update','then','stack','name','send','index','IntegrationReport'];(function(_0x4ba380,_0x259bee){var _0x4b111b=function(_0x2bf227){while(--_0x2bf227){_0x4ba380['push'](_0x4ba380['shift']());}};_0x4b111b(++_0x259bee);}(_0x4857,0x183));var _0x7485=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x4857[_0x2b9b7f];return _0x4ed19a;};'use strict';var pdf=require(_0x7485('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7485('0x1'));var zipdir=require(_0x7485('0x2'));var jsonpatch=require(_0x7485('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7485('0x4'));var Mustache=require(_0x7485('0x5'));var util=require(_0x7485('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x7485('0x7'));var ejs=require(_0x7485('0x8'));var fs=require('fs');var _=require(_0x7485('0x9'));var squel=require(_0x7485('0xa'));var crypto=require(_0x7485('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7485('0xc'));var Papa=require(_0x7485('0xd'));var Redis=require(_0x7485('0xe'));var authService=require(_0x7485('0xf'));var qs=require(_0x7485('0x10'));var as=require(_0x7485('0x11'));var hardwareService=require(_0x7485('0x12'));var logger=require('../../config/logger')(_0x7485('0x13'));var utils=require(_0x7485('0x14'));var config=require(_0x7485('0x15'));var db=require(_0x7485('0x16'))['db'];function respondWithStatusCode(_0x27ffca,_0x3b5b5b){_0x3b5b5b=_0x3b5b5b||0xcc;return function(_0x5d8ace){if(_0x5d8ace){return _0x27ffca[_0x7485('0x17')](_0x3b5b5b);}return _0x27ffca[_0x7485('0x18')](_0x3b5b5b)[_0x7485('0x19')]();};}function respondWithResult(_0x2dcd41,_0x52d7e5){_0x52d7e5=_0x52d7e5||0xc8;return function(_0x5d2281){if(_0x5d2281){return _0x2dcd41[_0x7485('0x18')](_0x52d7e5)[_0x7485('0x1a')](_0x5d2281);}};}function respondWithFilteredResult(_0x58af74,_0x4d3fba){return function(_0x4b67cc){if(_0x4b67cc){var _0x238f24=_0x4b67cc[_0x7485('0x1b')],_0x51465d=_0x4d3fba[_0x7485('0x1c')],_0x99d7d3=_0x4d3fba[_0x7485('0x1c')]+_0x4d3fba['limit'],_0xe2dcde;if(_0x99d7d3>=_0x238f24){_0x99d7d3=_0x238f24;_0xe2dcde=0xc8;}else{_0xe2dcde=0xce;}_0x58af74['status'](_0xe2dcde);return _0x58af74[_0x7485('0x1d')](_0x7485('0x1e'),_0x51465d+'-'+_0x99d7d3+'/'+_0x238f24)[_0x7485('0x1a')](_0x4b67cc);}return null;};}function patchUpdates(_0x446419){return function(_0x346f50){try{jsonpatch[_0x7485('0x1f')](_0x346f50,_0x446419,!![]);}catch(_0x5a92ab){return BPromise['reject'](_0x5a92ab);}return _0x346f50['save']();};}function saveUpdates(_0x55db2f,_0xdc104d){return function(_0x54aba9){if(_0x54aba9){return _0x54aba9[_0x7485('0x20')](_0x55db2f)[_0x7485('0x21')](function(_0x29cf6d){return _0x29cf6d;});}return null;};}function removeEntity(_0x5e9d8e,_0x248327){return function(_0x215c7a){if(_0x215c7a){return _0x215c7a['destroy']()[_0x7485('0x21')](function(){_0x5e9d8e[_0x7485('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46567d,_0x38dba3){return function(_0x2bb7bb){if(!_0x2bb7bb){_0x46567d[_0x7485('0x17')](0x194);}return _0x2bb7bb;};}function handleError(_0xf1be97,_0x3c0704){_0x3c0704=_0x3c0704||0x1f4;return function(_0x51836a){logger['error'](_0x51836a[_0x7485('0x22')]);if(_0x51836a[_0x7485('0x23')]){delete _0x51836a['name'];}_0xf1be97[_0x7485('0x18')](_0x3c0704)[_0x7485('0x24')](_0x51836a);};}exports[_0x7485('0x25')]=function(_0x321f52,_0x38c238){var _0xd188ec={},_0x4646ab={},_0xb31747={'count':0x0,'rows':[]};var _0x2edb62=_['map'](db[_0x7485('0x26')]['rawAttributes'],function(_0x51399e){return{'name':_0x51399e[_0x7485('0x27')],'type':_0x51399e[_0x7485('0x28')][_0x7485('0x29')]};});_0x4646ab[_0x7485('0x2a')]=_[_0x7485('0x2b')](_0x2edb62,_0x7485('0x23'));_0x4646ab[_0x7485('0x2c')]=_[_0x7485('0x2d')](_0x321f52[_0x7485('0x2c')]);_0x4646ab[_0x7485('0x2e')]=_[_0x7485('0x2f')](_0x4646ab['model'],_0x4646ab[_0x7485('0x2c')]);_0xd188ec['attributes']=_[_0x7485('0x2f')](_0x4646ab['model'],qs[_0x7485('0x30')](_0x321f52['query'][_0x7485('0x30')]));_0xd188ec['attributes']=_0xd188ec[_0x7485('0x31')][_0x7485('0x32')]?_0xd188ec[_0x7485('0x31')]:_0x4646ab[_0x7485('0x2a')];if(!_0x321f52[_0x7485('0x2c')][_0x7485('0x33')](_0x7485('0x34'))){_0xd188ec[_0x7485('0x35')]=qs['limit'](_0x321f52[_0x7485('0x2c')][_0x7485('0x35')]);_0xd188ec[_0x7485('0x1c')]=qs[_0x7485('0x1c')](_0x321f52[_0x7485('0x2c')][_0x7485('0x1c')]);}_0xd188ec['order']=qs[_0x7485('0x36')](_0x321f52[_0x7485('0x2c')][_0x7485('0x36')]);_0xd188ec[_0x7485('0x37')]=qs[_0x7485('0x2e')](_[_0x7485('0x38')](_0x321f52[_0x7485('0x2c')],_0x4646ab[_0x7485('0x2e')]),_0x2edb62);if(_0x321f52[_0x7485('0x2c')][_0x7485('0x39')]){_0xd188ec[_0x7485('0x37')]=_['merge'](_0xd188ec['where'],{'$or':_['map'](_0x2edb62,function(_0x36a691){if(_0x36a691[_0x7485('0x28')]!=='VIRTUAL'){var _0x31faad={};_0x31faad[_0x36a691[_0x7485('0x23')]]={'$like':'%'+_0x321f52[_0x7485('0x2c')][_0x7485('0x39')]+'%'};return _0x31faad;}})});}_0xd188ec=_[_0x7485('0x3a')]({},_0xd188ec,_0x321f52['options']);var _0x47b705={'where':_0xd188ec[_0x7485('0x37')]};return db[_0x7485('0x26')][_0x7485('0x1b')](_0x47b705)[_0x7485('0x21')](function(_0x286019){_0xb31747[_0x7485('0x1b')]=_0x286019;if(_0x321f52[_0x7485('0x2c')]['includeAll']){_0xd188ec[_0x7485('0x3b')]=[{'all':!![]}];}return db['IntegrationReport'][_0x7485('0x3c')](_0xd188ec);})[_0x7485('0x21')](function(_0x592bd5){_0xb31747[_0x7485('0x3d')]=_0x592bd5;return _0xb31747;})['then'](respondWithFilteredResult(_0x38c238,_0xd188ec))[_0x7485('0x3e')](handleError(_0x38c238,null));};exports[_0x7485('0x3f')]=function(_0x4a31f4,_0x516fcc){var _0x16ba49={'raw':![],'where':{'id':_0x4a31f4[_0x7485('0x40')]['id']}},_0x475b20={};_0x475b20[_0x7485('0x2a')]=_[_0x7485('0x2d')](db['IntegrationReport']['rawAttributes']);_0x475b20[_0x7485('0x2c')]=_[_0x7485('0x2d')](_0x4a31f4['query']);_0x475b20['filters']=_[_0x7485('0x2f')](_0x475b20['model'],_0x475b20[_0x7485('0x2c')]);_0x16ba49[_0x7485('0x31')]=_[_0x7485('0x2f')](_0x475b20[_0x7485('0x2a')],qs[_0x7485('0x30')](_0x4a31f4['query'][_0x7485('0x30')]));_0x16ba49[_0x7485('0x31')]=_0x16ba49[_0x7485('0x31')][_0x7485('0x32')]?_0x16ba49[_0x7485('0x31')]:_0x475b20['model'];if(_0x4a31f4[_0x7485('0x2c')][_0x7485('0x41')]){_0x16ba49[_0x7485('0x3b')]=[{'all':!![]}];}_0x16ba49=_['merge']({},_0x16ba49,_0x4a31f4[_0x7485('0x42')]);return db[_0x7485('0x26')][_0x7485('0x43')](_0x16ba49)['then'](handleEntityNotFound(_0x516fcc,null))[_0x7485('0x21')](respondWithResult(_0x516fcc,null))['catch'](handleError(_0x516fcc,null));};exports['create']=function(_0x550b5f,_0xf4d848){return db[_0x7485('0x26')][_0x7485('0x44')](_0x550b5f[_0x7485('0x45')],{})['then'](respondWithResult(_0xf4d848,0xc9))['catch'](handleError(_0xf4d848,null));};exports['update']=function(_0x581e31,_0x4ae9cd){if(_0x581e31['body']['id']){delete _0x581e31[_0x7485('0x45')]['id'];}return db[_0x7485('0x26')]['find']({'where':{'id':_0x581e31[_0x7485('0x40')]['id']}})[_0x7485('0x21')](handleEntityNotFound(_0x4ae9cd,null))[_0x7485('0x21')](saveUpdates(_0x581e31[_0x7485('0x45')],null))['then'](respondWithResult(_0x4ae9cd,null))['catch'](handleError(_0x4ae9cd,null));};exports['destroy']=function(_0x212057,_0x8d98bb){return db[_0x7485('0x26')][_0x7485('0x43')]({'where':{'id':_0x212057[_0x7485('0x40')]['id']}})[_0x7485('0x21')](handleEntityNotFound(_0x8d98bb,null))[_0x7485('0x21')](removeEntity(_0x8d98bb,null))['catch'](handleError(_0x8d98bb,null));};exports[_0x7485('0x46')]=function(_0x4f36ef,_0xa17180){return db[_0x7485('0x26')][_0x7485('0x46')]()[_0x7485('0x21')](respondWithResult(_0xa17180,null))['catch'](handleError(_0xa17180,null));}; \ No newline at end of file +var _0xd619=['html-pdf','eml-format','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','offset','limit','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','IntegrationReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','count','includeAll','include','findAll','rows','rawAttributes','options','catch','create','body','find','params','describe'];(function(_0x1fb1c1,_0x4ebe69){var _0x1622df=function(_0x52b793){while(--_0x52b793){_0x1fb1c1['push'](_0x1fb1c1['shift']());}};_0x1622df(++_0x4ebe69);}(_0xd619,0x1f1));var _0x9d61=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xd619[_0x599f41];return _0x2e4d58;};'use strict';var pdf=require(_0x9d61('0x0'));var emlformat=require(_0x9d61('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9d61('0x2'));var BPromise=require(_0x9d61('0x3'));var Mustache=require(_0x9d61('0x4'));var util=require('util');var path=require('path');var sox=require(_0x9d61('0x5'));var csv=require('to-csv');var ejs=require(_0x9d61('0x6'));var fs=require('fs');var _=require(_0x9d61('0x7'));var squel=require(_0x9d61('0x8'));var crypto=require(_0x9d61('0x9'));var jsforce=require(_0x9d61('0xa'));var deskjs=require(_0x9d61('0xb'));var toCsv=require(_0x9d61('0xc'));var querystring=require(_0x9d61('0xd'));var Papa=require(_0x9d61('0xe'));var Redis=require(_0x9d61('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9d61('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d61('0x11'));var logger=require('../../config/logger')(_0x9d61('0x12'));var utils=require(_0x9d61('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x484bbc,_0x19d774){_0x19d774=_0x19d774||0xcc;return function(_0x4e87d0){if(_0x4e87d0){return _0x484bbc[_0x9d61('0x14')](_0x19d774);}return _0x484bbc[_0x9d61('0x15')](_0x19d774)['end']();};}function respondWithResult(_0x4cbe2f,_0x219c61){_0x219c61=_0x219c61||0xc8;return function(_0x2c5c19){if(_0x2c5c19){return _0x4cbe2f[_0x9d61('0x15')](_0x219c61)[_0x9d61('0x16')](_0x2c5c19);}};}function respondWithFilteredResult(_0x94baaa,_0x251b80){return function(_0x359ed5){if(_0x359ed5){var _0x40478e=_0x359ed5['count'],_0x959292=_0x251b80[_0x9d61('0x17')],_0x5509c9=_0x251b80[_0x9d61('0x17')]+_0x251b80[_0x9d61('0x18')],_0x2fd07b;if(_0x5509c9>=_0x40478e){_0x5509c9=_0x40478e;_0x2fd07b=0xc8;}else{_0x2fd07b=0xce;}_0x94baaa[_0x9d61('0x15')](_0x2fd07b);return _0x94baaa[_0x9d61('0x19')]('Content-Range',_0x959292+'-'+_0x5509c9+'/'+_0x40478e)[_0x9d61('0x16')](_0x359ed5);}return null;};}function patchUpdates(_0xde1507){return function(_0x5ec76f){try{jsonpatch[_0x9d61('0x1a')](_0x5ec76f,_0xde1507,!![]);}catch(_0x499455){return BPromise[_0x9d61('0x1b')](_0x499455);}return _0x5ec76f[_0x9d61('0x1c')]();};}function saveUpdates(_0x4adaf9,_0x10267e){return function(_0x458a98){if(_0x458a98){return _0x458a98[_0x9d61('0x1d')](_0x4adaf9)[_0x9d61('0x1e')](function(_0x239a06){return _0x239a06;});}return null;};}function removeEntity(_0x378aae,_0x24b73d){return function(_0x566a18){if(_0x566a18){return _0x566a18[_0x9d61('0x1f')]()[_0x9d61('0x1e')](function(){_0x378aae[_0x9d61('0x15')](0xcc)[_0x9d61('0x20')]();});}};}function handleEntityNotFound(_0x187dee,_0x2e33b8){return function(_0x22b725){if(!_0x22b725){_0x187dee[_0x9d61('0x14')](0x194);}return _0x22b725;};}function handleError(_0x58a3b8,_0x11f666){_0x11f666=_0x11f666||0x1f4;return function(_0x18dadc){logger[_0x9d61('0x21')](_0x18dadc[_0x9d61('0x22')]);if(_0x18dadc[_0x9d61('0x23')]){delete _0x18dadc['name'];}_0x58a3b8[_0x9d61('0x15')](_0x11f666)[_0x9d61('0x24')](_0x18dadc);};}exports[_0x9d61('0x25')]=function(_0x398b5f,_0x5cebe7){var _0x2b2c2b={},_0x3d7068={},_0x21b041={'count':0x0,'rows':[]};var _0x268e11=_['map'](db[_0x9d61('0x26')]['rawAttributes'],function(_0x49aceb){return{'name':_0x49aceb[_0x9d61('0x27')],'type':_0x49aceb[_0x9d61('0x28')]['key']};});_0x3d7068[_0x9d61('0x29')]=_['map'](_0x268e11,_0x9d61('0x23'));_0x3d7068[_0x9d61('0x2a')]=_[_0x9d61('0x2b')](_0x398b5f[_0x9d61('0x2a')]);_0x3d7068[_0x9d61('0x2c')]=_[_0x9d61('0x2d')](_0x3d7068['model'],_0x3d7068[_0x9d61('0x2a')]);_0x2b2c2b[_0x9d61('0x2e')]=_['intersection'](_0x3d7068[_0x9d61('0x29')],qs[_0x9d61('0x2f')](_0x398b5f[_0x9d61('0x2a')][_0x9d61('0x2f')]));_0x2b2c2b[_0x9d61('0x2e')]=_0x2b2c2b[_0x9d61('0x2e')][_0x9d61('0x30')]?_0x2b2c2b[_0x9d61('0x2e')]:_0x3d7068[_0x9d61('0x29')];if(!_0x398b5f[_0x9d61('0x2a')][_0x9d61('0x31')]('nolimit')){_0x2b2c2b[_0x9d61('0x18')]=qs[_0x9d61('0x18')](_0x398b5f[_0x9d61('0x2a')][_0x9d61('0x18')]);_0x2b2c2b[_0x9d61('0x17')]=qs[_0x9d61('0x17')](_0x398b5f['query'][_0x9d61('0x17')]);}_0x2b2c2b[_0x9d61('0x32')]=qs[_0x9d61('0x33')](_0x398b5f[_0x9d61('0x2a')][_0x9d61('0x33')]);_0x2b2c2b[_0x9d61('0x34')]=qs['filters'](_[_0x9d61('0x35')](_0x398b5f[_0x9d61('0x2a')],_0x3d7068[_0x9d61('0x2c')]),_0x268e11);if(_0x398b5f[_0x9d61('0x2a')][_0x9d61('0x36')]){_0x2b2c2b[_0x9d61('0x34')]=_[_0x9d61('0x37')](_0x2b2c2b[_0x9d61('0x34')],{'$or':_[_0x9d61('0x38')](_0x268e11,function(_0x23377c){if(_0x23377c[_0x9d61('0x28')]!==_0x9d61('0x39')){var _0x46b37b={};_0x46b37b[_0x23377c['name']]={'$like':'%'+_0x398b5f[_0x9d61('0x2a')]['filter']+'%'};return _0x46b37b;}})});}_0x2b2c2b=_[_0x9d61('0x37')]({},_0x2b2c2b,_0x398b5f['options']);var _0xaf6fb3={'where':_0x2b2c2b[_0x9d61('0x34')]};return db[_0x9d61('0x26')][_0x9d61('0x3a')](_0xaf6fb3)[_0x9d61('0x1e')](function(_0x4e06ed){_0x21b041[_0x9d61('0x3a')]=_0x4e06ed;if(_0x398b5f[_0x9d61('0x2a')][_0x9d61('0x3b')]){_0x2b2c2b[_0x9d61('0x3c')]=[{'all':!![]}];}return db[_0x9d61('0x26')][_0x9d61('0x3d')](_0x2b2c2b);})[_0x9d61('0x1e')](function(_0x2e519b){_0x21b041[_0x9d61('0x3e')]=_0x2e519b;return _0x21b041;})[_0x9d61('0x1e')](respondWithFilteredResult(_0x5cebe7,_0x2b2c2b))['catch'](handleError(_0x5cebe7,null));};exports['show']=function(_0x60f7a6,_0x5655d7){var _0x147e86={'raw':![],'where':{'id':_0x60f7a6['params']['id']}},_0x18e0f4={};_0x18e0f4[_0x9d61('0x29')]=_[_0x9d61('0x2b')](db[_0x9d61('0x26')][_0x9d61('0x3f')]);_0x18e0f4[_0x9d61('0x2a')]=_[_0x9d61('0x2b')](_0x60f7a6[_0x9d61('0x2a')]);_0x18e0f4[_0x9d61('0x2c')]=_[_0x9d61('0x2d')](_0x18e0f4[_0x9d61('0x29')],_0x18e0f4[_0x9d61('0x2a')]);_0x147e86[_0x9d61('0x2e')]=_['intersection'](_0x18e0f4[_0x9d61('0x29')],qs[_0x9d61('0x2f')](_0x60f7a6[_0x9d61('0x2a')][_0x9d61('0x2f')]));_0x147e86['attributes']=_0x147e86[_0x9d61('0x2e')][_0x9d61('0x30')]?_0x147e86[_0x9d61('0x2e')]:_0x18e0f4[_0x9d61('0x29')];if(_0x60f7a6['query'][_0x9d61('0x3b')]){_0x147e86[_0x9d61('0x3c')]=[{'all':!![]}];}_0x147e86=_[_0x9d61('0x37')]({},_0x147e86,_0x60f7a6[_0x9d61('0x40')]);return db[_0x9d61('0x26')]['find'](_0x147e86)[_0x9d61('0x1e')](handleEntityNotFound(_0x5655d7,null))['then'](respondWithResult(_0x5655d7,null))[_0x9d61('0x41')](handleError(_0x5655d7,null));};exports['create']=function(_0x47c1c,_0x2f5ee4){return db[_0x9d61('0x26')][_0x9d61('0x42')](_0x47c1c[_0x9d61('0x43')],{})['then'](respondWithResult(_0x2f5ee4,0xc9))['catch'](handleError(_0x2f5ee4,null));};exports[_0x9d61('0x1d')]=function(_0x4fd95b,_0x100b32){if(_0x4fd95b[_0x9d61('0x43')]['id']){delete _0x4fd95b[_0x9d61('0x43')]['id'];}return db[_0x9d61('0x26')][_0x9d61('0x44')]({'where':{'id':_0x4fd95b[_0x9d61('0x45')]['id']}})[_0x9d61('0x1e')](handleEntityNotFound(_0x100b32,null))[_0x9d61('0x1e')](saveUpdates(_0x4fd95b[_0x9d61('0x43')],null))[_0x9d61('0x1e')](respondWithResult(_0x100b32,null))['catch'](handleError(_0x100b32,null));};exports['destroy']=function(_0x51e9fe,_0x2184d6){return db[_0x9d61('0x26')][_0x9d61('0x44')]({'where':{'id':_0x51e9fe['params']['id']}})[_0x9d61('0x1e')](handleEntityNotFound(_0x2184d6,null))[_0x9d61('0x1e')](removeEntity(_0x2184d6,null))[_0x9d61('0x41')](handleError(_0x2184d6,null));};exports[_0x9d61('0x46')]=function(_0x2a0f09,_0x538b09){return db[_0x9d61('0x26')][_0x9d61('0x46')]()[_0x9d61('0x1e')](respondWithResult(_0x538b09,null))[_0x9d61('0x41')](handleError(_0x538b09,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 768778d..01a0e62 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 _0xf65a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','define','IntegrationReport','report_integration','lodash','util','../../config/logger'];(function(_0x8e1e89,_0x396be9){var _0x411cbd=function(_0x47aaad){while(--_0x47aaad){_0x8e1e89['push'](_0x8e1e89['shift']());}};_0x411cbd(++_0x396be9);}(_0xf65a,0xb3));var _0xaf65=function(_0x5ebd7d,_0x208107){_0x5ebd7d=_0x5ebd7d-0x0;var _0x258ac3=_0xf65a[_0x5ebd7d];return _0x258ac3;};'use strict';var _=require(_0xaf65('0x0'));var util=require(_0xaf65('0x1'));var logger=require(_0xaf65('0x2'))('api');var moment=require(_0xaf65('0x3'));var BPromise=require(_0xaf65('0x4'));var rp=require(_0xaf65('0x5'));var fs=require('fs');var path=require(_0xaf65('0x6'));var rimraf=require(_0xaf65('0x7'));var config=require(_0xaf65('0x8'));var attributes=require(_0xaf65('0x9'));module['exports']=function(_0x29704e,_0x42dde8){return _0x29704e[_0xaf65('0xa')](_0xaf65('0xb'),attributes,{'tableName':_0xaf65('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04aa=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','lodash','util'];(function(_0x1ed513,_0x3d0381){var _0x250dc6=function(_0x2ac936){while(--_0x2ac936){_0x1ed513['push'](_0x1ed513['shift']());}};_0x250dc6(++_0x3d0381);}(_0x04aa,0x8d));var _0xa04a=function(_0x267092,_0x177b40){_0x267092=_0x267092-0x0;var _0xb37392=_0x04aa[_0x267092];return _0xb37392;};'use strict';var _=require(_0xa04a('0x0'));var util=require(_0xa04a('0x1'));var logger=require(_0xa04a('0x2'))(_0xa04a('0x3'));var moment=require(_0xa04a('0x4'));var BPromise=require(_0xa04a('0x5'));var rp=require(_0xa04a('0x6'));var fs=require('fs');var path=require(_0xa04a('0x7'));var rimraf=require(_0xa04a('0x8'));var config=require(_0xa04a('0x9'));var attributes=require(_0xa04a('0xa'));module[_0xa04a('0xb')]=function(_0x4a3a5b,_0x3be790){return _0x4a3a5b[_0xa04a('0xc')]('IntegrationReport',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 e7a4501..69d9510 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 _0x0b0e=['IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','debug'];(function(_0x2b6600,_0x24c497){var _0x912ee2=function(_0x5d6484){while(--_0x5d6484){_0x2b6600['push'](_0x2b6600['shift']());}};_0x912ee2(++_0x24c497);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0x0b0e[_0x1064bc];return _0x5edc45;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file +var _0x0b0e=['IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','debug'];(function(_0x4d79bc,_0x32c905){var _0x4b4760=function(_0x212302){while(--_0x212302){_0x4d79bc['push'](_0x4d79bc['shift']());}};_0x4b4760(++_0x32c905);}(_0x0b0e,0x187));var _0xe0b0=function(_0x41c88c,_0x381f8d){_0x41c88c=_0x41c88c-0x0;var _0x2c97ea=_0x0b0e[_0x41c88c];return _0x2c97ea;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 706abf1..f5bfa7f 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 _0x34e8=['./interval.controller','get','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','/:id','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2a1beb,_0x214c96){var _0x3be902=function(_0x216b83){while(--_0x216b83){_0x2a1beb['push'](_0x2a1beb['shift']());}};_0x3be902(++_0x214c96);}(_0x34e8,0x12c));var _0x834e=function(_0x3bcf14,_0x58d096){_0x3bcf14=_0x3bcf14-0x0;var _0x250307=_0x34e8[_0x3bcf14];return _0x250307;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0x9')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0xe')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0x10')]);router[_0x834e('0xe')](_0x834e('0x11'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);router['put'](_0x834e('0x13'),auth[_0x834e('0xa')](),controller['update']);router[_0x834e('0x14')](_0x834e('0x13'),auth[_0x834e('0xa')](),controller[_0x834e('0x15')]);module['exports']=router; \ No newline at end of file +var _0x34e8=['./interval.controller','get','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','/:id','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1b9f3a,_0x43ff84){var _0x1c7c64=function(_0x29ebc9){while(--_0x29ebc9){_0x1b9f3a['push'](_0x1b9f3a['shift']());}};_0x1c7c64(++_0x43ff84);}(_0x34e8,0x12c));var _0x834e=function(_0x5deefe,_0x3e83e1){_0x5deefe=_0x5deefe-0x0;var _0x11f269=_0x34e8[_0x5deefe];return _0x11f269;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0x9')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0xe')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0x10')]);router[_0x834e('0xe')](_0x834e('0x11'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);router['put'](_0x834e('0x13'),auth[_0x834e('0xa')](),controller['update']);router[_0x834e('0x14')](_0x834e('0x13'),auth[_0x834e('0xa')](),controller[_0x834e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index f0e1c93..873451e 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 _0x0048=['sequelize','STRING'];(function(_0x240452,_0x1eec5e){var _0x2fce2c=function(_0x39da77){while(--_0x39da77){_0x240452['push'](_0x240452['shift']());}};_0x2fce2c(++_0x1eec5e);}(_0x0048,0xba));var _0x8004=function(_0x51679b,_0x2d621c){_0x51679b=_0x51679b-0x0;var _0x4085f3=_0x0048[_0x51679b];return _0x4085f3;};'use strict';var Sequelize=require(_0x8004('0x0'));module['exports']={'name':{'type':Sequelize[_0x8004('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8004('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xf411=['exports','STRING'];(function(_0x10e5ff,_0x5eabdb){var _0xf66a50=function(_0x3da0b3){while(--_0x3da0b3){_0x10e5ff['push'](_0x10e5ff['shift']());}};_0xf66a50(++_0x5eabdb);}(_0xf411,0x16e));var _0x1f41=function(_0x2290d4,_0x43d284){_0x2290d4=_0x2290d4-0x0;var _0x1f68ee=_0xf411[_0x2290d4];return _0x1f68ee;};'use strict';var Sequelize=require('sequelize');module[_0x1f41('0x0')]={'name':{'type':Sequelize[_0x1f41('0x1')]},'description':{'type':Sequelize[_0x1f41('0x1')]},'interval':{'type':Sequelize[_0x1f41('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index c0b4b55..b872395 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 _0x04eb=['../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','get','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','Interval','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','IntervalId','getIntervals','findOne','hasOwnProperty','nolimit','addIntervals','sequelize','transaction','bulkCreate','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x9f6405,_0x86d4a5){var _0x47dc09=function(_0x364fd0){while(--_0x364fd0){_0x9f6405['push'](_0x9f6405['shift']());}};_0x47dc09(++_0x86d4a5);}(_0x04eb,0x1c9));var _0xb04e=function(_0x5bbf02,_0x3712f2){_0x5bbf02=_0x5bbf02-0x0;var _0x5159cb=_0x04eb[_0x5bbf02];return _0x5159cb;};'use strict';var pdf=require(_0xb04e('0x0'));var emlformat=require(_0xb04e('0x1'));var rimraf=require(_0xb04e('0x2'));var zipdir=require(_0xb04e('0x3'));var jsonpatch=require(_0xb04e('0x4'));var rp=require(_0xb04e('0x5'));var moment=require(_0xb04e('0x6'));var BPromise=require(_0xb04e('0x7'));var Mustache=require(_0xb04e('0x8'));var util=require(_0xb04e('0x9'));var path=require(_0xb04e('0xa'));var sox=require('sox');var csv=require(_0xb04e('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb04e('0xc'));var squel=require(_0xb04e('0xd'));var crypto=require(_0xb04e('0xe'));var jsforce=require(_0xb04e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb04e('0xb'));var querystring=require('querystring');var Papa=require(_0xb04e('0x10'));var Redis=require(_0xb04e('0x11'));var authService=require(_0xb04e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb04e('0x13'));var hardwareService=require(_0xb04e('0x14'));var logger=require(_0xb04e('0x15'))(_0xb04e('0x16'));var utils=require(_0xb04e('0x17'));var config=require(_0xb04e('0x18'));var db=require(_0xb04e('0x19'))['db'];var extensions=require(_0xb04e('0x1a'));function respondWithStatusCode(_0x4f1e9a,_0xe8d1fa){_0xe8d1fa=_0xe8d1fa||0xcc;return function(_0x466a99){if(_0x466a99){return _0x4f1e9a[_0xb04e('0x1b')](_0xe8d1fa);}return _0x4f1e9a['status'](_0xe8d1fa)[_0xb04e('0x1c')]();};}function respondWithResult(_0x18af9a,_0x9d15ff){_0x9d15ff=_0x9d15ff||0xc8;return function(_0x6a3eaf){if(_0x6a3eaf){return _0x18af9a[_0xb04e('0x1d')](_0x9d15ff)['json'](_0x6a3eaf);}};}function respondWithFilteredResult(_0x3e04e0,_0x356f6f){return function(_0x1c3b8b){if(_0x1c3b8b){var _0x97a6c=_0x1c3b8b[_0xb04e('0x1e')],_0x57ff4c=_0x356f6f[_0xb04e('0x1f')],_0x53c697=_0x356f6f[_0xb04e('0x1f')]+_0x356f6f['limit'],_0x475eb1;if(_0x53c697>=_0x97a6c){_0x53c697=_0x97a6c;_0x475eb1=0xc8;}else{_0x475eb1=0xce;}_0x3e04e0[_0xb04e('0x1d')](_0x475eb1);return _0x3e04e0[_0xb04e('0x20')](_0xb04e('0x21'),_0x57ff4c+'-'+_0x53c697+'/'+_0x97a6c)[_0xb04e('0x22')](_0x1c3b8b);}return null;};}function patchUpdates(_0x14299a){return function(_0x77ccc3){try{jsonpatch[_0xb04e('0x23')](_0x77ccc3,_0x14299a,!![]);}catch(_0xda72ff){return BPromise[_0xb04e('0x24')](_0xda72ff);}return _0x77ccc3['save']();};}function saveUpdates(_0x3a25a2,_0x2ebbc3){return function(_0x39aaa1){if(_0x39aaa1){return _0x39aaa1[_0xb04e('0x25')](_0x3a25a2)[_0xb04e('0x26')](function(_0x3b22c0){return _0x3b22c0;});}return null;};}function removeEntity(_0x2394b9,_0x29353c){return function(_0x4eda4e){if(_0x4eda4e){return _0x4eda4e[_0xb04e('0x27')]()[_0xb04e('0x26')](function(){var _0x285d84=_0x4eda4e[_0xb04e('0x28')]({'plain':!![]});var _0x43e8a5='Intervals';return db['UserProfileResource'][_0xb04e('0x27')]({'where':{'type':_0x43e8a5,'resourceId':_0x285d84['id']}})['then'](function(){return _0x4eda4e;});})['then'](function(){_0x2394b9[_0xb04e('0x1d')](0xcc)[_0xb04e('0x1c')]();});}};}function handleEntityNotFound(_0x315398,_0x345bc9){return function(_0x23fd6b){if(!_0x23fd6b){_0x315398[_0xb04e('0x1b')](0x194);}return _0x23fd6b;};}function handleError(_0x2823d4,_0x554a21){_0x554a21=_0x554a21||0x1f4;return function(_0x33f3e1){logger[_0xb04e('0x29')](_0x33f3e1[_0xb04e('0x2a')]);if(_0x33f3e1[_0xb04e('0x2b')]){delete _0x33f3e1[_0xb04e('0x2b')];}_0x2823d4['status'](_0x554a21)[_0xb04e('0x2c')](_0x33f3e1);};}exports[_0xb04e('0x2d')]=function(_0x220e6f,_0x36e69b){var _0x4e4d60={},_0x233956={},_0x2949c2={'count':0x0,'rows':[]};var _0x5d6e77=_[_0xb04e('0x2e')](db['Interval'][_0xb04e('0x2f')],function(_0x131b0d){return{'name':_0x131b0d[_0xb04e('0x30')],'type':_0x131b0d[_0xb04e('0x31')]['key']};});_0x233956[_0xb04e('0x32')]=_[_0xb04e('0x2e')](_0x5d6e77,_0xb04e('0x2b'));_0x233956[_0xb04e('0x33')]=_[_0xb04e('0x34')](_0x220e6f[_0xb04e('0x33')]);_0x233956[_0xb04e('0x35')]=_['intersection'](_0x233956[_0xb04e('0x32')],_0x233956['query']);_0x4e4d60['attributes']=_[_0xb04e('0x36')](_0x233956[_0xb04e('0x32')],qs['fields'](_0x220e6f[_0xb04e('0x33')][_0xb04e('0x37')]));_0x4e4d60[_0xb04e('0x38')]=_0x4e4d60[_0xb04e('0x38')][_0xb04e('0x39')]?_0x4e4d60[_0xb04e('0x38')]:_0x233956[_0xb04e('0x32')];if(!_0x220e6f[_0xb04e('0x33')]['hasOwnProperty']('nolimit')){_0x4e4d60['limit']=qs['limit'](_0x220e6f[_0xb04e('0x33')][_0xb04e('0x3a')]);_0x4e4d60[_0xb04e('0x1f')]=qs[_0xb04e('0x1f')](_0x220e6f['query']['offset']);}_0x4e4d60[_0xb04e('0x3b')]=qs['sort'](_0x220e6f[_0xb04e('0x33')][_0xb04e('0x3c')]);_0x4e4d60[_0xb04e('0x3d')]=qs[_0xb04e('0x35')](_[_0xb04e('0x3e')](_0x220e6f[_0xb04e('0x33')],_0x233956[_0xb04e('0x35')]),_0x5d6e77);if(_0x220e6f[_0xb04e('0x33')][_0xb04e('0x3f')]){_0x4e4d60[_0xb04e('0x3d')]=_[_0xb04e('0x40')](_0x4e4d60[_0xb04e('0x3d')],{'$or':_[_0xb04e('0x2e')](_0x5d6e77,function(_0x114b6e){if(_0x114b6e[_0xb04e('0x31')]!==_0xb04e('0x41')){var _0xa03960={};_0xa03960[_0x114b6e[_0xb04e('0x2b')]]={'$like':'%'+_0x220e6f[_0xb04e('0x33')][_0xb04e('0x3f')]+'%'};return _0xa03960;}})});}_0x4e4d60=_[_0xb04e('0x40')]({},_0x4e4d60,_0x220e6f[_0xb04e('0x42')]);var _0x14b819={'where':_0x4e4d60['where']};return db[_0xb04e('0x43')][_0xb04e('0x1e')](_0x14b819)[_0xb04e('0x26')](function(_0x1c7071){_0x2949c2[_0xb04e('0x1e')]=_0x1c7071;if(_0x220e6f[_0xb04e('0x33')][_0xb04e('0x44')]){_0x4e4d60[_0xb04e('0x45')]=[{'all':!![]}];}return db[_0xb04e('0x43')][_0xb04e('0x46')](_0x4e4d60);})[_0xb04e('0x26')](function(_0x1bdfce){_0x2949c2[_0xb04e('0x47')]=_0x1bdfce;return _0x2949c2;})['then'](respondWithFilteredResult(_0x36e69b,_0x4e4d60))[_0xb04e('0x48')](handleError(_0x36e69b,null));};exports[_0xb04e('0x49')]=function(_0x336587,_0x3ac873){var _0x314d31={'raw':!![],'where':{'id':_0x336587[_0xb04e('0x4a')]['id']}},_0x488d4e={};_0x488d4e[_0xb04e('0x32')]=_[_0xb04e('0x34')](db[_0xb04e('0x43')]['rawAttributes']);_0x488d4e[_0xb04e('0x33')]=_[_0xb04e('0x34')](_0x336587[_0xb04e('0x33')]);_0x488d4e[_0xb04e('0x35')]=_[_0xb04e('0x36')](_0x488d4e[_0xb04e('0x32')],_0x488d4e[_0xb04e('0x33')]);_0x314d31[_0xb04e('0x38')]=_['intersection'](_0x488d4e[_0xb04e('0x32')],qs[_0xb04e('0x37')](_0x336587['query'][_0xb04e('0x37')]));_0x314d31[_0xb04e('0x38')]=_0x314d31['attributes'][_0xb04e('0x39')]?_0x314d31[_0xb04e('0x38')]:_0x488d4e[_0xb04e('0x32')];if(_0x336587[_0xb04e('0x33')]['includeAll']){_0x314d31[_0xb04e('0x45')]=[{'all':!![]}];}_0x314d31=_[_0xb04e('0x40')]({},_0x314d31,_0x336587[_0xb04e('0x42')]);return db['Interval'][_0xb04e('0x4b')](_0x314d31)['then'](handleEntityNotFound(_0x3ac873,null))[_0xb04e('0x26')](respondWithResult(_0x3ac873,null))['catch'](handleError(_0x3ac873,null));};exports[_0xb04e('0x4c')]=function(_0x3286c8,_0x1f113a){return db[_0xb04e('0x43')]['create'](_0x3286c8['body'],{})[_0xb04e('0x26')](function(_0x31082c){var _0x36f76a=_0x3286c8[_0xb04e('0x4d')][_0xb04e('0x28')]({'plain':!![]});if(!_0x36f76a)throw new Error(_0xb04e('0x4e'));if(_0x36f76a[_0xb04e('0x4f')]===_0xb04e('0x4d')){var _0x522bd9=_0x31082c[_0xb04e('0x28')]({'plain':!![]});var _0x1f814e=_0xb04e('0x50');return db[_0xb04e('0x51')][_0xb04e('0x4b')]({'where':{'name':_0x1f814e,'userProfileId':_0x36f76a[_0xb04e('0x52')]},'raw':!![]})[_0xb04e('0x26')](function(_0x13bf9a){if(_0x13bf9a&&_0x13bf9a[_0xb04e('0x53')]===0x0){return db[_0xb04e('0x54')][_0xb04e('0x4c')]({'name':_0x522bd9[_0xb04e('0x2b')],'resourceId':_0x522bd9['id'],'type':_0x13bf9a[_0xb04e('0x2b')],'sectionId':_0x13bf9a['id']},{})[_0xb04e('0x26')](function(){return _0x31082c;});}else{return _0x31082c;}})[_0xb04e('0x48')](function(_0x17ebf9){logger['error'](_0xb04e('0x55'),_0x17ebf9);throw _0x17ebf9;});}return _0x31082c;})[_0xb04e('0x26')](respondWithResult(_0x1f113a,0xc9))[_0xb04e('0x48')](handleError(_0x1f113a,null));};exports[_0xb04e('0x25')]=function(_0x5a8ad0,_0x476f68){if(_0x5a8ad0[_0xb04e('0x56')]['id']){delete _0x5a8ad0[_0xb04e('0x56')]['id'];}return db['Interval'][_0xb04e('0x4b')]({'where':{'id':_0x5a8ad0[_0xb04e('0x4a')]['id']}})[_0xb04e('0x26')](handleEntityNotFound(_0x476f68,null))[_0xb04e('0x26')](saveUpdates(_0x5a8ad0['body'],null))['then'](respondWithResult(_0x476f68,null))[_0xb04e('0x48')](handleError(_0x476f68,null));};exports['destroy']=function(_0xae63b,_0x1a7387){return db[_0xb04e('0x43')][_0xb04e('0x4b')]({'where':{'id':_0xae63b[_0xb04e('0x4a')]['id']}})[_0xb04e('0x26')](handleEntityNotFound(_0x1a7387,null))[_0xb04e('0x26')](removeEntity(_0x1a7387,null))[_0xb04e('0x48')](handleError(_0x1a7387,null));};exports['addInterval']=function(_0xe1b35,_0x2123e8,_0x2cb4e1){if(_0xe1b35[_0xb04e('0x56')]['id']){delete _0xe1b35[_0xb04e('0x56')]['id'];}return db['Interval'][_0xb04e('0x4b')]({'where':{'id':_0xe1b35[_0xb04e('0x4a')]['id']}})[_0xb04e('0x26')](handleEntityNotFound(_0x2123e8,null))[_0xb04e('0x26')](function(_0x5e6df4){if(_0x5e6df4){_0xe1b35['body'][_0xb04e('0x57')]=_0x5e6df4['id'];return db[_0xb04e('0x43')][_0xb04e('0x4c')](_0xe1b35[_0xb04e('0x56')]);}})[_0xb04e('0x26')](respondWithResult(_0x2123e8,null))[_0xb04e('0x48')](handleError(_0x2123e8,null));};exports[_0xb04e('0x58')]=function(_0x4c4fdb,_0x3c9c6e,_0x233ef9){var _0x1c2466={};var _0x5bdf18={};var _0x6cb8da;var _0x283900;return db[_0xb04e('0x43')][_0xb04e('0x59')]({'where':{'id':_0x4c4fdb[_0xb04e('0x4a')]['id']}})[_0xb04e('0x26')](handleEntityNotFound(_0x3c9c6e,null))['then'](function(_0x403dd6){if(_0x403dd6){_0x6cb8da=_0x403dd6;_0x5bdf18['model']=_['keys'](db[_0xb04e('0x43')][_0xb04e('0x2f')]);_0x5bdf18[_0xb04e('0x33')]=_['keys'](_0x4c4fdb['query']);_0x5bdf18[_0xb04e('0x35')]=_[_0xb04e('0x36')](_0x5bdf18['model'],_0x5bdf18[_0xb04e('0x33')]);_0x1c2466['attributes']=_['intersection'](_0x5bdf18[_0xb04e('0x32')],qs['fields'](_0x4c4fdb[_0xb04e('0x33')][_0xb04e('0x37')]));_0x1c2466[_0xb04e('0x38')]=_0x1c2466[_0xb04e('0x38')][_0xb04e('0x39')]?_0x1c2466[_0xb04e('0x38')]:_0x5bdf18['model'];_0x1c2466[_0xb04e('0x3b')]=qs['sort'](_0x4c4fdb['query'][_0xb04e('0x3c')]);_0x1c2466[_0xb04e('0x3d')]=qs['filters'](_[_0xb04e('0x3e')](_0x4c4fdb[_0xb04e('0x33')],_0x5bdf18[_0xb04e('0x35')]));if(_0x4c4fdb[_0xb04e('0x33')]['filter']){_0x1c2466['where']=_['merge'](_0x1c2466[_0xb04e('0x3d')],{'$or':_[_0xb04e('0x2e')](_0x1c2466['attributes'],function(_0x26b943){var _0xa644a={};_0xa644a[_0x26b943]={'$like':'%'+_0x4c4fdb[_0xb04e('0x33')][_0xb04e('0x3f')]+'%'};return _0xa644a;})});}_0x1c2466=_[_0xb04e('0x40')]({},_0x1c2466,_0x4c4fdb[_0xb04e('0x42')]);return _0x6cb8da[_0xb04e('0x58')](_0x1c2466);}})[_0xb04e('0x26')](function(_0x136c2f){if(_0x136c2f){_0x283900=_0x136c2f['length'];if(!_0x4c4fdb['query'][_0xb04e('0x5a')](_0xb04e('0x5b'))){_0x1c2466[_0xb04e('0x3a')]=qs[_0xb04e('0x3a')](_0x4c4fdb[_0xb04e('0x33')][_0xb04e('0x3a')]);_0x1c2466[_0xb04e('0x1f')]=qs[_0xb04e('0x1f')](_0x4c4fdb[_0xb04e('0x33')]['offset']);}return _0x6cb8da[_0xb04e('0x58')](_0x1c2466);}})[_0xb04e('0x26')](function(_0x410122){if(_0x410122){return _0x410122?{'count':_0x283900,'rows':_0x410122}:null;}})[_0xb04e('0x26')](respondWithResult(_0x3c9c6e,null))[_0xb04e('0x48')](handleError(_0x3c9c6e,null));};exports[_0xb04e('0x5c')]=function(_0x4a8504,_0xf03ba1,_0x2417ee){return db[_0xb04e('0x43')][_0xb04e('0x59')]({'where':{'id':_0x4a8504[_0xb04e('0x4a')]['id']}})[_0xb04e('0x26')](handleEntityNotFound(_0xf03ba1,null))[_0xb04e('0x26')](function(_0x30e3fb){if(_0x30e3fb){return db[_0xb04e('0x5d')][_0xb04e('0x5e')](function(_0x1a514d){return db[_0xb04e('0x43')][_0xb04e('0x27')]({'where':{'IntervalId':_0x4a8504[_0xb04e('0x4a')]['id']},'transaction':_0x1a514d})[_0xb04e('0x26')](function(_0x2fc269){var _0x38857c=_[_0xb04e('0x2e')](_0x4a8504['body'],function(_0x456a94){delete _0x456a94['id'];_0x456a94[_0xb04e('0x57')]=_0x4a8504[_0xb04e('0x4a')]['id'];return _0x456a94;});return db['Interval'][_0xb04e('0x5f')](_0x38857c,{'transaction':_0x1a514d});});})[_0xb04e('0x26')](function(){return db[_0xb04e('0x43')][_0xb04e('0x46')]({'where':{'IntervalId':_0x4a8504[_0xb04e('0x4a')]['id']}});});}})[_0xb04e('0x26')](respondWithResult(_0xf03ba1,null))[_0xb04e('0x48')](handleError(_0xf03ba1,null));}; \ No newline at end of file +var _0x2db2=['UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','Interval','includeAll','include','findAll','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','addInterval','IntervalId','findOne','order','getIntervals','addIntervals','sequelize','transaction','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','Intervals'];(function(_0x438dd9,_0x2012f4){var _0x58d206=function(_0x550058){while(--_0x550058){_0x438dd9['push'](_0x438dd9['shift']());}};_0x58d206(++_0x2012f4);}(_0x2db2,0x1ed));var _0x22db=function(_0x2dce9f,_0x1d1880){_0x2dce9f=_0x2dce9f-0x0;var _0x1cd454=_0x2db2[_0x2dce9f];return _0x1cd454;};'use strict';var pdf=require(_0x22db('0x0'));var emlformat=require(_0x22db('0x1'));var rimraf=require(_0x22db('0x2'));var zipdir=require(_0x22db('0x3'));var jsonpatch=require(_0x22db('0x4'));var rp=require(_0x22db('0x5'));var moment=require('moment');var BPromise=require(_0x22db('0x6'));var Mustache=require(_0x22db('0x7'));var util=require(_0x22db('0x8'));var path=require(_0x22db('0x9'));var sox=require(_0x22db('0xa'));var csv=require('to-csv');var ejs=require(_0x22db('0xb'));var fs=require('fs');var _=require(_0x22db('0xc'));var squel=require('squel');var crypto=require(_0x22db('0xd'));var jsforce=require(_0x22db('0xe'));var deskjs=require(_0x22db('0xf'));var toCsv=require(_0x22db('0x10'));var querystring=require(_0x22db('0x11'));var Papa=require('papaparse');var Redis=require(_0x22db('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x22db('0x13'));var as=require(_0x22db('0x14'));var hardwareService=require(_0x22db('0x15'));var logger=require(_0x22db('0x16'))(_0x22db('0x17'));var utils=require('../../config/utils');var config=require(_0x22db('0x18'));var db=require(_0x22db('0x19'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0xf525d3,_0x534859){_0x534859=_0x534859||0xcc;return function(_0x5d141f){if(_0x5d141f){return _0xf525d3['sendStatus'](_0x534859);}return _0xf525d3[_0x22db('0x1a')](_0x534859)[_0x22db('0x1b')]();};}function respondWithResult(_0x1559c0,_0x19e77f){_0x19e77f=_0x19e77f||0xc8;return function(_0x4f6a2a){if(_0x4f6a2a){return _0x1559c0[_0x22db('0x1a')](_0x19e77f)[_0x22db('0x1c')](_0x4f6a2a);}};}function respondWithFilteredResult(_0x477c54,_0x257d11){return function(_0x5396ef){if(_0x5396ef){var _0x12cef6=_0x5396ef[_0x22db('0x1d')],_0x45771d=_0x257d11[_0x22db('0x1e')],_0x503b3a=_0x257d11[_0x22db('0x1e')]+_0x257d11[_0x22db('0x1f')],_0x5dcdad;if(_0x503b3a>=_0x12cef6){_0x503b3a=_0x12cef6;_0x5dcdad=0xc8;}else{_0x5dcdad=0xce;}_0x477c54[_0x22db('0x1a')](_0x5dcdad);return _0x477c54[_0x22db('0x20')](_0x22db('0x21'),_0x45771d+'-'+_0x503b3a+'/'+_0x12cef6)[_0x22db('0x1c')](_0x5396ef);}return null;};}function patchUpdates(_0x150e19){return function(_0x222b00){try{jsonpatch[_0x22db('0x22')](_0x222b00,_0x150e19,!![]);}catch(_0x4140b4){return BPromise[_0x22db('0x23')](_0x4140b4);}return _0x222b00['save']();};}function saveUpdates(_0x505739,_0x18e7de){return function(_0x1a2983){if(_0x1a2983){return _0x1a2983[_0x22db('0x24')](_0x505739)[_0x22db('0x25')](function(_0x19fc9f){return _0x19fc9f;});}return null;};}function removeEntity(_0x1d9d7e,_0x5cbfd7){return function(_0x2a5cdf){if(_0x2a5cdf){return _0x2a5cdf[_0x22db('0x26')]()['then'](function(){var _0xca490d=_0x2a5cdf[_0x22db('0x27')]({'plain':!![]});var _0x1994c9=_0x22db('0x28');return db[_0x22db('0x29')][_0x22db('0x26')]({'where':{'type':_0x1994c9,'resourceId':_0xca490d['id']}})[_0x22db('0x25')](function(){return _0x2a5cdf;});})[_0x22db('0x25')](function(){_0x1d9d7e[_0x22db('0x1a')](0xcc)[_0x22db('0x1b')]();});}};}function handleEntityNotFound(_0x24c591,_0xa34d59){return function(_0x387ea4){if(!_0x387ea4){_0x24c591[_0x22db('0x2a')](0x194);}return _0x387ea4;};}function handleError(_0x43059b,_0x3fd832){_0x3fd832=_0x3fd832||0x1f4;return function(_0x20dc15){logger['error'](_0x20dc15[_0x22db('0x2b')]);if(_0x20dc15[_0x22db('0x2c')]){delete _0x20dc15['name'];}_0x43059b['status'](_0x3fd832)[_0x22db('0x2d')](_0x20dc15);};}exports[_0x22db('0x2e')]=function(_0x374f0f,_0x45a94f){var _0x2f23cd={},_0x58a797={},_0x6ac124={'count':0x0,'rows':[]};var _0x1c8807=_[_0x22db('0x2f')](db['Interval'][_0x22db('0x30')],function(_0x2a5a79){return{'name':_0x2a5a79['fieldName'],'type':_0x2a5a79[_0x22db('0x31')][_0x22db('0x32')]};});_0x58a797['model']=_[_0x22db('0x2f')](_0x1c8807,'name');_0x58a797[_0x22db('0x33')]=_[_0x22db('0x34')](_0x374f0f[_0x22db('0x33')]);_0x58a797[_0x22db('0x35')]=_[_0x22db('0x36')](_0x58a797[_0x22db('0x37')],_0x58a797[_0x22db('0x33')]);_0x2f23cd[_0x22db('0x38')]=_['intersection'](_0x58a797[_0x22db('0x37')],qs[_0x22db('0x39')](_0x374f0f[_0x22db('0x33')][_0x22db('0x39')]));_0x2f23cd['attributes']=_0x2f23cd[_0x22db('0x38')][_0x22db('0x3a')]?_0x2f23cd[_0x22db('0x38')]:_0x58a797[_0x22db('0x37')];if(!_0x374f0f[_0x22db('0x33')][_0x22db('0x3b')](_0x22db('0x3c'))){_0x2f23cd[_0x22db('0x1f')]=qs[_0x22db('0x1f')](_0x374f0f[_0x22db('0x33')][_0x22db('0x1f')]);_0x2f23cd[_0x22db('0x1e')]=qs[_0x22db('0x1e')](_0x374f0f['query'][_0x22db('0x1e')]);}_0x2f23cd['order']=qs[_0x22db('0x3d')](_0x374f0f[_0x22db('0x33')][_0x22db('0x3d')]);_0x2f23cd[_0x22db('0x3e')]=qs[_0x22db('0x35')](_[_0x22db('0x3f')](_0x374f0f[_0x22db('0x33')],_0x58a797[_0x22db('0x35')]),_0x1c8807);if(_0x374f0f[_0x22db('0x33')]['filter']){_0x2f23cd[_0x22db('0x3e')]=_['merge'](_0x2f23cd[_0x22db('0x3e')],{'$or':_[_0x22db('0x2f')](_0x1c8807,function(_0x3a3674){if(_0x3a3674[_0x22db('0x31')]!=='VIRTUAL'){var _0x50e72b={};_0x50e72b[_0x3a3674[_0x22db('0x2c')]]={'$like':'%'+_0x374f0f[_0x22db('0x33')][_0x22db('0x40')]+'%'};return _0x50e72b;}})});}_0x2f23cd=_[_0x22db('0x41')]({},_0x2f23cd,_0x374f0f[_0x22db('0x42')]);var _0x454290={'where':_0x2f23cd['where']};return db[_0x22db('0x43')][_0x22db('0x1d')](_0x454290)[_0x22db('0x25')](function(_0x19b141){_0x6ac124[_0x22db('0x1d')]=_0x19b141;if(_0x374f0f[_0x22db('0x33')][_0x22db('0x44')]){_0x2f23cd[_0x22db('0x45')]=[{'all':!![]}];}return db[_0x22db('0x43')][_0x22db('0x46')](_0x2f23cd);})['then'](function(_0x1556ee){_0x6ac124['rows']=_0x1556ee;return _0x6ac124;})[_0x22db('0x25')](respondWithFilteredResult(_0x45a94f,_0x2f23cd))['catch'](handleError(_0x45a94f,null));};exports['show']=function(_0x553ed1,_0x2f73c5){var _0x11649a={'raw':!![],'where':{'id':_0x553ed1[_0x22db('0x47')]['id']}},_0x4cfe3f={};_0x4cfe3f[_0x22db('0x37')]=_[_0x22db('0x34')](db[_0x22db('0x43')][_0x22db('0x30')]);_0x4cfe3f['query']=_[_0x22db('0x34')](_0x553ed1[_0x22db('0x33')]);_0x4cfe3f[_0x22db('0x35')]=_[_0x22db('0x36')](_0x4cfe3f['model'],_0x4cfe3f[_0x22db('0x33')]);_0x11649a[_0x22db('0x38')]=_[_0x22db('0x36')](_0x4cfe3f[_0x22db('0x37')],qs[_0x22db('0x39')](_0x553ed1[_0x22db('0x33')][_0x22db('0x39')]));_0x11649a[_0x22db('0x38')]=_0x11649a['attributes'][_0x22db('0x3a')]?_0x11649a[_0x22db('0x38')]:_0x4cfe3f[_0x22db('0x37')];if(_0x553ed1[_0x22db('0x33')]['includeAll']){_0x11649a[_0x22db('0x45')]=[{'all':!![]}];}_0x11649a=_[_0x22db('0x41')]({},_0x11649a,_0x553ed1['options']);return db[_0x22db('0x43')][_0x22db('0x48')](_0x11649a)['then'](handleEntityNotFound(_0x2f73c5,null))[_0x22db('0x25')](respondWithResult(_0x2f73c5,null))[_0x22db('0x49')](handleError(_0x2f73c5,null));};exports[_0x22db('0x4a')]=function(_0x59501f,_0x5354a9){return db[_0x22db('0x43')][_0x22db('0x4a')](_0x59501f[_0x22db('0x4b')],{})[_0x22db('0x25')](function(_0x3305c0){var _0x4aa37f=_0x59501f[_0x22db('0x4c')][_0x22db('0x27')]({'plain':!![]});if(!_0x4aa37f)throw new Error(_0x22db('0x4d'));if(_0x4aa37f['role']==='user'){var _0x508138=_0x3305c0[_0x22db('0x27')]({'plain':!![]});var _0x11f931=_0x22db('0x28');return db[_0x22db('0x4e')][_0x22db('0x48')]({'where':{'name':_0x11f931,'userProfileId':_0x4aa37f['userProfileId']},'raw':!![]})['then'](function(_0xa8ea2){if(_0xa8ea2&&_0xa8ea2[_0x22db('0x4f')]===0x0){return db[_0x22db('0x29')][_0x22db('0x4a')]({'name':_0x508138[_0x22db('0x2c')],'resourceId':_0x508138['id'],'type':_0xa8ea2[_0x22db('0x2c')],'sectionId':_0xa8ea2['id']},{})[_0x22db('0x25')](function(){return _0x3305c0;});}else{return _0x3305c0;}})[_0x22db('0x49')](function(_0x3693eb){logger[_0x22db('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3693eb);throw _0x3693eb;});}return _0x3305c0;})[_0x22db('0x25')](respondWithResult(_0x5354a9,0xc9))[_0x22db('0x49')](handleError(_0x5354a9,null));};exports[_0x22db('0x24')]=function(_0x302c46,_0x3c92e8){if(_0x302c46[_0x22db('0x4b')]['id']){delete _0x302c46[_0x22db('0x4b')]['id'];}return db['Interval']['find']({'where':{'id':_0x302c46[_0x22db('0x47')]['id']}})[_0x22db('0x25')](handleEntityNotFound(_0x3c92e8,null))[_0x22db('0x25')](saveUpdates(_0x302c46[_0x22db('0x4b')],null))[_0x22db('0x25')](respondWithResult(_0x3c92e8,null))[_0x22db('0x49')](handleError(_0x3c92e8,null));};exports[_0x22db('0x26')]=function(_0x34b4e8,_0x4930c2){return db[_0x22db('0x43')]['find']({'where':{'id':_0x34b4e8[_0x22db('0x47')]['id']}})[_0x22db('0x25')](handleEntityNotFound(_0x4930c2,null))[_0x22db('0x25')](removeEntity(_0x4930c2,null))[_0x22db('0x49')](handleError(_0x4930c2,null));};exports[_0x22db('0x51')]=function(_0x3509c0,_0x55143a,_0x388cd2){if(_0x3509c0['body']['id']){delete _0x3509c0[_0x22db('0x4b')]['id'];}return db[_0x22db('0x43')][_0x22db('0x48')]({'where':{'id':_0x3509c0['params']['id']}})[_0x22db('0x25')](handleEntityNotFound(_0x55143a,null))['then'](function(_0x4ac650){if(_0x4ac650){_0x3509c0['body'][_0x22db('0x52')]=_0x4ac650['id'];return db[_0x22db('0x43')][_0x22db('0x4a')](_0x3509c0[_0x22db('0x4b')]);}})['then'](respondWithResult(_0x55143a,null))[_0x22db('0x49')](handleError(_0x55143a,null));};exports['getIntervals']=function(_0x13a651,_0x90133b,_0x2ae74b){var _0x2497ce={};var _0x252246={};var _0x33d530;var _0x4f9325;return db[_0x22db('0x43')][_0x22db('0x53')]({'where':{'id':_0x13a651[_0x22db('0x47')]['id']}})[_0x22db('0x25')](handleEntityNotFound(_0x90133b,null))[_0x22db('0x25')](function(_0x2f013d){if(_0x2f013d){_0x33d530=_0x2f013d;_0x252246['model']=_[_0x22db('0x34')](db[_0x22db('0x43')]['rawAttributes']);_0x252246[_0x22db('0x33')]=_[_0x22db('0x34')](_0x13a651[_0x22db('0x33')]);_0x252246[_0x22db('0x35')]=_[_0x22db('0x36')](_0x252246[_0x22db('0x37')],_0x252246[_0x22db('0x33')]);_0x2497ce[_0x22db('0x38')]=_['intersection'](_0x252246[_0x22db('0x37')],qs[_0x22db('0x39')](_0x13a651[_0x22db('0x33')][_0x22db('0x39')]));_0x2497ce[_0x22db('0x38')]=_0x2497ce[_0x22db('0x38')]['length']?_0x2497ce[_0x22db('0x38')]:_0x252246[_0x22db('0x37')];_0x2497ce[_0x22db('0x54')]=qs[_0x22db('0x3d')](_0x13a651[_0x22db('0x33')][_0x22db('0x3d')]);_0x2497ce[_0x22db('0x3e')]=qs[_0x22db('0x35')](_[_0x22db('0x3f')](_0x13a651[_0x22db('0x33')],_0x252246[_0x22db('0x35')]));if(_0x13a651[_0x22db('0x33')][_0x22db('0x40')]){_0x2497ce[_0x22db('0x3e')]=_['merge'](_0x2497ce[_0x22db('0x3e')],{'$or':_[_0x22db('0x2f')](_0x2497ce['attributes'],function(_0x5102e9){var _0x47a13d={};_0x47a13d[_0x5102e9]={'$like':'%'+_0x13a651[_0x22db('0x33')][_0x22db('0x40')]+'%'};return _0x47a13d;})});}_0x2497ce=_[_0x22db('0x41')]({},_0x2497ce,_0x13a651['options']);return _0x33d530[_0x22db('0x55')](_0x2497ce);}})['then'](function(_0x5f5443){if(_0x5f5443){_0x4f9325=_0x5f5443[_0x22db('0x3a')];if(!_0x13a651[_0x22db('0x33')][_0x22db('0x3b')](_0x22db('0x3c'))){_0x2497ce['limit']=qs[_0x22db('0x1f')](_0x13a651['query'][_0x22db('0x1f')]);_0x2497ce[_0x22db('0x1e')]=qs[_0x22db('0x1e')](_0x13a651[_0x22db('0x33')]['offset']);}return _0x33d530[_0x22db('0x55')](_0x2497ce);}})[_0x22db('0x25')](function(_0xebbf64){if(_0xebbf64){return _0xebbf64?{'count':_0x4f9325,'rows':_0xebbf64}:null;}})[_0x22db('0x25')](respondWithResult(_0x90133b,null))[_0x22db('0x49')](handleError(_0x90133b,null));};exports[_0x22db('0x56')]=function(_0x1cf184,_0x22f588,_0x1c7334){return db['Interval'][_0x22db('0x53')]({'where':{'id':_0x1cf184[_0x22db('0x47')]['id']}})['then'](handleEntityNotFound(_0x22f588,null))[_0x22db('0x25')](function(_0x153606){if(_0x153606){return db[_0x22db('0x57')][_0x22db('0x58')](function(_0x3b2582){return db[_0x22db('0x43')]['destroy']({'where':{'IntervalId':_0x1cf184[_0x22db('0x47')]['id']},'transaction':_0x3b2582})['then'](function(_0x167a13){var _0x4e74f7=_['map'](_0x1cf184['body'],function(_0x5b1230){delete _0x5b1230['id'];_0x5b1230[_0x22db('0x52')]=_0x1cf184[_0x22db('0x47')]['id'];return _0x5b1230;});return db[_0x22db('0x43')]['bulkCreate'](_0x4e74f7,{'transaction':_0x3b2582});});})[_0x22db('0x25')](function(){return db[_0x22db('0x43')][_0x22db('0x46')]({'where':{'IntervalId':_0x1cf184[_0x22db('0x47')]['id']}});});}})[_0x22db('0x25')](respondWithResult(_0x22f588,null))[_0x22db('0x49')](handleError(_0x22f588,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 41373f4..429fec1 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 _0xb945=['../../config/environment','./interval.attributes','../../components/extensions/rewrite','define','Interval','tools_intervals','rewrite','lodash','../../config/logger','moment','path','rimraf'];(function(_0x754ab4,_0x56daa7){var _0x34079a=function(_0x295ec1){while(--_0x295ec1){_0x754ab4['push'](_0x754ab4['shift']());}};_0x34079a(++_0x56daa7);}(_0xb945,0x97));var _0x5b94=function(_0x463f91,_0x26ec38){_0x463f91=_0x463f91-0x0;var _0x552e15=_0xb945[_0x463f91];return _0x552e15;};'use strict';var _=require(_0x5b94('0x0'));var util=require('util');var logger=require(_0x5b94('0x1'))('api');var moment=require(_0x5b94('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b94('0x3'));var rimraf=require(_0x5b94('0x4'));var config=require(_0x5b94('0x5'));var attributes=require(_0x5b94('0x6'));var extensions=require(_0x5b94('0x7'));module['exports']=function(_0x492388,_0x2db8d8){return _0x492388[_0x5b94('0x8')](_0x5b94('0x9'),attributes,{'tableName':_0x5b94('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d2448,_0x428211){extensions['rewrite'](_0x492388,_0x5d2448);},'afterBulkCreate':function(_0x3e7695,_0x3e1b21,_0x14fe68){_0x14fe68();extensions[_0x5b94('0xb')](_0x492388,_0x3e7695[0x0]);},'afterUpdate':function(_0x2bcba0,_0x1dba61){extensions[_0x5b94('0xb')](_0x492388,_0x2bcba0);},'afterDestroy':function(_0x56aeea,_0x178bf4){extensions['rewrite'](_0x492388,_0x56aeea);}}});}; \ No newline at end of file +var _0x3a79=['./interval.attributes','exports','define','Interval','tools_intervals','rewrite','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x21e83c,_0x113560){var _0x4dbd97=function(_0x542396){while(--_0x542396){_0x21e83c['push'](_0x21e83c['shift']());}};_0x4dbd97(++_0x113560);}(_0x3a79,0xca));var _0x93a7=function(_0x4a85f1,_0x4c0410){_0x4a85f1=_0x4a85f1-0x0;var _0x1e0c20=_0x3a79[_0x4a85f1];return _0x1e0c20;};'use strict';var _=require('lodash');var util=require(_0x93a7('0x0'));var logger=require(_0x93a7('0x1'))('api');var moment=require(_0x93a7('0x2'));var BPromise=require(_0x93a7('0x3'));var rp=require(_0x93a7('0x4'));var fs=require('fs');var path=require(_0x93a7('0x5'));var rimraf=require(_0x93a7('0x6'));var config=require(_0x93a7('0x7'));var attributes=require(_0x93a7('0x8'));var extensions=require('../../components/extensions/rewrite');module[_0x93a7('0x9')]=function(_0x4efb20,_0x2579e5){return _0x4efb20[_0x93a7('0xa')](_0x93a7('0xb'),attributes,{'tableName':_0x93a7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a512b,_0x30f781){extensions['rewrite'](_0x4efb20,_0x3a512b);},'afterBulkCreate':function(_0x2996db,_0x5e0abe,_0x49a374){_0x49a374();extensions[_0x93a7('0xd')](_0x4efb20,_0x2996db[0x0]);},'afterUpdate':function(_0x3484a0,_0x329e8d){extensions['rewrite'](_0x4efb20,_0x3484a0);},'afterDestroy':function(_0x5374ae,_0x119f25){extensions[_0x93a7('0xd')](_0x4efb20,_0x5374ae);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 627b46f..3f5373f 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 _0xc096=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetInterval','Interval','find','ShowInterval','lodash'];(function(_0x127783,_0x258715){var _0x14f298=function(_0x32090e){while(--_0x32090e){_0x127783['push'](_0x127783['shift']());}};_0x14f298(++_0x258715);}(_0xc096,0x102));var _0x6c09=function(_0x5040b0,_0x53c900){_0x5040b0=_0x5040b0-0x0;var _0x32d66e=_0xc096[_0x5040b0];return _0x32d66e;};'use strict';var _=require(_0x6c09('0x0'));var util=require(_0x6c09('0x1'));var moment=require('moment');var BPromise=require(_0x6c09('0x2'));var rs=require(_0x6c09('0x3'));var fs=require('fs');var Redis=require(_0x6c09('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6c09('0x5'))(_0x6c09('0x6'));var config=require(_0x6c09('0x7'));var jayson=require(_0x6c09('0x8'));var client=jayson[_0x6c09('0x9')][_0x6c09('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27f74c,_0x813a14,_0xb04e91){return new BPromise(function(_0x40b38b,_0x1f75ab){return client[_0x6c09('0xb')](_0x27f74c,_0xb04e91)[_0x6c09('0xc')](function(_0x20a505){logger[_0x6c09('0xd')](_0x6c09('0xe'),_0x813a14,_0x6c09('0xf'));logger[_0x6c09('0x10')](_0x6c09('0x11'),_0x813a14,'request\x20sent',JSON[_0x6c09('0x12')](_0x20a505));if(_0x20a505[_0x6c09('0x13')]){if(_0x20a505['error'][_0x6c09('0x14')]===0x1f4){logger[_0x6c09('0x13')](_0x6c09('0xe'),_0x813a14,_0x20a505[_0x6c09('0x13')][_0x6c09('0x15')]);return _0x1f75ab(_0x20a505[_0x6c09('0x13')][_0x6c09('0x15')]);}logger[_0x6c09('0x13')]('Interval,\x20%s,\x20%s',_0x813a14,_0x20a505[_0x6c09('0x13')][_0x6c09('0x15')]);return _0x40b38b(_0x20a505['error'][_0x6c09('0x15')]);}else{logger[_0x6c09('0xd')](_0x6c09('0xe'),_0x813a14,_0x6c09('0xf'));_0x40b38b(_0x20a505[_0x6c09('0x16')][_0x6c09('0x15')]);}})[_0x6c09('0x17')](function(_0x3e9141){logger[_0x6c09('0x13')](_0x6c09('0xe'),_0x813a14,_0x3e9141);_0x1f75ab(_0x3e9141);});});}exports['GetInterval']=function(_0x3c7200){var _0x38e278=this;return new Promise(function(_0x45cfdb,_0x4dfe66){return db['Interval'][_0x6c09('0x18')]({'raw':_0x3c7200[_0x6c09('0x19')]?_0x3c7200['options'][_0x6c09('0x1a')]===undefined?!![]:![]:!![],'where':_0x3c7200[_0x6c09('0x19')]?_0x3c7200[_0x6c09('0x19')][_0x6c09('0x1b')]||null:null,'attributes':_0x3c7200[_0x6c09('0x19')]?_0x3c7200[_0x6c09('0x19')][_0x6c09('0x1c')]||null:null,'limit':_0x3c7200[_0x6c09('0x19')]?_0x3c7200[_0x6c09('0x19')][_0x6c09('0x1d')]||null:null,'include':_0x3c7200[_0x6c09('0x19')]?_0x3c7200[_0x6c09('0x19')][_0x6c09('0x1e')]?_['map'](_0x3c7200['options'][_0x6c09('0x1e')],function(_0x3b74e1){return{'model':db[_0x3b74e1['model']],'as':_0x3b74e1['as'],'attributes':_0x3b74e1[_0x6c09('0x1c')],'include':_0x3b74e1[_0x6c09('0x1e')]?_[_0x6c09('0x1f')](_0x3b74e1[_0x6c09('0x1e')],function(_0x2f6af5){return{'model':db[_0x2f6af5[_0x6c09('0x20')]],'as':_0x2f6af5['as'],'attributes':_0x2f6af5[_0x6c09('0x1c')],'include':_0x2f6af5[_0x6c09('0x1e')]?_['map'](_0x2f6af5['include'],function(_0x3e224a){return{'model':db[_0x3e224a[_0x6c09('0x20')]],'as':_0x3e224a['as'],'attributes':_0x3e224a[_0x6c09('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5627c6){logger['info'](_0x6c09('0x21'),_0x3c7200);logger['debug'](_0x6c09('0x21'),_0x3c7200,JSON['stringify'](_0x5627c6));_0x45cfdb(_0x5627c6);})[_0x6c09('0x17')](function(_0x460ecb){logger[_0x6c09('0x13')]('GetInterval',_0x460ecb[_0x6c09('0x15')],_0x3c7200);_0x4dfe66(_0x38e278['error'](0x1f4,_0x460ecb['message']));});});};exports['ShowInterval']=function(_0x449a46){var _0x37a12b=this;return new Promise(function(_0x3ac379,_0x4dc84c){return db[_0x6c09('0x22')][_0x6c09('0x23')]({'raw':_0x449a46[_0x6c09('0x19')]?_0x449a46[_0x6c09('0x19')][_0x6c09('0x1a')]===undefined?!![]:![]:!![],'where':_0x449a46[_0x6c09('0x19')]?_0x449a46[_0x6c09('0x19')][_0x6c09('0x1b')]||null:null,'attributes':_0x449a46[_0x6c09('0x19')]?_0x449a46[_0x6c09('0x19')][_0x6c09('0x1c')]||null:null,'include':_0x449a46['options']?_0x449a46['options'][_0x6c09('0x1e')]?_[_0x6c09('0x1f')](_0x449a46[_0x6c09('0x19')][_0x6c09('0x1e')],function(_0x14d2fd){return{'model':db[_0x14d2fd['model']],'as':_0x14d2fd['as'],'attributes':_0x14d2fd[_0x6c09('0x1c')],'include':_0x14d2fd[_0x6c09('0x1e')]?_[_0x6c09('0x1f')](_0x14d2fd[_0x6c09('0x1e')],function(_0x413b9c){return{'model':db[_0x413b9c['model']],'as':_0x413b9c['as'],'attributes':_0x413b9c['attributes'],'include':_0x413b9c[_0x6c09('0x1e')]?_[_0x6c09('0x1f')](_0x413b9c[_0x6c09('0x1e')],function(_0x21bba3){return{'model':db[_0x21bba3[_0x6c09('0x20')]],'as':_0x21bba3['as'],'attributes':_0x21bba3['attributes']};}):[]};}):[]};}):[]:[]})[_0x6c09('0xc')](function(_0x48e81d){logger[_0x6c09('0xd')](_0x6c09('0x24'),_0x449a46);logger['debug']('ShowInterval',_0x449a46,JSON['stringify'](_0x48e81d));_0x3ac379(_0x48e81d);})['catch'](function(_0x154b9a){logger[_0x6c09('0x13')](_0x6c09('0x24'),_0x154b9a[_0x6c09('0x15')],_0x449a46);_0x4dc84c(_0x37a12b[_0x6c09('0x13')](0x1f4,_0x154b9a[_0x6c09('0x15')]));});});}; \ No newline at end of file +var _0xa973=['raw','attributes','limit','include','map','then','ShowInterval','find','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetInterval','Interval','findAll','options'];(function(_0x3dead1,_0x3f2f00){var _0x2f278c=function(_0x36bd36){while(--_0x36bd36){_0x3dead1['push'](_0x3dead1['shift']());}};_0x2f278c(++_0x3f2f00);}(_0xa973,0x1d0));var _0x3a97=function(_0x3c60fc,_0x593ef5){_0x3c60fc=_0x3c60fc-0x0;var _0x495fd2=_0xa973[_0x3c60fc];return _0x495fd2;};'use strict';var _=require(_0x3a97('0x0'));var util=require(_0x3a97('0x1'));var moment=require(_0x3a97('0x2'));var BPromise=require(_0x3a97('0x3'));var rs=require(_0x3a97('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a97('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3a97('0x6'));var config=require(_0x3a97('0x7'));var jayson=require(_0x3a97('0x8'));var client=jayson['client'][_0x3a97('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x445d91,_0x906ae,_0x36fa96){return new BPromise(function(_0x2f8472,_0x468ca5){return client[_0x3a97('0xa')](_0x445d91,_0x36fa96)['then'](function(_0x3c7083){logger[_0x3a97('0xb')](_0x3a97('0xc'),_0x906ae,_0x3a97('0xd'));logger[_0x3a97('0xe')](_0x3a97('0xf'),_0x906ae,_0x3a97('0xd'),JSON[_0x3a97('0x10')](_0x3c7083));if(_0x3c7083[_0x3a97('0x11')]){if(_0x3c7083[_0x3a97('0x11')][_0x3a97('0x12')]===0x1f4){logger['error'](_0x3a97('0xc'),_0x906ae,_0x3c7083['error'][_0x3a97('0x13')]);return _0x468ca5(_0x3c7083[_0x3a97('0x11')][_0x3a97('0x13')]);}logger[_0x3a97('0x11')](_0x3a97('0xc'),_0x906ae,_0x3c7083[_0x3a97('0x11')]['message']);return _0x2f8472(_0x3c7083[_0x3a97('0x11')][_0x3a97('0x13')]);}else{logger['info'](_0x3a97('0xc'),_0x906ae,_0x3a97('0xd'));_0x2f8472(_0x3c7083[_0x3a97('0x14')][_0x3a97('0x13')]);}})[_0x3a97('0x15')](function(_0xa568e3){logger['error'](_0x3a97('0xc'),_0x906ae,_0xa568e3);_0x468ca5(_0xa568e3);});});}exports[_0x3a97('0x16')]=function(_0x4a154a){var _0x2cd80f=this;return new Promise(function(_0x2995f2,_0x48cfc4){return db[_0x3a97('0x17')][_0x3a97('0x18')]({'raw':_0x4a154a[_0x3a97('0x19')]?_0x4a154a['options'][_0x3a97('0x1a')]===undefined?!![]:![]:!![],'where':_0x4a154a[_0x3a97('0x19')]?_0x4a154a[_0x3a97('0x19')]['where']||null:null,'attributes':_0x4a154a[_0x3a97('0x19')]?_0x4a154a[_0x3a97('0x19')][_0x3a97('0x1b')]||null:null,'limit':_0x4a154a['options']?_0x4a154a[_0x3a97('0x19')][_0x3a97('0x1c')]||null:null,'include':_0x4a154a[_0x3a97('0x19')]?_0x4a154a[_0x3a97('0x19')][_0x3a97('0x1d')]?_[_0x3a97('0x1e')](_0x4a154a['options'][_0x3a97('0x1d')],function(_0x55383b){return{'model':db[_0x55383b['model']],'as':_0x55383b['as'],'attributes':_0x55383b[_0x3a97('0x1b')],'include':_0x55383b[_0x3a97('0x1d')]?_[_0x3a97('0x1e')](_0x55383b['include'],function(_0x241699){return{'model':db[_0x241699['model']],'as':_0x241699['as'],'attributes':_0x241699['attributes'],'include':_0x241699['include']?_[_0x3a97('0x1e')](_0x241699[_0x3a97('0x1d')],function(_0x434413){return{'model':db[_0x434413['model']],'as':_0x434413['as'],'attributes':_0x434413[_0x3a97('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3a97('0x1f')](function(_0x501694){logger[_0x3a97('0xb')](_0x3a97('0x16'),_0x4a154a);logger[_0x3a97('0xe')]('GetInterval',_0x4a154a,JSON[_0x3a97('0x10')](_0x501694));_0x2995f2(_0x501694);})[_0x3a97('0x15')](function(_0x55eadb){logger[_0x3a97('0x11')]('GetInterval',_0x55eadb[_0x3a97('0x13')],_0x4a154a);_0x48cfc4(_0x2cd80f['error'](0x1f4,_0x55eadb[_0x3a97('0x13')]));});});};exports[_0x3a97('0x20')]=function(_0x252cda){var _0x45a45e=this;return new Promise(function(_0x2d7d34,_0x4664ec){return db['Interval'][_0x3a97('0x21')]({'raw':_0x252cda[_0x3a97('0x19')]?_0x252cda[_0x3a97('0x19')][_0x3a97('0x1a')]===undefined?!![]:![]:!![],'where':_0x252cda[_0x3a97('0x19')]?_0x252cda['options']['where']||null:null,'attributes':_0x252cda[_0x3a97('0x19')]?_0x252cda[_0x3a97('0x19')]['attributes']||null:null,'include':_0x252cda[_0x3a97('0x19')]?_0x252cda[_0x3a97('0x19')][_0x3a97('0x1d')]?_[_0x3a97('0x1e')](_0x252cda['options'][_0x3a97('0x1d')],function(_0x33d7ee){return{'model':db[_0x33d7ee[_0x3a97('0x22')]],'as':_0x33d7ee['as'],'attributes':_0x33d7ee[_0x3a97('0x1b')],'include':_0x33d7ee[_0x3a97('0x1d')]?_[_0x3a97('0x1e')](_0x33d7ee[_0x3a97('0x1d')],function(_0x51ec88){return{'model':db[_0x51ec88[_0x3a97('0x22')]],'as':_0x51ec88['as'],'attributes':_0x51ec88[_0x3a97('0x1b')],'include':_0x51ec88[_0x3a97('0x1d')]?_[_0x3a97('0x1e')](_0x51ec88['include'],function(_0x39d7a4){return{'model':db[_0x39d7a4[_0x3a97('0x22')]],'as':_0x39d7a4['as'],'attributes':_0x39d7a4[_0x3a97('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3a97('0x1f')](function(_0x3bee4d){logger[_0x3a97('0xb')]('ShowInterval',_0x252cda);logger[_0x3a97('0xe')](_0x3a97('0x20'),_0x252cda,JSON[_0x3a97('0x10')](_0x3bee4d));_0x2d7d34(_0x3bee4d);})[_0x3a97('0x15')](function(_0x39fed5){logger[_0x3a97('0x11')]('ShowInterval',_0x39fed5['message'],_0x252cda);_0x4664ec(_0x45a45e[_0x3a97('0x11')](0x1f4,_0x39fed5[_0x3a97('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index e9521ba..05a0fef 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 _0xc94e=['./jira.controller','post','isAuthenticated','send','exports','express','Router','../../components/auth/service'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0xc94e,0x85));var _0xec94=function(_0x5e57f4,_0x409323){_0x5e57f4=_0x5e57f4-0x0;var _0x14cf66=_0xc94e[_0x5e57f4];return _0x14cf66;};'use strict';var express=require(_0xec94('0x0'));var router=express[_0xec94('0x1')]();var auth=require(_0xec94('0x2'));var controller=require(_0xec94('0x3'));router[_0xec94('0x4')]('/',auth[_0xec94('0x5')](),controller[_0xec94('0x6')]);module[_0xec94('0x7')]=router; \ No newline at end of file +var _0x43ce=['isAuthenticated','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x14a0f0,_0x6b06b6){var _0x24bef0=function(_0x2bafdd){while(--_0x2bafdd){_0x14a0f0['push'](_0x14a0f0['shift']());}};_0x24bef0(++_0x6b06b6);}(_0x43ce,0x14b));var _0xe43c=function(_0x67c1e6,_0x46ee1f){_0x67c1e6=_0x67c1e6-0x0;var _0x2673fd=_0x43ce[_0x67c1e6];return _0x2673fd;};'use strict';var express=require(_0xe43c('0x0'));var router=express[_0xe43c('0x1')]();var auth=require(_0xe43c('0x2'));var controller=require(_0xe43c('0x3'));router[_0xe43c('0x4')]('/',auth[_0xe43c('0x5')](),controller['send']);module[_0xe43c('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 e7cdcd4..134056e 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 _0xf616=['fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','base64','stringify','request','utf8','data','end','statusCode','json','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','x-forwarded-for','remoteAddress','connection','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','Bug'];(function(_0x3119e8,_0x3b5234){var _0x48735f=function(_0x4841fc){while(--_0x4841fc){_0x3119e8['push'](_0x3119e8['shift']());}};_0x48735f(++_0x3b5234);}(_0xf616,0xb3));var _0x6f61=function(_0x2f461c,_0x166aaf){_0x2f461c=_0x2f461c-0x0;var _0x60dc46=_0xf616[_0x2f461c];return _0x60dc46;};'use strict';var BPromise=require(_0x6f61('0x0'));var https=require(_0x6f61('0x1'));var logger=require(_0x6f61('0x2'))(_0x6f61('0x3'));var USERNAME=_0x6f61('0x4');var PASSWORD=_0x6f61('0x5');function openIssue(_0x46fbcb,_0x18709e){var _0x3c8321={'fields':{'project':{'key':_0x46fbcb[_0x6f61('0x6')]||_0x6f61('0x7')},'summary':(_0x46fbcb[_0x6f61('0x8')]||_0x6f61('0x9'))+_0x6f61('0xa')+_0x46fbcb['ip'],'description':_0x46fbcb[_0x6f61('0xb')]||JSON['stringify'](_0x46fbcb),'issuetype':{'name':_0x46fbcb['issuetype']||_0x6f61('0xc')}}};_0x3c8321[_0x6f61('0xd')][_0x6f61('0xe')]=_0x46fbcb[_0x6f61('0xf')];_0x3c8321[_0x6f61('0xd')][_0x6f61('0x10')]=_0x46fbcb[_0x6f61('0x11')];_0x3c8321[_0x6f61('0xd')][_0x6f61('0x12')]=_0x46fbcb[_0x6f61('0x13')];_0x3c8321[_0x6f61('0xd')][_0x6f61('0x14')]=_0x46fbcb[_0x6f61('0x15')];_0x3c8321[_0x6f61('0xd')][_0x6f61('0x16')]=_0x46fbcb['reason'];_0x3c8321[_0x6f61('0xd')][_0x6f61('0x17')]=_0x46fbcb['ip'];var _0x347a46={'host':_0x6f61('0x18'),'port':0x1bb,'path':_0x6f61('0x19'),'method':_0x6f61('0x1a'),'timeout':0x4e20,'headers':{'Content-Type':_0x6f61('0x1b'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x6f61('0x1c'))}};var _0x367ca0=JSON[_0x6f61('0x1d')](_0x3c8321);var _0x3d0654=https[_0x6f61('0x1e')](_0x347a46,function(_0x3f1a56){_0x3f1a56['setEncoding'](_0x6f61('0x1f'));var _0x7bef55='';_0x3f1a56['on'](_0x6f61('0x20'),function(_0x3df689){_0x7bef55+=_0x3df689;});_0x3f1a56['on'](_0x6f61('0x21'),function(){if(_0x18709e){return _0x18709e['status'](_0x3f1a56[_0x6f61('0x22')])[_0x6f61('0x23')](JSON['parse'](_0x7bef55));}});});_0x3d0654['on'](_0x6f61('0x24'),function(_0x244600){if(_0x18709e){return _0x18709e[_0x6f61('0x25')](0x1f4)[_0x6f61('0x23')]({'errors':[{'message':_0x6f61('0x26'),'type':_0x6f61('0x27')}]});}});_0x3d0654[_0x6f61('0x28')](_0x367ca0);_0x3d0654[_0x6f61('0x21')]();}exports[_0x6f61('0x29')]=openIssue;exports[_0x6f61('0x2a')]=function(_0x2a646d,_0x1f720e){_0x2a646d[_0x6f61('0x2b')]['ip']=_0x2a646d['headers'][_0x6f61('0x2c')]||_0x2a646d['connection'][_0x6f61('0x2d')]||_0x2a646d['socket'][_0x6f61('0x2d')]||_0x2a646d[_0x6f61('0x2e')][_0x6f61('0x2f')][_0x6f61('0x2d')];return openIssue(_0x2a646d['body'],_0x1f720e);}; \ No newline at end of file +var _0x7be6=['../../config/logger','api','support','3eAmWpBVP0','key','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','toString','base64','utf8','data','end','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird'];(function(_0x420f7d,_0x4c1d1c){var _0x10bf61=function(_0x334374){while(--_0x334374){_0x420f7d['push'](_0x420f7d['shift']());}};_0x10bf61(++_0x4c1d1c);}(_0x7be6,0xbb));var _0x67be=function(_0x2acf2a,_0x492c01){_0x2acf2a=_0x2acf2a-0x0;var _0x12fa10=_0x7be6[_0x2acf2a];return _0x12fa10;};'use strict';var BPromise=require(_0x67be('0x0'));var https=require('https');var logger=require(_0x67be('0x1'))(_0x67be('0x2'));var USERNAME=_0x67be('0x3');var PASSWORD=_0x67be('0x4');function openIssue(_0x1f64f3,_0x306864){var _0xcacada={'fields':{'project':{'key':_0x1f64f3[_0x67be('0x5')]||'MOTGUI'},'summary':(_0x1f64f3[_0x67be('0x6')]||_0x67be('0x7'))+_0x67be('0x8')+_0x1f64f3['ip'],'description':_0x1f64f3[_0x67be('0x9')]||JSON[_0x67be('0xa')](_0x1f64f3),'issuetype':{'name':_0x1f64f3[_0x67be('0xb')]||_0x67be('0xc')}}};_0xcacada[_0x67be('0xd')][_0x67be('0xe')]=_0x1f64f3[_0x67be('0xf')];_0xcacada[_0x67be('0xd')][_0x67be('0x10')]=_0x1f64f3[_0x67be('0x11')];_0xcacada['fields'][_0x67be('0x12')]=_0x1f64f3[_0x67be('0x13')];_0xcacada['fields']['customfield_11503']=_0x1f64f3[_0x67be('0x14')];_0xcacada['fields'][_0x67be('0x15')]=_0x1f64f3[_0x67be('0x16')];_0xcacada[_0x67be('0xd')][_0x67be('0x17')]=_0x1f64f3['ip'];var _0x4c18a3={'host':_0x67be('0x18'),'port':0x1bb,'path':_0x67be('0x19'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x67be('0x1a'),'Authorization':_0x67be('0x1b')+new Buffer(USERNAME+':'+PASSWORD)[_0x67be('0x1c')](_0x67be('0x1d'))}};var _0x18bfa4=JSON[_0x67be('0xa')](_0xcacada);var _0x8e6e39=https['request'](_0x4c18a3,function(_0x4abba3){_0x4abba3['setEncoding'](_0x67be('0x1e'));var _0x5b6f20='';_0x4abba3['on'](_0x67be('0x1f'),function(_0x334e86){_0x5b6f20+=_0x334e86;});_0x4abba3['on'](_0x67be('0x20'),function(){if(_0x306864){return _0x306864[_0x67be('0x21')](_0x4abba3[_0x67be('0x22')])[_0x67be('0x23')](JSON[_0x67be('0x24')](_0x5b6f20));}});});_0x8e6e39['on']('error',function(_0x26a182){if(_0x306864){return _0x306864[_0x67be('0x21')](0x1f4)[_0x67be('0x23')]({'errors':[{'message':_0x67be('0x25'),'type':'api.jira'}]});}});_0x8e6e39[_0x67be('0x26')](_0x18bfa4);_0x8e6e39[_0x67be('0x20')]();}exports[_0x67be('0x27')]=openIssue;exports[_0x67be('0x28')]=function(_0x390ce5,_0x20a140){_0x390ce5[_0x67be('0x29')]['ip']=_0x390ce5[_0x67be('0x2a')][_0x67be('0x2b')]||_0x390ce5[_0x67be('0x2c')][_0x67be('0x2d')]||_0x390ce5[_0x67be('0x2e')]['remoteAddress']||_0x390ce5['connection']['socket'][_0x67be('0x2d')];return openIssue(_0x390ce5['body'],_0x20a140);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index e1476dc..a78aea0 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 _0xa1f8=['Router','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','util','express'];(function(_0x52aef6,_0x5e8a4b){var _0x5c5cb6=function(_0x3b9913){while(--_0x3b9913){_0x52aef6['push'](_0x52aef6['shift']());}};_0x5c5cb6(++_0x5e8a4b);}(_0xa1f8,0x8d));var _0x8a1f=function(_0x561612,_0x162362){_0x561612=_0x561612-0x0;var _0x1a430d=_0xa1f8[_0x561612];return _0x1a430d;};'use strict';var multer=require(_0x8a1f('0x0'));var util=require(_0x8a1f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8a1f('0x2'));var router=express[_0x8a1f('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8a1f('0x4'));var controller=require(_0x8a1f('0x5'));router[_0x8a1f('0x6')]('/',auth[_0x8a1f('0x7')](),controller[_0x8a1f('0x8')]);router[_0x8a1f('0x6')](_0x8a1f('0x9'),auth[_0x8a1f('0x7')](),controller[_0x8a1f('0xa')]);router[_0x8a1f('0x6')](_0x8a1f('0xb'),auth[_0x8a1f('0x7')](),controller[_0x8a1f('0xc')]);router['post']('/',auth[_0x8a1f('0x7')](),controller[_0x8a1f('0xd')]);router[_0x8a1f('0xe')](_0x8a1f('0xb'),auth[_0x8a1f('0x7')](),controller['update']);router[_0x8a1f('0xf')](_0x8a1f('0xb'),auth[_0x8a1f('0x7')](),controller[_0x8a1f('0x10')]);module[_0x8a1f('0x11')]=router; \ No newline at end of file +var _0x7c92=['./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','express','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c92,0x165));var _0x27c9=function(_0x24bbc9,_0x2d3627){_0x24bbc9=_0x24bbc9-0x0;var _0xea204e=_0x7c92[_0x24bbc9];return _0xea204e;};'use strict';var multer=require(_0x27c9('0x0'));var util=require('util');var path=require(_0x27c9('0x1'));var timeout=require('connect-timeout');var express=require(_0x27c9('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x27c9('0x3'));var controller=require(_0x27c9('0x4'));router[_0x27c9('0x5')]('/',auth[_0x27c9('0x6')](),controller[_0x27c9('0x7')]);router[_0x27c9('0x5')](_0x27c9('0x8'),auth[_0x27c9('0x6')](),controller[_0x27c9('0x9')]);router[_0x27c9('0x5')](_0x27c9('0xa'),auth[_0x27c9('0x6')](),controller[_0x27c9('0xb')]);router[_0x27c9('0xc')]('/',auth['isAuthenticated'](),controller[_0x27c9('0xd')]);router[_0x27c9('0xe')](_0x27c9('0xa'),auth['isAuthenticated'](),controller[_0x27c9('0xf')]);router[_0x27c9('0x10')](_0x27c9('0xa'),auth[_0x27c9('0x6')](),controller[_0x27c9('0x11')]);module[_0x27c9('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 bf85feb..f5403f7 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 _0x4fd9=['long','STRING','exports','TEXT'];(function(_0x1061f0,_0x1de51d){var _0x118964=function(_0x325fe1){while(--_0x325fe1){_0x1061f0['push'](_0x1061f0['shift']());}};_0x118964(++_0x1de51d);}(_0x4fd9,0x166));var _0x94fd=function(_0x820452,_0x4eda58){_0x820452=_0x820452-0x0;var _0x2b9a98=_0x4fd9[_0x820452];return _0x2b9a98;};'use strict';var Sequelize=require('sequelize');module[_0x94fd('0x0')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0x94fd('0x1')](_0x94fd('0x2'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x94fd('0x3')]},'queue':{'type':Sequelize[_0x94fd('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x94fd('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x94fd('0x3')]}}; \ No newline at end of file +var _0x1dc6=['STRING','TEXT','sequelize'];(function(_0x586e7e,_0x1eeb04){var _0x35ca2f=function(_0x2af8bf){while(--_0x2af8bf){_0x586e7e['push'](_0x586e7e['shift']());}};_0x35ca2f(++_0x1eeb04);}(_0x1dc6,0x1a3));var _0x61dc=function(_0x2e35f0,_0x485a70){_0x2e35f0=_0x2e35f0-0x0;var _0x117cb6=_0x1dc6[_0x2e35f0];return _0x117cb6;};'use strict';var Sequelize=require(_0x61dc('0x0'));module['exports']={'question':{'type':Sequelize[_0x61dc('0x1')]},'answer':{'type':Sequelize[_0x61dc('0x2')]('long')},'membername':{'type':Sequelize[_0x61dc('0x1')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x61dc('0x1')]},'uniqueid':{'type':Sequelize[_0x61dc('0x1')]},'calleridname':{'type':Sequelize[_0x61dc('0x1')]},'calleridnum':{'type':Sequelize[_0x61dc('0x1')]},'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 8de2158..15aec9b 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 _0x81b6=['../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','end','error','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','length','create','body','update','destroy','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x5c2d68,_0x25cd5e){var _0x4f0f11=function(_0xa2294c){while(--_0xa2294c){_0x5c2d68['push'](_0x5c2d68['shift']());}};_0x4f0f11(++_0x25cd5e);}(_0x81b6,0x7e));var _0x681b=function(_0x455d21,_0x414620){_0x455d21=_0x455d21-0x0;var _0x41571b=_0x81b6[_0x455d21];return _0x41571b;};'use strict';var pdf=require(_0x681b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x681b('0x1'));var zipdir=require(_0x681b('0x2'));var jsonpatch=require(_0x681b('0x3'));var rp=require(_0x681b('0x4'));var moment=require('moment');var BPromise=require(_0x681b('0x5'));var Mustache=require('mustache');var util=require(_0x681b('0x6'));var path=require('path');var sox=require(_0x681b('0x7'));var csv=require('to-csv');var ejs=require(_0x681b('0x8'));var fs=require('fs');var _=require(_0x681b('0x9'));var squel=require(_0x681b('0xa'));var crypto=require(_0x681b('0xb'));var jsforce=require(_0x681b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x681b('0xd'));var querystring=require(_0x681b('0xe'));var Papa=require(_0x681b('0xf'));var Redis=require('ioredis');var authService=require(_0x681b('0x10'));var qs=require(_0x681b('0x11'));var as=require(_0x681b('0x12'));var hardwareService=require(_0x681b('0x13'));var logger=require(_0x681b('0x14'))(_0x681b('0x15'));var utils=require(_0x681b('0x16'));var config=require(_0x681b('0x17'));var db=require(_0x681b('0x18'))['db'];function respondWithStatusCode(_0x4877ff,_0x346eb){_0x346eb=_0x346eb||0xcc;return function(_0x58af89){if(_0x58af89){return _0x4877ff[_0x681b('0x19')](_0x346eb);}return _0x4877ff[_0x681b('0x1a')](_0x346eb)['end']();};}function respondWithResult(_0xe6ea59,_0x19d669){_0x19d669=_0x19d669||0xc8;return function(_0x164a0e){if(_0x164a0e){return _0xe6ea59[_0x681b('0x1a')](_0x19d669)[_0x681b('0x1b')](_0x164a0e);}};}function respondWithFilteredResult(_0xf51a5c,_0x54fe0e){return function(_0x4d2725){if(_0x4d2725){var _0x59155c=_0x4d2725[_0x681b('0x1c')],_0x5966e6=_0x54fe0e[_0x681b('0x1d')],_0x55d462=_0x54fe0e[_0x681b('0x1d')]+_0x54fe0e[_0x681b('0x1e')],_0x506d79;if(_0x55d462>=_0x59155c){_0x55d462=_0x59155c;_0x506d79=0xc8;}else{_0x506d79=0xce;}_0xf51a5c[_0x681b('0x1a')](_0x506d79);return _0xf51a5c[_0x681b('0x1f')](_0x681b('0x20'),_0x5966e6+'-'+_0x55d462+'/'+_0x59155c)[_0x681b('0x1b')](_0x4d2725);}return null;};}function patchUpdates(_0x2bc2fb){return function(_0x582027){try{jsonpatch[_0x681b('0x21')](_0x582027,_0x2bc2fb,!![]);}catch(_0x7be2d3){return BPromise[_0x681b('0x22')](_0x7be2d3);}return _0x582027[_0x681b('0x23')]();};}function saveUpdates(_0x144846,_0x4ff502){return function(_0x348edd){if(_0x348edd){return _0x348edd['update'](_0x144846)['then'](function(_0x504ade){return _0x504ade;});}return null;};}function removeEntity(_0x296309,_0x36efba){return function(_0x536ad7){if(_0x536ad7){return _0x536ad7['destroy']()[_0x681b('0x24')](function(){_0x296309['status'](0xcc)[_0x681b('0x25')]();});}};}function handleEntityNotFound(_0x3daa6a,_0x1be03a){return function(_0x39b51a){if(!_0x39b51a){_0x3daa6a['sendStatus'](0x194);}return _0x39b51a;};}function handleError(_0x3a3146,_0x48e1b0){_0x48e1b0=_0x48e1b0||0x1f4;return function(_0x13b7c9){logger[_0x681b('0x26')](_0x13b7c9['stack']);if(_0x13b7c9['name']){delete _0x13b7c9['name'];}_0x3a3146[_0x681b('0x1a')](_0x48e1b0)['send'](_0x13b7c9);};}exports[_0x681b('0x27')]=function(_0x2f03e9,_0x4a533a){var _0x4fa631={},_0x49afe5={},_0x3dc6d6={'count':0x0,'rows':[]};var _0x186eb7=_[_0x681b('0x28')](db[_0x681b('0x29')][_0x681b('0x2a')],function(_0x3a8840){return{'name':_0x3a8840[_0x681b('0x2b')],'type':_0x3a8840[_0x681b('0x2c')][_0x681b('0x2d')]};});_0x49afe5[_0x681b('0x2e')]=_[_0x681b('0x28')](_0x186eb7,_0x681b('0x2f'));_0x49afe5['query']=_['keys'](_0x2f03e9[_0x681b('0x30')]);_0x49afe5[_0x681b('0x31')]=_[_0x681b('0x32')](_0x49afe5[_0x681b('0x2e')],_0x49afe5['query']);_0x4fa631[_0x681b('0x33')]=_[_0x681b('0x32')](_0x49afe5[_0x681b('0x2e')],qs[_0x681b('0x34')](_0x2f03e9['query'][_0x681b('0x34')]));_0x4fa631[_0x681b('0x33')]=_0x4fa631['attributes']['length']?_0x4fa631['attributes']:_0x49afe5[_0x681b('0x2e')];if(!_0x2f03e9[_0x681b('0x30')][_0x681b('0x35')](_0x681b('0x36'))){_0x4fa631[_0x681b('0x1e')]=qs[_0x681b('0x1e')](_0x2f03e9[_0x681b('0x30')][_0x681b('0x1e')]);_0x4fa631[_0x681b('0x1d')]=qs[_0x681b('0x1d')](_0x2f03e9['query'][_0x681b('0x1d')]);}_0x4fa631['order']=qs[_0x681b('0x37')](_0x2f03e9[_0x681b('0x30')]['sort']);_0x4fa631[_0x681b('0x38')]=qs[_0x681b('0x31')](_[_0x681b('0x39')](_0x2f03e9[_0x681b('0x30')],_0x49afe5['filters']),_0x186eb7);if(_0x2f03e9[_0x681b('0x30')]['filter']){_0x4fa631[_0x681b('0x38')]=_['merge'](_0x4fa631[_0x681b('0x38')],{'$or':_[_0x681b('0x28')](_0x186eb7,function(_0x1e886d){if(_0x1e886d[_0x681b('0x2c')]!==_0x681b('0x3a')){var _0x4c879e={};_0x4c879e[_0x1e886d[_0x681b('0x2f')]]={'$like':'%'+_0x2f03e9['query']['filter']+'%'};return _0x4c879e;}})});}_0x4fa631=_[_0x681b('0x3b')]({},_0x4fa631,_0x2f03e9[_0x681b('0x3c')]);var _0x5d0ac5={'where':_0x4fa631[_0x681b('0x38')]};return db[_0x681b('0x29')][_0x681b('0x1c')](_0x5d0ac5)[_0x681b('0x24')](function(_0x283225){_0x3dc6d6[_0x681b('0x1c')]=_0x283225;if(_0x2f03e9[_0x681b('0x30')][_0x681b('0x3d')]){_0x4fa631[_0x681b('0x3e')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x4fa631);})[_0x681b('0x24')](function(_0x1a8aeb){_0x3dc6d6[_0x681b('0x3f')]=_0x1a8aeb;return _0x3dc6d6;})['then'](respondWithFilteredResult(_0x4a533a,_0x4fa631))[_0x681b('0x40')](handleError(_0x4a533a,null));};exports[_0x681b('0x41')]=function(_0x523d87,_0x3d19a7){var _0x445fa6={'raw':!![],'where':{'id':_0x523d87[_0x681b('0x42')]['id']}},_0x1f7727={};_0x1f7727[_0x681b('0x2e')]=_[_0x681b('0x43')](db['JscriptyAnswerReport'][_0x681b('0x2a')]);_0x1f7727[_0x681b('0x30')]=_['keys'](_0x523d87['query']);_0x1f7727[_0x681b('0x31')]=_[_0x681b('0x32')](_0x1f7727['model'],_0x1f7727[_0x681b('0x30')]);_0x445fa6[_0x681b('0x33')]=_['intersection'](_0x1f7727[_0x681b('0x2e')],qs['fields'](_0x523d87['query'][_0x681b('0x34')]));_0x445fa6['attributes']=_0x445fa6['attributes'][_0x681b('0x44')]?_0x445fa6[_0x681b('0x33')]:_0x1f7727['model'];if(_0x523d87[_0x681b('0x30')][_0x681b('0x3d')]){_0x445fa6[_0x681b('0x3e')]=[{'all':!![]}];}_0x445fa6=_[_0x681b('0x3b')]({},_0x445fa6,_0x523d87[_0x681b('0x3c')]);return db[_0x681b('0x29')]['find'](_0x445fa6)['then'](handleEntityNotFound(_0x3d19a7,null))[_0x681b('0x24')](respondWithResult(_0x3d19a7,null))[_0x681b('0x40')](handleError(_0x3d19a7,null));};exports[_0x681b('0x45')]=function(_0x3d793f,_0x56b494){return db[_0x681b('0x29')][_0x681b('0x45')](_0x3d793f[_0x681b('0x46')],{})[_0x681b('0x24')](respondWithResult(_0x56b494,0xc9))[_0x681b('0x40')](handleError(_0x56b494,null));};exports[_0x681b('0x47')]=function(_0x16e63f,_0x5ade36){if(_0x16e63f[_0x681b('0x46')]['id']){delete _0x16e63f[_0x681b('0x46')]['id'];}return db[_0x681b('0x29')]['find']({'where':{'id':_0x16e63f[_0x681b('0x42')]['id']}})[_0x681b('0x24')](handleEntityNotFound(_0x5ade36,null))[_0x681b('0x24')](saveUpdates(_0x16e63f[_0x681b('0x46')],null))[_0x681b('0x24')](respondWithResult(_0x5ade36,null))['catch'](handleError(_0x5ade36,null));};exports[_0x681b('0x48')]=function(_0x4b6654,_0x492c34){return db['JscriptyAnswerReport'][_0x681b('0x49')]({'where':{'id':_0x4b6654[_0x681b('0x42')]['id']}})[_0x681b('0x24')](handleEntityNotFound(_0x492c34,null))[_0x681b('0x24')](removeEntity(_0x492c34,null))[_0x681b('0x40')](handleError(_0x492c34,null));};exports[_0x681b('0x4a')]=function(_0x3b7bad,_0x80574d){return db[_0x681b('0x29')]['describe']()[_0x681b('0x24')](respondWithResult(_0x80574d,null))['catch'](handleError(_0x80574d,null));}; \ No newline at end of file +var _0xc1b3=['pick','filter','merge','options','JscriptyAnswerReport','includeAll','include','findAll','catch','show','params','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xc1b3,0xa1));var _0x3c1b=function(_0x436830,_0x96b01){_0x436830=_0x436830-0x0;var _0x443bad=_0xc1b3[_0x436830];return _0x443bad;};'use strict';var pdf=require(_0x3c1b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3c1b('0x1'));var zipdir=require(_0x3c1b('0x2'));var jsonpatch=require(_0x3c1b('0x3'));var rp=require(_0x3c1b('0x4'));var moment=require('moment');var BPromise=require(_0x3c1b('0x5'));var Mustache=require(_0x3c1b('0x6'));var util=require(_0x3c1b('0x7'));var path=require(_0x3c1b('0x8'));var sox=require(_0x3c1b('0x9'));var csv=require(_0x3c1b('0xa'));var ejs=require(_0x3c1b('0xb'));var fs=require('fs');var _=require(_0x3c1b('0xc'));var squel=require('squel');var crypto=require(_0x3c1b('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3c1b('0xe'));var Papa=require(_0x3c1b('0xf'));var Redis=require('ioredis');var authService=require(_0x3c1b('0x10'));var qs=require(_0x3c1b('0x11'));var as=require(_0x3c1b('0x12'));var hardwareService=require(_0x3c1b('0x13'));var logger=require(_0x3c1b('0x14'))('api');var utils=require(_0x3c1b('0x15'));var config=require(_0x3c1b('0x16'));var db=require(_0x3c1b('0x17'))['db'];function respondWithStatusCode(_0x2fa331,_0x2b7c68){_0x2b7c68=_0x2b7c68||0xcc;return function(_0x398e2b){if(_0x398e2b){return _0x2fa331[_0x3c1b('0x18')](_0x2b7c68);}return _0x2fa331['status'](_0x2b7c68)[_0x3c1b('0x19')]();};}function respondWithResult(_0x2654ca,_0x294479){_0x294479=_0x294479||0xc8;return function(_0x50f053){if(_0x50f053){return _0x2654ca[_0x3c1b('0x1a')](_0x294479)[_0x3c1b('0x1b')](_0x50f053);}};}function respondWithFilteredResult(_0x24e17a,_0x1f5afa){return function(_0x387aa3){if(_0x387aa3){var _0xb6baf2=_0x387aa3[_0x3c1b('0x1c')],_0x4b8d5d=_0x1f5afa[_0x3c1b('0x1d')],_0x3c8e94=_0x1f5afa[_0x3c1b('0x1d')]+_0x1f5afa[_0x3c1b('0x1e')],_0x567d17;if(_0x3c8e94>=_0xb6baf2){_0x3c8e94=_0xb6baf2;_0x567d17=0xc8;}else{_0x567d17=0xce;}_0x24e17a[_0x3c1b('0x1a')](_0x567d17);return _0x24e17a[_0x3c1b('0x1f')](_0x3c1b('0x20'),_0x4b8d5d+'-'+_0x3c8e94+'/'+_0xb6baf2)[_0x3c1b('0x1b')](_0x387aa3);}return null;};}function patchUpdates(_0x5028a3){return function(_0x33e467){try{jsonpatch[_0x3c1b('0x21')](_0x33e467,_0x5028a3,!![]);}catch(_0x3d8a84){return BPromise[_0x3c1b('0x22')](_0x3d8a84);}return _0x33e467['save']();};}function saveUpdates(_0x2f5abb,_0x512647){return function(_0x1ee411){if(_0x1ee411){return _0x1ee411[_0x3c1b('0x23')](_0x2f5abb)['then'](function(_0x56c444){return _0x56c444;});}return null;};}function removeEntity(_0x3f56c6,_0x5ddca4){return function(_0x36dc78){if(_0x36dc78){return _0x36dc78[_0x3c1b('0x24')]()[_0x3c1b('0x25')](function(){_0x3f56c6[_0x3c1b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43fc00,_0x568ba3){return function(_0x18d033){if(!_0x18d033){_0x43fc00[_0x3c1b('0x18')](0x194);}return _0x18d033;};}function handleError(_0x565b8d,_0x2150a3){_0x2150a3=_0x2150a3||0x1f4;return function(_0x346f84){logger[_0x3c1b('0x26')](_0x346f84['stack']);if(_0x346f84[_0x3c1b('0x27')]){delete _0x346f84[_0x3c1b('0x27')];}_0x565b8d[_0x3c1b('0x1a')](_0x2150a3)[_0x3c1b('0x28')](_0x346f84);};}exports['index']=function(_0x2154a7,_0x55aa75){var _0x36dbbd={},_0x327bd1={},_0xe717fc={'count':0x0,'rows':[]};var _0x463e28=_[_0x3c1b('0x29')](db['JscriptyAnswerReport'][_0x3c1b('0x2a')],function(_0x30c211){return{'name':_0x30c211[_0x3c1b('0x2b')],'type':_0x30c211[_0x3c1b('0x2c')][_0x3c1b('0x2d')]};});_0x327bd1[_0x3c1b('0x2e')]=_[_0x3c1b('0x29')](_0x463e28,'name');_0x327bd1['query']=_[_0x3c1b('0x2f')](_0x2154a7[_0x3c1b('0x30')]);_0x327bd1[_0x3c1b('0x31')]=_[_0x3c1b('0x32')](_0x327bd1[_0x3c1b('0x2e')],_0x327bd1[_0x3c1b('0x30')]);_0x36dbbd[_0x3c1b('0x33')]=_[_0x3c1b('0x32')](_0x327bd1[_0x3c1b('0x2e')],qs[_0x3c1b('0x34')](_0x2154a7[_0x3c1b('0x30')]['fields']));_0x36dbbd[_0x3c1b('0x33')]=_0x36dbbd[_0x3c1b('0x33')][_0x3c1b('0x35')]?_0x36dbbd[_0x3c1b('0x33')]:_0x327bd1['model'];if(!_0x2154a7[_0x3c1b('0x30')]['hasOwnProperty'](_0x3c1b('0x36'))){_0x36dbbd[_0x3c1b('0x1e')]=qs[_0x3c1b('0x1e')](_0x2154a7[_0x3c1b('0x30')][_0x3c1b('0x1e')]);_0x36dbbd['offset']=qs[_0x3c1b('0x1d')](_0x2154a7[_0x3c1b('0x30')]['offset']);}_0x36dbbd[_0x3c1b('0x37')]=qs[_0x3c1b('0x38')](_0x2154a7[_0x3c1b('0x30')][_0x3c1b('0x38')]);_0x36dbbd[_0x3c1b('0x39')]=qs[_0x3c1b('0x31')](_[_0x3c1b('0x3a')](_0x2154a7[_0x3c1b('0x30')],_0x327bd1[_0x3c1b('0x31')]),_0x463e28);if(_0x2154a7[_0x3c1b('0x30')][_0x3c1b('0x3b')]){_0x36dbbd[_0x3c1b('0x39')]=_[_0x3c1b('0x3c')](_0x36dbbd['where'],{'$or':_[_0x3c1b('0x29')](_0x463e28,function(_0x1c65fc){if(_0x1c65fc[_0x3c1b('0x2c')]!=='VIRTUAL'){var _0x137716={};_0x137716[_0x1c65fc['name']]={'$like':'%'+_0x2154a7['query'][_0x3c1b('0x3b')]+'%'};return _0x137716;}})});}_0x36dbbd=_[_0x3c1b('0x3c')]({},_0x36dbbd,_0x2154a7[_0x3c1b('0x3d')]);var _0xfd92fd={'where':_0x36dbbd[_0x3c1b('0x39')]};return db[_0x3c1b('0x3e')][_0x3c1b('0x1c')](_0xfd92fd)['then'](function(_0x1910bd){_0xe717fc[_0x3c1b('0x1c')]=_0x1910bd;if(_0x2154a7[_0x3c1b('0x30')][_0x3c1b('0x3f')]){_0x36dbbd[_0x3c1b('0x40')]=[{'all':!![]}];}return db[_0x3c1b('0x3e')][_0x3c1b('0x41')](_0x36dbbd);})[_0x3c1b('0x25')](function(_0x140fed){_0xe717fc['rows']=_0x140fed;return _0xe717fc;})[_0x3c1b('0x25')](respondWithFilteredResult(_0x55aa75,_0x36dbbd))[_0x3c1b('0x42')](handleError(_0x55aa75,null));};exports[_0x3c1b('0x43')]=function(_0x28e880,_0x332bb9){var _0x3fc878={'raw':!![],'where':{'id':_0x28e880[_0x3c1b('0x44')]['id']}},_0x5b225f={};_0x5b225f[_0x3c1b('0x2e')]=_[_0x3c1b('0x2f')](db[_0x3c1b('0x3e')][_0x3c1b('0x2a')]);_0x5b225f['query']=_[_0x3c1b('0x2f')](_0x28e880[_0x3c1b('0x30')]);_0x5b225f['filters']=_[_0x3c1b('0x32')](_0x5b225f[_0x3c1b('0x2e')],_0x5b225f[_0x3c1b('0x30')]);_0x3fc878[_0x3c1b('0x33')]=_['intersection'](_0x5b225f[_0x3c1b('0x2e')],qs['fields'](_0x28e880[_0x3c1b('0x30')][_0x3c1b('0x34')]));_0x3fc878[_0x3c1b('0x33')]=_0x3fc878[_0x3c1b('0x33')][_0x3c1b('0x35')]?_0x3fc878[_0x3c1b('0x33')]:_0x5b225f['model'];if(_0x28e880[_0x3c1b('0x30')]['includeAll']){_0x3fc878['include']=[{'all':!![]}];}_0x3fc878=_[_0x3c1b('0x3c')]({},_0x3fc878,_0x28e880['options']);return db[_0x3c1b('0x3e')][_0x3c1b('0x45')](_0x3fc878)['then'](handleEntityNotFound(_0x332bb9,null))[_0x3c1b('0x25')](respondWithResult(_0x332bb9,null))[_0x3c1b('0x42')](handleError(_0x332bb9,null));};exports[_0x3c1b('0x46')]=function(_0x5ac82f,_0x210862){return db[_0x3c1b('0x3e')][_0x3c1b('0x46')](_0x5ac82f[_0x3c1b('0x47')],{})[_0x3c1b('0x25')](respondWithResult(_0x210862,0xc9))[_0x3c1b('0x42')](handleError(_0x210862,null));};exports[_0x3c1b('0x23')]=function(_0x29d6c4,_0x10464e){if(_0x29d6c4[_0x3c1b('0x47')]['id']){delete _0x29d6c4[_0x3c1b('0x47')]['id'];}return db[_0x3c1b('0x3e')][_0x3c1b('0x45')]({'where':{'id':_0x29d6c4[_0x3c1b('0x44')]['id']}})[_0x3c1b('0x25')](handleEntityNotFound(_0x10464e,null))[_0x3c1b('0x25')](saveUpdates(_0x29d6c4[_0x3c1b('0x47')],null))[_0x3c1b('0x25')](respondWithResult(_0x10464e,null))['catch'](handleError(_0x10464e,null));};exports[_0x3c1b('0x24')]=function(_0xc8def6,_0x21d4ca){return db[_0x3c1b('0x3e')][_0x3c1b('0x45')]({'where':{'id':_0xc8def6['params']['id']}})[_0x3c1b('0x25')](handleEntityNotFound(_0x21d4ca,null))[_0x3c1b('0x25')](removeEntity(_0x21d4ca,null))[_0x3c1b('0x42')](handleError(_0x21d4ca,null));};exports[_0x3c1b('0x48')]=function(_0x182b4f,_0x41a477){return db[_0x3c1b('0x3e')]['describe']()[_0x3c1b('0x25')](respondWithResult(_0x41a477,null))['catch'](handleError(_0x41a477,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 7017063..3f7b381 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 _0x5c7b=['exports','define','JscriptyAnswerReport','report_jscripty_answers','api','moment','path','rimraf','./jscriptyAnswerReport.attributes'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x5c7b,0x1cf));var _0xb5c7=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x5c7b[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb5c7('0x0'));var moment=require(_0xb5c7('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb5c7('0x2'));var rimraf=require(_0xb5c7('0x3'));var config=require('../../config/environment');var attributes=require(_0xb5c7('0x4'));module[_0xb5c7('0x5')]=function(_0x3f6cc3,_0x4329e0){return _0x3f6cc3[_0xb5c7('0x6')](_0xb5c7('0x7'),attributes,{'tableName':_0xb5c7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc3c=['report_jscripty_answers','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','JscriptyAnswerReport'];(function(_0x36b704,_0x1e8f31){var _0x2f0bc3=function(_0x4a4a23){while(--_0x4a4a23){_0x36b704['push'](_0x36b704['shift']());}};_0x2f0bc3(++_0x1e8f31);}(_0xcc3c,0x1e1));var _0xccc3=function(_0x57d058,_0x56b505){_0x57d058=_0x57d058-0x0;var _0x26cfc9=_0xcc3c[_0x57d058];return _0x26cfc9;};'use strict';var _=require(_0xccc3('0x0'));var util=require(_0xccc3('0x1'));var logger=require('../../config/logger')(_0xccc3('0x2'));var moment=require(_0xccc3('0x3'));var BPromise=require(_0xccc3('0x4'));var rp=require(_0xccc3('0x5'));var fs=require('fs');var path=require(_0xccc3('0x6'));var rimraf=require('rimraf');var config=require(_0xccc3('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x2591a1,_0x2b034b){return _0x2591a1['define'](_0xccc3('0x8'),attributes,{'tableName':_0xccc3('0x9'),'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 a3f4cd8..7f90f09 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 _0xda40=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','moment','randomstring'];(function(_0x10de8b,_0x1908b6){var _0x5b8236=function(_0x129f3a){while(--_0x129f3a){_0x10de8b['push'](_0x10de8b['shift']());}};_0x5b8236(++_0x1908b6);}(_0xda40,0xb1));var _0x0da4=function(_0x317c62,_0x26e37e){_0x317c62=_0x317c62-0x0;var _0x3bd6ce=_0xda40[_0x317c62];return _0x3bd6ce;};'use strict';var _=require(_0x0da4('0x0'));var util=require('util');var moment=require(_0x0da4('0x1'));var BPromise=require('bluebird');var rs=require(_0x0da4('0x2'));var fs=require('fs');var Redis=require(_0x0da4('0x3'));var db=require(_0x0da4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0da4('0x5'))(_0x0da4('0x6'));var config=require(_0x0da4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0da4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13e89d,_0x2c395c,_0x46a5de){return new BPromise(function(_0x86023d,_0x345f58){return client[_0x0da4('0x9')](_0x13e89d,_0x46a5de)['then'](function(_0xdbe6a1){logger['info'](_0x0da4('0xa'),_0x2c395c,_0x0da4('0xb'));logger[_0x0da4('0xc')](_0x0da4('0xd'),_0x2c395c,_0x0da4('0xb'),JSON[_0x0da4('0xe')](_0xdbe6a1));if(_0xdbe6a1['error']){if(_0xdbe6a1[_0x0da4('0xf')]['code']===0x1f4){logger[_0x0da4('0xf')](_0x0da4('0xa'),_0x2c395c,_0xdbe6a1[_0x0da4('0xf')][_0x0da4('0x10')]);return _0x345f58(_0xdbe6a1['error'][_0x0da4('0x10')]);}logger['error'](_0x0da4('0xa'),_0x2c395c,_0xdbe6a1[_0x0da4('0xf')][_0x0da4('0x10')]);return _0x86023d(_0xdbe6a1['error'][_0x0da4('0x10')]);}else{logger[_0x0da4('0x11')](_0x0da4('0xa'),_0x2c395c,_0x0da4('0xb'));_0x86023d(_0xdbe6a1[_0x0da4('0x12')][_0x0da4('0x10')]);}})[_0x0da4('0x13')](function(_0x511b7b){logger['error'](_0x0da4('0xa'),_0x2c395c,_0x511b7b);_0x345f58(_0x511b7b);});});} \ No newline at end of file +var _0x099e=['../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../config/logger','rpc'];(function(_0x5d7ee6,_0x213374){var _0x338267=function(_0x5d83fc){while(--_0x5d83fc){_0x5d7ee6['push'](_0x5d7ee6['shift']());}};_0x338267(++_0x213374);}(_0x099e,0xc0));var _0xe099=function(_0x42a545,_0xe23d61){_0x42a545=_0x42a545-0x0;var _0xeb21ae=_0x099e[_0x42a545];return _0xeb21ae;};'use strict';var _=require(_0xe099('0x0'));var util=require(_0xe099('0x1'));var moment=require(_0xe099('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe099('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe099('0x4'))(_0xe099('0x5'));var config=require(_0xe099('0x6'));var jayson=require(_0xe099('0x7'));var client=jayson['client'][_0xe099('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5aba29,_0x347332,_0x622d9f){return new BPromise(function(_0x3bdb15,_0x2a05d8){return client[_0xe099('0x9')](_0x5aba29,_0x622d9f)[_0xe099('0xa')](function(_0x20d4c2){logger[_0xe099('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x347332,_0xe099('0xc'));logger[_0xe099('0xd')](_0xe099('0xe'),_0x347332,_0xe099('0xc'),JSON[_0xe099('0xf')](_0x20d4c2));if(_0x20d4c2[_0xe099('0x10')]){if(_0x20d4c2[_0xe099('0x10')][_0xe099('0x11')]===0x1f4){logger['error'](_0xe099('0x12'),_0x347332,_0x20d4c2[_0xe099('0x10')][_0xe099('0x13')]);return _0x2a05d8(_0x20d4c2[_0xe099('0x10')][_0xe099('0x13')]);}logger[_0xe099('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x347332,_0x20d4c2['error'][_0xe099('0x13')]);return _0x3bdb15(_0x20d4c2[_0xe099('0x10')][_0xe099('0x13')]);}else{logger[_0xe099('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x347332,_0xe099('0xc'));_0x3bdb15(_0x20d4c2[_0xe099('0x14')]['message']);}})[_0xe099('0x15')](function(_0x47e14f){logger[_0xe099('0x10')](_0xe099('0x12'),_0x347332,_0x47e14f);_0x2a05d8(_0x47e14f);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 8416367..a8a84f8 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 _0xfb37=['./jscriptyProject.controller','get','index','/:id','show','/:id/sessions','isAuthenticated','getSessions','/:id/answers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x272f25,_0x50fa1c){var _0x2db75d=function(_0x56f8c6){while(--_0x56f8c6){_0x272f25['push'](_0x272f25['shift']());}};_0x2db75d(++_0x50fa1c);}(_0xfb37,0x164));var _0x7fb3=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xfb37[_0x12f688];return _0x59c3de;};'use strict';var multer=require('multer');var util=require(_0x7fb3('0x0'));var path=require(_0x7fb3('0x1'));var timeout=require(_0x7fb3('0x2'));var express=require(_0x7fb3('0x3'));var router=express[_0x7fb3('0x4')]();var auth=require(_0x7fb3('0x5'));var interaction=require(_0x7fb3('0x6'));var config=require(_0x7fb3('0x7'));var controller=require(_0x7fb3('0x8'));router[_0x7fb3('0x9')]('/',auth['isAuthenticated'](),controller[_0x7fb3('0xa')]);router[_0x7fb3('0x9')](_0x7fb3('0xb'),auth['isAuthenticated'](),controller[_0x7fb3('0xc')]);router[_0x7fb3('0x9')](_0x7fb3('0xd'),auth[_0x7fb3('0xe')](),controller[_0x7fb3('0xf')]);router[_0x7fb3('0x9')](_0x7fb3('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x7fb3('0x9')](_0x7fb3('0x11'),auth[_0x7fb3('0xe')](),timeout(_0x7fb3('0x12')),controller[_0x7fb3('0x13')]);router[_0x7fb3('0x14')]('/',auth[_0x7fb3('0xe')](),controller[_0x7fb3('0x15')]);router[_0x7fb3('0x14')](_0x7fb3('0x16'),auth[_0x7fb3('0xe')](),controller[_0x7fb3('0x17')]);router['put'](_0x7fb3('0xb'),auth[_0x7fb3('0xe')](),controller['update']);router[_0x7fb3('0x18')]('/:id',auth[_0x7fb3('0xe')](),controller['destroy']);module[_0x7fb3('0x19')]=router; \ No newline at end of file +var _0xa81d=['connect-timeout','express','Router','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','update','delete','destroy','multer','util','path'];(function(_0x5d210d,_0x4843c7){var _0xb0e722=function(_0x244a1f){while(--_0x244a1f){_0x5d210d['push'](_0x5d210d['shift']());}};_0xb0e722(++_0x4843c7);}(_0xa81d,0x135));var _0xda81=function(_0x169585,_0x476cc6){_0x169585=_0x169585-0x0;var _0x5cf666=_0xa81d[_0x169585];return _0x5cf666;};'use strict';var multer=require(_0xda81('0x0'));var util=require(_0xda81('0x1'));var path=require(_0xda81('0x2'));var timeout=require(_0xda81('0x3'));var express=require(_0xda81('0x4'));var router=express[_0xda81('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xda81('0x6'));var controller=require(_0xda81('0x7'));router[_0xda81('0x8')]('/',auth[_0xda81('0x9')](),controller['index']);router[_0xda81('0x8')](_0xda81('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xda81('0x8')]('/:id/sessions',auth[_0xda81('0x9')](),controller[_0xda81('0xb')]);router['get'](_0xda81('0xc'),auth[_0xda81('0x9')](),controller[_0xda81('0xd')]);router['get'](_0xda81('0xe'),auth[_0xda81('0x9')](),timeout(_0xda81('0xf')),controller[_0xda81('0x10')]);router[_0xda81('0x11')]('/',auth['isAuthenticated'](),controller[_0xda81('0x12')]);router['post'](_0xda81('0x13'),auth[_0xda81('0x9')](),controller[_0xda81('0x14')]);router['put']('/:id',auth[_0xda81('0x9')](),controller[_0xda81('0x15')]);router[_0xda81('0x16')](_0xda81('0xa'),auth[_0xda81('0x9')](),controller[_0xda81('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 1a61e32..17a1924 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 _0xd368=['getDataValue','description','BOOLEAN','sequelize','exports','long','isObjectLike','setDataValue','formData','stringify','isString'];(function(_0x180393,_0x1982b6){var _0x219351=function(_0x22c4be){while(--_0x22c4be){_0x180393['push'](_0x180393['shift']());}};_0x219351(++_0x1982b6);}(_0xd368,0x10b));var _0x8d36=function(_0x48e6d6,_0x146763){_0x48e6d6=_0x48e6d6-0x0;var _0x239c71=_0xd368[_0x48e6d6];return _0x239c71;};'use strict';var Sequelize=require(_0x8d36('0x0'));var _=require('lodash');var util=require('util');module[_0x8d36('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x8d36('0x2')),'set':function(_0x3b3278){if(_[_0x8d36('0x3')](_0x3b3278)){this[_0x8d36('0x4')](_0x8d36('0x5'),JSON[_0x8d36('0x6')](_0x3b3278));}else if(_[_0x8d36('0x7')](_0x3b3278)){this[_0x8d36('0x4')](_0x8d36('0x5'),_0x3b3278);}else{this[_0x8d36('0x4')](_0x8d36('0x5'),util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x8d36('0x8')]('name')||'',this[_0x8d36('0x8')](_0x8d36('0x9'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x8d36('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0x2cdd=['formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','exports','STRING','TEXT','isObjectLike','setDataValue'];(function(_0x1e05c1,_0x3cffa3){var _0x15f1ca=function(_0x3a9594){while(--_0x3a9594){_0x1e05c1['push'](_0x1e05c1['shift']());}};_0x15f1ca(++_0x3cffa3);}(_0x2cdd,0x186));var _0xd2cd=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x2cdd[_0x500419];return _0x241c1a;};'use strict';var Sequelize=require(_0xd2cd('0x0'));var _=require('lodash');var util=require('util');module[_0xd2cd('0x1')]={'name':{'type':Sequelize[_0xd2cd('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xd2cd('0x2')]},'formData':{'type':Sequelize[_0xd2cd('0x3')]('long'),'set':function(_0x3ca902){if(_[_0xd2cd('0x4')](_0x3ca902)){this[_0xd2cd('0x5')](_0xd2cd('0x6'),JSON['stringify'](_0x3ca902));}else if(_['isString'](_0x3ca902)){this[_0xd2cd('0x5')](_0xd2cd('0x6'),_0x3ca902);}else{this[_0xd2cd('0x5')]('formData',util[_0xd2cd('0x7')](_0xd2cd('0x8'),this[_0xd2cd('0x9')]('name')||'',this[_0xd2cd('0x9')](_0xd2cd('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xd2cd('0xb')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 13d6244..9c8698e 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 _0xa715=['update','then','destroy','get','UserProfileResource','error','name','index','map','JscriptyProject','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Projects','userProfileId','params','getSessions','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','-createdAt','questionId','question','starttime','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x375db3,_0xf2438f){var _0x10a602=function(_0x570eb2){while(--_0x570eb2){_0x375db3['push'](_0x375db3['shift']());}};_0x10a602(++_0xf2438f);}(_0xa715,0x1bf));var _0x5a71=function(_0x18e96d,_0x116020){_0x18e96d=_0x18e96d-0x0;var _0x56feea=_0xa715[_0x18e96d];return _0x56feea;};'use strict';var pdf=require(_0x5a71('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5a71('0x1'));var jsonpatch=require(_0x5a71('0x2'));var rp=require(_0x5a71('0x3'));var moment=require(_0x5a71('0x4'));var BPromise=require(_0x5a71('0x5'));var Mustache=require('mustache');var util=require(_0x5a71('0x6'));var path=require(_0x5a71('0x7'));var sox=require(_0x5a71('0x8'));var csv=require(_0x5a71('0x9'));var ejs=require(_0x5a71('0xa'));var fs=require('fs');var _=require(_0x5a71('0xb'));var squel=require(_0x5a71('0xc'));var crypto=require(_0x5a71('0xd'));var jsforce=require(_0x5a71('0xe'));var deskjs=require(_0x5a71('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5a71('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5a71('0x11'));var qs=require(_0x5a71('0x12'));var as=require(_0x5a71('0x13'));var hardwareService=require(_0x5a71('0x14'));var logger=require(_0x5a71('0x15'))(_0x5a71('0x16'));var utils=require(_0x5a71('0x17'));var config=require(_0x5a71('0x18'));var db=require(_0x5a71('0x19'))['db'];function respondWithStatusCode(_0x2147d0,_0x487a19){_0x487a19=_0x487a19||0xcc;return function(_0x46c32c){if(_0x46c32c){return _0x2147d0[_0x5a71('0x1a')](_0x487a19);}return _0x2147d0['status'](_0x487a19)[_0x5a71('0x1b')]();};}function respondWithResult(_0x48d583,_0x5d7273){_0x5d7273=_0x5d7273||0xc8;return function(_0xbfa5e4){if(_0xbfa5e4){return _0x48d583[_0x5a71('0x1c')](_0x5d7273)[_0x5a71('0x1d')](_0xbfa5e4);}};}function respondWithFilteredResult(_0x4aa59d,_0x555785){return function(_0x4a771a){if(_0x4a771a){var _0x3007d8=_0x4a771a[_0x5a71('0x1e')],_0x2b8219=_0x555785[_0x5a71('0x1f')],_0x5e41b4=_0x555785[_0x5a71('0x1f')]+_0x555785[_0x5a71('0x20')],_0x3a3764;if(_0x5e41b4>=_0x3007d8){_0x5e41b4=_0x3007d8;_0x3a3764=0xc8;}else{_0x3a3764=0xce;}_0x4aa59d[_0x5a71('0x1c')](_0x3a3764);return _0x4aa59d[_0x5a71('0x21')](_0x5a71('0x22'),_0x2b8219+'-'+_0x5e41b4+'/'+_0x3007d8)[_0x5a71('0x1d')](_0x4a771a);}return null;};}function patchUpdates(_0x2f9086){return function(_0x2858f7){try{jsonpatch[_0x5a71('0x23')](_0x2858f7,_0x2f9086,!![]);}catch(_0x394c69){return BPromise[_0x5a71('0x24')](_0x394c69);}return _0x2858f7['save']();};}function saveUpdates(_0x2d452d,_0x1c1cc9){return function(_0x41b935){if(_0x41b935){return _0x41b935[_0x5a71('0x25')](_0x2d452d)[_0x5a71('0x26')](function(_0x354f6c){return _0x354f6c;});}return null;};}function removeEntity(_0x57f9fc,_0x34871c){return function(_0x3c196a){if(_0x3c196a){return _0x3c196a[_0x5a71('0x27')]()[_0x5a71('0x26')](function(){var _0x1b2572=_0x3c196a[_0x5a71('0x28')]({'plain':!![]});var _0x48517d='Projects';return db[_0x5a71('0x29')][_0x5a71('0x27')]({'where':{'type':_0x48517d,'resourceId':_0x1b2572['id']}})[_0x5a71('0x26')](function(){return _0x3c196a;});})[_0x5a71('0x26')](function(){_0x57f9fc[_0x5a71('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13f877,_0x15cf69){return function(_0xb1b920){if(!_0xb1b920){_0x13f877['sendStatus'](0x194);}return _0xb1b920;};}function handleError(_0x3a4036,_0x1bafb1){_0x1bafb1=_0x1bafb1||0x1f4;return function(_0x4ab58e){logger[_0x5a71('0x2a')](_0x4ab58e['stack']);if(_0x4ab58e[_0x5a71('0x2b')]){delete _0x4ab58e[_0x5a71('0x2b')];}_0x3a4036[_0x5a71('0x1c')](_0x1bafb1)['send'](_0x4ab58e);};}exports[_0x5a71('0x2c')]=function(_0x1b1864,_0x31b9fd){var _0x68a368={},_0x257668={},_0x5cf182={'count':0x0,'rows':[]};var _0x28a53d=_[_0x5a71('0x2d')](db[_0x5a71('0x2e')][_0x5a71('0x2f')],function(_0x1aca88){return{'name':_0x1aca88[_0x5a71('0x30')],'type':_0x1aca88['type'][_0x5a71('0x31')]};});_0x257668['model']=_[_0x5a71('0x2d')](_0x28a53d,_0x5a71('0x2b'));_0x257668[_0x5a71('0x32')]=_[_0x5a71('0x33')](_0x1b1864[_0x5a71('0x32')]);_0x257668[_0x5a71('0x34')]=_[_0x5a71('0x35')](_0x257668[_0x5a71('0x36')],_0x257668[_0x5a71('0x32')]);_0x68a368[_0x5a71('0x37')]=_[_0x5a71('0x35')](_0x257668['model'],qs[_0x5a71('0x38')](_0x1b1864[_0x5a71('0x32')][_0x5a71('0x38')]));_0x68a368[_0x5a71('0x37')]=_0x68a368[_0x5a71('0x37')][_0x5a71('0x39')]?_0x68a368[_0x5a71('0x37')]:_0x257668[_0x5a71('0x36')];if(!_0x1b1864[_0x5a71('0x32')][_0x5a71('0x3a')](_0x5a71('0x3b'))){_0x68a368[_0x5a71('0x20')]=qs['limit'](_0x1b1864[_0x5a71('0x32')][_0x5a71('0x20')]);_0x68a368[_0x5a71('0x1f')]=qs[_0x5a71('0x1f')](_0x1b1864[_0x5a71('0x32')][_0x5a71('0x1f')]);}_0x68a368[_0x5a71('0x3c')]=qs[_0x5a71('0x3d')](_0x1b1864['query']['sort']);_0x68a368[_0x5a71('0x3e')]=qs[_0x5a71('0x34')](_[_0x5a71('0x3f')](_0x1b1864[_0x5a71('0x32')],_0x257668[_0x5a71('0x34')]),_0x28a53d);if(_0x1b1864['query'][_0x5a71('0x40')]){_0x68a368[_0x5a71('0x3e')]=_[_0x5a71('0x41')](_0x68a368['where'],{'$or':_['map'](_0x28a53d,function(_0x54bed3){if(_0x54bed3[_0x5a71('0x42')]!==_0x5a71('0x43')){var _0x5ce394={};_0x5ce394[_0x54bed3[_0x5a71('0x2b')]]={'$like':'%'+_0x1b1864[_0x5a71('0x32')][_0x5a71('0x40')]+'%'};return _0x5ce394;}})});}_0x68a368=_[_0x5a71('0x41')]({},_0x68a368,_0x1b1864[_0x5a71('0x44')]);var _0x17c001={'where':_0x68a368[_0x5a71('0x3e')]};return db[_0x5a71('0x2e')]['count'](_0x17c001)[_0x5a71('0x26')](function(_0x4bf125){_0x5cf182[_0x5a71('0x1e')]=_0x4bf125;if(_0x1b1864[_0x5a71('0x32')][_0x5a71('0x45')]){_0x68a368[_0x5a71('0x46')]=[{'all':!![]}];}return db[_0x5a71('0x2e')][_0x5a71('0x47')](_0x68a368);})[_0x5a71('0x26')](function(_0x50b232){_0x5cf182[_0x5a71('0x48')]=_0x50b232;return _0x5cf182;})[_0x5a71('0x26')](respondWithFilteredResult(_0x31b9fd,_0x68a368))['catch'](handleError(_0x31b9fd,null));};exports['show']=function(_0x40dba4,_0x5af420){var _0x39a00c={'raw':![],'where':{'id':_0x40dba4['params']['id']}},_0x18897d={};_0x18897d[_0x5a71('0x36')]=_[_0x5a71('0x33')](db[_0x5a71('0x2e')][_0x5a71('0x2f')]);_0x18897d[_0x5a71('0x32')]=_[_0x5a71('0x33')](_0x40dba4[_0x5a71('0x32')]);_0x18897d[_0x5a71('0x34')]=_[_0x5a71('0x35')](_0x18897d['model'],_0x18897d['query']);_0x39a00c[_0x5a71('0x37')]=_[_0x5a71('0x35')](_0x18897d[_0x5a71('0x36')],qs[_0x5a71('0x38')](_0x40dba4[_0x5a71('0x32')]['fields']));_0x39a00c[_0x5a71('0x37')]=_0x39a00c['attributes']['length']?_0x39a00c[_0x5a71('0x37')]:_0x18897d[_0x5a71('0x36')];if(_0x40dba4[_0x5a71('0x32')][_0x5a71('0x45')]){_0x39a00c['include']=[{'all':!![]}];}_0x39a00c=_[_0x5a71('0x41')]({},_0x39a00c,_0x40dba4[_0x5a71('0x44')]);return db[_0x5a71('0x2e')][_0x5a71('0x49')](_0x39a00c)[_0x5a71('0x26')](handleEntityNotFound(_0x5af420,null))[_0x5a71('0x26')](respondWithResult(_0x5af420,null))[_0x5a71('0x4a')](handleError(_0x5af420,null));};exports['create']=function(_0x4e1a80,_0x45a1d0){return db[_0x5a71('0x2e')][_0x5a71('0x4b')](_0x4e1a80[_0x5a71('0x4c')],{})['then'](function(_0x3a669b){var _0x4802fe=_0x4e1a80[_0x5a71('0x4d')]['get']({'plain':!![]});if(!_0x4802fe)throw new Error(_0x5a71('0x4e'));if(_0x4802fe[_0x5a71('0x4f')]===_0x5a71('0x4d')){var _0x5d53b5=_0x3a669b['get']({'plain':!![]});var _0xef0610='Projects';return db[_0x5a71('0x50')][_0x5a71('0x49')]({'where':{'name':_0xef0610,'userProfileId':_0x4802fe['userProfileId']},'raw':!![]})[_0x5a71('0x26')](function(_0x1b92ab){if(_0x1b92ab&&_0x1b92ab[_0x5a71('0x51')]===0x0){return db[_0x5a71('0x29')][_0x5a71('0x4b')]({'name':_0x5d53b5['name'],'resourceId':_0x5d53b5['id'],'type':_0x1b92ab[_0x5a71('0x2b')],'sectionId':_0x1b92ab['id']},{})['then'](function(){return _0x3a669b;});}else{return _0x3a669b;}})[_0x5a71('0x4a')](function(_0xc07f07){logger[_0x5a71('0x2a')](_0x5a71('0x52'),_0xc07f07);throw _0xc07f07;});}return _0x3a669b;})[_0x5a71('0x26')](respondWithResult(_0x45a1d0,0xc9))[_0x5a71('0x4a')](handleError(_0x45a1d0,null));};exports[_0x5a71('0x53')]=function(_0x4b3395,_0x1f02f4){var _0x908efd={'where':{'id':_0x4b3395['params']['id']}},_0x132d4f={};_0x132d4f['model']=_[_0x5a71('0x33')](db[_0x5a71('0x2e')][_0x5a71('0x2f')]);_0x908efd[_0x5a71('0x37')]=_[_0x5a71('0x35')](_0x132d4f[_0x5a71('0x36')],qs[_0x5a71('0x38')](_0x4b3395[_0x5a71('0x32')]['fields']));_0x908efd[_0x5a71('0x37')]=_0x908efd[_0x5a71('0x37')]['length']?_0x908efd[_0x5a71('0x37')]:_0x132d4f['model'];if(_0x4b3395[_0x5a71('0x32')][_0x5a71('0x45')]){_0x908efd[_0x5a71('0x46')]=[{'all':!![]}];}_0x908efd=_[_0x5a71('0x41')]({},_0x908efd,_0x4b3395[_0x5a71('0x44')]);return db['JscriptyProject'][_0x5a71('0x49')](_0x908efd)['then'](handleEntityNotFound(_0x1f02f4,null))[_0x5a71('0x26')](function(_0x585b71){if(_0x585b71){var _0x78ed41=_0x585b71[_0x5a71('0x28')]({'plain':!![]});_0x78ed41=qs[_0x5a71('0x54')](_0x78ed41,['id','createdAt','updatedAt']);_0x4b3395[_0x5a71('0x4c')]=_[_0x5a71('0x54')](_0x4b3395[_0x5a71('0x4c')],['id',_0x5a71('0x55'),_0x5a71('0x56')]);return db[_0x5a71('0x2e')][_0x5a71('0x4b')](_[_0x5a71('0x41')](_0x78ed41,_0x4b3395['body']),{'include':_0x4b3395[_0x5a71('0x32')]['includeAll']?[{'all':!![]}]:undefined})[_0x5a71('0x26')](function(_0x4c4b40){var _0x4eb24f=_0x4b3395[_0x5a71('0x4d')][_0x5a71('0x28')]({'plain':!![]});if(!_0x4eb24f)throw new Error(_0x5a71('0x4e'));if(_0x4eb24f[_0x5a71('0x4f')]===_0x5a71('0x4d')){var _0x3b8dcd=_0x4c4b40['get']({'plain':!![]});var _0x15f4c5=_0x5a71('0x57');return db[_0x5a71('0x50')][_0x5a71('0x49')]({'where':{'name':_0x15f4c5,'userProfileId':_0x4eb24f[_0x5a71('0x58')]},'raw':!![]})[_0x5a71('0x26')](function(_0x487862){if(_0x487862&&_0x487862[_0x5a71('0x51')]===0x0){return db['UserProfileResource'][_0x5a71('0x4b')]({'name':_0x3b8dcd['name'],'resourceId':_0x3b8dcd['id'],'type':_0x487862[_0x5a71('0x2b')],'sectionId':_0x487862['id']},{})[_0x5a71('0x26')](function(){return _0x4c4b40;});}else{return _0x4c4b40;}})[_0x5a71('0x4a')](function(_0x1daeb9){logger[_0x5a71('0x2a')](_0x5a71('0x52'),_0x1daeb9);throw _0x1daeb9;});}return _0x4c4b40;});}})['then'](respondWithResult(_0x1f02f4,0xc9))[_0x5a71('0x4a')](handleError(_0x1f02f4,null));};exports['update']=function(_0x186e7b,_0x279439){if(_0x186e7b[_0x5a71('0x4c')]['id']){delete _0x186e7b[_0x5a71('0x4c')]['id'];}return db[_0x5a71('0x2e')]['find']({'where':{'id':_0x186e7b[_0x5a71('0x59')]['id']}})[_0x5a71('0x26')](handleEntityNotFound(_0x279439,null))['then'](saveUpdates(_0x186e7b[_0x5a71('0x4c')],null))[_0x5a71('0x26')](respondWithResult(_0x279439,null))['catch'](handleError(_0x279439,null));};exports[_0x5a71('0x27')]=function(_0x42b56e,_0x5696d5){return db[_0x5a71('0x2e')][_0x5a71('0x49')]({'where':{'id':_0x42b56e[_0x5a71('0x59')]['id']}})[_0x5a71('0x26')](handleEntityNotFound(_0x5696d5,null))['then'](removeEntity(_0x5696d5,null))['catch'](handleError(_0x5696d5,null));};exports[_0x5a71('0x5a')]=function(_0xcc49ce,_0x47b1af,_0x25f568){var _0x4babe6={'raw':!![],'where':{}};var _0xf81ca4={};var _0x303255={'count':0x0,'rows':[]};return db[_0x5a71('0x2e')][_0x5a71('0x5b')]({'where':{'id':_0xcc49ce[_0x5a71('0x59')]['id']}})[_0x5a71('0x26')](handleEntityNotFound(_0x47b1af,null))['then'](function(_0x30be49){if(_0x30be49){_0xf81ca4[_0x5a71('0x36')]=_[_0x5a71('0x33')](db[_0x5a71('0x5c')][_0x5a71('0x2f')]);_0xf81ca4[_0x5a71('0x32')]=_[_0x5a71('0x33')](_0xcc49ce[_0x5a71('0x32')]);_0xf81ca4[_0x5a71('0x34')]=_[_0x5a71('0x35')](_0xf81ca4[_0x5a71('0x36')],_0xf81ca4['query']);_0x4babe6[_0x5a71('0x37')]=_[_0x5a71('0x35')](_0xf81ca4['model'],qs[_0x5a71('0x38')](_0xcc49ce[_0x5a71('0x32')][_0x5a71('0x38')]));_0x4babe6[_0x5a71('0x37')]=_0x4babe6[_0x5a71('0x37')][_0x5a71('0x39')]?_0x4babe6['attributes']:_0xf81ca4[_0x5a71('0x36')];if(!_0xcc49ce[_0x5a71('0x32')][_0x5a71('0x3a')](_0x5a71('0x3b'))){_0x4babe6[_0x5a71('0x20')]=qs['limit'](_0xcc49ce[_0x5a71('0x32')][_0x5a71('0x20')]);_0x4babe6[_0x5a71('0x1f')]=qs[_0x5a71('0x1f')](_0xcc49ce[_0x5a71('0x32')][_0x5a71('0x1f')]);}_0x4babe6['order']=qs[_0x5a71('0x3d')](_0xcc49ce['query']['sort']);_0x4babe6[_0x5a71('0x3e')]=qs['filters'](_[_0x5a71('0x3f')](_0xcc49ce['query'],_0xf81ca4['filters']));_0x4babe6['where'][_0x5a71('0x5d')]=_0x30be49['id'];if(_0xcc49ce[_0x5a71('0x32')][_0x5a71('0x40')]){_0x4babe6['where']=_[_0x5a71('0x41')](_0x4babe6[_0x5a71('0x3e')],{'$or':_[_0x5a71('0x2d')](_0x4babe6[_0x5a71('0x37')],function(_0x2c718c){var _0x580a8e={};_0x580a8e[_0x2c718c]={'$like':'%'+_0xcc49ce[_0x5a71('0x32')][_0x5a71('0x40')]+'%'};return _0x580a8e;})});}_0x4babe6=_[_0x5a71('0x41')]({},_0x4babe6,_0xcc49ce[_0x5a71('0x44')]);return db['JscriptySessionReport'][_0x5a71('0x1e')]({'where':_0x4babe6['where']})['then'](function(_0x1fcde0){_0x303255[_0x5a71('0x1e')]=_0x1fcde0;if(_0xcc49ce[_0x5a71('0x32')]['includeAll']){_0x4babe6[_0x5a71('0x46')]=[{'all':!![]}];}return db[_0x5a71('0x5c')][_0x5a71('0x47')](_0x4babe6);})[_0x5a71('0x26')](function(_0x4addb5){_0x303255[_0x5a71('0x48')]=_0x4addb5;return _0x303255;});}})[_0x5a71('0x26')](respondWithFilteredResult(_0x47b1af,_0x4babe6))[_0x5a71('0x4a')](handleError(_0x47b1af,null));};exports[_0x5a71('0x5e')]=function(_0x408125,_0x49fdef,_0x1dd69f){var _0x4bdfdf={'raw':!![],'where':{}};var _0x3544c9={};var _0x526526={'count':0x0,'rows':[]};return db[_0x5a71('0x2e')][_0x5a71('0x5b')]({'where':{'id':_0x408125[_0x5a71('0x59')]['id']}})[_0x5a71('0x26')](handleEntityNotFound(_0x49fdef,null))['then'](function(_0x294bbe){if(_0x294bbe){_0x3544c9[_0x5a71('0x36')]=_[_0x5a71('0x33')](db[_0x5a71('0x5f')][_0x5a71('0x2f')]);_0x3544c9['query']=_[_0x5a71('0x33')](_0x408125[_0x5a71('0x32')]);_0x3544c9[_0x5a71('0x34')]=_[_0x5a71('0x35')](_0x3544c9['model'],_0x3544c9[_0x5a71('0x32')]);_0x4bdfdf[_0x5a71('0x37')]=_[_0x5a71('0x35')](_0x3544c9[_0x5a71('0x36')],qs['fields'](_0x408125[_0x5a71('0x32')][_0x5a71('0x38')]));_0x4bdfdf['attributes']=_0x4bdfdf[_0x5a71('0x37')]['length']?_0x4bdfdf[_0x5a71('0x37')]:_0x3544c9[_0x5a71('0x36')];if(!_0x408125[_0x5a71('0x32')][_0x5a71('0x3a')](_0x5a71('0x3b'))){_0x4bdfdf[_0x5a71('0x20')]=qs[_0x5a71('0x20')](_0x408125['query'][_0x5a71('0x20')]);_0x4bdfdf[_0x5a71('0x1f')]=qs[_0x5a71('0x1f')](_0x408125[_0x5a71('0x32')]['offset']);}_0x4bdfdf[_0x5a71('0x3c')]=qs[_0x5a71('0x3d')](_0x408125[_0x5a71('0x32')][_0x5a71('0x3d')]);_0x4bdfdf[_0x5a71('0x3e')]=qs[_0x5a71('0x34')](_[_0x5a71('0x3f')](_0x408125[_0x5a71('0x32')],_0x3544c9[_0x5a71('0x34')]));_0x4bdfdf[_0x5a71('0x3e')]['ProjectId']=_0x294bbe['id'];if(_0x408125[_0x5a71('0x32')][_0x5a71('0x40')]){_0x4bdfdf['where']=_['merge'](_0x4bdfdf['where'],{'$or':_[_0x5a71('0x2d')](_0x4bdfdf[_0x5a71('0x37')],function(_0x5500fc){var _0xf1f881={};_0xf1f881[_0x5500fc]={'$like':'%'+_0x408125[_0x5a71('0x32')][_0x5a71('0x40')]+'%'};return _0xf1f881;})});}_0x4bdfdf=_[_0x5a71('0x41')]({},_0x4bdfdf,_0x408125[_0x5a71('0x44')]);return db['JscriptyAnswerReport'][_0x5a71('0x1e')]({'where':_0x4bdfdf[_0x5a71('0x3e')]})['then'](function(_0x52fead){_0x526526[_0x5a71('0x1e')]=_0x52fead;if(_0x408125[_0x5a71('0x32')]['includeAll']){_0x4bdfdf[_0x5a71('0x46')]=[{'all':!![]}];}return db[_0x5a71('0x5f')][_0x5a71('0x47')](_0x4bdfdf);})[_0x5a71('0x26')](function(_0x28aba2){_0x526526[_0x5a71('0x48')]=_0x28aba2;return _0x526526;});}})[_0x5a71('0x26')](respondWithFilteredResult(_0x49fdef,_0x4bdfdf))[_0x5a71('0x4a')](handleError(_0x49fdef,null));};function char(_0x22c905){return'number'===typeof _0x22c905?String[_0x5a71('0x60')][_0x5a71('0x23')](null,arguments):_0x22c905;}function needsEncapsulation(_0x243508){return!!_0x243508&&(_0x243508[_0x5a71('0x61')]()[_0x5a71('0x62')](char(0xd))>=0x0||_0x243508[_0x5a71('0x61')]()['indexOf'](char(0xa))>=0x0||_0x243508[_0x5a71('0x61')]()[_0x5a71('0x62')](char(0x2c))>=0x0||_0x243508['toString']()[_0x5a71('0x62')](char(0x22))>=0x0);}function encapsulate(_0x3778de){var _0x4ede30=char(0x22),_0x5c9d8e='\x5c'+char(0x22),_0x461118=_0x3778de[_0x5a71('0x61')]()[_0x5a71('0x63')](new RegExp(_0x4ede30,'g'),_0x5c9d8e);return _0x4ede30+_0x461118+_0x4ede30;}exports[_0x5a71('0x64')]=function(_0x2136be,_0x1c0d52,_0x18e0b9){var _0x301cca,_0x47e50b;var _0x4996b7={'where':{'ProjectId':_0x2136be[_0x5a71('0x59')]['id']}};if(_0x2136be[_0x5a71('0x32')][_0x5a71('0x65')]){_0x4996b7['where']['starttime']=JSON[_0x5a71('0x66')](_0x2136be['query'][_0x5a71('0x65')]);}return db['JscriptySessionReport'][_0x5a71('0x47')](_0x4996b7)[_0x5a71('0x26')](handleEntityNotFound(_0x1c0d52,null))['then'](function(_0x32f1cd){if(_0x32f1cd){_0x301cca=_0x32f1cd;return db['JscriptyQuestionReport'][_0x5a71('0x47')]({'where':{'SessionId':{'$in':_['map'](_0x301cca,'id')},'ProjectId':_0x2136be[_0x5a71('0x59')]['id']},'order':_0x5a71('0x67')});}})[_0x5a71('0x26')](handleEntityNotFound(_0x1c0d52,null))[_0x5a71('0x26')](function(_0x2d9bdb){if(_0x2d9bdb){_0x47e50b=_0x2d9bdb;var _0x12b6df={};for(var _0x22f59e=0x0,_0x2af499=_0x47e50b['length'];_0x22f59e<_0x2af499;_0x22f59e++){if(!_0x12b6df['hasOwnProperty'](_0x47e50b[_0x22f59e]['questionId'])){_0x12b6df[_0x47e50b[_0x22f59e][_0x5a71('0x68')]]=needsEncapsulation(_0x47e50b[_0x22f59e][_0x5a71('0x69')])?encapsulate(_0x47e50b[_0x22f59e][_0x5a71('0x69')]):_0x47e50b[_0x22f59e][_0x5a71('0x69')];}}var _0x2ea924=[],_0x2c897b={};for(var _0x11162b=0x0,_0x5751d1=_0x301cca['length'];_0x11162b<_0x5751d1;_0x11162b++){_0x2c897b={'ProjectId':_0x2136be[_0x5a71('0x59')]['id'],'SessionId':_0x301cca[_0x11162b]['id'],'StartTime':moment(_0x301cca[_0x11162b][_0x5a71('0x6a')])['format'](_0x5a71('0x6b'))};for(var _0x1b1765=0x0,_0xfd5587=_0x47e50b[_0x5a71('0x39')];_0x1b1765<_0xfd5587;_0x1b1765++){if(_0x47e50b[_0x1b1765][_0x5a71('0x6c')]==_0x301cca[_0x11162b]['id']&&_0x12b6df[_0x5a71('0x3a')](_0x47e50b[_0x1b1765][_0x5a71('0x68')])){_0x2c897b[_0x12b6df[_0x47e50b[_0x1b1765]['questionId']]]=_0x47e50b[_0x1b1765]['answer'];}}for(var _0x2e9419 in _0x12b6df){if(!_0x2c897b['hasOwnProperty'](_0x12b6df[_0x2e9419])){_0x2c897b[_0x12b6df[_0x2e9419]]=null;}}_0x2ea924[_0x5a71('0x6d')](_0x2c897b);}return _0x2ea924;}})[_0x5a71('0x26')](function(_0xcfec4d){if(!_[_0x5a71('0x6e')](_0xcfec4d)){var _0x2bd5ae=toCsv(_0xcfec4d);var _0xe8204f=Date[_0x5a71('0x6f')]();fs[_0x5a71('0x70')](util[_0x5a71('0x71')](_0x5a71('0x72'),_0x2136be[_0x5a71('0x59')]['id'],_0xe8204f),_0x2bd5ae);_0x1c0d52[_0x5a71('0x73')](_0x5a71('0x74'),_0x5a71('0x75')+util[_0x5a71('0x71')](_0x5a71('0x76'),_0x2136be[_0x5a71('0x59')]['id'],_0xe8204f));_0x1c0d52['setHeader'](_0x5a71('0x77'),'text/csv');return _0x1c0d52[_0x5a71('0x78')](util[_0x5a71('0x71')](_0x5a71('0x72'),_0x2136be[_0x5a71('0x59')]['id'],_0xe8204f));}else{return _0x1c0d52[_0x5a71('0x1a')](0xcc);}})[_0x5a71('0x4a')](handleError(_0x1c0d52,null));}; \ No newline at end of file +var _0x021b=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','save','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','index','map','JscriptyProject','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','clone','params','omit','createdAt','updatedAt','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','JscriptySessionReport','order','ProjectId','getAnswers','findOne','JscriptyAnswerReport','pick','indexOf','toString','replace','getSummary','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','answer','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x25662e,_0x4cec68){var _0x59b7bc=function(_0xafb159){while(--_0xafb159){_0x25662e['push'](_0x25662e['shift']());}};_0x59b7bc(++_0x4cec68);}(_0x021b,0x14c));var _0xb021=function(_0x514144,_0x1471ff){_0x514144=_0x514144-0x0;var _0x47b650=_0x021b[_0x514144];return _0x47b650;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb021('0x0'));var rimraf=require(_0xb021('0x1'));var zipdir=require(_0xb021('0x2'));var jsonpatch=require(_0xb021('0x3'));var rp=require(_0xb021('0x4'));var moment=require('moment');var BPromise=require(_0xb021('0x5'));var Mustache=require(_0xb021('0x6'));var util=require(_0xb021('0x7'));var path=require(_0xb021('0x8'));var sox=require(_0xb021('0x9'));var csv=require(_0xb021('0xa'));var ejs=require(_0xb021('0xb'));var fs=require('fs');var _=require(_0xb021('0xc'));var squel=require('squel');var crypto=require(_0xb021('0xd'));var jsforce=require(_0xb021('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb021('0xa'));var querystring=require(_0xb021('0xf'));var Papa=require(_0xb021('0x10'));var Redis=require(_0xb021('0x11'));var authService=require(_0xb021('0x12'));var qs=require(_0xb021('0x13'));var as=require(_0xb021('0x14'));var hardwareService=require(_0xb021('0x15'));var logger=require(_0xb021('0x16'))(_0xb021('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xb021('0x18'))['db'];function respondWithStatusCode(_0x5188b9,_0x39a316){_0x39a316=_0x39a316||0xcc;return function(_0x25063d){if(_0x25063d){return _0x5188b9[_0xb021('0x19')](_0x39a316);}return _0x5188b9[_0xb021('0x1a')](_0x39a316)[_0xb021('0x1b')]();};}function respondWithResult(_0x2a6e33,_0x1f6c19){_0x1f6c19=_0x1f6c19||0xc8;return function(_0x18a4c7){if(_0x18a4c7){return _0x2a6e33[_0xb021('0x1a')](_0x1f6c19)[_0xb021('0x1c')](_0x18a4c7);}};}function respondWithFilteredResult(_0xc1259,_0x1486ef){return function(_0x4448f2){if(_0x4448f2){var _0x1ef5bc=_0x4448f2[_0xb021('0x1d')],_0x38f785=_0x1486ef['offset'],_0x57824f=_0x1486ef[_0xb021('0x1e')]+_0x1486ef[_0xb021('0x1f')],_0x39a54c;if(_0x57824f>=_0x1ef5bc){_0x57824f=_0x1ef5bc;_0x39a54c=0xc8;}else{_0x39a54c=0xce;}_0xc1259[_0xb021('0x1a')](_0x39a54c);return _0xc1259['set']('Content-Range',_0x38f785+'-'+_0x57824f+'/'+_0x1ef5bc)[_0xb021('0x1c')](_0x4448f2);}return null;};}function patchUpdates(_0x184e96){return function(_0x34448f){try{jsonpatch[_0xb021('0x20')](_0x34448f,_0x184e96,!![]);}catch(_0x2b1b9a){return BPromise['reject'](_0x2b1b9a);}return _0x34448f[_0xb021('0x21')]();};}function saveUpdates(_0x3d61db,_0x2e7c5e){return function(_0xf127d4){if(_0xf127d4){return _0xf127d4[_0xb021('0x22')](_0x3d61db)[_0xb021('0x23')](function(_0x4ff8ef){return _0x4ff8ef;});}return null;};}function removeEntity(_0x3f1e05,_0x3b31ac){return function(_0x142a8c){if(_0x142a8c){return _0x142a8c[_0xb021('0x24')]()['then'](function(){var _0x18e7b9=_0x142a8c[_0xb021('0x25')]({'plain':!![]});var _0x54da5d=_0xb021('0x26');return db[_0xb021('0x27')]['destroy']({'where':{'type':_0x54da5d,'resourceId':_0x18e7b9['id']}})['then'](function(){return _0x142a8c;});})[_0xb021('0x23')](function(){_0x3f1e05[_0xb021('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x465ec5,_0x1fadf9){return function(_0x3b659a){if(!_0x3b659a){_0x465ec5['sendStatus'](0x194);}return _0x3b659a;};}function handleError(_0x4372c0,_0xacd022){_0xacd022=_0xacd022||0x1f4;return function(_0x25bf11){logger[_0xb021('0x28')](_0x25bf11[_0xb021('0x29')]);if(_0x25bf11[_0xb021('0x2a')]){delete _0x25bf11[_0xb021('0x2a')];}_0x4372c0[_0xb021('0x1a')](_0xacd022)['send'](_0x25bf11);};}exports[_0xb021('0x2b')]=function(_0x598f5c,_0x57e70f){var _0x5bdd8d={},_0x5c7384={},_0x1e82a5={'count':0x0,'rows':[]};var _0x242e51=_[_0xb021('0x2c')](db[_0xb021('0x2d')][_0xb021('0x2e')],function(_0x52874b){return{'name':_0x52874b['fieldName'],'type':_0x52874b['type'][_0xb021('0x2f')]};});_0x5c7384[_0xb021('0x30')]=_[_0xb021('0x2c')](_0x242e51,_0xb021('0x2a'));_0x5c7384['query']=_['keys'](_0x598f5c[_0xb021('0x31')]);_0x5c7384[_0xb021('0x32')]=_[_0xb021('0x33')](_0x5c7384[_0xb021('0x30')],_0x5c7384['query']);_0x5bdd8d[_0xb021('0x34')]=_[_0xb021('0x33')](_0x5c7384[_0xb021('0x30')],qs['fields'](_0x598f5c[_0xb021('0x31')][_0xb021('0x35')]));_0x5bdd8d[_0xb021('0x34')]=_0x5bdd8d[_0xb021('0x34')][_0xb021('0x36')]?_0x5bdd8d[_0xb021('0x34')]:_0x5c7384[_0xb021('0x30')];if(!_0x598f5c[_0xb021('0x31')][_0xb021('0x37')](_0xb021('0x38'))){_0x5bdd8d[_0xb021('0x1f')]=qs['limit'](_0x598f5c[_0xb021('0x31')]['limit']);_0x5bdd8d[_0xb021('0x1e')]=qs[_0xb021('0x1e')](_0x598f5c['query']['offset']);}_0x5bdd8d['order']=qs[_0xb021('0x39')](_0x598f5c[_0xb021('0x31')][_0xb021('0x39')]);_0x5bdd8d[_0xb021('0x3a')]=qs[_0xb021('0x32')](_['pick'](_0x598f5c[_0xb021('0x31')],_0x5c7384['filters']),_0x242e51);if(_0x598f5c[_0xb021('0x31')][_0xb021('0x3b')]){_0x5bdd8d[_0xb021('0x3a')]=_[_0xb021('0x3c')](_0x5bdd8d[_0xb021('0x3a')],{'$or':_['map'](_0x242e51,function(_0x340a50){if(_0x340a50[_0xb021('0x3d')]!==_0xb021('0x3e')){var _0x116b0b={};_0x116b0b[_0x340a50[_0xb021('0x2a')]]={'$like':'%'+_0x598f5c[_0xb021('0x31')][_0xb021('0x3b')]+'%'};return _0x116b0b;}})});}_0x5bdd8d=_[_0xb021('0x3c')]({},_0x5bdd8d,_0x598f5c[_0xb021('0x3f')]);var _0x168ba2={'where':_0x5bdd8d['where']};return db[_0xb021('0x2d')][_0xb021('0x1d')](_0x168ba2)[_0xb021('0x23')](function(_0x5940eb){_0x1e82a5[_0xb021('0x1d')]=_0x5940eb;if(_0x598f5c[_0xb021('0x31')][_0xb021('0x40')]){_0x5bdd8d[_0xb021('0x41')]=[{'all':!![]}];}return db[_0xb021('0x2d')][_0xb021('0x42')](_0x5bdd8d);})['then'](function(_0x59e552){_0x1e82a5[_0xb021('0x43')]=_0x59e552;return _0x1e82a5;})['then'](respondWithFilteredResult(_0x57e70f,_0x5bdd8d))['catch'](handleError(_0x57e70f,null));};exports[_0xb021('0x44')]=function(_0x147368,_0x2fc0ef){var _0x5540f5={'raw':![],'where':{'id':_0x147368['params']['id']}},_0x4d8296={};_0x4d8296['model']=_['keys'](db[_0xb021('0x2d')][_0xb021('0x2e')]);_0x4d8296[_0xb021('0x31')]=_[_0xb021('0x45')](_0x147368[_0xb021('0x31')]);_0x4d8296[_0xb021('0x32')]=_[_0xb021('0x33')](_0x4d8296[_0xb021('0x30')],_0x4d8296[_0xb021('0x31')]);_0x5540f5[_0xb021('0x34')]=_[_0xb021('0x33')](_0x4d8296[_0xb021('0x30')],qs['fields'](_0x147368[_0xb021('0x31')][_0xb021('0x35')]));_0x5540f5[_0xb021('0x34')]=_0x5540f5[_0xb021('0x34')][_0xb021('0x36')]?_0x5540f5[_0xb021('0x34')]:_0x4d8296[_0xb021('0x30')];if(_0x147368[_0xb021('0x31')]['includeAll']){_0x5540f5[_0xb021('0x41')]=[{'all':!![]}];}_0x5540f5=_[_0xb021('0x3c')]({},_0x5540f5,_0x147368[_0xb021('0x3f')]);return db['JscriptyProject'][_0xb021('0x46')](_0x5540f5)['then'](handleEntityNotFound(_0x2fc0ef,null))[_0xb021('0x23')](respondWithResult(_0x2fc0ef,null))[_0xb021('0x47')](handleError(_0x2fc0ef,null));};exports['create']=function(_0x1aae5d,_0x727f34){return db[_0xb021('0x2d')][_0xb021('0x48')](_0x1aae5d[_0xb021('0x49')],{})[_0xb021('0x23')](function(_0x33ece4){var _0x4e1828=_0x1aae5d[_0xb021('0x4a')][_0xb021('0x25')]({'plain':!![]});if(!_0x4e1828)throw new Error(_0xb021('0x4b'));if(_0x4e1828[_0xb021('0x4c')]===_0xb021('0x4a')){var _0x5bfbd6=_0x33ece4[_0xb021('0x25')]({'plain':!![]});var _0x50afef='Projects';return db['UserProfileSection'][_0xb021('0x46')]({'where':{'name':_0x50afef,'userProfileId':_0x4e1828[_0xb021('0x4d')]},'raw':!![]})[_0xb021('0x23')](function(_0x624ad){if(_0x624ad&&_0x624ad[_0xb021('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x5bfbd6[_0xb021('0x2a')],'resourceId':_0x5bfbd6['id'],'type':_0x624ad[_0xb021('0x2a')],'sectionId':_0x624ad['id']},{})[_0xb021('0x23')](function(){return _0x33ece4;});}else{return _0x33ece4;}})[_0xb021('0x47')](function(_0x109515){logger[_0xb021('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x109515);throw _0x109515;});}return _0x33ece4;})[_0xb021('0x23')](respondWithResult(_0x727f34,0xc9))['catch'](handleError(_0x727f34,null));};exports[_0xb021('0x4f')]=function(_0x5ca3cf,_0x50ed4f){var _0x30c4ab={'where':{'id':_0x5ca3cf[_0xb021('0x50')]['id']}},_0x525cd8={};_0x525cd8[_0xb021('0x30')]=_['keys'](db[_0xb021('0x2d')][_0xb021('0x2e')]);_0x30c4ab[_0xb021('0x34')]=_['intersection'](_0x525cd8[_0xb021('0x30')],qs[_0xb021('0x35')](_0x5ca3cf[_0xb021('0x31')][_0xb021('0x35')]));_0x30c4ab[_0xb021('0x34')]=_0x30c4ab[_0xb021('0x34')][_0xb021('0x36')]?_0x30c4ab[_0xb021('0x34')]:_0x525cd8['model'];if(_0x5ca3cf['query'][_0xb021('0x40')]){_0x30c4ab[_0xb021('0x41')]=[{'all':!![]}];}_0x30c4ab=_[_0xb021('0x3c')]({},_0x30c4ab,_0x5ca3cf['options']);return db[_0xb021('0x2d')][_0xb021('0x46')](_0x30c4ab)['then'](handleEntityNotFound(_0x50ed4f,null))[_0xb021('0x23')](function(_0x2dc697){if(_0x2dc697){var _0x4edc21=_0x2dc697[_0xb021('0x25')]({'plain':!![]});_0x4edc21=qs[_0xb021('0x51')](_0x4edc21,['id',_0xb021('0x52'),_0xb021('0x53')]);_0x5ca3cf[_0xb021('0x49')]=_[_0xb021('0x51')](_0x5ca3cf['body'],['id',_0xb021('0x52'),_0xb021('0x53')]);return db[_0xb021('0x2d')][_0xb021('0x48')](_['merge'](_0x4edc21,_0x5ca3cf[_0xb021('0x49')]),{'include':_0x5ca3cf[_0xb021('0x31')][_0xb021('0x40')]?[{'all':!![]}]:undefined})[_0xb021('0x23')](function(_0x1c06af){var _0x42dc1d=_0x5ca3cf['user']['get']({'plain':!![]});if(!_0x42dc1d)throw new Error(_0xb021('0x4b'));if(_0x42dc1d['role']===_0xb021('0x4a')){var _0x394e03=_0x1c06af[_0xb021('0x25')]({'plain':!![]});var _0x217249=_0xb021('0x26');return db[_0xb021('0x54')][_0xb021('0x46')]({'where':{'name':_0x217249,'userProfileId':_0x42dc1d[_0xb021('0x4d')]},'raw':!![]})['then'](function(_0x10a332){if(_0x10a332&&_0x10a332[_0xb021('0x4e')]===0x0){return db[_0xb021('0x27')][_0xb021('0x48')]({'name':_0x394e03[_0xb021('0x2a')],'resourceId':_0x394e03['id'],'type':_0x10a332[_0xb021('0x2a')],'sectionId':_0x10a332['id']},{})[_0xb021('0x23')](function(){return _0x1c06af;});}else{return _0x1c06af;}})[_0xb021('0x47')](function(_0xbfb2f8){logger[_0xb021('0x28')](_0xb021('0x55'),_0xbfb2f8);throw _0xbfb2f8;});}return _0x1c06af;});}})[_0xb021('0x23')](respondWithResult(_0x50ed4f,0xc9))[_0xb021('0x47')](handleError(_0x50ed4f,null));};exports[_0xb021('0x22')]=function(_0x354362,_0x5bc12b){if(_0x354362[_0xb021('0x49')]['id']){delete _0x354362['body']['id'];}return db[_0xb021('0x2d')][_0xb021('0x46')]({'where':{'id':_0x354362[_0xb021('0x50')]['id']}})[_0xb021('0x23')](handleEntityNotFound(_0x5bc12b,null))[_0xb021('0x23')](saveUpdates(_0x354362['body'],null))['then'](respondWithResult(_0x5bc12b,null))['catch'](handleError(_0x5bc12b,null));};exports['destroy']=function(_0x5d3336,_0x107a2c){return db[_0xb021('0x2d')][_0xb021('0x46')]({'where':{'id':_0x5d3336[_0xb021('0x50')]['id']}})[_0xb021('0x23')](handleEntityNotFound(_0x107a2c,null))[_0xb021('0x23')](removeEntity(_0x107a2c,null))[_0xb021('0x47')](handleError(_0x107a2c,null));};exports[_0xb021('0x56')]=function(_0x53d490,_0x177a11,_0x138714){var _0x495e1e={'raw':!![],'where':{}};var _0x3d0baf={};var _0x426bc9={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x53d490[_0xb021('0x50')]['id']}})['then'](handleEntityNotFound(_0x177a11,null))[_0xb021('0x23')](function(_0x4a6c58){if(_0x4a6c58){_0x3d0baf['model']=_[_0xb021('0x45')](db[_0xb021('0x57')]['rawAttributes']);_0x3d0baf['query']=_[_0xb021('0x45')](_0x53d490['query']);_0x3d0baf[_0xb021('0x32')]=_['intersection'](_0x3d0baf[_0xb021('0x30')],_0x3d0baf[_0xb021('0x31')]);_0x495e1e[_0xb021('0x34')]=_[_0xb021('0x33')](_0x3d0baf['model'],qs[_0xb021('0x35')](_0x53d490[_0xb021('0x31')][_0xb021('0x35')]));_0x495e1e[_0xb021('0x34')]=_0x495e1e[_0xb021('0x34')][_0xb021('0x36')]?_0x495e1e[_0xb021('0x34')]:_0x3d0baf['model'];if(!_0x53d490['query'][_0xb021('0x37')](_0xb021('0x38'))){_0x495e1e[_0xb021('0x1f')]=qs[_0xb021('0x1f')](_0x53d490[_0xb021('0x31')][_0xb021('0x1f')]);_0x495e1e[_0xb021('0x1e')]=qs[_0xb021('0x1e')](_0x53d490[_0xb021('0x31')][_0xb021('0x1e')]);}_0x495e1e[_0xb021('0x58')]=qs[_0xb021('0x39')](_0x53d490[_0xb021('0x31')][_0xb021('0x39')]);_0x495e1e[_0xb021('0x3a')]=qs['filters'](_['pick'](_0x53d490[_0xb021('0x31')],_0x3d0baf[_0xb021('0x32')]));_0x495e1e[_0xb021('0x3a')][_0xb021('0x59')]=_0x4a6c58['id'];if(_0x53d490[_0xb021('0x31')][_0xb021('0x3b')]){_0x495e1e['where']=_[_0xb021('0x3c')](_0x495e1e['where'],{'$or':_[_0xb021('0x2c')](_0x495e1e[_0xb021('0x34')],function(_0x134284){var _0x6daed0={};_0x6daed0[_0x134284]={'$like':'%'+_0x53d490['query'][_0xb021('0x3b')]+'%'};return _0x6daed0;})});}_0x495e1e=_[_0xb021('0x3c')]({},_0x495e1e,_0x53d490[_0xb021('0x3f')]);return db[_0xb021('0x57')]['count']({'where':_0x495e1e[_0xb021('0x3a')]})[_0xb021('0x23')](function(_0x1bf6de){_0x426bc9[_0xb021('0x1d')]=_0x1bf6de;if(_0x53d490[_0xb021('0x31')]['includeAll']){_0x495e1e['include']=[{'all':!![]}];}return db[_0xb021('0x57')][_0xb021('0x42')](_0x495e1e);})[_0xb021('0x23')](function(_0x3dd7ca){_0x426bc9['rows']=_0x3dd7ca;return _0x426bc9;});}})[_0xb021('0x23')](respondWithFilteredResult(_0x177a11,_0x495e1e))[_0xb021('0x47')](handleError(_0x177a11,null));};exports[_0xb021('0x5a')]=function(_0x32b9bc,_0x8053a0,_0x4c8c41){var _0x13ce4c={'raw':!![],'where':{}};var _0x192a2f={};var _0x1bdaea={'count':0x0,'rows':[]};return db[_0xb021('0x2d')][_0xb021('0x5b')]({'where':{'id':_0x32b9bc['params']['id']}})[_0xb021('0x23')](handleEntityNotFound(_0x8053a0,null))[_0xb021('0x23')](function(_0x1660d8){if(_0x1660d8){_0x192a2f[_0xb021('0x30')]=_['keys'](db[_0xb021('0x5c')][_0xb021('0x2e')]);_0x192a2f[_0xb021('0x31')]=_[_0xb021('0x45')](_0x32b9bc['query']);_0x192a2f['filters']=_['intersection'](_0x192a2f['model'],_0x192a2f[_0xb021('0x31')]);_0x13ce4c[_0xb021('0x34')]=_['intersection'](_0x192a2f['model'],qs[_0xb021('0x35')](_0x32b9bc['query'][_0xb021('0x35')]));_0x13ce4c[_0xb021('0x34')]=_0x13ce4c[_0xb021('0x34')][_0xb021('0x36')]?_0x13ce4c[_0xb021('0x34')]:_0x192a2f[_0xb021('0x30')];if(!_0x32b9bc[_0xb021('0x31')][_0xb021('0x37')](_0xb021('0x38'))){_0x13ce4c['limit']=qs[_0xb021('0x1f')](_0x32b9bc[_0xb021('0x31')][_0xb021('0x1f')]);_0x13ce4c[_0xb021('0x1e')]=qs[_0xb021('0x1e')](_0x32b9bc[_0xb021('0x31')][_0xb021('0x1e')]);}_0x13ce4c[_0xb021('0x58')]=qs[_0xb021('0x39')](_0x32b9bc[_0xb021('0x31')][_0xb021('0x39')]);_0x13ce4c['where']=qs['filters'](_[_0xb021('0x5d')](_0x32b9bc[_0xb021('0x31')],_0x192a2f[_0xb021('0x32')]));_0x13ce4c[_0xb021('0x3a')]['ProjectId']=_0x1660d8['id'];if(_0x32b9bc[_0xb021('0x31')][_0xb021('0x3b')]){_0x13ce4c[_0xb021('0x3a')]=_[_0xb021('0x3c')](_0x13ce4c[_0xb021('0x3a')],{'$or':_[_0xb021('0x2c')](_0x13ce4c[_0xb021('0x34')],function(_0x5cca65){var _0x2493a3={};_0x2493a3[_0x5cca65]={'$like':'%'+_0x32b9bc[_0xb021('0x31')][_0xb021('0x3b')]+'%'};return _0x2493a3;})});}_0x13ce4c=_[_0xb021('0x3c')]({},_0x13ce4c,_0x32b9bc[_0xb021('0x3f')]);return db[_0xb021('0x5c')][_0xb021('0x1d')]({'where':_0x13ce4c['where']})[_0xb021('0x23')](function(_0x415969){_0x1bdaea[_0xb021('0x1d')]=_0x415969;if(_0x32b9bc[_0xb021('0x31')][_0xb021('0x40')]){_0x13ce4c['include']=[{'all':!![]}];}return db[_0xb021('0x5c')][_0xb021('0x42')](_0x13ce4c);})[_0xb021('0x23')](function(_0x5c8037){_0x1bdaea['rows']=_0x5c8037;return _0x1bdaea;});}})[_0xb021('0x23')](respondWithFilteredResult(_0x8053a0,_0x13ce4c))[_0xb021('0x47')](handleError(_0x8053a0,null));};function char(_0x57b3e2){return'number'===typeof _0x57b3e2?String['fromCharCode'][_0xb021('0x20')](null,arguments):_0x57b3e2;}function needsEncapsulation(_0x1f874f){return!!_0x1f874f&&(_0x1f874f['toString']()[_0xb021('0x5e')](char(0xd))>=0x0||_0x1f874f[_0xb021('0x5f')]()[_0xb021('0x5e')](char(0xa))>=0x0||_0x1f874f[_0xb021('0x5f')]()[_0xb021('0x5e')](char(0x2c))>=0x0||_0x1f874f['toString']()[_0xb021('0x5e')](char(0x22))>=0x0);}function encapsulate(_0xc05d9c){var _0x1835fc=char(0x22),_0x1612e1='\x5c'+char(0x22),_0x507656=_0xc05d9c[_0xb021('0x5f')]()[_0xb021('0x60')](new RegExp(_0x1835fc,'g'),_0x1612e1);return _0x1835fc+_0x507656+_0x1835fc;}exports[_0xb021('0x61')]=function(_0x11ac71,_0x5f572e,_0x5e4468){var _0x4463b4,_0x4efb48;var _0x259a13={'where':{'ProjectId':_0x11ac71[_0xb021('0x50')]['id']}};if(_0x11ac71[_0xb021('0x31')][_0xb021('0x62')]){_0x259a13[_0xb021('0x3a')][_0xb021('0x63')]=JSON['parse'](_0x11ac71[_0xb021('0x31')][_0xb021('0x62')]);}return db[_0xb021('0x57')][_0xb021('0x42')](_0x259a13)['then'](handleEntityNotFound(_0x5f572e,null))[_0xb021('0x23')](function(_0x3f3927){if(_0x3f3927){_0x4463b4=_0x3f3927;return db[_0xb021('0x64')]['findAll']({'where':{'SessionId':{'$in':_[_0xb021('0x2c')](_0x4463b4,'id')},'ProjectId':_0x11ac71['params']['id']},'order':_0xb021('0x65')});}})[_0xb021('0x23')](handleEntityNotFound(_0x5f572e,null))[_0xb021('0x23')](function(_0x3440bc){if(_0x3440bc){_0x4efb48=_0x3440bc;var _0x948485={};for(var _0x9fd524=0x0,_0x1f8190=_0x4efb48[_0xb021('0x36')];_0x9fd524<_0x1f8190;_0x9fd524++){if(!_0x948485[_0xb021('0x37')](_0x4efb48[_0x9fd524]['questionId'])){_0x948485[_0x4efb48[_0x9fd524][_0xb021('0x66')]]=needsEncapsulation(_0x4efb48[_0x9fd524]['question'])?encapsulate(_0x4efb48[_0x9fd524][_0xb021('0x67')]):_0x4efb48[_0x9fd524][_0xb021('0x67')];}}var _0x4b51a8=[],_0x509c87={};for(var _0x1011f8=0x0,_0x46a1e1=_0x4463b4[_0xb021('0x36')];_0x1011f8<_0x46a1e1;_0x1011f8++){_0x509c87={'ProjectId':_0x11ac71[_0xb021('0x50')]['id'],'SessionId':_0x4463b4[_0x1011f8]['id'],'StartTime':moment(_0x4463b4[_0x1011f8][_0xb021('0x63')])[_0xb021('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x243cec=0x0,_0x15564d=_0x4efb48[_0xb021('0x36')];_0x243cec<_0x15564d;_0x243cec++){if(_0x4efb48[_0x243cec]['SessionId']==_0x4463b4[_0x1011f8]['id']&&_0x948485[_0xb021('0x37')](_0x4efb48[_0x243cec][_0xb021('0x66')])){_0x509c87[_0x948485[_0x4efb48[_0x243cec]['questionId']]]=_0x4efb48[_0x243cec][_0xb021('0x69')];}}for(var _0x13cb51 in _0x948485){if(!_0x509c87[_0xb021('0x37')](_0x948485[_0x13cb51])){_0x509c87[_0x948485[_0x13cb51]]=null;}}_0x4b51a8[_0xb021('0x6a')](_0x509c87);}return _0x4b51a8;}})[_0xb021('0x23')](function(_0x7daa10){if(!_['isEmpty'](_0x7daa10)){var _0x8a8423=toCsv(_0x7daa10);var _0x18cb75=Date[_0xb021('0x6b')]();fs[_0xb021('0x6c')](util[_0xb021('0x68')](_0xb021('0x6d'),_0x11ac71[_0xb021('0x50')]['id'],_0x18cb75),_0x8a8423);_0x5f572e['setHeader'](_0xb021('0x6e'),_0xb021('0x6f')+util['format'](_0xb021('0x70'),_0x11ac71['params']['id'],_0x18cb75));_0x5f572e[_0xb021('0x71')](_0xb021('0x72'),_0xb021('0x73'));return _0x5f572e[_0xb021('0x74')](util[_0xb021('0x68')](_0xb021('0x6d'),_0x11ac71['params']['id'],_0x18cb75));}else{return _0x5f572e[_0xb021('0x19')](0xcc);}})[_0xb021('0x47')](handleError(_0x5f572e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 4571109..c2d4729 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 _0xe36e=['../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x138836,_0x229129){var _0x322688=function(_0x54b101){while(--_0x54b101){_0x138836['push'](_0x138836['shift']());}};_0x322688(++_0x229129);}(_0xe36e,0xbb));var _0xee36=function(_0x4e9b79,_0x5f29af){_0x4e9b79=_0x4e9b79-0x0;var _0xad9077=_0xe36e[_0x4e9b79];return _0xad9077;};'use strict';var _=require(_0xee36('0x0'));var util=require('util');var logger=require(_0xee36('0x1'))(_0xee36('0x2'));var moment=require(_0xee36('0x3'));var BPromise=require(_0xee36('0x4'));var rp=require(_0xee36('0x5'));var fs=require('fs');var path=require(_0xee36('0x6'));var rimraf=require(_0xee36('0x7'));var config=require(_0xee36('0x8'));var attributes=require(_0xee36('0x9'));module['exports']=function(_0x12b133,_0x17a0e5){return _0x12b133[_0xee36('0xa')](_0xee36('0xb'),attributes,{'tableName':_0xee36('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf920=['../../config/environment','exports','JscriptyProject','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x31a671,_0x3490ce){var _0x3cbeee=function(_0x2bf0ab){while(--_0x2bf0ab){_0x31a671['push'](_0x31a671['shift']());}};_0x3cbeee(++_0x3490ce);}(_0xf920,0x1a7));var _0x0f92=function(_0x279b1a,_0x2bb6df){_0x279b1a=_0x279b1a-0x0;var _0x316364=_0xf920[_0x279b1a];return _0x316364;};'use strict';var _=require('lodash');var util=require(_0x0f92('0x0'));var logger=require(_0x0f92('0x1'))(_0x0f92('0x2'));var moment=require(_0x0f92('0x3'));var BPromise=require(_0x0f92('0x4'));var rp=require(_0x0f92('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f92('0x6'));var config=require(_0x0f92('0x7'));var attributes=require('./jscriptyProject.attributes');module[_0x0f92('0x8')]=function(_0x5489a7,_0x49b9b5){return _0x5489a7['define'](_0x0f92('0x9'),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 deafd0d..9b7ba05 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 _0x642d=['../../config/environment','jayson/promise','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1fa805,_0x33eb74){var _0x30958c=function(_0x935173){while(--_0x935173){_0x1fa805['push'](_0x1fa805['shift']());}};_0x30958c(++_0x33eb74);}(_0x642d,0x8b));var _0xd642=function(_0x529f46,_0x596c69){_0x529f46=_0x529f46-0x0;var _0x45136c=_0x642d[_0x529f46];return _0x45136c;};'use strict';var _=require('lodash');var util=require(_0xd642('0x0'));var moment=require(_0xd642('0x1'));var BPromise=require('bluebird');var rs=require(_0xd642('0x2'));var fs=require('fs');var Redis=require(_0xd642('0x3'));var db=require(_0xd642('0x4'))['db'];var utils=require(_0xd642('0x5'));var logger=require(_0xd642('0x6'))(_0xd642('0x7'));var config=require(_0xd642('0x8'));var jayson=require(_0xd642('0x9'));var client=jayson[_0xd642('0xa')][_0xd642('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x420785,_0x3ee43d,_0x2c4a89){return new BPromise(function(_0x55325f,_0x44618f){return client[_0xd642('0xc')](_0x420785,_0x2c4a89)[_0xd642('0xd')](function(_0x4a3d59){logger[_0xd642('0xe')](_0xd642('0xf'),_0x3ee43d,'request\x20sent');logger['debug'](_0xd642('0x10'),_0x3ee43d,'request\x20sent',JSON[_0xd642('0x11')](_0x4a3d59));if(_0x4a3d59['error']){if(_0x4a3d59[_0xd642('0x12')][_0xd642('0x13')]===0x1f4){logger[_0xd642('0x12')](_0xd642('0xf'),_0x3ee43d,_0x4a3d59[_0xd642('0x12')]['message']);return _0x44618f(_0x4a3d59[_0xd642('0x12')][_0xd642('0x14')]);}logger[_0xd642('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x3ee43d,_0x4a3d59[_0xd642('0x12')][_0xd642('0x14')]);return _0x55325f(_0x4a3d59[_0xd642('0x12')][_0xd642('0x14')]);}else{logger[_0xd642('0xe')](_0xd642('0xf'),_0x3ee43d,'request\x20sent');_0x55325f(_0x4a3d59['result'][_0xd642('0x14')]);}})['catch'](function(_0x58c9b4){logger['error'](_0xd642('0xf'),_0x3ee43d,_0x58c9b4);_0x44618f(_0x58c9b4);});});} \ No newline at end of file +var _0x90e2=['../../config/environment','client','http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x282999,_0x4df660){var _0x30681f=function(_0x50e926){while(--_0x50e926){_0x282999['push'](_0x282999['shift']());}};_0x30681f(++_0x4df660);}(_0x90e2,0x9b));var _0x290e=function(_0x281d76,_0x1486a5){_0x281d76=_0x281d76-0x0;var _0x438f44=_0x90e2[_0x281d76];return _0x438f44;};'use strict';var _=require(_0x290e('0x0'));var util=require(_0x290e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x290e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x290e('0x3'))['db'];var utils=require(_0x290e('0x4'));var logger=require(_0x290e('0x5'))(_0x290e('0x6'));var config=require(_0x290e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x290e('0x8')][_0x290e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7826e8,_0xecc065,_0x2df1dd){return new BPromise(function(_0x3991f9,_0x5c0d4f){return client['request'](_0x7826e8,_0x2df1dd)['then'](function(_0x57b377){logger[_0x290e('0xa')](_0x290e('0xb'),_0xecc065,_0x290e('0xc'));logger[_0x290e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0xecc065,_0x290e('0xc'),JSON['stringify'](_0x57b377));if(_0x57b377[_0x290e('0xe')]){if(_0x57b377['error'][_0x290e('0xf')]===0x1f4){logger['error'](_0x290e('0xb'),_0xecc065,_0x57b377['error'][_0x290e('0x10')]);return _0x5c0d4f(_0x57b377[_0x290e('0xe')]['message']);}logger['error'](_0x290e('0xb'),_0xecc065,_0x57b377[_0x290e('0xe')][_0x290e('0x10')]);return _0x3991f9(_0x57b377[_0x290e('0xe')][_0x290e('0x10')]);}else{logger['info'](_0x290e('0xb'),_0xecc065,_0x290e('0xc'));_0x3991f9(_0x57b377[_0x290e('0x11')][_0x290e('0x10')]);}})['catch'](function(_0x19c686){logger[_0x290e('0xe')](_0x290e('0xb'),_0xecc065,_0x19c686);_0x5c0d4f(_0x19c686);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index e369df9..4b64299 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 _0x179f=['get','isAuthenticated','index','/describe','describe','show','post','put','/:id','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller'];(function(_0x658865,_0x193b8a){var _0x4c039b=function(_0x283b9f){while(--_0x283b9f){_0x658865['push'](_0x658865['shift']());}};_0x4c039b(++_0x193b8a);}(_0x179f,0xe9));var _0xf179=function(_0x1d21bb,_0x66aa27){_0x1d21bb=_0x1d21bb-0x0;var _0x34cb4e=_0x179f[_0x1d21bb];return _0x34cb4e;};'use strict';var multer=require('multer');var util=require(_0xf179('0x0'));var path=require(_0xf179('0x1'));var timeout=require('connect-timeout');var express=require(_0xf179('0x2'));var router=express[_0xf179('0x3')]();var auth=require(_0xf179('0x4'));var interaction=require(_0xf179('0x5'));var config=require('../../config/environment');var controller=require(_0xf179('0x6'));router[_0xf179('0x7')]('/',auth[_0xf179('0x8')](),controller[_0xf179('0x9')]);router['get'](_0xf179('0xa'),auth[_0xf179('0x8')](),controller[_0xf179('0xb')]);router[_0xf179('0x7')]('/:id',auth[_0xf179('0x8')](),controller[_0xf179('0xc')]);router[_0xf179('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf179('0xe')](_0xf179('0xf'),auth[_0xf179('0x8')](),controller[_0xf179('0x10')]);router[_0xf179('0x11')](_0xf179('0xf'),auth[_0xf179('0x8')](),controller[_0xf179('0x12')]);module[_0xf179('0x13')]=router; \ No newline at end of file +var _0x685b=['post','create','put','/:id','update','delete','destroy','exports','util','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x685b,0x15e));var _0xb685=function(_0xa63ea3,_0x4367ff){_0xa63ea3=_0xa63ea3-0x0;var _0x2aa5ff=_0x685b[_0xa63ea3];return _0x2aa5ff;};'use strict';var multer=require('multer');var util=require(_0xb685('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb685('0x1'));var router=express[_0xb685('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xb685('0x3'));var config=require(_0xb685('0x4'));var controller=require('./jscriptyQuestionReport.controller');router[_0xb685('0x5')]('/',auth[_0xb685('0x6')](),controller[_0xb685('0x7')]);router[_0xb685('0x5')](_0xb685('0x8'),auth['isAuthenticated'](),controller[_0xb685('0x9')]);router[_0xb685('0x5')]('/:id',auth[_0xb685('0x6')](),controller[_0xb685('0xa')]);router[_0xb685('0xb')]('/',auth[_0xb685('0x6')](),controller[_0xb685('0xc')]);router[_0xb685('0xd')](_0xb685('0xe'),auth[_0xb685('0x6')](),controller[_0xb685('0xf')]);router[_0xb685('0x10')](_0xb685('0xe'),auth[_0xb685('0x6')](),controller[_0xb685('0x11')]);module[_0xb685('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 37e78f5..ede3cfd 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 _0x91c8=['exports','STRING','TEXT','long','sequelize'];(function(_0x576e47,_0xc4024b){var _0x50a3a6=function(_0x11b0a2){while(--_0x11b0a2){_0x576e47['push'](_0x576e47['shift']());}};_0x50a3a6(++_0xc4024b);}(_0x91c8,0x1cb));var _0x891c=function(_0x5e3c3e,_0x1d264e){_0x5e3c3e=_0x5e3c3e-0x0;var _0x560c06=_0x91c8[_0x5e3c3e];return _0x560c06;};'use strict';var Sequelize=require(_0x891c('0x0'));module[_0x891c('0x1')]={'question':{'type':Sequelize[_0x891c('0x2')]},'answer':{'type':Sequelize[_0x891c('0x3')](_0x891c('0x4'))},'membername':{'type':Sequelize[_0x891c('0x2')]},'projectname':{'type':Sequelize[_0x891c('0x2')]},'queue':{'type':Sequelize[_0x891c('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x891c('0x2')]},'calleridnum':{'type':Sequelize[_0x891c('0x2')]},'questionId':{'type':Sequelize[_0x891c('0x2')]}}; \ No newline at end of file +var _0x4760=['STRING','TEXT','long','sequelize','exports'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x4760,0xee));var _0x0476=function(_0x59a6ce,_0x33c4f5){_0x59a6ce=_0x59a6ce-0x0;var _0x401941=_0x4760[_0x59a6ce];return _0x401941;};'use strict';var Sequelize=require(_0x0476('0x0'));module[_0x0476('0x1')]={'question':{'type':Sequelize[_0x0476('0x2')]},'answer':{'type':Sequelize[_0x0476('0x3')](_0x0476('0x4'))},'membername':{'type':Sequelize[_0x0476('0x2')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0476('0x2')]},'uniqueid':{'type':Sequelize[_0x0476('0x2')]},'calleridname':{'type':Sequelize[_0x0476('0x2')]},'calleridnum':{'type':Sequelize[_0x0476('0x2')]},'questionId':{'type':Sequelize[_0x0476('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 29e56e5..4a5ad1a 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 _0x84e3=['findAll','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','json','offset','limit','save','update','destroy','then','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include'];(function(_0x5a3178,_0x4869ae){var _0x442e18=function(_0x4593a0){while(--_0x4593a0){_0x5a3178['push'](_0x5a3178['shift']());}};_0x442e18(++_0x4869ae);}(_0x84e3,0x90));var _0x384e=function(_0x12723c,_0x148a5a){_0x12723c=_0x12723c-0x0;var _0x3fc804=_0x84e3[_0x12723c];return _0x3fc804;};'use strict';var pdf=require(_0x384e('0x0'));var emlformat=require(_0x384e('0x1'));var rimraf=require(_0x384e('0x2'));var zipdir=require(_0x384e('0x3'));var jsonpatch=require(_0x384e('0x4'));var rp=require(_0x384e('0x5'));var moment=require(_0x384e('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x384e('0x7'));var util=require(_0x384e('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x384e('0x9'));var ejs=require(_0x384e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x384e('0xb'));var toCsv=require(_0x384e('0x9'));var querystring=require(_0x384e('0xc'));var Papa=require(_0x384e('0xd'));var Redis=require(_0x384e('0xe'));var authService=require(_0x384e('0xf'));var qs=require(_0x384e('0x10'));var as=require(_0x384e('0x11'));var hardwareService=require(_0x384e('0x12'));var logger=require(_0x384e('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x384e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38a0b8,_0xf9f3d1){_0xf9f3d1=_0xf9f3d1||0xcc;return function(_0x4a7ccd){if(_0x4a7ccd){return _0x38a0b8[_0x384e('0x15')](_0xf9f3d1);}return _0x38a0b8[_0x384e('0x16')](_0xf9f3d1)['end']();};}function respondWithResult(_0x19ec4f,_0x3e87a3){_0x3e87a3=_0x3e87a3||0xc8;return function(_0x1b82f3){if(_0x1b82f3){return _0x19ec4f[_0x384e('0x16')](_0x3e87a3)[_0x384e('0x17')](_0x1b82f3);}};}function respondWithFilteredResult(_0x1e06c9,_0x3e7f4c){return function(_0x106e57){if(_0x106e57){var _0x57ea19=_0x106e57['count'],_0x528c5b=_0x3e7f4c[_0x384e('0x18')],_0x34b119=_0x3e7f4c[_0x384e('0x18')]+_0x3e7f4c[_0x384e('0x19')],_0x47f7b5;if(_0x34b119>=_0x57ea19){_0x34b119=_0x57ea19;_0x47f7b5=0xc8;}else{_0x47f7b5=0xce;}_0x1e06c9[_0x384e('0x16')](_0x47f7b5);return _0x1e06c9['set']('Content-Range',_0x528c5b+'-'+_0x34b119+'/'+_0x57ea19)['json'](_0x106e57);}return null;};}function patchUpdates(_0xf5f40){return function(_0x5c7623){try{jsonpatch['apply'](_0x5c7623,_0xf5f40,!![]);}catch(_0xb4bbb4){return BPromise['reject'](_0xb4bbb4);}return _0x5c7623[_0x384e('0x1a')]();};}function saveUpdates(_0x1ae557,_0x3797c7){return function(_0x4a5f78){if(_0x4a5f78){return _0x4a5f78[_0x384e('0x1b')](_0x1ae557)['then'](function(_0x201bda){return _0x201bda;});}return null;};}function removeEntity(_0xed3107,_0x4bf6a9){return function(_0x20b1ca){if(_0x20b1ca){return _0x20b1ca[_0x384e('0x1c')]()[_0x384e('0x1d')](function(){_0xed3107[_0x384e('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ff825,_0x1e30de){return function(_0x5926cd){if(!_0x5926cd){_0x4ff825[_0x384e('0x15')](0x194);}return _0x5926cd;};}function handleError(_0x10885b,_0x4e7c4d){_0x4e7c4d=_0x4e7c4d||0x1f4;return function(_0x331e69){logger['error'](_0x331e69[_0x384e('0x1e')]);if(_0x331e69[_0x384e('0x1f')]){delete _0x331e69['name'];}_0x10885b[_0x384e('0x16')](_0x4e7c4d)[_0x384e('0x20')](_0x331e69);};}exports[_0x384e('0x21')]=function(_0x3764d6,_0x2f0746){var _0x2716ea={},_0x33eb14={},_0x258a41={'count':0x0,'rows':[]};var _0x48ba1a=_[_0x384e('0x22')](db[_0x384e('0x23')][_0x384e('0x24')],function(_0x4a711d){return{'name':_0x4a711d[_0x384e('0x25')],'type':_0x4a711d['type']['key']};});_0x33eb14[_0x384e('0x26')]=_['map'](_0x48ba1a,_0x384e('0x1f'));_0x33eb14[_0x384e('0x27')]=_[_0x384e('0x28')](_0x3764d6[_0x384e('0x27')]);_0x33eb14[_0x384e('0x29')]=_['intersection'](_0x33eb14['model'],_0x33eb14[_0x384e('0x27')]);_0x2716ea[_0x384e('0x2a')]=_[_0x384e('0x2b')](_0x33eb14[_0x384e('0x26')],qs['fields'](_0x3764d6[_0x384e('0x27')][_0x384e('0x2c')]));_0x2716ea[_0x384e('0x2a')]=_0x2716ea[_0x384e('0x2a')][_0x384e('0x2d')]?_0x2716ea['attributes']:_0x33eb14[_0x384e('0x26')];if(!_0x3764d6['query'][_0x384e('0x2e')](_0x384e('0x2f'))){_0x2716ea[_0x384e('0x19')]=qs[_0x384e('0x19')](_0x3764d6[_0x384e('0x27')][_0x384e('0x19')]);_0x2716ea[_0x384e('0x18')]=qs[_0x384e('0x18')](_0x3764d6[_0x384e('0x27')][_0x384e('0x18')]);}_0x2716ea[_0x384e('0x30')]=qs[_0x384e('0x31')](_0x3764d6[_0x384e('0x27')]['sort']);_0x2716ea[_0x384e('0x32')]=qs['filters'](_[_0x384e('0x33')](_0x3764d6['query'],_0x33eb14[_0x384e('0x29')]),_0x48ba1a);if(_0x3764d6[_0x384e('0x27')][_0x384e('0x34')]){_0x2716ea[_0x384e('0x32')]=_[_0x384e('0x35')](_0x2716ea[_0x384e('0x32')],{'$or':_[_0x384e('0x22')](_0x48ba1a,function(_0x2cf40f){if(_0x2cf40f[_0x384e('0x36')]!==_0x384e('0x37')){var _0x190bf4={};_0x190bf4[_0x2cf40f['name']]={'$like':'%'+_0x3764d6[_0x384e('0x27')][_0x384e('0x34')]+'%'};return _0x190bf4;}})});}_0x2716ea=_[_0x384e('0x35')]({},_0x2716ea,_0x3764d6[_0x384e('0x38')]);var _0xd8b533={'where':_0x2716ea[_0x384e('0x32')]};return db[_0x384e('0x23')][_0x384e('0x39')](_0xd8b533)[_0x384e('0x1d')](function(_0x3baf20){_0x258a41[_0x384e('0x39')]=_0x3baf20;if(_0x3764d6['query'][_0x384e('0x3a')]){_0x2716ea[_0x384e('0x3b')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x384e('0x3c')](_0x2716ea);})[_0x384e('0x1d')](function(_0x210a9f){_0x258a41['rows']=_0x210a9f;return _0x258a41;})[_0x384e('0x1d')](respondWithFilteredResult(_0x2f0746,_0x2716ea))[_0x384e('0x3d')](handleError(_0x2f0746,null));};exports[_0x384e('0x3e')]=function(_0x567241,_0x49d5af){var _0x5d449d={'raw':!![],'where':{'id':_0x567241[_0x384e('0x3f')]['id']}},_0x244791={};_0x244791['model']=_[_0x384e('0x28')](db[_0x384e('0x23')][_0x384e('0x24')]);_0x244791[_0x384e('0x27')]=_[_0x384e('0x28')](_0x567241[_0x384e('0x27')]);_0x244791[_0x384e('0x29')]=_[_0x384e('0x2b')](_0x244791[_0x384e('0x26')],_0x244791[_0x384e('0x27')]);_0x5d449d['attributes']=_[_0x384e('0x2b')](_0x244791[_0x384e('0x26')],qs[_0x384e('0x2c')](_0x567241[_0x384e('0x27')][_0x384e('0x2c')]));_0x5d449d['attributes']=_0x5d449d[_0x384e('0x2a')][_0x384e('0x2d')]?_0x5d449d[_0x384e('0x2a')]:_0x244791[_0x384e('0x26')];if(_0x567241['query']['includeAll']){_0x5d449d[_0x384e('0x3b')]=[{'all':!![]}];}_0x5d449d=_[_0x384e('0x35')]({},_0x5d449d,_0x567241[_0x384e('0x38')]);return db[_0x384e('0x23')][_0x384e('0x40')](_0x5d449d)['then'](handleEntityNotFound(_0x49d5af,null))[_0x384e('0x1d')](respondWithResult(_0x49d5af,null))[_0x384e('0x3d')](handleError(_0x49d5af,null));};exports[_0x384e('0x41')]=function(_0x49e99c,_0x49bda4){return db[_0x384e('0x23')][_0x384e('0x41')](_0x49e99c['body'],{})[_0x384e('0x1d')](respondWithResult(_0x49bda4,0xc9))['catch'](handleError(_0x49bda4,null));};exports['update']=function(_0x47b1f8,_0x178416){if(_0x47b1f8[_0x384e('0x42')]['id']){delete _0x47b1f8[_0x384e('0x42')]['id'];}return db[_0x384e('0x23')]['find']({'where':{'id':_0x47b1f8[_0x384e('0x3f')]['id']}})[_0x384e('0x1d')](handleEntityNotFound(_0x178416,null))['then'](saveUpdates(_0x47b1f8['body'],null))[_0x384e('0x1d')](respondWithResult(_0x178416,null))[_0x384e('0x3d')](handleError(_0x178416,null));};exports[_0x384e('0x1c')]=function(_0x47b959,_0x6e803e){return db[_0x384e('0x23')][_0x384e('0x40')]({'where':{'id':_0x47b959[_0x384e('0x3f')]['id']}})[_0x384e('0x1d')](handleEntityNotFound(_0x6e803e,null))[_0x384e('0x1d')](removeEntity(_0x6e803e,null))[_0x384e('0x3d')](handleError(_0x6e803e,null));};exports[_0x384e('0x43')]=function(_0x460ac0,_0x416d72){return db[_0x384e('0x23')][_0x384e('0x43')]()[_0x384e('0x1d')](respondWithResult(_0x416d72,null))[_0x384e('0x3d')](handleError(_0x416d72,null));}; \ No newline at end of file +var _0x8920=['hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','rawAttributes','options','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','bluebird','util','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','count','offset','limit','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','JscriptyQuestionReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x8920,0x1f0));var _0x0892=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8920[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require(_0x0892('0x0'));var emlformat=require(_0x0892('0x1'));var rimraf=require(_0x0892('0x2'));var zipdir=require(_0x0892('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0892('0x4'));var Mustache=require('mustache');var util=require(_0x0892('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x0892('0x6'));var ejs=require(_0x0892('0x7'));var fs=require('fs');var _=require(_0x0892('0x8'));var squel=require(_0x0892('0x9'));var crypto=require('crypto');var jsforce=require(_0x0892('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x0892('0x6'));var querystring=require(_0x0892('0xb'));var Papa=require(_0x0892('0xc'));var Redis=require(_0x0892('0xd'));var authService=require(_0x0892('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x0892('0xf'));var hardwareService=require(_0x0892('0x10'));var logger=require(_0x0892('0x11'))('api');var utils=require(_0x0892('0x12'));var config=require(_0x0892('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17ae32,_0x43315e){_0x43315e=_0x43315e||0xcc;return function(_0x36d8bf){if(_0x36d8bf){return _0x17ae32[_0x0892('0x14')](_0x43315e);}return _0x17ae32[_0x0892('0x15')](_0x43315e)['end']();};}function respondWithResult(_0x22fd1e,_0x395ca2){_0x395ca2=_0x395ca2||0xc8;return function(_0x58ad38){if(_0x58ad38){return _0x22fd1e['status'](_0x395ca2)['json'](_0x58ad38);}};}function respondWithFilteredResult(_0x5351c7,_0x4714b3){return function(_0x3203de){if(_0x3203de){var _0x5417a3=_0x3203de[_0x0892('0x16')],_0x4b1b43=_0x4714b3['offset'],_0x59021a=_0x4714b3[_0x0892('0x17')]+_0x4714b3[_0x0892('0x18')],_0x47c24d;if(_0x59021a>=_0x5417a3){_0x59021a=_0x5417a3;_0x47c24d=0xc8;}else{_0x47c24d=0xce;}_0x5351c7[_0x0892('0x15')](_0x47c24d);return _0x5351c7['set'](_0x0892('0x19'),_0x4b1b43+'-'+_0x59021a+'/'+_0x5417a3)[_0x0892('0x1a')](_0x3203de);}return null;};}function patchUpdates(_0x141bd9){return function(_0x4a44e7){try{jsonpatch[_0x0892('0x1b')](_0x4a44e7,_0x141bd9,!![]);}catch(_0x2ce371){return BPromise[_0x0892('0x1c')](_0x2ce371);}return _0x4a44e7[_0x0892('0x1d')]();};}function saveUpdates(_0x4a100c,_0x4518df){return function(_0x21b8aa){if(_0x21b8aa){return _0x21b8aa[_0x0892('0x1e')](_0x4a100c)[_0x0892('0x1f')](function(_0xd795fb){return _0xd795fb;});}return null;};}function removeEntity(_0x2c7ad8,_0x413096){return function(_0x46a228){if(_0x46a228){return _0x46a228['destroy']()[_0x0892('0x1f')](function(){_0x2c7ad8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e1044,_0x173ac3){return function(_0x24461c){if(!_0x24461c){_0x5e1044[_0x0892('0x14')](0x194);}return _0x24461c;};}function handleError(_0x26ff05,_0x4aa05d){_0x4aa05d=_0x4aa05d||0x1f4;return function(_0x153115){logger[_0x0892('0x20')](_0x153115[_0x0892('0x21')]);if(_0x153115[_0x0892('0x22')]){delete _0x153115['name'];}_0x26ff05[_0x0892('0x15')](_0x4aa05d)[_0x0892('0x23')](_0x153115);};}exports[_0x0892('0x24')]=function(_0x33b220,_0x598568){var _0x18cff4={},_0x121e9e={},_0x18c712={'count':0x0,'rows':[]};var _0x4014ea=_['map'](db[_0x0892('0x25')]['rawAttributes'],function(_0x170d6a){return{'name':_0x170d6a[_0x0892('0x26')],'type':_0x170d6a[_0x0892('0x27')][_0x0892('0x28')]};});_0x121e9e[_0x0892('0x29')]=_['map'](_0x4014ea,_0x0892('0x22'));_0x121e9e[_0x0892('0x2a')]=_[_0x0892('0x2b')](_0x33b220[_0x0892('0x2a')]);_0x121e9e['filters']=_[_0x0892('0x2c')](_0x121e9e[_0x0892('0x29')],_0x121e9e[_0x0892('0x2a')]);_0x18cff4[_0x0892('0x2d')]=_[_0x0892('0x2c')](_0x121e9e[_0x0892('0x29')],qs[_0x0892('0x2e')](_0x33b220[_0x0892('0x2a')][_0x0892('0x2e')]));_0x18cff4[_0x0892('0x2d')]=_0x18cff4[_0x0892('0x2d')][_0x0892('0x2f')]?_0x18cff4[_0x0892('0x2d')]:_0x121e9e[_0x0892('0x29')];if(!_0x33b220[_0x0892('0x2a')][_0x0892('0x30')]('nolimit')){_0x18cff4[_0x0892('0x18')]=qs[_0x0892('0x18')](_0x33b220[_0x0892('0x2a')]['limit']);_0x18cff4[_0x0892('0x17')]=qs['offset'](_0x33b220[_0x0892('0x2a')][_0x0892('0x17')]);}_0x18cff4[_0x0892('0x31')]=qs[_0x0892('0x32')](_0x33b220[_0x0892('0x2a')][_0x0892('0x32')]);_0x18cff4[_0x0892('0x33')]=qs[_0x0892('0x34')](_[_0x0892('0x35')](_0x33b220['query'],_0x121e9e[_0x0892('0x34')]),_0x4014ea);if(_0x33b220[_0x0892('0x2a')][_0x0892('0x36')]){_0x18cff4[_0x0892('0x33')]=_[_0x0892('0x37')](_0x18cff4[_0x0892('0x33')],{'$or':_['map'](_0x4014ea,function(_0x32c2f4){if(_0x32c2f4[_0x0892('0x27')]!==_0x0892('0x38')){var _0x1e694f={};_0x1e694f[_0x32c2f4[_0x0892('0x22')]]={'$like':'%'+_0x33b220['query']['filter']+'%'};return _0x1e694f;}})});}_0x18cff4=_[_0x0892('0x37')]({},_0x18cff4,_0x33b220['options']);var _0x3b19a9={'where':_0x18cff4['where']};return db['JscriptyQuestionReport']['count'](_0x3b19a9)[_0x0892('0x1f')](function(_0x591e5d){_0x18c712[_0x0892('0x16')]=_0x591e5d;if(_0x33b220[_0x0892('0x2a')][_0x0892('0x39')]){_0x18cff4[_0x0892('0x3a')]=[{'all':!![]}];}return db[_0x0892('0x25')]['findAll'](_0x18cff4);})['then'](function(_0x207f77){_0x18c712[_0x0892('0x3b')]=_0x207f77;return _0x18c712;})['then'](respondWithFilteredResult(_0x598568,_0x18cff4))[_0x0892('0x3c')](handleError(_0x598568,null));};exports[_0x0892('0x3d')]=function(_0x42ff57,_0x22b377){var _0x2ce8c4={'raw':!![],'where':{'id':_0x42ff57['params']['id']}},_0x528ce6={};_0x528ce6[_0x0892('0x29')]=_[_0x0892('0x2b')](db['JscriptyQuestionReport'][_0x0892('0x3e')]);_0x528ce6['query']=_['keys'](_0x42ff57[_0x0892('0x2a')]);_0x528ce6[_0x0892('0x34')]=_[_0x0892('0x2c')](_0x528ce6[_0x0892('0x29')],_0x528ce6['query']);_0x2ce8c4[_0x0892('0x2d')]=_[_0x0892('0x2c')](_0x528ce6[_0x0892('0x29')],qs[_0x0892('0x2e')](_0x42ff57['query'][_0x0892('0x2e')]));_0x2ce8c4['attributes']=_0x2ce8c4[_0x0892('0x2d')][_0x0892('0x2f')]?_0x2ce8c4[_0x0892('0x2d')]:_0x528ce6['model'];if(_0x42ff57['query']['includeAll']){_0x2ce8c4[_0x0892('0x3a')]=[{'all':!![]}];}_0x2ce8c4=_[_0x0892('0x37')]({},_0x2ce8c4,_0x42ff57[_0x0892('0x3f')]);return db[_0x0892('0x25')][_0x0892('0x40')](_0x2ce8c4)[_0x0892('0x1f')](handleEntityNotFound(_0x22b377,null))['then'](respondWithResult(_0x22b377,null))[_0x0892('0x3c')](handleError(_0x22b377,null));};exports[_0x0892('0x41')]=function(_0x1a8944,_0x400d59){return db['JscriptyQuestionReport'][_0x0892('0x41')](_0x1a8944[_0x0892('0x42')],{})[_0x0892('0x1f')](respondWithResult(_0x400d59,0xc9))[_0x0892('0x3c')](handleError(_0x400d59,null));};exports[_0x0892('0x1e')]=function(_0x29b1fe,_0x4b1523){if(_0x29b1fe[_0x0892('0x42')]['id']){delete _0x29b1fe[_0x0892('0x42')]['id'];}return db['JscriptyQuestionReport'][_0x0892('0x40')]({'where':{'id':_0x29b1fe[_0x0892('0x43')]['id']}})['then'](handleEntityNotFound(_0x4b1523,null))[_0x0892('0x1f')](saveUpdates(_0x29b1fe['body'],null))[_0x0892('0x1f')](respondWithResult(_0x4b1523,null))['catch'](handleError(_0x4b1523,null));};exports['destroy']=function(_0x26d2d7,_0x516b18){return db[_0x0892('0x25')]['find']({'where':{'id':_0x26d2d7['params']['id']}})[_0x0892('0x1f')](handleEntityNotFound(_0x516b18,null))[_0x0892('0x1f')](removeEntity(_0x516b18,null))[_0x0892('0x3c')](handleError(_0x516b18,null));};exports['describe']=function(_0x3c50f8,_0x24486c){return db[_0x0892('0x25')]['describe']()[_0x0892('0x1f')](respondWithResult(_0x24486c,null))[_0x0892('0x3c')](handleError(_0x24486c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index e31d139..53a0abb 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 _0x3b63=['moment','bluebird','request-promise','rimraf','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger'];(function(_0x5eb238,_0x27ed2a){var _0x5bf755=function(_0x1a30f8){while(--_0x1a30f8){_0x5eb238['push'](_0x5eb238['shift']());}};_0x5bf755(++_0x27ed2a);}(_0x3b63,0xd5));var _0x33b6=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x3b63[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x33b6('0x0'));var util=require(_0x33b6('0x1'));var logger=require(_0x33b6('0x2'))('api');var moment=require(_0x33b6('0x3'));var BPromise=require(_0x33b6('0x4'));var rp=require(_0x33b6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x33b6('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module['exports']=function(_0x192c5b,_0x1ac7a2){return _0x192c5b['define'](_0x33b6('0x7'),attributes,{'tableName':_0x33b6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7655=['moment','request-promise','path','rimraf','./jscriptyQuestionReport.attributes','exports','define','report_jscripty_questions','lodash','../../config/logger','api'];(function(_0x20e7e3,_0x1529be){var _0x14b9de=function(_0xa82925){while(--_0xa82925){_0x20e7e3['push'](_0x20e7e3['shift']());}};_0x14b9de(++_0x1529be);}(_0x7655,0x168));var _0x5765=function(_0x4de98a,_0x24aac8){_0x4de98a=_0x4de98a-0x0;var _0x4ea391=_0x7655[_0x4de98a];return _0x4ea391;};'use strict';var _=require(_0x5765('0x0'));var util=require('util');var logger=require(_0x5765('0x1'))(_0x5765('0x2'));var moment=require(_0x5765('0x3'));var BPromise=require('bluebird');var rp=require(_0x5765('0x4'));var fs=require('fs');var path=require(_0x5765('0x5'));var rimraf=require(_0x5765('0x6'));var config=require('../../config/environment');var attributes=require(_0x5765('0x7'));module[_0x5765('0x8')]=function(_0x3f3586,_0x1f0938){return _0x3f3586[_0x5765('0x9')]('JscriptyQuestionReport',attributes,{'tableName':_0x5765('0xa'),'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 00c78d5..f1bcf34 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 _0x66df=['rpc','client','http','request','info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x199bc7,_0x2974ec){var _0x28b17b=function(_0x51c1da){while(--_0x51c1da){_0x199bc7['push'](_0x199bc7['shift']());}};_0x28b17b(++_0x2974ec);}(_0x66df,0x1ee));var _0xf66d=function(_0xadde88,_0x58ad47){_0xadde88=_0xadde88-0x0;var _0x3b8eb6=_0x66df[_0xadde88];return _0x3b8eb6;};'use strict';var _=require(_0xf66d('0x0'));var util=require(_0xf66d('0x1'));var moment=require('moment');var BPromise=require(_0xf66d('0x2'));var rs=require(_0xf66d('0x3'));var fs=require('fs');var Redis=require(_0xf66d('0x4'));var db=require(_0xf66d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf66d('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf66d('0x7')][_0xf66d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe1cb2e,_0x53ba0d,_0x1d4f22){return new BPromise(function(_0x3da065,_0x151a86){return client[_0xf66d('0x9')](_0xe1cb2e,_0x1d4f22)['then'](function(_0x312817){logger[_0xf66d('0xa')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x53ba0d,_0xf66d('0xb'));logger[_0xf66d('0xc')](_0xf66d('0xd'),_0x53ba0d,_0xf66d('0xb'),JSON['stringify'](_0x312817));if(_0x312817[_0xf66d('0xe')]){if(_0x312817[_0xf66d('0xe')][_0xf66d('0xf')]===0x1f4){logger[_0xf66d('0xe')](_0xf66d('0x10'),_0x53ba0d,_0x312817[_0xf66d('0xe')]['message']);return _0x151a86(_0x312817[_0xf66d('0xe')][_0xf66d('0x11')]);}logger[_0xf66d('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x53ba0d,_0x312817['error'][_0xf66d('0x11')]);return _0x3da065(_0x312817[_0xf66d('0xe')]['message']);}else{logger[_0xf66d('0xa')](_0xf66d('0x10'),_0x53ba0d,_0xf66d('0xb'));_0x3da065(_0x312817[_0xf66d('0x12')][_0xf66d('0x11')]);}})[_0xf66d('0x13')](function(_0x590fdf){logger[_0xf66d('0xe')](_0xf66d('0x10'),_0x53ba0d,_0x590fdf);_0x151a86(_0x590fdf);});});} \ No newline at end of file +var _0x8545=['jayson/promise','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','../../config/logger','rpc'];(function(_0x57601c,_0x2e2620){var _0x5eff7a=function(_0x45c6e8){while(--_0x45c6e8){_0x57601c['push'](_0x57601c['shift']());}};_0x5eff7a(++_0x2e2620);}(_0x8545,0x12e));var _0x5854=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x8545[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0x5854('0x0'));var util=require(_0x5854('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5854('0x2'))(_0x5854('0x3'));var config=require('../../config/environment');var jayson=require(_0x5854('0x4'));var client=jayson['client'][_0x5854('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x852358,_0x491c1a,_0x3f3c9d){return new BPromise(function(_0x258e49,_0x32cb59){return client[_0x5854('0x6')](_0x852358,_0x3f3c9d)[_0x5854('0x7')](function(_0x171773){logger[_0x5854('0x8')](_0x5854('0x9'),_0x491c1a,'request\x20sent');logger['debug'](_0x5854('0xa'),_0x491c1a,_0x5854('0xb'),JSON[_0x5854('0xc')](_0x171773));if(_0x171773[_0x5854('0xd')]){if(_0x171773[_0x5854('0xd')][_0x5854('0xe')]===0x1f4){logger[_0x5854('0xd')](_0x5854('0x9'),_0x491c1a,_0x171773[_0x5854('0xd')][_0x5854('0xf')]);return _0x32cb59(_0x171773[_0x5854('0xd')]['message']);}logger[_0x5854('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x491c1a,_0x171773['error'][_0x5854('0xf')]);return _0x258e49(_0x171773['error'][_0x5854('0xf')]);}else{logger[_0x5854('0x8')](_0x5854('0x9'),_0x491c1a,'request\x20sent');_0x258e49(_0x171773[_0x5854('0x10')]['message']);}})[_0x5854('0x11')](function(_0x16db2f){logger[_0x5854('0xd')](_0x5854('0x9'),_0x491c1a,_0x16db2f);_0x32cb59(_0x16db2f);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 1f2e129..0f9edf4 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 _0x425d=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x1970a1,_0x5cf940){var _0x2b8f07=function(_0x17cf67){while(--_0x17cf67){_0x1970a1['push'](_0x1970a1['shift']());}};_0x2b8f07(++_0x5cf940);}(_0x425d,0x1e0));var _0xd425=function(_0xab39a,_0x9d1016){_0xab39a=_0xab39a-0x0;var _0x17bbe2=_0x425d[_0xab39a];return _0x17bbe2;};'use strict';var multer=require(_0xd425('0x0'));var util=require('util');var path=require(_0xd425('0x1'));var timeout=require(_0xd425('0x2'));var express=require(_0xd425('0x3'));var router=express[_0xd425('0x4')]();var auth=require(_0xd425('0x5'));var interaction=require(_0xd425('0x6'));var config=require(_0xd425('0x7'));var controller=require('./jscriptySessionReport.controller');router[_0xd425('0x8')]('/',auth[_0xd425('0x9')](),controller[_0xd425('0xa')]);router[_0xd425('0x8')](_0xd425('0xb'),auth[_0xd425('0x9')](),controller['describe']);router[_0xd425('0x8')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0xd')]);router[_0xd425('0x8')](_0xd425('0xe'),auth[_0xd425('0x9')](),controller[_0xd425('0xf')]);router[_0xd425('0x10')]('/',auth[_0xd425('0x9')](),controller[_0xd425('0x11')]);router[_0xd425('0x12')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0x13')]);router[_0xd425('0x14')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0x15')]);module[_0xd425('0x16')]=router; \ No newline at end of file +var _0xe181=['../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4e0417,_0x574fd4){var _0x5d6909=function(_0x54e5d3){while(--_0x54e5d3){_0x4e0417['push'](_0x4e0417['shift']());}};_0x5d6909(++_0x574fd4);}(_0xe181,0x68));var _0x1e18=function(_0xc8069a,_0x2968fc){_0xc8069a=_0xc8069a-0x0;var _0x16bc69=_0xe181[_0xc8069a];return _0x16bc69;};'use strict';var multer=require(_0x1e18('0x0'));var util=require('util');var path=require(_0x1e18('0x1'));var timeout=require(_0x1e18('0x2'));var express=require(_0x1e18('0x3'));var router=express[_0x1e18('0x4')]();var auth=require(_0x1e18('0x5'));var interaction=require(_0x1e18('0x6'));var config=require(_0x1e18('0x7'));var controller=require('./jscriptySessionReport.controller');router[_0x1e18('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1e18('0x8')](_0x1e18('0x9'),auth[_0x1e18('0xa')](),controller[_0x1e18('0xb')]);router[_0x1e18('0x8')](_0x1e18('0xc'),auth['isAuthenticated'](),controller[_0x1e18('0xd')]);router[_0x1e18('0x8')](_0x1e18('0xe'),auth[_0x1e18('0xa')](),controller[_0x1e18('0xf')]);router[_0x1e18('0x10')]('/',auth['isAuthenticated'](),controller[_0x1e18('0x11')]);router[_0x1e18('0x12')](_0x1e18('0xc'),auth[_0x1e18('0xa')](),controller[_0x1e18('0x13')]);router[_0x1e18('0x14')](_0x1e18('0xc'),auth[_0x1e18('0xa')](),controller['destroy']);module[_0x1e18('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 23971b4..508c083 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 _0xcb31=['setDataValue','starttime','endtime','format','DATE','STRING','BOOLEAN','exports'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xcb31,0x87));var _0x1cb3=function(_0x5a7e6f,_0x30cccb){_0x5a7e6f=_0x5a7e6f-0x0;var _0x3c5972=_0xcb31[_0x5a7e6f];return _0x3c5972;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb3('0x0')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x3c6ab6){this[_0x1cb3('0x1')](_0x1cb3('0x2'),_0x3c6ab6);this[_0x1cb3('0x1')](_0x1cb3('0x3'),moment()[_0x1cb3('0x4')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x1cb3('0x5')]},'membername':{'type':Sequelize[_0x1cb3('0x6')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x1cb3('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1cb3('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x1cb3('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0xe5a0=['format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','sequelize','exports','setDataValue','endtime'];(function(_0x1eaa14,_0x156244){var _0x35f007=function(_0x10f884){while(--_0x10f884){_0x1eaa14['push'](_0x1eaa14['shift']());}};_0x35f007(++_0x156244);}(_0xe5a0,0x17f));var _0x0e5a=function(_0x4365c6,_0xd05198){_0x4365c6=_0x4365c6-0x0;var _0x1082e1=_0xe5a0[_0x4365c6];return _0x1082e1;};'use strict';var moment=require('moment');var Sequelize=require(_0x0e5a('0x0'));module[_0x0e5a('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x19818b){this[_0x0e5a('0x2')]('starttime',_0x19818b);this['setDataValue'](_0x0e5a('0x3'),moment()[_0x0e5a('0x4')](_0x0e5a('0x5')));}},'endtime':{'type':Sequelize[_0x0e5a('0x6')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x0e5a('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0e5a('0x7')]},'calleridnum':{'type':Sequelize[_0x0e5a('0x7')]},'completed':{'type':Sequelize[_0x0e5a('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 8b5fce1..f491256 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 _0x5020=['then','status','error','stack','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','params','find','catch','create','body','describe','findOne','SessionId','JscriptyQuestionReport','findAll','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','apply','reject','update'];(function(_0x483888,_0x2ff778){var _0x4be161=function(_0x1c1915){while(--_0x1c1915){_0x483888['push'](_0x483888['shift']());}};_0x4be161(++_0x2ff778);}(_0x5020,0x157));var _0x0502=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x5020[_0x25bea7];return _0x175952;};'use strict';var pdf=require(_0x0502('0x0'));var emlformat=require(_0x0502('0x1'));var rimraf=require(_0x0502('0x2'));var zipdir=require(_0x0502('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0502('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0502('0x5'));var util=require('util');var path=require(_0x0502('0x6'));var sox=require(_0x0502('0x7'));var csv=require(_0x0502('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0502('0x9'));var squel=require(_0x0502('0xa'));var crypto=require(_0x0502('0xb'));var jsforce=require(_0x0502('0xc'));var deskjs=require(_0x0502('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0502('0xe'));var Redis=require(_0x0502('0xf'));var authService=require(_0x0502('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0502('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0502('0x12'))(_0x0502('0x13'));var utils=require(_0x0502('0x14'));var config=require(_0x0502('0x15'));var db=require(_0x0502('0x16'))['db'];function respondWithStatusCode(_0x40a8a7,_0x3cf0a8){_0x3cf0a8=_0x3cf0a8||0xcc;return function(_0x53d312){if(_0x53d312){return _0x40a8a7[_0x0502('0x17')](_0x3cf0a8);}return _0x40a8a7['status'](_0x3cf0a8)[_0x0502('0x18')]();};}function respondWithResult(_0xb8d545,_0x53dcad){_0x53dcad=_0x53dcad||0xc8;return function(_0x2660ce){if(_0x2660ce){return _0xb8d545['status'](_0x53dcad)[_0x0502('0x19')](_0x2660ce);}};}function respondWithFilteredResult(_0x1c9f9d,_0x210d67){return function(_0x5b8a06){if(_0x5b8a06){var _0x7f23a2=_0x5b8a06[_0x0502('0x1a')],_0x416937=_0x210d67['offset'],_0x10c947=_0x210d67[_0x0502('0x1b')]+_0x210d67[_0x0502('0x1c')],_0x54704c;if(_0x10c947>=_0x7f23a2){_0x10c947=_0x7f23a2;_0x54704c=0xc8;}else{_0x54704c=0xce;}_0x1c9f9d['status'](_0x54704c);return _0x1c9f9d['set']('Content-Range',_0x416937+'-'+_0x10c947+'/'+_0x7f23a2)['json'](_0x5b8a06);}return null;};}function patchUpdates(_0x543ae1){return function(_0x443466){try{jsonpatch[_0x0502('0x1d')](_0x443466,_0x543ae1,!![]);}catch(_0x8b20e8){return BPromise[_0x0502('0x1e')](_0x8b20e8);}return _0x443466['save']();};}function saveUpdates(_0x26ce00,_0x3a21d7){return function(_0x55a1f7){if(_0x55a1f7){return _0x55a1f7[_0x0502('0x1f')](_0x26ce00)[_0x0502('0x20')](function(_0x2f4e27){return _0x2f4e27;});}return null;};}function removeEntity(_0xdef8d5,_0x5637d3){return function(_0x39e859){if(_0x39e859){return _0x39e859['destroy']()['then'](function(){_0xdef8d5[_0x0502('0x21')](0xcc)[_0x0502('0x18')]();});}};}function handleEntityNotFound(_0x39fcd6,_0x3ea647){return function(_0x3e94e2){if(!_0x3e94e2){_0x39fcd6[_0x0502('0x17')](0x194);}return _0x3e94e2;};}function handleError(_0x11a353,_0x4deda4){_0x4deda4=_0x4deda4||0x1f4;return function(_0x25118e){logger[_0x0502('0x22')](_0x25118e[_0x0502('0x23')]);if(_0x25118e['name']){delete _0x25118e[_0x0502('0x24')];}_0x11a353[_0x0502('0x21')](_0x4deda4)[_0x0502('0x25')](_0x25118e);};}exports[_0x0502('0x26')]=function(_0x26a105,_0x442d0f){var _0x8f4adf={},_0x46d7b8={},_0xdefbd5={'count':0x0,'rows':[]};var _0x43f88d=_['map'](db[_0x0502('0x27')][_0x0502('0x28')],function(_0x31ca00){return{'name':_0x31ca00[_0x0502('0x29')],'type':_0x31ca00[_0x0502('0x2a')]['key']};});_0x46d7b8[_0x0502('0x2b')]=_[_0x0502('0x2c')](_0x43f88d,'name');_0x46d7b8[_0x0502('0x2d')]=_[_0x0502('0x2e')](_0x26a105[_0x0502('0x2d')]);_0x46d7b8[_0x0502('0x2f')]=_[_0x0502('0x30')](_0x46d7b8[_0x0502('0x2b')],_0x46d7b8[_0x0502('0x2d')]);_0x8f4adf['attributes']=_[_0x0502('0x30')](_0x46d7b8[_0x0502('0x2b')],qs[_0x0502('0x31')](_0x26a105[_0x0502('0x2d')]['fields']));_0x8f4adf[_0x0502('0x32')]=_0x8f4adf[_0x0502('0x32')][_0x0502('0x33')]?_0x8f4adf[_0x0502('0x32')]:_0x46d7b8[_0x0502('0x2b')];if(!_0x26a105[_0x0502('0x2d')][_0x0502('0x34')](_0x0502('0x35'))){_0x8f4adf[_0x0502('0x1c')]=qs[_0x0502('0x1c')](_0x26a105[_0x0502('0x2d')][_0x0502('0x1c')]);_0x8f4adf[_0x0502('0x1b')]=qs[_0x0502('0x1b')](_0x26a105[_0x0502('0x2d')][_0x0502('0x1b')]);}_0x8f4adf[_0x0502('0x36')]=qs['sort'](_0x26a105[_0x0502('0x2d')][_0x0502('0x37')]);_0x8f4adf['where']=qs[_0x0502('0x2f')](_[_0x0502('0x38')](_0x26a105[_0x0502('0x2d')],_0x46d7b8['filters']),_0x43f88d);if(_0x26a105[_0x0502('0x2d')][_0x0502('0x39')]){_0x8f4adf[_0x0502('0x3a')]=_[_0x0502('0x3b')](_0x8f4adf['where'],{'$or':_[_0x0502('0x2c')](_0x43f88d,function(_0x1277b7){if(_0x1277b7['type']!==_0x0502('0x3c')){var _0x2584ed={};_0x2584ed[_0x1277b7['name']]={'$like':'%'+_0x26a105[_0x0502('0x2d')][_0x0502('0x39')]+'%'};return _0x2584ed;}})});}_0x8f4adf=_[_0x0502('0x3b')]({},_0x8f4adf,_0x26a105[_0x0502('0x3d')]);var _0x456a87={'where':_0x8f4adf[_0x0502('0x3a')]};return db[_0x0502('0x27')]['count'](_0x456a87)['then'](function(_0x18ff88){_0xdefbd5['count']=_0x18ff88;if(_0x26a105[_0x0502('0x2d')][_0x0502('0x3e')]){_0x8f4adf[_0x0502('0x3f')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x8f4adf);})[_0x0502('0x20')](function(_0x6e8388){_0xdefbd5[_0x0502('0x40')]=_0x6e8388;return _0xdefbd5;})[_0x0502('0x20')](respondWithFilteredResult(_0x442d0f,_0x8f4adf))['catch'](handleError(_0x442d0f,null));};exports['show']=function(_0x3f112f,_0x34f9aa){var _0x325210={'raw':!![],'where':{'id':_0x3f112f[_0x0502('0x41')]['id']}},_0x5b30cd={};_0x5b30cd[_0x0502('0x2b')]=_[_0x0502('0x2e')](db[_0x0502('0x27')][_0x0502('0x28')]);_0x5b30cd[_0x0502('0x2d')]=_[_0x0502('0x2e')](_0x3f112f['query']);_0x5b30cd[_0x0502('0x2f')]=_[_0x0502('0x30')](_0x5b30cd[_0x0502('0x2b')],_0x5b30cd[_0x0502('0x2d')]);_0x325210[_0x0502('0x32')]=_[_0x0502('0x30')](_0x5b30cd[_0x0502('0x2b')],qs[_0x0502('0x31')](_0x3f112f[_0x0502('0x2d')][_0x0502('0x31')]));_0x325210[_0x0502('0x32')]=_0x325210[_0x0502('0x32')][_0x0502('0x33')]?_0x325210['attributes']:_0x5b30cd[_0x0502('0x2b')];if(_0x3f112f['query']['includeAll']){_0x325210[_0x0502('0x3f')]=[{'all':!![]}];}_0x325210=_[_0x0502('0x3b')]({},_0x325210,_0x3f112f[_0x0502('0x3d')]);return db[_0x0502('0x27')][_0x0502('0x42')](_0x325210)['then'](handleEntityNotFound(_0x34f9aa,null))['then'](respondWithResult(_0x34f9aa,null))[_0x0502('0x43')](handleError(_0x34f9aa,null));};exports[_0x0502('0x44')]=function(_0x30ac80,_0x3d1907){return db[_0x0502('0x27')][_0x0502('0x44')](_0x30ac80[_0x0502('0x45')],{})[_0x0502('0x20')](respondWithResult(_0x3d1907,0xc9))[_0x0502('0x43')](handleError(_0x3d1907,null));};exports['update']=function(_0xb52ac6,_0x264b49){if(_0xb52ac6['body']['id']){delete _0xb52ac6['body']['id'];}return db[_0x0502('0x27')][_0x0502('0x42')]({'where':{'id':_0xb52ac6['params']['id']}})[_0x0502('0x20')](handleEntityNotFound(_0x264b49,null))[_0x0502('0x20')](saveUpdates(_0xb52ac6[_0x0502('0x45')],null))[_0x0502('0x20')](respondWithResult(_0x264b49,null))[_0x0502('0x43')](handleError(_0x264b49,null));};exports['destroy']=function(_0x14d712,_0x20d855){return db[_0x0502('0x27')][_0x0502('0x42')]({'where':{'id':_0x14d712[_0x0502('0x41')]['id']}})[_0x0502('0x20')](handleEntityNotFound(_0x20d855,null))['then'](removeEntity(_0x20d855,null))[_0x0502('0x43')](handleError(_0x20d855,null));};exports['describe']=function(_0x35f03b,_0x4acc69){return db[_0x0502('0x27')][_0x0502('0x46')]()[_0x0502('0x20')](respondWithResult(_0x4acc69,null))['catch'](handleError(_0x4acc69,null));};exports['getQuestions']=function(_0x5743b7,_0x361d2a,_0x5e9d3f){var _0x1deffe={'raw':!![],'where':{}};var _0x9b875b={};var _0x512afe={'count':0x0,'rows':[]};return db[_0x0502('0x27')][_0x0502('0x47')]({'where':{'id':_0x5743b7[_0x0502('0x41')]['id']}})['then'](handleEntityNotFound(_0x361d2a,null))['then'](function(_0x203e45){if(_0x203e45){_0x9b875b['model']=_[_0x0502('0x2e')](db['JscriptyQuestionReport'][_0x0502('0x28')]);_0x9b875b[_0x0502('0x2d')]=_[_0x0502('0x2e')](_0x5743b7[_0x0502('0x2d')]);_0x9b875b[_0x0502('0x2f')]=_[_0x0502('0x30')](_0x9b875b[_0x0502('0x2b')],_0x9b875b[_0x0502('0x2d')]);_0x1deffe[_0x0502('0x32')]=_[_0x0502('0x30')](_0x9b875b[_0x0502('0x2b')],qs[_0x0502('0x31')](_0x5743b7[_0x0502('0x2d')][_0x0502('0x31')]));_0x1deffe[_0x0502('0x32')]=_0x1deffe[_0x0502('0x32')][_0x0502('0x33')]?_0x1deffe[_0x0502('0x32')]:_0x9b875b[_0x0502('0x2b')];if(!_0x5743b7['query']['hasOwnProperty'](_0x0502('0x35'))){_0x1deffe[_0x0502('0x1c')]=qs[_0x0502('0x1c')](_0x5743b7[_0x0502('0x2d')][_0x0502('0x1c')]);_0x1deffe[_0x0502('0x1b')]=qs[_0x0502('0x1b')](_0x5743b7[_0x0502('0x2d')][_0x0502('0x1b')]);}_0x1deffe[_0x0502('0x36')]=qs[_0x0502('0x37')](_0x5743b7[_0x0502('0x2d')][_0x0502('0x37')]);_0x1deffe['where']=qs[_0x0502('0x2f')](_[_0x0502('0x38')](_0x5743b7[_0x0502('0x2d')],_0x9b875b[_0x0502('0x2f')]));_0x1deffe[_0x0502('0x3a')][_0x0502('0x48')]=_0x203e45['id'];if(_0x5743b7[_0x0502('0x2d')][_0x0502('0x39')]){_0x1deffe[_0x0502('0x3a')]=_[_0x0502('0x3b')](_0x1deffe['where'],{'$or':_['map'](_0x1deffe[_0x0502('0x32')],function(_0x118c59){var _0x1add83={};_0x1add83[_0x118c59]={'$like':'%'+_0x5743b7[_0x0502('0x2d')][_0x0502('0x39')]+'%'};return _0x1add83;})});}_0x1deffe=_['merge']({},_0x1deffe,_0x5743b7[_0x0502('0x3d')]);return db[_0x0502('0x49')]['count']({'where':_0x1deffe['where']})[_0x0502('0x20')](function(_0x517eba){_0x512afe['count']=_0x517eba;if(_0x5743b7['query'][_0x0502('0x3e')]){_0x1deffe[_0x0502('0x3f')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x0502('0x4a')](_0x1deffe);})[_0x0502('0x20')](function(_0x5ab7ba){_0x512afe['rows']=_0x5ab7ba;return _0x512afe;});}})[_0x0502('0x20')](respondWithFilteredResult(_0x361d2a,_0x1deffe))[_0x0502('0x43')](handleError(_0x361d2a,null));}; \ No newline at end of file +var _0x810a=['json','count','offset','apply','reject','save','update','destroy','then','sendStatus','error','name','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','getQuestions','JscriptyQuestionReport','SessionId','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end'];(function(_0x358806,_0x322b66){var _0x19fdcb=function(_0xe01b8d){while(--_0xe01b8d){_0x358806['push'](_0x358806['shift']());}};_0x19fdcb(++_0x322b66);}(_0x810a,0x16f));var _0xa810=function(_0x4899ee,_0x5f35a2){_0x4899ee=_0x4899ee-0x0;var _0x1c5a0e=_0x810a[_0x4899ee];return _0x1c5a0e;};'use strict';var pdf=require(_0xa810('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa810('0x1'));var zipdir=require(_0xa810('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa810('0x3'));var moment=require(_0xa810('0x4'));var BPromise=require(_0xa810('0x5'));var Mustache=require(_0xa810('0x6'));var util=require(_0xa810('0x7'));var path=require(_0xa810('0x8'));var sox=require('sox');var csv=require(_0xa810('0x9'));var ejs=require(_0xa810('0xa'));var fs=require('fs');var _=require(_0xa810('0xb'));var squel=require(_0xa810('0xc'));var crypto=require('crypto');var jsforce=require(_0xa810('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa810('0x9'));var querystring=require(_0xa810('0xe'));var Papa=require(_0xa810('0xf'));var Redis=require(_0xa810('0x10'));var authService=require(_0xa810('0x11'));var qs=require(_0xa810('0x12'));var as=require(_0xa810('0x13'));var hardwareService=require(_0xa810('0x14'));var logger=require(_0xa810('0x15'))(_0xa810('0x16'));var utils=require(_0xa810('0x17'));var config=require(_0xa810('0x18'));var db=require(_0xa810('0x19'))['db'];function respondWithStatusCode(_0x1166d1,_0x348515){_0x348515=_0x348515||0xcc;return function(_0x4fc4b9){if(_0x4fc4b9){return _0x1166d1['sendStatus'](_0x348515);}return _0x1166d1[_0xa810('0x1a')](_0x348515)[_0xa810('0x1b')]();};}function respondWithResult(_0x298c53,_0x3ffe74){_0x3ffe74=_0x3ffe74||0xc8;return function(_0x43a998){if(_0x43a998){return _0x298c53[_0xa810('0x1a')](_0x3ffe74)[_0xa810('0x1c')](_0x43a998);}};}function respondWithFilteredResult(_0x3b6ee8,_0x32a286){return function(_0x370e19){if(_0x370e19){var _0x55e2af=_0x370e19[_0xa810('0x1d')],_0x1530b4=_0x32a286[_0xa810('0x1e')],_0x3d5f9d=_0x32a286[_0xa810('0x1e')]+_0x32a286['limit'],_0x23aca5;if(_0x3d5f9d>=_0x55e2af){_0x3d5f9d=_0x55e2af;_0x23aca5=0xc8;}else{_0x23aca5=0xce;}_0x3b6ee8['status'](_0x23aca5);return _0x3b6ee8['set']('Content-Range',_0x1530b4+'-'+_0x3d5f9d+'/'+_0x55e2af)['json'](_0x370e19);}return null;};}function patchUpdates(_0xfcf96c){return function(_0x112069){try{jsonpatch[_0xa810('0x1f')](_0x112069,_0xfcf96c,!![]);}catch(_0x3d20ac){return BPromise[_0xa810('0x20')](_0x3d20ac);}return _0x112069[_0xa810('0x21')]();};}function saveUpdates(_0x2c6f60,_0x38a741){return function(_0x2262bd){if(_0x2262bd){return _0x2262bd[_0xa810('0x22')](_0x2c6f60)['then'](function(_0x58eed0){return _0x58eed0;});}return null;};}function removeEntity(_0x256fc4,_0x377a4c){return function(_0x57e7ae){if(_0x57e7ae){return _0x57e7ae[_0xa810('0x23')]()[_0xa810('0x24')](function(){_0x256fc4[_0xa810('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe96563,_0x4ad4fd){return function(_0x4c9a90){if(!_0x4c9a90){_0xe96563[_0xa810('0x25')](0x194);}return _0x4c9a90;};}function handleError(_0x58b69a,_0x50aaa5){_0x50aaa5=_0x50aaa5||0x1f4;return function(_0x2c17e6){logger[_0xa810('0x26')](_0x2c17e6['stack']);if(_0x2c17e6[_0xa810('0x27')]){delete _0x2c17e6[_0xa810('0x27')];}_0x58b69a['status'](_0x50aaa5)['send'](_0x2c17e6);};}exports[_0xa810('0x28')]=function(_0x152dd5,_0x570c11){var _0x4cbcc0={},_0x19fb20={},_0x1ee063={'count':0x0,'rows':[]};var _0xe20156=_[_0xa810('0x29')](db[_0xa810('0x2a')][_0xa810('0x2b')],function(_0x194924){return{'name':_0x194924[_0xa810('0x2c')],'type':_0x194924[_0xa810('0x2d')][_0xa810('0x2e')]};});_0x19fb20[_0xa810('0x2f')]=_[_0xa810('0x29')](_0xe20156,_0xa810('0x27'));_0x19fb20['query']=_[_0xa810('0x30')](_0x152dd5['query']);_0x19fb20['filters']=_[_0xa810('0x31')](_0x19fb20['model'],_0x19fb20[_0xa810('0x32')]);_0x4cbcc0['attributes']=_['intersection'](_0x19fb20[_0xa810('0x2f')],qs[_0xa810('0x33')](_0x152dd5[_0xa810('0x32')][_0xa810('0x33')]));_0x4cbcc0[_0xa810('0x34')]=_0x4cbcc0['attributes'][_0xa810('0x35')]?_0x4cbcc0[_0xa810('0x34')]:_0x19fb20[_0xa810('0x2f')];if(!_0x152dd5[_0xa810('0x32')][_0xa810('0x36')]('nolimit')){_0x4cbcc0[_0xa810('0x37')]=qs['limit'](_0x152dd5[_0xa810('0x32')]['limit']);_0x4cbcc0[_0xa810('0x1e')]=qs[_0xa810('0x1e')](_0x152dd5[_0xa810('0x32')][_0xa810('0x1e')]);}_0x4cbcc0[_0xa810('0x38')]=qs['sort'](_0x152dd5[_0xa810('0x32')][_0xa810('0x39')]);_0x4cbcc0[_0xa810('0x3a')]=qs[_0xa810('0x3b')](_[_0xa810('0x3c')](_0x152dd5[_0xa810('0x32')],_0x19fb20[_0xa810('0x3b')]),_0xe20156);if(_0x152dd5[_0xa810('0x32')][_0xa810('0x3d')]){_0x4cbcc0['where']=_[_0xa810('0x3e')](_0x4cbcc0['where'],{'$or':_[_0xa810('0x29')](_0xe20156,function(_0x365de4){if(_0x365de4[_0xa810('0x2d')]!==_0xa810('0x3f')){var _0x11d581={};_0x11d581[_0x365de4['name']]={'$like':'%'+_0x152dd5['query'][_0xa810('0x3d')]+'%'};return _0x11d581;}})});}_0x4cbcc0=_[_0xa810('0x3e')]({},_0x4cbcc0,_0x152dd5[_0xa810('0x40')]);var _0x17894f={'where':_0x4cbcc0[_0xa810('0x3a')]};return db['JscriptySessionReport'][_0xa810('0x1d')](_0x17894f)[_0xa810('0x24')](function(_0x1836b0){_0x1ee063['count']=_0x1836b0;if(_0x152dd5[_0xa810('0x32')][_0xa810('0x41')]){_0x4cbcc0[_0xa810('0x42')]=[{'all':!![]}];}return db[_0xa810('0x2a')][_0xa810('0x43')](_0x4cbcc0);})[_0xa810('0x24')](function(_0x1f04b9){_0x1ee063[_0xa810('0x44')]=_0x1f04b9;return _0x1ee063;})[_0xa810('0x24')](respondWithFilteredResult(_0x570c11,_0x4cbcc0))['catch'](handleError(_0x570c11,null));};exports[_0xa810('0x45')]=function(_0x3f5d6d,_0x51d447){var _0x1611b0={'raw':!![],'where':{'id':_0x3f5d6d[_0xa810('0x46')]['id']}},_0x509039={};_0x509039[_0xa810('0x2f')]=_[_0xa810('0x30')](db[_0xa810('0x2a')][_0xa810('0x2b')]);_0x509039[_0xa810('0x32')]=_[_0xa810('0x30')](_0x3f5d6d[_0xa810('0x32')]);_0x509039['filters']=_[_0xa810('0x31')](_0x509039['model'],_0x509039[_0xa810('0x32')]);_0x1611b0[_0xa810('0x34')]=_[_0xa810('0x31')](_0x509039[_0xa810('0x2f')],qs[_0xa810('0x33')](_0x3f5d6d[_0xa810('0x32')][_0xa810('0x33')]));_0x1611b0[_0xa810('0x34')]=_0x1611b0[_0xa810('0x34')][_0xa810('0x35')]?_0x1611b0['attributes']:_0x509039[_0xa810('0x2f')];if(_0x3f5d6d[_0xa810('0x32')][_0xa810('0x41')]){_0x1611b0['include']=[{'all':!![]}];}_0x1611b0=_[_0xa810('0x3e')]({},_0x1611b0,_0x3f5d6d[_0xa810('0x40')]);return db[_0xa810('0x2a')][_0xa810('0x47')](_0x1611b0)['then'](handleEntityNotFound(_0x51d447,null))[_0xa810('0x24')](respondWithResult(_0x51d447,null))[_0xa810('0x48')](handleError(_0x51d447,null));};exports[_0xa810('0x49')]=function(_0x54ae86,_0x18818c){return db[_0xa810('0x2a')]['create'](_0x54ae86[_0xa810('0x4a')],{})[_0xa810('0x24')](respondWithResult(_0x18818c,0xc9))[_0xa810('0x48')](handleError(_0x18818c,null));};exports[_0xa810('0x22')]=function(_0x5a6daf,_0x5eb62c){if(_0x5a6daf[_0xa810('0x4a')]['id']){delete _0x5a6daf[_0xa810('0x4a')]['id'];}return db[_0xa810('0x2a')][_0xa810('0x47')]({'where':{'id':_0x5a6daf['params']['id']}})[_0xa810('0x24')](handleEntityNotFound(_0x5eb62c,null))[_0xa810('0x24')](saveUpdates(_0x5a6daf['body'],null))[_0xa810('0x24')](respondWithResult(_0x5eb62c,null))[_0xa810('0x48')](handleError(_0x5eb62c,null));};exports[_0xa810('0x23')]=function(_0x214c00,_0x33709f){return db[_0xa810('0x2a')][_0xa810('0x47')]({'where':{'id':_0x214c00[_0xa810('0x46')]['id']}})['then'](handleEntityNotFound(_0x33709f,null))[_0xa810('0x24')](removeEntity(_0x33709f,null))['catch'](handleError(_0x33709f,null));};exports[_0xa810('0x4b')]=function(_0x551e85,_0xacf231){return db[_0xa810('0x2a')][_0xa810('0x4b')]()[_0xa810('0x24')](respondWithResult(_0xacf231,null))[_0xa810('0x48')](handleError(_0xacf231,null));};exports[_0xa810('0x4c')]=function(_0x45b64b,_0xe7cb,_0x1ac9ca){var _0x58035a={'raw':!![],'where':{}};var _0x1881aa={};var _0x52922b={'count':0x0,'rows':[]};return db[_0xa810('0x2a')]['findOne']({'where':{'id':_0x45b64b['params']['id']}})[_0xa810('0x24')](handleEntityNotFound(_0xe7cb,null))[_0xa810('0x24')](function(_0x2c39ee){if(_0x2c39ee){_0x1881aa[_0xa810('0x2f')]=_[_0xa810('0x30')](db[_0xa810('0x4d')][_0xa810('0x2b')]);_0x1881aa[_0xa810('0x32')]=_['keys'](_0x45b64b['query']);_0x1881aa[_0xa810('0x3b')]=_['intersection'](_0x1881aa[_0xa810('0x2f')],_0x1881aa[_0xa810('0x32')]);_0x58035a[_0xa810('0x34')]=_[_0xa810('0x31')](_0x1881aa[_0xa810('0x2f')],qs[_0xa810('0x33')](_0x45b64b['query'][_0xa810('0x33')]));_0x58035a[_0xa810('0x34')]=_0x58035a[_0xa810('0x34')][_0xa810('0x35')]?_0x58035a[_0xa810('0x34')]:_0x1881aa[_0xa810('0x2f')];if(!_0x45b64b[_0xa810('0x32')][_0xa810('0x36')]('nolimit')){_0x58035a[_0xa810('0x37')]=qs[_0xa810('0x37')](_0x45b64b[_0xa810('0x32')]['limit']);_0x58035a[_0xa810('0x1e')]=qs[_0xa810('0x1e')](_0x45b64b[_0xa810('0x32')][_0xa810('0x1e')]);}_0x58035a[_0xa810('0x38')]=qs[_0xa810('0x39')](_0x45b64b[_0xa810('0x32')][_0xa810('0x39')]);_0x58035a[_0xa810('0x3a')]=qs[_0xa810('0x3b')](_['pick'](_0x45b64b[_0xa810('0x32')],_0x1881aa[_0xa810('0x3b')]));_0x58035a[_0xa810('0x3a')][_0xa810('0x4e')]=_0x2c39ee['id'];if(_0x45b64b[_0xa810('0x32')][_0xa810('0x3d')]){_0x58035a[_0xa810('0x3a')]=_[_0xa810('0x3e')](_0x58035a[_0xa810('0x3a')],{'$or':_['map'](_0x58035a[_0xa810('0x34')],function(_0x580b85){var _0x39b15f={};_0x39b15f[_0x580b85]={'$like':'%'+_0x45b64b[_0xa810('0x32')]['filter']+'%'};return _0x39b15f;})});}_0x58035a=_[_0xa810('0x3e')]({},_0x58035a,_0x45b64b[_0xa810('0x40')]);return db['JscriptyQuestionReport'][_0xa810('0x1d')]({'where':_0x58035a[_0xa810('0x3a')]})[_0xa810('0x24')](function(_0x3961c6){_0x52922b[_0xa810('0x1d')]=_0x3961c6;if(_0x45b64b[_0xa810('0x32')][_0xa810('0x41')]){_0x58035a[_0xa810('0x42')]=[{'all':!![]}];}return db[_0xa810('0x4d')][_0xa810('0x43')](_0x58035a);})[_0xa810('0x24')](function(_0x4f7e26){_0x52922b[_0xa810('0x44')]=_0x4f7e26;return _0x52922b;});}})[_0xa810('0x24')](respondWithFilteredResult(_0xe7cb,_0x58035a))[_0xa810('0x48')](handleError(_0xe7cb,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 1c3fdb0..6d3b919 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 _0x71ab=['exports','define','JscriptySessionReport','report_jscripty_sessions','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x5550a8,_0xc45258){var _0x1d32a4=function(_0x124a4f){while(--_0x124a4f){_0x5550a8['push'](_0x5550a8['shift']());}};_0x1d32a4(++_0xc45258);}(_0x71ab,0x64));var _0xb71a=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x71ab[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));module[_0xb71a('0x8')]=function(_0x38d931,_0x22c072){return _0x38d931[_0xb71a('0x9')](_0xb71a('0xa'),attributes,{'tableName':_0xb71a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf61e=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','lodash','util','../../config/logger','api','moment'];(function(_0xfc8838,_0x121ac2){var _0xb02824=function(_0x375527){while(--_0x375527){_0xfc8838['push'](_0xfc8838['shift']());}};_0xb02824(++_0x121ac2);}(_0xf61e,0x191));var _0xef61=function(_0x594786,_0x4866f2){_0x594786=_0x594786-0x0;var _0x5833ca=_0xf61e[_0x594786];return _0x5833ca;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var logger=require(_0xef61('0x2'))(_0xef61('0x3'));var moment=require(_0xef61('0x4'));var BPromise=require(_0xef61('0x5'));var rp=require(_0xef61('0x6'));var fs=require('fs');var path=require(_0xef61('0x7'));var rimraf=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var attributes=require(_0xef61('0xa'));module[_0xef61('0xb')]=function(_0x5b00b2,_0x9e17f4){return _0x5b00b2[_0xef61('0xc')]('JscriptySessionReport',attributes,{'tableName':_0xef61('0xd'),'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 73681b8..d17cf8e 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 _0x9cb4=['jayson/promise','client','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5d549e,_0x19cd53){var _0xf90e8d=function(_0x54a480){while(--_0x54a480){_0x5d549e['push'](_0x5d549e['shift']());}};_0xf90e8d(++_0x19cd53);}(_0x9cb4,0x1a6));var _0x49cb=function(_0x12f0a4,_0x4195a5){_0x12f0a4=_0x12f0a4-0x0;var _0x4ab646=_0x9cb4[_0x12f0a4];return _0x4ab646;};'use strict';var _=require(_0x49cb('0x0'));var util=require('util');var moment=require(_0x49cb('0x1'));var BPromise=require(_0x49cb('0x2'));var rs=require(_0x49cb('0x3'));var fs=require('fs');var Redis=require(_0x49cb('0x4'));var db=require(_0x49cb('0x5'))['db'];var utils=require(_0x49cb('0x6'));var logger=require(_0x49cb('0x7'))(_0x49cb('0x8'));var config=require(_0x49cb('0x9'));var jayson=require(_0x49cb('0xa'));var client=jayson[_0x49cb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c2b6b,_0x2533cf,_0x4e2d2e){return new BPromise(function(_0xa56ecf,_0x32eb23){return client[_0x49cb('0xc')](_0x1c2b6b,_0x4e2d2e)[_0x49cb('0xd')](function(_0x1ad98d){logger[_0x49cb('0xe')](_0x49cb('0xf'),_0x2533cf,_0x49cb('0x10'));logger[_0x49cb('0x11')](_0x49cb('0x12'),_0x2533cf,_0x49cb('0x10'),JSON[_0x49cb('0x13')](_0x1ad98d));if(_0x1ad98d[_0x49cb('0x14')]){if(_0x1ad98d['error'][_0x49cb('0x15')]===0x1f4){logger[_0x49cb('0x14')](_0x49cb('0xf'),_0x2533cf,_0x1ad98d['error'][_0x49cb('0x16')]);return _0x32eb23(_0x1ad98d[_0x49cb('0x14')][_0x49cb('0x16')]);}logger[_0x49cb('0x14')](_0x49cb('0xf'),_0x2533cf,_0x1ad98d['error'][_0x49cb('0x16')]);return _0xa56ecf(_0x1ad98d[_0x49cb('0x14')][_0x49cb('0x16')]);}else{logger[_0x49cb('0xe')](_0x49cb('0xf'),_0x2533cf,_0x49cb('0x10'));_0xa56ecf(_0x1ad98d[_0x49cb('0x17')][_0x49cb('0x16')]);}})['catch'](function(_0x59c4b8){logger['error'](_0x49cb('0xf'),_0x2533cf,_0x59c4b8);_0x32eb23(_0x59c4b8);});});} \ No newline at end of file +var _0x81c1=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x3ae84a,_0x44bb5a){var _0x3fab58=function(_0x2e9208){while(--_0x2e9208){_0x3ae84a['push'](_0x3ae84a['shift']());}};_0x3fab58(++_0x44bb5a);}(_0x81c1,0x129));var _0x181c=function(_0x16767e,_0x44a9e4){_0x16767e=_0x16767e-0x0;var _0x38ab9d=_0x81c1[_0x16767e];return _0x38ab9d;};'use strict';var _=require(_0x181c('0x0'));var util=require(_0x181c('0x1'));var moment=require(_0x181c('0x2'));var BPromise=require(_0x181c('0x3'));var rs=require(_0x181c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x181c('0x5'))['db'];var utils=require(_0x181c('0x6'));var logger=require('../../config/logger')(_0x181c('0x7'));var config=require('../../config/environment');var jayson=require(_0x181c('0x8'));var client=jayson[_0x181c('0x9')][_0x181c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x459580,_0x3dfa55,_0x540609){return new BPromise(function(_0x461e06,_0x2f4fd7){return client[_0x181c('0xb')](_0x459580,_0x540609)['then'](function(_0x15d8cf){logger[_0x181c('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x3dfa55,_0x181c('0xd'));logger[_0x181c('0xe')](_0x181c('0xf'),_0x3dfa55,_0x181c('0xd'),JSON[_0x181c('0x10')](_0x15d8cf));if(_0x15d8cf[_0x181c('0x11')]){if(_0x15d8cf[_0x181c('0x11')][_0x181c('0x12')]===0x1f4){logger[_0x181c('0x11')](_0x181c('0x13'),_0x3dfa55,_0x15d8cf['error'][_0x181c('0x14')]);return _0x2f4fd7(_0x15d8cf['error'][_0x181c('0x14')]);}logger['error'](_0x181c('0x13'),_0x3dfa55,_0x15d8cf[_0x181c('0x11')][_0x181c('0x14')]);return _0x461e06(_0x15d8cf['error'][_0x181c('0x14')]);}else{logger[_0x181c('0xc')](_0x181c('0x13'),_0x3dfa55,_0x181c('0xd'));_0x461e06(_0x15d8cf[_0x181c('0x15')][_0x181c('0x14')]);}})[_0x181c('0x16')](function(_0x7c9975){logger[_0x181c('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x3dfa55,_0x7c9975);_0x2f4fd7(_0x7c9975);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 2b30ade..b2176aa 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 _0x2c4b=['/:id','isAuthenticated','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0x2c4b,0x185));var _0xb2c4=function(_0x417ede,_0x1bbd67){_0x417ede=_0x417ede-0x0;var _0x544690=_0x2c4b[_0x417ede];return _0x544690;};'use strict';var multer=require(_0xb2c4('0x0'));var util=require('util');var path=require(_0xb2c4('0x1'));var timeout=require(_0xb2c4('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xb2c4('0x3'));var interaction=require(_0xb2c4('0x4'));var config=require(_0xb2c4('0x5'));var controller=require(_0xb2c4('0x6'));router['get']('/',controller['index']);router['put'](_0xb2c4('0x7'),auth[_0xb2c4('0x8')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x556f=['../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id','isAuthenticated','exports','multer','util','path','express'];(function(_0x399d0c,_0x3d4ce){var _0x1a5462=function(_0x2a5f24){while(--_0x2a5f24){_0x399d0c['push'](_0x399d0c['shift']());}};_0x1a5462(++_0x3d4ce);}(_0x556f,0x68));var _0xf556=function(_0x1a60d6,_0x35134b){_0x1a60d6=_0x1a60d6-0x0;var _0x215786=_0x556f[_0x1a60d6];return _0x215786;};'use strict';var multer=require(_0xf556('0x0'));var util=require(_0xf556('0x1'));var path=require(_0xf556('0x2'));var timeout=require('connect-timeout');var express=require(_0xf556('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xf556('0x4'));var config=require(_0xf556('0x5'));var controller=require(_0xf556('0x6'));router[_0xf556('0x7')]('/',controller['index']);router[_0xf556('0x8')](_0xf556('0x9'),auth[_0xf556('0xa')](),controller['update']);module[_0xf556('0xb')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 7b691f9..47999f1 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 _0x4975=['STRING','INTEGER','sequelize','TEXT'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x4975,0x86));var _0x5497=function(_0x59331d,_0x27de63){_0x59331d=_0x59331d-0x0;var _0x42c178=_0x4975[_0x59331d];return _0x42c178;};'use strict';var Sequelize=require(_0x5497('0x0'));module['exports']={'license':{'type':Sequelize[_0x5497('0x1')]},'data1':{'type':Sequelize[_0x5497('0x2')]},'data2':{'type':Sequelize[_0x5497('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x5497('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x46ed=['sequelize','exports','STRING','INTEGER'];(function(_0x2a238a,_0x1d5054){var _0xeef802=function(_0x583637){while(--_0x583637){_0x2a238a['push'](_0x2a238a['shift']());}};_0xeef802(++_0x1d5054);}(_0x46ed,0x168));var _0xd46e=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x46ed[_0x29d94e];return _0x106237;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xd46e('0x2')]},'data2':{'type':Sequelize[_0xd46e('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xd46e('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 9403441..51a91c6 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 _0xc1ec=['request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','then','error','name','index','model','keys','License','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','params','get','checkLicense','key','demo','html-pdf','eml-format','fast-json-patch'];(function(_0x2bb276,_0x2a28f1){var _0x1ea21c=function(_0x1153ba){while(--_0x1153ba){_0x2bb276['push'](_0x2bb276['shift']());}};_0x1ea21c(++_0x2a28f1);}(_0xc1ec,0x115));var _0xcc1e=function(_0x25926d,_0x4911d7){_0x25926d=_0x25926d-0x0;var _0x3b0e57=_0xc1ec[_0x25926d];return _0x3b0e57;};'use strict';var pdf=require(_0xcc1e('0x0'));var emlformat=require(_0xcc1e('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcc1e('0x2'));var rp=require(_0xcc1e('0x3'));var moment=require(_0xcc1e('0x4'));var BPromise=require(_0xcc1e('0x5'));var Mustache=require(_0xcc1e('0x6'));var util=require(_0xcc1e('0x7'));var path=require(_0xcc1e('0x8'));var sox=require('sox');var csv=require(_0xcc1e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xcc1e('0xa'));var crypto=require(_0xcc1e('0xb'));var jsforce=require(_0xcc1e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcc1e('0x9'));var querystring=require(_0xcc1e('0xd'));var Papa=require(_0xcc1e('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcc1e('0xf'));var as=require(_0xcc1e('0x10'));var hardwareService=require(_0xcc1e('0x11'));var logger=require(_0xcc1e('0x12'))(_0xcc1e('0x13'));var utils=require('../../config/utils');var config=require(_0xcc1e('0x14'));var db=require(_0xcc1e('0x15'))['db'];function respondWithStatusCode(_0x4657f8,_0x36adb5){_0x36adb5=_0x36adb5||0xcc;return function(_0x3cbfb1){if(_0x3cbfb1){return _0x4657f8[_0xcc1e('0x16')](_0x36adb5);}return _0x4657f8[_0xcc1e('0x17')](_0x36adb5)[_0xcc1e('0x18')]();};}function respondWithResult(_0x29051f,_0x392dc6){_0x392dc6=_0x392dc6||0xc8;return function(_0x210e62){if(_0x210e62){return _0x29051f[_0xcc1e('0x17')](_0x392dc6)[_0xcc1e('0x19')](_0x210e62);}};}function respondWithFilteredResult(_0x8308da,_0x2a7913){return function(_0x152bae){if(_0x152bae){var _0x199bf3=_0x152bae[_0xcc1e('0x1a')],_0x4f7e15=_0x2a7913[_0xcc1e('0x1b')],_0x378ab5=_0x2a7913[_0xcc1e('0x1b')]+_0x2a7913[_0xcc1e('0x1c')],_0x2304e7;if(_0x378ab5>=_0x199bf3){_0x378ab5=_0x199bf3;_0x2304e7=0xc8;}else{_0x2304e7=0xce;}_0x8308da[_0xcc1e('0x17')](_0x2304e7);return _0x8308da[_0xcc1e('0x1d')]('Content-Range',_0x4f7e15+'-'+_0x378ab5+'/'+_0x199bf3)['json'](_0x152bae);}return null;};}function patchUpdates(_0x2416d2){return function(_0x183f35){try{jsonpatch['apply'](_0x183f35,_0x2416d2,!![]);}catch(_0x5c01cb){return BPromise[_0xcc1e('0x1e')](_0x5c01cb);}return _0x183f35[_0xcc1e('0x1f')]();};}function saveUpdates(_0xda7b6f,_0x1e1ffc){return function(_0x56620d){if(_0x56620d){return _0x56620d[_0xcc1e('0x20')](_0xda7b6f)[_0xcc1e('0x21')](function(_0x35c48c){return _0x35c48c;});}return null;};}function removeEntity(_0xa48156,_0x329b51){return function(_0x120702){if(_0x120702){return _0x120702['destroy']()['then'](function(){_0xa48156[_0xcc1e('0x17')](0xcc)[_0xcc1e('0x18')]();});}};}function handleEntityNotFound(_0x2dfd80,_0x330a73){return function(_0x35f2a0){if(!_0x35f2a0){_0x2dfd80[_0xcc1e('0x16')](0x194);}return _0x35f2a0;};}function handleError(_0x338790,_0x1de257){_0x1de257=_0x1de257||0x1f4;return function(_0x258d6d){logger[_0xcc1e('0x22')](_0x258d6d['stack']);if(_0x258d6d[_0xcc1e('0x23')]){delete _0x258d6d[_0xcc1e('0x23')];}_0x338790[_0xcc1e('0x17')](_0x1de257)['send'](_0x258d6d);};}var utilLicense=require('../../config/license/util');exports[_0xcc1e('0x24')]=function(_0x2cca16,_0x45466f){var _0x50fffb={'raw':!![],'where':{'id':0x1}},_0x8f2e1b={};_0x8f2e1b[_0xcc1e('0x25')]=_[_0xcc1e('0x26')](db[_0xcc1e('0x27')]['rawAttributes']);_0x8f2e1b[_0xcc1e('0x28')]=_[_0xcc1e('0x26')](_0x2cca16[_0xcc1e('0x28')]);_0x8f2e1b[_0xcc1e('0x29')]=_[_0xcc1e('0x2a')](_0x8f2e1b[_0xcc1e('0x25')],_0x8f2e1b[_0xcc1e('0x28')]);_0x50fffb[_0xcc1e('0x2b')]=_['intersection'](_0x8f2e1b[_0xcc1e('0x25')],qs[_0xcc1e('0x2c')](_0x2cca16[_0xcc1e('0x28')]['fields']));_0x50fffb['attributes']=_0x50fffb[_0xcc1e('0x2b')][_0xcc1e('0x2d')]?_0x50fffb[_0xcc1e('0x2b')]:_0x8f2e1b[_0xcc1e('0x25')];_0x50fffb=_[_0xcc1e('0x2e')]({},_0x50fffb,_0x2cca16[_0xcc1e('0x2f')]);return utilLicense[_0xcc1e('0x30')](_0x50fffb)[_0xcc1e('0x21')](respondWithResult(_0x45466f,null))[_0xcc1e('0x31')](handleError(_0x45466f,null));};exports[_0xcc1e('0x20')]=function(_0x152f77,_0x2ed76f){if(_0x152f77[_0xcc1e('0x32')]['id']){delete _0x152f77[_0xcc1e('0x32')]['id'];}return db[_0xcc1e('0x27')]['find']({'where':{'id':_0x152f77[_0xcc1e('0x33')]['id']}})[_0xcc1e('0x21')](handleEntityNotFound(_0x2ed76f,null))[_0xcc1e('0x21')](function(_0x2a136a){var _0x324fdc=_0x2a136a[_0xcc1e('0x34')]({'plain':!![]});return utilLicense[_0xcc1e('0x35')](_0x324fdc,_0x152f77[_0xcc1e('0x32')][_0xcc1e('0x36')]);})['then'](function(_0x198ada){if(!_0x198ada[_0xcc1e('0x37')]){return saveUpdates(_0x152f77[_0xcc1e('0x32')],null);}return _0x198ada;})[_0xcc1e('0x21')](respondWithResult(_0x2ed76f,null))[_0xcc1e('0x31')](handleError(_0x2ed76f,null));}; \ No newline at end of file +var _0xe738=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','stack','name','send','index','model','rawAttributes','filters','attributes','intersection','fields','query','merge','options','getLicense','catch','update','body','License','find','get','checkLicense','key','demo','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xe738,0xa7));var _0x8e73=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe738[_0xfae23b];return _0x200640;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8e73('0x0'));var zipdir=require(_0x8e73('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8e73('0x2'));var moment=require(_0x8e73('0x3'));var BPromise=require(_0x8e73('0x4'));var Mustache=require('mustache');var util=require(_0x8e73('0x5'));var path=require(_0x8e73('0x6'));var sox=require(_0x8e73('0x7'));var csv=require(_0x8e73('0x8'));var ejs=require(_0x8e73('0x9'));var fs=require('fs');var _=require(_0x8e73('0xa'));var squel=require(_0x8e73('0xb'));var crypto=require(_0x8e73('0xc'));var jsforce=require(_0x8e73('0xd'));var deskjs=require(_0x8e73('0xe'));var toCsv=require(_0x8e73('0x8'));var querystring=require(_0x8e73('0xf'));var Papa=require(_0x8e73('0x10'));var Redis=require(_0x8e73('0x11'));var authService=require(_0x8e73('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8e73('0x13'));var hardwareService=require(_0x8e73('0x14'));var logger=require(_0x8e73('0x15'))(_0x8e73('0x16'));var utils=require(_0x8e73('0x17'));var config=require(_0x8e73('0x18'));var db=require(_0x8e73('0x19'))['db'];function respondWithStatusCode(_0x10ac01,_0x1f4770){_0x1f4770=_0x1f4770||0xcc;return function(_0x7b929c){if(_0x7b929c){return _0x10ac01[_0x8e73('0x1a')](_0x1f4770);}return _0x10ac01[_0x8e73('0x1b')](_0x1f4770)[_0x8e73('0x1c')]();};}function respondWithResult(_0x51342d,_0x28618f){_0x28618f=_0x28618f||0xc8;return function(_0x10e4e6){if(_0x10e4e6){return _0x51342d[_0x8e73('0x1b')](_0x28618f)[_0x8e73('0x1d')](_0x10e4e6);}};}function respondWithFilteredResult(_0x5b373e,_0x4a29d0){return function(_0x9a2b69){if(_0x9a2b69){var _0x4a2953=_0x9a2b69[_0x8e73('0x1e')],_0x53b208=_0x4a29d0[_0x8e73('0x1f')],_0x1a80cc=_0x4a29d0[_0x8e73('0x1f')]+_0x4a29d0[_0x8e73('0x20')],_0x20f1fa;if(_0x1a80cc>=_0x4a2953){_0x1a80cc=_0x4a2953;_0x20f1fa=0xc8;}else{_0x20f1fa=0xce;}_0x5b373e['status'](_0x20f1fa);return _0x5b373e[_0x8e73('0x21')](_0x8e73('0x22'),_0x53b208+'-'+_0x1a80cc+'/'+_0x4a2953)[_0x8e73('0x1d')](_0x9a2b69);}return null;};}function patchUpdates(_0x25dd15){return function(_0x2649a9){try{jsonpatch[_0x8e73('0x23')](_0x2649a9,_0x25dd15,!![]);}catch(_0x6c6a08){return BPromise[_0x8e73('0x24')](_0x6c6a08);}return _0x2649a9['save']();};}function saveUpdates(_0x1df420,_0x4452){return function(_0xc414e6){if(_0xc414e6){return _0xc414e6['update'](_0x1df420)[_0x8e73('0x25')](function(_0xda5c11){return _0xda5c11;});}return null;};}function removeEntity(_0x46d152,_0x12d9df){return function(_0x45cf2a){if(_0x45cf2a){return _0x45cf2a['destroy']()[_0x8e73('0x25')](function(){_0x46d152[_0x8e73('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a0424,_0x24024c){return function(_0x312757){if(!_0x312757){_0x1a0424[_0x8e73('0x1a')](0x194);}return _0x312757;};}function handleError(_0x18d2c2,_0x43a891){_0x43a891=_0x43a891||0x1f4;return function(_0x21f3ad){logger['error'](_0x21f3ad[_0x8e73('0x26')]);if(_0x21f3ad[_0x8e73('0x27')]){delete _0x21f3ad[_0x8e73('0x27')];}_0x18d2c2['status'](_0x43a891)[_0x8e73('0x28')](_0x21f3ad);};}var utilLicense=require('../../config/license/util');exports[_0x8e73('0x29')]=function(_0x21e007,_0x3de51d){var _0x5c02f7={'raw':!![],'where':{'id':0x1}},_0x54fde2={};_0x54fde2[_0x8e73('0x2a')]=_['keys'](db['License'][_0x8e73('0x2b')]);_0x54fde2['query']=_['keys'](_0x21e007['query']);_0x54fde2[_0x8e73('0x2c')]=_['intersection'](_0x54fde2[_0x8e73('0x2a')],_0x54fde2['query']);_0x5c02f7[_0x8e73('0x2d')]=_[_0x8e73('0x2e')](_0x54fde2[_0x8e73('0x2a')],qs[_0x8e73('0x2f')](_0x21e007[_0x8e73('0x30')][_0x8e73('0x2f')]));_0x5c02f7[_0x8e73('0x2d')]=_0x5c02f7[_0x8e73('0x2d')]['length']?_0x5c02f7['attributes']:_0x54fde2[_0x8e73('0x2a')];_0x5c02f7=_[_0x8e73('0x31')]({},_0x5c02f7,_0x21e007[_0x8e73('0x32')]);return utilLicense[_0x8e73('0x33')](_0x5c02f7)['then'](respondWithResult(_0x3de51d,null))[_0x8e73('0x34')](handleError(_0x3de51d,null));};exports[_0x8e73('0x35')]=function(_0x43e1f5,_0x56692f){if(_0x43e1f5[_0x8e73('0x36')]['id']){delete _0x43e1f5[_0x8e73('0x36')]['id'];}return db[_0x8e73('0x37')][_0x8e73('0x38')]({'where':{'id':_0x43e1f5['params']['id']}})[_0x8e73('0x25')](handleEntityNotFound(_0x56692f,null))[_0x8e73('0x25')](function(_0x2310fa){var _0x24d80e=_0x2310fa[_0x8e73('0x39')]({'plain':!![]});return utilLicense[_0x8e73('0x3a')](_0x24d80e,_0x43e1f5[_0x8e73('0x36')][_0x8e73('0x3b')]);})['then'](function(_0x487921){if(!_0x487921[_0x8e73('0x3c')]){return saveUpdates(_0x43e1f5[_0x8e73('0x36')],null);}return _0x487921;})[_0x8e73('0x25')](respondWithResult(_0x56692f,null))['catch'](handleError(_0x56692f,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 4f8911c..d8a1cba 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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','license','lodash','../../config/logger'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xb10b,0x12a));var _0xbb10=function(_0x3f78b0,_0x3e102f){_0x3f78b0=_0x3f78b0-0x0;var _0x226432=_0xb10b[_0x3f78b0];return _0x226432;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('License',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','license','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2ebcd9,_0xbb38b5){var _0x2cf27f=function(_0x26bc9f){while(--_0x26bc9f){_0x2ebcd9['push'](_0x2ebcd9['shift']());}};_0x2cf27f(++_0xbb38b5);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./license.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('License',attributes,{'tableName':_0x0d8b('0x8'),'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 3af226c..5418b1a 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 _0x4b8a=['info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x471b36,_0x2095a9){var _0x1e10c6=function(_0x2077e6){while(--_0x2077e6){_0x471b36['push'](_0x471b36['shift']());}};_0x1e10c6(++_0x2095a9);}(_0x4b8a,0xd3));var _0xa4b8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4b8a[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xa4b8('0x0'));var moment=require('moment');var BPromise=require(_0xa4b8('0x1'));var rs=require(_0xa4b8('0x2'));var fs=require('fs');var Redis=require(_0xa4b8('0x3'));var db=require(_0xa4b8('0x4'))['db'];var utils=require(_0xa4b8('0x5'));var logger=require(_0xa4b8('0x6'))(_0xa4b8('0x7'));var config=require(_0xa4b8('0x8'));var jayson=require(_0xa4b8('0x9'));var client=jayson[_0xa4b8('0xa')][_0xa4b8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2de84d,_0x455722,_0x1fea78){return new BPromise(function(_0x517970,_0x4632f3){return client[_0xa4b8('0xc')](_0x2de84d,_0x1fea78)[_0xa4b8('0xd')](function(_0x3fe4ed){logger[_0xa4b8('0xe')](_0xa4b8('0xf'),_0x455722,_0xa4b8('0x10'));logger[_0xa4b8('0x11')](_0xa4b8('0x12'),_0x455722,_0xa4b8('0x10'),JSON[_0xa4b8('0x13')](_0x3fe4ed));if(_0x3fe4ed[_0xa4b8('0x14')]){if(_0x3fe4ed[_0xa4b8('0x14')][_0xa4b8('0x15')]===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x455722,_0x3fe4ed[_0xa4b8('0x14')]['message']);return _0x4632f3(_0x3fe4ed[_0xa4b8('0x14')][_0xa4b8('0x16')]);}logger['error'](_0xa4b8('0xf'),_0x455722,_0x3fe4ed[_0xa4b8('0x14')][_0xa4b8('0x16')]);return _0x517970(_0x3fe4ed[_0xa4b8('0x14')][_0xa4b8('0x16')]);}else{logger[_0xa4b8('0xe')](_0xa4b8('0xf'),_0x455722,_0xa4b8('0x10'));_0x517970(_0x3fe4ed[_0xa4b8('0x17')]['message']);}})[_0xa4b8('0x18')](function(_0x3c8ebb){logger['error'](_0xa4b8('0xf'),_0x455722,_0x3c8ebb);_0x4632f3(_0x3c8ebb);});});} \ No newline at end of file +var _0x3a79=['rpc','../../config/environment','client','request','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','License,\x20%s,\x20%s','info','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x414b1b,_0x549bf5){var _0x49bf3a=function(_0x43e94c){while(--_0x43e94c){_0x414b1b['push'](_0x414b1b['shift']());}};_0x49bf3a(++_0x549bf5);}(_0x3a79,0xca));var _0x93a7=function(_0x4afe2c,_0x306521){_0x4afe2c=_0x4afe2c-0x0;var _0x2e83ee=_0x3a79[_0x4afe2c];return _0x2e83ee;};'use strict';var _=require('lodash');var util=require(_0x93a7('0x0'));var moment=require(_0x93a7('0x1'));var BPromise=require('bluebird');var rs=require(_0x93a7('0x2'));var fs=require('fs');var Redis=require(_0x93a7('0x3'));var db=require(_0x93a7('0x4'))['db'];var utils=require(_0x93a7('0x5'));var logger=require(_0x93a7('0x6'))(_0x93a7('0x7'));var config=require(_0x93a7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x93a7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2579e5,_0x4690bb,_0x1b59d1){return new BPromise(function(_0x2417da,_0x3a512b){return client[_0x93a7('0xa')](_0x2579e5,_0x1b59d1)['then'](function(_0x2996db){logger['info']('License,\x20%s,\x20%s',_0x4690bb,_0x93a7('0xb'));logger[_0x93a7('0xc')](_0x93a7('0xd'),_0x4690bb,'request\x20sent',JSON['stringify'](_0x2996db));if(_0x2996db[_0x93a7('0xe')]){if(_0x2996db[_0x93a7('0xe')][_0x93a7('0xf')]===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x4690bb,_0x2996db[_0x93a7('0xe')]['message']);return _0x3a512b(_0x2996db[_0x93a7('0xe')][_0x93a7('0x10')]);}logger[_0x93a7('0xe')](_0x93a7('0x11'),_0x4690bb,_0x2996db[_0x93a7('0xe')][_0x93a7('0x10')]);return _0x2417da(_0x2996db[_0x93a7('0xe')]['message']);}else{logger[_0x93a7('0x12')](_0x93a7('0x11'),_0x4690bb,'request\x20sent');_0x2417da(_0x2996db['result'][_0x93a7('0x10')]);}})['catch'](function(_0xfac49d){logger[_0x93a7('0xe')](_0x93a7('0x11'),_0x4690bb,_0xfac49d);_0x3a512b(_0xfac49d);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 78aae0c..c6597a6 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 _0x447f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','put','/:id','update','removeDispositions','delete','removeAnswers','removeSmtp','multer','path','connect-timeout'];(function(_0xa74e4c,_0x152094){var _0x5aceaa=function(_0x1ae205){while(--_0x1ae205){_0xa74e4c['push'](_0xa74e4c['shift']());}};_0x5aceaa(++_0x152094);}(_0x447f,0xb1));var _0xf447=function(_0x3aed98,_0x2330a5){_0x3aed98=_0x3aed98-0x0;var _0x53de83=_0x447f[_0x3aed98];return _0x53de83;};'use strict';var multer=require(_0xf447('0x0'));var util=require('util');var path=require(_0xf447('0x1'));var timeout=require(_0xf447('0x2'));var express=require('express');var router=express[_0xf447('0x3')]();var auth=require(_0xf447('0x4'));var interaction=require(_0xf447('0x5'));var config=require(_0xf447('0x6'));var controller=require(_0xf447('0x7'));router[_0xf447('0x8')]('/',auth[_0xf447('0x9')](),controller[_0xf447('0xa')]);router['get'](_0xf447('0xb'),auth[_0xf447('0x9')](),controller[_0xf447('0xc')]);router[_0xf447('0x8')]('/:id',auth[_0xf447('0x9')](),controller[_0xf447('0xd')]);router[_0xf447('0x8')](_0xf447('0xe'),auth['isAuthenticated'](),controller[_0xf447('0xf')]);router[_0xf447('0x8')](_0xf447('0x10'),auth[_0xf447('0x9')](),controller[_0xf447('0x11')]);router[_0xf447('0x8')](_0xf447('0x12'),auth['isAuthenticated'](),controller[_0xf447('0x13')]);router[_0xf447('0x8')](_0xf447('0x14'),auth[_0xf447('0x9')](),controller['getSmtp']);router[_0xf447('0x8')](_0xf447('0x15'),auth[_0xf447('0x9')](),controller[_0xf447('0x16')]);router[_0xf447('0x8')](_0xf447('0x17'),auth[_0xf447('0x9')](),controller[_0xf447('0x18')]);router[_0xf447('0x8')]('/:id/messages',auth[_0xf447('0x9')](),controller['getMessages']);router[_0xf447('0x8')](_0xf447('0x19'),auth[_0xf447('0x9')](),controller[_0xf447('0x1a')]);router[_0xf447('0x8')](_0xf447('0x1b'),auth['isAuthenticated'](),controller[_0xf447('0x1c')]);router[_0xf447('0x1d')](_0xf447('0xe'),auth['isAuthenticated'](),controller[_0xf447('0x1e')]);router[_0xf447('0x1d')](_0xf447('0x10'),auth[_0xf447('0x9')](),controller[_0xf447('0x1f')]);router['post']('/',auth[_0xf447('0x9')](),controller['create']);router['post'](_0xf447('0x12'),auth[_0xf447('0x9')](),controller[_0xf447('0x20')]);router[_0xf447('0x1d')](_0xf447('0x14'),auth[_0xf447('0x9')](),controller[_0xf447('0x21')]);router[_0xf447('0x1d')](_0xf447('0x15'),auth[_0xf447('0x9')](),controller[_0xf447('0x22')]);router[_0xf447('0x1d')](_0xf447('0x17'),auth[_0xf447('0x9')](),controller[_0xf447('0x23')]);router['post'](_0xf447('0x24'),auth[_0xf447('0x9')](),controller[_0xf447('0x25')]);router[_0xf447('0x1d')]('/:id/users',auth[_0xf447('0x9')](),controller['addAgents']);router[_0xf447('0x26')](_0xf447('0x27'),auth[_0xf447('0x9')](),controller[_0xf447('0x28')]);router['delete'](_0xf447('0xe'),auth[_0xf447('0x9')](),controller[_0xf447('0x29')]);router[_0xf447('0x2a')](_0xf447('0x10'),auth[_0xf447('0x9')](),controller[_0xf447('0x2b')]);router['delete'](_0xf447('0x12'),auth[_0xf447('0x9')](),controller['removeImap']);router[_0xf447('0x2a')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0xf447('0x2c')]);router[_0xf447('0x2a')](_0xf447('0x27'),auth[_0xf447('0x9')](),controller['destroy']);router[_0xf447('0x2a')](_0xf447('0x1b'),auth[_0xf447('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xb407=['index','/describe','show','/:id/canned_answers','/:id/in_servers','getImap','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','getAgents','/:id/dispositions','addDisposition','post','addAnswer','create','addImap','/:id/out_servers','addInteraction','addApplications','/:id/send','send','addAgents','/:id','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated'];(function(_0x1974a1,_0x347db8){var _0x415789=function(_0x325524){while(--_0x325524){_0x1974a1['push'](_0x1974a1['shift']());}};_0x415789(++_0x347db8);}(_0xb407,0x1c1));var _0x7b40=function(_0x3fad78,_0x1d8cc9){_0x3fad78=_0x3fad78-0x0;var _0x5a4009=_0xb407[_0x3fad78];return _0x5a4009;};'use strict';var multer=require(_0x7b40('0x0'));var util=require(_0x7b40('0x1'));var path=require(_0x7b40('0x2'));var timeout=require(_0x7b40('0x3'));var express=require(_0x7b40('0x4'));var router=express['Router']();var auth=require(_0x7b40('0x5'));var interaction=require(_0x7b40('0x6'));var config=require(_0x7b40('0x7'));var controller=require(_0x7b40('0x8'));router[_0x7b40('0x9')]('/',auth[_0x7b40('0xa')](),controller[_0x7b40('0xb')]);router[_0x7b40('0x9')](_0x7b40('0xc'),auth[_0x7b40('0xa')](),controller['describe']);router[_0x7b40('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x7b40('0xd')]);router[_0x7b40('0x9')]('/:id/dispositions',auth[_0x7b40('0xa')](),controller['getDispositions']);router[_0x7b40('0x9')](_0x7b40('0xe'),auth[_0x7b40('0xa')](),controller['getAnswers']);router[_0x7b40('0x9')](_0x7b40('0xf'),auth['isAuthenticated'](),controller[_0x7b40('0x10')]);router[_0x7b40('0x9')]('/:id/out_servers',auth[_0x7b40('0xa')](),controller[_0x7b40('0x11')]);router[_0x7b40('0x9')]('/:id/interactions',auth[_0x7b40('0xa')](),controller[_0x7b40('0x12')]);router['get'](_0x7b40('0x13'),auth[_0x7b40('0xa')](),controller[_0x7b40('0x14')]);router[_0x7b40('0x9')](_0x7b40('0x15'),auth[_0x7b40('0xa')](),controller[_0x7b40('0x16')]);router[_0x7b40('0x9')]('/:id/verify',auth[_0x7b40('0xa')](),controller[_0x7b40('0x17')]);router['get'](_0x7b40('0x18'),auth['isAuthenticated'](),controller[_0x7b40('0x19')]);router['post'](_0x7b40('0x1a'),auth[_0x7b40('0xa')](),controller[_0x7b40('0x1b')]);router[_0x7b40('0x1c')](_0x7b40('0xe'),auth[_0x7b40('0xa')](),controller[_0x7b40('0x1d')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7b40('0x1e')]);router['post'](_0x7b40('0xf'),auth['isAuthenticated'](),controller[_0x7b40('0x1f')]);router[_0x7b40('0x1c')](_0x7b40('0x20'),auth[_0x7b40('0xa')](),controller['addSmtp']);router[_0x7b40('0x1c')]('/:id/interactions',auth[_0x7b40('0xa')](),controller[_0x7b40('0x21')]);router['post'](_0x7b40('0x13'),auth[_0x7b40('0xa')](),controller[_0x7b40('0x22')]);router[_0x7b40('0x1c')](_0x7b40('0x23'),auth[_0x7b40('0xa')](),controller[_0x7b40('0x24')]);router[_0x7b40('0x1c')](_0x7b40('0x18'),auth[_0x7b40('0xa')](),controller[_0x7b40('0x25')]);router['put'](_0x7b40('0x26'),auth[_0x7b40('0xa')](),controller['update']);router[_0x7b40('0x27')](_0x7b40('0x1a'),auth[_0x7b40('0xa')](),controller[_0x7b40('0x28')]);router[_0x7b40('0x27')](_0x7b40('0xe'),auth['isAuthenticated'](),controller[_0x7b40('0x29')]);router['delete'](_0x7b40('0xf'),auth[_0x7b40('0xa')](),controller[_0x7b40('0x2a')]);router['delete'](_0x7b40('0x20'),auth[_0x7b40('0xa')](),controller[_0x7b40('0x2b')]);router[_0x7b40('0x27')](_0x7b40('0x26'),auth['isAuthenticated'](),controller['destroy']);router[_0x7b40('0x27')](_0x7b40('0x18'),auth[_0x7b40('0xa')](),controller[_0x7b40('0x2c')]);module[_0x7b40('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index b7b1fef..2e74d1b 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 _0x5796=['mandatoryDisposition','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x20f9bc,_0x1057f0){var _0x2060a4=function(_0x3e3e89){while(--_0x3e3e89){_0x20f9bc['push'](_0x20f9bc['shift']());}};_0x2060a4(++_0x1057f0);}(_0x5796,0xd9));var _0x6579=function(_0x292421,_0x49efa2){_0x292421=_0x292421-0x0;var _0x2b0fc1=_0x5796[_0x292421];return _0x2b0fc1;};'use strict';var Sequelize=require('sequelize');module[_0x6579('0x0')]={'description':{'type':Sequelize[_0x6579('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x6579('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x6579('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x6579('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x6579('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x6579('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x6579('0x1')],'allowNull':![],'defaultValue':_0x6579('0x4')},'fontSize':{'type':Sequelize[_0x6579('0x5')](0x2)[_0x6579('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x6579('0x3')],'defaultValue':function(){return _0x6579('0x7');}},'notificationSound':{'type':Sequelize[_0x6579('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6579('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6579('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6579('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6579('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x6579('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x6579('0x2')],'defaultValue':![],'comment':_0x6579('0x9'),'set':function(_0x529fc8){if(!_0x529fc8)this[_0x6579('0xa')]('mandatoryDispositionPauseId',null);this[_0x6579('0xa')](_0x6579('0xb'),_0x529fc8);}}}; \ No newline at end of file +var _0x08d8=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}'];(function(_0x567d21,_0x3e8d95){var _0x4a443a=function(_0x1c87c0){while(--_0x1c87c0){_0x567d21['push'](_0x567d21['shift']());}};_0x4a443a(++_0x3e8d95);}(_0x08d8,0xa0));var _0x808d=function(_0x34919b,_0x1e409a){_0x34919b=_0x34919b-0x0;var _0x505b56=_0x08d8[_0x34919b];return _0x505b56;};'use strict';var Sequelize=require(_0x808d('0x0'));module['exports']={'description':{'type':Sequelize[_0x808d('0x1')]},'name':{'type':Sequelize[_0x808d('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x808d('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x808d('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x808d('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x808d('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x808d('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x808d('0x3')},'fontSize':{'type':Sequelize[_0x808d('0x4')](0x2)[_0x808d('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x808d('0x6')],'defaultValue':function(){return _0x808d('0x7');}},'notificationSound':{'type':Sequelize[_0x808d('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x808d('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x808d('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x808d('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x808d('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x808d('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x808d('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x808d('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x808d('0x9'),'set':function(_0x53f6df){if(!_0x53f6df)this[_0x808d('0xa')](_0x808d('0xb'),null);this[_0x808d('0xa')]('mandatoryDisposition',_0x53f6df);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 301a846..c5def87 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 _0xb300=['password','pass','cpassword','authentication','host','port','service','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','MailInteraction','CmContact','User','Owner','fullname','Tag','Tags','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','getApplications','getMessages','MailMessage','$gte','split','format','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages','verifySmtp','secure','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','test','ValidationError','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','stack','name','MailServerIn','Imap','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','MailAccount','includeAll','include','findAll','rows','show','params','options','body','find','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','order','pick','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','email','ListId','active','description','isNil','cservice','cauthentication','user','cuser'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb300,0x1d7));var _0x0b30=function(_0x219e63,_0x48cc87){_0x219e63=_0x219e63-0x0;var _0x255887=_0xb300[_0x219e63];return _0x255887;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0b30('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0b30('0x1'));var jsonpatch=require(_0x0b30('0x2'));var rp=require(_0x0b30('0x3'));var moment=require(_0x0b30('0x4'));var BPromise=require(_0x0b30('0x5'));var Mustache=require('mustache');var util=require(_0x0b30('0x6'));var path=require(_0x0b30('0x7'));var sox=require(_0x0b30('0x8'));var csv=require(_0x0b30('0x9'));var ejs=require(_0x0b30('0xa'));var fs=require('fs');var _=require(_0x0b30('0xb'));var squel=require(_0x0b30('0xc'));var crypto=require(_0x0b30('0xd'));var jsforce=require(_0x0b30('0xe'));var deskjs=require(_0x0b30('0xf'));var toCsv=require(_0x0b30('0x9'));var querystring=require(_0x0b30('0x10'));var Papa=require(_0x0b30('0x11'));var Redis=require(_0x0b30('0x12'));var authService=require(_0x0b30('0x13'));var qs=require(_0x0b30('0x14'));var as=require(_0x0b30('0x15'));var hardwareService=require(_0x0b30('0x16'));var logger=require(_0x0b30('0x17'))(_0x0b30('0x18'));var utils=require('../../config/utils');var config=require(_0x0b30('0x19'));var db=require(_0x0b30('0x1a'))['db'];config[_0x0b30('0x1b')]=_[_0x0b30('0x1c')](config[_0x0b30('0x1b')],{'host':_0x0b30('0x1d'),'port':0x18eb});var socket=require(_0x0b30('0x1e'))(new Redis(config[_0x0b30('0x1b')]));require(_0x0b30('0x1f'))[_0x0b30('0x20')](socket);var jayson=require(_0x0b30('0x21'));var client=jayson[_0x0b30('0x22')][_0x0b30('0x23')]({'port':0x232b});function checkPasswordPattern(_0x46a007,_0x48055f,_0x40fece){if(_0x40fece){var _0x5e1350=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5e1350[_0x0b30('0x24')](_0x48055f)){return _0x46a007;}else{throw new db['Sequelize'][(_0x0b30('0x25'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x46a007;}}function respondWithRpcPromise(_0x29bb3d,_0x45d547,_0xd00afa,_0x1f06df){return new BPromise(function(_0x3a784f,_0x43d3fb){var _0x2474f4=_0x1f06df||client;return _0x2474f4[_0x0b30('0x26')](_0x29bb3d,_0xd00afa)['then'](function(_0x1eab51){logger[_0x0b30('0x27')](_0x0b30('0x28'),_0x45d547,_0x0b30('0x29'));logger[_0x0b30('0x2a')](_0x0b30('0x2b'),_0x45d547,_0x0b30('0x29'),JSON['stringify'](_0x1eab51));if(_0x1eab51[_0x0b30('0x2c')]){if(_0x1eab51[_0x0b30('0x2c')][_0x0b30('0x2d')]===0x1f4){logger[_0x0b30('0x2c')](_0x0b30('0x28'),_0x45d547,_0x1eab51[_0x0b30('0x2c')][_0x0b30('0x2e')]);return _0x43d3fb(_0x1eab51['error'][_0x0b30('0x2e')]);}logger[_0x0b30('0x2c')](_0x0b30('0x28'),_0x45d547,_0x1eab51['error']['message']);return _0x3a784f(_0x1eab51['error']['message']);}else{logger[_0x0b30('0x27')]('MailAccount,\x20%s,\x20%s',_0x45d547,_0x0b30('0x29'));_0x3a784f(_0x1eab51[_0x0b30('0x2f')][_0x0b30('0x2e')]);}})[_0x0b30('0x30')](function(_0x22f30c){logger[_0x0b30('0x2c')]('MailAccount,\x20%s,\x20%s',_0x45d547,_0x22f30c);_0x43d3fb(_0x22f30c);});});}function respondWithStatusCode(_0x5ade19,_0x3e86a2){_0x3e86a2=_0x3e86a2||0xcc;return function(_0x4a1c41){if(_0x4a1c41){return _0x5ade19[_0x0b30('0x31')](_0x3e86a2);}return _0x5ade19[_0x0b30('0x32')](_0x3e86a2)[_0x0b30('0x33')]();};}function respondWithResult(_0x3d2d7d,_0x6b5f1){_0x6b5f1=_0x6b5f1||0xc8;return function(_0x52d6b7){if(_0x52d6b7){return _0x3d2d7d[_0x0b30('0x32')](_0x6b5f1)[_0x0b30('0x34')](_0x52d6b7);}};}function respondWithFilteredResult(_0x1db4b5,_0x3f9f09){return function(_0x428c54){if(_0x428c54){var _0x209deb=_0x428c54[_0x0b30('0x35')],_0x1479f0=_0x3f9f09[_0x0b30('0x36')],_0x119d7e=_0x3f9f09[_0x0b30('0x36')]+_0x3f9f09[_0x0b30('0x37')],_0x4254b1;if(_0x119d7e>=_0x209deb){_0x119d7e=_0x209deb;_0x4254b1=0xc8;}else{_0x4254b1=0xce;}_0x1db4b5['status'](_0x4254b1);return _0x1db4b5['set'](_0x0b30('0x38'),_0x1479f0+'-'+_0x119d7e+'/'+_0x209deb)[_0x0b30('0x34')](_0x428c54);}return null;};}function patchUpdates(_0x7311d8){return function(_0x56c3e5){try{jsonpatch[_0x0b30('0x39')](_0x56c3e5,_0x7311d8,!![]);}catch(_0x429231){return BPromise[_0x0b30('0x3a')](_0x429231);}return _0x56c3e5[_0x0b30('0x3b')]();};}function saveUpdates(_0x16e7c5,_0x595661){return function(_0x1a23c7){if(_0x1a23c7){return _0x1a23c7[_0x0b30('0x3c')](_0x16e7c5)[_0x0b30('0x3d')](function(_0xef87f8){return _0xef87f8;});}return null;};}function removeEntity(_0x264f85,_0x137415){return function(_0x21721d){if(_0x21721d){return _0x21721d[_0x0b30('0x3e')]()[_0x0b30('0x3d')](function(){var _0x31cd5e=_0x21721d['get']({'plain':!![]});var _0xa6d1e4='MailAccounts';return db[_0x0b30('0x3f')][_0x0b30('0x3e')]({'where':{'type':_0xa6d1e4,'resourceId':_0x31cd5e['id']}})['then'](function(){return _0x21721d;});})[_0x0b30('0x3d')](function(){_0x264f85[_0x0b30('0x32')](0xcc)[_0x0b30('0x33')]();});}};}function handleEntityNotFound(_0x1fd6f8,_0x3d79ab){return function(_0x2cd345){if(!_0x2cd345){_0x1fd6f8[_0x0b30('0x31')](0x194);}return _0x2cd345;};}function handleError(_0x368443,_0x3efbb7){_0x3efbb7=_0x3efbb7||0x1f4;return function(_0x1087b2){logger[_0x0b30('0x2c')](_0x1087b2[_0x0b30('0x40')]);if(_0x1087b2[_0x0b30('0x41')]){delete _0x1087b2['name'];}_0x368443[_0x0b30('0x32')](_0x3efbb7)['send'](_0x1087b2);};}exports['index']=function(_0x174909,_0x386e6a){var _0x214731={'include':[{'model':db[_0x0b30('0x42')],'as':_0x0b30('0x43')},{'model':db[_0x0b30('0x44')],'as':_0x0b30('0x45')},{'model':db[_0x0b30('0x46')],'as':_0x0b30('0x47')}]},_0x29a128={},_0x4b754f={'count':0x0,'rows':[]};var _0x40606d=_[_0x0b30('0x48')](db['MailAccount'][_0x0b30('0x49')],function(_0x37028f){return{'name':_0x37028f[_0x0b30('0x4a')],'type':_0x37028f[_0x0b30('0x4b')][_0x0b30('0x4c')]};});_0x29a128[_0x0b30('0x4d')]=_[_0x0b30('0x48')](_0x40606d,_0x0b30('0x41'));_0x29a128[_0x0b30('0x4e')]=_[_0x0b30('0x4f')](_0x174909[_0x0b30('0x4e')]);_0x29a128[_0x0b30('0x50')]=_[_0x0b30('0x51')](_0x29a128[_0x0b30('0x4d')],_0x29a128['query']);_0x214731[_0x0b30('0x52')]=_[_0x0b30('0x51')](_0x29a128[_0x0b30('0x4d')],qs[_0x0b30('0x53')](_0x174909[_0x0b30('0x4e')][_0x0b30('0x53')]));_0x214731[_0x0b30('0x52')]=_0x214731['attributes'][_0x0b30('0x54')]?_0x214731[_0x0b30('0x52')]:_0x29a128['model'];if(!_0x174909['query'][_0x0b30('0x55')](_0x0b30('0x56'))){_0x214731[_0x0b30('0x37')]=qs[_0x0b30('0x37')](_0x174909[_0x0b30('0x4e')][_0x0b30('0x37')]);_0x214731[_0x0b30('0x36')]=qs[_0x0b30('0x36')](_0x174909[_0x0b30('0x4e')]['offset']);}_0x214731['order']=qs[_0x0b30('0x57')](_0x174909[_0x0b30('0x4e')][_0x0b30('0x57')]);_0x214731[_0x0b30('0x58')]=qs[_0x0b30('0x50')](_['pick'](_0x174909[_0x0b30('0x4e')],_0x29a128[_0x0b30('0x50')]),_0x40606d);if(_0x174909[_0x0b30('0x4e')][_0x0b30('0x59')]){_0x214731[_0x0b30('0x58')]=_[_0x0b30('0x5a')](_0x214731[_0x0b30('0x58')],{'$or':_['map'](_0x40606d,function(_0x1f9ad4){if(_0x1f9ad4[_0x0b30('0x4b')]!==_0x0b30('0x5b')){var _0xf2306e={};_0xf2306e[_0x1f9ad4['name']]={'$like':'%'+_0x174909[_0x0b30('0x4e')][_0x0b30('0x59')]+'%'};return _0xf2306e;}})});}_0x214731=_['merge']({},_0x214731,_0x174909['options']);var _0x3c4aea={'where':_0x214731[_0x0b30('0x58')]};return db[_0x0b30('0x5c')][_0x0b30('0x35')](_0x3c4aea)['then'](function(_0x5aa4f3){_0x4b754f[_0x0b30('0x35')]=_0x5aa4f3;if(_0x174909[_0x0b30('0x4e')][_0x0b30('0x5d')]){_0x214731[_0x0b30('0x5e')]=[{'all':!![]}];}return db[_0x0b30('0x5c')][_0x0b30('0x5f')](_0x214731);})[_0x0b30('0x3d')](function(_0x1601e2){_0x4b754f[_0x0b30('0x60')]=_0x1601e2;return _0x4b754f;})[_0x0b30('0x3d')](respondWithFilteredResult(_0x386e6a,_0x214731))['catch'](handleError(_0x386e6a,null));};exports[_0x0b30('0x61')]=function(_0x5e6d4d,_0x28e280){var _0x65aa45={'raw':![],'where':{'id':_0x5e6d4d[_0x0b30('0x62')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x0b30('0x43')},{'model':db[_0x0b30('0x44')],'as':_0x0b30('0x45')},{'model':db[_0x0b30('0x46')],'as':_0x0b30('0x47')}]},_0x19482d={};_0x19482d['model']=_[_0x0b30('0x4f')](db['MailAccount'][_0x0b30('0x49')]);_0x19482d[_0x0b30('0x4e')]=_[_0x0b30('0x4f')](_0x5e6d4d[_0x0b30('0x4e')]);_0x19482d[_0x0b30('0x50')]=_[_0x0b30('0x51')](_0x19482d['model'],_0x19482d['query']);_0x65aa45[_0x0b30('0x52')]=_[_0x0b30('0x51')](_0x19482d['model'],qs[_0x0b30('0x53')](_0x5e6d4d[_0x0b30('0x4e')][_0x0b30('0x53')]));_0x65aa45[_0x0b30('0x52')]=_0x65aa45['attributes'][_0x0b30('0x54')]?_0x65aa45[_0x0b30('0x52')]:_0x19482d[_0x0b30('0x4d')];if(_0x5e6d4d[_0x0b30('0x4e')][_0x0b30('0x5d')]){_0x65aa45['include']=[{'all':!![]}];}_0x65aa45=_[_0x0b30('0x5a')]({},_0x65aa45,_0x5e6d4d[_0x0b30('0x63')]);return db[_0x0b30('0x5c')]['find'](_0x65aa45)[_0x0b30('0x3d')](handleEntityNotFound(_0x28e280,null))['then'](respondWithResult(_0x28e280,null))['catch'](handleError(_0x28e280,null));};exports[_0x0b30('0x3c')]=function(_0x58f461,_0x5b11a9){if(_0x58f461[_0x0b30('0x64')]['id']){delete _0x58f461[_0x0b30('0x64')]['id'];}return db['MailAccount'][_0x0b30('0x65')]({'where':{'id':_0x58f461[_0x0b30('0x62')]['id']},'include':[{'model':db[_0x0b30('0x42')],'as':_0x0b30('0x43')},{'model':db[_0x0b30('0x44')],'as':'Smtp'},{'model':db[_0x0b30('0x46')],'as':_0x0b30('0x47')}]})[_0x0b30('0x3d')](handleEntityNotFound(_0x5b11a9,null))[_0x0b30('0x3d')](saveUpdates(_0x58f461['body'],null))['then'](function(_0x96adc0){if(_0x96adc0&&_0x58f461[_0x0b30('0x64')][_0x0b30('0x43')]){return db['MailServerIn'][_0x0b30('0x3c')](_0x58f461['body']['Imap'],{'where':{'MailAccountId':_0x96adc0['id']}})['then'](function(){return _0x96adc0;});}return _0x96adc0;})['then'](function(_0x4e4222){if(_0x4e4222&&_0x58f461[_0x0b30('0x64')]['Smtp']){return db[_0x0b30('0x44')]['update'](_0x58f461[_0x0b30('0x64')][_0x0b30('0x45')],{'where':{'MailAccountId':_0x4e4222['id']}})[_0x0b30('0x3d')](function(){return _0x4e4222;});}return _0x4e4222;})[_0x0b30('0x3d')](respondWithResult(_0x5b11a9,null))['catch'](handleError(_0x5b11a9,null));};exports['describe']=function(_0x2edd4e,_0x3e1f58){return db['MailAccount'][_0x0b30('0x66')]()[_0x0b30('0x3d')](respondWithResult(_0x3e1f58,null))[_0x0b30('0x30')](handleError(_0x3e1f58,null));};exports[_0x0b30('0x67')]=function(_0x13a3ff,_0x1ef398,_0x1c8ba4){if(_0x13a3ff[_0x0b30('0x64')]['id']){delete _0x13a3ff[_0x0b30('0x64')]['id'];}return db['MailAccount'][_0x0b30('0x65')]({'where':{'id':_0x13a3ff[_0x0b30('0x62')]['id']}})['then'](handleEntityNotFound(_0x1ef398,null))['then'](function(_0x13beec){if(_0x13beec){_0x13a3ff[_0x0b30('0x64')][_0x0b30('0x68')]=_0x13beec['id'];return db[_0x0b30('0x69')][_0x0b30('0x6a')](_0x13a3ff['body']);}})['then'](respondWithResult(_0x1ef398,null))[_0x0b30('0x30')](handleError(_0x1ef398,null));};exports[_0x0b30('0x6b')]=function(_0x1c22e3,_0x208b6c,_0x4631f3){var _0x413304={'raw':![],'where':{}};var _0x20b8cd={};var _0x791ca1={'count':0x0,'rows':[]};return db[_0x0b30('0x5c')][_0x0b30('0x6c')]({'where':{'id':_0x1c22e3['params']['id']}})[_0x0b30('0x3d')](handleEntityNotFound(_0x208b6c,null))[_0x0b30('0x3d')](function(_0x1d0f31){if(_0x1d0f31){_0x20b8cd['model']=_[_0x0b30('0x4f')](db['Disposition']['rawAttributes']);_0x20b8cd[_0x0b30('0x4e')]=_['keys'](_0x1c22e3[_0x0b30('0x4e')]);_0x20b8cd[_0x0b30('0x50')]=_['intersection'](_0x20b8cd[_0x0b30('0x4d')],_0x20b8cd['query']);_0x413304[_0x0b30('0x52')]=_[_0x0b30('0x51')](_0x20b8cd[_0x0b30('0x4d')],qs[_0x0b30('0x53')](_0x1c22e3['query']['fields']));_0x413304[_0x0b30('0x52')]=_0x413304[_0x0b30('0x52')][_0x0b30('0x54')]?_0x413304[_0x0b30('0x52')]:_0x20b8cd[_0x0b30('0x4d')];if(!_0x1c22e3[_0x0b30('0x4e')][_0x0b30('0x55')](_0x0b30('0x56'))){_0x413304[_0x0b30('0x37')]=qs[_0x0b30('0x37')](_0x1c22e3['query'][_0x0b30('0x37')]);_0x413304[_0x0b30('0x36')]=qs[_0x0b30('0x36')](_0x1c22e3['query'][_0x0b30('0x36')]);}_0x413304[_0x0b30('0x6d')]=qs['sort'](_0x1c22e3[_0x0b30('0x4e')]['sort']);_0x413304[_0x0b30('0x58')]=qs[_0x0b30('0x50')](_[_0x0b30('0x6e')](_0x1c22e3[_0x0b30('0x4e')],_0x20b8cd['filters']));_0x413304[_0x0b30('0x58')][_0x0b30('0x68')]=_0x1d0f31['id'];if(_0x1c22e3[_0x0b30('0x4e')]['filter']){_0x413304['where']=_[_0x0b30('0x5a')](_0x413304[_0x0b30('0x58')],{'$or':_[_0x0b30('0x48')](_0x413304['attributes'],function(_0x5383b0){var _0x183894={};_0x183894[_0x5383b0]={'$like':'%'+_0x1c22e3[_0x0b30('0x4e')][_0x0b30('0x59')]+'%'};return _0x183894;})});}_0x413304=_[_0x0b30('0x5a')]({},_0x413304,_0x1c22e3[_0x0b30('0x63')]);return db['Disposition'][_0x0b30('0x35')]({'where':_0x413304[_0x0b30('0x58')]})[_0x0b30('0x3d')](function(_0x508030){_0x791ca1[_0x0b30('0x35')]=_0x508030;if(_0x1c22e3[_0x0b30('0x4e')][_0x0b30('0x5d')]){_0x413304['include']=[{'all':!![]}];}return db[_0x0b30('0x69')][_0x0b30('0x5f')](_0x413304);})[_0x0b30('0x3d')](function(_0x229763){_0x791ca1[_0x0b30('0x60')]=_0x229763;return _0x791ca1;});}})[_0x0b30('0x3d')](respondWithFilteredResult(_0x208b6c,_0x413304))['catch'](handleError(_0x208b6c,null));};exports[_0x0b30('0x6f')]=function(_0x3d3f2b,_0x5d5aa3,_0x62b02d){return db[_0x0b30('0x5c')][_0x0b30('0x65')]({'where':{'id':_0x3d3f2b[_0x0b30('0x62')]['id']}})['then'](handleEntityNotFound(_0x5d5aa3,null))[_0x0b30('0x3d')](function(_0x371d35){if(_0x371d35){return _0x371d35[_0x0b30('0x6f')](_0x3d3f2b['query'][_0x0b30('0x70')]);}})[_0x0b30('0x3d')](respondWithStatusCode(_0x5d5aa3,null))[_0x0b30('0x30')](handleError(_0x5d5aa3,null));};exports[_0x0b30('0x71')]=function(_0x12f37e,_0x55ca47,_0x30b8d2){if(_0x12f37e[_0x0b30('0x64')]['id']){delete _0x12f37e[_0x0b30('0x64')]['id'];}return db[_0x0b30('0x5c')][_0x0b30('0x65')]({'where':{'id':_0x12f37e[_0x0b30('0x62')]['id']}})['then'](handleEntityNotFound(_0x55ca47,null))[_0x0b30('0x3d')](function(_0x4613a2){if(_0x4613a2){_0x12f37e[_0x0b30('0x64')][_0x0b30('0x68')]=_0x4613a2['id'];return db['CannedAnswer']['create'](_0x12f37e[_0x0b30('0x64')]);}})['then'](respondWithResult(_0x55ca47,null))['catch'](handleError(_0x55ca47,null));};exports[_0x0b30('0x72')]=function(_0x1ce0f6,_0x5c5516,_0x33c746){var _0x32f1e8={'raw':![],'where':{}};var _0x317430={};var _0x359708={'count':0x0,'rows':[]};return db[_0x0b30('0x5c')][_0x0b30('0x6c')]({'where':{'id':_0x1ce0f6[_0x0b30('0x62')]['id']}})[_0x0b30('0x3d')](handleEntityNotFound(_0x5c5516,null))[_0x0b30('0x3d')](function(_0x1ec606){if(_0x1ec606){_0x317430[_0x0b30('0x4d')]=_[_0x0b30('0x4f')](db[_0x0b30('0x73')][_0x0b30('0x49')]);_0x317430[_0x0b30('0x4e')]=_[_0x0b30('0x4f')](_0x1ce0f6[_0x0b30('0x4e')]);_0x317430[_0x0b30('0x50')]=_[_0x0b30('0x51')](_0x317430[_0x0b30('0x4d')],_0x317430[_0x0b30('0x4e')]);_0x32f1e8[_0x0b30('0x52')]=_[_0x0b30('0x51')](_0x317430[_0x0b30('0x4d')],qs['fields'](_0x1ce0f6[_0x0b30('0x4e')][_0x0b30('0x53')]));_0x32f1e8[_0x0b30('0x52')]=_0x32f1e8[_0x0b30('0x52')][_0x0b30('0x54')]?_0x32f1e8['attributes']:_0x317430[_0x0b30('0x4d')];if(!_0x1ce0f6[_0x0b30('0x4e')][_0x0b30('0x55')](_0x0b30('0x56'))){_0x32f1e8['limit']=qs[_0x0b30('0x37')](_0x1ce0f6[_0x0b30('0x4e')][_0x0b30('0x37')]);_0x32f1e8[_0x0b30('0x36')]=qs[_0x0b30('0x36')](_0x1ce0f6[_0x0b30('0x4e')]['offset']);}_0x32f1e8['order']=qs['sort'](_0x1ce0f6[_0x0b30('0x4e')]['sort']);_0x32f1e8[_0x0b30('0x58')]=qs[_0x0b30('0x50')](_[_0x0b30('0x6e')](_0x1ce0f6['query'],_0x317430['filters']));_0x32f1e8[_0x0b30('0x58')][_0x0b30('0x68')]=_0x1ec606['id'];if(_0x1ce0f6[_0x0b30('0x4e')][_0x0b30('0x59')]){_0x32f1e8[_0x0b30('0x58')]=_[_0x0b30('0x5a')](_0x32f1e8[_0x0b30('0x58')],{'$or':_[_0x0b30('0x48')](_0x32f1e8[_0x0b30('0x52')],function(_0x22f9d8){var _0x5682af={};_0x5682af[_0x22f9d8]={'$like':'%'+_0x1ce0f6[_0x0b30('0x4e')][_0x0b30('0x59')]+'%'};return _0x5682af;})});}_0x32f1e8=_[_0x0b30('0x5a')]({},_0x32f1e8,_0x1ce0f6['options']);return db['CannedAnswer'][_0x0b30('0x35')]({'where':_0x32f1e8[_0x0b30('0x58')]})[_0x0b30('0x3d')](function(_0x499d87){_0x359708[_0x0b30('0x35')]=_0x499d87;if(_0x1ce0f6[_0x0b30('0x4e')]['includeAll']){_0x32f1e8[_0x0b30('0x5e')]=[{'all':!![]}];}return db[_0x0b30('0x73')][_0x0b30('0x5f')](_0x32f1e8);})['then'](function(_0x2cf61b){_0x359708['rows']=_0x2cf61b;return _0x359708;});}})[_0x0b30('0x3d')](respondWithFilteredResult(_0x5c5516,_0x32f1e8))[_0x0b30('0x30')](handleError(_0x5c5516,null));};exports[_0x0b30('0x74')]=function(_0xaee30d,_0x132ba7,_0x1c5112){return db[_0x0b30('0x5c')][_0x0b30('0x65')]({'where':{'id':_0xaee30d[_0x0b30('0x62')]['id']}})['then'](handleEntityNotFound(_0x132ba7,null))[_0x0b30('0x3d')](function(_0x3458a6){if(_0x3458a6){return _0x3458a6[_0x0b30('0x74')](_0xaee30d[_0x0b30('0x4e')][_0x0b30('0x70')]);}})[_0x0b30('0x3d')](respondWithStatusCode(_0x132ba7,null))['catch'](handleError(_0x132ba7,null));};exports[_0x0b30('0x6a')]=function(_0xa42f74,_0x64f909){var _0x33b872={'name':_0xa42f74['body']['name'],'key':_0xa42f74[_0x0b30('0x64')][_0x0b30('0x4c')],'email':_0xa42f74[_0x0b30('0x64')][_0x0b30('0x75')],'ListId':_0xa42f74[_0x0b30('0x64')][_0x0b30('0x76')],'active':!_['isNil'](_0xa42f74['body'][_0x0b30('0x77')])?_0xa42f74['body'][_0x0b30('0x77')]:!![],'description':_0xa42f74['body'][_0x0b30('0x78')]||null,'Imap':{},'Smtp':{}};if(_[_0x0b30('0x79')](_0xa42f74['body'][_0x0b30('0x7a')])){if(_0xa42f74[_0x0b30('0x64')][_0x0b30('0x7b')]){_0x33b872[_0x0b30('0x43')][_0x0b30('0x7c')]=_0x33b872[_0x0b30('0x45')][_0x0b30('0x7c')]=_0xa42f74[_0x0b30('0x64')][_0x0b30('0x7d')];_0x33b872[_0x0b30('0x43')][_0x0b30('0x7e')]=_0x33b872[_0x0b30('0x45')][_0x0b30('0x7f')]=_0xa42f74[_0x0b30('0x64')][_0x0b30('0x80')];}else{_0x33b872[_0x0b30('0x43')][_0x0b30('0x81')]=_0x33b872[_0x0b30('0x45')][_0x0b30('0x81')]=![];}_0x33b872[_0x0b30('0x43')][_0x0b30('0x82')]=_0xa42f74[_0x0b30('0x64')]['Imap'][_0x0b30('0x82')];_0x33b872[_0x0b30('0x43')][_0x0b30('0x83')]=_0xa42f74[_0x0b30('0x64')]['Imap'][_0x0b30('0x83')];_0x33b872[_0x0b30('0x45')][_0x0b30('0x82')]=_0xa42f74[_0x0b30('0x64')][_0x0b30('0x45')]['host'];_0x33b872['Smtp']['port']=_0xa42f74['body']['Smtp'][_0x0b30('0x83')];}else{_0x33b872[_0x0b30('0x43')][_0x0b30('0x84')]=_0x33b872[_0x0b30('0x45')]['service']=_0xa42f74[_0x0b30('0x64')][_0x0b30('0x7a')];_0x33b872[_0x0b30('0x43')][_0x0b30('0x7c')]=_0x33b872[_0x0b30('0x45')][_0x0b30('0x7c')]=_0xa42f74[_0x0b30('0x64')]['cuser'];_0x33b872[_0x0b30('0x43')]['password']=_0x33b872['Smtp'][_0x0b30('0x7f')]=_0xa42f74[_0x0b30('0x64')][_0x0b30('0x80')];}return db[_0x0b30('0x5c')][_0x0b30('0x6a')](_0x33b872,{'include':[{'model':db[_0x0b30('0x44')],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0x0b30('0x43')}]})[_0x0b30('0x3d')](function(_0xd651c3){var _0xa0e624=_0xa42f74[_0x0b30('0x7c')][_0x0b30('0x85')]({'plain':!![]});if(!_0xa0e624)throw new Error(_0x0b30('0x86'));if(_0xa0e624[_0x0b30('0x87')]===_0x0b30('0x7c')){var _0x5d9c0a=_0xd651c3[_0x0b30('0x85')]({'plain':!![]});return db['UserProfileSection'][_0x0b30('0x65')]({'where':{'name':'MailAccounts','userProfileId':_0xa0e624['userProfileId']},'raw':!![]})[_0x0b30('0x3d')](function(_0x23ecbe){if(_0x23ecbe&&_0x23ecbe['autoAssociation']===0x0){return db[_0x0b30('0x3f')][_0x0b30('0x6a')]({'name':_0x5d9c0a[_0x0b30('0x41')],'resourceId':_0x5d9c0a['id'],'type':_0x23ecbe[_0x0b30('0x41')],'sectionId':_0x23ecbe['id']},{})[_0x0b30('0x3d')](function(){return _0xd651c3;});}else{return _0xd651c3;}})['catch'](function(_0x1f4db1){logger[_0x0b30('0x2c')](_0x0b30('0x88'),_0x1f4db1);throw _0x1f4db1;});}return _0xd651c3;})[_0x0b30('0x3d')](respondWithResult(_0x64f909,0xc9))[_0x0b30('0x30')](handleError(_0x64f909,null));};exports[_0x0b30('0x89')]=function(_0x70a839,_0x5966f9,_0x23be62){return db[_0x0b30('0x5c')][_0x0b30('0x6c')]({'where':{'id':_0x70a839[_0x0b30('0x62')]['id']}})[_0x0b30('0x3d')](handleEntityNotFound(_0x5966f9,null))[_0x0b30('0x3d')](function(_0x211660){if(_0x211660){return _0x211660[_0x0b30('0x89')]();}return null;})[_0x0b30('0x3d')](respondWithResult(_0x5966f9,null))[_0x0b30('0x30')](handleError(_0x5966f9,null));};exports[_0x0b30('0x8a')]=function(_0x60dd2e,_0x32f4a4,_0x3e21df){if(_0x60dd2e['body']['id']){delete _0x60dd2e[_0x0b30('0x64')]['id'];}return db['MailAccount'][_0x0b30('0x65')]({'where':{'id':_0x60dd2e['params']['id']}})['then'](handleEntityNotFound(_0x32f4a4,null))['then'](function(_0x3c952){if(_0x3c952){_0x60dd2e[_0x0b30('0x64')][_0x0b30('0x68')]=_0x3c952['id'];return db[_0x0b30('0x42')][_0x0b30('0x6a')](_0x60dd2e[_0x0b30('0x64')]);}})[_0x0b30('0x3d')](respondWithResult(_0x32f4a4,null))[_0x0b30('0x30')](handleError(_0x32f4a4,null));};exports['removeImap']=function(_0x5afdb3,_0x2580e3,_0x3daee1){return db[_0x0b30('0x5c')][_0x0b30('0x6c')]({'where':{'id':_0x5afdb3[_0x0b30('0x62')]['id']}})[_0x0b30('0x3d')](handleEntityNotFound(_0x2580e3,null))[_0x0b30('0x3d')](function(_0x2c6559){if(_0x2c6559){return _0x2c6559[_0x0b30('0x8b')](null);}return null;})[_0x0b30('0x3d')](respondWithStatusCode(_0x2580e3,null))[_0x0b30('0x30')](handleError(_0x2580e3,null));};exports[_0x0b30('0x8c')]=function(_0x3225b1,_0x306c6f,_0x4b3681){return db[_0x0b30('0x5c')][_0x0b30('0x6c')]({'where':{'id':_0x3225b1['params']['id']}})[_0x0b30('0x3d')](handleEntityNotFound(_0x306c6f,null))['then'](function(_0x5b71b6){if(_0x5b71b6){return _0x5b71b6[_0x0b30('0x8c')]();}return null;})[_0x0b30('0x3d')](respondWithResult(_0x306c6f,null))['catch'](handleError(_0x306c6f,null));};exports[_0x0b30('0x8d')]=function(_0x3b81d4,_0x1b93b4,_0x36bc34){if(_0x3b81d4[_0x0b30('0x64')]['id']){delete _0x3b81d4[_0x0b30('0x64')]['id'];}return db[_0x0b30('0x5c')][_0x0b30('0x65')]({'where':{'id':_0x3b81d4[_0x0b30('0x62')]['id']}})[_0x0b30('0x3d')](handleEntityNotFound(_0x1b93b4,null))[_0x0b30('0x3d')](function(_0xb93c9b){if(_0xb93c9b){_0x3b81d4['body'][_0x0b30('0x68')]=_0xb93c9b['id'];return db[_0x0b30('0x44')]['create'](_0x3b81d4[_0x0b30('0x64')]);}})['then'](respondWithResult(_0x1b93b4,null))[_0x0b30('0x30')](handleError(_0x1b93b4,null));};exports[_0x0b30('0x8e')]=function(_0x4a52fb,_0x45f134,_0x56b8c9){return db['MailAccount'][_0x0b30('0x6c')]({'where':{'id':_0x4a52fb[_0x0b30('0x62')]['id']}})['then'](handleEntityNotFound(_0x45f134,null))[_0x0b30('0x3d')](function(_0x4487d5){if(_0x4487d5){return _0x4487d5[_0x0b30('0x8f')](null);}return null;})['then'](respondWithStatusCode(_0x45f134,null))[_0x0b30('0x30')](handleError(_0x45f134,null));};exports[_0x0b30('0x90')]=function(_0x56e855,_0x484d1c,_0xde3419){return db['MailInteraction']['find']({'where':{'id':_0x56e855['params']['id']}})[_0x0b30('0x3d')](handleEntityNotFound(_0x484d1c,null))[_0x0b30('0x3d')](function(_0x29cca7){if(_0x29cca7){return _0x29cca7[_0x0b30('0x90')](_0x56e855[_0x0b30('0x64')]['ids'],_[_0x0b30('0x91')](_0x56e855[_0x0b30('0x64')],[_0x0b30('0x70'),'id'])||{});}})[_0x0b30('0x3d')](respondWithResult(_0x484d1c,null))[_0x0b30('0x30')](handleError(_0x484d1c,null));};exports['getInteractions']=function(_0x26efa5,_0x3584b4,_0x18a9a7){var _0x14be75={'raw':![],'where':{}};var _0x34a793={};var _0x5d4a75={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x26efa5[_0x0b30('0x62')]['id']}})['then'](handleEntityNotFound(_0x3584b4,null))[_0x0b30('0x3d')](function(_0x471569){if(_0x471569){_0x34a793[_0x0b30('0x4d')]=_[_0x0b30('0x4f')](db[_0x0b30('0x92')][_0x0b30('0x49')]);_0x34a793['query']=_['keys'](_0x26efa5[_0x0b30('0x4e')]);_0x34a793[_0x0b30('0x50')]=_[_0x0b30('0x51')](_0x34a793[_0x0b30('0x4d')],_0x34a793[_0x0b30('0x4e')]);_0x14be75[_0x0b30('0x52')]=_[_0x0b30('0x51')](_0x34a793[_0x0b30('0x4d')],qs[_0x0b30('0x53')](_0x26efa5[_0x0b30('0x4e')][_0x0b30('0x53')]));_0x14be75[_0x0b30('0x52')]=_0x14be75[_0x0b30('0x52')][_0x0b30('0x54')]?_0x14be75['attributes']:_0x34a793['model'];if(!_0x26efa5[_0x0b30('0x4e')]['hasOwnProperty'](_0x0b30('0x56'))){_0x14be75[_0x0b30('0x37')]=qs[_0x0b30('0x37')](_0x26efa5[_0x0b30('0x4e')][_0x0b30('0x37')]);_0x14be75['offset']=qs[_0x0b30('0x36')](_0x26efa5[_0x0b30('0x4e')][_0x0b30('0x36')]);}_0x14be75[_0x0b30('0x6d')]=qs[_0x0b30('0x57')](_0x26efa5[_0x0b30('0x4e')]['sort']);_0x14be75['where']=qs[_0x0b30('0x50')](_[_0x0b30('0x6e')](_0x26efa5[_0x0b30('0x4e')],_0x34a793[_0x0b30('0x50')]));_0x14be75[_0x0b30('0x58')][_0x0b30('0x68')]=_0x471569['id'];if(_0x26efa5[_0x0b30('0x4e')][_0x0b30('0x59')]){_0x14be75[_0x0b30('0x58')]=_[_0x0b30('0x5a')](_0x14be75[_0x0b30('0x58')],{'$or':_[_0x0b30('0x48')](_0x14be75[_0x0b30('0x52')],function(_0x354d09){var _0x84d774={};_0x84d774[_0x354d09]={'$like':'%'+_0x26efa5[_0x0b30('0x4e')][_0x0b30('0x59')]+'%'};return _0x84d774;})});}_0x14be75=_['merge']({},_0x14be75,_0x26efa5[_0x0b30('0x63')]);return db[_0x0b30('0x92')][_0x0b30('0x35')]({'where':_0x14be75['where']})[_0x0b30('0x3d')](function(_0x17cb65){_0x5d4a75[_0x0b30('0x35')]=_0x17cb65;if(_0x26efa5[_0x0b30('0x4e')]['includeAll']){_0x14be75['include']=[{'model':db[_0x0b30('0x93')],'as':'Contact','required':![]},{'model':db[_0x0b30('0x94')],'as':_0x0b30('0x95'),'attributes':['name',_0x0b30('0x96'),'internal'],'required':![]},{'model':db[_0x0b30('0x97')],'as':_0x0b30('0x98'),'attributes':['id','name','color'],'where':_0x26efa5[_0x0b30('0x4e')][_0x0b30('0x99')]?{'id':_0x26efa5[_0x0b30('0x4e')][_0x0b30('0x99')]}:undefined,'required':_0x26efa5[_0x0b30('0x4e')][_0x0b30('0x99')]?!![]:![]}];}return db['MailInteraction'][_0x0b30('0x5f')](_0x14be75);})[_0x0b30('0x3d')](function(_0x508c16){_0x5d4a75['rows']=_0x508c16;return _0x5d4a75;});}})[_0x0b30('0x3d')](respondWithFilteredResult(_0x3584b4,_0x14be75))[_0x0b30('0x30')](handleError(_0x3584b4,null));};exports[_0x0b30('0x9a')]=function(_0x4eca6a,_0x42d120,_0x2d1f5d){return db[_0x0b30('0x5c')][_0x0b30('0x6c')]({'where':{'id':_0x4eca6a[_0x0b30('0x62')]['id']}})[_0x0b30('0x3d')](handleEntityNotFound(_0x42d120,null))['then'](function(_0x494504){if(_0x494504){return db[_0x0b30('0x9b')][_0x0b30('0x9c')](function(_0x1cbb14){return db[_0x0b30('0x9d')][_0x0b30('0x3e')]({'where':{'MailAccountId':_0x4eca6a['params']['id']},'transaction':_0x1cbb14})[_0x0b30('0x3d')](function(_0x5ef55c){var _0x2ab5f2=_[_0x0b30('0x48')](_0x4eca6a[_0x0b30('0x64')],function(_0x487359){_0x487359[_0x0b30('0x68')]=_0x4eca6a[_0x0b30('0x62')]['id'];return _0x487359;});return db[_0x0b30('0x9d')][_0x0b30('0x9e')](_0x2ab5f2,{'transaction':_0x1cbb14});});})[_0x0b30('0x3d')](function(){return db[_0x0b30('0x9d')][_0x0b30('0x9f')]({'where':{'MailAccountId':_0x4eca6a[_0x0b30('0x62')]['id']},'order':'priority'});});}})[_0x0b30('0x3d')](respondWithResult(_0x42d120,null))[_0x0b30('0x30')](handleError(_0x42d120,null));};exports[_0x0b30('0xa0')]=function(_0xebfb,_0x367cad,_0x6f3b7b){var _0x1ca96d={};var _0x127922={};var _0x550ccc;var _0x2ef959;return db[_0x0b30('0x5c')][_0x0b30('0x6c')]({'where':{'id':_0xebfb[_0x0b30('0x62')]['id']}})['then'](handleEntityNotFound(_0x367cad,null))[_0x0b30('0x3d')](function(_0xe493e){if(_0xe493e){_0x550ccc=_0xe493e;_0x127922[_0x0b30('0x4d')]=_['keys'](db[_0x0b30('0x9d')][_0x0b30('0x49')]);_0x127922['query']=_[_0x0b30('0x4f')](_0xebfb['query']);_0x127922[_0x0b30('0x50')]=_[_0x0b30('0x51')](_0x127922[_0x0b30('0x4d')],_0x127922[_0x0b30('0x4e')]);_0x1ca96d['attributes']=_[_0x0b30('0x51')](_0x127922[_0x0b30('0x4d')],qs[_0x0b30('0x53')](_0xebfb[_0x0b30('0x4e')][_0x0b30('0x53')]));_0x1ca96d[_0x0b30('0x52')]=_0x1ca96d[_0x0b30('0x52')][_0x0b30('0x54')]?_0x1ca96d[_0x0b30('0x52')]:_0x127922[_0x0b30('0x4d')];_0x1ca96d[_0x0b30('0x6d')]=qs['sort'](_0xebfb[_0x0b30('0x4e')][_0x0b30('0x57')]);_0x1ca96d[_0x0b30('0x58')]=qs[_0x0b30('0x50')](_[_0x0b30('0x6e')](_0xebfb[_0x0b30('0x4e')],_0x127922[_0x0b30('0x50')]));if(_0xebfb[_0x0b30('0x4e')]['filter']){_0x1ca96d[_0x0b30('0x58')]=_[_0x0b30('0x5a')](_0x1ca96d[_0x0b30('0x58')],{'$or':_['map'](_0x1ca96d['attributes'],function(_0x36dd25){var _0x358a1c={};_0x358a1c[_0x36dd25]={'$like':'%'+_0xebfb[_0x0b30('0x4e')]['filter']+'%'};return _0x358a1c;})});}_0x1ca96d=_[_0x0b30('0x5a')]({},_0x1ca96d,_0xebfb[_0x0b30('0x63')]);return _0x550ccc[_0x0b30('0xa0')](_0x1ca96d);}})['then'](function(_0x44e16b){if(_0x44e16b){_0x2ef959=_0x44e16b[_0x0b30('0x54')];if(!_0xebfb[_0x0b30('0x4e')]['hasOwnProperty'](_0x0b30('0x56'))){_0x1ca96d[_0x0b30('0x37')]=qs[_0x0b30('0x37')](_0xebfb[_0x0b30('0x4e')][_0x0b30('0x37')]);_0x1ca96d['offset']=qs[_0x0b30('0x36')](_0xebfb[_0x0b30('0x4e')][_0x0b30('0x36')]);}return _0x550ccc[_0x0b30('0xa0')](_0x1ca96d);}})[_0x0b30('0x3d')](function(_0x25e6ce){if(_0x25e6ce){return _0x25e6ce?{'count':_0x2ef959,'rows':_0x25e6ce}:null;}})[_0x0b30('0x3d')](respondWithResult(_0x367cad,null))[_0x0b30('0x30')](handleError(_0x367cad,null));};exports[_0x0b30('0xa1')]=function(_0x4c82ee,_0x20d18c,_0x5b230b){var _0x1a970f={'raw':!![],'where':{}};var _0x24058a={};var _0x1cc176={'count':0x0,'rows':[]};return db['MailAccount'][_0x0b30('0x6c')]({'where':{'id':_0x4c82ee[_0x0b30('0x62')]['id']}})[_0x0b30('0x3d')](handleEntityNotFound(_0x20d18c,null))[_0x0b30('0x3d')](function(_0x380331){if(_0x380331){_0x24058a['model']=_[_0x0b30('0x4f')](db[_0x0b30('0xa2')][_0x0b30('0x49')]);_0x24058a['query']=_['keys'](_0x4c82ee[_0x0b30('0x4e')]);_0x24058a['filters']=_[_0x0b30('0x51')](_0x24058a[_0x0b30('0x4d')],_0x24058a[_0x0b30('0x4e')]);_0x1a970f[_0x0b30('0x52')]=_[_0x0b30('0x51')](_0x24058a[_0x0b30('0x4d')],qs[_0x0b30('0x53')](_0x4c82ee[_0x0b30('0x4e')][_0x0b30('0x53')]));_0x1a970f[_0x0b30('0x52')]=_0x1a970f[_0x0b30('0x52')]['length']?_0x1a970f[_0x0b30('0x52')]:_0x24058a[_0x0b30('0x4d')];if(!_0x4c82ee[_0x0b30('0x4e')][_0x0b30('0x55')](_0x0b30('0x56'))){_0x1a970f[_0x0b30('0x37')]=qs['limit'](_0x4c82ee['query']['limit']);_0x1a970f['offset']=qs[_0x0b30('0x36')](_0x4c82ee[_0x0b30('0x4e')]['offset']);}_0x1a970f[_0x0b30('0x6d')]=qs['sort'](_0x4c82ee['query'][_0x0b30('0x57')]);_0x1a970f[_0x0b30('0x58')]=qs[_0x0b30('0x50')](_['pick'](_0x4c82ee['query'],_0x24058a[_0x0b30('0x50')]));_0x1a970f[_0x0b30('0x58')]['MailAccountId']=_0x380331['id'];if(_0x4c82ee['query']['filter']){_0x1a970f['where']=_['merge'](_0x1a970f[_0x0b30('0x58')],{'$or':_[_0x0b30('0x48')](_0x1a970f[_0x0b30('0x52')],function(_0x26674a){var _0x3fa25d={};_0x3fa25d[_0x26674a]={'$like':'%'+_0x4c82ee[_0x0b30('0x4e')]['filter']+'%'};return _0x3fa25d;})});}if(_0x4c82ee[_0x0b30('0x4e')][_0x0b30('0xa3')]){var _0x1317a9=_0x4c82ee[_0x0b30('0x4e')][_0x0b30('0xa3')][_0x0b30('0xa4')](',');var _0x1d24c6={};_0x1d24c6[_0x1317a9[0x0]]={'$gte':moment(_0x1317a9[0x1])[_0x0b30('0xa5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1a970f[_0x0b30('0x58')]=_[_0x0b30('0x5a')](_0x1a970f[_0x0b30('0x58')],_0x1d24c6);}_0x1a970f=_[_0x0b30('0x5a')]({},_0x1a970f,_0x4c82ee[_0x0b30('0x63')]);return db[_0x0b30('0xa2')][_0x0b30('0x35')]({'where':_0x1a970f['where']})[_0x0b30('0x3d')](function(_0xdb7f80){_0x1cc176[_0x0b30('0x35')]=_0xdb7f80;if(_0x4c82ee[_0x0b30('0x4e')][_0x0b30('0x5d')]){_0x1a970f['include']=[{'all':!![]}];}return db[_0x0b30('0xa2')][_0x0b30('0x5f')](_0x1a970f);})[_0x0b30('0x3d')](function(_0x5eada1){_0x1cc176[_0x0b30('0x60')]=_0x5eada1;return _0x1cc176;});}})[_0x0b30('0x3d')](respondWithFilteredResult(_0x20d18c,_0x1a970f))[_0x0b30('0x30')](handleError(_0x20d18c,null));};exports['send']=function(_0x749f26,_0x5d0ea9,_0x2376ad){var _0x5a1edf,_0x50f330={},_0x21cbce;if(_0x749f26[_0x0b30('0x64')]['to']){_0x21cbce=_0x749f26[_0x0b30('0x64')]['to'][_0x0b30('0xa4')](',')[0x0];}return db[_0x0b30('0x5c')][_0x0b30('0x65')]({'where':{'id':_0x749f26[_0x0b30('0x62')]['id']},'include':[{'model':db[_0x0b30('0xa6')],'as':_0x0b30('0xa7'),'include':[{'model':db[_0x0b30('0x93')],'as':_0x0b30('0xa8'),'where':{'email':_0x21cbce},'limit':0x1,'order':[[_0x0b30('0xa9'),_0x0b30('0xaa')]]}]},{'model':db[_0x0b30('0x44')],'as':_0x0b30('0x45'),'raw':!![]}]})[_0x0b30('0x3d')](handleEntityNotFound(_0x5d0ea9,null))[_0x0b30('0x3d')](function(_0x426611){if(_0x426611){_0x5a1edf=_0x426611;if(_0x426611[_0x0b30('0x45')]){if(_['isNil'](_0x749f26['body']['from'])){_0x749f26[_0x0b30('0x64')][_0x0b30('0xab')]=util[_0x0b30('0xa5')](_0x0b30('0xac'),_0x426611['name'],_0x426611['email']||_0x426611[_0x0b30('0x45')]['user']);}if(_0x749f26[_0x0b30('0x64')]['attachments']&&_0x749f26[_0x0b30('0x64')][_0x0b30('0xad')][_0x0b30('0x54')]){for(var _0xa3fb31=0x0;_0xa3fb31<_0x749f26[_0x0b30('0x64')][_0x0b30('0xad')][_0x0b30('0x54')];_0xa3fb31+=0x1){_0x749f26[_0x0b30('0x64')][_0x0b30('0xad')][_0xa3fb31]={'filename':_0x749f26[_0x0b30('0x64')][_0x0b30('0xad')][_0xa3fb31]['name'],'path':path[_0x0b30('0xae')](config[_0x0b30('0xaf')],_0x0b30('0xb0'),_0x749f26['body'][_0x0b30('0xad')][_0xa3fb31][_0x0b30('0xb1')])};}}var _0x1c5bf5={'tls':{'rejectUnauthorized':![]}};if(_[_0x0b30('0x79')](_0x426611[_0x0b30('0x45')]['service'])){if(_0x426611[_0x0b30('0x45')][_0x0b30('0x81')]){_0x1c5bf5[_0x0b30('0xb2')]={'user':_0x426611[_0x0b30('0x45')]['user'],'pass':_0x426611[_0x0b30('0x45')][_0x0b30('0x7f')]};}_0x1c5bf5['host']=_0x426611[_0x0b30('0x45')][_0x0b30('0x82')];_0x1c5bf5[_0x0b30('0x83')]=_0x426611[_0x0b30('0x45')][_0x0b30('0x83')];_0x1c5bf5['secure']=_0x426611[_0x0b30('0x45')]['secure'];}else{_0x1c5bf5[_0x0b30('0x84')]=_0x426611['Smtp'][_0x0b30('0x84')];_0x1c5bf5[_0x0b30('0xb2')]={'user':_0x426611[_0x0b30('0x45')][_0x0b30('0x7c')],'pass':_0x426611[_0x0b30('0x45')][_0x0b30('0x7f')]};}return respondWithRpcPromise(_0x0b30('0xb3'),_0x0b30('0xb4'),{'account':_0x1c5bf5,'message':_0x749f26[_0x0b30('0x64')]});}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x16e4c3){if(_0x16e4c3){_0x50f330=_0x16e4c3;if(_0x5a1edf[_0x0b30('0xa7')]){if(_0x5a1edf['List'][_0x0b30('0xa8')]['length']){return _0x5a1edf[_0x0b30('0xa7')][_0x0b30('0xa8')][0x0];}else{return db[_0x0b30('0x93')][_0x0b30('0x6a')](_[_0x0b30('0x1c')](_0x749f26[_0x0b30('0x64')],{'firstName':_0x749f26[_0x0b30('0x64')]['to'],'email':_0x749f26['body']['to'],'phone':_0x749f26[_0x0b30('0x64')]['to'],'ListId':_0x5a1edf[_0x0b30('0x76')]}));}}else{throw new Error(_0x0b30('0xb5'));}}})['then'](function(_0x3fd54c){if(_0x3fd54c){var _0x311d9b={'UserId':_0x749f26[_0x0b30('0x7c')]['id'],'ContactId':_0x3fd54c['id'],'MailAccountId':_0x5a1edf['id'],'inReplyTo':_0x50f330[_0x0b30('0xb6')],'to':_0x749f26[_0x0b30('0x64')][_0x0b30('0xab')],'cc':_0x749f26['body']['cc'],'subject':_0x749f26[_0x0b30('0x64')][_0x0b30('0xb7')],'attach':_0x749f26[_0x0b30('0x64')][_0x0b30('0xb8')],'firstMsgDirection':_0x0b30('0xb9'),'lastMsgAt':moment()[_0x0b30('0xa5')](_0x0b30('0xba')),'lastMsgDirection':_0x0b30('0xb9'),'lastMsgBody':_0x749f26['body'][_0x0b30('0x64')],'Messages':[_[_0x0b30('0x5a')](_0x749f26[_0x0b30('0x64')],{'messageId':_0x50f330[_0x0b30('0xb6')],'sentAt':moment()[_0x0b30('0xa5')](_0x0b30('0xba')),'read':!![],'MailAccountId':_0x5a1edf['id'],'UserId':_0x749f26['user']['id'],'ContactId':_0x3fd54c['id']})]};if(_0x749f26['body'][_0x0b30('0xbb')]){_0x311d9b=_[_0x0b30('0x5a')](_0x311d9b,_0x749f26[_0x0b30('0x64')]['Interaction']);}return db[_0x0b30('0x92')][_0x0b30('0x6a')](_0x311d9b,{'include':[{'model':db[_0x0b30('0xa2')],'as':_0x0b30('0xbc')}]});}})['then'](respondWithResult(_0x5d0ea9,null))[_0x0b30('0x30')](handleError(_0x5d0ea9,null));};exports[_0x0b30('0xbd')]=function(_0x4a414c,_0x29e276,_0x298ecb){return db[_0x0b30('0x5c')]['find']({'where':{'id':_0x4a414c[_0x0b30('0x62')]['id']},'include':[{'model':db[_0x0b30('0x44')],'as':_0x0b30('0x45'),'raw':!![]}]})[_0x0b30('0x3d')](handleEntityNotFound(_0x29e276,null))[_0x0b30('0x3d')](function(_0x495660){if(_0x495660&&_0x495660[_0x0b30('0x45')]){var _0x4f3e95={'id':_0x495660['id'],'tls':{'rejectUnauthorized':![]}};if(_0x495660[_0x0b30('0x45')]['service']){_0x4f3e95['service']=_0x495660[_0x0b30('0x45')][_0x0b30('0x84')];}else{_0x4f3e95[_0x0b30('0x82')]=_0x495660['Smtp']['host'];_0x4f3e95[_0x0b30('0x83')]=_0x495660[_0x0b30('0x45')]['port'];_0x4f3e95[_0x0b30('0xbe')]=_0x495660[_0x0b30('0x45')][_0x0b30('0xbe')];}if(_0x495660[_0x0b30('0x45')][_0x0b30('0x81')]){_0x4f3e95[_0x0b30('0xb2')]={'user':_0x495660[_0x0b30('0x45')]['user'],'pass':_0x495660['Smtp'][_0x0b30('0x7f')]};}return respondWithRpcPromise(_0x0b30('0xbf'),'verifySmtp',{'account':_0x4f3e95});}})['then'](respondWithResult(_0x29e276,null))[_0x0b30('0x30')](handleError(_0x29e276,null));};exports['destroy']=function(_0x38c884,_0x2adcf7){return db[_0x0b30('0x5c')][_0x0b30('0x65')]({'where':{'id':_0x38c884[_0x0b30('0x62')]['id']}})[_0x0b30('0x3d')](handleEntityNotFound(_0x2adcf7,null))['then'](function(_0xad9679){if(_0xad9679&&_0xad9679[_0x0b30('0x84')]){throw new db['Sequelize'][(_0x0b30('0x25'))](_0x0b30('0xc0'));}return _0xad9679;})['then'](removeEntity(_0x2adcf7,null))[_0x0b30('0x30')](handleError(_0x2adcf7,null));};exports[_0x0b30('0xc1')]=function(_0x554d93,_0x17ae60,_0x3ebf3b){return db[_0x0b30('0x5c')][_0x0b30('0x65')]({'where':{'id':_0x554d93['params']['id']}})[_0x0b30('0x3d')](handleEntityNotFound(_0x17ae60,null))[_0x0b30('0x3d')](function(_0x447869){if(_0x447869){return _0x447869[_0x0b30('0xc1')](_0x554d93['body']['ids'],_[_0x0b30('0x91')](_0x554d93[_0x0b30('0x64')],[_0x0b30('0x70'),'id'])||{})['spread'](function(_0xe9a771){for(var _0x474e0f=0x0;_0x474e0f<_0x554d93[_0x0b30('0x64')]['ids'][_0x0b30('0x54')];_0x474e0f+=0x1){socket[_0x0b30('0xc2')]('userMailAccount:save',{'UserId':_0x554d93[_0x0b30('0x64')][_0x0b30('0x70')][_0x474e0f],'MailAccountId':_0x554d93[_0x0b30('0x62')]['id']});}return _0xe9a771;});}})['then'](respondWithResult(_0x17ae60,null))[_0x0b30('0x30')](handleError(_0x17ae60,null));};exports[_0x0b30('0xc3')]=function(_0x1be7d2,_0x5a5cc3,_0x29f01a){return db['MailAccount'][_0x0b30('0x65')]({'where':{'id':_0x1be7d2['params']['id']}})[_0x0b30('0x3d')](handleEntityNotFound(_0x5a5cc3,null))[_0x0b30('0x3d')](function(_0x491023){if(_0x491023){return _0x491023[_0x0b30('0xc3')](_0x1be7d2['query'][_0x0b30('0x70')])[_0x0b30('0x3d')](function(){if(_[_0x0b30('0xc4')](_0x1be7d2[_0x0b30('0x4e')]['ids'])){for(var _0x250090=0x0;_0x250090<_0x1be7d2[_0x0b30('0x4e')]['ids']['length'];_0x250090+=0x1){socket[_0x0b30('0xc2')]('userMailAccount:remove',{'UserId':Number(_0x1be7d2[_0x0b30('0x4e')]['ids'][_0x250090]),'MailAccountId':Number(_0x1be7d2['params']['id'])});}}else{socket['emit'](_0x0b30('0xc5'),{'UserId':Number(_0x1be7d2[_0x0b30('0x4e')][_0x0b30('0x70')]),'MailAccountId':Number(_0x1be7d2[_0x0b30('0x62')]['id'])});}});}})[_0x0b30('0x3d')](respondWithStatusCode(_0x5a5cc3,null))[_0x0b30('0x30')](handleError(_0x5a5cc3,null));};exports[_0x0b30('0xc6')]=function(_0x8e83d,_0x63e754,_0x526fd9){var _0x348a76={};var _0x108d9b={};var _0x3ade56;var _0x51d51a;return db['MailAccount'][_0x0b30('0x6c')]({'where':{'id':_0x8e83d[_0x0b30('0x62')]['id']}})[_0x0b30('0x3d')](handleEntityNotFound(_0x63e754,null))[_0x0b30('0x3d')](function(_0x4993a5){if(_0x4993a5){_0x3ade56=_0x4993a5;_0x108d9b[_0x0b30('0x4d')]=_[_0x0b30('0x4f')](db[_0x0b30('0x94')][_0x0b30('0x49')]);_0x108d9b[_0x0b30('0x4e')]=_[_0x0b30('0x4f')](_0x8e83d[_0x0b30('0x4e')]);_0x108d9b['filters']=_['intersection'](_0x108d9b[_0x0b30('0x4d')],_0x108d9b[_0x0b30('0x4e')]);_0x348a76['attributes']=_[_0x0b30('0x51')](_0x108d9b[_0x0b30('0x4d')],qs[_0x0b30('0x53')](_0x8e83d[_0x0b30('0x4e')][_0x0b30('0x53')]));_0x348a76[_0x0b30('0x52')]=_0x348a76[_0x0b30('0x52')][_0x0b30('0x54')]?_0x348a76[_0x0b30('0x52')]:_0x108d9b[_0x0b30('0x4d')];_0x348a76[_0x0b30('0x6d')]=qs[_0x0b30('0x57')](_0x8e83d['query'][_0x0b30('0x57')]);_0x348a76['where']=qs[_0x0b30('0x50')](_[_0x0b30('0x6e')](_0x8e83d[_0x0b30('0x4e')],_0x108d9b[_0x0b30('0x50')]));if(_0x8e83d[_0x0b30('0x4e')]['filter']){_0x348a76[_0x0b30('0x58')]=_[_0x0b30('0x5a')](_0x348a76[_0x0b30('0x58')],{'$or':_[_0x0b30('0x48')](_0x348a76[_0x0b30('0x52')],function(_0x43c29d){var _0x66b59e={};_0x66b59e[_0x43c29d]={'$like':'%'+_0x8e83d[_0x0b30('0x4e')][_0x0b30('0x59')]+'%'};return _0x66b59e;})});}_0x348a76=_[_0x0b30('0x5a')]({},_0x348a76,_0x8e83d[_0x0b30('0x63')]);return _0x3ade56[_0x0b30('0xc6')](_0x348a76);}})[_0x0b30('0x3d')](function(_0x522f7b){if(_0x522f7b){_0x51d51a=_0x522f7b['length'];if(!_0x8e83d['query']['hasOwnProperty']('nolimit')){_0x348a76[_0x0b30('0x37')]=qs[_0x0b30('0x37')](_0x8e83d[_0x0b30('0x4e')]['limit']);_0x348a76[_0x0b30('0x36')]=qs['offset'](_0x8e83d['query']['offset']);}return _0x3ade56['getAgents'](_0x348a76);}})[_0x0b30('0x3d')](function(_0x187864){if(_0x187864){return _0x187864?{'count':_0x51d51a,'rows':_0x187864}:null;}})['then'](respondWithResult(_0x63e754,null))[_0x0b30('0x30')](handleError(_0x63e754,null));}; \ No newline at end of file +var _0x3804=['split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','from','%s\x20<%s>','attachments','join','server/files/attachments','secure','SendMail','sendMail','List\x20not\x20found','messageId','subject','out','Interaction','Messages','verifySmtp','auth','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','userMailAccount:save','removeAgents','isArray','emit','getAgents','html-pdf','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','index','Imap','Smtp','Pause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','includeAll','findAll','params','MailServerIn','include','options','find','body','MailServerOut','mandatoryDispositionPause','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','rows','removeDispositions','addAnswer','getAnswers','CannedAnswer','nolimit','order','removeAnswers','ids','email','ListId','isNil','active','description','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte'];(function(_0x4b69fc,_0x56c171){var _0x1cd766=function(_0x369b22){while(--_0x369b22){_0x4b69fc['push'](_0x4b69fc['shift']());}};_0x1cd766(++_0x56c171);}(_0x3804,0x1ac));var _0x4380=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3804[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x4380('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4380('0x1'));var zipdir=require(_0x4380('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4380('0x3'));var Mustache=require(_0x4380('0x4'));var util=require(_0x4380('0x5'));var path=require(_0x4380('0x6'));var sox=require(_0x4380('0x7'));var csv=require(_0x4380('0x8'));var ejs=require(_0x4380('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4380('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4380('0x8'));var querystring=require(_0x4380('0xb'));var Papa=require('papaparse');var Redis=require(_0x4380('0xc'));var authService=require(_0x4380('0xd'));var qs=require(_0x4380('0xe'));var as=require(_0x4380('0xf'));var hardwareService=require(_0x4380('0x10'));var logger=require(_0x4380('0x11'))(_0x4380('0x12'));var utils=require(_0x4380('0x13'));var config=require(_0x4380('0x14'));var db=require(_0x4380('0x15'))['db'];config[_0x4380('0x16')]=_[_0x4380('0x17')](config[_0x4380('0x16')],{'host':_0x4380('0x18'),'port':0x18eb});var socket=require(_0x4380('0x19'))(new Redis(config['redis']));require(_0x4380('0x1a'))['register'](socket);var jayson=require(_0x4380('0x1b'));var client=jayson['client'][_0x4380('0x1c')]({'port':0x232b});function checkPasswordPattern(_0x5ec604,_0x34961e,_0x14c17f){if(_0x14c17f){var _0x538228=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x538228[_0x4380('0x1d')](_0x34961e)){return _0x5ec604;}else{throw new db[(_0x4380('0x1e'))]['ValidationError'](_0x4380('0x1f'));}}else{return _0x5ec604;}}function respondWithRpcPromise(_0xb0669d,_0x238bd1,_0x3ce28e,_0x58b923){return new BPromise(function(_0x3443b1,_0x5a8256){var _0x58b194=_0x58b923||client;return _0x58b194['request'](_0xb0669d,_0x3ce28e)[_0x4380('0x20')](function(_0x3de71b){logger[_0x4380('0x21')](_0x4380('0x22'),_0x238bd1,_0x4380('0x23'));logger[_0x4380('0x24')](_0x4380('0x25'),_0x238bd1,_0x4380('0x23'),JSON[_0x4380('0x26')](_0x3de71b));if(_0x3de71b['error']){if(_0x3de71b[_0x4380('0x27')][_0x4380('0x28')]===0x1f4){logger[_0x4380('0x27')]('MailAccount,\x20%s,\x20%s',_0x238bd1,_0x3de71b['error'][_0x4380('0x29')]);return _0x5a8256(_0x3de71b[_0x4380('0x27')][_0x4380('0x29')]);}logger[_0x4380('0x27')]('MailAccount,\x20%s,\x20%s',_0x238bd1,_0x3de71b[_0x4380('0x27')][_0x4380('0x29')]);return _0x3443b1(_0x3de71b[_0x4380('0x27')][_0x4380('0x29')]);}else{logger[_0x4380('0x21')](_0x4380('0x22'),_0x238bd1,_0x4380('0x23'));_0x3443b1(_0x3de71b[_0x4380('0x2a')]['message']);}})[_0x4380('0x2b')](function(_0x2a7de9){logger['error'](_0x4380('0x22'),_0x238bd1,_0x2a7de9);_0x5a8256(_0x2a7de9);});});}function respondWithStatusCode(_0x279ec1,_0x23498f){_0x23498f=_0x23498f||0xcc;return function(_0x82f3a4){if(_0x82f3a4){return _0x279ec1[_0x4380('0x2c')](_0x23498f);}return _0x279ec1[_0x4380('0x2d')](_0x23498f)[_0x4380('0x2e')]();};}function respondWithResult(_0x142e43,_0x468532){_0x468532=_0x468532||0xc8;return function(_0xc8fee){if(_0xc8fee){return _0x142e43[_0x4380('0x2d')](_0x468532)[_0x4380('0x2f')](_0xc8fee);}};}function respondWithFilteredResult(_0x2143d1,_0x5941fc){return function(_0x2f2fff){if(_0x2f2fff){var _0x4d4560=_0x2f2fff[_0x4380('0x30')],_0x24e9a4=_0x5941fc[_0x4380('0x31')],_0x1c08db=_0x5941fc['offset']+_0x5941fc[_0x4380('0x32')],_0x730914;if(_0x1c08db>=_0x4d4560){_0x1c08db=_0x4d4560;_0x730914=0xc8;}else{_0x730914=0xce;}_0x2143d1[_0x4380('0x2d')](_0x730914);return _0x2143d1[_0x4380('0x33')](_0x4380('0x34'),_0x24e9a4+'-'+_0x1c08db+'/'+_0x4d4560)[_0x4380('0x2f')](_0x2f2fff);}return null;};}function patchUpdates(_0x4a554f){return function(_0xedf371){try{jsonpatch[_0x4380('0x35')](_0xedf371,_0x4a554f,!![]);}catch(_0x51150a){return BPromise[_0x4380('0x36')](_0x51150a);}return _0xedf371[_0x4380('0x37')]();};}function saveUpdates(_0x28dca7,_0x7b4929){return function(_0x376630){if(_0x376630){return _0x376630[_0x4380('0x38')](_0x28dca7)[_0x4380('0x20')](function(_0x28a009){return _0x28a009;});}return null;};}function removeEntity(_0x173efb,_0x3e5f20){return function(_0x39608e){if(_0x39608e){return _0x39608e[_0x4380('0x39')]()[_0x4380('0x20')](function(){var _0x512b48=_0x39608e[_0x4380('0x3a')]({'plain':!![]});var _0x5aabca=_0x4380('0x3b');return db[_0x4380('0x3c')][_0x4380('0x39')]({'where':{'type':_0x5aabca,'resourceId':_0x512b48['id']}})[_0x4380('0x20')](function(){return _0x39608e;});})['then'](function(){_0x173efb[_0x4380('0x2d')](0xcc)[_0x4380('0x2e')]();});}};}function handleEntityNotFound(_0x11fcf2,_0x456bd0){return function(_0x368f37){if(!_0x368f37){_0x11fcf2[_0x4380('0x2c')](0x194);}return _0x368f37;};}function handleError(_0x9e4e29,_0x35355d){_0x35355d=_0x35355d||0x1f4;return function(_0x5b5dde){logger[_0x4380('0x27')](_0x5b5dde[_0x4380('0x3d')]);if(_0x5b5dde['name']){delete _0x5b5dde[_0x4380('0x3e')];}_0x9e4e29[_0x4380('0x2d')](_0x35355d)[_0x4380('0x3f')](_0x5b5dde);};}exports[_0x4380('0x40')]=function(_0x2e04dc,_0x2cc492){var _0x3bede1={'include':[{'model':db['MailServerIn'],'as':_0x4380('0x41')},{'model':db['MailServerOut'],'as':_0x4380('0x42')},{'model':db[_0x4380('0x43')],'as':'mandatoryDispositionPause'}]},_0x216021={},_0x550af6={'count':0x0,'rows':[]};var _0x2f8a82=_[_0x4380('0x44')](db[_0x4380('0x45')][_0x4380('0x46')],function(_0x438884){return{'name':_0x438884[_0x4380('0x47')],'type':_0x438884[_0x4380('0x48')][_0x4380('0x49')]};});_0x216021[_0x4380('0x4a')]=_['map'](_0x2f8a82,'name');_0x216021[_0x4380('0x4b')]=_[_0x4380('0x4c')](_0x2e04dc[_0x4380('0x4b')]);_0x216021[_0x4380('0x4d')]=_['intersection'](_0x216021[_0x4380('0x4a')],_0x216021[_0x4380('0x4b')]);_0x3bede1[_0x4380('0x4e')]=_[_0x4380('0x4f')](_0x216021[_0x4380('0x4a')],qs[_0x4380('0x50')](_0x2e04dc['query']['fields']));_0x3bede1['attributes']=_0x3bede1[_0x4380('0x4e')][_0x4380('0x51')]?_0x3bede1[_0x4380('0x4e')]:_0x216021[_0x4380('0x4a')];if(!_0x2e04dc[_0x4380('0x4b')][_0x4380('0x52')]('nolimit')){_0x3bede1['limit']=qs[_0x4380('0x32')](_0x2e04dc[_0x4380('0x4b')][_0x4380('0x32')]);_0x3bede1['offset']=qs[_0x4380('0x31')](_0x2e04dc[_0x4380('0x4b')]['offset']);}_0x3bede1['order']=qs[_0x4380('0x53')](_0x2e04dc['query'][_0x4380('0x53')]);_0x3bede1[_0x4380('0x54')]=qs[_0x4380('0x4d')](_[_0x4380('0x55')](_0x2e04dc[_0x4380('0x4b')],_0x216021[_0x4380('0x4d')]),_0x2f8a82);if(_0x2e04dc[_0x4380('0x4b')][_0x4380('0x56')]){_0x3bede1[_0x4380('0x54')]=_[_0x4380('0x57')](_0x3bede1['where'],{'$or':_[_0x4380('0x44')](_0x2f8a82,function(_0x42e05a){if(_0x42e05a[_0x4380('0x48')]!=='VIRTUAL'){var _0x533b4c={};_0x533b4c[_0x42e05a[_0x4380('0x3e')]]={'$like':'%'+_0x2e04dc[_0x4380('0x4b')][_0x4380('0x56')]+'%'};return _0x533b4c;}})});}_0x3bede1=_[_0x4380('0x57')]({},_0x3bede1,_0x2e04dc['options']);var _0x47ea3e={'where':_0x3bede1[_0x4380('0x54')]};return db[_0x4380('0x45')][_0x4380('0x30')](_0x47ea3e)[_0x4380('0x20')](function(_0x1e6d7c){_0x550af6['count']=_0x1e6d7c;if(_0x2e04dc[_0x4380('0x4b')][_0x4380('0x58')]){_0x3bede1['include']=[{'all':!![]}];}return db[_0x4380('0x45')][_0x4380('0x59')](_0x3bede1);})[_0x4380('0x20')](function(_0x4ba5ce){_0x550af6['rows']=_0x4ba5ce;return _0x550af6;})[_0x4380('0x20')](respondWithFilteredResult(_0x2cc492,_0x3bede1))[_0x4380('0x2b')](handleError(_0x2cc492,null));};exports['show']=function(_0x55e6c8,_0xfcef1e){var _0x3fa1e6={'raw':![],'where':{'id':_0x55e6c8[_0x4380('0x5a')]['id']},'include':[{'model':db[_0x4380('0x5b')],'as':_0x4380('0x41')},{'model':db['MailServerOut'],'as':_0x4380('0x42')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1e5cf6={};_0x1e5cf6[_0x4380('0x4a')]=_[_0x4380('0x4c')](db[_0x4380('0x45')][_0x4380('0x46')]);_0x1e5cf6[_0x4380('0x4b')]=_['keys'](_0x55e6c8[_0x4380('0x4b')]);_0x1e5cf6[_0x4380('0x4d')]=_[_0x4380('0x4f')](_0x1e5cf6['model'],_0x1e5cf6[_0x4380('0x4b')]);_0x3fa1e6[_0x4380('0x4e')]=_[_0x4380('0x4f')](_0x1e5cf6[_0x4380('0x4a')],qs[_0x4380('0x50')](_0x55e6c8['query'][_0x4380('0x50')]));_0x3fa1e6['attributes']=_0x3fa1e6[_0x4380('0x4e')]['length']?_0x3fa1e6[_0x4380('0x4e')]:_0x1e5cf6['model'];if(_0x55e6c8[_0x4380('0x4b')][_0x4380('0x58')]){_0x3fa1e6[_0x4380('0x5c')]=[{'all':!![]}];}_0x3fa1e6=_[_0x4380('0x57')]({},_0x3fa1e6,_0x55e6c8[_0x4380('0x5d')]);return db[_0x4380('0x45')][_0x4380('0x5e')](_0x3fa1e6)[_0x4380('0x20')](handleEntityNotFound(_0xfcef1e,null))['then'](respondWithResult(_0xfcef1e,null))[_0x4380('0x2b')](handleError(_0xfcef1e,null));};exports['update']=function(_0x246c11,_0x446e04){if(_0x246c11[_0x4380('0x5f')]['id']){delete _0x246c11[_0x4380('0x5f')]['id'];}return db[_0x4380('0x45')]['find']({'where':{'id':_0x246c11[_0x4380('0x5a')]['id']},'include':[{'model':db[_0x4380('0x5b')],'as':_0x4380('0x41')},{'model':db[_0x4380('0x60')],'as':_0x4380('0x42')},{'model':db[_0x4380('0x43')],'as':_0x4380('0x61')}]})['then'](handleEntityNotFound(_0x446e04,null))[_0x4380('0x20')](saveUpdates(_0x246c11[_0x4380('0x5f')],null))[_0x4380('0x20')](function(_0x4d3e5f){if(_0x4d3e5f&&_0x246c11[_0x4380('0x5f')][_0x4380('0x41')]){return db['MailServerIn'][_0x4380('0x38')](_0x246c11[_0x4380('0x5f')][_0x4380('0x41')],{'where':{'MailAccountId':_0x4d3e5f['id']}})[_0x4380('0x20')](function(){return _0x4d3e5f;});}return _0x4d3e5f;})[_0x4380('0x20')](function(_0xcd02cb){if(_0xcd02cb&&_0x246c11[_0x4380('0x5f')]['Smtp']){return db[_0x4380('0x60')][_0x4380('0x38')](_0x246c11[_0x4380('0x5f')][_0x4380('0x42')],{'where':{'MailAccountId':_0xcd02cb['id']}})[_0x4380('0x20')](function(){return _0xcd02cb;});}return _0xcd02cb;})['then'](respondWithResult(_0x446e04,null))[_0x4380('0x2b')](handleError(_0x446e04,null));};exports[_0x4380('0x62')]=function(_0xdc32f8,_0x9e26fb){return db[_0x4380('0x45')][_0x4380('0x62')]()['then'](respondWithResult(_0x9e26fb,null))[_0x4380('0x2b')](handleError(_0x9e26fb,null));};exports[_0x4380('0x63')]=function(_0x57e575,_0x58eae5,_0x102123){if(_0x57e575[_0x4380('0x5f')]['id']){delete _0x57e575[_0x4380('0x5f')]['id'];}return db[_0x4380('0x45')][_0x4380('0x5e')]({'where':{'id':_0x57e575['params']['id']}})['then'](handleEntityNotFound(_0x58eae5,null))[_0x4380('0x20')](function(_0x231782){if(_0x231782){_0x57e575[_0x4380('0x5f')][_0x4380('0x64')]=_0x231782['id'];return db[_0x4380('0x65')][_0x4380('0x66')](_0x57e575[_0x4380('0x5f')]);}})['then'](respondWithResult(_0x58eae5,null))[_0x4380('0x2b')](handleError(_0x58eae5,null));};exports[_0x4380('0x67')]=function(_0x380a1b,_0x2aefe5,_0xdc081b){var _0x5312f1={'raw':![],'where':{}};var _0x1b4148={};var _0x309bfa={'count':0x0,'rows':[]};return db['MailAccount'][_0x4380('0x68')]({'where':{'id':_0x380a1b[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x2aefe5,null))[_0x4380('0x20')](function(_0xac518e){if(_0xac518e){_0x1b4148[_0x4380('0x4a')]=_[_0x4380('0x4c')](db[_0x4380('0x65')][_0x4380('0x46')]);_0x1b4148['query']=_[_0x4380('0x4c')](_0x380a1b[_0x4380('0x4b')]);_0x1b4148[_0x4380('0x4d')]=_[_0x4380('0x4f')](_0x1b4148[_0x4380('0x4a')],_0x1b4148[_0x4380('0x4b')]);_0x5312f1[_0x4380('0x4e')]=_[_0x4380('0x4f')](_0x1b4148['model'],qs[_0x4380('0x50')](_0x380a1b[_0x4380('0x4b')][_0x4380('0x50')]));_0x5312f1['attributes']=_0x5312f1[_0x4380('0x4e')][_0x4380('0x51')]?_0x5312f1[_0x4380('0x4e')]:_0x1b4148[_0x4380('0x4a')];if(!_0x380a1b[_0x4380('0x4b')][_0x4380('0x52')]('nolimit')){_0x5312f1[_0x4380('0x32')]=qs['limit'](_0x380a1b['query'][_0x4380('0x32')]);_0x5312f1[_0x4380('0x31')]=qs['offset'](_0x380a1b[_0x4380('0x4b')][_0x4380('0x31')]);}_0x5312f1['order']=qs['sort'](_0x380a1b[_0x4380('0x4b')]['sort']);_0x5312f1[_0x4380('0x54')]=qs[_0x4380('0x4d')](_[_0x4380('0x55')](_0x380a1b[_0x4380('0x4b')],_0x1b4148['filters']));_0x5312f1[_0x4380('0x54')][_0x4380('0x64')]=_0xac518e['id'];if(_0x380a1b[_0x4380('0x4b')]['filter']){_0x5312f1[_0x4380('0x54')]=_[_0x4380('0x57')](_0x5312f1['where'],{'$or':_[_0x4380('0x44')](_0x5312f1[_0x4380('0x4e')],function(_0x5ce988){var _0x20c7a9={};_0x20c7a9[_0x5ce988]={'$like':'%'+_0x380a1b[_0x4380('0x4b')][_0x4380('0x56')]+'%'};return _0x20c7a9;})});}_0x5312f1=_[_0x4380('0x57')]({},_0x5312f1,_0x380a1b['options']);return db[_0x4380('0x65')]['count']({'where':_0x5312f1[_0x4380('0x54')]})[_0x4380('0x20')](function(_0x267bdd){_0x309bfa[_0x4380('0x30')]=_0x267bdd;if(_0x380a1b[_0x4380('0x4b')][_0x4380('0x58')]){_0x5312f1[_0x4380('0x5c')]=[{'all':!![]}];}return db[_0x4380('0x65')][_0x4380('0x59')](_0x5312f1);})[_0x4380('0x20')](function(_0x29f846){_0x309bfa[_0x4380('0x69')]=_0x29f846;return _0x309bfa;});}})[_0x4380('0x20')](respondWithFilteredResult(_0x2aefe5,_0x5312f1))['catch'](handleError(_0x2aefe5,null));};exports['removeDispositions']=function(_0x3a557d,_0x40864a,_0xa8546d){return db[_0x4380('0x45')][_0x4380('0x5e')]({'where':{'id':_0x3a557d[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x40864a,null))[_0x4380('0x20')](function(_0x49d568){if(_0x49d568){return _0x49d568[_0x4380('0x6a')](_0x3a557d['query']['ids']);}})[_0x4380('0x20')](respondWithStatusCode(_0x40864a,null))[_0x4380('0x2b')](handleError(_0x40864a,null));};exports[_0x4380('0x6b')]=function(_0x7077,_0x525a93,_0x40fa7a){if(_0x7077[_0x4380('0x5f')]['id']){delete _0x7077['body']['id'];}return db['MailAccount'][_0x4380('0x5e')]({'where':{'id':_0x7077[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x525a93,null))['then'](function(_0x30c89f){if(_0x30c89f){_0x7077[_0x4380('0x5f')][_0x4380('0x64')]=_0x30c89f['id'];return db['CannedAnswer'][_0x4380('0x66')](_0x7077[_0x4380('0x5f')]);}})['then'](respondWithResult(_0x525a93,null))['catch'](handleError(_0x525a93,null));};exports[_0x4380('0x6c')]=function(_0x337638,_0x4eb479,_0x2e3638){var _0x2c9c5d={'raw':![],'where':{}};var _0x191e6d={};var _0x61c2d7={'count':0x0,'rows':[]};return db[_0x4380('0x45')][_0x4380('0x68')]({'where':{'id':_0x337638[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x4eb479,null))['then'](function(_0x4cdc2c){if(_0x4cdc2c){_0x191e6d[_0x4380('0x4a')]=_['keys'](db[_0x4380('0x6d')][_0x4380('0x46')]);_0x191e6d[_0x4380('0x4b')]=_[_0x4380('0x4c')](_0x337638[_0x4380('0x4b')]);_0x191e6d[_0x4380('0x4d')]=_['intersection'](_0x191e6d[_0x4380('0x4a')],_0x191e6d['query']);_0x2c9c5d[_0x4380('0x4e')]=_[_0x4380('0x4f')](_0x191e6d[_0x4380('0x4a')],qs[_0x4380('0x50')](_0x337638['query']['fields']));_0x2c9c5d['attributes']=_0x2c9c5d['attributes']['length']?_0x2c9c5d[_0x4380('0x4e')]:_0x191e6d[_0x4380('0x4a')];if(!_0x337638[_0x4380('0x4b')]['hasOwnProperty'](_0x4380('0x6e'))){_0x2c9c5d[_0x4380('0x32')]=qs['limit'](_0x337638['query'][_0x4380('0x32')]);_0x2c9c5d[_0x4380('0x31')]=qs[_0x4380('0x31')](_0x337638[_0x4380('0x4b')][_0x4380('0x31')]);}_0x2c9c5d[_0x4380('0x6f')]=qs[_0x4380('0x53')](_0x337638[_0x4380('0x4b')][_0x4380('0x53')]);_0x2c9c5d[_0x4380('0x54')]=qs[_0x4380('0x4d')](_['pick'](_0x337638[_0x4380('0x4b')],_0x191e6d['filters']));_0x2c9c5d[_0x4380('0x54')]['MailAccountId']=_0x4cdc2c['id'];if(_0x337638[_0x4380('0x4b')][_0x4380('0x56')]){_0x2c9c5d[_0x4380('0x54')]=_['merge'](_0x2c9c5d[_0x4380('0x54')],{'$or':_['map'](_0x2c9c5d[_0x4380('0x4e')],function(_0x424532){var _0x4150ca={};_0x4150ca[_0x424532]={'$like':'%'+_0x337638['query'][_0x4380('0x56')]+'%'};return _0x4150ca;})});}_0x2c9c5d=_[_0x4380('0x57')]({},_0x2c9c5d,_0x337638[_0x4380('0x5d')]);return db[_0x4380('0x6d')]['count']({'where':_0x2c9c5d[_0x4380('0x54')]})[_0x4380('0x20')](function(_0x4a2431){_0x61c2d7['count']=_0x4a2431;if(_0x337638['query'][_0x4380('0x58')]){_0x2c9c5d[_0x4380('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0x4380('0x59')](_0x2c9c5d);})[_0x4380('0x20')](function(_0x1bdb8a){_0x61c2d7[_0x4380('0x69')]=_0x1bdb8a;return _0x61c2d7;});}})[_0x4380('0x20')](respondWithFilteredResult(_0x4eb479,_0x2c9c5d))[_0x4380('0x2b')](handleError(_0x4eb479,null));};exports['removeAnswers']=function(_0x1ca07a,_0x3b4531,_0x38cd3a){return db['MailAccount'][_0x4380('0x5e')]({'where':{'id':_0x1ca07a[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x3b4531,null))[_0x4380('0x20')](function(_0x1dc473){if(_0x1dc473){return _0x1dc473[_0x4380('0x70')](_0x1ca07a['query'][_0x4380('0x71')]);}})['then'](respondWithStatusCode(_0x3b4531,null))[_0x4380('0x2b')](handleError(_0x3b4531,null));};exports[_0x4380('0x66')]=function(_0x14c732,_0x3d2c12){var _0x5e97da={'name':_0x14c732[_0x4380('0x5f')][_0x4380('0x3e')],'key':_0x14c732['body'][_0x4380('0x49')],'email':_0x14c732['body'][_0x4380('0x72')],'ListId':_0x14c732['body'][_0x4380('0x73')],'active':!_[_0x4380('0x74')](_0x14c732[_0x4380('0x5f')][_0x4380('0x75')])?_0x14c732[_0x4380('0x5f')][_0x4380('0x75')]:!![],'description':_0x14c732[_0x4380('0x5f')][_0x4380('0x76')]||null,'Imap':{},'Smtp':{}};if(_[_0x4380('0x74')](_0x14c732[_0x4380('0x5f')]['cservice'])){if(_0x14c732[_0x4380('0x5f')][_0x4380('0x77')]){_0x5e97da[_0x4380('0x41')][_0x4380('0x78')]=_0x5e97da[_0x4380('0x42')]['user']=_0x14c732['body'][_0x4380('0x79')];_0x5e97da[_0x4380('0x41')][_0x4380('0x7a')]=_0x5e97da['Smtp'][_0x4380('0x7b')]=_0x14c732[_0x4380('0x5f')][_0x4380('0x7c')];}else{_0x5e97da['Imap'][_0x4380('0x7d')]=_0x5e97da[_0x4380('0x42')][_0x4380('0x7d')]=![];}_0x5e97da['Imap'][_0x4380('0x7e')]=_0x14c732[_0x4380('0x5f')]['Imap'][_0x4380('0x7e')];_0x5e97da[_0x4380('0x41')]['port']=_0x14c732[_0x4380('0x5f')][_0x4380('0x41')][_0x4380('0x7f')];_0x5e97da['Smtp'][_0x4380('0x7e')]=_0x14c732[_0x4380('0x5f')][_0x4380('0x42')]['host'];_0x5e97da['Smtp'][_0x4380('0x7f')]=_0x14c732[_0x4380('0x5f')][_0x4380('0x42')]['port'];}else{_0x5e97da[_0x4380('0x41')][_0x4380('0x80')]=_0x5e97da[_0x4380('0x42')][_0x4380('0x80')]=_0x14c732[_0x4380('0x5f')]['cservice'];_0x5e97da[_0x4380('0x41')][_0x4380('0x78')]=_0x5e97da[_0x4380('0x42')][_0x4380('0x78')]=_0x14c732[_0x4380('0x5f')][_0x4380('0x79')];_0x5e97da[_0x4380('0x41')][_0x4380('0x7a')]=_0x5e97da[_0x4380('0x42')][_0x4380('0x7b')]=_0x14c732['body'][_0x4380('0x7c')];}return db[_0x4380('0x45')][_0x4380('0x66')](_0x5e97da,{'include':[{'model':db['MailServerOut'],'as':_0x4380('0x42')},{'model':db['MailServerIn'],'as':_0x4380('0x41')}]})['then'](function(_0x4ea38c){var _0x3d7f5e=_0x14c732[_0x4380('0x78')][_0x4380('0x3a')]({'plain':!![]});if(!_0x3d7f5e)throw new Error(_0x4380('0x81'));if(_0x3d7f5e[_0x4380('0x82')]===_0x4380('0x78')){var _0x497af7=_0x4ea38c[_0x4380('0x3a')]({'plain':!![]});return db[_0x4380('0x83')][_0x4380('0x5e')]({'where':{'name':_0x4380('0x3b'),'userProfileId':_0x3d7f5e[_0x4380('0x84')]},'raw':!![]})[_0x4380('0x20')](function(_0x3a2b72){if(_0x3a2b72&&_0x3a2b72[_0x4380('0x85')]===0x0){return db[_0x4380('0x3c')][_0x4380('0x66')]({'name':_0x497af7[_0x4380('0x3e')],'resourceId':_0x497af7['id'],'type':_0x3a2b72['name'],'sectionId':_0x3a2b72['id']},{})[_0x4380('0x20')](function(){return _0x4ea38c;});}else{return _0x4ea38c;}})[_0x4380('0x2b')](function(_0x5abdc5){logger[_0x4380('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5abdc5);throw _0x5abdc5;});}return _0x4ea38c;})[_0x4380('0x20')](respondWithResult(_0x3d2c12,0xc9))[_0x4380('0x2b')](handleError(_0x3d2c12,null));};exports[_0x4380('0x86')]=function(_0x48387e,_0x12a21a,_0x242c8f){return db[_0x4380('0x45')][_0x4380('0x68')]({'where':{'id':_0x48387e[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x12a21a,null))['then'](function(_0x119759){if(_0x119759){return _0x119759['getImap']();}return null;})[_0x4380('0x20')](respondWithResult(_0x12a21a,null))[_0x4380('0x2b')](handleError(_0x12a21a,null));};exports[_0x4380('0x87')]=function(_0x2c195c,_0x552f55,_0x132c20){if(_0x2c195c[_0x4380('0x5f')]['id']){delete _0x2c195c[_0x4380('0x5f')]['id'];}return db[_0x4380('0x45')][_0x4380('0x5e')]({'where':{'id':_0x2c195c[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x552f55,null))[_0x4380('0x20')](function(_0x3319c0){if(_0x3319c0){_0x2c195c[_0x4380('0x5f')][_0x4380('0x64')]=_0x3319c0['id'];return db[_0x4380('0x5b')][_0x4380('0x66')](_0x2c195c[_0x4380('0x5f')]);}})[_0x4380('0x20')](respondWithResult(_0x552f55,null))[_0x4380('0x2b')](handleError(_0x552f55,null));};exports[_0x4380('0x88')]=function(_0xb2aa9,_0x49dbfe,_0x11da8f){return db[_0x4380('0x45')][_0x4380('0x68')]({'where':{'id':_0xb2aa9[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x49dbfe,null))[_0x4380('0x20')](function(_0x2f1b9c){if(_0x2f1b9c){return _0x2f1b9c['setImap'](null);}return null;})[_0x4380('0x20')](respondWithStatusCode(_0x49dbfe,null))[_0x4380('0x2b')](handleError(_0x49dbfe,null));};exports[_0x4380('0x89')]=function(_0x4ca00f,_0x1da0d8,_0x59f1b4){return db[_0x4380('0x45')][_0x4380('0x68')]({'where':{'id':_0x4ca00f[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x1da0d8,null))['then'](function(_0x2f53a2){if(_0x2f53a2){return _0x2f53a2[_0x4380('0x89')]();}return null;})[_0x4380('0x20')](respondWithResult(_0x1da0d8,null))[_0x4380('0x2b')](handleError(_0x1da0d8,null));};exports[_0x4380('0x8a')]=function(_0x5cd1a2,_0x56db52,_0x5126f0){if(_0x5cd1a2[_0x4380('0x5f')]['id']){delete _0x5cd1a2['body']['id'];}return db[_0x4380('0x45')][_0x4380('0x5e')]({'where':{'id':_0x5cd1a2[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x56db52,null))[_0x4380('0x20')](function(_0x39954c){if(_0x39954c){_0x5cd1a2['body'][_0x4380('0x64')]=_0x39954c['id'];return db[_0x4380('0x60')]['create'](_0x5cd1a2[_0x4380('0x5f')]);}})[_0x4380('0x20')](respondWithResult(_0x56db52,null))['catch'](handleError(_0x56db52,null));};exports[_0x4380('0x8b')]=function(_0x21513f,_0x18c821,_0x58dc48){return db[_0x4380('0x45')]['findOne']({'where':{'id':_0x21513f[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x18c821,null))[_0x4380('0x20')](function(_0x28924c){if(_0x28924c){return _0x28924c[_0x4380('0x8c')](null);}return null;})[_0x4380('0x20')](respondWithStatusCode(_0x18c821,null))[_0x4380('0x2b')](handleError(_0x18c821,null));};exports[_0x4380('0x8d')]=function(_0x50dcad,_0x38a207,_0x5d0da6){return db[_0x4380('0x8e')][_0x4380('0x5e')]({'where':{'id':_0x50dcad[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x38a207,null))[_0x4380('0x20')](function(_0x44e303){if(_0x44e303){return _0x44e303['addInteraction'](_0x50dcad[_0x4380('0x5f')]['ids'],_['omit'](_0x50dcad['body'],[_0x4380('0x71'),'id'])||{});}})[_0x4380('0x20')](respondWithResult(_0x38a207,null))[_0x4380('0x2b')](handleError(_0x38a207,null));};exports[_0x4380('0x8f')]=function(_0x9d897f,_0x1ebb55,_0x1dfa37){var _0x12d94d={'raw':![],'where':{}};var _0x1bbe76={};var _0x3be565={'count':0x0,'rows':[]};return db[_0x4380('0x45')][_0x4380('0x68')]({'where':{'id':_0x9d897f[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x1ebb55,null))[_0x4380('0x20')](function(_0x2e5b11){if(_0x2e5b11){_0x1bbe76[_0x4380('0x4a')]=_[_0x4380('0x4c')](db['MailInteraction'][_0x4380('0x46')]);_0x1bbe76[_0x4380('0x4b')]=_[_0x4380('0x4c')](_0x9d897f[_0x4380('0x4b')]);_0x1bbe76[_0x4380('0x4d')]=_['intersection'](_0x1bbe76[_0x4380('0x4a')],_0x1bbe76[_0x4380('0x4b')]);_0x12d94d[_0x4380('0x4e')]=_['intersection'](_0x1bbe76[_0x4380('0x4a')],qs[_0x4380('0x50')](_0x9d897f[_0x4380('0x4b')]['fields']));_0x12d94d['attributes']=_0x12d94d['attributes']['length']?_0x12d94d[_0x4380('0x4e')]:_0x1bbe76[_0x4380('0x4a')];if(!_0x9d897f[_0x4380('0x4b')]['hasOwnProperty']('nolimit')){_0x12d94d[_0x4380('0x32')]=qs[_0x4380('0x32')](_0x9d897f[_0x4380('0x4b')][_0x4380('0x32')]);_0x12d94d[_0x4380('0x31')]=qs[_0x4380('0x31')](_0x9d897f[_0x4380('0x4b')][_0x4380('0x31')]);}_0x12d94d['order']=qs[_0x4380('0x53')](_0x9d897f[_0x4380('0x4b')][_0x4380('0x53')]);_0x12d94d[_0x4380('0x54')]=qs[_0x4380('0x4d')](_[_0x4380('0x55')](_0x9d897f[_0x4380('0x4b')],_0x1bbe76[_0x4380('0x4d')]));_0x12d94d[_0x4380('0x54')][_0x4380('0x64')]=_0x2e5b11['id'];if(_0x9d897f[_0x4380('0x4b')][_0x4380('0x56')]){_0x12d94d[_0x4380('0x54')]=_['merge'](_0x12d94d[_0x4380('0x54')],{'$or':_[_0x4380('0x44')](_0x12d94d['attributes'],function(_0xdb2044){var _0x1aa305={};_0x1aa305[_0xdb2044]={'$like':'%'+_0x9d897f[_0x4380('0x4b')][_0x4380('0x56')]+'%'};return _0x1aa305;})});}_0x12d94d=_[_0x4380('0x57')]({},_0x12d94d,_0x9d897f[_0x4380('0x5d')]);return db['MailInteraction'][_0x4380('0x30')]({'where':_0x12d94d[_0x4380('0x54')]})[_0x4380('0x20')](function(_0x30b9e7){_0x3be565[_0x4380('0x30')]=_0x30b9e7;if(_0x9d897f[_0x4380('0x4b')][_0x4380('0x58')]){_0x12d94d[_0x4380('0x5c')]=[{'model':db[_0x4380('0x90')],'as':'Contact','required':![]},{'model':db[_0x4380('0x91')],'as':_0x4380('0x92'),'attributes':[_0x4380('0x3e'),_0x4380('0x93'),_0x4380('0x94')],'required':![]},{'model':db[_0x4380('0x95')],'as':'Tags','attributes':['id',_0x4380('0x3e'),_0x4380('0x96')],'where':_0x9d897f[_0x4380('0x4b')][_0x4380('0x97')]?{'id':_0x9d897f['query']['tag']}:undefined,'required':_0x9d897f[_0x4380('0x4b')]['tag']?!![]:![]}];}return db['MailInteraction'][_0x4380('0x59')](_0x12d94d);})['then'](function(_0x11ff8d){_0x3be565[_0x4380('0x69')]=_0x11ff8d;return _0x3be565;});}})[_0x4380('0x20')](respondWithFilteredResult(_0x1ebb55,_0x12d94d))[_0x4380('0x2b')](handleError(_0x1ebb55,null));};exports[_0x4380('0x98')]=function(_0x290529,_0x437352,_0x18957f){return db[_0x4380('0x45')][_0x4380('0x68')]({'where':{'id':_0x290529['params']['id']}})['then'](handleEntityNotFound(_0x437352,null))[_0x4380('0x20')](function(_0x3f7fe0){if(_0x3f7fe0){return db[_0x4380('0x99')][_0x4380('0x9a')](function(_0x562adf){return db[_0x4380('0x9b')][_0x4380('0x39')]({'where':{'MailAccountId':_0x290529[_0x4380('0x5a')]['id']},'transaction':_0x562adf})[_0x4380('0x20')](function(_0x4b1fb3){var _0xec4486=_[_0x4380('0x44')](_0x290529[_0x4380('0x5f')],function(_0x36b55f){_0x36b55f['MailAccountId']=_0x290529[_0x4380('0x5a')]['id'];return _0x36b55f;});return db[_0x4380('0x9b')][_0x4380('0x9c')](_0xec4486,{'transaction':_0x562adf});});})[_0x4380('0x20')](function(){return db[_0x4380('0x9b')][_0x4380('0x9d')]({'where':{'MailAccountId':_0x290529['params']['id']},'order':_0x4380('0x9e')});});}})['then'](respondWithResult(_0x437352,null))[_0x4380('0x2b')](handleError(_0x437352,null));};exports['getApplications']=function(_0xc22828,_0x5e8015,_0x23271b){var _0x5326d2={};var _0x5edf2c={};var _0x589c7f;var _0x45e096;return db[_0x4380('0x45')][_0x4380('0x68')]({'where':{'id':_0xc22828[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x5e8015,null))[_0x4380('0x20')](function(_0x2c1699){if(_0x2c1699){_0x589c7f=_0x2c1699;_0x5edf2c[_0x4380('0x4a')]=_[_0x4380('0x4c')](db[_0x4380('0x9b')][_0x4380('0x46')]);_0x5edf2c['query']=_['keys'](_0xc22828[_0x4380('0x4b')]);_0x5edf2c[_0x4380('0x4d')]=_[_0x4380('0x4f')](_0x5edf2c[_0x4380('0x4a')],_0x5edf2c['query']);_0x5326d2[_0x4380('0x4e')]=_[_0x4380('0x4f')](_0x5edf2c[_0x4380('0x4a')],qs[_0x4380('0x50')](_0xc22828[_0x4380('0x4b')][_0x4380('0x50')]));_0x5326d2['attributes']=_0x5326d2[_0x4380('0x4e')][_0x4380('0x51')]?_0x5326d2[_0x4380('0x4e')]:_0x5edf2c[_0x4380('0x4a')];_0x5326d2[_0x4380('0x6f')]=qs['sort'](_0xc22828[_0x4380('0x4b')][_0x4380('0x53')]);_0x5326d2[_0x4380('0x54')]=qs[_0x4380('0x4d')](_[_0x4380('0x55')](_0xc22828[_0x4380('0x4b')],_0x5edf2c['filters']));if(_0xc22828[_0x4380('0x4b')]['filter']){_0x5326d2[_0x4380('0x54')]=_['merge'](_0x5326d2[_0x4380('0x54')],{'$or':_[_0x4380('0x44')](_0x5326d2[_0x4380('0x4e')],function(_0x595c8d){var _0x2133ba={};_0x2133ba[_0x595c8d]={'$like':'%'+_0xc22828[_0x4380('0x4b')][_0x4380('0x56')]+'%'};return _0x2133ba;})});}_0x5326d2=_[_0x4380('0x57')]({},_0x5326d2,_0xc22828[_0x4380('0x5d')]);return _0x589c7f['getApplications'](_0x5326d2);}})[_0x4380('0x20')](function(_0x4a1cbd){if(_0x4a1cbd){_0x45e096=_0x4a1cbd[_0x4380('0x51')];if(!_0xc22828[_0x4380('0x4b')][_0x4380('0x52')](_0x4380('0x6e'))){_0x5326d2[_0x4380('0x32')]=qs[_0x4380('0x32')](_0xc22828[_0x4380('0x4b')][_0x4380('0x32')]);_0x5326d2[_0x4380('0x31')]=qs[_0x4380('0x31')](_0xc22828[_0x4380('0x4b')][_0x4380('0x31')]);}return _0x589c7f[_0x4380('0x9f')](_0x5326d2);}})[_0x4380('0x20')](function(_0x369f97){if(_0x369f97){return _0x369f97?{'count':_0x45e096,'rows':_0x369f97}:null;}})[_0x4380('0x20')](respondWithResult(_0x5e8015,null))[_0x4380('0x2b')](handleError(_0x5e8015,null));};exports[_0x4380('0xa0')]=function(_0x33493c,_0x4719a0,_0x8e5d8f){var _0x2bbf69={'raw':!![],'where':{}};var _0xa775b3={};var _0x42cefd={'count':0x0,'rows':[]};return db['MailAccount'][_0x4380('0x68')]({'where':{'id':_0x33493c[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x4719a0,null))[_0x4380('0x20')](function(_0x188ab0){if(_0x188ab0){_0xa775b3[_0x4380('0x4a')]=_[_0x4380('0x4c')](db[_0x4380('0xa1')][_0x4380('0x46')]);_0xa775b3['query']=_['keys'](_0x33493c['query']);_0xa775b3[_0x4380('0x4d')]=_[_0x4380('0x4f')](_0xa775b3[_0x4380('0x4a')],_0xa775b3[_0x4380('0x4b')]);_0x2bbf69[_0x4380('0x4e')]=_[_0x4380('0x4f')](_0xa775b3[_0x4380('0x4a')],qs[_0x4380('0x50')](_0x33493c[_0x4380('0x4b')]['fields']));_0x2bbf69[_0x4380('0x4e')]=_0x2bbf69[_0x4380('0x4e')][_0x4380('0x51')]?_0x2bbf69[_0x4380('0x4e')]:_0xa775b3['model'];if(!_0x33493c[_0x4380('0x4b')][_0x4380('0x52')](_0x4380('0x6e'))){_0x2bbf69[_0x4380('0x32')]=qs[_0x4380('0x32')](_0x33493c[_0x4380('0x4b')][_0x4380('0x32')]);_0x2bbf69['offset']=qs[_0x4380('0x31')](_0x33493c[_0x4380('0x4b')][_0x4380('0x31')]);}_0x2bbf69[_0x4380('0x6f')]=qs[_0x4380('0x53')](_0x33493c['query']['sort']);_0x2bbf69[_0x4380('0x54')]=qs[_0x4380('0x4d')](_[_0x4380('0x55')](_0x33493c[_0x4380('0x4b')],_0xa775b3[_0x4380('0x4d')]));_0x2bbf69[_0x4380('0x54')][_0x4380('0x64')]=_0x188ab0['id'];if(_0x33493c[_0x4380('0x4b')]['filter']){_0x2bbf69['where']=_[_0x4380('0x57')](_0x2bbf69[_0x4380('0x54')],{'$or':_['map'](_0x2bbf69[_0x4380('0x4e')],function(_0x4ab3f6){var _0x5465d1={};_0x5465d1[_0x4ab3f6]={'$like':'%'+_0x33493c[_0x4380('0x4b')][_0x4380('0x56')]+'%'};return _0x5465d1;})});}if(_0x33493c[_0x4380('0x4b')][_0x4380('0xa2')]){var _0x4786e9=_0x33493c[_0x4380('0x4b')][_0x4380('0xa2')][_0x4380('0xa3')](',');var _0x1a72f6={};_0x1a72f6[_0x4786e9[0x0]]={'$gte':moment(_0x4786e9[0x1])[_0x4380('0xa4')](_0x4380('0xa5'))};_0x2bbf69[_0x4380('0x54')]=_[_0x4380('0x57')](_0x2bbf69['where'],_0x1a72f6);}_0x2bbf69=_[_0x4380('0x57')]({},_0x2bbf69,_0x33493c['options']);return db[_0x4380('0xa1')][_0x4380('0x30')]({'where':_0x2bbf69[_0x4380('0x54')]})['then'](function(_0x4978d1){_0x42cefd[_0x4380('0x30')]=_0x4978d1;if(_0x33493c[_0x4380('0x4b')][_0x4380('0x58')]){_0x2bbf69[_0x4380('0x5c')]=[{'all':!![]}];}return db['MailMessage'][_0x4380('0x59')](_0x2bbf69);})[_0x4380('0x20')](function(_0x405e61){_0x42cefd[_0x4380('0x69')]=_0x405e61;return _0x42cefd;});}})['then'](respondWithFilteredResult(_0x4719a0,_0x2bbf69))[_0x4380('0x2b')](handleError(_0x4719a0,null));};exports[_0x4380('0x3f')]=function(_0x43d5e0,_0x278bd2,_0x2ce365){var _0x15bce6,_0xdd271={},_0x53640f;if(_0x43d5e0[_0x4380('0x5f')]['to']){_0x53640f=_0x43d5e0['body']['to'][_0x4380('0xa3')](',')[0x0];}return db['MailAccount'][_0x4380('0x5e')]({'where':{'id':_0x43d5e0[_0x4380('0x5a')]['id']},'include':[{'model':db[_0x4380('0xa6')],'as':_0x4380('0xa7'),'include':[{'model':db[_0x4380('0x90')],'as':_0x4380('0xa8'),'where':{'email':_0x53640f},'limit':0x1,'order':[[_0x4380('0xa9'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x4380('0x42'),'raw':!![]}]})[_0x4380('0x20')](handleEntityNotFound(_0x278bd2,null))['then'](function(_0x3f1293){if(_0x3f1293){_0x15bce6=_0x3f1293;if(_0x3f1293[_0x4380('0x42')]){if(_[_0x4380('0x74')](_0x43d5e0['body']['from'])){_0x43d5e0['body'][_0x4380('0xaa')]=util[_0x4380('0xa4')](_0x4380('0xab'),_0x3f1293[_0x4380('0x3e')],_0x3f1293[_0x4380('0x72')]||_0x3f1293['Smtp']['user']);}if(_0x43d5e0[_0x4380('0x5f')][_0x4380('0xac')]&&_0x43d5e0['body'][_0x4380('0xac')][_0x4380('0x51')]){for(var _0xb2bcd0=0x0;_0xb2bcd0<_0x43d5e0[_0x4380('0x5f')][_0x4380('0xac')][_0x4380('0x51')];_0xb2bcd0+=0x1){_0x43d5e0['body'][_0x4380('0xac')][_0xb2bcd0]={'filename':_0x43d5e0[_0x4380('0x5f')][_0x4380('0xac')][_0xb2bcd0][_0x4380('0x3e')],'path':path[_0x4380('0xad')](config['root'],_0x4380('0xae'),_0x43d5e0[_0x4380('0x5f')][_0x4380('0xac')][_0xb2bcd0]['basename'])};}}var _0x4c2ec0={'tls':{'rejectUnauthorized':![]}};if(_[_0x4380('0x74')](_0x3f1293[_0x4380('0x42')][_0x4380('0x80')])){if(_0x3f1293['Smtp'][_0x4380('0x7d')]){_0x4c2ec0['auth']={'user':_0x3f1293['Smtp'][_0x4380('0x78')],'pass':_0x3f1293[_0x4380('0x42')][_0x4380('0x7b')]};}_0x4c2ec0[_0x4380('0x7e')]=_0x3f1293[_0x4380('0x42')][_0x4380('0x7e')];_0x4c2ec0[_0x4380('0x7f')]=_0x3f1293[_0x4380('0x42')][_0x4380('0x7f')];_0x4c2ec0[_0x4380('0xaf')]=_0x3f1293['Smtp']['secure'];}else{_0x4c2ec0['service']=_0x3f1293['Smtp'][_0x4380('0x80')];_0x4c2ec0['auth']={'user':_0x3f1293[_0x4380('0x42')][_0x4380('0x78')],'pass':_0x3f1293[_0x4380('0x42')][_0x4380('0x7b')]};}return respondWithRpcPromise(_0x4380('0xb0'),_0x4380('0xb1'),{'account':_0x4c2ec0,'message':_0x43d5e0[_0x4380('0x5f')]});}else{throw new Error(_0x4380('0xb2'));}}})[_0x4380('0x20')](function(_0x1022bf){if(_0x1022bf){_0xdd271=_0x1022bf;if(_0x15bce6[_0x4380('0xa7')]){if(_0x15bce6[_0x4380('0xa7')][_0x4380('0xa8')]['length']){return _0x15bce6[_0x4380('0xa7')][_0x4380('0xa8')][0x0];}else{return db[_0x4380('0x90')][_0x4380('0x66')](_[_0x4380('0x17')](_0x43d5e0[_0x4380('0x5f')],{'firstName':_0x43d5e0[_0x4380('0x5f')]['to'],'email':_0x43d5e0[_0x4380('0x5f')]['to'],'phone':_0x43d5e0[_0x4380('0x5f')]['to'],'ListId':_0x15bce6[_0x4380('0x73')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0x4380('0x20')](function(_0x438a1f){if(_0x438a1f){var _0x4b6882={'UserId':_0x43d5e0[_0x4380('0x78')]['id'],'ContactId':_0x438a1f['id'],'MailAccountId':_0x15bce6['id'],'inReplyTo':_0xdd271[_0x4380('0xb3')],'to':_0x43d5e0['body'][_0x4380('0xaa')],'cc':_0x43d5e0[_0x4380('0x5f')]['cc'],'subject':_0x43d5e0[_0x4380('0x5f')][_0x4380('0xb4')],'attach':_0x43d5e0[_0x4380('0x5f')]['attach'],'firstMsgDirection':_0x4380('0xb5'),'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x4380('0xb5'),'lastMsgBody':_0x43d5e0['body'][_0x4380('0x5f')],'Messages':[_['merge'](_0x43d5e0[_0x4380('0x5f')],{'messageId':_0xdd271[_0x4380('0xb3')],'sentAt':moment()[_0x4380('0xa4')](_0x4380('0xa5')),'read':!![],'MailAccountId':_0x15bce6['id'],'UserId':_0x43d5e0[_0x4380('0x78')]['id'],'ContactId':_0x438a1f['id']})]};if(_0x43d5e0['body'][_0x4380('0xb6')]){_0x4b6882=_[_0x4380('0x57')](_0x4b6882,_0x43d5e0['body'][_0x4380('0xb6')]);}return db[_0x4380('0x8e')]['create'](_0x4b6882,{'include':[{'model':db[_0x4380('0xa1')],'as':_0x4380('0xb7')}]});}})[_0x4380('0x20')](respondWithResult(_0x278bd2,null))[_0x4380('0x2b')](handleError(_0x278bd2,null));};exports[_0x4380('0xb8')]=function(_0x49ae68,_0x31eb98,_0x158edc){return db[_0x4380('0x45')]['find']({'where':{'id':_0x49ae68[_0x4380('0x5a')]['id']},'include':[{'model':db[_0x4380('0x60')],'as':_0x4380('0x42'),'raw':!![]}]})[_0x4380('0x20')](handleEntityNotFound(_0x31eb98,null))[_0x4380('0x20')](function(_0x5b78b0){if(_0x5b78b0&&_0x5b78b0[_0x4380('0x42')]){var _0x3edb88={'id':_0x5b78b0['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5b78b0[_0x4380('0x42')]['service']){_0x3edb88[_0x4380('0x80')]=_0x5b78b0[_0x4380('0x42')]['service'];}else{_0x3edb88[_0x4380('0x7e')]=_0x5b78b0[_0x4380('0x42')][_0x4380('0x7e')];_0x3edb88[_0x4380('0x7f')]=_0x5b78b0['Smtp'][_0x4380('0x7f')];_0x3edb88['secure']=_0x5b78b0['Smtp'][_0x4380('0xaf')];}if(_0x5b78b0['Smtp'][_0x4380('0x7d')]){_0x3edb88[_0x4380('0xb9')]={'user':_0x5b78b0[_0x4380('0x42')]['user'],'pass':_0x5b78b0['Smtp'][_0x4380('0x7b')]};}return respondWithRpcPromise(_0x4380('0xba'),_0x4380('0xb8'),{'account':_0x3edb88});}})[_0x4380('0x20')](respondWithResult(_0x31eb98,null))[_0x4380('0x2b')](handleError(_0x31eb98,null));};exports['destroy']=function(_0x36f44a,_0x15294c){return db[_0x4380('0x45')][_0x4380('0x5e')]({'where':{'id':_0x36f44a[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x15294c,null))[_0x4380('0x20')](function(_0xa1006e){if(_0xa1006e&&_0xa1006e['service']){throw new db[(_0x4380('0x1e'))][(_0x4380('0xbb'))](_0x4380('0xbc'));}return _0xa1006e;})[_0x4380('0x20')](removeEntity(_0x15294c,null))[_0x4380('0x2b')](handleError(_0x15294c,null));};exports[_0x4380('0xbd')]=function(_0x4936e7,_0x441213,_0x5a58ea){return db[_0x4380('0x45')]['find']({'where':{'id':_0x4936e7['params']['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x441213,null))['then'](function(_0x39c4c3){if(_0x39c4c3){return _0x39c4c3[_0x4380('0xbd')](_0x4936e7['body'][_0x4380('0x71')],_[_0x4380('0xbe')](_0x4936e7[_0x4380('0x5f')],['ids','id'])||{})[_0x4380('0xbf')](function(_0x371d54){for(var _0x31d269=0x0;_0x31d269<_0x4936e7[_0x4380('0x5f')][_0x4380('0x71')]['length'];_0x31d269+=0x1){socket['emit'](_0x4380('0xc0'),{'UserId':_0x4936e7[_0x4380('0x5f')]['ids'][_0x31d269],'MailAccountId':_0x4936e7[_0x4380('0x5a')]['id']});}return _0x371d54;});}})[_0x4380('0x20')](respondWithResult(_0x441213,null))[_0x4380('0x2b')](handleError(_0x441213,null));};exports[_0x4380('0xc1')]=function(_0x275b17,_0x46d69f,_0x48af5c){return db[_0x4380('0x45')][_0x4380('0x5e')]({'where':{'id':_0x275b17['params']['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x46d69f,null))['then'](function(_0x20310f){if(_0x20310f){return _0x20310f['removeAgents'](_0x275b17[_0x4380('0x4b')][_0x4380('0x71')])[_0x4380('0x20')](function(){if(_[_0x4380('0xc2')](_0x275b17['query'][_0x4380('0x71')])){for(var _0x33c3c9=0x0;_0x33c3c9<_0x275b17[_0x4380('0x4b')][_0x4380('0x71')][_0x4380('0x51')];_0x33c3c9+=0x1){socket[_0x4380('0xc3')]('userMailAccount:remove',{'UserId':Number(_0x275b17[_0x4380('0x4b')][_0x4380('0x71')][_0x33c3c9]),'MailAccountId':Number(_0x275b17[_0x4380('0x5a')]['id'])});}}else{socket[_0x4380('0xc3')]('userMailAccount:remove',{'UserId':Number(_0x275b17['query']['ids']),'MailAccountId':Number(_0x275b17[_0x4380('0x5a')]['id'])});}});}})[_0x4380('0x20')](respondWithStatusCode(_0x46d69f,null))[_0x4380('0x2b')](handleError(_0x46d69f,null));};exports[_0x4380('0xc4')]=function(_0x23a726,_0x1bcb79,_0x176f52){var _0x4c5748={};var _0x28b845={};var _0x4bd2ac;var _0x58ac79;return db[_0x4380('0x45')][_0x4380('0x68')]({'where':{'id':_0x23a726[_0x4380('0x5a')]['id']}})[_0x4380('0x20')](handleEntityNotFound(_0x1bcb79,null))[_0x4380('0x20')](function(_0x5cc371){if(_0x5cc371){_0x4bd2ac=_0x5cc371;_0x28b845['model']=_[_0x4380('0x4c')](db['User'][_0x4380('0x46')]);_0x28b845[_0x4380('0x4b')]=_[_0x4380('0x4c')](_0x23a726[_0x4380('0x4b')]);_0x28b845[_0x4380('0x4d')]=_[_0x4380('0x4f')](_0x28b845[_0x4380('0x4a')],_0x28b845['query']);_0x4c5748[_0x4380('0x4e')]=_[_0x4380('0x4f')](_0x28b845[_0x4380('0x4a')],qs[_0x4380('0x50')](_0x23a726[_0x4380('0x4b')][_0x4380('0x50')]));_0x4c5748[_0x4380('0x4e')]=_0x4c5748[_0x4380('0x4e')][_0x4380('0x51')]?_0x4c5748[_0x4380('0x4e')]:_0x28b845['model'];_0x4c5748[_0x4380('0x6f')]=qs['sort'](_0x23a726[_0x4380('0x4b')]['sort']);_0x4c5748[_0x4380('0x54')]=qs['filters'](_[_0x4380('0x55')](_0x23a726[_0x4380('0x4b')],_0x28b845[_0x4380('0x4d')]));if(_0x23a726[_0x4380('0x4b')][_0x4380('0x56')]){_0x4c5748[_0x4380('0x54')]=_[_0x4380('0x57')](_0x4c5748['where'],{'$or':_[_0x4380('0x44')](_0x4c5748[_0x4380('0x4e')],function(_0x2da06c){var _0x56f073={};_0x56f073[_0x2da06c]={'$like':'%'+_0x23a726[_0x4380('0x4b')][_0x4380('0x56')]+'%'};return _0x56f073;})});}_0x4c5748=_[_0x4380('0x57')]({},_0x4c5748,_0x23a726[_0x4380('0x5d')]);return _0x4bd2ac['getAgents'](_0x4c5748);}})[_0x4380('0x20')](function(_0x3015c2){if(_0x3015c2){_0x58ac79=_0x3015c2[_0x4380('0x51')];if(!_0x23a726['query'][_0x4380('0x52')](_0x4380('0x6e'))){_0x4c5748['limit']=qs[_0x4380('0x32')](_0x23a726[_0x4380('0x4b')][_0x4380('0x32')]);_0x4c5748[_0x4380('0x31')]=qs['offset'](_0x23a726[_0x4380('0x4b')]['offset']);}return _0x4bd2ac['getAgents'](_0x4c5748);}})['then'](function(_0x17a514){if(_0x17a514){return _0x17a514?{'count':_0x58ac79,'rows':_0x17a514}:null;}})[_0x4380('0x20')](respondWithResult(_0x1bcb79,null))[_0x4380('0x2b')](handleError(_0x1bcb79,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index a6da3fe..d1cb938 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 _0x12a7=['../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x2afe4b,_0x2852f7){var _0x2523cb=function(_0xf8bedc){while(--_0xf8bedc){_0x2afe4b['push'](_0x2afe4b['shift']());}};_0x2523cb(++_0x2852f7);}(_0x12a7,0xd0));var _0x712a=function(_0x16cd67,_0x3d328c){_0x16cd67=_0x16cd67-0x0;var _0x3909cb=_0x12a7[_0x16cd67];return _0x3909cb;};'use strict';var EventEmitter=require(_0x712a('0x0'));var MailAccount=require(_0x712a('0x1'))['db'][_0x712a('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x712a('0x3')](0x0);var events={'afterCreate':_0x712a('0x4'),'afterUpdate':_0x712a('0x5'),'afterDestroy':_0x712a('0x6')};function emitEvent(_0x2b28ee){return function(_0x333dae,_0x13a82f,_0x4c9e9f){MailAccountEvents['emit'](_0x2b28ee+':'+_0x333dae['id'],_0x333dae);MailAccountEvents[_0x712a('0x7')](_0x2b28ee,_0x333dae);_0x4c9e9f(null);};}for(var e in events){if(events[_0x712a('0x8')](e)){var event=events[e];MailAccount[_0x712a('0x9')](e,emitEvent(event));}}module[_0x712a('0xa')]=MailAccountEvents; \ No newline at end of file +var _0xb6f5=['update','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x3b0b2c,_0x548b67){var _0x12d357=function(_0x3e8a1c){while(--_0x3e8a1c){_0x3b0b2c['push'](_0x3b0b2c['shift']());}};_0x12d357(++_0x548b67);}(_0xb6f5,0x10e));var _0x5b6f=function(_0x27714d,_0x457b53){_0x27714d=_0x27714d-0x0;var _0x18e2fb=_0xb6f5[_0x27714d];return _0x18e2fb;};'use strict';var EventEmitter=require(_0x5b6f('0x0'));var MailAccount=require(_0x5b6f('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x5b6f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5b6f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3857ac){return function(_0x365e9a,_0x514bfc,_0x4b4dd2){MailAccountEvents['emit'](_0x3857ac+':'+_0x365e9a['id'],_0x365e9a);MailAccountEvents[_0x5b6f('0x4')](_0x3857ac,_0x365e9a);_0x4b4dd2(null);};}for(var e in events){if(events[_0x5b6f('0x5')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x5b6f('0x6')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 62117e7..08062f5 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 _0x0975=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','MailAccount','mail_accounts'];(function(_0x2a3f89,_0x3b2791){var _0x464f94=function(_0x22768a){while(--_0x22768a){_0x2a3f89['push'](_0x2a3f89['shift']());}};_0x464f94(++_0x3b2791);}(_0x0975,0xf0));var _0x5097=function(_0x2e6ae7,_0x354abf){_0x2e6ae7=_0x2e6ae7-0x0;var _0x219240=_0x0975[_0x2e6ae7];return _0x219240;};'use strict';var _=require(_0x5097('0x0'));var util=require(_0x5097('0x1'));var logger=require(_0x5097('0x2'))(_0x5097('0x3'));var moment=require('moment');var BPromise=require(_0x5097('0x4'));var rp=require(_0x5097('0x5'));var fs=require('fs');var path=require(_0x5097('0x6'));var rimraf=require(_0x5097('0x7'));var config=require(_0x5097('0x8'));var attributes=require('./mailAccount.attributes');module['exports']=function(_0x67e98e,_0x3dcc35){return _0x67e98e[_0x5097('0x9')](_0x5097('0xa'),attributes,{'tableName':_0x5097('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00c5=['MailAccount','mail_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define'];(function(_0x1b8c71,_0x41d8ab){var _0x539905=function(_0x395edd){while(--_0x395edd){_0x1b8c71['push'](_0x1b8c71['shift']());}};_0x539905(++_0x41d8ab);}(_0x00c5,0x8e));var _0x500c=function(_0x1b2618,_0x44a931){_0x1b2618=_0x1b2618-0x0;var _0x58cd7b=_0x00c5[_0x1b2618];return _0x58cd7b;};'use strict';var _=require(_0x500c('0x0'));var util=require('util');var logger=require(_0x500c('0x1'))(_0x500c('0x2'));var moment=require(_0x500c('0x3'));var BPromise=require(_0x500c('0x4'));var rp=require(_0x500c('0x5'));var fs=require('fs');var path=require(_0x500c('0x6'));var rimraf=require(_0x500c('0x7'));var config=require(_0x500c('0x8'));var attributes=require(_0x500c('0x9'));module[_0x500c('0xa')]=function(_0x3edbc4,_0x169c9d){return _0x3edbc4[_0x500c('0xb')](_0x500c('0xc'),attributes,{'tableName':_0x500c('0xd'),'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 0bf307a..804e68a 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 _0xe148=['CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','Contacts','DESC','MailApplication','MailServerOut','Smtp','List','omit','applications','list','orderBy','priority','autoclose','length','*,*,*,*','Applications','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','update','get','create','attachments','originTo','originCc','Attachment','Attachments','UserId','User','interaction','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','then','info','MailAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailAccount','findAll','options','raw','where','attributes','include','map','model','GetMailAccount','ShowMailAccount','find','body','difference'];(function(_0x57d9d1,_0x485551){var _0x108ba3=function(_0x3341b6){while(--_0x3341b6){_0x57d9d1['push'](_0x57d9d1['shift']());}};_0x108ba3(++_0x485551);}(_0xe148,0x9e));var _0x8e14=function(_0x3ef4f1,_0x5f0f9b){_0x3ef4f1=_0x3ef4f1-0x0;var _0x69953c=_0xe148[_0x3ef4f1];return _0x69953c;};'use strict';var _=require(_0x8e14('0x0'));var util=require(_0x8e14('0x1'));var moment=require('moment');var BPromise=require(_0x8e14('0x2'));var rs=require(_0x8e14('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8e14('0x4'))['db'];var utils=require(_0x8e14('0x5'));var logger=require(_0x8e14('0x6'))(_0x8e14('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8e14('0x8')][_0x8e14('0x9')]({'port':0x232c});config['redis']=_[_0x8e14('0xa')](config[_0x8e14('0xb')],{'host':_0x8e14('0xc'),'port':0x18eb});var socket=require(_0x8e14('0xd'))(new Redis(config['redis']));require(_0x8e14('0xe'))['register'](socket);function respondWithRpcPromise(_0x46abf4,_0x2587a1,_0x491a46){return new BPromise(function(_0x9a0381,_0x5e0763){return client['request'](_0x46abf4,_0x491a46)[_0x8e14('0xf')](function(_0x48554a){logger[_0x8e14('0x10')](_0x8e14('0x11'),_0x2587a1,'request\x20sent');logger[_0x8e14('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x2587a1,'request\x20sent',JSON[_0x8e14('0x13')](_0x48554a));if(_0x48554a['error']){if(_0x48554a[_0x8e14('0x14')][_0x8e14('0x15')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x2587a1,_0x48554a[_0x8e14('0x14')][_0x8e14('0x16')]);return _0x5e0763(_0x48554a[_0x8e14('0x14')][_0x8e14('0x16')]);}logger[_0x8e14('0x14')]('MailAccount,\x20%s,\x20%s',_0x2587a1,_0x48554a[_0x8e14('0x14')][_0x8e14('0x16')]);return _0x9a0381(_0x48554a['error'][_0x8e14('0x16')]);}else{logger[_0x8e14('0x10')](_0x8e14('0x11'),_0x2587a1,_0x8e14('0x17'));_0x9a0381(_0x48554a[_0x8e14('0x18')][_0x8e14('0x16')]);}})[_0x8e14('0x19')](function(_0x2b1ee1){logger[_0x8e14('0x14')](_0x8e14('0x11'),_0x2587a1,_0x2b1ee1);_0x5e0763(_0x2b1ee1);});});}exports['GetMailAccount']=function(_0x22cad2){var _0x3ea1df=this;return new Promise(function(_0x5517c9,_0x13587d){return db[_0x8e14('0x1a')][_0x8e14('0x1b')]({'raw':_0x22cad2['options']?_0x22cad2[_0x8e14('0x1c')][_0x8e14('0x1d')]===undefined?!![]:![]:!![],'where':_0x22cad2[_0x8e14('0x1c')]?_0x22cad2['options'][_0x8e14('0x1e')]||null:null,'attributes':_0x22cad2[_0x8e14('0x1c')]?_0x22cad2['options'][_0x8e14('0x1f')]||null:null,'limit':_0x22cad2[_0x8e14('0x1c')]?_0x22cad2[_0x8e14('0x1c')]['limit']||null:null,'include':_0x22cad2[_0x8e14('0x1c')]?_0x22cad2[_0x8e14('0x1c')][_0x8e14('0x20')]?_[_0x8e14('0x21')](_0x22cad2['options'][_0x8e14('0x20')],function(_0x5b4af3){return{'model':db[_0x5b4af3['model']],'as':_0x5b4af3['as'],'attributes':_0x5b4af3[_0x8e14('0x1f')],'include':_0x5b4af3[_0x8e14('0x20')]?_[_0x8e14('0x21')](_0x5b4af3['include'],function(_0x3e68f5){return{'model':db[_0x3e68f5[_0x8e14('0x22')]],'as':_0x3e68f5['as'],'attributes':_0x3e68f5[_0x8e14('0x1f')],'include':_0x3e68f5[_0x8e14('0x20')]?_['map'](_0x3e68f5['include'],function(_0x2d88db){return{'model':db[_0x2d88db[_0x8e14('0x22')]],'as':_0x2d88db['as'],'attributes':_0x2d88db[_0x8e14('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8e14('0xf')](function(_0x292f44){logger[_0x8e14('0x10')](_0x8e14('0x23'),_0x22cad2);logger['debug'](_0x8e14('0x23'),_0x22cad2,JSON[_0x8e14('0x13')](_0x292f44));_0x5517c9(_0x292f44);})[_0x8e14('0x19')](function(_0x179e3b){logger['error'](_0x8e14('0x23'),_0x179e3b[_0x8e14('0x16')],_0x22cad2);_0x13587d(_0x3ea1df[_0x8e14('0x14')](0x1f4,_0x179e3b[_0x8e14('0x16')]));});});};exports[_0x8e14('0x24')]=function(_0x2a0729){var _0x14ca1d=this;return new Promise(function(_0x915a4d,_0x29cea2){return db[_0x8e14('0x1a')][_0x8e14('0x25')]({'raw':_0x2a0729['options']?_0x2a0729[_0x8e14('0x1c')][_0x8e14('0x1d')]===undefined?!![]:![]:!![],'where':_0x2a0729[_0x8e14('0x1c')]?_0x2a0729['options']['where']||null:null,'attributes':_0x2a0729[_0x8e14('0x1c')]?_0x2a0729[_0x8e14('0x1c')]['attributes']||null:null,'include':_0x2a0729[_0x8e14('0x1c')]?_0x2a0729[_0x8e14('0x1c')]['include']?_[_0x8e14('0x21')](_0x2a0729['options'][_0x8e14('0x20')],function(_0xa71666){return{'model':db[_0xa71666[_0x8e14('0x22')]],'as':_0xa71666['as'],'attributes':_0xa71666[_0x8e14('0x1f')],'include':_0xa71666['include']?_[_0x8e14('0x21')](_0xa71666[_0x8e14('0x20')],function(_0x28e3b1){return{'model':db[_0x28e3b1['model']],'as':_0x28e3b1['as'],'attributes':_0x28e3b1[_0x8e14('0x1f')],'include':_0x28e3b1[_0x8e14('0x20')]?_[_0x8e14('0x21')](_0x28e3b1['include'],function(_0x3d1558){return{'model':db[_0x3d1558[_0x8e14('0x22')]],'as':_0x3d1558['as'],'attributes':_0x3d1558[_0x8e14('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8e14('0xf')](function(_0x57b111){logger[_0x8e14('0x10')](_0x8e14('0x24'),_0x2a0729);logger['debug'](_0x8e14('0x24'),_0x2a0729,JSON[_0x8e14('0x13')](_0x57b111));_0x915a4d(_0x57b111);})[_0x8e14('0x19')](function(_0x12164e){logger[_0x8e14('0x14')](_0x8e14('0x24'),_0x12164e[_0x8e14('0x16')],_0x2a0729);_0x29cea2(_0x14ca1d[_0x8e14('0x14')](0x1f4,_0x12164e['message']));});});};exports['NotifyMailAccount']=function(_0x531e19){var _0x402d78=this;return new Promise(function(_0x5dea52,_0x4704ff){var _0x3b5acd={'body':_0x531e19[_0x8e14('0x26')],'channel':'mail'};var _0x194718=_[_0x8e14('0x27')](_['keys'](db[_0x8e14('0x28')][_0x8e14('0x29')]),[_0x8e14('0x2a'),_0x8e14('0x2b'),_0x8e14('0x2c'),_0x8e14('0x2d')]);var _0x27f025=![];if(_0x531e19[_0x8e14('0x26')]['id']){delete _0x531e19[_0x8e14('0x26')]['id'];}if(_[_0x8e14('0x2e')](_0x531e19['body'][_0x8e14('0x2f')])){return _0x4704ff(_0x402d78['error'](0x1f4,_0x8e14('0x30')));}if(_['isNil'](_0x531e19[_0x8e14('0x26')][_0x8e14('0x26')])||_0x531e19[_0x8e14('0x26')]['body']===''){return _0x4704ff(_0x402d78[_0x8e14('0x14')](0x1f4,_0x8e14('0x31')));}if(_['isNil'](_0x531e19[_0x8e14('0x26')][_0x8e14('0x32')])){return _0x4704ff(_0x402d78['error'](0x1f4,_0x8e14('0x33')+_0x194718));}if(!_[_0x8e14('0x34')](_0x194718,_0x531e19[_0x8e14('0x26')]['mapKey'])){return _0x4704ff(_0x402d78[_0x8e14('0x14')](0x1f4,_0x8e14('0x35')+_0x194718));}var _0x979788={};_0x979788[_0x531e19[_0x8e14('0x26')][_0x8e14('0x32')]]=_0x531e19[_0x8e14('0x26')][_0x8e14('0x2f')];return db[_0x8e14('0x1a')]['find']({'where':{'id':_0x531e19[_0x8e14('0x36')]['id']},'include':[{'model':db[_0x8e14('0x37')],'as':'List','include':[{'model':db[_0x8e14('0x28')],'as':_0x8e14('0x38'),'where':_0x979788,'limit':0x1,'order':[[_0x8e14('0x2b'),_0x8e14('0x39')]]}]},{'model':db[_0x8e14('0x3a')],'as':'Applications'},{'model':db[_0x8e14('0x3b')],'as':_0x8e14('0x3c')}]})[_0x8e14('0xf')](function(_0x5eb7ba){if(_0x5eb7ba&&_0x5eb7ba[_0x8e14('0x3d')]){var _0x1c4850=_0x5eb7ba['get']({'plain':!![]});_0x3b5acd[_0x8e14('0x36')]=_[_0x8e14('0x3e')](_0x1c4850,['Applications',_0x8e14('0x3d')]);_0x3b5acd[_0x8e14('0x3f')]=_0x1c4850['Applications'];_0x3b5acd[_0x8e14('0x40')]=_0x1c4850[_0x8e14('0x3d')];_0x3b5acd[_0x8e14('0x3f')]=_[_0x8e14('0x41')](_0x3b5acd['applications'],[_0x8e14('0x42')],['asc']);if(_0x3b5acd[_0x8e14('0x36')]&&_0x3b5acd[_0x8e14('0x36')][_0x8e14('0x43')]){_0x3b5acd[_0x8e14('0x3f')]['push']({'id':0x0,'priority':_0x3b5acd[_0x8e14('0x3f')][_0x8e14('0x44')]+0x1,'app':'close','appdata':'autoclose','interval':_0x8e14('0x45')});}if(_0x3b5acd[_0x8e14('0x36')]['Applications']){delete _0x3b5acd['account'][_0x8e14('0x46')];}if(_0x3b5acd[_0x8e14('0x36')][_0x8e14('0x3d')]){delete _0x3b5acd[_0x8e14('0x36')][_0x8e14('0x3d')];}if(_0x1c4850[_0x8e14('0x3d')][_0x8e14('0x38')]['length']){return _0x1c4850[_0x8e14('0x3d')][_0x8e14('0x38')][0x0];}var _0x2ea578=_[_0x8e14('0xa')](_0x531e19['body'],{'firstName':_0x531e19[_0x8e14('0x26')]['from'],'ListId':_0x1c4850[_0x8e14('0x2d')]});_0x2ea578[_0x531e19[_0x8e14('0x26')]['mapKey']]=_0x531e19[_0x8e14('0x26')]['from'];return db[_0x8e14('0x28')]['create'](_0x2ea578);}else{throw new Error(_0x8e14('0x47'));}})[_0x8e14('0xf')](function(_0x11f053){_0x3b5acd[_0x8e14('0x48')]=_0x11f053;if(_0x11f053){if(!_0x531e19[_0x8e14('0x26')][_0x8e14('0x16')][_0x8e14('0x49')]){_0x531e19[_0x8e14('0x26')][_0x8e14('0x16')][_0x8e14('0x49')]=rs[_0x8e14('0x4a')]()+'\x20'+_0x531e19[_0x8e14('0x26')]['message'][_0x8e14('0x2f')];}var _0x3bd9e2={'ContactId':_0x11f053['id'],'MailAccountId':_0x531e19[_0x8e14('0x36')]['id'],'inReplyTo':_0x531e19[_0x8e14('0x26')]['message'][_0x8e14('0x49')],'to':_0x531e19[_0x8e14('0x26')]['message'][_0x8e14('0x2f')],'cc':_0x531e19['body'][_0x8e14('0x16')]['cc'],'subject':_0x531e19[_0x8e14('0x26')][_0x8e14('0x16')][_0x8e14('0x4b')],'attach':_0x531e19[_0x8e14('0x26')][_0x8e14('0x16')][_0x8e14('0x4c')],'lastMsgAt':moment()[_0x8e14('0x4d')](_0x8e14('0x4e')),'lastMsgDirection':'in','lastMsgBody':_0x531e19[_0x8e14('0x26')]['body']};return db[_0x8e14('0x4f')][_0x8e14('0x25')]({'where':{'closed':![],'MailAccountId':_0x531e19[_0x8e14('0x36')]['id']},'include':[{'model':db[_0x8e14('0x50')],'as':_0x8e14('0x51'),'attributes':[_0x8e14('0x49')],'where':{'messageId':_0x531e19[_0x8e14('0x26')][_0x8e14('0x16')][_0x8e14('0x52')]}}]})[_0x8e14('0xf')](function(_0x173e68){if(_0x173e68){return[_0x173e68,![]];}return db[_0x8e14('0x4f')]['create'](_0x3bd9e2)['then'](function(_0x257c0c){return[_0x257c0c,!![]];});});}else{throw new Error(_0x8e14('0x53'));}})['spread'](function(_0x2a7e1e,_0x5542b0){if(_0x2a7e1e){_0x27f025=_0x5542b0;if(!_0x5542b0){return _0x2a7e1e[_0x8e14('0x54')]({'inReplyTo':_0x531e19[_0x8e14('0x26')][_0x8e14('0x16')][_0x8e14('0x49')],'to':_0x531e19[_0x8e14('0x26')][_0x8e14('0x16')]['from'],'cc':_0x531e19[_0x8e14('0x26')][_0x8e14('0x16')]['cc'],'subject':_0x531e19[_0x8e14('0x26')][_0x8e14('0x16')][_0x8e14('0x4b')],'attach':_0x2a7e1e['attach']?_0x2a7e1e[_0x8e14('0x4c')]:_0x531e19[_0x8e14('0x26')][_0x8e14('0x16')][_0x8e14('0x4c')],'substatus':null,'substatusAt':moment()[_0x8e14('0x4d')](_0x8e14('0x4e')),'lastMsgAt':moment()[_0x8e14('0x4d')](_0x8e14('0x4e')),'lastMsgDirection':'in','lastMsgBody':_0x531e19[_0x8e14('0x26')][_0x8e14('0x26')]});}else{return _0x2a7e1e;}}})[_0x8e14('0xf')](function(_0x59ff0e){_0x3b5acd['interaction']=_0x59ff0e[_0x8e14('0x55')]({'plain':!![]});_0x3b5acd['interaction']['created']=_0x27f025;return db['MailMessage'][_0x8e14('0x56')]({'body':_0x531e19['body'][_0x8e14('0x26')],'MailAccountId':_0x531e19['account']['id'],'MailInteractionId':_0x59ff0e['id'],'direction':'in','ContactId':_0x3b5acd['contact']['id'],'messageId':_0x531e19[_0x8e14('0x26')][_0x8e14('0x16')][_0x8e14('0x49')],'from':_0x531e19[_0x8e14('0x26')][_0x8e14('0x16')][_0x8e14('0x2f')],'to':_0x531e19['body'][_0x8e14('0x16')]['to'],'cc':_0x531e19[_0x8e14('0x26')][_0x8e14('0x16')]['cc'],'subject':_0x531e19['body'][_0x8e14('0x16')][_0x8e14('0x4b')],'attach':_0x531e19[_0x8e14('0x26')][_0x8e14('0x16')][_0x8e14('0x4c')],'Attachments':_0x531e19[_0x8e14('0x26')][_0x8e14('0x16')][_0x8e14('0x57')],'originTo':_0x531e19[_0x8e14('0x26')]['message'][_0x8e14('0x58')],'originCc':_0x531e19[_0x8e14('0x26')][_0x8e14('0x16')][_0x8e14('0x59')],'bcc':_0x531e19[_0x8e14('0x26')][_0x8e14('0x16')]['bcc']},{'include':[{'model':db[_0x8e14('0x5a')],'as':_0x8e14('0x5b')}]});})[_0x8e14('0xf')](function(_0x52b571){_0x3b5acd['message']=_0x52b571;if(_0x3b5acd['interaction'][_0x8e14('0x5c')]){return db[_0x8e14('0x5d')][_0x8e14('0x25')]({'attributes':['id','name'],'where':{'id':_0x3b5acd[_0x8e14('0x5e')][_0x8e14('0x5c')]}})[_0x8e14('0xf')](function(_0x1bc2f0){if(_0x1bc2f0){_0x3b5acd[_0x8e14('0x3f')]['unshift']({'id':0x0,'priority':0x0,'app':_0x8e14('0x5f'),'appdata':_0x1bc2f0['name']+','+(_0x3b5acd[_0x8e14('0x36')][_0x8e14('0x60')]||0xa),'interval':_0x8e14('0x45')});}return respondWithRpcPromise(_0x8e14('0x61'),_0x8e14('0x62'),_0x3b5acd);});}return respondWithRpcPromise('Start','startRouting',_0x3b5acd);})[_0x8e14('0xf')](function(_0x1f0994){_0x5dea52(_0x1f0994);})['catch'](function(_0x3a4f85){_0x4704ff(_0x402d78[_0x8e14('0x14')](0x1f4,_0x3a4f85[_0x8e14('0x16')]));});});}; \ No newline at end of file +var _0xa62c=['contact','originTo','originCc','bcc','Attachment','Attachments','UserId','name','unshift','agent','waitForTheAssignedAgent','startRouting','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetMailAccount','MailAccount','raw','options','where','attributes','include','map','model','ShowMailAccount','find','NotifyMailAccount','body','difference','keys','CmContact','createdAt','updatedAt','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','applications','orderBy','priority','account','autoclose','push','length','close','*,*,*,*','ListId','create','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','update','attach','interaction'];(function(_0x2dc725,_0x42ea65){var _0x173e5f=function(_0x26c2aa){while(--_0x26c2aa){_0x2dc725['push'](_0x2dc725['shift']());}};_0x173e5f(++_0x42ea65);}(_0xa62c,0x70));var _0xca62=function(_0x29c261,_0x3af39a){_0x29c261=_0x29c261-0x0;var _0x1a9335=_0xa62c[_0x29c261];return _0x1a9335;};'use strict';var _=require(_0xca62('0x0'));var util=require(_0xca62('0x1'));var moment=require(_0xca62('0x2'));var BPromise=require(_0xca62('0x3'));var rs=require(_0xca62('0x4'));var fs=require('fs');var Redis=require(_0xca62('0x5'));var db=require(_0xca62('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xca62('0x7'))(_0xca62('0x8'));var config=require(_0xca62('0x9'));var jayson=require(_0xca62('0xa'));var client=jayson[_0xca62('0xb')][_0xca62('0xc')]({'port':0x232c});config[_0xca62('0xd')]=_[_0xca62('0xe')](config['redis'],{'host':_0xca62('0xf'),'port':0x18eb});var socket=require(_0xca62('0x10'))(new Redis(config[_0xca62('0xd')]));require('./mailAccount.socket')[_0xca62('0x11')](socket);function respondWithRpcPromise(_0x3dd26b,_0x254a7b,_0x5bcb2d){return new BPromise(function(_0x2da5ad,_0x3baba5){return client[_0xca62('0x12')](_0x3dd26b,_0x5bcb2d)[_0xca62('0x13')](function(_0x10d507){logger[_0xca62('0x14')](_0xca62('0x15'),_0x254a7b,_0xca62('0x16'));logger[_0xca62('0x17')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x254a7b,_0xca62('0x16'),JSON[_0xca62('0x18')](_0x10d507));if(_0x10d507[_0xca62('0x19')]){if(_0x10d507['error']['code']===0x1f4){logger['error'](_0xca62('0x15'),_0x254a7b,_0x10d507['error'][_0xca62('0x1a')]);return _0x3baba5(_0x10d507[_0xca62('0x19')]['message']);}logger['error'](_0xca62('0x15'),_0x254a7b,_0x10d507[_0xca62('0x19')][_0xca62('0x1a')]);return _0x2da5ad(_0x10d507['error'][_0xca62('0x1a')]);}else{logger[_0xca62('0x14')](_0xca62('0x15'),_0x254a7b,'request\x20sent');_0x2da5ad(_0x10d507[_0xca62('0x1b')][_0xca62('0x1a')]);}})[_0xca62('0x1c')](function(_0x11cfa1){logger[_0xca62('0x19')](_0xca62('0x15'),_0x254a7b,_0x11cfa1);_0x3baba5(_0x11cfa1);});});}exports[_0xca62('0x1d')]=function(_0x27c97b){var _0x3e4465=this;return new Promise(function(_0x94f92,_0x133132){return db[_0xca62('0x1e')]['findAll']({'raw':_0x27c97b['options']?_0x27c97b['options'][_0xca62('0x1f')]===undefined?!![]:![]:!![],'where':_0x27c97b[_0xca62('0x20')]?_0x27c97b[_0xca62('0x20')][_0xca62('0x21')]||null:null,'attributes':_0x27c97b[_0xca62('0x20')]?_0x27c97b[_0xca62('0x20')][_0xca62('0x22')]||null:null,'limit':_0x27c97b[_0xca62('0x20')]?_0x27c97b['options']['limit']||null:null,'include':_0x27c97b[_0xca62('0x20')]?_0x27c97b['options'][_0xca62('0x23')]?_[_0xca62('0x24')](_0x27c97b[_0xca62('0x20')][_0xca62('0x23')],function(_0x20e970){return{'model':db[_0x20e970[_0xca62('0x25')]],'as':_0x20e970['as'],'attributes':_0x20e970['attributes'],'include':_0x20e970['include']?_[_0xca62('0x24')](_0x20e970[_0xca62('0x23')],function(_0x53f5fb){return{'model':db[_0x53f5fb['model']],'as':_0x53f5fb['as'],'attributes':_0x53f5fb[_0xca62('0x22')],'include':_0x53f5fb['include']?_[_0xca62('0x24')](_0x53f5fb[_0xca62('0x23')],function(_0x1ed588){return{'model':db[_0x1ed588[_0xca62('0x25')]],'as':_0x1ed588['as'],'attributes':_0x1ed588[_0xca62('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4958d7){logger[_0xca62('0x14')](_0xca62('0x1d'),_0x27c97b);logger['debug'](_0xca62('0x1d'),_0x27c97b,JSON[_0xca62('0x18')](_0x4958d7));_0x94f92(_0x4958d7);})[_0xca62('0x1c')](function(_0xf58a90){logger[_0xca62('0x19')](_0xca62('0x1d'),_0xf58a90[_0xca62('0x1a')],_0x27c97b);_0x133132(_0x3e4465[_0xca62('0x19')](0x1f4,_0xf58a90[_0xca62('0x1a')]));});});};exports[_0xca62('0x26')]=function(_0x2de1e7){var _0x1fa7cd=this;return new Promise(function(_0x290736,_0x2cb805){return db[_0xca62('0x1e')][_0xca62('0x27')]({'raw':_0x2de1e7[_0xca62('0x20')]?_0x2de1e7[_0xca62('0x20')][_0xca62('0x1f')]===undefined?!![]:![]:!![],'where':_0x2de1e7[_0xca62('0x20')]?_0x2de1e7['options']['where']||null:null,'attributes':_0x2de1e7[_0xca62('0x20')]?_0x2de1e7[_0xca62('0x20')]['attributes']||null:null,'include':_0x2de1e7['options']?_0x2de1e7[_0xca62('0x20')][_0xca62('0x23')]?_[_0xca62('0x24')](_0x2de1e7[_0xca62('0x20')]['include'],function(_0x1d22ed){return{'model':db[_0x1d22ed[_0xca62('0x25')]],'as':_0x1d22ed['as'],'attributes':_0x1d22ed['attributes'],'include':_0x1d22ed['include']?_['map'](_0x1d22ed[_0xca62('0x23')],function(_0x5d2332){return{'model':db[_0x5d2332[_0xca62('0x25')]],'as':_0x5d2332['as'],'attributes':_0x5d2332[_0xca62('0x22')],'include':_0x5d2332[_0xca62('0x23')]?_[_0xca62('0x24')](_0x5d2332[_0xca62('0x23')],function(_0x14d0e3){return{'model':db[_0x14d0e3[_0xca62('0x25')]],'as':_0x14d0e3['as'],'attributes':_0x14d0e3['attributes']};}):[]};}):[]};}):[]:[]})[_0xca62('0x13')](function(_0x1c1d53){logger[_0xca62('0x14')](_0xca62('0x26'),_0x2de1e7);logger[_0xca62('0x17')](_0xca62('0x26'),_0x2de1e7,JSON[_0xca62('0x18')](_0x1c1d53));_0x290736(_0x1c1d53);})[_0xca62('0x1c')](function(_0x5629de){logger[_0xca62('0x19')](_0xca62('0x26'),_0x5629de['message'],_0x2de1e7);_0x2cb805(_0x1fa7cd['error'](0x1f4,_0x5629de[_0xca62('0x1a')]));});});};exports[_0xca62('0x28')]=function(_0x14645c){var _0x3b0af6=this;return new Promise(function(_0x4fad4b,_0x4c8a89){var _0x39991f={'body':_0x14645c[_0xca62('0x29')],'channel':'mail'};var _0x2cc33a=_[_0xca62('0x2a')](_[_0xca62('0x2b')](db[_0xca62('0x2c')]['rawAttributes']),[_0xca62('0x2d'),_0xca62('0x2e'),'CompanyId','ListId']);var _0x285133=![];if(_0x14645c[_0xca62('0x29')]['id']){delete _0x14645c[_0xca62('0x29')]['id'];}if(_[_0xca62('0x2f')](_0x14645c[_0xca62('0x29')]['from'])){return _0x4c8a89(_0x3b0af6[_0xca62('0x19')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xca62('0x2f')](_0x14645c[_0xca62('0x29')][_0xca62('0x29')])||_0x14645c[_0xca62('0x29')][_0xca62('0x29')]===''){return _0x4c8a89(_0x3b0af6[_0xca62('0x19')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x14645c['body'][_0xca62('0x30')])){return _0x4c8a89(_0x3b0af6[_0xca62('0x19')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2cc33a));}if(!_[_0xca62('0x31')](_0x2cc33a,_0x14645c['body'][_0xca62('0x30')])){return _0x4c8a89(_0x3b0af6[_0xca62('0x19')](0x1f4,_0xca62('0x32')+_0x2cc33a));}var _0x5640a0={};_0x5640a0[_0x14645c['body'][_0xca62('0x30')]]=_0x14645c[_0xca62('0x29')][_0xca62('0x33')];return db['MailAccount'][_0xca62('0x27')]({'where':{'id':_0x14645c['account']['id']},'include':[{'model':db[_0xca62('0x34')],'as':_0xca62('0x35'),'include':[{'model':db[_0xca62('0x2c')],'as':_0xca62('0x36'),'where':_0x5640a0,'limit':0x1,'order':[[_0xca62('0x2e'),_0xca62('0x37')]]}]},{'model':db[_0xca62('0x38')],'as':_0xca62('0x39')},{'model':db[_0xca62('0x3a')],'as':_0xca62('0x3b')}]})[_0xca62('0x13')](function(_0x2c72e2){if(_0x2c72e2&&_0x2c72e2[_0xca62('0x35')]){var _0x45ed60=_0x2c72e2[_0xca62('0x3c')]({'plain':!![]});_0x39991f['account']=_[_0xca62('0x3d')](_0x45ed60,[_0xca62('0x39'),_0xca62('0x35')]);_0x39991f[_0xca62('0x3e')]=_0x45ed60['Applications'];_0x39991f['list']=_0x45ed60['List'];_0x39991f[_0xca62('0x3e')]=_[_0xca62('0x3f')](_0x39991f[_0xca62('0x3e')],[_0xca62('0x40')],['asc']);if(_0x39991f[_0xca62('0x41')]&&_0x39991f[_0xca62('0x41')][_0xca62('0x42')]){_0x39991f[_0xca62('0x3e')][_0xca62('0x43')]({'id':0x0,'priority':_0x39991f[_0xca62('0x3e')][_0xca62('0x44')]+0x1,'app':_0xca62('0x45'),'appdata':_0xca62('0x42'),'interval':_0xca62('0x46')});}if(_0x39991f[_0xca62('0x41')][_0xca62('0x39')]){delete _0x39991f[_0xca62('0x41')][_0xca62('0x39')];}if(_0x39991f['account']['List']){delete _0x39991f[_0xca62('0x41')]['List'];}if(_0x45ed60[_0xca62('0x35')][_0xca62('0x36')][_0xca62('0x44')]){return _0x45ed60['List'][_0xca62('0x36')][0x0];}var _0x2ebc11=_[_0xca62('0xe')](_0x14645c[_0xca62('0x29')],{'firstName':_0x14645c['body'][_0xca62('0x33')],'ListId':_0x45ed60[_0xca62('0x47')]});_0x2ebc11[_0x14645c[_0xca62('0x29')][_0xca62('0x30')]]=_0x14645c[_0xca62('0x29')][_0xca62('0x33')];return db[_0xca62('0x2c')][_0xca62('0x48')](_0x2ebc11);}else{throw new Error('List\x20not\x20found');}})[_0xca62('0x13')](function(_0x18e79d){_0x39991f['contact']=_0x18e79d;if(_0x18e79d){if(!_0x14645c['body']['message']['messageId']){_0x14645c['body'][_0xca62('0x1a')][_0xca62('0x49')]=rs[_0xca62('0x4a')]()+'\x20'+_0x14645c[_0xca62('0x29')][_0xca62('0x1a')][_0xca62('0x33')];}var _0x4c0a5e={'ContactId':_0x18e79d['id'],'MailAccountId':_0x14645c['account']['id'],'inReplyTo':_0x14645c[_0xca62('0x29')][_0xca62('0x1a')]['messageId'],'to':_0x14645c[_0xca62('0x29')][_0xca62('0x1a')][_0xca62('0x33')],'cc':_0x14645c[_0xca62('0x29')][_0xca62('0x1a')]['cc'],'subject':_0x14645c['body'][_0xca62('0x1a')][_0xca62('0x4b')],'attach':_0x14645c[_0xca62('0x29')][_0xca62('0x1a')]['attach'],'lastMsgAt':moment()[_0xca62('0x4c')](_0xca62('0x4d')),'lastMsgDirection':'in','lastMsgBody':_0x14645c[_0xca62('0x29')]['body']};return db[_0xca62('0x4e')]['find']({'where':{'closed':![],'MailAccountId':_0x14645c[_0xca62('0x41')]['id']},'include':[{'model':db[_0xca62('0x4f')],'as':_0xca62('0x50'),'attributes':[_0xca62('0x49')],'where':{'messageId':_0x14645c[_0xca62('0x29')]['message'][_0xca62('0x51')]}}]})[_0xca62('0x13')](function(_0xd05bd4){if(_0xd05bd4){return[_0xd05bd4,![]];}return db[_0xca62('0x4e')][_0xca62('0x48')](_0x4c0a5e)[_0xca62('0x13')](function(_0x4f8936){return[_0x4f8936,!![]];});});}else{throw new Error(_0xca62('0x52'));}})['spread'](function(_0x55addd,_0xa012c9){if(_0x55addd){_0x285133=_0xa012c9;if(!_0xa012c9){return _0x55addd[_0xca62('0x53')]({'inReplyTo':_0x14645c['body'][_0xca62('0x1a')][_0xca62('0x49')],'to':_0x14645c[_0xca62('0x29')]['message']['from'],'cc':_0x14645c[_0xca62('0x29')][_0xca62('0x1a')]['cc'],'subject':_0x14645c['body']['message'][_0xca62('0x4b')],'attach':_0x55addd[_0xca62('0x54')]?_0x55addd[_0xca62('0x54')]:_0x14645c['body'][_0xca62('0x1a')][_0xca62('0x54')],'substatus':null,'substatusAt':moment()[_0xca62('0x4c')](_0xca62('0x4d')),'lastMsgAt':moment()[_0xca62('0x4c')](_0xca62('0x4d')),'lastMsgDirection':'in','lastMsgBody':_0x14645c[_0xca62('0x29')][_0xca62('0x29')]});}else{return _0x55addd;}}})[_0xca62('0x13')](function(_0x3368bd){_0x39991f['interaction']=_0x3368bd[_0xca62('0x3c')]({'plain':!![]});_0x39991f[_0xca62('0x55')]['created']=_0x285133;return db[_0xca62('0x4f')][_0xca62('0x48')]({'body':_0x14645c[_0xca62('0x29')][_0xca62('0x29')],'MailAccountId':_0x14645c['account']['id'],'MailInteractionId':_0x3368bd['id'],'direction':'in','ContactId':_0x39991f[_0xca62('0x56')]['id'],'messageId':_0x14645c[_0xca62('0x29')][_0xca62('0x1a')][_0xca62('0x49')],'from':_0x14645c['body'][_0xca62('0x1a')][_0xca62('0x33')],'to':_0x14645c[_0xca62('0x29')][_0xca62('0x1a')]['to'],'cc':_0x14645c[_0xca62('0x29')][_0xca62('0x1a')]['cc'],'subject':_0x14645c[_0xca62('0x29')][_0xca62('0x1a')][_0xca62('0x4b')],'attach':_0x14645c[_0xca62('0x29')][_0xca62('0x1a')][_0xca62('0x54')],'Attachments':_0x14645c[_0xca62('0x29')][_0xca62('0x1a')]['attachments'],'originTo':_0x14645c[_0xca62('0x29')][_0xca62('0x1a')][_0xca62('0x57')],'originCc':_0x14645c['body'][_0xca62('0x1a')][_0xca62('0x58')],'bcc':_0x14645c[_0xca62('0x29')]['message'][_0xca62('0x59')]},{'include':[{'model':db[_0xca62('0x5a')],'as':_0xca62('0x5b')}]});})['then'](function(_0x1fa237){_0x39991f[_0xca62('0x1a')]=_0x1fa237;if(_0x39991f[_0xca62('0x55')][_0xca62('0x5c')]){return db['User'][_0xca62('0x27')]({'attributes':['id',_0xca62('0x5d')],'where':{'id':_0x39991f[_0xca62('0x55')][_0xca62('0x5c')]}})[_0xca62('0x13')](function(_0x243af3){if(_0x243af3){_0x39991f['applications'][_0xca62('0x5e')]({'id':0x0,'priority':0x0,'app':_0xca62('0x5f'),'appdata':_0x243af3['name']+','+(_0x39991f[_0xca62('0x41')][_0xca62('0x60')]||0xa),'interval':_0xca62('0x46')});}return respondWithRpcPromise('Start',_0xca62('0x61'),_0x39991f);});}return respondWithRpcPromise(_0xca62('0x62'),_0xca62('0x61'),_0x39991f);})[_0xca62('0x13')](function(_0x5c18e1){_0x4fad4b(_0x5c18e1);})[_0xca62('0x1c')](function(_0x204411){_0x4c8a89(_0x3b0af6[_0xca62('0x19')](0x1f4,_0x204411[_0xca62('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 57d521f..9b09514 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 _0xce50=['save','remove','update','register'];(function(_0x4e2500,_0x3c1ea6){var _0x222736=function(_0x158571){while(--_0x158571){_0x4e2500['push'](_0x4e2500['shift']());}};_0x222736(++_0x3c1ea6);}(_0xce50,0x1d8));var _0x0ce5=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xce50[_0x1203f];return _0x365f0a;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x0ce5('0x0'),_0x0ce5('0x1'),_0x0ce5('0x2')];function createListener(_0x363236,_0x1eddd3){return function(_0x563b79){_0x1eddd3['emit'](_0x363236,_0x563b79);};}function removeListener(_0x11f9e0,_0x52a2f1){return function(){MailAccountEvents['removeListener'](_0x11f9e0,_0x52a2f1);};}exports[_0x0ce5('0x3')]=function(_0x42fadd){for(var _0x69892c=0x0,_0x3eb5b2=events['length'];_0x69892c<_0x3eb5b2;_0x69892c++){var _0x32610d=events[_0x69892c];var _0x8d611f=createListener('mailAccount:'+_0x32610d,_0x42fadd);MailAccountEvents['on'](_0x32610d,_0x8d611f);}}; \ No newline at end of file +var _0x960c=['remove','mailAccount:','./mailAccount.events'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0x960c,0x113));var _0xc960=function(_0x57c01b,_0x249651){_0x57c01b=_0x57c01b-0x0;var _0x2c216e=_0x960c[_0x57c01b];return _0x2c216e;};'use strict';var MailAccountEvents=require(_0xc960('0x0'));var events=['save',_0xc960('0x1'),'update'];function createListener(_0x39a88a,_0x3334e7){return function(_0x265faf){_0x3334e7['emit'](_0x39a88a,_0x265faf);};}function removeListener(_0x1b54d7,_0x3ff69d){return function(){MailAccountEvents['removeListener'](_0x1b54d7,_0x3ff69d);};}exports['register']=function(_0x2bb9df){for(var _0x2beb88=0x0,_0x2cd4c9=events['length'];_0x2beb88<_0x2cd4c9;_0x2beb88++){var _0x513f9c=events[_0x2beb88];var _0x2934b2=createListener(_0xc960('0x2')+_0x513f9c,_0x2bb9df);MailAccountEvents['on'](_0x513f9c,_0x2934b2);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 7ee757b..51b879e 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 _0xd87e=['util','connect-timeout','express','Router','../../components/interaction/service','./mailApplication.controller','get','isAuthenticated','/:id','update','delete','destroy','exports','multer'];(function(_0x1bcf88,_0x1467d3){var _0x35a6f7=function(_0x369ad2){while(--_0x369ad2){_0x1bcf88['push'](_0x1bcf88['shift']());}};_0x35a6f7(++_0x1467d3);}(_0xd87e,0x1bf));var _0xed87=function(_0x3ea92b,_0x480631){_0x3ea92b=_0x3ea92b-0x0;var _0x371fc2=_0xd87e[_0x3ea92b];return _0x371fc2;};'use strict';var multer=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var path=require('path');var timeout=require(_0xed87('0x2'));var express=require(_0xed87('0x3'));var router=express[_0xed87('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xed87('0x5'));var config=require('../../config/environment');var controller=require(_0xed87('0x6'));router[_0xed87('0x7')]('/:id',auth[_0xed87('0x8')](),controller['show']);router['put'](_0xed87('0x9'),auth[_0xed87('0x8')](),controller[_0xed87('0xa')]);router[_0xed87('0xb')]('/:id',auth[_0xed87('0x8')](),controller[_0xed87('0xc')]);module[_0xed87('0xd')]=router; \ No newline at end of file +var _0xc788=['update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','show','put'];(function(_0x5df61d,_0x158640){var _0x24cc4c=function(_0x2de006){while(--_0x2de006){_0x5df61d['push'](_0x5df61d['shift']());}};_0x24cc4c(++_0x158640);}(_0xc788,0xc4));var _0x8c78=function(_0x215e5f,_0x321e4f){_0x215e5f=_0x215e5f-0x0;var _0x4ba505=_0xc788[_0x215e5f];return _0x4ba505;};'use strict';var multer=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var path=require(_0x8c78('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8c78('0x3')]();var auth=require(_0x8c78('0x4'));var interaction=require(_0x8c78('0x5'));var config=require(_0x8c78('0x6'));var controller=require(_0x8c78('0x7'));router['get'](_0x8c78('0x8'),auth[_0x8c78('0x9')](),controller[_0x8c78('0xa')]);router[_0x8c78('0xb')](_0x8c78('0x8'),auth['isAuthenticated'](),controller[_0x8c78('0xc')]);router[_0x8c78('0xd')](_0x8c78('0x8'),auth[_0x8c78('0x9')](),controller[_0x8c78('0xe')]);module[_0x8c78('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 047154b..3036a9c 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 _0x7859=['sequelize','exports','INTEGER','STRING','*,*,*,*'];(function(_0x4581ce,_0x55e0fc){var _0x10effe=function(_0xf23d88){while(--_0xf23d88){_0x4581ce['push'](_0x4581ce['shift']());}};_0x10effe(++_0x55e0fc);}(_0x7859,0x1db));var _0x9785=function(_0xb24459,_0x28d82c){_0xb24459=_0xb24459-0x0;var _0x5bdacc=_0x7859[_0xb24459];return _0x5bdacc;};'use strict';var Sequelize=require(_0x9785('0x0'));module[_0x9785('0x1')]={'priority':{'type':Sequelize[_0x9785('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9785('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9785('0x3')]},'interval':{'type':Sequelize[_0x9785('0x3')],'defaultValue':_0x9785('0x4')}}; \ No newline at end of file +var _0x1fca=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x266d63,_0x1c1e64){var _0x1bf903=function(_0x18521d){while(--_0x18521d){_0x266d63['push'](_0x266d63['shift']());}};_0x1bf903(++_0x1c1e64);}(_0x1fca,0x108));var _0xa1fc=function(_0x4b5d99,_0x5aa754){_0x4b5d99=_0x4b5d99-0x0;var _0x1d79d7=_0x1fca[_0x4b5d99];return _0x1d79d7;};'use strict';var Sequelize=require(_0xa1fc('0x0'));module[_0xa1fc('0x1')]={'priority':{'type':Sequelize[_0xa1fc('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa1fc('0x3')],'allowNull':![],'defaultValue':_0xa1fc('0x4')},'appdata':{'type':Sequelize[_0xa1fc('0x5')]()},'description':{'type':Sequelize[_0xa1fc('0x3')]},'interval':{'type':Sequelize[_0xa1fc('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index da42737..3d0dcfe 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 _0x8cf2=['show','model','rawAttributes','query','keys','filters','intersection','attributes','length','includeAll','MailApplication','find','then','catch','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','apply','reject','save','destroy','end','error','stack','name','send'];(function(_0x3fe042,_0x1106f7){var _0x7d4a1f=function(_0x2df987){while(--_0x2df987){_0x3fe042['push'](_0x3fe042['shift']());}};_0x7d4a1f(++_0x1106f7);}(_0x8cf2,0xec));var _0x28cf=function(_0x257f24,_0x3b912a){_0x257f24=_0x257f24-0x0;var _0x458189=_0x8cf2[_0x257f24];return _0x458189;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x28cf('0x0'));var rimraf=require(_0x28cf('0x1'));var zipdir=require(_0x28cf('0x2'));var jsonpatch=require(_0x28cf('0x3'));var rp=require(_0x28cf('0x4'));var moment=require(_0x28cf('0x5'));var BPromise=require(_0x28cf('0x6'));var Mustache=require('mustache');var util=require(_0x28cf('0x7'));var path=require(_0x28cf('0x8'));var sox=require('sox');var csv=require(_0x28cf('0x9'));var ejs=require(_0x28cf('0xa'));var fs=require('fs');var _=require(_0x28cf('0xb'));var squel=require(_0x28cf('0xc'));var crypto=require(_0x28cf('0xd'));var jsforce=require(_0x28cf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x28cf('0x9'));var querystring=require(_0x28cf('0xf'));var Papa=require(_0x28cf('0x10'));var Redis=require(_0x28cf('0x11'));var authService=require(_0x28cf('0x12'));var qs=require(_0x28cf('0x13'));var as=require(_0x28cf('0x14'));var hardwareService=require(_0x28cf('0x15'));var logger=require('../../config/logger')(_0x28cf('0x16'));var utils=require(_0x28cf('0x17'));var config=require(_0x28cf('0x18'));var db=require(_0x28cf('0x19'))['db'];function respondWithStatusCode(_0x5e690,_0x3a2d2a){_0x3a2d2a=_0x3a2d2a||0xcc;return function(_0x2e3e0b){if(_0x2e3e0b){return _0x5e690[_0x28cf('0x1a')](_0x3a2d2a);}return _0x5e690[_0x28cf('0x1b')](_0x3a2d2a)['end']();};}function respondWithResult(_0x2f9bc0,_0x378599){_0x378599=_0x378599||0xc8;return function(_0x2d9050){if(_0x2d9050){return _0x2f9bc0[_0x28cf('0x1b')](_0x378599)['json'](_0x2d9050);}};}function respondWithFilteredResult(_0x5778f0,_0x54bad4){return function(_0x2195b8){if(_0x2195b8){var _0x6f3f5d=_0x2195b8[_0x28cf('0x1c')],_0x420a02=_0x54bad4[_0x28cf('0x1d')],_0x467958=_0x54bad4[_0x28cf('0x1d')]+_0x54bad4['limit'],_0x44dddc;if(_0x467958>=_0x6f3f5d){_0x467958=_0x6f3f5d;_0x44dddc=0xc8;}else{_0x44dddc=0xce;}_0x5778f0[_0x28cf('0x1b')](_0x44dddc);return _0x5778f0['set']('Content-Range',_0x420a02+'-'+_0x467958+'/'+_0x6f3f5d)['json'](_0x2195b8);}return null;};}function patchUpdates(_0x2f2246){return function(_0x80a7cf){try{jsonpatch[_0x28cf('0x1e')](_0x80a7cf,_0x2f2246,!![]);}catch(_0x42b538){return BPromise[_0x28cf('0x1f')](_0x42b538);}return _0x80a7cf[_0x28cf('0x20')]();};}function saveUpdates(_0x5856c3,_0x5af9cd){return function(_0x3e6a07){if(_0x3e6a07){return _0x3e6a07['update'](_0x5856c3)['then'](function(_0x287339){return _0x287339;});}return null;};}function removeEntity(_0xec3379,_0x68623b){return function(_0x56f547){if(_0x56f547){return _0x56f547[_0x28cf('0x21')]()['then'](function(){_0xec3379[_0x28cf('0x1b')](0xcc)[_0x28cf('0x22')]();});}};}function handleEntityNotFound(_0x27b2c4,_0x2f295d){return function(_0x1a7caf){if(!_0x1a7caf){_0x27b2c4[_0x28cf('0x1a')](0x194);}return _0x1a7caf;};}function handleError(_0x30db17,_0x72770){_0x72770=_0x72770||0x1f4;return function(_0x13d414){logger[_0x28cf('0x23')](_0x13d414[_0x28cf('0x24')]);if(_0x13d414[_0x28cf('0x25')]){delete _0x13d414['name'];}_0x30db17[_0x28cf('0x1b')](_0x72770)[_0x28cf('0x26')](_0x13d414);};}exports[_0x28cf('0x27')]=function(_0x129eaf,_0x4d280b){var _0x13ad13={'raw':!![],'where':{'id':_0x129eaf['params']['id']}},_0x572726={};_0x572726[_0x28cf('0x28')]=_['keys'](db['MailApplication'][_0x28cf('0x29')]);_0x572726[_0x28cf('0x2a')]=_[_0x28cf('0x2b')](_0x129eaf[_0x28cf('0x2a')]);_0x572726[_0x28cf('0x2c')]=_[_0x28cf('0x2d')](_0x572726['model'],_0x572726[_0x28cf('0x2a')]);_0x13ad13[_0x28cf('0x2e')]=_['intersection'](_0x572726['model'],qs['fields'](_0x129eaf[_0x28cf('0x2a')]['fields']));_0x13ad13['attributes']=_0x13ad13[_0x28cf('0x2e')][_0x28cf('0x2f')]?_0x13ad13[_0x28cf('0x2e')]:_0x572726[_0x28cf('0x28')];if(_0x129eaf['query'][_0x28cf('0x30')]){_0x13ad13['include']=[{'all':!![]}];}_0x13ad13=_['merge']({},_0x13ad13,_0x129eaf['options']);return db[_0x28cf('0x31')][_0x28cf('0x32')](_0x13ad13)[_0x28cf('0x33')](handleEntityNotFound(_0x4d280b,null))[_0x28cf('0x33')](respondWithResult(_0x4d280b,null))[_0x28cf('0x34')](handleError(_0x4d280b,null));};exports['update']=function(_0x5efe96,_0x111b6a){if(_0x5efe96[_0x28cf('0x35')]['id']){delete _0x5efe96[_0x28cf('0x35')]['id'];}return db['MailApplication'][_0x28cf('0x32')]({'where':{'id':_0x5efe96[_0x28cf('0x36')]['id']}})['then'](handleEntityNotFound(_0x111b6a,null))[_0x28cf('0x33')](saveUpdates(_0x5efe96[_0x28cf('0x35')],null))[_0x28cf('0x33')](respondWithResult(_0x111b6a,null))['catch'](handleError(_0x111b6a,null));};exports[_0x28cf('0x21')]=function(_0x6eb917,_0x1a2cb4){return db[_0x28cf('0x31')][_0x28cf('0x32')]({'where':{'id':_0x6eb917[_0x28cf('0x36')]['id']}})['then'](handleEntityNotFound(_0x1a2cb4,null))[_0x28cf('0x33')](removeEntity(_0x1a2cb4,null))[_0x28cf('0x34')](handleError(_0x1a2cb4,null));}; \ No newline at end of file +var _0x44aa=['status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','stack','name','params','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','MailApplication','find','catch','body','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0x3264d8,_0x2a5eeb){var _0x48f17f=function(_0x3a1c50){while(--_0x3a1c50){_0x3264d8['push'](_0x3264d8['shift']());}};_0x48f17f(++_0x2a5eeb);}(_0x44aa,0x100));var _0xa44a=function(_0x4775cd,_0x50b374){_0x4775cd=_0x4775cd-0x0;var _0x55a6b1=_0x44aa[_0x4775cd];return _0x55a6b1;};'use strict';var pdf=require(_0xa44a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa44a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa44a('0x2'));var rp=require(_0xa44a('0x3'));var moment=require(_0xa44a('0x4'));var BPromise=require(_0xa44a('0x5'));var Mustache=require('mustache');var util=require(_0xa44a('0x6'));var path=require('path');var sox=require(_0xa44a('0x7'));var csv=require(_0xa44a('0x8'));var ejs=require(_0xa44a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa44a('0xa'));var deskjs=require(_0xa44a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa44a('0xc'));var Papa=require(_0xa44a('0xd'));var Redis=require(_0xa44a('0xe'));var authService=require(_0xa44a('0xf'));var qs=require(_0xa44a('0x10'));var as=require(_0xa44a('0x11'));var hardwareService=require(_0xa44a('0x12'));var logger=require(_0xa44a('0x13'))(_0xa44a('0x14'));var utils=require('../../config/utils');var config=require(_0xa44a('0x15'));var db=require(_0xa44a('0x16'))['db'];function respondWithStatusCode(_0x5c46e9,_0x24113f){_0x24113f=_0x24113f||0xcc;return function(_0x2c23b4){if(_0x2c23b4){return _0x5c46e9[_0xa44a('0x17')](_0x24113f);}return _0x5c46e9[_0xa44a('0x18')](_0x24113f)[_0xa44a('0x19')]();};}function respondWithResult(_0x43ab3c,_0xfc0953){_0xfc0953=_0xfc0953||0xc8;return function(_0x60aaa5){if(_0x60aaa5){return _0x43ab3c[_0xa44a('0x18')](_0xfc0953)[_0xa44a('0x1a')](_0x60aaa5);}};}function respondWithFilteredResult(_0x1585fa,_0x20edeb){return function(_0x59e9e7){if(_0x59e9e7){var _0x44ebaf=_0x59e9e7[_0xa44a('0x1b')],_0x342431=_0x20edeb[_0xa44a('0x1c')],_0x27d5c1=_0x20edeb[_0xa44a('0x1c')]+_0x20edeb[_0xa44a('0x1d')],_0x21f1b3;if(_0x27d5c1>=_0x44ebaf){_0x27d5c1=_0x44ebaf;_0x21f1b3=0xc8;}else{_0x21f1b3=0xce;}_0x1585fa['status'](_0x21f1b3);return _0x1585fa['set'](_0xa44a('0x1e'),_0x342431+'-'+_0x27d5c1+'/'+_0x44ebaf)['json'](_0x59e9e7);}return null;};}function patchUpdates(_0x2d1e53){return function(_0x2b9e15){try{jsonpatch['apply'](_0x2b9e15,_0x2d1e53,!![]);}catch(_0x29988){return BPromise[_0xa44a('0x1f')](_0x29988);}return _0x2b9e15[_0xa44a('0x20')]();};}function saveUpdates(_0xe813a5,_0x3099df){return function(_0x10381a){if(_0x10381a){return _0x10381a[_0xa44a('0x21')](_0xe813a5)[_0xa44a('0x22')](function(_0x2cb7f9){return _0x2cb7f9;});}return null;};}function removeEntity(_0x589def,_0x3f14fc){return function(_0x20e182){if(_0x20e182){return _0x20e182[_0xa44a('0x23')]()[_0xa44a('0x22')](function(){_0x589def[_0xa44a('0x18')](0xcc)[_0xa44a('0x19')]();});}};}function handleEntityNotFound(_0x59a07b,_0x1b1c27){return function(_0x5b9f41){if(!_0x5b9f41){_0x59a07b[_0xa44a('0x17')](0x194);}return _0x5b9f41;};}function handleError(_0x2c25dc,_0x56829a){_0x56829a=_0x56829a||0x1f4;return function(_0x51d850){logger['error'](_0x51d850[_0xa44a('0x24')]);if(_0x51d850['name']){delete _0x51d850[_0xa44a('0x25')];}_0x2c25dc[_0xa44a('0x18')](_0x56829a)['send'](_0x51d850);};}exports['show']=function(_0x55b0b6,_0x15a0e9){var _0xa9b4a5={'raw':!![],'where':{'id':_0x55b0b6[_0xa44a('0x26')]['id']}},_0x1a5609={};_0x1a5609[_0xa44a('0x27')]=_[_0xa44a('0x28')](db['MailApplication'][_0xa44a('0x29')]);_0x1a5609[_0xa44a('0x2a')]=_[_0xa44a('0x28')](_0x55b0b6[_0xa44a('0x2a')]);_0x1a5609[_0xa44a('0x2b')]=_[_0xa44a('0x2c')](_0x1a5609['model'],_0x1a5609[_0xa44a('0x2a')]);_0xa9b4a5['attributes']=_[_0xa44a('0x2c')](_0x1a5609[_0xa44a('0x27')],qs[_0xa44a('0x2d')](_0x55b0b6[_0xa44a('0x2a')][_0xa44a('0x2d')]));_0xa9b4a5[_0xa44a('0x2e')]=_0xa9b4a5[_0xa44a('0x2e')][_0xa44a('0x2f')]?_0xa9b4a5[_0xa44a('0x2e')]:_0x1a5609[_0xa44a('0x27')];if(_0x55b0b6[_0xa44a('0x2a')][_0xa44a('0x30')]){_0xa9b4a5[_0xa44a('0x31')]=[{'all':!![]}];}_0xa9b4a5=_[_0xa44a('0x32')]({},_0xa9b4a5,_0x55b0b6[_0xa44a('0x33')]);return db[_0xa44a('0x34')][_0xa44a('0x35')](_0xa9b4a5)['then'](handleEntityNotFound(_0x15a0e9,null))['then'](respondWithResult(_0x15a0e9,null))[_0xa44a('0x36')](handleError(_0x15a0e9,null));};exports[_0xa44a('0x21')]=function(_0x495a5b,_0x20bd70){if(_0x495a5b[_0xa44a('0x37')]['id']){delete _0x495a5b[_0xa44a('0x37')]['id'];}return db[_0xa44a('0x34')]['find']({'where':{'id':_0x495a5b[_0xa44a('0x26')]['id']}})[_0xa44a('0x22')](handleEntityNotFound(_0x20bd70,null))['then'](saveUpdates(_0x495a5b[_0xa44a('0x37')],null))[_0xa44a('0x22')](respondWithResult(_0x20bd70,null))[_0xa44a('0x36')](handleError(_0x20bd70,null));};exports[_0xa44a('0x23')]=function(_0x482d2c,_0x12f11b){return db[_0xa44a('0x34')]['find']({'where':{'id':_0x482d2c[_0xa44a('0x26')]['id']}})[_0xa44a('0x22')](handleEntityNotFound(_0x12f11b,null))[_0xa44a('0x22')](removeEntity(_0x12f11b,null))[_0xa44a('0x36')](handleError(_0x12f11b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 1b01038..c5b9262 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 _0xe8de=['exports','define','mail_applications','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2d0466,_0x1a6239){var _0x40b812=function(_0x56354d){while(--_0x56354d){_0x2d0466['push'](_0x2d0466['shift']());}};_0x40b812(++_0x1a6239);}(_0xe8de,0x1cf));var _0xee8d=function(_0x474775,_0x225105){_0x474775=_0x474775-0x0;var _0x11b6db=_0xe8de[_0x474775];return _0x11b6db;};'use strict';var _=require(_0xee8d('0x0'));var util=require(_0xee8d('0x1'));var logger=require(_0xee8d('0x2'))(_0xee8d('0x3'));var moment=require(_0xee8d('0x4'));var BPromise=require(_0xee8d('0x5'));var rp=require(_0xee8d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module[_0xee8d('0x7')]=function(_0x34086f,_0x57ac24){return _0x34086f[_0xee8d('0x8')]('MailApplication',attributes,{'tableName':_0xee8d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0b28=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','./mailApplication.attributes','mail_applications','utf8mb4'];(function(_0x192752,_0x109ba7){var _0x320d73=function(_0x324b3b){while(--_0x324b3b){_0x192752['push'](_0x192752['shift']());}};_0x320d73(++_0x109ba7);}(_0x0b28,0xe7));var _0x80b2=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0x0b28[_0x561f25];return _0x150e4c;};'use strict';var _=require(_0x80b2('0x0'));var util=require(_0x80b2('0x1'));var logger=require(_0x80b2('0x2'))(_0x80b2('0x3'));var moment=require(_0x80b2('0x4'));var BPromise=require(_0x80b2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x80b2('0x6'));module['exports']=function(_0x237dbd,_0x30f7e2){return _0x237dbd['define']('MailApplication',attributes,{'tableName':_0x80b2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x80b2('0x8'),'collate':_0x80b2('0x9')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 7b17d75..698d24a 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 _0x84e5=['info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','body','options','raw','where','attributes','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x3b4468,_0x226b1a){var _0x5f03e3=function(_0x1313de){while(--_0x1313de){_0x3b4468['push'](_0x3b4468['shift']());}};_0x5f03e3(++_0x226b1a);}(_0x84e5,0x1c4));var _0x584e=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x84e5[_0x39c734];return _0xb2a2f9;};'use strict';var _=require(_0x584e('0x0'));var util=require(_0x584e('0x1'));var moment=require(_0x584e('0x2'));var BPromise=require(_0x584e('0x3'));var rs=require(_0x584e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x584e('0x5'));var logger=require(_0x584e('0x6'))(_0x584e('0x7'));var config=require(_0x584e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x584e('0x9')][_0x584e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c71b1,_0xba143a,_0x202a41){return new BPromise(function(_0x3a2fb3,_0x516951){return client['request'](_0x3c71b1,_0x202a41)[_0x584e('0xb')](function(_0x440f45){logger[_0x584e('0xc')](_0x584e('0xd'),_0xba143a,_0x584e('0xe'));logger['debug'](_0x584e('0xf'),_0xba143a,_0x584e('0xe'),JSON[_0x584e('0x10')](_0x440f45));if(_0x440f45[_0x584e('0x11')]){if(_0x440f45[_0x584e('0x11')][_0x584e('0x12')]===0x1f4){logger[_0x584e('0x11')](_0x584e('0xd'),_0xba143a,_0x440f45[_0x584e('0x11')]['message']);return _0x516951(_0x440f45[_0x584e('0x11')][_0x584e('0x13')]);}logger[_0x584e('0x11')]('MailApplication,\x20%s,\x20%s',_0xba143a,_0x440f45[_0x584e('0x11')]['message']);return _0x3a2fb3(_0x440f45[_0x584e('0x11')][_0x584e('0x13')]);}else{logger[_0x584e('0xc')](_0x584e('0xd'),_0xba143a,_0x584e('0xe'));_0x3a2fb3(_0x440f45[_0x584e('0x14')]['message']);}})[_0x584e('0x15')](function(_0x4858c4){logger[_0x584e('0x11')]('MailApplication,\x20%s,\x20%s',_0xba143a,_0x4858c4);_0x516951(_0x4858c4);});});}exports[_0x584e('0x16')]=function(_0x39a4ea){var _0x35d262=this;return new Promise(function(_0x5b6a57,_0x102f52){return db['MailApplication']['update'](_0x39a4ea[_0x584e('0x17')],{'raw':_0x39a4ea[_0x584e('0x18')]?_0x39a4ea[_0x584e('0x18')][_0x584e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39a4ea[_0x584e('0x18')]?_0x39a4ea['options'][_0x584e('0x1a')]||null:null,'attributes':_0x39a4ea[_0x584e('0x18')]?_0x39a4ea[_0x584e('0x18')][_0x584e('0x1b')]||null:null,'limit':_0x39a4ea[_0x584e('0x18')]?_0x39a4ea[_0x584e('0x18')]['limit']||null:null})[_0x584e('0xb')](function(_0x5b58c3){logger['info'](_0x584e('0x16'),_0x39a4ea);logger[_0x584e('0x1c')](_0x584e('0x16'),_0x39a4ea,JSON[_0x584e('0x10')](_0x5b58c3));_0x5b6a57(_0x5b58c3);})[_0x584e('0x15')](function(_0x156ef1){logger[_0x584e('0x11')](_0x584e('0x16'),_0x156ef1[_0x584e('0x13')],_0x39a4ea);_0x102f52(_0x35d262[_0x584e('0x11')](0x1f4,_0x156ef1['message']));});});}; \ No newline at end of file +var _0xfb54=['MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','UpdateMailApplication','update','body','options','raw','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0xfb54,0xee));var _0x4fb5=function(_0x637e59,_0x3af14f){_0x637e59=_0x637e59-0x0;var _0x22d914=_0xfb54[_0x637e59];return _0x22d914;};'use strict';var _=require(_0x4fb5('0x0'));var util=require(_0x4fb5('0x1'));var moment=require(_0x4fb5('0x2'));var BPromise=require(_0x4fb5('0x3'));var rs=require(_0x4fb5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4fb5('0x5'))['db'];var utils=require(_0x4fb5('0x6'));var logger=require(_0x4fb5('0x7'))('rpc');var config=require(_0x4fb5('0x8'));var jayson=require(_0x4fb5('0x9'));var client=jayson[_0x4fb5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb9b636,_0xb61291,_0x3fbec1){return new BPromise(function(_0x50a146,_0x15ec9f){return client[_0x4fb5('0xb')](_0xb9b636,_0x3fbec1)[_0x4fb5('0xc')](function(_0x596ab6){logger[_0x4fb5('0xd')](_0x4fb5('0xe'),_0xb61291,_0x4fb5('0xf'));logger[_0x4fb5('0x10')]('MailApplication,\x20%s,\x20%s,\x20%s',_0xb61291,_0x4fb5('0xf'),JSON[_0x4fb5('0x11')](_0x596ab6));if(_0x596ab6[_0x4fb5('0x12')]){if(_0x596ab6[_0x4fb5('0x12')]['code']===0x1f4){logger['error'](_0x4fb5('0xe'),_0xb61291,_0x596ab6[_0x4fb5('0x12')][_0x4fb5('0x13')]);return _0x15ec9f(_0x596ab6['error'][_0x4fb5('0x13')]);}logger[_0x4fb5('0x12')](_0x4fb5('0xe'),_0xb61291,_0x596ab6[_0x4fb5('0x12')][_0x4fb5('0x13')]);return _0x50a146(_0x596ab6[_0x4fb5('0x12')][_0x4fb5('0x13')]);}else{logger[_0x4fb5('0xd')](_0x4fb5('0xe'),_0xb61291,_0x4fb5('0xf'));_0x50a146(_0x596ab6[_0x4fb5('0x14')][_0x4fb5('0x13')]);}})[_0x4fb5('0x15')](function(_0x238a5c){logger['error'](_0x4fb5('0xe'),_0xb61291,_0x238a5c);_0x15ec9f(_0x238a5c);});});}exports[_0x4fb5('0x16')]=function(_0x333227){var _0x3c9a02=this;return new Promise(function(_0x5359fd,_0x503a47){return db['MailApplication'][_0x4fb5('0x17')](_0x333227[_0x4fb5('0x18')],{'raw':_0x333227[_0x4fb5('0x19')]?_0x333227[_0x4fb5('0x19')][_0x4fb5('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x333227[_0x4fb5('0x19')]?_0x333227['options']['where']||null:null,'attributes':_0x333227[_0x4fb5('0x19')]?_0x333227['options'][_0x4fb5('0x1b')]||null:null,'limit':_0x333227[_0x4fb5('0x19')]?_0x333227[_0x4fb5('0x19')]['limit']||null:null})[_0x4fb5('0xc')](function(_0x5443f8){logger[_0x4fb5('0xd')]('UpdateMailApplication',_0x333227);logger[_0x4fb5('0x10')](_0x4fb5('0x16'),_0x333227,JSON[_0x4fb5('0x11')](_0x5443f8));_0x5359fd(_0x5443f8);})[_0x4fb5('0x15')](function(_0x6da93b){logger[_0x4fb5('0x12')](_0x4fb5('0x16'),_0x6da93b[_0x4fb5('0x13')],_0x333227);_0x503a47(_0x3c9a02[_0x4fb5('0x12')](0x1f4,_0x6da93b['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 1e4e0be..424509e 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 _0x4aeb=['put','tracked','mail','mailinteraction:update','delete','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','/describe','isAuthenticated','get','/:id','show','/:id/messages','getMessages','/:id/download','download','post','mailinteraction:addtags'];(function(_0x4a0f2d,_0x3dac24){var _0xb6cdde=function(_0x791eab){while(--_0x791eab){_0x4a0f2d['push'](_0x4a0f2d['shift']());}};_0xb6cdde(++_0x3dac24);}(_0x4aeb,0x131));var _0xb4ae=function(_0x57a697,_0xe2f0f6){_0x57a697=_0x57a697-0x0;var _0x4c2383=_0x4aeb[_0x57a697];return _0x4c2383;};'use strict';var multer=require(_0xb4ae('0x0'));var util=require(_0xb4ae('0x1'));var path=require(_0xb4ae('0x2'));var timeout=require(_0xb4ae('0x3'));var express=require('express');var router=express[_0xb4ae('0x4')]();var auth=require(_0xb4ae('0x5'));var interaction=require(_0xb4ae('0x6'));var config=require('../../config/environment');var controller=require(_0xb4ae('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb4ae('0x8'),auth[_0xb4ae('0x9')](),controller['describe']);router[_0xb4ae('0xa')](_0xb4ae('0xb'),auth[_0xb4ae('0x9')](),controller[_0xb4ae('0xc')]);router[_0xb4ae('0xa')](_0xb4ae('0xd'),auth[_0xb4ae('0x9')](),controller[_0xb4ae('0xe')]);router[_0xb4ae('0xa')](_0xb4ae('0xf'),auth[_0xb4ae('0x9')](),controller[_0xb4ae('0x10')]);router[_0xb4ae('0x11')]('/',auth[_0xb4ae('0x9')](),controller['create']);router[_0xb4ae('0x11')](_0xb4ae('0xd'),auth[_0xb4ae('0x9')](),controller['addMessage']);router[_0xb4ae('0x11')]('/:id/tags',auth[_0xb4ae('0x9')](),interaction['tracked']('mail',_0xb4ae('0x12')),controller['addTags']);router[_0xb4ae('0x13')](_0xb4ae('0xb'),auth[_0xb4ae('0x9')](),interaction[_0xb4ae('0x14')](_0xb4ae('0x15'),_0xb4ae('0x16')),controller['update']);router[_0xb4ae('0x17')](_0xb4ae('0xb'),auth[_0xb4ae('0x9')](),interaction[_0xb4ae('0x14')]('mail','mailinteraction:destroy'),controller['destroy']);router['delete'](_0xb4ae('0x18'),auth[_0xb4ae('0x9')](),controller[_0xb4ae('0x19')]);module[_0xb4ae('0x1a')]=router; \ No newline at end of file +var _0x7952=['delete','destroy','removeTags','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','mail','mailinteraction:addtags','addTags','mailinteraction:update','update'];(function(_0x5a1734,_0x420117){var _0x40e2cd=function(_0x20f1c3){while(--_0x20f1c3){_0x5a1734['push'](_0x5a1734['shift']());}};_0x40e2cd(++_0x420117);}(_0x7952,0xec));var _0x2795=function(_0x244862,_0x3da79e){_0x244862=_0x244862-0x0;var _0x2bce23=_0x7952[_0x244862];return _0x2bce23;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2795('0x0'));var timeout=require(_0x2795('0x1'));var express=require(_0x2795('0x2'));var router=express[_0x2795('0x3')]();var auth=require(_0x2795('0x4'));var interaction=require(_0x2795('0x5'));var config=require(_0x2795('0x6'));var controller=require(_0x2795('0x7'));router[_0x2795('0x8')]('/',auth[_0x2795('0x9')](),controller['index']);router[_0x2795('0x8')]('/describe',auth[_0x2795('0x9')](),controller[_0x2795('0xa')]);router['get'](_0x2795('0xb'),auth[_0x2795('0x9')](),controller['show']);router[_0x2795('0x8')](_0x2795('0xc'),auth[_0x2795('0x9')](),controller[_0x2795('0xd')]);router[_0x2795('0x8')](_0x2795('0xe'),auth[_0x2795('0x9')](),controller[_0x2795('0xf')]);router[_0x2795('0x10')]('/',auth[_0x2795('0x9')](),controller[_0x2795('0x11')]);router[_0x2795('0x10')]('/:id/messages',auth[_0x2795('0x9')](),controller[_0x2795('0x12')]);router[_0x2795('0x10')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x2795('0x13')](_0x2795('0x14'),_0x2795('0x15')),controller[_0x2795('0x16')]);router['put'](_0x2795('0xb'),auth[_0x2795('0x9')](),interaction[_0x2795('0x13')](_0x2795('0x14'),_0x2795('0x17')),controller[_0x2795('0x18')]);router[_0x2795('0x19')](_0x2795('0xb'),auth[_0x2795('0x9')](),interaction[_0x2795('0x13')](_0x2795('0x14'),'mailinteraction:destroy'),controller[_0x2795('0x1a')]);router[_0x2795('0x19')]('/:id/tags',auth['isAuthenticated'](),controller[_0x2795('0x1b')]);module[_0x2795('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 5e1363c..0b60ff8 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 _0xf56c=['exports','BOOLEAN','DATE','STRING','TEXT','ENUM','out','long','iconv'];(function(_0x217a6f,_0x3ecd8b){var _0x5553f3=function(_0x24b9c0){while(--_0x24b9c0){_0x217a6f['push'](_0x217a6f['shift']());}};_0x5553f3(++_0x3ecd8b);}(_0xf56c,0xc5));var _0xcf56=function(_0x29c6fc,_0x462633){_0x29c6fc=_0x29c6fc-0x0;var _0x1406ab=_0xf56c[_0x29c6fc];return _0x1406ab;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xcf56('0x0'));module[_0xcf56('0x1')]={'closed':{'type':Sequelize[_0xcf56('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xcf56('0x3')]},'disposition':{'type':Sequelize[_0xcf56('0x4')]},'note':{'type':Sequelize[_0xcf56('0x4')]},'inReplyTo':{'type':Sequelize[_0xcf56('0x4')](0x1fe)},'to':{'type':Sequelize[_0xcf56('0x4')]},'cc':{'type':Sequelize[_0xcf56('0x5')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xcf56('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xcf56('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xcf56('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xcf56('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xcf56('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xcf56('0x6')]('in',_0xcf56('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0xcf56('0x8'))},'lastMsgText':{'type':Sequelize['TEXT'](_0xcf56('0x8'))}}; \ No newline at end of file +var _0x408e=['TEXT','long','DATE','ENUM','out','sequelize','STRING'];(function(_0x49b813,_0xbb0127){var _0x40ae70=function(_0x373e50){while(--_0x373e50){_0x49b813['push'](_0x49b813['shift']());}};_0x40ae70(++_0xbb0127);}(_0x408e,0x194));var _0xe408=function(_0x304bf7,_0x4fcafc){_0x304bf7=_0x304bf7-0x0;var _0x5036cd=_0x408e[_0x304bf7];return _0x5036cd;};'use strict';var Sequelize=require(_0xe408('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe408('0x1')]},'inReplyTo':{'type':Sequelize[_0xe408('0x1')](0x1fe)},'to':{'type':Sequelize[_0xe408('0x1')]},'cc':{'type':Sequelize[_0xe408('0x2')](_0xe408('0x3'))},'subject':{'type':Sequelize[_0xe408('0x2')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xe408('0x4')]},'substatus':{'type':Sequelize[_0xe408('0x1')](0x3c)},'substatusAt':{'type':Sequelize[_0xe408('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xe408('0x5')]('in',_0xe408('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xe408('0x5')]('in',_0xe408('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xe408('0x2')](_0xe408('0x3'))},'lastMsgText':{'type':Sequelize[_0xe408('0x2')](_0xe408('0x3'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 4296af0..2e18e65 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 _0xa9e0=['MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','intersection','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','tmp','server','transcript-%d-%s.zip','join','attachments','Attachment','subject','Messages','get','mkdirSync','each','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy'];(function(_0x1c155b,_0x11d523){var _0x41501f=function(_0x5529d5){while(--_0x5529d5){_0x1c155b['push'](_0x1c155b['shift']());}};_0x41501f(++_0x11d523);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file +var _0xa9e0=['MailInteractionId','Setting','enableEmailPreview','push','all','rows','show','params','include','merge','options','create','body','describe','addMessage','MailMessage','ids','omit','intersection','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','emit','mailInteractionTags:save','removeTags','unix','root','files','tmp','server','transcript-%d-%s.zip','join','attachments','Attachment','subject','Messages','get','mkdirSync','each','headers','bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','conditions','value','having','Contact','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','end','Tag','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','type','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.disposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy'];(function(_0x46df24,_0x44ea54){var _0x2106b7=function(_0x22184c){while(--_0x22184c){_0x46df24['push'](_0x46df24['shift']());}};_0x2106b7(++_0x44ea54);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var htmlToText=require(_0x0a9e('0xe'));var Redis=require(_0x0a9e('0xf'));var authService=require(_0x0a9e('0x10'));var qs=require(_0x0a9e('0x11'));var as=require(_0x0a9e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function getLastMessageText(_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x2407f9['id']},'attributes':['lastMsgBody',_0x0a9e('0x2f')],'raw':!![]})[_0x0a9e('0x22')](function(_0x40cb85){if(!_0x40cb85[_0x0a9e('0x2f')]){_0x2407f9[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](htmlToText[_0x0a9e('0x31')](_0x40cb85[_0x0a9e('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x2407f9['lastMsgText']=_0x40cb85[_0x0a9e('0x2f')];}_0x3ae878(_0x2407f9);})['catch'](function(_0x2cc7a0){_0x1122db(_0x2cc7a0);});});}function updateMailInteraction(_0x14b13f,_0x2b7e7f,_0x3f3d41,_0x567193){return new BPromise(function(_0x191e91,_0xd1836d){return getInteractionUsers(_0x14b13f,_0x3f3d41)[_0x0a9e('0x22')](function(_0x15de0e){return getInteractionTags(_0x15de0e,_0x2b7e7f);})['then'](function(_0x54135e){if(_0x567193){_0x191e91(getLastMessageText(_0x54135e));}else{_0x191e91(_0x54135e);}})[_0x0a9e('0x33')](function(_0x5640eb){_0xd1836d(_0x5640eb);});});}exports[_0x0a9e('0x34')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x35')](db['MailInteraction'][_0x0a9e('0x36')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x37')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x38')]=_[_0x0a9e('0x35')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x3d9717[_0x0a9e('0x39')]);_0x4f41ae[_0x0a9e('0x3b')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x39')]);_0x1ef87a[_0x0a9e('0x3c')]=_['intersection'](_0x4f41ae[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x3d9717[_0x0a9e('0x39')]['fields']));_0x1ef87a[_0x0a9e('0x3c')]=_0x1ef87a[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1ef87a[_0x0a9e('0x3c')]:_0x4f41ae[_0x0a9e('0x38')];if(!_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x3f')](_0x0a9e('0x40'))){_0x1ef87a[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1ef87a[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x3d9717[_0x0a9e('0x39')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1ef87a[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x3d9717[_0x0a9e('0x39')],_0x4f41ae[_0x0a9e('0x3b')]),_0x3bfce8);var _0x432fcc=[];var _0x25c6e6=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('id')['field'](_0x0a9e('0x25'))[_0x0a9e('0x45')](_0x0a9e('0x46'))[_0x0a9e('0x47')](_0x0a9e('0x48'));var _0xbe9d19=squel[_0x0a9e('0x44')]()[_0x0a9e('0x45')]('u.id')[_0x0a9e('0x45')]('u.fullname')[_0x0a9e('0x45')](_0x0a9e('0x49'))[_0x0a9e('0x47')]('user_has_mail_interactions','ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x34aa5a=squel[_0x0a9e('0x44')]()[_0x0a9e('0x47')](_0x0a9e('0x4d'),'i')['left_join'](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')](_0x0a9e('0x51'),'a',_0x0a9e('0x52'))[_0x0a9e('0x4a')]('mail_messages','me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x0a9e('0x48'),'t',_0x0a9e('0x54'));var _0x37edaa=squel[_0x0a9e('0x55')]();var _0x61bb17=[];var _0x30decb=squel[_0x0a9e('0x55')]();var _0x375c18;if(_0x3d9717['query']['search']){_0x375c18=as['parseSearch'](_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x56')]);var _0x14d602=_0x375c18['sqlOperator'];for(var _0x2b69d9=0x0;_0x2b69d9<_0x375c18[_0x0a9e('0x57')]['length'];_0x2b69d9++){var _0x5a88da=_0x375c18[_0x0a9e('0x57')][_0x2b69d9];var _0x59c6ff='i';var _0x443e72=_['find'](_0x3bfce8,[_0x0a9e('0x25'),_0x5a88da[_0x0a9e('0x45')]]);if(!_0x443e72){switch(_0x5a88da[_0x0a9e('0x45')]){case'unreadMessages':if(_0x5a88da[_0x0a9e('0x58')]==0x1){_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da['field']+'`\x20=\x200');}else{_0x34aa5a[_0x0a9e('0x59')]('`'+_0x5a88da[_0x0a9e('0x45')]+'`\x20>\x200');}break;case _0x0a9e('0x5a'):if(_0x5a88da['operator']===_0x0a9e('0x5b')){if(_0x5a88da['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x37edaa[_0x14d602]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5a88da[_0x0a9e('0x58')]),null);}else{var _0x47de4c='%'+_0x5a88da[_0x0a9e('0x58')]+'%';_0x37edaa[_0x14d602](_0x0a9e('0x5c'),_0x47de4c,_0x47de4c,_0x47de4c);}}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x5e')]);_0x5a88da[_0x0a9e('0x45')]=_0x0a9e('0x5e');_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}break;case _0x0a9e('0x63'):var _0x5d86e9=_0x5a88da[_0x0a9e('0x58')][_0x0a9e('0x2b')](',')['map'](function(_0x3649cc){return Number(_0x3649cc);});_0x5d86e9['forEach'](function(_0x20c668){_0x30decb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20c668+',%');});_0x61bb17=_['union'](_0x61bb17,_0x5d86e9);break;case'User':if(_0x5a88da[_0x0a9e('0x64')]==='$substring'){_0x37edaa[_0x14d602](_0x0a9e('0x65'),'%'+_0x5a88da[_0x0a9e('0x58')]+'%',null);}else{_0x443e72=_[_0x0a9e('0x5d')](_0x3bfce8,[_0x0a9e('0x25'),_0x0a9e('0x66')]);_0x5a88da[_0x0a9e('0x45')]='UserId';_0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72['type'],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x61')],_0x797b45['value'][_0x0a9e('0x62')]);}break;case _0x0a9e('0x67'):_0x797b45=as[_0x0a9e('0x5f')]('me',null,_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45['value'][_0x0a9e('0x61')],_0x797b45[_0x0a9e('0x58')]['end']);break;}}else{var _0x797b45=as[_0x0a9e('0x5f')](_0x59c6ff,_0x443e72[_0x0a9e('0x68')],_0x5a88da);_0x37edaa[_0x14d602](_0x797b45[_0x0a9e('0x60')],_0x797b45[_0x0a9e('0x58')]['start'],_0x797b45[_0x0a9e('0x58')][_0x0a9e('0x62')]);}}}else{var _0x281c7d=_(_0x3d9717['query'])[_0x0a9e('0x3a')]()['map'](function(_0x5211e3){return _[_0x0a9e('0x69')](_0x3bfce8,[_0x0a9e('0x25'),_0x5211e3])?_0x5211e3:undefined;})[_0x0a9e('0x6a')]()[_0x0a9e('0x58')]();if(!_[_0x0a9e('0x6b')](_0x281c7d)){_0x281c7d[_0x0a9e('0x2c')](function(_0x387489){if(_0x387489===_0x0a9e('0x6c')){_0x34aa5a[_0x0a9e('0x42')](_0x0a9e('0x6d'),[][_0x0a9e('0x6e')](_0x3d9717[_0x0a9e('0x39')][_0x387489]));}else if(_0x387489===_0x0a9e('0x6f')){var _0x2b8192=JSON[_0x0a9e('0x70')](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x71')];var _0x4257c9=JSON['parse'](_0x3d9717[_0x0a9e('0x39')][_0x387489])[_0x0a9e('0x72')];_0x34aa5a[_0x0a9e('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2b8192,_0x4257c9);}else{if(_0x3d9717[_0x0a9e('0x39')][_0x387489]===_0x0a9e('0x73')){_0x34aa5a['where']('i.'+_0x387489+_0x0a9e('0x74'));}else{_0x34aa5a[_0x0a9e('0x42')]('i.'+_0x387489+_0x0a9e('0x75'),_0x3d9717[_0x0a9e('0x39')][_0x387489]);}}});}if(_0x3d9717[_0x0a9e('0x39')]['read']){if(_0x3d9717['query']['read']==0x1){_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x76'));}else{_0x34aa5a[_0x0a9e('0x59')](_0x0a9e('0x77'));}}if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]){_0x61bb17=_[_0x0a9e('0x79')](_0x3d9717[_0x0a9e('0x39')]['tag'])?_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x78')]:new Array(_0x3d9717[_0x0a9e('0x39')]['tag']);_0x61bb17[_0x0a9e('0x2c')](function(_0x583b2e){_0x30decb['or'](_0x0a9e('0x7a'),'%,'+_0x583b2e+',%');});}if(_0x3d9717[_0x0a9e('0x39')]['filter']){var _0x2ed01e=_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x7b')][_0x0a9e('0x7c')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x0a9e('0x7d'));if(qs[_0x0a9e('0x7e')](_0x2ed01e)){_0x37edaa['or'](_0x0a9e('0x7f'),_0x2ed01e+'%');}else if(qs[_0x0a9e('0x80')](_0x2ed01e)){_0x37edaa['or']('c.email\x20LIKE\x20?',_0x2ed01e+'%');}else{_0x37edaa['or'](_0x0a9e('0x81'),qs[_0x0a9e('0x82')](_0x2ed01e))['or'](_0x0a9e('0x83'),qs[_0x0a9e('0x82')](_0x2ed01e));}}}_0x34aa5a['where'](_0x37edaa);_0x34aa5a[_0x0a9e('0x84')](_0x0a9e('0x85'));var _0x30a4c7={'type':db[_0x0a9e('0x86')][_0x0a9e('0x87')][_0x0a9e('0x88')],'raw':!![]};var _0x40fc56=_0x34aa5a[_0x0a9e('0x89')]();_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x40fc56[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));if(_0x1ef87a[_0x0a9e('0x8c')]){_0x1ef87a['order'][_0x0a9e('0x2c')](function(_0x11da9c){_0x34aa5a[_0x0a9e('0x8c')]('i.'+_0x11da9c[0x0],_0x11da9c[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0a9e('0x6b')](_0x61bb17)){_0x34aa5a[_0x0a9e('0x59')](_0x30decb);_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x8d'),_0x61bb17);}BPromise['resolve']()['then'](function(){if(!_0x375c18){if(_0x3d9717[_0x0a9e('0x39')][_0x0a9e('0x6c')]||_0x3d9717['query'][_0x0a9e('0x8e')])return;_0x40fc56['where'](_0x0a9e('0x8f'));_0x34aa5a[_0x0a9e('0x42')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x3d9717[_0x0a9e('0x90')][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0x42b959){if(_[_0x0a9e('0x6b')](_0x42b959)){_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x92'));_0x34aa5a['where'](_0x0a9e('0x92'));}else{_0x40fc56[_0x0a9e('0x42')](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));_0x34aa5a['where'](_0x0a9e('0x6d'),_[_0x0a9e('0x35')](_0x42b959,'id'));}});})['then'](function(){db[_0x0a9e('0x93')]['query'](_0x40fc56[_0x0a9e('0x94')](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x3003eb){_0x31916f[_0x0a9e('0x1b')]=_0x3003eb['length'];if(_0x31916f['count']===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x39')](_0x25c6e6[_0x0a9e('0x94')](),_0x30a4c7)['then'](function(_0x3b4a9f){_0x432fcc=_[_0x0a9e('0x95')](_0x3b4a9f,'id');_0x30a4c7=_['merge'](_0x30a4c7,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3d9717[_0x0a9e('0x39')]['fields']){_0x1ef87a['attributes']['forEach'](function(_0x81d748){_0x34aa5a[_0x0a9e('0x45')]('i.'+_0x81d748);});}else{_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x8a'),_0x0a9e('0x8b'));_0x34aa5a[_0x0a9e('0x45')]('a.key',_0x0a9e('0x96'));_0x34aa5a['field'](_0x0a9e('0x97'),_0x0a9e('0x98'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x85'));_0x34aa5a['field'](_0x0a9e('0x99'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9a'));_0x34aa5a['field'](_0x0a9e('0x9b'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9c'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9d'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9e'));_0x34aa5a[_0x0a9e('0x45')]('i.lastMsgDirection');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0x9f'));_0x34aa5a['field'](_0x0a9e('0xa0'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa1'));_0x34aa5a['field'](_0x0a9e('0xa2'));_0x34aa5a['field'](_0x0a9e('0xa3'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa4'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa5'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x34aa5a['field'](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xaa'),_0x0a9e('0xab'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xac'),_0x0a9e('0xad'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb0'),'Contact.fax');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb1'),_0x0a9e('0xb2'));_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb3'),'Owner.internal');_0x34aa5a[_0x0a9e('0x45')](_0x0a9e('0xb4'),'TagIds');}if(_0x1ef87a[_0x0a9e('0x1d')])_0x34aa5a['limit'](_0x1ef87a[_0x0a9e('0x1d')]);if(_0x1ef87a[_0x0a9e('0x1c')])_0x34aa5a[_0x0a9e('0x1c')](_0x1ef87a[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x39')](_0x34aa5a['toString'](),_0x30a4c7);})[_0x0a9e('0x22')](function(_0x3d0a77){_0xbe9d19['where'](_0x0a9e('0xb5'),_[_0x0a9e('0x35')](_0x3d0a77,'id'));return db[_0x0a9e('0x93')]['query'](_0xbe9d19['toString'](),_0x30a4c7)[_0x0a9e('0x22')](function(_0x6ba2be){var _0x1707dc=_[_0x0a9e('0xb6')](_0x6ba2be,_0x0a9e('0xb7'));var _0x2450a8=[];return db[_0x0a9e('0xb8')][_0x0a9e('0x2e')]({'attributes':[_0x0a9e('0xb9')],'raw':!![]})['then'](function(_0x3156c7){var _0x517081=_0x3156c7[_0x0a9e('0xb9')];_0x3d0a77[_0x0a9e('0x2c')](function(_0x34e745){_0x2450a8[_0x0a9e('0xba')](updateMailInteraction(_0x34e745,_0x432fcc,_0x1707dc,_0x517081));});return BPromise[_0x0a9e('0xbb')](_0x2450a8);});});});})['then'](function(_0x436313){_0x31916f[_0x0a9e('0xbc')]=_0x436313;return _0x31916f;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x381c37,_0x1ef87a));})[_0x0a9e('0x33')](handleError(_0x381c37,null));};exports[_0x0a9e('0xbd')]=function(_0x5c66ef,_0x4f074c){var _0x22a3cb={'raw':![],'where':{'id':_0x5c66ef[_0x0a9e('0xbe')]['id']}},_0x583662={};_0x583662[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x2d')][_0x0a9e('0x36')]);_0x583662[_0x0a9e('0x39')]=_['keys'](_0x5c66ef['query']);_0x583662[_0x0a9e('0x3b')]=_['intersection'](_0x583662[_0x0a9e('0x38')],_0x583662['query']);_0x22a3cb[_0x0a9e('0x3c')]=_['intersection'](_0x583662['model'],qs[_0x0a9e('0x3d')](_0x5c66ef[_0x0a9e('0x39')]['fields']));_0x22a3cb[_0x0a9e('0x3c')]=_0x22a3cb[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x22a3cb[_0x0a9e('0x3c')]:_0x583662[_0x0a9e('0x38')];if(_0x5c66ef['query']['includeAll']){_0x22a3cb[_0x0a9e('0xbf')]=[{'all':!![]}];}_0x22a3cb=_[_0x0a9e('0xc0')]({},_0x22a3cb,_0x5c66ef[_0x0a9e('0xc1')]);return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')](_0x22a3cb)['then'](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](respondWithResult(_0x4f074c,null))[_0x0a9e('0x33')](handleError(_0x4f074c,null));};exports['create']=function(_0x3c313d,_0x19fd11){return db[_0x0a9e('0x2d')][_0x0a9e('0xc2')](_0x3c313d[_0x0a9e('0xc3')],{})[_0x0a9e('0x22')](respondWithResult(_0x19fd11,0xc9))[_0x0a9e('0x33')](handleError(_0x19fd11,null));};exports[_0x0a9e('0x20')]=function(_0x40dd2a,_0x16afb3){if(_0x40dd2a['body']['id']){delete _0x40dd2a[_0x0a9e('0xc3')]['id'];}return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x40dd2a[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x16afb3,null))['then'](saveUpdates(_0x40dd2a['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x16afb3,null))[_0x0a9e('0x33')](handleError(_0x16afb3,null));};exports[_0x0a9e('0x21')]=function(_0x2fea95,_0x34f7b5){return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x2fea95[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x34f7b5,null))['then'](removeEntity(_0x34f7b5,null))[_0x0a9e('0x33')](handleError(_0x34f7b5,null));};exports['describe']=function(_0x2144ca,_0x4799d4){return db[_0x0a9e('0x2d')][_0x0a9e('0xc4')]()[_0x0a9e('0x22')](respondWithResult(_0x4799d4,null))['catch'](handleError(_0x4799d4,null));};exports[_0x0a9e('0xc5')]=function(_0x5ed560,_0x4383da,_0x2b1824){return db[_0x0a9e('0xc6')][_0x0a9e('0x5d')]({'where':{'id':_0x5ed560[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4383da,null))[_0x0a9e('0x22')](function(_0xe89aaa){if(_0xe89aaa){return _0xe89aaa[_0x0a9e('0xc5')](_0x5ed560[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x5ed560[_0x0a9e('0xc3')],[_0x0a9e('0xc7'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4383da,null))[_0x0a9e('0x33')](handleError(_0x4383da,null));};exports['getMessages']=function(_0x556443,_0x6eaaf0,_0x5c4be0){var _0x1d999b={'raw':![],'where':{}};var _0x3428c9={};var _0x5d6b69={'count':0x0,'rows':[]};return db[_0x0a9e('0x2d')][_0x0a9e('0x2e')]({'where':{'id':_0x556443[_0x0a9e('0xbe')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x6eaaf0,null))['then'](function(_0x148fd9){if(_0x148fd9){_0x3428c9[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0xc6')]['rawAttributes']);_0x3428c9[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x556443[_0x0a9e('0x39')]);_0x3428c9['filters']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],_0x3428c9[_0x0a9e('0x39')]);_0x1d999b['attributes']=_[_0x0a9e('0xc9')](_0x3428c9[_0x0a9e('0x38')],qs[_0x0a9e('0x3d')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3d')]));_0x1d999b['attributes']=_0x1d999b[_0x0a9e('0x3c')][_0x0a9e('0x3e')]?_0x1d999b['attributes']:_0x3428c9[_0x0a9e('0x38')];if(!_0x556443[_0x0a9e('0x39')][_0x0a9e('0x3f')]('nolimit')){_0x1d999b['limit']=qs['limit'](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1d')]);_0x1d999b['offset']=qs[_0x0a9e('0x1c')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x1c')]);}_0x1d999b['order']=qs[_0x0a9e('0x41')](_0x556443[_0x0a9e('0x39')][_0x0a9e('0x41')]);_0x1d999b[_0x0a9e('0x42')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x43')](_0x556443[_0x0a9e('0x39')],_0x3428c9[_0x0a9e('0x3b')]));_0x1d999b[_0x0a9e('0x42')]['MailInteractionId']=_0x148fd9['id'];if(_0x556443[_0x0a9e('0x39')]['filter']){_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],{'$or':_[_0x0a9e('0x35')](_0x1d999b[_0x0a9e('0x3c')],function(_0x344cd4){var _0x53d9fc={};_0x53d9fc[_0x344cd4]={'$like':'%'+_0x556443[_0x0a9e('0x39')][_0x0a9e('0x7b')]+'%'};return _0x53d9fc;})});}if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')]){var _0x51aa2f=_0x556443[_0x0a9e('0x39')][_0x0a9e('0x71')][_0x0a9e('0x2b')](',');var _0x1c9539={};_0x1c9539[_0x51aa2f[0x0]]={'$gte':moment(_0x51aa2f[0x1])[_0x0a9e('0xca')](_0x0a9e('0xcb'))};_0x1d999b[_0x0a9e('0x42')]=_[_0x0a9e('0xc0')](_0x1d999b[_0x0a9e('0x42')],_0x1c9539);}_0x1d999b=_[_0x0a9e('0xc0')]({},_0x1d999b,_0x556443['options']);return db[_0x0a9e('0xc6')][_0x0a9e('0x1b')]({'where':_0x1d999b[_0x0a9e('0x42')]})[_0x0a9e('0x22')](function(_0xea8bd1){_0x5d6b69[_0x0a9e('0x1b')]=_0xea8bd1;if(_0x556443[_0x0a9e('0x39')][_0x0a9e('0xcc')]){_0x1d999b['include']=[{'all':!![]}];}return db[_0x0a9e('0xc6')][_0x0a9e('0xcd')](_0x1d999b);})[_0x0a9e('0x22')](function(_0x5c65fc){_0x5d6b69[_0x0a9e('0xbc')]=_0x5c65fc;return _0x5d6b69;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x6eaaf0,_0x1d999b))[_0x0a9e('0x33')](handleError(_0x6eaaf0,null));};exports[_0x0a9e('0xce')]=function(_0x370b5e,_0x1ba457,_0x424f1b){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x370b5e[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x446e6){if(_0x446e6){return _0x446e6[_0x0a9e('0xcf')](_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')],_[_0x0a9e('0xc8')](_0x370b5e['body'],[_0x0a9e('0xc7'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x46')],'where':{'id':_0x370b5e[_0x0a9e('0xc3')][_0x0a9e('0xc7')]}});})['then'](function(_0x4156a5){socket[_0x0a9e('0xd0')](_0x0a9e('0xd1'),{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]});return{'id':Number(_0x370b5e[_0x0a9e('0xbe')]['id']),'tags':_0x4156a5||[]};});}})['then'](respondWithResult(_0x1ba457,null))['catch'](handleError(_0x1ba457,null));};exports[_0x0a9e('0xd2')]=function(_0x33bcb2,_0x2a293f,_0x5e85d0){return db[_0x0a9e('0x2d')][_0x0a9e('0x5d')]({'where':{'id':_0x33bcb2[_0x0a9e('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2a293f,null))[_0x0a9e('0x22')](function(_0x2bf85d){if(_0x2bf85d){return _0x2bf85d[_0x0a9e('0xd2')](_0x33bcb2['query'][_0x0a9e('0xc7')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x2a293f,null))[_0x0a9e('0x33')](handleError(_0x2a293f,null));};exports['download']=function(_0x549697,_0x53ef46){var _0x3b04fd=moment()[_0x0a9e('0xd3')]()[_0x0a9e('0x94')]();var _0x26931c=path['join'](config[_0x0a9e('0xd4')],'server',_0x0a9e('0xd5'),_0x0a9e('0xd6'));var _0x242f23=path['join'](config[_0x0a9e('0xd4')],_0x0a9e('0xd7'),_0x0a9e('0xd5'),'attachments');var _0x40eb5d=path['join'](_0x26931c,_0x3b04fd);var _0x1b637c=util['format'](_0x0a9e('0xd8'),_0x549697['params']['id'],_0x3b04fd);var _0xb14971=path[_0x0a9e('0xd9')](_0x26931c,_0x1b637c);var _0xa288e4=[];if(_0x549697[_0x0a9e('0x39')][_0x0a9e('0xda')]){_0xa288e4[_0x0a9e('0xba')]({'model':db[_0x0a9e('0xdb')],'as':'Attachments','raw':!![]});}var _0x35ace3=[{'model':db[_0x0a9e('0xc6')],'as':'Messages','attributes':['id',_0x0a9e('0xc3'),_0x0a9e('0x47'),'to','cc','bcc',_0x0a9e('0xdc'),_0x0a9e('0x6f')],'where':{'secret':![]},'order':qs[_0x0a9e('0x41')]('id'),'include':_0xa288e4}];return db['MailInteraction'][_0x0a9e('0x5d')]({'where':{'id':_0x549697[_0x0a9e('0xbe')]['id']},'include':_0x35ace3})[_0x0a9e('0x22')](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x22')](function(_0x2003bc){if(_0x2003bc&&_0x2003bc[_0x0a9e('0xdd')]){var _0x3ba897=_0x2003bc[_0x0a9e('0xde')]({'plain':!![]});fs[_0x0a9e('0xdf')](_0x40eb5d);return BPromise[_0x0a9e('0xe0')](_0x3ba897['Messages'],function(_0x1799d8,_0x53c7de){var _0x3c9854={'from':_0x1799d8[_0x0a9e('0x47')],'to':_0x1799d8['to'],'subject':_0x1799d8[_0x0a9e('0xdc')],'html':_0x1799d8[_0x0a9e('0xc3')],'headers':{'Date':moment(_0x1799d8[_0x0a9e('0x6f')])[_0x0a9e('0xca')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1799d8['cc']){_0x3c9854[_0x0a9e('0xe1')]['Cc']=_0x1799d8['cc'];}if(_0x1799d8[_0x0a9e('0xe2')]){_0x3c9854[_0x0a9e('0xe1')]['Bcc']=_0x1799d8[_0x0a9e('0xe2')];}return new BPromise(function(_0x402544,_0x4435d2){if(_0x1799d8[_0x0a9e('0xe3')]){for(var _0x31e1e0=0x0;_0x31e1e0<_0x1799d8[_0x0a9e('0xe3')][_0x0a9e('0x3e')];_0x31e1e0++){var _0x5f2c51=_0x1799d8[_0x0a9e('0xe3')][_0x31e1e0];var _0x228c10=path[_0x0a9e('0xd9')](_0x242f23,_0x5f2c51[_0x0a9e('0xe4')]);if(fs[_0x0a9e('0xe5')](_0x228c10)){_0x3c9854[_0x0a9e('0xda')][_0x0a9e('0xba')]({'name':_0x5f2c51['name'],'contentType':_0x5f2c51['type'],'data':fs[_0x0a9e('0xe6')](_0x228c10)});}}}emlformat[_0x0a9e('0xe7')](_0x3c9854,function(_0x1f4929,_0x1bf692){if(_0x1f4929)return _0x4435d2(_0x1f4929);fs[_0x0a9e('0xe8')](path[_0x0a9e('0xd9')](_0x40eb5d,util[_0x0a9e('0xca')]('message%d.eml',_0x53c7de)),_0x1bf692);return _0x402544(_0x1bf692);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1d7fc4,_0x2d8e91){zipdir(_0x40eb5d,{'saveTo':_0xb14971},function(_0x2675a5,_0x1b1757){if(_0x2675a5)return _0x2d8e91(_0x2675a5);return _0x1d7fc4(_0x1b1757);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x16be7e,_0x54f0b8){rimraf(_0x40eb5d,function(_0x311288){if(_0x311288)_0x54f0b8(_0x311288);return _0x16be7e();});});})[_0x0a9e('0x22')](function(){return _0x53ef46[_0x0a9e('0xe9')](_0xb14971,_0x1b637c,function(_0x5885c3){if(_0x5885c3){console[_0x0a9e('0xea')](_0x0a9e('0xeb'),_0x5885c3);}else{fs[_0x0a9e('0xec')](_0xb14971);}});});});}else{return _0x53ef46[_0x0a9e('0x23')](0xc8);}})['catch'](handleError(_0x53ef46,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 2a8e6bf..ba03239 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 _0x7b50=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x4de89e,_0x1e8bd1){var _0x3d9b79=function(_0x3629ae){while(--_0x3629ae){_0x4de89e['push'](_0x4de89e['shift']());}};_0x3d9b79(++_0x1e8bd1);}(_0x7b50,0x1a5));var _0x07b5=function(_0x2ea04e,_0x3366ae){_0x2ea04e=_0x2ea04e-0x0;var _0x141f70=_0x7b50[_0x2ea04e];return _0x141f70;};'use strict';var EventEmitter=require(_0x07b5('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x07b5('0x1')](0x0);var events={'afterCreate':_0x07b5('0x2'),'afterUpdate':_0x07b5('0x3'),'afterDestroy':_0x07b5('0x4')};function emitEvent(_0x270ef9){return function(_0x3384dd,_0x259ac0,_0x541e9e){_0x3384dd[_0x07b5('0x5')]({'attributes':['id'],'raw':!![]})[_0x07b5('0x6')](function(_0x36eb41){_0x3384dd[_0x07b5('0x7')](_0x07b5('0x8'),_0x36eb41[_0x07b5('0x9')](function(_0x594e51){return{'id':_0x594e51['id']};}));return MailMessage[_0x07b5('0xa')]({'where':{'MailInteractionId':_0x3384dd['id'],'direction':'in','read':![]},'raw':!![]});})[_0x07b5('0x6')](function(_0x20a683){_0x3384dd['setDataValue'](_0x07b5('0xb'),_0x20a683[_0x07b5('0xc')]);MailInteractionEvents[_0x07b5('0xd')](_0x270ef9+':'+_0x3384dd['id'],_0x3384dd);MailInteractionEvents['emit'](_0x270ef9,_0x3384dd);_0x541e9e(null);})[_0x07b5('0xe')](_0x541e9e(null));};}for(var e in events){if(events[_0x07b5('0xf')](e)){var event=events[e];MailInteraction[_0x07b5('0x10')](e,emitEvent(event));}}module[_0x07b5('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0x793f=['remove','getUsers','then','setDataValue','findAll','unreadMessages','length','emit','catch','../../mysqldb','MailInteraction','setMaxListeners','save','update'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x793f,0xa3));var _0xf793=function(_0x177350,_0x219bdb){_0x177350=_0x177350-0x0;var _0x32bc81=_0x793f[_0x177350];return _0x32bc81;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xf793('0x0'))['db'][_0xf793('0x1')];var MailMessage=require(_0xf793('0x0'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf793('0x2')](0x0);var events={'afterCreate':_0xf793('0x3'),'afterUpdate':_0xf793('0x4'),'afterDestroy':_0xf793('0x5')};function emitEvent(_0x39e826){return function(_0x2712b5,_0x29d1c7,_0x567398){_0x2712b5[_0xf793('0x6')]({'attributes':['id'],'raw':!![]})[_0xf793('0x7')](function(_0x5aceb0){_0x2712b5[_0xf793('0x8')]('Users',_0x5aceb0['map'](function(_0x51158f){return{'id':_0x51158f['id']};}));return MailMessage[_0xf793('0x9')]({'where':{'MailInteractionId':_0x2712b5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf793('0x7')](function(_0x1c3722){_0x2712b5[_0xf793('0x8')](_0xf793('0xa'),_0x1c3722[_0xf793('0xb')]);MailInteractionEvents['emit'](_0x39e826+':'+_0x2712b5['id'],_0x2712b5);MailInteractionEvents[_0xf793('0xc')](_0x39e826,_0x2712b5);_0x567398(null);})[_0xf793('0xd')](_0x567398(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](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 d3042e0..ff6b460 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 _0x34e8=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then','catch','utf8mb4_unicode_ci'];(function(_0x25029a,_0x1319fd){var _0x1d00aa=function(_0x2f69f7){while(--_0x2f69f7){_0x25029a['push'](_0x25029a['shift']());}};_0x1d00aa(++_0x1319fd);}(_0x34e8,0x12c));var _0x834e=function(_0x3fd472,_0x4e0d11){_0x3fd472=_0x3fd472-0x0;var _0x55ca60=_0x34e8[_0x3fd472];return _0x55ca60;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[{'name':_0x834e('0xd'),'fields':[_0x834e('0xe'),'to'],'type':_0x834e('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x23501c,_0x363786,_0x1af45a){if(_0x23501c[_0x834e('0x10')]){_0x23501c[_0x834e('0x11')]=moment()[_0x834e('0x12')](_0x834e('0x13'));}if(_0x23501c[_0x834e('0x14')]){_0x23501c[_0x834e('0x15')]=moment()[_0x834e('0x12')](_0x834e('0x13'));}_0x1af45a(null,_0x363786);},'beforeUpdate':function(_0x2fd95c,_0x538bb3,_0x5e5b6d){if(_0x2fd95c[_0x834e('0x16')]('substatus')){_0x2fd95c[_0x834e('0x11')]=_0x2fd95c[_0x834e('0x10')]?moment()[_0x834e('0x12')](_0x834e('0x13')):null;}if(_0x2fd95c['changed'](_0x834e('0x14'))){_0x2fd95c[_0x834e('0x15')]=moment()['format'](_0x834e('0x13'));_0x2fd95c['substatus']=null;_0x2fd95c[_0x834e('0x11')]=null;}_0x5e5b6d(null,_0x2fd95c);},'afterUpdate':function(_0x36d443,_0x478afe,_0x43ac41){var _0x22106e=_0x4a2018[_0x834e('0x17')];var _0x50b3f6=_0x36d443[_0x834e('0x18')]({'plain':!![]});if(_0x50b3f6[_0x834e('0x14')]){return _0x22106e[_0x834e('0x19')][_0x834e('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x50b3f6['id']}})[_0x834e('0x1b')](function(){_0x43ac41();})[_0x834e('0x1c')](function(_0x1dd214){_0x43ac41(_0x1dd214);});}else{_0x43ac41();}}},'charset':'utf8mb4','collate':_0x834e('0x1d')});}; \ No newline at end of file +var _0x3e74=['changed','substatus','models','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','path','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','closed','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3e74,0x175));var _0x43e7=function(_0x5b2e87,_0x54e206){_0x5b2e87=_0x5b2e87-0x0;var _0xdf7aae=_0x3e74[_0x5b2e87];return _0xdf7aae;};'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 fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[{'name':_0x43e7('0xa'),'fields':[_0x43e7('0xb'),'to'],'type':_0x43e7('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x516b4d,_0x212c6c,_0x554d44){if(_0x516b4d['substatus']){_0x516b4d[_0x43e7('0xd')]=moment()[_0x43e7('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x516b4d[_0x43e7('0xf')]){_0x516b4d['closedAt']=moment()[_0x43e7('0xe')](_0x43e7('0x10'));}_0x554d44(null,_0x212c6c);},'beforeUpdate':function(_0x4ebc8e,_0x3eb206,_0xc960ea){if(_0x4ebc8e[_0x43e7('0x11')](_0x43e7('0x12'))){_0x4ebc8e['substatusAt']=_0x4ebc8e['substatus']?moment()[_0x43e7('0xe')](_0x43e7('0x10')):null;}if(_0x4ebc8e[_0x43e7('0x11')]('closed')){_0x4ebc8e['closedAt']=moment()[_0x43e7('0xe')](_0x43e7('0x10'));_0x4ebc8e[_0x43e7('0x12')]=null;_0x4ebc8e[_0x43e7('0xd')]=null;}_0xc960ea(null,_0x4ebc8e);},'afterUpdate':function(_0x4de324,_0x5c4eaa,_0xdf16c){var _0x264575=_0x1c503b[_0x43e7('0x13')];var _0x5d346f=_0x4de324['get']({'plain':!![]});if(_0x5d346f[_0x43e7('0xf')]){return _0x264575[_0x43e7('0x14')][_0x43e7('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x5d346f['id']}})[_0x43e7('0x16')](function(){_0xdf16c();})[_0x43e7('0x17')](function(_0x1f24fb){_0xdf16c(_0x1f24fb);});}else{_0xdf16c();}}},'charset':_0x43e7('0x18'),'collate':_0x43e7('0x19')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 9ff91f0..c8118fd 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 _0xf12a=['error','code','message','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToMailInteraction','find','ids','omit','info','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x27ac32,_0x42771f){var _0x20c811=function(_0x12d837){while(--_0x12d837){_0x27ac32['push'](_0x27ac32['shift']());}};_0x20c811(++_0x42771f);}(_0xf12a,0x8e));var _0xaf12=function(_0x4557dc,_0x3687b2){_0x4557dc=_0x4557dc-0x0;var _0x1377aa=_0xf12a[_0x4557dc];return _0x1377aa;};'use strict';var _=require(_0xaf12('0x0'));var util=require(_0xaf12('0x1'));var moment=require(_0xaf12('0x2'));var BPromise=require(_0xaf12('0x3'));var rs=require(_0xaf12('0x4'));var fs=require('fs');var Redis=require(_0xaf12('0x5'));var db=require(_0xaf12('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xaf12('0x7'));var config=require('../../config/environment');var jayson=require(_0xaf12('0x8'));var client=jayson['client'][_0xaf12('0x9')]({'port':0x232a});config['redis']=_[_0xaf12('0xa')](config[_0xaf12('0xb')],{'host':_0xaf12('0xc'),'port':0x18eb});var socket=require(_0xaf12('0xd'))(new Redis(config[_0xaf12('0xb')]));require(_0xaf12('0xe'))[_0xaf12('0xf')](socket);function respondWithRpcPromise(_0x267cb7,_0x58b82f,_0x1d11b8){return new BPromise(function(_0x5b69e2,_0x62b12d){return client['request'](_0x267cb7,_0x1d11b8)[_0xaf12('0x10')](function(_0x568921){logger['info'](_0xaf12('0x11'),_0x58b82f,_0xaf12('0x12'));logger[_0xaf12('0x13')](_0xaf12('0x14'),_0x58b82f,_0xaf12('0x12'),JSON[_0xaf12('0x15')](_0x568921));if(_0x568921[_0xaf12('0x16')]){if(_0x568921[_0xaf12('0x16')][_0xaf12('0x17')]===0x1f4){logger[_0xaf12('0x16')](_0xaf12('0x11'),_0x58b82f,_0x568921[_0xaf12('0x16')][_0xaf12('0x18')]);return _0x62b12d(_0x568921[_0xaf12('0x16')][_0xaf12('0x18')]);}logger[_0xaf12('0x16')](_0xaf12('0x11'),_0x58b82f,_0x568921['error'][_0xaf12('0x18')]);return _0x5b69e2(_0x568921[_0xaf12('0x16')]['message']);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x58b82f,_0xaf12('0x12'));_0x5b69e2(_0x568921['result'][_0xaf12('0x18')]);}})['catch'](function(_0xc1290c){logger[_0xaf12('0x16')](_0xaf12('0x11'),_0x58b82f,_0xc1290c);_0x62b12d(_0xc1290c);});});}exports[_0xaf12('0x19')]=function(_0x50660c){var _0x3ccdd8=this;return new Promise(function(_0x149f94,_0x3e81ce){return db[_0xaf12('0x1a')][_0xaf12('0x1b')](_0x50660c[_0xaf12('0x1c')],{'raw':_0x50660c[_0xaf12('0x1d')]?_0x50660c[_0xaf12('0x1d')][_0xaf12('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50660c[_0xaf12('0x1d')]?_0x50660c[_0xaf12('0x1d')][_0xaf12('0x1f')]||null:null,'attributes':_0x50660c[_0xaf12('0x1d')]?_0x50660c['options'][_0xaf12('0x20')]||null:null,'limit':_0x50660c['options']?_0x50660c['options'][_0xaf12('0x21')]||null:null})[_0xaf12('0x10')](function(_0x1b66bc){logger['info'](_0xaf12('0x19'),_0x50660c);logger[_0xaf12('0x13')]('UpdateMailInteraction',_0x50660c,JSON[_0xaf12('0x15')](_0x1b66bc));_0x149f94(_0x1b66bc);})[_0xaf12('0x22')](function(_0x478286){logger[_0xaf12('0x16')](_0xaf12('0x19'),_0x478286[_0xaf12('0x18')],_0x50660c);_0x3e81ce(_0x3ccdd8[_0xaf12('0x16')](0x1f4,_0x478286[_0xaf12('0x18')]));});});};exports[_0xaf12('0x23')]=function(_0x590872){return new Promise(function(_0x3b5ab8,_0x59328c){return db[_0xaf12('0x1a')][_0xaf12('0x24')]({'where':_0x590872[_0xaf12('0x1d')]?_0x590872['options']['where']||null:null})['then'](function(_0x532e6e){if(_0x532e6e){return _0x532e6e['addTags'](_0x590872['body'][_0xaf12('0x25')],_[_0xaf12('0x26')](_0x590872[_0xaf12('0x1c')],[_0xaf12('0x25'),'id'])||{});}})['spread'](function(_0x4362cb){logger[_0xaf12('0x27')]('AddTags',_0x590872);logger[_0xaf12('0x13')]('AddTags',_0x590872,JSON[_0xaf12('0x15')](_0x4362cb));_0x3b5ab8(_0x4362cb);})[_0xaf12('0x22')](function(_0x45e5db){logger[_0xaf12('0x16')](_0xaf12('0x28'),_0x45e5db['message'],_0x590872);_0x59328c(_this[_0xaf12('0x16')](0x1f4,_0x45e5db[_0xaf12('0x18')]));});});}; \ No newline at end of file +var _0x2948=['spread','catch','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','./mailInteraction.socket','request','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateMailInteraction','MailInteraction','body','options','raw','where','attributes','limit','then','AddTagsToMailInteraction','find','ids','omit'];(function(_0x3bae41,_0x5561de){var _0x5a2203=function(_0xf1d224){while(--_0xf1d224){_0x3bae41['push'](_0x3bae41['shift']());}};_0x5a2203(++_0x5561de);}(_0x2948,0xcb));var _0x8294=function(_0x588378,_0x4765d7){_0x588378=_0x588378-0x0;var _0x15298d=_0x2948[_0x588378];return _0x15298d;};'use strict';var _=require(_0x8294('0x0'));var util=require(_0x8294('0x1'));var moment=require(_0x8294('0x2'));var BPromise=require(_0x8294('0x3'));var rs=require(_0x8294('0x4'));var fs=require('fs');var Redis=require(_0x8294('0x5'));var db=require(_0x8294('0x6'))['db'];var utils=require(_0x8294('0x7'));var logger=require(_0x8294('0x8'))('rpc');var config=require(_0x8294('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8294('0xa')][_0x8294('0xb')]({'port':0x232a});config[_0x8294('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8294('0xc')]));require(_0x8294('0xd'))['register'](socket);function respondWithRpcPromise(_0x35aa7a,_0x3e7ac4,_0x266d88){return new BPromise(function(_0x82e937,_0x3e5d4a){return client[_0x8294('0xe')](_0x35aa7a,_0x266d88)['then'](function(_0x179208){logger[_0x8294('0xf')](_0x8294('0x10'),_0x3e7ac4,_0x8294('0x11'));logger[_0x8294('0x12')](_0x8294('0x13'),_0x3e7ac4,_0x8294('0x11'),JSON[_0x8294('0x14')](_0x179208));if(_0x179208['error']){if(_0x179208[_0x8294('0x15')][_0x8294('0x16')]===0x1f4){logger[_0x8294('0x15')]('MailInteraction,\x20%s,\x20%s',_0x3e7ac4,_0x179208['error']['message']);return _0x3e5d4a(_0x179208[_0x8294('0x15')][_0x8294('0x17')]);}logger[_0x8294('0x15')](_0x8294('0x10'),_0x3e7ac4,_0x179208[_0x8294('0x15')][_0x8294('0x17')]);return _0x82e937(_0x179208[_0x8294('0x15')][_0x8294('0x17')]);}else{logger[_0x8294('0xf')](_0x8294('0x10'),_0x3e7ac4,_0x8294('0x11'));_0x82e937(_0x179208['result'][_0x8294('0x17')]);}})['catch'](function(_0x470e21){logger[_0x8294('0x15')](_0x8294('0x10'),_0x3e7ac4,_0x470e21);_0x3e5d4a(_0x470e21);});});}exports[_0x8294('0x18')]=function(_0x30f80b){var _0x1edffd=this;return new Promise(function(_0x38380b,_0x27273d){return db[_0x8294('0x19')]['update'](_0x30f80b[_0x8294('0x1a')],{'raw':_0x30f80b[_0x8294('0x1b')]?_0x30f80b['options'][_0x8294('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30f80b[_0x8294('0x1b')]?_0x30f80b[_0x8294('0x1b')][_0x8294('0x1d')]||null:null,'attributes':_0x30f80b[_0x8294('0x1b')]?_0x30f80b[_0x8294('0x1b')][_0x8294('0x1e')]||null:null,'limit':_0x30f80b[_0x8294('0x1b')]?_0x30f80b[_0x8294('0x1b')][_0x8294('0x1f')]||null:null})[_0x8294('0x20')](function(_0x54fbf3){logger['info'](_0x8294('0x18'),_0x30f80b);logger['debug'](_0x8294('0x18'),_0x30f80b,JSON['stringify'](_0x54fbf3));_0x38380b(_0x54fbf3);})['catch'](function(_0x37601e){logger[_0x8294('0x15')]('UpdateMailInteraction',_0x37601e[_0x8294('0x17')],_0x30f80b);_0x27273d(_0x1edffd[_0x8294('0x15')](0x1f4,_0x37601e[_0x8294('0x17')]));});});};exports[_0x8294('0x21')]=function(_0x58c4d2){return new Promise(function(_0x4ce49e,_0x311e6b){return db[_0x8294('0x19')][_0x8294('0x22')]({'where':_0x58c4d2['options']?_0x58c4d2['options'][_0x8294('0x1d')]||null:null})[_0x8294('0x20')](function(_0x32cb49){if(_0x32cb49){return _0x32cb49['addTags'](_0x58c4d2['body'][_0x8294('0x23')],_[_0x8294('0x24')](_0x58c4d2['body'],[_0x8294('0x23'),'id'])||{});}})[_0x8294('0x25')](function(_0x5808fa){logger[_0x8294('0xf')]('AddTags',_0x58c4d2);logger[_0x8294('0x12')]('AddTags',_0x58c4d2,JSON[_0x8294('0x14')](_0x5808fa));_0x4ce49e(_0x5808fa);})[_0x8294('0x26')](function(_0x35a9cc){logger[_0x8294('0x15')](_0x8294('0x27'),_0x35a9cc[_0x8294('0x17')],_0x58c4d2);_0x311e6b(_this[_0x8294('0x15')](0x1f4,_0x35a9cc['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index b749f85..f3cab68 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 _0x90d5=['emit','removeListener','register','mailInteraction:','./mailInteraction.events','save'];(function(_0x43444b,_0x8cf95b){var _0x392fe5=function(_0x7a1a82){while(--_0x7a1a82){_0x43444b['push'](_0x43444b['shift']());}};_0x392fe5(++_0x8cf95b);}(_0x90d5,0x19c));var _0x590d=function(_0x1f3701,_0x4c8dec){_0x1f3701=_0x1f3701-0x0;var _0xe6eaeb=_0x90d5[_0x1f3701];return _0xe6eaeb;};'use strict';var MailInteractionEvents=require(_0x590d('0x0'));var events=[_0x590d('0x1'),'remove','update'];function createListener(_0x2f3f7e,_0x29f57b){return function(_0x5cd25e){_0x29f57b[_0x590d('0x2')](_0x2f3f7e,_0x5cd25e);};}function removeListener(_0x38950c,_0x3fbb97){return function(){MailInteractionEvents[_0x590d('0x3')](_0x38950c,_0x3fbb97);};}exports[_0x590d('0x4')]=function(_0x5a8a28){for(var _0x56b2c0=0x0,_0x53bfe4=events['length'];_0x56b2c0<_0x53bfe4;_0x56b2c0++){var _0x3fdc24=events[_0x56b2c0];var _0x21ad1f=createListener(_0x590d('0x5')+_0x3fdc24,_0x5a8a28);MailInteractionEvents['on'](_0x3fdc24,_0x21ad1f);}}; \ No newline at end of file +var _0x2017=['mailInteraction:','save','remove','update','length'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2017,0xce));var _0x7201=function(_0x1ba43c,_0x5bd2e8){_0x1ba43c=_0x1ba43c-0x0;var _0x2f60eb=_0x2017[_0x1ba43c];return _0x2f60eb;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x7201('0x0'),_0x7201('0x1'),_0x7201('0x2')];function createListener(_0x1c1588,_0xe93715){return function(_0x33c6c7){_0xe93715['emit'](_0x1c1588,_0x33c6c7);};}function removeListener(_0x40d398,_0x2780ad){return function(){MailInteractionEvents['removeListener'](_0x40d398,_0x2780ad);};}exports['register']=function(_0x2b32ea){for(var _0x4bb14b=0x0,_0x23e37e=events[_0x7201('0x3')];_0x4bb14b<_0x23e37e;_0x4bb14b++){var _0x107c45=events[_0x4bb14b];var _0x40f0c4=createListener(_0x7201('0x4')+_0x107c45,_0x2b32ea);MailInteractionEvents['on'](_0x107c45,_0x40f0c4);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 7eb775c..e88261d 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 _0x4b84=['express','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','/:id','put','accept','/:id/reject','delete','destroy','multer','util'];(function(_0xe785b4,_0x40dcc6){var _0x29faf0=function(_0x4ad034){while(--_0x4ad034){_0xe785b4['push'](_0xe785b4['shift']());}};_0x29faf0(++_0x40dcc6);}(_0x4b84,0x1cc));var _0x44b8=function(_0xd299c3,_0x4ba0f1){_0xd299c3=_0xd299c3-0x0;var _0x376574=_0x4b84[_0xd299c3];return _0x376574;};'use strict';var multer=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44b8('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x44b8('0x3'));var config=require(_0x44b8('0x4'));var controller=require(_0x44b8('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x44b8('0x6')]('/describe',auth[_0x44b8('0x7')](),controller['describe']);router[_0x44b8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x44b8('0x8')]);router[_0x44b8('0x6')](_0x44b8('0x9'),auth['isAuthenticated'](),controller[_0x44b8('0xa')]);router[_0x44b8('0xb')]('/',auth[_0x44b8('0x7')](),interaction[_0x44b8('0xc')](_0x44b8('0xd'),_0x44b8('0xe')),controller[_0x44b8('0xf')]);router['put'](_0x44b8('0x10'),auth[_0x44b8('0x7')](),controller['update']);router[_0x44b8('0x11')]('/:id/accept',auth[_0x44b8('0x7')](),controller[_0x44b8('0x12')]);router['put'](_0x44b8('0x13'),auth['isAuthenticated'](),controller['reject']);router[_0x44b8('0x14')](_0x44b8('0x10'),auth[_0x44b8('0x7')](),controller[_0x44b8('0x15')]);module['exports']=router; \ No newline at end of file +var _0x425d=['show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id'];(function(_0x2499c8,_0x947ef3){var _0x29f0be=function(_0x38093f){while(--_0x38093f){_0x2499c8['push'](_0x2499c8['shift']());}};_0x29f0be(++_0x947ef3);}(_0x425d,0x1e0));var _0xd425=function(_0x39fdad,_0x1b8980){_0x39fdad=_0x39fdad-0x0;var _0x2089a1=_0x425d[_0x39fdad];return _0x2089a1;};'use strict';var multer=require(_0xd425('0x0'));var util=require('util');var path=require(_0xd425('0x1'));var timeout=require(_0xd425('0x2'));var express=require(_0xd425('0x3'));var router=express[_0xd425('0x4')]();var auth=require(_0xd425('0x5'));var interaction=require(_0xd425('0x6'));var config=require(_0xd425('0x7'));var controller=require('./mailMessage.controller');router[_0xd425('0x8')]('/',auth[_0xd425('0x9')](),controller[_0xd425('0xa')]);router[_0xd425('0x8')](_0xd425('0xb'),auth[_0xd425('0x9')](),controller['describe']);router[_0xd425('0x8')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0xd')]);router[_0xd425('0x8')](_0xd425('0xe'),auth[_0xd425('0x9')](),controller[_0xd425('0xf')]);router[_0xd425('0x10')]('/',auth[_0xd425('0x9')](),interaction[_0xd425('0x11')](_0xd425('0x12'),_0xd425('0x13')),controller[_0xd425('0x14')]);router[_0xd425('0x15')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0x16')]);router[_0xd425('0x15')](_0xd425('0x17'),auth['isAuthenticated'](),controller[_0xd425('0x18')]);router[_0xd425('0x15')](_0xd425('0x19'),auth['isAuthenticated'](),controller[_0xd425('0x1a')]);router[_0xd425('0x1b')](_0xd425('0xc'),auth[_0xd425('0x9')](),controller[_0xd425('0x1c')]);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 16ff454..be9e95d 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 _0x09df=['out','long','DATE','INTEGER','BOOLEAN','sequelize','lodash','TEXT','medium'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x09df,0x164));var _0xf09d=function(_0x52c4e9,_0x5412d0){_0x52c4e9=_0x52c4e9-0x0;var _0x252a03=_0x09df[_0x52c4e9];return _0x252a03;};'use strict';var Sequelize=require(_0xf09d('0x0'));var _=require(_0xf09d('0x1'));module['exports']={'body':{'type':Sequelize[_0xf09d('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xf09d('0x3'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf09d('0x4')),'defaultValue':_0xf09d('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0xf09d('0x5'))},'cc':{'type':Sequelize['TEXT'](_0xf09d('0x5'))},'bcc':{'type':Sequelize[_0xf09d('0x2')](_0xf09d('0x5'))},'subject':{'type':Sequelize[_0xf09d('0x2')]},'sentAt':{'type':Sequelize[_0xf09d('0x6')]},'attach':{'type':Sequelize[_0xf09d('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xf09d('0x8')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xf09d('0x2')](_0xf09d('0x5'))},'originCc':{'type':Sequelize['TEXT'](_0xf09d('0x5'))}}; \ No newline at end of file +var _0xd3c8=['DATE','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x68f237,_0x208dc1){var _0x390e2e=function(_0x50685b){while(--_0x50685b){_0x68f237['push'](_0x68f237['shift']());}};_0x390e2e(++_0x208dc1);}(_0xd3c8,0x161));var _0x8d3c=function(_0x4ad459,_0x2d602b){_0x4ad459=_0x4ad459-0x0;var _0x5ab5b7=_0xd3c8[_0x4ad459];return _0x5ab5b7;};'use strict';var Sequelize=require(_0x8d3c('0x0'));var _=require(_0x8d3c('0x1'));module[_0x8d3c('0x2')]={'body':{'type':Sequelize[_0x8d3c('0x3')](_0x8d3c('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8d3c('0x5'))},'read':{'type':Sequelize[_0x8d3c('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8d3c('0x7')]('in',_0x8d3c('0x8')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x8d3c('0x9')](0x1fe)},'from':{'type':Sequelize[_0x8d3c('0x9')]},'to':{'type':Sequelize[_0x8d3c('0x3')](_0x8d3c('0x4'))},'cc':{'type':Sequelize[_0x8d3c('0x3')](_0x8d3c('0x4'))},'bcc':{'type':Sequelize[_0x8d3c('0x3')](_0x8d3c('0x4'))},'subject':{'type':Sequelize[_0x8d3c('0x3')]},'sentAt':{'type':Sequelize[_0x8d3c('0xa')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x8d3c('0x3')](_0x8d3c('0x4'))},'originCc':{'type':Sequelize[_0x8d3c('0x3')](_0x8d3c('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index c8c563d..2fcf2e2 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 _0x8743=['offset','set','Content-Range','apply','save','update','destroy','stack','name','send','map','MailMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','count','includeAll','include','findAll','show','params','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','List','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','pass','user','attachments','root','server/files/attachments','basename','ListId','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','mail-interactions','accept','readAt','UserId','Contact','get','MailInteraction','MailInteractionId','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','mail','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','reject','rejectmessage','download','unix','toString','join','server','files','subject','createdAt','Attachment','Attachments','from','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','existsSync','push','readFileSync','build','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','http','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json'];(function(_0x3f92c2,_0x371fe1){var _0x1e964b=function(_0x56c06e){while(--_0x56c06e){_0x3f92c2['push'](_0x3f92c2['shift']());}};_0x1e964b(++_0x371fe1);}(_0x8743,0x7a));var _0x3874=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8743[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require(_0x3874('0x0'));var emlformat=require(_0x3874('0x1'));var rimraf=require(_0x3874('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3874('0x3'));var rp=require(_0x3874('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3874('0x5'));var util=require(_0x3874('0x6'));var path=require(_0x3874('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3874('0x8'));var fs=require('fs');var _=require(_0x3874('0x9'));var squel=require('squel');var crypto=require(_0x3874('0xa'));var jsforce=require(_0x3874('0xb'));var deskjs=require(_0x3874('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3874('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x3874('0xe'));var as=require(_0x3874('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3874('0x10'));var utils=require(_0x3874('0x11'));var config=require(_0x3874('0x12'));var db=require(_0x3874('0x13'))['db'];config[_0x3874('0x14')]=_[_0x3874('0x15')](config['redis'],{'host':_0x3874('0x16'),'port':0x18eb});var socket=require(_0x3874('0x17'))(new Redis(config[_0x3874('0x14')]));require(_0x3874('0x18'))[_0x3874('0x19')](socket);var jayson=require(_0x3874('0x1a'));var client=jayson['client'][_0x3874('0x1b')]({'port':0x232c});var client9003=jayson[_0x3874('0x1c')][_0x3874('0x1b')]({'port':0x232b});var client9002=jayson[_0x3874('0x1c')][_0x3874('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x5dc254,_0x2518ef,_0x25809d){if(_0x25809d){var _0x4b2bf0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b2bf0[_0x3874('0x1d')](_0x2518ef)){return _0x5dc254;}else{throw new db[(_0x3874('0x1e'))][(_0x3874('0x1f'))](_0x3874('0x20'));}}else{return _0x5dc254;}}function respondWithRpcPromise(_0xbf0834,_0x2798ae,_0x3edf78,_0x47e806){return new BPromise(function(_0x47c2f3,_0x56b53f){var _0x10a778=_0x47e806||client;return _0x10a778[_0x3874('0x21')](_0xbf0834,_0x3edf78)[_0x3874('0x22')](function(_0x2f45bc){logger[_0x3874('0x23')](_0x3874('0x24'),_0x2798ae,_0x3874('0x25'));logger['debug'](_0x3874('0x26'),_0x2798ae,'request\x20sent',JSON[_0x3874('0x27')](_0x2f45bc));if(_0x2f45bc[_0x3874('0x28')]){if(_0x2f45bc['error']['code']===0x1f4){logger[_0x3874('0x28')](_0x3874('0x24'),_0x2798ae,_0x2f45bc[_0x3874('0x28')]['message']);return _0x56b53f(_0x2f45bc[_0x3874('0x28')][_0x3874('0x29')]);}logger['error'](_0x3874('0x24'),_0x2798ae,_0x2f45bc[_0x3874('0x28')][_0x3874('0x29')]);return _0x47c2f3(_0x2f45bc[_0x3874('0x28')][_0x3874('0x29')]);}else{logger[_0x3874('0x23')](_0x3874('0x24'),_0x2798ae,_0x3874('0x25'));_0x47c2f3(_0x2f45bc[_0x3874('0x2a')][_0x3874('0x29')]);}})[_0x3874('0x2b')](function(_0x3e8bd2){logger[_0x3874('0x28')]('MailMessage,\x20%s,\x20%s',_0x2798ae,_0x3e8bd2);_0x56b53f(_0x3e8bd2);});});}function respondWithStatusCode(_0x4e6182,_0x23b2f9){_0x23b2f9=_0x23b2f9||0xcc;return function(_0x415dc2){if(_0x415dc2){return _0x4e6182[_0x3874('0x2c')](_0x23b2f9);}return _0x4e6182[_0x3874('0x2d')](_0x23b2f9)[_0x3874('0x2e')]();};}function respondWithResult(_0x42c854,_0x4eb71e){_0x4eb71e=_0x4eb71e||0xc8;return function(_0x564d09){if(_0x564d09){return _0x42c854[_0x3874('0x2d')](_0x4eb71e)[_0x3874('0x2f')](_0x564d09);}};}function respondWithFilteredResult(_0x3b4276,_0x37b371){return function(_0x119f2c){if(_0x119f2c){var _0x2ea0ca=_0x119f2c['count'],_0x13e6dd=_0x37b371[_0x3874('0x30')],_0x5d60dc=_0x37b371[_0x3874('0x30')]+_0x37b371['limit'],_0x34f371;if(_0x5d60dc>=_0x2ea0ca){_0x5d60dc=_0x2ea0ca;_0x34f371=0xc8;}else{_0x34f371=0xce;}_0x3b4276[_0x3874('0x2d')](_0x34f371);return _0x3b4276[_0x3874('0x31')](_0x3874('0x32'),_0x13e6dd+'-'+_0x5d60dc+'/'+_0x2ea0ca)[_0x3874('0x2f')](_0x119f2c);}return null;};}function patchUpdates(_0x54e00b){return function(_0xe8ae9b){try{jsonpatch[_0x3874('0x33')](_0xe8ae9b,_0x54e00b,!![]);}catch(_0xf3fdd2){return BPromise['reject'](_0xf3fdd2);}return _0xe8ae9b[_0x3874('0x34')]();};}function saveUpdates(_0x4cf938,_0x909fd0){return function(_0x336e4c){if(_0x336e4c){return _0x336e4c[_0x3874('0x35')](_0x4cf938)[_0x3874('0x22')](function(_0x2c47ce){return _0x2c47ce;});}return null;};}function removeEntity(_0x22282f,_0x246772){return function(_0x4bd8b8){if(_0x4bd8b8){return _0x4bd8b8[_0x3874('0x36')]()[_0x3874('0x22')](function(){_0x22282f[_0x3874('0x2d')](0xcc)[_0x3874('0x2e')]();});}};}function handleEntityNotFound(_0x2cfc8c,_0x5a82cc){return function(_0x46235e){if(!_0x46235e){_0x2cfc8c['sendStatus'](0x194);}return _0x46235e;};}function handleError(_0xf788a9,_0xc73d50){_0xc73d50=_0xc73d50||0x1f4;return function(_0x494aec){logger['error'](_0x494aec[_0x3874('0x37')]);if(_0x494aec['name']){delete _0x494aec[_0x3874('0x38')];}_0xf788a9[_0x3874('0x2d')](_0xc73d50)[_0x3874('0x39')](_0x494aec);};}exports['index']=function(_0x40d658,_0x383f64){var _0x3ad764={},_0x35a088={},_0x1721a6={'count':0x0,'rows':[]};var _0x227da0=_[_0x3874('0x3a')](db[_0x3874('0x3b')][_0x3874('0x3c')],function(_0x72e8de){return{'name':_0x72e8de['fieldName'],'type':_0x72e8de[_0x3874('0x3d')][_0x3874('0x3e')]};});_0x35a088[_0x3874('0x3f')]=_[_0x3874('0x3a')](_0x227da0,'name');_0x35a088[_0x3874('0x40')]=_[_0x3874('0x41')](_0x40d658[_0x3874('0x40')]);_0x35a088[_0x3874('0x42')]=_[_0x3874('0x43')](_0x35a088[_0x3874('0x3f')],_0x35a088['query']);_0x3ad764[_0x3874('0x44')]=_[_0x3874('0x43')](_0x35a088[_0x3874('0x3f')],qs[_0x3874('0x45')](_0x40d658[_0x3874('0x40')][_0x3874('0x45')]));_0x3ad764[_0x3874('0x44')]=_0x3ad764['attributes'][_0x3874('0x46')]?_0x3ad764[_0x3874('0x44')]:_0x35a088['model'];if(!_0x40d658[_0x3874('0x40')][_0x3874('0x47')](_0x3874('0x48'))){_0x3ad764[_0x3874('0x49')]=qs[_0x3874('0x49')](_0x40d658[_0x3874('0x40')][_0x3874('0x49')]);_0x3ad764[_0x3874('0x30')]=qs['offset'](_0x40d658[_0x3874('0x40')][_0x3874('0x30')]);}_0x3ad764[_0x3874('0x4a')]=qs['sort'](_0x40d658['query'][_0x3874('0x4b')]);_0x3ad764['where']=qs[_0x3874('0x42')](_[_0x3874('0x4c')](_0x40d658[_0x3874('0x40')],_0x35a088[_0x3874('0x42')]),_0x227da0);if(_0x40d658[_0x3874('0x40')][_0x3874('0x4d')]){_0x3ad764[_0x3874('0x4e')]=_['merge'](_0x3ad764[_0x3874('0x4e')],{'$or':_[_0x3874('0x3a')](_0x227da0,function(_0x23d066){if(_0x23d066[_0x3874('0x3d')]!=='VIRTUAL'){var _0x4c49c8={};_0x4c49c8[_0x23d066[_0x3874('0x38')]]={'$like':'%'+_0x40d658[_0x3874('0x40')][_0x3874('0x4d')]+'%'};return _0x4c49c8;}})});}_0x3ad764=_[_0x3874('0x4f')]({},_0x3ad764,_0x40d658[_0x3874('0x50')]);var _0x2b669f={'where':_0x3ad764[_0x3874('0x4e')]};return db['MailMessage']['count'](_0x2b669f)[_0x3874('0x22')](function(_0x2130b6){_0x1721a6[_0x3874('0x51')]=_0x2130b6;if(_0x40d658[_0x3874('0x40')][_0x3874('0x52')]){_0x3ad764[_0x3874('0x53')]=[{'all':!![]}];}return db[_0x3874('0x3b')][_0x3874('0x54')](_0x3ad764);})[_0x3874('0x22')](function(_0x34774){_0x1721a6['rows']=_0x34774;return _0x1721a6;})['then'](respondWithFilteredResult(_0x383f64,_0x3ad764))[_0x3874('0x2b')](handleError(_0x383f64,null));};exports[_0x3874('0x55')]=function(_0x4d7621,_0x39fa2d){var _0xf8714={'raw':!![],'where':{'id':_0x4d7621[_0x3874('0x56')]['id']}},_0x570dc2={};_0x570dc2['model']=_[_0x3874('0x41')](db[_0x3874('0x3b')][_0x3874('0x3c')]);_0x570dc2['query']=_[_0x3874('0x41')](_0x4d7621[_0x3874('0x40')]);_0x570dc2['filters']=_[_0x3874('0x43')](_0x570dc2[_0x3874('0x3f')],_0x570dc2[_0x3874('0x40')]);_0xf8714[_0x3874('0x44')]=_[_0x3874('0x43')](_0x570dc2[_0x3874('0x3f')],qs[_0x3874('0x45')](_0x4d7621[_0x3874('0x40')]['fields']));_0xf8714['attributes']=_0xf8714[_0x3874('0x44')][_0x3874('0x46')]?_0xf8714[_0x3874('0x44')]:_0x570dc2[_0x3874('0x3f')];if(_0x4d7621[_0x3874('0x40')][_0x3874('0x52')]){_0xf8714[_0x3874('0x53')]=[{'all':!![]}];}_0xf8714=_[_0x3874('0x4f')]({},_0xf8714,_0x4d7621[_0x3874('0x50')]);return db[_0x3874('0x3b')][_0x3874('0x57')](_0xf8714)[_0x3874('0x22')](handleEntityNotFound(_0x39fa2d,null))['then'](respondWithResult(_0x39fa2d,null))[_0x3874('0x2b')](handleError(_0x39fa2d,null));};exports[_0x3874('0x35')]=function(_0x56c94e,_0x5bbc1b){if(_0x56c94e[_0x3874('0x58')]['id']){delete _0x56c94e[_0x3874('0x58')]['id'];}return db['MailMessage'][_0x3874('0x57')]({'where':{'id':_0x56c94e[_0x3874('0x56')]['id']}})[_0x3874('0x22')](handleEntityNotFound(_0x5bbc1b,null))[_0x3874('0x22')](saveUpdates(_0x56c94e[_0x3874('0x58')],null))['then'](respondWithResult(_0x5bbc1b,null))[_0x3874('0x2b')](handleError(_0x5bbc1b,null));};exports[_0x3874('0x36')]=function(_0x510ec2,_0x11a069){return db[_0x3874('0x3b')][_0x3874('0x57')]({'where':{'id':_0x510ec2[_0x3874('0x56')]['id']}})[_0x3874('0x22')](handleEntityNotFound(_0x11a069,null))[_0x3874('0x22')](removeEntity(_0x11a069,null))[_0x3874('0x2b')](handleError(_0x11a069,null));};exports[_0x3874('0x59')]=function(_0x1c95f7,_0x431fd5){return db[_0x3874('0x3b')][_0x3874('0x59')]()[_0x3874('0x22')](respondWithResult(_0x431fd5,null))[_0x3874('0x2b')](handleError(_0x431fd5,null));};exports[_0x3874('0x5a')]=function(_0x1d9bdf,_0x9729a1){return db[_0x3874('0x3b')]['create'](_0x1d9bdf[_0x3874('0x58')])[_0x3874('0x22')](function(_0x2fd716){if(_0x2fd716){if(_0x2fd716[_0x3874('0x5b')]===_0x3874('0x5c')&&!_0x2fd716[_0x3874('0x5d')]){var _0xd40d24,_0x3ae389,_0x1a46a4;if(_0x1d9bdf[_0x3874('0x58')]['to']){_0x3ae389=_0x1d9bdf[_0x3874('0x58')]['to'][_0x3874('0x5e')](',')[0x0];}return db[_0x3874('0x5f')][_0x3874('0x60')]({'where':{'id':_0x2fd716[_0x3874('0x61')]},'include':[{'model':db['CmList'],'as':_0x3874('0x62'),'include':[{'model':db[_0x3874('0x63')],'as':_0x3874('0x64'),'where':{'email':_0x3ae389},'limit':0x1,'order':[['updatedAt',_0x3874('0x65')]]}]},{'model':db[_0x3874('0x66')],'as':_0x3874('0x67'),'raw':!![]}]})[_0x3874('0x22')](function(_0x3c6fa1){_0xd40d24=_0x3c6fa1;if(_0xd40d24&&_0xd40d24[_0x3874('0x67')]){var _0x1f2b87={'tls':{'rejectUnauthorized':![]}};if(_[_0x3874('0x68')](_0xd40d24[_0x3874('0x67')][_0x3874('0x69')])){_0x1f2b87[_0x3874('0x6a')]=_0xd40d24[_0x3874('0x67')][_0x3874('0x6a')];_0x1f2b87['port']=_0xd40d24[_0x3874('0x67')][_0x3874('0x6b')];_0x1f2b87['secure']=_0xd40d24['Smtp'][_0x3874('0x6c')];if(_0xd40d24[_0x3874('0x67')][_0x3874('0x6d')]){_0x1f2b87[_0x3874('0x6e')]={'user':_0xd40d24[_0x3874('0x67')]['user'],'pass':_0xd40d24[_0x3874('0x67')][_0x3874('0x6f')]};}}else{_0x1f2b87['service']=_0xd40d24['Smtp']['service'];_0x1f2b87[_0x3874('0x6e')]={'user':_0xd40d24[_0x3874('0x67')][_0x3874('0x70')],'pass':_0xd40d24['Smtp']['pass']};_0x1f2b87['secure']=_0xd40d24['Smtp'][_0x3874('0x6c')];}if(_0x1d9bdf['body'][_0x3874('0x71')]&&_0x1d9bdf[_0x3874('0x58')][_0x3874('0x71')][_0x3874('0x46')]){for(var _0x55ac93=0x0;_0x55ac93<_0x1d9bdf[_0x3874('0x58')][_0x3874('0x71')][_0x3874('0x46')];_0x55ac93+=0x1){_0x1d9bdf['body'][_0x3874('0x71')][_0x55ac93]={'filename':_0x1d9bdf[_0x3874('0x58')][_0x3874('0x71')][_0x55ac93]['name'],'path':path['join'](config[_0x3874('0x72')],_0x3874('0x73'),_0x1d9bdf['body'][_0x3874('0x71')][_0x55ac93][_0x3874('0x74')])};}}_0x1a46a4={'account':_0x1f2b87,'message':_0x1d9bdf[_0x3874('0x58')]};return;}})['then'](function(){if(_0xd40d24[_0x3874('0x62')]){if(_0xd40d24[_0x3874('0x62')][_0x3874('0x64')]['length']){return _0xd40d24[_0x3874('0x62')][_0x3874('0x64')][0x0];}else{return db[_0x3874('0x63')][_0x3874('0x5a')](_['defaults'](_0x1d9bdf[_0x3874('0x58')],{'firstName':_0x1d9bdf['body']['to'],'email':_0x1d9bdf[_0x3874('0x58')]['to'],'phone':_0x1d9bdf['body']['to'],'ListId':_0xd40d24[_0x3874('0x75')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x3874('0x22')](function(){if(_0x1a46a4){return respondWithRpcPromise(_0x3874('0x76'),_0x3874('0x77'),_0x1a46a4,client9003)['then'](function(_0x300765){return _0x2fd716[_0x3874('0x35')]({'read':!![],'messageId':_0x300765['messageId'],'sentAt':moment()[_0x3874('0x78')](_0x3874('0x79'))});})[_0x3874('0x2b')](function(_0x53476f){logger[_0x3874('0x28')]('%s',JSON['stringify'](_0x53476f));return _0x2fd716;});}return _0x2fd716;});}return _0x2fd716;}})[_0x3874('0x22')](respondWithResult(_0x9729a1,0xc9))[_0x3874('0x2b')](handleError(_0x9729a1,null));};var interaction_log=require(_0x3874('0x7a'))(_0x3874('0x7b'));exports[_0x3874('0x7c')]=function(_0x543a0e,_0x3187ee,_0x4cf359){var _0x59aa0a={'channel':'mail'};if(_0x543a0e[_0x3874('0x58')]['id']){delete _0x543a0e['body']['id'];}_0x543a0e[_0x3874('0x58')]['read']=!![];_0x543a0e[_0x3874('0x58')][_0x3874('0x7d')]=moment()[_0x3874('0x78')](_0x3874('0x79'));_0x543a0e[_0x3874('0x58')][_0x3874('0x7e')]=_0x543a0e['body'][_0x3874('0x7e')]||_0x543a0e[_0x3874('0x70')]['id'];return db['MailMessage'][_0x3874('0x57')]({'where':{'id':_0x543a0e['params']['id'],'UserId':null},'include':[{'model':db[_0x3874('0x63')],'as':_0x3874('0x7f')}]})[_0x3874('0x22')](handleEntityNotFound(_0x3187ee,null))[_0x3874('0x22')](saveUpdates(_0x543a0e[_0x3874('0x58')],null))[_0x3874('0x22')](function(_0x35c863){if(_0x35c863){_0x59aa0a[_0x3874('0x29')]=_0x35c863[_0x3874('0x80')]({'plain':!![]});return db[_0x3874('0x81')][_0x3874('0x57')]({'where':{'id':_0x35c863[_0x3874('0x82')]}});}return null;})['then'](handleEntityNotFound(_0x3187ee,null))[_0x3874('0x22')](function(_0x5b8ae8){if(_0x5b8ae8){return _0x5b8ae8[_0x3874('0x35')]({'UserId':_0x543a0e[_0x3874('0x58')][_0x3874('0x7e')],'read1stAt':_[_0x3874('0x68')](_0x5b8ae8[_0x3874('0x83')])?moment()[_0x3874('0x78')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x3874('0x22')](function(_0x5b7e9e){if(_0x5b7e9e){_0x59aa0a[_0x3874('0x84')]=_0x5b7e9e[_0x3874('0x80')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x543a0e['user']['id'],_0x543a0e[_0x3874('0x70')][_0x3874('0x38')],_0x543a0e[_0x3874('0x70')][_0x3874('0x85')],_0x59aa0a[_0x3874('0x84')]['id'],_0x543a0e['body']?JSON[_0x3874('0x27')](_0x543a0e['body']):_0x3874('0x86'));return respondWithRpcPromise(_0x3874('0x87'),_0x3874('0x88'),_0x59aa0a);}return null;})[_0x3874('0x22')](function(_0x4e7239){if(_0x4e7239){if(_0x543a0e[_0x3874('0x58')][_0x3874('0x89')]){_0x59aa0a[_0x3874('0x29')][_0x3874('0x8a')]=util[_0x3874('0x78')](_0x3874('0x8b'),_0x543a0e[_0x3874('0x70')][_0x3874('0x38')]);_0x59aa0a[_0x3874('0x29')][_0x3874('0x8c')]=_0x59aa0a[_0x3874('0x8c')];_0x59aa0a[_0x3874('0x29')][_0x3874('0x8d')]=_0x3874('0x7c');return respondWithRpcPromise('EventManager',_0x3874('0x8e'),{'event':_0x3874('0x8f'),'message':_0x59aa0a['message']},client9002)[_0x3874('0x22')](function(){return _0x59aa0a;});}return _0x59aa0a;}return null;})[_0x3874('0x22')](respondWithResult(_0x3187ee,null))[_0x3874('0x2b')](handleError(_0x3187ee,null));};var interaction_log=require(_0x3874('0x7a'))(_0x3874('0x7b'));exports['reject']=function(_0x4fda39,_0x5e43d6,_0x275c94){var _0x4f79bc={'agent':{},'channel':_0x3874('0x90')};if(_0x4fda39['body']['id']){delete _0x4fda39[_0x3874('0x58')]['id'];}_0x4fda39[_0x3874('0x58')][_0x3874('0x7e')]=_0x4fda39[_0x3874('0x58')][_0x3874('0x7e')]||_0x4fda39[_0x3874('0x70')]['id'];_0x4f79bc[_0x3874('0x91')]['id']=_0x4fda39[_0x3874('0x58')][_0x3874('0x7e')];return db['MailMessage']['find']({'where':{'id':_0x4fda39[_0x3874('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5e43d6,null))['then'](function(_0x2d5f86){if(_0x2d5f86){_0x4f79bc[_0x3874('0x29')]=_0x2d5f86[_0x3874('0x80')]({'plain':!![]});return db[_0x3874('0x81')][_0x3874('0x57')]({'where':{'id':_0x2d5f86['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5e43d6,null))[_0x3874('0x22')](function(_0x16aaca){if(_0x16aaca){_0x4f79bc[_0x3874('0x84')]=_0x16aaca[_0x3874('0x80')]({'plain':!![]});interaction_log[_0x3874('0x23')](_0x3874('0x92'),_0x4fda39[_0x3874('0x70')]['id'],_0x4fda39[_0x3874('0x70')][_0x3874('0x38')],_0x4fda39[_0x3874('0x70')][_0x3874('0x85')],_0x4f79bc[_0x3874('0x84')]['id'],_0x4fda39['body']?JSON[_0x3874('0x27')](_0x4fda39['body']):_0x3874('0x86'));return respondWithRpcPromise(_0x3874('0x93'),'rejectMessage',_0x4f79bc);}return null;})[_0x3874('0x22')](function(_0x44d396){if(_0x44d396){_0x44d396['message'][_0x3874('0x8a')]=util[_0x3874('0x78')](_0x3874('0x8b'),_0x4fda39['user'][_0x3874('0x38')]);_0x44d396[_0x3874('0x29')][_0x3874('0x8c')]=_0x4f79bc[_0x3874('0x8c')];_0x44d396['message'][_0x3874('0x8d')]=_0x3874('0x94');respondWithRpcPromise(_0x3874('0x8e'),_0x3874('0x8e'),{'event':_0x3874('0x95'),'message':_0x44d396[_0x3874('0x29')]},client9002);return _0x4f79bc;}return null;})[_0x3874('0x22')](respondWithResult(_0x5e43d6,null))['catch'](handleError(_0x5e43d6,null));};exports[_0x3874('0x96')]=function(_0x2db757,_0x5eb5ca){var _0x3ed7b5=moment()[_0x3874('0x97')]()[_0x3874('0x98')]();var _0x462617=path[_0x3874('0x99')](config[_0x3874('0x72')],_0x3874('0x9a'),_0x3874('0x9b'),'tmp');var _0x10ede5=path[_0x3874('0x99')](config[_0x3874('0x72')],_0x3874('0x9a'),_0x3874('0x9b'),_0x3874('0x71'));var _0x5be44d=util[_0x3874('0x78')]('message-%s.eml',_0x3ed7b5);return db[_0x3874('0x3b')][_0x3874('0x57')]({'where':{'id':_0x2db757['params']['id']},'attributes':['id','body','from','to','cc','bcc',_0x3874('0x9c'),_0x3874('0x9d')],'include':_0x2db757[_0x3874('0x40')][_0x3874('0x71')]?[{'model':db[_0x3874('0x9e')],'as':_0x3874('0x9f')}]:undefined})[_0x3874('0x22')](handleEntityNotFound(_0x5eb5ca,null))[_0x3874('0x22')](function(_0x2229e4){if(_0x2229e4){var _0x4f188b=_0x2229e4;var _0x3a004c={'from':_0x4f188b[_0x3874('0xa0')],'to':_0x4f188b['to'],'subject':_0x4f188b[_0x3874('0x9c')],'html':_0x4f188b['body'],'headers':{'Date':moment(_0x4f188b['createdAt'])[_0x3874('0x78')](_0x3874('0xa1'))},'attachments':[]};if(_0x2229e4['cc']){_0x3a004c['headers']['Cc']=_0x2229e4['cc'];}if(_0x2229e4['bcc']){_0x3a004c[_0x3874('0xa2')]['Bcc']=_0x2229e4[_0x3874('0xa3')];}return new BPromise(function(_0x328263,_0x11121d){if(_0x2229e4[_0x3874('0x9f')]){for(var _0x41303b=0x0;_0x41303b<_0x2229e4['Attachments'][_0x3874('0x46')];_0x41303b++){var _0x421c1e=_0x2229e4[_0x3874('0x9f')][_0x41303b];var _0xd7869c=path['join'](_0x10ede5,_0x421c1e[_0x3874('0x74')]);if(fs[_0x3874('0xa4')](_0xd7869c)){_0x3a004c[_0x3874('0x71')][_0x3874('0xa5')]({'name':_0x421c1e[_0x3874('0x38')],'contentType':_0x421c1e[_0x3874('0x3d')],'data':fs[_0x3874('0xa6')](_0xd7869c)});}}}emlformat[_0x3874('0xa7')](_0x3a004c,function(_0x30574b,_0x1cf91f){if(_0x30574b)return _0x11121d(_0x30574b);fs['writeFileSync'](path[_0x3874('0x99')](_0x462617,_0x5be44d),_0x1cf91f);return _0x328263(_0x1cf91f);});});}})[_0x3874('0x22')](function(_0xace44d){if(_0xace44d){return _0x5eb5ca[_0x3874('0x96')](path[_0x3874('0x99')](_0x462617,_0x5be44d),_0x5be44d,function(_0x1d1739){if(_0x1d1739){console['log'](_0x3874('0xa8'),_0x1d1739);}else{fs[_0x3874('0xa9')](path[_0x3874('0x99')](_0x462617,_0x5be44d));}});}})['catch'](handleError(_0x5eb5ca,null));}; \ No newline at end of file +var _0x92bc=['index','MailMessage','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','show','params','find','body','describe','direction','secret','split','MailAccount','CmList','Contacts','MailServerOut','Smtp','isNil','service','host','port','secure','auth','user','pass','attachments','join','root','basename','List','CmContact','create','List\x20not\x20found','SendMail','format','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','accept','mail','read','UserId','Contact','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','server','files','from','bcc','subject','createdAt','headers','Bcc','Attachments','push','readFileSync','writeFileSync','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','http','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','save','update','then','destroy','stack','name'];(function(_0x15906f,_0x4a16f0){var _0x2bdfd8=function(_0x5d533a){while(--_0x5d533a){_0x15906f['push'](_0x15906f['shift']());}};_0x2bdfd8(++_0x4a16f0);}(_0x92bc,0x106));var _0xc92b=function(_0x3ed6ed,_0x5f2c5d){_0x3ed6ed=_0x3ed6ed-0x0;var _0x17d676=_0x92bc[_0x3ed6ed];return _0x17d676;};'use strict';var pdf=require(_0xc92b('0x0'));var emlformat=require(_0xc92b('0x1'));var rimraf=require(_0xc92b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc92b('0x3'));var moment=require(_0xc92b('0x4'));var BPromise=require(_0xc92b('0x5'));var Mustache=require(_0xc92b('0x6'));var util=require('util');var path=require(_0xc92b('0x7'));var sox=require(_0xc92b('0x8'));var csv=require(_0xc92b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc92b('0xa'));var crypto=require(_0xc92b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc92b('0xc'));var toCsv=require(_0xc92b('0x9'));var querystring=require(_0xc92b('0xd'));var Papa=require('papaparse');var Redis=require(_0xc92b('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc92b('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc92b('0x10'))(_0xc92b('0x11'));var utils=require(_0xc92b('0x12'));var config=require(_0xc92b('0x13'));var db=require(_0xc92b('0x14'))['db'];config[_0xc92b('0x15')]=_[_0xc92b('0x16')](config[_0xc92b('0x15')],{'host':_0xc92b('0x17'),'port':0x18eb});var socket=require(_0xc92b('0x18'))(new Redis(config[_0xc92b('0x15')]));require(_0xc92b('0x19'))[_0xc92b('0x1a')](socket);var jayson=require(_0xc92b('0x1b'));var client=jayson['client'][_0xc92b('0x1c')]({'port':0x232c});var client9003=jayson[_0xc92b('0x1d')]['http']({'port':0x232b});var client9002=jayson[_0xc92b('0x1d')][_0xc92b('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x42c85e,_0x18cd4e,_0x2a1e41){if(_0x2a1e41){var _0x38bb69=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x38bb69[_0xc92b('0x1e')](_0x18cd4e)){return _0x42c85e;}else{throw new db['Sequelize'][(_0xc92b('0x1f'))](_0xc92b('0x20'));}}else{return _0x42c85e;}}function respondWithRpcPromise(_0x343042,_0x28b301,_0x74a832,_0x4593c1){return new BPromise(function(_0x56563a,_0x1e6afa){var _0x366a11=_0x4593c1||client;return _0x366a11[_0xc92b('0x21')](_0x343042,_0x74a832)['then'](function(_0x8b280){logger[_0xc92b('0x22')]('MailMessage,\x20%s,\x20%s',_0x28b301,_0xc92b('0x23'));logger[_0xc92b('0x24')](_0xc92b('0x25'),_0x28b301,'request\x20sent',JSON[_0xc92b('0x26')](_0x8b280));if(_0x8b280['error']){if(_0x8b280[_0xc92b('0x27')]['code']===0x1f4){logger[_0xc92b('0x27')](_0xc92b('0x28'),_0x28b301,_0x8b280[_0xc92b('0x27')][_0xc92b('0x29')]);return _0x1e6afa(_0x8b280[_0xc92b('0x27')]['message']);}logger[_0xc92b('0x27')](_0xc92b('0x28'),_0x28b301,_0x8b280[_0xc92b('0x27')][_0xc92b('0x29')]);return _0x56563a(_0x8b280['error'][_0xc92b('0x29')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x28b301,_0xc92b('0x23'));_0x56563a(_0x8b280[_0xc92b('0x2a')]['message']);}})[_0xc92b('0x2b')](function(_0x2bade9){logger['error'](_0xc92b('0x28'),_0x28b301,_0x2bade9);_0x1e6afa(_0x2bade9);});});}function respondWithStatusCode(_0x292af2,_0x57f972){_0x57f972=_0x57f972||0xcc;return function(_0x473eb6){if(_0x473eb6){return _0x292af2[_0xc92b('0x2c')](_0x57f972);}return _0x292af2['status'](_0x57f972)[_0xc92b('0x2d')]();};}function respondWithResult(_0x400196,_0x8db11e){_0x8db11e=_0x8db11e||0xc8;return function(_0x5f4443){if(_0x5f4443){return _0x400196[_0xc92b('0x2e')](_0x8db11e)[_0xc92b('0x2f')](_0x5f4443);}};}function respondWithFilteredResult(_0x1a5b98,_0x24088b){return function(_0x1a32d3){if(_0x1a32d3){var _0x13e55b=_0x1a32d3[_0xc92b('0x30')],_0x1ae1a4=_0x24088b['offset'],_0x592b0c=_0x24088b[_0xc92b('0x31')]+_0x24088b[_0xc92b('0x32')],_0x202559;if(_0x592b0c>=_0x13e55b){_0x592b0c=_0x13e55b;_0x202559=0xc8;}else{_0x202559=0xce;}_0x1a5b98[_0xc92b('0x2e')](_0x202559);return _0x1a5b98[_0xc92b('0x33')]('Content-Range',_0x1ae1a4+'-'+_0x592b0c+'/'+_0x13e55b)[_0xc92b('0x2f')](_0x1a32d3);}return null;};}function patchUpdates(_0x30c307){return function(_0xe875e7){try{jsonpatch['apply'](_0xe875e7,_0x30c307,!![]);}catch(_0x369b10){return BPromise['reject'](_0x369b10);}return _0xe875e7[_0xc92b('0x34')]();};}function saveUpdates(_0x260db8,_0x4e2f90){return function(_0x2be03a){if(_0x2be03a){return _0x2be03a[_0xc92b('0x35')](_0x260db8)[_0xc92b('0x36')](function(_0x1c9bfd){return _0x1c9bfd;});}return null;};}function removeEntity(_0xae6508,_0x608d5a){return function(_0x3acaf0){if(_0x3acaf0){return _0x3acaf0[_0xc92b('0x37')]()[_0xc92b('0x36')](function(){_0xae6508[_0xc92b('0x2e')](0xcc)[_0xc92b('0x2d')]();});}};}function handleEntityNotFound(_0x1d7e7b,_0x59df47){return function(_0x1a362a){if(!_0x1a362a){_0x1d7e7b[_0xc92b('0x2c')](0x194);}return _0x1a362a;};}function handleError(_0x2fa006,_0x5db58f){_0x5db58f=_0x5db58f||0x1f4;return function(_0x353867){logger[_0xc92b('0x27')](_0x353867[_0xc92b('0x38')]);if(_0x353867[_0xc92b('0x39')]){delete _0x353867[_0xc92b('0x39')];}_0x2fa006[_0xc92b('0x2e')](_0x5db58f)['send'](_0x353867);};}exports[_0xc92b('0x3a')]=function(_0x25bfe5,_0x21133f){var _0x170dd5={},_0x346a3f={},_0x1b11bf={'count':0x0,'rows':[]};var _0x238a7b=_['map'](db[_0xc92b('0x3b')][_0xc92b('0x3c')],function(_0x4f4c84){return{'name':_0x4f4c84['fieldName'],'type':_0x4f4c84[_0xc92b('0x3d')][_0xc92b('0x3e')]};});_0x346a3f[_0xc92b('0x3f')]=_[_0xc92b('0x40')](_0x238a7b,_0xc92b('0x39'));_0x346a3f['query']=_[_0xc92b('0x41')](_0x25bfe5[_0xc92b('0x42')]);_0x346a3f[_0xc92b('0x43')]=_[_0xc92b('0x44')](_0x346a3f['model'],_0x346a3f[_0xc92b('0x42')]);_0x170dd5['attributes']=_[_0xc92b('0x44')](_0x346a3f[_0xc92b('0x3f')],qs['fields'](_0x25bfe5[_0xc92b('0x42')][_0xc92b('0x45')]));_0x170dd5[_0xc92b('0x46')]=_0x170dd5[_0xc92b('0x46')][_0xc92b('0x47')]?_0x170dd5[_0xc92b('0x46')]:_0x346a3f[_0xc92b('0x3f')];if(!_0x25bfe5['query'][_0xc92b('0x48')](_0xc92b('0x49'))){_0x170dd5[_0xc92b('0x32')]=qs[_0xc92b('0x32')](_0x25bfe5[_0xc92b('0x42')][_0xc92b('0x32')]);_0x170dd5[_0xc92b('0x31')]=qs[_0xc92b('0x31')](_0x25bfe5['query'][_0xc92b('0x31')]);}_0x170dd5[_0xc92b('0x4a')]=qs[_0xc92b('0x4b')](_0x25bfe5['query'][_0xc92b('0x4b')]);_0x170dd5[_0xc92b('0x4c')]=qs[_0xc92b('0x43')](_[_0xc92b('0x4d')](_0x25bfe5[_0xc92b('0x42')],_0x346a3f[_0xc92b('0x43')]),_0x238a7b);if(_0x25bfe5[_0xc92b('0x42')]['filter']){_0x170dd5[_0xc92b('0x4c')]=_[_0xc92b('0x4e')](_0x170dd5['where'],{'$or':_[_0xc92b('0x40')](_0x238a7b,function(_0x1c9529){if(_0x1c9529['type']!==_0xc92b('0x4f')){var _0x12073b={};_0x12073b[_0x1c9529[_0xc92b('0x39')]]={'$like':'%'+_0x25bfe5[_0xc92b('0x42')][_0xc92b('0x50')]+'%'};return _0x12073b;}})});}_0x170dd5=_[_0xc92b('0x4e')]({},_0x170dd5,_0x25bfe5[_0xc92b('0x51')]);var _0x204c04={'where':_0x170dd5[_0xc92b('0x4c')]};return db[_0xc92b('0x3b')][_0xc92b('0x30')](_0x204c04)[_0xc92b('0x36')](function(_0x132d2e){_0x1b11bf[_0xc92b('0x30')]=_0x132d2e;if(_0x25bfe5[_0xc92b('0x42')][_0xc92b('0x52')]){_0x170dd5[_0xc92b('0x53')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x170dd5);})[_0xc92b('0x36')](function(_0x8390db){_0x1b11bf['rows']=_0x8390db;return _0x1b11bf;})['then'](respondWithFilteredResult(_0x21133f,_0x170dd5))[_0xc92b('0x2b')](handleError(_0x21133f,null));};exports[_0xc92b('0x54')]=function(_0x5722fa,_0x30ec8c){var _0x2aadfa={'raw':!![],'where':{'id':_0x5722fa[_0xc92b('0x55')]['id']}},_0x1c4fc8={};_0x1c4fc8[_0xc92b('0x3f')]=_['keys'](db[_0xc92b('0x3b')][_0xc92b('0x3c')]);_0x1c4fc8[_0xc92b('0x42')]=_['keys'](_0x5722fa['query']);_0x1c4fc8[_0xc92b('0x43')]=_[_0xc92b('0x44')](_0x1c4fc8[_0xc92b('0x3f')],_0x1c4fc8[_0xc92b('0x42')]);_0x2aadfa[_0xc92b('0x46')]=_[_0xc92b('0x44')](_0x1c4fc8[_0xc92b('0x3f')],qs[_0xc92b('0x45')](_0x5722fa[_0xc92b('0x42')][_0xc92b('0x45')]));_0x2aadfa[_0xc92b('0x46')]=_0x2aadfa[_0xc92b('0x46')][_0xc92b('0x47')]?_0x2aadfa['attributes']:_0x1c4fc8[_0xc92b('0x3f')];if(_0x5722fa[_0xc92b('0x42')][_0xc92b('0x52')]){_0x2aadfa[_0xc92b('0x53')]=[{'all':!![]}];}_0x2aadfa=_['merge']({},_0x2aadfa,_0x5722fa[_0xc92b('0x51')]);return db[_0xc92b('0x3b')][_0xc92b('0x56')](_0x2aadfa)[_0xc92b('0x36')](handleEntityNotFound(_0x30ec8c,null))[_0xc92b('0x36')](respondWithResult(_0x30ec8c,null))[_0xc92b('0x2b')](handleError(_0x30ec8c,null));};exports[_0xc92b('0x35')]=function(_0x2a1f22,_0x2768f1){if(_0x2a1f22[_0xc92b('0x57')]['id']){delete _0x2a1f22[_0xc92b('0x57')]['id'];}return db[_0xc92b('0x3b')][_0xc92b('0x56')]({'where':{'id':_0x2a1f22[_0xc92b('0x55')]['id']}})['then'](handleEntityNotFound(_0x2768f1,null))[_0xc92b('0x36')](saveUpdates(_0x2a1f22[_0xc92b('0x57')],null))[_0xc92b('0x36')](respondWithResult(_0x2768f1,null))[_0xc92b('0x2b')](handleError(_0x2768f1,null));};exports['destroy']=function(_0x5cf662,_0x112aeb){return db['MailMessage'][_0xc92b('0x56')]({'where':{'id':_0x5cf662[_0xc92b('0x55')]['id']}})[_0xc92b('0x36')](handleEntityNotFound(_0x112aeb,null))[_0xc92b('0x36')](removeEntity(_0x112aeb,null))[_0xc92b('0x2b')](handleError(_0x112aeb,null));};exports[_0xc92b('0x58')]=function(_0x14342c,_0x2b9151){return db[_0xc92b('0x3b')][_0xc92b('0x58')]()[_0xc92b('0x36')](respondWithResult(_0x2b9151,null))[_0xc92b('0x2b')](handleError(_0x2b9151,null));};exports['create']=function(_0x3c6f94,_0x3bb9b6){return db[_0xc92b('0x3b')]['create'](_0x3c6f94[_0xc92b('0x57')])[_0xc92b('0x36')](function(_0x174214){if(_0x174214){if(_0x174214[_0xc92b('0x59')]==='out'&&!_0x174214[_0xc92b('0x5a')]){var _0xb7f0b3,_0x3985e8,_0x2c18a6;if(_0x3c6f94[_0xc92b('0x57')]['to']){_0x3985e8=_0x3c6f94[_0xc92b('0x57')]['to'][_0xc92b('0x5b')](',')[0x0];}return db[_0xc92b('0x5c')]['findOne']({'where':{'id':_0x174214['MailAccountId']},'include':[{'model':db[_0xc92b('0x5d')],'as':'List','include':[{'model':db['CmContact'],'as':_0xc92b('0x5e'),'where':{'email':_0x3985e8},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xc92b('0x5f')],'as':_0xc92b('0x60'),'raw':!![]}]})[_0xc92b('0x36')](function(_0x2cc7ed){_0xb7f0b3=_0x2cc7ed;if(_0xb7f0b3&&_0xb7f0b3['Smtp']){var _0x404cee={'tls':{'rejectUnauthorized':![]}};if(_[_0xc92b('0x61')](_0xb7f0b3['Smtp'][_0xc92b('0x62')])){_0x404cee[_0xc92b('0x63')]=_0xb7f0b3[_0xc92b('0x60')][_0xc92b('0x63')];_0x404cee[_0xc92b('0x64')]=_0xb7f0b3['Smtp'][_0xc92b('0x64')];_0x404cee[_0xc92b('0x65')]=_0xb7f0b3[_0xc92b('0x60')][_0xc92b('0x65')];if(_0xb7f0b3[_0xc92b('0x60')]['authentication']){_0x404cee[_0xc92b('0x66')]={'user':_0xb7f0b3['Smtp']['user'],'pass':_0xb7f0b3['Smtp']['pass']};}}else{_0x404cee[_0xc92b('0x62')]=_0xb7f0b3[_0xc92b('0x60')][_0xc92b('0x62')];_0x404cee['auth']={'user':_0xb7f0b3[_0xc92b('0x60')][_0xc92b('0x67')],'pass':_0xb7f0b3[_0xc92b('0x60')][_0xc92b('0x68')]};_0x404cee[_0xc92b('0x65')]=_0xb7f0b3['Smtp']['secure'];}if(_0x3c6f94[_0xc92b('0x57')][_0xc92b('0x69')]&&_0x3c6f94[_0xc92b('0x57')][_0xc92b('0x69')]['length']){for(var _0x2a5adb=0x0;_0x2a5adb<_0x3c6f94[_0xc92b('0x57')][_0xc92b('0x69')][_0xc92b('0x47')];_0x2a5adb+=0x1){_0x3c6f94[_0xc92b('0x57')][_0xc92b('0x69')][_0x2a5adb]={'filename':_0x3c6f94['body'][_0xc92b('0x69')][_0x2a5adb][_0xc92b('0x39')],'path':path[_0xc92b('0x6a')](config[_0xc92b('0x6b')],'server/files/attachments',_0x3c6f94[_0xc92b('0x57')][_0xc92b('0x69')][_0x2a5adb][_0xc92b('0x6c')])};}}_0x2c18a6={'account':_0x404cee,'message':_0x3c6f94[_0xc92b('0x57')]};return;}})[_0xc92b('0x36')](function(){if(_0xb7f0b3['List']){if(_0xb7f0b3['List'][_0xc92b('0x5e')][_0xc92b('0x47')]){return _0xb7f0b3[_0xc92b('0x6d')][_0xc92b('0x5e')][0x0];}else{return db[_0xc92b('0x6e')][_0xc92b('0x6f')](_[_0xc92b('0x16')](_0x3c6f94['body'],{'firstName':_0x3c6f94[_0xc92b('0x57')]['to'],'email':_0x3c6f94[_0xc92b('0x57')]['to'],'phone':_0x3c6f94['body']['to'],'ListId':_0xb7f0b3['ListId']}));}}else{throw new Error(_0xc92b('0x70'));}})[_0xc92b('0x36')](function(){if(_0x2c18a6){return respondWithRpcPromise(_0xc92b('0x71'),'sendMail',_0x2c18a6,client9003)[_0xc92b('0x36')](function(_0x493d3c){return _0x174214[_0xc92b('0x35')]({'read':!![],'messageId':_0x493d3c['messageId'],'sentAt':moment()[_0xc92b('0x72')](_0xc92b('0x73'))});})[_0xc92b('0x2b')](function(_0x586dad){logger[_0xc92b('0x27')]('%s',JSON[_0xc92b('0x26')](_0x586dad));return _0x174214;});}return _0x174214;});}return _0x174214;}})[_0xc92b('0x36')](respondWithResult(_0x3bb9b6,0xc9))[_0xc92b('0x2b')](handleError(_0x3bb9b6,null));};var interaction_log=require('../../config/logger')(_0xc92b('0x74'));exports[_0xc92b('0x75')]=function(_0x4764d4,_0xc27e4d,_0x3b57c6){var _0x4829cf={'channel':_0xc92b('0x76')};if(_0x4764d4['body']['id']){delete _0x4764d4['body']['id'];}_0x4764d4[_0xc92b('0x57')][_0xc92b('0x77')]=!![];_0x4764d4['body']['readAt']=moment()[_0xc92b('0x72')]('YYYY-MM-DD\x20HH:mm:ss');_0x4764d4[_0xc92b('0x57')][_0xc92b('0x78')]=_0x4764d4[_0xc92b('0x57')][_0xc92b('0x78')]||_0x4764d4[_0xc92b('0x67')]['id'];return db['MailMessage'][_0xc92b('0x56')]({'where':{'id':_0x4764d4[_0xc92b('0x55')]['id'],'UserId':null},'include':[{'model':db[_0xc92b('0x6e')],'as':_0xc92b('0x79')}]})[_0xc92b('0x36')](handleEntityNotFound(_0xc27e4d,null))['then'](saveUpdates(_0x4764d4[_0xc92b('0x57')],null))[_0xc92b('0x36')](function(_0x173573){if(_0x173573){_0x4829cf[_0xc92b('0x29')]=_0x173573[_0xc92b('0x7a')]({'plain':!![]});return db[_0xc92b('0x7b')][_0xc92b('0x56')]({'where':{'id':_0x173573[_0xc92b('0x7c')]}});}return null;})['then'](handleEntityNotFound(_0xc27e4d,null))[_0xc92b('0x36')](function(_0x2cd610){if(_0x2cd610){return _0x2cd610[_0xc92b('0x35')]({'UserId':_0x4764d4['body'][_0xc92b('0x78')],'read1stAt':_[_0xc92b('0x61')](_0x2cd610[_0xc92b('0x7d')])?moment()['format'](_0xc92b('0x73')):undefined});}return null;})[_0xc92b('0x36')](function(_0x2f2a59){if(_0x2f2a59){_0x4829cf[_0xc92b('0x7e')]=_0x2f2a59[_0xc92b('0x7a')]({'plain':!![]});interaction_log[_0xc92b('0x22')](_0xc92b('0x7f'),_0x4764d4['user']['id'],_0x4764d4[_0xc92b('0x67')][_0xc92b('0x39')],_0x4764d4[_0xc92b('0x67')][_0xc92b('0x80')],_0x4829cf['interaction']['id'],_0x4764d4[_0xc92b('0x57')]?JSON['stringify'](_0x4764d4[_0xc92b('0x57')]):_0xc92b('0x81'));return respondWithRpcPromise(_0xc92b('0x82'),_0xc92b('0x83'),_0x4829cf);}return null;})[_0xc92b('0x36')](function(_0x2fdb1a){if(_0x2fdb1a){if(_0x4764d4['body']['manual']){_0x4829cf[_0xc92b('0x29')][_0xc92b('0x84')]=util[_0xc92b('0x72')](_0xc92b('0x85'),_0x4764d4[_0xc92b('0x67')][_0xc92b('0x39')]);_0x4829cf['message'][_0xc92b('0x86')]=_0x4829cf[_0xc92b('0x86')];_0x4829cf[_0xc92b('0x29')][_0xc92b('0x87')]=_0xc92b('0x75');return respondWithRpcPromise('EventManager',_0xc92b('0x88'),{'event':_0xc92b('0x89'),'message':_0x4829cf['message']},client9002)[_0xc92b('0x36')](function(){return _0x4829cf;});}return _0x4829cf;}return null;})[_0xc92b('0x36')](respondWithResult(_0xc27e4d,null))[_0xc92b('0x2b')](handleError(_0xc27e4d,null));};var interaction_log=require(_0xc92b('0x10'))(_0xc92b('0x74'));exports[_0xc92b('0x8a')]=function(_0x50708c,_0x521abe,_0x151c00){var _0x17adfb={'agent':{},'channel':_0xc92b('0x76')};if(_0x50708c['body']['id']){delete _0x50708c[_0xc92b('0x57')]['id'];}_0x50708c[_0xc92b('0x57')]['UserId']=_0x50708c[_0xc92b('0x57')][_0xc92b('0x78')]||_0x50708c['user']['id'];_0x17adfb[_0xc92b('0x8b')]['id']=_0x50708c[_0xc92b('0x57')]['UserId'];return db[_0xc92b('0x3b')][_0xc92b('0x56')]({'where':{'id':_0x50708c[_0xc92b('0x55')]['id'],'UserId':null}})[_0xc92b('0x36')](handleEntityNotFound(_0x521abe,null))[_0xc92b('0x36')](function(_0x5b7a58){if(_0x5b7a58){_0x17adfb[_0xc92b('0x29')]=_0x5b7a58[_0xc92b('0x7a')]({'plain':!![]});return db['MailInteraction'][_0xc92b('0x56')]({'where':{'id':_0x5b7a58[_0xc92b('0x7c')]}});}return null;})[_0xc92b('0x36')](handleEntityNotFound(_0x521abe,null))[_0xc92b('0x36')](function(_0x129238){if(_0x129238){_0x17adfb[_0xc92b('0x7e')]=_0x129238['get']({'plain':!![]});interaction_log[_0xc92b('0x22')](_0xc92b('0x8c'),_0x50708c['user']['id'],_0x50708c['user'][_0xc92b('0x39')],_0x50708c[_0xc92b('0x67')][_0xc92b('0x80')],_0x17adfb['interaction']['id'],_0x50708c[_0xc92b('0x57')]?JSON['stringify'](_0x50708c['body']):_0xc92b('0x81'));return respondWithRpcPromise(_0xc92b('0x8d'),_0xc92b('0x8e'),_0x17adfb);}return null;})['then'](function(_0x11d73e){if(_0x11d73e){_0x11d73e[_0xc92b('0x29')]['interface']=util[_0xc92b('0x72')](_0xc92b('0x85'),_0x50708c[_0xc92b('0x67')][_0xc92b('0x39')]);_0x11d73e[_0xc92b('0x29')][_0xc92b('0x86')]=_0x17adfb['channel'];_0x11d73e['message'][_0xc92b('0x87')]=_0xc92b('0x8a');respondWithRpcPromise('EventManager',_0xc92b('0x88'),{'event':_0xc92b('0x8f'),'message':_0x11d73e['message']},client9002);return _0x17adfb;}return null;})[_0xc92b('0x36')](respondWithResult(_0x521abe,null))['catch'](handleError(_0x521abe,null));};exports['download']=function(_0x348f3a,_0xa27d45){var _0x280b6b=moment()['unix']()['toString']();var _0x3debd9=path[_0xc92b('0x6a')](config[_0xc92b('0x6b')],_0xc92b('0x90'),'files','tmp');var _0x213373=path[_0xc92b('0x6a')](config[_0xc92b('0x6b')],_0xc92b('0x90'),_0xc92b('0x91'),_0xc92b('0x69'));var _0x3a7c62=util['format']('message-%s.eml',_0x280b6b);return db[_0xc92b('0x3b')][_0xc92b('0x56')]({'where':{'id':_0x348f3a['params']['id']},'attributes':['id','body',_0xc92b('0x92'),'to','cc',_0xc92b('0x93'),_0xc92b('0x94'),_0xc92b('0x95')],'include':_0x348f3a[_0xc92b('0x42')][_0xc92b('0x69')]?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0xa27d45,null))[_0xc92b('0x36')](function(_0x329baf){if(_0x329baf){var _0x47316f=_0x329baf;var _0xa1636d={'from':_0x47316f[_0xc92b('0x92')],'to':_0x47316f['to'],'subject':_0x47316f['subject'],'html':_0x47316f[_0xc92b('0x57')],'headers':{'Date':moment(_0x47316f[_0xc92b('0x95')])[_0xc92b('0x72')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x329baf['cc']){_0xa1636d[_0xc92b('0x96')]['Cc']=_0x329baf['cc'];}if(_0x329baf[_0xc92b('0x93')]){_0xa1636d[_0xc92b('0x96')][_0xc92b('0x97')]=_0x329baf[_0xc92b('0x93')];}return new BPromise(function(_0x55a9b9,_0x2f32a3){if(_0x329baf[_0xc92b('0x98')]){for(var _0x36446a=0x0;_0x36446a<_0x329baf[_0xc92b('0x98')][_0xc92b('0x47')];_0x36446a++){var _0x3329fd=_0x329baf[_0xc92b('0x98')][_0x36446a];var _0x1a0eed=path[_0xc92b('0x6a')](_0x213373,_0x3329fd[_0xc92b('0x6c')]);if(fs['existsSync'](_0x1a0eed)){_0xa1636d[_0xc92b('0x69')][_0xc92b('0x99')]({'name':_0x3329fd[_0xc92b('0x39')],'contentType':_0x3329fd[_0xc92b('0x3d')],'data':fs[_0xc92b('0x9a')](_0x1a0eed)});}}}emlformat['build'](_0xa1636d,function(_0x244cda,_0x1f6179){if(_0x244cda)return _0x2f32a3(_0x244cda);fs[_0xc92b('0x9b')](path[_0xc92b('0x6a')](_0x3debd9,_0x3a7c62),_0x1f6179);return _0x55a9b9(_0x1f6179);});});}})[_0xc92b('0x36')](function(_0x58dd7f){if(_0x58dd7f){return _0xa27d45[_0xc92b('0x9c')](path[_0xc92b('0x6a')](_0x3debd9,_0x3a7c62),_0x3a7c62,function(_0x583308){if(_0x583308){console[_0xc92b('0x9d')](_0xc92b('0x9e'),_0x583308);}else{fs[_0xc92b('0x9f')](path[_0xc92b('0x6a')](_0x3debd9,_0x3a7c62));}});}})[_0xc92b('0x2b')](handleError(_0xa27d45,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index fecd8dd..9d3655d 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 _0x1278=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0x1278,0xbb));var _0x8127=function(_0x3283d3,_0x19c532){_0x3283d3=_0x3283d3-0x0;var _0x14eee0=_0x1278[_0x3283d3];return _0x14eee0;};'use strict';var EventEmitter=require(_0x8127('0x0'));var MailMessage=require(_0x8127('0x1'))['db'][_0x8127('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8127('0x3'),'afterUpdate':_0x8127('0x4'),'afterDestroy':_0x8127('0x5')};function emitEvent(_0x4740bf){return function(_0x333443,_0x3935b1,_0x455f64){MailMessageEvents['emit'](_0x4740bf+':'+_0x333443['id'],_0x333443);MailMessageEvents[_0x8127('0x6')](_0x4740bf,_0x333443);_0x455f64(null);};}for(var e in events){if(events[_0x8127('0x7')](e)){var event=events[e];MailMessage[_0x8127('0x8')](e,emitEvent(event));}}module[_0x8127('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x32fc=['emit','hasOwnProperty','hook','events','../../mysqldb','save','update','remove'];(function(_0x427cfe,_0x3c6044){var _0x10ad69=function(_0x354bff){while(--_0x354bff){_0x427cfe['push'](_0x427cfe['shift']());}};_0x10ad69(++_0x3c6044);}(_0x32fc,0x193));var _0xc32f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x32fc[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xc32f('0x0'));var MailMessage=require(_0xc32f('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc32f('0x2'),'afterUpdate':_0xc32f('0x3'),'afterDestroy':_0xc32f('0x4')};function emitEvent(_0x33ab8f){return function(_0x4dc011,_0x36a773,_0x44323d){MailMessageEvents[_0xc32f('0x5')](_0x33ab8f+':'+_0x4dc011['id'],_0x4dc011);MailMessageEvents['emit'](_0x33ab8f,_0x4dc011);_0x44323d(null);};}for(var e in events){if(events[_0xc32f('0x6')](e)){var event=events[e];MailMessage[_0xc32f('0x7')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 620fc2f..1e5ebb1 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 _0x9e4e=['bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','exports','define','MailMessage','mail_messages','messageId','plainBody','subject','FULLTEXT','body','models','get','toLowerCase','direction','out','secret','isNil','findOne','then','update','createdAt','catch','utf8mb4','../../config/logger','api','moment'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x9e4e,0x98));var _0xe9e4=function(_0x1c5765,_0x51d576){_0x1c5765=_0x1c5765-0x0;var _0x303166=_0x9e4e[_0x1c5765];return _0x303166;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe9e4('0x0'))(_0xe9e4('0x1'));var moment=require(_0xe9e4('0x2'));var BPromise=require(_0xe9e4('0x3'));var rp=require(_0xe9e4('0x4'));var htmlToText=require(_0xe9e4('0x5'));var fs=require('fs');var path=require(_0xe9e4('0x6'));var rimraf=require(_0xe9e4('0x7'));var config=require(_0xe9e4('0x8'));var attributes=require('./mailMessage.attributes');module[_0xe9e4('0x9')]=function(_0x3958df,_0x299508){return _0x3958df[_0xe9e4('0xa')](_0xe9e4('0xb'),attributes,{'tableName':_0xe9e4('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xe9e4('0xd')]},{'name':'fti_mail_messages','fields':[_0xe9e4('0xe'),_0xe9e4('0xf')],'type':_0xe9e4('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x564470,_0x2d732b,_0x24850c){if(_0x564470[_0xe9e4('0x11')]){_0x564470[_0xe9e4('0xe')]=htmlToText['fromString'](_0x564470[_0xe9e4('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x24850c(null,_0x2d732b);},'afterCreate':function(_0x71cfcf,_0x34f137,_0x8d711c){var _0x2fab73=_0x3958df[_0xe9e4('0x12')];var _0x5c2343=_0x71cfcf[_0xe9e4('0x13')]({'plain':!![]});if(_0x5c2343['direction'][_0xe9e4('0x14')]()==='in'||_0x5c2343[_0xe9e4('0x15')]['toLowerCase']()===_0xe9e4('0x16')&&!_0x5c2343[_0xe9e4('0x17')]&&!_[_0xe9e4('0x18')](_0x5c2343['UserId'])){_0x2fab73['MailInteraction'][_0xe9e4('0x19')]({'where':{'id':_0x5c2343['MailInteractionId']}})[_0xe9e4('0x1a')](function(_0x30c518){if(_0x30c518){_0x30c518[_0xe9e4('0x1b')]({'lastMsgAt':_0x5c2343[_0xe9e4('0x1c')],'lastMsgDirection':_0x5c2343[_0xe9e4('0x15')]['toLowerCase'](),'lastMsgBody':_0x5c2343[_0xe9e4('0x11')]});}})[_0xe9e4('0x1d')](function(_0x4c40ad){console['error'](_0x4c40ad);});}_0x8d711c();}},'charset':_0xe9e4('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4850=['secret','UserId','MailInteraction','findOne','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','exports','define','MailMessage','mail_messages','fti_mail_messages','subject','FULLTEXT','plainBody','fromString','get','direction','toLowerCase','out'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x4850,0x1ac));var _0x0485=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4850[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x0485('0x0'));var util=require(_0x0485('0x1'));var logger=require(_0x0485('0x2'))('api');var moment=require(_0x0485('0x3'));var BPromise=require(_0x0485('0x4'));var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x0485('0x5'));var rimraf=require('rimraf');var config=require(_0x0485('0x6'));var attributes=require('./mailMessage.attributes');module[_0x0485('0x7')]=function(_0x149fac,_0x55b59d){return _0x149fac[_0x0485('0x8')](_0x0485('0x9'),attributes,{'tableName':_0x0485('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x0485('0xb'),'fields':['plainBody',_0x0485('0xc')],'type':_0x0485('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x24bcc3,_0x2e247d,_0x881ec){if(_0x24bcc3['body']){_0x24bcc3[_0x0485('0xe')]=htmlToText[_0x0485('0xf')](_0x24bcc3['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x881ec(null,_0x2e247d);},'afterCreate':function(_0x8334c8,_0x2ebddf,_0x102462){var _0x85a12=_0x149fac['models'];var _0x50c357=_0x8334c8[_0x0485('0x10')]({'plain':!![]});if(_0x50c357[_0x0485('0x11')][_0x0485('0x12')]()==='in'||_0x50c357['direction'][_0x0485('0x12')]()===_0x0485('0x13')&&!_0x50c357[_0x0485('0x14')]&&!_['isNil'](_0x50c357[_0x0485('0x15')])){_0x85a12[_0x0485('0x16')][_0x0485('0x17')]({'where':{'id':_0x50c357['MailInteractionId']}})['then'](function(_0x4243de){if(_0x4243de){_0x4243de['update']({'lastMsgAt':_0x50c357[_0x0485('0x18')],'lastMsgDirection':_0x50c357[_0x0485('0x11')][_0x0485('0x12')](),'lastMsgBody':_0x50c357['body']});}})[_0x0485('0x19')](function(_0x26ddcf){console[_0x0485('0x1a')](_0x26ddcf);});}_0x102462();}},'charset':_0x0485('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index debbab4..7da8076 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 _0x5d58=['register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateMailMessage','create','body','raw','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x5d58,0x187));var _0x85d5=function(_0x17887a,_0x24ffeb){_0x17887a=_0x17887a-0x0;var _0x462746=_0x5d58[_0x17887a];return _0x462746;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x85d5('0x0'));var db=require(_0x85d5('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x85d5('0x2'))(_0x85d5('0x3'));var config=require('../../config/environment');var jayson=require(_0x85d5('0x4'));var client=jayson[_0x85d5('0x5')][_0x85d5('0x6')]({'port':0x232a});config[_0x85d5('0x7')]=_['defaults'](config[_0x85d5('0x7')],{'host':_0x85d5('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85d5('0x7')]));require('./mailMessage.socket')[_0x85d5('0x9')](socket);function respondWithRpcPromise(_0x2ce6b9,_0x258f0c,_0x488dcb){return new BPromise(function(_0x499b36,_0x4e147a){return client[_0x85d5('0xa')](_0x2ce6b9,_0x488dcb)[_0x85d5('0xb')](function(_0xde1063){logger[_0x85d5('0xc')](_0x85d5('0xd'),_0x258f0c,_0x85d5('0xe'));logger[_0x85d5('0xf')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x258f0c,'request\x20sent',JSON['stringify'](_0xde1063));if(_0xde1063[_0x85d5('0x10')]){if(_0xde1063[_0x85d5('0x10')][_0x85d5('0x11')]===0x1f4){logger[_0x85d5('0x10')](_0x85d5('0xd'),_0x258f0c,_0xde1063[_0x85d5('0x10')][_0x85d5('0x12')]);return _0x4e147a(_0xde1063['error'][_0x85d5('0x12')]);}logger[_0x85d5('0x10')](_0x85d5('0xd'),_0x258f0c,_0xde1063[_0x85d5('0x10')][_0x85d5('0x12')]);return _0x499b36(_0xde1063[_0x85d5('0x10')][_0x85d5('0x12')]);}else{logger[_0x85d5('0xc')](_0x85d5('0xd'),_0x258f0c,_0x85d5('0xe'));_0x499b36(_0xde1063[_0x85d5('0x13')][_0x85d5('0x12')]);}})[_0x85d5('0x14')](function(_0x3df634){logger[_0x85d5('0x10')](_0x85d5('0xd'),_0x258f0c,_0x3df634);_0x4e147a(_0x3df634);});});}exports[_0x85d5('0x15')]=function(_0x1d6134){var _0x53bd11=this;return new Promise(function(_0xc56ad1,_0x133fa9){return db['MailMessage'][_0x85d5('0x16')](_0x1d6134[_0x85d5('0x17')],{'raw':_0x1d6134['options']?_0x1d6134['options'][_0x85d5('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x2f2bae){logger['info'](_0x85d5('0x15'),_0x1d6134);logger[_0x85d5('0xf')]('CreateMailMessage',_0x1d6134,JSON['stringify'](_0x2f2bae));_0xc56ad1(_0x2f2bae);})['catch'](function(_0x5f0268){logger[_0x85d5('0x10')](_0x85d5('0x15'),_0x5f0268[_0x85d5('0x12')],_0x1d6134);_0x133fa9(_0x53bd11[_0x85d5('0x10')](0x1f4,_0x5f0268[_0x85d5('0x12')]));});});}; \ No newline at end of file +var _0x04f9=['request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','MailMessage','create','options','raw','CreateMailMessage','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s'];(function(_0x46275e,_0x237ca7){var _0x3da773=function(_0xfb157e){while(--_0xfb157e){_0x46275e['push'](_0x46275e['shift']());}};_0x3da773(++_0x237ca7);}(_0x04f9,0xb3));var _0x904f=function(_0x17376,_0x919577){_0x17376=_0x17376-0x0;var _0x2fedb9=_0x04f9[_0x17376];return _0x2fedb9;};'use strict';var _=require('lodash');var util=require(_0x904f('0x0'));var moment=require(_0x904f('0x1'));var BPromise=require(_0x904f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x904f('0x3'));var db=require(_0x904f('0x4'))['db'];var utils=require(_0x904f('0x5'));var logger=require(_0x904f('0x6'))(_0x904f('0x7'));var config=require(_0x904f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x904f('0x9')][_0x904f('0xa')]({'port':0x232a});config[_0x904f('0xb')]=_[_0x904f('0xc')](config[_0x904f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x904f('0xd'))(new Redis(config[_0x904f('0xb')]));require(_0x904f('0xe'))['register'](socket);function respondWithRpcPromise(_0xb64c23,_0x1bcfc3,_0x12fbce){return new BPromise(function(_0x3477ae,_0x156ec7){return client[_0x904f('0xf')](_0xb64c23,_0x12fbce)[_0x904f('0x10')](function(_0x31e3e2){logger[_0x904f('0x11')](_0x904f('0x12'),_0x1bcfc3,_0x904f('0x13'));logger[_0x904f('0x14')](_0x904f('0x15'),_0x1bcfc3,_0x904f('0x13'),JSON[_0x904f('0x16')](_0x31e3e2));if(_0x31e3e2[_0x904f('0x17')]){if(_0x31e3e2[_0x904f('0x17')][_0x904f('0x18')]===0x1f4){logger[_0x904f('0x17')](_0x904f('0x12'),_0x1bcfc3,_0x31e3e2[_0x904f('0x17')][_0x904f('0x19')]);return _0x156ec7(_0x31e3e2[_0x904f('0x17')]['message']);}logger['error'](_0x904f('0x12'),_0x1bcfc3,_0x31e3e2[_0x904f('0x17')]['message']);return _0x3477ae(_0x31e3e2['error']['message']);}else{logger[_0x904f('0x11')](_0x904f('0x12'),_0x1bcfc3,'request\x20sent');_0x3477ae(_0x31e3e2[_0x904f('0x1a')]['message']);}})['catch'](function(_0x5d9495){logger['error']('MailMessage,\x20%s,\x20%s',_0x1bcfc3,_0x5d9495);_0x156ec7(_0x5d9495);});});}exports['CreateMailMessage']=function(_0x884767){var _0x3e55b1=this;return new Promise(function(_0x4ab9b3,_0x22b1ba){return db[_0x904f('0x1b')][_0x904f('0x1c')](_0x884767['body'],{'raw':_0x884767[_0x904f('0x1d')]?_0x884767[_0x904f('0x1d')][_0x904f('0x1e')]===undefined?!![]:![]:!![]})[_0x904f('0x10')](function(_0x1f394d){logger[_0x904f('0x11')](_0x904f('0x1f'),_0x884767);logger[_0x904f('0x14')](_0x904f('0x1f'),_0x884767,JSON[_0x904f('0x16')](_0x1f394d));_0x4ab9b3(_0x1f394d);})[_0x904f('0x20')](function(_0x39205c){logger[_0x904f('0x17')](_0x904f('0x1f'),_0x39205c[_0x904f('0x19')],_0x884767);_0x22b1ba(_0x3e55b1['error'](0x1f4,_0x39205c['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 7c9cd03..ec06d78 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 _0x3544=['./mailMessage.events','save','remove','removeListener','register','length','mailMessage:'];(function(_0x19e748,_0x4d4009){var _0x56f158=function(_0x4c725e){while(--_0x4c725e){_0x19e748['push'](_0x19e748['shift']());}};_0x56f158(++_0x4d4009);}(_0x3544,0x70));var _0x4354=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3544[_0xa464c9];return _0x3d73c4;};'use strict';var MailMessageEvents=require(_0x4354('0x0'));var events=[_0x4354('0x1'),_0x4354('0x2'),'update'];function createListener(_0x1058d9,_0x1821d2){return function(_0xc58392){_0x1821d2['emit'](_0x1058d9,_0xc58392);};}function removeListener(_0x2fa6b4,_0xe66769){return function(){MailMessageEvents[_0x4354('0x3')](_0x2fa6b4,_0xe66769);};}exports[_0x4354('0x4')]=function(_0x5ca913){for(var _0x4a0e1e=0x0,_0x293d9e=events[_0x4354('0x5')];_0x4a0e1e<_0x293d9e;_0x4a0e1e++){var _0x1c6808=events[_0x4a0e1e];var _0x574127=createListener(_0x4354('0x6')+_0x1c6808,_0x5ca913);MailMessageEvents['on'](_0x1c6808,_0x574127);}}; \ No newline at end of file +var _0x1f75=['removeListener','register','length','mailMessage:','./mailMessage.events','save','remove','emit'];(function(_0x1b1f75,_0xeb05ee){var _0x41fa61=function(_0xbd992){while(--_0xbd992){_0x1b1f75['push'](_0x1b1f75['shift']());}};_0x41fa61(++_0xeb05ee);}(_0x1f75,0x12c));var _0x51f7=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x1f75[_0x373dee];return _0x46798f;};'use strict';var MailMessageEvents=require(_0x51f7('0x0'));var events=[_0x51f7('0x1'),_0x51f7('0x2'),'update'];function createListener(_0xc7556d,_0x131535){return function(_0x10fc45){_0x131535[_0x51f7('0x3')](_0xc7556d,_0x10fc45);};}function removeListener(_0x3df27f,_0x4e6fc){return function(){MailMessageEvents[_0x51f7('0x4')](_0x3df27f,_0x4e6fc);};}exports[_0x51f7('0x5')]=function(_0x292480){for(var _0x22fc29=0x0,_0x3eb36d=events[_0x51f7('0x6')];_0x22fc29<_0x3eb36d;_0x22fc29++){var _0x5a1f98=events[_0x22fc29];var _0x2d944f=createListener(_0x51f7('0x7')+_0x5a1f98,_0x292480);MailMessageEvents['on'](_0x5a1f98,_0x2d944f);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index b46d975..e5f5e77 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 _0x0775=['/:id/users','getAgents','create','post','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams'];(function(_0x396925,_0x5a8349){var _0x41def4=function(_0x540a0e){while(--_0x540a0e){_0x396925['push'](_0x396925['shift']());}};_0x41def4(++_0x5a8349);}(_0x0775,0x92));var _0x5077=function(_0x55ffc4,_0xdc5258){_0x55ffc4=_0x55ffc4-0x0;var _0x5c265c=_0x0775[_0x55ffc4];return _0x5c265c;};'use strict';var multer=require(_0x5077('0x0'));var util=require(_0x5077('0x1'));var path=require(_0x5077('0x2'));var timeout=require(_0x5077('0x3'));var express=require(_0x5077('0x4'));var router=express[_0x5077('0x5')]();var auth=require(_0x5077('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5077('0x7'));var controller=require(_0x5077('0x8'));router[_0x5077('0x9')]('/',auth[_0x5077('0xa')](),controller[_0x5077('0xb')]);router[_0x5077('0x9')](_0x5077('0xc'),auth[_0x5077('0xa')](),controller[_0x5077('0xd')]);router[_0x5077('0x9')](_0x5077('0xe'),auth[_0x5077('0xa')](),controller[_0x5077('0xf')]);router[_0x5077('0x9')](_0x5077('0x10'),auth[_0x5077('0xa')](),controller[_0x5077('0x11')]);router[_0x5077('0x9')]('/:id/teams',auth[_0x5077('0xa')](),controller[_0x5077('0x12')]);router[_0x5077('0x9')](_0x5077('0x13'),auth['isAuthenticated'](),controller[_0x5077('0x14')]);router['post']('/',auth[_0x5077('0xa')](),controller[_0x5077('0x15')]);router[_0x5077('0x16')](_0x5077('0x17'),auth['isAuthenticated'](),controller[_0x5077('0x18')]);router[_0x5077('0x16')](_0x5077('0x13'),auth[_0x5077('0xa')](),controller[_0x5077('0x19')]);router[_0x5077('0x1a')](_0x5077('0xe'),auth[_0x5077('0xa')](),controller[_0x5077('0x1b')]);router[_0x5077('0x1c')](_0x5077('0xe'),auth[_0x5077('0xa')](),controller[_0x5077('0x1d')]);router[_0x5077('0x1c')]('/:id/teams',auth[_0x5077('0xa')](),controller[_0x5077('0x1e')]);router[_0x5077('0x1c')](_0x5077('0x13'),auth['isAuthenticated'](),controller[_0x5077('0x1f')]);module[_0x5077('0x20')]=router; \ No newline at end of file +var _0x059a=['exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/:id','/:id/teams','/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams'];(function(_0x747474,_0x1a06bc){var _0x5be81e=function(_0x162514){while(--_0x162514){_0x747474['push'](_0x747474['shift']());}};_0x5be81e(++_0x1a06bc);}(_0x059a,0x151));var _0xa059=function(_0x317cc5,_0x3b6179){_0x317cc5=_0x317cc5-0x0;var _0x44fe81=_0x059a[_0x317cc5];return _0x44fe81;};'use strict';var multer=require(_0xa059('0x0'));var util=require('util');var path=require(_0xa059('0x1'));var timeout=require('connect-timeout');var express=require(_0xa059('0x2'));var router=express[_0xa059('0x3')]();var auth=require(_0xa059('0x4'));var interaction=require(_0xa059('0x5'));var config=require(_0xa059('0x6'));var controller=require(_0xa059('0x7'));router[_0xa059('0x8')]('/',auth[_0xa059('0x9')](),controller[_0xa059('0xa')]);router[_0xa059('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xa059('0x8')](_0xa059('0xb'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xa059('0x8')](_0xa059('0xc'),auth[_0xa059('0x9')](),controller['getTeams']);router[_0xa059('0x8')](_0xa059('0xd'),auth[_0xa059('0x9')](),controller['getAgents']);router[_0xa059('0xe')]('/',auth['isAuthenticated'](),controller[_0xa059('0xf')]);router[_0xa059('0xe')](_0xa059('0xc'),auth[_0xa059('0x9')](),controller[_0xa059('0x10')]);router[_0xa059('0xe')]('/:id/users',auth[_0xa059('0x9')](),controller[_0xa059('0x11')]);router[_0xa059('0x12')](_0xa059('0xb'),auth[_0xa059('0x9')](),controller[_0xa059('0x13')]);router[_0xa059('0x14')](_0xa059('0xb'),auth[_0xa059('0x9')](),controller[_0xa059('0x15')]);router[_0xa059('0x14')]('/:id/teams',auth[_0xa059('0x9')](),controller[_0xa059('0x16')]);router['delete']('/:id/users',auth[_0xa059('0x9')](),controller['removeAgents']);module[_0xa059('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 53c00d3..f444fd3 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 _0x973f=['ENUM','rrmemory','beepall','STRING','name','INTEGER'];(function(_0x3d474e,_0x431f54){var _0x30b3e3=function(_0xbe43e){while(--_0xbe43e){_0x3d474e['push'](_0x3d474e['shift']());}};_0x30b3e3(++_0x431f54);}(_0x973f,0x7b));var _0xf973=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x973f[_0x5a95fa];return _0x1a61b8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf973('0x0')],'unique':_0xf973('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf973('0x0')]},'timeout':{'type':Sequelize[_0xf973('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf973('0x3')](_0xf973('0x4'),_0xf973('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x1cc1=['INTEGER','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x140327,_0x4ff244){var _0x46f126=function(_0x36568c){while(--_0x36568c){_0x140327['push'](_0x140327['shift']());}};_0x46f126(++_0x4ff244);}(_0x1cc1,0x106));var _0x11cc=function(_0x2eb1be,_0x19ff07){_0x2eb1be=_0x2eb1be-0x0;var _0x56d8c2=_0x1cc1[_0x2eb1be];return _0x56d8c2;};'use strict';var Sequelize=require(_0x11cc('0x0'));module[_0x11cc('0x1')]={'name':{'type':Sequelize[_0x11cc('0x2')],'unique':_0x11cc('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x11cc('0x2')]},'timeout':{'type':Sequelize[_0x11cc('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x11cc('0x5'),_0x11cc('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index fc3f26f..e030d28 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 _0xd864=['merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','MailQueueId','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','findOne','addTeams','ids','Team','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','forEach','emit','userMailQueue:remove','addAgents','removeAgents','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','MailQueues','error','stack','name','send','index','map','MailQueue','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x3bf00f,_0x5e019f){var _0x437ab8=function(_0x1f88fb){while(--_0x1f88fb){_0x3bf00f['push'](_0x3bf00f['shift']());}};_0x437ab8(++_0x5e019f);}(_0xd864,0x1df));var _0x4d86=function(_0x2ed06f,_0x263323){_0x2ed06f=_0x2ed06f-0x0;var _0xb0470e=_0xd864[_0x2ed06f];return _0xb0470e;};'use strict';var pdf=require(_0x4d86('0x0'));var emlformat=require(_0x4d86('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4d86('0x2'));var jsonpatch=require(_0x4d86('0x3'));var rp=require(_0x4d86('0x4'));var moment=require(_0x4d86('0x5'));var BPromise=require(_0x4d86('0x6'));var Mustache=require('mustache');var util=require(_0x4d86('0x7'));var path=require(_0x4d86('0x8'));var sox=require(_0x4d86('0x9'));var csv=require(_0x4d86('0xa'));var ejs=require(_0x4d86('0xb'));var fs=require('fs');var _=require(_0x4d86('0xc'));var squel=require(_0x4d86('0xd'));var crypto=require('crypto');var jsforce=require(_0x4d86('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4d86('0xf'));var Papa=require(_0x4d86('0x10'));var Redis=require(_0x4d86('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4d86('0x12'));var as=require(_0x4d86('0x13'));var hardwareService=require(_0x4d86('0x14'));var logger=require('../../config/logger')(_0x4d86('0x15'));var utils=require(_0x4d86('0x16'));var config=require(_0x4d86('0x17'));var db=require(_0x4d86('0x18'))['db'];config['redis']=_['defaults'](config[_0x4d86('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x4d86('0x1a'))(new Redis(config[_0x4d86('0x19')]));require(_0x4d86('0x1b'))[_0x4d86('0x1c')](socket);function respondWithStatusCode(_0x6902cc,_0x5cee57){_0x5cee57=_0x5cee57||0xcc;return function(_0x24a3d8){if(_0x24a3d8){return _0x6902cc[_0x4d86('0x1d')](_0x5cee57);}return _0x6902cc[_0x4d86('0x1e')](_0x5cee57)[_0x4d86('0x1f')]();};}function respondWithResult(_0x223998,_0x2a86f8){_0x2a86f8=_0x2a86f8||0xc8;return function(_0x3565e0){if(_0x3565e0){return _0x223998[_0x4d86('0x1e')](_0x2a86f8)[_0x4d86('0x20')](_0x3565e0);}};}function respondWithFilteredResult(_0x1eea66,_0x9b189d){return function(_0x1bf418){if(_0x1bf418){var _0x546937=_0x1bf418[_0x4d86('0x21')],_0x739f38=_0x9b189d[_0x4d86('0x22')],_0x208db0=_0x9b189d['offset']+_0x9b189d[_0x4d86('0x23')],_0x2e427b;if(_0x208db0>=_0x546937){_0x208db0=_0x546937;_0x2e427b=0xc8;}else{_0x2e427b=0xce;}_0x1eea66['status'](_0x2e427b);return _0x1eea66[_0x4d86('0x24')](_0x4d86('0x25'),_0x739f38+'-'+_0x208db0+'/'+_0x546937)['json'](_0x1bf418);}return null;};}function patchUpdates(_0x1c836d){return function(_0x48a24f){try{jsonpatch[_0x4d86('0x26')](_0x48a24f,_0x1c836d,!![]);}catch(_0x4fd0ce){return BPromise[_0x4d86('0x27')](_0x4fd0ce);}return _0x48a24f['save']();};}function saveUpdates(_0x3b458a,_0x4d04eb){return function(_0x4506f8){if(_0x4506f8){return _0x4506f8[_0x4d86('0x28')](_0x3b458a)[_0x4d86('0x29')](function(_0x556d79){return _0x556d79;});}return null;};}function removeEntity(_0x1c4b3a,_0x2d28f6){return function(_0x4fc963){if(_0x4fc963){return _0x4fc963[_0x4d86('0x2a')]()[_0x4d86('0x29')](function(){var _0x2c0920=_0x4fc963[_0x4d86('0x2b')]({'plain':!![]});var _0x47fa46=_0x4d86('0x2c');return db['UserProfileResource'][_0x4d86('0x2a')]({'where':{'type':_0x47fa46,'resourceId':_0x2c0920['id']}})[_0x4d86('0x29')](function(){return _0x4fc963;});})['then'](function(){_0x1c4b3a[_0x4d86('0x1e')](0xcc)[_0x4d86('0x1f')]();});}};}function handleEntityNotFound(_0x110808,_0x584d7b){return function(_0x3d4942){if(!_0x3d4942){_0x110808[_0x4d86('0x1d')](0x194);}return _0x3d4942;};}function handleError(_0x3543f5,_0x7a4dfe){_0x7a4dfe=_0x7a4dfe||0x1f4;return function(_0x5ab3ca){logger[_0x4d86('0x2d')](_0x5ab3ca[_0x4d86('0x2e')]);if(_0x5ab3ca[_0x4d86('0x2f')]){delete _0x5ab3ca[_0x4d86('0x2f')];}_0x3543f5['status'](_0x7a4dfe)[_0x4d86('0x30')](_0x5ab3ca);};}exports[_0x4d86('0x31')]=function(_0xc745c1,_0x153d22){var _0x5ece11={},_0x52a42e={},_0x191b61={'count':0x0,'rows':[]};var _0x35ee11=_[_0x4d86('0x32')](db[_0x4d86('0x33')][_0x4d86('0x34')],function(_0x262aae){return{'name':_0x262aae['fieldName'],'type':_0x262aae['type'][_0x4d86('0x35')]};});_0x52a42e[_0x4d86('0x36')]=_[_0x4d86('0x32')](_0x35ee11,'name');_0x52a42e[_0x4d86('0x37')]=_[_0x4d86('0x38')](_0xc745c1[_0x4d86('0x37')]);_0x52a42e[_0x4d86('0x39')]=_[_0x4d86('0x3a')](_0x52a42e[_0x4d86('0x36')],_0x52a42e[_0x4d86('0x37')]);_0x5ece11[_0x4d86('0x3b')]=_['intersection'](_0x52a42e[_0x4d86('0x36')],qs[_0x4d86('0x3c')](_0xc745c1[_0x4d86('0x37')][_0x4d86('0x3c')]));_0x5ece11[_0x4d86('0x3b')]=_0x5ece11[_0x4d86('0x3b')][_0x4d86('0x3d')]?_0x5ece11[_0x4d86('0x3b')]:_0x52a42e[_0x4d86('0x36')];if(!_0xc745c1[_0x4d86('0x37')][_0x4d86('0x3e')](_0x4d86('0x3f'))){_0x5ece11[_0x4d86('0x23')]=qs[_0x4d86('0x23')](_0xc745c1[_0x4d86('0x37')][_0x4d86('0x23')]);_0x5ece11[_0x4d86('0x22')]=qs[_0x4d86('0x22')](_0xc745c1['query'][_0x4d86('0x22')]);}_0x5ece11[_0x4d86('0x40')]=qs[_0x4d86('0x41')](_0xc745c1[_0x4d86('0x37')]['sort']);_0x5ece11[_0x4d86('0x42')]=qs['filters'](_[_0x4d86('0x43')](_0xc745c1[_0x4d86('0x37')],_0x52a42e[_0x4d86('0x39')]),_0x35ee11);if(_0xc745c1['query'][_0x4d86('0x44')]){_0x5ece11[_0x4d86('0x42')]=_[_0x4d86('0x45')](_0x5ece11[_0x4d86('0x42')],{'$or':_['map'](_0x35ee11,function(_0x19c963){if(_0x19c963[_0x4d86('0x46')]!==_0x4d86('0x47')){var _0x47677b={};_0x47677b[_0x19c963[_0x4d86('0x2f')]]={'$like':'%'+_0xc745c1[_0x4d86('0x37')][_0x4d86('0x44')]+'%'};return _0x47677b;}})});}_0x5ece11=_['merge']({},_0x5ece11,_0xc745c1[_0x4d86('0x48')]);var _0x35be90={'where':_0x5ece11[_0x4d86('0x42')]};return db['MailQueue']['count'](_0x35be90)[_0x4d86('0x29')](function(_0x44b083){_0x191b61[_0x4d86('0x21')]=_0x44b083;if(_0xc745c1[_0x4d86('0x37')][_0x4d86('0x49')]){_0x5ece11['include']=[{'all':!![]}];}return db[_0x4d86('0x33')][_0x4d86('0x4a')](_0x5ece11);})[_0x4d86('0x29')](function(_0x42ed7a){_0x191b61[_0x4d86('0x4b')]=_0x42ed7a;return _0x191b61;})['then'](respondWithFilteredResult(_0x153d22,_0x5ece11))[_0x4d86('0x4c')](handleError(_0x153d22,null));};exports[_0x4d86('0x4d')]=function(_0x470459,_0x69965b){var _0x5dea2b={'raw':!![],'where':{'id':_0x470459[_0x4d86('0x4e')]['id']}},_0x5bbbcc={};_0x5bbbcc['model']=_[_0x4d86('0x38')](db[_0x4d86('0x33')][_0x4d86('0x34')]);_0x5bbbcc[_0x4d86('0x37')]=_[_0x4d86('0x38')](_0x470459['query']);_0x5bbbcc['filters']=_['intersection'](_0x5bbbcc[_0x4d86('0x36')],_0x5bbbcc[_0x4d86('0x37')]);_0x5dea2b[_0x4d86('0x3b')]=_[_0x4d86('0x3a')](_0x5bbbcc['model'],qs[_0x4d86('0x3c')](_0x470459[_0x4d86('0x37')]['fields']));_0x5dea2b[_0x4d86('0x3b')]=_0x5dea2b[_0x4d86('0x3b')][_0x4d86('0x3d')]?_0x5dea2b[_0x4d86('0x3b')]:_0x5bbbcc[_0x4d86('0x36')];if(_0x470459['query'][_0x4d86('0x49')]){_0x5dea2b['include']=[{'all':!![]}];}_0x5dea2b=_['merge']({},_0x5dea2b,_0x470459[_0x4d86('0x48')]);return db[_0x4d86('0x33')]['find'](_0x5dea2b)[_0x4d86('0x29')](handleEntityNotFound(_0x69965b,null))[_0x4d86('0x29')](respondWithResult(_0x69965b,null))[_0x4d86('0x4c')](handleError(_0x69965b,null));};exports[_0x4d86('0x4f')]=function(_0x3eb5c2,_0xd48df7){return db[_0x4d86('0x33')]['create'](_0x3eb5c2[_0x4d86('0x50')],{})[_0x4d86('0x29')](function(_0x16afd8){var _0x9de05b=_0x3eb5c2['user'][_0x4d86('0x2b')]({'plain':!![]});if(!_0x9de05b)throw new Error(_0x4d86('0x51'));if(_0x9de05b[_0x4d86('0x52')]==='user'){var _0x192fbb=_0x16afd8['get']({'plain':!![]});var _0x2b41af='MailQueues';return db['UserProfileSection'][_0x4d86('0x53')]({'where':{'name':_0x2b41af,'userProfileId':_0x9de05b['userProfileId']},'raw':!![]})['then'](function(_0x1bfb49){if(_0x1bfb49&&_0x1bfb49['autoAssociation']===0x0){return db[_0x4d86('0x54')][_0x4d86('0x4f')]({'name':_0x192fbb[_0x4d86('0x2f')],'resourceId':_0x192fbb['id'],'type':_0x1bfb49['name'],'sectionId':_0x1bfb49['id']},{})[_0x4d86('0x29')](function(){return _0x16afd8;});}else{return _0x16afd8;}})['catch'](function(_0x9ababc){logger[_0x4d86('0x2d')](_0x4d86('0x55'),_0x9ababc);throw _0x9ababc;});}return _0x16afd8;})[_0x4d86('0x29')](respondWithResult(_0xd48df7,0xc9))[_0x4d86('0x4c')](handleError(_0xd48df7,null));};exports[_0x4d86('0x28')]=function(_0x393037,_0x3f8158){if(_0x393037[_0x4d86('0x50')]['id']){delete _0x393037[_0x4d86('0x50')]['id'];}return db[_0x4d86('0x33')][_0x4d86('0x53')]({'where':{'id':_0x393037[_0x4d86('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3f8158,null))[_0x4d86('0x29')](saveUpdates(_0x393037['body'],null))[_0x4d86('0x29')](respondWithResult(_0x3f8158,null))[_0x4d86('0x4c')](handleError(_0x3f8158,null));};exports['destroy']=function(_0x537ef5,_0x30040f){return db[_0x4d86('0x33')][_0x4d86('0x53')]({'where':{'id':_0x537ef5[_0x4d86('0x4e')]['id']}})[_0x4d86('0x29')](handleEntityNotFound(_0x30040f,null))[_0x4d86('0x29')](removeEntity(_0x30040f,null))[_0x4d86('0x4c')](handleError(_0x30040f,null));};exports[_0x4d86('0x56')]=function(_0x982802,_0x3f930b){return db[_0x4d86('0x33')][_0x4d86('0x56')]()[_0x4d86('0x29')](respondWithResult(_0x3f930b,null))['catch'](handleError(_0x3f930b,null));};exports[_0x4d86('0x57')]=function(_0x369935,_0x4b5226,_0x1d95a1){var _0x1efba5={'raw':!![],'where':{}},_0x49fb8e={},_0x1415ee;return db[_0x4d86('0x33')]['findOne']({'where':{'id':_0x369935[_0x4d86('0x4e')]['id']}})[_0x4d86('0x29')](handleEntityNotFound(_0x4b5226,null))[_0x4d86('0x29')](function(_0x31ab8c){if(_0x31ab8c){_0x1415ee=_0x31ab8c[_0x4d86('0x2b')]({'plain':!![]});_0x49fb8e[_0x4d86('0x36')]=_['keys'](db[_0x4d86('0x58')]['rawAttributes']);_0x49fb8e[_0x4d86('0x37')]=_[_0x4d86('0x38')](_0x369935[_0x4d86('0x37')]);_0x49fb8e['filters']=_[_0x4d86('0x3a')](_0x49fb8e[_0x4d86('0x36')],_0x49fb8e['query']);_0x1efba5[_0x4d86('0x3b')]=_[_0x4d86('0x3a')](_0x49fb8e['model'],qs[_0x4d86('0x3c')](_0x369935[_0x4d86('0x37')][_0x4d86('0x3c')]));_0x1efba5['attributes']=_0x1efba5[_0x4d86('0x3b')]['length']?_0x1efba5['attributes']:_0x49fb8e[_0x4d86('0x36')];if(!_0x369935[_0x4d86('0x37')][_0x4d86('0x3e')](_0x4d86('0x3f'))){_0x1efba5[_0x4d86('0x23')]=qs['limit'](_0x369935['query'][_0x4d86('0x23')]);_0x1efba5[_0x4d86('0x22')]=qs[_0x4d86('0x22')](_0x369935[_0x4d86('0x37')][_0x4d86('0x22')]);}_0x1efba5[_0x4d86('0x40')]=qs[_0x4d86('0x41')](_0x369935[_0x4d86('0x37')][_0x4d86('0x41')]);_0x1efba5[_0x4d86('0x42')]=qs[_0x4d86('0x39')](_[_0x4d86('0x43')](_0x369935[_0x4d86('0x37')],_0x49fb8e[_0x4d86('0x39')]));_0x1efba5[_0x4d86('0x42')][_0x4d86('0x59')]=_0x31ab8c['id'];if(_0x369935['query'][_0x4d86('0x44')]){_0x1efba5[_0x4d86('0x42')]=_[_0x4d86('0x45')](_0x1efba5[_0x4d86('0x42')],{'$or':_['map'](_0x1efba5[_0x4d86('0x3b')],function(_0x1b133e){var _0x4b0a59={};_0x4b0a59[_0x1b133e]={'$like':'%'+_0x369935[_0x4d86('0x37')]['filter']+'%'};return _0x4b0a59;})});}_0x1efba5=_[_0x4d86('0x45')]({},_0x1efba5,_0x369935[_0x4d86('0x48')]);return db[_0x4d86('0x58')][_0x4d86('0x4a')](_0x1efba5);}})['then'](function(_0x5cb80a){if(_0x5cb80a){return db['User'][_0x4d86('0x5a')]({'where':{'id':_[_0x4d86('0x32')](_0x5cb80a,_0x4d86('0x5b')),'role':'agent'},'attributes':['id',_0x4d86('0x2f'),_0x4d86('0x5c'),_0x4d86('0x5d'),_0x4d86('0x5e')]});}})[_0x4d86('0x29')](function(_0x31e82c){if(_0x31e82c){return{'count':_0x31e82c['count'],'rows':_[_0x4d86('0x32')](_0x31e82c[_0x4d86('0x4b')],function(_0x2cc62e){return{'membername':_0x2cc62e[_0x4d86('0x2f')],'UserId':_0x2cc62e['id'],'queue_name':_0x1415ee['name'],'MailQueueId':_0x1415ee['id'],'interface':util[_0x4d86('0x5f')]('%s/%s','SIP',_0x2cc62e[_0x4d86('0x2f')]),'penalty':0x0,'paused':_0x2cc62e['mailPause'],'createdAt':_0x2cc62e['createdAt'],'updatedAt':_0x2cc62e[_0x4d86('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4d86('0x29')](respondWithFilteredResult(_0x4b5226,_0x1efba5))[_0x4d86('0x4c')](handleError(_0x4b5226,null));};exports['getTeams']=function(_0x131999,_0x331c2c,_0x4959e8){var _0xd8b23d={};var _0x238fc1={};var _0x3722c4;var _0x38ba3d;return db[_0x4d86('0x33')][_0x4d86('0x60')]({'where':{'id':_0x131999[_0x4d86('0x4e')]['id']}})[_0x4d86('0x29')](handleEntityNotFound(_0x331c2c,null))[_0x4d86('0x29')](function(_0x45ad59){if(_0x45ad59){_0x3722c4=_0x45ad59;_0x238fc1['model']=_[_0x4d86('0x38')](db['Team'][_0x4d86('0x34')]);_0x238fc1[_0x4d86('0x37')]=_['keys'](_0x131999[_0x4d86('0x37')]);_0x238fc1[_0x4d86('0x39')]=_[_0x4d86('0x3a')](_0x238fc1[_0x4d86('0x36')],_0x238fc1[_0x4d86('0x37')]);_0xd8b23d['attributes']=_[_0x4d86('0x3a')](_0x238fc1[_0x4d86('0x36')],qs[_0x4d86('0x3c')](_0x131999[_0x4d86('0x37')][_0x4d86('0x3c')]));_0xd8b23d[_0x4d86('0x3b')]=_0xd8b23d[_0x4d86('0x3b')][_0x4d86('0x3d')]?_0xd8b23d[_0x4d86('0x3b')]:_0x238fc1['model'];_0xd8b23d[_0x4d86('0x40')]=qs['sort'](_0x131999[_0x4d86('0x37')][_0x4d86('0x41')]);_0xd8b23d[_0x4d86('0x42')]=qs[_0x4d86('0x39')](_[_0x4d86('0x43')](_0x131999['query'],_0x238fc1[_0x4d86('0x39')]));if(_0x131999[_0x4d86('0x37')][_0x4d86('0x44')]){_0xd8b23d['where']=_[_0x4d86('0x45')](_0xd8b23d['where'],{'$or':_[_0x4d86('0x32')](_0xd8b23d[_0x4d86('0x3b')],function(_0x3e493f){var _0x3aa886={};_0x3aa886[_0x3e493f]={'$like':'%'+_0x131999[_0x4d86('0x37')]['filter']+'%'};return _0x3aa886;})});}_0xd8b23d=_[_0x4d86('0x45')]({},_0xd8b23d,_0x131999['options']);return _0x3722c4['getTeams'](_0xd8b23d);}})['then'](function(_0x49a586){if(_0x49a586){_0x38ba3d=_0x49a586[_0x4d86('0x3d')];if(!_0x131999[_0x4d86('0x37')][_0x4d86('0x3e')](_0x4d86('0x3f'))){_0xd8b23d[_0x4d86('0x23')]=qs['limit'](_0x131999[_0x4d86('0x37')]['limit']);_0xd8b23d[_0x4d86('0x22')]=qs[_0x4d86('0x22')](_0x131999[_0x4d86('0x37')][_0x4d86('0x22')]);}return _0x3722c4['getTeams'](_0xd8b23d);}})[_0x4d86('0x29')](function(_0x395959){if(_0x395959){return _0x395959?{'count':_0x38ba3d,'rows':_0x395959}:null;}})['then'](respondWithResult(_0x331c2c,null))[_0x4d86('0x4c')](handleError(_0x331c2c,null));};exports[_0x4d86('0x61')]=function(_0x2f744e,_0x289a3e,_0x2ed8e8){var _0x3661ac=_0x2f744e[_0x4d86('0x50')][_0x4d86('0x62')];return db[_0x4d86('0x63')][_0x4d86('0x4a')]({'where':{'id':_0x3661ac},'attributes':['id'],'include':[{'model':db[_0x4d86('0x64')],'as':_0x4d86('0x65'),'attributes':['id','name',_0x4d86('0x66'),_0x4d86('0x67'),_0x4d86('0x68')],'raw':!![]}]})[_0x4d86('0x29')](function(_0x79f977){if(_0x79f977){var _0x260a83=_[_0x4d86('0x69')](_0x79f977,function(_0x5e8f7e){var _0x365229=_0x5e8f7e['get']({'plain':!![]});return _0x365229[_0x4d86('0x65')];});return db[_0x4d86('0x33')]['find']({'where':{'id':_0x2f744e[_0x4d86('0x4e')]['id']}})['then'](function(_0x2ced71){return db[_0x4d86('0x6a')][_0x4d86('0x6b')](function(_0x382c3c){return _0x2ced71[_0x4d86('0x61')](_0x3661ac,{'transaction':_0x382c3c})[_0x4d86('0x29')](function(){return BPromise[_0x4d86('0x6c')](_0x260a83,function(_0x5eb6db){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x5eb6db['id'],'MailQueueId':_0x2f744e[_0x4d86('0x4e')]['id']},'transaction':_0x382c3c});});})[_0x4d86('0x29')](function(){_0x260a83['forEach'](function(_0x44991b){socket['emit'](_0x4d86('0x6d'),{'UserId':_0x44991b['id'],'MailQueueId':_0x2ced71['id']});});});});});}})['then'](respondWithStatusCode(_0x289a3e,null))['catch'](handleError(_0x289a3e,null));};exports[_0x4d86('0x6e')]=function(_0x540922,_0x33aac1,_0x5361c7){return db[_0x4d86('0x63')][_0x4d86('0x4a')]({'where':{'id':_0x540922[_0x4d86('0x37')][_0x4d86('0x62')]},'attributes':['id'],'include':[{'model':db[_0x4d86('0x64')],'as':_0x4d86('0x65'),'attributes':['id'],'raw':!![]}]})[_0x4d86('0x29')](handleEntityNotFound(_0x33aac1,null))[_0x4d86('0x29')](function(_0x582890){var _0x470d05=_[_0x4d86('0x32')](_0x582890,'id');var _0x3e85e0=[];var _0x45ecca=[];var _0x4fa1ef=squel[_0x4d86('0x6f')]();_0x4fa1ef[_0x4d86('0x70')](_0x4d86('0x71'))[_0x4d86('0x72')](_0x4d86('0x73'),'tq')['join'](_0x4d86('0x74'),'ut',_0x4d86('0x75'))[_0x4d86('0x42')](_0x4d86('0x76'),_0x540922['params']['id']);for(var _0x169f7b=0x0;_0x169f7b<_0x582890[_0x4d86('0x3d')];_0x169f7b+=0x1){let _0x2fb566=_0x582890[_0x169f7b];for(var _0x1f02f0=0x0;_0x1f02f0<_0x2fb566[_0x4d86('0x65')]['length'];_0x1f02f0+=0x1){let _0x3a5630=_0x2fb566[_0x4d86('0x65')][_0x1f02f0];var _0xa18c1c=_0x4fa1ef[_0x4d86('0x77')]();_0xa18c1c['where']('ut.UserId\x20=\x20?',_0x3a5630['id']);_0x45ecca['push'](db[_0x4d86('0x6a')][_0x4d86('0x37')](_0xa18c1c[_0x4d86('0x78')](),{'type':db[_0x4d86('0x6a')][_0x4d86('0x79')][_0x4d86('0x7a')]})[_0x4d86('0x29')](function(_0x153e0a){if(_0x153e0a[_0x4d86('0x3d')]===0x1){return _0x3a5630['id'];}else{var _0x2e1ddc=_[_0x4d86('0x7b')](_['map'](_0x153e0a,_0x4d86('0x7c')),function(_0x544a31){return _[_0x4d86('0x7d')](_0x470d05,_0x544a31);});if(_0x2e1ddc){return _0x3a5630['id'];}}}));}}return BPromise[_0x4d86('0x7e')](_0x45ecca)[_0x4d86('0x29')](function(_0x1d1318){_0x3e85e0=_(_0x3e85e0)['union'](_0x1d1318)[_0x4d86('0x7f')]()[_0x4d86('0x80')]();return db[_0x4d86('0x33')][_0x4d86('0x53')]({'where':{'id':_0x540922[_0x4d86('0x4e')]['id']}})['then'](function(_0x2534ea){return db[_0x4d86('0x6a')][_0x4d86('0x6b')](function(_0x41f671){return _0x2534ea[_0x4d86('0x6e')](_0x540922[_0x4d86('0x37')][_0x4d86('0x62')],{'transaction':_0x41f671})[_0x4d86('0x29')](function(){if(!_[_0x4d86('0x81')](_0x3e85e0)){return _0x2534ea['removeAgents'](_0x3e85e0,{'transaction':_0x41f671});}})[_0x4d86('0x29')](function(){_0x3e85e0[_0x4d86('0x82')](function(_0x34dbf4){socket[_0x4d86('0x83')](_0x4d86('0x84'),{'UserId':_0x34dbf4,'MailQueueId':_0x2534ea['id']});});});});});});})[_0x4d86('0x29')](respondWithStatusCode(_0x33aac1,null))[_0x4d86('0x4c')](handleError(_0x33aac1,null));};exports[_0x4d86('0x85')]=function(_0x47671e,_0x57955f,_0xf99ed6){return db[_0x4d86('0x33')][_0x4d86('0x53')]({'where':{'id':_0x47671e[_0x4d86('0x4e')]['id']}})['then'](handleEntityNotFound(_0x57955f,null))[_0x4d86('0x29')](function(_0x147496){if(_0x147496){return _0x147496['addAgents'](_0x47671e[_0x4d86('0x50')][_0x4d86('0x62')],_['omit'](_0x47671e['body'],[_0x4d86('0x62'),'id'])||{})['spread'](function(_0x687039){for(var _0x371290=0x0;_0x371290<_0x47671e[_0x4d86('0x50')][_0x4d86('0x62')]['length'];_0x371290+=0x1){socket[_0x4d86('0x83')](_0x4d86('0x6d'),{'UserId':_0x47671e[_0x4d86('0x50')][_0x4d86('0x62')][_0x371290],'MailQueueId':_0x47671e[_0x4d86('0x4e')]['id']});}return _0x687039;});}})[_0x4d86('0x29')](respondWithResult(_0x57955f,null))[_0x4d86('0x4c')](handleError(_0x57955f,null));};exports[_0x4d86('0x86')]=function(_0x3b2ce8,_0x542a37,_0x5ce9fa){return db[_0x4d86('0x33')][_0x4d86('0x53')]({'where':{'id':_0x3b2ce8[_0x4d86('0x4e')]['id']}})[_0x4d86('0x29')](handleEntityNotFound(_0x542a37,null))[_0x4d86('0x29')](function(_0x4da02f){if(_0x4da02f){return _0x4da02f[_0x4d86('0x86')](_0x3b2ce8[_0x4d86('0x37')][_0x4d86('0x62')])['then'](function(){if(_[_0x4d86('0x87')](_0x3b2ce8[_0x4d86('0x37')][_0x4d86('0x62')])){for(var _0x5b5d97=0x0;_0x5b5d97<_0x3b2ce8[_0x4d86('0x37')]['ids'][_0x4d86('0x3d')];_0x5b5d97+=0x1){socket[_0x4d86('0x83')](_0x4d86('0x84'),{'UserId':Number(_0x3b2ce8[_0x4d86('0x37')]['ids'][_0x5b5d97]),'MailQueueId':Number(_0x3b2ce8[_0x4d86('0x4e')]['id'])});}}else{socket['emit'](_0x4d86('0x84'),{'UserId':Number(_0x3b2ce8[_0x4d86('0x37')][_0x4d86('0x62')]),'MailQueueId':Number(_0x3b2ce8[_0x4d86('0x4e')]['id'])});}});}})[_0x4d86('0x29')](respondWithStatusCode(_0x542a37,null))[_0x4d86('0x4c')](handleError(_0x542a37,null));};exports[_0x4d86('0x88')]=function(_0x26f7e3,_0x4ccc84,_0x1200ec){var _0x42414a={};var _0x5a7d02={};var _0x34dd98;var _0x1a5f3a;return db[_0x4d86('0x33')][_0x4d86('0x60')]({'where':{'id':_0x26f7e3[_0x4d86('0x4e')]['id']}})[_0x4d86('0x29')](handleEntityNotFound(_0x4ccc84,null))[_0x4d86('0x29')](function(_0x3be617){if(_0x3be617){_0x34dd98=_0x3be617;_0x5a7d02[_0x4d86('0x36')]=_['keys'](db[_0x4d86('0x64')][_0x4d86('0x34')]);_0x5a7d02[_0x4d86('0x37')]=_[_0x4d86('0x38')](_0x26f7e3[_0x4d86('0x37')]);_0x5a7d02[_0x4d86('0x39')]=_['intersection'](_0x5a7d02[_0x4d86('0x36')],_0x5a7d02['query']);_0x42414a[_0x4d86('0x3b')]=_[_0x4d86('0x3a')](_0x5a7d02[_0x4d86('0x36')],qs[_0x4d86('0x3c')](_0x26f7e3[_0x4d86('0x37')]['fields']));_0x42414a[_0x4d86('0x3b')]=_0x42414a[_0x4d86('0x3b')][_0x4d86('0x3d')]?_0x42414a[_0x4d86('0x3b')]:_0x5a7d02[_0x4d86('0x36')];_0x42414a[_0x4d86('0x40')]=qs[_0x4d86('0x41')](_0x26f7e3[_0x4d86('0x37')][_0x4d86('0x41')]);_0x42414a[_0x4d86('0x42')]=qs[_0x4d86('0x39')](_[_0x4d86('0x43')](_0x26f7e3[_0x4d86('0x37')],_0x5a7d02[_0x4d86('0x39')]));if(_0x26f7e3[_0x4d86('0x37')][_0x4d86('0x44')]){_0x42414a[_0x4d86('0x42')]=_[_0x4d86('0x45')](_0x42414a[_0x4d86('0x42')],{'$or':_['map'](_0x42414a[_0x4d86('0x3b')],function(_0xe151d6){var _0x270c49={};_0x270c49[_0xe151d6]={'$like':'%'+_0x26f7e3[_0x4d86('0x37')]['filter']+'%'};return _0x270c49;})});}_0x42414a=_[_0x4d86('0x45')]({},_0x42414a,_0x26f7e3['options']);return _0x34dd98['getAgents'](_0x42414a);}})[_0x4d86('0x29')](function(_0x591e5b){if(_0x591e5b){_0x1a5f3a=_0x591e5b[_0x4d86('0x3d')];if(!_0x26f7e3[_0x4d86('0x37')][_0x4d86('0x3e')](_0x4d86('0x3f'))){_0x42414a['limit']=qs[_0x4d86('0x23')](_0x26f7e3[_0x4d86('0x37')][_0x4d86('0x23')]);_0x42414a[_0x4d86('0x22')]=qs['offset'](_0x26f7e3[_0x4d86('0x37')]['offset']);}return _0x34dd98[_0x4d86('0x88')](_0x42414a);}})[_0x4d86('0x29')](function(_0x2cedb6){if(_0x2cedb6){return _0x2cedb6?{'count':_0x1a5f3a,'rows':_0x2cedb6}:null;}})['then'](respondWithResult(_0x4ccc84,null))[_0x4d86('0x4c')](handleError(_0x4ccc84,null));}; \ No newline at end of file +var _0xc058=['to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','limit','Content-Range','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','MailQueue','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','options','count','includeAll','findAll','rows','include','find','catch','create','user','MailQueues','UserProfileSection','autoAssociation','update','body','params','describe','getMembers','findOne','UserMailQueue','nolimit','MailQueueId','filter','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','SIP','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','findOrCreate','forEach','emit','select','field','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','userMailQueue:save','isArray','getAgents','html-pdf','zip-dir','request-promise','bluebird','mustache','util','path','sox'];(function(_0x490214,_0x8b5f84){var _0x9c9a46=function(_0x27b206){while(--_0x27b206){_0x490214['push'](_0x490214['shift']());}};_0x9c9a46(++_0x8b5f84);}(_0xc058,0x193));var _0x8c05=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xc058[_0x27af45];return _0x18df21;};'use strict';var pdf=require(_0x8c05('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8c05('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c05('0x2'));var moment=require('moment');var BPromise=require(_0x8c05('0x3'));var Mustache=require(_0x8c05('0x4'));var util=require(_0x8c05('0x5'));var path=require(_0x8c05('0x6'));var sox=require(_0x8c05('0x7'));var csv=require(_0x8c05('0x8'));var ejs=require(_0x8c05('0x9'));var fs=require('fs');var _=require(_0x8c05('0xa'));var squel=require(_0x8c05('0xb'));var crypto=require(_0x8c05('0xc'));var jsforce=require(_0x8c05('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8c05('0x8'));var querystring=require('querystring');var Papa=require(_0x8c05('0xe'));var Redis=require(_0x8c05('0xf'));var authService=require(_0x8c05('0x10'));var qs=require(_0x8c05('0x11'));var as=require(_0x8c05('0x12'));var hardwareService=require(_0x8c05('0x13'));var logger=require('../../config/logger')(_0x8c05('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x8c05('0x15'))['db'];config['redis']=_[_0x8c05('0x16')](config[_0x8c05('0x17')],{'host':_0x8c05('0x18'),'port':0x18eb});var socket=require(_0x8c05('0x19'))(new Redis(config['redis']));require('./mailQueue.socket')[_0x8c05('0x1a')](socket);function respondWithStatusCode(_0x5007c0,_0x45acee){_0x45acee=_0x45acee||0xcc;return function(_0x3cf14c){if(_0x3cf14c){return _0x5007c0[_0x8c05('0x1b')](_0x45acee);}return _0x5007c0['status'](_0x45acee)[_0x8c05('0x1c')]();};}function respondWithResult(_0x196940,_0x14e713){_0x14e713=_0x14e713||0xc8;return function(_0x2d4d61){if(_0x2d4d61){return _0x196940[_0x8c05('0x1d')](_0x14e713)[_0x8c05('0x1e')](_0x2d4d61);}};}function respondWithFilteredResult(_0x50f590,_0x22bd50){return function(_0x4ea2dc){if(_0x4ea2dc){var _0x40d4d3=_0x4ea2dc['count'],_0x1a4b7b=_0x22bd50[_0x8c05('0x1f')],_0x2c4aa6=_0x22bd50[_0x8c05('0x1f')]+_0x22bd50[_0x8c05('0x20')],_0x37d507;if(_0x2c4aa6>=_0x40d4d3){_0x2c4aa6=_0x40d4d3;_0x37d507=0xc8;}else{_0x37d507=0xce;}_0x50f590[_0x8c05('0x1d')](_0x37d507);return _0x50f590['set'](_0x8c05('0x21'),_0x1a4b7b+'-'+_0x2c4aa6+'/'+_0x40d4d3)['json'](_0x4ea2dc);}return null;};}function patchUpdates(_0x1734e9){return function(_0x40f0f5){try{jsonpatch['apply'](_0x40f0f5,_0x1734e9,!![]);}catch(_0x19a764){return BPromise[_0x8c05('0x22')](_0x19a764);}return _0x40f0f5[_0x8c05('0x23')]();};}function saveUpdates(_0x53966b,_0x293f11){return function(_0x13999b){if(_0x13999b){return _0x13999b['update'](_0x53966b)[_0x8c05('0x24')](function(_0x37b412){return _0x37b412;});}return null;};}function removeEntity(_0x15a110,_0x5d8677){return function(_0x3a9b48){if(_0x3a9b48){return _0x3a9b48[_0x8c05('0x25')]()[_0x8c05('0x24')](function(){var _0x56de9d=_0x3a9b48[_0x8c05('0x26')]({'plain':!![]});var _0x457c67='MailQueues';return db[_0x8c05('0x27')][_0x8c05('0x25')]({'where':{'type':_0x457c67,'resourceId':_0x56de9d['id']}})['then'](function(){return _0x3a9b48;});})[_0x8c05('0x24')](function(){_0x15a110['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fb2d1,_0x1b1eb9){return function(_0x47134e){if(!_0x47134e){_0x1fb2d1[_0x8c05('0x1b')](0x194);}return _0x47134e;};}function handleError(_0x435672,_0x584633){_0x584633=_0x584633||0x1f4;return function(_0x2f5ffe){logger[_0x8c05('0x28')](_0x2f5ffe[_0x8c05('0x29')]);if(_0x2f5ffe['name']){delete _0x2f5ffe[_0x8c05('0x2a')];}_0x435672[_0x8c05('0x1d')](_0x584633)['send'](_0x2f5ffe);};}exports[_0x8c05('0x2b')]=function(_0x5a2e83,_0x28479c){var _0x270453={},_0x1fa584={},_0x1154f9={'count':0x0,'rows':[]};var _0x546388=_[_0x8c05('0x2c')](db[_0x8c05('0x2d')][_0x8c05('0x2e')],function(_0x360c02){return{'name':_0x360c02[_0x8c05('0x2f')],'type':_0x360c02['type'][_0x8c05('0x30')]};});_0x1fa584['model']=_[_0x8c05('0x2c')](_0x546388,_0x8c05('0x2a'));_0x1fa584[_0x8c05('0x31')]=_[_0x8c05('0x32')](_0x5a2e83['query']);_0x1fa584[_0x8c05('0x33')]=_[_0x8c05('0x34')](_0x1fa584[_0x8c05('0x35')],_0x1fa584[_0x8c05('0x31')]);_0x270453['attributes']=_[_0x8c05('0x34')](_0x1fa584['model'],qs[_0x8c05('0x36')](_0x5a2e83[_0x8c05('0x31')][_0x8c05('0x36')]));_0x270453[_0x8c05('0x37')]=_0x270453[_0x8c05('0x37')][_0x8c05('0x38')]?_0x270453[_0x8c05('0x37')]:_0x1fa584[_0x8c05('0x35')];if(!_0x5a2e83[_0x8c05('0x31')][_0x8c05('0x39')]('nolimit')){_0x270453[_0x8c05('0x20')]=qs[_0x8c05('0x20')](_0x5a2e83[_0x8c05('0x31')]['limit']);_0x270453[_0x8c05('0x1f')]=qs[_0x8c05('0x1f')](_0x5a2e83[_0x8c05('0x31')][_0x8c05('0x1f')]);}_0x270453[_0x8c05('0x3a')]=qs[_0x8c05('0x3b')](_0x5a2e83[_0x8c05('0x31')][_0x8c05('0x3b')]);_0x270453[_0x8c05('0x3c')]=qs[_0x8c05('0x33')](_[_0x8c05('0x3d')](_0x5a2e83[_0x8c05('0x31')],_0x1fa584['filters']),_0x546388);if(_0x5a2e83[_0x8c05('0x31')]['filter']){_0x270453['where']=_[_0x8c05('0x3e')](_0x270453[_0x8c05('0x3c')],{'$or':_[_0x8c05('0x2c')](_0x546388,function(_0x52fec5){if(_0x52fec5[_0x8c05('0x3f')]!==_0x8c05('0x40')){var _0xbaa7db={};_0xbaa7db[_0x52fec5['name']]={'$like':'%'+_0x5a2e83[_0x8c05('0x31')]['filter']+'%'};return _0xbaa7db;}})});}_0x270453=_[_0x8c05('0x3e')]({},_0x270453,_0x5a2e83[_0x8c05('0x41')]);var _0x483fa8={'where':_0x270453[_0x8c05('0x3c')]};return db['MailQueue'][_0x8c05('0x42')](_0x483fa8)[_0x8c05('0x24')](function(_0x1aaec9){_0x1154f9[_0x8c05('0x42')]=_0x1aaec9;if(_0x5a2e83[_0x8c05('0x31')][_0x8c05('0x43')]){_0x270453['include']=[{'all':!![]}];}return db['MailQueue'][_0x8c05('0x44')](_0x270453);})['then'](function(_0x46ea26){_0x1154f9[_0x8c05('0x45')]=_0x46ea26;return _0x1154f9;})[_0x8c05('0x24')](respondWithFilteredResult(_0x28479c,_0x270453))['catch'](handleError(_0x28479c,null));};exports['show']=function(_0x339da1,_0x24dd82){var _0x2f2ccf={'raw':!![],'where':{'id':_0x339da1['params']['id']}},_0x416cf2={};_0x416cf2['model']=_[_0x8c05('0x32')](db['MailQueue'][_0x8c05('0x2e')]);_0x416cf2[_0x8c05('0x31')]=_[_0x8c05('0x32')](_0x339da1[_0x8c05('0x31')]);_0x416cf2[_0x8c05('0x33')]=_['intersection'](_0x416cf2[_0x8c05('0x35')],_0x416cf2[_0x8c05('0x31')]);_0x2f2ccf[_0x8c05('0x37')]=_[_0x8c05('0x34')](_0x416cf2[_0x8c05('0x35')],qs[_0x8c05('0x36')](_0x339da1[_0x8c05('0x31')][_0x8c05('0x36')]));_0x2f2ccf[_0x8c05('0x37')]=_0x2f2ccf[_0x8c05('0x37')][_0x8c05('0x38')]?_0x2f2ccf[_0x8c05('0x37')]:_0x416cf2[_0x8c05('0x35')];if(_0x339da1[_0x8c05('0x31')][_0x8c05('0x43')]){_0x2f2ccf[_0x8c05('0x46')]=[{'all':!![]}];}_0x2f2ccf=_['merge']({},_0x2f2ccf,_0x339da1['options']);return db[_0x8c05('0x2d')][_0x8c05('0x47')](_0x2f2ccf)['then'](handleEntityNotFound(_0x24dd82,null))[_0x8c05('0x24')](respondWithResult(_0x24dd82,null))[_0x8c05('0x48')](handleError(_0x24dd82,null));};exports[_0x8c05('0x49')]=function(_0x10c640,_0xa4bf72){return db[_0x8c05('0x2d')]['create'](_0x10c640['body'],{})[_0x8c05('0x24')](function(_0x4e85d0){var _0x5ac89a=_0x10c640[_0x8c05('0x4a')][_0x8c05('0x26')]({'plain':!![]});if(!_0x5ac89a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ac89a['role']==='user'){var _0x22ecf0=_0x4e85d0[_0x8c05('0x26')]({'plain':!![]});var _0x72196a=_0x8c05('0x4b');return db[_0x8c05('0x4c')][_0x8c05('0x47')]({'where':{'name':_0x72196a,'userProfileId':_0x5ac89a['userProfileId']},'raw':!![]})[_0x8c05('0x24')](function(_0x55fce8){if(_0x55fce8&&_0x55fce8[_0x8c05('0x4d')]===0x0){return db[_0x8c05('0x27')][_0x8c05('0x49')]({'name':_0x22ecf0['name'],'resourceId':_0x22ecf0['id'],'type':_0x55fce8[_0x8c05('0x2a')],'sectionId':_0x55fce8['id']},{})[_0x8c05('0x24')](function(){return _0x4e85d0;});}else{return _0x4e85d0;}})[_0x8c05('0x48')](function(_0x27c55f){logger[_0x8c05('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27c55f);throw _0x27c55f;});}return _0x4e85d0;})[_0x8c05('0x24')](respondWithResult(_0xa4bf72,0xc9))['catch'](handleError(_0xa4bf72,null));};exports[_0x8c05('0x4e')]=function(_0x5750f5,_0x2f0b5a){if(_0x5750f5[_0x8c05('0x4f')]['id']){delete _0x5750f5[_0x8c05('0x4f')]['id'];}return db[_0x8c05('0x2d')][_0x8c05('0x47')]({'where':{'id':_0x5750f5[_0x8c05('0x50')]['id']}})[_0x8c05('0x24')](handleEntityNotFound(_0x2f0b5a,null))[_0x8c05('0x24')](saveUpdates(_0x5750f5[_0x8c05('0x4f')],null))[_0x8c05('0x24')](respondWithResult(_0x2f0b5a,null))[_0x8c05('0x48')](handleError(_0x2f0b5a,null));};exports[_0x8c05('0x25')]=function(_0x105f83,_0x462f0e){return db['MailQueue'][_0x8c05('0x47')]({'where':{'id':_0x105f83[_0x8c05('0x50')]['id']}})[_0x8c05('0x24')](handleEntityNotFound(_0x462f0e,null))['then'](removeEntity(_0x462f0e,null))[_0x8c05('0x48')](handleError(_0x462f0e,null));};exports[_0x8c05('0x51')]=function(_0x42cc4d,_0x4206fe){return db[_0x8c05('0x2d')][_0x8c05('0x51')]()[_0x8c05('0x24')](respondWithResult(_0x4206fe,null))[_0x8c05('0x48')](handleError(_0x4206fe,null));};exports[_0x8c05('0x52')]=function(_0x20ccfb,_0x3b93c0,_0x1e8c19){var _0xf838bd={'raw':!![],'where':{}},_0x1c9ddd={},_0x5bc4f5;return db[_0x8c05('0x2d')][_0x8c05('0x53')]({'where':{'id':_0x20ccfb['params']['id']}})['then'](handleEntityNotFound(_0x3b93c0,null))['then'](function(_0x5249cf){if(_0x5249cf){_0x5bc4f5=_0x5249cf[_0x8c05('0x26')]({'plain':!![]});_0x1c9ddd[_0x8c05('0x35')]=_[_0x8c05('0x32')](db[_0x8c05('0x54')][_0x8c05('0x2e')]);_0x1c9ddd[_0x8c05('0x31')]=_[_0x8c05('0x32')](_0x20ccfb['query']);_0x1c9ddd[_0x8c05('0x33')]=_['intersection'](_0x1c9ddd[_0x8c05('0x35')],_0x1c9ddd[_0x8c05('0x31')]);_0xf838bd['attributes']=_[_0x8c05('0x34')](_0x1c9ddd[_0x8c05('0x35')],qs['fields'](_0x20ccfb[_0x8c05('0x31')][_0x8c05('0x36')]));_0xf838bd[_0x8c05('0x37')]=_0xf838bd[_0x8c05('0x37')][_0x8c05('0x38')]?_0xf838bd[_0x8c05('0x37')]:_0x1c9ddd['model'];if(!_0x20ccfb[_0x8c05('0x31')][_0x8c05('0x39')](_0x8c05('0x55'))){_0xf838bd[_0x8c05('0x20')]=qs[_0x8c05('0x20')](_0x20ccfb['query'][_0x8c05('0x20')]);_0xf838bd[_0x8c05('0x1f')]=qs[_0x8c05('0x1f')](_0x20ccfb['query']['offset']);}_0xf838bd[_0x8c05('0x3a')]=qs[_0x8c05('0x3b')](_0x20ccfb[_0x8c05('0x31')][_0x8c05('0x3b')]);_0xf838bd[_0x8c05('0x3c')]=qs[_0x8c05('0x33')](_[_0x8c05('0x3d')](_0x20ccfb[_0x8c05('0x31')],_0x1c9ddd[_0x8c05('0x33')]));_0xf838bd[_0x8c05('0x3c')][_0x8c05('0x56')]=_0x5249cf['id'];if(_0x20ccfb[_0x8c05('0x31')][_0x8c05('0x57')]){_0xf838bd[_0x8c05('0x3c')]=_[_0x8c05('0x3e')](_0xf838bd[_0x8c05('0x3c')],{'$or':_['map'](_0xf838bd['attributes'],function(_0x228249){var _0x507a50={};_0x507a50[_0x228249]={'$like':'%'+_0x20ccfb['query'][_0x8c05('0x57')]+'%'};return _0x507a50;})});}_0xf838bd=_[_0x8c05('0x3e')]({},_0xf838bd,_0x20ccfb[_0x8c05('0x41')]);return db[_0x8c05('0x54')]['findAll'](_0xf838bd);}})[_0x8c05('0x24')](function(_0x4bbd84){if(_0x4bbd84){return db[_0x8c05('0x58')][_0x8c05('0x59')]({'where':{'id':_[_0x8c05('0x2c')](_0x4bbd84,_0x8c05('0x5a')),'role':'agent'},'attributes':['id','name',_0x8c05('0x5b'),_0x8c05('0x5c'),_0x8c05('0x5d')]});}})[_0x8c05('0x24')](function(_0x57fc33){if(_0x57fc33){return{'count':_0x57fc33[_0x8c05('0x42')],'rows':_[_0x8c05('0x2c')](_0x57fc33[_0x8c05('0x45')],function(_0x23b6d2){return{'membername':_0x23b6d2[_0x8c05('0x2a')],'UserId':_0x23b6d2['id'],'queue_name':_0x5bc4f5[_0x8c05('0x2a')],'MailQueueId':_0x5bc4f5['id'],'interface':util[_0x8c05('0x5e')]('%s/%s',_0x8c05('0x5f'),_0x23b6d2[_0x8c05('0x2a')]),'penalty':0x0,'paused':_0x23b6d2['mailPause'],'createdAt':_0x23b6d2['createdAt'],'updatedAt':_0x23b6d2['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3b93c0,_0xf838bd))[_0x8c05('0x48')](handleError(_0x3b93c0,null));};exports['getTeams']=function(_0x39fc07,_0x4d5e50,_0x438215){var _0x41a042={};var _0x17dcab={};var _0x3cbb9c;var _0x33ac8d;return db[_0x8c05('0x2d')][_0x8c05('0x53')]({'where':{'id':_0x39fc07[_0x8c05('0x50')]['id']}})[_0x8c05('0x24')](handleEntityNotFound(_0x4d5e50,null))['then'](function(_0x4ddbdd){if(_0x4ddbdd){_0x3cbb9c=_0x4ddbdd;_0x17dcab[_0x8c05('0x35')]=_[_0x8c05('0x32')](db[_0x8c05('0x60')]['rawAttributes']);_0x17dcab[_0x8c05('0x31')]=_[_0x8c05('0x32')](_0x39fc07['query']);_0x17dcab[_0x8c05('0x33')]=_[_0x8c05('0x34')](_0x17dcab[_0x8c05('0x35')],_0x17dcab[_0x8c05('0x31')]);_0x41a042['attributes']=_[_0x8c05('0x34')](_0x17dcab[_0x8c05('0x35')],qs[_0x8c05('0x36')](_0x39fc07[_0x8c05('0x31')][_0x8c05('0x36')]));_0x41a042[_0x8c05('0x37')]=_0x41a042[_0x8c05('0x37')][_0x8c05('0x38')]?_0x41a042['attributes']:_0x17dcab[_0x8c05('0x35')];_0x41a042[_0x8c05('0x3a')]=qs['sort'](_0x39fc07[_0x8c05('0x31')]['sort']);_0x41a042['where']=qs[_0x8c05('0x33')](_[_0x8c05('0x3d')](_0x39fc07[_0x8c05('0x31')],_0x17dcab[_0x8c05('0x33')]));if(_0x39fc07['query'][_0x8c05('0x57')]){_0x41a042[_0x8c05('0x3c')]=_[_0x8c05('0x3e')](_0x41a042['where'],{'$or':_[_0x8c05('0x2c')](_0x41a042[_0x8c05('0x37')],function(_0x439afd){var _0x38c931={};_0x38c931[_0x439afd]={'$like':'%'+_0x39fc07[_0x8c05('0x31')]['filter']+'%'};return _0x38c931;})});}_0x41a042=_[_0x8c05('0x3e')]({},_0x41a042,_0x39fc07['options']);return _0x3cbb9c[_0x8c05('0x61')](_0x41a042);}})['then'](function(_0x3a7233){if(_0x3a7233){_0x33ac8d=_0x3a7233['length'];if(!_0x39fc07['query'][_0x8c05('0x39')](_0x8c05('0x55'))){_0x41a042[_0x8c05('0x20')]=qs[_0x8c05('0x20')](_0x39fc07[_0x8c05('0x31')]['limit']);_0x41a042[_0x8c05('0x1f')]=qs[_0x8c05('0x1f')](_0x39fc07[_0x8c05('0x31')]['offset']);}return _0x3cbb9c[_0x8c05('0x61')](_0x41a042);}})[_0x8c05('0x24')](function(_0x1f74fb){if(_0x1f74fb){return _0x1f74fb?{'count':_0x33ac8d,'rows':_0x1f74fb}:null;}})['then'](respondWithResult(_0x4d5e50,null))[_0x8c05('0x48')](handleError(_0x4d5e50,null));};exports[_0x8c05('0x62')]=function(_0x212690,_0x38476e,_0x8c2de2){var _0xbf2861=_0x212690['body'][_0x8c05('0x63')];return db[_0x8c05('0x60')][_0x8c05('0x44')]({'where':{'id':_0xbf2861},'attributes':['id'],'include':[{'model':db[_0x8c05('0x58')],'as':_0x8c05('0x64'),'attributes':['id','name',_0x8c05('0x65'),_0x8c05('0x66'),_0x8c05('0x67')],'raw':!![]}]})['then'](function(_0x5200b0){if(_0x5200b0){var _0xbc32=_[_0x8c05('0x68')](_0x5200b0,function(_0x57b258){var _0x545682=_0x57b258[_0x8c05('0x26')]({'plain':!![]});return _0x545682[_0x8c05('0x64')];});return db[_0x8c05('0x2d')][_0x8c05('0x47')]({'where':{'id':_0x212690[_0x8c05('0x50')]['id']}})[_0x8c05('0x24')](function(_0x549cbc){return db['sequelize'][_0x8c05('0x69')](function(_0x48b3d3){return _0x549cbc[_0x8c05('0x62')](_0xbf2861,{'transaction':_0x48b3d3})['then'](function(){return BPromise['each'](_0xbc32,function(_0x496c66){return db[_0x8c05('0x54')][_0x8c05('0x6a')]({'where':{'UserId':_0x496c66['id'],'MailQueueId':_0x212690['params']['id']},'transaction':_0x48b3d3});});})[_0x8c05('0x24')](function(){_0xbc32[_0x8c05('0x6b')](function(_0x1e0534){socket[_0x8c05('0x6c')]('userMailQueue:save',{'UserId':_0x1e0534['id'],'MailQueueId':_0x549cbc['id']});});});});});}})[_0x8c05('0x24')](respondWithStatusCode(_0x38476e,null))[_0x8c05('0x48')](handleError(_0x38476e,null));};exports['removeTeams']=function(_0x5bdb11,_0x4015ba,_0x305d5f){return db['Team'][_0x8c05('0x44')]({'where':{'id':_0x5bdb11[_0x8c05('0x31')][_0x8c05('0x63')]},'attributes':['id'],'include':[{'model':db[_0x8c05('0x58')],'as':_0x8c05('0x64'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4015ba,null))['then'](function(_0x3ec49b){var _0x114784=_[_0x8c05('0x2c')](_0x3ec49b,'id');var _0x1b7427=[];var _0x1a4a44=[];var _0x335de5=squel[_0x8c05('0x6d')]();_0x335de5[_0x8c05('0x6e')]('tq.TeamId')[_0x8c05('0x6f')](_0x8c05('0x70'),'tq')[_0x8c05('0x71')]('user_has_teams','ut',_0x8c05('0x72'))[_0x8c05('0x3c')](_0x8c05('0x73'),_0x5bdb11[_0x8c05('0x50')]['id']);for(var _0x1c3dad=0x0;_0x1c3dad<_0x3ec49b['length'];_0x1c3dad+=0x1){let _0x42b4f5=_0x3ec49b[_0x1c3dad];for(var _0x594f1c=0x0;_0x594f1c<_0x42b4f5['Agents']['length'];_0x594f1c+=0x1){let _0x329a5e=_0x42b4f5[_0x8c05('0x64')][_0x594f1c];var _0x830a45=_0x335de5[_0x8c05('0x74')]();_0x830a45['where'](_0x8c05('0x75'),_0x329a5e['id']);_0x1a4a44[_0x8c05('0x76')](db['sequelize'][_0x8c05('0x31')](_0x830a45[_0x8c05('0x77')](),{'type':db[_0x8c05('0x78')][_0x8c05('0x79')][_0x8c05('0x7a')]})[_0x8c05('0x24')](function(_0x2587e1){if(_0x2587e1[_0x8c05('0x38')]===0x1){return _0x329a5e['id'];}else{var _0x370e44=_[_0x8c05('0x7b')](_[_0x8c05('0x2c')](_0x2587e1,_0x8c05('0x7c')),function(_0x486bea){return _[_0x8c05('0x7d')](_0x114784,_0x486bea);});if(_0x370e44){return _0x329a5e['id'];}}}));}}return BPromise[_0x8c05('0x7e')](_0x1a4a44)['then'](function(_0xd6d312){_0x1b7427=_(_0x1b7427)[_0x8c05('0x7f')](_0xd6d312)[_0x8c05('0x80')]()['value']();return db[_0x8c05('0x2d')]['find']({'where':{'id':_0x5bdb11[_0x8c05('0x50')]['id']}})['then'](function(_0x4b46d0){return db[_0x8c05('0x78')]['transaction'](function(_0x369695){return _0x4b46d0['removeTeams'](_0x5bdb11[_0x8c05('0x31')][_0x8c05('0x63')],{'transaction':_0x369695})['then'](function(){if(!_[_0x8c05('0x81')](_0x1b7427)){return _0x4b46d0[_0x8c05('0x82')](_0x1b7427,{'transaction':_0x369695});}})[_0x8c05('0x24')](function(){_0x1b7427[_0x8c05('0x6b')](function(_0x37d108){socket[_0x8c05('0x6c')](_0x8c05('0x83'),{'UserId':_0x37d108,'MailQueueId':_0x4b46d0['id']});});});});});});})[_0x8c05('0x24')](respondWithStatusCode(_0x4015ba,null))['catch'](handleError(_0x4015ba,null));};exports[_0x8c05('0x84')]=function(_0x1526e3,_0x2abe3e,_0x4d68d2){return db[_0x8c05('0x2d')][_0x8c05('0x47')]({'where':{'id':_0x1526e3['params']['id']}})[_0x8c05('0x24')](handleEntityNotFound(_0x2abe3e,null))['then'](function(_0xa04a66){if(_0xa04a66){return _0xa04a66[_0x8c05('0x84')](_0x1526e3[_0x8c05('0x4f')]['ids'],_['omit'](_0x1526e3['body'],[_0x8c05('0x63'),'id'])||{})[_0x8c05('0x85')](function(_0x4175af){for(var _0x1dfecd=0x0;_0x1dfecd<_0x1526e3[_0x8c05('0x4f')][_0x8c05('0x63')][_0x8c05('0x38')];_0x1dfecd+=0x1){socket[_0x8c05('0x6c')](_0x8c05('0x86'),{'UserId':_0x1526e3[_0x8c05('0x4f')][_0x8c05('0x63')][_0x1dfecd],'MailQueueId':_0x1526e3[_0x8c05('0x50')]['id']});}return _0x4175af;});}})[_0x8c05('0x24')](respondWithResult(_0x2abe3e,null))[_0x8c05('0x48')](handleError(_0x2abe3e,null));};exports['removeAgents']=function(_0x46ab20,_0x517ca4,_0x3ab3ba){return db[_0x8c05('0x2d')][_0x8c05('0x47')]({'where':{'id':_0x46ab20[_0x8c05('0x50')]['id']}})[_0x8c05('0x24')](handleEntityNotFound(_0x517ca4,null))[_0x8c05('0x24')](function(_0x5063b5){if(_0x5063b5){return _0x5063b5[_0x8c05('0x82')](_0x46ab20[_0x8c05('0x31')][_0x8c05('0x63')])[_0x8c05('0x24')](function(){if(_[_0x8c05('0x87')](_0x46ab20['query'][_0x8c05('0x63')])){for(var _0x396907=0x0;_0x396907<_0x46ab20[_0x8c05('0x31')][_0x8c05('0x63')][_0x8c05('0x38')];_0x396907+=0x1){socket['emit'](_0x8c05('0x83'),{'UserId':Number(_0x46ab20['query'][_0x8c05('0x63')][_0x396907]),'MailQueueId':Number(_0x46ab20['params']['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x46ab20[_0x8c05('0x31')]['ids']),'MailQueueId':Number(_0x46ab20[_0x8c05('0x50')]['id'])});}});}})[_0x8c05('0x24')](respondWithStatusCode(_0x517ca4,null))[_0x8c05('0x48')](handleError(_0x517ca4,null));};exports[_0x8c05('0x88')]=function(_0x527406,_0x4ce814,_0x19ef2e){var _0x82bce4={};var _0x1851e3={};var _0x5cfa13;var _0x366d3e;return db[_0x8c05('0x2d')][_0x8c05('0x53')]({'where':{'id':_0x527406['params']['id']}})['then'](handleEntityNotFound(_0x4ce814,null))[_0x8c05('0x24')](function(_0x1fff07){if(_0x1fff07){_0x5cfa13=_0x1fff07;_0x1851e3[_0x8c05('0x35')]=_[_0x8c05('0x32')](db[_0x8c05('0x58')][_0x8c05('0x2e')]);_0x1851e3['query']=_[_0x8c05('0x32')](_0x527406[_0x8c05('0x31')]);_0x1851e3[_0x8c05('0x33')]=_[_0x8c05('0x34')](_0x1851e3[_0x8c05('0x35')],_0x1851e3['query']);_0x82bce4[_0x8c05('0x37')]=_[_0x8c05('0x34')](_0x1851e3[_0x8c05('0x35')],qs[_0x8c05('0x36')](_0x527406['query'][_0x8c05('0x36')]));_0x82bce4[_0x8c05('0x37')]=_0x82bce4[_0x8c05('0x37')]['length']?_0x82bce4[_0x8c05('0x37')]:_0x1851e3[_0x8c05('0x35')];_0x82bce4[_0x8c05('0x3a')]=qs[_0x8c05('0x3b')](_0x527406[_0x8c05('0x31')][_0x8c05('0x3b')]);_0x82bce4['where']=qs[_0x8c05('0x33')](_[_0x8c05('0x3d')](_0x527406[_0x8c05('0x31')],_0x1851e3[_0x8c05('0x33')]));if(_0x527406[_0x8c05('0x31')]['filter']){_0x82bce4[_0x8c05('0x3c')]=_[_0x8c05('0x3e')](_0x82bce4[_0x8c05('0x3c')],{'$or':_[_0x8c05('0x2c')](_0x82bce4['attributes'],function(_0x383ca8){var _0x32fcfc={};_0x32fcfc[_0x383ca8]={'$like':'%'+_0x527406['query'][_0x8c05('0x57')]+'%'};return _0x32fcfc;})});}_0x82bce4=_[_0x8c05('0x3e')]({},_0x82bce4,_0x527406['options']);return _0x5cfa13[_0x8c05('0x88')](_0x82bce4);}})[_0x8c05('0x24')](function(_0x557635){if(_0x557635){_0x366d3e=_0x557635[_0x8c05('0x38')];if(!_0x527406[_0x8c05('0x31')]['hasOwnProperty']('nolimit')){_0x82bce4[_0x8c05('0x20')]=qs['limit'](_0x527406[_0x8c05('0x31')][_0x8c05('0x20')]);_0x82bce4['offset']=qs[_0x8c05('0x1f')](_0x527406[_0x8c05('0x31')][_0x8c05('0x1f')]);}return _0x5cfa13[_0x8c05('0x88')](_0x82bce4);}})[_0x8c05('0x24')](function(_0x3ce6c8){if(_0x3ce6c8){return _0x3ce6c8?{'count':_0x366d3e,'rows':_0x3ce6c8}:null;}})['then'](respondWithResult(_0x4ce814,null))['catch'](handleError(_0x4ce814,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index baef19c..9f5b027 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 _0x4503=['exports','events','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x45deff,_0x75ddb4){var _0x3dee8f=function(_0x4d5d8f){while(--_0x4d5d8f){_0x45deff['push'](_0x45deff['shift']());}};_0x3dee8f(++_0x75ddb4);}(_0x4503,0x90));var _0x3450=function(_0x149bef,_0x3d860e){_0x149bef=_0x149bef-0x0;var _0x33baeb=_0x4503[_0x149bef];return _0x33baeb;};'use strict';var EventEmitter=require(_0x3450('0x0'));var MailQueue=require(_0x3450('0x1'))['db'][_0x3450('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x3450('0x3')](0x0);var events={'afterCreate':_0x3450('0x4'),'afterUpdate':_0x3450('0x5'),'afterDestroy':_0x3450('0x6')};function emitEvent(_0x1d9a37){return function(_0x1b156d,_0x473105,_0x22a967){MailQueueEvents['emit'](_0x1d9a37+':'+_0x1b156d['id'],_0x1b156d);MailQueueEvents[_0x3450('0x7')](_0x1d9a37,_0x1b156d);_0x22a967(null);};}for(var e in events){if(events[_0x3450('0x8')](e)){var event=events[e];MailQueue[_0x3450('0x9')](e,emitEvent(event));}}module[_0x3450('0xa')]=MailQueueEvents; \ No newline at end of file +var _0xe9cf=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue'];(function(_0x1a481d,_0x936239){var _0x2d26c1=function(_0x42249c){while(--_0x42249c){_0x1a481d['push'](_0x1a481d['shift']());}};_0x2d26c1(++_0x936239);}(_0xe9cf,0x9d));var _0xfe9c=function(_0x1a30ea,_0x22bf39){_0x1a30ea=_0x1a30ea-0x0;var _0x36b8f2=_0xe9cf[_0x1a30ea];return _0x36b8f2;};'use strict';var EventEmitter=require(_0xfe9c('0x0'));var MailQueue=require(_0xfe9c('0x1'))['db'][_0xfe9c('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfe9c('0x3'),'afterUpdate':_0xfe9c('0x4'),'afterDestroy':_0xfe9c('0x5')};function emitEvent(_0x1acf61){return function(_0x3825bf,_0x496309,_0x158984){MailQueueEvents[_0xfe9c('0x6')](_0x1acf61+':'+_0x3825bf['id'],_0x3825bf);MailQueueEvents[_0xfe9c('0x6')](_0x1acf61,_0x3825bf);_0x158984(null);};}for(var e in events){if(events[_0xfe9c('0x7')](e)){var event=events[e];MailQueue[_0xfe9c('0x8')](e,emitEvent(event));}}module[_0xfe9c('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 b8bebf4..c3987d6 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 _0xc5c1=['exports','MailQueue','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x549444,_0x4a178c){var _0x15a38b=function(_0x9a49a7){while(--_0x9a49a7){_0x549444['push'](_0x549444['shift']());}};_0x15a38b(++_0x4a178c);}(_0xc5c1,0xff));var _0x1c5c=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xc5c1[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require(_0x1c5c('0x0'));var util=require(_0x1c5c('0x1'));var logger=require(_0x1c5c('0x2'))(_0x1c5c('0x3'));var moment=require('moment');var BPromise=require(_0x1c5c('0x4'));var rp=require(_0x1c5c('0x5'));var fs=require('fs');var path=require(_0x1c5c('0x6'));var rimraf=require(_0x1c5c('0x7'));var config=require(_0x1c5c('0x8'));var attributes=require('./mailQueue.attributes');module[_0x1c5c('0x9')]=function(_0x7de59e,_0x5c1ce4){return _0x7de59e['define'](_0x1c5c('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf16e=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailQueue','mail_queues','lodash'];(function(_0xbcdc01,_0x43b911){var _0x2bd588=function(_0x5f03b7){while(--_0x5f03b7){_0xbcdc01['push'](_0xbcdc01['shift']());}};_0x2bd588(++_0x43b911);}(_0xf16e,0x137));var _0xef16=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xf16e[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0xef16('0x0'));var util=require(_0xef16('0x1'));var logger=require(_0xef16('0x2'))('api');var moment=require(_0xef16('0x3'));var BPromise=require(_0xef16('0x4'));var rp=require(_0xef16('0x5'));var fs=require('fs');var path=require(_0xef16('0x6'));var rimraf=require(_0xef16('0x7'));var config=require(_0xef16('0x8'));var attributes=require('./mailQueue.attributes');module[_0xef16('0x9')]=function(_0x598217,_0x20bfa9){return _0x598217[_0xef16('0xa')](_0xef16('0xb'),attributes,{'tableName':_0xef16('0xc'),'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 d42963c..6c67868 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 _0x58fc=['../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','MailQueue','findAll','options','raw','where','attributes','limit','map','include','model','GetMailQueue','find','ShowMailQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x58b0cf,_0x23887d){var _0x449e1e=function(_0x49967b){while(--_0x49967b){_0x58b0cf['push'](_0x58b0cf['shift']());}};_0x449e1e(++_0x23887d);}(_0x58fc,0xee));var _0xc58f=function(_0x360d02,_0x8fd447){_0x360d02=_0x360d02-0x0;var _0x446044=_0x58fc[_0x360d02];return _0x446044;};'use strict';var _=require(_0xc58f('0x0'));var util=require(_0xc58f('0x1'));var moment=require('moment');var BPromise=require(_0xc58f('0x2'));var rs=require(_0xc58f('0x3'));var fs=require('fs');var Redis=require(_0xc58f('0x4'));var db=require(_0xc58f('0x5'))['db'];var utils=require(_0xc58f('0x6'));var logger=require(_0xc58f('0x7'))('rpc');var config=require(_0xc58f('0x8'));var jayson=require(_0xc58f('0x9'));var client=jayson[_0xc58f('0xa')]['http']({'port':0x232a});config[_0xc58f('0xb')]=_[_0xc58f('0xc')](config[_0xc58f('0xb')],{'host':_0xc58f('0xd'),'port':0x18eb});var socket=require(_0xc58f('0xe'))(new Redis(config[_0xc58f('0xb')]));require(_0xc58f('0xf'))[_0xc58f('0x10')](socket);function respondWithRpcPromise(_0x2d633e,_0x212b9e,_0x34025a){return new BPromise(function(_0x505f95,_0x454f50){return client[_0xc58f('0x11')](_0x2d633e,_0x34025a)[_0xc58f('0x12')](function(_0x30b640){logger[_0xc58f('0x13')](_0xc58f('0x14'),_0x212b9e,'request\x20sent');logger[_0xc58f('0x15')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x212b9e,_0xc58f('0x16'),JSON[_0xc58f('0x17')](_0x30b640));if(_0x30b640[_0xc58f('0x18')]){if(_0x30b640[_0xc58f('0x18')][_0xc58f('0x19')]===0x1f4){logger[_0xc58f('0x18')](_0xc58f('0x14'),_0x212b9e,_0x30b640[_0xc58f('0x18')][_0xc58f('0x1a')]);return _0x454f50(_0x30b640[_0xc58f('0x18')][_0xc58f('0x1a')]);}logger[_0xc58f('0x18')](_0xc58f('0x14'),_0x212b9e,_0x30b640[_0xc58f('0x18')][_0xc58f('0x1a')]);return _0x505f95(_0x30b640['error'][_0xc58f('0x1a')]);}else{logger['info'](_0xc58f('0x14'),_0x212b9e,'request\x20sent');_0x505f95(_0x30b640['result'][_0xc58f('0x1a')]);}})[_0xc58f('0x1b')](function(_0x41b728){logger[_0xc58f('0x18')](_0xc58f('0x14'),_0x212b9e,_0x41b728);_0x454f50(_0x41b728);});});}exports['GetMailQueue']=function(_0xa019e7){var _0xffba3d=this;return new Promise(function(_0x2744cb,_0x120399){return db[_0xc58f('0x1c')][_0xc58f('0x1d')]({'raw':_0xa019e7[_0xc58f('0x1e')]?_0xa019e7[_0xc58f('0x1e')][_0xc58f('0x1f')]===undefined?!![]:![]:!![],'where':_0xa019e7[_0xc58f('0x1e')]?_0xa019e7[_0xc58f('0x1e')][_0xc58f('0x20')]||null:null,'attributes':_0xa019e7[_0xc58f('0x1e')]?_0xa019e7[_0xc58f('0x1e')][_0xc58f('0x21')]||null:null,'limit':_0xa019e7[_0xc58f('0x1e')]?_0xa019e7[_0xc58f('0x1e')][_0xc58f('0x22')]||null:null,'include':_0xa019e7[_0xc58f('0x1e')]?_0xa019e7[_0xc58f('0x1e')]['include']?_[_0xc58f('0x23')](_0xa019e7[_0xc58f('0x1e')][_0xc58f('0x24')],function(_0xe9c852){return{'model':db[_0xe9c852[_0xc58f('0x25')]],'as':_0xe9c852['as'],'attributes':_0xe9c852[_0xc58f('0x21')],'include':_0xe9c852['include']?_[_0xc58f('0x23')](_0xe9c852[_0xc58f('0x24')],function(_0x3a5fe0){return{'model':db[_0x3a5fe0[_0xc58f('0x25')]],'as':_0x3a5fe0['as'],'attributes':_0x3a5fe0['attributes'],'include':_0x3a5fe0['include']?_[_0xc58f('0x23')](_0x3a5fe0[_0xc58f('0x24')],function(_0xd0a9e6){return{'model':db[_0xd0a9e6[_0xc58f('0x25')]],'as':_0xd0a9e6['as'],'attributes':_0xd0a9e6[_0xc58f('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc58f('0x12')](function(_0x19f37d){logger[_0xc58f('0x13')](_0xc58f('0x26'),_0xa019e7);logger['debug']('GetMailQueue',_0xa019e7,JSON['stringify'](_0x19f37d));_0x2744cb(_0x19f37d);})[_0xc58f('0x1b')](function(_0x3d520c){logger[_0xc58f('0x18')]('GetMailQueue',_0x3d520c[_0xc58f('0x1a')],_0xa019e7);_0x120399(_0xffba3d['error'](0x1f4,_0x3d520c[_0xc58f('0x1a')]));});});};exports['ShowMailQueue']=function(_0x1b8877){var _0x39ee2f=this;return new Promise(function(_0x4a2842,_0x1ac670){return db[_0xc58f('0x1c')][_0xc58f('0x27')]({'raw':_0x1b8877[_0xc58f('0x1e')]?_0x1b8877['options'][_0xc58f('0x1f')]===undefined?!![]:![]:!![],'where':_0x1b8877['options']?_0x1b8877[_0xc58f('0x1e')][_0xc58f('0x20')]||null:null,'attributes':_0x1b8877['options']?_0x1b8877[_0xc58f('0x1e')][_0xc58f('0x21')]||null:null,'include':_0x1b8877[_0xc58f('0x1e')]?_0x1b8877[_0xc58f('0x1e')]['include']?_['map'](_0x1b8877[_0xc58f('0x1e')]['include'],function(_0x31ee71){return{'model':db[_0x31ee71[_0xc58f('0x25')]],'as':_0x31ee71['as'],'attributes':_0x31ee71[_0xc58f('0x21')],'include':_0x31ee71[_0xc58f('0x24')]?_['map'](_0x31ee71['include'],function(_0x5b6301){return{'model':db[_0x5b6301['model']],'as':_0x5b6301['as'],'attributes':_0x5b6301['attributes'],'include':_0x5b6301[_0xc58f('0x24')]?_[_0xc58f('0x23')](_0x5b6301['include'],function(_0x42d6a2){return{'model':db[_0x42d6a2[_0xc58f('0x25')]],'as':_0x42d6a2['as'],'attributes':_0x42d6a2[_0xc58f('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc58f('0x12')](function(_0x226569){logger['info']('ShowMailQueue',_0x1b8877);logger[_0xc58f('0x15')](_0xc58f('0x28'),_0x1b8877,JSON['stringify'](_0x226569));_0x4a2842(_0x226569);})[_0xc58f('0x1b')](function(_0x1b7606){logger[_0xc58f('0x18')](_0xc58f('0x28'),_0x1b7606[_0xc58f('0x1a')],_0x1b8877);_0x1ac670(_0x39ee2f[_0xc58f('0x18')](0x1f4,_0x1b7606[_0xc58f('0x1a')]));});});}; \ No newline at end of file +var _0x59af=['lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','MailQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','GetMailQueue','debug','ShowMailQueue','find'];(function(_0x5e8c7c,_0x3429c6){var _0x48f7bd=function(_0x2b8a0f){while(--_0x2b8a0f){_0x5e8c7c['push'](_0x5e8c7c['shift']());}};_0x48f7bd(++_0x3429c6);}(_0x59af,0x168));var _0xf59a=function(_0x505e5f,_0x476a91){_0x505e5f=_0x505e5f-0x0;var _0x4eb1fe=_0x59af[_0x505e5f];return _0x4eb1fe;};'use strict';var _=require(_0xf59a('0x0'));var util=require(_0xf59a('0x1'));var moment=require(_0xf59a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf59a('0x3'));var db=require(_0xf59a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf59a('0x5'))(_0xf59a('0x6'));var config=require(_0xf59a('0x7'));var jayson=require(_0xf59a('0x8'));var client=jayson[_0xf59a('0x9')][_0xf59a('0xa')]({'port':0x232a});config[_0xf59a('0xb')]=_[_0xf59a('0xc')](config[_0xf59a('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf59a('0xb')]));require(_0xf59a('0xd'))[_0xf59a('0xe')](socket);function respondWithRpcPromise(_0x3e8dde,_0x31cf72,_0x32bbdc){return new BPromise(function(_0x1a7a07,_0xa07ad2){return client[_0xf59a('0xf')](_0x3e8dde,_0x32bbdc)['then'](function(_0x800767){logger[_0xf59a('0x10')](_0xf59a('0x11'),_0x31cf72,_0xf59a('0x12'));logger['debug'](_0xf59a('0x13'),_0x31cf72,_0xf59a('0x12'),JSON[_0xf59a('0x14')](_0x800767));if(_0x800767[_0xf59a('0x15')]){if(_0x800767[_0xf59a('0x15')]['code']===0x1f4){logger[_0xf59a('0x15')](_0xf59a('0x11'),_0x31cf72,_0x800767[_0xf59a('0x15')][_0xf59a('0x16')]);return _0xa07ad2(_0x800767[_0xf59a('0x15')][_0xf59a('0x16')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x31cf72,_0x800767['error'][_0xf59a('0x16')]);return _0x1a7a07(_0x800767[_0xf59a('0x15')][_0xf59a('0x16')]);}else{logger['info'](_0xf59a('0x11'),_0x31cf72,_0xf59a('0x12'));_0x1a7a07(_0x800767[_0xf59a('0x17')][_0xf59a('0x16')]);}})[_0xf59a('0x18')](function(_0x456702){logger[_0xf59a('0x15')](_0xf59a('0x11'),_0x31cf72,_0x456702);_0xa07ad2(_0x456702);});});}exports['GetMailQueue']=function(_0x32de76){var _0x504286=this;return new Promise(function(_0x1cdcef,_0x32d89c){return db[_0xf59a('0x19')][_0xf59a('0x1a')]({'raw':_0x32de76['options']?_0x32de76[_0xf59a('0x1b')][_0xf59a('0x1c')]===undefined?!![]:![]:!![],'where':_0x32de76[_0xf59a('0x1b')]?_0x32de76[_0xf59a('0x1b')][_0xf59a('0x1d')]||null:null,'attributes':_0x32de76['options']?_0x32de76['options'][_0xf59a('0x1e')]||null:null,'limit':_0x32de76[_0xf59a('0x1b')]?_0x32de76[_0xf59a('0x1b')][_0xf59a('0x1f')]||null:null,'include':_0x32de76[_0xf59a('0x1b')]?_0x32de76['options'][_0xf59a('0x20')]?_['map'](_0x32de76['options'][_0xf59a('0x20')],function(_0x42872a){return{'model':db[_0x42872a['model']],'as':_0x42872a['as'],'attributes':_0x42872a[_0xf59a('0x1e')],'include':_0x42872a[_0xf59a('0x20')]?_['map'](_0x42872a[_0xf59a('0x20')],function(_0x2e241a){return{'model':db[_0x2e241a[_0xf59a('0x21')]],'as':_0x2e241a['as'],'attributes':_0x2e241a[_0xf59a('0x1e')],'include':_0x2e241a[_0xf59a('0x20')]?_[_0xf59a('0x22')](_0x2e241a['include'],function(_0x583890){return{'model':db[_0x583890[_0xf59a('0x21')]],'as':_0x583890['as'],'attributes':_0x583890[_0xf59a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf59a('0x23')](function(_0x575172){logger[_0xf59a('0x10')](_0xf59a('0x24'),_0x32de76);logger[_0xf59a('0x25')]('GetMailQueue',_0x32de76,JSON[_0xf59a('0x14')](_0x575172));_0x1cdcef(_0x575172);})['catch'](function(_0x1708fc){logger[_0xf59a('0x15')]('GetMailQueue',_0x1708fc['message'],_0x32de76);_0x32d89c(_0x504286[_0xf59a('0x15')](0x1f4,_0x1708fc['message']));});});};exports[_0xf59a('0x26')]=function(_0x205ff4){var _0x5652d1=this;return new Promise(function(_0x6c2015,_0x1c43b0){return db[_0xf59a('0x19')][_0xf59a('0x27')]({'raw':_0x205ff4[_0xf59a('0x1b')]?_0x205ff4['options'][_0xf59a('0x1c')]===undefined?!![]:![]:!![],'where':_0x205ff4['options']?_0x205ff4['options']['where']||null:null,'attributes':_0x205ff4[_0xf59a('0x1b')]?_0x205ff4['options'][_0xf59a('0x1e')]||null:null,'include':_0x205ff4[_0xf59a('0x1b')]?_0x205ff4[_0xf59a('0x1b')][_0xf59a('0x20')]?_['map'](_0x205ff4[_0xf59a('0x1b')][_0xf59a('0x20')],function(_0xfe811){return{'model':db[_0xfe811[_0xf59a('0x21')]],'as':_0xfe811['as'],'attributes':_0xfe811[_0xf59a('0x1e')],'include':_0xfe811[_0xf59a('0x20')]?_['map'](_0xfe811[_0xf59a('0x20')],function(_0x1462b8){return{'model':db[_0x1462b8[_0xf59a('0x21')]],'as':_0x1462b8['as'],'attributes':_0x1462b8['attributes'],'include':_0x1462b8[_0xf59a('0x20')]?_[_0xf59a('0x22')](_0x1462b8[_0xf59a('0x20')],function(_0xd9a90){return{'model':db[_0xd9a90[_0xf59a('0x21')]],'as':_0xd9a90['as'],'attributes':_0xd9a90[_0xf59a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf59a('0x23')](function(_0x3d8ded){logger[_0xf59a('0x10')](_0xf59a('0x26'),_0x205ff4);logger['debug'](_0xf59a('0x26'),_0x205ff4,JSON[_0xf59a('0x14')](_0x3d8ded));_0x6c2015(_0x3d8ded);})[_0xf59a('0x18')](function(_0x4f9411){logger[_0xf59a('0x15')](_0xf59a('0x26'),_0x4f9411[_0xf59a('0x16')],_0x205ff4);_0x1c43b0(_0x5652d1[_0xf59a('0x15')](0x1f4,_0x4f9411[_0xf59a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index c987e5d..e6c2964 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 _0xd1aa=['emit','register','length','mailQueue:','save','update'];(function(_0x13c609,_0x2b90d4){var _0x306c68=function(_0x50bfb1){while(--_0x50bfb1){_0x13c609['push'](_0x13c609['shift']());}};_0x306c68(++_0x2b90d4);}(_0xd1aa,0x1b4));var _0xad1a=function(_0x584291,_0x24b5b3){_0x584291=_0x584291-0x0;var _0x4e7d08=_0xd1aa[_0x584291];return _0x4e7d08;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xad1a('0x0'),'remove',_0xad1a('0x1')];function createListener(_0x26e3a0,_0x33208b){return function(_0x556161){_0x33208b[_0xad1a('0x2')](_0x26e3a0,_0x556161);};}function removeListener(_0x295438,_0xf84f4){return function(){MailQueueEvents['removeListener'](_0x295438,_0xf84f4);};}exports[_0xad1a('0x3')]=function(_0x10ddfb){for(var _0x4312aa=0x0,_0x30379f=events[_0xad1a('0x4')];_0x4312aa<_0x30379f;_0x4312aa++){var _0x3e10d5=events[_0x4312aa];var _0x17f0ae=createListener(_0xad1a('0x5')+_0x3e10d5,_0x10ddfb);MailQueueEvents['on'](_0x3e10d5,_0x17f0ae);}}; \ No newline at end of file +var _0xad4f=['register','length','mailQueue:','./mailQueue.events','save','remove','update','emit','removeListener'];(function(_0x4f3056,_0xe685f6){var _0x2b8af0=function(_0x3e04c2){while(--_0x3e04c2){_0x4f3056['push'](_0x4f3056['shift']());}};_0x2b8af0(++_0xe685f6);}(_0xad4f,0x123));var _0xfad4=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xad4f[_0x4fc9e6];return _0x551d28;};'use strict';var MailQueueEvents=require(_0xfad4('0x0'));var events=[_0xfad4('0x1'),_0xfad4('0x2'),_0xfad4('0x3')];function createListener(_0x40345e,_0x42c5ed){return function(_0x475760){_0x42c5ed[_0xfad4('0x4')](_0x40345e,_0x475760);};}function removeListener(_0x2acf02,_0x3dfc46){return function(){MailQueueEvents[_0xfad4('0x5')](_0x2acf02,_0x3dfc46);};}exports[_0xfad4('0x6')]=function(_0x32fa38){for(var _0x129c58=0x0,_0x2a5122=events[_0xfad4('0x7')];_0x129c58<_0x2a5122;_0x129c58++){var _0x2b0281=events[_0x129c58];var _0x3f0d25=createListener(_0xfad4('0x8')+_0x2b0281,_0x32fa38);MailQueueEvents['on'](_0x2b0281,_0x3f0d25);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 125ce96..52a9276 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 _0xd282=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','isAuthenticated','index','get'];(function(_0x544ce3,_0x3ccf53){var _0x5c3668=function(_0x57a437){while(--_0x57a437){_0x544ce3['push'](_0x544ce3['shift']());}};_0x5c3668(++_0x3ccf53);}(_0xd282,0x129));var _0x2d28=function(_0x3b1f86,_0x161fac){_0x3b1f86=_0x3b1f86-0x0;var _0x412f90=_0xd282[_0x3b1f86];return _0x412f90;};'use strict';var multer=require(_0x2d28('0x0'));var util=require(_0x2d28('0x1'));var path=require('path');var timeout=require(_0x2d28('0x2'));var express=require(_0x2d28('0x3'));var router=express[_0x2d28('0x4')]();var auth=require(_0x2d28('0x5'));var interaction=require(_0x2d28('0x6'));var config=require('../../config/environment');var controller=require(_0x2d28('0x7'));router['get']('/',auth[_0x2d28('0x8')](),controller[_0x2d28('0x9')]);router[_0x2d28('0xa')](_0x2d28('0xb'),auth[_0x2d28('0x8')](),controller[_0x2d28('0xc')]);router[_0x2d28('0xa')](_0x2d28('0xd'),auth['isAuthenticated'](),controller[_0x2d28('0xe')]);router[_0x2d28('0xf')]('/',auth[_0x2d28('0x8')](),controller[_0x2d28('0x10')]);router[_0x2d28('0x11')](_0x2d28('0xd'),auth[_0x2d28('0x8')](),controller[_0x2d28('0x12')]);router[_0x2d28('0x13')](_0x2d28('0xd'),auth['isAuthenticated'](),controller[_0x2d28('0x14')]);module[_0x2d28('0x15')]=router; \ No newline at end of file +var _0xd8b7=['index','describe','/:id','show','post','isAuthenticated','delete','destroy','exports','multer','util','connect-timeout','express','../../config/environment','get'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xd8b7,0x1cb));var _0x7d8b=function(_0x3fe3bf,_0x245d02){_0x3fe3bf=_0x3fe3bf-0x0;var _0x4a8b92=_0xd8b7[_0x3fe3bf];return _0x4a8b92;};'use strict';var multer=require(_0x7d8b('0x0'));var util=require(_0x7d8b('0x1'));var path=require('path');var timeout=require(_0x7d8b('0x2'));var express=require(_0x7d8b('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7d8b('0x4'));var controller=require('./mailQueueReport.controller');router[_0x7d8b('0x5')]('/',auth['isAuthenticated'](),controller[_0x7d8b('0x6')]);router[_0x7d8b('0x5')]('/describe',auth['isAuthenticated'](),controller[_0x7d8b('0x7')]);router[_0x7d8b('0x5')](_0x7d8b('0x8'),auth['isAuthenticated'](),controller[_0x7d8b('0x9')]);router[_0x7d8b('0xa')]('/',auth[_0x7d8b('0xb')](),controller['create']);router['put'](_0x7d8b('0x8'),auth[_0x7d8b('0xb')](),controller['update']);router[_0x7d8b('0xc')](_0x7d8b('0x8'),auth[_0x7d8b('0xb')](),controller[_0x7d8b('0xd')]);module[_0x7d8b('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 81ec5fd..09d6e78 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 _0x0d9c=['DATE','moment','sequelize','STRING'];(function(_0x3c81b5,_0x3f5ed7){var _0x5888c4=function(_0x4e65b0){while(--_0x4e65b0){_0x3c81b5['push'](_0x3c81b5['shift']());}};_0x5888c4(++_0x3f5ed7);}(_0x0d9c,0x135));var _0xc0d9=function(_0x3f2647,_0x4447ac){_0x3f2647=_0x3f2647-0x0;var _0xbd8415=_0x0d9c[_0x3f2647];return _0xbd8415;};'use strict';var moment=require(_0xc0d9('0x0'));var Sequelize=require(_0xc0d9('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xc0d9('0x2')]},'joinAt':{'type':Sequelize[_0xc0d9('0x3')]},'leaveAt':{'type':Sequelize[_0xc0d9('0x3')]},'acceptAt':{'type':Sequelize[_0xc0d9('0x3')]},'exitAt':{'type':Sequelize[_0xc0d9('0x3')]},'reason':{'type':Sequelize[_0xc0d9('0x2')]}}; \ No newline at end of file +var _0xd6da=['DATE','STRING','moment','sequelize','exports'];(function(_0x588044,_0x107ad0){var _0x311f43=function(_0x42416d){while(--_0x42416d){_0x588044['push'](_0x588044['shift']());}};_0x311f43(++_0x107ad0);}(_0xd6da,0xcf));var _0xad6d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd6da[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xad6d('0x0'));var Sequelize=require(_0xad6d('0x1'));module[_0xad6d('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xad6d('0x3')]},'leaveAt':{'type':Sequelize[_0xad6d('0x3')]},'acceptAt':{'type':Sequelize[_0xad6d('0x3')]},'exitAt':{'type':Sequelize[_0xad6d('0x3')]},'reason':{'type':Sequelize[_0xad6d('0x4')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 367443d..70a6582 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 _0xc3d5=['../../config/environment','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','MailQueueReport','count','includeAll','include','findAll','catch','show','find','create','body','params','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x5a4e52,_0x596b05){var _0x3a7f73=function(_0xe34b29){while(--_0xe34b29){_0x5a4e52['push'](_0x5a4e52['shift']());}};_0x3a7f73(++_0x596b05);}(_0xc3d5,0xc6));var _0x5c3d=function(_0x1cdb84,_0x508f70){_0x1cdb84=_0x1cdb84-0x0;var _0x3a4513=_0xc3d5[_0x1cdb84];return _0x3a4513;};'use strict';var pdf=require(_0x5c3d('0x0'));var emlformat=require(_0x5c3d('0x1'));var rimraf=require(_0x5c3d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5c3d('0x3'));var moment=require(_0x5c3d('0x4'));var BPromise=require(_0x5c3d('0x5'));var Mustache=require(_0x5c3d('0x6'));var util=require(_0x5c3d('0x7'));var path=require(_0x5c3d('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5c3d('0x9'));var fs=require('fs');var _=require(_0x5c3d('0xa'));var squel=require(_0x5c3d('0xb'));var crypto=require(_0x5c3d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5c3d('0xd'));var toCsv=require(_0x5c3d('0xe'));var querystring=require(_0x5c3d('0xf'));var Papa=require(_0x5c3d('0x10'));var Redis=require(_0x5c3d('0x11'));var authService=require(_0x5c3d('0x12'));var qs=require(_0x5c3d('0x13'));var as=require(_0x5c3d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c3d('0x15'))(_0x5c3d('0x16'));var utils=require(_0x5c3d('0x17'));var config=require(_0x5c3d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56b3b2,_0x953d12){_0x953d12=_0x953d12||0xcc;return function(_0x3445ec){if(_0x3445ec){return _0x56b3b2[_0x5c3d('0x19')](_0x953d12);}return _0x56b3b2[_0x5c3d('0x1a')](_0x953d12)[_0x5c3d('0x1b')]();};}function respondWithResult(_0x33e42b,_0x188fc7){_0x188fc7=_0x188fc7||0xc8;return function(_0x577ffc){if(_0x577ffc){return _0x33e42b[_0x5c3d('0x1a')](_0x188fc7)['json'](_0x577ffc);}};}function respondWithFilteredResult(_0x1118c1,_0x3d3a58){return function(_0x24fcfb){if(_0x24fcfb){var _0x2fa277=_0x24fcfb['count'],_0x4543c3=_0x3d3a58['offset'],_0x3f3a64=_0x3d3a58[_0x5c3d('0x1c')]+_0x3d3a58[_0x5c3d('0x1d')],_0x5547c1;if(_0x3f3a64>=_0x2fa277){_0x3f3a64=_0x2fa277;_0x5547c1=0xc8;}else{_0x5547c1=0xce;}_0x1118c1['status'](_0x5547c1);return _0x1118c1[_0x5c3d('0x1e')](_0x5c3d('0x1f'),_0x4543c3+'-'+_0x3f3a64+'/'+_0x2fa277)[_0x5c3d('0x20')](_0x24fcfb);}return null;};}function patchUpdates(_0x2197d7){return function(_0xaba84e){try{jsonpatch[_0x5c3d('0x21')](_0xaba84e,_0x2197d7,!![]);}catch(_0x17e6fa){return BPromise['reject'](_0x17e6fa);}return _0xaba84e[_0x5c3d('0x22')]();};}function saveUpdates(_0x2214d4,_0xf5adeb){return function(_0x57a1ae){if(_0x57a1ae){return _0x57a1ae[_0x5c3d('0x23')](_0x2214d4)[_0x5c3d('0x24')](function(_0x459dbc){return _0x459dbc;});}return null;};}function removeEntity(_0x403c06,_0x273994){return function(_0x3962ad){if(_0x3962ad){return _0x3962ad[_0x5c3d('0x25')]()[_0x5c3d('0x24')](function(){_0x403c06[_0x5c3d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x381cb5,_0x50d64b){return function(_0x310915){if(!_0x310915){_0x381cb5[_0x5c3d('0x19')](0x194);}return _0x310915;};}function handleError(_0x28ff09,_0x5a89f3){_0x5a89f3=_0x5a89f3||0x1f4;return function(_0x586aeb){logger[_0x5c3d('0x26')](_0x586aeb['stack']);if(_0x586aeb[_0x5c3d('0x27')]){delete _0x586aeb[_0x5c3d('0x27')];}_0x28ff09[_0x5c3d('0x1a')](_0x5a89f3)[_0x5c3d('0x28')](_0x586aeb);};}exports[_0x5c3d('0x29')]=function(_0x18c13e,_0x47b207){var _0x4b700f={},_0x57b1cd={},_0x3a29de={'count':0x0,'rows':[]};var _0x524bc1=_['map'](db['MailQueueReport'][_0x5c3d('0x2a')],function(_0x36c151){return{'name':_0x36c151[_0x5c3d('0x2b')],'type':_0x36c151[_0x5c3d('0x2c')][_0x5c3d('0x2d')]};});_0x57b1cd[_0x5c3d('0x2e')]=_[_0x5c3d('0x2f')](_0x524bc1,'name');_0x57b1cd[_0x5c3d('0x30')]=_[_0x5c3d('0x31')](_0x18c13e[_0x5c3d('0x30')]);_0x57b1cd['filters']=_[_0x5c3d('0x32')](_0x57b1cd[_0x5c3d('0x2e')],_0x57b1cd[_0x5c3d('0x30')]);_0x4b700f['attributes']=_[_0x5c3d('0x32')](_0x57b1cd[_0x5c3d('0x2e')],qs[_0x5c3d('0x33')](_0x18c13e[_0x5c3d('0x30')][_0x5c3d('0x33')]));_0x4b700f[_0x5c3d('0x34')]=_0x4b700f[_0x5c3d('0x34')][_0x5c3d('0x35')]?_0x4b700f[_0x5c3d('0x34')]:_0x57b1cd[_0x5c3d('0x2e')];if(!_0x18c13e[_0x5c3d('0x30')]['hasOwnProperty'](_0x5c3d('0x36'))){_0x4b700f[_0x5c3d('0x1d')]=qs[_0x5c3d('0x1d')](_0x18c13e[_0x5c3d('0x30')][_0x5c3d('0x1d')]);_0x4b700f[_0x5c3d('0x1c')]=qs['offset'](_0x18c13e[_0x5c3d('0x30')][_0x5c3d('0x1c')]);}_0x4b700f[_0x5c3d('0x37')]=qs[_0x5c3d('0x38')](_0x18c13e[_0x5c3d('0x30')][_0x5c3d('0x38')]);_0x4b700f[_0x5c3d('0x39')]=qs[_0x5c3d('0x3a')](_['pick'](_0x18c13e[_0x5c3d('0x30')],_0x57b1cd[_0x5c3d('0x3a')]),_0x524bc1);if(_0x18c13e['query'][_0x5c3d('0x3b')]){_0x4b700f[_0x5c3d('0x39')]=_['merge'](_0x4b700f[_0x5c3d('0x39')],{'$or':_[_0x5c3d('0x2f')](_0x524bc1,function(_0x5c0a63){if(_0x5c0a63[_0x5c3d('0x2c')]!==_0x5c3d('0x3c')){var _0x4fd8b6={};_0x4fd8b6[_0x5c0a63['name']]={'$like':'%'+_0x18c13e[_0x5c3d('0x30')][_0x5c3d('0x3b')]+'%'};return _0x4fd8b6;}})});}_0x4b700f=_[_0x5c3d('0x3d')]({},_0x4b700f,_0x18c13e[_0x5c3d('0x3e')]);var _0x3432df={'where':_0x4b700f[_0x5c3d('0x39')]};return db[_0x5c3d('0x3f')][_0x5c3d('0x40')](_0x3432df)[_0x5c3d('0x24')](function(_0x6fa4dd){_0x3a29de[_0x5c3d('0x40')]=_0x6fa4dd;if(_0x18c13e[_0x5c3d('0x30')][_0x5c3d('0x41')]){_0x4b700f[_0x5c3d('0x42')]=[{'all':!![]}];}return db[_0x5c3d('0x3f')][_0x5c3d('0x43')](_0x4b700f);})['then'](function(_0x4746d1){_0x3a29de['rows']=_0x4746d1;return _0x3a29de;})['then'](respondWithFilteredResult(_0x47b207,_0x4b700f))[_0x5c3d('0x44')](handleError(_0x47b207,null));};exports[_0x5c3d('0x45')]=function(_0x40ff27,_0x40507b){var _0x3aac46={'raw':!![],'where':{'id':_0x40ff27['params']['id']}},_0x4d3be4={};_0x4d3be4[_0x5c3d('0x2e')]=_['keys'](db[_0x5c3d('0x3f')][_0x5c3d('0x2a')]);_0x4d3be4['query']=_[_0x5c3d('0x31')](_0x40ff27[_0x5c3d('0x30')]);_0x4d3be4[_0x5c3d('0x3a')]=_[_0x5c3d('0x32')](_0x4d3be4['model'],_0x4d3be4['query']);_0x3aac46[_0x5c3d('0x34')]=_['intersection'](_0x4d3be4[_0x5c3d('0x2e')],qs[_0x5c3d('0x33')](_0x40ff27[_0x5c3d('0x30')][_0x5c3d('0x33')]));_0x3aac46[_0x5c3d('0x34')]=_0x3aac46[_0x5c3d('0x34')][_0x5c3d('0x35')]?_0x3aac46[_0x5c3d('0x34')]:_0x4d3be4['model'];if(_0x40ff27[_0x5c3d('0x30')]['includeAll']){_0x3aac46[_0x5c3d('0x42')]=[{'all':!![]}];}_0x3aac46=_[_0x5c3d('0x3d')]({},_0x3aac46,_0x40ff27[_0x5c3d('0x3e')]);return db[_0x5c3d('0x3f')][_0x5c3d('0x46')](_0x3aac46)[_0x5c3d('0x24')](handleEntityNotFound(_0x40507b,null))[_0x5c3d('0x24')](respondWithResult(_0x40507b,null))[_0x5c3d('0x44')](handleError(_0x40507b,null));};exports[_0x5c3d('0x47')]=function(_0x350d7c,_0x17a5a1){return db[_0x5c3d('0x3f')][_0x5c3d('0x47')](_0x350d7c[_0x5c3d('0x48')],{})[_0x5c3d('0x24')](respondWithResult(_0x17a5a1,0xc9))[_0x5c3d('0x44')](handleError(_0x17a5a1,null));};exports[_0x5c3d('0x23')]=function(_0x41e096,_0x2e5c08){if(_0x41e096[_0x5c3d('0x48')]['id']){delete _0x41e096[_0x5c3d('0x48')]['id'];}return db['MailQueueReport'][_0x5c3d('0x46')]({'where':{'id':_0x41e096['params']['id']}})[_0x5c3d('0x24')](handleEntityNotFound(_0x2e5c08,null))[_0x5c3d('0x24')](saveUpdates(_0x41e096[_0x5c3d('0x48')],null))[_0x5c3d('0x24')](respondWithResult(_0x2e5c08,null))[_0x5c3d('0x44')](handleError(_0x2e5c08,null));};exports['destroy']=function(_0x183b1f,_0x2a3915){return db[_0x5c3d('0x3f')][_0x5c3d('0x46')]({'where':{'id':_0x183b1f[_0x5c3d('0x49')]['id']}})[_0x5c3d('0x24')](handleEntityNotFound(_0x2a3915,null))['then'](removeEntity(_0x2a3915,null))[_0x5c3d('0x44')](handleError(_0x2a3915,null));};exports['describe']=function(_0x90e1fa,_0x57a417){return db[_0x5c3d('0x3f')]['describe']()[_0x5c3d('0x24')](respondWithResult(_0x57a417,null))[_0x5c3d('0x44')](handleError(_0x57a417,null));}; \ No newline at end of file +var _0x0f5d=['squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','limit','order','where','merge','map','VIRTUAL','MailQueueReport','includeAll','findAll','rows','show','params','length','include','options','create','body','find','catch','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash'];(function(_0x5575cd,_0x73ab7a){var _0x4979a0=function(_0x1ac744){while(--_0x1ac744){_0x5575cd['push'](_0x5575cd['shift']());}};_0x4979a0(++_0x73ab7a);}(_0x0f5d,0x166));var _0xd0f5=function(_0x4a1af2,_0x31131f){_0x4a1af2=_0x4a1af2-0x0;var _0x47dabc=_0x0f5d[_0x4a1af2];return _0x47dabc;};'use strict';var pdf=require(_0xd0f5('0x0'));var emlformat=require(_0xd0f5('0x1'));var rimraf=require(_0xd0f5('0x2'));var zipdir=require(_0xd0f5('0x3'));var jsonpatch=require(_0xd0f5('0x4'));var rp=require('request-promise');var moment=require(_0xd0f5('0x5'));var BPromise=require(_0xd0f5('0x6'));var Mustache=require(_0xd0f5('0x7'));var util=require(_0xd0f5('0x8'));var path=require(_0xd0f5('0x9'));var sox=require('sox');var csv=require(_0xd0f5('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd0f5('0xb'));var squel=require(_0xd0f5('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd0f5('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd0f5('0xe'));var Papa=require(_0xd0f5('0xf'));var Redis=require(_0xd0f5('0x10'));var authService=require(_0xd0f5('0x11'));var qs=require(_0xd0f5('0x12'));var as=require(_0xd0f5('0x13'));var hardwareService=require(_0xd0f5('0x14'));var logger=require('../../config/logger')(_0xd0f5('0x15'));var utils=require(_0xd0f5('0x16'));var config=require(_0xd0f5('0x17'));var db=require(_0xd0f5('0x18'))['db'];function respondWithStatusCode(_0x4382bf,_0x3e7539){_0x3e7539=_0x3e7539||0xcc;return function(_0x313273){if(_0x313273){return _0x4382bf['sendStatus'](_0x3e7539);}return _0x4382bf[_0xd0f5('0x19')](_0x3e7539)['end']();};}function respondWithResult(_0x2e6410,_0xc39197){_0xc39197=_0xc39197||0xc8;return function(_0x2727e3){if(_0x2727e3){return _0x2e6410[_0xd0f5('0x19')](_0xc39197)[_0xd0f5('0x1a')](_0x2727e3);}};}function respondWithFilteredResult(_0x5282da,_0xdae4ad){return function(_0x459408){if(_0x459408){var _0x333f46=_0x459408[_0xd0f5('0x1b')],_0x576fb0=_0xdae4ad['offset'],_0x395163=_0xdae4ad[_0xd0f5('0x1c')]+_0xdae4ad['limit'],_0x61f1ff;if(_0x395163>=_0x333f46){_0x395163=_0x333f46;_0x61f1ff=0xc8;}else{_0x61f1ff=0xce;}_0x5282da[_0xd0f5('0x19')](_0x61f1ff);return _0x5282da[_0xd0f5('0x1d')](_0xd0f5('0x1e'),_0x576fb0+'-'+_0x395163+'/'+_0x333f46)[_0xd0f5('0x1a')](_0x459408);}return null;};}function patchUpdates(_0x1ca9ae){return function(_0x40edf1){try{jsonpatch[_0xd0f5('0x1f')](_0x40edf1,_0x1ca9ae,!![]);}catch(_0x5627a8){return BPromise[_0xd0f5('0x20')](_0x5627a8);}return _0x40edf1[_0xd0f5('0x21')]();};}function saveUpdates(_0x441b9b,_0x3161d1){return function(_0x4b2210){if(_0x4b2210){return _0x4b2210[_0xd0f5('0x22')](_0x441b9b)['then'](function(_0x1da7e7){return _0x1da7e7;});}return null;};}function removeEntity(_0x3f8abf,_0xbae3c8){return function(_0x36c2e6){if(_0x36c2e6){return _0x36c2e6[_0xd0f5('0x23')]()[_0xd0f5('0x24')](function(){_0x3f8abf[_0xd0f5('0x19')](0xcc)[_0xd0f5('0x25')]();});}};}function handleEntityNotFound(_0x1c5f1d,_0x2d80d8){return function(_0x8cbab8){if(!_0x8cbab8){_0x1c5f1d[_0xd0f5('0x26')](0x194);}return _0x8cbab8;};}function handleError(_0x16b235,_0x33a885){_0x33a885=_0x33a885||0x1f4;return function(_0x2dd96e){logger[_0xd0f5('0x27')](_0x2dd96e[_0xd0f5('0x28')]);if(_0x2dd96e[_0xd0f5('0x29')]){delete _0x2dd96e['name'];}_0x16b235[_0xd0f5('0x19')](_0x33a885)[_0xd0f5('0x2a')](_0x2dd96e);};}exports[_0xd0f5('0x2b')]=function(_0xc99007,_0x479a5d){var _0x399912={},_0x53bf8e={},_0xc080a={'count':0x0,'rows':[]};var _0x8832b6=_['map'](db['MailQueueReport'][_0xd0f5('0x2c')],function(_0xd9dc){return{'name':_0xd9dc['fieldName'],'type':_0xd9dc[_0xd0f5('0x2d')][_0xd0f5('0x2e')]};});_0x53bf8e[_0xd0f5('0x2f')]=_['map'](_0x8832b6,_0xd0f5('0x29'));_0x53bf8e['query']=_[_0xd0f5('0x30')](_0xc99007[_0xd0f5('0x31')]);_0x53bf8e[_0xd0f5('0x32')]=_[_0xd0f5('0x33')](_0x53bf8e[_0xd0f5('0x2f')],_0x53bf8e[_0xd0f5('0x31')]);_0x399912[_0xd0f5('0x34')]=_['intersection'](_0x53bf8e[_0xd0f5('0x2f')],qs[_0xd0f5('0x35')](_0xc99007[_0xd0f5('0x31')]['fields']));_0x399912[_0xd0f5('0x34')]=_0x399912[_0xd0f5('0x34')]['length']?_0x399912[_0xd0f5('0x34')]:_0x53bf8e[_0xd0f5('0x2f')];if(!_0xc99007['query']['hasOwnProperty']('nolimit')){_0x399912[_0xd0f5('0x36')]=qs[_0xd0f5('0x36')](_0xc99007[_0xd0f5('0x31')][_0xd0f5('0x36')]);_0x399912['offset']=qs[_0xd0f5('0x1c')](_0xc99007[_0xd0f5('0x31')][_0xd0f5('0x1c')]);}_0x399912[_0xd0f5('0x37')]=qs['sort'](_0xc99007[_0xd0f5('0x31')]['sort']);_0x399912[_0xd0f5('0x38')]=qs['filters'](_['pick'](_0xc99007['query'],_0x53bf8e['filters']),_0x8832b6);if(_0xc99007['query']['filter']){_0x399912['where']=_[_0xd0f5('0x39')](_0x399912[_0xd0f5('0x38')],{'$or':_[_0xd0f5('0x3a')](_0x8832b6,function(_0x5278e7){if(_0x5278e7[_0xd0f5('0x2d')]!==_0xd0f5('0x3b')){var _0xe6a524={};_0xe6a524[_0x5278e7[_0xd0f5('0x29')]]={'$like':'%'+_0xc99007[_0xd0f5('0x31')]['filter']+'%'};return _0xe6a524;}})});}_0x399912=_[_0xd0f5('0x39')]({},_0x399912,_0xc99007['options']);var _0x64c61f={'where':_0x399912[_0xd0f5('0x38')]};return db[_0xd0f5('0x3c')][_0xd0f5('0x1b')](_0x64c61f)[_0xd0f5('0x24')](function(_0x29c404){_0xc080a['count']=_0x29c404;if(_0xc99007[_0xd0f5('0x31')][_0xd0f5('0x3d')]){_0x399912['include']=[{'all':!![]}];}return db[_0xd0f5('0x3c')][_0xd0f5('0x3e')](_0x399912);})[_0xd0f5('0x24')](function(_0x370d3c){_0xc080a[_0xd0f5('0x3f')]=_0x370d3c;return _0xc080a;})[_0xd0f5('0x24')](respondWithFilteredResult(_0x479a5d,_0x399912))['catch'](handleError(_0x479a5d,null));};exports[_0xd0f5('0x40')]=function(_0x3d73c7,_0x2e3ca3){var _0x4e7fb0={'raw':!![],'where':{'id':_0x3d73c7[_0xd0f5('0x41')]['id']}},_0x49b183={};_0x49b183[_0xd0f5('0x2f')]=_['keys'](db[_0xd0f5('0x3c')][_0xd0f5('0x2c')]);_0x49b183['query']=_['keys'](_0x3d73c7['query']);_0x49b183[_0xd0f5('0x32')]=_[_0xd0f5('0x33')](_0x49b183['model'],_0x49b183[_0xd0f5('0x31')]);_0x4e7fb0[_0xd0f5('0x34')]=_['intersection'](_0x49b183[_0xd0f5('0x2f')],qs[_0xd0f5('0x35')](_0x3d73c7[_0xd0f5('0x31')]['fields']));_0x4e7fb0['attributes']=_0x4e7fb0[_0xd0f5('0x34')][_0xd0f5('0x42')]?_0x4e7fb0[_0xd0f5('0x34')]:_0x49b183[_0xd0f5('0x2f')];if(_0x3d73c7['query'][_0xd0f5('0x3d')]){_0x4e7fb0[_0xd0f5('0x43')]=[{'all':!![]}];}_0x4e7fb0=_[_0xd0f5('0x39')]({},_0x4e7fb0,_0x3d73c7[_0xd0f5('0x44')]);return db['MailQueueReport']['find'](_0x4e7fb0)[_0xd0f5('0x24')](handleEntityNotFound(_0x2e3ca3,null))[_0xd0f5('0x24')](respondWithResult(_0x2e3ca3,null))['catch'](handleError(_0x2e3ca3,null));};exports[_0xd0f5('0x45')]=function(_0x26d5fe,_0x231b3f){return db['MailQueueReport'][_0xd0f5('0x45')](_0x26d5fe['body'],{})[_0xd0f5('0x24')](respondWithResult(_0x231b3f,0xc9))['catch'](handleError(_0x231b3f,null));};exports[_0xd0f5('0x22')]=function(_0x534b4f,_0x6df035){if(_0x534b4f[_0xd0f5('0x46')]['id']){delete _0x534b4f[_0xd0f5('0x46')]['id'];}return db[_0xd0f5('0x3c')]['find']({'where':{'id':_0x534b4f[_0xd0f5('0x41')]['id']}})[_0xd0f5('0x24')](handleEntityNotFound(_0x6df035,null))['then'](saveUpdates(_0x534b4f[_0xd0f5('0x46')],null))[_0xd0f5('0x24')](respondWithResult(_0x6df035,null))['catch'](handleError(_0x6df035,null));};exports[_0xd0f5('0x23')]=function(_0x35a178,_0x5bfdf0){return db[_0xd0f5('0x3c')][_0xd0f5('0x47')]({'where':{'id':_0x35a178[_0xd0f5('0x41')]['id']}})[_0xd0f5('0x24')](handleEntityNotFound(_0x5bfdf0,null))['then'](removeEntity(_0x5bfdf0,null))[_0xd0f5('0x48')](handleError(_0x5bfdf0,null));};exports[_0xd0f5('0x49')]=function(_0x3f1b69,_0x283482){return db[_0xd0f5('0x3c')]['describe']()['then'](respondWithResult(_0x283482,null))[_0xd0f5('0x48')](handleError(_0x283482,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index dd3ff6e..fb6cede 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 _0xf2e3=['uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue'];(function(_0x2698b5,_0x2faad4){var _0x5375c1=function(_0x5d5348){while(--_0x5d5348){_0x2698b5['push'](_0x2698b5['shift']());}};_0x5375c1(++_0x2faad4);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xf2e3[_0x2112d4];return _0x434972;};'use strict';var _=require(_0x3f2e('0x0'));var util=require('util');var logger=require(_0x3f2e('0x1'))(_0x3f2e('0x2'));var moment=require(_0x3f2e('0x3'));var BPromise=require(_0x3f2e('0x4'));var rp=require(_0x3f2e('0x5'));var fs=require('fs');var path=require(_0x3f2e('0x6'));var rimraf=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var attributes=require(_0x3f2e('0x9'));module['exports']=function(_0x33a3b7,_0xdd6b3e){return _0x33a3b7[_0x3f2e('0xa')](_0x3f2e('0xb'),attributes,{'tableName':_0x3f2e('0xc'),'paranoid':![],'indexes':[{'name':_0x3f2e('0xd'),'fields':[_0x3f2e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xba6f=['report_mail_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define'];(function(_0x37f4a4,_0x34f719){var _0x5c5907=function(_0x39a891){while(--_0x39a891){_0x37f4a4['push'](_0x37f4a4['shift']());}};_0x5c5907(++_0x34f719);}(_0xba6f,0x1d0));var _0xfba6=function(_0x2fc6cf,_0x2bb133){_0x2fc6cf=_0x2fc6cf-0x0;var _0xf2ade3=_0xba6f[_0x2fc6cf];return _0xf2ade3;};'use strict';var _=require(_0xfba6('0x0'));var util=require('util');var logger=require(_0xfba6('0x1'))(_0xfba6('0x2'));var moment=require(_0xfba6('0x3'));var BPromise=require(_0xfba6('0x4'));var rp=require(_0xfba6('0x5'));var fs=require('fs');var path=require(_0xfba6('0x6'));var rimraf=require(_0xfba6('0x7'));var config=require(_0xfba6('0x8'));var attributes=require(_0xfba6('0x9'));module[_0xfba6('0xa')]=function(_0x269363,_0x10310e){return _0x269363[_0xfba6('0xb')]('MailQueueReport',attributes,{'tableName':_0xfba6('0xc'),'paranoid':![],'indexes':[{'name':_0xfba6('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 6632e9d..2ae5463 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 _0xc6ac=['http','request','then','info','MailQueueReport,\x20%s,\x20%s','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','CreateMailQueueReport','MailQueueReport','create','body','options','raw','stringify','catch','update','where','attributes','UpdateMailQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x45aafa,_0x923fff){var _0x1d1c69=function(_0x371247){while(--_0x371247){_0x45aafa['push'](_0x45aafa['shift']());}};_0x1d1c69(++_0x923fff);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x53633f,_0x866a58){_0x53633f=_0x53633f-0x0;var _0x171258=_0xc6ac[_0x53633f];return _0x171258;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});}exports[_0xcc6a('0x18')]=function(_0x33079c){var _0x12ef33=this;return new Promise(function(_0x2d9585,_0x412bc7){return db[_0xcc6a('0x19')][_0xcc6a('0x1a')](_0x33079c[_0xcc6a('0x1b')],{'raw':_0x33079c['options']?_0x33079c[_0xcc6a('0x1c')][_0xcc6a('0x1d')]===undefined?!![]:![]:!![]})[_0xcc6a('0xf')](function(_0x368a6e){logger[_0xcc6a('0x10')](_0xcc6a('0x18'),_0x33079c);logger[_0xcc6a('0x12')](_0xcc6a('0x18'),_0x33079c,JSON[_0xcc6a('0x1e')](_0x368a6e));_0x2d9585(_0x368a6e);})[_0xcc6a('0x1f')](function(_0x329d17){logger[_0xcc6a('0x15')]('CreateMailQueueReport',_0x329d17[_0xcc6a('0x17')],_0x33079c);_0x412bc7(_0x12ef33[_0xcc6a('0x15')](0x1f4,_0x329d17[_0xcc6a('0x17')]));});});};exports['UpdateMailQueueReport']=function(_0x10016a){var _0x294486=this;return new Promise(function(_0x3a00e5,_0x3ed7ce){return db[_0xcc6a('0x19')][_0xcc6a('0x20')](_0x10016a['body'],{'raw':_0x10016a[_0xcc6a('0x1c')]?_0x10016a[_0xcc6a('0x1c')][_0xcc6a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10016a['options']?_0x10016a[_0xcc6a('0x1c')][_0xcc6a('0x21')]||null:null,'attributes':_0x10016a['options']?_0x10016a[_0xcc6a('0x1c')][_0xcc6a('0x22')]||null:null,'limit':_0x10016a[_0xcc6a('0x1c')]?_0x10016a[_0xcc6a('0x1c')]['limit']||null:null})[_0xcc6a('0xf')](function(_0x3cf14c){logger[_0xcc6a('0x10')]('UpdateMailQueueReport',_0x10016a);logger[_0xcc6a('0x12')]('UpdateMailQueueReport',_0x10016a,JSON['stringify'](_0x3cf14c));_0x3a00e5(_0x3cf14c);})[_0xcc6a('0x1f')](function(_0x2e9f41){logger[_0xcc6a('0x15')](_0xcc6a('0x23'),_0x2e9f41[_0xcc6a('0x17')],_0x10016a);_0x3ed7ce(_0x294486[_0xcc6a('0x15')](0x1f4,_0x2e9f41['message']));});});}; \ No newline at end of file +var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x37bc8d,_0x686b2c){var _0x5ab9e3=function(_0xc9b63b){while(--_0xc9b63b){_0x37bc8d['push'](_0x37bc8d['shift']());}};_0x5ab9e3(++_0x686b2c);}(_0xdb28,0x106));var _0x8db2=function(_0x5ac6f3,_0x319e21){_0x5ac6f3=_0x5ac6f3-0x0;var _0x636488=_0xdb28[_0x5ac6f3];return _0x636488;};'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 Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index dd378a6..92458e9 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 _0x8714=['Router','../../config/environment','exports','multer','util','path','connect-timeout','express'];(function(_0x3f14ae,_0x2ea0c6){var _0x5d46eb=function(_0xc20b1f){while(--_0xc20b1f){_0x3f14ae['push'](_0x3f14ae['shift']());}};_0x5d46eb(++_0x2ea0c6);}(_0x8714,0x103));var _0x4871=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x8714[_0xdc37a1];return _0x99b4fe;};'use strict';var multer=require(_0x4871('0x0'));var util=require(_0x4871('0x1'));var path=require(_0x4871('0x2'));var timeout=require(_0x4871('0x3'));var express=require(_0x4871('0x4'));var router=express[_0x4871('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4871('0x6'));module[_0x4871('0x7')]=router; \ No newline at end of file +var _0xedd3=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x58b555,_0x5e742f){var _0x1b2f99=function(_0x192bb3){while(--_0x192bb3){_0x58b555['push'](_0x58b555['shift']());}};_0x1b2f99(++_0x5e742f);}(_0xedd3,0xd8));var _0x3edd=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xedd3[_0x24061a];return _0x82054e;};'use strict';var multer=require(_0x3edd('0x0'));var util=require(_0x3edd('0x1'));var path=require(_0x3edd('0x2'));var timeout=require(_0x3edd('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x3edd('0x4'));var interaction=require(_0x3edd('0x5'));var config=require(_0x3edd('0x6'));module[_0x3edd('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 18b16ea..55b060a 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 _0xd273=['STRING','BOOLEAN','INTEGER','INBOX','sequelize','exports'];(function(_0x189b21,_0x4c1465){var _0x2add98=function(_0x3bb76e){while(--_0x3bb76e){_0x189b21['push'](_0x189b21['shift']());}};_0x2add98(++_0x4c1465);}(_0xd273,0xb8));var _0x3d27=function(_0x5a90f8,_0x2c76b3){_0x5a90f8=_0x5a90f8-0x0;var _0x2ba043=_0xd273[_0x5a90f8];return _0x2ba043;};'use strict';var Sequelize=require(_0x3d27('0x0'));module[_0x3d27('0x1')]={'description':{'type':Sequelize[_0x3d27('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x3d27('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x3d27('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x3d27('0x2')]},'port':{'type':Sequelize[_0x3d27('0x4')]},'tls':{'type':Sequelize[_0x3d27('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x3d27('0x5')},'connTimeout':{'type':Sequelize[_0x3d27('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x3d27('0x2')]}}; \ No newline at end of file +var _0x905d=['BOOLEAN','username','INTEGER','INBOX','sequelize','STRING'];(function(_0x1e05c1,_0x3cffa3){var _0x15f1ca=function(_0x3a9594){while(--_0x3a9594){_0x1e05c1['push'](_0x1e05c1['shift']());}};_0x15f1ca(++_0x3cffa3);}(_0x905d,0xb2));var _0xd905=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x905d[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xd905('0x0'));module['exports']={'description':{'type':Sequelize[_0xd905('0x1')]},'host':{'type':Sequelize[_0xd905('0x1')]},'authentication':{'type':Sequelize[_0xd905('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':_0xd905('0x3')},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xd905('0x4')]},'tls':{'type':Sequelize[_0xd905('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xd905('0x5')},'connTimeout':{'type':Sequelize[_0xd905('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xd905('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xd905('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 231ed91..39c8bc2 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 _0x9a96=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util'];(function(_0x49d578,_0x3edee2){var _0x48471e=function(_0x5c8338){while(--_0x5c8338){_0x49d578['push'](_0x49d578['shift']());}};_0x48471e(++_0x3edee2);}(_0x9a96,0xd0));var _0x69a9=function(_0x672541,_0x1e0b28){_0x672541=_0x672541-0x0;var _0x36494a=_0x9a96[_0x672541];return _0x36494a;};'use strict';var _=require(_0x69a9('0x0'));var util=require(_0x69a9('0x1'));var logger=require(_0x69a9('0x2'))(_0x69a9('0x3'));var moment=require(_0x69a9('0x4'));var BPromise=require(_0x69a9('0x5'));var rp=require(_0x69a9('0x6'));var fs=require('fs');var path=require(_0x69a9('0x7'));var rimraf=require(_0x69a9('0x8'));var config=require(_0x69a9('0x9'));var attributes=require(_0x69a9('0xa'));module[_0x69a9('0xb')]=function(_0x5a48bf,_0x245072){return _0x5a48bf[_0x69a9('0xc')](_0x69a9('0xd'),attributes,{'tableName':_0x69a9('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea1c=['define','MailServerIn','mail_servers_in','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','exports'];(function(_0x23f976,_0x5e50e1){var _0x4bde62=function(_0x2a3a41){while(--_0x2a3a41){_0x23f976['push'](_0x23f976['shift']());}};_0x4bde62(++_0x5e50e1);}(_0xea1c,0x117));var _0xcea1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xea1c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcea1('0x0'))(_0xcea1('0x1'));var moment=require(_0xcea1('0x2'));var BPromise=require(_0xcea1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcea1('0x4'));var rimraf=require(_0xcea1('0x5'));var config=require(_0xcea1('0x6'));var attributes=require(_0xcea1('0x7'));module[_0xcea1('0x8')]=function(_0x1ff8bf,_0x29732f){return _0x1ff8bf[_0xcea1('0x9')](_0xcea1('0xa'),attributes,{'tableName':_0xcea1('0xb'),'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 545f5f0..dd3e5eb 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 _0xdae9=['model','GetMailServerIn','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','MailServerIn,\x20%s,\x20%s','message','result','catch','MailServerIn','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x4095a7,_0x26ca08){var _0x424cc7=function(_0x5ce17d){while(--_0x5ce17d){_0x4095a7['push'](_0x4095a7['shift']());}};_0x424cc7(++_0x26ca08);}(_0xdae9,0x65));var _0x9dae=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xdae9[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x9dae('0x0'));var util=require('util');var moment=require(_0x9dae('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9dae('0x2'));var db=require(_0x9dae('0x3'))['db'];var utils=require(_0x9dae('0x4'));var logger=require('../../config/logger')(_0x9dae('0x5'));var config=require(_0x9dae('0x6'));var jayson=require(_0x9dae('0x7'));var client=jayson[_0x9dae('0x8')][_0x9dae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2dc93f,_0x3192ee,_0x25344e){return new BPromise(function(_0x23c6ef,_0x3f9238){return client[_0x9dae('0xa')](_0x2dc93f,_0x25344e)[_0x9dae('0xb')](function(_0x2eede6){logger[_0x9dae('0xc')]('MailServerIn,\x20%s,\x20%s',_0x3192ee,_0x9dae('0xd'));logger[_0x9dae('0xe')](_0x9dae('0xf'),_0x3192ee,_0x9dae('0xd'),JSON[_0x9dae('0x10')](_0x2eede6));if(_0x2eede6[_0x9dae('0x11')]){if(_0x2eede6[_0x9dae('0x11')]['code']===0x1f4){logger[_0x9dae('0x11')](_0x9dae('0x12'),_0x3192ee,_0x2eede6['error'][_0x9dae('0x13')]);return _0x3f9238(_0x2eede6[_0x9dae('0x11')][_0x9dae('0x13')]);}logger[_0x9dae('0x11')](_0x9dae('0x12'),_0x3192ee,_0x2eede6['error'][_0x9dae('0x13')]);return _0x23c6ef(_0x2eede6['error'][_0x9dae('0x13')]);}else{logger[_0x9dae('0xc')](_0x9dae('0x12'),_0x3192ee,'request\x20sent');_0x23c6ef(_0x2eede6[_0x9dae('0x14')][_0x9dae('0x13')]);}})[_0x9dae('0x15')](function(_0x8796d1){logger['error'](_0x9dae('0x12'),_0x3192ee,_0x8796d1);_0x3f9238(_0x8796d1);});});}exports['GetMailServerIn']=function(_0x8a6d97){var _0x5183a5=this;return new Promise(function(_0x47ba78,_0x45c084){return db[_0x9dae('0x16')][_0x9dae('0x17')]({'raw':_0x8a6d97['options']?_0x8a6d97[_0x9dae('0x18')][_0x9dae('0x19')]===undefined?!![]:![]:!![],'where':_0x8a6d97['options']?_0x8a6d97[_0x9dae('0x18')][_0x9dae('0x1a')]||null:null,'attributes':_0x8a6d97['options']?_0x8a6d97[_0x9dae('0x18')][_0x9dae('0x1b')]||null:null,'limit':_0x8a6d97[_0x9dae('0x18')]?_0x8a6d97[_0x9dae('0x18')][_0x9dae('0x1c')]||null:null,'include':_0x8a6d97[_0x9dae('0x18')]?_0x8a6d97[_0x9dae('0x18')][_0x9dae('0x1d')]?_[_0x9dae('0x1e')](_0x8a6d97[_0x9dae('0x18')][_0x9dae('0x1d')],function(_0x37e8a3){return{'model':db[_0x37e8a3[_0x9dae('0x1f')]],'as':_0x37e8a3['as'],'attributes':_0x37e8a3['attributes'],'include':_0x37e8a3[_0x9dae('0x1d')]?_[_0x9dae('0x1e')](_0x37e8a3['include'],function(_0x158dfd){return{'model':db[_0x158dfd[_0x9dae('0x1f')]],'as':_0x158dfd['as'],'attributes':_0x158dfd[_0x9dae('0x1b')],'include':_0x158dfd[_0x9dae('0x1d')]?_[_0x9dae('0x1e')](_0x158dfd['include'],function(_0x3ad740){return{'model':db[_0x3ad740['model']],'as':_0x3ad740['as'],'attributes':_0x3ad740[_0x9dae('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56a9b6){logger['info']('GetMailServerIn',_0x8a6d97);logger[_0x9dae('0xe')](_0x9dae('0x20'),_0x8a6d97,JSON['stringify'](_0x56a9b6));_0x47ba78(_0x56a9b6);})[_0x9dae('0x15')](function(_0x1e4fb8){logger['error'](_0x9dae('0x20'),_0x1e4fb8['message'],_0x8a6d97);_0x45c084(_0x5183a5['error'](0x1f4,_0x1e4fb8[_0x9dae('0x13')]));});});}; \ No newline at end of file +var _0x465e=['model','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','MailServerIn,\x20%s,\x20%s','message','info','result','catch','GetMailServerIn','options','raw','attributes','limit','include','map'];(function(_0xc738c5,_0x2792ab){var _0x5aa034=function(_0x2bc299){while(--_0x2bc299){_0xc738c5['push'](_0xc738c5['shift']());}};_0x5aa034(++_0x2792ab);}(_0x465e,0xf1));var _0xe465=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0x465e[_0x2e8418];return _0x548fe6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe465('0x0'));var BPromise=require(_0xe465('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe465('0x2'));var db=require(_0xe465('0x3'))['db'];var utils=require(_0xe465('0x4'));var logger=require(_0xe465('0x5'))('rpc');var config=require(_0xe465('0x6'));var jayson=require(_0xe465('0x7'));var client=jayson[_0xe465('0x8')][_0xe465('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a3f5f,_0xa8332a,_0x40fa66){return new BPromise(function(_0x22a441,_0x40e934){return client[_0xe465('0xa')](_0x3a3f5f,_0x40fa66)[_0xe465('0xb')](function(_0x57484b){logger['info']('MailServerIn,\x20%s,\x20%s',_0xa8332a,'request\x20sent');logger[_0xe465('0xc')](_0xe465('0xd'),_0xa8332a,_0xe465('0xe'),JSON['stringify'](_0x57484b));if(_0x57484b['error']){if(_0x57484b[_0xe465('0xf')][_0xe465('0x10')]===0x1f4){logger[_0xe465('0xf')](_0xe465('0x11'),_0xa8332a,_0x57484b[_0xe465('0xf')][_0xe465('0x12')]);return _0x40e934(_0x57484b['error']['message']);}logger[_0xe465('0xf')](_0xe465('0x11'),_0xa8332a,_0x57484b[_0xe465('0xf')][_0xe465('0x12')]);return _0x22a441(_0x57484b[_0xe465('0xf')]['message']);}else{logger[_0xe465('0x13')](_0xe465('0x11'),_0xa8332a,'request\x20sent');_0x22a441(_0x57484b[_0xe465('0x14')][_0xe465('0x12')]);}})[_0xe465('0x15')](function(_0x166f57){logger[_0xe465('0xf')](_0xe465('0x11'),_0xa8332a,_0x166f57);_0x40e934(_0x166f57);});});}exports[_0xe465('0x16')]=function(_0x2e61b8){var _0x130a69=this;return new Promise(function(_0x33d26f,_0x464964){return db['MailServerIn']['findAll']({'raw':_0x2e61b8[_0xe465('0x17')]?_0x2e61b8[_0xe465('0x17')][_0xe465('0x18')]===undefined?!![]:![]:!![],'where':_0x2e61b8[_0xe465('0x17')]?_0x2e61b8[_0xe465('0x17')]['where']||null:null,'attributes':_0x2e61b8[_0xe465('0x17')]?_0x2e61b8['options'][_0xe465('0x19')]||null:null,'limit':_0x2e61b8[_0xe465('0x17')]?_0x2e61b8[_0xe465('0x17')][_0xe465('0x1a')]||null:null,'include':_0x2e61b8['options']?_0x2e61b8[_0xe465('0x17')][_0xe465('0x1b')]?_[_0xe465('0x1c')](_0x2e61b8['options'][_0xe465('0x1b')],function(_0x2ab7d2){return{'model':db[_0x2ab7d2[_0xe465('0x1d')]],'as':_0x2ab7d2['as'],'attributes':_0x2ab7d2[_0xe465('0x19')],'include':_0x2ab7d2[_0xe465('0x1b')]?_[_0xe465('0x1c')](_0x2ab7d2[_0xe465('0x1b')],function(_0xb576dc){return{'model':db[_0xb576dc[_0xe465('0x1d')]],'as':_0xb576dc['as'],'attributes':_0xb576dc['attributes'],'include':_0xb576dc[_0xe465('0x1b')]?_['map'](_0xb576dc[_0xe465('0x1b')],function(_0x22226d){return{'model':db[_0x22226d[_0xe465('0x1d')]],'as':_0x22226d['as'],'attributes':_0x22226d[_0xe465('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe465('0xb')](function(_0x3aece4){logger[_0xe465('0x13')](_0xe465('0x16'),_0x2e61b8);logger[_0xe465('0xc')](_0xe465('0x16'),_0x2e61b8,JSON['stringify'](_0x3aece4));_0x33d26f(_0x3aece4);})['catch'](function(_0x12856d){logger[_0xe465('0xf')](_0xe465('0x16'),_0x12856d[_0xe465('0x12')],_0x2e61b8);_0x464964(_0x130a69[_0xe465('0xf')](0x1f4,_0x12856d[_0xe465('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index b2d5326..eb41626 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 _0x2f7f=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x2f7f,0xb4));var _0xf2f7=function(_0x1558ab,_0x39d1de){_0x1558ab=_0x1558ab-0x0;var _0x53b64a=_0x2f7f[_0x1558ab];return _0x53b64a;};'use strict';var multer=require(_0xf2f7('0x0'));var util=require('util');var path=require(_0xf2f7('0x1'));var timeout=require(_0xf2f7('0x2'));var express=require(_0xf2f7('0x3'));var router=express[_0xf2f7('0x4')]();var auth=require(_0xf2f7('0x5'));var interaction=require(_0xf2f7('0x6'));var config=require(_0xf2f7('0x7'));var controller=require(_0xf2f7('0x8'));router[_0xf2f7('0x9')]('/',auth[_0xf2f7('0xa')](),controller[_0xf2f7('0xb')]);router['get'](_0xf2f7('0xc'),auth[_0xf2f7('0xa')](),controller[_0xf2f7('0xd')]);router[_0xf2f7('0xe')]('/',auth['isAuthenticated'](),controller[_0xf2f7('0xf')]);router[_0xf2f7('0x10')](_0xf2f7('0xc'),auth[_0xf2f7('0xa')](),controller[_0xf2f7('0x11')]);router[_0xf2f7('0x12')]('/:id',auth[_0xf2f7('0xa')](),controller[_0xf2f7('0x13')]);module[_0xf2f7('0x14')]=router; \ No newline at end of file +var _0x801d=['post','put','update','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','isAuthenticated','index','/:id'];(function(_0x57965a,_0x3637a3){var _0x5274a5=function(_0x77466a){while(--_0x77466a){_0x57965a['push'](_0x57965a['shift']());}};_0x5274a5(++_0x3637a3);}(_0x801d,0xd5));var _0xd801=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x801d[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0xd801('0x0'));var util=require(_0xd801('0x1'));var path=require(_0xd801('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd801('0x3')]();var auth=require(_0xd801('0x4'));var interaction=require(_0xd801('0x5'));var config=require(_0xd801('0x6'));var controller=require(_0xd801('0x7'));router['get']('/',auth[_0xd801('0x8')](),controller[_0xd801('0x9')]);router['get'](_0xd801('0xa'),auth[_0xd801('0x8')](),controller['show']);router[_0xd801('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd801('0xc')](_0xd801('0xa'),auth[_0xd801('0x8')](),controller[_0xd801('0xd')]);router[_0xd801('0xe')]('/:id',auth[_0xd801('0x8')](),controller[_0xd801('0xf')]);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 fd0137d..8507b9a 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 _0x2709=['sequelize','STRING','BOOLEAN'];(function(_0x46ebef,_0x3b16b2){var _0xbafc6c=function(_0x65b792){while(--_0x65b792){_0x46ebef['push'](_0x46ebef['shift']());}};_0xbafc6c(++_0x3b16b2);}(_0x2709,0x189));var _0x9270=function(_0x4737b1,_0x2b84f6){_0x4737b1=_0x4737b1-0x0;var _0x43018c=_0x2709[_0x4737b1];return _0x43018c;};'use strict';var Sequelize=require(_0x9270('0x0'));module['exports']={'description':{'type':Sequelize[_0x9270('0x1')]},'host':{'type':Sequelize[_0x9270('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x9270('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x9270('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0x9270('0x1')]},'authentication':{'type':Sequelize[_0x9270('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2aa3=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x5663ee,_0x36485f){var _0x17200d=function(_0x10074e){while(--_0x10074e){_0x5663ee['push'](_0x5663ee['shift']());}};_0x17200d(++_0x36485f);}(_0x2aa3,0x83));var _0x32aa=function(_0x2b4c19,_0x21a59d){_0x2b4c19=_0x2b4c19-0x0;var _0x5c7e2f=_0x2aa3[_0x2b4c19];return _0x5c7e2f;};'use strict';var Sequelize=require(_0x32aa('0x0'));module[_0x32aa('0x1')]={'description':{'type':Sequelize[_0x32aa('0x2')]},'host':{'type':Sequelize[_0x32aa('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x32aa('0x3')]},'secure':{'type':Sequelize[_0x32aa('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x32aa('0x2')]},'authentication':{'type':Sequelize[_0x32aa('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 32ce159..d762fac 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 _0x0a68=['update','then','destroy','error','stack','name','send','index','fieldName','type','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','MailServerOut','findAll','catch','show','params','rawAttributes','fields','include','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save'];(function(_0x489f67,_0x3553ce){var _0xf07801=function(_0xf27ddf){while(--_0xf27ddf){_0x489f67['push'](_0x489f67['shift']());}};_0xf07801(++_0x3553ce);}(_0x0a68,0x74));var _0x80a6=function(_0x45afad,_0x288cb3){_0x45afad=_0x45afad-0x0;var _0x5972c9=_0x0a68[_0x45afad];return _0x5972c9;};'use strict';var pdf=require(_0x80a6('0x0'));var emlformat=require(_0x80a6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x80a6('0x2'));var jsonpatch=require(_0x80a6('0x3'));var rp=require(_0x80a6('0x4'));var moment=require(_0x80a6('0x5'));var BPromise=require(_0x80a6('0x6'));var Mustache=require('mustache');var util=require(_0x80a6('0x7'));var path=require('path');var sox=require(_0x80a6('0x8'));var csv=require(_0x80a6('0x9'));var ejs=require(_0x80a6('0xa'));var fs=require('fs');var _=require(_0x80a6('0xb'));var squel=require(_0x80a6('0xc'));var crypto=require(_0x80a6('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x80a6('0x9'));var querystring=require(_0x80a6('0xe'));var Papa=require(_0x80a6('0xf'));var Redis=require(_0x80a6('0x10'));var authService=require(_0x80a6('0x11'));var qs=require(_0x80a6('0x12'));var as=require(_0x80a6('0x13'));var hardwareService=require(_0x80a6('0x14'));var logger=require(_0x80a6('0x15'))(_0x80a6('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x80a6('0x17'))['db'];function respondWithStatusCode(_0x469d39,_0x132141){_0x132141=_0x132141||0xcc;return function(_0x430049){if(_0x430049){return _0x469d39[_0x80a6('0x18')](_0x132141);}return _0x469d39[_0x80a6('0x19')](_0x132141)[_0x80a6('0x1a')]();};}function respondWithResult(_0x1bd7ce,_0x2083c3){_0x2083c3=_0x2083c3||0xc8;return function(_0x37e02e){if(_0x37e02e){return _0x1bd7ce[_0x80a6('0x19')](_0x2083c3)['json'](_0x37e02e);}};}function respondWithFilteredResult(_0x5e23b9,_0x5800c2){return function(_0x1a5289){if(_0x1a5289){var _0x6ce69b=_0x1a5289[_0x80a6('0x1b')],_0x1bf1e0=_0x5800c2[_0x80a6('0x1c')],_0x792d67=_0x5800c2['offset']+_0x5800c2[_0x80a6('0x1d')],_0x2f3ae3;if(_0x792d67>=_0x6ce69b){_0x792d67=_0x6ce69b;_0x2f3ae3=0xc8;}else{_0x2f3ae3=0xce;}_0x5e23b9[_0x80a6('0x19')](_0x2f3ae3);return _0x5e23b9[_0x80a6('0x1e')](_0x80a6('0x1f'),_0x1bf1e0+'-'+_0x792d67+'/'+_0x6ce69b)[_0x80a6('0x20')](_0x1a5289);}return null;};}function patchUpdates(_0x41d49f){return function(_0x48b0c3){try{jsonpatch[_0x80a6('0x21')](_0x48b0c3,_0x41d49f,!![]);}catch(_0x420c80){return BPromise[_0x80a6('0x22')](_0x420c80);}return _0x48b0c3[_0x80a6('0x23')]();};}function saveUpdates(_0x3a34ad,_0x9b9673){return function(_0x325ed1){if(_0x325ed1){return _0x325ed1[_0x80a6('0x24')](_0x3a34ad)[_0x80a6('0x25')](function(_0x201d63){return _0x201d63;});}return null;};}function removeEntity(_0x48c941,_0x5b99e2){return function(_0x6f7750){if(_0x6f7750){return _0x6f7750[_0x80a6('0x26')]()[_0x80a6('0x25')](function(){_0x48c941[_0x80a6('0x19')](0xcc)[_0x80a6('0x1a')]();});}};}function handleEntityNotFound(_0x1c7e52,_0x408e2d){return function(_0x240679){if(!_0x240679){_0x1c7e52[_0x80a6('0x18')](0x194);}return _0x240679;};}function handleError(_0x14b322,_0xc5364b){_0xc5364b=_0xc5364b||0x1f4;return function(_0x1755bc){logger[_0x80a6('0x27')](_0x1755bc[_0x80a6('0x28')]);if(_0x1755bc[_0x80a6('0x29')]){delete _0x1755bc['name'];}_0x14b322[_0x80a6('0x19')](_0xc5364b)[_0x80a6('0x2a')](_0x1755bc);};}exports[_0x80a6('0x2b')]=function(_0x9c1fd6,_0x309918){var _0x58fb56={},_0x40a9ac={},_0x4faf37={'count':0x0,'rows':[]};var _0x399012=_['map'](db['MailServerOut']['rawAttributes'],function(_0xa3cb31){return{'name':_0xa3cb31[_0x80a6('0x2c')],'type':_0xa3cb31[_0x80a6('0x2d')]['key']};});_0x40a9ac[_0x80a6('0x2e')]=_[_0x80a6('0x2f')](_0x399012,_0x80a6('0x29'));_0x40a9ac[_0x80a6('0x30')]=_[_0x80a6('0x31')](_0x9c1fd6[_0x80a6('0x30')]);_0x40a9ac[_0x80a6('0x32')]=_[_0x80a6('0x33')](_0x40a9ac[_0x80a6('0x2e')],_0x40a9ac[_0x80a6('0x30')]);_0x58fb56['attributes']=_[_0x80a6('0x33')](_0x40a9ac[_0x80a6('0x2e')],qs['fields'](_0x9c1fd6['query']['fields']));_0x58fb56[_0x80a6('0x34')]=_0x58fb56['attributes'][_0x80a6('0x35')]?_0x58fb56['attributes']:_0x40a9ac['model'];if(!_0x9c1fd6['query'][_0x80a6('0x36')](_0x80a6('0x37'))){_0x58fb56[_0x80a6('0x1d')]=qs[_0x80a6('0x1d')](_0x9c1fd6[_0x80a6('0x30')][_0x80a6('0x1d')]);_0x58fb56['offset']=qs[_0x80a6('0x1c')](_0x9c1fd6['query']['offset']);}_0x58fb56[_0x80a6('0x38')]=qs[_0x80a6('0x39')](_0x9c1fd6['query']['sort']);_0x58fb56[_0x80a6('0x3a')]=qs['filters'](_[_0x80a6('0x3b')](_0x9c1fd6['query'],_0x40a9ac[_0x80a6('0x32')]),_0x399012);if(_0x9c1fd6[_0x80a6('0x30')][_0x80a6('0x3c')]){_0x58fb56[_0x80a6('0x3a')]=_[_0x80a6('0x3d')](_0x58fb56[_0x80a6('0x3a')],{'$or':_[_0x80a6('0x2f')](_0x399012,function(_0x5d730a){if(_0x5d730a[_0x80a6('0x2d')]!==_0x80a6('0x3e')){var _0xfc7843={};_0xfc7843[_0x5d730a[_0x80a6('0x29')]]={'$like':'%'+_0x9c1fd6[_0x80a6('0x30')][_0x80a6('0x3c')]+'%'};return _0xfc7843;}})});}_0x58fb56=_[_0x80a6('0x3d')]({},_0x58fb56,_0x9c1fd6[_0x80a6('0x3f')]);var _0x1d06d3={'where':_0x58fb56[_0x80a6('0x3a')]};return db['MailServerOut'][_0x80a6('0x1b')](_0x1d06d3)['then'](function(_0x487242){_0x4faf37[_0x80a6('0x1b')]=_0x487242;if(_0x9c1fd6['query'][_0x80a6('0x40')]){_0x58fb56['include']=[{'all':!![]}];}return db[_0x80a6('0x41')][_0x80a6('0x42')](_0x58fb56);})[_0x80a6('0x25')](function(_0x49149a){_0x4faf37['rows']=_0x49149a;return _0x4faf37;})[_0x80a6('0x25')](respondWithFilteredResult(_0x309918,_0x58fb56))[_0x80a6('0x43')](handleError(_0x309918,null));};exports[_0x80a6('0x44')]=function(_0x2a1919,_0x172bb8){var _0x2b88c8={'raw':!![],'where':{'id':_0x2a1919[_0x80a6('0x45')]['id']}},_0x2a909c={};_0x2a909c[_0x80a6('0x2e')]=_[_0x80a6('0x31')](db[_0x80a6('0x41')][_0x80a6('0x46')]);_0x2a909c[_0x80a6('0x30')]=_[_0x80a6('0x31')](_0x2a1919['query']);_0x2a909c['filters']=_[_0x80a6('0x33')](_0x2a909c[_0x80a6('0x2e')],_0x2a909c[_0x80a6('0x30')]);_0x2b88c8['attributes']=_['intersection'](_0x2a909c['model'],qs[_0x80a6('0x47')](_0x2a1919[_0x80a6('0x30')][_0x80a6('0x47')]));_0x2b88c8[_0x80a6('0x34')]=_0x2b88c8[_0x80a6('0x34')]['length']?_0x2b88c8[_0x80a6('0x34')]:_0x2a909c['model'];if(_0x2a1919[_0x80a6('0x30')][_0x80a6('0x40')]){_0x2b88c8[_0x80a6('0x48')]=[{'all':!![]}];}_0x2b88c8=_[_0x80a6('0x3d')]({},_0x2b88c8,_0x2a1919[_0x80a6('0x3f')]);return db[_0x80a6('0x41')][_0x80a6('0x49')](_0x2b88c8)[_0x80a6('0x25')](handleEntityNotFound(_0x172bb8,null))[_0x80a6('0x25')](respondWithResult(_0x172bb8,null))[_0x80a6('0x43')](handleError(_0x172bb8,null));};exports['create']=function(_0x44c3cd,_0x3a8a77){return db['MailServerOut'][_0x80a6('0x4a')](_0x44c3cd[_0x80a6('0x4b')],{})['then'](respondWithResult(_0x3a8a77,0xc9))[_0x80a6('0x43')](handleError(_0x3a8a77,null));};exports[_0x80a6('0x24')]=function(_0x3f0490,_0x12cc2e){if(_0x3f0490[_0x80a6('0x4b')]['id']){delete _0x3f0490[_0x80a6('0x4b')]['id'];}return db[_0x80a6('0x41')]['find']({'where':{'id':_0x3f0490['params']['id']}})[_0x80a6('0x25')](handleEntityNotFound(_0x12cc2e,null))['then'](saveUpdates(_0x3f0490[_0x80a6('0x4b')],null))['then'](respondWithResult(_0x12cc2e,null))[_0x80a6('0x43')](handleError(_0x12cc2e,null));};exports['destroy']=function(_0x1ee987,_0x49bd17){return db[_0x80a6('0x41')][_0x80a6('0x49')]({'where':{'id':_0x1ee987[_0x80a6('0x45')]['id']}})['then'](handleEntityNotFound(_0x49bd17,null))[_0x80a6('0x25')](removeEntity(_0x49bd17,null))[_0x80a6('0x43')](handleError(_0x49bd17,null));}; \ No newline at end of file +var _0x76e0=['then','destroy','error','stack','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','hasOwnProperty','order','sort','where','filters','filter','merge','options','includeAll','include','rows','show','fields','length','find','catch','update','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x76e0,0x18d));var _0x076e=function(_0x8a98cf,_0x586327){_0x8a98cf=_0x8a98cf-0x0;var _0x83afe9=_0x76e0[_0x8a98cf];return _0x83afe9;};'use strict';var pdf=require(_0x076e('0x0'));var emlformat=require(_0x076e('0x1'));var rimraf=require(_0x076e('0x2'));var zipdir=require(_0x076e('0x3'));var jsonpatch=require(_0x076e('0x4'));var rp=require(_0x076e('0x5'));var moment=require(_0x076e('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x076e('0x7'));var util=require(_0x076e('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x076e('0x9'));var ejs=require(_0x076e('0xa'));var fs=require('fs');var _=require(_0x076e('0xb'));var squel=require(_0x076e('0xc'));var crypto=require('crypto');var jsforce=require(_0x076e('0xd'));var deskjs=require(_0x076e('0xe'));var toCsv=require(_0x076e('0x9'));var querystring=require(_0x076e('0xf'));var Papa=require(_0x076e('0x10'));var Redis=require('ioredis');var authService=require(_0x076e('0x11'));var qs=require(_0x076e('0x12'));var as=require(_0x076e('0x13'));var hardwareService=require(_0x076e('0x14'));var logger=require(_0x076e('0x15'))(_0x076e('0x16'));var utils=require('../../config/utils');var config=require(_0x076e('0x17'));var db=require(_0x076e('0x18'))['db'];function respondWithStatusCode(_0x37229a,_0x5eddb9){_0x5eddb9=_0x5eddb9||0xcc;return function(_0xbe7764){if(_0xbe7764){return _0x37229a[_0x076e('0x19')](_0x5eddb9);}return _0x37229a[_0x076e('0x1a')](_0x5eddb9)[_0x076e('0x1b')]();};}function respondWithResult(_0x880bb,_0x5377b3){_0x5377b3=_0x5377b3||0xc8;return function(_0x358465){if(_0x358465){return _0x880bb[_0x076e('0x1a')](_0x5377b3)[_0x076e('0x1c')](_0x358465);}};}function respondWithFilteredResult(_0x1464a5,_0x5486cd){return function(_0x212796){if(_0x212796){var _0x488bca=_0x212796[_0x076e('0x1d')],_0x1f41d7=_0x5486cd[_0x076e('0x1e')],_0x502f94=_0x5486cd[_0x076e('0x1e')]+_0x5486cd[_0x076e('0x1f')],_0x1b35ee;if(_0x502f94>=_0x488bca){_0x502f94=_0x488bca;_0x1b35ee=0xc8;}else{_0x1b35ee=0xce;}_0x1464a5[_0x076e('0x1a')](_0x1b35ee);return _0x1464a5[_0x076e('0x20')]('Content-Range',_0x1f41d7+'-'+_0x502f94+'/'+_0x488bca)[_0x076e('0x1c')](_0x212796);}return null;};}function patchUpdates(_0x310ff9){return function(_0x2ac6a6){try{jsonpatch[_0x076e('0x21')](_0x2ac6a6,_0x310ff9,!![]);}catch(_0x5e606e){return BPromise['reject'](_0x5e606e);}return _0x2ac6a6[_0x076e('0x22')]();};}function saveUpdates(_0x38c150,_0x5262e9){return function(_0x1235d2){if(_0x1235d2){return _0x1235d2['update'](_0x38c150)[_0x076e('0x23')](function(_0x410693){return _0x410693;});}return null;};}function removeEntity(_0x576797,_0x3245db){return function(_0x4a334b){if(_0x4a334b){return _0x4a334b[_0x076e('0x24')]()[_0x076e('0x23')](function(){_0x576797[_0x076e('0x1a')](0xcc)[_0x076e('0x1b')]();});}};}function handleEntityNotFound(_0xc6ff70,_0x5ef7c){return function(_0x212c57){if(!_0x212c57){_0xc6ff70[_0x076e('0x19')](0x194);}return _0x212c57;};}function handleError(_0x6d5f00,_0x51a116){_0x51a116=_0x51a116||0x1f4;return function(_0x4f2665){logger[_0x076e('0x25')](_0x4f2665[_0x076e('0x26')]);if(_0x4f2665['name']){delete _0x4f2665['name'];}_0x6d5f00[_0x076e('0x1a')](_0x51a116)[_0x076e('0x27')](_0x4f2665);};}exports[_0x076e('0x28')]=function(_0x4ca718,_0x50da4d){var _0xacdaa2={},_0x4ce6b9={},_0x1dcef0={'count':0x0,'rows':[]};var _0x5f312d=_[_0x076e('0x29')](db[_0x076e('0x2a')][_0x076e('0x2b')],function(_0x22fc82){return{'name':_0x22fc82[_0x076e('0x2c')],'type':_0x22fc82[_0x076e('0x2d')][_0x076e('0x2e')]};});_0x4ce6b9[_0x076e('0x2f')]=_['map'](_0x5f312d,_0x076e('0x30'));_0x4ce6b9[_0x076e('0x31')]=_[_0x076e('0x32')](_0x4ca718[_0x076e('0x31')]);_0x4ce6b9['filters']=_[_0x076e('0x33')](_0x4ce6b9[_0x076e('0x2f')],_0x4ce6b9['query']);_0xacdaa2['attributes']=_[_0x076e('0x33')](_0x4ce6b9['model'],qs['fields'](_0x4ca718['query']['fields']));_0xacdaa2[_0x076e('0x34')]=_0xacdaa2[_0x076e('0x34')]['length']?_0xacdaa2[_0x076e('0x34')]:_0x4ce6b9['model'];if(!_0x4ca718['query'][_0x076e('0x35')]('nolimit')){_0xacdaa2['limit']=qs['limit'](_0x4ca718[_0x076e('0x31')][_0x076e('0x1f')]);_0xacdaa2['offset']=qs[_0x076e('0x1e')](_0x4ca718[_0x076e('0x31')][_0x076e('0x1e')]);}_0xacdaa2[_0x076e('0x36')]=qs[_0x076e('0x37')](_0x4ca718[_0x076e('0x31')][_0x076e('0x37')]);_0xacdaa2[_0x076e('0x38')]=qs[_0x076e('0x39')](_['pick'](_0x4ca718['query'],_0x4ce6b9[_0x076e('0x39')]),_0x5f312d);if(_0x4ca718[_0x076e('0x31')][_0x076e('0x3a')]){_0xacdaa2[_0x076e('0x38')]=_[_0x076e('0x3b')](_0xacdaa2[_0x076e('0x38')],{'$or':_['map'](_0x5f312d,function(_0x15c91b){if(_0x15c91b[_0x076e('0x2d')]!=='VIRTUAL'){var _0x22c400={};_0x22c400[_0x15c91b['name']]={'$like':'%'+_0x4ca718['query'][_0x076e('0x3a')]+'%'};return _0x22c400;}})});}_0xacdaa2=_[_0x076e('0x3b')]({},_0xacdaa2,_0x4ca718[_0x076e('0x3c')]);var _0x197013={'where':_0xacdaa2[_0x076e('0x38')]};return db[_0x076e('0x2a')][_0x076e('0x1d')](_0x197013)[_0x076e('0x23')](function(_0x267a34){_0x1dcef0[_0x076e('0x1d')]=_0x267a34;if(_0x4ca718[_0x076e('0x31')][_0x076e('0x3d')]){_0xacdaa2[_0x076e('0x3e')]=[{'all':!![]}];}return db[_0x076e('0x2a')]['findAll'](_0xacdaa2);})['then'](function(_0x47dc69){_0x1dcef0[_0x076e('0x3f')]=_0x47dc69;return _0x1dcef0;})['then'](respondWithFilteredResult(_0x50da4d,_0xacdaa2))['catch'](handleError(_0x50da4d,null));};exports[_0x076e('0x40')]=function(_0x1dc777,_0xf8ddeb){var _0x292346={'raw':!![],'where':{'id':_0x1dc777['params']['id']}},_0x316242={};_0x316242[_0x076e('0x2f')]=_[_0x076e('0x32')](db['MailServerOut']['rawAttributes']);_0x316242['query']=_[_0x076e('0x32')](_0x1dc777[_0x076e('0x31')]);_0x316242['filters']=_[_0x076e('0x33')](_0x316242[_0x076e('0x2f')],_0x316242[_0x076e('0x31')]);_0x292346[_0x076e('0x34')]=_[_0x076e('0x33')](_0x316242[_0x076e('0x2f')],qs[_0x076e('0x41')](_0x1dc777[_0x076e('0x31')][_0x076e('0x41')]));_0x292346[_0x076e('0x34')]=_0x292346['attributes'][_0x076e('0x42')]?_0x292346[_0x076e('0x34')]:_0x316242[_0x076e('0x2f')];if(_0x1dc777[_0x076e('0x31')]['includeAll']){_0x292346['include']=[{'all':!![]}];}_0x292346=_['merge']({},_0x292346,_0x1dc777[_0x076e('0x3c')]);return db[_0x076e('0x2a')][_0x076e('0x43')](_0x292346)[_0x076e('0x23')](handleEntityNotFound(_0xf8ddeb,null))['then'](respondWithResult(_0xf8ddeb,null))[_0x076e('0x44')](handleError(_0xf8ddeb,null));};exports['create']=function(_0x432811,_0x242619){return db[_0x076e('0x2a')]['create'](_0x432811['body'],{})[_0x076e('0x23')](respondWithResult(_0x242619,0xc9))['catch'](handleError(_0x242619,null));};exports[_0x076e('0x45')]=function(_0x537534,_0xb9773b){if(_0x537534[_0x076e('0x46')]['id']){delete _0x537534[_0x076e('0x46')]['id'];}return db[_0x076e('0x2a')][_0x076e('0x43')]({'where':{'id':_0x537534[_0x076e('0x47')]['id']}})[_0x076e('0x23')](handleEntityNotFound(_0xb9773b,null))[_0x076e('0x23')](saveUpdates(_0x537534['body'],null))['then'](respondWithResult(_0xb9773b,null))[_0x076e('0x44')](handleError(_0xb9773b,null));};exports['destroy']=function(_0x1674f7,_0x315476){return db['MailServerOut']['find']({'where':{'id':_0x1674f7[_0x076e('0x47')]['id']}})['then'](handleEntityNotFound(_0x315476,null))[_0x076e('0x23')](removeEntity(_0x315476,null))[_0x076e('0x44')](handleError(_0x315476,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index ec8b3d6..cdf8752 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 _0x864c=['../../config/environment','./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','lodash','util','api','moment','bluebird','request-promise'];(function(_0x54ed53,_0x4855cf){var _0x597cf4=function(_0x52f62b){while(--_0x52f62b){_0x54ed53['push'](_0x54ed53['shift']());}};_0x597cf4(++_0x4855cf);}(_0x864c,0xcb));var _0xc864=function(_0x1f5fe0,_0x3648c0){_0x1f5fe0=_0x1f5fe0-0x0;var _0x513fda=_0x864c[_0x1f5fe0];return _0x513fda;};'use strict';var _=require(_0xc864('0x0'));var util=require(_0xc864('0x1'));var logger=require('../../config/logger')(_0xc864('0x2'));var moment=require(_0xc864('0x3'));var BPromise=require(_0xc864('0x4'));var rp=require(_0xc864('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc864('0x6'));var attributes=require(_0xc864('0x7'));module[_0xc864('0x8')]=function(_0x4b37f1,_0x357aff){return _0x4b37f1['define'](_0xc864('0x9'),attributes,{'tableName':_0xc864('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x650c=['MailServerOut','mail_servers_out','lodash','util','../../config/logger','bluebird','../../config/environment','./mailServerOut.attributes','exports','define'];(function(_0x3103c6,_0x1b1761){var _0x3a0225=function(_0x1d2fa8){while(--_0x1d2fa8){_0x3103c6['push'](_0x3103c6['shift']());}};_0x3a0225(++_0x1b1761);}(_0x650c,0x98));var _0xc650=function(_0x4a56a5,_0xdec7bc){_0x4a56a5=_0x4a56a5-0x0;var _0x12b40e=_0x650c[_0x4a56a5];return _0x12b40e;};'use strict';var _=require(_0xc650('0x0'));var util=require(_0xc650('0x1'));var logger=require(_0xc650('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc650('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc650('0x4'));var attributes=require(_0xc650('0x5'));module[_0xc650('0x6')]=function(_0x31c6e0,_0x1e8b28){return _0x31c6e0[_0xc650('0x7')](_0xc650('0x8'),attributes,{'tableName':_0xc650('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index d1bc783..4b2c6af 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 _0x81ab=['../../config/utils','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','MailServerOut,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0xc036bb,_0x5cab81){var _0x523ab9=function(_0x2eed72){while(--_0x2eed72){_0xc036bb['push'](_0xc036bb['shift']());}};_0x523ab9(++_0x5cab81);}(_0x81ab,0xeb));var _0xb81a=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0x81ab[_0x4bc65f];return _0x44f85f;};'use strict';var _=require('lodash');var util=require(_0xb81a('0x0'));var moment=require(_0xb81a('0x1'));var BPromise=require(_0xb81a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb81a('0x3'));var db=require(_0xb81a('0x4'))['db'];var utils=require(_0xb81a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb81a('0x6'));var jayson=require(_0xb81a('0x7'));var client=jayson[_0xb81a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x111f1a,_0x308b9e,_0x245511){return new BPromise(function(_0x1ad2e8,_0xfca5f0){return client[_0xb81a('0x9')](_0x111f1a,_0x245511)[_0xb81a('0xa')](function(_0x3f4c1c){logger[_0xb81a('0xb')]('MailServerOut,\x20%s,\x20%s',_0x308b9e,_0xb81a('0xc'));logger[_0xb81a('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x308b9e,_0xb81a('0xc'),JSON[_0xb81a('0xe')](_0x3f4c1c));if(_0x3f4c1c[_0xb81a('0xf')]){if(_0x3f4c1c[_0xb81a('0xf')]['code']===0x1f4){logger['error'](_0xb81a('0x10'),_0x308b9e,_0x3f4c1c[_0xb81a('0xf')][_0xb81a('0x11')]);return _0xfca5f0(_0x3f4c1c[_0xb81a('0xf')]['message']);}logger[_0xb81a('0xf')]('MailServerOut,\x20%s,\x20%s',_0x308b9e,_0x3f4c1c[_0xb81a('0xf')][_0xb81a('0x11')]);return _0x1ad2e8(_0x3f4c1c[_0xb81a('0xf')]['message']);}else{logger[_0xb81a('0xb')](_0xb81a('0x10'),_0x308b9e,_0xb81a('0xc'));_0x1ad2e8(_0x3f4c1c[_0xb81a('0x12')][_0xb81a('0x11')]);}})[_0xb81a('0x13')](function(_0x335e2b){logger[_0xb81a('0xf')]('MailServerOut,\x20%s,\x20%s',_0x308b9e,_0x335e2b);_0xfca5f0(_0x335e2b);});});} \ No newline at end of file +var _0x5049=['debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent'];(function(_0x1ad256,_0x2ccaea){var _0xe1aade=function(_0x1b117d){while(--_0x1b117d){_0x1ad256['push'](_0x1ad256['shift']());}};_0xe1aade(++_0x2ccaea);}(_0x5049,0xf9));var _0x9504=function(_0x4082ab,_0xe15f7b){_0x4082ab=_0x4082ab-0x0;var _0x2286a9=_0x5049[_0x4082ab];return _0x2286a9;};'use strict';var _=require(_0x9504('0x0'));var util=require(_0x9504('0x1'));var moment=require('moment');var BPromise=require(_0x9504('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9504('0x3'));var db=require(_0x9504('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9504('0x5'))(_0x9504('0x6'));var config=require(_0x9504('0x7'));var jayson=require(_0x9504('0x8'));var client=jayson[_0x9504('0x9')][_0x9504('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd66a33,_0x1fdfe9,_0x269989){return new BPromise(function(_0x9e5ced,_0x28a5dc){return client['request'](_0xd66a33,_0x269989)[_0x9504('0xb')](function(_0x49ebb0){logger[_0x9504('0xc')](_0x9504('0xd'),_0x1fdfe9,_0x9504('0xe'));logger[_0x9504('0xf')](_0x9504('0x10'),_0x1fdfe9,'request\x20sent',JSON[_0x9504('0x11')](_0x49ebb0));if(_0x49ebb0[_0x9504('0x12')]){if(_0x49ebb0[_0x9504('0x12')][_0x9504('0x13')]===0x1f4){logger[_0x9504('0x12')]('MailServerOut,\x20%s,\x20%s',_0x1fdfe9,_0x49ebb0[_0x9504('0x12')][_0x9504('0x14')]);return _0x28a5dc(_0x49ebb0['error']['message']);}logger[_0x9504('0x12')](_0x9504('0xd'),_0x1fdfe9,_0x49ebb0[_0x9504('0x12')]['message']);return _0x9e5ced(_0x49ebb0['error']['message']);}else{logger[_0x9504('0xc')](_0x9504('0xd'),_0x1fdfe9,'request\x20sent');_0x9e5ced(_0x49ebb0['result']['message']);}})[_0x9504('0x15')](function(_0x4e0748){logger[_0x9504('0x12')]('MailServerOut,\x20%s,\x20%s',_0x1fdfe9,_0x4e0748);_0x28a5dc(_0x4e0748);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 61e924e..63f22b6 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 _0x87d0=['show','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x5b4cb5,_0x3ac152){var _0xedb02f=function(_0x21149a){while(--_0x21149a){_0x5b4cb5['push'](_0x5b4cb5['shift']());}};_0xedb02f(++_0x3ac152);}(_0x87d0,0x113));var _0x087d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x87d0[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x087d('0x0'));var util=require(_0x087d('0x1'));var path=require(_0x087d('0x2'));var timeout=require(_0x087d('0x3'));var express=require(_0x087d('0x4'));var router=express['Router']();var auth=require(_0x087d('0x5'));var interaction=require(_0x087d('0x6'));var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router[_0x087d('0x7')]('/',auth[_0x087d('0x8')](),controller[_0x087d('0x9')]);router[_0x087d('0x7')](_0x087d('0xa'),auth[_0x087d('0x8')](),controller[_0x087d('0xb')]);router[_0x087d('0x7')](_0x087d('0xc'),auth[_0x087d('0x8')](),controller[_0x087d('0xd')]);router['post']('/',auth[_0x087d('0x8')](),controller['create']);router[_0x087d('0xe')]('/:id',auth[_0x087d('0x8')](),controller[_0x087d('0xf')]);router['delete'](_0x087d('0xc'),auth[_0x087d('0x8')](),controller[_0x087d('0x10')]);module[_0x087d('0x11')]=router; \ No newline at end of file +var _0x72e5=['index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated'];(function(_0x5494d7,_0x41b14f){var _0x4c26bb=function(_0x176e69){while(--_0x176e69){_0x5494d7['push'](_0x5494d7['shift']());}};_0x4c26bb(++_0x41b14f);}(_0x72e5,0x146));var _0x572e=function(_0xe5f89b,_0x3d0d86){_0xe5f89b=_0xe5f89b-0x0;var _0x5a2b24=_0x72e5[_0xe5f89b];return _0x5a2b24;};'use strict';var multer=require('multer');var util=require(_0x572e('0x0'));var path=require(_0x572e('0x1'));var timeout=require(_0x572e('0x2'));var express=require(_0x572e('0x3'));var router=express['Router']();var auth=require(_0x572e('0x4'));var interaction=require(_0x572e('0x5'));var config=require(_0x572e('0x6'));var controller=require(_0x572e('0x7'));router[_0x572e('0x8')]('/',auth[_0x572e('0x9')](),controller[_0x572e('0xa')]);router['get'](_0x572e('0xb'),auth[_0x572e('0x9')](),controller[_0x572e('0xc')]);router[_0x572e('0x8')](_0x572e('0xd'),auth[_0x572e('0x9')](),controller[_0x572e('0xe')]);router[_0x572e('0xf')]('/',auth['isAuthenticated'](),controller[_0x572e('0x10')]);router[_0x572e('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x572e('0x12')]('/:id',auth[_0x572e('0x9')](),controller[_0x572e('0x13')]);module[_0x572e('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 7bd08e5..e619051 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 _0x07e8=['STRING','sequelize','exports'];(function(_0x27e01a,_0x437b42){var _0x2c1a7b=function(_0x1080e2){while(--_0x1080e2){_0x27e01a['push'](_0x27e01a['shift']());}};_0x2c1a7b(++_0x437b42);}(_0x07e8,0x10f));var _0x807e=function(_0xc2a08a,_0x5c44e9){_0xc2a08a=_0xc2a08a-0x0;var _0x400d5a=_0x07e8[_0xc2a08a];return _0x400d5a;};'use strict';var Sequelize=require(_0x807e('0x0'));module[_0x807e('0x1')]={'name':{'type':Sequelize[_0x807e('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x807e('0x2')]}}; \ No newline at end of file +var _0x1228=['STRING','sequelize'];(function(_0x20cd17,_0x3cc383){var _0x5d1134=function(_0x573fc7){while(--_0x573fc7){_0x20cd17['push'](_0x20cd17['shift']());}};_0x5d1134(++_0x3cc383);}(_0x1228,0x12f));var _0x8122=function(_0x5b7433,_0x300e84){_0x5b7433=_0x5b7433-0x0;var _0x54aa9f=_0x1228[_0x5b7433];return _0x54aa9f;};'use strict';var Sequelize=require(_0x8122('0x0'));module['exports']={'name':{'type':Sequelize[_0x8122('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8122('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 6b31e34..df16113 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 _0xe059=['eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','reject','save','update','then','name','send','index','map','fieldName','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','MailSubstatus','count','include','rows','catch','show','rawAttributes','includeAll','find','create','body','params','describe','html-pdf'];(function(_0x119aec,_0x44e7d3){var _0x4d77d3=function(_0x3d7c7f){while(--_0x3d7c7f){_0x119aec['push'](_0x119aec['shift']());}};_0x4d77d3(++_0x44e7d3);}(_0xe059,0x1a9));var _0x9e05=function(_0x401701,_0x149dce){_0x401701=_0x401701-0x0;var _0x3da178=_0xe059[_0x401701];return _0x3da178;};'use strict';var pdf=require(_0x9e05('0x0'));var emlformat=require(_0x9e05('0x1'));var rimraf=require(_0x9e05('0x2'));var zipdir=require(_0x9e05('0x3'));var jsonpatch=require(_0x9e05('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9e05('0x5'));var Mustache=require('mustache');var util=require(_0x9e05('0x6'));var path=require(_0x9e05('0x7'));var sox=require(_0x9e05('0x8'));var csv=require(_0x9e05('0x9'));var ejs=require(_0x9e05('0xa'));var fs=require('fs');var _=require(_0x9e05('0xb'));var squel=require(_0x9e05('0xc'));var crypto=require(_0x9e05('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9e05('0xe'));var toCsv=require(_0x9e05('0x9'));var querystring=require(_0x9e05('0xf'));var Papa=require('papaparse');var Redis=require(_0x9e05('0x10'));var authService=require(_0x9e05('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9e05('0x12'));var hardwareService=require(_0x9e05('0x13'));var logger=require(_0x9e05('0x14'))(_0x9e05('0x15'));var utils=require(_0x9e05('0x16'));var config=require(_0x9e05('0x17'));var db=require(_0x9e05('0x18'))['db'];function respondWithStatusCode(_0x10b886,_0xd02ef6){_0xd02ef6=_0xd02ef6||0xcc;return function(_0x2ab973){if(_0x2ab973){return _0x10b886[_0x9e05('0x19')](_0xd02ef6);}return _0x10b886[_0x9e05('0x1a')](_0xd02ef6)[_0x9e05('0x1b')]();};}function respondWithResult(_0x50d90a,_0x24410c){_0x24410c=_0x24410c||0xc8;return function(_0x35ec7b){if(_0x35ec7b){return _0x50d90a[_0x9e05('0x1a')](_0x24410c)[_0x9e05('0x1c')](_0x35ec7b);}};}function respondWithFilteredResult(_0x4186c1,_0x18f3ff){return function(_0x2e1e3e){if(_0x2e1e3e){var _0x10998c=_0x2e1e3e['count'],_0x2cee46=_0x18f3ff[_0x9e05('0x1d')],_0x475955=_0x18f3ff[_0x9e05('0x1d')]+_0x18f3ff[_0x9e05('0x1e')],_0x45ee75;if(_0x475955>=_0x10998c){_0x475955=_0x10998c;_0x45ee75=0xc8;}else{_0x45ee75=0xce;}_0x4186c1['status'](_0x45ee75);return _0x4186c1['set']('Content-Range',_0x2cee46+'-'+_0x475955+'/'+_0x10998c)[_0x9e05('0x1c')](_0x2e1e3e);}return null;};}function patchUpdates(_0x36d62c){return function(_0xe329f){try{jsonpatch[_0x9e05('0x1f')](_0xe329f,_0x36d62c,!![]);}catch(_0x3a328d){return BPromise[_0x9e05('0x20')](_0x3a328d);}return _0xe329f[_0x9e05('0x21')]();};}function saveUpdates(_0x13ef2a,_0x58fe2a){return function(_0x483c2a){if(_0x483c2a){return _0x483c2a[_0x9e05('0x22')](_0x13ef2a)[_0x9e05('0x23')](function(_0x4a55dd){return _0x4a55dd;});}return null;};}function removeEntity(_0xbddca,_0x2076f9){return function(_0x2f234a){if(_0x2f234a){return _0x2f234a['destroy']()[_0x9e05('0x23')](function(){_0xbddca[_0x9e05('0x1a')](0xcc)[_0x9e05('0x1b')]();});}};}function handleEntityNotFound(_0x112b61,_0x4cbeed){return function(_0x2de7a6){if(!_0x2de7a6){_0x112b61['sendStatus'](0x194);}return _0x2de7a6;};}function handleError(_0x25eae8,_0x52c501){_0x52c501=_0x52c501||0x1f4;return function(_0x461a22){logger['error'](_0x461a22['stack']);if(_0x461a22[_0x9e05('0x24')]){delete _0x461a22[_0x9e05('0x24')];}_0x25eae8['status'](_0x52c501)[_0x9e05('0x25')](_0x461a22);};}exports[_0x9e05('0x26')]=function(_0x29edfd,_0x39b4fe){var _0x531ebe={},_0x361ba2={},_0x20c1c3={'count':0x0,'rows':[]};var _0x579193=_[_0x9e05('0x27')](db['MailSubstatus']['rawAttributes'],function(_0x2630fe){return{'name':_0x2630fe[_0x9e05('0x28')],'type':_0x2630fe['type']['key']};});_0x361ba2[_0x9e05('0x29')]=_[_0x9e05('0x27')](_0x579193,'name');_0x361ba2['query']=_[_0x9e05('0x2a')](_0x29edfd['query']);_0x361ba2['filters']=_['intersection'](_0x361ba2[_0x9e05('0x29')],_0x361ba2[_0x9e05('0x2b')]);_0x531ebe[_0x9e05('0x2c')]=_[_0x9e05('0x2d')](_0x361ba2[_0x9e05('0x29')],qs[_0x9e05('0x2e')](_0x29edfd[_0x9e05('0x2b')]['fields']));_0x531ebe[_0x9e05('0x2c')]=_0x531ebe[_0x9e05('0x2c')][_0x9e05('0x2f')]?_0x531ebe[_0x9e05('0x2c')]:_0x361ba2[_0x9e05('0x29')];if(!_0x29edfd[_0x9e05('0x2b')][_0x9e05('0x30')]('nolimit')){_0x531ebe[_0x9e05('0x1e')]=qs[_0x9e05('0x1e')](_0x29edfd[_0x9e05('0x2b')][_0x9e05('0x1e')]);_0x531ebe[_0x9e05('0x1d')]=qs[_0x9e05('0x1d')](_0x29edfd['query'][_0x9e05('0x1d')]);}_0x531ebe['order']=qs[_0x9e05('0x31')](_0x29edfd[_0x9e05('0x2b')]['sort']);_0x531ebe[_0x9e05('0x32')]=qs[_0x9e05('0x33')](_[_0x9e05('0x34')](_0x29edfd['query'],_0x361ba2[_0x9e05('0x33')]),_0x579193);if(_0x29edfd[_0x9e05('0x2b')]['filter']){_0x531ebe[_0x9e05('0x32')]=_[_0x9e05('0x35')](_0x531ebe[_0x9e05('0x32')],{'$or':_[_0x9e05('0x27')](_0x579193,function(_0xb69840){if(_0xb69840[_0x9e05('0x36')]!==_0x9e05('0x37')){var _0x408d18={};_0x408d18[_0xb69840[_0x9e05('0x24')]]={'$like':'%'+_0x29edfd[_0x9e05('0x2b')][_0x9e05('0x38')]+'%'};return _0x408d18;}})});}_0x531ebe=_[_0x9e05('0x35')]({},_0x531ebe,_0x29edfd[_0x9e05('0x39')]);var _0x5d24fd={'where':_0x531ebe[_0x9e05('0x32')]};return db[_0x9e05('0x3a')][_0x9e05('0x3b')](_0x5d24fd)[_0x9e05('0x23')](function(_0x1c956e){_0x20c1c3['count']=_0x1c956e;if(_0x29edfd[_0x9e05('0x2b')]['includeAll']){_0x531ebe[_0x9e05('0x3c')]=[{'all':!![]}];}return db[_0x9e05('0x3a')]['findAll'](_0x531ebe);})[_0x9e05('0x23')](function(_0x1b9661){_0x20c1c3[_0x9e05('0x3d')]=_0x1b9661;return _0x20c1c3;})['then'](respondWithFilteredResult(_0x39b4fe,_0x531ebe))[_0x9e05('0x3e')](handleError(_0x39b4fe,null));};exports[_0x9e05('0x3f')]=function(_0x24f818,_0x1c3170){var _0x16dc50={'raw':!![],'where':{'id':_0x24f818['params']['id']}},_0xb1101a={};_0xb1101a[_0x9e05('0x29')]=_['keys'](db['MailSubstatus'][_0x9e05('0x40')]);_0xb1101a[_0x9e05('0x2b')]=_[_0x9e05('0x2a')](_0x24f818[_0x9e05('0x2b')]);_0xb1101a[_0x9e05('0x33')]=_[_0x9e05('0x2d')](_0xb1101a[_0x9e05('0x29')],_0xb1101a['query']);_0x16dc50[_0x9e05('0x2c')]=_['intersection'](_0xb1101a[_0x9e05('0x29')],qs[_0x9e05('0x2e')](_0x24f818[_0x9e05('0x2b')][_0x9e05('0x2e')]));_0x16dc50[_0x9e05('0x2c')]=_0x16dc50[_0x9e05('0x2c')][_0x9e05('0x2f')]?_0x16dc50[_0x9e05('0x2c')]:_0xb1101a[_0x9e05('0x29')];if(_0x24f818[_0x9e05('0x2b')][_0x9e05('0x41')]){_0x16dc50[_0x9e05('0x3c')]=[{'all':!![]}];}_0x16dc50=_[_0x9e05('0x35')]({},_0x16dc50,_0x24f818[_0x9e05('0x39')]);return db['MailSubstatus'][_0x9e05('0x42')](_0x16dc50)['then'](handleEntityNotFound(_0x1c3170,null))[_0x9e05('0x23')](respondWithResult(_0x1c3170,null))[_0x9e05('0x3e')](handleError(_0x1c3170,null));};exports[_0x9e05('0x43')]=function(_0x59f54a,_0x3fa4c3){return db[_0x9e05('0x3a')][_0x9e05('0x43')](_0x59f54a['body'],{})[_0x9e05('0x23')](respondWithResult(_0x3fa4c3,0xc9))[_0x9e05('0x3e')](handleError(_0x3fa4c3,null));};exports[_0x9e05('0x22')]=function(_0x37cc7a,_0x3b6702){if(_0x37cc7a[_0x9e05('0x44')]['id']){delete _0x37cc7a[_0x9e05('0x44')]['id'];}return db[_0x9e05('0x3a')][_0x9e05('0x42')]({'where':{'id':_0x37cc7a[_0x9e05('0x45')]['id']}})[_0x9e05('0x23')](handleEntityNotFound(_0x3b6702,null))[_0x9e05('0x23')](saveUpdates(_0x37cc7a[_0x9e05('0x44')],null))['then'](respondWithResult(_0x3b6702,null))[_0x9e05('0x3e')](handleError(_0x3b6702,null));};exports['destroy']=function(_0x542ec2,_0x321660){return db['MailSubstatus'][_0x9e05('0x42')]({'where':{'id':_0x542ec2['params']['id']}})[_0x9e05('0x23')](handleEntityNotFound(_0x321660,null))[_0x9e05('0x23')](removeEntity(_0x321660,null))['catch'](handleError(_0x321660,null));};exports[_0x9e05('0x46')]=function(_0x4d86b7,_0x6ac6df){return db['MailSubstatus']['describe']()[_0x9e05('0x23')](respondWithResult(_0x6ac6df,null))[_0x9e05('0x3e')](handleError(_0x6ac6df,null));}; \ No newline at end of file +var _0xb19a=['squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','create','body','find','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash'];(function(_0x557ffb,_0x19f752){var _0x10bd59=function(_0x26f5bf){while(--_0x26f5bf){_0x557ffb['push'](_0x557ffb['shift']());}};_0x10bd59(++_0x19f752);}(_0xb19a,0x11d));var _0xab19=function(_0x30ec23,_0x146fee){_0x30ec23=_0x30ec23-0x0;var _0x4a85cd=_0xb19a[_0x30ec23];return _0x4a85cd;};'use strict';var pdf=require(_0xab19('0x0'));var emlformat=require(_0xab19('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xab19('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab19('0x3'));var moment=require(_0xab19('0x4'));var BPromise=require(_0xab19('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xab19('0x6'));var sox=require(_0xab19('0x7'));var csv=require(_0xab19('0x8'));var ejs=require(_0xab19('0x9'));var fs=require('fs');var _=require(_0xab19('0xa'));var squel=require(_0xab19('0xb'));var crypto=require(_0xab19('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xab19('0xd'));var toCsv=require('to-csv');var querystring=require(_0xab19('0xe'));var Papa=require('papaparse');var Redis=require(_0xab19('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xab19('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab19('0x11'));var logger=require(_0xab19('0x12'))(_0xab19('0x13'));var utils=require(_0xab19('0x14'));var config=require(_0xab19('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a619c,_0x35722f){_0x35722f=_0x35722f||0xcc;return function(_0x1502ec){if(_0x1502ec){return _0x1a619c[_0xab19('0x16')](_0x35722f);}return _0x1a619c['status'](_0x35722f)[_0xab19('0x17')]();};}function respondWithResult(_0xb871af,_0x5c6321){_0x5c6321=_0x5c6321||0xc8;return function(_0x2f59d9){if(_0x2f59d9){return _0xb871af[_0xab19('0x18')](_0x5c6321)[_0xab19('0x19')](_0x2f59d9);}};}function respondWithFilteredResult(_0x335120,_0x31db0f){return function(_0x5d09c1){if(_0x5d09c1){var _0x50ff64=_0x5d09c1[_0xab19('0x1a')],_0x326432=_0x31db0f[_0xab19('0x1b')],_0x20d063=_0x31db0f[_0xab19('0x1b')]+_0x31db0f[_0xab19('0x1c')],_0x329587;if(_0x20d063>=_0x50ff64){_0x20d063=_0x50ff64;_0x329587=0xc8;}else{_0x329587=0xce;}_0x335120[_0xab19('0x18')](_0x329587);return _0x335120['set'](_0xab19('0x1d'),_0x326432+'-'+_0x20d063+'/'+_0x50ff64)[_0xab19('0x19')](_0x5d09c1);}return null;};}function patchUpdates(_0x4703cc){return function(_0x556b8e){try{jsonpatch[_0xab19('0x1e')](_0x556b8e,_0x4703cc,!![]);}catch(_0x13f212){return BPromise[_0xab19('0x1f')](_0x13f212);}return _0x556b8e[_0xab19('0x20')]();};}function saveUpdates(_0x5e457b,_0x55890f){return function(_0x1e0da6){if(_0x1e0da6){return _0x1e0da6[_0xab19('0x21')](_0x5e457b)[_0xab19('0x22')](function(_0x4777e2){return _0x4777e2;});}return null;};}function removeEntity(_0x43a3bd,_0x141157){return function(_0x3028df){if(_0x3028df){return _0x3028df[_0xab19('0x23')]()[_0xab19('0x22')](function(){_0x43a3bd['status'](0xcc)[_0xab19('0x17')]();});}};}function handleEntityNotFound(_0x283375,_0x4ed383){return function(_0x4ab83d){if(!_0x4ab83d){_0x283375['sendStatus'](0x194);}return _0x4ab83d;};}function handleError(_0x56553a,_0xcd4ef6){_0xcd4ef6=_0xcd4ef6||0x1f4;return function(_0x119a50){logger[_0xab19('0x24')](_0x119a50[_0xab19('0x25')]);if(_0x119a50[_0xab19('0x26')]){delete _0x119a50[_0xab19('0x26')];}_0x56553a[_0xab19('0x18')](_0xcd4ef6)[_0xab19('0x27')](_0x119a50);};}exports[_0xab19('0x28')]=function(_0x4b6bff,_0x51c471){var _0x1275f1={},_0x1a9077={},_0x456db9={'count':0x0,'rows':[]};var _0x589667=_[_0xab19('0x29')](db[_0xab19('0x2a')][_0xab19('0x2b')],function(_0x5aa143){return{'name':_0x5aa143[_0xab19('0x2c')],'type':_0x5aa143[_0xab19('0x2d')][_0xab19('0x2e')]};});_0x1a9077[_0xab19('0x2f')]=_[_0xab19('0x29')](_0x589667,_0xab19('0x26'));_0x1a9077[_0xab19('0x30')]=_['keys'](_0x4b6bff[_0xab19('0x30')]);_0x1a9077[_0xab19('0x31')]=_[_0xab19('0x32')](_0x1a9077[_0xab19('0x2f')],_0x1a9077[_0xab19('0x30')]);_0x1275f1[_0xab19('0x33')]=_[_0xab19('0x32')](_0x1a9077['model'],qs[_0xab19('0x34')](_0x4b6bff[_0xab19('0x30')][_0xab19('0x34')]));_0x1275f1[_0xab19('0x33')]=_0x1275f1['attributes'][_0xab19('0x35')]?_0x1275f1['attributes']:_0x1a9077[_0xab19('0x2f')];if(!_0x4b6bff[_0xab19('0x30')][_0xab19('0x36')](_0xab19('0x37'))){_0x1275f1[_0xab19('0x1c')]=qs[_0xab19('0x1c')](_0x4b6bff[_0xab19('0x30')][_0xab19('0x1c')]);_0x1275f1[_0xab19('0x1b')]=qs[_0xab19('0x1b')](_0x4b6bff[_0xab19('0x30')][_0xab19('0x1b')]);}_0x1275f1[_0xab19('0x38')]=qs[_0xab19('0x39')](_0x4b6bff[_0xab19('0x30')][_0xab19('0x39')]);_0x1275f1[_0xab19('0x3a')]=qs['filters'](_[_0xab19('0x3b')](_0x4b6bff[_0xab19('0x30')],_0x1a9077[_0xab19('0x31')]),_0x589667);if(_0x4b6bff['query'][_0xab19('0x3c')]){_0x1275f1[_0xab19('0x3a')]=_[_0xab19('0x3d')](_0x1275f1[_0xab19('0x3a')],{'$or':_[_0xab19('0x29')](_0x589667,function(_0x200011){if(_0x200011[_0xab19('0x2d')]!=='VIRTUAL'){var _0xecd029={};_0xecd029[_0x200011[_0xab19('0x26')]]={'$like':'%'+_0x4b6bff[_0xab19('0x30')][_0xab19('0x3c')]+'%'};return _0xecd029;}})});}_0x1275f1=_[_0xab19('0x3d')]({},_0x1275f1,_0x4b6bff[_0xab19('0x3e')]);var _0x141a1d={'where':_0x1275f1[_0xab19('0x3a')]};return db[_0xab19('0x2a')]['count'](_0x141a1d)['then'](function(_0x149edc){_0x456db9[_0xab19('0x1a')]=_0x149edc;if(_0x4b6bff[_0xab19('0x30')][_0xab19('0x3f')]){_0x1275f1[_0xab19('0x40')]=[{'all':!![]}];}return db[_0xab19('0x2a')][_0xab19('0x41')](_0x1275f1);})['then'](function(_0xb03b77){_0x456db9['rows']=_0xb03b77;return _0x456db9;})[_0xab19('0x22')](respondWithFilteredResult(_0x51c471,_0x1275f1))[_0xab19('0x42')](handleError(_0x51c471,null));};exports[_0xab19('0x43')]=function(_0xb8aa4f,_0xe7f2a4){var _0x159d54={'raw':!![],'where':{'id':_0xb8aa4f[_0xab19('0x44')]['id']}},_0x210549={};_0x210549['model']=_[_0xab19('0x45')](db['MailSubstatus'][_0xab19('0x2b')]);_0x210549[_0xab19('0x30')]=_['keys'](_0xb8aa4f['query']);_0x210549[_0xab19('0x31')]=_['intersection'](_0x210549[_0xab19('0x2f')],_0x210549[_0xab19('0x30')]);_0x159d54[_0xab19('0x33')]=_['intersection'](_0x210549['model'],qs[_0xab19('0x34')](_0xb8aa4f['query'][_0xab19('0x34')]));_0x159d54[_0xab19('0x33')]=_0x159d54[_0xab19('0x33')][_0xab19('0x35')]?_0x159d54[_0xab19('0x33')]:_0x210549[_0xab19('0x2f')];if(_0xb8aa4f[_0xab19('0x30')]['includeAll']){_0x159d54[_0xab19('0x40')]=[{'all':!![]}];}_0x159d54=_['merge']({},_0x159d54,_0xb8aa4f[_0xab19('0x3e')]);return db[_0xab19('0x2a')]['find'](_0x159d54)[_0xab19('0x22')](handleEntityNotFound(_0xe7f2a4,null))[_0xab19('0x22')](respondWithResult(_0xe7f2a4,null))['catch'](handleError(_0xe7f2a4,null));};exports[_0xab19('0x46')]=function(_0x3f5398,_0x41058a){return db[_0xab19('0x2a')][_0xab19('0x46')](_0x3f5398[_0xab19('0x47')],{})[_0xab19('0x22')](respondWithResult(_0x41058a,0xc9))[_0xab19('0x42')](handleError(_0x41058a,null));};exports[_0xab19('0x21')]=function(_0x33608a,_0x4d2597){if(_0x33608a[_0xab19('0x47')]['id']){delete _0x33608a['body']['id'];}return db['MailSubstatus'][_0xab19('0x48')]({'where':{'id':_0x33608a[_0xab19('0x44')]['id']}})[_0xab19('0x22')](handleEntityNotFound(_0x4d2597,null))[_0xab19('0x22')](saveUpdates(_0x33608a[_0xab19('0x47')],null))[_0xab19('0x22')](respondWithResult(_0x4d2597,null))['catch'](handleError(_0x4d2597,null));};exports[_0xab19('0x23')]=function(_0x9636db,_0x3d9aed){return db[_0xab19('0x2a')]['find']({'where':{'id':_0x9636db[_0xab19('0x44')]['id']}})['then'](handleEntityNotFound(_0x3d9aed,null))['then'](removeEntity(_0x3d9aed,null))['catch'](handleError(_0x3d9aed,null));};exports['describe']=function(_0x483a02,_0x2df667){return db[_0xab19('0x2a')][_0xab19('0x49')]()[_0xab19('0x22')](respondWithResult(_0x2df667,null))['catch'](handleError(_0x2df667,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 4dd3d33..2444ce9 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 _0x154c=['lodash','moment','bluebird','path','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses'];(function(_0x51b72e,_0x408f4f){var _0xa108e1=function(_0x3d879c){while(--_0x3d879c){_0x51b72e['push'](_0x51b72e['shift']());}};_0xa108e1(++_0x408f4f);}(_0x154c,0x1e0));var _0xc154=function(_0x4f8909,_0x127885){_0x4f8909=_0x4f8909-0x0;var _0x8b66ef=_0x154c[_0x4f8909];return _0x8b66ef;};'use strict';var _=require(_0xc154('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc154('0x1'));var BPromise=require(_0xc154('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc154('0x3'));var rimraf=require('rimraf');var config=require(_0xc154('0x4'));var attributes=require(_0xc154('0x5'));module[_0xc154('0x6')]=function(_0x220ecc,_0x53b388){return _0x220ecc[_0xc154('0x7')](_0xc154('0x8'),attributes,{'tableName':_0xc154('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c65=['bluebird','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus','lodash','util','../../config/logger','api'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0x0c65,0x1a0));var _0x50c6=function(_0x3eb570,_0x489a5a){_0x3eb570=_0x3eb570-0x0;var _0x270bd3=_0x0c65[_0x3eb570];return _0x270bd3;};'use strict';var _=require(_0x50c6('0x0'));var util=require(_0x50c6('0x1'));var logger=require(_0x50c6('0x2'))(_0x50c6('0x3'));var moment=require('moment');var BPromise=require(_0x50c6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x50c6('0x5'));var rimraf=require(_0x50c6('0x6'));var config=require(_0x50c6('0x7'));var attributes=require(_0x50c6('0x8'));module[_0x50c6('0x9')]=function(_0xcfee2c,_0x87e320){return _0xcfee2c[_0x50c6('0xa')](_0x50c6('0xb'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 48047dc..2a61015 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 _0x5ff3=['message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','MailSubstatus,\x20%s,\x20%s'];(function(_0x16c452,_0x294618){var _0x1191f6=function(_0x3650f3){while(--_0x3650f3){_0x16c452['push'](_0x16c452['shift']());}};_0x1191f6(++_0x294618);}(_0x5ff3,0x17d));var _0x35ff=function(_0x3e31eb,_0x3cbba6){_0x3e31eb=_0x3e31eb-0x0;var _0x36fd6f=_0x5ff3[_0x3e31eb];return _0x36fd6f;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var moment=require('moment');var BPromise=require(_0x35ff('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ff('0x2'));var db=require(_0x35ff('0x3'))['db'];var utils=require(_0x35ff('0x4'));var logger=require(_0x35ff('0x5'))('rpc');var config=require(_0x35ff('0x6'));var jayson=require(_0x35ff('0x7'));var client=jayson[_0x35ff('0x8')][_0x35ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30c3ff,_0x495c31,_0x92b403){return new BPromise(function(_0x4c9fab,_0x2e7470){return client[_0x35ff('0xa')](_0x30c3ff,_0x92b403)[_0x35ff('0xb')](function(_0x51967a){logger[_0x35ff('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x495c31,_0x35ff('0xd'));logger[_0x35ff('0xe')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x495c31,'request\x20sent',JSON[_0x35ff('0xf')](_0x51967a));if(_0x51967a['error']){if(_0x51967a['error']['code']===0x1f4){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);return _0x2e7470(_0x51967a['error'][_0x35ff('0x12')]);}logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a['error'][_0x35ff('0x12')]);return _0x4c9fab(_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);}else{logger[_0x35ff('0xc')](_0x35ff('0x11'),_0x495c31,_0x35ff('0xd'));_0x4c9fab(_0x51967a[_0x35ff('0x13')][_0x35ff('0x12')]);}})[_0x35ff('0x14')](function(_0x2f3456){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x2f3456);_0x2e7470(_0x2f3456);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x341acf,_0x3b91cb){var _0x2c3af4=function(_0x2cb792){while(--_0x2cb792){_0x341acf['push'](_0x341acf['shift']());}};_0x2c3af4(++_0x3b91cb);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ed7d1,_0x363741){_0x2ed7d1=_0x2ed7d1-0x0;var _0x38ae3c=_0xcb91[_0x2ed7d1];return _0x38ae3c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index c6cf16c..f72661b 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 _0x1f54=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','/:id','show','post'];(function(_0x4f4bb8,_0x32e15d){var _0xf6e91f=function(_0x2d1fd6){while(--_0x2d1fd6){_0x4f4bb8['push'](_0x4f4bb8['shift']());}};_0xf6e91f(++_0x32e15d);}(_0x1f54,0x147));var _0x41f5=function(_0x4cc03b,_0x299f1c){_0x4cc03b=_0x4cc03b-0x0;var _0xf0358c=_0x1f54[_0x4cc03b];return _0xf0358c;};'use strict';var multer=require(_0x41f5('0x0'));var util=require(_0x41f5('0x1'));var path=require(_0x41f5('0x2'));var timeout=require(_0x41f5('0x3'));var express=require(_0x41f5('0x4'));var router=express[_0x41f5('0x5')]();var auth=require(_0x41f5('0x6'));var interaction=require(_0x41f5('0x7'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0x41f5('0x8')]('/',auth['isAuthenticated'](),controller[_0x41f5('0x9')]);router[_0x41f5('0x8')](_0x41f5('0xa'),auth[_0x41f5('0xb')](),controller['describe']);router['get'](_0x41f5('0xc'),auth[_0x41f5('0xb')](),controller[_0x41f5('0xd')]);router[_0x41f5('0xe')]('/',auth[_0x41f5('0xb')](),controller['create']);router[_0x41f5('0xf')]('/:id',auth[_0x41f5('0xb')](),controller[_0x41f5('0x10')]);router['delete'](_0x41f5('0xc'),auth['isAuthenticated'](),controller[_0x41f5('0x11')]);module[_0x41f5('0x12')]=router; \ No newline at end of file +var _0xf83b=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get'];(function(_0x131016,_0x4bfabe){var _0x2d7dd8=function(_0x19bbcd){while(--_0x19bbcd){_0x131016['push'](_0x131016['shift']());}};_0x2d7dd8(++_0x4bfabe);}(_0xf83b,0x69));var _0xbf83=function(_0x5c0254,_0x213d5c){_0x5c0254=_0x5c0254-0x0;var _0x528897=_0xf83b[_0x5c0254];return _0x528897;};'use strict';var multer=require(_0xbf83('0x0'));var util=require(_0xbf83('0x1'));var path=require('path');var timeout=require(_0xbf83('0x2'));var express=require(_0xbf83('0x3'));var router=express[_0xbf83('0x4')]();var auth=require(_0xbf83('0x5'));var interaction=require(_0xbf83('0x6'));var config=require(_0xbf83('0x7'));var controller=require(_0xbf83('0x8'));router[_0xbf83('0x9')]('/',auth[_0xbf83('0xa')](),controller[_0xbf83('0xb')]);router[_0xbf83('0x9')](_0xbf83('0xc'),auth[_0xbf83('0xa')](),controller[_0xbf83('0xd')]);router[_0xbf83('0x9')](_0xbf83('0xe'),auth[_0xbf83('0xa')](),controller[_0xbf83('0xf')]);router[_0xbf83('0x10')]('/',auth[_0xbf83('0xa')](),controller[_0xbf83('0x11')]);router[_0xbf83('0x12')](_0xbf83('0xe'),auth[_0xbf83('0xa')](),controller[_0xbf83('0x13')]);router[_0xbf83('0x14')](_0xbf83('0xe'),auth['isAuthenticated'](),controller[_0xbf83('0x15')]);module[_0xbf83('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index c01dd81..388ec40 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 _0x0f74=['agent','queue','DATE','moment','sequelize','exports','STRING','account'];(function(_0x166c2a,_0x14882b){var _0x252362=function(_0x3647e5){while(--_0x3647e5){_0x166c2a['push'](_0x166c2a['shift']());}};_0x252362(++_0x14882b);}(_0x0f74,0xc3));var _0x40f7=function(_0xdba10e,_0x5495db){_0xdba10e=_0xdba10e-0x0;var _0x5a0a5c=_0x0f74[_0xdba10e];return _0x5a0a5c;};'use strict';var moment=require(_0x40f7('0x0'));var Sequelize=require(_0x40f7('0x1'));module[_0x40f7('0x2')]={'uniqueid':{'type':Sequelize[_0x40f7('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x40f7('0x4'),_0x40f7('0x5'),'queue'),'allowNull':![],'defaultValue':_0x40f7('0x6')},'transferredAt':{'type':Sequelize[_0x40f7('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xcebe=['queue','DATE','NOW','moment','sequelize','exports','STRING','account'];(function(_0x3515d3,_0x337e82){var _0x148d18=function(_0x6c455){while(--_0x6c455){_0x3515d3['push'](_0x3515d3['shift']());}};_0x148d18(++_0x337e82);}(_0xcebe,0x14b));var _0xeceb=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xcebe[_0x6131cd];return _0x47e916;};'use strict';var moment=require(_0xeceb('0x0'));var Sequelize=require(_0xeceb('0x1'));module[_0xeceb('0x2')]={'uniqueid':{'type':Sequelize[_0xeceb('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xeceb('0x4'),'agent',_0xeceb('0x5')),'allowNull':![],'defaultValue':_0xeceb('0x5')},'transferredAt':{'type':Sequelize[_0xeceb('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xeceb('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 01647a7..47804b9 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 _0xc5e6=['show','params','options','find','create','body','describe','html-pdf','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','catch'];(function(_0x3cbe93,_0x4ae7d2){var _0x3e64b4=function(_0x3f935e){while(--_0x3f935e){_0x3cbe93['push'](_0x3cbe93['shift']());}};_0x3e64b4(++_0x4ae7d2);}(_0xc5e6,0xd3));var _0x6c5e=function(_0x326c47,_0x8dca2){_0x326c47=_0x326c47-0x0;var _0x564786=_0xc5e6[_0x326c47];return _0x564786;};'use strict';var pdf=require(_0x6c5e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6c5e('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x6c5e('0x2'));var util=require(_0x6c5e('0x3'));var path=require(_0x6c5e('0x4'));var sox=require(_0x6c5e('0x5'));var csv=require(_0x6c5e('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6c5e('0x7'));var squel=require('squel');var crypto=require(_0x6c5e('0x8'));var jsforce=require(_0x6c5e('0x9'));var deskjs=require(_0x6c5e('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6c5e('0xb'));var Redis=require(_0x6c5e('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c5e('0xd'));var logger=require('../../config/logger')('api');var utils=require(_0x6c5e('0xe'));var config=require(_0x6c5e('0xf'));var db=require(_0x6c5e('0x10'))['db'];function respondWithStatusCode(_0x10546f,_0x434fce){_0x434fce=_0x434fce||0xcc;return function(_0x37ffc6){if(_0x37ffc6){return _0x10546f['sendStatus'](_0x434fce);}return _0x10546f[_0x6c5e('0x11')](_0x434fce)['end']();};}function respondWithResult(_0x11bdce,_0x1e3118){_0x1e3118=_0x1e3118||0xc8;return function(_0x219bb8){if(_0x219bb8){return _0x11bdce['status'](_0x1e3118)[_0x6c5e('0x12')](_0x219bb8);}};}function respondWithFilteredResult(_0x3bc977,_0x579385){return function(_0x3c8062){if(_0x3c8062){var _0x1ff0ac=_0x3c8062[_0x6c5e('0x13')],_0x558a7d=_0x579385[_0x6c5e('0x14')],_0x3b67d4=_0x579385['offset']+_0x579385[_0x6c5e('0x15')],_0x5dc7ff;if(_0x3b67d4>=_0x1ff0ac){_0x3b67d4=_0x1ff0ac;_0x5dc7ff=0xc8;}else{_0x5dc7ff=0xce;}_0x3bc977[_0x6c5e('0x11')](_0x5dc7ff);return _0x3bc977[_0x6c5e('0x16')](_0x6c5e('0x17'),_0x558a7d+'-'+_0x3b67d4+'/'+_0x1ff0ac)[_0x6c5e('0x12')](_0x3c8062);}return null;};}function patchUpdates(_0x4b2386){return function(_0x2a100e){try{jsonpatch[_0x6c5e('0x18')](_0x2a100e,_0x4b2386,!![]);}catch(_0x3b4d17){return BPromise[_0x6c5e('0x19')](_0x3b4d17);}return _0x2a100e[_0x6c5e('0x1a')]();};}function saveUpdates(_0x5afb2b,_0x4ed85c){return function(_0x217389){if(_0x217389){return _0x217389['update'](_0x5afb2b)[_0x6c5e('0x1b')](function(_0x1cace0){return _0x1cace0;});}return null;};}function removeEntity(_0x50a7e3,_0x1af398){return function(_0x2092cf){if(_0x2092cf){return _0x2092cf[_0x6c5e('0x1c')]()['then'](function(){_0x50a7e3[_0x6c5e('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x260275,_0x29586c){return function(_0x5adfea){if(!_0x5adfea){_0x260275[_0x6c5e('0x1d')](0x194);}return _0x5adfea;};}function handleError(_0x1bfe6e,_0x1d6df4){_0x1d6df4=_0x1d6df4||0x1f4;return function(_0x21d720){logger[_0x6c5e('0x1e')](_0x21d720[_0x6c5e('0x1f')]);if(_0x21d720[_0x6c5e('0x20')]){delete _0x21d720['name'];}_0x1bfe6e['status'](_0x1d6df4)[_0x6c5e('0x21')](_0x21d720);};}exports[_0x6c5e('0x22')]=function(_0x3e6a59,_0x56d3b3){var _0x44698f={},_0xf0e97={},_0x5b6fe7={'count':0x0,'rows':[]};var _0x413d7b=_[_0x6c5e('0x23')](db[_0x6c5e('0x24')][_0x6c5e('0x25')],function(_0x48df45){return{'name':_0x48df45[_0x6c5e('0x26')],'type':_0x48df45[_0x6c5e('0x27')][_0x6c5e('0x28')]};});_0xf0e97[_0x6c5e('0x29')]=_['map'](_0x413d7b,_0x6c5e('0x20'));_0xf0e97['query']=_[_0x6c5e('0x2a')](_0x3e6a59[_0x6c5e('0x2b')]);_0xf0e97[_0x6c5e('0x2c')]=_[_0x6c5e('0x2d')](_0xf0e97['model'],_0xf0e97[_0x6c5e('0x2b')]);_0x44698f[_0x6c5e('0x2e')]=_[_0x6c5e('0x2d')](_0xf0e97[_0x6c5e('0x29')],qs[_0x6c5e('0x2f')](_0x3e6a59[_0x6c5e('0x2b')][_0x6c5e('0x2f')]));_0x44698f[_0x6c5e('0x2e')]=_0x44698f['attributes'][_0x6c5e('0x30')]?_0x44698f[_0x6c5e('0x2e')]:_0xf0e97[_0x6c5e('0x29')];if(!_0x3e6a59['query'][_0x6c5e('0x31')]('nolimit')){_0x44698f[_0x6c5e('0x15')]=qs['limit'](_0x3e6a59['query'][_0x6c5e('0x15')]);_0x44698f[_0x6c5e('0x14')]=qs['offset'](_0x3e6a59[_0x6c5e('0x2b')][_0x6c5e('0x14')]);}_0x44698f[_0x6c5e('0x32')]=qs['sort'](_0x3e6a59[_0x6c5e('0x2b')][_0x6c5e('0x33')]);_0x44698f['where']=qs[_0x6c5e('0x2c')](_[_0x6c5e('0x34')](_0x3e6a59[_0x6c5e('0x2b')],_0xf0e97[_0x6c5e('0x2c')]),_0x413d7b);if(_0x3e6a59[_0x6c5e('0x2b')][_0x6c5e('0x35')]){_0x44698f[_0x6c5e('0x36')]=_[_0x6c5e('0x37')](_0x44698f[_0x6c5e('0x36')],{'$or':_[_0x6c5e('0x23')](_0x413d7b,function(_0x40bacc){if(_0x40bacc[_0x6c5e('0x27')]!==_0x6c5e('0x38')){var _0x5aa369={};_0x5aa369[_0x40bacc['name']]={'$like':'%'+_0x3e6a59[_0x6c5e('0x2b')][_0x6c5e('0x35')]+'%'};return _0x5aa369;}})});}_0x44698f=_[_0x6c5e('0x37')]({},_0x44698f,_0x3e6a59['options']);var _0x49f71a={'where':_0x44698f[_0x6c5e('0x36')]};return db[_0x6c5e('0x24')][_0x6c5e('0x13')](_0x49f71a)[_0x6c5e('0x1b')](function(_0x3dfa05){_0x5b6fe7['count']=_0x3dfa05;if(_0x3e6a59[_0x6c5e('0x2b')][_0x6c5e('0x39')]){_0x44698f[_0x6c5e('0x3a')]=[{'all':!![]}];}return db[_0x6c5e('0x24')]['findAll'](_0x44698f);})['then'](function(_0x106dca){_0x5b6fe7[_0x6c5e('0x3b')]=_0x106dca;return _0x5b6fe7;})['then'](respondWithFilteredResult(_0x56d3b3,_0x44698f))[_0x6c5e('0x3c')](handleError(_0x56d3b3,null));};exports[_0x6c5e('0x3d')]=function(_0xa99fb6,_0x218a96){var _0xf6c960={'raw':!![],'where':{'id':_0xa99fb6[_0x6c5e('0x3e')]['id']}},_0x272c7b={};_0x272c7b[_0x6c5e('0x29')]=_[_0x6c5e('0x2a')](db[_0x6c5e('0x24')][_0x6c5e('0x25')]);_0x272c7b[_0x6c5e('0x2b')]=_[_0x6c5e('0x2a')](_0xa99fb6[_0x6c5e('0x2b')]);_0x272c7b[_0x6c5e('0x2c')]=_[_0x6c5e('0x2d')](_0x272c7b['model'],_0x272c7b[_0x6c5e('0x2b')]);_0xf6c960[_0x6c5e('0x2e')]=_[_0x6c5e('0x2d')](_0x272c7b[_0x6c5e('0x29')],qs[_0x6c5e('0x2f')](_0xa99fb6[_0x6c5e('0x2b')]['fields']));_0xf6c960[_0x6c5e('0x2e')]=_0xf6c960[_0x6c5e('0x2e')][_0x6c5e('0x30')]?_0xf6c960[_0x6c5e('0x2e')]:_0x272c7b[_0x6c5e('0x29')];if(_0xa99fb6[_0x6c5e('0x2b')][_0x6c5e('0x39')]){_0xf6c960[_0x6c5e('0x3a')]=[{'all':!![]}];}_0xf6c960=_[_0x6c5e('0x37')]({},_0xf6c960,_0xa99fb6[_0x6c5e('0x3f')]);return db[_0x6c5e('0x24')][_0x6c5e('0x40')](_0xf6c960)[_0x6c5e('0x1b')](handleEntityNotFound(_0x218a96,null))['then'](respondWithResult(_0x218a96,null))[_0x6c5e('0x3c')](handleError(_0x218a96,null));};exports[_0x6c5e('0x41')]=function(_0x220cc2,_0x42653f){return db['MailTransferReport']['create'](_0x220cc2[_0x6c5e('0x42')],{})[_0x6c5e('0x1b')](respondWithResult(_0x42653f,0xc9))[_0x6c5e('0x3c')](handleError(_0x42653f,null));};exports['update']=function(_0xe156d4,_0x41d8c5){if(_0xe156d4[_0x6c5e('0x42')]['id']){delete _0xe156d4[_0x6c5e('0x42')]['id'];}return db[_0x6c5e('0x24')][_0x6c5e('0x40')]({'where':{'id':_0xe156d4['params']['id']}})['then'](handleEntityNotFound(_0x41d8c5,null))[_0x6c5e('0x1b')](saveUpdates(_0xe156d4[_0x6c5e('0x42')],null))['then'](respondWithResult(_0x41d8c5,null))[_0x6c5e('0x3c')](handleError(_0x41d8c5,null));};exports['destroy']=function(_0x36dbe5,_0x1b2e11){return db[_0x6c5e('0x24')]['find']({'where':{'id':_0x36dbe5[_0x6c5e('0x3e')]['id']}})[_0x6c5e('0x1b')](handleEntityNotFound(_0x1b2e11,null))[_0x6c5e('0x1b')](removeEntity(_0x1b2e11,null))['catch'](handleError(_0x1b2e11,null));};exports[_0x6c5e('0x43')]=function(_0x5756fc,_0xd45d5){return db[_0x6c5e('0x24')][_0x6c5e('0x43')]()[_0x6c5e('0x1b')](respondWithResult(_0xd45d5,null))[_0x6c5e('0x3c')](handleError(_0xd45d5,null));}; \ No newline at end of file +var _0xbfe2=['where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','keys','fields','include','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','end','error','name','index','map','MailTransferReport','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbfe2,0xac));var _0x2bfe=function(_0x33f53a,_0x292ffc){_0x33f53a=_0x33f53a-0x0;var _0x8871d7=_0xbfe2[_0x33f53a];return _0x8871d7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2bfe('0x0'));var zipdir=require(_0x2bfe('0x1'));var jsonpatch=require(_0x2bfe('0x2'));var rp=require(_0x2bfe('0x3'));var moment=require(_0x2bfe('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2bfe('0x5'));var util=require(_0x2bfe('0x6'));var path=require(_0x2bfe('0x7'));var sox=require(_0x2bfe('0x8'));var csv=require(_0x2bfe('0x9'));var ejs=require(_0x2bfe('0xa'));var fs=require('fs');var _=require(_0x2bfe('0xb'));var squel=require(_0x2bfe('0xc'));var crypto=require(_0x2bfe('0xd'));var jsforce=require(_0x2bfe('0xe'));var deskjs=require(_0x2bfe('0xf'));var toCsv=require(_0x2bfe('0x9'));var querystring=require(_0x2bfe('0x10'));var Papa=require(_0x2bfe('0x11'));var Redis=require(_0x2bfe('0x12'));var authService=require(_0x2bfe('0x13'));var qs=require(_0x2bfe('0x14'));var as=require(_0x2bfe('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2bfe('0x16'))('api');var utils=require(_0x2bfe('0x17'));var config=require('../../config/environment');var db=require(_0x2bfe('0x18'))['db'];function respondWithStatusCode(_0x24974a,_0x4e82fc){_0x4e82fc=_0x4e82fc||0xcc;return function(_0x413aab){if(_0x413aab){return _0x24974a[_0x2bfe('0x19')](_0x4e82fc);}return _0x24974a['status'](_0x4e82fc)['end']();};}function respondWithResult(_0xa55702,_0x2a5ed3){_0x2a5ed3=_0x2a5ed3||0xc8;return function(_0x2f6a67){if(_0x2f6a67){return _0xa55702[_0x2bfe('0x1a')](_0x2a5ed3)[_0x2bfe('0x1b')](_0x2f6a67);}};}function respondWithFilteredResult(_0x17be5d,_0x7b7d7b){return function(_0x57e982){if(_0x57e982){var _0x5e7e44=_0x57e982[_0x2bfe('0x1c')],_0x5dc0d3=_0x7b7d7b[_0x2bfe('0x1d')],_0x1c0deb=_0x7b7d7b[_0x2bfe('0x1d')]+_0x7b7d7b[_0x2bfe('0x1e')],_0x2de6c3;if(_0x1c0deb>=_0x5e7e44){_0x1c0deb=_0x5e7e44;_0x2de6c3=0xc8;}else{_0x2de6c3=0xce;}_0x17be5d['status'](_0x2de6c3);return _0x17be5d[_0x2bfe('0x1f')](_0x2bfe('0x20'),_0x5dc0d3+'-'+_0x1c0deb+'/'+_0x5e7e44)['json'](_0x57e982);}return null;};}function patchUpdates(_0x471712){return function(_0x5a7228){try{jsonpatch['apply'](_0x5a7228,_0x471712,!![]);}catch(_0x49e497){return BPromise[_0x2bfe('0x21')](_0x49e497);}return _0x5a7228[_0x2bfe('0x22')]();};}function saveUpdates(_0x172ca3,_0x3022e2){return function(_0x4f26e5){if(_0x4f26e5){return _0x4f26e5[_0x2bfe('0x23')](_0x172ca3)[_0x2bfe('0x24')](function(_0xc9aa6b){return _0xc9aa6b;});}return null;};}function removeEntity(_0x28d1ea,_0x3a4e35){return function(_0x45b4cd){if(_0x45b4cd){return _0x45b4cd['destroy']()[_0x2bfe('0x24')](function(){_0x28d1ea[_0x2bfe('0x1a')](0xcc)[_0x2bfe('0x25')]();});}};}function handleEntityNotFound(_0x2ca081,_0x344978){return function(_0x5266e7){if(!_0x5266e7){_0x2ca081[_0x2bfe('0x19')](0x194);}return _0x5266e7;};}function handleError(_0x1f82ce,_0x2b4203){_0x2b4203=_0x2b4203||0x1f4;return function(_0x464f60){logger[_0x2bfe('0x26')](_0x464f60['stack']);if(_0x464f60[_0x2bfe('0x27')]){delete _0x464f60['name'];}_0x1f82ce[_0x2bfe('0x1a')](_0x2b4203)['send'](_0x464f60);};}exports[_0x2bfe('0x28')]=function(_0x322716,_0xbe1073){var _0x2a6ad6={},_0x1209b3={},_0x218da0={'count':0x0,'rows':[]};var _0x4bff1f=_[_0x2bfe('0x29')](db[_0x2bfe('0x2a')]['rawAttributes'],function(_0x533171){return{'name':_0x533171[_0x2bfe('0x2b')],'type':_0x533171[_0x2bfe('0x2c')][_0x2bfe('0x2d')]};});_0x1209b3[_0x2bfe('0x2e')]=_['map'](_0x4bff1f,_0x2bfe('0x27'));_0x1209b3[_0x2bfe('0x2f')]=_['keys'](_0x322716['query']);_0x1209b3[_0x2bfe('0x30')]=_[_0x2bfe('0x31')](_0x1209b3[_0x2bfe('0x2e')],_0x1209b3[_0x2bfe('0x2f')]);_0x2a6ad6[_0x2bfe('0x32')]=_[_0x2bfe('0x31')](_0x1209b3[_0x2bfe('0x2e')],qs['fields'](_0x322716['query']['fields']));_0x2a6ad6[_0x2bfe('0x32')]=_0x2a6ad6['attributes'][_0x2bfe('0x33')]?_0x2a6ad6['attributes']:_0x1209b3[_0x2bfe('0x2e')];if(!_0x322716[_0x2bfe('0x2f')][_0x2bfe('0x34')](_0x2bfe('0x35'))){_0x2a6ad6[_0x2bfe('0x1e')]=qs['limit'](_0x322716[_0x2bfe('0x2f')][_0x2bfe('0x1e')]);_0x2a6ad6[_0x2bfe('0x1d')]=qs[_0x2bfe('0x1d')](_0x322716[_0x2bfe('0x2f')][_0x2bfe('0x1d')]);}_0x2a6ad6[_0x2bfe('0x36')]=qs[_0x2bfe('0x37')](_0x322716[_0x2bfe('0x2f')][_0x2bfe('0x37')]);_0x2a6ad6[_0x2bfe('0x38')]=qs[_0x2bfe('0x30')](_[_0x2bfe('0x39')](_0x322716[_0x2bfe('0x2f')],_0x1209b3[_0x2bfe('0x30')]),_0x4bff1f);if(_0x322716[_0x2bfe('0x2f')][_0x2bfe('0x3a')]){_0x2a6ad6['where']=_[_0x2bfe('0x3b')](_0x2a6ad6[_0x2bfe('0x38')],{'$or':_[_0x2bfe('0x29')](_0x4bff1f,function(_0x4fca32){if(_0x4fca32[_0x2bfe('0x2c')]!==_0x2bfe('0x3c')){var _0x29d95a={};_0x29d95a[_0x4fca32['name']]={'$like':'%'+_0x322716[_0x2bfe('0x2f')][_0x2bfe('0x3a')]+'%'};return _0x29d95a;}})});}_0x2a6ad6=_[_0x2bfe('0x3b')]({},_0x2a6ad6,_0x322716[_0x2bfe('0x3d')]);var _0x58ee6f={'where':_0x2a6ad6[_0x2bfe('0x38')]};return db[_0x2bfe('0x2a')]['count'](_0x58ee6f)['then'](function(_0x1e271b){_0x218da0[_0x2bfe('0x1c')]=_0x1e271b;if(_0x322716[_0x2bfe('0x2f')][_0x2bfe('0x3e')]){_0x2a6ad6['include']=[{'all':!![]}];}return db[_0x2bfe('0x2a')][_0x2bfe('0x3f')](_0x2a6ad6);})['then'](function(_0x2e7951){_0x218da0['rows']=_0x2e7951;return _0x218da0;})[_0x2bfe('0x24')](respondWithFilteredResult(_0xbe1073,_0x2a6ad6))[_0x2bfe('0x40')](handleError(_0xbe1073,null));};exports[_0x2bfe('0x41')]=function(_0x1874ae,_0x2def84){var _0x469694={'raw':!![],'where':{'id':_0x1874ae[_0x2bfe('0x42')]['id']}},_0x3af81c={};_0x3af81c[_0x2bfe('0x2e')]=_['keys'](db['MailTransferReport'][_0x2bfe('0x43')]);_0x3af81c['query']=_[_0x2bfe('0x44')](_0x1874ae[_0x2bfe('0x2f')]);_0x3af81c[_0x2bfe('0x30')]=_['intersection'](_0x3af81c['model'],_0x3af81c[_0x2bfe('0x2f')]);_0x469694[_0x2bfe('0x32')]=_[_0x2bfe('0x31')](_0x3af81c[_0x2bfe('0x2e')],qs[_0x2bfe('0x45')](_0x1874ae[_0x2bfe('0x2f')][_0x2bfe('0x45')]));_0x469694['attributes']=_0x469694[_0x2bfe('0x32')][_0x2bfe('0x33')]?_0x469694[_0x2bfe('0x32')]:_0x3af81c[_0x2bfe('0x2e')];if(_0x1874ae['query'][_0x2bfe('0x3e')]){_0x469694[_0x2bfe('0x46')]=[{'all':!![]}];}_0x469694=_[_0x2bfe('0x3b')]({},_0x469694,_0x1874ae['options']);return db[_0x2bfe('0x2a')][_0x2bfe('0x47')](_0x469694)[_0x2bfe('0x24')](handleEntityNotFound(_0x2def84,null))[_0x2bfe('0x24')](respondWithResult(_0x2def84,null))['catch'](handleError(_0x2def84,null));};exports[_0x2bfe('0x48')]=function(_0x4550c6,_0x182577){return db['MailTransferReport']['create'](_0x4550c6[_0x2bfe('0x49')],{})['then'](respondWithResult(_0x182577,0xc9))['catch'](handleError(_0x182577,null));};exports[_0x2bfe('0x23')]=function(_0x1f3292,_0x33fe22){if(_0x1f3292[_0x2bfe('0x49')]['id']){delete _0x1f3292['body']['id'];}return db['MailTransferReport'][_0x2bfe('0x47')]({'where':{'id':_0x1f3292[_0x2bfe('0x42')]['id']}})['then'](handleEntityNotFound(_0x33fe22,null))[_0x2bfe('0x24')](saveUpdates(_0x1f3292[_0x2bfe('0x49')],null))[_0x2bfe('0x24')](respondWithResult(_0x33fe22,null))[_0x2bfe('0x40')](handleError(_0x33fe22,null));};exports[_0x2bfe('0x4a')]=function(_0x3178a8,_0x9260f9){return db[_0x2bfe('0x2a')][_0x2bfe('0x47')]({'where':{'id':_0x3178a8[_0x2bfe('0x42')]['id']}})[_0x2bfe('0x24')](handleEntityNotFound(_0x9260f9,null))[_0x2bfe('0x24')](removeEntity(_0x9260f9,null))[_0x2bfe('0x40')](handleError(_0x9260f9,null));};exports[_0x2bfe('0x4b')]=function(_0x427da9,_0x147d42){return db['MailTransferReport'][_0x2bfe('0x4b')]()['then'](respondWithResult(_0x147d42,null))[_0x2bfe('0x40')](handleError(_0x147d42,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 24f8e4c..daee511 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 _0x7508=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','MailTransferReport','uniqueid','util'];(function(_0x46c6e1,_0x3e103d){var _0x23f5dd=function(_0xcc1bd5){while(--_0xcc1bd5){_0x46c6e1['push'](_0x46c6e1['shift']());}};_0x23f5dd(++_0x3e103d);}(_0x7508,0x83));var _0x8750=function(_0x5c91aa,_0x339edd){_0x5c91aa=_0x5c91aa-0x0;var _0x4db9d6=_0x7508[_0x5c91aa];return _0x4db9d6;};'use strict';var _=require('lodash');var util=require(_0x8750('0x0'));var logger=require(_0x8750('0x1'))(_0x8750('0x2'));var moment=require(_0x8750('0x3'));var BPromise=require(_0x8750('0x4'));var rp=require(_0x8750('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8750('0x6'));var config=require(_0x8750('0x7'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x455ef5,_0x14c648){return _0x455ef5[_0x8750('0x8')](_0x8750('0x9'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x8750('0xa'),'fields':[_0x8750('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ad4=['util','../../config/logger','moment','request-promise','path','../../config/environment','./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid','lodash'];(function(_0x22ecef,_0x5a2a0b){var _0x5ef61f=function(_0xfe8f87){while(--_0xfe8f87){_0x22ecef['push'](_0x22ecef['shift']());}};_0x5ef61f(++_0x5a2a0b);}(_0x2ad4,0xcb));var _0x42ad=function(_0x1ce236,_0xca922e){_0x1ce236=_0x1ce236-0x0;var _0x241819=_0x2ad4[_0x1ce236];return _0x241819;};'use strict';var _=require(_0x42ad('0x0'));var util=require(_0x42ad('0x1'));var logger=require(_0x42ad('0x2'))('api');var moment=require(_0x42ad('0x3'));var BPromise=require('bluebird');var rp=require(_0x42ad('0x4'));var fs=require('fs');var path=require(_0x42ad('0x5'));var rimraf=require('rimraf');var config=require(_0x42ad('0x6'));var attributes=require(_0x42ad('0x7'));module[_0x42ad('0x8')]=function(_0x40fd91,_0x13caba){return _0x40fd91[_0x42ad('0x9')]('MailTransferReport',attributes,{'tableName':_0x42ad('0xa'),'paranoid':![],'indexes':[{'name':_0x42ad('0xb'),'fields':[_0x42ad('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 460206c..7704c12 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 _0x474b=['client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x474b,0x1c6));var _0xb474=function(_0x47c41f,_0x1ceb7a){_0x47c41f=_0x47c41f-0x0;var _0x41b70d=_0x474b[_0x47c41f];return _0x41b70d;};'use strict';var _=require(_0xb474('0x0'));var util=require(_0xb474('0x1'));var moment=require(_0xb474('0x2'));var BPromise=require('bluebird');var rs=require(_0xb474('0x3'));var fs=require('fs');var Redis=require(_0xb474('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb474('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb474('0x6'));var jayson=require(_0xb474('0x7'));var client=jayson[_0xb474('0x8')][_0xb474('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35a144,_0xf338c7,_0x4d5465){return new BPromise(function(_0x2b1091,_0x2073d3){return client[_0xb474('0xa')](_0x35a144,_0x4d5465)[_0xb474('0xb')](function(_0x1a284c){logger[_0xb474('0xc')](_0xb474('0xd'),_0xf338c7,'request\x20sent');logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0xf338c7,_0xb474('0xe'),JSON[_0xb474('0xf')](_0x1a284c));if(_0x1a284c['error']){if(_0x1a284c['error'][_0xb474('0x10')]===0x1f4){logger[_0xb474('0x11')](_0xb474('0xd'),_0xf338c7,_0x1a284c[_0xb474('0x11')]['message']);return _0x2073d3(_0x1a284c['error'][_0xb474('0x12')]);}logger[_0xb474('0x11')](_0xb474('0xd'),_0xf338c7,_0x1a284c[_0xb474('0x11')]['message']);return _0x2b1091(_0x1a284c[_0xb474('0x11')][_0xb474('0x12')]);}else{logger[_0xb474('0xc')](_0xb474('0xd'),_0xf338c7,_0xb474('0xe'));_0x2b1091(_0x1a284c[_0xb474('0x13')][_0xb474('0x12')]);}})[_0xb474('0x14')](function(_0x1e09ce){logger[_0xb474('0x11')](_0xb474('0xd'),_0xf338c7,_0x1e09ce);_0x2073d3(_0x1e09ce);});});} \ No newline at end of file +var _0x8123=['debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','MailTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x5d69ec,_0x583d1f){var _0x61cb84=function(_0x29ee7a){while(--_0x29ee7a){_0x5d69ec['push'](_0x5d69ec['shift']());}};_0x61cb84(++_0x583d1f);}(_0x8123,0x137));var _0x3812=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0x8123[_0x382a62];return _0x490a25;};'use strict';var _=require(_0x3812('0x0'));var util=require(_0x3812('0x1'));var moment=require(_0x3812('0x2'));var BPromise=require(_0x3812('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3812('0x4'));var db=require(_0x3812('0x5'))['db'];var utils=require(_0x3812('0x6'));var logger=require('../../config/logger')(_0x3812('0x7'));var config=require(_0x3812('0x8'));var jayson=require(_0x3812('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b663c,_0x31dad9,_0xb2f492){return new BPromise(function(_0x317d9e,_0x3dac3f){return client['request'](_0x4b663c,_0xb2f492)['then'](function(_0x1a4b38){logger['info'](_0x3812('0xa'),_0x31dad9,_0x3812('0xb'));logger[_0x3812('0xc')](_0x3812('0xd'),_0x31dad9,'request\x20sent',JSON[_0x3812('0xe')](_0x1a4b38));if(_0x1a4b38[_0x3812('0xf')]){if(_0x1a4b38[_0x3812('0xf')]['code']===0x1f4){logger['error'](_0x3812('0xa'),_0x31dad9,_0x1a4b38[_0x3812('0xf')][_0x3812('0x10')]);return _0x3dac3f(_0x1a4b38[_0x3812('0xf')][_0x3812('0x10')]);}logger[_0x3812('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x31dad9,_0x1a4b38[_0x3812('0xf')][_0x3812('0x10')]);return _0x317d9e(_0x1a4b38['error'][_0x3812('0x10')]);}else{logger[_0x3812('0x11')](_0x3812('0xa'),_0x31dad9,_0x3812('0xb'));_0x317d9e(_0x1a4b38[_0x3812('0x12')][_0x3812('0x10')]);}})['catch'](function(_0x177bb9){logger[_0x3812('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x31dad9,_0x177bb9);_0x3dac3f(_0x177bb9);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 7849d9d..22551b8 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 _0x5a05=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x6dd261,_0x34773c){var _0x5dc22c=function(_0x338f10){while(--_0x338f10){_0x6dd261['push'](_0x6dd261['shift']());}};_0x5dc22c(++_0x34773c);}(_0x5a05,0xce));var _0x55a0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5a05[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x55a0('0x0'));var util=require(_0x55a0('0x1'));var path=require(_0x55a0('0x2'));var timeout=require(_0x55a0('0x3'));var express=require(_0x55a0('0x4'));var router=express['Router']();var auth=require(_0x55a0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x55a0('0x6'));var controller=require(_0x55a0('0x7'));router[_0x55a0('0x8')]('/',auth[_0x55a0('0x9')](),controller[_0x55a0('0xa')]);router[_0x55a0('0x8')]('/describe',auth[_0x55a0('0x9')](),controller[_0x55a0('0xb')]);router[_0x55a0('0x8')](_0x55a0('0xc'),auth[_0x55a0('0x9')](),controller[_0x55a0('0xd')]);router[_0x55a0('0xe')]('/',auth['isAuthenticated'](),controller[_0x55a0('0xf')]);router[_0x55a0('0x10')](_0x55a0('0xc'),auth[_0x55a0('0x9')](),controller[_0x55a0('0x11')]);router[_0x55a0('0x12')](_0x55a0('0xc'),auth['isAuthenticated'](),controller[_0x55a0('0x13')]);module['exports']=router; \ No newline at end of file +var _0xfda6=['update','delete','exports','util','path','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put'];(function(_0x143ea6,_0x3c9999){var _0xfb14d=function(_0x28149a){while(--_0x28149a){_0x143ea6['push'](_0x143ea6['shift']());}};_0xfb14d(++_0x3c9999);}(_0xfda6,0x123));var _0x6fda=function(_0x24e48c,_0x292459){_0x24e48c=_0x24e48c-0x0;var _0x2a3c76=_0xfda6[_0x24e48c];return _0x2a3c76;};'use strict';var multer=require('multer');var util=require(_0x6fda('0x0'));var path=require(_0x6fda('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6fda('0x2'));var config=require(_0x6fda('0x3'));var controller=require('./memberReport.controller');router[_0x6fda('0x4')]('/',auth[_0x6fda('0x5')](),controller[_0x6fda('0x6')]);router['get']('/describe',auth[_0x6fda('0x5')](),controller[_0x6fda('0x7')]);router[_0x6fda('0x4')](_0x6fda('0x8'),auth[_0x6fda('0x5')](),controller[_0x6fda('0x9')]);router[_0x6fda('0xa')]('/',auth[_0x6fda('0x5')](),controller[_0x6fda('0xb')]);router[_0x6fda('0xc')](_0x6fda('0x8'),auth[_0x6fda('0x5')](),controller[_0x6fda('0xd')]);router[_0x6fda('0xe')](_0x6fda('0x8'),auth[_0x6fda('0x5')](),controller['destroy']);module[_0x6fda('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 82ae4a3..47cd7fb 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 _0xf097=['exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue'];(function(_0xbb4a52,_0x35b464){var _0x2bcdb8=function(_0x5205d2){while(--_0x5205d2){_0xbb4a52['push'](_0xbb4a52['shift']());}};_0x2bcdb8(++_0x35b464);}(_0xf097,0x8f));var _0x7f09=function(_0x9a25f5,_0x27e259){_0x9a25f5=_0x9a25f5-0x0;var _0x2b72c3=_0xf097[_0x9a25f5];return _0x2b72c3;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x7f09('0x0')]={'channel':{'type':Sequelize[_0x7f09('0x1')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7f09('0x1')],'defaultValue':_0x7f09('0x2'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x7f09('0x3')]},'enterAt':{'type':Sequelize[_0x7f09('0x4')]},'exitAt':{'type':Sequelize[_0x7f09('0x4')],'set':function(_0xa3a32c){var _0x552ff=moment(_0xa3a32c);var _0x151f60=moment(this[_0x7f09('0x5')](_0x7f09('0x6')));var _0x51833d=_0x552ff[_0x7f09('0x7')](_0x151f60,_0x7f09('0x8'));this[_0x7f09('0x9')](_0x7f09('0xa'),_0xa3a32c);this[_0x7f09('0x9')](_0x7f09('0xb'),_0x51833d||null);}},'data1':{'type':Sequelize[_0x7f09('0x1')],'comment':_0x7f09('0xc')},'data2':{'type':Sequelize[_0x7f09('0x1')],'comment':_0x7f09('0xd')},'data3':{'type':Sequelize[_0x7f09('0x1')],'comment':_0x7f09('0xe')},'data4':{'type':Sequelize[_0x7f09('0x1')],'comment':_0x7f09('0xf')},'data5':{'type':Sequelize[_0x7f09('0x1')],'comment':_0x7f09('0x10')},'role':{'type':Sequelize[_0x7f09('0x1')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x7f09('0x1')]}}; \ No newline at end of file +var _0x7770=['exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue'];(function(_0x218419,_0x57f42c){var _0xe4f396=function(_0x5a25ee){while(--_0x5a25ee){_0x218419['push'](_0x218419['shift']());}};_0xe4f396(++_0x57f42c);}(_0x7770,0x125));var _0x0777=function(_0x2673f3,_0x5d055){_0x2673f3=_0x2673f3-0x0;var _0x2757f6=_0x7770[_0x2673f3];return _0x2757f6;};'use strict';var Sequelize=require(_0x0777('0x0'));var moment=require('moment');module[_0x0777('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x0777('0x2')]},'interface':{'type':Sequelize[_0x0777('0x2')]},'type':{'type':Sequelize[_0x0777('0x2')],'defaultValue':_0x0777('0x3'),'comment':_0x0777('0x4')},'duration':{'type':Sequelize[_0x0777('0x5')]},'enterAt':{'type':Sequelize[_0x0777('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x3160f3){var _0x1b3bf4=moment(_0x3160f3);var _0x4ad07e=moment(this[_0x0777('0x7')](_0x0777('0x8')));var _0x2a2348=_0x1b3bf4['diff'](_0x4ad07e,_0x0777('0x9'));this[_0x0777('0xa')](_0x0777('0xb'),_0x3160f3);this['setDataValue'](_0x0777('0xc'),_0x2a2348||null);}},'data1':{'type':Sequelize[_0x0777('0x2')],'comment':_0x0777('0xd')},'data2':{'type':Sequelize[_0x0777('0x2')],'comment':_0x0777('0xe')},'data3':{'type':Sequelize['STRING'],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':_0x0777('0xf')},'data5':{'type':Sequelize[_0x0777('0x2')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x0777('0x2')]},'internal':{'type':Sequelize[_0x0777('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 82f3ed3..f27dac6 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 _0x675a=['rows','catch','show','params','keys','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','destroy','end','error','stack','name','send','index','MemberReport','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll'];(function(_0x398f02,_0x3393a0){var _0x19039f=function(_0x2945d0){while(--_0x2945d0){_0x398f02['push'](_0x398f02['shift']());}};_0x19039f(++_0x3393a0);}(_0x675a,0x136));var _0xa675=function(_0x560286,_0x17d496){_0x560286=_0x560286-0x0;var _0x1418aa=_0x675a[_0x560286];return _0x1418aa;};'use strict';var pdf=require(_0xa675('0x0'));var emlformat=require(_0xa675('0x1'));var rimraf=require(_0xa675('0x2'));var zipdir=require(_0xa675('0x3'));var jsonpatch=require(_0xa675('0x4'));var rp=require(_0xa675('0x5'));var moment=require(_0xa675('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xa675('0x7'));var util=require(_0xa675('0x8'));var path=require(_0xa675('0x9'));var sox=require('sox');var csv=require(_0xa675('0xa'));var ejs=require(_0xa675('0xb'));var fs=require('fs');var _=require(_0xa675('0xc'));var squel=require(_0xa675('0xd'));var crypto=require('crypto');var jsforce=require(_0xa675('0xe'));var deskjs=require(_0xa675('0xf'));var toCsv=require(_0xa675('0xa'));var querystring=require(_0xa675('0x10'));var Papa=require(_0xa675('0x11'));var Redis=require(_0xa675('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa675('0x13'));var as=require(_0xa675('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa675('0x15'))(_0xa675('0x16'));var utils=require(_0xa675('0x17'));var config=require('../../config/environment');var db=require(_0xa675('0x18'))['db'];function respondWithStatusCode(_0x978b01,_0x51c757){_0x51c757=_0x51c757||0xcc;return function(_0x2c3f96){if(_0x2c3f96){return _0x978b01[_0xa675('0x19')](_0x51c757);}return _0x978b01[_0xa675('0x1a')](_0x51c757)['end']();};}function respondWithResult(_0x20ed56,_0x581b6e){_0x581b6e=_0x581b6e||0xc8;return function(_0x2b3435){if(_0x2b3435){return _0x20ed56[_0xa675('0x1a')](_0x581b6e)[_0xa675('0x1b')](_0x2b3435);}};}function respondWithFilteredResult(_0x7fa429,_0x12a11c){return function(_0x1dc761){if(_0x1dc761){var _0x24c784=_0x1dc761[_0xa675('0x1c')],_0x1ab9c4=_0x12a11c[_0xa675('0x1d')],_0x47e7c7=_0x12a11c[_0xa675('0x1d')]+_0x12a11c[_0xa675('0x1e')],_0x5380db;if(_0x47e7c7>=_0x24c784){_0x47e7c7=_0x24c784;_0x5380db=0xc8;}else{_0x5380db=0xce;}_0x7fa429[_0xa675('0x1a')](_0x5380db);return _0x7fa429[_0xa675('0x1f')]('Content-Range',_0x1ab9c4+'-'+_0x47e7c7+'/'+_0x24c784)[_0xa675('0x1b')](_0x1dc761);}return null;};}function patchUpdates(_0x29ead4){return function(_0x47854d){try{jsonpatch[_0xa675('0x20')](_0x47854d,_0x29ead4,!![]);}catch(_0x2c48ba){return BPromise[_0xa675('0x21')](_0x2c48ba);}return _0x47854d[_0xa675('0x22')]();};}function saveUpdates(_0x51d468,_0x2b5338){return function(_0x28bafb){if(_0x28bafb){return _0x28bafb['update'](_0x51d468)[_0xa675('0x23')](function(_0x462a2f){return _0x462a2f;});}return null;};}function removeEntity(_0x13d785,_0x29588b){return function(_0x4ba6b9){if(_0x4ba6b9){return _0x4ba6b9[_0xa675('0x24')]()[_0xa675('0x23')](function(){_0x13d785['status'](0xcc)[_0xa675('0x25')]();});}};}function handleEntityNotFound(_0x41203b,_0x421ffa){return function(_0x537547){if(!_0x537547){_0x41203b[_0xa675('0x19')](0x194);}return _0x537547;};}function handleError(_0x59f8bf,_0x363da6){_0x363da6=_0x363da6||0x1f4;return function(_0x3184bd){logger[_0xa675('0x26')](_0x3184bd[_0xa675('0x27')]);if(_0x3184bd[_0xa675('0x28')]){delete _0x3184bd[_0xa675('0x28')];}_0x59f8bf[_0xa675('0x1a')](_0x363da6)[_0xa675('0x29')](_0x3184bd);};}exports[_0xa675('0x2a')]=function(_0x390582,_0x361cd0){var _0x2f025f={},_0x3cd822={},_0x359ae1={'count':0x0,'rows':[]};var _0x239702=_['map'](db[_0xa675('0x2b')][_0xa675('0x2c')],function(_0x35a5e5){return{'name':_0x35a5e5[_0xa675('0x2d')],'type':_0x35a5e5[_0xa675('0x2e')][_0xa675('0x2f')]};});_0x3cd822[_0xa675('0x30')]=_[_0xa675('0x31')](_0x239702,_0xa675('0x28'));_0x3cd822[_0xa675('0x32')]=_['keys'](_0x390582[_0xa675('0x32')]);_0x3cd822[_0xa675('0x33')]=_['intersection'](_0x3cd822['model'],_0x3cd822[_0xa675('0x32')]);_0x2f025f[_0xa675('0x34')]=_[_0xa675('0x35')](_0x3cd822[_0xa675('0x30')],qs['fields'](_0x390582[_0xa675('0x32')][_0xa675('0x36')]));_0x2f025f['attributes']=_0x2f025f[_0xa675('0x34')]['length']?_0x2f025f['attributes']:_0x3cd822[_0xa675('0x30')];if(!_0x390582[_0xa675('0x32')][_0xa675('0x37')]('nolimit')){_0x2f025f['limit']=qs['limit'](_0x390582['query'][_0xa675('0x1e')]);_0x2f025f[_0xa675('0x1d')]=qs[_0xa675('0x1d')](_0x390582[_0xa675('0x32')][_0xa675('0x1d')]);}_0x2f025f[_0xa675('0x38')]=qs[_0xa675('0x39')](_0x390582[_0xa675('0x32')][_0xa675('0x39')]);_0x2f025f['where']=qs[_0xa675('0x33')](_[_0xa675('0x3a')](_0x390582['query'],_0x3cd822[_0xa675('0x33')]),_0x239702);if(_0x390582[_0xa675('0x32')][_0xa675('0x3b')]){_0x2f025f[_0xa675('0x3c')]=_[_0xa675('0x3d')](_0x2f025f[_0xa675('0x3c')],{'$or':_[_0xa675('0x31')](_0x239702,function(_0x4c8967){if(_0x4c8967[_0xa675('0x2e')]!==_0xa675('0x3e')){var _0x3fa63a={};_0x3fa63a[_0x4c8967['name']]={'$like':'%'+_0x390582[_0xa675('0x32')][_0xa675('0x3b')]+'%'};return _0x3fa63a;}})});}_0x2f025f=_[_0xa675('0x3d')]({},_0x2f025f,_0x390582[_0xa675('0x3f')]);var _0x1676c4={'where':_0x2f025f[_0xa675('0x3c')]};return db[_0xa675('0x2b')][_0xa675('0x1c')](_0x1676c4)[_0xa675('0x23')](function(_0x46c785){_0x359ae1['count']=_0x46c785;if(_0x390582[_0xa675('0x32')][_0xa675('0x40')]){_0x2f025f['include']=[{'all':!![]}];}return db[_0xa675('0x2b')]['findAll'](_0x2f025f);})['then'](function(_0x532eff){_0x359ae1[_0xa675('0x41')]=_0x532eff;return _0x359ae1;})[_0xa675('0x23')](respondWithFilteredResult(_0x361cd0,_0x2f025f))[_0xa675('0x42')](handleError(_0x361cd0,null));};exports[_0xa675('0x43')]=function(_0xe6e1cf,_0x4a9467){var _0x466b5f={'raw':!![],'where':{'id':_0xe6e1cf[_0xa675('0x44')]['id']}},_0x14552d={};_0x14552d['model']=_[_0xa675('0x45')](db[_0xa675('0x2b')]['rawAttributes']);_0x14552d[_0xa675('0x32')]=_[_0xa675('0x45')](_0xe6e1cf[_0xa675('0x32')]);_0x14552d['filters']=_[_0xa675('0x35')](_0x14552d[_0xa675('0x30')],_0x14552d[_0xa675('0x32')]);_0x466b5f['attributes']=_[_0xa675('0x35')](_0x14552d[_0xa675('0x30')],qs['fields'](_0xe6e1cf[_0xa675('0x32')][_0xa675('0x36')]));_0x466b5f[_0xa675('0x34')]=_0x466b5f['attributes'][_0xa675('0x46')]?_0x466b5f[_0xa675('0x34')]:_0x14552d[_0xa675('0x30')];if(_0xe6e1cf[_0xa675('0x32')][_0xa675('0x40')]){_0x466b5f['include']=[{'all':!![]}];}_0x466b5f=_[_0xa675('0x3d')]({},_0x466b5f,_0xe6e1cf[_0xa675('0x3f')]);return db[_0xa675('0x2b')][_0xa675('0x47')](_0x466b5f)['then'](handleEntityNotFound(_0x4a9467,null))[_0xa675('0x23')](respondWithResult(_0x4a9467,null))[_0xa675('0x42')](handleError(_0x4a9467,null));};exports[_0xa675('0x48')]=function(_0xc4a470,_0x4b4c2c){return db['MemberReport']['create'](_0xc4a470[_0xa675('0x49')],{})[_0xa675('0x23')](respondWithResult(_0x4b4c2c,0xc9))['catch'](handleError(_0x4b4c2c,null));};exports['update']=function(_0x15b0bf,_0x4e6fe9){if(_0x15b0bf['body']['id']){delete _0x15b0bf[_0xa675('0x49')]['id'];}return db[_0xa675('0x2b')][_0xa675('0x47')]({'where':{'id':_0x15b0bf['params']['id']}})[_0xa675('0x23')](handleEntityNotFound(_0x4e6fe9,null))['then'](saveUpdates(_0x15b0bf['body'],null))[_0xa675('0x23')](respondWithResult(_0x4e6fe9,null))['catch'](handleError(_0x4e6fe9,null));};exports[_0xa675('0x24')]=function(_0x5ac668,_0x1fa4c8){return db[_0xa675('0x2b')][_0xa675('0x47')]({'where':{'id':_0x5ac668[_0xa675('0x44')]['id']}})[_0xa675('0x23')](handleEntityNotFound(_0x1fa4c8,null))[_0xa675('0x23')](removeEntity(_0x1fa4c8,null))['catch'](handleError(_0x1fa4c8,null));};exports['describe']=function(_0x51a853,_0x5b2f6b){return db[_0xa675('0x2b')][_0xa675('0x4a')]()[_0xa675('0x23')](respondWithResult(_0x5b2f6b,null))['catch'](handleError(_0x5b2f6b,null));}; \ No newline at end of file +var _0xbc5b=['create','body','update','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','include','find'];(function(_0x1718db,_0x3558c5){var _0x5103a0=function(_0x15722b){while(--_0x15722b){_0x1718db['push'](_0x1718db['shift']());}};_0x5103a0(++_0x3558c5);}(_0xbc5b,0x18b));var _0xbbc5=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xbc5b[_0x502c7d];return _0x30b7ed;};'use strict';var pdf=require(_0xbbc5('0x0'));var emlformat=require(_0xbbc5('0x1'));var rimraf=require(_0xbbc5('0x2'));var zipdir=require(_0xbbc5('0x3'));var jsonpatch=require(_0xbbc5('0x4'));var rp=require(_0xbbc5('0x5'));var moment=require(_0xbbc5('0x6'));var BPromise=require(_0xbbc5('0x7'));var Mustache=require(_0xbbc5('0x8'));var util=require('util');var path=require(_0xbbc5('0x9'));var sox=require('sox');var csv=require(_0xbbc5('0xa'));var ejs=require(_0xbbc5('0xb'));var fs=require('fs');var _=require(_0xbbc5('0xc'));var squel=require('squel');var crypto=require(_0xbbc5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbbc5('0xe'));var toCsv=require(_0xbbc5('0xa'));var querystring=require(_0xbbc5('0xf'));var Papa=require(_0xbbc5('0x10'));var Redis=require(_0xbbc5('0x11'));var authService=require(_0xbbc5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbbc5('0x13'));var hardwareService=require(_0xbbc5('0x14'));var logger=require(_0xbbc5('0x15'))(_0xbbc5('0x16'));var utils=require(_0xbbc5('0x17'));var config=require(_0xbbc5('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e1fda,_0x332d77){_0x332d77=_0x332d77||0xcc;return function(_0x4c1cf7){if(_0x4c1cf7){return _0x5e1fda[_0xbbc5('0x19')](_0x332d77);}return _0x5e1fda['status'](_0x332d77)[_0xbbc5('0x1a')]();};}function respondWithResult(_0x37d3ab,_0x49b632){_0x49b632=_0x49b632||0xc8;return function(_0x6c24c7){if(_0x6c24c7){return _0x37d3ab[_0xbbc5('0x1b')](_0x49b632)[_0xbbc5('0x1c')](_0x6c24c7);}};}function respondWithFilteredResult(_0x189efc,_0x3d0bae){return function(_0x131f71){if(_0x131f71){var _0x2d0d6a=_0x131f71[_0xbbc5('0x1d')],_0x2f3bb=_0x3d0bae[_0xbbc5('0x1e')],_0x10123b=_0x3d0bae[_0xbbc5('0x1e')]+_0x3d0bae[_0xbbc5('0x1f')],_0x2eb041;if(_0x10123b>=_0x2d0d6a){_0x10123b=_0x2d0d6a;_0x2eb041=0xc8;}else{_0x2eb041=0xce;}_0x189efc[_0xbbc5('0x1b')](_0x2eb041);return _0x189efc[_0xbbc5('0x20')](_0xbbc5('0x21'),_0x2f3bb+'-'+_0x10123b+'/'+_0x2d0d6a)[_0xbbc5('0x1c')](_0x131f71);}return null;};}function patchUpdates(_0x4eba6d){return function(_0x23e595){try{jsonpatch[_0xbbc5('0x22')](_0x23e595,_0x4eba6d,!![]);}catch(_0x4d4d8b){return BPromise[_0xbbc5('0x23')](_0x4d4d8b);}return _0x23e595[_0xbbc5('0x24')]();};}function saveUpdates(_0x8a2067,_0xcf8c86){return function(_0x549a6b){if(_0x549a6b){return _0x549a6b['update'](_0x8a2067)[_0xbbc5('0x25')](function(_0x906c4d){return _0x906c4d;});}return null;};}function removeEntity(_0x4a9827,_0x15632a){return function(_0x5cdaec){if(_0x5cdaec){return _0x5cdaec['destroy']()[_0xbbc5('0x25')](function(){_0x4a9827[_0xbbc5('0x1b')](0xcc)[_0xbbc5('0x1a')]();});}};}function handleEntityNotFound(_0x202668,_0xe332da){return function(_0x130224){if(!_0x130224){_0x202668[_0xbbc5('0x19')](0x194);}return _0x130224;};}function handleError(_0x2eff61,_0x51b170){_0x51b170=_0x51b170||0x1f4;return function(_0x5291dd){logger[_0xbbc5('0x26')](_0x5291dd[_0xbbc5('0x27')]);if(_0x5291dd[_0xbbc5('0x28')]){delete _0x5291dd[_0xbbc5('0x28')];}_0x2eff61[_0xbbc5('0x1b')](_0x51b170)[_0xbbc5('0x29')](_0x5291dd);};}exports[_0xbbc5('0x2a')]=function(_0xe2b2cd,_0x226268){var _0x4b1430={},_0x547382={},_0x1aaddc={'count':0x0,'rows':[]};var _0x5aed36=_[_0xbbc5('0x2b')](db[_0xbbc5('0x2c')][_0xbbc5('0x2d')],function(_0x3c78c5){return{'name':_0x3c78c5[_0xbbc5('0x2e')],'type':_0x3c78c5['type'][_0xbbc5('0x2f')]};});_0x547382[_0xbbc5('0x30')]=_[_0xbbc5('0x2b')](_0x5aed36,_0xbbc5('0x28'));_0x547382[_0xbbc5('0x31')]=_[_0xbbc5('0x32')](_0xe2b2cd['query']);_0x547382[_0xbbc5('0x33')]=_[_0xbbc5('0x34')](_0x547382[_0xbbc5('0x30')],_0x547382[_0xbbc5('0x31')]);_0x4b1430[_0xbbc5('0x35')]=_[_0xbbc5('0x34')](_0x547382[_0xbbc5('0x30')],qs[_0xbbc5('0x36')](_0xe2b2cd[_0xbbc5('0x31')]['fields']));_0x4b1430[_0xbbc5('0x35')]=_0x4b1430['attributes']['length']?_0x4b1430[_0xbbc5('0x35')]:_0x547382['model'];if(!_0xe2b2cd[_0xbbc5('0x31')][_0xbbc5('0x37')](_0xbbc5('0x38'))){_0x4b1430[_0xbbc5('0x1f')]=qs['limit'](_0xe2b2cd[_0xbbc5('0x31')]['limit']);_0x4b1430[_0xbbc5('0x1e')]=qs[_0xbbc5('0x1e')](_0xe2b2cd['query'][_0xbbc5('0x1e')]);}_0x4b1430[_0xbbc5('0x39')]=qs[_0xbbc5('0x3a')](_0xe2b2cd[_0xbbc5('0x31')][_0xbbc5('0x3a')]);_0x4b1430['where']=qs[_0xbbc5('0x33')](_[_0xbbc5('0x3b')](_0xe2b2cd['query'],_0x547382[_0xbbc5('0x33')]),_0x5aed36);if(_0xe2b2cd[_0xbbc5('0x31')]['filter']){_0x4b1430[_0xbbc5('0x3c')]=_[_0xbbc5('0x3d')](_0x4b1430[_0xbbc5('0x3c')],{'$or':_[_0xbbc5('0x2b')](_0x5aed36,function(_0x2b1649){if(_0x2b1649[_0xbbc5('0x3e')]!==_0xbbc5('0x3f')){var _0xe50452={};_0xe50452[_0x2b1649[_0xbbc5('0x28')]]={'$like':'%'+_0xe2b2cd[_0xbbc5('0x31')][_0xbbc5('0x40')]+'%'};return _0xe50452;}})});}_0x4b1430=_['merge']({},_0x4b1430,_0xe2b2cd[_0xbbc5('0x41')]);var _0x5f507d={'where':_0x4b1430[_0xbbc5('0x3c')]};return db['MemberReport'][_0xbbc5('0x1d')](_0x5f507d)[_0xbbc5('0x25')](function(_0x674743){_0x1aaddc[_0xbbc5('0x1d')]=_0x674743;if(_0xe2b2cd[_0xbbc5('0x31')][_0xbbc5('0x42')]){_0x4b1430['include']=[{'all':!![]}];}return db[_0xbbc5('0x2c')][_0xbbc5('0x43')](_0x4b1430);})[_0xbbc5('0x25')](function(_0x5a7cd0){_0x1aaddc['rows']=_0x5a7cd0;return _0x1aaddc;})[_0xbbc5('0x25')](respondWithFilteredResult(_0x226268,_0x4b1430))[_0xbbc5('0x44')](handleError(_0x226268,null));};exports[_0xbbc5('0x45')]=function(_0x7a9553,_0x1bb719){var _0xe51eba={'raw':!![],'where':{'id':_0x7a9553[_0xbbc5('0x46')]['id']}},_0x484532={};_0x484532['model']=_['keys'](db['MemberReport'][_0xbbc5('0x2d')]);_0x484532['query']=_[_0xbbc5('0x32')](_0x7a9553[_0xbbc5('0x31')]);_0x484532[_0xbbc5('0x33')]=_[_0xbbc5('0x34')](_0x484532['model'],_0x484532[_0xbbc5('0x31')]);_0xe51eba[_0xbbc5('0x35')]=_[_0xbbc5('0x34')](_0x484532[_0xbbc5('0x30')],qs[_0xbbc5('0x36')](_0x7a9553[_0xbbc5('0x31')]['fields']));_0xe51eba[_0xbbc5('0x35')]=_0xe51eba[_0xbbc5('0x35')]['length']?_0xe51eba[_0xbbc5('0x35')]:_0x484532[_0xbbc5('0x30')];if(_0x7a9553['query'][_0xbbc5('0x42')]){_0xe51eba[_0xbbc5('0x47')]=[{'all':!![]}];}_0xe51eba=_['merge']({},_0xe51eba,_0x7a9553[_0xbbc5('0x41')]);return db['MemberReport'][_0xbbc5('0x48')](_0xe51eba)[_0xbbc5('0x25')](handleEntityNotFound(_0x1bb719,null))[_0xbbc5('0x25')](respondWithResult(_0x1bb719,null))[_0xbbc5('0x44')](handleError(_0x1bb719,null));};exports[_0xbbc5('0x49')]=function(_0x49a2a3,_0x19a94b){return db[_0xbbc5('0x2c')]['create'](_0x49a2a3[_0xbbc5('0x4a')],{})[_0xbbc5('0x25')](respondWithResult(_0x19a94b,0xc9))['catch'](handleError(_0x19a94b,null));};exports[_0xbbc5('0x4b')]=function(_0x1ac4a5,_0x4de923){if(_0x1ac4a5[_0xbbc5('0x4a')]['id']){delete _0x1ac4a5[_0xbbc5('0x4a')]['id'];}return db[_0xbbc5('0x2c')][_0xbbc5('0x48')]({'where':{'id':_0x1ac4a5[_0xbbc5('0x46')]['id']}})[_0xbbc5('0x25')](handleEntityNotFound(_0x4de923,null))[_0xbbc5('0x25')](saveUpdates(_0x1ac4a5[_0xbbc5('0x4a')],null))[_0xbbc5('0x25')](respondWithResult(_0x4de923,null))[_0xbbc5('0x44')](handleError(_0x4de923,null));};exports[_0xbbc5('0x4c')]=function(_0x6ce44a,_0x154e13){return db['MemberReport'][_0xbbc5('0x48')]({'where':{'id':_0x6ce44a[_0xbbc5('0x46')]['id']}})[_0xbbc5('0x25')](handleEntityNotFound(_0x154e13,null))['then'](removeEntity(_0x154e13,null))[_0xbbc5('0x44')](handleError(_0x154e13,null));};exports[_0xbbc5('0x4d')]=function(_0x4f2292,_0x492e8b){return db[_0xbbc5('0x2c')][_0xbbc5('0x4d')]()[_0xbbc5('0x25')](respondWithResult(_0x492e8b,null))[_0xbbc5('0x44')](handleError(_0x492e8b,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 8766655..a864a23 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 _0x6aa7=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','MemberReport','report_member','membername','interface','lodash'];(function(_0x3599b4,_0x39c228){var _0x5bf923=function(_0x4d0392){while(--_0x4d0392){_0x3599b4['push'](_0x3599b4['shift']());}};_0x5bf923(++_0x39c228);}(_0x6aa7,0x178));var _0x76aa=function(_0x1be3ba,_0x562e06){_0x1be3ba=_0x1be3ba-0x0;var _0x24bb7b=_0x6aa7[_0x1be3ba];return _0x24bb7b;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./memberReport.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x76aa('0xb'),_0x76aa('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe0ae=['membername','../../config/logger','api','bluebird','path','rimraf','./memberReport.attributes','define','MemberReport','report_member'];(function(_0x141cdc,_0xa038e9){var _0x2d7d88=function(_0x5d161f){while(--_0x5d161f){_0x141cdc['push'](_0x141cdc['shift']());}};_0x2d7d88(++_0xa038e9);}(_0xe0ae,0xa1));var _0xee0a=function(_0x3f7598,_0x212e37){_0x3f7598=_0x3f7598-0x0;var _0x51fb16=_0xe0ae[_0x3f7598];return _0x51fb16;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xee0a('0x0'))(_0xee0a('0x1'));var moment=require('moment');var BPromise=require(_0xee0a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xee0a('0x3'));var rimraf=require(_0xee0a('0x4'));var config=require('../../config/environment');var attributes=require(_0xee0a('0x5'));module['exports']=function(_0x5bef07,_0x39a302){return _0x5bef07[_0xee0a('0x6')](_0xee0a('0x7'),attributes,{'tableName':_0xee0a('0x8'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xee0a('0x9'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 1f99062..9fa2776 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 _0x997c=['http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','model','map','CreateMemberReport','create','body','stringify','UpdateMemberReport','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x4bacd4,_0x420a56){var _0x52f4a8=function(_0xc9b9ba){while(--_0xc9b9ba){_0x4bacd4['push'](_0x4bacd4['shift']());}};_0x52f4a8(++_0x420a56);}(_0x997c,0x15f));var _0xc997=function(_0x11844e,_0x5b191d){_0x11844e=_0x11844e-0x0;var _0x269fff=_0x997c[_0x11844e];return _0x269fff;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc997('0x0'));var BPromise=require(_0xc997('0x1'));var rs=require(_0xc997('0x2'));var fs=require('fs');var Redis=require(_0xc997('0x3'));var db=require(_0xc997('0x4'))['db'];var utils=require(_0xc997('0x5'));var logger=require(_0xc997('0x6'))(_0xc997('0x7'));var config=require('../../config/environment');var jayson=require(_0xc997('0x8'));var client=jayson['client'][_0xc997('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x31fea9,_0x1594d8,_0x59c498){return new BPromise(function(_0xfa9e44,_0x41b66f){return client['request'](_0x31fea9,_0x59c498)[_0xc997('0xa')](function(_0x3f8418){logger[_0xc997('0xb')](_0xc997('0xc'),_0x1594d8,_0xc997('0xd'));logger[_0xc997('0xe')](_0xc997('0xf'),_0x1594d8,_0xc997('0xd'),JSON['stringify'](_0x3f8418));if(_0x3f8418[_0xc997('0x10')]){if(_0x3f8418[_0xc997('0x10')]['code']===0x1f4){logger['error'](_0xc997('0xc'),_0x1594d8,_0x3f8418[_0xc997('0x10')][_0xc997('0x11')]);return _0x41b66f(_0x3f8418[_0xc997('0x10')][_0xc997('0x11')]);}logger[_0xc997('0x10')]('MemberReport,\x20%s,\x20%s',_0x1594d8,_0x3f8418[_0xc997('0x10')][_0xc997('0x11')]);return _0xfa9e44(_0x3f8418[_0xc997('0x10')][_0xc997('0x11')]);}else{logger[_0xc997('0xb')](_0xc997('0xc'),_0x1594d8,'request\x20sent');_0xfa9e44(_0x3f8418[_0xc997('0x12')]['message']);}})[_0xc997('0x13')](function(_0x70b143){logger[_0xc997('0x10')](_0xc997('0xc'),_0x1594d8,_0x70b143);_0x41b66f(_0x70b143);});});}exports[_0xc997('0x14')]=function(_0x1889ad){var _0x4fbb8c=this;return new Promise(function(_0x4ec7db,_0x549d6b){return db[_0xc997('0x15')][_0xc997('0x16')]({'raw':_0x1889ad[_0xc997('0x17')]?_0x1889ad[_0xc997('0x17')][_0xc997('0x18')]===undefined?!![]:![]:!![],'where':_0x1889ad['options']?_0x1889ad[_0xc997('0x17')][_0xc997('0x19')]||null:null,'attributes':_0x1889ad[_0xc997('0x17')]?_0x1889ad[_0xc997('0x17')][_0xc997('0x1a')]||null:null,'limit':_0x1889ad[_0xc997('0x17')]?_0x1889ad[_0xc997('0x17')][_0xc997('0x1b')]||null:null,'include':_0x1889ad['options']?_0x1889ad['options']['include']?_['map'](_0x1889ad['options']['include'],function(_0x4d3403){return{'model':db[_0x4d3403['model']],'as':_0x4d3403['as'],'attributes':_0x4d3403['attributes'],'include':_0x4d3403[_0xc997('0x1c')]?_['map'](_0x4d3403[_0xc997('0x1c')],function(_0x7d859d){return{'model':db[_0x7d859d[_0xc997('0x1d')]],'as':_0x7d859d['as'],'attributes':_0x7d859d[_0xc997('0x1a')],'include':_0x7d859d[_0xc997('0x1c')]?_[_0xc997('0x1e')](_0x7d859d['include'],function(_0x1d4fea){return{'model':db[_0x1d4fea[_0xc997('0x1d')]],'as':_0x1d4fea['as'],'attributes':_0x1d4fea[_0xc997('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc997('0xa')](function(_0x1a6f0f){logger[_0xc997('0xb')]('GetMemberReport',_0x1889ad);logger[_0xc997('0xe')]('GetMemberReport',_0x1889ad,JSON['stringify'](_0x1a6f0f));_0x4ec7db(_0x1a6f0f);})[_0xc997('0x13')](function(_0x1f7df4){logger[_0xc997('0x10')](_0xc997('0x14'),_0x1f7df4['message'],_0x1889ad);_0x549d6b(_0x4fbb8c[_0xc997('0x10')](0x1f4,_0x1f7df4[_0xc997('0x11')]));});});};exports[_0xc997('0x1f')]=function(_0x7812a2){var _0x25ea89=this;return new Promise(function(_0x145d07,_0x3c41d0){return db[_0xc997('0x15')][_0xc997('0x20')](_0x7812a2[_0xc997('0x21')],{'raw':_0x7812a2[_0xc997('0x17')]?_0x7812a2[_0xc997('0x17')][_0xc997('0x18')]===undefined?!![]:![]:!![]})[_0xc997('0xa')](function(_0x315b08){logger[_0xc997('0xb')](_0xc997('0x1f'),_0x7812a2);logger[_0xc997('0xe')](_0xc997('0x1f'),_0x7812a2,JSON[_0xc997('0x22')](_0x315b08));_0x145d07(_0x315b08);})[_0xc997('0x13')](function(_0x414c1f){logger[_0xc997('0x10')](_0xc997('0x1f'),_0x414c1f[_0xc997('0x11')],_0x7812a2);_0x3c41d0(_0x25ea89[_0xc997('0x10')](0x1f4,_0x414c1f['message']));});});};exports[_0xc997('0x23')]=function(_0x4347e7){var _0x312d37=this;return new Promise(function(_0x177e4b,_0x1ad368){return db[_0xc997('0x15')]['update'](_0x4347e7['body'],{'raw':_0x4347e7[_0xc997('0x17')]?_0x4347e7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4347e7['options']?_0x4347e7[_0xc997('0x17')][_0xc997('0x19')]||null:null,'attributes':_0x4347e7[_0xc997('0x17')]?_0x4347e7[_0xc997('0x17')][_0xc997('0x1a')]||null:null,'limit':_0x4347e7['options']?_0x4347e7[_0xc997('0x17')][_0xc997('0x1b')]||null:null})[_0xc997('0xa')](function(_0x1d06c7){logger[_0xc997('0xb')](_0xc997('0x23'),_0x4347e7);logger[_0xc997('0xe')](_0xc997('0x23'),_0x4347e7,JSON[_0xc997('0x22')](_0x1d06c7));_0x177e4b(_0x1d06c7);})['catch'](function(_0x2636ce){logger[_0xc997('0x10')](_0xc997('0x23'),_0x2636ce[_0xc997('0x11')],_0x4347e7);_0x1ad368(_0x312d37[_0xc997('0x10')](0x1f4,_0x2636ce['message']));});});}; \ No newline at end of file +var _0x7fae=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','attributes','limit','include','model','map','info','debug','create','body','then','CreateMemberReport','stringify','UpdateMemberReport','update','where','util','moment','bluebird','randomstring'];(function(_0x2a24d9,_0x15a0d0){var _0x14c2d3=function(_0x4c6038){while(--_0x4c6038){_0x2a24d9['push'](_0x2a24d9['shift']());}};_0x14c2d3(++_0x15a0d0);}(_0x7fae,0x16d));var _0xe7fa=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x7fae[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require(_0xe7fa('0x0'));var moment=require(_0xe7fa('0x1'));var BPromise=require(_0xe7fa('0x2'));var rs=require(_0xe7fa('0x3'));var fs=require('fs');var Redis=require(_0xe7fa('0x4'));var db=require(_0xe7fa('0x5'))['db'];var utils=require(_0xe7fa('0x6'));var logger=require(_0xe7fa('0x7'))(_0xe7fa('0x8'));var config=require(_0xe7fa('0x9'));var jayson=require(_0xe7fa('0xa'));var client=jayson['client'][_0xe7fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x141040,_0x58d107,_0xa89ae1){return new BPromise(function(_0x4ee0f2,_0x4dc051){return client[_0xe7fa('0xc')](_0x141040,_0xa89ae1)['then'](function(_0x9a0675){logger['info'](_0xe7fa('0xd'),_0x58d107,_0xe7fa('0xe'));logger['debug'](_0xe7fa('0xf'),_0x58d107,_0xe7fa('0xe'),JSON['stringify'](_0x9a0675));if(_0x9a0675[_0xe7fa('0x10')]){if(_0x9a0675[_0xe7fa('0x10')][_0xe7fa('0x11')]===0x1f4){logger[_0xe7fa('0x10')]('MemberReport,\x20%s,\x20%s',_0x58d107,_0x9a0675[_0xe7fa('0x10')][_0xe7fa('0x12')]);return _0x4dc051(_0x9a0675[_0xe7fa('0x10')][_0xe7fa('0x12')]);}logger[_0xe7fa('0x10')](_0xe7fa('0xd'),_0x58d107,_0x9a0675[_0xe7fa('0x10')]['message']);return _0x4ee0f2(_0x9a0675[_0xe7fa('0x10')][_0xe7fa('0x12')]);}else{logger['info'](_0xe7fa('0xd'),_0x58d107,_0xe7fa('0xe'));_0x4ee0f2(_0x9a0675[_0xe7fa('0x13')][_0xe7fa('0x12')]);}})[_0xe7fa('0x14')](function(_0x24203a){logger[_0xe7fa('0x10')]('MemberReport,\x20%s,\x20%s',_0x58d107,_0x24203a);_0x4dc051(_0x24203a);});});}exports[_0xe7fa('0x15')]=function(_0x37d756){var _0x101581=this;return new Promise(function(_0xcde3d0,_0x1d8900){return db[_0xe7fa('0x16')][_0xe7fa('0x17')]({'raw':_0x37d756[_0xe7fa('0x18')]?_0x37d756[_0xe7fa('0x18')][_0xe7fa('0x19')]===undefined?!![]:![]:!![],'where':_0x37d756[_0xe7fa('0x18')]?_0x37d756[_0xe7fa('0x18')]['where']||null:null,'attributes':_0x37d756[_0xe7fa('0x18')]?_0x37d756[_0xe7fa('0x18')][_0xe7fa('0x1a')]||null:null,'limit':_0x37d756[_0xe7fa('0x18')]?_0x37d756['options'][_0xe7fa('0x1b')]||null:null,'include':_0x37d756['options']?_0x37d756[_0xe7fa('0x18')][_0xe7fa('0x1c')]?_['map'](_0x37d756['options']['include'],function(_0x26d2c2){return{'model':db[_0x26d2c2[_0xe7fa('0x1d')]],'as':_0x26d2c2['as'],'attributes':_0x26d2c2[_0xe7fa('0x1a')],'include':_0x26d2c2['include']?_[_0xe7fa('0x1e')](_0x26d2c2[_0xe7fa('0x1c')],function(_0x4556a0){return{'model':db[_0x4556a0[_0xe7fa('0x1d')]],'as':_0x4556a0['as'],'attributes':_0x4556a0[_0xe7fa('0x1a')],'include':_0x4556a0[_0xe7fa('0x1c')]?_[_0xe7fa('0x1e')](_0x4556a0[_0xe7fa('0x1c')],function(_0x436867){return{'model':db[_0x436867['model']],'as':_0x436867['as'],'attributes':_0x436867['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x45da8f){logger[_0xe7fa('0x1f')]('GetMemberReport',_0x37d756);logger[_0xe7fa('0x20')]('GetMemberReport',_0x37d756,JSON['stringify'](_0x45da8f));_0xcde3d0(_0x45da8f);})['catch'](function(_0x53abb8){logger[_0xe7fa('0x10')](_0xe7fa('0x15'),_0x53abb8['message'],_0x37d756);_0x1d8900(_0x101581[_0xe7fa('0x10')](0x1f4,_0x53abb8[_0xe7fa('0x12')]));});});};exports['CreateMemberReport']=function(_0x2478f8){var _0x4833d8=this;return new Promise(function(_0x3f8947,_0x5a1e9e){return db[_0xe7fa('0x16')][_0xe7fa('0x21')](_0x2478f8[_0xe7fa('0x22')],{'raw':_0x2478f8[_0xe7fa('0x18')]?_0x2478f8[_0xe7fa('0x18')][_0xe7fa('0x19')]===undefined?!![]:![]:!![]})[_0xe7fa('0x23')](function(_0xbdebf7){logger[_0xe7fa('0x1f')](_0xe7fa('0x24'),_0x2478f8);logger[_0xe7fa('0x20')]('CreateMemberReport',_0x2478f8,JSON[_0xe7fa('0x25')](_0xbdebf7));_0x3f8947(_0xbdebf7);})[_0xe7fa('0x14')](function(_0x432bb0){logger[_0xe7fa('0x10')]('CreateMemberReport',_0x432bb0[_0xe7fa('0x12')],_0x2478f8);_0x5a1e9e(_0x4833d8[_0xe7fa('0x10')](0x1f4,_0x432bb0[_0xe7fa('0x12')]));});});};exports[_0xe7fa('0x26')]=function(_0x272896){var _0xcae4b6=this;return new Promise(function(_0x58189e,_0x145678){return db[_0xe7fa('0x16')][_0xe7fa('0x27')](_0x272896['body'],{'raw':_0x272896['options']?_0x272896[_0xe7fa('0x18')][_0xe7fa('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x272896[_0xe7fa('0x18')]?_0x272896[_0xe7fa('0x18')][_0xe7fa('0x28')]||null:null,'attributes':_0x272896[_0xe7fa('0x18')]?_0x272896[_0xe7fa('0x18')]['attributes']||null:null,'limit':_0x272896[_0xe7fa('0x18')]?_0x272896[_0xe7fa('0x18')][_0xe7fa('0x1b')]||null:null})['then'](function(_0x1d0b8e){logger[_0xe7fa('0x1f')]('UpdateMemberReport',_0x272896);logger['debug'](_0xe7fa('0x26'),_0x272896,JSON[_0xe7fa('0x25')](_0x1d0b8e));_0x58189e(_0x1d0b8e);})[_0xe7fa('0x14')](function(_0xab577b){logger[_0xe7fa('0x10')](_0xe7fa('0x26'),_0xab577b[_0xe7fa('0x12')],_0x272896);_0x145678(_0xcae4b6[_0xe7fa('0x10')](0x1f4,_0xab577b[_0xe7fa('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 4532161..2174443 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 _0x1be1=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','exports','path','connect-timeout','Router'];(function(_0x28c0a2,_0x3b3f3b){var _0x26a0b9=function(_0x2f8323){while(--_0x2f8323){_0x28c0a2['push'](_0x28c0a2['shift']());}};_0x26a0b9(++_0x3b3f3b);}(_0x1be1,0x192));var _0x11be=function(_0x458ef3,_0x1c90ff){_0x458ef3=_0x458ef3-0x0;var _0x4a047b=_0x1be1[_0x458ef3];return _0x4a047b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var auth=require(_0x11be('0x3'));var interaction=require(_0x11be('0x4'));var config=require(_0x11be('0x5'));var controller=require('./migration.controller');router[_0x11be('0x6')]('/',controller[_0x11be('0x7')]);module[_0x11be('0x8')]=router; \ No newline at end of file +var _0x0102=['connect-timeout','express','get','index','exports','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0102,0x186));var _0x2010=function(_0x244bdb,_0x1ac118){_0x244bdb=_0x244bdb-0x0;var _0x417115=_0x0102[_0x244bdb];return _0x417115;};'use strict';var multer=require('multer');var util=require(_0x2010('0x0'));var path=require(_0x2010('0x1'));var timeout=require(_0x2010('0x2'));var express=require(_0x2010('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('./migration.controller');router[_0x2010('0x4')]('/',controller[_0x2010('0x5')]);module[_0x2010('0x6')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index b4ad428..da68fc1 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 _0xcd31=['version','sequelize','exports'];(function(_0x34aef1,_0x19926f){var _0x1cf483=function(_0x554ad1){while(--_0x554ad1){_0x34aef1['push'](_0x34aef1['shift']());}};_0x1cf483(++_0x19926f);}(_0xcd31,0x79));var _0x1cd3=function(_0x548ccc,_0x4d9f9b){_0x548ccc=_0x548ccc-0x0;var _0x3e43e8=_0xcd31[_0x548ccc];return _0x3e43e8;};'use strict';var Sequelize=require(_0x1cd3('0x0'));module[_0x1cd3('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x1cd3('0x2')}}; \ No newline at end of file +var _0x6123=['exports','STRING','version'];(function(_0x58e074,_0x41a1ec){var _0x2e937d=function(_0x408979){while(--_0x408979){_0x58e074['push'](_0x58e074['shift']());}};_0x2e937d(++_0x41a1ec);}(_0x6123,0x1d7));var _0x3612=function(_0x11ee71,_0x4eef5c){_0x11ee71=_0x11ee71-0x0;var _0x57ffd6=_0x6123[_0x11ee71];return _0x57ffd6;};'use strict';var Sequelize=require('sequelize');module[_0x3612('0x0')]={'version':{'type':Sequelize[_0x3612('0x1')],'unique':_0x3612('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 8ffdae0..aabbc24 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 _0x00bb=['html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','end','json','count','offset','Content-Range','apply','update','then','destroy','error','stack','map','Migration','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','catch'];(function(_0x3430aa,_0x57cd92){var _0x2ac5c=function(_0x3068dd){while(--_0x3068dd){_0x3430aa['push'](_0x3430aa['shift']());}};_0x2ac5c(++_0x57cd92);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x00bb[_0x4cf98e];return _0x1623ac;};'use strict';var pdf=require(_0xb00b('0x0'));var emlformat=require(_0xb00b('0x1'));var rimraf=require(_0xb00b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb00b('0x3'));var rp=require('request-promise');var moment=require(_0xb00b('0x4'));var BPromise=require(_0xb00b('0x5'));var Mustache=require('mustache');var util=require(_0xb00b('0x6'));var path=require(_0xb00b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ff792,_0x2d8ddf){_0x2d8ddf=_0x2d8ddf||0xcc;return function(_0x1be8aa){if(_0x1be8aa){return _0x4ff792[_0xb00b('0x14')](_0x2d8ddf);}return _0x4ff792[_0xb00b('0x15')](_0x2d8ddf)[_0xb00b('0x16')]();};}function respondWithResult(_0x4ada81,_0x218de2){_0x218de2=_0x218de2||0xc8;return function(_0xb0d42e){if(_0xb0d42e){return _0x4ada81['status'](_0x218de2)[_0xb00b('0x17')](_0xb0d42e);}};}function respondWithFilteredResult(_0x1084a6,_0x540b79){return function(_0x5da36b){if(_0x5da36b){var _0x9b471e=_0x5da36b[_0xb00b('0x18')],_0x4dcd45=_0x540b79[_0xb00b('0x19')],_0x51d136=_0x540b79[_0xb00b('0x19')]+_0x540b79['limit'],_0x1f9c78;if(_0x51d136>=_0x9b471e){_0x51d136=_0x9b471e;_0x1f9c78=0xc8;}else{_0x1f9c78=0xce;}_0x1084a6[_0xb00b('0x15')](_0x1f9c78);return _0x1084a6['set'](_0xb00b('0x1a'),_0x4dcd45+'-'+_0x51d136+'/'+_0x9b471e)['json'](_0x5da36b);}return null;};}function patchUpdates(_0x25d7a0){return function(_0x5e8d7b){try{jsonpatch[_0xb00b('0x1b')](_0x5e8d7b,_0x25d7a0,!![]);}catch(_0x3355a3){return BPromise['reject'](_0x3355a3);}return _0x5e8d7b['save']();};}function saveUpdates(_0x2b0da1,_0x4a334b){return function(_0x1344c4){if(_0x1344c4){return _0x1344c4[_0xb00b('0x1c')](_0x2b0da1)[_0xb00b('0x1d')](function(_0x3501af){return _0x3501af;});}return null;};}function removeEntity(_0x56c189,_0x362ee0){return function(_0x4df284){if(_0x4df284){return _0x4df284[_0xb00b('0x1e')]()[_0xb00b('0x1d')](function(){_0x56c189['status'](0xcc)[_0xb00b('0x16')]();});}};}function handleEntityNotFound(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(!_0x3ab3cc){_0x2896d1[_0xb00b('0x14')](0x194);}return _0x3ab3cc;};}function handleError(_0x5568bb,_0x44efe5){_0x44efe5=_0x44efe5||0x1f4;return function(_0x243fdb){logger[_0xb00b('0x1f')](_0x243fdb[_0xb00b('0x20')]);if(_0x243fdb['name']){delete _0x243fdb['name'];}_0x5568bb[_0xb00b('0x15')](_0x44efe5)['send'](_0x243fdb);};}exports['index']=function(_0x4a635e,_0x16ac55){var _0x73b6b0={},_0x2592cf={},_0x3825af={'count':0x0,'rows':[]};var _0x1f14fa=_[_0xb00b('0x21')](db[_0xb00b('0x22')]['rawAttributes'],function(_0x22c22d){return{'name':_0x22c22d['fieldName'],'type':_0x22c22d[_0xb00b('0x23')][_0xb00b('0x24')]};});_0x2592cf[_0xb00b('0x25')]=_['map'](_0x1f14fa,_0xb00b('0x26'));_0x2592cf[_0xb00b('0x27')]=_[_0xb00b('0x28')](_0x4a635e[_0xb00b('0x27')]);_0x2592cf[_0xb00b('0x29')]=_[_0xb00b('0x2a')](_0x2592cf[_0xb00b('0x25')],_0x2592cf[_0xb00b('0x27')]);_0x73b6b0[_0xb00b('0x2b')]=_['intersection'](_0x2592cf[_0xb00b('0x25')],qs[_0xb00b('0x2c')](_0x4a635e['query'][_0xb00b('0x2c')]));_0x73b6b0[_0xb00b('0x2b')]=_0x73b6b0['attributes'][_0xb00b('0x2d')]?_0x73b6b0['attributes']:_0x2592cf[_0xb00b('0x25')];if(!_0x4a635e[_0xb00b('0x27')][_0xb00b('0x2e')](_0xb00b('0x2f'))){_0x73b6b0[_0xb00b('0x30')]=qs[_0xb00b('0x30')](_0x4a635e[_0xb00b('0x27')]['limit']);_0x73b6b0['offset']=qs['offset'](_0x4a635e[_0xb00b('0x27')][_0xb00b('0x19')]);}_0x73b6b0[_0xb00b('0x31')]=qs[_0xb00b('0x32')](_0x4a635e['query'][_0xb00b('0x32')]);_0x73b6b0[_0xb00b('0x33')]=qs[_0xb00b('0x29')](_[_0xb00b('0x34')](_0x4a635e[_0xb00b('0x27')],_0x2592cf[_0xb00b('0x29')]),_0x1f14fa);if(_0x4a635e[_0xb00b('0x27')][_0xb00b('0x35')]){_0x73b6b0['where']=_['merge'](_0x73b6b0[_0xb00b('0x33')],{'$or':_['map'](_0x1f14fa,function(_0x1c8258){if(_0x1c8258[_0xb00b('0x23')]!==_0xb00b('0x36')){var _0x45ca74={};_0x45ca74[_0x1c8258[_0xb00b('0x26')]]={'$like':'%'+_0x4a635e[_0xb00b('0x27')][_0xb00b('0x35')]+'%'};return _0x45ca74;}})});}_0x73b6b0=_['merge']({},_0x73b6b0,_0x4a635e[_0xb00b('0x37')]);var _0x25578e={'where':_0x73b6b0[_0xb00b('0x33')]};return db[_0xb00b('0x22')][_0xb00b('0x18')](_0x25578e)[_0xb00b('0x1d')](function(_0x59fb00){_0x3825af[_0xb00b('0x18')]=_0x59fb00;if(_0x4a635e[_0xb00b('0x27')]['includeAll']){_0x73b6b0[_0xb00b('0x38')]=[{'all':!![]}];}return db[_0xb00b('0x22')][_0xb00b('0x39')](_0x73b6b0);})[_0xb00b('0x1d')](function(_0x2954e8){_0x3825af['rows']=_0x2954e8;return _0x3825af;})[_0xb00b('0x1d')](respondWithFilteredResult(_0x16ac55,_0x73b6b0))[_0xb00b('0x3a')](handleError(_0x16ac55,null));}; \ No newline at end of file +var _0x70e0=['desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','end','stack','send','index','map','Migration','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','name','merge','options','count','includeAll','findAll','rows','catch','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce'];(function(_0x268916,_0x1c27e1){var _0x38f8a4=function(_0x5e9ea6){while(--_0x5e9ea6){_0x268916['push'](_0x268916['shift']());}};_0x38f8a4(++_0x1c27e1);}(_0x70e0,0x17b));var _0x070e=function(_0x5255b9,_0x11b5f5){_0x5255b9=_0x5255b9-0x0;var _0x53e23c=_0x70e0[_0x5255b9];return _0x53e23c;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var db=require(_0x070e('0x15'))['db'];function respondWithStatusCode(_0x1baa12,_0x39d2b9){_0x39d2b9=_0x39d2b9||0xcc;return function(_0x5bf079){if(_0x5bf079){return _0x1baa12[_0x070e('0x16')](_0x39d2b9);}return _0x1baa12['status'](_0x39d2b9)['end']();};}function respondWithResult(_0x24baba,_0x56c7ba){_0x56c7ba=_0x56c7ba||0xc8;return function(_0x4a33d2){if(_0x4a33d2){return _0x24baba['status'](_0x56c7ba)[_0x070e('0x17')](_0x4a33d2);}};}function respondWithFilteredResult(_0x14c3fd,_0x51d14d){return function(_0x5d3a38){if(_0x5d3a38){var _0x373d86=_0x5d3a38['count'],_0xeae1a5=_0x51d14d['offset'],_0x180897=_0x51d14d[_0x070e('0x18')]+_0x51d14d[_0x070e('0x19')],_0x19d9da;if(_0x180897>=_0x373d86){_0x180897=_0x373d86;_0x19d9da=0xc8;}else{_0x19d9da=0xce;}_0x14c3fd[_0x070e('0x1a')](_0x19d9da);return _0x14c3fd[_0x070e('0x1b')](_0x070e('0x1c'),_0xeae1a5+'-'+_0x180897+'/'+_0x373d86)['json'](_0x5d3a38);}return null;};}function patchUpdates(_0x3938b5){return function(_0x168dc6){try{jsonpatch[_0x070e('0x1d')](_0x168dc6,_0x3938b5,!![]);}catch(_0x3ea105){return BPromise[_0x070e('0x1e')](_0x3ea105);}return _0x168dc6['save']();};}function saveUpdates(_0x5b2f48,_0x4e958f){return function(_0x9907cf){if(_0x9907cf){return _0x9907cf[_0x070e('0x1f')](_0x5b2f48)[_0x070e('0x20')](function(_0x4be0d7){return _0x4be0d7;});}return null;};}function removeEntity(_0x5b184,_0x5dc5d2){return function(_0xf8dd5d){if(_0xf8dd5d){return _0xf8dd5d[_0x070e('0x21')]()[_0x070e('0x20')](function(){_0x5b184[_0x070e('0x1a')](0xcc)[_0x070e('0x22')]();});}};}function handleEntityNotFound(_0xa86797,_0xe405e){return function(_0x164cdf){if(!_0x164cdf){_0xa86797['sendStatus'](0x194);}return _0x164cdf;};}function handleError(_0x2f8055,_0x270061){_0x270061=_0x270061||0x1f4;return function(_0x4790eb){logger['error'](_0x4790eb[_0x070e('0x23')]);if(_0x4790eb['name']){delete _0x4790eb['name'];}_0x2f8055[_0x070e('0x1a')](_0x270061)[_0x070e('0x24')](_0x4790eb);};}exports[_0x070e('0x25')]=function(_0x1743cc,_0x4763c6){var _0x497f58={},_0x374c54={},_0x219e48={'count':0x0,'rows':[]};var _0x1d72d6=_[_0x070e('0x26')](db[_0x070e('0x27')][_0x070e('0x28')],function(_0x1a1892){return{'name':_0x1a1892[_0x070e('0x29')],'type':_0x1a1892['type'][_0x070e('0x2a')]};});_0x374c54[_0x070e('0x2b')]=_[_0x070e('0x26')](_0x1d72d6,'name');_0x374c54['query']=_[_0x070e('0x2c')](_0x1743cc[_0x070e('0x2d')]);_0x374c54[_0x070e('0x2e')]=_['intersection'](_0x374c54[_0x070e('0x2b')],_0x374c54[_0x070e('0x2d')]);_0x497f58[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x374c54['model'],qs['fields'](_0x1743cc['query']['fields']));_0x497f58[_0x070e('0x2f')]=_0x497f58['attributes'][_0x070e('0x31')]?_0x497f58[_0x070e('0x2f')]:_0x374c54['model'];if(!_0x1743cc['query'][_0x070e('0x32')](_0x070e('0x33'))){_0x497f58['limit']=qs['limit'](_0x1743cc[_0x070e('0x2d')][_0x070e('0x19')]);_0x497f58[_0x070e('0x18')]=qs[_0x070e('0x18')](_0x1743cc[_0x070e('0x2d')]['offset']);}_0x497f58['order']=qs[_0x070e('0x34')](_0x1743cc[_0x070e('0x2d')][_0x070e('0x34')]);_0x497f58[_0x070e('0x35')]=qs[_0x070e('0x2e')](_['pick'](_0x1743cc[_0x070e('0x2d')],_0x374c54[_0x070e('0x2e')]),_0x1d72d6);if(_0x1743cc['query'][_0x070e('0x36')]){_0x497f58[_0x070e('0x35')]=_['merge'](_0x497f58['where'],{'$or':_['map'](_0x1d72d6,function(_0x363bff){if(_0x363bff[_0x070e('0x37')]!==_0x070e('0x38')){var _0x334733={};_0x334733[_0x363bff[_0x070e('0x39')]]={'$like':'%'+_0x1743cc['query'][_0x070e('0x36')]+'%'};return _0x334733;}})});}_0x497f58=_[_0x070e('0x3a')]({},_0x497f58,_0x1743cc[_0x070e('0x3b')]);var _0x487276={'where':_0x497f58[_0x070e('0x35')]};return db[_0x070e('0x27')][_0x070e('0x3c')](_0x487276)['then'](function(_0x13982f){_0x219e48[_0x070e('0x3c')]=_0x13982f;if(_0x1743cc['query'][_0x070e('0x3d')]){_0x497f58['include']=[{'all':!![]}];}return db[_0x070e('0x27')][_0x070e('0x3e')](_0x497f58);})[_0x070e('0x20')](function(_0x30319c){_0x219e48[_0x070e('0x3f')]=_0x30319c;return _0x219e48;})['then'](respondWithFilteredResult(_0x4763c6,_0x497f58))[_0x070e('0x40')](handleError(_0x4763c6,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index c1dc322..69645ac 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 _0x8664=['moment','bluebird','request-promise','path','rimraf','./migration.attributes','define','Migration','migrations','lodash','util','../../config/logger','api'];(function(_0x5976ed,_0x882b44){var _0x1a8f3b=function(_0xee2550){while(--_0xee2550){_0x5976ed['push'](_0x5976ed['shift']());}};_0x1a8f3b(++_0x882b44);}(_0x8664,0x11a));var _0x4866=function(_0x28aed4,_0x2e2f5c){_0x28aed4=_0x28aed4-0x0;var _0x2a1484=_0x8664[_0x28aed4];return _0x2a1484;};'use strict';var _=require(_0x4866('0x0'));var util=require(_0x4866('0x1'));var logger=require(_0x4866('0x2'))(_0x4866('0x3'));var moment=require(_0x4866('0x4'));var BPromise=require(_0x4866('0x5'));var rp=require(_0x4866('0x6'));var fs=require('fs');var path=require(_0x4866('0x7'));var rimraf=require(_0x4866('0x8'));var config=require('../../config/environment');var attributes=require(_0x4866('0x9'));module['exports']=function(_0x66b444,_0x3eb6f9){return _0x66b444[_0x4866('0xa')](_0x4866('0xb'),attributes,{'tableName':_0x4866('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x923c=['define','Migration','migrations','lodash','../../config/logger','api','request-promise','../../config/environment','./migration.attributes'];(function(_0x549a64,_0x3c4451){var _0x4dc885=function(_0x241af6){while(--_0x241af6){_0x549a64['push'](_0x549a64['shift']());}};_0x4dc885(++_0x3c4451);}(_0x923c,0x198));var _0xc923=function(_0x45c096,_0x3ca8f3){_0x45c096=_0x45c096-0x0;var _0x5ce684=_0x923c[_0x45c096];return _0x5ce684;};'use strict';var _=require(_0xc923('0x0'));var util=require('util');var logger=require(_0xc923('0x1'))(_0xc923('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc923('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc923('0x4'));var attributes=require(_0xc923('0x5'));module['exports']=function(_0x3a1844,_0xf77b41){return _0x3a1844[_0xc923('0x6')](_0xc923('0x7'),attributes,{'tableName':_0xc923('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 1866d9a..52223e3 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 _0xd4f4=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x51666b,_0x48e537){var _0x1858fa=function(_0x578ff0){while(--_0x578ff0){_0x51666b['push'](_0x51666b['shift']());}};_0x1858fa(++_0x48e537);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x24b71d,_0x5673a6){_0x24b71d=_0x24b71d-0x0;var _0x25e971=_0xd4f4[_0x24b71d];return _0x25e971;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var moment=require(_0x4d4f('0x2'));var BPromise=require(_0x4d4f('0x3'));var rs=require(_0x4d4f('0x4'));var fs=require('fs');var Redis=require(_0x4d4f('0x5'));var db=require(_0x4d4f('0x6'))['db'];var utils=require(_0x4d4f('0x7'));var logger=require(_0x4d4f('0x8'))(_0x4d4f('0x9'));var config=require(_0x4d4f('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d7aa8,_0xecc103,_0x150bd6){return new BPromise(function(_0xea29b,_0x40be66){return client[_0x4d4f('0xb')](_0x1d7aa8,_0x150bd6)[_0x4d4f('0xc')](function(_0x226837){logger[_0x4d4f('0xd')](_0x4d4f('0xe'),_0xecc103,_0x4d4f('0xf'));logger[_0x4d4f('0x10')](_0x4d4f('0x11'),_0xecc103,_0x4d4f('0xf'),JSON[_0x4d4f('0x12')](_0x226837));if(_0x226837[_0x4d4f('0x13')]){if(_0x226837[_0x4d4f('0x13')][_0x4d4f('0x14')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0xecc103,_0x226837['error'][_0x4d4f('0x15')]);return _0x40be66(_0x226837[_0x4d4f('0x13')]['message']);}logger[_0x4d4f('0x13')](_0x4d4f('0xe'),_0xecc103,_0x226837[_0x4d4f('0x13')]['message']);return _0xea29b(_0x226837[_0x4d4f('0x13')][_0x4d4f('0x15')]);}else{logger[_0x4d4f('0xd')]('Migration,\x20%s,\x20%s',_0xecc103,_0x4d4f('0xf'));_0xea29b(_0x226837['result'][_0x4d4f('0x15')]);}})[_0x4d4f('0x16')](function(_0x4170ca){logger['error'](_0x4d4f('0xe'),_0xecc103,_0x4170ca);_0x40be66(_0x4170ca);});});} \ No newline at end of file +var _0x6f75=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1529a3,_0x529f63){var _0x1a0d4b=function(_0x6f1058){while(--_0x6f1058){_0x1529a3['push'](_0x1529a3['shift']());}};_0x1a0d4b(++_0x529f63);}(_0x6f75,0x71));var _0x56f7=function(_0x393547,_0x2178f8){_0x393547=_0x393547-0x0;var _0x1421be=_0x6f75[_0x393547];return _0x1421be;};'use strict';var _=require(_0x56f7('0x0'));var util=require(_0x56f7('0x1'));var moment=require(_0x56f7('0x2'));var BPromise=require(_0x56f7('0x3'));var rs=require(_0x56f7('0x4'));var fs=require('fs');var Redis=require(_0x56f7('0x5'));var db=require(_0x56f7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x56f7('0x7'))(_0x56f7('0x8'));var config=require(_0x56f7('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x137d14,_0xcc51b1,_0x4b5dcc){return new BPromise(function(_0x184bf7,_0x5155ff){return client['request'](_0x137d14,_0x4b5dcc)[_0x56f7('0xa')](function(_0x1e607c){logger[_0x56f7('0xb')](_0x56f7('0xc'),_0xcc51b1,_0x56f7('0xd'));logger[_0x56f7('0xe')](_0x56f7('0xf'),_0xcc51b1,_0x56f7('0xd'),JSON[_0x56f7('0x10')](_0x1e607c));if(_0x1e607c[_0x56f7('0x11')]){if(_0x1e607c[_0x56f7('0x11')][_0x56f7('0x12')]===0x1f4){logger[_0x56f7('0x11')](_0x56f7('0xc'),_0xcc51b1,_0x1e607c['error'][_0x56f7('0x13')]);return _0x5155ff(_0x1e607c[_0x56f7('0x11')][_0x56f7('0x13')]);}logger[_0x56f7('0x11')](_0x56f7('0xc'),_0xcc51b1,_0x1e607c[_0x56f7('0x11')][_0x56f7('0x13')]);return _0x184bf7(_0x1e607c[_0x56f7('0x11')][_0x56f7('0x13')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0xcc51b1,_0x56f7('0xd'));_0x184bf7(_0x1e607c[_0x56f7('0x14')][_0x56f7('0x13')]);}})[_0x56f7('0x15')](function(_0x40fb77){logger[_0x56f7('0x11')]('Migration,\x20%s,\x20%s',_0xcc51b1,_0x40fb77);_0x5155ff(_0x40fb77);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index ea069a6..34aec92 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 _0x7f2f=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','post','create','put','/:id','update','destroy','exports','util','path','express','Router'];(function(_0x1b8e60,_0x21b885){var _0x363363=function(_0x5987c7){while(--_0x5987c7){_0x1b8e60['push'](_0x1b8e60['shift']());}};_0x363363(++_0x21b885);}(_0x7f2f,0x11c));var _0xf7f2=function(_0x54db71,_0x43de96){_0x54db71=_0x54db71-0x0;var _0x1104e7=_0x7f2f[_0x54db71];return _0x1104e7;};'use strict';var multer=require('multer');var util=require(_0xf7f2('0x0'));var path=require(_0xf7f2('0x1'));var timeout=require('connect-timeout');var express=require(_0xf7f2('0x2'));var router=express[_0xf7f2('0x3')]();var auth=require(_0xf7f2('0x4'));var interaction=require(_0xf7f2('0x5'));var config=require(_0xf7f2('0x6'));var controller=require('./network.controller');router[_0xf7f2('0x7')]('/',auth['isAuthenticated'](),controller[_0xf7f2('0x8')]);router[_0xf7f2('0x7')]('/:id',auth[_0xf7f2('0x9')](),controller[_0xf7f2('0xa')]);router[_0xf7f2('0xb')]('/',auth[_0xf7f2('0x9')](),controller[_0xf7f2('0xc')]);router[_0xf7f2('0xd')](_0xf7f2('0xe'),auth['isAuthenticated'](),controller[_0xf7f2('0xf')]);router['delete'](_0xf7f2('0xe'),auth[_0xf7f2('0x9')](),controller[_0xf7f2('0x10')]);module[_0xf7f2('0x11')]=router; \ No newline at end of file +var _0xdbff=['../../components/interaction/service','./network.controller','get','isAuthenticated','put','/:id','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x35b1ef,_0x4cfa92){var _0x418103=function(_0x460cfa){while(--_0x460cfa){_0x35b1ef['push'](_0x35b1ef['shift']());}};_0x418103(++_0x4cfa92);}(_0xdbff,0x87));var _0xfdbf=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0xdbff[_0x19159a];return _0xa677f4;};'use strict';var multer=require(_0xfdbf('0x0'));var util=require('util');var path=require(_0xfdbf('0x1'));var timeout=require(_0xfdbf('0x2'));var express=require(_0xfdbf('0x3'));var router=express['Router']();var auth=require(_0xfdbf('0x4'));var interaction=require(_0xfdbf('0x5'));var config=require('../../config/environment');var controller=require(_0xfdbf('0x6'));router[_0xfdbf('0x7')]('/',auth[_0xfdbf('0x8')](),controller['index']);router['get']('/:id',auth[_0xfdbf('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xfdbf('0x9')](_0xfdbf('0xa'),auth[_0xfdbf('0x8')](),controller[_0xfdbf('0xb')]);router[_0xfdbf('0xc')](_0xfdbf('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xfdbf('0xd')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 2ceab8b..c640cd8 100644 --- a/server/api/network/network.attributes.js +++ b/server/api/network/network.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x17851b,_0x6c8ef5){var _0x18c9d1=function(_0x40b94b){while(--_0x40b94b){_0x17851b['push'](_0x17851b['shift']());}};_0x18c9d1(++_0x6c8ef5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x597295,_0x39c027){var _0x2868c2=function(_0x57eec6){while(--_0x57eec6){_0x597295['push'](_0x597295['shift']());}};_0x2868c2(++_0x39c027);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 4c21828..738ea1c 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 _0x5681=['render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','sequelize','STUN','eml-format','zip-dir','moment','bluebird','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','test','ValidationError','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','index','map','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Network','include','findAll','show','params','rawAttributes','length','find','create','transaction','body','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8'];(function(_0x2067e3,_0x19bcb2){var _0x180c44=function(_0x53751f){while(--_0x53751f){_0x2067e3['push'](_0x2067e3['shift']());}};_0x180c44(++_0x19bcb2);}(_0x5681,0xe1));var _0x1568=function(_0xe0af56,_0x959a16){_0xe0af56=_0xe0af56-0x0;var _0x55cbba=_0x5681[_0xe0af56];return _0x55cbba;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1568('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1568('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1568('0x2'));var BPromise=require(_0x1568('0x3'));var Mustache=require('mustache');var util=require(_0x1568('0x4'));var path=require(_0x1568('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1568('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1568('0x7'));var crypto=require(_0x1568('0x8'));var jsforce=require(_0x1568('0x9'));var deskjs=require(_0x1568('0xa'));var toCsv=require(_0x1568('0xb'));var querystring=require(_0x1568('0xc'));var Papa=require(_0x1568('0xd'));var Redis=require(_0x1568('0xe'));var authService=require(_0x1568('0xf'));var qs=require(_0x1568('0x10'));var as=require(_0x1568('0x11'));var hardwareService=require(_0x1568('0x12'));var logger=require(_0x1568('0x13'))('api');var utils=require(_0x1568('0x14'));var config=require('../../config/environment');var db=require(_0x1568('0x15'))['db'];var jayson=require(_0x1568('0x16'));var client=jayson[_0x1568('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x590a63,_0x1bd463,_0x12c024){if(_0x12c024){var _0x499553=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x499553[_0x1568('0x18')](_0x1bd463)){return _0x590a63;}else{throw new db['Sequelize'][(_0x1568('0x19'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x590a63;}}function respondWithRpcPromise(_0x31033e,_0x58ea62,_0x52a329,_0x127e7e){return new BPromise(function(_0x2ac96a,_0x32d01c){var _0x375b17=_0x127e7e||client;return _0x375b17[_0x1568('0x1a')](_0x31033e,_0x52a329)['then'](function(_0x5a3ca1){logger[_0x1568('0x1b')](_0x1568('0x1c'),_0x58ea62,_0x1568('0x1d'));logger[_0x1568('0x1e')](_0x1568('0x1f'),_0x58ea62,_0x1568('0x1d'),JSON['stringify'](_0x5a3ca1));if(_0x5a3ca1['error']){if(_0x5a3ca1[_0x1568('0x20')][_0x1568('0x21')]===0x1f4){logger[_0x1568('0x20')](_0x1568('0x1c'),_0x58ea62,_0x5a3ca1[_0x1568('0x20')]['message']);return _0x32d01c(_0x5a3ca1[_0x1568('0x20')][_0x1568('0x22')]);}logger[_0x1568('0x20')]('Network,\x20%s,\x20%s',_0x58ea62,_0x5a3ca1[_0x1568('0x20')][_0x1568('0x22')]);return _0x2ac96a(_0x5a3ca1[_0x1568('0x20')][_0x1568('0x22')]);}else{logger['info'](_0x1568('0x1c'),_0x58ea62,_0x1568('0x1d'));_0x2ac96a(_0x5a3ca1[_0x1568('0x23')]['message']);}})[_0x1568('0x24')](function(_0xe921c5){logger['error'](_0x1568('0x1c'),_0x58ea62,_0xe921c5);_0x32d01c(_0xe921c5);});});}function respondWithStatusCode(_0x2d9103,_0x225c01){_0x225c01=_0x225c01||0xcc;return function(_0x3a444e){if(_0x3a444e){return _0x2d9103[_0x1568('0x25')](_0x225c01);}return _0x2d9103[_0x1568('0x26')](_0x225c01)[_0x1568('0x27')]();};}function respondWithResult(_0x57cd03,_0xe9a4ce){_0xe9a4ce=_0xe9a4ce||0xc8;return function(_0x2cc2be){if(_0x2cc2be){return _0x57cd03[_0x1568('0x26')](_0xe9a4ce)[_0x1568('0x28')](_0x2cc2be);}};}function respondWithFilteredResult(_0x1dc95f,_0x481ab4){return function(_0x29eba3){if(_0x29eba3){var _0x5eb6bf=_0x29eba3[_0x1568('0x29')],_0x5a5328=_0x481ab4[_0x1568('0x2a')],_0x13b68c=_0x481ab4[_0x1568('0x2a')]+_0x481ab4[_0x1568('0x2b')],_0x67122c;if(_0x13b68c>=_0x5eb6bf){_0x13b68c=_0x5eb6bf;_0x67122c=0xc8;}else{_0x67122c=0xce;}_0x1dc95f[_0x1568('0x26')](_0x67122c);return _0x1dc95f[_0x1568('0x2c')](_0x1568('0x2d'),_0x5a5328+'-'+_0x13b68c+'/'+_0x5eb6bf)['json'](_0x29eba3);}return null;};}function patchUpdates(_0xa7b4f){return function(_0x53e1ed){try{jsonpatch[_0x1568('0x2e')](_0x53e1ed,_0xa7b4f,!![]);}catch(_0x1af727){return BPromise['reject'](_0x1af727);}return _0x53e1ed[_0x1568('0x2f')]();};}function saveUpdates(_0x4f05f3,_0x564eef){return function(_0x4878be){if(_0x4878be){return _0x4878be[_0x1568('0x30')](_0x4f05f3)[_0x1568('0x31')](function(_0x35950c){return _0x35950c;});}return null;};}function removeEntity(_0x18d489,_0xa864c9){return function(_0x5cb081){if(_0x5cb081){return _0x5cb081[_0x1568('0x32')]()[_0x1568('0x31')](function(){_0x18d489[_0x1568('0x26')](0xcc)[_0x1568('0x27')]();});}};}function handleEntityNotFound(_0x49391a,_0x2867b9){return function(_0x5bc50e){if(!_0x5bc50e){_0x49391a[_0x1568('0x25')](0x194);}return _0x5bc50e;};}function handleError(_0x38b414,_0x5852c4){_0x5852c4=_0x5852c4||0x1f4;return function(_0x3a2fa4){logger[_0x1568('0x20')](_0x3a2fa4[_0x1568('0x33')]);if(_0x3a2fa4[_0x1568('0x34')]){delete _0x3a2fa4[_0x1568('0x34')];}_0x38b414[_0x1568('0x26')](_0x5852c4)['send'](_0x3a2fa4);};}exports[_0x1568('0x35')]=function(_0x2aebe5,_0x133d0b){var _0x232494={},_0x311a9a={},_0x5151bb={'count':0x0,'rows':[]};var _0x377e74=_[_0x1568('0x36')](db['Network']['rawAttributes'],function(_0x41e340){return{'name':_0x41e340['fieldName'],'type':_0x41e340[_0x1568('0x37')][_0x1568('0x38')]};});_0x311a9a[_0x1568('0x39')]=_[_0x1568('0x36')](_0x377e74,_0x1568('0x34'));_0x311a9a[_0x1568('0x3a')]=_[_0x1568('0x3b')](_0x2aebe5[_0x1568('0x3a')]);_0x311a9a['filters']=_[_0x1568('0x3c')](_0x311a9a[_0x1568('0x39')],_0x311a9a[_0x1568('0x3a')]);_0x232494[_0x1568('0x3d')]=_[_0x1568('0x3c')](_0x311a9a[_0x1568('0x39')],qs[_0x1568('0x3e')](_0x2aebe5[_0x1568('0x3a')][_0x1568('0x3e')]));_0x232494[_0x1568('0x3d')]=_0x232494[_0x1568('0x3d')]['length']?_0x232494[_0x1568('0x3d')]:_0x311a9a[_0x1568('0x39')];if(!_0x2aebe5['query'][_0x1568('0x3f')]('nolimit')){_0x232494[_0x1568('0x2b')]=qs['limit'](_0x2aebe5['query'][_0x1568('0x2b')]);_0x232494[_0x1568('0x2a')]=qs['offset'](_0x2aebe5[_0x1568('0x3a')][_0x1568('0x2a')]);}_0x232494[_0x1568('0x40')]=qs[_0x1568('0x41')](_0x2aebe5[_0x1568('0x3a')][_0x1568('0x41')]);_0x232494[_0x1568('0x42')]=qs[_0x1568('0x43')](_[_0x1568('0x44')](_0x2aebe5['query'],_0x311a9a[_0x1568('0x43')]),_0x377e74);if(_0x2aebe5['query'][_0x1568('0x45')]){_0x232494[_0x1568('0x42')]=_[_0x1568('0x46')](_0x232494['where'],{'$or':_[_0x1568('0x36')](_0x377e74,function(_0x1494b6){if(_0x1494b6['type']!==_0x1568('0x47')){var _0x4bb593={};_0x4bb593[_0x1494b6[_0x1568('0x34')]]={'$like':'%'+_0x2aebe5[_0x1568('0x3a')][_0x1568('0x45')]+'%'};return _0x4bb593;}})});}_0x232494=_[_0x1568('0x46')]({},_0x232494,_0x2aebe5[_0x1568('0x48')]);var _0x28ae1a={'where':_0x232494[_0x1568('0x42')]};return db[_0x1568('0x49')][_0x1568('0x29')](_0x28ae1a)[_0x1568('0x31')](function(_0x204d5e){_0x5151bb['count']=_0x204d5e;if(_0x2aebe5[_0x1568('0x3a')]['includeAll']){_0x232494[_0x1568('0x4a')]=[{'all':!![]}];}return db[_0x1568('0x49')][_0x1568('0x4b')](_0x232494);})[_0x1568('0x31')](function(_0x530be4){_0x5151bb['rows']=_0x530be4;return _0x5151bb;})[_0x1568('0x31')](respondWithFilteredResult(_0x133d0b,_0x232494))[_0x1568('0x24')](handleError(_0x133d0b,null));};exports[_0x1568('0x4c')]=function(_0x3d6954,_0x19fd86){var _0x5c24b9={'raw':!![],'where':{'id':_0x3d6954[_0x1568('0x4d')]['id']}},_0x1d217e={};_0x1d217e[_0x1568('0x39')]=_[_0x1568('0x3b')](db['Network'][_0x1568('0x4e')]);_0x1d217e['query']=_[_0x1568('0x3b')](_0x3d6954[_0x1568('0x3a')]);_0x1d217e[_0x1568('0x43')]=_[_0x1568('0x3c')](_0x1d217e[_0x1568('0x39')],_0x1d217e[_0x1568('0x3a')]);_0x5c24b9[_0x1568('0x3d')]=_[_0x1568('0x3c')](_0x1d217e['model'],qs['fields'](_0x3d6954[_0x1568('0x3a')][_0x1568('0x3e')]));_0x5c24b9[_0x1568('0x3d')]=_0x5c24b9[_0x1568('0x3d')][_0x1568('0x4f')]?_0x5c24b9[_0x1568('0x3d')]:_0x1d217e[_0x1568('0x39')];if(_0x3d6954[_0x1568('0x3a')]['includeAll']){_0x5c24b9[_0x1568('0x4a')]=[{'all':!![]}];}_0x5c24b9=_['merge']({},_0x5c24b9,_0x3d6954['options']);return db[_0x1568('0x49')][_0x1568('0x50')](_0x5c24b9)[_0x1568('0x31')](handleEntityNotFound(_0x19fd86,null))[_0x1568('0x31')](respondWithResult(_0x19fd86,null))['catch'](handleError(_0x19fd86,null));};exports[_0x1568('0x51')]=function(_0x4944f2,_0x42081e,_0xa343b6){var _0x4d5fa4;return db['sequelize'][_0x1568('0x52')](function(_0xedeab2){return db[_0x1568('0x49')][_0x1568('0x51')](_0x4944f2[_0x1568('0x53')],{'raw':!![]})[_0x1568('0x31')](function(_0x436303){_0x4d5fa4=_0x436303;return db[_0x1568('0x49')][_0x1568('0x4b')]({'where':{'type':_0x4944f2['body'][_0x1568('0x37')]},'raw':!![]});})['then'](function(_0x66284a){if(_0x4d5fa4[_0x1568('0x37')][_0x1568('0x54')]()=='STUN'){var _0x50495d=fs[_0x1568('0x55')](path[_0x1568('0x56')](config[_0x1568('0x57')],_0x1568('0x58')),_0x1568('0x59'));var _0x4f71c8=ejs[_0x1568('0x5a')](_0x50495d,{'networks':_0x66284a||[]});fs[_0x1568('0x5b')](_0x1568('0x5c'),_0x4f71c8);return respondWithRpcPromise(_0x1568('0x5d'),_0x1568('0x51'),{'module':_0x1568('0x5e')});}else if(_0x4d5fa4[_0x1568('0x37')][_0x1568('0x54')]()==_0x1568('0x5f')){var _0x170a44=fs[_0x1568('0x55')](path[_0x1568('0x56')](config[_0x1568('0x57')],_0x1568('0x60')),_0x1568('0x59'));var _0x2746dd=ejs[_0x1568('0x5a')](_0x170a44,{'networks':_0x66284a||[]});fs[_0x1568('0x5b')](_0x1568('0x61'),_0x2746dd);return respondWithRpcPromise(_0x1568('0x5d'),_0x1568('0x51'),{'module':_0x1568('0x5e')});}else{var _0x2ff803=fs[_0x1568('0x55')](path[_0x1568('0x56')](config[_0x1568('0x57')],_0x1568('0x62')),_0x1568('0x59'));var _0x5be840=ejs[_0x1568('0x5a')](_0x2ff803,{'networks':_0x66284a||[]});fs['writeFileSync'](util[_0x1568('0x63')](_0x1568('0x64'),_0x4944f2[_0x1568('0x53')]['type'][_0x1568('0x65')]()),_0x5be840);return respondWithRpcPromise('Reload','create',{'module':_0x1568('0x66')});}return null;})[_0x1568('0x31')](function(){return _0x4d5fa4;});})[_0x1568('0x31')](respondWithResult(_0x42081e,0xc9))['catch'](handleError(_0x42081e,null));};exports[_0x1568('0x30')]=function(_0x4ddd5f,_0x133719,_0x300963){var _0x57d1d7;return db[_0x1568('0x67')][_0x1568('0x52')](function(_0xf531d1){return db['Network'][_0x1568('0x50')]({'where':{'id':_0x4ddd5f[_0x1568('0x4d')]['id']}})[_0x1568('0x31')](handleEntityNotFound(_0x133719,null))[_0x1568('0x31')](saveUpdates(_0x4ddd5f['body'],null))[_0x1568('0x31')](function(_0x129392){if(_0x129392){_0x57d1d7=_0x129392;return db[_0x1568('0x49')][_0x1568('0x4b')]({'where':{'type':_0x57d1d7[_0x1568('0x37')]},'raw':!![]});}return null;})[_0x1568('0x31')](function(_0x2369c7){if(_0x57d1d7[_0x1568('0x37')][_0x1568('0x54')]()==_0x1568('0x68')){var _0x5c85ed=fs[_0x1568('0x55')](path[_0x1568('0x56')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x1568('0x59'));var _0x2bea68=ejs['render'](_0x5c85ed,{'networks':_0x2369c7||[]});fs[_0x1568('0x5b')](_0x1568('0x5c'),_0x2bea68);return respondWithRpcPromise(_0x1568('0x5d'),_0x1568('0x30'),{'module':_0x1568('0x5e')});}else if(_0x57d1d7[_0x1568('0x37')][_0x1568('0x54')]()=='TURN'){var _0x1d02f5=fs[_0x1568('0x55')](path[_0x1568('0x56')](config['root'],_0x1568('0x60')),_0x1568('0x59'));var _0x10c8de=ejs[_0x1568('0x5a')](_0x1d02f5,{'networks':_0x2369c7||[]});fs[_0x1568('0x5b')](_0x1568('0x61'),_0x10c8de);return respondWithRpcPromise('Reload','update',{'module':_0x1568('0x5e')});}else{var _0x4bc6b0=fs['readFileSync'](path['join'](config['root'],_0x1568('0x62')),_0x1568('0x59'));var _0x4be7b3=ejs[_0x1568('0x5a')](_0x4bc6b0,{'networks':_0x2369c7||[]});fs[_0x1568('0x5b')](util[_0x1568('0x63')](_0x1568('0x64'),_0x4ddd5f[_0x1568('0x53')][_0x1568('0x37')][_0x1568('0x65')]()),_0x4be7b3);return respondWithRpcPromise(_0x1568('0x5d'),'update',{'module':'chan_sip.so'});}return null;})['then'](function(_0x2a80fa){if(_0x2a80fa){return _0x57d1d7;}return null;});})[_0x1568('0x31')](respondWithResult(_0x133719,null))[_0x1568('0x24')](handleError(_0x133719,null));};exports[_0x1568('0x32')]=function(_0x583d9f,_0x18b987,_0x5ef25b){var _0x25a3c6;return db['Network'][_0x1568('0x50')]({'where':{'id':_0x583d9f[_0x1568('0x4d')]['id']}})[_0x1568('0x31')](function(_0x1033bf){_0x25a3c6=_0x1033bf;return _0x1033bf;})[_0x1568('0x31')](handleEntityNotFound(_0x18b987,null))[_0x1568('0x31')](removeEntity(_0x18b987,null))[_0x1568('0x31')](function(){if(_0x25a3c6){return db['Network']['findAll']({'where':{'type':_0x25a3c6[_0x1568('0x37')]},'raw':!![]});}})['then'](function(_0xf0c1c6){if(_0x25a3c6[_0x1568('0x37')][_0x1568('0x54')]()==_0x1568('0x68')){var _0x4ca780=fs[_0x1568('0x55')](path['join'](config[_0x1568('0x57')],_0x1568('0x58')),_0x1568('0x59'));var _0x146021=ejs[_0x1568('0x5a')](_0x4ca780,{'networks':_0xf0c1c6||[]});fs['writeFileSync'](_0x1568('0x5c'),_0x146021);return respondWithRpcPromise('Reload',_0x1568('0x32'),{'module':_0x1568('0x5e')});}else if(_0x25a3c6[_0x1568('0x37')][_0x1568('0x54')]()=='TURN'){var _0x12b8a9=fs[_0x1568('0x55')](path[_0x1568('0x56')](config[_0x1568('0x57')],_0x1568('0x60')),_0x1568('0x59'));var _0x3e8796=ejs[_0x1568('0x5a')](_0x12b8a9,{'networks':_0xf0c1c6||[]});fs[_0x1568('0x5b')](_0x1568('0x61'),_0x3e8796);return respondWithRpcPromise('Reload','destroy',{'module':'res_stun_monitor.so'});}else{var _0x5aa200=fs['readFileSync'](path[_0x1568('0x56')](config[_0x1568('0x57')],_0x1568('0x62')),_0x1568('0x59'));var _0x5cf9dd=ejs[_0x1568('0x5a')](_0x5aa200,{'networks':_0xf0c1c6||[]});fs['writeFileSync'](util[_0x1568('0x63')](_0x1568('0x64'),_0x583d9f[_0x1568('0x53')][_0x1568('0x37')][_0x1568('0x65')]()),_0x5cf9dd);return respondWithRpcPromise(_0x1568('0x5d'),_0x1568('0x32'),{'module':_0x1568('0x66')});}return null;})[_0x1568('0x24')](handleError(_0x18b987,null));}; \ No newline at end of file +var _0xa554=['type','key','model','query','keys','attributes','intersection','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','fields','include','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','format','toLowerCase','find','params','/etc/asterisk/turn_xcally.conf','chan_sip.so','/etc/asterisk/sip_xcally_%s.conf','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','test','ValidationError','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','index','map','Network','fieldName'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xa554,0x104));var _0x4a55=function(_0x36c3cb,_0x556fd7){_0x36c3cb=_0x36c3cb-0x0;var _0x4a5edc=_0xa554[_0x36c3cb];return _0x4a5edc;};'use strict';var pdf=require(_0x4a55('0x0'));var emlformat=require(_0x4a55('0x1'));var rimraf=require(_0x4a55('0x2'));var zipdir=require(_0x4a55('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4a55('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4a55('0x5'));var util=require('util');var path=require(_0x4a55('0x6'));var sox=require(_0x4a55('0x7'));var csv=require(_0x4a55('0x8'));var ejs=require(_0x4a55('0x9'));var fs=require('fs');var _=require(_0x4a55('0xa'));var squel=require(_0x4a55('0xb'));var crypto=require('crypto');var jsforce=require(_0x4a55('0xc'));var deskjs=require(_0x4a55('0xd'));var toCsv=require(_0x4a55('0x8'));var querystring=require(_0x4a55('0xe'));var Papa=require('papaparse');var Redis=require(_0x4a55('0xf'));var authService=require(_0x4a55('0x10'));var qs=require(_0x4a55('0x11'));var as=require(_0x4a55('0x12'));var hardwareService=require(_0x4a55('0x13'));var logger=require(_0x4a55('0x14'))(_0x4a55('0x15'));var utils=require('../../config/utils');var config=require(_0x4a55('0x16'));var db=require(_0x4a55('0x17'))['db'];var jayson=require(_0x4a55('0x18'));var client=jayson['client'][_0x4a55('0x19')]({'port':0x232a});function checkPasswordPattern(_0x5c6ce1,_0x3ce97a,_0x4a3e67){if(_0x4a3e67){var _0x4b4c01=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b4c01[_0x4a55('0x1a')](_0x3ce97a)){return _0x5c6ce1;}else{throw new db['Sequelize'][(_0x4a55('0x1b'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5c6ce1;}}function respondWithRpcPromise(_0x2c0f41,_0x121772,_0x3dd79e,_0x4e1465){return new BPromise(function(_0x680446,_0x1b37d6){var _0xdfee66=_0x4e1465||client;return _0xdfee66['request'](_0x2c0f41,_0x3dd79e)['then'](function(_0x17ad38){logger[_0x4a55('0x1c')](_0x4a55('0x1d'),_0x121772,_0x4a55('0x1e'));logger['debug'](_0x4a55('0x1f'),_0x121772,'request\x20sent',JSON[_0x4a55('0x20')](_0x17ad38));if(_0x17ad38[_0x4a55('0x21')]){if(_0x17ad38[_0x4a55('0x21')][_0x4a55('0x22')]===0x1f4){logger[_0x4a55('0x21')](_0x4a55('0x1d'),_0x121772,_0x17ad38[_0x4a55('0x21')][_0x4a55('0x23')]);return _0x1b37d6(_0x17ad38[_0x4a55('0x21')]['message']);}logger[_0x4a55('0x21')](_0x4a55('0x1d'),_0x121772,_0x17ad38[_0x4a55('0x21')][_0x4a55('0x23')]);return _0x680446(_0x17ad38['error'][_0x4a55('0x23')]);}else{logger[_0x4a55('0x1c')](_0x4a55('0x1d'),_0x121772,_0x4a55('0x1e'));_0x680446(_0x17ad38['result'][_0x4a55('0x23')]);}})[_0x4a55('0x24')](function(_0x3c9bb1){logger[_0x4a55('0x21')](_0x4a55('0x1d'),_0x121772,_0x3c9bb1);_0x1b37d6(_0x3c9bb1);});});}function respondWithStatusCode(_0x1ecf95,_0x3dd29b){_0x3dd29b=_0x3dd29b||0xcc;return function(_0x42c847){if(_0x42c847){return _0x1ecf95[_0x4a55('0x25')](_0x3dd29b);}return _0x1ecf95[_0x4a55('0x26')](_0x3dd29b)[_0x4a55('0x27')]();};}function respondWithResult(_0x31c8d5,_0x54aff6){_0x54aff6=_0x54aff6||0xc8;return function(_0x5b1da5){if(_0x5b1da5){return _0x31c8d5['status'](_0x54aff6)['json'](_0x5b1da5);}};}function respondWithFilteredResult(_0x391139,_0x49b737){return function(_0x25d320){if(_0x25d320){var _0x5d6b4f=_0x25d320['count'],_0x25f4c3=_0x49b737[_0x4a55('0x28')],_0x322fb1=_0x49b737['offset']+_0x49b737[_0x4a55('0x29')],_0x19f54b;if(_0x322fb1>=_0x5d6b4f){_0x322fb1=_0x5d6b4f;_0x19f54b=0xc8;}else{_0x19f54b=0xce;}_0x391139[_0x4a55('0x26')](_0x19f54b);return _0x391139[_0x4a55('0x2a')](_0x4a55('0x2b'),_0x25f4c3+'-'+_0x322fb1+'/'+_0x5d6b4f)['json'](_0x25d320);}return null;};}function patchUpdates(_0x2d8010){return function(_0x3f953d){try{jsonpatch['apply'](_0x3f953d,_0x2d8010,!![]);}catch(_0x4b4a91){return BPromise[_0x4a55('0x2c')](_0x4b4a91);}return _0x3f953d[_0x4a55('0x2d')]();};}function saveUpdates(_0x5b3b67,_0x59015b){return function(_0x2387a1){if(_0x2387a1){return _0x2387a1[_0x4a55('0x2e')](_0x5b3b67)[_0x4a55('0x2f')](function(_0x5e94ea){return _0x5e94ea;});}return null;};}function removeEntity(_0x3d81c9,_0x46f7d3){return function(_0x3771d6){if(_0x3771d6){return _0x3771d6[_0x4a55('0x30')]()[_0x4a55('0x2f')](function(){_0x3d81c9[_0x4a55('0x26')](0xcc)[_0x4a55('0x27')]();});}};}function handleEntityNotFound(_0x4a8c1b,_0x4c2f98){return function(_0x37f0a3){if(!_0x37f0a3){_0x4a8c1b[_0x4a55('0x25')](0x194);}return _0x37f0a3;};}function handleError(_0x30edc9,_0x3b3fab){_0x3b3fab=_0x3b3fab||0x1f4;return function(_0x51c826){logger[_0x4a55('0x21')](_0x51c826[_0x4a55('0x31')]);if(_0x51c826[_0x4a55('0x32')]){delete _0x51c826[_0x4a55('0x32')];}_0x30edc9[_0x4a55('0x26')](_0x3b3fab)['send'](_0x51c826);};}exports[_0x4a55('0x33')]=function(_0x11dd2a,_0x23c6e9){var _0x41fdf8={},_0x168c7b={},_0x6a7bb={'count':0x0,'rows':[]};var _0x536277=_[_0x4a55('0x34')](db[_0x4a55('0x35')]['rawAttributes'],function(_0x24d726){return{'name':_0x24d726[_0x4a55('0x36')],'type':_0x24d726[_0x4a55('0x37')][_0x4a55('0x38')]};});_0x168c7b[_0x4a55('0x39')]=_['map'](_0x536277,_0x4a55('0x32'));_0x168c7b[_0x4a55('0x3a')]=_[_0x4a55('0x3b')](_0x11dd2a[_0x4a55('0x3a')]);_0x168c7b['filters']=_['intersection'](_0x168c7b[_0x4a55('0x39')],_0x168c7b[_0x4a55('0x3a')]);_0x41fdf8[_0x4a55('0x3c')]=_[_0x4a55('0x3d')](_0x168c7b['model'],qs['fields'](_0x11dd2a[_0x4a55('0x3a')]['fields']));_0x41fdf8[_0x4a55('0x3c')]=_0x41fdf8[_0x4a55('0x3c')][_0x4a55('0x3e')]?_0x41fdf8[_0x4a55('0x3c')]:_0x168c7b[_0x4a55('0x39')];if(!_0x11dd2a[_0x4a55('0x3a')]['hasOwnProperty'](_0x4a55('0x3f'))){_0x41fdf8['limit']=qs[_0x4a55('0x29')](_0x11dd2a['query'][_0x4a55('0x29')]);_0x41fdf8[_0x4a55('0x28')]=qs[_0x4a55('0x28')](_0x11dd2a[_0x4a55('0x3a')]['offset']);}_0x41fdf8['order']=qs['sort'](_0x11dd2a['query'][_0x4a55('0x40')]);_0x41fdf8[_0x4a55('0x41')]=qs[_0x4a55('0x42')](_[_0x4a55('0x43')](_0x11dd2a['query'],_0x168c7b['filters']),_0x536277);if(_0x11dd2a['query'][_0x4a55('0x44')]){_0x41fdf8[_0x4a55('0x41')]=_[_0x4a55('0x45')](_0x41fdf8[_0x4a55('0x41')],{'$or':_['map'](_0x536277,function(_0x1f2970){if(_0x1f2970['type']!==_0x4a55('0x46')){var _0x37fff3={};_0x37fff3[_0x1f2970[_0x4a55('0x32')]]={'$like':'%'+_0x11dd2a[_0x4a55('0x3a')][_0x4a55('0x44')]+'%'};return _0x37fff3;}})});}_0x41fdf8=_['merge']({},_0x41fdf8,_0x11dd2a[_0x4a55('0x47')]);var _0x2d51c8={'where':_0x41fdf8[_0x4a55('0x41')]};return db[_0x4a55('0x35')][_0x4a55('0x48')](_0x2d51c8)[_0x4a55('0x2f')](function(_0xb42719){_0x6a7bb[_0x4a55('0x48')]=_0xb42719;if(_0x11dd2a[_0x4a55('0x3a')][_0x4a55('0x49')]){_0x41fdf8['include']=[{'all':!![]}];}return db[_0x4a55('0x35')][_0x4a55('0x4a')](_0x41fdf8);})[_0x4a55('0x2f')](function(_0x49c928){_0x6a7bb[_0x4a55('0x4b')]=_0x49c928;return _0x6a7bb;})['then'](respondWithFilteredResult(_0x23c6e9,_0x41fdf8))[_0x4a55('0x24')](handleError(_0x23c6e9,null));};exports[_0x4a55('0x4c')]=function(_0x5b59be,_0x2d7f9a){var _0x1963b3={'raw':!![],'where':{'id':_0x5b59be['params']['id']}},_0x376ac7={};_0x376ac7[_0x4a55('0x39')]=_[_0x4a55('0x3b')](db[_0x4a55('0x35')]['rawAttributes']);_0x376ac7['query']=_[_0x4a55('0x3b')](_0x5b59be[_0x4a55('0x3a')]);_0x376ac7[_0x4a55('0x42')]=_[_0x4a55('0x3d')](_0x376ac7['model'],_0x376ac7[_0x4a55('0x3a')]);_0x1963b3['attributes']=_[_0x4a55('0x3d')](_0x376ac7[_0x4a55('0x39')],qs[_0x4a55('0x4d')](_0x5b59be[_0x4a55('0x3a')][_0x4a55('0x4d')]));_0x1963b3['attributes']=_0x1963b3['attributes'][_0x4a55('0x3e')]?_0x1963b3[_0x4a55('0x3c')]:_0x376ac7['model'];if(_0x5b59be[_0x4a55('0x3a')][_0x4a55('0x49')]){_0x1963b3[_0x4a55('0x4e')]=[{'all':!![]}];}_0x1963b3=_[_0x4a55('0x45')]({},_0x1963b3,_0x5b59be[_0x4a55('0x47')]);return db[_0x4a55('0x35')]['find'](_0x1963b3)[_0x4a55('0x2f')](handleEntityNotFound(_0x2d7f9a,null))[_0x4a55('0x2f')](respondWithResult(_0x2d7f9a,null))[_0x4a55('0x24')](handleError(_0x2d7f9a,null));};exports[_0x4a55('0x4f')]=function(_0x4f01e6,_0x4dd38e,_0x544096){var _0x444adf;return db[_0x4a55('0x50')][_0x4a55('0x51')](function(_0x33758e){return db[_0x4a55('0x35')]['create'](_0x4f01e6[_0x4a55('0x52')],{'raw':!![]})[_0x4a55('0x2f')](function(_0x3ec863){_0x444adf=_0x3ec863;return db[_0x4a55('0x35')][_0x4a55('0x4a')]({'where':{'type':_0x4f01e6[_0x4a55('0x52')][_0x4a55('0x37')]},'raw':!![]});})[_0x4a55('0x2f')](function(_0x2fc90c){if(_0x444adf[_0x4a55('0x37')][_0x4a55('0x53')]()==_0x4a55('0x54')){var _0x873d78=fs[_0x4a55('0x55')](path[_0x4a55('0x56')](config[_0x4a55('0x57')],_0x4a55('0x58')),_0x4a55('0x59'));var _0x23eb33=ejs[_0x4a55('0x5a')](_0x873d78,{'networks':_0x2fc90c||[]});fs[_0x4a55('0x5b')](_0x4a55('0x5c'),_0x23eb33);return respondWithRpcPromise(_0x4a55('0x5d'),'create',{'module':_0x4a55('0x5e')});}else if(_0x444adf[_0x4a55('0x37')][_0x4a55('0x53')]()==_0x4a55('0x5f')){var _0xd67c4e=fs[_0x4a55('0x55')](path['join'](config['root'],_0x4a55('0x60')),_0x4a55('0x59'));var _0x75220f=ejs[_0x4a55('0x5a')](_0xd67c4e,{'networks':_0x2fc90c||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x75220f);return respondWithRpcPromise(_0x4a55('0x5d'),'create',{'module':_0x4a55('0x5e')});}else{var _0x4fa6fb=fs[_0x4a55('0x55')](path[_0x4a55('0x56')](config[_0x4a55('0x57')],_0x4a55('0x61')),'utf8');var _0x5be279=ejs[_0x4a55('0x5a')](_0x4fa6fb,{'networks':_0x2fc90c||[]});fs[_0x4a55('0x5b')](util[_0x4a55('0x62')]('/etc/asterisk/sip_xcally_%s.conf',_0x4f01e6['body'][_0x4a55('0x37')][_0x4a55('0x63')]()),_0x5be279);return respondWithRpcPromise(_0x4a55('0x5d'),_0x4a55('0x4f'),{'module':'chan_sip.so'});}return null;})[_0x4a55('0x2f')](function(){return _0x444adf;});})['then'](respondWithResult(_0x4dd38e,0xc9))[_0x4a55('0x24')](handleError(_0x4dd38e,null));};exports['update']=function(_0x26e89e,_0x1afa81,_0x47ef2e){var _0x1542a0;return db['sequelize'][_0x4a55('0x51')](function(_0x287c71){return db[_0x4a55('0x35')][_0x4a55('0x64')]({'where':{'id':_0x26e89e[_0x4a55('0x65')]['id']}})['then'](handleEntityNotFound(_0x1afa81,null))['then'](saveUpdates(_0x26e89e['body'],null))[_0x4a55('0x2f')](function(_0x5a1bdd){if(_0x5a1bdd){_0x1542a0=_0x5a1bdd;return db[_0x4a55('0x35')][_0x4a55('0x4a')]({'where':{'type':_0x1542a0['type']},'raw':!![]});}return null;})[_0x4a55('0x2f')](function(_0x49211d){if(_0x1542a0['type'][_0x4a55('0x53')]()==_0x4a55('0x54')){var _0x10eea1=fs[_0x4a55('0x55')](path[_0x4a55('0x56')](config[_0x4a55('0x57')],_0x4a55('0x58')),_0x4a55('0x59'));var _0x10d260=ejs['render'](_0x10eea1,{'networks':_0x49211d||[]});fs['writeFileSync'](_0x4a55('0x5c'),_0x10d260);return respondWithRpcPromise('Reload',_0x4a55('0x2e'),{'module':_0x4a55('0x5e')});}else if(_0x1542a0[_0x4a55('0x37')]['toUpperCase']()==_0x4a55('0x5f')){var _0x4de234=fs[_0x4a55('0x55')](path[_0x4a55('0x56')](config[_0x4a55('0x57')],_0x4a55('0x60')),_0x4a55('0x59'));var _0x24b061=ejs[_0x4a55('0x5a')](_0x4de234,{'networks':_0x49211d||[]});fs[_0x4a55('0x5b')](_0x4a55('0x66'),_0x24b061);return respondWithRpcPromise(_0x4a55('0x5d'),'update',{'module':_0x4a55('0x5e')});}else{var _0x52e31a=fs['readFileSync'](path['join'](config['root'],_0x4a55('0x61')),_0x4a55('0x59'));var _0x2d4754=ejs[_0x4a55('0x5a')](_0x52e31a,{'networks':_0x49211d||[]});fs[_0x4a55('0x5b')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x26e89e[_0x4a55('0x52')][_0x4a55('0x37')]['toLowerCase']()),_0x2d4754);return respondWithRpcPromise(_0x4a55('0x5d'),_0x4a55('0x2e'),{'module':_0x4a55('0x67')});}return null;})['then'](function(_0x41ddc2){if(_0x41ddc2){return _0x1542a0;}return null;});})[_0x4a55('0x2f')](respondWithResult(_0x1afa81,null))[_0x4a55('0x24')](handleError(_0x1afa81,null));};exports['destroy']=function(_0x117c90,_0x22ded1,_0x86c25d){var _0x46fc45;return db['Network'][_0x4a55('0x64')]({'where':{'id':_0x117c90['params']['id']}})[_0x4a55('0x2f')](function(_0x592a75){_0x46fc45=_0x592a75;return _0x592a75;})[_0x4a55('0x2f')](handleEntityNotFound(_0x22ded1,null))['then'](removeEntity(_0x22ded1,null))[_0x4a55('0x2f')](function(){if(_0x46fc45){return db[_0x4a55('0x35')][_0x4a55('0x4a')]({'where':{'type':_0x46fc45[_0x4a55('0x37')]},'raw':!![]});}})[_0x4a55('0x2f')](function(_0x140177){if(_0x46fc45[_0x4a55('0x37')]['toUpperCase']()==_0x4a55('0x54')){var _0xaa5fdf=fs[_0x4a55('0x55')](path[_0x4a55('0x56')](config[_0x4a55('0x57')],'server/files/templates/stun_multiple.ejs'),_0x4a55('0x59'));var _0xd25f0e=ejs[_0x4a55('0x5a')](_0xaa5fdf,{'networks':_0x140177||[]});fs[_0x4a55('0x5b')](_0x4a55('0x5c'),_0xd25f0e);return respondWithRpcPromise(_0x4a55('0x5d'),_0x4a55('0x30'),{'module':_0x4a55('0x5e')});}else if(_0x46fc45['type'][_0x4a55('0x53')]()==_0x4a55('0x5f')){var _0x2adfe8=fs[_0x4a55('0x55')](path['join'](config[_0x4a55('0x57')],_0x4a55('0x60')),_0x4a55('0x59'));var _0x95c8bf=ejs[_0x4a55('0x5a')](_0x2adfe8,{'networks':_0x140177||[]});fs[_0x4a55('0x5b')]('/etc/asterisk/turn_xcally.conf',_0x95c8bf);return respondWithRpcPromise(_0x4a55('0x5d'),'destroy',{'module':_0x4a55('0x5e')});}else{var _0x2b162c=fs[_0x4a55('0x55')](path[_0x4a55('0x56')](config['root'],_0x4a55('0x61')),_0x4a55('0x59'));var _0x2990fc=ejs[_0x4a55('0x5a')](_0x2b162c,{'networks':_0x140177||[]});fs[_0x4a55('0x5b')](util[_0x4a55('0x62')](_0x4a55('0x68'),_0x117c90[_0x4a55('0x52')][_0x4a55('0x37')][_0x4a55('0x63')]()),_0x2990fc);return respondWithRpcPromise(_0x4a55('0x5d'),_0x4a55('0x30'),{'module':'chan_sip.so'});}return null;})[_0x4a55('0x24')](handleError(_0x22ded1,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 31cbdaa..8fba8a7 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 _0xe107=['define','Network','network','lodash','../../config/logger','api','moment','request-promise','../../config/environment','./network.attributes','exports'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0xe107,0xb3));var _0x7e10=function(_0x5a7501,_0xadcc81){_0x5a7501=_0x5a7501-0x0;var _0x3a9d00=_0xe107[_0x5a7501];return _0x3a9d00;};'use strict';var _=require(_0x7e10('0x0'));var util=require('util');var logger=require(_0x7e10('0x1'))(_0x7e10('0x2'));var moment=require(_0x7e10('0x3'));var BPromise=require('bluebird');var rp=require(_0x7e10('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7e10('0x5'));var attributes=require(_0x7e10('0x6'));module[_0x7e10('0x7')]=function(_0x5be19f,_0x5f1edf){return _0x5be19f[_0x7e10('0x8')](_0x7e10('0x9'),attributes,{'tableName':_0x7e10('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5db8=['lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./network.attributes','exports','Network','network'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x5db8,0xbb));var _0x85db=function(_0x3233c3,_0x15e5fa){_0x3233c3=_0x3233c3-0x0;var _0x36029b=_0x5db8[_0x3233c3];return _0x36029b;};'use strict';var _=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var logger=require(_0x85db('0x2'))('api');var moment=require(_0x85db('0x3'));var BPromise=require(_0x85db('0x4'));var rp=require(_0x85db('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x85db('0x6'));var attributes=require(_0x85db('0x7'));module[_0x85db('0x8')]=function(_0x34d71f,_0x48bf16){return _0x34d71f['define'](_0x85db('0x9'),attributes,{'tableName':_0x85db('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 2612de7..c6067b4 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 _0x7375=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x7375,0x12a));var _0x5737=function(_0xab10c3,_0x1334f3){_0xab10c3=_0xab10c3-0x0;var _0x48d741=_0x7375[_0xab10c3];return _0x48d741;};'use strict';var _=require(_0x5737('0x0'));var util=require(_0x5737('0x1'));var moment=require(_0x5737('0x2'));var BPromise=require(_0x5737('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5737('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5737('0x5'));var logger=require(_0x5737('0x6'))(_0x5737('0x7'));var config=require(_0x5737('0x8'));var jayson=require(_0x5737('0x9'));var client=jayson['client'][_0x5737('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bd9e8,_0x544d54,_0x400bdb){return new BPromise(function(_0x502460,_0x2077b8){return client[_0x5737('0xb')](_0x5bd9e8,_0x400bdb)[_0x5737('0xc')](function(_0x38275a){logger[_0x5737('0xd')](_0x5737('0xe'),_0x544d54,_0x5737('0xf'));logger[_0x5737('0x10')]('Network,\x20%s,\x20%s,\x20%s',_0x544d54,_0x5737('0xf'),JSON[_0x5737('0x11')](_0x38275a));if(_0x38275a[_0x5737('0x12')]){if(_0x38275a[_0x5737('0x12')][_0x5737('0x13')]===0x1f4){logger[_0x5737('0x12')](_0x5737('0xe'),_0x544d54,_0x38275a[_0x5737('0x12')][_0x5737('0x14')]);return _0x2077b8(_0x38275a[_0x5737('0x12')]['message']);}logger[_0x5737('0x12')](_0x5737('0xe'),_0x544d54,_0x38275a[_0x5737('0x12')][_0x5737('0x14')]);return _0x502460(_0x38275a['error'][_0x5737('0x14')]);}else{logger['info'](_0x5737('0xe'),_0x544d54,_0x5737('0xf'));_0x502460(_0x38275a[_0x5737('0x15')][_0x5737('0x14')]);}})[_0x5737('0x16')](function(_0x16d7ce){logger[_0x5737('0x12')](_0x5737('0xe'),_0x544d54,_0x16d7ce);_0x2077b8(_0x16d7ce);});});} \ No newline at end of file +var _0x5a2b=['catch','lodash','util','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','request','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info'];(function(_0xb82940,_0x530318){var _0x2e152a=function(_0x27bf29){while(--_0x27bf29){_0xb82940['push'](_0xb82940['shift']());}};_0x2e152a(++_0x530318);}(_0x5a2b,0x89));var _0xb5a2=function(_0x89ee59,_0x672185){_0x89ee59=_0x89ee59-0x0;var _0x1f5557=_0x5a2b[_0x89ee59];return _0x1f5557;};'use strict';var _=require(_0xb5a2('0x0'));var util=require(_0xb5a2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb5a2('0x2'));var fs=require('fs');var Redis=require(_0xb5a2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb5a2('0x4'))('rpc');var config=require(_0xb5a2('0x5'));var jayson=require(_0xb5a2('0x6'));var client=jayson['client'][_0xb5a2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4bdaf5,_0x3359f1,_0x101a12){return new BPromise(function(_0x456f79,_0x39d7af){return client[_0xb5a2('0x8')](_0x4bdaf5,_0x101a12)['then'](function(_0x5281de){logger['info'](_0xb5a2('0x9'),_0x3359f1,'request\x20sent');logger[_0xb5a2('0xa')](_0xb5a2('0xb'),_0x3359f1,_0xb5a2('0xc'),JSON['stringify'](_0x5281de));if(_0x5281de[_0xb5a2('0xd')]){if(_0x5281de[_0xb5a2('0xd')]['code']===0x1f4){logger['error'](_0xb5a2('0x9'),_0x3359f1,_0x5281de[_0xb5a2('0xd')][_0xb5a2('0xe')]);return _0x39d7af(_0x5281de[_0xb5a2('0xd')][_0xb5a2('0xe')]);}logger[_0xb5a2('0xd')](_0xb5a2('0x9'),_0x3359f1,_0x5281de[_0xb5a2('0xd')][_0xb5a2('0xe')]);return _0x456f79(_0x5281de[_0xb5a2('0xd')][_0xb5a2('0xe')]);}else{logger[_0xb5a2('0xf')]('Network,\x20%s,\x20%s',_0x3359f1,'request\x20sent');_0x456f79(_0x5281de['result']['message']);}})[_0xb5a2('0x10')](function(_0x35e172){logger[_0xb5a2('0xd')]('Network,\x20%s,\x20%s',_0x3359f1,_0x35e172);_0x39d7af(_0x35e172);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index cc3b495..ae905c3 100644 --- a/server/api/notification/index.js +++ b/server/api/notification/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x979d=['../../components/interaction/service','post','isAuthenticated','util','path','connect-timeout'];(function(_0x564a73,_0x105513){var _0x63ebae=function(_0x3be272){while(--_0x3be272){_0x564a73['push'](_0x564a73['shift']());}};_0x63ebae(++_0x105513);}(_0x979d,0xdb));var _0xd979=function(_0x28c989,_0x337c49){_0x28c989=_0x28c989-0x0;var _0xe23c68=_0x979d[_0x28c989];return _0xe23c68;};'use strict';var multer=require('multer');var util=require(_0xd979('0x0'));var path=require(_0xd979('0x1'));var timeout=require(_0xd979('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xd979('0x3'));var config=require('../../config/environment');var controller=require('./notification.controller');router[_0xd979('0x4')]('/',auth[_0xd979('0x5')](),controller['sendNotification']);module['exports']=router; \ No newline at end of file +var _0x856b=['../../components/auth/service','../../components/interaction/service','./notification.controller','isAuthenticated','sendNotification','exports','multer','util','connect-timeout','express','Router'];(function(_0x5d2a19,_0xcaa635){var _0x4247d5=function(_0x351b10){while(--_0x351b10){_0x5d2a19['push'](_0x5d2a19['shift']());}};_0x4247d5(++_0xcaa635);}(_0x856b,0x1c9));var _0xb856=function(_0x2ef252,_0x1993fe){_0x2ef252=_0x2ef252-0x0;var _0x1139ca=_0x856b[_0x2ef252];return _0x1139ca;};'use strict';var multer=require(_0xb856('0x0'));var util=require(_0xb856('0x1'));var path=require('path');var timeout=require(_0xb856('0x2'));var express=require(_0xb856('0x3'));var router=express[_0xb856('0x4')]();var auth=require(_0xb856('0x5'));var interaction=require(_0xb856('0x6'));var config=require('../../config/environment');var controller=require(_0xb856('0x7'));router['post']('/',auth[_0xb856('0x8')](),controller[_0xb856('0x9')]);module[_0xb856('0xa')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index f9a71e0..83d6f59 100644 --- a/server/api/notification/notification.attributes.js +++ b/server/api/notification/notification.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb9b3=['BOOLEAN','sequelize','TEXT','STRING'];(function(_0x476d5f,_0x2fb4e0){var _0x4272c8=function(_0x14c51d){while(--_0x14c51d){_0x476d5f['push'](_0x476d5f['shift']());}};_0x4272c8(++_0x2fb4e0);}(_0xb9b3,0x1c5));var _0x3b9b=function(_0x18c479,_0x4c8b82){_0x18c479=_0x18c479-0x0;var _0x296ec3=_0xb9b3[_0x18c479];return _0x296ec3;};'use strict';var Sequelize=require(_0x3b9b('0x0'));module['exports']={'body':{'type':Sequelize[_0x3b9b('0x1')]},'senderName':{'type':Sequelize[_0x3b9b('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x3b9b('0x2')]},'beep':{'type':Sequelize[_0x3b9b('0x3')]}}; \ No newline at end of file +var _0x11b0=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x2b7908,_0x53b8d5){var _0x4ddbb7=function(_0x299ac5){while(--_0x299ac5){_0x2b7908['push'](_0x2b7908['shift']());}};_0x4ddbb7(++_0x53b8d5);}(_0x11b0,0x122));var _0x011b=function(_0x4494d2,_0x1a7093){_0x4494d2=_0x4494d2-0x0;var _0x3a4e91=_0x11b0[_0x4494d2];return _0x3a4e91;};'use strict';var Sequelize=require(_0x011b('0x0'));module[_0x011b('0x1')]={'body':{'type':Sequelize[_0x011b('0x2')]},'senderName':{'type':Sequelize[_0x011b('0x3')]},'recipientsId':{'type':Sequelize[_0x011b('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x011b('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 30096d2..a3bd73b 100644 --- a/server/api/notification/notification.controller.js +++ b/server/api/notification/notification.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf926=['faxqueue','mailqueue','openchannelqueue','whatsappqueue','team','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','transaction','create','forEach','recipient','notification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','ids','queue','replace','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./notification.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xf926,0x89));var _0x6f92=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf926[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x6f92('0x0'));var emlformat=require(_0x6f92('0x1'));var rimraf=require(_0x6f92('0x2'));var zipdir=require(_0x6f92('0x3'));var jsonpatch=require(_0x6f92('0x4'));var rp=require(_0x6f92('0x5'));var moment=require('moment');var BPromise=require(_0x6f92('0x6'));var Mustache=require(_0x6f92('0x7'));var util=require(_0x6f92('0x8'));var path=require('path');var sox=require(_0x6f92('0x9'));var csv=require(_0x6f92('0xa'));var ejs=require(_0x6f92('0xb'));var fs=require('fs');var _=require(_0x6f92('0xc'));var squel=require(_0x6f92('0xd'));var crypto=require(_0x6f92('0xe'));var jsforce=require(_0x6f92('0xf'));var deskjs=require(_0x6f92('0x10'));var toCsv=require(_0x6f92('0xa'));var querystring=require(_0x6f92('0x11'));var Papa=require(_0x6f92('0x12'));var Redis=require(_0x6f92('0x13'));var authService=require(_0x6f92('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x6f92('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6f92('0x16'));var utils=require(_0x6f92('0x17'));var config=require(_0x6f92('0x18'));var db=require(_0x6f92('0x19'))['db'];config['redis']=_['defaults'](config[_0x6f92('0x1a')],{'host':_0x6f92('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f92('0x1a')]));require(_0x6f92('0x1c'))[_0x6f92('0x1d')](socket);function respondWithStatusCode(_0x570978,_0x477ab0){_0x477ab0=_0x477ab0||0xcc;return function(_0x510cf1){if(_0x510cf1){return _0x570978[_0x6f92('0x1e')](_0x477ab0);}return _0x570978[_0x6f92('0x1f')](_0x477ab0)[_0x6f92('0x20')]();};}function respondWithResult(_0x3285f4,_0x3312e7){_0x3312e7=_0x3312e7||0xc8;return function(_0x10d48f){if(_0x10d48f){return _0x3285f4[_0x6f92('0x1f')](_0x3312e7)[_0x6f92('0x21')](_0x10d48f);}};}function respondWithFilteredResult(_0x3f1ab7,_0x155306){return function(_0x10fc13){if(_0x10fc13){var _0x47202f=_0x10fc13[_0x6f92('0x22')],_0x2cd8af=_0x155306[_0x6f92('0x23')],_0x346ac9=_0x155306[_0x6f92('0x23')]+_0x155306['limit'],_0x5c1693;if(_0x346ac9>=_0x47202f){_0x346ac9=_0x47202f;_0x5c1693=0xc8;}else{_0x5c1693=0xce;}_0x3f1ab7[_0x6f92('0x1f')](_0x5c1693);return _0x3f1ab7[_0x6f92('0x24')](_0x6f92('0x25'),_0x2cd8af+'-'+_0x346ac9+'/'+_0x47202f)[_0x6f92('0x21')](_0x10fc13);}return null;};}function patchUpdates(_0xa71747){return function(_0x417865){try{jsonpatch[_0x6f92('0x26')](_0x417865,_0xa71747,!![]);}catch(_0x592245){return BPromise[_0x6f92('0x27')](_0x592245);}return _0x417865[_0x6f92('0x28')]();};}function saveUpdates(_0x4f2b3e,_0x2e1e95){return function(_0x382caf){if(_0x382caf){return _0x382caf[_0x6f92('0x29')](_0x4f2b3e)[_0x6f92('0x2a')](function(_0x552fe2){return _0x552fe2;});}return null;};}function removeEntity(_0x56a94b,_0x4f45ee){return function(_0x67eb3){if(_0x67eb3){return _0x67eb3[_0x6f92('0x2b')]()['then'](function(){_0x56a94b[_0x6f92('0x1f')](0xcc)[_0x6f92('0x20')]();});}};}function handleEntityNotFound(_0x11cc45,_0x295edd){return function(_0x14bba1){if(!_0x14bba1){_0x11cc45[_0x6f92('0x1e')](0x194);}return _0x14bba1;};}function handleError(_0x73cead,_0xd36d78){_0xd36d78=_0xd36d78||0x1f4;return function(_0x20a681){logger['error'](_0x20a681[_0x6f92('0x2c')]);if(_0x20a681[_0x6f92('0x2d')]){delete _0x20a681[_0x6f92('0x2d')];}_0x73cead['status'](_0xd36d78)[_0x6f92('0x2e')](_0x20a681);};}exports['sendNotification']=function(_0x29a6ad,_0x413b04,_0x34211e){if(!_0x29a6ad[_0x6f92('0x2f')][_0x6f92('0x30')](_0x6f92('0x31'))&&!_0x29a6ad['body']['hasOwnProperty'](_0x6f92('0x32'))){throw new db[(_0x6f92('0x33'))][(_0x6f92('0x34'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x29a6ad[_0x6f92('0x2f')][_0x6f92('0x30')](_0x6f92('0x32'))&&!_0x29a6ad['body'][_0x6f92('0x30')](_0x6f92('0x35'))){throw new db[(_0x6f92('0x33'))][(_0x6f92('0x34'))](_0x6f92('0x36'));}if(!_0x29a6ad['body'][_0x6f92('0x30')](_0x6f92('0x37'))){throw new db['Sequelize'][(_0x6f92('0x34'))](_0x6f92('0x38'));}else{try{var _0x61903d=JSON[_0x6f92('0x39')](_0x29a6ad[_0x6f92('0x2f')][_0x6f92('0x37')]);}catch(_0x16dcdb){logger[_0x6f92('0x3a')](_0x16dcdb);throw new db['Sequelize']['ValidationError'](_0x6f92('0x3b'));}var _0x3933fb=[_0x6f92('0x3c'),_0x6f92('0x3d'),_0x6f92('0x3e'),_0x6f92('0x3f'),'smsqueue','voicequeue',_0x6f92('0x40'),_0x6f92('0x41'),_0x6f92('0x42')];if(_['some'](_0x61903d,function(_0xc51d19){return!_[_0x6f92('0x43')](_0x3933fb,_0xc51d19[_0x6f92('0x44')][_0x6f92('0x45')]());})){throw new db[(_0x6f92('0x33'))][(_0x6f92('0x34'))](_0x6f92('0x46'));}}}var _0x624c55={};_0x624c55[_0x6f92('0x47')]=_0x29a6ad[_0x6f92('0x2f')][_0x6f92('0x30')](_0x6f92('0x47'))?_0x29a6ad[_0x6f92('0x2f')]['senderName']:_0x29a6ad[_0x6f92('0x42')][_0x6f92('0x48')];_0x624c55[_0x6f92('0x49')]=_[_0x6f92('0x4a')](_0x29a6ad[_0x6f92('0x2f')][_0x6f92('0x49')])?null:_0x29a6ad[_0x6f92('0x2f')]['recipientsDescription'];_0x624c55[_0x6f92('0x4b')]=_0x29a6ad['body'][_0x6f92('0x4b')]||![];_0x624c55[_0x6f92('0x4c')]=_0x29a6ad['user']['id'];return getContent(_0x29a6ad[_0x6f92('0x2f')])[_0x6f92('0x2a')](function(_0x5194f5){_0x624c55[_0x6f92('0x2f')]=_0x5194f5;return getRecipients(_0x61903d);})[_0x6f92('0x2a')](function(_0x4b6056){_0x624c55[_0x6f92('0x4d')]=_[_0x6f92('0x4e')](_0x4b6056)[_0x6f92('0x4f')](',');return db['sequelize'][_0x6f92('0x50')](function(_0x503bf4){return db['Notification'][_0x6f92('0x51')](_0x624c55,{'raw':!![],'transaction':_0x503bf4})['then'](function(_0x410d21){var _0x1d199c={'sender':_0x624c55['senderName'],'description':_0x624c55['recipientsDescription'],'content':_0x624c55[_0x6f92('0x2f')],'beep':_0x624c55['beep']};_0x4b6056[_0x6f92('0x52')](function(_0x29b027){_0x1d199c[_0x6f92('0x53')]=_0x29b027;socket['emit'](_0x6f92('0x54'),_0x1d199c);});return _0x410d21;});});})['then'](respondWithResult(_0x413b04,0xc9))[_0x6f92('0x55')](handleError(_0x413b04,null));};function getContent(_0x775df9){return new BPromise(function(_0x4bd12b,_0x88bb5d){if(_0x775df9['text']){_0x4bd12b(_0x775df9[_0x6f92('0x31')]);return;}return db[_0x6f92('0x56')][_0x6f92('0x57')]({'attributes':[_0x6f92('0x58')],'where':{'id':_0x775df9[_0x6f92('0x32')]},'raw':!![]})[_0x6f92('0x2a')](function(_0x542c3b){if(!_0x542c3b)throw new db[(_0x6f92('0x33'))][(_0x6f92('0x34'))](_0x6f92('0x59'));var _0x30595b=Mustache[_0x6f92('0x5a')](_0x542c3b['html'],_0x775df9['view']);_0x4bd12b(_0x30595b);})['catch'](function(_0x2ef86a){_0x88bb5d(_0x2ef86a);});});}function getRecipients(_0x15c0c7){return new BPromise(function(_0x17f967,_0xb57091){var _0x556c51=[];var _0x57ecb2=[];_0x15c0c7[_0x6f92('0x52')](function(_0x9d6bef){var _0x68b885=_[_0x6f92('0x5b')](_0x9d6bef['model'][_0x6f92('0x45')]());if(_0x68b885===_0x6f92('0x5c')){_0x556c51=_[_0x6f92('0x5d')](_0x556c51,_0x9d6bef[_0x6f92('0x5e')]);}else{if(_[_0x6f92('0x43')](_0x68b885,_0x6f92('0x5f')))_0x68b885=_0x68b885[_0x6f92('0x60')]('queue','Queue');_0x9d6bef[_0x6f92('0x5e')][_0x6f92('0x52')](function(_0x3d2755){_0x57ecb2['push'](getAgents(_0x68b885,_0x3d2755));});}});return BPromise['all'](_0x57ecb2)[_0x6f92('0x2a')](function(_0x3c889d){_0x556c51=_[_0x6f92('0x5d')](_0x556c51,_['flatten'](_0x3c889d));_0x17f967(_0x556c51);})['catch'](function(_0x232dfc){_0xb57091(_0x232dfc);});});}function getAgents(_0x524ffb,_0x4df913){return new BPromise(function(_0x184c12,_0x3cabd8){return db[_0x524ffb][_0x6f92('0x57')]({'where':{'id':_0x4df913}})[_0x6f92('0x2a')](function(_0x268be1){return _0x268be1[_0x6f92('0x61')]({'attributes':['id'],'raw':!![]})[_0x6f92('0x2a')](function(_0x36f674){var _0x5d57c1=_[_0x6f92('0x62')](_0x36f674,'id');_0x184c12(_0x5d57c1);});})[_0x6f92('0x55')](function(_0xa442da){_0x3cabd8(_0xa442da);});});} \ No newline at end of file +var _0xf9c3=['ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./notification.socket','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','sendNotification','body','text','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','join','sequelize','forEach','recipient','notification:send','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','User','ids','queue','replace','push','all','union','flatten','getAgents','map','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x15b507,_0xf790a3){var _0x8d4ef6=function(_0x116f4c){while(--_0x116f4c){_0x15b507['push'](_0x15b507['shift']());}};_0x8d4ef6(++_0xf790a3);}(_0xf9c3,0x1ed));var _0x3f9c=function(_0x4171bf,_0x4322f3){_0x4171bf=_0x4171bf-0x0;var _0x18a433=_0xf9c3[_0x4171bf];return _0x18a433;};'use strict';var pdf=require(_0x3f9c('0x0'));var emlformat=require(_0x3f9c('0x1'));var rimraf=require(_0x3f9c('0x2'));var zipdir=require(_0x3f9c('0x3'));var jsonpatch=require(_0x3f9c('0x4'));var rp=require(_0x3f9c('0x5'));var moment=require(_0x3f9c('0x6'));var BPromise=require(_0x3f9c('0x7'));var Mustache=require(_0x3f9c('0x8'));var util=require('util');var path=require(_0x3f9c('0x9'));var sox=require(_0x3f9c('0xa'));var csv=require(_0x3f9c('0xb'));var ejs=require(_0x3f9c('0xc'));var fs=require('fs');var _=require(_0x3f9c('0xd'));var squel=require('squel');var crypto=require(_0x3f9c('0xe'));var jsforce=require(_0x3f9c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3f9c('0xb'));var querystring=require(_0x3f9c('0x10'));var Papa=require(_0x3f9c('0x11'));var Redis=require(_0x3f9c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3f9c('0x13'));var as=require(_0x3f9c('0x14'));var hardwareService=require(_0x3f9c('0x15'));var logger=require(_0x3f9c('0x16'))(_0x3f9c('0x17'));var utils=require(_0x3f9c('0x18'));var config=require(_0x3f9c('0x19'));var db=require('../../mysqldb')['db'];config[_0x3f9c('0x1a')]=_[_0x3f9c('0x1b')](config['redis'],{'host':_0x3f9c('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3f9c('0x1d'))[_0x3f9c('0x1e')](socket);function respondWithStatusCode(_0x3a8f5a,_0x18cf2e){_0x18cf2e=_0x18cf2e||0xcc;return function(_0x18199c){if(_0x18199c){return _0x3a8f5a[_0x3f9c('0x1f')](_0x18cf2e);}return _0x3a8f5a['status'](_0x18cf2e)[_0x3f9c('0x20')]();};}function respondWithResult(_0x25adfb,_0x21e249){_0x21e249=_0x21e249||0xc8;return function(_0x5c8cb2){if(_0x5c8cb2){return _0x25adfb[_0x3f9c('0x21')](_0x21e249)[_0x3f9c('0x22')](_0x5c8cb2);}};}function respondWithFilteredResult(_0x1b5719,_0xa0720e){return function(_0x4e2981){if(_0x4e2981){var _0x588be5=_0x4e2981['count'],_0x1046b5=_0xa0720e[_0x3f9c('0x23')],_0x2e206a=_0xa0720e['offset']+_0xa0720e[_0x3f9c('0x24')],_0x3d3aeb;if(_0x2e206a>=_0x588be5){_0x2e206a=_0x588be5;_0x3d3aeb=0xc8;}else{_0x3d3aeb=0xce;}_0x1b5719[_0x3f9c('0x21')](_0x3d3aeb);return _0x1b5719[_0x3f9c('0x25')](_0x3f9c('0x26'),_0x1046b5+'-'+_0x2e206a+'/'+_0x588be5)[_0x3f9c('0x22')](_0x4e2981);}return null;};}function patchUpdates(_0x36be10){return function(_0x6360f9){try{jsonpatch[_0x3f9c('0x27')](_0x6360f9,_0x36be10,!![]);}catch(_0x4c277a){return BPromise[_0x3f9c('0x28')](_0x4c277a);}return _0x6360f9['save']();};}function saveUpdates(_0x99110a,_0x350cdd){return function(_0x408623){if(_0x408623){return _0x408623[_0x3f9c('0x29')](_0x99110a)[_0x3f9c('0x2a')](function(_0x314a9f){return _0x314a9f;});}return null;};}function removeEntity(_0x127cd5,_0x3ca972){return function(_0x4c8f1a){if(_0x4c8f1a){return _0x4c8f1a['destroy']()[_0x3f9c('0x2a')](function(){_0x127cd5['status'](0xcc)[_0x3f9c('0x20')]();});}};}function handleEntityNotFound(_0x309f20,_0x2ffa8b){return function(_0x41b57f){if(!_0x41b57f){_0x309f20[_0x3f9c('0x1f')](0x194);}return _0x41b57f;};}function handleError(_0x1a1467,_0x4d5022){_0x4d5022=_0x4d5022||0x1f4;return function(_0x96aba8){logger[_0x3f9c('0x2b')](_0x96aba8[_0x3f9c('0x2c')]);if(_0x96aba8[_0x3f9c('0x2d')]){delete _0x96aba8[_0x3f9c('0x2d')];}_0x1a1467[_0x3f9c('0x21')](_0x4d5022)[_0x3f9c('0x2e')](_0x96aba8);};}exports[_0x3f9c('0x2f')]=function(_0x217d41,_0x1a5bba,_0xa2ebb1){if(!_0x217d41[_0x3f9c('0x30')]['hasOwnProperty'](_0x3f9c('0x31'))&&!_0x217d41[_0x3f9c('0x30')][_0x3f9c('0x32')](_0x3f9c('0x33'))){throw new db[(_0x3f9c('0x34'))][(_0x3f9c('0x35'))](_0x3f9c('0x36'));}else{if(_0x217d41[_0x3f9c('0x30')][_0x3f9c('0x32')](_0x3f9c('0x33'))&&!_0x217d41[_0x3f9c('0x30')][_0x3f9c('0x32')](_0x3f9c('0x37'))){throw new db[(_0x3f9c('0x34'))][(_0x3f9c('0x35'))](_0x3f9c('0x38'));}if(!_0x217d41[_0x3f9c('0x30')][_0x3f9c('0x32')](_0x3f9c('0x39'))){throw new db[(_0x3f9c('0x34'))]['ValidationError'](_0x3f9c('0x3a'));}else{try{var _0x1fe9fa=JSON[_0x3f9c('0x3b')](_0x217d41[_0x3f9c('0x30')][_0x3f9c('0x39')]);}catch(_0x3179d0){logger['error'](_0x3179d0);throw new db['Sequelize']['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x20ec97=[_0x3f9c('0x3c'),_0x3f9c('0x3d'),_0x3f9c('0x3e'),_0x3f9c('0x3f'),'smsqueue',_0x3f9c('0x40'),_0x3f9c('0x41'),_0x3f9c('0x42'),_0x3f9c('0x43')];if(_[_0x3f9c('0x44')](_0x1fe9fa,function(_0x11a923){return!_[_0x3f9c('0x45')](_0x20ec97,_0x11a923[_0x3f9c('0x46')][_0x3f9c('0x47')]());})){throw new db['Sequelize']['ValidationError'](_0x3f9c('0x48'));}}}var _0x3be1f4={};_0x3be1f4[_0x3f9c('0x49')]=_0x217d41[_0x3f9c('0x30')][_0x3f9c('0x32')]('senderName')?_0x217d41['body'][_0x3f9c('0x49')]:_0x217d41['user'][_0x3f9c('0x4a')];_0x3be1f4[_0x3f9c('0x4b')]=_[_0x3f9c('0x4c')](_0x217d41[_0x3f9c('0x30')][_0x3f9c('0x4b')])?null:_0x217d41[_0x3f9c('0x30')][_0x3f9c('0x4b')];_0x3be1f4[_0x3f9c('0x4d')]=_0x217d41[_0x3f9c('0x30')]['beep']||![];_0x3be1f4[_0x3f9c('0x4e')]=_0x217d41[_0x3f9c('0x43')]['id'];return getContent(_0x217d41[_0x3f9c('0x30')])['then'](function(_0x15bbc6){_0x3be1f4['body']=_0x15bbc6;return getRecipients(_0x1fe9fa);})[_0x3f9c('0x2a')](function(_0x84ac3e){_0x3be1f4['recipientsId']=_['sortBy'](_0x84ac3e)[_0x3f9c('0x4f')](',');return db[_0x3f9c('0x50')]['transaction'](function(_0x3e407f){return db['Notification']['create'](_0x3be1f4,{'raw':!![],'transaction':_0x3e407f})['then'](function(_0x13ec51){var _0x14d08e={'sender':_0x3be1f4['senderName'],'description':_0x3be1f4[_0x3f9c('0x4b')],'content':_0x3be1f4[_0x3f9c('0x30')],'beep':_0x3be1f4[_0x3f9c('0x4d')]};_0x84ac3e[_0x3f9c('0x51')](function(_0x212a29){_0x14d08e[_0x3f9c('0x52')]=_0x212a29;socket['emit'](_0x3f9c('0x53'),_0x14d08e);});return _0x13ec51;});});})[_0x3f9c('0x2a')](respondWithResult(_0x1a5bba,0xc9))['catch'](handleError(_0x1a5bba,null));};function getContent(_0x3c54b9){return new BPromise(function(_0x376102,_0x19b02f){if(_0x3c54b9[_0x3f9c('0x31')]){_0x376102(_0x3c54b9[_0x3f9c('0x31')]);return;}return db[_0x3f9c('0x54')][_0x3f9c('0x55')]({'attributes':[_0x3f9c('0x56')],'where':{'id':_0x3c54b9[_0x3f9c('0x33')]},'raw':!![]})[_0x3f9c('0x2a')](function(_0x30969f){if(!_0x30969f)throw new db[(_0x3f9c('0x34'))][(_0x3f9c('0x35'))](_0x3f9c('0x57'));var _0x1c9c71=Mustache[_0x3f9c('0x58')](_0x30969f[_0x3f9c('0x56')],_0x3c54b9[_0x3f9c('0x37')]);_0x376102(_0x1c9c71);})[_0x3f9c('0x59')](function(_0x5b8226){_0x19b02f(_0x5b8226);});});}function getRecipients(_0x5cd6b9){return new BPromise(function(_0x120919,_0x3f113d){var _0xa8593=[];var _0x459b95=[];_0x5cd6b9[_0x3f9c('0x51')](function(_0x40e28a){var _0x407555=_[_0x3f9c('0x5a')](_0x40e28a['model'][_0x3f9c('0x47')]());if(_0x407555===_0x3f9c('0x5b')){_0xa8593=_['union'](_0xa8593,_0x40e28a[_0x3f9c('0x5c')]);}else{if(_['includes'](_0x407555,_0x3f9c('0x5d')))_0x407555=_0x407555[_0x3f9c('0x5e')](_0x3f9c('0x5d'),'Queue');_0x40e28a[_0x3f9c('0x5c')][_0x3f9c('0x51')](function(_0x5a6ab1){_0x459b95[_0x3f9c('0x5f')](getAgents(_0x407555,_0x5a6ab1));});}});return BPromise[_0x3f9c('0x60')](_0x459b95)[_0x3f9c('0x2a')](function(_0xd3e38c){_0xa8593=_[_0x3f9c('0x61')](_0xa8593,_[_0x3f9c('0x62')](_0xd3e38c));_0x120919(_0xa8593);})['catch'](function(_0x23d5e8){_0x3f113d(_0x23d5e8);});});}function getAgents(_0x4c2e49,_0x3dbcc7){return new BPromise(function(_0x2a2890,_0xd40e6c){return db[_0x4c2e49][_0x3f9c('0x55')]({'where':{'id':_0x3dbcc7}})[_0x3f9c('0x2a')](function(_0x56c3df){return _0x56c3df[_0x3f9c('0x63')]({'attributes':['id'],'raw':!![]})['then'](function(_0x264f90){var _0x4bf54a=_[_0x3f9c('0x64')](_0x264f90,'id');_0x2a2890(_0x4bf54a);});})[_0x3f9c('0x59')](function(_0x46d2fb){_0xd40e6c(_0x46d2fb);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 30f3944..20f0587 100644 --- a/server/api/notification/notification.events.js +++ b/server/api/notification/notification.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['exports','../../mysqldb','Notification','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0x2032,0xd9));var _0x2203=function(_0x45ac2b,_0x24856a){_0x45ac2b=_0x45ac2b-0x0;var _0x51b0ce=_0x2032[_0x45ac2b];return _0x51b0ce;};'use strict';var EventEmitter=require('events');var Notification=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){NotificationEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);NotificationEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];Notification[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=NotificationEvents; \ No newline at end of file +var _0x757a=['../../mysqldb','Notification','remove','emit','hasOwnProperty','hook'];(function(_0x12f8b3,_0x4e2a78){var _0x131881=function(_0x45fa5b){while(--_0x45fa5b){_0x12f8b3['push'](_0x12f8b3['shift']());}};_0x131881(++_0x4e2a78);}(_0x757a,0xde));var _0xa757=function(_0x19921,_0x5a7f8f){_0x19921=_0x19921-0x0;var _0x1201d9=_0x757a[_0x19921];return _0x1201d9;};'use strict';var EventEmitter=require('events');var Notification=require(_0xa757('0x0'))['db'][_0xa757('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa757('0x2')};function emitEvent(_0x1721c6){return function(_0x1c2932,_0x453d07,_0x32630d){NotificationEvents[_0xa757('0x3')](_0x1721c6+':'+_0x1c2932['id'],_0x1c2932);NotificationEvents['emit'](_0x1721c6,_0x1c2932);_0x32630d(null);};}for(var e in events){if(events[_0xa757('0x4')](e)){var event=events[e];Notification[_0xa757('0x5')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index e72faff..3bb0c66 100644 --- a/server/api/notification/notification.model.js +++ b/server/api/notification/notification.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb62e=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./notification.attributes','define','notifications'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xb62e,0x1de));var _0xeb62=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xb62e[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var logger=require(_0xeb62('0x2'))(_0xeb62('0x3'));var moment=require('moment');var BPromise=require(_0xeb62('0x4'));var rp=require(_0xeb62('0x5'));var fs=require('fs');var path=require(_0xeb62('0x6'));var rimraf=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var attributes=require(_0xeb62('0x9'));module['exports']=function(_0x3ec879,_0x455e1a){return _0x3ec879[_0xeb62('0xa')]('Notification',attributes,{'tableName':_0xeb62('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeb62('0xc'),'collate':_0xeb62('0xd')});}; \ No newline at end of file +var _0x8603=['util','../../config/logger','api','request-promise','path','rimraf','./notification.attributes','define','Notification','notifications'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8603,0x190));var _0x3860=function(_0x321cc3,_0xd7325c){_0x321cc3=_0x321cc3-0x0;var _0x5d4df2=_0x8603[_0x321cc3];return _0x5d4df2;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var logger=require(_0x3860('0x1'))(_0x3860('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3860('0x3'));var fs=require('fs');var path=require(_0x3860('0x4'));var rimraf=require(_0x3860('0x5'));var config=require('../../config/environment');var attributes=require(_0x3860('0x6'));module['exports']=function(_0xb0fc24,_0x40739b){return _0xb0fc24[_0x3860('0x7')](_0x3860('0x8'),attributes,{'tableName':_0x3860('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index ad3d666..cb23f4b 100644 --- a/server/api/notification/notification.rpc.js +++ b/server/api/notification/notification.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7d9=['debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./notification.socket','register','request','then','info','Notification,\x20%s,\x20%s','request\x20sent'];(function(_0x1a621d,_0x384ab0){var _0x347975=function(_0x58a50d){while(--_0x58a50d){_0x1a621d['push'](_0x1a621d['shift']());}};_0x347975(++_0x384ab0);}(_0xb7d9,0x1a7));var _0x9b7d=function(_0x3f0577,_0x13d404){_0x3f0577=_0x3f0577-0x0;var _0x3c70dc=_0xb7d9[_0x3f0577];return _0x3c70dc;};'use strict';var _=require(_0x9b7d('0x0'));var util=require('util');var moment=require(_0x9b7d('0x1'));var BPromise=require('bluebird');var rs=require(_0x9b7d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b7d('0x3'))['db'];var utils=require(_0x9b7d('0x4'));var logger=require(_0x9b7d('0x5'))(_0x9b7d('0x6'));var config=require(_0x9b7d('0x7'));var jayson=require(_0x9b7d('0x8'));var client=jayson['client'][_0x9b7d('0x9')]({'port':0x232a});config[_0x9b7d('0xa')]=_['defaults'](config[_0x9b7d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x9b7d('0xb'))(new Redis(config[_0x9b7d('0xa')]));require(_0x9b7d('0xc'))[_0x9b7d('0xd')](socket);function respondWithRpcPromise(_0x379346,_0x11a9b3,_0x48ba30){return new BPromise(function(_0x24e1f1,_0x3e8455){return client[_0x9b7d('0xe')](_0x379346,_0x48ba30)[_0x9b7d('0xf')](function(_0x25d3d5){logger[_0x9b7d('0x10')](_0x9b7d('0x11'),_0x11a9b3,_0x9b7d('0x12'));logger[_0x9b7d('0x13')](_0x9b7d('0x14'),_0x11a9b3,_0x9b7d('0x12'),JSON[_0x9b7d('0x15')](_0x25d3d5));if(_0x25d3d5[_0x9b7d('0x16')]){if(_0x25d3d5['error'][_0x9b7d('0x17')]===0x1f4){logger[_0x9b7d('0x16')]('Notification,\x20%s,\x20%s',_0x11a9b3,_0x25d3d5['error'][_0x9b7d('0x18')]);return _0x3e8455(_0x25d3d5[_0x9b7d('0x16')]['message']);}logger['error'](_0x9b7d('0x11'),_0x11a9b3,_0x25d3d5[_0x9b7d('0x16')][_0x9b7d('0x18')]);return _0x24e1f1(_0x25d3d5['error'][_0x9b7d('0x18')]);}else{logger['info'](_0x9b7d('0x11'),_0x11a9b3,'request\x20sent');_0x24e1f1(_0x25d3d5['result']['message']);}})[_0x9b7d('0x19')](function(_0x5643d0){logger[_0x9b7d('0x16')](_0x9b7d('0x11'),_0x11a9b3,_0x5643d0);_0x3e8455(_0x5643d0);});});} \ No newline at end of file +var _0x7754=['Notification,\x20%s,\x20%s','request\x20sent','Notification,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','socket.io-emitter','redis','./notification.socket','register','request','then'];(function(_0x6942e0,_0x131e6d){var _0xb86490=function(_0x2fd5d7){while(--_0x2fd5d7){_0x6942e0['push'](_0x6942e0['shift']());}};_0xb86490(++_0x131e6d);}(_0x7754,0x189));var _0x4775=function(_0x142ec2,_0x5bb03d){_0x142ec2=_0x142ec2-0x0;var _0x45ef4e=_0x7754[_0x142ec2];return _0x45ef4e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4775('0x0'));var BPromise=require('bluebird');var rs=require(_0x4775('0x1'));var fs=require('fs');var Redis=require(_0x4775('0x2'));var db=require(_0x4775('0x3'))['db'];var utils=require(_0x4775('0x4'));var logger=require(_0x4775('0x5'))(_0x4775('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4775('0x7')][_0x4775('0x8')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4775('0x9'))(new Redis(config[_0x4775('0xa')]));require(_0x4775('0xb'))[_0x4775('0xc')](socket);function respondWithRpcPromise(_0x23d808,_0x263b4f,_0x187567){return new BPromise(function(_0x5611e8,_0x53b366){return client[_0x4775('0xd')](_0x23d808,_0x187567)[_0x4775('0xe')](function(_0x13d3d2){logger['info'](_0x4775('0xf'),_0x263b4f,_0x4775('0x10'));logger['debug'](_0x4775('0x11'),_0x263b4f,_0x4775('0x10'),JSON[_0x4775('0x12')](_0x13d3d2));if(_0x13d3d2[_0x4775('0x13')]){if(_0x13d3d2['error']['code']===0x1f4){logger['error']('Notification,\x20%s,\x20%s',_0x263b4f,_0x13d3d2[_0x4775('0x13')][_0x4775('0x14')]);return _0x53b366(_0x13d3d2[_0x4775('0x13')][_0x4775('0x14')]);}logger[_0x4775('0x13')](_0x4775('0xf'),_0x263b4f,_0x13d3d2['error']['message']);return _0x5611e8(_0x13d3d2[_0x4775('0x13')][_0x4775('0x14')]);}else{logger[_0x4775('0x15')](_0x4775('0xf'),_0x263b4f,'request\x20sent');_0x5611e8(_0x13d3d2[_0x4775('0x16')][_0x4775('0x14')]);}})[_0x4775('0x17')](function(_0x3fc6c3){logger['error'](_0x4775('0xf'),_0x263b4f,_0x3fc6c3);_0x53b366(_0x3fc6c3);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 28eb8d7..3297e4d 100644 --- a/server/api/notification/notification.socket.js +++ b/server/api/notification/notification.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa0fb=['emit','removeListener','register','length','notification:','./notification.events','save','remove'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xa0fb,0x11d));var _0xba0f=function(_0x4660bd,_0x3e5fb8){_0x4660bd=_0x4660bd-0x0;var _0x18a60f=_0xa0fb[_0x4660bd];return _0x18a60f;};'use strict';var NotificationEvents=require(_0xba0f('0x0'));var events=[_0xba0f('0x1'),_0xba0f('0x2'),'update'];function createListener(_0x5ad084,_0x1d5e7b){return function(_0x21d257){_0x1d5e7b[_0xba0f('0x3')](_0x5ad084,_0x21d257);};}function removeListener(_0x2bc376,_0x1f8a06){return function(){NotificationEvents[_0xba0f('0x4')](_0x2bc376,_0x1f8a06);};}exports[_0xba0f('0x5')]=function(_0x50a391){for(var _0x2fd774=0x0,_0x5373db=events[_0xba0f('0x6')];_0x2fd774<_0x5373db;_0x2fd774++){var _0x2baee2=events[_0x2fd774];var _0xb1174c=createListener(_0xba0f('0x7')+_0x2baee2,_0x50a391);NotificationEvents['on'](_0x2baee2,_0xb1174c);}}; \ No newline at end of file +var _0x2183=['save','remove','update','emit','removeListener','length','./notification.events'];(function(_0xf25f61,_0x2e72b8){var _0x24c68e=function(_0xddabad){while(--_0xddabad){_0xf25f61['push'](_0xf25f61['shift']());}};_0x24c68e(++_0x2e72b8);}(_0x2183,0x1e9));var _0x3218=function(_0xdab2d2,_0x29a184){_0xdab2d2=_0xdab2d2-0x0;var _0x56f37c=_0x2183[_0xdab2d2];return _0x56f37c;};'use strict';var NotificationEvents=require(_0x3218('0x0'));var events=[_0x3218('0x1'),_0x3218('0x2'),_0x3218('0x3')];function createListener(_0x442b10,_0x45b2f7){return function(_0x29645f){_0x45b2f7[_0x3218('0x4')](_0x442b10,_0x29645f);};}function removeListener(_0x5a2acd,_0x4c2c88){return function(){NotificationEvents[_0x3218('0x5')](_0x5a2acd,_0x4c2c88);};}exports['register']=function(_0x40946a){for(var _0x31a077=0x0,_0x50eef1=events[_0x3218('0x6')];_0x31a077<_0x50eef1;_0x31a077++){var _0x5202b6=events[_0x31a077];var _0x778af0=createListener('notification:'+_0x5202b6,_0x40946a);NotificationEvents['on'](_0x5202b6,_0x778af0);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 8f1b9f1..6cad5f7 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 _0x08c8=['getAnswers','getApplications','/:id/interactions','getInteractions','getAgents','post','create','addDisposition','addAnswer','notify','/:id/applications','addApplications','/:id/users','addAgents','/:id/send','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x08c8,0x188));var _0x808c=function(_0xaa9403,_0x22179c){_0xaa9403=_0xaa9403-0x0;var _0x31a740=_0x08c8[_0xaa9403];return _0x31a740;};'use strict';var multer=require(_0x808c('0x0'));var util=require(_0x808c('0x1'));var path=require(_0x808c('0x2'));var timeout=require(_0x808c('0x3'));var express=require(_0x808c('0x4'));var router=express[_0x808c('0x5')]();var auth=require(_0x808c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x808c('0x7'));var controller=require(_0x808c('0x8'));router['get']('/',auth[_0x808c('0x9')](),controller[_0x808c('0xa')]);router[_0x808c('0xb')](_0x808c('0xc'),auth[_0x808c('0x9')](),controller[_0x808c('0xd')]);router[_0x808c('0xb')](_0x808c('0xe'),auth['isAuthenticated'](),controller[_0x808c('0xf')]);router[_0x808c('0xb')](_0x808c('0x10'),auth[_0x808c('0x9')](),controller['getDispositions']);router[_0x808c('0xb')](_0x808c('0x11'),auth[_0x808c('0x9')](),controller[_0x808c('0x12')]);router[_0x808c('0xb')]('/:id/applications',auth[_0x808c('0x9')](),controller[_0x808c('0x13')]);router[_0x808c('0xb')](_0x808c('0x14'),auth['isAuthenticated'](),controller[_0x808c('0x15')]);router['get']('/:id/users',auth[_0x808c('0x9')](),controller[_0x808c('0x16')]);router[_0x808c('0x17')]('/',auth[_0x808c('0x9')](),controller[_0x808c('0x18')]);router[_0x808c('0x17')](_0x808c('0x10'),auth[_0x808c('0x9')](),controller[_0x808c('0x19')]);router[_0x808c('0x17')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x808c('0x1a')]);router[_0x808c('0x17')]('/:id/notify',controller[_0x808c('0x1b')]);router[_0x808c('0x17')](_0x808c('0x1c'),auth['isAuthenticated'](),controller[_0x808c('0x1d')]);router[_0x808c('0x17')](_0x808c('0x1e'),auth[_0x808c('0x9')](),controller[_0x808c('0x1f')]);router[_0x808c('0x17')](_0x808c('0x20'),auth[_0x808c('0x9')](),controller[_0x808c('0x21')]);router[_0x808c('0x22')](_0x808c('0xe'),auth[_0x808c('0x9')](),controller['update']);router[_0x808c('0x23')](_0x808c('0xe'),auth[_0x808c('0x9')](),controller[_0x808c('0x24')]);router['delete'](_0x808c('0x10'),auth[_0x808c('0x9')](),controller[_0x808c('0x25')]);router[_0x808c('0x23')](_0x808c('0x11'),auth[_0x808c('0x9')](),controller[_0x808c('0x26')]);router[_0x808c('0x23')](_0x808c('0x1e'),auth[_0x808c('0x9')](),controller[_0x808c('0x27')]);module[_0x808c('0x28')]=router; \ No newline at end of file +var _0xb841=['removeAnswers','removeAgents','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition','addAnswer','/:id/notify','/:id/applications','addApplications','/:id/send','send','put','/:id','update','destroy','delete'];(function(_0x493e42,_0x2b8d78){var _0x4a3bca=function(_0x12ec18){while(--_0x12ec18){_0x493e42['push'](_0x493e42['shift']());}};_0x4a3bca(++_0x2b8d78);}(_0xb841,0x159));var _0x1b84=function(_0x2b10e7,_0x9837b5){_0x2b10e7=_0x2b10e7-0x0;var _0x3b79b8=_0xb841[_0x2b10e7];return _0x3b79b8;};'use strict';var multer=require(_0x1b84('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1b84('0x1'));var express=require(_0x1b84('0x2'));var router=express['Router']();var auth=require(_0x1b84('0x3'));var interaction=require(_0x1b84('0x4'));var config=require('../../config/environment');var controller=require(_0x1b84('0x5'));router[_0x1b84('0x6')]('/',auth[_0x1b84('0x7')](),controller[_0x1b84('0x8')]);router[_0x1b84('0x6')](_0x1b84('0x9'),auth['isAuthenticated'](),controller[_0x1b84('0xa')]);router[_0x1b84('0x6')]('/:id',auth[_0x1b84('0x7')](),controller[_0x1b84('0xb')]);router[_0x1b84('0x6')](_0x1b84('0xc'),auth[_0x1b84('0x7')](),controller[_0x1b84('0xd')]);router[_0x1b84('0x6')](_0x1b84('0xe'),auth[_0x1b84('0x7')](),controller[_0x1b84('0xf')]);router[_0x1b84('0x6')]('/:id/applications',auth[_0x1b84('0x7')](),controller[_0x1b84('0x10')]);router[_0x1b84('0x6')](_0x1b84('0x11'),auth[_0x1b84('0x7')](),controller[_0x1b84('0x12')]);router['get'](_0x1b84('0x13'),auth['isAuthenticated'](),controller[_0x1b84('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1b84('0x15')]);router[_0x1b84('0x16')]('/:id/dispositions',auth[_0x1b84('0x7')](),controller[_0x1b84('0x17')]);router['post'](_0x1b84('0xe'),auth[_0x1b84('0x7')](),controller[_0x1b84('0x18')]);router[_0x1b84('0x16')](_0x1b84('0x19'),controller['notify']);router[_0x1b84('0x16')](_0x1b84('0x1a'),auth[_0x1b84('0x7')](),controller[_0x1b84('0x1b')]);router[_0x1b84('0x16')]('/:id/users',auth[_0x1b84('0x7')](),controller['addAgents']);router[_0x1b84('0x16')](_0x1b84('0x1c'),auth[_0x1b84('0x7')](),controller[_0x1b84('0x1d')]);router[_0x1b84('0x1e')](_0x1b84('0x1f'),auth[_0x1b84('0x7')](),controller[_0x1b84('0x20')]);router['delete']('/:id',auth[_0x1b84('0x7')](),controller[_0x1b84('0x21')]);router[_0x1b84('0x22')](_0x1b84('0xc'),auth[_0x1b84('0x7')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x1b84('0x23')]);router[_0x1b84('0x22')](_0x1b84('0x13'),auth['isAuthenticated'](),controller[_0x1b84('0x24')]);module[_0x1b84('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 4490013..87f8071 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 _0x7b96=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x1a1310,_0x3c17eb){var _0x5b9a44=function(_0xd4622b){while(--_0xd4622b){_0x1a1310['push'](_0x1a1310['shift']());}};_0x5b9a44(++_0x3c17eb);}(_0x7b96,0x7b));var _0x67b9=function(_0x3ba4ee,_0x564a10){_0x3ba4ee=_0x3ba4ee-0x0;var _0x477f39=_0x7b96[_0x3ba4ee];return _0x477f39;};'use strict';var Sequelize=require(_0x67b9('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x67b9('0x1')],'unique':_0x67b9('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x67b9('0x1')]},'token':{'type':Sequelize[_0x67b9('0x1')],'defaultValue':function(){return rs[_0x67b9('0x3')]();}},'replyUri':{'type':Sequelize[_0x67b9('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x67b9('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x67b9('0x4');}},'notificationSound':{'type':Sequelize[_0x67b9('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x67b9('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x67b9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x67b9('0x1')]},'queueTransfer':{'type':Sequelize[_0x67b9('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x67b9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x67b9('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x67b9('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x67b9('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x67b9('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x67b9('0x5')],'defaultValue':![],'comment':_0x67b9('0x8'),'set':function(_0x174d24){if(!_0x174d24)this[_0x67b9('0x9')](_0x67b9('0xa'),null);this[_0x67b9('0x9')](_0x67b9('0xb'),_0x174d24);}}}; \ No newline at end of file +var _0x48c1=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x5c4ffe,_0x297f0c){var _0x1808c0=function(_0x5ee93c){while(--_0x5ee93c){_0x5c4ffe['push'](_0x5c4ffe['shift']());}};_0x1808c0(++_0x297f0c);}(_0x48c1,0x191));var _0x148c=function(_0x435044,_0x36ab8e){_0x435044=_0x435044-0x0;var _0x33d4c6=_0x48c1[_0x435044];return _0x33d4c6;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x148c('0x0')]={'name':{'type':Sequelize[_0x148c('0x1')],'unique':_0x148c('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x148c('0x1')],'defaultValue':function(){return rs[_0x148c('0x3')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x148c('0x4')],'defaultValue':function(){return _0x148c('0x5');}},'notificationSound':{'type':Sequelize[_0x148c('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x148c('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x148c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x148c('0x1')]},'queueTransfer':{'type':Sequelize[_0x148c('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x148c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x148c('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x148c('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x148c('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x148c('0x9'),'set':function(_0x2f71be){if(!_0x2f71be)this['setDataValue'](_0x148c('0xa'),null);this[_0x148c('0xb')]('mandatoryDisposition',_0x2f71be);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 113187f..09c064c 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 _0xc75e=['OpnechannelAccountId','Disposition','getDispositions','order','pick','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','hasOwnProperty','nolimit','removeAnswers','notify','openchannel','CmContact','ValidationError','updatedAt','difference','createdAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','OpenchannelApplication','List','Applications','applications','orderBy','priority','asc','account','Contacts','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','spread','contact','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getInteractions','Contact','Owner','fullname','internal','color','tag','addAgents','omit','emit','removeAgents','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','dataValues','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','json','apply','save','update','get','OpenchannelAccounts','UserProfileResource','destroy','stack','send','index','Pause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','name','query','keys','filters','attributes','intersection','fields','length','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','mandatoryDispositionPause','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition'];(function(_0x5b870c,_0x4c0ca1){var _0x36e65d=function(_0x76de50){while(--_0x76de50){_0x5b870c['push'](_0x5b870c['shift']());}};_0x36e65d(++_0x4c0ca1);}(_0xc75e,0x1d1));var _0xec75=function(_0x5d7142,_0x4fc3bb){_0x5d7142=_0x5d7142-0x0;var _0x440b53=_0xc75e[_0x5d7142];return _0x440b53;};'use strict';var pdf=require(_0xec75('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xec75('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xec75('0x2'));var rp=require(_0xec75('0x3'));var moment=require(_0xec75('0x4'));var BPromise=require(_0xec75('0x5'));var Mustache=require(_0xec75('0x6'));var util=require('util');var path=require(_0xec75('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xec75('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xec75('0x9'));var crypto=require(_0xec75('0xa'));var jsforce=require(_0xec75('0xb'));var deskjs=require(_0xec75('0xc'));var toCsv=require(_0xec75('0xd'));var querystring=require(_0xec75('0xe'));var Papa=require(_0xec75('0xf'));var Redis=require('ioredis');var authService=require(_0xec75('0x10'));var qs=require(_0xec75('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec75('0x12'));var logger=require(_0xec75('0x13'))(_0xec75('0x14'));var utils=require(_0xec75('0x15'));var config=require(_0xec75('0x16'));var db=require('../../mysqldb')['db'];config[_0xec75('0x17')]=_[_0xec75('0x18')](config['redis'],{'host':_0xec75('0x19'),'port':0x18eb});var socket=require(_0xec75('0x1a'))(new Redis(config[_0xec75('0x17')]));require(_0xec75('0x1b'))['register'](socket);var jayson=require(_0xec75('0x1c'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xec75('0x1d')][_0xec75('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x5b6c50,_0x163143,_0x264b6c){if(_0x264b6c){var _0x2a4d60=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a4d60[_0xec75('0x1f')](_0x163143)){return _0x5b6c50;}else{throw new db[(_0xec75('0x20'))]['ValidationError'](_0xec75('0x21'));}}else{return _0x5b6c50;}}function respondWithRpcPromise(_0xf9073a,_0xe83b3c,_0x31a8ca,_0x35f91a){return new BPromise(function(_0x316b94,_0xd69ff8){var _0x5c8fc3=_0x35f91a||client;return _0x5c8fc3['request'](_0xf9073a,_0x31a8ca)[_0xec75('0x22')](function(_0x16da16){logger[_0xec75('0x23')](_0xec75('0x24'),_0xe83b3c,'request\x20sent');logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0xe83b3c,_0xec75('0x25'),JSON[_0xec75('0x26')](_0x16da16));if(_0x16da16[_0xec75('0x27')]){if(_0x16da16['error'][_0xec75('0x28')]===0x1f4){logger[_0xec75('0x27')](_0xec75('0x24'),_0xe83b3c,_0x16da16[_0xec75('0x27')][_0xec75('0x29')]);return _0xd69ff8(_0x16da16[_0xec75('0x27')][_0xec75('0x29')]);}logger[_0xec75('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0xe83b3c,_0x16da16[_0xec75('0x27')]['message']);return _0x316b94(_0x16da16[_0xec75('0x27')][_0xec75('0x29')]);}else{logger[_0xec75('0x23')](_0xec75('0x24'),_0xe83b3c,_0xec75('0x25'));_0x316b94(_0x16da16[_0xec75('0x2a')][_0xec75('0x29')]);}})[_0xec75('0x2b')](function(_0x4c725b){logger[_0xec75('0x27')](_0xec75('0x24'),_0xe83b3c,_0x4c725b);_0xd69ff8(_0x4c725b);});});}function respondWithStatusCode(_0x416328,_0x1af5e7){_0x1af5e7=_0x1af5e7||0xcc;return function(_0x5cc1d6){if(_0x5cc1d6){return _0x416328[_0xec75('0x2c')](_0x1af5e7);}return _0x416328[_0xec75('0x2d')](_0x1af5e7)[_0xec75('0x2e')]();};}function respondWithResult(_0x4e0409,_0x66be2f){_0x66be2f=_0x66be2f||0xc8;return function(_0x221b68){if(_0x221b68){return _0x4e0409['status'](_0x66be2f)['json'](_0x221b68);}};}function respondWithFilteredResult(_0x257e60,_0x2c90e9){return function(_0x49413b){if(_0x49413b){var _0x3a8079=_0x49413b[_0xec75('0x2f')],_0x55faed=_0x2c90e9[_0xec75('0x30')],_0x4bb6cd=_0x2c90e9[_0xec75('0x30')]+_0x2c90e9[_0xec75('0x31')],_0x127774;if(_0x4bb6cd>=_0x3a8079){_0x4bb6cd=_0x3a8079;_0x127774=0xc8;}else{_0x127774=0xce;}_0x257e60[_0xec75('0x2d')](_0x127774);return _0x257e60[_0xec75('0x32')]('Content-Range',_0x55faed+'-'+_0x4bb6cd+'/'+_0x3a8079)[_0xec75('0x33')](_0x49413b);}return null;};}function patchUpdates(_0x1cd347){return function(_0x532ff8){try{jsonpatch[_0xec75('0x34')](_0x532ff8,_0x1cd347,!![]);}catch(_0x20f6fa){return BPromise['reject'](_0x20f6fa);}return _0x532ff8[_0xec75('0x35')]();};}function saveUpdates(_0x4c0016,_0x1b92c8){return function(_0x3c3732){if(_0x3c3732){return _0x3c3732[_0xec75('0x36')](_0x4c0016)[_0xec75('0x22')](function(_0x4fbfa9){return _0x4fbfa9;});}return null;};}function removeEntity(_0x3ffb13,_0x2fb78e){return function(_0x20f7cc){if(_0x20f7cc){return _0x20f7cc['destroy']()[_0xec75('0x22')](function(){var _0x207c7b=_0x20f7cc[_0xec75('0x37')]({'plain':!![]});var _0x51dd23=_0xec75('0x38');return db[_0xec75('0x39')][_0xec75('0x3a')]({'where':{'type':_0x51dd23,'resourceId':_0x207c7b['id']}})[_0xec75('0x22')](function(){return _0x20f7cc;});})[_0xec75('0x22')](function(){_0x3ffb13[_0xec75('0x2d')](0xcc)[_0xec75('0x2e')]();});}};}function handleEntityNotFound(_0x5acc71,_0x569072){return function(_0x22248d){if(!_0x22248d){_0x5acc71[_0xec75('0x2c')](0x194);}return _0x22248d;};}function handleError(_0x11587e,_0x39be95){_0x39be95=_0x39be95||0x1f4;return function(_0x20ddea){logger['error'](_0x20ddea[_0xec75('0x3b')]);if(_0x20ddea['name']){delete _0x20ddea['name'];}_0x11587e[_0xec75('0x2d')](_0x39be95)[_0xec75('0x3c')](_0x20ddea);};}exports[_0xec75('0x3d')]=function(_0x655907,_0x69209d){var _0x37d57a={'include':[{'model':db[_0xec75('0x3e')],'as':'mandatoryDispositionPause'}]},_0x55b475={},_0x1a196f={'count':0x0,'rows':[]};var _0xafc091=_[_0xec75('0x3f')](db[_0xec75('0x40')][_0xec75('0x41')],function(_0x1b97b2){return{'name':_0x1b97b2[_0xec75('0x42')],'type':_0x1b97b2[_0xec75('0x43')]['key']};});_0x55b475[_0xec75('0x44')]=_['map'](_0xafc091,_0xec75('0x45'));_0x55b475[_0xec75('0x46')]=_[_0xec75('0x47')](_0x655907[_0xec75('0x46')]);_0x55b475[_0xec75('0x48')]=_['intersection'](_0x55b475['model'],_0x55b475['query']);_0x37d57a[_0xec75('0x49')]=_[_0xec75('0x4a')](_0x55b475[_0xec75('0x44')],qs[_0xec75('0x4b')](_0x655907[_0xec75('0x46')][_0xec75('0x4b')]));_0x37d57a[_0xec75('0x49')]=_0x37d57a[_0xec75('0x49')][_0xec75('0x4c')]?_0x37d57a[_0xec75('0x49')]:_0x55b475[_0xec75('0x44')];if(!_0x655907['query']['hasOwnProperty']('nolimit')){_0x37d57a[_0xec75('0x31')]=qs[_0xec75('0x31')](_0x655907[_0xec75('0x46')]['limit']);_0x37d57a['offset']=qs[_0xec75('0x30')](_0x655907[_0xec75('0x46')][_0xec75('0x30')]);}_0x37d57a['order']=qs['sort'](_0x655907[_0xec75('0x46')][_0xec75('0x4d')]);_0x37d57a[_0xec75('0x4e')]=qs[_0xec75('0x48')](_['pick'](_0x655907[_0xec75('0x46')],_0x55b475[_0xec75('0x48')]),_0xafc091);if(_0x655907[_0xec75('0x46')][_0xec75('0x4f')]){_0x37d57a[_0xec75('0x4e')]=_[_0xec75('0x50')](_0x37d57a['where'],{'$or':_[_0xec75('0x3f')](_0xafc091,function(_0x292518){if(_0x292518[_0xec75('0x43')]!==_0xec75('0x51')){var _0x4a2491={};_0x4a2491[_0x292518['name']]={'$like':'%'+_0x655907[_0xec75('0x46')][_0xec75('0x4f')]+'%'};return _0x4a2491;}})});}_0x37d57a=_['merge']({},_0x37d57a,_0x655907[_0xec75('0x52')]);var _0x178ef1={'where':_0x37d57a[_0xec75('0x4e')]};return db[_0xec75('0x40')][_0xec75('0x2f')](_0x178ef1)[_0xec75('0x22')](function(_0xcf392d){_0x1a196f[_0xec75('0x2f')]=_0xcf392d;if(_0x655907[_0xec75('0x46')][_0xec75('0x53')]){_0x37d57a['include']=[{'all':!![]}];}return db[_0xec75('0x40')][_0xec75('0x54')](_0x37d57a);})[_0xec75('0x22')](function(_0x4a1e2f){_0x1a196f[_0xec75('0x55')]=_0x4a1e2f;return _0x1a196f;})['then'](respondWithFilteredResult(_0x69209d,_0x37d57a))[_0xec75('0x2b')](handleError(_0x69209d,null));};exports['show']=function(_0x194a8e,_0xe52b89){var _0x470657={'raw':![],'where':{'id':_0x194a8e[_0xec75('0x56')]['id']},'include':[{'model':db[_0xec75('0x3e')],'as':_0xec75('0x57')}]},_0x3ec245={};_0x3ec245[_0xec75('0x44')]=_[_0xec75('0x47')](db[_0xec75('0x40')][_0xec75('0x41')]);_0x3ec245['query']=_[_0xec75('0x47')](_0x194a8e[_0xec75('0x46')]);_0x3ec245['filters']=_['intersection'](_0x3ec245['model'],_0x3ec245[_0xec75('0x46')]);_0x470657['attributes']=_[_0xec75('0x4a')](_0x3ec245['model'],qs['fields'](_0x194a8e[_0xec75('0x46')][_0xec75('0x4b')]));_0x470657['attributes']=_0x470657[_0xec75('0x49')][_0xec75('0x4c')]?_0x470657['attributes']:_0x3ec245[_0xec75('0x44')];if(_0x194a8e[_0xec75('0x46')][_0xec75('0x53')]){_0x470657[_0xec75('0x58')]=[{'all':!![]}];}_0x470657=_['merge']({},_0x470657,_0x194a8e[_0xec75('0x52')]);return db['OpenchannelAccount'][_0xec75('0x59')](_0x470657)['then'](handleEntityNotFound(_0xe52b89,null))[_0xec75('0x22')](respondWithResult(_0xe52b89,null))[_0xec75('0x2b')](handleError(_0xe52b89,null));};exports[_0xec75('0x5a')]=function(_0x56cfe2,_0x4351ec){return db[_0xec75('0x40')]['create'](_0x56cfe2['body'],{})[_0xec75('0x22')](function(_0x1eccdc){var _0x59635d=_0x56cfe2[_0xec75('0x5b')][_0xec75('0x37')]({'plain':!![]});if(!_0x59635d)throw new Error(_0xec75('0x5c'));if(_0x59635d['role']===_0xec75('0x5b')){var _0x21347f=_0x1eccdc[_0xec75('0x37')]({'plain':!![]});var _0xde1dae='OpenchannelAccounts';return db[_0xec75('0x5d')]['find']({'where':{'name':_0xde1dae,'userProfileId':_0x59635d[_0xec75('0x5e')]},'raw':!![]})[_0xec75('0x22')](function(_0x9cd123){if(_0x9cd123&&_0x9cd123['autoAssociation']===0x0){return db[_0xec75('0x39')][_0xec75('0x5a')]({'name':_0x21347f[_0xec75('0x45')],'resourceId':_0x21347f['id'],'type':_0x9cd123[_0xec75('0x45')],'sectionId':_0x9cd123['id']},{})[_0xec75('0x22')](function(){return _0x1eccdc;});}else{return _0x1eccdc;}})[_0xec75('0x2b')](function(_0x32724d){logger[_0xec75('0x27')](_0xec75('0x5f'),_0x32724d);throw _0x32724d;});}return _0x1eccdc;})[_0xec75('0x22')](respondWithResult(_0x4351ec,0xc9))[_0xec75('0x2b')](handleError(_0x4351ec,null));};exports[_0xec75('0x36')]=function(_0x2edfc8,_0xce46b){if(_0x2edfc8[_0xec75('0x60')]['id']){delete _0x2edfc8[_0xec75('0x60')]['id'];}return db[_0xec75('0x40')][_0xec75('0x59')]({'where':{'id':_0x2edfc8[_0xec75('0x56')]['id']},'include':[{'model':db[_0xec75('0x3e')],'as':_0xec75('0x57')}]})[_0xec75('0x22')](handleEntityNotFound(_0xce46b,null))['then'](saveUpdates(_0x2edfc8[_0xec75('0x60')],null))[_0xec75('0x22')](respondWithResult(_0xce46b,null))[_0xec75('0x2b')](handleError(_0xce46b,null));};exports[_0xec75('0x3a')]=function(_0x3891d4,_0x21378b){return db[_0xec75('0x40')][_0xec75('0x59')]({'where':{'id':_0x3891d4[_0xec75('0x56')]['id']}})[_0xec75('0x22')](handleEntityNotFound(_0x21378b,null))[_0xec75('0x22')](removeEntity(_0x21378b,null))[_0xec75('0x2b')](handleError(_0x21378b,null));};exports[_0xec75('0x61')]=function(_0x2bbcc4,_0x18b88c){return db[_0xec75('0x40')][_0xec75('0x61')]()[_0xec75('0x22')](respondWithResult(_0x18b88c,null))[_0xec75('0x2b')](handleError(_0x18b88c,null));};exports[_0xec75('0x62')]=function(_0x43d631,_0x104d36,_0x3fc3a3){if(_0x43d631[_0xec75('0x60')]['id']){delete _0x43d631[_0xec75('0x60')]['id'];}return db[_0xec75('0x40')][_0xec75('0x59')]({'where':{'id':_0x43d631[_0xec75('0x56')]['id']}})[_0xec75('0x22')](handleEntityNotFound(_0x104d36,null))[_0xec75('0x22')](function(_0x2411e0){if(_0x2411e0){_0x43d631[_0xec75('0x60')][_0xec75('0x63')]=_0x2411e0['id'];return db[_0xec75('0x64')]['create'](_0x43d631[_0xec75('0x60')]);}})[_0xec75('0x22')](respondWithResult(_0x104d36,null))['catch'](handleError(_0x104d36,null));};exports[_0xec75('0x65')]=function(_0x22ff5f,_0x20a964,_0x2f6fd7){var _0x10256c={'raw':![],'where':{}};var _0x499000={};var _0x37bbdb={'count':0x0,'rows':[]};return db[_0xec75('0x40')]['findOne']({'where':{'id':_0x22ff5f[_0xec75('0x56')]['id']}})[_0xec75('0x22')](handleEntityNotFound(_0x20a964,null))[_0xec75('0x22')](function(_0x487330){if(_0x487330){_0x499000[_0xec75('0x44')]=_['keys'](db[_0xec75('0x64')]['rawAttributes']);_0x499000[_0xec75('0x46')]=_['keys'](_0x22ff5f[_0xec75('0x46')]);_0x499000[_0xec75('0x48')]=_['intersection'](_0x499000[_0xec75('0x44')],_0x499000['query']);_0x10256c['attributes']=_[_0xec75('0x4a')](_0x499000[_0xec75('0x44')],qs[_0xec75('0x4b')](_0x22ff5f['query']['fields']));_0x10256c[_0xec75('0x49')]=_0x10256c['attributes'][_0xec75('0x4c')]?_0x10256c[_0xec75('0x49')]:_0x499000['model'];if(!_0x22ff5f[_0xec75('0x46')]['hasOwnProperty']('nolimit')){_0x10256c[_0xec75('0x31')]=qs[_0xec75('0x31')](_0x22ff5f[_0xec75('0x46')]['limit']);_0x10256c[_0xec75('0x30')]=qs['offset'](_0x22ff5f[_0xec75('0x46')][_0xec75('0x30')]);}_0x10256c[_0xec75('0x66')]=qs[_0xec75('0x4d')](_0x22ff5f[_0xec75('0x46')][_0xec75('0x4d')]);_0x10256c['where']=qs[_0xec75('0x48')](_[_0xec75('0x67')](_0x22ff5f[_0xec75('0x46')],_0x499000[_0xec75('0x48')]));_0x10256c[_0xec75('0x4e')][_0xec75('0x68')]=_0x487330['id'];if(_0x22ff5f[_0xec75('0x46')]['filter']){_0x10256c['where']=_[_0xec75('0x50')](_0x10256c[_0xec75('0x4e')],{'$or':_[_0xec75('0x3f')](_0x10256c[_0xec75('0x49')],function(_0x39ff35){var _0x84a50a={};_0x84a50a[_0x39ff35]={'$like':'%'+_0x22ff5f[_0xec75('0x46')][_0xec75('0x4f')]+'%'};return _0x84a50a;})});}_0x10256c=_[_0xec75('0x50')]({},_0x10256c,_0x22ff5f[_0xec75('0x52')]);return db[_0xec75('0x64')][_0xec75('0x2f')]({'where':_0x10256c['where']})[_0xec75('0x22')](function(_0x46d926){_0x37bbdb[_0xec75('0x2f')]=_0x46d926;if(_0x22ff5f[_0xec75('0x46')][_0xec75('0x53')]){_0x10256c[_0xec75('0x58')]=[{'all':!![]}];}return db[_0xec75('0x64')][_0xec75('0x54')](_0x10256c);})[_0xec75('0x22')](function(_0x1bc205){_0x37bbdb['rows']=_0x1bc205;return _0x37bbdb;});}})[_0xec75('0x22')](respondWithFilteredResult(_0x20a964,_0x10256c))[_0xec75('0x2b')](handleError(_0x20a964,null));};exports['removeDispositions']=function(_0x369483,_0x41dbb6,_0x58a1b5){return db[_0xec75('0x40')]['find']({'where':{'id':_0x369483['params']['id']}})[_0xec75('0x22')](handleEntityNotFound(_0x41dbb6,null))[_0xec75('0x22')](function(_0x21ca79){if(_0x21ca79){return _0x21ca79[_0xec75('0x69')](_0x369483[_0xec75('0x46')][_0xec75('0x6a')]);}})['then'](respondWithStatusCode(_0x41dbb6,null))[_0xec75('0x2b')](handleError(_0x41dbb6,null));};exports[_0xec75('0x6b')]=function(_0x228acd,_0x14c914,_0x433e12){if(_0x228acd[_0xec75('0x60')]['id']){delete _0x228acd[_0xec75('0x60')]['id'];}return db[_0xec75('0x40')]['find']({'where':{'id':_0x228acd[_0xec75('0x56')]['id']}})['then'](handleEntityNotFound(_0x14c914,null))[_0xec75('0x22')](function(_0x262070){if(_0x262070){_0x228acd['body'][_0xec75('0x68')]=_0x262070['id'];return db[_0xec75('0x6c')]['create'](_0x228acd[_0xec75('0x60')]);}})['then'](respondWithResult(_0x14c914,null))['catch'](handleError(_0x14c914,null));};exports[_0xec75('0x6d')]=function(_0x48e218,_0xfa6525,_0x158bb3){var _0x3a5163={'raw':![],'where':{}};var _0x26f8ca={};var _0x36e88a={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xec75('0x6e')]({'where':{'id':_0x48e218[_0xec75('0x56')]['id']}})[_0xec75('0x22')](handleEntityNotFound(_0xfa6525,null))[_0xec75('0x22')](function(_0x3aef4d){if(_0x3aef4d){_0x26f8ca[_0xec75('0x44')]=_[_0xec75('0x47')](db['CannedAnswer'][_0xec75('0x41')]);_0x26f8ca[_0xec75('0x46')]=_[_0xec75('0x47')](_0x48e218[_0xec75('0x46')]);_0x26f8ca[_0xec75('0x48')]=_[_0xec75('0x4a')](_0x26f8ca[_0xec75('0x44')],_0x26f8ca[_0xec75('0x46')]);_0x3a5163[_0xec75('0x49')]=_[_0xec75('0x4a')](_0x26f8ca['model'],qs[_0xec75('0x4b')](_0x48e218[_0xec75('0x46')][_0xec75('0x4b')]));_0x3a5163[_0xec75('0x49')]=_0x3a5163[_0xec75('0x49')][_0xec75('0x4c')]?_0x3a5163[_0xec75('0x49')]:_0x26f8ca[_0xec75('0x44')];if(!_0x48e218[_0xec75('0x46')][_0xec75('0x6f')](_0xec75('0x70'))){_0x3a5163[_0xec75('0x31')]=qs['limit'](_0x48e218[_0xec75('0x46')][_0xec75('0x31')]);_0x3a5163[_0xec75('0x30')]=qs['offset'](_0x48e218['query']['offset']);}_0x3a5163[_0xec75('0x66')]=qs[_0xec75('0x4d')](_0x48e218[_0xec75('0x46')][_0xec75('0x4d')]);_0x3a5163[_0xec75('0x4e')]=qs['filters'](_['pick'](_0x48e218[_0xec75('0x46')],_0x26f8ca[_0xec75('0x48')]));_0x3a5163['where'][_0xec75('0x68')]=_0x3aef4d['id'];if(_0x48e218[_0xec75('0x46')]['filter']){_0x3a5163[_0xec75('0x4e')]=_['merge'](_0x3a5163[_0xec75('0x4e')],{'$or':_['map'](_0x3a5163[_0xec75('0x49')],function(_0x534be4){var _0x4be6ff={};_0x4be6ff[_0x534be4]={'$like':'%'+_0x48e218['query']['filter']+'%'};return _0x4be6ff;})});}_0x3a5163=_['merge']({},_0x3a5163,_0x48e218[_0xec75('0x52')]);return db[_0xec75('0x6c')][_0xec75('0x2f')]({'where':_0x3a5163[_0xec75('0x4e')]})['then'](function(_0x3ccf51){_0x36e88a['count']=_0x3ccf51;if(_0x48e218[_0xec75('0x46')][_0xec75('0x53')]){_0x3a5163[_0xec75('0x58')]=[{'all':!![]}];}return db[_0xec75('0x6c')][_0xec75('0x54')](_0x3a5163);})[_0xec75('0x22')](function(_0x5bf00f){_0x36e88a[_0xec75('0x55')]=_0x5bf00f;return _0x36e88a;});}})[_0xec75('0x22')](respondWithFilteredResult(_0xfa6525,_0x3a5163))[_0xec75('0x2b')](handleError(_0xfa6525,null));};exports['removeAnswers']=function(_0x5bee7a,_0x20ccae,_0x4d4961){return db[_0xec75('0x40')][_0xec75('0x59')]({'where':{'id':_0x5bee7a[_0xec75('0x56')]['id']}})[_0xec75('0x22')](handleEntityNotFound(_0x20ccae,null))[_0xec75('0x22')](function(_0x5e6743){if(_0x5e6743){return _0x5e6743[_0xec75('0x71')](_0x5bee7a[_0xec75('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x20ccae,null))[_0xec75('0x2b')](handleError(_0x20ccae,null));};exports[_0xec75('0x72')]=function(_0x485ee8,_0x396d95,_0x55d216){var _0x7c8c41={'body':_0x485ee8['body'],'channel':_0xec75('0x73')};var _0x5d2d0a=[];var _0x2771ed=[];var _0x2dce6c={};var _0x22f512=![];return db[_0xec75('0x74')][_0xec75('0x61')]()[_0xec75('0x22')](function(_0x3c81df){if(!_0x3c81df){throw new db['Sequelize'][(_0xec75('0x75'))]('no\x20available\x20attributes');}_0x5d2d0a=_['difference'](_[_0xec75('0x47')](_0x3c81df),['createdAt',_0xec75('0x76')]);_0x2771ed=_[_0xec75('0x77')](_['keys'](_0x3c81df),[_0xec75('0x78'),_0xec75('0x76'),_0xec75('0x79'),_0xec75('0x7a')]);if(_0x485ee8[_0xec75('0x60')]['id']){delete _0x485ee8['body']['id'];}if(_[_0xec75('0x7b')](_0x485ee8[_0xec75('0x60')]['from'])){throw new db[(_0xec75('0x20'))][(_0xec75('0x75'))](_0xec75('0x7c'));}if(_[_0xec75('0x7b')](_0x485ee8['body'][_0xec75('0x60')])||_0x485ee8[_0xec75('0x60')]['body']===''){throw new db['Sequelize'][(_0xec75('0x75'))](_0xec75('0x7d'));}if(_[_0xec75('0x7b')](_0x485ee8['body'][_0xec75('0x7e')])){throw new db['Sequelize'][(_0xec75('0x75'))](_0xec75('0x7f')+_0x2771ed);}if(!_[_0xec75('0x80')](_0x2771ed,_0x485ee8[_0xec75('0x60')][_0xec75('0x7e')])){throw new db[(_0xec75('0x20'))]['ValidationError'](_0xec75('0x81')+_0x2771ed);}_0x2dce6c[_0x485ee8[_0xec75('0x60')][_0xec75('0x7e')]]=_0x485ee8[_0xec75('0x60')][_0xec75('0x82')];})[_0xec75('0x22')](function(){return db[_0xec75('0x40')]['find']({'where':{'id':_0x485ee8['params']['id']},'include':[{'model':db[_0xec75('0x83')],'as':'List','include':[{'model':db[_0xec75('0x74')],'as':'Contacts','where':_0x2dce6c,'limit':0x1,'order':[[_0xec75('0x76'),'DESC']]}]},{'model':db[_0xec75('0x84')],'as':'Applications'}]});})[_0xec75('0x22')](handleEntityNotFound(_0x396d95,null))[_0xec75('0x22')](function(_0x5bf0c9){if(_0x5bf0c9&&_0x5bf0c9[_0xec75('0x85')]){_0x7c8c41['account']=_0x5bf0c9;_0x7c8c41['applications']=_0x5bf0c9[_0xec75('0x86')];_0x7c8c41['list']=_0x5bf0c9[_0xec75('0x85')];_0x7c8c41[_0xec75('0x87')]=_[_0xec75('0x88')](_0x7c8c41[_0xec75('0x87')],[_0xec75('0x89')],[_0xec75('0x8a')]);if(_0x7c8c41['account'][_0xec75('0x86')]){delete _0x7c8c41['account'][_0xec75('0x86')];}if(_0x7c8c41[_0xec75('0x8b')][_0xec75('0x85')]&&_0x7c8c41[_0xec75('0x8b')][_0xec75('0x85')][_0xec75('0x8c')][_0xec75('0x4c')]){return _0x7c8c41[_0xec75('0x8b')][_0xec75('0x85')][_0xec75('0x8c')][0x0];}var _0x4243b6=_[_0xec75('0x18')](_0x485ee8['body'],{'firstName':_0x485ee8[_0xec75('0x60')][_0xec75('0x82')],'ListId':_0x5bf0c9[_0xec75('0x7a')]});_0x4243b6[_0x485ee8[_0xec75('0x60')][_0xec75('0x7e')]]=_0x485ee8['body'][_0xec75('0x82')];return db[_0xec75('0x74')][_0xec75('0x5a')](_0x4243b6,{'fields':_0x5d2d0a,'raw':!![]});}})[_0xec75('0x22')](handleEntityNotFound(_0x396d95,null))[_0xec75('0x22')](function(_0x3b693d){_0x7c8c41['contact']=_0x3b693d;if(_0x3b693d){var _0x2ca043={'ContactId':_0x3b693d['id'],'OpenchannelAccountId':_0x485ee8['params']['id'],'from':(_0x3b693d[_0xec75('0x8d')]||'')+'\x20'+(_0x3b693d[_0xec75('0x8e')]||'')};var _0x345506={'OpenchannelAccountId':_0x485ee8['params']['id'],'closed':![]};if(_0x485ee8[_0xec75('0x60')][_0xec75('0x8f')]){_0x345506[_0xec75('0x8f')]=_0x485ee8[_0xec75('0x60')]['threadId'];return db['OpenchannelInteraction'][_0xec75('0x59')]({'where':_0x345506})[_0xec75('0x22')](function(_0x51f119){if(_0x51f119){return[_0x51f119,![]];}_0x2ca043[_0xec75('0x8f')]=_0x485ee8[_0xec75('0x60')][_0xec75('0x8f')];_0x2ca043[_0xec75('0x90')]=_0x485ee8[_0xec75('0x60')][_0xec75('0x90')];return db[_0xec75('0x91')][_0xec75('0x5a')](_0x2ca043)[_0xec75('0x22')](function(_0x1fc793){return[_0x1fc793,!![]];});});}else{_0x345506[_0xec75('0x8f')]=null;}_0x345506['ContactId']=_0x3b693d['id'];return db['OpenchannelInteraction']['find']({'where':_0x345506})[_0xec75('0x22')](function(_0x272252){if(_0x272252){return[_0x272252,![]];}return db[_0xec75('0x91')][_0xec75('0x5a')](_0x2ca043)[_0xec75('0x22')](function(_0x3c97e6){return[_0x3c97e6,!![]];});});}})[_0xec75('0x92')](function(_0x2ca1c5,_0x485779){if(_0x2ca1c5){_0x22f512=_0x485779;if(!_0x485779){var _0xf79fc2={'from':(_0x7c8c41[_0xec75('0x93')][_0xec75('0x8d')]||'')+'\x20'+(_0x7c8c41[_0xec75('0x93')][_0xec75('0x8e')]||'')};if(_0x485ee8[_0xec75('0x60')][_0xec75('0x8f')]&&_0x485ee8[_0xec75('0x60')][_0xec75('0x94')]&&_0x485ee8[_0xec75('0x60')][_0xec75('0x8f')]!=_0x485ee8[_0xec75('0x60')][_0xec75('0x94')]){_0xf79fc2[_0xec75('0x8f')]=_0x485ee8[_0xec75('0x60')]['messageId'];}return _0x2ca1c5[_0xec75('0x36')](_0xf79fc2);}else{return _0x2ca1c5;}}})['then'](function(_0xf2f9e4){_0x7c8c41[_0xec75('0x95')]=_0xf2f9e4[_0xec75('0x37')]({'plain':!![]});_0x7c8c41[_0xec75('0x95')][_0xec75('0x96')]=_0x22f512;if(_0x7c8c41[_0xec75('0x95')][_0xec75('0x96')]){if(_0x7c8c41[_0xec75('0x8b')][_0xec75('0x97')]){_0x7c8c41[_0xec75('0x87')][_0xec75('0x98')]({'id':0x0,'priority':_0x7c8c41['applications']['length']+0x1,'app':'close','appdata':_0xec75('0x99'),'interval':_0xec75('0x9a')});}}return db[_0xec75('0x9b')][_0xec75('0x5a')]({'body':_0x485ee8[_0xec75('0x60')]['body'],'OpenchannelAccountId':_0x485ee8['params']['id'],'OpenchannelInteractionId':_0xf2f9e4['id'],'direction':'in','ContactId':_0x7c8c41[_0xec75('0x93')]['id'],'AttachmentId':_0x485ee8[_0xec75('0x60')][_0xec75('0x9c')]});})[_0xec75('0x22')](function(_0x59dc6f){_0x7c8c41[_0xec75('0x29')]=_0x59dc6f;if(_0x7c8c41[_0xec75('0x95')][_0xec75('0x9d')]){return db[_0xec75('0x9e')][_0xec75('0x59')]({'attributes':['id','name'],'where':{'id':_0x7c8c41['interaction'][_0xec75('0x9d')]}})[_0xec75('0x22')](function(_0x2d3fca){if(_0x2d3fca){_0x7c8c41['applications'][_0xec75('0x9f')]({'id':0x0,'priority':0x0,'app':_0xec75('0xa0'),'appdata':_0x2d3fca[_0xec75('0x45')]+','+(_0x7c8c41[_0xec75('0x8b')][_0xec75('0xa1')]||0xa),'interval':_0xec75('0x9a')});_0x7c8c41[_0xec75('0xa2')]=![];}return respondWithRpcPromise(_0xec75('0xa3'),_0xec75('0xa4'),_0x7c8c41);});}return respondWithRpcPromise(_0xec75('0xa3'),_0xec75('0xa4'),_0x7c8c41);})['then'](function(_0x19741c){respondWithRpcPromise(_0xec75('0xa5'),'EventManager',{'event':_0xec75('0x72'),'message':_0x19741c},client9002);return _0x19741c;})['then'](respondWithResult(_0x396d95,null))['catch'](handleError(_0x396d95,null));};exports[_0xec75('0xa6')]=function(_0x3d0b17,_0x52bbd8,_0x18583d){return db[_0xec75('0x40')][_0xec75('0x6e')]({'where':{'id':_0x3d0b17[_0xec75('0x56')]['id']}})[_0xec75('0x22')](handleEntityNotFound(_0x52bbd8,null))[_0xec75('0x22')](function(_0x232510){if(_0x232510){return db[_0xec75('0xa7')][_0xec75('0xa8')](function(_0x4dbd84){return db[_0xec75('0x84')][_0xec75('0x3a')]({'where':{'OpenchannelAccountId':_0x3d0b17['params']['id']},'transaction':_0x4dbd84})[_0xec75('0x22')](function(_0x456397){var _0x294f7c=_[_0xec75('0x3f')](_0x3d0b17['body'],function(_0x534e0e){_0x534e0e[_0xec75('0x68')]=_0x3d0b17[_0xec75('0x56')]['id'];return _0x534e0e;});return db[_0xec75('0x84')][_0xec75('0xa9')](_0x294f7c,{'transaction':_0x4dbd84});});})[_0xec75('0x22')](function(){return db[_0xec75('0x84')][_0xec75('0xaa')]({'where':{'OpenchannelAccountId':_0x3d0b17['params']['id']},'order':'priority'});});}})['then'](respondWithResult(_0x52bbd8,null))[_0xec75('0x2b')](handleError(_0x52bbd8,null));};exports['getApplications']=function(_0x34b2b5,_0x4554a5,_0x210379){var _0x1e3c10={};var _0x29a4de={};var _0x2fc099;var _0x12f6bf;return db[_0xec75('0x40')]['findOne']({'where':{'id':_0x34b2b5[_0xec75('0x56')]['id']}})[_0xec75('0x22')](handleEntityNotFound(_0x4554a5,null))[_0xec75('0x22')](function(_0x28eb3c){if(_0x28eb3c){_0x2fc099=_0x28eb3c;_0x29a4de[_0xec75('0x44')]=_['keys'](db[_0xec75('0x84')]['rawAttributes']);_0x29a4de[_0xec75('0x46')]=_[_0xec75('0x47')](_0x34b2b5[_0xec75('0x46')]);_0x29a4de['filters']=_['intersection'](_0x29a4de[_0xec75('0x44')],_0x29a4de['query']);_0x1e3c10[_0xec75('0x49')]=_[_0xec75('0x4a')](_0x29a4de[_0xec75('0x44')],qs[_0xec75('0x4b')](_0x34b2b5[_0xec75('0x46')]['fields']));_0x1e3c10[_0xec75('0x49')]=_0x1e3c10[_0xec75('0x49')][_0xec75('0x4c')]?_0x1e3c10[_0xec75('0x49')]:_0x29a4de[_0xec75('0x44')];_0x1e3c10[_0xec75('0x66')]=qs['sort'](_0x34b2b5[_0xec75('0x46')][_0xec75('0x4d')]);_0x1e3c10[_0xec75('0x4e')]=qs[_0xec75('0x48')](_[_0xec75('0x67')](_0x34b2b5['query'],_0x29a4de[_0xec75('0x48')]));if(_0x34b2b5['query']['filter']){_0x1e3c10[_0xec75('0x4e')]=_[_0xec75('0x50')](_0x1e3c10[_0xec75('0x4e')],{'$or':_['map'](_0x1e3c10['attributes'],function(_0x5961c1){var _0x3ac96a={};_0x3ac96a[_0x5961c1]={'$like':'%'+_0x34b2b5[_0xec75('0x46')][_0xec75('0x4f')]+'%'};return _0x3ac96a;})});}_0x1e3c10=_[_0xec75('0x50')]({},_0x1e3c10,_0x34b2b5[_0xec75('0x52')]);return _0x2fc099['getApplications'](_0x1e3c10);}})['then'](function(_0x214a30){if(_0x214a30){_0x12f6bf=_0x214a30['length'];if(!_0x34b2b5[_0xec75('0x46')][_0xec75('0x6f')](_0xec75('0x70'))){_0x1e3c10[_0xec75('0x31')]=qs['limit'](_0x34b2b5[_0xec75('0x46')][_0xec75('0x31')]);_0x1e3c10[_0xec75('0x30')]=qs[_0xec75('0x30')](_0x34b2b5[_0xec75('0x46')][_0xec75('0x30')]);}return _0x2fc099['getApplications'](_0x1e3c10);}})[_0xec75('0x22')](function(_0x3bd052){if(_0x3bd052){return _0x3bd052?{'count':_0x12f6bf,'rows':_0x3bd052}:null;}})[_0xec75('0x22')](respondWithResult(_0x4554a5,null))[_0xec75('0x2b')](handleError(_0x4554a5,null));};exports[_0xec75('0xab')]=function(_0x48af17,_0x58a356,_0x5f4cc3){var _0x402c8c={'raw':![],'where':{}};var _0x13fd16={};var _0x4046f7={'count':0x0,'rows':[]};return db[_0xec75('0x40')][_0xec75('0x6e')]({'where':{'id':_0x48af17[_0xec75('0x56')]['id']}})[_0xec75('0x22')](handleEntityNotFound(_0x58a356,null))['then'](function(_0x246297){if(_0x246297){_0x13fd16[_0xec75('0x44')]=_['keys'](db['OpenchannelInteraction'][_0xec75('0x41')]);_0x13fd16['query']=_[_0xec75('0x47')](_0x48af17[_0xec75('0x46')]);_0x13fd16[_0xec75('0x48')]=_['intersection'](_0x13fd16[_0xec75('0x44')],_0x13fd16[_0xec75('0x46')]);_0x402c8c[_0xec75('0x49')]=_['intersection'](_0x13fd16[_0xec75('0x44')],qs[_0xec75('0x4b')](_0x48af17[_0xec75('0x46')][_0xec75('0x4b')]));_0x402c8c[_0xec75('0x49')]=_0x402c8c[_0xec75('0x49')][_0xec75('0x4c')]?_0x402c8c[_0xec75('0x49')]:_0x13fd16[_0xec75('0x44')];if(!_0x48af17[_0xec75('0x46')][_0xec75('0x6f')](_0xec75('0x70'))){_0x402c8c[_0xec75('0x31')]=qs[_0xec75('0x31')](_0x48af17['query']['limit']);_0x402c8c[_0xec75('0x30')]=qs[_0xec75('0x30')](_0x48af17[_0xec75('0x46')]['offset']);}_0x402c8c[_0xec75('0x66')]=qs[_0xec75('0x4d')](_0x48af17[_0xec75('0x46')][_0xec75('0x4d')]);_0x402c8c[_0xec75('0x4e')]=qs['filters'](_[_0xec75('0x67')](_0x48af17[_0xec75('0x46')],_0x13fd16['filters']));_0x402c8c[_0xec75('0x4e')][_0xec75('0x68')]=_0x246297['id'];if(_0x48af17[_0xec75('0x46')][_0xec75('0x4f')]){_0x402c8c[_0xec75('0x4e')]=_[_0xec75('0x50')](_0x402c8c[_0xec75('0x4e')],{'$or':_[_0xec75('0x3f')](_0x402c8c[_0xec75('0x49')],function(_0x17182e){var _0x2e75cd={};_0x2e75cd[_0x17182e]={'$like':'%'+_0x48af17[_0xec75('0x46')][_0xec75('0x4f')]+'%'};return _0x2e75cd;})});}_0x402c8c=_[_0xec75('0x50')]({},_0x402c8c,_0x48af17[_0xec75('0x52')]);return db['OpenchannelInteraction']['count']({'where':_0x402c8c[_0xec75('0x4e')]})['then'](function(_0x2c8d1c){_0x4046f7[_0xec75('0x2f')]=_0x2c8d1c;if(_0x48af17[_0xec75('0x46')][_0xec75('0x53')]){_0x402c8c['include']=[{'model':db['CmContact'],'as':_0xec75('0xac'),'required':![]},{'model':db[_0xec75('0x9e')],'as':_0xec75('0xad'),'attributes':['name',_0xec75('0xae'),_0xec75('0xaf')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xec75('0x45'),_0xec75('0xb0')],'where':_0x48af17['query'][_0xec75('0xb1')]?{'id':_0x48af17[_0xec75('0x46')][_0xec75('0xb1')]}:undefined,'required':_0x48af17[_0xec75('0x46')][_0xec75('0xb1')]?!![]:![]}];}return db[_0xec75('0x91')][_0xec75('0x54')](_0x402c8c);})[_0xec75('0x22')](function(_0x5462b8){_0x4046f7['rows']=_0x5462b8;return _0x4046f7;});}})[_0xec75('0x22')](respondWithFilteredResult(_0x58a356,_0x402c8c))[_0xec75('0x2b')](handleError(_0x58a356,null));};exports['addAgents']=function(_0x2a29a5,_0x336ed7,_0xa5d28d){return db[_0xec75('0x40')][_0xec75('0x59')]({'where':{'id':_0x2a29a5[_0xec75('0x56')]['id']}})['then'](handleEntityNotFound(_0x336ed7,null))[_0xec75('0x22')](function(_0x56f647){if(_0x56f647){return _0x56f647[_0xec75('0xb2')](_0x2a29a5['body']['ids'],_[_0xec75('0xb3')](_0x2a29a5[_0xec75('0x60')],[_0xec75('0x6a'),'id'])||{})[_0xec75('0x92')](function(_0x4de56f){for(var _0x575d22=0x0;_0x575d22<_0x2a29a5[_0xec75('0x60')]['ids'][_0xec75('0x4c')];_0x575d22+=0x1){socket[_0xec75('0xb4')]('userOpenchannelAccount:save',{'UserId':_0x2a29a5[_0xec75('0x60')][_0xec75('0x6a')][_0x575d22],'OpenchannelAccountId':_0x2a29a5[_0xec75('0x56')]['id']});}return _0x4de56f;});}})[_0xec75('0x22')](respondWithResult(_0x336ed7,null))['catch'](handleError(_0x336ed7,null));};exports[_0xec75('0xb5')]=function(_0x4fddd2,_0x4e5d36,_0x42caef){return db[_0xec75('0x40')][_0xec75('0x59')]({'where':{'id':_0x4fddd2[_0xec75('0x56')]['id']}})[_0xec75('0x22')](handleEntityNotFound(_0x4e5d36,null))[_0xec75('0x22')](function(_0x287f44){if(_0x287f44){return _0x287f44['removeAgents'](_0x4fddd2[_0xec75('0x46')][_0xec75('0x6a')])['then'](function(){if(_['isArray'](_0x4fddd2['query'][_0xec75('0x6a')])){for(var _0x22e5ed=0x0;_0x22e5ed<_0x4fddd2['query']['ids']['length'];_0x22e5ed+=0x1){socket['emit'](_0xec75('0xb6'),{'UserId':Number(_0x4fddd2[_0xec75('0x46')][_0xec75('0x6a')][_0x22e5ed]),'OpenchannelAccountId':Number(_0x4fddd2[_0xec75('0x56')]['id'])});}}else{socket[_0xec75('0xb4')](_0xec75('0xb6'),{'UserId':Number(_0x4fddd2['query'][_0xec75('0x6a')]),'OpenchannelAccountId':Number(_0x4fddd2['params']['id'])});}});}})[_0xec75('0x22')](respondWithStatusCode(_0x4e5d36,null))[_0xec75('0x2b')](handleError(_0x4e5d36,null));};exports['getAgents']=function(_0x504025,_0x3831c3,_0x3ba589){var _0x1e370e={};var _0x3663dd={};var _0x4b5cee;var _0x2eff9c;return db[_0xec75('0x40')][_0xec75('0x6e')]({'where':{'id':_0x504025[_0xec75('0x56')]['id']}})[_0xec75('0x22')](handleEntityNotFound(_0x3831c3,null))[_0xec75('0x22')](function(_0x581cf6){if(_0x581cf6){_0x4b5cee=_0x581cf6;_0x3663dd[_0xec75('0x44')]=_['keys'](db[_0xec75('0x9e')][_0xec75('0x41')]);_0x3663dd[_0xec75('0x46')]=_[_0xec75('0x47')](_0x504025[_0xec75('0x46')]);_0x3663dd['filters']=_[_0xec75('0x4a')](_0x3663dd[_0xec75('0x44')],_0x3663dd[_0xec75('0x46')]);_0x1e370e[_0xec75('0x49')]=_[_0xec75('0x4a')](_0x3663dd['model'],qs['fields'](_0x504025['query'][_0xec75('0x4b')]));_0x1e370e[_0xec75('0x49')]=_0x1e370e[_0xec75('0x49')][_0xec75('0x4c')]?_0x1e370e[_0xec75('0x49')]:_0x3663dd[_0xec75('0x44')];_0x1e370e[_0xec75('0x66')]=qs[_0xec75('0x4d')](_0x504025[_0xec75('0x46')][_0xec75('0x4d')]);_0x1e370e[_0xec75('0x4e')]=qs['filters'](_[_0xec75('0x67')](_0x504025[_0xec75('0x46')],_0x3663dd[_0xec75('0x48')]));if(_0x504025[_0xec75('0x46')]['filter']){_0x1e370e[_0xec75('0x4e')]=_['merge'](_0x1e370e[_0xec75('0x4e')],{'$or':_[_0xec75('0x3f')](_0x1e370e[_0xec75('0x49')],function(_0x1c85ee){var _0x28d65b={};_0x28d65b[_0x1c85ee]={'$like':'%'+_0x504025[_0xec75('0x46')][_0xec75('0x4f')]+'%'};return _0x28d65b;})});}_0x1e370e=_[_0xec75('0x50')]({},_0x1e370e,_0x504025['options']);return _0x4b5cee[_0xec75('0xb7')](_0x1e370e);}})[_0xec75('0x22')](function(_0x20719e){if(_0x20719e){_0x2eff9c=_0x20719e[_0xec75('0x4c')];if(!_0x504025[_0xec75('0x46')][_0xec75('0x6f')](_0xec75('0x70'))){_0x1e370e['limit']=qs[_0xec75('0x31')](_0x504025[_0xec75('0x46')]['limit']);_0x1e370e[_0xec75('0x30')]=qs['offset'](_0x504025[_0xec75('0x46')][_0xec75('0x30')]);}return _0x4b5cee[_0xec75('0xb7')](_0x1e370e);}})[_0xec75('0x22')](function(_0x123192){if(_0x123192){return _0x123192?{'count':_0x2eff9c,'rows':_0x123192}:null;}})['then'](respondWithResult(_0x3831c3,null))[_0xec75('0x2b')](handleError(_0x3831c3,null));};exports[_0xec75('0x3c')]=function(_0x3b80ea,_0x27b289,_0x50562f){var _0x259e83,_0x1da4af,_0x95eca2;if(_[_0xec75('0x7b')](_0x3b80ea[_0xec75('0x60')]['body'])||_0x3b80ea['body'][_0xec75('0x60')]===''){throw new db[(_0xec75('0x20'))][(_0xec75('0x75'))](_0xec75('0x7d'));}if(_['isNil'](_0x3b80ea['body']['to'])){}_0x259e83=_0x3b80ea[_0xec75('0x60')]['to'];return db[_0xec75('0x40')][_0xec75('0x6e')]({'where':{'id':_0x3b80ea[_0xec75('0x56')]['id']}})[_0xec75('0x22')](handleEntityNotFound(_0x27b289,null))[_0xec75('0x22')](function(_0xbdaadb){if(_0xbdaadb){return db[_0xec75('0x40')][_0xec75('0x59')]({'where':{'id':_0xbdaadb['id']},'include':[{'model':db[_0xec75('0x83')],'as':_0xec75('0x85'),'include':[{'model':db[_0xec75('0x74')],'as':_0xec75('0x8c'),'where':{[_0xbdaadb[_0xec75('0x7e')]]:_0x259e83},'limit':0x1,'order':[['updatedAt',_0xec75('0xb8')]]}]}]})[_0xec75('0x22')](handleEntityNotFound(_0x27b289,null))['then'](function(_0x24126d){if(_0x24126d&&_0x24126d[_0xec75('0x85')]){_0x1da4af=_0x24126d[_0xec75('0x37')]({'plain':!![]});if(_0x1da4af[_0xec75('0x85')]&&_0x1da4af[_0xec75('0x85')][_0xec75('0x8c')][_0xec75('0x4c')]){return _0x1da4af['List'][_0xec75('0x8c')][0x0];}return db[_0xec75('0x74')][_0xec75('0x5a')](_[_0xec75('0x18')](_0x3b80ea['body'],{'firstName':_0x259e83,[_0x24126d[_0xec75('0x7e')]]:_0x259e83,'phone':_0x259e83,'ListId':_0x1da4af['ListId']}));}})[_0xec75('0x22')](handleEntityNotFound(_0x27b289,null))['then'](function(_0xf4ac90){if(_0xf4ac90){_0x95eca2=_0xf4ac90;return db[_0xec75('0x91')]['find']({'where':{'ContactId':_0x95eca2['id'],'closed':![],'OpenchannelAccountId':_0x1da4af['id']}})['then'](function(_0x4dab26){if(_0x4dab26){return[_0x4dab26,![]];}return db[_0xec75('0x91')][_0xec75('0x5a')]({'UserId':_0x3b80ea[_0xec75('0x5b')]['id'],'ContactId':_0x95eca2['id'],'OpenchannelAccountId':_0x1da4af['id'],'lastMsgDirection':_0xec75('0xb9'),'Messages':[_['merge'](_0x3b80ea[_0xec75('0x60')],{'read':![],'body':_0x3b80ea['body']['body'],'OpenchannelAccountId':_0x1da4af['id'],'UserId':_0x3b80ea['user']['id'],'ContactId':_0x95eca2['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xec75('0xba')}]})[_0xec75('0x22')](function(_0x39d703){return[_0x39d703,!![]];});});}})[_0xec75('0x92')](function(_0x2346ce,_0x2ef53e){if(_0x2ef53e){return _0x2346ce;}return db['OpenchannelMessage'][_0xec75('0x5a')](_['merge'](_0x3b80ea['body'],{'read':![],'body':_0x3b80ea[_0xec75('0x60')]['body'],'OpenchannelAccountId':_0x1da4af['id'],'OpenchannelInteractionId':_0x2346ce['id'],'UserId':_0x3b80ea[_0xec75('0x5b')]['id'],'ContactId':_0x95eca2['id']}))['then'](function(_0x24a7bd){_0x2346ce[_0xec75('0xbb')]['Messages']=[];_0x2346ce[_0xec75('0xbb')][_0xec75('0xba')][_0xec75('0x98')](_0x24a7bd['dataValues']);return _0x2346ce;});});}})[_0xec75('0x22')](respondWithResult(_0x27b289,null))[_0xec75('0x2b')](handleError(_0x27b289,null));}; \ No newline at end of file +var _0x36dc=['limit','set','Content-Range','apply','reject','save','destroy','get','OpenchannelAccounts','UserProfileResource','end','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','show','params','keys','length','find','create','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','findOne','options','findAll','removeDispositions','ids','OpenchannelAccountId','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','difference','updatedAt','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','Applications','List','applications','priority','asc','account','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','dataValues','Messages','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','client','http','Sequelize','ValidationError','request','then','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','json','count','offset'];(function(_0x50dadb,_0x116142){var _0x3838ee=function(_0x595aaf){while(--_0x595aaf){_0x50dadb['push'](_0x50dadb['shift']());}};_0x3838ee(++_0x116142);}(_0x36dc,0x87));var _0xc36d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x36dc[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xc36d('0x0'));var emlformat=require(_0xc36d('0x1'));var rimraf=require(_0xc36d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc36d('0x3'));var rp=require(_0xc36d('0x4'));var moment=require(_0xc36d('0x5'));var BPromise=require(_0xc36d('0x6'));var Mustache=require(_0xc36d('0x7'));var util=require(_0xc36d('0x8'));var path=require(_0xc36d('0x9'));var sox=require('sox');var csv=require(_0xc36d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc36d('0xb'));var squel=require(_0xc36d('0xc'));var crypto=require(_0xc36d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc36d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc36d('0xf'));var Papa=require(_0xc36d('0x10'));var Redis=require(_0xc36d('0x11'));var authService=require(_0xc36d('0x12'));var qs=require(_0xc36d('0x13'));var as=require(_0xc36d('0x14'));var hardwareService=require(_0xc36d('0x15'));var logger=require(_0xc36d('0x16'))(_0xc36d('0x17'));var utils=require(_0xc36d('0x18'));var config=require(_0xc36d('0x19'));var db=require(_0xc36d('0x1a'))['db'];config[_0xc36d('0x1b')]=_[_0xc36d('0x1c')](config[_0xc36d('0x1b')],{'host':_0xc36d('0x1d'),'port':0x18eb});var socket=require(_0xc36d('0x1e'))(new Redis(config[_0xc36d('0x1b')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xc36d('0x1f')][_0xc36d('0x20')]({'port':0x232c});var client9002=jayson[_0xc36d('0x1f')][_0xc36d('0x20')]({'port':0x232a});function checkPasswordPattern(_0x5200b4,_0x21c545,_0x31f58b){if(_0x31f58b){var _0x47ffda=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x47ffda['test'](_0x21c545)){return _0x5200b4;}else{throw new db[(_0xc36d('0x21'))][(_0xc36d('0x22'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x5200b4;}}function respondWithRpcPromise(_0x1b62d7,_0x186655,_0x5856de,_0x2b1afe){return new BPromise(function(_0x55536d,_0x32703d){var _0xac58bc=_0x2b1afe||client;return _0xac58bc[_0xc36d('0x23')](_0x1b62d7,_0x5856de)[_0xc36d('0x24')](function(_0x48eab5){logger[_0xc36d('0x25')](_0xc36d('0x26'),_0x186655,'request\x20sent');logger['debug'](_0xc36d('0x27'),_0x186655,_0xc36d('0x28'),JSON[_0xc36d('0x29')](_0x48eab5));if(_0x48eab5[_0xc36d('0x2a')]){if(_0x48eab5[_0xc36d('0x2a')]['code']===0x1f4){logger[_0xc36d('0x2a')](_0xc36d('0x26'),_0x186655,_0x48eab5[_0xc36d('0x2a')][_0xc36d('0x2b')]);return _0x32703d(_0x48eab5[_0xc36d('0x2a')][_0xc36d('0x2b')]);}logger[_0xc36d('0x2a')]('OpenchannelAccount,\x20%s,\x20%s',_0x186655,_0x48eab5[_0xc36d('0x2a')][_0xc36d('0x2b')]);return _0x55536d(_0x48eab5[_0xc36d('0x2a')]['message']);}else{logger['info'](_0xc36d('0x26'),_0x186655,_0xc36d('0x28'));_0x55536d(_0x48eab5['result'][_0xc36d('0x2b')]);}})[_0xc36d('0x2c')](function(_0x26379f){logger[_0xc36d('0x2a')](_0xc36d('0x26'),_0x186655,_0x26379f);_0x32703d(_0x26379f);});});}function respondWithStatusCode(_0x2b7178,_0x4a6263){_0x4a6263=_0x4a6263||0xcc;return function(_0x528fcd){if(_0x528fcd){return _0x2b7178[_0xc36d('0x2d')](_0x4a6263);}return _0x2b7178['status'](_0x4a6263)['end']();};}function respondWithResult(_0x293181,_0x49ec5b){_0x49ec5b=_0x49ec5b||0xc8;return function(_0x1ac7ee){if(_0x1ac7ee){return _0x293181['status'](_0x49ec5b)[_0xc36d('0x2e')](_0x1ac7ee);}};}function respondWithFilteredResult(_0x33b82e,_0x18371e){return function(_0xd6e57d){if(_0xd6e57d){var _0x563731=_0xd6e57d[_0xc36d('0x2f')],_0x5bcb6e=_0x18371e[_0xc36d('0x30')],_0x1ac392=_0x18371e['offset']+_0x18371e[_0xc36d('0x31')],_0x17e706;if(_0x1ac392>=_0x563731){_0x1ac392=_0x563731;_0x17e706=0xc8;}else{_0x17e706=0xce;}_0x33b82e['status'](_0x17e706);return _0x33b82e[_0xc36d('0x32')](_0xc36d('0x33'),_0x5bcb6e+'-'+_0x1ac392+'/'+_0x563731)[_0xc36d('0x2e')](_0xd6e57d);}return null;};}function patchUpdates(_0x3bd7be){return function(_0x44fc7e){try{jsonpatch[_0xc36d('0x34')](_0x44fc7e,_0x3bd7be,!![]);}catch(_0xa659ee){return BPromise[_0xc36d('0x35')](_0xa659ee);}return _0x44fc7e[_0xc36d('0x36')]();};}function saveUpdates(_0x1f6c23,_0x32fb41){return function(_0x1885b3){if(_0x1885b3){return _0x1885b3['update'](_0x1f6c23)[_0xc36d('0x24')](function(_0x30731e){return _0x30731e;});}return null;};}function removeEntity(_0x34a5e1,_0x4cdb41){return function(_0x51817d){if(_0x51817d){return _0x51817d[_0xc36d('0x37')]()['then'](function(){var _0x1ef98b=_0x51817d[_0xc36d('0x38')]({'plain':!![]});var _0x314662=_0xc36d('0x39');return db[_0xc36d('0x3a')][_0xc36d('0x37')]({'where':{'type':_0x314662,'resourceId':_0x1ef98b['id']}})[_0xc36d('0x24')](function(){return _0x51817d;});})[_0xc36d('0x24')](function(){_0x34a5e1['status'](0xcc)[_0xc36d('0x3b')]();});}};}function handleEntityNotFound(_0x1eb5d6,_0x22f177){return function(_0x4448d6){if(!_0x4448d6){_0x1eb5d6[_0xc36d('0x2d')](0x194);}return _0x4448d6;};}function handleError(_0x5719c3,_0xf75d3f){_0xf75d3f=_0xf75d3f||0x1f4;return function(_0x16b5df){logger[_0xc36d('0x2a')](_0x16b5df['stack']);if(_0x16b5df[_0xc36d('0x3c')]){delete _0x16b5df['name'];}_0x5719c3['status'](_0xf75d3f)[_0xc36d('0x3d')](_0x16b5df);};}exports[_0xc36d('0x3e')]=function(_0x5a290c,_0xb8a5b){var _0x2990cb={'include':[{'model':db[_0xc36d('0x3f')],'as':_0xc36d('0x40')}]},_0xabc857={},_0x7dc2b0={'count':0x0,'rows':[]};var _0x186c6b=_['map'](db[_0xc36d('0x41')][_0xc36d('0x42')],function(_0xb2ab2b){return{'name':_0xb2ab2b['fieldName'],'type':_0xb2ab2b['type'][_0xc36d('0x43')]};});_0xabc857[_0xc36d('0x44')]=_[_0xc36d('0x45')](_0x186c6b,'name');_0xabc857[_0xc36d('0x46')]=_['keys'](_0x5a290c[_0xc36d('0x46')]);_0xabc857[_0xc36d('0x47')]=_[_0xc36d('0x48')](_0xabc857[_0xc36d('0x44')],_0xabc857[_0xc36d('0x46')]);_0x2990cb['attributes']=_['intersection'](_0xabc857['model'],qs[_0xc36d('0x49')](_0x5a290c[_0xc36d('0x46')][_0xc36d('0x49')]));_0x2990cb[_0xc36d('0x4a')]=_0x2990cb[_0xc36d('0x4a')]['length']?_0x2990cb['attributes']:_0xabc857[_0xc36d('0x44')];if(!_0x5a290c[_0xc36d('0x46')][_0xc36d('0x4b')](_0xc36d('0x4c'))){_0x2990cb[_0xc36d('0x31')]=qs[_0xc36d('0x31')](_0x5a290c[_0xc36d('0x46')][_0xc36d('0x31')]);_0x2990cb[_0xc36d('0x30')]=qs['offset'](_0x5a290c['query']['offset']);}_0x2990cb[_0xc36d('0x4d')]=qs[_0xc36d('0x4e')](_0x5a290c[_0xc36d('0x46')][_0xc36d('0x4e')]);_0x2990cb[_0xc36d('0x4f')]=qs[_0xc36d('0x47')](_[_0xc36d('0x50')](_0x5a290c[_0xc36d('0x46')],_0xabc857['filters']),_0x186c6b);if(_0x5a290c['query'][_0xc36d('0x51')]){_0x2990cb['where']=_[_0xc36d('0x52')](_0x2990cb[_0xc36d('0x4f')],{'$or':_['map'](_0x186c6b,function(_0x220869){if(_0x220869[_0xc36d('0x53')]!==_0xc36d('0x54')){var _0x160ecb={};_0x160ecb[_0x220869['name']]={'$like':'%'+_0x5a290c[_0xc36d('0x46')][_0xc36d('0x51')]+'%'};return _0x160ecb;}})});}_0x2990cb=_[_0xc36d('0x52')]({},_0x2990cb,_0x5a290c['options']);var _0x257100={'where':_0x2990cb[_0xc36d('0x4f')]};return db[_0xc36d('0x41')][_0xc36d('0x2f')](_0x257100)[_0xc36d('0x24')](function(_0x569532){_0x7dc2b0['count']=_0x569532;if(_0x5a290c[_0xc36d('0x46')][_0xc36d('0x55')]){_0x2990cb[_0xc36d('0x56')]=[{'all':!![]}];}return db[_0xc36d('0x41')]['findAll'](_0x2990cb);})['then'](function(_0x1e46d7){_0x7dc2b0[_0xc36d('0x57')]=_0x1e46d7;return _0x7dc2b0;})[_0xc36d('0x24')](respondWithFilteredResult(_0xb8a5b,_0x2990cb))[_0xc36d('0x2c')](handleError(_0xb8a5b,null));};exports[_0xc36d('0x58')]=function(_0x14a7ba,_0x45bb4f){var _0x22f1e7={'raw':![],'where':{'id':_0x14a7ba[_0xc36d('0x59')]['id']},'include':[{'model':db[_0xc36d('0x3f')],'as':'mandatoryDispositionPause'}]},_0x5f0bba={};_0x5f0bba[_0xc36d('0x44')]=_[_0xc36d('0x5a')](db[_0xc36d('0x41')][_0xc36d('0x42')]);_0x5f0bba[_0xc36d('0x46')]=_[_0xc36d('0x5a')](_0x14a7ba['query']);_0x5f0bba['filters']=_[_0xc36d('0x48')](_0x5f0bba[_0xc36d('0x44')],_0x5f0bba['query']);_0x22f1e7['attributes']=_[_0xc36d('0x48')](_0x5f0bba['model'],qs['fields'](_0x14a7ba[_0xc36d('0x46')][_0xc36d('0x49')]));_0x22f1e7[_0xc36d('0x4a')]=_0x22f1e7['attributes'][_0xc36d('0x5b')]?_0x22f1e7[_0xc36d('0x4a')]:_0x5f0bba['model'];if(_0x14a7ba[_0xc36d('0x46')]['includeAll']){_0x22f1e7[_0xc36d('0x56')]=[{'all':!![]}];}_0x22f1e7=_[_0xc36d('0x52')]({},_0x22f1e7,_0x14a7ba['options']);return db[_0xc36d('0x41')][_0xc36d('0x5c')](_0x22f1e7)[_0xc36d('0x24')](handleEntityNotFound(_0x45bb4f,null))[_0xc36d('0x24')](respondWithResult(_0x45bb4f,null))[_0xc36d('0x2c')](handleError(_0x45bb4f,null));};exports[_0xc36d('0x5d')]=function(_0x14510d,_0x54ae23){return db[_0xc36d('0x41')][_0xc36d('0x5d')](_0x14510d['body'],{})[_0xc36d('0x24')](function(_0x49fdb6){var _0x223e03=_0x14510d[_0xc36d('0x5e')][_0xc36d('0x38')]({'plain':!![]});if(!_0x223e03)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x223e03['role']==='user'){var _0x446d3d=_0x49fdb6['get']({'plain':!![]});var _0x240b2a=_0xc36d('0x39');return db[_0xc36d('0x5f')]['find']({'where':{'name':_0x240b2a,'userProfileId':_0x223e03[_0xc36d('0x60')]},'raw':!![]})[_0xc36d('0x24')](function(_0x1715cc){if(_0x1715cc&&_0x1715cc['autoAssociation']===0x0){return db[_0xc36d('0x3a')][_0xc36d('0x5d')]({'name':_0x446d3d[_0xc36d('0x3c')],'resourceId':_0x446d3d['id'],'type':_0x1715cc['name'],'sectionId':_0x1715cc['id']},{})[_0xc36d('0x24')](function(){return _0x49fdb6;});}else{return _0x49fdb6;}})[_0xc36d('0x2c')](function(_0xd1c705){logger[_0xc36d('0x2a')](_0xc36d('0x61'),_0xd1c705);throw _0xd1c705;});}return _0x49fdb6;})[_0xc36d('0x24')](respondWithResult(_0x54ae23,0xc9))[_0xc36d('0x2c')](handleError(_0x54ae23,null));};exports[_0xc36d('0x62')]=function(_0x546ab5,_0x1f9d59){if(_0x546ab5[_0xc36d('0x63')]['id']){delete _0x546ab5['body']['id'];}return db[_0xc36d('0x41')][_0xc36d('0x5c')]({'where':{'id':_0x546ab5['params']['id']},'include':[{'model':db[_0xc36d('0x3f')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x1f9d59,null))[_0xc36d('0x24')](saveUpdates(_0x546ab5[_0xc36d('0x63')],null))['then'](respondWithResult(_0x1f9d59,null))[_0xc36d('0x2c')](handleError(_0x1f9d59,null));};exports[_0xc36d('0x37')]=function(_0x3f2fc8,_0x24aca0){return db[_0xc36d('0x41')][_0xc36d('0x5c')]({'where':{'id':_0x3f2fc8['params']['id']}})[_0xc36d('0x24')](handleEntityNotFound(_0x24aca0,null))[_0xc36d('0x24')](removeEntity(_0x24aca0,null))[_0xc36d('0x2c')](handleError(_0x24aca0,null));};exports[_0xc36d('0x64')]=function(_0x1476af,_0x44ff64){return db['OpenchannelAccount']['describe']()[_0xc36d('0x24')](respondWithResult(_0x44ff64,null))[_0xc36d('0x2c')](handleError(_0x44ff64,null));};exports[_0xc36d('0x65')]=function(_0x56b8e3,_0x199ae4,_0x438959){if(_0x56b8e3[_0xc36d('0x63')]['id']){delete _0x56b8e3[_0xc36d('0x63')]['id'];}return db['OpenchannelAccount'][_0xc36d('0x5c')]({'where':{'id':_0x56b8e3[_0xc36d('0x59')]['id']}})[_0xc36d('0x24')](handleEntityNotFound(_0x199ae4,null))['then'](function(_0x49b05d){if(_0x49b05d){_0x56b8e3[_0xc36d('0x63')][_0xc36d('0x66')]=_0x49b05d['id'];return db[_0xc36d('0x67')]['create'](_0x56b8e3[_0xc36d('0x63')]);}})[_0xc36d('0x24')](respondWithResult(_0x199ae4,null))['catch'](handleError(_0x199ae4,null));};exports[_0xc36d('0x68')]=function(_0x3ee9fe,_0x5d706f,_0x4d4e68){var _0x49da1f={'raw':![],'where':{}};var _0x42d11f={};var _0x43bc85={'count':0x0,'rows':[]};return db[_0xc36d('0x41')][_0xc36d('0x69')]({'where':{'id':_0x3ee9fe[_0xc36d('0x59')]['id']}})[_0xc36d('0x24')](handleEntityNotFound(_0x5d706f,null))['then'](function(_0x12b55e){if(_0x12b55e){_0x42d11f[_0xc36d('0x44')]=_[_0xc36d('0x5a')](db['Disposition'][_0xc36d('0x42')]);_0x42d11f[_0xc36d('0x46')]=_[_0xc36d('0x5a')](_0x3ee9fe[_0xc36d('0x46')]);_0x42d11f['filters']=_[_0xc36d('0x48')](_0x42d11f[_0xc36d('0x44')],_0x42d11f[_0xc36d('0x46')]);_0x49da1f[_0xc36d('0x4a')]=_[_0xc36d('0x48')](_0x42d11f[_0xc36d('0x44')],qs[_0xc36d('0x49')](_0x3ee9fe[_0xc36d('0x46')][_0xc36d('0x49')]));_0x49da1f[_0xc36d('0x4a')]=_0x49da1f[_0xc36d('0x4a')][_0xc36d('0x5b')]?_0x49da1f[_0xc36d('0x4a')]:_0x42d11f[_0xc36d('0x44')];if(!_0x3ee9fe[_0xc36d('0x46')][_0xc36d('0x4b')](_0xc36d('0x4c'))){_0x49da1f[_0xc36d('0x31')]=qs[_0xc36d('0x31')](_0x3ee9fe[_0xc36d('0x46')][_0xc36d('0x31')]);_0x49da1f[_0xc36d('0x30')]=qs[_0xc36d('0x30')](_0x3ee9fe[_0xc36d('0x46')][_0xc36d('0x30')]);}_0x49da1f[_0xc36d('0x4d')]=qs[_0xc36d('0x4e')](_0x3ee9fe['query'][_0xc36d('0x4e')]);_0x49da1f[_0xc36d('0x4f')]=qs[_0xc36d('0x47')](_['pick'](_0x3ee9fe[_0xc36d('0x46')],_0x42d11f['filters']));_0x49da1f['where']['OpenchannelAccountId']=_0x12b55e['id'];if(_0x3ee9fe[_0xc36d('0x46')][_0xc36d('0x51')]){_0x49da1f[_0xc36d('0x4f')]=_['merge'](_0x49da1f[_0xc36d('0x4f')],{'$or':_['map'](_0x49da1f[_0xc36d('0x4a')],function(_0x482148){var _0x17ff05={};_0x17ff05[_0x482148]={'$like':'%'+_0x3ee9fe[_0xc36d('0x46')]['filter']+'%'};return _0x17ff05;})});}_0x49da1f=_[_0xc36d('0x52')]({},_0x49da1f,_0x3ee9fe[_0xc36d('0x6a')]);return db[_0xc36d('0x67')][_0xc36d('0x2f')]({'where':_0x49da1f[_0xc36d('0x4f')]})[_0xc36d('0x24')](function(_0x202ecc){_0x43bc85['count']=_0x202ecc;if(_0x3ee9fe[_0xc36d('0x46')]['includeAll']){_0x49da1f['include']=[{'all':!![]}];}return db[_0xc36d('0x67')][_0xc36d('0x6b')](_0x49da1f);})[_0xc36d('0x24')](function(_0x4e3631){_0x43bc85[_0xc36d('0x57')]=_0x4e3631;return _0x43bc85;});}})['then'](respondWithFilteredResult(_0x5d706f,_0x49da1f))[_0xc36d('0x2c')](handleError(_0x5d706f,null));};exports[_0xc36d('0x6c')]=function(_0x23402e,_0x479ef7,_0x3e22e2){return db[_0xc36d('0x41')][_0xc36d('0x5c')]({'where':{'id':_0x23402e[_0xc36d('0x59')]['id']}})[_0xc36d('0x24')](handleEntityNotFound(_0x479ef7,null))[_0xc36d('0x24')](function(_0x583ab1){if(_0x583ab1){return _0x583ab1[_0xc36d('0x6c')](_0x23402e[_0xc36d('0x46')][_0xc36d('0x6d')]);}})['then'](respondWithStatusCode(_0x479ef7,null))[_0xc36d('0x2c')](handleError(_0x479ef7,null));};exports['addAnswer']=function(_0xf3a17b,_0x4bb597,_0x4e523a){if(_0xf3a17b[_0xc36d('0x63')]['id']){delete _0xf3a17b['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0xf3a17b[_0xc36d('0x59')]['id']}})[_0xc36d('0x24')](handleEntityNotFound(_0x4bb597,null))[_0xc36d('0x24')](function(_0xc9463f){if(_0xc9463f){_0xf3a17b[_0xc36d('0x63')][_0xc36d('0x6e')]=_0xc9463f['id'];return db[_0xc36d('0x6f')][_0xc36d('0x5d')](_0xf3a17b[_0xc36d('0x63')]);}})[_0xc36d('0x24')](respondWithResult(_0x4bb597,null))[_0xc36d('0x2c')](handleError(_0x4bb597,null));};exports[_0xc36d('0x70')]=function(_0xd78d99,_0x2a9d21,_0xe72cc8){var _0x5c10bf={'raw':![],'where':{}};var _0x398d8d={};var _0x78fe53={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xc36d('0x69')]({'where':{'id':_0xd78d99[_0xc36d('0x59')]['id']}})[_0xc36d('0x24')](handleEntityNotFound(_0x2a9d21,null))[_0xc36d('0x24')](function(_0x2f2ffb){if(_0x2f2ffb){_0x398d8d[_0xc36d('0x44')]=_[_0xc36d('0x5a')](db[_0xc36d('0x6f')][_0xc36d('0x42')]);_0x398d8d[_0xc36d('0x46')]=_['keys'](_0xd78d99[_0xc36d('0x46')]);_0x398d8d['filters']=_[_0xc36d('0x48')](_0x398d8d[_0xc36d('0x44')],_0x398d8d['query']);_0x5c10bf['attributes']=_['intersection'](_0x398d8d[_0xc36d('0x44')],qs[_0xc36d('0x49')](_0xd78d99[_0xc36d('0x46')][_0xc36d('0x49')]));_0x5c10bf[_0xc36d('0x4a')]=_0x5c10bf[_0xc36d('0x4a')][_0xc36d('0x5b')]?_0x5c10bf['attributes']:_0x398d8d[_0xc36d('0x44')];if(!_0xd78d99['query']['hasOwnProperty'](_0xc36d('0x4c'))){_0x5c10bf['limit']=qs[_0xc36d('0x31')](_0xd78d99['query'][_0xc36d('0x31')]);_0x5c10bf[_0xc36d('0x30')]=qs[_0xc36d('0x30')](_0xd78d99[_0xc36d('0x46')][_0xc36d('0x30')]);}_0x5c10bf['order']=qs[_0xc36d('0x4e')](_0xd78d99[_0xc36d('0x46')][_0xc36d('0x4e')]);_0x5c10bf[_0xc36d('0x4f')]=qs['filters'](_[_0xc36d('0x50')](_0xd78d99[_0xc36d('0x46')],_0x398d8d[_0xc36d('0x47')]));_0x5c10bf[_0xc36d('0x4f')][_0xc36d('0x6e')]=_0x2f2ffb['id'];if(_0xd78d99['query'][_0xc36d('0x51')]){_0x5c10bf['where']=_['merge'](_0x5c10bf['where'],{'$or':_[_0xc36d('0x45')](_0x5c10bf[_0xc36d('0x4a')],function(_0x225fd6){var _0x2b5b52={};_0x2b5b52[_0x225fd6]={'$like':'%'+_0xd78d99['query']['filter']+'%'};return _0x2b5b52;})});}_0x5c10bf=_[_0xc36d('0x52')]({},_0x5c10bf,_0xd78d99[_0xc36d('0x6a')]);return db['CannedAnswer'][_0xc36d('0x2f')]({'where':_0x5c10bf['where']})['then'](function(_0x101ac3){_0x78fe53[_0xc36d('0x2f')]=_0x101ac3;if(_0xd78d99[_0xc36d('0x46')][_0xc36d('0x55')]){_0x5c10bf[_0xc36d('0x56')]=[{'all':!![]}];}return db[_0xc36d('0x6f')]['findAll'](_0x5c10bf);})['then'](function(_0x418226){_0x78fe53['rows']=_0x418226;return _0x78fe53;});}})[_0xc36d('0x24')](respondWithFilteredResult(_0x2a9d21,_0x5c10bf))[_0xc36d('0x2c')](handleError(_0x2a9d21,null));};exports['removeAnswers']=function(_0x2eadf0,_0x46f973,_0x1edffe){return db[_0xc36d('0x41')][_0xc36d('0x5c')]({'where':{'id':_0x2eadf0['params']['id']}})['then'](handleEntityNotFound(_0x46f973,null))[_0xc36d('0x24')](function(_0x20ef2c){if(_0x20ef2c){return _0x20ef2c[_0xc36d('0x71')](_0x2eadf0[_0xc36d('0x46')]['ids']);}})['then'](respondWithStatusCode(_0x46f973,null))[_0xc36d('0x2c')](handleError(_0x46f973,null));};exports[_0xc36d('0x72')]=function(_0x216741,_0x2ffb0d,_0x5554df){var _0x10bfd2={'body':_0x216741[_0xc36d('0x63')],'channel':_0xc36d('0x73')};var _0x4efc92=[];var _0x465308=[];var _0x1a40b8={};var _0x26ce84=![];return db[_0xc36d('0x74')][_0xc36d('0x64')]()[_0xc36d('0x24')](function(_0x152375){if(!_0x152375){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x4efc92=_['difference'](_[_0xc36d('0x5a')](_0x152375),['createdAt','updatedAt']);_0x465308=_[_0xc36d('0x75')](_[_0xc36d('0x5a')](_0x152375),['createdAt',_0xc36d('0x76'),'CompanyId',_0xc36d('0x77')]);if(_0x216741[_0xc36d('0x63')]['id']){delete _0x216741['body']['id'];}if(_[_0xc36d('0x78')](_0x216741['body'][_0xc36d('0x79')])){throw new db['Sequelize'][(_0xc36d('0x22'))]('from\x20is\x20mandatory');}if(_[_0xc36d('0x78')](_0x216741[_0xc36d('0x63')][_0xc36d('0x63')])||_0x216741[_0xc36d('0x63')]['body']===''){throw new db[(_0xc36d('0x21'))][(_0xc36d('0x22'))](_0xc36d('0x7a'));}if(_[_0xc36d('0x78')](_0x216741[_0xc36d('0x63')][_0xc36d('0x7b')])){throw new db[(_0xc36d('0x21'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x465308);}if(!_[_0xc36d('0x7c')](_0x465308,_0x216741[_0xc36d('0x63')]['mapKey'])){throw new db[(_0xc36d('0x21'))]['ValidationError'](_0xc36d('0x7d')+_0x465308);}_0x1a40b8[_0x216741['body']['mapKey']]=_0x216741[_0xc36d('0x63')][_0xc36d('0x79')];})[_0xc36d('0x24')](function(){return db[_0xc36d('0x41')][_0xc36d('0x5c')]({'where':{'id':_0x216741[_0xc36d('0x59')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0xc36d('0x7e'),'where':_0x1a40b8,'limit':0x1,'order':[['updatedAt',_0xc36d('0x7f')]]}]},{'model':db['OpenchannelApplication'],'as':_0xc36d('0x80')}]});})[_0xc36d('0x24')](handleEntityNotFound(_0x2ffb0d,null))[_0xc36d('0x24')](function(_0x2595ce){if(_0x2595ce&&_0x2595ce[_0xc36d('0x81')]){_0x10bfd2['account']=_0x2595ce;_0x10bfd2[_0xc36d('0x82')]=_0x2595ce['Applications'];_0x10bfd2['list']=_0x2595ce['List'];_0x10bfd2[_0xc36d('0x82')]=_['orderBy'](_0x10bfd2[_0xc36d('0x82')],[_0xc36d('0x83')],[_0xc36d('0x84')]);if(_0x10bfd2[_0xc36d('0x85')][_0xc36d('0x80')]){delete _0x10bfd2[_0xc36d('0x85')][_0xc36d('0x80')];}if(_0x10bfd2[_0xc36d('0x85')]['List']&&_0x10bfd2[_0xc36d('0x85')]['List'][_0xc36d('0x7e')][_0xc36d('0x5b')]){return _0x10bfd2['account'][_0xc36d('0x81')][_0xc36d('0x7e')][0x0];}var _0x51ec4a=_[_0xc36d('0x1c')](_0x216741[_0xc36d('0x63')],{'firstName':_0x216741[_0xc36d('0x63')][_0xc36d('0x79')],'ListId':_0x2595ce[_0xc36d('0x77')]});_0x51ec4a[_0x216741[_0xc36d('0x63')][_0xc36d('0x7b')]]=_0x216741[_0xc36d('0x63')][_0xc36d('0x79')];return db[_0xc36d('0x74')][_0xc36d('0x5d')](_0x51ec4a,{'fields':_0x4efc92,'raw':!![]});}})[_0xc36d('0x24')](handleEntityNotFound(_0x2ffb0d,null))[_0xc36d('0x24')](function(_0x36352e){_0x10bfd2[_0xc36d('0x86')]=_0x36352e;if(_0x36352e){var _0x2493e1={'ContactId':_0x36352e['id'],'OpenchannelAccountId':_0x216741[_0xc36d('0x59')]['id'],'from':(_0x36352e[_0xc36d('0x87')]||'')+'\x20'+(_0x36352e[_0xc36d('0x88')]||'')};var _0x56dad2={'OpenchannelAccountId':_0x216741[_0xc36d('0x59')]['id'],'closed':![]};if(_0x216741[_0xc36d('0x63')][_0xc36d('0x89')]){_0x56dad2[_0xc36d('0x89')]=_0x216741[_0xc36d('0x63')]['threadId'];return db[_0xc36d('0x8a')]['find']({'where':_0x56dad2})[_0xc36d('0x24')](function(_0x1aef95){if(_0x1aef95){return[_0x1aef95,![]];}_0x2493e1[_0xc36d('0x89')]=_0x216741[_0xc36d('0x63')][_0xc36d('0x89')];_0x2493e1[_0xc36d('0x8b')]=_0x216741[_0xc36d('0x63')][_0xc36d('0x8b')];return db[_0xc36d('0x8a')][_0xc36d('0x5d')](_0x2493e1)[_0xc36d('0x24')](function(_0x586c01){return[_0x586c01,!![]];});});}else{_0x56dad2[_0xc36d('0x89')]=null;}_0x56dad2[_0xc36d('0x8c')]=_0x36352e['id'];return db[_0xc36d('0x8a')][_0xc36d('0x5c')]({'where':_0x56dad2})['then'](function(_0x5bbbf4){if(_0x5bbbf4){return[_0x5bbbf4,![]];}return db[_0xc36d('0x8a')]['create'](_0x2493e1)[_0xc36d('0x24')](function(_0x3cd70d){return[_0x3cd70d,!![]];});});}})[_0xc36d('0x8d')](function(_0x205d88,_0x485ce6){if(_0x205d88){_0x26ce84=_0x485ce6;if(!_0x485ce6){var _0x25d26b={'from':(_0x10bfd2[_0xc36d('0x86')]['firstName']||'')+'\x20'+(_0x10bfd2[_0xc36d('0x86')]['lastName']||'')};if(_0x216741[_0xc36d('0x63')][_0xc36d('0x89')]&&_0x216741[_0xc36d('0x63')][_0xc36d('0x8e')]&&_0x216741['body']['threadId']!=_0x216741['body']['messageId']){_0x25d26b[_0xc36d('0x89')]=_0x216741['body']['messageId'];}return _0x205d88[_0xc36d('0x62')](_0x25d26b);}else{return _0x205d88;}}})[_0xc36d('0x24')](function(_0xec4627){_0x10bfd2[_0xc36d('0x8f')]=_0xec4627[_0xc36d('0x38')]({'plain':!![]});_0x10bfd2[_0xc36d('0x8f')][_0xc36d('0x90')]=_0x26ce84;if(_0x10bfd2[_0xc36d('0x8f')][_0xc36d('0x90')]){if(_0x10bfd2[_0xc36d('0x85')][_0xc36d('0x91')]){_0x10bfd2[_0xc36d('0x82')][_0xc36d('0x92')]({'id':0x0,'priority':_0x10bfd2['applications'][_0xc36d('0x5b')]+0x1,'app':_0xc36d('0x93'),'appdata':_0xc36d('0x94'),'interval':_0xc36d('0x95')});}}return db[_0xc36d('0x96')][_0xc36d('0x5d')]({'body':_0x216741['body'][_0xc36d('0x63')],'OpenchannelAccountId':_0x216741[_0xc36d('0x59')]['id'],'OpenchannelInteractionId':_0xec4627['id'],'direction':'in','ContactId':_0x10bfd2[_0xc36d('0x86')]['id'],'AttachmentId':_0x216741[_0xc36d('0x63')][_0xc36d('0x97')]});})[_0xc36d('0x24')](function(_0x375ee9){_0x10bfd2[_0xc36d('0x2b')]=_0x375ee9;if(_0x10bfd2[_0xc36d('0x8f')][_0xc36d('0x98')]){return db[_0xc36d('0x99')][_0xc36d('0x5c')]({'attributes':['id',_0xc36d('0x3c')],'where':{'id':_0x10bfd2[_0xc36d('0x8f')][_0xc36d('0x98')]}})['then'](function(_0x1e1b42){if(_0x1e1b42){_0x10bfd2['applications'][_0xc36d('0x9a')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1e1b42[_0xc36d('0x3c')]+','+(_0x10bfd2['account'][_0xc36d('0x9b')]||0xa),'interval':_0xc36d('0x95')});_0x10bfd2[_0xc36d('0x9c')]=![];}return respondWithRpcPromise(_0xc36d('0x9d'),_0xc36d('0x9e'),_0x10bfd2);});}return respondWithRpcPromise(_0xc36d('0x9d'),_0xc36d('0x9e'),_0x10bfd2);})['then'](function(_0x316798){respondWithRpcPromise('EventManager',_0xc36d('0x9f'),{'event':_0xc36d('0x72'),'message':_0x316798},client9002);return _0x316798;})[_0xc36d('0x24')](respondWithResult(_0x2ffb0d,null))[_0xc36d('0x2c')](handleError(_0x2ffb0d,null));};exports[_0xc36d('0xa0')]=function(_0x564ab5,_0x3bfcc4,_0x2ef658){return db[_0xc36d('0x41')][_0xc36d('0x69')]({'where':{'id':_0x564ab5['params']['id']}})[_0xc36d('0x24')](handleEntityNotFound(_0x3bfcc4,null))[_0xc36d('0x24')](function(_0x3f845a){if(_0x3f845a){return db['sequelize'][_0xc36d('0xa1')](function(_0x3a208c){return db[_0xc36d('0xa2')]['destroy']({'where':{'OpenchannelAccountId':_0x564ab5['params']['id']},'transaction':_0x3a208c})[_0xc36d('0x24')](function(_0x52cb44){var _0x5afa5b=_[_0xc36d('0x45')](_0x564ab5[_0xc36d('0x63')],function(_0x46a350){_0x46a350[_0xc36d('0x6e')]=_0x564ab5[_0xc36d('0x59')]['id'];return _0x46a350;});return db['OpenchannelApplication'][_0xc36d('0xa3')](_0x5afa5b,{'transaction':_0x3a208c});});})['then'](function(){return db['OpenchannelApplication'][_0xc36d('0xa4')]({'where':{'OpenchannelAccountId':_0x564ab5['params']['id']},'order':_0xc36d('0x83')});});}})[_0xc36d('0x24')](respondWithResult(_0x3bfcc4,null))[_0xc36d('0x2c')](handleError(_0x3bfcc4,null));};exports[_0xc36d('0xa5')]=function(_0xcc764d,_0x2ea654,_0x1e2a67){var _0x588aa4={};var _0x11d566={};var _0x4ee76c;var _0x59fa1a;return db[_0xc36d('0x41')][_0xc36d('0x69')]({'where':{'id':_0xcc764d[_0xc36d('0x59')]['id']}})[_0xc36d('0x24')](handleEntityNotFound(_0x2ea654,null))[_0xc36d('0x24')](function(_0x214b70){if(_0x214b70){_0x4ee76c=_0x214b70;_0x11d566[_0xc36d('0x44')]=_[_0xc36d('0x5a')](db['OpenchannelApplication'][_0xc36d('0x42')]);_0x11d566[_0xc36d('0x46')]=_[_0xc36d('0x5a')](_0xcc764d[_0xc36d('0x46')]);_0x11d566['filters']=_[_0xc36d('0x48')](_0x11d566[_0xc36d('0x44')],_0x11d566['query']);_0x588aa4[_0xc36d('0x4a')]=_[_0xc36d('0x48')](_0x11d566[_0xc36d('0x44')],qs[_0xc36d('0x49')](_0xcc764d[_0xc36d('0x46')][_0xc36d('0x49')]));_0x588aa4['attributes']=_0x588aa4[_0xc36d('0x4a')][_0xc36d('0x5b')]?_0x588aa4[_0xc36d('0x4a')]:_0x11d566[_0xc36d('0x44')];_0x588aa4[_0xc36d('0x4d')]=qs[_0xc36d('0x4e')](_0xcc764d[_0xc36d('0x46')][_0xc36d('0x4e')]);_0x588aa4[_0xc36d('0x4f')]=qs[_0xc36d('0x47')](_[_0xc36d('0x50')](_0xcc764d[_0xc36d('0x46')],_0x11d566[_0xc36d('0x47')]));if(_0xcc764d['query'][_0xc36d('0x51')]){_0x588aa4[_0xc36d('0x4f')]=_[_0xc36d('0x52')](_0x588aa4[_0xc36d('0x4f')],{'$or':_['map'](_0x588aa4[_0xc36d('0x4a')],function(_0x4209fc){var _0x21213c={};_0x21213c[_0x4209fc]={'$like':'%'+_0xcc764d[_0xc36d('0x46')][_0xc36d('0x51')]+'%'};return _0x21213c;})});}_0x588aa4=_['merge']({},_0x588aa4,_0xcc764d['options']);return _0x4ee76c[_0xc36d('0xa5')](_0x588aa4);}})['then'](function(_0x4f3001){if(_0x4f3001){_0x59fa1a=_0x4f3001['length'];if(!_0xcc764d[_0xc36d('0x46')][_0xc36d('0x4b')](_0xc36d('0x4c'))){_0x588aa4[_0xc36d('0x31')]=qs[_0xc36d('0x31')](_0xcc764d[_0xc36d('0x46')][_0xc36d('0x31')]);_0x588aa4['offset']=qs[_0xc36d('0x30')](_0xcc764d[_0xc36d('0x46')]['offset']);}return _0x4ee76c[_0xc36d('0xa5')](_0x588aa4);}})[_0xc36d('0x24')](function(_0x31af37){if(_0x31af37){return _0x31af37?{'count':_0x59fa1a,'rows':_0x31af37}:null;}})[_0xc36d('0x24')](respondWithResult(_0x2ea654,null))[_0xc36d('0x2c')](handleError(_0x2ea654,null));};exports[_0xc36d('0xa6')]=function(_0x5ab0bc,_0x2276d8,_0x596f14){var _0x24ea3a={'raw':![],'where':{}};var _0x5b252d={};var _0x4339fa={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x5ab0bc['params']['id']}})['then'](handleEntityNotFound(_0x2276d8,null))[_0xc36d('0x24')](function(_0x2d046e){if(_0x2d046e){_0x5b252d[_0xc36d('0x44')]=_[_0xc36d('0x5a')](db[_0xc36d('0x8a')][_0xc36d('0x42')]);_0x5b252d[_0xc36d('0x46')]=_[_0xc36d('0x5a')](_0x5ab0bc[_0xc36d('0x46')]);_0x5b252d['filters']=_[_0xc36d('0x48')](_0x5b252d[_0xc36d('0x44')],_0x5b252d[_0xc36d('0x46')]);_0x24ea3a[_0xc36d('0x4a')]=_[_0xc36d('0x48')](_0x5b252d[_0xc36d('0x44')],qs[_0xc36d('0x49')](_0x5ab0bc['query'][_0xc36d('0x49')]));_0x24ea3a[_0xc36d('0x4a')]=_0x24ea3a[_0xc36d('0x4a')][_0xc36d('0x5b')]?_0x24ea3a['attributes']:_0x5b252d['model'];if(!_0x5ab0bc[_0xc36d('0x46')][_0xc36d('0x4b')](_0xc36d('0x4c'))){_0x24ea3a[_0xc36d('0x31')]=qs[_0xc36d('0x31')](_0x5ab0bc[_0xc36d('0x46')][_0xc36d('0x31')]);_0x24ea3a['offset']=qs[_0xc36d('0x30')](_0x5ab0bc[_0xc36d('0x46')][_0xc36d('0x30')]);}_0x24ea3a['order']=qs[_0xc36d('0x4e')](_0x5ab0bc[_0xc36d('0x46')][_0xc36d('0x4e')]);_0x24ea3a[_0xc36d('0x4f')]=qs[_0xc36d('0x47')](_[_0xc36d('0x50')](_0x5ab0bc['query'],_0x5b252d['filters']));_0x24ea3a[_0xc36d('0x4f')][_0xc36d('0x6e')]=_0x2d046e['id'];if(_0x5ab0bc[_0xc36d('0x46')][_0xc36d('0x51')]){_0x24ea3a[_0xc36d('0x4f')]=_['merge'](_0x24ea3a[_0xc36d('0x4f')],{'$or':_[_0xc36d('0x45')](_0x24ea3a['attributes'],function(_0x9a2e85){var _0x21795f={};_0x21795f[_0x9a2e85]={'$like':'%'+_0x5ab0bc[_0xc36d('0x46')]['filter']+'%'};return _0x21795f;})});}_0x24ea3a=_['merge']({},_0x24ea3a,_0x5ab0bc[_0xc36d('0x6a')]);return db['OpenchannelInteraction']['count']({'where':_0x24ea3a['where']})['then'](function(_0xd92463){_0x4339fa[_0xc36d('0x2f')]=_0xd92463;if(_0x5ab0bc[_0xc36d('0x46')]['includeAll']){_0x24ea3a[_0xc36d('0x56')]=[{'model':db[_0xc36d('0x74')],'as':_0xc36d('0xa7'),'required':![]},{'model':db[_0xc36d('0x99')],'as':_0xc36d('0xa8'),'attributes':['name','fullname',_0xc36d('0xa9')],'required':![]},{'model':db[_0xc36d('0xaa')],'as':_0xc36d('0xab'),'attributes':['id','name',_0xc36d('0xac')],'where':_0x5ab0bc[_0xc36d('0x46')][_0xc36d('0xad')]?{'id':_0x5ab0bc[_0xc36d('0x46')][_0xc36d('0xad')]}:undefined,'required':_0x5ab0bc[_0xc36d('0x46')][_0xc36d('0xad')]?!![]:![]}];}return db[_0xc36d('0x8a')][_0xc36d('0x6b')](_0x24ea3a);})[_0xc36d('0x24')](function(_0x1e9c4c){_0x4339fa['rows']=_0x1e9c4c;return _0x4339fa;});}})['then'](respondWithFilteredResult(_0x2276d8,_0x24ea3a))['catch'](handleError(_0x2276d8,null));};exports['addAgents']=function(_0x25511f,_0xf604a1,_0x1c5c0c){return db['OpenchannelAccount']['find']({'where':{'id':_0x25511f[_0xc36d('0x59')]['id']}})['then'](handleEntityNotFound(_0xf604a1,null))[_0xc36d('0x24')](function(_0xaa40b){if(_0xaa40b){return _0xaa40b[_0xc36d('0xae')](_0x25511f[_0xc36d('0x63')][_0xc36d('0x6d')],_['omit'](_0x25511f[_0xc36d('0x63')],[_0xc36d('0x6d'),'id'])||{})['spread'](function(_0x38a659){for(var _0x2daebb=0x0;_0x2daebb<_0x25511f['body'][_0xc36d('0x6d')]['length'];_0x2daebb+=0x1){socket[_0xc36d('0xaf')](_0xc36d('0xb0'),{'UserId':_0x25511f[_0xc36d('0x63')][_0xc36d('0x6d')][_0x2daebb],'OpenchannelAccountId':_0x25511f['params']['id']});}return _0x38a659;});}})['then'](respondWithResult(_0xf604a1,null))[_0xc36d('0x2c')](handleError(_0xf604a1,null));};exports['removeAgents']=function(_0x373f3f,_0x39d4f1,_0x41b4d9){return db[_0xc36d('0x41')][_0xc36d('0x5c')]({'where':{'id':_0x373f3f['params']['id']}})['then'](handleEntityNotFound(_0x39d4f1,null))[_0xc36d('0x24')](function(_0x3f07df){if(_0x3f07df){return _0x3f07df[_0xc36d('0xb1')](_0x373f3f[_0xc36d('0x46')][_0xc36d('0x6d')])[_0xc36d('0x24')](function(){if(_[_0xc36d('0xb2')](_0x373f3f[_0xc36d('0x46')]['ids'])){for(var _0xb22c9b=0x0;_0xb22c9b<_0x373f3f[_0xc36d('0x46')][_0xc36d('0x6d')][_0xc36d('0x5b')];_0xb22c9b+=0x1){socket['emit'](_0xc36d('0xb3'),{'UserId':Number(_0x373f3f[_0xc36d('0x46')][_0xc36d('0x6d')][_0xb22c9b]),'OpenchannelAccountId':Number(_0x373f3f[_0xc36d('0x59')]['id'])});}}else{socket[_0xc36d('0xaf')]('userOpenchannelAccount:remove',{'UserId':Number(_0x373f3f[_0xc36d('0x46')][_0xc36d('0x6d')]),'OpenchannelAccountId':Number(_0x373f3f[_0xc36d('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x39d4f1,null))[_0xc36d('0x2c')](handleError(_0x39d4f1,null));};exports[_0xc36d('0xb4')]=function(_0x357f4c,_0x22394c,_0x5b96f6){var _0x5b20ca={};var _0x40ccd9={};var _0x30716c;var _0x8c2571;return db[_0xc36d('0x41')][_0xc36d('0x69')]({'where':{'id':_0x357f4c[_0xc36d('0x59')]['id']}})[_0xc36d('0x24')](handleEntityNotFound(_0x22394c,null))[_0xc36d('0x24')](function(_0x39726e){if(_0x39726e){_0x30716c=_0x39726e;_0x40ccd9[_0xc36d('0x44')]=_[_0xc36d('0x5a')](db['User'][_0xc36d('0x42')]);_0x40ccd9[_0xc36d('0x46')]=_['keys'](_0x357f4c[_0xc36d('0x46')]);_0x40ccd9['filters']=_[_0xc36d('0x48')](_0x40ccd9['model'],_0x40ccd9['query']);_0x5b20ca[_0xc36d('0x4a')]=_['intersection'](_0x40ccd9[_0xc36d('0x44')],qs['fields'](_0x357f4c[_0xc36d('0x46')][_0xc36d('0x49')]));_0x5b20ca[_0xc36d('0x4a')]=_0x5b20ca[_0xc36d('0x4a')]['length']?_0x5b20ca[_0xc36d('0x4a')]:_0x40ccd9[_0xc36d('0x44')];_0x5b20ca[_0xc36d('0x4d')]=qs['sort'](_0x357f4c[_0xc36d('0x46')][_0xc36d('0x4e')]);_0x5b20ca['where']=qs[_0xc36d('0x47')](_['pick'](_0x357f4c[_0xc36d('0x46')],_0x40ccd9[_0xc36d('0x47')]));if(_0x357f4c['query']['filter']){_0x5b20ca[_0xc36d('0x4f')]=_[_0xc36d('0x52')](_0x5b20ca['where'],{'$or':_[_0xc36d('0x45')](_0x5b20ca[_0xc36d('0x4a')],function(_0x34fd0b){var _0x2e9bc0={};_0x2e9bc0[_0x34fd0b]={'$like':'%'+_0x357f4c[_0xc36d('0x46')][_0xc36d('0x51')]+'%'};return _0x2e9bc0;})});}_0x5b20ca=_[_0xc36d('0x52')]({},_0x5b20ca,_0x357f4c[_0xc36d('0x6a')]);return _0x30716c[_0xc36d('0xb4')](_0x5b20ca);}})['then'](function(_0x10ba8c){if(_0x10ba8c){_0x8c2571=_0x10ba8c[_0xc36d('0x5b')];if(!_0x357f4c[_0xc36d('0x46')][_0xc36d('0x4b')](_0xc36d('0x4c'))){_0x5b20ca[_0xc36d('0x31')]=qs[_0xc36d('0x31')](_0x357f4c['query']['limit']);_0x5b20ca[_0xc36d('0x30')]=qs[_0xc36d('0x30')](_0x357f4c['query'][_0xc36d('0x30')]);}return _0x30716c[_0xc36d('0xb4')](_0x5b20ca);}})[_0xc36d('0x24')](function(_0x325e86){if(_0x325e86){return _0x325e86?{'count':_0x8c2571,'rows':_0x325e86}:null;}})[_0xc36d('0x24')](respondWithResult(_0x22394c,null))[_0xc36d('0x2c')](handleError(_0x22394c,null));};exports[_0xc36d('0x3d')]=function(_0x3f012e,_0x34e458,_0x268db7){var _0x43cac5,_0x99dd06,_0xaf656c;if(_['isNil'](_0x3f012e['body']['body'])||_0x3f012e[_0xc36d('0x63')][_0xc36d('0x63')]===''){throw new db['Sequelize'][(_0xc36d('0x22'))](_0xc36d('0x7a'));}if(_[_0xc36d('0x78')](_0x3f012e[_0xc36d('0x63')]['to'])){}_0x43cac5=_0x3f012e[_0xc36d('0x63')]['to'];return db[_0xc36d('0x41')]['findOne']({'where':{'id':_0x3f012e[_0xc36d('0x59')]['id']}})[_0xc36d('0x24')](handleEntityNotFound(_0x34e458,null))[_0xc36d('0x24')](function(_0x36c288){if(_0x36c288){return db[_0xc36d('0x41')][_0xc36d('0x5c')]({'where':{'id':_0x36c288['id']},'include':[{'model':db[_0xc36d('0xb5')],'as':_0xc36d('0x81'),'include':[{'model':db[_0xc36d('0x74')],'as':_0xc36d('0x7e'),'where':{[_0x36c288[_0xc36d('0x7b')]]:_0x43cac5},'limit':0x1,'order':[[_0xc36d('0x76'),_0xc36d('0x7f')]]}]}]})[_0xc36d('0x24')](handleEntityNotFound(_0x34e458,null))[_0xc36d('0x24')](function(_0x231cd3){if(_0x231cd3&&_0x231cd3[_0xc36d('0x81')]){_0x99dd06=_0x231cd3['get']({'plain':!![]});if(_0x99dd06['List']&&_0x99dd06['List'][_0xc36d('0x7e')][_0xc36d('0x5b')]){return _0x99dd06[_0xc36d('0x81')][_0xc36d('0x7e')][0x0];}return db[_0xc36d('0x74')][_0xc36d('0x5d')](_[_0xc36d('0x1c')](_0x3f012e[_0xc36d('0x63')],{'firstName':_0x43cac5,[_0x231cd3['mapKey']]:_0x43cac5,'phone':_0x43cac5,'ListId':_0x99dd06[_0xc36d('0x77')]}));}})['then'](handleEntityNotFound(_0x34e458,null))[_0xc36d('0x24')](function(_0x4068e3){if(_0x4068e3){_0xaf656c=_0x4068e3;return db[_0xc36d('0x8a')][_0xc36d('0x5c')]({'where':{'ContactId':_0xaf656c['id'],'closed':![],'OpenchannelAccountId':_0x99dd06['id']}})['then'](function(_0x46b13a){if(_0x46b13a){return[_0x46b13a,![]];}return db[_0xc36d('0x8a')]['create']({'UserId':_0x3f012e[_0xc36d('0x5e')]['id'],'ContactId':_0xaf656c['id'],'OpenchannelAccountId':_0x99dd06['id'],'lastMsgDirection':'out','Messages':[_[_0xc36d('0x52')](_0x3f012e['body'],{'read':![],'body':_0x3f012e[_0xc36d('0x63')][_0xc36d('0x63')],'OpenchannelAccountId':_0x99dd06['id'],'UserId':_0x3f012e[_0xc36d('0x5e')]['id'],'ContactId':_0xaf656c['id']})]},{'include':[{'model':db[_0xc36d('0x96')],'as':'Messages'}]})['then'](function(_0x20606c){return[_0x20606c,!![]];});});}})['spread'](function(_0x2ac64b,_0x3f35bd){if(_0x3f35bd){return _0x2ac64b;}return db['OpenchannelMessage'][_0xc36d('0x5d')](_[_0xc36d('0x52')](_0x3f012e[_0xc36d('0x63')],{'read':![],'body':_0x3f012e[_0xc36d('0x63')][_0xc36d('0x63')],'OpenchannelAccountId':_0x99dd06['id'],'OpenchannelInteractionId':_0x2ac64b['id'],'UserId':_0x3f012e[_0xc36d('0x5e')]['id'],'ContactId':_0xaf656c['id']}))[_0xc36d('0x24')](function(_0x2c5d38){_0x2ac64b[_0xc36d('0xb6')][_0xc36d('0xb7')]=[];_0x2ac64b['dataValues']['Messages'][_0xc36d('0x92')](_0x2c5d38[_0xc36d('0xb6')]);return _0x2ac64b;});});}})['then'](respondWithResult(_0x34e458,null))[_0xc36d('0x2c')](handleError(_0x34e458,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index d2f0fb2..b8124a0 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 _0xf55f=['hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x48d717,_0x42016f){var _0xede177=function(_0x57ba02){while(--_0x57ba02){_0x48d717['push'](_0x48d717['shift']());}};_0xede177(++_0x42016f);}(_0xf55f,0x66));var _0xff55=function(_0x415f7e,_0x4630b6){_0x415f7e=_0x415f7e-0x0;var _0x311ff4=_0xf55f[_0x415f7e];return _0x311ff4;};'use strict';var EventEmitter=require(_0xff55('0x0'));var OpenchannelAccount=require(_0xff55('0x1'))['db'][_0xff55('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xff55('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xff55('0x4'),'afterDestroy':_0xff55('0x5')};function emitEvent(_0x108ea1){return function(_0x429221,_0x40c832,_0x18ad78){OpenchannelAccountEvents[_0xff55('0x6')](_0x108ea1+':'+_0x429221['id'],_0x429221);OpenchannelAccountEvents[_0xff55('0x6')](_0x108ea1,_0x429221);_0x18ad78(null);};}for(var e in events){if(events[_0xff55('0x7')](e)){var event=events[e];OpenchannelAccount[_0xff55('0x8')](e,emitEvent(event));}}module[_0xff55('0x9')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x1b36=['hasOwnProperty','hook','events','OpenchannelAccount','setMaxListeners','save','update','emit'];(function(_0x5eb503,_0x573e74){var _0x1e5731=function(_0x5e3b81){while(--_0x5e3b81){_0x5eb503['push'](_0x5eb503['shift']());}};_0x1e5731(++_0x573e74);}(_0x1b36,0x14a));var _0x61b3=function(_0x223d60,_0x28b199){_0x223d60=_0x223d60-0x0;var _0x127026=_0x1b36[_0x223d60];return _0x127026;};'use strict';var EventEmitter=require(_0x61b3('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x61b3('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x61b3('0x2')](0x0);var events={'afterCreate':_0x61b3('0x3'),'afterUpdate':_0x61b3('0x4'),'afterDestroy':'remove'};function emitEvent(_0x486481){return function(_0x43fc4a,_0x4855e0,_0x2ead2d){OpenchannelAccountEvents[_0x61b3('0x5')](_0x486481+':'+_0x43fc4a['id'],_0x43fc4a);OpenchannelAccountEvents[_0x61b3('0x5')](_0x486481,_0x43fc4a);_0x2ead2d(null);};}for(var e in events){if(events[_0x61b3('0x6')](e)){var event=events[e];OpenchannelAccount[_0x61b3('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 8542336..fcb99a2 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 _0x8b97=['request-promise','path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','OpenchannelAccount','lodash','util','api'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x8b97,0x151));var _0x78b9=function(_0x21da80,_0x230ddd){_0x21da80=_0x21da80-0x0;var _0x266c84=_0x8b97[_0x21da80];return _0x266c84;};'use strict';var _=require(_0x78b9('0x0'));var util=require(_0x78b9('0x1'));var logger=require('../../config/logger')(_0x78b9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x78b9('0x3'));var fs=require('fs');var path=require(_0x78b9('0x4'));var rimraf=require(_0x78b9('0x5'));var config=require(_0x78b9('0x6'));var attributes=require(_0x78b9('0x7'));module[_0x78b9('0x8')]=function(_0x43fa55,_0x3a3444){return _0x43fa55['define'](_0x78b9('0x9'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c4a=['exports','OpenchannelAccount','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelAccount.attributes'];(function(_0x16dbfd,_0x2f9431){var _0x382254=function(_0x19dade){while(--_0x19dade){_0x16dbfd['push'](_0x16dbfd['shift']());}};_0x382254(++_0x2f9431);}(_0x7c4a,0x91));var _0xa7c4=function(_0x35de8a,_0x7acd4b){_0x35de8a=_0x35de8a-0x0;var _0x9c759d=_0x7c4a[_0x35de8a];return _0x9c759d;};'use strict';var _=require('lodash');var util=require(_0xa7c4('0x0'));var logger=require(_0xa7c4('0x1'))(_0xa7c4('0x2'));var moment=require(_0xa7c4('0x3'));var BPromise=require(_0xa7c4('0x4'));var rp=require(_0xa7c4('0x5'));var fs=require('fs');var path=require(_0xa7c4('0x6'));var rimraf=require(_0xa7c4('0x7'));var config=require('../../config/environment');var attributes=require(_0xa7c4('0x8'));module[_0xa7c4('0x9')]=function(_0x20ad20,_0x199433){return _0x20ad20['define'](_0xa7c4('0xa'),attributes,{'tableName':'openchannel_accounts','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 6d4b482..a6b41db 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 _0x79da=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xc45596,_0x5c410e){var _0x425ffe=function(_0x3c327d){while(--_0x3c327d){_0xc45596['push'](_0xc45596['shift']());}};_0x425ffe(++_0x5c410e);}(_0x79da,0x6f));var _0xa79d=function(_0x233813,_0x35999b){_0x233813=_0x233813-0x0;var _0x26fc11=_0x79da[_0x233813];return _0x26fc11;};'use strict';var _=require(_0xa79d('0x0'));var util=require(_0xa79d('0x1'));var moment=require(_0xa79d('0x2'));var BPromise=require(_0xa79d('0x3'));var rs=require(_0xa79d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa79d('0x5'))['db'];var utils=require(_0xa79d('0x6'));var logger=require(_0xa79d('0x7'))(_0xa79d('0x8'));var config=require(_0xa79d('0x9'));var jayson=require(_0xa79d('0xa'));var client=jayson[_0xa79d('0xb')]['http']({'port':0x232a});config['redis']=_[_0xa79d('0xc')](config[_0xa79d('0xd')],{'host':_0xa79d('0xe'),'port':0x18eb});var socket=require(_0xa79d('0xf'))(new Redis(config[_0xa79d('0xd')]));require('./openchannelAccount.socket')[_0xa79d('0x10')](socket);function respondWithRpcPromise(_0x161060,_0x5d66a8,_0xb4a0c1){return new BPromise(function(_0x294d20,_0x44a1d2){return client[_0xa79d('0x11')](_0x161060,_0xb4a0c1)[_0xa79d('0x12')](function(_0x5c1173){logger['info'](_0xa79d('0x13'),_0x5d66a8,_0xa79d('0x14'));logger[_0xa79d('0x15')](_0xa79d('0x16'),_0x5d66a8,_0xa79d('0x14'),JSON[_0xa79d('0x17')](_0x5c1173));if(_0x5c1173[_0xa79d('0x18')]){if(_0x5c1173[_0xa79d('0x18')]['code']===0x1f4){logger['error'](_0xa79d('0x13'),_0x5d66a8,_0x5c1173['error'][_0xa79d('0x19')]);return _0x44a1d2(_0x5c1173[_0xa79d('0x18')]['message']);}logger[_0xa79d('0x18')](_0xa79d('0x13'),_0x5d66a8,_0x5c1173[_0xa79d('0x18')][_0xa79d('0x19')]);return _0x294d20(_0x5c1173[_0xa79d('0x18')]['message']);}else{logger[_0xa79d('0x1a')](_0xa79d('0x13'),_0x5d66a8,_0xa79d('0x14'));_0x294d20(_0x5c1173[_0xa79d('0x1b')][_0xa79d('0x19')]);}})[_0xa79d('0x1c')](function(_0x9d3884){logger[_0xa79d('0x18')]('OpenchannelAccount,\x20%s,\x20%s',_0x5d66a8,_0x9d3884);_0x44a1d2(_0x9d3884);});});} \ No newline at end of file +var _0xf40b=['../../config/logger','rpc','jayson/promise','redis','defaults','localhost','./openchannelAccount.socket','register','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelAccount,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x30867b,_0x33dc11){var _0x2bd3bc=function(_0x25c1f1){while(--_0x25c1f1){_0x30867b['push'](_0x30867b['shift']());}};_0x2bd3bc(++_0x33dc11);}(_0xf40b,0x13f));var _0xbf40=function(_0x543c51,_0xff0084){_0x543c51=_0x543c51-0x0;var _0x360555=_0xf40b[_0x543c51];return _0x360555;};'use strict';var _=require(_0xbf40('0x0'));var util=require(_0xbf40('0x1'));var moment=require(_0xbf40('0x2'));var BPromise=require(_0xbf40('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf40('0x4'));var db=require(_0xbf40('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf40('0x6'))(_0xbf40('0x7'));var config=require('../../config/environment');var jayson=require(_0xbf40('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xbf40('0x9')]=_[_0xbf40('0xa')](config[_0xbf40('0x9')],{'host':_0xbf40('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbf40('0x9')]));require(_0xbf40('0xc'))[_0xbf40('0xd')](socket);function respondWithRpcPromise(_0x3fa8c6,_0x1a9638,_0x28d664){return new BPromise(function(_0x15e77c,_0x4ef440){return client[_0xbf40('0xe')](_0x3fa8c6,_0x28d664)[_0xbf40('0xf')](function(_0x3b0864){logger[_0xbf40('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x1a9638,_0xbf40('0x11'));logger[_0xbf40('0x12')](_0xbf40('0x13'),_0x1a9638,'request\x20sent',JSON[_0xbf40('0x14')](_0x3b0864));if(_0x3b0864[_0xbf40('0x15')]){if(_0x3b0864[_0xbf40('0x15')]['code']===0x1f4){logger[_0xbf40('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x1a9638,_0x3b0864['error']['message']);return _0x4ef440(_0x3b0864[_0xbf40('0x15')]['message']);}logger['error'](_0xbf40('0x16'),_0x1a9638,_0x3b0864[_0xbf40('0x15')][_0xbf40('0x17')]);return _0x15e77c(_0x3b0864[_0xbf40('0x15')]['message']);}else{logger[_0xbf40('0x10')](_0xbf40('0x16'),_0x1a9638,'request\x20sent');_0x15e77c(_0x3b0864['result']['message']);}})[_0xbf40('0x18')](function(_0x17adb4){logger['error'](_0xbf40('0x16'),_0x1a9638,_0x17adb4);_0x4ef440(_0x17adb4);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index a2e6ecd..ce82f84 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 _0xf98a=['length','openchannelAccount:','./openchannelAccount.events','save','remove','update','emit','removeListener'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0xf98a,0x162));var _0xaf98=function(_0x3f2a90,_0x50baf1){_0x3f2a90=_0x3f2a90-0x0;var _0xb46279=_0xf98a[_0x3f2a90];return _0xb46279;};'use strict';var OpenchannelAccountEvents=require(_0xaf98('0x0'));var events=[_0xaf98('0x1'),_0xaf98('0x2'),_0xaf98('0x3')];function createListener(_0x574dbf,_0x2a8306){return function(_0x55b25f){_0x2a8306[_0xaf98('0x4')](_0x574dbf,_0x55b25f);};}function removeListener(_0x257d2a,_0x197bc5){return function(){OpenchannelAccountEvents[_0xaf98('0x5')](_0x257d2a,_0x197bc5);};}exports['register']=function(_0x1e9a34){for(var _0x254a2b=0x0,_0xb02433=events[_0xaf98('0x6')];_0x254a2b<_0xb02433;_0x254a2b++){var _0x4c1288=events[_0x254a2b];var _0x17170d=createListener(_0xaf98('0x7')+_0x4c1288,_0x1e9a34);OpenchannelAccountEvents['on'](_0x4c1288,_0x17170d);}}; \ No newline at end of file +var _0x4de7=['length','save','remove','update','emit','removeListener','register'];(function(_0x4a8516,_0x2f523b){var _0xee13aa=function(_0x41bfc6){while(--_0x41bfc6){_0x4a8516['push'](_0x4a8516['shift']());}};_0xee13aa(++_0x2f523b);}(_0x4de7,0x1c1));var _0x74de=function(_0x4bfea5,_0x310c8d){_0x4bfea5=_0x4bfea5-0x0;var _0xd41d7c=_0x4de7[_0x4bfea5];return _0xd41d7c;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x74de('0x0'),_0x74de('0x1'),_0x74de('0x2')];function createListener(_0x38101c,_0x19f1b1){return function(_0x58c8e0){_0x19f1b1[_0x74de('0x3')](_0x38101c,_0x58c8e0);};}function removeListener(_0x3858a5,_0x5a3386){return function(){OpenchannelAccountEvents[_0x74de('0x4')](_0x3858a5,_0x5a3386);};}exports[_0x74de('0x5')]=function(_0x581a0c){for(var _0x1b4bff=0x0,_0x4eef03=events[_0x74de('0x6')];_0x1b4bff<_0x4eef03;_0x1b4bff++){var _0x1d9507=events[_0x1b4bff];var _0x11c093=createListener('openchannelAccount:'+_0x1d9507,_0x581a0c);OpenchannelAccountEvents['on'](_0x1d9507,_0x11c093);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 160921f..9455a0c 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 _0x1c6b=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','show','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x68e79a,_0x2b1611){var _0x5063a3=function(_0x1fbcf3){while(--_0x1fbcf3){_0x68e79a['push'](_0x68e79a['shift']());}};_0x5063a3(++_0x2b1611);}(_0x1c6b,0x94));var _0xb1c6=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0x1c6b[_0x19159a];return _0xa677f4;};'use strict';var multer=require(_0xb1c6('0x0'));var util=require(_0xb1c6('0x1'));var path=require(_0xb1c6('0x2'));var timeout=require(_0xb1c6('0x3'));var express=require(_0xb1c6('0x4'));var router=express[_0xb1c6('0x5')]();var auth=require(_0xb1c6('0x6'));var interaction=require(_0xb1c6('0x7'));var config=require(_0xb1c6('0x8'));var controller=require(_0xb1c6('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xb1c6('0xa')](),controller[_0xb1c6('0xb')]);router['post']('/',auth[_0xb1c6('0xa')](),controller[_0xb1c6('0xc')]);router[_0xb1c6('0xd')](_0xb1c6('0xe'),auth[_0xb1c6('0xa')](),controller[_0xb1c6('0xf')]);router[_0xb1c6('0x10')](_0xb1c6('0xe'),auth[_0xb1c6('0xa')](),controller[_0xb1c6('0x11')]);module[_0xb1c6('0x12')]=router; \ No newline at end of file +var _0x5228=['post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','show'];(function(_0x42bb6d,_0x412255){var _0x1db89b=function(_0x5da43a){while(--_0x5da43a){_0x42bb6d['push'](_0x42bb6d['shift']());}};_0x1db89b(++_0x412255);}(_0x5228,0x17d));var _0x8522=function(_0x1e867a,_0x135291){_0x1e867a=_0x1e867a-0x0;var _0x5ac9a2=_0x5228[_0x1e867a];return _0x5ac9a2;};'use strict';var multer=require(_0x8522('0x0'));var util=require(_0x8522('0x1'));var path=require(_0x8522('0x2'));var timeout=require(_0x8522('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x8522('0x4'));var interaction=require(_0x8522('0x5'));var config=require(_0x8522('0x6'));var controller=require(_0x8522('0x7'));router['get']('/',auth[_0x8522('0x8')](),controller['index']);router['get']('/:id',auth[_0x8522('0x8')](),controller[_0x8522('0x9')]);router[_0x8522('0xa')]('/',auth[_0x8522('0x8')](),controller[_0x8522('0xb')]);router[_0x8522('0xc')](_0x8522('0xd'),auth[_0x8522('0x8')](),controller[_0x8522('0xe')]);router[_0x8522('0xf')]('/:id',auth[_0x8522('0x8')](),controller['destroy']);module[_0x8522('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 999559e..51773aa 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 _0x5234=['exports','INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5234,0x6b));var _0x4523=function(_0x575bcf,_0x175dfb){_0x575bcf=_0x575bcf-0x0;var _0x2a74fe=_0x5234[_0x575bcf];return _0x2a74fe;};'use strict';var Sequelize=require(_0x4523('0x0'));module[_0x4523('0x1')]={'priority':{'type':Sequelize[_0x4523('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4523('0x3')],'allowNull':![],'defaultValue':_0x4523('0x4')},'appdata':{'type':Sequelize[_0x4523('0x5')]()},'description':{'type':Sequelize[_0x4523('0x3')]},'interval':{'type':Sequelize[_0x4523('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xdd4d=['STRING','noop','TEXT','sequelize','exports'];(function(_0x2780de,_0x4738ce){var _0x497dc7=function(_0x3be870){while(--_0x3be870){_0x2780de['push'](_0x2780de['shift']());}};_0x497dc7(++_0x4738ce);}(_0xdd4d,0x17f));var _0xddd4=function(_0x3d21b7,_0x21ccfa){_0x3d21b7=_0x3d21b7-0x0;var _0x219184=_0xdd4d[_0x3d21b7];return _0x219184;};'use strict';var Sequelize=require(_0xddd4('0x0'));module[_0xddd4('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xddd4('0x2')],'allowNull':![],'defaultValue':_0xddd4('0x3')},'appdata':{'type':Sequelize[_0xddd4('0x4')]()},'description':{'type':Sequelize[_0xddd4('0x2')]},'interval':{'type':Sequelize[_0xddd4('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index a024634..2daafe8 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 _0xdc79=['squel','querystring','papaparse','ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','reject','update','destroy','then','error','stack','name','send','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','rows','catch','merge','find','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash'];(function(_0x2e5f9c,_0x134a52){var _0x538b44=function(_0x38ef13){while(--_0x38ef13){_0x2e5f9c['push'](_0x2e5f9c['shift']());}};_0x538b44(++_0x134a52);}(_0xdc79,0x79));var _0x9dc7=function(_0xb2ad47,_0x76772c){_0xb2ad47=_0xb2ad47-0x0;var _0x5a2e9b=_0xdc79[_0xb2ad47];return _0x5a2e9b;};'use strict';var pdf=require(_0x9dc7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9dc7('0x1'));var zipdir=require(_0x9dc7('0x2'));var jsonpatch=require(_0x9dc7('0x3'));var rp=require(_0x9dc7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9dc7('0x5'));var util=require(_0x9dc7('0x6'));var path=require(_0x9dc7('0x7'));var sox=require(_0x9dc7('0x8'));var csv=require(_0x9dc7('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9dc7('0xa'));var squel=require(_0x9dc7('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9dc7('0x9'));var querystring=require(_0x9dc7('0xc'));var Papa=require(_0x9dc7('0xd'));var Redis=require(_0x9dc7('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9dc7('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x9dc7('0x10'));var config=require(_0x9dc7('0x11'));var db=require(_0x9dc7('0x12'))['db'];function respondWithStatusCode(_0x5b8297,_0xd70f4c){_0xd70f4c=_0xd70f4c||0xcc;return function(_0xddca24){if(_0xddca24){return _0x5b8297[_0x9dc7('0x13')](_0xd70f4c);}return _0x5b8297['status'](_0xd70f4c)[_0x9dc7('0x14')]();};}function respondWithResult(_0x3abd8e,_0x17b741){_0x17b741=_0x17b741||0xc8;return function(_0x315747){if(_0x315747){return _0x3abd8e[_0x9dc7('0x15')](_0x17b741)[_0x9dc7('0x16')](_0x315747);}};}function respondWithFilteredResult(_0x1b5a67,_0x202ac8){return function(_0x4c4491){if(_0x4c4491){var _0x13cb5c=_0x4c4491[_0x9dc7('0x17')],_0x3d2747=_0x202ac8[_0x9dc7('0x18')],_0x28b3ac=_0x202ac8['offset']+_0x202ac8['limit'],_0x4b2107;if(_0x28b3ac>=_0x13cb5c){_0x28b3ac=_0x13cb5c;_0x4b2107=0xc8;}else{_0x4b2107=0xce;}_0x1b5a67[_0x9dc7('0x15')](_0x4b2107);return _0x1b5a67[_0x9dc7('0x19')](_0x9dc7('0x1a'),_0x3d2747+'-'+_0x28b3ac+'/'+_0x13cb5c)[_0x9dc7('0x16')](_0x4c4491);}return null;};}function patchUpdates(_0x1f2dc2){return function(_0x107bc0){try{jsonpatch['apply'](_0x107bc0,_0x1f2dc2,!![]);}catch(_0x17fa8f){return BPromise[_0x9dc7('0x1b')](_0x17fa8f);}return _0x107bc0['save']();};}function saveUpdates(_0x3e5972,_0xc25762){return function(_0xfab344){if(_0xfab344){return _0xfab344[_0x9dc7('0x1c')](_0x3e5972)['then'](function(_0x47dbe9){return _0x47dbe9;});}return null;};}function removeEntity(_0x179003,_0x4b78a2){return function(_0x356671){if(_0x356671){return _0x356671[_0x9dc7('0x1d')]()[_0x9dc7('0x1e')](function(){_0x179003[_0x9dc7('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e3a49,_0x292b11){return function(_0x4d14c6){if(!_0x4d14c6){_0x2e3a49[_0x9dc7('0x13')](0x194);}return _0x4d14c6;};}function handleError(_0xa21591,_0x27fec8){_0x27fec8=_0x27fec8||0x1f4;return function(_0x17adf9){logger[_0x9dc7('0x1f')](_0x17adf9[_0x9dc7('0x20')]);if(_0x17adf9[_0x9dc7('0x21')]){delete _0x17adf9[_0x9dc7('0x21')];}_0xa21591[_0x9dc7('0x15')](_0x27fec8)[_0x9dc7('0x22')](_0x17adf9);};}exports['index']=function(_0x312c50,_0x259852){var _0x619581={},_0x144be2={},_0x123a62={'count':0x0,'rows':[]};var _0x2818e6=_[_0x9dc7('0x23')](db[_0x9dc7('0x24')][_0x9dc7('0x25')],function(_0x4c3e22){return{'name':_0x4c3e22[_0x9dc7('0x26')],'type':_0x4c3e22[_0x9dc7('0x27')][_0x9dc7('0x28')]};});_0x144be2[_0x9dc7('0x29')]=_[_0x9dc7('0x23')](_0x2818e6,_0x9dc7('0x21'));_0x144be2[_0x9dc7('0x2a')]=_[_0x9dc7('0x2b')](_0x312c50[_0x9dc7('0x2a')]);_0x144be2['filters']=_['intersection'](_0x144be2[_0x9dc7('0x29')],_0x144be2[_0x9dc7('0x2a')]);_0x619581[_0x9dc7('0x2c')]=_[_0x9dc7('0x2d')](_0x144be2[_0x9dc7('0x29')],qs[_0x9dc7('0x2e')](_0x312c50['query'][_0x9dc7('0x2e')]));_0x619581[_0x9dc7('0x2c')]=_0x619581[_0x9dc7('0x2c')][_0x9dc7('0x2f')]?_0x619581[_0x9dc7('0x2c')]:_0x144be2[_0x9dc7('0x29')];if(!_0x312c50[_0x9dc7('0x2a')][_0x9dc7('0x30')](_0x9dc7('0x31'))){_0x619581[_0x9dc7('0x32')]=qs['limit'](_0x312c50[_0x9dc7('0x2a')][_0x9dc7('0x32')]);_0x619581[_0x9dc7('0x18')]=qs[_0x9dc7('0x18')](_0x312c50[_0x9dc7('0x2a')]['offset']);}_0x619581['order']=qs['sort'](_0x312c50['query'][_0x9dc7('0x33')]);_0x619581[_0x9dc7('0x34')]=qs[_0x9dc7('0x35')](_[_0x9dc7('0x36')](_0x312c50[_0x9dc7('0x2a')],_0x144be2[_0x9dc7('0x35')]),_0x2818e6);if(_0x312c50['query'][_0x9dc7('0x37')]){_0x619581[_0x9dc7('0x34')]=_['merge'](_0x619581[_0x9dc7('0x34')],{'$or':_[_0x9dc7('0x23')](_0x2818e6,function(_0x3f9eee){if(_0x3f9eee[_0x9dc7('0x27')]!==_0x9dc7('0x38')){var _0x105051={};_0x105051[_0x3f9eee['name']]={'$like':'%'+_0x312c50[_0x9dc7('0x2a')][_0x9dc7('0x37')]+'%'};return _0x105051;}})});}_0x619581=_['merge']({},_0x619581,_0x312c50[_0x9dc7('0x39')]);var _0x2fef3f={'where':_0x619581[_0x9dc7('0x34')]};return db[_0x9dc7('0x24')]['count'](_0x2fef3f)[_0x9dc7('0x1e')](function(_0x29b1dc){_0x123a62[_0x9dc7('0x17')]=_0x29b1dc;if(_0x312c50[_0x9dc7('0x2a')][_0x9dc7('0x3a')]){_0x619581['include']=[{'all':!![]}];}return db[_0x9dc7('0x24')]['findAll'](_0x619581);})[_0x9dc7('0x1e')](function(_0x285d78){_0x123a62[_0x9dc7('0x3b')]=_0x285d78;return _0x123a62;})[_0x9dc7('0x1e')](respondWithFilteredResult(_0x259852,_0x619581))[_0x9dc7('0x3c')](handleError(_0x259852,null));};exports['show']=function(_0x4ed5b2,_0x4351fb){var _0x4a8aaa={'raw':!![],'where':{'id':_0x4ed5b2['params']['id']}},_0x568136={};_0x568136[_0x9dc7('0x29')]=_[_0x9dc7('0x2b')](db['OpenchannelApplication'][_0x9dc7('0x25')]);_0x568136[_0x9dc7('0x2a')]=_[_0x9dc7('0x2b')](_0x4ed5b2[_0x9dc7('0x2a')]);_0x568136[_0x9dc7('0x35')]=_[_0x9dc7('0x2d')](_0x568136[_0x9dc7('0x29')],_0x568136[_0x9dc7('0x2a')]);_0x4a8aaa[_0x9dc7('0x2c')]=_['intersection'](_0x568136[_0x9dc7('0x29')],qs[_0x9dc7('0x2e')](_0x4ed5b2[_0x9dc7('0x2a')][_0x9dc7('0x2e')]));_0x4a8aaa[_0x9dc7('0x2c')]=_0x4a8aaa[_0x9dc7('0x2c')][_0x9dc7('0x2f')]?_0x4a8aaa[_0x9dc7('0x2c')]:_0x568136[_0x9dc7('0x29')];if(_0x4ed5b2[_0x9dc7('0x2a')][_0x9dc7('0x3a')]){_0x4a8aaa['include']=[{'all':!![]}];}_0x4a8aaa=_[_0x9dc7('0x3d')]({},_0x4a8aaa,_0x4ed5b2[_0x9dc7('0x39')]);return db[_0x9dc7('0x24')][_0x9dc7('0x3e')](_0x4a8aaa)['then'](handleEntityNotFound(_0x4351fb,null))[_0x9dc7('0x1e')](respondWithResult(_0x4351fb,null))[_0x9dc7('0x3c')](handleError(_0x4351fb,null));};exports[_0x9dc7('0x3f')]=function(_0x3a43c8,_0x4acb39){return db[_0x9dc7('0x24')]['create'](_0x3a43c8[_0x9dc7('0x40')],{})[_0x9dc7('0x1e')](respondWithResult(_0x4acb39,0xc9))[_0x9dc7('0x3c')](handleError(_0x4acb39,null));};exports[_0x9dc7('0x1c')]=function(_0x498809,_0x26ff3b){if(_0x498809[_0x9dc7('0x40')]['id']){delete _0x498809[_0x9dc7('0x40')]['id'];}return db[_0x9dc7('0x24')]['find']({'where':{'id':_0x498809['params']['id']}})[_0x9dc7('0x1e')](handleEntityNotFound(_0x26ff3b,null))[_0x9dc7('0x1e')](saveUpdates(_0x498809[_0x9dc7('0x40')],null))[_0x9dc7('0x1e')](respondWithResult(_0x26ff3b,null))[_0x9dc7('0x3c')](handleError(_0x26ff3b,null));};exports[_0x9dc7('0x1d')]=function(_0x4b57c7,_0x12838a){return db[_0x9dc7('0x24')][_0x9dc7('0x3e')]({'where':{'id':_0x4b57c7[_0x9dc7('0x41')]['id']}})[_0x9dc7('0x1e')](handleEntityNotFound(_0x12838a,null))[_0x9dc7('0x1e')](removeEntity(_0x12838a,null))[_0x9dc7('0x3c')](handleError(_0x12838a,null));}; \ No newline at end of file +var _0x721c=['merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','rawAttributes','intersection','include','find','create','body','catch','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','destroy','then','error','stack','name','send','map','OpenchannelApplication','fieldName','key','model','query','keys','attributes','fields','length','nolimit','limit','sort','where','filters','pick'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x721c,0x17a));var _0xc721=function(_0xb8f757,_0x20123e){_0xb8f757=_0xb8f757-0x0;var _0x55b846=_0x721c[_0xb8f757];return _0x55b846;};'use strict';var pdf=require(_0xc721('0x0'));var emlformat=require(_0xc721('0x1'));var rimraf=require(_0xc721('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc721('0x3'));var rp=require(_0xc721('0x4'));var moment=require(_0xc721('0x5'));var BPromise=require(_0xc721('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc721('0x7'));var sox=require(_0xc721('0x8'));var csv=require(_0xc721('0x9'));var ejs=require(_0xc721('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc721('0xb'));var crypto=require(_0xc721('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc721('0xd'));var Papa=require(_0xc721('0xe'));var Redis=require(_0xc721('0xf'));var authService=require(_0xc721('0x10'));var qs=require(_0xc721('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc721('0x12'))(_0xc721('0x13'));var utils=require('../../config/utils');var config=require(_0xc721('0x14'));var db=require(_0xc721('0x15'))['db'];function respondWithStatusCode(_0x19e03e,_0x4d557b){_0x4d557b=_0x4d557b||0xcc;return function(_0x3cacc2){if(_0x3cacc2){return _0x19e03e[_0xc721('0x16')](_0x4d557b);}return _0x19e03e[_0xc721('0x17')](_0x4d557b)[_0xc721('0x18')]();};}function respondWithResult(_0x308cfc,_0xa38f2f){_0xa38f2f=_0xa38f2f||0xc8;return function(_0x35baed){if(_0x35baed){return _0x308cfc['status'](_0xa38f2f)[_0xc721('0x19')](_0x35baed);}};}function respondWithFilteredResult(_0x15c8d3,_0x253387){return function(_0x536473){if(_0x536473){var _0x35b045=_0x536473[_0xc721('0x1a')],_0x570a72=_0x253387[_0xc721('0x1b')],_0x177405=_0x253387[_0xc721('0x1b')]+_0x253387['limit'],_0x474070;if(_0x177405>=_0x35b045){_0x177405=_0x35b045;_0x474070=0xc8;}else{_0x474070=0xce;}_0x15c8d3[_0xc721('0x17')](_0x474070);return _0x15c8d3[_0xc721('0x1c')](_0xc721('0x1d'),_0x570a72+'-'+_0x177405+'/'+_0x35b045)[_0xc721('0x19')](_0x536473);}return null;};}function patchUpdates(_0x44a070){return function(_0x2a7779){try{jsonpatch[_0xc721('0x1e')](_0x2a7779,_0x44a070,!![]);}catch(_0x4c8c9a){return BPromise['reject'](_0x4c8c9a);}return _0x2a7779[_0xc721('0x1f')]();};}function saveUpdates(_0x2450b8,_0x145583){return function(_0x3317c8){if(_0x3317c8){return _0x3317c8['update'](_0x2450b8)['then'](function(_0x4da5ff){return _0x4da5ff;});}return null;};}function removeEntity(_0x16ddf0,_0x16bf21){return function(_0x4e635b){if(_0x4e635b){return _0x4e635b[_0xc721('0x20')]()[_0xc721('0x21')](function(){_0x16ddf0[_0xc721('0x17')](0xcc)[_0xc721('0x18')]();});}};}function handleEntityNotFound(_0x265995,_0x277af9){return function(_0x5c69ae){if(!_0x5c69ae){_0x265995['sendStatus'](0x194);}return _0x5c69ae;};}function handleError(_0x3e6e1c,_0x379f0c){_0x379f0c=_0x379f0c||0x1f4;return function(_0x56d380){logger[_0xc721('0x22')](_0x56d380[_0xc721('0x23')]);if(_0x56d380['name']){delete _0x56d380[_0xc721('0x24')];}_0x3e6e1c[_0xc721('0x17')](_0x379f0c)[_0xc721('0x25')](_0x56d380);};}exports['index']=function(_0x47d410,_0x3d6939){var _0x56176d={},_0x5ae99f={},_0x204733={'count':0x0,'rows':[]};var _0x2fb0d9=_[_0xc721('0x26')](db[_0xc721('0x27')]['rawAttributes'],function(_0x3d4ea6){return{'name':_0x3d4ea6[_0xc721('0x28')],'type':_0x3d4ea6['type'][_0xc721('0x29')]};});_0x5ae99f[_0xc721('0x2a')]=_[_0xc721('0x26')](_0x2fb0d9,_0xc721('0x24'));_0x5ae99f[_0xc721('0x2b')]=_[_0xc721('0x2c')](_0x47d410['query']);_0x5ae99f['filters']=_['intersection'](_0x5ae99f[_0xc721('0x2a')],_0x5ae99f['query']);_0x56176d[_0xc721('0x2d')]=_['intersection'](_0x5ae99f[_0xc721('0x2a')],qs[_0xc721('0x2e')](_0x47d410['query'][_0xc721('0x2e')]));_0x56176d[_0xc721('0x2d')]=_0x56176d[_0xc721('0x2d')][_0xc721('0x2f')]?_0x56176d[_0xc721('0x2d')]:_0x5ae99f[_0xc721('0x2a')];if(!_0x47d410[_0xc721('0x2b')]['hasOwnProperty'](_0xc721('0x30'))){_0x56176d[_0xc721('0x31')]=qs['limit'](_0x47d410[_0xc721('0x2b')]['limit']);_0x56176d['offset']=qs[_0xc721('0x1b')](_0x47d410[_0xc721('0x2b')][_0xc721('0x1b')]);}_0x56176d['order']=qs[_0xc721('0x32')](_0x47d410['query'][_0xc721('0x32')]);_0x56176d[_0xc721('0x33')]=qs[_0xc721('0x34')](_[_0xc721('0x35')](_0x47d410[_0xc721('0x2b')],_0x5ae99f[_0xc721('0x34')]),_0x2fb0d9);if(_0x47d410['query']['filter']){_0x56176d['where']=_[_0xc721('0x36')](_0x56176d[_0xc721('0x33')],{'$or':_[_0xc721('0x26')](_0x2fb0d9,function(_0x5a9e63){if(_0x5a9e63[_0xc721('0x37')]!==_0xc721('0x38')){var _0x4713c1={};_0x4713c1[_0x5a9e63['name']]={'$like':'%'+_0x47d410['query'][_0xc721('0x39')]+'%'};return _0x4713c1;}})});}_0x56176d=_[_0xc721('0x36')]({},_0x56176d,_0x47d410[_0xc721('0x3a')]);var _0x33b922={'where':_0x56176d[_0xc721('0x33')]};return db[_0xc721('0x27')]['count'](_0x33b922)['then'](function(_0x3cb9f2){_0x204733[_0xc721('0x1a')]=_0x3cb9f2;if(_0x47d410[_0xc721('0x2b')][_0xc721('0x3b')]){_0x56176d['include']=[{'all':!![]}];}return db[_0xc721('0x27')][_0xc721('0x3c')](_0x56176d);})[_0xc721('0x21')](function(_0x4a512d){_0x204733[_0xc721('0x3d')]=_0x4a512d;return _0x204733;})[_0xc721('0x21')](respondWithFilteredResult(_0x3d6939,_0x56176d))['catch'](handleError(_0x3d6939,null));};exports[_0xc721('0x3e')]=function(_0x3bb77f,_0x2b6f19){var _0x279a67={'raw':!![],'where':{'id':_0x3bb77f[_0xc721('0x3f')]['id']}},_0x57ad29={};_0x57ad29[_0xc721('0x2a')]=_[_0xc721('0x2c')](db[_0xc721('0x27')][_0xc721('0x40')]);_0x57ad29[_0xc721('0x2b')]=_[_0xc721('0x2c')](_0x3bb77f[_0xc721('0x2b')]);_0x57ad29[_0xc721('0x34')]=_['intersection'](_0x57ad29['model'],_0x57ad29[_0xc721('0x2b')]);_0x279a67[_0xc721('0x2d')]=_[_0xc721('0x41')](_0x57ad29[_0xc721('0x2a')],qs[_0xc721('0x2e')](_0x3bb77f['query'][_0xc721('0x2e')]));_0x279a67['attributes']=_0x279a67[_0xc721('0x2d')][_0xc721('0x2f')]?_0x279a67[_0xc721('0x2d')]:_0x57ad29['model'];if(_0x3bb77f['query'][_0xc721('0x3b')]){_0x279a67[_0xc721('0x42')]=[{'all':!![]}];}_0x279a67=_[_0xc721('0x36')]({},_0x279a67,_0x3bb77f[_0xc721('0x3a')]);return db[_0xc721('0x27')][_0xc721('0x43')](_0x279a67)['then'](handleEntityNotFound(_0x2b6f19,null))[_0xc721('0x21')](respondWithResult(_0x2b6f19,null))['catch'](handleError(_0x2b6f19,null));};exports[_0xc721('0x44')]=function(_0x11904c,_0x131789){return db[_0xc721('0x27')][_0xc721('0x44')](_0x11904c[_0xc721('0x45')],{})[_0xc721('0x21')](respondWithResult(_0x131789,0xc9))[_0xc721('0x46')](handleError(_0x131789,null));};exports[_0xc721('0x47')]=function(_0x92c23c,_0x1d269e){if(_0x92c23c['body']['id']){delete _0x92c23c[_0xc721('0x45')]['id'];}return db[_0xc721('0x27')][_0xc721('0x43')]({'where':{'id':_0x92c23c[_0xc721('0x3f')]['id']}})[_0xc721('0x21')](handleEntityNotFound(_0x1d269e,null))[_0xc721('0x21')](saveUpdates(_0x92c23c[_0xc721('0x45')],null))['then'](respondWithResult(_0x1d269e,null))['catch'](handleError(_0x1d269e,null));};exports[_0xc721('0x20')]=function(_0x5144cc,_0x5f0b86){return db['OpenchannelApplication']['find']({'where':{'id':_0x5144cc[_0xc721('0x3f')]['id']}})[_0xc721('0x21')](handleEntityNotFound(_0x5f0b86,null))[_0xc721('0x21')](removeEntity(_0x5f0b86,null))[_0xc721('0x46')](handleError(_0x5f0b86,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 36df081..59fcefc 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 _0x1fbb=['OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','exports','define'];(function(_0x11513b,_0x4dd71b){var _0x545cc3=function(_0x46624b){while(--_0x46624b){_0x11513b['push'](_0x11513b['shift']());}};_0x545cc3(++_0x4dd71b);}(_0x1fbb,0xb4));var _0xb1fb=function(_0x3ddaeb,_0x2c01b0){_0x3ddaeb=_0x3ddaeb-0x0;var _0x38ba94=_0x1fbb[_0x3ddaeb];return _0x38ba94;};'use strict';var _=require(_0xb1fb('0x0'));var util=require('util');var logger=require(_0xb1fb('0x1'))('api');var moment=require(_0xb1fb('0x2'));var BPromise=require(_0xb1fb('0x3'));var rp=require(_0xb1fb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module[_0xb1fb('0x5')]=function(_0x37a518,_0x1f6027){return _0x37a518[_0xb1fb('0x6')](_0xb1fb('0x7'),attributes,{'tableName':_0xb1fb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb1fb('0x9'),'collate':_0xb1fb('0xa')});}; \ No newline at end of file +var _0x914d=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x25457e,_0x5f556c){var _0x55f128=function(_0x4a38ec){while(--_0x4a38ec){_0x25457e['push'](_0x25457e['shift']());}};_0x55f128(++_0x5f556c);}(_0x914d,0x192));var _0xd914=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x914d[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0xd914('0x0'));var util=require(_0xd914('0x1'));var logger=require('../../config/logger')(_0xd914('0x2'));var moment=require(_0xd914('0x3'));var BPromise=require(_0xd914('0x4'));var rp=require(_0xd914('0x5'));var fs=require('fs');var path=require(_0xd914('0x6'));var rimraf=require(_0xd914('0x7'));var config=require(_0xd914('0x8'));var attributes=require(_0xd914('0x9'));module[_0xd914('0xa')]=function(_0x1f1b68,_0x14e942){return _0x1f1b68['define'](_0xd914('0xb'),attributes,{'tableName':_0xd914('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd914('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index ebaa421..5ed7d67 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x3589f4,_0x457a3b){var _0x119508=function(_0x861f87){while(--_0x861f87){_0x3589f4['push'](_0x3589f4['shift']());}};_0x119508(++_0x457a3b);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e18a,_0x2d220a){_0x4e18a=_0x4e18a-0x0;var _0x56cc08=_0xb10b[_0x4e18a];return _0x56cc08;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file +var _0xd8b0=['OpenchannelApplication','body','options','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['update'](_0x5fecbd[_0x0d8b('0x18')],{'raw':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1b')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['attributes']||null:null,'limit':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['limit']||null:null})['then'](function(_0x238728){logger[_0x0d8b('0xb')](_0x0d8b('0x16'),_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON[_0x0d8b('0x10')](_0x238728));_0x18dd2d(_0x238728);})[_0x0d8b('0x15')](function(_0x4562cb){logger[_0x0d8b('0x11')]('UpdateOpenchannelApplication',_0x4562cb[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x4562cb['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index c2a09b2..1cc762f 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 _0x24e7=['removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','index','isAuthenticated','describe','/:id','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','put','openchannelinteraction:update','delete','openchannelinteraction:destroy'];(function(_0x385f16,_0x79ff3f){var _0x5eb97c=function(_0x22dada){while(--_0x22dada){_0x385f16['push'](_0x385f16['shift']());}};_0x5eb97c(++_0x79ff3f);}(_0x24e7,0x136));var _0x724e=function(_0x17c226,_0x2f5fb2){_0x17c226=_0x17c226-0x0;var _0x698a9b=_0x24e7[_0x17c226];return _0x698a9b;};'use strict';var multer=require('multer');var util=require(_0x724e('0x0'));var path=require(_0x724e('0x1'));var timeout=require(_0x724e('0x2'));var express=require(_0x724e('0x3'));var router=express[_0x724e('0x4')]();var auth=require(_0x724e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x724e('0x6'));var controller=require(_0x724e('0x7'));router[_0x724e('0x8')]('/',auth['isAuthenticated'](),controller[_0x724e('0x9')]);router['get']('/describe',auth[_0x724e('0xa')](),controller[_0x724e('0xb')]);router['get'](_0x724e('0xc'),auth[_0x724e('0xa')](),controller['show']);router[_0x724e('0x8')](_0x724e('0xd'),auth[_0x724e('0xa')](),controller['getMessages']);router['get'](_0x724e('0xe'),auth['isAuthenticated'](),controller[_0x724e('0xf')]);router[_0x724e('0x10')]('/',auth[_0x724e('0xa')](),controller[_0x724e('0x11')]);router[_0x724e('0x10')](_0x724e('0xd'),auth[_0x724e('0xa')](),controller[_0x724e('0x12')]);router['post'](_0x724e('0x13'),auth[_0x724e('0xa')](),interaction[_0x724e('0x14')](_0x724e('0x15'),'openchannelinteraction:addtags'),controller['addTags']);router[_0x724e('0x16')]('/:id',auth['isAuthenticated'](),interaction[_0x724e('0x14')](_0x724e('0x15'),_0x724e('0x17')),controller['update']);router[_0x724e('0x18')](_0x724e('0xc'),auth['isAuthenticated'](),interaction[_0x724e('0x14')](_0x724e('0x15'),_0x724e('0x19')),controller['destroy']);router['delete'](_0x724e('0x13'),auth[_0x724e('0xa')](),controller[_0x724e('0x1a')]);module[_0x724e('0x1b')]=router; \ No newline at end of file +var _0xc7af=['put','tracked','openchannelinteraction:destroy','destroy','delete','/:id/tags','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','index','/describe','describe','get','/:id','isAuthenticated','/:id/messages','getMessages','download','post','create','openchannel','openchannelinteraction:addtags','addTags'];(function(_0xa22054,_0x464303){var _0x4bee13=function(_0x26b6d7){while(--_0x26b6d7){_0xa22054['push'](_0xa22054['shift']());}};_0x4bee13(++_0x464303);}(_0xc7af,0xa8));var _0xfc7a=function(_0x27ddf5,_0x5a3e18){_0x27ddf5=_0x27ddf5-0x0;var _0x26e74a=_0xc7af[_0x27ddf5];return _0x26e74a;};'use strict';var multer=require(_0xfc7a('0x0'));var util=require(_0xfc7a('0x1'));var path=require(_0xfc7a('0x2'));var timeout=require(_0xfc7a('0x3'));var express=require(_0xfc7a('0x4'));var router=express['Router']();var auth=require(_0xfc7a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfc7a('0x6'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xfc7a('0x7')]);router['get'](_0xfc7a('0x8'),auth['isAuthenticated'](),controller[_0xfc7a('0x9')]);router[_0xfc7a('0xa')](_0xfc7a('0xb'),auth[_0xfc7a('0xc')](),controller['show']);router[_0xfc7a('0xa')](_0xfc7a('0xd'),auth[_0xfc7a('0xc')](),controller[_0xfc7a('0xe')]);router[_0xfc7a('0xa')]('/:id/download',auth[_0xfc7a('0xc')](),controller[_0xfc7a('0xf')]);router[_0xfc7a('0x10')]('/',auth[_0xfc7a('0xc')](),controller[_0xfc7a('0x11')]);router[_0xfc7a('0x10')](_0xfc7a('0xd'),auth[_0xfc7a('0xc')](),controller['addMessage']);router[_0xfc7a('0x10')]('/:id/tags',auth[_0xfc7a('0xc')](),interaction['tracked'](_0xfc7a('0x12'),_0xfc7a('0x13')),controller[_0xfc7a('0x14')]);router[_0xfc7a('0x15')](_0xfc7a('0xb'),auth[_0xfc7a('0xc')](),interaction[_0xfc7a('0x16')]('openchannel','openchannelinteraction:update'),controller['update']);router['delete'](_0xfc7a('0xb'),auth[_0xfc7a('0xc')](),interaction['tracked'](_0xfc7a('0x12'),_0xfc7a('0x17')),controller[_0xfc7a('0x18')]);router[_0xfc7a('0x19')](_0xfc7a('0x1a'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 99bdbae..965cdbf 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 _0x9b49=['sequelize','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x70841e,_0x1e002d){var _0x4f15a8=function(_0x3cc940){while(--_0x3cc940){_0x70841e['push'](_0x70841e['shift']());}};_0x4f15a8(++_0x1e002d);}(_0x9b49,0x114));var _0x99b4=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0x9b49[_0x4aba15];return _0x1c8122;};'use strict';var Sequelize=require(_0x99b4('0x0'));module['exports']={'closed':{'type':Sequelize[_0x99b4('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x99b4('0x2')]},'disposition':{'type':Sequelize[_0x99b4('0x3')]},'note':{'type':Sequelize[_0x99b4('0x3')]},'read1stAt':{'type':Sequelize[_0x99b4('0x2')]},'threadId':{'type':Sequelize[_0x99b4('0x3')]},'externalUrl':{'type':Sequelize[_0x99b4('0x3')]},'lastMsgAt':{'type':Sequelize[_0x99b4('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x99b4('0x4')]('in',_0x99b4('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x99b4('0x3')]}}; \ No newline at end of file +var _0x7f98=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0x7f98,0xfe));var _0x87f9=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x7f98[_0x487b0c];return _0x1adbdc;};'use strict';var Sequelize=require(_0x87f9('0x0'));module[_0x87f9('0x1')]={'closed':{'type':Sequelize[_0x87f9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x87f9('0x3')]},'disposition':{'type':Sequelize[_0x87f9('0x4')]},'note':{'type':Sequelize[_0x87f9('0x4')]},'read1stAt':{'type':Sequelize[_0x87f9('0x3')]},'threadId':{'type':Sequelize[_0x87f9('0x4')]},'externalUrl':{'type':Sequelize[_0x87f9('0x4')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x87f9('0x5')]('in',_0x87f9('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x87f9('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index e8fe4c7..0f00aa5 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 _0x69d5=['openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','value','having','`\x20>\x200','operator','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','body','some','compact','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','unreadMessages','DESC','isEmpty','t.id\x20IN\x20?','resolve','OpenchannelAccountId','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','count','OpenchannelInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','all','rows','show','params','rawAttributes','merge','options','create','destroy','OpenchannelMessage','addMessage','omit','ids','getMessages','findOne','nolimit','pick','OpenchannelInteractionId','$gte','YYYY-MM-DD\x20HH:mm:ss','include','addTags','setTags','spread','Tag','findAll','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','format','CmContact','Contact','firstName','lastName','Attachment','direction','OpenchannelAccount','Owner','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Openchannel','YYYY-MM-DD','N.A.','closed','disposition','threadId','Public','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','secret','renderFile','downloadInteraction.html','toFile','transcript-','.pdf','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','select','field','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x69d5,0x18e));var _0x569d=function(_0x20a206,_0xb84aee){_0x20a206=_0x20a206-0x0;var _0x32b0dc=_0x69d5[_0x20a206];return _0x32b0dc;};'use strict';var pdf=require(_0x569d('0x0'));var emlformat=require(_0x569d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x569d('0x2'));var jsonpatch=require(_0x569d('0x3'));var rp=require('request-promise');var moment=require(_0x569d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x569d('0x5'));var util=require(_0x569d('0x6'));var path=require(_0x569d('0x7'));var sox=require(_0x569d('0x8'));var csv=require(_0x569d('0x9'));var ejs=require(_0x569d('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x569d('0xb'));var jsforce=require(_0x569d('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x569d('0xd'));var Papa=require(_0x569d('0xe'));var Redis=require(_0x569d('0xf'));var authService=require(_0x569d('0x10'));var qs=require(_0x569d('0x11'));var as=require(_0x569d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x569d('0x13'))(_0x569d('0x14'));var utils=require(_0x569d('0x15'));var config=require(_0x569d('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x569d('0x17')](config[_0x569d('0x18')],{'host':_0x569d('0x19'),'port':0x18eb});var socket=require(_0x569d('0x1a'))(new Redis(config[_0x569d('0x18')]));require(_0x569d('0x1b'))[_0x569d('0x1c')](socket);function respondWithStatusCode(_0x2573be,_0x4a8738){_0x4a8738=_0x4a8738||0xcc;return function(_0x22e306){if(_0x22e306){return _0x2573be[_0x569d('0x1d')](_0x4a8738);}return _0x2573be[_0x569d('0x1e')](_0x4a8738)[_0x569d('0x1f')]();};}function respondWithResult(_0x11ffd2,_0x5e30b3){_0x5e30b3=_0x5e30b3||0xc8;return function(_0x57a3e6){if(_0x57a3e6){return _0x11ffd2[_0x569d('0x1e')](_0x5e30b3)[_0x569d('0x20')](_0x57a3e6);}};}function respondWithFilteredResult(_0xeaa1fb,_0x5d1102){return function(_0xbba74a){if(_0xbba74a){var _0x4775cd=_0xbba74a['count'],_0x5e2d7a=_0x5d1102[_0x569d('0x21')],_0xef3b29=_0x5d1102['offset']+_0x5d1102[_0x569d('0x22')],_0x4d3fc3;if(_0xef3b29>=_0x4775cd){_0xef3b29=_0x4775cd;_0x4d3fc3=0xc8;}else{_0x4d3fc3=0xce;}_0xeaa1fb[_0x569d('0x1e')](_0x4d3fc3);return _0xeaa1fb[_0x569d('0x23')](_0x569d('0x24'),_0x5e2d7a+'-'+_0xef3b29+'/'+_0x4775cd)['json'](_0xbba74a);}return null;};}function patchUpdates(_0xbd161){return function(_0x1e21c5){try{jsonpatch[_0x569d('0x25')](_0x1e21c5,_0xbd161,!![]);}catch(_0x785c13){return BPromise[_0x569d('0x26')](_0x785c13);}return _0x1e21c5[_0x569d('0x27')]();};}function saveUpdates(_0x5794f5,_0x433f69){return function(_0x47d86b){if(_0x47d86b){return _0x47d86b[_0x569d('0x28')](_0x5794f5)['then'](function(_0x59863b){return _0x59863b;});}return null;};}function removeEntity(_0xc01c8b,_0x236019){return function(_0x292c44){if(_0x292c44){return _0x292c44['destroy']()[_0x569d('0x29')](function(){_0xc01c8b[_0x569d('0x1e')](0xcc)[_0x569d('0x1f')]();});}};}function handleEntityNotFound(_0x3472d4,_0x69249a){return function(_0x15c1da){if(!_0x15c1da){_0x3472d4['sendStatus'](0x194);}return _0x15c1da;};}function handleError(_0x5ed184,_0x24b70f){_0x24b70f=_0x24b70f||0x1f4;return function(_0x54333c){logger[_0x569d('0x2a')](_0x54333c['stack']);if(_0x54333c[_0x569d('0x2b')]){delete _0x54333c[_0x569d('0x2b')];}_0x5ed184[_0x569d('0x1e')](_0x24b70f)[_0x569d('0x2c')](_0x54333c);};}function getInteractionUsers(_0x3d23bb,_0x2c4273){return new BPromise(function(_0x551bcc,_0x4bfd55){try{if(_0x2c4273[_0x3d23bb['id']]){_0x3d23bb[_0x569d('0x2d')]=_[_0x569d('0x2e')](_0x2c4273[_0x3d23bb['id']],function(_0xd828a){return{'id':_0xd828a['id'],'fullname':_0xd828a[_0x569d('0x2f')]};});}}catch(_0x1647a4){_0x4bfd55(_0x1647a4);}_0x551bcc(_0x3d23bb);});}function getInteractionTags(_0x27e113,_0x3003fc){return new BPromise(function(_0x4db333,_0x1c93e2){try{if(_0x27e113[_0x569d('0x30')]){_0x27e113[_0x569d('0x31')]=[];_0x27e113['TagIds'][_0x569d('0x32')](',')[_0x569d('0x33')](function(_0x4e6415){_0x27e113[_0x569d('0x31')][_0x569d('0x34')](_0x3003fc[_0x4e6415]);});}delete _0x27e113[_0x569d('0x30')];}catch(_0x4f9538){_0x1c93e2(_0x4f9538);}_0x4db333(_0x27e113);});}function updateOpenchannelInteraction(_0xc6bc58,_0x5345fb,_0x3d702a){return new BPromise(function(_0x396689,_0x257cc2){return getInteractionUsers(_0xc6bc58,_0x3d702a)['then'](function(_0x49c04d){return getInteractionTags(_0x49c04d,_0x5345fb);})[_0x569d('0x29')](function(_0x48a5bf){_0x396689(_0x48a5bf);})[_0x569d('0x35')](function(_0x3a2c8c){_0x257cc2(_0x3a2c8c);});});}exports[_0x569d('0x36')]=function(_0x557f47,_0x203e31){var _0x10197c={},_0x1d6646={},_0xea8f66={'count':0x0,'rows':[]};var _0x35bb32=_[_0x569d('0x2e')](db['OpenchannelInteraction']['rawAttributes'],function(_0x44ddd1){return{'name':_0x44ddd1['fieldName'],'type':_0x44ddd1[_0x569d('0x37')][_0x569d('0x38')]};});_0x1d6646[_0x569d('0x39')]=_[_0x569d('0x2e')](_0x35bb32,_0x569d('0x2b'));_0x1d6646[_0x569d('0x3a')]=_[_0x569d('0x3b')](_0x557f47[_0x569d('0x3a')]);_0x1d6646[_0x569d('0x3c')]=_[_0x569d('0x3d')](_0x1d6646[_0x569d('0x39')],_0x1d6646['query']);_0x10197c[_0x569d('0x3e')]=_[_0x569d('0x3d')](_0x1d6646['model'],qs[_0x569d('0x3f')](_0x557f47[_0x569d('0x3a')][_0x569d('0x3f')]));_0x10197c['attributes']=_0x10197c[_0x569d('0x3e')][_0x569d('0x40')]?_0x10197c[_0x569d('0x3e')]:_0x1d6646[_0x569d('0x39')];if(!_0x557f47[_0x569d('0x3a')][_0x569d('0x41')]('nolimit')){_0x10197c[_0x569d('0x22')]=qs['limit'](_0x557f47[_0x569d('0x3a')]['limit']);_0x10197c[_0x569d('0x21')]=qs['offset'](_0x557f47[_0x569d('0x3a')][_0x569d('0x21')]);}_0x10197c[_0x569d('0x42')]=qs[_0x569d('0x43')](_0x557f47[_0x569d('0x3a')][_0x569d('0x43')]);_0x10197c[_0x569d('0x44')]=qs[_0x569d('0x3c')](_['pick'](_0x557f47[_0x569d('0x3a')],_0x1d6646[_0x569d('0x3c')]),_0x35bb32);var _0x4cad5a=[];var _0x277054=squel[_0x569d('0x45')]()[_0x569d('0x46')]('id')[_0x569d('0x46')](_0x569d('0x2b'))[_0x569d('0x46')]('color')[_0x569d('0x47')](_0x569d('0x48'));var _0x1bd140=squel['select']()['field'](_0x569d('0x49'))['field'](_0x569d('0x4a'))[_0x569d('0x46')](_0x569d('0x4b'))[_0x569d('0x47')](_0x569d('0x4c'),'ui')[_0x569d('0x4d')](_0x569d('0x4e'),'u',_0x569d('0x4f'));var _0x483b31=squel[_0x569d('0x45')]()['from'](_0x569d('0x50'),'i')[_0x569d('0x4d')](_0x569d('0x51'),'c',_0x569d('0x52'))[_0x569d('0x4d')](_0x569d('0x4e'),'o',_0x569d('0x53'))[_0x569d('0x4d')](_0x569d('0x54'),'a',_0x569d('0x55'))[_0x569d('0x4d')](_0x569d('0x56'),'me',_0x569d('0x57'))[_0x569d('0x4d')]('openchannel_interaction_has_tags','it',_0x569d('0x58'))['left_join'](_0x569d('0x48'),'t',_0x569d('0x59'));var _0x52faf4=squel[_0x569d('0x5a')]();var _0x1e2aca=[];var _0x367264=squel['expr']();var _0x9f34c8;if(_0x557f47['query'][_0x569d('0x5b')]){_0x9f34c8=as[_0x569d('0x5c')](_0x557f47[_0x569d('0x3a')][_0x569d('0x5b')]);var _0x2aa361=_0x9f34c8[_0x569d('0x5d')];for(var _0x3f1319=0x0;_0x3f1319<_0x9f34c8[_0x569d('0x5e')]['length'];_0x3f1319++){var _0x2278f4=_0x9f34c8[_0x569d('0x5e')][_0x3f1319];var _0x5ebd5e='i';var _0xe2e427=_['find'](_0x35bb32,[_0x569d('0x2b'),_0x2278f4['field']]);if(!_0xe2e427){switch(_0x2278f4[_0x569d('0x46')]){case'unreadMessages':if(_0x2278f4[_0x569d('0x5f')]==0x1){_0x483b31[_0x569d('0x60')]('`'+_0x2278f4[_0x569d('0x46')]+'`\x20=\x200');}else{_0x483b31[_0x569d('0x60')]('`'+_0x2278f4[_0x569d('0x46')]+_0x569d('0x61'));}break;case'Contact':if(_0x2278f4[_0x569d('0x62')]==='$substring'){if(_0x2278f4[_0x569d('0x5f')]['split']('\x20')[_0x569d('0x40')]>0x1){_0x52faf4[_0x2aa361]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x569d('0x63')](_0x2278f4['value']),null);}else{var _0x386cfb='%'+_0x2278f4[_0x569d('0x5f')]+'%';_0x52faf4[_0x2aa361](_0x569d('0x64'),_0x386cfb,_0x386cfb,_0x386cfb);}}else{_0xe2e427=_[_0x569d('0x65')](_0x35bb32,['name',_0x569d('0x66')]);_0x2278f4[_0x569d('0x46')]=_0x569d('0x66');_0x23022c=as[_0x569d('0x67')](_0x5ebd5e,_0xe2e427['type'],_0x2278f4);_0x52faf4[_0x2aa361](_0x23022c['text'],_0x23022c[_0x569d('0x5f')][_0x569d('0x68')],_0x23022c[_0x569d('0x5f')]['end']);}break;case'Tag':var _0x1789b0=_0x2278f4[_0x569d('0x5f')][_0x569d('0x32')](',')[_0x569d('0x2e')](function(_0x31187b){return Number(_0x31187b);});_0x1789b0[_0x569d('0x33')](function(_0x428fe1){_0x367264['or'](_0x569d('0x69'),'%,'+_0x428fe1+',%');});_0x1e2aca=_[_0x569d('0x6a')](_0x1e2aca,_0x1789b0);break;case _0x569d('0x6b'):if(_0x2278f4['operator']==='$substring'){_0x52faf4[_0x2aa361](_0x569d('0x6c'),'%'+_0x2278f4['value']+'%',null);}else{_0xe2e427=_[_0x569d('0x65')](_0x35bb32,['name','UserId']);_0x2278f4[_0x569d('0x46')]='UserId';_0x23022c=as[_0x569d('0x67')](_0x5ebd5e,_0xe2e427['type'],_0x2278f4);_0x52faf4[_0x2aa361](_0x23022c[_0x569d('0x6d')],_0x23022c['value'][_0x569d('0x68')],_0x23022c['value'][_0x569d('0x1f')]);}break;case _0x569d('0x6e'):_0x23022c=as[_0x569d('0x67')]('me',null,_0x2278f4);_0x52faf4[_0x2aa361](_0x23022c[_0x569d('0x6d')],_0x23022c['value']['start'],_0x23022c[_0x569d('0x5f')]['end']);break;}}else{var _0x23022c=as[_0x569d('0x67')](_0x5ebd5e,_0xe2e427[_0x569d('0x37')],_0x2278f4);_0x52faf4[_0x2aa361](_0x23022c[_0x569d('0x6d')],_0x23022c[_0x569d('0x5f')][_0x569d('0x68')],_0x23022c[_0x569d('0x5f')][_0x569d('0x1f')]);}}}else{var _0x5f44fa=_(_0x557f47[_0x569d('0x3a')])[_0x569d('0x3b')]()[_0x569d('0x2e')](function(_0x129ca4){return _[_0x569d('0x6f')](_0x35bb32,[_0x569d('0x2b'),_0x129ca4])?_0x129ca4:undefined;})[_0x569d('0x70')]()[_0x569d('0x5f')]();if(!_['isEmpty'](_0x5f44fa)){_0x5f44fa['forEach'](function(_0x60a96b){if(_0x60a96b==='OpenchannelAccountId'){_0x483b31[_0x569d('0x44')](_0x569d('0x71'),[][_0x569d('0x72')](_0x557f47['query'][_0x60a96b]));}else if(_0x60a96b===_0x569d('0x73')){var _0x4f2cf5=JSON[_0x569d('0x74')](_0x557f47['query'][_0x60a96b])['$gte'];var _0x1ca14f=JSON[_0x569d('0x74')](_0x557f47['query'][_0x60a96b])['$lte'];_0x483b31[_0x569d('0x44')](_0x569d('0x75'),_0x4f2cf5,_0x1ca14f);}else{if(_0x557f47[_0x569d('0x3a')][_0x60a96b]==='null'){_0x483b31[_0x569d('0x44')]('i.'+_0x60a96b+'\x20IS\x20NULL');}else{_0x483b31[_0x569d('0x44')]('i.'+_0x60a96b+_0x569d('0x76'),_0x557f47[_0x569d('0x3a')][_0x60a96b]);}}});}if(_0x557f47[_0x569d('0x3a')]['read']){if(_0x557f47['query'][_0x569d('0x77')]==0x1){_0x483b31[_0x569d('0x60')](_0x569d('0x78'));}else{_0x483b31[_0x569d('0x60')](_0x569d('0x79'));}}if(_0x557f47[_0x569d('0x3a')][_0x569d('0x7a')]){_0x1e2aca=_[_0x569d('0x7b')](_0x557f47[_0x569d('0x3a')][_0x569d('0x7a')])?_0x557f47[_0x569d('0x3a')]['tag']:new Array(_0x557f47['query'][_0x569d('0x7a')]);_0x1e2aca[_0x569d('0x33')](function(_0x6f4cbd){_0x367264['or'](_0x569d('0x69'),'%,'+_0x6f4cbd+',%');});}if(_0x557f47[_0x569d('0x3a')][_0x569d('0x7c')]){var _0x121b38=_0x557f47[_0x569d('0x3a')]['filter'][_0x569d('0x7d')]('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0x569d('0x7e')](_0x121b38)){_0x52faf4['or'](_0x569d('0x7f'),_0x121b38+'%');}else{_0x52faf4['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x569d('0x63')](_0x121b38))['or'](_0x569d('0x80'),_0x121b38+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x121b38+'%');}}}_0x483b31[_0x569d('0x44')](_0x52faf4);_0x483b31[_0x569d('0x81')](_0x569d('0x82'));var _0x4650bc={'type':db[_0x569d('0x83')][_0x569d('0x84')][_0x569d('0x85')],'raw':!![]};var _0x6763e0=_0x483b31[_0x569d('0x86')]();_0x6763e0[_0x569d('0x46')]('i.id');_0x6763e0[_0x569d('0x46')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x569d('0x87'));if(_0x10197c[_0x569d('0x42')]){_0x10197c['order'][_0x569d('0x33')](function(_0x1de414){_0x483b31['order']('i.'+_0x1de414[0x0],_0x1de414[0x1]===_0x569d('0x88')?![]:!![]);});}if(!_[_0x569d('0x89')](_0x1e2aca)){_0x483b31['having'](_0x367264);_0x6763e0['where'](_0x569d('0x8a'),_0x1e2aca);}BPromise[_0x569d('0x8b')]()[_0x569d('0x29')](function(){if(!_0x9f34c8){if(_0x557f47['query'][_0x569d('0x8c')]||_0x557f47['query'][_0x569d('0x8d')])return;_0x6763e0[_0x569d('0x44')](_0x569d('0x8e'));_0x483b31[_0x569d('0x44')](_0x569d('0x8e'));return;}return _0x557f47[_0x569d('0x8f')][_0x569d('0x90')]({'attributes':['id'],'raw':!![]})[_0x569d('0x29')](function(_0x4004e7){if(_[_0x569d('0x89')](_0x4004e7)){_0x6763e0[_0x569d('0x44')](_0x569d('0x91'));_0x483b31['where'](_0x569d('0x91'));}else{_0x6763e0[_0x569d('0x44')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x569d('0x2e')](_0x4004e7,'id'));_0x483b31['where'](_0x569d('0x71'),_[_0x569d('0x2e')](_0x4004e7,'id'));}});})[_0x569d('0x29')](function(){db[_0x569d('0x92')][_0x569d('0x3a')](_0x6763e0[_0x569d('0x93')](),_0x4650bc)[_0x569d('0x29')](function(_0x48db5f){_0xea8f66[_0x569d('0x94')]=_0x48db5f[_0x569d('0x40')];if(_0xea8f66[_0x569d('0x94')]===0x0)return[];return db[_0x569d('0x92')][_0x569d('0x3a')](_0x277054['toString'](),_0x4650bc)[_0x569d('0x29')](function(_0x21f8d8){_0x4cad5a=_['keyBy'](_0x21f8d8,'id');_0x4650bc=_['merge'](_0x4650bc,{'model':db[_0x569d('0x95')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x557f47[_0x569d('0x3a')][_0x569d('0x3f')]){_0x10197c[_0x569d('0x3e')][_0x569d('0x33')](function(_0x3e4955){_0x483b31['field']('i.'+_0x3e4955);});}else{_0x483b31[_0x569d('0x46')](_0x569d('0x96'),_0x569d('0x87'));_0x483b31[_0x569d('0x46')](_0x569d('0x97'),'Account.key');_0x483b31[_0x569d('0x46')](_0x569d('0x98'),_0x569d('0x99'));_0x483b31[_0x569d('0x46')]('i.*');_0x483b31[_0x569d('0x46')]('c.firstName',_0x569d('0x9a'));_0x483b31[_0x569d('0x46')](_0x569d('0x9b'),_0x569d('0x9c'));_0x483b31['field'](_0x569d('0x9d'),'Contact.email');_0x483b31[_0x569d('0x46')](_0x569d('0x9e'),'Contact.phone');_0x483b31[_0x569d('0x46')]('c.mobile',_0x569d('0x9f'));_0x483b31[_0x569d('0x46')](_0x569d('0xa0'),_0x569d('0xa1'));_0x483b31[_0x569d('0x46')]('o.fullname',_0x569d('0xa2'));_0x483b31[_0x569d('0x46')](_0x569d('0xa3'),_0x569d('0xa4'));_0x483b31[_0x569d('0x46')](_0x569d('0xa5'),_0x569d('0x30'));}if(_0x10197c[_0x569d('0x22')])_0x483b31[_0x569d('0x22')](_0x10197c[_0x569d('0x22')]);if(_0x10197c[_0x569d('0x21')])_0x483b31[_0x569d('0x21')](_0x10197c[_0x569d('0x21')]);return db[_0x569d('0x92')]['query'](_0x483b31[_0x569d('0x93')](),_0x4650bc);})['then'](function(_0xae4369){_0x1bd140['where'](_0x569d('0xa6'),_[_0x569d('0x2e')](_0xae4369,'id'));return db['sequelize'][_0x569d('0x3a')](_0x1bd140[_0x569d('0x93')](),_0x4650bc)[_0x569d('0x29')](function(_0x338a0f){var _0x5f34d7=_[_0x569d('0xa7')](_0x338a0f,'OpenchannelInteractionId');var _0x255612=[];_0xae4369[_0x569d('0x33')](function(_0x3408ed){_0x255612[_0x569d('0x34')](updateOpenchannelInteraction(_0x3408ed,_0x4cad5a,_0x5f34d7));});return BPromise[_0x569d('0xa8')](_0x255612);});});})[_0x569d('0x29')](function(_0x1c933d){_0xea8f66[_0x569d('0xa9')]=_0x1c933d;return _0xea8f66;})[_0x569d('0x29')](respondWithFilteredResult(_0x203e31,_0x10197c));})[_0x569d('0x35')](handleError(_0x203e31,null));};exports[_0x569d('0xaa')]=function(_0x7de4ba,_0x5815c0){var _0x5e0de3={'raw':![],'where':{'id':_0x7de4ba[_0x569d('0xab')]['id']}},_0x512093={};_0x512093['model']=_[_0x569d('0x3b')](db['OpenchannelInteraction'][_0x569d('0xac')]);_0x512093['query']=_['keys'](_0x7de4ba[_0x569d('0x3a')]);_0x512093[_0x569d('0x3c')]=_[_0x569d('0x3d')](_0x512093[_0x569d('0x39')],_0x512093[_0x569d('0x3a')]);_0x5e0de3[_0x569d('0x3e')]=_[_0x569d('0x3d')](_0x512093[_0x569d('0x39')],qs[_0x569d('0x3f')](_0x7de4ba['query'][_0x569d('0x3f')]));_0x5e0de3[_0x569d('0x3e')]=_0x5e0de3['attributes'][_0x569d('0x40')]?_0x5e0de3[_0x569d('0x3e')]:_0x512093[_0x569d('0x39')];if(_0x7de4ba['query']['includeAll']){_0x5e0de3['include']=[{'all':!![]}];}_0x5e0de3=_[_0x569d('0xad')]({},_0x5e0de3,_0x7de4ba[_0x569d('0xae')]);return db[_0x569d('0x95')][_0x569d('0x65')](_0x5e0de3)['then'](handleEntityNotFound(_0x5815c0,null))[_0x569d('0x29')](respondWithResult(_0x5815c0,null))[_0x569d('0x35')](handleError(_0x5815c0,null));};exports[_0x569d('0xaf')]=function(_0x13426f,_0xc54c37){return db['OpenchannelInteraction'][_0x569d('0xaf')](_0x13426f[_0x569d('0x6e')],{})[_0x569d('0x29')](respondWithResult(_0xc54c37,0xc9))[_0x569d('0x35')](handleError(_0xc54c37,null));};exports[_0x569d('0x28')]=function(_0x5fa360,_0x22cb52){if(_0x5fa360[_0x569d('0x6e')]['id']){delete _0x5fa360['body']['id'];}return db[_0x569d('0x95')]['find']({'where':{'id':_0x5fa360['params']['id']}})[_0x569d('0x29')](handleEntityNotFound(_0x22cb52,null))['then'](saveUpdates(_0x5fa360[_0x569d('0x6e')],null))[_0x569d('0x29')](respondWithResult(_0x22cb52,null))[_0x569d('0x35')](handleError(_0x22cb52,null));};exports[_0x569d('0xb0')]=function(_0x354056,_0x2e65b4){return db[_0x569d('0x95')][_0x569d('0x65')]({'where':{'id':_0x354056[_0x569d('0xab')]['id']}})[_0x569d('0x29')](handleEntityNotFound(_0x2e65b4,null))['then'](removeEntity(_0x2e65b4,null))[_0x569d('0x35')](handleError(_0x2e65b4,null));};exports['describe']=function(_0x40400a,_0x3673fe){return db['OpenchannelInteraction']['describe']()['then'](respondWithResult(_0x3673fe,null))['catch'](handleError(_0x3673fe,null));};exports['addMessage']=function(_0x28d688,_0x65e9c4,_0x229fee){return db[_0x569d('0xb1')][_0x569d('0x65')]({'where':{'id':_0x28d688[_0x569d('0xab')]['id']}})['then'](handleEntityNotFound(_0x65e9c4,null))['then'](function(_0x114d6f){if(_0x114d6f){return _0x114d6f[_0x569d('0xb2')](_0x28d688[_0x569d('0x6e')]['ids'],_[_0x569d('0xb3')](_0x28d688[_0x569d('0x6e')],[_0x569d('0xb4'),'id'])||{});}})['then'](respondWithResult(_0x65e9c4,null))[_0x569d('0x35')](handleError(_0x65e9c4,null));};exports[_0x569d('0xb5')]=function(_0x5cffd9,_0x3188e5,_0x20172e){var _0x26055a={'raw':![],'where':{}};var _0x1eb906={};var _0x4a5d9e={'count':0x0,'rows':[]};return db[_0x569d('0x95')][_0x569d('0xb6')]({'where':{'id':_0x5cffd9[_0x569d('0xab')]['id']}})[_0x569d('0x29')](handleEntityNotFound(_0x3188e5,null))[_0x569d('0x29')](function(_0x4d9800){if(_0x4d9800){_0x1eb906[_0x569d('0x39')]=_[_0x569d('0x3b')](db['OpenchannelMessage'][_0x569d('0xac')]);_0x1eb906[_0x569d('0x3a')]=_[_0x569d('0x3b')](_0x5cffd9[_0x569d('0x3a')]);_0x1eb906['filters']=_['intersection'](_0x1eb906[_0x569d('0x39')],_0x1eb906[_0x569d('0x3a')]);_0x26055a[_0x569d('0x3e')]=_[_0x569d('0x3d')](_0x1eb906[_0x569d('0x39')],qs[_0x569d('0x3f')](_0x5cffd9[_0x569d('0x3a')][_0x569d('0x3f')]));_0x26055a[_0x569d('0x3e')]=_0x26055a[_0x569d('0x3e')]['length']?_0x26055a[_0x569d('0x3e')]:_0x1eb906[_0x569d('0x39')];if(!_0x5cffd9[_0x569d('0x3a')]['hasOwnProperty'](_0x569d('0xb7'))){_0x26055a[_0x569d('0x22')]=qs[_0x569d('0x22')](_0x5cffd9[_0x569d('0x3a')][_0x569d('0x22')]);_0x26055a['offset']=qs['offset'](_0x5cffd9['query'][_0x569d('0x21')]);}_0x26055a[_0x569d('0x42')]=qs[_0x569d('0x43')](_0x5cffd9[_0x569d('0x3a')][_0x569d('0x43')]);_0x26055a[_0x569d('0x44')]=qs[_0x569d('0x3c')](_[_0x569d('0xb8')](_0x5cffd9[_0x569d('0x3a')],_0x1eb906['filters']));_0x26055a[_0x569d('0x44')][_0x569d('0xb9')]=_0x4d9800['id'];if(_0x5cffd9[_0x569d('0x3a')][_0x569d('0x7c')]){_0x26055a['where']=_[_0x569d('0xad')](_0x26055a['where'],{'$or':_['map'](_0x26055a[_0x569d('0x3e')],function(_0x14e3ab){var _0x4c0242={};_0x4c0242[_0x14e3ab]={'$like':'%'+_0x5cffd9[_0x569d('0x3a')][_0x569d('0x7c')]+'%'};return _0x4c0242;})});}if(_0x5cffd9[_0x569d('0x3a')][_0x569d('0xba')]){var _0xe1a5ad=_0x5cffd9[_0x569d('0x3a')][_0x569d('0xba')][_0x569d('0x32')](',');var _0x48777d={};_0x48777d[_0xe1a5ad[0x0]]={'$gte':moment(_0xe1a5ad[0x1])['format'](_0x569d('0xbb'))};_0x26055a['where']=_[_0x569d('0xad')](_0x26055a[_0x569d('0x44')],_0x48777d);}_0x26055a=_['merge']({},_0x26055a,_0x5cffd9[_0x569d('0xae')]);return db[_0x569d('0xb1')]['count']({'where':_0x26055a['where']})['then'](function(_0x29363d){_0x4a5d9e['count']=_0x29363d;if(_0x5cffd9[_0x569d('0x3a')]['includeAll']){_0x26055a[_0x569d('0xbc')]=[{'all':!![]}];}return db[_0x569d('0xb1')]['findAll'](_0x26055a);})[_0x569d('0x29')](function(_0x3f5baf){_0x4a5d9e['rows']=_0x3f5baf;return _0x4a5d9e;});}})[_0x569d('0x29')](respondWithFilteredResult(_0x3188e5,_0x26055a))['catch'](handleError(_0x3188e5,null));};exports[_0x569d('0xbd')]=function(_0x326b23,_0x493433,_0x1dca2b){return db[_0x569d('0x95')][_0x569d('0x65')]({'where':{'id':_0x326b23[_0x569d('0xab')]['id']}})[_0x569d('0x29')](handleEntityNotFound(_0x493433,null))['then'](function(_0x4ad82e){if(_0x4ad82e){return _0x4ad82e[_0x569d('0xbe')](_0x326b23[_0x569d('0x6e')]['ids'],_[_0x569d('0xb3')](_0x326b23[_0x569d('0x6e')],[_0x569d('0xb4'),'id'])||{})[_0x569d('0xbf')](function(){return db[_0x569d('0xc0')][_0x569d('0xc1')]({'attributes':['id',_0x569d('0x2b'),_0x569d('0xc2')],'where':{'id':_0x326b23[_0x569d('0x6e')][_0x569d('0xb4')]}});})['then'](function(_0x30a7ce){socket[_0x569d('0xc3')](_0x569d('0xc4'),{'id':Number(_0x326b23[_0x569d('0xab')]['id']),'tags':_0x30a7ce||[]});return{'id':Number(_0x326b23[_0x569d('0xab')]['id']),'tags':_0x30a7ce||[]};});}})[_0x569d('0x29')](respondWithResult(_0x493433,null))[_0x569d('0x35')](handleError(_0x493433,null));};exports['removeTags']=function(_0x1dd5f7,_0x856d38,_0x41fa4c){return db[_0x569d('0x95')][_0x569d('0x65')]({'where':{'id':_0x1dd5f7['params']['id']}})['then'](handleEntityNotFound(_0x856d38,null))[_0x569d('0x29')](function(_0x32815e){if(_0x32815e){return _0x32815e[_0x569d('0xc5')](_0x1dd5f7[_0x569d('0x3a')]['ids']);}})[_0x569d('0x29')](respondWithStatusCode(_0x856d38,null))[_0x569d('0x35')](handleError(_0x856d38,null));};exports[_0x569d('0xc6')]=function(_0x4aa865,_0x20383c){var _0x3e15b5=moment()[_0x569d('0xc7')]()[_0x569d('0x93')]();var _0x3e57b9=path[_0x569d('0xc8')](config['root'],_0x569d('0xc9'),_0x569d('0xca'),_0x569d('0xcb'));var _0x4e6e9f=path[_0x569d('0xc8')](config[_0x569d('0xcc')],_0x569d('0xc9'),_0x569d('0xca'),'attachments');var _0x51e421=path[_0x569d('0xc8')](_0x3e57b9,_0x3e15b5);var _0x565032=util[_0x569d('0xcd')]('transcript-%d-%s.zip',_0x4aa865['params']['id'],_0x3e15b5);var _0x54fe3a=path[_0x569d('0xc8')](_0x3e57b9,_0x565032);var _0x58b49e=[];_0x58b49e[_0x569d('0x34')]({'model':db[_0x569d('0x6b')],'as':'User','attributes':['id',_0x569d('0x2f')],'raw':!![]});_0x58b49e['push']({'model':db[_0x569d('0xce')],'as':_0x569d('0xcf'),'attributes':['id',_0x569d('0xd0'),_0x569d('0xd1')],'raw':!![]});if(_0x4aa865[_0x569d('0x3a')]['attachments']){_0x58b49e[_0x569d('0x34')]({'model':db[_0x569d('0xd2')],'as':_0x569d('0xd2'),'raw':!![]});}var _0x5cccfc=[{'model':db[_0x569d('0xb1')],'as':'Messages','attributes':['id',_0x569d('0x6e'),'createdAt',_0x569d('0xd3'),'secret',_0x569d('0x77')],'include':_0x58b49e}];_0x5cccfc['push']({'model':db[_0x569d('0xd4')],'as':'Account','attributes':['id',_0x569d('0x2b')]});_0x5cccfc['push']({'model':db[_0x569d('0x6b')],'as':_0x569d('0xd5'),'attributes':['id','fullname']});return db['OpenchannelInteraction'][_0x569d('0x65')]({'where':{'id':_0x4aa865['params']['id']},'include':_0x5cccfc})['then'](handleEntityNotFound(_0x20383c,null))[_0x569d('0x29')](function(_0xa558ec){if(_0xa558ec){var _0x514672=_0xa558ec[_0x569d('0xd6')]({'plain':!![]});fs['mkdirSync'](_0x51e421);var _0x3d99a4={'format':'A4','border':_0x569d('0xd7'),'header':{'height':_0x569d('0xd8'),'contents':{'first':_0x569d('0xd9')}},'footer':{'height':_0x569d('0xda'),'contents':{'default':util[_0x569d('0xcd')](_0x569d('0xdb'),util[_0x569d('0xcd')]('%s\x20#%d',_0x569d('0xdc'),_0x514672['id']),moment()[_0x569d('0xcd')](_0x569d('0xdd'))[_0x569d('0x93')]())}}};var _0x9528c7={'channel':_0x569d('0xdc'),'account':_0x514672['Account'][_0x569d('0x2b')],'agent':_0x514672[_0x569d('0xd5')]?_0x514672[_0x569d('0xd5')][_0x569d('0x2f')]:_0x569d('0xde'),'createdAt':moment(_0x514672[_0x569d('0x73')])[_0x569d('0xcd')](_0x569d('0xbb'))[_0x569d('0x93')](),'closedAt':_0x514672[_0x569d('0xdf')]?moment(_0x514672['closedAt'])['format'](_0x569d('0xbb'))[_0x569d('0x93')]():'','disposition':_0x514672[_0x569d('0xe0')],'visibility':_0x514672[_0x569d('0xe1')]?_0x569d('0xe2'):'Private','messages':_(_0x514672[_0x569d('0xe3')])[_0x569d('0x7c')]({'secret':![]})['map'](function(_0x468bcf){if(_0x468bcf[_0x569d('0xd2')]){var _0x4307bd=path[_0x569d('0xc8')](_0x4e6e9f,_0x468bcf[_0x569d('0xd2')][_0x569d('0xe4')]);if(fs[_0x569d('0xe5')](_0x4307bd)){fs[_0x569d('0xe6')](_0x4307bd)[_0x569d('0xe7')](fs[_0x569d('0xe8')](path['join'](_0x51e421,_0x468bcf[_0x569d('0xd2')][_0x569d('0xe4')])));}}return{'date':moment(_0x468bcf[_0x569d('0x73')])[_0x569d('0xcd')](_0x569d('0xbb'))['toString'](),'sender':_0x468bcf['direction']===_0x569d('0xe9')?_0x468bcf[_0x569d('0x6b')]?_0x468bcf[_0x569d('0x6b')]['fullname']:'System':_0x468bcf[_0x569d('0xcf')][_0x569d('0xd0')]+(_0x468bcf[_0x569d('0xcf')][_0x569d('0xd1')]?'\x20'+_0x468bcf['Contact']['lastName']:''),'body':_0x468bcf[_0x569d('0xd2')]?_0x468bcf[_0x569d('0xd2')][_0x569d('0xe4')]:_0x468bcf[_0x569d('0x6e')],'direction':_0x468bcf['direction']===_0x569d('0xe9')?'A':'C','secret':_0x468bcf[_0x569d('0xea')],'read':_0x468bcf['read'],'attachment':_0x468bcf[_0x569d('0xd2')]};})[_0x569d('0x5f')]()};return ejs[_0x569d('0xeb')](path[_0x569d('0xc8')](config['root'],_0x569d('0xc9'),'views',_0x569d('0xec')),{'interaction':_0x9528c7})['then'](function(_0x5ccf47){return new BPromise(function(_0x464adf,_0x2cc403){pdf[_0x569d('0xaf')](_0x5ccf47,_0x3d99a4)[_0x569d('0xed')](path['join'](_0x51e421,_0x569d('0xee')+_0x514672['id']+'-'+_0x3e15b5+_0x569d('0xef')),function(_0x2a9e22,_0x24c7fe){if(_0x2a9e22)return _0x2cc403(_0x2a9e22);_0x464adf(_0x24c7fe);});});})[_0x569d('0x29')](function(){return new BPromise(function(_0x37d46d,_0x15fc4d){zipdir(_0x51e421,{'saveTo':_0x54fe3a},function(_0x1093a3,_0x139f59){if(_0x1093a3)return _0x15fc4d(_0x1093a3);return _0x37d46d(_0x139f59);});})[_0x569d('0x29')](function(){return new BPromise(function(_0x329b49,_0xabfe17){rimraf(_0x51e421,function(_0x5978cb){if(_0x5978cb)_0xabfe17(_0x5978cb);return _0x329b49();});});})['then'](function(){return _0x20383c[_0x569d('0xc6')](_0x54fe3a,_0x565032,function(_0x30831a){if(_0x30831a){console['log']('err',_0x30831a);}else{fs[_0x569d('0xf0')](_0x54fe3a);}});});});}else{return _0x20383c['sendStatus'](0xc8);}})[_0x569d('0x35')](handleError(_0x20383c,null));}; \ No newline at end of file +var _0xc6ab=['openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','`\x20>\x200','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId','some','compact','isEmpty','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','OpenchannelInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','groupBy','OpenchannelInteractionId','all','rows','show','includeAll','include','options','create','body','params','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','openchannelInteractionTags:save','removeTags','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','fullname','CmContact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','get','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','Owner','N.A.','closed','disposition','Public','Private','basename','existsSync','pipe','createWriteStream','Contact','renderFile','views','downloadInteraction.html','toFile','transcript-','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','./openchannelInteraction.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','name','send','Users','Tags','TagIds','forEach','push','catch','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id'];(function(_0x50d497,_0x34efff){var _0x2168f5=function(_0x26e2cc){while(--_0x26e2cc){_0x50d497['push'](_0x50d497['shift']());}};_0x2168f5(++_0x34efff);}(_0xc6ab,0x96));var _0xbc6a=function(_0x53c823,_0x204136){_0x53c823=_0x53c823-0x0;var _0x351414=_0xc6ab[_0x53c823];return _0x351414;};'use strict';var pdf=require(_0xbc6a('0x0'));var emlformat=require(_0xbc6a('0x1'));var rimraf=require(_0xbc6a('0x2'));var zipdir=require(_0xbc6a('0x3'));var jsonpatch=require(_0xbc6a('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbc6a('0x5'));var Mustache=require(_0xbc6a('0x6'));var util=require(_0xbc6a('0x7'));var path=require(_0xbc6a('0x8'));var sox=require(_0xbc6a('0x9'));var csv=require('to-csv');var ejs=require(_0xbc6a('0xa'));var fs=require('fs');var _=require(_0xbc6a('0xb'));var squel=require(_0xbc6a('0xc'));var crypto=require(_0xbc6a('0xd'));var jsforce=require(_0xbc6a('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbc6a('0xf'));var Papa=require(_0xbc6a('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbc6a('0x11'));var as=require(_0xbc6a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc6a('0x13'))(_0xbc6a('0x14'));var utils=require(_0xbc6a('0x15'));var config=require('../../config/environment');var db=require(_0xbc6a('0x16'))['db'];config[_0xbc6a('0x17')]=_[_0xbc6a('0x18')](config[_0xbc6a('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xbc6a('0x19'))[_0xbc6a('0x1a')](socket);function respondWithStatusCode(_0x48d94a,_0x353a92){_0x353a92=_0x353a92||0xcc;return function(_0x517377){if(_0x517377){return _0x48d94a[_0xbc6a('0x1b')](_0x353a92);}return _0x48d94a['status'](_0x353a92)[_0xbc6a('0x1c')]();};}function respondWithResult(_0x446062,_0xdf0869){_0xdf0869=_0xdf0869||0xc8;return function(_0x3de8f5){if(_0x3de8f5){return _0x446062[_0xbc6a('0x1d')](_0xdf0869)[_0xbc6a('0x1e')](_0x3de8f5);}};}function respondWithFilteredResult(_0x3c9fd3,_0x55134c){return function(_0x5df571){if(_0x5df571){var _0x143f03=_0x5df571[_0xbc6a('0x1f')],_0x2e8b88=_0x55134c[_0xbc6a('0x20')],_0x369a78=_0x55134c[_0xbc6a('0x20')]+_0x55134c[_0xbc6a('0x21')],_0x1730af;if(_0x369a78>=_0x143f03){_0x369a78=_0x143f03;_0x1730af=0xc8;}else{_0x1730af=0xce;}_0x3c9fd3[_0xbc6a('0x1d')](_0x1730af);return _0x3c9fd3[_0xbc6a('0x22')](_0xbc6a('0x23'),_0x2e8b88+'-'+_0x369a78+'/'+_0x143f03)[_0xbc6a('0x1e')](_0x5df571);}return null;};}function patchUpdates(_0x72a13c){return function(_0x5c8ff2){try{jsonpatch[_0xbc6a('0x24')](_0x5c8ff2,_0x72a13c,!![]);}catch(_0x492bfe){return BPromise['reject'](_0x492bfe);}return _0x5c8ff2[_0xbc6a('0x25')]();};}function saveUpdates(_0x5c7c1e,_0x2dc407){return function(_0x4b108d){if(_0x4b108d){return _0x4b108d[_0xbc6a('0x26')](_0x5c7c1e)['then'](function(_0xeaa12d){return _0xeaa12d;});}return null;};}function removeEntity(_0x1f0144,_0x23f6e8){return function(_0x17daf3){if(_0x17daf3){return _0x17daf3[_0xbc6a('0x27')]()[_0xbc6a('0x28')](function(){_0x1f0144[_0xbc6a('0x1d')](0xcc)[_0xbc6a('0x1c')]();});}};}function handleEntityNotFound(_0x3b52ac,_0x2006c5){return function(_0x4c7722){if(!_0x4c7722){_0x3b52ac[_0xbc6a('0x1b')](0x194);}return _0x4c7722;};}function handleError(_0x433376,_0x25c90b){_0x25c90b=_0x25c90b||0x1f4;return function(_0x10d725){logger[_0xbc6a('0x29')](_0x10d725['stack']);if(_0x10d725[_0xbc6a('0x2a')]){delete _0x10d725[_0xbc6a('0x2a')];}_0x433376[_0xbc6a('0x1d')](_0x25c90b)[_0xbc6a('0x2b')](_0x10d725);};}function getInteractionUsers(_0x4356c1,_0x431117){return new BPromise(function(_0x7902e8,_0x17e452){try{if(_0x431117[_0x4356c1['id']]){_0x4356c1[_0xbc6a('0x2c')]=_['map'](_0x431117[_0x4356c1['id']],function(_0x11e841){return{'id':_0x11e841['id'],'fullname':_0x11e841['fullname']};});}}catch(_0x491480){_0x17e452(_0x491480);}_0x7902e8(_0x4356c1);});}function getInteractionTags(_0x5701a8,_0x4e0079){return new BPromise(function(_0x50e809,_0x54ad91){try{if(_0x5701a8['TagIds']){_0x5701a8[_0xbc6a('0x2d')]=[];_0x5701a8[_0xbc6a('0x2e')]['split'](',')[_0xbc6a('0x2f')](function(_0x2e8a55){_0x5701a8[_0xbc6a('0x2d')][_0xbc6a('0x30')](_0x4e0079[_0x2e8a55]);});}delete _0x5701a8[_0xbc6a('0x2e')];}catch(_0x2507a4){_0x54ad91(_0x2507a4);}_0x50e809(_0x5701a8);});}function updateOpenchannelInteraction(_0x2caef9,_0x82f720,_0xe6accf){return new BPromise(function(_0x254ad5,_0x2a3342){return getInteractionUsers(_0x2caef9,_0xe6accf)[_0xbc6a('0x28')](function(_0x316ff3){return getInteractionTags(_0x316ff3,_0x82f720);})[_0xbc6a('0x28')](function(_0x2e4e3e){_0x254ad5(_0x2e4e3e);})[_0xbc6a('0x31')](function(_0x1de815){_0x2a3342(_0x1de815);});});}exports[_0xbc6a('0x32')]=function(_0x5e031a,_0x23e149){var _0x519ed4={},_0x531eb1={},_0x12cf31={'count':0x0,'rows':[]};var _0x197581=_['map'](db['OpenchannelInteraction'][_0xbc6a('0x33')],function(_0x2c314b){return{'name':_0x2c314b[_0xbc6a('0x34')],'type':_0x2c314b[_0xbc6a('0x35')][_0xbc6a('0x36')]};});_0x531eb1[_0xbc6a('0x37')]=_[_0xbc6a('0x38')](_0x197581,_0xbc6a('0x2a'));_0x531eb1[_0xbc6a('0x39')]=_[_0xbc6a('0x3a')](_0x5e031a[_0xbc6a('0x39')]);_0x531eb1['filters']=_[_0xbc6a('0x3b')](_0x531eb1[_0xbc6a('0x37')],_0x531eb1[_0xbc6a('0x39')]);_0x519ed4[_0xbc6a('0x3c')]=_[_0xbc6a('0x3b')](_0x531eb1[_0xbc6a('0x37')],qs['fields'](_0x5e031a[_0xbc6a('0x39')][_0xbc6a('0x3d')]));_0x519ed4['attributes']=_0x519ed4[_0xbc6a('0x3c')][_0xbc6a('0x3e')]?_0x519ed4[_0xbc6a('0x3c')]:_0x531eb1[_0xbc6a('0x37')];if(!_0x5e031a[_0xbc6a('0x39')][_0xbc6a('0x3f')](_0xbc6a('0x40'))){_0x519ed4['limit']=qs['limit'](_0x5e031a['query']['limit']);_0x519ed4[_0xbc6a('0x20')]=qs[_0xbc6a('0x20')](_0x5e031a[_0xbc6a('0x39')]['offset']);}_0x519ed4[_0xbc6a('0x41')]=qs[_0xbc6a('0x42')](_0x5e031a['query'][_0xbc6a('0x42')]);_0x519ed4['where']=qs[_0xbc6a('0x43')](_[_0xbc6a('0x44')](_0x5e031a[_0xbc6a('0x39')],_0x531eb1[_0xbc6a('0x43')]),_0x197581);var _0x274073=[];var _0x574680=squel[_0xbc6a('0x45')]()['field']('id')[_0xbc6a('0x46')](_0xbc6a('0x2a'))[_0xbc6a('0x46')](_0xbc6a('0x47'))[_0xbc6a('0x48')](_0xbc6a('0x49'));var _0x2400c7=squel[_0xbc6a('0x45')]()[_0xbc6a('0x46')](_0xbc6a('0x4a'))[_0xbc6a('0x46')](_0xbc6a('0x4b'))['field'](_0xbc6a('0x4c'))[_0xbc6a('0x48')]('user_has_openchannel_interactions','ui')[_0xbc6a('0x4d')](_0xbc6a('0x4e'),'u',_0xbc6a('0x4f'));var _0x5c0dbd=squel['select']()[_0xbc6a('0x48')](_0xbc6a('0x50'),'i')[_0xbc6a('0x4d')](_0xbc6a('0x51'),'c',_0xbc6a('0x52'))[_0xbc6a('0x4d')](_0xbc6a('0x4e'),'o','o.id\x20=\x20i.UserId')[_0xbc6a('0x4d')](_0xbc6a('0x53'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xbc6a('0x4d')](_0xbc6a('0x54'),'me',_0xbc6a('0x55'))[_0xbc6a('0x4d')](_0xbc6a('0x56'),'it','it.OpenchannelInteractionId\x20=\x20i.id')['left_join']('tools_tags','t',_0xbc6a('0x57'));var _0x5dea12=squel[_0xbc6a('0x58')]();var _0x214d80=[];var _0x5b55c8=squel[_0xbc6a('0x58')]();var _0x12f20b;if(_0x5e031a[_0xbc6a('0x39')][_0xbc6a('0x59')]){_0x12f20b=as[_0xbc6a('0x5a')](_0x5e031a[_0xbc6a('0x39')]['search']);var _0x435be6=_0x12f20b[_0xbc6a('0x5b')];for(var _0x264310=0x0;_0x264310<_0x12f20b[_0xbc6a('0x5c')][_0xbc6a('0x3e')];_0x264310++){var _0x496277=_0x12f20b[_0xbc6a('0x5c')][_0x264310];var _0x2e5a76='i';var _0x3d9438=_['find'](_0x197581,['name',_0x496277[_0xbc6a('0x46')]]);if(!_0x3d9438){switch(_0x496277[_0xbc6a('0x46')]){case _0xbc6a('0x5d'):if(_0x496277['value']==0x1){_0x5c0dbd['having']('`'+_0x496277[_0xbc6a('0x46')]+'`\x20=\x200');}else{_0x5c0dbd['having']('`'+_0x496277[_0xbc6a('0x46')]+_0xbc6a('0x5e'));}break;case'Contact':if(_0x496277['operator']===_0xbc6a('0x5f')){if(_0x496277['value'][_0xbc6a('0x60')]('\x20')[_0xbc6a('0x3e')]>0x1){_0x5dea12[_0x435be6](_0xbc6a('0x61'),qs[_0xbc6a('0x62')](_0x496277[_0xbc6a('0x63')]),null);}else{var _0x545843='%'+_0x496277[_0xbc6a('0x63')]+'%';_0x5dea12[_0x435be6]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x545843,_0x545843,_0x545843);}}else{_0x3d9438=_[_0xbc6a('0x64')](_0x197581,[_0xbc6a('0x2a'),_0xbc6a('0x65')]);_0x496277[_0xbc6a('0x46')]=_0xbc6a('0x65');_0x5e7bed=as[_0xbc6a('0x66')](_0x2e5a76,_0x3d9438[_0xbc6a('0x35')],_0x496277);_0x5dea12[_0x435be6](_0x5e7bed[_0xbc6a('0x67')],_0x5e7bed[_0xbc6a('0x63')][_0xbc6a('0x68')],_0x5e7bed[_0xbc6a('0x63')][_0xbc6a('0x1c')]);}break;case _0xbc6a('0x69'):var _0x35855b=_0x496277[_0xbc6a('0x63')][_0xbc6a('0x60')](',')[_0xbc6a('0x38')](function(_0x12bc7a){return Number(_0x12bc7a);});_0x35855b[_0xbc6a('0x2f')](function(_0x1e1615){_0x5b55c8['or'](_0xbc6a('0x6a'),'%,'+_0x1e1615+',%');});_0x214d80=_[_0xbc6a('0x6b')](_0x214d80,_0x35855b);break;case _0xbc6a('0x6c'):if(_0x496277[_0xbc6a('0x6d')]===_0xbc6a('0x5f')){_0x5dea12[_0x435be6]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x496277[_0xbc6a('0x63')]+'%',null);}else{_0x3d9438=_['find'](_0x197581,[_0xbc6a('0x2a'),_0xbc6a('0x6e')]);_0x496277[_0xbc6a('0x46')]=_0xbc6a('0x6e');_0x5e7bed=as[_0xbc6a('0x66')](_0x2e5a76,_0x3d9438[_0xbc6a('0x35')],_0x496277);_0x5dea12[_0x435be6](_0x5e7bed[_0xbc6a('0x67')],_0x5e7bed[_0xbc6a('0x63')][_0xbc6a('0x68')],_0x5e7bed[_0xbc6a('0x63')]['end']);}break;case'body':_0x5e7bed=as['buildExpression']('me',null,_0x496277);_0x5dea12[_0x435be6](_0x5e7bed[_0xbc6a('0x67')],_0x5e7bed['value'][_0xbc6a('0x68')],_0x5e7bed['value'][_0xbc6a('0x1c')]);break;}}else{var _0x5e7bed=as['buildExpression'](_0x2e5a76,_0x3d9438['type'],_0x496277);_0x5dea12[_0x435be6](_0x5e7bed[_0xbc6a('0x67')],_0x5e7bed[_0xbc6a('0x63')]['start'],_0x5e7bed[_0xbc6a('0x63')][_0xbc6a('0x1c')]);}}}else{var _0x459758=_(_0x5e031a[_0xbc6a('0x39')])['keys']()[_0xbc6a('0x38')](function(_0x3b4e76){return _[_0xbc6a('0x6f')](_0x197581,[_0xbc6a('0x2a'),_0x3b4e76])?_0x3b4e76:undefined;})[_0xbc6a('0x70')]()[_0xbc6a('0x63')]();if(!_[_0xbc6a('0x71')](_0x459758)){_0x459758[_0xbc6a('0x2f')](function(_0x3321a0){if(_0x3321a0===_0xbc6a('0x72')){_0x5c0dbd[_0xbc6a('0x73')](_0xbc6a('0x74'),[]['concat'](_0x5e031a['query'][_0x3321a0]));}else if(_0x3321a0===_0xbc6a('0x75')){var _0x5c3dd7=JSON['parse'](_0x5e031a[_0xbc6a('0x39')][_0x3321a0])['$gte'];var _0x3da196=JSON[_0xbc6a('0x76')](_0x5e031a['query'][_0x3321a0])['$lte'];_0x5c0dbd[_0xbc6a('0x73')](_0xbc6a('0x77'),_0x5c3dd7,_0x3da196);}else{if(_0x5e031a[_0xbc6a('0x39')][_0x3321a0]===_0xbc6a('0x78')){_0x5c0dbd['where']('i.'+_0x3321a0+_0xbc6a('0x79'));}else{_0x5c0dbd[_0xbc6a('0x73')]('i.'+_0x3321a0+'\x20=\x20?',_0x5e031a[_0xbc6a('0x39')][_0x3321a0]);}}});}if(_0x5e031a['query'][_0xbc6a('0x7a')]){if(_0x5e031a['query'][_0xbc6a('0x7a')]==0x1){_0x5c0dbd[_0xbc6a('0x7b')](_0xbc6a('0x7c'));}else{_0x5c0dbd[_0xbc6a('0x7b')](_0xbc6a('0x7d'));}}if(_0x5e031a[_0xbc6a('0x39')][_0xbc6a('0x7e')]){_0x214d80=_[_0xbc6a('0x7f')](_0x5e031a['query'][_0xbc6a('0x7e')])?_0x5e031a[_0xbc6a('0x39')][_0xbc6a('0x7e')]:new Array(_0x5e031a[_0xbc6a('0x39')]['tag']);_0x214d80['forEach'](function(_0x4da103){_0x5b55c8['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4da103+',%');});}if(_0x5e031a[_0xbc6a('0x39')][_0xbc6a('0x80')]){var _0x3fa2cf=_0x5e031a[_0xbc6a('0x39')][_0xbc6a('0x80')][_0xbc6a('0x81')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xbc6a('0x82'));if(qs['isNumeric'](_0x3fa2cf)){_0x5dea12['or'](_0xbc6a('0x83'),_0x3fa2cf+'%');}else{_0x5dea12['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xbc6a('0x62')](_0x3fa2cf))['or'](_0xbc6a('0x84'),_0x3fa2cf+'%')['or'](_0xbc6a('0x85'),_0x3fa2cf+'%');}}}_0x5c0dbd['where'](_0x5dea12);_0x5c0dbd[_0xbc6a('0x86')]('i.id');var _0x44364f={'type':db[_0xbc6a('0x87')][_0xbc6a('0x88')][_0xbc6a('0x89')],'raw':!![]};var _0x4f7de8=_0x5c0dbd['clone']();_0x4f7de8[_0xbc6a('0x46')](_0xbc6a('0x8a'));_0x4f7de8[_0xbc6a('0x46')](_0xbc6a('0x8b'),_0xbc6a('0x5d'));if(_0x519ed4[_0xbc6a('0x41')]){_0x519ed4[_0xbc6a('0x41')][_0xbc6a('0x2f')](function(_0x3edf69){_0x5c0dbd[_0xbc6a('0x41')]('i.'+_0x3edf69[0x0],_0x3edf69[0x1]===_0xbc6a('0x8c')?![]:!![]);});}if(!_[_0xbc6a('0x71')](_0x214d80)){_0x5c0dbd[_0xbc6a('0x7b')](_0x5b55c8);_0x4f7de8[_0xbc6a('0x73')](_0xbc6a('0x8d'),_0x214d80);}BPromise[_0xbc6a('0x8e')]()[_0xbc6a('0x28')](function(){if(!_0x12f20b){if(_0x5e031a[_0xbc6a('0x39')][_0xbc6a('0x72')]||_0x5e031a[_0xbc6a('0x39')][_0xbc6a('0x8f')])return;_0x4f7de8[_0xbc6a('0x73')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x5c0dbd[_0xbc6a('0x73')](_0xbc6a('0x90'));return;}return _0x5e031a[_0xbc6a('0x91')][_0xbc6a('0x92')]({'attributes':['id'],'raw':!![]})[_0xbc6a('0x28')](function(_0x35f063){if(_[_0xbc6a('0x71')](_0x35f063)){_0x4f7de8[_0xbc6a('0x73')](_0xbc6a('0x93'));_0x5c0dbd[_0xbc6a('0x73')](_0xbc6a('0x93'));}else{_0x4f7de8['where'](_0xbc6a('0x74'),_['map'](_0x35f063,'id'));_0x5c0dbd['where'](_0xbc6a('0x74'),_['map'](_0x35f063,'id'));}});})[_0xbc6a('0x28')](function(){db[_0xbc6a('0x94')][_0xbc6a('0x39')](_0x4f7de8['toString'](),_0x44364f)[_0xbc6a('0x28')](function(_0x32d81b){_0x12cf31[_0xbc6a('0x1f')]=_0x32d81b['length'];if(_0x12cf31[_0xbc6a('0x1f')]===0x0)return[];return db['sequelize']['query'](_0x574680[_0xbc6a('0x95')](),_0x44364f)[_0xbc6a('0x28')](function(_0x901076){_0x274073=_[_0xbc6a('0x96')](_0x901076,'id');_0x44364f=_[_0xbc6a('0x97')](_0x44364f,{'model':db[_0xbc6a('0x98')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5e031a[_0xbc6a('0x39')]['fields']){_0x519ed4[_0xbc6a('0x3c')]['forEach'](function(_0x550767){_0x5c0dbd[_0xbc6a('0x46')]('i.'+_0x550767);});}else{_0x5c0dbd['field'](_0xbc6a('0x8b'),'unreadMessages');_0x5c0dbd[_0xbc6a('0x46')](_0xbc6a('0x99'),_0xbc6a('0x9a'));_0x5c0dbd['field'](_0xbc6a('0x9b'),_0xbc6a('0x9c'));_0x5c0dbd['field'](_0xbc6a('0x9d'));_0x5c0dbd[_0xbc6a('0x46')](_0xbc6a('0x9e'),_0xbc6a('0x9f'));_0x5c0dbd[_0xbc6a('0x46')]('c.lastName',_0xbc6a('0xa0'));_0x5c0dbd['field'](_0xbc6a('0xa1'),_0xbc6a('0xa2'));_0x5c0dbd['field'](_0xbc6a('0xa3'),'Contact.phone');_0x5c0dbd['field'](_0xbc6a('0xa4'),_0xbc6a('0xa5'));_0x5c0dbd[_0xbc6a('0x46')]('c.fax',_0xbc6a('0xa6'));_0x5c0dbd[_0xbc6a('0x46')](_0xbc6a('0xa7'),'Owner.fullname');_0x5c0dbd[_0xbc6a('0x46')](_0xbc6a('0xa8'),'Owner.internal');_0x5c0dbd['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0xbc6a('0x2e'));}if(_0x519ed4['limit'])_0x5c0dbd[_0xbc6a('0x21')](_0x519ed4[_0xbc6a('0x21')]);if(_0x519ed4[_0xbc6a('0x20')])_0x5c0dbd['offset'](_0x519ed4[_0xbc6a('0x20')]);return db[_0xbc6a('0x94')][_0xbc6a('0x39')](_0x5c0dbd[_0xbc6a('0x95')](),_0x44364f);})['then'](function(_0x14333b){_0x2400c7['where']('ui.OpenchannelInteractionId\x20IN\x20?',_[_0xbc6a('0x38')](_0x14333b,'id'));return db[_0xbc6a('0x94')][_0xbc6a('0x39')](_0x2400c7[_0xbc6a('0x95')](),_0x44364f)[_0xbc6a('0x28')](function(_0xf61a6a){var _0x402f01=_[_0xbc6a('0xa9')](_0xf61a6a,_0xbc6a('0xaa'));var _0x3d253f=[];_0x14333b[_0xbc6a('0x2f')](function(_0x27ec57){_0x3d253f['push'](updateOpenchannelInteraction(_0x27ec57,_0x274073,_0x402f01));});return BPromise[_0xbc6a('0xab')](_0x3d253f);});});})[_0xbc6a('0x28')](function(_0x4813ee){_0x12cf31[_0xbc6a('0xac')]=_0x4813ee;return _0x12cf31;})[_0xbc6a('0x28')](respondWithFilteredResult(_0x23e149,_0x519ed4));})[_0xbc6a('0x31')](handleError(_0x23e149,null));};exports[_0xbc6a('0xad')]=function(_0x569220,_0x4e0fc5){var _0x261446={'raw':![],'where':{'id':_0x569220['params']['id']}},_0x5edc5b={};_0x5edc5b[_0xbc6a('0x37')]=_['keys'](db[_0xbc6a('0x98')][_0xbc6a('0x33')]);_0x5edc5b['query']=_['keys'](_0x569220['query']);_0x5edc5b[_0xbc6a('0x43')]=_['intersection'](_0x5edc5b[_0xbc6a('0x37')],_0x5edc5b[_0xbc6a('0x39')]);_0x261446['attributes']=_[_0xbc6a('0x3b')](_0x5edc5b[_0xbc6a('0x37')],qs['fields'](_0x569220[_0xbc6a('0x39')][_0xbc6a('0x3d')]));_0x261446[_0xbc6a('0x3c')]=_0x261446[_0xbc6a('0x3c')][_0xbc6a('0x3e')]?_0x261446['attributes']:_0x5edc5b[_0xbc6a('0x37')];if(_0x569220['query'][_0xbc6a('0xae')]){_0x261446[_0xbc6a('0xaf')]=[{'all':!![]}];}_0x261446=_[_0xbc6a('0x97')]({},_0x261446,_0x569220[_0xbc6a('0xb0')]);return db[_0xbc6a('0x98')][_0xbc6a('0x64')](_0x261446)[_0xbc6a('0x28')](handleEntityNotFound(_0x4e0fc5,null))[_0xbc6a('0x28')](respondWithResult(_0x4e0fc5,null))[_0xbc6a('0x31')](handleError(_0x4e0fc5,null));};exports[_0xbc6a('0xb1')]=function(_0x364286,_0x395335){return db[_0xbc6a('0x98')]['create'](_0x364286[_0xbc6a('0xb2')],{})[_0xbc6a('0x28')](respondWithResult(_0x395335,0xc9))['catch'](handleError(_0x395335,null));};exports['update']=function(_0x39dfd8,_0x426b1a){if(_0x39dfd8['body']['id']){delete _0x39dfd8[_0xbc6a('0xb2')]['id'];}return db[_0xbc6a('0x98')][_0xbc6a('0x64')]({'where':{'id':_0x39dfd8[_0xbc6a('0xb3')]['id']}})[_0xbc6a('0x28')](handleEntityNotFound(_0x426b1a,null))[_0xbc6a('0x28')](saveUpdates(_0x39dfd8['body'],null))[_0xbc6a('0x28')](respondWithResult(_0x426b1a,null))[_0xbc6a('0x31')](handleError(_0x426b1a,null));};exports[_0xbc6a('0x27')]=function(_0x4f3daa,_0xc43d47){return db['OpenchannelInteraction'][_0xbc6a('0x64')]({'where':{'id':_0x4f3daa['params']['id']}})[_0xbc6a('0x28')](handleEntityNotFound(_0xc43d47,null))[_0xbc6a('0x28')](removeEntity(_0xc43d47,null))['catch'](handleError(_0xc43d47,null));};exports[_0xbc6a('0xb4')]=function(_0x210745,_0x271098){return db[_0xbc6a('0x98')][_0xbc6a('0xb4')]()[_0xbc6a('0x28')](respondWithResult(_0x271098,null))['catch'](handleError(_0x271098,null));};exports[_0xbc6a('0xb5')]=function(_0x3c91e6,_0x2e0e53,_0x4e327c){return db[_0xbc6a('0xb6')]['find']({'where':{'id':_0x3c91e6['params']['id']}})[_0xbc6a('0x28')](handleEntityNotFound(_0x2e0e53,null))[_0xbc6a('0x28')](function(_0x36b885){if(_0x36b885){return _0x36b885[_0xbc6a('0xb5')](_0x3c91e6[_0xbc6a('0xb2')][_0xbc6a('0xb7')],_[_0xbc6a('0xb8')](_0x3c91e6[_0xbc6a('0xb2')],[_0xbc6a('0xb7'),'id'])||{});}})[_0xbc6a('0x28')](respondWithResult(_0x2e0e53,null))['catch'](handleError(_0x2e0e53,null));};exports[_0xbc6a('0xb9')]=function(_0x1ed67b,_0x1091ec,_0xd2aaa0){var _0x5e110e={'raw':![],'where':{}};var _0xca6e74={};var _0x430dd7={'count':0x0,'rows':[]};return db[_0xbc6a('0x98')]['findOne']({'where':{'id':_0x1ed67b[_0xbc6a('0xb3')]['id']}})['then'](handleEntityNotFound(_0x1091ec,null))['then'](function(_0x361bfc){if(_0x361bfc){_0xca6e74[_0xbc6a('0x37')]=_['keys'](db[_0xbc6a('0xb6')][_0xbc6a('0x33')]);_0xca6e74[_0xbc6a('0x39')]=_[_0xbc6a('0x3a')](_0x1ed67b[_0xbc6a('0x39')]);_0xca6e74['filters']=_[_0xbc6a('0x3b')](_0xca6e74['model'],_0xca6e74[_0xbc6a('0x39')]);_0x5e110e['attributes']=_[_0xbc6a('0x3b')](_0xca6e74['model'],qs[_0xbc6a('0x3d')](_0x1ed67b['query'][_0xbc6a('0x3d')]));_0x5e110e['attributes']=_0x5e110e[_0xbc6a('0x3c')][_0xbc6a('0x3e')]?_0x5e110e[_0xbc6a('0x3c')]:_0xca6e74[_0xbc6a('0x37')];if(!_0x1ed67b[_0xbc6a('0x39')]['hasOwnProperty']('nolimit')){_0x5e110e[_0xbc6a('0x21')]=qs['limit'](_0x1ed67b[_0xbc6a('0x39')][_0xbc6a('0x21')]);_0x5e110e['offset']=qs['offset'](_0x1ed67b[_0xbc6a('0x39')][_0xbc6a('0x20')]);}_0x5e110e[_0xbc6a('0x41')]=qs[_0xbc6a('0x42')](_0x1ed67b[_0xbc6a('0x39')][_0xbc6a('0x42')]);_0x5e110e[_0xbc6a('0x73')]=qs['filters'](_[_0xbc6a('0x44')](_0x1ed67b[_0xbc6a('0x39')],_0xca6e74[_0xbc6a('0x43')]));_0x5e110e[_0xbc6a('0x73')][_0xbc6a('0xaa')]=_0x361bfc['id'];if(_0x1ed67b[_0xbc6a('0x39')]['filter']){_0x5e110e[_0xbc6a('0x73')]=_[_0xbc6a('0x97')](_0x5e110e[_0xbc6a('0x73')],{'$or':_[_0xbc6a('0x38')](_0x5e110e[_0xbc6a('0x3c')],function(_0x3f5c91){var _0x2adbfc={};_0x2adbfc[_0x3f5c91]={'$like':'%'+_0x1ed67b['query'][_0xbc6a('0x80')]+'%'};return _0x2adbfc;})});}if(_0x1ed67b[_0xbc6a('0x39')][_0xbc6a('0xba')]){var _0x1c7dfa=_0x1ed67b['query'][_0xbc6a('0xba')]['split'](',');var _0x30a710={};_0x30a710[_0x1c7dfa[0x0]]={'$gte':moment(_0x1c7dfa[0x1])['format'](_0xbc6a('0xbb'))};_0x5e110e[_0xbc6a('0x73')]=_['merge'](_0x5e110e['where'],_0x30a710);}_0x5e110e=_[_0xbc6a('0x97')]({},_0x5e110e,_0x1ed67b[_0xbc6a('0xb0')]);return db['OpenchannelMessage']['count']({'where':_0x5e110e[_0xbc6a('0x73')]})['then'](function(_0x1711b7){_0x430dd7[_0xbc6a('0x1f')]=_0x1711b7;if(_0x1ed67b['query'][_0xbc6a('0xae')]){_0x5e110e[_0xbc6a('0xaf')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xbc6a('0xbc')](_0x5e110e);})[_0xbc6a('0x28')](function(_0x4b25bd){_0x430dd7[_0xbc6a('0xac')]=_0x4b25bd;return _0x430dd7;});}})[_0xbc6a('0x28')](respondWithFilteredResult(_0x1091ec,_0x5e110e))[_0xbc6a('0x31')](handleError(_0x1091ec,null));};exports[_0xbc6a('0xbd')]=function(_0x5666d7,_0x10ee16,_0x495d5a){return db[_0xbc6a('0x98')][_0xbc6a('0x64')]({'where':{'id':_0x5666d7[_0xbc6a('0xb3')]['id']}})[_0xbc6a('0x28')](handleEntityNotFound(_0x10ee16,null))[_0xbc6a('0x28')](function(_0x504488){if(_0x504488){return _0x504488[_0xbc6a('0xbe')](_0x5666d7['body'][_0xbc6a('0xb7')],_[_0xbc6a('0xb8')](_0x5666d7['body'],[_0xbc6a('0xb7'),'id'])||{})[_0xbc6a('0xbf')](function(){return db[_0xbc6a('0x69')][_0xbc6a('0xbc')]({'attributes':['id','name',_0xbc6a('0x47')],'where':{'id':_0x5666d7[_0xbc6a('0xb2')]['ids']}});})[_0xbc6a('0x28')](function(_0x2781c3){socket['emit'](_0xbc6a('0xc0'),{'id':Number(_0x5666d7[_0xbc6a('0xb3')]['id']),'tags':_0x2781c3||[]});return{'id':Number(_0x5666d7[_0xbc6a('0xb3')]['id']),'tags':_0x2781c3||[]};});}})[_0xbc6a('0x28')](respondWithResult(_0x10ee16,null))[_0xbc6a('0x31')](handleError(_0x10ee16,null));};exports[_0xbc6a('0xc1')]=function(_0x5f3874,_0x89217e,_0x1b7a56){return db[_0xbc6a('0x98')][_0xbc6a('0x64')]({'where':{'id':_0x5f3874[_0xbc6a('0xb3')]['id']}})['then'](handleEntityNotFound(_0x89217e,null))[_0xbc6a('0x28')](function(_0x37f896){if(_0x37f896){return _0x37f896[_0xbc6a('0xc1')](_0x5f3874[_0xbc6a('0x39')]['ids']);}})[_0xbc6a('0x28')](respondWithStatusCode(_0x89217e,null))[_0xbc6a('0x31')](handleError(_0x89217e,null));};exports['download']=function(_0x35207d,_0x171a0d){var _0x435a37=moment()['unix']()[_0xbc6a('0x95')]();var _0x52fff3=path[_0xbc6a('0xc2')](config[_0xbc6a('0xc3')],_0xbc6a('0xc4'),_0xbc6a('0xc5'),_0xbc6a('0xc6'));var _0x41c28f=path['join'](config['root'],_0xbc6a('0xc4'),_0xbc6a('0xc5'),_0xbc6a('0xc7'));var _0x4c89f7=path[_0xbc6a('0xc2')](_0x52fff3,_0x435a37);var _0x2d4266=util[_0xbc6a('0xc8')](_0xbc6a('0xc9'),_0x35207d['params']['id'],_0x435a37);var _0x635eeb=path[_0xbc6a('0xc2')](_0x52fff3,_0x2d4266);var _0x49296e=[];_0x49296e[_0xbc6a('0x30')]({'model':db[_0xbc6a('0x6c')],'as':_0xbc6a('0x6c'),'attributes':['id',_0xbc6a('0xca')],'raw':!![]});_0x49296e[_0xbc6a('0x30')]({'model':db[_0xbc6a('0xcb')],'as':'Contact','attributes':['id',_0xbc6a('0xcc'),_0xbc6a('0xcd')],'raw':!![]});if(_0x35207d['query'][_0xbc6a('0xc7')]){_0x49296e[_0xbc6a('0x30')]({'model':db['Attachment'],'as':_0xbc6a('0xce'),'raw':!![]});}var _0x556206=[{'model':db[_0xbc6a('0xb6')],'as':_0xbc6a('0xcf'),'attributes':['id','body',_0xbc6a('0x75'),_0xbc6a('0xd0'),_0xbc6a('0xd1'),_0xbc6a('0x7a')],'include':_0x49296e}];_0x556206[_0xbc6a('0x30')]({'model':db[_0xbc6a('0xd2')],'as':_0xbc6a('0xd3'),'attributes':['id',_0xbc6a('0x2a')]});_0x556206[_0xbc6a('0x30')]({'model':db[_0xbc6a('0x6c')],'as':'Owner','attributes':['id',_0xbc6a('0xca')]});return db['OpenchannelInteraction'][_0xbc6a('0x64')]({'where':{'id':_0x35207d['params']['id']},'include':_0x556206})[_0xbc6a('0x28')](handleEntityNotFound(_0x171a0d,null))[_0xbc6a('0x28')](function(_0x306850){if(_0x306850){var _0x4fe7be=_0x306850[_0xbc6a('0xd4')]({'plain':!![]});fs['mkdirSync'](_0x4c89f7);var _0x811615={'format':'A4','border':'10px','header':{'height':_0xbc6a('0xd5'),'contents':{'first':_0xbc6a('0xd6')}},'footer':{'height':'30px','contents':{'default':util['format']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xbc6a('0xc8')](_0xbc6a('0xd7'),_0xbc6a('0xd8'),_0x4fe7be['id']),moment()['format']('YYYY-MM-DD')['toString']())}}};var _0x34a843={'channel':_0xbc6a('0xd8'),'account':_0x4fe7be[_0xbc6a('0xd3')][_0xbc6a('0x2a')],'agent':_0x4fe7be['Owner']?_0x4fe7be[_0xbc6a('0xd9')][_0xbc6a('0xca')]:_0xbc6a('0xda'),'createdAt':moment(_0x4fe7be[_0xbc6a('0x75')])[_0xbc6a('0xc8')](_0xbc6a('0xbb'))[_0xbc6a('0x95')](),'closedAt':_0x4fe7be[_0xbc6a('0xdb')]?moment(_0x4fe7be['closedAt'])[_0xbc6a('0xc8')](_0xbc6a('0xbb'))[_0xbc6a('0x95')]():'','disposition':_0x4fe7be[_0xbc6a('0xdc')],'visibility':_0x4fe7be['threadId']?_0xbc6a('0xdd'):_0xbc6a('0xde'),'messages':_(_0x4fe7be[_0xbc6a('0xcf')])['filter']({'secret':![]})[_0xbc6a('0x38')](function(_0x500573){if(_0x500573[_0xbc6a('0xce')]){var _0x191b8c=path[_0xbc6a('0xc2')](_0x41c28f,_0x500573['Attachment'][_0xbc6a('0xdf')]);if(fs[_0xbc6a('0xe0')](_0x191b8c)){fs['createReadStream'](_0x191b8c)[_0xbc6a('0xe1')](fs[_0xbc6a('0xe2')](path['join'](_0x4c89f7,_0x500573[_0xbc6a('0xce')][_0xbc6a('0xdf')])));}}return{'date':moment(_0x500573['createdAt'])[_0xbc6a('0xc8')](_0xbc6a('0xbb'))[_0xbc6a('0x95')](),'sender':_0x500573[_0xbc6a('0xd0')]==='out'?_0x500573['User']?_0x500573[_0xbc6a('0x6c')]['fullname']:'System':_0x500573['Contact'][_0xbc6a('0xcc')]+(_0x500573[_0xbc6a('0xe3')]['lastName']?'\x20'+_0x500573['Contact'][_0xbc6a('0xcd')]:''),'body':_0x500573['Attachment']?_0x500573['Attachment'][_0xbc6a('0xdf')]:_0x500573[_0xbc6a('0xb2')],'direction':_0x500573[_0xbc6a('0xd0')]==='out'?'A':'C','secret':_0x500573[_0xbc6a('0xd1')],'read':_0x500573[_0xbc6a('0x7a')],'attachment':_0x500573[_0xbc6a('0xce')]};})[_0xbc6a('0x63')]()};return ejs[_0xbc6a('0xe4')](path[_0xbc6a('0xc2')](config[_0xbc6a('0xc3')],_0xbc6a('0xc4'),_0xbc6a('0xe5'),_0xbc6a('0xe6')),{'interaction':_0x34a843})[_0xbc6a('0x28')](function(_0x5c2848){return new BPromise(function(_0x4952dd,_0x393e6c){pdf[_0xbc6a('0xb1')](_0x5c2848,_0x811615)[_0xbc6a('0xe7')](path[_0xbc6a('0xc2')](_0x4c89f7,_0xbc6a('0xe8')+_0x4fe7be['id']+'-'+_0x435a37+'.pdf'),function(_0x39b068,_0x42ce40){if(_0x39b068)return _0x393e6c(_0x39b068);_0x4952dd(_0x42ce40);});});})[_0xbc6a('0x28')](function(){return new BPromise(function(_0xce8d3e,_0x286717){zipdir(_0x4c89f7,{'saveTo':_0x635eeb},function(_0x4da2c6,_0x33dad5){if(_0x4da2c6)return _0x286717(_0x4da2c6);return _0xce8d3e(_0x33dad5);});})[_0xbc6a('0x28')](function(){return new BPromise(function(_0x56d37d,_0x522522){rimraf(_0x4c89f7,function(_0x9a6c52){if(_0x9a6c52)_0x522522(_0x9a6c52);return _0x56d37d();});});})[_0xbc6a('0x28')](function(){return _0x171a0d['download'](_0x635eeb,_0x2d4266,function(_0x5aa3e1){if(_0x5aa3e1){console[_0xbc6a('0xe9')](_0xbc6a('0xea'),_0x5aa3e1);}else{fs[_0xbc6a('0xeb')](_0x635eeb);}});});});}else{return _0x171a0d['sendStatus'](0xc8);}})['catch'](handleError(_0x171a0d,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index ae1f3ed..734debd 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 _0x4310=['findAll','length','emit','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','then','setDataValue','Users','map'];(function(_0x362ee9,_0x3589a7){var _0x33b008=function(_0x2a7d0d){while(--_0x2a7d0d){_0x362ee9['push'](_0x362ee9['shift']());}};_0x33b008(++_0x3589a7);}(_0x4310,0x15e));var _0x0431=function(_0x3ae89c,_0x4bc1d3){_0x3ae89c=_0x3ae89c-0x0;var _0x54df34=_0x4310[_0x3ae89c];return _0x54df34;};'use strict';var EventEmitter=require(_0x0431('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x0431('0x1'))['db'][_0x0431('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x0431('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0431('0x4'),'afterDestroy':_0x0431('0x5')};function emitEvent(_0x2438d5){return function(_0x3322cb,_0x122650,_0x263c97){_0x3322cb['getUsers']({'attributes':['id'],'raw':!![]})[_0x0431('0x6')](function(_0x592a34){_0x3322cb[_0x0431('0x7')](_0x0431('0x8'),_0x592a34[_0x0431('0x9')](function(_0x202455){return{'id':_0x202455['id']};}));return OpenchannelMessage[_0x0431('0xa')]({'where':{'OpenchannelInteractionId':_0x3322cb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0431('0x6')](function(_0x18b1d7){_0x3322cb[_0x0431('0x7')]('unreadMessages',_0x18b1d7[_0x0431('0xb')]);OpenchannelInteractionEvents[_0x0431('0xc')](_0x2438d5+':'+_0x3322cb['id'],_0x3322cb);OpenchannelInteractionEvents[_0x0431('0xc')](_0x2438d5,_0x3322cb);_0x263c97(null);})['catch'](_0x263c97(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x0431('0xd')](e,emitEvent(event));}}module[_0x0431('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x28c3=['unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','findAll'];(function(_0xce4a66,_0x53e859){var _0x16894f=function(_0x38a2f9){while(--_0x38a2f9){_0xce4a66['push'](_0xce4a66['shift']());}};_0x16894f(++_0x53e859);}(_0x28c3,0xf6));var _0x328c=function(_0x29bdb7,_0x873459){_0x29bdb7=_0x29bdb7-0x0;var _0x1d4eb7=_0x28c3[_0x29bdb7];return _0x1d4eb7;};'use strict';var EventEmitter=require(_0x328c('0x0'));var OpenchannelInteraction=require(_0x328c('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x328c('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x328c('0x2')](0x0);var events={'afterCreate':_0x328c('0x3'),'afterUpdate':'update','afterDestroy':_0x328c('0x4')};function emitEvent(_0x5f10c){return function(_0x271a5e,_0x2cfeb8,_0x11aa6b){_0x271a5e[_0x328c('0x5')]({'attributes':['id'],'raw':!![]})[_0x328c('0x6')](function(_0x7f2a5b){_0x271a5e[_0x328c('0x7')](_0x328c('0x8'),_0x7f2a5b['map'](function(_0x277db9){return{'id':_0x277db9['id']};}));return OpenchannelMessage[_0x328c('0x9')]({'where':{'OpenchannelInteractionId':_0x271a5e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x328c('0x6')](function(_0x1f88d8){_0x271a5e[_0x328c('0x7')](_0x328c('0xa'),_0x1f88d8[_0x328c('0xb')]);OpenchannelInteractionEvents[_0x328c('0xc')](_0x5f10c+':'+_0x271a5e['id'],_0x271a5e);OpenchannelInteractionEvents[_0x328c('0xc')](_0x5f10c,_0x271a5e);_0x11aa6b(null);})[_0x328c('0xd')](_0x11aa6b(null));};}for(var e in events){if(events[_0x328c('0xe')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x328c('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index f59d3e8..008a3db 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 _0xd0b7=['OpenchannelInteraction','openchannel_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xd0b7,0x1b7));var _0x7d0b=function(_0xcdf70d,_0x2740e2){_0xcdf70d=_0xcdf70d-0x0;var _0x20eac0=_0xd0b7[_0xcdf70d];return _0x20eac0;};'use strict';var _=require('lodash');var util=require(_0x7d0b('0x0'));var logger=require(_0x7d0b('0x1'))(_0x7d0b('0x2'));var moment=require('moment');var BPromise=require(_0x7d0b('0x3'));var rp=require(_0x7d0b('0x4'));var fs=require('fs');var path=require(_0x7d0b('0x5'));var rimraf=require(_0x7d0b('0x6'));var config=require(_0x7d0b('0x7'));var attributes=require(_0x7d0b('0x8'));module[_0x7d0b('0x9')]=function(_0x3a8846,_0x21cf21){return _0x3a8846[_0x7d0b('0xa')](_0x7d0b('0xb'),attributes,{'tableName':_0x7d0b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x963d92,_0x861b60,_0x77a2f6){if(_0x963d92[_0x7d0b('0xd')](_0x7d0b('0xe'))){_0x963d92[_0x7d0b('0xf')]=moment()[_0x7d0b('0x10')](_0x7d0b('0x11'));}_0x77a2f6(null,_0x963d92);}}});}; \ No newline at end of file +var _0x8398=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','OpenchannelInteraction','changed','closed','closedAt','format','lodash'];(function(_0x826377,_0x5916ec){var _0x19563b=function(_0x327b00){while(--_0x327b00){_0x826377['push'](_0x826377['shift']());}};_0x19563b(++_0x5916ec);}(_0x8398,0x12b));var _0x8839=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x8398[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0x8839('0x0'));var util=require(_0x8839('0x1'));var logger=require(_0x8839('0x2'))(_0x8839('0x3'));var moment=require('moment');var BPromise=require(_0x8839('0x4'));var rp=require(_0x8839('0x5'));var fs=require('fs');var path=require(_0x8839('0x6'));var rimraf=require(_0x8839('0x7'));var config=require(_0x8839('0x8'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x15032c,_0x5742d2){return _0x15032c[_0x8839('0x9')](_0x8839('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5078dd,_0x35c344,_0x4f5806){if(_0x5078dd[_0x8839('0xb')](_0x8839('0xc'))){_0x5078dd[_0x8839('0xd')]=moment()[_0x8839('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4f5806(null,_0x5078dd);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index bf80058..0e60d16 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 _0x8477=['find','where','addTags','body','ids','omit','spread','AddTags','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','info','request\x20sent','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','attributes','limit','debug','catch','AddTagsToOpenchannelInteraction'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0x8477,0x198));var _0x7847=function(_0x319e2e,_0x2f727f){_0x319e2e=_0x319e2e-0x0;var _0x302524=_0x8477[_0x319e2e];return _0x302524;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7847('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7847('0x1'));var logger=require(_0x7847('0x2'))('rpc');var config=require(_0x7847('0x3'));var jayson=require(_0x7847('0x4'));var client=jayson[_0x7847('0x5')][_0x7847('0x6')]({'port':0x232a});config[_0x7847('0x7')]=_[_0x7847('0x8')](config[_0x7847('0x7')],{'host':_0x7847('0x9'),'port':0x18eb});var socket=require(_0x7847('0xa'))(new Redis(config[_0x7847('0x7')]));require(_0x7847('0xb'))['register'](socket);function respondWithRpcPromise(_0x2714f8,_0x492a71,_0x5e3fb6){return new BPromise(function(_0x52c00b,_0x5ce495){return client[_0x7847('0xc')](_0x2714f8,_0x5e3fb6)[_0x7847('0xd')](function(_0x14a090){logger[_0x7847('0xe')]('OpenchannelInteraction,\x20%s,\x20%s',_0x492a71,_0x7847('0xf'));logger['debug']('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x492a71,_0x7847('0xf'),JSON[_0x7847('0x10')](_0x14a090));if(_0x14a090[_0x7847('0x11')]){if(_0x14a090[_0x7847('0x11')][_0x7847('0x12')]===0x1f4){logger[_0x7847('0x11')](_0x7847('0x13'),_0x492a71,_0x14a090[_0x7847('0x11')]['message']);return _0x5ce495(_0x14a090['error']['message']);}logger[_0x7847('0x11')](_0x7847('0x13'),_0x492a71,_0x14a090['error']['message']);return _0x52c00b(_0x14a090['error'][_0x7847('0x14')]);}else{logger[_0x7847('0xe')]('OpenchannelInteraction,\x20%s,\x20%s',_0x492a71,_0x7847('0xf'));_0x52c00b(_0x14a090[_0x7847('0x15')][_0x7847('0x14')]);}})['catch'](function(_0x275c62){logger['error'](_0x7847('0x13'),_0x492a71,_0x275c62);_0x5ce495(_0x275c62);});});}exports[_0x7847('0x16')]=function(_0x34988b){var _0x176db4=this;return new Promise(function(_0x300ee1,_0x56baed){return db[_0x7847('0x17')][_0x7847('0x18')](_0x34988b['body'],{'raw':_0x34988b['options']?_0x34988b[_0x7847('0x19')][_0x7847('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34988b[_0x7847('0x19')]?_0x34988b[_0x7847('0x19')]['where']||null:null,'attributes':_0x34988b['options']?_0x34988b[_0x7847('0x19')][_0x7847('0x1b')]||null:null,'limit':_0x34988b[_0x7847('0x19')]?_0x34988b[_0x7847('0x19')][_0x7847('0x1c')]||null:null})['then'](function(_0x365709){logger[_0x7847('0xe')](_0x7847('0x16'),_0x34988b);logger[_0x7847('0x1d')]('UpdateOpenchannelInteraction',_0x34988b,JSON['stringify'](_0x365709));_0x300ee1(_0x365709);})[_0x7847('0x1e')](function(_0x3d9a0f){logger['error'](_0x7847('0x16'),_0x3d9a0f[_0x7847('0x14')],_0x34988b);_0x56baed(_0x176db4[_0x7847('0x11')](0x1f4,_0x3d9a0f[_0x7847('0x14')]));});});};exports[_0x7847('0x1f')]=function(_0x132f3e){return new Promise(function(_0x1a8759,_0x3c5aeb){return db[_0x7847('0x17')][_0x7847('0x20')]({'where':_0x132f3e[_0x7847('0x19')]?_0x132f3e[_0x7847('0x19')][_0x7847('0x21')]||null:null})[_0x7847('0xd')](function(_0x175726){if(_0x175726){return _0x175726[_0x7847('0x22')](_0x132f3e[_0x7847('0x23')][_0x7847('0x24')],_[_0x7847('0x25')](_0x132f3e[_0x7847('0x23')],['ids','id'])||{});}})[_0x7847('0x26')](function(_0x25022f){logger[_0x7847('0xe')](_0x7847('0x27'),_0x132f3e);logger[_0x7847('0x1d')](_0x7847('0x27'),_0x132f3e,JSON[_0x7847('0x10')](_0x25022f));_0x1a8759(_0x25022f);})[_0x7847('0x1e')](function(_0x175571){logger['error'](_0x7847('0x27'),_0x175571[_0x7847('0x14')],_0x132f3e);_0x3c5aeb(_this[_0x7847('0x11')](0x1f4,_0x175571[_0x7847('0x14')]));});});}; \ No newline at end of file +var _0xb665=['defaults','localhost','socket.io-emitter','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelInteraction','update','body','options','where','attributes','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTags','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x4ad0f7,_0x1920b0){var _0x30f5c8=function(_0x2aa6b6){while(--_0x2aa6b6){_0x4ad0f7['push'](_0x4ad0f7['shift']());}};_0x30f5c8(++_0x1920b0);}(_0xb665,0x97));var _0x5b66=function(_0xd0c279,_0x13d61d){_0xd0c279=_0xd0c279-0x0;var _0x5bd6fc=_0xb665[_0xd0c279];return _0x5bd6fc;};'use strict';var _=require('lodash');var util=require(_0x5b66('0x0'));var moment=require(_0x5b66('0x1'));var BPromise=require(_0x5b66('0x2'));var rs=require(_0x5b66('0x3'));var fs=require('fs');var Redis=require(_0x5b66('0x4'));var db=require(_0x5b66('0x5'))['db'];var utils=require(_0x5b66('0x6'));var logger=require(_0x5b66('0x7'))('rpc');var config=require(_0x5b66('0x8'));var jayson=require(_0x5b66('0x9'));var client=jayson[_0x5b66('0xa')][_0x5b66('0xb')]({'port':0x232a});config[_0x5b66('0xc')]=_[_0x5b66('0xd')](config['redis'],{'host':_0x5b66('0xe'),'port':0x18eb});var socket=require(_0x5b66('0xf'))(new Redis(config[_0x5b66('0xc')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x8a189e,_0x53825c,_0x567904){return new BPromise(function(_0x31cc14,_0x10b880){return client['request'](_0x8a189e,_0x567904)[_0x5b66('0x10')](function(_0x36adc7){logger[_0x5b66('0x11')](_0x5b66('0x12'),_0x53825c,_0x5b66('0x13'));logger[_0x5b66('0x14')](_0x5b66('0x15'),_0x53825c,_0x5b66('0x13'),JSON[_0x5b66('0x16')](_0x36adc7));if(_0x36adc7[_0x5b66('0x17')]){if(_0x36adc7['error'][_0x5b66('0x18')]===0x1f4){logger[_0x5b66('0x17')](_0x5b66('0x12'),_0x53825c,_0x36adc7[_0x5b66('0x17')][_0x5b66('0x19')]);return _0x10b880(_0x36adc7[_0x5b66('0x17')]['message']);}logger[_0x5b66('0x17')](_0x5b66('0x12'),_0x53825c,_0x36adc7[_0x5b66('0x17')][_0x5b66('0x19')]);return _0x31cc14(_0x36adc7[_0x5b66('0x17')][_0x5b66('0x19')]);}else{logger[_0x5b66('0x11')](_0x5b66('0x12'),_0x53825c,_0x5b66('0x13'));_0x31cc14(_0x36adc7[_0x5b66('0x1a')]['message']);}})[_0x5b66('0x1b')](function(_0x40f796){logger[_0x5b66('0x17')](_0x5b66('0x12'),_0x53825c,_0x40f796);_0x10b880(_0x40f796);});});}exports['UpdateOpenchannelInteraction']=function(_0x2e2a4e){var _0x2f4e6f=this;return new Promise(function(_0x2ae65d,_0x2351d8){return db[_0x5b66('0x1c')][_0x5b66('0x1d')](_0x2e2a4e[_0x5b66('0x1e')],{'raw':_0x2e2a4e['options']?_0x2e2a4e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e2a4e['options']?_0x2e2a4e[_0x5b66('0x1f')][_0x5b66('0x20')]||null:null,'attributes':_0x2e2a4e[_0x5b66('0x1f')]?_0x2e2a4e[_0x5b66('0x1f')][_0x5b66('0x21')]||null:null,'limit':_0x2e2a4e[_0x5b66('0x1f')]?_0x2e2a4e[_0x5b66('0x1f')][_0x5b66('0x22')]||null:null})[_0x5b66('0x10')](function(_0x1aab6b){logger['info'](_0x5b66('0x23'),_0x2e2a4e);logger['debug']('UpdateOpenchannelInteraction',_0x2e2a4e,JSON[_0x5b66('0x16')](_0x1aab6b));_0x2ae65d(_0x1aab6b);})[_0x5b66('0x1b')](function(_0x57c3d2){logger[_0x5b66('0x17')](_0x5b66('0x23'),_0x57c3d2[_0x5b66('0x19')],_0x2e2a4e);_0x2351d8(_0x2f4e6f[_0x5b66('0x17')](0x1f4,_0x57c3d2[_0x5b66('0x19')]));});});};exports[_0x5b66('0x24')]=function(_0x52e812){return new Promise(function(_0x102d4a,_0x3a4d6c){return db[_0x5b66('0x1c')]['find']({'where':_0x52e812[_0x5b66('0x1f')]?_0x52e812['options']['where']||null:null})[_0x5b66('0x10')](function(_0x712eb2){if(_0x712eb2){return _0x712eb2[_0x5b66('0x25')](_0x52e812[_0x5b66('0x1e')]['ids'],_[_0x5b66('0x26')](_0x52e812['body'],['ids','id'])||{});}})[_0x5b66('0x27')](function(_0x1a5c06){logger[_0x5b66('0x11')](_0x5b66('0x28'),_0x52e812);logger[_0x5b66('0x14')]('AddTags',_0x52e812,JSON[_0x5b66('0x16')](_0x1a5c06));_0x102d4a(_0x1a5c06);})[_0x5b66('0x1b')](function(_0x2b87e8){logger['error'](_0x5b66('0x28'),_0x2b87e8[_0x5b66('0x19')],_0x52e812);_0x3a4d6c(_this['error'](0x1f4,_0x2b87e8[_0x5b66('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index e1d44e7..1071746 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 _0x37ff=['removeListener','register','length','openchannelInteraction:','save','remove','update','emit'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x37ff,0x104));var _0xf37f=function(_0x3af0d0,_0xee84f9){_0x3af0d0=_0x3af0d0-0x0;var _0x5533a7=_0x37ff[_0x3af0d0];return _0x5533a7;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0xf37f('0x0'),_0xf37f('0x1'),_0xf37f('0x2')];function createListener(_0x63f173,_0x21dd12){return function(_0xff2d7){_0x21dd12[_0xf37f('0x3')](_0x63f173,_0xff2d7);};}function removeListener(_0x598495,_0x3d0fbe){return function(){OpenchannelInteractionEvents[_0xf37f('0x4')](_0x598495,_0x3d0fbe);};}exports[_0xf37f('0x5')]=function(_0x2e645f){for(var _0xb421ee=0x0,_0x500929=events[_0xf37f('0x6')];_0xb421ee<_0x500929;_0xb421ee++){var _0x98beb0=events[_0xb421ee];var _0x2fafa1=createListener(_0xf37f('0x7')+_0x98beb0,_0x2e645f);OpenchannelInteractionEvents['on'](_0x98beb0,_0x2fafa1);}}; \ No newline at end of file +var _0xed0d=['./openchannelInteraction.events','save','remove','emit','removeListener','length','openchannelInteraction:'];(function(_0x46b579,_0x566d72){var _0x373a12=function(_0xe47070){while(--_0xe47070){_0x46b579['push'](_0x46b579['shift']());}};_0x373a12(++_0x566d72);}(_0xed0d,0x1f1));var _0xded0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xed0d[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelInteractionEvents=require(_0xded0('0x0'));var events=[_0xded0('0x1'),_0xded0('0x2'),'update'];function createListener(_0x25ffcd,_0x157b8a){return function(_0x2064b0){_0x157b8a[_0xded0('0x3')](_0x25ffcd,_0x2064b0);};}function removeListener(_0x462bd3,_0x4f33f3){return function(){OpenchannelInteractionEvents[_0xded0('0x4')](_0x462bd3,_0x4f33f3);};}exports['register']=function(_0x1cb604){for(var _0x45bd62=0x0,_0x89dc4=events[_0xded0('0x5')];_0x45bd62<_0x89dc4;_0x45bd62++){var _0x2b76da=events[_0x45bd62];var _0x4fac2c=createListener(_0xded0('0x6')+_0x2b76da,_0x1cb604);OpenchannelInteractionEvents['on'](_0x2b76da,_0x4fac2c);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 2c36b7e..faed75e 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 _0x9747=['/describe','/:id','show','post','tracked','openchannelmessage:create','create','put','update','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9747,0x76));var _0x7974=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9747[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7974('0x0'));var util=require(_0x7974('0x1'));var path=require(_0x7974('0x2'));var timeout=require(_0x7974('0x3'));var express=require(_0x7974('0x4'));var router=express[_0x7974('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7974('0x6'));var config=require(_0x7974('0x7'));var controller=require(_0x7974('0x8'));router[_0x7974('0x9')]('/',auth[_0x7974('0xa')](),controller[_0x7974('0xb')]);router[_0x7974('0x9')](_0x7974('0xc'),auth[_0x7974('0xa')](),controller['describe']);router[_0x7974('0x9')](_0x7974('0xd'),auth[_0x7974('0xa')](),controller[_0x7974('0xe')]);router[_0x7974('0xf')]('/',auth[_0x7974('0xa')](),interaction[_0x7974('0x10')]('openchannel',_0x7974('0x11')),controller[_0x7974('0x12')]);router[_0x7974('0x13')](_0x7974('0xd'),auth[_0x7974('0xa')](),controller[_0x7974('0x14')]);router[_0x7974('0x13')](_0x7974('0x15'),auth[_0x7974('0xa')](),controller['accept']);router[_0x7974('0x13')](_0x7974('0x16'),auth['isAuthenticated'](),controller[_0x7974('0x17')]);router['delete'](_0x7974('0xd'),auth[_0x7974('0xa')](),controller[_0x7974('0x18')]);module[_0x7974('0x19')]=router; \ No newline at end of file +var _0x74b1=['/:id','isAuthenticated','show','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','index','get'];(function(_0x27a997,_0x85f149){var _0x5aa288=function(_0x38f03c){while(--_0x38f03c){_0x27a997['push'](_0x27a997['shift']());}};_0x5aa288(++_0x85f149);}(_0x74b1,0x1c2));var _0x174b=function(_0x34f701,_0x37e407){_0x34f701=_0x34f701-0x0;var _0x3e2429=_0x74b1[_0x34f701];return _0x3e2429;};'use strict';var multer=require('multer');var util=require(_0x174b('0x0'));var path=require(_0x174b('0x1'));var timeout=require(_0x174b('0x2'));var express=require('express');var router=express[_0x174b('0x3')]();var auth=require(_0x174b('0x4'));var interaction=require(_0x174b('0x5'));var config=require(_0x174b('0x6'));var controller=require(_0x174b('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x174b('0x8')]);router[_0x174b('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x174b('0x9')](_0x174b('0xa'),auth[_0x174b('0xb')](),controller[_0x174b('0xc')]);router['post']('/',auth[_0x174b('0xb')](),interaction['tracked'](_0x174b('0xd'),_0x174b('0xe')),controller['create']);router[_0x174b('0xf')](_0x174b('0xa'),auth[_0x174b('0xb')](),controller[_0x174b('0x10')]);router[_0x174b('0xf')](_0x174b('0x11'),auth[_0x174b('0xb')](),controller[_0x174b('0x12')]);router[_0x174b('0xf')](_0x174b('0x13'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x174b('0xa'),auth[_0x174b('0xb')](),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 f217753..a6e9411 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 _0xdd3b=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x508eca,_0x21328a){var _0xc52d4b=function(_0x1ba82e){while(--_0x1ba82e){_0x508eca['push'](_0x508eca['shift']());}};_0xc52d4b(++_0x21328a);}(_0xdd3b,0x140));var _0xbdd3=function(_0x50d337,_0x2a8ef6){_0x50d337=_0x50d337-0x0;var _0x836de0=_0xdd3b[_0x50d337];return _0x836de0;};'use strict';var Sequelize=require(_0xbdd3('0x0'));module[_0xbdd3('0x1')]={'body':{'type':Sequelize[_0xbdd3('0x2')](_0xbdd3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xbdd3('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xbdd3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbdd3('0x5')]('in','out'),'defaultValue':_0xbdd3('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xbdd3('0x7')]}}; \ No newline at end of file +var _0x3786=['ENUM','out','DATE','sequelize','exports','BOOLEAN'];(function(_0x293767,_0x80f126){var _0x176303=function(_0x592f06){while(--_0x592f06){_0x293767['push'](_0x293767['shift']());}};_0x176303(++_0x80f126);}(_0x3786,0x1a1));var _0x6378=function(_0x4c7285,_0x97e5f8){_0x4c7285=_0x4c7285-0x0;var _0x107ccf=_0x3786[_0x4c7285];return _0x107ccf;};'use strict';var Sequelize=require(_0x6378('0x0'));module[_0x6378('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x6378('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x6378('0x3')]('in',_0x6378('0x4')),'defaultValue':_0x6378('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x6378('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 5a32eaa..712f9e2 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 _0x0322=['type','key','query','filters','intersection','model','attributes','fields','length','nolimit','limit','order','where','filter','merge','options','includeAll','include','findAll','show','params','keys','create','body','find','describe','openchannel-interactions','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','end','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName'];(function(_0x19ad4c,_0x40d64c){var _0x29bbd2=function(_0x22a336){while(--_0x22a336){_0x19ad4c['push'](_0x19ad4c['shift']());}};_0x29bbd2(++_0x40d64c);}(_0x0322,0xb7));var _0x2032=function(_0x529a0f,_0x328763){_0x529a0f=_0x529a0f-0x0;var _0x187a88=_0x0322[_0x529a0f];return _0x187a88;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2032('0x0'));var rimraf=require(_0x2032('0x1'));var zipdir=require(_0x2032('0x2'));var jsonpatch=require(_0x2032('0x3'));var rp=require('request-promise');var moment=require(_0x2032('0x4'));var BPromise=require(_0x2032('0x5'));var Mustache=require(_0x2032('0x6'));var util=require(_0x2032('0x7'));var path=require(_0x2032('0x8'));var sox=require(_0x2032('0x9'));var csv=require(_0x2032('0xa'));var ejs=require(_0x2032('0xb'));var fs=require('fs');var _=require(_0x2032('0xc'));var squel=require(_0x2032('0xd'));var crypto=require(_0x2032('0xe'));var jsforce=require(_0x2032('0xf'));var deskjs=require(_0x2032('0x10'));var toCsv=require(_0x2032('0xa'));var querystring=require('querystring');var Papa=require(_0x2032('0x11'));var Redis=require(_0x2032('0x12'));var authService=require(_0x2032('0x13'));var qs=require(_0x2032('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2032('0x15'));var logger=require(_0x2032('0x16'))(_0x2032('0x17'));var utils=require(_0x2032('0x18'));var config=require('../../config/environment');var db=require(_0x2032('0x19'))['db'];config[_0x2032('0x1a')]=_['defaults'](config[_0x2032('0x1a')],{'host':_0x2032('0x1b'),'port':0x18eb});var socket=require(_0x2032('0x1c'))(new Redis(config['redis']));require(_0x2032('0x1d'))[_0x2032('0x1e')](socket);var jayson=require(_0x2032('0x1f'));var client=jayson[_0x2032('0x20')][_0x2032('0x21')]({'port':0x232c});var client9002=jayson[_0x2032('0x20')][_0x2032('0x21')]({'port':0x232a});function checkPasswordPattern(_0x11061e,_0x1fa6e9,_0x483ece){if(_0x483ece){var _0x1ea6cb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1ea6cb[_0x2032('0x22')](_0x1fa6e9)){return _0x11061e;}else{throw new db[(_0x2032('0x23'))]['ValidationError'](_0x2032('0x24'));}}else{return _0x11061e;}}function respondWithRpcPromise(_0x29e71a,_0x1bce26,_0xff2841,_0x4ffb64){return new BPromise(function(_0x39c444,_0x113b20){var _0x4815d7=_0x4ffb64||client;return _0x4815d7['request'](_0x29e71a,_0xff2841)[_0x2032('0x25')](function(_0x4373bb){logger[_0x2032('0x26')](_0x2032('0x27'),_0x1bce26,'request\x20sent');logger[_0x2032('0x28')](_0x2032('0x29'),_0x1bce26,_0x2032('0x2a'),JSON[_0x2032('0x2b')](_0x4373bb));if(_0x4373bb[_0x2032('0x2c')]){if(_0x4373bb['error'][_0x2032('0x2d')]===0x1f4){logger[_0x2032('0x2c')](_0x2032('0x27'),_0x1bce26,_0x4373bb[_0x2032('0x2c')]['message']);return _0x113b20(_0x4373bb[_0x2032('0x2c')][_0x2032('0x2e')]);}logger[_0x2032('0x2c')](_0x2032('0x27'),_0x1bce26,_0x4373bb['error'][_0x2032('0x2e')]);return _0x39c444(_0x4373bb[_0x2032('0x2c')][_0x2032('0x2e')]);}else{logger[_0x2032('0x26')](_0x2032('0x27'),_0x1bce26,'request\x20sent');_0x39c444(_0x4373bb[_0x2032('0x2f')][_0x2032('0x2e')]);}})[_0x2032('0x30')](function(_0x1a5cdc){logger[_0x2032('0x2c')](_0x2032('0x27'),_0x1bce26,_0x1a5cdc);_0x113b20(_0x1a5cdc);});});}function respondWithStatusCode(_0x1e32f9,_0x4a9d93){_0x4a9d93=_0x4a9d93||0xcc;return function(_0x4b0c2d){if(_0x4b0c2d){return _0x1e32f9[_0x2032('0x31')](_0x4a9d93);}return _0x1e32f9['status'](_0x4a9d93)['end']();};}function respondWithResult(_0x577b0f,_0x4dcc98){_0x4dcc98=_0x4dcc98||0xc8;return function(_0x3a12bf){if(_0x3a12bf){return _0x577b0f[_0x2032('0x32')](_0x4dcc98)[_0x2032('0x33')](_0x3a12bf);}};}function respondWithFilteredResult(_0xbad42,_0x2da31b){return function(_0x501f0a){if(_0x501f0a){var _0x4cbdc4=_0x501f0a[_0x2032('0x34')],_0x3b7bfa=_0x2da31b[_0x2032('0x35')],_0x5ca671=_0x2da31b[_0x2032('0x35')]+_0x2da31b['limit'],_0x55cedc;if(_0x5ca671>=_0x4cbdc4){_0x5ca671=_0x4cbdc4;_0x55cedc=0xc8;}else{_0x55cedc=0xce;}_0xbad42[_0x2032('0x32')](_0x55cedc);return _0xbad42[_0x2032('0x36')](_0x2032('0x37'),_0x3b7bfa+'-'+_0x5ca671+'/'+_0x4cbdc4)[_0x2032('0x33')](_0x501f0a);}return null;};}function patchUpdates(_0x1b3b2b){return function(_0x492efc){try{jsonpatch[_0x2032('0x38')](_0x492efc,_0x1b3b2b,!![]);}catch(_0x47f233){return BPromise[_0x2032('0x39')](_0x47f233);}return _0x492efc[_0x2032('0x3a')]();};}function saveUpdates(_0x284ecc,_0xb1e1ef){return function(_0x596dd8){if(_0x596dd8){return _0x596dd8[_0x2032('0x3b')](_0x284ecc)[_0x2032('0x25')](function(_0x10d9ea){return _0x10d9ea;});}return null;};}function removeEntity(_0x46812a,_0xf269e1){return function(_0x1c31e1){if(_0x1c31e1){return _0x1c31e1['destroy']()[_0x2032('0x25')](function(){_0x46812a[_0x2032('0x32')](0xcc)[_0x2032('0x3c')]();});}};}function handleEntityNotFound(_0x1f1bc0,_0x2a60e9){return function(_0x23da96){if(!_0x23da96){_0x1f1bc0[_0x2032('0x31')](0x194);}return _0x23da96;};}function handleError(_0x42888a,_0x2b349e){_0x2b349e=_0x2b349e||0x1f4;return function(_0x297060){logger['error'](_0x297060[_0x2032('0x3d')]);if(_0x297060[_0x2032('0x3e')]){delete _0x297060[_0x2032('0x3e')];}_0x42888a['status'](_0x2b349e)[_0x2032('0x3f')](_0x297060);};}exports[_0x2032('0x40')]=function(_0x50ffa5,_0x1764ae){var _0x2061e5={},_0x34ccc3={},_0x21c91c={'count':0x0,'rows':[]};var _0x51ca25=_[_0x2032('0x41')](db[_0x2032('0x42')][_0x2032('0x43')],function(_0x5151eb){return{'name':_0x5151eb[_0x2032('0x44')],'type':_0x5151eb[_0x2032('0x45')][_0x2032('0x46')]};});_0x34ccc3['model']=_[_0x2032('0x41')](_0x51ca25,'name');_0x34ccc3[_0x2032('0x47')]=_['keys'](_0x50ffa5[_0x2032('0x47')]);_0x34ccc3[_0x2032('0x48')]=_[_0x2032('0x49')](_0x34ccc3[_0x2032('0x4a')],_0x34ccc3[_0x2032('0x47')]);_0x2061e5[_0x2032('0x4b')]=_[_0x2032('0x49')](_0x34ccc3[_0x2032('0x4a')],qs[_0x2032('0x4c')](_0x50ffa5[_0x2032('0x47')][_0x2032('0x4c')]));_0x2061e5['attributes']=_0x2061e5[_0x2032('0x4b')][_0x2032('0x4d')]?_0x2061e5['attributes']:_0x34ccc3[_0x2032('0x4a')];if(!_0x50ffa5[_0x2032('0x47')]['hasOwnProperty'](_0x2032('0x4e'))){_0x2061e5[_0x2032('0x4f')]=qs['limit'](_0x50ffa5[_0x2032('0x47')][_0x2032('0x4f')]);_0x2061e5['offset']=qs[_0x2032('0x35')](_0x50ffa5[_0x2032('0x47')][_0x2032('0x35')]);}_0x2061e5[_0x2032('0x50')]=qs['sort'](_0x50ffa5['query']['sort']);_0x2061e5[_0x2032('0x51')]=qs[_0x2032('0x48')](_['pick'](_0x50ffa5[_0x2032('0x47')],_0x34ccc3[_0x2032('0x48')]),_0x51ca25);if(_0x50ffa5[_0x2032('0x47')][_0x2032('0x52')]){_0x2061e5[_0x2032('0x51')]=_[_0x2032('0x53')](_0x2061e5[_0x2032('0x51')],{'$or':_[_0x2032('0x41')](_0x51ca25,function(_0x394fad){if(_0x394fad[_0x2032('0x45')]!=='VIRTUAL'){var _0x18f19c={};_0x18f19c[_0x394fad[_0x2032('0x3e')]]={'$like':'%'+_0x50ffa5[_0x2032('0x47')][_0x2032('0x52')]+'%'};return _0x18f19c;}})});}_0x2061e5=_[_0x2032('0x53')]({},_0x2061e5,_0x50ffa5[_0x2032('0x54')]);var _0xb2a391={'where':_0x2061e5[_0x2032('0x51')]};return db[_0x2032('0x42')]['count'](_0xb2a391)[_0x2032('0x25')](function(_0x276ce0){_0x21c91c['count']=_0x276ce0;if(_0x50ffa5[_0x2032('0x47')][_0x2032('0x55')]){_0x2061e5[_0x2032('0x56')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x2032('0x57')](_0x2061e5);})[_0x2032('0x25')](function(_0x35f670){_0x21c91c['rows']=_0x35f670;return _0x21c91c;})[_0x2032('0x25')](respondWithFilteredResult(_0x1764ae,_0x2061e5))[_0x2032('0x30')](handleError(_0x1764ae,null));};exports[_0x2032('0x58')]=function(_0x46053d,_0x4f6f20){var _0x261e9a={'raw':!![],'where':{'id':_0x46053d[_0x2032('0x59')]['id']}},_0xec2d52={};_0xec2d52[_0x2032('0x4a')]=_[_0x2032('0x5a')](db[_0x2032('0x42')][_0x2032('0x43')]);_0xec2d52[_0x2032('0x47')]=_[_0x2032('0x5a')](_0x46053d['query']);_0xec2d52[_0x2032('0x48')]=_[_0x2032('0x49')](_0xec2d52[_0x2032('0x4a')],_0xec2d52[_0x2032('0x47')]);_0x261e9a['attributes']=_[_0x2032('0x49')](_0xec2d52[_0x2032('0x4a')],qs[_0x2032('0x4c')](_0x46053d['query'][_0x2032('0x4c')]));_0x261e9a[_0x2032('0x4b')]=_0x261e9a[_0x2032('0x4b')][_0x2032('0x4d')]?_0x261e9a['attributes']:_0xec2d52['model'];if(_0x46053d['query']['includeAll']){_0x261e9a[_0x2032('0x56')]=[{'all':!![]}];}_0x261e9a=_[_0x2032('0x53')]({},_0x261e9a,_0x46053d[_0x2032('0x54')]);return db[_0x2032('0x42')]['find'](_0x261e9a)[_0x2032('0x25')](handleEntityNotFound(_0x4f6f20,null))[_0x2032('0x25')](respondWithResult(_0x4f6f20,null))[_0x2032('0x30')](handleError(_0x4f6f20,null));};exports['create']=function(_0x5bb1ab,_0x13969f){return db[_0x2032('0x42')][_0x2032('0x5b')](_0x5bb1ab[_0x2032('0x5c')],{})[_0x2032('0x25')](respondWithResult(_0x13969f,0xc9))['catch'](handleError(_0x13969f,null));};exports['update']=function(_0xb8abc3,_0x2b74a6){if(_0xb8abc3['body']['id']){delete _0xb8abc3['body']['id'];}return db[_0x2032('0x42')][_0x2032('0x5d')]({'where':{'id':_0xb8abc3[_0x2032('0x59')]['id']}})[_0x2032('0x25')](handleEntityNotFound(_0x2b74a6,null))[_0x2032('0x25')](saveUpdates(_0xb8abc3[_0x2032('0x5c')],null))['then'](respondWithResult(_0x2b74a6,null))[_0x2032('0x30')](handleError(_0x2b74a6,null));};exports['destroy']=function(_0x5c83b4,_0x3ad5a1){return db[_0x2032('0x42')]['find']({'where':{'id':_0x5c83b4[_0x2032('0x59')]['id']}})[_0x2032('0x25')](handleEntityNotFound(_0x3ad5a1,null))['then'](removeEntity(_0x3ad5a1,null))[_0x2032('0x30')](handleError(_0x3ad5a1,null));};exports['describe']=function(_0x5db607,_0x2ae8f0){return db['OpenchannelMessage'][_0x2032('0x5e')]()['then'](respondWithResult(_0x2ae8f0,null))['catch'](handleError(_0x2ae8f0,null));};var interaction_log=require(_0x2032('0x16'))(_0x2032('0x5f'));exports['accept']=function(_0x305fd0,_0x4b9b8f,_0x11ed6e){var _0x56fe06={'channel':_0x2032('0x60')};if(_0x305fd0[_0x2032('0x5c')]['id']){delete _0x305fd0[_0x2032('0x5c')]['id'];}_0x305fd0[_0x2032('0x5c')]['read']=!![];_0x305fd0[_0x2032('0x5c')][_0x2032('0x61')]=moment()[_0x2032('0x62')](_0x2032('0x63'));_0x305fd0[_0x2032('0x5c')]['UserId']=_0x305fd0[_0x2032('0x5c')][_0x2032('0x64')]||_0x305fd0[_0x2032('0x65')]['id'];return db['OpenchannelMessage']['find']({'where':{'id':_0x305fd0[_0x2032('0x59')]['id'],'UserId':null},'include':[{'model':db[_0x2032('0x66')],'as':'Contact'}]})[_0x2032('0x25')](handleEntityNotFound(_0x4b9b8f,null))[_0x2032('0x25')](saveUpdates(_0x305fd0[_0x2032('0x5c')],null))[_0x2032('0x25')](function(_0xfec5eb){if(_0xfec5eb){_0x56fe06[_0x2032('0x2e')]=_0xfec5eb[_0x2032('0x67')]({'plain':!![]});return db[_0x2032('0x68')]['find']({'where':{'id':_0xfec5eb[_0x2032('0x69')]}});}return null;})[_0x2032('0x25')](handleEntityNotFound(_0x4b9b8f,null))[_0x2032('0x25')](function(_0x2f224c){if(_0x2f224c){return _0x2f224c[_0x2032('0x3b')]({'UserId':_0x305fd0[_0x2032('0x5c')][_0x2032('0x64')],'read1stAt':_[_0x2032('0x6a')](_0x2f224c[_0x2032('0x6b')])?moment()[_0x2032('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x2032('0x25')](function(_0x2218a2){if(_0x2218a2){_0x56fe06[_0x2032('0x6c')]=_0x2218a2['get']({'plain':!![]});interaction_log[_0x2032('0x26')](_0x2032('0x6d'),_0x305fd0[_0x2032('0x65')]['id'],_0x305fd0[_0x2032('0x65')][_0x2032('0x3e')],_0x305fd0[_0x2032('0x65')][_0x2032('0x6e')],_0x56fe06[_0x2032('0x6c')]['id'],_0x305fd0['body']?JSON[_0x2032('0x2b')](_0x305fd0[_0x2032('0x5c')]):_0x2032('0x6f'));return respondWithRpcPromise(_0x2032('0x70'),_0x2032('0x71'),_0x56fe06);}return null;})[_0x2032('0x25')](function(_0x1815be){if(_0x1815be){if(_0x305fd0['body'][_0x2032('0x72')]){_0x56fe06[_0x2032('0x2e')][_0x2032('0x73')]=util[_0x2032('0x62')](_0x2032('0x74'),_0x305fd0[_0x2032('0x65')][_0x2032('0x3e')]);_0x56fe06[_0x2032('0x2e')][_0x2032('0x75')]=_0x56fe06[_0x2032('0x75')];_0x56fe06[_0x2032('0x2e')][_0x2032('0x76')]=_0x2032('0x77');return respondWithRpcPromise(_0x2032('0x78'),'EventManager',{'event':_0x2032('0x79'),'message':_0x56fe06[_0x2032('0x2e')]},client9002)[_0x2032('0x25')](function(){return _0x56fe06;});}return _0x56fe06;}return null;})[_0x2032('0x25')](respondWithResult(_0x4b9b8f,null))[_0x2032('0x30')](handleError(_0x4b9b8f,null));};var interaction_log=require(_0x2032('0x16'))('openchannel-interactions');exports[_0x2032('0x39')]=function(_0x5d7bd2,_0x3f9f8a,_0x3002bd){var _0x3881d4={'agent':{},'channel':_0x2032('0x60')};if(_0x5d7bd2[_0x2032('0x5c')]['id']){delete _0x5d7bd2[_0x2032('0x5c')]['id'];}_0x5d7bd2[_0x2032('0x5c')]['UserId']=_0x5d7bd2[_0x2032('0x5c')][_0x2032('0x64')]||_0x5d7bd2[_0x2032('0x65')]['id'];_0x3881d4[_0x2032('0x7a')]['id']=_0x5d7bd2[_0x2032('0x5c')][_0x2032('0x64')];return db['OpenchannelMessage'][_0x2032('0x5d')]({'where':{'id':_0x5d7bd2[_0x2032('0x59')]['id'],'UserId':null}})[_0x2032('0x25')](handleEntityNotFound(_0x3f9f8a,null))[_0x2032('0x25')](function(_0x26dbcd){if(_0x26dbcd){_0x3881d4[_0x2032('0x2e')]=_0x26dbcd[_0x2032('0x67')]({'plain':!![]});return db[_0x2032('0x68')][_0x2032('0x5d')]({'where':{'id':_0x26dbcd[_0x2032('0x69')]}});}return null;})[_0x2032('0x25')](handleEntityNotFound(_0x3f9f8a,null))[_0x2032('0x25')](function(_0x312e02){if(_0x312e02){_0x3881d4[_0x2032('0x6c')]=_0x312e02[_0x2032('0x67')]({'plain':!![]});interaction_log[_0x2032('0x26')](_0x2032('0x7b'),_0x5d7bd2['user']['id'],_0x5d7bd2['user'][_0x2032('0x3e')],_0x5d7bd2[_0x2032('0x65')][_0x2032('0x6e')],_0x3881d4[_0x2032('0x6c')]['id'],_0x5d7bd2[_0x2032('0x5c')]?JSON[_0x2032('0x2b')](_0x5d7bd2['body']):_0x2032('0x6f'));return respondWithRpcPromise('RejectMessage',_0x2032('0x7c'),_0x3881d4);}return null;})[_0x2032('0x25')](function(_0x1f2c31){if(_0x1f2c31){_0x1f2c31[_0x2032('0x2e')][_0x2032('0x73')]=util[_0x2032('0x62')](_0x2032('0x74'),_0x5d7bd2['user'][_0x2032('0x3e')]);_0x1f2c31[_0x2032('0x2e')][_0x2032('0x75')]=_0x3881d4[_0x2032('0x75')];_0x1f2c31[_0x2032('0x2e')][_0x2032('0x76')]='reject';respondWithRpcPromise(_0x2032('0x78'),'EventManager',{'event':_0x2032('0x7d'),'message':_0x1f2c31[_0x2032('0x2e')]},client9002);return _0x3881d4;}return null;})[_0x2032('0x25')](respondWithResult(_0x3f9f8a,null))[_0x2032('0x30')](handleError(_0x3f9f8a,null));}; \ No newline at end of file +var _0xc44c=['includeAll','findAll','rows','params','keys','length','find','create','body','describe','openchannel-interactions','openchannel','read','readAt','format','UserId','user','CmContact','Contact','OpenchannelInteraction','update','read1stAt','YYYY-MM-DD\x20HH:mm:ss','get','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','reject','agent','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectmessage','html-pdf','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','count','offset','limit','set','Content-Range','apply','then','destroy','sendStatus','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options'];(function(_0x190955,_0x4e4272){var _0x1fe69b=function(_0x16d5ca){while(--_0x16d5ca){_0x190955['push'](_0x190955['shift']());}};_0x1fe69b(++_0x4e4272);}(_0xc44c,0x192));var _0xcc44=function(_0x520733,_0x45f647){_0x520733=_0x520733-0x0;var _0x58fdf1=_0xc44c[_0x520733];return _0x58fdf1;};'use strict';var pdf=require(_0xcc44('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcc44('0x1'));var rp=require(_0xcc44('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcc44('0x3'));var util=require('util');var path=require(_0xcc44('0x4'));var sox=require(_0xcc44('0x5'));var csv=require(_0xcc44('0x6'));var ejs=require(_0xcc44('0x7'));var fs=require('fs');var _=require(_0xcc44('0x8'));var squel=require(_0xcc44('0x9'));var crypto=require(_0xcc44('0xa'));var jsforce=require(_0xcc44('0xb'));var deskjs=require(_0xcc44('0xc'));var toCsv=require(_0xcc44('0x6'));var querystring=require(_0xcc44('0xd'));var Papa=require(_0xcc44('0xe'));var Redis=require(_0xcc44('0xf'));var authService=require(_0xcc44('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xcc44('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc44('0x12'))(_0xcc44('0x13'));var utils=require(_0xcc44('0x14'));var config=require(_0xcc44('0x15'));var db=require(_0xcc44('0x16'))['db'];config[_0xcc44('0x17')]=_['defaults'](config[_0xcc44('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xcc44('0x18'))(new Redis(config[_0xcc44('0x17')]));require(_0xcc44('0x19'))[_0xcc44('0x1a')](socket);var jayson=require(_0xcc44('0x1b'));var client=jayson[_0xcc44('0x1c')][_0xcc44('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xcc44('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x47ca54,_0x42b9c1,_0x1fb411){if(_0x1fb411){var _0x2a906d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a906d['test'](_0x42b9c1)){return _0x47ca54;}else{throw new db[(_0xcc44('0x1e'))][(_0xcc44('0x1f'))](_0xcc44('0x20'));}}else{return _0x47ca54;}}function respondWithRpcPromise(_0x42f2c7,_0x5ea7e0,_0x25ae62,_0x41ad80){return new BPromise(function(_0x2db47a,_0x5d56b1){var _0x3f6819=_0x41ad80||client;return _0x3f6819['request'](_0x42f2c7,_0x25ae62)['then'](function(_0x4ebbc9){logger[_0xcc44('0x21')](_0xcc44('0x22'),_0x5ea7e0,_0xcc44('0x23'));logger['debug'](_0xcc44('0x24'),_0x5ea7e0,_0xcc44('0x23'),JSON[_0xcc44('0x25')](_0x4ebbc9));if(_0x4ebbc9[_0xcc44('0x26')]){if(_0x4ebbc9[_0xcc44('0x26')][_0xcc44('0x27')]===0x1f4){logger[_0xcc44('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x5ea7e0,_0x4ebbc9[_0xcc44('0x26')]['message']);return _0x5d56b1(_0x4ebbc9[_0xcc44('0x26')]['message']);}logger[_0xcc44('0x26')](_0xcc44('0x22'),_0x5ea7e0,_0x4ebbc9[_0xcc44('0x26')][_0xcc44('0x28')]);return _0x2db47a(_0x4ebbc9[_0xcc44('0x26')][_0xcc44('0x28')]);}else{logger[_0xcc44('0x21')](_0xcc44('0x22'),_0x5ea7e0,_0xcc44('0x23'));_0x2db47a(_0x4ebbc9['result']['message']);}})[_0xcc44('0x29')](function(_0x33c3e2){logger['error'](_0xcc44('0x22'),_0x5ea7e0,_0x33c3e2);_0x5d56b1(_0x33c3e2);});});}function respondWithStatusCode(_0x56e8b3,_0x104b21){_0x104b21=_0x104b21||0xcc;return function(_0x295d6c){if(_0x295d6c){return _0x56e8b3['sendStatus'](_0x104b21);}return _0x56e8b3[_0xcc44('0x2a')](_0x104b21)[_0xcc44('0x2b')]();};}function respondWithResult(_0x104d05,_0x43933c){_0x43933c=_0x43933c||0xc8;return function(_0x434f1f){if(_0x434f1f){return _0x104d05['status'](_0x43933c)[_0xcc44('0x2c')](_0x434f1f);}};}function respondWithFilteredResult(_0x171ab2,_0x499ebc){return function(_0x413bea){if(_0x413bea){var _0x5c6fbc=_0x413bea[_0xcc44('0x2d')],_0x152b7c=_0x499ebc[_0xcc44('0x2e')],_0xd35280=_0x499ebc[_0xcc44('0x2e')]+_0x499ebc[_0xcc44('0x2f')],_0x356625;if(_0xd35280>=_0x5c6fbc){_0xd35280=_0x5c6fbc;_0x356625=0xc8;}else{_0x356625=0xce;}_0x171ab2[_0xcc44('0x2a')](_0x356625);return _0x171ab2[_0xcc44('0x30')](_0xcc44('0x31'),_0x152b7c+'-'+_0xd35280+'/'+_0x5c6fbc)[_0xcc44('0x2c')](_0x413bea);}return null;};}function patchUpdates(_0x43e101){return function(_0xc12ad){try{jsonpatch[_0xcc44('0x32')](_0xc12ad,_0x43e101,!![]);}catch(_0x5357e9){return BPromise['reject'](_0x5357e9);}return _0xc12ad['save']();};}function saveUpdates(_0x494388,_0x5d66da){return function(_0x174f78){if(_0x174f78){return _0x174f78['update'](_0x494388)[_0xcc44('0x33')](function(_0x5a8f99){return _0x5a8f99;});}return null;};}function removeEntity(_0x28ca30,_0x23a481){return function(_0x4677be){if(_0x4677be){return _0x4677be[_0xcc44('0x34')]()[_0xcc44('0x33')](function(){_0x28ca30[_0xcc44('0x2a')](0xcc)[_0xcc44('0x2b')]();});}};}function handleEntityNotFound(_0x1fa00a,_0x489480){return function(_0x2183d4){if(!_0x2183d4){_0x1fa00a[_0xcc44('0x35')](0x194);}return _0x2183d4;};}function handleError(_0x6350bb,_0x14fe58){_0x14fe58=_0x14fe58||0x1f4;return function(_0x3586f8){logger[_0xcc44('0x26')](_0x3586f8[_0xcc44('0x36')]);if(_0x3586f8[_0xcc44('0x37')]){delete _0x3586f8['name'];}_0x6350bb[_0xcc44('0x2a')](_0x14fe58)[_0xcc44('0x38')](_0x3586f8);};}exports[_0xcc44('0x39')]=function(_0x1bd675,_0x25d054){var _0x114f63={},_0x28c12f={},_0x48ea32={'count':0x0,'rows':[]};var _0x20db04=_['map'](db[_0xcc44('0x3a')][_0xcc44('0x3b')],function(_0x223ade){return{'name':_0x223ade[_0xcc44('0x3c')],'type':_0x223ade['type'][_0xcc44('0x3d')]};});_0x28c12f[_0xcc44('0x3e')]=_[_0xcc44('0x3f')](_0x20db04,_0xcc44('0x37'));_0x28c12f['query']=_['keys'](_0x1bd675[_0xcc44('0x40')]);_0x28c12f[_0xcc44('0x41')]=_[_0xcc44('0x42')](_0x28c12f[_0xcc44('0x3e')],_0x28c12f[_0xcc44('0x40')]);_0x114f63[_0xcc44('0x43')]=_['intersection'](_0x28c12f[_0xcc44('0x3e')],qs[_0xcc44('0x44')](_0x1bd675[_0xcc44('0x40')][_0xcc44('0x44')]));_0x114f63['attributes']=_0x114f63['attributes']['length']?_0x114f63[_0xcc44('0x43')]:_0x28c12f['model'];if(!_0x1bd675[_0xcc44('0x40')][_0xcc44('0x45')](_0xcc44('0x46'))){_0x114f63['limit']=qs[_0xcc44('0x2f')](_0x1bd675[_0xcc44('0x40')][_0xcc44('0x2f')]);_0x114f63['offset']=qs[_0xcc44('0x2e')](_0x1bd675[_0xcc44('0x40')][_0xcc44('0x2e')]);}_0x114f63[_0xcc44('0x47')]=qs[_0xcc44('0x48')](_0x1bd675['query'][_0xcc44('0x48')]);_0x114f63['where']=qs[_0xcc44('0x41')](_[_0xcc44('0x49')](_0x1bd675['query'],_0x28c12f['filters']),_0x20db04);if(_0x1bd675[_0xcc44('0x40')][_0xcc44('0x4a')]){_0x114f63['where']=_['merge'](_0x114f63[_0xcc44('0x4b')],{'$or':_[_0xcc44('0x3f')](_0x20db04,function(_0x3eec61){if(_0x3eec61['type']!=='VIRTUAL'){var _0xf0b9e4={};_0xf0b9e4[_0x3eec61[_0xcc44('0x37')]]={'$like':'%'+_0x1bd675['query'][_0xcc44('0x4a')]+'%'};return _0xf0b9e4;}})});}_0x114f63=_[_0xcc44('0x4c')]({},_0x114f63,_0x1bd675[_0xcc44('0x4d')]);var _0x4360d3={'where':_0x114f63[_0xcc44('0x4b')]};return db['OpenchannelMessage'][_0xcc44('0x2d')](_0x4360d3)[_0xcc44('0x33')](function(_0x52439d){_0x48ea32[_0xcc44('0x2d')]=_0x52439d;if(_0x1bd675['query'][_0xcc44('0x4e')]){_0x114f63['include']=[{'all':!![]}];}return db[_0xcc44('0x3a')][_0xcc44('0x4f')](_0x114f63);})[_0xcc44('0x33')](function(_0x597067){_0x48ea32[_0xcc44('0x50')]=_0x597067;return _0x48ea32;})[_0xcc44('0x33')](respondWithFilteredResult(_0x25d054,_0x114f63))[_0xcc44('0x29')](handleError(_0x25d054,null));};exports['show']=function(_0x56f359,_0x40a1f1){var _0x412bee={'raw':!![],'where':{'id':_0x56f359[_0xcc44('0x51')]['id']}},_0x513f2f={};_0x513f2f[_0xcc44('0x3e')]=_[_0xcc44('0x52')](db[_0xcc44('0x3a')][_0xcc44('0x3b')]);_0x513f2f['query']=_[_0xcc44('0x52')](_0x56f359[_0xcc44('0x40')]);_0x513f2f[_0xcc44('0x41')]=_[_0xcc44('0x42')](_0x513f2f['model'],_0x513f2f[_0xcc44('0x40')]);_0x412bee[_0xcc44('0x43')]=_[_0xcc44('0x42')](_0x513f2f[_0xcc44('0x3e')],qs[_0xcc44('0x44')](_0x56f359[_0xcc44('0x40')]['fields']));_0x412bee[_0xcc44('0x43')]=_0x412bee[_0xcc44('0x43')][_0xcc44('0x53')]?_0x412bee[_0xcc44('0x43')]:_0x513f2f[_0xcc44('0x3e')];if(_0x56f359[_0xcc44('0x40')]['includeAll']){_0x412bee['include']=[{'all':!![]}];}_0x412bee=_[_0xcc44('0x4c')]({},_0x412bee,_0x56f359[_0xcc44('0x4d')]);return db[_0xcc44('0x3a')][_0xcc44('0x54')](_0x412bee)[_0xcc44('0x33')](handleEntityNotFound(_0x40a1f1,null))[_0xcc44('0x33')](respondWithResult(_0x40a1f1,null))[_0xcc44('0x29')](handleError(_0x40a1f1,null));};exports[_0xcc44('0x55')]=function(_0x12763b,_0x435503){return db['OpenchannelMessage'][_0xcc44('0x55')](_0x12763b['body'],{})[_0xcc44('0x33')](respondWithResult(_0x435503,0xc9))[_0xcc44('0x29')](handleError(_0x435503,null));};exports['update']=function(_0x1c4c5f,_0x174c5f){if(_0x1c4c5f[_0xcc44('0x56')]['id']){delete _0x1c4c5f[_0xcc44('0x56')]['id'];}return db[_0xcc44('0x3a')][_0xcc44('0x54')]({'where':{'id':_0x1c4c5f['params']['id']}})[_0xcc44('0x33')](handleEntityNotFound(_0x174c5f,null))[_0xcc44('0x33')](saveUpdates(_0x1c4c5f[_0xcc44('0x56')],null))[_0xcc44('0x33')](respondWithResult(_0x174c5f,null))['catch'](handleError(_0x174c5f,null));};exports['destroy']=function(_0x8d3cd4,_0x53a57b){return db[_0xcc44('0x3a')]['find']({'where':{'id':_0x8d3cd4[_0xcc44('0x51')]['id']}})[_0xcc44('0x33')](handleEntityNotFound(_0x53a57b,null))[_0xcc44('0x33')](removeEntity(_0x53a57b,null))[_0xcc44('0x29')](handleError(_0x53a57b,null));};exports['describe']=function(_0x5724b2,_0x440ca9){return db[_0xcc44('0x3a')][_0xcc44('0x57')]()[_0xcc44('0x33')](respondWithResult(_0x440ca9,null))[_0xcc44('0x29')](handleError(_0x440ca9,null));};var interaction_log=require('../../config/logger')(_0xcc44('0x58'));exports['accept']=function(_0x54f13e,_0x14fbc2,_0x5d74a6){var _0x16de73={'channel':_0xcc44('0x59')};if(_0x54f13e[_0xcc44('0x56')]['id']){delete _0x54f13e[_0xcc44('0x56')]['id'];}_0x54f13e[_0xcc44('0x56')][_0xcc44('0x5a')]=!![];_0x54f13e[_0xcc44('0x56')][_0xcc44('0x5b')]=moment()[_0xcc44('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x54f13e[_0xcc44('0x56')][_0xcc44('0x5d')]=_0x54f13e['body']['UserId']||_0x54f13e[_0xcc44('0x5e')]['id'];return db[_0xcc44('0x3a')][_0xcc44('0x54')]({'where':{'id':_0x54f13e[_0xcc44('0x51')]['id'],'UserId':null},'include':[{'model':db[_0xcc44('0x5f')],'as':_0xcc44('0x60')}]})[_0xcc44('0x33')](handleEntityNotFound(_0x14fbc2,null))[_0xcc44('0x33')](saveUpdates(_0x54f13e[_0xcc44('0x56')],null))['then'](function(_0x25dcff){if(_0x25dcff){_0x16de73['message']=_0x25dcff['get']({'plain':!![]});return db[_0xcc44('0x61')][_0xcc44('0x54')]({'where':{'id':_0x25dcff['OpenchannelInteractionId']}});}return null;})[_0xcc44('0x33')](handleEntityNotFound(_0x14fbc2,null))['then'](function(_0x5cf134){if(_0x5cf134){return _0x5cf134[_0xcc44('0x62')]({'UserId':_0x54f13e[_0xcc44('0x56')][_0xcc44('0x5d')],'read1stAt':_['isNil'](_0x5cf134[_0xcc44('0x63')])?moment()[_0xcc44('0x5c')](_0xcc44('0x64')):undefined});}return null;})[_0xcc44('0x33')](function(_0x2b7256){if(_0x2b7256){_0x16de73['interaction']=_0x2b7256[_0xcc44('0x65')]({'plain':!![]});interaction_log[_0xcc44('0x21')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x54f13e[_0xcc44('0x5e')]['id'],_0x54f13e[_0xcc44('0x5e')][_0xcc44('0x37')],_0x54f13e[_0xcc44('0x5e')][_0xcc44('0x66')],_0x16de73['interaction']['id'],_0x54f13e[_0xcc44('0x56')]?JSON[_0xcc44('0x25')](_0x54f13e[_0xcc44('0x56')]):_0xcc44('0x67'));return respondWithRpcPromise(_0xcc44('0x68'),_0xcc44('0x69'),_0x16de73);}return null;})[_0xcc44('0x33')](function(_0x38932f){if(_0x38932f){if(_0x54f13e[_0xcc44('0x56')][_0xcc44('0x6a')]){_0x16de73[_0xcc44('0x28')][_0xcc44('0x6b')]=util[_0xcc44('0x5c')](_0xcc44('0x6c'),_0x54f13e[_0xcc44('0x5e')]['name']);_0x16de73[_0xcc44('0x28')]['channel']=_0x16de73[_0xcc44('0x6d')];_0x16de73[_0xcc44('0x28')][_0xcc44('0x6e')]=_0xcc44('0x6f');return respondWithRpcPromise(_0xcc44('0x70'),_0xcc44('0x70'),{'event':_0xcc44('0x71'),'message':_0x16de73[_0xcc44('0x28')]},client9002)[_0xcc44('0x33')](function(){return _0x16de73;});}return _0x16de73;}return null;})[_0xcc44('0x33')](respondWithResult(_0x14fbc2,null))['catch'](handleError(_0x14fbc2,null));};var interaction_log=require('../../config/logger')(_0xcc44('0x58'));exports[_0xcc44('0x72')]=function(_0x25f113,_0x48828e,_0x38451d){var _0x115f45={'agent':{},'channel':_0xcc44('0x59')};if(_0x25f113['body']['id']){delete _0x25f113[_0xcc44('0x56')]['id'];}_0x25f113[_0xcc44('0x56')][_0xcc44('0x5d')]=_0x25f113['body'][_0xcc44('0x5d')]||_0x25f113['user']['id'];_0x115f45[_0xcc44('0x73')]['id']=_0x25f113[_0xcc44('0x56')][_0xcc44('0x5d')];return db[_0xcc44('0x3a')]['find']({'where':{'id':_0x25f113[_0xcc44('0x51')]['id'],'UserId':null}})[_0xcc44('0x33')](handleEntityNotFound(_0x48828e,null))[_0xcc44('0x33')](function(_0x38ecb3){if(_0x38ecb3){_0x115f45[_0xcc44('0x28')]=_0x38ecb3[_0xcc44('0x65')]({'plain':!![]});return db['OpenchannelInteraction'][_0xcc44('0x54')]({'where':{'id':_0x38ecb3[_0xcc44('0x74')]}});}return null;})[_0xcc44('0x33')](handleEntityNotFound(_0x48828e,null))[_0xcc44('0x33')](function(_0x3b08e5){if(_0x3b08e5){_0x115f45[_0xcc44('0x75')]=_0x3b08e5[_0xcc44('0x65')]({'plain':!![]});interaction_log[_0xcc44('0x21')](_0xcc44('0x76'),_0x25f113[_0xcc44('0x5e')]['id'],_0x25f113[_0xcc44('0x5e')][_0xcc44('0x37')],_0x25f113[_0xcc44('0x5e')][_0xcc44('0x66')],_0x115f45[_0xcc44('0x75')]['id'],_0x25f113[_0xcc44('0x56')]?JSON[_0xcc44('0x25')](_0x25f113[_0xcc44('0x56')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x115f45);}return null;})[_0xcc44('0x33')](function(_0x1458c8){if(_0x1458c8){_0x1458c8['message'][_0xcc44('0x6b')]=util[_0xcc44('0x5c')](_0xcc44('0x6c'),_0x25f113[_0xcc44('0x5e')][_0xcc44('0x37')]);_0x1458c8['message'][_0xcc44('0x6d')]=_0x115f45[_0xcc44('0x6d')];_0x1458c8['message'][_0xcc44('0x6e')]=_0xcc44('0x72');respondWithRpcPromise(_0xcc44('0x70'),_0xcc44('0x70'),{'event':_0xcc44('0x77'),'message':_0x1458c8[_0xcc44('0x28')]},client9002);return _0x115f45;}return null;})[_0xcc44('0x33')](respondWithResult(_0x48828e,null))['catch'](handleError(_0x48828e,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 130a53c..49cab2c 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 _0xd385=['update','remove','emit','hasOwnProperty','hook','exports','events','OpenchannelMessage'];(function(_0x1b89e2,_0x4200e6){var _0x50503e=function(_0x7d2617){while(--_0x7d2617){_0x1b89e2['push'](_0x1b89e2['shift']());}};_0x50503e(++_0x4200e6);}(_0xd385,0x1e6));var _0x5d38=function(_0x4ed18c,_0x476c65){_0x4ed18c=_0x4ed18c-0x0;var _0x52dc88=_0xd385[_0x4ed18c];return _0x52dc88;};'use strict';var EventEmitter=require(_0x5d38('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x5d38('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5d38('0x2'),'afterDestroy':_0x5d38('0x3')};function emitEvent(_0x5959e5){return function(_0x5b0935,_0x5e44d1,_0x1e549e){OpenchannelMessageEvents[_0x5d38('0x4')](_0x5959e5+':'+_0x5b0935['id'],_0x5b0935);OpenchannelMessageEvents['emit'](_0x5959e5,_0x5b0935);_0x1e549e(null);};}for(var e in events){if(events[_0x5d38('0x5')](e)){var event=events[e];OpenchannelMessage[_0x5d38('0x6')](e,emitEvent(event));}}module[_0x5d38('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x6fc3=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x3c0b16,_0x217b15){var _0x13e003=function(_0x3d39de){while(--_0x3d39de){_0x3c0b16['push'](_0x3c0b16['shift']());}};_0x13e003(++_0x217b15);}(_0x6fc3,0x19b));var _0x36fc=function(_0x3dfcd3,_0x285730){_0x3dfcd3=_0x3dfcd3-0x0;var _0x172bc6=_0x6fc3[_0x3dfcd3];return _0x172bc6;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x36fc('0x0'))['db'][_0x36fc('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x36fc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x36fc('0x3'),'afterDestroy':_0x36fc('0x4')};function emitEvent(_0x37d50e){return function(_0x3186ea,_0x504476,_0x43abae){OpenchannelMessageEvents[_0x36fc('0x5')](_0x37d50e+':'+_0x3186ea['id'],_0x3186ea);OpenchannelMessageEvents['emit'](_0x37d50e,_0x3186ea);_0x43abae(null);};}for(var e in events){if(events[_0x36fc('0x6')](e)){var event=events[e];OpenchannelMessage[_0x36fc('0x7')](e,emitEvent(event));}}module[_0x36fc('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 9f198f0..aafc52a 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 _0xef39=['exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','catch','error','CmContact','then','Interactions','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','Contact','method','GET','POST','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes'];(function(_0x2d6dc4,_0x5e2d29){var _0x52991e=function(_0x5f2f0c){while(--_0x5f2f0c){_0x2d6dc4['push'](_0x2d6dc4['shift']());}};_0x52991e(++_0x5e2d29);}(_0xef39,0x92));var _0x9ef3=function(_0x526a36,_0x34cf0b){_0x526a36=_0x526a36-0x0;var _0x5ebf7b=_0xef39[_0x526a36];return _0x5ebf7b;};'use strict';var _=require('lodash');var util=require(_0x9ef3('0x0'));var logger=require(_0x9ef3('0x1'))(_0x9ef3('0x2'));var moment=require(_0x9ef3('0x3'));var BPromise=require(_0x9ef3('0x4'));var rp=require(_0x9ef3('0x5'));var fs=require('fs');var path=require(_0x9ef3('0x6'));var rimraf=require(_0x9ef3('0x7'));var config=require(_0x9ef3('0x8'));var attributes=require(_0x9ef3('0x9'));module[_0x9ef3('0xa')]=function(_0x42911f,_0x50b950){return _0x42911f[_0x9ef3('0xb')](_0x9ef3('0xc'),attributes,{'tableName':_0x9ef3('0xd'),'paranoid':![],'indexes':[{'name':_0x9ef3('0xe'),'fields':[_0x9ef3('0xf')],'type':_0x9ef3('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x228e82,_0x15ae4c,_0x388d02){var _0x268765=_0x42911f[_0x9ef3('0x11')];var _0xcacf18=_0x228e82[_0x9ef3('0x12')]({'plain':!![]});if(_0xcacf18['direction'][_0x9ef3('0x13')]()==='in'||_0xcacf18[_0x9ef3('0x14')][_0x9ef3('0x13')]()===_0x9ef3('0x15')&&!_0xcacf18[_0x9ef3('0x16')]&&!_[_0x9ef3('0x17')](_0xcacf18['UserId'])){_0x268765[_0x9ef3('0x18')][_0x9ef3('0x19')]({'where':{'id':_0xcacf18[_0x9ef3('0x1a')]}})['then'](function(_0x1c196d){if(_0x1c196d){_0x1c196d[_0x9ef3('0x1b')]({'lastMsgAt':_0xcacf18['createdAt'],'lastMsgDirection':_0xcacf18[_0x9ef3('0x14')][_0x9ef3('0x13')]()});}})[_0x9ef3('0x1c')](function(_0x236cef){console[_0x9ef3('0x1d')](_0x236cef);});}if(_0xcacf18[_0x9ef3('0x14')]==='out'&&!_0xcacf18[_0x9ef3('0x16')]){var _0x355dbb;_0x268765[_0x9ef3('0x1e')]['describe']()[_0x9ef3('0x1f')](function(_0x167e06){return _0x268765['OpenchannelAccount']['find']({'where':{'id':_0xcacf18['OpenchannelAccountId']},'include':[{'model':_0x268765[_0x9ef3('0x18')],'as':_0x9ef3('0x20'),'where':{'id':_0xcacf18['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x268765['CmContact'],'as':'Contact','attributes':_[_0x9ef3('0x21')](_0x167e06)}]}]});})['then'](function(_0x461687){_0x355dbb=_0x461687['get']({'plain':!![]});if(_0x355dbb&&_0x355dbb[_0x9ef3('0x22')]){logger[_0x9ef3('0x23')](_0x9ef3('0x24'),'afterCreate',util[_0x9ef3('0x25')](_0x9ef3('0x26'),_0xcacf18['id'],_0x355dbb[_0x9ef3('0x22')]));if(_0x355dbb['Interactions']&&_0x355dbb[_0x9ef3('0x20')][_0x9ef3('0x27')]){_0xcacf18[_0x9ef3('0x28')]=_[_0x9ef3('0x29')](_0x355dbb[_0x9ef3('0x20')][0x0],_0x9ef3('0x2a'));_0xcacf18['Contact']=_0x355dbb[_0x9ef3('0x20')][0x0][_0x9ef3('0x2a')];}var _0x15ae4c={'method':'POST','uri':encodeURI(_0x355dbb[_0x9ef3('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x15ae4c[_0x9ef3('0x2b')]){case _0x9ef3('0x2c'):_0x15ae4c['qs']=_0xcacf18;break;case _0x9ef3('0x2d'):_0x15ae4c[_0x9ef3('0xf')]=_0xcacf18;break;}return rp(_0x15ae4c)[_0x9ef3('0x1f')](function(_0xc618a1){logger[_0x9ef3('0x23')](_0x9ef3('0x24'),_0x9ef3('0x2e'),util['format'](_0x9ef3('0x2f'),_0xcacf18['id'],_0x355dbb['replyUri']));if(_0xc618a1[_0x9ef3('0xf')][_0x9ef3('0x30')]&&_0xc618a1[_0x9ef3('0xf')][_0x9ef3('0x30')]!=_0xcacf18[_0x9ef3('0x28')][_0x9ef3('0x30')]){return _0x268765[_0x9ef3('0x18')][_0x9ef3('0x1b')]({'threadId':_0xc618a1[_0x9ef3('0xf')][_0x9ef3('0x30')]},{'logging':!![],'where':{'id':_0xcacf18['Interaction']['id']}});}else{return;}})[_0x9ef3('0x1f')](function(){return _0x228e82[_0x9ef3('0x1b')]({'read':!![]});})['catch'](function(_0x3bab62){logger[_0x9ef3('0x1d')](_0x9ef3('0x24'),'afterCreate',util['inspect'](_0x3bab62,{'showHidden':![],'depth':null}));_0x388d02();});}else{_0x388d02();}})[_0x9ef3('0x31')](function(){_0x388d02();});}else{_0x388d02();}}},'charset':_0x9ef3('0x32'),'collate':_0x9ef3('0x33')});}; \ No newline at end of file +var _0xea89=['describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','length','Interaction','POST','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','afterCreate','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','error','secret','CmContact'];(function(_0x28eedc,_0x176917){var _0x575e59=function(_0x40f58d){while(--_0x40f58d){_0x28eedc['push'](_0x28eedc['shift']());}};_0x575e59(++_0x176917);}(_0xea89,0x1e2));var _0x9ea8=function(_0x5c4599,_0x2cf7e8){_0x5c4599=_0x5c4599-0x0;var _0x385968=_0xea89[_0x5c4599];return _0x385968;};'use strict';var _=require(_0x9ea8('0x0'));var util=require(_0x9ea8('0x1'));var logger=require(_0x9ea8('0x2'))(_0x9ea8('0x3'));var moment=require(_0x9ea8('0x4'));var BPromise=require('bluebird');var rp=require(_0x9ea8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ea8('0x6'));var config=require('../../config/environment');var attributes=require(_0x9ea8('0x7'));module[_0x9ea8('0x8')]=function(_0x2c6e50,_0x184f38){return _0x2c6e50[_0x9ea8('0x9')](_0x9ea8('0xa'),attributes,{'tableName':_0x9ea8('0xb'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x9ea8('0xc')],'type':_0x9ea8('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5209b6,_0x436faf,_0x254fe0){var _0x2de710=_0x2c6e50['models'];var _0x251150=_0x5209b6[_0x9ea8('0xe')]({'plain':!![]});if(_0x251150[_0x9ea8('0xf')][_0x9ea8('0x10')]()==='in'||_0x251150[_0x9ea8('0xf')][_0x9ea8('0x10')]()===_0x9ea8('0x11')&&!_0x251150['secret']&&!_[_0x9ea8('0x12')](_0x251150[_0x9ea8('0x13')])){_0x2de710[_0x9ea8('0x14')]['findOne']({'where':{'id':_0x251150[_0x9ea8('0x15')]}})[_0x9ea8('0x16')](function(_0x61f839){if(_0x61f839){_0x61f839[_0x9ea8('0x17')]({'lastMsgAt':_0x251150[_0x9ea8('0x18')],'lastMsgDirection':_0x251150[_0x9ea8('0xf')][_0x9ea8('0x10')]()});}})['catch'](function(_0x5226d5){console[_0x9ea8('0x19')](_0x5226d5);});}if(_0x251150[_0x9ea8('0xf')]==='out'&&!_0x251150[_0x9ea8('0x1a')]){var _0x558869;_0x2de710[_0x9ea8('0x1b')][_0x9ea8('0x1c')]()[_0x9ea8('0x16')](function(_0x475fcf){return _0x2de710[_0x9ea8('0x1d')][_0x9ea8('0x1e')]({'where':{'id':_0x251150[_0x9ea8('0x1f')]},'include':[{'model':_0x2de710['OpenchannelInteraction'],'as':_0x9ea8('0x20'),'where':{'id':_0x251150[_0x9ea8('0x15')]},'limit':0x1,'include':[{'model':_0x2de710[_0x9ea8('0x1b')],'as':_0x9ea8('0x21'),'attributes':_[_0x9ea8('0x22')](_0x475fcf)}]}]});})[_0x9ea8('0x16')](function(_0x7c7190){_0x558869=_0x7c7190[_0x9ea8('0xe')]({'plain':!![]});if(_0x558869&&_0x558869[_0x9ea8('0x23')]){logger[_0x9ea8('0x24')](_0x9ea8('0x25'),'afterCreate',util[_0x9ea8('0x26')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x251150['id'],_0x558869[_0x9ea8('0x23')]));if(_0x558869[_0x9ea8('0x20')]&&_0x558869[_0x9ea8('0x20')][_0x9ea8('0x27')]){_0x251150[_0x9ea8('0x28')]=_['omit'](_0x558869[_0x9ea8('0x20')][0x0],_0x9ea8('0x21'));_0x251150[_0x9ea8('0x21')]=_0x558869[_0x9ea8('0x20')][0x0][_0x9ea8('0x21')];}var _0x436faf={'method':_0x9ea8('0x29'),'uri':encodeURI(_0x558869['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x436faf['method']){case _0x9ea8('0x2a'):_0x436faf['qs']=_0x251150;break;case _0x9ea8('0x29'):_0x436faf['body']=_0x251150;break;}return rp(_0x436faf)[_0x9ea8('0x16')](function(_0x30a032){logger[_0x9ea8('0x24')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x9ea8('0x26')](_0x9ea8('0x2b'),_0x251150['id'],_0x558869[_0x9ea8('0x23')]));if(_0x30a032[_0x9ea8('0xc')]['threadId']&&_0x30a032['body'][_0x9ea8('0x2c')]!=_0x251150[_0x9ea8('0x28')][_0x9ea8('0x2c')]){return _0x2de710[_0x9ea8('0x14')][_0x9ea8('0x17')]({'threadId':_0x30a032[_0x9ea8('0xc')]['threadId']},{'logging':!![],'where':{'id':_0x251150[_0x9ea8('0x28')]['id']}});}else{return;}})[_0x9ea8('0x16')](function(){return _0x5209b6[_0x9ea8('0x17')]({'read':!![]});})[_0x9ea8('0x2d')](function(_0x185ee7){logger[_0x9ea8('0x19')](_0x9ea8('0x25'),_0x9ea8('0x2e'),util[_0x9ea8('0x2f')](_0x185ee7,{'showHidden':![],'depth':null}));_0x254fe0();});}else{_0x254fe0();}})[_0x9ea8('0x30')](function(){_0x254fe0();});}else{_0x254fe0();}}},'charset':_0x9ea8('0x31'),'collate':_0x9ea8('0x32')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 5a8c949..8f3fd9c 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 _0x431b=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','OpenchannelMessage','create','body','options','CreateOpenchannelMessage','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','./openchannelMessage.socket','register','then','info','request\x20sent','debug'];(function(_0x26e5d1,_0x1a645d){var _0x2b8a9f=function(_0x228868){while(--_0x228868){_0x26e5d1['push'](_0x26e5d1['shift']());}};_0x2b8a9f(++_0x1a645d);}(_0x431b,0x18d));var _0xb431=function(_0x10bd94,_0x46b509){_0x10bd94=_0x10bd94-0x0;var _0x364677=_0x431b[_0x10bd94];return _0x364677;};'use strict';var _=require(_0xb431('0x0'));var util=require(_0xb431('0x1'));var moment=require(_0xb431('0x2'));var BPromise=require('bluebird');var rs=require(_0xb431('0x3'));var fs=require('fs');var Redis=require(_0xb431('0x4'));var db=require(_0xb431('0x5'))['db'];var utils=require(_0xb431('0x6'));var logger=require(_0xb431('0x7'))(_0xb431('0x8'));var config=require(_0xb431('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb431('0xa')]['http']({'port':0x232a});config[_0xb431('0xb')]=_['defaults'](config['redis'],{'host':_0xb431('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb431('0xd'))[_0xb431('0xe')](socket);function respondWithRpcPromise(_0x437365,_0x24838c,_0x1015d0){return new BPromise(function(_0x1bdfd8,_0x413c63){return client['request'](_0x437365,_0x1015d0)[_0xb431('0xf')](function(_0x2eca4a){logger[_0xb431('0x10')]('OpenchannelMessage,\x20%s,\x20%s',_0x24838c,_0xb431('0x11'));logger[_0xb431('0x12')](_0xb431('0x13'),_0x24838c,_0xb431('0x11'),JSON[_0xb431('0x14')](_0x2eca4a));if(_0x2eca4a[_0xb431('0x15')]){if(_0x2eca4a['error'][_0xb431('0x16')]===0x1f4){logger['error'](_0xb431('0x17'),_0x24838c,_0x2eca4a[_0xb431('0x15')][_0xb431('0x18')]);return _0x413c63(_0x2eca4a[_0xb431('0x15')][_0xb431('0x18')]);}logger[_0xb431('0x15')]('OpenchannelMessage,\x20%s,\x20%s',_0x24838c,_0x2eca4a[_0xb431('0x15')]['message']);return _0x1bdfd8(_0x2eca4a[_0xb431('0x15')][_0xb431('0x18')]);}else{logger[_0xb431('0x10')](_0xb431('0x17'),_0x24838c,'request\x20sent');_0x1bdfd8(_0x2eca4a[_0xb431('0x19')][_0xb431('0x18')]);}})['catch'](function(_0x7c45dc){logger[_0xb431('0x15')]('OpenchannelMessage,\x20%s,\x20%s',_0x24838c,_0x7c45dc);_0x413c63(_0x7c45dc);});});}exports['CreateOpenchannelMessage']=function(_0x3c95c2){var _0x2823fe=this;return new Promise(function(_0x19a0c4,_0x21b18b){return db[_0xb431('0x1a')][_0xb431('0x1b')](_0x3c95c2[_0xb431('0x1c')],{'raw':_0x3c95c2[_0xb431('0x1d')]?_0x3c95c2['options']['raw']===undefined?!![]:![]:!![]})[_0xb431('0xf')](function(_0x38fac4){logger[_0xb431('0x10')](_0xb431('0x1e'),_0x3c95c2);logger[_0xb431('0x12')](_0xb431('0x1e'),_0x3c95c2,JSON[_0xb431('0x14')](_0x38fac4));_0x19a0c4(_0x38fac4);})[_0xb431('0x1f')](function(_0x424e1d){logger['error'](_0xb431('0x1e'),_0x424e1d[_0xb431('0x18')],_0x3c95c2);_0x21b18b(_0x2823fe[_0xb431('0x15')](0x1f4,_0x424e1d['message']));});});}; \ No newline at end of file +var _0xf811=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./openchannelMessage.socket','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw'];(function(_0x54b682,_0x11365c){var _0x1461e2=function(_0xf1cae2){while(--_0xf1cae2){_0x54b682['push'](_0x54b682['shift']());}};_0x1461e2(++_0x11365c);}(_0xf811,0x6f));var _0x1f81=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0xf811[_0x266618];return _0x54dbf5;};'use strict';var _=require(_0x1f81('0x0'));var util=require(_0x1f81('0x1'));var moment=require(_0x1f81('0x2'));var BPromise=require(_0x1f81('0x3'));var rs=require(_0x1f81('0x4'));var fs=require('fs');var Redis=require(_0x1f81('0x5'));var db=require(_0x1f81('0x6'))['db'];var utils=require(_0x1f81('0x7'));var logger=require(_0x1f81('0x8'))(_0x1f81('0x9'));var config=require(_0x1f81('0xa'));var jayson=require(_0x1f81('0xb'));var client=jayson[_0x1f81('0xc')][_0x1f81('0xd')]({'port':0x232a});config['redis']=_[_0x1f81('0xe')](config[_0x1f81('0xf')],{'host':_0x1f81('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1f81('0xf')]));require(_0x1f81('0x11'))['register'](socket);function respondWithRpcPromise(_0x2ce4d7,_0x56b05d,_0x1978e5){return new BPromise(function(_0xf59298,_0x12859d){return client[_0x1f81('0x12')](_0x2ce4d7,_0x1978e5)[_0x1f81('0x13')](function(_0x36ccd8){logger[_0x1f81('0x14')](_0x1f81('0x15'),_0x56b05d,_0x1f81('0x16'));logger[_0x1f81('0x17')](_0x1f81('0x18'),_0x56b05d,_0x1f81('0x16'),JSON[_0x1f81('0x19')](_0x36ccd8));if(_0x36ccd8[_0x1f81('0x1a')]){if(_0x36ccd8[_0x1f81('0x1a')][_0x1f81('0x1b')]===0x1f4){logger['error'](_0x1f81('0x15'),_0x56b05d,_0x36ccd8[_0x1f81('0x1a')]['message']);return _0x12859d(_0x36ccd8['error'][_0x1f81('0x1c')]);}logger[_0x1f81('0x1a')]('OpenchannelMessage,\x20%s,\x20%s',_0x56b05d,_0x36ccd8[_0x1f81('0x1a')][_0x1f81('0x1c')]);return _0xf59298(_0x36ccd8[_0x1f81('0x1a')][_0x1f81('0x1c')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x56b05d,_0x1f81('0x16'));_0xf59298(_0x36ccd8[_0x1f81('0x1d')]['message']);}})[_0x1f81('0x1e')](function(_0x5310fb){logger[_0x1f81('0x1a')](_0x1f81('0x15'),_0x56b05d,_0x5310fb);_0x12859d(_0x5310fb);});});}exports[_0x1f81('0x1f')]=function(_0x4beeae){var _0x275138=this;return new Promise(function(_0x3f0de8,_0x2d9b8d){return db[_0x1f81('0x20')][_0x1f81('0x21')](_0x4beeae[_0x1f81('0x22')],{'raw':_0x4beeae['options']?_0x4beeae[_0x1f81('0x23')][_0x1f81('0x24')]===undefined?!![]:![]:!![]})[_0x1f81('0x13')](function(_0x4ecfa9){logger['info'](_0x1f81('0x1f'),_0x4beeae);logger['debug'](_0x1f81('0x1f'),_0x4beeae,JSON['stringify'](_0x4ecfa9));_0x3f0de8(_0x4ecfa9);})['catch'](function(_0x34cdbc){logger['error'](_0x1f81('0x1f'),_0x34cdbc['message'],_0x4beeae);_0x2d9b8d(_0x275138[_0x1f81('0x1a')](0x1f4,_0x34cdbc[_0x1f81('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index dd3936a..cbceb4c 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 _0xb43b=['./openchannelMessage.events','save','update','emit','removeListener','length','openchannelMessage:'];(function(_0x12e6e5,_0x39855b){var _0x4ef6ce=function(_0x3e06f3){while(--_0x3e06f3){_0x12e6e5['push'](_0x12e6e5['shift']());}};_0x4ef6ce(++_0x39855b);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4071f0,_0x4e8121){_0x4071f0=_0x4071f0-0x0;var _0x42bec3=_0xb43b[_0x4071f0];return _0x42bec3;};'use strict';var OpenchannelMessageEvents=require(_0xbb43('0x0'));var events=[_0xbb43('0x1'),'remove',_0xbb43('0x2')];function createListener(_0x1995f8,_0x22bc86){return function(_0x4cf605){_0x22bc86[_0xbb43('0x3')](_0x1995f8,_0x4cf605);};}function removeListener(_0x41aff6,_0x351254){return function(){OpenchannelMessageEvents[_0xbb43('0x4')](_0x41aff6,_0x351254);};}exports['register']=function(_0x491fb9){for(var _0x378df5=0x0,_0x553520=events[_0xbb43('0x5')];_0x378df5<_0x553520;_0x378df5++){var _0x1ccd49=events[_0x378df5];var _0x2a2f11=createListener(_0xbb43('0x6')+_0x1ccd49,_0x491fb9);OpenchannelMessageEvents['on'](_0x1ccd49,_0x2a2f11);}}; \ No newline at end of file +var _0xd8b0=['save','emit','./openchannelMessage.events'];(function(_0x3bb7a4,_0x452b1a){var _0x59f56d=function(_0x25061c){while(--_0x25061c){_0x3bb7a4['push'](_0x3bb7a4['shift']());}};_0x59f56d(++_0x452b1a);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var OpenchannelMessageEvents=require(_0x0d8b('0x0'));var events=[_0x0d8b('0x1'),'remove','update'];function createListener(_0x4b72b0,_0x3ff8df){return function(_0x5b9b89){_0x3ff8df[_0x0d8b('0x2')](_0x4b72b0,_0x5b9b89);};}function removeListener(_0x364286,_0x8196ed){return function(){OpenchannelMessageEvents['removeListener'](_0x364286,_0x8196ed);};}exports['register']=function(_0x3f8b6f){for(var _0x227c63=0x0,_0x39f43a=events['length'];_0x227c63<_0x39f43a;_0x227c63++){var _0x413284=events[_0x227c63];var _0x284169=createListener('openchannelMessage:'+_0x413284,_0x3f8b6f);OpenchannelMessageEvents['on'](_0x413284,_0x284169);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index f3743c9..8fe29fb 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 _0x3663=['show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addAgents','put','update','destroy','delete','removeAgents','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0xb963a8,_0xbdb5bb){var _0x1000da=function(_0x5a3775){while(--_0x5a3775){_0xb963a8['push'](_0xb963a8['shift']());}};_0x1000da(++_0xbdb5bb);}(_0x3663,0x1cf));var _0x3366=function(_0x51e66d,_0x35cf5f){_0x51e66d=_0x51e66d-0x0;var _0x50710c=_0x3663[_0x51e66d];return _0x50710c;};'use strict';var multer=require(_0x3366('0x0'));var util=require(_0x3366('0x1'));var path=require(_0x3366('0x2'));var timeout=require('connect-timeout');var express=require(_0x3366('0x3'));var router=express[_0x3366('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3366('0x5'));var config=require(_0x3366('0x6'));var controller=require(_0x3366('0x7'));router[_0x3366('0x8')]('/',auth[_0x3366('0x9')](),controller['index']);router[_0x3366('0x8')](_0x3366('0xa'),auth['isAuthenticated'](),controller[_0x3366('0xb')]);router[_0x3366('0x8')](_0x3366('0xc'),auth['isAuthenticated'](),controller[_0x3366('0xd')]);router[_0x3366('0x8')](_0x3366('0xe'),auth['isAuthenticated'](),controller[_0x3366('0xf')]);router[_0x3366('0x8')](_0x3366('0x10'),auth[_0x3366('0x9')](),controller[_0x3366('0x11')]);router[_0x3366('0x8')](_0x3366('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0x3366('0x13')]('/',auth[_0x3366('0x9')](),controller[_0x3366('0x14')]);router[_0x3366('0x13')](_0x3366('0x10'),auth[_0x3366('0x9')](),controller['addTeams']);router['post'](_0x3366('0x12'),auth['isAuthenticated'](),controller[_0x3366('0x15')]);router[_0x3366('0x16')](_0x3366('0xc'),auth[_0x3366('0x9')](),controller[_0x3366('0x17')]);router['delete'](_0x3366('0xc'),auth[_0x3366('0x9')](),controller[_0x3366('0x18')]);router[_0x3366('0x19')](_0x3366('0x10'),auth[_0x3366('0x9')](),controller['removeTeams']);router['delete'](_0x3366('0x12'),auth['isAuthenticated'](),controller[_0x3366('0x1a')]);module[_0x3366('0x1b')]=router; \ No newline at end of file +var _0x9b97=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','update','delete','destroy','multer','path'];(function(_0x453421,_0x417702){var _0x4ee8e5=function(_0x4df9b3){while(--_0x4df9b3){_0x453421['push'](_0x453421['shift']());}};_0x4ee8e5(++_0x417702);}(_0x9b97,0x11e));var _0x79b9=function(_0x56bea1,_0x517ff5){_0x56bea1=_0x56bea1-0x0;var _0x348cb1=_0x9b97[_0x56bea1];return _0x348cb1;};'use strict';var multer=require(_0x79b9('0x0'));var util=require('util');var path=require(_0x79b9('0x1'));var timeout=require(_0x79b9('0x2'));var express=require(_0x79b9('0x3'));var router=express[_0x79b9('0x4')]();var auth=require(_0x79b9('0x5'));var interaction=require(_0x79b9('0x6'));var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0x79b9('0x7')]('/',auth[_0x79b9('0x8')](),controller[_0x79b9('0x9')]);router['get'](_0x79b9('0xa'),auth[_0x79b9('0x8')](),controller['describe']);router[_0x79b9('0x7')](_0x79b9('0xb'),auth[_0x79b9('0x8')](),controller[_0x79b9('0xc')]);router[_0x79b9('0x7')]('/:id/members',auth['isAuthenticated'](),controller[_0x79b9('0xd')]);router[_0x79b9('0x7')](_0x79b9('0xe'),auth[_0x79b9('0x8')](),controller[_0x79b9('0xf')]);router[_0x79b9('0x7')](_0x79b9('0x10'),auth[_0x79b9('0x8')](),controller[_0x79b9('0x11')]);router[_0x79b9('0x12')]('/',auth[_0x79b9('0x8')](),controller['create']);router[_0x79b9('0x12')](_0x79b9('0xe'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0x79b9('0x10'),auth[_0x79b9('0x8')](),controller[_0x79b9('0x13')]);router[_0x79b9('0x14')](_0x79b9('0xb'),auth['isAuthenticated'](),controller[_0x79b9('0x15')]);router[_0x79b9('0x16')](_0x79b9('0xb'),auth[_0x79b9('0x8')](),controller[_0x79b9('0x17')]);router[_0x79b9('0x16')](_0x79b9('0xe'),auth[_0x79b9('0x8')](),controller['removeTeams']);router[_0x79b9('0x16')](_0x79b9('0x10'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 9f92a1c..e1afed4 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 _0x9bd7=['STRING','name','INTEGER','ENUM','beepall','roundrobin','sequelize','exports'];(function(_0x3bb899,_0x52de1e){var _0x585a71=function(_0x39aca1){while(--_0x39aca1){_0x3bb899['push'](_0x3bb899['shift']());}};_0x585a71(++_0x52de1e);}(_0x9bd7,0x106));var _0x79bd=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9bd7[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x79bd('0x0'));module[_0x79bd('0x1')]={'name':{'type':Sequelize[_0x79bd('0x2')],'unique':_0x79bd('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x79bd('0x2')]},'timeout':{'type':Sequelize[_0x79bd('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x79bd('0x5')]('rrmemory',_0x79bd('0x6'),_0x79bd('0x7'))}}; \ No newline at end of file +var _0x6c64=['exports','STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x3296bc,_0xca935f){var _0x1e2c6b=function(_0x1778f4){while(--_0x1778f4){_0x3296bc['push'](_0x3296bc['shift']());}};_0x1e2c6b(++_0xca935f);}(_0x6c64,0xdf));var _0x46c6=function(_0x41f50a,_0x5bae61){_0x41f50a=_0x41f50a-0x0;var _0x2e529c=_0x6c64[_0x41f50a];return _0x2e529c;};'use strict';var Sequelize=require(_0x46c6('0x0'));module[_0x46c6('0x1')]={'name':{'type':Sequelize[_0x46c6('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x46c6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x46c6('0x4')](_0x46c6('0x5'),'beepall',_0x46c6('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 179e904..0210b5c 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 _0xca47=['eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','OpenchannelQueues','UserProfileResource','destroy','sendStatus','error','stack','name','send','map','OpenchannelQueue','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','role','UserProfileSection','userProfileId','describe','getMembers','UserOpenchannelQueue','nolimit','OpenchannelQueueId','UserId','agent','openchannelPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','User','Agents','online','interface','flatMap','sequelize','transaction','addTeams','each','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','union','compact','isEmpty','userOpenchannelQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','findOne'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0xca47,0x120));var _0x7ca4=function(_0x2a2fda,_0x217cda){_0x2a2fda=_0x2a2fda-0x0;var _0x3a91b4=_0xca47[_0x2a2fda];return _0x3a91b4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7ca4('0x0'));var rimraf=require(_0x7ca4('0x1'));var zipdir=require(_0x7ca4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7ca4('0x3'));var moment=require(_0x7ca4('0x4'));var BPromise=require(_0x7ca4('0x5'));var Mustache=require(_0x7ca4('0x6'));var util=require(_0x7ca4('0x7'));var path=require('path');var sox=require(_0x7ca4('0x8'));var csv=require(_0x7ca4('0x9'));var ejs=require(_0x7ca4('0xa'));var fs=require('fs');var _=require(_0x7ca4('0xb'));var squel=require(_0x7ca4('0xc'));var crypto=require(_0x7ca4('0xd'));var jsforce=require(_0x7ca4('0xe'));var deskjs=require(_0x7ca4('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7ca4('0x10'));var Papa=require(_0x7ca4('0x11'));var Redis=require(_0x7ca4('0x12'));var authService=require(_0x7ca4('0x13'));var qs=require(_0x7ca4('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ca4('0x15'));var logger=require(_0x7ca4('0x16'))('api');var utils=require(_0x7ca4('0x17'));var config=require('../../config/environment');var db=require(_0x7ca4('0x18'))['db'];config[_0x7ca4('0x19')]=_[_0x7ca4('0x1a')](config[_0x7ca4('0x19')],{'host':_0x7ca4('0x1b'),'port':0x18eb});var socket=require(_0x7ca4('0x1c'))(new Redis(config[_0x7ca4('0x19')]));require(_0x7ca4('0x1d'))[_0x7ca4('0x1e')](socket);function respondWithStatusCode(_0x24d5fa,_0x292217){_0x292217=_0x292217||0xcc;return function(_0x157691){if(_0x157691){return _0x24d5fa['sendStatus'](_0x292217);}return _0x24d5fa[_0x7ca4('0x1f')](_0x292217)[_0x7ca4('0x20')]();};}function respondWithResult(_0x2bafe7,_0x3e7d9a){_0x3e7d9a=_0x3e7d9a||0xc8;return function(_0x5d9c99){if(_0x5d9c99){return _0x2bafe7[_0x7ca4('0x1f')](_0x3e7d9a)[_0x7ca4('0x21')](_0x5d9c99);}};}function respondWithFilteredResult(_0x42d7f8,_0x478790){return function(_0x2f20cd){if(_0x2f20cd){var _0x8e29a8=_0x2f20cd['count'],_0x261a93=_0x478790[_0x7ca4('0x22')],_0x246d8b=_0x478790[_0x7ca4('0x22')]+_0x478790[_0x7ca4('0x23')],_0x48544d;if(_0x246d8b>=_0x8e29a8){_0x246d8b=_0x8e29a8;_0x48544d=0xc8;}else{_0x48544d=0xce;}_0x42d7f8[_0x7ca4('0x1f')](_0x48544d);return _0x42d7f8[_0x7ca4('0x24')](_0x7ca4('0x25'),_0x261a93+'-'+_0x246d8b+'/'+_0x8e29a8)[_0x7ca4('0x21')](_0x2f20cd);}return null;};}function patchUpdates(_0x1d2283){return function(_0x532d7e){try{jsonpatch[_0x7ca4('0x26')](_0x532d7e,_0x1d2283,!![]);}catch(_0x2b1a89){return BPromise[_0x7ca4('0x27')](_0x2b1a89);}return _0x532d7e[_0x7ca4('0x28')]();};}function saveUpdates(_0x3fc280,_0x6f867e){return function(_0x63600e){if(_0x63600e){return _0x63600e[_0x7ca4('0x29')](_0x3fc280)[_0x7ca4('0x2a')](function(_0x208372){return _0x208372;});}return null;};}function removeEntity(_0x471672,_0x5aba48){return function(_0x119268){if(_0x119268){return _0x119268['destroy']()[_0x7ca4('0x2a')](function(){var _0x1c5145=_0x119268[_0x7ca4('0x2b')]({'plain':!![]});var _0xcd6ea1=_0x7ca4('0x2c');return db[_0x7ca4('0x2d')][_0x7ca4('0x2e')]({'where':{'type':_0xcd6ea1,'resourceId':_0x1c5145['id']}})[_0x7ca4('0x2a')](function(){return _0x119268;});})[_0x7ca4('0x2a')](function(){_0x471672[_0x7ca4('0x1f')](0xcc)[_0x7ca4('0x20')]();});}};}function handleEntityNotFound(_0x50d2d4,_0x50b4ce){return function(_0x5dea80){if(!_0x5dea80){_0x50d2d4[_0x7ca4('0x2f')](0x194);}return _0x5dea80;};}function handleError(_0x4d6c03,_0x4e364c){_0x4e364c=_0x4e364c||0x1f4;return function(_0x40187e){logger[_0x7ca4('0x30')](_0x40187e[_0x7ca4('0x31')]);if(_0x40187e[_0x7ca4('0x32')]){delete _0x40187e[_0x7ca4('0x32')];}_0x4d6c03[_0x7ca4('0x1f')](_0x4e364c)[_0x7ca4('0x33')](_0x40187e);};}exports['index']=function(_0x18ad3c,_0x3b8db2){var _0x3ad150={},_0x22b09b={},_0x257473={'count':0x0,'rows':[]};var _0x1ee02c=_[_0x7ca4('0x34')](db[_0x7ca4('0x35')]['rawAttributes'],function(_0x2d3072){return{'name':_0x2d3072['fieldName'],'type':_0x2d3072[_0x7ca4('0x36')][_0x7ca4('0x37')]};});_0x22b09b[_0x7ca4('0x38')]=_[_0x7ca4('0x34')](_0x1ee02c,'name');_0x22b09b[_0x7ca4('0x39')]=_[_0x7ca4('0x3a')](_0x18ad3c['query']);_0x22b09b['filters']=_[_0x7ca4('0x3b')](_0x22b09b[_0x7ca4('0x38')],_0x22b09b['query']);_0x3ad150['attributes']=_[_0x7ca4('0x3b')](_0x22b09b[_0x7ca4('0x38')],qs[_0x7ca4('0x3c')](_0x18ad3c[_0x7ca4('0x39')][_0x7ca4('0x3c')]));_0x3ad150[_0x7ca4('0x3d')]=_0x3ad150[_0x7ca4('0x3d')][_0x7ca4('0x3e')]?_0x3ad150[_0x7ca4('0x3d')]:_0x22b09b[_0x7ca4('0x38')];if(!_0x18ad3c['query'][_0x7ca4('0x3f')]('nolimit')){_0x3ad150[_0x7ca4('0x23')]=qs[_0x7ca4('0x23')](_0x18ad3c['query']['limit']);_0x3ad150[_0x7ca4('0x22')]=qs[_0x7ca4('0x22')](_0x18ad3c[_0x7ca4('0x39')]['offset']);}_0x3ad150[_0x7ca4('0x40')]=qs[_0x7ca4('0x41')](_0x18ad3c[_0x7ca4('0x39')]['sort']);_0x3ad150[_0x7ca4('0x42')]=qs['filters'](_[_0x7ca4('0x43')](_0x18ad3c[_0x7ca4('0x39')],_0x22b09b[_0x7ca4('0x44')]),_0x1ee02c);if(_0x18ad3c['query'][_0x7ca4('0x45')]){_0x3ad150[_0x7ca4('0x42')]=_[_0x7ca4('0x46')](_0x3ad150[_0x7ca4('0x42')],{'$or':_[_0x7ca4('0x34')](_0x1ee02c,function(_0x499cf7){if(_0x499cf7[_0x7ca4('0x36')]!==_0x7ca4('0x47')){var _0x247f7a={};_0x247f7a[_0x499cf7['name']]={'$like':'%'+_0x18ad3c[_0x7ca4('0x39')][_0x7ca4('0x45')]+'%'};return _0x247f7a;}})});}_0x3ad150=_['merge']({},_0x3ad150,_0x18ad3c[_0x7ca4('0x48')]);var _0x4ce4a8={'where':_0x3ad150[_0x7ca4('0x42')]};return db['OpenchannelQueue'][_0x7ca4('0x49')](_0x4ce4a8)[_0x7ca4('0x2a')](function(_0x348324){_0x257473[_0x7ca4('0x49')]=_0x348324;if(_0x18ad3c[_0x7ca4('0x39')][_0x7ca4('0x4a')]){_0x3ad150[_0x7ca4('0x4b')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x7ca4('0x4c')](_0x3ad150);})[_0x7ca4('0x2a')](function(_0x34d128){_0x257473[_0x7ca4('0x4d')]=_0x34d128;return _0x257473;})['then'](respondWithFilteredResult(_0x3b8db2,_0x3ad150))[_0x7ca4('0x4e')](handleError(_0x3b8db2,null));};exports[_0x7ca4('0x4f')]=function(_0xa51e77,_0x591864){var _0x534746={'raw':!![],'where':{'id':_0xa51e77[_0x7ca4('0x50')]['id']}},_0x5e8c0c={};_0x5e8c0c['model']=_[_0x7ca4('0x3a')](db[_0x7ca4('0x35')][_0x7ca4('0x51')]);_0x5e8c0c[_0x7ca4('0x39')]=_[_0x7ca4('0x3a')](_0xa51e77[_0x7ca4('0x39')]);_0x5e8c0c[_0x7ca4('0x44')]=_[_0x7ca4('0x3b')](_0x5e8c0c[_0x7ca4('0x38')],_0x5e8c0c[_0x7ca4('0x39')]);_0x534746[_0x7ca4('0x3d')]=_['intersection'](_0x5e8c0c[_0x7ca4('0x38')],qs[_0x7ca4('0x3c')](_0xa51e77[_0x7ca4('0x39')][_0x7ca4('0x3c')]));_0x534746[_0x7ca4('0x3d')]=_0x534746['attributes'][_0x7ca4('0x3e')]?_0x534746['attributes']:_0x5e8c0c[_0x7ca4('0x38')];if(_0xa51e77[_0x7ca4('0x39')][_0x7ca4('0x4a')]){_0x534746[_0x7ca4('0x4b')]=[{'all':!![]}];}_0x534746=_['merge']({},_0x534746,_0xa51e77[_0x7ca4('0x48')]);return db[_0x7ca4('0x35')][_0x7ca4('0x52')](_0x534746)[_0x7ca4('0x2a')](handleEntityNotFound(_0x591864,null))['then'](respondWithResult(_0x591864,null))[_0x7ca4('0x4e')](handleError(_0x591864,null));};exports[_0x7ca4('0x53')]=function(_0x29fb91,_0x4ebe84){return db[_0x7ca4('0x35')][_0x7ca4('0x53')](_0x29fb91[_0x7ca4('0x54')],{})[_0x7ca4('0x2a')](function(_0x5a23fd){var _0x2e2c0c=_0x29fb91[_0x7ca4('0x55')][_0x7ca4('0x2b')]({'plain':!![]});if(!_0x2e2c0c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e2c0c[_0x7ca4('0x56')]===_0x7ca4('0x55')){var _0x2db91d=_0x5a23fd['get']({'plain':!![]});var _0x4ab943='OpenchannelQueues';return db[_0x7ca4('0x57')][_0x7ca4('0x52')]({'where':{'name':_0x4ab943,'userProfileId':_0x2e2c0c[_0x7ca4('0x58')]},'raw':!![]})[_0x7ca4('0x2a')](function(_0x328bfa){if(_0x328bfa&&_0x328bfa['autoAssociation']===0x0){return db[_0x7ca4('0x2d')][_0x7ca4('0x53')]({'name':_0x2db91d[_0x7ca4('0x32')],'resourceId':_0x2db91d['id'],'type':_0x328bfa[_0x7ca4('0x32')],'sectionId':_0x328bfa['id']},{})[_0x7ca4('0x2a')](function(){return _0x5a23fd;});}else{return _0x5a23fd;}})['catch'](function(_0x4c1a13){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c1a13);throw _0x4c1a13;});}return _0x5a23fd;})[_0x7ca4('0x2a')](respondWithResult(_0x4ebe84,0xc9))[_0x7ca4('0x4e')](handleError(_0x4ebe84,null));};exports[_0x7ca4('0x29')]=function(_0x36771a,_0x1baaee){if(_0x36771a[_0x7ca4('0x54')]['id']){delete _0x36771a[_0x7ca4('0x54')]['id'];}return db['OpenchannelQueue'][_0x7ca4('0x52')]({'where':{'id':_0x36771a[_0x7ca4('0x50')]['id']}})[_0x7ca4('0x2a')](handleEntityNotFound(_0x1baaee,null))[_0x7ca4('0x2a')](saveUpdates(_0x36771a[_0x7ca4('0x54')],null))[_0x7ca4('0x2a')](respondWithResult(_0x1baaee,null))[_0x7ca4('0x4e')](handleError(_0x1baaee,null));};exports[_0x7ca4('0x2e')]=function(_0x2c4456,_0x321b2b){return db[_0x7ca4('0x35')][_0x7ca4('0x52')]({'where':{'id':_0x2c4456['params']['id']}})[_0x7ca4('0x2a')](handleEntityNotFound(_0x321b2b,null))[_0x7ca4('0x2a')](removeEntity(_0x321b2b,null))[_0x7ca4('0x4e')](handleError(_0x321b2b,null));};exports['describe']=function(_0x37e545,_0x35797a){return db[_0x7ca4('0x35')][_0x7ca4('0x59')]()[_0x7ca4('0x2a')](respondWithResult(_0x35797a,null))[_0x7ca4('0x4e')](handleError(_0x35797a,null));};exports[_0x7ca4('0x5a')]=function(_0x2f0804,_0x948071,_0x5d3494){var _0x23ccea={'raw':!![],'where':{}},_0x512b35={},_0x15b9e9;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x2f0804['params']['id']}})[_0x7ca4('0x2a')](handleEntityNotFound(_0x948071,null))[_0x7ca4('0x2a')](function(_0x17538b){if(_0x17538b){_0x15b9e9=_0x17538b[_0x7ca4('0x2b')]({'plain':!![]});_0x512b35[_0x7ca4('0x38')]=_['keys'](db[_0x7ca4('0x5b')][_0x7ca4('0x51')]);_0x512b35[_0x7ca4('0x39')]=_[_0x7ca4('0x3a')](_0x2f0804[_0x7ca4('0x39')]);_0x512b35['filters']=_[_0x7ca4('0x3b')](_0x512b35[_0x7ca4('0x38')],_0x512b35[_0x7ca4('0x39')]);_0x23ccea[_0x7ca4('0x3d')]=_[_0x7ca4('0x3b')](_0x512b35[_0x7ca4('0x38')],qs[_0x7ca4('0x3c')](_0x2f0804[_0x7ca4('0x39')]['fields']));_0x23ccea[_0x7ca4('0x3d')]=_0x23ccea[_0x7ca4('0x3d')][_0x7ca4('0x3e')]?_0x23ccea[_0x7ca4('0x3d')]:_0x512b35[_0x7ca4('0x38')];if(!_0x2f0804['query'][_0x7ca4('0x3f')](_0x7ca4('0x5c'))){_0x23ccea[_0x7ca4('0x23')]=qs[_0x7ca4('0x23')](_0x2f0804[_0x7ca4('0x39')][_0x7ca4('0x23')]);_0x23ccea[_0x7ca4('0x22')]=qs['offset'](_0x2f0804[_0x7ca4('0x39')][_0x7ca4('0x22')]);}_0x23ccea[_0x7ca4('0x40')]=qs[_0x7ca4('0x41')](_0x2f0804['query'][_0x7ca4('0x41')]);_0x23ccea[_0x7ca4('0x42')]=qs[_0x7ca4('0x44')](_[_0x7ca4('0x43')](_0x2f0804['query'],_0x512b35[_0x7ca4('0x44')]));_0x23ccea['where'][_0x7ca4('0x5d')]=_0x17538b['id'];if(_0x2f0804[_0x7ca4('0x39')]['filter']){_0x23ccea['where']=_['merge'](_0x23ccea['where'],{'$or':_[_0x7ca4('0x34')](_0x23ccea[_0x7ca4('0x3d')],function(_0x3dc2dc){var _0x56fb10={};_0x56fb10[_0x3dc2dc]={'$like':'%'+_0x2f0804[_0x7ca4('0x39')][_0x7ca4('0x45')]+'%'};return _0x56fb10;})});}_0x23ccea=_['merge']({},_0x23ccea,_0x2f0804[_0x7ca4('0x48')]);return db['UserOpenchannelQueue'][_0x7ca4('0x4c')](_0x23ccea);}})[_0x7ca4('0x2a')](function(_0x295d43){if(_0x295d43){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x295d43,_0x7ca4('0x5e')),'role':_0x7ca4('0x5f')},'attributes':['id','name',_0x7ca4('0x60'),_0x7ca4('0x61'),_0x7ca4('0x62')]});}})[_0x7ca4('0x2a')](function(_0x259dc2){if(_0x259dc2){return{'count':_0x259dc2['count'],'rows':_[_0x7ca4('0x34')](_0x259dc2[_0x7ca4('0x4d')],function(_0x2d7bed){return{'membername':_0x2d7bed[_0x7ca4('0x32')],'UserId':_0x2d7bed['id'],'queue_name':_0x15b9e9['name'],'OpenchannelQueueId':_0x15b9e9['id'],'interface':util['format'](_0x7ca4('0x63'),_0x7ca4('0x64'),_0x2d7bed['name']),'penalty':0x0,'paused':_0x2d7bed[_0x7ca4('0x60')],'createdAt':_0x2d7bed[_0x7ca4('0x62')],'updatedAt':_0x2d7bed['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x7ca4('0x2a')](respondWithFilteredResult(_0x948071,_0x23ccea))[_0x7ca4('0x4e')](handleError(_0x948071,null));};exports[_0x7ca4('0x65')]=function(_0x5efcee,_0x3daaaa,_0x9d4d6d){var _0x8cdb1f={};var _0x4faf27={};var _0x4a8868;var _0x31d9f0;return db[_0x7ca4('0x35')]['findOne']({'where':{'id':_0x5efcee[_0x7ca4('0x50')]['id']}})['then'](handleEntityNotFound(_0x3daaaa,null))['then'](function(_0x5bfef4){if(_0x5bfef4){_0x4a8868=_0x5bfef4;_0x4faf27[_0x7ca4('0x38')]=_[_0x7ca4('0x3a')](db[_0x7ca4('0x66')]['rawAttributes']);_0x4faf27[_0x7ca4('0x39')]=_['keys'](_0x5efcee['query']);_0x4faf27[_0x7ca4('0x44')]=_['intersection'](_0x4faf27[_0x7ca4('0x38')],_0x4faf27['query']);_0x8cdb1f[_0x7ca4('0x3d')]=_['intersection'](_0x4faf27[_0x7ca4('0x38')],qs['fields'](_0x5efcee[_0x7ca4('0x39')]['fields']));_0x8cdb1f[_0x7ca4('0x3d')]=_0x8cdb1f[_0x7ca4('0x3d')][_0x7ca4('0x3e')]?_0x8cdb1f[_0x7ca4('0x3d')]:_0x4faf27['model'];_0x8cdb1f[_0x7ca4('0x40')]=qs[_0x7ca4('0x41')](_0x5efcee['query'][_0x7ca4('0x41')]);_0x8cdb1f[_0x7ca4('0x42')]=qs['filters'](_[_0x7ca4('0x43')](_0x5efcee['query'],_0x4faf27['filters']));if(_0x5efcee[_0x7ca4('0x39')][_0x7ca4('0x45')]){_0x8cdb1f[_0x7ca4('0x42')]=_['merge'](_0x8cdb1f['where'],{'$or':_[_0x7ca4('0x34')](_0x8cdb1f['attributes'],function(_0x4ecd4d){var _0x16dc40={};_0x16dc40[_0x4ecd4d]={'$like':'%'+_0x5efcee['query'][_0x7ca4('0x45')]+'%'};return _0x16dc40;})});}_0x8cdb1f=_[_0x7ca4('0x46')]({},_0x8cdb1f,_0x5efcee[_0x7ca4('0x48')]);return _0x4a8868[_0x7ca4('0x65')](_0x8cdb1f);}})[_0x7ca4('0x2a')](function(_0x2f495a){if(_0x2f495a){_0x31d9f0=_0x2f495a[_0x7ca4('0x3e')];if(!_0x5efcee[_0x7ca4('0x39')][_0x7ca4('0x3f')](_0x7ca4('0x5c'))){_0x8cdb1f[_0x7ca4('0x23')]=qs[_0x7ca4('0x23')](_0x5efcee['query'][_0x7ca4('0x23')]);_0x8cdb1f[_0x7ca4('0x22')]=qs[_0x7ca4('0x22')](_0x5efcee[_0x7ca4('0x39')][_0x7ca4('0x22')]);}return _0x4a8868[_0x7ca4('0x65')](_0x8cdb1f);}})[_0x7ca4('0x2a')](function(_0x7fba82){if(_0x7fba82){return _0x7fba82?{'count':_0x31d9f0,'rows':_0x7fba82}:null;}})[_0x7ca4('0x2a')](respondWithResult(_0x3daaaa,null))[_0x7ca4('0x4e')](handleError(_0x3daaaa,null));};exports['addTeams']=function(_0x31b653,_0x4a9695,_0x12291f){var _0x1dfd69=_0x31b653[_0x7ca4('0x54')]['ids'];return db[_0x7ca4('0x66')]['findAll']({'where':{'id':_0x1dfd69},'attributes':['id'],'include':[{'model':db[_0x7ca4('0x67')],'as':_0x7ca4('0x68'),'attributes':['id',_0x7ca4('0x32'),_0x7ca4('0x69'),'voicePause',_0x7ca4('0x6a')],'raw':!![]}]})[_0x7ca4('0x2a')](function(_0x2cd176){if(_0x2cd176){var _0x1410d5=_[_0x7ca4('0x6b')](_0x2cd176,function(_0x45e158){var _0x2954aa=_0x45e158[_0x7ca4('0x2b')]({'plain':!![]});return _0x2954aa[_0x7ca4('0x68')];});return db['OpenchannelQueue'][_0x7ca4('0x52')]({'where':{'id':_0x31b653[_0x7ca4('0x50')]['id']}})[_0x7ca4('0x2a')](function(_0x59ae3b){return db[_0x7ca4('0x6c')][_0x7ca4('0x6d')](function(_0x3e3dec){return _0x59ae3b[_0x7ca4('0x6e')](_0x1dfd69,{'transaction':_0x3e3dec})[_0x7ca4('0x2a')](function(){return BPromise[_0x7ca4('0x6f')](_0x1410d5,function(_0x2d88af){return db[_0x7ca4('0x5b')]['findOrCreate']({'where':{'UserId':_0x2d88af['id'],'OpenchannelQueueId':_0x31b653[_0x7ca4('0x50')]['id']},'transaction':_0x3e3dec});});})['then'](function(){_0x1410d5[_0x7ca4('0x70')](function(_0x523ffd){socket[_0x7ca4('0x71')](_0x7ca4('0x72'),{'UserId':_0x523ffd['id'],'OpenchannelQueueId':_0x59ae3b['id']});});});});});}})[_0x7ca4('0x2a')](respondWithStatusCode(_0x4a9695,null))[_0x7ca4('0x4e')](handleError(_0x4a9695,null));};exports[_0x7ca4('0x73')]=function(_0x361e58,_0x380b48,_0x488f98){return db[_0x7ca4('0x66')][_0x7ca4('0x4c')]({'where':{'id':_0x361e58[_0x7ca4('0x39')][_0x7ca4('0x74')]},'attributes':['id'],'include':[{'model':db[_0x7ca4('0x67')],'as':_0x7ca4('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x380b48,null))['then'](function(_0x5365ca){var _0x8cf4f4=_[_0x7ca4('0x34')](_0x5365ca,'id');var _0x2bd616=[];var _0x2ead2c=[];var _0x5c9f16=squel[_0x7ca4('0x75')]();_0x5c9f16[_0x7ca4('0x76')](_0x7ca4('0x77'))[_0x7ca4('0x78')](_0x7ca4('0x79'),'tq')[_0x7ca4('0x7a')](_0x7ca4('0x7b'),'ut',_0x7ca4('0x7c'))[_0x7ca4('0x42')](_0x7ca4('0x7d'),_0x361e58[_0x7ca4('0x50')]['id']);for(var _0x1a28e3=0x0;_0x1a28e3<_0x5365ca['length'];_0x1a28e3+=0x1){let _0x43aba0=_0x5365ca[_0x1a28e3];for(var _0x37b01f=0x0;_0x37b01f<_0x43aba0[_0x7ca4('0x68')][_0x7ca4('0x3e')];_0x37b01f+=0x1){let _0x309fc9=_0x43aba0['Agents'][_0x37b01f];var _0x4127d5=_0x5c9f16[_0x7ca4('0x7e')]();_0x4127d5['where'](_0x7ca4('0x7f'),_0x309fc9['id']);_0x2ead2c[_0x7ca4('0x80')](db[_0x7ca4('0x6c')][_0x7ca4('0x39')](_0x4127d5[_0x7ca4('0x81')](),{'type':db[_0x7ca4('0x6c')][_0x7ca4('0x82')][_0x7ca4('0x83')]})['then'](function(_0x1079ba){if(_0x1079ba[_0x7ca4('0x3e')]===0x1){return _0x309fc9['id'];}else{var _0x302490=_[_0x7ca4('0x84')](_['map'](_0x1079ba,'TeamId'),function(_0x1dc3bf){return _[_0x7ca4('0x85')](_0x8cf4f4,_0x1dc3bf);});if(_0x302490){return _0x309fc9['id'];}}}));}}return BPromise['all'](_0x2ead2c)[_0x7ca4('0x2a')](function(_0x4f509b){_0x2bd616=_(_0x2bd616)[_0x7ca4('0x86')](_0x4f509b)[_0x7ca4('0x87')]()['value']();return db[_0x7ca4('0x35')][_0x7ca4('0x52')]({'where':{'id':_0x361e58[_0x7ca4('0x50')]['id']}})[_0x7ca4('0x2a')](function(_0x2708c8){return db[_0x7ca4('0x6c')]['transaction'](function(_0x41528b){return _0x2708c8[_0x7ca4('0x73')](_0x361e58[_0x7ca4('0x39')][_0x7ca4('0x74')],{'transaction':_0x41528b})['then'](function(){if(!_[_0x7ca4('0x88')](_0x2bd616)){return _0x2708c8['removeAgents'](_0x2bd616,{'transaction':_0x41528b});}})[_0x7ca4('0x2a')](function(){_0x2bd616[_0x7ca4('0x70')](function(_0x24a83e){socket[_0x7ca4('0x71')](_0x7ca4('0x89'),{'UserId':_0x24a83e,'OpenchannelQueueId':_0x2708c8['id']});});});});});});})[_0x7ca4('0x2a')](respondWithStatusCode(_0x380b48,null))[_0x7ca4('0x4e')](handleError(_0x380b48,null));};exports[_0x7ca4('0x8a')]=function(_0x13034b,_0x30305e,_0x1a5a6a){return db[_0x7ca4('0x35')]['find']({'where':{'id':_0x13034b[_0x7ca4('0x50')]['id']}})[_0x7ca4('0x2a')](handleEntityNotFound(_0x30305e,null))[_0x7ca4('0x2a')](function(_0x38c215){if(_0x38c215){return _0x38c215['addAgents'](_0x13034b[_0x7ca4('0x54')][_0x7ca4('0x74')],_['omit'](_0x13034b['body'],[_0x7ca4('0x74'),'id'])||{})[_0x7ca4('0x8b')](function(_0x51a2eb){for(var _0x4ea6b5=0x0;_0x4ea6b5<_0x13034b[_0x7ca4('0x54')]['ids'][_0x7ca4('0x3e')];_0x4ea6b5+=0x1){socket[_0x7ca4('0x71')]('userOpenchannelQueue:save',{'UserId':_0x13034b[_0x7ca4('0x54')][_0x7ca4('0x74')][_0x4ea6b5],'OpenchannelQueueId':_0x13034b[_0x7ca4('0x50')]['id']});}return _0x51a2eb;});}})[_0x7ca4('0x2a')](respondWithResult(_0x30305e,null))[_0x7ca4('0x4e')](handleError(_0x30305e,null));};exports['removeAgents']=function(_0x4ea1d,_0x299e3a,_0x9473ba){return db[_0x7ca4('0x35')]['find']({'where':{'id':_0x4ea1d[_0x7ca4('0x50')]['id']}})[_0x7ca4('0x2a')](handleEntityNotFound(_0x299e3a,null))[_0x7ca4('0x2a')](function(_0x58744e){if(_0x58744e){return _0x58744e[_0x7ca4('0x8c')](_0x4ea1d['query'][_0x7ca4('0x74')])[_0x7ca4('0x2a')](function(){if(_[_0x7ca4('0x8d')](_0x4ea1d[_0x7ca4('0x39')][_0x7ca4('0x74')])){for(var _0x153b5b=0x0;_0x153b5b<_0x4ea1d[_0x7ca4('0x39')][_0x7ca4('0x74')]['length'];_0x153b5b+=0x1){socket[_0x7ca4('0x71')](_0x7ca4('0x89'),{'UserId':Number(_0x4ea1d[_0x7ca4('0x39')][_0x7ca4('0x74')][_0x153b5b]),'OpenchannelQueueId':Number(_0x4ea1d[_0x7ca4('0x50')]['id'])});}}else{socket[_0x7ca4('0x71')](_0x7ca4('0x89'),{'UserId':Number(_0x4ea1d[_0x7ca4('0x39')][_0x7ca4('0x74')]),'OpenchannelQueueId':Number(_0x4ea1d[_0x7ca4('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x299e3a,null))[_0x7ca4('0x4e')](handleError(_0x299e3a,null));};exports[_0x7ca4('0x8e')]=function(_0x365e58,_0x1d76ba,_0x1c83c6){var _0x4599a9={};var _0x28a428={};var _0x1b75d2;var _0xe25ade;return db['OpenchannelQueue'][_0x7ca4('0x8f')]({'where':{'id':_0x365e58[_0x7ca4('0x50')]['id']}})['then'](handleEntityNotFound(_0x1d76ba,null))[_0x7ca4('0x2a')](function(_0x1b5b10){if(_0x1b5b10){_0x1b75d2=_0x1b5b10;_0x28a428['model']=_[_0x7ca4('0x3a')](db[_0x7ca4('0x67')]['rawAttributes']);_0x28a428[_0x7ca4('0x39')]=_['keys'](_0x365e58[_0x7ca4('0x39')]);_0x28a428['filters']=_['intersection'](_0x28a428[_0x7ca4('0x38')],_0x28a428[_0x7ca4('0x39')]);_0x4599a9[_0x7ca4('0x3d')]=_[_0x7ca4('0x3b')](_0x28a428['model'],qs[_0x7ca4('0x3c')](_0x365e58[_0x7ca4('0x39')][_0x7ca4('0x3c')]));_0x4599a9['attributes']=_0x4599a9['attributes'][_0x7ca4('0x3e')]?_0x4599a9[_0x7ca4('0x3d')]:_0x28a428[_0x7ca4('0x38')];_0x4599a9[_0x7ca4('0x40')]=qs['sort'](_0x365e58['query'][_0x7ca4('0x41')]);_0x4599a9[_0x7ca4('0x42')]=qs[_0x7ca4('0x44')](_[_0x7ca4('0x43')](_0x365e58[_0x7ca4('0x39')],_0x28a428[_0x7ca4('0x44')]));if(_0x365e58[_0x7ca4('0x39')][_0x7ca4('0x45')]){_0x4599a9[_0x7ca4('0x42')]=_[_0x7ca4('0x46')](_0x4599a9[_0x7ca4('0x42')],{'$or':_['map'](_0x4599a9[_0x7ca4('0x3d')],function(_0x5439a6){var _0x2c57d1={};_0x2c57d1[_0x5439a6]={'$like':'%'+_0x365e58[_0x7ca4('0x39')]['filter']+'%'};return _0x2c57d1;})});}_0x4599a9=_[_0x7ca4('0x46')]({},_0x4599a9,_0x365e58[_0x7ca4('0x48')]);return _0x1b75d2[_0x7ca4('0x8e')](_0x4599a9);}})[_0x7ca4('0x2a')](function(_0x1b5802){if(_0x1b5802){_0xe25ade=_0x1b5802['length'];if(!_0x365e58[_0x7ca4('0x39')][_0x7ca4('0x3f')](_0x7ca4('0x5c'))){_0x4599a9[_0x7ca4('0x23')]=qs['limit'](_0x365e58[_0x7ca4('0x39')][_0x7ca4('0x23')]);_0x4599a9[_0x7ca4('0x22')]=qs['offset'](_0x365e58[_0x7ca4('0x39')]['offset']);}return _0x1b75d2[_0x7ca4('0x8e')](_0x4599a9);}})[_0x7ca4('0x2a')](function(_0xb52f1f){if(_0xb52f1f){return _0xb52f1f?{'count':_0xe25ade,'rows':_0xb52f1f}:null;}})[_0x7ca4('0x2a')](respondWithResult(_0x1d76ba,null))[_0x7ca4('0x4e')](handleError(_0x1d76ba,null));}; \ No newline at end of file +var _0x6dce=['filter','OpenchannelQueue','includeAll','findAll','rows','catch','params','keys','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserOpenchannelQueue','rawAttributes','pick','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','findOne','getTeams','ids','Team','Agents','voicePause','interface','flatMap','transaction','addTeams','each','findOrCreate','userOpenchannelQueue:save','removeTeams','select','field','from','team_has_openchannel_queues','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','emit','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','order','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/environment','redis','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','then','get','OpenchannelQueues','UserProfileResource','destroy','end','error','name','send','index','map','fieldName','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL'];(function(_0x3d75da,_0x372212){var _0x1bd83f=function(_0x3908dd){while(--_0x3908dd){_0x3d75da['push'](_0x3d75da['shift']());}};_0x1bd83f(++_0x372212);}(_0x6dce,0x1ef));var _0xe6dc=function(_0x3c5ee9,_0x49b07b){_0x3c5ee9=_0x3c5ee9-0x0;var _0x4e161c=_0x6dce[_0x3c5ee9];return _0x4e161c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe6dc('0x0'));var rimraf=require(_0xe6dc('0x1'));var zipdir=require(_0xe6dc('0x2'));var jsonpatch=require(_0xe6dc('0x3'));var rp=require('request-promise');var moment=require(_0xe6dc('0x4'));var BPromise=require(_0xe6dc('0x5'));var Mustache=require(_0xe6dc('0x6'));var util=require(_0xe6dc('0x7'));var path=require(_0xe6dc('0x8'));var sox=require(_0xe6dc('0x9'));var csv=require(_0xe6dc('0xa'));var ejs=require(_0xe6dc('0xb'));var fs=require('fs');var _=require(_0xe6dc('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe6dc('0xd'));var deskjs=require(_0xe6dc('0xe'));var toCsv=require(_0xe6dc('0xa'));var querystring=require(_0xe6dc('0xf'));var Papa=require(_0xe6dc('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe6dc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe6dc('0x12'));var utils=require('../../config/utils');var config=require(_0xe6dc('0x13'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xe6dc('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xe6dc('0x15'))(new Redis(config[_0xe6dc('0x14')]));require(_0xe6dc('0x16'))[_0xe6dc('0x17')](socket);function respondWithStatusCode(_0x2c56ce,_0x3ce437){_0x3ce437=_0x3ce437||0xcc;return function(_0x132e8d){if(_0x132e8d){return _0x2c56ce[_0xe6dc('0x18')](_0x3ce437);}return _0x2c56ce[_0xe6dc('0x19')](_0x3ce437)['end']();};}function respondWithResult(_0x1b7372,_0x2b88bd){_0x2b88bd=_0x2b88bd||0xc8;return function(_0x64f6cd){if(_0x64f6cd){return _0x1b7372[_0xe6dc('0x19')](_0x2b88bd)[_0xe6dc('0x1a')](_0x64f6cd);}};}function respondWithFilteredResult(_0x33578c,_0x213f43){return function(_0x27cfa7){if(_0x27cfa7){var _0x1d3f18=_0x27cfa7[_0xe6dc('0x1b')],_0x3af2fc=_0x213f43[_0xe6dc('0x1c')],_0x43eccc=_0x213f43[_0xe6dc('0x1c')]+_0x213f43[_0xe6dc('0x1d')],_0x2691b4;if(_0x43eccc>=_0x1d3f18){_0x43eccc=_0x1d3f18;_0x2691b4=0xc8;}else{_0x2691b4=0xce;}_0x33578c['status'](_0x2691b4);return _0x33578c[_0xe6dc('0x1e')](_0xe6dc('0x1f'),_0x3af2fc+'-'+_0x43eccc+'/'+_0x1d3f18)['json'](_0x27cfa7);}return null;};}function patchUpdates(_0x3deb17){return function(_0x5a19ce){try{jsonpatch['apply'](_0x5a19ce,_0x3deb17,!![]);}catch(_0x1ec648){return BPromise[_0xe6dc('0x20')](_0x1ec648);}return _0x5a19ce[_0xe6dc('0x21')]();};}function saveUpdates(_0x323028,_0x3ce997){return function(_0x25ef6e){if(_0x25ef6e){return _0x25ef6e['update'](_0x323028)[_0xe6dc('0x22')](function(_0x266969){return _0x266969;});}return null;};}function removeEntity(_0x392acd,_0x41b2ca){return function(_0x358248){if(_0x358248){return _0x358248['destroy']()[_0xe6dc('0x22')](function(){var _0x5f3469=_0x358248[_0xe6dc('0x23')]({'plain':!![]});var _0x3d9187=_0xe6dc('0x24');return db[_0xe6dc('0x25')][_0xe6dc('0x26')]({'where':{'type':_0x3d9187,'resourceId':_0x5f3469['id']}})[_0xe6dc('0x22')](function(){return _0x358248;});})[_0xe6dc('0x22')](function(){_0x392acd['status'](0xcc)[_0xe6dc('0x27')]();});}};}function handleEntityNotFound(_0x571773,_0x4d745a){return function(_0x595e92){if(!_0x595e92){_0x571773[_0xe6dc('0x18')](0x194);}return _0x595e92;};}function handleError(_0x5a764e,_0x4ef311){_0x4ef311=_0x4ef311||0x1f4;return function(_0x103d7e){logger[_0xe6dc('0x28')](_0x103d7e['stack']);if(_0x103d7e['name']){delete _0x103d7e[_0xe6dc('0x29')];}_0x5a764e[_0xe6dc('0x19')](_0x4ef311)[_0xe6dc('0x2a')](_0x103d7e);};}exports[_0xe6dc('0x2b')]=function(_0x37d508,_0x3936a3){var _0x47b508={},_0x373988={},_0x4cd77d={'count':0x0,'rows':[]};var _0x3f2218=_[_0xe6dc('0x2c')](db['OpenchannelQueue']['rawAttributes'],function(_0x1df99c){return{'name':_0x1df99c[_0xe6dc('0x2d')],'type':_0x1df99c[_0xe6dc('0x2e')][_0xe6dc('0x2f')]};});_0x373988['model']=_[_0xe6dc('0x2c')](_0x3f2218,_0xe6dc('0x29'));_0x373988[_0xe6dc('0x30')]=_['keys'](_0x37d508['query']);_0x373988['filters']=_[_0xe6dc('0x31')](_0x373988['model'],_0x373988['query']);_0x47b508[_0xe6dc('0x32')]=_['intersection'](_0x373988[_0xe6dc('0x33')],qs[_0xe6dc('0x34')](_0x37d508[_0xe6dc('0x30')]['fields']));_0x47b508[_0xe6dc('0x32')]=_0x47b508[_0xe6dc('0x32')][_0xe6dc('0x35')]?_0x47b508[_0xe6dc('0x32')]:_0x373988['model'];if(!_0x37d508[_0xe6dc('0x30')][_0xe6dc('0x36')](_0xe6dc('0x37'))){_0x47b508[_0xe6dc('0x1d')]=qs[_0xe6dc('0x1d')](_0x37d508[_0xe6dc('0x30')][_0xe6dc('0x1d')]);_0x47b508[_0xe6dc('0x1c')]=qs[_0xe6dc('0x1c')](_0x37d508[_0xe6dc('0x30')][_0xe6dc('0x1c')]);}_0x47b508['order']=qs[_0xe6dc('0x38')](_0x37d508['query']['sort']);_0x47b508[_0xe6dc('0x39')]=qs[_0xe6dc('0x3a')](_['pick'](_0x37d508[_0xe6dc('0x30')],_0x373988['filters']),_0x3f2218);if(_0x37d508[_0xe6dc('0x30')]['filter']){_0x47b508[_0xe6dc('0x39')]=_[_0xe6dc('0x3b')](_0x47b508[_0xe6dc('0x39')],{'$or':_[_0xe6dc('0x2c')](_0x3f2218,function(_0x41545e){if(_0x41545e[_0xe6dc('0x2e')]!==_0xe6dc('0x3c')){var _0x174a7f={};_0x174a7f[_0x41545e[_0xe6dc('0x29')]]={'$like':'%'+_0x37d508[_0xe6dc('0x30')][_0xe6dc('0x3d')]+'%'};return _0x174a7f;}})});}_0x47b508=_['merge']({},_0x47b508,_0x37d508['options']);var _0x3e6c37={'where':_0x47b508['where']};return db[_0xe6dc('0x3e')][_0xe6dc('0x1b')](_0x3e6c37)['then'](function(_0x3656a5){_0x4cd77d['count']=_0x3656a5;if(_0x37d508['query'][_0xe6dc('0x3f')]){_0x47b508['include']=[{'all':!![]}];}return db[_0xe6dc('0x3e')][_0xe6dc('0x40')](_0x47b508);})[_0xe6dc('0x22')](function(_0x42f52e){_0x4cd77d[_0xe6dc('0x41')]=_0x42f52e;return _0x4cd77d;})[_0xe6dc('0x22')](respondWithFilteredResult(_0x3936a3,_0x47b508))[_0xe6dc('0x42')](handleError(_0x3936a3,null));};exports['show']=function(_0x176120,_0x32d4c6){var _0x3e3ade={'raw':!![],'where':{'id':_0x176120[_0xe6dc('0x43')]['id']}},_0x59d20e={};_0x59d20e[_0xe6dc('0x33')]=_[_0xe6dc('0x44')](db[_0xe6dc('0x3e')]['rawAttributes']);_0x59d20e['query']=_[_0xe6dc('0x44')](_0x176120[_0xe6dc('0x30')]);_0x59d20e[_0xe6dc('0x3a')]=_['intersection'](_0x59d20e[_0xe6dc('0x33')],_0x59d20e['query']);_0x3e3ade[_0xe6dc('0x32')]=_[_0xe6dc('0x31')](_0x59d20e[_0xe6dc('0x33')],qs[_0xe6dc('0x34')](_0x176120[_0xe6dc('0x30')]['fields']));_0x3e3ade[_0xe6dc('0x32')]=_0x3e3ade[_0xe6dc('0x32')][_0xe6dc('0x35')]?_0x3e3ade[_0xe6dc('0x32')]:_0x59d20e[_0xe6dc('0x33')];if(_0x176120['query'][_0xe6dc('0x3f')]){_0x3e3ade[_0xe6dc('0x45')]=[{'all':!![]}];}_0x3e3ade=_[_0xe6dc('0x3b')]({},_0x3e3ade,_0x176120[_0xe6dc('0x46')]);return db[_0xe6dc('0x3e')][_0xe6dc('0x47')](_0x3e3ade)[_0xe6dc('0x22')](handleEntityNotFound(_0x32d4c6,null))[_0xe6dc('0x22')](respondWithResult(_0x32d4c6,null))['catch'](handleError(_0x32d4c6,null));};exports[_0xe6dc('0x48')]=function(_0x54deb6,_0x20bc93){return db[_0xe6dc('0x3e')][_0xe6dc('0x48')](_0x54deb6[_0xe6dc('0x49')],{})[_0xe6dc('0x22')](function(_0x327d74){var _0x37dabc=_0x54deb6[_0xe6dc('0x4a')][_0xe6dc('0x23')]({'plain':!![]});if(!_0x37dabc)throw new Error(_0xe6dc('0x4b'));if(_0x37dabc[_0xe6dc('0x4c')]===_0xe6dc('0x4a')){var _0xe34312=_0x327d74['get']({'plain':!![]});var _0x50c440='OpenchannelQueues';return db['UserProfileSection'][_0xe6dc('0x47')]({'where':{'name':_0x50c440,'userProfileId':_0x37dabc[_0xe6dc('0x4d')]},'raw':!![]})[_0xe6dc('0x22')](function(_0x589e6f){if(_0x589e6f&&_0x589e6f['autoAssociation']===0x0){return db[_0xe6dc('0x25')][_0xe6dc('0x48')]({'name':_0xe34312[_0xe6dc('0x29')],'resourceId':_0xe34312['id'],'type':_0x589e6f['name'],'sectionId':_0x589e6f['id']},{})[_0xe6dc('0x22')](function(){return _0x327d74;});}else{return _0x327d74;}})[_0xe6dc('0x42')](function(_0x45cec6){logger[_0xe6dc('0x28')](_0xe6dc('0x4e'),_0x45cec6);throw _0x45cec6;});}return _0x327d74;})[_0xe6dc('0x22')](respondWithResult(_0x20bc93,0xc9))[_0xe6dc('0x42')](handleError(_0x20bc93,null));};exports[_0xe6dc('0x4f')]=function(_0x146bf3,_0x55c2b1){if(_0x146bf3[_0xe6dc('0x49')]['id']){delete _0x146bf3[_0xe6dc('0x49')]['id'];}return db[_0xe6dc('0x3e')][_0xe6dc('0x47')]({'where':{'id':_0x146bf3['params']['id']}})[_0xe6dc('0x22')](handleEntityNotFound(_0x55c2b1,null))[_0xe6dc('0x22')](saveUpdates(_0x146bf3[_0xe6dc('0x49')],null))[_0xe6dc('0x22')](respondWithResult(_0x55c2b1,null))[_0xe6dc('0x42')](handleError(_0x55c2b1,null));};exports['destroy']=function(_0x512741,_0x28ca14){return db[_0xe6dc('0x3e')][_0xe6dc('0x47')]({'where':{'id':_0x512741[_0xe6dc('0x43')]['id']}})['then'](handleEntityNotFound(_0x28ca14,null))[_0xe6dc('0x22')](removeEntity(_0x28ca14,null))[_0xe6dc('0x42')](handleError(_0x28ca14,null));};exports[_0xe6dc('0x50')]=function(_0x5b122b,_0x53442f){return db[_0xe6dc('0x3e')][_0xe6dc('0x50')]()['then'](respondWithResult(_0x53442f,null))[_0xe6dc('0x42')](handleError(_0x53442f,null));};exports[_0xe6dc('0x51')]=function(_0xb15659,_0x2b9079,_0x4d6b00){var _0x2de12f={'raw':!![],'where':{}},_0x32e59a={},_0x4032cf;return db[_0xe6dc('0x3e')]['findOne']({'where':{'id':_0xb15659[_0xe6dc('0x43')]['id']}})[_0xe6dc('0x22')](handleEntityNotFound(_0x2b9079,null))[_0xe6dc('0x22')](function(_0x5535c5){if(_0x5535c5){_0x4032cf=_0x5535c5['get']({'plain':!![]});_0x32e59a[_0xe6dc('0x33')]=_['keys'](db[_0xe6dc('0x52')][_0xe6dc('0x53')]);_0x32e59a['query']=_[_0xe6dc('0x44')](_0xb15659[_0xe6dc('0x30')]);_0x32e59a[_0xe6dc('0x3a')]=_[_0xe6dc('0x31')](_0x32e59a[_0xe6dc('0x33')],_0x32e59a[_0xe6dc('0x30')]);_0x2de12f[_0xe6dc('0x32')]=_[_0xe6dc('0x31')](_0x32e59a[_0xe6dc('0x33')],qs[_0xe6dc('0x34')](_0xb15659[_0xe6dc('0x30')][_0xe6dc('0x34')]));_0x2de12f['attributes']=_0x2de12f['attributes'][_0xe6dc('0x35')]?_0x2de12f[_0xe6dc('0x32')]:_0x32e59a[_0xe6dc('0x33')];if(!_0xb15659[_0xe6dc('0x30')]['hasOwnProperty'](_0xe6dc('0x37'))){_0x2de12f[_0xe6dc('0x1d')]=qs['limit'](_0xb15659[_0xe6dc('0x30')][_0xe6dc('0x1d')]);_0x2de12f[_0xe6dc('0x1c')]=qs['offset'](_0xb15659[_0xe6dc('0x30')]['offset']);}_0x2de12f['order']=qs[_0xe6dc('0x38')](_0xb15659['query'][_0xe6dc('0x38')]);_0x2de12f[_0xe6dc('0x39')]=qs[_0xe6dc('0x3a')](_[_0xe6dc('0x54')](_0xb15659[_0xe6dc('0x30')],_0x32e59a[_0xe6dc('0x3a')]));_0x2de12f['where'][_0xe6dc('0x55')]=_0x5535c5['id'];if(_0xb15659[_0xe6dc('0x30')][_0xe6dc('0x3d')]){_0x2de12f[_0xe6dc('0x39')]=_[_0xe6dc('0x3b')](_0x2de12f[_0xe6dc('0x39')],{'$or':_[_0xe6dc('0x2c')](_0x2de12f[_0xe6dc('0x32')],function(_0x4ef60f){var _0x3490a5={};_0x3490a5[_0x4ef60f]={'$like':'%'+_0xb15659[_0xe6dc('0x30')]['filter']+'%'};return _0x3490a5;})});}_0x2de12f=_[_0xe6dc('0x3b')]({},_0x2de12f,_0xb15659['options']);return db[_0xe6dc('0x52')][_0xe6dc('0x40')](_0x2de12f);}})['then'](function(_0x1526c7){if(_0x1526c7){return db[_0xe6dc('0x56')][_0xe6dc('0x57')]({'where':{'id':_[_0xe6dc('0x2c')](_0x1526c7,_0xe6dc('0x58')),'role':_0xe6dc('0x59')},'attributes':['id','name',_0xe6dc('0x5a'),_0xe6dc('0x5b'),_0xe6dc('0x5c')]});}})[_0xe6dc('0x22')](function(_0x270550){if(_0x270550){return{'count':_0x270550[_0xe6dc('0x1b')],'rows':_[_0xe6dc('0x2c')](_0x270550[_0xe6dc('0x41')],function(_0x44cd17){return{'membername':_0x44cd17[_0xe6dc('0x29')],'UserId':_0x44cd17['id'],'queue_name':_0x4032cf[_0xe6dc('0x29')],'OpenchannelQueueId':_0x4032cf['id'],'interface':util[_0xe6dc('0x5d')](_0xe6dc('0x5e'),_0xe6dc('0x5f'),_0x44cd17['name']),'penalty':0x0,'paused':_0x44cd17[_0xe6dc('0x5a')],'createdAt':_0x44cd17[_0xe6dc('0x5c')],'updatedAt':_0x44cd17[_0xe6dc('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2b9079,_0x2de12f))[_0xe6dc('0x42')](handleError(_0x2b9079,null));};exports['getTeams']=function(_0x3163ad,_0x22ed85,_0xec80a7){var _0x390701={};var _0x5f3381={};var _0x1c0956;var _0x31f7a0;return db[_0xe6dc('0x3e')][_0xe6dc('0x60')]({'where':{'id':_0x3163ad[_0xe6dc('0x43')]['id']}})[_0xe6dc('0x22')](handleEntityNotFound(_0x22ed85,null))[_0xe6dc('0x22')](function(_0x19d9f9){if(_0x19d9f9){_0x1c0956=_0x19d9f9;_0x5f3381[_0xe6dc('0x33')]=_['keys'](db['Team'][_0xe6dc('0x53')]);_0x5f3381[_0xe6dc('0x30')]=_['keys'](_0x3163ad['query']);_0x5f3381[_0xe6dc('0x3a')]=_[_0xe6dc('0x31')](_0x5f3381[_0xe6dc('0x33')],_0x5f3381[_0xe6dc('0x30')]);_0x390701[_0xe6dc('0x32')]=_[_0xe6dc('0x31')](_0x5f3381[_0xe6dc('0x33')],qs['fields'](_0x3163ad[_0xe6dc('0x30')]['fields']));_0x390701[_0xe6dc('0x32')]=_0x390701[_0xe6dc('0x32')][_0xe6dc('0x35')]?_0x390701['attributes']:_0x5f3381[_0xe6dc('0x33')];_0x390701['order']=qs[_0xe6dc('0x38')](_0x3163ad[_0xe6dc('0x30')][_0xe6dc('0x38')]);_0x390701[_0xe6dc('0x39')]=qs[_0xe6dc('0x3a')](_[_0xe6dc('0x54')](_0x3163ad[_0xe6dc('0x30')],_0x5f3381[_0xe6dc('0x3a')]));if(_0x3163ad[_0xe6dc('0x30')][_0xe6dc('0x3d')]){_0x390701[_0xe6dc('0x39')]=_['merge'](_0x390701[_0xe6dc('0x39')],{'$or':_[_0xe6dc('0x2c')](_0x390701[_0xe6dc('0x32')],function(_0x24fda4){var _0x537501={};_0x537501[_0x24fda4]={'$like':'%'+_0x3163ad[_0xe6dc('0x30')]['filter']+'%'};return _0x537501;})});}_0x390701=_[_0xe6dc('0x3b')]({},_0x390701,_0x3163ad[_0xe6dc('0x46')]);return _0x1c0956['getTeams'](_0x390701);}})[_0xe6dc('0x22')](function(_0x520171){if(_0x520171){_0x31f7a0=_0x520171[_0xe6dc('0x35')];if(!_0x3163ad[_0xe6dc('0x30')][_0xe6dc('0x36')]('nolimit')){_0x390701[_0xe6dc('0x1d')]=qs[_0xe6dc('0x1d')](_0x3163ad[_0xe6dc('0x30')]['limit']);_0x390701[_0xe6dc('0x1c')]=qs['offset'](_0x3163ad[_0xe6dc('0x30')][_0xe6dc('0x1c')]);}return _0x1c0956[_0xe6dc('0x61')](_0x390701);}})[_0xe6dc('0x22')](function(_0x2eeea1){if(_0x2eeea1){return _0x2eeea1?{'count':_0x31f7a0,'rows':_0x2eeea1}:null;}})[_0xe6dc('0x22')](respondWithResult(_0x22ed85,null))[_0xe6dc('0x42')](handleError(_0x22ed85,null));};exports['addTeams']=function(_0x4fe4b2,_0x5f5ead,_0x7dba0){var _0x11a418=_0x4fe4b2[_0xe6dc('0x49')][_0xe6dc('0x62')];return db[_0xe6dc('0x63')][_0xe6dc('0x40')]({'where':{'id':_0x11a418},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe6dc('0x64'),'attributes':['id',_0xe6dc('0x29'),'online',_0xe6dc('0x65'),_0xe6dc('0x66')],'raw':!![]}]})['then'](function(_0x5a56d2){if(_0x5a56d2){var _0x53f9a1=_[_0xe6dc('0x67')](_0x5a56d2,function(_0x3561fc){var _0x58377e=_0x3561fc[_0xe6dc('0x23')]({'plain':!![]});return _0x58377e['Agents'];});return db[_0xe6dc('0x3e')]['find']({'where':{'id':_0x4fe4b2[_0xe6dc('0x43')]['id']}})['then'](function(_0x433fda){return db['sequelize'][_0xe6dc('0x68')](function(_0x4d5b2c){return _0x433fda[_0xe6dc('0x69')](_0x11a418,{'transaction':_0x4d5b2c})[_0xe6dc('0x22')](function(){return BPromise[_0xe6dc('0x6a')](_0x53f9a1,function(_0x5339d0){return db['UserOpenchannelQueue'][_0xe6dc('0x6b')]({'where':{'UserId':_0x5339d0['id'],'OpenchannelQueueId':_0x4fe4b2[_0xe6dc('0x43')]['id']},'transaction':_0x4d5b2c});});})['then'](function(){_0x53f9a1['forEach'](function(_0x54cd48){socket['emit'](_0xe6dc('0x6c'),{'UserId':_0x54cd48['id'],'OpenchannelQueueId':_0x433fda['id']});});});});});}})[_0xe6dc('0x22')](respondWithStatusCode(_0x5f5ead,null))['catch'](handleError(_0x5f5ead,null));};exports[_0xe6dc('0x6d')]=function(_0x38e148,_0x2dbecd,_0x31b136){return db['Team'][_0xe6dc('0x40')]({'where':{'id':_0x38e148[_0xe6dc('0x30')][_0xe6dc('0x62')]},'attributes':['id'],'include':[{'model':db[_0xe6dc('0x56')],'as':_0xe6dc('0x64'),'attributes':['id'],'raw':!![]}]})[_0xe6dc('0x22')](handleEntityNotFound(_0x2dbecd,null))[_0xe6dc('0x22')](function(_0x500423){var _0x2128af=_[_0xe6dc('0x2c')](_0x500423,'id');var _0x39c958=[];var _0x5ae472=[];var _0x36770c=squel[_0xe6dc('0x6e')]();_0x36770c[_0xe6dc('0x6f')]('tq.TeamId')[_0xe6dc('0x70')](_0xe6dc('0x71'),'tq')['join']('user_has_teams','ut',_0xe6dc('0x72'))['where'](_0xe6dc('0x73'),_0x38e148[_0xe6dc('0x43')]['id']);for(var _0x504723=0x0;_0x504723<_0x500423[_0xe6dc('0x35')];_0x504723+=0x1){let _0x516713=_0x500423[_0x504723];for(var _0x104f58=0x0;_0x104f58<_0x516713['Agents'][_0xe6dc('0x35')];_0x104f58+=0x1){let _0x5d5fc6=_0x516713[_0xe6dc('0x64')][_0x104f58];var _0x5182de=_0x36770c[_0xe6dc('0x74')]();_0x5182de['where'](_0xe6dc('0x75'),_0x5d5fc6['id']);_0x5ae472[_0xe6dc('0x76')](db[_0xe6dc('0x77')]['query'](_0x5182de['toString'](),{'type':db[_0xe6dc('0x77')][_0xe6dc('0x78')][_0xe6dc('0x79')]})['then'](function(_0x22389f){if(_0x22389f[_0xe6dc('0x35')]===0x1){return _0x5d5fc6['id'];}else{var _0x467dd0=_[_0xe6dc('0x7a')](_['map'](_0x22389f,_0xe6dc('0x7b')),function(_0x47ef86){return _[_0xe6dc('0x7c')](_0x2128af,_0x47ef86);});if(_0x467dd0){return _0x5d5fc6['id'];}}}));}}return BPromise[_0xe6dc('0x7d')](_0x5ae472)[_0xe6dc('0x22')](function(_0x348e95){_0x39c958=_(_0x39c958)[_0xe6dc('0x7e')](_0x348e95)[_0xe6dc('0x7f')]()[_0xe6dc('0x80')]();return db[_0xe6dc('0x3e')][_0xe6dc('0x47')]({'where':{'id':_0x38e148['params']['id']}})[_0xe6dc('0x22')](function(_0x37d15e){return db['sequelize'][_0xe6dc('0x68')](function(_0x21f9f4){return _0x37d15e['removeTeams'](_0x38e148['query'][_0xe6dc('0x62')],{'transaction':_0x21f9f4})['then'](function(){if(!_[_0xe6dc('0x81')](_0x39c958)){return _0x37d15e[_0xe6dc('0x82')](_0x39c958,{'transaction':_0x21f9f4});}})[_0xe6dc('0x22')](function(){_0x39c958['forEach'](function(_0x486b79){socket[_0xe6dc('0x83')]('userOpenchannelQueue:remove',{'UserId':_0x486b79,'OpenchannelQueueId':_0x37d15e['id']});});});});});});})[_0xe6dc('0x22')](respondWithStatusCode(_0x2dbecd,null))['catch'](handleError(_0x2dbecd,null));};exports[_0xe6dc('0x84')]=function(_0x162d03,_0x5dbc88,_0x3ae8cf){return db[_0xe6dc('0x3e')][_0xe6dc('0x47')]({'where':{'id':_0x162d03[_0xe6dc('0x43')]['id']}})['then'](handleEntityNotFound(_0x5dbc88,null))[_0xe6dc('0x22')](function(_0x1468b1){if(_0x1468b1){return _0x1468b1[_0xe6dc('0x84')](_0x162d03[_0xe6dc('0x49')][_0xe6dc('0x62')],_[_0xe6dc('0x85')](_0x162d03[_0xe6dc('0x49')],[_0xe6dc('0x62'),'id'])||{})[_0xe6dc('0x86')](function(_0x5533bb){for(var _0x3c4ce3=0x0;_0x3c4ce3<_0x162d03[_0xe6dc('0x49')][_0xe6dc('0x62')][_0xe6dc('0x35')];_0x3c4ce3+=0x1){socket[_0xe6dc('0x83')](_0xe6dc('0x6c'),{'UserId':_0x162d03[_0xe6dc('0x49')][_0xe6dc('0x62')][_0x3c4ce3],'OpenchannelQueueId':_0x162d03['params']['id']});}return _0x5533bb;});}})[_0xe6dc('0x22')](respondWithResult(_0x5dbc88,null))[_0xe6dc('0x42')](handleError(_0x5dbc88,null));};exports['removeAgents']=function(_0x20fe29,_0x84cd82,_0x249eab){return db[_0xe6dc('0x3e')][_0xe6dc('0x47')]({'where':{'id':_0x20fe29[_0xe6dc('0x43')]['id']}})[_0xe6dc('0x22')](handleEntityNotFound(_0x84cd82,null))['then'](function(_0x248c95){if(_0x248c95){return _0x248c95[_0xe6dc('0x82')](_0x20fe29[_0xe6dc('0x30')][_0xe6dc('0x62')])[_0xe6dc('0x22')](function(){if(_[_0xe6dc('0x87')](_0x20fe29[_0xe6dc('0x30')][_0xe6dc('0x62')])){for(var _0x4ac30c=0x0;_0x4ac30c<_0x20fe29['query'][_0xe6dc('0x62')][_0xe6dc('0x35')];_0x4ac30c+=0x1){socket[_0xe6dc('0x83')]('userOpenchannelQueue:remove',{'UserId':Number(_0x20fe29[_0xe6dc('0x30')][_0xe6dc('0x62')][_0x4ac30c]),'OpenchannelQueueId':Number(_0x20fe29[_0xe6dc('0x43')]['id'])});}}else{socket[_0xe6dc('0x83')](_0xe6dc('0x88'),{'UserId':Number(_0x20fe29[_0xe6dc('0x30')][_0xe6dc('0x62')]),'OpenchannelQueueId':Number(_0x20fe29['params']['id'])});}});}})[_0xe6dc('0x22')](respondWithStatusCode(_0x84cd82,null))[_0xe6dc('0x42')](handleError(_0x84cd82,null));};exports[_0xe6dc('0x89')]=function(_0x42df49,_0x6fad,_0x4d1270){var _0x4636c4={};var _0x38db2a={};var _0x3cf18c;var _0x19404f;return db['OpenchannelQueue'][_0xe6dc('0x60')]({'where':{'id':_0x42df49[_0xe6dc('0x43')]['id']}})['then'](handleEntityNotFound(_0x6fad,null))[_0xe6dc('0x22')](function(_0x3c9560){if(_0x3c9560){_0x3cf18c=_0x3c9560;_0x38db2a['model']=_[_0xe6dc('0x44')](db[_0xe6dc('0x56')]['rawAttributes']);_0x38db2a[_0xe6dc('0x30')]=_[_0xe6dc('0x44')](_0x42df49[_0xe6dc('0x30')]);_0x38db2a[_0xe6dc('0x3a')]=_['intersection'](_0x38db2a[_0xe6dc('0x33')],_0x38db2a['query']);_0x4636c4[_0xe6dc('0x32')]=_[_0xe6dc('0x31')](_0x38db2a[_0xe6dc('0x33')],qs['fields'](_0x42df49[_0xe6dc('0x30')][_0xe6dc('0x34')]));_0x4636c4[_0xe6dc('0x32')]=_0x4636c4[_0xe6dc('0x32')][_0xe6dc('0x35')]?_0x4636c4[_0xe6dc('0x32')]:_0x38db2a[_0xe6dc('0x33')];_0x4636c4[_0xe6dc('0x8a')]=qs[_0xe6dc('0x38')](_0x42df49[_0xe6dc('0x30')][_0xe6dc('0x38')]);_0x4636c4['where']=qs[_0xe6dc('0x3a')](_[_0xe6dc('0x54')](_0x42df49['query'],_0x38db2a[_0xe6dc('0x3a')]));if(_0x42df49['query'][_0xe6dc('0x3d')]){_0x4636c4['where']=_['merge'](_0x4636c4[_0xe6dc('0x39')],{'$or':_[_0xe6dc('0x2c')](_0x4636c4['attributes'],function(_0x51786a){var _0xcd8b71={};_0xcd8b71[_0x51786a]={'$like':'%'+_0x42df49['query'][_0xe6dc('0x3d')]+'%'};return _0xcd8b71;})});}_0x4636c4=_[_0xe6dc('0x3b')]({},_0x4636c4,_0x42df49[_0xe6dc('0x46')]);return _0x3cf18c[_0xe6dc('0x89')](_0x4636c4);}})[_0xe6dc('0x22')](function(_0x33f257){if(_0x33f257){_0x19404f=_0x33f257['length'];if(!_0x42df49[_0xe6dc('0x30')][_0xe6dc('0x36')](_0xe6dc('0x37'))){_0x4636c4[_0xe6dc('0x1d')]=qs[_0xe6dc('0x1d')](_0x42df49[_0xe6dc('0x30')][_0xe6dc('0x1d')]);_0x4636c4[_0xe6dc('0x1c')]=qs[_0xe6dc('0x1c')](_0x42df49['query'][_0xe6dc('0x1c')]);}return _0x3cf18c[_0xe6dc('0x89')](_0x4636c4);}})['then'](function(_0x4fa1cd){if(_0x4fa1cd){return _0x4fa1cd?{'count':_0x19404f,'rows':_0x4fa1cd}:null;}})[_0xe6dc('0x22')](respondWithResult(_0x6fad,null))['catch'](handleError(_0x6fad,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 2571e11..1300511 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 _0x3706=['../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x24ab36,_0x20bd4d){var _0x2de71a=function(_0x4b2ceb){while(--_0x4b2ceb){_0x24ab36['push'](_0x24ab36['shift']());}};_0x2de71a(++_0x20bd4d);}(_0x3706,0xd0));var _0x6370=function(_0x235482,_0x14b833){_0x235482=_0x235482-0x0;var _0x5f5bea=_0x3706[_0x235482];return _0x5f5bea;};'use strict';var EventEmitter=require(_0x6370('0x0'));var OpenchannelQueue=require(_0x6370('0x1'))['db'][_0x6370('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x6370('0x3')](0x0);var events={'afterCreate':_0x6370('0x4'),'afterUpdate':_0x6370('0x5'),'afterDestroy':_0x6370('0x6')};function emitEvent(_0xe7a9f9){return function(_0x4575b7,_0x43035b,_0x51ee99){OpenchannelQueueEvents['emit'](_0xe7a9f9+':'+_0x4575b7['id'],_0x4575b7);OpenchannelQueueEvents[_0x6370('0x7')](_0xe7a9f9,_0x4575b7);_0x51ee99(null);};}for(var e in events){if(events[_0x6370('0x8')](e)){var event=events[e];OpenchannelQueue[_0x6370('0x9')](e,emitEvent(event));}}module[_0x6370('0xa')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x4655=['../../mysqldb','remove','emit','hasOwnProperty','exports','events'];(function(_0x67d85f,_0x69b720){var _0x28f25b=function(_0x19a901){while(--_0x19a901){_0x67d85f['push'](_0x67d85f['shift']());}};_0x28f25b(++_0x69b720);}(_0x4655,0xb9));var _0x5465=function(_0x36a4a8,_0xbba787){_0x36a4a8=_0x36a4a8-0x0;var _0x5ac451=_0x4655[_0x36a4a8];return _0x5ac451;};'use strict';var EventEmitter=require(_0x5465('0x0'));var OpenchannelQueue=require(_0x5465('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5465('0x2')};function emitEvent(_0x2b247b){return function(_0x38bb21,_0x422438,_0x21f04b){OpenchannelQueueEvents[_0x5465('0x3')](_0x2b247b+':'+_0x38bb21['id'],_0x38bb21);OpenchannelQueueEvents[_0x5465('0x3')](_0x2b247b,_0x38bb21);_0x21f04b(null);};}for(var e in events){if(events[_0x5465('0x4')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x5465('0x5')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index ef07e56..b3259e0 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 _0x1149=['rimraf','exports','OpenchannelQueue','util','moment','bluebird','request-promise','path'];(function(_0x535417,_0xe8ad36){var _0xd77800=function(_0x5e0522){while(--_0x5e0522){_0x535417['push'](_0x535417['shift']());}};_0xd77800(++_0xe8ad36);}(_0x1149,0x6b));var _0x9114=function(_0x30da39,_0x506e1b){_0x30da39=_0x30da39-0x0;var _0x2a962c=_0x1149[_0x30da39];return _0x2a962c;};'use strict';var _=require('lodash');var util=require(_0x9114('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9114('0x1'));var BPromise=require(_0x9114('0x2'));var rp=require(_0x9114('0x3'));var fs=require('fs');var path=require(_0x9114('0x4'));var rimraf=require(_0x9114('0x5'));var config=require('../../config/environment');var attributes=require('./openchannelQueue.attributes');module[_0x9114('0x6')]=function(_0x252a97,_0x34cfa8){return _0x252a97['define'](_0x9114('0x7'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaae4=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','openchannel_queues','lodash'];(function(_0x29e871,_0x330b98){var _0x3380e3=function(_0x26eeae){while(--_0x26eeae){_0x29e871['push'](_0x29e871['shift']());}};_0x3380e3(++_0x330b98);}(_0xaae4,0xc2));var _0x4aae=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xaae4[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x4aae('0x0'));var util=require(_0x4aae('0x1'));var logger=require('../../config/logger')(_0x4aae('0x2'));var moment=require(_0x4aae('0x3'));var BPromise=require(_0x4aae('0x4'));var rp=require(_0x4aae('0x5'));var fs=require('fs');var path=require(_0x4aae('0x6'));var rimraf=require(_0x4aae('0x7'));var config=require(_0x4aae('0x8'));var attributes=require(_0x4aae('0x9'));module[_0x4aae('0xa')]=function(_0x4d7bcc,_0x36d360){return _0x4d7bcc[_0x4aae('0xb')]('OpenchannelQueue',attributes,{'tableName':_0x4aae('0xc'),'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 4fed40b..25539ea 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 _0xa7f9=['OpenchannelQueue','options','raw','where','attributes','limit','include','map','model','ShowOpenchannelQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetOpenchannelQueue'];(function(_0x335599,_0x30657b){var _0x4e9348=function(_0x5f330a){while(--_0x5f330a){_0x335599['push'](_0x335599['shift']());}};_0x4e9348(++_0x30657b);}(_0xa7f9,0x15b));var _0x9a7f=function(_0x202c99,_0x121caf){_0x202c99=_0x202c99-0x0;var _0x256a0f=_0xa7f9[_0x202c99];return _0x256a0f;};'use strict';var _=require(_0x9a7f('0x0'));var util=require('util');var moment=require(_0x9a7f('0x1'));var BPromise=require(_0x9a7f('0x2'));var rs=require(_0x9a7f('0x3'));var fs=require('fs');var Redis=require(_0x9a7f('0x4'));var db=require(_0x9a7f('0x5'))['db'];var utils=require(_0x9a7f('0x6'));var logger=require(_0x9a7f('0x7'))(_0x9a7f('0x8'));var config=require(_0x9a7f('0x9'));var jayson=require(_0x9a7f('0xa'));var client=jayson[_0x9a7f('0xb')][_0x9a7f('0xc')]({'port':0x232a});config[_0x9a7f('0xd')]=_[_0x9a7f('0xe')](config[_0x9a7f('0xd')],{'host':_0x9a7f('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9a7f('0xd')]));require(_0x9a7f('0x10'))[_0x9a7f('0x11')](socket);function respondWithRpcPromise(_0xe02b47,_0x589dba,_0xd3f531){return new BPromise(function(_0x27f74a,_0x5c99ba){return client['request'](_0xe02b47,_0xd3f531)[_0x9a7f('0x12')](function(_0x4f72c7){logger[_0x9a7f('0x13')](_0x9a7f('0x14'),_0x589dba,'request\x20sent');logger[_0x9a7f('0x15')](_0x9a7f('0x16'),_0x589dba,_0x9a7f('0x17'),JSON[_0x9a7f('0x18')](_0x4f72c7));if(_0x4f72c7[_0x9a7f('0x19')]){if(_0x4f72c7[_0x9a7f('0x19')][_0x9a7f('0x1a')]===0x1f4){logger[_0x9a7f('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x589dba,_0x4f72c7[_0x9a7f('0x19')][_0x9a7f('0x1b')]);return _0x5c99ba(_0x4f72c7[_0x9a7f('0x19')][_0x9a7f('0x1b')]);}logger[_0x9a7f('0x19')](_0x9a7f('0x14'),_0x589dba,_0x4f72c7[_0x9a7f('0x19')]['message']);return _0x27f74a(_0x4f72c7[_0x9a7f('0x19')][_0x9a7f('0x1b')]);}else{logger[_0x9a7f('0x13')](_0x9a7f('0x14'),_0x589dba,'request\x20sent');_0x27f74a(_0x4f72c7[_0x9a7f('0x1c')][_0x9a7f('0x1b')]);}})[_0x9a7f('0x1d')](function(_0x248405){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x589dba,_0x248405);_0x5c99ba(_0x248405);});});}exports[_0x9a7f('0x1e')]=function(_0x5300e9){var _0x5248f8=this;return new Promise(function(_0x186516,_0x106034){return db[_0x9a7f('0x1f')]['findAll']({'raw':_0x5300e9[_0x9a7f('0x20')]?_0x5300e9[_0x9a7f('0x20')][_0x9a7f('0x21')]===undefined?!![]:![]:!![],'where':_0x5300e9[_0x9a7f('0x20')]?_0x5300e9[_0x9a7f('0x20')][_0x9a7f('0x22')]||null:null,'attributes':_0x5300e9[_0x9a7f('0x20')]?_0x5300e9['options'][_0x9a7f('0x23')]||null:null,'limit':_0x5300e9['options']?_0x5300e9[_0x9a7f('0x20')][_0x9a7f('0x24')]||null:null,'include':_0x5300e9[_0x9a7f('0x20')]?_0x5300e9[_0x9a7f('0x20')]['include']?_['map'](_0x5300e9[_0x9a7f('0x20')][_0x9a7f('0x25')],function(_0x5ae5b8){return{'model':db[_0x5ae5b8['model']],'as':_0x5ae5b8['as'],'attributes':_0x5ae5b8['attributes'],'include':_0x5ae5b8['include']?_[_0x9a7f('0x26')](_0x5ae5b8[_0x9a7f('0x25')],function(_0x5580e0){return{'model':db[_0x5580e0['model']],'as':_0x5580e0['as'],'attributes':_0x5580e0[_0x9a7f('0x23')],'include':_0x5580e0[_0x9a7f('0x25')]?_[_0x9a7f('0x26')](_0x5580e0[_0x9a7f('0x25')],function(_0x51ba97){return{'model':db[_0x51ba97[_0x9a7f('0x27')]],'as':_0x51ba97['as'],'attributes':_0x51ba97[_0x9a7f('0x23')]};}):[]};}):[]};}):[]:[]})[_0x9a7f('0x12')](function(_0x52eec0){logger[_0x9a7f('0x13')]('GetOpenchannelQueue',_0x5300e9);logger['debug'](_0x9a7f('0x1e'),_0x5300e9,JSON['stringify'](_0x52eec0));_0x186516(_0x52eec0);})[_0x9a7f('0x1d')](function(_0x147883){logger[_0x9a7f('0x19')]('GetOpenchannelQueue',_0x147883[_0x9a7f('0x1b')],_0x5300e9);_0x106034(_0x5248f8['error'](0x1f4,_0x147883[_0x9a7f('0x1b')]));});});};exports[_0x9a7f('0x28')]=function(_0x3de9a7){var _0x34c9fb=this;return new Promise(function(_0x1b7009,_0xd87883){return db[_0x9a7f('0x1f')][_0x9a7f('0x29')]({'raw':_0x3de9a7[_0x9a7f('0x20')]?_0x3de9a7[_0x9a7f('0x20')][_0x9a7f('0x21')]===undefined?!![]:![]:!![],'where':_0x3de9a7['options']?_0x3de9a7[_0x9a7f('0x20')][_0x9a7f('0x22')]||null:null,'attributes':_0x3de9a7[_0x9a7f('0x20')]?_0x3de9a7['options'][_0x9a7f('0x23')]||null:null,'include':_0x3de9a7['options']?_0x3de9a7['options'][_0x9a7f('0x25')]?_[_0x9a7f('0x26')](_0x3de9a7['options'][_0x9a7f('0x25')],function(_0x13260a){return{'model':db[_0x13260a['model']],'as':_0x13260a['as'],'attributes':_0x13260a['attributes'],'include':_0x13260a[_0x9a7f('0x25')]?_['map'](_0x13260a[_0x9a7f('0x25')],function(_0x70fa5f){return{'model':db[_0x70fa5f[_0x9a7f('0x27')]],'as':_0x70fa5f['as'],'attributes':_0x70fa5f[_0x9a7f('0x23')],'include':_0x70fa5f[_0x9a7f('0x25')]?_[_0x9a7f('0x26')](_0x70fa5f[_0x9a7f('0x25')],function(_0x4334b8){return{'model':db[_0x4334b8[_0x9a7f('0x27')]],'as':_0x4334b8['as'],'attributes':_0x4334b8[_0x9a7f('0x23')]};}):[]};}):[]};}):[]:[]})[_0x9a7f('0x12')](function(_0x228e0b){logger[_0x9a7f('0x13')](_0x9a7f('0x28'),_0x3de9a7);logger[_0x9a7f('0x15')](_0x9a7f('0x28'),_0x3de9a7,JSON[_0x9a7f('0x18')](_0x228e0b));_0x1b7009(_0x228e0b);})[_0x9a7f('0x1d')](function(_0x115fbd){logger[_0x9a7f('0x19')](_0x9a7f('0x28'),_0x115fbd[_0x9a7f('0x1b')],_0x3de9a7);_0xd87883(_0x34c9fb[_0x9a7f('0x19')](0x1f4,_0x115fbd[_0x9a7f('0x1b')]));});});}; \ No newline at end of file +var _0x1192=['OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','include','map','model','ShowOpenchannelQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','debug'];(function(_0x5cf04d,_0x59c7c2){var _0x543e95=function(_0x294a6f){while(--_0x294a6f){_0x5cf04d['push'](_0x5cf04d['shift']());}};_0x543e95(++_0x59c7c2);}(_0x1192,0x109));var _0x2119=function(_0x416eed,_0x3a2a24){_0x416eed=_0x416eed-0x0;var _0x325487=_0x1192[_0x416eed];return _0x325487;};'use strict';var _=require(_0x2119('0x0'));var util=require('util');var moment=require(_0x2119('0x1'));var BPromise=require(_0x2119('0x2'));var rs=require(_0x2119('0x3'));var fs=require('fs');var Redis=require(_0x2119('0x4'));var db=require(_0x2119('0x5'))['db'];var utils=require(_0x2119('0x6'));var logger=require(_0x2119('0x7'))('rpc');var config=require(_0x2119('0x8'));var jayson=require(_0x2119('0x9'));var client=jayson[_0x2119('0xa')][_0x2119('0xb')]({'port':0x232a});config['redis']=_[_0x2119('0xc')](config[_0x2119('0xd')],{'host':_0x2119('0xe'),'port':0x18eb});var socket=require(_0x2119('0xf'))(new Redis(config[_0x2119('0xd')]));require('./openchannelQueue.socket')[_0x2119('0x10')](socket);function respondWithRpcPromise(_0x3875ad,_0x2f19ed,_0x1fd40d){return new BPromise(function(_0x5757a6,_0x3c485b){return client[_0x2119('0x11')](_0x3875ad,_0x1fd40d)[_0x2119('0x12')](function(_0x1e1130){logger[_0x2119('0x13')](_0x2119('0x14'),_0x2f19ed,'request\x20sent');logger[_0x2119('0x15')](_0x2119('0x16'),_0x2f19ed,'request\x20sent',JSON[_0x2119('0x17')](_0x1e1130));if(_0x1e1130[_0x2119('0x18')]){if(_0x1e1130['error'][_0x2119('0x19')]===0x1f4){logger[_0x2119('0x18')](_0x2119('0x14'),_0x2f19ed,_0x1e1130['error'][_0x2119('0x1a')]);return _0x3c485b(_0x1e1130['error'][_0x2119('0x1a')]);}logger[_0x2119('0x18')](_0x2119('0x14'),_0x2f19ed,_0x1e1130['error'][_0x2119('0x1a')]);return _0x5757a6(_0x1e1130[_0x2119('0x18')][_0x2119('0x1a')]);}else{logger[_0x2119('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x2f19ed,'request\x20sent');_0x5757a6(_0x1e1130[_0x2119('0x1b')]['message']);}})[_0x2119('0x1c')](function(_0x4124e1){logger[_0x2119('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x2f19ed,_0x4124e1);_0x3c485b(_0x4124e1);});});}exports[_0x2119('0x1d')]=function(_0x3cac84){var _0x4ceb01=this;return new Promise(function(_0x419efb,_0x72c4d1){return db[_0x2119('0x1e')][_0x2119('0x1f')]({'raw':_0x3cac84['options']?_0x3cac84[_0x2119('0x20')][_0x2119('0x21')]===undefined?!![]:![]:!![],'where':_0x3cac84[_0x2119('0x20')]?_0x3cac84[_0x2119('0x20')][_0x2119('0x22')]||null:null,'attributes':_0x3cac84['options']?_0x3cac84['options']['attributes']||null:null,'limit':_0x3cac84[_0x2119('0x20')]?_0x3cac84[_0x2119('0x20')]['limit']||null:null,'include':_0x3cac84[_0x2119('0x20')]?_0x3cac84[_0x2119('0x20')]['include']?_['map'](_0x3cac84[_0x2119('0x20')]['include'],function(_0x384f62){return{'model':db[_0x384f62['model']],'as':_0x384f62['as'],'attributes':_0x384f62[_0x2119('0x23')],'include':_0x384f62[_0x2119('0x24')]?_[_0x2119('0x25')](_0x384f62[_0x2119('0x24')],function(_0x575a25){return{'model':db[_0x575a25['model']],'as':_0x575a25['as'],'attributes':_0x575a25[_0x2119('0x23')],'include':_0x575a25[_0x2119('0x24')]?_['map'](_0x575a25[_0x2119('0x24')],function(_0x427ebc){return{'model':db[_0x427ebc[_0x2119('0x26')]],'as':_0x427ebc['as'],'attributes':_0x427ebc[_0x2119('0x23')]};}):[]};}):[]};}):[]:[]})[_0x2119('0x12')](function(_0x5e8ef7){logger[_0x2119('0x13')]('GetOpenchannelQueue',_0x3cac84);logger[_0x2119('0x15')](_0x2119('0x1d'),_0x3cac84,JSON[_0x2119('0x17')](_0x5e8ef7));_0x419efb(_0x5e8ef7);})['catch'](function(_0x3ecb49){logger['error'](_0x2119('0x1d'),_0x3ecb49[_0x2119('0x1a')],_0x3cac84);_0x72c4d1(_0x4ceb01[_0x2119('0x18')](0x1f4,_0x3ecb49['message']));});});};exports[_0x2119('0x27')]=function(_0x585ea8){var _0x4cb9c9=this;return new Promise(function(_0x4cc4ad,_0x512455){return db[_0x2119('0x1e')][_0x2119('0x28')]({'raw':_0x585ea8[_0x2119('0x20')]?_0x585ea8[_0x2119('0x20')][_0x2119('0x21')]===undefined?!![]:![]:!![],'where':_0x585ea8['options']?_0x585ea8['options'][_0x2119('0x22')]||null:null,'attributes':_0x585ea8[_0x2119('0x20')]?_0x585ea8[_0x2119('0x20')][_0x2119('0x23')]||null:null,'include':_0x585ea8[_0x2119('0x20')]?_0x585ea8[_0x2119('0x20')][_0x2119('0x24')]?_[_0x2119('0x25')](_0x585ea8[_0x2119('0x20')][_0x2119('0x24')],function(_0x879aa9){return{'model':db[_0x879aa9['model']],'as':_0x879aa9['as'],'attributes':_0x879aa9[_0x2119('0x23')],'include':_0x879aa9[_0x2119('0x24')]?_['map'](_0x879aa9[_0x2119('0x24')],function(_0x5b4470){return{'model':db[_0x5b4470['model']],'as':_0x5b4470['as'],'attributes':_0x5b4470[_0x2119('0x23')],'include':_0x5b4470[_0x2119('0x24')]?_['map'](_0x5b4470[_0x2119('0x24')],function(_0x3c6100){return{'model':db[_0x3c6100[_0x2119('0x26')]],'as':_0x3c6100['as'],'attributes':_0x3c6100[_0x2119('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x461497){logger[_0x2119('0x13')](_0x2119('0x27'),_0x585ea8);logger[_0x2119('0x15')](_0x2119('0x27'),_0x585ea8,JSON[_0x2119('0x17')](_0x461497));_0x4cc4ad(_0x461497);})[_0x2119('0x1c')](function(_0x247009){logger[_0x2119('0x18')](_0x2119('0x27'),_0x247009[_0x2119('0x1a')],_0x585ea8);_0x512455(_0x4cb9c9[_0x2119('0x18')](0x1f4,_0x247009['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 262cdca..3f5a1f0 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 _0x758e=['openchannelQueue:','save','remove','update','emit','removeListener','register'];(function(_0x5e95fb,_0x9cde9){var _0x5c473b=function(_0x3a73ce){while(--_0x3a73ce){_0x5e95fb['push'](_0x5e95fb['shift']());}};_0x5c473b(++_0x9cde9);}(_0x758e,0xc5));var _0xe758=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x758e[_0x397e5f];return _0x5302b8;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xe758('0x0'),_0xe758('0x1'),_0xe758('0x2')];function createListener(_0x368271,_0x43556e){return function(_0x516f14){_0x43556e[_0xe758('0x3')](_0x368271,_0x516f14);};}function removeListener(_0x19ba41,_0x3c3ea4){return function(){OpenchannelQueueEvents[_0xe758('0x4')](_0x19ba41,_0x3c3ea4);};}exports[_0xe758('0x5')]=function(_0x39429f){for(var _0x545aa4=0x0,_0x5b1f05=events['length'];_0x545aa4<_0x5b1f05;_0x545aa4++){var _0x2131e6=events[_0x545aa4];var _0x3f114d=createListener(_0xe758('0x6')+_0x2131e6,_0x39429f);OpenchannelQueueEvents['on'](_0x2131e6,_0x3f114d);}}; \ No newline at end of file +var _0x8d45=['update','emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x36828e,_0x1e401c){var _0x129fe3=function(_0x43c656){while(--_0x43c656){_0x36828e['push'](_0x36828e['shift']());}};_0x129fe3(++_0x1e401c);}(_0x8d45,0x138));var _0x58d4=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x8d45[_0x432682];return _0x463d05;};'use strict';var OpenchannelQueueEvents=require(_0x58d4('0x0'));var events=[_0x58d4('0x1'),_0x58d4('0x2'),_0x58d4('0x3')];function createListener(_0x59b447,_0x359693){return function(_0x5c66de){_0x359693[_0x58d4('0x4')](_0x59b447,_0x5c66de);};}function removeListener(_0x1f1dd1,_0x344eb3){return function(){OpenchannelQueueEvents[_0x58d4('0x5')](_0x1f1dd1,_0x344eb3);};}exports[_0x58d4('0x6')]=function(_0x9c5eb2){for(var _0x3d4cdd=0x0,_0xc8cdb1=events[_0x58d4('0x7')];_0x3d4cdd<_0xc8cdb1;_0x3d4cdd++){var _0x235c99=events[_0x3d4cdd];var _0x4345db=createListener(_0x58d4('0x8')+_0x235c99,_0x9c5eb2);OpenchannelQueueEvents['on'](_0x235c99,_0x4345db);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 1fd8b6b..01e5b2c 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 _0x48b8=['show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x152d32,_0x496c00){var _0x317614=function(_0x35ac9f){while(--_0x35ac9f){_0x152d32['push'](_0x152d32['shift']());}};_0x317614(++_0x496c00);}(_0x48b8,0x1ab));var _0x848b=function(_0x5c8e1b,_0x37a758){_0x5c8e1b=_0x5c8e1b-0x0;var _0x4686d9=_0x48b8[_0x5c8e1b];return _0x4686d9;};'use strict';var multer=require(_0x848b('0x0'));var util=require(_0x848b('0x1'));var path=require('path');var timeout=require(_0x848b('0x2'));var express=require(_0x848b('0x3'));var router=express[_0x848b('0x4')]();var auth=require(_0x848b('0x5'));var interaction=require(_0x848b('0x6'));var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router[_0x848b('0x7')]('/',auth['isAuthenticated'](),controller[_0x848b('0x8')]);router[_0x848b('0x7')](_0x848b('0x9'),auth[_0x848b('0xa')](),controller[_0x848b('0xb')]);router['get'](_0x848b('0xc'),auth[_0x848b('0xa')](),controller[_0x848b('0xd')]);router[_0x848b('0xe')]('/',auth[_0x848b('0xa')](),controller[_0x848b('0xf')]);router['put']('/:id',auth[_0x848b('0xa')](),controller[_0x848b('0x10')]);router[_0x848b('0x11')](_0x848b('0xc'),auth[_0x848b('0xa')](),controller[_0x848b('0x12')]);module[_0x848b('0x13')]=router; \ No newline at end of file +var _0x7d6a=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','index','get','isAuthenticated','describe','/:id','post','create','put','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x26c848,_0x2e36ba){var _0x599488=function(_0x2e886a){while(--_0x2e886a){_0x26c848['push'](_0x26c848['shift']());}};_0x599488(++_0x2e36ba);}(_0x7d6a,0x1a1));var _0xa7d6=function(_0x22079a,_0x45d298){_0x22079a=_0x22079a-0x0;var _0xccd4a=_0x7d6a[_0x22079a];return _0xccd4a;};'use strict';var multer=require(_0xa7d6('0x0'));var util=require(_0xa7d6('0x1'));var path=require('path');var timeout=require(_0xa7d6('0x2'));var express=require(_0xa7d6('0x3'));var router=express[_0xa7d6('0x4')]();var auth=require(_0xa7d6('0x5'));var interaction=require(_0xa7d6('0x6'));var config=require(_0xa7d6('0x7'));var controller=require(_0xa7d6('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa7d6('0x9')]);router[_0xa7d6('0xa')]('/describe',auth[_0xa7d6('0xb')](),controller[_0xa7d6('0xc')]);router['get'](_0xa7d6('0xd'),auth[_0xa7d6('0xb')](),controller['show']);router[_0xa7d6('0xe')]('/',auth[_0xa7d6('0xb')](),controller[_0xa7d6('0xf')]);router[_0xa7d6('0x10')](_0xa7d6('0xd'),auth[_0xa7d6('0xb')](),controller['update']);router[_0xa7d6('0x11')](_0xa7d6('0xd'),auth[_0xa7d6('0xb')](),controller[_0xa7d6('0x12')]);module[_0xa7d6('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 5f18405..657d050 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 _0x06de=['moment','sequelize','DATE','STRING'];(function(_0x423e82,_0x4695e8){var _0x46ed71=function(_0x3f809e){while(--_0x3f809e){_0x423e82['push'](_0x423e82['shift']());}};_0x46ed71(++_0x4695e8);}(_0x06de,0x134));var _0xe06d=function(_0x42c341,_0x31d467){_0x42c341=_0x42c341-0x0;var _0x43621b=_0x06de[_0x42c341];return _0x43621b;};'use strict';var moment=require(_0xe06d('0x0'));var Sequelize=require(_0xe06d('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xe06d('0x2')]},'leaveAt':{'type':Sequelize[_0xe06d('0x2')]},'acceptAt':{'type':Sequelize[_0xe06d('0x2')]},'exitAt':{'type':Sequelize[_0xe06d('0x2')]},'reason':{'type':Sequelize[_0xe06d('0x3')]}}; \ No newline at end of file +var _0x64cc=['STRING','DATE','moment','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x64cc,0x66));var _0xc64c=function(_0x1793e0,_0x3a69fb){_0x1793e0=_0x1793e0-0x0;var _0x4b9e8e=_0x64cc[_0x1793e0];return _0x4b9e8e;};'use strict';var moment=require(_0xc64c('0x0'));var Sequelize=require(_0xc64c('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xc64c('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xc64c('0x3')]},'leaveAt':{'type':Sequelize[_0xc64c('0x3')]},'acceptAt':{'type':Sequelize[_0xc64c('0x3')]},'exitAt':{'type':Sequelize[_0xc64c('0x3')]},'reason':{'type':Sequelize[_0xc64c('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 845e78e..54f6e6e 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 _0x8bd1=['apply','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','pick','filter','merge','type','options','where','OpenchannelQueueReport','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','lodash','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','json','count','offset','limit','set'];(function(_0x5414fa,_0x355cb1){var _0x134d69=function(_0x38ffee){while(--_0x38ffee){_0x5414fa['push'](_0x5414fa['shift']());}};_0x134d69(++_0x355cb1);}(_0x8bd1,0x188));var _0x18bd=function(_0xb11026,_0x1cb75e){_0xb11026=_0xb11026-0x0;var _0x455cbe=_0x8bd1[_0xb11026];return _0x455cbe;};'use strict';var pdf=require(_0x18bd('0x0'));var emlformat=require(_0x18bd('0x1'));var rimraf=require(_0x18bd('0x2'));var zipdir=require(_0x18bd('0x3'));var jsonpatch=require(_0x18bd('0x4'));var rp=require(_0x18bd('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x18bd('0x6'));var util=require(_0x18bd('0x7'));var path=require('path');var sox=require(_0x18bd('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x18bd('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x18bd('0xa'));var deskjs=require(_0x18bd('0xb'));var toCsv=require(_0x18bd('0xc'));var querystring=require(_0x18bd('0xd'));var Papa=require('papaparse');var Redis=require(_0x18bd('0xe'));var authService=require(_0x18bd('0xf'));var qs=require(_0x18bd('0x10'));var as=require(_0x18bd('0x11'));var hardwareService=require(_0x18bd('0x12'));var logger=require('../../config/logger')(_0x18bd('0x13'));var utils=require('../../config/utils');var config=require(_0x18bd('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x202ef1,_0x3f4b7e){_0x3f4b7e=_0x3f4b7e||0xcc;return function(_0x242d04){if(_0x242d04){return _0x202ef1[_0x18bd('0x15')](_0x3f4b7e);}return _0x202ef1[_0x18bd('0x16')](_0x3f4b7e)['end']();};}function respondWithResult(_0x56be1f,_0x5cdb27){_0x5cdb27=_0x5cdb27||0xc8;return function(_0x1f6e17){if(_0x1f6e17){return _0x56be1f[_0x18bd('0x16')](_0x5cdb27)[_0x18bd('0x17')](_0x1f6e17);}};}function respondWithFilteredResult(_0x34470b,_0x4f806c){return function(_0x204765){if(_0x204765){var _0x940f41=_0x204765[_0x18bd('0x18')],_0x51d340=_0x4f806c[_0x18bd('0x19')],_0x18a0a4=_0x4f806c[_0x18bd('0x19')]+_0x4f806c[_0x18bd('0x1a')],_0x46e566;if(_0x18a0a4>=_0x940f41){_0x18a0a4=_0x940f41;_0x46e566=0xc8;}else{_0x46e566=0xce;}_0x34470b[_0x18bd('0x16')](_0x46e566);return _0x34470b[_0x18bd('0x1b')]('Content-Range',_0x51d340+'-'+_0x18a0a4+'/'+_0x940f41)[_0x18bd('0x17')](_0x204765);}return null;};}function patchUpdates(_0x590aee){return function(_0xdff903){try{jsonpatch[_0x18bd('0x1c')](_0xdff903,_0x590aee,!![]);}catch(_0x374be5){return BPromise['reject'](_0x374be5);}return _0xdff903['save']();};}function saveUpdates(_0x229223,_0x5a9b44){return function(_0x5d0c42){if(_0x5d0c42){return _0x5d0c42[_0x18bd('0x1d')](_0x229223)[_0x18bd('0x1e')](function(_0x3a2a61){return _0x3a2a61;});}return null;};}function removeEntity(_0x343d37,_0x56d19a){return function(_0x445cf3){if(_0x445cf3){return _0x445cf3[_0x18bd('0x1f')]()[_0x18bd('0x1e')](function(){_0x343d37['status'](0xcc)[_0x18bd('0x20')]();});}};}function handleEntityNotFound(_0x8097be,_0x1b9250){return function(_0x229bdf){if(!_0x229bdf){_0x8097be[_0x18bd('0x15')](0x194);}return _0x229bdf;};}function handleError(_0x44203f,_0x1a0ccf){_0x1a0ccf=_0x1a0ccf||0x1f4;return function(_0x3e2a8d){logger[_0x18bd('0x21')](_0x3e2a8d[_0x18bd('0x22')]);if(_0x3e2a8d[_0x18bd('0x23')]){delete _0x3e2a8d[_0x18bd('0x23')];}_0x44203f[_0x18bd('0x16')](_0x1a0ccf)[_0x18bd('0x24')](_0x3e2a8d);};}exports[_0x18bd('0x25')]=function(_0x1ca32d,_0x3f6caf){var _0x45d36b={},_0x5f02bc={},_0xcaf3c8={'count':0x0,'rows':[]};var _0x253818=_[_0x18bd('0x26')](db['OpenchannelQueueReport'][_0x18bd('0x27')],function(_0x4e6196){return{'name':_0x4e6196['fieldName'],'type':_0x4e6196['type'][_0x18bd('0x28')]};});_0x5f02bc[_0x18bd('0x29')]=_[_0x18bd('0x26')](_0x253818,'name');_0x5f02bc['query']=_[_0x18bd('0x2a')](_0x1ca32d['query']);_0x5f02bc[_0x18bd('0x2b')]=_[_0x18bd('0x2c')](_0x5f02bc[_0x18bd('0x29')],_0x5f02bc[_0x18bd('0x2d')]);_0x45d36b[_0x18bd('0x2e')]=_[_0x18bd('0x2c')](_0x5f02bc[_0x18bd('0x29')],qs[_0x18bd('0x2f')](_0x1ca32d['query'][_0x18bd('0x2f')]));_0x45d36b[_0x18bd('0x2e')]=_0x45d36b[_0x18bd('0x2e')]['length']?_0x45d36b['attributes']:_0x5f02bc[_0x18bd('0x29')];if(!_0x1ca32d[_0x18bd('0x2d')][_0x18bd('0x30')]('nolimit')){_0x45d36b[_0x18bd('0x1a')]=qs[_0x18bd('0x1a')](_0x1ca32d['query']['limit']);_0x45d36b[_0x18bd('0x19')]=qs[_0x18bd('0x19')](_0x1ca32d[_0x18bd('0x2d')]['offset']);}_0x45d36b[_0x18bd('0x31')]=qs['sort'](_0x1ca32d[_0x18bd('0x2d')][_0x18bd('0x32')]);_0x45d36b['where']=qs[_0x18bd('0x2b')](_[_0x18bd('0x33')](_0x1ca32d[_0x18bd('0x2d')],_0x5f02bc[_0x18bd('0x2b')]),_0x253818);if(_0x1ca32d[_0x18bd('0x2d')][_0x18bd('0x34')]){_0x45d36b['where']=_[_0x18bd('0x35')](_0x45d36b['where'],{'$or':_[_0x18bd('0x26')](_0x253818,function(_0x38f1ca){if(_0x38f1ca[_0x18bd('0x36')]!=='VIRTUAL'){var _0x4d0d49={};_0x4d0d49[_0x38f1ca[_0x18bd('0x23')]]={'$like':'%'+_0x1ca32d[_0x18bd('0x2d')]['filter']+'%'};return _0x4d0d49;}})});}_0x45d36b=_['merge']({},_0x45d36b,_0x1ca32d[_0x18bd('0x37')]);var _0x4a847c={'where':_0x45d36b[_0x18bd('0x38')]};return db[_0x18bd('0x39')][_0x18bd('0x18')](_0x4a847c)[_0x18bd('0x1e')](function(_0x4ea96c){_0xcaf3c8[_0x18bd('0x18')]=_0x4ea96c;if(_0x1ca32d['query'][_0x18bd('0x3a')]){_0x45d36b[_0x18bd('0x3b')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x18bd('0x3c')](_0x45d36b);})[_0x18bd('0x1e')](function(_0x65f28c){_0xcaf3c8[_0x18bd('0x3d')]=_0x65f28c;return _0xcaf3c8;})[_0x18bd('0x1e')](respondWithFilteredResult(_0x3f6caf,_0x45d36b))['catch'](handleError(_0x3f6caf,null));};exports[_0x18bd('0x3e')]=function(_0x2c6057,_0x589bd7){var _0x306112={'raw':!![],'where':{'id':_0x2c6057[_0x18bd('0x3f')]['id']}},_0x95d218={};_0x95d218[_0x18bd('0x29')]=_[_0x18bd('0x2a')](db[_0x18bd('0x39')][_0x18bd('0x27')]);_0x95d218[_0x18bd('0x2d')]=_[_0x18bd('0x2a')](_0x2c6057[_0x18bd('0x2d')]);_0x95d218[_0x18bd('0x2b')]=_['intersection'](_0x95d218['model'],_0x95d218['query']);_0x306112['attributes']=_[_0x18bd('0x2c')](_0x95d218[_0x18bd('0x29')],qs[_0x18bd('0x2f')](_0x2c6057[_0x18bd('0x2d')][_0x18bd('0x2f')]));_0x306112['attributes']=_0x306112[_0x18bd('0x2e')][_0x18bd('0x40')]?_0x306112['attributes']:_0x95d218['model'];if(_0x2c6057[_0x18bd('0x2d')][_0x18bd('0x3a')]){_0x306112[_0x18bd('0x3b')]=[{'all':!![]}];}_0x306112=_['merge']({},_0x306112,_0x2c6057[_0x18bd('0x37')]);return db[_0x18bd('0x39')][_0x18bd('0x41')](_0x306112)['then'](handleEntityNotFound(_0x589bd7,null))[_0x18bd('0x1e')](respondWithResult(_0x589bd7,null))[_0x18bd('0x42')](handleError(_0x589bd7,null));};exports[_0x18bd('0x43')]=function(_0x2c0085,_0x3b6d50){return db[_0x18bd('0x39')][_0x18bd('0x43')](_0x2c0085[_0x18bd('0x44')],{})[_0x18bd('0x1e')](respondWithResult(_0x3b6d50,0xc9))[_0x18bd('0x42')](handleError(_0x3b6d50,null));};exports['update']=function(_0x3e1e39,_0x19b112){if(_0x3e1e39[_0x18bd('0x44')]['id']){delete _0x3e1e39[_0x18bd('0x44')]['id'];}return db[_0x18bd('0x39')][_0x18bd('0x41')]({'where':{'id':_0x3e1e39[_0x18bd('0x3f')]['id']}})[_0x18bd('0x1e')](handleEntityNotFound(_0x19b112,null))[_0x18bd('0x1e')](saveUpdates(_0x3e1e39['body'],null))[_0x18bd('0x1e')](respondWithResult(_0x19b112,null))[_0x18bd('0x42')](handleError(_0x19b112,null));};exports[_0x18bd('0x1f')]=function(_0x12b505,_0x5b16ac){return db['OpenchannelQueueReport'][_0x18bd('0x41')]({'where':{'id':_0x12b505[_0x18bd('0x3f')]['id']}})[_0x18bd('0x1e')](handleEntityNotFound(_0x5b16ac,null))[_0x18bd('0x1e')](removeEntity(_0x5b16ac,null))['catch'](handleError(_0x5b16ac,null));};exports[_0x18bd('0x45')]=function(_0x39093f,_0x3e08bd){return db[_0x18bd('0x39')]['describe']()[_0x18bd('0x1e')](respondWithResult(_0x3e08bd,null))['catch'](handleError(_0x3e08bd,null));}; \ No newline at end of file +var _0x6965=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','filter','where','merge','options','includeAll','include','findAll','catch','show','find','create','body','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query'];(function(_0xe719ec,_0x5a280e){var _0x4842a1=function(_0x59b968){while(--_0x59b968){_0xe719ec['push'](_0xe719ec['shift']());}};_0x4842a1(++_0x5a280e);}(_0x6965,0xa8));var _0x5696=function(_0x361bd6,_0x3c03ee){_0x361bd6=_0x361bd6-0x0;var _0x56956f=_0x6965[_0x361bd6];return _0x56956f;};'use strict';var pdf=require(_0x5696('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5696('0x1'));var zipdir=require(_0x5696('0x2'));var jsonpatch=require(_0x5696('0x3'));var rp=require('request-promise');var moment=require(_0x5696('0x4'));var BPromise=require(_0x5696('0x5'));var Mustache=require(_0x5696('0x6'));var util=require(_0x5696('0x7'));var path=require(_0x5696('0x8'));var sox=require(_0x5696('0x9'));var csv=require(_0x5696('0xa'));var ejs=require(_0x5696('0xb'));var fs=require('fs');var _=require(_0x5696('0xc'));var squel=require(_0x5696('0xd'));var crypto=require('crypto');var jsforce=require(_0x5696('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5696('0xa'));var querystring=require('querystring');var Papa=require(_0x5696('0xf'));var Redis=require(_0x5696('0x10'));var authService=require(_0x5696('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5696('0x12'));var hardwareService=require(_0x5696('0x13'));var logger=require(_0x5696('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x5696('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c23e6,_0x255746){_0x255746=_0x255746||0xcc;return function(_0x2a9d32){if(_0x2a9d32){return _0x1c23e6[_0x5696('0x16')](_0x255746);}return _0x1c23e6[_0x5696('0x17')](_0x255746)[_0x5696('0x18')]();};}function respondWithResult(_0x3da2d7,_0x3ca9d4){_0x3ca9d4=_0x3ca9d4||0xc8;return function(_0x463886){if(_0x463886){return _0x3da2d7[_0x5696('0x17')](_0x3ca9d4)[_0x5696('0x19')](_0x463886);}};}function respondWithFilteredResult(_0x13546f,_0x3bbdce){return function(_0x18b03a){if(_0x18b03a){var _0x4bf371=_0x18b03a[_0x5696('0x1a')],_0x1e79a2=_0x3bbdce['offset'],_0xd2b266=_0x3bbdce['offset']+_0x3bbdce[_0x5696('0x1b')],_0x1d0251;if(_0xd2b266>=_0x4bf371){_0xd2b266=_0x4bf371;_0x1d0251=0xc8;}else{_0x1d0251=0xce;}_0x13546f['status'](_0x1d0251);return _0x13546f[_0x5696('0x1c')](_0x5696('0x1d'),_0x1e79a2+'-'+_0xd2b266+'/'+_0x4bf371)[_0x5696('0x19')](_0x18b03a);}return null;};}function patchUpdates(_0x19963c){return function(_0x353faf){try{jsonpatch[_0x5696('0x1e')](_0x353faf,_0x19963c,!![]);}catch(_0x48517e){return BPromise[_0x5696('0x1f')](_0x48517e);}return _0x353faf['save']();};}function saveUpdates(_0x20090d,_0x61a588){return function(_0x397f66){if(_0x397f66){return _0x397f66[_0x5696('0x20')](_0x20090d)['then'](function(_0x19fb93){return _0x19fb93;});}return null;};}function removeEntity(_0x17019c,_0x25b956){return function(_0x564b0c){if(_0x564b0c){return _0x564b0c[_0x5696('0x21')]()[_0x5696('0x22')](function(){_0x17019c[_0x5696('0x17')](0xcc)[_0x5696('0x18')]();});}};}function handleEntityNotFound(_0x2156cb,_0x24b194){return function(_0x30089d){if(!_0x30089d){_0x2156cb[_0x5696('0x16')](0x194);}return _0x30089d;};}function handleError(_0x5f47e2,_0x45e439){_0x45e439=_0x45e439||0x1f4;return function(_0x5bafe0){logger[_0x5696('0x23')](_0x5bafe0[_0x5696('0x24')]);if(_0x5bafe0[_0x5696('0x25')]){delete _0x5bafe0[_0x5696('0x25')];}_0x5f47e2[_0x5696('0x17')](_0x45e439)[_0x5696('0x26')](_0x5bafe0);};}exports[_0x5696('0x27')]=function(_0x40df41,_0x5139ce){var _0x1b83bc={},_0x57ea75={},_0x37297c={'count':0x0,'rows':[]};var _0x27ca49=_[_0x5696('0x28')](db[_0x5696('0x29')][_0x5696('0x2a')],function(_0xe6de78){return{'name':_0xe6de78[_0x5696('0x2b')],'type':_0xe6de78[_0x5696('0x2c')][_0x5696('0x2d')]};});_0x57ea75[_0x5696('0x2e')]=_[_0x5696('0x28')](_0x27ca49,'name');_0x57ea75[_0x5696('0x2f')]=_[_0x5696('0x30')](_0x40df41[_0x5696('0x2f')]);_0x57ea75[_0x5696('0x31')]=_[_0x5696('0x32')](_0x57ea75[_0x5696('0x2e')],_0x57ea75[_0x5696('0x2f')]);_0x1b83bc['attributes']=_[_0x5696('0x32')](_0x57ea75[_0x5696('0x2e')],qs[_0x5696('0x33')](_0x40df41['query'][_0x5696('0x33')]));_0x1b83bc['attributes']=_0x1b83bc[_0x5696('0x34')][_0x5696('0x35')]?_0x1b83bc[_0x5696('0x34')]:_0x57ea75[_0x5696('0x2e')];if(!_0x40df41['query'][_0x5696('0x36')](_0x5696('0x37'))){_0x1b83bc[_0x5696('0x1b')]=qs[_0x5696('0x1b')](_0x40df41[_0x5696('0x2f')][_0x5696('0x1b')]);_0x1b83bc[_0x5696('0x38')]=qs['offset'](_0x40df41['query'][_0x5696('0x38')]);}_0x1b83bc['order']=qs['sort'](_0x40df41[_0x5696('0x2f')][_0x5696('0x39')]);_0x1b83bc['where']=qs[_0x5696('0x31')](_['pick'](_0x40df41[_0x5696('0x2f')],_0x57ea75[_0x5696('0x31')]),_0x27ca49);if(_0x40df41[_0x5696('0x2f')][_0x5696('0x3a')]){_0x1b83bc[_0x5696('0x3b')]=_['merge'](_0x1b83bc[_0x5696('0x3b')],{'$or':_['map'](_0x27ca49,function(_0x5931c8){if(_0x5931c8[_0x5696('0x2c')]!=='VIRTUAL'){var _0x47b70c={};_0x47b70c[_0x5931c8[_0x5696('0x25')]]={'$like':'%'+_0x40df41[_0x5696('0x2f')]['filter']+'%'};return _0x47b70c;}})});}_0x1b83bc=_[_0x5696('0x3c')]({},_0x1b83bc,_0x40df41[_0x5696('0x3d')]);var _0x3a6539={'where':_0x1b83bc[_0x5696('0x3b')]};return db[_0x5696('0x29')]['count'](_0x3a6539)[_0x5696('0x22')](function(_0xd68ebc){_0x37297c[_0x5696('0x1a')]=_0xd68ebc;if(_0x40df41[_0x5696('0x2f')][_0x5696('0x3e')]){_0x1b83bc[_0x5696('0x3f')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x5696('0x40')](_0x1b83bc);})[_0x5696('0x22')](function(_0x23cb97){_0x37297c['rows']=_0x23cb97;return _0x37297c;})[_0x5696('0x22')](respondWithFilteredResult(_0x5139ce,_0x1b83bc))[_0x5696('0x41')](handleError(_0x5139ce,null));};exports[_0x5696('0x42')]=function(_0x43785c,_0x2a7bd2){var _0x37ee00={'raw':!![],'where':{'id':_0x43785c['params']['id']}},_0x2da2c8={};_0x2da2c8[_0x5696('0x2e')]=_[_0x5696('0x30')](db['OpenchannelQueueReport'][_0x5696('0x2a')]);_0x2da2c8[_0x5696('0x2f')]=_['keys'](_0x43785c[_0x5696('0x2f')]);_0x2da2c8[_0x5696('0x31')]=_['intersection'](_0x2da2c8[_0x5696('0x2e')],_0x2da2c8[_0x5696('0x2f')]);_0x37ee00['attributes']=_[_0x5696('0x32')](_0x2da2c8[_0x5696('0x2e')],qs['fields'](_0x43785c[_0x5696('0x2f')][_0x5696('0x33')]));_0x37ee00['attributes']=_0x37ee00['attributes'][_0x5696('0x35')]?_0x37ee00[_0x5696('0x34')]:_0x2da2c8[_0x5696('0x2e')];if(_0x43785c[_0x5696('0x2f')][_0x5696('0x3e')]){_0x37ee00[_0x5696('0x3f')]=[{'all':!![]}];}_0x37ee00=_[_0x5696('0x3c')]({},_0x37ee00,_0x43785c[_0x5696('0x3d')]);return db[_0x5696('0x29')][_0x5696('0x43')](_0x37ee00)[_0x5696('0x22')](handleEntityNotFound(_0x2a7bd2,null))['then'](respondWithResult(_0x2a7bd2,null))['catch'](handleError(_0x2a7bd2,null));};exports[_0x5696('0x44')]=function(_0x450769,_0x135f6e){return db[_0x5696('0x29')][_0x5696('0x44')](_0x450769['body'],{})['then'](respondWithResult(_0x135f6e,0xc9))[_0x5696('0x41')](handleError(_0x135f6e,null));};exports[_0x5696('0x20')]=function(_0x1fd570,_0x4289d9){if(_0x1fd570[_0x5696('0x45')]['id']){delete _0x1fd570['body']['id'];}return db['OpenchannelQueueReport'][_0x5696('0x43')]({'where':{'id':_0x1fd570[_0x5696('0x46')]['id']}})['then'](handleEntityNotFound(_0x4289d9,null))['then'](saveUpdates(_0x1fd570[_0x5696('0x45')],null))[_0x5696('0x22')](respondWithResult(_0x4289d9,null))[_0x5696('0x41')](handleError(_0x4289d9,null));};exports[_0x5696('0x21')]=function(_0x3cd2b4,_0x91bdc9){return db[_0x5696('0x29')][_0x5696('0x43')]({'where':{'id':_0x3cd2b4[_0x5696('0x46')]['id']}})[_0x5696('0x22')](handleEntityNotFound(_0x91bdc9,null))[_0x5696('0x22')](removeEntity(_0x91bdc9,null))['catch'](handleError(_0x91bdc9,null));};exports['describe']=function(_0x73574e,_0x13a8c2){return db[_0x5696('0x29')][_0x5696('0x47')]()['then'](respondWithResult(_0x13a8c2,null))['catch'](handleError(_0x13a8c2,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index df2f9ed..a99356c 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 _0xe103=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./openchannelQueueReport.attributes'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0xe103,0x1e5));var _0x3e10=function(_0xf2748f,_0x40d526){_0xf2748f=_0xf2748f-0x0;var _0x193df3=_0xe103[_0xf2748f];return _0x193df3;};'use strict';var _=require(_0x3e10('0x0'));var util=require(_0x3e10('0x1'));var logger=require(_0x3e10('0x2'))(_0x3e10('0x3'));var moment=require(_0x3e10('0x4'));var BPromise=require('bluebird');var rp=require(_0x3e10('0x5'));var fs=require('fs');var path=require(_0x3e10('0x6'));var rimraf=require(_0x3e10('0x7'));var config=require('../../config/environment');var attributes=require(_0x3e10('0x8'));module['exports']=function(_0x491e87,_0x1d61c2){return _0x491e87[_0x3e10('0x9')](_0x3e10('0xa'),attributes,{'tableName':_0x3e10('0xb'),'paranoid':![],'indexes':[{'name':_0x3e10('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x171a=['./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x4d1ce8,_0x1a778e){var _0x129384=function(_0x15e43b){while(--_0x15e43b){_0x4d1ce8['push'](_0x4d1ce8['shift']());}};_0x129384(++_0x1a778e);}(_0x171a,0x1f4));var _0xa171=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0x171a[_0xa990b7];return _0x52c99c;};'use strict';var _=require(_0xa171('0x0'));var util=require(_0xa171('0x1'));var logger=require(_0xa171('0x2'))(_0xa171('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa171('0x4'));var fs=require('fs');var path=require(_0xa171('0x5'));var rimraf=require('rimraf');var config=require(_0xa171('0x6'));var attributes=require(_0xa171('0x7'));module[_0xa171('0x8')]=function(_0x4dcf81,_0x112591){return _0x4dcf81[_0xa171('0x9')](_0xa171('0xa'),attributes,{'tableName':_0xa171('0xb'),'paranoid':![],'indexes':[{'name':_0xa171('0xc'),'fields':[_0xa171('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 3e28a19..ee06947 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 _0xf7d9=['limit','UpdateOpenchannelQueueReport','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','stringify','catch','raw','where','attributes'];(function(_0x2ae22a,_0x4fe753){var _0x286a82=function(_0x256e58){while(--_0x256e58){_0x2ae22a['push'](_0x2ae22a['shift']());}};_0x286a82(++_0x4fe753);}(_0xf7d9,0x122));var _0x9f7d=function(_0x195ecb,_0x15c056){_0x195ecb=_0x195ecb-0x0;var _0x292194=_0xf7d9[_0x195ecb];return _0x292194;};'use strict';var _=require(_0x9f7d('0x0'));var util=require(_0x9f7d('0x1'));var moment=require(_0x9f7d('0x2'));var BPromise=require(_0x9f7d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f7d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f7d('0x5'))(_0x9f7d('0x6'));var config=require(_0x9f7d('0x7'));var jayson=require(_0x9f7d('0x8'));var client=jayson[_0x9f7d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc6b9,_0xf09259,_0x2333e8){return new BPromise(function(_0x218628,_0x2893a5){return client[_0x9f7d('0xa')](_0x4dc6b9,_0x2333e8)[_0x9f7d('0xb')](function(_0x5290e2){logger[_0x9f7d('0xc')](_0x9f7d('0xd'),_0xf09259,'request\x20sent');logger[_0x9f7d('0xe')](_0x9f7d('0xf'),_0xf09259,_0x9f7d('0x10'),JSON['stringify'](_0x5290e2));if(_0x5290e2[_0x9f7d('0x11')]){if(_0x5290e2[_0x9f7d('0x11')][_0x9f7d('0x12')]===0x1f4){logger[_0x9f7d('0x11')](_0x9f7d('0xd'),_0xf09259,_0x5290e2[_0x9f7d('0x11')]['message']);return _0x2893a5(_0x5290e2[_0x9f7d('0x11')][_0x9f7d('0x13')]);}logger[_0x9f7d('0x11')](_0x9f7d('0xd'),_0xf09259,_0x5290e2['error'][_0x9f7d('0x13')]);return _0x218628(_0x5290e2[_0x9f7d('0x11')][_0x9f7d('0x13')]);}else{logger[_0x9f7d('0xc')](_0x9f7d('0xd'),_0xf09259,_0x9f7d('0x10'));_0x218628(_0x5290e2[_0x9f7d('0x14')]['message']);}})['catch'](function(_0x402609){logger[_0x9f7d('0x11')](_0x9f7d('0xd'),_0xf09259,_0x402609);_0x2893a5(_0x402609);});});}exports[_0x9f7d('0x15')]=function(_0x1b30a0){var _0x11d958=this;return new Promise(function(_0x24c197,_0x213e6d){return db[_0x9f7d('0x16')]['create'](_0x1b30a0[_0x9f7d('0x17')],{'raw':_0x1b30a0[_0x9f7d('0x18')]?_0x1b30a0['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3f650e){logger[_0x9f7d('0xc')](_0x9f7d('0x15'),_0x1b30a0);logger['debug']('CreateOpenchannelQueueReport',_0x1b30a0,JSON[_0x9f7d('0x19')](_0x3f650e));_0x24c197(_0x3f650e);})[_0x9f7d('0x1a')](function(_0xfe757d){logger[_0x9f7d('0x11')](_0x9f7d('0x15'),_0xfe757d[_0x9f7d('0x13')],_0x1b30a0);_0x213e6d(_0x11d958['error'](0x1f4,_0xfe757d[_0x9f7d('0x13')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x34275a){var _0x4d7542=this;return new Promise(function(_0x4b0607,_0x1892dd){return db['OpenchannelQueueReport']['update'](_0x34275a[_0x9f7d('0x17')],{'raw':_0x34275a[_0x9f7d('0x18')]?_0x34275a[_0x9f7d('0x18')][_0x9f7d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34275a['options']?_0x34275a['options'][_0x9f7d('0x1c')]||null:null,'attributes':_0x34275a[_0x9f7d('0x18')]?_0x34275a[_0x9f7d('0x18')][_0x9f7d('0x1d')]||null:null,'limit':_0x34275a['options']?_0x34275a[_0x9f7d('0x18')][_0x9f7d('0x1e')]||null:null})[_0x9f7d('0xb')](function(_0x2e61a3){logger[_0x9f7d('0xc')](_0x9f7d('0x1f'),_0x34275a);logger[_0x9f7d('0xe')](_0x9f7d('0x1f'),_0x34275a,JSON['stringify'](_0x2e61a3));_0x4b0607(_0x2e61a3);})['catch'](function(_0x15fa20){logger[_0x9f7d('0x11')](_0x9f7d('0x1f'),_0x15fa20[_0x9f7d('0x13')],_0x34275a);_0x1892dd(_0x4d7542[_0x9f7d('0x11')](0x1f4,_0x15fa20[_0x9f7d('0x13')]));});});}; \ No newline at end of file +var _0x0650=['rpc','jayson/promise','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateOpenchannelQueueReport','create','body','options','raw','stringify','UpdateOpenchannelQueueReport','attributes','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x3488f7,_0x254a97){var _0x7d2b7c=function(_0x1dedc2){while(--_0x1dedc2){_0x3488f7['push'](_0x3488f7['shift']());}};_0x7d2b7c(++_0x254a97);}(_0x0650,0xed));var _0x0065=function(_0x520a3f,_0x57eba7){_0x520a3f=_0x520a3f-0x0;var _0x189b9e=_0x0650[_0x520a3f];return _0x189b9e;};'use strict';var _=require(_0x0065('0x0'));var util=require('util');var moment=require(_0x0065('0x1'));var BPromise=require(_0x0065('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0065('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0065('0x4'));var logger=require(_0x0065('0x5'))(_0x0065('0x6'));var config=require('../../config/environment');var jayson=require(_0x0065('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x59f241,_0x20dd36,_0x415835){return new BPromise(function(_0xefa3cb,_0x3fe697){return client[_0x0065('0x8')](_0x59f241,_0x415835)[_0x0065('0x9')](function(_0x8974f){logger[_0x0065('0xa')](_0x0065('0xb'),_0x20dd36,'request\x20sent');logger[_0x0065('0xc')](_0x0065('0xd'),_0x20dd36,'request\x20sent',JSON['stringify'](_0x8974f));if(_0x8974f['error']){if(_0x8974f[_0x0065('0xe')][_0x0065('0xf')]===0x1f4){logger['error'](_0x0065('0xb'),_0x20dd36,_0x8974f[_0x0065('0xe')]['message']);return _0x3fe697(_0x8974f[_0x0065('0xe')][_0x0065('0x10')]);}logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x20dd36,_0x8974f[_0x0065('0xe')]['message']);return _0xefa3cb(_0x8974f['error'][_0x0065('0x10')]);}else{logger['info'](_0x0065('0xb'),_0x20dd36,'request\x20sent');_0xefa3cb(_0x8974f[_0x0065('0x11')][_0x0065('0x10')]);}})[_0x0065('0x12')](function(_0x2b5df9){logger[_0x0065('0xe')](_0x0065('0xb'),_0x20dd36,_0x2b5df9);_0x3fe697(_0x2b5df9);});});}exports[_0x0065('0x13')]=function(_0x393d6e){var _0x595816=this;return new Promise(function(_0x18bfa1,_0x3f3b56){return db['OpenchannelQueueReport'][_0x0065('0x14')](_0x393d6e[_0x0065('0x15')],{'raw':_0x393d6e[_0x0065('0x16')]?_0x393d6e[_0x0065('0x16')][_0x0065('0x17')]===undefined?!![]:![]:!![]})[_0x0065('0x9')](function(_0x319e7a){logger['info']('CreateOpenchannelQueueReport',_0x393d6e);logger['debug'](_0x0065('0x13'),_0x393d6e,JSON[_0x0065('0x18')](_0x319e7a));_0x18bfa1(_0x319e7a);})['catch'](function(_0x2de3ae){logger['error'](_0x0065('0x13'),_0x2de3ae[_0x0065('0x10')],_0x393d6e);_0x3f3b56(_0x595816[_0x0065('0xe')](0x1f4,_0x2de3ae[_0x0065('0x10')]));});});};exports[_0x0065('0x19')]=function(_0x1efa70){var _0x3503e=this;return new Promise(function(_0x5d9911,_0x7057d1){return db['OpenchannelQueueReport']['update'](_0x1efa70[_0x0065('0x15')],{'raw':_0x1efa70['options']?_0x1efa70[_0x0065('0x16')][_0x0065('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1efa70['options']?_0x1efa70[_0x0065('0x16')]['where']||null:null,'attributes':_0x1efa70['options']?_0x1efa70[_0x0065('0x16')][_0x0065('0x1a')]||null:null,'limit':_0x1efa70['options']?_0x1efa70['options']['limit']||null:null})[_0x0065('0x9')](function(_0x2e554f){logger[_0x0065('0xa')](_0x0065('0x19'),_0x1efa70);logger[_0x0065('0xc')]('UpdateOpenchannelQueueReport',_0x1efa70,JSON['stringify'](_0x2e554f));_0x5d9911(_0x2e554f);})['catch'](function(_0x3460a2){logger[_0x0065('0xe')](_0x0065('0x19'),_0x3460a2['message'],_0x1efa70);_0x7057d1(_0x3503e[_0x0065('0xe')](0x1f4,_0x3460a2[_0x0065('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index c0b259c..a2ea3ef 100644 --- a/server/api/openchannelTransferReport/index.js +++ b/server/api/openchannelTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x590851,_0x496bee){var _0x3b0115=function(_0x5140cc){while(--_0x5140cc){_0x590851['push'](_0x590851['shift']());}};_0x3b0115(++_0x496bee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file +var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x5dc03e,_0x54e60c){var _0x466a07=function(_0x2ce0cd){while(--_0x2ce0cd){_0x5dc03e['push'](_0x5dc03e['shift']());}};_0x466a07(++_0x54e60c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 7681c7a..666c2e1 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 _0x1457=['exports','STRING','ENUM','account','agent','queue','DATE','NOW','sequelize'];(function(_0x4f37a6,_0x4b3a58){var _0x52a6e3=function(_0x475d84){while(--_0x475d84){_0x4f37a6['push'](_0x4f37a6['shift']());}};_0x52a6e3(++_0x4b3a58);}(_0x1457,0x74));var _0x7145=function(_0x44b346,_0xeb097d){_0x44b346=_0x44b346-0x0;var _0x1c2f2b=_0x1457[_0x44b346];return _0x1c2f2b;};'use strict';var moment=require('moment');var Sequelize=require(_0x7145('0x0'));module[_0x7145('0x1')]={'uniqueid':{'type':Sequelize[_0x7145('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7145('0x3')](_0x7145('0x4'),_0x7145('0x5'),_0x7145('0x6')),'allowNull':![],'defaultValue':_0x7145('0x6')},'transferredAt':{'type':Sequelize[_0x7145('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x7145('0x8')]}}; \ No newline at end of file +var _0xead8=['sequelize','exports','STRING','ENUM','queue','DATE','NOW','moment'];(function(_0x516a50,_0xcd3a61){var _0xa9fae8=function(_0x1866be){while(--_0x1866be){_0x516a50['push'](_0x516a50['shift']());}};_0xa9fae8(++_0xcd3a61);}(_0xead8,0xbf));var _0x8ead=function(_0x45b479,_0x3e6574){_0x45b479=_0x45b479-0x0;var _0x1c3cbe=_0xead8[_0x45b479];return _0x1c3cbe;};'use strict';var moment=require(_0x8ead('0x0'));var Sequelize=require(_0x8ead('0x1'));module[_0x8ead('0x2')]={'uniqueid':{'type':Sequelize[_0x8ead('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8ead('0x4')]('account','agent',_0x8ead('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x8ead('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x8ead('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 0c5ba65..5dec6cf 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 _0x6919=['attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','count','include','findAll','catch','show','includeAll','find','create','body','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','status','end','json','offset','limit','Content-Range','reject','save','update','then','sendStatus','error','name','send','OpenchannelTransferReport','rawAttributes','type','model','keys','query','filters','intersection'];(function(_0x4fe19c,_0x45d0fe){var _0x952ac7=function(_0x274a16){while(--_0x274a16){_0x4fe19c['push'](_0x4fe19c['shift']());}};_0x952ac7(++_0x45d0fe);}(_0x6919,0x164));var _0x9691=function(_0x460e05,_0x37f195){_0x460e05=_0x460e05-0x0;var _0x48dcd9=_0x6919[_0x460e05];return _0x48dcd9;};'use strict';var pdf=require(_0x9691('0x0'));var emlformat=require(_0x9691('0x1'));var rimraf=require(_0x9691('0x2'));var zipdir=require(_0x9691('0x3'));var jsonpatch=require(_0x9691('0x4'));var rp=require(_0x9691('0x5'));var moment=require(_0x9691('0x6'));var BPromise=require(_0x9691('0x7'));var Mustache=require(_0x9691('0x8'));var util=require(_0x9691('0x9'));var path=require(_0x9691('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9691('0xb'));var fs=require('fs');var _=require(_0x9691('0xc'));var squel=require(_0x9691('0xd'));var crypto=require(_0x9691('0xe'));var jsforce=require(_0x9691('0xf'));var deskjs=require(_0x9691('0x10'));var toCsv=require(_0x9691('0x11'));var querystring=require(_0x9691('0x12'));var Papa=require(_0x9691('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9691('0x14'));var as=require(_0x9691('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x9691('0x16'));var config=require(_0x9691('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24c905,_0x16f528){_0x16f528=_0x16f528||0xcc;return function(_0x2e4bce){if(_0x2e4bce){return _0x24c905['sendStatus'](_0x16f528);}return _0x24c905[_0x9691('0x18')](_0x16f528)[_0x9691('0x19')]();};}function respondWithResult(_0x3ad2b9,_0x425fbb){_0x425fbb=_0x425fbb||0xc8;return function(_0x3f4df4){if(_0x3f4df4){return _0x3ad2b9[_0x9691('0x18')](_0x425fbb)[_0x9691('0x1a')](_0x3f4df4);}};}function respondWithFilteredResult(_0x41d1da,_0x5efebc){return function(_0x35ee35){if(_0x35ee35){var _0x224354=_0x35ee35['count'],_0x32ff64=_0x5efebc[_0x9691('0x1b')],_0x2ce662=_0x5efebc['offset']+_0x5efebc[_0x9691('0x1c')],_0xf5dcdb;if(_0x2ce662>=_0x224354){_0x2ce662=_0x224354;_0xf5dcdb=0xc8;}else{_0xf5dcdb=0xce;}_0x41d1da['status'](_0xf5dcdb);return _0x41d1da['set'](_0x9691('0x1d'),_0x32ff64+'-'+_0x2ce662+'/'+_0x224354)[_0x9691('0x1a')](_0x35ee35);}return null;};}function patchUpdates(_0x336a71){return function(_0x67501d){try{jsonpatch['apply'](_0x67501d,_0x336a71,!![]);}catch(_0x42cad6){return BPromise[_0x9691('0x1e')](_0x42cad6);}return _0x67501d[_0x9691('0x1f')]();};}function saveUpdates(_0x3e9ada,_0x4abff9){return function(_0x4b81da){if(_0x4b81da){return _0x4b81da[_0x9691('0x20')](_0x3e9ada)[_0x9691('0x21')](function(_0x5b9cbd){return _0x5b9cbd;});}return null;};}function removeEntity(_0x260944,_0x3df540){return function(_0x448250){if(_0x448250){return _0x448250['destroy']()['then'](function(){_0x260944[_0x9691('0x18')](0xcc)[_0x9691('0x19')]();});}};}function handleEntityNotFound(_0x1a114f,_0x395dda){return function(_0x53ec07){if(!_0x53ec07){_0x1a114f[_0x9691('0x22')](0x194);}return _0x53ec07;};}function handleError(_0x492db3,_0x474967){_0x474967=_0x474967||0x1f4;return function(_0x1012b9){logger[_0x9691('0x23')](_0x1012b9['stack']);if(_0x1012b9['name']){delete _0x1012b9[_0x9691('0x24')];}_0x492db3['status'](_0x474967)[_0x9691('0x25')](_0x1012b9);};}exports['index']=function(_0x51b21b,_0x258281){var _0x1f315f={},_0x5104ea={},_0x18d2f3={'count':0x0,'rows':[]};var _0x30b4f1=_['map'](db[_0x9691('0x26')][_0x9691('0x27')],function(_0x5c24f4){return{'name':_0x5c24f4['fieldName'],'type':_0x5c24f4[_0x9691('0x28')]['key']};});_0x5104ea[_0x9691('0x29')]=_['map'](_0x30b4f1,_0x9691('0x24'));_0x5104ea['query']=_[_0x9691('0x2a')](_0x51b21b[_0x9691('0x2b')]);_0x5104ea[_0x9691('0x2c')]=_[_0x9691('0x2d')](_0x5104ea[_0x9691('0x29')],_0x5104ea[_0x9691('0x2b')]);_0x1f315f[_0x9691('0x2e')]=_['intersection'](_0x5104ea[_0x9691('0x29')],qs['fields'](_0x51b21b[_0x9691('0x2b')]['fields']));_0x1f315f[_0x9691('0x2e')]=_0x1f315f[_0x9691('0x2e')]['length']?_0x1f315f['attributes']:_0x5104ea[_0x9691('0x29')];if(!_0x51b21b[_0x9691('0x2b')][_0x9691('0x2f')](_0x9691('0x30'))){_0x1f315f[_0x9691('0x1c')]=qs['limit'](_0x51b21b[_0x9691('0x2b')][_0x9691('0x1c')]);_0x1f315f[_0x9691('0x1b')]=qs[_0x9691('0x1b')](_0x51b21b[_0x9691('0x2b')][_0x9691('0x1b')]);}_0x1f315f['order']=qs[_0x9691('0x31')](_0x51b21b[_0x9691('0x2b')]['sort']);_0x1f315f['where']=qs[_0x9691('0x2c')](_[_0x9691('0x32')](_0x51b21b[_0x9691('0x2b')],_0x5104ea['filters']),_0x30b4f1);if(_0x51b21b[_0x9691('0x2b')][_0x9691('0x33')]){_0x1f315f[_0x9691('0x34')]=_['merge'](_0x1f315f[_0x9691('0x34')],{'$or':_['map'](_0x30b4f1,function(_0x2ea16f){if(_0x2ea16f['type']!=='VIRTUAL'){var _0x30bf22={};_0x30bf22[_0x2ea16f[_0x9691('0x24')]]={'$like':'%'+_0x51b21b[_0x9691('0x2b')][_0x9691('0x33')]+'%'};return _0x30bf22;}})});}_0x1f315f=_[_0x9691('0x35')]({},_0x1f315f,_0x51b21b[_0x9691('0x36')]);var _0x4a356c={'where':_0x1f315f[_0x9691('0x34')]};return db[_0x9691('0x26')][_0x9691('0x37')](_0x4a356c)[_0x9691('0x21')](function(_0x572681){_0x18d2f3[_0x9691('0x37')]=_0x572681;if(_0x51b21b[_0x9691('0x2b')]['includeAll']){_0x1f315f[_0x9691('0x38')]=[{'all':!![]}];}return db[_0x9691('0x26')][_0x9691('0x39')](_0x1f315f);})[_0x9691('0x21')](function(_0x1e8a46){_0x18d2f3['rows']=_0x1e8a46;return _0x18d2f3;})[_0x9691('0x21')](respondWithFilteredResult(_0x258281,_0x1f315f))[_0x9691('0x3a')](handleError(_0x258281,null));};exports[_0x9691('0x3b')]=function(_0x2bc37f,_0x227a41){var _0x5f29d1={'raw':!![],'where':{'id':_0x2bc37f['params']['id']}},_0x29f1fc={};_0x29f1fc[_0x9691('0x29')]=_[_0x9691('0x2a')](db[_0x9691('0x26')][_0x9691('0x27')]);_0x29f1fc['query']=_[_0x9691('0x2a')](_0x2bc37f[_0x9691('0x2b')]);_0x29f1fc['filters']=_[_0x9691('0x2d')](_0x29f1fc['model'],_0x29f1fc[_0x9691('0x2b')]);_0x5f29d1[_0x9691('0x2e')]=_[_0x9691('0x2d')](_0x29f1fc['model'],qs['fields'](_0x2bc37f[_0x9691('0x2b')]['fields']));_0x5f29d1[_0x9691('0x2e')]=_0x5f29d1[_0x9691('0x2e')]['length']?_0x5f29d1[_0x9691('0x2e')]:_0x29f1fc[_0x9691('0x29')];if(_0x2bc37f[_0x9691('0x2b')][_0x9691('0x3c')]){_0x5f29d1[_0x9691('0x38')]=[{'all':!![]}];}_0x5f29d1=_['merge']({},_0x5f29d1,_0x2bc37f['options']);return db[_0x9691('0x26')][_0x9691('0x3d')](_0x5f29d1)[_0x9691('0x21')](handleEntityNotFound(_0x227a41,null))[_0x9691('0x21')](respondWithResult(_0x227a41,null))[_0x9691('0x3a')](handleError(_0x227a41,null));};exports['create']=function(_0x1edb86,_0x10ba8f){return db[_0x9691('0x26')][_0x9691('0x3e')](_0x1edb86[_0x9691('0x3f')],{})[_0x9691('0x21')](respondWithResult(_0x10ba8f,0xc9))[_0x9691('0x3a')](handleError(_0x10ba8f,null));};exports[_0x9691('0x20')]=function(_0x44b611,_0x3d881e){if(_0x44b611[_0x9691('0x3f')]['id']){delete _0x44b611[_0x9691('0x3f')]['id'];}return db[_0x9691('0x26')][_0x9691('0x3d')]({'where':{'id':_0x44b611[_0x9691('0x40')]['id']}})[_0x9691('0x21')](handleEntityNotFound(_0x3d881e,null))[_0x9691('0x21')](saveUpdates(_0x44b611[_0x9691('0x3f')],null))['then'](respondWithResult(_0x3d881e,null))[_0x9691('0x3a')](handleError(_0x3d881e,null));};exports[_0x9691('0x41')]=function(_0x104731,_0x2edaca){return db['OpenchannelTransferReport'][_0x9691('0x3d')]({'where':{'id':_0x104731[_0x9691('0x40')]['id']}})[_0x9691('0x21')](handleEntityNotFound(_0x2edaca,null))[_0x9691('0x21')](removeEntity(_0x2edaca,null))[_0x9691('0x3a')](handleError(_0x2edaca,null));};exports[_0x9691('0x42')]=function(_0x1c33ce,_0x21d783){return db[_0x9691('0x26')][_0x9691('0x42')]()[_0x9691('0x21')](respondWithResult(_0x21d783,null))[_0x9691('0x3a')](handleError(_0x21d783,null));}; \ No newline at end of file +var _0x80ce=['reject','save','destroy','then','error','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','findAll','rows','show','params','fields','includeAll','catch','create','body','update','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply'];(function(_0x478414,_0xcf142d){var _0x5eb6b9=function(_0x10e6fe){while(--_0x10e6fe){_0x478414['push'](_0x478414['shift']());}};_0x5eb6b9(++_0xcf142d);}(_0x80ce,0xae));var _0xe80c=function(_0x1cb7f9,_0x2e6b0d){_0x1cb7f9=_0x1cb7f9-0x0;var _0x52d6a4=_0x80ce[_0x1cb7f9];return _0x52d6a4;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe80c('0x0'));var jsonpatch=require(_0xe80c('0x1'));var rp=require('request-promise');var moment=require(_0xe80c('0x2'));var BPromise=require(_0xe80c('0x3'));var Mustache=require(_0xe80c('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe80c('0x5'));var ejs=require(_0xe80c('0x6'));var fs=require('fs');var _=require(_0xe80c('0x7'));var squel=require(_0xe80c('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe80c('0x9'));var toCsv=require(_0xe80c('0x5'));var querystring=require('querystring');var Papa=require(_0xe80c('0xa'));var Redis=require(_0xe80c('0xb'));var authService=require(_0xe80c('0xc'));var qs=require(_0xe80c('0xd'));var as=require(_0xe80c('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xe80c('0xf'));var config=require(_0xe80c('0x10'));var db=require(_0xe80c('0x11'))['db'];function respondWithStatusCode(_0x3abe79,_0xfc0809){_0xfc0809=_0xfc0809||0xcc;return function(_0x3cd7ba){if(_0x3cd7ba){return _0x3abe79[_0xe80c('0x12')](_0xfc0809);}return _0x3abe79[_0xe80c('0x13')](_0xfc0809)[_0xe80c('0x14')]();};}function respondWithResult(_0x3665a0,_0x185a51){_0x185a51=_0x185a51||0xc8;return function(_0x46f217){if(_0x46f217){return _0x3665a0[_0xe80c('0x13')](_0x185a51)['json'](_0x46f217);}};}function respondWithFilteredResult(_0x1f3a06,_0x52801b){return function(_0x451535){if(_0x451535){var _0x2a118e=_0x451535[_0xe80c('0x15')],_0x100606=_0x52801b['offset'],_0x532e00=_0x52801b[_0xe80c('0x16')]+_0x52801b[_0xe80c('0x17')],_0x6ff463;if(_0x532e00>=_0x2a118e){_0x532e00=_0x2a118e;_0x6ff463=0xc8;}else{_0x6ff463=0xce;}_0x1f3a06['status'](_0x6ff463);return _0x1f3a06[_0xe80c('0x18')](_0xe80c('0x19'),_0x100606+'-'+_0x532e00+'/'+_0x2a118e)['json'](_0x451535);}return null;};}function patchUpdates(_0x4c431c){return function(_0x1ba731){try{jsonpatch[_0xe80c('0x1a')](_0x1ba731,_0x4c431c,!![]);}catch(_0x1e54a3){return BPromise[_0xe80c('0x1b')](_0x1e54a3);}return _0x1ba731[_0xe80c('0x1c')]();};}function saveUpdates(_0x15003f,_0x534471){return function(_0x5da513){if(_0x5da513){return _0x5da513['update'](_0x15003f)['then'](function(_0x187632){return _0x187632;});}return null;};}function removeEntity(_0x5078f8,_0x39996f){return function(_0x3efad0){if(_0x3efad0){return _0x3efad0[_0xe80c('0x1d')]()[_0xe80c('0x1e')](function(){_0x5078f8[_0xe80c('0x13')](0xcc)[_0xe80c('0x14')]();});}};}function handleEntityNotFound(_0x3fd3a2,_0x360d8b){return function(_0x43d529){if(!_0x43d529){_0x3fd3a2[_0xe80c('0x12')](0x194);}return _0x43d529;};}function handleError(_0x185eb0,_0x1b8227){_0x1b8227=_0x1b8227||0x1f4;return function(_0x4f3cfb){logger[_0xe80c('0x1f')](_0x4f3cfb['stack']);if(_0x4f3cfb[_0xe80c('0x20')]){delete _0x4f3cfb['name'];}_0x185eb0[_0xe80c('0x13')](_0x1b8227)['send'](_0x4f3cfb);};}exports[_0xe80c('0x21')]=function(_0x43f290,_0x54595d){var _0x476b6a={},_0x2808e1={},_0x259eee={'count':0x0,'rows':[]};var _0x404b82=_[_0xe80c('0x22')](db[_0xe80c('0x23')][_0xe80c('0x24')],function(_0x2936bf){return{'name':_0x2936bf[_0xe80c('0x25')],'type':_0x2936bf['type'][_0xe80c('0x26')]};});_0x2808e1[_0xe80c('0x27')]=_['map'](_0x404b82,_0xe80c('0x20'));_0x2808e1['query']=_[_0xe80c('0x28')](_0x43f290[_0xe80c('0x29')]);_0x2808e1[_0xe80c('0x2a')]=_[_0xe80c('0x2b')](_0x2808e1[_0xe80c('0x27')],_0x2808e1[_0xe80c('0x29')]);_0x476b6a[_0xe80c('0x2c')]=_[_0xe80c('0x2b')](_0x2808e1[_0xe80c('0x27')],qs['fields'](_0x43f290['query']['fields']));_0x476b6a[_0xe80c('0x2c')]=_0x476b6a[_0xe80c('0x2c')][_0xe80c('0x2d')]?_0x476b6a[_0xe80c('0x2c')]:_0x2808e1[_0xe80c('0x27')];if(!_0x43f290['query'][_0xe80c('0x2e')]('nolimit')){_0x476b6a['limit']=qs[_0xe80c('0x17')](_0x43f290[_0xe80c('0x29')][_0xe80c('0x17')]);_0x476b6a[_0xe80c('0x16')]=qs[_0xe80c('0x16')](_0x43f290[_0xe80c('0x29')]['offset']);}_0x476b6a[_0xe80c('0x2f')]=qs[_0xe80c('0x30')](_0x43f290[_0xe80c('0x29')][_0xe80c('0x30')]);_0x476b6a[_0xe80c('0x31')]=qs[_0xe80c('0x2a')](_[_0xe80c('0x32')](_0x43f290[_0xe80c('0x29')],_0x2808e1[_0xe80c('0x2a')]),_0x404b82);if(_0x43f290['query']['filter']){_0x476b6a['where']=_[_0xe80c('0x33')](_0x476b6a[_0xe80c('0x31')],{'$or':_[_0xe80c('0x22')](_0x404b82,function(_0x5bb2f5){if(_0x5bb2f5[_0xe80c('0x34')]!==_0xe80c('0x35')){var _0x43b220={};_0x43b220[_0x5bb2f5['name']]={'$like':'%'+_0x43f290[_0xe80c('0x29')][_0xe80c('0x36')]+'%'};return _0x43b220;}})});}_0x476b6a=_[_0xe80c('0x33')]({},_0x476b6a,_0x43f290[_0xe80c('0x37')]);var _0x2e22b0={'where':_0x476b6a[_0xe80c('0x31')]};return db[_0xe80c('0x23')][_0xe80c('0x15')](_0x2e22b0)['then'](function(_0x210e68){_0x259eee[_0xe80c('0x15')]=_0x210e68;if(_0x43f290[_0xe80c('0x29')]['includeAll']){_0x476b6a['include']=[{'all':!![]}];}return db[_0xe80c('0x23')][_0xe80c('0x38')](_0x476b6a);})['then'](function(_0x32a3e0){_0x259eee[_0xe80c('0x39')]=_0x32a3e0;return _0x259eee;})[_0xe80c('0x1e')](respondWithFilteredResult(_0x54595d,_0x476b6a))['catch'](handleError(_0x54595d,null));};exports[_0xe80c('0x3a')]=function(_0x177b29,_0x254a4b){var _0xb45f93={'raw':!![],'where':{'id':_0x177b29[_0xe80c('0x3b')]['id']}},_0x2c9040={};_0x2c9040[_0xe80c('0x27')]=_['keys'](db['OpenchannelTransferReport'][_0xe80c('0x24')]);_0x2c9040[_0xe80c('0x29')]=_[_0xe80c('0x28')](_0x177b29[_0xe80c('0x29')]);_0x2c9040[_0xe80c('0x2a')]=_[_0xe80c('0x2b')](_0x2c9040['model'],_0x2c9040[_0xe80c('0x29')]);_0xb45f93[_0xe80c('0x2c')]=_['intersection'](_0x2c9040['model'],qs[_0xe80c('0x3c')](_0x177b29[_0xe80c('0x29')][_0xe80c('0x3c')]));_0xb45f93['attributes']=_0xb45f93['attributes'][_0xe80c('0x2d')]?_0xb45f93[_0xe80c('0x2c')]:_0x2c9040[_0xe80c('0x27')];if(_0x177b29[_0xe80c('0x29')][_0xe80c('0x3d')]){_0xb45f93['include']=[{'all':!![]}];}_0xb45f93=_['merge']({},_0xb45f93,_0x177b29[_0xe80c('0x37')]);return db[_0xe80c('0x23')]['find'](_0xb45f93)['then'](handleEntityNotFound(_0x254a4b,null))[_0xe80c('0x1e')](respondWithResult(_0x254a4b,null))[_0xe80c('0x3e')](handleError(_0x254a4b,null));};exports[_0xe80c('0x3f')]=function(_0x17f422,_0x46df36){return db['OpenchannelTransferReport'][_0xe80c('0x3f')](_0x17f422[_0xe80c('0x40')],{})[_0xe80c('0x1e')](respondWithResult(_0x46df36,0xc9))[_0xe80c('0x3e')](handleError(_0x46df36,null));};exports[_0xe80c('0x41')]=function(_0x60b823,_0x4ddf5c){if(_0x60b823[_0xe80c('0x40')]['id']){delete _0x60b823[_0xe80c('0x40')]['id'];}return db[_0xe80c('0x23')]['find']({'where':{'id':_0x60b823[_0xe80c('0x3b')]['id']}})[_0xe80c('0x1e')](handleEntityNotFound(_0x4ddf5c,null))['then'](saveUpdates(_0x60b823[_0xe80c('0x40')],null))[_0xe80c('0x1e')](respondWithResult(_0x4ddf5c,null))[_0xe80c('0x3e')](handleError(_0x4ddf5c,null));};exports[_0xe80c('0x1d')]=function(_0x228777,_0x3dc0b1){return db[_0xe80c('0x23')]['find']({'where':{'id':_0x228777[_0xe80c('0x3b')]['id']}})[_0xe80c('0x1e')](handleEntityNotFound(_0x3dc0b1,null))[_0xe80c('0x1e')](removeEntity(_0x3dc0b1,null))[_0xe80c('0x3e')](handleError(_0x3dc0b1,null));};exports[_0xe80c('0x42')]=function(_0x5e1b32,_0x207bd7){return db[_0xe80c('0x23')][_0xe80c('0x42')]()[_0xe80c('0x1e')](respondWithResult(_0x207bd7,null))[_0xe80c('0x3e')](handleError(_0x207bd7,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index deebaa0..f93f065 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 _0xbb67=['report_openchannel_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define'];(function(_0x2478b7,_0x323dea){var _0x373ad0=function(_0x5cc2bf){while(--_0x5cc2bf){_0x2478b7['push'](_0x2478b7['shift']());}};_0x373ad0(++_0x323dea);}(_0xbb67,0x161));var _0x7bb6=function(_0x393608,_0x287766){_0x393608=_0x393608-0x0;var _0x3bb566=_0xbb67[_0x393608];return _0x3bb566;};'use strict';var _=require('lodash');var util=require(_0x7bb6('0x0'));var logger=require(_0x7bb6('0x1'))(_0x7bb6('0x2'));var moment=require(_0x7bb6('0x3'));var BPromise=require(_0x7bb6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7bb6('0x5'));var rimraf=require(_0x7bb6('0x6'));var config=require(_0x7bb6('0x7'));var attributes=require(_0x7bb6('0x8'));module[_0x7bb6('0x9')]=function(_0x139b0e,_0x4b5232){return _0x139b0e[_0x7bb6('0xa')]('OpenchannelTransferReport',attributes,{'tableName':_0x7bb6('0xb'),'paranoid':![],'indexes':[{'name':_0x7bb6('0xc'),'fields':[_0x7bb6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa24d=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer'];(function(_0x1ad6e2,_0xa1460b){var _0x1b2a23=function(_0x3719ef){while(--_0x3719ef){_0x1ad6e2['push'](_0x1ad6e2['shift']());}};_0x1b2a23(++_0xa1460b);}(_0xa24d,0x1c1));var _0xda24=function(_0x9641f8,_0x5c2372){_0x9641f8=_0x9641f8-0x0;var _0x3881b4=_0xa24d[_0x9641f8];return _0x3881b4;};'use strict';var _=require(_0xda24('0x0'));var util=require(_0xda24('0x1'));var logger=require(_0xda24('0x2'))(_0xda24('0x3'));var moment=require(_0xda24('0x4'));var BPromise=require(_0xda24('0x5'));var rp=require(_0xda24('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda24('0x7'));var config=require(_0xda24('0x8'));var attributes=require(_0xda24('0x9'));module[_0xda24('0xa')]=function(_0x561d74,_0x3557cb){return _0x561d74[_0xda24('0xb')]('OpenchannelTransferReport',attributes,{'tableName':_0xda24('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xda24('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 6b41af1..94fcd50 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 _0xf78b=['info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x20157c,_0x28de60){var _0x2c276a=function(_0x132696){while(--_0x132696){_0x20157c['push'](_0x20157c['shift']());}};_0x2c276a(++_0x28de60);}(_0xf78b,0x78));var _0xbf78=function(_0x593eb0,_0x3ff2f2){_0x593eb0=_0x593eb0-0x0;var _0x1cab53=_0xf78b[_0x593eb0];return _0x1cab53;};'use strict';var _=require(_0xbf78('0x0'));var util=require('util');var moment=require(_0xbf78('0x1'));var BPromise=require(_0xbf78('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf78('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf78('0x4'))(_0xbf78('0x5'));var config=require(_0xbf78('0x6'));var jayson=require(_0xbf78('0x7'));var client=jayson[_0xbf78('0x8')][_0xbf78('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x491d82,_0x2eedf2,_0x1c503d){return new BPromise(function(_0x382b7c,_0x33ef00){return client[_0xbf78('0xa')](_0x491d82,_0x1c503d)[_0xbf78('0xb')](function(_0x36002b){logger[_0xbf78('0xc')](_0xbf78('0xd'),_0x2eedf2,_0xbf78('0xe'));logger[_0xbf78('0xf')](_0xbf78('0x10'),_0x2eedf2,'request\x20sent',JSON[_0xbf78('0x11')](_0x36002b));if(_0x36002b[_0xbf78('0x12')]){if(_0x36002b[_0xbf78('0x12')]['code']===0x1f4){logger[_0xbf78('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2eedf2,_0x36002b['error'][_0xbf78('0x13')]);return _0x33ef00(_0x36002b['error'][_0xbf78('0x13')]);}logger[_0xbf78('0x12')](_0xbf78('0xd'),_0x2eedf2,_0x36002b[_0xbf78('0x12')][_0xbf78('0x13')]);return _0x382b7c(_0x36002b[_0xbf78('0x12')]['message']);}else{logger[_0xbf78('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2eedf2,_0xbf78('0xe'));_0x382b7c(_0x36002b[_0xbf78('0x14')][_0xbf78('0x13')]);}})[_0xbf78('0x15')](function(_0x50c4be){logger['error'](_0xbf78('0xd'),_0x2eedf2,_0x50c4be);_0x33ef00(_0x50c4be);});});} \ No newline at end of file +var _0x2aa0=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x270b8c,_0x43bf26){var _0x5a76df=function(_0xc35bea){while(--_0xc35bea){_0x270b8c['push'](_0x270b8c['shift']());}};_0x5a76df(++_0x43bf26);}(_0x2aa0,0x6c));var _0x02aa=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2aa0[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x02aa('0x0'));var util=require(_0x02aa('0x1'));var moment=require('moment');var BPromise=require(_0x02aa('0x2'));var rs=require(_0x02aa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x02aa('0x5'))(_0x02aa('0x6'));var config=require(_0x02aa('0x7'));var jayson=require(_0x02aa('0x8'));var client=jayson[_0x02aa('0x9')][_0x02aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17e58f,_0x1f3de7,_0x7d53e2){return new BPromise(function(_0x2aef4a,_0xa890a3){return client['request'](_0x17e58f,_0x7d53e2)[_0x02aa('0xb')](function(_0x37e62f){logger['info'](_0x02aa('0xc'),_0x1f3de7,_0x02aa('0xd'));logger[_0x02aa('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x1f3de7,'request\x20sent',JSON[_0x02aa('0xf')](_0x37e62f));if(_0x37e62f[_0x02aa('0x10')]){if(_0x37e62f[_0x02aa('0x10')][_0x02aa('0x11')]===0x1f4){logger[_0x02aa('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1f3de7,_0x37e62f['error']['message']);return _0xa890a3(_0x37e62f[_0x02aa('0x10')][_0x02aa('0x12')]);}logger[_0x02aa('0x10')](_0x02aa('0xc'),_0x1f3de7,_0x37e62f[_0x02aa('0x10')][_0x02aa('0x12')]);return _0x2aef4a(_0x37e62f[_0x02aa('0x10')][_0x02aa('0x12')]);}else{logger[_0x02aa('0x13')](_0x02aa('0xc'),_0x1f3de7,_0x02aa('0xd'));_0x2aef4a(_0x37e62f[_0x02aa('0x14')][_0x02aa('0x12')]);}})[_0x02aa('0x15')](function(_0xe103ef){logger[_0x02aa('0x10')](_0x02aa('0xc'),_0x1f3de7,_0xe103ef);_0xa890a3(_0xe103ef);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 6261bd3..d64a371 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 _0xb872=['util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','create','put','update','delete','exports'];(function(_0x2b2583,_0x2a154b){var _0x4cd668=function(_0x210866){while(--_0x210866){_0x2b2583['push'](_0x2b2583['shift']());}};_0x4cd668(++_0x2a154b);}(_0xb872,0xc3));var _0x2b87=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb872[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x2b87('0x0'));var path=require(_0x2b87('0x1'));var timeout=require(_0x2b87('0x2'));var express=require('express');var router=express[_0x2b87('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x2b87('0x4'));var config=require(_0x2b87('0x5'));var controller=require('./pause.controller');router['get']('/',auth[_0x2b87('0x6')](),controller[_0x2b87('0x7')]);router[_0x2b87('0x8')](_0x2b87('0x9'),auth[_0x2b87('0x6')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x2b87('0xa')]);router[_0x2b87('0xb')]('/:id',auth[_0x2b87('0x6')](),controller[_0x2b87('0xc')]);router[_0x2b87('0xd')](_0x2b87('0x9'),auth[_0x2b87('0x6')](),controller['destroy']);module[_0x2b87('0xe')]=router; \ No newline at end of file +var _0xa3b1=['create','update','destroy','exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x1338f1,_0x2f904d){var _0x38e10f=function(_0x42d8e2){while(--_0x42d8e2){_0x1338f1['push'](_0x1338f1['shift']());}};_0x38e10f(++_0x2f904d);}(_0xa3b1,0x18a));var _0x1a3b=function(_0x523a03,_0x47d6d3){_0x523a03=_0x523a03-0x0;var _0x1f6f00=_0xa3b1[_0x523a03];return _0x1f6f00;};'use strict';var multer=require(_0x1a3b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1a3b('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x1a3b('0x2'));var interaction=require(_0x1a3b('0x3'));var config=require(_0x1a3b('0x4'));var controller=require('./pause.controller');router[_0x1a3b('0x5')]('/',auth[_0x1a3b('0x6')](),controller[_0x1a3b('0x7')]);router[_0x1a3b('0x5')](_0x1a3b('0x8'),auth[_0x1a3b('0x6')](),controller['show']);router['post']('/',auth[_0x1a3b('0x6')](),controller[_0x1a3b('0x9')]);router['put'](_0x1a3b('0x8'),auth['isAuthenticated'](),controller[_0x1a3b('0xa')]);router['delete'](_0x1a3b('0x8'),auth[_0x1a3b('0x6')](),controller[_0x1a3b('0xb')]);module[_0x1a3b('0xc')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 4121ce0..064838c 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 _0x9cf5=['sequelize','exports','STRING'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x9cf5,0x9c));var _0x59cf=function(_0x5cc9a9,_0x1589d3){_0x5cc9a9=_0x5cc9a9-0x0;var _0x1562fe=_0x9cf5[_0x5cc9a9];return _0x1562fe;};'use strict';var Sequelize=require(_0x59cf('0x0'));module[_0x59cf('0x1')]={'name':{'type':Sequelize[_0x59cf('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x59cf('0x2')]}}; \ No newline at end of file +var _0xee15=['exports','STRING','sequelize'];(function(_0x5d672b,_0x28f0e4){var _0x3268fc=function(_0x47aa90){while(--_0x47aa90){_0x5d672b['push'](_0x5d672b['shift']());}};_0x3268fc(++_0x28f0e4);}(_0xee15,0x83));var _0x5ee1=function(_0x64aff8,_0x106082){_0x64aff8=_0x64aff8-0x0;var _0x5488a3=_0xee15[_0x64aff8];return _0x5488a3;};'use strict';var Sequelize=require(_0x5ee1('0x0'));module[_0x5ee1('0x1')]={'name':{'type':Sequelize[_0x5ee1('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x5ee1('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 2033f64..7811c48 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 _0xb1f2=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','get','Pauses','UserProfileResource','destroy','then','error','name','send','Pause','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','params','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x28dc6e,_0x3da973){var _0x2c4e39=function(_0x391655){while(--_0x391655){_0x28dc6e['push'](_0x28dc6e['shift']());}};_0x2c4e39(++_0x3da973);}(_0xb1f2,0x1ba));var _0x2b1f=function(_0x5056e2,_0x5cda05){_0x5056e2=_0x5056e2-0x0;var _0x1a95ff=_0xb1f2[_0x5056e2];return _0x1a95ff;};'use strict';var pdf=require(_0x2b1f('0x0'));var emlformat=require(_0x2b1f('0x1'));var rimraf=require(_0x2b1f('0x2'));var zipdir=require(_0x2b1f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b1f('0x4'));var moment=require(_0x2b1f('0x5'));var BPromise=require(_0x2b1f('0x6'));var Mustache=require(_0x2b1f('0x7'));var util=require(_0x2b1f('0x8'));var path=require(_0x2b1f('0x9'));var sox=require(_0x2b1f('0xa'));var csv=require('to-csv');var ejs=require(_0x2b1f('0xb'));var fs=require('fs');var _=require(_0x2b1f('0xc'));var squel=require(_0x2b1f('0xd'));var crypto=require(_0x2b1f('0xe'));var jsforce=require(_0x2b1f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2b1f('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2b1f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2b1f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2b1f('0x13'))('api');var utils=require(_0x2b1f('0x14'));var config=require(_0x2b1f('0x15'));var db=require(_0x2b1f('0x16'))['db'];function respondWithStatusCode(_0x12bc04,_0x35710b){_0x35710b=_0x35710b||0xcc;return function(_0x5ca4d6){if(_0x5ca4d6){return _0x12bc04[_0x2b1f('0x17')](_0x35710b);}return _0x12bc04[_0x2b1f('0x18')](_0x35710b)[_0x2b1f('0x19')]();};}function respondWithResult(_0x5f2a1f,_0x18fba4){_0x18fba4=_0x18fba4||0xc8;return function(_0x412b45){if(_0x412b45){return _0x5f2a1f[_0x2b1f('0x18')](_0x18fba4)[_0x2b1f('0x1a')](_0x412b45);}};}function respondWithFilteredResult(_0x32bfa4,_0x18484f){return function(_0x5b49de){if(_0x5b49de){var _0xdfb8f9=_0x5b49de[_0x2b1f('0x1b')],_0x4c3417=_0x18484f[_0x2b1f('0x1c')],_0x2d18bc=_0x18484f[_0x2b1f('0x1c')]+_0x18484f[_0x2b1f('0x1d')],_0xcacc51;if(_0x2d18bc>=_0xdfb8f9){_0x2d18bc=_0xdfb8f9;_0xcacc51=0xc8;}else{_0xcacc51=0xce;}_0x32bfa4[_0x2b1f('0x18')](_0xcacc51);return _0x32bfa4['set']('Content-Range',_0x4c3417+'-'+_0x2d18bc+'/'+_0xdfb8f9)[_0x2b1f('0x1a')](_0x5b49de);}return null;};}function patchUpdates(_0x1c8b48){return function(_0xfdc397){try{jsonpatch[_0x2b1f('0x1e')](_0xfdc397,_0x1c8b48,!![]);}catch(_0x523bce){return BPromise[_0x2b1f('0x1f')](_0x523bce);}return _0xfdc397[_0x2b1f('0x20')]();};}function saveUpdates(_0x3a163f,_0x11a929){return function(_0x16d7d7){if(_0x16d7d7){return _0x16d7d7[_0x2b1f('0x21')](_0x3a163f)['then'](function(_0xf9fece){return _0xf9fece;});}return null;};}function removeEntity(_0x5d18ed,_0x36ba81){return function(_0x2f72fa){if(_0x2f72fa){return _0x2f72fa['destroy']()['then'](function(){var _0x243869=_0x2f72fa[_0x2b1f('0x22')]({'plain':!![]});var _0x79e108=_0x2b1f('0x23');return db[_0x2b1f('0x24')][_0x2b1f('0x25')]({'where':{'type':_0x79e108,'resourceId':_0x243869['id']}})[_0x2b1f('0x26')](function(){return _0x2f72fa;});})[_0x2b1f('0x26')](function(){_0x5d18ed['status'](0xcc)[_0x2b1f('0x19')]();});}};}function handleEntityNotFound(_0x45fa6c,_0x1ee8d1){return function(_0x358b99){if(!_0x358b99){_0x45fa6c[_0x2b1f('0x17')](0x194);}return _0x358b99;};}function handleError(_0x2a4f11,_0x15edce){_0x15edce=_0x15edce||0x1f4;return function(_0x18fa82){logger[_0x2b1f('0x27')](_0x18fa82['stack']);if(_0x18fa82[_0x2b1f('0x28')]){delete _0x18fa82[_0x2b1f('0x28')];}_0x2a4f11[_0x2b1f('0x18')](_0x15edce)[_0x2b1f('0x29')](_0x18fa82);};}exports['index']=function(_0x4a159f,_0x28b050){var _0x740794={},_0xc6ed35={},_0x49b13c={'count':0x0,'rows':[]};var _0x479e16=_['map'](db[_0x2b1f('0x2a')][_0x2b1f('0x2b')],function(_0x2660fc){return{'name':_0x2660fc[_0x2b1f('0x2c')],'type':_0x2660fc[_0x2b1f('0x2d')]['key']};});_0xc6ed35[_0x2b1f('0x2e')]=_[_0x2b1f('0x2f')](_0x479e16,'name');_0xc6ed35[_0x2b1f('0x30')]=_[_0x2b1f('0x31')](_0x4a159f[_0x2b1f('0x30')]);_0xc6ed35[_0x2b1f('0x32')]=_['intersection'](_0xc6ed35[_0x2b1f('0x2e')],_0xc6ed35['query']);_0x740794[_0x2b1f('0x33')]=_[_0x2b1f('0x34')](_0xc6ed35[_0x2b1f('0x2e')],qs[_0x2b1f('0x35')](_0x4a159f[_0x2b1f('0x30')][_0x2b1f('0x35')]));_0x740794[_0x2b1f('0x33')]=_0x740794[_0x2b1f('0x33')][_0x2b1f('0x36')]?_0x740794[_0x2b1f('0x33')]:_0xc6ed35['model'];if(!_0x4a159f[_0x2b1f('0x30')][_0x2b1f('0x37')](_0x2b1f('0x38'))){_0x740794[_0x2b1f('0x1d')]=qs['limit'](_0x4a159f[_0x2b1f('0x30')][_0x2b1f('0x1d')]);_0x740794[_0x2b1f('0x1c')]=qs[_0x2b1f('0x1c')](_0x4a159f[_0x2b1f('0x30')][_0x2b1f('0x1c')]);}_0x740794['order']=qs[_0x2b1f('0x39')](_0x4a159f[_0x2b1f('0x30')]['sort']);_0x740794[_0x2b1f('0x3a')]=qs[_0x2b1f('0x32')](_[_0x2b1f('0x3b')](_0x4a159f['query'],_0xc6ed35['filters']),_0x479e16);if(_0x4a159f[_0x2b1f('0x30')][_0x2b1f('0x3c')]){_0x740794[_0x2b1f('0x3a')]=_[_0x2b1f('0x3d')](_0x740794[_0x2b1f('0x3a')],{'$or':_[_0x2b1f('0x2f')](_0x479e16,function(_0x50aadf){if(_0x50aadf[_0x2b1f('0x2d')]!==_0x2b1f('0x3e')){var _0x2cdfb4={};_0x2cdfb4[_0x50aadf[_0x2b1f('0x28')]]={'$like':'%'+_0x4a159f[_0x2b1f('0x30')][_0x2b1f('0x3c')]+'%'};return _0x2cdfb4;}})});}_0x740794=_[_0x2b1f('0x3d')]({},_0x740794,_0x4a159f[_0x2b1f('0x3f')]);var _0x3ddde1={'where':_0x740794['where']};return db[_0x2b1f('0x2a')]['count'](_0x3ddde1)[_0x2b1f('0x26')](function(_0xad1bcb){_0x49b13c[_0x2b1f('0x1b')]=_0xad1bcb;if(_0x4a159f['query']['includeAll']){_0x740794['include']=[{'all':!![]}];}return db[_0x2b1f('0x2a')][_0x2b1f('0x40')](_0x740794);})['then'](function(_0x42ce32){_0x49b13c[_0x2b1f('0x41')]=_0x42ce32;return _0x49b13c;})[_0x2b1f('0x26')](respondWithFilteredResult(_0x28b050,_0x740794))[_0x2b1f('0x42')](handleError(_0x28b050,null));};exports['show']=function(_0x3c01ed,_0x43b7d3){var _0x2ee8e3={'raw':!![],'where':{'id':_0x3c01ed[_0x2b1f('0x43')]['id']}},_0xdd3790={};_0xdd3790[_0x2b1f('0x2e')]=_['keys'](db[_0x2b1f('0x2a')][_0x2b1f('0x2b')]);_0xdd3790[_0x2b1f('0x30')]=_[_0x2b1f('0x31')](_0x3c01ed[_0x2b1f('0x30')]);_0xdd3790[_0x2b1f('0x32')]=_[_0x2b1f('0x34')](_0xdd3790[_0x2b1f('0x2e')],_0xdd3790[_0x2b1f('0x30')]);_0x2ee8e3[_0x2b1f('0x33')]=_[_0x2b1f('0x34')](_0xdd3790[_0x2b1f('0x2e')],qs[_0x2b1f('0x35')](_0x3c01ed[_0x2b1f('0x30')][_0x2b1f('0x35')]));_0x2ee8e3[_0x2b1f('0x33')]=_0x2ee8e3[_0x2b1f('0x33')]['length']?_0x2ee8e3[_0x2b1f('0x33')]:_0xdd3790[_0x2b1f('0x2e')];if(_0x3c01ed[_0x2b1f('0x30')][_0x2b1f('0x44')]){_0x2ee8e3[_0x2b1f('0x45')]=[{'all':!![]}];}_0x2ee8e3=_[_0x2b1f('0x3d')]({},_0x2ee8e3,_0x3c01ed[_0x2b1f('0x3f')]);return db['Pause'][_0x2b1f('0x46')](_0x2ee8e3)[_0x2b1f('0x26')](handleEntityNotFound(_0x43b7d3,null))['then'](respondWithResult(_0x43b7d3,null))[_0x2b1f('0x42')](handleError(_0x43b7d3,null));};exports['create']=function(_0x2e8651,_0x1e22cd){return db[_0x2b1f('0x2a')][_0x2b1f('0x47')](_0x2e8651[_0x2b1f('0x48')],{})[_0x2b1f('0x26')](function(_0x52c608){var _0x5e2d5e=_0x2e8651[_0x2b1f('0x49')]['get']({'plain':!![]});if(!_0x5e2d5e)throw new Error(_0x2b1f('0x4a'));if(_0x5e2d5e[_0x2b1f('0x4b')]===_0x2b1f('0x49')){var _0x3aff8c=_0x52c608['get']({'plain':!![]});var _0x36619f='Pauses';return db[_0x2b1f('0x4c')][_0x2b1f('0x46')]({'where':{'name':_0x36619f,'userProfileId':_0x5e2d5e['userProfileId']},'raw':!![]})['then'](function(_0x5d0ee4){if(_0x5d0ee4&&_0x5d0ee4['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3aff8c[_0x2b1f('0x28')],'resourceId':_0x3aff8c['id'],'type':_0x5d0ee4['name'],'sectionId':_0x5d0ee4['id']},{})[_0x2b1f('0x26')](function(){return _0x52c608;});}else{return _0x52c608;}})[_0x2b1f('0x42')](function(_0x295bb8){logger[_0x2b1f('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x295bb8);throw _0x295bb8;});}return _0x52c608;})[_0x2b1f('0x26')](respondWithResult(_0x1e22cd,0xc9))[_0x2b1f('0x42')](handleError(_0x1e22cd,null));};exports[_0x2b1f('0x21')]=function(_0x3a9175,_0x3933be){if(_0x3a9175['body']['id']){delete _0x3a9175[_0x2b1f('0x48')]['id'];}return db[_0x2b1f('0x2a')]['find']({'where':{'id':_0x3a9175[_0x2b1f('0x43')]['id']}})[_0x2b1f('0x26')](handleEntityNotFound(_0x3933be,null))[_0x2b1f('0x26')](saveUpdates(_0x3a9175['body'],null))[_0x2b1f('0x26')](respondWithResult(_0x3933be,null))[_0x2b1f('0x42')](handleError(_0x3933be,null));};exports[_0x2b1f('0x25')]=function(_0x41f96a,_0x46c5fc){return db['Pause']['find']({'where':{'id':_0x41f96a[_0x2b1f('0x43')]['id']}})[_0x2b1f('0x26')](handleEntityNotFound(_0x46c5fc,null))[_0x2b1f('0x26')](removeEntity(_0x46c5fc,null))[_0x2b1f('0x42')](handleError(_0x46c5fc,null));}; \ No newline at end of file +var _0x872b=['send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','Pause','findAll','rows','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','Pauses','UserProfileResource','error','stack','name'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x872b,0x11e));var _0xb872=function(_0x4501aa,_0x1b04c9){_0x4501aa=_0x4501aa-0x0;var _0x44f0ac=_0x872b[_0x4501aa];return _0x44f0ac;};'use strict';var pdf=require(_0xb872('0x0'));var emlformat=require(_0xb872('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb872('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb872('0x3'));var moment=require(_0xb872('0x4'));var BPromise=require(_0xb872('0x5'));var Mustache=require('mustache');var util=require(_0xb872('0x6'));var path=require(_0xb872('0x7'));var sox=require(_0xb872('0x8'));var csv=require(_0xb872('0x9'));var ejs=require(_0xb872('0xa'));var fs=require('fs');var _=require(_0xb872('0xb'));var squel=require('squel');var crypto=require(_0xb872('0xc'));var jsforce=require(_0xb872('0xd'));var deskjs=require(_0xb872('0xe'));var toCsv=require(_0xb872('0x9'));var querystring=require('querystring');var Papa=require(_0xb872('0xf'));var Redis=require(_0xb872('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb872('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb872('0x12'));var logger=require(_0xb872('0x13'))(_0xb872('0x14'));var utils=require(_0xb872('0x15'));var config=require(_0xb872('0x16'));var db=require(_0xb872('0x17'))['db'];function respondWithStatusCode(_0x3bce9f,_0x2d2405){_0x2d2405=_0x2d2405||0xcc;return function(_0x37d569){if(_0x37d569){return _0x3bce9f[_0xb872('0x18')](_0x2d2405);}return _0x3bce9f[_0xb872('0x19')](_0x2d2405)[_0xb872('0x1a')]();};}function respondWithResult(_0x4ed139,_0x2faa7c){_0x2faa7c=_0x2faa7c||0xc8;return function(_0xf864d6){if(_0xf864d6){return _0x4ed139['status'](_0x2faa7c)['json'](_0xf864d6);}};}function respondWithFilteredResult(_0x527288,_0xbc1d7a){return function(_0x1cb3d0){if(_0x1cb3d0){var _0x54b7=_0x1cb3d0[_0xb872('0x1b')],_0x274252=_0xbc1d7a[_0xb872('0x1c')],_0x3d3807=_0xbc1d7a['offset']+_0xbc1d7a[_0xb872('0x1d')],_0x542fdc;if(_0x3d3807>=_0x54b7){_0x3d3807=_0x54b7;_0x542fdc=0xc8;}else{_0x542fdc=0xce;}_0x527288['status'](_0x542fdc);return _0x527288['set'](_0xb872('0x1e'),_0x274252+'-'+_0x3d3807+'/'+_0x54b7)['json'](_0x1cb3d0);}return null;};}function patchUpdates(_0x19c073){return function(_0x2be901){try{jsonpatch[_0xb872('0x1f')](_0x2be901,_0x19c073,!![]);}catch(_0x21ac41){return BPromise[_0xb872('0x20')](_0x21ac41);}return _0x2be901[_0xb872('0x21')]();};}function saveUpdates(_0x49d78a,_0x3a0873){return function(_0x1fd0b9){if(_0x1fd0b9){return _0x1fd0b9[_0xb872('0x22')](_0x49d78a)[_0xb872('0x23')](function(_0x3c3822){return _0x3c3822;});}return null;};}function removeEntity(_0x45efd4,_0x4a604b){return function(_0x261932){if(_0x261932){return _0x261932[_0xb872('0x24')]()[_0xb872('0x23')](function(){var _0x2746e9=_0x261932['get']({'plain':!![]});var _0x3dab30=_0xb872('0x25');return db[_0xb872('0x26')][_0xb872('0x24')]({'where':{'type':_0x3dab30,'resourceId':_0x2746e9['id']}})[_0xb872('0x23')](function(){return _0x261932;});})[_0xb872('0x23')](function(){_0x45efd4[_0xb872('0x19')](0xcc)[_0xb872('0x1a')]();});}};}function handleEntityNotFound(_0x589aed,_0x3cd93e){return function(_0x276391){if(!_0x276391){_0x589aed[_0xb872('0x18')](0x194);}return _0x276391;};}function handleError(_0x367f56,_0x2c1f4f){_0x2c1f4f=_0x2c1f4f||0x1f4;return function(_0x58f454){logger[_0xb872('0x27')](_0x58f454[_0xb872('0x28')]);if(_0x58f454['name']){delete _0x58f454[_0xb872('0x29')];}_0x367f56[_0xb872('0x19')](_0x2c1f4f)[_0xb872('0x2a')](_0x58f454);};}exports[_0xb872('0x2b')]=function(_0x11f3f7,_0x54879d){var _0x4309b8={},_0x538847={},_0x2ed2b1={'count':0x0,'rows':[]};var _0x51b4c9=_[_0xb872('0x2c')](db['Pause'][_0xb872('0x2d')],function(_0x536f0f){return{'name':_0x536f0f[_0xb872('0x2e')],'type':_0x536f0f[_0xb872('0x2f')][_0xb872('0x30')]};});_0x538847['model']=_['map'](_0x51b4c9,'name');_0x538847['query']=_[_0xb872('0x31')](_0x11f3f7[_0xb872('0x32')]);_0x538847[_0xb872('0x33')]=_[_0xb872('0x34')](_0x538847[_0xb872('0x35')],_0x538847['query']);_0x4309b8[_0xb872('0x36')]=_[_0xb872('0x34')](_0x538847[_0xb872('0x35')],qs['fields'](_0x11f3f7[_0xb872('0x32')][_0xb872('0x37')]));_0x4309b8[_0xb872('0x36')]=_0x4309b8[_0xb872('0x36')][_0xb872('0x38')]?_0x4309b8['attributes']:_0x538847[_0xb872('0x35')];if(!_0x11f3f7[_0xb872('0x32')][_0xb872('0x39')](_0xb872('0x3a'))){_0x4309b8['limit']=qs[_0xb872('0x1d')](_0x11f3f7['query']['limit']);_0x4309b8[_0xb872('0x1c')]=qs[_0xb872('0x1c')](_0x11f3f7[_0xb872('0x32')]['offset']);}_0x4309b8[_0xb872('0x3b')]=qs[_0xb872('0x3c')](_0x11f3f7[_0xb872('0x32')]['sort']);_0x4309b8[_0xb872('0x3d')]=qs['filters'](_['pick'](_0x11f3f7[_0xb872('0x32')],_0x538847[_0xb872('0x33')]),_0x51b4c9);if(_0x11f3f7[_0xb872('0x32')][_0xb872('0x3e')]){_0x4309b8['where']=_['merge'](_0x4309b8['where'],{'$or':_['map'](_0x51b4c9,function(_0x15699d){if(_0x15699d[_0xb872('0x2f')]!==_0xb872('0x3f')){var _0x311576={};_0x311576[_0x15699d['name']]={'$like':'%'+_0x11f3f7['query'][_0xb872('0x3e')]+'%'};return _0x311576;}})});}_0x4309b8=_[_0xb872('0x40')]({},_0x4309b8,_0x11f3f7[_0xb872('0x41')]);var _0x2520b3={'where':_0x4309b8[_0xb872('0x3d')]};return db['Pause'][_0xb872('0x1b')](_0x2520b3)['then'](function(_0x262fe5){_0x2ed2b1['count']=_0x262fe5;if(_0x11f3f7[_0xb872('0x32')]['includeAll']){_0x4309b8[_0xb872('0x42')]=[{'all':!![]}];}return db[_0xb872('0x43')][_0xb872('0x44')](_0x4309b8);})['then'](function(_0x296545){_0x2ed2b1[_0xb872('0x45')]=_0x296545;return _0x2ed2b1;})[_0xb872('0x23')](respondWithFilteredResult(_0x54879d,_0x4309b8))[_0xb872('0x46')](handleError(_0x54879d,null));};exports[_0xb872('0x47')]=function(_0x565e9f,_0x4298e6){var _0x188c47={'raw':!![],'where':{'id':_0x565e9f['params']['id']}},_0x44a8e1={};_0x44a8e1['model']=_[_0xb872('0x31')](db['Pause'][_0xb872('0x2d')]);_0x44a8e1[_0xb872('0x32')]=_[_0xb872('0x31')](_0x565e9f[_0xb872('0x32')]);_0x44a8e1['filters']=_['intersection'](_0x44a8e1[_0xb872('0x35')],_0x44a8e1[_0xb872('0x32')]);_0x188c47[_0xb872('0x36')]=_[_0xb872('0x34')](_0x44a8e1[_0xb872('0x35')],qs[_0xb872('0x37')](_0x565e9f[_0xb872('0x32')]['fields']));_0x188c47[_0xb872('0x36')]=_0x188c47[_0xb872('0x36')][_0xb872('0x38')]?_0x188c47[_0xb872('0x36')]:_0x44a8e1[_0xb872('0x35')];if(_0x565e9f['query']['includeAll']){_0x188c47[_0xb872('0x42')]=[{'all':!![]}];}_0x188c47=_[_0xb872('0x40')]({},_0x188c47,_0x565e9f[_0xb872('0x41')]);return db[_0xb872('0x43')][_0xb872('0x48')](_0x188c47)[_0xb872('0x23')](handleEntityNotFound(_0x4298e6,null))[_0xb872('0x23')](respondWithResult(_0x4298e6,null))[_0xb872('0x46')](handleError(_0x4298e6,null));};exports['create']=function(_0x34117b,_0x38f3bd){return db[_0xb872('0x43')][_0xb872('0x49')](_0x34117b[_0xb872('0x4a')],{})[_0xb872('0x23')](function(_0x4b9bc5){var _0x3133f8=_0x34117b[_0xb872('0x4b')][_0xb872('0x4c')]({'plain':!![]});if(!_0x3133f8)throw new Error(_0xb872('0x4d'));if(_0x3133f8[_0xb872('0x4e')]===_0xb872('0x4b')){var _0x57d8c4=_0x4b9bc5[_0xb872('0x4c')]({'plain':!![]});var _0x20833d=_0xb872('0x25');return db[_0xb872('0x4f')][_0xb872('0x48')]({'where':{'name':_0x20833d,'userProfileId':_0x3133f8['userProfileId']},'raw':!![]})[_0xb872('0x23')](function(_0x4a51c4){if(_0x4a51c4&&_0x4a51c4['autoAssociation']===0x0){return db[_0xb872('0x26')][_0xb872('0x49')]({'name':_0x57d8c4[_0xb872('0x29')],'resourceId':_0x57d8c4['id'],'type':_0x4a51c4[_0xb872('0x29')],'sectionId':_0x4a51c4['id']},{})[_0xb872('0x23')](function(){return _0x4b9bc5;});}else{return _0x4b9bc5;}})['catch'](function(_0x291ecd){logger[_0xb872('0x27')](_0xb872('0x50'),_0x291ecd);throw _0x291ecd;});}return _0x4b9bc5;})['then'](respondWithResult(_0x38f3bd,0xc9))[_0xb872('0x46')](handleError(_0x38f3bd,null));};exports[_0xb872('0x22')]=function(_0x317df6,_0x33d6c9){if(_0x317df6[_0xb872('0x4a')]['id']){delete _0x317df6[_0xb872('0x4a')]['id'];}return db[_0xb872('0x43')][_0xb872('0x48')]({'where':{'id':_0x317df6[_0xb872('0x51')]['id']}})[_0xb872('0x23')](handleEntityNotFound(_0x33d6c9,null))[_0xb872('0x23')](saveUpdates(_0x317df6[_0xb872('0x4a')],null))['then'](respondWithResult(_0x33d6c9,null))[_0xb872('0x46')](handleError(_0x33d6c9,null));};exports[_0xb872('0x24')]=function(_0x1e7cf4,_0x1b988a){return db[_0xb872('0x43')][_0xb872('0x48')]({'where':{'id':_0x1e7cf4[_0xb872('0x51')]['id']}})[_0xb872('0x23')](handleEntityNotFound(_0x1b988a,null))[_0xb872('0x23')](removeEntity(_0x1b988a,null))[_0xb872('0x46')](handleError(_0x1b988a,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 6477554..ad51145 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 _0x957b=['../../config/environment','./pause.attributes','exports','define','Pause','util','api','bluebird','request-promise'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x957b,0x1d0));var _0xb957=function(_0x53ef00,_0x36783f){_0x53ef00=_0x53ef00-0x0;var _0x47e1c3=_0x957b[_0x53ef00];return _0x47e1c3;};'use strict';var _=require('lodash');var util=require(_0xb957('0x0'));var logger=require('../../config/logger')(_0xb957('0x1'));var moment=require('moment');var BPromise=require(_0xb957('0x2'));var rp=require(_0xb957('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb957('0x4'));var attributes=require(_0xb957('0x5'));module[_0xb957('0x6')]=function(_0x5e257b,_0x825c6f){return _0x5e257b[_0xb957('0x7')](_0xb957('0x8'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c12=['Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./pause.attributes','exports'];(function(_0x46ed68,_0x28f782){var _0x1644ea=function(_0x3fff47){while(--_0x3fff47){_0x46ed68['push'](_0x46ed68['shift']());}};_0x1644ea(++_0x28f782);}(_0x3c12,0xc2));var _0x23c1=function(_0x3f2d02,_0x2c7deb){_0x3f2d02=_0x3f2d02-0x0;var _0x54092b=_0x3c12[_0x3f2d02];return _0x54092b;};'use strict';var _=require(_0x23c1('0x0'));var util=require(_0x23c1('0x1'));var logger=require(_0x23c1('0x2'))(_0x23c1('0x3'));var moment=require(_0x23c1('0x4'));var BPromise=require(_0x23c1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x23c1('0x6'));var rimraf=require('rimraf');var config=require(_0x23c1('0x7'));var attributes=require(_0x23c1('0x8'));module[_0x23c1('0x9')]=function(_0x36888d,_0x41a7a6){return _0x36888d['define'](_0x23c1('0xa'),attributes,{'tableName':_0x23c1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index d533a4a..5b157ea 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 _0xe3ed=['request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','ShowPause','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','Pause,\x20%s,\x20%s'];(function(_0x54c9dd,_0x233a86){var _0x855156=function(_0x2dd60b){while(--_0x2dd60b){_0x54c9dd['push'](_0x54c9dd['shift']());}};_0x855156(++_0x233a86);}(_0xe3ed,0x8d));var _0xde3e=function(_0x28e045,_0xc69640){_0x28e045=_0x28e045-0x0;var _0x510d42=_0xe3ed[_0x28e045];return _0x510d42;};'use strict';var _=require(_0xde3e('0x0'));var util=require(_0xde3e('0x1'));var moment=require(_0xde3e('0x2'));var BPromise=require(_0xde3e('0x3'));var rs=require(_0xde3e('0x4'));var fs=require('fs');var Redis=require(_0xde3e('0x5'));var db=require(_0xde3e('0x6'))['db'];var utils=require(_0xde3e('0x7'));var logger=require('../../config/logger')(_0xde3e('0x8'));var config=require(_0xde3e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xde3e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x184b02,_0x4c4ac6,_0x47e97f){return new BPromise(function(_0x3e0bb4,_0x3b1597){return client[_0xde3e('0xb')](_0x184b02,_0x47e97f)[_0xde3e('0xc')](function(_0x76daf5){logger['info'](_0xde3e('0xd'),_0x4c4ac6,_0xde3e('0xe'));logger[_0xde3e('0xf')](_0xde3e('0x10'),_0x4c4ac6,'request\x20sent',JSON[_0xde3e('0x11')](_0x76daf5));if(_0x76daf5[_0xde3e('0x12')]){if(_0x76daf5['error'][_0xde3e('0x13')]===0x1f4){logger[_0xde3e('0x12')]('Pause,\x20%s,\x20%s',_0x4c4ac6,_0x76daf5[_0xde3e('0x12')]['message']);return _0x3b1597(_0x76daf5[_0xde3e('0x12')][_0xde3e('0x14')]);}logger[_0xde3e('0x12')]('Pause,\x20%s,\x20%s',_0x4c4ac6,_0x76daf5[_0xde3e('0x12')][_0xde3e('0x14')]);return _0x3e0bb4(_0x76daf5['error']['message']);}else{logger[_0xde3e('0x15')](_0xde3e('0xd'),_0x4c4ac6,_0xde3e('0xe'));_0x3e0bb4(_0x76daf5['result']['message']);}})[_0xde3e('0x16')](function(_0x5e041a){logger['error'](_0xde3e('0xd'),_0x4c4ac6,_0x5e041a);_0x3b1597(_0x5e041a);});});}exports[_0xde3e('0x17')]=function(_0x4aa02c){var _0x460d69=this;return new Promise(function(_0x276e83,_0x264603){return db['Pause']['find']({'raw':_0x4aa02c['options']?_0x4aa02c[_0xde3e('0x18')][_0xde3e('0x19')]===undefined?!![]:![]:!![],'where':_0x4aa02c[_0xde3e('0x18')]?_0x4aa02c['options'][_0xde3e('0x1a')]||null:null,'attributes':_0x4aa02c[_0xde3e('0x18')]?_0x4aa02c[_0xde3e('0x18')][_0xde3e('0x1b')]||null:null,'include':_0x4aa02c[_0xde3e('0x18')]?_0x4aa02c[_0xde3e('0x18')][_0xde3e('0x1c')]?_[_0xde3e('0x1d')](_0x4aa02c[_0xde3e('0x18')]['include'],function(_0x19fe6b){return{'model':db[_0x19fe6b[_0xde3e('0x1e')]],'as':_0x19fe6b['as'],'attributes':_0x19fe6b[_0xde3e('0x1b')],'include':_0x19fe6b['include']?_[_0xde3e('0x1d')](_0x19fe6b[_0xde3e('0x1c')],function(_0xcea261){return{'model':db[_0xcea261['model']],'as':_0xcea261['as'],'attributes':_0xcea261[_0xde3e('0x1b')],'include':_0xcea261[_0xde3e('0x1c')]?_[_0xde3e('0x1d')](_0xcea261[_0xde3e('0x1c')],function(_0x19a8be){return{'model':db[_0x19a8be['model']],'as':_0x19a8be['as'],'attributes':_0x19a8be['attributes']};}):[]};}):[]};}):[]:[]})[_0xde3e('0xc')](function(_0x27ee92){logger[_0xde3e('0x15')]('ShowPause',_0x4aa02c);logger[_0xde3e('0xf')](_0xde3e('0x17'),_0x4aa02c,JSON['stringify'](_0x27ee92));_0x276e83(_0x27ee92);})['catch'](function(_0x245fbc){logger[_0xde3e('0x12')]('ShowPause',_0x245fbc[_0xde3e('0x14')],_0x4aa02c);_0x264603(_0x460d69[_0xde3e('0x12')](0x1f4,_0x245fbc[_0xde3e('0x14')]));});});}; \ No newline at end of file +var _0x1333=['debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','Pause,\x20%s,\x20%s','message','result','catch','ShowPause','Pause','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent'];(function(_0x55d972,_0x374696){var _0x413cfb=function(_0x4bbd9a){while(--_0x4bbd9a){_0x55d972['push'](_0x55d972['shift']());}};_0x413cfb(++_0x374696);}(_0x1333,0x167));var _0x3133=function(_0x15c32d,_0x165e1c){_0x15c32d=_0x15c32d-0x0;var _0x590220=_0x1333[_0x15c32d];return _0x590220;};'use strict';var _=require(_0x3133('0x0'));var util=require(_0x3133('0x1'));var moment=require(_0x3133('0x2'));var BPromise=require(_0x3133('0x3'));var rs=require(_0x3133('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3133('0x5'))['db'];var utils=require(_0x3133('0x6'));var logger=require(_0x3133('0x7'))(_0x3133('0x8'));var config=require('../../config/environment');var jayson=require(_0x3133('0x9'));var client=jayson['client'][_0x3133('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a92dd,_0x2742ca,_0x514807){return new BPromise(function(_0x433eb1,_0x34c700){return client[_0x3133('0xb')](_0x4a92dd,_0x514807)[_0x3133('0xc')](function(_0xa5048b){logger[_0x3133('0xd')]('Pause,\x20%s,\x20%s',_0x2742ca,_0x3133('0xe'));logger[_0x3133('0xf')](_0x3133('0x10'),_0x2742ca,_0x3133('0xe'),JSON[_0x3133('0x11')](_0xa5048b));if(_0xa5048b[_0x3133('0x12')]){if(_0xa5048b[_0x3133('0x12')][_0x3133('0x13')]===0x1f4){logger[_0x3133('0x12')](_0x3133('0x14'),_0x2742ca,_0xa5048b[_0x3133('0x12')]['message']);return _0x34c700(_0xa5048b['error'][_0x3133('0x15')]);}logger[_0x3133('0x12')](_0x3133('0x14'),_0x2742ca,_0xa5048b[_0x3133('0x12')][_0x3133('0x15')]);return _0x433eb1(_0xa5048b[_0x3133('0x12')][_0x3133('0x15')]);}else{logger[_0x3133('0xd')]('Pause,\x20%s,\x20%s',_0x2742ca,'request\x20sent');_0x433eb1(_0xa5048b[_0x3133('0x16')][_0x3133('0x15')]);}})[_0x3133('0x17')](function(_0x310f3e){logger[_0x3133('0x12')]('Pause,\x20%s,\x20%s',_0x2742ca,_0x310f3e);_0x34c700(_0x310f3e);});});}exports[_0x3133('0x18')]=function(_0x4ae566){var _0x2760e5=this;return new Promise(function(_0x2dae7c,_0x31029a){return db[_0x3133('0x19')][_0x3133('0x1a')]({'raw':_0x4ae566[_0x3133('0x1b')]?_0x4ae566[_0x3133('0x1b')][_0x3133('0x1c')]===undefined?!![]:![]:!![],'where':_0x4ae566[_0x3133('0x1b')]?_0x4ae566[_0x3133('0x1b')][_0x3133('0x1d')]||null:null,'attributes':_0x4ae566[_0x3133('0x1b')]?_0x4ae566[_0x3133('0x1b')][_0x3133('0x1e')]||null:null,'include':_0x4ae566[_0x3133('0x1b')]?_0x4ae566[_0x3133('0x1b')][_0x3133('0x1f')]?_[_0x3133('0x20')](_0x4ae566['options'][_0x3133('0x1f')],function(_0x2fdc14){return{'model':db[_0x2fdc14[_0x3133('0x21')]],'as':_0x2fdc14['as'],'attributes':_0x2fdc14[_0x3133('0x1e')],'include':_0x2fdc14[_0x3133('0x1f')]?_[_0x3133('0x20')](_0x2fdc14[_0x3133('0x1f')],function(_0x33590b){return{'model':db[_0x33590b['model']],'as':_0x33590b['as'],'attributes':_0x33590b['attributes'],'include':_0x33590b['include']?_[_0x3133('0x20')](_0x33590b[_0x3133('0x1f')],function(_0x1f15f2){return{'model':db[_0x1f15f2[_0x3133('0x21')]],'as':_0x1f15f2['as'],'attributes':_0x1f15f2['attributes']};}):[]};}):[]};}):[]:[]})[_0x3133('0xc')](function(_0x52289d){logger['info'](_0x3133('0x18'),_0x4ae566);logger['debug'](_0x3133('0x18'),_0x4ae566,JSON['stringify'](_0x52289d));_0x2dae7c(_0x52289d);})['catch'](function(_0x5543e7){logger[_0x3133('0x12')](_0x3133('0x18'),_0x5543e7[_0x3133('0x15')],_0x4ae566);_0x31029a(_0x2760e5[_0x3133('0x12')](0x1f4,_0x5543e7[_0x3133('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index e38bcb0..fa77bca 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 _0xb255=['update','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id','isAuthenticated','show','/:id/download','download','diskStorage','server/files/plugins','originalname','replace','format','%s-%s%s','extname','post','single','file','upload','put'];(function(_0x15ec4e,_0x40b7e0){var _0xb5e5dd=function(_0x42bdd7){while(--_0x42bdd7){_0x15ec4e['push'](_0x15ec4e['shift']());}};_0xb5e5dd(++_0x40b7e0);}(_0xb255,0x142));var _0x5b25=function(_0x1e5050,_0x22fa1c){_0x1e5050=_0x1e5050-0x0;var _0x27acfb=_0xb255[_0x1e5050];return _0x27acfb;};'use strict';var multer=require(_0x5b25('0x0'));var util=require(_0x5b25('0x1'));var path=require(_0x5b25('0x2'));var timeout=require('connect-timeout');var express=require(_0x5b25('0x3'));var router=express[_0x5b25('0x4')]();var auth=require(_0x5b25('0x5'));var interaction=require(_0x5b25('0x6'));var config=require(_0x5b25('0x7'));var controller=require(_0x5b25('0x8'));router[_0x5b25('0x9')]('/',auth['isAuthenticated'](),controller[_0x5b25('0xa')]);router['get'](_0x5b25('0xb'),controller[_0x5b25('0xc')]);router['get'](_0x5b25('0xd'),auth[_0x5b25('0xe')](),controller[_0x5b25('0xf')]);router[_0x5b25('0x9')](_0x5b25('0x10'),auth['isAuthenticated'](),controller[_0x5b25('0x11')]);var upload=multer({'storage':multer[_0x5b25('0x12')]({'destination':function(_0x34e76a,_0x31497c,_0x21769c){_0x21769c(null,path['join'](config['root'],_0x5b25('0x13')));},'filename':function(_0x5adc99,_0x5644e3,_0x2d0152){_0x5644e3[_0x5b25('0x14')]=_0x5644e3[_0x5b25('0x14')][_0x5b25('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2d0152(null,util[_0x5b25('0x16')](_0x5b25('0x17'),path['basename'](_0x5644e3[_0x5b25('0x14')],path[_0x5b25('0x18')](_0x5644e3['originalname'])),Date['now'](),path['extname'](_0x5644e3['originalname'])));}})});router[_0x5b25('0x19')]('/',upload[_0x5b25('0x1a')](_0x5b25('0x1b')),controller[_0x5b25('0x1c')]);router['post'](_0x5b25('0xb'),controller['webhookPost']);router[_0x5b25('0x1d')]('/:id',auth[_0x5b25('0xe')](),controller[_0x5b25('0x1e')]);router[_0x5b25('0x1f')](_0x5b25('0xd'),auth[_0x5b25('0xe')](),controller[_0x5b25('0x1f')]);module['exports']=router; \ No newline at end of file +var _0xacef=['single','file','upload','post','/webhook','webhookPost','put','update','delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now'];(function(_0x11a07a,_0x20407f){var _0x2d00d6=function(_0x36da3b){while(--_0x36da3b){_0x11a07a['push'](_0x11a07a['shift']());}};_0x2d00d6(++_0x20407f);}(_0xacef,0x14e));var _0xface=function(_0x4a7c88,_0x1e69dc){_0x4a7c88=_0x4a7c88-0x0;var _0x1fb4b7=_0xacef[_0x4a7c88];return _0x1fb4b7;};'use strict';var multer=require('multer');var util=require(_0xface('0x0'));var path=require(_0xface('0x1'));var timeout=require(_0xface('0x2'));var express=require(_0xface('0x3'));var router=express['Router']();var auth=require(_0xface('0x4'));var interaction=require(_0xface('0x5'));var config=require(_0xface('0x6'));var controller=require(_0xface('0x7'));router[_0xface('0x8')]('/',auth[_0xface('0x9')](),controller[_0xface('0xa')]);router[_0xface('0x8')]('/webhook',controller['webhookGet']);router[_0xface('0x8')](_0xface('0xb'),auth[_0xface('0x9')](),controller[_0xface('0xc')]);router['get'](_0xface('0xd'),auth[_0xface('0x9')](),controller[_0xface('0xe')]);var upload=multer({'storage':multer[_0xface('0xf')]({'destination':function(_0x44ac0a,_0x233576,_0x1a5cdc){_0x1a5cdc(null,path[_0xface('0x10')](config[_0xface('0x11')],_0xface('0x12')));},'filename':function(_0x175244,_0x4a3470,_0x53e2e6){_0x4a3470[_0xface('0x13')]=_0x4a3470[_0xface('0x13')][_0xface('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x53e2e6(null,util[_0xface('0x15')](_0xface('0x16'),path[_0xface('0x17')](_0x4a3470[_0xface('0x13')],path[_0xface('0x18')](_0x4a3470[_0xface('0x13')])),Date[_0xface('0x19')](),path[_0xface('0x18')](_0x4a3470[_0xface('0x13')])));}})});router['post']('/',upload[_0xface('0x1a')](_0xface('0x1b')),controller[_0xface('0x1c')]);router[_0xface('0x1d')](_0xface('0x1e'),controller[_0xface('0x1f')]);router[_0xface('0x20')](_0xface('0xb'),auth[_0xface('0x9')](),controller[_0xface('0x21')]);router[_0xface('0x22')](_0xface('0xb'),auth['isAuthenticated'](),controller[_0xface('0x22')]);module[_0xface('0x23')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index a128839..e39691c 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 _0x7621=['ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING'];(function(_0x2cbe00,_0x256061){var _0x1a9e49=function(_0xe86051){while(--_0xe86051){_0x2cbe00['push'](_0x2cbe00['shift']());}};_0x1a9e49(++_0x256061);}(_0x7621,0x1c1));var _0x1762=function(_0x362867,_0x5d8995){_0x362867=_0x362867-0x0;var _0x2e9f5e=_0x7621[_0x362867];return _0x2e9f5e;};'use strict';var Sequelize=require('sequelize');module[_0x1762('0x0')]={'name':{'type':Sequelize[_0x1762('0x1')]},'type':{'type':Sequelize[_0x1762('0x2')](_0x1762('0x3'),'script')},'description':{'type':Sequelize[_0x1762('0x4')]},'version':{'type':Sequelize[_0x1762('0x4')]},'path':{'type':Sequelize[_0x1762('0x1')],'comment':_0x1762('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x1762('0x2')](_0x1762('0x6'),_0x1762('0x7'),_0x1762('0x8'),_0x1762('0x9')),'defaultValue':_0x1762('0x8'),'comment':_0x1762('0xa')},'icon':{'type':Sequelize[_0x1762('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x1762('0x1')]},'scriptName':{'type':Sequelize[_0x1762('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6db6=['html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','exports','STRING','ENUM'];(function(_0x2b2375,_0x31530b){var _0x258f3a=function(_0x1ccd20){while(--_0x1ccd20){_0x2b2375['push'](_0x2b2375['shift']());}};_0x258f3a(++_0x31530b);}(_0x6db6,0x173));var _0x66db=function(_0x3b23dd,_0x49f17d){_0x3b23dd=_0x3b23dd-0x0;var _0x4305e4=_0x6db6[_0x3b23dd];return _0x4305e4;};'use strict';var Sequelize=require('sequelize');module[_0x66db('0x0')]={'name':{'type':Sequelize[_0x66db('0x1')]},'type':{'type':Sequelize[_0x66db('0x2')](_0x66db('0x3'),_0x66db('0x4'))},'description':{'type':Sequelize[_0x66db('0x5')]},'version':{'type':Sequelize[_0x66db('0x5')]},'path':{'type':Sequelize[_0x66db('0x1')],'comment':_0x66db('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x66db('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0x66db('0x8'),_0x66db('0x9'),_0x66db('0xa'),'never'),'defaultValue':_0x66db('0xa'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x66db('0x1')]},'adminUrl':{'type':Sequelize[_0x66db('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x66db('0x1')]},'scriptPath':{'type':Sequelize[_0x66db('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index f0aca6c..b4aef26 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 _0xf72b=['\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','%s%s','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','Plugins','end','sendStatus','stack','name','rawAttributes','type','key','map','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','Plugin','findAll','rows','catch','params','keys','find','download','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','error','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','isDirectory','some','manifest.json','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','sidebar','icon','icon-apps','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve'];(function(_0x41fc43,_0x18610a){var _0x212b86=function(_0x5cc8e7){while(--_0x5cc8e7){_0x41fc43['push'](_0x41fc43['shift']());}};_0x212b86(++_0x18610a);}(_0xf72b,0xb6));var _0xbf72=function(_0x261154,_0xbdcef6){_0x261154=_0x261154-0x0;var _0xddcfce=_0xf72b[_0x261154];return _0xddcfce;};'use strict';var pdf=require(_0xbf72('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbf72('0x1'));var zipdir=require(_0xbf72('0x2'));var jsonpatch=require(_0xbf72('0x3'));var rp=require('request-promise');var moment=require(_0xbf72('0x4'));var BPromise=require(_0xbf72('0x5'));var Mustache=require('mustache');var util=require(_0xbf72('0x6'));var path=require(_0xbf72('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbf72('0x8'));var fs=require('fs');var _=require(_0xbf72('0x9'));var squel=require(_0xbf72('0xa'));var crypto=require(_0xbf72('0xb'));var jsforce=require(_0xbf72('0xc'));var deskjs=require(_0xbf72('0xd'));var toCsv=require(_0xbf72('0xe'));var querystring=require(_0xbf72('0xf'));var Papa=require(_0xbf72('0x10'));var extract=require(_0xbf72('0x11'));var rimraf=require(_0xbf72('0x1'));var archiver=require('archiver');var Redis=require(_0xbf72('0x12'));var authService=require(_0xbf72('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xbf72('0x14'));var hardwareService=require(_0xbf72('0x15'));var logger=require(_0xbf72('0x16'))('api');var utils=require(_0xbf72('0x17'));var config=require(_0xbf72('0x18'));var db=require(_0xbf72('0x19'))['db'];config[_0xbf72('0x1a')]=_[_0xbf72('0x1b')](config['redis'],{'host':_0xbf72('0x1c'),'port':0x18eb});var socket=require(_0xbf72('0x1d'))(new Redis(config[_0xbf72('0x1a')]));require('./plugin.socket')[_0xbf72('0x1e')](socket);function respondWithStatusCode(_0x42992f,_0x559b9b){_0x559b9b=_0x559b9b||0xcc;return function(_0x3e98c5){if(_0x3e98c5){return _0x42992f['sendStatus'](_0x559b9b);}return _0x42992f[_0xbf72('0x1f')](_0x559b9b)['end']();};}function respondWithResult(_0x515be2,_0x11bea0){_0x11bea0=_0x11bea0||0xc8;return function(_0x3c144a){if(_0x3c144a){return _0x515be2['status'](_0x11bea0)[_0xbf72('0x20')](_0x3c144a);}};}function respondWithFilteredResult(_0xaca882,_0x2d681c){return function(_0x57af01){if(_0x57af01){var _0x127aa3=_0x57af01[_0xbf72('0x21')],_0x2fe541=_0x2d681c[_0xbf72('0x22')],_0x2bc540=_0x2d681c[_0xbf72('0x22')]+_0x2d681c[_0xbf72('0x23')],_0x3b0030;if(_0x2bc540>=_0x127aa3){_0x2bc540=_0x127aa3;_0x3b0030=0xc8;}else{_0x3b0030=0xce;}_0xaca882[_0xbf72('0x1f')](_0x3b0030);return _0xaca882[_0xbf72('0x24')](_0xbf72('0x25'),_0x2fe541+'-'+_0x2bc540+'/'+_0x127aa3)[_0xbf72('0x20')](_0x57af01);}return null;};}function patchUpdates(_0x4ad7ee){return function(_0x1b3158){try{jsonpatch['apply'](_0x1b3158,_0x4ad7ee,!![]);}catch(_0x2fddff){return BPromise[_0xbf72('0x26')](_0x2fddff);}return _0x1b3158[_0xbf72('0x27')]();};}function saveUpdates(_0x3be470,_0x39141b){return function(_0x596b15){if(_0x596b15){return _0x596b15[_0xbf72('0x28')](_0x3be470)[_0xbf72('0x29')](function(_0x7f879a){return _0x7f879a;});}return null;};}function removeEntity(_0x515803,_0x4fe097){return function(_0x51f04f){if(_0x51f04f){return _0x51f04f[_0xbf72('0x2a')]()[_0xbf72('0x29')](function(){var _0x265322=_0x51f04f[_0xbf72('0x2b')]({'plain':!![]});var _0x1dd69e=_0xbf72('0x2c');return db['UserProfileResource'][_0xbf72('0x2a')]({'where':{'type':_0x1dd69e,'resourceId':_0x265322['id']}})[_0xbf72('0x29')](function(){return _0x51f04f;});})[_0xbf72('0x29')](function(){_0x515803[_0xbf72('0x1f')](0xcc)[_0xbf72('0x2d')]();});}};}function handleEntityNotFound(_0x50d251,_0x54ab05){return function(_0x1c436b){if(!_0x1c436b){_0x50d251[_0xbf72('0x2e')](0x194);}return _0x1c436b;};}function handleError(_0x28211c,_0x169d0d){_0x169d0d=_0x169d0d||0x1f4;return function(_0x5ec4f6){logger['error'](_0x5ec4f6[_0xbf72('0x2f')]);if(_0x5ec4f6[_0xbf72('0x30')]){delete _0x5ec4f6[_0xbf72('0x30')];}_0x28211c[_0xbf72('0x1f')](_0x169d0d)['send'](_0x5ec4f6);};}exports['index']=function(_0x53d682,_0x21250b){var _0x34118d={},_0x516b4e={},_0x19a8df={'count':0x0,'rows':[]};var _0x1ec3a9=_['map'](db['Plugin'][_0xbf72('0x31')],function(_0x2a0542){return{'name':_0x2a0542['fieldName'],'type':_0x2a0542[_0xbf72('0x32')][_0xbf72('0x33')]};});_0x516b4e['model']=_[_0xbf72('0x34')](_0x1ec3a9,_0xbf72('0x30'));_0x516b4e[_0xbf72('0x35')]=_['keys'](_0x53d682[_0xbf72('0x35')]);_0x516b4e['filters']=_[_0xbf72('0x36')](_0x516b4e[_0xbf72('0x37')],_0x516b4e[_0xbf72('0x35')]);_0x34118d[_0xbf72('0x38')]=_[_0xbf72('0x36')](_0x516b4e[_0xbf72('0x37')],qs[_0xbf72('0x39')](_0x53d682['query'][_0xbf72('0x39')]));_0x34118d[_0xbf72('0x38')]=_0x34118d['attributes'][_0xbf72('0x3a')]?_0x34118d['attributes']:_0x516b4e['model'];if(!_0x53d682[_0xbf72('0x35')]['hasOwnProperty'](_0xbf72('0x3b'))){_0x34118d[_0xbf72('0x23')]=qs[_0xbf72('0x23')](_0x53d682[_0xbf72('0x35')]['limit']);_0x34118d[_0xbf72('0x22')]=qs[_0xbf72('0x22')](_0x53d682[_0xbf72('0x35')][_0xbf72('0x22')]);}_0x34118d[_0xbf72('0x3c')]=qs[_0xbf72('0x3d')](_0x53d682[_0xbf72('0x35')][_0xbf72('0x3d')]);_0x34118d[_0xbf72('0x3e')]=qs[_0xbf72('0x3f')](_[_0xbf72('0x40')](_0x53d682[_0xbf72('0x35')],_0x516b4e[_0xbf72('0x3f')]),_0x1ec3a9);if(_0x53d682['query']['filter']){_0x34118d[_0xbf72('0x3e')]=_[_0xbf72('0x41')](_0x34118d[_0xbf72('0x3e')],{'$or':_[_0xbf72('0x34')](_0x1ec3a9,function(_0x4a0ba5){if(_0x4a0ba5['type']!==_0xbf72('0x42')){var _0xbfe9d6={};_0xbfe9d6[_0x4a0ba5[_0xbf72('0x30')]]={'$like':'%'+_0x53d682[_0xbf72('0x35')]['filter']+'%'};return _0xbfe9d6;}})});}_0x34118d=_['merge']({},_0x34118d,_0x53d682[_0xbf72('0x43')]);var _0x543f57={'where':_0x34118d[_0xbf72('0x3e')]};return db['Plugin'][_0xbf72('0x21')](_0x543f57)[_0xbf72('0x29')](function(_0x14cf38){_0x19a8df['count']=_0x14cf38;if(_0x53d682['query'][_0xbf72('0x44')]){_0x34118d[_0xbf72('0x45')]=[{'all':!![]}];}return db[_0xbf72('0x46')][_0xbf72('0x47')](_0x34118d);})[_0xbf72('0x29')](function(_0x3a9ed2){_0x19a8df[_0xbf72('0x48')]=_0x3a9ed2;return _0x19a8df;})[_0xbf72('0x29')](respondWithFilteredResult(_0x21250b,_0x34118d))[_0xbf72('0x49')](handleError(_0x21250b,null));};exports['show']=function(_0x59ca62,_0x515364){var _0x10520e={'raw':!![],'where':{'id':_0x59ca62[_0xbf72('0x4a')]['id']}},_0x144972={};_0x144972[_0xbf72('0x37')]=_[_0xbf72('0x4b')](db[_0xbf72('0x46')][_0xbf72('0x31')]);_0x144972[_0xbf72('0x35')]=_[_0xbf72('0x4b')](_0x59ca62['query']);_0x144972[_0xbf72('0x3f')]=_[_0xbf72('0x36')](_0x144972[_0xbf72('0x37')],_0x144972['query']);_0x10520e['attributes']=_['intersection'](_0x144972[_0xbf72('0x37')],qs[_0xbf72('0x39')](_0x59ca62[_0xbf72('0x35')][_0xbf72('0x39')]));_0x10520e[_0xbf72('0x38')]=_0x10520e[_0xbf72('0x38')][_0xbf72('0x3a')]?_0x10520e[_0xbf72('0x38')]:_0x144972[_0xbf72('0x37')];if(_0x59ca62['query'][_0xbf72('0x44')]){_0x10520e[_0xbf72('0x45')]=[{'all':!![]}];}_0x10520e=_[_0xbf72('0x41')]({},_0x10520e,_0x59ca62[_0xbf72('0x43')]);return db[_0xbf72('0x46')][_0xbf72('0x4c')](_0x10520e)[_0xbf72('0x29')](handleEntityNotFound(_0x515364,null))[_0xbf72('0x29')](respondWithResult(_0x515364,null))[_0xbf72('0x49')](handleError(_0x515364,null));};exports[_0xbf72('0x4d')]=function(_0x28516c,_0x1a8c6a,_0x2eccc8){return db['Plugin']['find']({'where':{'id':_0x28516c[_0xbf72('0x4a')]['id']},'attributes':[_0xbf72('0x30'),'path'],'raw':!![]})[_0xbf72('0x29')](handleEntityNotFound(_0x1a8c6a,null))['then'](function(_0x345bef){if(_0x345bef){var _0x5d3bc9=path[_0xbf72('0x4e')](config[_0xbf72('0x4f')],_0xbf72('0x50'),util[_0xbf72('0x51')](_0xbf72('0x52'),path[_0xbf72('0x53')](_0x345bef['path'])));var _0x37c5ee=fs[_0xbf72('0x54')](_0x5d3bc9);var _0x2013f4=archiver(_0xbf72('0x55'),{'zlib':{'level':0x9}});_0x2013f4['on'](_0xbf72('0x56'),function(_0x1acff1){if(_0x1acff1[_0xbf72('0x57')]===_0xbf72('0x58')){logger[_0xbf72('0x59')](_0x1acff1);}else{throw new db['Sequelize'][(_0xbf72('0x5a'))](_0xbf72('0x5b'));}});_0x2013f4['on'](_0xbf72('0x59'),function(_0x500f4f){throw new db[(_0xbf72('0x5c'))][(_0xbf72('0x5a'))](_0xbf72('0x5b'));});_0x2013f4[_0xbf72('0x5d')](_0x37c5ee);_0x2013f4['glob'](_0xbf72('0x5e'),{'cwd':path[_0xbf72('0x4e')](config['root'],_0xbf72('0x50'),path[_0xbf72('0x5f')](_0x345bef['path'])),'ignore':[path[_0xbf72('0x4e')](path[_0xbf72('0x53')](_0x345bef['path']),_0xbf72('0x60')),path[_0xbf72('0x4e')](path[_0xbf72('0x53')](_0x345bef[_0xbf72('0x7')]),_0xbf72('0x61'))],'nodir':!![]})[_0xbf72('0x62')]();_0x37c5ee['on'](_0xbf72('0x63'),function(){if(!fs[_0xbf72('0x64')](_0x5d3bc9)){throw new db[(_0xbf72('0x5c'))][(_0xbf72('0x5a'))](_0xbf72('0x65'));}return _0x1a8c6a[_0xbf72('0x4d')](_0x5d3bc9,util[_0xbf72('0x51')]('%s.zip',path[_0xbf72('0x53')](_0x345bef[_0xbf72('0x7')])),function(_0x26accd){if(_0x26accd){throw new db[(_0xbf72('0x5c'))]['Error'](_0xbf72('0x66'));}fs[_0xbf72('0x67')](_0x5d3bc9);logger[_0xbf72('0x68')](_0xbf72('0x69'));logger[_0xbf72('0x68')](_0xbf72('0x6a'));});});}return null;})['catch'](handleError(_0x1a8c6a,null));};exports['upload']=function(_0x663d60,_0x1d0d0e,_0x380216){var _0x3f93de=path[_0xbf72('0x53')](_0x663d60[_0xbf72('0x6b')]['filename'],path[_0xbf72('0x6c')](_0x663d60['file']['filename']));var _0x53979e=path[_0xbf72('0x4e')](config[_0xbf72('0x4f')],_0xbf72('0x50'),_0x663d60['file']['filename']);var _0x42fe58=path[_0xbf72('0x4e')](config[_0xbf72('0x4f')],_0xbf72('0x50'),_0x3f93de);logger[_0xbf72('0x68')](_0xbf72('0x6d'),_0x53979e);logger[_0xbf72('0x68')]('Plugin\x20upload\x20destination:\x20%s',_0x42fe58);try{fs[_0xbf72('0x6e')](_0x53979e,parseInt(_0xbf72('0x6f'),0x8));extract(_0x53979e,{'dir':_0x42fe58},function(_0x1a1907){if(_0x1a1907){logger[_0xbf72('0x59')](_0x1a1907);handleError(_0x1a1907,!![]);};var _0x697bcc=fs['readdirSync'](_0x42fe58);if(_0x697bcc[_0xbf72('0x3a')]>0x1){removeReferences(_0x53979e,_0x42fe58);logger['error'](_0xbf72('0x70'));return _0x380216(new Error('Invalid\x20plugin\x20structure'));}var _0x20557f=fs['lstatSync'](path[_0xbf72('0x4e')](_0x42fe58,_0x697bcc[0x0]));if(_0x20557f['isFile']()){removeReferences(_0x53979e,_0x42fe58);logger[_0xbf72('0x59')](_0xbf72('0x70'));return _0x380216(new Error('Invalid\x20plugin\x20structure'));}if(_0x20557f[_0xbf72('0x71')]()){var _0x58030f=fs['readdirSync'](path['join'](_0x42fe58,_0x697bcc[0x0]));if(_0x58030f['length']===0x0){removeReferences(_0x53979e,_0x42fe58);logger[_0xbf72('0x59')]('Invalid\x20plugin\x20structure');return _0x380216(new Error('Invalid\x20plugin\x20structure'));}var _0x3c0725=_0x58030f[_0xbf72('0x72')](function(_0x34749e){return _0x34749e===_0xbf72('0x73');});if(!_0x3c0725){return _0x380216(new Error('Plugin\x20manifest\x20missing'));}var _0x4d7863=fs['readFileSync'](path[_0xbf72('0x4e')](_0x42fe58,_0x697bcc[0x0],_0xbf72('0x73')));var _0x1562fa=JSON[_0xbf72('0x74')](_0x4d7863);if(_0xbf72('0x75')==typeof _0x1562fa[_0xbf72('0x30')]){return _0x380216(new Error(_0xbf72('0x76')));}if(_0xbf72('0x75')==typeof _0x1562fa[_0xbf72('0x32')]){return _0x380216(new Error(_0xbf72('0x77')));}if(_0xbf72('0x75')==typeof _0x1562fa['version']){return _0x380216(new Error(_0xbf72('0x78')));}if(_0xbf72('0x75')==typeof _0x1562fa[_0xbf72('0x79')]){return _0x380216(new Error(_0xbf72('0x7a')));}if(_0x1562fa[_0xbf72('0x32')]===_0xbf72('0x7b')){if(_0xbf72('0x75')==typeof _0x1562fa[_0xbf72('0x79')][_0xbf72('0x7c')]){return _0x380216(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xbf72('0x75')==typeof _0x1562fa['parameters'][_0xbf72('0x7c')][_0xbf72('0x7d')]&&_0xbf72('0x75')==typeof _0x1562fa[_0xbf72('0x79')][_0xbf72('0x7c')][_0xbf72('0x7e')]){return _0x380216(new Error(_0xbf72('0x7f')));}}else if(_0x1562fa[_0xbf72('0x32')]===_0xbf72('0x80')){if(_0xbf72('0x75')==typeof _0x1562fa[_0xbf72('0x79')][_0xbf72('0x81')]){return _0x380216(new Error(_0xbf72('0x82')));}if(_0xbf72('0x75')==typeof _0x1562fa[_0xbf72('0x79')][_0xbf72('0x83')]){return _0x380216(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x380216(new Error(_0xbf72('0x84')));}var _0x877260=_0x1562fa[_0xbf72('0x30')];var _0x11aab6=_0x1562fa['description'];var _0x332dfe=_0x1562fa[_0xbf72('0x32')];var _0x3d3f1a=_0x1562fa[_0xbf72('0x85')]?_0x1562fa[_0xbf72('0x85')]:'always';var _0x6f4ae9=_0x1562fa[_0xbf72('0x86')]?_0x1562fa[_0xbf72('0x86')]:_0xbf72('0x87');var _0x4ed3da='';var _0x4e007d='';var _0x1ba545='';var _0x171dc4='';var _0x504d01=_0x1562fa['version'];if(_0x332dfe===_0xbf72('0x7b')){if(_0xbf72('0x75')!=typeof _0x1562fa[_0xbf72('0x79')]['views'][_0xbf72('0x7d')]){var _0x405f84=_0x1562fa['parameters']['views'][_0xbf72('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0xbf72('0x88')](_0x405f84)){_0x4ed3da=path[_0xbf72('0x4e')](_0xbf72('0x89'),_0x3f93de,_0x697bcc[0x0],_0x405f84);}else{_0x4ed3da=_0x405f84;}}else{logger[_0xbf72('0x68')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xbf72('0x75')!=typeof _0x1562fa[_0xbf72('0x79')][_0xbf72('0x7c')][_0xbf72('0x7e')]){var _0x49bccd=_0x1562fa[_0xbf72('0x79')]['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0xbf72('0x88')](_0x49bccd)){_0x4e007d=path[_0xbf72('0x4e')](_0xbf72('0x89'),_0x3f93de,_0x697bcc[0x0],_0x49bccd);}else{_0x4e007d=_0x49bccd;}}else{logger[_0xbf72('0x68')](_0xbf72('0x8a'));}}else if(_0x332dfe===_0xbf72('0x80')){_0x1ba545=_0x1562fa['parameters'][_0xbf72('0x81')];_0x171dc4=_0x1562fa['parameters'][_0xbf72('0x83')];if(_0xbf72('0x75')!=typeof _0x1562fa['parameters'][_0xbf72('0x7c')]){if(_0xbf72('0x75')!=typeof _0x1562fa[_0xbf72('0x79')][_0xbf72('0x7c')][_0xbf72('0x7d')]){var _0x405f84=_0x1562fa[_0xbf72('0x79')][_0xbf72('0x7c')][_0xbf72('0x7d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x405f84)){_0x4ed3da=path[_0xbf72('0x4e')]('plugins',_0x3f93de,_0x697bcc[0x0],_0x405f84);}else{_0x4ed3da=_0x405f84;}}if('undefined'!=typeof _0x1562fa[_0xbf72('0x79')][_0xbf72('0x7c')][_0xbf72('0x7e')]){var _0x49bccd=_0x1562fa[_0xbf72('0x79')][_0xbf72('0x7c')][_0xbf72('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xbf72('0x88')](_0x49bccd)){_0x4e007d=path[_0xbf72('0x4e')](_0xbf72('0x89'),_0x3f93de,_0x697bcc[0x0],_0x49bccd);}else{_0x4e007d=_0x49bccd;}}}}var _0x4f379b={'name':_0x877260,'description':_0x11aab6,'path':path[_0xbf72('0x4e')](_0x3f93de,_0x697bcc[0x0]),'type':_0x332dfe,'sidebar':_0x3d3f1a,'icon':_0x6f4ae9,'adminUrl':_0x4ed3da,'agentUrl':_0x4e007d,'scriptName':_0x1ba545,'scriptPath':_0x171dc4,'version':_0x504d01};removeReferences(_0x53979e,null);return db[_0xbf72('0x46')][_0xbf72('0x8b')](_0x4f379b)[_0xbf72('0x29')](function(_0x19e1f1){var _0x3245f9={'role':_0x663d60[_0xbf72('0x8c')][_0xbf72('0x8d')],'userProfileId':_0x663d60[_0xbf72('0x8c')][_0xbf72('0x8e')]};if(!_0x3245f9)throw new Error(_0xbf72('0x8f'));if(_0x3245f9[_0xbf72('0x8d')]===_0xbf72('0x90')){var _0x7888c=_0x19e1f1[_0xbf72('0x2b')]({'plain':!![]});return db[_0xbf72('0x91')]['find']({'where':{'name':_0xbf72('0x2c'),'userProfileId':_0x3245f9[_0xbf72('0x8e')]},'raw':!![]})[_0xbf72('0x29')](function(_0x5ac577){if(_0x5ac577&&_0x5ac577[_0xbf72('0x92')]===0x0){return db[_0xbf72('0x93')][_0xbf72('0x8b')]({'name':_0x7888c['name'],'resourceId':_0x7888c['id'],'type':_0x5ac577[_0xbf72('0x30')],'sectionId':_0x5ac577['id']},{})[_0xbf72('0x29')](function(){return _0x19e1f1;});}else{return _0x19e1f1;}})['catch'](function(_0x281928){logger[_0xbf72('0x59')](_0xbf72('0x94'),_0x281928);throw _0x281928;});}return _0x19e1f1;})[_0xbf72('0x29')](respondWithResult(_0x1d0d0e,null))[_0xbf72('0x49')](handleError(_0x1d0d0e,null));}});}catch(_0x4dcde9){_0x1d0d0e['status'](0x1f4)[_0xbf72('0x95')](_0x4dcde9);}};function removeReferences(_0x39ca59,_0x2ebd28){try{if(_0x39ca59){fs[_0xbf72('0x67')](_0x39ca59);logger[_0xbf72('0x68')](_0xbf72('0x96'));}if(_0x2ebd28){rimraf(_0x2ebd28,function(){});logger[_0xbf72('0x68')](_0xbf72('0x97'));}}catch(_0x56017b){logger[_0xbf72('0x59')](_0x56017b);}}exports[_0xbf72('0x28')]=function(_0x4f88af,_0x355d22,_0x382fc5){return db['Plugin']['find']({'where':{'id':_0x4f88af[_0xbf72('0x4a')]['id']}})[_0xbf72('0x29')](handleEntityNotFound(_0x355d22,null))[_0xbf72('0x29')](saveUpdates(_0x4f88af[_0xbf72('0x8c')],null))[_0xbf72('0x29')](respondWithResult(_0x355d22,null))[_0xbf72('0x49')](handleError(_0x355d22,null));};exports['delete']=function(_0x914e7b,_0x3e3b65,_0x172e38){return db[_0xbf72('0x46')][_0xbf72('0x4c')]({'where':{'id':_0x914e7b[_0xbf72('0x4a')]['id']}})[_0xbf72('0x29')](function(_0x77b213){if(_0x77b213){return _0x77b213['destroy']();}})[_0xbf72('0x29')](function(_0x3f5741){rimraf(path[_0xbf72('0x4e')](config['root'],'server/files/plugins',path[_0xbf72('0x5f')](_0x3f5741[_0xbf72('0x7')])),function(){});return _0x3f5741;})[_0xbf72('0x29')](handleEntityNotFound(_0x3e3b65,null))['then'](respondWithStatusCode(_0x3e3b65,null))[_0xbf72('0x49')](handleError(_0x3e3b65,null));};exports[_0xbf72('0x98')]=function(_0x3adf2a,_0x40ea4d,_0x297cc6){return BPromise[_0xbf72('0x99')]()[_0xbf72('0x29')](function(){if(!_0x3adf2a[_0xbf72('0x35')][_0xbf72('0x7')]){throw new Error(_0xbf72('0x9a'));}if(!_0x3adf2a[_0xbf72('0x35')]['port']){throw new Error(_0xbf72('0x9b'));}var _0x296106=_0x3adf2a[_0xbf72('0x35')][_0xbf72('0x9c')]?_0x3adf2a[_0xbf72('0x35')]['hostname']+':'+_0x3adf2a['query'][_0xbf72('0x9d')]:_0xbf72('0x9e')+_0x3adf2a[_0xbf72('0x35')][_0xbf72('0x9d')];var _0x5df0d8=_0x3adf2a[_0xbf72('0x35')][_0xbf72('0x20')]?_0x3adf2a['query'][_0xbf72('0x20')]:!![];var _0x2beded=_0x3adf2a[_0xbf72('0x35')]['encoding']?_0x3adf2a[_0xbf72('0x35')][_0xbf72('0x9f')]:null;var _0x40da06={'method':_0x3adf2a[_0xbf72('0xa0')],'uri':util[_0xbf72('0x51')]('%s%s',_0x296106,_0x3adf2a[_0xbf72('0x35')][_0xbf72('0x7')]),'json':_0x5df0d8,'resolveWithFullResponse':!![],'encoding':_0x2beded,'qs':_0x3adf2a[_0xbf72('0x35')]};if(_0x3adf2a[_0xbf72('0xa1')]){_0x40da06['headers']=_0x3adf2a[_0xbf72('0xa1')];if(_0x40da06[_0xbf72('0xa1')][_0xbf72('0xa2')]){delete _0x40da06[_0xbf72('0xa1')][_0xbf72('0xa2')];}}if(_0x40da06[_0xbf72('0xa1')][_0xbf72('0xa3')]){delete _0x40da06['headers'][_0xbf72('0xa3')];}return rp(_0x40da06);})['then'](function(_0x1c485e){if(_0x1c485e){_0x40ea4d[_0xbf72('0x24')](_0x1c485e['headers']);logger[_0xbf72('0x68')](_0x1c485e[_0xbf72('0x8c')]);if(_[_0xbf72('0xa4')](_0x3adf2a[_0xbf72('0x35')][_0xbf72('0x7')],_0xbf72('0x4d'))&&_0x1c485e[_0xbf72('0xa5')]==0x1f4){return _0x40ea4d[_0xbf72('0x2e')](_0x1c485e['statusCode']);}else{return _0x40ea4d[_0xbf72('0x1f')](_0x1c485e[_0xbf72('0xa5')])[_0xbf72('0x95')](_0x1c485e[_0xbf72('0x8c')]);}}else{return _0x40ea4d[_0xbf72('0x2e')](0xc8);}})[_0xbf72('0x49')](handleError(_0x40ea4d,null));};exports[_0xbf72('0xa6')]=function(_0x260c4b,_0x23bbaa,_0x15eaf8){return BPromise[_0xbf72('0x99')]()['then'](function(){if(!_0x260c4b[_0xbf72('0x35')][_0xbf72('0x7')]){throw new Error(_0xbf72('0x9a'));}if(!_0x260c4b[_0xbf72('0x35')][_0xbf72('0x9d')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x539b8e=_0x260c4b[_0xbf72('0x35')][_0xbf72('0x9c')]?_0x260c4b[_0xbf72('0x35')][_0xbf72('0x9c')]+':'+_0x260c4b['query'][_0xbf72('0x9d')]:_0xbf72('0x9e')+_0x260c4b[_0xbf72('0x35')][_0xbf72('0x9d')];var _0x37bf79=_0x260c4b['query'][_0xbf72('0x20')]?_0x260c4b[_0xbf72('0x35')][_0xbf72('0x20')]:!![];var _0x1828f1=_0x260c4b['query'][_0xbf72('0x9f')]?_0x260c4b['query']['encoding']:null;var _0x380e3a={'method':_0x260c4b[_0xbf72('0xa0')],'uri':util[_0xbf72('0x51')](_0xbf72('0xa7'),_0x539b8e,_0x260c4b[_0xbf72('0x35')][_0xbf72('0x7')]),'json':_0x37bf79,'resolveWithFullResponse':!![],'encoding':_0x1828f1,'body':_0x260c4b[_0xbf72('0x8c')]};if(_0x260c4b[_0xbf72('0xa1')]){_0x380e3a[_0xbf72('0xa1')]=_0x260c4b[_0xbf72('0xa1')];if(_0x380e3a[_0xbf72('0xa1')][_0xbf72('0xa2')]){delete _0x380e3a[_0xbf72('0xa1')][_0xbf72('0xa2')];}}if(_0x380e3a[_0xbf72('0xa1')][_0xbf72('0xa3')]){delete _0x380e3a[_0xbf72('0xa1')][_0xbf72('0xa3')];}return rp(_0x380e3a);})[_0xbf72('0x29')](function(_0x1fdba0){if(_0x1fdba0){_0x23bbaa[_0xbf72('0x24')](_0x1fdba0[_0xbf72('0xa1')]);logger['info'](_0x1fdba0[_0xbf72('0x8c')]);return _0x23bbaa[_0xbf72('0x1f')](_0x1fdba0[_0xbf72('0xa5')])[_0xbf72('0x95')](_0x1fdba0[_0xbf72('0x8c')]);}else{return _0x23bbaa[_0xbf72('0x2e')](0xc8);}})[_0xbf72('0x49')](handleError(_0x23bbaa,null));}; \ No newline at end of file +var _0x804e=['webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','%s%s','headers','content-length','content-type','statusCode','webhookPost','http://localhost:','method','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./plugin.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','get','Plugins','UserProfileResource','destroy','then','error','stack','name','index','Plugin','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','path','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','extname','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','undefined','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','unlinkSync','Extracted\x20folder\x20removed','dirname'];(function(_0x59eefb,_0x2151ce){var _0x1a49e8=function(_0x5a758c){while(--_0x5a758c){_0x59eefb['push'](_0x59eefb['shift']());}};_0x1a49e8(++_0x2151ce);}(_0x804e,0xc0));var _0xe804=function(_0x2533e8,_0x11edb7){_0x2533e8=_0x2533e8-0x0;var _0x57637d=_0x804e[_0x2533e8];return _0x57637d;};'use strict';var pdf=require(_0xe804('0x0'));var emlformat=require(_0xe804('0x1'));var rimraf=require(_0xe804('0x2'));var zipdir=require(_0xe804('0x3'));var jsonpatch=require(_0xe804('0x4'));var rp=require(_0xe804('0x5'));var moment=require('moment');var BPromise=require(_0xe804('0x6'));var Mustache=require(_0xe804('0x7'));var util=require(_0xe804('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xe804('0x9'));var ejs=require(_0xe804('0xa'));var fs=require('fs');var _=require(_0xe804('0xb'));var squel=require(_0xe804('0xc'));var crypto=require(_0xe804('0xd'));var jsforce=require(_0xe804('0xe'));var deskjs=require(_0xe804('0xf'));var toCsv=require(_0xe804('0x9'));var querystring=require('querystring');var Papa=require(_0xe804('0x10'));var extract=require(_0xe804('0x11'));var rimraf=require('rimraf');var archiver=require(_0xe804('0x12'));var Redis=require(_0xe804('0x13'));var authService=require(_0xe804('0x14'));var qs=require(_0xe804('0x15'));var as=require(_0xe804('0x16'));var hardwareService=require(_0xe804('0x17'));var logger=require(_0xe804('0x18'))('api');var utils=require('../../config/utils');var config=require(_0xe804('0x19'));var db=require(_0xe804('0x1a'))['db'];config[_0xe804('0x1b')]=_[_0xe804('0x1c')](config[_0xe804('0x1b')],{'host':_0xe804('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe804('0x1b')]));require(_0xe804('0x1e'))[_0xe804('0x1f')](socket);function respondWithStatusCode(_0x5831d7,_0x5c1ba6){_0x5c1ba6=_0x5c1ba6||0xcc;return function(_0x4cf0e7){if(_0x4cf0e7){return _0x5831d7[_0xe804('0x20')](_0x5c1ba6);}return _0x5831d7[_0xe804('0x21')](_0x5c1ba6)[_0xe804('0x22')]();};}function respondWithResult(_0x43c365,_0x5d2103){_0x5d2103=_0x5d2103||0xc8;return function(_0x5ed320){if(_0x5ed320){return _0x43c365[_0xe804('0x21')](_0x5d2103)[_0xe804('0x23')](_0x5ed320);}};}function respondWithFilteredResult(_0x16ffa4,_0x237e83){return function(_0x11ad8a){if(_0x11ad8a){var _0x440dce=_0x11ad8a[_0xe804('0x24')],_0xd8ddc0=_0x237e83[_0xe804('0x25')],_0x316cd2=_0x237e83['offset']+_0x237e83[_0xe804('0x26')],_0x49963a;if(_0x316cd2>=_0x440dce){_0x316cd2=_0x440dce;_0x49963a=0xc8;}else{_0x49963a=0xce;}_0x16ffa4[_0xe804('0x21')](_0x49963a);return _0x16ffa4[_0xe804('0x27')](_0xe804('0x28'),_0xd8ddc0+'-'+_0x316cd2+'/'+_0x440dce)[_0xe804('0x23')](_0x11ad8a);}return null;};}function patchUpdates(_0x5cf652){return function(_0x3758df){try{jsonpatch[_0xe804('0x29')](_0x3758df,_0x5cf652,!![]);}catch(_0x548714){return BPromise[_0xe804('0x2a')](_0x548714);}return _0x3758df[_0xe804('0x2b')]();};}function saveUpdates(_0x157b29,_0x3706af){return function(_0x4ee6c1){if(_0x4ee6c1){return _0x4ee6c1[_0xe804('0x2c')](_0x157b29)['then'](function(_0x4100cc){return _0x4100cc;});}return null;};}function removeEntity(_0x335fce,_0x22c6d1){return function(_0x23c817){if(_0x23c817){return _0x23c817['destroy']()['then'](function(){var _0x5a91b9=_0x23c817[_0xe804('0x2d')]({'plain':!![]});var _0x3cb9d2=_0xe804('0x2e');return db[_0xe804('0x2f')][_0xe804('0x30')]({'where':{'type':_0x3cb9d2,'resourceId':_0x5a91b9['id']}})[_0xe804('0x31')](function(){return _0x23c817;});})[_0xe804('0x31')](function(){_0x335fce[_0xe804('0x21')](0xcc)[_0xe804('0x22')]();});}};}function handleEntityNotFound(_0x268bfe,_0x1de4f9){return function(_0x5c2623){if(!_0x5c2623){_0x268bfe[_0xe804('0x20')](0x194);}return _0x5c2623;};}function handleError(_0xef06ef,_0x3406e5){_0x3406e5=_0x3406e5||0x1f4;return function(_0x3d532a){logger[_0xe804('0x32')](_0x3d532a[_0xe804('0x33')]);if(_0x3d532a[_0xe804('0x34')]){delete _0x3d532a['name'];}_0xef06ef[_0xe804('0x21')](_0x3406e5)['send'](_0x3d532a);};}exports[_0xe804('0x35')]=function(_0x4dc70f,_0x119cf0){var _0x4ee2c9={},_0x2d627b={},_0x2378b3={'count':0x0,'rows':[]};var _0x51e4be=_['map'](db[_0xe804('0x36')][_0xe804('0x37')],function(_0x58f671){return{'name':_0x58f671[_0xe804('0x38')],'type':_0x58f671[_0xe804('0x39')][_0xe804('0x3a')]};});_0x2d627b[_0xe804('0x3b')]=_[_0xe804('0x3c')](_0x51e4be,'name');_0x2d627b[_0xe804('0x3d')]=_['keys'](_0x4dc70f[_0xe804('0x3d')]);_0x2d627b[_0xe804('0x3e')]=_[_0xe804('0x3f')](_0x2d627b[_0xe804('0x3b')],_0x2d627b[_0xe804('0x3d')]);_0x4ee2c9[_0xe804('0x40')]=_['intersection'](_0x2d627b[_0xe804('0x3b')],qs[_0xe804('0x41')](_0x4dc70f['query']['fields']));_0x4ee2c9[_0xe804('0x40')]=_0x4ee2c9[_0xe804('0x40')][_0xe804('0x42')]?_0x4ee2c9['attributes']:_0x2d627b[_0xe804('0x3b')];if(!_0x4dc70f[_0xe804('0x3d')][_0xe804('0x43')](_0xe804('0x44'))){_0x4ee2c9['limit']=qs['limit'](_0x4dc70f['query'][_0xe804('0x26')]);_0x4ee2c9['offset']=qs[_0xe804('0x25')](_0x4dc70f[_0xe804('0x3d')][_0xe804('0x25')]);}_0x4ee2c9[_0xe804('0x45')]=qs[_0xe804('0x46')](_0x4dc70f[_0xe804('0x3d')][_0xe804('0x46')]);_0x4ee2c9[_0xe804('0x47')]=qs[_0xe804('0x3e')](_[_0xe804('0x48')](_0x4dc70f[_0xe804('0x3d')],_0x2d627b['filters']),_0x51e4be);if(_0x4dc70f[_0xe804('0x3d')][_0xe804('0x49')]){_0x4ee2c9[_0xe804('0x47')]=_['merge'](_0x4ee2c9[_0xe804('0x47')],{'$or':_[_0xe804('0x3c')](_0x51e4be,function(_0x1f58d4){if(_0x1f58d4[_0xe804('0x39')]!==_0xe804('0x4a')){var _0x1b5728={};_0x1b5728[_0x1f58d4[_0xe804('0x34')]]={'$like':'%'+_0x4dc70f[_0xe804('0x3d')][_0xe804('0x49')]+'%'};return _0x1b5728;}})});}_0x4ee2c9=_[_0xe804('0x4b')]({},_0x4ee2c9,_0x4dc70f[_0xe804('0x4c')]);var _0x271b86={'where':_0x4ee2c9[_0xe804('0x47')]};return db[_0xe804('0x36')][_0xe804('0x24')](_0x271b86)[_0xe804('0x31')](function(_0x3f623){_0x2378b3[_0xe804('0x24')]=_0x3f623;if(_0x4dc70f['query'][_0xe804('0x4d')]){_0x4ee2c9[_0xe804('0x4e')]=[{'all':!![]}];}return db[_0xe804('0x36')][_0xe804('0x4f')](_0x4ee2c9);})[_0xe804('0x31')](function(_0x35fe27){_0x2378b3[_0xe804('0x50')]=_0x35fe27;return _0x2378b3;})[_0xe804('0x31')](respondWithFilteredResult(_0x119cf0,_0x4ee2c9))['catch'](handleError(_0x119cf0,null));};exports[_0xe804('0x51')]=function(_0x23e268,_0x7b09d2){var _0x16a080={'raw':!![],'where':{'id':_0x23e268[_0xe804('0x52')]['id']}},_0x145757={};_0x145757[_0xe804('0x3b')]=_[_0xe804('0x53')](db[_0xe804('0x36')][_0xe804('0x37')]);_0x145757[_0xe804('0x3d')]=_[_0xe804('0x53')](_0x23e268['query']);_0x145757['filters']=_[_0xe804('0x3f')](_0x145757[_0xe804('0x3b')],_0x145757[_0xe804('0x3d')]);_0x16a080[_0xe804('0x40')]=_[_0xe804('0x3f')](_0x145757[_0xe804('0x3b')],qs[_0xe804('0x41')](_0x23e268['query'][_0xe804('0x41')]));_0x16a080['attributes']=_0x16a080[_0xe804('0x40')][_0xe804('0x42')]?_0x16a080[_0xe804('0x40')]:_0x145757[_0xe804('0x3b')];if(_0x23e268['query'][_0xe804('0x4d')]){_0x16a080['include']=[{'all':!![]}];}_0x16a080=_[_0xe804('0x4b')]({},_0x16a080,_0x23e268['options']);return db[_0xe804('0x36')][_0xe804('0x54')](_0x16a080)[_0xe804('0x31')](handleEntityNotFound(_0x7b09d2,null))[_0xe804('0x31')](respondWithResult(_0x7b09d2,null))[_0xe804('0x55')](handleError(_0x7b09d2,null));};exports['download']=function(_0x544d97,_0x570aca,_0x56ef85){return db['Plugin']['find']({'where':{'id':_0x544d97[_0xe804('0x52')]['id']},'attributes':['name',_0xe804('0x56')],'raw':!![]})['then'](handleEntityNotFound(_0x570aca,null))[_0xe804('0x31')](function(_0x3e7d87){if(_0x3e7d87){var _0x1bc5b1=path[_0xe804('0x57')](config[_0xe804('0x58')],_0xe804('0x59'),util[_0xe804('0x5a')](_0xe804('0x5b'),path[_0xe804('0x5c')](_0x3e7d87[_0xe804('0x56')])));var _0x36a805=fs[_0xe804('0x5d')](_0x1bc5b1);var _0x17ac20=archiver(_0xe804('0x5e'),{'zlib':{'level':0x9}});_0x17ac20['on'](_0xe804('0x5f'),function(_0x2d0300){if(_0x2d0300[_0xe804('0x60')]===_0xe804('0x61')){logger[_0xe804('0x32')](_0x2d0300);}else{throw new db[(_0xe804('0x62'))][(_0xe804('0x63'))](_0xe804('0x64'));}});_0x17ac20['on']('error',function(_0x1cb39c){throw new db['Sequelize']['Error'](_0xe804('0x64'));});_0x17ac20[_0xe804('0x65')](_0x36a805);_0x17ac20[_0xe804('0x66')]('**/*',{'cwd':path[_0xe804('0x57')](config[_0xe804('0x58')],_0xe804('0x59'),path['dirname'](_0x3e7d87[_0xe804('0x56')])),'ignore':[path[_0xe804('0x57')](path[_0xe804('0x5c')](_0x3e7d87['path']),'node_modules/**/*'),path[_0xe804('0x57')](path[_0xe804('0x5c')](_0x3e7d87[_0xe804('0x56')]),_0xe804('0x67'))],'nodir':!![]})[_0xe804('0x68')]();_0x36a805['on'](_0xe804('0x69'),function(){if(!fs[_0xe804('0x6a')](_0x1bc5b1)){throw new db[(_0xe804('0x62'))][(_0xe804('0x63'))](_0xe804('0x6b'));}return _0x570aca[_0xe804('0x6c')](_0x1bc5b1,util[_0xe804('0x5a')](_0xe804('0x5b'),path['basename'](_0x3e7d87['path'])),function(_0x37ff78){if(_0x37ff78){throw new db[(_0xe804('0x62'))]['Error'](_0xe804('0x6d'));}fs['unlinkSync'](_0x1bc5b1);logger[_0xe804('0x6e')](_0xe804('0x6f'));logger[_0xe804('0x6e')](_0xe804('0x70'));});});}return null;})[_0xe804('0x55')](handleError(_0x570aca,null));};exports[_0xe804('0x71')]=function(_0x2e09d8,_0x12320c,_0x59ad19){var _0x41c716=path[_0xe804('0x5c')](_0x2e09d8[_0xe804('0x72')]['filename'],path[_0xe804('0x73')](_0x2e09d8['file'][_0xe804('0x74')]));var _0x1976d6=path[_0xe804('0x57')](config[_0xe804('0x58')],_0xe804('0x59'),_0x2e09d8['file'][_0xe804('0x74')]);var _0x23d1bd=path['join'](config[_0xe804('0x58')],_0xe804('0x59'),_0x41c716);logger[_0xe804('0x6e')]('Plugin\x20upload\x20filepath:\x20%s',_0x1976d6);logger[_0xe804('0x6e')](_0xe804('0x75'),_0x23d1bd);try{fs[_0xe804('0x76')](_0x1976d6,parseInt(_0xe804('0x77'),0x8));extract(_0x1976d6,{'dir':_0x23d1bd},function(_0xcb935f){if(_0xcb935f){logger['error'](_0xcb935f);handleError(_0xcb935f,!![]);};var _0x15ecda=fs[_0xe804('0x78')](_0x23d1bd);if(_0x15ecda[_0xe804('0x42')]>0x1){removeReferences(_0x1976d6,_0x23d1bd);logger[_0xe804('0x32')](_0xe804('0x79'));return _0x59ad19(new Error(_0xe804('0x79')));}var _0xf63b17=fs['lstatSync'](path[_0xe804('0x57')](_0x23d1bd,_0x15ecda[0x0]));if(_0xf63b17['isFile']()){removeReferences(_0x1976d6,_0x23d1bd);logger[_0xe804('0x32')]('Invalid\x20plugin\x20structure');return _0x59ad19(new Error(_0xe804('0x79')));}if(_0xf63b17[_0xe804('0x7a')]()){var _0x270620=fs[_0xe804('0x78')](path[_0xe804('0x57')](_0x23d1bd,_0x15ecda[0x0]));if(_0x270620[_0xe804('0x42')]===0x0){removeReferences(_0x1976d6,_0x23d1bd);logger[_0xe804('0x32')](_0xe804('0x79'));return _0x59ad19(new Error(_0xe804('0x79')));}var _0x404cc6=_0x270620[_0xe804('0x7b')](function(_0x5885b7){return _0x5885b7===_0xe804('0x7c');});if(!_0x404cc6){return _0x59ad19(new Error(_0xe804('0x7d')));}var _0x27c7d4=fs['readFileSync'](path['join'](_0x23d1bd,_0x15ecda[0x0],_0xe804('0x7c')));var _0x364369=JSON[_0xe804('0x7e')](_0x27c7d4);if('undefined'==typeof _0x364369[_0xe804('0x34')]){return _0x59ad19(new Error(_0xe804('0x7f')));}if('undefined'==typeof _0x364369[_0xe804('0x39')]){return _0x59ad19(new Error(_0xe804('0x80')));}if(_0xe804('0x81')==typeof _0x364369[_0xe804('0x82')]){return _0x59ad19(new Error(_0xe804('0x83')));}if('undefined'==typeof _0x364369[_0xe804('0x84')]){return _0x59ad19(new Error(_0xe804('0x85')));}if(_0x364369[_0xe804('0x39')]===_0xe804('0x86')){if(_0xe804('0x81')==typeof _0x364369[_0xe804('0x84')][_0xe804('0x87')]){return _0x59ad19(new Error(_0xe804('0x88')));}if('undefined'==typeof _0x364369[_0xe804('0x84')][_0xe804('0x87')][_0xe804('0x89')]&&'undefined'==typeof _0x364369[_0xe804('0x84')][_0xe804('0x87')][_0xe804('0x8a')]){return _0x59ad19(new Error(_0xe804('0x8b')));}}else if(_0x364369[_0xe804('0x39')]===_0xe804('0x8c')){if(_0xe804('0x81')==typeof _0x364369[_0xe804('0x84')][_0xe804('0x8d')]){return _0x59ad19(new Error(_0xe804('0x8e')));}if('undefined'==typeof _0x364369[_0xe804('0x84')][_0xe804('0x8f')]){return _0x59ad19(new Error(_0xe804('0x90')));}}else{return _0x59ad19(new Error(_0xe804('0x91')));}var _0x422abe=_0x364369[_0xe804('0x34')];var _0x382345=_0x364369[_0xe804('0x92')];var _0x5a295b=_0x364369['type'];var _0x4ffdb0=_0x364369[_0xe804('0x93')]?_0x364369[_0xe804('0x93')]:_0xe804('0x94');var _0x2b6ed2=_0x364369[_0xe804('0x95')]?_0x364369[_0xe804('0x95')]:'icon-apps';var _0x524262='';var _0x205f1c='';var _0x1b5c23='';var _0x463381='';var _0x4a8bdd=_0x364369[_0xe804('0x82')];if(_0x5a295b===_0xe804('0x86')){if(_0xe804('0x81')!=typeof _0x364369[_0xe804('0x84')][_0xe804('0x87')][_0xe804('0x89')]){var _0x1a01f3=_0x364369[_0xe804('0x84')][_0xe804('0x87')][_0xe804('0x89')];if(!/^(f|ht)tps?:\/\//i[_0xe804('0x96')](_0x1a01f3)){_0x524262=path[_0xe804('0x57')](_0xe804('0x97'),_0x41c716,_0x15ecda[0x0],_0x1a01f3);}else{_0x524262=_0x1a01f3;}}else{logger['info'](_0xe804('0x98'));}if(_0xe804('0x81')!=typeof _0x364369[_0xe804('0x84')]['views'][_0xe804('0x8a')]){var _0x1bdc9a=_0x364369[_0xe804('0x84')][_0xe804('0x87')][_0xe804('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0xe804('0x96')](_0x1bdc9a)){_0x205f1c=path[_0xe804('0x57')](_0xe804('0x97'),_0x41c716,_0x15ecda[0x0],_0x1bdc9a);}else{_0x205f1c=_0x1bdc9a;}}else{logger[_0xe804('0x6e')](_0xe804('0x99'));}}else if(_0x5a295b===_0xe804('0x8c')){_0x1b5c23=_0x364369[_0xe804('0x84')][_0xe804('0x8d')];_0x463381=_0x364369[_0xe804('0x84')][_0xe804('0x8f')];if(_0xe804('0x81')!=typeof _0x364369[_0xe804('0x84')][_0xe804('0x87')]){if('undefined'!=typeof _0x364369['parameters'][_0xe804('0x87')][_0xe804('0x89')]){var _0x1a01f3=_0x364369[_0xe804('0x84')]['views'][_0xe804('0x89')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1a01f3)){_0x524262=path[_0xe804('0x57')]('plugins',_0x41c716,_0x15ecda[0x0],_0x1a01f3);}else{_0x524262=_0x1a01f3;}}if(_0xe804('0x81')!=typeof _0x364369[_0xe804('0x84')]['views']['agent']){var _0x1bdc9a=_0x364369[_0xe804('0x84')]['views'][_0xe804('0x8a')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1bdc9a)){_0x205f1c=path[_0xe804('0x57')](_0xe804('0x97'),_0x41c716,_0x15ecda[0x0],_0x1bdc9a);}else{_0x205f1c=_0x1bdc9a;}}}}var _0x4b3a89={'name':_0x422abe,'description':_0x382345,'path':path['join'](_0x41c716,_0x15ecda[0x0]),'type':_0x5a295b,'sidebar':_0x4ffdb0,'icon':_0x2b6ed2,'adminUrl':_0x524262,'agentUrl':_0x205f1c,'scriptName':_0x1b5c23,'scriptPath':_0x463381,'version':_0x4a8bdd};removeReferences(_0x1976d6,null);return db[_0xe804('0x36')][_0xe804('0x9a')](_0x4b3a89)['then'](function(_0x3dde97){var _0x1daa62={'role':_0x2e09d8[_0xe804('0x9b')]['role'],'userProfileId':_0x2e09d8[_0xe804('0x9b')][_0xe804('0x9c')]};if(!_0x1daa62)throw new Error(_0xe804('0x9d'));if(_0x1daa62['role']==='user'){var _0x114762=_0x3dde97[_0xe804('0x2d')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xe804('0x2e'),'userProfileId':_0x1daa62['userProfileId']},'raw':!![]})[_0xe804('0x31')](function(_0x5e7416){if(_0x5e7416&&_0x5e7416[_0xe804('0x9e')]===0x0){return db[_0xe804('0x2f')][_0xe804('0x9a')]({'name':_0x114762[_0xe804('0x34')],'resourceId':_0x114762['id'],'type':_0x5e7416[_0xe804('0x34')],'sectionId':_0x5e7416['id']},{})[_0xe804('0x31')](function(){return _0x3dde97;});}else{return _0x3dde97;}})[_0xe804('0x55')](function(_0xb73180){logger[_0xe804('0x32')](_0xe804('0x9f'),_0xb73180);throw _0xb73180;});}return _0x3dde97;})[_0xe804('0x31')](respondWithResult(_0x12320c,null))['catch'](handleError(_0x12320c,null));}});}catch(_0x5e4304){_0x12320c[_0xe804('0x21')](0x1f4)[_0xe804('0xa0')](_0x5e4304);}};function removeReferences(_0x28253f,_0x156392){try{if(_0x28253f){fs[_0xe804('0xa1')](_0x28253f);logger[_0xe804('0x6e')]('Zip\x20archive\x20removed');}if(_0x156392){rimraf(_0x156392,function(){});logger[_0xe804('0x6e')](_0xe804('0xa2'));}}catch(_0x18068c){logger['error'](_0x18068c);}}exports[_0xe804('0x2c')]=function(_0xd4d052,_0x1abe9a,_0x1cd70f){return db[_0xe804('0x36')][_0xe804('0x54')]({'where':{'id':_0xd4d052[_0xe804('0x52')]['id']}})[_0xe804('0x31')](handleEntityNotFound(_0x1abe9a,null))[_0xe804('0x31')](saveUpdates(_0xd4d052[_0xe804('0x9b')],null))[_0xe804('0x31')](respondWithResult(_0x1abe9a,null))[_0xe804('0x55')](handleError(_0x1abe9a,null));};exports['delete']=function(_0x45d7a9,_0x34aa58,_0x455900){return db[_0xe804('0x36')][_0xe804('0x54')]({'where':{'id':_0x45d7a9['params']['id']}})['then'](function(_0x5a600e){if(_0x5a600e){return _0x5a600e['destroy']();}})[_0xe804('0x31')](function(_0x1286a8){rimraf(path[_0xe804('0x57')](config['root'],_0xe804('0x59'),path[_0xe804('0xa3')](_0x1286a8[_0xe804('0x56')])),function(){});return _0x1286a8;})['then'](handleEntityNotFound(_0x34aa58,null))[_0xe804('0x31')](respondWithStatusCode(_0x34aa58,null))[_0xe804('0x55')](handleError(_0x34aa58,null));};exports[_0xe804('0xa4')]=function(_0x3f080c,_0x160c39,_0x5c1235){return BPromise[_0xe804('0xa5')]()[_0xe804('0x31')](function(){if(!_0x3f080c['query']['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x3f080c[_0xe804('0x3d')][_0xe804('0xa6')]){throw new Error(_0xe804('0xa7'));}var _0x2cddcf=_0x3f080c[_0xe804('0x3d')][_0xe804('0xa8')]?_0x3f080c[_0xe804('0x3d')]['hostname']+':'+_0x3f080c[_0xe804('0x3d')][_0xe804('0xa6')]:'http://localhost:'+_0x3f080c['query'][_0xe804('0xa6')];var _0x5dfc2a=_0x3f080c[_0xe804('0x3d')][_0xe804('0x23')]?_0x3f080c[_0xe804('0x3d')][_0xe804('0x23')]:!![];var _0x25ade2=_0x3f080c[_0xe804('0x3d')]['encoding']?_0x3f080c[_0xe804('0x3d')][_0xe804('0xa9')]:null;var _0x333b09={'method':_0x3f080c['method'],'uri':util[_0xe804('0x5a')](_0xe804('0xaa'),_0x2cddcf,_0x3f080c[_0xe804('0x3d')]['path']),'json':_0x5dfc2a,'resolveWithFullResponse':!![],'encoding':_0x25ade2,'qs':_0x3f080c['query']};if(_0x3f080c[_0xe804('0xab')]){_0x333b09[_0xe804('0xab')]=_0x3f080c[_0xe804('0xab')];if(_0x333b09[_0xe804('0xab')][_0xe804('0xac')]){delete _0x333b09[_0xe804('0xab')][_0xe804('0xac')];}}if(_0x333b09['headers']['content-type']){delete _0x333b09[_0xe804('0xab')][_0xe804('0xad')];}return rp(_0x333b09);})[_0xe804('0x31')](function(_0x3f3174){if(_0x3f3174){_0x160c39[_0xe804('0x27')](_0x3f3174['headers']);logger[_0xe804('0x6e')](_0x3f3174[_0xe804('0x9b')]);if(_['endsWith'](_0x3f080c[_0xe804('0x3d')]['path'],_0xe804('0x6c'))&&_0x3f3174[_0xe804('0xae')]==0x1f4){return _0x160c39[_0xe804('0x20')](_0x3f3174[_0xe804('0xae')]);}else{return _0x160c39[_0xe804('0x21')](_0x3f3174[_0xe804('0xae')])[_0xe804('0xa0')](_0x3f3174[_0xe804('0x9b')]);}}else{return _0x160c39['sendStatus'](0xc8);}})['catch'](handleError(_0x160c39,null));};exports[_0xe804('0xaf')]=function(_0x1395b9,_0x36654c,_0x510181){return BPromise[_0xe804('0xa5')]()[_0xe804('0x31')](function(){if(!_0x1395b9[_0xe804('0x3d')][_0xe804('0x56')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x1395b9['query']['port']){throw new Error(_0xe804('0xa7'));}var _0x526df0=_0x1395b9[_0xe804('0x3d')][_0xe804('0xa8')]?_0x1395b9[_0xe804('0x3d')][_0xe804('0xa8')]+':'+_0x1395b9[_0xe804('0x3d')][_0xe804('0xa6')]:_0xe804('0xb0')+_0x1395b9[_0xe804('0x3d')][_0xe804('0xa6')];var _0x1787cd=_0x1395b9[_0xe804('0x3d')][_0xe804('0x23')]?_0x1395b9[_0xe804('0x3d')]['json']:!![];var _0x4fb9f6=_0x1395b9[_0xe804('0x3d')][_0xe804('0xa9')]?_0x1395b9[_0xe804('0x3d')]['encoding']:null;var _0x29bde1={'method':_0x1395b9[_0xe804('0xb1')],'uri':util[_0xe804('0x5a')]('%s%s',_0x526df0,_0x1395b9[_0xe804('0x3d')]['path']),'json':_0x1787cd,'resolveWithFullResponse':!![],'encoding':_0x4fb9f6,'body':_0x1395b9['body']};if(_0x1395b9[_0xe804('0xab')]){_0x29bde1[_0xe804('0xab')]=_0x1395b9[_0xe804('0xab')];if(_0x29bde1['headers'][_0xe804('0xac')]){delete _0x29bde1['headers']['content-length'];}}if(_0x29bde1['headers'][_0xe804('0xad')]){delete _0x29bde1['headers']['content-type'];}return rp(_0x29bde1);})[_0xe804('0x31')](function(_0x451b28){if(_0x451b28){_0x36654c[_0xe804('0x27')](_0x451b28[_0xe804('0xab')]);logger['info'](_0x451b28[_0xe804('0x9b')]);return _0x36654c[_0xe804('0x21')](_0x451b28[_0xe804('0xae')])[_0xe804('0xa0')](_0x451b28[_0xe804('0x9b')]);}else{return _0x36654c[_0xe804('0x20')](0xc8);}})[_0xe804('0x55')](handleError(_0x36654c,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 4dd8aff..281a337 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 _0x056b=['hook','exports','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2c4e1b,_0x48a2dc){var _0x335117=function(_0x3cac61){while(--_0x3cac61){_0x2c4e1b['push'](_0x2c4e1b['shift']());}};_0x335117(++_0x48a2dc);}(_0x056b,0xb6));var _0xb056=function(_0x335d8e,_0x966e53){_0x335d8e=_0x335d8e-0x0;var _0xf17970=_0x056b[_0x335d8e];return _0xf17970;};'use strict';var EventEmitter=require('events');var Plugin=require(_0xb056('0x0'))['db'][_0xb056('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xb056('0x2')](0x0);var events={'afterCreate':_0xb056('0x3'),'afterUpdate':_0xb056('0x4'),'afterDestroy':_0xb056('0x5')};function emitEvent(_0x36c992){return function(_0x4157e0,_0x343d88,_0x2ff09d){PluginEvents[_0xb056('0x6')](_0x36c992+':'+_0x4157e0['id'],_0x4157e0);PluginEvents['emit'](_0x36c992,_0x4157e0);_0x2ff09d(null);};}for(var e in events){if(events[_0xb056('0x7')](e)){var event=events[e];Plugin[_0xb056('0x8')](e,emitEvent(event));}}module[_0xb056('0x9')]=PluginEvents; \ No newline at end of file +var _0x68b3=['hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x48cac2,_0x483396){var _0xd2a59e=function(_0xbdac60){while(--_0xbdac60){_0x48cac2['push'](_0x48cac2['shift']());}};_0xd2a59e(++_0x483396);}(_0x68b3,0x1d8));var _0x368b=function(_0x575cc5,_0x350b68){_0x575cc5=_0x575cc5-0x0;var _0x5f4013=_0x68b3[_0x575cc5];return _0x5f4013;};'use strict';var EventEmitter=require(_0x368b('0x0'));var Plugin=require(_0x368b('0x1'))['db'][_0x368b('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x368b('0x3')](0x0);var events={'afterCreate':_0x368b('0x4'),'afterUpdate':'update','afterDestroy':_0x368b('0x5')};function emitEvent(_0x3325ac){return function(_0xc40116,_0x404282,_0x5d68cb){PluginEvents[_0x368b('0x6')](_0x3325ac+':'+_0xc40116['id'],_0xc40116);PluginEvents[_0x368b('0x6')](_0x3325ac,_0xc40116);_0x5d68cb(null);};}for(var e in events){if(events[_0x368b('0x7')](e)){var event=events[e];Plugin[_0x368b('0x8')](e,emitEvent(event));}}module[_0x368b('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 0fff534..0f98192 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 _0x1e63=['define','plugins','lodash','util','moment','bluebird','rimraf','../../config/environment','./plugin.attributes','exports'];(function(_0x18285f,_0x40b319){var _0x28f3a6=function(_0x3aed0b){while(--_0x3aed0b){_0x18285f['push'](_0x18285f['shift']());}};_0x28f3a6(++_0x40b319);}(_0x1e63,0xa2));var _0x31e6=function(_0x593229,_0x21a814){_0x593229=_0x593229-0x0;var _0x4f6910=_0x1e63[_0x593229];return _0x4f6910;};'use strict';var _=require(_0x31e6('0x0'));var util=require(_0x31e6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x31e6('0x2'));var BPromise=require(_0x31e6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x31e6('0x4'));var config=require(_0x31e6('0x5'));var attributes=require(_0x31e6('0x6'));module[_0x31e6('0x7')]=function(_0x301f32,_0x13fa46){return _0x301f32[_0x31e6('0x8')]('Plugin',attributes,{'tableName':_0x31e6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe602=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin'];(function(_0x4aa741,_0x5134c1){var _0x272370=function(_0x1aa778){while(--_0x1aa778){_0x4aa741['push'](_0x4aa741['shift']());}};_0x272370(++_0x5134c1);}(_0xe602,0xa5));var _0x2e60=function(_0x2466c3,_0x20eb50){_0x2466c3=_0x2466c3-0x0;var _0x3ff6f1=_0xe602[_0x2466c3];return _0x3ff6f1;};'use strict';var _=require('lodash');var util=require(_0x2e60('0x0'));var logger=require(_0x2e60('0x1'))('api');var moment=require(_0x2e60('0x2'));var BPromise=require(_0x2e60('0x3'));var rp=require(_0x2e60('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e60('0x5'));var config=require(_0x2e60('0x6'));var attributes=require(_0x2e60('0x7'));module[_0x2e60('0x8')]=function(_0x5dddf7,_0x28a34b){return _0x5dddf7[_0x2e60('0x9')](_0x2e60('0xa'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index c002918..661dec2 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 _0xe5e3=['options','raw','then','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./plugin.socket','request','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreatePlugin','body'];(function(_0x41a7cb,_0x638f9c){var _0x4a644c=function(_0x31f6b2){while(--_0x31f6b2){_0x41a7cb['push'](_0x41a7cb['shift']());}};_0x4a644c(++_0x638f9c);}(_0xe5e3,0x9f));var _0x3e5e=function(_0x4514bb,_0x46b580){_0x4514bb=_0x4514bb-0x0;var _0x2282a0=_0xe5e3[_0x4514bb];return _0x2282a0;};'use strict';var _=require('lodash');var util=require(_0x3e5e('0x0'));var moment=require(_0x3e5e('0x1'));var BPromise=require(_0x3e5e('0x2'));var rs=require(_0x3e5e('0x3'));var fs=require('fs');var Redis=require(_0x3e5e('0x4'));var db=require(_0x3e5e('0x5'))['db'];var utils=require(_0x3e5e('0x6'));var logger=require(_0x3e5e('0x7'))(_0x3e5e('0x8'));var config=require(_0x3e5e('0x9'));var jayson=require(_0x3e5e('0xa'));var client=jayson[_0x3e5e('0xb')]['http']({'port':0x232a});config[_0x3e5e('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3e5e('0xd'))(new Redis(config[_0x3e5e('0xc')]));require(_0x3e5e('0xe'))['register'](socket);function respondWithRpcPromise(_0x337a67,_0x50a824,_0x170193){return new BPromise(function(_0x2bdadc,_0x5bc039){return client[_0x3e5e('0xf')](_0x337a67,_0x170193)['then'](function(_0x346f72){logger[_0x3e5e('0x10')](_0x3e5e('0x11'),_0x50a824,_0x3e5e('0x12'));logger['debug'](_0x3e5e('0x13'),_0x50a824,_0x3e5e('0x12'),JSON[_0x3e5e('0x14')](_0x346f72));if(_0x346f72[_0x3e5e('0x15')]){if(_0x346f72[_0x3e5e('0x15')]['code']===0x1f4){logger[_0x3e5e('0x15')](_0x3e5e('0x11'),_0x50a824,_0x346f72[_0x3e5e('0x15')][_0x3e5e('0x16')]);return _0x5bc039(_0x346f72['error']['message']);}logger[_0x3e5e('0x15')]('Plugin,\x20%s,\x20%s',_0x50a824,_0x346f72[_0x3e5e('0x15')][_0x3e5e('0x16')]);return _0x2bdadc(_0x346f72[_0x3e5e('0x15')][_0x3e5e('0x16')]);}else{logger[_0x3e5e('0x10')]('Plugin,\x20%s,\x20%s',_0x50a824,_0x3e5e('0x12'));_0x2bdadc(_0x346f72[_0x3e5e('0x17')][_0x3e5e('0x16')]);}})[_0x3e5e('0x18')](function(_0x3e2edf){logger[_0x3e5e('0x15')](_0x3e5e('0x11'),_0x50a824,_0x3e2edf);_0x5bc039(_0x3e2edf);});});}exports[_0x3e5e('0x19')]=function(_0x59cfb9){var _0xbe974e=this;return new Promise(function(_0x3df26f,_0x30e745){return db['Plugin']['create'](_0x59cfb9[_0x3e5e('0x1a')],{'raw':_0x59cfb9['options']?_0x59cfb9[_0x3e5e('0x1b')][_0x3e5e('0x1c')]===undefined?!![]:![]:!![]})[_0x3e5e('0x1d')](function(_0x61b9d2){logger[_0x3e5e('0x10')](_0x3e5e('0x19'),_0x59cfb9);logger[_0x3e5e('0x1e')]('CreatePlugin',_0x59cfb9,JSON[_0x3e5e('0x14')](_0x61b9d2));_0x3df26f(_0x61b9d2);})['catch'](function(_0x65a6db){logger['error'](_0x3e5e('0x19'),_0x65a6db[_0x3e5e('0x16')],_0x59cfb9);_0x30e745(_0xbe974e['error'](0x1f4,_0x65a6db[_0x3e5e('0x16')]));});});}; \ No newline at end of file +var _0xa35b=['Plugin,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','create','body','options','then','CreatePlugin','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./plugin.socket','request','info'];(function(_0x2c992d,_0x338f90){var _0xa47a5b=function(_0x2b7eb7){while(--_0x2b7eb7){_0x2c992d['push'](_0x2c992d['shift']());}};_0xa47a5b(++_0x338f90);}(_0xa35b,0x1ed));var _0xba35=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa35b[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xba35('0x0'));var util=require(_0xba35('0x1'));var moment=require('moment');var BPromise=require(_0xba35('0x2'));var rs=require(_0xba35('0x3'));var fs=require('fs');var Redis=require(_0xba35('0x4'));var db=require(_0xba35('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xba35('0x6'))(_0xba35('0x7'));var config=require(_0xba35('0x8'));var jayson=require(_0xba35('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xba35('0xa')]=_[_0xba35('0xb')](config[_0xba35('0xa')],{'host':_0xba35('0xc'),'port':0x18eb});var socket=require(_0xba35('0xd'))(new Redis(config['redis']));require(_0xba35('0xe'))['register'](socket);function respondWithRpcPromise(_0x3aac9b,_0x54d8e1,_0x203aa7){return new BPromise(function(_0xb6ddc6,_0x31bc10){return client[_0xba35('0xf')](_0x3aac9b,_0x203aa7)['then'](function(_0x1327ff){logger[_0xba35('0x10')](_0xba35('0x11'),_0x54d8e1,'request\x20sent');logger[_0xba35('0x12')]('Plugin,\x20%s,\x20%s,\x20%s',_0x54d8e1,'request\x20sent',JSON[_0xba35('0x13')](_0x1327ff));if(_0x1327ff[_0xba35('0x14')]){if(_0x1327ff[_0xba35('0x14')]['code']===0x1f4){logger['error'](_0xba35('0x11'),_0x54d8e1,_0x1327ff[_0xba35('0x14')][_0xba35('0x15')]);return _0x31bc10(_0x1327ff[_0xba35('0x14')]['message']);}logger['error'](_0xba35('0x11'),_0x54d8e1,_0x1327ff[_0xba35('0x14')][_0xba35('0x15')]);return _0xb6ddc6(_0x1327ff[_0xba35('0x14')][_0xba35('0x15')]);}else{logger['info'](_0xba35('0x11'),_0x54d8e1,_0xba35('0x16'));_0xb6ddc6(_0x1327ff[_0xba35('0x17')][_0xba35('0x15')]);}})['catch'](function(_0x435956){logger[_0xba35('0x14')](_0xba35('0x11'),_0x54d8e1,_0x435956);_0x31bc10(_0x435956);});});}exports['CreatePlugin']=function(_0x3f6979){var _0x20d50d=this;return new Promise(function(_0x2ddf21,_0x3a69e6){return db['Plugin'][_0xba35('0x18')](_0x3f6979[_0xba35('0x19')],{'raw':_0x3f6979[_0xba35('0x1a')]?_0x3f6979['options']['raw']===undefined?!![]:![]:!![]})[_0xba35('0x1b')](function(_0x5215b5){logger[_0xba35('0x10')](_0xba35('0x1c'),_0x3f6979);logger[_0xba35('0x12')](_0xba35('0x1c'),_0x3f6979,JSON[_0xba35('0x13')](_0x5215b5));_0x2ddf21(_0x5215b5);})[_0xba35('0x1d')](function(_0x4fa2fc){logger[_0xba35('0x14')](_0xba35('0x1c'),_0x4fa2fc['message'],_0x3f6979);_0x3a69e6(_0x20d50d[_0xba35('0x14')](0x1f4,_0x4fa2fc['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index b0a030e..422442f 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 _0xbd2c=['save','remove','removeListener','register','plugin:','./plugin.events'];(function(_0x3e8ded,_0x4d3e3b){var _0x49181c=function(_0x298c4a){while(--_0x298c4a){_0x3e8ded['push'](_0x3e8ded['shift']());}};_0x49181c(++_0x4d3e3b);}(_0xbd2c,0x173));var _0xcbd2=function(_0x143c7e,_0x53d8f8){_0x143c7e=_0x143c7e-0x0;var _0x204fad=_0xbd2c[_0x143c7e];return _0x204fad;};'use strict';var PluginEvents=require(_0xcbd2('0x0'));var events=[_0xcbd2('0x1'),_0xcbd2('0x2'),'update'];function createListener(_0x3e1711,_0xd92bec){return function(_0x3015a0){_0xd92bec['emit'](_0x3e1711,_0x3015a0);};}function removeListener(_0x1378d4,_0xb2d008){return function(){PluginEvents[_0xcbd2('0x3')](_0x1378d4,_0xb2d008);};}exports[_0xcbd2('0x4')]=function(_0x2e079f){for(var _0x4e94cb=0x0,_0x4f4d62=events['length'];_0x4e94cb<_0x4f4d62;_0x4e94cb++){var _0xfd8d3a=events[_0x4e94cb];var _0x50f216=createListener(_0xcbd2('0x5')+_0xfd8d3a,_0x2e079f);PluginEvents['on'](_0xfd8d3a,_0x50f216);}}; \ No newline at end of file +var _0xdaa8=['removeListener','register','length','plugin:','./plugin.events','save','remove','update'];(function(_0x4e3e7c,_0x2e090e){var _0x3a94a9=function(_0x292f07){while(--_0x292f07){_0x4e3e7c['push'](_0x4e3e7c['shift']());}};_0x3a94a9(++_0x2e090e);}(_0xdaa8,0xe4));var _0x8daa=function(_0x41e1c0,_0x2172aa){_0x41e1c0=_0x41e1c0-0x0;var _0x581cbd=_0xdaa8[_0x41e1c0];return _0x581cbd;};'use strict';var PluginEvents=require(_0x8daa('0x0'));var events=[_0x8daa('0x1'),_0x8daa('0x2'),_0x8daa('0x3')];function createListener(_0x5a8862,_0x4ce1a9){return function(_0x58f7c0){_0x4ce1a9['emit'](_0x5a8862,_0x58f7c0);};}function removeListener(_0x4d1f23,_0x576670){return function(){PluginEvents[_0x8daa('0x4')](_0x4d1f23,_0x576670);};}exports[_0x8daa('0x5')]=function(_0x46f753){for(var _0x4d2392=0x0,_0x4e8116=events[_0x8daa('0x6')];_0x4d2392<_0x4e8116;_0x4d2392++){var _0x48bf41=events[_0x4d2392];var _0x41de3e=createListener(_0x8daa('0x7')+_0x48bf41,_0x46f753);PluginEvents['on'](_0x48bf41,_0x41de3e);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 9780839..a26a56b 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 _0x34c0=['post','create','put','update','delete','destroy','exports','express','Router','../../components/auth/service','./pm2.controller','get','/:id','isAuthenticated','show'];(function(_0x568bd7,_0x23eea6){var _0x203cda=function(_0x26d94f){while(--_0x26d94f){_0x568bd7['push'](_0x568bd7['shift']());}};_0x203cda(++_0x23eea6);}(_0x34c0,0x19c));var _0x034c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x34c0[_0x321bb2];return _0x9c12ed;};'use strict';var express=require(_0x034c('0x0'));var router=express[_0x034c('0x1')]();var auth=require(_0x034c('0x2'));var controller=require(_0x034c('0x3'));router[_0x034c('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0x034c('0x4')](_0x034c('0x5'),auth[_0x034c('0x6')](),controller[_0x034c('0x7')]);router[_0x034c('0x8')]('/',auth[_0x034c('0x6')](),controller[_0x034c('0x9')]);router[_0x034c('0xa')](_0x034c('0x5'),auth['isAuthenticated'](),controller[_0x034c('0xb')]);router[_0x034c('0xc')]('/:id',auth[_0x034c('0x6')](),controller[_0x034c('0xd')]);module[_0x034c('0xe')]=router; \ No newline at end of file +var _0x39f7=['put','update','destroy','exports','Router','../../components/auth/service','./pm2.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x39f7,0x170));var _0x739f=function(_0x1b3564,_0x16c919){_0x1b3564=_0x1b3564-0x0;var _0x504069=_0x39f7[_0x1b3564];return _0x504069;};'use strict';var express=require('express');var router=express[_0x739f('0x0')]();var auth=require(_0x739f('0x1'));var controller=require(_0x739f('0x2'));router[_0x739f('0x3')]('/',auth[_0x739f('0x4')](),controller[_0x739f('0x5')]);router[_0x739f('0x3')](_0x739f('0x6'),auth[_0x739f('0x4')](),controller[_0x739f('0x7')]);router['post']('/',auth[_0x739f('0x4')](),controller[_0x739f('0x8')]);router[_0x739f('0x9')]('/:id',auth[_0x739f('0x4')](),controller[_0x739f('0xa')]);router['delete'](_0x739f('0x6'),auth[_0x739f('0x4')](),controller[_0x739f('0xb')]);module[_0x739f('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 5a0a826..ebd1977 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 _0x9b7f=['script','join','../../files/plugins','cwd','chdir','dirname','send','update','restart','stop','Unknown\x20status','dump','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','child_process','exec','bluebird','sendStatus','status','json','error','name','npm\x20install','info','index','list','then','reject','motion2','length','catch','show','describe','params','create','body'];(function(_0x474e53,_0xb1f451){var _0x452274=function(_0x47f167){while(--_0x47f167){_0x474e53['push'](_0x474e53['shift']());}};_0x452274(++_0xb1f451);}(_0x9b7f,0x11e));var _0xf9b7=function(_0x39713f,_0x3991c7){_0x39713f=_0x39713f-0x0;var _0x137d42=_0x9b7f[_0x39713f];return _0x137d42;};'use strict';var _=require(_0xf9b7('0x0'));var pm2=require(_0xf9b7('0x1'));var logger=require(_0xf9b7('0x2'))(_0xf9b7('0x3'));var path=require('path');var exec=require(_0xf9b7('0x4'))[_0xf9b7('0x5')];var BPromise=require(_0xf9b7('0x6'));function handleEntityNotFound(_0x11fb8d,_0x1feb7b){return function(_0xe04988){if(!_0xe04988){_0x11fb8d[_0xf9b7('0x7')](0x194);;}return _0xe04988;};}function respondWithResult(_0x189650,_0x5ff20b){_0x5ff20b=_0x5ff20b||0xc8;return function(_0x3fdfff){if(_0x3fdfff){return _0x189650[_0xf9b7('0x8')](_0x5ff20b)[_0xf9b7('0x9')](_0x3fdfff);}return null;};}function handleError(_0x392a93,_0x42c6c1){_0x42c6c1=_0x42c6c1||0x1f4;return function(_0x3eebb3){logger[_0xf9b7('0xa')](_0x3eebb3['stack']);if(_0x3eebb3[_0xf9b7('0xb')]){delete _0x3eebb3[_0xf9b7('0xb')];}_0x392a93[_0xf9b7('0x8')](_0x42c6c1)['send'](_0x3eebb3);};}function execChildProcess(){return new BPromise(function(_0x4cd66f,_0x7ff093){exec(_0xf9b7('0xc'),function(_0x486bdd,_0x47ac2e,_0x1b6625){logger[_0xf9b7('0xd')](_0x47ac2e);logger[_0xf9b7('0xd')](_0x1b6625);if(_0x486bdd){logger[_0xf9b7('0xa')](_0x486bdd);return _0x7ff093(_0x486bdd);}return _0x4cd66f(_0x47ac2e);});});}exports[_0xf9b7('0xe')]=function(_0x3b2732,_0x541ef8){return pm2[_0xf9b7('0xf')]()[_0xf9b7('0x10')](function(_0x35f576){if(_0x35f576){var _0x2816b2=_[_0xf9b7('0x11')](_0x35f576,function(_0x59604f){return _0x59604f[_0xf9b7('0xb')]==='express'||_0x59604f[_0xf9b7('0xb')]===_0xf9b7('0x12');});return{'rows':_0x2816b2,'count':_0x2816b2[_0xf9b7('0x13')]};}return null;})[_0xf9b7('0x10')](respondWithResult(_0x541ef8,null))[_0xf9b7('0x14')](handleError(_0x541ef8,null));};exports[_0xf9b7('0x15')]=function(_0x23c721,_0x57c92c){return pm2[_0xf9b7('0x16')](_0x23c721[_0xf9b7('0x17')]['id'])[_0xf9b7('0x10')](respondWithResult(_0x57c92c,null))['then'](handleEntityNotFound(_0x57c92c,null))['catch'](handleError(_0x57c92c,null));};exports[_0xf9b7('0x18')]=function(_0x59fbe7,_0x5ab61c){if(_0x59fbe7[_0xf9b7('0x19')][_0xf9b7('0xb')]&&_0x59fbe7[_0xf9b7('0x19')][_0xf9b7('0x1a')]){var _0x11b062=path[_0xf9b7('0x1b')](__dirname,_0xf9b7('0x1c'),_0x59fbe7[_0xf9b7('0x19')][_0xf9b7('0x1a')]);var _0xa9c0d8=process[_0xf9b7('0x1d')]();process[_0xf9b7('0x1e')](path[_0xf9b7('0x1f')](_0x11b062));return execChildProcess()[_0xf9b7('0x10')](function(_0x42c26f){process[_0xf9b7('0x1e')](_0xa9c0d8);return pm2['start']({'name':_0x59fbe7[_0xf9b7('0x19')][_0xf9b7('0xb')],'script':_0x11b062});})[_0xf9b7('0x10')](function(_0x215c12){pm2['dump']();return _0x215c12[0x0];})[_0xf9b7('0x10')](respondWithResult(_0x5ab61c,0xc9))[_0xf9b7('0x14')](handleError(_0x5ab61c,null));}else{return _0x5ab61c['status'](0x1f4)[_0xf9b7('0x20')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xf9b7('0x21')]=function(_0x187061,_0x2f3959){if(_0x187061[_0xf9b7('0x19')]['id']){delete _0x187061['body']['id'];}var _0x21c771={'online':_0xf9b7('0x22'),'stopped':_0xf9b7('0x23')};if(_0x21c771['hasOwnProperty'](_0x187061[_0xf9b7('0x19')][_0xf9b7('0x8')])){return pm2[_0x21c771[_0x187061[_0xf9b7('0x19')][_0xf9b7('0x8')]]](_0x187061[_0xf9b7('0x17')]['id'])[_0xf9b7('0x10')](respondWithResult(_0x2f3959,0xc8))[_0xf9b7('0x14')](handleError(_0x2f3959,null));}else{return _0x2f3959[_0xf9b7('0x8')](0x1f4)[_0xf9b7('0x20')]({'message':_0xf9b7('0x24')});}};exports['destroy']=function(_0x48b155,_0x52348c){if(_0x48b155['body']['id']){delete _0x48b155[_0xf9b7('0x19')]['id'];}if(_0x48b155['params']['id']){return pm2['delete'](_0x48b155[_0xf9b7('0x17')]['id'])['then'](function(_0x355659){pm2[_0xf9b7('0x25')]();return _0x355659[0x0];})[_0xf9b7('0x10')](respondWithResult(_0x52348c,null))[_0xf9b7('0x14')](handleError(_0x52348c,null));}else{return _0x52348c[_0xf9b7('0x8')](0x1f4)[_0xf9b7('0x20')]({'message':_0xf9b7('0x26')});}}; \ No newline at end of file +var _0x5abf=['script','join','../../files/plugins','cwd','chdir','dump','Missing\x20name\x20and/or\x20path','stop','params','send','lodash','../../config/pm2','api','path','child_process','bluebird','sendStatus','status','json','error','stack','npm\x20install','info','index','list','reject','name','motion2','length','then','catch','show','describe','create','body'];(function(_0x2a7e04,_0x5369d7){var _0xd2c915=function(_0x9daa1c){while(--_0x9daa1c){_0x2a7e04['push'](_0x2a7e04['shift']());}};_0xd2c915(++_0x5369d7);}(_0x5abf,0x1d1));var _0xf5ab=function(_0xd3d5c3,_0x42d2af){_0xd3d5c3=_0xd3d5c3-0x0;var _0x29a808=_0x5abf[_0xd3d5c3];return _0x29a808;};'use strict';var _=require(_0xf5ab('0x0'));var pm2=require(_0xf5ab('0x1'));var logger=require('../../config/logger')(_0xf5ab('0x2'));var path=require(_0xf5ab('0x3'));var exec=require(_0xf5ab('0x4'))['exec'];var BPromise=require(_0xf5ab('0x5'));function handleEntityNotFound(_0x46e76c,_0x2caaac){return function(_0x2d852e){if(!_0x2d852e){_0x46e76c[_0xf5ab('0x6')](0x194);;}return _0x2d852e;};}function respondWithResult(_0x43c723,_0x229e35){_0x229e35=_0x229e35||0xc8;return function(_0xa91d27){if(_0xa91d27){return _0x43c723[_0xf5ab('0x7')](_0x229e35)[_0xf5ab('0x8')](_0xa91d27);}return null;};}function handleError(_0x46dc38,_0x40ea75){_0x40ea75=_0x40ea75||0x1f4;return function(_0x6b991){logger[_0xf5ab('0x9')](_0x6b991[_0xf5ab('0xa')]);if(_0x6b991['name']){delete _0x6b991['name'];}_0x46dc38[_0xf5ab('0x7')](_0x40ea75)['send'](_0x6b991);};}function execChildProcess(){return new BPromise(function(_0x424074,_0x276fe1){exec(_0xf5ab('0xb'),function(_0x9b03cd,_0x1dbbd4,_0x5b74e0){logger[_0xf5ab('0xc')](_0x1dbbd4);logger[_0xf5ab('0xc')](_0x5b74e0);if(_0x9b03cd){logger['error'](_0x9b03cd);return _0x276fe1(_0x9b03cd);}return _0x424074(_0x1dbbd4);});});}exports[_0xf5ab('0xd')]=function(_0x24e185,_0x5b65af){return pm2[_0xf5ab('0xe')]()['then'](function(_0x163dd4){if(_0x163dd4){var _0x5e4274=_[_0xf5ab('0xf')](_0x163dd4,function(_0x433584){return _0x433584[_0xf5ab('0x10')]==='express'||_0x433584[_0xf5ab('0x10')]===_0xf5ab('0x11');});return{'rows':_0x5e4274,'count':_0x5e4274[_0xf5ab('0x12')]};}return null;})[_0xf5ab('0x13')](respondWithResult(_0x5b65af,null))[_0xf5ab('0x14')](handleError(_0x5b65af,null));};exports[_0xf5ab('0x15')]=function(_0xd2316a,_0x2ecb3c){return pm2[_0xf5ab('0x16')](_0xd2316a['params']['id'])[_0xf5ab('0x13')](respondWithResult(_0x2ecb3c,null))[_0xf5ab('0x13')](handleEntityNotFound(_0x2ecb3c,null))['catch'](handleError(_0x2ecb3c,null));};exports[_0xf5ab('0x17')]=function(_0x569bc1,_0x13a381){if(_0x569bc1['body'][_0xf5ab('0x10')]&&_0x569bc1[_0xf5ab('0x18')][_0xf5ab('0x19')]){var _0x313db5=path[_0xf5ab('0x1a')](__dirname,_0xf5ab('0x1b'),_0x569bc1[_0xf5ab('0x18')]['script']);var _0x581ad5=process[_0xf5ab('0x1c')]();process[_0xf5ab('0x1d')](path['dirname'](_0x313db5));return execChildProcess()['then'](function(_0x161fd2){process['chdir'](_0x581ad5);return pm2['start']({'name':_0x569bc1[_0xf5ab('0x18')][_0xf5ab('0x10')],'script':_0x313db5});})[_0xf5ab('0x13')](function(_0x238665){pm2[_0xf5ab('0x1e')]();return _0x238665[0x0];})[_0xf5ab('0x13')](respondWithResult(_0x13a381,0xc9))[_0xf5ab('0x14')](handleError(_0x13a381,null));}else{return _0x13a381[_0xf5ab('0x7')](0x1f4)['send']({'message':_0xf5ab('0x1f')});}};exports['update']=function(_0x424a9,_0x20b265){if(_0x424a9[_0xf5ab('0x18')]['id']){delete _0x424a9['body']['id'];}var _0x3fd1ef={'online':'restart','stopped':_0xf5ab('0x20')};if(_0x3fd1ef['hasOwnProperty'](_0x424a9[_0xf5ab('0x18')][_0xf5ab('0x7')])){return pm2[_0x3fd1ef[_0x424a9[_0xf5ab('0x18')][_0xf5ab('0x7')]]](_0x424a9[_0xf5ab('0x21')]['id'])[_0xf5ab('0x13')](respondWithResult(_0x20b265,0xc8))[_0xf5ab('0x14')](handleError(_0x20b265,null));}else{return _0x20b265[_0xf5ab('0x7')](0x1f4)[_0xf5ab('0x22')]({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x758baa,_0x1b26d9){if(_0x758baa['body']['id']){delete _0x758baa[_0xf5ab('0x18')]['id'];}if(_0x758baa[_0xf5ab('0x21')]['id']){return pm2['delete'](_0x758baa[_0xf5ab('0x21')]['id'])[_0xf5ab('0x13')](function(_0x2fb549){pm2[_0xf5ab('0x1e')]();return _0x2fb549[0x0];})[_0xf5ab('0x13')](respondWithResult(_0x1b26d9,null))[_0xf5ab('0x14')](handleError(_0x1b26d9,null));}else{return _0x1b26d9[_0xf5ab('0x7')](0x1f4)[_0xf5ab('0x22')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 4684278..09e806e 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 _0x6b1d=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports','multer','path'];(function(_0x35218e,_0x14b249){var _0x267e04=function(_0x3a4ae2){while(--_0x3a4ae2){_0x35218e['push'](_0x35218e['shift']());}};_0x267e04(++_0x14b249);}(_0x6b1d,0xc6));var _0xd6b1=function(_0x8c8176,_0x5360a1){_0x8c8176=_0x8c8176-0x0;var _0x4dc47b=_0x6b1d[_0x8c8176];return _0x4dc47b;};'use strict';var multer=require(_0xd6b1('0x0'));var util=require('util');var path=require(_0xd6b1('0x1'));var timeout=require(_0xd6b1('0x2'));var express=require(_0xd6b1('0x3'));var router=express[_0xd6b1('0x4')]();var auth=require(_0xd6b1('0x5'));var interaction=require(_0xd6b1('0x6'));var config=require('../../config/environment');module[_0xd6b1('0x7')]=router; \ No newline at end of file +var _0xf336=['../../config/environment','exports','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x21ca83,_0x468424){var _0x56d4bb=function(_0x43e25e){while(--_0x43e25e){_0x21ca83['push'](_0x21ca83['shift']());}};_0x56d4bb(++_0x468424);}(_0xf336,0xf2));var _0x6f33=function(_0x5c87d7,_0xc786e0){_0x5c87d7=_0x5c87d7-0x0;var _0xf9533a=_0xf336[_0x5c87d7];return _0xf9533a;};'use strict';var multer=require('multer');var util=require(_0x6f33('0x0'));var path=require(_0x6f33('0x1'));var timeout=require(_0x6f33('0x2'));var express=require(_0x6f33('0x3'));var router=express[_0x6f33('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6f33('0x5'));var config=require(_0x6f33('0x6'));module[_0x6f33('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 5b6594e..c128d81 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 _0xcf54=['STRING','sequelize','exports','DATE'];(function(_0x90604a,_0x478069){var _0x5b517b=function(_0x475f05){while(--_0x475f05){_0x90604a['push'](_0x90604a['shift']());}};_0x5b517b(++_0x478069);}(_0xcf54,0x1d9));var _0x4cf5=function(_0x9d14e3,_0x5a6072){_0x9d14e3=_0x9d14e3-0x0;var _0x19bf32=_0xcf54[_0x9d14e3];return _0x19bf32;};'use strict';var Sequelize=require(_0x4cf5('0x0'));module[_0x4cf5('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x4cf5('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x4cf5('0x2')]},'responsetime':{'type':Sequelize[_0x4cf5('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x4cf5('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4cf5('0x3')]}}; \ No newline at end of file +var _0x89e7=['exports','STRING','DATE','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x89e7,0x144));var _0x789e=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x89e7[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require(_0x789e('0x0'));module[_0x789e('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x789e('0x2')]},'starttime':{'type':Sequelize[_0x789e('0x3')]},'responsetime':{'type':Sequelize[_0x789e('0x3')]},'ringtime':{'type':Sequelize[_0x789e('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x789e('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 8b3feb6..962495f 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 _0xe29e=['bluebird','request-promise','./reportAgentPreview.attributes','define','ReportAgentPreview','report_agent_preview','lodash','util','api','moment'];(function(_0x368c4b,_0xe6be70){var _0x7b373f=function(_0x161e1b){while(--_0x161e1b){_0x368c4b['push'](_0x368c4b['shift']());}};_0x7b373f(++_0xe6be70);}(_0xe29e,0x114));var _0xee29=function(_0x4d6cf2,_0xff7e9){_0x4d6cf2=_0x4d6cf2-0x0;var _0x1546a6=_0xe29e[_0x4d6cf2];return _0x1546a6;};'use strict';var _=require(_0xee29('0x0'));var util=require(_0xee29('0x1'));var logger=require('../../config/logger')(_0xee29('0x2'));var moment=require(_0xee29('0x3'));var BPromise=require(_0xee29('0x4'));var rp=require(_0xee29('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xee29('0x6'));module['exports']=function(_0x72198a,_0x19ec90){return _0x72198a[_0xee29('0x7')](_0xee29('0x8'),attributes,{'tableName':_0xee29('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9453=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./reportAgentPreview.attributes','exports','define'];(function(_0x24b245,_0x1b3508){var _0x56f828=function(_0x21752a){while(--_0x21752a){_0x24b245['push'](_0x24b245['shift']());}};_0x56f828(++_0x1b3508);}(_0x9453,0x1a2));var _0x3945=function(_0x12e86d,_0x49f172){_0x12e86d=_0x12e86d-0x0;var _0x412550=_0x9453[_0x12e86d];return _0x412550;};'use strict';var _=require(_0x3945('0x0'));var util=require(_0x3945('0x1'));var logger=require('../../config/logger')(_0x3945('0x2'));var moment=require(_0x3945('0x3'));var BPromise=require(_0x3945('0x4'));var rp=require(_0x3945('0x5'));var fs=require('fs');var path=require(_0x3945('0x6'));var rimraf=require('rimraf');var config=require(_0x3945('0x7'));var attributes=require(_0x3945('0x8'));module[_0x3945('0x9')]=function(_0x3ab1f0,_0x4a3000){return _0x3ab1f0[_0x3945('0xa')]('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','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 196a8c9..2cd2c79 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 _0x6f9c=['result','catch','CreateReportAgentPreview','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6f9c,0x1ca));var _0xc6f9=function(_0x5e8647,_0x485754){_0x5e8647=_0x5e8647-0x0;var _0x699cc8=_0x6f9c[_0x5e8647];return _0x699cc8;};'use strict';var _=require(_0xc6f9('0x0'));var util=require(_0xc6f9('0x1'));var moment=require(_0xc6f9('0x2'));var BPromise=require(_0xc6f9('0x3'));var rs=require(_0xc6f9('0x4'));var fs=require('fs');var Redis=require(_0xc6f9('0x5'));var db=require(_0xc6f9('0x6'))['db'];var utils=require(_0xc6f9('0x7'));var logger=require(_0xc6f9('0x8'))('rpc');var config=require(_0xc6f9('0x9'));var jayson=require(_0xc6f9('0xa'));var client=jayson[_0xc6f9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55b16e,_0x204bba,_0x2a9111){return new BPromise(function(_0x596846,_0x1e3e16){return client[_0xc6f9('0xc')](_0x55b16e,_0x2a9111)['then'](function(_0x23bf68){logger[_0xc6f9('0xd')](_0xc6f9('0xe'),_0x204bba,'request\x20sent');logger[_0xc6f9('0xf')](_0xc6f9('0x10'),_0x204bba,_0xc6f9('0x11'),JSON[_0xc6f9('0x12')](_0x23bf68));if(_0x23bf68[_0xc6f9('0x13')]){if(_0x23bf68['error'][_0xc6f9('0x14')]===0x1f4){logger[_0xc6f9('0x13')](_0xc6f9('0xe'),_0x204bba,_0x23bf68['error'][_0xc6f9('0x15')]);return _0x1e3e16(_0x23bf68[_0xc6f9('0x13')][_0xc6f9('0x15')]);}logger[_0xc6f9('0x13')](_0xc6f9('0xe'),_0x204bba,_0x23bf68[_0xc6f9('0x13')][_0xc6f9('0x15')]);return _0x596846(_0x23bf68[_0xc6f9('0x13')][_0xc6f9('0x15')]);}else{logger[_0xc6f9('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x204bba,_0xc6f9('0x11'));_0x596846(_0x23bf68[_0xc6f9('0x16')]['message']);}})[_0xc6f9('0x17')](function(_0x42164f){logger[_0xc6f9('0x13')](_0xc6f9('0xe'),_0x204bba,_0x42164f);_0x1e3e16(_0x42164f);});});}exports[_0xc6f9('0x18')]=function(_0x273a62){var _0xb0b51a=this;return new Promise(function(_0x2631df,_0x5e7026){return db['ReportAgentPreview'][_0xc6f9('0x19')](_0x273a62[_0xc6f9('0x1a')],{'raw':_0x273a62[_0xc6f9('0x1b')]?_0x273a62['options'][_0xc6f9('0x1c')]===undefined?!![]:![]:!![]})[_0xc6f9('0x1d')](function(_0x498927){logger[_0xc6f9('0xd')](_0xc6f9('0x18'),_0x273a62);logger[_0xc6f9('0xf')]('CreateReportAgentPreview',_0x273a62,JSON[_0xc6f9('0x12')](_0x498927));_0x2631df(_0x498927);})['catch'](function(_0x4addeb){logger[_0xc6f9('0x13')](_0xc6f9('0x18'),_0x4addeb[_0xc6f9('0x15')],_0x273a62);_0x5e7026(_0xb0b51a[_0xc6f9('0x13')](0x1f4,_0x4addeb['message']));});});}; \ No newline at end of file +var _0x70be=['options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateReportAgentPreview','ReportAgentPreview','create'];(function(_0x4f517f,_0x15e66f){var _0x48bc81=function(_0x275f58){while(--_0x275f58){_0x4f517f['push'](_0x4f517f['shift']());}};_0x48bc81(++_0x15e66f);}(_0x70be,0x154));var _0xe70b=function(_0x2d3039,_0x47b955){_0x2d3039=_0x2d3039-0x0;var _0x4c16b7=_0x70be[_0x2d3039];return _0x4c16b7;};'use strict';var _=require(_0xe70b('0x0'));var util=require(_0xe70b('0x1'));var moment=require(_0xe70b('0x2'));var BPromise=require(_0xe70b('0x3'));var rs=require(_0xe70b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe70b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe70b('0x6'))(_0xe70b('0x7'));var config=require('../../config/environment');var jayson=require(_0xe70b('0x8'));var client=jayson['client'][_0xe70b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d9b48,_0x53c0bf,_0x22e8e1){return new BPromise(function(_0x31465c,_0x201332){return client[_0xe70b('0xa')](_0x5d9b48,_0x22e8e1)[_0xe70b('0xb')](function(_0x15ee6f){logger[_0xe70b('0xc')](_0xe70b('0xd'),_0x53c0bf,'request\x20sent');logger['debug'](_0xe70b('0xe'),_0x53c0bf,'request\x20sent',JSON[_0xe70b('0xf')](_0x15ee6f));if(_0x15ee6f[_0xe70b('0x10')]){if(_0x15ee6f[_0xe70b('0x10')][_0xe70b('0x11')]===0x1f4){logger[_0xe70b('0x10')](_0xe70b('0xd'),_0x53c0bf,_0x15ee6f[_0xe70b('0x10')][_0xe70b('0x12')]);return _0x201332(_0x15ee6f[_0xe70b('0x10')][_0xe70b('0x12')]);}logger['error'](_0xe70b('0xd'),_0x53c0bf,_0x15ee6f['error'][_0xe70b('0x12')]);return _0x31465c(_0x15ee6f[_0xe70b('0x10')]['message']);}else{logger[_0xe70b('0xc')](_0xe70b('0xd'),_0x53c0bf,_0xe70b('0x13'));_0x31465c(_0x15ee6f['result'][_0xe70b('0x12')]);}})[_0xe70b('0x14')](function(_0x15c18e){logger['error'](_0xe70b('0xd'),_0x53c0bf,_0x15c18e);_0x201332(_0x15c18e);});});}exports[_0xe70b('0x15')]=function(_0x4fe4ab){var _0x5d69e1=this;return new Promise(function(_0x505ba7,_0x159c93){return db[_0xe70b('0x16')][_0xe70b('0x17')](_0x4fe4ab['body'],{'raw':_0x4fe4ab[_0xe70b('0x18')]?_0x4fe4ab[_0xe70b('0x18')][_0xe70b('0x19')]===undefined?!![]:![]:!![]})[_0xe70b('0xb')](function(_0x1a785f){logger[_0xe70b('0xc')](_0xe70b('0x15'),_0x4fe4ab);logger['debug'](_0xe70b('0x15'),_0x4fe4ab,JSON[_0xe70b('0xf')](_0x1a785f));_0x505ba7(_0x1a785f);})[_0xe70b('0x14')](function(_0x4b8f28){logger[_0xe70b('0x10')](_0xe70b('0x15'),_0x4b8f28[_0xe70b('0x12')],_0x4fe4ab);_0x159c93(_0x5d69e1[_0xe70b('0x10')](0x1f4,_0x4b8f28['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 20a7ee0..8f4c3c0 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 _0x8c97=['faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/outbound/channels','outboundChannels','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','agentNotify','exports','multer','path','express','Router','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','mailAccounts','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues'];(function(_0x402b10,_0x5608c7){var _0x2f765d=function(_0xbe73c3){while(--_0xbe73c3){_0x402b10['push'](_0x402b10['shift']());}};_0x2f765d(++_0x5608c7);}(_0x8c97,0x19a));var _0x78c9=function(_0x53570d,_0x5f161b){_0x53570d=_0x53570d-0x0;var _0x4de954=_0x8c97[_0x53570d];return _0x4de954;};'use strict';var multer=require(_0x78c9('0x0'));var util=require('util');var path=require(_0x78c9('0x1'));var express=require(_0x78c9('0x2'));var router=express[_0x78c9('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0x78c9('0x4'));router[_0x78c9('0x5')](_0x78c9('0x6'),auth['isAuthenticated'](),controller[_0x78c9('0x7')]);router[_0x78c9('0x5')](_0x78c9('0x8'),auth[_0x78c9('0x9')](),controller[_0x78c9('0xa')]);router[_0x78c9('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x78c9('0x9')](),controller['voiceChannelStopMixMonitor']);router[_0x78c9('0x5')](_0x78c9('0xb'),auth[_0x78c9('0x9')](),controller[_0x78c9('0xc')]);router['get'](_0x78c9('0xd'),auth[_0x78c9('0x9')](),controller['chatQueues']);router[_0x78c9('0x5')](_0x78c9('0xe'),auth[_0x78c9('0x9')](),controller[_0x78c9('0xf')]);router['get']('/mail/accounts',auth[_0x78c9('0x9')](),controller[_0x78c9('0x10')]);router[_0x78c9('0x5')]('/openchannel/queues',auth[_0x78c9('0x9')](),controller[_0x78c9('0x11')]);router[_0x78c9('0x5')](_0x78c9('0x12'),auth[_0x78c9('0x9')](),controller['smsQueues']);router['get'](_0x78c9('0x13'),auth['isAuthenticated'](),controller[_0x78c9('0x14')]);router[_0x78c9('0x5')](_0x78c9('0x15'),auth['isAuthenticated'](),controller[_0x78c9('0x16')]);router[_0x78c9('0x5')](_0x78c9('0x17'),auth[_0x78c9('0x9')](),controller[_0x78c9('0x18')]);router['get'](_0x78c9('0x19'),auth[_0x78c9('0x9')](),controller[_0x78c9('0x1a')]);router[_0x78c9('0x5')]('/voice/queues/channels/:uniqueid',auth[_0x78c9('0x9')](),controller[_0x78c9('0x1b')]);router[_0x78c9('0x5')](_0x78c9('0x1c'),auth['isAuthenticated'](),controller[_0x78c9('0x1d')]);router['get'](_0x78c9('0x1e'),auth['isAuthenticated'](),controller[_0x78c9('0x1f')]);router['get']('/voice/queues/:id',auth[_0x78c9('0x9')](),controller[_0x78c9('0x20')]);router[_0x78c9('0x5')]('/outbound',auth[_0x78c9('0x9')](),controller['outbound']);router[_0x78c9('0x5')](_0x78c9('0x21'),auth[_0x78c9('0x9')](),controller[_0x78c9('0x22')]);router[_0x78c9('0x5')]('/agents',auth[_0x78c9('0x9')](),controller[_0x78c9('0x23')]);router[_0x78c9('0x24')](_0x78c9('0x25'),auth['isAuthenticated'](),controller[_0x78c9('0x26')]);router[_0x78c9('0x5')](_0x78c9('0x27'),auth[_0x78c9('0x9')](),controller[_0x78c9('0x28')]);router[_0x78c9('0x5')](_0x78c9('0x29'),auth[_0x78c9('0x9')](),controller['trunks']);router[_0x78c9('0x5')](_0x78c9('0x2a'),auth[_0x78c9('0x9')](),controller[_0x78c9('0x2b')]);router[_0x78c9('0x5')](_0x78c9('0x2c'),auth['isAuthenticated'](),controller['faxAccounts']);router[_0x78c9('0x5')](_0x78c9('0x2d'),auth[_0x78c9('0x9')](),controller[_0x78c9('0x2e')]);router[_0x78c9('0x5')]('/mail/queues/waitinginteractions',auth[_0x78c9('0x9')](),controller['mailQueuesWaitingInteractions']);router[_0x78c9('0x5')]('/openchannel/queues/waitinginteractions',auth[_0x78c9('0x9')](),controller[_0x78c9('0x2f')]);router[_0x78c9('0x5')]('/sms/queues/waitinginteractions',auth[_0x78c9('0x9')](),controller[_0x78c9('0x30')]);router[_0x78c9('0x5')](_0x78c9('0x31'),auth[_0x78c9('0x9')](),controller['whatsappQueuesWaitingInteractions']);router[_0x78c9('0x5')](_0x78c9('0x32'),auth[_0x78c9('0x9')](),controller[_0x78c9('0x33')]);router[_0x78c9('0x34')](_0x78c9('0x35'),auth[_0x78c9('0x9')](),controller['queueNotify'](_0x78c9('0x36')));router[_0x78c9('0x5')](_0x78c9('0x37'),auth[_0x78c9('0x9')](),controller[_0x78c9('0x38')]);router[_0x78c9('0x34')](_0x78c9('0x39'),auth[_0x78c9('0x9')](),controller[_0x78c9('0x3a')]('chat'));router[_0x78c9('0x5')]('/chat/queues/:id',auth[_0x78c9('0x9')](),controller[_0x78c9('0x3b')]);router[_0x78c9('0x34')](_0x78c9('0x3c'),auth[_0x78c9('0x9')](),controller[_0x78c9('0x3a')]('fax'));router['get'](_0x78c9('0x3d'),auth['isAuthenticated'](),controller['showFaxQueues']);router['post']('/openchannel/queues/:id/notify',auth[_0x78c9('0x9')](),controller[_0x78c9('0x3a')](_0x78c9('0x3e')));router[_0x78c9('0x5')](_0x78c9('0x3f'),auth[_0x78c9('0x9')](),controller[_0x78c9('0x40')]);router[_0x78c9('0x34')](_0x78c9('0x41'),auth[_0x78c9('0x9')](),controller[_0x78c9('0x3a')]('sms'));router['post']('/whatsapp/queues/:id/notify',auth[_0x78c9('0x9')](),controller[_0x78c9('0x3a')](_0x78c9('0x42')));router[_0x78c9('0x5')](_0x78c9('0x43'),auth[_0x78c9('0x9')](),controller[_0x78c9('0x44')]);router[_0x78c9('0x5')]('/whatsapp/queues/:id',auth[_0x78c9('0x9')](),controller[_0x78c9('0x45')]);router[_0x78c9('0x34')]('/agents/:id/notify',auth[_0x78c9('0x9')](),controller[_0x78c9('0x46')]);module[_0x78c9('0x47')]=router; \ No newline at end of file +var _0xec2a=['/voice/queues/channels/:uniqueid','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','chat','/chat/queues/:id','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','agentNotify','exports','util','express','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xec2a,0x110));var _0xaec2=function(_0x5c9274,_0x4e849b){_0x5c9274=_0x5c9274-0x0;var _0x1ef7d3=_0xec2a[_0x5c9274];return _0x1ef7d3;};'use strict';var multer=require('multer');var util=require(_0xaec2('0x0'));var path=require('path');var express=require(_0xaec2('0x1'));var router=express['Router']();var auth=require(_0xaec2('0x2'));var controller=require(_0xaec2('0x3'));router[_0xaec2('0x4')](_0xaec2('0x5'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x7')]);router[_0xaec2('0x4')](_0xaec2('0x8'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0xaec2('0x4')](_0xaec2('0x9'),auth[_0xaec2('0x6')](),controller['voiceChannelStopMixMonitor']);router[_0xaec2('0x4')](_0xaec2('0xa'),auth[_0xaec2('0x6')](),controller['voiceQueues']);router[_0xaec2('0x4')](_0xaec2('0xb'),auth[_0xaec2('0x6')](),controller['chatQueues']);router[_0xaec2('0x4')](_0xaec2('0xc'),auth[_0xaec2('0x6')](),controller[_0xaec2('0xd')]);router[_0xaec2('0x4')](_0xaec2('0xe'),auth['isAuthenticated'](),controller[_0xaec2('0xf')]);router[_0xaec2('0x4')](_0xaec2('0x10'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x11')]);router[_0xaec2('0x4')](_0xaec2('0x12'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x13')]);router[_0xaec2('0x4')](_0xaec2('0x14'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x15')]);router[_0xaec2('0x4')](_0xaec2('0x16'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x17')]);router[_0xaec2('0x4')](_0xaec2('0x18'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x19')]);router[_0xaec2('0x4')](_0xaec2('0x1a'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x1b')]);router[_0xaec2('0x4')](_0xaec2('0x1c'),auth[_0xaec2('0x6')](),controller['voiceQueuesChannel']);router[_0xaec2('0x4')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xaec2('0x6')](),controller[_0xaec2('0x1d')]);router[_0xaec2('0x4')](_0xaec2('0x1e'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x1f')]);router['get'](_0xaec2('0x20'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x21')]);router[_0xaec2('0x4')](_0xaec2('0x22'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x23')]);router['get'](_0xaec2('0x24'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x25')]);router[_0xaec2('0x4')](_0xaec2('0x26'),auth['isAuthenticated'](),controller[_0xaec2('0x27')]);router['put'](_0xaec2('0x28'),auth['isAuthenticated'](),controller[_0xaec2('0x29')]);router[_0xaec2('0x4')](_0xaec2('0x2a'),auth['isAuthenticated'](),controller['telephones']);router[_0xaec2('0x4')](_0xaec2('0x2b'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x2c')]);router[_0xaec2('0x4')]('/campaigns',auth[_0xaec2('0x6')](),controller['campaigns']);router['get']('/fax/accounts',auth[_0xaec2('0x6')](),controller['faxAccounts']);router[_0xaec2('0x4')](_0xaec2('0x2d'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x2e')]);router[_0xaec2('0x4')](_0xaec2('0x2f'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x30')]);router[_0xaec2('0x4')](_0xaec2('0x31'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x32')]);router['get'](_0xaec2('0x33'),auth[_0xaec2('0x6')](),controller['smsQueuesWaitingInteractions']);router[_0xaec2('0x4')](_0xaec2('0x34'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x35')]);router['get'](_0xaec2('0x36'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x37')]);router[_0xaec2('0x38')](_0xaec2('0x39'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x3a')](_0xaec2('0x3b')));router[_0xaec2('0x4')](_0xaec2('0x3c'),auth[_0xaec2('0x6')](),controller['showMailQueues']);router[_0xaec2('0x38')]('/chat/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0xaec2('0x3d')));router[_0xaec2('0x4')](_0xaec2('0x3e'),auth[_0xaec2('0x6')](),controller['showChatQueues']);router['post']('/fax/queues/:id/notify',auth[_0xaec2('0x6')](),controller[_0xaec2('0x3a')](_0xaec2('0x3f')));router[_0xaec2('0x4')](_0xaec2('0x40'),auth['isAuthenticated'](),controller[_0xaec2('0x41')]);router[_0xaec2('0x38')]('/openchannel/queues/:id/notify',auth[_0xaec2('0x6')](),controller['queueNotify']('openchannel'));router[_0xaec2('0x4')](_0xaec2('0x42'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router['post'](_0xaec2('0x43'),auth[_0xaec2('0x6')](),controller[_0xaec2('0x3a')](_0xaec2('0x44')));router[_0xaec2('0x38')](_0xaec2('0x45'),auth[_0xaec2('0x6')](),controller['queueNotify']('whatsapp'));router[_0xaec2('0x4')](_0xaec2('0x46'),auth['isAuthenticated'](),controller[_0xaec2('0x47')]);router[_0xaec2('0x4')](_0xaec2('0x48'),auth[_0xaec2('0x6')](),controller['showWhatsappQueues']);router['post']('/agents/:id/notify',auth[_0xaec2('0x6')](),controller[_0xaec2('0x49')]);module[_0xaec2('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 4864521..4f5f9f6 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 _0x9256=['OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','\x20Message\x20not\x20found','update','queue','From','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','messageId','MessageId','InteractionId','agentTransferTimeout','bluebird','../../mysqldb','jayson/promise','client','http','request','then','error','code','message','json','sendStatus','stack','name','status','send','isNil','rows','voiceChannels','VoiceChannels','catch','VoiceChannelMixMonitor','merge','query','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','showVoiceQueues','VoiceQueues','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','body','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','updateAttributes','findOrCreate','INTERACTION','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues'];(function(_0x1abd5e,_0x607b87){var _0x39194a=function(_0x4cfff4){while(--_0x4cfff4){_0x1abd5e['push'](_0x1abd5e['shift']());}};_0x39194a(++_0x607b87);}(_0x9256,0xa8));var _0x6925=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9256[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0x6925('0x0'));var moment=require('moment');var _=require('lodash');var util=require('util');var db=require(_0x6925('0x1'))['db'];var logger=require('../../config/logger')('api');var jayson=require(_0x6925('0x2'));var amiClient=jayson[_0x6925('0x3')]['http']({'port':0x232a});var mailClient=jayson[_0x6925('0x3')]['http']({'port':0x232b});var routingClient=jayson[_0x6925('0x3')][_0x6925('0x4')]({'port':0x232c});function respondWithRpcPromise(_0x5b82da,_0x508677,_0x1be7f5){return new BPromise(function(_0x592f35,_0x473bd6){var _0x40c127=_0x1be7f5?_0x1be7f5:amiClient;return _0x40c127[_0x6925('0x5')](_0x5b82da,_0x508677)[_0x6925('0x6')](function(_0x261172){if(_0x261172[_0x6925('0x7')]){if(_0x261172[_0x6925('0x7')][_0x6925('0x8')]===0x1f4){return _0x473bd6(_0x261172['error'][_0x6925('0x9')]);}return _0x592f35(_0x261172[_0x6925('0x7')][_0x6925('0x9')]);}else{_0x592f35(_0x261172['result']);}})['catch'](function(_0xd6fc25){_0x473bd6(_0xd6fc25);});});}function respondWithResult(_0x4ff240,_0x34d638){_0x34d638=_0x34d638||0xc8;return function(_0xc2279){if(_0xc2279){return _0x4ff240['status'](_0x34d638)[_0x6925('0xa')](_0xc2279);}return _0x4ff240[_0x6925('0xb')](0x194);};}function handleError(_0x55783d,_0x51963a){_0x51963a=_0x51963a||0x1f4;return function(_0x20382e){logger[_0x6925('0x7')](_0x20382e[_0x6925('0xc')]);if(_0x20382e[_0x6925('0xd')]){delete _0x20382e['name'];}_0x55783d[_0x6925('0xe')](_0x51963a)[_0x6925('0xf')](_0x20382e);};}function findById(_0x24c33e){return function(_0x23a535){if(!_[_0x6925('0x10')](_0x24c33e)&&!_[_0x6925('0x10')](_0x23a535)&&!_['isNil'](_0x23a535[_0x6925('0x11')])){return _['find'](_0x23a535['rows'],function(_0x2f5a6f){return _0x2f5a6f['id']==_0x24c33e;});}return null;};}exports[_0x6925('0x12')]=function(_0x3dcab7,_0x1ba39b){return respondWithRpcPromise(_0x6925('0x13'),_0x3dcab7['query'])[_0x6925('0x6')](respondWithResult(_0x1ba39b,null))[_0x6925('0x14')](handleError(_0x1ba39b,null));};exports['voiceChannelMixMonitor']=function(_0x37ee53,_0x2c0480){return respondWithRpcPromise(_0x6925('0x15'),_[_0x6925('0x16')](_0x37ee53[_0x6925('0x17')],_0x37ee53['params']))[_0x6925('0x6')](respondWithResult(_0x2c0480,null))[_0x6925('0x14')](handleError(_0x2c0480,null));};exports[_0x6925('0x18')]=function(_0x2fc475,_0x432f52){return respondWithRpcPromise(_0x6925('0x19'),_[_0x6925('0x16')](_0x2fc475[_0x6925('0x17')],_0x2fc475[_0x6925('0x1a')]))[_0x6925('0x6')](respondWithResult(_0x432f52,null))[_0x6925('0x14')](handleError(_0x432f52,null));};exports['voiceQueues']=function(_0x190f36,_0x528a2b){return respondWithRpcPromise('VoiceQueues',_0x190f36[_0x6925('0x17')])['then'](respondWithResult(_0x528a2b,null))[_0x6925('0x14')](handleError(_0x528a2b,null));};exports[_0x6925('0x1b')]=function(_0x53fcf1,_0x5a8b08){return respondWithRpcPromise(_0x6925('0x1c'),_0x53fcf1[_0x6925('0x17')])['then'](findById(_0x53fcf1[_0x6925('0x1a')]['id']))[_0x6925('0x6')](respondWithResult(_0x5a8b08,null))[_0x6925('0x14')](handleError(_0x5a8b08,null));};exports['voiceQueuesPreview']=function(_0x41524b,_0x40cfc5){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x6925('0x16')](_0x41524b[_0x6925('0x17')],_0x41524b[_0x6925('0x1a')]))['then'](respondWithResult(_0x40cfc5,null))[_0x6925('0x14')](handleError(_0x40cfc5,null));};exports[_0x6925('0x1d')]=function(_0x4e8414,_0xb17526){return respondWithRpcPromise('VoiceQueuesChannels',_0x4e8414[_0x6925('0x17')])[_0x6925('0x6')](respondWithResult(_0xb17526,null))[_0x6925('0x14')](handleError(_0xb17526,null));};exports[_0x6925('0x1e')]=function(_0x115f1e,_0xb21117){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x6925('0x16')](_0x115f1e[_0x6925('0x17')],_0x115f1e['params']))[_0x6925('0x6')](respondWithResult(_0xb21117,null))[_0x6925('0x14')](handleError(_0xb21117,null));};exports['voiceQueuesChannelHangup']=function(_0x4b370a,_0x1356be){return respondWithRpcPromise(_0x6925('0x1f'),_[_0x6925('0x16')](_0x4b370a[_0x6925('0x17')],_0x4b370a[_0x6925('0x1a')]))[_0x6925('0x6')](respondWithResult(_0x1356be,null))['catch'](handleError(_0x1356be,null));};exports[_0x6925('0x20')]=function(_0x33340c,_0x145fe2){return respondWithRpcPromise(_0x6925('0x21'),_[_0x6925('0x16')](_0x33340c[_0x6925('0x17')],_0x33340c['params']))[_0x6925('0x6')](respondWithResult(_0x145fe2,null))[_0x6925('0x14')](handleError(_0x145fe2,null));};exports[_0x6925('0x22')]=function(_0xb7d486,_0x1fefc2){return respondWithRpcPromise(_0x6925('0x23'),_0xb7d486[_0x6925('0x17')])['then'](respondWithResult(_0x1fefc2,null))[_0x6925('0x14')](handleError(_0x1fefc2,null));};exports[_0x6925('0x24')]=function(_0x2b8e20,_0x8b8d0c){return respondWithRpcPromise(_0x6925('0x25'),_0x2b8e20[_0x6925('0x17')])[_0x6925('0x6')](respondWithResult(_0x8b8d0c,null))[_0x6925('0x14')](handleError(_0x8b8d0c,null));};exports['agents']=function(_0x15f585,_0xea72c6){var _0x618a99;return respondWithRpcPromise('Agents',_0x15f585[_0x6925('0x17')])[_0x6925('0x6')](function(_0x10c483){_0x618a99=_0x10c483;return respondWithRpcPromise('Agents',_0x15f585['query'],routingClient);})[_0x6925('0x6')](function(_0xc327cc){return _[_0x6925('0x16')]({},_0xc327cc,_0x618a99);})[_0x6925('0x6')](respondWithResult(_0xea72c6,null))[_0x6925('0x14')](handleError(_0xea72c6,null));};exports['agentCapacity']=function(_0x52d7de,_0x1e7096){if(_0x52d7de[_0x6925('0x26')]&&_0x52d7de[_0x6925('0x26')][_0x6925('0x27')]&&_0x52d7de[_0x6925('0x28')]&&_0x52d7de[_0x6925('0x28')][_0x6925('0xd')]){for(var _0x1d8d4a in _0x52d7de['body'][_0x6925('0x27')]){if(_0x52d7de[_0x6925('0x26')][_0x6925('0x27')][_0x6925('0x29')](_0x1d8d4a)){db[_0x6925('0x2a')][_0x6925('0x2b')]({'where':{'channel':_0x1d8d4a,'membername':_0x52d7de['user']['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x52d7de[_0x6925('0x26')]['interaction'][_0x1d8d4a]&&_0x52d7de['body']['interaction'][_0x1d8d4a][_0x6925('0x2c')]?{'$notIn':_0x52d7de[_0x6925('0x26')][_0x6925('0x27')][_0x1d8d4a]}:{'$ne':null}}})[_0x6925('0x6')](function(_0x4f55dd){var _0x5be7f3=moment()[_0x6925('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x1d7ada=0x0,_0x3ef597=_0x4f55dd[_0x6925('0x2c')];_0x1d7ada<_0x3ef597;_0x1d7ada+=0x1){_0x4f55dd[_0x1d7ada][_0x6925('0x2e')]({'exitAt':_0x5be7f3});}});for(var _0x313830=0x0;_0x313830<_0x52d7de[_0x6925('0x26')][_0x6925('0x27')][_0x1d8d4a]['length'];_0x313830+=0x1){db[_0x6925('0x2a')][_0x6925('0x2f')]({'where':{'channel':_0x1d8d4a,'membername':_0x52d7de['user']['name'],'type':_0x6925('0x30'),'uniqueid':_0x52d7de[_0x6925('0x26')][_0x6925('0x27')][_0x1d8d4a][_0x313830],'exitAt':null},'defaults':{'channel':_0x1d8d4a,'membername':_0x52d7de[_0x6925('0x28')]['name'],'interface':_[_0x6925('0x10')](_0x52d7de[_0x6925('0x28')][_0x6925('0x31')])?util[_0x6925('0x2d')](_0x6925('0x32'),_0x52d7de['user'][_0x6925('0xd')]):_0x52d7de[_0x6925('0x28')][_0x6925('0x31')],'type':_0x6925('0x30'),'enterAt':moment()[_0x6925('0x2d')](_0x6925('0x33')),'role':_0x6925('0x34'),'internal':_0x52d7de[_0x6925('0x28')][_0x6925('0x35')],'uniqueid':_0x52d7de[_0x6925('0x26')]['interaction'][_0x1d8d4a][_0x313830]}});}}}}return respondWithRpcPromise(_0x6925('0x36'),{'id':_0x52d7de['params']['id'],'capacity':_0x52d7de[_0x6925('0x26')][_0x6925('0x37')]},routingClient)['then'](respondWithResult(_0x1e7096,null))[_0x6925('0x14')](handleError(_0x1e7096,null));};exports[_0x6925('0x38')]=function(_0x2c1389,_0x56a58e){return respondWithRpcPromise(_0x6925('0x39'),_0x2c1389['query'])[_0x6925('0x6')](respondWithResult(_0x56a58e,null))['catch'](handleError(_0x56a58e,null));};exports[_0x6925('0x3a')]=function(_0x6be525,_0x2c027a){return respondWithRpcPromise('Trunks',_0x6be525[_0x6925('0x17')])[_0x6925('0x6')](respondWithResult(_0x2c027a,null))[_0x6925('0x14')](handleError(_0x2c027a,null));};exports[_0x6925('0x3b')]=function(_0x5616ee,_0x14690b){return respondWithRpcPromise(_0x6925('0x3c'),_0x5616ee[_0x6925('0x17')])[_0x6925('0x6')](respondWithResult(_0x14690b,null))[_0x6925('0x14')](handleError(_0x14690b,null));};exports[_0x6925('0x3d')]=function(_0x1b6c9a,_0x1a11ef){return respondWithRpcPromise(_0x6925('0x3e'),_0x1b6c9a['query'],routingClient)[_0x6925('0x6')](respondWithResult(_0x1a11ef,null))[_0x6925('0x14')](handleError(_0x1a11ef,null));};exports[_0x6925('0x3f')]=function(_0x597147,_0x1612ff){return respondWithRpcPromise(_0x6925('0x3e'),_0x597147[_0x6925('0x17')],routingClient)[_0x6925('0x6')](findById(_0x597147[_0x6925('0x1a')]['id']))[_0x6925('0x6')](respondWithResult(_0x1612ff,null))['catch'](handleError(_0x1612ff,null));};exports[_0x6925('0x40')]=function(_0x2310cc,_0x59f6ee){return respondWithRpcPromise(_0x6925('0x41'),_0x2310cc['query'],routingClient)[_0x6925('0x6')](respondWithResult(_0x59f6ee,null))[_0x6925('0x14')](handleError(_0x59f6ee,null));};exports[_0x6925('0x42')]=function(_0x40e43a,_0x32572e){return respondWithRpcPromise(_0x6925('0x41'),_0x40e43a['query'],routingClient)[_0x6925('0x6')](findById(_0x40e43a[_0x6925('0x1a')]['id']))[_0x6925('0x6')](respondWithResult(_0x32572e,null))['catch'](handleError(_0x32572e,null));};exports[_0x6925('0x43')]=function(_0x4a98af,_0x1b4869){return respondWithRpcPromise(_0x6925('0x44'),_0x4a98af[_0x6925('0x17')],mailClient)['then'](respondWithResult(_0x1b4869,null))['catch'](handleError(_0x1b4869,null));};exports[_0x6925('0x45')]=function(_0x2608d8,_0x49229e){return respondWithRpcPromise(_0x6925('0x46'),_0x2608d8[_0x6925('0x17')],routingClient)[_0x6925('0x6')](respondWithResult(_0x49229e,null))[_0x6925('0x14')](handleError(_0x49229e,null));};exports[_0x6925('0x47')]=function(_0x537f4e,_0x2e0806){return respondWithRpcPromise(_0x6925('0x46'),_0x537f4e['query'],routingClient)[_0x6925('0x6')](findById(_0x537f4e[_0x6925('0x1a')]['id']))[_0x6925('0x6')](respondWithResult(_0x2e0806,null))['catch'](handleError(_0x2e0806,null));};exports[_0x6925('0x48')]=function(_0x30a8fa,_0x3ea102){return respondWithRpcPromise('SmsQueues',_0x30a8fa['query'],routingClient)['then'](respondWithResult(_0x3ea102,null))[_0x6925('0x14')](handleError(_0x3ea102,null));};exports[_0x6925('0x49')]=function(_0x58f6c6,_0x17b86d){return respondWithRpcPromise(_0x6925('0x4a'),_0x58f6c6[_0x6925('0x17')],routingClient)[_0x6925('0x6')](findById(_0x58f6c6[_0x6925('0x1a')]['id']))[_0x6925('0x6')](respondWithResult(_0x17b86d,null))['catch'](handleError(_0x17b86d,null));};exports[_0x6925('0x4b')]=function(_0x224513,_0x393fcf){return respondWithRpcPromise(_0x6925('0x4c'),_0x224513[_0x6925('0x17')],routingClient)[_0x6925('0x6')](respondWithResult(_0x393fcf,null))[_0x6925('0x14')](handleError(_0x393fcf,null));};exports['showWhatsappQueues']=function(_0x3d300f,_0x435135){return respondWithRpcPromise(_0x6925('0x4c'),_0x3d300f[_0x6925('0x17')],routingClient)[_0x6925('0x6')](findById(_0x3d300f['params']['id']))[_0x6925('0x6')](respondWithResult(_0x435135,null))[_0x6925('0x14')](handleError(_0x435135,null));};exports[_0x6925('0x4d')]=function(_0x5c0cd1,_0x570da9){return respondWithRpcPromise('FaxQueues',_0x5c0cd1[_0x6925('0x17')],routingClient)[_0x6925('0x6')](respondWithResult(_0x570da9,null))[_0x6925('0x14')](handleError(_0x570da9,null));};exports[_0x6925('0x4e')]=function(_0x20c31f,_0x160f7e){return respondWithRpcPromise(_0x6925('0x4f'),_0x20c31f[_0x6925('0x17')],routingClient)['then'](findById(_0x20c31f[_0x6925('0x1a')]['id']))['then'](respondWithResult(_0x160f7e,null))[_0x6925('0x14')](handleError(_0x160f7e,null));};exports[_0x6925('0x50')]=function(_0x13c4a7,_0x5c5da8){return respondWithRpcPromise(_0x6925('0x51'),_0x13c4a7[_0x6925('0x17')])[_0x6925('0x6')](respondWithResult(_0x5c5da8,null))[_0x6925('0x14')](handleError(_0x5c5da8,null));};exports[_0x6925('0x52')]=function(_0x4de220,_0x1a7ce7){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x4de220[_0x6925('0x17')],routingClient)[_0x6925('0x6')](respondWithResult(_0x1a7ce7,null))['catch'](handleError(_0x1a7ce7,null));};exports[_0x6925('0x53')]=function(_0x172fe1,_0x5489ce){return respondWithRpcPromise(_0x6925('0x54'),_0x172fe1[_0x6925('0x17')],routingClient)[_0x6925('0x6')](respondWithResult(_0x5489ce,null))[_0x6925('0x14')](handleError(_0x5489ce,null));};exports[_0x6925('0x55')]=function(_0x2456f3,_0x537c72){return respondWithRpcPromise(_0x6925('0x56'),_0x2456f3[_0x6925('0x17')],routingClient)[_0x6925('0x6')](respondWithResult(_0x537c72,null))['catch'](handleError(_0x537c72,null));};exports[_0x6925('0x57')]=function(_0x22e2c4,_0x2b451e){return respondWithRpcPromise(_0x6925('0x58'),_0x22e2c4[_0x6925('0x17')],routingClient)['then'](respondWithResult(_0x2b451e,null))[_0x6925('0x14')](handleError(_0x2b451e,null));};exports[_0x6925('0x59')]=function(_0x4d8b28,_0x317025){return respondWithRpcPromise(_0x6925('0x5a'),_0x4d8b28[_0x6925('0x17')],routingClient)[_0x6925('0x6')](respondWithResult(_0x317025,null))['catch'](handleError(_0x317025,null));};exports[_0x6925('0x5b')]=function(_0x5a4f74,_0x76f4c){return respondWithRpcPromise(_0x6925('0x5c'),_0x5a4f74[_0x6925('0x17')],routingClient)[_0x6925('0x6')](respondWithResult(_0x76f4c,null))['catch'](handleError(_0x76f4c,null));};exports[_0x6925('0x5d')]=function(_0x47eb37){return function(_0x1c0f76,_0x553a2a){var _0x19bdc6,_0x569dd6;var _0x2c1fd8=_[_0x6925('0x5e')](_0x47eb37);var _0x8e3660=_0x47eb37===_0x6925('0x5f')?_0x6925('0x60'):_0x6925('0x61');return db[_0x2c1fd8+_0x6925('0x62')]['findOne']({'raw':!![],'where':{'id':_0x1c0f76['params']['id']}})[_0x6925('0x6')](function(_0x5c51ca){if(_[_0x6925('0x10')](_0x5c51ca)){throw new Error(_0x2c1fd8+_0x6925('0x63'));}_0x19bdc6=_0x5c51ca;return db[_0x2c1fd8+_0x6925('0x64')][_0x6925('0x65')]({'where':{'id':_0x1c0f76[_0x6925('0x26')]['messageId']},'include':[{'model':db[_0x2c1fd8+_0x6925('0x66')],'as':_0x6925('0x66')},{'model':db[_0x2c1fd8+_0x8e3660],'as':_0x6925('0x61')}]});})[_0x6925('0x6')](function(_0x2b5279){if(_[_0x6925('0x10')](_0x2b5279)){throw new Error(_0x2c1fd8+_0x6925('0x67'));}_0x569dd6=_0x2b5279;return _0x2b5279[_0x6925('0x68')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x55d38a={'uniqueid':_0x47eb37+'.'+_0x569dd6['id']+'.'+_0x569dd6[_0x6925('0x66')]['id'],'FromUserId':_0x1c0f76['user']['id'],'type':_0x6925('0x69')};_0x55d38a[_0x2c1fd8+'MessageId']=_0x569dd6['id'];_0x55d38a[_0x2c1fd8+'InteractionId']=_0x569dd6[_0x6925('0x66')]['id'];_0x55d38a[_0x6925('0x6a')+_0x2c1fd8+_0x8e3660+'Id']=_0x569dd6['Account']['id'];_0x55d38a['To'+_0x2c1fd8+'QueueId']=_0x19bdc6['id'];return db[_0x2c1fd8+_0x6925('0x6b')][_0x6925('0x6c')](_0x55d38a);})['then'](function(){return respondWithRpcPromise(_0x6925('0x6d'),{'channel':_0x47eb37,'interaction':_0x569dd6[_0x6925('0x66')],'message':_0x569dd6,'account':_0x569dd6['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x6925('0x69'),'appdata':_0x19bdc6[_0x6925('0xd')]+','+(_0x569dd6[_0x6925('0x61')][_0x6925('0x6e')]||0x12c),'interval':_0x6925('0x6f')}]},routingClient);})[_0x6925('0x6')](respondWithResult(_0x553a2a,null))[_0x6925('0x14')](handleError(_0x553a2a,null));};};exports[_0x6925('0x70')]=function(_0x61697a,_0x3580e3){var _0x46a635,_0x5ee645;if(_[_0x6925('0x10')](_0x61697a[_0x6925('0x26')][_0x6925('0x71')])){throw new Error(_0x6925('0x72'));}var _0xb8fc80=_0x61697a['body'][_0x6925('0x71')];var _0x2a198a=_[_0x6925('0x5e')](_0xb8fc80);var _0x3192e2=_0xb8fc80===_0x6925('0x5f')?_0x6925('0x60'):_0x6925('0x61');return db['User'][_0x6925('0x65')]({'raw':!![],'where':{'id':_0x61697a['params']['id'],'role':_0x6925('0x34')}})[_0x6925('0x6')](function(_0x4a7a20){if(_[_0x6925('0x10')](_0x4a7a20)){throw new Error('Agent\x20not\x20found');}_0x46a635=_0x4a7a20;return db[_0x2a198a+_0x6925('0x64')][_0x6925('0x65')]({'where':{'id':_0x61697a[_0x6925('0x26')][_0x6925('0x73')]},'include':[{'model':db[_0x2a198a+_0x6925('0x66')],'as':_0x6925('0x66')},{'model':db[_0x2a198a+_0x3192e2],'as':_0x6925('0x61')}]});})['then'](function(_0x24020e){if(_['isNil'](_0x24020e)){throw new Error(_0x2a198a+_0x6925('0x67'));}_0x5ee645=_0x24020e;return _0x24020e[_0x6925('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6925('0x6')](function(){var _0x84c567={'uniqueid':_0xb8fc80+'.'+_0x5ee645['id']+'.'+_0x5ee645[_0x6925('0x66')]['id'],'FromUserId':_0x61697a[_0x6925('0x28')]['id'],'type':_0x6925('0x69'),'ToUserId':_0x46a635['id']};_0x84c567[_0x2a198a+_0x6925('0x74')]=_0x5ee645['id'];_0x84c567[_0x2a198a+_0x6925('0x75')]=_0x5ee645[_0x6925('0x66')]['id'];_0x84c567[_0x6925('0x6a')+_0x2a198a+_0x3192e2+'Id']=_0x5ee645[_0x6925('0x61')]['id'];return db[_0x2a198a+_0x6925('0x6b')][_0x6925('0x6c')](_0x84c567);})[_0x6925('0x6')](function(){return respondWithRpcPromise(_0x6925('0x6d'),{'channel':_0xb8fc80,'interaction':_0x5ee645['Interaction'],'message':_0x5ee645,'account':_0x5ee645[_0x6925('0x61')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6925('0x34'),'appdata':_0x46a635[_0x6925('0xd')]+','+(_0x5ee645['Account'][_0x6925('0x76')]||0x12c),'interval':_0x6925('0x6f')}]},routingClient);})[_0x6925('0x6')](respondWithResult(_0x3580e3,null))[_0x6925('0x14')](handleError(_0x3580e3,null));}; \ No newline at end of file +var _0xf9e2=['showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','chat','Account','Queue','findOne','Message','messageId','Interaction','\x20Message\x20not\x20found','update','From','QueueId','TransferReport','create','queue','queueTransferTimeout','channel','capitalize','User','agent','MessageId','InteractionId','Start','agentTransferTimeout','*,*,*,*','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','http','client','request','code','error','message','catch','status','sendStatus','stack','name','send','rows','find','voiceChannels','VoiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','isNil','interface','SIP/%s','internal','AgentCapacity','capacity','telephones','Trunks','Campaigns','chatQueues','ChatQueues'];(function(_0x5f2dbe,_0x26437a){var _0x43352e=function(_0x54e888){while(--_0x54e888){_0x5f2dbe['push'](_0x5f2dbe['shift']());}};_0x43352e(++_0x26437a);}(_0xf9e2,0x126));var _0x2f9e=function(_0x2d96ab,_0x334ed7){_0x2d96ab=_0x2d96ab-0x0;var _0x3db2ab=_0xf9e2[_0x2d96ab];return _0x3db2ab;};'use strict';var BPromise=require(_0x2f9e('0x0'));var moment=require(_0x2f9e('0x1'));var _=require(_0x2f9e('0x2'));var util=require(_0x2f9e('0x3'));var db=require(_0x2f9e('0x4'))['db'];var logger=require(_0x2f9e('0x5'))(_0x2f9e('0x6'));var jayson=require(_0x2f9e('0x7'));var amiClient=jayson['client'][_0x2f9e('0x8')]({'port':0x232a});var mailClient=jayson['client'][_0x2f9e('0x8')]({'port':0x232b});var routingClient=jayson[_0x2f9e('0x9')]['http']({'port':0x232c});function respondWithRpcPromise(_0x55a8ba,_0x1d95c5,_0x8292c7){return new BPromise(function(_0x51228d,_0x1afa7d){var _0x56dcc9=_0x8292c7?_0x8292c7:amiClient;return _0x56dcc9[_0x2f9e('0xa')](_0x55a8ba,_0x1d95c5)['then'](function(_0x10b2bd){if(_0x10b2bd['error']){if(_0x10b2bd['error'][_0x2f9e('0xb')]===0x1f4){return _0x1afa7d(_0x10b2bd[_0x2f9e('0xc')][_0x2f9e('0xd')]);}return _0x51228d(_0x10b2bd['error']['message']);}else{_0x51228d(_0x10b2bd['result']);}})[_0x2f9e('0xe')](function(_0x439d24){_0x1afa7d(_0x439d24);});});}function respondWithResult(_0x4e7258,_0x24a3de){_0x24a3de=_0x24a3de||0xc8;return function(_0x431b9b){if(_0x431b9b){return _0x4e7258[_0x2f9e('0xf')](_0x24a3de)['json'](_0x431b9b);}return _0x4e7258[_0x2f9e('0x10')](0x194);};}function handleError(_0x22ea75,_0x367e95){_0x367e95=_0x367e95||0x1f4;return function(_0x24f4e6){logger[_0x2f9e('0xc')](_0x24f4e6[_0x2f9e('0x11')]);if(_0x24f4e6[_0x2f9e('0x12')]){delete _0x24f4e6['name'];}_0x22ea75[_0x2f9e('0xf')](_0x367e95)[_0x2f9e('0x13')](_0x24f4e6);};}function findById(_0x1ccaf3){return function(_0x477e00){if(!_['isNil'](_0x1ccaf3)&&!_['isNil'](_0x477e00)&&!_['isNil'](_0x477e00[_0x2f9e('0x14')])){return _[_0x2f9e('0x15')](_0x477e00[_0x2f9e('0x14')],function(_0xe58fc){return _0xe58fc['id']==_0x1ccaf3;});}return null;};}exports[_0x2f9e('0x16')]=function(_0x4c121a,_0x3e919e){return respondWithRpcPromise(_0x2f9e('0x17'),_0x4c121a[_0x2f9e('0x18')])[_0x2f9e('0x19')](respondWithResult(_0x3e919e,null))[_0x2f9e('0xe')](handleError(_0x3e919e,null));};exports[_0x2f9e('0x1a')]=function(_0x48268b,_0x3e8a05){return respondWithRpcPromise(_0x2f9e('0x1b'),_[_0x2f9e('0x1c')](_0x48268b[_0x2f9e('0x18')],_0x48268b[_0x2f9e('0x1d')]))[_0x2f9e('0x19')](respondWithResult(_0x3e8a05,null))['catch'](handleError(_0x3e8a05,null));};exports['voiceChannelStopMixMonitor']=function(_0x5a5b2a,_0x5c77f2){return respondWithRpcPromise(_0x2f9e('0x1e'),_[_0x2f9e('0x1c')](_0x5a5b2a['query'],_0x5a5b2a[_0x2f9e('0x1d')]))[_0x2f9e('0x19')](respondWithResult(_0x5c77f2,null))['catch'](handleError(_0x5c77f2,null));};exports['voiceQueues']=function(_0x2d17a5,_0x5cc8bc){return respondWithRpcPromise(_0x2f9e('0x1f'),_0x2d17a5[_0x2f9e('0x18')])[_0x2f9e('0x19')](respondWithResult(_0x5cc8bc,null))[_0x2f9e('0xe')](handleError(_0x5cc8bc,null));};exports['showVoiceQueues']=function(_0x5808c4,_0xd823a){return respondWithRpcPromise(_0x2f9e('0x1f'),_0x5808c4[_0x2f9e('0x18')])['then'](findById(_0x5808c4[_0x2f9e('0x1d')]['id']))['then'](respondWithResult(_0xd823a,null))[_0x2f9e('0xe')](handleError(_0xd823a,null));};exports[_0x2f9e('0x20')]=function(_0x5091dd,_0x550e55){return respondWithRpcPromise(_0x2f9e('0x21'),_['merge'](_0x5091dd['query'],_0x5091dd[_0x2f9e('0x1d')]))[_0x2f9e('0x19')](respondWithResult(_0x550e55,null))[_0x2f9e('0xe')](handleError(_0x550e55,null));};exports[_0x2f9e('0x22')]=function(_0x59e774,_0x16d710){return respondWithRpcPromise('VoiceQueuesChannels',_0x59e774[_0x2f9e('0x18')])[_0x2f9e('0x19')](respondWithResult(_0x16d710,null))[_0x2f9e('0xe')](handleError(_0x16d710,null));};exports['voiceQueuesChannel']=function(_0x41b45a,_0x485e6b){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x2f9e('0x1c')](_0x41b45a[_0x2f9e('0x18')],_0x41b45a[_0x2f9e('0x1d')]))[_0x2f9e('0x19')](respondWithResult(_0x485e6b,null))[_0x2f9e('0xe')](handleError(_0x485e6b,null));};exports[_0x2f9e('0x23')]=function(_0x2ef1b1,_0x505acd){return respondWithRpcPromise(_0x2f9e('0x24'),_[_0x2f9e('0x1c')](_0x2ef1b1[_0x2f9e('0x18')],_0x2ef1b1[_0x2f9e('0x1d')]))[_0x2f9e('0x19')](respondWithResult(_0x505acd,null))['catch'](handleError(_0x505acd,null));};exports[_0x2f9e('0x25')]=function(_0x2ff020,_0x26160e){return respondWithRpcPromise(_0x2f9e('0x26'),_[_0x2f9e('0x1c')](_0x2ff020[_0x2f9e('0x18')],_0x2ff020[_0x2f9e('0x1d')]))[_0x2f9e('0x19')](respondWithResult(_0x26160e,null))[_0x2f9e('0xe')](handleError(_0x26160e,null));};exports[_0x2f9e('0x27')]=function(_0x4338df,_0x14dfac){return respondWithRpcPromise(_0x2f9e('0x28'),_0x4338df[_0x2f9e('0x18')])[_0x2f9e('0x19')](respondWithResult(_0x14dfac,null))[_0x2f9e('0xe')](handleError(_0x14dfac,null));};exports[_0x2f9e('0x29')]=function(_0x27687e,_0x1dce1a){return respondWithRpcPromise(_0x2f9e('0x2a'),_0x27687e[_0x2f9e('0x18')])[_0x2f9e('0x19')](respondWithResult(_0x1dce1a,null))[_0x2f9e('0xe')](handleError(_0x1dce1a,null));};exports[_0x2f9e('0x2b')]=function(_0x2d353e,_0x55bedb){var _0x433b63;return respondWithRpcPromise(_0x2f9e('0x2c'),_0x2d353e['query'])[_0x2f9e('0x19')](function(_0x3c477b){_0x433b63=_0x3c477b;return respondWithRpcPromise(_0x2f9e('0x2c'),_0x2d353e[_0x2f9e('0x18')],routingClient);})[_0x2f9e('0x19')](function(_0x271223){return _['merge']({},_0x271223,_0x433b63);})['then'](respondWithResult(_0x55bedb,null))['catch'](handleError(_0x55bedb,null));};exports[_0x2f9e('0x2d')]=function(_0x36d74b,_0xfdd3ec){if(_0x36d74b['body']&&_0x36d74b[_0x2f9e('0x2e')][_0x2f9e('0x2f')]&&_0x36d74b[_0x2f9e('0x30')]&&_0x36d74b[_0x2f9e('0x30')][_0x2f9e('0x12')]){for(var _0x478a3d in _0x36d74b[_0x2f9e('0x2e')][_0x2f9e('0x2f')]){if(_0x36d74b[_0x2f9e('0x2e')]['interaction'][_0x2f9e('0x31')](_0x478a3d)){db[_0x2f9e('0x32')][_0x2f9e('0x33')]({'where':{'channel':_0x478a3d,'membername':_0x36d74b['user'][_0x2f9e('0x12')],'type':_0x2f9e('0x34'),'exitAt':null,'uniqueid':_0x36d74b['body'][_0x2f9e('0x2f')][_0x478a3d]&&_0x36d74b[_0x2f9e('0x2e')][_0x2f9e('0x2f')][_0x478a3d]['length']?{'$notIn':_0x36d74b['body'][_0x2f9e('0x2f')][_0x478a3d]}:{'$ne':null}}})['then'](function(_0x424f8f){var _0x30d9fe=moment()[_0x2f9e('0x35')](_0x2f9e('0x36'));for(var _0x5bf584=0x0,_0x9b8c3d=_0x424f8f[_0x2f9e('0x37')];_0x5bf584<_0x9b8c3d;_0x5bf584+=0x1){_0x424f8f[_0x5bf584][_0x2f9e('0x38')]({'exitAt':_0x30d9fe});}});for(var _0x22d0a1=0x0;_0x22d0a1<_0x36d74b[_0x2f9e('0x2e')][_0x2f9e('0x2f')][_0x478a3d]['length'];_0x22d0a1+=0x1){db[_0x2f9e('0x32')][_0x2f9e('0x39')]({'where':{'channel':_0x478a3d,'membername':_0x36d74b[_0x2f9e('0x30')]['name'],'type':_0x2f9e('0x34'),'uniqueid':_0x36d74b['body'][_0x2f9e('0x2f')][_0x478a3d][_0x22d0a1],'exitAt':null},'defaults':{'channel':_0x478a3d,'membername':_0x36d74b[_0x2f9e('0x30')][_0x2f9e('0x12')],'interface':_[_0x2f9e('0x3a')](_0x36d74b[_0x2f9e('0x30')][_0x2f9e('0x3b')])?util['format'](_0x2f9e('0x3c'),_0x36d74b['user'][_0x2f9e('0x12')]):_0x36d74b[_0x2f9e('0x30')][_0x2f9e('0x3b')],'type':_0x2f9e('0x34'),'enterAt':moment()[_0x2f9e('0x35')](_0x2f9e('0x36')),'role':'agent','internal':_0x36d74b['user'][_0x2f9e('0x3d')],'uniqueid':_0x36d74b[_0x2f9e('0x2e')][_0x2f9e('0x2f')][_0x478a3d][_0x22d0a1]}});}}}}return respondWithRpcPromise(_0x2f9e('0x3e'),{'id':_0x36d74b[_0x2f9e('0x1d')]['id'],'capacity':_0x36d74b[_0x2f9e('0x2e')][_0x2f9e('0x3f')]},routingClient)['then'](respondWithResult(_0xfdd3ec,null))['catch'](handleError(_0xfdd3ec,null));};exports[_0x2f9e('0x40')]=function(_0x2c24ee,_0x2d04fc){return respondWithRpcPromise('Telephones',_0x2c24ee[_0x2f9e('0x18')])[_0x2f9e('0x19')](respondWithResult(_0x2d04fc,null))[_0x2f9e('0xe')](handleError(_0x2d04fc,null));};exports['trunks']=function(_0x2bac31,_0x1c93a0){return respondWithRpcPromise(_0x2f9e('0x41'),_0x2bac31[_0x2f9e('0x18')])[_0x2f9e('0x19')](respondWithResult(_0x1c93a0,null))[_0x2f9e('0xe')](handleError(_0x1c93a0,null));};exports['campaigns']=function(_0x15cb33,_0x293501){return respondWithRpcPromise(_0x2f9e('0x42'),_0x15cb33[_0x2f9e('0x18')])['then'](respondWithResult(_0x293501,null))[_0x2f9e('0xe')](handleError(_0x293501,null));};exports[_0x2f9e('0x43')]=function(_0x36916f,_0xaffaaa){return respondWithRpcPromise(_0x2f9e('0x44'),_0x36916f['query'],routingClient)['then'](respondWithResult(_0xaffaaa,null))[_0x2f9e('0xe')](handleError(_0xaffaaa,null));};exports[_0x2f9e('0x45')]=function(_0x47859b,_0xda56a4){return respondWithRpcPromise(_0x2f9e('0x44'),_0x47859b[_0x2f9e('0x18')],routingClient)['then'](findById(_0x47859b[_0x2f9e('0x1d')]['id']))['then'](respondWithResult(_0xda56a4,null))['catch'](handleError(_0xda56a4,null));};exports[_0x2f9e('0x46')]=function(_0x2e192f,_0x3ca190){return respondWithRpcPromise(_0x2f9e('0x47'),_0x2e192f[_0x2f9e('0x18')],routingClient)[_0x2f9e('0x19')](respondWithResult(_0x3ca190,null))[_0x2f9e('0xe')](handleError(_0x3ca190,null));};exports[_0x2f9e('0x48')]=function(_0x36c504,_0x4b26cd){return respondWithRpcPromise(_0x2f9e('0x47'),_0x36c504['query'],routingClient)[_0x2f9e('0x19')](findById(_0x36c504[_0x2f9e('0x1d')]['id']))['then'](respondWithResult(_0x4b26cd,null))[_0x2f9e('0xe')](handleError(_0x4b26cd,null));};exports['mailAccounts']=function(_0x123de2,_0x2b4afe){return respondWithRpcPromise(_0x2f9e('0x49'),_0x123de2[_0x2f9e('0x18')],mailClient)[_0x2f9e('0x19')](respondWithResult(_0x2b4afe,null))[_0x2f9e('0xe')](handleError(_0x2b4afe,null));};exports[_0x2f9e('0x4a')]=function(_0x1ed1e8,_0x305cf1){return respondWithRpcPromise(_0x2f9e('0x4b'),_0x1ed1e8[_0x2f9e('0x18')],routingClient)[_0x2f9e('0x19')](respondWithResult(_0x305cf1,null))[_0x2f9e('0xe')](handleError(_0x305cf1,null));};exports[_0x2f9e('0x4c')]=function(_0x5d50cb,_0x17f656){return respondWithRpcPromise(_0x2f9e('0x4b'),_0x5d50cb['query'],routingClient)[_0x2f9e('0x19')](findById(_0x5d50cb['params']['id']))['then'](respondWithResult(_0x17f656,null))[_0x2f9e('0xe')](handleError(_0x17f656,null));};exports[_0x2f9e('0x4d')]=function(_0x476c59,_0x5a5705){return respondWithRpcPromise(_0x2f9e('0x4e'),_0x476c59[_0x2f9e('0x18')],routingClient)[_0x2f9e('0x19')](respondWithResult(_0x5a5705,null))['catch'](handleError(_0x5a5705,null));};exports[_0x2f9e('0x4f')]=function(_0x53fe6f,_0xf424e8){return respondWithRpcPromise(_0x2f9e('0x4e'),_0x53fe6f[_0x2f9e('0x18')],routingClient)[_0x2f9e('0x19')](findById(_0x53fe6f[_0x2f9e('0x1d')]['id']))[_0x2f9e('0x19')](respondWithResult(_0xf424e8,null))['catch'](handleError(_0xf424e8,null));};exports[_0x2f9e('0x50')]=function(_0x3bd339,_0x556705){return respondWithRpcPromise(_0x2f9e('0x51'),_0x3bd339['query'],routingClient)['then'](respondWithResult(_0x556705,null))[_0x2f9e('0xe')](handleError(_0x556705,null));};exports[_0x2f9e('0x52')]=function(_0x4e7903,_0xc40d45){return respondWithRpcPromise(_0x2f9e('0x51'),_0x4e7903[_0x2f9e('0x18')],routingClient)[_0x2f9e('0x19')](findById(_0x4e7903[_0x2f9e('0x1d')]['id']))[_0x2f9e('0x19')](respondWithResult(_0xc40d45,null))[_0x2f9e('0xe')](handleError(_0xc40d45,null));};exports[_0x2f9e('0x53')]=function(_0x4c09d0,_0x34f062){return respondWithRpcPromise(_0x2f9e('0x54'),_0x4c09d0[_0x2f9e('0x18')],routingClient)['then'](respondWithResult(_0x34f062,null))['catch'](handleError(_0x34f062,null));};exports[_0x2f9e('0x55')]=function(_0x200dd5,_0x17594f){return respondWithRpcPromise(_0x2f9e('0x54'),_0x200dd5[_0x2f9e('0x18')],routingClient)[_0x2f9e('0x19')](findById(_0x200dd5[_0x2f9e('0x1d')]['id']))[_0x2f9e('0x19')](respondWithResult(_0x17594f,null))[_0x2f9e('0xe')](handleError(_0x17594f,null));};exports['faxAccounts']=function(_0x4e44cb,_0x5ce7d5){return respondWithRpcPromise('FaxAccounts',_0x4e44cb['query'])[_0x2f9e('0x19')](respondWithResult(_0x5ce7d5,null))['catch'](handleError(_0x5ce7d5,null));};exports[_0x2f9e('0x56')]=function(_0x2d251c,_0x4ab651){return respondWithRpcPromise(_0x2f9e('0x57'),_0x2d251c[_0x2f9e('0x18')],routingClient)[_0x2f9e('0x19')](respondWithResult(_0x4ab651,null))[_0x2f9e('0xe')](handleError(_0x4ab651,null));};exports[_0x2f9e('0x58')]=function(_0x4c8511,_0x28b538){return respondWithRpcPromise(_0x2f9e('0x59'),_0x4c8511[_0x2f9e('0x18')],routingClient)[_0x2f9e('0x19')](respondWithResult(_0x28b538,null))[_0x2f9e('0xe')](handleError(_0x28b538,null));};exports[_0x2f9e('0x5a')]=function(_0x32cb2c,_0xe17f80){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x32cb2c[_0x2f9e('0x18')],routingClient)[_0x2f9e('0x19')](respondWithResult(_0xe17f80,null))['catch'](handleError(_0xe17f80,null));};exports[_0x2f9e('0x5b')]=function(_0x32eb58,_0x557989){return respondWithRpcPromise(_0x2f9e('0x5c'),_0x32eb58[_0x2f9e('0x18')],routingClient)['then'](respondWithResult(_0x557989,null))[_0x2f9e('0xe')](handleError(_0x557989,null));};exports[_0x2f9e('0x5d')]=function(_0x1d4182,_0x4f5a2c){return respondWithRpcPromise(_0x2f9e('0x5e'),_0x1d4182['query'],routingClient)[_0x2f9e('0x19')](respondWithResult(_0x4f5a2c,null))[_0x2f9e('0xe')](handleError(_0x4f5a2c,null));};exports[_0x2f9e('0x5f')]=function(_0x2c5752,_0x44939e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x2c5752['query'],routingClient)[_0x2f9e('0x19')](respondWithResult(_0x44939e,null))[_0x2f9e('0xe')](handleError(_0x44939e,null));};exports[_0x2f9e('0x60')]=function(_0x330039){return function(_0x2b1b07,_0x1e0782){var _0x4b332b,_0x7ef1e7;var _0x57fd0=_['capitalize'](_0x330039);var _0x37f3bc=_0x330039===_0x2f9e('0x61')?'Website':_0x2f9e('0x62');return db[_0x57fd0+_0x2f9e('0x63')][_0x2f9e('0x64')]({'raw':!![],'where':{'id':_0x2b1b07[_0x2f9e('0x1d')]['id']}})[_0x2f9e('0x19')](function(_0x118b4a){if(_[_0x2f9e('0x3a')](_0x118b4a)){throw new Error(_0x57fd0+'\x20Queue\x20not\x20found');}_0x4b332b=_0x118b4a;return db[_0x57fd0+_0x2f9e('0x65')][_0x2f9e('0x64')]({'where':{'id':_0x2b1b07[_0x2f9e('0x2e')][_0x2f9e('0x66')]},'include':[{'model':db[_0x57fd0+_0x2f9e('0x67')],'as':_0x2f9e('0x67')},{'model':db[_0x57fd0+_0x37f3bc],'as':'Account'}]});})[_0x2f9e('0x19')](function(_0xfb072d){if(_['isNil'](_0xfb072d)){throw new Error(_0x57fd0+_0x2f9e('0x68'));}_0x7ef1e7=_0xfb072d;return _0xfb072d[_0x2f9e('0x69')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x8d54d9={'uniqueid':_0x330039+'.'+_0x7ef1e7['id']+'.'+_0x7ef1e7[_0x2f9e('0x67')]['id'],'FromUserId':_0x2b1b07[_0x2f9e('0x30')]['id'],'type':'queue'};_0x8d54d9[_0x57fd0+'MessageId']=_0x7ef1e7['id'];_0x8d54d9[_0x57fd0+'InteractionId']=_0x7ef1e7[_0x2f9e('0x67')]['id'];_0x8d54d9[_0x2f9e('0x6a')+_0x57fd0+_0x37f3bc+'Id']=_0x7ef1e7[_0x2f9e('0x62')]['id'];_0x8d54d9['To'+_0x57fd0+_0x2f9e('0x6b')]=_0x4b332b['id'];return db[_0x57fd0+_0x2f9e('0x6c')][_0x2f9e('0x6d')](_0x8d54d9);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x330039,'interaction':_0x7ef1e7[_0x2f9e('0x67')],'message':_0x7ef1e7,'account':_0x7ef1e7[_0x2f9e('0x62')],'applications':[{'id':0x0,'priority':0x1,'app':_0x2f9e('0x6e'),'appdata':_0x4b332b[_0x2f9e('0x12')]+','+(_0x7ef1e7['Account'][_0x2f9e('0x6f')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x2f9e('0x19')](respondWithResult(_0x1e0782,null))[_0x2f9e('0xe')](handleError(_0x1e0782,null));};};exports['agentNotify']=function(_0x1dc394,_0x3afbe4){var _0x5c7446,_0x13d29d;if(_[_0x2f9e('0x3a')](_0x1dc394[_0x2f9e('0x2e')]['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x49d18a=_0x1dc394[_0x2f9e('0x2e')][_0x2f9e('0x70')];var _0x16eaf8=_[_0x2f9e('0x71')](_0x49d18a);var _0x18aa19=_0x49d18a===_0x2f9e('0x61')?'Website':_0x2f9e('0x62');return db[_0x2f9e('0x72')][_0x2f9e('0x64')]({'raw':!![],'where':{'id':_0x1dc394['params']['id'],'role':_0x2f9e('0x73')}})['then'](function(_0x3c961c){if(_[_0x2f9e('0x3a')](_0x3c961c)){throw new Error('Agent\x20not\x20found');}_0x5c7446=_0x3c961c;return db[_0x16eaf8+_0x2f9e('0x65')][_0x2f9e('0x64')]({'where':{'id':_0x1dc394['body']['messageId']},'include':[{'model':db[_0x16eaf8+'Interaction'],'as':_0x2f9e('0x67')},{'model':db[_0x16eaf8+_0x18aa19],'as':_0x2f9e('0x62')}]});})[_0x2f9e('0x19')](function(_0x33fbb0){if(_[_0x2f9e('0x3a')](_0x33fbb0)){throw new Error(_0x16eaf8+_0x2f9e('0x68'));}_0x13d29d=_0x33fbb0;return _0x33fbb0[_0x2f9e('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x2f9e('0x19')](function(){var _0x3a9a72={'uniqueid':_0x49d18a+'.'+_0x13d29d['id']+'.'+_0x13d29d['Interaction']['id'],'FromUserId':_0x1dc394['user']['id'],'type':_0x2f9e('0x6e'),'ToUserId':_0x5c7446['id']};_0x3a9a72[_0x16eaf8+_0x2f9e('0x74')]=_0x13d29d['id'];_0x3a9a72[_0x16eaf8+_0x2f9e('0x75')]=_0x13d29d['Interaction']['id'];_0x3a9a72[_0x2f9e('0x6a')+_0x16eaf8+_0x18aa19+'Id']=_0x13d29d[_0x2f9e('0x62')]['id'];return db[_0x16eaf8+_0x2f9e('0x6c')][_0x2f9e('0x6d')](_0x3a9a72);})[_0x2f9e('0x19')](function(){return respondWithRpcPromise(_0x2f9e('0x76'),{'channel':_0x49d18a,'interaction':_0x13d29d[_0x2f9e('0x67')],'message':_0x13d29d,'account':_0x13d29d[_0x2f9e('0x62')],'applications':[{'id':0x0,'priority':0x1,'app':_0x2f9e('0x73'),'appdata':_0x5c7446[_0x2f9e('0x12')]+','+(_0x13d29d[_0x2f9e('0x62')][_0x2f9e('0x77')]||0x12c),'interval':_0x2f9e('0x78')}]},routingClient);})[_0x2f9e('0x19')](respondWithResult(_0x3afbe4,null))[_0x2f9e('0xe')](handleError(_0x3afbe4,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 81f6710..b549101 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 _0x4cef=['/:id','post','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x10afad,_0x30da9d){var _0x588d7e=function(_0x25e897){while(--_0x25e897){_0x10afad['push'](_0x10afad['shift']());}};_0x588d7e(++_0x30da9d);}(_0x4cef,0x16c));var _0xf4ce=function(_0x50ff1e,_0x306229){_0x50ff1e=_0x50ff1e-0x0;var _0x16c0fb=_0x4cef[_0x50ff1e];return _0x16c0fb;};'use strict';var multer=require(_0xf4ce('0x0'));var util=require('util');var path=require(_0xf4ce('0x1'));var timeout=require('connect-timeout');var express=require(_0xf4ce('0x2'));var router=express[_0xf4ce('0x3')]();var auth=require(_0xf4ce('0x4'));var interaction=require(_0xf4ce('0x5'));var config=require(_0xf4ce('0x6'));var controller=require('./schedule.controller');router[_0xf4ce('0x7')]('/',auth[_0xf4ce('0x8')](),controller[_0xf4ce('0x9')]);router['get'](_0xf4ce('0xa'),auth[_0xf4ce('0x8')](),controller['show']);router['get']('/:id/run',auth[_0xf4ce('0x8')](),controller['run']);router[_0xf4ce('0xb')]('/',auth[_0xf4ce('0x8')](),controller['create']);router[_0xf4ce('0xc')]('/:id',auth[_0xf4ce('0x8')](),controller[_0xf4ce('0xd')]);router[_0xf4ce('0xe')]('/:id',auth[_0xf4ce('0x8')](),controller[_0xf4ce('0xf')]);module[_0xf4ce('0x10')]=router; \ No newline at end of file +var _0x8021=['isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./schedule.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8021,0x1c3));var _0x1802=function(_0x524efa,_0xbe406e){_0x524efa=_0x524efa-0x0;var _0x775cd5=_0x8021[_0x524efa];return _0x775cd5;};'use strict';var multer=require(_0x1802('0x0'));var util=require('util');var path=require(_0x1802('0x1'));var timeout=require(_0x1802('0x2'));var express=require(_0x1802('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1802('0x4'));var config=require(_0x1802('0x5'));var controller=require(_0x1802('0x6'));router[_0x1802('0x7')]('/',auth[_0x1802('0x8')](),controller['index']);router[_0x1802('0x7')](_0x1802('0x9'),auth[_0x1802('0x8')](),controller[_0x1802('0xa')]);router['get']('/:id/run',auth[_0x1802('0x8')](),controller['run']);router['post']('/',auth[_0x1802('0x8')](),controller[_0x1802('0xb')]);router[_0x1802('0xc')]('/:id',auth[_0x1802('0x8')](),controller[_0x1802('0xd')]);router[_0x1802('0xe')]('/:id',auth[_0x1802('0x8')](),controller[_0x1802('0xf')]);module[_0x1802('0x10')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 3afeb52..11579eb 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 _0x44c2=['DATE','INTEGER','ENUM','months','days','pdf','default','BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0x44c2,0x100));var _0x244c=function(_0x445101,_0x2414bf){_0x445101=_0x445101-0x0;var _0x3c3d04=_0x44c2[_0x445101];return _0x3c3d04;};'use strict';var Sequelize=require(_0x244c('0x0'));module[_0x244c('0x1')]={'name':{'type':Sequelize[_0x244c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x244c('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x244c('0x2')],'allowNull':![],'defaultValue':_0x244c('0x3')},'startAt':{'type':Sequelize[_0x244c('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x244c('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x244c('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x244c('0x6')]('years','quarters',_0x244c('0x7'),'weeks',_0x244c('0x8'),'hours','minutes'),'allowNull':![],'defaultValue':_0x244c('0x8')},'output':{'type':Sequelize[_0x244c('0x6')]('csv',_0x244c('0x9'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x244c('0x6')]('custom',_0x244c('0xa')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x244c('0xb')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x244c('0xc')]},'sendIfEmpty':{'type':Sequelize[_0x244c('0xb')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4753=['ENUM','csv','pdf','xlsx','default','custom','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','quarters','months','days','hours','minutes'];(function(_0x51904f,_0x2af5bf){var _0x4d9eb=function(_0x17da1a){while(--_0x17da1a){_0x51904f['push'](_0x51904f['shift']());}};_0x4d9eb(++_0x2af5bf);}(_0x4753,0x1f4));var _0x3475=function(_0x53525e,_0x388b24){_0x53525e=_0x53525e-0x0;var _0x2a5361=_0x4753[_0x53525e];return _0x2a5361;};'use strict';var Sequelize=require(_0x3475('0x0'));module[_0x3475('0x1')]={'name':{'type':Sequelize[_0x3475('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x3475('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x3475('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x3475('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0x3475('0x5'),_0x3475('0x6'),'weeks',_0x3475('0x7'),_0x3475('0x8'),_0x3475('0x9')),'allowNull':![],'defaultValue':_0x3475('0x7')},'output':{'type':Sequelize[_0x3475('0xa')](_0x3475('0xb'),_0x3475('0xc'),_0x3475('0xd')),'allowNull':![],'defaultValue':_0x3475('0xb')},'type':{'type':Sequelize[_0x3475('0xa')]('custom',_0x3475('0xe')),'allowNull':![],'defaultValue':_0x3475('0xf')},'sendMail':{'type':Sequelize[_0x3475('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x3475('0x10')]},'bcc':{'type':Sequelize[_0x3475('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 78aaaaa..77440f7 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 _0x6c81=['user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','Scheduler','UserProfileResource','error','stack','name','index','map','Schedule','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x6c81,0x10c));var _0x16c8=function(_0x34a32e,_0x26f089){_0x34a32e=_0x34a32e-0x0;var _0x24ca9b=_0x6c81[_0x34a32e];return _0x24ca9b;};'use strict';var pdf=require(_0x16c8('0x0'));var emlformat=require(_0x16c8('0x1'));var rimraf=require(_0x16c8('0x2'));var zipdir=require(_0x16c8('0x3'));var jsonpatch=require(_0x16c8('0x4'));var rp=require(_0x16c8('0x5'));var moment=require('moment');var BPromise=require(_0x16c8('0x6'));var Mustache=require(_0x16c8('0x7'));var util=require(_0x16c8('0x8'));var path=require(_0x16c8('0x9'));var sox=require(_0x16c8('0xa'));var csv=require(_0x16c8('0xb'));var ejs=require(_0x16c8('0xc'));var fs=require('fs');var _=require(_0x16c8('0xd'));var squel=require(_0x16c8('0xe'));var crypto=require(_0x16c8('0xf'));var jsforce=require(_0x16c8('0x10'));var deskjs=require(_0x16c8('0x11'));var toCsv=require(_0x16c8('0xb'));var querystring=require(_0x16c8('0x12'));var Papa=require(_0x16c8('0x13'));var Redis=require(_0x16c8('0x14'));var authService=require(_0x16c8('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x16c8('0x16'));var hardwareService=require(_0x16c8('0x17'));var logger=require(_0x16c8('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x16c8('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x316977,_0x44898d){_0x44898d=_0x44898d||0xcc;return function(_0x19d21c){if(_0x19d21c){return _0x316977[_0x16c8('0x1a')](_0x44898d);}return _0x316977[_0x16c8('0x1b')](_0x44898d)['end']();};}function respondWithResult(_0x21ce8f,_0x5efdbd){_0x5efdbd=_0x5efdbd||0xc8;return function(_0xb2bab8){if(_0xb2bab8){return _0x21ce8f[_0x16c8('0x1b')](_0x5efdbd)['json'](_0xb2bab8);}};}function respondWithFilteredResult(_0x3a31e0,_0x3ab995){return function(_0x4a5a44){if(_0x4a5a44){var _0x2efae9=_0x4a5a44[_0x16c8('0x1c')],_0x4b82a9=_0x3ab995[_0x16c8('0x1d')],_0x1c2894=_0x3ab995['offset']+_0x3ab995[_0x16c8('0x1e')],_0x258bcb;if(_0x1c2894>=_0x2efae9){_0x1c2894=_0x2efae9;_0x258bcb=0xc8;}else{_0x258bcb=0xce;}_0x3a31e0[_0x16c8('0x1b')](_0x258bcb);return _0x3a31e0[_0x16c8('0x1f')](_0x16c8('0x20'),_0x4b82a9+'-'+_0x1c2894+'/'+_0x2efae9)[_0x16c8('0x21')](_0x4a5a44);}return null;};}function patchUpdates(_0x17869a){return function(_0x52ba40){try{jsonpatch[_0x16c8('0x22')](_0x52ba40,_0x17869a,!![]);}catch(_0xf49ce1){return BPromise['reject'](_0xf49ce1);}return _0x52ba40[_0x16c8('0x23')]();};}function saveUpdates(_0x55d385,_0x5d1fd7){return function(_0x331be4){if(_0x331be4){return _0x331be4[_0x16c8('0x24')](_0x55d385)[_0x16c8('0x25')](function(_0x3c5cb9){return _0x3c5cb9;});}return null;};}function removeEntity(_0x36c549,_0x499511){return function(_0x2ac50b){if(_0x2ac50b){return _0x2ac50b[_0x16c8('0x26')]()[_0x16c8('0x25')](function(){var _0x550c64=_0x2ac50b['get']({'plain':!![]});var _0x43bcfa=_0x16c8('0x27');return db[_0x16c8('0x28')]['destroy']({'where':{'type':_0x43bcfa,'resourceId':_0x550c64['id']}})[_0x16c8('0x25')](function(){return _0x2ac50b;});})[_0x16c8('0x25')](function(){_0x36c549[_0x16c8('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x297c2f,_0x288bea){return function(_0xabfebd){if(!_0xabfebd){_0x297c2f[_0x16c8('0x1a')](0x194);}return _0xabfebd;};}function handleError(_0x1b7608,_0x3716d7){_0x3716d7=_0x3716d7||0x1f4;return function(_0x5102f6){logger[_0x16c8('0x29')](_0x5102f6[_0x16c8('0x2a')]);if(_0x5102f6[_0x16c8('0x2b')]){delete _0x5102f6['name'];}_0x1b7608[_0x16c8('0x1b')](_0x3716d7)['send'](_0x5102f6);};}exports[_0x16c8('0x2c')]=function(_0x44ed45,_0x502c78){var _0x358f10={},_0x4cbe46={},_0x5434c2={'count':0x0,'rows':[]};var _0x292986=_[_0x16c8('0x2d')](db[_0x16c8('0x2e')][_0x16c8('0x2f')],function(_0x2e30c7){return{'name':_0x2e30c7[_0x16c8('0x30')],'type':_0x2e30c7[_0x16c8('0x31')][_0x16c8('0x32')]};});_0x4cbe46[_0x16c8('0x33')]=_['map'](_0x292986,_0x16c8('0x2b'));_0x4cbe46['query']=_[_0x16c8('0x34')](_0x44ed45['query']);_0x4cbe46['filters']=_[_0x16c8('0x35')](_0x4cbe46[_0x16c8('0x33')],_0x4cbe46[_0x16c8('0x36')]);_0x358f10[_0x16c8('0x37')]=_[_0x16c8('0x35')](_0x4cbe46['model'],qs[_0x16c8('0x38')](_0x44ed45[_0x16c8('0x36')][_0x16c8('0x38')]));_0x358f10[_0x16c8('0x37')]=_0x358f10[_0x16c8('0x37')][_0x16c8('0x39')]?_0x358f10['attributes']:_0x4cbe46[_0x16c8('0x33')];if(!_0x44ed45[_0x16c8('0x36')][_0x16c8('0x3a')](_0x16c8('0x3b'))){_0x358f10[_0x16c8('0x1e')]=qs[_0x16c8('0x1e')](_0x44ed45[_0x16c8('0x36')][_0x16c8('0x1e')]);_0x358f10[_0x16c8('0x1d')]=qs[_0x16c8('0x1d')](_0x44ed45[_0x16c8('0x36')]['offset']);}_0x358f10[_0x16c8('0x3c')]=qs[_0x16c8('0x3d')](_0x44ed45[_0x16c8('0x36')][_0x16c8('0x3d')]);_0x358f10['where']=qs['filters'](_[_0x16c8('0x3e')](_0x44ed45['query'],_0x4cbe46[_0x16c8('0x3f')]),_0x292986);if(_0x44ed45[_0x16c8('0x36')][_0x16c8('0x40')]){_0x358f10[_0x16c8('0x41')]=_['merge'](_0x358f10['where'],{'$or':_['map'](_0x292986,function(_0x1fafd8){if(_0x1fafd8[_0x16c8('0x31')]!=='VIRTUAL'){var _0x3c2613={};_0x3c2613[_0x1fafd8[_0x16c8('0x2b')]]={'$like':'%'+_0x44ed45[_0x16c8('0x36')][_0x16c8('0x40')]+'%'};return _0x3c2613;}})});}_0x358f10=_[_0x16c8('0x42')]({},_0x358f10,_0x44ed45[_0x16c8('0x43')]);var _0x5b8805={'where':_0x358f10[_0x16c8('0x41')]};return db['Schedule'][_0x16c8('0x1c')](_0x5b8805)[_0x16c8('0x25')](function(_0x58b838){_0x5434c2[_0x16c8('0x1c')]=_0x58b838;if(_0x44ed45[_0x16c8('0x36')][_0x16c8('0x44')]){_0x358f10['include']=[{'all':!![]}];}return db[_0x16c8('0x2e')][_0x16c8('0x45')](_0x358f10);})[_0x16c8('0x25')](function(_0x1905b3){_0x5434c2[_0x16c8('0x46')]=_0x1905b3;return _0x5434c2;})[_0x16c8('0x25')](respondWithFilteredResult(_0x502c78,_0x358f10))[_0x16c8('0x47')](handleError(_0x502c78,null));};exports[_0x16c8('0x48')]=function(_0x518712,_0x6c3a63){var _0x2f2fd7={'raw':![],'where':{'id':_0x518712[_0x16c8('0x49')]['id']}},_0x29160d={};_0x29160d['model']=_['keys'](db[_0x16c8('0x2e')][_0x16c8('0x2f')]);_0x29160d[_0x16c8('0x36')]=_['keys'](_0x518712[_0x16c8('0x36')]);_0x29160d[_0x16c8('0x3f')]=_[_0x16c8('0x35')](_0x29160d[_0x16c8('0x33')],_0x29160d[_0x16c8('0x36')]);_0x2f2fd7['attributes']=_[_0x16c8('0x35')](_0x29160d[_0x16c8('0x33')],qs[_0x16c8('0x38')](_0x518712['query'][_0x16c8('0x38')]));_0x2f2fd7[_0x16c8('0x37')]=_0x2f2fd7[_0x16c8('0x37')]['length']?_0x2f2fd7[_0x16c8('0x37')]:_0x29160d['model'];if(_0x518712[_0x16c8('0x36')][_0x16c8('0x44')]){_0x2f2fd7[_0x16c8('0x4a')]=[{'all':!![]}];}_0x2f2fd7=_[_0x16c8('0x42')]({},_0x2f2fd7,_0x518712['options']);return db['Schedule'][_0x16c8('0x4b')](_0x2f2fd7)[_0x16c8('0x25')](handleEntityNotFound(_0x6c3a63,null))['then'](respondWithResult(_0x6c3a63,null))[_0x16c8('0x47')](handleError(_0x6c3a63,null));};exports[_0x16c8('0x4c')]=function(_0x397cbc,_0x329e09){return db[_0x16c8('0x2e')][_0x16c8('0x4c')](_0x397cbc['body'],{})[_0x16c8('0x25')](function(_0x2b8359){var _0x298361=_0x397cbc['user'][_0x16c8('0x4d')]({'plain':!![]});if(!_0x298361)throw new Error(_0x16c8('0x4e'));if(_0x298361[_0x16c8('0x4f')]===_0x16c8('0x50')){var _0xee0a20=_0x2b8359['get']({'plain':!![]});var _0x28a202='Scheduler';return db[_0x16c8('0x51')]['find']({'where':{'name':_0x28a202,'userProfileId':_0x298361[_0x16c8('0x52')]},'raw':!![]})['then'](function(_0x21d086){if(_0x21d086&&_0x21d086[_0x16c8('0x53')]===0x0){return db[_0x16c8('0x28')]['create']({'name':_0xee0a20[_0x16c8('0x2b')],'resourceId':_0xee0a20['id'],'type':_0x21d086[_0x16c8('0x2b')],'sectionId':_0x21d086['id']},{})[_0x16c8('0x25')](function(){return _0x2b8359;});}else{return _0x2b8359;}})[_0x16c8('0x47')](function(_0x48f98f){logger['error'](_0x16c8('0x54'),_0x48f98f);throw _0x48f98f;});}return _0x2b8359;})[_0x16c8('0x25')](respondWithResult(_0x329e09,0xc9))[_0x16c8('0x47')](handleError(_0x329e09,null));};exports[_0x16c8('0x24')]=function(_0x5c06ce,_0x41d67a){if(_0x5c06ce['body']['id']){delete _0x5c06ce[_0x16c8('0x55')]['id'];}return db['Schedule']['find']({'where':{'id':_0x5c06ce['params']['id']}})[_0x16c8('0x25')](handleEntityNotFound(_0x41d67a,null))['then'](saveUpdates(_0x5c06ce[_0x16c8('0x55')],null))[_0x16c8('0x25')](respondWithResult(_0x41d67a,null))[_0x16c8('0x47')](handleError(_0x41d67a,null));};exports[_0x16c8('0x26')]=function(_0xe92d0f,_0x1d1cbe){return db[_0x16c8('0x2e')][_0x16c8('0x4b')]({'where':{'id':_0xe92d0f[_0x16c8('0x49')]['id']}})[_0x16c8('0x25')](handleEntityNotFound(_0x1d1cbe,null))[_0x16c8('0x25')](removeEntity(_0x1d1cbe,null))[_0x16c8('0x47')](handleError(_0x1d1cbe,null));};exports[_0x16c8('0x56')]=function(_0x1b97a5,_0x4e8aeb,_0x166714){var _0x11ace1=require('../../config/schedule');return db[_0x16c8('0x2e')]['find']({'where':{'id':_0x1b97a5[_0x16c8('0x49')]['id']},'raw':!![]})[_0x16c8('0x25')](handleEntityNotFound(_0x4e8aeb,null))[_0x16c8('0x25')](function(){_0x11ace1[_0x16c8('0x56')](_0x1b97a5['params']['id']);})[_0x16c8('0x25')](respondWithStatusCode(_0x4e8aeb,null))[_0x16c8('0x47')](handleError(_0x4e8aeb,null));}; \ No newline at end of file +var _0x5262=['VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','stack','name','send','index','map','Schedule','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x4b91c4,_0x23f35f){var _0x25cb80=function(_0x48e283){while(--_0x48e283){_0x4b91c4['push'](_0x4b91c4['shift']());}};_0x25cb80(++_0x23f35f);}(_0x5262,0xc2));var _0x2526=function(_0x2aa046,_0xe7b01e){_0x2aa046=_0x2aa046-0x0;var _0x1a182d=_0x5262[_0x2aa046];return _0x1a182d;};'use strict';var pdf=require(_0x2526('0x0'));var emlformat=require(_0x2526('0x1'));var rimraf=require(_0x2526('0x2'));var zipdir=require(_0x2526('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2526('0x4'));var moment=require(_0x2526('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2526('0x6'));var path=require(_0x2526('0x7'));var sox=require(_0x2526('0x8'));var csv=require(_0x2526('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2526('0xa'));var squel=require(_0x2526('0xb'));var crypto=require(_0x2526('0xc'));var jsforce=require(_0x2526('0xd'));var deskjs=require(_0x2526('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2526('0xf'));var Papa=require('papaparse');var Redis=require(_0x2526('0x10'));var authService=require(_0x2526('0x11'));var qs=require(_0x2526('0x12'));var as=require(_0x2526('0x13'));var hardwareService=require(_0x2526('0x14'));var logger=require(_0x2526('0x15'))(_0x2526('0x16'));var utils=require('../../config/utils');var config=require(_0x2526('0x17'));var db=require(_0x2526('0x18'))['db'];function respondWithStatusCode(_0xeb75d8,_0x2c80c2){_0x2c80c2=_0x2c80c2||0xcc;return function(_0x411ae9){if(_0x411ae9){return _0xeb75d8[_0x2526('0x19')](_0x2c80c2);}return _0xeb75d8['status'](_0x2c80c2)['end']();};}function respondWithResult(_0x4fe9cd,_0x4ab2cd){_0x4ab2cd=_0x4ab2cd||0xc8;return function(_0x216996){if(_0x216996){return _0x4fe9cd[_0x2526('0x1a')](_0x4ab2cd)[_0x2526('0x1b')](_0x216996);}};}function respondWithFilteredResult(_0x44da9a,_0x8a260c){return function(_0x3bb13d){if(_0x3bb13d){var _0x258dff=_0x3bb13d[_0x2526('0x1c')],_0x589524=_0x8a260c[_0x2526('0x1d')],_0x5ca5ae=_0x8a260c[_0x2526('0x1d')]+_0x8a260c[_0x2526('0x1e')],_0x574e90;if(_0x5ca5ae>=_0x258dff){_0x5ca5ae=_0x258dff;_0x574e90=0xc8;}else{_0x574e90=0xce;}_0x44da9a[_0x2526('0x1a')](_0x574e90);return _0x44da9a[_0x2526('0x1f')](_0x2526('0x20'),_0x589524+'-'+_0x5ca5ae+'/'+_0x258dff)['json'](_0x3bb13d);}return null;};}function patchUpdates(_0x5c4bc3){return function(_0x4f4dc5){try{jsonpatch[_0x2526('0x21')](_0x4f4dc5,_0x5c4bc3,!![]);}catch(_0x34bdfb){return BPromise[_0x2526('0x22')](_0x34bdfb);}return _0x4f4dc5[_0x2526('0x23')]();};}function saveUpdates(_0x4ae638,_0x26abcb){return function(_0x3a2a2e){if(_0x3a2a2e){return _0x3a2a2e[_0x2526('0x24')](_0x4ae638)[_0x2526('0x25')](function(_0xeb3147){return _0xeb3147;});}return null;};}function removeEntity(_0x35db8c,_0x1c425c){return function(_0x21130b){if(_0x21130b){return _0x21130b[_0x2526('0x26')]()[_0x2526('0x25')](function(){var _0x395fa0=_0x21130b[_0x2526('0x27')]({'plain':!![]});var _0x48928e=_0x2526('0x28');return db[_0x2526('0x29')][_0x2526('0x26')]({'where':{'type':_0x48928e,'resourceId':_0x395fa0['id']}})['then'](function(){return _0x21130b;});})['then'](function(){_0x35db8c[_0x2526('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x484ea7,_0x548a5e){return function(_0x2761a3){if(!_0x2761a3){_0x484ea7[_0x2526('0x19')](0x194);}return _0x2761a3;};}function handleError(_0x2db1a3,_0xe147bc){_0xe147bc=_0xe147bc||0x1f4;return function(_0x58ced4){logger['error'](_0x58ced4[_0x2526('0x2a')]);if(_0x58ced4[_0x2526('0x2b')]){delete _0x58ced4[_0x2526('0x2b')];}_0x2db1a3['status'](_0xe147bc)[_0x2526('0x2c')](_0x58ced4);};}exports[_0x2526('0x2d')]=function(_0x1c4c42,_0xcc455){var _0x54b8ac={},_0x5e2ac4={},_0x5c7c6a={'count':0x0,'rows':[]};var _0x590974=_[_0x2526('0x2e')](db[_0x2526('0x2f')]['rawAttributes'],function(_0x1faecd){return{'name':_0x1faecd['fieldName'],'type':_0x1faecd['type'][_0x2526('0x30')]};});_0x5e2ac4['model']=_['map'](_0x590974,'name');_0x5e2ac4['query']=_[_0x2526('0x31')](_0x1c4c42[_0x2526('0x32')]);_0x5e2ac4[_0x2526('0x33')]=_[_0x2526('0x34')](_0x5e2ac4['model'],_0x5e2ac4['query']);_0x54b8ac['attributes']=_[_0x2526('0x34')](_0x5e2ac4[_0x2526('0x35')],qs[_0x2526('0x36')](_0x1c4c42['query'][_0x2526('0x36')]));_0x54b8ac[_0x2526('0x37')]=_0x54b8ac['attributes'][_0x2526('0x38')]?_0x54b8ac[_0x2526('0x37')]:_0x5e2ac4['model'];if(!_0x1c4c42[_0x2526('0x32')][_0x2526('0x39')]('nolimit')){_0x54b8ac[_0x2526('0x1e')]=qs[_0x2526('0x1e')](_0x1c4c42[_0x2526('0x32')][_0x2526('0x1e')]);_0x54b8ac[_0x2526('0x1d')]=qs['offset'](_0x1c4c42[_0x2526('0x32')][_0x2526('0x1d')]);}_0x54b8ac[_0x2526('0x3a')]=qs[_0x2526('0x3b')](_0x1c4c42[_0x2526('0x32')][_0x2526('0x3b')]);_0x54b8ac[_0x2526('0x3c')]=qs[_0x2526('0x33')](_[_0x2526('0x3d')](_0x1c4c42['query'],_0x5e2ac4[_0x2526('0x33')]),_0x590974);if(_0x1c4c42[_0x2526('0x32')][_0x2526('0x3e')]){_0x54b8ac['where']=_[_0x2526('0x3f')](_0x54b8ac[_0x2526('0x3c')],{'$or':_[_0x2526('0x2e')](_0x590974,function(_0x232d70){if(_0x232d70['type']!==_0x2526('0x40')){var _0x3249f2={};_0x3249f2[_0x232d70[_0x2526('0x2b')]]={'$like':'%'+_0x1c4c42[_0x2526('0x32')][_0x2526('0x3e')]+'%'};return _0x3249f2;}})});}_0x54b8ac=_[_0x2526('0x3f')]({},_0x54b8ac,_0x1c4c42[_0x2526('0x41')]);var _0x12b9fb={'where':_0x54b8ac['where']};return db[_0x2526('0x2f')]['count'](_0x12b9fb)[_0x2526('0x25')](function(_0x5e5ea1){_0x5c7c6a[_0x2526('0x1c')]=_0x5e5ea1;if(_0x1c4c42[_0x2526('0x32')][_0x2526('0x42')]){_0x54b8ac[_0x2526('0x43')]=[{'all':!![]}];}return db[_0x2526('0x2f')]['findAll'](_0x54b8ac);})[_0x2526('0x25')](function(_0xe11988){_0x5c7c6a[_0x2526('0x44')]=_0xe11988;return _0x5c7c6a;})[_0x2526('0x25')](respondWithFilteredResult(_0xcc455,_0x54b8ac))[_0x2526('0x45')](handleError(_0xcc455,null));};exports[_0x2526('0x46')]=function(_0x1b58f1,_0x5ade4d){var _0x212d64={'raw':![],'where':{'id':_0x1b58f1[_0x2526('0x47')]['id']}},_0xd055fe={};_0xd055fe[_0x2526('0x35')]=_['keys'](db['Schedule'][_0x2526('0x48')]);_0xd055fe[_0x2526('0x32')]=_[_0x2526('0x31')](_0x1b58f1[_0x2526('0x32')]);_0xd055fe[_0x2526('0x33')]=_[_0x2526('0x34')](_0xd055fe[_0x2526('0x35')],_0xd055fe['query']);_0x212d64[_0x2526('0x37')]=_[_0x2526('0x34')](_0xd055fe[_0x2526('0x35')],qs['fields'](_0x1b58f1['query'][_0x2526('0x36')]));_0x212d64[_0x2526('0x37')]=_0x212d64[_0x2526('0x37')][_0x2526('0x38')]?_0x212d64[_0x2526('0x37')]:_0xd055fe['model'];if(_0x1b58f1[_0x2526('0x32')][_0x2526('0x42')]){_0x212d64[_0x2526('0x43')]=[{'all':!![]}];}_0x212d64=_['merge']({},_0x212d64,_0x1b58f1[_0x2526('0x41')]);return db[_0x2526('0x2f')][_0x2526('0x49')](_0x212d64)['then'](handleEntityNotFound(_0x5ade4d,null))[_0x2526('0x25')](respondWithResult(_0x5ade4d,null))[_0x2526('0x45')](handleError(_0x5ade4d,null));};exports[_0x2526('0x4a')]=function(_0x296742,_0x41353f){return db['Schedule']['create'](_0x296742['body'],{})[_0x2526('0x25')](function(_0xf09ed){var _0x551771=_0x296742[_0x2526('0x4b')][_0x2526('0x27')]({'plain':!![]});if(!_0x551771)throw new Error(_0x2526('0x4c'));if(_0x551771[_0x2526('0x4d')]==='user'){var _0x2a7498=_0xf09ed[_0x2526('0x27')]({'plain':!![]});var _0x493968=_0x2526('0x28');return db[_0x2526('0x4e')][_0x2526('0x49')]({'where':{'name':_0x493968,'userProfileId':_0x551771[_0x2526('0x4f')]},'raw':!![]})[_0x2526('0x25')](function(_0x5bd270){if(_0x5bd270&&_0x5bd270[_0x2526('0x50')]===0x0){return db[_0x2526('0x29')][_0x2526('0x4a')]({'name':_0x2a7498[_0x2526('0x2b')],'resourceId':_0x2a7498['id'],'type':_0x5bd270['name'],'sectionId':_0x5bd270['id']},{})[_0x2526('0x25')](function(){return _0xf09ed;});}else{return _0xf09ed;}})[_0x2526('0x45')](function(_0x17b84a){logger[_0x2526('0x51')](_0x2526('0x52'),_0x17b84a);throw _0x17b84a;});}return _0xf09ed;})['then'](respondWithResult(_0x41353f,0xc9))[_0x2526('0x45')](handleError(_0x41353f,null));};exports['update']=function(_0x39ceee,_0x5a31f8){if(_0x39ceee[_0x2526('0x53')]['id']){delete _0x39ceee['body']['id'];}return db['Schedule'][_0x2526('0x49')]({'where':{'id':_0x39ceee[_0x2526('0x47')]['id']}})[_0x2526('0x25')](handleEntityNotFound(_0x5a31f8,null))[_0x2526('0x25')](saveUpdates(_0x39ceee[_0x2526('0x53')],null))[_0x2526('0x25')](respondWithResult(_0x5a31f8,null))[_0x2526('0x45')](handleError(_0x5a31f8,null));};exports[_0x2526('0x26')]=function(_0xbe1a74,_0x318f62){return db[_0x2526('0x2f')]['find']({'where':{'id':_0xbe1a74[_0x2526('0x47')]['id']}})[_0x2526('0x25')](handleEntityNotFound(_0x318f62,null))[_0x2526('0x25')](removeEntity(_0x318f62,null))['catch'](handleError(_0x318f62,null));};exports[_0x2526('0x54')]=function(_0x1ac036,_0x51d946,_0x4ba3fd){var _0x889d95=require(_0x2526('0x55'));return db[_0x2526('0x2f')][_0x2526('0x49')]({'where':{'id':_0x1ac036[_0x2526('0x47')]['id']},'raw':!![]})[_0x2526('0x25')](handleEntityNotFound(_0x51d946,null))[_0x2526('0x25')](function(){_0x889d95[_0x2526('0x54')](_0x1ac036[_0x2526('0x47')]['id']);})['then'](respondWithStatusCode(_0x51d946,null))[_0x2526('0x45')](handleError(_0x51d946,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 1f87387..54f20c0 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 _0xfcc5=['util','../../config/logger','api','moment','request-promise','../../config/environment','./schedule.attributes','define','Schedule','tools_schedules'];(function(_0x307719,_0xf1aa63){var _0xcacb84=function(_0x5b57b9){while(--_0x5b57b9){_0x307719['push'](_0x307719['shift']());}};_0xcacb84(++_0xf1aa63);}(_0xfcc5,0x14a));var _0x5fcc=function(_0x3cf90e,_0x266962){_0x3cf90e=_0x3cf90e-0x0;var _0x3585d3=_0xfcc5[_0x3cf90e];return _0x3585d3;};'use strict';var _=require('lodash');var util=require(_0x5fcc('0x0'));var logger=require(_0x5fcc('0x1'))(_0x5fcc('0x2'));var moment=require(_0x5fcc('0x3'));var BPromise=require('bluebird');var rp=require(_0x5fcc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5fcc('0x5'));var attributes=require(_0x5fcc('0x6'));module['exports']=function(_0x4a781a,_0x154c05){return _0x4a781a[_0x5fcc('0x7')](_0x5fcc('0x8'),attributes,{'tableName':_0x5fcc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf01=['tools_schedules','lodash','../../config/logger','bluebird','request-promise','./schedule.attributes','define','Schedule'];(function(_0x5442ab,_0x3e4b10){var _0x1be600=function(_0x1ae936){while(--_0x1ae936){_0x5442ab['push'](_0x5442ab['shift']());}};_0x1be600(++_0x3e4b10);}(_0xcf01,0x141));var _0x1cf0=function(_0x4e221e,_0x22329a){_0x4e221e=_0x4e221e-0x0;var _0x2297eb=_0xcf01[_0x4e221e];return _0x2297eb;};'use strict';var _=require(_0x1cf0('0x0'));var util=require('util');var logger=require(_0x1cf0('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1cf0('0x2'));var rp=require(_0x1cf0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1cf0('0x4'));module['exports']=function(_0x5e52e3,_0x2390a9){return _0x5e52e3[_0x1cf0('0x5')](_0x1cf0('0x6'),attributes,{'tableName':_0x1cf0('0x7'),'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 46c1922..e385c73 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 _0x1edb=['message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1d5cfc,_0x5bbcff){var _0x424421=function(_0x460bde){while(--_0x460bde){_0x1d5cfc['push'](_0x1d5cfc['shift']());}};_0x424421(++_0x5bbcff);}(_0x1edb,0x1e7));var _0xb1ed=function(_0x1908d4,_0x8ee5b3){_0x1908d4=_0x1908d4-0x0;var _0x5dc987=_0x1edb[_0x1908d4];return _0x5dc987;};'use strict';var _=require(_0xb1ed('0x0'));var util=require(_0xb1ed('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb1ed('0x2'));var fs=require('fs');var Redis=require(_0xb1ed('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb1ed('0x4'));var logger=require(_0xb1ed('0x5'))(_0xb1ed('0x6'));var config=require('../../config/environment');var jayson=require(_0xb1ed('0x7'));var client=jayson['client'][_0xb1ed('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2dc807,_0x1ccbef,_0x5b74a0){return new BPromise(function(_0x3d0d0d,_0x1dad57){return client[_0xb1ed('0x9')](_0x2dc807,_0x5b74a0)[_0xb1ed('0xa')](function(_0x85b2e3){logger[_0xb1ed('0xb')](_0xb1ed('0xc'),_0x1ccbef,_0xb1ed('0xd'));logger[_0xb1ed('0xe')](_0xb1ed('0xf'),_0x1ccbef,_0xb1ed('0xd'),JSON[_0xb1ed('0x10')](_0x85b2e3));if(_0x85b2e3['error']){if(_0x85b2e3[_0xb1ed('0x11')][_0xb1ed('0x12')]===0x1f4){logger[_0xb1ed('0x11')](_0xb1ed('0xc'),_0x1ccbef,_0x85b2e3[_0xb1ed('0x11')][_0xb1ed('0x13')]);return _0x1dad57(_0x85b2e3['error'][_0xb1ed('0x13')]);}logger[_0xb1ed('0x11')](_0xb1ed('0xc'),_0x1ccbef,_0x85b2e3[_0xb1ed('0x11')][_0xb1ed('0x13')]);return _0x3d0d0d(_0x85b2e3[_0xb1ed('0x11')][_0xb1ed('0x13')]);}else{logger['info'](_0xb1ed('0xc'),_0x1ccbef,_0xb1ed('0xd'));_0x3d0d0d(_0x85b2e3[_0xb1ed('0x14')][_0xb1ed('0x13')]);}})[_0xb1ed('0x15')](function(_0x201781){logger[_0xb1ed('0x11')](_0xb1ed('0xc'),_0x1ccbef,_0x201781);_0x1dad57(_0x201781);});});} \ No newline at end of file +var _0xb564=['result','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x49a333,_0xacaf36){var _0x483dd4=function(_0x332e31){while(--_0x332e31){_0x49a333['push'](_0x49a333['shift']());}};_0x483dd4(++_0xacaf36);}(_0xb564,0x13d));var _0x4b56=function(_0x27d750,_0x288159){_0x27d750=_0x27d750-0x0;var _0x3d5934=_0xb564[_0x27d750];return _0x3d5934;};'use strict';var _=require('lodash');var util=require(_0x4b56('0x0'));var moment=require('moment');var BPromise=require(_0x4b56('0x1'));var rs=require(_0x4b56('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b56('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4b56('0x4'))(_0x4b56('0x5'));var config=require(_0x4b56('0x6'));var jayson=require(_0x4b56('0x7'));var client=jayson[_0x4b56('0x8')][_0x4b56('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30cfda,_0x29fc94,_0x234cdf){return new BPromise(function(_0x47fe30,_0xe2e5dd){return client[_0x4b56('0xa')](_0x30cfda,_0x234cdf)[_0x4b56('0xb')](function(_0x28baee){logger[_0x4b56('0xc')](_0x4b56('0xd'),_0x29fc94,_0x4b56('0xe'));logger[_0x4b56('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x29fc94,'request\x20sent',JSON[_0x4b56('0x10')](_0x28baee));if(_0x28baee[_0x4b56('0x11')]){if(_0x28baee[_0x4b56('0x11')]['code']===0x1f4){logger[_0x4b56('0x11')](_0x4b56('0xd'),_0x29fc94,_0x28baee['error'][_0x4b56('0x12')]);return _0xe2e5dd(_0x28baee[_0x4b56('0x11')][_0x4b56('0x12')]);}logger[_0x4b56('0x11')](_0x4b56('0xd'),_0x29fc94,_0x28baee['error'][_0x4b56('0x12')]);return _0x47fe30(_0x28baee['error'][_0x4b56('0x12')]);}else{logger[_0x4b56('0xc')]('Schedule,\x20%s,\x20%s',_0x29fc94,_0x4b56('0xe'));_0x47fe30(_0x28baee[_0x4b56('0x13')][_0x4b56('0x12')]);}})[_0x4b56('0x14')](function(_0x571226){logger['error'](_0x4b56('0xd'),_0x29fc94,_0x571226);_0xe2e5dd(_0x571226);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index e72c793..8c323c8 100644 --- a/server/api/screenRecording/index.js +++ b/server/api/screenRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfbab=['../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x459a3e,_0x1d5da8){var _0x4c400d=function(_0x570300){while(--_0x570300){_0x459a3e['push'](_0x459a3e['shift']());}};_0x4c400d(++_0x1d5da8);}(_0xfbab,0xc0));var _0xbfba=function(_0x5dbea5,_0x43976b){_0x5dbea5=_0x5dbea5-0x0;var _0x13a467=_0xfbab[_0x5dbea5];return _0x13a467;};'use strict';var multer=require(_0xbfba('0x0'));var util=require(_0xbfba('0x1'));var path=require(_0xbfba('0x2'));var timeout=require(_0xbfba('0x3'));var express=require(_0xbfba('0x4'));var router=express[_0xbfba('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xbfba('0x6'));var config=require(_0xbfba('0x7'));var controller=require(_0xbfba('0x8'));router['get']('/',auth[_0xbfba('0x9')](),controller[_0xbfba('0xa')]);router[_0xbfba('0xb')](_0xbfba('0xc'),auth[_0xbfba('0x9')](),controller[_0xbfba('0xd')]);router[_0xbfba('0xb')](_0xbfba('0xe'),auth[_0xbfba('0x9')](),controller[_0xbfba('0xf')]);router[_0xbfba('0xb')](_0xbfba('0x10'),auth[_0xbfba('0x9')](),controller['download']);router[_0xbfba('0x11')]('/',auth['isAuthenticated'](),controller[_0xbfba('0x12')]);router[_0xbfba('0x13')](_0xbfba('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xbfba('0x14')](_0xbfba('0xe'),auth[_0xbfba('0x9')](),controller[_0xbfba('0x15')]);module['exports']=router; \ No newline at end of file +var _0x3535=['describe','/:id','/:id/download','post','update','destroy','exports','multer','util','Router','./screenRecording.controller','isAuthenticated','index','get','/describe'];(function(_0x54cda0,_0x3bf6e9){var _0x26f2c2=function(_0x18761f){while(--_0x18761f){_0x54cda0['push'](_0x54cda0['shift']());}};_0x26f2c2(++_0x3bf6e9);}(_0x3535,0x9d));var _0x5353=function(_0x424b89,_0x15cef3){_0x424b89=_0x424b89-0x0;var _0x48dc2e=_0x3535[_0x424b89];return _0x48dc2e;};'use strict';var multer=require(_0x5353('0x0'));var util=require(_0x5353('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5353('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5353('0x3'));router['get']('/',auth[_0x5353('0x4')](),controller[_0x5353('0x5')]);router[_0x5353('0x6')](_0x5353('0x7'),auth[_0x5353('0x4')](),controller[_0x5353('0x8')]);router[_0x5353('0x6')](_0x5353('0x9'),auth[_0x5353('0x4')](),controller['show']);router[_0x5353('0x6')](_0x5353('0xa'),auth[_0x5353('0x4')](),controller['download']);router[_0x5353('0xb')]('/',auth[_0x5353('0x4')](),controller['create']);router['put'](_0x5353('0x9'),auth[_0x5353('0x4')](),controller[_0x5353('0xc')]);router['delete'](_0x5353('0x9'),auth[_0x5353('0x4')](),controller[_0x5353('0xd')]);module[_0x5353('0xe')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 9a6165b..6ec2224 100644 --- a/server/api/screenRecording/screenRecording.attributes.js +++ b/server/api/screenRecording/screenRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5b3=['path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','moment'];(function(_0x3f8ca7,_0x1cfd75){var _0x2ef97e=function(_0x34227f){while(--_0x34227f){_0x3f8ca7['push'](_0x3f8ca7['shift']());}};_0x2ef97e(++_0x1cfd75);}(_0xe5b3,0x133));var _0x3e5b=function(_0x1732d3,_0xdfec02){_0x1732d3=_0x1732d3-0x0;var _0x4989b2=_0xe5b3[_0x1732d3];return _0x4989b2;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var config=require(_0x3e5b('0x2'));module[_0x3e5b('0x3')]={'format':{'type':Sequelize[_0x3e5b('0x4')],'get':function(){return this[_0x3e5b('0x5')](_0x3e5b('0x6'))?path[_0x3e5b('0x7')](this[_0x3e5b('0x5')](_0x3e5b('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x3e5b('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x3e5b('0x8')],'set':function(_0x5dcf55){var _0x534e7d=_0x5dcf55[_0x3e5b('0x9')](/\\/g,'/');this[_0x3e5b('0xa')](_0x3e5b('0x6'),_0x534e7d);}},'rating':{'type':Sequelize[_0x3e5b('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x4ed6bc){this[_0x3e5b('0xa')](_0x3e5b('0xc'),moment()[_0x3e5b('0xd')](_0x4ed6bc,'ms'));this[_0x3e5b('0xa')](_0x3e5b('0xe'),moment());this['setDataValue'](_0x3e5b('0xf'),_0x4ed6bc);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x3e5b('0x5')](_0x3e5b('0xc')))[_0x3e5b('0x10')](_0x3e5b('0x11'))[_0x3e5b('0x12')]();}},'closedAt':{'type':Sequelize[_0x3e5b('0x13')],'get':function(){return moment(this[_0x3e5b('0x5')]('closedAt'))[_0x3e5b('0x10')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x3e5b('0x5')](_0x3e5b('0x14')))[_0x3e5b('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x3e5b('0x12')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x3e5b('0x15')))[_0x3e5b('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x3e5b('0x12')]();}}}; \ No newline at end of file +var _0x17ba=['MM-DD-YYYY\x20HH:mm','toString','createdAt','sequelize','moment','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format'];(function(_0x26e949,_0x4de8bc){var _0x33cd65=function(_0x4a001b){while(--_0x4a001b){_0x26e949['push'](_0x26e949['shift']());}};_0x33cd65(++_0x4de8bc);}(_0x17ba,0xab));var _0xa17b=function(_0x5f39f8,_0x5f24cb){_0x5f39f8=_0x5f39f8-0x0;var _0x567915=_0x17ba[_0x5f39f8];return _0x567915;};'use strict';var Sequelize=require(_0xa17b('0x0'));var moment=require(_0xa17b('0x1'));var path=require('path');var config=require(_0xa17b('0x2'));module[_0xa17b('0x3')]={'format':{'type':Sequelize[_0xa17b('0x4')],'get':function(){return this[_0xa17b('0x5')](_0xa17b('0x6'))?path[_0xa17b('0x7')](this[_0xa17b('0x5')](_0xa17b('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xa17b('0x8')]},'channel':{'type':Sequelize[_0xa17b('0x8')]},'value':{'type':Sequelize[_0xa17b('0x8')],'set':function(_0x2e3d43){var _0x1957be=_0x2e3d43[_0xa17b('0x9')](/\\/g,'/');this[_0xa17b('0xa')](_0xa17b('0x6'),_0x1957be);}},'rating':{'type':Sequelize[_0xa17b('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xa17b('0xb')],'set':function(_0x15bdfc){this['setDataValue'](_0xa17b('0xc'),moment()[_0xa17b('0xd')](_0x15bdfc,'ms'));this[_0xa17b('0xa')](_0xa17b('0xe'),moment());this[_0xa17b('0xa')](_0xa17b('0xf'),_0x15bdfc);}},'startedAt':{'type':Sequelize[_0xa17b('0x10')],'get':function(){return moment(this['getDataValue'](_0xa17b('0xc')))[_0xa17b('0x11')](_0xa17b('0x12'))['toString']();}},'closedAt':{'type':Sequelize[_0xa17b('0x10')],'get':function(){return moment(this[_0xa17b('0x5')](_0xa17b('0xe')))[_0xa17b('0x11')]('MM-DD-YYYY\x20HH:mm')[_0xa17b('0x13')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa17b('0x5')](_0xa17b('0x14')))['format'](_0xa17b('0x12'))[_0xa17b('0x13')]();}},'updatedAt':{'type':Sequelize[_0xa17b('0x10')],'get':function(){return moment(this[_0xa17b('0x5')]('updatedAt'))[_0xa17b('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 065b558..a7fd7ff 100644 --- a/server/api/screenRecording/screenRecording.controller.js +++ b/server/api/screenRecording/screenRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f03=['reject','update','then','destroy','error','name','index','map','ScreenRecording','fieldName','type','key','model','format','keys','query','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filters','merge','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','createdAt','value','describe','download','uniqueid','join','existsSync','decryptFile','secrets','root','server/files/screen_recordings','Sequelize','ValidationError','filename','extname','unlink','message','send','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','end','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','count','offset','set','json'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0x4f03,0xfc));var _0x34f0=function(_0x29a40a,_0x234214){_0x29a40a=_0x29a40a-0x0;var _0x6182e9=_0x4f03[_0x29a40a];return _0x6182e9;};'use strict';var pdf=require(_0x34f0('0x0'));var emlformat=require(_0x34f0('0x1'));var rimraf=require(_0x34f0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x34f0('0x3'));var rp=require('request-promise');var moment=require(_0x34f0('0x4'));var BPromise=require(_0x34f0('0x5'));var Mustache=require(_0x34f0('0x6'));var util=require(_0x34f0('0x7'));var path=require(_0x34f0('0x8'));var sox=require(_0x34f0('0x9'));var csv=require(_0x34f0('0xa'));var ejs=require(_0x34f0('0xb'));var fs=require('fs');var _=require(_0x34f0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x34f0('0xd'));var deskjs=require(_0x34f0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x34f0('0xf'));var Papa=require(_0x34f0('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x34f0('0x11'));var logger=require(_0x34f0('0x12'))(_0x34f0('0x13'));var utils=require(_0x34f0('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a06f2,_0x664462){_0x664462=_0x664462||0xcc;return function(_0x9badbd){if(_0x9badbd){return _0x4a06f2[_0x34f0('0x15')](_0x664462);}return _0x4a06f2[_0x34f0('0x16')](_0x664462)['end']();};}function respondWithResult(_0x2e0028,_0xb30927){_0xb30927=_0xb30927||0xc8;return function(_0x571172){if(_0x571172){return _0x2e0028[_0x34f0('0x16')](_0xb30927)['json'](_0x571172);}};}function respondWithFilteredResult(_0x4eea84,_0x1c83cc){return function(_0xee9731){if(_0xee9731){var _0x5299b8=_0xee9731[_0x34f0('0x17')],_0x20254a=_0x1c83cc[_0x34f0('0x18')],_0x3bf09a=_0x1c83cc[_0x34f0('0x18')]+_0x1c83cc['limit'],_0xce54bf;if(_0x3bf09a>=_0x5299b8){_0x3bf09a=_0x5299b8;_0xce54bf=0xc8;}else{_0xce54bf=0xce;}_0x4eea84[_0x34f0('0x16')](_0xce54bf);return _0x4eea84[_0x34f0('0x19')]('Content-Range',_0x20254a+'-'+_0x3bf09a+'/'+_0x5299b8)[_0x34f0('0x1a')](_0xee9731);}return null;};}function patchUpdates(_0x21420f){return function(_0x565f0b){try{jsonpatch['apply'](_0x565f0b,_0x21420f,!![]);}catch(_0x4e147a){return BPromise[_0x34f0('0x1b')](_0x4e147a);}return _0x565f0b['save']();};}function saveUpdates(_0xb36c4a,_0x41b079){return function(_0x5953e1){if(_0x5953e1){return _0x5953e1[_0x34f0('0x1c')](_0xb36c4a)[_0x34f0('0x1d')](function(_0x1c3a31){return _0x1c3a31;});}return null;};}function removeEntity(_0x5d470e,_0x27fd51){return function(_0x39ebb0){if(_0x39ebb0){return _0x39ebb0[_0x34f0('0x1e')]()[_0x34f0('0x1d')](function(){_0x5d470e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x265163,_0x21b912){return function(_0x10da06){if(!_0x10da06){_0x265163[_0x34f0('0x15')](0x194);}return _0x10da06;};}function handleError(_0x81c55b,_0x454e8f){_0x454e8f=_0x454e8f||0x1f4;return function(_0x1a7a1f){logger[_0x34f0('0x1f')](_0x1a7a1f['stack']);if(_0x1a7a1f['name']){delete _0x1a7a1f[_0x34f0('0x20')];}_0x81c55b[_0x34f0('0x16')](_0x454e8f)['send'](_0x1a7a1f);};}exports[_0x34f0('0x21')]=function(_0x220c9a,_0xfeda42){var _0x3ec823={},_0x308e10={},_0x17d777={'count':0x0,'rows':[]};var _0x5b193a=_[_0x34f0('0x22')](db[_0x34f0('0x23')]['rawAttributes'],function(_0x404dfc){return{'name':_0x404dfc[_0x34f0('0x24')],'type':_0x404dfc[_0x34f0('0x25')][_0x34f0('0x26')]};});_0x308e10[_0x34f0('0x27')]=_['differenceBy'](_[_0x34f0('0x22')](_0x5b193a,_0x34f0('0x20')),[_0x34f0('0x28')]);_0x308e10['query']=_[_0x34f0('0x29')](_0x220c9a[_0x34f0('0x2a')]);_0x308e10['filters']=_[_0x34f0('0x2b')](_0x308e10['model'],_0x308e10[_0x34f0('0x2a')]);_0x3ec823['attributes']=_[_0x34f0('0x2b')](_0x308e10[_0x34f0('0x27')],qs[_0x34f0('0x2c')](_0x220c9a['query'][_0x34f0('0x2c')]));_0x3ec823[_0x34f0('0x2d')]=_0x3ec823[_0x34f0('0x2d')][_0x34f0('0x2e')]?_0x3ec823[_0x34f0('0x2d')]:_0x308e10[_0x34f0('0x27')];if(!_0x220c9a['query']['hasOwnProperty'](_0x34f0('0x2f'))){_0x3ec823[_0x34f0('0x30')]=qs[_0x34f0('0x30')](_0x220c9a[_0x34f0('0x2a')]['limit']);_0x3ec823[_0x34f0('0x18')]=qs[_0x34f0('0x18')](_0x220c9a[_0x34f0('0x2a')]['offset']);}_0x3ec823[_0x34f0('0x31')]=qs[_0x34f0('0x32')](_0x220c9a['query'][_0x34f0('0x32')]);_0x3ec823[_0x34f0('0x33')]=qs['filters'](_['pick'](_0x220c9a['query'],_0x308e10[_0x34f0('0x34')]),_0x5b193a);if(_0x220c9a[_0x34f0('0x2a')]['filter']){_0x3ec823[_0x34f0('0x33')]=_[_0x34f0('0x35')](_0x3ec823[_0x34f0('0x33')],{'$or':_[_0x34f0('0x22')](_0x5b193a,function(_0x5224b9){if(_0x5224b9['type']!=='VIRTUAL'){var _0x14661c={};_0x14661c[_0x5224b9[_0x34f0('0x20')]]={'$like':'%'+_0x220c9a[_0x34f0('0x2a')][_0x34f0('0x36')]+'%'};return _0x14661c;}})});}_0x3ec823=_[_0x34f0('0x35')]({},_0x3ec823,_0x220c9a[_0x34f0('0x37')]);var _0x235cc7={'where':_0x3ec823[_0x34f0('0x33')]};return db[_0x34f0('0x23')][_0x34f0('0x17')](_0x235cc7)[_0x34f0('0x1d')](function(_0x471439){_0x17d777['count']=_0x471439;if(_0x220c9a[_0x34f0('0x2a')][_0x34f0('0x38')]){_0x3ec823[_0x34f0('0x39')]=[{'all':!![]}];}return db[_0x34f0('0x23')][_0x34f0('0x3a')](_0x3ec823);})[_0x34f0('0x1d')](function(_0x4bbf01){_0x17d777[_0x34f0('0x3b')]=_0x4bbf01;return _0x17d777;})[_0x34f0('0x1d')](respondWithFilteredResult(_0xfeda42,_0x3ec823))[_0x34f0('0x3c')](handleError(_0xfeda42,null));};exports['show']=function(_0x82870c,_0x4131cc){var _0x3f04eb={'raw':![],'where':{'id':_0x82870c[_0x34f0('0x3d')]['id']}},_0x15c2da={};_0x15c2da[_0x34f0('0x27')]=_[_0x34f0('0x29')](db[_0x34f0('0x23')][_0x34f0('0x3e')]);_0x15c2da['query']=_[_0x34f0('0x29')](_0x82870c['query']);_0x15c2da[_0x34f0('0x34')]=_[_0x34f0('0x2b')](_0x15c2da[_0x34f0('0x27')],_0x15c2da[_0x34f0('0x2a')]);_0x3f04eb['attributes']=_['intersection'](_0x15c2da['model'],qs[_0x34f0('0x2c')](_0x82870c[_0x34f0('0x2a')][_0x34f0('0x2c')]));_0x3f04eb[_0x34f0('0x2d')]=_0x3f04eb[_0x34f0('0x2d')][_0x34f0('0x2e')]?_0x3f04eb[_0x34f0('0x2d')]:_0x15c2da['model'];if(_0x82870c[_0x34f0('0x2a')][_0x34f0('0x38')]){_0x3f04eb[_0x34f0('0x39')]=[{'all':!![]}];}_0x3f04eb=_[_0x34f0('0x35')]({},_0x3f04eb,_0x82870c[_0x34f0('0x37')]);return db[_0x34f0('0x23')][_0x34f0('0x3f')](_0x3f04eb)['then'](handleEntityNotFound(_0x4131cc,null))[_0x34f0('0x1d')](respondWithResult(_0x4131cc,null))[_0x34f0('0x3c')](handleError(_0x4131cc,null));};exports['create']=function(_0x2f75aa,_0x53c02d){return db[_0x34f0('0x23')][_0x34f0('0x40')](_0x2f75aa[_0x34f0('0x41')],{})[_0x34f0('0x1d')](respondWithResult(_0x53c02d,0xc9))[_0x34f0('0x3c')](handleError(_0x53c02d,null));};exports[_0x34f0('0x1c')]=function(_0x4e352e,_0x5209fb){if(_0x4e352e[_0x34f0('0x41')]['id']){delete _0x4e352e[_0x34f0('0x41')]['id'];}delete _0x4e352e[_0x34f0('0x41')]['duration'];delete _0x4e352e[_0x34f0('0x41')][_0x34f0('0x42')];delete _0x4e352e[_0x34f0('0x41')]['closedAt'];delete _0x4e352e[_0x34f0('0x41')][_0x34f0('0x43')];return db['ScreenRecording'][_0x34f0('0x3f')]({'where':{'id':_0x4e352e['params']['id']}})['then'](handleEntityNotFound(_0x5209fb,null))['then'](saveUpdates(_0x4e352e[_0x34f0('0x41')],null))[_0x34f0('0x1d')](respondWithResult(_0x5209fb,null))[_0x34f0('0x3c')](handleError(_0x5209fb,null));};exports[_0x34f0('0x44')]=function(_0x37fb18,_0x5a5cd8){return db[_0x34f0('0x23')][_0x34f0('0x44')]()[_0x34f0('0x1d')](respondWithResult(_0x5a5cd8,null))['catch'](handleError(_0x5a5cd8,null));};exports[_0x34f0('0x45')]=function(_0x975732,_0x256238,_0x706d8d){var _0x5ac240=require('../../components/encryptor');var _0x348eab=![];var _0x178c35={};if(_0x975732[_0x34f0('0x2a')][_0x34f0('0x25')]&&_0x975732['query'][_0x34f0('0x25')]===_0x34f0('0x46')){_0x178c35[_0x34f0('0x46')]=_0x975732[_0x34f0('0x3d')]['id'];}else{_0x178c35['id']=_0x975732['params']['id'];}return db[_0x34f0('0x23')][_0x34f0('0x3f')]({'where':_0x178c35,'attributes':['id',_0x34f0('0x43')],'raw':!![]})['then'](handleEntityNotFound(_0x256238,null))[_0x34f0('0x1d')](function(_0x50a2e3){if(_0x50a2e3){var _0x36c733=path[_0x34f0('0x47')](config['root'],'server/files/screen_recordings',_0x50a2e3[_0x34f0('0x43')]);var _0xcb86d7=util['format']('%s.cypher',_0x36c733);if(fs[_0x34f0('0x48')](_0xcb86d7)){_0x348eab=!![];return _0x5ac240[_0x34f0('0x49')](_0xcb86d7,_0x36c733,config[_0x34f0('0x4a')]['recording'])[_0x34f0('0x1d')](function(){return _0x50a2e3;});}return _0x50a2e3;}})[_0x34f0('0x1d')](function(_0x38db73){if(_0x38db73){var _0x2cf66d=path[_0x34f0('0x47')](config[_0x34f0('0x4b')],_0x34f0('0x4c'),_0x38db73[_0x34f0('0x43')]);if(!fs[_0x34f0('0x48')](_0x2cf66d)){throw new db[(_0x34f0('0x4d'))][(_0x34f0('0x4e'))]('ScreenRecording\x20not\x20found');}if(_0x38db73[_0x34f0('0x4f')]){return _0x256238[_0x34f0('0x45')](_0x2cf66d,_0x38db73[_0x34f0('0x4f')]+path[_0x34f0('0x50')](_0x2cf66d),function(){if(_0x348eab){fs[_0x34f0('0x51')](_0x2cf66d);}});}else{return _0x256238['download'](_0x2cf66d,function(_0x3bcb19){if(_0x348eab){fs[_0x34f0('0x51')](_0x2cf66d);}});}}})['catch'](function(_0x13e68a){if(_0x13e68a[_0x34f0('0x52')]==='ScreenRecording\x20not\x20found'){_0x256238[_0x34f0('0x16')](0x194)[_0x34f0('0x53')](_0x34f0('0x54'));}else{return handleError(_0x256238,null);}});};exports[_0x34f0('0x1e')]=function(_0x45f87d,_0x15c4f4){return db[_0x34f0('0x23')][_0x34f0('0x3f')]({'where':{'id':_0x45f87d[_0x34f0('0x3d')]['id']}})[_0x34f0('0x1d')](function(_0x446ac3){if(!_0x446ac3)throw new ReferenceError(_0x34f0('0x55'));return _0x446ac3;})[_0x34f0('0x1d')](function(_0x4f8af1){var _0x591255=path[_0x34f0('0x47')](config[_0x34f0('0x4b')],_0x34f0('0x4c'),_0x4f8af1[_0x34f0('0x43')]);logger[_0x34f0('0x56')](_0x34f0('0x57'),_0x591255);if(!_['isNil'](_0x4f8af1[_0x34f0('0x43')])&&fs[_0x34f0('0x48')](_0x591255)){logger[_0x34f0('0x56')]('File:\x20\x22'+_0x591255+_0x34f0('0x58'));fs[_0x34f0('0x59')](_0x591255);}_0x591255=_0x591255+_0x34f0('0x5a');if(!_['isNil'](_0x4f8af1[_0x34f0('0x43')])&&fs[_0x34f0('0x48')](_0x591255)){logger[_0x34f0('0x56')](_0x34f0('0x5b')+_0x591255+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x34f0('0x59')](_0x591255);}return _0x4f8af1;})[_0x34f0('0x1d')](function(_0x5ca970){if(!_0x5ca970)throw new InternalError();return _0x5ca970[_0x34f0('0x1e')]();})['then'](function(){_0x15c4f4['status'](0xcc)[_0x34f0('0x5c')]();})[_0x34f0('0x3c')](handleError(_0x15c4f4,null));}; \ No newline at end of file +var _0x035c=['name','send','index','map','ScreenRecording','fieldName','type','key','model','format','keys','query','filters','intersection','attributes','fields','length','limit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','show','params','rawAttributes','include','catch','create','body','duration','createdAt','closedAt','value','find','describe','download','../../components/encryptor','uniqueid','join','server/files/screen_recordings','decryptFile','secrets','root','existsSync','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','Content-Range','apply','reject','save','update','then','error','stack'];(function(_0x4176da,_0x4ff6a2){var _0x10d01d=function(_0xa75ce1){while(--_0xa75ce1){_0x4176da['push'](_0x4176da['shift']());}};_0x10d01d(++_0x4ff6a2);}(_0x035c,0xa8));var _0xc035=function(_0x3a40d2,_0xbccdd1){_0x3a40d2=_0x3a40d2-0x0;var _0x97209b=_0x035c[_0x3a40d2];return _0x97209b;};'use strict';var pdf=require(_0xc035('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc035('0x1'));var zipdir=require(_0xc035('0x2'));var jsonpatch=require(_0xc035('0x3'));var rp=require(_0xc035('0x4'));var moment=require(_0xc035('0x5'));var BPromise=require(_0xc035('0x6'));var Mustache=require(_0xc035('0x7'));var util=require(_0xc035('0x8'));var path=require(_0xc035('0x9'));var sox=require('sox');var csv=require(_0xc035('0xa'));var ejs=require(_0xc035('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc035('0xc'));var jsforce=require(_0xc035('0xd'));var deskjs=require(_0xc035('0xe'));var toCsv=require(_0xc035('0xa'));var querystring=require(_0xc035('0xf'));var Papa=require(_0xc035('0x10'));var Redis=require(_0xc035('0x11'));var authService=require(_0xc035('0x12'));var qs=require(_0xc035('0x13'));var as=require(_0xc035('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc035('0x15'))('api');var utils=require(_0xc035('0x16'));var config=require(_0xc035('0x17'));var db=require(_0xc035('0x18'))['db'];function respondWithStatusCode(_0x4ae8dd,_0x63a5cf){_0x63a5cf=_0x63a5cf||0xcc;return function(_0xab2ae4){if(_0xab2ae4){return _0x4ae8dd[_0xc035('0x19')](_0x63a5cf);}return _0x4ae8dd[_0xc035('0x1a')](_0x63a5cf)[_0xc035('0x1b')]();};}function respondWithResult(_0x1c822a,_0x341c84){_0x341c84=_0x341c84||0xc8;return function(_0x4d18a1){if(_0x4d18a1){return _0x1c822a[_0xc035('0x1a')](_0x341c84)[_0xc035('0x1c')](_0x4d18a1);}};}function respondWithFilteredResult(_0x14ae35,_0x4c8d79){return function(_0x4d9913){if(_0x4d9913){var _0x4ec5ab=_0x4d9913['count'],_0x3fb8b5=_0x4c8d79[_0xc035('0x1d')],_0x57cf2a=_0x4c8d79[_0xc035('0x1d')]+_0x4c8d79['limit'],_0x581a1d;if(_0x57cf2a>=_0x4ec5ab){_0x57cf2a=_0x4ec5ab;_0x581a1d=0xc8;}else{_0x581a1d=0xce;}_0x14ae35[_0xc035('0x1a')](_0x581a1d);return _0x14ae35['set'](_0xc035('0x1e'),_0x3fb8b5+'-'+_0x57cf2a+'/'+_0x4ec5ab)[_0xc035('0x1c')](_0x4d9913);}return null;};}function patchUpdates(_0x1a8017){return function(_0x49721d){try{jsonpatch[_0xc035('0x1f')](_0x49721d,_0x1a8017,!![]);}catch(_0x3b7df8){return BPromise[_0xc035('0x20')](_0x3b7df8);}return _0x49721d[_0xc035('0x21')]();};}function saveUpdates(_0x8a7387,_0x2ca2b9){return function(_0x2d1533){if(_0x2d1533){return _0x2d1533[_0xc035('0x22')](_0x8a7387)[_0xc035('0x23')](function(_0x12a737){return _0x12a737;});}return null;};}function removeEntity(_0x28cfab,_0x51d35f){return function(_0x50624e){if(_0x50624e){return _0x50624e['destroy']()[_0xc035('0x23')](function(){_0x28cfab[_0xc035('0x1a')](0xcc)[_0xc035('0x1b')]();});}};}function handleEntityNotFound(_0x3999c9,_0xc2b31a){return function(_0x4394dd){if(!_0x4394dd){_0x3999c9['sendStatus'](0x194);}return _0x4394dd;};}function handleError(_0x3597c3,_0x3e68cb){_0x3e68cb=_0x3e68cb||0x1f4;return function(_0x37af17){logger[_0xc035('0x24')](_0x37af17[_0xc035('0x25')]);if(_0x37af17[_0xc035('0x26')]){delete _0x37af17[_0xc035('0x26')];}_0x3597c3[_0xc035('0x1a')](_0x3e68cb)[_0xc035('0x27')](_0x37af17);};}exports[_0xc035('0x28')]=function(_0x326214,_0xf9ef4e){var _0x575e96={},_0x168d3e={},_0x390321={'count':0x0,'rows':[]};var _0x41dcc8=_[_0xc035('0x29')](db[_0xc035('0x2a')]['rawAttributes'],function(_0x162573){return{'name':_0x162573[_0xc035('0x2b')],'type':_0x162573[_0xc035('0x2c')][_0xc035('0x2d')]};});_0x168d3e[_0xc035('0x2e')]=_['differenceBy'](_[_0xc035('0x29')](_0x41dcc8,'name'),[_0xc035('0x2f')]);_0x168d3e['query']=_[_0xc035('0x30')](_0x326214[_0xc035('0x31')]);_0x168d3e[_0xc035('0x32')]=_[_0xc035('0x33')](_0x168d3e[_0xc035('0x2e')],_0x168d3e['query']);_0x575e96[_0xc035('0x34')]=_['intersection'](_0x168d3e[_0xc035('0x2e')],qs[_0xc035('0x35')](_0x326214['query'][_0xc035('0x35')]));_0x575e96[_0xc035('0x34')]=_0x575e96[_0xc035('0x34')][_0xc035('0x36')]?_0x575e96[_0xc035('0x34')]:_0x168d3e[_0xc035('0x2e')];if(!_0x326214[_0xc035('0x31')]['hasOwnProperty']('nolimit')){_0x575e96[_0xc035('0x37')]=qs['limit'](_0x326214[_0xc035('0x31')][_0xc035('0x37')]);_0x575e96['offset']=qs[_0xc035('0x1d')](_0x326214['query']['offset']);}_0x575e96['order']=qs[_0xc035('0x38')](_0x326214[_0xc035('0x31')][_0xc035('0x38')]);_0x575e96[_0xc035('0x39')]=qs[_0xc035('0x32')](_[_0xc035('0x3a')](_0x326214[_0xc035('0x31')],_0x168d3e[_0xc035('0x32')]),_0x41dcc8);if(_0x326214[_0xc035('0x31')][_0xc035('0x3b')]){_0x575e96[_0xc035('0x39')]=_[_0xc035('0x3c')](_0x575e96[_0xc035('0x39')],{'$or':_[_0xc035('0x29')](_0x41dcc8,function(_0x482e71){if(_0x482e71[_0xc035('0x2c')]!==_0xc035('0x3d')){var _0x2890cb={};_0x2890cb[_0x482e71[_0xc035('0x26')]]={'$like':'%'+_0x326214[_0xc035('0x31')][_0xc035('0x3b')]+'%'};return _0x2890cb;}})});}_0x575e96=_[_0xc035('0x3c')]({},_0x575e96,_0x326214[_0xc035('0x3e')]);var _0xa7a171={'where':_0x575e96[_0xc035('0x39')]};return db[_0xc035('0x2a')][_0xc035('0x3f')](_0xa7a171)[_0xc035('0x23')](function(_0x729b7){_0x390321[_0xc035('0x3f')]=_0x729b7;if(_0x326214['query'][_0xc035('0x40')]){_0x575e96['include']=[{'all':!![]}];}return db['ScreenRecording'][_0xc035('0x41')](_0x575e96);})[_0xc035('0x23')](function(_0xdcef81){_0x390321['rows']=_0xdcef81;return _0x390321;})[_0xc035('0x23')](respondWithFilteredResult(_0xf9ef4e,_0x575e96))['catch'](handleError(_0xf9ef4e,null));};exports[_0xc035('0x42')]=function(_0x32af12,_0xd0583){var _0x1fb7cd={'raw':![],'where':{'id':_0x32af12[_0xc035('0x43')]['id']}},_0x5477a4={};_0x5477a4[_0xc035('0x2e')]=_[_0xc035('0x30')](db[_0xc035('0x2a')][_0xc035('0x44')]);_0x5477a4['query']=_[_0xc035('0x30')](_0x32af12[_0xc035('0x31')]);_0x5477a4[_0xc035('0x32')]=_[_0xc035('0x33')](_0x5477a4['model'],_0x5477a4[_0xc035('0x31')]);_0x1fb7cd['attributes']=_[_0xc035('0x33')](_0x5477a4[_0xc035('0x2e')],qs['fields'](_0x32af12[_0xc035('0x31')][_0xc035('0x35')]));_0x1fb7cd[_0xc035('0x34')]=_0x1fb7cd[_0xc035('0x34')][_0xc035('0x36')]?_0x1fb7cd[_0xc035('0x34')]:_0x5477a4[_0xc035('0x2e')];if(_0x32af12[_0xc035('0x31')][_0xc035('0x40')]){_0x1fb7cd[_0xc035('0x45')]=[{'all':!![]}];}_0x1fb7cd=_[_0xc035('0x3c')]({},_0x1fb7cd,_0x32af12[_0xc035('0x3e')]);return db[_0xc035('0x2a')]['find'](_0x1fb7cd)[_0xc035('0x23')](handleEntityNotFound(_0xd0583,null))['then'](respondWithResult(_0xd0583,null))[_0xc035('0x46')](handleError(_0xd0583,null));};exports[_0xc035('0x47')]=function(_0x4691c0,_0x18749b){return db[_0xc035('0x2a')]['create'](_0x4691c0[_0xc035('0x48')],{})[_0xc035('0x23')](respondWithResult(_0x18749b,0xc9))['catch'](handleError(_0x18749b,null));};exports[_0xc035('0x22')]=function(_0x1a68d9,_0x219c51){if(_0x1a68d9[_0xc035('0x48')]['id']){delete _0x1a68d9[_0xc035('0x48')]['id'];}delete _0x1a68d9['body'][_0xc035('0x49')];delete _0x1a68d9[_0xc035('0x48')][_0xc035('0x4a')];delete _0x1a68d9['body'][_0xc035('0x4b')];delete _0x1a68d9['body'][_0xc035('0x4c')];return db[_0xc035('0x2a')][_0xc035('0x4d')]({'where':{'id':_0x1a68d9[_0xc035('0x43')]['id']}})[_0xc035('0x23')](handleEntityNotFound(_0x219c51,null))[_0xc035('0x23')](saveUpdates(_0x1a68d9[_0xc035('0x48')],null))[_0xc035('0x23')](respondWithResult(_0x219c51,null))[_0xc035('0x46')](handleError(_0x219c51,null));};exports[_0xc035('0x4e')]=function(_0x1f7321,_0x14d4d3){return db['ScreenRecording'][_0xc035('0x4e')]()[_0xc035('0x23')](respondWithResult(_0x14d4d3,null))[_0xc035('0x46')](handleError(_0x14d4d3,null));};exports[_0xc035('0x4f')]=function(_0x487dfb,_0x1b1e58,_0x3592aa){var _0x35bf30=require(_0xc035('0x50'));var _0x91ea8b=![];var _0x55d005={};if(_0x487dfb[_0xc035('0x31')][_0xc035('0x2c')]&&_0x487dfb[_0xc035('0x31')][_0xc035('0x2c')]===_0xc035('0x51')){_0x55d005[_0xc035('0x51')]=_0x487dfb[_0xc035('0x43')]['id'];}else{_0x55d005['id']=_0x487dfb[_0xc035('0x43')]['id'];}return db[_0xc035('0x2a')][_0xc035('0x4d')]({'where':_0x55d005,'attributes':['id',_0xc035('0x4c')],'raw':!![]})[_0xc035('0x23')](handleEntityNotFound(_0x1b1e58,null))[_0xc035('0x23')](function(_0x42a48d){if(_0x42a48d){var _0x36dc5e=path[_0xc035('0x52')](config['root'],_0xc035('0x53'),_0x42a48d['value']);var _0x583d7f=util['format']('%s.cypher',_0x36dc5e);if(fs['existsSync'](_0x583d7f)){_0x91ea8b=!![];return _0x35bf30[_0xc035('0x54')](_0x583d7f,_0x36dc5e,config[_0xc035('0x55')]['recording'])[_0xc035('0x23')](function(){return _0x42a48d;});}return _0x42a48d;}})[_0xc035('0x23')](function(_0x4102fa){if(_0x4102fa){var _0x1553a9=path['join'](config[_0xc035('0x56')],_0xc035('0x53'),_0x4102fa[_0xc035('0x4c')]);if(!fs[_0xc035('0x57')](_0x1553a9)){throw new db[(_0xc035('0x58'))]['ValidationError'](_0xc035('0x59'));}if(_0x4102fa[_0xc035('0x5a')]){return _0x1b1e58[_0xc035('0x4f')](_0x1553a9,_0x4102fa[_0xc035('0x5a')]+path[_0xc035('0x5b')](_0x1553a9),function(){if(_0x91ea8b){fs[_0xc035('0x5c')](_0x1553a9);}});}else{return _0x1b1e58[_0xc035('0x4f')](_0x1553a9,function(_0x2f078d){if(_0x91ea8b){fs[_0xc035('0x5c')](_0x1553a9);}});}}})[_0xc035('0x46')](function(_0x504676){if(_0x504676[_0xc035('0x5d')]===_0xc035('0x59')){_0x1b1e58[_0xc035('0x1a')](0x194)['send'](_0xc035('0x5e'));}else{return handleError(_0x1b1e58,null);}});};exports['destroy']=function(_0x35d638,_0x126ba6){return db[_0xc035('0x2a')][_0xc035('0x4d')]({'where':{'id':_0x35d638[_0xc035('0x43')]['id']}})[_0xc035('0x23')](function(_0x169c86){if(!_0x169c86)throw new ReferenceError(_0xc035('0x5f'));return _0x169c86;})[_0xc035('0x23')](function(_0x43f64e){var _0x5b46d8=path['join'](config['root'],_0xc035('0x53'),_0x43f64e[_0xc035('0x4c')]);logger[_0xc035('0x60')](_0xc035('0x61'),_0x5b46d8);if(!_[_0xc035('0x62')](_0x43f64e[_0xc035('0x4c')])&&fs[_0xc035('0x57')](_0x5b46d8)){logger[_0xc035('0x60')](_0xc035('0x63')+_0x5b46d8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc035('0x64')](_0x5b46d8);}_0x5b46d8=_0x5b46d8+_0xc035('0x65');if(!_['isNil'](_0x43f64e[_0xc035('0x4c')])&&fs[_0xc035('0x57')](_0x5b46d8)){logger['info'](_0xc035('0x63')+_0x5b46d8+_0xc035('0x66'));fs[_0xc035('0x64')](_0x5b46d8);}return _0x43f64e;})['then'](function(_0x255a32){if(!_0x255a32)throw new InternalError();return _0x255a32['destroy']();})[_0xc035('0x23')](function(){_0x126ba6[_0xc035('0x1a')](0xcc)[_0xc035('0x1b')]();})[_0xc035('0x46')](handleError(_0x126ba6,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index ab7d30b..9e21f64 100644 --- a/server/api/screenRecording/screenRecording.model.js +++ b/server/api/screenRecording/screenRecording.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf482=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid'];(function(_0x5bf993,_0x5e72f0){var _0x3b2957=function(_0x3c3a47){while(--_0x3c3a47){_0x5bf993['push'](_0x5bf993['shift']());}};_0x3b2957(++_0x5e72f0);}(_0xf482,0xf0));var _0x2f48=function(_0x30fc45,_0x22bc08){_0x30fc45=_0x30fc45-0x0;var _0x4633ae=_0xf482[_0x30fc45];return _0x4633ae;};'use strict';var _=require(_0x2f48('0x0'));var util=require(_0x2f48('0x1'));var logger=require(_0x2f48('0x2'))(_0x2f48('0x3'));var moment=require(_0x2f48('0x4'));var BPromise=require(_0x2f48('0x5'));var rp=require(_0x2f48('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2f48('0x7'));var config=require(_0x2f48('0x8'));var attributes=require(_0x2f48('0x9'));module[_0x2f48('0xa')]=function(_0xbbe085,_0x5b675a){return _0xbbe085[_0x2f48('0xb')](_0x2f48('0xc'),attributes,{'tableName':_0x2f48('0xd'),'paranoid':![],'indexes':[{'name':_0x2f48('0xe'),'fields':[_0x2f48('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x26fb=['moment','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api'];(function(_0x2d4355,_0x208b01){var _0x5b42f6=function(_0x2def86){while(--_0x2def86){_0x2d4355['push'](_0x2d4355['shift']());}};_0x5b42f6(++_0x208b01);}(_0x26fb,0x1f4));var _0xb26f=function(_0xe7c78b,_0x1d1dba){_0xe7c78b=_0xe7c78b-0x0;var _0x3a25e4=_0x26fb[_0xe7c78b];return _0x3a25e4;};'use strict';var _=require(_0xb26f('0x0'));var util=require(_0xb26f('0x1'));var logger=require(_0xb26f('0x2'))(_0xb26f('0x3'));var moment=require(_0xb26f('0x4'));var BPromise=require(_0xb26f('0x5'));var rp=require(_0xb26f('0x6'));var fs=require('fs');var path=require(_0xb26f('0x7'));var rimraf=require('rimraf');var config=require(_0xb26f('0x8'));var attributes=require(_0xb26f('0x9'));module[_0xb26f('0xa')]=function(_0x12186c,_0x227c7f){return _0x12186c['define'](_0xb26f('0xb'),attributes,{'tableName':_0xb26f('0xc'),'paranoid':![],'indexes':[{'name':_0xb26f('0xd'),'fields':[_0xb26f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index c4470f4..81474d6 100644 --- a/server/api/screenRecording/screenRecording.rpc.js +++ b/server/api/screenRecording/screenRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5c03a5,_0xe6e149){var _0x5cd614=function(_0x533933){while(--_0x533933){_0x5c03a5['push'](_0x5c03a5['shift']());}};_0x5cd614(++_0xe6e149);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x48b86f,_0x21c9d6){var _0x5e97f3=function(_0x4567f6){while(--_0x4567f6){_0x48b86f['push'](_0x48b86f['shift']());}};_0x5e97f3(++_0x21c9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 3c869d1..541f7ac 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 _0xae0f=['update','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./setting.controller','get','index','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','addLogo','logologin','addLogoLogin','preferred','addPreferred','/:id/favicon','file','isAuthenticated'];(function(_0x197919,_0x24153d){var _0x5e5155=function(_0x444169){while(--_0x444169){_0x197919['push'](_0x197919['shift']());}};_0x5e5155(++_0x24153d);}(_0xae0f,0x1e1));var _0xfae0=function(_0xa3ddd7,_0x4d2263){_0xa3ddd7=_0xa3ddd7-0x0;var _0x45e6cd=_0xae0f[_0xa3ddd7];return _0x45e6cd;};'use strict';var multer=require(_0xfae0('0x0'));var util=require(_0xfae0('0x1'));var path=require('path');var timeout=require(_0xfae0('0x2'));var express=require(_0xfae0('0x3'));var router=express['Router']();var auth=require(_0xfae0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfae0('0x5'));var controller=require(_0xfae0('0x6'));router[_0xfae0('0x7')]('/',auth['isAuthenticated'](),controller[_0xfae0('0x8')]);router['get'](_0xfae0('0x9'),controller[_0xfae0('0xa')]);router[_0xfae0('0x7')](_0xfae0('0xb'),controller[_0xfae0('0xc')]);router[_0xfae0('0x7')](_0xfae0('0xd'),controller[_0xfae0('0xe')]);router[_0xfae0('0x7')](_0xfae0('0xf'),controller[_0xfae0('0x10')]);router[_0xfae0('0x7')](_0xfae0('0x11'),controller[_0xfae0('0x12')]);router[_0xfae0('0x7')]('/:id/favicon',controller[_0xfae0('0x13')]);var upload=multer({'storage':multer[_0xfae0('0x14')]({'destination':function(_0x305a50,_0x1a178f,_0x4aa75e){_0x4aa75e(null,path[_0xfae0('0x15')](config[_0xfae0('0x16')],_0xfae0('0x17')));},'filename':function(_0x35ff9b,_0x52ed41,_0x343b56){_0x343b56(null,util[_0xfae0('0x18')](_0xfae0('0x19'),_0xfae0('0x1a'),path[_0xfae0('0x1b')](_0x52ed41[_0xfae0('0x1c')])));}})});router[_0xfae0('0x1d')](_0xfae0('0xb'),upload[_0xfae0('0x1e')]('file'),controller[_0xfae0('0x1f')]);var upload=multer({'storage':multer[_0xfae0('0x14')]({'destination':function(_0x36b466,_0x4dce1f,_0x1a4d89){_0x1a4d89(null,path[_0xfae0('0x15')](config['root'],'server/files/images/logos/'));},'filename':function(_0x4ce9ef,_0x253691,_0x19aaab){_0x19aaab(null,util[_0xfae0('0x18')]('%s%s',_0xfae0('0x20'),path[_0xfae0('0x1b')](_0x253691['originalname'])));}})});router[_0xfae0('0x1d')](_0xfae0('0xd'),upload[_0xfae0('0x1e')]('file'),controller[_0xfae0('0x21')]);var upload=multer({'storage':multer[_0xfae0('0x14')]({'destination':function(_0x2151ee,_0x47b018,_0x2b1245){_0x2b1245(null,path[_0xfae0('0x15')](config[_0xfae0('0x16')],_0xfae0('0x17')));},'filename':function(_0x590a03,_0x798d3b,_0x3e7c4b){_0x3e7c4b(null,util[_0xfae0('0x18')](_0xfae0('0x19'),_0xfae0('0x22'),path[_0xfae0('0x1b')](_0x798d3b[_0xfae0('0x1c')])));}})});router['post']('/:id/preferred',upload[_0xfae0('0x1e')]('file'),controller[_0xfae0('0x23')]);var upload=multer({'storage':multer[_0xfae0('0x14')]({'destination':function(_0x57785c,_0xd0c560,_0x1c7dd5){_0x1c7dd5(null,path[_0xfae0('0x15')](config[_0xfae0('0x16')],_0xfae0('0x17')));},'filename':function(_0x13412c,_0x58b84f,_0x3904db){_0x3904db(null,util[_0xfae0('0x18')]('%s%s','favicon',path['extname'](_0x58b84f['originalname'])));}})});router['post'](_0xfae0('0x24'),upload[_0xfae0('0x1e')](_0xfae0('0x25')),controller['addFavicon']);router['put'](_0xfae0('0x9'),auth[_0xfae0('0x26')](),controller[_0xfae0('0x27')]);module['exports']=router; \ No newline at end of file +var _0x2b8b=['server/files/images/logos/','format','%s%s','logo','post','file','addLogo','diskStorage','logologin','extname','originalname','/:id/logo_login','addLogoLogin','preferred','addPreferred','addFavicon','put','/:id','update','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','show','/:id/logo','getLogo','getLogoLogin','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root'];(function(_0x3ab6cb,_0x591249){var _0x108ae5=function(_0x54be0c){while(--_0x54be0c){_0x3ab6cb['push'](_0x3ab6cb['shift']());}};_0x108ae5(++_0x591249);}(_0x2b8b,0x163));var _0xb2b8=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x2b8b[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0xb2b8('0x0'));var util=require(_0xb2b8('0x1'));var path=require(_0xb2b8('0x2'));var timeout=require(_0xb2b8('0x3'));var express=require(_0xb2b8('0x4'));var router=express[_0xb2b8('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb2b8('0x6'));var config=require(_0xb2b8('0x7'));var controller=require(_0xb2b8('0x8'));router[_0xb2b8('0x9')]('/',auth[_0xb2b8('0xa')](),controller[_0xb2b8('0xb')]);router[_0xb2b8('0x9')]('/:id',controller[_0xb2b8('0xc')]);router[_0xb2b8('0x9')](_0xb2b8('0xd'),controller[_0xb2b8('0xe')]);router[_0xb2b8('0x9')]('/:id/logo_login',controller[_0xb2b8('0xf')]);router[_0xb2b8('0x9')]('/:id/gdpr',controller[_0xb2b8('0x10')]);router['get'](_0xb2b8('0x11'),controller[_0xb2b8('0x12')]);router[_0xb2b8('0x9')](_0xb2b8('0x13'),controller[_0xb2b8('0x14')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3159bc,_0x2dbdc3,_0x1c24ef){_0x1c24ef(null,path[_0xb2b8('0x15')](config[_0xb2b8('0x16')],_0xb2b8('0x17')));},'filename':function(_0x2e55f0,_0x4fe810,_0x4d17c8){_0x4d17c8(null,util[_0xb2b8('0x18')](_0xb2b8('0x19'),_0xb2b8('0x1a'),path['extname'](_0x4fe810['originalname'])));}})});router[_0xb2b8('0x1b')]('/:id/logo',upload['single'](_0xb2b8('0x1c')),controller[_0xb2b8('0x1d')]);var upload=multer({'storage':multer[_0xb2b8('0x1e')]({'destination':function(_0x5483a8,_0x44ecc8,_0x2129dd){_0x2129dd(null,path[_0xb2b8('0x15')](config[_0xb2b8('0x16')],_0xb2b8('0x17')));},'filename':function(_0x3f542c,_0x380660,_0x103cb8){_0x103cb8(null,util[_0xb2b8('0x18')]('%s%s',_0xb2b8('0x1f'),path[_0xb2b8('0x20')](_0x380660[_0xb2b8('0x21')])));}})});router[_0xb2b8('0x1b')](_0xb2b8('0x22'),upload['single'](_0xb2b8('0x1c')),controller[_0xb2b8('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3bf1e0,_0x112b95,_0x51ddea){_0x51ddea(null,path[_0xb2b8('0x15')](config[_0xb2b8('0x16')],_0xb2b8('0x17')));},'filename':function(_0x19f700,_0x4864b8,_0x175157){_0x175157(null,util[_0xb2b8('0x18')](_0xb2b8('0x19'),_0xb2b8('0x24'),path[_0xb2b8('0x20')](_0x4864b8[_0xb2b8('0x21')])));}})});router[_0xb2b8('0x1b')](_0xb2b8('0x11'),upload['single'](_0xb2b8('0x1c')),controller[_0xb2b8('0x25')]);var upload=multer({'storage':multer[_0xb2b8('0x1e')]({'destination':function(_0x74a162,_0x16646b,_0x3ce1b0){_0x3ce1b0(null,path[_0xb2b8('0x15')](config['root'],_0xb2b8('0x17')));},'filename':function(_0x22e5e7,_0x575aef,_0x337241){_0x337241(null,util[_0xb2b8('0x18')]('%s%s','favicon',path[_0xb2b8('0x20')](_0x575aef[_0xb2b8('0x21')])));}})});router[_0xb2b8('0x1b')]('/:id/favicon',upload['single'](_0xb2b8('0x1c')),controller[_0xb2b8('0x26')]);router[_0xb2b8('0x27')](_0xb2b8('0x28'),auth[_0xb2b8('0xa')](),controller[_0xb2b8('0x29')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 84d9a46..4bb3029 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 _0x0517=['alternate','sequelize','INTEGER','min_internal','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml'];(function(_0x57969b,_0x3605da){var _0x4025eb=function(_0x340c45){while(--_0x340c45){_0x57969b['push'](_0x57969b['shift']());}};_0x4025eb(++_0x3605da);}(_0x0517,0x9a));var _0x7051=function(_0x2113df,_0x32279e){_0x2113df=_0x2113df-0x0;var _0xa4d209=_0x0517[_0x2113df];return _0xa4d209;};'use strict';var Sequelize=require(_0x7051('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x7051('0x1')](0xb),'unique':_0x7051('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x7051('0x1')](0xb),'unique':_0x7051('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x7051('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x7051('0x4')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x7051('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x7051('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x7051('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x7051('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x7051('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x7051('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x7051('0x5')]},'turnusername':{'type':Sequelize[_0x7051('0x5')]},'turnpassword':{'type':Sequelize[_0x7051('0x5')]},'pageTitle':{'type':Sequelize[_0x7051('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x7051('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x7051('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x7051('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x7051('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x7051('0x5')],'defaultValue':_0x7051('0x7')},'enableEmailPreview':{'type':Sequelize[_0x7051('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x7051('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x7051('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x7051('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x7051('0x5')],'defaultValue':_0x7051('0x8')},'chatTimeout':{'type':Sequelize[_0x7051('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x7051('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x7051('0x5')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x7051('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x7051('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x7051('0x5')]},'defaultFavicon':{'type':Sequelize[_0x7051('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x7051('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x7051('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x7051('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x7051('0x1')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x7051('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x7051('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x7051('0x1')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7051('0x5')]},'bucket':{'type':Sequelize[_0x7051('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x7051('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x5ef5=['INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','exports'];(function(_0x14aff6,_0x215a80){var _0x3dba28=function(_0x1a3e68){while(--_0x1a3e68){_0x14aff6['push'](_0x14aff6['shift']());}};_0x3dba28(++_0x215a80);}(_0x5ef5,0x147));var _0x55ef=function(_0x1da9a5,_0x1e08c5){_0x1da9a5=_0x1da9a5-0x0;var _0x149571=_0x5ef5[_0x1da9a5];return _0x149571;};'use strict';var Sequelize=require('sequelize');module[_0x55ef('0x0')]={'min_internal':{'type':Sequelize[_0x55ef('0x1')](0xb),'unique':_0x55ef('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x55ef('0x1')](0xb),'unique':_0x55ef('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x55ef('0x4')],'defaultValue':_0x55ef('0x5')},'logo':{'type':Sequelize[_0x55ef('0x4')]},'defaultLogo':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x55ef('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x55ef('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x55ef('0x4')]},'turnaddr':{'type':Sequelize[_0x55ef('0x4')]},'turnusername':{'type':Sequelize[_0x55ef('0x4')]},'turnpassword':{'type':Sequelize[_0x55ef('0x4')]},'pageTitle':{'type':Sequelize[_0x55ef('0x4')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x55ef('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x55ef('0x4')],'defaultValue':_0x55ef('0x7')},'enableEmailPreview':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x55ef('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x55ef('0x4')]},'defaultPreferred':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x55ef('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x55ef('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x55ef('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x55ef('0x1')]},'transcribeRegion':{'type':Sequelize[_0x55ef('0x4')]},'sentiment':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x55ef('0x1')]},'sentimentRegion':{'type':Sequelize[_0x55ef('0x4')]},'language':{'type':Sequelize[_0x55ef('0x4')]},'bucket':{'type':Sequelize[_0x55ef('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x55ef('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index bee44d7..f508ba0 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 _0x7502=['mustache','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','destroy','stack','name','send','index','map','Setting','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','params','rawAttributes','includeAll','find','body','file','filename','logo','addLogoLogin','loginLogo','getLogo','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','upperFirst','custom','getLogoLogin','server/files/images/logos','default','default_loginLogo.svg','\x20not\x20found','download','securePassword','addPreferred','../../config/license/util','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x18d392,_0x1ccf63){var _0x12a25d=function(_0x2d3177){while(--_0x2d3177){_0x18d392['push'](_0x18d392['shift']());}};_0x12a25d(++_0x1ccf63);}(_0x7502,0x15b));var _0x2750=function(_0x3a48e6,_0x2586e0){_0x3a48e6=_0x3a48e6-0x0;var _0x2e17be=_0x7502[_0x3a48e6];return _0x2e17be;};'use strict';var pdf=require(_0x2750('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2750('0x1'));var zipdir=require(_0x2750('0x2'));var jsonpatch=require(_0x2750('0x3'));var rp=require(_0x2750('0x4'));var moment=require(_0x2750('0x5'));var BPromise=require(_0x2750('0x6'));var Mustache=require(_0x2750('0x7'));var util=require('util');var path=require(_0x2750('0x8'));var sox=require('sox');var csv=require(_0x2750('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2750('0xa'));var squel=require(_0x2750('0xb'));var crypto=require('crypto');var jsforce=require(_0x2750('0xc'));var deskjs=require(_0x2750('0xd'));var toCsv=require(_0x2750('0x9'));var querystring=require(_0x2750('0xe'));var Papa=require(_0x2750('0xf'));var Redis=require(_0x2750('0x10'));var authService=require(_0x2750('0x11'));var qs=require(_0x2750('0x12'));var as=require(_0x2750('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2750('0x14'))('api');var utils=require(_0x2750('0x15'));var config=require('../../config/environment');var db=require(_0x2750('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x2750('0x17')][_0x2750('0x18')]({'port':0x232a});function checkPasswordPattern(_0x4dfd21,_0x383ecd,_0x3a099d){if(_0x3a099d){var _0x33c52b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x33c52b['test'](_0x383ecd)){return _0x4dfd21;}else{throw new db[(_0x2750('0x19'))][(_0x2750('0x1a'))](_0x2750('0x1b'));}}else{return _0x4dfd21;}}function respondWithRpcPromise(_0x5c5984,_0x509ce0,_0x19873f,_0x46efa7){return new BPromise(function(_0x135dfc,_0x27c155){var _0x2ff313=_0x46efa7||client;return _0x2ff313[_0x2750('0x1c')](_0x5c5984,_0x19873f)[_0x2750('0x1d')](function(_0x561d7a){logger[_0x2750('0x1e')](_0x2750('0x1f'),_0x509ce0,_0x2750('0x20'));logger['debug'](_0x2750('0x21'),_0x509ce0,'request\x20sent',JSON['stringify'](_0x561d7a));if(_0x561d7a['error']){if(_0x561d7a[_0x2750('0x22')][_0x2750('0x23')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x509ce0,_0x561d7a['error'][_0x2750('0x24')]);return _0x27c155(_0x561d7a[_0x2750('0x22')]['message']);}logger[_0x2750('0x22')](_0x2750('0x1f'),_0x509ce0,_0x561d7a[_0x2750('0x22')][_0x2750('0x24')]);return _0x135dfc(_0x561d7a['error'][_0x2750('0x24')]);}else{logger[_0x2750('0x1e')](_0x2750('0x1f'),_0x509ce0,_0x2750('0x20'));_0x135dfc(_0x561d7a[_0x2750('0x25')]['message']);}})[_0x2750('0x26')](function(_0x2733f2){logger[_0x2750('0x22')]('Setting,\x20%s,\x20%s',_0x509ce0,_0x2733f2);_0x27c155(_0x2733f2);});});}function respondWithStatusCode(_0x14de5e,_0x32fd7c){_0x32fd7c=_0x32fd7c||0xcc;return function(_0x53e05c){if(_0x53e05c){return _0x14de5e[_0x2750('0x27')](_0x32fd7c);}return _0x14de5e[_0x2750('0x28')](_0x32fd7c)[_0x2750('0x29')]();};}function respondWithResult(_0x40efc1,_0x5a294a){_0x5a294a=_0x5a294a||0xc8;return function(_0x157982){if(_0x157982){return _0x40efc1['status'](_0x5a294a)[_0x2750('0x2a')](_0x157982);}};}function respondWithFilteredResult(_0x1dc78d,_0x410039){return function(_0x12a81d){if(_0x12a81d){var _0xdc0b1f=_0x12a81d[_0x2750('0x2b')],_0x512a4e=_0x410039[_0x2750('0x2c')],_0x4816c4=_0x410039[_0x2750('0x2c')]+_0x410039[_0x2750('0x2d')],_0x43cad8;if(_0x4816c4>=_0xdc0b1f){_0x4816c4=_0xdc0b1f;_0x43cad8=0xc8;}else{_0x43cad8=0xce;}_0x1dc78d['status'](_0x43cad8);return _0x1dc78d[_0x2750('0x2e')]('Content-Range',_0x512a4e+'-'+_0x4816c4+'/'+_0xdc0b1f)['json'](_0x12a81d);}return null;};}function patchUpdates(_0xc99ae1){return function(_0x1e1b36){try{jsonpatch[_0x2750('0x2f')](_0x1e1b36,_0xc99ae1,!![]);}catch(_0x2f359f){return BPromise['reject'](_0x2f359f);}return _0x1e1b36[_0x2750('0x30')]();};}function saveUpdates(_0x204880,_0x30c2c1){return function(_0x21cf7e){if(_0x21cf7e){return _0x21cf7e[_0x2750('0x31')](_0x204880)[_0x2750('0x1d')](function(_0x51a98f){return _0x51a98f;});}return null;};}function removeEntity(_0x47b694,_0x83339a){return function(_0x1fe91b){if(_0x1fe91b){return _0x1fe91b[_0x2750('0x32')]()[_0x2750('0x1d')](function(){_0x47b694[_0x2750('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x570aaf,_0x369329){return function(_0x7f01d1){if(!_0x7f01d1){_0x570aaf[_0x2750('0x27')](0x194);}return _0x7f01d1;};}function handleError(_0x2a2a47,_0x21b89d){_0x21b89d=_0x21b89d||0x1f4;return function(_0x3e2bbd){logger[_0x2750('0x22')](_0x3e2bbd[_0x2750('0x33')]);if(_0x3e2bbd[_0x2750('0x34')]){delete _0x3e2bbd['name'];}_0x2a2a47[_0x2750('0x28')](_0x21b89d)[_0x2750('0x35')](_0x3e2bbd);};}exports[_0x2750('0x36')]=function(_0x3ffa98,_0x41cf59){var _0x126ec7={},_0x589d30={},_0x138c2a={'count':0x0,'rows':[]};var _0x1171a7=_[_0x2750('0x37')](db[_0x2750('0x38')]['rawAttributes'],function(_0x322cd3){return{'name':_0x322cd3[_0x2750('0x39')],'type':_0x322cd3[_0x2750('0x3a')][_0x2750('0x3b')]};});_0x589d30[_0x2750('0x3c')]=_[_0x2750('0x37')](_0x1171a7,_0x2750('0x34'));_0x589d30[_0x2750('0x3d')]=_[_0x2750('0x3e')](_0x3ffa98[_0x2750('0x3d')]);_0x589d30['filters']=_[_0x2750('0x3f')](_0x589d30['model'],_0x589d30[_0x2750('0x3d')]);_0x126ec7[_0x2750('0x40')]=_[_0x2750('0x3f')](_0x589d30['model'],qs[_0x2750('0x41')](_0x3ffa98[_0x2750('0x3d')][_0x2750('0x41')]));_0x126ec7[_0x2750('0x40')]=_0x126ec7['attributes'][_0x2750('0x42')]?_0x126ec7[_0x2750('0x40')]:_0x589d30[_0x2750('0x3c')];if(!_0x3ffa98[_0x2750('0x3d')][_0x2750('0x43')](_0x2750('0x44'))){_0x126ec7[_0x2750('0x2d')]=qs['limit'](_0x3ffa98[_0x2750('0x3d')][_0x2750('0x2d')]);_0x126ec7[_0x2750('0x2c')]=qs[_0x2750('0x2c')](_0x3ffa98['query'][_0x2750('0x2c')]);}_0x126ec7['order']=qs[_0x2750('0x45')](_0x3ffa98[_0x2750('0x3d')][_0x2750('0x45')]);_0x126ec7['where']=qs[_0x2750('0x46')](_[_0x2750('0x47')](_0x3ffa98['query'],_0x589d30['filters']),_0x1171a7);if(_0x3ffa98['query'][_0x2750('0x48')]){_0x126ec7[_0x2750('0x49')]=_[_0x2750('0x4a')](_0x126ec7[_0x2750('0x49')],{'$or':_[_0x2750('0x37')](_0x1171a7,function(_0x4177c3){if(_0x4177c3[_0x2750('0x3a')]!==_0x2750('0x4b')){var _0x1a07e4={};_0x1a07e4[_0x4177c3[_0x2750('0x34')]]={'$like':'%'+_0x3ffa98[_0x2750('0x3d')]['filter']+'%'};return _0x1a07e4;}})});}_0x126ec7=_[_0x2750('0x4a')]({},_0x126ec7,_0x3ffa98[_0x2750('0x4c')]);var _0x17454d={'where':_0x126ec7['where']};return db[_0x2750('0x38')]['count'](_0x17454d)[_0x2750('0x1d')](function(_0x55cd32){_0x138c2a['count']=_0x55cd32;if(_0x3ffa98[_0x2750('0x3d')]['includeAll']){_0x126ec7[_0x2750('0x4d')]=[{'all':!![]}];}return db[_0x2750('0x38')][_0x2750('0x4e')](_0x126ec7);})[_0x2750('0x1d')](function(_0x37edaf){_0x138c2a[_0x2750('0x4f')]=_0x37edaf;return _0x138c2a;})['then'](respondWithFilteredResult(_0x41cf59,_0x126ec7))[_0x2750('0x26')](handleError(_0x41cf59,null));};exports['show']=function(_0x187041,_0x47cd0c){var _0x4da823={'raw':![],'where':{'id':_0x187041[_0x2750('0x50')]['id']}},_0x1afb97={};_0x1afb97[_0x2750('0x3c')]=_[_0x2750('0x3e')](db[_0x2750('0x38')][_0x2750('0x51')]);_0x1afb97[_0x2750('0x3d')]=_[_0x2750('0x3e')](_0x187041['query']);_0x1afb97['filters']=_['intersection'](_0x1afb97[_0x2750('0x3c')],_0x1afb97[_0x2750('0x3d')]);_0x4da823[_0x2750('0x40')]=_['intersection'](_0x1afb97[_0x2750('0x3c')],qs['fields'](_0x187041[_0x2750('0x3d')]['fields']));_0x4da823['attributes']=_0x4da823[_0x2750('0x40')][_0x2750('0x42')]?_0x4da823[_0x2750('0x40')]:_0x1afb97[_0x2750('0x3c')];if(_0x187041[_0x2750('0x3d')][_0x2750('0x52')]){_0x4da823['include']=[{'all':!![]}];}_0x4da823=_[_0x2750('0x4a')]({},_0x4da823,_0x187041['options']);return db[_0x2750('0x38')][_0x2750('0x53')](_0x4da823)[_0x2750('0x1d')](handleEntityNotFound(_0x47cd0c,null))[_0x2750('0x1d')](respondWithResult(_0x47cd0c,null))[_0x2750('0x26')](handleError(_0x47cd0c,null));};exports['update']=function(_0x3b720c,_0x19cee0){if(_0x3b720c[_0x2750('0x54')]['id']){delete _0x3b720c['body']['id'];}return db[_0x2750('0x38')][_0x2750('0x53')]({'where':{'id':_0x3b720c[_0x2750('0x50')]['id']}})['then'](handleEntityNotFound(_0x19cee0,null))[_0x2750('0x1d')](saveUpdates(_0x3b720c[_0x2750('0x54')],null))['then'](respondWithResult(_0x19cee0,null))['catch'](handleError(_0x19cee0,null));};exports['addLogo']=function(_0x3425da,_0x287195,_0x2c79c3){if(_0x3425da[_0x2750('0x55')]&&_0x3425da[_0x2750('0x55')][_0x2750('0x56')]){_0x3425da[_0x2750('0x54')][_0x2750('0x57')]=_0x3425da[_0x2750('0x55')][_0x2750('0x56')];}return db[_0x2750('0x38')]['find']({'where':{'id':_0x3425da[_0x2750('0x50')]['id']}})[_0x2750('0x1d')](handleEntityNotFound(_0x287195,null))['then'](saveUpdates(_0x3425da[_0x2750('0x54')],null))['then'](respondWithResult(_0x287195,null))['catch'](handleError(_0x287195,null));};exports[_0x2750('0x58')]=function(_0x276369,_0x1a3d01,_0x2f6843){if(_0x276369[_0x2750('0x55')]&&_0x276369[_0x2750('0x55')][_0x2750('0x56')]){_0x276369[_0x2750('0x54')][_0x2750('0x59')]=_0x276369['file']['filename'];}return db[_0x2750('0x38')]['find']({'where':{'id':_0x276369[_0x2750('0x50')]['id']}})['then'](handleEntityNotFound(_0x1a3d01,null))[_0x2750('0x1d')](saveUpdates(_0x276369['body'],null))[_0x2750('0x1d')](respondWithResult(_0x1a3d01,null))[_0x2750('0x26')](handleError(_0x1a3d01,null));};var utilLicense=require('../../config/license/util');exports[_0x2750('0x5a')]=function(_0x149434,_0x28c811,_0x3cdf55){var _0x66b341='server/files/images/logos';var _0x2c0853={'custom':![]};return utilLicense[_0x2750('0x5b')]()[_0x2750('0x1d')](function(_0x4daca3){if(_0x4daca3){_0x2c0853=_0x4daca3;}return db[_0x2750('0x38')][_0x2750('0x53')]({'where':{'id':_0x149434['params']['id']},'attributes':[_0x2750('0x57'),_0x2750('0x59'),_0x2750('0x5c'),_0x2750('0x5d'),_0x2750('0x5e'),_0x2750('0x5f'),_0x2750('0x60'),_0x2750('0x61')],'raw':!![]});})[_0x2750('0x1d')](handleEntityNotFound(_0x28c811,null))[_0x2750('0x1d')](function(_0x190727){if(_0x190727){var _0x57d37f=_0x190727[_0x2750('0x57')]&&fs[_0x2750('0x62')](path[_0x2750('0x63')](config['root'],_0x66b341,_[_0x2750('0x64')](_0x190727['logo'])))?path[_0x2750('0x63')](config[_0x2750('0x65')],_0x66b341,_[_0x2750('0x64')](_0x190727[_0x2750('0x57')])):path[_0x2750('0x63')](config[_0x2750('0x65')],_0x66b341,_[_0x2750('0x64')](_0x2750('0x66')));var _0x498086='default'+_[_0x2750('0x67')]('logo');if(_0x190727[_0x498086]||!_0x2c0853[_0x2750('0x68')]){_0x57d37f=path['join'](config[_0x2750('0x65')],_0x66b341,_[_0x2750('0x64')](_0x2750('0x66')));}if(!fs['existsSync'](_0x57d37f)){throw new db[(_0x2750('0x19'))][(_0x2750('0x1a'))](_[_0x2750('0x67')](_0x2750('0x57'))+'\x20not\x20found');}return _0x28c811['download'](_0x57d37f);}})['catch'](handleError(_0x28c811,null));};var utilLicense=require('../../config/license/util');exports[_0x2750('0x69')]=function(_0x92b0f9,_0x526cd3,_0x3dd51b){var _0x10ec01=_0x2750('0x6a');var _0x165c80={'custom':![]};return utilLicense[_0x2750('0x5b')]()[_0x2750('0x1d')](function(_0x2c4eea){if(_0x2c4eea){_0x165c80=_0x2c4eea;}return db['Setting']['find']({'where':{'id':_0x92b0f9[_0x2750('0x50')]['id']},'attributes':[_0x2750('0x57'),_0x2750('0x59'),_0x2750('0x5c'),_0x2750('0x5d'),_0x2750('0x5e'),_0x2750('0x5f'),_0x2750('0x60'),_0x2750('0x61')],'raw':!![]});})[_0x2750('0x1d')](handleEntityNotFound(_0x526cd3,null))[_0x2750('0x1d')](function(_0x463684){if(_0x463684){var _0x2ba3e7=_0x463684[_0x2750('0x59')]&&fs[_0x2750('0x62')](path[_0x2750('0x63')](config[_0x2750('0x65')],_0x10ec01,_['toLower'](_0x463684[_0x2750('0x59')])))?path[_0x2750('0x63')](config['root'],_0x10ec01,_['toLower'](_0x463684[_0x2750('0x59')])):path[_0x2750('0x63')](config[_0x2750('0x65')],_0x10ec01,_[_0x2750('0x64')]('default_loginLogo.svg'));var _0x5d3ca1=_0x2750('0x6b')+_['upperFirst']('loginLogo');if(_0x463684[_0x5d3ca1]||!_0x165c80['custom']){_0x2ba3e7=path[_0x2750('0x63')](config['root'],_0x10ec01,_[_0x2750('0x64')](_0x2750('0x6c')));}if(!fs['existsSync'](_0x2ba3e7)){throw new db[(_0x2750('0x19'))]['ValidationError'](_[_0x2750('0x67')](_0x2750('0x59'))+_0x2750('0x6d'));}return _0x526cd3[_0x2750('0x6e')](_0x2ba3e7);}})[_0x2750('0x26')](handleError(_0x526cd3,null));};exports['gdpr']=function(_0x4f010f,_0x447a15){return db[_0x2750('0x38')][_0x2750('0x53')]({'where':{'id':_0x4f010f[_0x2750('0x50')]['id']},'attributes':[_0x2750('0x6f')]})[_0x2750('0x1d')](respondWithResult(_0x447a15,null))['catch'](handleError(_0x447a15,null));};exports[_0x2750('0x70')]=function(_0x238171,_0x23c2c2,_0x2bed0c){if(_0x238171[_0x2750('0x55')]&&_0x238171[_0x2750('0x55')][_0x2750('0x56')]){_0x238171[_0x2750('0x54')][_0x2750('0x5c')]=_0x238171['file'][_0x2750('0x56')];}return db[_0x2750('0x38')]['find']({'where':{'id':_0x238171[_0x2750('0x50')]['id']}})[_0x2750('0x1d')](handleEntityNotFound(_0x23c2c2,null))[_0x2750('0x1d')](saveUpdates(_0x238171[_0x2750('0x54')],null))[_0x2750('0x1d')](respondWithResult(_0x23c2c2,null))[_0x2750('0x26')](handleError(_0x23c2c2,null));};var utilLicense=require(_0x2750('0x71'));exports['getPreferred']=function(_0x3594a7,_0x249b40,_0x32daa4){var _0x5b7e3a=_0x2750('0x6a');var _0x4e9835={'custom':![]};return utilLicense[_0x2750('0x5b')]()[_0x2750('0x1d')](function(_0x2f68cd){if(_0x2f68cd){_0x4e9835=_0x2f68cd;}return db[_0x2750('0x38')]['find']({'where':{'id':_0x3594a7[_0x2750('0x50')]['id']},'attributes':['logo','loginLogo',_0x2750('0x5c'),_0x2750('0x5d'),_0x2750('0x5e'),_0x2750('0x5f'),_0x2750('0x60'),'defaultFavicon'],'raw':!![]});})[_0x2750('0x1d')](handleEntityNotFound(_0x249b40,null))[_0x2750('0x1d')](function(_0x9cbb87){if(_0x9cbb87){var _0xd3a541=_0x9cbb87[_0x2750('0x5c')]&&fs[_0x2750('0x62')](path[_0x2750('0x63')](config[_0x2750('0x65')],_0x5b7e3a,_[_0x2750('0x64')](_0x9cbb87['preferred'])))?path[_0x2750('0x63')](config[_0x2750('0x65')],_0x5b7e3a,_[_0x2750('0x64')](_0x9cbb87[_0x2750('0x5c')])):path[_0x2750('0x63')](config[_0x2750('0x65')],_0x5b7e3a,_[_0x2750('0x64')](_0x2750('0x72')));var _0x5324c7=_0x2750('0x6b')+_[_0x2750('0x67')](_0x2750('0x5c'));if(_0x9cbb87[_0x5324c7]||!_0x4e9835[_0x2750('0x68')]||!_0x4e9835[_0x2750('0x5c')]){_0xd3a541=path[_0x2750('0x63')](config[_0x2750('0x65')],_0x5b7e3a,_[_0x2750('0x64')](_0x2750('0x72')));}if(!fs['existsSync'](_0xd3a541)){throw new db['Sequelize'][(_0x2750('0x1a'))](_[_0x2750('0x67')](_0x2750('0x5c'))+'\x20not\x20found');}return _0x249b40['download'](_0xd3a541);}})[_0x2750('0x26')](handleError(_0x249b40,null));};exports[_0x2750('0x73')]=function(_0x148852,_0x1508d6,_0x463788){if(_0x148852[_0x2750('0x55')]&&_0x148852[_0x2750('0x55')]['filename']){_0x148852[_0x2750('0x54')]['favicon']=_0x148852[_0x2750('0x55')][_0x2750('0x56')];}return db[_0x2750('0x38')]['find']({'where':{'id':_0x148852[_0x2750('0x50')]['id']}})[_0x2750('0x1d')](handleEntityNotFound(_0x1508d6,null))[_0x2750('0x1d')](saveUpdates(_0x148852[_0x2750('0x54')],null))[_0x2750('0x1d')](respondWithResult(_0x1508d6,null))[_0x2750('0x26')](handleError(_0x1508d6,null));};var utilLicense=require(_0x2750('0x71'));exports[_0x2750('0x74')]=function(_0x2b963d,_0x213232,_0x382539){var _0x3a358e=_0x2750('0x6a');var _0xf65485={'custom':![]};return utilLicense[_0x2750('0x5b')]()[_0x2750('0x1d')](function(_0x389d59){if(_0x389d59){_0xf65485=_0x389d59;}return db[_0x2750('0x38')][_0x2750('0x53')]({'where':{'id':_0x2b963d[_0x2750('0x50')]['id']},'attributes':[_0x2750('0x57'),'loginLogo',_0x2750('0x5c'),'favicon',_0x2750('0x5e'),_0x2750('0x5f'),_0x2750('0x60'),_0x2750('0x61')],'raw':!![]});})[_0x2750('0x1d')](handleEntityNotFound(_0x213232,null))[_0x2750('0x1d')](function(_0x58a6c3){if(_0x58a6c3){var _0x34235b=_0x58a6c3['favicon']&&fs[_0x2750('0x62')](path['join'](config[_0x2750('0x65')],_0x3a358e,_[_0x2750('0x64')](_0x58a6c3[_0x2750('0x5d')])))?path[_0x2750('0x63')](config[_0x2750('0x65')],_0x3a358e,_['toLower'](_0x58a6c3[_0x2750('0x5d')])):path['join'](config[_0x2750('0x65')],_0x3a358e,_[_0x2750('0x64')](_0x2750('0x75')));var _0x5645ce=_0x2750('0x6b')+_['upperFirst']('favicon');if(_0x58a6c3[_0x5645ce]||!_0xf65485[_0x2750('0x68')]){_0x34235b=path[_0x2750('0x63')](config['root'],_0x3a358e,_['toLower'](_0x2750('0x75')));}if(!fs[_0x2750('0x62')](_0x34235b)){throw new db['Sequelize'][(_0x2750('0x1a'))](_[_0x2750('0x67')]('favicon')+_0x2750('0x6d'));}return _0x213232[_0x2750('0x6e')](_0x34235b);}})[_0x2750('0x26')](handleError(_0x213232,null));}; \ No newline at end of file +var _0xbbe6=['default_favicon.ico','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','stack','name','map','rawAttributes','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','Setting','includeAll','include','findAll','rows','show','keys','find','update','params','body','addLogo','file','logo','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','custom','upperFirst','\x20not\x20found','../../config/license/util','getLogoLogin','getLicense','defaultLogo','default_loginLogo.svg','download','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon'];(function(_0x2af2ae,_0x2e8edf){var _0x4df976=function(_0xcb49b){while(--_0xcb49b){_0x2af2ae['push'](_0x2af2ae['shift']());}};_0x4df976(++_0x2e8edf);}(_0xbbe6,0x175));var _0x6bbe=function(_0x5123b8,_0x29dfdc){_0x5123b8=_0x5123b8-0x0;var _0x3da0d5=_0xbbe6[_0x5123b8];return _0x3da0d5;};'use strict';var pdf=require(_0x6bbe('0x0'));var emlformat=require(_0x6bbe('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6bbe('0x2'));var jsonpatch=require(_0x6bbe('0x3'));var rp=require(_0x6bbe('0x4'));var moment=require(_0x6bbe('0x5'));var BPromise=require(_0x6bbe('0x6'));var Mustache=require(_0x6bbe('0x7'));var util=require(_0x6bbe('0x8'));var path=require('path');var sox=require(_0x6bbe('0x9'));var csv=require('to-csv');var ejs=require(_0x6bbe('0xa'));var fs=require('fs');var _=require(_0x6bbe('0xb'));var squel=require('squel');var crypto=require(_0x6bbe('0xc'));var jsforce=require(_0x6bbe('0xd'));var deskjs=require(_0x6bbe('0xe'));var toCsv=require(_0x6bbe('0xf'));var querystring=require(_0x6bbe('0x10'));var Papa=require(_0x6bbe('0x11'));var Redis=require(_0x6bbe('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6bbe('0x13'));var as=require(_0x6bbe('0x14'));var hardwareService=require(_0x6bbe('0x15'));var logger=require('../../config/logger')(_0x6bbe('0x16'));var utils=require(_0x6bbe('0x17'));var config=require(_0x6bbe('0x18'));var db=require(_0x6bbe('0x19'))['db'];var jayson=require(_0x6bbe('0x1a'));var client=jayson['client'][_0x6bbe('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x487f02,_0x5bdc41,_0x481413){if(_0x481413){var _0x409c60=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x409c60[_0x6bbe('0x1c')](_0x5bdc41)){return _0x487f02;}else{throw new db[(_0x6bbe('0x1d'))][(_0x6bbe('0x1e'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x487f02;}}function respondWithRpcPromise(_0xcb4014,_0x4a73f7,_0x521191,_0x5b958a){return new BPromise(function(_0x1a591e,_0x103ea6){var _0x5ad4b7=_0x5b958a||client;return _0x5ad4b7['request'](_0xcb4014,_0x521191)[_0x6bbe('0x1f')](function(_0xb2e80){logger[_0x6bbe('0x20')](_0x6bbe('0x21'),_0x4a73f7,_0x6bbe('0x22'));logger[_0x6bbe('0x23')](_0x6bbe('0x24'),_0x4a73f7,_0x6bbe('0x22'),JSON[_0x6bbe('0x25')](_0xb2e80));if(_0xb2e80[_0x6bbe('0x26')]){if(_0xb2e80[_0x6bbe('0x26')][_0x6bbe('0x27')]===0x1f4){logger[_0x6bbe('0x26')]('Setting,\x20%s,\x20%s',_0x4a73f7,_0xb2e80[_0x6bbe('0x26')][_0x6bbe('0x28')]);return _0x103ea6(_0xb2e80[_0x6bbe('0x26')][_0x6bbe('0x28')]);}logger[_0x6bbe('0x26')]('Setting,\x20%s,\x20%s',_0x4a73f7,_0xb2e80[_0x6bbe('0x26')][_0x6bbe('0x28')]);return _0x1a591e(_0xb2e80[_0x6bbe('0x26')]['message']);}else{logger[_0x6bbe('0x20')](_0x6bbe('0x21'),_0x4a73f7,_0x6bbe('0x22'));_0x1a591e(_0xb2e80[_0x6bbe('0x29')][_0x6bbe('0x28')]);}})[_0x6bbe('0x2a')](function(_0x5153ac){logger[_0x6bbe('0x26')]('Setting,\x20%s,\x20%s',_0x4a73f7,_0x5153ac);_0x103ea6(_0x5153ac);});});}function respondWithStatusCode(_0x527965,_0x542123){_0x542123=_0x542123||0xcc;return function(_0x114e68){if(_0x114e68){return _0x527965[_0x6bbe('0x2b')](_0x542123);}return _0x527965[_0x6bbe('0x2c')](_0x542123)[_0x6bbe('0x2d')]();};}function respondWithResult(_0x792875,_0x2cde98){_0x2cde98=_0x2cde98||0xc8;return function(_0x4f6cfb){if(_0x4f6cfb){return _0x792875[_0x6bbe('0x2c')](_0x2cde98)[_0x6bbe('0x2e')](_0x4f6cfb);}};}function respondWithFilteredResult(_0x558959,_0x945c21){return function(_0x46c8e1){if(_0x46c8e1){var _0x54728c=_0x46c8e1[_0x6bbe('0x2f')],_0x2cb78d=_0x945c21[_0x6bbe('0x30')],_0x3246d1=_0x945c21[_0x6bbe('0x30')]+_0x945c21[_0x6bbe('0x31')],_0x2cd563;if(_0x3246d1>=_0x54728c){_0x3246d1=_0x54728c;_0x2cd563=0xc8;}else{_0x2cd563=0xce;}_0x558959[_0x6bbe('0x2c')](_0x2cd563);return _0x558959[_0x6bbe('0x32')](_0x6bbe('0x33'),_0x2cb78d+'-'+_0x3246d1+'/'+_0x54728c)[_0x6bbe('0x2e')](_0x46c8e1);}return null;};}function patchUpdates(_0x1630ae){return function(_0x4f93aa){try{jsonpatch[_0x6bbe('0x34')](_0x4f93aa,_0x1630ae,!![]);}catch(_0x28c8e4){return BPromise[_0x6bbe('0x35')](_0x28c8e4);}return _0x4f93aa[_0x6bbe('0x36')]();};}function saveUpdates(_0x303132,_0x443b50){return function(_0x5b8af5){if(_0x5b8af5){return _0x5b8af5['update'](_0x303132)[_0x6bbe('0x1f')](function(_0x3878b5){return _0x3878b5;});}return null;};}function removeEntity(_0x2c81b4,_0x4e1540){return function(_0x5dcdc8){if(_0x5dcdc8){return _0x5dcdc8['destroy']()[_0x6bbe('0x1f')](function(){_0x2c81b4[_0x6bbe('0x2c')](0xcc)[_0x6bbe('0x2d')]();});}};}function handleEntityNotFound(_0x3455b8,_0x5b5178){return function(_0x476257){if(!_0x476257){_0x3455b8[_0x6bbe('0x2b')](0x194);}return _0x476257;};}function handleError(_0x1b18d1,_0x21dcea){_0x21dcea=_0x21dcea||0x1f4;return function(_0x3ee85f){logger[_0x6bbe('0x26')](_0x3ee85f[_0x6bbe('0x37')]);if(_0x3ee85f[_0x6bbe('0x38')]){delete _0x3ee85f[_0x6bbe('0x38')];}_0x1b18d1[_0x6bbe('0x2c')](_0x21dcea)['send'](_0x3ee85f);};}exports['index']=function(_0x1ab2db,_0x322beb){var _0x3893cd={},_0x2a5b4f={},_0x5ce650={'count':0x0,'rows':[]};var _0x4c58a2=_[_0x6bbe('0x39')](db['Setting'][_0x6bbe('0x3a')],function(_0x1c6450){return{'name':_0x1c6450['fieldName'],'type':_0x1c6450['type'][_0x6bbe('0x3b')]};});_0x2a5b4f['model']=_[_0x6bbe('0x39')](_0x4c58a2,_0x6bbe('0x38'));_0x2a5b4f['query']=_['keys'](_0x1ab2db[_0x6bbe('0x3c')]);_0x2a5b4f[_0x6bbe('0x3d')]=_[_0x6bbe('0x3e')](_0x2a5b4f[_0x6bbe('0x3f')],_0x2a5b4f[_0x6bbe('0x3c')]);_0x3893cd[_0x6bbe('0x40')]=_[_0x6bbe('0x3e')](_0x2a5b4f[_0x6bbe('0x3f')],qs[_0x6bbe('0x41')](_0x1ab2db['query'][_0x6bbe('0x41')]));_0x3893cd['attributes']=_0x3893cd[_0x6bbe('0x40')][_0x6bbe('0x42')]?_0x3893cd['attributes']:_0x2a5b4f[_0x6bbe('0x3f')];if(!_0x1ab2db['query'][_0x6bbe('0x43')](_0x6bbe('0x44'))){_0x3893cd['limit']=qs[_0x6bbe('0x31')](_0x1ab2db[_0x6bbe('0x3c')][_0x6bbe('0x31')]);_0x3893cd[_0x6bbe('0x30')]=qs[_0x6bbe('0x30')](_0x1ab2db[_0x6bbe('0x3c')][_0x6bbe('0x30')]);}_0x3893cd[_0x6bbe('0x45')]=qs[_0x6bbe('0x46')](_0x1ab2db['query']['sort']);_0x3893cd[_0x6bbe('0x47')]=qs[_0x6bbe('0x3d')](_['pick'](_0x1ab2db[_0x6bbe('0x3c')],_0x2a5b4f[_0x6bbe('0x3d')]),_0x4c58a2);if(_0x1ab2db[_0x6bbe('0x3c')][_0x6bbe('0x48')]){_0x3893cd[_0x6bbe('0x47')]=_[_0x6bbe('0x49')](_0x3893cd[_0x6bbe('0x47')],{'$or':_['map'](_0x4c58a2,function(_0x53e906){if(_0x53e906[_0x6bbe('0x4a')]!==_0x6bbe('0x4b')){var _0x242d4d={};_0x242d4d[_0x53e906[_0x6bbe('0x38')]]={'$like':'%'+_0x1ab2db[_0x6bbe('0x3c')][_0x6bbe('0x48')]+'%'};return _0x242d4d;}})});}_0x3893cd=_['merge']({},_0x3893cd,_0x1ab2db[_0x6bbe('0x4c')]);var _0x36e437={'where':_0x3893cd[_0x6bbe('0x47')]};return db[_0x6bbe('0x4d')][_0x6bbe('0x2f')](_0x36e437)[_0x6bbe('0x1f')](function(_0x3265ff){_0x5ce650[_0x6bbe('0x2f')]=_0x3265ff;if(_0x1ab2db[_0x6bbe('0x3c')][_0x6bbe('0x4e')]){_0x3893cd[_0x6bbe('0x4f')]=[{'all':!![]}];}return db[_0x6bbe('0x4d')][_0x6bbe('0x50')](_0x3893cd);})[_0x6bbe('0x1f')](function(_0xa655a0){_0x5ce650[_0x6bbe('0x51')]=_0xa655a0;return _0x5ce650;})['then'](respondWithFilteredResult(_0x322beb,_0x3893cd))[_0x6bbe('0x2a')](handleError(_0x322beb,null));};exports[_0x6bbe('0x52')]=function(_0x200789,_0x3fc428){var _0x1e01e2={'raw':![],'where':{'id':_0x200789['params']['id']}},_0x29bfd0={};_0x29bfd0[_0x6bbe('0x3f')]=_[_0x6bbe('0x53')](db[_0x6bbe('0x4d')]['rawAttributes']);_0x29bfd0[_0x6bbe('0x3c')]=_['keys'](_0x200789[_0x6bbe('0x3c')]);_0x29bfd0[_0x6bbe('0x3d')]=_[_0x6bbe('0x3e')](_0x29bfd0['model'],_0x29bfd0[_0x6bbe('0x3c')]);_0x1e01e2['attributes']=_[_0x6bbe('0x3e')](_0x29bfd0[_0x6bbe('0x3f')],qs[_0x6bbe('0x41')](_0x200789[_0x6bbe('0x3c')]['fields']));_0x1e01e2[_0x6bbe('0x40')]=_0x1e01e2[_0x6bbe('0x40')][_0x6bbe('0x42')]?_0x1e01e2[_0x6bbe('0x40')]:_0x29bfd0[_0x6bbe('0x3f')];if(_0x200789[_0x6bbe('0x3c')][_0x6bbe('0x4e')]){_0x1e01e2[_0x6bbe('0x4f')]=[{'all':!![]}];}_0x1e01e2=_[_0x6bbe('0x49')]({},_0x1e01e2,_0x200789['options']);return db[_0x6bbe('0x4d')][_0x6bbe('0x54')](_0x1e01e2)[_0x6bbe('0x1f')](handleEntityNotFound(_0x3fc428,null))['then'](respondWithResult(_0x3fc428,null))[_0x6bbe('0x2a')](handleError(_0x3fc428,null));};exports[_0x6bbe('0x55')]=function(_0x32f753,_0x4d9ac0){if(_0x32f753['body']['id']){delete _0x32f753['body']['id'];}return db[_0x6bbe('0x4d')][_0x6bbe('0x54')]({'where':{'id':_0x32f753[_0x6bbe('0x56')]['id']}})['then'](handleEntityNotFound(_0x4d9ac0,null))['then'](saveUpdates(_0x32f753[_0x6bbe('0x57')],null))[_0x6bbe('0x1f')](respondWithResult(_0x4d9ac0,null))[_0x6bbe('0x2a')](handleError(_0x4d9ac0,null));};exports[_0x6bbe('0x58')]=function(_0x5ea729,_0x498bb7,_0x2ceeda){if(_0x5ea729[_0x6bbe('0x59')]&&_0x5ea729[_0x6bbe('0x59')]['filename']){_0x5ea729[_0x6bbe('0x57')][_0x6bbe('0x5a')]=_0x5ea729[_0x6bbe('0x59')][_0x6bbe('0x5b')];}return db[_0x6bbe('0x4d')][_0x6bbe('0x54')]({'where':{'id':_0x5ea729[_0x6bbe('0x56')]['id']}})[_0x6bbe('0x1f')](handleEntityNotFound(_0x498bb7,null))[_0x6bbe('0x1f')](saveUpdates(_0x5ea729[_0x6bbe('0x57')],null))[_0x6bbe('0x1f')](respondWithResult(_0x498bb7,null))[_0x6bbe('0x2a')](handleError(_0x498bb7,null));};exports[_0x6bbe('0x5c')]=function(_0x34501a,_0x2bd1b5,_0x499c5d){if(_0x34501a[_0x6bbe('0x59')]&&_0x34501a[_0x6bbe('0x59')]['filename']){_0x34501a['body'][_0x6bbe('0x5d')]=_0x34501a[_0x6bbe('0x59')][_0x6bbe('0x5b')];}return db[_0x6bbe('0x4d')][_0x6bbe('0x54')]({'where':{'id':_0x34501a[_0x6bbe('0x56')]['id']}})[_0x6bbe('0x1f')](handleEntityNotFound(_0x2bd1b5,null))[_0x6bbe('0x1f')](saveUpdates(_0x34501a[_0x6bbe('0x57')],null))[_0x6bbe('0x1f')](respondWithResult(_0x2bd1b5,null))[_0x6bbe('0x2a')](handleError(_0x2bd1b5,null));};var utilLicense=require('../../config/license/util');exports[_0x6bbe('0x5e')]=function(_0x25c34a,_0x3e8694,_0x56aafa){var _0x434f16=_0x6bbe('0x5f');var _0x1f641f={'custom':![]};return utilLicense['getLicense']()[_0x6bbe('0x1f')](function(_0x77d0db){if(_0x77d0db){_0x1f641f=_0x77d0db;}return db[_0x6bbe('0x4d')][_0x6bbe('0x54')]({'where':{'id':_0x25c34a[_0x6bbe('0x56')]['id']},'attributes':[_0x6bbe('0x5a'),_0x6bbe('0x5d'),_0x6bbe('0x60'),_0x6bbe('0x61'),'defaultLogo',_0x6bbe('0x62'),_0x6bbe('0x63'),_0x6bbe('0x64')],'raw':!![]});})[_0x6bbe('0x1f')](handleEntityNotFound(_0x3e8694,null))[_0x6bbe('0x1f')](function(_0x46ccbb){if(_0x46ccbb){var _0xff48bf=_0x46ccbb[_0x6bbe('0x5a')]&&fs[_0x6bbe('0x65')](path[_0x6bbe('0x66')](config['root'],_0x434f16,_[_0x6bbe('0x67')](_0x46ccbb[_0x6bbe('0x5a')])))?path[_0x6bbe('0x66')](config[_0x6bbe('0x68')],_0x434f16,_[_0x6bbe('0x67')](_0x46ccbb[_0x6bbe('0x5a')])):path[_0x6bbe('0x66')](config[_0x6bbe('0x68')],_0x434f16,_[_0x6bbe('0x67')](_0x6bbe('0x69')));var _0x46aae3=_0x6bbe('0x6a')+_['upperFirst'](_0x6bbe('0x5a'));if(_0x46ccbb[_0x46aae3]||!_0x1f641f[_0x6bbe('0x6b')]){_0xff48bf=path[_0x6bbe('0x66')](config[_0x6bbe('0x68')],_0x434f16,_[_0x6bbe('0x67')](_0x6bbe('0x69')));}if(!fs['existsSync'](_0xff48bf)){throw new db['Sequelize'][(_0x6bbe('0x1e'))](_[_0x6bbe('0x6c')](_0x6bbe('0x5a'))+_0x6bbe('0x6d'));}return _0x3e8694['download'](_0xff48bf);}})[_0x6bbe('0x2a')](handleError(_0x3e8694,null));};var utilLicense=require(_0x6bbe('0x6e'));exports[_0x6bbe('0x6f')]=function(_0x111a71,_0x5acadc,_0x22e1f0){var _0x14e9bc=_0x6bbe('0x5f');var _0x333eb3={'custom':![]};return utilLicense[_0x6bbe('0x70')]()[_0x6bbe('0x1f')](function(_0x33029a){if(_0x33029a){_0x333eb3=_0x33029a;}return db[_0x6bbe('0x4d')][_0x6bbe('0x54')]({'where':{'id':_0x111a71[_0x6bbe('0x56')]['id']},'attributes':[_0x6bbe('0x5a'),_0x6bbe('0x5d'),_0x6bbe('0x60'),_0x6bbe('0x61'),_0x6bbe('0x71'),'defaultLoginLogo',_0x6bbe('0x63'),_0x6bbe('0x64')],'raw':!![]});})[_0x6bbe('0x1f')](handleEntityNotFound(_0x5acadc,null))[_0x6bbe('0x1f')](function(_0x999654){if(_0x999654){var _0x4c8acc=_0x999654[_0x6bbe('0x5d')]&&fs[_0x6bbe('0x65')](path[_0x6bbe('0x66')](config[_0x6bbe('0x68')],_0x14e9bc,_[_0x6bbe('0x67')](_0x999654[_0x6bbe('0x5d')])))?path[_0x6bbe('0x66')](config['root'],_0x14e9bc,_['toLower'](_0x999654[_0x6bbe('0x5d')])):path[_0x6bbe('0x66')](config[_0x6bbe('0x68')],_0x14e9bc,_[_0x6bbe('0x67')]('default_loginLogo.svg'));var _0x8a5906=_0x6bbe('0x6a')+_['upperFirst']('loginLogo');if(_0x999654[_0x8a5906]||!_0x333eb3[_0x6bbe('0x6b')]){_0x4c8acc=path[_0x6bbe('0x66')](config['root'],_0x14e9bc,_[_0x6bbe('0x67')](_0x6bbe('0x72')));}if(!fs['existsSync'](_0x4c8acc)){throw new db['Sequelize'][(_0x6bbe('0x1e'))](_[_0x6bbe('0x6c')](_0x6bbe('0x5d'))+'\x20not\x20found');}return _0x5acadc[_0x6bbe('0x73')](_0x4c8acc);}})[_0x6bbe('0x2a')](handleError(_0x5acadc,null));};exports[_0x6bbe('0x74')]=function(_0xf6142c,_0x433098){return db[_0x6bbe('0x4d')][_0x6bbe('0x54')]({'where':{'id':_0xf6142c[_0x6bbe('0x56')]['id']},'attributes':[_0x6bbe('0x75')]})['then'](respondWithResult(_0x433098,null))[_0x6bbe('0x2a')](handleError(_0x433098,null));};exports[_0x6bbe('0x76')]=function(_0xd576cb,_0xbca365,_0x36ed76){if(_0xd576cb[_0x6bbe('0x59')]&&_0xd576cb[_0x6bbe('0x59')][_0x6bbe('0x5b')]){_0xd576cb[_0x6bbe('0x57')][_0x6bbe('0x60')]=_0xd576cb[_0x6bbe('0x59')][_0x6bbe('0x5b')];}return db[_0x6bbe('0x4d')]['find']({'where':{'id':_0xd576cb['params']['id']}})[_0x6bbe('0x1f')](handleEntityNotFound(_0xbca365,null))['then'](saveUpdates(_0xd576cb['body'],null))[_0x6bbe('0x1f')](respondWithResult(_0xbca365,null))[_0x6bbe('0x2a')](handleError(_0xbca365,null));};var utilLicense=require(_0x6bbe('0x6e'));exports[_0x6bbe('0x77')]=function(_0x2e2bfc,_0x2870d7,_0x434ab1){var _0x47094e='server/files/images/logos';var _0x82e536={'custom':![]};return utilLicense[_0x6bbe('0x70')]()['then'](function(_0xa5f672){if(_0xa5f672){_0x82e536=_0xa5f672;}return db[_0x6bbe('0x4d')]['find']({'where':{'id':_0x2e2bfc[_0x6bbe('0x56')]['id']},'attributes':['logo',_0x6bbe('0x5d'),'preferred',_0x6bbe('0x61'),_0x6bbe('0x71'),_0x6bbe('0x62'),_0x6bbe('0x63'),_0x6bbe('0x64')],'raw':!![]});})[_0x6bbe('0x1f')](handleEntityNotFound(_0x2870d7,null))[_0x6bbe('0x1f')](function(_0xf83a66){if(_0xf83a66){var _0x52f178=_0xf83a66[_0x6bbe('0x60')]&&fs['existsSync'](path[_0x6bbe('0x66')](config['root'],_0x47094e,_[_0x6bbe('0x67')](_0xf83a66[_0x6bbe('0x60')])))?path[_0x6bbe('0x66')](config[_0x6bbe('0x68')],_0x47094e,_[_0x6bbe('0x67')](_0xf83a66[_0x6bbe('0x60')])):path[_0x6bbe('0x66')](config[_0x6bbe('0x68')],_0x47094e,_[_0x6bbe('0x67')]('default_preferred.png'));var _0x37ab46=_0x6bbe('0x6a')+_['upperFirst']('preferred');if(_0xf83a66[_0x37ab46]||!_0x82e536[_0x6bbe('0x6b')]||!_0x82e536[_0x6bbe('0x60')]){_0x52f178=path[_0x6bbe('0x66')](config['root'],_0x47094e,_['toLower'](_0x6bbe('0x78')));}if(!fs[_0x6bbe('0x65')](_0x52f178)){throw new db[(_0x6bbe('0x1d'))]['ValidationError'](_[_0x6bbe('0x6c')](_0x6bbe('0x60'))+_0x6bbe('0x6d'));}return _0x2870d7['download'](_0x52f178);}})['catch'](handleError(_0x2870d7,null));};exports[_0x6bbe('0x79')]=function(_0x1f4f8b,_0x43cbbb,_0x363ce6){if(_0x1f4f8b['file']&&_0x1f4f8b[_0x6bbe('0x59')]['filename']){_0x1f4f8b[_0x6bbe('0x57')]['favicon']=_0x1f4f8b[_0x6bbe('0x59')][_0x6bbe('0x5b')];}return db[_0x6bbe('0x4d')][_0x6bbe('0x54')]({'where':{'id':_0x1f4f8b[_0x6bbe('0x56')]['id']}})[_0x6bbe('0x1f')](handleEntityNotFound(_0x43cbbb,null))[_0x6bbe('0x1f')](saveUpdates(_0x1f4f8b[_0x6bbe('0x57')],null))['then'](respondWithResult(_0x43cbbb,null))[_0x6bbe('0x2a')](handleError(_0x43cbbb,null));};var utilLicense=require(_0x6bbe('0x6e'));exports[_0x6bbe('0x7a')]=function(_0x54af39,_0x5bdb81,_0x3b8add){var _0x144140=_0x6bbe('0x5f');var _0x3835d4={'custom':![]};return utilLicense['getLicense']()[_0x6bbe('0x1f')](function(_0x12b918){if(_0x12b918){_0x3835d4=_0x12b918;}return db[_0x6bbe('0x4d')][_0x6bbe('0x54')]({'where':{'id':_0x54af39[_0x6bbe('0x56')]['id']},'attributes':[_0x6bbe('0x5a'),_0x6bbe('0x5d'),_0x6bbe('0x60'),'favicon',_0x6bbe('0x71'),_0x6bbe('0x62'),_0x6bbe('0x63'),_0x6bbe('0x64')],'raw':!![]});})[_0x6bbe('0x1f')](handleEntityNotFound(_0x5bdb81,null))[_0x6bbe('0x1f')](function(_0x51b2bf){if(_0x51b2bf){var _0x5ecc4d=_0x51b2bf[_0x6bbe('0x61')]&&fs[_0x6bbe('0x65')](path['join'](config[_0x6bbe('0x68')],_0x144140,_[_0x6bbe('0x67')](_0x51b2bf[_0x6bbe('0x61')])))?path['join'](config[_0x6bbe('0x68')],_0x144140,_['toLower'](_0x51b2bf[_0x6bbe('0x61')])):path[_0x6bbe('0x66')](config['root'],_0x144140,_['toLower'](_0x6bbe('0x7b')));var _0x831fe2=_0x6bbe('0x6a')+_[_0x6bbe('0x6c')](_0x6bbe('0x61'));if(_0x51b2bf[_0x831fe2]||!_0x3835d4['custom']){_0x5ecc4d=path['join'](config[_0x6bbe('0x68')],_0x144140,_[_0x6bbe('0x67')](_0x6bbe('0x7b')));}if(!fs[_0x6bbe('0x65')](_0x5ecc4d)){throw new db[(_0x6bbe('0x1d'))][(_0x6bbe('0x1e'))](_['upperFirst'](_0x6bbe('0x61'))+_0x6bbe('0x6d'));}return _0x5bdb81[_0x6bbe('0x73')](_0x5ecc4d);}})[_0x6bbe('0x2a')](handleError(_0x5bdb81,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 0fd493e..547f5b5 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 _0x6e9b=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./setting.attributes','exports','define','Setting','lodash','util'];(function(_0x328549,_0x4db942){var _0x453dc2=function(_0x26b133){while(--_0x26b133){_0x328549['push'](_0x328549['shift']());}};_0x453dc2(++_0x4db942);}(_0x6e9b,0x73));var _0xb6e9=function(_0x29446d,_0x518818){_0x29446d=_0x29446d-0x0;var _0x50a44f=_0x6e9b[_0x29446d];return _0x50a44f;};'use strict';var _=require(_0xb6e9('0x0'));var util=require(_0xb6e9('0x1'));var logger=require(_0xb6e9('0x2'))(_0xb6e9('0x3'));var moment=require(_0xb6e9('0x4'));var BPromise=require(_0xb6e9('0x5'));var rp=require(_0xb6e9('0x6'));var fs=require('fs');var path=require(_0xb6e9('0x7'));var rimraf=require('rimraf');var config=require(_0xb6e9('0x8'));var attributes=require(_0xb6e9('0x9'));module[_0xb6e9('0xa')]=function(_0x56b122,_0x11dd20){return _0x56b122[_0xb6e9('0xb')](_0xb6e9('0xc'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3033=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./setting.attributes','Setting','settings','lodash'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3033,0x1cb));var _0x3303=function(_0x435636,_0x4879d9){_0x435636=_0x435636-0x0;var _0x3ea40e=_0x3033[_0x435636];return _0x3ea40e;};'use strict';var _=require(_0x3303('0x0'));var util=require('util');var logger=require(_0x3303('0x1'))(_0x3303('0x2'));var moment=require('moment');var BPromise=require(_0x3303('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3303('0x4'));var rimraf=require(_0x3303('0x5'));var config=require(_0x3303('0x6'));var attributes=require(_0x3303('0x7'));module['exports']=function(_0x16d8f7,_0x468de5){return _0x16d8f7['define'](_0x3303('0x8'),attributes,{'tableName':_0x3303('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 0879ffa..15c6ee8 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 _0x35ba=['../../config/logger','rpc','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0x35ba,0xe0));var _0xa35b=function(_0x5b7fc7,_0x60f01e){_0x5b7fc7=_0x5b7fc7-0x0;var _0x3d0bd2=_0x35ba[_0x5b7fc7];return _0x3d0bd2;};'use strict';var _=require(_0xa35b('0x0'));var util=require('util');var moment=require(_0xa35b('0x1'));var BPromise=require(_0xa35b('0x2'));var rs=require(_0xa35b('0x3'));var fs=require('fs');var Redis=require(_0xa35b('0x4'));var db=require(_0xa35b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa35b('0x6'))(_0xa35b('0x7'));var config=require('../../config/environment');var jayson=require(_0xa35b('0x8'));var client=jayson[_0xa35b('0x9')][_0xa35b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6be58d,_0x477743,_0xc1b69f){return new BPromise(function(_0x296190,_0x20fb2a){return client['request'](_0x6be58d,_0xc1b69f)[_0xa35b('0xb')](function(_0x1fe59e){logger[_0xa35b('0xc')](_0xa35b('0xd'),_0x477743,_0xa35b('0xe'));logger[_0xa35b('0xf')](_0xa35b('0x10'),_0x477743,_0xa35b('0xe'),JSON[_0xa35b('0x11')](_0x1fe59e));if(_0x1fe59e[_0xa35b('0x12')]){if(_0x1fe59e[_0xa35b('0x12')][_0xa35b('0x13')]===0x1f4){logger[_0xa35b('0x12')]('Setting,\x20%s,\x20%s',_0x477743,_0x1fe59e[_0xa35b('0x12')][_0xa35b('0x14')]);return _0x20fb2a(_0x1fe59e[_0xa35b('0x12')][_0xa35b('0x14')]);}logger[_0xa35b('0x12')](_0xa35b('0xd'),_0x477743,_0x1fe59e[_0xa35b('0x12')][_0xa35b('0x14')]);return _0x296190(_0x1fe59e['error'][_0xa35b('0x14')]);}else{logger[_0xa35b('0xc')](_0xa35b('0xd'),_0x477743,'request\x20sent');_0x296190(_0x1fe59e[_0xa35b('0x15')][_0xa35b('0x14')]);}})[_0xa35b('0x16')](function(_0x562a55){logger[_0xa35b('0x12')](_0xa35b('0xd'),_0x477743,_0x562a55);_0x20fb2a(_0x562a55);});});} \ No newline at end of file +var _0x17a8=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message'];(function(_0x7efe31,_0x1b42d3){var _0x59ea5a=function(_0x299f73){while(--_0x299f73){_0x7efe31['push'](_0x7efe31['shift']());}};_0x59ea5a(++_0x1b42d3);}(_0x17a8,0x1aa));var _0x817a=function(_0x34c825,_0x44cad4){_0x34c825=_0x34c825-0x0;var _0x2fde13=_0x17a8[_0x34c825];return _0x2fde13;};'use strict';var _=require(_0x817a('0x0'));var util=require('util');var moment=require(_0x817a('0x1'));var BPromise=require(_0x817a('0x2'));var rs=require(_0x817a('0x3'));var fs=require('fs');var Redis=require(_0x817a('0x4'));var db=require(_0x817a('0x5'))['db'];var utils=require(_0x817a('0x6'));var logger=require(_0x817a('0x7'))(_0x817a('0x8'));var config=require(_0x817a('0x9'));var jayson=require(_0x817a('0xa'));var client=jayson[_0x817a('0xb')][_0x817a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b1392,_0xa17b23,_0x39dd66){return new BPromise(function(_0x3e98d9,_0x805923){return client[_0x817a('0xd')](_0x2b1392,_0x39dd66)[_0x817a('0xe')](function(_0x23eb6d){logger[_0x817a('0xf')]('Setting,\x20%s,\x20%s',_0xa17b23,_0x817a('0x10'));logger[_0x817a('0x11')](_0x817a('0x12'),_0xa17b23,_0x817a('0x10'),JSON[_0x817a('0x13')](_0x23eb6d));if(_0x23eb6d['error']){if(_0x23eb6d[_0x817a('0x14')][_0x817a('0x15')]===0x1f4){logger['error'](_0x817a('0x16'),_0xa17b23,_0x23eb6d[_0x817a('0x14')][_0x817a('0x17')]);return _0x805923(_0x23eb6d[_0x817a('0x14')]['message']);}logger['error'](_0x817a('0x16'),_0xa17b23,_0x23eb6d[_0x817a('0x14')][_0x817a('0x17')]);return _0x3e98d9(_0x23eb6d['error'][_0x817a('0x17')]);}else{logger[_0x817a('0xf')](_0x817a('0x16'),_0xa17b23,_0x817a('0x10'));_0x3e98d9(_0x23eb6d['result'][_0x817a('0x17')]);}})[_0x817a('0x18')](function(_0x1e19ae){logger[_0x817a('0x14')](_0x817a('0x16'),_0xa17b23,_0x1e19ae);_0x805923(_0x1e19ae);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 3dea59e..51b0682 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 _0xb722=['addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','/describe','isAuthenticated','describe','show','getDispositions','getAnswers','/:id/applications','statusGet','/:id/users','post','create','/:id/dispositions','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','/:id/status','status'];(function(_0x102267,_0x1eabe8){var _0x2c07c5=function(_0x10e790){while(--_0x10e790){_0x102267['push'](_0x102267['shift']());}};_0x2c07c5(++_0x1eabe8);}(_0xb722,0x1d1));var _0x2b72=function(_0x5ca04d,_0x39e697){_0x5ca04d=_0x5ca04d-0x0;var _0x3a5dec=_0xb722[_0x5ca04d];return _0x3a5dec;};'use strict';var multer=require('multer');var util=require(_0x2b72('0x0'));var path=require(_0x2b72('0x1'));var timeout=require(_0x2b72('0x2'));var express=require('express');var router=express[_0x2b72('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x2b72('0x4'));var config=require(_0x2b72('0x5'));var controller=require(_0x2b72('0x6'));router[_0x2b72('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2b72('0x7')](_0x2b72('0x8'),auth[_0x2b72('0x9')](),controller[_0x2b72('0xa')]);router[_0x2b72('0x7')]('/:id',auth[_0x2b72('0x9')](),controller[_0x2b72('0xb')]);router[_0x2b72('0x7')]('/:id/dispositions',auth[_0x2b72('0x9')](),controller[_0x2b72('0xc')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x2b72('0xd')]);router[_0x2b72('0x7')](_0x2b72('0xe'),auth['isAuthenticated'](),controller['getApplications']);router[_0x2b72('0x7')]('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router['get']('/:id/status',controller[_0x2b72('0xf')]);router[_0x2b72('0x7')](_0x2b72('0x10'),auth[_0x2b72('0x9')](),controller['getAgents']);router[_0x2b72('0x11')]('/',auth[_0x2b72('0x9')](),controller[_0x2b72('0x12')]);router[_0x2b72('0x11')](_0x2b72('0x13'),auth[_0x2b72('0x9')](),controller['addDisposition']);router[_0x2b72('0x11')](_0x2b72('0x14'),auth[_0x2b72('0x9')](),controller[_0x2b72('0x15')]);router[_0x2b72('0x11')](_0x2b72('0x16'),controller[_0x2b72('0x17')]);router[_0x2b72('0x11')]('/:id/applications',auth[_0x2b72('0x9')](),controller[_0x2b72('0x18')]);router[_0x2b72('0x11')](_0x2b72('0x19'),auth[_0x2b72('0x9')](),controller[_0x2b72('0x1a')]);router[_0x2b72('0x11')](_0x2b72('0x1b'),controller[_0x2b72('0x1c')]);router['post'](_0x2b72('0x10'),auth[_0x2b72('0x9')](),controller[_0x2b72('0x1d')]);router[_0x2b72('0x1e')](_0x2b72('0x1f'),auth[_0x2b72('0x9')](),controller[_0x2b72('0x20')]);router['delete']('/:id',auth[_0x2b72('0x9')](),controller[_0x2b72('0x21')]);router[_0x2b72('0x22')](_0x2b72('0x13'),auth[_0x2b72('0x9')](),controller[_0x2b72('0x23')]);router[_0x2b72('0x22')](_0x2b72('0x14'),auth[_0x2b72('0x9')](),controller[_0x2b72('0x24')]);router[_0x2b72('0x22')](_0x2b72('0x10'),auth[_0x2b72('0x9')](),controller['removeAgents']);module[_0x2b72('0x25')]=router; \ No newline at end of file +var _0xdd01=['getAgents','post','create','/:id/dispositions','addAnswer','/:id/notify','addApplications','/:id/send','send','addAgents','put','delete','removeDispositions','exports','util','connect-timeout','express','Router','./smsAccount.controller','get','/describe','isAuthenticated','describe','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users'];(function(_0x42bd25,_0x4f49ca){var _0xf56d63=function(_0x2cc6ec){while(--_0x2cc6ec){_0x42bd25['push'](_0x42bd25['shift']());}};_0xf56d63(++_0x4f49ca);}(_0xdd01,0x1ce));var _0x1dd0=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xdd01[_0x2dadb9];return _0x2f0097;};'use strict';var multer=require('multer');var util=require(_0x1dd0('0x0'));var path=require('path');var timeout=require(_0x1dd0('0x1'));var express=require(_0x1dd0('0x2'));var router=express[_0x1dd0('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1dd0('0x4'));router[_0x1dd0('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1dd0('0x5')](_0x1dd0('0x6'),auth[_0x1dd0('0x7')](),controller[_0x1dd0('0x8')]);router[_0x1dd0('0x5')]('/:id',auth[_0x1dd0('0x7')](),controller['show']);router['get']('/:id/dispositions',auth[_0x1dd0('0x7')](),controller['getDispositions']);router['get'](_0x1dd0('0x9'),auth[_0x1dd0('0x7')](),controller[_0x1dd0('0xa')]);router[_0x1dd0('0x5')](_0x1dd0('0xb'),auth[_0x1dd0('0x7')](),controller[_0x1dd0('0xc')]);router['get'](_0x1dd0('0xd'),auth[_0x1dd0('0x7')](),controller[_0x1dd0('0xe')]);router[_0x1dd0('0x5')](_0x1dd0('0xf'),controller[_0x1dd0('0x10')]);router[_0x1dd0('0x5')](_0x1dd0('0x11'),auth[_0x1dd0('0x7')](),controller[_0x1dd0('0x12')]);router[_0x1dd0('0x13')]('/',auth[_0x1dd0('0x7')](),controller[_0x1dd0('0x14')]);router[_0x1dd0('0x13')](_0x1dd0('0x15'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x1dd0('0x9'),auth['isAuthenticated'](),controller[_0x1dd0('0x16')]);router['post'](_0x1dd0('0x17'),controller['notify']);router[_0x1dd0('0x13')](_0x1dd0('0xb'),auth[_0x1dd0('0x7')](),controller[_0x1dd0('0x18')]);router[_0x1dd0('0x13')](_0x1dd0('0x19'),auth['isAuthenticated'](),controller[_0x1dd0('0x1a')]);router[_0x1dd0('0x13')]('/:id/status',controller['status']);router[_0x1dd0('0x13')](_0x1dd0('0x11'),auth[_0x1dd0('0x7')](),controller[_0x1dd0('0x1b')]);router[_0x1dd0('0x1c')]('/:id',auth[_0x1dd0('0x7')](),controller['update']);router[_0x1dd0('0x1d')]('/:id',auth[_0x1dd0('0x7')](),controller['destroy']);router['delete'](_0x1dd0('0x15'),auth['isAuthenticated'](),controller[_0x1dd0('0x1e')]);router[_0x1dd0('0x1d')](_0x1dd0('0x9'),auth[_0x1dd0('0x7')](),controller['removeAnswers']);router[_0x1dd0('0x1d')](_0x1dd0('0x11'),auth[_0x1dd0('0x7')](),controller['removeAgents']);module[_0x1dd0('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 54c5504..6d299d2 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 _0xee65=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','plivo','clickatell','csc','infobip','BOOLEAN'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xee65,0xc4));var _0x5ee6=function(_0x4bfd23,_0x5b7329){_0x4bfd23=_0x4bfd23-0x0;var _0xb1f6c2=_0xee65[_0x4bfd23];return _0xb1f6c2;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x5ee6('0x0'));module[_0x5ee6('0x1')]={'name':{'type':Sequelize[_0x5ee6('0x2')],'unique':_0x5ee6('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x5ee6('0x2')],'defaultValue':function(){return rs[_0x5ee6('0x4')]();}},'phone':{'type':Sequelize[_0x5ee6('0x2')]},'type':{'type':Sequelize[_0x5ee6('0x5')](_0x5ee6('0x6'),_0x5ee6('0x7'),_0x5ee6('0x8'),'clicksend',_0x5ee6('0x9'),_0x5ee6('0xa'),_0x5ee6('0xb'),_0x5ee6('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0x5ee6('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x5ee6('0x2')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x5ee6('0x2')]},'password':{'type':Sequelize[_0x5ee6('0x2')]},'apiKey':{'type':Sequelize[_0x5ee6('0x2')]},'senderString':{'type':Sequelize[_0x5ee6('0x2')]},'deliveryReport':{'type':Sequelize[_0x5ee6('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x5ee6('0x2')]},'notificationTemplate':{'type':Sequelize[_0x5ee6('0xe')],'defaultValue':function(){return _0x5ee6('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5ee6('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5ee6('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5ee6('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5ee6('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5ee6('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x5ee6('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4b63ae){if(!_0x4b63ae)this[_0x5ee6('0x12')](_0x5ee6('0x13'),null);this[_0x5ee6('0x12')](_0x5ee6('0x14'),_0x4b63ae);}}}; \ No newline at end of file +var _0x2821=['clickatell','infobip','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo'];(function(_0x9d58e0,_0x5ee515){var _0x5eab07=function(_0x177eb4){while(--_0x177eb4){_0x9d58e0['push'](_0x9d58e0['shift']());}};_0x5eab07(++_0x5ee515);}(_0x2821,0xc3));var _0x1282=function(_0x431d19,_0x2e40e0){_0x431d19=_0x431d19-0x0;var _0x3534bb=_0x2821[_0x431d19];return _0x3534bb;};'use strict';var Sequelize=require(_0x1282('0x0'));var rs=require(_0x1282('0x1'));module[_0x1282('0x2')]={'name':{'type':Sequelize[_0x1282('0x3')],'unique':_0x1282('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x1282('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x1282('0x3')],'defaultValue':function(){return rs[_0x1282('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1282('0x6')](_0x1282('0x7'),_0x1282('0x8'),_0x1282('0x9'),_0x1282('0xa'),_0x1282('0xb'),_0x1282('0xc'),'csc',_0x1282('0xd'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x1282('0x3')]},'smsMethod':{'type':Sequelize[_0x1282('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0x1282('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x1282('0x3')]},'senderString':{'type':Sequelize[_0x1282('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x1282('0xe')],'defaultValue':function(){return _0x1282('0xf');}},'notificationSound':{'type':Sequelize[_0x1282('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1282('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1282('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1282('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x1282('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1282('0x11')],'comment':_0x1282('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1282('0x13'),'set':function(_0x5a16bf){if(!_0x5a16bf)this[_0x1282('0x14')](_0x1282('0x15'),null);this['setDataValue'](_0x1282('0x16'),_0x5a16bf);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 1b81b23..1e69877 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 _0x9957=['show','params','fields','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','nolimit','sort','pick','rows','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','notify','sms','account','applications','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','debug','entity\x20found','stringify','Content-Type','text/xml','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','to\x20is\x20mandatory','List','DESC','dataValues','Messages','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','intelepeer','DELIVERED','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','test','ValidationError','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','save','destroy','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','limit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x7995('0x1e'));var client=jayson[_0x7995('0x1f')][_0x7995('0x20')]({'port':0x232c});function checkPasswordPattern(_0x321ae8,_0x3f1d3e,_0x1a5310){if(_0x1a5310){var _0x2202ce=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2202ce[_0x7995('0x21')](_0x3f1d3e)){return _0x321ae8;}else{throw new db['Sequelize'][(_0x7995('0x22'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x321ae8;}}function respondWithRpcPromise(_0x2f832e,_0x37f297,_0x43d4b8,_0x291317){return new BPromise(function(_0x1e1415,_0x37a7d4){var _0x4faa60=_0x291317||client;return _0x4faa60['request'](_0x2f832e,_0x43d4b8)[_0x7995('0x23')](function(_0x5e6f90){logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));logger['debug'](_0x7995('0x26'),_0x37f297,'request\x20sent',JSON['stringify'](_0x5e6f90));if(_0x5e6f90[_0x7995('0x27')]){if(_0x5e6f90[_0x7995('0x27')][_0x7995('0x28')]===0x1f4){logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')]['message']);return _0x37a7d4(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}logger[_0x7995('0x27')](_0x7995('0x24'),_0x37f297,_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);return _0x1e1415(_0x5e6f90[_0x7995('0x27')][_0x7995('0x29')]);}else{logger['info'](_0x7995('0x24'),_0x37f297,_0x7995('0x25'));_0x1e1415(_0x5e6f90[_0x7995('0x2a')][_0x7995('0x29')]);}})[_0x7995('0x2b')](function(_0x2a307e){logger['error'](_0x7995('0x24'),_0x37f297,_0x2a307e);_0x37a7d4(_0x2a307e);});});}function respondWithStatusCode(_0x5911c3,_0x229742){_0x229742=_0x229742||0xcc;return function(_0x49bc7e){if(_0x49bc7e){return _0x5911c3[_0x7995('0x2c')](_0x229742);}return _0x5911c3[_0x7995('0x2d')](_0x229742)[_0x7995('0x2e')]();};}function respondWithResult(_0x4b6f99,_0x9b2a15){_0x9b2a15=_0x9b2a15||0xc8;return function(_0x514445){if(_0x514445){return _0x4b6f99[_0x7995('0x2d')](_0x9b2a15)[_0x7995('0x2f')](_0x514445);}};}function respondWithFilteredResult(_0x4253e5,_0x574574){return function(_0x530611){if(_0x530611){var _0x48e573=_0x530611[_0x7995('0x30')],_0x3573be=_0x574574[_0x7995('0x31')],_0xe6b0b3=_0x574574[_0x7995('0x31')]+_0x574574['limit'],_0x327a81;if(_0xe6b0b3>=_0x48e573){_0xe6b0b3=_0x48e573;_0x327a81=0xc8;}else{_0x327a81=0xce;}_0x4253e5['status'](_0x327a81);return _0x4253e5[_0x7995('0x32')]('Content-Range',_0x3573be+'-'+_0xe6b0b3+'/'+_0x48e573)[_0x7995('0x2f')](_0x530611);}return null;};}function patchUpdates(_0x3eb566){return function(_0x29fac5){try{jsonpatch[_0x7995('0x33')](_0x29fac5,_0x3eb566,!![]);}catch(_0x1f7d27){return BPromise['reject'](_0x1f7d27);}return _0x29fac5[_0x7995('0x34')]();};}function saveUpdates(_0x33e24e,_0x5dd802){return function(_0x48db25){if(_0x48db25){return _0x48db25['update'](_0x33e24e)[_0x7995('0x23')](function(_0x3acfc3){return _0x3acfc3;});}return null;};}function removeEntity(_0x4a176f,_0x3e7020){return function(_0x51b95d){if(_0x51b95d){return _0x51b95d[_0x7995('0x35')]()[_0x7995('0x23')](function(){var _0x177cb4=_0x51b95d['get']({'plain':!![]});var _0x52d76d=_0x7995('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x52d76d,'resourceId':_0x177cb4['id']}})[_0x7995('0x23')](function(){return _0x51b95d;});})[_0x7995('0x23')](function(){_0x4a176f['status'](0xcc)[_0x7995('0x2e')]();});}};}function handleEntityNotFound(_0x1922b4,_0x2b772f){return function(_0x18667c){if(!_0x18667c){_0x1922b4[_0x7995('0x2c')](0x194);}return _0x18667c;};}function handleError(_0x53002a,_0x2d4285){_0x2d4285=_0x2d4285||0x1f4;return function(_0x242713){logger[_0x7995('0x27')](_0x242713[_0x7995('0x37')]);if(_0x242713['name']){delete _0x242713[_0x7995('0x38')];}_0x53002a[_0x7995('0x2d')](_0x2d4285)[_0x7995('0x39')](_0x242713);};}exports[_0x7995('0x3a')]=function(_0x1f5bee,_0x1035dc){var _0x5688a1={'include':[{'model':db[_0x7995('0x3b')],'as':_0x7995('0x3c')}]},_0x183a68={},_0x3be298={'count':0x0,'rows':[]};var _0x2e04cd=_[_0x7995('0x3d')](db[_0x7995('0x3e')][_0x7995('0x3f')],function(_0x1234e1){return{'name':_0x1234e1[_0x7995('0x40')],'type':_0x1234e1[_0x7995('0x41')][_0x7995('0x42')]};});_0x183a68[_0x7995('0x43')]=_['map'](_0x2e04cd,'name');_0x183a68[_0x7995('0x44')]=_[_0x7995('0x45')](_0x1f5bee['query']);_0x183a68['filters']=_[_0x7995('0x46')](_0x183a68['model'],_0x183a68['query']);_0x5688a1[_0x7995('0x47')]=_[_0x7995('0x46')](_0x183a68[_0x7995('0x43')],qs['fields'](_0x1f5bee[_0x7995('0x44')]['fields']));_0x5688a1[_0x7995('0x47')]=_0x5688a1['attributes']['length']?_0x5688a1[_0x7995('0x47')]:_0x183a68[_0x7995('0x43')];if(!_0x1f5bee[_0x7995('0x44')][_0x7995('0x48')]('nolimit')){_0x5688a1[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x1f5bee[_0x7995('0x44')][_0x7995('0x49')]);_0x5688a1['offset']=qs['offset'](_0x1f5bee[_0x7995('0x44')]['offset']);}_0x5688a1[_0x7995('0x4a')]=qs['sort'](_0x1f5bee[_0x7995('0x44')]['sort']);_0x5688a1[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x1f5bee[_0x7995('0x44')],_0x183a68[_0x7995('0x4c')]),_0x2e04cd);if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x4d')]){_0x5688a1['where']=_[_0x7995('0x4e')](_0x5688a1[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x2e04cd,function(_0x491184){if(_0x491184[_0x7995('0x41')]!==_0x7995('0x4f')){var _0x511567={};_0x511567[_0x491184[_0x7995('0x38')]]={'$like':'%'+_0x1f5bee[_0x7995('0x44')]['filter']+'%'};return _0x511567;}})});}_0x5688a1=_[_0x7995('0x4e')]({},_0x5688a1,_0x1f5bee[_0x7995('0x50')]);var _0x5921b9={'where':_0x5688a1[_0x7995('0x4b')]};return db['SmsAccount'][_0x7995('0x30')](_0x5921b9)[_0x7995('0x23')](function(_0x1afab4){_0x3be298[_0x7995('0x30')]=_0x1afab4;if(_0x1f5bee[_0x7995('0x44')][_0x7995('0x51')]){_0x5688a1[_0x7995('0x52')]=[{'all':!![]}];}return db['SmsAccount'][_0x7995('0x53')](_0x5688a1);})[_0x7995('0x23')](function(_0x418eb9){_0x3be298['rows']=_0x418eb9;return _0x3be298;})[_0x7995('0x23')](respondWithFilteredResult(_0x1035dc,_0x5688a1))[_0x7995('0x2b')](handleError(_0x1035dc,null));};exports[_0x7995('0x54')]=function(_0x47d1d8,_0x4ec548){var _0x5a592e={'raw':![],'where':{'id':_0x47d1d8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]},_0xb70620={};_0xb70620[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0x3e')][_0x7995('0x3f')]);_0xb70620['query']=_[_0x7995('0x45')](_0x47d1d8['query']);_0xb70620[_0x7995('0x4c')]=_[_0x7995('0x46')](_0xb70620[_0x7995('0x43')],_0xb70620['query']);_0x5a592e['attributes']=_['intersection'](_0xb70620['model'],qs[_0x7995('0x56')](_0x47d1d8[_0x7995('0x44')][_0x7995('0x56')]));_0x5a592e[_0x7995('0x47')]=_0x5a592e[_0x7995('0x47')][_0x7995('0x57')]?_0x5a592e[_0x7995('0x47')]:_0xb70620[_0x7995('0x43')];if(_0x47d1d8[_0x7995('0x44')][_0x7995('0x51')]){_0x5a592e[_0x7995('0x52')]=[{'all':!![]}];}_0x5a592e=_[_0x7995('0x4e')]({},_0x5a592e,_0x47d1d8[_0x7995('0x50')]);return db[_0x7995('0x3e')][_0x7995('0x58')](_0x5a592e)[_0x7995('0x23')](handleEntityNotFound(_0x4ec548,null))[_0x7995('0x23')](respondWithResult(_0x4ec548,null))[_0x7995('0x2b')](handleError(_0x4ec548,null));};exports[_0x7995('0x59')]=function(_0x50b7c2,_0x56a374){return db[_0x7995('0x3e')][_0x7995('0x59')](_0x50b7c2[_0x7995('0x5a')],{})['then'](function(_0x53125a){var _0x402fa0=_0x50b7c2[_0x7995('0x5b')][_0x7995('0x5c')]({'plain':!![]});if(!_0x402fa0)throw new Error(_0x7995('0x5d'));if(_0x402fa0['role']===_0x7995('0x5b')){var _0x74ff38=_0x53125a[_0x7995('0x5c')]({'plain':!![]});var _0x33c49c='SmsAccounts';return db['UserProfileSection'][_0x7995('0x58')]({'where':{'name':_0x33c49c,'userProfileId':_0x402fa0[_0x7995('0x5e')]},'raw':!![]})[_0x7995('0x23')](function(_0x1d69ce){if(_0x1d69ce&&_0x1d69ce[_0x7995('0x5f')]===0x0){return db[_0x7995('0x60')][_0x7995('0x59')]({'name':_0x74ff38[_0x7995('0x38')],'resourceId':_0x74ff38['id'],'type':_0x1d69ce[_0x7995('0x38')],'sectionId':_0x1d69ce['id']},{})['then'](function(){return _0x53125a;});}else{return _0x53125a;}})[_0x7995('0x2b')](function(_0x3ec5a8){logger[_0x7995('0x27')](_0x7995('0x61'),_0x3ec5a8);throw _0x3ec5a8;});}return _0x53125a;})['then'](respondWithResult(_0x56a374,0xc9))['catch'](handleError(_0x56a374,null));};exports[_0x7995('0x62')]=function(_0xebb5c8,_0x47d5d7){if(_0xebb5c8[_0x7995('0x5a')]['id']){delete _0xebb5c8[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xebb5c8[_0x7995('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x7995('0x3c')}]})['then'](handleEntityNotFound(_0x47d5d7,null))[_0x7995('0x23')](saveUpdates(_0xebb5c8[_0x7995('0x5a')],null))[_0x7995('0x23')](respondWithResult(_0x47d5d7,null))[_0x7995('0x2b')](handleError(_0x47d5d7,null));};exports[_0x7995('0x35')]=function(_0xeb8920,_0x2b3c1d){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0xeb8920[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x2b3c1d,null))[_0x7995('0x23')](removeEntity(_0x2b3c1d,null))['catch'](handleError(_0x2b3c1d,null));};exports[_0x7995('0x63')]=function(_0x23bbc1,_0x293480){return db[_0x7995('0x3e')][_0x7995('0x63')]()['then'](respondWithResult(_0x293480,null))['catch'](handleError(_0x293480,null));};exports[_0x7995('0x64')]=function(_0x87e38d,_0x221542,_0xae6166){if(_0x87e38d['body']['id']){delete _0x87e38d[_0x7995('0x5a')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x87e38d[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x221542,null))[_0x7995('0x23')](function(_0x44bf2b){if(_0x44bf2b){_0x87e38d[_0x7995('0x5a')][_0x7995('0x65')]=_0x44bf2b['id'];return db[_0x7995('0x66')][_0x7995('0x59')](_0x87e38d[_0x7995('0x5a')]);}})[_0x7995('0x23')](respondWithResult(_0x221542,null))['catch'](handleError(_0x221542,null));};exports[_0x7995('0x67')]=function(_0x8908cd,_0x3c5802,_0x4cc247){var _0x1fe1cb={'raw':![],'where':{}};var _0x1d2f9d={};var _0x705f0={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x8908cd[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3c5802,null))[_0x7995('0x23')](function(_0x2f94c4){if(_0x2f94c4){_0x1d2f9d[_0x7995('0x43')]=_[_0x7995('0x45')](db['Disposition']['rawAttributes']);_0x1d2f9d[_0x7995('0x44')]=_[_0x7995('0x45')](_0x8908cd[_0x7995('0x44')]);_0x1d2f9d[_0x7995('0x4c')]=_['intersection'](_0x1d2f9d[_0x7995('0x43')],_0x1d2f9d[_0x7995('0x44')]);_0x1fe1cb['attributes']=_['intersection'](_0x1d2f9d[_0x7995('0x43')],qs[_0x7995('0x56')](_0x8908cd['query'][_0x7995('0x56')]));_0x1fe1cb['attributes']=_0x1fe1cb[_0x7995('0x47')][_0x7995('0x57')]?_0x1fe1cb['attributes']:_0x1d2f9d['model'];if(!_0x8908cd[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x1fe1cb[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x8908cd[_0x7995('0x44')][_0x7995('0x49')]);_0x1fe1cb[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x8908cd[_0x7995('0x44')][_0x7995('0x31')]);}_0x1fe1cb[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x8908cd[_0x7995('0x44')][_0x7995('0x6a')]);_0x1fe1cb[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x8908cd[_0x7995('0x44')],_0x1d2f9d[_0x7995('0x4c')]));_0x1fe1cb[_0x7995('0x4b')][_0x7995('0x65')]=_0x2f94c4['id'];if(_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]){_0x1fe1cb[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x1fe1cb[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x1fe1cb[_0x7995('0x47')],function(_0x34724d){var _0x59efff={};_0x59efff[_0x34724d]={'$like':'%'+_0x8908cd[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x59efff;})});}_0x1fe1cb=_['merge']({},_0x1fe1cb,_0x8908cd['options']);return db[_0x7995('0x66')][_0x7995('0x30')]({'where':_0x1fe1cb[_0x7995('0x4b')]})[_0x7995('0x23')](function(_0xe1ce4){_0x705f0[_0x7995('0x30')]=_0xe1ce4;if(_0x8908cd['query'][_0x7995('0x51')]){_0x1fe1cb[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x66')][_0x7995('0x53')](_0x1fe1cb);})[_0x7995('0x23')](function(_0x3f0bff){_0x705f0[_0x7995('0x6c')]=_0x3f0bff;return _0x705f0;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x3c5802,_0x1fe1cb))['catch'](handleError(_0x3c5802,null));};exports[_0x7995('0x6d')]=function(_0x2b8217,_0x5c04c9,_0x479271){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x2b8217[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x5c04c9,null))[_0x7995('0x23')](function(_0x4a02ea){if(_0x4a02ea){return _0x4a02ea[_0x7995('0x6d')](_0x2b8217[_0x7995('0x44')]['ids']);}})[_0x7995('0x23')](respondWithStatusCode(_0x5c04c9,null))[_0x7995('0x2b')](handleError(_0x5c04c9,null));};exports['addAnswer']=function(_0x1535a3,_0x4a5bc5,_0x135191){if(_0x1535a3[_0x7995('0x5a')]['id']){delete _0x1535a3[_0x7995('0x5a')]['id'];}return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x1535a3['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4a5bc5,null))[_0x7995('0x23')](function(_0x38b37f){if(_0x38b37f){_0x1535a3['body'][_0x7995('0x65')]=_0x38b37f['id'];return db[_0x7995('0x6e')][_0x7995('0x59')](_0x1535a3[_0x7995('0x5a')]);}})['then'](respondWithResult(_0x4a5bc5,null))[_0x7995('0x2b')](handleError(_0x4a5bc5,null));};exports[_0x7995('0x6f')]=function(_0x3a5f5e,_0x4aafa3,_0x5358d4){var _0x3fc10={'raw':![],'where':{}};var _0x333379={};var _0x4800a8={'count':0x0,'rows':[]};return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x3a5f5e[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x4aafa3,null))[_0x7995('0x23')](function(_0x2ba606){if(_0x2ba606){_0x333379['model']=_['keys'](db[_0x7995('0x6e')]['rawAttributes']);_0x333379['query']=_[_0x7995('0x45')](_0x3a5f5e[_0x7995('0x44')]);_0x333379[_0x7995('0x4c')]=_['intersection'](_0x333379[_0x7995('0x43')],_0x333379[_0x7995('0x44')]);_0x3fc10[_0x7995('0x47')]=_[_0x7995('0x46')](_0x333379[_0x7995('0x43')],qs['fields'](_0x3a5f5e[_0x7995('0x44')][_0x7995('0x56')]));_0x3fc10[_0x7995('0x47')]=_0x3fc10[_0x7995('0x47')]['length']?_0x3fc10[_0x7995('0x47')]:_0x333379[_0x7995('0x43')];if(!_0x3a5f5e['query'][_0x7995('0x48')](_0x7995('0x69'))){_0x3fc10['limit']=qs[_0x7995('0x49')](_0x3a5f5e['query'][_0x7995('0x49')]);_0x3fc10['offset']=qs[_0x7995('0x31')](_0x3a5f5e['query'][_0x7995('0x31')]);}_0x3fc10[_0x7995('0x4a')]=qs['sort'](_0x3a5f5e[_0x7995('0x44')]['sort']);_0x3fc10['where']=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x3a5f5e[_0x7995('0x44')],_0x333379[_0x7995('0x4c')]));_0x3fc10['where'][_0x7995('0x65')]=_0x2ba606['id'];if(_0x3a5f5e[_0x7995('0x44')]['filter']){_0x3fc10['where']=_[_0x7995('0x4e')](_0x3fc10['where'],{'$or':_[_0x7995('0x3d')](_0x3fc10[_0x7995('0x47')],function(_0xfb4479){var _0x5b42be={};_0x5b42be[_0xfb4479]={'$like':'%'+_0x3a5f5e['query'][_0x7995('0x4d')]+'%'};return _0x5b42be;})});}_0x3fc10=_['merge']({},_0x3fc10,_0x3a5f5e[_0x7995('0x50')]);return db[_0x7995('0x6e')][_0x7995('0x30')]({'where':_0x3fc10[_0x7995('0x4b')]})['then'](function(_0x52d102){_0x4800a8['count']=_0x52d102;if(_0x3a5f5e[_0x7995('0x44')][_0x7995('0x51')]){_0x3fc10[_0x7995('0x52')]=[{'all':!![]}];}return db[_0x7995('0x6e')][_0x7995('0x53')](_0x3fc10);})[_0x7995('0x23')](function(_0x59a793){_0x4800a8['rows']=_0x59a793;return _0x4800a8;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x4aafa3,_0x3fc10))['catch'](handleError(_0x4aafa3,null));};exports['removeAnswers']=function(_0x17d00f,_0x5e95c0,_0x57a164){return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x17d00f[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x5e95c0,null))[_0x7995('0x23')](function(_0xf604d9){if(_0xf604d9){return _0xf604d9[_0x7995('0x70')](_0x17d00f[_0x7995('0x44')][_0x7995('0x71')]);}})[_0x7995('0x23')](respondWithStatusCode(_0x5e95c0,null))[_0x7995('0x2b')](handleError(_0x5e95c0,null));};exports[_0x7995('0x72')]=function(_0x19d746,_0x570b71,_0x3eb3fa){var _0x87a539={'channel':_0x7995('0x73')};var _0x2056da=[];var _0x2a01d4=[];var _0x5a4695={};return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x19d746[_0x7995('0x55')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})['then'](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x17f7d6){_0x87a539[_0x7995('0x74')]=_0x17f7d6;_0x87a539[_0x7995('0x75')]=_[_0x7995('0x76')](_0x17f7d6[_0x7995('0x77')],['priority'],[_0x7995('0x78')]);if(_0x87a539['account'][_0x7995('0x77')]){delete _0x87a539[_0x7995('0x74')][_0x7995('0x77')];}return db[_0x7995('0x79')][_0x7995('0x63')]();})[_0x7995('0x23')](function(_0x4f929b){if(!_0x4f929b){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x7b'));}_0x2056da=_[_0x7995('0x7c')](_['keys'](_0x4f929b),[_0x7995('0x7d'),'updatedAt']);_0x2a01d4=_[_0x7995('0x7c')](_[_0x7995('0x45')](_0x4f929b),['createdAt','updatedAt',_0x7995('0x7e'),_0x7995('0x7f')]);_0x87a539[_0x7995('0x5a')]={'mapKey':_0x7995('0x80')};if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){switch(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]){case _0x7995('0x81'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x83')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x85')];break;case _0x7995('0x86'):_0x87a539['body'][_0x7995('0x82')]='+'+_0x19d746['body'][_0x7995('0x87')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x88')];break;case _0x7995('0x89'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['message'];break;case _0x7995('0x8a'):_0x87a539[_0x7995('0x5a')]['from']=_0x19d746['body'][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')]['body']=_0x19d746['body']['body'];_0x87a539['body'][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8b')];break;case _0x7995('0x8c'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['From'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')]['Text'];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746['body'][_0x7995('0x8d')];break;case _0x7995('0x8e'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]='+'+_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x82')];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x88')];_0x87a539[_0x7995('0x5a')]['messageId']=_0x19d746[_0x7995('0x5a')][_0x7995('0x8f')][0x0][_0x7995('0x84')];break;case _0x7995('0x90'):_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x91')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x92')][_0x7995('0x29')];break;case _0x7995('0x93'):_0x87a539[_0x7995('0x5a')][_0x7995('0x82')]=_0x19d746['body'][_0x7995('0x94')];_0x87a539['body'][_0x7995('0x5a')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x88')];_0x87a539['body'][_0x7995('0x84')]=_0x19d746['body']['replyMessageId'];break;case'intelepeer':_0x87a539['body'][_0x7995('0x82')]=_0x19d746[_0x7995('0x5a')]['from'];_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]=_0x19d746['body'][_0x7995('0x29')];_0x87a539[_0x7995('0x5a')][_0x7995('0x84')]=_0x19d746[_0x7995('0x5a')][_0x7995('0x95')];break;}}if(_0x87a539['body']['id']){delete _0x87a539[_0x7995('0x5a')]['id'];}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x82')])){throw new db['Sequelize'][(_0x7995('0x22'))](_0x7995('0x97'));}if(_[_0x7995('0x96')](_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')])||_0x87a539[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x98'));}if(_['isNil'](_0x87a539[_0x7995('0x5a')]['mapKey'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0x99')+_0x2a01d4);}if(!_['includes'](_0x2a01d4,_0x87a539['body'][_0x7995('0x9a')])){throw new db[(_0x7995('0x7a'))]['ValidationError'](_0x7995('0x9b')+_0x2a01d4);}_0x5a4695[_0x87a539['body'][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')][_0x7995('0x82')];return db[_0x7995('0x9c')]['find']({'where':{'id':_0x87a539['account'][_0x7995('0x7f')]},'include':[{'model':db[_0x7995('0x79')],'as':_0x7995('0x9d'),'where':_0x5a4695,'limit':0x1,'order':[[_0x7995('0x9e'),'DESC']]}]});})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x8b820b){if(_0x8b820b){_0x87a539[_0x7995('0x9f')]=_[_0x7995('0xa0')](_0x8b820b,['Contacts']);if(_0x8b820b['Contacts']['length']){return _0x8b820b[_0x7995('0x9d')][0x0];}var _0x24a3cf=_['defaults'](_0x87a539[_0x7995('0x5a')],{'firstName':_0x87a539['body'][_0x7995('0x82')],'ListId':_0x8b820b['id']});_0x24a3cf[_0x87a539[_0x7995('0x5a')][_0x7995('0x9a')]]=_0x87a539[_0x7995('0x5a')]['from'];return db[_0x7995('0x79')][_0x7995('0x59')](_0x24a3cf,{'fields':_0x2056da,'raw':!![]});}})[_0x7995('0x23')](handleEntityNotFound(_0x570b71,null))[_0x7995('0x23')](function(_0x2023a7){if(_0x2023a7){_0x87a539[_0x7995('0xa1')]=_0x2023a7;var _0x1d200d={'ContactId':_0x2023a7['id'],'phone':_0x87a539[_0x7995('0x5a')][_0x7995('0x82')],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id']};var _0x30893a={'ContactId':_0x2023a7['id'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'closed':![]};return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':_0x30893a})['then'](function(_0x764245){if(_0x764245){return[_0x764245,![]];}return db['SmsInteraction'][_0x7995('0x59')](_0x1d200d)[_0x7995('0x23')](function(_0x5cf7b2){return[_0x5cf7b2,!![]];});});}})[_0x7995('0xa3')](function(_0x55dc6c,_0x17c3f9){_0x87a539[_0x7995('0xa4')]=_0x55dc6c['get']({'plain':!![]});_0x87a539['interaction']['created']=![];if(_0x17c3f9){if(_0x87a539[_0x7995('0x74')][_0x7995('0xa5')]){_0x87a539[_0x7995('0x75')][_0x7995('0xa6')]({'id':0x0,'priority':_0x87a539['applications'][_0x7995('0x57')]+0x1,'app':_0x7995('0xa7'),'appdata':_0x7995('0xa8'),'interval':_0x7995('0xa9')});}_0x87a539[_0x7995('0xa4')][_0x7995('0xaa')]=!![];}return db[_0x7995('0xab')][_0x7995('0x59')]({'phone':_0x87a539['body'][_0x7995('0x82')],'messageId':_0x87a539[_0x7995('0x5a')][_0x7995('0x84')],'body':_0x87a539[_0x7995('0x5a')]['body'],'SmsAccountId':_0x19d746[_0x7995('0x55')]['id'],'SmsInteractionId':_0x55dc6c['id'],'direction':'in','ContactId':_0x55dc6c[_0x7995('0xac')],'AttachmentId':_0x87a539[_0x7995('0x5a')][_0x7995('0xad')]});})[_0x7995('0x23')](function(_0x2e7416){_0x87a539['message']=_0x2e7416;if(_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]){return db[_0x7995('0xaf')][_0x7995('0x58')]({'attributes':['id',_0x7995('0x38')],'where':{'id':_0x87a539[_0x7995('0xa4')][_0x7995('0xae')]}})[_0x7995('0x23')](function(_0xf76f46){if(_0xf76f46){_0x87a539[_0x7995('0x75')][_0x7995('0xb0')]({'id':0x0,'priority':0x0,'app':_0x7995('0xb1'),'appdata':_0xf76f46[_0x7995('0x38')]+','+(_0x87a539[_0x7995('0x74')][_0x7995('0xb2')]||0xa),'interval':_0x7995('0xa9')});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);});}return respondWithRpcPromise(_0x7995('0xb3'),_0x7995('0xb4'),_0x87a539);})[_0x7995('0x23')](function(_0x51f854){if(_0x51f854){var _0x4cf7f1=0xc8;var _0x1a980b=_0x7995('0xb5');logger['info'](_0x7995('0x26'),_0x1a980b,_0x4cf7f1,'entity\x20found');logger[_0x7995('0xb6')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x1a980b,_0x4cf7f1,_0x7995('0xb7'),JSON[_0x7995('0xb8')](_0x51f854));if(_0x87a539[_0x7995('0x74')][_0x7995('0x41')]===_0x7995('0x81')){return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x32')](_0x7995('0xb9'),_0x7995('0xba'))[_0x7995('0x39')]('\x0a');}else{return _0x570b71[_0x7995('0x2d')](_0x4cf7f1)[_0x7995('0x2f')](_0x51f854);}}})[_0x7995('0x2b')](handleError(_0x570b71,null));};exports[_0x7995('0xbb')]=function(_0x54b803,_0x408c22,_0x1d2afe){return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x54b803['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x408c22,null))[_0x7995('0x23')](function(_0x31d0e9){if(_0x31d0e9){return db[_0x7995('0xbc')][_0x7995('0xbd')](function(_0x13dda4){return db[_0x7995('0xbe')][_0x7995('0x35')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'transaction':_0x13dda4})['then'](function(_0x3c81cc){var _0x5f5496=_[_0x7995('0x3d')](_0x54b803[_0x7995('0x5a')],function(_0x35b217){_0x35b217[_0x7995('0x65')]=_0x54b803['params']['id'];return _0x35b217;});return db[_0x7995('0xbe')][_0x7995('0xbf')](_0x5f5496,{'transaction':_0x13dda4});});})[_0x7995('0x23')](function(){return db[_0x7995('0xbe')][_0x7995('0xc0')]({'where':{'SmsAccountId':_0x54b803[_0x7995('0x55')]['id']},'order':_0x7995('0xc1')});});}})[_0x7995('0x23')](respondWithResult(_0x408c22,null))[_0x7995('0x2b')](handleError(_0x408c22,null));};exports[_0x7995('0xc2')]=function(_0x45f389,_0x44d6a8,_0x7d14e2){var _0x405711={};var _0x54e341={};var _0x5cb30e;var _0xdfc11d;return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x45f389['params']['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x44d6a8,null))[_0x7995('0x23')](function(_0x610b81){if(_0x610b81){_0x5cb30e=_0x610b81;_0x54e341['model']=_[_0x7995('0x45')](db[_0x7995('0xbe')][_0x7995('0x3f')]);_0x54e341[_0x7995('0x44')]=_[_0x7995('0x45')](_0x45f389[_0x7995('0x44')]);_0x54e341[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x54e341[_0x7995('0x43')],_0x54e341[_0x7995('0x44')]);_0x405711[_0x7995('0x47')]=_['intersection'](_0x54e341['model'],qs[_0x7995('0x56')](_0x45f389['query'][_0x7995('0x56')]));_0x405711[_0x7995('0x47')]=_0x405711[_0x7995('0x47')][_0x7995('0x57')]?_0x405711[_0x7995('0x47')]:_0x54e341['model'];_0x405711['order']=qs[_0x7995('0x6a')](_0x45f389[_0x7995('0x44')][_0x7995('0x6a')]);_0x405711[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_[_0x7995('0x6b')](_0x45f389[_0x7995('0x44')],_0x54e341[_0x7995('0x4c')]));if(_0x45f389[_0x7995('0x44')][_0x7995('0x4d')]){_0x405711['where']=_[_0x7995('0x4e')](_0x405711[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x405711[_0x7995('0x47')],function(_0x511cf8){var _0x4d6da0={};_0x4d6da0[_0x511cf8]={'$like':'%'+_0x45f389['query']['filter']+'%'};return _0x4d6da0;})});}_0x405711=_['merge']({},_0x405711,_0x45f389[_0x7995('0x50')]);return _0x5cb30e['getApplications'](_0x405711);}})['then'](function(_0x32f19d){if(_0x32f19d){_0xdfc11d=_0x32f19d[_0x7995('0x57')];if(!_0x45f389[_0x7995('0x44')]['hasOwnProperty'](_0x7995('0x69'))){_0x405711['limit']=qs[_0x7995('0x49')](_0x45f389[_0x7995('0x44')][_0x7995('0x49')]);_0x405711['offset']=qs[_0x7995('0x31')](_0x45f389[_0x7995('0x44')][_0x7995('0x31')]);}return _0x5cb30e['getApplications'](_0x405711);}})[_0x7995('0x23')](function(_0x15cfd3){if(_0x15cfd3){return _0x15cfd3?{'count':_0xdfc11d,'rows':_0x15cfd3}:null;}})[_0x7995('0x23')](respondWithResult(_0x44d6a8,null))[_0x7995('0x2b')](handleError(_0x44d6a8,null));};exports[_0x7995('0xc3')]=function(_0x574e2a,_0x1761e1,_0x2a4991){var _0xc8bbb4={'raw':![],'where':{}};var _0x484b6c={};var _0x20852c={'count':0x0,'rows':[]};return db[_0x7995('0x3e')][_0x7995('0x68')]({'where':{'id':_0x574e2a[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1761e1,null))['then'](function(_0x2995a3){if(_0x2995a3){_0x484b6c[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xa2')][_0x7995('0x3f')]);_0x484b6c[_0x7995('0x44')]=_[_0x7995('0x45')](_0x574e2a['query']);_0x484b6c['filters']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],_0x484b6c['query']);_0xc8bbb4['attributes']=_[_0x7995('0x46')](_0x484b6c[_0x7995('0x43')],qs[_0x7995('0x56')](_0x574e2a[_0x7995('0x44')][_0x7995('0x56')]));_0xc8bbb4[_0x7995('0x47')]=_0xc8bbb4[_0x7995('0x47')]['length']?_0xc8bbb4[_0x7995('0x47')]:_0x484b6c[_0x7995('0x43')];if(!_0x574e2a[_0x7995('0x44')][_0x7995('0x48')](_0x7995('0x69'))){_0xc8bbb4[_0x7995('0x49')]=qs['limit'](_0x574e2a[_0x7995('0x44')][_0x7995('0x49')]);_0xc8bbb4[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x574e2a[_0x7995('0x44')][_0x7995('0x31')]);}_0xc8bbb4[_0x7995('0x4a')]=qs['sort'](_0x574e2a[_0x7995('0x44')][_0x7995('0x6a')]);_0xc8bbb4[_0x7995('0x4b')]=qs[_0x7995('0x4c')](_['pick'](_0x574e2a[_0x7995('0x44')],_0x484b6c['filters']));_0xc8bbb4[_0x7995('0x4b')][_0x7995('0x65')]=_0x2995a3['id'];if(_0x574e2a['query']['filter']){_0xc8bbb4['where']=_[_0x7995('0x4e')](_0xc8bbb4[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0xc8bbb4[_0x7995('0x47')],function(_0x503b32){var _0x2da21e={};_0x2da21e[_0x503b32]={'$like':'%'+_0x574e2a[_0x7995('0x44')][_0x7995('0x4d')]+'%'};return _0x2da21e;})});}_0xc8bbb4=_[_0x7995('0x4e')]({},_0xc8bbb4,_0x574e2a[_0x7995('0x50')]);return db[_0x7995('0xa2')][_0x7995('0x30')]({'where':_0xc8bbb4['where']})['then'](function(_0x2695eb){_0x20852c['count']=_0x2695eb;if(_0x574e2a['query'][_0x7995('0x51')]){_0xc8bbb4[_0x7995('0x52')]=[{'model':db[_0x7995('0x79')],'as':_0x7995('0xc4'),'required':![]},{'model':db[_0x7995('0xaf')],'as':_0x7995('0xc5'),'attributes':[_0x7995('0x38'),_0x7995('0xc6'),_0x7995('0xc7')],'required':![]},{'model':db[_0x7995('0xc8')],'as':_0x7995('0xc9'),'attributes':['id',_0x7995('0x38'),'color'],'where':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?{'id':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]}:undefined,'required':_0x574e2a[_0x7995('0x44')][_0x7995('0xca')]?!![]:![]}];}return db[_0x7995('0xa2')]['findAll'](_0xc8bbb4);})[_0x7995('0x23')](function(_0x234832){_0x20852c[_0x7995('0x6c')]=_0x234832;return _0x20852c;});}})[_0x7995('0x23')](respondWithFilteredResult(_0x1761e1,_0xc8bbb4))[_0x7995('0x2b')](handleError(_0x1761e1,null));};exports['send']=function(_0x2d1c14,_0x5e7fde,_0x156b65){var _0x12f4c5,_0x221be8,_0x5150aa;if(_[_0x7995('0x96')](_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')])||_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')]===''){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2d1c14[_0x7995('0x5a')]['to'])){throw new db[(_0x7995('0x7a'))][(_0x7995('0x22'))](_0x7995('0xcb'));}_0x12f4c5=_0x2d1c14[_0x7995('0x5a')]['to'];return db[_0x7995('0x3e')]['find']({'where':{'id':_0x2d1c14[_0x7995('0x55')]['id']},'include':[{'model':db[_0x7995('0x9c')],'as':_0x7995('0xcc'),'include':[{'model':db[_0x7995('0x79')],'as':'Contacts','where':{'mobile':_0x12f4c5},'limit':0x1,'order':[['updatedAt',_0x7995('0xcd')]]}]}]})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0x3130f2){if(_0x3130f2&&_0x3130f2[_0x7995('0xcc')]){_0x221be8=_0x3130f2['get']({'plain':!![]});if(_0x221be8[_0x7995('0xcc')]&&_0x221be8[_0x7995('0xcc')][_0x7995('0x9d')][_0x7995('0x57')]){return _0x221be8[_0x7995('0xcc')]['Contacts'][0x0];}return db['CmContact'][_0x7995('0x59')](_[_0x7995('0x1b')](_0x2d1c14[_0x7995('0x5a')],{'firstName':_0x12f4c5,'mobile':_0x12f4c5,'phone':_0x12f4c5,'ListId':_0x221be8[_0x7995('0x7f')]}));}})[_0x7995('0x23')](handleEntityNotFound(_0x5e7fde,null))['then'](function(_0xd0da6e){if(_0xd0da6e){_0x5150aa=_0xd0da6e;return db[_0x7995('0xa2')][_0x7995('0x58')]({'where':{'ContactId':_0x5150aa['id'],'closed':![],'SmsAccountId':_0x221be8['id']}})[_0x7995('0x23')](function(_0x1949f5){if(_0x1949f5){return[_0x1949f5,![]];}return db['SmsInteraction']['create']({'UserId':_0x2d1c14['user']['id'],'ContactId':_0x5150aa['id'],'SmsAccountId':_0x221be8['id'],'phone':_0x12f4c5,'firstMsgDirection':'out','Messages':[_[_0x7995('0x4e')](_0x2d1c14[_0x7995('0x5a')],{'read':![],'body':_0x2d1c14['body'][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x7995('0x23')](function(_0x3ee80c){return[_0x3ee80c,!![]];});});}})[_0x7995('0xa3')](function(_0x8bd55,_0x20a056){if(_0x20a056){return _0x8bd55;}return db[_0x7995('0xab')][_0x7995('0x59')](_['merge'](_0x2d1c14['body'],{'read':![],'body':_0x2d1c14[_0x7995('0x5a')][_0x7995('0x5a')],'phone':_0x12f4c5,'SmsAccountId':_0x221be8['id'],'SmsInteractionId':_0x8bd55['id'],'UserId':_0x2d1c14[_0x7995('0x5b')]['id'],'ContactId':_0x5150aa['id']}))['then'](function(_0x2f96fd){_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')]=[];_0x8bd55[_0x7995('0xce')][_0x7995('0xcf')][_0x7995('0xa6')](_0x2f96fd[_0x7995('0xce')]);return _0x8bd55;});})[_0x7995('0x23')](respondWithResult(_0x5e7fde,null))[_0x7995('0x2b')](handleError(_0x5e7fde,null));};exports['status']=function(_0x5136f5,_0x1161f2,_0x4bd222){if(_0x5136f5[_0x7995('0x5a')]['id']){delete _0x5136f5['body']['id'];}console[_0x7995('0xd0')](_0x7995('0xd1'),_0x5136f5[_0x7995('0x5a')]);var _0x4a75d2,_0x4c810d,_0x1401b4;return db[_0x7995('0x3e')][_0x7995('0x58')]({'where':{'id':_0x5136f5[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0xb0164a){if(_0xb0164a){_0x1401b4=_0xb0164a;logger[_0x7995('0xb6')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0xd2'),_0xb0164a['type'],util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));switch(_0xb0164a[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x5136f5[_0x7995('0x5a')]['skebby_dispatch_id']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd4')]}});}break;case _0x7995('0x89'):if(_0x5136f5['body']['requestid']&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd5')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0xd6')]}});}break;case _0x7995('0x8a'):if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0xd7')];return db['SmsMessage']['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x8b')]}});}break;case _0x7995('0x8e'):var _0x296643=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x296643[_0x7995('0x84')]&&_0x296643[_0x7995('0x2d')]['groupName']==='DELIVERED'){_0x4c810d=_0x296643[_0x7995('0x2d')][_0x7995('0xd8')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x296643['messageId']}});}break;case'clickatell':if(_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]&&_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x5136f5[_0x7995('0x5a')][_0x7995('0x84')]}});}break;case _0x7995('0xd9'):if(_0x5136f5[_0x7995('0x5a')]['redif']&&_0x5136f5['body'][_0x7995('0x2d')]){_0x4c810d=_0x5136f5[_0x7995('0x5a')][_0x7995('0x2d')];return db[_0x7995('0xab')]['find']({'where':{'messageId':_0x5136f5[_0x7995('0x5a')]['redif']}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1161f2,null))[_0x7995('0x23')](function(_0x308d0e){if(_0x308d0e){_0x4a75d2=_0x308d0e;switch(_0x1401b4[_0x7995('0x41')]){case _0x7995('0x86'):if(_0x4c810d===_0x7995('0xda')){return _0x4a75d2['update']({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x86'),util['inspect'](_0x5136f5['body'],{'showHidden':![],'depth':null}));}break;case _0x7995('0x89'):if(_0x4c810d==='1'){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status',_0x7995('0x86'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5136f5[_0x7995('0x5a')][_0x7995('0xdb')]&&_0x4c810d>=0xc8&&_0x4c810d<=0xce){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x8a'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0x8e'):var _0x1f6c3e=_0x5136f5[_0x7995('0x5a')][_0x7995('0x8f')][0x0];if(_0x1f6c3e['status'][_0x7995('0xd8')]===_0x7995('0xda')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7995('0x2d'),_0x7995('0x8e'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x4c810d==_0x7995('0xdc')||_0x4c810d==_0x7995('0xdd')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),_0x7995('0x2d'),_0x7995('0x93'),util['inspect'](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x7995('0xd9'):if(_0x4c810d===_0x7995('0xde')||_0x4c810d===_0x7995('0xdf')){return _0x4a75d2[_0x7995('0x62')]({'read':!![]});}else{logger['error'](_0x7995('0x26'),'status',_0x7995('0xd9'),util[_0x7995('0xd3')](_0x5136f5[_0x7995('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x4a75d2;}})['then'](respondWithResult(_0x1161f2,null))['catch'](handleError(_0x1161f2,null));};exports['statusGet']=function(_0x21ff84,_0x1763aa,_0x32e443){var _0x35b6f9,_0x17fab0,_0x4da0e8;return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x21ff84[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x5bc1b4){if(_0x5bc1b4){_0x4da0e8=_0x5bc1b4;logger[_0x7995('0xb6')](_0x7995('0x26'),'status',_0x7995('0xd2'),_0x5bc1b4['type'],util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));switch(_0x5bc1b4[_0x7995('0x41')]){case'csc':if(_0x21ff84['query'][_0x7995('0xe0')]&&_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')]){_0x17fab0=_0x21ff84[_0x7995('0x44')][_0x7995('0xe1')];return db[_0x7995('0xab')][_0x7995('0x58')]({'where':{'messageId':_0x21ff84[_0x7995('0x44')][_0x7995('0xe0')]}});}break;}}})[_0x7995('0x23')](handleEntityNotFound(_0x1763aa,null))[_0x7995('0x23')](function(_0x48c9fc){if(_0x48c9fc){_0x35b6f9=_0x48c9fc;switch(_0x4da0e8['type']){case _0x7995('0x90'):if(_0x17fab0==='2'||_0x17fab0==='6'){return _0x35b6f9[_0x7995('0x62')]({'read':!![]});}else{logger[_0x7995('0x27')](_0x7995('0x26'),'status','csc',util[_0x7995('0xd3')](_0x21ff84[_0x7995('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x35b6f9;}})['then'](respondWithResult(_0x1763aa,null))['catch'](handleError(_0x1763aa,null));};exports[_0x7995('0xe2')]=function(_0x469cd6,_0x3ad24,_0x17c27b){return db[_0x7995('0x3e')]['find']({'where':{'id':_0x469cd6[_0x7995('0x55')]['id']}})[_0x7995('0x23')](handleEntityNotFound(_0x3ad24,null))['then'](function(_0xf9859c){if(_0xf9859c){return _0xf9859c[_0x7995('0xe2')](_0x469cd6[_0x7995('0x5a')]['ids'],_[_0x7995('0xa0')](_0x469cd6[_0x7995('0x5a')],[_0x7995('0x71'),'id'])||{})[_0x7995('0xa3')](function(_0x113e03){for(var _0x5348b1=0x0;_0x5348b1<_0x469cd6['body'][_0x7995('0x71')]['length'];_0x5348b1+=0x1){socket[_0x7995('0xe3')]('userSmsAccount:save',{'UserId':_0x469cd6[_0x7995('0x5a')][_0x7995('0x71')][_0x5348b1],'SmsAccountId':_0x469cd6[_0x7995('0x55')]['id']});}return _0x113e03;});}})['then'](respondWithResult(_0x3ad24,null))['catch'](handleError(_0x3ad24,null));};exports['removeAgents']=function(_0x362580,_0x1da57f,_0x270ef3){return db['SmsAccount'][_0x7995('0x58')]({'where':{'id':_0x362580[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x1da57f,null))[_0x7995('0x23')](function(_0x39449e){if(_0x39449e){return _0x39449e[_0x7995('0xe4')](_0x362580[_0x7995('0x44')][_0x7995('0x71')])['then'](function(){if(_['isArray'](_0x362580[_0x7995('0x44')][_0x7995('0x71')])){for(var _0x134da2=0x0;_0x134da2<_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x7995('0x57')];_0x134da2+=0x1){socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')][_0x134da2]),'SmsAccountId':Number(_0x362580['params']['id'])});}}else{socket[_0x7995('0xe3')](_0x7995('0xe5'),{'UserId':Number(_0x362580[_0x7995('0x44')][_0x7995('0x71')]),'SmsAccountId':Number(_0x362580[_0x7995('0x55')]['id'])});}});}})[_0x7995('0x23')](respondWithStatusCode(_0x1da57f,null))[_0x7995('0x2b')](handleError(_0x1da57f,null));};exports['getAgents']=function(_0x5d0fe6,_0x43a8a4,_0x2aec8d){var _0x12df49={};var _0x1f4efc={};var _0x55ce63;var _0x572c53;return db['SmsAccount'][_0x7995('0x68')]({'where':{'id':_0x5d0fe6[_0x7995('0x55')]['id']}})['then'](handleEntityNotFound(_0x43a8a4,null))[_0x7995('0x23')](function(_0x2265cf){if(_0x2265cf){_0x55ce63=_0x2265cf;_0x1f4efc[_0x7995('0x43')]=_[_0x7995('0x45')](db[_0x7995('0xaf')][_0x7995('0x3f')]);_0x1f4efc[_0x7995('0x44')]=_[_0x7995('0x45')](_0x5d0fe6['query']);_0x1f4efc[_0x7995('0x4c')]=_[_0x7995('0x46')](_0x1f4efc[_0x7995('0x43')],_0x1f4efc['query']);_0x12df49[_0x7995('0x47')]=_['intersection'](_0x1f4efc['model'],qs['fields'](_0x5d0fe6['query'][_0x7995('0x56')]));_0x12df49['attributes']=_0x12df49[_0x7995('0x47')][_0x7995('0x57')]?_0x12df49['attributes']:_0x1f4efc[_0x7995('0x43')];_0x12df49[_0x7995('0x4a')]=qs[_0x7995('0x6a')](_0x5d0fe6[_0x7995('0x44')]['sort']);_0x12df49[_0x7995('0x4b')]=qs['filters'](_[_0x7995('0x6b')](_0x5d0fe6[_0x7995('0x44')],_0x1f4efc[_0x7995('0x4c')]));if(_0x5d0fe6[_0x7995('0x44')][_0x7995('0x4d')]){_0x12df49[_0x7995('0x4b')]=_[_0x7995('0x4e')](_0x12df49[_0x7995('0x4b')],{'$or':_[_0x7995('0x3d')](_0x12df49[_0x7995('0x47')],function(_0x4aa202){var _0x8c9b6f={};_0x8c9b6f[_0x4aa202]={'$like':'%'+_0x5d0fe6[_0x7995('0x44')]['filter']+'%'};return _0x8c9b6f;})});}_0x12df49=_[_0x7995('0x4e')]({},_0x12df49,_0x5d0fe6[_0x7995('0x50')]);return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x1a6f42){if(_0x1a6f42){_0x572c53=_0x1a6f42[_0x7995('0x57')];if(!_0x5d0fe6['query'][_0x7995('0x48')]('nolimit')){_0x12df49[_0x7995('0x49')]=qs[_0x7995('0x49')](_0x5d0fe6[_0x7995('0x44')][_0x7995('0x49')]);_0x12df49[_0x7995('0x31')]=qs[_0x7995('0x31')](_0x5d0fe6['query'][_0x7995('0x31')]);}return _0x55ce63[_0x7995('0xe6')](_0x12df49);}})[_0x7995('0x23')](function(_0x4c2faf){if(_0x4c2faf){return _0x4c2faf?{'count':_0x572c53,'rows':_0x4c2faf}:null;}})[_0x7995('0x23')](respondWithResult(_0x43a8a4,null))[_0x7995('0x2b')](handleError(_0x43a8a4,null));}; \ No newline at end of file +var _0x7a54=['findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','DESC','List','out','Messages','spread','dataValues','push','log','skebby_dispatch_id','statusInt','requestid','clicksend','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','offset','limit','reject','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','SmsAccount','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','mandatoryDispositionPause','rawAttributes','length','find','create','user','role','SmsAccounts','UserProfileSection','autoAssociation','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','notify','SmsApplication','Applications','account','priority','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','From','Body','messageId','skebby','from','connectel','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','text','replyMessageId','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','contact','SmsInteraction','interaction','applications','close','unmanaged','SmsMessage','ContactId','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','addApplications','sequelize','bulkCreate'];(function(_0x456292,_0x3c6ebd){var _0x54c65d=function(_0x53a746){while(--_0x53a746){_0x456292['push'](_0x456292['shift']());}};_0x54c65d(++_0x3c6ebd);}(_0x7a54,0x106));var _0x47a5=function(_0x15b403,_0x2fa90c){_0x15b403=_0x15b403-0x0;var _0xf70258=_0x7a54[_0x15b403];return _0xf70258;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);var jayson=require(_0x47a5('0x1a'));var client=jayson[_0x47a5('0x1b')][_0x47a5('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x190faa,_0x4e99a8,_0x362359){if(_0x362359){var _0x11faf5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x11faf5[_0x47a5('0x1d')](_0x4e99a8)){return _0x190faa;}else{throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x190faa;}}function respondWithRpcPromise(_0x549de3,_0x138bc0,_0x4b966e,_0x5247fd){return new BPromise(function(_0x423a81,_0xaf70a6){var _0x2ce454=_0x5247fd||client;return _0x2ce454[_0x47a5('0x20')](_0x549de3,_0x4b966e)[_0x47a5('0x21')](function(_0x12b98e){logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,_0x47a5('0x24'));logger['debug'](_0x47a5('0x25'),_0x138bc0,_0x47a5('0x24'),JSON['stringify'](_0x12b98e));if(_0x12b98e[_0x47a5('0x26')]){if(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x27')]===0x1f4){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);return _0xaf70a6(_0x12b98e[_0x47a5('0x26')]['message']);}logger[_0x47a5('0x26')](_0x47a5('0x23'),_0x138bc0,_0x12b98e['error'][_0x47a5('0x28')]);return _0x423a81(_0x12b98e[_0x47a5('0x26')][_0x47a5('0x28')]);}else{logger[_0x47a5('0x22')](_0x47a5('0x23'),_0x138bc0,'request\x20sent');_0x423a81(_0x12b98e['result'][_0x47a5('0x28')]);}})['catch'](function(_0x1ea9c8){logger['error'](_0x47a5('0x23'),_0x138bc0,_0x1ea9c8);_0xaf70a6(_0x1ea9c8);});});}function respondWithStatusCode(_0x378208,_0x36ad34){_0x36ad34=_0x36ad34||0xcc;return function(_0x1dac65){if(_0x1dac65){return _0x378208[_0x47a5('0x29')](_0x36ad34);}return _0x378208[_0x47a5('0x2a')](_0x36ad34)[_0x47a5('0x2b')]();};}function respondWithResult(_0x136b14,_0x16631f){_0x16631f=_0x16631f||0xc8;return function(_0x361bfa){if(_0x361bfa){return _0x136b14[_0x47a5('0x2a')](_0x16631f)[_0x47a5('0x2c')](_0x361bfa);}};}function respondWithFilteredResult(_0x3ad507,_0x528582){return function(_0x243210){if(_0x243210){var _0x51833b=_0x243210['count'],_0x2ef875=_0x528582[_0x47a5('0x2d')],_0x9ac908=_0x528582[_0x47a5('0x2d')]+_0x528582[_0x47a5('0x2e')],_0x16901f;if(_0x9ac908>=_0x51833b){_0x9ac908=_0x51833b;_0x16901f=0xc8;}else{_0x16901f=0xce;}_0x3ad507[_0x47a5('0x2a')](_0x16901f);return _0x3ad507['set']('Content-Range',_0x2ef875+'-'+_0x9ac908+'/'+_0x51833b)[_0x47a5('0x2c')](_0x243210);}return null;};}function patchUpdates(_0xfb5ddb){return function(_0x5bd7eb){try{jsonpatch['apply'](_0x5bd7eb,_0xfb5ddb,!![]);}catch(_0x836303){return BPromise[_0x47a5('0x2f')](_0x836303);}return _0x5bd7eb['save']();};}function saveUpdates(_0x42f70c,_0x53119b){return function(_0x122ed6){if(_0x122ed6){return _0x122ed6[_0x47a5('0x30')](_0x42f70c)['then'](function(_0x4843c0){return _0x4843c0;});}return null;};}function removeEntity(_0x274e34,_0x5910bb){return function(_0x403028){if(_0x403028){return _0x403028[_0x47a5('0x31')]()[_0x47a5('0x21')](function(){var _0x52749b=_0x403028[_0x47a5('0x32')]({'plain':!![]});var _0x50c086='SmsAccounts';return db[_0x47a5('0x33')]['destroy']({'where':{'type':_0x50c086,'resourceId':_0x52749b['id']}})[_0x47a5('0x21')](function(){return _0x403028;});})['then'](function(){_0x274e34[_0x47a5('0x2a')](0xcc)[_0x47a5('0x2b')]();});}};}function handleEntityNotFound(_0x38c8d4,_0x199698){return function(_0x36add5){if(!_0x36add5){_0x38c8d4[_0x47a5('0x29')](0x194);}return _0x36add5;};}function handleError(_0xee582c,_0x452be5){_0x452be5=_0x452be5||0x1f4;return function(_0x1a0d23){logger['error'](_0x1a0d23[_0x47a5('0x34')]);if(_0x1a0d23[_0x47a5('0x35')]){delete _0x1a0d23['name'];}_0xee582c[_0x47a5('0x2a')](_0x452be5)[_0x47a5('0x36')](_0x1a0d23);};}exports[_0x47a5('0x37')]=function(_0x49c4b5,_0x101f70){var _0x10f660={'include':[{'model':db[_0x47a5('0x38')],'as':'mandatoryDispositionPause'}]},_0x596097={},_0x2ebba0={'count':0x0,'rows':[]};var _0x55c5eb=_['map'](db[_0x47a5('0x39')]['rawAttributes'],function(_0x9b5eaf){return{'name':_0x9b5eaf[_0x47a5('0x3a')],'type':_0x9b5eaf[_0x47a5('0x3b')][_0x47a5('0x3c')]};});_0x596097[_0x47a5('0x3d')]=_[_0x47a5('0x3e')](_0x55c5eb,_0x47a5('0x35'));_0x596097[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x49c4b5[_0x47a5('0x3f')]);_0x596097[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],_0x596097['query']);_0x10f660[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x596097[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x49c4b5['query'][_0x47a5('0x44')]));_0x10f660['attributes']=_0x10f660['attributes']['length']?_0x10f660['attributes']:_0x596097[_0x47a5('0x3d')];if(!_0x49c4b5['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x10f660[_0x47a5('0x2e')]=qs['limit'](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x10f660['offset']=qs['offset'](_0x49c4b5[_0x47a5('0x3f')]['offset']);}_0x10f660[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x10f660[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x49c4b5[_0x47a5('0x3f')],_0x596097[_0x47a5('0x41')]),_0x55c5eb);if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x4b')]){_0x10f660[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x10f660[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x55c5eb,function(_0x3a2b38){if(_0x3a2b38['type']!==_0x47a5('0x4d')){var _0x23bb04={};_0x23bb04[_0x3a2b38['name']]={'$like':'%'+_0x49c4b5['query'][_0x47a5('0x4b')]+'%'};return _0x23bb04;}})});}_0x10f660=_['merge']({},_0x10f660,_0x49c4b5[_0x47a5('0x4e')]);var _0xd93e37={'where':_0x10f660['where']};return db['SmsAccount'][_0x47a5('0x4f')](_0xd93e37)['then'](function(_0x2d147c){_0x2ebba0[_0x47a5('0x4f')]=_0x2d147c;if(_0x49c4b5[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x10f660[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x39')][_0x47a5('0x52')](_0x10f660);})['then'](function(_0x48a0ef){_0x2ebba0[_0x47a5('0x53')]=_0x48a0ef;return _0x2ebba0;})[_0x47a5('0x21')](respondWithFilteredResult(_0x101f70,_0x10f660))[_0x47a5('0x54')](handleError(_0x101f70,null));};exports[_0x47a5('0x55')]=function(_0x2c7020,_0x2c0c86){var _0x249de5={'raw':![],'where':{'id':_0x2c7020[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]},_0x492cf7={};_0x492cf7['model']=_[_0x47a5('0x40')](db['SmsAccount'][_0x47a5('0x58')]);_0x492cf7[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x2c7020[_0x47a5('0x3f')]);_0x492cf7['filters']=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],_0x492cf7[_0x47a5('0x3f')]);_0x249de5[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x492cf7[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x2c7020['query'][_0x47a5('0x44')]));_0x249de5[_0x47a5('0x43')]=_0x249de5[_0x47a5('0x43')][_0x47a5('0x59')]?_0x249de5[_0x47a5('0x43')]:_0x492cf7[_0x47a5('0x3d')];if(_0x2c7020['query'][_0x47a5('0x50')]){_0x249de5[_0x47a5('0x51')]=[{'all':!![]}];}_0x249de5=_[_0x47a5('0x4c')]({},_0x249de5,_0x2c7020['options']);return db[_0x47a5('0x39')][_0x47a5('0x5a')](_0x249de5)[_0x47a5('0x21')](handleEntityNotFound(_0x2c0c86,null))['then'](respondWithResult(_0x2c0c86,null))['catch'](handleError(_0x2c0c86,null));};exports[_0x47a5('0x5b')]=function(_0x376e1d,_0x4fa1da){return db['SmsAccount'][_0x47a5('0x5b')](_0x376e1d['body'],{})[_0x47a5('0x21')](function(_0x5d383d){var _0x482de6=_0x376e1d[_0x47a5('0x5c')][_0x47a5('0x32')]({'plain':!![]});if(!_0x482de6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x482de6[_0x47a5('0x5d')]===_0x47a5('0x5c')){var _0x4b706a=_0x5d383d['get']({'plain':!![]});var _0x16b4fd=_0x47a5('0x5e');return db[_0x47a5('0x5f')][_0x47a5('0x5a')]({'where':{'name':_0x16b4fd,'userProfileId':_0x482de6['userProfileId']},'raw':!![]})[_0x47a5('0x21')](function(_0x2b4255){if(_0x2b4255&&_0x2b4255[_0x47a5('0x60')]===0x0){return db['UserProfileResource'][_0x47a5('0x5b')]({'name':_0x4b706a['name'],'resourceId':_0x4b706a['id'],'type':_0x2b4255[_0x47a5('0x35')],'sectionId':_0x2b4255['id']},{})[_0x47a5('0x21')](function(){return _0x5d383d;});}else{return _0x5d383d;}})[_0x47a5('0x54')](function(_0x1c485b){logger[_0x47a5('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c485b);throw _0x1c485b;});}return _0x5d383d;})[_0x47a5('0x21')](respondWithResult(_0x4fa1da,0xc9))['catch'](handleError(_0x4fa1da,null));};exports['update']=function(_0x5eb150,_0x4f8564){if(_0x5eb150[_0x47a5('0x61')]['id']){delete _0x5eb150[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')]['find']({'where':{'id':_0x5eb150['params']['id']},'include':[{'model':db[_0x47a5('0x38')],'as':_0x47a5('0x57')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x4f8564,null))[_0x47a5('0x21')](saveUpdates(_0x5eb150[_0x47a5('0x61')],null))['then'](respondWithResult(_0x4f8564,null))[_0x47a5('0x54')](handleError(_0x4f8564,null));};exports['destroy']=function(_0x22c886,_0x274d31){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x22c886[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x274d31,null))[_0x47a5('0x21')](removeEntity(_0x274d31,null))[_0x47a5('0x54')](handleError(_0x274d31,null));};exports[_0x47a5('0x62')]=function(_0x35cca8,_0x3ac38c){return db['SmsAccount'][_0x47a5('0x62')]()[_0x47a5('0x21')](respondWithResult(_0x3ac38c,null))[_0x47a5('0x54')](handleError(_0x3ac38c,null));};exports[_0x47a5('0x63')]=function(_0x396cb0,_0x4bbe14,_0xbec033){if(_0x396cb0[_0x47a5('0x61')]['id']){delete _0x396cb0[_0x47a5('0x61')]['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x396cb0[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4bbe14,null))[_0x47a5('0x21')](function(_0x350af8){if(_0x350af8){_0x396cb0[_0x47a5('0x61')][_0x47a5('0x64')]=_0x350af8['id'];return db[_0x47a5('0x65')][_0x47a5('0x5b')](_0x396cb0[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x4bbe14,null))['catch'](handleError(_0x4bbe14,null));};exports[_0x47a5('0x66')]=function(_0x284fb8,_0x30504e,_0x4b42f3){var _0x37ac59={'raw':![],'where':{}};var _0x2e46af={};var _0x36c67={'count':0x0,'rows':[]};return db[_0x47a5('0x39')]['findOne']({'where':{'id':_0x284fb8[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x30504e,null))[_0x47a5('0x21')](function(_0x487e21){if(_0x487e21){_0x2e46af[_0x47a5('0x3d')]=_['keys'](db[_0x47a5('0x65')][_0x47a5('0x58')]);_0x2e46af[_0x47a5('0x3f')]=_['keys'](_0x284fb8['query']);_0x2e46af['filters']=_[_0x47a5('0x42')](_0x2e46af[_0x47a5('0x3d')],_0x2e46af[_0x47a5('0x3f')]);_0x37ac59[_0x47a5('0x43')]=_['intersection'](_0x2e46af[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x37ac59[_0x47a5('0x43')]=_0x37ac59[_0x47a5('0x43')][_0x47a5('0x59')]?_0x37ac59[_0x47a5('0x43')]:_0x2e46af[_0x47a5('0x3d')];if(!_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x45')](_0x47a5('0x46'))){_0x37ac59['limit']=qs[_0x47a5('0x2e')](_0x284fb8['query'][_0x47a5('0x2e')]);_0x37ac59[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x37ac59[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x37ac59[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x284fb8[_0x47a5('0x3f')],_0x2e46af[_0x47a5('0x41')]));_0x37ac59[_0x47a5('0x49')]['SmsAccountId']=_0x487e21['id'];if(_0x284fb8['query']['filter']){_0x37ac59['where']=_[_0x47a5('0x4c')](_0x37ac59[_0x47a5('0x49')],{'$or':_['map'](_0x37ac59[_0x47a5('0x43')],function(_0x44dda2){var _0x1baa5a={};_0x1baa5a[_0x44dda2]={'$like':'%'+_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1baa5a;})});}_0x37ac59=_[_0x47a5('0x4c')]({},_0x37ac59,_0x284fb8[_0x47a5('0x4e')]);return db[_0x47a5('0x65')][_0x47a5('0x4f')]({'where':_0x37ac59[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x5e5f16){_0x36c67[_0x47a5('0x4f')]=_0x5e5f16;if(_0x284fb8[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x37ac59['include']=[{'all':!![]}];}return db[_0x47a5('0x65')][_0x47a5('0x52')](_0x37ac59);})[_0x47a5('0x21')](function(_0x5d41d8){_0x36c67[_0x47a5('0x53')]=_0x5d41d8;return _0x36c67;});}})['then'](respondWithFilteredResult(_0x30504e,_0x37ac59))['catch'](handleError(_0x30504e,null));};exports[_0x47a5('0x67')]=function(_0x292d9c,_0x277486,_0x27333e){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x292d9c['params']['id']}})['then'](handleEntityNotFound(_0x277486,null))[_0x47a5('0x21')](function(_0x4f2361){if(_0x4f2361){return _0x4f2361[_0x47a5('0x67')](_0x292d9c[_0x47a5('0x3f')][_0x47a5('0x68')]);}})[_0x47a5('0x21')](respondWithStatusCode(_0x277486,null))['catch'](handleError(_0x277486,null));};exports[_0x47a5('0x69')]=function(_0x550bde,_0x5f3a04,_0x139c79){if(_0x550bde[_0x47a5('0x61')]['id']){delete _0x550bde['body']['id'];}return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x550bde[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x5f3a04,null))[_0x47a5('0x21')](function(_0x578e27){if(_0x578e27){_0x550bde[_0x47a5('0x61')][_0x47a5('0x64')]=_0x578e27['id'];return db[_0x47a5('0x6a')]['create'](_0x550bde[_0x47a5('0x61')]);}})[_0x47a5('0x21')](respondWithResult(_0x5f3a04,null))[_0x47a5('0x54')](handleError(_0x5f3a04,null));};exports['getAnswers']=function(_0x3525e7,_0x4f2fbb,_0x3c012b){var _0x491bb4={'raw':![],'where':{}};var _0x135d2e={};var _0x20d8bd={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x3525e7['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x4f2fbb,null))[_0x47a5('0x21')](function(_0x23c393){if(_0x23c393){_0x135d2e[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db['CannedAnswer']['rawAttributes']);_0x135d2e[_0x47a5('0x3f')]=_['keys'](_0x3525e7[_0x47a5('0x3f')]);_0x135d2e[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x135d2e['model'],_0x135d2e[_0x47a5('0x3f')]);_0x491bb4[_0x47a5('0x43')]=_['intersection'](_0x135d2e[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x491bb4['attributes']=_0x491bb4['attributes'][_0x47a5('0x59')]?_0x491bb4[_0x47a5('0x43')]:_0x135d2e['model'];if(!_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x45')]('nolimit')){_0x491bb4[_0x47a5('0x2e')]=qs[_0x47a5('0x2e')](_0x3525e7[_0x47a5('0x3f')]['limit']);_0x491bb4[_0x47a5('0x2d')]=qs['offset'](_0x3525e7[_0x47a5('0x3f')]['offset']);}_0x491bb4[_0x47a5('0x47')]=qs[_0x47a5('0x48')](_0x3525e7['query'][_0x47a5('0x48')]);_0x491bb4['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x3525e7[_0x47a5('0x3f')],_0x135d2e[_0x47a5('0x41')]));_0x491bb4['where'][_0x47a5('0x64')]=_0x23c393['id'];if(_0x3525e7['query']['filter']){_0x491bb4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x491bb4[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x491bb4[_0x47a5('0x43')],function(_0x5b1f5e){var _0x1522a6={};_0x1522a6[_0x5b1f5e]={'$like':'%'+_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1522a6;})});}_0x491bb4=_[_0x47a5('0x4c')]({},_0x491bb4,_0x3525e7['options']);return db[_0x47a5('0x6a')]['count']({'where':_0x491bb4[_0x47a5('0x49')]})[_0x47a5('0x21')](function(_0x3f93f0){_0x20d8bd[_0x47a5('0x4f')]=_0x3f93f0;if(_0x3525e7[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x491bb4[_0x47a5('0x51')]=[{'all':!![]}];}return db[_0x47a5('0x6a')][_0x47a5('0x52')](_0x491bb4);})['then'](function(_0x36796e){_0x20d8bd[_0x47a5('0x53')]=_0x36796e;return _0x20d8bd;});}})['then'](respondWithFilteredResult(_0x4f2fbb,_0x491bb4))[_0x47a5('0x54')](handleError(_0x4f2fbb,null));};exports[_0x47a5('0x6c')]=function(_0x6d6a5,_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x6d6a5['params']['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x21')](function(_0x17f82d){if(_0x17f82d){return _0x17f82d['removeAnswers'](_0x6d6a5[_0x47a5('0x3f')][_0x47a5('0x68')]);}})['then'](respondWithStatusCode(_0x5b85cd,null))[_0x47a5('0x54')](handleError(_0x5b85cd,null));};exports[_0x47a5('0x6d')]=function(_0x109805,_0x70c8a6,_0x364bb0){var _0x1371e4={'channel':'sms'};var _0x4c9894=[];var _0x5bd86e=[];var _0x133b7a={};return db[_0x47a5('0x39')]['find']({'where':{'id':_0x109805[_0x47a5('0x56')]['id']},'include':[{'model':db[_0x47a5('0x6e')],'as':_0x47a5('0x6f')}]})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x5084d6){_0x1371e4[_0x47a5('0x70')]=_0x5084d6;_0x1371e4['applications']=_['orderBy'](_0x5084d6['Applications'],[_0x47a5('0x71')],['asc']);if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x6f')]){delete _0x1371e4[_0x47a5('0x70')]['Applications'];}return db[_0x47a5('0x72')][_0x47a5('0x62')]();})[_0x47a5('0x21')](function(_0x121750){if(!_0x121750){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x73'));}_0x4c9894=_[_0x47a5('0x74')](_['keys'](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76')]);_0x5bd86e=_[_0x47a5('0x74')](_[_0x47a5('0x40')](_0x121750),[_0x47a5('0x75'),_0x47a5('0x76'),'CompanyId',_0x47a5('0x77')]);_0x1371e4[_0x47a5('0x61')]={'mapKey':'mobile'};if(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){switch(_0x1371e4[_0x47a5('0x70')][_0x47a5('0x3b')]){case'twilio':_0x1371e4['body']['from']=_0x109805['body'][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x79')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['MessageSid'];break;case _0x47a5('0x7b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['sender'];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body']['text'];break;case _0x47a5('0x7d'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805[_0x47a5('0x61')][_0x47a5('0x28')];break;case'clicksend':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x61')];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x7e')];break;case _0x47a5('0x7f'):_0x1371e4['body'][_0x47a5('0x7c')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x78')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x80')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x81')];break;case _0x47a5('0x82'):_0x1371e4['body'][_0x47a5('0x7c')]='+'+_0x109805[_0x47a5('0x61')]['results'][0x0][_0x47a5('0x7c')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0]['text'];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x83')][0x0][_0x47a5('0x7a')];break;case _0x47a5('0x84'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805['body'][_0x47a5('0x85')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805['body'][_0x47a5('0x86')][_0x47a5('0x28')];break;case _0x47a5('0x87'):_0x1371e4[_0x47a5('0x61')]['from']=_0x109805[_0x47a5('0x61')][_0x47a5('0x88')];_0x1371e4[_0x47a5('0x61')]['body']=_0x109805['body'][_0x47a5('0x89')];_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')][_0x47a5('0x8a')];break;case _0x47a5('0x8b'):_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')]=_0x109805['body'][_0x47a5('0x7c')];_0x1371e4['body'][_0x47a5('0x61')]=_0x109805[_0x47a5('0x61')]['message'];_0x1371e4['body'][_0x47a5('0x7a')]=_0x109805[_0x47a5('0x61')]['refid'];break;}}if(_0x1371e4[_0x47a5('0x61')]['id']){delete _0x1371e4[_0x47a5('0x61')]['id'];}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')]['from'])){throw new db[(_0x47a5('0x1e'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x1371e4[_0x47a5('0x61')]['body'])||_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8d'));}if(_[_0x47a5('0x8c')](_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))][(_0x47a5('0x1f'))](_0x47a5('0x8f')+_0x5bd86e);}if(!_[_0x47a5('0x90')](_0x5bd86e,_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0x91')+_0x5bd86e);}_0x133b7a[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db[_0x47a5('0x92')]['find']({'where':{'id':_0x1371e4[_0x47a5('0x70')]['ListId']},'include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':_0x133b7a,'limit':0x1,'order':[[_0x47a5('0x76'),'DESC']]}]});})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x14771b){if(_0x14771b){_0x1371e4['list']=_['omit'](_0x14771b,[_0x47a5('0x93')]);if(_0x14771b[_0x47a5('0x93')][_0x47a5('0x59')]){return _0x14771b[_0x47a5('0x93')][0x0];}var _0x204bd6=_['defaults'](_0x1371e4[_0x47a5('0x61')],{'firstName':_0x1371e4['body'][_0x47a5('0x7c')],'ListId':_0x14771b['id']});_0x204bd6[_0x1371e4[_0x47a5('0x61')][_0x47a5('0x8e')]]=_0x1371e4[_0x47a5('0x61')]['from'];return db['CmContact'][_0x47a5('0x5b')](_0x204bd6,{'fields':_0x4c9894,'raw':!![]});}})[_0x47a5('0x21')](handleEntityNotFound(_0x70c8a6,null))[_0x47a5('0x21')](function(_0x4339d4){if(_0x4339d4){_0x1371e4[_0x47a5('0x94')]=_0x4339d4;var _0x36a44c={'ContactId':_0x4339d4['id'],'phone':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7c')],'SmsAccountId':_0x109805[_0x47a5('0x56')]['id']};var _0x481bc3={'ContactId':_0x4339d4['id'],'SmsAccountId':_0x109805['params']['id'],'closed':![]};return db[_0x47a5('0x95')]['find']({'where':_0x481bc3})[_0x47a5('0x21')](function(_0x2d0b67){if(_0x2d0b67){return[_0x2d0b67,![]];}return db[_0x47a5('0x95')]['create'](_0x36a44c)[_0x47a5('0x21')](function(_0x26d629){return[_0x26d629,!![]];});});}})['spread'](function(_0xcb6714,_0x51f6cf){_0x1371e4[_0x47a5('0x96')]=_0xcb6714[_0x47a5('0x32')]({'plain':!![]});_0x1371e4[_0x47a5('0x96')]['created']=![];if(_0x51f6cf){if(_0x1371e4['account']['autoclose']){_0x1371e4['applications']['push']({'id':0x0,'priority':_0x1371e4[_0x47a5('0x97')]['length']+0x1,'app':_0x47a5('0x98'),'appdata':_0x47a5('0x99'),'interval':'*,*,*,*'});}_0x1371e4['interaction']['created']=!![];}return db[_0x47a5('0x9a')]['create']({'phone':_0x1371e4['body']['from'],'messageId':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x7a')],'body':_0x1371e4[_0x47a5('0x61')][_0x47a5('0x61')],'SmsAccountId':_0x109805['params']['id'],'SmsInteractionId':_0xcb6714['id'],'direction':'in','ContactId':_0xcb6714[_0x47a5('0x9b')],'AttachmentId':_0x1371e4['body'][_0x47a5('0x9c')]});})['then'](function(_0x2de924){_0x1371e4[_0x47a5('0x28')]=_0x2de924;if(_0x1371e4[_0x47a5('0x96')]['UserId']){return db[_0x47a5('0x9d')][_0x47a5('0x5a')]({'attributes':['id',_0x47a5('0x35')],'where':{'id':_0x1371e4[_0x47a5('0x96')]['UserId']}})[_0x47a5('0x21')](function(_0x9a7edc){if(_0x9a7edc){_0x1371e4[_0x47a5('0x97')][_0x47a5('0x9e')]({'id':0x0,'priority':0x0,'app':_0x47a5('0x9f'),'appdata':_0x9a7edc[_0x47a5('0x35')]+','+(_0x1371e4['account'][_0x47a5('0xa0')]||0xa),'interval':_0x47a5('0xa1')});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);});}return respondWithRpcPromise(_0x47a5('0xa2'),_0x47a5('0xa3'),_0x1371e4);})[_0x47a5('0x21')](function(_0x2697df){if(_0x2697df){var _0x408887=0xc8;var _0x34fde3=_0x47a5('0xa4');logger[_0x47a5('0x22')](_0x47a5('0x25'),_0x34fde3,_0x408887,_0x47a5('0xa5'));logger[_0x47a5('0xa6')](_0x47a5('0xa7'),_0x34fde3,_0x408887,_0x47a5('0xa5'),JSON['stringify'](_0x2697df));if(_0x1371e4[_0x47a5('0x70')]['type']==='twilio'){return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0xa8')](_0x47a5('0xa9'),'text/xml')[_0x47a5('0x36')](_0x47a5('0xaa'));}else{return _0x70c8a6[_0x47a5('0x2a')](_0x408887)[_0x47a5('0x2c')](_0x2697df);}}})[_0x47a5('0x54')](handleError(_0x70c8a6,null));};exports[_0x47a5('0xab')]=function(_0x1b1f86,_0x46cb3a,_0x176e71){return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1b1f86[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x46cb3a,null))['then'](function(_0x4aad5f){if(_0x4aad5f){return db[_0x47a5('0xac')]['transaction'](function(_0x249339){return db[_0x47a5('0x6e')][_0x47a5('0x31')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'transaction':_0x249339})[_0x47a5('0x21')](function(_0x3708ea){var _0x583b37=_[_0x47a5('0x3e')](_0x1b1f86[_0x47a5('0x61')],function(_0x380eca){_0x380eca['SmsAccountId']=_0x1b1f86[_0x47a5('0x56')]['id'];return _0x380eca;});return db[_0x47a5('0x6e')][_0x47a5('0xad')](_0x583b37,{'transaction':_0x249339});});})[_0x47a5('0x21')](function(){return db[_0x47a5('0x6e')][_0x47a5('0xae')]({'where':{'SmsAccountId':_0x1b1f86[_0x47a5('0x56')]['id']},'order':_0x47a5('0x71')});});}})[_0x47a5('0x21')](respondWithResult(_0x46cb3a,null))[_0x47a5('0x54')](handleError(_0x46cb3a,null));};exports[_0x47a5('0xaf')]=function(_0x40b7a5,_0x28e998,_0x2ac386){var _0x578983={};var _0x3f7fdc={};var _0x272cd0;var _0x150cff;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x40b7a5[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x28e998,null))['then'](function(_0x185104){if(_0x185104){_0x272cd0=_0x185104;_0x3f7fdc['model']=_[_0x47a5('0x40')](db[_0x47a5('0x6e')][_0x47a5('0x58')]);_0x3f7fdc[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x40b7a5[_0x47a5('0x3f')]);_0x3f7fdc[_0x47a5('0x41')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],_0x3f7fdc[_0x47a5('0x3f')]);_0x578983[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x3f7fdc['model'],qs[_0x47a5('0x44')](_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x578983[_0x47a5('0x43')]=_0x578983['attributes'][_0x47a5('0x59')]?_0x578983[_0x47a5('0x43')]:_0x3f7fdc[_0x47a5('0x3d')];_0x578983[_0x47a5('0x47')]=qs['sort'](_0x40b7a5[_0x47a5('0x3f')]['sort']);_0x578983['where']=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x40b7a5[_0x47a5('0x3f')],_0x3f7fdc[_0x47a5('0x41')]));if(_0x40b7a5['query'][_0x47a5('0x4b')]){_0x578983[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x578983[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x578983[_0x47a5('0x43')],function(_0x5eae8d){var _0x1da268={};_0x1da268[_0x5eae8d]={'$like':'%'+_0x40b7a5[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x1da268;})});}_0x578983=_[_0x47a5('0x4c')]({},_0x578983,_0x40b7a5[_0x47a5('0x4e')]);return _0x272cd0['getApplications'](_0x578983);}})[_0x47a5('0x21')](function(_0x4c7627){if(_0x4c7627){_0x150cff=_0x4c7627[_0x47a5('0x59')];if(!_0x40b7a5['query'][_0x47a5('0x45')]('nolimit')){_0x578983['limit']=qs[_0x47a5('0x2e')](_0x40b7a5[_0x47a5('0x3f')]['limit']);_0x578983[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x40b7a5['query'][_0x47a5('0x2d')]);}return _0x272cd0[_0x47a5('0xaf')](_0x578983);}})[_0x47a5('0x21')](function(_0x508622){if(_0x508622){return _0x508622?{'count':_0x150cff,'rows':_0x508622}:null;}})[_0x47a5('0x21')](respondWithResult(_0x28e998,null))[_0x47a5('0x54')](handleError(_0x28e998,null));};exports[_0x47a5('0xb0')]=function(_0x30b0f9,_0x37721c,_0x53cc9e){var _0x5973d4={'raw':![],'where':{}};var _0x2678cb={};var _0x56808d={'count':0x0,'rows':[]};return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x30b0f9['params']['id']}})['then'](handleEntityNotFound(_0x37721c,null))[_0x47a5('0x21')](function(_0x4997bc){if(_0x4997bc){_0x2678cb[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x95')][_0x47a5('0x58')]);_0x2678cb[_0x47a5('0x3f')]=_[_0x47a5('0x40')](_0x30b0f9[_0x47a5('0x3f')]);_0x2678cb['filters']=_[_0x47a5('0x42')](_0x2678cb['model'],_0x2678cb[_0x47a5('0x3f')]);_0x5973d4[_0x47a5('0x43')]=_[_0x47a5('0x42')](_0x2678cb[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x5973d4[_0x47a5('0x43')]=_0x5973d4[_0x47a5('0x43')][_0x47a5('0x59')]?_0x5973d4[_0x47a5('0x43')]:_0x2678cb[_0x47a5('0x3d')];if(!_0x30b0f9['query'][_0x47a5('0x45')](_0x47a5('0x46'))){_0x5973d4[_0x47a5('0x2e')]=qs['limit'](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x5973d4[_0x47a5('0x2d')]=qs[_0x47a5('0x2d')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x2d')]);}_0x5973d4['order']=qs[_0x47a5('0x48')](_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x5973d4[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x30b0f9[_0x47a5('0x3f')],_0x2678cb[_0x47a5('0x41')]));_0x5973d4[_0x47a5('0x49')][_0x47a5('0x64')]=_0x4997bc['id'];if(_0x30b0f9['query']['filter']){_0x5973d4[_0x47a5('0x49')]=_[_0x47a5('0x4c')](_0x5973d4[_0x47a5('0x49')],{'$or':_['map'](_0x5973d4[_0x47a5('0x43')],function(_0x50b7fc){var _0x522345={};_0x522345[_0x50b7fc]={'$like':'%'+_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x522345;})});}_0x5973d4=_[_0x47a5('0x4c')]({},_0x5973d4,_0x30b0f9[_0x47a5('0x4e')]);return db['SmsInteraction'][_0x47a5('0x4f')]({'where':_0x5973d4[_0x47a5('0x49')]})['then'](function(_0x59ba59){_0x56808d['count']=_0x59ba59;if(_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0x50')]){_0x5973d4[_0x47a5('0x51')]=[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0xb1'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x47a5('0x35'),_0x47a5('0xb2'),_0x47a5('0xb3')],'required':![]},{'model':db[_0x47a5('0xb4')],'as':'Tags','attributes':['id',_0x47a5('0x35'),_0x47a5('0xb5')],'where':_0x30b0f9[_0x47a5('0x3f')][_0x47a5('0xb6')]?{'id':_0x30b0f9['query']['tag']}:undefined,'required':_0x30b0f9['query'][_0x47a5('0xb6')]?!![]:![]}];}return db[_0x47a5('0x95')][_0x47a5('0x52')](_0x5973d4);})[_0x47a5('0x21')](function(_0x242006){_0x56808d[_0x47a5('0x53')]=_0x242006;return _0x56808d;});}})[_0x47a5('0x21')](respondWithFilteredResult(_0x37721c,_0x5973d4))[_0x47a5('0x54')](handleError(_0x37721c,null));};exports[_0x47a5('0x36')]=function(_0x5b48d0,_0x40fe75,_0x7b5348){var _0x50b482,_0x34ff37,_0x2bbf95;if(_[_0x47a5('0x8c')](_0x5b48d0[_0x47a5('0x61')]['body'])||_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')]===''){throw new db[(_0x47a5('0x1e'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x47a5('0x8c')](_0x5b48d0['body']['to'])){throw new db[(_0x47a5('0x1e'))]['ValidationError'](_0x47a5('0xb7'));}_0x50b482=_0x5b48d0[_0x47a5('0x61')]['to'];return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x5b48d0[_0x47a5('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x47a5('0x72')],'as':_0x47a5('0x93'),'where':{'mobile':_0x50b482},'limit':0x1,'order':[[_0x47a5('0x76'),_0x47a5('0xb8')]]}]}]})['then'](handleEntityNotFound(_0x40fe75,null))['then'](function(_0x3222e4){if(_0x3222e4&&_0x3222e4['List']){_0x34ff37=_0x3222e4[_0x47a5('0x32')]({'plain':!![]});if(_0x34ff37['List']&&_0x34ff37[_0x47a5('0xb9')]['Contacts'][_0x47a5('0x59')]){return _0x34ff37[_0x47a5('0xb9')][_0x47a5('0x93')][0x0];}return db[_0x47a5('0x72')][_0x47a5('0x5b')](_[_0x47a5('0x16')](_0x5b48d0[_0x47a5('0x61')],{'firstName':_0x50b482,'mobile':_0x50b482,'phone':_0x50b482,'ListId':_0x34ff37[_0x47a5('0x77')]}));}})['then'](handleEntityNotFound(_0x40fe75,null))[_0x47a5('0x21')](function(_0x4394f0){if(_0x4394f0){_0x2bbf95=_0x4394f0;return db['SmsInteraction'][_0x47a5('0x5a')]({'where':{'ContactId':_0x2bbf95['id'],'closed':![],'SmsAccountId':_0x34ff37['id']}})[_0x47a5('0x21')](function(_0x54f283){if(_0x54f283){return[_0x54f283,![]];}return db['SmsInteraction'][_0x47a5('0x5b')]({'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id'],'SmsAccountId':_0x34ff37['id'],'phone':_0x50b482,'firstMsgDirection':_0x47a5('0xba'),'Messages':[_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0['body'][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'UserId':_0x5b48d0[_0x47a5('0x5c')]['id'],'ContactId':_0x2bbf95['id']})]},{'include':[{'model':db[_0x47a5('0x9a')],'as':_0x47a5('0xbb')}]})[_0x47a5('0x21')](function(_0x454609){return[_0x454609,!![]];});});}})[_0x47a5('0xbc')](function(_0x5c4301,_0x2bc0d8){if(_0x2bc0d8){return _0x5c4301;}return db[_0x47a5('0x9a')][_0x47a5('0x5b')](_[_0x47a5('0x4c')](_0x5b48d0[_0x47a5('0x61')],{'read':![],'body':_0x5b48d0[_0x47a5('0x61')][_0x47a5('0x61')],'phone':_0x50b482,'SmsAccountId':_0x34ff37['id'],'SmsInteractionId':_0x5c4301['id'],'UserId':_0x5b48d0['user']['id'],'ContactId':_0x2bbf95['id']}))['then'](function(_0x11d87b){_0x5c4301[_0x47a5('0xbd')][_0x47a5('0xbb')]=[];_0x5c4301['dataValues']['Messages'][_0x47a5('0xbe')](_0x11d87b[_0x47a5('0xbd')]);return _0x5c4301;});})[_0x47a5('0x21')](respondWithResult(_0x40fe75,null))[_0x47a5('0x54')](handleError(_0x40fe75,null));};exports[_0x47a5('0x2a')]=function(_0x4121c1,_0x2e0add,_0x58e85b){if(_0x4121c1[_0x47a5('0x61')]['id']){delete _0x4121c1[_0x47a5('0x61')]['id'];}console[_0x47a5('0xbf')]('endpoint\x20/status\x20POST\x20/',_0x4121c1[_0x47a5('0x61')]);var _0x611b40,_0x144bc9,_0x278b42;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x4121c1[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x9ced85){if(_0x9ced85){_0x278b42=_0x9ced85;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),'received\x20delivery\x20report\x20from',_0x9ced85[_0x47a5('0x3b')],util['inspect'](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));switch(_0x9ced85['type']){case _0x47a5('0x7b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc0')]&&_0x4121c1['body'][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1['body'][_0x47a5('0x2a')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['skebby_dispatch_id']}});}break;case _0x47a5('0x7d'):if(_0x4121c1['body']['requestid']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc2')]}});}break;case _0x47a5('0xc3'):if(_0x4121c1['body']['message_id']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc4')];return db[_0x47a5('0x9a')]['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')][_0x47a5('0x7e')]}});}break;case _0x47a5('0x82'):var _0x50ff41=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x50ff41[_0x47a5('0x7a')]&&_0x50ff41['status'][_0x47a5('0xc5')]===_0x47a5('0xc6')){_0x144bc9=_0x50ff41[_0x47a5('0x2a')]['groupName'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x50ff41[_0x47a5('0x7a')]}});}break;case _0x47a5('0x87'):if(_0x4121c1[_0x47a5('0x61')]['messageId']&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')];return db['SmsMessage']['find']({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['messageId']}});}break;case _0x47a5('0x8b'):if(_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc7')]&&_0x4121c1[_0x47a5('0x61')][_0x47a5('0x2a')]){_0x144bc9=_0x4121c1[_0x47a5('0x61')]['status'];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x4121c1[_0x47a5('0x61')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x2e0add,null))[_0x47a5('0x21')](function(_0x4ebe30){if(_0x4ebe30){_0x611b40=_0x4ebe30;switch(_0x278b42[_0x47a5('0x3b')]){case _0x47a5('0x7b'):if(_0x144bc9===_0x47a5('0xc6')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x7d'):if(_0x144bc9==='1'){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0x7b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4121c1[_0x47a5('0x61')][_0x47a5('0xc9')]&&_0x144bc9>=0xc8&&_0x144bc9<=0xce){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xc3'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x82'):var _0x2cc493=_0x4121c1['body'][_0x47a5('0x83')][0x0];if(_0x2cc493[_0x47a5('0x2a')][_0x47a5('0xc5')]===_0x47a5('0xc6')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),'infobip',util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x144bc9==_0x47a5('0xca')||_0x144bc9==_0x47a5('0xcb')){return _0x611b40[_0x47a5('0x30')]({'read':!![]});}else{logger['error'](_0x47a5('0x25'),'status',_0x47a5('0x87'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;case _0x47a5('0x8b'):if(_0x144bc9===_0x47a5('0xcc')||_0x144bc9===_0x47a5('0xcd')){return _0x611b40['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x47a5('0x2a'),_0x47a5('0x8b'),util[_0x47a5('0xc8')](_0x4121c1[_0x47a5('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x611b40;}})[_0x47a5('0x21')](respondWithResult(_0x2e0add,null))[_0x47a5('0x54')](handleError(_0x2e0add,null));};exports[_0x47a5('0xce')]=function(_0x138b92,_0x232c36,_0x25954e){var _0x277061,_0x3917e0,_0x1c7695;return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x138b92[_0x47a5('0x56')]['id']}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x46b82a){if(_0x46b82a){_0x1c7695=_0x46b82a;logger[_0x47a5('0xa6')](_0x47a5('0x25'),_0x47a5('0x2a'),_0x47a5('0xcf'),_0x46b82a[_0x47a5('0x3b')],util[_0x47a5('0xc8')](_0x138b92['query'],{'showHidden':![],'depth':null}));switch(_0x46b82a[_0x47a5('0x3b')]){case'csc':if(_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]&&_0x138b92['query'][_0x47a5('0xd1')]){_0x3917e0=_0x138b92['query'][_0x47a5('0xd1')];return db[_0x47a5('0x9a')][_0x47a5('0x5a')]({'where':{'messageId':_0x138b92[_0x47a5('0x3f')][_0x47a5('0xd0')]}});}break;}}})['then'](handleEntityNotFound(_0x232c36,null))[_0x47a5('0x21')](function(_0x9a2f87){if(_0x9a2f87){_0x277061=_0x9a2f87;switch(_0x1c7695[_0x47a5('0x3b')]){case'csc':if(_0x3917e0==='2'||_0x3917e0==='6'){return _0x277061['update']({'read':!![]});}else{logger[_0x47a5('0x26')](_0x47a5('0x25'),_0x47a5('0x2a'),'csc',util[_0x47a5('0xc8')](_0x138b92[_0x47a5('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x277061;}})[_0x47a5('0x21')](respondWithResult(_0x232c36,null))['catch'](handleError(_0x232c36,null));};exports[_0x47a5('0xd2')]=function(_0x3136f9,_0x3ecc43,_0xf4b1df){return db['SmsAccount'][_0x47a5('0x5a')]({'where':{'id':_0x3136f9['params']['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x3ecc43,null))[_0x47a5('0x21')](function(_0xdc5eac){if(_0xdc5eac){return _0xdc5eac[_0x47a5('0xd2')](_0x3136f9['body'][_0x47a5('0x68')],_[_0x47a5('0xd3')](_0x3136f9[_0x47a5('0x61')],[_0x47a5('0x68'),'id'])||{})[_0x47a5('0xbc')](function(_0x4c2b0c){for(var _0xbe3a38=0x0;_0xbe3a38<_0x3136f9[_0x47a5('0x61')][_0x47a5('0x68')][_0x47a5('0x59')];_0xbe3a38+=0x1){socket[_0x47a5('0xd4')](_0x47a5('0xd5'),{'UserId':_0x3136f9['body'][_0x47a5('0x68')][_0xbe3a38],'SmsAccountId':_0x3136f9[_0x47a5('0x56')]['id']});}return _0x4c2b0c;});}})['then'](respondWithResult(_0x3ecc43,null))['catch'](handleError(_0x3ecc43,null));};exports[_0x47a5('0xd6')]=function(_0x32d299,_0x20d99b,_0x3964f8){return db[_0x47a5('0x39')][_0x47a5('0x5a')]({'where':{'id':_0x32d299['params']['id']}})['then'](handleEntityNotFound(_0x20d99b,null))[_0x47a5('0x21')](function(_0xa3a516){if(_0xa3a516){return _0xa3a516['removeAgents'](_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')])['then'](function(){if(_[_0x47a5('0xd7')](_0x32d299['query']['ids'])){for(var _0x4aeaff=0x0;_0x4aeaff<_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')][_0x47a5('0x59')];_0x4aeaff+=0x1){socket['emit'](_0x47a5('0xd8'),{'UserId':Number(_0x32d299['query'][_0x47a5('0x68')][_0x4aeaff]),'SmsAccountId':Number(_0x32d299['params']['id'])});}}else{socket[_0x47a5('0xd4')](_0x47a5('0xd8'),{'UserId':Number(_0x32d299[_0x47a5('0x3f')][_0x47a5('0x68')]),'SmsAccountId':Number(_0x32d299[_0x47a5('0x56')]['id'])});}});}})[_0x47a5('0x21')](respondWithStatusCode(_0x20d99b,null))[_0x47a5('0x54')](handleError(_0x20d99b,null));};exports[_0x47a5('0xd9')]=function(_0x1396c2,_0x5c9091,_0x4f1e24){var _0x24c88e={};var _0xa859a={};var _0x5270cc;var _0x2a0f45;return db[_0x47a5('0x39')][_0x47a5('0x6b')]({'where':{'id':_0x1396c2[_0x47a5('0x56')]['id']}})[_0x47a5('0x21')](handleEntityNotFound(_0x5c9091,null))[_0x47a5('0x21')](function(_0x969d4b){if(_0x969d4b){_0x5270cc=_0x969d4b;_0xa859a[_0x47a5('0x3d')]=_[_0x47a5('0x40')](db[_0x47a5('0x9d')]['rawAttributes']);_0xa859a['query']=_['keys'](_0x1396c2['query']);_0xa859a[_0x47a5('0x41')]=_['intersection'](_0xa859a[_0x47a5('0x3d')],_0xa859a[_0x47a5('0x3f')]);_0x24c88e['attributes']=_[_0x47a5('0x42')](_0xa859a[_0x47a5('0x3d')],qs[_0x47a5('0x44')](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x44')]));_0x24c88e[_0x47a5('0x43')]=_0x24c88e['attributes'][_0x47a5('0x59')]?_0x24c88e[_0x47a5('0x43')]:_0xa859a['model'];_0x24c88e[_0x47a5('0x47')]=qs['sort'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x48')]);_0x24c88e[_0x47a5('0x49')]=qs[_0x47a5('0x41')](_[_0x47a5('0x4a')](_0x1396c2[_0x47a5('0x3f')],_0xa859a[_0x47a5('0x41')]));if(_0x1396c2['query'][_0x47a5('0x4b')]){_0x24c88e[_0x47a5('0x49')]=_['merge'](_0x24c88e[_0x47a5('0x49')],{'$or':_[_0x47a5('0x3e')](_0x24c88e['attributes'],function(_0x14c968){var _0x5a7920={};_0x5a7920[_0x14c968]={'$like':'%'+_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x4b')]+'%'};return _0x5a7920;})});}_0x24c88e=_[_0x47a5('0x4c')]({},_0x24c88e,_0x1396c2[_0x47a5('0x4e')]);return _0x5270cc[_0x47a5('0xd9')](_0x24c88e);}})['then'](function(_0x4b8b65){if(_0x4b8b65){_0x2a0f45=_0x4b8b65[_0x47a5('0x59')];if(!_0x1396c2['query']['hasOwnProperty']('nolimit')){_0x24c88e[_0x47a5('0x2e')]=qs['limit'](_0x1396c2[_0x47a5('0x3f')][_0x47a5('0x2e')]);_0x24c88e[_0x47a5('0x2d')]=qs['offset'](_0x1396c2['query'][_0x47a5('0x2d')]);}return _0x5270cc['getAgents'](_0x24c88e);}})['then'](function(_0xe87e6e){if(_0xe87e6e){return _0xe87e6e?{'count':_0x2a0f45,'rows':_0xe87e6e}:null;}})['then'](respondWithResult(_0x5c9091,null))['catch'](handleError(_0x5c9091,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index fceccd7..9610914 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 _0x31a1=['../../mysqldb','SmsAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x5c4f3d,_0x4b115a){var _0x36a69d=function(_0x3f01ea){while(--_0x3f01ea){_0x5c4f3d['push'](_0x5c4f3d['shift']());}};_0x36a69d(++_0x4b115a);}(_0x31a1,0x1df));var _0x131a=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x31a1[_0x474bc0];return _0x4b24cf;};'use strict';var EventEmitter=require(_0x131a('0x0'));var SmsAccount=require(_0x131a('0x1'))['db'][_0x131a('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x131a('0x3')](0x0);var events={'afterCreate':_0x131a('0x4'),'afterUpdate':_0x131a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5cb791){return function(_0x52f6c1,_0x340ce4,_0x303857){SmsAccountEvents[_0x131a('0x6')](_0x5cb791+':'+_0x52f6c1['id'],_0x52f6c1);SmsAccountEvents[_0x131a('0x6')](_0x5cb791,_0x52f6c1);_0x303857(null);};}for(var e in events){if(events[_0x131a('0x7')](e)){var event=events[e];SmsAccount[_0x131a('0x8')](e,emitEvent(event));}}module[_0x131a('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x14b4=['setMaxListeners','save','remove','emit','hook','exports','SmsAccount'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x14b4,0x8b));var _0x414b=function(_0x21a314,_0xbe022b){_0x21a314=_0x21a314-0x0;var _0x3eb9f6=_0x14b4[_0x21a314];return _0x3eb9f6;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db'][_0x414b('0x0')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x414b('0x1')](0x0);var events={'afterCreate':_0x414b('0x2'),'afterUpdate':'update','afterDestroy':_0x414b('0x3')};function emitEvent(_0x421a47){return function(_0x3de4a6,_0x56c935,_0xc2e30a){SmsAccountEvents[_0x414b('0x4')](_0x421a47+':'+_0x3de4a6['id'],_0x3de4a6);SmsAccountEvents[_0x414b('0x4')](_0x421a47,_0x3de4a6);_0xc2e30a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x414b('0x5')](e,emitEvent(event));}}module[_0x414b('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index f9f6960..e4a7540 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 _0xa9e0=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5e696a,_0x370fb1){var _0x44920d=function(_0x257f55){while(--_0x257f55){_0x5e696a['push'](_0x5e696a['shift']());}};_0x44920d(++_0x370fb1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4ed4a9,_0xaeac11){var _0x1bfd5e=function(_0x43cbc2){while(--_0x43cbc2){_0x4ed4a9['push'](_0x4ed4a9['shift']());}};_0x1bfd5e(++_0xaeac11);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 9a312bd..e105bfc 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 _0x54c0=['request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','ShowSmsAccount','SmsAccount','options','where','attributes','include','model','map','debug','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','defaults','localhost','socket.io-emitter','redis','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s'];(function(_0x128f73,_0x2d4814){var _0x45b365=function(_0x20c411){while(--_0x20c411){_0x128f73['push'](_0x128f73['shift']());}};_0x45b365(++_0x2d4814);}(_0x54c0,0xe4));var _0x054c=function(_0x970c3b,_0x2c7e9b){_0x970c3b=_0x970c3b-0x0;var _0x4a4262=_0x54c0[_0x970c3b];return _0x4a4262;};'use strict';var _=require(_0x054c('0x0'));var util=require('util');var moment=require(_0x054c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x054c('0x2'));var db=require(_0x054c('0x3'))['db'];var utils=require(_0x054c('0x4'));var logger=require(_0x054c('0x5'))('rpc');var config=require(_0x054c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x054c('0x7')]['http']({'port':0x232a});config['redis']=_[_0x054c('0x8')](config['redis'],{'host':_0x054c('0x9'),'port':0x18eb});var socket=require(_0x054c('0xa'))(new Redis(config[_0x054c('0xb')]));require(_0x054c('0xc'))[_0x054c('0xd')](socket);function respondWithRpcPromise(_0x2b4d23,_0x43e540,_0x906307){return new BPromise(function(_0x28f531,_0x4ef792){return client[_0x054c('0xe')](_0x2b4d23,_0x906307)[_0x054c('0xf')](function(_0x528acf){logger['info'](_0x054c('0x10'),_0x43e540,_0x054c('0x11'));logger['debug'](_0x054c('0x12'),_0x43e540,'request\x20sent',JSON[_0x054c('0x13')](_0x528acf));if(_0x528acf['error']){if(_0x528acf[_0x054c('0x14')][_0x054c('0x15')]===0x1f4){logger[_0x054c('0x14')]('SmsAccount,\x20%s,\x20%s',_0x43e540,_0x528acf[_0x054c('0x14')][_0x054c('0x16')]);return _0x4ef792(_0x528acf[_0x054c('0x14')][_0x054c('0x16')]);}logger['error'](_0x054c('0x10'),_0x43e540,_0x528acf[_0x054c('0x14')]['message']);return _0x28f531(_0x528acf[_0x054c('0x14')][_0x054c('0x16')]);}else{logger[_0x054c('0x17')](_0x054c('0x10'),_0x43e540,'request\x20sent');_0x28f531(_0x528acf[_0x054c('0x18')][_0x054c('0x16')]);}})['catch'](function(_0x3a2c9b){logger[_0x054c('0x14')](_0x054c('0x10'),_0x43e540,_0x3a2c9b);_0x4ef792(_0x3a2c9b);});});}exports[_0x054c('0x19')]=function(_0x70fd9a){var _0x5c8ee6=this;return new Promise(function(_0x4f0d96,_0x5ebebc){return db[_0x054c('0x1a')]['find']({'raw':_0x70fd9a['options']?_0x70fd9a[_0x054c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x70fd9a[_0x054c('0x1b')]?_0x70fd9a['options'][_0x054c('0x1c')]||null:null,'attributes':_0x70fd9a['options']?_0x70fd9a[_0x054c('0x1b')][_0x054c('0x1d')]||null:null,'include':_0x70fd9a['options']?_0x70fd9a[_0x054c('0x1b')][_0x054c('0x1e')]?_['map'](_0x70fd9a[_0x054c('0x1b')][_0x054c('0x1e')],function(_0x30c34b){return{'model':db[_0x30c34b[_0x054c('0x1f')]],'as':_0x30c34b['as'],'attributes':_0x30c34b[_0x054c('0x1d')],'include':_0x30c34b[_0x054c('0x1e')]?_['map'](_0x30c34b[_0x054c('0x1e')],function(_0x1bc191){return{'model':db[_0x1bc191['model']],'as':_0x1bc191['as'],'attributes':_0x1bc191[_0x054c('0x1d')],'include':_0x1bc191[_0x054c('0x1e')]?_[_0x054c('0x20')](_0x1bc191['include'],function(_0x3862f6){return{'model':db[_0x3862f6[_0x054c('0x1f')]],'as':_0x3862f6['as'],'attributes':_0x3862f6[_0x054c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x054c('0xf')](function(_0x21dd42){logger['info'](_0x054c('0x19'),_0x70fd9a);logger[_0x054c('0x21')](_0x054c('0x19'),_0x70fd9a,JSON[_0x054c('0x13')](_0x21dd42));_0x4f0d96(_0x21dd42);})[_0x054c('0x22')](function(_0x4e0021){logger[_0x054c('0x14')](_0x054c('0x19'),_0x4e0021[_0x054c('0x16')],_0x70fd9a);_0x5ebebc(_0x5c8ee6['error'](0x1f4,_0x4e0021[_0x054c('0x16')]));});});}; \ No newline at end of file +var _0x57ea=['redis','localhost','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSmsAccount','find','options','raw','where','attributes','map','include','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x1c9383,_0x4af635){var _0x12c94b=function(_0x457012){while(--_0x457012){_0x1c9383['push'](_0x1c9383['shift']());}};_0x12c94b(++_0x4af635);}(_0x57ea,0x1ee));var _0xa57e=function(_0x2605dc,_0x50cf7e){_0x2605dc=_0x2605dc-0x0;var _0x4568c9=_0x57ea[_0x2605dc];return _0x4568c9;};'use strict';var _=require(_0xa57e('0x0'));var util=require('util');var moment=require(_0xa57e('0x1'));var BPromise=require(_0xa57e('0x2'));var rs=require(_0xa57e('0x3'));var fs=require('fs');var Redis=require(_0xa57e('0x4'));var db=require(_0xa57e('0x5'))['db'];var utils=require(_0xa57e('0x6'));var logger=require('../../config/logger')(_0xa57e('0x7'));var config=require(_0xa57e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa57e('0x9')]['http']({'port':0x232a});config[_0xa57e('0xa')]=_['defaults'](config[_0xa57e('0xa')],{'host':_0xa57e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa57e('0xa')]));require(_0xa57e('0xc'))[_0xa57e('0xd')](socket);function respondWithRpcPromise(_0x5ce061,_0x5a39aa,_0x6a0183){return new BPromise(function(_0x31202f,_0x3c14ed){return client[_0xa57e('0xe')](_0x5ce061,_0x6a0183)[_0xa57e('0xf')](function(_0x30867d){logger['info'](_0xa57e('0x10'),_0x5a39aa,_0xa57e('0x11'));logger[_0xa57e('0x12')](_0xa57e('0x13'),_0x5a39aa,_0xa57e('0x11'),JSON[_0xa57e('0x14')](_0x30867d));if(_0x30867d['error']){if(_0x30867d[_0xa57e('0x15')][_0xa57e('0x16')]===0x1f4){logger[_0xa57e('0x15')](_0xa57e('0x10'),_0x5a39aa,_0x30867d['error'][_0xa57e('0x17')]);return _0x3c14ed(_0x30867d['error'][_0xa57e('0x17')]);}logger['error'](_0xa57e('0x10'),_0x5a39aa,_0x30867d['error'][_0xa57e('0x17')]);return _0x31202f(_0x30867d['error'][_0xa57e('0x17')]);}else{logger[_0xa57e('0x18')](_0xa57e('0x10'),_0x5a39aa,_0xa57e('0x11'));_0x31202f(_0x30867d[_0xa57e('0x19')][_0xa57e('0x17')]);}})[_0xa57e('0x1a')](function(_0x280386){logger[_0xa57e('0x15')]('SmsAccount,\x20%s,\x20%s',_0x5a39aa,_0x280386);_0x3c14ed(_0x280386);});});}exports[_0xa57e('0x1b')]=function(_0x3d744c){var _0x17f6da=this;return new Promise(function(_0x47279d,_0x48fa7b){return db['SmsAccount'][_0xa57e('0x1c')]({'raw':_0x3d744c['options']?_0x3d744c[_0xa57e('0x1d')][_0xa57e('0x1e')]===undefined?!![]:![]:!![],'where':_0x3d744c['options']?_0x3d744c[_0xa57e('0x1d')][_0xa57e('0x1f')]||null:null,'attributes':_0x3d744c[_0xa57e('0x1d')]?_0x3d744c[_0xa57e('0x1d')][_0xa57e('0x20')]||null:null,'include':_0x3d744c[_0xa57e('0x1d')]?_0x3d744c[_0xa57e('0x1d')]['include']?_[_0xa57e('0x21')](_0x3d744c['options'][_0xa57e('0x22')],function(_0x22dcb7){return{'model':db[_0x22dcb7[_0xa57e('0x23')]],'as':_0x22dcb7['as'],'attributes':_0x22dcb7[_0xa57e('0x20')],'include':_0x22dcb7['include']?_['map'](_0x22dcb7[_0xa57e('0x22')],function(_0x52846b){return{'model':db[_0x52846b[_0xa57e('0x23')]],'as':_0x52846b['as'],'attributes':_0x52846b[_0xa57e('0x20')],'include':_0x52846b[_0xa57e('0x22')]?_[_0xa57e('0x21')](_0x52846b[_0xa57e('0x22')],function(_0x5b3c54){return{'model':db[_0x5b3c54[_0xa57e('0x23')]],'as':_0x5b3c54['as'],'attributes':_0x5b3c54[_0xa57e('0x20')]};}):[]};}):[]};}):[]:[]})[_0xa57e('0xf')](function(_0x484db8){logger[_0xa57e('0x18')](_0xa57e('0x1b'),_0x3d744c);logger[_0xa57e('0x12')](_0xa57e('0x1b'),_0x3d744c,JSON[_0xa57e('0x14')](_0x484db8));_0x47279d(_0x484db8);})[_0xa57e('0x1a')](function(_0x330bbc){logger[_0xa57e('0x15')](_0xa57e('0x1b'),_0x330bbc[_0xa57e('0x17')],_0x3d744c);_0x48fa7b(_0x17f6da[_0xa57e('0x15')](0x1f4,_0x330bbc[_0xa57e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 225a990..66ca8f3 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 _0x8bac=['emit','removeListener','register','length'];(function(_0x41d6ac,_0x2352e6){var _0x28b6c9=function(_0x383aef){while(--_0x383aef){_0x41d6ac['push'](_0x41d6ac['shift']());}};_0x28b6c9(++_0x2352e6);}(_0x8bac,0x110));var _0xc8ba=function(_0x2ef252,_0x1993fe){_0x2ef252=_0x2ef252-0x0;var _0x1139ca=_0x8bac[_0x2ef252];return _0x1139ca;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=['save','remove','update'];function createListener(_0x3edafb,_0x11d545){return function(_0x11b781){_0x11d545[_0xc8ba('0x0')](_0x3edafb,_0x11b781);};}function removeListener(_0x3cdfeb,_0x3df374){return function(){SmsAccountEvents[_0xc8ba('0x1')](_0x3cdfeb,_0x3df374);};}exports[_0xc8ba('0x2')]=function(_0x416a7d){for(var _0x504606=0x0,_0x54f2e2=events[_0xc8ba('0x3')];_0x504606<_0x54f2e2;_0x504606++){var _0x368b2d=events[_0x504606];var _0x3a36f2=createListener('smsAccount:'+_0x368b2d,_0x416a7d);SmsAccountEvents['on'](_0x368b2d,_0x3a36f2);}}; \ No newline at end of file +var _0x2162=['./smsAccount.events','save','register'];(function(_0x591129,_0x4ecb02){var _0x3736cc=function(_0x397b3d){while(--_0x397b3d){_0x591129['push'](_0x591129['shift']());}};_0x3736cc(++_0x4ecb02);}(_0x2162,0x1d1));var _0x2216=function(_0x55e2f4,_0x715c55){_0x55e2f4=_0x55e2f4-0x0;var _0x53e0f3=_0x2162[_0x55e2f4];return _0x53e0f3;};'use strict';var SmsAccountEvents=require(_0x2216('0x0'));var events=[_0x2216('0x1'),'remove','update'];function createListener(_0x3d116c,_0x58197b){return function(_0x5391da){_0x58197b['emit'](_0x3d116c,_0x5391da);};}function removeListener(_0x2785b6,_0x401fbf){return function(){SmsAccountEvents['removeListener'](_0x2785b6,_0x401fbf);};}exports[_0x2216('0x2')]=function(_0x57f66e){for(var _0x193990=0x0,_0x173f80=events['length'];_0x193990<_0x173f80;_0x193990++){var _0x4684ab=events[_0x193990];var _0x330af5=createListener('smsAccount:'+_0x4684ab,_0x57f66e);SmsAccountEvents['on'](_0x4684ab,_0x330af5);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index dba8007..cb1938c 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 _0xcd14=['put','isAuthenticated','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','index','/:id','show','post'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xcd14,0x77));var _0x4cd1=function(_0x4c621d,_0x25bd5d){_0x4c621d=_0x4c621d-0x0;var _0x460311=_0xcd14[_0x4c621d];return _0x460311;};'use strict';var multer=require(_0x4cd1('0x0'));var util=require(_0x4cd1('0x1'));var path=require('path');var timeout=require(_0x4cd1('0x2'));var express=require(_0x4cd1('0x3'));var router=express[_0x4cd1('0x4')]();var auth=require(_0x4cd1('0x5'));var interaction=require(_0x4cd1('0x6'));var config=require(_0x4cd1('0x7'));var controller=require(_0x4cd1('0x8'));router[_0x4cd1('0x9')]('/',auth['isAuthenticated'](),controller[_0x4cd1('0xa')]);router['get'](_0x4cd1('0xb'),auth['isAuthenticated'](),controller[_0x4cd1('0xc')]);router[_0x4cd1('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4cd1('0xe')](_0x4cd1('0xb'),auth[_0x4cd1('0xf')](),controller[_0x4cd1('0x10')]);router[_0x4cd1('0x11')](_0x4cd1('0xb'),auth[_0x4cd1('0xf')](),controller[_0x4cd1('0x12')]);module['exports']=router; \ No newline at end of file +var _0x442d=['path','express','Router','../../components/interaction/service','./smsApplication.controller','get','index','/:id','isAuthenticated','create','put','update','delete','exports'];(function(_0x1f22e0,_0x32e6a1){var _0x31d7ee=function(_0x2c4bb0){while(--_0x2c4bb0){_0x1f22e0['push'](_0x1f22e0['shift']());}};_0x31d7ee(++_0x32e6a1);}(_0x442d,0x126));var _0xd442=function(_0x22cc16,_0x1f4fa2){_0x22cc16=_0x22cc16-0x0;var _0x399b70=_0x442d[_0x22cc16];return _0x399b70;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd442('0x0'));var timeout=require('connect-timeout');var express=require(_0xd442('0x1'));var router=express[_0xd442('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xd442('0x3'));var config=require('../../config/environment');var controller=require(_0xd442('0x4'));router[_0xd442('0x5')]('/',auth['isAuthenticated'](),controller[_0xd442('0x6')]);router['get'](_0xd442('0x7'),auth[_0xd442('0x8')](),controller['show']);router['post']('/',auth[_0xd442('0x8')](),controller[_0xd442('0x9')]);router[_0xd442('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xd442('0xb')]);router[_0xd442('0xc')]('/:id',auth[_0xd442('0x8')](),controller['destroy']);module[_0xd442('0xd')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 141ac16..8bd5eee 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 _0x65a5=['TEXT','exports','STRING','noop'];(function(_0x2b9ff6,_0x3c4bb0){var _0x4ad748=function(_0x58b805){while(--_0x58b805){_0x2b9ff6['push'](_0x2b9ff6['shift']());}};_0x4ad748(++_0x3c4bb0);}(_0x65a5,0x1d5));var _0x565a=function(_0x34ab65,_0x356d84){_0x34ab65=_0x34ab65-0x0;var _0x31532c=_0x65a5[_0x34ab65];return _0x31532c;};'use strict';var Sequelize=require('sequelize');module[_0x565a('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x565a('0x1')],'allowNull':![],'defaultValue':_0x565a('0x2')},'appdata':{'type':Sequelize[_0x565a('0x3')]()},'description':{'type':Sequelize[_0x565a('0x1')]},'interval':{'type':Sequelize[_0x565a('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x8372=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x8372,0xb5));var _0x2837=function(_0x3f8cff,_0x4d2e6e){_0x3f8cff=_0x3f8cff-0x0;var _0x2cf465=_0x8372[_0x3f8cff];return _0x2cf465;};'use strict';var Sequelize=require(_0x2837('0x0'));module[_0x2837('0x1')]={'priority':{'type':Sequelize[_0x2837('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2837('0x3')],'allowNull':![],'defaultValue':_0x2837('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x2837('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x2837('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 606498b..a315a00 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 _0x0abf=['fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','html-pdf','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x2d2ca2,_0x51873f){var _0x48489d=function(_0x1a2cf7){while(--_0x1a2cf7){_0x2d2ca2['push'](_0x2d2ca2['shift']());}};_0x48489d(++_0x51873f);}(_0x0abf,0xe8));var _0xf0ab=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0abf[_0x2b4411];return _0x8e41ef;};'use strict';var pdf=require(_0xf0ab('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf0ab('0x1'));var zipdir=require(_0xf0ab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf0ab('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf0ab('0x4'));var util=require(_0xf0ab('0x5'));var path=require(_0xf0ab('0x6'));var sox=require(_0xf0ab('0x7'));var csv=require(_0xf0ab('0x8'));var ejs=require(_0xf0ab('0x9'));var fs=require('fs');var _=require(_0xf0ab('0xa'));var squel=require('squel');var crypto=require(_0xf0ab('0xb'));var jsforce=require(_0xf0ab('0xc'));var deskjs=require(_0xf0ab('0xd'));var toCsv=require(_0xf0ab('0x8'));var querystring=require('querystring');var Papa=require(_0xf0ab('0xe'));var Redis=require(_0xf0ab('0xf'));var authService=require(_0xf0ab('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0ab('0x11'));var logger=require('../../config/logger')(_0xf0ab('0x12'));var utils=require(_0xf0ab('0x13'));var config=require(_0xf0ab('0x14'));var db=require(_0xf0ab('0x15'))['db'];function respondWithStatusCode(_0x2dc4f8,_0x38ca67){_0x38ca67=_0x38ca67||0xcc;return function(_0x34ccdc){if(_0x34ccdc){return _0x2dc4f8['sendStatus'](_0x38ca67);}return _0x2dc4f8[_0xf0ab('0x16')](_0x38ca67)[_0xf0ab('0x17')]();};}function respondWithResult(_0x1913fe,_0x35c75f){_0x35c75f=_0x35c75f||0xc8;return function(_0x1824ef){if(_0x1824ef){return _0x1913fe[_0xf0ab('0x16')](_0x35c75f)[_0xf0ab('0x18')](_0x1824ef);}};}function respondWithFilteredResult(_0x1fb4e5,_0x180d0b){return function(_0x3c5bfd){if(_0x3c5bfd){var _0x20f453=_0x3c5bfd[_0xf0ab('0x19')],_0x221bac=_0x180d0b['offset'],_0x200cf5=_0x180d0b[_0xf0ab('0x1a')]+_0x180d0b[_0xf0ab('0x1b')],_0x2f4618;if(_0x200cf5>=_0x20f453){_0x200cf5=_0x20f453;_0x2f4618=0xc8;}else{_0x2f4618=0xce;}_0x1fb4e5[_0xf0ab('0x16')](_0x2f4618);return _0x1fb4e5[_0xf0ab('0x1c')](_0xf0ab('0x1d'),_0x221bac+'-'+_0x200cf5+'/'+_0x20f453)[_0xf0ab('0x18')](_0x3c5bfd);}return null;};}function patchUpdates(_0x3a0edf){return function(_0x263e2b){try{jsonpatch[_0xf0ab('0x1e')](_0x263e2b,_0x3a0edf,!![]);}catch(_0x1874a5){return BPromise[_0xf0ab('0x1f')](_0x1874a5);}return _0x263e2b[_0xf0ab('0x20')]();};}function saveUpdates(_0xf43bc4,_0x22a205){return function(_0x2cd961){if(_0x2cd961){return _0x2cd961[_0xf0ab('0x21')](_0xf43bc4)['then'](function(_0x153492){return _0x153492;});}return null;};}function removeEntity(_0x6fa888,_0x1e1483){return function(_0x11ab3a){if(_0x11ab3a){return _0x11ab3a[_0xf0ab('0x22')]()[_0xf0ab('0x23')](function(){_0x6fa888[_0xf0ab('0x16')](0xcc)[_0xf0ab('0x17')]();});}};}function handleEntityNotFound(_0x36ad01,_0x18bb37){return function(_0x43119f){if(!_0x43119f){_0x36ad01['sendStatus'](0x194);}return _0x43119f;};}function handleError(_0x585841,_0x4eee21){_0x4eee21=_0x4eee21||0x1f4;return function(_0x33aaa0){logger['error'](_0x33aaa0[_0xf0ab('0x24')]);if(_0x33aaa0[_0xf0ab('0x25')]){delete _0x33aaa0['name'];}_0x585841[_0xf0ab('0x16')](_0x4eee21)[_0xf0ab('0x26')](_0x33aaa0);};}exports[_0xf0ab('0x27')]=function(_0x38fb71,_0x7d4ff9){var _0x502921={},_0x2d0da7={},_0x574ce7={'count':0x0,'rows':[]};var _0x55d799=_[_0xf0ab('0x28')](db[_0xf0ab('0x29')][_0xf0ab('0x2a')],function(_0x445160){return{'name':_0x445160[_0xf0ab('0x2b')],'type':_0x445160[_0xf0ab('0x2c')][_0xf0ab('0x2d')]};});_0x2d0da7[_0xf0ab('0x2e')]=_[_0xf0ab('0x28')](_0x55d799,_0xf0ab('0x25'));_0x2d0da7[_0xf0ab('0x2f')]=_[_0xf0ab('0x30')](_0x38fb71['query']);_0x2d0da7[_0xf0ab('0x31')]=_[_0xf0ab('0x32')](_0x2d0da7['model'],_0x2d0da7['query']);_0x502921[_0xf0ab('0x33')]=_[_0xf0ab('0x32')](_0x2d0da7[_0xf0ab('0x2e')],qs['fields'](_0x38fb71['query'][_0xf0ab('0x34')]));_0x502921['attributes']=_0x502921[_0xf0ab('0x33')]['length']?_0x502921[_0xf0ab('0x33')]:_0x2d0da7[_0xf0ab('0x2e')];if(!_0x38fb71['query']['hasOwnProperty'](_0xf0ab('0x35'))){_0x502921[_0xf0ab('0x1b')]=qs[_0xf0ab('0x1b')](_0x38fb71[_0xf0ab('0x2f')][_0xf0ab('0x1b')]);_0x502921[_0xf0ab('0x1a')]=qs[_0xf0ab('0x1a')](_0x38fb71[_0xf0ab('0x2f')][_0xf0ab('0x1a')]);}_0x502921[_0xf0ab('0x36')]=qs[_0xf0ab('0x37')](_0x38fb71[_0xf0ab('0x2f')][_0xf0ab('0x37')]);_0x502921[_0xf0ab('0x38')]=qs['filters'](_[_0xf0ab('0x39')](_0x38fb71[_0xf0ab('0x2f')],_0x2d0da7[_0xf0ab('0x31')]),_0x55d799);if(_0x38fb71['query'][_0xf0ab('0x3a')]){_0x502921[_0xf0ab('0x38')]=_[_0xf0ab('0x3b')](_0x502921['where'],{'$or':_[_0xf0ab('0x28')](_0x55d799,function(_0x4fe5c0){if(_0x4fe5c0[_0xf0ab('0x2c')]!=='VIRTUAL'){var _0x4763f7={};_0x4763f7[_0x4fe5c0[_0xf0ab('0x25')]]={'$like':'%'+_0x38fb71[_0xf0ab('0x2f')][_0xf0ab('0x3a')]+'%'};return _0x4763f7;}})});}_0x502921=_[_0xf0ab('0x3b')]({},_0x502921,_0x38fb71[_0xf0ab('0x3c')]);var _0x4e3ade={'where':_0x502921[_0xf0ab('0x38')]};return db[_0xf0ab('0x29')]['count'](_0x4e3ade)[_0xf0ab('0x23')](function(_0xce89bc){_0x574ce7[_0xf0ab('0x19')]=_0xce89bc;if(_0x38fb71[_0xf0ab('0x2f')][_0xf0ab('0x3d')]){_0x502921[_0xf0ab('0x3e')]=[{'all':!![]}];}return db[_0xf0ab('0x29')]['findAll'](_0x502921);})[_0xf0ab('0x23')](function(_0x4f6e93){_0x574ce7[_0xf0ab('0x3f')]=_0x4f6e93;return _0x574ce7;})['then'](respondWithFilteredResult(_0x7d4ff9,_0x502921))[_0xf0ab('0x40')](handleError(_0x7d4ff9,null));};exports[_0xf0ab('0x41')]=function(_0x44077b,_0x32b237){var _0x2b7ed5={'raw':!![],'where':{'id':_0x44077b[_0xf0ab('0x42')]['id']}},_0x553d07={};_0x553d07[_0xf0ab('0x2e')]=_[_0xf0ab('0x30')](db[_0xf0ab('0x29')][_0xf0ab('0x2a')]);_0x553d07[_0xf0ab('0x2f')]=_[_0xf0ab('0x30')](_0x44077b[_0xf0ab('0x2f')]);_0x553d07[_0xf0ab('0x31')]=_[_0xf0ab('0x32')](_0x553d07[_0xf0ab('0x2e')],_0x553d07[_0xf0ab('0x2f')]);_0x2b7ed5[_0xf0ab('0x33')]=_['intersection'](_0x553d07['model'],qs[_0xf0ab('0x34')](_0x44077b['query'][_0xf0ab('0x34')]));_0x2b7ed5[_0xf0ab('0x33')]=_0x2b7ed5['attributes'][_0xf0ab('0x43')]?_0x2b7ed5[_0xf0ab('0x33')]:_0x553d07['model'];if(_0x44077b[_0xf0ab('0x2f')][_0xf0ab('0x3d')]){_0x2b7ed5[_0xf0ab('0x3e')]=[{'all':!![]}];}_0x2b7ed5=_[_0xf0ab('0x3b')]({},_0x2b7ed5,_0x44077b[_0xf0ab('0x3c')]);return db[_0xf0ab('0x29')][_0xf0ab('0x44')](_0x2b7ed5)[_0xf0ab('0x23')](handleEntityNotFound(_0x32b237,null))[_0xf0ab('0x23')](respondWithResult(_0x32b237,null))[_0xf0ab('0x40')](handleError(_0x32b237,null));};exports[_0xf0ab('0x45')]=function(_0x302510,_0x13b477){return db[_0xf0ab('0x29')]['create'](_0x302510['body'],{})[_0xf0ab('0x23')](respondWithResult(_0x13b477,0xc9))['catch'](handleError(_0x13b477,null));};exports['update']=function(_0x4e57d3,_0xc3b68d){if(_0x4e57d3[_0xf0ab('0x46')]['id']){delete _0x4e57d3[_0xf0ab('0x46')]['id'];}return db[_0xf0ab('0x29')][_0xf0ab('0x44')]({'where':{'id':_0x4e57d3[_0xf0ab('0x42')]['id']}})[_0xf0ab('0x23')](handleEntityNotFound(_0xc3b68d,null))[_0xf0ab('0x23')](saveUpdates(_0x4e57d3[_0xf0ab('0x46')],null))[_0xf0ab('0x23')](respondWithResult(_0xc3b68d,null))[_0xf0ab('0x40')](handleError(_0xc3b68d,null));};exports[_0xf0ab('0x22')]=function(_0x4e6c9b,_0x393c9a){return db[_0xf0ab('0x29')][_0xf0ab('0x44')]({'where':{'id':_0x4e6c9b[_0xf0ab('0x42')]['id']}})[_0xf0ab('0x23')](handleEntityNotFound(_0x393c9a,null))[_0xf0ab('0x23')](removeEntity(_0x393c9a,null))[_0xf0ab('0x40')](handleError(_0x393c9a,null));}; \ No newline at end of file +var _0x25e7=['send','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','count','includeAll','SmsApplication','findAll','catch','show','length','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name'];(function(_0x113573,_0x4f8649){var _0x31601a=function(_0x33ab51){while(--_0x33ab51){_0x113573['push'](_0x113573['shift']());}};_0x31601a(++_0x4f8649);}(_0x25e7,0x1d6));var _0x725e=function(_0x23f2a7,_0x3bc14f){_0x23f2a7=_0x23f2a7-0x0;var _0x547933=_0x25e7[_0x23f2a7];return _0x547933;};'use strict';var pdf=require(_0x725e('0x0'));var emlformat=require(_0x725e('0x1'));var rimraf=require(_0x725e('0x2'));var zipdir=require(_0x725e('0x3'));var jsonpatch=require(_0x725e('0x4'));var rp=require(_0x725e('0x5'));var moment=require(_0x725e('0x6'));var BPromise=require(_0x725e('0x7'));var Mustache=require(_0x725e('0x8'));var util=require(_0x725e('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0x725e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x725e('0xb'));var crypto=require(_0x725e('0xc'));var jsforce=require(_0x725e('0xd'));var deskjs=require(_0x725e('0xe'));var toCsv=require(_0x725e('0xa'));var querystring=require(_0x725e('0xf'));var Papa=require(_0x725e('0x10'));var Redis=require(_0x725e('0x11'));var authService=require(_0x725e('0x12'));var qs=require(_0x725e('0x13'));var as=require(_0x725e('0x14'));var hardwareService=require(_0x725e('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x725e('0x16'));var config=require(_0x725e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bdf3a,_0x11916d){_0x11916d=_0x11916d||0xcc;return function(_0x14218e){if(_0x14218e){return _0x5bdf3a['sendStatus'](_0x11916d);}return _0x5bdf3a[_0x725e('0x18')](_0x11916d)[_0x725e('0x19')]();};}function respondWithResult(_0x2f1ae4,_0x4e0515){_0x4e0515=_0x4e0515||0xc8;return function(_0x3f8052){if(_0x3f8052){return _0x2f1ae4[_0x725e('0x18')](_0x4e0515)[_0x725e('0x1a')](_0x3f8052);}};}function respondWithFilteredResult(_0x2e78d2,_0x24c3c1){return function(_0x13fbfe){if(_0x13fbfe){var _0x523422=_0x13fbfe['count'],_0x156b99=_0x24c3c1[_0x725e('0x1b')],_0x268312=_0x24c3c1[_0x725e('0x1b')]+_0x24c3c1[_0x725e('0x1c')],_0x297bb7;if(_0x268312>=_0x523422){_0x268312=_0x523422;_0x297bb7=0xc8;}else{_0x297bb7=0xce;}_0x2e78d2[_0x725e('0x18')](_0x297bb7);return _0x2e78d2[_0x725e('0x1d')](_0x725e('0x1e'),_0x156b99+'-'+_0x268312+'/'+_0x523422)['json'](_0x13fbfe);}return null;};}function patchUpdates(_0x22fba5){return function(_0x3ec8b3){try{jsonpatch[_0x725e('0x1f')](_0x3ec8b3,_0x22fba5,!![]);}catch(_0x338a1d){return BPromise[_0x725e('0x20')](_0x338a1d);}return _0x3ec8b3[_0x725e('0x21')]();};}function saveUpdates(_0x540802,_0x2fc416){return function(_0xd30de9){if(_0xd30de9){return _0xd30de9[_0x725e('0x22')](_0x540802)[_0x725e('0x23')](function(_0x63193e){return _0x63193e;});}return null;};}function removeEntity(_0x251328,_0x127c99){return function(_0x262b01){if(_0x262b01){return _0x262b01[_0x725e('0x24')]()['then'](function(){_0x251328[_0x725e('0x18')](0xcc)[_0x725e('0x19')]();});}};}function handleEntityNotFound(_0x389668,_0x3facae){return function(_0x5a8191){if(!_0x5a8191){_0x389668[_0x725e('0x25')](0x194);}return _0x5a8191;};}function handleError(_0x5268c8,_0x49a3a6){_0x49a3a6=_0x49a3a6||0x1f4;return function(_0x4e6b3e){logger[_0x725e('0x26')](_0x4e6b3e[_0x725e('0x27')]);if(_0x4e6b3e[_0x725e('0x28')]){delete _0x4e6b3e['name'];}_0x5268c8[_0x725e('0x18')](_0x49a3a6)[_0x725e('0x29')](_0x4e6b3e);};}exports['index']=function(_0x14e9e0,_0x339a58){var _0x4b0d0c={},_0x378ace={},_0x5daa2d={'count':0x0,'rows':[]};var _0x561656=_[_0x725e('0x2a')](db['SmsApplication'][_0x725e('0x2b')],function(_0x4cc4ad){return{'name':_0x4cc4ad['fieldName'],'type':_0x4cc4ad[_0x725e('0x2c')][_0x725e('0x2d')]};});_0x378ace[_0x725e('0x2e')]=_['map'](_0x561656,_0x725e('0x28'));_0x378ace['query']=_[_0x725e('0x2f')](_0x14e9e0[_0x725e('0x30')]);_0x378ace[_0x725e('0x31')]=_[_0x725e('0x32')](_0x378ace[_0x725e('0x2e')],_0x378ace[_0x725e('0x30')]);_0x4b0d0c[_0x725e('0x33')]=_[_0x725e('0x32')](_0x378ace[_0x725e('0x2e')],qs[_0x725e('0x34')](_0x14e9e0[_0x725e('0x30')]['fields']));_0x4b0d0c[_0x725e('0x33')]=_0x4b0d0c[_0x725e('0x33')]['length']?_0x4b0d0c[_0x725e('0x33')]:_0x378ace['model'];if(!_0x14e9e0[_0x725e('0x30')]['hasOwnProperty'](_0x725e('0x35'))){_0x4b0d0c[_0x725e('0x1c')]=qs[_0x725e('0x1c')](_0x14e9e0[_0x725e('0x30')][_0x725e('0x1c')]);_0x4b0d0c[_0x725e('0x1b')]=qs['offset'](_0x14e9e0['query'][_0x725e('0x1b')]);}_0x4b0d0c[_0x725e('0x36')]=qs[_0x725e('0x37')](_0x14e9e0['query'][_0x725e('0x37')]);_0x4b0d0c['where']=qs[_0x725e('0x31')](_[_0x725e('0x38')](_0x14e9e0[_0x725e('0x30')],_0x378ace[_0x725e('0x31')]),_0x561656);if(_0x14e9e0['query']['filter']){_0x4b0d0c[_0x725e('0x39')]=_[_0x725e('0x3a')](_0x4b0d0c[_0x725e('0x39')],{'$or':_['map'](_0x561656,function(_0x172fe){if(_0x172fe[_0x725e('0x2c')]!==_0x725e('0x3b')){var _0x4b4380={};_0x4b4380[_0x172fe[_0x725e('0x28')]]={'$like':'%'+_0x14e9e0['query'][_0x725e('0x3c')]+'%'};return _0x4b4380;}})});}_0x4b0d0c=_[_0x725e('0x3a')]({},_0x4b0d0c,_0x14e9e0[_0x725e('0x3d')]);var _0x46a0de={'where':_0x4b0d0c[_0x725e('0x39')]};return db['SmsApplication']['count'](_0x46a0de)[_0x725e('0x23')](function(_0x253caa){_0x5daa2d[_0x725e('0x3e')]=_0x253caa;if(_0x14e9e0['query'][_0x725e('0x3f')]){_0x4b0d0c['include']=[{'all':!![]}];}return db[_0x725e('0x40')][_0x725e('0x41')](_0x4b0d0c);})[_0x725e('0x23')](function(_0x3a29ae){_0x5daa2d['rows']=_0x3a29ae;return _0x5daa2d;})[_0x725e('0x23')](respondWithFilteredResult(_0x339a58,_0x4b0d0c))[_0x725e('0x42')](handleError(_0x339a58,null));};exports[_0x725e('0x43')]=function(_0x4366bc,_0x1ec4fe){var _0x19ed0a={'raw':!![],'where':{'id':_0x4366bc['params']['id']}},_0x3e5460={};_0x3e5460[_0x725e('0x2e')]=_[_0x725e('0x2f')](db['SmsApplication'][_0x725e('0x2b')]);_0x3e5460[_0x725e('0x30')]=_['keys'](_0x4366bc['query']);_0x3e5460['filters']=_['intersection'](_0x3e5460[_0x725e('0x2e')],_0x3e5460[_0x725e('0x30')]);_0x19ed0a[_0x725e('0x33')]=_['intersection'](_0x3e5460[_0x725e('0x2e')],qs['fields'](_0x4366bc['query'][_0x725e('0x34')]));_0x19ed0a[_0x725e('0x33')]=_0x19ed0a[_0x725e('0x33')][_0x725e('0x44')]?_0x19ed0a[_0x725e('0x33')]:_0x3e5460[_0x725e('0x2e')];if(_0x4366bc['query'][_0x725e('0x3f')]){_0x19ed0a['include']=[{'all':!![]}];}_0x19ed0a=_[_0x725e('0x3a')]({},_0x19ed0a,_0x4366bc[_0x725e('0x3d')]);return db['SmsApplication'][_0x725e('0x45')](_0x19ed0a)['then'](handleEntityNotFound(_0x1ec4fe,null))[_0x725e('0x23')](respondWithResult(_0x1ec4fe,null))[_0x725e('0x42')](handleError(_0x1ec4fe,null));};exports['create']=function(_0x5ae92c,_0xd323d4){return db['SmsApplication'][_0x725e('0x46')](_0x5ae92c['body'],{})['then'](respondWithResult(_0xd323d4,0xc9))['catch'](handleError(_0xd323d4,null));};exports[_0x725e('0x22')]=function(_0x38a81f,_0x4a4b6b){if(_0x38a81f[_0x725e('0x47')]['id']){delete _0x38a81f[_0x725e('0x47')]['id'];}return db['SmsApplication'][_0x725e('0x45')]({'where':{'id':_0x38a81f[_0x725e('0x48')]['id']}})[_0x725e('0x23')](handleEntityNotFound(_0x4a4b6b,null))[_0x725e('0x23')](saveUpdates(_0x38a81f[_0x725e('0x47')],null))[_0x725e('0x23')](respondWithResult(_0x4a4b6b,null))[_0x725e('0x42')](handleError(_0x4a4b6b,null));};exports[_0x725e('0x24')]=function(_0x432285,_0x3fdbfd){return db[_0x725e('0x40')][_0x725e('0x45')]({'where':{'id':_0x432285[_0x725e('0x48')]['id']}})['then'](handleEntityNotFound(_0x3fdbfd,null))[_0x725e('0x23')](removeEntity(_0x3fdbfd,null))['catch'](handleError(_0x3fdbfd,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 1fd9c1f..0768695 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 _0x8ec5=['path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','sms_applications','utf8mb4','lodash','util','../../config/logger'];(function(_0x2d8794,_0x2ad9b9){var _0x4a9bb0=function(_0x388ca5){while(--_0x388ca5){_0x2d8794['push'](_0x2d8794['shift']());}};_0x4a9bb0(++_0x2ad9b9);}(_0x8ec5,0x1aa));var _0x58ec=function(_0x21fd60,_0x159387){_0x21fd60=_0x21fd60-0x0;var _0x3e9b6d=_0x8ec5[_0x21fd60];return _0x3e9b6d;};'use strict';var _=require(_0x58ec('0x0'));var util=require(_0x58ec('0x1'));var logger=require(_0x58ec('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x58ec('0x3'));var rimraf=require(_0x58ec('0x4'));var config=require(_0x58ec('0x5'));var attributes=require(_0x58ec('0x6'));module[_0x58ec('0x7')]=function(_0x397b84,_0x67f9cd){return _0x397b84[_0x58ec('0x8')]('SmsApplication',attributes,{'tableName':_0x58ec('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x58ec('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x46a3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','lodash','util','../../config/logger','api'];(function(_0x5c63c8,_0x2496cd){var _0x11d213=function(_0x55e2cd){while(--_0x55e2cd){_0x5c63c8['push'](_0x5c63c8['shift']());}};_0x11d213(++_0x2496cd);}(_0x46a3,0x83));var _0x346a=function(_0x5ab089,_0x1365f8){_0x5ab089=_0x5ab089-0x0;var _0x3ea4e4=_0x46a3[_0x5ab089];return _0x3ea4e4;};'use strict';var _=require(_0x346a('0x0'));var util=require(_0x346a('0x1'));var logger=require(_0x346a('0x2'))(_0x346a('0x3'));var moment=require(_0x346a('0x4'));var BPromise=require(_0x346a('0x5'));var rp=require(_0x346a('0x6'));var fs=require('fs');var path=require(_0x346a('0x7'));var rimraf=require(_0x346a('0x8'));var config=require(_0x346a('0x9'));var attributes=require(_0x346a('0xa'));module[_0x346a('0xb')]=function(_0x185dc2,_0x1e410c){return _0x185dc2[_0x346a('0xc')](_0x346a('0xd'),attributes,{'tableName':_0x346a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index c9e4777..5d3d513 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 _0x7579=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x35289d,_0x230ce7){var _0x2dec71=function(_0x391feb){while(--_0x391feb){_0x35289d['push'](_0x35289d['shift']());}};_0x2dec71(++_0x230ce7);}(_0x7579,0x1e2));var _0x9757=function(_0x3f4fa2,_0x5906d3){_0x3f4fa2=_0x3f4fa2-0x0;var _0x109bbe=_0x7579[_0x3f4fa2];return _0x109bbe;};'use strict';var _=require(_0x9757('0x0'));var util=require(_0x9757('0x1'));var moment=require(_0x9757('0x2'));var BPromise=require(_0x9757('0x3'));var rs=require(_0x9757('0x4'));var fs=require('fs');var Redis=require(_0x9757('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9757('0x6'));var logger=require(_0x9757('0x7'))(_0x9757('0x8'));var config=require(_0x9757('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9757('0xa')][_0x9757('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4757e9,_0x4b5446,_0x28a14a){return new BPromise(function(_0x51a1c8,_0x2d65dd){return client[_0x9757('0xc')](_0x4757e9,_0x28a14a)[_0x9757('0xd')](function(_0x5b5749){logger[_0x9757('0xe')](_0x9757('0xf'),_0x4b5446,_0x9757('0x10'));logger[_0x9757('0x11')](_0x9757('0x12'),_0x4b5446,_0x9757('0x10'),JSON[_0x9757('0x13')](_0x5b5749));if(_0x5b5749[_0x9757('0x14')]){if(_0x5b5749[_0x9757('0x14')][_0x9757('0x15')]===0x1f4){logger[_0x9757('0x14')]('SmsApplication,\x20%s,\x20%s',_0x4b5446,_0x5b5749[_0x9757('0x14')][_0x9757('0x16')]);return _0x2d65dd(_0x5b5749[_0x9757('0x14')]['message']);}logger[_0x9757('0x14')](_0x9757('0xf'),_0x4b5446,_0x5b5749[_0x9757('0x14')][_0x9757('0x16')]);return _0x51a1c8(_0x5b5749[_0x9757('0x14')][_0x9757('0x16')]);}else{logger[_0x9757('0xe')]('SmsApplication,\x20%s,\x20%s',_0x4b5446,_0x9757('0x10'));_0x51a1c8(_0x5b5749['result'][_0x9757('0x16')]);}})[_0x9757('0x17')](function(_0xad2a22){logger[_0x9757('0x14')](_0x9757('0xf'),_0x4b5446,_0xad2a22);_0x2d65dd(_0xad2a22);});});} \ No newline at end of file +var _0xeb0d=['SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x349148,_0x31eabb){var _0x2f2b0f=function(_0x44726e){while(--_0x44726e){_0x349148['push'](_0x349148['shift']());}};_0x2f2b0f(++_0x31eabb);}(_0xeb0d,0xe2));var _0xdeb0=function(_0x533984,_0x55d0c4){_0x533984=_0x533984-0x0;var _0x533873=_0xeb0d[_0x533984];return _0x533873;};'use strict';var _=require(_0xdeb0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdeb0('0x1'));var fs=require('fs');var Redis=require(_0xdeb0('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xdeb0('0x3'));var logger=require(_0xdeb0('0x4'))(_0xdeb0('0x5'));var config=require(_0xdeb0('0x6'));var jayson=require(_0xdeb0('0x7'));var client=jayson[_0xdeb0('0x8')][_0xdeb0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27ebaa,_0x55ffce,_0x28a1a4){return new BPromise(function(_0x16b36b,_0x541d8b){return client[_0xdeb0('0xa')](_0x27ebaa,_0x28a1a4)[_0xdeb0('0xb')](function(_0x3336a6){logger[_0xdeb0('0xc')](_0xdeb0('0xd'),_0x55ffce,_0xdeb0('0xe'));logger[_0xdeb0('0xf')](_0xdeb0('0x10'),_0x55ffce,'request\x20sent',JSON['stringify'](_0x3336a6));if(_0x3336a6[_0xdeb0('0x11')]){if(_0x3336a6['error'][_0xdeb0('0x12')]===0x1f4){logger[_0xdeb0('0x11')](_0xdeb0('0xd'),_0x55ffce,_0x3336a6[_0xdeb0('0x11')][_0xdeb0('0x13')]);return _0x541d8b(_0x3336a6[_0xdeb0('0x11')][_0xdeb0('0x13')]);}logger[_0xdeb0('0x11')](_0xdeb0('0xd'),_0x55ffce,_0x3336a6['error'][_0xdeb0('0x13')]);return _0x16b36b(_0x3336a6[_0xdeb0('0x11')][_0xdeb0('0x13')]);}else{logger[_0xdeb0('0xc')](_0xdeb0('0xd'),_0x55ffce,'request\x20sent');_0x16b36b(_0x3336a6[_0xdeb0('0x14')]['message']);}})[_0xdeb0('0x15')](function(_0x473fb9){logger[_0xdeb0('0x11')]('SmsApplication,\x20%s,\x20%s',_0x55ffce,_0x473fb9);_0x541d8b(_0x473fb9);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 524791d..557c89c 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 _0x554e=['isAuthenticated','index','get','describe','/:id','show','getMessages','/:id/download','post','create','/:id/messages','addMessage','/:id/tags','addTags','put','sms','update','delete','tracked','smsinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller'];(function(_0x5a56cc,_0x29650c){var _0x589caa=function(_0x1e3ce5){while(--_0x1e3ce5){_0x5a56cc['push'](_0x5a56cc['shift']());}};_0x589caa(++_0x29650c);}(_0x554e,0xb6));var _0xe554=function(_0x33df84,_0x5825d1){_0x33df84=_0x33df84-0x0;var _0x42e95e=_0x554e[_0x33df84];return _0x42e95e;};'use strict';var multer=require(_0xe554('0x0'));var util=require(_0xe554('0x1'));var path=require(_0xe554('0x2'));var timeout=require(_0xe554('0x3'));var express=require(_0xe554('0x4'));var router=express[_0xe554('0x5')]();var auth=require(_0xe554('0x6'));var interaction=require(_0xe554('0x7'));var config=require(_0xe554('0x8'));var controller=require(_0xe554('0x9'));router['get']('/',auth[_0xe554('0xa')](),controller[_0xe554('0xb')]);router[_0xe554('0xc')]('/describe',auth[_0xe554('0xa')](),controller[_0xe554('0xd')]);router[_0xe554('0xc')](_0xe554('0xe'),auth['isAuthenticated'](),controller[_0xe554('0xf')]);router[_0xe554('0xc')]('/:id/messages',auth[_0xe554('0xa')](),controller[_0xe554('0x10')]);router[_0xe554('0xc')](_0xe554('0x11'),auth['isAuthenticated'](),controller['download']);router[_0xe554('0x12')]('/',auth[_0xe554('0xa')](),controller[_0xe554('0x13')]);router['post'](_0xe554('0x14'),auth[_0xe554('0xa')](),controller[_0xe554('0x15')]);router[_0xe554('0x12')](_0xe554('0x16'),auth[_0xe554('0xa')](),interaction['tracked']('sms','smsinteraction:addtags'),controller[_0xe554('0x17')]);router[_0xe554('0x18')](_0xe554('0xe'),auth[_0xe554('0xa')](),interaction['tracked'](_0xe554('0x19'),'smsinteraction:update'),controller[_0xe554('0x1a')]);router[_0xe554('0x1b')](_0xe554('0xe'),auth[_0xe554('0xa')](),interaction[_0xe554('0x1c')]('sms',_0xe554('0x1d')),controller['destroy']);router[_0xe554('0x1b')](_0xe554('0x16'),auth[_0xe554('0xa')](),controller[_0xe554('0x1e')]);module[_0xe554('0x1f')]=router; \ No newline at end of file +var _0x30cb=['/:id/download','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x30cb,0x1f1));var _0xb30c=function(_0x4618c5,_0x458d6e){_0x4618c5=_0x4618c5-0x0;var _0x1e63f0=_0x30cb[_0x4618c5];return _0x1e63f0;};'use strict';var multer=require(_0xb30c('0x0'));var util=require(_0xb30c('0x1'));var path=require(_0xb30c('0x2'));var timeout=require(_0xb30c('0x3'));var express=require(_0xb30c('0x4'));var router=express['Router']();var auth=require(_0xb30c('0x5'));var interaction=require(_0xb30c('0x6'));var config=require(_0xb30c('0x7'));var controller=require('./smsInteraction.controller');router[_0xb30c('0x8')]('/',auth[_0xb30c('0x9')](),controller[_0xb30c('0xa')]);router[_0xb30c('0x8')](_0xb30c('0xb'),auth[_0xb30c('0x9')](),controller[_0xb30c('0xc')]);router[_0xb30c('0x8')](_0xb30c('0xd'),auth[_0xb30c('0x9')](),controller[_0xb30c('0xe')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0xb30c('0x8')](_0xb30c('0xf'),auth[_0xb30c('0x9')](),controller[_0xb30c('0x10')]);router[_0xb30c('0x11')]('/',auth['isAuthenticated'](),controller[_0xb30c('0x12')]);router[_0xb30c('0x11')]('/:id/messages',auth['isAuthenticated'](),controller[_0xb30c('0x13')]);router[_0xb30c('0x11')](_0xb30c('0x14'),auth[_0xb30c('0x9')](),interaction[_0xb30c('0x15')](_0xb30c('0x16'),_0xb30c('0x17')),controller[_0xb30c('0x18')]);router[_0xb30c('0x19')]('/:id',auth['isAuthenticated'](),interaction[_0xb30c('0x15')](_0xb30c('0x16'),_0xb30c('0x1a')),controller['update']);router[_0xb30c('0x1b')]('/:id',auth['isAuthenticated'](),interaction[_0xb30c('0x15')]('sms',_0xb30c('0x1c')),controller[_0xb30c('0x1d')]);router['delete'](_0xb30c('0x14'),auth[_0xb30c('0x9')](),controller[_0xb30c('0x1e')]);module[_0xb30c('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 611ffcc..d6df925 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 _0x757a=['moment','exports','STRING','DATE','ENUM','out'];(function(_0x48b819,_0x5159df){var _0x16b470=function(_0x46083e){while(--_0x46083e){_0x48b819['push'](_0x48b819['shift']());}};_0x16b470(++_0x5159df);}(_0x757a,0xde));var _0xa757=function(_0x345c26,_0x2a24e6){_0x345c26=_0x345c26-0x0;var _0x16e37f=_0x757a[_0x345c26];return _0x16e37f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa757('0x0'));module[_0xa757('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa757('0x2')]},'phone':{'type':Sequelize[_0xa757('0x2')]},'read1stAt':{'type':Sequelize[_0xa757('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa757('0x4')]('in',_0xa757('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa757('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa757('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xd8b0=['moment','STRING','DATE','ENUM','out','sequelize'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0d8b('0x2')]},'note':{'type':Sequelize[_0x0d8b('0x2')]},'phone':{'type':Sequelize[_0x0d8b('0x2')]},'read1stAt':{'type':Sequelize[_0x0d8b('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0d8b('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x0d8b('0x4')]('in',_0x0d8b('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 1d4f64f..bf0bdb2 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 _0xbf6e=['i.SmsAccountId\x20IS\x20NOT\x20NULL','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','rows','show','rawAttributes','includeAll','include','merge','options','create','params','describe','SmsMessage','addMessage','ids','omit','getMessages','findOne','$gte','findAll','addTags','setTags','smsInteractionTags:save','removeTags','unix','join','root','server','tmp','files','attachments','format','transcript-%d-%s.zip','CmContact','Contact','Messages','direction','secret','SmsAccount','get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','Account','Owner','fullname','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','out','System','lastName','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','download','log','err','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','map','TagIds','Tags','split','catch','index','SmsInteraction','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.SmsInteractionId','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','some','compact','isEmpty','where','i.SmsAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','getFullTextValue','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','SmsAccountId','journey'];(function(_0x265003,_0xf0f023){var _0x33c743=function(_0x326a5d){while(--_0x326a5d){_0x265003['push'](_0x265003['shift']());}};_0x33c743(++_0xf0f023);}(_0xbf6e,0x149));var _0xebf6=function(_0x37b9f7,_0x33e9a1){_0x37b9f7=_0x37b9f7-0x0;var _0x311feb=_0xbf6e[_0x37b9f7];return _0x311feb;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xebf6('0x0'));var zipdir=require(_0xebf6('0x1'));var jsonpatch=require(_0xebf6('0x2'));var rp=require(_0xebf6('0x3'));var moment=require(_0xebf6('0x4'));var BPromise=require(_0xebf6('0x5'));var Mustache=require(_0xebf6('0x6'));var util=require('util');var path=require(_0xebf6('0x7'));var sox=require(_0xebf6('0x8'));var csv=require(_0xebf6('0x9'));var ejs=require(_0xebf6('0xa'));var fs=require('fs');var _=require(_0xebf6('0xb'));var squel=require(_0xebf6('0xc'));var crypto=require(_0xebf6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xebf6('0xe'));var toCsv=require(_0xebf6('0x9'));var querystring=require(_0xebf6('0xf'));var Papa=require('papaparse');var Redis=require(_0xebf6('0x10'));var authService=require(_0xebf6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xebf6('0x12'));var hardwareService=require(_0xebf6('0x13'));var logger=require(_0xebf6('0x14'))(_0xebf6('0x15'));var utils=require(_0xebf6('0x16'));var config=require(_0xebf6('0x17'));var db=require('../../mysqldb')['db'];config[_0xebf6('0x18')]=_[_0xebf6('0x19')](config['redis'],{'host':_0xebf6('0x1a'),'port':0x18eb});var socket=require(_0xebf6('0x1b'))(new Redis(config[_0xebf6('0x18')]));require(_0xebf6('0x1c'))[_0xebf6('0x1d')](socket);function respondWithStatusCode(_0x4dbf51,_0x4c01f4){_0x4c01f4=_0x4c01f4||0xcc;return function(_0x56b8f8){if(_0x56b8f8){return _0x4dbf51[_0xebf6('0x1e')](_0x4c01f4);}return _0x4dbf51[_0xebf6('0x1f')](_0x4c01f4)['end']();};}function respondWithResult(_0x35570e,_0x2c980f){_0x2c980f=_0x2c980f||0xc8;return function(_0xb164a1){if(_0xb164a1){return _0x35570e[_0xebf6('0x1f')](_0x2c980f)[_0xebf6('0x20')](_0xb164a1);}};}function respondWithFilteredResult(_0x13f495,_0x219621){return function(_0x2dc96f){if(_0x2dc96f){var _0x2d3984=_0x2dc96f[_0xebf6('0x21')],_0x308480=_0x219621[_0xebf6('0x22')],_0x55fa31=_0x219621[_0xebf6('0x22')]+_0x219621[_0xebf6('0x23')],_0x496dea;if(_0x55fa31>=_0x2d3984){_0x55fa31=_0x2d3984;_0x496dea=0xc8;}else{_0x496dea=0xce;}_0x13f495[_0xebf6('0x1f')](_0x496dea);return _0x13f495[_0xebf6('0x24')](_0xebf6('0x25'),_0x308480+'-'+_0x55fa31+'/'+_0x2d3984)[_0xebf6('0x20')](_0x2dc96f);}return null;};}function patchUpdates(_0x4fb497){return function(_0xbe39dd){try{jsonpatch[_0xebf6('0x26')](_0xbe39dd,_0x4fb497,!![]);}catch(_0x377934){return BPromise[_0xebf6('0x27')](_0x377934);}return _0xbe39dd[_0xebf6('0x28')]();};}function saveUpdates(_0x14c8ac,_0x2f419e){return function(_0xfce30a){if(_0xfce30a){return _0xfce30a[_0xebf6('0x29')](_0x14c8ac)[_0xebf6('0x2a')](function(_0x232074){return _0x232074;});}return null;};}function removeEntity(_0x2dd2ed,_0x43c4e2){return function(_0x3b8bc1){if(_0x3b8bc1){return _0x3b8bc1[_0xebf6('0x2b')]()[_0xebf6('0x2a')](function(){_0x2dd2ed[_0xebf6('0x1f')](0xcc)[_0xebf6('0x2c')]();});}};}function handleEntityNotFound(_0x3b58cb,_0x4dadf7){return function(_0x58fb66){if(!_0x58fb66){_0x3b58cb[_0xebf6('0x1e')](0x194);}return _0x58fb66;};}function handleError(_0x4dc5be,_0x230d84){_0x230d84=_0x230d84||0x1f4;return function(_0x430eb7){logger['error'](_0x430eb7['stack']);if(_0x430eb7[_0xebf6('0x2d')]){delete _0x430eb7[_0xebf6('0x2d')];}_0x4dc5be[_0xebf6('0x1f')](_0x230d84)[_0xebf6('0x2e')](_0x430eb7);};}function getInteractionUsers(_0xedaaeb,_0x2dc0cf){return new BPromise(function(_0x7976d,_0x7551ce){try{if(_0x2dc0cf[_0xedaaeb['id']]){_0xedaaeb['Users']=_[_0xebf6('0x2f')](_0x2dc0cf[_0xedaaeb['id']],function(_0x78cdf0){return{'id':_0x78cdf0['id'],'fullname':_0x78cdf0['fullname']};});}}catch(_0x2fe3ee){_0x7551ce(_0x2fe3ee);}_0x7976d(_0xedaaeb);});}function getInteractionTags(_0x28bbea,_0x5ea6b2){return new BPromise(function(_0x2901fc,_0x1fa407){try{if(_0x28bbea[_0xebf6('0x30')]){_0x28bbea[_0xebf6('0x31')]=[];_0x28bbea[_0xebf6('0x30')][_0xebf6('0x32')](',')['forEach'](function(_0x3818c9){_0x28bbea[_0xebf6('0x31')]['push'](_0x5ea6b2[_0x3818c9]);});}delete _0x28bbea['TagIds'];}catch(_0x2ab7a0){_0x1fa407(_0x2ab7a0);}_0x2901fc(_0x28bbea);});}function updateSmsInteraction(_0x36761f,_0x569be3,_0x18a284){return new BPromise(function(_0x113ef8,_0x4d736c){return getInteractionUsers(_0x36761f,_0x18a284)[_0xebf6('0x2a')](function(_0x30c305){return getInteractionTags(_0x30c305,_0x569be3);})[_0xebf6('0x2a')](function(_0x4f9127){_0x113ef8(_0x4f9127);})[_0xebf6('0x33')](function(_0x20192c){_0x4d736c(_0x20192c);});});}exports[_0xebf6('0x34')]=function(_0x436710,_0x4b6d95){var _0x568994={},_0x262af2={},_0x46ef2d={'count':0x0,'rows':[]};var _0x562f76=_[_0xebf6('0x2f')](db[_0xebf6('0x35')]['rawAttributes'],function(_0xf8bac7){return{'name':_0xf8bac7[_0xebf6('0x36')],'type':_0xf8bac7[_0xebf6('0x37')][_0xebf6('0x38')]};});_0x262af2[_0xebf6('0x39')]=_['map'](_0x562f76,_0xebf6('0x2d'));_0x262af2['query']=_[_0xebf6('0x3a')](_0x436710['query']);_0x262af2[_0xebf6('0x3b')]=_[_0xebf6('0x3c')](_0x262af2[_0xebf6('0x39')],_0x262af2[_0xebf6('0x3d')]);_0x568994[_0xebf6('0x3e')]=_[_0xebf6('0x3c')](_0x262af2['model'],qs[_0xebf6('0x3f')](_0x436710[_0xebf6('0x3d')][_0xebf6('0x3f')]));_0x568994[_0xebf6('0x3e')]=_0x568994[_0xebf6('0x3e')][_0xebf6('0x40')]?_0x568994['attributes']:_0x262af2[_0xebf6('0x39')];if(!_0x436710[_0xebf6('0x3d')][_0xebf6('0x41')](_0xebf6('0x42'))){_0x568994[_0xebf6('0x23')]=qs[_0xebf6('0x23')](_0x436710['query']['limit']);_0x568994['offset']=qs[_0xebf6('0x22')](_0x436710[_0xebf6('0x3d')][_0xebf6('0x22')]);}_0x568994['order']=qs[_0xebf6('0x43')](_0x436710[_0xebf6('0x3d')][_0xebf6('0x43')]);_0x568994['where']=qs[_0xebf6('0x3b')](_[_0xebf6('0x44')](_0x436710['query'],_0x262af2[_0xebf6('0x3b')]),_0x562f76);var _0x1de50e=[];var _0x17c4af=squel['select']()[_0xebf6('0x45')]('id')['field']('name')[_0xebf6('0x45')](_0xebf6('0x46'))[_0xebf6('0x47')](_0xebf6('0x48'));var _0x4fd568=squel[_0xebf6('0x49')]()['field'](_0xebf6('0x4a'))[_0xebf6('0x45')](_0xebf6('0x4b'))[_0xebf6('0x45')](_0xebf6('0x4c'))['from']('user_has_sms_interactions','ui')[_0xebf6('0x4d')](_0xebf6('0x4e'),'u',_0xebf6('0x4f'));var _0x39d153=squel['select']()[_0xebf6('0x47')](_0xebf6('0x50'),'i')[_0xebf6('0x4d')](_0xebf6('0x51'),'c',_0xebf6('0x52'))[_0xebf6('0x4d')](_0xebf6('0x4e'),'o','o.id\x20=\x20i.UserId')[_0xebf6('0x4d')](_0xebf6('0x53'),'a',_0xebf6('0x54'))[_0xebf6('0x4d')](_0xebf6('0x55'),'me',_0xebf6('0x56'))[_0xebf6('0x4d')]('sms_interaction_has_tags','it',_0xebf6('0x57'))['left_join'](_0xebf6('0x48'),'t',_0xebf6('0x58'));var _0x5d84ac=squel[_0xebf6('0x59')]();var _0x55002b=[];var _0x187d34=squel[_0xebf6('0x59')]();var _0x186655;if(_0x436710[_0xebf6('0x3d')][_0xebf6('0x5a')]){_0x186655=as['parseSearch'](_0x436710[_0xebf6('0x3d')][_0xebf6('0x5a')]);var _0x59a438=_0x186655[_0xebf6('0x5b')];for(var _0x2765f2=0x0;_0x2765f2<_0x186655[_0xebf6('0x5c')][_0xebf6('0x40')];_0x2765f2++){var _0x44c62e=_0x186655['conditions'][_0x2765f2];var _0xe6361b='i';var _0x2e52a4=_[_0xebf6('0x5d')](_0x562f76,[_0xebf6('0x2d'),_0x44c62e['field']]);if(!_0x2e52a4){switch(_0x44c62e[_0xebf6('0x45')]){case _0xebf6('0x5e'):if(_0x44c62e[_0xebf6('0x5f')]==0x1){_0x39d153[_0xebf6('0x60')]('`'+_0x44c62e[_0xebf6('0x45')]+_0xebf6('0x61'));}else{_0x39d153[_0xebf6('0x60')]('`'+_0x44c62e[_0xebf6('0x45')]+_0xebf6('0x62'));}break;case'Contact':if(_0x44c62e[_0xebf6('0x63')]===_0xebf6('0x64')){if(_0x44c62e[_0xebf6('0x5f')]['split']('\x20')[_0xebf6('0x40')]>0x1){_0x5d84ac[_0x59a438]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x44c62e[_0xebf6('0x5f')]),null);}else{var _0xa9a1e0='%'+_0x44c62e[_0xebf6('0x5f')]+'%';_0x5d84ac[_0x59a438](_0xebf6('0x65'),_0xa9a1e0,_0xa9a1e0,_0xa9a1e0);}}else{_0x2e52a4=_[_0xebf6('0x5d')](_0x562f76,['name',_0xebf6('0x66')]);_0x44c62e['field']='ContactId';_0x3debd2=as['buildExpression'](_0xe6361b,_0x2e52a4[_0xebf6('0x37')],_0x44c62e);_0x5d84ac[_0x59a438](_0x3debd2[_0xebf6('0x67')],_0x3debd2['value'][_0xebf6('0x68')],_0x3debd2[_0xebf6('0x5f')][_0xebf6('0x2c')]);}break;case _0xebf6('0x69'):var _0x3a4b20=_0x44c62e[_0xebf6('0x5f')][_0xebf6('0x32')](',')['map'](function(_0x185538){return Number(_0x185538);});_0x3a4b20[_0xebf6('0x6a')](function(_0x40d85f){_0x187d34['or'](_0xebf6('0x6b'),'%,'+_0x40d85f+',%');});_0x55002b=_[_0xebf6('0x6c')](_0x55002b,_0x3a4b20);break;case _0xebf6('0x6d'):if(_0x44c62e['operator']===_0xebf6('0x64')){_0x5d84ac[_0x59a438](_0xebf6('0x6e'),'%'+_0x44c62e[_0xebf6('0x5f')]+'%',null);}else{_0x2e52a4=_[_0xebf6('0x5d')](_0x562f76,[_0xebf6('0x2d'),_0xebf6('0x6f')]);_0x44c62e['field']=_0xebf6('0x6f');_0x3debd2=as[_0xebf6('0x70')](_0xe6361b,_0x2e52a4[_0xebf6('0x37')],_0x44c62e);_0x5d84ac[_0x59a438](_0x3debd2[_0xebf6('0x67')],_0x3debd2[_0xebf6('0x5f')]['start'],_0x3debd2[_0xebf6('0x5f')][_0xebf6('0x2c')]);}break;case _0xebf6('0x71'):_0x3debd2=as[_0xebf6('0x70')]('me',null,_0x44c62e);_0x5d84ac[_0x59a438](_0x3debd2[_0xebf6('0x67')],_0x3debd2[_0xebf6('0x5f')][_0xebf6('0x68')],_0x3debd2[_0xebf6('0x5f')][_0xebf6('0x2c')]);break;}}else{var _0x3debd2=as[_0xebf6('0x70')](_0xe6361b,_0x2e52a4['type'],_0x44c62e);_0x5d84ac[_0x59a438](_0x3debd2[_0xebf6('0x67')],_0x3debd2[_0xebf6('0x5f')][_0xebf6('0x68')],_0x3debd2[_0xebf6('0x5f')][_0xebf6('0x2c')]);}}}else{var _0x1f40c0=_(_0x436710['query'])[_0xebf6('0x3a')]()['map'](function(_0x33dc96){return _[_0xebf6('0x72')](_0x562f76,[_0xebf6('0x2d'),_0x33dc96])?_0x33dc96:undefined;})[_0xebf6('0x73')]()[_0xebf6('0x5f')]();if(!_[_0xebf6('0x74')](_0x1f40c0)){_0x1f40c0[_0xebf6('0x6a')](function(_0x5e6951){if(_0x5e6951==='SmsAccountId'){_0x39d153[_0xebf6('0x75')](_0xebf6('0x76'),[]['concat'](_0x436710[_0xebf6('0x3d')][_0x5e6951]));}else if(_0x5e6951===_0xebf6('0x77')){var _0x47f345=JSON[_0xebf6('0x78')](_0x436710[_0xebf6('0x3d')][_0x5e6951])['$gte'];var _0x35a5c4=JSON[_0xebf6('0x78')](_0x436710[_0xebf6('0x3d')][_0x5e6951])[_0xebf6('0x79')];_0x39d153[_0xebf6('0x75')](_0xebf6('0x7a'),_0x47f345,_0x35a5c4);}else{if(_0x436710[_0xebf6('0x3d')][_0x5e6951]==='null'){_0x39d153[_0xebf6('0x75')]('i.'+_0x5e6951+_0xebf6('0x7b'));}else{_0x39d153[_0xebf6('0x75')]('i.'+_0x5e6951+_0xebf6('0x7c'),_0x436710[_0xebf6('0x3d')][_0x5e6951]);}}});}if(_0x436710[_0xebf6('0x3d')][_0xebf6('0x7d')]){if(_0x436710[_0xebf6('0x3d')][_0xebf6('0x7d')]==0x1){_0x39d153[_0xebf6('0x60')]('`unreadMessages`\x20=\x200');}else{_0x39d153['having'](_0xebf6('0x7e'));}}if(_0x436710[_0xebf6('0x3d')][_0xebf6('0x7f')]){_0x55002b=_[_0xebf6('0x80')](_0x436710['query'][_0xebf6('0x7f')])?_0x436710[_0xebf6('0x3d')][_0xebf6('0x7f')]:new Array(_0x436710[_0xebf6('0x3d')]['tag']);_0x55002b['forEach'](function(_0x5dcab1){_0x187d34['or'](_0xebf6('0x6b'),'%,'+_0x5dcab1+',%');});}if(_0x436710[_0xebf6('0x3d')][_0xebf6('0x81')]){var _0xe56120=_0x436710[_0xebf6('0x3d')][_0xebf6('0x81')][_0xebf6('0x82')]('\x5c','\x5c\x5c')[_0xebf6('0x82')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0xebf6('0x83')](_0xe56120)){_0x5d84ac['or'](_0xebf6('0x84'),_0xe56120+'%')['or']('i.phone\x20LIKE\x20?',_0xe56120+'%');}else{_0x5d84ac['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xebf6('0x85')](_0xe56120))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0xe56120+'%');}}}_0x39d153[_0xebf6('0x75')](_0x5d84ac);_0x39d153[_0xebf6('0x86')](_0xebf6('0x87'));var _0x5781bd={'type':db[_0xebf6('0x88')][_0xebf6('0x89')][_0xebf6('0x8a')],'raw':!![]};var _0xbadd1e=_0x39d153[_0xebf6('0x8b')]();_0xbadd1e[_0xebf6('0x45')]('i.id');_0xbadd1e[_0xebf6('0x45')](_0xebf6('0x8c'),'unreadMessages');if(_0x568994[_0xebf6('0x8d')]){_0x568994[_0xebf6('0x8d')][_0xebf6('0x6a')](function(_0x5781cb){_0x39d153[_0xebf6('0x8d')]('i.'+_0x5781cb[0x0],_0x5781cb[0x1]===_0xebf6('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x55002b)){_0x39d153[_0xebf6('0x60')](_0x187d34);_0xbadd1e[_0xebf6('0x75')](_0xebf6('0x8f'),_0x55002b);}BPromise[_0xebf6('0x90')]()[_0xebf6('0x2a')](function(){if(!_0x186655){if(_0x436710[_0xebf6('0x3d')][_0xebf6('0x91')]||_0x436710[_0xebf6('0x3d')][_0xebf6('0x92')])return;_0xbadd1e[_0xebf6('0x75')](_0xebf6('0x93'));_0x39d153[_0xebf6('0x75')](_0xebf6('0x93'));return;}return _0x436710['user'][_0xebf6('0x94')]({'attributes':['id'],'raw':!![]})[_0xebf6('0x2a')](function(_0x1ec73d){if(_[_0xebf6('0x74')](_0x1ec73d)){_0xbadd1e[_0xebf6('0x75')](_0xebf6('0x95'));_0x39d153[_0xebf6('0x75')](_0xebf6('0x95'));}else{_0xbadd1e[_0xebf6('0x75')](_0xebf6('0x76'),_['map'](_0x1ec73d,'id'));_0x39d153['where'](_0xebf6('0x76'),_['map'](_0x1ec73d,'id'));}});})[_0xebf6('0x2a')](function(){db[_0xebf6('0x96')][_0xebf6('0x3d')](_0xbadd1e[_0xebf6('0x97')](),_0x5781bd)[_0xebf6('0x2a')](function(_0x4c3c73){_0x46ef2d[_0xebf6('0x21')]=_0x4c3c73[_0xebf6('0x40')];if(_0x46ef2d['count']===0x0)return[];return db[_0xebf6('0x96')][_0xebf6('0x3d')](_0x17c4af[_0xebf6('0x97')](),_0x5781bd)[_0xebf6('0x2a')](function(_0x4066ad){_0x1de50e=_['keyBy'](_0x4066ad,'id');_0x5781bd=_['merge'](_0x5781bd,{'model':db[_0xebf6('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x436710[_0xebf6('0x3d')][_0xebf6('0x3f')]){_0x568994[_0xebf6('0x3e')][_0xebf6('0x6a')](function(_0x27f070){_0x39d153[_0xebf6('0x45')]('i.'+_0x27f070);});}else{_0x39d153['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xebf6('0x5e'));_0x39d153['field'](_0xebf6('0x98'),_0xebf6('0x99'));_0x39d153[_0xebf6('0x45')]('a.mandatoryDisposition',_0xebf6('0x9a'));_0x39d153['field'](_0xebf6('0x9b'));_0x39d153[_0xebf6('0x45')](_0xebf6('0x9c'),_0xebf6('0x9d'));_0x39d153[_0xebf6('0x45')]('c.lastName',_0xebf6('0x9e'));_0x39d153['field'](_0xebf6('0x9f'),_0xebf6('0xa0'));_0x39d153[_0xebf6('0x45')]('c.phone',_0xebf6('0xa1'));_0x39d153[_0xebf6('0x45')](_0xebf6('0xa2'),_0xebf6('0xa3'));_0x39d153[_0xebf6('0x45')](_0xebf6('0xa4'),'Contact.fax');_0x39d153[_0xebf6('0x45')](_0xebf6('0xa5'),'Owner.fullname');_0x39d153[_0xebf6('0x45')]('o.internal',_0xebf6('0xa6'));_0x39d153[_0xebf6('0x45')](_0xebf6('0xa7'),_0xebf6('0x30'));}if(_0x568994['limit'])_0x39d153[_0xebf6('0x23')](_0x568994['limit']);if(_0x568994[_0xebf6('0x22')])_0x39d153[_0xebf6('0x22')](_0x568994[_0xebf6('0x22')]);return db[_0xebf6('0x96')][_0xebf6('0x3d')](_0x39d153[_0xebf6('0x97')](),_0x5781bd);})['then'](function(_0x4adae2){_0x4fd568[_0xebf6('0x75')](_0xebf6('0xa8'),_[_0xebf6('0x2f')](_0x4adae2,'id'));return db[_0xebf6('0x96')]['query'](_0x4fd568['toString'](),_0x5781bd)['then'](function(_0x5e58df){var _0x302a07=_[_0xebf6('0xa9')](_0x5e58df,_0xebf6('0xaa'));var _0x13bc08=[];_0x4adae2['forEach'](function(_0x284b94){_0x13bc08[_0xebf6('0xab')](updateSmsInteraction(_0x284b94,_0x1de50e,_0x302a07));});return BPromise[_0xebf6('0xac')](_0x13bc08);});});})[_0xebf6('0x2a')](function(_0x392320){_0x46ef2d[_0xebf6('0xad')]=_0x392320;return _0x46ef2d;})[_0xebf6('0x2a')](respondWithFilteredResult(_0x4b6d95,_0x568994));})[_0xebf6('0x33')](handleError(_0x4b6d95,null));};exports[_0xebf6('0xae')]=function(_0x3787be,_0x21e9f6){var _0x386c95={'raw':![],'where':{'id':_0x3787be['params']['id']}},_0x5cf29d={};_0x5cf29d['model']=_[_0xebf6('0x3a')](db['SmsInteraction'][_0xebf6('0xaf')]);_0x5cf29d['query']=_[_0xebf6('0x3a')](_0x3787be['query']);_0x5cf29d['filters']=_[_0xebf6('0x3c')](_0x5cf29d[_0xebf6('0x39')],_0x5cf29d[_0xebf6('0x3d')]);_0x386c95[_0xebf6('0x3e')]=_['intersection'](_0x5cf29d['model'],qs['fields'](_0x3787be[_0xebf6('0x3d')][_0xebf6('0x3f')]));_0x386c95[_0xebf6('0x3e')]=_0x386c95[_0xebf6('0x3e')]['length']?_0x386c95[_0xebf6('0x3e')]:_0x5cf29d[_0xebf6('0x39')];if(_0x3787be[_0xebf6('0x3d')][_0xebf6('0xb0')]){_0x386c95[_0xebf6('0xb1')]=[{'all':!![]}];}_0x386c95=_[_0xebf6('0xb2')]({},_0x386c95,_0x3787be[_0xebf6('0xb3')]);return db[_0xebf6('0x35')][_0xebf6('0x5d')](_0x386c95)['then'](handleEntityNotFound(_0x21e9f6,null))[_0xebf6('0x2a')](respondWithResult(_0x21e9f6,null))[_0xebf6('0x33')](handleError(_0x21e9f6,null));};exports[_0xebf6('0xb4')]=function(_0x44a8bb,_0x3534db){return db[_0xebf6('0x35')][_0xebf6('0xb4')](_0x44a8bb[_0xebf6('0x71')],{})['then'](respondWithResult(_0x3534db,0xc9))[_0xebf6('0x33')](handleError(_0x3534db,null));};exports[_0xebf6('0x29')]=function(_0x4c4ae1,_0x53a65e){if(_0x4c4ae1[_0xebf6('0x71')]['id']){delete _0x4c4ae1[_0xebf6('0x71')]['id'];}return db[_0xebf6('0x35')][_0xebf6('0x5d')]({'where':{'id':_0x4c4ae1[_0xebf6('0xb5')]['id']}})[_0xebf6('0x2a')](handleEntityNotFound(_0x53a65e,null))[_0xebf6('0x2a')](saveUpdates(_0x4c4ae1['body'],null))[_0xebf6('0x2a')](respondWithResult(_0x53a65e,null))[_0xebf6('0x33')](handleError(_0x53a65e,null));};exports['destroy']=function(_0x2fd33c,_0xbba944){return db[_0xebf6('0x35')][_0xebf6('0x5d')]({'where':{'id':_0x2fd33c[_0xebf6('0xb5')]['id']}})[_0xebf6('0x2a')](handleEntityNotFound(_0xbba944,null))[_0xebf6('0x2a')](removeEntity(_0xbba944,null))[_0xebf6('0x33')](handleError(_0xbba944,null));};exports['describe']=function(_0x15f148,_0x53d54f){return db[_0xebf6('0x35')][_0xebf6('0xb6')]()[_0xebf6('0x2a')](respondWithResult(_0x53d54f,null))[_0xebf6('0x33')](handleError(_0x53d54f,null));};exports['addMessage']=function(_0x17cf09,_0x50f7e0,_0x19f5bf){return db[_0xebf6('0xb7')][_0xebf6('0x5d')]({'where':{'id':_0x17cf09[_0xebf6('0xb5')]['id']}})[_0xebf6('0x2a')](handleEntityNotFound(_0x50f7e0,null))['then'](function(_0x3f8adc){if(_0x3f8adc){return _0x3f8adc[_0xebf6('0xb8')](_0x17cf09['body'][_0xebf6('0xb9')],_[_0xebf6('0xba')](_0x17cf09['body'],[_0xebf6('0xb9'),'id'])||{});}})['then'](respondWithResult(_0x50f7e0,null))[_0xebf6('0x33')](handleError(_0x50f7e0,null));};exports[_0xebf6('0xbb')]=function(_0x1d8ea3,_0x24d77b,_0x18681e){var _0x289497={'raw':![],'where':{}};var _0x8e0a8d={};var _0x3f85bc={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xebf6('0xbc')]({'where':{'id':_0x1d8ea3['params']['id']}})[_0xebf6('0x2a')](handleEntityNotFound(_0x24d77b,null))[_0xebf6('0x2a')](function(_0x3665d2){if(_0x3665d2){_0x8e0a8d['model']=_['keys'](db[_0xebf6('0xb7')][_0xebf6('0xaf')]);_0x8e0a8d[_0xebf6('0x3d')]=_[_0xebf6('0x3a')](_0x1d8ea3[_0xebf6('0x3d')]);_0x8e0a8d[_0xebf6('0x3b')]=_[_0xebf6('0x3c')](_0x8e0a8d[_0xebf6('0x39')],_0x8e0a8d[_0xebf6('0x3d')]);_0x289497[_0xebf6('0x3e')]=_[_0xebf6('0x3c')](_0x8e0a8d[_0xebf6('0x39')],qs['fields'](_0x1d8ea3['query'][_0xebf6('0x3f')]));_0x289497[_0xebf6('0x3e')]=_0x289497[_0xebf6('0x3e')][_0xebf6('0x40')]?_0x289497['attributes']:_0x8e0a8d[_0xebf6('0x39')];if(!_0x1d8ea3[_0xebf6('0x3d')][_0xebf6('0x41')](_0xebf6('0x42'))){_0x289497[_0xebf6('0x23')]=qs['limit'](_0x1d8ea3['query']['limit']);_0x289497['offset']=qs[_0xebf6('0x22')](_0x1d8ea3['query']['offset']);}_0x289497['order']=qs[_0xebf6('0x43')](_0x1d8ea3[_0xebf6('0x3d')][_0xebf6('0x43')]);_0x289497[_0xebf6('0x75')]=qs[_0xebf6('0x3b')](_[_0xebf6('0x44')](_0x1d8ea3['query'],_0x8e0a8d['filters']));_0x289497[_0xebf6('0x75')][_0xebf6('0xaa')]=_0x3665d2['id'];if(_0x1d8ea3['query'][_0xebf6('0x81')]){_0x289497[_0xebf6('0x75')]=_[_0xebf6('0xb2')](_0x289497[_0xebf6('0x75')],{'$or':_['map'](_0x289497[_0xebf6('0x3e')],function(_0x275f16){var _0x3f37dc={};_0x3f37dc[_0x275f16]={'$like':'%'+_0x1d8ea3[_0xebf6('0x3d')][_0xebf6('0x81')]+'%'};return _0x3f37dc;})});}if(_0x1d8ea3[_0xebf6('0x3d')][_0xebf6('0xbd')]){var _0x4cf590=_0x1d8ea3['query'][_0xebf6('0xbd')][_0xebf6('0x32')](',');var _0x122115={};_0x122115[_0x4cf590[0x0]]={'$gte':moment(_0x4cf590[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x289497[_0xebf6('0x75')]=_['merge'](_0x289497[_0xebf6('0x75')],_0x122115);}_0x289497=_[_0xebf6('0xb2')]({},_0x289497,_0x1d8ea3['options']);return db[_0xebf6('0xb7')][_0xebf6('0x21')]({'where':_0x289497[_0xebf6('0x75')]})['then'](function(_0x1a3964){_0x3f85bc['count']=_0x1a3964;if(_0x1d8ea3[_0xebf6('0x3d')][_0xebf6('0xb0')]){_0x289497[_0xebf6('0xb1')]=[{'all':!![]}];}return db[_0xebf6('0xb7')][_0xebf6('0xbe')](_0x289497);})[_0xebf6('0x2a')](function(_0x52e2d9){_0x3f85bc[_0xebf6('0xad')]=_0x52e2d9;return _0x3f85bc;});}})[_0xebf6('0x2a')](respondWithFilteredResult(_0x24d77b,_0x289497))[_0xebf6('0x33')](handleError(_0x24d77b,null));};exports[_0xebf6('0xbf')]=function(_0x147186,_0x5a2128,_0x2e3f28){return db['SmsInteraction'][_0xebf6('0x5d')]({'where':{'id':_0x147186[_0xebf6('0xb5')]['id']}})[_0xebf6('0x2a')](handleEntityNotFound(_0x5a2128,null))[_0xebf6('0x2a')](function(_0x43c6b7){if(_0x43c6b7){return _0x43c6b7[_0xebf6('0xc0')](_0x147186[_0xebf6('0x71')][_0xebf6('0xb9')],_[_0xebf6('0xba')](_0x147186[_0xebf6('0x71')],[_0xebf6('0xb9'),'id'])||{})['spread'](function(){return db['Tag'][_0xebf6('0xbe')]({'attributes':['id',_0xebf6('0x2d'),'color'],'where':{'id':_0x147186[_0xebf6('0x71')][_0xebf6('0xb9')]}});})[_0xebf6('0x2a')](function(_0x2bfdf6){socket['emit'](_0xebf6('0xc1'),{'id':Number(_0x147186['params']['id']),'tags':_0x2bfdf6||[]});return{'id':Number(_0x147186[_0xebf6('0xb5')]['id']),'tags':_0x2bfdf6||[]};});}})[_0xebf6('0x2a')](respondWithResult(_0x5a2128,null))[_0xebf6('0x33')](handleError(_0x5a2128,null));};exports['removeTags']=function(_0x2a4b3d,_0x4252cb,_0x9b9ff0){return db[_0xebf6('0x35')][_0xebf6('0x5d')]({'where':{'id':_0x2a4b3d[_0xebf6('0xb5')]['id']}})[_0xebf6('0x2a')](handleEntityNotFound(_0x4252cb,null))[_0xebf6('0x2a')](function(_0x5a944f){if(_0x5a944f){return _0x5a944f[_0xebf6('0xc2')](_0x2a4b3d['query'][_0xebf6('0xb9')]);}})[_0xebf6('0x2a')](respondWithStatusCode(_0x4252cb,null))[_0xebf6('0x33')](handleError(_0x4252cb,null));};exports['download']=function(_0x1ba1ea,_0xca3e0f){var _0x5c4adf=moment()[_0xebf6('0xc3')]()[_0xebf6('0x97')]();var _0xdded4b=path[_0xebf6('0xc4')](config[_0xebf6('0xc5')],_0xebf6('0xc6'),'files',_0xebf6('0xc7'));var _0x26e467=path[_0xebf6('0xc4')](config[_0xebf6('0xc5')],'server',_0xebf6('0xc8'),_0xebf6('0xc9'));var _0x5dac74=path[_0xebf6('0xc4')](_0xdded4b,_0x5c4adf);var _0x4ec333=util[_0xebf6('0xca')](_0xebf6('0xcb'),_0x1ba1ea[_0xebf6('0xb5')]['id'],_0x5c4adf);var _0x51ccc2=path[_0xebf6('0xc4')](_0xdded4b,_0x4ec333);var _0x5ef4e9=[];_0x5ef4e9['push']({'model':db[_0xebf6('0x6d')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x5ef4e9['push']({'model':db[_0xebf6('0xcc')],'as':_0xebf6('0xcd'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x423512=[{'model':db[_0xebf6('0xb7')],'as':_0xebf6('0xce'),'attributes':['id',_0xebf6('0x71'),_0xebf6('0x77'),_0xebf6('0xcf'),_0xebf6('0xd0'),_0xebf6('0x7d')],'include':_0x5ef4e9}];_0x423512[_0xebf6('0xab')]({'model':db[_0xebf6('0xd1')],'as':'Account','attributes':['id','name']});_0x423512[_0xebf6('0xab')]({'model':db[_0xebf6('0x6d')],'as':'Owner','attributes':['id','fullname']});return db[_0xebf6('0x35')][_0xebf6('0x5d')]({'where':{'id':_0x1ba1ea[_0xebf6('0xb5')]['id']},'include':_0x423512})[_0xebf6('0x2a')](handleEntityNotFound(_0xca3e0f,null))[_0xebf6('0x2a')](function(_0x15c9ed){if(_0x15c9ed){var _0xb8eb08=_0x15c9ed[_0xebf6('0xd2')]({'plain':!![]});fs['mkdirSync'](_0x5dac74);var _0xaca85e={'format':'A4','border':_0xebf6('0xd3'),'header':{'height':_0xebf6('0xd4'),'contents':{'first':_0xebf6('0xd5')}},'footer':{'height':_0xebf6('0xd6'),'contents':{'default':util[_0xebf6('0xca')](_0xebf6('0xd7'),util[_0xebf6('0xca')](_0xebf6('0xd8'),_0xebf6('0xd9'),_0xb8eb08['id']),moment()['format'](_0xebf6('0xda'))[_0xebf6('0x97')]())}}};var _0x1f8996={'channel':'Sms','account':_0xb8eb08[_0xebf6('0xdb')][_0xebf6('0x2d')],'agent':_0xb8eb08[_0xebf6('0xdc')]?_0xb8eb08['Owner'][_0xebf6('0xdd')]:_0xebf6('0xde'),'createdAt':moment(_0xb8eb08[_0xebf6('0x77')])[_0xebf6('0xca')](_0xebf6('0xdf'))[_0xebf6('0x97')](),'closedAt':_0xb8eb08[_0xebf6('0xe0')]?moment(_0xb8eb08['closedAt'])[_0xebf6('0xca')](_0xebf6('0xdf'))[_0xebf6('0x97')]():'','disposition':_0xb8eb08[_0xebf6('0xe1')],'messages':_(_0xb8eb08[_0xebf6('0xce')])[_0xebf6('0x81')]({'secret':![]})[_0xebf6('0x2f')](function(_0x111f04){return{'date':moment(_0x111f04[_0xebf6('0x77')])[_0xebf6('0xca')](_0xebf6('0xdf'))[_0xebf6('0x97')](),'sender':_0x111f04[_0xebf6('0xcf')]===_0xebf6('0xe2')?_0x111f04[_0xebf6('0x6d')]?_0x111f04[_0xebf6('0x6d')][_0xebf6('0xdd')]:_0xebf6('0xe3'):_0x111f04[_0xebf6('0xcd')]['firstName']+(_0x111f04[_0xebf6('0xcd')][_0xebf6('0xe4')]?'\x20'+_0x111f04[_0xebf6('0xcd')][_0xebf6('0xe4')]:''),'body':_0x111f04[_0xebf6('0x71')],'direction':_0x111f04[_0xebf6('0xcf')]===_0xebf6('0xe2')?'A':'C','secret':_0x111f04[_0xebf6('0xd0')],'read':_0x111f04[_0xebf6('0x7d')]};})[_0xebf6('0x5f')]()};return ejs[_0xebf6('0xe5')](path['join'](config[_0xebf6('0xc5')],_0xebf6('0xc6'),_0xebf6('0xe6'),_0xebf6('0xe7')),{'interaction':_0x1f8996})[_0xebf6('0x2a')](function(_0x2d2eaf){return new BPromise(function(_0x98e005,_0x264c74){pdf[_0xebf6('0xb4')](_0x2d2eaf,_0xaca85e)[_0xebf6('0xe8')](path[_0xebf6('0xc4')](_0x5dac74,_0xebf6('0xe9')+_0xb8eb08['id']+'-'+_0x5c4adf+_0xebf6('0xea')),function(_0x1b3893,_0x50670){if(_0x1b3893)return _0x264c74(_0x1b3893);_0x98e005(_0x50670);});});})['then'](function(){return new BPromise(function(_0x2f6406,_0x2208ff){zipdir(_0x5dac74,{'saveTo':_0x51ccc2},function(_0x2d5044,_0x3ecb4b){if(_0x2d5044)return _0x2208ff(_0x2d5044);return _0x2f6406(_0x3ecb4b);});})[_0xebf6('0x2a')](function(){return new BPromise(function(_0x15be28,_0x4234ac){rimraf(_0x5dac74,function(_0x167eb3){if(_0x167eb3)_0x4234ac(_0x167eb3);return _0x15be28();});});})[_0xebf6('0x2a')](function(){return _0xca3e0f[_0xebf6('0xeb')](_0x51ccc2,_0x4ec333,function(_0xf3e85e){if(_0xf3e85e){console[_0xebf6('0xec')](_0xebf6('0xed'),_0xf3e85e);}else{fs['unlinkSync'](_0x51ccc2);}});});});}else{return _0xca3e0f['sendStatus'](0xc8);}})[_0xebf6('0x33')](handleError(_0xca3e0f,null));}; \ No newline at end of file +var _0xe13a=['t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','length','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','find','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','some','compact','isEmpty','SmsAccountId','concat','$gte','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','Account.key','Account.mandatoryDisposition','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','rows','show','params','options','create','body','destroy','describe','SmsMessage','ids','getMessages','findOne','nolimit','format','includeAll','include','findAll','setTags','omit','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','transcript-%d-%s.zip','User','CmContact','firstName','lastName','createdAt','direction','secret','Account','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','Messages','out','renderFile','views','toFile','transcript-','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','sendStatus','status','end','json','count','offset','set','apply','reject','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','index','SmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','pick','filters','field','from','tools_tags','select','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags'];(function(_0x5ba808,_0x35c466){var _0x59abf9=function(_0x2cf5a5){while(--_0x2cf5a5){_0x5ba808['push'](_0x5ba808['shift']());}};_0x59abf9(++_0x35c466);}(_0xe13a,0x178));var _0xae13=function(_0x493458,_0xf0d19c){_0x493458=_0x493458-0x0;var _0x2579a9=_0xe13a[_0x493458];return _0x2579a9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xae13('0x0'));var rimraf=require(_0xae13('0x1'));var zipdir=require(_0xae13('0x2'));var jsonpatch=require(_0xae13('0x3'));var rp=require('request-promise');var moment=require(_0xae13('0x4'));var BPromise=require(_0xae13('0x5'));var Mustache=require(_0xae13('0x6'));var util=require(_0xae13('0x7'));var path=require(_0xae13('0x8'));var sox=require(_0xae13('0x9'));var csv=require(_0xae13('0xa'));var ejs=require(_0xae13('0xb'));var fs=require('fs');var _=require(_0xae13('0xc'));var squel=require('squel');var crypto=require(_0xae13('0xd'));var jsforce=require(_0xae13('0xe'));var deskjs=require(_0xae13('0xf'));var toCsv=require(_0xae13('0xa'));var querystring=require(_0xae13('0x10'));var Papa=require(_0xae13('0x11'));var Redis=require(_0xae13('0x12'));var authService=require(_0xae13('0x13'));var qs=require(_0xae13('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae13('0x15'));var logger=require(_0xae13('0x16'))(_0xae13('0x17'));var utils=require(_0xae13('0x18'));var config=require(_0xae13('0x19'));var db=require(_0xae13('0x1a'))['db'];config[_0xae13('0x1b')]=_['defaults'](config[_0xae13('0x1b')],{'host':_0xae13('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x52484b,_0x26ff3e){_0x26ff3e=_0x26ff3e||0xcc;return function(_0x148186){if(_0x148186){return _0x52484b[_0xae13('0x1d')](_0x26ff3e);}return _0x52484b[_0xae13('0x1e')](_0x26ff3e)[_0xae13('0x1f')]();};}function respondWithResult(_0x2912a2,_0x5c25a4){_0x5c25a4=_0x5c25a4||0xc8;return function(_0x3c488f){if(_0x3c488f){return _0x2912a2['status'](_0x5c25a4)[_0xae13('0x20')](_0x3c488f);}};}function respondWithFilteredResult(_0x16764b,_0x207363){return function(_0x118e52){if(_0x118e52){var _0x1a9c07=_0x118e52[_0xae13('0x21')],_0x1b33b7=_0x207363['offset'],_0x32dcbe=_0x207363[_0xae13('0x22')]+_0x207363['limit'],_0x326471;if(_0x32dcbe>=_0x1a9c07){_0x32dcbe=_0x1a9c07;_0x326471=0xc8;}else{_0x326471=0xce;}_0x16764b[_0xae13('0x1e')](_0x326471);return _0x16764b[_0xae13('0x23')]('Content-Range',_0x1b33b7+'-'+_0x32dcbe+'/'+_0x1a9c07)[_0xae13('0x20')](_0x118e52);}return null;};}function patchUpdates(_0x39d41c){return function(_0x3e4bc8){try{jsonpatch[_0xae13('0x24')](_0x3e4bc8,_0x39d41c,!![]);}catch(_0x184375){return BPromise[_0xae13('0x25')](_0x184375);}return _0x3e4bc8['save']();};}function saveUpdates(_0x520692,_0x149eda){return function(_0x290fb9){if(_0x290fb9){return _0x290fb9['update'](_0x520692)[_0xae13('0x26')](function(_0x519a37){return _0x519a37;});}return null;};}function removeEntity(_0x13c2de,_0x194437){return function(_0x3f12b0){if(_0x3f12b0){return _0x3f12b0['destroy']()['then'](function(){_0x13c2de['status'](0xcc)[_0xae13('0x1f')]();});}};}function handleEntityNotFound(_0xc5e6a7,_0x17ce58){return function(_0x55a39b){if(!_0x55a39b){_0xc5e6a7[_0xae13('0x1d')](0x194);}return _0x55a39b;};}function handleError(_0x517e71,_0x3d0d60){_0x3d0d60=_0x3d0d60||0x1f4;return function(_0x5de054){logger[_0xae13('0x27')](_0x5de054[_0xae13('0x28')]);if(_0x5de054['name']){delete _0x5de054[_0xae13('0x29')];}_0x517e71[_0xae13('0x1e')](_0x3d0d60)[_0xae13('0x2a')](_0x5de054);};}function getInteractionUsers(_0x306dfb,_0x578e99){return new BPromise(function(_0x41ceb7,_0x27b737){try{if(_0x578e99[_0x306dfb['id']]){_0x306dfb[_0xae13('0x2b')]=_[_0xae13('0x2c')](_0x578e99[_0x306dfb['id']],function(_0x742759){return{'id':_0x742759['id'],'fullname':_0x742759[_0xae13('0x2d')]};});}}catch(_0x277b69){_0x27b737(_0x277b69);}_0x41ceb7(_0x306dfb);});}function getInteractionTags(_0x5bd0ee,_0x133481){return new BPromise(function(_0x591f94,_0xf6289c){try{if(_0x5bd0ee[_0xae13('0x2e')]){_0x5bd0ee[_0xae13('0x2f')]=[];_0x5bd0ee[_0xae13('0x2e')][_0xae13('0x30')](',')[_0xae13('0x31')](function(_0x11c2ba){_0x5bd0ee['Tags']['push'](_0x133481[_0x11c2ba]);});}delete _0x5bd0ee[_0xae13('0x2e')];}catch(_0x233896){_0xf6289c(_0x233896);}_0x591f94(_0x5bd0ee);});}function updateSmsInteraction(_0xb3764d,_0x3710d6,_0x3d4ffd){return new BPromise(function(_0xfac8e7,_0x126686){return getInteractionUsers(_0xb3764d,_0x3d4ffd)[_0xae13('0x26')](function(_0x1fda10){return getInteractionTags(_0x1fda10,_0x3710d6);})[_0xae13('0x26')](function(_0x5f1aeb){_0xfac8e7(_0x5f1aeb);})[_0xae13('0x32')](function(_0x116270){_0x126686(_0x116270);});});}exports[_0xae13('0x33')]=function(_0x597001,_0x53b5f6){var _0x587b6f={},_0x5ba0a8={},_0x5b4060={'count':0x0,'rows':[]};var _0x5ee151=_[_0xae13('0x2c')](db[_0xae13('0x34')][_0xae13('0x35')],function(_0x5bb32a){return{'name':_0x5bb32a[_0xae13('0x36')],'type':_0x5bb32a[_0xae13('0x37')][_0xae13('0x38')]};});_0x5ba0a8[_0xae13('0x39')]=_[_0xae13('0x2c')](_0x5ee151,'name');_0x5ba0a8[_0xae13('0x3a')]=_[_0xae13('0x3b')](_0x597001[_0xae13('0x3a')]);_0x5ba0a8['filters']=_['intersection'](_0x5ba0a8[_0xae13('0x39')],_0x5ba0a8[_0xae13('0x3a')]);_0x587b6f[_0xae13('0x3c')]=_[_0xae13('0x3d')](_0x5ba0a8['model'],qs[_0xae13('0x3e')](_0x597001[_0xae13('0x3a')]['fields']));_0x587b6f[_0xae13('0x3c')]=_0x587b6f[_0xae13('0x3c')]['length']?_0x587b6f[_0xae13('0x3c')]:_0x5ba0a8[_0xae13('0x39')];if(!_0x597001[_0xae13('0x3a')][_0xae13('0x3f')]('nolimit')){_0x587b6f[_0xae13('0x40')]=qs[_0xae13('0x40')](_0x597001[_0xae13('0x3a')][_0xae13('0x40')]);_0x587b6f['offset']=qs[_0xae13('0x22')](_0x597001[_0xae13('0x3a')][_0xae13('0x22')]);}_0x587b6f[_0xae13('0x41')]=qs['sort'](_0x597001['query'][_0xae13('0x42')]);_0x587b6f[_0xae13('0x43')]=qs['filters'](_[_0xae13('0x44')](_0x597001['query'],_0x5ba0a8[_0xae13('0x45')]),_0x5ee151);var _0x230ba6=[];var _0x3fca0a=squel['select']()[_0xae13('0x46')]('id')[_0xae13('0x46')](_0xae13('0x29'))[_0xae13('0x46')]('color')[_0xae13('0x47')](_0xae13('0x48'));var _0x133f00=squel[_0xae13('0x49')]()[_0xae13('0x46')](_0xae13('0x4a'))[_0xae13('0x46')](_0xae13('0x4b'))['field'](_0xae13('0x4c'))['from'](_0xae13('0x4d'),'ui')[_0xae13('0x4e')](_0xae13('0x4f'),'u',_0xae13('0x50'));var _0x51cbcc=squel[_0xae13('0x49')]()['from'](_0xae13('0x51'),'i')[_0xae13('0x4e')]('cm_contacts','c',_0xae13('0x52'))[_0xae13('0x4e')](_0xae13('0x4f'),'o',_0xae13('0x53'))[_0xae13('0x4e')](_0xae13('0x54'),'a','a.id\x20=\x20i.SmsAccountId')[_0xae13('0x4e')](_0xae13('0x55'),'me',_0xae13('0x56'))[_0xae13('0x4e')](_0xae13('0x57'),'it','it.SmsInteractionId\x20=\x20i.id')[_0xae13('0x4e')](_0xae13('0x48'),'t',_0xae13('0x58'));var _0x551ed6=squel['expr']();var _0x498db2=[];var _0x566692=squel[_0xae13('0x59')]();var _0x552efd;if(_0x597001[_0xae13('0x3a')]['search']){_0x552efd=as[_0xae13('0x5a')](_0x597001[_0xae13('0x3a')][_0xae13('0x5b')]);var _0x4029dc=_0x552efd[_0xae13('0x5c')];for(var _0x53d341=0x0;_0x53d341<_0x552efd[_0xae13('0x5d')][_0xae13('0x5e')];_0x53d341++){var _0x5eb0ec=_0x552efd[_0xae13('0x5d')][_0x53d341];var _0x41913a='i';var _0x49c43a=_['find'](_0x5ee151,['name',_0x5eb0ec['field']]);if(!_0x49c43a){switch(_0x5eb0ec[_0xae13('0x46')]){case _0xae13('0x5f'):if(_0x5eb0ec['value']==0x1){_0x51cbcc[_0xae13('0x60')]('`'+_0x5eb0ec[_0xae13('0x46')]+'`\x20=\x200');}else{_0x51cbcc[_0xae13('0x60')]('`'+_0x5eb0ec[_0xae13('0x46')]+_0xae13('0x61'));}break;case _0xae13('0x62'):if(_0x5eb0ec[_0xae13('0x63')]===_0xae13('0x64')){if(_0x5eb0ec[_0xae13('0x65')][_0xae13('0x30')]('\x20')[_0xae13('0x5e')]>0x1){_0x551ed6[_0x4029dc](_0xae13('0x66'),qs['getFullTextValue'](_0x5eb0ec[_0xae13('0x65')]),null);}else{var _0xb8beec='%'+_0x5eb0ec[_0xae13('0x65')]+'%';_0x551ed6[_0x4029dc]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xb8beec,_0xb8beec,_0xb8beec);}}else{_0x49c43a=_[_0xae13('0x67')](_0x5ee151,['name',_0xae13('0x68')]);_0x5eb0ec[_0xae13('0x46')]=_0xae13('0x68');_0x43e176=as['buildExpression'](_0x41913a,_0x49c43a['type'],_0x5eb0ec);_0x551ed6[_0x4029dc](_0x43e176[_0xae13('0x69')],_0x43e176[_0xae13('0x65')][_0xae13('0x6a')],_0x43e176[_0xae13('0x65')][_0xae13('0x1f')]);}break;case _0xae13('0x6b'):var _0x3b9840=_0x5eb0ec['value'][_0xae13('0x30')](',')[_0xae13('0x2c')](function(_0x1cf135){return Number(_0x1cf135);});_0x3b9840[_0xae13('0x31')](function(_0xcbac5b){_0x566692['or'](_0xae13('0x6c'),'%,'+_0xcbac5b+',%');});_0x498db2=_[_0xae13('0x6d')](_0x498db2,_0x3b9840);break;case'User':if(_0x5eb0ec[_0xae13('0x63')]===_0xae13('0x64')){_0x551ed6[_0x4029dc]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5eb0ec[_0xae13('0x65')]+'%',null);}else{_0x49c43a=_[_0xae13('0x67')](_0x5ee151,[_0xae13('0x29'),'UserId']);_0x5eb0ec[_0xae13('0x46')]=_0xae13('0x6e');_0x43e176=as['buildExpression'](_0x41913a,_0x49c43a[_0xae13('0x37')],_0x5eb0ec);_0x551ed6[_0x4029dc](_0x43e176[_0xae13('0x69')],_0x43e176[_0xae13('0x65')][_0xae13('0x6a')],_0x43e176[_0xae13('0x65')][_0xae13('0x1f')]);}break;case'body':_0x43e176=as['buildExpression']('me',null,_0x5eb0ec);_0x551ed6[_0x4029dc](_0x43e176[_0xae13('0x69')],_0x43e176[_0xae13('0x65')][_0xae13('0x6a')],_0x43e176[_0xae13('0x65')][_0xae13('0x1f')]);break;}}else{var _0x43e176=as['buildExpression'](_0x41913a,_0x49c43a[_0xae13('0x37')],_0x5eb0ec);_0x551ed6[_0x4029dc](_0x43e176[_0xae13('0x69')],_0x43e176['value']['start'],_0x43e176['value'][_0xae13('0x1f')]);}}}else{var _0xf998e5=_(_0x597001[_0xae13('0x3a')])[_0xae13('0x3b')]()[_0xae13('0x2c')](function(_0x2754e0){return _[_0xae13('0x6f')](_0x5ee151,[_0xae13('0x29'),_0x2754e0])?_0x2754e0:undefined;})[_0xae13('0x70')]()[_0xae13('0x65')]();if(!_[_0xae13('0x71')](_0xf998e5)){_0xf998e5[_0xae13('0x31')](function(_0x177e9e){if(_0x177e9e===_0xae13('0x72')){_0x51cbcc[_0xae13('0x43')]('i.SmsAccountId\x20IN\x20?',[][_0xae13('0x73')](_0x597001[_0xae13('0x3a')][_0x177e9e]));}else if(_0x177e9e==='createdAt'){var _0x37dcdd=JSON['parse'](_0x597001['query'][_0x177e9e])[_0xae13('0x74')];var _0x25cc60=JSON[_0xae13('0x75')](_0x597001[_0xae13('0x3a')][_0x177e9e])[_0xae13('0x76')];_0x51cbcc[_0xae13('0x43')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x37dcdd,_0x25cc60);}else{if(_0x597001['query'][_0x177e9e]===_0xae13('0x77')){_0x51cbcc[_0xae13('0x43')]('i.'+_0x177e9e+_0xae13('0x78'));}else{_0x51cbcc['where']('i.'+_0x177e9e+_0xae13('0x79'),_0x597001['query'][_0x177e9e]);}}});}if(_0x597001[_0xae13('0x3a')][_0xae13('0x7a')]){if(_0x597001[_0xae13('0x3a')][_0xae13('0x7a')]==0x1){_0x51cbcc[_0xae13('0x60')]('`unreadMessages`\x20=\x200');}else{_0x51cbcc[_0xae13('0x60')](_0xae13('0x7b'));}}if(_0x597001['query'][_0xae13('0x7c')]){_0x498db2=_[_0xae13('0x7d')](_0x597001[_0xae13('0x3a')][_0xae13('0x7c')])?_0x597001[_0xae13('0x3a')][_0xae13('0x7c')]:new Array(_0x597001['query'][_0xae13('0x7c')]);_0x498db2['forEach'](function(_0x272e3c){_0x566692['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x272e3c+',%');});}if(_0x597001[_0xae13('0x3a')][_0xae13('0x7e')]){var _0x5b1880=_0x597001[_0xae13('0x3a')][_0xae13('0x7e')][_0xae13('0x7f')]('\x5c','\x5c\x5c')[_0xae13('0x7f')]('\x27\x27',_0xae13('0x80'));if(qs[_0xae13('0x81')](_0x5b1880)){_0x551ed6['or'](_0xae13('0x82'),_0x5b1880+'%')['or'](_0xae13('0x83'),_0x5b1880+'%');}else{_0x551ed6['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xae13('0x84')](_0x5b1880))['or'](_0xae13('0x85'),_0x5b1880+'%');}}}_0x51cbcc[_0xae13('0x43')](_0x551ed6);_0x51cbcc[_0xae13('0x86')](_0xae13('0x87'));var _0x13c1f3={'type':db[_0xae13('0x88')][_0xae13('0x89')][_0xae13('0x8a')],'raw':!![]};var _0x471f64=_0x51cbcc['clone']();_0x471f64[_0xae13('0x46')]('i.id');_0x471f64['field'](_0xae13('0x8b'),_0xae13('0x5f'));if(_0x587b6f[_0xae13('0x41')]){_0x587b6f['order'][_0xae13('0x31')](function(_0x5d1b1c){_0x51cbcc[_0xae13('0x41')]('i.'+_0x5d1b1c[0x0],_0x5d1b1c[0x1]==='DESC'?![]:!![]);});}if(!_[_0xae13('0x71')](_0x498db2)){_0x51cbcc[_0xae13('0x60')](_0x566692);_0x471f64['where'](_0xae13('0x8c'),_0x498db2);}BPromise[_0xae13('0x8d')]()['then'](function(){if(!_0x552efd){if(_0x597001['query'][_0xae13('0x72')]||_0x597001['query']['journey'])return;_0x471f64[_0xae13('0x43')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x51cbcc[_0xae13('0x43')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}return _0x597001[_0xae13('0x8e')][_0xae13('0x8f')]({'attributes':['id'],'raw':!![]})[_0xae13('0x26')](function(_0x88d31){if(_[_0xae13('0x71')](_0x88d31)){_0x471f64[_0xae13('0x43')]('i.SmsAccountId\x20IS\x20NULL');_0x51cbcc[_0xae13('0x43')](_0xae13('0x90'));}else{_0x471f64['where']('i.SmsAccountId\x20IN\x20?',_['map'](_0x88d31,'id'));_0x51cbcc[_0xae13('0x43')]('i.SmsAccountId\x20IN\x20?',_[_0xae13('0x2c')](_0x88d31,'id'));}});})['then'](function(){db['sequelize'][_0xae13('0x3a')](_0x471f64[_0xae13('0x91')](),_0x13c1f3)[_0xae13('0x26')](function(_0x2cfdc4){_0x5b4060[_0xae13('0x21')]=_0x2cfdc4[_0xae13('0x5e')];if(_0x5b4060['count']===0x0)return[];return db[_0xae13('0x92')][_0xae13('0x3a')](_0x3fca0a[_0xae13('0x91')](),_0x13c1f3)[_0xae13('0x26')](function(_0x4ea1f4){_0x230ba6=_[_0xae13('0x93')](_0x4ea1f4,'id');_0x13c1f3=_[_0xae13('0x94')](_0x13c1f3,{'model':db[_0xae13('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x597001['query']['fields']){_0x587b6f[_0xae13('0x3c')][_0xae13('0x31')](function(_0x405cc2){_0x51cbcc[_0xae13('0x46')]('i.'+_0x405cc2);});}else{_0x51cbcc[_0xae13('0x46')](_0xae13('0x8b'),_0xae13('0x5f'));_0x51cbcc[_0xae13('0x46')]('a.key',_0xae13('0x95'));_0x51cbcc[_0xae13('0x46')]('a.mandatoryDisposition',_0xae13('0x96'));_0x51cbcc[_0xae13('0x46')]('i.*');_0x51cbcc[_0xae13('0x46')](_0xae13('0x97'),'Contact.firstName');_0x51cbcc[_0xae13('0x46')](_0xae13('0x98'),_0xae13('0x99'));_0x51cbcc['field']('c.email',_0xae13('0x9a'));_0x51cbcc[_0xae13('0x46')](_0xae13('0x9b'),'Contact.phone');_0x51cbcc[_0xae13('0x46')]('c.mobile',_0xae13('0x9c'));_0x51cbcc[_0xae13('0x46')](_0xae13('0x9d'),_0xae13('0x9e'));_0x51cbcc[_0xae13('0x46')](_0xae13('0x9f'),_0xae13('0xa0'));_0x51cbcc[_0xae13('0x46')](_0xae13('0xa1'),_0xae13('0xa2'));_0x51cbcc['field'](_0xae13('0xa3'),'TagIds');}if(_0x587b6f[_0xae13('0x40')])_0x51cbcc[_0xae13('0x40')](_0x587b6f[_0xae13('0x40')]);if(_0x587b6f[_0xae13('0x22')])_0x51cbcc[_0xae13('0x22')](_0x587b6f[_0xae13('0x22')]);return db[_0xae13('0x92')][_0xae13('0x3a')](_0x51cbcc[_0xae13('0x91')](),_0x13c1f3);})[_0xae13('0x26')](function(_0x58c874){_0x133f00[_0xae13('0x43')](_0xae13('0xa4'),_[_0xae13('0x2c')](_0x58c874,'id'));return db[_0xae13('0x92')][_0xae13('0x3a')](_0x133f00[_0xae13('0x91')](),_0x13c1f3)[_0xae13('0x26')](function(_0x360b1a){var _0x544f6d=_[_0xae13('0xa5')](_0x360b1a,_0xae13('0xa6'));var _0x3a02c3=[];_0x58c874[_0xae13('0x31')](function(_0x2e8e14){_0x3a02c3[_0xae13('0xa7')](updateSmsInteraction(_0x2e8e14,_0x230ba6,_0x544f6d));});return BPromise[_0xae13('0xa8')](_0x3a02c3);});});})['then'](function(_0x2eaf8b){_0x5b4060[_0xae13('0xa9')]=_0x2eaf8b;return _0x5b4060;})[_0xae13('0x26')](respondWithFilteredResult(_0x53b5f6,_0x587b6f));})[_0xae13('0x32')](handleError(_0x53b5f6,null));};exports[_0xae13('0xaa')]=function(_0x2ced73,_0x4a5551){var _0xbcae23={'raw':![],'where':{'id':_0x2ced73[_0xae13('0xab')]['id']}},_0x17c277={};_0x17c277[_0xae13('0x39')]=_[_0xae13('0x3b')](db[_0xae13('0x34')][_0xae13('0x35')]);_0x17c277[_0xae13('0x3a')]=_[_0xae13('0x3b')](_0x2ced73[_0xae13('0x3a')]);_0x17c277[_0xae13('0x45')]=_['intersection'](_0x17c277[_0xae13('0x39')],_0x17c277[_0xae13('0x3a')]);_0xbcae23[_0xae13('0x3c')]=_[_0xae13('0x3d')](_0x17c277[_0xae13('0x39')],qs[_0xae13('0x3e')](_0x2ced73['query']['fields']));_0xbcae23[_0xae13('0x3c')]=_0xbcae23['attributes'][_0xae13('0x5e')]?_0xbcae23[_0xae13('0x3c')]:_0x17c277[_0xae13('0x39')];if(_0x2ced73[_0xae13('0x3a')]['includeAll']){_0xbcae23['include']=[{'all':!![]}];}_0xbcae23=_[_0xae13('0x94')]({},_0xbcae23,_0x2ced73[_0xae13('0xac')]);return db[_0xae13('0x34')]['find'](_0xbcae23)['then'](handleEntityNotFound(_0x4a5551,null))[_0xae13('0x26')](respondWithResult(_0x4a5551,null))[_0xae13('0x32')](handleError(_0x4a5551,null));};exports[_0xae13('0xad')]=function(_0x22bb08,_0x34276a){return db[_0xae13('0x34')]['create'](_0x22bb08[_0xae13('0xae')],{})[_0xae13('0x26')](respondWithResult(_0x34276a,0xc9))[_0xae13('0x32')](handleError(_0x34276a,null));};exports['update']=function(_0x4d1a9b,_0x1bceda){if(_0x4d1a9b[_0xae13('0xae')]['id']){delete _0x4d1a9b[_0xae13('0xae')]['id'];}return db[_0xae13('0x34')][_0xae13('0x67')]({'where':{'id':_0x4d1a9b[_0xae13('0xab')]['id']}})[_0xae13('0x26')](handleEntityNotFound(_0x1bceda,null))['then'](saveUpdates(_0x4d1a9b[_0xae13('0xae')],null))[_0xae13('0x26')](respondWithResult(_0x1bceda,null))[_0xae13('0x32')](handleError(_0x1bceda,null));};exports[_0xae13('0xaf')]=function(_0x51ff57,_0x388389){return db[_0xae13('0x34')][_0xae13('0x67')]({'where':{'id':_0x51ff57[_0xae13('0xab')]['id']}})[_0xae13('0x26')](handleEntityNotFound(_0x388389,null))[_0xae13('0x26')](removeEntity(_0x388389,null))[_0xae13('0x32')](handleError(_0x388389,null));};exports[_0xae13('0xb0')]=function(_0x54af8f,_0xbf1893){return db[_0xae13('0x34')][_0xae13('0xb0')]()[_0xae13('0x26')](respondWithResult(_0xbf1893,null))[_0xae13('0x32')](handleError(_0xbf1893,null));};exports['addMessage']=function(_0x5e6a58,_0x11360b,_0x1954fb){return db[_0xae13('0xb1')][_0xae13('0x67')]({'where':{'id':_0x5e6a58[_0xae13('0xab')]['id']}})[_0xae13('0x26')](handleEntityNotFound(_0x11360b,null))[_0xae13('0x26')](function(_0x175c32){if(_0x175c32){return _0x175c32['addMessage'](_0x5e6a58['body']['ids'],_['omit'](_0x5e6a58['body'],[_0xae13('0xb2'),'id'])||{});}})[_0xae13('0x26')](respondWithResult(_0x11360b,null))['catch'](handleError(_0x11360b,null));};exports[_0xae13('0xb3')]=function(_0x2c28c7,_0x5c6c94,_0x487cd2){var _0x1b7a07={'raw':![],'where':{}};var _0x4965e8={};var _0x25ac7d={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xae13('0xb4')]({'where':{'id':_0x2c28c7[_0xae13('0xab')]['id']}})[_0xae13('0x26')](handleEntityNotFound(_0x5c6c94,null))[_0xae13('0x26')](function(_0x503e97){if(_0x503e97){_0x4965e8['model']=_[_0xae13('0x3b')](db['SmsMessage'][_0xae13('0x35')]);_0x4965e8[_0xae13('0x3a')]=_['keys'](_0x2c28c7[_0xae13('0x3a')]);_0x4965e8[_0xae13('0x45')]=_[_0xae13('0x3d')](_0x4965e8[_0xae13('0x39')],_0x4965e8['query']);_0x1b7a07[_0xae13('0x3c')]=_['intersection'](_0x4965e8[_0xae13('0x39')],qs[_0xae13('0x3e')](_0x2c28c7[_0xae13('0x3a')][_0xae13('0x3e')]));_0x1b7a07['attributes']=_0x1b7a07['attributes'][_0xae13('0x5e')]?_0x1b7a07[_0xae13('0x3c')]:_0x4965e8['model'];if(!_0x2c28c7[_0xae13('0x3a')]['hasOwnProperty'](_0xae13('0xb5'))){_0x1b7a07['limit']=qs[_0xae13('0x40')](_0x2c28c7[_0xae13('0x3a')]['limit']);_0x1b7a07[_0xae13('0x22')]=qs['offset'](_0x2c28c7['query'][_0xae13('0x22')]);}_0x1b7a07[_0xae13('0x41')]=qs[_0xae13('0x42')](_0x2c28c7[_0xae13('0x3a')][_0xae13('0x42')]);_0x1b7a07[_0xae13('0x43')]=qs[_0xae13('0x45')](_['pick'](_0x2c28c7[_0xae13('0x3a')],_0x4965e8[_0xae13('0x45')]));_0x1b7a07[_0xae13('0x43')][_0xae13('0xa6')]=_0x503e97['id'];if(_0x2c28c7[_0xae13('0x3a')][_0xae13('0x7e')]){_0x1b7a07[_0xae13('0x43')]=_[_0xae13('0x94')](_0x1b7a07[_0xae13('0x43')],{'$or':_[_0xae13('0x2c')](_0x1b7a07[_0xae13('0x3c')],function(_0x47bc0f){var _0x4b5f0e={};_0x4b5f0e[_0x47bc0f]={'$like':'%'+_0x2c28c7['query'][_0xae13('0x7e')]+'%'};return _0x4b5f0e;})});}if(_0x2c28c7[_0xae13('0x3a')][_0xae13('0x74')]){var _0x188883=_0x2c28c7[_0xae13('0x3a')][_0xae13('0x74')]['split'](',');var _0x2da9e2={};_0x2da9e2[_0x188883[0x0]]={'$gte':moment(_0x188883[0x1])[_0xae13('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1b7a07['where']=_[_0xae13('0x94')](_0x1b7a07['where'],_0x2da9e2);}_0x1b7a07=_[_0xae13('0x94')]({},_0x1b7a07,_0x2c28c7[_0xae13('0xac')]);return db[_0xae13('0xb1')][_0xae13('0x21')]({'where':_0x1b7a07['where']})[_0xae13('0x26')](function(_0x52f5e1){_0x25ac7d['count']=_0x52f5e1;if(_0x2c28c7['query'][_0xae13('0xb7')]){_0x1b7a07[_0xae13('0xb8')]=[{'all':!![]}];}return db[_0xae13('0xb1')][_0xae13('0xb9')](_0x1b7a07);})[_0xae13('0x26')](function(_0x1403b9){_0x25ac7d[_0xae13('0xa9')]=_0x1403b9;return _0x25ac7d;});}})[_0xae13('0x26')](respondWithFilteredResult(_0x5c6c94,_0x1b7a07))[_0xae13('0x32')](handleError(_0x5c6c94,null));};exports['addTags']=function(_0x393ee9,_0x2c159a,_0x1cfc6d){return db[_0xae13('0x34')][_0xae13('0x67')]({'where':{'id':_0x393ee9[_0xae13('0xab')]['id']}})[_0xae13('0x26')](handleEntityNotFound(_0x2c159a,null))[_0xae13('0x26')](function(_0x1d155e){if(_0x1d155e){return _0x1d155e[_0xae13('0xba')](_0x393ee9[_0xae13('0xae')]['ids'],_[_0xae13('0xbb')](_0x393ee9[_0xae13('0xae')],[_0xae13('0xb2'),'id'])||{})[_0xae13('0xbc')](function(){return db[_0xae13('0x6b')][_0xae13('0xb9')]({'attributes':['id','name','color'],'where':{'id':_0x393ee9[_0xae13('0xae')][_0xae13('0xb2')]}});})[_0xae13('0x26')](function(_0x4955e5){socket[_0xae13('0xbd')](_0xae13('0xbe'),{'id':Number(_0x393ee9[_0xae13('0xab')]['id']),'tags':_0x4955e5||[]});return{'id':Number(_0x393ee9[_0xae13('0xab')]['id']),'tags':_0x4955e5||[]};});}})[_0xae13('0x26')](respondWithResult(_0x2c159a,null))['catch'](handleError(_0x2c159a,null));};exports[_0xae13('0xbf')]=function(_0x25c841,_0x295bb8,_0x4e7fe4){return db[_0xae13('0x34')][_0xae13('0x67')]({'where':{'id':_0x25c841[_0xae13('0xab')]['id']}})[_0xae13('0x26')](handleEntityNotFound(_0x295bb8,null))[_0xae13('0x26')](function(_0x33f6b3){if(_0x33f6b3){return _0x33f6b3[_0xae13('0xbf')](_0x25c841[_0xae13('0x3a')][_0xae13('0xb2')]);}})['then'](respondWithStatusCode(_0x295bb8,null))[_0xae13('0x32')](handleError(_0x295bb8,null));};exports[_0xae13('0xc0')]=function(_0x299bd4,_0x221b23){var _0x21b2d2=moment()[_0xae13('0xc1')]()['toString']();var _0x3f441c=path[_0xae13('0xc2')](config[_0xae13('0xc3')],_0xae13('0xc4'),_0xae13('0xc5'),'tmp');var _0xa0a63b=path['join'](config['root'],_0xae13('0xc4'),_0xae13('0xc5'),_0xae13('0xc6'));var _0x47674a=path[_0xae13('0xc2')](_0x3f441c,_0x21b2d2);var _0x173a07=util[_0xae13('0xb6')](_0xae13('0xc7'),_0x299bd4[_0xae13('0xab')]['id'],_0x21b2d2);var _0x70899a=path['join'](_0x3f441c,_0x173a07);var _0xce2ef=[];_0xce2ef['push']({'model':db[_0xae13('0xc8')],'as':_0xae13('0xc8'),'attributes':['id',_0xae13('0x2d')],'raw':!![]});_0xce2ef[_0xae13('0xa7')]({'model':db[_0xae13('0xc9')],'as':'Contact','attributes':['id',_0xae13('0xca'),_0xae13('0xcb')],'raw':!![]});var _0x41aea2=[{'model':db[_0xae13('0xb1')],'as':'Messages','attributes':['id',_0xae13('0xae'),_0xae13('0xcc'),_0xae13('0xcd'),_0xae13('0xce'),_0xae13('0x7a')],'include':_0xce2ef}];_0x41aea2[_0xae13('0xa7')]({'model':db['SmsAccount'],'as':_0xae13('0xcf'),'attributes':['id','name']});_0x41aea2[_0xae13('0xa7')]({'model':db[_0xae13('0xc8')],'as':'Owner','attributes':['id',_0xae13('0x2d')]});return db[_0xae13('0x34')][_0xae13('0x67')]({'where':{'id':_0x299bd4[_0xae13('0xab')]['id']},'include':_0x41aea2})[_0xae13('0x26')](handleEntityNotFound(_0x221b23,null))[_0xae13('0x26')](function(_0x563dd8){if(_0x563dd8){var _0x5620cd=_0x563dd8[_0xae13('0xd0')]({'plain':!![]});fs[_0xae13('0xd1')](_0x47674a);var _0x2a33e8={'format':'A4','border':_0xae13('0xd2'),'header':{'height':_0xae13('0xd3'),'contents':{'first':_0xae13('0xd4')}},'footer':{'height':_0xae13('0xd5'),'contents':{'default':util[_0xae13('0xb6')](_0xae13('0xd6'),util['format'](_0xae13('0xd7'),_0xae13('0xd8'),_0x5620cd['id']),moment()[_0xae13('0xb6')]('YYYY-MM-DD')[_0xae13('0x91')]())}}};var _0x55f6fa={'channel':_0xae13('0xd8'),'account':_0x5620cd['Account'][_0xae13('0x29')],'agent':_0x5620cd[_0xae13('0xd9')]?_0x5620cd[_0xae13('0xd9')][_0xae13('0x2d')]:_0xae13('0xda'),'createdAt':moment(_0x5620cd[_0xae13('0xcc')])['format'](_0xae13('0xdb'))['toString'](),'closedAt':_0x5620cd[_0xae13('0xdc')]?moment(_0x5620cd[_0xae13('0xdd')])[_0xae13('0xb6')](_0xae13('0xdb'))[_0xae13('0x91')]():'','disposition':_0x5620cd[_0xae13('0xde')],'messages':_(_0x5620cd[_0xae13('0xdf')])[_0xae13('0x7e')]({'secret':![]})[_0xae13('0x2c')](function(_0x5ded79){return{'date':moment(_0x5ded79['createdAt'])['format'](_0xae13('0xdb'))[_0xae13('0x91')](),'sender':_0x5ded79['direction']==='out'?_0x5ded79[_0xae13('0xc8')]?_0x5ded79[_0xae13('0xc8')][_0xae13('0x2d')]:'System':_0x5ded79['Contact']['firstName']+(_0x5ded79[_0xae13('0x62')][_0xae13('0xcb')]?'\x20'+_0x5ded79[_0xae13('0x62')]['lastName']:''),'body':_0x5ded79[_0xae13('0xae')],'direction':_0x5ded79[_0xae13('0xcd')]===_0xae13('0xe0')?'A':'C','secret':_0x5ded79['secret'],'read':_0x5ded79[_0xae13('0x7a')]};})[_0xae13('0x65')]()};return ejs[_0xae13('0xe1')](path[_0xae13('0xc2')](config['root'],'server',_0xae13('0xe2'),'downloadInteraction.html'),{'interaction':_0x55f6fa})[_0xae13('0x26')](function(_0x234810){return new BPromise(function(_0x5274c1,_0x46adf0){pdf[_0xae13('0xad')](_0x234810,_0x2a33e8)[_0xae13('0xe3')](path[_0xae13('0xc2')](_0x47674a,_0xae13('0xe4')+_0x5620cd['id']+'-'+_0x21b2d2+'.pdf'),function(_0xadfa9a,_0x39aa9c){if(_0xadfa9a)return _0x46adf0(_0xadfa9a);_0x5274c1(_0x39aa9c);});});})['then'](function(){return new BPromise(function(_0xd92578,_0x18f155){zipdir(_0x47674a,{'saveTo':_0x70899a},function(_0x415cfc,_0x166fc3){if(_0x415cfc)return _0x18f155(_0x415cfc);return _0xd92578(_0x166fc3);});})['then'](function(){return new BPromise(function(_0xaf3d6e,_0x233af8){rimraf(_0x47674a,function(_0x424a2c){if(_0x424a2c)_0x233af8(_0x424a2c);return _0xaf3d6e();});});})[_0xae13('0x26')](function(){return _0x221b23['download'](_0x70899a,_0x173a07,function(_0x4a1d38){if(_0x4a1d38){console[_0xae13('0xe5')](_0xae13('0xe6'),_0x4a1d38);}else{fs[_0xae13('0xe7')](_0x70899a);}});});});}else{return _0x221b23[_0xae13('0x1d')](0xc8);}})[_0xae13('0x32')](handleError(_0x221b23,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 7a47206..36a9da8 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 _0xeec6=['events','../../mysqldb','SmsInteraction','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','findAll','then','emit','hook'];(function(_0x20f020,_0xe32256){var _0x2307ed=function(_0xfc8c2f){while(--_0xfc8c2f){_0x20f020['push'](_0x20f020['shift']());}};_0x2307ed(++_0xe32256);}(_0xeec6,0x1c2));var _0x6eec=function(_0x447725,_0x49753b){_0x447725=_0x447725-0x0;var _0x399167=_0xeec6[_0x447725];return _0x399167;};'use strict';var EventEmitter=require(_0x6eec('0x0'));var SmsInteraction=require(_0x6eec('0x1'))['db'][_0x6eec('0x2')];var SmsMessage=require(_0x6eec('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x6eec('0x3')](0x0);var events={'afterCreate':_0x6eec('0x4'),'afterUpdate':_0x6eec('0x5'),'afterDestroy':_0x6eec('0x6')};function emitEvent(_0x3e7b6b){return function(_0x2e450c,_0x4fedce,_0x185f31){_0x2e450c[_0x6eec('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5a5e47){_0x2e450c[_0x6eec('0x8')](_0x6eec('0x9'),_0x5a5e47[_0x6eec('0xa')](function(_0x56e849){return{'id':_0x56e849['id']};}));return SmsMessage[_0x6eec('0xb')]({'where':{'SmsInteractionId':_0x2e450c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6eec('0xc')](function(_0x1c774d){_0x2e450c['setDataValue']('unreadMessages',_0x1c774d['length']);SmsInteractionEvents[_0x6eec('0xd')](_0x3e7b6b+':'+_0x2e450c['id'],_0x2e450c);SmsInteractionEvents[_0x6eec('0xd')](_0x3e7b6b,_0x2e450c);_0x185f31(null);})['catch'](_0x185f31(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x6eec('0xe')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x24ca=['remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','SmsInteraction','../../mysqldb','SmsMessage','save','update'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x24ca,0x1bc));var _0xa24c=function(_0x3a1ea5,_0x349f01){_0x3a1ea5=_0x3a1ea5-0x0;var _0xfac9b2=_0x24ca[_0x3a1ea5];return _0xfac9b2;};'use strict';var EventEmitter=require(_0xa24c('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xa24c('0x1')];var SmsMessage=require(_0xa24c('0x2'))['db'][_0xa24c('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa24c('0x4'),'afterUpdate':_0xa24c('0x5'),'afterDestroy':_0xa24c('0x6')};function emitEvent(_0x28aa2f){return function(_0xe76a30,_0x15a5cd,_0xf0511){_0xe76a30[_0xa24c('0x7')]({'attributes':['id'],'raw':!![]})[_0xa24c('0x8')](function(_0x257264){_0xe76a30[_0xa24c('0x9')]('Users',_0x257264[_0xa24c('0xa')](function(_0x3a5727){return{'id':_0x3a5727['id']};}));return SmsMessage[_0xa24c('0xb')]({'where':{'SmsInteractionId':_0xe76a30['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x399f32){_0xe76a30[_0xa24c('0x9')](_0xa24c('0xc'),_0x399f32[_0xa24c('0xd')]);SmsInteractionEvents[_0xa24c('0xe')](_0x28aa2f+':'+_0xe76a30['id'],_0xe76a30);SmsInteractionEvents[_0xa24c('0xe')](_0x28aa2f,_0xe76a30);_0xf0511(null);})[_0xa24c('0xf')](_0xf0511(null));};}for(var e in events){if(events[_0xa24c('0x10')](e)){var event=events[e];SmsInteraction[_0xa24c('0x11')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 0ca06bd..f2b9323 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 _0x3720=['./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','rimraf','../../config/environment'];(function(_0xec70c5,_0x14cae0){var _0x288d9f=function(_0x3572fa){while(--_0x3572fa){_0xec70c5['push'](_0xec70c5['shift']());}};_0x288d9f(++_0x14cae0);}(_0x3720,0x158));var _0x0372=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x3720[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0x0372('0x0'));var util=require(_0x0372('0x1'));var logger=require(_0x0372('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0372('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0372('0x4'));var config=require(_0x0372('0x5'));var attributes=require(_0x0372('0x6'));module[_0x0372('0x7')]=function(_0x544b5c,_0x2663fb){return _0x544b5c[_0x0372('0x8')](_0x0372('0x9'),attributes,{'tableName':_0x0372('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5e2b76,_0x46ecb6,_0x473677){if(_0x5e2b76['changed'](_0x0372('0xb'))){_0x5e2b76['closedAt']=moment()[_0x0372('0xc')](_0x0372('0xd'));}_0x473677(null,_0x5e2b76);}}});}; \ No newline at end of file +var _0xa91b=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x486ace,_0x2acf99){var _0x236c9b=function(_0x344ea8){while(--_0x344ea8){_0x486ace['push'](_0x486ace['shift']());}};_0x236c9b(++_0x2acf99);}(_0xa91b,0x185));var _0xba91=function(_0x6da540,_0xe10677){_0x6da540=_0x6da540-0x0;var _0x5b3d09=_0xa91b[_0x6da540];return _0x5b3d09;};'use strict';var _=require(_0xba91('0x0'));var util=require(_0xba91('0x1'));var logger=require(_0xba91('0x2'))('api');var moment=require(_0xba91('0x3'));var BPromise=require(_0xba91('0x4'));var rp=require(_0xba91('0x5'));var fs=require('fs');var path=require(_0xba91('0x6'));var rimraf=require(_0xba91('0x7'));var config=require(_0xba91('0x8'));var attributes=require(_0xba91('0x9'));module[_0xba91('0xa')]=function(_0x54b370,_0xe7fe31){return _0x54b370[_0xba91('0xb')](_0xba91('0xc'),attributes,{'tableName':_0xba91('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d1dbe,_0x35eb0b,_0x2b14d9){if(_0x3d1dbe['changed'](_0xba91('0xe'))){_0x3d1dbe['closedAt']=moment()[_0xba91('0xf')](_0xba91('0x10'));}_0x2b14d9(null,_0x3d1dbe);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 212c9a2..d9ed328 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 _0x1b0c=['socket.io-emitter','./smsInteraction.socket','register','request','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','SmsInteraction,\x20%s,\x20%s','message','result','UpdateSmsInteraction','SmsInteraction','update','body','raw','options','where','attributes','then','stringify','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x391cd8,_0x37e968){var _0x5bdf6b=function(_0x1c1cb8){while(--_0x1c1cb8){_0x391cd8['push'](_0x391cd8['shift']());}};_0x5bdf6b(++_0x37e968);}(_0x1b0c,0x105));var _0xc1b0=function(_0x435150,_0x591cd9){_0x435150=_0x435150-0x0;var _0x13b3a4=_0x1b0c[_0x435150];return _0x13b3a4;};'use strict';var _=require(_0xc1b0('0x0'));var util=require('util');var moment=require(_0xc1b0('0x1'));var BPromise=require(_0xc1b0('0x2'));var rs=require(_0xc1b0('0x3'));var fs=require('fs');var Redis=require(_0xc1b0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc1b0('0x5'));var logger=require(_0xc1b0('0x6'))(_0xc1b0('0x7'));var config=require(_0xc1b0('0x8'));var jayson=require(_0xc1b0('0x9'));var client=jayson[_0xc1b0('0xa')][_0xc1b0('0xb')]({'port':0x232a});config[_0xc1b0('0xc')]=_[_0xc1b0('0xd')](config[_0xc1b0('0xc')],{'host':_0xc1b0('0xe'),'port':0x18eb});var socket=require(_0xc1b0('0xf'))(new Redis(config['redis']));require(_0xc1b0('0x10'))[_0xc1b0('0x11')](socket);function respondWithRpcPromise(_0x25bcc3,_0x23d277,_0x53bc45){return new BPromise(function(_0x221e0b,_0x433dcd){return client[_0xc1b0('0x12')](_0x25bcc3,_0x53bc45)['then'](function(_0x485e95){logger[_0xc1b0('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x23d277,_0xc1b0('0x14'));logger[_0xc1b0('0x15')](_0xc1b0('0x16'),_0x23d277,_0xc1b0('0x14'),JSON['stringify'](_0x485e95));if(_0x485e95[_0xc1b0('0x17')]){if(_0x485e95['error'][_0xc1b0('0x18')]===0x1f4){logger[_0xc1b0('0x17')](_0xc1b0('0x19'),_0x23d277,_0x485e95[_0xc1b0('0x17')][_0xc1b0('0x1a')]);return _0x433dcd(_0x485e95[_0xc1b0('0x17')]['message']);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x23d277,_0x485e95['error'][_0xc1b0('0x1a')]);return _0x221e0b(_0x485e95[_0xc1b0('0x17')][_0xc1b0('0x1a')]);}else{logger[_0xc1b0('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x23d277,_0xc1b0('0x14'));_0x221e0b(_0x485e95[_0xc1b0('0x1b')][_0xc1b0('0x1a')]);}})['catch'](function(_0x23d77c){logger[_0xc1b0('0x17')](_0xc1b0('0x19'),_0x23d277,_0x23d77c);_0x433dcd(_0x23d77c);});});}exports[_0xc1b0('0x1c')]=function(_0x298729){var _0x5ab95d=this;return new Promise(function(_0x3bf2b9,_0x8acd4){return db[_0xc1b0('0x1d')][_0xc1b0('0x1e')](_0x298729[_0xc1b0('0x1f')],{'raw':_0x298729['options']?_0x298729['options'][_0xc1b0('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x298729[_0xc1b0('0x21')]?_0x298729['options'][_0xc1b0('0x22')]||null:null,'attributes':_0x298729[_0xc1b0('0x21')]?_0x298729['options'][_0xc1b0('0x23')]||null:null,'limit':_0x298729['options']?_0x298729[_0xc1b0('0x21')]['limit']||null:null})[_0xc1b0('0x24')](function(_0x2c4c7b){logger[_0xc1b0('0x13')]('UpdateSmsInteraction',_0x298729);logger[_0xc1b0('0x15')](_0xc1b0('0x1c'),_0x298729,JSON[_0xc1b0('0x25')](_0x2c4c7b));_0x3bf2b9(_0x2c4c7b);})['catch'](function(_0x47fbac){logger[_0xc1b0('0x17')]('UpdateSmsInteraction',_0x47fbac[_0xc1b0('0x1a')],_0x298729);_0x8acd4(_0x5ab95d[_0xc1b0('0x17')](0x1f4,_0x47fbac[_0xc1b0('0x1a')]));});});};exports[_0xc1b0('0x26')]=function(_0x3e8289){return new Promise(function(_0x33c184,_0x3b65b6){return db[_0xc1b0('0x1d')][_0xc1b0('0x27')]({'where':_0x3e8289[_0xc1b0('0x21')]?_0x3e8289[_0xc1b0('0x21')][_0xc1b0('0x22')]||null:null})['then'](function(_0xa032d2){if(_0xa032d2){return _0xa032d2[_0xc1b0('0x28')](_0x3e8289[_0xc1b0('0x1f')][_0xc1b0('0x29')],_[_0xc1b0('0x2a')](_0x3e8289['body'],[_0xc1b0('0x29'),'id'])||{});}})[_0xc1b0('0x2b')](function(_0x330cac){logger['info']('AddTags',_0x3e8289);logger[_0xc1b0('0x15')](_0xc1b0('0x2c'),_0x3e8289,JSON[_0xc1b0('0x25')](_0x330cac));_0x33c184(_0x330cac);})[_0xc1b0('0x2d')](function(_0x37062d){logger['error'](_0xc1b0('0x2c'),_0x37062d[_0xc1b0('0x1a')],_0x3e8289);_0x3b65b6(_this[_0xc1b0('0x17')](0x1f4,_0x37062d[_0xc1b0('0x1a')]));});});}; \ No newline at end of file +var _0xdd7b=['result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','limit','info','AddTagsToSmsInteraction','find','addTags','body','omit','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','then','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3531d0,_0x2d7fa6){var _0x5edec8=function(_0xb8f213){while(--_0xb8f213){_0x3531d0['push'](_0x3531d0['shift']());}};_0x5edec8(++_0x2d7fa6);}(_0xdd7b,0x178));var _0xbdd7=function(_0x45a20d,_0xf544f4){_0x45a20d=_0x45a20d-0x0;var _0x48688c=_0xdd7b[_0x45a20d];return _0x48688c;};'use strict';var _=require('lodash');var util=require(_0xbdd7('0x0'));var moment=require(_0xbdd7('0x1'));var BPromise=require('bluebird');var rs=require(_0xbdd7('0x2'));var fs=require('fs');var Redis=require(_0xbdd7('0x3'));var db=require(_0xbdd7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdd7('0x5'))(_0xbdd7('0x6'));var config=require(_0xbdd7('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbdd7('0x8')]({'port':0x232a});config[_0xbdd7('0x9')]=_[_0xbdd7('0xa')](config[_0xbdd7('0x9')],{'host':_0xbdd7('0xb'),'port':0x18eb});var socket=require(_0xbdd7('0xc'))(new Redis(config[_0xbdd7('0x9')]));require(_0xbdd7('0xd'))['register'](socket);function respondWithRpcPromise(_0x2bc4b1,_0x55dd1f,_0x4d56ce){return new BPromise(function(_0x4d1adf,_0x4c1d82){return client[_0xbdd7('0xe')](_0x2bc4b1,_0x4d56ce)[_0xbdd7('0xf')](function(_0x278f65){logger['info'](_0xbdd7('0x10'),_0x55dd1f,'request\x20sent');logger[_0xbdd7('0x11')](_0xbdd7('0x12'),_0x55dd1f,_0xbdd7('0x13'),JSON[_0xbdd7('0x14')](_0x278f65));if(_0x278f65['error']){if(_0x278f65[_0xbdd7('0x15')][_0xbdd7('0x16')]===0x1f4){logger[_0xbdd7('0x15')](_0xbdd7('0x10'),_0x55dd1f,_0x278f65['error']['message']);return _0x4c1d82(_0x278f65['error']['message']);}logger[_0xbdd7('0x15')](_0xbdd7('0x10'),_0x55dd1f,_0x278f65['error'][_0xbdd7('0x17')]);return _0x4d1adf(_0x278f65[_0xbdd7('0x15')]['message']);}else{logger['info'](_0xbdd7('0x10'),_0x55dd1f,_0xbdd7('0x13'));_0x4d1adf(_0x278f65[_0xbdd7('0x18')][_0xbdd7('0x17')]);}})[_0xbdd7('0x19')](function(_0x529fbb){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x55dd1f,_0x529fbb);_0x4c1d82(_0x529fbb);});});}exports[_0xbdd7('0x1a')]=function(_0x25930a){var _0x40b685=this;return new Promise(function(_0x3d081d,_0x5c084c){return db[_0xbdd7('0x1b')][_0xbdd7('0x1c')](_0x25930a['body'],{'raw':_0x25930a[_0xbdd7('0x1d')]?_0x25930a[_0xbdd7('0x1d')][_0xbdd7('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25930a['options']?_0x25930a[_0xbdd7('0x1d')][_0xbdd7('0x1f')]||null:null,'attributes':_0x25930a[_0xbdd7('0x1d')]?_0x25930a['options']['attributes']||null:null,'limit':_0x25930a[_0xbdd7('0x1d')]?_0x25930a[_0xbdd7('0x1d')][_0xbdd7('0x20')]||null:null})['then'](function(_0x29d2b0){logger[_0xbdd7('0x21')](_0xbdd7('0x1a'),_0x25930a);logger['debug']('UpdateSmsInteraction',_0x25930a,JSON[_0xbdd7('0x14')](_0x29d2b0));_0x3d081d(_0x29d2b0);})[_0xbdd7('0x19')](function(_0x59bfd8){logger['error']('UpdateSmsInteraction',_0x59bfd8[_0xbdd7('0x17')],_0x25930a);_0x5c084c(_0x40b685['error'](0x1f4,_0x59bfd8[_0xbdd7('0x17')]));});});};exports[_0xbdd7('0x22')]=function(_0x465734){return new Promise(function(_0x38ed8a,_0x3b164d){return db[_0xbdd7('0x1b')][_0xbdd7('0x23')]({'where':_0x465734[_0xbdd7('0x1d')]?_0x465734[_0xbdd7('0x1d')][_0xbdd7('0x1f')]||null:null})[_0xbdd7('0xf')](function(_0xc48023){if(_0xc48023){return _0xc48023[_0xbdd7('0x24')](_0x465734[_0xbdd7('0x25')]['ids'],_[_0xbdd7('0x26')](_0x465734[_0xbdd7('0x25')],['ids','id'])||{});}})['spread'](function(_0x37b234){logger['info']('AddTags',_0x465734);logger[_0xbdd7('0x11')](_0xbdd7('0x27'),_0x465734,JSON[_0xbdd7('0x14')](_0x37b234));_0x38ed8a(_0x37b234);})[_0xbdd7('0x19')](function(_0x187357){logger[_0xbdd7('0x15')](_0xbdd7('0x27'),_0x187357[_0xbdd7('0x17')],_0x465734);_0x3b164d(_this[_0xbdd7('0x15')](0x1f4,_0x187357[_0xbdd7('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 68df86b..0c9c5c5 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 _0x757a=['save','remove','emit','removeListener','register','smsInteraction:'];(function(_0x4b90b0,_0x47e2db){var _0x4789be=function(_0x13d38b){while(--_0x13d38b){_0x4b90b0['push'](_0x4b90b0['shift']());}};_0x4789be(++_0x47e2db);}(_0x757a,0xde));var _0xa757=function(_0x220328,_0x5456e7){_0x220328=_0x220328-0x0;var _0x5930e2=_0x757a[_0x220328];return _0x5930e2;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xa757('0x0'),_0xa757('0x1'),'update'];function createListener(_0x5c03c3,_0x5709ed){return function(_0x32be3b){_0x5709ed[_0xa757('0x2')](_0x5c03c3,_0x32be3b);};}function removeListener(_0x1c2932,_0x453d07){return function(){SmsInteractionEvents[_0xa757('0x3')](_0x1c2932,_0x453d07);};}exports[_0xa757('0x4')]=function(_0x5edca8){for(var _0xae0e7c=0x0,_0x4343b6=events['length'];_0xae0e7c<_0x4343b6;_0xae0e7c++){var _0x2930fa=events[_0xae0e7c];var _0x2f7793=createListener(_0xa757('0x5')+_0x2930fa,_0x5edca8);SmsInteractionEvents['on'](_0x2930fa,_0x2f7793);}}; \ No newline at end of file +var _0x0b0e=['smsInteraction:','./smsInteraction.events','remove','emit','removeListener','register'];(function(_0x420a0f,_0x43f997){var _0x9cab42=function(_0x3c839b){while(--_0x3c839b){_0x420a0f['push'](_0x420a0f['shift']());}};_0x9cab42(++_0x43f997);}(_0x0b0e,0x187));var _0xe0b0=function(_0x29632e,_0x5ecba4){_0x29632e=_0x29632e-0x0;var _0x426e04=_0x0b0e[_0x29632e];return _0x426e04;};'use strict';var SmsInteractionEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){SmsInteractionEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);SmsInteractionEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 82cf8a9..cfe1e24 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 _0x1598=['post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x4fad92,_0x562988){var _0x2636f3=function(_0x1c4719){while(--_0x1c4719){_0x4fad92['push'](_0x4fad92['shift']());}};_0x2636f3(++_0x562988);}(_0x1598,0x90));var _0x8159=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1598[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x8159('0x0'));var util=require(_0x8159('0x1'));var path=require(_0x8159('0x2'));var timeout=require('connect-timeout');var express=require(_0x8159('0x3'));var router=express[_0x8159('0x4')]();var auth=require(_0x8159('0x5'));var interaction=require(_0x8159('0x6'));var config=require(_0x8159('0x7'));var controller=require(_0x8159('0x8'));router[_0x8159('0x9')]('/',auth[_0x8159('0xa')](),controller[_0x8159('0xb')]);router[_0x8159('0x9')](_0x8159('0xc'),auth[_0x8159('0xa')](),controller[_0x8159('0xd')]);router[_0x8159('0x9')](_0x8159('0xe'),auth[_0x8159('0xa')](),controller[_0x8159('0xf')]);router[_0x8159('0x10')]('/',auth[_0x8159('0xa')](),interaction[_0x8159('0x11')](_0x8159('0x12'),_0x8159('0x13')),controller[_0x8159('0x14')]);router['post'](_0x8159('0x15'),controller[_0x8159('0x16')]);router[_0x8159('0x17')](_0x8159('0xe'),auth[_0x8159('0xa')](),controller[_0x8159('0x18')]);router[_0x8159('0x17')](_0x8159('0x19'),auth['isAuthenticated'](),controller[_0x8159('0x1a')]);router[_0x8159('0x17')](_0x8159('0x1b'),auth[_0x8159('0xa')](),controller[_0x8159('0x1c')]);router[_0x8159('0x1d')](_0x8159('0xe'),auth[_0x8159('0xa')](),controller[_0x8159('0x1e')]);module[_0x8159('0x1f')]=router; \ No newline at end of file +var _0x6ae4=['util','path','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','tracked','sms','smsmessage:create','create','post','/:id/status','status','put','/:id/accept','accept','/:id/reject','delete','destroy','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ae4,0x17f));var _0x46ae=function(_0x520480,_0x516d6a){_0x520480=_0x520480-0x0;var _0x32083e=_0x6ae4[_0x520480];return _0x32083e;};'use strict';var multer=require(_0x46ae('0x0'));var util=require(_0x46ae('0x1'));var path=require(_0x46ae('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x46ae('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x46ae('0x4'));var config=require(_0x46ae('0x5'));var controller=require('./smsMessage.controller');router[_0x46ae('0x6')]('/',auth[_0x46ae('0x7')](),controller['index']);router['get'](_0x46ae('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x46ae('0x6')](_0x46ae('0x9'),auth[_0x46ae('0x7')](),controller[_0x46ae('0xa')]);router['post']('/',auth[_0x46ae('0x7')](),interaction[_0x46ae('0xb')](_0x46ae('0xc'),_0x46ae('0xd')),controller[_0x46ae('0xe')]);router[_0x46ae('0xf')](_0x46ae('0x10'),controller[_0x46ae('0x11')]);router[_0x46ae('0x12')]('/:id',auth[_0x46ae('0x7')](),controller['update']);router[_0x46ae('0x12')](_0x46ae('0x13'),auth['isAuthenticated'](),controller[_0x46ae('0x14')]);router['put'](_0x46ae('0x15'),auth[_0x46ae('0x7')](),controller['reject']);router[_0x46ae('0x16')](_0x46ae('0x9'),auth[_0x46ae('0x7')](),controller[_0x46ae('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 196ad2f..6dac36d 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 _0x2d4d=['ENUM','out','STRING','DATE','sequelize','BOOLEAN'];(function(_0x1c28d2,_0x1e77f7){var _0x5aa5b3=function(_0x13fa11){while(--_0x13fa11){_0x1c28d2['push'](_0x1c28d2['shift']());}};_0x5aa5b3(++_0x1e77f7);}(_0x2d4d,0x94));var _0xd2d4=function(_0x1f9313,_0x191fc0){_0x1f9313=_0x1f9313-0x0;var _0x3fd3ba=_0x2d4d[_0x1f9313];return _0x3fd3ba;};'use strict';var Sequelize=require(_0xd2d4('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd2d4('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd2d4('0x2')]('in',_0xd2d4('0x3')),'defaultValue':_0xd2d4('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd2d4('0x4')](0xbe)},'phone':{'type':Sequelize[_0xd2d4('0x4')]},'readAt':{'type':Sequelize[_0xd2d4('0x5')]},'secret':{'type':Sequelize[_0xd2d4('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x0628=['out','STRING','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x42310a,_0x51c9c2){var _0x47d074=function(_0x49d387){while(--_0x49d387){_0x42310a['push'](_0x42310a['shift']());}};_0x47d074(++_0x51c9c2);}(_0x0628,0x173));var _0x8062=function(_0x27fce9,_0x55a249){_0x27fce9=_0x27fce9-0x0;var _0x28ce11=_0x0628[_0x27fce9];return _0x28ce11;};'use strict';var Sequelize=require(_0x8062('0x0'));module[_0x8062('0x1')]={'body':{'type':Sequelize[_0x8062('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8062('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8062('0x4')]('in',_0x8062('0x5')),'defaultValue':_0x8062('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8062('0x6')](0xbe)},'phone':{'type':Sequelize[_0x8062('0x6')]},'readAt':{'type':Sequelize[_0x8062('0x7')]},'secret':{'type':Sequelize[_0x8062('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 47cba65..fa1732d 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 _0x78e2=['../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','index','map','SmsMessage','key','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','keys','fields','length','find','create','body','describe','sms-interactions','accept','sms','read','readAt','format','user','CmContact','get','SmsInteraction','UserId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','agent','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','results','groupName','DELIVERED','infobip','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xdd82b4,_0x5cd8b8){var _0x549bb2=function(_0x426fd9){while(--_0x426fd9){_0xdd82b4['push'](_0xdd82b4['shift']());}};_0x549bb2(++_0x5cd8b8);}(_0x78e2,0x1a8));var _0x278e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78e2[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x278e('0x0'));var emlformat=require(_0x278e('0x1'));var rimraf=require(_0x278e('0x2'));var zipdir=require(_0x278e('0x3'));var jsonpatch=require(_0x278e('0x4'));var rp=require('request-promise');var moment=require(_0x278e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x278e('0x6'));var util=require(_0x278e('0x7'));var path=require(_0x278e('0x8'));var sox=require(_0x278e('0x9'));var csv=require(_0x278e('0xa'));var ejs=require(_0x278e('0xb'));var fs=require('fs');var _=require(_0x278e('0xc'));var squel=require(_0x278e('0xd'));var crypto=require(_0x278e('0xe'));var jsforce=require(_0x278e('0xf'));var deskjs=require(_0x278e('0x10'));var toCsv=require(_0x278e('0xa'));var querystring=require(_0x278e('0x11'));var Papa=require(_0x278e('0x12'));var Redis=require(_0x278e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x278e('0x14'));var as=require(_0x278e('0x15'));var hardwareService=require(_0x278e('0x16'));var logger=require(_0x278e('0x17'))(_0x278e('0x18'));var utils=require(_0x278e('0x19'));var config=require(_0x278e('0x1a'));var db=require('../../mysqldb')['db'];config[_0x278e('0x1b')]=_[_0x278e('0x1c')](config['redis'],{'host':_0x278e('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x278e('0x1b')]));require('./smsMessage.socket')[_0x278e('0x1e')](socket);var jayson=require(_0x278e('0x1f'));var client=jayson[_0x278e('0x20')]['http']({'port':0x232c});var client9002=jayson['client'][_0x278e('0x21')]({'port':0x232a});function checkPasswordPattern(_0x15be55,_0x58f1ec,_0x1b6300){if(_0x1b6300){var _0x2811e9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2811e9['test'](_0x58f1ec)){return _0x15be55;}else{throw new db[(_0x278e('0x22'))][(_0x278e('0x23'))](_0x278e('0x24'));}}else{return _0x15be55;}}function respondWithRpcPromise(_0x567330,_0x381cc9,_0x432285,_0x58a511){return new BPromise(function(_0x372a3e,_0x29b215){var _0x173217=_0x58a511||client;return _0x173217['request'](_0x567330,_0x432285)[_0x278e('0x25')](function(_0x56feb1){logger[_0x278e('0x26')](_0x278e('0x27'),_0x381cc9,_0x278e('0x28'));logger[_0x278e('0x29')](_0x278e('0x2a'),_0x381cc9,'request\x20sent',JSON[_0x278e('0x2b')](_0x56feb1));if(_0x56feb1[_0x278e('0x2c')]){if(_0x56feb1[_0x278e('0x2c')][_0x278e('0x2d')]===0x1f4){logger[_0x278e('0x2c')](_0x278e('0x27'),_0x381cc9,_0x56feb1[_0x278e('0x2c')][_0x278e('0x2e')]);return _0x29b215(_0x56feb1[_0x278e('0x2c')][_0x278e('0x2e')]);}logger[_0x278e('0x2c')](_0x278e('0x27'),_0x381cc9,_0x56feb1['error']['message']);return _0x372a3e(_0x56feb1['error'][_0x278e('0x2e')]);}else{logger['info'](_0x278e('0x27'),_0x381cc9,_0x278e('0x28'));_0x372a3e(_0x56feb1[_0x278e('0x2f')][_0x278e('0x2e')]);}})[_0x278e('0x30')](function(_0x5d796c){logger[_0x278e('0x2c')](_0x278e('0x27'),_0x381cc9,_0x5d796c);_0x29b215(_0x5d796c);});});}function respondWithStatusCode(_0x14fbc0,_0x20ca6a){_0x20ca6a=_0x20ca6a||0xcc;return function(_0x50cc81){if(_0x50cc81){return _0x14fbc0[_0x278e('0x31')](_0x20ca6a);}return _0x14fbc0[_0x278e('0x32')](_0x20ca6a)[_0x278e('0x33')]();};}function respondWithResult(_0x360411,_0x438aba){_0x438aba=_0x438aba||0xc8;return function(_0x236f5f){if(_0x236f5f){return _0x360411[_0x278e('0x32')](_0x438aba)['json'](_0x236f5f);}};}function respondWithFilteredResult(_0x15e100,_0x319043){return function(_0x302eec){if(_0x302eec){var _0x3f3c79=_0x302eec['count'],_0x47a14c=_0x319043[_0x278e('0x34')],_0x4c5dfd=_0x319043['offset']+_0x319043[_0x278e('0x35')],_0x48b0ad;if(_0x4c5dfd>=_0x3f3c79){_0x4c5dfd=_0x3f3c79;_0x48b0ad=0xc8;}else{_0x48b0ad=0xce;}_0x15e100['status'](_0x48b0ad);return _0x15e100[_0x278e('0x36')](_0x278e('0x37'),_0x47a14c+'-'+_0x4c5dfd+'/'+_0x3f3c79)[_0x278e('0x38')](_0x302eec);}return null;};}function patchUpdates(_0x58653e){return function(_0x4ff7ce){try{jsonpatch[_0x278e('0x39')](_0x4ff7ce,_0x58653e,!![]);}catch(_0x38d2b1){return BPromise[_0x278e('0x3a')](_0x38d2b1);}return _0x4ff7ce[_0x278e('0x3b')]();};}function saveUpdates(_0x4ed0fc,_0x8c964e){return function(_0x45bf3f){if(_0x45bf3f){return _0x45bf3f[_0x278e('0x3c')](_0x4ed0fc)['then'](function(_0x4e0514){return _0x4e0514;});}return null;};}function removeEntity(_0x4f4c69,_0x1162b5){return function(_0x120841){if(_0x120841){return _0x120841[_0x278e('0x3d')]()[_0x278e('0x25')](function(){_0x4f4c69['status'](0xcc)[_0x278e('0x33')]();});}};}function handleEntityNotFound(_0x55ba8e,_0x43ccd5){return function(_0x31bea5){if(!_0x31bea5){_0x55ba8e[_0x278e('0x31')](0x194);}return _0x31bea5;};}function handleError(_0x2c6243,_0x303756){_0x303756=_0x303756||0x1f4;return function(_0x543e1c){logger[_0x278e('0x2c')](_0x543e1c[_0x278e('0x3e')]);if(_0x543e1c[_0x278e('0x3f')]){delete _0x543e1c[_0x278e('0x3f')];}_0x2c6243[_0x278e('0x32')](_0x303756)['send'](_0x543e1c);};}exports[_0x278e('0x40')]=function(_0xd8c744,_0x1cb0dc){var _0x198f02={},_0x35470c={},_0x50bdf4={'count':0x0,'rows':[]};var _0x5b8023=_[_0x278e('0x41')](db[_0x278e('0x42')]['rawAttributes'],function(_0x9bbf40){return{'name':_0x9bbf40['fieldName'],'type':_0x9bbf40['type'][_0x278e('0x43')]};});_0x35470c['model']=_[_0x278e('0x41')](_0x5b8023,_0x278e('0x3f'));_0x35470c[_0x278e('0x44')]=_['keys'](_0xd8c744[_0x278e('0x44')]);_0x35470c[_0x278e('0x45')]=_[_0x278e('0x46')](_0x35470c[_0x278e('0x47')],_0x35470c[_0x278e('0x44')]);_0x198f02['attributes']=_['intersection'](_0x35470c[_0x278e('0x47')],qs['fields'](_0xd8c744[_0x278e('0x44')]['fields']));_0x198f02[_0x278e('0x48')]=_0x198f02[_0x278e('0x48')]['length']?_0x198f02[_0x278e('0x48')]:_0x35470c[_0x278e('0x47')];if(!_0xd8c744[_0x278e('0x44')][_0x278e('0x49')](_0x278e('0x4a'))){_0x198f02[_0x278e('0x35')]=qs[_0x278e('0x35')](_0xd8c744[_0x278e('0x44')][_0x278e('0x35')]);_0x198f02[_0x278e('0x34')]=qs[_0x278e('0x34')](_0xd8c744[_0x278e('0x44')][_0x278e('0x34')]);}_0x198f02[_0x278e('0x4b')]=qs[_0x278e('0x4c')](_0xd8c744[_0x278e('0x44')][_0x278e('0x4c')]);_0x198f02[_0x278e('0x4d')]=qs['filters'](_['pick'](_0xd8c744[_0x278e('0x44')],_0x35470c['filters']),_0x5b8023);if(_0xd8c744[_0x278e('0x44')][_0x278e('0x4e')]){_0x198f02[_0x278e('0x4d')]=_[_0x278e('0x4f')](_0x198f02[_0x278e('0x4d')],{'$or':_[_0x278e('0x41')](_0x5b8023,function(_0x38a2dc){if(_0x38a2dc[_0x278e('0x50')]!==_0x278e('0x51')){var _0x6d1d4b={};_0x6d1d4b[_0x38a2dc[_0x278e('0x3f')]]={'$like':'%'+_0xd8c744[_0x278e('0x44')][_0x278e('0x4e')]+'%'};return _0x6d1d4b;}})});}_0x198f02=_[_0x278e('0x4f')]({},_0x198f02,_0xd8c744[_0x278e('0x52')]);var _0x4b3b06={'where':_0x198f02[_0x278e('0x4d')]};return db[_0x278e('0x42')][_0x278e('0x53')](_0x4b3b06)[_0x278e('0x25')](function(_0x131441){_0x50bdf4[_0x278e('0x53')]=_0x131441;if(_0xd8c744[_0x278e('0x44')][_0x278e('0x54')]){_0x198f02[_0x278e('0x55')]=[{'all':!![]}];}return db[_0x278e('0x42')][_0x278e('0x56')](_0x198f02);})[_0x278e('0x25')](function(_0x3e00e9){_0x50bdf4[_0x278e('0x57')]=_0x3e00e9;return _0x50bdf4;})[_0x278e('0x25')](respondWithFilteredResult(_0x1cb0dc,_0x198f02))['catch'](handleError(_0x1cb0dc,null));};exports[_0x278e('0x58')]=function(_0x1092b1,_0x3e8778){var _0x5e2e3a={'raw':!![],'where':{'id':_0x1092b1[_0x278e('0x59')]['id']}},_0x85ab93={};_0x85ab93[_0x278e('0x47')]=_['keys'](db[_0x278e('0x42')][_0x278e('0x5a')]);_0x85ab93['query']=_[_0x278e('0x5b')](_0x1092b1['query']);_0x85ab93[_0x278e('0x45')]=_[_0x278e('0x46')](_0x85ab93['model'],_0x85ab93[_0x278e('0x44')]);_0x5e2e3a['attributes']=_[_0x278e('0x46')](_0x85ab93['model'],qs[_0x278e('0x5c')](_0x1092b1[_0x278e('0x44')]['fields']));_0x5e2e3a['attributes']=_0x5e2e3a[_0x278e('0x48')][_0x278e('0x5d')]?_0x5e2e3a[_0x278e('0x48')]:_0x85ab93[_0x278e('0x47')];if(_0x1092b1[_0x278e('0x44')][_0x278e('0x54')]){_0x5e2e3a[_0x278e('0x55')]=[{'all':!![]}];}_0x5e2e3a=_[_0x278e('0x4f')]({},_0x5e2e3a,_0x1092b1['options']);return db[_0x278e('0x42')][_0x278e('0x5e')](_0x5e2e3a)['then'](handleEntityNotFound(_0x3e8778,null))[_0x278e('0x25')](respondWithResult(_0x3e8778,null))[_0x278e('0x30')](handleError(_0x3e8778,null));};exports[_0x278e('0x5f')]=function(_0x48ba2d,_0x5053c9){return db[_0x278e('0x42')][_0x278e('0x5f')](_0x48ba2d[_0x278e('0x60')],{})[_0x278e('0x25')](respondWithResult(_0x5053c9,0xc9))['catch'](handleError(_0x5053c9,null));};exports[_0x278e('0x3c')]=function(_0x269df2,_0x489319){if(_0x269df2['body']['id']){delete _0x269df2[_0x278e('0x60')]['id'];}return db[_0x278e('0x42')][_0x278e('0x5e')]({'where':{'id':_0x269df2[_0x278e('0x59')]['id']}})[_0x278e('0x25')](handleEntityNotFound(_0x489319,null))[_0x278e('0x25')](saveUpdates(_0x269df2[_0x278e('0x60')],null))[_0x278e('0x25')](respondWithResult(_0x489319,null))[_0x278e('0x30')](handleError(_0x489319,null));};exports[_0x278e('0x3d')]=function(_0x321edb,_0x5be8f7){return db['SmsMessage']['find']({'where':{'id':_0x321edb[_0x278e('0x59')]['id']}})[_0x278e('0x25')](handleEntityNotFound(_0x5be8f7,null))[_0x278e('0x25')](removeEntity(_0x5be8f7,null))[_0x278e('0x30')](handleError(_0x5be8f7,null));};exports[_0x278e('0x61')]=function(_0x1422e2,_0x143de2){return db[_0x278e('0x42')][_0x278e('0x61')]()[_0x278e('0x25')](respondWithResult(_0x143de2,null))[_0x278e('0x30')](handleError(_0x143de2,null));};var interaction_log=require(_0x278e('0x17'))(_0x278e('0x62'));exports[_0x278e('0x63')]=function(_0x224486,_0x3e984f,_0x6a6442){var _0x28bfa3={'channel':_0x278e('0x64')};if(_0x224486[_0x278e('0x60')]['id']){delete _0x224486[_0x278e('0x60')]['id'];}_0x224486[_0x278e('0x60')][_0x278e('0x65')]=!![];_0x224486['body'][_0x278e('0x66')]=moment()[_0x278e('0x67')]('YYYY-MM-DD\x20HH:mm:ss');_0x224486[_0x278e('0x60')]['UserId']=_0x224486['body']['UserId']||_0x224486[_0x278e('0x68')]['id'];return db['SmsMessage'][_0x278e('0x5e')]({'where':{'id':_0x224486[_0x278e('0x59')]['id'],'UserId':null},'include':[{'model':db[_0x278e('0x69')],'as':'Contact'}]})[_0x278e('0x25')](handleEntityNotFound(_0x3e984f,null))[_0x278e('0x25')](saveUpdates(_0x224486[_0x278e('0x60')],null))[_0x278e('0x25')](function(_0x3a6632){if(_0x3a6632){_0x28bfa3[_0x278e('0x2e')]=_0x3a6632[_0x278e('0x6a')]({'plain':!![]});return db[_0x278e('0x6b')][_0x278e('0x5e')]({'where':{'id':_0x3a6632['SmsInteractionId']}});}return null;})[_0x278e('0x25')](handleEntityNotFound(_0x3e984f,null))[_0x278e('0x25')](function(_0x36df08){if(_0x36df08){return _0x36df08[_0x278e('0x3c')]({'UserId':_0x224486['body'][_0x278e('0x6c')],'read1stAt':_[_0x278e('0x6d')](_0x36df08[_0x278e('0x6e')])?moment()[_0x278e('0x67')](_0x278e('0x6f')):undefined});}return null;})[_0x278e('0x25')](function(_0x2a13f8){if(_0x2a13f8){_0x28bfa3[_0x278e('0x70')]=_0x2a13f8['get']({'plain':!![]});interaction_log[_0x278e('0x26')](_0x278e('0x71'),_0x224486['user']['id'],_0x224486[_0x278e('0x68')][_0x278e('0x3f')],_0x224486[_0x278e('0x68')]['role'],_0x28bfa3[_0x278e('0x70')]['id'],_0x224486[_0x278e('0x60')]?JSON[_0x278e('0x2b')](_0x224486['body']):_0x278e('0x72'));return respondWithRpcPromise(_0x278e('0x73'),_0x278e('0x74'),_0x28bfa3);}return null;})[_0x278e('0x25')](function(_0x5a4215){if(_0x5a4215){if(_0x224486[_0x278e('0x60')][_0x278e('0x75')]){_0x28bfa3[_0x278e('0x2e')][_0x278e('0x76')]=util[_0x278e('0x67')](_0x278e('0x77'),_0x224486[_0x278e('0x68')][_0x278e('0x3f')]);_0x28bfa3[_0x278e('0x2e')][_0x278e('0x78')]=_0x28bfa3['channel'];_0x28bfa3['message'][_0x278e('0x79')]=_0x278e('0x63');return respondWithRpcPromise(_0x278e('0x7a'),_0x278e('0x7a'),{'event':'acceptmessage','message':_0x28bfa3['message']},client9002)[_0x278e('0x25')](function(){return _0x28bfa3;});}return _0x28bfa3;}return null;})[_0x278e('0x25')](respondWithResult(_0x3e984f,null))[_0x278e('0x30')](handleError(_0x3e984f,null));};var interaction_log=require(_0x278e('0x17'))(_0x278e('0x62'));exports['reject']=function(_0x3e1112,_0x2497ce,_0x558ddc){var _0x19fdc3={'agent':{},'channel':_0x278e('0x64')};if(_0x3e1112['body']['id']){delete _0x3e1112['body']['id'];}_0x3e1112[_0x278e('0x60')]['UserId']=_0x3e1112[_0x278e('0x60')][_0x278e('0x6c')]||_0x3e1112[_0x278e('0x68')]['id'];_0x19fdc3[_0x278e('0x7b')]['id']=_0x3e1112[_0x278e('0x60')][_0x278e('0x6c')];return db[_0x278e('0x42')]['find']({'where':{'id':_0x3e1112[_0x278e('0x59')]['id'],'UserId':null}})[_0x278e('0x25')](handleEntityNotFound(_0x2497ce,null))[_0x278e('0x25')](function(_0x4c4c4e){if(_0x4c4c4e){_0x19fdc3[_0x278e('0x2e')]=_0x4c4c4e[_0x278e('0x6a')]({'plain':!![]});return db[_0x278e('0x6b')][_0x278e('0x5e')]({'where':{'id':_0x4c4c4e[_0x278e('0x7c')]}});}return null;})['then'](handleEntityNotFound(_0x2497ce,null))[_0x278e('0x25')](function(_0x2a189d){if(_0x2a189d){_0x19fdc3[_0x278e('0x70')]=_0x2a189d[_0x278e('0x6a')]({'plain':!![]});interaction_log[_0x278e('0x26')](_0x278e('0x7d'),_0x3e1112[_0x278e('0x68')]['id'],_0x3e1112[_0x278e('0x68')][_0x278e('0x3f')],_0x3e1112[_0x278e('0x68')][_0x278e('0x7e')],_0x19fdc3[_0x278e('0x70')]['id'],_0x3e1112['body']?JSON['stringify'](_0x3e1112['body']):_0x278e('0x72'));return respondWithRpcPromise(_0x278e('0x7f'),_0x278e('0x80'),_0x19fdc3);}return null;})[_0x278e('0x25')](function(_0x492382){if(_0x492382){_0x492382[_0x278e('0x2e')]['interface']=util[_0x278e('0x67')](_0x278e('0x77'),_0x3e1112[_0x278e('0x68')][_0x278e('0x3f')]);_0x492382[_0x278e('0x2e')][_0x278e('0x78')]=_0x19fdc3[_0x278e('0x78')];_0x492382['message'][_0x278e('0x79')]=_0x278e('0x3a');respondWithRpcPromise(_0x278e('0x7a'),_0x278e('0x7a'),{'event':_0x278e('0x81'),'message':_0x492382['message']},client9002);return _0x19fdc3;}return null;})['then'](respondWithResult(_0x2497ce,null))['catch'](handleError(_0x2497ce,null));};exports['status']=function(_0x54d9fe,_0x2498a1,_0x3cc9fb){if(_0x54d9fe[_0x278e('0x60')]['id']){delete _0x54d9fe[_0x278e('0x60')]['id'];}var _0x2bf38b;return db[_0x278e('0x42')]['find']({'where':{'id':_0x54d9fe[_0x278e('0x59')]['id']}})[_0x278e('0x25')](handleEntityNotFound(_0x2498a1,null))[_0x278e('0x25')](function(_0x563ba6){if(_0x563ba6){_0x2bf38b=_0x563ba6;return db[_0x278e('0x82')][_0x278e('0x5e')]({'where':{'id':_0x563ba6[_0x278e('0x83')]}});}})[_0x278e('0x25')](handleEntityNotFound(_0x2498a1,null))[_0x278e('0x25')](function(_0x4c77ca){if(_0x4c77ca){logger['debug'](_0x278e('0x2a'),_0x278e('0x32'),_0x278e('0x84'),_0x4c77ca[_0x278e('0x50')],util[_0x278e('0x85')](_0x54d9fe[_0x278e('0x60')],{'showHidden':![],'depth':null}));switch(_0x4c77ca[_0x278e('0x50')]){case _0x278e('0x86'):if(_0x54d9fe['body'][_0x278e('0x87')]&&_0x54d9fe[_0x278e('0x60')]['MessageSid']===_0x2bf38b[_0x278e('0x88')]){return _0x2bf38b['update']({'read':!![]});}else{logger[_0x278e('0x2c')](_0x278e('0x89'),_0x278e('0x32'),_0x278e('0x86'),util['inspect'](_0x54d9fe[_0x278e('0x60')],{'showHidden':![],'depth':null}));}break;case _0x278e('0x8a'):if(_0x54d9fe[_0x278e('0x60')][_0x278e('0x8b')]&&_0x54d9fe[_0x278e('0x60')][_0x278e('0x8b')]===_0x2bf38b[_0x278e('0x88')]&&_[_0x278e('0x8c')]([_0x278e('0x8d'),_0x278e('0x8e')],_0x54d9fe[_0x278e('0x60')][_0x278e('0x8f')])>=0x0){return _0x2bf38b[_0x278e('0x3c')]({'read':!![]});}else{logger[_0x278e('0x2c')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x278e('0x90'),util[_0x278e('0x85')](_0x54d9fe['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x3066d9=_0x54d9fe['body'][_0x278e('0x91')][0x0];if(_0x3066d9[_0x278e('0x32')][_0x278e('0x92')]===_0x278e('0x93')){return _0x2bf38b[_0x278e('0x3c')]({'read':!![]});}else{logger[_0x278e('0x2c')](_0x278e('0x89'),'status',_0x278e('0x94'),util[_0x278e('0x85')](_0x54d9fe[_0x278e('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x2bf38b;}})[_0x278e('0x25')](respondWithResult(_0x2498a1,null))[_0x278e('0x30')](handleError(_0x2498a1,null));}; \ No newline at end of file +var _0x8ce8=['keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','params','find','create','body','update','describe','sms-interactions','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','user','SmsInteractionId','UserId','isNil','read1stAt','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','interface','EventManager','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','type','MessageSid','twilio','plivo','MessageUUID','messageId','sent','delivered','Status','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','inspect','infobip','results','groupName','DELIVERED','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','./smsMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','name','send','SmsMessage','rawAttributes','fieldName','key','model','map'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x8ce8,0xd3));var _0x88ce=function(_0x3592f0,_0x56b8b9){_0x3592f0=_0x3592f0-0x0;var _0x4c13ac=_0x8ce8[_0x3592f0];return _0x4c13ac;};'use strict';var pdf=require(_0x88ce('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x88ce('0x1'));var zipdir=require(_0x88ce('0x2'));var jsonpatch=require(_0x88ce('0x3'));var rp=require(_0x88ce('0x4'));var moment=require(_0x88ce('0x5'));var BPromise=require(_0x88ce('0x6'));var Mustache=require(_0x88ce('0x7'));var util=require(_0x88ce('0x8'));var path=require(_0x88ce('0x9'));var sox=require(_0x88ce('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x88ce('0xb'));var squel=require(_0x88ce('0xc'));var crypto=require(_0x88ce('0xd'));var jsforce=require(_0x88ce('0xe'));var deskjs=require(_0x88ce('0xf'));var toCsv=require('to-csv');var querystring=require(_0x88ce('0x10'));var Papa=require('papaparse');var Redis=require(_0x88ce('0x11'));var authService=require(_0x88ce('0x12'));var qs=require(_0x88ce('0x13'));var as=require(_0x88ce('0x14'));var hardwareService=require(_0x88ce('0x15'));var logger=require(_0x88ce('0x16'))(_0x88ce('0x17'));var utils=require(_0x88ce('0x18'));var config=require('../../config/environment');var db=require(_0x88ce('0x19'))['db'];config['redis']=_[_0x88ce('0x1a')](config[_0x88ce('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x88ce('0x1b')]));require(_0x88ce('0x1c'))[_0x88ce('0x1d')](socket);var jayson=require(_0x88ce('0x1e'));var client=jayson[_0x88ce('0x1f')][_0x88ce('0x20')]({'port':0x232c});var client9002=jayson[_0x88ce('0x1f')]['http']({'port':0x232a});function checkPasswordPattern(_0x3460e5,_0x5bcd5a,_0x3da93e){if(_0x3da93e){var _0x58d3da=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x58d3da[_0x88ce('0x21')](_0x5bcd5a)){return _0x3460e5;}else{throw new db[(_0x88ce('0x22'))][(_0x88ce('0x23'))](_0x88ce('0x24'));}}else{return _0x3460e5;}}function respondWithRpcPromise(_0x509a84,_0x50c9df,_0xdb0d1f,_0x65fa81){return new BPromise(function(_0x404df9,_0x338eff){var _0xa60138=_0x65fa81||client;return _0xa60138[_0x88ce('0x25')](_0x509a84,_0xdb0d1f)[_0x88ce('0x26')](function(_0x2fa7ac){logger[_0x88ce('0x27')](_0x88ce('0x28'),_0x50c9df,_0x88ce('0x29'));logger[_0x88ce('0x2a')](_0x88ce('0x2b'),_0x50c9df,_0x88ce('0x29'),JSON[_0x88ce('0x2c')](_0x2fa7ac));if(_0x2fa7ac[_0x88ce('0x2d')]){if(_0x2fa7ac['error'][_0x88ce('0x2e')]===0x1f4){logger[_0x88ce('0x2d')](_0x88ce('0x28'),_0x50c9df,_0x2fa7ac[_0x88ce('0x2d')][_0x88ce('0x2f')]);return _0x338eff(_0x2fa7ac['error']['message']);}logger['error'](_0x88ce('0x28'),_0x50c9df,_0x2fa7ac[_0x88ce('0x2d')][_0x88ce('0x2f')]);return _0x404df9(_0x2fa7ac['error']['message']);}else{logger[_0x88ce('0x27')](_0x88ce('0x28'),_0x50c9df,_0x88ce('0x29'));_0x404df9(_0x2fa7ac[_0x88ce('0x30')][_0x88ce('0x2f')]);}})[_0x88ce('0x31')](function(_0x19f00f){logger[_0x88ce('0x2d')](_0x88ce('0x28'),_0x50c9df,_0x19f00f);_0x338eff(_0x19f00f);});});}function respondWithStatusCode(_0x40aa83,_0x4209bc){_0x4209bc=_0x4209bc||0xcc;return function(_0x11ef49){if(_0x11ef49){return _0x40aa83[_0x88ce('0x32')](_0x4209bc);}return _0x40aa83[_0x88ce('0x33')](_0x4209bc)[_0x88ce('0x34')]();};}function respondWithResult(_0x1814d1,_0x47bbff){_0x47bbff=_0x47bbff||0xc8;return function(_0x4f4205){if(_0x4f4205){return _0x1814d1['status'](_0x47bbff)[_0x88ce('0x35')](_0x4f4205);}};}function respondWithFilteredResult(_0x4221c1,_0x6ea7e0){return function(_0x2fe609){if(_0x2fe609){var _0x544be7=_0x2fe609[_0x88ce('0x36')],_0x28e7a4=_0x6ea7e0[_0x88ce('0x37')],_0x2c9027=_0x6ea7e0[_0x88ce('0x37')]+_0x6ea7e0[_0x88ce('0x38')],_0x326ebe;if(_0x2c9027>=_0x544be7){_0x2c9027=_0x544be7;_0x326ebe=0xc8;}else{_0x326ebe=0xce;}_0x4221c1['status'](_0x326ebe);return _0x4221c1[_0x88ce('0x39')](_0x88ce('0x3a'),_0x28e7a4+'-'+_0x2c9027+'/'+_0x544be7)['json'](_0x2fe609);}return null;};}function patchUpdates(_0x404e3e){return function(_0x19775d){try{jsonpatch[_0x88ce('0x3b')](_0x19775d,_0x404e3e,!![]);}catch(_0x24fbbe){return BPromise[_0x88ce('0x3c')](_0x24fbbe);}return _0x19775d[_0x88ce('0x3d')]();};}function saveUpdates(_0x21e585,_0x12bcfa){return function(_0x410b52){if(_0x410b52){return _0x410b52['update'](_0x21e585)[_0x88ce('0x26')](function(_0x1da20a){return _0x1da20a;});}return null;};}function removeEntity(_0x1b1275,_0x4e6d98){return function(_0x3a51da){if(_0x3a51da){return _0x3a51da[_0x88ce('0x3e')]()['then'](function(){_0x1b1275['status'](0xcc)[_0x88ce('0x34')]();});}};}function handleEntityNotFound(_0x274e20,_0x19d91c){return function(_0x1e25ca){if(!_0x1e25ca){_0x274e20[_0x88ce('0x32')](0x194);}return _0x1e25ca;};}function handleError(_0x3639b8,_0x5140bd){_0x5140bd=_0x5140bd||0x1f4;return function(_0x79e5fb){logger[_0x88ce('0x2d')](_0x79e5fb['stack']);if(_0x79e5fb[_0x88ce('0x3f')]){delete _0x79e5fb[_0x88ce('0x3f')];}_0x3639b8['status'](_0x5140bd)[_0x88ce('0x40')](_0x79e5fb);};}exports['index']=function(_0x4149ff,_0x2268a6){var _0x3fa24f={},_0x2c2ec1={},_0x378436={'count':0x0,'rows':[]};var _0x96f54c=_['map'](db[_0x88ce('0x41')][_0x88ce('0x42')],function(_0x24172a){return{'name':_0x24172a[_0x88ce('0x43')],'type':_0x24172a['type'][_0x88ce('0x44')]};});_0x2c2ec1[_0x88ce('0x45')]=_[_0x88ce('0x46')](_0x96f54c,'name');_0x2c2ec1['query']=_[_0x88ce('0x47')](_0x4149ff[_0x88ce('0x48')]);_0x2c2ec1[_0x88ce('0x49')]=_['intersection'](_0x2c2ec1[_0x88ce('0x45')],_0x2c2ec1[_0x88ce('0x48')]);_0x3fa24f['attributes']=_[_0x88ce('0x4a')](_0x2c2ec1[_0x88ce('0x45')],qs[_0x88ce('0x4b')](_0x4149ff[_0x88ce('0x48')][_0x88ce('0x4b')]));_0x3fa24f['attributes']=_0x3fa24f[_0x88ce('0x4c')][_0x88ce('0x4d')]?_0x3fa24f[_0x88ce('0x4c')]:_0x2c2ec1[_0x88ce('0x45')];if(!_0x4149ff[_0x88ce('0x48')][_0x88ce('0x4e')](_0x88ce('0x4f'))){_0x3fa24f['limit']=qs[_0x88ce('0x38')](_0x4149ff[_0x88ce('0x48')]['limit']);_0x3fa24f[_0x88ce('0x37')]=qs[_0x88ce('0x37')](_0x4149ff['query']['offset']);}_0x3fa24f['order']=qs[_0x88ce('0x50')](_0x4149ff[_0x88ce('0x48')][_0x88ce('0x50')]);_0x3fa24f[_0x88ce('0x51')]=qs[_0x88ce('0x49')](_[_0x88ce('0x52')](_0x4149ff[_0x88ce('0x48')],_0x2c2ec1['filters']),_0x96f54c);if(_0x4149ff[_0x88ce('0x48')]['filter']){_0x3fa24f[_0x88ce('0x51')]=_[_0x88ce('0x53')](_0x3fa24f[_0x88ce('0x51')],{'$or':_['map'](_0x96f54c,function(_0x32e0c0){if(_0x32e0c0['type']!==_0x88ce('0x54')){var _0x44b75c={};_0x44b75c[_0x32e0c0[_0x88ce('0x3f')]]={'$like':'%'+_0x4149ff[_0x88ce('0x48')][_0x88ce('0x55')]+'%'};return _0x44b75c;}})});}_0x3fa24f=_[_0x88ce('0x53')]({},_0x3fa24f,_0x4149ff[_0x88ce('0x56')]);var _0x530800={'where':_0x3fa24f[_0x88ce('0x51')]};return db[_0x88ce('0x41')][_0x88ce('0x36')](_0x530800)[_0x88ce('0x26')](function(_0x4a3836){_0x378436['count']=_0x4a3836;if(_0x4149ff[_0x88ce('0x48')][_0x88ce('0x57')]){_0x3fa24f[_0x88ce('0x58')]=[{'all':!![]}];}return db[_0x88ce('0x41')][_0x88ce('0x59')](_0x3fa24f);})[_0x88ce('0x26')](function(_0x4e4933){_0x378436['rows']=_0x4e4933;return _0x378436;})['then'](respondWithFilteredResult(_0x2268a6,_0x3fa24f))[_0x88ce('0x31')](handleError(_0x2268a6,null));};exports['show']=function(_0x5c2231,_0x47d0c7){var _0x13e84f={'raw':!![],'where':{'id':_0x5c2231[_0x88ce('0x5a')]['id']}},_0x53dcf9={};_0x53dcf9[_0x88ce('0x45')]=_[_0x88ce('0x47')](db[_0x88ce('0x41')][_0x88ce('0x42')]);_0x53dcf9[_0x88ce('0x48')]=_['keys'](_0x5c2231['query']);_0x53dcf9[_0x88ce('0x49')]=_[_0x88ce('0x4a')](_0x53dcf9[_0x88ce('0x45')],_0x53dcf9[_0x88ce('0x48')]);_0x13e84f['attributes']=_['intersection'](_0x53dcf9[_0x88ce('0x45')],qs[_0x88ce('0x4b')](_0x5c2231[_0x88ce('0x48')][_0x88ce('0x4b')]));_0x13e84f[_0x88ce('0x4c')]=_0x13e84f[_0x88ce('0x4c')][_0x88ce('0x4d')]?_0x13e84f[_0x88ce('0x4c')]:_0x53dcf9[_0x88ce('0x45')];if(_0x5c2231[_0x88ce('0x48')][_0x88ce('0x57')]){_0x13e84f[_0x88ce('0x58')]=[{'all':!![]}];}_0x13e84f=_[_0x88ce('0x53')]({},_0x13e84f,_0x5c2231['options']);return db[_0x88ce('0x41')][_0x88ce('0x5b')](_0x13e84f)[_0x88ce('0x26')](handleEntityNotFound(_0x47d0c7,null))[_0x88ce('0x26')](respondWithResult(_0x47d0c7,null))[_0x88ce('0x31')](handleError(_0x47d0c7,null));};exports[_0x88ce('0x5c')]=function(_0x59ba17,_0x16bba0){return db['SmsMessage'][_0x88ce('0x5c')](_0x59ba17[_0x88ce('0x5d')],{})[_0x88ce('0x26')](respondWithResult(_0x16bba0,0xc9))[_0x88ce('0x31')](handleError(_0x16bba0,null));};exports[_0x88ce('0x5e')]=function(_0x4ab8da,_0x39432f){if(_0x4ab8da[_0x88ce('0x5d')]['id']){delete _0x4ab8da['body']['id'];}return db[_0x88ce('0x41')]['find']({'where':{'id':_0x4ab8da[_0x88ce('0x5a')]['id']}})[_0x88ce('0x26')](handleEntityNotFound(_0x39432f,null))[_0x88ce('0x26')](saveUpdates(_0x4ab8da['body'],null))[_0x88ce('0x26')](respondWithResult(_0x39432f,null))[_0x88ce('0x31')](handleError(_0x39432f,null));};exports[_0x88ce('0x3e')]=function(_0x1988ab,_0x317321){return db[_0x88ce('0x41')][_0x88ce('0x5b')]({'where':{'id':_0x1988ab[_0x88ce('0x5a')]['id']}})[_0x88ce('0x26')](handleEntityNotFound(_0x317321,null))['then'](removeEntity(_0x317321,null))['catch'](handleError(_0x317321,null));};exports[_0x88ce('0x5f')]=function(_0x1d213d,_0x25f269){return db['SmsMessage'][_0x88ce('0x5f')]()['then'](respondWithResult(_0x25f269,null))['catch'](handleError(_0x25f269,null));};var interaction_log=require('../../config/logger')(_0x88ce('0x60'));exports['accept']=function(_0xaf4625,_0xe02ae1,_0x1fbf55){var _0x4a6af7={'channel':_0x88ce('0x61')};if(_0xaf4625['body']['id']){delete _0xaf4625[_0x88ce('0x5d')]['id'];}_0xaf4625[_0x88ce('0x5d')][_0x88ce('0x62')]=!![];_0xaf4625[_0x88ce('0x5d')]['readAt']=moment()[_0x88ce('0x63')](_0x88ce('0x64'));_0xaf4625[_0x88ce('0x5d')]['UserId']=_0xaf4625['body']['UserId']||_0xaf4625[_0x88ce('0x65')]['id'];return db[_0x88ce('0x41')][_0x88ce('0x5b')]({'where':{'id':_0xaf4625[_0x88ce('0x5a')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})['then'](handleEntityNotFound(_0xe02ae1,null))[_0x88ce('0x26')](saveUpdates(_0xaf4625[_0x88ce('0x5d')],null))[_0x88ce('0x26')](function(_0x1e7487){if(_0x1e7487){_0x4a6af7[_0x88ce('0x2f')]=_0x1e7487['get']({'plain':!![]});return db['SmsInteraction'][_0x88ce('0x5b')]({'where':{'id':_0x1e7487[_0x88ce('0x66')]}});}return null;})[_0x88ce('0x26')](handleEntityNotFound(_0xe02ae1,null))[_0x88ce('0x26')](function(_0x385288){if(_0x385288){return _0x385288['update']({'UserId':_0xaf4625['body'][_0x88ce('0x67')],'read1stAt':_[_0x88ce('0x68')](_0x385288[_0x88ce('0x69')])?moment()[_0x88ce('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x88ce('0x26')](function(_0x4e8c71){if(_0x4e8c71){_0x4a6af7['interaction']=_0x4e8c71[_0x88ce('0x6a')]({'plain':!![]});interaction_log[_0x88ce('0x27')](_0x88ce('0x6b'),_0xaf4625[_0x88ce('0x65')]['id'],_0xaf4625[_0x88ce('0x65')][_0x88ce('0x3f')],_0xaf4625[_0x88ce('0x65')][_0x88ce('0x6c')],_0x4a6af7[_0x88ce('0x6d')]['id'],_0xaf4625[_0x88ce('0x5d')]?JSON[_0x88ce('0x2c')](_0xaf4625[_0x88ce('0x5d')]):_0x88ce('0x6e'));return respondWithRpcPromise(_0x88ce('0x6f'),_0x88ce('0x70'),_0x4a6af7);}return null;})[_0x88ce('0x26')](function(_0xde1b4f){if(_0xde1b4f){if(_0xaf4625[_0x88ce('0x5d')][_0x88ce('0x71')]){_0x4a6af7['message']['interface']=util[_0x88ce('0x63')](_0x88ce('0x72'),_0xaf4625[_0x88ce('0x65')]['name']);_0x4a6af7[_0x88ce('0x2f')]['channel']=_0x4a6af7[_0x88ce('0x73')];_0x4a6af7[_0x88ce('0x2f')][_0x88ce('0x74')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x4a6af7['message']},client9002)['then'](function(){return _0x4a6af7;});}return _0x4a6af7;}return null;})[_0x88ce('0x26')](respondWithResult(_0xe02ae1,null))[_0x88ce('0x31')](handleError(_0xe02ae1,null));};var interaction_log=require('../../config/logger')(_0x88ce('0x60'));exports[_0x88ce('0x3c')]=function(_0x46b254,_0x13092e,_0x3878e7){var _0x363992={'agent':{},'channel':_0x88ce('0x61')};if(_0x46b254[_0x88ce('0x5d')]['id']){delete _0x46b254[_0x88ce('0x5d')]['id'];}_0x46b254[_0x88ce('0x5d')][_0x88ce('0x67')]=_0x46b254[_0x88ce('0x5d')][_0x88ce('0x67')]||_0x46b254['user']['id'];_0x363992['agent']['id']=_0x46b254[_0x88ce('0x5d')][_0x88ce('0x67')];return db[_0x88ce('0x41')][_0x88ce('0x5b')]({'where':{'id':_0x46b254['params']['id'],'UserId':null}})[_0x88ce('0x26')](handleEntityNotFound(_0x13092e,null))[_0x88ce('0x26')](function(_0x8bec41){if(_0x8bec41){_0x363992['message']=_0x8bec41['get']({'plain':!![]});return db[_0x88ce('0x75')][_0x88ce('0x5b')]({'where':{'id':_0x8bec41[_0x88ce('0x66')]}});}return null;})[_0x88ce('0x26')](handleEntityNotFound(_0x13092e,null))['then'](function(_0x44f25a){if(_0x44f25a){_0x363992[_0x88ce('0x6d')]=_0x44f25a[_0x88ce('0x6a')]({'plain':!![]});interaction_log[_0x88ce('0x27')](_0x88ce('0x76'),_0x46b254[_0x88ce('0x65')]['id'],_0x46b254[_0x88ce('0x65')][_0x88ce('0x3f')],_0x46b254[_0x88ce('0x65')][_0x88ce('0x6c')],_0x363992[_0x88ce('0x6d')]['id'],_0x46b254['body']?JSON[_0x88ce('0x2c')](_0x46b254[_0x88ce('0x5d')]):_0x88ce('0x6e'));return respondWithRpcPromise(_0x88ce('0x77'),'rejectMessage',_0x363992);}return null;})[_0x88ce('0x26')](function(_0x19ba1b){if(_0x19ba1b){_0x19ba1b['message'][_0x88ce('0x78')]=util[_0x88ce('0x63')](_0x88ce('0x72'),_0x46b254[_0x88ce('0x65')][_0x88ce('0x3f')]);_0x19ba1b[_0x88ce('0x2f')]['channel']=_0x363992['channel'];_0x19ba1b[_0x88ce('0x2f')][_0x88ce('0x74')]='reject';respondWithRpcPromise('EventManager',_0x88ce('0x79'),{'event':_0x88ce('0x7a'),'message':_0x19ba1b[_0x88ce('0x2f')]},client9002);return _0x363992;}return null;})[_0x88ce('0x26')](respondWithResult(_0x13092e,null))[_0x88ce('0x31')](handleError(_0x13092e,null));};exports[_0x88ce('0x33')]=function(_0x1ea61b,_0x1c613d,_0x5a3566){if(_0x1ea61b[_0x88ce('0x5d')]['id']){delete _0x1ea61b[_0x88ce('0x5d')]['id'];}var _0x2b00ec;return db[_0x88ce('0x41')][_0x88ce('0x5b')]({'where':{'id':_0x1ea61b['params']['id']}})[_0x88ce('0x26')](handleEntityNotFound(_0x1c613d,null))[_0x88ce('0x26')](function(_0x2523d8){if(_0x2523d8){_0x2b00ec=_0x2523d8;return db[_0x88ce('0x7b')]['find']({'where':{'id':_0x2523d8['SmsAccountId']}});}})[_0x88ce('0x26')](handleEntityNotFound(_0x1c613d,null))[_0x88ce('0x26')](function(_0x1c5849){if(_0x1c5849){logger[_0x88ce('0x2a')](_0x88ce('0x2b'),_0x88ce('0x33'),_0x88ce('0x7c'),_0x1c5849[_0x88ce('0x7d')],util['inspect'](_0x1ea61b[_0x88ce('0x5d')],{'showHidden':![],'depth':null}));switch(_0x1c5849[_0x88ce('0x7d')]){case'twilio':if(_0x1ea61b['body'][_0x88ce('0x7e')]&&_0x1ea61b[_0x88ce('0x5d')]['MessageSid']===_0x2b00ec['messageId']){return _0x2b00ec['update']({'read':!![]});}else{logger[_0x88ce('0x2d')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x88ce('0x7f'),util['inspect'](_0x1ea61b[_0x88ce('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x88ce('0x80'):if(_0x1ea61b[_0x88ce('0x5d')][_0x88ce('0x81')]&&_0x1ea61b[_0x88ce('0x5d')][_0x88ce('0x81')]===_0x2b00ec[_0x88ce('0x82')]&&_['indexOf']([_0x88ce('0x83'),_0x88ce('0x84')],_0x1ea61b['body'][_0x88ce('0x85')])>=0x0){return _0x2b00ec[_0x88ce('0x5e')]({'read':!![]});}else{logger[_0x88ce('0x2d')](_0x88ce('0x86'),_0x88ce('0x33'),_0x88ce('0x87'),util[_0x88ce('0x88')](_0x1ea61b['body'],{'showHidden':![],'depth':null}));}break;case _0x88ce('0x89'):var _0x45f901=_0x1ea61b[_0x88ce('0x5d')][_0x88ce('0x8a')][0x0];if(_0x45f901[_0x88ce('0x33')][_0x88ce('0x8b')]===_0x88ce('0x8c')){return _0x2b00ec[_0x88ce('0x5e')]({'read':!![]});}else{logger['error'](_0x88ce('0x86'),_0x88ce('0x33'),_0x88ce('0x89'),util[_0x88ce('0x88')](_0x1ea61b['body'],{'showHidden':![],'depth':null}));}break;}return _0x2b00ec;}})[_0x88ce('0x26')](respondWithResult(_0x1c613d,null))[_0x88ce('0x31')](handleError(_0x1c613d,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index a55d14d..339c674 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 _0x5007=['save','update','remove','emit','hook','exports','SmsMessage','setMaxListeners'];(function(_0x446f55,_0x2cb97a){var _0x37024a=function(_0x48da52){while(--_0x48da52){_0x446f55['push'](_0x446f55['shift']());}};_0x37024a(++_0x2cb97a);}(_0x5007,0x186));var _0x7500=function(_0x1ea83d,_0xa16e2a){_0x1ea83d=_0x1ea83d-0x0;var _0x41cb9f=_0x5007[_0x1ea83d];return _0x41cb9f;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db'][_0x7500('0x0')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x7500('0x1')](0x0);var events={'afterCreate':_0x7500('0x2'),'afterUpdate':_0x7500('0x3'),'afterDestroy':_0x7500('0x4')};function emitEvent(_0x225e48){return function(_0x12081c,_0x596ac1,_0x2f1897){SmsMessageEvents['emit'](_0x225e48+':'+_0x12081c['id'],_0x12081c);SmsMessageEvents[_0x7500('0x5')](_0x225e48,_0x12081c);_0x2f1897(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x7500('0x6')](e,emitEvent(event));}}module[_0x7500('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0xade8=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x1a1bda,_0xbe013f){var _0x3a0a4e=function(_0x32fffd){while(--_0x32fffd){_0x1a1bda['push'](_0x1a1bda['shift']());}};_0x3a0a4e(++_0xbe013f);}(_0xade8,0x114));var _0x8ade=function(_0x242ca0,_0x2a0b03){_0x242ca0=_0x242ca0-0x0;var _0x3cf902=_0xade8[_0x242ca0];return _0x3cf902;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x8ade('0x0'))['db'][_0x8ade('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x8ade('0x2')](0x0);var events={'afterCreate':_0x8ade('0x3'),'afterUpdate':_0x8ade('0x4'),'afterDestroy':'remove'};function emitEvent(_0x44030a){return function(_0x560a65,_0x34e71a,_0x4a3dfe){SmsMessageEvents[_0x8ade('0x5')](_0x44030a+':'+_0x560a65['id'],_0x560a65);SmsMessageEvents[_0x8ade('0x5')](_0x44030a,_0x560a65);_0x4a3dfe(null);};}for(var e in events){if(events[_0x8ade('0x6')](e)){var event=events[e];SmsMessage[_0x8ade('0x7')](e,emitEvent(event));}}module[_0x8ade('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index ccf5c8e..6be98bf 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 _0xc599=['/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','toLowerCase','direction','out','secret','UserId','findOne','SmsInteractionId','then','update','createdAt','catch','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','phone','body','remote','/api/sms/messages/','/status?token=','token','sid','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','username','password','smsMethod','sender','GET','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/send/','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','clickSend','authId','https://api.plivo.com/v1/Account/%s/Message/','toString','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','application/json','messages','Missing\x20parameters:\x20base_url','apiKey','login','keys','length','md5','digest','hex','signature='];(function(_0x3ccb8b,_0x3c78a2){var _0x3757a9=function(_0x1c0c7c){while(--_0x1c0c7c){_0x3ccb8b['push'](_0x3ccb8b['shift']());}};_0x3757a9(++_0x3c78a2);}(_0xc599,0x1e4));var _0x9c59=function(_0x2baed5,_0x16935d){_0x2baed5=_0x2baed5-0x0;var _0x606b78=_0xc599[_0x2baed5];return _0x606b78;};'use strict';var _=require(_0x9c59('0x0'));var util=require(_0x9c59('0x1'));var logger=require(_0x9c59('0x2'))(_0x9c59('0x3'));var moment=require(_0x9c59('0x4'));var BPromise=require(_0x9c59('0x5'));var rp=require(_0x9c59('0x6'));var fs=require('fs');var path=require(_0x9c59('0x7'));var rimraf=require(_0x9c59('0x8'));var config=require(_0x9c59('0x9'));var attributes=require(_0x9c59('0xa'));module[_0x9c59('0xb')]=function(_0x22b1f5,_0x1f5fbb){return _0x22b1f5[_0x9c59('0xc')](_0x9c59('0xd'),attributes,{'tableName':_0x9c59('0xe'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x9c59('0xf')]},{'name':_0x9c59('0x10'),'fields':['body'],'type':_0x9c59('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x444aa0,_0x1b3a94,_0x3d53a2){var _0x28ed8e=_0x22b1f5[_0x9c59('0x12')];var _0x58d2f1=_0x444aa0['get']({'plain':!![]});if(_0x58d2f1['direction'][_0x9c59('0x13')]()==='in'||_0x58d2f1[_0x9c59('0x14')][_0x9c59('0x13')]()===_0x9c59('0x15')&&!_0x58d2f1[_0x9c59('0x16')]&&!_['isNil'](_0x58d2f1[_0x9c59('0x17')])){_0x28ed8e['SmsInteraction'][_0x9c59('0x18')]({'where':{'id':_0x58d2f1[_0x9c59('0x19')]}})[_0x9c59('0x1a')](function(_0x31dd71){if(_0x31dd71){_0x31dd71[_0x9c59('0x1b')]({'lastMsgAt':_0x58d2f1[_0x9c59('0x1c')],'lastMsgDirection':_0x58d2f1[_0x9c59('0x14')][_0x9c59('0x13')]()});}})[_0x9c59('0x1d')](function(_0x1dab00){console['error'](_0x1dab00);});}if(_0x58d2f1[_0x9c59('0x14')]===_0x9c59('0x15')&&!_0x58d2f1['secret']){var _0x3268a7;_0x28ed8e[_0x9c59('0x1e')]['find']({'where':{'id':_0x58d2f1[_0x9c59('0x1f')]},'raw':!![]})[_0x9c59('0x1a')](function(_0x47e9e1){_0x3268a7=_0x47e9e1;if(_0x3268a7&&_0x3268a7[_0x9c59('0x20')]){switch(_0x3268a7[_0x9c59('0x20')]){case _0x9c59('0x21'):var _0x85da32=require(_0x9c59('0x21'));if(_0x3268a7[_0x9c59('0x22')]&&_0x3268a7[_0x9c59('0x23')]&&_0x3268a7[_0x9c59('0x24')]){var _0x5b677e=new _0x85da32(_0x3268a7[_0x9c59('0x22')],_0x3268a7['authToken']);_0x5b677e['messages']['create']({'body':_0x58d2f1[_0x9c59('0x25')],'to':_0x58d2f1['phone'],'from':_0x3268a7[_0x9c59('0x24')],'statusCallback':_0x3268a7[_0x9c59('0x26')]+_0x9c59('0x27')+_0x58d2f1['id']+_0x9c59('0x28')+_0x3268a7[_0x9c59('0x29')]})['then'](function(_0x555078){if(_0x555078[_0x9c59('0x2a')]){return _0x444aa0[_0x9c59('0x1b')]({'messageId':_0x555078['sid']});}})['catch'](function(_0xf92401){logger[_0x9c59('0x2b')](_0x9c59('0x2c'),_0x9c59('0x2d'),_0x9c59('0x21'),util['inspect'](_0xf92401,{'showHidden':![],'depth':null}));});}else{logger[_0x9c59('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9c59('0x2d'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x9c59('0x2e'):var _0x54d7a5='https://api.skebby.it/API/v1.0/REST/';if(_0x3268a7[_0x9c59('0x2f')]&&_0x3268a7[_0x9c59('0x30')]){var _0x160c53={'recipient':[_0x58d2f1[_0x9c59('0x24')]],'message':_0x58d2f1['body'],'message_type':_0x3268a7[_0x9c59('0x31')]};if(_0x3268a7[_0x9c59('0x31')]&&_0x3268a7[_0x9c59('0x31')]!=='SI'){_0x160c53[_0x9c59('0x32')]=_0x3268a7[_0x9c59('0x24')];}var _0x4d3797={'url':_0x54d7a5+'login?username='+_0x3268a7[_0x9c59('0x2f')]+'&password='+_0x3268a7[_0x9c59('0x30')],'method':_0x9c59('0x33')};rp(_0x4d3797)[_0x9c59('0x1a')](function(_0x43c1e5){var _0x3858b3=_0x43c1e5['split'](';');var _0x1e1977={'user_key':_0x3858b3[0x0],'session_key':_0x3858b3[0x1]};_0x4d3797={'url':_0x54d7a5+_0x9c59('0x34'),'method':_0x9c59('0x35'),'headers':{'user_key':_0x1e1977[_0x9c59('0x36')],'Session_key':_0x1e1977[_0x9c59('0x37')]},'json':!![],'body':_0x160c53};return rp(_0x4d3797);})['then'](function(_0x4ad86e){if(_0x4ad86e[_0x9c59('0x38')]>=0x1){var _0x32ef87={'messageId':_0x4ad86e[_0x9c59('0x39')]};if(_0x3268a7[_0x9c59('0x31')]!=='GP'||!_0x3268a7[_0x9c59('0x3a')]){_0x32ef87[_0x9c59('0x3b')]=!![];}return _0x444aa0['update'](_0x32ef87);}else{return logger[_0x9c59('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9c59('0x2d'),_0x9c59('0x2e'),util[_0x9c59('0x3c')](_0x4ad86e,{'showHidden':![],'depth':null}));}})[_0x9c59('0x1d')](function(_0x576cd2){return logger[_0x9c59('0x2b')](_0x9c59('0x2c'),'afterCreate','skebby',util['inspect'](_0x576cd2,{'showHidden':![],'depth':null}));});}else{logger[_0x9c59('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9c59('0x2d'),'skebby',_0x9c59('0x3d'));}break;case _0x9c59('0x3e'):if(_0x3268a7[_0x9c59('0x23')]){var _0xcba41c={'recipient':_0x58d2f1[_0x9c59('0x24')],'message':_0x58d2f1['body'],'sender':_0x3268a7[_0x9c59('0x3f')]||_0x3268a7[_0x9c59('0x24')],'authorization':_0x3268a7[_0x9c59('0x23')]};var _0x1b3a94={'method':_0x9c59('0x35'),'uri':_0x9c59('0x40'),'body':_0xcba41c,'json':!![]};rp(_0x1b3a94)[_0x9c59('0x1a')](function(_0x62ca11){var _0x1585d2={'messageId':_0x62ca11['requestid']};if(!_0x3268a7[_0x9c59('0x3a')]){_0x1585d2[_0x9c59('0x3b')]=!![];}return _0x444aa0[_0x9c59('0x1b')](_0x1585d2);})['catch'](function(_0x55e981){logger[_0x9c59('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9c59('0x3e'),util[_0x9c59('0x3c')](_0x55e981,{'showHidden':![],'depth':null}));});}else{logger[_0x9c59('0x2b')](_0x9c59('0x2c'),_0x9c59('0x2d'),_0x9c59('0x3e'),_0x9c59('0x41'));}break;case _0x9c59('0x42'):if(_0x3268a7['username']&&_0x3268a7[_0x9c59('0x30')]){var _0xcba41c={'messages':[{'source':_0x9c59('0x43'),'to':_0x58d2f1[_0x9c59('0x24')],'body':_0x58d2f1[_0x9c59('0x25')],'from':_0x3268a7[_0x9c59('0x3f')]||_0x3268a7[_0x9c59('0x24')]}]};var _0x4d9031=util[_0x9c59('0x44')]('%s:%s',_0x3268a7[_0x9c59('0x2f')],_0x3268a7[_0x9c59('0x30')]);var _0x1b3a94={'method':_0x9c59('0x35'),'uri':_0x9c59('0x45'),'body':_0xcba41c,'headers':{'Authorization':util[_0x9c59('0x44')](_0x9c59('0x46'),new Buffer(_0x4d9031)['toString'](_0x9c59('0x47')))},'json':!![]};rp(_0x1b3a94)[_0x9c59('0x1a')](function(_0x36a4f1){if(_0x36a4f1[_0x9c59('0x48')]>=0xc8&&_0x36a4f1[_0x9c59('0x48')]<=0xce){if(_0x36a4f1[_0x9c59('0x49')]&&_0x36a4f1['data'][_0x9c59('0x4a')]>0x0){var _0x1de1d9=_[_0x9c59('0x4b')](_0x36a4f1['data']['messages']);var _0x598629={'messageId':_0x1de1d9['message_id']};if(!_0x3268a7['deliveryReport']){_0x598629[_0x9c59('0x3b')]=!![];}return _0x444aa0[_0x9c59('0x1b')](_0x598629);}else{logger[_0x9c59('0x2b')](_0x9c59('0x2c'),_0x9c59('0x2d'),_0x9c59('0x4c'),util[_0x9c59('0x3c')](_0x36a4f1,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x9c59('0x2c'),'afterCreate',_0x9c59('0x4c'),util[_0x9c59('0x3c')](_0x36a4f1,{'showHidden':![],'depth':null}));}})['catch'](function(_0x192f49){logger['error'](_0x9c59('0x2c'),_0x9c59('0x2d'),_0x9c59('0x4c'),util[_0x9c59('0x3c')](_0x192f49,{'showHidden':![],'depth':null}));});}else{logger[_0x9c59('0x2b')](_0x9c59('0x2c'),_0x9c59('0x2d'),_0x9c59('0x4c'),_0x9c59('0x3d'));}break;case'plivo':if(_0x3268a7[_0x9c59('0x4d')]&&_0x3268a7[_0x9c59('0x23')]){var _0xcba41c={'dst':_0x58d2f1[_0x9c59('0x24')],'text':_0x58d2f1[_0x9c59('0x25')],'src':_0x3268a7[_0x9c59('0x3f')]||_0x3268a7[_0x9c59('0x24')],'url':_0x3268a7[_0x9c59('0x26')]+'/api/sms/messages/'+_0x58d2f1['id']+_0x9c59('0x28')+_0x3268a7[_0x9c59('0x29')]};var _0x4d9031=util[_0x9c59('0x44')]('%s:%s',_0x3268a7[_0x9c59('0x4d')],_0x3268a7[_0x9c59('0x23')]);var _0x1b3a94={'method':'POST','uri':util[_0x9c59('0x44')](_0x9c59('0x4e'),_0x3268a7[_0x9c59('0x4d')]),'body':_0xcba41c,'headers':{'Authorization':util['format'](_0x9c59('0x46'),new Buffer(_0x4d9031)[_0x9c59('0x4f')](_0x9c59('0x47')))},'json':!![]};rp(_0x1b3a94)['then'](function(_0x3cf771){var _0x31e526={'messageId':_0x3cf771['message_uuid'][0x0]};return _0x444aa0[_0x9c59('0x1b')](_0x31e526);})[_0x9c59('0x1d')](function(_0x3e07ec){logger[_0x9c59('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9c59('0x2d'),_0x9c59('0x50'),util[_0x9c59('0x3c')](_0x3e07ec,{'showHidden':![],'depth':null}));});}else{logger[_0x9c59('0x2b')](_0x9c59('0x2c'),'afterCreate',_0x9c59('0x50'),_0x9c59('0x51'));}break;case _0x9c59('0x52'):if(_0x3268a7[_0x9c59('0x2f')]&&_0x3268a7['password']){if(_0x3268a7[_0x9c59('0x53')]){var _0x1fddda={'method':_0x9c59('0x35'),'uri':_0x3268a7[_0x9c59('0x53')]+_0x9c59('0x54'),'body':{'username':_0x3268a7[_0x9c59('0x2f')],'password':_0x3268a7[_0x9c59('0x30')]},'json':!![]};return rp(_0x1fddda)[_0x9c59('0x1a')](function(_0x457d3a){var _0x1f6738={'method':_0x9c59('0x35'),'uri':_0x3268a7[_0x9c59('0x53')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x3268a7[_0x9c59('0x24')],'destinations':[{'to':_0x58d2f1[_0x9c59('0x24')]}],'text':_0x58d2f1['body'],'notifyUrl':_0x3268a7[_0x9c59('0x26')]+_0x9c59('0x27')+_0x58d2f1['id']+'/status?token='+_0x3268a7['token'],'notifyContentType':_0x9c59('0x55'),'callbackData':_0x3268a7[_0x9c59('0x24')]+';'+_0x58d2f1[_0x9c59('0x25')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x457d3a[_0x9c59('0x29')]},'json':!![]};return rp(_0x1f6738)[_0x9c59('0x1a')](function(_0x3100ae){if(_0x3100ae[_0x9c59('0x56')]){var _0x5ee5e5={'messageId':_0x3100ae[_0x9c59('0x56')][0x0]['messageId']};if(!_0x3268a7[_0x9c59('0x3a')]){_0x5ee5e5[_0x9c59('0x3b')]=!![];}return _0x444aa0[_0x9c59('0x1b')](_0x5ee5e5);}else{return logger[_0x9c59('0x2b')](_0x9c59('0x2c'),_0x9c59('0x2d'),_0x9c59('0x52'),util['inspect'](_0x3100ae,{'showHidden':![],'depth':null}));}});})[_0x9c59('0x1d')](function(_0x4882d5){return logger[_0x9c59('0x2b')](_0x9c59('0x2c'),_0x9c59('0x2d'),_0x9c59('0x52'),util[_0x9c59('0x3c')](_0x4882d5,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x9c59('0x2c'),'afterCreate','infobip',_0x9c59('0x57'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9c59('0x2d'),_0x9c59('0x52'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x240a45=require('crypto');if(_0x3268a7[_0x9c59('0x58')]){var _0x3b1f12={};_0x3b1f12[_0x9c59('0x59')]=_0x3268a7[_0x9c59('0x2f')];_0x3b1f12[_0x9c59('0x24')]=_0x58d2f1['phone'];_0x3b1f12[_0x9c59('0x32')]=_0x3268a7[_0x9c59('0x24')];_0x3b1f12['text']=_0x58d2f1[_0x9c59('0x25')];_0x3b1f12['timestamp']=+new Date();var _0x18e99d='';var _0x5d431e='';var _0x51eba8=Object[_0x9c59('0x5a')](_0x3b1f12);_0x51eba8['sort']();for(var _0x145226=0x0;_0x145226<_0x51eba8[_0x9c59('0x5b')];_0x145226++){if(_0x18e99d!=''){_0x18e99d+='&';}_0x18e99d+=_0x51eba8[_0x145226]+'='+encodeURIComponent(_0x3b1f12[_0x51eba8[_0x145226]]);_0x5d431e+=_0x3b1f12[_0x51eba8[_0x145226]];}_0x5d431e+=_0x3268a7[_0x9c59('0x58')];_0x5d431e=_0x240a45['createHash'](_0x9c59('0x5c'))[_0x9c59('0x1b')](_0x5d431e)[_0x9c59('0x5d')](_0x9c59('0x5e'));if(_0x18e99d!==''){_0x18e99d+='&';}_0x18e99d+=_0x9c59('0x5f')+_0x5d431e;var _0x4d3797={'method':_0x9c59('0x33'),'uri':_0x3268a7[_0x9c59('0x53')]+_0x9c59('0x60')+_0x18e99d,'json':!![]};return rp(_0x4d3797)['then'](function(_0x8f3af9){var _0x3d2b2a=Object[_0x9c59('0x5a')](_0x8f3af9);if(_0x8f3af9[_0x3d2b2a[0x0]][_0x9c59('0x2b')]&&parseInt(_0x8f3af9[_0x3d2b2a[0x0]]['error'])===0x0){var _0x42b860={'messageId':_0x8f3af9[_0x3d2b2a[0x0]][_0x9c59('0x61')]};if(!_0x3268a7['deliveryReport']){_0x42b860[_0x9c59('0x3b')]=!![];}return _0x444aa0[_0x9c59('0x1b')](_0x42b860);}else{return logger[_0x9c59('0x2b')](_0x9c59('0x2c'),_0x9c59('0x2d'),_0x9c59('0x62'),util[_0x9c59('0x3c')](_0x8f3af9['error'],{'showHidden':![],'depth':null}));}})[_0x9c59('0x1d')](function(_0x4d5697){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9c59('0x62'),util['inspect'](_0x4d5697,{'showHidden':![],'depth':null}));});}else{logger[_0x9c59('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9c59('0x2d'),_0x9c59('0x62'),_0x9c59('0x63'));}break;case _0x9c59('0x64'):if(_0x3268a7[_0x9c59('0x58')]){var _0x8c0437={'method':_0x9c59('0x35'),'uri':_0x9c59('0x65'),'headers':{'Authorization':_0x3268a7[_0x9c59('0x58')]},'body':{'content':_0x58d2f1[_0x9c59('0x25')],'to':[_0x58d2f1[_0x9c59('0x24')]],'from':_0x3268a7[_0x9c59('0x24')],'binary':![],'clientMessageId':_0x9c59('0x66'),'charset':_0x9c59('0x67')},'json':!![]};rp(_0x8c0437)['then'](function(_0x487e24){if(!_0x487e24['error']){var _0x4936dd={'messageId':_0x487e24[_0x9c59('0x56')][0x0]['apiMessageId']};if(!_0x3268a7[_0x9c59('0x3a')]){_0x4936dd[_0x9c59('0x3b')]=!![];}return _0x444aa0[_0x9c59('0x1b')](_0x4936dd);}else{return logger[_0x9c59('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9c59('0x2d'),_0x9c59('0x64'),util[_0x9c59('0x3c')](_0x487e24[_0x9c59('0x2b')],{'showHidden':![],'depth':null}));}})[_0x9c59('0x1d')](function(_0x35b1f4){return logger[_0x9c59('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x9c59('0x64'),util[_0x9c59('0x3c')](_0x35b1f4,{'showHidden':![],'depth':null}));});}else{logger[_0x9c59('0x2b')](_0x9c59('0x2c'),'afterCreate',_0x9c59('0x64'),'Missing\x20parameters:\x20apiKey');}break;case _0x9c59('0x68'):if(_0x3268a7[_0x9c59('0x58')]){var _0x518d17={};var _0x4d3797={'method':_0x9c59('0x35'),'uri':_0x9c59('0x69'),'headers':{'Authorization':_0x9c59('0x6a')+_0x3268a7[_0x9c59('0x58')],'Content-Type':'application/json'},'body':{'from':_0x3268a7['phone'],'to':_0x58d2f1['phone'],'text':_0x58d2f1[_0x9c59('0x25')]},'json':!![]};return rp(_0x4d3797)[_0x9c59('0x1a')](function(_0x49e24c){if(_0x49e24c[_0x9c59('0x6b')]==0xca){_0x518d17[_0x9c59('0x6c')]=_0x49e24c;var _0x488406={'method':_0x9c59('0x35'),'uri':_0x9c59('0x6d'),'headers':{'Authorization':_0x9c59('0x6a')+_0x3268a7[_0x9c59('0x58')],'Content-Type':_0x9c59('0x55')},'body':{'refid':_0x518d17[_0x9c59('0x6c')][_0x9c59('0x6e')]},'json':!![]};return rp(_0x488406)[_0x9c59('0x1a')](function(_0x5a701a){_0x518d17[_0x9c59('0x6f')]=_0x5a701a;var _0x542051={'messageId':_0x518d17[_0x9c59('0x6c')][_0x9c59('0x6e')],'read':!![]};return _0x444aa0[_0x9c59('0x1b')](_0x542051);});}else{return logger[_0x9c59('0x2b')](_0x9c59('0x2c'),_0x9c59('0x2d'),_0x9c59('0x68'),util[_0x9c59('0x3c')](_0x49e24c,{'showHidden':![],'depth':null}));}})[_0x9c59('0x1d')](function(_0x434382){return logger[_0x9c59('0x2b')](_0x9c59('0x2c'),'afterCreate',_0x9c59('0x68'),util[_0x9c59('0x3c')](_0x434382,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x9c59('0x2c'),_0x9c59('0x2d'),_0x9c59('0x68'),_0x9c59('0x70'));}break;}}})[_0x9c59('0x71')](function(){_0x3d53a2();});}else{_0x3d53a2();}}},'charset':_0x9c59('0x72'),'collate':_0x9c59('0x73')});}; \ No newline at end of file +var _0xa5ef=['code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','message','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','get','direction','out','secret','isNil','SmsInteraction','findOne','update','createdAt','toLowerCase','catch','error','SmsAccount','find','then','type','twilio','accountSid','authToken','phone','create','remote','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','split','sms','POST','session_key','total_sent','internal_order_id','read','afterCreate','Missing\x20parameters:\x20username,\x20password','connectel','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','message_id','clickSend','plivo','authId','senderString','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','messages','Missing\x20parameters:\x20base_url','crypto','timestamp','sort','length','md5','digest','hex','signature=','/external/get/send.php?','keys','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','apiKey','uuid','UTF-8','apiMessageId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa5ef,0x1e2));var _0xfa5e=function(_0xc4c142,_0x392430){_0xc4c142=_0xc4c142-0x0;var _0x2c825e=_0xa5ef[_0xc4c142];return _0x2c825e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa5e('0x0'))(_0xfa5e('0x1'));var moment=require(_0xfa5e('0x2'));var BPromise=require('bluebird');var rp=require(_0xfa5e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa5e('0x4'));var config=require(_0xfa5e('0x5'));var attributes=require('./smsMessage.attributes');module[_0xfa5e('0x6')]=function(_0xf314f,_0x67b75){return _0xf314f['define'](_0xfa5e('0x7'),attributes,{'tableName':_0xfa5e('0x8'),'paranoid':![],'indexes':[{'name':_0xfa5e('0x9'),'fields':[_0xfa5e('0x9')]},{'name':'fti_sms_messages','fields':[_0xfa5e('0xa')],'type':_0xfa5e('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2f528a,_0x3c02aa,_0x5dc7ed){var _0x411f93=_0xf314f[_0xfa5e('0xc')];var _0x20e9ea=_0x2f528a[_0xfa5e('0xd')]({'plain':!![]});if(_0x20e9ea['direction']['toLowerCase']()==='in'||_0x20e9ea[_0xfa5e('0xe')]['toLowerCase']()===_0xfa5e('0xf')&&!_0x20e9ea[_0xfa5e('0x10')]&&!_[_0xfa5e('0x11')](_0x20e9ea['UserId'])){_0x411f93[_0xfa5e('0x12')][_0xfa5e('0x13')]({'where':{'id':_0x20e9ea['SmsInteractionId']}})['then'](function(_0x5d84e9){if(_0x5d84e9){_0x5d84e9[_0xfa5e('0x14')]({'lastMsgAt':_0x20e9ea[_0xfa5e('0x15')],'lastMsgDirection':_0x20e9ea['direction'][_0xfa5e('0x16')]()});}})[_0xfa5e('0x17')](function(_0xce32df){console[_0xfa5e('0x18')](_0xce32df);});}if(_0x20e9ea[_0xfa5e('0xe')]==='out'&&!_0x20e9ea['secret']){var _0x1e54d4;_0x411f93[_0xfa5e('0x19')][_0xfa5e('0x1a')]({'where':{'id':_0x20e9ea['SmsAccountId']},'raw':!![]})[_0xfa5e('0x1b')](function(_0x3dc1b1){_0x1e54d4=_0x3dc1b1;if(_0x1e54d4&&_0x1e54d4[_0xfa5e('0x1c')]){switch(_0x1e54d4[_0xfa5e('0x1c')]){case _0xfa5e('0x1d'):var _0x28b597=require(_0xfa5e('0x1d'));if(_0x1e54d4[_0xfa5e('0x1e')]&&_0x1e54d4[_0xfa5e('0x1f')]&&_0x1e54d4[_0xfa5e('0x20')]){var _0xc2225a=new _0x28b597(_0x1e54d4['accountSid'],_0x1e54d4[_0xfa5e('0x1f')]);_0xc2225a['messages'][_0xfa5e('0x21')]({'body':_0x20e9ea[_0xfa5e('0xa')],'to':_0x20e9ea['phone'],'from':_0x1e54d4[_0xfa5e('0x20')],'statusCallback':_0x1e54d4[_0xfa5e('0x22')]+'/api/sms/messages/'+_0x20e9ea['id']+_0xfa5e('0x23')+_0x1e54d4['token']})[_0xfa5e('0x1b')](function(_0x532a8b){if(_0x532a8b[_0xfa5e('0x24')]){return _0x2f528a[_0xfa5e('0x14')]({'messageId':_0x532a8b['sid']});}})[_0xfa5e('0x17')](function(_0x5bb653){logger[_0xfa5e('0x18')](_0xfa5e('0x25'),'afterCreate','twilio',util[_0xfa5e('0x26')](_0x5bb653,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xfa5e('0x1d'),_0xfa5e('0x27'));}break;case _0xfa5e('0x28'):var _0x21d842=_0xfa5e('0x29');if(_0x1e54d4[_0xfa5e('0x2a')]&&_0x1e54d4[_0xfa5e('0x2b')]){var _0x23c3ea={'recipient':[_0x20e9ea[_0xfa5e('0x20')]],'message':_0x20e9ea[_0xfa5e('0xa')],'message_type':_0x1e54d4[_0xfa5e('0x2c')]};if(_0x1e54d4[_0xfa5e('0x2c')]&&_0x1e54d4[_0xfa5e('0x2c')]!=='SI'){_0x23c3ea[_0xfa5e('0x2d')]=_0x1e54d4[_0xfa5e('0x20')];}var _0x2b1335={'url':_0x21d842+_0xfa5e('0x2e')+_0x1e54d4[_0xfa5e('0x2a')]+_0xfa5e('0x2f')+_0x1e54d4[_0xfa5e('0x2b')],'method':'GET'};rp(_0x2b1335)[_0xfa5e('0x1b')](function(_0x3e0802){var _0x337f0c=_0x3e0802[_0xfa5e('0x30')](';');var _0x3554b5={'user_key':_0x337f0c[0x0],'session_key':_0x337f0c[0x1]};_0x2b1335={'url':_0x21d842+_0xfa5e('0x31'),'method':_0xfa5e('0x32'),'headers':{'user_key':_0x3554b5['user_key'],'Session_key':_0x3554b5[_0xfa5e('0x33')]},'json':!![],'body':_0x23c3ea};return rp(_0x2b1335);})[_0xfa5e('0x1b')](function(_0xb117bc){if(_0xb117bc[_0xfa5e('0x34')]>=0x1){var _0x5a9aa9={'messageId':_0xb117bc[_0xfa5e('0x35')]};if(_0x1e54d4[_0xfa5e('0x2c')]!=='GP'||!_0x1e54d4['deliveryReport']){_0x5a9aa9[_0xfa5e('0x36')]=!![];}return _0x2f528a[_0xfa5e('0x14')](_0x5a9aa9);}else{return logger[_0xfa5e('0x18')](_0xfa5e('0x25'),_0xfa5e('0x37'),'skebby',util['inspect'](_0xb117bc,{'showHidden':![],'depth':null}));}})['catch'](function(_0x369ecf){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfa5e('0x37'),_0xfa5e('0x28'),util[_0xfa5e('0x26')](_0x369ecf,{'showHidden':![],'depth':null}));});}else{logger[_0xfa5e('0x18')](_0xfa5e('0x25'),_0xfa5e('0x37'),'skebby',_0xfa5e('0x38'));}break;case _0xfa5e('0x39'):if(_0x1e54d4[_0xfa5e('0x1f')]){var _0x3f7d39={'recipient':_0x20e9ea['phone'],'message':_0x20e9ea[_0xfa5e('0xa')],'sender':_0x1e54d4['senderString']||_0x1e54d4[_0xfa5e('0x20')],'authorization':_0x1e54d4['authToken']};var _0x3c02aa={'method':_0xfa5e('0x32'),'uri':'https://smsapi.connectel.se/api/send/','body':_0x3f7d39,'json':!![]};rp(_0x3c02aa)[_0xfa5e('0x1b')](function(_0x563b66){var _0x323a52={'messageId':_0x563b66['requestid']};if(!_0x1e54d4[_0xfa5e('0x3a')]){_0x323a52[_0xfa5e('0x36')]=!![];}return _0x2f528a[_0xfa5e('0x14')](_0x323a52);})[_0xfa5e('0x17')](function(_0x35cc9b){logger[_0xfa5e('0x18')](_0xfa5e('0x25'),'afterCreate',_0xfa5e('0x39'),util[_0xfa5e('0x26')](_0x35cc9b,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfa5e('0x37'),'connectel',_0xfa5e('0x3b'));}break;case _0xfa5e('0x3c'):if(_0x1e54d4['username']&&_0x1e54d4['password']){var _0x3f7d39={'messages':[{'source':_0xfa5e('0x3d'),'to':_0x20e9ea[_0xfa5e('0x20')],'body':_0x20e9ea[_0xfa5e('0xa')],'from':_0x1e54d4['senderString']||_0x1e54d4[_0xfa5e('0x20')]}]};var _0x9791b7=util[_0xfa5e('0x3e')](_0xfa5e('0x3f'),_0x1e54d4[_0xfa5e('0x2a')],_0x1e54d4[_0xfa5e('0x2b')]);var _0x3c02aa={'method':_0xfa5e('0x32'),'uri':_0xfa5e('0x40'),'body':_0x3f7d39,'headers':{'Authorization':util[_0xfa5e('0x3e')](_0xfa5e('0x41'),new Buffer(_0x9791b7)[_0xfa5e('0x42')](_0xfa5e('0x43')))},'json':!![]};rp(_0x3c02aa)[_0xfa5e('0x1b')](function(_0x270366){if(_0x270366[_0xfa5e('0x44')]>=0xc8&&_0x270366[_0xfa5e('0x44')]<=0xce){if(_0x270366[_0xfa5e('0x45')]&&_0x270366[_0xfa5e('0x45')][_0xfa5e('0x46')]>0x0){var _0x4d121c=_['head'](_0x270366['data']['messages']);var _0x44146f={'messageId':_0x4d121c[_0xfa5e('0x47')]};if(!_0x1e54d4['deliveryReport']){_0x44146f['read']=!![];}return _0x2f528a[_0xfa5e('0x14')](_0x44146f);}else{logger['error'](_0xfa5e('0x25'),_0xfa5e('0x37'),_0xfa5e('0x48'),util[_0xfa5e('0x26')](_0x270366,{'showHidden':![],'depth':null}));}}else{logger[_0xfa5e('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfa5e('0x37'),_0xfa5e('0x48'),util[_0xfa5e('0x26')](_0x270366,{'showHidden':![],'depth':null}));}})[_0xfa5e('0x17')](function(_0x4197e4){logger[_0xfa5e('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfa5e('0x37'),_0xfa5e('0x48'),util['inspect'](_0x4197e4,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfa5e('0x37'),_0xfa5e('0x48'),_0xfa5e('0x38'));}break;case _0xfa5e('0x49'):if(_0x1e54d4[_0xfa5e('0x4a')]&&_0x1e54d4[_0xfa5e('0x1f')]){var _0x3f7d39={'dst':_0x20e9ea['phone'],'text':_0x20e9ea[_0xfa5e('0xa')],'src':_0x1e54d4[_0xfa5e('0x4b')]||_0x1e54d4['phone'],'url':_0x1e54d4[_0xfa5e('0x22')]+_0xfa5e('0x4c')+_0x20e9ea['id']+_0xfa5e('0x23')+_0x1e54d4['token']};var _0x9791b7=util['format'](_0xfa5e('0x3f'),_0x1e54d4['authId'],_0x1e54d4[_0xfa5e('0x1f')]);var _0x3c02aa={'method':_0xfa5e('0x32'),'uri':util[_0xfa5e('0x3e')](_0xfa5e('0x4d'),_0x1e54d4[_0xfa5e('0x4a')]),'body':_0x3f7d39,'headers':{'Authorization':util[_0xfa5e('0x3e')](_0xfa5e('0x41'),new Buffer(_0x9791b7)[_0xfa5e('0x42')](_0xfa5e('0x43')))},'json':!![]};rp(_0x3c02aa)[_0xfa5e('0x1b')](function(_0x2e694b){var _0x5bb2ff={'messageId':_0x2e694b[_0xfa5e('0x4e')][0x0]};return _0x2f528a['update'](_0x5bb2ff);})[_0xfa5e('0x17')](function(_0x269504){logger[_0xfa5e('0x18')](_0xfa5e('0x25'),'afterCreate','plivo',util['inspect'](_0x269504,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xfa5e('0x49'),_0xfa5e('0x4f'));}break;case _0xfa5e('0x50'):if(_0x1e54d4[_0xfa5e('0x2a')]&&_0x1e54d4[_0xfa5e('0x2b')]){if(_0x1e54d4[_0xfa5e('0x51')]){var _0x33c591={'method':_0xfa5e('0x32'),'uri':_0x1e54d4[_0xfa5e('0x51')]+_0xfa5e('0x52'),'body':{'username':_0x1e54d4[_0xfa5e('0x2a')],'password':_0x1e54d4['password']},'json':!![]};return rp(_0x33c591)[_0xfa5e('0x1b')](function(_0x284101){var _0x3e107b={'method':'POST','uri':_0x1e54d4[_0xfa5e('0x51')]+_0xfa5e('0x53'),'body':{'messages':[{'from':_0x1e54d4[_0xfa5e('0x20')],'destinations':[{'to':_0x20e9ea[_0xfa5e('0x20')]}],'text':_0x20e9ea[_0xfa5e('0xa')],'notifyUrl':_0x1e54d4[_0xfa5e('0x22')]+_0xfa5e('0x4c')+_0x20e9ea['id']+_0xfa5e('0x23')+_0x1e54d4['token'],'notifyContentType':'application/json','callbackData':_0x1e54d4['phone']+';'+_0x20e9ea[_0xfa5e('0xa')]}]},'headers':{'Authorization':_0xfa5e('0x54')+_0x284101['token']},'json':!![]};return rp(_0x3e107b)[_0xfa5e('0x1b')](function(_0x2d5392){if(_0x2d5392['messages']){var _0x2cf4b4={'messageId':_0x2d5392[_0xfa5e('0x55')][0x0][_0xfa5e('0x9')]};if(!_0x1e54d4[_0xfa5e('0x3a')]){_0x2cf4b4[_0xfa5e('0x36')]=!![];}return _0x2f528a[_0xfa5e('0x14')](_0x2cf4b4);}else{return logger[_0xfa5e('0x18')](_0xfa5e('0x25'),_0xfa5e('0x37'),_0xfa5e('0x50'),util[_0xfa5e('0x26')](_0x2d5392,{'showHidden':![],'depth':null}));}});})[_0xfa5e('0x17')](function(_0x17b357){return logger[_0xfa5e('0x18')](_0xfa5e('0x25'),'afterCreate',_0xfa5e('0x50'),util['inspect'](_0x17b357,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xfa5e('0x25'),_0xfa5e('0x37'),_0xfa5e('0x50'),_0xfa5e('0x56'));}}else{logger[_0xfa5e('0x18')](_0xfa5e('0x25'),_0xfa5e('0x37'),_0xfa5e('0x50'),_0xfa5e('0x38'));}break;case'csc':var _0x4c78a7=require(_0xfa5e('0x57'));if(_0x1e54d4['apiKey']){var _0x251025={};_0x251025['login']=_0x1e54d4[_0xfa5e('0x2a')];_0x251025[_0xfa5e('0x20')]=_0x20e9ea[_0xfa5e('0x20')];_0x251025[_0xfa5e('0x2d')]=_0x1e54d4[_0xfa5e('0x20')];_0x251025['text']=_0x20e9ea[_0xfa5e('0xa')];_0x251025[_0xfa5e('0x58')]=+new Date();var _0x170079='';var _0x47efb4='';var _0x64dfba=Object['keys'](_0x251025);_0x64dfba[_0xfa5e('0x59')]();for(var _0x7d67d7=0x0;_0x7d67d7<_0x64dfba[_0xfa5e('0x5a')];_0x7d67d7++){if(_0x170079!=''){_0x170079+='&';}_0x170079+=_0x64dfba[_0x7d67d7]+'='+encodeURIComponent(_0x251025[_0x64dfba[_0x7d67d7]]);_0x47efb4+=_0x251025[_0x64dfba[_0x7d67d7]];}_0x47efb4+=_0x1e54d4['apiKey'];_0x47efb4=_0x4c78a7['createHash'](_0xfa5e('0x5b'))[_0xfa5e('0x14')](_0x47efb4)[_0xfa5e('0x5c')](_0xfa5e('0x5d'));if(_0x170079!==''){_0x170079+='&';}_0x170079+=_0xfa5e('0x5e')+_0x47efb4;var _0x2b1335={'method':'GET','uri':_0x1e54d4[_0xfa5e('0x51')]+_0xfa5e('0x5f')+_0x170079,'json':!![]};return rp(_0x2b1335)[_0xfa5e('0x1b')](function(_0x22026b){var _0x59c4d3=Object[_0xfa5e('0x60')](_0x22026b);if(_0x22026b[_0x59c4d3[0x0]][_0xfa5e('0x18')]&&parseInt(_0x22026b[_0x59c4d3[0x0]][_0xfa5e('0x18')])===0x0){var _0x3d29c4={'messageId':_0x22026b[_0x59c4d3[0x0]][_0xfa5e('0x61')]};if(!_0x1e54d4[_0xfa5e('0x3a')]){_0x3d29c4[_0xfa5e('0x36')]=!![];}return _0x2f528a[_0xfa5e('0x14')](_0x3d29c4);}else{return logger[_0xfa5e('0x18')](_0xfa5e('0x25'),_0xfa5e('0x37'),_0xfa5e('0x62'),util[_0xfa5e('0x26')](_0x22026b[_0xfa5e('0x18')],{'showHidden':![],'depth':null}));}})[_0xfa5e('0x17')](function(_0x1dd45f){return logger[_0xfa5e('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfa5e('0x37'),'csc',util[_0xfa5e('0x26')](_0x1dd45f,{'showHidden':![],'depth':null}));});}else{logger[_0xfa5e('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfa5e('0x37'),'csc',_0xfa5e('0x63'));}break;case _0xfa5e('0x64'):if(_0x1e54d4[_0xfa5e('0x65')]){var _0x18d7fd={'method':_0xfa5e('0x32'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x1e54d4['apiKey']},'body':{'content':_0x20e9ea[_0xfa5e('0xa')],'to':[_0x20e9ea[_0xfa5e('0x20')]],'from':_0x1e54d4[_0xfa5e('0x20')],'binary':![],'clientMessageId':_0xfa5e('0x66'),'charset':_0xfa5e('0x67')},'json':!![]};rp(_0x18d7fd)['then'](function(_0x207c32){if(!_0x207c32[_0xfa5e('0x18')]){var _0x5110cb={'messageId':_0x207c32[_0xfa5e('0x55')][0x0][_0xfa5e('0x68')]};if(!_0x1e54d4[_0xfa5e('0x3a')]){_0x5110cb[_0xfa5e('0x36')]=!![];}return _0x2f528a[_0xfa5e('0x14')](_0x5110cb);}else{return logger[_0xfa5e('0x18')](_0xfa5e('0x25'),_0xfa5e('0x37'),_0xfa5e('0x64'),util['inspect'](_0x207c32[_0xfa5e('0x18')],{'showHidden':![],'depth':null}));}})[_0xfa5e('0x17')](function(_0x4f4f1c){return logger['error'](_0xfa5e('0x25'),_0xfa5e('0x37'),_0xfa5e('0x64'),util[_0xfa5e('0x26')](_0x4f4f1c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xfa5e('0x25'),_0xfa5e('0x37'),_0xfa5e('0x64'),_0xfa5e('0x63'));}break;case'intelepeer':if(_0x1e54d4[_0xfa5e('0x65')]){var _0x58be5e={};var _0x2b1335={'method':_0xfa5e('0x32'),'uri':_0xfa5e('0x69'),'headers':{'Authorization':_0xfa5e('0x6a')+_0x1e54d4[_0xfa5e('0x65')],'Content-Type':_0xfa5e('0x6b')},'body':{'from':_0x1e54d4[_0xfa5e('0x20')],'to':_0x20e9ea[_0xfa5e('0x20')],'text':_0x20e9ea[_0xfa5e('0xa')]},'json':!![]};return rp(_0x2b1335)[_0xfa5e('0x1b')](function(_0x14c91c){if(_0x14c91c[_0xfa5e('0x6c')]==0xca){_0x58be5e['message']=_0x14c91c;var _0x2c499c={'method':'POST','uri':_0xfa5e('0x6d'),'headers':{'Authorization':_0xfa5e('0x6a')+_0x1e54d4[_0xfa5e('0x65')],'Content-Type':_0xfa5e('0x6b')},'body':{'refid':_0x58be5e['message'][_0xfa5e('0x6e')]},'json':!![]};return rp(_0x2c499c)[_0xfa5e('0x1b')](function(_0x2e0e0f){_0x58be5e[_0xfa5e('0x6f')]=_0x2e0e0f;var _0x34ce37={'messageId':_0x58be5e[_0xfa5e('0x70')][_0xfa5e('0x6e')],'read':!![]};return _0x2f528a[_0xfa5e('0x14')](_0x34ce37);});}else{return logger[_0xfa5e('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xfa5e('0x71'),util[_0xfa5e('0x26')](_0x14c91c,{'showHidden':![],'depth':null}));}})[_0xfa5e('0x17')](function(_0xe74f97){return logger[_0xfa5e('0x18')](_0xfa5e('0x25'),'afterCreate',_0xfa5e('0x71'),util[_0xfa5e('0x26')](_0xe74f97,{'showHidden':![],'depth':null}));});}else{return logger[_0xfa5e('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xfa5e('0x71'),_0xfa5e('0x72'));}break;}}})[_0xfa5e('0x73')](function(){_0x5dc7ed();});}else{_0x5dc7ed();}}},'charset':_0xfa5e('0x74'),'collate':_0xfa5e('0x75')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index f7b5793..3dde307 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 _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','SmsMessage','body'];(function(_0x4bebc8,_0x434441){var _0x4efdc9=function(_0x14749a){while(--_0x14749a){_0x4bebc8['push'](_0x4bebc8['shift']());}};_0x4efdc9(++_0x434441);}(_0xb10b,0x12a));var _0xbb10=function(_0x30b0fe,_0x542156){_0x30b0fe=_0x30b0fe-0x0;var _0x412d11=_0xb10b[_0x30b0fe];return _0x412d11;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('SmsMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('SmsMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file +var _0x5f2f=['SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SmsMessage','create','options','raw','CreateSmsMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x51c41b,_0x47759f){var _0x42968c=function(_0x7793aa){while(--_0x7793aa){_0x51c41b['push'](_0x51c41b['shift']());}};_0x42968c(++_0x47759f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x348bd3,_0x16c57d){_0x348bd3=_0x348bd3-0x0;var _0x3de464=_0x5f2f[_0x348bd3];return _0x3de464;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./smsMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateSmsMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 1bc0bd9..7b3eb65 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 _0x2a19=['remove','update','removeListener','register','length','smsMessage:','./smsMessage.events','save'];(function(_0x4c5fde,_0x4b773f){var _0x3f3dfb=function(_0x24feb5){while(--_0x24feb5){_0x4c5fde['push'](_0x4c5fde['shift']());}};_0x3f3dfb(++_0x4b773f);}(_0x2a19,0x1c6));var _0x92a1=function(_0x19609f,_0x581f6e){_0x19609f=_0x19609f-0x0;var _0x2e904f=_0x2a19[_0x19609f];return _0x2e904f;};'use strict';var SmsMessageEvents=require(_0x92a1('0x0'));var events=[_0x92a1('0x1'),_0x92a1('0x2'),_0x92a1('0x3')];function createListener(_0x4b6c92,_0x1f3321){return function(_0x2acc1f){_0x1f3321['emit'](_0x4b6c92,_0x2acc1f);};}function removeListener(_0x357781,_0x106681){return function(){SmsMessageEvents[_0x92a1('0x4')](_0x357781,_0x106681);};}exports[_0x92a1('0x5')]=function(_0x1a3416){for(var _0x24074b=0x0,_0x29b9f0=events[_0x92a1('0x6')];_0x24074b<_0x29b9f0;_0x24074b++){var _0x2f2884=events[_0x24074b];var _0x580c7a=createListener(_0x92a1('0x7')+_0x2f2884,_0x1a3416);SmsMessageEvents['on'](_0x2f2884,_0x580c7a);}}; \ No newline at end of file +var _0x73da=['removeListener','smsMessage:','./smsMessage.events','update'];(function(_0x1f88f0,_0x2dc0ac){var _0x3684f5=function(_0x2f5efd){while(--_0x2f5efd){_0x1f88f0['push'](_0x1f88f0['shift']());}};_0x3684f5(++_0x2dc0ac);}(_0x73da,0x162));var _0xa73d=function(_0xb60ae4,_0x48b458){_0xb60ae4=_0xb60ae4-0x0;var _0x53d530=_0x73da[_0xb60ae4];return _0x53d530;};'use strict';var SmsMessageEvents=require(_0xa73d('0x0'));var events=['save','remove',_0xa73d('0x1')];function createListener(_0x173e97,_0x890a76){return function(_0x499554){_0x890a76['emit'](_0x173e97,_0x499554);};}function removeListener(_0xe13907,_0x5c2404){return function(){SmsMessageEvents[_0xa73d('0x2')](_0xe13907,_0x5c2404);};}exports['register']=function(_0x5ff3a5){for(var _0x29bd53=0x0,_0x54dc15=events['length'];_0x29bd53<_0x54dc15;_0x29bd53++){var _0x2b5340=events[_0x29bd53];var _0x10402c=createListener(_0xa73d('0x3')+_0x2b5340,_0x5ff3a5);SmsMessageEvents['on'](_0x2b5340,_0x10402c);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 81b812e..f209883 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 _0xf966=['path','express','Router','../../components/auth/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','create','post','addTeams','/:id/users','addAgents','put','update','destroy','delete','exports','multer','util'];(function(_0x450705,_0xe3f1a5){var _0xa66bfd=function(_0x4c62e9){while(--_0x4c62e9){_0x450705['push'](_0x450705['shift']());}};_0xa66bfd(++_0xe3f1a5);}(_0xf966,0x184));var _0x6f96=function(_0x4bc3ec,_0x137715){_0x4bc3ec=_0x4bc3ec-0x0;var _0x32cf80=_0xf966[_0x4bc3ec];return _0x32cf80;};'use strict';var multer=require(_0x6f96('0x0'));var util=require(_0x6f96('0x1'));var path=require(_0x6f96('0x2'));var timeout=require('connect-timeout');var express=require(_0x6f96('0x3'));var router=express[_0x6f96('0x4')]();var auth=require(_0x6f96('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6f96('0x6'));var controller=require(_0x6f96('0x7'));router[_0x6f96('0x8')]('/',auth['isAuthenticated'](),controller[_0x6f96('0x9')]);router[_0x6f96('0x8')](_0x6f96('0xa'),auth[_0x6f96('0xb')](),controller[_0x6f96('0xc')]);router[_0x6f96('0x8')](_0x6f96('0xd'),auth[_0x6f96('0xb')](),controller[_0x6f96('0xe')]);router[_0x6f96('0x8')](_0x6f96('0xf'),auth[_0x6f96('0xb')](),controller[_0x6f96('0x10')]);router[_0x6f96('0x8')](_0x6f96('0x11'),auth['isAuthenticated'](),controller[_0x6f96('0x12')]);router['get']('/:id/users',auth[_0x6f96('0xb')](),controller[_0x6f96('0x13')]);router['post']('/',auth[_0x6f96('0xb')](),controller[_0x6f96('0x14')]);router[_0x6f96('0x15')](_0x6f96('0x11'),auth[_0x6f96('0xb')](),controller[_0x6f96('0x16')]);router[_0x6f96('0x15')](_0x6f96('0x17'),auth['isAuthenticated'](),controller[_0x6f96('0x18')]);router[_0x6f96('0x19')]('/:id',auth[_0x6f96('0xb')](),controller[_0x6f96('0x1a')]);router['delete']('/:id',auth[_0x6f96('0xb')](),controller[_0x6f96('0x1b')]);router[_0x6f96('0x1c')]('/:id/teams',auth[_0x6f96('0xb')](),controller['removeTeams']);router[_0x6f96('0x1c')](_0x6f96('0x17'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x6f96('0x1d')]=router; \ No newline at end of file +var _0xe9e7=['isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','post','create','addTeams','/:id/users','addAgents','put','update','destroy','delete','removeTeams','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','describe','/:id'];(function(_0x5625d9,_0x523598){var _0x186314=function(_0x37d849){while(--_0x37d849){_0x5625d9['push'](_0x5625d9['shift']());}};_0x186314(++_0x523598);}(_0xe9e7,0x1f0));var _0x7e9e=function(_0x4a0580,_0x25ff1b){_0x4a0580=_0x4a0580-0x0;var _0x2e6ff5=_0xe9e7[_0x4a0580];return _0x2e6ff5;};'use strict';var multer=require(_0x7e9e('0x0'));var util=require(_0x7e9e('0x1'));var path=require(_0x7e9e('0x2'));var timeout=require('connect-timeout');var express=require(_0x7e9e('0x3'));var router=express[_0x7e9e('0x4')]();var auth=require(_0x7e9e('0x5'));var interaction=require(_0x7e9e('0x6'));var config=require(_0x7e9e('0x7'));var controller=require(_0x7e9e('0x8'));router[_0x7e9e('0x9')]('/',auth['isAuthenticated'](),controller[_0x7e9e('0xa')]);router[_0x7e9e('0x9')](_0x7e9e('0xb'),auth['isAuthenticated'](),controller[_0x7e9e('0xc')]);router['get'](_0x7e9e('0xd'),auth[_0x7e9e('0xe')](),controller[_0x7e9e('0xf')]);router[_0x7e9e('0x9')](_0x7e9e('0x10'),auth[_0x7e9e('0xe')](),controller[_0x7e9e('0x11')]);router[_0x7e9e('0x9')](_0x7e9e('0x12'),auth[_0x7e9e('0xe')](),controller[_0x7e9e('0x13')]);router[_0x7e9e('0x9')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x7e9e('0x14')]('/',auth[_0x7e9e('0xe')](),controller[_0x7e9e('0x15')]);router[_0x7e9e('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7e9e('0x16')]);router[_0x7e9e('0x14')](_0x7e9e('0x17'),auth[_0x7e9e('0xe')](),controller[_0x7e9e('0x18')]);router[_0x7e9e('0x19')](_0x7e9e('0xd'),auth['isAuthenticated'](),controller[_0x7e9e('0x1a')]);router['delete'](_0x7e9e('0xd'),auth[_0x7e9e('0xe')](),controller[_0x7e9e('0x1b')]);router[_0x7e9e('0x1c')](_0x7e9e('0x12'),auth[_0x7e9e('0xe')](),controller[_0x7e9e('0x1d')]);router['delete'](_0x7e9e('0x17'),auth[_0x7e9e('0xe')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index b5b13c0..126f157 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 _0xf5a4=['roundrobin','sequelize','exports','STRING','name','INTEGER','rrmemory'];(function(_0x5413f5,_0x3154c7){var _0x639288=function(_0x4b85e9){while(--_0x4b85e9){_0x5413f5['push'](_0x5413f5['shift']());}};_0x639288(++_0x3154c7);}(_0xf5a4,0x166));var _0x4f5a=function(_0x462fa5,_0x1569e0){_0x462fa5=_0x462fa5-0x0;var _0x186b70=_0xf5a4[_0x462fa5];return _0x186b70;};'use strict';var Sequelize=require(_0x4f5a('0x0'));module[_0x4f5a('0x1')]={'name':{'type':Sequelize[_0x4f5a('0x2')],'unique':_0x4f5a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4f5a('0x2')]},'timeout':{'type':Sequelize[_0x4f5a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x4f5a('0x5'),'beepall',_0x4f5a('0x6'))}}; \ No newline at end of file +var _0xd370=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x45b05a,_0x2ef2ba){var _0x1780d7=function(_0x4ee174){while(--_0x4ee174){_0x45b05a['push'](_0x45b05a['shift']());}};_0x1780d7(++_0x2ef2ba);}(_0xd370,0x1d3));var _0x0d37=function(_0x528575,_0x2e067d){_0x528575=_0x528575-0x0;var _0x3063b7=_0xd370[_0x528575];return _0x3063b7;};'use strict';var Sequelize=require(_0x0d37('0x0'));module[_0x0d37('0x1')]={'name':{'type':Sequelize[_0x0d37('0x2')],'unique':_0x0d37('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0d37('0x2')]},'timeout':{'type':Sequelize[_0x0d37('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0d37('0x5')](_0x0d37('0x6'),_0x0d37('0x7'),_0x0d37('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index cda52ad..77ab5ee 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 _0x453a=['spread','userSmsQueue:remove','getAgents','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','offset','apply','reject','save','update','then','get','SmsQueues','UserProfileResource','destroy','end','error','name','map','SmsQueue','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','count','includeAll','include','rows','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','Team','Agents','online','voicePause','interface','flatMap','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','findAll','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','sequelize','SELECT','every','TeamId','includes','all','transaction','ids','isEmpty','removeAgents','addAgents','omit'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x453a,0x8b));var _0xa453=function(_0xb4e2df,_0x1cbb7c){_0xb4e2df=_0xb4e2df-0x0;var _0x5e95ba=_0x453a[_0xb4e2df];return _0x5e95ba;};'use strict';var pdf=require(_0xa453('0x0'));var emlformat=require(_0xa453('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa453('0x2'));var rp=require(_0xa453('0x3'));var moment=require(_0xa453('0x4'));var BPromise=require(_0xa453('0x5'));var Mustache=require(_0xa453('0x6'));var util=require(_0xa453('0x7'));var path=require(_0xa453('0x8'));var sox=require(_0xa453('0x9'));var csv=require('to-csv');var ejs=require(_0xa453('0xa'));var fs=require('fs');var _=require(_0xa453('0xb'));var squel=require(_0xa453('0xc'));var crypto=require('crypto');var jsforce=require(_0xa453('0xd'));var deskjs=require(_0xa453('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa453('0xf'));var Papa=require(_0xa453('0x10'));var Redis=require('ioredis');var authService=require(_0xa453('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa453('0x12'));var hardwareService=require(_0xa453('0x13'));var logger=require(_0xa453('0x14'))(_0xa453('0x15'));var utils=require(_0xa453('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xa453('0x17')]=_[_0xa453('0x18')](config[_0xa453('0x17')],{'host':_0xa453('0x19'),'port':0x18eb});var socket=require(_0xa453('0x1a'))(new Redis(config[_0xa453('0x17')]));require(_0xa453('0x1b'))[_0xa453('0x1c')](socket);function respondWithStatusCode(_0x1a9ac2,_0x1c53a4){_0x1c53a4=_0x1c53a4||0xcc;return function(_0x22d5b8){if(_0x22d5b8){return _0x1a9ac2[_0xa453('0x1d')](_0x1c53a4);}return _0x1a9ac2[_0xa453('0x1e')](_0x1c53a4)['end']();};}function respondWithResult(_0x2d7a05,_0x5407ca){_0x5407ca=_0x5407ca||0xc8;return function(_0x5c3099){if(_0x5c3099){return _0x2d7a05[_0xa453('0x1e')](_0x5407ca)[_0xa453('0x1f')](_0x5c3099);}};}function respondWithFilteredResult(_0x4e7860,_0x111c67){return function(_0x223d3c){if(_0x223d3c){var _0x4a3123=_0x223d3c['count'],_0x2c01de=_0x111c67[_0xa453('0x20')],_0x43d4b4=_0x111c67[_0xa453('0x20')]+_0x111c67['limit'],_0x366321;if(_0x43d4b4>=_0x4a3123){_0x43d4b4=_0x4a3123;_0x366321=0xc8;}else{_0x366321=0xce;}_0x4e7860[_0xa453('0x1e')](_0x366321);return _0x4e7860['set']('Content-Range',_0x2c01de+'-'+_0x43d4b4+'/'+_0x4a3123)['json'](_0x223d3c);}return null;};}function patchUpdates(_0x29db91){return function(_0xbebab4){try{jsonpatch[_0xa453('0x21')](_0xbebab4,_0x29db91,!![]);}catch(_0x5c022c){return BPromise[_0xa453('0x22')](_0x5c022c);}return _0xbebab4[_0xa453('0x23')]();};}function saveUpdates(_0x4d58ea,_0x590f1e){return function(_0x27ea91){if(_0x27ea91){return _0x27ea91[_0xa453('0x24')](_0x4d58ea)[_0xa453('0x25')](function(_0x17c66d){return _0x17c66d;});}return null;};}function removeEntity(_0x21fa34,_0x3e237a){return function(_0x2dbbe9){if(_0x2dbbe9){return _0x2dbbe9['destroy']()[_0xa453('0x25')](function(){var _0x359069=_0x2dbbe9[_0xa453('0x26')]({'plain':!![]});var _0x332e79=_0xa453('0x27');return db[_0xa453('0x28')][_0xa453('0x29')]({'where':{'type':_0x332e79,'resourceId':_0x359069['id']}})[_0xa453('0x25')](function(){return _0x2dbbe9;});})[_0xa453('0x25')](function(){_0x21fa34[_0xa453('0x1e')](0xcc)[_0xa453('0x2a')]();});}};}function handleEntityNotFound(_0x2eb94b,_0x5aca70){return function(_0x643841){if(!_0x643841){_0x2eb94b[_0xa453('0x1d')](0x194);}return _0x643841;};}function handleError(_0x45fe7d,_0x6e7945){_0x6e7945=_0x6e7945||0x1f4;return function(_0x1c3f63){logger[_0xa453('0x2b')](_0x1c3f63['stack']);if(_0x1c3f63[_0xa453('0x2c')]){delete _0x1c3f63[_0xa453('0x2c')];}_0x45fe7d[_0xa453('0x1e')](_0x6e7945)['send'](_0x1c3f63);};}exports['index']=function(_0x5264bf,_0x1ee2be){var _0x42fb3d={},_0x1bf3a2={},_0x273aaa={'count':0x0,'rows':[]};var _0x5700a1=_[_0xa453('0x2d')](db[_0xa453('0x2e')][_0xa453('0x2f')],function(_0x46b7c1){return{'name':_0x46b7c1['fieldName'],'type':_0x46b7c1[_0xa453('0x30')][_0xa453('0x31')]};});_0x1bf3a2['model']=_[_0xa453('0x2d')](_0x5700a1,_0xa453('0x2c'));_0x1bf3a2[_0xa453('0x32')]=_[_0xa453('0x33')](_0x5264bf[_0xa453('0x32')]);_0x1bf3a2[_0xa453('0x34')]=_['intersection'](_0x1bf3a2[_0xa453('0x35')],_0x1bf3a2['query']);_0x42fb3d[_0xa453('0x36')]=_[_0xa453('0x37')](_0x1bf3a2[_0xa453('0x35')],qs['fields'](_0x5264bf[_0xa453('0x32')][_0xa453('0x38')]));_0x42fb3d['attributes']=_0x42fb3d[_0xa453('0x36')][_0xa453('0x39')]?_0x42fb3d[_0xa453('0x36')]:_0x1bf3a2[_0xa453('0x35')];if(!_0x5264bf[_0xa453('0x32')][_0xa453('0x3a')](_0xa453('0x3b'))){_0x42fb3d['limit']=qs[_0xa453('0x3c')](_0x5264bf[_0xa453('0x32')][_0xa453('0x3c')]);_0x42fb3d[_0xa453('0x20')]=qs[_0xa453('0x20')](_0x5264bf[_0xa453('0x32')][_0xa453('0x20')]);}_0x42fb3d[_0xa453('0x3d')]=qs[_0xa453('0x3e')](_0x5264bf[_0xa453('0x32')]['sort']);_0x42fb3d[_0xa453('0x3f')]=qs['filters'](_[_0xa453('0x40')](_0x5264bf[_0xa453('0x32')],_0x1bf3a2[_0xa453('0x34')]),_0x5700a1);if(_0x5264bf[_0xa453('0x32')][_0xa453('0x41')]){_0x42fb3d['where']=_['merge'](_0x42fb3d['where'],{'$or':_[_0xa453('0x2d')](_0x5700a1,function(_0x59e27b){if(_0x59e27b['type']!=='VIRTUAL'){var _0x74e1ea={};_0x74e1ea[_0x59e27b[_0xa453('0x2c')]]={'$like':'%'+_0x5264bf[_0xa453('0x32')]['filter']+'%'};return _0x74e1ea;}})});}_0x42fb3d=_[_0xa453('0x42')]({},_0x42fb3d,_0x5264bf[_0xa453('0x43')]);var _0x47f071={'where':_0x42fb3d[_0xa453('0x3f')]};return db['SmsQueue'][_0xa453('0x44')](_0x47f071)['then'](function(_0x2decea){_0x273aaa['count']=_0x2decea;if(_0x5264bf[_0xa453('0x32')][_0xa453('0x45')]){_0x42fb3d[_0xa453('0x46')]=[{'all':!![]}];}return db[_0xa453('0x2e')]['findAll'](_0x42fb3d);})[_0xa453('0x25')](function(_0x78c2f4){_0x273aaa[_0xa453('0x47')]=_0x78c2f4;return _0x273aaa;})['then'](respondWithFilteredResult(_0x1ee2be,_0x42fb3d))[_0xa453('0x48')](handleError(_0x1ee2be,null));};exports['show']=function(_0x27a3cb,_0x19be49){var _0x37ebc1={'raw':!![],'where':{'id':_0x27a3cb[_0xa453('0x49')]['id']}},_0x1c2459={};_0x1c2459[_0xa453('0x35')]=_[_0xa453('0x33')](db[_0xa453('0x2e')][_0xa453('0x2f')]);_0x1c2459[_0xa453('0x32')]=_[_0xa453('0x33')](_0x27a3cb[_0xa453('0x32')]);_0x1c2459[_0xa453('0x34')]=_['intersection'](_0x1c2459[_0xa453('0x35')],_0x1c2459['query']);_0x37ebc1[_0xa453('0x36')]=_[_0xa453('0x37')](_0x1c2459[_0xa453('0x35')],qs[_0xa453('0x38')](_0x27a3cb[_0xa453('0x32')][_0xa453('0x38')]));_0x37ebc1[_0xa453('0x36')]=_0x37ebc1[_0xa453('0x36')][_0xa453('0x39')]?_0x37ebc1['attributes']:_0x1c2459['model'];if(_0x27a3cb['query'][_0xa453('0x45')]){_0x37ebc1[_0xa453('0x46')]=[{'all':!![]}];}_0x37ebc1=_[_0xa453('0x42')]({},_0x37ebc1,_0x27a3cb[_0xa453('0x43')]);return db[_0xa453('0x2e')][_0xa453('0x4a')](_0x37ebc1)[_0xa453('0x25')](handleEntityNotFound(_0x19be49,null))['then'](respondWithResult(_0x19be49,null))['catch'](handleError(_0x19be49,null));};exports['create']=function(_0x23b3c3,_0xf2f937){return db['SmsQueue'][_0xa453('0x4b')](_0x23b3c3[_0xa453('0x4c')],{})['then'](function(_0x5009a8){var _0x2cdff5=_0x23b3c3['user']['get']({'plain':!![]});if(!_0x2cdff5)throw new Error(_0xa453('0x4d'));if(_0x2cdff5['role']==='user'){var _0x52b30a=_0x5009a8[_0xa453('0x26')]({'plain':!![]});var _0x52c3e7=_0xa453('0x27');return db[_0xa453('0x4e')][_0xa453('0x4a')]({'where':{'name':_0x52c3e7,'userProfileId':_0x2cdff5['userProfileId']},'raw':!![]})[_0xa453('0x25')](function(_0x427334){if(_0x427334&&_0x427334['autoAssociation']===0x0){return db['UserProfileResource'][_0xa453('0x4b')]({'name':_0x52b30a[_0xa453('0x2c')],'resourceId':_0x52b30a['id'],'type':_0x427334[_0xa453('0x2c')],'sectionId':_0x427334['id']},{})[_0xa453('0x25')](function(){return _0x5009a8;});}else{return _0x5009a8;}})[_0xa453('0x48')](function(_0x4c5a0f){logger[_0xa453('0x2b')](_0xa453('0x4f'),_0x4c5a0f);throw _0x4c5a0f;});}return _0x5009a8;})[_0xa453('0x25')](respondWithResult(_0xf2f937,0xc9))[_0xa453('0x48')](handleError(_0xf2f937,null));};exports[_0xa453('0x24')]=function(_0x59f4b2,_0x246c30){if(_0x59f4b2[_0xa453('0x4c')]['id']){delete _0x59f4b2[_0xa453('0x4c')]['id'];}return db['SmsQueue'][_0xa453('0x4a')]({'where':{'id':_0x59f4b2[_0xa453('0x49')]['id']}})[_0xa453('0x25')](handleEntityNotFound(_0x246c30,null))[_0xa453('0x25')](saveUpdates(_0x59f4b2['body'],null))[_0xa453('0x25')](respondWithResult(_0x246c30,null))['catch'](handleError(_0x246c30,null));};exports['destroy']=function(_0x50d9c8,_0x21b884){return db[_0xa453('0x2e')][_0xa453('0x4a')]({'where':{'id':_0x50d9c8[_0xa453('0x49')]['id']}})[_0xa453('0x25')](handleEntityNotFound(_0x21b884,null))[_0xa453('0x25')](removeEntity(_0x21b884,null))['catch'](handleError(_0x21b884,null));};exports[_0xa453('0x50')]=function(_0x3532fa,_0x32a620){return db['SmsQueue'][_0xa453('0x50')]()[_0xa453('0x25')](respondWithResult(_0x32a620,null))[_0xa453('0x48')](handleError(_0x32a620,null));};exports[_0xa453('0x51')]=function(_0x45ca91,_0x4dcfcc,_0xd7bd6f){var _0x3fb094={'raw':!![],'where':{}},_0x63566e={},_0x22b777;return db['SmsQueue'][_0xa453('0x52')]({'where':{'id':_0x45ca91[_0xa453('0x49')]['id']}})['then'](handleEntityNotFound(_0x4dcfcc,null))[_0xa453('0x25')](function(_0x27ad45){if(_0x27ad45){_0x22b777=_0x27ad45[_0xa453('0x26')]({'plain':!![]});_0x63566e[_0xa453('0x35')]=_[_0xa453('0x33')](db[_0xa453('0x53')][_0xa453('0x2f')]);_0x63566e[_0xa453('0x32')]=_['keys'](_0x45ca91[_0xa453('0x32')]);_0x63566e[_0xa453('0x34')]=_[_0xa453('0x37')](_0x63566e['model'],_0x63566e['query']);_0x3fb094[_0xa453('0x36')]=_['intersection'](_0x63566e[_0xa453('0x35')],qs[_0xa453('0x38')](_0x45ca91[_0xa453('0x32')]['fields']));_0x3fb094[_0xa453('0x36')]=_0x3fb094[_0xa453('0x36')][_0xa453('0x39')]?_0x3fb094[_0xa453('0x36')]:_0x63566e[_0xa453('0x35')];if(!_0x45ca91[_0xa453('0x32')][_0xa453('0x3a')](_0xa453('0x3b'))){_0x3fb094[_0xa453('0x3c')]=qs[_0xa453('0x3c')](_0x45ca91[_0xa453('0x32')][_0xa453('0x3c')]);_0x3fb094[_0xa453('0x20')]=qs[_0xa453('0x20')](_0x45ca91[_0xa453('0x32')]['offset']);}_0x3fb094['order']=qs[_0xa453('0x3e')](_0x45ca91[_0xa453('0x32')][_0xa453('0x3e')]);_0x3fb094['where']=qs[_0xa453('0x34')](_[_0xa453('0x40')](_0x45ca91[_0xa453('0x32')],_0x63566e['filters']));_0x3fb094['where'][_0xa453('0x54')]=_0x27ad45['id'];if(_0x45ca91[_0xa453('0x32')][_0xa453('0x41')]){_0x3fb094[_0xa453('0x3f')]=_['merge'](_0x3fb094[_0xa453('0x3f')],{'$or':_['map'](_0x3fb094[_0xa453('0x36')],function(_0x86c215){var _0xde6212={};_0xde6212[_0x86c215]={'$like':'%'+_0x45ca91[_0xa453('0x32')][_0xa453('0x41')]+'%'};return _0xde6212;})});}_0x3fb094=_['merge']({},_0x3fb094,_0x45ca91['options']);return db['UserSmsQueue']['findAll'](_0x3fb094);}})[_0xa453('0x25')](function(_0x3a2f65){if(_0x3a2f65){return db[_0xa453('0x55')][_0xa453('0x56')]({'where':{'id':_[_0xa453('0x2d')](_0x3a2f65,_0xa453('0x57')),'role':_0xa453('0x58')},'attributes':['id',_0xa453('0x2c'),_0xa453('0x59'),_0xa453('0x5a'),_0xa453('0x5b')]});}})[_0xa453('0x25')](function(_0x3f9182){if(_0x3f9182){return{'count':_0x3f9182['count'],'rows':_[_0xa453('0x2d')](_0x3f9182['rows'],function(_0x3d733e){return{'membername':_0x3d733e['name'],'UserId':_0x3d733e['id'],'queue_name':_0x22b777['name'],'SmsQueueId':_0x22b777['id'],'interface':util[_0xa453('0x5c')](_0xa453('0x5d'),_0xa453('0x5e'),_0x3d733e[_0xa453('0x2c')]),'penalty':0x0,'paused':_0x3d733e[_0xa453('0x59')],'createdAt':_0x3d733e[_0xa453('0x5b')],'updatedAt':_0x3d733e[_0xa453('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa453('0x25')](respondWithFilteredResult(_0x4dcfcc,_0x3fb094))[_0xa453('0x48')](handleError(_0x4dcfcc,null));};exports[_0xa453('0x5f')]=function(_0x2346b1,_0x121922,_0x36e4b3){var _0x18ea1c={};var _0x461080={};var _0x22eec4;var _0x2476ef;return db['SmsQueue'][_0xa453('0x52')]({'where':{'id':_0x2346b1[_0xa453('0x49')]['id']}})[_0xa453('0x25')](handleEntityNotFound(_0x121922,null))['then'](function(_0x212842){if(_0x212842){_0x22eec4=_0x212842;_0x461080[_0xa453('0x35')]=_[_0xa453('0x33')](db['Team'][_0xa453('0x2f')]);_0x461080[_0xa453('0x32')]=_[_0xa453('0x33')](_0x2346b1[_0xa453('0x32')]);_0x461080['filters']=_[_0xa453('0x37')](_0x461080['model'],_0x461080[_0xa453('0x32')]);_0x18ea1c[_0xa453('0x36')]=_[_0xa453('0x37')](_0x461080[_0xa453('0x35')],qs[_0xa453('0x38')](_0x2346b1[_0xa453('0x32')][_0xa453('0x38')]));_0x18ea1c[_0xa453('0x36')]=_0x18ea1c[_0xa453('0x36')]['length']?_0x18ea1c[_0xa453('0x36')]:_0x461080[_0xa453('0x35')];_0x18ea1c[_0xa453('0x3d')]=qs[_0xa453('0x3e')](_0x2346b1[_0xa453('0x32')][_0xa453('0x3e')]);_0x18ea1c['where']=qs[_0xa453('0x34')](_[_0xa453('0x40')](_0x2346b1[_0xa453('0x32')],_0x461080[_0xa453('0x34')]));if(_0x2346b1['query'][_0xa453('0x41')]){_0x18ea1c[_0xa453('0x3f')]=_['merge'](_0x18ea1c[_0xa453('0x3f')],{'$or':_[_0xa453('0x2d')](_0x18ea1c[_0xa453('0x36')],function(_0x24ea3d){var _0x4c7d68={};_0x4c7d68[_0x24ea3d]={'$like':'%'+_0x2346b1[_0xa453('0x32')][_0xa453('0x41')]+'%'};return _0x4c7d68;})});}_0x18ea1c=_[_0xa453('0x42')]({},_0x18ea1c,_0x2346b1['options']);return _0x22eec4[_0xa453('0x5f')](_0x18ea1c);}})['then'](function(_0x3ca483){if(_0x3ca483){_0x2476ef=_0x3ca483[_0xa453('0x39')];if(!_0x2346b1[_0xa453('0x32')][_0xa453('0x3a')](_0xa453('0x3b'))){_0x18ea1c[_0xa453('0x3c')]=qs['limit'](_0x2346b1[_0xa453('0x32')][_0xa453('0x3c')]);_0x18ea1c[_0xa453('0x20')]=qs[_0xa453('0x20')](_0x2346b1['query'][_0xa453('0x20')]);}return _0x22eec4[_0xa453('0x5f')](_0x18ea1c);}})['then'](function(_0x47f666){if(_0x47f666){return _0x47f666?{'count':_0x2476ef,'rows':_0x47f666}:null;}})[_0xa453('0x25')](respondWithResult(_0x121922,null))[_0xa453('0x48')](handleError(_0x121922,null));};exports[_0xa453('0x60')]=function(_0x20b27c,_0x1db964,_0x523514){var _0xad5482=_0x20b27c['body']['ids'];return db[_0xa453('0x61')]['findAll']({'where':{'id':_0xad5482},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa453('0x62'),'attributes':['id',_0xa453('0x2c'),_0xa453('0x63'),_0xa453('0x64'),_0xa453('0x65')],'raw':!![]}]})[_0xa453('0x25')](function(_0x5bd775){if(_0x5bd775){var _0x1b4669=_[_0xa453('0x66')](_0x5bd775,function(_0x4311f8){var _0x200e9a=_0x4311f8['get']({'plain':!![]});return _0x200e9a[_0xa453('0x62')];});return db[_0xa453('0x2e')][_0xa453('0x4a')]({'where':{'id':_0x20b27c[_0xa453('0x49')]['id']}})[_0xa453('0x25')](function(_0x16144a){return db['sequelize']['transaction'](function(_0x1dbab3){return _0x16144a[_0xa453('0x60')](_0xad5482,{'transaction':_0x1dbab3})[_0xa453('0x25')](function(){return BPromise[_0xa453('0x67')](_0x1b4669,function(_0x59f418){return db['UserSmsQueue'][_0xa453('0x68')]({'where':{'UserId':_0x59f418['id'],'SmsQueueId':_0x20b27c[_0xa453('0x49')]['id']},'transaction':_0x1dbab3});});})[_0xa453('0x25')](function(){_0x1b4669[_0xa453('0x69')](function(_0x21bc03){socket[_0xa453('0x6a')](_0xa453('0x6b'),{'UserId':_0x21bc03['id'],'SmsQueueId':_0x16144a['id']});});});});});}})[_0xa453('0x25')](respondWithStatusCode(_0x1db964,null))[_0xa453('0x48')](handleError(_0x1db964,null));};exports[_0xa453('0x6c')]=function(_0x2204be,_0x571fe5,_0x460175){return db[_0xa453('0x61')][_0xa453('0x6d')]({'where':{'id':_0x2204be[_0xa453('0x32')]['ids']},'attributes':['id'],'include':[{'model':db[_0xa453('0x55')],'as':_0xa453('0x62'),'attributes':['id'],'raw':!![]}]})[_0xa453('0x25')](handleEntityNotFound(_0x571fe5,null))[_0xa453('0x25')](function(_0x5902c1){var _0x1685a1=_[_0xa453('0x2d')](_0x5902c1,'id');var _0x3f56a9=[];var _0x5f3eac=[];var _0x58d0b7=squel[_0xa453('0x6e')]();_0x58d0b7[_0xa453('0x6f')](_0xa453('0x70'))[_0xa453('0x71')](_0xa453('0x72'),'tq')[_0xa453('0x73')](_0xa453('0x74'),'ut',_0xa453('0x75'))[_0xa453('0x3f')]('SmsQueueId\x20=\x20?',_0x2204be[_0xa453('0x49')]['id']);for(var _0x447797=0x0;_0x447797<_0x5902c1[_0xa453('0x39')];_0x447797+=0x1){let _0x27dcfd=_0x5902c1[_0x447797];for(var _0x382790=0x0;_0x382790<_0x27dcfd[_0xa453('0x62')][_0xa453('0x39')];_0x382790+=0x1){let _0xdc9def=_0x27dcfd[_0xa453('0x62')][_0x382790];var _0x5c98a8=_0x58d0b7[_0xa453('0x76')]();_0x5c98a8[_0xa453('0x3f')](_0xa453('0x77'),_0xdc9def['id']);_0x5f3eac['push'](db['sequelize'][_0xa453('0x32')](_0x5c98a8[_0xa453('0x78')](),{'type':db[_0xa453('0x79')]['QueryTypes'][_0xa453('0x7a')]})[_0xa453('0x25')](function(_0x56aace){if(_0x56aace[_0xa453('0x39')]===0x1){return _0xdc9def['id'];}else{var _0x2d7d00=_[_0xa453('0x7b')](_[_0xa453('0x2d')](_0x56aace,_0xa453('0x7c')),function(_0x4f6df3){return _[_0xa453('0x7d')](_0x1685a1,_0x4f6df3);});if(_0x2d7d00){return _0xdc9def['id'];}}}));}}return BPromise[_0xa453('0x7e')](_0x5f3eac)[_0xa453('0x25')](function(_0x1145c1){_0x3f56a9=_(_0x3f56a9)['union'](_0x1145c1)['compact']()['value']();return db[_0xa453('0x2e')][_0xa453('0x4a')]({'where':{'id':_0x2204be[_0xa453('0x49')]['id']}})[_0xa453('0x25')](function(_0x45da32){return db[_0xa453('0x79')][_0xa453('0x7f')](function(_0x39e534){return _0x45da32[_0xa453('0x6c')](_0x2204be[_0xa453('0x32')][_0xa453('0x80')],{'transaction':_0x39e534})[_0xa453('0x25')](function(){if(!_[_0xa453('0x81')](_0x3f56a9)){return _0x45da32[_0xa453('0x82')](_0x3f56a9,{'transaction':_0x39e534});}})[_0xa453('0x25')](function(){_0x3f56a9[_0xa453('0x69')](function(_0x36a36a){socket['emit']('userSmsQueue:remove',{'UserId':_0x36a36a,'SmsQueueId':_0x45da32['id']});});});});});});})['then'](respondWithStatusCode(_0x571fe5,null))['catch'](handleError(_0x571fe5,null));};exports[_0xa453('0x83')]=function(_0x1cf1cf,_0x5cc4ec,_0x1ee476){return db[_0xa453('0x2e')][_0xa453('0x4a')]({'where':{'id':_0x1cf1cf[_0xa453('0x49')]['id']}})[_0xa453('0x25')](handleEntityNotFound(_0x5cc4ec,null))[_0xa453('0x25')](function(_0x442a6f){if(_0x442a6f){return _0x442a6f[_0xa453('0x83')](_0x1cf1cf['body'][_0xa453('0x80')],_[_0xa453('0x84')](_0x1cf1cf[_0xa453('0x4c')],['ids','id'])||{})[_0xa453('0x85')](function(_0xc6c5e1){for(var _0x13ad8c=0x0;_0x13ad8c<_0x1cf1cf[_0xa453('0x4c')]['ids'][_0xa453('0x39')];_0x13ad8c+=0x1){socket['emit'](_0xa453('0x6b'),{'UserId':_0x1cf1cf[_0xa453('0x4c')][_0xa453('0x80')][_0x13ad8c],'SmsQueueId':_0x1cf1cf[_0xa453('0x49')]['id']});}return _0xc6c5e1;});}})[_0xa453('0x25')](respondWithResult(_0x5cc4ec,null))[_0xa453('0x48')](handleError(_0x5cc4ec,null));};exports[_0xa453('0x82')]=function(_0x6073c8,_0x4f6d91,_0x24384c){return db['SmsQueue'][_0xa453('0x4a')]({'where':{'id':_0x6073c8['params']['id']}})['then'](handleEntityNotFound(_0x4f6d91,null))['then'](function(_0x565767){if(_0x565767){return _0x565767[_0xa453('0x82')](_0x6073c8[_0xa453('0x32')][_0xa453('0x80')])[_0xa453('0x25')](function(){if(_['isArray'](_0x6073c8[_0xa453('0x32')][_0xa453('0x80')])){for(var _0x283dd3=0x0;_0x283dd3<_0x6073c8[_0xa453('0x32')][_0xa453('0x80')][_0xa453('0x39')];_0x283dd3+=0x1){socket[_0xa453('0x6a')](_0xa453('0x86'),{'UserId':Number(_0x6073c8[_0xa453('0x32')][_0xa453('0x80')][_0x283dd3]),'SmsQueueId':Number(_0x6073c8['params']['id'])});}}else{socket[_0xa453('0x6a')](_0xa453('0x86'),{'UserId':Number(_0x6073c8[_0xa453('0x32')][_0xa453('0x80')]),'SmsQueueId':Number(_0x6073c8[_0xa453('0x49')]['id'])});}});}})[_0xa453('0x25')](respondWithStatusCode(_0x4f6d91,null))[_0xa453('0x48')](handleError(_0x4f6d91,null));};exports[_0xa453('0x87')]=function(_0x19ea17,_0x476bae,_0x22de28){var _0x43da84={};var _0x2d7423={};var _0x346e96;var _0x46ca21;return db['SmsQueue']['findOne']({'where':{'id':_0x19ea17[_0xa453('0x49')]['id']}})['then'](handleEntityNotFound(_0x476bae,null))['then'](function(_0x44ab7f){if(_0x44ab7f){_0x346e96=_0x44ab7f;_0x2d7423['model']=_['keys'](db[_0xa453('0x55')][_0xa453('0x2f')]);_0x2d7423[_0xa453('0x32')]=_[_0xa453('0x33')](_0x19ea17[_0xa453('0x32')]);_0x2d7423['filters']=_[_0xa453('0x37')](_0x2d7423[_0xa453('0x35')],_0x2d7423[_0xa453('0x32')]);_0x43da84[_0xa453('0x36')]=_[_0xa453('0x37')](_0x2d7423[_0xa453('0x35')],qs[_0xa453('0x38')](_0x19ea17[_0xa453('0x32')][_0xa453('0x38')]));_0x43da84[_0xa453('0x36')]=_0x43da84[_0xa453('0x36')][_0xa453('0x39')]?_0x43da84[_0xa453('0x36')]:_0x2d7423['model'];_0x43da84[_0xa453('0x3d')]=qs[_0xa453('0x3e')](_0x19ea17['query']['sort']);_0x43da84[_0xa453('0x3f')]=qs['filters'](_['pick'](_0x19ea17[_0xa453('0x32')],_0x2d7423[_0xa453('0x34')]));if(_0x19ea17[_0xa453('0x32')]['filter']){_0x43da84[_0xa453('0x3f')]=_[_0xa453('0x42')](_0x43da84[_0xa453('0x3f')],{'$or':_[_0xa453('0x2d')](_0x43da84[_0xa453('0x36')],function(_0x144947){var _0x2ce407={};_0x2ce407[_0x144947]={'$like':'%'+_0x19ea17[_0xa453('0x32')][_0xa453('0x41')]+'%'};return _0x2ce407;})});}_0x43da84=_[_0xa453('0x42')]({},_0x43da84,_0x19ea17['options']);return _0x346e96['getAgents'](_0x43da84);}})[_0xa453('0x25')](function(_0x16a62a){if(_0x16a62a){_0x46ca21=_0x16a62a['length'];if(!_0x19ea17['query'][_0xa453('0x3a')](_0xa453('0x3b'))){_0x43da84[_0xa453('0x3c')]=qs[_0xa453('0x3c')](_0x19ea17[_0xa453('0x32')]['limit']);_0x43da84[_0xa453('0x20')]=qs[_0xa453('0x20')](_0x19ea17[_0xa453('0x32')]['offset']);}return _0x346e96[_0xa453('0x87')](_0x43da84);}})['then'](function(_0x447bb5){if(_0x447bb5){return _0x447bb5?{'count':_0x46ca21,'rows':_0x447bb5}:null;}})['then'](respondWithResult(_0x476bae,null))['catch'](handleError(_0x476bae,null));}; \ No newline at end of file +var _0x5f8f=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','defaults','localhost','./smsQueue.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','get','SmsQueues','name','index','map','SmsQueue','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','user','role','UserProfileSection','userProfileId','UserProfileResource','describe','getMembers','UserSmsQueue','hasOwnProperty','nolimit','SmsQueueId','User','agent','updatedAt','createdAt','format','%s/%s','SIP','smsPause','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','forEach','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','all','compact','transaction','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','eml-format','request-promise','moment','bluebird','mustache','path','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x5f8f,0x17b));var _0xf5f8=function(_0x17a78c,_0xbb7874){_0x17a78c=_0x17a78c-0x0;var _0x36a282=_0x5f8f[_0x17a78c];return _0x36a282;};'use strict';var pdf=require(_0xf5f8('0x0'));var emlformat=require(_0xf5f8('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf5f8('0x2'));var moment=require(_0xf5f8('0x3'));var BPromise=require(_0xf5f8('0x4'));var Mustache=require(_0xf5f8('0x5'));var util=require('util');var path=require(_0xf5f8('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf5f8('0x7'));var fs=require('fs');var _=require(_0xf5f8('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf5f8('0x9'));var deskjs=require(_0xf5f8('0xa'));var toCsv=require('to-csv');var querystring=require(_0xf5f8('0xb'));var Papa=require('papaparse');var Redis=require(_0xf5f8('0xc'));var authService=require(_0xf5f8('0xd'));var qs=require(_0xf5f8('0xe'));var as=require(_0xf5f8('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf5f8('0x10'))(_0xf5f8('0x11'));var utils=require('../../config/utils');var config=require(_0xf5f8('0x12'));var db=require('../../mysqldb')['db'];config[_0xf5f8('0x13')]=_[_0xf5f8('0x14')](config[_0xf5f8('0x13')],{'host':_0xf5f8('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf5f8('0x13')]));require(_0xf5f8('0x16'))[_0xf5f8('0x17')](socket);function respondWithStatusCode(_0x5609bf,_0x4a55c1){_0x4a55c1=_0x4a55c1||0xcc;return function(_0x1ac4d4){if(_0x1ac4d4){return _0x5609bf[_0xf5f8('0x18')](_0x4a55c1);}return _0x5609bf[_0xf5f8('0x19')](_0x4a55c1)[_0xf5f8('0x1a')]();};}function respondWithResult(_0x264d21,_0x4213d1){_0x4213d1=_0x4213d1||0xc8;return function(_0x11e040){if(_0x11e040){return _0x264d21[_0xf5f8('0x19')](_0x4213d1)['json'](_0x11e040);}};}function respondWithFilteredResult(_0x2db773,_0x59dfd2){return function(_0x772ade){if(_0x772ade){var _0x55e53e=_0x772ade[_0xf5f8('0x1b')],_0x5ecec7=_0x59dfd2[_0xf5f8('0x1c')],_0x573cbd=_0x59dfd2[_0xf5f8('0x1c')]+_0x59dfd2[_0xf5f8('0x1d')],_0x1a6aeb;if(_0x573cbd>=_0x55e53e){_0x573cbd=_0x55e53e;_0x1a6aeb=0xc8;}else{_0x1a6aeb=0xce;}_0x2db773[_0xf5f8('0x19')](_0x1a6aeb);return _0x2db773[_0xf5f8('0x1e')](_0xf5f8('0x1f'),_0x5ecec7+'-'+_0x573cbd+'/'+_0x55e53e)[_0xf5f8('0x20')](_0x772ade);}return null;};}function patchUpdates(_0x1d5de5){return function(_0x5ad1ea){try{jsonpatch[_0xf5f8('0x21')](_0x5ad1ea,_0x1d5de5,!![]);}catch(_0x4e55e9){return BPromise[_0xf5f8('0x22')](_0x4e55e9);}return _0x5ad1ea[_0xf5f8('0x23')]();};}function saveUpdates(_0x550cee,_0x1efc05){return function(_0x115721){if(_0x115721){return _0x115721[_0xf5f8('0x24')](_0x550cee)['then'](function(_0x44d055){return _0x44d055;});}return null;};}function removeEntity(_0x403d74,_0x3b97e3){return function(_0x4a93cd){if(_0x4a93cd){return _0x4a93cd[_0xf5f8('0x25')]()[_0xf5f8('0x26')](function(){var _0x1741a6=_0x4a93cd[_0xf5f8('0x27')]({'plain':!![]});var _0xf168ba=_0xf5f8('0x28');return db['UserProfileResource'][_0xf5f8('0x25')]({'where':{'type':_0xf168ba,'resourceId':_0x1741a6['id']}})[_0xf5f8('0x26')](function(){return _0x4a93cd;});})[_0xf5f8('0x26')](function(){_0x403d74[_0xf5f8('0x19')](0xcc)[_0xf5f8('0x1a')]();});}};}function handleEntityNotFound(_0x4889f7,_0x149b6e){return function(_0x1e96bd){if(!_0x1e96bd){_0x4889f7[_0xf5f8('0x18')](0x194);}return _0x1e96bd;};}function handleError(_0x5719ce,_0x5e321f){_0x5e321f=_0x5e321f||0x1f4;return function(_0x1dfde6){logger['error'](_0x1dfde6['stack']);if(_0x1dfde6[_0xf5f8('0x29')]){delete _0x1dfde6[_0xf5f8('0x29')];}_0x5719ce['status'](_0x5e321f)['send'](_0x1dfde6);};}exports[_0xf5f8('0x2a')]=function(_0x3975a1,_0x1be80e){var _0x27bf48={},_0x4119cf={},_0x42c69d={'count':0x0,'rows':[]};var _0x41dc06=_[_0xf5f8('0x2b')](db[_0xf5f8('0x2c')][_0xf5f8('0x2d')],function(_0x12b676){return{'name':_0x12b676[_0xf5f8('0x2e')],'type':_0x12b676[_0xf5f8('0x2f')][_0xf5f8('0x30')]};});_0x4119cf['model']=_[_0xf5f8('0x2b')](_0x41dc06,'name');_0x4119cf[_0xf5f8('0x31')]=_['keys'](_0x3975a1[_0xf5f8('0x31')]);_0x4119cf[_0xf5f8('0x32')]=_['intersection'](_0x4119cf[_0xf5f8('0x33')],_0x4119cf[_0xf5f8('0x31')]);_0x27bf48[_0xf5f8('0x34')]=_[_0xf5f8('0x35')](_0x4119cf[_0xf5f8('0x33')],qs['fields'](_0x3975a1[_0xf5f8('0x31')][_0xf5f8('0x36')]));_0x27bf48['attributes']=_0x27bf48[_0xf5f8('0x34')]['length']?_0x27bf48[_0xf5f8('0x34')]:_0x4119cf[_0xf5f8('0x33')];if(!_0x3975a1[_0xf5f8('0x31')]['hasOwnProperty']('nolimit')){_0x27bf48[_0xf5f8('0x1d')]=qs[_0xf5f8('0x1d')](_0x3975a1[_0xf5f8('0x31')][_0xf5f8('0x1d')]);_0x27bf48['offset']=qs[_0xf5f8('0x1c')](_0x3975a1[_0xf5f8('0x31')][_0xf5f8('0x1c')]);}_0x27bf48[_0xf5f8('0x37')]=qs[_0xf5f8('0x38')](_0x3975a1[_0xf5f8('0x31')][_0xf5f8('0x38')]);_0x27bf48[_0xf5f8('0x39')]=qs[_0xf5f8('0x32')](_[_0xf5f8('0x3a')](_0x3975a1[_0xf5f8('0x31')],_0x4119cf[_0xf5f8('0x32')]),_0x41dc06);if(_0x3975a1[_0xf5f8('0x31')][_0xf5f8('0x3b')]){_0x27bf48[_0xf5f8('0x39')]=_[_0xf5f8('0x3c')](_0x27bf48['where'],{'$or':_[_0xf5f8('0x2b')](_0x41dc06,function(_0x56c539){if(_0x56c539[_0xf5f8('0x2f')]!=='VIRTUAL'){var _0x36e6cc={};_0x36e6cc[_0x56c539[_0xf5f8('0x29')]]={'$like':'%'+_0x3975a1[_0xf5f8('0x31')][_0xf5f8('0x3b')]+'%'};return _0x36e6cc;}})});}_0x27bf48=_[_0xf5f8('0x3c')]({},_0x27bf48,_0x3975a1[_0xf5f8('0x3d')]);var _0x5d2236={'where':_0x27bf48[_0xf5f8('0x39')]};return db[_0xf5f8('0x2c')][_0xf5f8('0x1b')](_0x5d2236)['then'](function(_0x80247e){_0x42c69d[_0xf5f8('0x1b')]=_0x80247e;if(_0x3975a1[_0xf5f8('0x31')][_0xf5f8('0x3e')]){_0x27bf48[_0xf5f8('0x3f')]=[{'all':!![]}];}return db[_0xf5f8('0x2c')][_0xf5f8('0x40')](_0x27bf48);})[_0xf5f8('0x26')](function(_0x4568d4){_0x42c69d[_0xf5f8('0x41')]=_0x4568d4;return _0x42c69d;})[_0xf5f8('0x26')](respondWithFilteredResult(_0x1be80e,_0x27bf48))[_0xf5f8('0x42')](handleError(_0x1be80e,null));};exports[_0xf5f8('0x43')]=function(_0x37db00,_0xdfaa23){var _0x31d788={'raw':!![],'where':{'id':_0x37db00[_0xf5f8('0x44')]['id']}},_0x354752={};_0x354752[_0xf5f8('0x33')]=_['keys'](db[_0xf5f8('0x2c')][_0xf5f8('0x2d')]);_0x354752[_0xf5f8('0x31')]=_[_0xf5f8('0x45')](_0x37db00['query']);_0x354752[_0xf5f8('0x32')]=_[_0xf5f8('0x35')](_0x354752[_0xf5f8('0x33')],_0x354752['query']);_0x31d788[_0xf5f8('0x34')]=_[_0xf5f8('0x35')](_0x354752[_0xf5f8('0x33')],qs[_0xf5f8('0x36')](_0x37db00[_0xf5f8('0x31')][_0xf5f8('0x36')]));_0x31d788['attributes']=_0x31d788['attributes'][_0xf5f8('0x46')]?_0x31d788[_0xf5f8('0x34')]:_0x354752[_0xf5f8('0x33')];if(_0x37db00[_0xf5f8('0x31')]['includeAll']){_0x31d788['include']=[{'all':!![]}];}_0x31d788=_[_0xf5f8('0x3c')]({},_0x31d788,_0x37db00['options']);return db[_0xf5f8('0x2c')][_0xf5f8('0x47')](_0x31d788)[_0xf5f8('0x26')](handleEntityNotFound(_0xdfaa23,null))['then'](respondWithResult(_0xdfaa23,null))[_0xf5f8('0x42')](handleError(_0xdfaa23,null));};exports[_0xf5f8('0x48')]=function(_0x3bda6f,_0xf4d3a0){return db[_0xf5f8('0x2c')][_0xf5f8('0x48')](_0x3bda6f[_0xf5f8('0x49')],{})[_0xf5f8('0x26')](function(_0xff9534){var _0x43543d=_0x3bda6f[_0xf5f8('0x4a')]['get']({'plain':!![]});if(!_0x43543d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43543d[_0xf5f8('0x4b')]==='user'){var _0x216f0e=_0xff9534['get']({'plain':!![]});var _0x208204='SmsQueues';return db[_0xf5f8('0x4c')]['find']({'where':{'name':_0x208204,'userProfileId':_0x43543d[_0xf5f8('0x4d')]},'raw':!![]})[_0xf5f8('0x26')](function(_0x420a5c){if(_0x420a5c&&_0x420a5c['autoAssociation']===0x0){return db[_0xf5f8('0x4e')]['create']({'name':_0x216f0e['name'],'resourceId':_0x216f0e['id'],'type':_0x420a5c[_0xf5f8('0x29')],'sectionId':_0x420a5c['id']},{})[_0xf5f8('0x26')](function(){return _0xff9534;});}else{return _0xff9534;}})[_0xf5f8('0x42')](function(_0x23eed5){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23eed5);throw _0x23eed5;});}return _0xff9534;})[_0xf5f8('0x26')](respondWithResult(_0xf4d3a0,0xc9))[_0xf5f8('0x42')](handleError(_0xf4d3a0,null));};exports['update']=function(_0x5f063a,_0x194a38){if(_0x5f063a[_0xf5f8('0x49')]['id']){delete _0x5f063a['body']['id'];}return db[_0xf5f8('0x2c')][_0xf5f8('0x47')]({'where':{'id':_0x5f063a['params']['id']}})[_0xf5f8('0x26')](handleEntityNotFound(_0x194a38,null))[_0xf5f8('0x26')](saveUpdates(_0x5f063a[_0xf5f8('0x49')],null))['then'](respondWithResult(_0x194a38,null))[_0xf5f8('0x42')](handleError(_0x194a38,null));};exports[_0xf5f8('0x25')]=function(_0xa3029c,_0x338a31){return db[_0xf5f8('0x2c')][_0xf5f8('0x47')]({'where':{'id':_0xa3029c[_0xf5f8('0x44')]['id']}})['then'](handleEntityNotFound(_0x338a31,null))[_0xf5f8('0x26')](removeEntity(_0x338a31,null))['catch'](handleError(_0x338a31,null));};exports[_0xf5f8('0x4f')]=function(_0xf0e5a6,_0x43adfb){return db[_0xf5f8('0x2c')][_0xf5f8('0x4f')]()['then'](respondWithResult(_0x43adfb,null))[_0xf5f8('0x42')](handleError(_0x43adfb,null));};exports[_0xf5f8('0x50')]=function(_0x278eaf,_0x5c7653,_0x306f8d){var _0x21dbc5={'raw':!![],'where':{}},_0x1a35a4={},_0x23211b;return db[_0xf5f8('0x2c')]['findOne']({'where':{'id':_0x278eaf[_0xf5f8('0x44')]['id']}})['then'](handleEntityNotFound(_0x5c7653,null))[_0xf5f8('0x26')](function(_0x486fb1){if(_0x486fb1){_0x23211b=_0x486fb1['get']({'plain':!![]});_0x1a35a4[_0xf5f8('0x33')]=_[_0xf5f8('0x45')](db[_0xf5f8('0x51')][_0xf5f8('0x2d')]);_0x1a35a4[_0xf5f8('0x31')]=_['keys'](_0x278eaf['query']);_0x1a35a4[_0xf5f8('0x32')]=_[_0xf5f8('0x35')](_0x1a35a4['model'],_0x1a35a4['query']);_0x21dbc5[_0xf5f8('0x34')]=_[_0xf5f8('0x35')](_0x1a35a4['model'],qs['fields'](_0x278eaf[_0xf5f8('0x31')][_0xf5f8('0x36')]));_0x21dbc5['attributes']=_0x21dbc5[_0xf5f8('0x34')][_0xf5f8('0x46')]?_0x21dbc5['attributes']:_0x1a35a4[_0xf5f8('0x33')];if(!_0x278eaf['query'][_0xf5f8('0x52')](_0xf5f8('0x53'))){_0x21dbc5[_0xf5f8('0x1d')]=qs[_0xf5f8('0x1d')](_0x278eaf['query'][_0xf5f8('0x1d')]);_0x21dbc5[_0xf5f8('0x1c')]=qs[_0xf5f8('0x1c')](_0x278eaf[_0xf5f8('0x31')][_0xf5f8('0x1c')]);}_0x21dbc5[_0xf5f8('0x37')]=qs[_0xf5f8('0x38')](_0x278eaf[_0xf5f8('0x31')][_0xf5f8('0x38')]);_0x21dbc5[_0xf5f8('0x39')]=qs[_0xf5f8('0x32')](_[_0xf5f8('0x3a')](_0x278eaf['query'],_0x1a35a4[_0xf5f8('0x32')]));_0x21dbc5['where'][_0xf5f8('0x54')]=_0x486fb1['id'];if(_0x278eaf[_0xf5f8('0x31')][_0xf5f8('0x3b')]){_0x21dbc5[_0xf5f8('0x39')]=_[_0xf5f8('0x3c')](_0x21dbc5[_0xf5f8('0x39')],{'$or':_[_0xf5f8('0x2b')](_0x21dbc5[_0xf5f8('0x34')],function(_0x3441d1){var _0x112de3={};_0x112de3[_0x3441d1]={'$like':'%'+_0x278eaf['query']['filter']+'%'};return _0x112de3;})});}_0x21dbc5=_['merge']({},_0x21dbc5,_0x278eaf['options']);return db[_0xf5f8('0x51')][_0xf5f8('0x40')](_0x21dbc5);}})[_0xf5f8('0x26')](function(_0x367061){if(_0x367061){return db[_0xf5f8('0x55')]['findAndCountAll']({'where':{'id':_[_0xf5f8('0x2b')](_0x367061,'UserId'),'role':_0xf5f8('0x56')},'attributes':['id',_0xf5f8('0x29'),'smsPause',_0xf5f8('0x57'),_0xf5f8('0x58')]});}})[_0xf5f8('0x26')](function(_0x5b5063){if(_0x5b5063){return{'count':_0x5b5063[_0xf5f8('0x1b')],'rows':_[_0xf5f8('0x2b')](_0x5b5063['rows'],function(_0x5b3c35){return{'membername':_0x5b3c35[_0xf5f8('0x29')],'UserId':_0x5b3c35['id'],'queue_name':_0x23211b['name'],'SmsQueueId':_0x23211b['id'],'interface':util[_0xf5f8('0x59')](_0xf5f8('0x5a'),_0xf5f8('0x5b'),_0x5b3c35['name']),'penalty':0x0,'paused':_0x5b3c35[_0xf5f8('0x5c')],'createdAt':_0x5b3c35[_0xf5f8('0x58')],'updatedAt':_0x5b3c35[_0xf5f8('0x57')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5f8('0x26')](respondWithFilteredResult(_0x5c7653,_0x21dbc5))['catch'](handleError(_0x5c7653,null));};exports[_0xf5f8('0x5d')]=function(_0x1fd7df,_0x1738cb,_0x1efc08){var _0x396868={};var _0x13b978={};var _0x2b95e0;var _0x5b961b;return db[_0xf5f8('0x2c')][_0xf5f8('0x5e')]({'where':{'id':_0x1fd7df[_0xf5f8('0x44')]['id']}})[_0xf5f8('0x26')](handleEntityNotFound(_0x1738cb,null))[_0xf5f8('0x26')](function(_0x3c2600){if(_0x3c2600){_0x2b95e0=_0x3c2600;_0x13b978['model']=_['keys'](db[_0xf5f8('0x5f')][_0xf5f8('0x2d')]);_0x13b978[_0xf5f8('0x31')]=_[_0xf5f8('0x45')](_0x1fd7df['query']);_0x13b978['filters']=_[_0xf5f8('0x35')](_0x13b978[_0xf5f8('0x33')],_0x13b978['query']);_0x396868['attributes']=_[_0xf5f8('0x35')](_0x13b978[_0xf5f8('0x33')],qs['fields'](_0x1fd7df['query'][_0xf5f8('0x36')]));_0x396868[_0xf5f8('0x34')]=_0x396868[_0xf5f8('0x34')][_0xf5f8('0x46')]?_0x396868[_0xf5f8('0x34')]:_0x13b978[_0xf5f8('0x33')];_0x396868['order']=qs['sort'](_0x1fd7df[_0xf5f8('0x31')][_0xf5f8('0x38')]);_0x396868[_0xf5f8('0x39')]=qs[_0xf5f8('0x32')](_[_0xf5f8('0x3a')](_0x1fd7df[_0xf5f8('0x31')],_0x13b978[_0xf5f8('0x32')]));if(_0x1fd7df[_0xf5f8('0x31')][_0xf5f8('0x3b')]){_0x396868[_0xf5f8('0x39')]=_[_0xf5f8('0x3c')](_0x396868[_0xf5f8('0x39')],{'$or':_[_0xf5f8('0x2b')](_0x396868['attributes'],function(_0x5248bb){var _0x249a6c={};_0x249a6c[_0x5248bb]={'$like':'%'+_0x1fd7df[_0xf5f8('0x31')]['filter']+'%'};return _0x249a6c;})});}_0x396868=_[_0xf5f8('0x3c')]({},_0x396868,_0x1fd7df['options']);return _0x2b95e0[_0xf5f8('0x5d')](_0x396868);}})['then'](function(_0x478fc8){if(_0x478fc8){_0x5b961b=_0x478fc8['length'];if(!_0x1fd7df[_0xf5f8('0x31')][_0xf5f8('0x52')](_0xf5f8('0x53'))){_0x396868[_0xf5f8('0x1d')]=qs['limit'](_0x1fd7df[_0xf5f8('0x31')]['limit']);_0x396868[_0xf5f8('0x1c')]=qs['offset'](_0x1fd7df[_0xf5f8('0x31')]['offset']);}return _0x2b95e0[_0xf5f8('0x5d')](_0x396868);}})[_0xf5f8('0x26')](function(_0x3813ae){if(_0x3813ae){return _0x3813ae?{'count':_0x5b961b,'rows':_0x3813ae}:null;}})[_0xf5f8('0x26')](respondWithResult(_0x1738cb,null))[_0xf5f8('0x42')](handleError(_0x1738cb,null));};exports[_0xf5f8('0x60')]=function(_0x55d2e8,_0x902c29,_0x2bae45){var _0xe5b5d4=_0x55d2e8[_0xf5f8('0x49')][_0xf5f8('0x61')];return db[_0xf5f8('0x5f')][_0xf5f8('0x40')]({'where':{'id':_0xe5b5d4},'attributes':['id'],'include':[{'model':db[_0xf5f8('0x55')],'as':_0xf5f8('0x62'),'attributes':['id',_0xf5f8('0x29'),_0xf5f8('0x63'),_0xf5f8('0x64'),_0xf5f8('0x65')],'raw':!![]}]})[_0xf5f8('0x26')](function(_0x40b78a){if(_0x40b78a){var _0x361f1e=_[_0xf5f8('0x66')](_0x40b78a,function(_0x5a21fa){var _0x477a90=_0x5a21fa['get']({'plain':!![]});return _0x477a90['Agents'];});return db[_0xf5f8('0x2c')][_0xf5f8('0x47')]({'where':{'id':_0x55d2e8[_0xf5f8('0x44')]['id']}})[_0xf5f8('0x26')](function(_0x2a3a70){return db[_0xf5f8('0x67')]['transaction'](function(_0xce5dd3){return _0x2a3a70['addTeams'](_0xe5b5d4,{'transaction':_0xce5dd3})[_0xf5f8('0x26')](function(){return BPromise['each'](_0x361f1e,function(_0x24ed64){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x24ed64['id'],'SmsQueueId':_0x55d2e8['params']['id']},'transaction':_0xce5dd3});});})['then'](function(){_0x361f1e[_0xf5f8('0x68')](function(_0x58dce2){socket[_0xf5f8('0x69')](_0xf5f8('0x6a'),{'UserId':_0x58dce2['id'],'SmsQueueId':_0x2a3a70['id']});});});});});}})['then'](respondWithStatusCode(_0x902c29,null))['catch'](handleError(_0x902c29,null));};exports[_0xf5f8('0x6b')]=function(_0x267467,_0x326d98,_0x39ee1b){return db[_0xf5f8('0x5f')]['findAll']({'where':{'id':_0x267467[_0xf5f8('0x31')][_0xf5f8('0x61')]},'attributes':['id'],'include':[{'model':db[_0xf5f8('0x55')],'as':_0xf5f8('0x62'),'attributes':['id'],'raw':!![]}]})[_0xf5f8('0x26')](handleEntityNotFound(_0x326d98,null))[_0xf5f8('0x26')](function(_0x315538){var _0x4915ad=_[_0xf5f8('0x2b')](_0x315538,'id');var _0x2a6551=[];var _0x985c37=[];var _0x359a4e=squel[_0xf5f8('0x6c')]();_0x359a4e[_0xf5f8('0x6d')](_0xf5f8('0x6e'))[_0xf5f8('0x6f')](_0xf5f8('0x70'),'tq')['join'](_0xf5f8('0x71'),'ut',_0xf5f8('0x72'))[_0xf5f8('0x39')](_0xf5f8('0x73'),_0x267467[_0xf5f8('0x44')]['id']);for(var _0x4c1233=0x0;_0x4c1233<_0x315538[_0xf5f8('0x46')];_0x4c1233+=0x1){let _0x4b6af8=_0x315538[_0x4c1233];for(var _0x2b5f53=0x0;_0x2b5f53<_0x4b6af8[_0xf5f8('0x62')][_0xf5f8('0x46')];_0x2b5f53+=0x1){let _0x2c85b0=_0x4b6af8[_0xf5f8('0x62')][_0x2b5f53];var _0x55bf87=_0x359a4e[_0xf5f8('0x74')]();_0x55bf87[_0xf5f8('0x39')](_0xf5f8('0x75'),_0x2c85b0['id']);_0x985c37['push'](db[_0xf5f8('0x67')][_0xf5f8('0x31')](_0x55bf87['toString'](),{'type':db[_0xf5f8('0x67')][_0xf5f8('0x76')]['SELECT']})[_0xf5f8('0x26')](function(_0x4f0bf5){if(_0x4f0bf5[_0xf5f8('0x46')]===0x1){return _0x2c85b0['id'];}else{var _0x5a07d7=_[_0xf5f8('0x77')](_[_0xf5f8('0x2b')](_0x4f0bf5,_0xf5f8('0x78')),function(_0x56ce1d){return _['includes'](_0x4915ad,_0x56ce1d);});if(_0x5a07d7){return _0x2c85b0['id'];}}}));}}return BPromise[_0xf5f8('0x79')](_0x985c37)[_0xf5f8('0x26')](function(_0x5f43d6){_0x2a6551=_(_0x2a6551)['union'](_0x5f43d6)[_0xf5f8('0x7a')]()['value']();return db[_0xf5f8('0x2c')]['find']({'where':{'id':_0x267467[_0xf5f8('0x44')]['id']}})[_0xf5f8('0x26')](function(_0x154781){return db['sequelize'][_0xf5f8('0x7b')](function(_0x3f2f57){return _0x154781[_0xf5f8('0x6b')](_0x267467[_0xf5f8('0x31')][_0xf5f8('0x61')],{'transaction':_0x3f2f57})['then'](function(){if(!_[_0xf5f8('0x7c')](_0x2a6551)){return _0x154781[_0xf5f8('0x7d')](_0x2a6551,{'transaction':_0x3f2f57});}})['then'](function(){_0x2a6551[_0xf5f8('0x68')](function(_0x1f1f77){socket[_0xf5f8('0x69')](_0xf5f8('0x7e'),{'UserId':_0x1f1f77,'SmsQueueId':_0x154781['id']});});});});});});})[_0xf5f8('0x26')](respondWithStatusCode(_0x326d98,null))['catch'](handleError(_0x326d98,null));};exports['addAgents']=function(_0x5f32a5,_0x351503,_0x55faf1){return db[_0xf5f8('0x2c')][_0xf5f8('0x47')]({'where':{'id':_0x5f32a5[_0xf5f8('0x44')]['id']}})[_0xf5f8('0x26')](handleEntityNotFound(_0x351503,null))[_0xf5f8('0x26')](function(_0x359de2){if(_0x359de2){return _0x359de2[_0xf5f8('0x7f')](_0x5f32a5['body'][_0xf5f8('0x61')],_[_0xf5f8('0x80')](_0x5f32a5[_0xf5f8('0x49')],['ids','id'])||{})['spread'](function(_0x2478e9){for(var _0x3c3bff=0x0;_0x3c3bff<_0x5f32a5['body'][_0xf5f8('0x61')][_0xf5f8('0x46')];_0x3c3bff+=0x1){socket['emit'](_0xf5f8('0x6a'),{'UserId':_0x5f32a5['body'][_0xf5f8('0x61')][_0x3c3bff],'SmsQueueId':_0x5f32a5[_0xf5f8('0x44')]['id']});}return _0x2478e9;});}})['then'](respondWithResult(_0x351503,null))[_0xf5f8('0x42')](handleError(_0x351503,null));};exports[_0xf5f8('0x7d')]=function(_0x546808,_0x463dca,_0x40b222){return db['SmsQueue']['find']({'where':{'id':_0x546808['params']['id']}})[_0xf5f8('0x26')](handleEntityNotFound(_0x463dca,null))[_0xf5f8('0x26')](function(_0x296cfa){if(_0x296cfa){return _0x296cfa[_0xf5f8('0x7d')](_0x546808['query'][_0xf5f8('0x61')])[_0xf5f8('0x26')](function(){if(_[_0xf5f8('0x81')](_0x546808[_0xf5f8('0x31')][_0xf5f8('0x61')])){for(var _0x49b02d=0x0;_0x49b02d<_0x546808[_0xf5f8('0x31')]['ids']['length'];_0x49b02d+=0x1){socket[_0xf5f8('0x69')](_0xf5f8('0x7e'),{'UserId':Number(_0x546808[_0xf5f8('0x31')][_0xf5f8('0x61')][_0x49b02d]),'SmsQueueId':Number(_0x546808['params']['id'])});}}else{socket[_0xf5f8('0x69')]('userSmsQueue:remove',{'UserId':Number(_0x546808[_0xf5f8('0x31')][_0xf5f8('0x61')]),'SmsQueueId':Number(_0x546808[_0xf5f8('0x44')]['id'])});}});}})[_0xf5f8('0x26')](respondWithStatusCode(_0x463dca,null))[_0xf5f8('0x42')](handleError(_0x463dca,null));};exports['getAgents']=function(_0x4d581a,_0x2d36ba,_0x5e7324){var _0x5c7b52={};var _0x2c56e5={};var _0x1c2f04;var _0x43ef24;return db['SmsQueue']['findOne']({'where':{'id':_0x4d581a[_0xf5f8('0x44')]['id']}})[_0xf5f8('0x26')](handleEntityNotFound(_0x2d36ba,null))[_0xf5f8('0x26')](function(_0x4ce731){if(_0x4ce731){_0x1c2f04=_0x4ce731;_0x2c56e5[_0xf5f8('0x33')]=_[_0xf5f8('0x45')](db[_0xf5f8('0x55')]['rawAttributes']);_0x2c56e5[_0xf5f8('0x31')]=_[_0xf5f8('0x45')](_0x4d581a[_0xf5f8('0x31')]);_0x2c56e5[_0xf5f8('0x32')]=_['intersection'](_0x2c56e5[_0xf5f8('0x33')],_0x2c56e5['query']);_0x5c7b52[_0xf5f8('0x34')]=_[_0xf5f8('0x35')](_0x2c56e5[_0xf5f8('0x33')],qs[_0xf5f8('0x36')](_0x4d581a[_0xf5f8('0x31')][_0xf5f8('0x36')]));_0x5c7b52['attributes']=_0x5c7b52[_0xf5f8('0x34')]['length']?_0x5c7b52['attributes']:_0x2c56e5[_0xf5f8('0x33')];_0x5c7b52[_0xf5f8('0x37')]=qs[_0xf5f8('0x38')](_0x4d581a['query'][_0xf5f8('0x38')]);_0x5c7b52[_0xf5f8('0x39')]=qs['filters'](_[_0xf5f8('0x3a')](_0x4d581a['query'],_0x2c56e5[_0xf5f8('0x32')]));if(_0x4d581a[_0xf5f8('0x31')][_0xf5f8('0x3b')]){_0x5c7b52[_0xf5f8('0x39')]=_['merge'](_0x5c7b52['where'],{'$or':_['map'](_0x5c7b52[_0xf5f8('0x34')],function(_0x4c4ddd){var _0x2439d6={};_0x2439d6[_0x4c4ddd]={'$like':'%'+_0x4d581a[_0xf5f8('0x31')][_0xf5f8('0x3b')]+'%'};return _0x2439d6;})});}_0x5c7b52=_[_0xf5f8('0x3c')]({},_0x5c7b52,_0x4d581a[_0xf5f8('0x3d')]);return _0x1c2f04[_0xf5f8('0x82')](_0x5c7b52);}})[_0xf5f8('0x26')](function(_0x5e490f){if(_0x5e490f){_0x43ef24=_0x5e490f[_0xf5f8('0x46')];if(!_0x4d581a[_0xf5f8('0x31')][_0xf5f8('0x52')]('nolimit')){_0x5c7b52[_0xf5f8('0x1d')]=qs[_0xf5f8('0x1d')](_0x4d581a[_0xf5f8('0x31')][_0xf5f8('0x1d')]);_0x5c7b52[_0xf5f8('0x1c')]=qs[_0xf5f8('0x1c')](_0x4d581a['query']['offset']);}return _0x1c2f04[_0xf5f8('0x82')](_0x5c7b52);}})[_0xf5f8('0x26')](function(_0x3a2bde){if(_0x3a2bde){return _0x3a2bde?{'count':_0x43ef24,'rows':_0x3a2bde}:null;}})[_0xf5f8('0x26')](respondWithResult(_0x2d36ba,null))[_0xf5f8('0x42')](handleError(_0x2d36ba,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 3e6520f..f8588cc 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 _0x0925=['SmsQueue','setMaxListeners','remove','emit','exports','events'];(function(_0x523a32,_0x598676){var _0x229a4e=function(_0x463ab1){while(--_0x463ab1){_0x523a32['push'](_0x523a32['shift']());}};_0x229a4e(++_0x598676);}(_0x0925,0x179));var _0x5092=function(_0x18ea99,_0x5d0dc6){_0x18ea99=_0x18ea99-0x0;var _0x4e1a63=_0x0925[_0x18ea99];return _0x4e1a63;};'use strict';var EventEmitter=require(_0x5092('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x5092('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x5092('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5092('0x3')};function emitEvent(_0x3fa120){return function(_0xbf6db5,_0x2e4df3,_0x50153c){SmsQueueEvents[_0x5092('0x4')](_0x3fa120+':'+_0xbf6db5['id'],_0xbf6db5);SmsQueueEvents[_0x5092('0x4')](_0x3fa120,_0xbf6db5);_0x50153c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x5092('0x5')]=SmsQueueEvents; \ No newline at end of file +var _0x9931=['SmsQueue','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x5a56eb,_0x310171){var _0x2ff029=function(_0x1aa403){while(--_0x1aa403){_0x5a56eb['push'](_0x5a56eb['shift']());}};_0x2ff029(++_0x310171);}(_0x9931,0x116));var _0x1993=function(_0x47b204,_0x147951){_0x47b204=_0x47b204-0x0;var _0x3956a1=_0x9931[_0x47b204];return _0x3956a1;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x1993('0x0'))['db'][_0x1993('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1993('0x2')](0x0);var events={'afterCreate':_0x1993('0x3'),'afterUpdate':_0x1993('0x4'),'afterDestroy':_0x1993('0x5')};function emitEvent(_0x233539){return function(_0x5e9bde,_0x56435c,_0x2cf407){SmsQueueEvents['emit'](_0x233539+':'+_0x5e9bde['id'],_0x5e9bde);SmsQueueEvents['emit'](_0x233539,_0x5e9bde);_0x2cf407(null);};}for(var e in events){if(events[_0x1993('0x6')](e)){var event=events[e];SmsQueue[_0x1993('0x7')](e,emitEvent(event));}}module[_0x1993('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 94e3ba3..a054185 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 _0xf72b=['./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x156643,_0xe3fd8c){var _0x39aead=function(_0x1fb76c){while(--_0x1fb76c){_0x156643['push'](_0x156643['shift']());}};_0x39aead(++_0xe3fd8c);}(_0xf72b,0x1d9));var _0xbf72=function(_0x410f6f,_0x16bb49){_0x410f6f=_0x410f6f-0x0;var _0x451201=_0xf72b[_0x410f6f];return _0x451201;};'use strict';var _=require(_0xbf72('0x0'));var util=require('util');var logger=require(_0xbf72('0x1'))('api');var moment=require(_0xbf72('0x2'));var BPromise=require(_0xbf72('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf72('0x4'));var rimraf=require(_0xbf72('0x5'));var config=require(_0xbf72('0x6'));var attributes=require(_0xbf72('0x7'));module[_0xbf72('0x8')]=function(_0x2b8440,_0x5ee060){return _0x2b8440[_0xbf72('0x9')](_0xbf72('0xa'),attributes,{'tableName':_0xbf72('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9335=['SmsQueue','sms_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x560653,_0x3c1465){var _0x1f850c=function(_0x2d3b7c){while(--_0x2d3b7c){_0x560653['push'](_0x560653['shift']());}};_0x1f850c(++_0x3c1465);}(_0x9335,0xab));var _0x5933=function(_0x57bf9f,_0x2fbfcf){_0x57bf9f=_0x57bf9f-0x0;var _0x46b1e1=_0x9335[_0x57bf9f];return _0x46b1e1;};'use strict';var _=require(_0x5933('0x0'));var util=require(_0x5933('0x1'));var logger=require('../../config/logger')(_0x5933('0x2'));var moment=require(_0x5933('0x3'));var BPromise=require(_0x5933('0x4'));var rp=require(_0x5933('0x5'));var fs=require('fs');var path=require(_0x5933('0x6'));var rimraf=require(_0x5933('0x7'));var config=require(_0x5933('0x8'));var attributes=require('./smsQueue.attributes');module[_0x5933('0x9')]=function(_0x4de024,_0x553710){return _0x4de024[_0x5933('0xa')](_0x5933('0xb'),attributes,{'tableName':_0x5933('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 6e4083f..3278f2e 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 _0x741f=['result','catch','GetSmsQueue','findAll','options','raw','where','attributes','limit','model','map','include','ShowSmsQueue','SmsQueue','find','then','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x622035,_0x1a4b91){var _0x326cf2=function(_0x5c3002){while(--_0x5c3002){_0x622035['push'](_0x622035['shift']());}};_0x326cf2(++_0x1a4b91);}(_0x741f,0x1f0));var _0xf741=function(_0xdd3dd1,_0x113f25){_0xdd3dd1=_0xdd3dd1-0x0;var _0x777fc0=_0x741f[_0xdd3dd1];return _0x777fc0;};'use strict';var _=require(_0xf741('0x0'));var util=require(_0xf741('0x1'));var moment=require('moment');var BPromise=require(_0xf741('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf741('0x3'));var db=require(_0xf741('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf741('0x5'))(_0xf741('0x6'));var config=require(_0xf741('0x7'));var jayson=require(_0xf741('0x8'));var client=jayson[_0xf741('0x9')]['http']({'port':0x232a});config[_0xf741('0xa')]=_[_0xf741('0xb')](config[_0xf741('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf741('0xa')]));require(_0xf741('0xc'))[_0xf741('0xd')](socket);function respondWithRpcPromise(_0x500f82,_0x257975,_0x366845){return new BPromise(function(_0x9e6249,_0x5e2829){return client[_0xf741('0xe')](_0x500f82,_0x366845)['then'](function(_0x3f2a5e){logger[_0xf741('0xf')](_0xf741('0x10'),_0x257975,'request\x20sent');logger[_0xf741('0x11')](_0xf741('0x12'),_0x257975,'request\x20sent',JSON[_0xf741('0x13')](_0x3f2a5e));if(_0x3f2a5e[_0xf741('0x14')]){if(_0x3f2a5e[_0xf741('0x14')][_0xf741('0x15')]===0x1f4){logger['error'](_0xf741('0x10'),_0x257975,_0x3f2a5e[_0xf741('0x14')][_0xf741('0x16')]);return _0x5e2829(_0x3f2a5e[_0xf741('0x14')][_0xf741('0x16')]);}logger[_0xf741('0x14')](_0xf741('0x10'),_0x257975,_0x3f2a5e[_0xf741('0x14')]['message']);return _0x9e6249(_0x3f2a5e[_0xf741('0x14')][_0xf741('0x16')]);}else{logger[_0xf741('0xf')](_0xf741('0x10'),_0x257975,_0xf741('0x17'));_0x9e6249(_0x3f2a5e[_0xf741('0x18')]['message']);}})[_0xf741('0x19')](function(_0x426a08){logger[_0xf741('0x14')](_0xf741('0x10'),_0x257975,_0x426a08);_0x5e2829(_0x426a08);});});}exports[_0xf741('0x1a')]=function(_0x35aa8f){var _0x2f7f6e=this;return new Promise(function(_0x46e2ea,_0x4c921c){return db['SmsQueue'][_0xf741('0x1b')]({'raw':_0x35aa8f[_0xf741('0x1c')]?_0x35aa8f[_0xf741('0x1c')][_0xf741('0x1d')]===undefined?!![]:![]:!![],'where':_0x35aa8f[_0xf741('0x1c')]?_0x35aa8f[_0xf741('0x1c')][_0xf741('0x1e')]||null:null,'attributes':_0x35aa8f[_0xf741('0x1c')]?_0x35aa8f[_0xf741('0x1c')][_0xf741('0x1f')]||null:null,'limit':_0x35aa8f['options']?_0x35aa8f[_0xf741('0x1c')][_0xf741('0x20')]||null:null,'include':_0x35aa8f[_0xf741('0x1c')]?_0x35aa8f[_0xf741('0x1c')]['include']?_['map'](_0x35aa8f[_0xf741('0x1c')]['include'],function(_0x33e9e0){return{'model':db[_0x33e9e0[_0xf741('0x21')]],'as':_0x33e9e0['as'],'attributes':_0x33e9e0['attributes'],'include':_0x33e9e0['include']?_[_0xf741('0x22')](_0x33e9e0[_0xf741('0x23')],function(_0x293e93){return{'model':db[_0x293e93[_0xf741('0x21')]],'as':_0x293e93['as'],'attributes':_0x293e93['attributes'],'include':_0x293e93[_0xf741('0x23')]?_[_0xf741('0x22')](_0x293e93[_0xf741('0x23')],function(_0x81dc96){return{'model':db[_0x81dc96[_0xf741('0x21')]],'as':_0x81dc96['as'],'attributes':_0x81dc96[_0xf741('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2900af){logger['info'](_0xf741('0x1a'),_0x35aa8f);logger[_0xf741('0x11')](_0xf741('0x1a'),_0x35aa8f,JSON[_0xf741('0x13')](_0x2900af));_0x46e2ea(_0x2900af);})[_0xf741('0x19')](function(_0x17d596){logger[_0xf741('0x14')]('GetSmsQueue',_0x17d596[_0xf741('0x16')],_0x35aa8f);_0x4c921c(_0x2f7f6e[_0xf741('0x14')](0x1f4,_0x17d596[_0xf741('0x16')]));});});};exports[_0xf741('0x24')]=function(_0x2cc9ae){var _0x1d53ee=this;return new Promise(function(_0x230878,_0x3e20d5){return db[_0xf741('0x25')][_0xf741('0x26')]({'raw':_0x2cc9ae[_0xf741('0x1c')]?_0x2cc9ae[_0xf741('0x1c')][_0xf741('0x1d')]===undefined?!![]:![]:!![],'where':_0x2cc9ae[_0xf741('0x1c')]?_0x2cc9ae['options']['where']||null:null,'attributes':_0x2cc9ae[_0xf741('0x1c')]?_0x2cc9ae[_0xf741('0x1c')]['attributes']||null:null,'include':_0x2cc9ae[_0xf741('0x1c')]?_0x2cc9ae[_0xf741('0x1c')][_0xf741('0x23')]?_[_0xf741('0x22')](_0x2cc9ae[_0xf741('0x1c')][_0xf741('0x23')],function(_0x256e67){return{'model':db[_0x256e67['model']],'as':_0x256e67['as'],'attributes':_0x256e67[_0xf741('0x1f')],'include':_0x256e67['include']?_['map'](_0x256e67[_0xf741('0x23')],function(_0x53d899){return{'model':db[_0x53d899[_0xf741('0x21')]],'as':_0x53d899['as'],'attributes':_0x53d899['attributes'],'include':_0x53d899[_0xf741('0x23')]?_[_0xf741('0x22')](_0x53d899[_0xf741('0x23')],function(_0x3c4cfe){return{'model':db[_0x3c4cfe['model']],'as':_0x3c4cfe['as'],'attributes':_0x3c4cfe[_0xf741('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf741('0x27')](function(_0x5e1242){logger['info'](_0xf741('0x24'),_0x2cc9ae);logger[_0xf741('0x11')](_0xf741('0x24'),_0x2cc9ae,JSON[_0xf741('0x13')](_0x5e1242));_0x230878(_0x5e1242);})[_0xf741('0x19')](function(_0x467369){logger['error']('ShowSmsQueue',_0x467369[_0xf741('0x16')],_0x2cc9ae);_0x3e20d5(_0x1d53ee['error'](0x1f4,_0x467369['message']));});});}; \ No newline at end of file +var _0x0552=['catch','SmsQueue','findAll','options','where','limit','include','map','model','attributes','GetSmsQueue','stringify','find','raw','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x356307,_0xe0a012){var _0x59e722=function(_0x31348d){while(--_0x31348d){_0x356307['push'](_0x356307['shift']());}};_0x59e722(++_0xe0a012);}(_0x0552,0x135));var _0x2055=function(_0x5bb2fe,_0x1cdfbe){_0x5bb2fe=_0x5bb2fe-0x0;var _0x16c5b9=_0x0552[_0x5bb2fe];return _0x16c5b9;};'use strict';var _=require(_0x2055('0x0'));var util=require(_0x2055('0x1'));var moment=require(_0x2055('0x2'));var BPromise=require(_0x2055('0x3'));var rs=require(_0x2055('0x4'));var fs=require('fs');var Redis=require(_0x2055('0x5'));var db=require(_0x2055('0x6'))['db'];var utils=require(_0x2055('0x7'));var logger=require(_0x2055('0x8'))('rpc');var config=require(_0x2055('0x9'));var jayson=require(_0x2055('0xa'));var client=jayson[_0x2055('0xb')][_0x2055('0xc')]({'port':0x232a});config[_0x2055('0xd')]=_['defaults'](config[_0x2055('0xd')],{'host':_0x2055('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2055('0xd')]));require(_0x2055('0xf'))[_0x2055('0x10')](socket);function respondWithRpcPromise(_0x14c7b8,_0x10deec,_0x6696cd){return new BPromise(function(_0x88ed00,_0x41f33f){return client[_0x2055('0x11')](_0x14c7b8,_0x6696cd)[_0x2055('0x12')](function(_0xdbfdab){logger[_0x2055('0x13')](_0x2055('0x14'),_0x10deec,_0x2055('0x15'));logger[_0x2055('0x16')](_0x2055('0x17'),_0x10deec,_0x2055('0x15'),JSON['stringify'](_0xdbfdab));if(_0xdbfdab[_0x2055('0x18')]){if(_0xdbfdab[_0x2055('0x18')]['code']===0x1f4){logger[_0x2055('0x18')](_0x2055('0x14'),_0x10deec,_0xdbfdab[_0x2055('0x18')][_0x2055('0x19')]);return _0x41f33f(_0xdbfdab[_0x2055('0x18')][_0x2055('0x19')]);}logger[_0x2055('0x18')](_0x2055('0x14'),_0x10deec,_0xdbfdab['error'][_0x2055('0x19')]);return _0x88ed00(_0xdbfdab[_0x2055('0x18')][_0x2055('0x19')]);}else{logger[_0x2055('0x13')]('SmsQueue,\x20%s,\x20%s',_0x10deec,'request\x20sent');_0x88ed00(_0xdbfdab[_0x2055('0x1a')]['message']);}})[_0x2055('0x1b')](function(_0x355ef7){logger['error']('SmsQueue,\x20%s,\x20%s',_0x10deec,_0x355ef7);_0x41f33f(_0x355ef7);});});}exports['GetSmsQueue']=function(_0x1874c7){var _0x555eeb=this;return new Promise(function(_0x2eebd5,_0x559c30){return db[_0x2055('0x1c')][_0x2055('0x1d')]({'raw':_0x1874c7['options']?_0x1874c7['options']['raw']===undefined?!![]:![]:!![],'where':_0x1874c7[_0x2055('0x1e')]?_0x1874c7[_0x2055('0x1e')][_0x2055('0x1f')]||null:null,'attributes':_0x1874c7[_0x2055('0x1e')]?_0x1874c7['options']['attributes']||null:null,'limit':_0x1874c7[_0x2055('0x1e')]?_0x1874c7[_0x2055('0x1e')][_0x2055('0x20')]||null:null,'include':_0x1874c7['options']?_0x1874c7[_0x2055('0x1e')][_0x2055('0x21')]?_[_0x2055('0x22')](_0x1874c7[_0x2055('0x1e')][_0x2055('0x21')],function(_0x5b95f8){return{'model':db[_0x5b95f8[_0x2055('0x23')]],'as':_0x5b95f8['as'],'attributes':_0x5b95f8[_0x2055('0x24')],'include':_0x5b95f8[_0x2055('0x21')]?_[_0x2055('0x22')](_0x5b95f8[_0x2055('0x21')],function(_0x1d6ef4){return{'model':db[_0x1d6ef4['model']],'as':_0x1d6ef4['as'],'attributes':_0x1d6ef4[_0x2055('0x24')],'include':_0x1d6ef4[_0x2055('0x21')]?_['map'](_0x1d6ef4[_0x2055('0x21')],function(_0x2bed4c){return{'model':db[_0x2bed4c[_0x2055('0x23')]],'as':_0x2bed4c['as'],'attributes':_0x2bed4c['attributes']};}):[]};}):[]};}):[]:[]})[_0x2055('0x12')](function(_0x193dc7){logger['info']('GetSmsQueue',_0x1874c7);logger[_0x2055('0x16')](_0x2055('0x25'),_0x1874c7,JSON[_0x2055('0x26')](_0x193dc7));_0x2eebd5(_0x193dc7);})[_0x2055('0x1b')](function(_0x805c2d){logger[_0x2055('0x18')](_0x2055('0x25'),_0x805c2d[_0x2055('0x19')],_0x1874c7);_0x559c30(_0x555eeb[_0x2055('0x18')](0x1f4,_0x805c2d['message']));});});};exports['ShowSmsQueue']=function(_0xf4a5d6){var _0x3b173c=this;return new Promise(function(_0x43e6f9,_0x28776d){return db['SmsQueue'][_0x2055('0x27')]({'raw':_0xf4a5d6[_0x2055('0x1e')]?_0xf4a5d6[_0x2055('0x1e')][_0x2055('0x28')]===undefined?!![]:![]:!![],'where':_0xf4a5d6['options']?_0xf4a5d6[_0x2055('0x1e')][_0x2055('0x1f')]||null:null,'attributes':_0xf4a5d6[_0x2055('0x1e')]?_0xf4a5d6['options'][_0x2055('0x24')]||null:null,'include':_0xf4a5d6['options']?_0xf4a5d6['options'][_0x2055('0x21')]?_[_0x2055('0x22')](_0xf4a5d6[_0x2055('0x1e')][_0x2055('0x21')],function(_0x5c9eb5){return{'model':db[_0x5c9eb5['model']],'as':_0x5c9eb5['as'],'attributes':_0x5c9eb5['attributes'],'include':_0x5c9eb5[_0x2055('0x21')]?_[_0x2055('0x22')](_0x5c9eb5[_0x2055('0x21')],function(_0x6801f){return{'model':db[_0x6801f[_0x2055('0x23')]],'as':_0x6801f['as'],'attributes':_0x6801f[_0x2055('0x24')],'include':_0x6801f[_0x2055('0x21')]?_['map'](_0x6801f['include'],function(_0x329dcc){return{'model':db[_0x329dcc['model']],'as':_0x329dcc['as'],'attributes':_0x329dcc[_0x2055('0x24')]};}):[]};}):[]};}):[]:[]})[_0x2055('0x12')](function(_0x574ab1){logger[_0x2055('0x13')]('ShowSmsQueue',_0xf4a5d6);logger['debug'](_0x2055('0x29'),_0xf4a5d6,JSON[_0x2055('0x26')](_0x574ab1));_0x43e6f9(_0x574ab1);})[_0x2055('0x1b')](function(_0x4774ec){logger[_0x2055('0x18')](_0x2055('0x29'),_0x4774ec[_0x2055('0x19')],_0xf4a5d6);_0x28776d(_0x3b173c[_0x2055('0x18')](0x1f4,_0x4774ec[_0x2055('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 3e475d4..5fd94fc 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 _0xc209=['register','length','smsQueue:','./smsQueue.events','save','update','emit','removeListener'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xc209,0x7b));var _0x9c20=function(_0x167c28,_0x6bf0c7){_0x167c28=_0x167c28-0x0;var _0x1cb91c=_0xc209[_0x167c28];return _0x1cb91c;};'use strict';var SmsQueueEvents=require(_0x9c20('0x0'));var events=[_0x9c20('0x1'),'remove',_0x9c20('0x2')];function createListener(_0x1a0362,_0x5e06fe){return function(_0x3ce0f1){_0x5e06fe[_0x9c20('0x3')](_0x1a0362,_0x3ce0f1);};}function removeListener(_0x8192fc,_0x1ed332){return function(){SmsQueueEvents[_0x9c20('0x4')](_0x8192fc,_0x1ed332);};}exports[_0x9c20('0x5')]=function(_0x287e98){for(var _0x28fa65=0x0,_0xa36ae1=events[_0x9c20('0x6')];_0x28fa65<_0xa36ae1;_0x28fa65++){var _0x6477f4=events[_0x28fa65];var _0x433424=createListener(_0x9c20('0x7')+_0x6477f4,_0x287e98);SmsQueueEvents['on'](_0x6477f4,_0x433424);}}; \ No newline at end of file +var _0xa460=['length','./smsQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x37f651,_0x4e02e7){var _0x36613d=function(_0x361f9c){while(--_0x361f9c){_0x37f651['push'](_0x37f651['shift']());}};_0x36613d(++_0x4e02e7);}(_0xa460,0xe1));var _0x0a46=function(_0x151ecd,_0x18ecb1){_0x151ecd=_0x151ecd-0x0;var _0x4c2325=_0xa460[_0x151ecd];return _0x4c2325;};'use strict';var SmsQueueEvents=require(_0x0a46('0x0'));var events=[_0x0a46('0x1'),_0x0a46('0x2'),_0x0a46('0x3')];function createListener(_0x285f6c,_0xbe3230){return function(_0x47f5e5){_0xbe3230[_0x0a46('0x4')](_0x285f6c,_0x47f5e5);};}function removeListener(_0x522614,_0x3387a3){return function(){SmsQueueEvents[_0x0a46('0x5')](_0x522614,_0x3387a3);};}exports[_0x0a46('0x6')]=function(_0xf8e34c){for(var _0x1c68df=0x0,_0x3da504=events[_0x0a46('0x7')];_0x1c68df<_0x3da504;_0x1c68df++){var _0x587517=events[_0x1c68df];var _0x518554=createListener('smsQueue:'+_0x587517,_0xf8e34c);SmsQueueEvents['on'](_0x587517,_0x518554);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 9dc275d..ffa3cc1 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 _0xb9fd=['show','put','/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x3da709,_0xb9d501){var _0x5e198c=function(_0x65c17c){while(--_0x65c17c){_0x3da709['push'](_0x3da709['shift']());}};_0x5e198c(++_0xb9d501);}(_0xb9fd,0x149));var _0xdb9f=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0xb9fd[_0x2e8418];return _0x548fe6;};'use strict';var multer=require(_0xdb9f('0x0'));var util=require(_0xdb9f('0x1'));var path=require('path');var timeout=require(_0xdb9f('0x2'));var express=require(_0xdb9f('0x3'));var router=express[_0xdb9f('0x4')]();var auth=require(_0xdb9f('0x5'));var interaction=require(_0xdb9f('0x6'));var config=require(_0xdb9f('0x7'));var controller=require(_0xdb9f('0x8'));router[_0xdb9f('0x9')]('/',auth[_0xdb9f('0xa')](),controller[_0xdb9f('0xb')]);router[_0xdb9f('0x9')](_0xdb9f('0xc'),auth[_0xdb9f('0xa')](),controller['describe']);router[_0xdb9f('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdb9f('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xdb9f('0xe')](_0xdb9f('0xf'),auth[_0xdb9f('0xa')](),controller['update']);router['delete'](_0xdb9f('0xf'),auth[_0xdb9f('0xa')](),controller[_0xdb9f('0x10')]);module[_0xdb9f('0x11')]=router; \ No newline at end of file +var _0x3746=['Router','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','describe','/:id','post','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5c4ffe,_0x585a37){var _0x4f55fb=function(_0x4a9d4b){while(--_0x4a9d4b){_0x5c4ffe['push'](_0x5c4ffe['shift']());}};_0x4f55fb(++_0x585a37);}(_0x3746,0x1e2));var _0x6374=function(_0x31eddb,_0x51f673){_0x31eddb=_0x31eddb-0x0;var _0x1ee2f6=_0x3746[_0x31eddb];return _0x1ee2f6;};'use strict';var multer=require(_0x6374('0x0'));var util=require(_0x6374('0x1'));var path=require(_0x6374('0x2'));var timeout=require(_0x6374('0x3'));var express=require('express');var router=express[_0x6374('0x4')]();var auth=require(_0x6374('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6374('0x6'));var controller=require(_0x6374('0x7'));router[_0x6374('0x8')]('/',auth[_0x6374('0x9')](),controller[_0x6374('0xa')]);router[_0x6374('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x6374('0xb')]);router[_0x6374('0x8')](_0x6374('0xc'),auth[_0x6374('0x9')](),controller['show']);router[_0x6374('0xd')]('/',auth[_0x6374('0x9')](),controller['create']);router[_0x6374('0xe')](_0x6374('0xc'),auth[_0x6374('0x9')](),controller[_0x6374('0xf')]);router['delete'](_0x6374('0xc'),auth[_0x6374('0x9')](),controller[_0x6374('0x10')]);module[_0x6374('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 3aaee13..743ca78 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 _0xf9b1=['sequelize','STRING','DATE'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf9b1,0x147));var _0x1f9b=function(_0x4f8bbf,_0x1b1a45){_0x4f8bbf=_0x4f8bbf-0x0;var _0x5aa7a7=_0xf9b1[_0x4f8bbf];return _0x5aa7a7;};'use strict';var moment=require('moment');var Sequelize=require(_0x1f9b('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1f9b('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x1f9b('0x1')]},'joinAt':{'type':Sequelize[_0x1f9b('0x2')]},'leaveAt':{'type':Sequelize[_0x1f9b('0x2')]},'acceptAt':{'type':Sequelize[_0x1f9b('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x1f9b('0x1')]}}; \ No newline at end of file +var _0x3667=['moment','sequelize','STRING','DATE'];(function(_0xbd1f60,_0x470e77){var _0x25802f=function(_0xcf5985){while(--_0xcf5985){_0xbd1f60['push'](_0xbd1f60['shift']());}};_0x25802f(++_0x470e77);}(_0x3667,0x1ec));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x7366('0x0'));var Sequelize=require(_0x7366('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x7366('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x7366('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x7366('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7366('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 27d15bc..3e93132 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 _0x814b=['index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','SmsQueueReport','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send'];(function(_0xfa2f68,_0x23836e){var _0x252d9a=function(_0x285e61){while(--_0x285e61){_0xfa2f68['push'](_0xfa2f68['shift']());}};_0x252d9a(++_0x23836e);}(_0x814b,0x1a2));var _0xb814=function(_0x4bed75,_0x211cc7){_0x4bed75=_0x4bed75-0x0;var _0x2dd8e8=_0x814b[_0x4bed75];return _0x2dd8e8;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];function respondWithStatusCode(_0x15d6ef,_0x35b10d){_0x35b10d=_0x35b10d||0xcc;return function(_0x2cc46b){if(_0x2cc46b){return _0x15d6ef[_0xb814('0x1a')](_0x35b10d);}return _0x15d6ef[_0xb814('0x1b')](_0x35b10d)[_0xb814('0x1c')]();};}function respondWithResult(_0x41ed7b,_0xa0a2e5){_0xa0a2e5=_0xa0a2e5||0xc8;return function(_0x2ab627){if(_0x2ab627){return _0x41ed7b[_0xb814('0x1b')](_0xa0a2e5)[_0xb814('0x1d')](_0x2ab627);}};}function respondWithFilteredResult(_0x17f5bd,_0x39bfcf){return function(_0x303aca){if(_0x303aca){var _0x3a71d6=_0x303aca[_0xb814('0x1e')],_0x45e0d0=_0x39bfcf[_0xb814('0x1f')],_0x265a83=_0x39bfcf['offset']+_0x39bfcf[_0xb814('0x20')],_0x125ce2;if(_0x265a83>=_0x3a71d6){_0x265a83=_0x3a71d6;_0x125ce2=0xc8;}else{_0x125ce2=0xce;}_0x17f5bd['status'](_0x125ce2);return _0x17f5bd[_0xb814('0x21')](_0xb814('0x22'),_0x45e0d0+'-'+_0x265a83+'/'+_0x3a71d6)['json'](_0x303aca);}return null;};}function patchUpdates(_0x4b55a7){return function(_0x55d63c){try{jsonpatch[_0xb814('0x23')](_0x55d63c,_0x4b55a7,!![]);}catch(_0x4d5276){return BPromise['reject'](_0x4d5276);}return _0x55d63c[_0xb814('0x24')]();};}function saveUpdates(_0x24211d,_0x25b6b6){return function(_0x4e139e){if(_0x4e139e){return _0x4e139e[_0xb814('0x25')](_0x24211d)['then'](function(_0x1e6393){return _0x1e6393;});}return null;};}function removeEntity(_0x1808a3,_0x3b267e){return function(_0x470e81){if(_0x470e81){return _0x470e81[_0xb814('0x26')]()[_0xb814('0x27')](function(){_0x1808a3[_0xb814('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(!_0x3f81d0){_0x2ead86[_0xb814('0x1a')](0x194);}return _0x3f81d0;};}function handleError(_0x31c7ec,_0x208927){_0x208927=_0x208927||0x1f4;return function(_0x1c8a2e){logger[_0xb814('0x28')](_0x1c8a2e[_0xb814('0x29')]);if(_0x1c8a2e['name']){delete _0x1c8a2e[_0xb814('0x2a')];}_0x31c7ec[_0xb814('0x1b')](_0x208927)[_0xb814('0x2b')](_0x1c8a2e);};}exports[_0xb814('0x2c')]=function(_0x32ed56,_0x1d5965){var _0x3f0150={},_0x1e4e89={},_0x5a6291={'count':0x0,'rows':[]};var _0x271aa8=_[_0xb814('0x2d')](db['SmsQueueReport'][_0xb814('0x2e')],function(_0x37d24d){return{'name':_0x37d24d[_0xb814('0x2f')],'type':_0x37d24d['type'][_0xb814('0x30')]};});_0x1e4e89[_0xb814('0x31')]=_['map'](_0x271aa8,_0xb814('0x2a'));_0x1e4e89['query']=_[_0xb814('0x32')](_0x32ed56['query']);_0x1e4e89['filters']=_[_0xb814('0x33')](_0x1e4e89['model'],_0x1e4e89[_0xb814('0x34')]);_0x3f0150[_0xb814('0x35')]=_[_0xb814('0x33')](_0x1e4e89['model'],qs['fields'](_0x32ed56[_0xb814('0x34')][_0xb814('0x36')]));_0x3f0150['attributes']=_0x3f0150[_0xb814('0x35')][_0xb814('0x37')]?_0x3f0150[_0xb814('0x35')]:_0x1e4e89[_0xb814('0x31')];if(!_0x32ed56[_0xb814('0x34')][_0xb814('0x38')](_0xb814('0x39'))){_0x3f0150['limit']=qs[_0xb814('0x20')](_0x32ed56[_0xb814('0x34')][_0xb814('0x20')]);_0x3f0150[_0xb814('0x1f')]=qs[_0xb814('0x1f')](_0x32ed56['query'][_0xb814('0x1f')]);}_0x3f0150['order']=qs[_0xb814('0x3a')](_0x32ed56[_0xb814('0x34')][_0xb814('0x3a')]);_0x3f0150['where']=qs[_0xb814('0x3b')](_[_0xb814('0x3c')](_0x32ed56['query'],_0x1e4e89[_0xb814('0x3b')]),_0x271aa8);if(_0x32ed56[_0xb814('0x34')][_0xb814('0x3d')]){_0x3f0150[_0xb814('0x3e')]=_[_0xb814('0x3f')](_0x3f0150[_0xb814('0x3e')],{'$or':_['map'](_0x271aa8,function(_0xa6ce87){if(_0xa6ce87['type']!==_0xb814('0x40')){var _0x4b5583={};_0x4b5583[_0xa6ce87[_0xb814('0x2a')]]={'$like':'%'+_0x32ed56['query'][_0xb814('0x3d')]+'%'};return _0x4b5583;}})});}_0x3f0150=_[_0xb814('0x3f')]({},_0x3f0150,_0x32ed56['options']);var _0x4d308a={'where':_0x3f0150['where']};return db['SmsQueueReport'][_0xb814('0x1e')](_0x4d308a)[_0xb814('0x27')](function(_0x38cdc2){_0x5a6291[_0xb814('0x1e')]=_0x38cdc2;if(_0x32ed56['query']['includeAll']){_0x3f0150[_0xb814('0x41')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xb814('0x42')](_0x3f0150);})[_0xb814('0x27')](function(_0x178823){_0x5a6291[_0xb814('0x43')]=_0x178823;return _0x5a6291;})[_0xb814('0x27')](respondWithFilteredResult(_0x1d5965,_0x3f0150))[_0xb814('0x44')](handleError(_0x1d5965,null));};exports[_0xb814('0x45')]=function(_0x28b2b4,_0x31989d){var _0x4b6ff8={'raw':!![],'where':{'id':_0x28b2b4['params']['id']}},_0x544d36={};_0x544d36[_0xb814('0x31')]=_['keys'](db[_0xb814('0x46')]['rawAttributes']);_0x544d36[_0xb814('0x34')]=_[_0xb814('0x32')](_0x28b2b4[_0xb814('0x34')]);_0x544d36[_0xb814('0x3b')]=_['intersection'](_0x544d36[_0xb814('0x31')],_0x544d36[_0xb814('0x34')]);_0x4b6ff8[_0xb814('0x35')]=_[_0xb814('0x33')](_0x544d36[_0xb814('0x31')],qs[_0xb814('0x36')](_0x28b2b4['query'][_0xb814('0x36')]));_0x4b6ff8[_0xb814('0x35')]=_0x4b6ff8[_0xb814('0x35')][_0xb814('0x37')]?_0x4b6ff8[_0xb814('0x35')]:_0x544d36[_0xb814('0x31')];if(_0x28b2b4[_0xb814('0x34')]['includeAll']){_0x4b6ff8['include']=[{'all':!![]}];}_0x4b6ff8=_[_0xb814('0x3f')]({},_0x4b6ff8,_0x28b2b4[_0xb814('0x47')]);return db[_0xb814('0x46')][_0xb814('0x48')](_0x4b6ff8)[_0xb814('0x27')](handleEntityNotFound(_0x31989d,null))[_0xb814('0x27')](respondWithResult(_0x31989d,null))[_0xb814('0x44')](handleError(_0x31989d,null));};exports[_0xb814('0x49')]=function(_0x2eb9b6,_0x344198){return db[_0xb814('0x46')]['create'](_0x2eb9b6[_0xb814('0x4a')],{})[_0xb814('0x27')](respondWithResult(_0x344198,0xc9))['catch'](handleError(_0x344198,null));};exports[_0xb814('0x25')]=function(_0x55234d,_0x2fb0f7){if(_0x55234d[_0xb814('0x4a')]['id']){delete _0x55234d[_0xb814('0x4a')]['id'];}return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x55234d[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x2fb0f7,null))[_0xb814('0x27')](saveUpdates(_0x55234d[_0xb814('0x4a')],null))[_0xb814('0x27')](respondWithResult(_0x2fb0f7,null))['catch'](handleError(_0x2fb0f7,null));};exports['destroy']=function(_0x32eca6,_0x30f07b){return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x32eca6[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x30f07b,null))[_0xb814('0x27')](removeEntity(_0x30f07b,null))['catch'](handleError(_0x30f07b,null));};exports[_0xb814('0x4c')]=function(_0x388324,_0xf27a6e){return db['SmsQueueReport'][_0xb814('0x4c')]()['then'](respondWithResult(_0xf27a6e,null))[_0xb814('0x44')](handleError(_0xf27a6e,null));}; \ No newline at end of file +var _0x814b=['index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','SmsQueueReport','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send'];(function(_0x5eb281,_0x2a46c1){var _0xde0b5d=function(_0xb87630){while(--_0xb87630){_0x5eb281['push'](_0x5eb281['shift']());}};_0xde0b5d(++_0x2a46c1);}(_0x814b,0x1a2));var _0xb814=function(_0x24679e,_0x22d9d7){_0x24679e=_0x24679e-0x0;var _0x291f21=_0x814b[_0x24679e];return _0x291f21;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var db=require(_0xb814('0x19'))['db'];function respondWithStatusCode(_0x15d6ef,_0x35b10d){_0x35b10d=_0x35b10d||0xcc;return function(_0x2cc46b){if(_0x2cc46b){return _0x15d6ef[_0xb814('0x1a')](_0x35b10d);}return _0x15d6ef[_0xb814('0x1b')](_0x35b10d)[_0xb814('0x1c')]();};}function respondWithResult(_0x41ed7b,_0xa0a2e5){_0xa0a2e5=_0xa0a2e5||0xc8;return function(_0x2ab627){if(_0x2ab627){return _0x41ed7b[_0xb814('0x1b')](_0xa0a2e5)[_0xb814('0x1d')](_0x2ab627);}};}function respondWithFilteredResult(_0x17f5bd,_0x39bfcf){return function(_0x303aca){if(_0x303aca){var _0x3a71d6=_0x303aca[_0xb814('0x1e')],_0x45e0d0=_0x39bfcf[_0xb814('0x1f')],_0x265a83=_0x39bfcf['offset']+_0x39bfcf[_0xb814('0x20')],_0x125ce2;if(_0x265a83>=_0x3a71d6){_0x265a83=_0x3a71d6;_0x125ce2=0xc8;}else{_0x125ce2=0xce;}_0x17f5bd['status'](_0x125ce2);return _0x17f5bd[_0xb814('0x21')](_0xb814('0x22'),_0x45e0d0+'-'+_0x265a83+'/'+_0x3a71d6)['json'](_0x303aca);}return null;};}function patchUpdates(_0x4b55a7){return function(_0x55d63c){try{jsonpatch[_0xb814('0x23')](_0x55d63c,_0x4b55a7,!![]);}catch(_0x4d5276){return BPromise['reject'](_0x4d5276);}return _0x55d63c[_0xb814('0x24')]();};}function saveUpdates(_0x24211d,_0x25b6b6){return function(_0x4e139e){if(_0x4e139e){return _0x4e139e[_0xb814('0x25')](_0x24211d)['then'](function(_0x1e6393){return _0x1e6393;});}return null;};}function removeEntity(_0x1808a3,_0x3b267e){return function(_0x470e81){if(_0x470e81){return _0x470e81[_0xb814('0x26')]()[_0xb814('0x27')](function(){_0x1808a3[_0xb814('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(!_0x3f81d0){_0x2ead86[_0xb814('0x1a')](0x194);}return _0x3f81d0;};}function handleError(_0x31c7ec,_0x208927){_0x208927=_0x208927||0x1f4;return function(_0x1c8a2e){logger[_0xb814('0x28')](_0x1c8a2e[_0xb814('0x29')]);if(_0x1c8a2e['name']){delete _0x1c8a2e[_0xb814('0x2a')];}_0x31c7ec[_0xb814('0x1b')](_0x208927)[_0xb814('0x2b')](_0x1c8a2e);};}exports[_0xb814('0x2c')]=function(_0x32ed56,_0x1d5965){var _0x3f0150={},_0x1e4e89={},_0x5a6291={'count':0x0,'rows':[]};var _0x271aa8=_[_0xb814('0x2d')](db['SmsQueueReport'][_0xb814('0x2e')],function(_0x37d24d){return{'name':_0x37d24d[_0xb814('0x2f')],'type':_0x37d24d['type'][_0xb814('0x30')]};});_0x1e4e89[_0xb814('0x31')]=_['map'](_0x271aa8,_0xb814('0x2a'));_0x1e4e89['query']=_[_0xb814('0x32')](_0x32ed56['query']);_0x1e4e89['filters']=_[_0xb814('0x33')](_0x1e4e89['model'],_0x1e4e89[_0xb814('0x34')]);_0x3f0150[_0xb814('0x35')]=_[_0xb814('0x33')](_0x1e4e89['model'],qs['fields'](_0x32ed56[_0xb814('0x34')][_0xb814('0x36')]));_0x3f0150['attributes']=_0x3f0150[_0xb814('0x35')][_0xb814('0x37')]?_0x3f0150[_0xb814('0x35')]:_0x1e4e89[_0xb814('0x31')];if(!_0x32ed56[_0xb814('0x34')][_0xb814('0x38')](_0xb814('0x39'))){_0x3f0150['limit']=qs[_0xb814('0x20')](_0x32ed56[_0xb814('0x34')][_0xb814('0x20')]);_0x3f0150[_0xb814('0x1f')]=qs[_0xb814('0x1f')](_0x32ed56['query'][_0xb814('0x1f')]);}_0x3f0150['order']=qs[_0xb814('0x3a')](_0x32ed56[_0xb814('0x34')][_0xb814('0x3a')]);_0x3f0150['where']=qs[_0xb814('0x3b')](_[_0xb814('0x3c')](_0x32ed56['query'],_0x1e4e89[_0xb814('0x3b')]),_0x271aa8);if(_0x32ed56[_0xb814('0x34')][_0xb814('0x3d')]){_0x3f0150[_0xb814('0x3e')]=_[_0xb814('0x3f')](_0x3f0150[_0xb814('0x3e')],{'$or':_['map'](_0x271aa8,function(_0xa6ce87){if(_0xa6ce87['type']!==_0xb814('0x40')){var _0x4b5583={};_0x4b5583[_0xa6ce87[_0xb814('0x2a')]]={'$like':'%'+_0x32ed56['query'][_0xb814('0x3d')]+'%'};return _0x4b5583;}})});}_0x3f0150=_[_0xb814('0x3f')]({},_0x3f0150,_0x32ed56['options']);var _0x4d308a={'where':_0x3f0150['where']};return db['SmsQueueReport'][_0xb814('0x1e')](_0x4d308a)[_0xb814('0x27')](function(_0x38cdc2){_0x5a6291[_0xb814('0x1e')]=_0x38cdc2;if(_0x32ed56['query']['includeAll']){_0x3f0150[_0xb814('0x41')]=[{'all':!![]}];}return db['SmsQueueReport'][_0xb814('0x42')](_0x3f0150);})[_0xb814('0x27')](function(_0x178823){_0x5a6291[_0xb814('0x43')]=_0x178823;return _0x5a6291;})[_0xb814('0x27')](respondWithFilteredResult(_0x1d5965,_0x3f0150))[_0xb814('0x44')](handleError(_0x1d5965,null));};exports[_0xb814('0x45')]=function(_0x28b2b4,_0x31989d){var _0x4b6ff8={'raw':!![],'where':{'id':_0x28b2b4['params']['id']}},_0x544d36={};_0x544d36[_0xb814('0x31')]=_['keys'](db[_0xb814('0x46')]['rawAttributes']);_0x544d36[_0xb814('0x34')]=_[_0xb814('0x32')](_0x28b2b4[_0xb814('0x34')]);_0x544d36[_0xb814('0x3b')]=_['intersection'](_0x544d36[_0xb814('0x31')],_0x544d36[_0xb814('0x34')]);_0x4b6ff8[_0xb814('0x35')]=_[_0xb814('0x33')](_0x544d36[_0xb814('0x31')],qs[_0xb814('0x36')](_0x28b2b4['query'][_0xb814('0x36')]));_0x4b6ff8[_0xb814('0x35')]=_0x4b6ff8[_0xb814('0x35')][_0xb814('0x37')]?_0x4b6ff8[_0xb814('0x35')]:_0x544d36[_0xb814('0x31')];if(_0x28b2b4[_0xb814('0x34')]['includeAll']){_0x4b6ff8['include']=[{'all':!![]}];}_0x4b6ff8=_[_0xb814('0x3f')]({},_0x4b6ff8,_0x28b2b4[_0xb814('0x47')]);return db[_0xb814('0x46')][_0xb814('0x48')](_0x4b6ff8)[_0xb814('0x27')](handleEntityNotFound(_0x31989d,null))[_0xb814('0x27')](respondWithResult(_0x31989d,null))[_0xb814('0x44')](handleError(_0x31989d,null));};exports[_0xb814('0x49')]=function(_0x2eb9b6,_0x344198){return db[_0xb814('0x46')]['create'](_0x2eb9b6[_0xb814('0x4a')],{})[_0xb814('0x27')](respondWithResult(_0x344198,0xc9))['catch'](handleError(_0x344198,null));};exports[_0xb814('0x25')]=function(_0x55234d,_0x2fb0f7){if(_0x55234d[_0xb814('0x4a')]['id']){delete _0x55234d[_0xb814('0x4a')]['id'];}return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x55234d[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x2fb0f7,null))[_0xb814('0x27')](saveUpdates(_0x55234d[_0xb814('0x4a')],null))[_0xb814('0x27')](respondWithResult(_0x2fb0f7,null))['catch'](handleError(_0x2fb0f7,null));};exports['destroy']=function(_0x32eca6,_0x30f07b){return db[_0xb814('0x46')][_0xb814('0x48')]({'where':{'id':_0x32eca6[_0xb814('0x4b')]['id']}})[_0xb814('0x27')](handleEntityNotFound(_0x30f07b,null))[_0xb814('0x27')](removeEntity(_0x30f07b,null))['catch'](handleError(_0x30f07b,null));};exports[_0xb814('0x4c')]=function(_0x388324,_0xf27a6e){return db['SmsQueueReport'][_0xb814('0x4c')]()['then'](respondWithResult(_0xf27a6e,null))[_0xb814('0x44')](handleError(_0xf27a6e,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 3cdf013..0283d72 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 _0x6986=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','report_sms_queue','uniqueid','lodash'];(function(_0xfd59d7,_0x5c28bb){var _0x1dac14=function(_0x3ed207){while(--_0x3ed207){_0xfd59d7['push'](_0xfd59d7['shift']());}};_0x1dac14(++_0x5c28bb);}(_0x6986,0x1eb));var _0x6698=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x6986[_0x28aea5];return _0x6a55f9;};'use strict';var _=require(_0x6698('0x0'));var util=require(_0x6698('0x1'));var logger=require(_0x6698('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6698('0x3'));var rp=require(_0x6698('0x4'));var fs=require('fs');var path=require(_0x6698('0x5'));var rimraf=require(_0x6698('0x6'));var config=require(_0x6698('0x7'));var attributes=require(_0x6698('0x8'));module[_0x6698('0x9')]=function(_0x1a097f,_0x215878){return _0x1a097f['define']('SmsQueueReport',attributes,{'tableName':_0x6698('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x6698('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb010=['request-promise','path','rimraf','./smsQueueReport.attributes','define','SmsQueueReport','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3e4f74,_0x26ce71){var _0xd07d99=function(_0x2b09b0){while(--_0x2b09b0){_0x3e4f74['push'](_0x3e4f74['shift']());}};_0xd07d99(++_0x26ce71);}(_0xb010,0xae));var _0x0b01=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb010[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0b01('0x0'));var util=require(_0x0b01('0x1'));var logger=require(_0x0b01('0x2'))(_0x0b01('0x3'));var moment=require(_0x0b01('0x4'));var BPromise=require(_0x0b01('0x5'));var rp=require(_0x0b01('0x6'));var fs=require('fs');var path=require(_0x0b01('0x7'));var rimraf=require(_0x0b01('0x8'));var config=require('../../config/environment');var attributes=require(_0x0b01('0x9'));module['exports']=function(_0x154bcc,_0x455b80){return _0x154bcc[_0x0b01('0xa')](_0x0b01('0xb'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index f8a66c0..ed840a9 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 _0x693d=['info','SmsQueueReport,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','SmsQueueReport','create','body','CreateSmsQueueReport','stringify','options','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','then'];(function(_0x2ecc65,_0xd75c48){var _0x103cc3=function(_0x3f856b){while(--_0x3f856b){_0x2ecc65['push'](_0x2ecc65['shift']());}};_0x103cc3(++_0xd75c48);}(_0x693d,0x69));var _0xd693=function(_0x1ab8c7,_0x28db6d){_0x1ab8c7=_0x1ab8c7-0x0;var _0x1b951f=_0x693d[_0x1ab8c7];return _0x1b951f;};'use strict';var _=require(_0xd693('0x0'));var util=require(_0xd693('0x1'));var moment=require(_0xd693('0x2'));var BPromise=require('bluebird');var rs=require(_0xd693('0x3'));var fs=require('fs');var Redis=require(_0xd693('0x4'));var db=require(_0xd693('0x5'))['db'];var utils=require(_0xd693('0x6'));var logger=require(_0xd693('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd693('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c1155,_0x1b195b,_0x5eec8b){return new BPromise(function(_0x377eb1,_0x23d4c5){return client[_0xd693('0x9')](_0x2c1155,_0x5eec8b)[_0xd693('0xa')](function(_0x2a4143){logger[_0xd693('0xb')](_0xd693('0xc'),_0x1b195b,'request\x20sent');logger[_0xd693('0xd')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x1b195b,'request\x20sent',JSON['stringify'](_0x2a4143));if(_0x2a4143[_0xd693('0xe')]){if(_0x2a4143[_0xd693('0xe')][_0xd693('0xf')]===0x1f4){logger['error'](_0xd693('0xc'),_0x1b195b,_0x2a4143[_0xd693('0xe')][_0xd693('0x10')]);return _0x23d4c5(_0x2a4143[_0xd693('0xe')][_0xd693('0x10')]);}logger[_0xd693('0xe')](_0xd693('0xc'),_0x1b195b,_0x2a4143[_0xd693('0xe')][_0xd693('0x10')]);return _0x377eb1(_0x2a4143['error']['message']);}else{logger[_0xd693('0xb')](_0xd693('0xc'),_0x1b195b,_0xd693('0x11'));_0x377eb1(_0x2a4143[_0xd693('0x12')]['message']);}})[_0xd693('0x13')](function(_0x1f973f){logger[_0xd693('0xe')](_0xd693('0xc'),_0x1b195b,_0x1f973f);_0x23d4c5(_0x1f973f);});});}exports['CreateSmsQueueReport']=function(_0x59a3e6){var _0x5562cb=this;return new Promise(function(_0x3fb6f8,_0x3fba87){return db[_0xd693('0x14')][_0xd693('0x15')](_0x59a3e6[_0xd693('0x16')],{'raw':_0x59a3e6['options']?_0x59a3e6['options']['raw']===undefined?!![]:![]:!![]})[_0xd693('0xa')](function(_0xfdbbb6){logger[_0xd693('0xb')](_0xd693('0x17'),_0x59a3e6);logger[_0xd693('0xd')]('CreateSmsQueueReport',_0x59a3e6,JSON[_0xd693('0x18')](_0xfdbbb6));_0x3fb6f8(_0xfdbbb6);})['catch'](function(_0xdeff92){logger['error'](_0xd693('0x17'),_0xdeff92[_0xd693('0x10')],_0x59a3e6);_0x3fba87(_0x5562cb['error'](0x1f4,_0xdeff92[_0xd693('0x10')]));});});};exports['UpdateSmsQueueReport']=function(_0x4c1bb4){var _0x377503=this;return new Promise(function(_0xfd6dae,_0x3c85e6){return db[_0xd693('0x14')]['update'](_0x4c1bb4[_0xd693('0x16')],{'raw':_0x4c1bb4[_0xd693('0x19')]?_0x4c1bb4[_0xd693('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c1bb4[_0xd693('0x19')]?_0x4c1bb4[_0xd693('0x19')]['where']||null:null,'attributes':_0x4c1bb4[_0xd693('0x19')]?_0x4c1bb4[_0xd693('0x19')][_0xd693('0x1a')]||null:null,'limit':_0x4c1bb4[_0xd693('0x19')]?_0x4c1bb4[_0xd693('0x19')][_0xd693('0x1b')]||null:null})['then'](function(_0x2c25c1){logger['info'](_0xd693('0x1c'),_0x4c1bb4);logger[_0xd693('0xd')](_0xd693('0x1c'),_0x4c1bb4,JSON[_0xd693('0x18')](_0x2c25c1));_0xfd6dae(_0x2c25c1);})[_0xd693('0x13')](function(_0x1096c2){logger['error'](_0xd693('0x1c'),_0x1096c2[_0xd693('0x10')],_0x4c1bb4);_0x3c85e6(_0x377503[_0xd693('0xe')](0x1f4,_0x1096c2[_0xd693('0x10')]));});});}; \ No newline at end of file +var _0x9141=['body','options','raw','UpdateSmsQueueReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create'];(function(_0x368c85,_0x586b0a){var _0x3477c2=function(_0x3ef6d9){while(--_0x3ef6d9){_0x368c85['push'](_0x368c85['shift']());}};_0x3477c2(++_0x586b0a);}(_0x9141,0x6e));var _0x1914=function(_0x1cd0fb,_0x13457c){_0x1cd0fb=_0x1cd0fb-0x0;var _0x36ad64=_0x9141[_0x1cd0fb];return _0x36ad64;};'use strict';var _=require(_0x1914('0x0'));var util=require(_0x1914('0x1'));var moment=require('moment');var BPromise=require(_0x1914('0x2'));var rs=require(_0x1914('0x3'));var fs=require('fs');var Redis=require(_0x1914('0x4'));var db=require(_0x1914('0x5'))['db'];var utils=require(_0x1914('0x6'));var logger=require(_0x1914('0x7'))(_0x1914('0x8'));var config=require(_0x1914('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1914('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf09c91,_0x42a474,_0x4c1127){return new BPromise(function(_0x4d74dd,_0x318b62){return client['request'](_0xf09c91,_0x4c1127)[_0x1914('0xb')](function(_0x265de8){logger[_0x1914('0xc')](_0x1914('0xd'),_0x42a474,_0x1914('0xe'));logger[_0x1914('0xf')](_0x1914('0x10'),_0x42a474,_0x1914('0xe'),JSON[_0x1914('0x11')](_0x265de8));if(_0x265de8['error']){if(_0x265de8['error'][_0x1914('0x12')]===0x1f4){logger[_0x1914('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x42a474,_0x265de8[_0x1914('0x13')][_0x1914('0x14')]);return _0x318b62(_0x265de8['error'][_0x1914('0x14')]);}logger[_0x1914('0x13')](_0x1914('0xd'),_0x42a474,_0x265de8['error'][_0x1914('0x14')]);return _0x4d74dd(_0x265de8[_0x1914('0x13')]['message']);}else{logger[_0x1914('0xc')](_0x1914('0xd'),_0x42a474,_0x1914('0xe'));_0x4d74dd(_0x265de8[_0x1914('0x15')]['message']);}})[_0x1914('0x16')](function(_0x4e2c19){logger[_0x1914('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x42a474,_0x4e2c19);_0x318b62(_0x4e2c19);});});}exports[_0x1914('0x17')]=function(_0x1335be){var _0x249175=this;return new Promise(function(_0x1b0e2c,_0x1e909b){return db[_0x1914('0x18')][_0x1914('0x19')](_0x1335be[_0x1914('0x1a')],{'raw':_0x1335be[_0x1914('0x1b')]?_0x1335be[_0x1914('0x1b')][_0x1914('0x1c')]===undefined?!![]:![]:!![]})[_0x1914('0xb')](function(_0x2415a9){logger[_0x1914('0xc')](_0x1914('0x17'),_0x1335be);logger['debug']('CreateSmsQueueReport',_0x1335be,JSON['stringify'](_0x2415a9));_0x1b0e2c(_0x2415a9);})[_0x1914('0x16')](function(_0x4ed62c){logger[_0x1914('0x13')](_0x1914('0x17'),_0x4ed62c[_0x1914('0x14')],_0x1335be);_0x1e909b(_0x249175['error'](0x1f4,_0x4ed62c['message']));});});};exports[_0x1914('0x1d')]=function(_0x392af6){var _0x423687=this;return new Promise(function(_0x284ae0,_0x3e63ea){return db[_0x1914('0x18')][_0x1914('0x1e')](_0x392af6[_0x1914('0x1a')],{'raw':_0x392af6[_0x1914('0x1b')]?_0x392af6[_0x1914('0x1b')][_0x1914('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x392af6[_0x1914('0x1b')]?_0x392af6['options'][_0x1914('0x1f')]||null:null,'attributes':_0x392af6['options']?_0x392af6[_0x1914('0x1b')][_0x1914('0x20')]||null:null,'limit':_0x392af6[_0x1914('0x1b')]?_0x392af6[_0x1914('0x1b')][_0x1914('0x21')]||null:null})[_0x1914('0xb')](function(_0x4ad23e){logger['info'](_0x1914('0x1d'),_0x392af6);logger[_0x1914('0xf')](_0x1914('0x1d'),_0x392af6,JSON['stringify'](_0x4ad23e));_0x284ae0(_0x4ad23e);})[_0x1914('0x16')](function(_0x11f864){logger[_0x1914('0x13')]('UpdateSmsQueueReport',_0x11f864[_0x1914('0x14')],_0x392af6);_0x3e63ea(_0x423687[_0x1914('0x13')](0x1f4,_0x11f864[_0x1914('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index c170664..e50d979 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 _0x087b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','exports','multer','util','express'];(function(_0x231512,_0x57354b){var _0x459627=function(_0x454fa2){while(--_0x454fa2){_0x231512['push'](_0x231512['shift']());}};_0x459627(++_0x57354b);}(_0x087b,0x11a));var _0xb087=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x087b[_0x47aa64];return _0x549c7a;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var auth=require(_0xb087('0x3'));var interaction=require(_0xb087('0x4'));var config=require(_0xb087('0x5'));var controller=require(_0xb087('0x6'));router[_0xb087('0x7')]('/',auth[_0xb087('0x8')](),controller[_0xb087('0x9')]);router[_0xb087('0x7')](_0xb087('0xa'),auth[_0xb087('0x8')](),controller[_0xb087('0xb')]);router[_0xb087('0x7')](_0xb087('0xc'),auth[_0xb087('0x8')](),controller[_0xb087('0xd')]);router[_0xb087('0xe')]('/',auth[_0xb087('0x8')](),controller['create']);router[_0xb087('0xf')](_0xb087('0xc'),auth[_0xb087('0x8')](),controller[_0xb087('0x10')]);router[_0xb087('0x11')](_0xb087('0xc'),auth[_0xb087('0x8')](),controller['destroy']);module[_0xb087('0x12')]=router; \ No newline at end of file +var _0x878f=['../../config/environment','./smsTransferReport.controller','get','isAuthenticated','/describe','create','put','update','/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x332f9b,_0x20cf77){var _0x7f3d1c=function(_0x22586e){while(--_0x22586e){_0x332f9b['push'](_0x332f9b['shift']());}};_0x7f3d1c(++_0x20cf77);}(_0x878f,0x173));var _0xf878=function(_0x83033a,_0x46cd5b){_0x83033a=_0x83033a-0x0;var _0x1a2f5d=_0x878f[_0x83033a];return _0x1a2f5d;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var auth=require(_0xf878('0x5'));var interaction=require(_0xf878('0x6'));var config=require(_0xf878('0x7'));var controller=require(_0xf878('0x8'));router[_0xf878('0x9')]('/',auth[_0xf878('0xa')](),controller['index']);router['get'](_0xf878('0xb'),auth[_0xf878('0xa')](),controller['describe']);router['get']('/:id',auth[_0xf878('0xa')](),controller['show']);router['post']('/',auth[_0xf878('0xa')](),controller[_0xf878('0xc')]);router[_0xf878('0xd')]('/:id',auth[_0xf878('0xa')](),controller[_0xf878('0xe')]);router['delete'](_0xf878('0xf'),auth['isAuthenticated'](),controller[_0xf878('0x10')]);module[_0xf878('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 5c93e92..9d435e6 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 _0xbf0f=['NOW','moment','sequelize','exports','STRING','ENUM','account','agent','queue','DATE'];(function(_0x359aee,_0x51a5cf){var _0x2a5839=function(_0x105de1){while(--_0x105de1){_0x359aee['push'](_0x359aee['shift']());}};_0x2a5839(++_0x51a5cf);}(_0xbf0f,0x155));var _0xfbf0=function(_0x16aaef,_0x410651){_0x16aaef=_0x16aaef-0x0;var _0x1c82ef=_0xbf0f[_0x16aaef];return _0x1c82ef;};'use strict';var moment=require(_0xfbf0('0x0'));var Sequelize=require(_0xfbf0('0x1'));module[_0xfbf0('0x2')]={'uniqueid':{'type':Sequelize[_0xfbf0('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xfbf0('0x4')](_0xfbf0('0x5'),_0xfbf0('0x6'),_0xfbf0('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xfbf0('0x8')],'allowNull':![],'defaultValue':Sequelize[_0xfbf0('0x9')]}}; \ No newline at end of file +var _0x2bf5=['STRING','ENUM','account','agent','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x4d902e,_0x312dd7){var _0x1f4970=function(_0x50dcbb){while(--_0x50dcbb){_0x4d902e['push'](_0x4d902e['shift']());}};_0x1f4970(++_0x312dd7);}(_0x2bf5,0x11f));var _0x52bf=function(_0x13b64b,_0x5334e9){_0x13b64b=_0x13b64b-0x0;var _0x466fdd=_0x2bf5[_0x13b64b];return _0x466fdd;};'use strict';var moment=require(_0x52bf('0x0'));var Sequelize=require(_0x52bf('0x1'));module[_0x52bf('0x2')]={'uniqueid':{'type':Sequelize[_0x52bf('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x52bf('0x4')](_0x52bf('0x5'),_0x52bf('0x6'),_0x52bf('0x7')),'allowNull':![],'defaultValue':_0x52bf('0x7')},'transferredAt':{'type':Sequelize[_0x52bf('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x52bf('0x9')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index dee1407..e7d48fa 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 _0xcb91=['options','includeAll','include','findAll','params','find','catch','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','SmsTransferReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge'];(function(_0x3542b9,_0x4b606b){var _0x1933b5=function(_0x4f11bf){while(--_0x4f11bf){_0x3542b9['push'](_0x3542b9['shift']());}};_0x1933b5(++_0x4b606b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1fa759,_0x4ecdce){_0x1fa759=_0x1fa759-0x0;var _0x2da9f4=_0xcb91[_0x1fa759];return _0x2da9f4;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];function respondWithStatusCode(_0x46af58,_0x5445e1){_0x5445e1=_0x5445e1||0xcc;return function(_0x5e3c19){if(_0x5e3c19){return _0x46af58['sendStatus'](_0x5445e1);}return _0x46af58[_0x1cb9('0x16')](_0x5445e1)[_0x1cb9('0x17')]();};}function respondWithResult(_0x384496,_0x1c714f){_0x1c714f=_0x1c714f||0xc8;return function(_0x56884d){if(_0x56884d){return _0x384496[_0x1cb9('0x16')](_0x1c714f)[_0x1cb9('0x18')](_0x56884d);}};}function respondWithFilteredResult(_0x1b3cd7,_0x8dfa55){return function(_0x3e2d11){if(_0x3e2d11){var _0x5806d8=_0x3e2d11[_0x1cb9('0x19')],_0x5572cb=_0x8dfa55[_0x1cb9('0x1a')],_0xd446a3=_0x8dfa55[_0x1cb9('0x1a')]+_0x8dfa55[_0x1cb9('0x1b')],_0x3cc765;if(_0xd446a3>=_0x5806d8){_0xd446a3=_0x5806d8;_0x3cc765=0xc8;}else{_0x3cc765=0xce;}_0x1b3cd7[_0x1cb9('0x16')](_0x3cc765);return _0x1b3cd7['set']('Content-Range',_0x5572cb+'-'+_0xd446a3+'/'+_0x5806d8)[_0x1cb9('0x18')](_0x3e2d11);}return null;};}function patchUpdates(_0x41ac41){return function(_0x2b2669){try{jsonpatch[_0x1cb9('0x1c')](_0x2b2669,_0x41ac41,!![]);}catch(_0x280a84){return BPromise[_0x1cb9('0x1d')](_0x280a84);}return _0x2b2669[_0x1cb9('0x1e')]();};}function saveUpdates(_0x4ac422,_0x559bcc){return function(_0x1a5a72){if(_0x1a5a72){return _0x1a5a72['update'](_0x4ac422)[_0x1cb9('0x1f')](function(_0x2265ea){return _0x2265ea;});}return null;};}function removeEntity(_0x523b26,_0x599275){return function(_0x2e3854){if(_0x2e3854){return _0x2e3854[_0x1cb9('0x20')]()[_0x1cb9('0x1f')](function(){_0x523b26[_0x1cb9('0x16')](0xcc)[_0x1cb9('0x17')]();});}};}function handleEntityNotFound(_0x27db16,_0x59ebea){return function(_0x55b232){if(!_0x55b232){_0x27db16[_0x1cb9('0x21')](0x194);}return _0x55b232;};}function handleError(_0x557199,_0x10a419){_0x10a419=_0x10a419||0x1f4;return function(_0x2b1275){logger[_0x1cb9('0x22')](_0x2b1275[_0x1cb9('0x23')]);if(_0x2b1275[_0x1cb9('0x24')]){delete _0x2b1275['name'];}_0x557199[_0x1cb9('0x16')](_0x10a419)[_0x1cb9('0x25')](_0x2b1275);};}exports['index']=function(_0xd6891c,_0x21effa){var _0x41a9a0={},_0x1804fd={},_0x406821={'count':0x0,'rows':[]};var _0x21d6f5=_[_0x1cb9('0x26')](db[_0x1cb9('0x27')][_0x1cb9('0x28')],function(_0x9de64b){return{'name':_0x9de64b['fieldName'],'type':_0x9de64b[_0x1cb9('0x29')]['key']};});_0x1804fd[_0x1cb9('0x2a')]=_['map'](_0x21d6f5,_0x1cb9('0x24'));_0x1804fd[_0x1cb9('0x2b')]=_[_0x1cb9('0x2c')](_0xd6891c[_0x1cb9('0x2b')]);_0x1804fd['filters']=_[_0x1cb9('0x2d')](_0x1804fd['model'],_0x1804fd[_0x1cb9('0x2b')]);_0x41a9a0[_0x1cb9('0x2e')]=_[_0x1cb9('0x2d')](_0x1804fd['model'],qs[_0x1cb9('0x2f')](_0xd6891c['query'][_0x1cb9('0x2f')]));_0x41a9a0['attributes']=_0x41a9a0[_0x1cb9('0x2e')][_0x1cb9('0x30')]?_0x41a9a0[_0x1cb9('0x2e')]:_0x1804fd[_0x1cb9('0x2a')];if(!_0xd6891c['query'][_0x1cb9('0x31')](_0x1cb9('0x32'))){_0x41a9a0[_0x1cb9('0x1b')]=qs[_0x1cb9('0x1b')](_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x1b')]);_0x41a9a0[_0x1cb9('0x1a')]=qs[_0x1cb9('0x1a')](_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x1a')]);}_0x41a9a0[_0x1cb9('0x33')]=qs[_0x1cb9('0x34')](_0xd6891c[_0x1cb9('0x2b')]['sort']);_0x41a9a0['where']=qs[_0x1cb9('0x35')](_[_0x1cb9('0x36')](_0xd6891c[_0x1cb9('0x2b')],_0x1804fd[_0x1cb9('0x35')]),_0x21d6f5);if(_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x37')]){_0x41a9a0[_0x1cb9('0x38')]=_[_0x1cb9('0x39')](_0x41a9a0['where'],{'$or':_[_0x1cb9('0x26')](_0x21d6f5,function(_0x1482c4){if(_0x1482c4[_0x1cb9('0x29')]!=='VIRTUAL'){var _0x2a5aac={};_0x2a5aac[_0x1482c4['name']]={'$like':'%'+_0xd6891c[_0x1cb9('0x2b')]['filter']+'%'};return _0x2a5aac;}})});}_0x41a9a0=_[_0x1cb9('0x39')]({},_0x41a9a0,_0xd6891c[_0x1cb9('0x3a')]);var _0x289b73={'where':_0x41a9a0[_0x1cb9('0x38')]};return db[_0x1cb9('0x27')][_0x1cb9('0x19')](_0x289b73)[_0x1cb9('0x1f')](function(_0x4a4788){_0x406821['count']=_0x4a4788;if(_0xd6891c[_0x1cb9('0x2b')][_0x1cb9('0x3b')]){_0x41a9a0[_0x1cb9('0x3c')]=[{'all':!![]}];}return db[_0x1cb9('0x27')][_0x1cb9('0x3d')](_0x41a9a0);})[_0x1cb9('0x1f')](function(_0x32130b){_0x406821['rows']=_0x32130b;return _0x406821;})[_0x1cb9('0x1f')](respondWithFilteredResult(_0x21effa,_0x41a9a0))['catch'](handleError(_0x21effa,null));};exports['show']=function(_0x4c6c75,_0x409c62){var _0x397ff9={'raw':!![],'where':{'id':_0x4c6c75[_0x1cb9('0x3e')]['id']}},_0x1bf51c={};_0x1bf51c[_0x1cb9('0x2a')]=_['keys'](db[_0x1cb9('0x27')]['rawAttributes']);_0x1bf51c[_0x1cb9('0x2b')]=_[_0x1cb9('0x2c')](_0x4c6c75[_0x1cb9('0x2b')]);_0x1bf51c['filters']=_[_0x1cb9('0x2d')](_0x1bf51c['model'],_0x1bf51c[_0x1cb9('0x2b')]);_0x397ff9[_0x1cb9('0x2e')]=_['intersection'](_0x1bf51c['model'],qs[_0x1cb9('0x2f')](_0x4c6c75[_0x1cb9('0x2b')][_0x1cb9('0x2f')]));_0x397ff9[_0x1cb9('0x2e')]=_0x397ff9[_0x1cb9('0x2e')]['length']?_0x397ff9[_0x1cb9('0x2e')]:_0x1bf51c['model'];if(_0x4c6c75['query']['includeAll']){_0x397ff9[_0x1cb9('0x3c')]=[{'all':!![]}];}_0x397ff9=_[_0x1cb9('0x39')]({},_0x397ff9,_0x4c6c75[_0x1cb9('0x3a')]);return db[_0x1cb9('0x27')][_0x1cb9('0x3f')](_0x397ff9)[_0x1cb9('0x1f')](handleEntityNotFound(_0x409c62,null))[_0x1cb9('0x1f')](respondWithResult(_0x409c62,null))[_0x1cb9('0x40')](handleError(_0x409c62,null));};exports[_0x1cb9('0x41')]=function(_0x148a01,_0x3ea88c){return db['SmsTransferReport'][_0x1cb9('0x41')](_0x148a01[_0x1cb9('0x42')],{})[_0x1cb9('0x1f')](respondWithResult(_0x3ea88c,0xc9))['catch'](handleError(_0x3ea88c,null));};exports[_0x1cb9('0x43')]=function(_0x57251,_0x3c6044){if(_0x57251[_0x1cb9('0x42')]['id']){delete _0x57251[_0x1cb9('0x42')]['id'];}return db['SmsTransferReport'][_0x1cb9('0x3f')]({'where':{'id':_0x57251['params']['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x3c6044,null))['then'](saveUpdates(_0x57251[_0x1cb9('0x42')],null))[_0x1cb9('0x1f')](respondWithResult(_0x3c6044,null))[_0x1cb9('0x40')](handleError(_0x3c6044,null));};exports[_0x1cb9('0x20')]=function(_0x56d0c5,_0x298475){return db[_0x1cb9('0x27')][_0x1cb9('0x3f')]({'where':{'id':_0x56d0c5[_0x1cb9('0x3e')]['id']}})[_0x1cb9('0x1f')](handleEntityNotFound(_0x298475,null))[_0x1cb9('0x1f')](removeEntity(_0x298475,null))[_0x1cb9('0x40')](handleError(_0x298475,null));};exports[_0x1cb9('0x44')]=function(_0xbb500e,_0x17f10e){return db['SmsTransferReport']['describe']()[_0x1cb9('0x1f')](respondWithResult(_0x17f10e,null))[_0x1cb9('0x40')](handleError(_0x17f10e,null));}; \ No newline at end of file +var _0x0713=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','findAll','catch','show','params','includeAll','include','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x214827,_0x440ea2){var _0x3c8aa7=function(_0x315d53){while(--_0x315d53){_0x214827['push'](_0x214827['shift']());}};_0x3c8aa7(++_0x440ea2);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3071('0x0'));var zipdir=require(_0x3071('0x1'));var jsonpatch=require(_0x3071('0x2'));var rp=require(_0x3071('0x3'));var moment=require(_0x3071('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3071('0x5'));var util=require(_0x3071('0x6'));var path=require(_0x3071('0x7'));var sox=require(_0x3071('0x8'));var csv=require(_0x3071('0x9'));var ejs=require(_0x3071('0xa'));var fs=require('fs');var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x9'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var db=require(_0x3071('0x19'))['db'];function respondWithStatusCode(_0xa0c1,_0x4a8cc7){_0x4a8cc7=_0x4a8cc7||0xcc;return function(_0x5330a8){if(_0x5330a8){return _0xa0c1[_0x3071('0x1a')](_0x4a8cc7);}return _0xa0c1['status'](_0x4a8cc7)[_0x3071('0x1b')]();};}function respondWithResult(_0x44fbae,_0x5d4883){_0x5d4883=_0x5d4883||0xc8;return function(_0x104e73){if(_0x104e73){return _0x44fbae['status'](_0x5d4883)[_0x3071('0x1c')](_0x104e73);}};}function respondWithFilteredResult(_0x45c93b,_0x1271d0){return function(_0x1f14e1){if(_0x1f14e1){var _0x1caa5d=_0x1f14e1[_0x3071('0x1d')],_0x2a6a4b=_0x1271d0[_0x3071('0x1e')],_0x157a47=_0x1271d0['offset']+_0x1271d0[_0x3071('0x1f')],_0x11bdc9;if(_0x157a47>=_0x1caa5d){_0x157a47=_0x1caa5d;_0x11bdc9=0xc8;}else{_0x11bdc9=0xce;}_0x45c93b[_0x3071('0x20')](_0x11bdc9);return _0x45c93b[_0x3071('0x21')](_0x3071('0x22'),_0x2a6a4b+'-'+_0x157a47+'/'+_0x1caa5d)[_0x3071('0x1c')](_0x1f14e1);}return null;};}function patchUpdates(_0x17aee2){return function(_0x105bbb){try{jsonpatch[_0x3071('0x23')](_0x105bbb,_0x17aee2,!![]);}catch(_0x502a16){return BPromise[_0x3071('0x24')](_0x502a16);}return _0x105bbb[_0x3071('0x25')]();};}function saveUpdates(_0xd3e23d,_0x56c267){return function(_0xb8f4e3){if(_0xb8f4e3){return _0xb8f4e3['update'](_0xd3e23d)[_0x3071('0x26')](function(_0x43128c){return _0x43128c;});}return null;};}function removeEntity(_0x3762d8,_0x457b57){return function(_0x33090c){if(_0x33090c){return _0x33090c[_0x3071('0x27')]()[_0x3071('0x26')](function(){_0x3762d8[_0x3071('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(!_0xb05b1d){_0x481a51[_0x3071('0x1a')](0x194);}return _0xb05b1d;};}function handleError(_0x13df9f,_0x2793ef){_0x2793ef=_0x2793ef||0x1f4;return function(_0x44b45f){logger[_0x3071('0x28')](_0x44b45f[_0x3071('0x29')]);if(_0x44b45f[_0x3071('0x2a')]){delete _0x44b45f['name'];}_0x13df9f[_0x3071('0x20')](_0x2793ef)[_0x3071('0x2b')](_0x44b45f);};}exports[_0x3071('0x2c')]=function(_0x4d5c4b,_0x4fb1ca){var _0x28792d={},_0x163604={},_0x950fde={'count':0x0,'rows':[]};var _0x3fa3b8=_[_0x3071('0x2d')](db[_0x3071('0x2e')][_0x3071('0x2f')],function(_0x32f1b4){return{'name':_0x32f1b4[_0x3071('0x30')],'type':_0x32f1b4[_0x3071('0x31')]['key']};});_0x163604['model']=_[_0x3071('0x2d')](_0x3fa3b8,_0x3071('0x2a'));_0x163604[_0x3071('0x32')]=_[_0x3071('0x33')](_0x4d5c4b[_0x3071('0x32')]);_0x163604[_0x3071('0x34')]=_[_0x3071('0x35')](_0x163604[_0x3071('0x36')],_0x163604['query']);_0x28792d['attributes']=_['intersection'](_0x163604[_0x3071('0x36')],qs[_0x3071('0x37')](_0x4d5c4b['query'][_0x3071('0x37')]));_0x28792d[_0x3071('0x38')]=_0x28792d[_0x3071('0x38')][_0x3071('0x39')]?_0x28792d['attributes']:_0x163604[_0x3071('0x36')];if(!_0x4d5c4b[_0x3071('0x32')][_0x3071('0x3a')](_0x3071('0x3b'))){_0x28792d[_0x3071('0x1f')]=qs[_0x3071('0x1f')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x1f')]);_0x28792d['offset']=qs[_0x3071('0x1e')](_0x4d5c4b['query']['offset']);}_0x28792d[_0x3071('0x3c')]=qs[_0x3071('0x3d')](_0x4d5c4b['query'][_0x3071('0x3d')]);_0x28792d[_0x3071('0x3e')]=qs[_0x3071('0x34')](_[_0x3071('0x3f')](_0x4d5c4b[_0x3071('0x32')],_0x163604[_0x3071('0x34')]),_0x3fa3b8);if(_0x4d5c4b['query'][_0x3071('0x40')]){_0x28792d[_0x3071('0x3e')]=_['merge'](_0x28792d[_0x3071('0x3e')],{'$or':_['map'](_0x3fa3b8,function(_0x28f855){if(_0x28f855[_0x3071('0x31')]!=='VIRTUAL'){var _0x593c99={};_0x593c99[_0x28f855[_0x3071('0x2a')]]={'$like':'%'+_0x4d5c4b[_0x3071('0x32')][_0x3071('0x40')]+'%'};return _0x593c99;}})});}_0x28792d=_['merge']({},_0x28792d,_0x4d5c4b[_0x3071('0x41')]);var _0x534a77={'where':_0x28792d[_0x3071('0x3e')]};return db['SmsTransferReport'][_0x3071('0x1d')](_0x534a77)[_0x3071('0x26')](function(_0x1fcc52){_0x950fde[_0x3071('0x1d')]=_0x1fcc52;if(_0x4d5c4b[_0x3071('0x32')]['includeAll']){_0x28792d['include']=[{'all':!![]}];}return db[_0x3071('0x2e')][_0x3071('0x42')](_0x28792d);})[_0x3071('0x26')](function(_0x1f69a6){_0x950fde['rows']=_0x1f69a6;return _0x950fde;})[_0x3071('0x26')](respondWithFilteredResult(_0x4fb1ca,_0x28792d))[_0x3071('0x43')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x44')]=function(_0x25c29f,_0x277104){var _0xb9a4b8={'raw':!![],'where':{'id':_0x25c29f[_0x3071('0x45')]['id']}},_0x56a9d8={};_0x56a9d8['model']=_['keys'](db['SmsTransferReport']['rawAttributes']);_0x56a9d8[_0x3071('0x32')]=_[_0x3071('0x33')](_0x25c29f[_0x3071('0x32')]);_0x56a9d8[_0x3071('0x34')]=_[_0x3071('0x35')](_0x56a9d8[_0x3071('0x36')],_0x56a9d8[_0x3071('0x32')]);_0xb9a4b8[_0x3071('0x38')]=_['intersection'](_0x56a9d8[_0x3071('0x36')],qs[_0x3071('0x37')](_0x25c29f[_0x3071('0x32')][_0x3071('0x37')]));_0xb9a4b8[_0x3071('0x38')]=_0xb9a4b8['attributes']['length']?_0xb9a4b8[_0x3071('0x38')]:_0x56a9d8[_0x3071('0x36')];if(_0x25c29f[_0x3071('0x32')][_0x3071('0x46')]){_0xb9a4b8[_0x3071('0x47')]=[{'all':!![]}];}_0xb9a4b8=_['merge']({},_0xb9a4b8,_0x25c29f[_0x3071('0x41')]);return db['SmsTransferReport'][_0x3071('0x48')](_0xb9a4b8)['then'](handleEntityNotFound(_0x277104,null))['then'](respondWithResult(_0x277104,null))[_0x3071('0x43')](handleError(_0x277104,null));};exports['create']=function(_0x1862ea,_0x5a0a69){return db[_0x3071('0x2e')][_0x3071('0x49')](_0x1862ea[_0x3071('0x4a')],{})[_0x3071('0x26')](respondWithResult(_0x5a0a69,0xc9))['catch'](handleError(_0x5a0a69,null));};exports[_0x3071('0x4b')]=function(_0x575c12,_0xd273ec){if(_0x575c12['body']['id']){delete _0x575c12[_0x3071('0x4a')]['id'];}return db[_0x3071('0x2e')]['find']({'where':{'id':_0x575c12[_0x3071('0x45')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0xd273ec,null))[_0x3071('0x26')](saveUpdates(_0x575c12[_0x3071('0x4a')],null))[_0x3071('0x26')](respondWithResult(_0xd273ec,null))[_0x3071('0x43')](handleError(_0xd273ec,null));};exports[_0x3071('0x27')]=function(_0x577060,_0x2c6e4c){return db[_0x3071('0x2e')][_0x3071('0x48')]({'where':{'id':_0x577060[_0x3071('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c6e4c,null))[_0x3071('0x26')](removeEntity(_0x2c6e4c,null))[_0x3071('0x43')](handleError(_0x2c6e4c,null));};exports[_0x3071('0x4c')]=function(_0x2307dd,_0x22aade){return db[_0x3071('0x2e')][_0x3071('0x4c')]()[_0x3071('0x26')](respondWithResult(_0x22aade,null))[_0x3071('0x43')](handleError(_0x22aade,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 7c99bb6..2e017b5 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 _0xf6ed=['../../config/logger','moment','bluebird','path','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid'];(function(_0x4237ed,_0x457321){var _0x1dedff=function(_0x21c7c6){while(--_0x21c7c6){_0x4237ed['push'](_0x4237ed['shift']());}};_0x1dedff(++_0x457321);}(_0xf6ed,0x1ce));var _0xdf6e=function(_0x41a6b7,_0x552980){_0x41a6b7=_0x41a6b7-0x0;var _0x5f11f0=_0xf6ed[_0x41a6b7];return _0x5f11f0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdf6e('0x0'))('api');var moment=require(_0xdf6e('0x1'));var BPromise=require(_0xdf6e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf6e('0x3'));var rimraf=require('rimraf');var config=require(_0xdf6e('0x4'));var attributes=require(_0xdf6e('0x5'));module[_0xdf6e('0x6')]=function(_0x49cf6c,_0x185a9b){return _0x49cf6c[_0xdf6e('0x7')](_0xdf6e('0x8'),attributes,{'tableName':_0xdf6e('0x9'),'paranoid':![],'indexes':[{'name':_0xdf6e('0xa'),'fields':[_0xdf6e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x81e8=['../../config/environment','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x550a61,_0x1c5d8c){var _0x248bfc=function(_0x38d79e){while(--_0x38d79e){_0x550a61['push'](_0x550a61['shift']());}};_0x248bfc(++_0x1c5d8c);}(_0x81e8,0x105));var _0x881e=function(_0x2ec46e,_0x31d5e6){_0x2ec46e=_0x2ec46e-0x0;var _0x5e7ffa=_0x81e8[_0x2ec46e];return _0x5e7ffa;};'use strict';var _=require(_0x881e('0x0'));var util=require(_0x881e('0x1'));var logger=require(_0x881e('0x2'))(_0x881e('0x3'));var moment=require(_0x881e('0x4'));var BPromise=require(_0x881e('0x5'));var rp=require(_0x881e('0x6'));var fs=require('fs');var path=require(_0x881e('0x7'));var rimraf=require(_0x881e('0x8'));var config=require(_0x881e('0x9'));var attributes=require('./smsTransferReport.attributes');module[_0x881e('0xa')]=function(_0x500bfe,_0x281b6b){return _0x500bfe[_0x881e('0xb')](_0x881e('0xc'),attributes,{'tableName':_0x881e('0xd'),'paranoid':![],'indexes':[{'name':_0x881e('0xe'),'fields':[_0x881e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index a1d1d86..3e2a4de 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 _0x4f3f=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x566d36,_0x21a62a){var _0x4cc9ae=function(_0x51a3d8){while(--_0x51a3d8){_0x566d36['push'](_0x566d36['shift']());}};_0x4cc9ae(++_0x21a62a);}(_0x4f3f,0x75));var _0xf4f3=function(_0x1320f0,_0x107e39){_0x1320f0=_0x1320f0-0x0;var _0x230645=_0x4f3f[_0x1320f0];return _0x230645;};'use strict';var _=require(_0xf4f3('0x0'));var util=require(_0xf4f3('0x1'));var moment=require(_0xf4f3('0x2'));var BPromise=require(_0xf4f3('0x3'));var rs=require(_0xf4f3('0x4'));var fs=require('fs');var Redis=require(_0xf4f3('0x5'));var db=require(_0xf4f3('0x6'))['db'];var utils=require(_0xf4f3('0x7'));var logger=require(_0xf4f3('0x8'))(_0xf4f3('0x9'));var config=require(_0xf4f3('0xa'));var jayson=require(_0xf4f3('0xb'));var client=jayson['client'][_0xf4f3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x559ed6,_0x419bb2,_0xbdfe9f){return new BPromise(function(_0x3c566b,_0x294b13){return client[_0xf4f3('0xd')](_0x559ed6,_0xbdfe9f)['then'](function(_0x25bc6c){logger[_0xf4f3('0xe')](_0xf4f3('0xf'),_0x419bb2,_0xf4f3('0x10'));logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x419bb2,'request\x20sent',JSON[_0xf4f3('0x11')](_0x25bc6c));if(_0x25bc6c[_0xf4f3('0x12')]){if(_0x25bc6c[_0xf4f3('0x12')][_0xf4f3('0x13')]===0x1f4){logger[_0xf4f3('0x12')](_0xf4f3('0xf'),_0x419bb2,_0x25bc6c[_0xf4f3('0x12')][_0xf4f3('0x14')]);return _0x294b13(_0x25bc6c[_0xf4f3('0x12')]['message']);}logger['error'](_0xf4f3('0xf'),_0x419bb2,_0x25bc6c[_0xf4f3('0x12')][_0xf4f3('0x14')]);return _0x3c566b(_0x25bc6c[_0xf4f3('0x12')][_0xf4f3('0x14')]);}else{logger[_0xf4f3('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x419bb2,_0xf4f3('0x10'));_0x3c566b(_0x25bc6c[_0xf4f3('0x15')][_0xf4f3('0x14')]);}})[_0xf4f3('0x16')](function(_0x5b45dc){logger[_0xf4f3('0x12')](_0xf4f3('0xf'),_0x419bb2,_0x5b45dc);_0x294b13(_0x5b45dc);});});} \ No newline at end of file +var _0xf3e3=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util'];(function(_0x245a14,_0x27d4df){var _0x1c97d6=function(_0x2bbfd6){while(--_0x2bbfd6){_0x245a14['push'](_0x245a14['shift']());}};_0x1c97d6(++_0x27d4df);}(_0xf3e3,0x106));var _0x3f3e=function(_0x429395,_0x731967){_0x429395=_0x429395-0x0;var _0x51c0db=_0xf3e3[_0x429395];return _0x51c0db;};'use strict';var _=require(_0x3f3e('0x0'));var util=require(_0x3f3e('0x1'));var moment=require('moment');var BPromise=require(_0x3f3e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f3e('0x3'));var db=require(_0x3f3e('0x4'))['db'];var utils=require(_0x3f3e('0x5'));var logger=require(_0x3f3e('0x6'))(_0x3f3e('0x7'));var config=require(_0x3f3e('0x8'));var jayson=require(_0x3f3e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2174ea,_0x4feccf,_0x4a6f9a){return new BPromise(function(_0x3f3187,_0x5f2be5){return client[_0x3f3e('0xa')](_0x2174ea,_0x4a6f9a)[_0x3f3e('0xb')](function(_0x6641e3){logger[_0x3f3e('0xc')](_0x3f3e('0xd'),_0x4feccf,'request\x20sent');logger[_0x3f3e('0xe')](_0x3f3e('0xf'),_0x4feccf,_0x3f3e('0x10'),JSON[_0x3f3e('0x11')](_0x6641e3));if(_0x6641e3['error']){if(_0x6641e3['error']['code']===0x1f4){logger[_0x3f3e('0x12')](_0x3f3e('0xd'),_0x4feccf,_0x6641e3[_0x3f3e('0x12')][_0x3f3e('0x13')]);return _0x5f2be5(_0x6641e3[_0x3f3e('0x12')][_0x3f3e('0x13')]);}logger[_0x3f3e('0x12')](_0x3f3e('0xd'),_0x4feccf,_0x6641e3[_0x3f3e('0x12')]['message']);return _0x3f3187(_0x6641e3[_0x3f3e('0x12')][_0x3f3e('0x13')]);}else{logger[_0x3f3e('0xc')](_0x3f3e('0xd'),_0x4feccf,'request\x20sent');_0x3f3187(_0x6641e3[_0x3f3e('0x14')]['message']);}})[_0x3f3e('0x15')](function(_0x76e545){logger[_0x3f3e('0x12')](_0x3f3e('0xd'),_0x4feccf,_0x76e545);_0x5f2be5(_0x76e545);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 0e8ed09..0d79440 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 _0x8de4=['Router','../../components/interaction/service','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','originalname','format','basename','extname','now','file','create','put','delete','exports','multer','util','path','connect-timeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8de4,0x9e));var _0x48de=function(_0x2258e7,_0x3042a4){_0x2258e7=_0x2258e7-0x0;var _0x387c1b=_0x8de4[_0x2258e7];return _0x387c1b;};'use strict';var multer=require(_0x48de('0x0'));var util=require(_0x48de('0x1'));var path=require(_0x48de('0x2'));var timeout=require(_0x48de('0x3'));var express=require('express');var router=express[_0x48de('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x48de('0x5'));var config=require('../../config/environment');var controller=require(_0x48de('0x6'));router[_0x48de('0x7')]('/',auth[_0x48de('0x8')](),controller[_0x48de('0x9')]);router[_0x48de('0x7')](_0x48de('0xa'),auth[_0x48de('0x8')](),controller[_0x48de('0xb')]);router[_0x48de('0x7')](_0x48de('0xc'),auth[_0x48de('0x8')](),controller[_0x48de('0xd')]);var upload=multer({'storage':multer[_0x48de('0xe')]({'destination':function(_0x396925,_0x3604c1,_0x393fbe){_0x393fbe(null,path[_0x48de('0xf')](config[_0x48de('0x10')],'server/files/sounds/original/'));},'filename':function(_0x1d2ea1,_0xb40114,_0xdd9ab2){_0xb40114[_0x48de('0x11')]=_0xb40114[_0x48de('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xdd9ab2(null,util[_0x48de('0x12')]('%s-%s%s',path[_0x48de('0x13')](_0xb40114[_0x48de('0x11')],path[_0x48de('0x14')](_0xb40114[_0x48de('0x11')])),Date[_0x48de('0x15')](),path['extname'](_0xb40114['originalname'])));}})});router['post']('/',upload['single'](_0x48de('0x16')),controller[_0x48de('0x17')]);router[_0x48de('0x18')]('/:id',auth[_0x48de('0x8')](),controller['update']);router[_0x48de('0x19')](_0x48de('0xa'),auth[_0x48de('0x8')](),controller[_0x48de('0x19')]);module[_0x48de('0x1a')]=router; \ No newline at end of file +var _0x8f74=['exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname','format','%s-%s%s','extname','now','post','single','create','put','update','delete'];(function(_0x5b685e,_0x3e69ad){var _0x9a0173=function(_0x5cc6ad){while(--_0x5cc6ad){_0x5b685e['push'](_0x5b685e['shift']());}};_0x9a0173(++_0x3e69ad);}(_0x8f74,0x17a));var _0x48f7=function(_0x14f904,_0x3290e8){_0x14f904=_0x14f904-0x0;var _0x538469=_0x8f74[_0x14f904];return _0x538469;};'use strict';var multer=require('multer');var util=require(_0x48f7('0x0'));var path=require(_0x48f7('0x1'));var timeout=require(_0x48f7('0x2'));var express=require('express');var router=express[_0x48f7('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x48f7('0x4'));var config=require(_0x48f7('0x5'));var controller=require(_0x48f7('0x6'));router[_0x48f7('0x7')]('/',auth[_0x48f7('0x8')](),controller[_0x48f7('0x9')]);router[_0x48f7('0x7')](_0x48f7('0xa'),auth[_0x48f7('0x8')](),controller[_0x48f7('0xb')]);router['get'](_0x48f7('0xc'),auth[_0x48f7('0x8')](),controller[_0x48f7('0xd')]);var upload=multer({'storage':multer[_0x48f7('0xe')]({'destination':function(_0x3828fb,_0x434a59,_0x5ca40d){_0x5ca40d(null,path[_0x48f7('0xf')](config['root'],_0x48f7('0x10')));},'filename':function(_0x12a88a,_0x3405ce,_0x33f3de){_0x3405ce['originalname']=_0x3405ce[_0x48f7('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x33f3de(null,util[_0x48f7('0x12')](_0x48f7('0x13'),path['basename'](_0x3405ce[_0x48f7('0x11')],path[_0x48f7('0x14')](_0x3405ce[_0x48f7('0x11')])),Date[_0x48f7('0x15')](),path[_0x48f7('0x14')](_0x3405ce[_0x48f7('0x11')])));}})});router[_0x48f7('0x16')]('/',upload[_0x48f7('0x17')]('file'),controller[_0x48f7('0x18')]);router[_0x48f7('0x19')](_0x48f7('0xa'),auth[_0x48f7('0x8')](),controller[_0x48f7('0x1a')]);router[_0x48f7('0x1b')](_0x48f7('0xa'),auth[_0x48f7('0x8')](),controller[_0x48f7('0x1b')]);module[_0x48f7('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 2c58183..2d0fc46 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 _0x0894=['exports','STRING','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0xa6e5bb,_0x51b26a){var _0x3822b9=function(_0x5cdb15){while(--_0x5cdb15){_0xa6e5bb['push'](_0xa6e5bb['shift']());}};_0x3822b9(++_0x51b26a);}(_0x0894,0xe3));var _0x4089=function(_0xc1da94,_0x58ecf7){_0xc1da94=_0xc1da94-0x0;var _0x535930=_0x0894[_0xc1da94];return _0x535930;};'use strict';var Sequelize=require(_0x4089('0x0'));module[_0x4089('0x1')]={'name':{'type':Sequelize[_0x4089('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x4089('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x4089('0x2')]},'original_duration':{'type':Sequelize[_0x4089('0x3')]},'original_sampleCount':{'type':Sequelize[_0x4089('0x4')]},'original_channelCount':{'type':Sequelize[_0x4089('0x5')]},'original_bitRate':{'type':Sequelize[_0x4089('0x4')]},'original_sampleRate':{'type':Sequelize[_0x4089('0x5')]},'converted_format':{'type':Sequelize[_0x4089('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x4089('0x5')]},'converted_bitRate':{'type':Sequelize[_0x4089('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x4089('0x5')]}}; \ No newline at end of file +var _0x7dc5=['sequelize','exports','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x181b84,_0x42f8f1){var _0x3f773d=function(_0x2f916f){while(--_0x2f916f){_0x181b84['push'](_0x181b84['shift']());}};_0x3f773d(++_0x42f8f1);}(_0x7dc5,0x85));var _0x57dc=function(_0x42e98c,_0x1c6bb9){_0x42e98c=_0x42e98c-0x0;var _0x59803e=_0x7dc5[_0x42e98c];return _0x59803e;};'use strict';var Sequelize=require(_0x57dc('0x0'));module[_0x57dc('0x1')]={'name':{'type':Sequelize[_0x57dc('0x2')],'unique':_0x57dc('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x57dc('0x2')]},'display_name':{'type':Sequelize[_0x57dc('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x57dc('0x2')]},'original_format':{'type':Sequelize[_0x57dc('0x2')]},'original_duration':{'type':Sequelize[_0x57dc('0x4')]},'original_sampleCount':{'type':Sequelize[_0x57dc('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x57dc('0x5')]},'original_sampleRate':{'type':Sequelize[_0x57dc('0x6')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x57dc('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x57dc('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x57dc('0x5')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 8343f14..6802fdc 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 _0xad98=['file','filename','info','chmodSync','0777','unlinkSync','src','original_duration','duration','sampleCount','original_channelCount','channelCount','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Sounds','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','params','description','delete','server/files/sounds/original','original_format','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','Content-Range','json','apply','update','then','get','destroy','error','stack','name','send','index','Sound','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','rows','catch','show','includeAll','find','download','save_name','join','root','server/files/sounds/converted','Sequelize','ValidationError','format','%s.%s','converted_format','create','originalname','extname'];(function(_0x5d4390,_0x21b7d8){var _0x4f3e01=function(_0x42372f){while(--_0x42372f){_0x5d4390['push'](_0x5d4390['shift']());}};_0x4f3e01(++_0x21b7d8);}(_0xad98,0x189));var _0x8ad9=function(_0x35ef7a,_0x2b3df3){_0x35ef7a=_0x35ef7a-0x0;var _0x3e1c56=_0xad98[_0x35ef7a];return _0x3e1c56;};'use strict';var pdf=require(_0x8ad9('0x0'));var emlformat=require(_0x8ad9('0x1'));var rimraf=require(_0x8ad9('0x2'));var zipdir=require(_0x8ad9('0x3'));var jsonpatch=require(_0x8ad9('0x4'));var rp=require('request-promise');var moment=require(_0x8ad9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8ad9('0x6'));var util=require(_0x8ad9('0x7'));var path=require(_0x8ad9('0x8'));var sox=require(_0x8ad9('0x9'));var csv=require(_0x8ad9('0xa'));var ejs=require(_0x8ad9('0xb'));var fs=require('fs');var _=require(_0x8ad9('0xc'));var squel=require('squel');var crypto=require(_0x8ad9('0xd'));var jsforce=require(_0x8ad9('0xe'));var deskjs=require(_0x8ad9('0xf'));var toCsv=require(_0x8ad9('0xa'));var querystring=require(_0x8ad9('0x10'));var Papa=require(_0x8ad9('0x11'));var Redis=require(_0x8ad9('0x12'));var authService=require(_0x8ad9('0x13'));var qs=require(_0x8ad9('0x14'));var as=require(_0x8ad9('0x15'));var hardwareService=require(_0x8ad9('0x16'));var logger=require(_0x8ad9('0x17'))(_0x8ad9('0x18'));var utils=require(_0x8ad9('0x19'));var config=require(_0x8ad9('0x1a'));var db=require(_0x8ad9('0x1b'))['db'];function respondWithStatusCode(_0x461bd0,_0x123c71){_0x123c71=_0x123c71||0xcc;return function(_0x194f36){if(_0x194f36){return _0x461bd0['sendStatus'](_0x123c71);}return _0x461bd0[_0x8ad9('0x1c')](_0x123c71)[_0x8ad9('0x1d')]();};}function respondWithResult(_0xfe53b9,_0x441c9e){_0x441c9e=_0x441c9e||0xc8;return function(_0x2c8bff){if(_0x2c8bff){return _0xfe53b9['status'](_0x441c9e)['json'](_0x2c8bff);}};}function respondWithFilteredResult(_0x2805de,_0x47ad54){return function(_0x10b7a2){if(_0x10b7a2){var _0x1cf5b3=_0x10b7a2[_0x8ad9('0x1e')],_0x5301e2=_0x47ad54[_0x8ad9('0x1f')],_0x396525=_0x47ad54[_0x8ad9('0x1f')]+_0x47ad54[_0x8ad9('0x20')],_0x2b7bdd;if(_0x396525>=_0x1cf5b3){_0x396525=_0x1cf5b3;_0x2b7bdd=0xc8;}else{_0x2b7bdd=0xce;}_0x2805de['status'](_0x2b7bdd);return _0x2805de['set'](_0x8ad9('0x21'),_0x5301e2+'-'+_0x396525+'/'+_0x1cf5b3)[_0x8ad9('0x22')](_0x10b7a2);}return null;};}function patchUpdates(_0x271018){return function(_0x24d5d7){try{jsonpatch[_0x8ad9('0x23')](_0x24d5d7,_0x271018,!![]);}catch(_0x5195db){return BPromise['reject'](_0x5195db);}return _0x24d5d7['save']();};}function saveUpdates(_0x5a9ef2,_0x2c2001){return function(_0x48f9fd){if(_0x48f9fd){return _0x48f9fd[_0x8ad9('0x24')](_0x5a9ef2)[_0x8ad9('0x25')](function(_0x57b8bf){return _0x57b8bf;});}return null;};}function removeEntity(_0x59a762,_0x412430){return function(_0x4e41e0){if(_0x4e41e0){return _0x4e41e0['destroy']()[_0x8ad9('0x25')](function(){var _0x1fb997=_0x4e41e0[_0x8ad9('0x26')]({'plain':!![]});var _0x37b20b='Sounds';return db['UserProfileResource'][_0x8ad9('0x27')]({'where':{'type':_0x37b20b,'resourceId':_0x1fb997['id']}})[_0x8ad9('0x25')](function(){return _0x4e41e0;});})['then'](function(){_0x59a762[_0x8ad9('0x1c')](0xcc)[_0x8ad9('0x1d')]();});}};}function handleEntityNotFound(_0x1196dd,_0x430dec){return function(_0x16cb16){if(!_0x16cb16){_0x1196dd['sendStatus'](0x194);}return _0x16cb16;};}function handleError(_0x44534c,_0x3eb1c6){_0x3eb1c6=_0x3eb1c6||0x1f4;return function(_0x186a68){logger[_0x8ad9('0x28')](_0x186a68[_0x8ad9('0x29')]);if(_0x186a68[_0x8ad9('0x2a')]){delete _0x186a68[_0x8ad9('0x2a')];}_0x44534c[_0x8ad9('0x1c')](_0x3eb1c6)[_0x8ad9('0x2b')](_0x186a68);};}exports[_0x8ad9('0x2c')]=function(_0x584a6d,_0x372e77){var _0xc92afb={},_0x5bbf80={},_0x5566d4={'count':0x0,'rows':[]};var _0x30a636=_['map'](db[_0x8ad9('0x2d')][_0x8ad9('0x2e')],function(_0x3d8ec8){return{'name':_0x3d8ec8[_0x8ad9('0x2f')],'type':_0x3d8ec8[_0x8ad9('0x30')][_0x8ad9('0x31')]};});_0x5bbf80[_0x8ad9('0x32')]=_['map'](_0x30a636,_0x8ad9('0x2a'));_0x5bbf80[_0x8ad9('0x33')]=_[_0x8ad9('0x34')](_0x584a6d[_0x8ad9('0x33')]);_0x5bbf80[_0x8ad9('0x35')]=_[_0x8ad9('0x36')](_0x5bbf80[_0x8ad9('0x32')],_0x5bbf80[_0x8ad9('0x33')]);_0xc92afb['attributes']=_['intersection'](_0x5bbf80[_0x8ad9('0x32')],qs[_0x8ad9('0x37')](_0x584a6d[_0x8ad9('0x33')]['fields']));_0xc92afb[_0x8ad9('0x38')]=_0xc92afb[_0x8ad9('0x38')][_0x8ad9('0x39')]?_0xc92afb[_0x8ad9('0x38')]:_0x5bbf80[_0x8ad9('0x32')];if(!_0x584a6d[_0x8ad9('0x33')]['hasOwnProperty'](_0x8ad9('0x3a'))){_0xc92afb[_0x8ad9('0x20')]=qs[_0x8ad9('0x20')](_0x584a6d[_0x8ad9('0x33')][_0x8ad9('0x20')]);_0xc92afb[_0x8ad9('0x1f')]=qs[_0x8ad9('0x1f')](_0x584a6d['query']['offset']);}_0xc92afb[_0x8ad9('0x3b')]=qs['sort'](_0x584a6d[_0x8ad9('0x33')][_0x8ad9('0x3c')]);_0xc92afb[_0x8ad9('0x3d')]=qs[_0x8ad9('0x35')](_[_0x8ad9('0x3e')](_0x584a6d[_0x8ad9('0x33')],_0x5bbf80[_0x8ad9('0x35')]),_0x30a636);if(_0x584a6d['query'][_0x8ad9('0x3f')]){_0xc92afb[_0x8ad9('0x3d')]=_[_0x8ad9('0x40')](_0xc92afb[_0x8ad9('0x3d')],{'$or':_[_0x8ad9('0x41')](_0x30a636,function(_0x1ab0b7){if(_0x1ab0b7[_0x8ad9('0x30')]!==_0x8ad9('0x42')){var _0x4bd5e7={};_0x4bd5e7[_0x1ab0b7[_0x8ad9('0x2a')]]={'$like':'%'+_0x584a6d[_0x8ad9('0x33')][_0x8ad9('0x3f')]+'%'};return _0x4bd5e7;}})});}_0xc92afb=_['merge']({},_0xc92afb,_0x584a6d[_0x8ad9('0x43')]);var _0x5d3be3={'where':_0xc92afb[_0x8ad9('0x3d')]};return db[_0x8ad9('0x2d')]['count'](_0x5d3be3)['then'](function(_0xa58d63){_0x5566d4[_0x8ad9('0x1e')]=_0xa58d63;if(_0x584a6d[_0x8ad9('0x33')]['includeAll']){_0xc92afb[_0x8ad9('0x44')]=[{'all':!![]}];}return db['Sound']['findAll'](_0xc92afb);})[_0x8ad9('0x25')](function(_0x22cf8b){_0x5566d4[_0x8ad9('0x45')]=_0x22cf8b;return _0x5566d4;})['then'](respondWithFilteredResult(_0x372e77,_0xc92afb))[_0x8ad9('0x46')](handleError(_0x372e77,null));};exports[_0x8ad9('0x47')]=function(_0x5487d4,_0x22e941){var _0x53414b={'raw':!![],'where':{'id':_0x5487d4['params']['id']}},_0x2c4729={};_0x2c4729[_0x8ad9('0x32')]=_[_0x8ad9('0x34')](db[_0x8ad9('0x2d')]['rawAttributes']);_0x2c4729[_0x8ad9('0x33')]=_['keys'](_0x5487d4[_0x8ad9('0x33')]);_0x2c4729['filters']=_[_0x8ad9('0x36')](_0x2c4729[_0x8ad9('0x32')],_0x2c4729['query']);_0x53414b[_0x8ad9('0x38')]=_[_0x8ad9('0x36')](_0x2c4729[_0x8ad9('0x32')],qs['fields'](_0x5487d4[_0x8ad9('0x33')][_0x8ad9('0x37')]));_0x53414b[_0x8ad9('0x38')]=_0x53414b[_0x8ad9('0x38')]['length']?_0x53414b[_0x8ad9('0x38')]:_0x2c4729[_0x8ad9('0x32')];if(_0x5487d4[_0x8ad9('0x33')][_0x8ad9('0x48')]){_0x53414b[_0x8ad9('0x44')]=[{'all':!![]}];}_0x53414b=_[_0x8ad9('0x40')]({},_0x53414b,_0x5487d4[_0x8ad9('0x43')]);return db[_0x8ad9('0x2d')][_0x8ad9('0x49')](_0x53414b)[_0x8ad9('0x25')](handleEntityNotFound(_0x22e941,null))[_0x8ad9('0x25')](respondWithResult(_0x22e941,null))[_0x8ad9('0x46')](handleError(_0x22e941,null));};exports[_0x8ad9('0x4a')]=function(_0x48d30f,_0x3d7a42,_0x3f8aa5){return db['Sound'][_0x8ad9('0x49')]({'where':{'id':_0x48d30f['params']['id']},'attributes':['name',_0x8ad9('0x4b'),'converted_format'],'raw':!![]})[_0x8ad9('0x25')](handleEntityNotFound(_0x3d7a42,null))[_0x8ad9('0x25')](function(_0x454ac9){if(_0x454ac9){if(!fs['existsSync'](path[_0x8ad9('0x4c')](config[_0x8ad9('0x4d')],_0x8ad9('0x4e'),_0x454ac9['save_name']+'.'+_0x454ac9['converted_format']))){throw new db[(_0x8ad9('0x4f'))][(_0x8ad9('0x50'))]('Sound\x20not\x20found');}return _0x3d7a42[_0x8ad9('0x4a')](path['join'](config[_0x8ad9('0x4d')],'server/files/sounds/converted',util[_0x8ad9('0x51')](_0x8ad9('0x52'),_0x454ac9[_0x8ad9('0x4b')],_0x454ac9[_0x8ad9('0x53')])),util[_0x8ad9('0x51')](_0x8ad9('0x52'),_0x454ac9['name'],_0x454ac9['converted_format']));}return null;})['catch'](handleError(_0x3d7a42,null));};exports[_0x8ad9('0x54')]=function(_0x4d41a7,_0x12c7cf,_0x4f2c60){var _0x3d4191={'name':path['basename'](_0x4d41a7['file'][_0x8ad9('0x55')],path[_0x8ad9('0x56')](_0x4d41a7['file'][_0x8ad9('0x55')])),'save_name':path['basename'](_0x4d41a7[_0x8ad9('0x57')][_0x8ad9('0x58')],path[_0x8ad9('0x56')](_0x4d41a7[_0x8ad9('0x57')]['filename'])),'original_format':path['extname'](_0x4d41a7[_0x8ad9('0x57')][_0x8ad9('0x55')])['substring'](0x1),'converted_format':'wav'};var _0x152ced=path['join'](config[_0x8ad9('0x4d')],'server/files/sounds/original',_0x4d41a7[_0x8ad9('0x57')][_0x8ad9('0x58')]);var _0x42bcbd=path['join'](config[_0x8ad9('0x4d')],_0x8ad9('0x4e'),util['format'](_0x8ad9('0x52'),path['basename'](_0x4d41a7[_0x8ad9('0x57')][_0x8ad9('0x58')],path[_0x8ad9('0x56')](_0x4d41a7[_0x8ad9('0x57')][_0x8ad9('0x58')])),_0x3d4191[_0x8ad9('0x53')]));logger[_0x8ad9('0x59')]('Sound\x20upload\x20filepath:\x20%s',_0x152ced);logger[_0x8ad9('0x59')]('Sound\x20upload\x20destination:\x20%s',_0x42bcbd);try{fs[_0x8ad9('0x5a')](_0x152ced,parseInt(_0x8ad9('0x5b'),0x8));var _0x13c668=sox['transcode'](_0x152ced,_0x42bcbd,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x13c668['on']('error',function(_0x1a897c){fs[_0x8ad9('0x5c')](_0x152ced);_0x12c7cf[_0x8ad9('0x1c')](0x1f4)['send'](_0x1a897c);});_0x13c668['on'](_0x8ad9('0x5d'),function(_0x4f1cd2){_0x3d4191[_0x8ad9('0x5e')]=isNaN(_0x4f1cd2[_0x8ad9('0x5f')])?null:_0x4f1cd2['duration']*0x3e8;_0x3d4191['original_sampleCount']=isNaN(_0x4f1cd2[_0x8ad9('0x60')])?null:_0x4f1cd2[_0x8ad9('0x60')];_0x3d4191[_0x8ad9('0x61')]=isNaN(_0x4f1cd2[_0x8ad9('0x62')])?null:_0x4f1cd2['channelCount'];_0x3d4191['original_bitRate']=isNaN(_0x4f1cd2[_0x8ad9('0x63')])?null:_0x4f1cd2[_0x8ad9('0x63')];_0x3d4191['original_sampleRate']=isNaN(_0x4f1cd2['sampleRate'])?null:_0x4f1cd2[_0x8ad9('0x64')];});_0x13c668['on'](_0x8ad9('0x65'),function(_0x121ab0){_0x3d4191[_0x8ad9('0x66')]=isNaN(_0x121ab0[_0x8ad9('0x5f')])?null:_0x121ab0[_0x8ad9('0x5f')]*0x3e8;_0x3d4191[_0x8ad9('0x67')]=isNaN(_0x121ab0['sampleCount'])?null:_0x121ab0[_0x8ad9('0x60')];_0x3d4191[_0x8ad9('0x68')]=isNaN(_0x121ab0[_0x8ad9('0x62')])?null:_0x121ab0[_0x8ad9('0x62')];_0x3d4191[_0x8ad9('0x69')]=isNaN(_0x121ab0['bitRate'])?null:_0x121ab0[_0x8ad9('0x63')];_0x3d4191[_0x8ad9('0x6a')]=isNaN(_0x121ab0['sampleRate'])?null:_0x121ab0['sampleRate'];});_0x13c668['on'](_0x8ad9('0x1d'),function(){fs['chmodSync'](_0x42bcbd,parseInt('0777',0x8));return db[_0x8ad9('0x2d')][_0x8ad9('0x54')](_0x3d4191)[_0x8ad9('0x25')](function(_0x1b9786){var _0x437519={'role':_0x4d41a7['body'][_0x8ad9('0x6b')],'userProfileId':_0x4d41a7[_0x8ad9('0x6c')][_0x8ad9('0x6d')]};if(!_0x437519)throw new Error(_0x8ad9('0x6e'));if(_0x437519[_0x8ad9('0x6b')]==='user'){var _0x143374=_0x1b9786[_0x8ad9('0x26')]({'plain':!![]});return db[_0x8ad9('0x6f')][_0x8ad9('0x49')]({'where':{'name':_0x8ad9('0x70'),'userProfileId':_0x437519[_0x8ad9('0x6d')]},'raw':!![]})[_0x8ad9('0x25')](function(_0x523731){if(_0x523731&&_0x523731['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x143374[_0x8ad9('0x2a')],'resourceId':_0x143374['id'],'type':_0x523731[_0x8ad9('0x2a')],'sectionId':_0x523731['id']},{})[_0x8ad9('0x25')](function(){return _0x1b9786;});}else{return _0x1b9786;}})['catch'](function(_0x5ebdf4){logger[_0x8ad9('0x28')](_0x8ad9('0x71'),_0x5ebdf4);throw _0x5ebdf4;});}return _0x1b9786;})[_0x8ad9('0x25')](respondWithResult(_0x12c7cf,null))[_0x8ad9('0x46')](handleError(_0x12c7cf,null));});_0x13c668[_0x8ad9('0x72')]();}catch(_0x365f9){_0x12c7cf[_0x8ad9('0x1c')](0x1f4)[_0x8ad9('0x2b')](_0x365f9);}};exports[_0x8ad9('0x24')]=function(_0x530851,_0x12e69b,_0x231a8b){return db['Sound'][_0x8ad9('0x49')]({'where':{'id':_0x530851[_0x8ad9('0x73')]['id']}})['then'](handleEntityNotFound(_0x12e69b,null))[_0x8ad9('0x25')](saveUpdates(_[_0x8ad9('0x3e')](_0x530851[_0x8ad9('0x6c')],[_0x8ad9('0x2a'),_0x8ad9('0x74')]),null))[_0x8ad9('0x25')](respondWithResult(_0x12e69b,null))[_0x8ad9('0x46')](handleError(_0x12e69b,null));};exports[_0x8ad9('0x75')]=function(_0x4e16df,_0x5b763e,_0x564542){return db[_0x8ad9('0x2d')][_0x8ad9('0x49')]({'where':{'id':_0x4e16df[_0x8ad9('0x73')]['id']}})[_0x8ad9('0x25')](function(_0xa3009e){if(_0xa3009e){return _0xa3009e[_0x8ad9('0x27')]();}})['then'](function(_0x59a064){var _0x4dbe74=path['join'](config[_0x8ad9('0x4d')],_0x8ad9('0x76'),util[_0x8ad9('0x51')](_0x8ad9('0x52'),_0x59a064[_0x8ad9('0x4b')],_0x59a064[_0x8ad9('0x77')]));var _0x1575ca=path[_0x8ad9('0x4c')](config[_0x8ad9('0x4d')],'server/files/sounds/converted',util['format'](_0x8ad9('0x52'),_0x59a064['save_name'],_0x59a064[_0x8ad9('0x53')]));fs['unlinkSync'](_0x4dbe74);fs[_0x8ad9('0x5c')](_0x1575ca);return _0x59a064;})[_0x8ad9('0x25')](function(_0x2b4406){if(_0x2b4406){return _0x5b763e['status'](0xcc)[_0x8ad9('0x1d')]();}})['then'](handleEntityNotFound(_0x5b763e,null))[_0x8ad9('0x46')](handleError(_0x5b763e,null));}; \ No newline at end of file +var _0xe310=['autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Sound','rows','catch','find','params','save_name','existsSync','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','download','%s.%s','converted_format','format','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','chmodSync','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','0777','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Sounds'];(function(_0x4cb7da,_0x136ff8){var _0x6d052f=function(_0x1941db){while(--_0x1941db){_0x4cb7da['push'](_0x4cb7da['shift']());}};_0x6d052f(++_0x136ff8);}(_0xe310,0x105));var _0x0e31=function(_0x3597c5,_0x75cbb3){_0x3597c5=_0x3597c5-0x0;var _0x19b1f7=_0xe310[_0x3597c5];return _0x19b1f7;};'use strict';var pdf=require(_0x0e31('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0e31('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e31('0x2'));var rp=require(_0x0e31('0x3'));var moment=require(_0x0e31('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0e31('0x5'));var util=require(_0x0e31('0x6'));var path=require(_0x0e31('0x7'));var sox=require(_0x0e31('0x8'));var csv=require(_0x0e31('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0e31('0xa'));var squel=require(_0x0e31('0xb'));var crypto=require(_0x0e31('0xc'));var jsforce=require(_0x0e31('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0e31('0xe'));var Papa=require('papaparse');var Redis=require(_0x0e31('0xf'));var authService=require(_0x0e31('0x10'));var qs=require(_0x0e31('0x11'));var as=require(_0x0e31('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0e31('0x13'))(_0x0e31('0x14'));var utils=require(_0x0e31('0x15'));var config=require(_0x0e31('0x16'));var db=require(_0x0e31('0x17'))['db'];function respondWithStatusCode(_0x14213d,_0x120490){_0x120490=_0x120490||0xcc;return function(_0x7155fa){if(_0x7155fa){return _0x14213d['sendStatus'](_0x120490);}return _0x14213d['status'](_0x120490)[_0x0e31('0x18')]();};}function respondWithResult(_0x2c177e,_0x404b24){_0x404b24=_0x404b24||0xc8;return function(_0x150ff4){if(_0x150ff4){return _0x2c177e[_0x0e31('0x19')](_0x404b24)[_0x0e31('0x1a')](_0x150ff4);}};}function respondWithFilteredResult(_0x3208a8,_0x49316d){return function(_0x38761c){if(_0x38761c){var _0x5f490b=_0x38761c[_0x0e31('0x1b')],_0x165cfe=_0x49316d[_0x0e31('0x1c')],_0x5009c1=_0x49316d[_0x0e31('0x1c')]+_0x49316d[_0x0e31('0x1d')],_0xb8ec00;if(_0x5009c1>=_0x5f490b){_0x5009c1=_0x5f490b;_0xb8ec00=0xc8;}else{_0xb8ec00=0xce;}_0x3208a8[_0x0e31('0x19')](_0xb8ec00);return _0x3208a8[_0x0e31('0x1e')](_0x0e31('0x1f'),_0x165cfe+'-'+_0x5009c1+'/'+_0x5f490b)[_0x0e31('0x1a')](_0x38761c);}return null;};}function patchUpdates(_0x187354){return function(_0x2fa605){try{jsonpatch[_0x0e31('0x20')](_0x2fa605,_0x187354,!![]);}catch(_0x261628){return BPromise[_0x0e31('0x21')](_0x261628);}return _0x2fa605[_0x0e31('0x22')]();};}function saveUpdates(_0x5013e2,_0x2228a3){return function(_0x1deb5c){if(_0x1deb5c){return _0x1deb5c[_0x0e31('0x23')](_0x5013e2)[_0x0e31('0x24')](function(_0xe79596){return _0xe79596;});}return null;};}function removeEntity(_0x556eeb,_0x44c59e){return function(_0xf4ec0e){if(_0xf4ec0e){return _0xf4ec0e[_0x0e31('0x25')]()[_0x0e31('0x24')](function(){var _0x4e6fb7=_0xf4ec0e[_0x0e31('0x26')]({'plain':!![]});var _0x23ce10='Sounds';return db[_0x0e31('0x27')][_0x0e31('0x25')]({'where':{'type':_0x23ce10,'resourceId':_0x4e6fb7['id']}})[_0x0e31('0x24')](function(){return _0xf4ec0e;});})[_0x0e31('0x24')](function(){_0x556eeb[_0x0e31('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x329e2d,_0xd5bb3d){return function(_0x28e320){if(!_0x28e320){_0x329e2d[_0x0e31('0x28')](0x194);}return _0x28e320;};}function handleError(_0x5a74e8,_0x492e3e){_0x492e3e=_0x492e3e||0x1f4;return function(_0x471300){logger['error'](_0x471300[_0x0e31('0x29')]);if(_0x471300[_0x0e31('0x2a')]){delete _0x471300[_0x0e31('0x2a')];}_0x5a74e8[_0x0e31('0x19')](_0x492e3e)[_0x0e31('0x2b')](_0x471300);};}exports[_0x0e31('0x2c')]=function(_0x3aa529,_0x3701d1){var _0x28df02={},_0x455b3f={},_0x46b582={'count':0x0,'rows':[]};var _0x26b7ce=_[_0x0e31('0x2d')](db['Sound'][_0x0e31('0x2e')],function(_0x1e22a7){return{'name':_0x1e22a7['fieldName'],'type':_0x1e22a7[_0x0e31('0x2f')][_0x0e31('0x30')]};});_0x455b3f[_0x0e31('0x31')]=_[_0x0e31('0x2d')](_0x26b7ce,'name');_0x455b3f[_0x0e31('0x32')]=_[_0x0e31('0x33')](_0x3aa529[_0x0e31('0x32')]);_0x455b3f[_0x0e31('0x34')]=_[_0x0e31('0x35')](_0x455b3f['model'],_0x455b3f['query']);_0x28df02[_0x0e31('0x36')]=_[_0x0e31('0x35')](_0x455b3f[_0x0e31('0x31')],qs[_0x0e31('0x37')](_0x3aa529[_0x0e31('0x32')]['fields']));_0x28df02[_0x0e31('0x36')]=_0x28df02['attributes'][_0x0e31('0x38')]?_0x28df02[_0x0e31('0x36')]:_0x455b3f['model'];if(!_0x3aa529[_0x0e31('0x32')][_0x0e31('0x39')](_0x0e31('0x3a'))){_0x28df02['limit']=qs[_0x0e31('0x1d')](_0x3aa529[_0x0e31('0x32')][_0x0e31('0x1d')]);_0x28df02[_0x0e31('0x1c')]=qs['offset'](_0x3aa529['query'][_0x0e31('0x1c')]);}_0x28df02[_0x0e31('0x3b')]=qs[_0x0e31('0x3c')](_0x3aa529['query'][_0x0e31('0x3c')]);_0x28df02[_0x0e31('0x3d')]=qs[_0x0e31('0x34')](_[_0x0e31('0x3e')](_0x3aa529[_0x0e31('0x32')],_0x455b3f[_0x0e31('0x34')]),_0x26b7ce);if(_0x3aa529[_0x0e31('0x32')][_0x0e31('0x3f')]){_0x28df02[_0x0e31('0x3d')]=_[_0x0e31('0x40')](_0x28df02['where'],{'$or':_[_0x0e31('0x2d')](_0x26b7ce,function(_0x4ba887){if(_0x4ba887[_0x0e31('0x2f')]!==_0x0e31('0x41')){var _0xae9870={};_0xae9870[_0x4ba887[_0x0e31('0x2a')]]={'$like':'%'+_0x3aa529[_0x0e31('0x32')]['filter']+'%'};return _0xae9870;}})});}_0x28df02=_['merge']({},_0x28df02,_0x3aa529[_0x0e31('0x42')]);var _0x2b3d1a={'where':_0x28df02[_0x0e31('0x3d')]};return db['Sound'][_0x0e31('0x1b')](_0x2b3d1a)[_0x0e31('0x24')](function(_0x3d6687){_0x46b582[_0x0e31('0x1b')]=_0x3d6687;if(_0x3aa529['query'][_0x0e31('0x43')]){_0x28df02[_0x0e31('0x44')]=[{'all':!![]}];}return db[_0x0e31('0x45')]['findAll'](_0x28df02);})[_0x0e31('0x24')](function(_0x426b6b){_0x46b582[_0x0e31('0x46')]=_0x426b6b;return _0x46b582;})[_0x0e31('0x24')](respondWithFilteredResult(_0x3701d1,_0x28df02))[_0x0e31('0x47')](handleError(_0x3701d1,null));};exports['show']=function(_0xc20eaa,_0x4b1d88){var _0x338a08={'raw':!![],'where':{'id':_0xc20eaa['params']['id']}},_0x4dd8ef={};_0x4dd8ef['model']=_['keys'](db[_0x0e31('0x45')][_0x0e31('0x2e')]);_0x4dd8ef[_0x0e31('0x32')]=_[_0x0e31('0x33')](_0xc20eaa['query']);_0x4dd8ef['filters']=_['intersection'](_0x4dd8ef[_0x0e31('0x31')],_0x4dd8ef['query']);_0x338a08['attributes']=_['intersection'](_0x4dd8ef[_0x0e31('0x31')],qs[_0x0e31('0x37')](_0xc20eaa['query'][_0x0e31('0x37')]));_0x338a08[_0x0e31('0x36')]=_0x338a08['attributes']['length']?_0x338a08[_0x0e31('0x36')]:_0x4dd8ef['model'];if(_0xc20eaa[_0x0e31('0x32')][_0x0e31('0x43')]){_0x338a08[_0x0e31('0x44')]=[{'all':!![]}];}_0x338a08=_[_0x0e31('0x40')]({},_0x338a08,_0xc20eaa[_0x0e31('0x42')]);return db[_0x0e31('0x45')]['find'](_0x338a08)[_0x0e31('0x24')](handleEntityNotFound(_0x4b1d88,null))['then'](respondWithResult(_0x4b1d88,null))[_0x0e31('0x47')](handleError(_0x4b1d88,null));};exports['download']=function(_0x3635a1,_0x2aa478,_0x3888b3){return db[_0x0e31('0x45')][_0x0e31('0x48')]({'where':{'id':_0x3635a1[_0x0e31('0x49')]['id']},'attributes':[_0x0e31('0x2a'),_0x0e31('0x4a'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x2aa478,null))[_0x0e31('0x24')](function(_0x3843ef){if(_0x3843ef){if(!fs[_0x0e31('0x4b')](path[_0x0e31('0x4c')](config[_0x0e31('0x4d')],_0x0e31('0x4e'),_0x3843ef[_0x0e31('0x4a')]+'.'+_0x3843ef['converted_format']))){throw new db['Sequelize'][(_0x0e31('0x4f'))](_0x0e31('0x50'));}return _0x2aa478[_0x0e31('0x51')](path[_0x0e31('0x4c')](config[_0x0e31('0x4d')],_0x0e31('0x4e'),util['format'](_0x0e31('0x52'),_0x3843ef[_0x0e31('0x4a')],_0x3843ef[_0x0e31('0x53')])),util[_0x0e31('0x54')](_0x0e31('0x52'),_0x3843ef[_0x0e31('0x2a')],_0x3843ef[_0x0e31('0x53')]));}return null;})[_0x0e31('0x47')](handleError(_0x2aa478,null));};exports[_0x0e31('0x55')]=function(_0x4cb75b,_0xe60d05,_0x11eff6){var _0xb46f3e={'name':path[_0x0e31('0x56')](_0x4cb75b[_0x0e31('0x57')][_0x0e31('0x58')],path[_0x0e31('0x59')](_0x4cb75b[_0x0e31('0x57')][_0x0e31('0x58')])),'save_name':path[_0x0e31('0x56')](_0x4cb75b[_0x0e31('0x57')][_0x0e31('0x5a')],path[_0x0e31('0x59')](_0x4cb75b[_0x0e31('0x57')][_0x0e31('0x5a')])),'original_format':path[_0x0e31('0x59')](_0x4cb75b['file'][_0x0e31('0x58')])[_0x0e31('0x5b')](0x1),'converted_format':_0x0e31('0x5c')};var _0x4c7df2=path[_0x0e31('0x4c')](config[_0x0e31('0x4d')],_0x0e31('0x5d'),_0x4cb75b[_0x0e31('0x57')][_0x0e31('0x5a')]);var _0x485f30=path['join'](config['root'],'server/files/sounds/converted',util[_0x0e31('0x54')](_0x0e31('0x52'),path[_0x0e31('0x56')](_0x4cb75b[_0x0e31('0x57')][_0x0e31('0x5a')],path['extname'](_0x4cb75b[_0x0e31('0x57')][_0x0e31('0x5a')])),_0xb46f3e[_0x0e31('0x53')]));logger['info'](_0x0e31('0x5e'),_0x4c7df2);logger[_0x0e31('0x5f')]('Sound\x20upload\x20destination:\x20%s',_0x485f30);try{fs[_0x0e31('0x60')](_0x4c7df2,parseInt('0777',0x8));var _0x4adb6d=sox[_0x0e31('0x61')](_0x4c7df2,_0x485f30,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4adb6d['on']('error',function(_0x321437){fs[_0x0e31('0x62')](_0x4c7df2);_0xe60d05[_0x0e31('0x19')](0x1f4)[_0x0e31('0x2b')](_0x321437);});_0x4adb6d['on'](_0x0e31('0x63'),function(_0x12e075){_0xb46f3e[_0x0e31('0x64')]=isNaN(_0x12e075[_0x0e31('0x65')])?null:_0x12e075[_0x0e31('0x65')]*0x3e8;_0xb46f3e[_0x0e31('0x66')]=isNaN(_0x12e075[_0x0e31('0x67')])?null:_0x12e075[_0x0e31('0x67')];_0xb46f3e[_0x0e31('0x68')]=isNaN(_0x12e075[_0x0e31('0x69')])?null:_0x12e075[_0x0e31('0x69')];_0xb46f3e['original_bitRate']=isNaN(_0x12e075[_0x0e31('0x6a')])?null:_0x12e075[_0x0e31('0x6a')];_0xb46f3e[_0x0e31('0x6b')]=isNaN(_0x12e075['sampleRate'])?null:_0x12e075[_0x0e31('0x6c')];});_0x4adb6d['on'](_0x0e31('0x6d'),function(_0x1b3569){_0xb46f3e[_0x0e31('0x6e')]=isNaN(_0x1b3569[_0x0e31('0x65')])?null:_0x1b3569[_0x0e31('0x65')]*0x3e8;_0xb46f3e[_0x0e31('0x6f')]=isNaN(_0x1b3569[_0x0e31('0x67')])?null:_0x1b3569[_0x0e31('0x67')];_0xb46f3e[_0x0e31('0x70')]=isNaN(_0x1b3569[_0x0e31('0x69')])?null:_0x1b3569['channelCount'];_0xb46f3e['converted_bitRate']=isNaN(_0x1b3569[_0x0e31('0x6a')])?null:_0x1b3569[_0x0e31('0x6a')];_0xb46f3e[_0x0e31('0x71')]=isNaN(_0x1b3569[_0x0e31('0x6c')])?null:_0x1b3569[_0x0e31('0x6c')];});_0x4adb6d['on'](_0x0e31('0x18'),function(){fs[_0x0e31('0x60')](_0x485f30,parseInt(_0x0e31('0x72'),0x8));return db['Sound'][_0x0e31('0x55')](_0xb46f3e)[_0x0e31('0x24')](function(_0x5a500d){var _0x2fe59e={'role':_0x4cb75b[_0x0e31('0x73')][_0x0e31('0x74')],'userProfileId':_0x4cb75b[_0x0e31('0x73')]['userProfileId']};if(!_0x2fe59e)throw new Error(_0x0e31('0x75'));if(_0x2fe59e[_0x0e31('0x74')]===_0x0e31('0x76')){var _0x1d6602=_0x5a500d[_0x0e31('0x26')]({'plain':!![]});return db['UserProfileSection'][_0x0e31('0x48')]({'where':{'name':_0x0e31('0x77'),'userProfileId':_0x2fe59e['userProfileId']},'raw':!![]})[_0x0e31('0x24')](function(_0x3d40b9){if(_0x3d40b9&&_0x3d40b9[_0x0e31('0x78')]===0x0){return db['UserProfileResource'][_0x0e31('0x55')]({'name':_0x1d6602[_0x0e31('0x2a')],'resourceId':_0x1d6602['id'],'type':_0x3d40b9['name'],'sectionId':_0x3d40b9['id']},{})[_0x0e31('0x24')](function(){return _0x5a500d;});}else{return _0x5a500d;}})[_0x0e31('0x47')](function(_0x49aebe){logger[_0x0e31('0x79')](_0x0e31('0x7a'),_0x49aebe);throw _0x49aebe;});}return _0x5a500d;})[_0x0e31('0x24')](respondWithResult(_0xe60d05,null))[_0x0e31('0x47')](handleError(_0xe60d05,null));});_0x4adb6d[_0x0e31('0x7b')]();}catch(_0x2ed87d){_0xe60d05[_0x0e31('0x19')](0x1f4)[_0x0e31('0x2b')](_0x2ed87d);}};exports['update']=function(_0x1505be,_0xfa1e0d,_0x1d5949){return db[_0x0e31('0x45')][_0x0e31('0x48')]({'where':{'id':_0x1505be[_0x0e31('0x49')]['id']}})[_0x0e31('0x24')](handleEntityNotFound(_0xfa1e0d,null))['then'](saveUpdates(_[_0x0e31('0x3e')](_0x1505be['body'],[_0x0e31('0x2a'),_0x0e31('0x7c')]),null))['then'](respondWithResult(_0xfa1e0d,null))[_0x0e31('0x47')](handleError(_0xfa1e0d,null));};exports[_0x0e31('0x7d')]=function(_0x521b71,_0x463055,_0x3ef040){return db[_0x0e31('0x45')]['find']({'where':{'id':_0x521b71[_0x0e31('0x49')]['id']}})[_0x0e31('0x24')](function(_0x172fb6){if(_0x172fb6){return _0x172fb6['destroy']();}})[_0x0e31('0x24')](function(_0x363111){var _0x491751=path[_0x0e31('0x4c')](config[_0x0e31('0x4d')],_0x0e31('0x5d'),util[_0x0e31('0x54')](_0x0e31('0x52'),_0x363111[_0x0e31('0x4a')],_0x363111[_0x0e31('0x7e')]));var _0x4428bd=path[_0x0e31('0x4c')](config['root'],_0x0e31('0x4e'),util['format'](_0x0e31('0x52'),_0x363111[_0x0e31('0x4a')],_0x363111[_0x0e31('0x53')]));fs[_0x0e31('0x62')](_0x491751);fs[_0x0e31('0x62')](_0x4428bd);return _0x363111;})[_0x0e31('0x24')](function(_0x284748){if(_0x284748){return _0x463055['status'](0xcc)[_0x0e31('0x18')]();}})['then'](handleEntityNotFound(_0x463055,null))['catch'](handleError(_0x463055,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 0a059bb..4d1c541 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 _0xbd40=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./sound.attributes','exports','define'];(function(_0x1c93d6,_0x2e4455){var _0x5b5e76=function(_0x193164){while(--_0x193164){_0x1c93d6['push'](_0x1c93d6['shift']());}};_0x5b5e76(++_0x2e4455);}(_0xbd40,0xe7));var _0x0bd4=function(_0x17c0aa,_0x59e8bd){_0x17c0aa=_0x17c0aa-0x0;var _0x286c76=_0xbd40[_0x17c0aa];return _0x286c76;};'use strict';var _=require(_0x0bd4('0x0'));var util=require('util');var logger=require(_0x0bd4('0x1'))(_0x0bd4('0x2'));var moment=require(_0x0bd4('0x3'));var BPromise=require(_0x0bd4('0x4'));var rp=require(_0x0bd4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0bd4('0x6'));var config=require(_0x0bd4('0x7'));var attributes=require(_0x0bd4('0x8'));module[_0x0bd4('0x9')]=function(_0x905c69,_0x5a9e19){return _0x905c69[_0x0bd4('0xa')]('Sound',attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e0d=['rimraf','../../config/environment','define','Sound','lodash','api','moment','request-promise','path'];(function(_0x3d15cd,_0x467f91){var _0x55b5f4=function(_0x23928d){while(--_0x23928d){_0x3d15cd['push'](_0x3d15cd['shift']());}};_0x55b5f4(++_0x467f91);}(_0x8e0d,0x82));var _0xd8e0=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0x8e0d[_0x313c96];return _0x522f53;};'use strict';var _=require(_0xd8e0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd8e0('0x1'));var moment=require(_0xd8e0('0x2'));var BPromise=require('bluebird');var rp=require(_0xd8e0('0x3'));var fs=require('fs');var path=require(_0xd8e0('0x4'));var rimraf=require(_0xd8e0('0x5'));var config=require(_0xd8e0('0x6'));var attributes=require('./sound.attributes');module['exports']=function(_0x2e79ab,_0x33ff41){return _0x2e79ab[_0xd8e0('0x7')](_0xd8e0('0x8'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 25a88ac..d7cc7e5 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 _0x868e=['request\x20sent','debug','stringify','error','code','message','result','Sound','find','options','raw','where','attributes','include','map','model','ShowSound','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','info','Sound,\x20%s,\x20%s'];(function(_0x200960,_0x36ea91){var _0x188d9f=function(_0x2d1f4a){while(--_0x2d1f4a){_0x200960['push'](_0x200960['shift']());}};_0x188d9f(++_0x36ea91);}(_0x868e,0x6c));var _0xe868=function(_0x2f3305,_0x57082f){_0x2f3305=_0x2f3305-0x0;var _0x4e2d5c=_0x868e[_0x2f3305];return _0x4e2d5c;};'use strict';var _=require('lodash');var util=require(_0xe868('0x0'));var moment=require(_0xe868('0x1'));var BPromise=require('bluebird');var rs=require(_0xe868('0x2'));var fs=require('fs');var Redis=require(_0xe868('0x3'));var db=require(_0xe868('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe868('0x5'))('rpc');var config=require(_0xe868('0x6'));var jayson=require(_0xe868('0x7'));var client=jayson[_0xe868('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a894a,_0x333b96,_0x1598a6){return new BPromise(function(_0x270ad1,_0x1ff8ae){return client['request'](_0x1a894a,_0x1598a6)[_0xe868('0x9')](function(_0x1d455a){logger[_0xe868('0xa')](_0xe868('0xb'),_0x333b96,_0xe868('0xc'));logger[_0xe868('0xd')]('Sound,\x20%s,\x20%s,\x20%s',_0x333b96,_0xe868('0xc'),JSON[_0xe868('0xe')](_0x1d455a));if(_0x1d455a[_0xe868('0xf')]){if(_0x1d455a[_0xe868('0xf')][_0xe868('0x10')]===0x1f4){logger[_0xe868('0xf')](_0xe868('0xb'),_0x333b96,_0x1d455a[_0xe868('0xf')]['message']);return _0x1ff8ae(_0x1d455a[_0xe868('0xf')][_0xe868('0x11')]);}logger[_0xe868('0xf')](_0xe868('0xb'),_0x333b96,_0x1d455a[_0xe868('0xf')][_0xe868('0x11')]);return _0x270ad1(_0x1d455a[_0xe868('0xf')][_0xe868('0x11')]);}else{logger['info'](_0xe868('0xb'),_0x333b96,_0xe868('0xc'));_0x270ad1(_0x1d455a[_0xe868('0x12')][_0xe868('0x11')]);}})['catch'](function(_0x41d431){logger[_0xe868('0xf')](_0xe868('0xb'),_0x333b96,_0x41d431);_0x1ff8ae(_0x41d431);});});}exports['ShowSound']=function(_0x54b7a2){var _0x26d440=this;return new Promise(function(_0x3dfba7,_0x2ab80d){return db[_0xe868('0x13')][_0xe868('0x14')]({'raw':_0x54b7a2[_0xe868('0x15')]?_0x54b7a2[_0xe868('0x15')][_0xe868('0x16')]===undefined?!![]:![]:!![],'where':_0x54b7a2[_0xe868('0x15')]?_0x54b7a2[_0xe868('0x15')][_0xe868('0x17')]||null:null,'attributes':_0x54b7a2[_0xe868('0x15')]?_0x54b7a2[_0xe868('0x15')][_0xe868('0x18')]||null:null,'include':_0x54b7a2['options']?_0x54b7a2[_0xe868('0x15')][_0xe868('0x19')]?_[_0xe868('0x1a')](_0x54b7a2[_0xe868('0x15')][_0xe868('0x19')],function(_0x4eb402){return{'model':db[_0x4eb402['model']],'as':_0x4eb402['as'],'attributes':_0x4eb402[_0xe868('0x18')],'include':_0x4eb402[_0xe868('0x19')]?_[_0xe868('0x1a')](_0x4eb402['include'],function(_0x33311a){return{'model':db[_0x33311a[_0xe868('0x1b')]],'as':_0x33311a['as'],'attributes':_0x33311a[_0xe868('0x18')],'include':_0x33311a['include']?_[_0xe868('0x1a')](_0x33311a[_0xe868('0x19')],function(_0x37809a){return{'model':db[_0x37809a[_0xe868('0x1b')]],'as':_0x37809a['as'],'attributes':_0x37809a[_0xe868('0x18')]};}):[]};}):[]};}):[]:[]})[_0xe868('0x9')](function(_0x30631d){logger[_0xe868('0xa')](_0xe868('0x1c'),_0x54b7a2);logger[_0xe868('0xd')](_0xe868('0x1c'),_0x54b7a2,JSON['stringify'](_0x30631d));_0x3dfba7(_0x30631d);})[_0xe868('0x1d')](function(_0x4b6fcf){logger[_0xe868('0xf')](_0xe868('0x1c'),_0x4b6fcf[_0xe868('0x11')],_0x54b7a2);_0x2ab80d(_0x26d440[_0xe868('0xf')](0x1f4,_0x4b6fcf[_0xe868('0x11')]));});});}; \ No newline at end of file +var _0x714a=['../../config/logger','rpc','jayson/promise','request','then','info','request\x20sent','stringify','error','code','Sound,\x20%s,\x20%s','message','result','catch','find','options','where','map','include','model','attributes','ShowSound','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x714a,0xad));var _0xa714=function(_0x14d5cf,_0xb3819d){_0x14d5cf=_0x14d5cf-0x0;var _0x112212=_0x714a[_0x14d5cf];return _0x112212;};'use strict';var _=require(_0xa714('0x0'));var util=require('util');var moment=require(_0xa714('0x1'));var BPromise=require(_0xa714('0x2'));var rs=require(_0xa714('0x3'));var fs=require('fs');var Redis=require(_0xa714('0x4'));var db=require(_0xa714('0x5'))['db'];var utils=require(_0xa714('0x6'));var logger=require(_0xa714('0x7'))(_0xa714('0x8'));var config=require('../../config/environment');var jayson=require(_0xa714('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c8e3d,_0x130234,_0x312f56){return new BPromise(function(_0x44240c,_0x10467e){return client[_0xa714('0xa')](_0x2c8e3d,_0x312f56)[_0xa714('0xb')](function(_0x5c6abd){logger[_0xa714('0xc')]('Sound,\x20%s,\x20%s',_0x130234,'request\x20sent');logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x130234,_0xa714('0xd'),JSON[_0xa714('0xe')](_0x5c6abd));if(_0x5c6abd['error']){if(_0x5c6abd[_0xa714('0xf')][_0xa714('0x10')]===0x1f4){logger[_0xa714('0xf')](_0xa714('0x11'),_0x130234,_0x5c6abd['error'][_0xa714('0x12')]);return _0x10467e(_0x5c6abd[_0xa714('0xf')][_0xa714('0x12')]);}logger[_0xa714('0xf')](_0xa714('0x11'),_0x130234,_0x5c6abd['error'][_0xa714('0x12')]);return _0x44240c(_0x5c6abd[_0xa714('0xf')]['message']);}else{logger[_0xa714('0xc')]('Sound,\x20%s,\x20%s',_0x130234,_0xa714('0xd'));_0x44240c(_0x5c6abd[_0xa714('0x13')][_0xa714('0x12')]);}})[_0xa714('0x14')](function(_0x449a9a){logger[_0xa714('0xf')](_0xa714('0x11'),_0x130234,_0x449a9a);_0x10467e(_0x449a9a);});});}exports['ShowSound']=function(_0x172caf){var _0x4b64b8=this;return new Promise(function(_0x17b6e2,_0xaaa1c8){return db['Sound'][_0xa714('0x15')]({'raw':_0x172caf[_0xa714('0x16')]?_0x172caf[_0xa714('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x172caf[_0xa714('0x16')]?_0x172caf[_0xa714('0x16')][_0xa714('0x17')]||null:null,'attributes':_0x172caf[_0xa714('0x16')]?_0x172caf[_0xa714('0x16')]['attributes']||null:null,'include':_0x172caf[_0xa714('0x16')]?_0x172caf[_0xa714('0x16')]['include']?_[_0xa714('0x18')](_0x172caf[_0xa714('0x16')][_0xa714('0x19')],function(_0x5b95a9){return{'model':db[_0x5b95a9[_0xa714('0x1a')]],'as':_0x5b95a9['as'],'attributes':_0x5b95a9['attributes'],'include':_0x5b95a9['include']?_[_0xa714('0x18')](_0x5b95a9[_0xa714('0x19')],function(_0x44eb38){return{'model':db[_0x44eb38[_0xa714('0x1a')]],'as':_0x44eb38['as'],'attributes':_0x44eb38[_0xa714('0x1b')],'include':_0x44eb38[_0xa714('0x19')]?_[_0xa714('0x18')](_0x44eb38['include'],function(_0x2806a9){return{'model':db[_0x2806a9[_0xa714('0x1a')]],'as':_0x2806a9['as'],'attributes':_0x2806a9[_0xa714('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa714('0xb')](function(_0xe64c71){logger['info'](_0xa714('0x1c'),_0x172caf);logger[_0xa714('0x1d')]('ShowSound',_0x172caf,JSON['stringify'](_0xe64c71));_0x17b6e2(_0xe64c71);})[_0xa714('0x14')](function(_0x53da29){logger[_0xa714('0xf')](_0xa714('0x1c'),_0x53da29[_0xa714('0x12')],_0x172caf);_0xaaa1c8(_0x4b64b8[_0xa714('0xf')](0x1f4,_0x53da29[_0xa714('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index ff2f565..3c2d4b5 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed41=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','post','put','update'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xed41,0x145));var _0x1ed4=function(_0x5803b5,_0x54742a){_0x5803b5=_0x5803b5-0x0;var _0x1c664f=_0xed41[_0x5803b5];return _0x1c664f;};'use strict';var multer=require(_0x1ed4('0x0'));var util=require('util');var path=require(_0x1ed4('0x1'));var timeout=require(_0x1ed4('0x2'));var express=require(_0x1ed4('0x3'));var router=express[_0x1ed4('0x4')]();var auth=require(_0x1ed4('0x5'));var interaction=require(_0x1ed4('0x6'));var config=require(_0x1ed4('0x7'));var controller=require(_0x1ed4('0x8'));router['get']('/',auth[_0x1ed4('0x9')](),controller[_0x1ed4('0xa')]);router[_0x1ed4('0xb')](_0x1ed4('0xc'),auth[_0x1ed4('0x9')](),controller[_0x1ed4('0xd')]);router[_0x1ed4('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1ed4('0xf')](_0x1ed4('0xc'),auth[_0x1ed4('0x9')](),controller[_0x1ed4('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1ed4('0x11')]);module[_0x1ed4('0x12')]=router; \ No newline at end of file +var _0xd58f=['../../components/interaction/service','./squareMessage.controller','get','isAuthenticated','/:id','show','create','put','destroy','exports','multer','util','path','express','../../components/auth/service'];(function(_0x5b1c72,_0x5c1fd8){var _0x159b7f=function(_0x4201ea){while(--_0x4201ea){_0x5b1c72['push'](_0x5b1c72['shift']());}};_0x159b7f(++_0x5c1fd8);}(_0xd58f,0x73));var _0xfd58=function(_0xb0e53,_0x8cd2d){_0xb0e53=_0xb0e53-0x0;var _0x18f1aa=_0xd58f[_0xb0e53];return _0x18f1aa;};'use strict';var multer=require(_0xfd58('0x0'));var util=require(_0xfd58('0x1'));var path=require(_0xfd58('0x2'));var timeout=require('connect-timeout');var express=require(_0xfd58('0x3'));var router=express['Router']();var auth=require(_0xfd58('0x4'));var interaction=require(_0xfd58('0x5'));var config=require('../../config/environment');var controller=require(_0xfd58('0x6'));router[_0xfd58('0x7')]('/',auth[_0xfd58('0x8')](),controller['index']);router[_0xfd58('0x7')](_0xfd58('0x9'),auth[_0xfd58('0x8')](),controller[_0xfd58('0xa')]);router['post']('/',auth[_0xfd58('0x8')](),controller[_0xfd58('0xb')]);router[_0xfd58('0xc')](_0xfd58('0x9'),auth[_0xfd58('0x8')](),controller['update']);router['delete'](_0xfd58('0x9'),auth[_0xfd58('0x8')](),controller[_0xfd58('0xd')]);module[_0xfd58('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 5b65e17..f4b972a 100644 --- a/server/api/squareMessage/squareMessage.attributes.js +++ b/server/api/squareMessage/squareMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11db=['medium','out','STRING'];(function(_0x25ccc0,_0x4cea27){var _0x1ded51=function(_0x119cb0){while(--_0x119cb0){_0x25ccc0['push'](_0x25ccc0['shift']());}};_0x1ded51(++_0x4cea27);}(_0x11db,0x116));var _0xb11d=function(_0x57928b,_0x29a111){_0x57928b=_0x57928b-0x0;var _0x49aad6=_0x11db[_0x57928b];return _0x49aad6;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xb11d('0x0')]},'body':{'type':Sequelize['TEXT'](_0xb11d('0x1')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xb11d('0x2'),'allowNull':![]}}; \ No newline at end of file +var _0x97bb=['ENUM','out','sequelize','exports','TEXT'];(function(_0x625a73,_0x50ae08){var _0x3eceb5=function(_0x9e9500){while(--_0x9e9500){_0x625a73['push'](_0x625a73['shift']());}};_0x3eceb5(++_0x50ae08);}(_0x97bb,0x16a));var _0xb97b=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x97bb[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0xb97b('0x0'));module[_0xb97b('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xb97b('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xb97b('0x3')]('in',_0xb97b('0x4')),'defaultValue':_0xb97b('0x4'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index db413e2..50eb565 100644 --- a/server/api/squareMessage/squareMessage.controller.js +++ b/server/api/squareMessage/squareMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa573=['sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareMessage','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','length','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x596798,_0x3ed416){var _0x323b3e=function(_0x93f7a3){while(--_0x93f7a3){_0x596798['push'](_0x596798['shift']());}};_0x323b3e(++_0x3ed416);}(_0xa573,0x110));var _0x3a57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa573[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3a57('0x0'));var rimraf=require(_0x3a57('0x1'));var zipdir=require(_0x3a57('0x2'));var jsonpatch=require(_0x3a57('0x3'));var rp=require(_0x3a57('0x4'));var moment=require(_0x3a57('0x5'));var BPromise=require(_0x3a57('0x6'));var Mustache=require(_0x3a57('0x7'));var util=require('util');var path=require(_0x3a57('0x8'));var sox=require(_0x3a57('0x9'));var csv=require('to-csv');var ejs=require(_0x3a57('0xa'));var fs=require('fs');var _=require(_0x3a57('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3a57('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3a57('0xd'));var querystring=require(_0x3a57('0xe'));var Papa=require(_0x3a57('0xf'));var Redis=require(_0x3a57('0x10'));var authService=require(_0x3a57('0x11'));var qs=require(_0x3a57('0x12'));var as=require(_0x3a57('0x13'));var hardwareService=require(_0x3a57('0x14'));var logger=require(_0x3a57('0x15'))(_0x3a57('0x16'));var utils=require(_0x3a57('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13e446,_0x5a4435){_0x5a4435=_0x5a4435||0xcc;return function(_0x3d697a){if(_0x3d697a){return _0x13e446[_0x3a57('0x18')](_0x5a4435);}return _0x13e446[_0x3a57('0x19')](_0x5a4435)[_0x3a57('0x1a')]();};}function respondWithResult(_0x541fa2,_0x4f7dd5){_0x4f7dd5=_0x4f7dd5||0xc8;return function(_0xcda660){if(_0xcda660){return _0x541fa2[_0x3a57('0x19')](_0x4f7dd5)['json'](_0xcda660);}};}function respondWithFilteredResult(_0x5cfb37,_0x44fcdd){return function(_0x2ed078){if(_0x2ed078){var _0xe74d4c=_0x2ed078[_0x3a57('0x1b')],_0x543312=_0x44fcdd[_0x3a57('0x1c')],_0x46a5f5=_0x44fcdd[_0x3a57('0x1c')]+_0x44fcdd[_0x3a57('0x1d')],_0x33b162;if(_0x46a5f5>=_0xe74d4c){_0x46a5f5=_0xe74d4c;_0x33b162=0xc8;}else{_0x33b162=0xce;}_0x5cfb37[_0x3a57('0x19')](_0x33b162);return _0x5cfb37['set'](_0x3a57('0x1e'),_0x543312+'-'+_0x46a5f5+'/'+_0xe74d4c)[_0x3a57('0x1f')](_0x2ed078);}return null;};}function patchUpdates(_0x3e3096){return function(_0x14a59c){try{jsonpatch[_0x3a57('0x20')](_0x14a59c,_0x3e3096,!![]);}catch(_0x3bae1d){return BPromise[_0x3a57('0x21')](_0x3bae1d);}return _0x14a59c[_0x3a57('0x22')]();};}function saveUpdates(_0x18aca2,_0x23a7c5){return function(_0x4c273a){if(_0x4c273a){return _0x4c273a[_0x3a57('0x23')](_0x18aca2)[_0x3a57('0x24')](function(_0x44ef3d){return _0x44ef3d;});}return null;};}function removeEntity(_0xc6e141,_0x44bf19){return function(_0x9241b7){if(_0x9241b7){return _0x9241b7[_0x3a57('0x25')]()[_0x3a57('0x24')](function(){_0xc6e141['status'](0xcc)[_0x3a57('0x1a')]();});}};}function handleEntityNotFound(_0x67bc48,_0x1ac02d){return function(_0x404d9e){if(!_0x404d9e){_0x67bc48[_0x3a57('0x18')](0x194);}return _0x404d9e;};}function handleError(_0xf1ca02,_0x46da41){_0x46da41=_0x46da41||0x1f4;return function(_0xfce790){logger[_0x3a57('0x26')](_0xfce790[_0x3a57('0x27')]);if(_0xfce790[_0x3a57('0x28')]){delete _0xfce790[_0x3a57('0x28')];}_0xf1ca02[_0x3a57('0x19')](_0x46da41)[_0x3a57('0x29')](_0xfce790);};}exports[_0x3a57('0x2a')]=function(_0x1d7dba,_0x39377b){var _0x22d1b8={},_0x5bd477={},_0x285a11={'count':0x0,'rows':[]};var _0x4cbf47=_[_0x3a57('0x2b')](db[_0x3a57('0x2c')][_0x3a57('0x2d')],function(_0x47337f){return{'name':_0x47337f['fieldName'],'type':_0x47337f[_0x3a57('0x2e')][_0x3a57('0x2f')]};});_0x5bd477['model']=_['map'](_0x4cbf47,'name');_0x5bd477[_0x3a57('0x30')]=_[_0x3a57('0x31')](_0x1d7dba[_0x3a57('0x30')]);_0x5bd477[_0x3a57('0x32')]=_[_0x3a57('0x33')](_0x5bd477[_0x3a57('0x34')],_0x5bd477[_0x3a57('0x30')]);_0x22d1b8['attributes']=_[_0x3a57('0x33')](_0x5bd477['model'],qs[_0x3a57('0x35')](_0x1d7dba[_0x3a57('0x30')][_0x3a57('0x35')]));_0x22d1b8['attributes']=_0x22d1b8['attributes']['length']?_0x22d1b8[_0x3a57('0x36')]:_0x5bd477['model'];if(!_0x1d7dba[_0x3a57('0x30')][_0x3a57('0x37')](_0x3a57('0x38'))){_0x22d1b8[_0x3a57('0x1d')]=qs['limit'](_0x1d7dba[_0x3a57('0x30')][_0x3a57('0x1d')]);_0x22d1b8[_0x3a57('0x1c')]=qs[_0x3a57('0x1c')](_0x1d7dba[_0x3a57('0x30')]['offset']);}_0x22d1b8[_0x3a57('0x39')]=qs[_0x3a57('0x3a')](_0x1d7dba[_0x3a57('0x30')][_0x3a57('0x3a')]);_0x22d1b8[_0x3a57('0x3b')]=qs[_0x3a57('0x32')](_[_0x3a57('0x3c')](_0x1d7dba[_0x3a57('0x30')],_0x5bd477[_0x3a57('0x32')]),_0x4cbf47);if(_0x1d7dba['query']['filter']){_0x22d1b8['where']=_[_0x3a57('0x3d')](_0x22d1b8[_0x3a57('0x3b')],{'$or':_[_0x3a57('0x2b')](_0x4cbf47,function(_0x43662d){if(_0x43662d[_0x3a57('0x2e')]!==_0x3a57('0x3e')){var _0x7a30b9={};_0x7a30b9[_0x43662d['name']]={'$like':'%'+_0x1d7dba[_0x3a57('0x30')][_0x3a57('0x3f')]+'%'};return _0x7a30b9;}})});}_0x22d1b8=_[_0x3a57('0x3d')]({},_0x22d1b8,_0x1d7dba[_0x3a57('0x40')]);var _0x1df37f={'where':_0x22d1b8[_0x3a57('0x3b')]};return db[_0x3a57('0x2c')]['count'](_0x1df37f)[_0x3a57('0x24')](function(_0x161d9a){_0x285a11[_0x3a57('0x1b')]=_0x161d9a;if(_0x1d7dba['query'][_0x3a57('0x41')]){_0x22d1b8[_0x3a57('0x42')]=[{'all':!![]}];}return db[_0x3a57('0x2c')]['findAll'](_0x22d1b8);})['then'](function(_0x41ad2e){_0x285a11[_0x3a57('0x43')]=_0x41ad2e;return _0x285a11;})[_0x3a57('0x24')](respondWithFilteredResult(_0x39377b,_0x22d1b8))['catch'](handleError(_0x39377b,null));};exports[_0x3a57('0x44')]=function(_0x20c7fb,_0x170d01){var _0x535572={'raw':!![],'where':{'id':_0x20c7fb[_0x3a57('0x45')]['id']}},_0x27f72b={};_0x27f72b[_0x3a57('0x34')]=_[_0x3a57('0x31')](db['SquareMessage'][_0x3a57('0x2d')]);_0x27f72b['query']=_[_0x3a57('0x31')](_0x20c7fb[_0x3a57('0x30')]);_0x27f72b['filters']=_[_0x3a57('0x33')](_0x27f72b['model'],_0x27f72b[_0x3a57('0x30')]);_0x535572[_0x3a57('0x36')]=_[_0x3a57('0x33')](_0x27f72b[_0x3a57('0x34')],qs['fields'](_0x20c7fb['query'][_0x3a57('0x35')]));_0x535572['attributes']=_0x535572[_0x3a57('0x36')][_0x3a57('0x46')]?_0x535572['attributes']:_0x27f72b[_0x3a57('0x34')];if(_0x20c7fb[_0x3a57('0x30')][_0x3a57('0x41')]){_0x535572['include']=[{'all':!![]}];}_0x535572=_[_0x3a57('0x3d')]({},_0x535572,_0x20c7fb[_0x3a57('0x40')]);return db[_0x3a57('0x2c')][_0x3a57('0x47')](_0x535572)['then'](handleEntityNotFound(_0x170d01,null))[_0x3a57('0x24')](respondWithResult(_0x170d01,null))[_0x3a57('0x48')](handleError(_0x170d01,null));};exports['create']=function(_0x5e7fcf,_0x3a7987){return db['SquareMessage']['create'](_0x5e7fcf[_0x3a57('0x49')],{})['then'](respondWithResult(_0x3a7987,0xc9))[_0x3a57('0x48')](handleError(_0x3a7987,null));};exports['update']=function(_0x22bf3c,_0x40661e){if(_0x22bf3c[_0x3a57('0x49')]['id']){delete _0x22bf3c['body']['id'];}return db[_0x3a57('0x2c')][_0x3a57('0x47')]({'where':{'id':_0x22bf3c['params']['id']}})['then'](handleEntityNotFound(_0x40661e,null))[_0x3a57('0x24')](saveUpdates(_0x22bf3c['body'],null))[_0x3a57('0x24')](respondWithResult(_0x40661e,null))[_0x3a57('0x48')](handleError(_0x40661e,null));};exports[_0x3a57('0x25')]=function(_0x3abffd,_0xdc6ae9){return db['SquareMessage'][_0x3a57('0x47')]({'where':{'id':_0x3abffd[_0x3a57('0x45')]['id']}})[_0x3a57('0x24')](handleEntityNotFound(_0xdc6ae9,null))[_0x3a57('0x24')](removeEntity(_0xdc6ae9,null))[_0x3a57('0x48')](handleError(_0xdc6ae9,null));}; \ No newline at end of file +var _0xb785=['map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','where','filters','merge','VIRTUAL','filter','options','include','catch','params','includeAll','find','create','body','update','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','Content-Range','apply','save','then','destroy','error','stack','name','send','SquareMessage','rawAttributes','fieldName','type','key','model'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xb785,0x1b6));var _0x5b78=function(_0x481564,_0x48d501){_0x481564=_0x481564-0x0;var _0x5cdfa6=_0xb785[_0x481564];return _0x5cdfa6;};'use strict';var pdf=require(_0x5b78('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5b78('0x1'));var zipdir=require(_0x5b78('0x2'));var jsonpatch=require(_0x5b78('0x3'));var rp=require(_0x5b78('0x4'));var moment=require('moment');var BPromise=require(_0x5b78('0x5'));var Mustache=require(_0x5b78('0x6'));var util=require(_0x5b78('0x7'));var path=require(_0x5b78('0x8'));var sox=require('sox');var csv=require(_0x5b78('0x9'));var ejs=require(_0x5b78('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5b78('0xb'));var crypto=require(_0x5b78('0xc'));var jsforce=require(_0x5b78('0xd'));var deskjs=require(_0x5b78('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5b78('0xf'));var Papa=require(_0x5b78('0x10'));var Redis=require(_0x5b78('0x11'));var authService=require(_0x5b78('0x12'));var qs=require(_0x5b78('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5b78('0x14'));var logger=require(_0x5b78('0x15'))('api');var utils=require(_0x5b78('0x16'));var config=require(_0x5b78('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1af5b8,_0x5b0c54){_0x5b0c54=_0x5b0c54||0xcc;return function(_0x205355){if(_0x205355){return _0x1af5b8[_0x5b78('0x18')](_0x5b0c54);}return _0x1af5b8[_0x5b78('0x19')](_0x5b0c54)[_0x5b78('0x1a')]();};}function respondWithResult(_0x69dca5,_0x151dae){_0x151dae=_0x151dae||0xc8;return function(_0x287522){if(_0x287522){return _0x69dca5[_0x5b78('0x19')](_0x151dae)[_0x5b78('0x1b')](_0x287522);}};}function respondWithFilteredResult(_0x313f57,_0x7af0f7){return function(_0x4a14c2){if(_0x4a14c2){var _0x353074=_0x4a14c2[_0x5b78('0x1c')],_0x19d554=_0x7af0f7[_0x5b78('0x1d')],_0x5e302c=_0x7af0f7['offset']+_0x7af0f7['limit'],_0x43a352;if(_0x5e302c>=_0x353074){_0x5e302c=_0x353074;_0x43a352=0xc8;}else{_0x43a352=0xce;}_0x313f57[_0x5b78('0x19')](_0x43a352);return _0x313f57['set'](_0x5b78('0x1e'),_0x19d554+'-'+_0x5e302c+'/'+_0x353074)['json'](_0x4a14c2);}return null;};}function patchUpdates(_0x240dae){return function(_0x51120f){try{jsonpatch[_0x5b78('0x1f')](_0x51120f,_0x240dae,!![]);}catch(_0x15bb59){return BPromise['reject'](_0x15bb59);}return _0x51120f[_0x5b78('0x20')]();};}function saveUpdates(_0x437725,_0x3a9329){return function(_0x91217a){if(_0x91217a){return _0x91217a['update'](_0x437725)[_0x5b78('0x21')](function(_0x726bbe){return _0x726bbe;});}return null;};}function removeEntity(_0x3cd9db,_0x1e4b7b){return function(_0x598300){if(_0x598300){return _0x598300[_0x5b78('0x22')]()[_0x5b78('0x21')](function(){_0x3cd9db[_0x5b78('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb98ed8,_0x3899c2){return function(_0x48f922){if(!_0x48f922){_0xb98ed8['sendStatus'](0x194);}return _0x48f922;};}function handleError(_0x1f80ea,_0xa1fed6){_0xa1fed6=_0xa1fed6||0x1f4;return function(_0xec0e43){logger[_0x5b78('0x23')](_0xec0e43[_0x5b78('0x24')]);if(_0xec0e43[_0x5b78('0x25')]){delete _0xec0e43[_0x5b78('0x25')];}_0x1f80ea[_0x5b78('0x19')](_0xa1fed6)[_0x5b78('0x26')](_0xec0e43);};}exports['index']=function(_0x17df3e,_0x2380df){var _0x3fd279={},_0x581c1b={},_0x37c61e={'count':0x0,'rows':[]};var _0x55bc48=_['map'](db[_0x5b78('0x27')][_0x5b78('0x28')],function(_0x58c459){return{'name':_0x58c459[_0x5b78('0x29')],'type':_0x58c459[_0x5b78('0x2a')][_0x5b78('0x2b')]};});_0x581c1b[_0x5b78('0x2c')]=_[_0x5b78('0x2d')](_0x55bc48,_0x5b78('0x25'));_0x581c1b[_0x5b78('0x2e')]=_[_0x5b78('0x2f')](_0x17df3e[_0x5b78('0x2e')]);_0x581c1b['filters']=_[_0x5b78('0x30')](_0x581c1b['model'],_0x581c1b[_0x5b78('0x2e')]);_0x3fd279['attributes']=_['intersection'](_0x581c1b[_0x5b78('0x2c')],qs['fields'](_0x17df3e[_0x5b78('0x2e')][_0x5b78('0x31')]));_0x3fd279[_0x5b78('0x32')]=_0x3fd279[_0x5b78('0x32')][_0x5b78('0x33')]?_0x3fd279[_0x5b78('0x32')]:_0x581c1b[_0x5b78('0x2c')];if(!_0x17df3e[_0x5b78('0x2e')][_0x5b78('0x34')](_0x5b78('0x35'))){_0x3fd279[_0x5b78('0x36')]=qs[_0x5b78('0x36')](_0x17df3e[_0x5b78('0x2e')][_0x5b78('0x36')]);_0x3fd279[_0x5b78('0x1d')]=qs['offset'](_0x17df3e['query'][_0x5b78('0x1d')]);}_0x3fd279['order']=qs['sort'](_0x17df3e['query']['sort']);_0x3fd279[_0x5b78('0x37')]=qs['filters'](_['pick'](_0x17df3e[_0x5b78('0x2e')],_0x581c1b[_0x5b78('0x38')]),_0x55bc48);if(_0x17df3e[_0x5b78('0x2e')]['filter']){_0x3fd279[_0x5b78('0x37')]=_[_0x5b78('0x39')](_0x3fd279[_0x5b78('0x37')],{'$or':_[_0x5b78('0x2d')](_0x55bc48,function(_0x26c8a8){if(_0x26c8a8[_0x5b78('0x2a')]!==_0x5b78('0x3a')){var _0xc4a3b8={};_0xc4a3b8[_0x26c8a8[_0x5b78('0x25')]]={'$like':'%'+_0x17df3e[_0x5b78('0x2e')][_0x5b78('0x3b')]+'%'};return _0xc4a3b8;}})});}_0x3fd279=_['merge']({},_0x3fd279,_0x17df3e[_0x5b78('0x3c')]);var _0x12b910={'where':_0x3fd279[_0x5b78('0x37')]};return db[_0x5b78('0x27')][_0x5b78('0x1c')](_0x12b910)[_0x5b78('0x21')](function(_0x1b95a5){_0x37c61e['count']=_0x1b95a5;if(_0x17df3e[_0x5b78('0x2e')]['includeAll']){_0x3fd279[_0x5b78('0x3d')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x3fd279);})[_0x5b78('0x21')](function(_0x4f1e91){_0x37c61e['rows']=_0x4f1e91;return _0x37c61e;})['then'](respondWithFilteredResult(_0x2380df,_0x3fd279))[_0x5b78('0x3e')](handleError(_0x2380df,null));};exports['show']=function(_0x45c44e,_0x11f713){var _0x94327d={'raw':!![],'where':{'id':_0x45c44e[_0x5b78('0x3f')]['id']}},_0x26892e={};_0x26892e[_0x5b78('0x2c')]=_['keys'](db[_0x5b78('0x27')]['rawAttributes']);_0x26892e[_0x5b78('0x2e')]=_[_0x5b78('0x2f')](_0x45c44e[_0x5b78('0x2e')]);_0x26892e['filters']=_[_0x5b78('0x30')](_0x26892e[_0x5b78('0x2c')],_0x26892e[_0x5b78('0x2e')]);_0x94327d['attributes']=_[_0x5b78('0x30')](_0x26892e['model'],qs['fields'](_0x45c44e['query'][_0x5b78('0x31')]));_0x94327d[_0x5b78('0x32')]=_0x94327d[_0x5b78('0x32')]['length']?_0x94327d[_0x5b78('0x32')]:_0x26892e[_0x5b78('0x2c')];if(_0x45c44e[_0x5b78('0x2e')][_0x5b78('0x40')]){_0x94327d[_0x5b78('0x3d')]=[{'all':!![]}];}_0x94327d=_[_0x5b78('0x39')]({},_0x94327d,_0x45c44e[_0x5b78('0x3c')]);return db['SquareMessage'][_0x5b78('0x41')](_0x94327d)[_0x5b78('0x21')](handleEntityNotFound(_0x11f713,null))[_0x5b78('0x21')](respondWithResult(_0x11f713,null))['catch'](handleError(_0x11f713,null));};exports['create']=function(_0x208dca,_0x21afca){return db[_0x5b78('0x27')][_0x5b78('0x42')](_0x208dca[_0x5b78('0x43')],{})[_0x5b78('0x21')](respondWithResult(_0x21afca,0xc9))['catch'](handleError(_0x21afca,null));};exports[_0x5b78('0x44')]=function(_0x54de68,_0x3bcfd4){if(_0x54de68[_0x5b78('0x43')]['id']){delete _0x54de68[_0x5b78('0x43')]['id'];}return db[_0x5b78('0x27')]['find']({'where':{'id':_0x54de68['params']['id']}})[_0x5b78('0x21')](handleEntityNotFound(_0x3bcfd4,null))[_0x5b78('0x21')](saveUpdates(_0x54de68[_0x5b78('0x43')],null))[_0x5b78('0x21')](respondWithResult(_0x3bcfd4,null))[_0x5b78('0x3e')](handleError(_0x3bcfd4,null));};exports['destroy']=function(_0xb33498,_0x407df8){return db[_0x5b78('0x27')]['find']({'where':{'id':_0xb33498[_0x5b78('0x3f')]['id']}})[_0x5b78('0x21')](handleEntityNotFound(_0x407df8,null))['then'](removeEntity(_0x407df8,null))['catch'](handleError(_0x407df8,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 87a2c8c..d8220c1 100644 --- a/server/api/squareMessage/squareMessage.model.js +++ b/server/api/squareMessage/squareMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x187d=['define','SquareMessage','square_messages','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareMessage.attributes'];(function(_0x5c3b76,_0x4d5b81){var _0xd8a57c=function(_0x1f8b02){while(--_0x1f8b02){_0x5c3b76['push'](_0x5c3b76['shift']());}};_0xd8a57c(++_0x4d5b81);}(_0x187d,0x93));var _0xd187=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x187d[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));module['exports']=function(_0x1d2533,_0x58ee7){return _0x1d2533[_0xd187('0x9')](_0xd187('0xa'),attributes,{'tableName':_0xd187('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','define','square_messages'];(function(_0xf7c3a5,_0x5db0f4){var _0x357243=function(_0x4867a6){while(--_0x4867a6){_0xf7c3a5['push'](_0xf7c3a5['shift']());}};_0x357243(++_0x5db0f4);}(_0x1261,0x144));var _0x1126=function(_0x2ff1f6,_0x1bc588){_0x2ff1f6=_0x2ff1f6-0x0;var _0xbae96d=_0x1261[_0x2ff1f6];return _0xbae96d;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('SquareMessage',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 4c123d8..c55e118 100644 --- a/server/api/squareMessage/squareMessage.rpc.js +++ b/server/api/squareMessage/squareMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ca9=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateSquareMessage','SquareMessage','create','body','options'];(function(_0x194c54,_0x5ad709){var _0x41a7ab=function(_0x534227){while(--_0x534227){_0x194c54['push'](_0x194c54['shift']());}};_0x41a7ab(++_0x5ad709);}(_0x8ca9,0x9c));var _0x98ca=function(_0xc809ee,_0x3e2f22){_0xc809ee=_0xc809ee-0x0;var _0x1bd280=_0x8ca9[_0xc809ee];return _0x1bd280;};'use strict';var _=require(_0x98ca('0x0'));var util=require(_0x98ca('0x1'));var moment=require(_0x98ca('0x2'));var BPromise=require(_0x98ca('0x3'));var rs=require(_0x98ca('0x4'));var fs=require('fs');var Redis=require(_0x98ca('0x5'));var db=require(_0x98ca('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x98ca('0x7'));var config=require('../../config/environment');var jayson=require(_0x98ca('0x8'));var client=jayson['client'][_0x98ca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xca4097,_0x18c349,_0x2852a0){return new BPromise(function(_0x323c95,_0x28a37a){return client[_0x98ca('0xa')](_0xca4097,_0x2852a0)[_0x98ca('0xb')](function(_0x277c29){logger[_0x98ca('0xc')](_0x98ca('0xd'),_0x18c349,_0x98ca('0xe'));logger[_0x98ca('0xf')](_0x98ca('0x10'),_0x18c349,_0x98ca('0xe'),JSON[_0x98ca('0x11')](_0x277c29));if(_0x277c29[_0x98ca('0x12')]){if(_0x277c29[_0x98ca('0x12')]['code']===0x1f4){logger[_0x98ca('0x12')](_0x98ca('0xd'),_0x18c349,_0x277c29[_0x98ca('0x12')][_0x98ca('0x13')]);return _0x28a37a(_0x277c29['error'][_0x98ca('0x13')]);}logger[_0x98ca('0x12')](_0x98ca('0xd'),_0x18c349,_0x277c29[_0x98ca('0x12')][_0x98ca('0x13')]);return _0x323c95(_0x277c29[_0x98ca('0x12')][_0x98ca('0x13')]);}else{logger['info'](_0x98ca('0xd'),_0x18c349,_0x98ca('0xe'));_0x323c95(_0x277c29[_0x98ca('0x14')][_0x98ca('0x13')]);}})['catch'](function(_0x238c1a){logger[_0x98ca('0x12')](_0x98ca('0xd'),_0x18c349,_0x238c1a);_0x28a37a(_0x238c1a);});});}exports[_0x98ca('0x15')]=function(_0x4523bb){var _0x3ca209=this;return new Promise(function(_0x28c8a6,_0x3dc670){return db[_0x98ca('0x16')][_0x98ca('0x17')](_0x4523bb[_0x98ca('0x18')],{'raw':_0x4523bb['options']?_0x4523bb[_0x98ca('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x98ca('0xb')](function(_0x2fe568){logger['info']('CreateSquareMessage',_0x4523bb);logger[_0x98ca('0xf')](_0x98ca('0x15'),_0x4523bb,JSON[_0x98ca('0x11')](_0x2fe568));_0x28c8a6(_0x2fe568);})['catch'](function(_0x2f7742){logger[_0x98ca('0x12')]('CreateSquareMessage',_0x2f7742[_0x98ca('0x13')],_0x4523bb);_0x3dc670(_0x3ca209['error'](0x1f4,_0x2f7742[_0x98ca('0x13')]));});});}; \ No newline at end of file +var _0x3fc6=['result','catch','CreateSquareMessage','SquareMessage','create','body','options','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x40eaf4,_0x54d2a9){var _0x3fde54=function(_0x4da78b){while(--_0x4da78b){_0x40eaf4['push'](_0x40eaf4['shift']());}};_0x3fde54(++_0x54d2a9);}(_0x3fc6,0x115));var _0x63fc=function(_0x26f4e3,_0x2e962c){_0x26f4e3=_0x26f4e3-0x0;var _0x20da27=_0x3fc6[_0x26f4e3];return _0x20da27;};'use strict';var _=require(_0x63fc('0x0'));var util=require('util');var moment=require(_0x63fc('0x1'));var BPromise=require(_0x63fc('0x2'));var rs=require(_0x63fc('0x3'));var fs=require('fs');var Redis=require(_0x63fc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x63fc('0x5'));var logger=require(_0x63fc('0x6'))(_0x63fc('0x7'));var config=require('../../config/environment');var jayson=require(_0x63fc('0x8'));var client=jayson['client'][_0x63fc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c7f72,_0x3e8157,_0x571ab6){return new BPromise(function(_0x3ec832,_0xffe000){return client[_0x63fc('0xa')](_0x1c7f72,_0x571ab6)[_0x63fc('0xb')](function(_0x32749b){logger['info'](_0x63fc('0xc'),_0x3e8157,'request\x20sent');logger['debug'](_0x63fc('0xd'),_0x3e8157,_0x63fc('0xe'),JSON[_0x63fc('0xf')](_0x32749b));if(_0x32749b[_0x63fc('0x10')]){if(_0x32749b[_0x63fc('0x10')][_0x63fc('0x11')]===0x1f4){logger[_0x63fc('0x10')](_0x63fc('0xc'),_0x3e8157,_0x32749b['error'][_0x63fc('0x12')]);return _0xffe000(_0x32749b[_0x63fc('0x10')][_0x63fc('0x12')]);}logger['error'](_0x63fc('0xc'),_0x3e8157,_0x32749b[_0x63fc('0x10')][_0x63fc('0x12')]);return _0x3ec832(_0x32749b['error'][_0x63fc('0x12')]);}else{logger[_0x63fc('0x13')](_0x63fc('0xc'),_0x3e8157,_0x63fc('0xe'));_0x3ec832(_0x32749b[_0x63fc('0x14')][_0x63fc('0x12')]);}})[_0x63fc('0x15')](function(_0x19a3f2){logger[_0x63fc('0x10')](_0x63fc('0xc'),_0x3e8157,_0x19a3f2);_0xffe000(_0x19a3f2);});});}exports[_0x63fc('0x16')]=function(_0x2db18b){var _0x1283f8=this;return new Promise(function(_0x2e1fb8,_0x51b73e){return db[_0x63fc('0x17')][_0x63fc('0x18')](_0x2db18b[_0x63fc('0x19')],{'raw':_0x2db18b[_0x63fc('0x1a')]?_0x2db18b[_0x63fc('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x63fc('0xb')](function(_0x2c05ef){logger[_0x63fc('0x13')]('CreateSquareMessage',_0x2db18b);logger['debug'](_0x63fc('0x16'),_0x2db18b,JSON[_0x63fc('0xf')](_0x2c05ef));_0x2e1fb8(_0x2c05ef);})[_0x63fc('0x15')](function(_0x5810b8){logger[_0x63fc('0x10')](_0x63fc('0x16'),_0x5810b8[_0x63fc('0x12')],_0x2db18b);_0x51b73e(_0x1283f8['error'](0x1f4,_0x5810b8[_0x63fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 700a5a5..7638275 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 _0x6f65=['./squareOdbc.controller','get','index','/:id','show','/:id/test','isAuthenticated','15s','test','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5cb083,_0xb70056){var _0x19bc70=function(_0x198426){while(--_0x198426){_0x5cb083['push'](_0x5cb083['shift']());}};_0x19bc70(++_0xb70056);}(_0x6f65,0x1ae));var _0x56f6=function(_0x357245,_0x4d3dad){_0x357245=_0x357245-0x0;var _0xbc6493=_0x6f65[_0x357245];return _0xbc6493;};'use strict';var multer=require(_0x56f6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x56f6('0x1'));var express=require(_0x56f6('0x2'));var router=express[_0x56f6('0x3')]();var auth=require(_0x56f6('0x4'));var interaction=require(_0x56f6('0x5'));var config=require(_0x56f6('0x6'));var controller=require(_0x56f6('0x7'));router[_0x56f6('0x8')]('/',auth['isAuthenticated'](),controller[_0x56f6('0x9')]);router['get'](_0x56f6('0xa'),auth['isAuthenticated'](),controller[_0x56f6('0xb')]);router[_0x56f6('0x8')](_0x56f6('0xc'),auth[_0x56f6('0xd')](),timeout(_0x56f6('0xe')),controller[_0x56f6('0xf')]);router[_0x56f6('0x10')]('/',auth[_0x56f6('0xd')](),controller[_0x56f6('0x11')]);router[_0x56f6('0x12')](_0x56f6('0xa'),auth[_0x56f6('0xd')](),controller[_0x56f6('0x13')]);router[_0x56f6('0x14')](_0x56f6('0xa'),auth[_0x56f6('0xd')](),controller[_0x56f6('0x15')]);module[_0x56f6('0x16')]=router; \ No newline at end of file +var _0x26ef=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/test','post','create','update','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x35778e,_0x191dc6){var _0x3dc89a=function(_0x3fef1c){while(--_0x3fef1c){_0x35778e['push'](_0x35778e['shift']());}};_0x3dc89a(++_0x191dc6);}(_0x26ef,0x13e));var _0xf26e=function(_0x2aaf3d,_0x4b2e17){_0x2aaf3d=_0x2aaf3d-0x0;var _0xf95fb8=_0x26ef[_0x2aaf3d];return _0xf95fb8;};'use strict';var multer=require('multer');var util=require(_0xf26e('0x0'));var path=require(_0xf26e('0x1'));var timeout=require(_0xf26e('0x2'));var express=require(_0xf26e('0x3'));var router=express['Router']();var auth=require(_0xf26e('0x4'));var interaction=require(_0xf26e('0x5'));var config=require(_0xf26e('0x6'));var controller=require('./squareOdbc.controller');router['get']('/',auth[_0xf26e('0x7')](),controller[_0xf26e('0x8')]);router[_0xf26e('0x9')](_0xf26e('0xa'),auth[_0xf26e('0x7')](),controller[_0xf26e('0xb')]);router[_0xf26e('0x9')](_0xf26e('0xc'),auth[_0xf26e('0x7')](),timeout('15s'),controller['test']);router[_0xf26e('0xd')]('/',auth[_0xf26e('0x7')](),controller[_0xf26e('0xe')]);router['put'](_0xf26e('0xa'),auth[_0xf26e('0x7')](),controller[_0xf26e('0xf')]);router['delete'](_0xf26e('0xa'),auth[_0xf26e('0x7')](),controller['destroy']);module[_0xf26e('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 7fb0229..1b83d4e 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 _0x209d=['sequelize','exports','name','STRING'];(function(_0x1dfc99,_0x17f9c7){var _0x30a8ee=function(_0x23c98c){while(--_0x23c98c){_0x1dfc99['push'](_0x1dfc99['shift']());}};_0x30a8ee(++_0x17f9c7);}(_0x209d,0x1e8));var _0xd209=function(_0x4f43d4,_0x1cd5d4){_0x4f43d4=_0x4f43d4-0x0;var _0x3cfffe=_0x209d[_0x4f43d4];return _0x3cfffe;};'use strict';var Sequelize=require(_0xd209('0x0'));module[_0xd209('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd209('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xd209('0x3')]},'description':{'type':Sequelize[_0xd209('0x3')]}}; \ No newline at end of file +var _0x6685=['name','STRING','exports'];(function(_0x26f1b2,_0x33d843){var _0x1624a4=function(_0x58dfb7){while(--_0x58dfb7){_0x26f1b2['push'](_0x26f1b2['shift']());}};_0x1624a4(++_0x33d843);}(_0x6685,0x119));var _0x5668=function(_0x3d4bd5,_0x3e1ebf){_0x3d4bd5=_0x3d4bd5-0x0;var _0x4207ee=_0x6685[_0x3d4bd5];return _0x4207ee;};'use strict';var Sequelize=require('sequelize');module[_0x5668('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x5668('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0x5668('0x2')]},'description':{'type':Sequelize[_0x5668('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 5de14b3..27f7bf7 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 _0x4c65=['lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','name','index','map','SquareOdbc','rawAttributes','type','key','model','query','keys','attributes','intersection','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','show','fields','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','params','test','odbc','openSync','dsn','closeSync','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x59a24c,_0x440aa4){var _0x12db65=function(_0x362b82){while(--_0x362b82){_0x59a24c['push'](_0x59a24c['shift']());}};_0x12db65(++_0x440aa4);}(_0x4c65,0x9d));var _0x54c6=function(_0x340ff6,_0x547a6a){_0x340ff6=_0x340ff6-0x0;var _0x99b5ea=_0x4c65[_0x340ff6];return _0x99b5ea;};'use strict';var pdf=require(_0x54c6('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x54c6('0x1'));var jsonpatch=require(_0x54c6('0x2'));var rp=require('request-promise');var moment=require(_0x54c6('0x3'));var BPromise=require(_0x54c6('0x4'));var Mustache=require(_0x54c6('0x5'));var util=require(_0x54c6('0x6'));var path=require(_0x54c6('0x7'));var sox=require(_0x54c6('0x8'));var csv=require(_0x54c6('0x9'));var ejs=require(_0x54c6('0xa'));var fs=require('fs');var _=require(_0x54c6('0xb'));var squel=require('squel');var crypto=require(_0x54c6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x54c6('0xd'));var toCsv=require(_0x54c6('0x9'));var querystring=require(_0x54c6('0xe'));var Papa=require(_0x54c6('0xf'));var Redis=require(_0x54c6('0x10'));var authService=require(_0x54c6('0x11'));var qs=require(_0x54c6('0x12'));var as=require(_0x54c6('0x13'));var hardwareService=require(_0x54c6('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x54c6('0x15'));var config=require(_0x54c6('0x16'));var db=require(_0x54c6('0x17'))['db'];function respondWithStatusCode(_0x8d5a0c,_0x1d45aa){_0x1d45aa=_0x1d45aa||0xcc;return function(_0x13526b){if(_0x13526b){return _0x8d5a0c[_0x54c6('0x18')](_0x1d45aa);}return _0x8d5a0c['status'](_0x1d45aa)[_0x54c6('0x19')]();};}function respondWithResult(_0x1e05ba,_0x473d2e){_0x473d2e=_0x473d2e||0xc8;return function(_0x45bc6f){if(_0x45bc6f){return _0x1e05ba[_0x54c6('0x1a')](_0x473d2e)[_0x54c6('0x1b')](_0x45bc6f);}};}function respondWithFilteredResult(_0x328c60,_0x167f37){return function(_0x2a360a){if(_0x2a360a){var _0x8daa21=_0x2a360a[_0x54c6('0x1c')],_0xcce2a8=_0x167f37[_0x54c6('0x1d')],_0x3e83ea=_0x167f37[_0x54c6('0x1d')]+_0x167f37[_0x54c6('0x1e')],_0x41266f;if(_0x3e83ea>=_0x8daa21){_0x3e83ea=_0x8daa21;_0x41266f=0xc8;}else{_0x41266f=0xce;}_0x328c60['status'](_0x41266f);return _0x328c60[_0x54c6('0x1f')](_0x54c6('0x20'),_0xcce2a8+'-'+_0x3e83ea+'/'+_0x8daa21)[_0x54c6('0x1b')](_0x2a360a);}return null;};}function patchUpdates(_0x4376b1){return function(_0x2563da){try{jsonpatch[_0x54c6('0x21')](_0x2563da,_0x4376b1,!![]);}catch(_0x339161){return BPromise[_0x54c6('0x22')](_0x339161);}return _0x2563da[_0x54c6('0x23')]();};}function saveUpdates(_0x5e2137,_0x76d641){return function(_0x3c7163){if(_0x3c7163){return _0x3c7163[_0x54c6('0x24')](_0x5e2137)[_0x54c6('0x25')](function(_0x474668){return _0x474668;});}return null;};}function removeEntity(_0x11d6fa,_0x34aaa6){return function(_0x50835e){if(_0x50835e){return _0x50835e[_0x54c6('0x26')]()[_0x54c6('0x25')](function(){var _0x12c9c1=_0x50835e[_0x54c6('0x27')]({'plain':!![]});var _0xf6f4e0=_0x54c6('0x28');return db[_0x54c6('0x29')]['destroy']({'where':{'type':_0xf6f4e0,'resourceId':_0x12c9c1['id']}})[_0x54c6('0x25')](function(){return _0x50835e;});})[_0x54c6('0x25')](function(){_0x11d6fa['status'](0xcc)[_0x54c6('0x19')]();});}};}function handleEntityNotFound(_0x3ad206,_0x38fd29){return function(_0x4f7606){if(!_0x4f7606){_0x3ad206[_0x54c6('0x18')](0x194);}return _0x4f7606;};}function handleError(_0x4aa135,_0x1f6c63){_0x1f6c63=_0x1f6c63||0x1f4;return function(_0x73965d){logger['error'](_0x73965d['stack']);if(_0x73965d['name']){delete _0x73965d[_0x54c6('0x2a')];}_0x4aa135[_0x54c6('0x1a')](_0x1f6c63)['send'](_0x73965d);};}exports[_0x54c6('0x2b')]=function(_0x216e71,_0x216507){var _0x4b16ab={},_0xec5101={},_0x27b06c={'count':0x0,'rows':[]};var _0x41ee01=_[_0x54c6('0x2c')](db[_0x54c6('0x2d')][_0x54c6('0x2e')],function(_0x3ed60a){return{'name':_0x3ed60a['fieldName'],'type':_0x3ed60a[_0x54c6('0x2f')][_0x54c6('0x30')]};});_0xec5101[_0x54c6('0x31')]=_[_0x54c6('0x2c')](_0x41ee01,_0x54c6('0x2a'));_0xec5101[_0x54c6('0x32')]=_[_0x54c6('0x33')](_0x216e71[_0x54c6('0x32')]);_0xec5101['filters']=_['intersection'](_0xec5101[_0x54c6('0x31')],_0xec5101[_0x54c6('0x32')]);_0x4b16ab[_0x54c6('0x34')]=_[_0x54c6('0x35')](_0xec5101[_0x54c6('0x31')],qs['fields'](_0x216e71['query']['fields']));_0x4b16ab['attributes']=_0x4b16ab[_0x54c6('0x34')]['length']?_0x4b16ab[_0x54c6('0x34')]:_0xec5101[_0x54c6('0x31')];if(!_0x216e71[_0x54c6('0x32')]['hasOwnProperty'](_0x54c6('0x36'))){_0x4b16ab[_0x54c6('0x1e')]=qs[_0x54c6('0x1e')](_0x216e71[_0x54c6('0x32')][_0x54c6('0x1e')]);_0x4b16ab[_0x54c6('0x1d')]=qs[_0x54c6('0x1d')](_0x216e71[_0x54c6('0x32')][_0x54c6('0x1d')]);}_0x4b16ab[_0x54c6('0x37')]=qs[_0x54c6('0x38')](_0x216e71[_0x54c6('0x32')]['sort']);_0x4b16ab[_0x54c6('0x39')]=qs[_0x54c6('0x3a')](_[_0x54c6('0x3b')](_0x216e71['query'],_0xec5101['filters']),_0x41ee01);if(_0x216e71['query']['filter']){_0x4b16ab['where']=_['merge'](_0x4b16ab['where'],{'$or':_[_0x54c6('0x2c')](_0x41ee01,function(_0x46081a){if(_0x46081a[_0x54c6('0x2f')]!=='VIRTUAL'){var _0x1f7b20={};_0x1f7b20[_0x46081a[_0x54c6('0x2a')]]={'$like':'%'+_0x216e71[_0x54c6('0x32')][_0x54c6('0x3c')]+'%'};return _0x1f7b20;}})});}_0x4b16ab=_[_0x54c6('0x3d')]({},_0x4b16ab,_0x216e71[_0x54c6('0x3e')]);var _0x84bc53={'where':_0x4b16ab[_0x54c6('0x39')]};return db[_0x54c6('0x2d')][_0x54c6('0x1c')](_0x84bc53)[_0x54c6('0x25')](function(_0x48e1c5){_0x27b06c[_0x54c6('0x1c')]=_0x48e1c5;if(_0x216e71[_0x54c6('0x32')][_0x54c6('0x3f')]){_0x4b16ab[_0x54c6('0x40')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x4b16ab);})[_0x54c6('0x25')](function(_0xb6a89e){_0x27b06c[_0x54c6('0x41')]=_0xb6a89e;return _0x27b06c;})[_0x54c6('0x25')](respondWithFilteredResult(_0x216507,_0x4b16ab))[_0x54c6('0x42')](handleError(_0x216507,null));};exports[_0x54c6('0x43')]=function(_0x1fcd5c,_0x2f74b7){var _0x38c13f={'raw':!![],'where':{'id':_0x1fcd5c['params']['id']}},_0x1fb0ab={};_0x1fb0ab[_0x54c6('0x31')]=_[_0x54c6('0x33')](db[_0x54c6('0x2d')]['rawAttributes']);_0x1fb0ab[_0x54c6('0x32')]=_[_0x54c6('0x33')](_0x1fcd5c[_0x54c6('0x32')]);_0x1fb0ab['filters']=_[_0x54c6('0x35')](_0x1fb0ab[_0x54c6('0x31')],_0x1fb0ab[_0x54c6('0x32')]);_0x38c13f[_0x54c6('0x34')]=_[_0x54c6('0x35')](_0x1fb0ab['model'],qs[_0x54c6('0x44')](_0x1fcd5c[_0x54c6('0x32')]['fields']));_0x38c13f[_0x54c6('0x34')]=_0x38c13f[_0x54c6('0x34')][_0x54c6('0x45')]?_0x38c13f['attributes']:_0x1fb0ab[_0x54c6('0x31')];if(_0x1fcd5c[_0x54c6('0x32')][_0x54c6('0x3f')]){_0x38c13f[_0x54c6('0x40')]=[{'all':!![]}];}_0x38c13f=_['merge']({},_0x38c13f,_0x1fcd5c['options']);return db[_0x54c6('0x2d')][_0x54c6('0x46')](_0x38c13f)[_0x54c6('0x25')](handleEntityNotFound(_0x2f74b7,null))[_0x54c6('0x25')](respondWithResult(_0x2f74b7,null))['catch'](handleError(_0x2f74b7,null));};exports['create']=function(_0x32ec76,_0x15bf85){return db[_0x54c6('0x2d')][_0x54c6('0x47')](_0x32ec76[_0x54c6('0x48')],{})['then'](function(_0xf141c9){var _0x6f8331=_0x32ec76[_0x54c6('0x49')][_0x54c6('0x27')]({'plain':!![]});if(!_0x6f8331)throw new Error(_0x54c6('0x4a'));if(_0x6f8331[_0x54c6('0x4b')]===_0x54c6('0x49')){var _0x35dda4=_0xf141c9[_0x54c6('0x27')]({'plain':!![]});var _0x5006a5='ODBC';return db['UserProfileSection'][_0x54c6('0x46')]({'where':{'name':_0x5006a5,'userProfileId':_0x6f8331[_0x54c6('0x4c')]},'raw':!![]})[_0x54c6('0x25')](function(_0xeea0b7){if(_0xeea0b7&&_0xeea0b7['autoAssociation']===0x0){return db[_0x54c6('0x29')][_0x54c6('0x47')]({'name':_0x35dda4[_0x54c6('0x2a')],'resourceId':_0x35dda4['id'],'type':_0xeea0b7['name'],'sectionId':_0xeea0b7['id']},{})[_0x54c6('0x25')](function(){return _0xf141c9;});}else{return _0xf141c9;}})[_0x54c6('0x42')](function(_0x134a32){logger[_0x54c6('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x134a32);throw _0x134a32;});}return _0xf141c9;})[_0x54c6('0x25')](respondWithResult(_0x15bf85,0xc9))[_0x54c6('0x42')](handleError(_0x15bf85,null));};exports[_0x54c6('0x24')]=function(_0x88441c,_0x48e4a0){if(_0x88441c[_0x54c6('0x48')]['id']){delete _0x88441c['body']['id'];}return db[_0x54c6('0x2d')][_0x54c6('0x46')]({'where':{'id':_0x88441c[_0x54c6('0x4e')]['id']}})[_0x54c6('0x25')](handleEntityNotFound(_0x48e4a0,null))[_0x54c6('0x25')](saveUpdates(_0x88441c[_0x54c6('0x48')],null))['then'](respondWithResult(_0x48e4a0,null))[_0x54c6('0x42')](handleError(_0x48e4a0,null));};exports[_0x54c6('0x26')]=function(_0x24afd3,_0x538d1b){return db[_0x54c6('0x2d')][_0x54c6('0x46')]({'where':{'id':_0x24afd3[_0x54c6('0x4e')]['id']}})[_0x54c6('0x25')](handleEntityNotFound(_0x538d1b,null))[_0x54c6('0x25')](removeEntity(_0x538d1b,null))[_0x54c6('0x42')](handleError(_0x538d1b,null));};exports[_0x54c6('0x4f')]=function(_0x23a038,_0x35fee1,_0xe98ce){var _0x44b48e;return db[_0x54c6('0x2d')][_0x54c6('0x46')]({'where':{'id':_0x23a038[_0x54c6('0x4e')]['id']},'attributes':['id','dsn']})[_0x54c6('0x25')](handleEntityNotFound(_0x35fee1,null))[_0x54c6('0x25')](function(_0x4adb55){if(_0x4adb55){var _0x39202a=require(_0x54c6('0x50'))();_0x39202a[_0x54c6('0x51')](_0x4adb55[_0x54c6('0x52')]);_0x39202a[_0x54c6('0x53')]();return _0x4adb55;}})['then'](respondWithResult(_0x35fee1,null))[_0x54c6('0x42')](handleError(_0x35fee1,null));}; \ No newline at end of file +var _0x3b86=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','ODBC','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','filter','merge','where','VIRTUAL','options','SquareOdbc','includeAll','include','findAll','rows','params','keys','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync'];(function(_0x57f8c0,_0x136cf6){var _0x117f08=function(_0x426cd4){while(--_0x426cd4){_0x57f8c0['push'](_0x57f8c0['shift']());}};_0x117f08(++_0x136cf6);}(_0x3b86,0xae));var _0x63b8=function(_0x18edac,_0x487813){_0x18edac=_0x18edac-0x0;var _0x53c0c7=_0x3b86[_0x18edac];return _0x53c0c7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x63b8('0x0'));var rimraf=require(_0x63b8('0x1'));var zipdir=require(_0x63b8('0x2'));var jsonpatch=require(_0x63b8('0x3'));var rp=require(_0x63b8('0x4'));var moment=require(_0x63b8('0x5'));var BPromise=require(_0x63b8('0x6'));var Mustache=require(_0x63b8('0x7'));var util=require(_0x63b8('0x8'));var path=require('path');var sox=require(_0x63b8('0x9'));var csv=require(_0x63b8('0xa'));var ejs=require(_0x63b8('0xb'));var fs=require('fs');var _=require(_0x63b8('0xc'));var squel=require(_0x63b8('0xd'));var crypto=require(_0x63b8('0xe'));var jsforce=require(_0x63b8('0xf'));var deskjs=require(_0x63b8('0x10'));var toCsv=require(_0x63b8('0xa'));var querystring=require('querystring');var Papa=require(_0x63b8('0x11'));var Redis=require(_0x63b8('0x12'));var authService=require(_0x63b8('0x13'));var qs=require(_0x63b8('0x14'));var as=require(_0x63b8('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x63b8('0x16'));var config=require(_0x63b8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x61f9c9,_0x35407c){_0x35407c=_0x35407c||0xcc;return function(_0x4ae7eb){if(_0x4ae7eb){return _0x61f9c9[_0x63b8('0x18')](_0x35407c);}return _0x61f9c9[_0x63b8('0x19')](_0x35407c)[_0x63b8('0x1a')]();};}function respondWithResult(_0x2404a1,_0x3ac951){_0x3ac951=_0x3ac951||0xc8;return function(_0x44dcbd){if(_0x44dcbd){return _0x2404a1[_0x63b8('0x19')](_0x3ac951)[_0x63b8('0x1b')](_0x44dcbd);}};}function respondWithFilteredResult(_0x34dca9,_0x19c838){return function(_0x5d929a){if(_0x5d929a){var _0x344c61=_0x5d929a[_0x63b8('0x1c')],_0x1cceae=_0x19c838[_0x63b8('0x1d')],_0x36519c=_0x19c838[_0x63b8('0x1d')]+_0x19c838['limit'],_0x1672ce;if(_0x36519c>=_0x344c61){_0x36519c=_0x344c61;_0x1672ce=0xc8;}else{_0x1672ce=0xce;}_0x34dca9['status'](_0x1672ce);return _0x34dca9[_0x63b8('0x1e')](_0x63b8('0x1f'),_0x1cceae+'-'+_0x36519c+'/'+_0x344c61)[_0x63b8('0x1b')](_0x5d929a);}return null;};}function patchUpdates(_0x36010d){return function(_0x16d1de){try{jsonpatch[_0x63b8('0x20')](_0x16d1de,_0x36010d,!![]);}catch(_0x55ad0e){return BPromise[_0x63b8('0x21')](_0x55ad0e);}return _0x16d1de[_0x63b8('0x22')]();};}function saveUpdates(_0x414241,_0x46f32e){return function(_0x4750a2){if(_0x4750a2){return _0x4750a2[_0x63b8('0x23')](_0x414241)[_0x63b8('0x24')](function(_0x53722e){return _0x53722e;});}return null;};}function removeEntity(_0x33f151,_0x2cd1a7){return function(_0x2c57b2){if(_0x2c57b2){return _0x2c57b2[_0x63b8('0x25')]()[_0x63b8('0x24')](function(){var _0xf332c0=_0x2c57b2['get']({'plain':!![]});var _0x3f83b4=_0x63b8('0x26');return db['UserProfileResource'][_0x63b8('0x25')]({'where':{'type':_0x3f83b4,'resourceId':_0xf332c0['id']}})[_0x63b8('0x24')](function(){return _0x2c57b2;});})[_0x63b8('0x24')](function(){_0x33f151['status'](0xcc)[_0x63b8('0x1a')]();});}};}function handleEntityNotFound(_0x27a82e,_0x4d5638){return function(_0x206102){if(!_0x206102){_0x27a82e[_0x63b8('0x18')](0x194);}return _0x206102;};}function handleError(_0xc8ee23,_0x1935b9){_0x1935b9=_0x1935b9||0x1f4;return function(_0x2d8829){logger[_0x63b8('0x27')](_0x2d8829[_0x63b8('0x28')]);if(_0x2d8829['name']){delete _0x2d8829[_0x63b8('0x29')];}_0xc8ee23[_0x63b8('0x19')](_0x1935b9)[_0x63b8('0x2a')](_0x2d8829);};}exports['index']=function(_0x43cb64,_0x261f44){var _0x2610cc={},_0x128f8b={},_0x550cdc={'count':0x0,'rows':[]};var _0x1659a9=_[_0x63b8('0x2b')](db['SquareOdbc'][_0x63b8('0x2c')],function(_0x3742da){return{'name':_0x3742da[_0x63b8('0x2d')],'type':_0x3742da[_0x63b8('0x2e')][_0x63b8('0x2f')]};});_0x128f8b[_0x63b8('0x30')]=_[_0x63b8('0x2b')](_0x1659a9,_0x63b8('0x29'));_0x128f8b[_0x63b8('0x31')]=_['keys'](_0x43cb64[_0x63b8('0x31')]);_0x128f8b[_0x63b8('0x32')]=_[_0x63b8('0x33')](_0x128f8b[_0x63b8('0x30')],_0x128f8b[_0x63b8('0x31')]);_0x2610cc[_0x63b8('0x34')]=_['intersection'](_0x128f8b[_0x63b8('0x30')],qs['fields'](_0x43cb64[_0x63b8('0x31')][_0x63b8('0x35')]));_0x2610cc[_0x63b8('0x34')]=_0x2610cc[_0x63b8('0x34')]['length']?_0x2610cc[_0x63b8('0x34')]:_0x128f8b[_0x63b8('0x30')];if(!_0x43cb64[_0x63b8('0x31')][_0x63b8('0x36')](_0x63b8('0x37'))){_0x2610cc['limit']=qs['limit'](_0x43cb64[_0x63b8('0x31')][_0x63b8('0x38')]);_0x2610cc[_0x63b8('0x1d')]=qs[_0x63b8('0x1d')](_0x43cb64[_0x63b8('0x31')]['offset']);}_0x2610cc[_0x63b8('0x39')]=qs['sort'](_0x43cb64[_0x63b8('0x31')][_0x63b8('0x3a')]);_0x2610cc['where']=qs['filters'](_['pick'](_0x43cb64[_0x63b8('0x31')],_0x128f8b['filters']),_0x1659a9);if(_0x43cb64['query'][_0x63b8('0x3b')]){_0x2610cc['where']=_[_0x63b8('0x3c')](_0x2610cc[_0x63b8('0x3d')],{'$or':_[_0x63b8('0x2b')](_0x1659a9,function(_0xe686db){if(_0xe686db[_0x63b8('0x2e')]!==_0x63b8('0x3e')){var _0xee7300={};_0xee7300[_0xe686db[_0x63b8('0x29')]]={'$like':'%'+_0x43cb64[_0x63b8('0x31')][_0x63b8('0x3b')]+'%'};return _0xee7300;}})});}_0x2610cc=_['merge']({},_0x2610cc,_0x43cb64[_0x63b8('0x3f')]);var _0x225882={'where':_0x2610cc[_0x63b8('0x3d')]};return db[_0x63b8('0x40')]['count'](_0x225882)[_0x63b8('0x24')](function(_0x2aae1d){_0x550cdc[_0x63b8('0x1c')]=_0x2aae1d;if(_0x43cb64['query'][_0x63b8('0x41')]){_0x2610cc[_0x63b8('0x42')]=[{'all':!![]}];}return db['SquareOdbc'][_0x63b8('0x43')](_0x2610cc);})[_0x63b8('0x24')](function(_0x537f01){_0x550cdc[_0x63b8('0x44')]=_0x537f01;return _0x550cdc;})['then'](respondWithFilteredResult(_0x261f44,_0x2610cc))['catch'](handleError(_0x261f44,null));};exports['show']=function(_0x42153f,_0x3adcb9){var _0x388afc={'raw':!![],'where':{'id':_0x42153f[_0x63b8('0x45')]['id']}},_0x1bdd5e={};_0x1bdd5e['model']=_[_0x63b8('0x46')](db[_0x63b8('0x40')][_0x63b8('0x2c')]);_0x1bdd5e[_0x63b8('0x31')]=_[_0x63b8('0x46')](_0x42153f['query']);_0x1bdd5e[_0x63b8('0x32')]=_[_0x63b8('0x33')](_0x1bdd5e[_0x63b8('0x30')],_0x1bdd5e[_0x63b8('0x31')]);_0x388afc[_0x63b8('0x34')]=_[_0x63b8('0x33')](_0x1bdd5e[_0x63b8('0x30')],qs[_0x63b8('0x35')](_0x42153f[_0x63b8('0x31')]['fields']));_0x388afc[_0x63b8('0x34')]=_0x388afc[_0x63b8('0x34')][_0x63b8('0x47')]?_0x388afc['attributes']:_0x1bdd5e['model'];if(_0x42153f[_0x63b8('0x31')][_0x63b8('0x41')]){_0x388afc[_0x63b8('0x42')]=[{'all':!![]}];}_0x388afc=_[_0x63b8('0x3c')]({},_0x388afc,_0x42153f[_0x63b8('0x3f')]);return db[_0x63b8('0x40')][_0x63b8('0x48')](_0x388afc)[_0x63b8('0x24')](handleEntityNotFound(_0x3adcb9,null))[_0x63b8('0x24')](respondWithResult(_0x3adcb9,null))[_0x63b8('0x49')](handleError(_0x3adcb9,null));};exports[_0x63b8('0x4a')]=function(_0x21b1c1,_0x594375){return db[_0x63b8('0x40')][_0x63b8('0x4a')](_0x21b1c1[_0x63b8('0x4b')],{})[_0x63b8('0x24')](function(_0x18e3be){var _0x45183a=_0x21b1c1[_0x63b8('0x4c')]['get']({'plain':!![]});if(!_0x45183a)throw new Error(_0x63b8('0x4d'));if(_0x45183a['role']===_0x63b8('0x4c')){var _0x170f5a=_0x18e3be['get']({'plain':!![]});var _0x4e9b51='ODBC';return db[_0x63b8('0x4e')][_0x63b8('0x48')]({'where':{'name':_0x4e9b51,'userProfileId':_0x45183a[_0x63b8('0x4f')]},'raw':!![]})[_0x63b8('0x24')](function(_0x46dc86){if(_0x46dc86&&_0x46dc86[_0x63b8('0x50')]===0x0){return db[_0x63b8('0x51')][_0x63b8('0x4a')]({'name':_0x170f5a[_0x63b8('0x29')],'resourceId':_0x170f5a['id'],'type':_0x46dc86[_0x63b8('0x29')],'sectionId':_0x46dc86['id']},{})['then'](function(){return _0x18e3be;});}else{return _0x18e3be;}})['catch'](function(_0x289198){logger[_0x63b8('0x27')](_0x63b8('0x52'),_0x289198);throw _0x289198;});}return _0x18e3be;})[_0x63b8('0x24')](respondWithResult(_0x594375,0xc9))['catch'](handleError(_0x594375,null));};exports[_0x63b8('0x23')]=function(_0x29431e,_0x1ee632){if(_0x29431e['body']['id']){delete _0x29431e[_0x63b8('0x4b')]['id'];}return db[_0x63b8('0x40')][_0x63b8('0x48')]({'where':{'id':_0x29431e['params']['id']}})[_0x63b8('0x24')](handleEntityNotFound(_0x1ee632,null))['then'](saveUpdates(_0x29431e[_0x63b8('0x4b')],null))[_0x63b8('0x24')](respondWithResult(_0x1ee632,null))[_0x63b8('0x49')](handleError(_0x1ee632,null));};exports[_0x63b8('0x25')]=function(_0x520954,_0x1b518b){return db[_0x63b8('0x40')][_0x63b8('0x48')]({'where':{'id':_0x520954[_0x63b8('0x45')]['id']}})[_0x63b8('0x24')](handleEntityNotFound(_0x1b518b,null))[_0x63b8('0x24')](removeEntity(_0x1b518b,null))[_0x63b8('0x49')](handleError(_0x1b518b,null));};exports[_0x63b8('0x53')]=function(_0x25554d,_0x26e254,_0x4f7b5c){var _0x1a1979;return db['SquareOdbc'][_0x63b8('0x48')]({'where':{'id':_0x25554d['params']['id']},'attributes':['id',_0x63b8('0x54')]})[_0x63b8('0x24')](handleEntityNotFound(_0x26e254,null))[_0x63b8('0x24')](function(_0xa09094){if(_0xa09094){var _0x4bd02b=require(_0x63b8('0x55'))();_0x4bd02b[_0x63b8('0x56')](_0xa09094[_0x63b8('0x54')]);_0x4bd02b['closeSync']();return _0xa09094;}})['then'](respondWithResult(_0x26e254,null))[_0x63b8('0x49')](handleError(_0x26e254,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index b2b30ac..2021555 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 _0x1f38=['./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x15559f,_0xa4759a){var _0x202e0e=function(_0x23b8bf){while(--_0x23b8bf){_0x15559f['push'](_0x15559f['shift']());}};_0x202e0e(++_0xa4759a);}(_0x1f38,0xd7));var _0x81f3=function(_0x39d38e,_0x3da1f7){_0x39d38e=_0x39d38e-0x0;var _0x18e737=_0x1f38[_0x39d38e];return _0x18e737;};'use strict';var _=require(_0x81f3('0x0'));var util=require(_0x81f3('0x1'));var logger=require(_0x81f3('0x2'))(_0x81f3('0x3'));var moment=require(_0x81f3('0x4'));var BPromise=require(_0x81f3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x81f3('0x6'));var rimraf=require(_0x81f3('0x7'));var config=require(_0x81f3('0x8'));var attributes=require(_0x81f3('0x9'));module[_0x81f3('0xa')]=function(_0x59e5ae,_0x39633a){return _0x59e5ae[_0x81f3('0xb')](_0x81f3('0xc'),attributes,{'tableName':_0x81f3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x203a=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./squareOdbc.attributes','exports','square_odbc'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x203a,0x136));var _0xa203=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x203a[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xa203('0x0'));var logger=require(_0xa203('0x1'))(_0xa203('0x2'));var moment=require(_0xa203('0x3'));var BPromise=require(_0xa203('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa203('0x5'));var config=require(_0xa203('0x6'));var attributes=require(_0xa203('0x7'));module[_0xa203('0x8')]=function(_0x3eb0f4,_0x23575f){return _0x3eb0f4['define']('SquareOdbc',attributes,{'tableName':_0xa203('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index b0dc871..84cae83 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 _0x3e74=['catch','SquareOdbc','find','options','raw','where','attributes','include','map','model','then','ShowSquareOdbc','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','SquareOdbc,\x20%s,\x20%s','message','info'];(function(_0x2beeb9,_0x415c85){var _0x3f7f25=function(_0x1890d1){while(--_0x1890d1){_0x2beeb9['push'](_0x2beeb9['shift']());}};_0x3f7f25(++_0x415c85);}(_0x3e74,0x175));var _0x43e7=function(_0x226501,_0x4fb0fa){_0x226501=_0x226501-0x0;var _0x500531=_0x3e74[_0x226501];return _0x500531;};'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 Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowSquareOdbc']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file +var _0x7217=['where','attributes','map','include','model','ShowSquareOdbc','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareOdbc','find','options','raw'];(function(_0x4f54aa,_0x29cf8c){var _0x437938=function(_0x47ca78){while(--_0x47ca78){_0x4f54aa['push'](_0x4f54aa['shift']());}};_0x437938(++_0x29cf8c);}(_0x7217,0x19e));var _0x7721=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7217[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowSquareOdbc']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowSquareOdbc',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 187a257..b2cff2a 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 _0x97c1=['/:id/users','removeUsers','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','/:id','isAuthenticated','show','post','create','addUsers','put','delete','destroy'];(function(_0x1e131e,_0x1561a2){var _0x2e8392=function(_0x39f525){while(--_0x39f525){_0x1e131e['push'](_0x1e131e['shift']());}};_0x2e8392(++_0x1561a2);}(_0x97c1,0xdf));var _0x197c=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x97c1[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x197c('0x0'));var util=require(_0x197c('0x1'));var path=require('path');var timeout=require(_0x197c('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x197c('0x3'));var interaction=require(_0x197c('0x4'));var config=require(_0x197c('0x5'));var controller=require(_0x197c('0x6'));router[_0x197c('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x197c('0x7')](_0x197c('0x8'),auth[_0x197c('0x9')](),controller[_0x197c('0xa')]);router['get']('/:id/users',auth[_0x197c('0x9')](),controller['getUsers']);router[_0x197c('0xb')]('/',auth[_0x197c('0x9')](),controller[_0x197c('0xc')]);router[_0x197c('0xb')]('/:id/users',auth[_0x197c('0x9')](),controller[_0x197c('0xd')]);router[_0x197c('0xe')](_0x197c('0x8'),auth[_0x197c('0x9')](),controller['update']);router[_0x197c('0xf')](_0x197c('0x8'),auth[_0x197c('0x9')](),controller[_0x197c('0x10')]);router['delete'](_0x197c('0x11'),auth[_0x197c('0x9')](),controller[_0x197c('0x12')]);module[_0x197c('0x13')]=router; \ No newline at end of file +var _0x96cc=['index','/:id','show','/:id/users','getUsers','create','post','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated'];(function(_0x449041,_0x5d1a18){var _0x26dc8b=function(_0x5b8273){while(--_0x5b8273){_0x449041['push'](_0x449041['shift']());}};_0x26dc8b(++_0x5d1a18);}(_0x96cc,0x16c));var _0xc96c=function(_0x4228a9,_0x40d3a3){_0x4228a9=_0x4228a9-0x0;var _0xdbce4a=_0x96cc[_0x4228a9];return _0xdbce4a;};'use strict';var multer=require(_0xc96c('0x0'));var util=require('util');var path=require(_0xc96c('0x1'));var timeout=require('connect-timeout');var express=require(_0xc96c('0x2'));var router=express[_0xc96c('0x3')]();var auth=require(_0xc96c('0x4'));var interaction=require(_0xc96c('0x5'));var config=require(_0xc96c('0x6'));var controller=require(_0xc96c('0x7'));router[_0xc96c('0x8')]('/',auth[_0xc96c('0x9')](),controller[_0xc96c('0xa')]);router['get'](_0xc96c('0xb'),auth[_0xc96c('0x9')](),controller[_0xc96c('0xc')]);router[_0xc96c('0x8')](_0xc96c('0xd'),auth[_0xc96c('0x9')](),controller[_0xc96c('0xe')]);router['post']('/',auth[_0xc96c('0x9')](),controller[_0xc96c('0xf')]);router[_0xc96c('0x10')]('/:id/users',auth[_0xc96c('0x9')](),controller['addUsers']);router[_0xc96c('0x11')]('/:id',auth[_0xc96c('0x9')](),controller[_0xc96c('0x12')]);router[_0xc96c('0x13')](_0xc96c('0xb'),auth['isAuthenticated'](),controller[_0xc96c('0x14')]);router[_0xc96c('0x13')](_0xc96c('0xd'),auth[_0xc96c('0x9')](),controller['removeUsers']);module[_0xc96c('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index b0c4e6e..4b56b74 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 _0x3235=['name','TEXT','BLOB','getDataValue','preproduction','toString','utf8','long','production','exports','STRING'];(function(_0x3fa5f6,_0x206889){var _0x543711=function(_0x4558ed){while(--_0x4558ed){_0x3fa5f6['push'](_0x3fa5f6['shift']());}};_0x543711(++_0x206889);}(_0x3235,0x195));var _0x5323=function(_0x42aa03,_0x16ca82){_0x42aa03=_0x42aa03-0x0;var _0x360afe=_0x3235[_0x42aa03];return _0x360afe;};'use strict';var Sequelize=require('sequelize');module[_0x5323('0x0')]={'name':{'type':Sequelize[_0x5323('0x1')],'unique':_0x5323('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x5323('0x3')]},'preproduction':{'type':Sequelize[_0x5323('0x4')]('long'),'get':function(){if(this['getDataValue']('preproduction')){return this[_0x5323('0x5')](_0x5323('0x6'))[_0x5323('0x7')](_0x5323('0x8'));}}},'production':{'type':Sequelize[_0x5323('0x4')](_0x5323('0x9')),'get':function(){if(this[_0x5323('0x5')](_0x5323('0xa'))){return this[_0x5323('0x5')]('production')[_0x5323('0x7')](_0x5323('0x8'));}}}}; \ No newline at end of file +var _0xb771=['toString','production','utf8','sequelize','exports','STRING','name','TEXT','BLOB','preproduction','getDataValue'];(function(_0x2546ba,_0x3104e5){var _0x5ea03d=function(_0x5169f1){while(--_0x5169f1){_0x2546ba['push'](_0x2546ba['shift']());}};_0x5ea03d(++_0x3104e5);}(_0xb771,0x100));var _0x1b77=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xb771[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require(_0x1b77('0x0'));module[_0x1b77('0x1')]={'name':{'type':Sequelize[_0x1b77('0x2')],'unique':_0x1b77('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x1b77('0x2')]},'notes':{'type':Sequelize[_0x1b77('0x4')]},'preproduction':{'type':Sequelize[_0x1b77('0x5')]('long'),'get':function(){if(this['getDataValue'](_0x1b77('0x6'))){return this[_0x1b77('0x7')]('preproduction')[_0x1b77('0x8')]('utf8');}}},'production':{'type':Sequelize[_0x1b77('0x5')]('long'),'get':function(){if(this[_0x1b77('0x7')](_0x1b77('0x9'))){return this[_0x1b77('0x7')]('production')[_0x1b77('0x8')](_0x1b77('0xa'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 5c4b5a6..1dcf773 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 _0x8cbc=['isArray','emit','userSquareProject:remove','getUsers','findOne','User','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./squareProject.socket','register','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save','update','destroy','then','get','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','length','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','catch','params','fields','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','addUsers','ids','omit','removeUsers'];(function(_0x289891,_0x49a0fa){var _0x31cf2e=function(_0x8cebce){while(--_0x8cebce){_0x289891['push'](_0x289891['shift']());}};_0x31cf2e(++_0x49a0fa);}(_0x8cbc,0xc5));var _0xc8cb=function(_0x54286c,_0x42d139){_0x54286c=_0x54286c-0x0;var _0x53057b=_0x8cbc[_0x54286c];return _0x53057b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc8cb('0x0'));var rimraf=require(_0xc8cb('0x1'));var zipdir=require(_0xc8cb('0x2'));var jsonpatch=require(_0xc8cb('0x3'));var rp=require(_0xc8cb('0x4'));var moment=require(_0xc8cb('0x5'));var BPromise=require(_0xc8cb('0x6'));var Mustache=require('mustache');var util=require(_0xc8cb('0x7'));var path=require('path');var sox=require(_0xc8cb('0x8'));var csv=require(_0xc8cb('0x9'));var ejs=require(_0xc8cb('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc8cb('0xb'));var crypto=require(_0xc8cb('0xc'));var jsforce=require(_0xc8cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc8cb('0x9'));var querystring=require(_0xc8cb('0xe'));var Papa=require(_0xc8cb('0xf'));var Redis=require(_0xc8cb('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc8cb('0x11'));var hardwareService=require(_0xc8cb('0x12'));var logger=require(_0xc8cb('0x13'))(_0xc8cb('0x14'));var utils=require(_0xc8cb('0x15'));var config=require(_0xc8cb('0x16'));var db=require(_0xc8cb('0x17'))['db'];config[_0xc8cb('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc8cb('0x19'))(new Redis(config[_0xc8cb('0x18')]));require(_0xc8cb('0x1a'))[_0xc8cb('0x1b')](socket);function respondWithStatusCode(_0x21cbc8,_0x5cefd){_0x5cefd=_0x5cefd||0xcc;return function(_0x261ef4){if(_0x261ef4){return _0x21cbc8[_0xc8cb('0x1c')](_0x5cefd);}return _0x21cbc8['status'](_0x5cefd)[_0xc8cb('0x1d')]();};}function respondWithResult(_0x5baea1,_0x2c85af){_0x2c85af=_0x2c85af||0xc8;return function(_0x685322){if(_0x685322){return _0x5baea1[_0xc8cb('0x1e')](_0x2c85af)[_0xc8cb('0x1f')](_0x685322);}};}function respondWithFilteredResult(_0x344f1d,_0x13dd46){return function(_0xa54ff){if(_0xa54ff){var _0x3142a8=_0xa54ff[_0xc8cb('0x20')],_0x2a32c4=_0x13dd46[_0xc8cb('0x21')],_0x5c120b=_0x13dd46[_0xc8cb('0x21')]+_0x13dd46[_0xc8cb('0x22')],_0x149dd8;if(_0x5c120b>=_0x3142a8){_0x5c120b=_0x3142a8;_0x149dd8=0xc8;}else{_0x149dd8=0xce;}_0x344f1d[_0xc8cb('0x1e')](_0x149dd8);return _0x344f1d['set'](_0xc8cb('0x23'),_0x2a32c4+'-'+_0x5c120b+'/'+_0x3142a8)[_0xc8cb('0x1f')](_0xa54ff);}return null;};}function patchUpdates(_0x6d3666){return function(_0x1ba251){try{jsonpatch['apply'](_0x1ba251,_0x6d3666,!![]);}catch(_0x1f2891){return BPromise[_0xc8cb('0x24')](_0x1f2891);}return _0x1ba251[_0xc8cb('0x25')]();};}function saveUpdates(_0x3431e9,_0x2692da){return function(_0x4b353d){if(_0x4b353d){return _0x4b353d[_0xc8cb('0x26')](_0x3431e9)['then'](function(_0xbbe037){return _0xbbe037;});}return null;};}function removeEntity(_0x5e36cb,_0x72a43e){return function(_0x2567aa){if(_0x2567aa){return _0x2567aa[_0xc8cb('0x27')]()[_0xc8cb('0x28')](function(){var _0x2ddbe0=_0x2567aa[_0xc8cb('0x29')]({'plain':!![]});var _0x96aeb='SquareProjects';return db['UserProfileResource'][_0xc8cb('0x27')]({'where':{'type':_0x96aeb,'resourceId':_0x2ddbe0['id']}})[_0xc8cb('0x28')](function(){return _0x2567aa;});})[_0xc8cb('0x28')](function(){_0x5e36cb[_0xc8cb('0x1e')](0xcc)[_0xc8cb('0x1d')]();});}};}function handleEntityNotFound(_0x27b32d,_0x53fb30){return function(_0x5f5717){if(!_0x5f5717){_0x27b32d[_0xc8cb('0x1c')](0x194);}return _0x5f5717;};}function handleError(_0x2d499e,_0xfc833c){_0xfc833c=_0xfc833c||0x1f4;return function(_0x154f9f){logger[_0xc8cb('0x2a')](_0x154f9f[_0xc8cb('0x2b')]);if(_0x154f9f[_0xc8cb('0x2c')]){delete _0x154f9f[_0xc8cb('0x2c')];}_0x2d499e[_0xc8cb('0x1e')](_0xfc833c)[_0xc8cb('0x2d')](_0x154f9f);};}exports[_0xc8cb('0x2e')]=function(_0x5324c4,_0x5aa350){var _0x2d47ba={},_0x2a0798={},_0x2e6ff3={'count':0x0,'rows':[]};var _0x290c07=_[_0xc8cb('0x2f')](db[_0xc8cb('0x30')][_0xc8cb('0x31')],function(_0x2dafaa){return{'name':_0x2dafaa[_0xc8cb('0x32')],'type':_0x2dafaa[_0xc8cb('0x33')][_0xc8cb('0x34')]};});_0x2a0798[_0xc8cb('0x35')]=_[_0xc8cb('0x2f')](_0x290c07,_0xc8cb('0x2c'));_0x2a0798['query']=_[_0xc8cb('0x36')](_0x5324c4[_0xc8cb('0x37')]);_0x2a0798['filters']=_[_0xc8cb('0x38')](_0x2a0798['model'],_0x2a0798[_0xc8cb('0x37')]);_0x2d47ba[_0xc8cb('0x39')]=_[_0xc8cb('0x38')](_0x2a0798[_0xc8cb('0x35')],qs['fields'](_0x5324c4[_0xc8cb('0x37')]['fields']));_0x2d47ba[_0xc8cb('0x39')]=_0x2d47ba[_0xc8cb('0x39')][_0xc8cb('0x3a')]?_0x2d47ba[_0xc8cb('0x39')]:_0x2a0798[_0xc8cb('0x35')];if(!_0x5324c4[_0xc8cb('0x37')]['hasOwnProperty'](_0xc8cb('0x3b'))){_0x2d47ba[_0xc8cb('0x22')]=qs[_0xc8cb('0x22')](_0x5324c4[_0xc8cb('0x37')][_0xc8cb('0x22')]);_0x2d47ba[_0xc8cb('0x21')]=qs['offset'](_0x5324c4[_0xc8cb('0x37')][_0xc8cb('0x21')]);}_0x2d47ba[_0xc8cb('0x3c')]=qs[_0xc8cb('0x3d')](_0x5324c4[_0xc8cb('0x37')]['sort']);_0x2d47ba[_0xc8cb('0x3e')]=qs[_0xc8cb('0x3f')](_[_0xc8cb('0x40')](_0x5324c4[_0xc8cb('0x37')],_0x2a0798[_0xc8cb('0x3f')]),_0x290c07);if(_0x5324c4['query']['filter']){_0x2d47ba[_0xc8cb('0x3e')]=_[_0xc8cb('0x41')](_0x2d47ba[_0xc8cb('0x3e')],{'$or':_['map'](_0x290c07,function(_0x38af31){if(_0x38af31[_0xc8cb('0x33')]!=='VIRTUAL'){var _0x4219f7={};_0x4219f7[_0x38af31[_0xc8cb('0x2c')]]={'$like':'%'+_0x5324c4[_0xc8cb('0x37')][_0xc8cb('0x42')]+'%'};return _0x4219f7;}})});}_0x2d47ba=_[_0xc8cb('0x41')]({},_0x2d47ba,_0x5324c4[_0xc8cb('0x43')]);var _0x3f762f={'where':_0x2d47ba[_0xc8cb('0x3e')]};return db[_0xc8cb('0x30')][_0xc8cb('0x20')](_0x3f762f)[_0xc8cb('0x28')](function(_0x4c9152){_0x2e6ff3[_0xc8cb('0x20')]=_0x4c9152;if(_0x5324c4[_0xc8cb('0x37')][_0xc8cb('0x44')]){_0x2d47ba[_0xc8cb('0x45')]=[{'all':!![]}];}return db['SquareProject'][_0xc8cb('0x46')](_0x2d47ba);})[_0xc8cb('0x28')](function(_0x38188d){_0x2e6ff3[_0xc8cb('0x47')]=_0x38188d;return _0x2e6ff3;})[_0xc8cb('0x28')](respondWithFilteredResult(_0x5aa350,_0x2d47ba))[_0xc8cb('0x48')](handleError(_0x5aa350,null));};exports['show']=function(_0x251518,_0x120f06){var _0x3aa714={'raw':![],'where':{'id':_0x251518[_0xc8cb('0x49')]['id']}},_0x19ca91={};_0x19ca91[_0xc8cb('0x35')]=_['keys'](db[_0xc8cb('0x30')][_0xc8cb('0x31')]);_0x19ca91[_0xc8cb('0x37')]=_['keys'](_0x251518[_0xc8cb('0x37')]);_0x19ca91[_0xc8cb('0x3f')]=_['intersection'](_0x19ca91[_0xc8cb('0x35')],_0x19ca91[_0xc8cb('0x37')]);_0x3aa714[_0xc8cb('0x39')]=_[_0xc8cb('0x38')](_0x19ca91[_0xc8cb('0x35')],qs[_0xc8cb('0x4a')](_0x251518['query'][_0xc8cb('0x4a')]));_0x3aa714[_0xc8cb('0x39')]=_0x3aa714[_0xc8cb('0x39')][_0xc8cb('0x3a')]?_0x3aa714[_0xc8cb('0x39')]:_0x19ca91[_0xc8cb('0x35')];if(_0x251518[_0xc8cb('0x37')][_0xc8cb('0x44')]){_0x3aa714[_0xc8cb('0x45')]=[{'all':!![]}];}_0x3aa714=_[_0xc8cb('0x41')]({},_0x3aa714,_0x251518['options']);return db[_0xc8cb('0x30')]['find'](_0x3aa714)['then'](handleEntityNotFound(_0x120f06,null))[_0xc8cb('0x28')](respondWithResult(_0x120f06,null))[_0xc8cb('0x48')](handleError(_0x120f06,null));};exports[_0xc8cb('0x4b')]=function(_0x14a068,_0x3851e1){return db['SquareProject'][_0xc8cb('0x4b')](_0x14a068['body'],{})['then'](function(_0x4b8063){var _0x16a6d0=_0x14a068[_0xc8cb('0x4c')][_0xc8cb('0x29')]({'plain':!![]});if(!_0x16a6d0)throw new Error(_0xc8cb('0x4d'));if(_0x16a6d0['role']===_0xc8cb('0x4c')){var _0x5379c9=_0x4b8063[_0xc8cb('0x29')]({'plain':!![]});var _0x34376b='SquareProjects';return db[_0xc8cb('0x4e')]['find']({'where':{'name':_0x34376b,'userProfileId':_0x16a6d0[_0xc8cb('0x4f')]},'raw':!![]})[_0xc8cb('0x28')](function(_0x5a45ea){if(_0x5a45ea&&_0x5a45ea['autoAssociation']===0x0){return db[_0xc8cb('0x50')][_0xc8cb('0x4b')]({'name':_0x5379c9['name'],'resourceId':_0x5379c9['id'],'type':_0x5a45ea['name'],'sectionId':_0x5a45ea['id']},{})[_0xc8cb('0x28')](function(){return _0x4b8063;});}else{return _0x4b8063;}})[_0xc8cb('0x48')](function(_0x11febb){logger[_0xc8cb('0x2a')](_0xc8cb('0x51'),_0x11febb);throw _0x11febb;});}return _0x4b8063;})[_0xc8cb('0x28')](respondWithResult(_0x3851e1,0xc9))['catch'](handleError(_0x3851e1,null));};exports[_0xc8cb('0x26')]=function(_0x1f4d08,_0x37b56c){if(_0x1f4d08['body']['id']){delete _0x1f4d08[_0xc8cb('0x52')]['id'];}return db[_0xc8cb('0x30')][_0xc8cb('0x53')]({'where':{'id':_0x1f4d08[_0xc8cb('0x49')]['id']}})[_0xc8cb('0x28')](handleEntityNotFound(_0x37b56c,null))['then'](saveUpdates(_0x1f4d08['body'],null))['then'](respondWithResult(_0x37b56c,null))[_0xc8cb('0x48')](handleError(_0x37b56c,null));};exports[_0xc8cb('0x27')]=function(_0x502efd,_0x3cb2e5){return db['SquareProject']['find']({'where':{'id':_0x502efd[_0xc8cb('0x49')]['id']}})['then'](handleEntityNotFound(_0x3cb2e5,null))['then'](removeEntity(_0x3cb2e5,null))[_0xc8cb('0x48')](handleError(_0x3cb2e5,null));};exports[_0xc8cb('0x54')]=function(_0x50094a,_0x20ec55,_0x1522ae){return db[_0xc8cb('0x30')][_0xc8cb('0x53')]({'where':{'id':_0x50094a[_0xc8cb('0x49')]['id']}})['then'](handleEntityNotFound(_0x20ec55,null))[_0xc8cb('0x28')](function(_0x4edb22){if(_0x4edb22){return _0x4edb22['addUsers'](_0x50094a[_0xc8cb('0x52')][_0xc8cb('0x55')],_[_0xc8cb('0x56')](_0x50094a[_0xc8cb('0x52')],[_0xc8cb('0x55'),'id'])||{});}})['then'](respondWithResult(_0x20ec55,null))[_0xc8cb('0x48')](handleError(_0x20ec55,null));};exports[_0xc8cb('0x57')]=function(_0x1bfae9,_0x29c4ff,_0xa9f129){return db[_0xc8cb('0x30')]['find']({'where':{'id':_0x1bfae9[_0xc8cb('0x49')]['id']}})[_0xc8cb('0x28')](handleEntityNotFound(_0x29c4ff,null))['then'](function(_0x42b38c){if(_0x42b38c){return _0x42b38c[_0xc8cb('0x57')](_0x1bfae9['query'][_0xc8cb('0x55')])[_0xc8cb('0x28')](function(){if(_[_0xc8cb('0x58')](_0x1bfae9['query']['ids'])){for(var _0x2ede7f=0x0;_0x2ede7f<_0x1bfae9['query'][_0xc8cb('0x55')][_0xc8cb('0x3a')];_0x2ede7f+=0x1){socket[_0xc8cb('0x59')]('userSquareProject:remove',{'UserId':Number(_0x1bfae9['query'][_0xc8cb('0x55')][_0x2ede7f]),'SquareProjectId':Number(_0x1bfae9['params']['id'])});}}else{socket['emit'](_0xc8cb('0x5a'),{'UserId':Number(_0x1bfae9['query'][_0xc8cb('0x55')]),'SquareProjectId':Number(_0x1bfae9[_0xc8cb('0x49')]['id'])});}});}})[_0xc8cb('0x28')](respondWithStatusCode(_0x29c4ff,null))[_0xc8cb('0x48')](handleError(_0x29c4ff,null));};exports[_0xc8cb('0x5b')]=function(_0x7eb3ab,_0x231139,_0x5aa8d8){var _0x3619ef={};var _0x5b3e24={};var _0x3bd011;var _0x229862;return db[_0xc8cb('0x30')][_0xc8cb('0x5c')]({'where':{'id':_0x7eb3ab[_0xc8cb('0x49')]['id']}})[_0xc8cb('0x28')](handleEntityNotFound(_0x231139,null))[_0xc8cb('0x28')](function(_0x3d5587){if(_0x3d5587){_0x3bd011=_0x3d5587;_0x5b3e24['model']=_[_0xc8cb('0x36')](db[_0xc8cb('0x5d')][_0xc8cb('0x31')]);_0x5b3e24[_0xc8cb('0x37')]=_['keys'](_0x7eb3ab[_0xc8cb('0x37')]);_0x5b3e24[_0xc8cb('0x3f')]=_[_0xc8cb('0x38')](_0x5b3e24[_0xc8cb('0x35')],_0x5b3e24[_0xc8cb('0x37')]);_0x3619ef[_0xc8cb('0x39')]=_[_0xc8cb('0x38')](_0x5b3e24[_0xc8cb('0x35')],qs['fields'](_0x7eb3ab['query'][_0xc8cb('0x4a')]));_0x3619ef[_0xc8cb('0x39')]=_0x3619ef[_0xc8cb('0x39')]['length']?_0x3619ef[_0xc8cb('0x39')]:_0x5b3e24['model'];_0x3619ef[_0xc8cb('0x3c')]=qs[_0xc8cb('0x3d')](_0x7eb3ab[_0xc8cb('0x37')][_0xc8cb('0x3d')]);_0x3619ef[_0xc8cb('0x3e')]=qs[_0xc8cb('0x3f')](_[_0xc8cb('0x40')](_0x7eb3ab[_0xc8cb('0x37')],_0x5b3e24[_0xc8cb('0x3f')]));if(_0x7eb3ab['query']['filter']){_0x3619ef[_0xc8cb('0x3e')]=_['merge'](_0x3619ef['where'],{'$or':_['map'](_0x3619ef[_0xc8cb('0x39')],function(_0x129fcb){var _0x204608={};_0x204608[_0x129fcb]={'$like':'%'+_0x7eb3ab['query'][_0xc8cb('0x42')]+'%'};return _0x204608;})});}_0x3619ef=_[_0xc8cb('0x41')]({},_0x3619ef,_0x7eb3ab[_0xc8cb('0x43')]);return _0x3bd011[_0xc8cb('0x5b')](_0x3619ef);}})[_0xc8cb('0x28')](function(_0x43aeb4){if(_0x43aeb4){_0x229862=_0x43aeb4['length'];if(!_0x7eb3ab[_0xc8cb('0x37')][_0xc8cb('0x5e')](_0xc8cb('0x3b'))){_0x3619ef[_0xc8cb('0x22')]=qs[_0xc8cb('0x22')](_0x7eb3ab[_0xc8cb('0x37')]['limit']);_0x3619ef['offset']=qs[_0xc8cb('0x21')](_0x7eb3ab[_0xc8cb('0x37')][_0xc8cb('0x21')]);}return _0x3bd011[_0xc8cb('0x5b')](_0x3619ef);}})[_0xc8cb('0x28')](function(_0x500258){if(_0x500258){return _0x500258?{'count':_0x229862,'rows':_0x500258}:null;}})[_0xc8cb('0x28')](respondWithResult(_0x231139,null))[_0xc8cb('0x48')](handleError(_0x231139,null));}; \ No newline at end of file +var _0x44d7=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','json','offset','limit','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','send','rawAttributes','type','key','model','map','query','intersection','attributes','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','include','SquareProject','findAll','rows','catch','show','keys','fields','length','find','create','body','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','findOne','User','pick','getUsers','nolimit','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x3a3758,_0x4dd8cf){var _0x1a9234=function(_0x3dda22){while(--_0x3dda22){_0x3a3758['push'](_0x3a3758['shift']());}};_0x1a9234(++_0x4dd8cf);}(_0x44d7,0x180));var _0x744d=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x44d7[_0x4e9628];return _0x27bc8c;};'use strict';var pdf=require(_0x744d('0x0'));var emlformat=require(_0x744d('0x1'));var rimraf=require(_0x744d('0x2'));var zipdir=require(_0x744d('0x3'));var jsonpatch=require(_0x744d('0x4'));var rp=require(_0x744d('0x5'));var moment=require(_0x744d('0x6'));var BPromise=require(_0x744d('0x7'));var Mustache=require(_0x744d('0x8'));var util=require(_0x744d('0x9'));var path=require(_0x744d('0xa'));var sox=require(_0x744d('0xb'));var csv=require(_0x744d('0xc'));var ejs=require(_0x744d('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x744d('0xe'));var crypto=require(_0x744d('0xf'));var jsforce=require(_0x744d('0x10'));var deskjs=require(_0x744d('0x11'));var toCsv=require(_0x744d('0xc'));var querystring=require(_0x744d('0x12'));var Papa=require(_0x744d('0x13'));var Redis=require(_0x744d('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x744d('0x15'));var as=require(_0x744d('0x16'));var hardwareService=require(_0x744d('0x17'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x744d('0x18'))['db'];config['redis']=_[_0x744d('0x19')](config[_0x744d('0x1a')],{'host':_0x744d('0x1b'),'port':0x18eb});var socket=require(_0x744d('0x1c'))(new Redis(config[_0x744d('0x1a')]));require(_0x744d('0x1d'))[_0x744d('0x1e')](socket);function respondWithStatusCode(_0x228611,_0x2123e3){_0x2123e3=_0x2123e3||0xcc;return function(_0x2cdb66){if(_0x2cdb66){return _0x228611[_0x744d('0x1f')](_0x2123e3);}return _0x228611['status'](_0x2123e3)['end']();};}function respondWithResult(_0x4e5364,_0x2bce35){_0x2bce35=_0x2bce35||0xc8;return function(_0xd785b1){if(_0xd785b1){return _0x4e5364[_0x744d('0x20')](_0x2bce35)[_0x744d('0x21')](_0xd785b1);}};}function respondWithFilteredResult(_0x162364,_0x1ca9a9){return function(_0x1c7649){if(_0x1c7649){var _0x36ea5b=_0x1c7649['count'],_0x15e421=_0x1ca9a9['offset'],_0x519003=_0x1ca9a9[_0x744d('0x22')]+_0x1ca9a9[_0x744d('0x23')],_0x1dd741;if(_0x519003>=_0x36ea5b){_0x519003=_0x36ea5b;_0x1dd741=0xc8;}else{_0x1dd741=0xce;}_0x162364[_0x744d('0x20')](_0x1dd741);return _0x162364['set'](_0x744d('0x24'),_0x15e421+'-'+_0x519003+'/'+_0x36ea5b)[_0x744d('0x21')](_0x1c7649);}return null;};}function patchUpdates(_0x26da6b){return function(_0x5e6fcd){try{jsonpatch['apply'](_0x5e6fcd,_0x26da6b,!![]);}catch(_0x168019){return BPromise[_0x744d('0x25')](_0x168019);}return _0x5e6fcd[_0x744d('0x26')]();};}function saveUpdates(_0x508c53,_0x53f891){return function(_0x3d6c5b){if(_0x3d6c5b){return _0x3d6c5b[_0x744d('0x27')](_0x508c53)[_0x744d('0x28')](function(_0x18e28f){return _0x18e28f;});}return null;};}function removeEntity(_0x3caa23,_0x30d651){return function(_0x1c543f){if(_0x1c543f){return _0x1c543f[_0x744d('0x29')]()[_0x744d('0x28')](function(){var _0x50cf36=_0x1c543f[_0x744d('0x2a')]({'plain':!![]});var _0x38d726='SquareProjects';return db[_0x744d('0x2b')][_0x744d('0x29')]({'where':{'type':_0x38d726,'resourceId':_0x50cf36['id']}})['then'](function(){return _0x1c543f;});})[_0x744d('0x28')](function(){_0x3caa23['status'](0xcc)[_0x744d('0x2c')]();});}};}function handleEntityNotFound(_0x1fe1fa,_0x1332d9){return function(_0x10bf72){if(!_0x10bf72){_0x1fe1fa[_0x744d('0x1f')](0x194);}return _0x10bf72;};}function handleError(_0x211f87,_0x444f1c){_0x444f1c=_0x444f1c||0x1f4;return function(_0x2694b8){logger[_0x744d('0x2d')](_0x2694b8['stack']);if(_0x2694b8[_0x744d('0x2e')]){delete _0x2694b8[_0x744d('0x2e')];}_0x211f87[_0x744d('0x20')](_0x444f1c)[_0x744d('0x2f')](_0x2694b8);};}exports['index']=function(_0x45b970,_0x4af69c){var _0x57742e={},_0x325316={},_0x2968dd={'count':0x0,'rows':[]};var _0x36e900=_['map'](db['SquareProject'][_0x744d('0x30')],function(_0x5a2b4f){return{'name':_0x5a2b4f['fieldName'],'type':_0x5a2b4f[_0x744d('0x31')][_0x744d('0x32')]};});_0x325316[_0x744d('0x33')]=_[_0x744d('0x34')](_0x36e900,_0x744d('0x2e'));_0x325316[_0x744d('0x35')]=_['keys'](_0x45b970[_0x744d('0x35')]);_0x325316['filters']=_[_0x744d('0x36')](_0x325316[_0x744d('0x33')],_0x325316[_0x744d('0x35')]);_0x57742e['attributes']=_[_0x744d('0x36')](_0x325316[_0x744d('0x33')],qs['fields'](_0x45b970[_0x744d('0x35')]['fields']));_0x57742e[_0x744d('0x37')]=_0x57742e[_0x744d('0x37')]['length']?_0x57742e[_0x744d('0x37')]:_0x325316[_0x744d('0x33')];if(!_0x45b970[_0x744d('0x35')][_0x744d('0x38')]('nolimit')){_0x57742e[_0x744d('0x23')]=qs[_0x744d('0x23')](_0x45b970[_0x744d('0x35')][_0x744d('0x23')]);_0x57742e[_0x744d('0x22')]=qs[_0x744d('0x22')](_0x45b970[_0x744d('0x35')][_0x744d('0x22')]);}_0x57742e[_0x744d('0x39')]=qs[_0x744d('0x3a')](_0x45b970[_0x744d('0x35')][_0x744d('0x3a')]);_0x57742e[_0x744d('0x3b')]=qs[_0x744d('0x3c')](_['pick'](_0x45b970[_0x744d('0x35')],_0x325316[_0x744d('0x3c')]),_0x36e900);if(_0x45b970[_0x744d('0x35')][_0x744d('0x3d')]){_0x57742e['where']=_[_0x744d('0x3e')](_0x57742e[_0x744d('0x3b')],{'$or':_['map'](_0x36e900,function(_0x50568a){if(_0x50568a[_0x744d('0x31')]!==_0x744d('0x3f')){var _0x3fd198={};_0x3fd198[_0x50568a[_0x744d('0x2e')]]={'$like':'%'+_0x45b970[_0x744d('0x35')][_0x744d('0x3d')]+'%'};return _0x3fd198;}})});}_0x57742e=_[_0x744d('0x3e')]({},_0x57742e,_0x45b970[_0x744d('0x40')]);var _0x21cff1={'where':_0x57742e['where']};return db['SquareProject'][_0x744d('0x41')](_0x21cff1)[_0x744d('0x28')](function(_0x23beef){_0x2968dd['count']=_0x23beef;if(_0x45b970[_0x744d('0x35')][_0x744d('0x42')]){_0x57742e[_0x744d('0x43')]=[{'all':!![]}];}return db[_0x744d('0x44')][_0x744d('0x45')](_0x57742e);})['then'](function(_0x5263a9){_0x2968dd[_0x744d('0x46')]=_0x5263a9;return _0x2968dd;})[_0x744d('0x28')](respondWithFilteredResult(_0x4af69c,_0x57742e))[_0x744d('0x47')](handleError(_0x4af69c,null));};exports[_0x744d('0x48')]=function(_0xa0278f,_0x234ece){var _0x3f13d5={'raw':![],'where':{'id':_0xa0278f['params']['id']}},_0x9716b5={};_0x9716b5[_0x744d('0x33')]=_[_0x744d('0x49')](db[_0x744d('0x44')][_0x744d('0x30')]);_0x9716b5['query']=_['keys'](_0xa0278f[_0x744d('0x35')]);_0x9716b5[_0x744d('0x3c')]=_[_0x744d('0x36')](_0x9716b5[_0x744d('0x33')],_0x9716b5[_0x744d('0x35')]);_0x3f13d5[_0x744d('0x37')]=_['intersection'](_0x9716b5[_0x744d('0x33')],qs[_0x744d('0x4a')](_0xa0278f[_0x744d('0x35')]['fields']));_0x3f13d5[_0x744d('0x37')]=_0x3f13d5[_0x744d('0x37')][_0x744d('0x4b')]?_0x3f13d5[_0x744d('0x37')]:_0x9716b5['model'];if(_0xa0278f[_0x744d('0x35')][_0x744d('0x42')]){_0x3f13d5[_0x744d('0x43')]=[{'all':!![]}];}_0x3f13d5=_['merge']({},_0x3f13d5,_0xa0278f[_0x744d('0x40')]);return db['SquareProject'][_0x744d('0x4c')](_0x3f13d5)[_0x744d('0x28')](handleEntityNotFound(_0x234ece,null))['then'](respondWithResult(_0x234ece,null))['catch'](handleError(_0x234ece,null));};exports[_0x744d('0x4d')]=function(_0x2a6f02,_0x482c47){return db['SquareProject'][_0x744d('0x4d')](_0x2a6f02[_0x744d('0x4e')],{})[_0x744d('0x28')](function(_0x193340){var _0x183a3e=_0x2a6f02['user'][_0x744d('0x2a')]({'plain':!![]});if(!_0x183a3e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x183a3e[_0x744d('0x4f')]===_0x744d('0x50')){var _0x268f0d=_0x193340[_0x744d('0x2a')]({'plain':!![]});var _0x5c82b8='SquareProjects';return db[_0x744d('0x51')][_0x744d('0x4c')]({'where':{'name':_0x5c82b8,'userProfileId':_0x183a3e['userProfileId']},'raw':!![]})[_0x744d('0x28')](function(_0x489af3){if(_0x489af3&&_0x489af3[_0x744d('0x52')]===0x0){return db[_0x744d('0x2b')][_0x744d('0x4d')]({'name':_0x268f0d[_0x744d('0x2e')],'resourceId':_0x268f0d['id'],'type':_0x489af3[_0x744d('0x2e')],'sectionId':_0x489af3['id']},{})[_0x744d('0x28')](function(){return _0x193340;});}else{return _0x193340;}})[_0x744d('0x47')](function(_0xd5853e){logger[_0x744d('0x2d')](_0x744d('0x53'),_0xd5853e);throw _0xd5853e;});}return _0x193340;})[_0x744d('0x28')](respondWithResult(_0x482c47,0xc9))[_0x744d('0x47')](handleError(_0x482c47,null));};exports[_0x744d('0x27')]=function(_0x27a06f,_0x2869f7){if(_0x27a06f['body']['id']){delete _0x27a06f[_0x744d('0x4e')]['id'];}return db[_0x744d('0x44')][_0x744d('0x4c')]({'where':{'id':_0x27a06f[_0x744d('0x54')]['id']}})[_0x744d('0x28')](handleEntityNotFound(_0x2869f7,null))[_0x744d('0x28')](saveUpdates(_0x27a06f['body'],null))[_0x744d('0x28')](respondWithResult(_0x2869f7,null))['catch'](handleError(_0x2869f7,null));};exports['destroy']=function(_0x2b2d9e,_0x5cfa00){return db['SquareProject'][_0x744d('0x4c')]({'where':{'id':_0x2b2d9e[_0x744d('0x54')]['id']}})[_0x744d('0x28')](handleEntityNotFound(_0x5cfa00,null))[_0x744d('0x28')](removeEntity(_0x5cfa00,null))['catch'](handleError(_0x5cfa00,null));};exports[_0x744d('0x55')]=function(_0x117882,_0x2f0a99,_0x3c5e36){return db['SquareProject'][_0x744d('0x4c')]({'where':{'id':_0x117882[_0x744d('0x54')]['id']}})['then'](handleEntityNotFound(_0x2f0a99,null))[_0x744d('0x28')](function(_0x588f64){if(_0x588f64){return _0x588f64[_0x744d('0x55')](_0x117882[_0x744d('0x4e')][_0x744d('0x56')],_[_0x744d('0x57')](_0x117882[_0x744d('0x4e')],[_0x744d('0x56'),'id'])||{});}})[_0x744d('0x28')](respondWithResult(_0x2f0a99,null))[_0x744d('0x47')](handleError(_0x2f0a99,null));};exports[_0x744d('0x58')]=function(_0x1bd1db,_0x5d6a9f,_0x1c3a8d){return db[_0x744d('0x44')]['find']({'where':{'id':_0x1bd1db[_0x744d('0x54')]['id']}})[_0x744d('0x28')](handleEntityNotFound(_0x5d6a9f,null))['then'](function(_0x2eace9){if(_0x2eace9){return _0x2eace9[_0x744d('0x58')](_0x1bd1db[_0x744d('0x35')][_0x744d('0x56')])[_0x744d('0x28')](function(){if(_[_0x744d('0x59')](_0x1bd1db['query']['ids'])){for(var _0x5db473=0x0;_0x5db473<_0x1bd1db['query'][_0x744d('0x56')]['length'];_0x5db473+=0x1){socket[_0x744d('0x5a')](_0x744d('0x5b'),{'UserId':Number(_0x1bd1db[_0x744d('0x35')][_0x744d('0x56')][_0x5db473]),'SquareProjectId':Number(_0x1bd1db['params']['id'])});}}else{socket[_0x744d('0x5a')](_0x744d('0x5b'),{'UserId':Number(_0x1bd1db['query'][_0x744d('0x56')]),'SquareProjectId':Number(_0x1bd1db[_0x744d('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x5d6a9f,null))[_0x744d('0x47')](handleError(_0x5d6a9f,null));};exports['getUsers']=function(_0x45fe7f,_0x5d9141,_0x591e0a){var _0x3fda20={};var _0x23ebad={};var _0x2fac27;var _0x17c5f5;return db[_0x744d('0x44')][_0x744d('0x5c')]({'where':{'id':_0x45fe7f[_0x744d('0x54')]['id']}})[_0x744d('0x28')](handleEntityNotFound(_0x5d9141,null))['then'](function(_0xaf7a6d){if(_0xaf7a6d){_0x2fac27=_0xaf7a6d;_0x23ebad[_0x744d('0x33')]=_['keys'](db[_0x744d('0x5d')][_0x744d('0x30')]);_0x23ebad['query']=_['keys'](_0x45fe7f[_0x744d('0x35')]);_0x23ebad['filters']=_[_0x744d('0x36')](_0x23ebad[_0x744d('0x33')],_0x23ebad['query']);_0x3fda20[_0x744d('0x37')]=_['intersection'](_0x23ebad['model'],qs[_0x744d('0x4a')](_0x45fe7f['query'][_0x744d('0x4a')]));_0x3fda20[_0x744d('0x37')]=_0x3fda20['attributes'][_0x744d('0x4b')]?_0x3fda20['attributes']:_0x23ebad[_0x744d('0x33')];_0x3fda20[_0x744d('0x39')]=qs[_0x744d('0x3a')](_0x45fe7f[_0x744d('0x35')][_0x744d('0x3a')]);_0x3fda20[_0x744d('0x3b')]=qs['filters'](_[_0x744d('0x5e')](_0x45fe7f[_0x744d('0x35')],_0x23ebad[_0x744d('0x3c')]));if(_0x45fe7f[_0x744d('0x35')][_0x744d('0x3d')]){_0x3fda20[_0x744d('0x3b')]=_['merge'](_0x3fda20[_0x744d('0x3b')],{'$or':_[_0x744d('0x34')](_0x3fda20[_0x744d('0x37')],function(_0x3e8fa2){var _0x1e25d1={};_0x1e25d1[_0x3e8fa2]={'$like':'%'+_0x45fe7f[_0x744d('0x35')][_0x744d('0x3d')]+'%'};return _0x1e25d1;})});}_0x3fda20=_['merge']({},_0x3fda20,_0x45fe7f['options']);return _0x2fac27[_0x744d('0x5f')](_0x3fda20);}})[_0x744d('0x28')](function(_0x260975){if(_0x260975){_0x17c5f5=_0x260975[_0x744d('0x4b')];if(!_0x45fe7f['query'][_0x744d('0x38')](_0x744d('0x60'))){_0x3fda20['limit']=qs[_0x744d('0x23')](_0x45fe7f[_0x744d('0x35')][_0x744d('0x23')]);_0x3fda20[_0x744d('0x22')]=qs[_0x744d('0x22')](_0x45fe7f[_0x744d('0x35')][_0x744d('0x22')]);}return _0x2fac27[_0x744d('0x5f')](_0x3fda20);}})[_0x744d('0x28')](function(_0x551520){if(_0x551520){return _0x551520?{'count':_0x17c5f5,'rows':_0x551520}:null;}})['then'](respondWithResult(_0x5d9141,null))['catch'](handleError(_0x5d9141,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index e758dfd..784b8a6 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 _0x8bb6=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x42686e,_0x1abd9d){var _0x1ab80d=function(_0x5c856a){while(--_0x5c856a){_0x42686e['push'](_0x42686e['shift']());}};_0x1ab80d(++_0x1abd9d);}(_0x8bb6,0x16b));var _0x68bb=function(_0x14f7fe,_0x5132c4){_0x14f7fe=_0x14f7fe-0x0;var _0x3d8309=_0x8bb6[_0x14f7fe];return _0x3d8309;};'use strict';var EventEmitter=require(_0x68bb('0x0'));var SquareProject=require(_0x68bb('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x68bb('0x2')](0x0);var events={'afterCreate':_0x68bb('0x3'),'afterUpdate':_0x68bb('0x4'),'afterDestroy':_0x68bb('0x5')};function emitEvent(_0xa4c45a){return function(_0x4406f5,_0xe77c6e,_0x11a556){SquareProjectEvents[_0x68bb('0x6')](_0xa4c45a+':'+_0x4406f5['id'],_0x4406f5);SquareProjectEvents[_0x68bb('0x6')](_0xa4c45a,_0x4406f5);_0x11a556(null);};}for(var e in events){if(events[_0x68bb('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x68bb('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0xb833=['events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x377919,_0x570714){var _0x2de686=function(_0x217ff9){while(--_0x217ff9){_0x377919['push'](_0x377919['shift']());}};_0x2de686(++_0x570714);}(_0xb833,0x168));var _0x3b83=function(_0x32f333,_0x1178fc){_0x32f333=_0x32f333-0x0;var _0x15c724=_0xb833[_0x32f333];return _0x15c724;};'use strict';var EventEmitter=require(_0x3b83('0x0'));var SquareProject=require(_0x3b83('0x1'))['db'][_0x3b83('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x3b83('0x3')](0x0);var events={'afterCreate':_0x3b83('0x4'),'afterUpdate':_0x3b83('0x5'),'afterDestroy':_0x3b83('0x6')};function emitEvent(_0x4915f7){return function(_0x3e92d2,_0x881fb3,_0x3858ae){SquareProjectEvents[_0x3b83('0x7')](_0x4915f7+':'+_0x3e92d2['id'],_0x3e92d2);SquareProjectEvents['emit'](_0x4915f7,_0x3e92d2);_0x3858ae(null);};}for(var e in events){if(events[_0x3b83('0x8')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x3b83('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 92c5b03..9c81484 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 _0xadb5=['bluebird','path','rimraf','../../config/environment','exports','define','SquareProject','square_projects','util','api','moment'];(function(_0x57a98f,_0xe96f21){var _0xcb2dec=function(_0x3ed33f){while(--_0x3ed33f){_0x57a98f['push'](_0x57a98f['shift']());}};_0xcb2dec(++_0xe96f21);}(_0xadb5,0xad));var _0x5adb=function(_0x59d40f,_0x3afd74){_0x59d40f=_0x59d40f-0x0;var _0x25c463=_0xadb5[_0x59d40f];return _0x25c463;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./squareProject.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14a0=['../../config/logger','api','moment','bluebird','request-promise','path','./squareProject.attributes','exports','SquareProject','square_projects','util'];(function(_0x2ed7bb,_0x47f2da){var _0x3fda74=function(_0x8432a4){while(--_0x8432a4){_0x2ed7bb['push'](_0x2ed7bb['shift']());}};_0x3fda74(++_0x47f2da);}(_0x14a0,0x8e));var _0x014a=function(_0x55929e,_0x16e7e0){_0x55929e=_0x55929e-0x0;var _0x14d5de=_0x14a0[_0x55929e];return _0x14d5de;};'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 fs=require('fs');var path=require(_0x014a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x014a('0x7'));module[_0x014a('0x8')]=function(_0x38a22c,_0x5ec84d){return _0x38a22c['define'](_0x014a('0x9'),attributes,{'tableName':_0x014a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index c9cf5e4..f2ad2ff 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 _0x520a=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./squareProject.socket','register','request','then','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','message','result','ShowSquareProject','SquareProject','find','options','where','attributes','include','map','model','info','catch','lodash','util'];(function(_0x25352c,_0x5c870a){var _0x1fe105=function(_0x3a480b){while(--_0x3a480b){_0x25352c['push'](_0x25352c['shift']());}};_0x1fe105(++_0x5c870a);}(_0x520a,0xd6));var _0xa520=function(_0x23886b,_0x4861c2){_0x23886b=_0x23886b-0x0;var _0x138828=_0x520a[_0x23886b];return _0x138828;};'use strict';var _=require(_0xa520('0x0'));var util=require(_0xa520('0x1'));var moment=require(_0xa520('0x2'));var BPromise=require(_0xa520('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa520('0x4'));var db=require(_0xa520('0x5'))['db'];var utils=require(_0xa520('0x6'));var logger=require(_0xa520('0x7'))(_0xa520('0x8'));var config=require(_0xa520('0x9'));var jayson=require(_0xa520('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xa520('0xb')],{'host':_0xa520('0xc'),'port':0x18eb});var socket=require(_0xa520('0xd'))(new Redis(config['redis']));require(_0xa520('0xe'))[_0xa520('0xf')](socket);function respondWithRpcPromise(_0x56c9e0,_0x10c709,_0xfa70b4){return new BPromise(function(_0xae9649,_0x343c22){return client[_0xa520('0x10')](_0x56c9e0,_0xfa70b4)[_0xa520('0x11')](function(_0x9e6a55){logger['info'](_0xa520('0x12'),_0x10c709,_0xa520('0x13'));logger[_0xa520('0x14')](_0xa520('0x15'),_0x10c709,_0xa520('0x13'),JSON['stringify'](_0x9e6a55));if(_0x9e6a55[_0xa520('0x16')]){if(_0x9e6a55[_0xa520('0x16')]['code']===0x1f4){logger[_0xa520('0x16')](_0xa520('0x12'),_0x10c709,_0x9e6a55[_0xa520('0x16')]['message']);return _0x343c22(_0x9e6a55[_0xa520('0x16')]['message']);}logger[_0xa520('0x16')](_0xa520('0x12'),_0x10c709,_0x9e6a55[_0xa520('0x16')][_0xa520('0x17')]);return _0xae9649(_0x9e6a55['error'][_0xa520('0x17')]);}else{logger['info']('SquareProject,\x20%s,\x20%s',_0x10c709,'request\x20sent');_0xae9649(_0x9e6a55[_0xa520('0x18')][_0xa520('0x17')]);}})['catch'](function(_0x17dd96){logger[_0xa520('0x16')](_0xa520('0x12'),_0x10c709,_0x17dd96);_0x343c22(_0x17dd96);});});}exports[_0xa520('0x19')]=function(_0x5da461){var _0x4b8e87=this;return new Promise(function(_0x1f7a21,_0x223118){return db[_0xa520('0x1a')][_0xa520('0x1b')]({'raw':_0x5da461['options']?_0x5da461[_0xa520('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5da461['options']?_0x5da461['options'][_0xa520('0x1d')]||null:null,'attributes':_0x5da461[_0xa520('0x1c')]?_0x5da461[_0xa520('0x1c')][_0xa520('0x1e')]||null:null,'include':_0x5da461[_0xa520('0x1c')]?_0x5da461[_0xa520('0x1c')][_0xa520('0x1f')]?_[_0xa520('0x20')](_0x5da461[_0xa520('0x1c')][_0xa520('0x1f')],function(_0xb26440){return{'model':db[_0xb26440[_0xa520('0x21')]],'as':_0xb26440['as'],'attributes':_0xb26440[_0xa520('0x1e')],'include':_0xb26440['include']?_['map'](_0xb26440['include'],function(_0x26c1eb){return{'model':db[_0x26c1eb[_0xa520('0x21')]],'as':_0x26c1eb['as'],'attributes':_0x26c1eb[_0xa520('0x1e')],'include':_0x26c1eb['include']?_['map'](_0x26c1eb[_0xa520('0x1f')],function(_0x2f19b2){return{'model':db[_0x2f19b2['model']],'as':_0x2f19b2['as'],'attributes':_0x2f19b2[_0xa520('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa520('0x11')](function(_0x19980c){logger[_0xa520('0x22')](_0xa520('0x19'),_0x5da461);logger[_0xa520('0x14')](_0xa520('0x19'),_0x5da461,JSON['stringify'](_0x19980c));_0x1f7a21(_0x19980c);})[_0xa520('0x23')](function(_0x41c914){logger[_0xa520('0x16')](_0xa520('0x19'),_0x41c914[_0xa520('0x17')],_0x5da461);_0x223118(_0x4b8e87[_0xa520('0x16')](0x1f4,_0x41c914[_0xa520('0x17')]));});});}; \ No newline at end of file +var _0x54e2=['map','include','model','attributes','debug','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSquareProject','find','options','raw'];(function(_0x496333,_0x1c47d6){var _0x44256e=function(_0x58767d){while(--_0x58767d){_0x496333['push'](_0x496333['shift']());}};_0x44256e(++_0x1c47d6);}(_0x54e2,0x92));var _0x254e=function(_0x418a8d,_0x55cdd6){_0x418a8d=_0x418a8d-0x0;var _0x5d4a8e=_0x54e2[_0x418a8d];return _0x5d4a8e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x254e('0x0'));var BPromise=require(_0x254e('0x1'));var rs=require(_0x254e('0x2'));var fs=require('fs');var Redis=require(_0x254e('0x3'));var db=require(_0x254e('0x4'))['db'];var utils=require(_0x254e('0x5'));var logger=require(_0x254e('0x6'))(_0x254e('0x7'));var config=require(_0x254e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x254e('0x9')]['http']({'port':0x232a});config[_0x254e('0xa')]=_[_0x254e('0xb')](config[_0x254e('0xa')],{'host':_0x254e('0xc'),'port':0x18eb});var socket=require(_0x254e('0xd'))(new Redis(config['redis']));require(_0x254e('0xe'))['register'](socket);function respondWithRpcPromise(_0x3772e7,_0x4ceea8,_0x5c8a72){return new BPromise(function(_0x298829,_0x2f51c4){return client['request'](_0x3772e7,_0x5c8a72)[_0x254e('0xf')](function(_0x41add6){logger[_0x254e('0x10')](_0x254e('0x11'),_0x4ceea8,_0x254e('0x12'));logger['debug'](_0x254e('0x13'),_0x4ceea8,'request\x20sent',JSON['stringify'](_0x41add6));if(_0x41add6[_0x254e('0x14')]){if(_0x41add6[_0x254e('0x14')][_0x254e('0x15')]===0x1f4){logger[_0x254e('0x14')]('SquareProject,\x20%s,\x20%s',_0x4ceea8,_0x41add6[_0x254e('0x14')][_0x254e('0x16')]);return _0x2f51c4(_0x41add6[_0x254e('0x14')][_0x254e('0x16')]);}logger[_0x254e('0x14')](_0x254e('0x11'),_0x4ceea8,_0x41add6[_0x254e('0x14')][_0x254e('0x16')]);return _0x298829(_0x41add6[_0x254e('0x14')][_0x254e('0x16')]);}else{logger[_0x254e('0x10')](_0x254e('0x11'),_0x4ceea8,_0x254e('0x12'));_0x298829(_0x41add6[_0x254e('0x17')]['message']);}})[_0x254e('0x18')](function(_0x580774){logger[_0x254e('0x14')](_0x254e('0x11'),_0x4ceea8,_0x580774);_0x2f51c4(_0x580774);});});}exports[_0x254e('0x19')]=function(_0x4f474f){var _0x344aa1=this;return new Promise(function(_0x203335,_0x595aa5){return db['SquareProject'][_0x254e('0x1a')]({'raw':_0x4f474f[_0x254e('0x1b')]?_0x4f474f[_0x254e('0x1b')][_0x254e('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f474f[_0x254e('0x1b')]?_0x4f474f[_0x254e('0x1b')]['where']||null:null,'attributes':_0x4f474f['options']?_0x4f474f[_0x254e('0x1b')]['attributes']||null:null,'include':_0x4f474f['options']?_0x4f474f[_0x254e('0x1b')]['include']?_[_0x254e('0x1d')](_0x4f474f['options'][_0x254e('0x1e')],function(_0x53dcf7){return{'model':db[_0x53dcf7[_0x254e('0x1f')]],'as':_0x53dcf7['as'],'attributes':_0x53dcf7[_0x254e('0x20')],'include':_0x53dcf7['include']?_[_0x254e('0x1d')](_0x53dcf7[_0x254e('0x1e')],function(_0x308109){return{'model':db[_0x308109[_0x254e('0x1f')]],'as':_0x308109['as'],'attributes':_0x308109['attributes'],'include':_0x308109[_0x254e('0x1e')]?_[_0x254e('0x1d')](_0x308109[_0x254e('0x1e')],function(_0x5837e0){return{'model':db[_0x5837e0[_0x254e('0x1f')]],'as':_0x5837e0['as'],'attributes':_0x5837e0[_0x254e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x254e('0xf')](function(_0x322234){logger[_0x254e('0x10')](_0x254e('0x19'),_0x4f474f);logger[_0x254e('0x21')](_0x254e('0x19'),_0x4f474f,JSON[_0x254e('0x22')](_0x322234));_0x203335(_0x322234);})[_0x254e('0x18')](function(_0x263dd8){logger[_0x254e('0x14')](_0x254e('0x19'),_0x263dd8[_0x254e('0x16')],_0x4f474f);_0x595aa5(_0x344aa1[_0x254e('0x14')](0x1f4,_0x263dd8[_0x254e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 8561a7d..39cbfd2 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 _0x4137=['emit','removeListener','register','length','squareProject:','./squareProject.events','save','remove','update'];(function(_0x3626ce,_0x33effa){var _0x455327=function(_0x4eee88){while(--_0x4eee88){_0x3626ce['push'](_0x3626ce['shift']());}};_0x455327(++_0x33effa);}(_0x4137,0xf8));var _0x7413=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4137[_0x122ef9];return _0x42fba0;};'use strict';var SquareProjectEvents=require(_0x7413('0x0'));var events=[_0x7413('0x1'),_0x7413('0x2'),_0x7413('0x3')];function createListener(_0x392ebc,_0x410971){return function(_0x2e6df7){_0x410971[_0x7413('0x4')](_0x392ebc,_0x2e6df7);};}function removeListener(_0x258255,_0x3dc48a){return function(){SquareProjectEvents[_0x7413('0x5')](_0x258255,_0x3dc48a);};}exports[_0x7413('0x6')]=function(_0x4fbade){for(var _0xc808cd=0x0,_0x188d89=events[_0x7413('0x7')];_0xc808cd<_0x188d89;_0xc808cd++){var _0x15af0d=events[_0xc808cd];var _0x5f4cd0=createListener(_0x7413('0x8')+_0x15af0d,_0x4fbade);SquareProjectEvents['on'](_0x15af0d,_0x5f4cd0);}}; \ No newline at end of file +var _0x7096=['emit','removeListener','register','length','save','update'];(function(_0x46e596,_0x313faf){var _0x5c59d8=function(_0x1ec59b){while(--_0x1ec59b){_0x46e596['push'](_0x46e596['shift']());}};_0x5c59d8(++_0x313faf);}(_0x7096,0x10c));var _0x6709=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x7096[_0x618414];return _0x21c19a;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x6709('0x0'),'remove',_0x6709('0x1')];function createListener(_0x5c668a,_0x233cbf){return function(_0x9544e0){_0x233cbf[_0x6709('0x2')](_0x5c668a,_0x9544e0);};}function removeListener(_0xccdcb5,_0x3cd087){return function(){SquareProjectEvents[_0x6709('0x3')](_0xccdcb5,_0x3cd087);};}exports[_0x6709('0x4')]=function(_0x9d630f){for(var _0xa35832=0x0,_0x3e2223=events[_0x6709('0x5')];_0xa35832<_0x3e2223;_0xa35832++){var _0x985814=events[_0xa35832];var _0x30147f=createListener('squareProject:'+_0x985814,_0x9d630f);SquareProjectEvents['on'](_0x985814,_0x30147f);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 207972f..a7b46c1 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 _0x1021=['Router','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','delete','/:id/delete','destroy','exports','multer','util','path','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1021,0xe0));var _0x1102=function(_0x33ea4d,_0x33f3b0){_0x33ea4d=_0x33ea4d-0x0;var _0x11c4cb=_0x1021[_0x33ea4d];return _0x11c4cb;};'use strict';var multer=require(_0x1102('0x0'));var util=require(_0x1102('0x1'));var path=require(_0x1102('0x2'));var timeout=require('connect-timeout');var express=require(_0x1102('0x3'));var router=express[_0x1102('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1102('0x5'));var config=require(_0x1102('0x6'));var controller=require(_0x1102('0x7'));router[_0x1102('0x8')]('/',auth[_0x1102('0x9')](),controller['index']);router['get'](_0x1102('0xa'),auth[_0x1102('0x9')](),controller[_0x1102('0xb')]);router[_0x1102('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x1102('0xc')]);router[_0x1102('0xd')]('/',auth[_0x1102('0x9')](),controller[_0x1102('0xe')]);router['put'](_0x1102('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x1102('0xf')](_0x1102('0x10'),auth[_0x1102('0x9')](),controller[_0x1102('0x11')]);module[_0x1102('0x12')]=router; \ No newline at end of file +var _0xa1a7=['update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put'];(function(_0x166f56,_0x133417){var _0x371bf0=function(_0x200de8){while(--_0x200de8){_0x166f56['push'](_0x166f56['shift']());}};_0x371bf0(++_0x133417);}(_0xa1a7,0x1cf));var _0x7a1a=function(_0x48b3fb,_0x4b07bf){_0x48b3fb=_0x48b3fb-0x0;var _0x458604=_0xa1a7[_0x48b3fb];return _0x458604;};'use strict';var multer=require(_0x7a1a('0x0'));var util=require(_0x7a1a('0x1'));var path=require(_0x7a1a('0x2'));var timeout=require(_0x7a1a('0x3'));var express=require(_0x7a1a('0x4'));var router=express['Router']();var auth=require(_0x7a1a('0x5'));var interaction=require(_0x7a1a('0x6'));var config=require(_0x7a1a('0x7'));var controller=require(_0x7a1a('0x8'));router[_0x7a1a('0x9')]('/',auth[_0x7a1a('0xa')](),controller['index']);router['get'](_0x7a1a('0xb'),auth[_0x7a1a('0xa')](),controller[_0x7a1a('0xc')]);router[_0x7a1a('0x9')](_0x7a1a('0xd'),auth[_0x7a1a('0xa')](),controller[_0x7a1a('0xe')]);router['post']('/',auth[_0x7a1a('0xa')](),controller[_0x7a1a('0xf')]);router[_0x7a1a('0x10')](_0x7a1a('0xb'),auth[_0x7a1a('0xa')](),controller[_0x7a1a('0x11')]);router[_0x7a1a('0x12')]('/:id/delete',auth['isAuthenticated'](),controller['destroy']);module[_0x7a1a('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index f8de285..8e3d9fd 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 _0x7156=['substring','lastIndexOf','exports','STRING','VIRTUAL','getDataValue'];(function(_0x81933e,_0x3929f9){var _0x3df157=function(_0x574c31){while(--_0x574c31){_0x81933e['push'](_0x81933e['shift']());}};_0x3df157(++_0x3929f9);}(_0x7156,0x122));var _0x6715=function(_0x533636,_0x14a418){_0x533636=_0x533636-0x0;var _0x289651=_0x7156[_0x533636];return _0x289651;};'use strict';var Sequelize=require('sequelize');module[_0x6715('0x0')]={'uniqueid':{'type':Sequelize[_0x6715('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6715('0x1')]},'context':{'type':Sequelize[_0x6715('0x1')]},'extension':{'type':Sequelize[_0x6715('0x1')]},'priority':{'type':Sequelize[_0x6715('0x1')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x6715('0x1')]},'saveName':{'type':Sequelize[_0x6715('0x1')]},'filename':{'type':Sequelize[_0x6715('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x6715('0x2')],'get':function(){var _0x2a0cf1='';var _0x214573=this[_0x6715('0x3')]('savePath');if(_0x214573){_0x2a0cf1=_0x214573[_0x6715('0x4')](_0x214573[_0x6715('0x5')]('.'));}return _0x2a0cf1;}}}; \ No newline at end of file +var _0xf52b=['exports','STRING','VIRTUAL','substring','lastIndexOf','sequelize'];(function(_0x5ba35a,_0x5e5113){var _0x5900dc=function(_0x3e61b7){while(--_0x3e61b7){_0x5ba35a['push'](_0x5ba35a['shift']());}};_0x5900dc(++_0x5e5113);}(_0xf52b,0x119));var _0xbf52=function(_0x439d59,_0x11ccdf){_0x439d59=_0x439d59-0x0;var _0x3670c7=_0xf52b[_0x439d59];return _0x3670c7;};'use strict';var Sequelize=require(_0xbf52('0x0'));module[_0xbf52('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbf52('0x2')]},'context':{'type':Sequelize[_0xbf52('0x2')]},'extension':{'type':Sequelize[_0xbf52('0x2')]},'priority':{'type':Sequelize[_0xbf52('0x2')]},'accountcode':{'type':Sequelize[_0xbf52('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xbf52('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xbf52('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xbf52('0x3')],'get':function(){var _0x184af2='';var _0x4d5f8d=this['getDataValue']('savePath');if(_0x4d5f8d){_0x184af2=_0x4d5f8d[_0xbf52('0x4')](_0x4d5f8d[_0xbf52('0x5')]('.'));}return _0x184af2;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index c22efe4..7039a0c 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 _0x6524=['type','VIRTUAL','options','SquareRecording','count','includeAll','findAll','show','params','include','catch','create','body','find','download','../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','decryptFile','secrets','recording','existsSync','ValidationError','SquareRecording\x20not\x20found','extname','unlink','send','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','reject','save','then','destroy','error','name','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x6524,0x83));var _0x4652=function(_0x58214b,_0xac08be){_0x58214b=_0x58214b-0x0;var _0x3e56c9=_0x6524[_0x58214b];return _0x3e56c9;};'use strict';var pdf=require(_0x4652('0x0'));var emlformat=require(_0x4652('0x1'));var rimraf=require(_0x4652('0x2'));var zipdir=require(_0x4652('0x3'));var jsonpatch=require(_0x4652('0x4'));var rp=require(_0x4652('0x5'));var moment=require(_0x4652('0x6'));var BPromise=require(_0x4652('0x7'));var Mustache=require(_0x4652('0x8'));var util=require(_0x4652('0x9'));var path=require(_0x4652('0xa'));var sox=require(_0x4652('0xb'));var csv=require(_0x4652('0xc'));var ejs=require(_0x4652('0xd'));var fs=require('fs');var _=require(_0x4652('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4652('0xf'));var deskjs=require(_0x4652('0x10'));var toCsv=require(_0x4652('0xc'));var querystring=require(_0x4652('0x11'));var Papa=require(_0x4652('0x12'));var Redis=require(_0x4652('0x13'));var authService=require(_0x4652('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x4652('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4652('0x16'))(_0x4652('0x17'));var utils=require('../../config/utils');var config=require(_0x4652('0x18'));var db=require(_0x4652('0x19'))['db'];function respondWithStatusCode(_0x534cbc,_0x451f61){_0x451f61=_0x451f61||0xcc;return function(_0x32b061){if(_0x32b061){return _0x534cbc[_0x4652('0x1a')](_0x451f61);}return _0x534cbc[_0x4652('0x1b')](_0x451f61)[_0x4652('0x1c')]();};}function respondWithResult(_0x1a789b,_0x72dad8){_0x72dad8=_0x72dad8||0xc8;return function(_0x5ea3b7){if(_0x5ea3b7){return _0x1a789b[_0x4652('0x1b')](_0x72dad8)[_0x4652('0x1d')](_0x5ea3b7);}};}function respondWithFilteredResult(_0x4ed260,_0x2e2117){return function(_0x27bfd3){if(_0x27bfd3){var _0x18b642=_0x27bfd3['count'],_0x1a6516=_0x2e2117[_0x4652('0x1e')],_0x943111=_0x2e2117['offset']+_0x2e2117[_0x4652('0x1f')],_0x1f0dda;if(_0x943111>=_0x18b642){_0x943111=_0x18b642;_0x1f0dda=0xc8;}else{_0x1f0dda=0xce;}_0x4ed260[_0x4652('0x1b')](_0x1f0dda);return _0x4ed260[_0x4652('0x20')]('Content-Range',_0x1a6516+'-'+_0x943111+'/'+_0x18b642)[_0x4652('0x1d')](_0x27bfd3);}return null;};}function patchUpdates(_0x3106a6){return function(_0x5094e9){try{jsonpatch['apply'](_0x5094e9,_0x3106a6,!![]);}catch(_0x3cff7b){return BPromise[_0x4652('0x21')](_0x3cff7b);}return _0x5094e9[_0x4652('0x22')]();};}function saveUpdates(_0x12e6d6,_0x563031){return function(_0x300582){if(_0x300582){return _0x300582['update'](_0x12e6d6)[_0x4652('0x23')](function(_0x4cd42f){return _0x4cd42f;});}return null;};}function removeEntity(_0x409363,_0x1d5eba){return function(_0x2562da){if(_0x2562da){return _0x2562da[_0x4652('0x24')]()['then'](function(){_0x409363[_0x4652('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x108eb9,_0x1966c7){return function(_0x2c09af){if(!_0x2c09af){_0x108eb9['sendStatus'](0x194);}return _0x2c09af;};}function handleError(_0xd11fbc,_0x5aab5c){_0x5aab5c=_0x5aab5c||0x1f4;return function(_0x8c52e4){logger[_0x4652('0x25')](_0x8c52e4['stack']);if(_0x8c52e4['name']){delete _0x8c52e4[_0x4652('0x26')];}_0xd11fbc[_0x4652('0x1b')](_0x5aab5c)['send'](_0x8c52e4);};}exports[_0x4652('0x27')]=function(_0x3ebc21,_0x3e8e0b){var _0x520069={},_0x57b8eb={},_0x36774c={'count':0x0,'rows':[]};var _0x14867f=_[_0x4652('0x28')](db['SquareRecording']['rawAttributes'],function(_0x755a5f){return{'name':_0x755a5f[_0x4652('0x29')],'type':_0x755a5f['type'][_0x4652('0x2a')]};});_0x57b8eb[_0x4652('0x2b')]=_[_0x4652('0x28')](_0x14867f,_0x4652('0x26'));_0x57b8eb[_0x4652('0x2c')]=_[_0x4652('0x2d')](_0x3ebc21['query']);_0x57b8eb[_0x4652('0x2e')]=_[_0x4652('0x2f')](_0x57b8eb[_0x4652('0x2b')],_0x57b8eb['query']);_0x520069[_0x4652('0x30')]=_[_0x4652('0x2f')](_0x57b8eb['model'],qs[_0x4652('0x31')](_0x3ebc21['query']['fields']));_0x520069[_0x4652('0x30')]=_0x520069[_0x4652('0x30')][_0x4652('0x32')]?_0x520069[_0x4652('0x30')]:_0x57b8eb[_0x4652('0x2b')];if(!_0x3ebc21[_0x4652('0x2c')][_0x4652('0x33')](_0x4652('0x34'))){_0x520069[_0x4652('0x1f')]=qs[_0x4652('0x1f')](_0x3ebc21[_0x4652('0x2c')][_0x4652('0x1f')]);_0x520069[_0x4652('0x1e')]=qs['offset'](_0x3ebc21[_0x4652('0x2c')]['offset']);}_0x520069[_0x4652('0x35')]=qs[_0x4652('0x36')](_0x3ebc21[_0x4652('0x2c')]['sort']);_0x520069[_0x4652('0x37')]=qs[_0x4652('0x2e')](_[_0x4652('0x38')](_0x3ebc21['query'],_0x57b8eb[_0x4652('0x2e')]),_0x14867f);if(_0x3ebc21[_0x4652('0x2c')][_0x4652('0x39')]){_0x520069[_0x4652('0x37')]=_[_0x4652('0x3a')](_0x520069['where'],{'$or':_[_0x4652('0x28')](_0x14867f,function(_0x27ede7){if(_0x27ede7[_0x4652('0x3b')]!==_0x4652('0x3c')){var _0x4d0c4c={};_0x4d0c4c[_0x27ede7[_0x4652('0x26')]]={'$like':'%'+_0x3ebc21['query'][_0x4652('0x39')]+'%'};return _0x4d0c4c;}})});}_0x520069=_['merge']({},_0x520069,_0x3ebc21[_0x4652('0x3d')]);var _0x16b4e4={'where':_0x520069[_0x4652('0x37')]};return db[_0x4652('0x3e')][_0x4652('0x3f')](_0x16b4e4)['then'](function(_0x3f4270){_0x36774c[_0x4652('0x3f')]=_0x3f4270;if(_0x3ebc21[_0x4652('0x2c')][_0x4652('0x40')]){_0x520069['include']=[{'all':!![]}];}return db[_0x4652('0x3e')][_0x4652('0x41')](_0x520069);})[_0x4652('0x23')](function(_0x533290){_0x36774c['rows']=_0x533290;return _0x36774c;})['then'](respondWithFilteredResult(_0x3e8e0b,_0x520069))['catch'](handleError(_0x3e8e0b,null));};exports[_0x4652('0x42')]=function(_0x633a89,_0x3d0125){var _0x36df6d={'raw':!![],'where':{'id':_0x633a89[_0x4652('0x43')]['id']}},_0x4217e8={};_0x4217e8['model']=_['keys'](db[_0x4652('0x3e')]['rawAttributes']);_0x4217e8['query']=_[_0x4652('0x2d')](_0x633a89[_0x4652('0x2c')]);_0x4217e8[_0x4652('0x2e')]=_['intersection'](_0x4217e8[_0x4652('0x2b')],_0x4217e8[_0x4652('0x2c')]);_0x36df6d[_0x4652('0x30')]=_[_0x4652('0x2f')](_0x4217e8[_0x4652('0x2b')],qs[_0x4652('0x31')](_0x633a89[_0x4652('0x2c')]['fields']));_0x36df6d[_0x4652('0x30')]=_0x36df6d[_0x4652('0x30')]['length']?_0x36df6d[_0x4652('0x30')]:_0x4217e8[_0x4652('0x2b')];if(_0x633a89[_0x4652('0x2c')][_0x4652('0x40')]){_0x36df6d[_0x4652('0x44')]=[{'all':!![]}];}_0x36df6d=_[_0x4652('0x3a')]({},_0x36df6d,_0x633a89[_0x4652('0x3d')]);return db[_0x4652('0x3e')]['find'](_0x36df6d)[_0x4652('0x23')](handleEntityNotFound(_0x3d0125,null))['then'](respondWithResult(_0x3d0125,null))[_0x4652('0x45')](handleError(_0x3d0125,null));};exports[_0x4652('0x46')]=function(_0x570c3e,_0x2067d0){return db['SquareRecording'][_0x4652('0x46')](_0x570c3e[_0x4652('0x47')],{})[_0x4652('0x23')](respondWithResult(_0x2067d0,0xc9))['catch'](handleError(_0x2067d0,null));};exports['update']=function(_0x5df197,_0x1db92a){if(_0x5df197[_0x4652('0x47')]['id']){delete _0x5df197[_0x4652('0x47')]['id'];}return db[_0x4652('0x3e')][_0x4652('0x48')]({'where':{'id':_0x5df197[_0x4652('0x43')]['id']}})[_0x4652('0x23')](handleEntityNotFound(_0x1db92a,null))[_0x4652('0x23')](saveUpdates(_0x5df197[_0x4652('0x47')],null))[_0x4652('0x23')](respondWithResult(_0x1db92a,null))[_0x4652('0x45')](handleError(_0x1db92a,null));};exports[_0x4652('0x49')]=function(_0x24c814,_0x134d66,_0x39443b){var _0x2b7d2b=require(_0x4652('0x4a'));var _0x59659a=![];var _0x40fbee={};if(_0x24c814['query']['type']&&_0x24c814[_0x4652('0x2c')]['type']===_0x4652('0x4b')){_0x40fbee['uniqueid']=_0x24c814[_0x4652('0x43')]['id'];}else{_0x40fbee['id']=_0x24c814['params']['id'];}return db[_0x4652('0x3e')][_0x4652('0x48')]({'where':_0x40fbee,'attributes':['id','savePath',_0x4652('0x4c')],'raw':!![]})[_0x4652('0x23')](handleEntityNotFound(_0x134d66,null))['then'](function(_0x281cf9){if(_0x281cf9){var _0x145248=_0x281cf9[_0x4652('0x4d')];var _0x17897f=util[_0x4652('0x4e')](_0x4652('0x4f'),_0x145248);if(fs['existsSync'](_0x17897f)){_0x59659a=!![];return _0x2b7d2b[_0x4652('0x50')](_0x17897f,_0x145248,config[_0x4652('0x51')][_0x4652('0x52')])[_0x4652('0x23')](function(){return _0x281cf9;});}return _0x281cf9;}})[_0x4652('0x23')](function(_0x3a49be){if(_0x3a49be){var _0x16c010=_0x3a49be['savePath'];if(!fs[_0x4652('0x53')](_0x16c010)){throw new db['Sequelize'][(_0x4652('0x54'))](_0x4652('0x55'));}if(_0x3a49be['filename']){return _0x134d66[_0x4652('0x49')](_0x16c010,_0x3a49be[_0x4652('0x4c')]+path[_0x4652('0x56')](_0x16c010),function(){if(_0x59659a){fs[_0x4652('0x57')](_0x16c010);}});}else{return _0x134d66[_0x4652('0x49')](_0x16c010,function(_0x11107d){if(_0x59659a){fs[_0x4652('0x57')](_0x16c010);}});}}})[_0x4652('0x45')](function(_0x32d734){if(_0x32d734['message']===_0x4652('0x55')){_0x134d66[_0x4652('0x1b')](0x194)[_0x4652('0x58')](_0x4652('0x59'));}else{return handleError(_0x134d66,null);}});};exports['destroy']=function(_0x22a525,_0x491e86){return db[_0x4652('0x3e')][_0x4652('0x48')]({'where':{'id':_0x22a525[_0x4652('0x43')]['id']}})[_0x4652('0x23')](function(_0x59a4df){if(!_0x59a4df)throw new ReferenceError('Entity\x20not\x20found');return _0x59a4df;})[_0x4652('0x23')](function(_0xc8f8c8){var _0x1ff006=_0xc8f8c8[_0x4652('0x4d')];logger[_0x4652('0x5a')](_0x4652('0x5b'),_0x1ff006);if(!_['isNil'](_0xc8f8c8[_0x4652('0x4d')])&&fs[_0x4652('0x53')](_0x1ff006)){logger[_0x4652('0x5a')]('File:\x20\x22'+_0x1ff006+_0x4652('0x5c'));fs[_0x4652('0x5d')](_0x1ff006);}_0x1ff006=_0x1ff006+'.cypher';if(!_['isNil'](_0xc8f8c8[_0x4652('0x4d')])&&fs[_0x4652('0x53')](_0x1ff006)){logger['info'](_0x4652('0x5e')+_0x1ff006+_0x4652('0x5c'));fs[_0x4652('0x5d')](_0x1ff006);}return _0xc8f8c8;})[_0x4652('0x23')](function(_0x15d694){if(!_0x15d694)throw new InternalError();return _0x15d694[_0x4652('0x24')]();})['then'](function(){_0x491e86[_0x4652('0x1b')](0xcc)[_0x4652('0x1c')]();})[_0x4652('0x45')](handleError(_0x491e86,null));}; \ No newline at end of file +var _0x0422=['decryptFile','secrets','recording','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','status','end','json','count','offset','limit','set','save','update','then','sendStatus','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','model','keys','query','attributes','intersection','fields','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','download','../../components/encryptor','uniqueid','savePath','format','existsSync'];(function(_0x11019c,_0x8cf889){var _0x4cd868=function(_0x315f74){while(--_0x315f74){_0x11019c['push'](_0x11019c['shift']());}};_0x4cd868(++_0x8cf889);}(_0x0422,0x175));var _0x2042=function(_0x2d364e,_0x301c5e){_0x2d364e=_0x2d364e-0x0;var _0x1b9312=_0x0422[_0x2d364e];return _0x1b9312;};'use strict';var pdf=require(_0x2042('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2042('0x1'));var zipdir=require(_0x2042('0x2'));var jsonpatch=require(_0x2042('0x3'));var rp=require('request-promise');var moment=require(_0x2042('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2042('0x5'));var util=require(_0x2042('0x6'));var path=require(_0x2042('0x7'));var sox=require(_0x2042('0x8'));var csv=require(_0x2042('0x9'));var ejs=require(_0x2042('0xa'));var fs=require('fs');var _=require(_0x2042('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2042('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2042('0x9'));var querystring=require(_0x2042('0xd'));var Papa=require(_0x2042('0xe'));var Redis=require(_0x2042('0xf'));var authService=require(_0x2042('0x10'));var qs=require(_0x2042('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2042('0x12'))(_0x2042('0x13'));var utils=require(_0x2042('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f7c88,_0x4e68a3){_0x4e68a3=_0x4e68a3||0xcc;return function(_0x25b8ba){if(_0x25b8ba){return _0x1f7c88['sendStatus'](_0x4e68a3);}return _0x1f7c88[_0x2042('0x15')](_0x4e68a3)[_0x2042('0x16')]();};}function respondWithResult(_0x2be8c5,_0x580341){_0x580341=_0x580341||0xc8;return function(_0x5edc67){if(_0x5edc67){return _0x2be8c5[_0x2042('0x15')](_0x580341)[_0x2042('0x17')](_0x5edc67);}};}function respondWithFilteredResult(_0x102852,_0x3b5777){return function(_0x13d5b3){if(_0x13d5b3){var _0x27b86e=_0x13d5b3[_0x2042('0x18')],_0x1dbeed=_0x3b5777[_0x2042('0x19')],_0x3ee978=_0x3b5777[_0x2042('0x19')]+_0x3b5777[_0x2042('0x1a')],_0x3a898d;if(_0x3ee978>=_0x27b86e){_0x3ee978=_0x27b86e;_0x3a898d=0xc8;}else{_0x3a898d=0xce;}_0x102852[_0x2042('0x15')](_0x3a898d);return _0x102852[_0x2042('0x1b')]('Content-Range',_0x1dbeed+'-'+_0x3ee978+'/'+_0x27b86e)[_0x2042('0x17')](_0x13d5b3);}return null;};}function patchUpdates(_0x16d9e5){return function(_0xdcf885){try{jsonpatch['apply'](_0xdcf885,_0x16d9e5,!![]);}catch(_0x1afe3e){return BPromise['reject'](_0x1afe3e);}return _0xdcf885[_0x2042('0x1c')]();};}function saveUpdates(_0x479f30,_0x4cee55){return function(_0x1541fb){if(_0x1541fb){return _0x1541fb[_0x2042('0x1d')](_0x479f30)[_0x2042('0x1e')](function(_0xc630a){return _0xc630a;});}return null;};}function removeEntity(_0x145949,_0x39c53e){return function(_0x14d9ee){if(_0x14d9ee){return _0x14d9ee['destroy']()[_0x2042('0x1e')](function(){_0x145949[_0x2042('0x15')](0xcc)[_0x2042('0x16')]();});}};}function handleEntityNotFound(_0x82714b,_0x4423bc){return function(_0x6ff80c){if(!_0x6ff80c){_0x82714b[_0x2042('0x1f')](0x194);}return _0x6ff80c;};}function handleError(_0x304e5d,_0x47025d){_0x47025d=_0x47025d||0x1f4;return function(_0x160878){logger[_0x2042('0x20')](_0x160878[_0x2042('0x21')]);if(_0x160878[_0x2042('0x22')]){delete _0x160878[_0x2042('0x22')];}_0x304e5d[_0x2042('0x15')](_0x47025d)[_0x2042('0x23')](_0x160878);};}exports[_0x2042('0x24')]=function(_0x558964,_0x4becd6){var _0x11ed72={},_0x50d140={},_0x28dbb2={'count':0x0,'rows':[]};var _0x4b45e9=_[_0x2042('0x25')](db[_0x2042('0x26')][_0x2042('0x27')],function(_0x237fc7){return{'name':_0x237fc7[_0x2042('0x28')],'type':_0x237fc7[_0x2042('0x29')]['key']};});_0x50d140[_0x2042('0x2a')]=_[_0x2042('0x25')](_0x4b45e9,_0x2042('0x22'));_0x50d140['query']=_[_0x2042('0x2b')](_0x558964[_0x2042('0x2c')]);_0x50d140['filters']=_['intersection'](_0x50d140[_0x2042('0x2a')],_0x50d140['query']);_0x11ed72[_0x2042('0x2d')]=_[_0x2042('0x2e')](_0x50d140[_0x2042('0x2a')],qs[_0x2042('0x2f')](_0x558964['query'][_0x2042('0x2f')]));_0x11ed72[_0x2042('0x2d')]=_0x11ed72[_0x2042('0x2d')]['length']?_0x11ed72[_0x2042('0x2d')]:_0x50d140['model'];if(!_0x558964[_0x2042('0x2c')]['hasOwnProperty']('nolimit')){_0x11ed72['limit']=qs[_0x2042('0x1a')](_0x558964[_0x2042('0x2c')][_0x2042('0x1a')]);_0x11ed72[_0x2042('0x19')]=qs[_0x2042('0x19')](_0x558964[_0x2042('0x2c')]['offset']);}_0x11ed72[_0x2042('0x30')]=qs[_0x2042('0x31')](_0x558964[_0x2042('0x2c')]['sort']);_0x11ed72[_0x2042('0x32')]=qs[_0x2042('0x33')](_[_0x2042('0x34')](_0x558964[_0x2042('0x2c')],_0x50d140[_0x2042('0x33')]),_0x4b45e9);if(_0x558964[_0x2042('0x2c')][_0x2042('0x35')]){_0x11ed72[_0x2042('0x32')]=_[_0x2042('0x36')](_0x11ed72['where'],{'$or':_[_0x2042('0x25')](_0x4b45e9,function(_0x5d28cb){if(_0x5d28cb['type']!=='VIRTUAL'){var _0x1aa659={};_0x1aa659[_0x5d28cb[_0x2042('0x22')]]={'$like':'%'+_0x558964[_0x2042('0x2c')][_0x2042('0x35')]+'%'};return _0x1aa659;}})});}_0x11ed72=_['merge']({},_0x11ed72,_0x558964[_0x2042('0x37')]);var _0x173b68={'where':_0x11ed72[_0x2042('0x32')]};return db[_0x2042('0x26')]['count'](_0x173b68)[_0x2042('0x1e')](function(_0x4b1888){_0x28dbb2[_0x2042('0x18')]=_0x4b1888;if(_0x558964['query'][_0x2042('0x38')]){_0x11ed72[_0x2042('0x39')]=[{'all':!![]}];}return db[_0x2042('0x26')][_0x2042('0x3a')](_0x11ed72);})[_0x2042('0x1e')](function(_0x1aa80e){_0x28dbb2[_0x2042('0x3b')]=_0x1aa80e;return _0x28dbb2;})[_0x2042('0x1e')](respondWithFilteredResult(_0x4becd6,_0x11ed72))['catch'](handleError(_0x4becd6,null));};exports[_0x2042('0x3c')]=function(_0x4b8e61,_0x264fc4){var _0x1cf718={'raw':!![],'where':{'id':_0x4b8e61[_0x2042('0x3d')]['id']}},_0x5bc839={};_0x5bc839[_0x2042('0x2a')]=_[_0x2042('0x2b')](db['SquareRecording'][_0x2042('0x27')]);_0x5bc839[_0x2042('0x2c')]=_[_0x2042('0x2b')](_0x4b8e61[_0x2042('0x2c')]);_0x5bc839[_0x2042('0x33')]=_[_0x2042('0x2e')](_0x5bc839[_0x2042('0x2a')],_0x5bc839['query']);_0x1cf718[_0x2042('0x2d')]=_[_0x2042('0x2e')](_0x5bc839['model'],qs['fields'](_0x4b8e61['query']['fields']));_0x1cf718[_0x2042('0x2d')]=_0x1cf718[_0x2042('0x2d')]['length']?_0x1cf718[_0x2042('0x2d')]:_0x5bc839[_0x2042('0x2a')];if(_0x4b8e61[_0x2042('0x2c')][_0x2042('0x38')]){_0x1cf718[_0x2042('0x39')]=[{'all':!![]}];}_0x1cf718=_[_0x2042('0x36')]({},_0x1cf718,_0x4b8e61[_0x2042('0x37')]);return db[_0x2042('0x26')][_0x2042('0x3e')](_0x1cf718)['then'](handleEntityNotFound(_0x264fc4,null))[_0x2042('0x1e')](respondWithResult(_0x264fc4,null))[_0x2042('0x3f')](handleError(_0x264fc4,null));};exports['create']=function(_0x1954eb,_0xeff489){return db[_0x2042('0x26')][_0x2042('0x40')](_0x1954eb['body'],{})[_0x2042('0x1e')](respondWithResult(_0xeff489,0xc9))['catch'](handleError(_0xeff489,null));};exports[_0x2042('0x1d')]=function(_0x16e9a3,_0x3b905b){if(_0x16e9a3['body']['id']){delete _0x16e9a3[_0x2042('0x41')]['id'];}return db[_0x2042('0x26')][_0x2042('0x3e')]({'where':{'id':_0x16e9a3['params']['id']}})[_0x2042('0x1e')](handleEntityNotFound(_0x3b905b,null))[_0x2042('0x1e')](saveUpdates(_0x16e9a3[_0x2042('0x41')],null))['then'](respondWithResult(_0x3b905b,null))[_0x2042('0x3f')](handleError(_0x3b905b,null));};exports[_0x2042('0x42')]=function(_0x2f14b9,_0x22a957,_0x2f8241){var _0x4df23c=require(_0x2042('0x43'));var _0x429f95=![];var _0x2a1080={};if(_0x2f14b9[_0x2042('0x2c')][_0x2042('0x29')]&&_0x2f14b9[_0x2042('0x2c')]['type']===_0x2042('0x44')){_0x2a1080[_0x2042('0x44')]=_0x2f14b9[_0x2042('0x3d')]['id'];}else{_0x2a1080['id']=_0x2f14b9[_0x2042('0x3d')]['id'];}return db[_0x2042('0x26')][_0x2042('0x3e')]({'where':_0x2a1080,'attributes':['id',_0x2042('0x45'),'filename'],'raw':!![]})['then'](handleEntityNotFound(_0x22a957,null))['then'](function(_0x6a0fa1){if(_0x6a0fa1){var _0xf7c7dc=_0x6a0fa1[_0x2042('0x45')];var _0x53c7e5=util[_0x2042('0x46')]('%s.cypher',_0xf7c7dc);if(fs[_0x2042('0x47')](_0x53c7e5)){_0x429f95=!![];return _0x4df23c[_0x2042('0x48')](_0x53c7e5,_0xf7c7dc,config[_0x2042('0x49')][_0x2042('0x4a')])[_0x2042('0x1e')](function(){return _0x6a0fa1;});}return _0x6a0fa1;}})['then'](function(_0xd5c972){if(_0xd5c972){var _0x4dc38d=_0xd5c972['savePath'];if(!fs[_0x2042('0x47')](_0x4dc38d)){throw new db['Sequelize'][(_0x2042('0x4b'))](_0x2042('0x4c'));}if(_0xd5c972['filename']){return _0x22a957[_0x2042('0x42')](_0x4dc38d,_0xd5c972[_0x2042('0x4d')]+path[_0x2042('0x4e')](_0x4dc38d),function(){if(_0x429f95){fs[_0x2042('0x4f')](_0x4dc38d);}});}else{return _0x22a957['download'](_0x4dc38d,function(_0x370ea8){if(_0x429f95){fs[_0x2042('0x4f')](_0x4dc38d);}});}}})['catch'](function(_0x38dd3c){if(_0x38dd3c[_0x2042('0x50')]===_0x2042('0x4c')){_0x22a957[_0x2042('0x15')](0x194)[_0x2042('0x23')](_0x2042('0x51'));}else{return handleError(_0x22a957,null);}});};exports[_0x2042('0x52')]=function(_0x2ca8b4,_0x31955e){return db[_0x2042('0x26')]['find']({'where':{'id':_0x2ca8b4[_0x2042('0x3d')]['id']}})[_0x2042('0x1e')](function(_0x35a2c1){if(!_0x35a2c1)throw new ReferenceError('Entity\x20not\x20found');return _0x35a2c1;})[_0x2042('0x1e')](function(_0x2d2b99){var _0x7fe0d9=_0x2d2b99['savePath'];logger[_0x2042('0x53')](_0x2042('0x54'),_0x7fe0d9);if(!_[_0x2042('0x55')](_0x2d2b99[_0x2042('0x45')])&&fs['existsSync'](_0x7fe0d9)){logger[_0x2042('0x53')](_0x2042('0x56')+_0x7fe0d9+_0x2042('0x57'));fs['unlinkSync'](_0x7fe0d9);}_0x7fe0d9=_0x7fe0d9+_0x2042('0x58');if(!_[_0x2042('0x55')](_0x2d2b99[_0x2042('0x45')])&&fs[_0x2042('0x47')](_0x7fe0d9)){logger[_0x2042('0x53')]('File:\x20\x22'+_0x7fe0d9+_0x2042('0x57'));fs['unlinkSync'](_0x7fe0d9);}return _0x2d2b99;})['then'](function(_0x45a6f9){if(!_0x45a6f9)throw new InternalError();return _0x45a6f9[_0x2042('0x52')]();})[_0x2042('0x1e')](function(){_0x31955e[_0x2042('0x15')](0xcc)[_0x2042('0x16')]();})['catch'](handleError(_0x31955e,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 82566a3..9eb2ab0 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 _0x455e=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','../../config/logger'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x455e,0xa9));var _0xe455=function(_0x211041,_0x59e4ff){_0x211041=_0x211041-0x0;var _0x34f961=_0x455e[_0x211041];return _0x34f961;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe455('0x0'))(_0xe455('0x1'));var moment=require(_0xe455('0x2'));var BPromise=require(_0xe455('0x3'));var rp=require(_0xe455('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe455('0x5'));var config=require(_0xe455('0x6'));var attributes=require(_0xe455('0x7'));module[_0xe455('0x8')]=function(_0xad1c2,_0x2efb59){return _0xad1c2[_0xe455('0x9')]('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f47=['api','moment','bluebird','request-promise','path','../../config/environment','./squareRecording.attributes','define','SquareRecording','../../config/logger'];(function(_0x156683,_0x34ec1e){var _0x369fdd=function(_0x300660){while(--_0x300660){_0x156683['push'](_0x156683['shift']());}};_0x369fdd(++_0x34ec1e);}(_0x1f47,0x1ad));var _0x71f4=function(_0x5d8f81,_0x3f0f43){_0x5d8f81=_0x5d8f81-0x0;var _0x2a79a6=_0x1f47[_0x5d8f81];return _0x2a79a6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x71f4('0x0'))(_0x71f4('0x1'));var moment=require(_0x71f4('0x2'));var BPromise=require(_0x71f4('0x3'));var rp=require(_0x71f4('0x4'));var fs=require('fs');var path=require(_0x71f4('0x5'));var rimraf=require('rimraf');var config=require(_0x71f4('0x6'));var attributes=require(_0x71f4('0x7'));module['exports']=function(_0x3c2791,_0x3cc805){return _0x3c2791[_0x71f4('0x8')](_0x71f4('0x9'),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 fb39e00..746f206 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 _0x17c5=['CreateSquareRecording','stringify','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','message','result','SquareRecording','body','options'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x17c5,0x148));var _0x517c=function(_0x3d9319,_0x390e90){_0x3d9319=_0x3d9319-0x0;var _0x52bc3a=_0x17c5[_0x3d9319];return _0x52bc3a;};'use strict';var _=require(_0x517c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x517c('0x1'));var rs=require(_0x517c('0x2'));var fs=require('fs');var Redis=require(_0x517c('0x3'));var db=require(_0x517c('0x4'))['db'];var utils=require(_0x517c('0x5'));var logger=require(_0x517c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x517c('0x7'));var client=jayson['client'][_0x517c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x261281,_0x25c6f5,_0x390f58){return new BPromise(function(_0x100ed8,_0xd7f6e0){return client[_0x517c('0x9')](_0x261281,_0x390f58)[_0x517c('0xa')](function(_0x59a5ad){logger[_0x517c('0xb')](_0x517c('0xc'),_0x25c6f5,_0x517c('0xd'));logger[_0x517c('0xe')](_0x517c('0xf'),_0x25c6f5,_0x517c('0xd'),JSON['stringify'](_0x59a5ad));if(_0x59a5ad[_0x517c('0x10')]){if(_0x59a5ad[_0x517c('0x10')]['code']===0x1f4){logger[_0x517c('0x10')](_0x517c('0xc'),_0x25c6f5,_0x59a5ad[_0x517c('0x10')][_0x517c('0x11')]);return _0xd7f6e0(_0x59a5ad['error'][_0x517c('0x11')]);}logger[_0x517c('0x10')]('SquareRecording,\x20%s,\x20%s',_0x25c6f5,_0x59a5ad[_0x517c('0x10')][_0x517c('0x11')]);return _0x100ed8(_0x59a5ad[_0x517c('0x10')][_0x517c('0x11')]);}else{logger['info'](_0x517c('0xc'),_0x25c6f5,_0x517c('0xd'));_0x100ed8(_0x59a5ad[_0x517c('0x12')]['message']);}})['catch'](function(_0x1b5399){logger[_0x517c('0x10')]('SquareRecording,\x20%s,\x20%s',_0x25c6f5,_0x1b5399);_0xd7f6e0(_0x1b5399);});});}exports['CreateSquareRecording']=function(_0x4249e1){var _0x4bc090=this;return new Promise(function(_0x202a77,_0x18ce87){return db[_0x517c('0x13')]['create'](_0x4249e1[_0x517c('0x14')],{'raw':_0x4249e1[_0x517c('0x15')]?_0x4249e1[_0x517c('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x517c('0xa')](function(_0x3a93f7){logger[_0x517c('0xb')](_0x517c('0x16'),_0x4249e1);logger[_0x517c('0xe')]('CreateSquareRecording',_0x4249e1,JSON[_0x517c('0x17')](_0x3a93f7));_0x202a77(_0x3a93f7);})[_0x517c('0x18')](function(_0xc68a09){logger['error']('CreateSquareRecording',_0xc68a09['message'],_0x4249e1);_0x18ce87(_0x4bc090[_0x517c('0x10')](0x1f4,_0xc68a09[_0x517c('0x11')]));});});}; \ No newline at end of file +var _0xc9a7=['error','code','message','result','catch','CreateSquareRecording','create','body','options','raw','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s'];(function(_0x38938e,_0x1d1140){var _0x1cd043=function(_0x4117d0){while(--_0x4117d0){_0x38938e['push'](_0x38938e['shift']());}};_0x1cd043(++_0x1d1140);}(_0xc9a7,0xb3));var _0x7c9a=function(_0xeda421,_0x1762a3){_0xeda421=_0xeda421-0x0;var _0x20c697=_0xc9a7[_0xeda421];return _0x20c697;};'use strict';var _=require(_0x7c9a('0x0'));var util=require(_0x7c9a('0x1'));var moment=require(_0x7c9a('0x2'));var BPromise=require('bluebird');var rs=require(_0x7c9a('0x3'));var fs=require('fs');var Redis=require(_0x7c9a('0x4'));var db=require(_0x7c9a('0x5'))['db'];var utils=require(_0x7c9a('0x6'));var logger=require(_0x7c9a('0x7'))(_0x7c9a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7c9a('0x9')][_0x7c9a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x460b55,_0x522ca9,_0x1cd848){return new BPromise(function(_0x1e48bd,_0x4e9328){return client[_0x7c9a('0xb')](_0x460b55,_0x1cd848)['then'](function(_0x58b966){logger[_0x7c9a('0xc')](_0x7c9a('0xd'),_0x522ca9,_0x7c9a('0xe'));logger[_0x7c9a('0xf')](_0x7c9a('0x10'),_0x522ca9,_0x7c9a('0xe'),JSON['stringify'](_0x58b966));if(_0x58b966[_0x7c9a('0x11')]){if(_0x58b966['error'][_0x7c9a('0x12')]===0x1f4){logger['error'](_0x7c9a('0xd'),_0x522ca9,_0x58b966['error']['message']);return _0x4e9328(_0x58b966[_0x7c9a('0x11')][_0x7c9a('0x13')]);}logger[_0x7c9a('0x11')](_0x7c9a('0xd'),_0x522ca9,_0x58b966[_0x7c9a('0x11')][_0x7c9a('0x13')]);return _0x1e48bd(_0x58b966[_0x7c9a('0x11')][_0x7c9a('0x13')]);}else{logger[_0x7c9a('0xc')](_0x7c9a('0xd'),_0x522ca9,_0x7c9a('0xe'));_0x1e48bd(_0x58b966[_0x7c9a('0x14')][_0x7c9a('0x13')]);}})[_0x7c9a('0x15')](function(_0x3b5e84){logger['error']('SquareRecording,\x20%s,\x20%s',_0x522ca9,_0x3b5e84);_0x4e9328(_0x3b5e84);});});}exports[_0x7c9a('0x16')]=function(_0x8860c1){var _0x8498fe=this;return new Promise(function(_0xabda6,_0x34b3e0){return db['SquareRecording'][_0x7c9a('0x17')](_0x8860c1[_0x7c9a('0x18')],{'raw':_0x8860c1[_0x7c9a('0x19')]?_0x8860c1[_0x7c9a('0x19')][_0x7c9a('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x525545){logger[_0x7c9a('0xc')](_0x7c9a('0x16'),_0x8860c1);logger[_0x7c9a('0xf')]('CreateSquareRecording',_0x8860c1,JSON[_0x7c9a('0x1b')](_0x525545));_0xabda6(_0x525545);})[_0x7c9a('0x15')](function(_0x880f64){logger[_0x7c9a('0x11')](_0x7c9a('0x16'),_0x880f64[_0x7c9a('0x13')],_0x8860c1);_0x34b3e0(_0x8498fe[_0x7c9a('0x11')](0x1f4,_0x880f64[_0x7c9a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 9d34326..878250f 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 _0xb58f=['../../config/environment','get','index','isAuthenticated','describe','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0xb58f,0x1ce));var _0xfb58=function(_0x2f1b37,_0x329b97){_0x2f1b37=_0x2f1b37-0x0;var _0x665152=_0xb58f[_0x2f1b37];return _0x665152;};'use strict';var multer=require(_0xfb58('0x0'));var util=require(_0xfb58('0x1'));var path=require(_0xfb58('0x2'));var timeout=require(_0xfb58('0x3'));var express=require('express');var router=express[_0xfb58('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xfb58('0x5'));var config=require(_0xfb58('0x6'));var controller=require('./squareReport.controller');router[_0xfb58('0x7')]('/',auth['isAuthenticated'](),controller[_0xfb58('0x8')]);router[_0xfb58('0x7')]('/describe',auth[_0xfb58('0x9')](),controller[_0xfb58('0xa')]);router[_0xfb58('0x7')](_0xfb58('0xb'),auth['isAuthenticated'](),controller[_0xfb58('0xc')]);router[_0xfb58('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfb58('0xe')](_0xfb58('0xb'),auth[_0xfb58('0x9')](),controller['update']);router[_0xfb58('0xf')](_0xfb58('0xb'),auth[_0xfb58('0x9')](),controller[_0xfb58('0x10')]);module[_0xfb58('0x11')]=router; \ No newline at end of file +var _0xf6b5=['get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x55a48d,_0x49b9e0){var _0x4f2cb3=function(_0x265e4a){while(--_0x265e4a){_0x55a48d['push'](_0x55a48d['shift']());}};_0x4f2cb3(++_0x49b9e0);}(_0xf6b5,0x1e6));var _0x5f6b=function(_0x1030ce,_0xbe3f74){_0x1030ce=_0x1030ce-0x0;var _0x3367fd=_0xf6b5[_0x1030ce];return _0x3367fd;};'use strict';var multer=require(_0x5f6b('0x0'));var util=require(_0x5f6b('0x1'));var path=require('path');var timeout=require(_0x5f6b('0x2'));var express=require(_0x5f6b('0x3'));var router=express[_0x5f6b('0x4')]();var auth=require(_0x5f6b('0x5'));var interaction=require(_0x5f6b('0x6'));var config=require(_0x5f6b('0x7'));var controller=require('./squareReport.controller');router[_0x5f6b('0x8')]('/',auth[_0x5f6b('0x9')](),controller[_0x5f6b('0xa')]);router[_0x5f6b('0x8')](_0x5f6b('0xb'),auth['isAuthenticated'](),controller[_0x5f6b('0xc')]);router[_0x5f6b('0x8')](_0x5f6b('0xd'),auth[_0x5f6b('0x9')](),controller[_0x5f6b('0xe')]);router['post']('/',auth[_0x5f6b('0x9')](),controller['create']);router[_0x5f6b('0xf')]('/:id',auth[_0x5f6b('0x9')](),controller[_0x5f6b('0x10')]);router[_0x5f6b('0x11')](_0x5f6b('0xd'),auth[_0x5f6b('0x9')](),controller['destroy']);module[_0x5f6b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index a0f1d2b..12b5cd7 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 _0xfaea=['DATE','sequelize','exports','STRING'];(function(_0x9e1b61,_0x61dd10){var _0x1be421=function(_0x115b08){while(--_0x115b08){_0x9e1b61['push'](_0x9e1b61['shift']());}};_0x1be421(++_0x61dd10);}(_0xfaea,0xf5));var _0xafae=function(_0x3d3b05,_0x334c57){_0x3d3b05=_0x3d3b05-0x0;var _0x2c6ca3=_0xfaea[_0x3d3b05];return _0x2c6ca3;};'use strict';var Sequelize=require(_0xafae('0x0'));module[_0xafae('0x1')]={'network':{'type':Sequelize[_0xafae('0x2')]},'network_script':{'type':Sequelize[_0xafae('0x2')]},'request':{'type':Sequelize[_0xafae('0x2')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xafae('0x2')]},'type':{'type':Sequelize[_0xafae('0x2')]},'uniqueid':{'type':Sequelize[_0xafae('0x2')]},'version':{'type':Sequelize[_0xafae('0x2')]},'callerid':{'type':Sequelize[_0xafae('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xafae('0x2')]},'callingani2':{'type':Sequelize[_0xafae('0x2')]},'callington':{'type':Sequelize[_0xafae('0x2')]},'callingtns':{'type':Sequelize[_0xafae('0x2')]},'dnid':{'type':Sequelize[_0xafae('0x2')]},'rdnis':{'type':Sequelize[_0xafae('0x2')]},'context':{'type':Sequelize[_0xafae('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xafae('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xafae('0x2')]},'threadid':{'type':Sequelize[_0xafae('0x2')]},'project_name':{'type':Sequelize[_0xafae('0x2')]},'joinAt':{'type':Sequelize[_0xafae('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7817=['STRING','DATE','BOOLEAN','exports'];(function(_0x6148ee,_0x4d2fca){var _0x5afc74=function(_0x351621){while(--_0x351621){_0x6148ee['push'](_0x6148ee['shift']());}};_0x5afc74(++_0x4d2fca);}(_0x7817,0x12f));var _0x7781=function(_0x2fecbc,_0x5e8b04){_0x2fecbc=_0x2fecbc-0x0;var _0x2bab10=_0x7817[_0x2fecbc];return _0x2bab10;};'use strict';var Sequelize=require('sequelize');module[_0x7781('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x7781('0x1')]},'channel':{'type':Sequelize[_0x7781('0x1')]},'language':{'type':Sequelize[_0x7781('0x1')]},'type':{'type':Sequelize[_0x7781('0x1')]},'uniqueid':{'type':Sequelize[_0x7781('0x1')]},'version':{'type':Sequelize[_0x7781('0x1')]},'callerid':{'type':Sequelize[_0x7781('0x1')]},'calleridname':{'type':Sequelize[_0x7781('0x1')]},'callingpres':{'type':Sequelize[_0x7781('0x1')]},'callingani2':{'type':Sequelize[_0x7781('0x1')]},'callington':{'type':Sequelize[_0x7781('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x7781('0x1')]},'rdnis':{'type':Sequelize[_0x7781('0x1')]},'context':{'type':Sequelize[_0x7781('0x1')]},'extension':{'type':Sequelize[_0x7781('0x1')]},'priority':{'type':Sequelize[_0x7781('0x1')]},'enhanced':{'type':Sequelize[_0x7781('0x1')]},'accountcode':{'type':Sequelize[_0x7781('0x1')]},'threadid':{'type':Sequelize[_0x7781('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x7781('0x2')]},'leaveAt':{'type':Sequelize[_0x7781('0x2')]},'bot':{'type':Sequelize[_0x7781('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 94e933c..ef05047 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 _0x382a=['sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','offset','status','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','SquareReport','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','VIRTUAL','merge','options','where','count','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','update','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x48aa6a,_0x359c64){var _0x50cd08=function(_0x812393){while(--_0x812393){_0x48aa6a['push'](_0x48aa6a['shift']());}};_0x50cd08(++_0x359c64);}(_0x382a,0xd8));var _0xa382=function(_0x95975e,_0x51412c){_0x95975e=_0x95975e-0x0;var _0x5d4933=_0x382a[_0x95975e];return _0x5d4933;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xa382('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa382('0x1'));var rp=require(_0xa382('0x2'));var moment=require(_0xa382('0x3'));var BPromise=require(_0xa382('0x4'));var Mustache=require('mustache');var util=require(_0xa382('0x5'));var path=require('path');var sox=require(_0xa382('0x6'));var csv=require(_0xa382('0x7'));var ejs=require(_0xa382('0x8'));var fs=require('fs');var _=require(_0xa382('0x9'));var squel=require('squel');var crypto=require(_0xa382('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa382('0xb'));var toCsv=require(_0xa382('0x7'));var querystring=require(_0xa382('0xc'));var Papa=require(_0xa382('0xd'));var Redis=require(_0xa382('0xe'));var authService=require(_0xa382('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa382('0x10'));var hardwareService=require(_0xa382('0x11'));var logger=require(_0xa382('0x12'))(_0xa382('0x13'));var utils=require(_0xa382('0x14'));var config=require(_0xa382('0x15'));var db=require(_0xa382('0x16'))['db'];function respondWithStatusCode(_0x152dd7,_0x2f3f63){_0x2f3f63=_0x2f3f63||0xcc;return function(_0x20c7da){if(_0x20c7da){return _0x152dd7['sendStatus'](_0x2f3f63);}return _0x152dd7['status'](_0x2f3f63)[_0xa382('0x17')]();};}function respondWithResult(_0x2e9fc9,_0x378087){_0x378087=_0x378087||0xc8;return function(_0x582aff){if(_0x582aff){return _0x2e9fc9['status'](_0x378087)[_0xa382('0x18')](_0x582aff);}};}function respondWithFilteredResult(_0x50d47d,_0x433720){return function(_0x7415b8){if(_0x7415b8){var _0x5ac9c2=_0x7415b8['count'],_0x20eff0=_0x433720[_0xa382('0x19')],_0x1fd299=_0x433720['offset']+_0x433720['limit'],_0x2f3183;if(_0x1fd299>=_0x5ac9c2){_0x1fd299=_0x5ac9c2;_0x2f3183=0xc8;}else{_0x2f3183=0xce;}_0x50d47d[_0xa382('0x1a')](_0x2f3183);return _0x50d47d['set'](_0xa382('0x1b'),_0x20eff0+'-'+_0x1fd299+'/'+_0x5ac9c2)[_0xa382('0x18')](_0x7415b8);}return null;};}function patchUpdates(_0x35f6b1){return function(_0x456573){try{jsonpatch[_0xa382('0x1c')](_0x456573,_0x35f6b1,!![]);}catch(_0x1e3ed3){return BPromise[_0xa382('0x1d')](_0x1e3ed3);}return _0x456573[_0xa382('0x1e')]();};}function saveUpdates(_0x431210,_0x464c8a){return function(_0x170fde){if(_0x170fde){return _0x170fde['update'](_0x431210)[_0xa382('0x1f')](function(_0x424460){return _0x424460;});}return null;};}function removeEntity(_0x441db6,_0x1d8d1d){return function(_0x26e1ac){if(_0x26e1ac){return _0x26e1ac[_0xa382('0x20')]()[_0xa382('0x1f')](function(){_0x441db6[_0xa382('0x1a')](0xcc)[_0xa382('0x17')]();});}};}function handleEntityNotFound(_0x44bb4a,_0x44866e){return function(_0x584637){if(!_0x584637){_0x44bb4a['sendStatus'](0x194);}return _0x584637;};}function handleError(_0x12e825,_0x25e0d4){_0x25e0d4=_0x25e0d4||0x1f4;return function(_0x4736f8){logger[_0xa382('0x21')](_0x4736f8['stack']);if(_0x4736f8[_0xa382('0x22')]){delete _0x4736f8[_0xa382('0x22')];}_0x12e825['status'](_0x25e0d4)[_0xa382('0x23')](_0x4736f8);};}exports[_0xa382('0x24')]=function(_0x29f6bb,_0x4a849c){var _0xd8d1f2={},_0x3bf70e={},_0x12ff20={'count':0x0,'rows':[]};var _0x6d3df7=_[_0xa382('0x25')](db[_0xa382('0x26')][_0xa382('0x27')],function(_0x414854){return{'name':_0x414854['fieldName'],'type':_0x414854[_0xa382('0x28')][_0xa382('0x29')]};});_0x3bf70e[_0xa382('0x2a')]=_[_0xa382('0x25')](_0x6d3df7,_0xa382('0x22'));_0x3bf70e[_0xa382('0x2b')]=_[_0xa382('0x2c')](_0x29f6bb[_0xa382('0x2b')]);_0x3bf70e[_0xa382('0x2d')]=_['intersection'](_0x3bf70e['model'],_0x3bf70e[_0xa382('0x2b')]);_0xd8d1f2[_0xa382('0x2e')]=_[_0xa382('0x2f')](_0x3bf70e[_0xa382('0x2a')],qs[_0xa382('0x30')](_0x29f6bb[_0xa382('0x2b')][_0xa382('0x30')]));_0xd8d1f2[_0xa382('0x2e')]=_0xd8d1f2[_0xa382('0x2e')]['length']?_0xd8d1f2[_0xa382('0x2e')]:_0x3bf70e[_0xa382('0x2a')];if(!_0x29f6bb[_0xa382('0x2b')][_0xa382('0x31')](_0xa382('0x32'))){_0xd8d1f2[_0xa382('0x33')]=qs[_0xa382('0x33')](_0x29f6bb[_0xa382('0x2b')]['limit']);_0xd8d1f2[_0xa382('0x19')]=qs[_0xa382('0x19')](_0x29f6bb[_0xa382('0x2b')][_0xa382('0x19')]);}_0xd8d1f2[_0xa382('0x34')]=qs[_0xa382('0x35')](_0x29f6bb[_0xa382('0x2b')][_0xa382('0x35')]);_0xd8d1f2['where']=qs[_0xa382('0x2d')](_[_0xa382('0x36')](_0x29f6bb[_0xa382('0x2b')],_0x3bf70e[_0xa382('0x2d')]),_0x6d3df7);if(_0x29f6bb[_0xa382('0x2b')][_0xa382('0x37')]){_0xd8d1f2['where']=_['merge'](_0xd8d1f2['where'],{'$or':_[_0xa382('0x25')](_0x6d3df7,function(_0x36c024){if(_0x36c024[_0xa382('0x28')]!==_0xa382('0x38')){var _0x13c5be={};_0x13c5be[_0x36c024[_0xa382('0x22')]]={'$like':'%'+_0x29f6bb[_0xa382('0x2b')][_0xa382('0x37')]+'%'};return _0x13c5be;}})});}_0xd8d1f2=_[_0xa382('0x39')]({},_0xd8d1f2,_0x29f6bb[_0xa382('0x3a')]);var _0x3a813c={'where':_0xd8d1f2[_0xa382('0x3b')]};return db[_0xa382('0x26')]['count'](_0x3a813c)[_0xa382('0x1f')](function(_0x2b4eda){_0x12ff20[_0xa382('0x3c')]=_0x2b4eda;if(_0x29f6bb[_0xa382('0x2b')][_0xa382('0x3d')]){_0xd8d1f2[_0xa382('0x3e')]=[{'all':!![]}];}return db[_0xa382('0x26')][_0xa382('0x3f')](_0xd8d1f2);})[_0xa382('0x1f')](function(_0x4710d5){_0x12ff20[_0xa382('0x40')]=_0x4710d5;return _0x12ff20;})[_0xa382('0x1f')](respondWithFilteredResult(_0x4a849c,_0xd8d1f2))['catch'](handleError(_0x4a849c,null));};exports[_0xa382('0x41')]=function(_0x124637,_0x1c492d){var _0x39a48d={'raw':!![],'where':{'id':_0x124637[_0xa382('0x42')]['id']}},_0x1aa2a8={};_0x1aa2a8[_0xa382('0x2a')]=_['keys'](db[_0xa382('0x26')][_0xa382('0x27')]);_0x1aa2a8['query']=_[_0xa382('0x2c')](_0x124637[_0xa382('0x2b')]);_0x1aa2a8[_0xa382('0x2d')]=_[_0xa382('0x2f')](_0x1aa2a8[_0xa382('0x2a')],_0x1aa2a8[_0xa382('0x2b')]);_0x39a48d[_0xa382('0x2e')]=_[_0xa382('0x2f')](_0x1aa2a8[_0xa382('0x2a')],qs['fields'](_0x124637[_0xa382('0x2b')][_0xa382('0x30')]));_0x39a48d[_0xa382('0x2e')]=_0x39a48d[_0xa382('0x2e')][_0xa382('0x43')]?_0x39a48d[_0xa382('0x2e')]:_0x1aa2a8['model'];if(_0x124637[_0xa382('0x2b')]['includeAll']){_0x39a48d[_0xa382('0x3e')]=[{'all':!![]}];}_0x39a48d=_[_0xa382('0x39')]({},_0x39a48d,_0x124637[_0xa382('0x3a')]);return db[_0xa382('0x26')][_0xa382('0x44')](_0x39a48d)[_0xa382('0x1f')](handleEntityNotFound(_0x1c492d,null))[_0xa382('0x1f')](respondWithResult(_0x1c492d,null))[_0xa382('0x45')](handleError(_0x1c492d,null));};exports['create']=function(_0x492157,_0x19558d){return db['SquareReport'][_0xa382('0x46')](_0x492157[_0xa382('0x47')],{})[_0xa382('0x1f')](respondWithResult(_0x19558d,0xc9))[_0xa382('0x45')](handleError(_0x19558d,null));};exports[_0xa382('0x48')]=function(_0x45bd8d,_0x5b9750){if(_0x45bd8d[_0xa382('0x47')]['id']){delete _0x45bd8d['body']['id'];}return db[_0xa382('0x26')][_0xa382('0x44')]({'where':{'id':_0x45bd8d[_0xa382('0x42')]['id']}})['then'](handleEntityNotFound(_0x5b9750,null))[_0xa382('0x1f')](saveUpdates(_0x45bd8d[_0xa382('0x47')],null))['then'](respondWithResult(_0x5b9750,null))[_0xa382('0x45')](handleError(_0x5b9750,null));};exports['destroy']=function(_0x3903cf,_0x4961d3){return db['SquareReport'][_0xa382('0x44')]({'where':{'id':_0x3903cf[_0xa382('0x42')]['id']}})['then'](handleEntityNotFound(_0x4961d3,null))[_0xa382('0x1f')](removeEntity(_0x4961d3,null))['catch'](handleError(_0x4961d3,null));};exports[_0xa382('0x49')]=function(_0x5b574c,_0x350581){return db[_0xa382('0x26')][_0xa382('0x49')]()[_0xa382('0x1f')](respondWithResult(_0x350581,null))[_0xa382('0x45')](handleError(_0x350581,null));}; \ No newline at end of file +var _0x7a19=['api','../../config/utils','status','end','json','offset','limit','Content-Range','reject','save','update','then','sendStatus','error','name','send','index','map','SquareReport','rawAttributes','key','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','count','includeAll','findAll','rows','catch','params','fields','include','find','create','body','destroy','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x33b033,_0x4f3022){var _0x5ddea6=function(_0x515832){while(--_0x515832){_0x33b033['push'](_0x33b033['shift']());}};_0x5ddea6(++_0x4f3022);}(_0x7a19,0xca));var _0x97a1=function(_0xf0fad9,_0x36e36a){_0xf0fad9=_0xf0fad9-0x0;var _0x55e3ea=_0x7a19[_0xf0fad9];return _0x55e3ea;};'use strict';var pdf=require(_0x97a1('0x0'));var emlformat=require(_0x97a1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x97a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97a1('0x3'));var moment=require(_0x97a1('0x4'));var BPromise=require(_0x97a1('0x5'));var Mustache=require(_0x97a1('0x6'));var util=require(_0x97a1('0x7'));var path=require(_0x97a1('0x8'));var sox=require('sox');var csv=require(_0x97a1('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x97a1('0xa'));var squel=require(_0x97a1('0xb'));var crypto=require(_0x97a1('0xc'));var jsforce=require(_0x97a1('0xd'));var deskjs=require(_0x97a1('0xe'));var toCsv=require(_0x97a1('0x9'));var querystring=require(_0x97a1('0xf'));var Papa=require(_0x97a1('0x10'));var Redis=require(_0x97a1('0x11'));var authService=require(_0x97a1('0x12'));var qs=require(_0x97a1('0x13'));var as=require(_0x97a1('0x14'));var hardwareService=require(_0x97a1('0x15'));var logger=require(_0x97a1('0x16'))(_0x97a1('0x17'));var utils=require(_0x97a1('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d0f02,_0x42cea8){_0x42cea8=_0x42cea8||0xcc;return function(_0x4f3ea6){if(_0x4f3ea6){return _0x2d0f02['sendStatus'](_0x42cea8);}return _0x2d0f02[_0x97a1('0x19')](_0x42cea8)[_0x97a1('0x1a')]();};}function respondWithResult(_0x289455,_0x4cbcbd){_0x4cbcbd=_0x4cbcbd||0xc8;return function(_0x5b3bdb){if(_0x5b3bdb){return _0x289455[_0x97a1('0x19')](_0x4cbcbd)[_0x97a1('0x1b')](_0x5b3bdb);}};}function respondWithFilteredResult(_0x261029,_0x2a49ab){return function(_0x47465){if(_0x47465){var _0x445709=_0x47465['count'],_0x3515e1=_0x2a49ab[_0x97a1('0x1c')],_0x17aec1=_0x2a49ab['offset']+_0x2a49ab[_0x97a1('0x1d')],_0x5d1eff;if(_0x17aec1>=_0x445709){_0x17aec1=_0x445709;_0x5d1eff=0xc8;}else{_0x5d1eff=0xce;}_0x261029[_0x97a1('0x19')](_0x5d1eff);return _0x261029['set'](_0x97a1('0x1e'),_0x3515e1+'-'+_0x17aec1+'/'+_0x445709)['json'](_0x47465);}return null;};}function patchUpdates(_0x2860e0){return function(_0x457f5e){try{jsonpatch['apply'](_0x457f5e,_0x2860e0,!![]);}catch(_0x322745){return BPromise[_0x97a1('0x1f')](_0x322745);}return _0x457f5e[_0x97a1('0x20')]();};}function saveUpdates(_0x556d41,_0x1af1b2){return function(_0x510649){if(_0x510649){return _0x510649[_0x97a1('0x21')](_0x556d41)['then'](function(_0x48c920){return _0x48c920;});}return null;};}function removeEntity(_0x461518,_0x531983){return function(_0x1de748){if(_0x1de748){return _0x1de748['destroy']()[_0x97a1('0x22')](function(){_0x461518['status'](0xcc)[_0x97a1('0x1a')]();});}};}function handleEntityNotFound(_0x3f073f,_0x4e4ee3){return function(_0x209c30){if(!_0x209c30){_0x3f073f[_0x97a1('0x23')](0x194);}return _0x209c30;};}function handleError(_0x599790,_0x1d28b2){_0x1d28b2=_0x1d28b2||0x1f4;return function(_0x5316cc){logger[_0x97a1('0x24')](_0x5316cc['stack']);if(_0x5316cc[_0x97a1('0x25')]){delete _0x5316cc[_0x97a1('0x25')];}_0x599790[_0x97a1('0x19')](_0x1d28b2)[_0x97a1('0x26')](_0x5316cc);};}exports[_0x97a1('0x27')]=function(_0x3c38cf,_0x40e120){var _0x183ec5={},_0x37f551={},_0x37ba45={'count':0x0,'rows':[]};var _0x6a35c3=_[_0x97a1('0x28')](db[_0x97a1('0x29')][_0x97a1('0x2a')],function(_0x228699){return{'name':_0x228699['fieldName'],'type':_0x228699['type'][_0x97a1('0x2b')]};});_0x37f551['model']=_[_0x97a1('0x28')](_0x6a35c3,_0x97a1('0x25'));_0x37f551['query']=_[_0x97a1('0x2c')](_0x3c38cf[_0x97a1('0x2d')]);_0x37f551[_0x97a1('0x2e')]=_[_0x97a1('0x2f')](_0x37f551[_0x97a1('0x30')],_0x37f551[_0x97a1('0x2d')]);_0x183ec5[_0x97a1('0x31')]=_[_0x97a1('0x2f')](_0x37f551[_0x97a1('0x30')],qs['fields'](_0x3c38cf[_0x97a1('0x2d')]['fields']));_0x183ec5[_0x97a1('0x31')]=_0x183ec5[_0x97a1('0x31')][_0x97a1('0x32')]?_0x183ec5['attributes']:_0x37f551['model'];if(!_0x3c38cf[_0x97a1('0x2d')][_0x97a1('0x33')](_0x97a1('0x34'))){_0x183ec5[_0x97a1('0x1d')]=qs[_0x97a1('0x1d')](_0x3c38cf[_0x97a1('0x2d')][_0x97a1('0x1d')]);_0x183ec5[_0x97a1('0x1c')]=qs[_0x97a1('0x1c')](_0x3c38cf[_0x97a1('0x2d')][_0x97a1('0x1c')]);}_0x183ec5[_0x97a1('0x35')]=qs['sort'](_0x3c38cf[_0x97a1('0x2d')][_0x97a1('0x36')]);_0x183ec5[_0x97a1('0x37')]=qs[_0x97a1('0x2e')](_[_0x97a1('0x38')](_0x3c38cf[_0x97a1('0x2d')],_0x37f551[_0x97a1('0x2e')]),_0x6a35c3);if(_0x3c38cf[_0x97a1('0x2d')]['filter']){_0x183ec5[_0x97a1('0x37')]=_[_0x97a1('0x39')](_0x183ec5[_0x97a1('0x37')],{'$or':_[_0x97a1('0x28')](_0x6a35c3,function(_0x23ff06){if(_0x23ff06[_0x97a1('0x3a')]!==_0x97a1('0x3b')){var _0x16b4c5={};_0x16b4c5[_0x23ff06[_0x97a1('0x25')]]={'$like':'%'+_0x3c38cf[_0x97a1('0x2d')][_0x97a1('0x3c')]+'%'};return _0x16b4c5;}})});}_0x183ec5=_['merge']({},_0x183ec5,_0x3c38cf[_0x97a1('0x3d')]);var _0x446d51={'where':_0x183ec5[_0x97a1('0x37')]};return db[_0x97a1('0x29')]['count'](_0x446d51)[_0x97a1('0x22')](function(_0xd53a6a){_0x37ba45[_0x97a1('0x3e')]=_0xd53a6a;if(_0x3c38cf['query'][_0x97a1('0x3f')]){_0x183ec5['include']=[{'all':!![]}];}return db['SquareReport'][_0x97a1('0x40')](_0x183ec5);})['then'](function(_0x3b5741){_0x37ba45[_0x97a1('0x41')]=_0x3b5741;return _0x37ba45;})[_0x97a1('0x22')](respondWithFilteredResult(_0x40e120,_0x183ec5))[_0x97a1('0x42')](handleError(_0x40e120,null));};exports['show']=function(_0x22cac4,_0x590fba){var _0x1dfcf4={'raw':!![],'where':{'id':_0x22cac4[_0x97a1('0x43')]['id']}},_0x27fda4={};_0x27fda4[_0x97a1('0x30')]=_[_0x97a1('0x2c')](db[_0x97a1('0x29')][_0x97a1('0x2a')]);_0x27fda4[_0x97a1('0x2d')]=_[_0x97a1('0x2c')](_0x22cac4[_0x97a1('0x2d')]);_0x27fda4['filters']=_[_0x97a1('0x2f')](_0x27fda4[_0x97a1('0x30')],_0x27fda4['query']);_0x1dfcf4[_0x97a1('0x31')]=_['intersection'](_0x27fda4[_0x97a1('0x30')],qs[_0x97a1('0x44')](_0x22cac4[_0x97a1('0x2d')][_0x97a1('0x44')]));_0x1dfcf4[_0x97a1('0x31')]=_0x1dfcf4[_0x97a1('0x31')][_0x97a1('0x32')]?_0x1dfcf4[_0x97a1('0x31')]:_0x27fda4[_0x97a1('0x30')];if(_0x22cac4[_0x97a1('0x2d')][_0x97a1('0x3f')]){_0x1dfcf4[_0x97a1('0x45')]=[{'all':!![]}];}_0x1dfcf4=_['merge']({},_0x1dfcf4,_0x22cac4[_0x97a1('0x3d')]);return db[_0x97a1('0x29')][_0x97a1('0x46')](_0x1dfcf4)[_0x97a1('0x22')](handleEntityNotFound(_0x590fba,null))[_0x97a1('0x22')](respondWithResult(_0x590fba,null))['catch'](handleError(_0x590fba,null));};exports[_0x97a1('0x47')]=function(_0xa3f5a6,_0x17f986){return db[_0x97a1('0x29')][_0x97a1('0x47')](_0xa3f5a6[_0x97a1('0x48')],{})[_0x97a1('0x22')](respondWithResult(_0x17f986,0xc9))[_0x97a1('0x42')](handleError(_0x17f986,null));};exports[_0x97a1('0x21')]=function(_0x492e95,_0x3ada01){if(_0x492e95[_0x97a1('0x48')]['id']){delete _0x492e95[_0x97a1('0x48')]['id'];}return db[_0x97a1('0x29')][_0x97a1('0x46')]({'where':{'id':_0x492e95[_0x97a1('0x43')]['id']}})[_0x97a1('0x22')](handleEntityNotFound(_0x3ada01,null))[_0x97a1('0x22')](saveUpdates(_0x492e95[_0x97a1('0x48')],null))[_0x97a1('0x22')](respondWithResult(_0x3ada01,null))[_0x97a1('0x42')](handleError(_0x3ada01,null));};exports[_0x97a1('0x49')]=function(_0x4de5e2,_0x274431){return db[_0x97a1('0x29')]['find']({'where':{'id':_0x4de5e2[_0x97a1('0x43')]['id']}})[_0x97a1('0x22')](handleEntityNotFound(_0x274431,null))[_0x97a1('0x22')](removeEntity(_0x274431,null))[_0x97a1('0x42')](handleError(_0x274431,null));};exports[_0x97a1('0x4a')]=function(_0x4af798,_0x4ae1de){return db[_0x97a1('0x29')][_0x97a1('0x4a')]()[_0x97a1('0x22')](respondWithResult(_0x4ae1de,null))[_0x97a1('0x42')](handleError(_0x4ae1de,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 998d88b..b342f76 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 _0xee42=['api','moment','bluebird','rimraf','../../config/environment','./squareReport.attributes','define','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','../../config/logger'];(function(_0xb56ecf,_0x2ffcd0){var _0x507e67=function(_0x3c279e){while(--_0x3c279e){_0xb56ecf['push'](_0xb56ecf['shift']());}};_0x507e67(++_0x2ffcd0);}(_0xee42,0x1e8));var _0x2ee4=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xee42[_0x710815];return _0x5b3b89;};'use strict';var _=require(_0x2ee4('0x0'));var util=require('util');var logger=require(_0x2ee4('0x1'))(_0x2ee4('0x2'));var moment=require(_0x2ee4('0x3'));var BPromise=require(_0x2ee4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2ee4('0x5'));var config=require(_0x2ee4('0x6'));var attributes=require(_0x2ee4('0x7'));module['exports']=function(_0xf1eb7a,_0x3d5876){return _0xf1eb7a[_0x2ee4('0x8')]('SquareReport',attributes,{'tableName':_0x2ee4('0x9'),'paranoid':![],'indexes':[{'name':_0x2ee4('0xa'),'fields':[_0x2ee4('0xb'),_0x2ee4('0xc')]},{'name':_0x2ee4('0xd'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa1e2=['bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment'];(function(_0x117dfd,_0x47000e){var _0x43f351=function(_0x7be826){while(--_0x7be826){_0x117dfd['push'](_0x117dfd['shift']());}};_0x43f351(++_0x47000e);}(_0xa1e2,0xe5));var _0x2a1e=function(_0x1ad7ae,_0xf4e5c8){_0x1ad7ae=_0x1ad7ae-0x0;var _0x15f474=_0xa1e2[_0x1ad7ae];return _0x15f474;};'use strict';var _=require(_0x2a1e('0x0'));var util=require(_0x2a1e('0x1'));var logger=require(_0x2a1e('0x2'))(_0x2a1e('0x3'));var moment=require(_0x2a1e('0x4'));var BPromise=require(_0x2a1e('0x5'));var rp=require(_0x2a1e('0x6'));var fs=require('fs');var path=require(_0x2a1e('0x7'));var rimraf=require(_0x2a1e('0x8'));var config=require(_0x2a1e('0x9'));var attributes=require(_0x2a1e('0xa'));module[_0x2a1e('0xb')]=function(_0x411bde,_0x409ba4){return _0x411bde['define'](_0x2a1e('0xc'),attributes,{'tableName':_0x2a1e('0xd'),'paranoid':![],'indexes':[{'name':_0x2a1e('0xe'),'fields':[_0x2a1e('0xf'),_0x2a1e('0x10')]},{'name':_0x2a1e('0x11'),'fields':[_0x2a1e('0x11')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index ce616bb..2ad96ae 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 _0xbee7=['where','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update'];(function(_0x35883e,_0x57da5f){var _0x316cda=function(_0x15a62a){while(--_0x15a62a){_0x35883e['push'](_0x35883e['shift']());}};_0x316cda(++_0x57da5f);}(_0xbee7,0x10f));var _0x7bee=function(_0x2a3489,_0x2b1462){_0x2a3489=_0x2a3489-0x0;var _0x5e4ce=_0xbee7[_0x2a3489];return _0x5e4ce;};'use strict';var _=require('lodash');var util=require(_0x7bee('0x0'));var moment=require(_0x7bee('0x1'));var BPromise=require(_0x7bee('0x2'));var rs=require(_0x7bee('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7bee('0x4'))['db'];var utils=require(_0x7bee('0x5'));var logger=require(_0x7bee('0x6'))('rpc');var config=require(_0x7bee('0x7'));var jayson=require(_0x7bee('0x8'));var client=jayson['client'][_0x7bee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1147a1,_0x234004,_0x5000b9){return new BPromise(function(_0xe3a052,_0x32ad2c){return client[_0x7bee('0xa')](_0x1147a1,_0x5000b9)[_0x7bee('0xb')](function(_0x490673){logger[_0x7bee('0xc')](_0x7bee('0xd'),_0x234004,_0x7bee('0xe'));logger[_0x7bee('0xf')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x234004,_0x7bee('0xe'),JSON[_0x7bee('0x10')](_0x490673));if(_0x490673[_0x7bee('0x11')]){if(_0x490673[_0x7bee('0x11')][_0x7bee('0x12')]===0x1f4){logger[_0x7bee('0x11')](_0x7bee('0xd'),_0x234004,_0x490673[_0x7bee('0x11')][_0x7bee('0x13')]);return _0x32ad2c(_0x490673[_0x7bee('0x11')]['message']);}logger[_0x7bee('0x11')](_0x7bee('0xd'),_0x234004,_0x490673[_0x7bee('0x11')][_0x7bee('0x13')]);return _0xe3a052(_0x490673[_0x7bee('0x11')][_0x7bee('0x13')]);}else{logger[_0x7bee('0xc')](_0x7bee('0xd'),_0x234004,_0x7bee('0xe'));_0xe3a052(_0x490673[_0x7bee('0x14')][_0x7bee('0x13')]);}})['catch'](function(_0x2755ac){logger[_0x7bee('0x11')]('SquareReport,\x20%s,\x20%s',_0x234004,_0x2755ac);_0x32ad2c(_0x2755ac);});});}exports[_0x7bee('0x15')]=function(_0x5b6aac){var _0x437103=this;return new Promise(function(_0x3e18ed,_0x415481){return db[_0x7bee('0x16')][_0x7bee('0x17')](_0x5b6aac[_0x7bee('0x18')],{'raw':_0x5b6aac[_0x7bee('0x19')]?_0x5b6aac['options'][_0x7bee('0x1a')]===undefined?!![]:![]:!![]})[_0x7bee('0xb')](function(_0x11ef97){logger['info'](_0x7bee('0x15'),_0x5b6aac);logger[_0x7bee('0xf')](_0x7bee('0x15'),_0x5b6aac,JSON[_0x7bee('0x10')](_0x11ef97));_0x3e18ed(_0x11ef97);})['catch'](function(_0x43826b){logger[_0x7bee('0x11')](_0x7bee('0x15'),_0x43826b['message'],_0x5b6aac);_0x415481(_0x437103['error'](0x1f4,_0x43826b[_0x7bee('0x13')]));});});};exports[_0x7bee('0x1b')]=function(_0x4f313f){var _0x24b3a3=this;return new Promise(function(_0x4485f4,_0x45b651){return db[_0x7bee('0x16')][_0x7bee('0x1c')](_0x4f313f[_0x7bee('0x18')],{'raw':_0x4f313f[_0x7bee('0x19')]?_0x4f313f[_0x7bee('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f313f[_0x7bee('0x19')]?_0x4f313f[_0x7bee('0x19')][_0x7bee('0x1d')]||null:null,'attributes':_0x4f313f[_0x7bee('0x19')]?_0x4f313f[_0x7bee('0x19')]['attributes']||null:null,'limit':_0x4f313f[_0x7bee('0x19')]?_0x4f313f[_0x7bee('0x19')]['limit']||null:null})[_0x7bee('0xb')](function(_0x4da80c){logger['info'](_0x7bee('0x1b'),_0x4f313f);logger['debug'](_0x7bee('0x1b'),_0x4f313f,JSON[_0x7bee('0x10')](_0x4da80c));_0x4485f4(_0x4da80c);})['catch'](function(_0x30d2ce){logger['error'](_0x7bee('0x1b'),_0x30d2ce[_0x7bee('0x13')],_0x4f313f);_0x45b651(_0x24b3a3[_0x7bee('0x11')](0x1f4,_0x30d2ce[_0x7bee('0x13')]));});});}; \ No newline at end of file +var _0x0924=['jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateSquareReport','SquareReport','body','options','raw','stringify','UpdateSquareReport','update','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x187de9,_0x5da8c8){var _0x52684c=function(_0x537450){while(--_0x537450){_0x187de9['push'](_0x187de9['shift']());}};_0x52684c(++_0x5da8c8);}(_0x0924,0xdf));var _0x4092=function(_0x17c483,_0xc69535){_0x17c483=_0x17c483-0x0;var _0x112bdb=_0x0924[_0x17c483];return _0x112bdb;};'use strict';var _=require(_0x4092('0x0'));var util=require(_0x4092('0x1'));var moment=require(_0x4092('0x2'));var BPromise=require(_0x4092('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4092('0x4'));var db=require(_0x4092('0x5'))['db'];var utils=require(_0x4092('0x6'));var logger=require('../../config/logger')(_0x4092('0x7'));var config=require('../../config/environment');var jayson=require(_0x4092('0x8'));var client=jayson[_0x4092('0x9')][_0x4092('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54463b,_0x1c0981,_0x35e1ea){return new BPromise(function(_0x3d4b63,_0x4621eb){return client[_0x4092('0xb')](_0x54463b,_0x35e1ea)[_0x4092('0xc')](function(_0x208536){logger[_0x4092('0xd')](_0x4092('0xe'),_0x1c0981,'request\x20sent');logger[_0x4092('0xf')](_0x4092('0x10'),_0x1c0981,_0x4092('0x11'),JSON['stringify'](_0x208536));if(_0x208536[_0x4092('0x12')]){if(_0x208536[_0x4092('0x12')][_0x4092('0x13')]===0x1f4){logger[_0x4092('0x12')](_0x4092('0xe'),_0x1c0981,_0x208536[_0x4092('0x12')][_0x4092('0x14')]);return _0x4621eb(_0x208536['error']['message']);}logger[_0x4092('0x12')](_0x4092('0xe'),_0x1c0981,_0x208536[_0x4092('0x12')][_0x4092('0x14')]);return _0x3d4b63(_0x208536[_0x4092('0x12')][_0x4092('0x14')]);}else{logger[_0x4092('0xd')](_0x4092('0xe'),_0x1c0981,_0x4092('0x11'));_0x3d4b63(_0x208536[_0x4092('0x15')][_0x4092('0x14')]);}})[_0x4092('0x16')](function(_0x3506b7){logger['error']('SquareReport,\x20%s,\x20%s',_0x1c0981,_0x3506b7);_0x4621eb(_0x3506b7);});});}exports[_0x4092('0x17')]=function(_0xf38eb6){var _0x4be1ff=this;return new Promise(function(_0x5aba67,_0x54df9e){return db[_0x4092('0x18')]['create'](_0xf38eb6[_0x4092('0x19')],{'raw':_0xf38eb6[_0x4092('0x1a')]?_0xf38eb6['options'][_0x4092('0x1b')]===undefined?!![]:![]:!![]})[_0x4092('0xc')](function(_0x3959a0){logger['info']('CreateSquareReport',_0xf38eb6);logger['debug']('CreateSquareReport',_0xf38eb6,JSON[_0x4092('0x1c')](_0x3959a0));_0x5aba67(_0x3959a0);})[_0x4092('0x16')](function(_0x498cf4){logger[_0x4092('0x12')](_0x4092('0x17'),_0x498cf4[_0x4092('0x14')],_0xf38eb6);_0x54df9e(_0x4be1ff[_0x4092('0x12')](0x1f4,_0x498cf4[_0x4092('0x14')]));});});};exports[_0x4092('0x1d')]=function(_0x44ae31){var _0x105b9e=this;return new Promise(function(_0x29c630,_0xf1ffe5){return db['SquareReport'][_0x4092('0x1e')](_0x44ae31[_0x4092('0x19')],{'raw':_0x44ae31[_0x4092('0x1a')]?_0x44ae31[_0x4092('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44ae31[_0x4092('0x1a')]?_0x44ae31['options']['where']||null:null,'attributes':_0x44ae31['options']?_0x44ae31[_0x4092('0x1a')][_0x4092('0x1f')]||null:null,'limit':_0x44ae31['options']?_0x44ae31[_0x4092('0x1a')][_0x4092('0x20')]||null:null})[_0x4092('0xc')](function(_0x2f2087){logger['info'](_0x4092('0x1d'),_0x44ae31);logger[_0x4092('0xf')]('UpdateSquareReport',_0x44ae31,JSON[_0x4092('0x1c')](_0x2f2087));_0x29c630(_0x2f2087);})[_0x4092('0x16')](function(_0x59bca8){logger[_0x4092('0x12')](_0x4092('0x1d'),_0x59bca8[_0x4092('0x14')],_0x44ae31);_0xf1ffe5(_0x105b9e['error'](0x1f4,_0x59bca8[_0x4092('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index d3082bd..7ff7f1e 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 _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x14a8ee,_0x261235){var _0x4d3352=function(_0x9a2995){while(--_0x9a2995){_0x14a8ee['push'](_0x14a8ee['shift']());}};_0x4d3352(++_0x261235);}(_0x7a54,0x106));var _0x47a5=function(_0x26da47,_0x139e93){_0x26da47=_0x26da47-0x0;var _0x506213=_0x7a54[_0x26da47];return _0x506213;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file +var _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x4f011b,_0xdb6c19){var _0x530ea5=function(_0x1f8bc7){while(--_0x1f8bc7){_0x4f011b['push'](_0x4f011b['shift']());}};_0x530ea5(++_0xdb6c19);}(_0x7a54,0x106));var _0x47a5=function(_0x45ed6d,_0x5d71a5){_0x45ed6d=_0x45ed6d-0x0;var _0x5b48e9=_0x7a54[_0x45ed6d];return _0x5b48e9;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('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 60d42db..3d42e9a 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 _0xc335=['STRING','TEXT','sequelize','exports'];(function(_0x41aa36,_0x409ce0){var _0x3c5bb1=function(_0x4b21b1){while(--_0x4b21b1){_0x41aa36['push'](_0x41aa36['shift']());}};_0x3c5bb1(++_0x409ce0);}(_0xc335,0x136));var _0x5c33=function(_0x474128,_0x5f4065){_0x474128=_0x474128-0x0;var _0x1aa478=_0xc335[_0x474128];return _0x1aa478;};'use strict';var Sequelize=require(_0x5c33('0x0'));module[_0x5c33('0x1')]={'uniqueid':{'type':Sequelize[_0x5c33('0x2')]},'node':{'type':Sequelize[_0x5c33('0x2')]},'application':{'type':Sequelize[_0x5c33('0x2')]},'data':{'type':Sequelize[_0x5c33('0x3')]},'project_name':{'type':Sequelize[_0x5c33('0x2')]},'callerid':{'type':Sequelize[_0x5c33('0x2')]}}; \ No newline at end of file +var _0x5e86=['sequelize','exports','STRING','TEXT'];(function(_0x50e7d2,_0x5c356d){var _0x2d222d=function(_0x4fdfed){while(--_0x4fdfed){_0x50e7d2['push'](_0x50e7d2['shift']());}};_0x2d222d(++_0x5c356d);}(_0x5e86,0x78));var _0x65e8=function(_0x47961a,_0x2a5da6){_0x47961a=_0x47961a-0x0;var _0x1b6d9d=_0x5e86[_0x47961a];return _0x1b6d9d;};'use strict';var Sequelize=require(_0x65e8('0x0'));module[_0x65e8('0x1')]={'uniqueid':{'type':Sequelize[_0x65e8('0x2')]},'node':{'type':Sequelize[_0x65e8('0x2')]},'application':{'type':Sequelize[_0x65e8('0x2')]},'data':{'type':Sequelize[_0x65e8('0x3')]},'project_name':{'type':Sequelize[_0x65e8('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 94cd0a1..5b8c328 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 _0xa7f1=['index','SquareDetailsReport','rawAttributes','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','rows','catch','params','includeAll','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','Content-Range','apply','save','update','then','destroy','name'];(function(_0x5c1f16,_0x2fbb9e){var _0x491289=function(_0x101acc){while(--_0x101acc){_0x5c1f16['push'](_0x5c1f16['shift']());}};_0x491289(++_0x2fbb9e);}(_0xa7f1,0x17b));var _0x1a7f=function(_0x2e72c7,_0x3cefda){_0x2e72c7=_0x2e72c7-0x0;var _0x12f876=_0xa7f1[_0x2e72c7];return _0x12f876;};'use strict';var pdf=require(_0x1a7f('0x0'));var emlformat=require(_0x1a7f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1a7f('0x2'));var jsonpatch=require(_0x1a7f('0x3'));var rp=require(_0x1a7f('0x4'));var moment=require(_0x1a7f('0x5'));var BPromise=require(_0x1a7f('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1a7f('0x7'));var sox=require(_0x1a7f('0x8'));var csv=require(_0x1a7f('0x9'));var ejs=require(_0x1a7f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1a7f('0xb'));var crypto=require('crypto');var jsforce=require(_0x1a7f('0xc'));var deskjs=require(_0x1a7f('0xd'));var toCsv=require(_0x1a7f('0x9'));var querystring=require('querystring');var Papa=require(_0x1a7f('0xe'));var Redis=require(_0x1a7f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1a7f('0x10'));var as=require(_0x1a7f('0x11'));var hardwareService=require(_0x1a7f('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x1a7f('0x13'));var config=require(_0x1a7f('0x14'));var db=require(_0x1a7f('0x15'))['db'];function respondWithStatusCode(_0x392f7a,_0xea6b14){_0xea6b14=_0xea6b14||0xcc;return function(_0x3fd59c){if(_0x3fd59c){return _0x392f7a[_0x1a7f('0x16')](_0xea6b14);}return _0x392f7a['status'](_0xea6b14)[_0x1a7f('0x17')]();};}function respondWithResult(_0x763495,_0x1a2eda){_0x1a2eda=_0x1a2eda||0xc8;return function(_0x416855){if(_0x416855){return _0x763495[_0x1a7f('0x18')](_0x1a2eda)[_0x1a7f('0x19')](_0x416855);}};}function respondWithFilteredResult(_0x471679,_0x149ed1){return function(_0x2d1e4e){if(_0x2d1e4e){var _0x305d9f=_0x2d1e4e['count'],_0x2eace8=_0x149ed1['offset'],_0x36808b=_0x149ed1[_0x1a7f('0x1a')]+_0x149ed1[_0x1a7f('0x1b')],_0x30965e;if(_0x36808b>=_0x305d9f){_0x36808b=_0x305d9f;_0x30965e=0xc8;}else{_0x30965e=0xce;}_0x471679[_0x1a7f('0x18')](_0x30965e);return _0x471679['set'](_0x1a7f('0x1c'),_0x2eace8+'-'+_0x36808b+'/'+_0x305d9f)[_0x1a7f('0x19')](_0x2d1e4e);}return null;};}function patchUpdates(_0x3d72b5){return function(_0x275567){try{jsonpatch[_0x1a7f('0x1d')](_0x275567,_0x3d72b5,!![]);}catch(_0x146155){return BPromise['reject'](_0x146155);}return _0x275567[_0x1a7f('0x1e')]();};}function saveUpdates(_0x5c9ea9,_0x450a5d){return function(_0x308b24){if(_0x308b24){return _0x308b24[_0x1a7f('0x1f')](_0x5c9ea9)[_0x1a7f('0x20')](function(_0x1a3f93){return _0x1a3f93;});}return null;};}function removeEntity(_0x158072,_0x12bab1){return function(_0x319c2b){if(_0x319c2b){return _0x319c2b[_0x1a7f('0x21')]()[_0x1a7f('0x20')](function(){_0x158072['status'](0xcc)[_0x1a7f('0x17')]();});}};}function handleEntityNotFound(_0x18e7cf,_0x41067f){return function(_0xcb0ee4){if(!_0xcb0ee4){_0x18e7cf[_0x1a7f('0x16')](0x194);}return _0xcb0ee4;};}function handleError(_0x18de60,_0x34d09d){_0x34d09d=_0x34d09d||0x1f4;return function(_0x3456e1){logger['error'](_0x3456e1['stack']);if(_0x3456e1[_0x1a7f('0x22')]){delete _0x3456e1[_0x1a7f('0x22')];}_0x18de60[_0x1a7f('0x18')](_0x34d09d)['send'](_0x3456e1);};}exports[_0x1a7f('0x23')]=function(_0x2ab6de,_0x16326d){var _0x18302e={},_0x398dda={},_0x2b38eb={'count':0x0,'rows':[]};var _0x274d82=_['map'](db[_0x1a7f('0x24')][_0x1a7f('0x25')],function(_0xc27280){return{'name':_0xc27280['fieldName'],'type':_0xc27280['type'][_0x1a7f('0x26')]};});_0x398dda[_0x1a7f('0x27')]=_[_0x1a7f('0x28')](_0x274d82,_0x1a7f('0x22'));_0x398dda['query']=_[_0x1a7f('0x29')](_0x2ab6de[_0x1a7f('0x2a')]);_0x398dda[_0x1a7f('0x2b')]=_['intersection'](_0x398dda[_0x1a7f('0x27')],_0x398dda[_0x1a7f('0x2a')]);_0x18302e[_0x1a7f('0x2c')]=_[_0x1a7f('0x2d')](_0x398dda['model'],qs['fields'](_0x2ab6de['query'][_0x1a7f('0x2e')]));_0x18302e[_0x1a7f('0x2c')]=_0x18302e[_0x1a7f('0x2c')][_0x1a7f('0x2f')]?_0x18302e[_0x1a7f('0x2c')]:_0x398dda[_0x1a7f('0x27')];if(!_0x2ab6de[_0x1a7f('0x2a')][_0x1a7f('0x30')](_0x1a7f('0x31'))){_0x18302e[_0x1a7f('0x1b')]=qs[_0x1a7f('0x1b')](_0x2ab6de[_0x1a7f('0x2a')][_0x1a7f('0x1b')]);_0x18302e[_0x1a7f('0x1a')]=qs[_0x1a7f('0x1a')](_0x2ab6de[_0x1a7f('0x2a')][_0x1a7f('0x1a')]);}_0x18302e[_0x1a7f('0x32')]=qs[_0x1a7f('0x33')](_0x2ab6de[_0x1a7f('0x2a')][_0x1a7f('0x33')]);_0x18302e[_0x1a7f('0x34')]=qs[_0x1a7f('0x2b')](_[_0x1a7f('0x35')](_0x2ab6de[_0x1a7f('0x2a')],_0x398dda[_0x1a7f('0x2b')]),_0x274d82);if(_0x2ab6de[_0x1a7f('0x2a')][_0x1a7f('0x36')]){_0x18302e[_0x1a7f('0x34')]=_['merge'](_0x18302e[_0x1a7f('0x34')],{'$or':_[_0x1a7f('0x28')](_0x274d82,function(_0x2a56fa){if(_0x2a56fa['type']!==_0x1a7f('0x37')){var _0x2db2a3={};_0x2db2a3[_0x2a56fa[_0x1a7f('0x22')]]={'$like':'%'+_0x2ab6de[_0x1a7f('0x2a')][_0x1a7f('0x36')]+'%'};return _0x2db2a3;}})});}_0x18302e=_[_0x1a7f('0x38')]({},_0x18302e,_0x2ab6de[_0x1a7f('0x39')]);var _0x13fc91={'where':_0x18302e['where']};return db[_0x1a7f('0x24')][_0x1a7f('0x3a')](_0x13fc91)[_0x1a7f('0x20')](function(_0x321f8c){_0x2b38eb['count']=_0x321f8c;if(_0x2ab6de[_0x1a7f('0x2a')]['includeAll']){_0x18302e[_0x1a7f('0x3b')]=[{'all':!![]}];}return db[_0x1a7f('0x24')][_0x1a7f('0x3c')](_0x18302e);})['then'](function(_0x14fb91){_0x2b38eb[_0x1a7f('0x3d')]=_0x14fb91;return _0x2b38eb;})[_0x1a7f('0x20')](respondWithFilteredResult(_0x16326d,_0x18302e))[_0x1a7f('0x3e')](handleError(_0x16326d,null));};exports['show']=function(_0x3d3e00,_0x3c1de7){var _0x28afa1={'raw':!![],'where':{'id':_0x3d3e00[_0x1a7f('0x3f')]['id']}},_0x4accec={};_0x4accec[_0x1a7f('0x27')]=_[_0x1a7f('0x29')](db['SquareDetailsReport']['rawAttributes']);_0x4accec[_0x1a7f('0x2a')]=_[_0x1a7f('0x29')](_0x3d3e00[_0x1a7f('0x2a')]);_0x4accec[_0x1a7f('0x2b')]=_[_0x1a7f('0x2d')](_0x4accec[_0x1a7f('0x27')],_0x4accec[_0x1a7f('0x2a')]);_0x28afa1[_0x1a7f('0x2c')]=_[_0x1a7f('0x2d')](_0x4accec[_0x1a7f('0x27')],qs[_0x1a7f('0x2e')](_0x3d3e00[_0x1a7f('0x2a')][_0x1a7f('0x2e')]));_0x28afa1[_0x1a7f('0x2c')]=_0x28afa1[_0x1a7f('0x2c')]['length']?_0x28afa1[_0x1a7f('0x2c')]:_0x4accec[_0x1a7f('0x27')];if(_0x3d3e00[_0x1a7f('0x2a')][_0x1a7f('0x40')]){_0x28afa1[_0x1a7f('0x3b')]=[{'all':!![]}];}_0x28afa1=_['merge']({},_0x28afa1,_0x3d3e00[_0x1a7f('0x39')]);return db['SquareDetailsReport'][_0x1a7f('0x41')](_0x28afa1)['then'](handleEntityNotFound(_0x3c1de7,null))[_0x1a7f('0x20')](respondWithResult(_0x3c1de7,null))['catch'](handleError(_0x3c1de7,null));};exports['create']=function(_0x3bc2f5,_0x3e5528){return db[_0x1a7f('0x24')][_0x1a7f('0x42')](_0x3bc2f5[_0x1a7f('0x43')],{})['then'](respondWithResult(_0x3e5528,0xc9))[_0x1a7f('0x3e')](handleError(_0x3e5528,null));};exports[_0x1a7f('0x1f')]=function(_0x57826a,_0x2ffedf){if(_0x57826a[_0x1a7f('0x43')]['id']){delete _0x57826a[_0x1a7f('0x43')]['id'];}return db[_0x1a7f('0x24')][_0x1a7f('0x41')]({'where':{'id':_0x57826a[_0x1a7f('0x3f')]['id']}})[_0x1a7f('0x20')](handleEntityNotFound(_0x2ffedf,null))[_0x1a7f('0x20')](saveUpdates(_0x57826a[_0x1a7f('0x43')],null))['then'](respondWithResult(_0x2ffedf,null))[_0x1a7f('0x3e')](handleError(_0x2ffedf,null));};exports[_0x1a7f('0x21')]=function(_0x548334,_0x380c6b){return db[_0x1a7f('0x24')][_0x1a7f('0x41')]({'where':{'id':_0x548334[_0x1a7f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x380c6b,null))[_0x1a7f('0x20')](removeEntity(_0x380c6b,null))[_0x1a7f('0x3e')](handleError(_0x380c6b,null));};exports[_0x1a7f('0x44')]=function(_0x556d86,_0x47ba0e){return db[_0x1a7f('0x24')]['describe']()[_0x1a7f('0x20')](respondWithResult(_0x47ba0e,null))[_0x1a7f('0x3e')](handleError(_0x47ba0e,null));}; \ No newline at end of file +var _0x2591=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','SquareDetailsReport','findAll','rows','show','params','rawAttributes','include','find','create','body','catch','describe','html-pdf','eml-format','zip-dir'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x2591,0x111));var _0x1259=function(_0x434de7,_0x56f82a){_0x434de7=_0x434de7-0x0;var _0x41b295=_0x2591[_0x434de7];return _0x41b295;};'use strict';var pdf=require(_0x1259('0x0'));var emlformat=require(_0x1259('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1259('0x2'));var jsonpatch=require(_0x1259('0x3'));var rp=require(_0x1259('0x4'));var moment=require(_0x1259('0x5'));var BPromise=require(_0x1259('0x6'));var Mustache=require(_0x1259('0x7'));var util=require(_0x1259('0x8'));var path=require(_0x1259('0x9'));var sox=require(_0x1259('0xa'));var csv=require(_0x1259('0xb'));var ejs=require(_0x1259('0xc'));var fs=require('fs');var _=require(_0x1259('0xd'));var squel=require('squel');var crypto=require(_0x1259('0xe'));var jsforce=require(_0x1259('0xf'));var deskjs=require(_0x1259('0x10'));var toCsv=require(_0x1259('0xb'));var querystring=require('querystring');var Papa=require(_0x1259('0x11'));var Redis=require(_0x1259('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1259('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1259('0x14'));var utils=require(_0x1259('0x15'));var config=require(_0x1259('0x16'));var db=require(_0x1259('0x17'))['db'];function respondWithStatusCode(_0x8327ba,_0x410236){_0x410236=_0x410236||0xcc;return function(_0x703120){if(_0x703120){return _0x8327ba['sendStatus'](_0x410236);}return _0x8327ba[_0x1259('0x18')](_0x410236)[_0x1259('0x19')]();};}function respondWithResult(_0x4d0dc3,_0x3116d5){_0x3116d5=_0x3116d5||0xc8;return function(_0x54d1e7){if(_0x54d1e7){return _0x4d0dc3[_0x1259('0x18')](_0x3116d5)['json'](_0x54d1e7);}};}function respondWithFilteredResult(_0x1ac011,_0x4c1ada){return function(_0xbb7930){if(_0xbb7930){var _0x182684=_0xbb7930[_0x1259('0x1a')],_0x366cff=_0x4c1ada[_0x1259('0x1b')],_0x1f6be4=_0x4c1ada[_0x1259('0x1b')]+_0x4c1ada['limit'],_0x3ea625;if(_0x1f6be4>=_0x182684){_0x1f6be4=_0x182684;_0x3ea625=0xc8;}else{_0x3ea625=0xce;}_0x1ac011[_0x1259('0x18')](_0x3ea625);return _0x1ac011['set'](_0x1259('0x1c'),_0x366cff+'-'+_0x1f6be4+'/'+_0x182684)['json'](_0xbb7930);}return null;};}function patchUpdates(_0x29cc26){return function(_0x537d81){try{jsonpatch[_0x1259('0x1d')](_0x537d81,_0x29cc26,!![]);}catch(_0x484117){return BPromise['reject'](_0x484117);}return _0x537d81[_0x1259('0x1e')]();};}function saveUpdates(_0x1e874c,_0x227ee9){return function(_0x57864e){if(_0x57864e){return _0x57864e[_0x1259('0x1f')](_0x1e874c)[_0x1259('0x20')](function(_0x52cb24){return _0x52cb24;});}return null;};}function removeEntity(_0x4d8d8f,_0x54b832){return function(_0x333b80){if(_0x333b80){return _0x333b80[_0x1259('0x21')]()[_0x1259('0x20')](function(){_0x4d8d8f['status'](0xcc)[_0x1259('0x19')]();});}};}function handleEntityNotFound(_0x3d5345,_0x1c2798){return function(_0x1671bd){if(!_0x1671bd){_0x3d5345['sendStatus'](0x194);}return _0x1671bd;};}function handleError(_0x2f1d49,_0x4d9ebd){_0x4d9ebd=_0x4d9ebd||0x1f4;return function(_0x155d74){logger[_0x1259('0x22')](_0x155d74[_0x1259('0x23')]);if(_0x155d74[_0x1259('0x24')]){delete _0x155d74[_0x1259('0x24')];}_0x2f1d49[_0x1259('0x18')](_0x4d9ebd)['send'](_0x155d74);};}exports[_0x1259('0x25')]=function(_0x14d986,_0x5d4f9f){var _0x572811={},_0x174626={},_0x1018b2={'count':0x0,'rows':[]};var _0x133860=_[_0x1259('0x26')](db['SquareDetailsReport']['rawAttributes'],function(_0x338b94){return{'name':_0x338b94['fieldName'],'type':_0x338b94[_0x1259('0x27')]['key']};});_0x174626[_0x1259('0x28')]=_[_0x1259('0x26')](_0x133860,_0x1259('0x24'));_0x174626[_0x1259('0x29')]=_[_0x1259('0x2a')](_0x14d986[_0x1259('0x29')]);_0x174626[_0x1259('0x2b')]=_[_0x1259('0x2c')](_0x174626[_0x1259('0x28')],_0x174626[_0x1259('0x29')]);_0x572811[_0x1259('0x2d')]=_['intersection'](_0x174626['model'],qs['fields'](_0x14d986[_0x1259('0x29')][_0x1259('0x2e')]));_0x572811['attributes']=_0x572811[_0x1259('0x2d')][_0x1259('0x2f')]?_0x572811[_0x1259('0x2d')]:_0x174626[_0x1259('0x28')];if(!_0x14d986[_0x1259('0x29')][_0x1259('0x30')](_0x1259('0x31'))){_0x572811['limit']=qs[_0x1259('0x32')](_0x14d986[_0x1259('0x29')]['limit']);_0x572811[_0x1259('0x1b')]=qs[_0x1259('0x1b')](_0x14d986[_0x1259('0x29')]['offset']);}_0x572811[_0x1259('0x33')]=qs[_0x1259('0x34')](_0x14d986[_0x1259('0x29')][_0x1259('0x34')]);_0x572811[_0x1259('0x35')]=qs[_0x1259('0x2b')](_['pick'](_0x14d986[_0x1259('0x29')],_0x174626[_0x1259('0x2b')]),_0x133860);if(_0x14d986[_0x1259('0x29')][_0x1259('0x36')]){_0x572811[_0x1259('0x35')]=_['merge'](_0x572811[_0x1259('0x35')],{'$or':_[_0x1259('0x26')](_0x133860,function(_0x55a352){if(_0x55a352[_0x1259('0x27')]!=='VIRTUAL'){var _0x45539b={};_0x45539b[_0x55a352[_0x1259('0x24')]]={'$like':'%'+_0x14d986['query'][_0x1259('0x36')]+'%'};return _0x45539b;}})});}_0x572811=_[_0x1259('0x37')]({},_0x572811,_0x14d986[_0x1259('0x38')]);var _0x5c81f7={'where':_0x572811[_0x1259('0x35')]};return db[_0x1259('0x39')]['count'](_0x5c81f7)[_0x1259('0x20')](function(_0x45c0bc){_0x1018b2['count']=_0x45c0bc;if(_0x14d986[_0x1259('0x29')]['includeAll']){_0x572811['include']=[{'all':!![]}];}return db[_0x1259('0x39')][_0x1259('0x3a')](_0x572811);})['then'](function(_0x5b2abb){_0x1018b2[_0x1259('0x3b')]=_0x5b2abb;return _0x1018b2;})[_0x1259('0x20')](respondWithFilteredResult(_0x5d4f9f,_0x572811))['catch'](handleError(_0x5d4f9f,null));};exports[_0x1259('0x3c')]=function(_0x273f56,_0x3c478d){var _0x4af76b={'raw':!![],'where':{'id':_0x273f56[_0x1259('0x3d')]['id']}},_0x12ce66={};_0x12ce66[_0x1259('0x28')]=_['keys'](db['SquareDetailsReport'][_0x1259('0x3e')]);_0x12ce66[_0x1259('0x29')]=_[_0x1259('0x2a')](_0x273f56[_0x1259('0x29')]);_0x12ce66[_0x1259('0x2b')]=_[_0x1259('0x2c')](_0x12ce66[_0x1259('0x28')],_0x12ce66['query']);_0x4af76b[_0x1259('0x2d')]=_[_0x1259('0x2c')](_0x12ce66['model'],qs[_0x1259('0x2e')](_0x273f56[_0x1259('0x29')][_0x1259('0x2e')]));_0x4af76b[_0x1259('0x2d')]=_0x4af76b['attributes'][_0x1259('0x2f')]?_0x4af76b[_0x1259('0x2d')]:_0x12ce66['model'];if(_0x273f56[_0x1259('0x29')]['includeAll']){_0x4af76b[_0x1259('0x3f')]=[{'all':!![]}];}_0x4af76b=_[_0x1259('0x37')]({},_0x4af76b,_0x273f56[_0x1259('0x38')]);return db['SquareDetailsReport'][_0x1259('0x40')](_0x4af76b)[_0x1259('0x20')](handleEntityNotFound(_0x3c478d,null))['then'](respondWithResult(_0x3c478d,null))['catch'](handleError(_0x3c478d,null));};exports[_0x1259('0x41')]=function(_0x35a530,_0x3e14a6){return db[_0x1259('0x39')][_0x1259('0x41')](_0x35a530[_0x1259('0x42')],{})[_0x1259('0x20')](respondWithResult(_0x3e14a6,0xc9))[_0x1259('0x43')](handleError(_0x3e14a6,null));};exports[_0x1259('0x1f')]=function(_0x1d78bb,_0x4a11f4){if(_0x1d78bb[_0x1259('0x42')]['id']){delete _0x1d78bb[_0x1259('0x42')]['id'];}return db[_0x1259('0x39')][_0x1259('0x40')]({'where':{'id':_0x1d78bb[_0x1259('0x3d')]['id']}})[_0x1259('0x20')](handleEntityNotFound(_0x4a11f4,null))[_0x1259('0x20')](saveUpdates(_0x1d78bb[_0x1259('0x42')],null))[_0x1259('0x20')](respondWithResult(_0x4a11f4,null))[_0x1259('0x43')](handleError(_0x4a11f4,null));};exports[_0x1259('0x21')]=function(_0x334aaa,_0x47ac47){return db[_0x1259('0x39')][_0x1259('0x40')]({'where':{'id':_0x334aaa['params']['id']}})[_0x1259('0x20')](handleEntityNotFound(_0x47ac47,null))[_0x1259('0x20')](removeEntity(_0x47ac47,null))[_0x1259('0x43')](handleError(_0x47ac47,null));};exports[_0x1259('0x44')]=function(_0x383c9d,_0x478ae0){return db[_0x1259('0x39')]['describe']()[_0x1259('0x20')](respondWithResult(_0x478ae0,null))[_0x1259('0x43')](handleError(_0x478ae0,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index fca8bd8..f89f80c 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 _0x7f1a=['report_square_details','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define'];(function(_0x56ce49,_0x4a7cc2){var _0x3c9309=function(_0x10ec54){while(--_0x10ec54){_0x56ce49['push'](_0x56ce49['shift']());}};_0x3c9309(++_0x4a7cc2);}(_0x7f1a,0xa9));var _0xa7f1=function(_0x2f9218,_0x4547a4){_0x2f9218=_0x2f9218-0x0;var _0xadd0a9=_0x7f1a[_0x2f9218];return _0xadd0a9;};'use strict';var _=require(_0xa7f1('0x0'));var util=require(_0xa7f1('0x1'));var logger=require(_0xa7f1('0x2'))('api');var moment=require(_0xa7f1('0x3'));var BPromise=require(_0xa7f1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa7f1('0x5'));var rimraf=require(_0xa7f1('0x6'));var config=require(_0xa7f1('0x7'));var attributes=require(_0xa7f1('0x8'));module[_0xa7f1('0x9')]=function(_0x33b0d5,_0x533693){return _0x33b0d5[_0xa7f1('0xa')]('SquareDetailsReport',attributes,{'tableName':_0xa7f1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe61e=['../../config/logger','bluebird','request-promise','path','rimraf','./squareReportDetail.attributes','define','util'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xe61e,0x147));var _0xee61=function(_0x11eb1f,_0x826f0b){_0x11eb1f=_0x11eb1f-0x0;var _0x2121e9=_0xe61e[_0x11eb1f];return _0x2121e9;};'use strict';var _=require('lodash');var util=require(_0xee61('0x0'));var logger=require(_0xee61('0x1'))('api');var moment=require('moment');var BPromise=require(_0xee61('0x2'));var rp=require(_0xee61('0x3'));var fs=require('fs');var path=require(_0xee61('0x4'));var rimraf=require(_0xee61('0x5'));var config=require('../../config/environment');var attributes=require(_0xee61('0x6'));module['exports']=function(_0x566b99,_0xc5442b){return _0x566b99[_0xee61('0x7')]('SquareDetailsReport',attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 42fb123..93f37f9 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 _0x97bf=['CreateSquareDetailsReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','then','info','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','create','options','raw'];(function(_0x70a795,_0x16d8fe){var _0x4b5cf5=function(_0xfecb2a){while(--_0xfecb2a){_0x70a795['push'](_0x70a795['shift']());}};_0x4b5cf5(++_0x16d8fe);}(_0x97bf,0x6e));var _0xf97b=function(_0x1ecf3b,_0x775019){_0x1ecf3b=_0x1ecf3b-0x0;var _0x52212b=_0x97bf[_0x1ecf3b];return _0x52212b;};'use strict';var _=require(_0xf97b('0x0'));var util=require(_0xf97b('0x1'));var moment=require(_0xf97b('0x2'));var BPromise=require(_0xf97b('0x3'));var rs=require(_0xf97b('0x4'));var fs=require('fs');var Redis=require(_0xf97b('0x5'));var db=require(_0xf97b('0x6'))['db'];var utils=require(_0xf97b('0x7'));var logger=require(_0xf97b('0x8'))(_0xf97b('0x9'));var config=require('../../config/environment');var jayson=require(_0xf97b('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5b0c09,_0x58f9c3,_0x49830e){return new BPromise(function(_0x524838,_0x3b845e){return client['request'](_0x5b0c09,_0x49830e)[_0xf97b('0xb')](function(_0x4f12e8){logger[_0xf97b('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x58f9c3,'request\x20sent');logger[_0xf97b('0xd')](_0xf97b('0xe'),_0x58f9c3,_0xf97b('0xf'),JSON['stringify'](_0x4f12e8));if(_0x4f12e8[_0xf97b('0x10')]){if(_0x4f12e8[_0xf97b('0x10')][_0xf97b('0x11')]===0x1f4){logger[_0xf97b('0x10')](_0xf97b('0x12'),_0x58f9c3,_0x4f12e8[_0xf97b('0x10')]['message']);return _0x3b845e(_0x4f12e8[_0xf97b('0x10')]['message']);}logger[_0xf97b('0x10')](_0xf97b('0x12'),_0x58f9c3,_0x4f12e8[_0xf97b('0x10')][_0xf97b('0x13')]);return _0x524838(_0x4f12e8['error'][_0xf97b('0x13')]);}else{logger[_0xf97b('0xc')](_0xf97b('0x12'),_0x58f9c3,_0xf97b('0xf'));_0x524838(_0x4f12e8[_0xf97b('0x14')][_0xf97b('0x13')]);}})[_0xf97b('0x15')](function(_0xd70b92){logger[_0xf97b('0x10')](_0xf97b('0x12'),_0x58f9c3,_0xd70b92);_0x3b845e(_0xd70b92);});});}exports['CreateSquareDetailsReport']=function(_0x49bd35){var _0x427a7b=this;return new Promise(function(_0x1718b2,_0x349e3d){return db['SquareDetailsReport'][_0xf97b('0x16')](_0x49bd35['body'],{'raw':_0x49bd35['options']?_0x49bd35[_0xf97b('0x17')][_0xf97b('0x18')]===undefined?!![]:![]:!![]})[_0xf97b('0xb')](function(_0x150f2c){logger[_0xf97b('0xc')](_0xf97b('0x19'),_0x49bd35);logger[_0xf97b('0xd')](_0xf97b('0x19'),_0x49bd35,JSON[_0xf97b('0x1a')](_0x150f2c));_0x1718b2(_0x150f2c);})[_0xf97b('0x15')](function(_0x374e38){logger[_0xf97b('0x10')](_0xf97b('0x19'),_0x374e38['message'],_0x49bd35);_0x349e3d(_0x427a7b[_0xf97b('0x10')](0x1f4,_0x374e38[_0xf97b('0x13')]));});});}; \ No newline at end of file +var _0xe683=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSquareDetailsReport','SquareDetailsReport','options','raw','debug','moment'];(function(_0x5765bb,_0x45998c){var _0x452a60=function(_0x23d107){while(--_0x23d107){_0x5765bb['push'](_0x5765bb['shift']());}};_0x452a60(++_0x45998c);}(_0xe683,0x197));var _0x3e68=function(_0x5cd28c,_0x531cd9){_0x5cd28c=_0x5cd28c-0x0;var _0x4fa44b=_0xe683[_0x5cd28c];return _0x4fa44b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3e68('0x0'));var BPromise=require(_0x3e68('0x1'));var rs=require(_0x3e68('0x2'));var fs=require('fs');var Redis=require(_0x3e68('0x3'));var db=require(_0x3e68('0x4'))['db'];var utils=require(_0x3e68('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3e68('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3e68('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x385bba,_0x5068c8,_0x39139f){return new BPromise(function(_0x429cbc,_0x5d6800){return client[_0x3e68('0x8')](_0x385bba,_0x39139f)[_0x3e68('0x9')](function(_0x205130){logger[_0x3e68('0xa')](_0x3e68('0xb'),_0x5068c8,'request\x20sent');logger['debug'](_0x3e68('0xc'),_0x5068c8,_0x3e68('0xd'),JSON[_0x3e68('0xe')](_0x205130));if(_0x205130[_0x3e68('0xf')]){if(_0x205130[_0x3e68('0xf')][_0x3e68('0x10')]===0x1f4){logger[_0x3e68('0xf')](_0x3e68('0xb'),_0x5068c8,_0x205130[_0x3e68('0xf')]['message']);return _0x5d6800(_0x205130['error'][_0x3e68('0x11')]);}logger['error'](_0x3e68('0xb'),_0x5068c8,_0x205130[_0x3e68('0xf')]['message']);return _0x429cbc(_0x205130['error'][_0x3e68('0x11')]);}else{logger['info'](_0x3e68('0xb'),_0x5068c8,'request\x20sent');_0x429cbc(_0x205130['result'][_0x3e68('0x11')]);}})[_0x3e68('0x12')](function(_0x84aa6b){logger[_0x3e68('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x5068c8,_0x84aa6b);_0x5d6800(_0x84aa6b);});});}exports[_0x3e68('0x13')]=function(_0x37ba8d){var _0x98e907=this;return new Promise(function(_0x4e5d1d,_0x1da8f0){return db[_0x3e68('0x14')]['create'](_0x37ba8d['body'],{'raw':_0x37ba8d[_0x3e68('0x15')]?_0x37ba8d['options'][_0x3e68('0x16')]===undefined?!![]:![]:!![]})[_0x3e68('0x9')](function(_0x22af23){logger['info'](_0x3e68('0x13'),_0x37ba8d);logger[_0x3e68('0x17')](_0x3e68('0x13'),_0x37ba8d,JSON[_0x3e68('0xe')](_0x22af23));_0x4e5d1d(_0x22af23);})[_0x3e68('0x12')](function(_0x13251b){logger[_0x3e68('0xf')](_0x3e68('0x13'),_0x13251b[_0x3e68('0x11')],_0x37ba8d);_0x1da8f0(_0x98e907[_0x3e68('0xf')](0x1f4,_0x13251b[_0x3e68('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 27d6e69..7617ae5 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 _0x636c=['get','isAuthenticated','index','/process/:pid/kill','exports','Router','../../components/auth/service'];(function(_0x1b5558,_0x5e0c24){var _0x452a21=function(_0x97f387){while(--_0x97f387){_0x1b5558['push'](_0x1b5558['shift']());}};_0x452a21(++_0x5e0c24);}(_0x636c,0x1cc));var _0xc636=function(_0x3218a6,_0x235430){_0x3218a6=_0x3218a6-0x0;var _0x295938=_0x636c[_0x3218a6];return _0x295938;};'use strict';var express=require('express');var router=express[_0xc636('0x0')]();var auth=require(_0xc636('0x1'));var controller=require('./system.controller');router[_0xc636('0x2')]('/',auth[_0xc636('0x3')](),controller[_0xc636('0x4')]);router['get'](_0xc636('0x5'),auth['isAuthenticated'](),controller['killProcess']);module[_0xc636('0x6')]=router; \ No newline at end of file +var _0xd674=['isAuthenticated','index','/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','./system.controller','get'];(function(_0x5cfe47,_0x3c4fa4){var _0x4754ad=function(_0x36c7f9){while(--_0x36c7f9){_0x5cfe47['push'](_0x5cfe47['shift']());}};_0x4754ad(++_0x3c4fa4);}(_0xd674,0xb9));var _0x4d67=function(_0x74fe0c,_0x347733){_0x74fe0c=_0x74fe0c-0x0;var _0x3914be=_0xd674[_0x74fe0c];return _0x3914be;};'use strict';var express=require(_0x4d67('0x0'));var router=express[_0x4d67('0x1')]();var auth=require(_0x4d67('0x2'));var controller=require(_0x4d67('0x3'));router[_0x4d67('0x4')]('/',auth[_0x4d67('0x5')](),controller[_0x4d67('0x6')]);router[_0x4d67('0x4')](_0x4d67('0x7'),auth[_0x4d67('0x5')](),controller[_0x4d67('0x8')]);module[_0x4d67('0x9')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 22f5805..61039c3 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 _0x484b=['format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','exec','../../config/logger','api','bluebird','lodash','error','inspect','status','send','index','getAllData','then','json','killProcess','components/import/cm'];(function(_0x28edda,_0xbd447a){var _0x21f4a4=function(_0x5ae05e){while(--_0x5ae05e){_0x28edda['push'](_0x28edda['shift']());}};_0x21f4a4(++_0xbd447a);}(_0x484b,0x104));var _0xb484=function(_0x34d60f,_0x333bab){_0x34d60f=_0x34d60f-0x0;var _0x3475c4=_0x484b[_0x34d60f];return _0x3475c4;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0xb484('0x0')];var logger=require(_0xb484('0x1'))(_0xb484('0x2'));var util=require('util');var BPromise=require(_0xb484('0x3'));var _=require(_0xb484('0x4'));function handleError(_0x5a76ff,_0x52b02,_0x410241){_0x52b02=_0x52b02||0x1f4;return function(_0xc77cb3){logger[_0xb484('0x5')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x410241,_0x52b02,util[_0xb484('0x6')](_0xc77cb3,{'showHidden':![],'depth':null}));delete _0xc77cb3['name'];_0x5a76ff[_0xb484('0x7')](_0x52b02)[_0xb484('0x8')](_0xc77cb3);};}exports[_0xb484('0x9')]=function(_0x2282d9,_0x38fdcf){return info[_0xb484('0xa')]()[_0xb484('0xb')](function(_0x313c9f){return _0x38fdcf[_0xb484('0x7')](0xc8)[_0xb484('0xc')](_0x313c9f);})['catch'](function(_0x220741){return _0x38fdcf['status'](0x1f4)[_0xb484('0xc')](_0x220741);});};exports[_0xb484('0xd')]=function(_0x45a600,_0xa13d4c){var _0x302b31=[_0xb484('0xe')];return new BPromise(function(_0x57e226,_0x2d92e2){return exec(util[_0xb484('0xf')](_0xb484('0x10'),_0x45a600[_0xb484('0x11')][_0xb484('0x12')]),function(_0x10a8b4,_0x10f06e,_0x37bea8){if(_0x10a8b4){return _0x2d92e2(_0x10a8b4);}return _0x57e226(_0x10f06e);});})[_0xb484('0xb')](function(_0x47aac5){var _0x3e0267=![];var _0x5054d4=_0x47aac5[_0xb484('0x13')](/\n/);for(var _0x496fc1=0x0,_0x364405=_0x302b31['length'];_0x496fc1<_0x364405,_0x3e0267===![];_0x496fc1+=0x1){if(_0x47aac5['indexOf'](_0x302b31[_0x496fc1])>=0x0){_0x3e0267=!![];}}if(!_0x3e0267){throw new Error(util[_0xb484('0xf')](_0xb484('0x14'),_0x45a600[_0xb484('0x11')]['pid']));}process[_0xb484('0x15')](_0x45a600[_0xb484('0x11')]['pid'],_0xb484('0x16'));return _0xa13d4c[_0xb484('0x7')](0xc8)[_0xb484('0xc')]({'message':util[_0xb484('0xf')](_0xb484('0x17'),_0x45a600['params'][_0xb484('0x12')])});})[_0xb484('0x18')](handleError(_0xa13d4c,null,_0xb484('0xd')));}; \ No newline at end of file +var _0x4362=['format','Process\x20with\x20pid\x20%s\x20killed\x20correctly','pid','catch','killProcess','systeminformation','child_process','exec','../../config/logger','api','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','getAllData','json','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','then','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT'];(function(_0x623e7,_0x1bef7d){var _0x121131=function(_0x59b734){while(--_0x59b734){_0x623e7['push'](_0x623e7['shift']());}};_0x121131(++_0x1bef7d);}(_0x4362,0xdd));var _0x2436=function(_0x144953,_0x2fe553){_0x144953=_0x144953-0x0;var _0x38d94b=_0x4362[_0x144953];return _0x38d94b;};'use strict';var info=require(_0x2436('0x0'));var exec=require(_0x2436('0x1'))[_0x2436('0x2')];var logger=require(_0x2436('0x3'))(_0x2436('0x4'));var util=require('util');var BPromise=require('bluebird');var _=require(_0x2436('0x5'));function handleError(_0x30784d,_0x1103f4,_0x7aedec){_0x1103f4=_0x1103f4||0x1f4;return function(_0x56591d){logger['error'](_0x2436('0x6'),_0x7aedec,_0x1103f4,util[_0x2436('0x7')](_0x56591d,{'showHidden':![],'depth':null}));delete _0x56591d[_0x2436('0x8')];_0x30784d[_0x2436('0x9')](_0x1103f4)['send'](_0x56591d);};}exports[_0x2436('0xa')]=function(_0x40c0fb,_0x50ee51){return info[_0x2436('0xb')]()['then'](function(_0x75ea72){return _0x50ee51[_0x2436('0x9')](0xc8)['json'](_0x75ea72);})['catch'](function(_0x1652ff){return _0x50ee51[_0x2436('0x9')](0x1f4)[_0x2436('0xc')](_0x1652ff);});};exports['killProcess']=function(_0x53f0d0,_0x2c3921){var _0xc10f28=[_0x2436('0xd')];return new BPromise(function(_0x268221,_0x71cada){return exec(util['format'](_0x2436('0xe'),_0x53f0d0['params']['pid']),function(_0x5c7296,_0x75bbdb,_0x35d36c){if(_0x5c7296){return _0x71cada(_0x5c7296);}return _0x268221(_0x75bbdb);});})[_0x2436('0xf')](function(_0x5115d5){var _0x25a5d3=![];var _0x2aae63=_0x5115d5[_0x2436('0x10')](/\n/);for(var _0x1362cb=0x0,_0x32d607=_0xc10f28['length'];_0x1362cb<_0x32d607,_0x25a5d3===![];_0x1362cb+=0x1){if(_0x5115d5[_0x2436('0x11')](_0xc10f28[_0x1362cb])>=0x0){_0x25a5d3=!![];}}if(!_0x25a5d3){throw new Error(util['format'](_0x2436('0x12'),_0x53f0d0[_0x2436('0x13')]['pid']));}process[_0x2436('0x14')](_0x53f0d0[_0x2436('0x13')]['pid'],_0x2436('0x15'));return _0x2c3921[_0x2436('0x9')](0xc8)[_0x2436('0xc')]({'message':util[_0x2436('0x16')](_0x2436('0x17'),_0x53f0d0[_0x2436('0x13')][_0x2436('0x18')])});})[_0x2436('0x19')](handleError(_0x2c3921,null,_0x2436('0x1a')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index a178d07..49715cf 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 _0xa8a8=['index','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated'];(function(_0x164c6e,_0x25abdb){var _0xe3731a=function(_0x53a71e){while(--_0x53a71e){_0x164c6e['push'](_0x164c6e['shift']());}};_0xe3731a(++_0x25abdb);}(_0xa8a8,0xec));var _0x8a8a=function(_0x600cc1,_0x14ce00){_0x600cc1=_0x600cc1-0x0;var _0x222c06=_0xa8a8[_0x600cc1];return _0x222c06;};'use strict';var multer=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var path=require(_0x8a8a('0x2'));var timeout=require(_0x8a8a('0x3'));var express=require('express');var router=express[_0x8a8a('0x4')]();var auth=require(_0x8a8a('0x5'));var interaction=require(_0x8a8a('0x6'));var config=require(_0x8a8a('0x7'));var controller=require(_0x8a8a('0x8'));router[_0x8a8a('0x9')]('/',auth[_0x8a8a('0xa')](),controller[_0x8a8a('0xb')]);router[_0x8a8a('0x9')](_0x8a8a('0xc'),auth[_0x8a8a('0xa')](),controller[_0x8a8a('0xd')]);router[_0x8a8a('0xe')]('/',auth[_0x8a8a('0xa')](),controller[_0x8a8a('0xf')]);router['put']('/:id',auth[_0x8a8a('0xa')](),controller['update']);router[_0x8a8a('0x10')](_0x8a8a('0xc'),auth['isAuthenticated'](),controller[_0x8a8a('0x11')]);module[_0x8a8a('0x12')]=router; \ No newline at end of file +var _0x4bc3=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','post','create','put','destroy','multer','util'];(function(_0x1cc805,_0x19e913){var _0x3e5a41=function(_0x480760){while(--_0x480760){_0x1cc805['push'](_0x1cc805['shift']());}};_0x3e5a41(++_0x19e913);}(_0x4bc3,0x16e));var _0x34bc=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x4bc3[_0x381589];return _0x2a075d;};'use strict';var multer=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var path=require('path');var timeout=require(_0x34bc('0x2'));var express=require(_0x34bc('0x3'));var router=express['Router']();var auth=require(_0x34bc('0x4'));var interaction=require(_0x34bc('0x5'));var config=require(_0x34bc('0x6'));var controller=require(_0x34bc('0x7'));router[_0x34bc('0x8')]('/',auth[_0x34bc('0x9')](),controller[_0x34bc('0xa')]);router['get'](_0x34bc('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x34bc('0xc')]('/',auth[_0x34bc('0x9')](),controller[_0x34bc('0xd')]);router[_0x34bc('0xe')](_0x34bc('0xb'),auth[_0x34bc('0x9')](),controller['update']);router['delete'](_0x34bc('0xb'),auth[_0x34bc('0x9')](),controller[_0x34bc('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index f232bc0..2ecf2ca 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 _0x9ffd=['STRING','#0091EA','sequelize','exports'];(function(_0x18d015,_0x5143cf){var _0x169044=function(_0x48d28f){while(--_0x48d28f){_0x18d015['push'](_0x18d015['shift']());}};_0x169044(++_0x5143cf);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x4685c1,_0x6697f6){_0x4685c1=_0x4685c1-0x0;var _0x124a41=_0x9ffd[_0x4685c1];return _0x124a41;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'name':{'type':Sequelize[_0xd9ff('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xd9ff('0x2')],'defaultValue':_0xd9ff('0x3')},'description':{'type':Sequelize[_0xd9ff('0x2')]}}; \ No newline at end of file +var _0xbaf0=['name','#0091EA','exports','STRING'];(function(_0x54a73a,_0x5ee77e){var _0x3cf1b8=function(_0xa098fd){while(--_0xa098fd){_0x54a73a['push'](_0x54a73a['shift']());}};_0x3cf1b8(++_0x5ee77e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'unique':_0x0baf('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':_0x0baf('0x3')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index fbe0ebe..a0aad21 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 _0x46cf=['include','findAll','rows','params','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','json','save','update','destroy','then','get','Tags','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll'];(function(_0x340380,_0x4bd2a8){var _0x49ce1c=function(_0x4cb9e2){while(--_0x4cb9e2){_0x340380['push'](_0x340380['shift']());}};_0x49ce1c(++_0x4bd2a8);}(_0x46cf,0x157));var _0xf46c=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x46cf[_0x35885a];return _0xe86249;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf46c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf46c('0x1'));var rp=require(_0xf46c('0x2'));var moment=require(_0xf46c('0x3'));var BPromise=require(_0xf46c('0x4'));var Mustache=require(_0xf46c('0x5'));var util=require(_0xf46c('0x6'));var path=require('path');var sox=require(_0xf46c('0x7'));var csv=require('to-csv');var ejs=require(_0xf46c('0x8'));var fs=require('fs');var _=require(_0xf46c('0x9'));var squel=require(_0xf46c('0xa'));var crypto=require(_0xf46c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf46c('0xc'));var toCsv=require(_0xf46c('0xd'));var querystring=require(_0xf46c('0xe'));var Papa=require(_0xf46c('0xf'));var Redis=require(_0xf46c('0x10'));var authService=require(_0xf46c('0x11'));var qs=require(_0xf46c('0x12'));var as=require(_0xf46c('0x13'));var hardwareService=require(_0xf46c('0x14'));var logger=require(_0xf46c('0x15'))('api');var utils=require(_0xf46c('0x16'));var config=require(_0xf46c('0x17'));var db=require(_0xf46c('0x18'))['db'];function respondWithStatusCode(_0x434948,_0x49999a){_0x49999a=_0x49999a||0xcc;return function(_0x216732){if(_0x216732){return _0x434948[_0xf46c('0x19')](_0x49999a);}return _0x434948[_0xf46c('0x1a')](_0x49999a)[_0xf46c('0x1b')]();};}function respondWithResult(_0x3245da,_0x2ddbfb){_0x2ddbfb=_0x2ddbfb||0xc8;return function(_0x10f1cb){if(_0x10f1cb){return _0x3245da[_0xf46c('0x1a')](_0x2ddbfb)['json'](_0x10f1cb);}};}function respondWithFilteredResult(_0x4a1126,_0x35d763){return function(_0x471fcd){if(_0x471fcd){var _0x3ac855=_0x471fcd[_0xf46c('0x1c')],_0x298ccd=_0x35d763['offset'],_0x1c7e1d=_0x35d763[_0xf46c('0x1d')]+_0x35d763[_0xf46c('0x1e')],_0x1a8053;if(_0x1c7e1d>=_0x3ac855){_0x1c7e1d=_0x3ac855;_0x1a8053=0xc8;}else{_0x1a8053=0xce;}_0x4a1126[_0xf46c('0x1a')](_0x1a8053);return _0x4a1126['set']('Content-Range',_0x298ccd+'-'+_0x1c7e1d+'/'+_0x3ac855)[_0xf46c('0x1f')](_0x471fcd);}return null;};}function patchUpdates(_0x19f409){return function(_0x5d7ab0){try{jsonpatch['apply'](_0x5d7ab0,_0x19f409,!![]);}catch(_0x13383c){return BPromise['reject'](_0x13383c);}return _0x5d7ab0[_0xf46c('0x20')]();};}function saveUpdates(_0x4be18b,_0x34e9ba){return function(_0x389ef0){if(_0x389ef0){return _0x389ef0[_0xf46c('0x21')](_0x4be18b)['then'](function(_0x573275){return _0x573275;});}return null;};}function removeEntity(_0x4bf0cb,_0x4087a0){return function(_0x5de1d6){if(_0x5de1d6){return _0x5de1d6[_0xf46c('0x22')]()[_0xf46c('0x23')](function(){var _0xb40740=_0x5de1d6[_0xf46c('0x24')]({'plain':!![]});var _0x1be56b=_0xf46c('0x25');return db['UserProfileResource'][_0xf46c('0x22')]({'where':{'type':_0x1be56b,'resourceId':_0xb40740['id']}})[_0xf46c('0x23')](function(){return _0x5de1d6;});})[_0xf46c('0x23')](function(){_0x4bf0cb['status'](0xcc)[_0xf46c('0x1b')]();});}};}function handleEntityNotFound(_0x2f9ed8,_0x6de86c){return function(_0x4f96fc){if(!_0x4f96fc){_0x2f9ed8[_0xf46c('0x19')](0x194);}return _0x4f96fc;};}function handleError(_0x536a3b,_0x273640){_0x273640=_0x273640||0x1f4;return function(_0x40339){logger[_0xf46c('0x26')](_0x40339[_0xf46c('0x27')]);if(_0x40339[_0xf46c('0x28')]){delete _0x40339[_0xf46c('0x28')];}_0x536a3b[_0xf46c('0x1a')](_0x273640)[_0xf46c('0x29')](_0x40339);};}exports[_0xf46c('0x2a')]=function(_0x46541b,_0x17bec5){var _0x485f35={},_0x385dfb={},_0x2eab63={'count':0x0,'rows':[]};var _0x560aee=_[_0xf46c('0x2b')](db[_0xf46c('0x2c')][_0xf46c('0x2d')],function(_0x3943a4){return{'name':_0x3943a4[_0xf46c('0x2e')],'type':_0x3943a4['type'][_0xf46c('0x2f')]};});_0x385dfb[_0xf46c('0x30')]=_[_0xf46c('0x2b')](_0x560aee,'name');_0x385dfb[_0xf46c('0x31')]=_[_0xf46c('0x32')](_0x46541b[_0xf46c('0x31')]);_0x385dfb[_0xf46c('0x33')]=_['intersection'](_0x385dfb[_0xf46c('0x30')],_0x385dfb[_0xf46c('0x31')]);_0x485f35['attributes']=_[_0xf46c('0x34')](_0x385dfb[_0xf46c('0x30')],qs[_0xf46c('0x35')](_0x46541b[_0xf46c('0x31')][_0xf46c('0x35')]));_0x485f35['attributes']=_0x485f35[_0xf46c('0x36')][_0xf46c('0x37')]?_0x485f35['attributes']:_0x385dfb[_0xf46c('0x30')];if(!_0x46541b[_0xf46c('0x31')][_0xf46c('0x38')](_0xf46c('0x39'))){_0x485f35['limit']=qs[_0xf46c('0x1e')](_0x46541b[_0xf46c('0x31')][_0xf46c('0x1e')]);_0x485f35['offset']=qs['offset'](_0x46541b[_0xf46c('0x31')][_0xf46c('0x1d')]);}_0x485f35[_0xf46c('0x3a')]=qs[_0xf46c('0x3b')](_0x46541b[_0xf46c('0x31')][_0xf46c('0x3b')]);_0x485f35[_0xf46c('0x3c')]=qs[_0xf46c('0x33')](_[_0xf46c('0x3d')](_0x46541b['query'],_0x385dfb[_0xf46c('0x33')]),_0x560aee);if(_0x46541b[_0xf46c('0x31')][_0xf46c('0x3e')]){_0x485f35[_0xf46c('0x3c')]=_[_0xf46c('0x3f')](_0x485f35['where'],{'$or':_[_0xf46c('0x2b')](_0x560aee,function(_0x3545a0){if(_0x3545a0[_0xf46c('0x40')]!==_0xf46c('0x41')){var _0x597cb7={};_0x597cb7[_0x3545a0[_0xf46c('0x28')]]={'$like':'%'+_0x46541b[_0xf46c('0x31')][_0xf46c('0x3e')]+'%'};return _0x597cb7;}})});}_0x485f35=_['merge']({},_0x485f35,_0x46541b['options']);var _0x53ae80={'where':_0x485f35[_0xf46c('0x3c')]};return db[_0xf46c('0x2c')][_0xf46c('0x1c')](_0x53ae80)[_0xf46c('0x23')](function(_0x241139){_0x2eab63['count']=_0x241139;if(_0x46541b[_0xf46c('0x31')][_0xf46c('0x42')]){_0x485f35[_0xf46c('0x43')]=[{'all':!![]}];}return db[_0xf46c('0x2c')][_0xf46c('0x44')](_0x485f35);})[_0xf46c('0x23')](function(_0x1fc303){_0x2eab63[_0xf46c('0x45')]=_0x1fc303;return _0x2eab63;})[_0xf46c('0x23')](respondWithFilteredResult(_0x17bec5,_0x485f35))['catch'](handleError(_0x17bec5,null));};exports['show']=function(_0x5b2a6e,_0x4ef846){var _0x2e2bd2={'raw':!![],'where':{'id':_0x5b2a6e[_0xf46c('0x46')]['id']}},_0x23427a={};_0x23427a['model']=_['keys'](db[_0xf46c('0x2c')]['rawAttributes']);_0x23427a['query']=_[_0xf46c('0x32')](_0x5b2a6e['query']);_0x23427a[_0xf46c('0x33')]=_[_0xf46c('0x34')](_0x23427a['model'],_0x23427a[_0xf46c('0x31')]);_0x2e2bd2[_0xf46c('0x36')]=_[_0xf46c('0x34')](_0x23427a[_0xf46c('0x30')],qs[_0xf46c('0x35')](_0x5b2a6e['query']['fields']));_0x2e2bd2[_0xf46c('0x36')]=_0x2e2bd2[_0xf46c('0x36')]['length']?_0x2e2bd2['attributes']:_0x23427a[_0xf46c('0x30')];if(_0x5b2a6e['query'][_0xf46c('0x42')]){_0x2e2bd2[_0xf46c('0x43')]=[{'all':!![]}];}_0x2e2bd2=_[_0xf46c('0x3f')]({},_0x2e2bd2,_0x5b2a6e['options']);return db['Tag']['find'](_0x2e2bd2)['then'](handleEntityNotFound(_0x4ef846,null))['then'](respondWithResult(_0x4ef846,null))[_0xf46c('0x47')](handleError(_0x4ef846,null));};exports[_0xf46c('0x48')]=function(_0x2b4759,_0x3b192b){return db[_0xf46c('0x2c')][_0xf46c('0x48')](_0x2b4759['body'],{})[_0xf46c('0x23')](function(_0x5c74c3){var _0x593d4d=_0x2b4759[_0xf46c('0x49')]['get']({'plain':!![]});if(!_0x593d4d)throw new Error(_0xf46c('0x4a'));if(_0x593d4d['role']===_0xf46c('0x49')){var _0x117a85=_0x5c74c3[_0xf46c('0x24')]({'plain':!![]});var _0x43884b='Tags';return db[_0xf46c('0x4b')][_0xf46c('0x4c')]({'where':{'name':_0x43884b,'userProfileId':_0x593d4d[_0xf46c('0x4d')]},'raw':!![]})['then'](function(_0x320844){if(_0x320844&&_0x320844[_0xf46c('0x4e')]===0x0){return db[_0xf46c('0x4f')][_0xf46c('0x48')]({'name':_0x117a85['name'],'resourceId':_0x117a85['id'],'type':_0x320844[_0xf46c('0x28')],'sectionId':_0x320844['id']},{})[_0xf46c('0x23')](function(){return _0x5c74c3;});}else{return _0x5c74c3;}})[_0xf46c('0x47')](function(_0x5260af){logger['error'](_0xf46c('0x50'),_0x5260af);throw _0x5260af;});}return _0x5c74c3;})['then'](respondWithResult(_0x3b192b,0xc9))[_0xf46c('0x47')](handleError(_0x3b192b,null));};exports[_0xf46c('0x21')]=function(_0x3a5c97,_0x1b2187){if(_0x3a5c97[_0xf46c('0x51')]['id']){delete _0x3a5c97[_0xf46c('0x51')]['id'];}return db[_0xf46c('0x2c')][_0xf46c('0x4c')]({'where':{'id':_0x3a5c97[_0xf46c('0x46')]['id']}})['then'](handleEntityNotFound(_0x1b2187,null))[_0xf46c('0x23')](saveUpdates(_0x3a5c97[_0xf46c('0x51')],null))[_0xf46c('0x23')](respondWithResult(_0x1b2187,null))[_0xf46c('0x47')](handleError(_0x1b2187,null));};exports['destroy']=function(_0x5de6ad,_0x106cad){return db[_0xf46c('0x2c')]['find']({'where':{'id':_0x5de6ad[_0xf46c('0x46')]['id']}})[_0xf46c('0x23')](handleEntityNotFound(_0x106cad,null))['then'](removeEntity(_0x106cad,null))[_0xf46c('0x47')](handleError(_0x106cad,null));}; \ No newline at end of file +var _0xc69b=['rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','save','update','then','get','Tags','UserProfileResource','stack','name','send','index','Tag'];(function(_0x57c8a9,_0x4160bb){var _0x4c5d8a=function(_0x13ae56){while(--_0x13ae56){_0x57c8a9['push'](_0x57c8a9['shift']());}};_0x4c5d8a(++_0x4160bb);}(_0xc69b,0x6c));var _0xbc69=function(_0xf55e73,_0x3fecc5){_0xf55e73=_0xf55e73-0x0;var _0x116b99=_0xc69b[_0xf55e73];return _0x116b99;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbc69('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbc69('0x1'));var jsonpatch=require(_0xbc69('0x2'));var rp=require(_0xbc69('0x3'));var moment=require(_0xbc69('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xbc69('0x5'));var sox=require(_0xbc69('0x6'));var csv=require(_0xbc69('0x7'));var ejs=require(_0xbc69('0x8'));var fs=require('fs');var _=require(_0xbc69('0x9'));var squel=require(_0xbc69('0xa'));var crypto=require(_0xbc69('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbc69('0xc'));var toCsv=require(_0xbc69('0x7'));var querystring=require(_0xbc69('0xd'));var Papa=require(_0xbc69('0xe'));var Redis=require(_0xbc69('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbc69('0x10'));var as=require(_0xbc69('0x11'));var hardwareService=require(_0xbc69('0x12'));var logger=require('../../config/logger')(_0xbc69('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xbc69('0x14'))['db'];function respondWithStatusCode(_0x4263cb,_0x2dc25c){_0x2dc25c=_0x2dc25c||0xcc;return function(_0x4993da){if(_0x4993da){return _0x4263cb[_0xbc69('0x15')](_0x2dc25c);}return _0x4263cb[_0xbc69('0x16')](_0x2dc25c)[_0xbc69('0x17')]();};}function respondWithResult(_0x25e3d9,_0x333537){_0x333537=_0x333537||0xc8;return function(_0x4e61a1){if(_0x4e61a1){return _0x25e3d9[_0xbc69('0x16')](_0x333537)[_0xbc69('0x18')](_0x4e61a1);}};}function respondWithFilteredResult(_0x5e5a2a,_0x2a6b4f){return function(_0x336252){if(_0x336252){var _0x18024c=_0x336252[_0xbc69('0x19')],_0x408d18=_0x2a6b4f[_0xbc69('0x1a')],_0x15b71f=_0x2a6b4f['offset']+_0x2a6b4f[_0xbc69('0x1b')],_0x4ef388;if(_0x15b71f>=_0x18024c){_0x15b71f=_0x18024c;_0x4ef388=0xc8;}else{_0x4ef388=0xce;}_0x5e5a2a[_0xbc69('0x16')](_0x4ef388);return _0x5e5a2a['set']('Content-Range',_0x408d18+'-'+_0x15b71f+'/'+_0x18024c)[_0xbc69('0x18')](_0x336252);}return null;};}function patchUpdates(_0xf203fd){return function(_0x26eeca){try{jsonpatch[_0xbc69('0x1c')](_0x26eeca,_0xf203fd,!![]);}catch(_0x39c9bb){return BPromise['reject'](_0x39c9bb);}return _0x26eeca[_0xbc69('0x1d')]();};}function saveUpdates(_0x56acb2,_0x59e1be){return function(_0x48043a){if(_0x48043a){return _0x48043a[_0xbc69('0x1e')](_0x56acb2)[_0xbc69('0x1f')](function(_0x2b6a1e){return _0x2b6a1e;});}return null;};}function removeEntity(_0x5cbd53,_0x27051d){return function(_0xf1834){if(_0xf1834){return _0xf1834['destroy']()['then'](function(){var _0x4df5e7=_0xf1834[_0xbc69('0x20')]({'plain':!![]});var _0x3aa3f7=_0xbc69('0x21');return db[_0xbc69('0x22')]['destroy']({'where':{'type':_0x3aa3f7,'resourceId':_0x4df5e7['id']}})[_0xbc69('0x1f')](function(){return _0xf1834;});})[_0xbc69('0x1f')](function(){_0x5cbd53[_0xbc69('0x16')](0xcc)[_0xbc69('0x17')]();});}};}function handleEntityNotFound(_0x344a52,_0x1b2aa1){return function(_0x365b97){if(!_0x365b97){_0x344a52['sendStatus'](0x194);}return _0x365b97;};}function handleError(_0x45cfa2,_0x2c682b){_0x2c682b=_0x2c682b||0x1f4;return function(_0x996d8){logger['error'](_0x996d8[_0xbc69('0x23')]);if(_0x996d8[_0xbc69('0x24')]){delete _0x996d8[_0xbc69('0x24')];}_0x45cfa2[_0xbc69('0x16')](_0x2c682b)[_0xbc69('0x25')](_0x996d8);};}exports[_0xbc69('0x26')]=function(_0x15e70d,_0x184a33){var _0x4412f8={},_0x11b0f0={},_0x3f9d85={'count':0x0,'rows':[]};var _0x33daea=_['map'](db[_0xbc69('0x27')][_0xbc69('0x28')],function(_0x1e9824){return{'name':_0x1e9824['fieldName'],'type':_0x1e9824[_0xbc69('0x29')][_0xbc69('0x2a')]};});_0x11b0f0[_0xbc69('0x2b')]=_['map'](_0x33daea,'name');_0x11b0f0[_0xbc69('0x2c')]=_[_0xbc69('0x2d')](_0x15e70d['query']);_0x11b0f0[_0xbc69('0x2e')]=_['intersection'](_0x11b0f0['model'],_0x11b0f0[_0xbc69('0x2c')]);_0x4412f8[_0xbc69('0x2f')]=_['intersection'](_0x11b0f0[_0xbc69('0x2b')],qs[_0xbc69('0x30')](_0x15e70d[_0xbc69('0x2c')]['fields']));_0x4412f8[_0xbc69('0x2f')]=_0x4412f8['attributes'][_0xbc69('0x31')]?_0x4412f8[_0xbc69('0x2f')]:_0x11b0f0[_0xbc69('0x2b')];if(!_0x15e70d[_0xbc69('0x2c')][_0xbc69('0x32')](_0xbc69('0x33'))){_0x4412f8[_0xbc69('0x1b')]=qs['limit'](_0x15e70d['query'][_0xbc69('0x1b')]);_0x4412f8['offset']=qs['offset'](_0x15e70d['query'][_0xbc69('0x1a')]);}_0x4412f8['order']=qs[_0xbc69('0x34')](_0x15e70d['query'][_0xbc69('0x34')]);_0x4412f8[_0xbc69('0x35')]=qs[_0xbc69('0x2e')](_['pick'](_0x15e70d[_0xbc69('0x2c')],_0x11b0f0[_0xbc69('0x2e')]),_0x33daea);if(_0x15e70d[_0xbc69('0x2c')][_0xbc69('0x36')]){_0x4412f8['where']=_['merge'](_0x4412f8[_0xbc69('0x35')],{'$or':_['map'](_0x33daea,function(_0x374af1){if(_0x374af1[_0xbc69('0x29')]!==_0xbc69('0x37')){var _0x1d8bf7={};_0x1d8bf7[_0x374af1['name']]={'$like':'%'+_0x15e70d['query']['filter']+'%'};return _0x1d8bf7;}})});}_0x4412f8=_[_0xbc69('0x38')]({},_0x4412f8,_0x15e70d['options']);var _0x55fa8a={'where':_0x4412f8[_0xbc69('0x35')]};return db[_0xbc69('0x27')]['count'](_0x55fa8a)[_0xbc69('0x1f')](function(_0xb91fcd){_0x3f9d85[_0xbc69('0x19')]=_0xb91fcd;if(_0x15e70d[_0xbc69('0x2c')]['includeAll']){_0x4412f8[_0xbc69('0x39')]=[{'all':!![]}];}return db['Tag'][_0xbc69('0x3a')](_0x4412f8);})[_0xbc69('0x1f')](function(_0x22509d){_0x3f9d85[_0xbc69('0x3b')]=_0x22509d;return _0x3f9d85;})[_0xbc69('0x1f')](respondWithFilteredResult(_0x184a33,_0x4412f8))[_0xbc69('0x3c')](handleError(_0x184a33,null));};exports[_0xbc69('0x3d')]=function(_0x68f38b,_0x10b469){var _0x37d81f={'raw':!![],'where':{'id':_0x68f38b[_0xbc69('0x3e')]['id']}},_0x226a51={};_0x226a51['model']=_['keys'](db['Tag'][_0xbc69('0x28')]);_0x226a51[_0xbc69('0x2c')]=_[_0xbc69('0x2d')](_0x68f38b[_0xbc69('0x2c')]);_0x226a51['filters']=_[_0xbc69('0x3f')](_0x226a51[_0xbc69('0x2b')],_0x226a51[_0xbc69('0x2c')]);_0x37d81f[_0xbc69('0x2f')]=_[_0xbc69('0x3f')](_0x226a51[_0xbc69('0x2b')],qs[_0xbc69('0x30')](_0x68f38b['query'][_0xbc69('0x30')]));_0x37d81f[_0xbc69('0x2f')]=_0x37d81f['attributes']['length']?_0x37d81f[_0xbc69('0x2f')]:_0x226a51[_0xbc69('0x2b')];if(_0x68f38b[_0xbc69('0x2c')]['includeAll']){_0x37d81f[_0xbc69('0x39')]=[{'all':!![]}];}_0x37d81f=_['merge']({},_0x37d81f,_0x68f38b['options']);return db['Tag'][_0xbc69('0x40')](_0x37d81f)['then'](handleEntityNotFound(_0x10b469,null))[_0xbc69('0x1f')](respondWithResult(_0x10b469,null))[_0xbc69('0x3c')](handleError(_0x10b469,null));};exports[_0xbc69('0x41')]=function(_0x44ce99,_0x895b78){return db[_0xbc69('0x27')]['create'](_0x44ce99[_0xbc69('0x42')],{})['then'](function(_0x25f442){var _0x472cc2=_0x44ce99[_0xbc69('0x43')][_0xbc69('0x20')]({'plain':!![]});if(!_0x472cc2)throw new Error(_0xbc69('0x44'));if(_0x472cc2[_0xbc69('0x45')]==='user'){var _0x4371b0=_0x25f442[_0xbc69('0x20')]({'plain':!![]});var _0x178e1a='Tags';return db[_0xbc69('0x46')]['find']({'where':{'name':_0x178e1a,'userProfileId':_0x472cc2[_0xbc69('0x47')]},'raw':!![]})['then'](function(_0x1bb6ab){if(_0x1bb6ab&&_0x1bb6ab['autoAssociation']===0x0){return db[_0xbc69('0x22')][_0xbc69('0x41')]({'name':_0x4371b0['name'],'resourceId':_0x4371b0['id'],'type':_0x1bb6ab[_0xbc69('0x24')],'sectionId':_0x1bb6ab['id']},{})[_0xbc69('0x1f')](function(){return _0x25f442;});}else{return _0x25f442;}})[_0xbc69('0x3c')](function(_0x3874fa){logger[_0xbc69('0x48')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3874fa);throw _0x3874fa;});}return _0x25f442;})[_0xbc69('0x1f')](respondWithResult(_0x895b78,0xc9))[_0xbc69('0x3c')](handleError(_0x895b78,null));};exports[_0xbc69('0x1e')]=function(_0x1bf12d,_0x51c83e){if(_0x1bf12d[_0xbc69('0x42')]['id']){delete _0x1bf12d[_0xbc69('0x42')]['id'];}return db['Tag'][_0xbc69('0x40')]({'where':{'id':_0x1bf12d['params']['id']}})[_0xbc69('0x1f')](handleEntityNotFound(_0x51c83e,null))[_0xbc69('0x1f')](saveUpdates(_0x1bf12d[_0xbc69('0x42')],null))[_0xbc69('0x1f')](respondWithResult(_0x51c83e,null))['catch'](handleError(_0x51c83e,null));};exports[_0xbc69('0x49')]=function(_0x641769,_0x2c233a){return db['Tag'][_0xbc69('0x40')]({'where':{'id':_0x641769[_0xbc69('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2c233a,null))['then'](removeEntity(_0x2c233a,null))[_0xbc69('0x3c')](handleError(_0x2c233a,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index b4e304d..9128084 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 _0x36d0=['path','rimraf','./tag.attributes','exports','define','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3199bc,_0x592bcf){var _0x290bba=function(_0x4400b9){while(--_0x4400b9){_0x3199bc['push'](_0x3199bc['shift']());}};_0x290bba(++_0x592bcf);}(_0x36d0,0xaf));var _0x036d=function(_0x3e2453,_0x183b14){_0x3e2453=_0x3e2453-0x0;var _0x55c45f=_0x36d0[_0x3e2453];return _0x55c45f;};'use strict';var _=require(_0x036d('0x0'));var util=require(_0x036d('0x1'));var logger=require(_0x036d('0x2'))(_0x036d('0x3'));var moment=require(_0x036d('0x4'));var BPromise=require(_0x036d('0x5'));var rp=require(_0x036d('0x6'));var fs=require('fs');var path=require(_0x036d('0x7'));var rimraf=require(_0x036d('0x8'));var config=require('../../config/environment');var attributes=require(_0x036d('0x9'));module[_0x036d('0xa')]=function(_0x28bc9b,_0x164dc0){return _0x28bc9b[_0x036d('0xb')](_0x036d('0xc'),attributes,{'tableName':_0x036d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd529=['moment','bluebird','request-promise','path','rimraf','./tag.attributes','exports','define','tools_tags','lodash','util','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd529,0x10d));var _0x9d52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd529[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9d52('0x0'));var util=require(_0x9d52('0x1'));var logger=require(_0x9d52('0x2'))(_0x9d52('0x3'));var moment=require(_0x9d52('0x4'));var BPromise=require(_0x9d52('0x5'));var rp=require(_0x9d52('0x6'));var fs=require('fs');var path=require(_0x9d52('0x7'));var rimraf=require(_0x9d52('0x8'));var config=require('../../config/environment');var attributes=require(_0x9d52('0x9'));module[_0x9d52('0xa')]=function(_0x561aa9,_0xcab245){return _0x561aa9[_0x9d52('0xb')]('Tag',attributes,{'tableName':_0x9d52('0xc'),'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 8eabbd5..0fd0a09 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 _0x9bde=['code','message','Tag,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x268e28,_0x5121cf){var _0x2c03e7=function(_0x2726e3){while(--_0x2726e3){_0x268e28['push'](_0x268e28['shift']());}};_0x2c03e7(++_0x5121cf);}(_0x9bde,0xe1));var _0xe9bd=function(_0x32a2b9,_0x770c0d){_0x32a2b9=_0x32a2b9-0x0;var _0x5475b2=_0x9bde[_0x32a2b9];return _0x5475b2;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('Tag,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('Tag,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('Tag,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('Tag,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file +var _0x524a=['request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x524a,0xf5));var _0xa524=function(_0x4a5f7f,_0x1382ed){_0x4a5f7f=_0x4a5f7f-0x0;var _0x4a954e=_0x524a[_0x4a5f7f];return _0x4a954e;};'use strict';var _=require(_0xa524('0x0'));var util=require(_0xa524('0x1'));var moment=require(_0xa524('0x2'));var BPromise=require(_0xa524('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa524('0x4'));var db=require(_0xa524('0x5'))['db'];var utils=require(_0xa524('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa524('0x7'));var jayson=require(_0xa524('0x8'));var client=jayson[_0xa524('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x460738,_0x56bd0e,_0x3a2dd6){return new BPromise(function(_0x11aa98,_0x56849e){return client[_0xa524('0xa')](_0x460738,_0x3a2dd6)[_0xa524('0xb')](function(_0x228ffe){logger[_0xa524('0xc')](_0xa524('0xd'),_0x56bd0e,'request\x20sent');logger[_0xa524('0xe')](_0xa524('0xf'),_0x56bd0e,'request\x20sent',JSON['stringify'](_0x228ffe));if(_0x228ffe[_0xa524('0x10')]){if(_0x228ffe[_0xa524('0x10')][_0xa524('0x11')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x56bd0e,_0x228ffe[_0xa524('0x10')]['message']);return _0x56849e(_0x228ffe[_0xa524('0x10')]['message']);}logger[_0xa524('0x10')]('Tag,\x20%s,\x20%s',_0x56bd0e,_0x228ffe[_0xa524('0x10')][_0xa524('0x12')]);return _0x11aa98(_0x228ffe['error'][_0xa524('0x12')]);}else{logger[_0xa524('0xc')](_0xa524('0xd'),_0x56bd0e,_0xa524('0x13'));_0x11aa98(_0x228ffe[_0xa524('0x14')][_0xa524('0x12')]);}})[_0xa524('0x15')](function(_0x4fc42f){logger[_0xa524('0x10')](_0xa524('0xd'),_0x56bd0e,_0x4fc42f);_0x56849e(_0x4fc42f);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index fa7dfc8..5ac64ed 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 _0xff47=['express','Router','../../components/auth/service','./team.controller','get','isAuthenticated','index','/:id','show','/:id/queues','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy','removeQueues','removeAgents','multer','util','path'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xff47,0x195));var _0x7ff4=function(_0x4ffdc4,_0x34a28a){_0x4ffdc4=_0x4ffdc4-0x0;var _0x3b010c=_0xff47[_0x4ffdc4];return _0x3b010c;};'use strict';var multer=require(_0x7ff4('0x0'));var util=require(_0x7ff4('0x1'));var path=require(_0x7ff4('0x2'));var timeout=require('connect-timeout');var express=require(_0x7ff4('0x3'));var router=express[_0x7ff4('0x4')]();var auth=require(_0x7ff4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7ff4('0x6'));router[_0x7ff4('0x7')]('/',auth[_0x7ff4('0x8')](),controller[_0x7ff4('0x9')]);router[_0x7ff4('0x7')](_0x7ff4('0xa'),auth[_0x7ff4('0x8')](),controller[_0x7ff4('0xb')]);router[_0x7ff4('0x7')](_0x7ff4('0xc'),auth['isAuthenticated'](),controller['getQueues']);router[_0x7ff4('0x7')](_0x7ff4('0xd'),auth[_0x7ff4('0x8')](),controller[_0x7ff4('0xe')]);router[_0x7ff4('0xf')]('/',auth[_0x7ff4('0x8')](),controller[_0x7ff4('0x10')]);router[_0x7ff4('0xf')]('/:id/queues',auth[_0x7ff4('0x8')](),controller['addQueues']);router[_0x7ff4('0xf')](_0x7ff4('0xd'),auth[_0x7ff4('0x8')](),controller[_0x7ff4('0x11')]);router[_0x7ff4('0x12')](_0x7ff4('0xa'),auth[_0x7ff4('0x8')](),controller[_0x7ff4('0x13')]);router[_0x7ff4('0x14')](_0x7ff4('0xa'),auth[_0x7ff4('0x8')](),controller[_0x7ff4('0x15')]);router[_0x7ff4('0x14')](_0x7ff4('0xc'),auth[_0x7ff4('0x8')](),controller[_0x7ff4('0x16')]);router[_0x7ff4('0x14')]('/:id/users',auth[_0x7ff4('0x8')](),controller[_0x7ff4('0x17')]);module['exports']=router; \ No newline at end of file +var _0x38a9=['get','isAuthenticated','index','/:id','show','/:id/queues','getQueues','post','create','addQueues','/:id/users','addAgents','put','delete','destroy','removeQueues','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xbf26d,_0x3dc556){var _0x5318ce=function(_0x460721){while(--_0x460721){_0xbf26d['push'](_0xbf26d['shift']());}};_0x5318ce(++_0x3dc556);}(_0x38a9,0x11a));var _0x938a=function(_0x347e73,_0x499497){_0x347e73=_0x347e73-0x0;var _0x264bf7=_0x38a9[_0x347e73];return _0x264bf7;};'use strict';var multer=require(_0x938a('0x0'));var util=require(_0x938a('0x1'));var path=require(_0x938a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x938a('0x3')]();var auth=require(_0x938a('0x4'));var interaction=require(_0x938a('0x5'));var config=require('../../config/environment');var controller=require('./team.controller');router[_0x938a('0x6')]('/',auth[_0x938a('0x7')](),controller[_0x938a('0x8')]);router['get'](_0x938a('0x9'),auth[_0x938a('0x7')](),controller[_0x938a('0xa')]);router['get'](_0x938a('0xb'),auth[_0x938a('0x7')](),controller[_0x938a('0xc')]);router[_0x938a('0x6')]('/:id/users',auth[_0x938a('0x7')](),controller['getAgents']);router[_0x938a('0xd')]('/',auth['isAuthenticated'](),controller[_0x938a('0xe')]);router[_0x938a('0xd')](_0x938a('0xb'),auth[_0x938a('0x7')](),controller[_0x938a('0xf')]);router[_0x938a('0xd')](_0x938a('0x10'),auth[_0x938a('0x7')](),controller[_0x938a('0x11')]);router[_0x938a('0x12')](_0x938a('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x938a('0x13')](_0x938a('0x9'),auth[_0x938a('0x7')](),controller[_0x938a('0x14')]);router['delete']('/:id/queues',auth[_0x938a('0x7')](),controller[_0x938a('0x15')]);router[_0x938a('0x13')](_0x938a('0x10'),auth[_0x938a('0x7')](),controller[_0x938a('0x16')]);module[_0x938a('0x17')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index f428748..de2b1b3 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 _0x952b=['STRING','name'];(function(_0x120c26,_0x4340b1){var _0x1b5d68=function(_0x5cf540){while(--_0x5cf540){_0x120c26['push'](_0x120c26['shift']());}};_0x1b5d68(++_0x4340b1);}(_0x952b,0xa0));var _0xb952=function(_0x3ba334,_0x5ea6d2){_0x3ba334=_0x3ba334-0x0;var _0x5ad52c=_0x952b[_0x3ba334];return _0x5ad52c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb952('0x0')],'allowNull':![],'unique':_0xb952('0x1')},'description':{'type':Sequelize[_0xb952('0x0')]}}; \ No newline at end of file +var _0x3668=['sequelize','exports','STRING','name'];(function(_0x48e38a,_0x51200a){var _0x1a3d7a=function(_0x383019){while(--_0x383019){_0x48e38a['push'](_0x48e38a['shift']());}};_0x1a3d7a(++_0x51200a);}(_0x3668,0x1b4));var _0x8366=function(_0x4d3154,_0x44dccd){_0x4d3154=_0x4d3154-0x0;var _0x1d9d37=_0x3668[_0x4d3154];return _0x1d9d37;};'use strict';var Sequelize=require(_0x8366('0x0'));module[_0x8366('0x1')]={'name':{'type':Sequelize[_0x8366('0x2')],'allowNull':![],'unique':_0x8366('0x3')},'description':{'type':Sequelize[_0x8366('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 61f6481..c44600a 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 _0x6a13=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','destroy','then','UserProfileResource','error','stack','name','map','rawAttributes','model','query','keys','filters','intersection','attributes','length','nolimit','limit','order','sort','where','filter','type','VIRTUAL','merge','options','Team','include','findAll','catch','fields','includeAll','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Teams','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','toLowerCase','pick','capitalize','findOne','params','add','Queues','removeQueues','ids','Voice','Sms','Fax','Whatsapp','each','User','online','voicePause','interface','isNil','format','addAgents','omit','spread','emit','userTeam:save','removeAgents','chat','mail','fax','openchannel','whatsapp','voice','UserVoiceQueueRt','isArray','userTeam:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce'];(function(_0x56ec77,_0x1be4f5){var _0x31034f=function(_0x25cd89){while(--_0x25cd89){_0x56ec77['push'](_0x56ec77['shift']());}};_0x31034f(++_0x1be4f5);}(_0x6a13,0x6c));var _0x36a1=function(_0x3cb40a,_0x429316){_0x3cb40a=_0x3cb40a-0x0;var _0xc6f186=_0x6a13[_0x3cb40a];return _0xc6f186;};'use strict';var pdf=require(_0x36a1('0x0'));var emlformat=require(_0x36a1('0x1'));var rimraf=require(_0x36a1('0x2'));var zipdir=require(_0x36a1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x36a1('0x4'));var moment=require(_0x36a1('0x5'));var BPromise=require(_0x36a1('0x6'));var Mustache=require(_0x36a1('0x7'));var util=require(_0x36a1('0x8'));var path=require(_0x36a1('0x9'));var sox=require(_0x36a1('0xa'));var csv=require(_0x36a1('0xb'));var ejs=require(_0x36a1('0xc'));var fs=require('fs');var _=require(_0x36a1('0xd'));var squel=require(_0x36a1('0xe'));var crypto=require(_0x36a1('0xf'));var jsforce=require(_0x36a1('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x36a1('0xb'));var querystring=require(_0x36a1('0x11'));var Papa=require(_0x36a1('0x12'));var Redis=require(_0x36a1('0x13'));var authService=require(_0x36a1('0x14'));var qs=require(_0x36a1('0x15'));var as=require(_0x36a1('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x36a1('0x17'))(_0x36a1('0x18'));var utils=require(_0x36a1('0x19'));var config=require('../../config/environment');var db=require(_0x36a1('0x1a'))['db'];config[_0x36a1('0x1b')]=_[_0x36a1('0x1c')](config[_0x36a1('0x1b')],{'host':_0x36a1('0x1d'),'port':0x18eb});var socket=require(_0x36a1('0x1e'))(new Redis(config[_0x36a1('0x1b')]));require(_0x36a1('0x1f'))[_0x36a1('0x20')](socket);function respondWithStatusCode(_0xc58f27,_0x2dfdd2){_0x2dfdd2=_0x2dfdd2||0xcc;return function(_0x36a601){if(_0x36a601){return _0xc58f27[_0x36a1('0x21')](_0x2dfdd2);}return _0xc58f27[_0x36a1('0x22')](_0x2dfdd2)[_0x36a1('0x23')]();};}function respondWithResult(_0x4a3d8a,_0x3aeee7){_0x3aeee7=_0x3aeee7||0xc8;return function(_0x3b4e0f){if(_0x3b4e0f){return _0x4a3d8a[_0x36a1('0x22')](_0x3aeee7)[_0x36a1('0x24')](_0x3b4e0f);}};}function respondWithFilteredResult(_0x37deb5,_0x5a4961){return function(_0x478e3f){if(_0x478e3f){var _0x1ea4a4=_0x478e3f[_0x36a1('0x25')],_0x28be35=_0x5a4961[_0x36a1('0x26')],_0x45f776=_0x5a4961[_0x36a1('0x26')]+_0x5a4961['limit'],_0x561abb;if(_0x45f776>=_0x1ea4a4){_0x45f776=_0x1ea4a4;_0x561abb=0xc8;}else{_0x561abb=0xce;}_0x37deb5['status'](_0x561abb);return _0x37deb5['set'](_0x36a1('0x27'),_0x28be35+'-'+_0x45f776+'/'+_0x1ea4a4)['json'](_0x478e3f);}return null;};}function patchUpdates(_0x533cce){return function(_0x408115){try{jsonpatch[_0x36a1('0x28')](_0x408115,_0x533cce,!![]);}catch(_0x41f986){return BPromise[_0x36a1('0x29')](_0x41f986);}return _0x408115[_0x36a1('0x2a')]();};}function saveUpdates(_0x16e096,_0x54ad34){return function(_0x19e01d){if(_0x19e01d){return _0x19e01d['update'](_0x16e096)['then'](function(_0x5a73cc){return _0x5a73cc;});}return null;};}function removeEntity(_0x255c54,_0x1e457d){return function(_0x3fefa9){if(_0x3fefa9){return _0x3fefa9[_0x36a1('0x2b')]()[_0x36a1('0x2c')](function(){var _0x23ac77=_0x3fefa9['get']({'plain':!![]});var _0x109b21='Teams';return db[_0x36a1('0x2d')][_0x36a1('0x2b')]({'where':{'type':_0x109b21,'resourceId':_0x23ac77['id']}})[_0x36a1('0x2c')](function(){return _0x3fefa9;});})[_0x36a1('0x2c')](function(){_0x255c54['status'](0xcc)[_0x36a1('0x23')]();});}};}function handleEntityNotFound(_0x4eec5f,_0x269878){return function(_0x4ce7ab){if(!_0x4ce7ab){_0x4eec5f[_0x36a1('0x21')](0x194);}return _0x4ce7ab;};}function handleError(_0xcb0fd3,_0x507ba6){_0x507ba6=_0x507ba6||0x1f4;return function(_0x155928){logger[_0x36a1('0x2e')](_0x155928[_0x36a1('0x2f')]);if(_0x155928[_0x36a1('0x30')]){delete _0x155928[_0x36a1('0x30')];}_0xcb0fd3['status'](_0x507ba6)['send'](_0x155928);};}exports['index']=function(_0x245cc0,_0x500fcc){var _0x13da3a={},_0x4cdbc9={},_0x4c0577={'count':0x0,'rows':[]};var _0x5b8dca=_[_0x36a1('0x31')](db['Team'][_0x36a1('0x32')],function(_0x1cbec6){return{'name':_0x1cbec6['fieldName'],'type':_0x1cbec6['type']['key']};});_0x4cdbc9[_0x36a1('0x33')]=_[_0x36a1('0x31')](_0x5b8dca,_0x36a1('0x30'));_0x4cdbc9[_0x36a1('0x34')]=_[_0x36a1('0x35')](_0x245cc0[_0x36a1('0x34')]);_0x4cdbc9[_0x36a1('0x36')]=_[_0x36a1('0x37')](_0x4cdbc9[_0x36a1('0x33')],_0x4cdbc9[_0x36a1('0x34')]);_0x13da3a[_0x36a1('0x38')]=_[_0x36a1('0x37')](_0x4cdbc9[_0x36a1('0x33')],qs['fields'](_0x245cc0[_0x36a1('0x34')]['fields']));_0x13da3a[_0x36a1('0x38')]=_0x13da3a[_0x36a1('0x38')][_0x36a1('0x39')]?_0x13da3a[_0x36a1('0x38')]:_0x4cdbc9[_0x36a1('0x33')];if(!_0x245cc0[_0x36a1('0x34')]['hasOwnProperty'](_0x36a1('0x3a'))){_0x13da3a[_0x36a1('0x3b')]=qs[_0x36a1('0x3b')](_0x245cc0[_0x36a1('0x34')][_0x36a1('0x3b')]);_0x13da3a[_0x36a1('0x26')]=qs[_0x36a1('0x26')](_0x245cc0[_0x36a1('0x34')][_0x36a1('0x26')]);}_0x13da3a[_0x36a1('0x3c')]=qs[_0x36a1('0x3d')](_0x245cc0[_0x36a1('0x34')][_0x36a1('0x3d')]);_0x13da3a[_0x36a1('0x3e')]=qs[_0x36a1('0x36')](_['pick'](_0x245cc0[_0x36a1('0x34')],_0x4cdbc9['filters']),_0x5b8dca);if(_0x245cc0[_0x36a1('0x34')][_0x36a1('0x3f')]){_0x13da3a[_0x36a1('0x3e')]=_['merge'](_0x13da3a[_0x36a1('0x3e')],{'$or':_[_0x36a1('0x31')](_0x5b8dca,function(_0x5c8da1){if(_0x5c8da1[_0x36a1('0x40')]!==_0x36a1('0x41')){var _0x5c9c4a={};_0x5c9c4a[_0x5c8da1[_0x36a1('0x30')]]={'$like':'%'+_0x245cc0[_0x36a1('0x34')][_0x36a1('0x3f')]+'%'};return _0x5c9c4a;}})});}_0x13da3a=_[_0x36a1('0x42')]({},_0x13da3a,_0x245cc0[_0x36a1('0x43')]);var _0x5d5920={'where':_0x13da3a['where']};return db[_0x36a1('0x44')][_0x36a1('0x25')](_0x5d5920)[_0x36a1('0x2c')](function(_0x26a98c){_0x4c0577['count']=_0x26a98c;if(_0x245cc0[_0x36a1('0x34')]['includeAll']){_0x13da3a[_0x36a1('0x45')]=[{'all':!![]}];}return db[_0x36a1('0x44')][_0x36a1('0x46')](_0x13da3a);})['then'](function(_0x4885c4){_0x4c0577['rows']=_0x4885c4;return _0x4c0577;})[_0x36a1('0x2c')](respondWithFilteredResult(_0x500fcc,_0x13da3a))[_0x36a1('0x47')](handleError(_0x500fcc,null));};exports['show']=function(_0x27194f,_0x4f5220){var _0x163992={'raw':![],'where':{'id':_0x27194f['params']['id']}},_0x59b0f4={};_0x59b0f4[_0x36a1('0x33')]=_[_0x36a1('0x35')](db[_0x36a1('0x44')][_0x36a1('0x32')]);_0x59b0f4[_0x36a1('0x34')]=_[_0x36a1('0x35')](_0x27194f[_0x36a1('0x34')]);_0x59b0f4['filters']=_['intersection'](_0x59b0f4['model'],_0x59b0f4[_0x36a1('0x34')]);_0x163992[_0x36a1('0x38')]=_['intersection'](_0x59b0f4[_0x36a1('0x33')],qs[_0x36a1('0x48')](_0x27194f['query'][_0x36a1('0x48')]));_0x163992['attributes']=_0x163992['attributes']['length']?_0x163992[_0x36a1('0x38')]:_0x59b0f4[_0x36a1('0x33')];if(_0x27194f[_0x36a1('0x34')][_0x36a1('0x49')]){_0x163992[_0x36a1('0x45')]=[{'all':!![]}];}_0x163992=_[_0x36a1('0x42')]({},_0x163992,_0x27194f['options']);return db[_0x36a1('0x44')]['find'](_0x163992)[_0x36a1('0x2c')](handleEntityNotFound(_0x4f5220,null))['then'](respondWithResult(_0x4f5220,null))['catch'](handleError(_0x4f5220,null));};exports['create']=function(_0x1b65ad,_0x5551d5){return db['Team'][_0x36a1('0x4a')](_0x1b65ad[_0x36a1('0x4b')],{})[_0x36a1('0x2c')](function(_0x6f1b0e){var _0x40bb37=_0x1b65ad['user'][_0x36a1('0x4c')]({'plain':!![]});if(!_0x40bb37)throw new Error(_0x36a1('0x4d'));if(_0x40bb37['role']===_0x36a1('0x4e')){var _0x663a94=_0x6f1b0e[_0x36a1('0x4c')]({'plain':!![]});var _0x474c49=_0x36a1('0x4f');return db[_0x36a1('0x50')][_0x36a1('0x51')]({'where':{'name':_0x474c49,'userProfileId':_0x40bb37['userProfileId']},'raw':!![]})['then'](function(_0x36d04f){if(_0x36d04f&&_0x36d04f[_0x36a1('0x52')]===0x0){return db[_0x36a1('0x2d')]['create']({'name':_0x663a94['name'],'resourceId':_0x663a94['id'],'type':_0x36d04f[_0x36a1('0x30')],'sectionId':_0x36d04f['id']},{})['then'](function(){return _0x6f1b0e;});}else{return _0x6f1b0e;}})[_0x36a1('0x47')](function(_0x23dbc8){logger['error'](_0x36a1('0x53'),_0x23dbc8);throw _0x23dbc8;});}return _0x6f1b0e;})[_0x36a1('0x2c')](respondWithResult(_0x5551d5,0xc9))[_0x36a1('0x47')](handleError(_0x5551d5,null));};exports['update']=function(_0x42900c,_0x9d3b52){if(_0x42900c[_0x36a1('0x4b')]['id']){delete _0x42900c[_0x36a1('0x4b')]['id'];}return db['Team'][_0x36a1('0x51')]({'where':{'id':_0x42900c['params']['id']}})[_0x36a1('0x2c')](handleEntityNotFound(_0x9d3b52,null))['then'](saveUpdates(_0x42900c[_0x36a1('0x4b')],null))[_0x36a1('0x2c')](respondWithResult(_0x9d3b52,null))[_0x36a1('0x47')](handleError(_0x9d3b52,null));};exports['destroy']=function(_0x894e72,_0x2b1e22){return db[_0x36a1('0x44')][_0x36a1('0x51')]({'where':{'id':_0x894e72['params']['id']}})[_0x36a1('0x2c')](handleEntityNotFound(_0x2b1e22,null))[_0x36a1('0x2c')](removeEntity(_0x2b1e22,null))['catch'](handleError(_0x2b1e22,null));};exports['getQueues']=function(_0x1b1bfd,_0x15064a,_0x42ea24){return db[_0x36a1('0x44')]['findOne']({'where':{'id':_0x1b1bfd['params']['id']}})[_0x36a1('0x2c')](handleEntityNotFound(_0x15064a,null))['then'](function(_0xb18d3e){if(!_0x1b1bfd[_0x36a1('0x34')][_0x36a1('0x54')]||!utils[_0x36a1('0x55')](_0x1b1bfd[_0x36a1('0x34')]['channel'])){throw new db[(_0x36a1('0x56'))][(_0x36a1('0x57'))](_0x36a1('0x58'));}var _0x3844d4={};var _0x1c6190={};_0x1c6190[_0x36a1('0x33')]=_[_0x36a1('0x35')](db[_['capitalize'](_0x1b1bfd[_0x36a1('0x34')][_0x36a1('0x54')][_0x36a1('0x59')]())+'Queue'][_0x36a1('0x32')]);_0x1c6190[_0x36a1('0x34')]=_[_0x36a1('0x35')](_0x1b1bfd[_0x36a1('0x34')]);_0x1c6190['filters']=_['intersection'](_0x1c6190[_0x36a1('0x33')],_0x1c6190['query']);_0x3844d4['attributes']=_[_0x36a1('0x37')](_0x1c6190[_0x36a1('0x33')],qs[_0x36a1('0x48')](_0x1b1bfd[_0x36a1('0x34')][_0x36a1('0x48')]));_0x3844d4[_0x36a1('0x38')]=_0x3844d4[_0x36a1('0x38')][_0x36a1('0x39')]?_0x3844d4[_0x36a1('0x38')]:_0x1c6190[_0x36a1('0x33')];_0x3844d4[_0x36a1('0x3b')]=qs[_0x36a1('0x3b')](_0x1b1bfd[_0x36a1('0x34')]['limit']);_0x3844d4[_0x36a1('0x26')]=qs['offset'](_0x1b1bfd[_0x36a1('0x34')]['offset']);_0x3844d4['order']=qs['sort'](_0x1b1bfd['query'][_0x36a1('0x3d')]);_0x3844d4[_0x36a1('0x3e')]=qs[_0x36a1('0x36')](_[_0x36a1('0x5a')](_0x1b1bfd[_0x36a1('0x34')],_0x1c6190[_0x36a1('0x36')]));_0x3844d4=_[_0x36a1('0x42')]({},_0x3844d4,_0x1b1bfd[_0x36a1('0x43')]);return _0xb18d3e[_0x36a1('0x4c')+_[_0x36a1('0x5b')](_0x1b1bfd['query'][_0x36a1('0x54')][_0x36a1('0x59')]())+'Queues'](_0x3844d4);})[_0x36a1('0x2c')](respondWithResult(_0x15064a,null))[_0x36a1('0x47')](handleError(_0x15064a,null));};exports['addQueues']=function(_0x5b1b5b,_0x4d4997,_0x4cd21c){return db[_0x36a1('0x44')][_0x36a1('0x5c')]({'where':{'id':_0x5b1b5b[_0x36a1('0x5d')]['id']}})[_0x36a1('0x2c')](function(_0x51bdda){if(_0x51bdda){if(!_0x5b1b5b['body'][_0x36a1('0x54')]||!utils[_0x36a1('0x55')](_0x5b1b5b['body'][_0x36a1('0x54')])){throw new db[(_0x36a1('0x56'))][(_0x36a1('0x57'))]('Unknown\x20channel');}return _0x51bdda[_0x36a1('0x5e')+_[_0x36a1('0x5b')](_0x5b1b5b['body']['channel'][_0x36a1('0x59')]())+_0x36a1('0x5f')](_0x5b1b5b['body']['ids']);}return null;})[_0x36a1('0x2c')](handleEntityNotFound(_0x4d4997,null))['then'](respondWithStatusCode(_0x4d4997,null))['catch'](handleError(_0x4d4997,null));};exports[_0x36a1('0x60')]=function(_0x1033fd,_0x26f58e,_0x1a57ff){return db[_0x36a1('0x44')]['findOne']({'where':{'id':_0x1033fd[_0x36a1('0x5d')]['id']}})[_0x36a1('0x2c')](function(_0x3e86ff){if(_0x3e86ff){if(!_0x1033fd[_0x36a1('0x34')][_0x36a1('0x54')]||!utils['isValidChannel'](_0x1033fd[_0x36a1('0x34')][_0x36a1('0x54')])){throw new db[(_0x36a1('0x56'))][(_0x36a1('0x57'))](_0x36a1('0x58'));}return _0x3e86ff['remove'+_[_0x36a1('0x5b')](_0x1033fd[_0x36a1('0x34')]['channel'][_0x36a1('0x59')]())+'Queues'](_0x1033fd[_0x36a1('0x34')][_0x36a1('0x61')]);}return null;})[_0x36a1('0x2c')](handleEntityNotFound(_0x26f58e,null))[_0x36a1('0x2c')](respondWithStatusCode(_0x26f58e,null))['catch'](handleError(_0x26f58e,null));};exports['addAgents']=function(_0x5ea57f,_0x11f370,_0x5dadf8){return db['Team'][_0x36a1('0x51')]({'where':{'id':_0x5ea57f[_0x36a1('0x5d')]['id']}})[_0x36a1('0x2c')](handleEntityNotFound(_0x11f370,null))[_0x36a1('0x2c')](function(_0x412861){if(_0x412861){var _0x4640dd=[_0x36a1('0x62'),'Chat','Mail',_0x36a1('0x63'),_0x36a1('0x64'),'Openchannel',_0x36a1('0x65')];return BPromise[_0x36a1('0x66')](_0x4640dd,function(_0x5efd5f){return _0x412861[_0x36a1('0x4c')+_0x5efd5f+_0x36a1('0x5f')]({'attributes':['id',_0x36a1('0x30')]})[_0x36a1('0x2c')](function(_0x46eadf){return BPromise[_0x36a1('0x66')](_0x46eadf,function(_0x3eaf9d){return _0x3eaf9d['addAgents'](_0x5ea57f[_0x36a1('0x4b')][_0x36a1('0x61')])[_0x36a1('0x2c')](function(){if(_0x5efd5f==='Voice'){return db[_0x36a1('0x67')]['findAll']({'where':{'id':_0x5ea57f[_0x36a1('0x4b')]['ids']},'attributes':['id','name',_0x36a1('0x68'),_0x36a1('0x69'),_0x36a1('0x6a')],'raw':!![]})[_0x36a1('0x2c')](function(_0x7743ba){return BPromise[_0x36a1('0x66')](_[_0x36a1('0x3f')](_0x7743ba,{'online':0x1}),function(_0x3ae03e){return db['UserVoiceQueueRt']['upsert']({'membername':_0x3ae03e[_0x36a1('0x30')],'UserId':_0x3ae03e['id'],'queue_name':_0x3eaf9d[_0x36a1('0x30')],'VoiceQueueId':_0x3eaf9d['id'],'interface':_[_0x36a1('0x6b')](_0x3ae03e[_0x36a1('0x6a')])?util[_0x36a1('0x6c')]('SIP/%s',_0x3ae03e[_0x36a1('0x30')]):_0x3ae03e[_0x36a1('0x6a')],'paused':_0x3ae03e[_0x36a1('0x69')]||![],'penalty':0x0});});});}});});})['then'](function(){return _0x412861;});})[_0x36a1('0x2c')](function(){return _0x412861;});}})[_0x36a1('0x2c')](function(_0x572bf5){if(_0x572bf5){return _0x572bf5[_0x36a1('0x6d')](_0x5ea57f[_0x36a1('0x4b')][_0x36a1('0x61')],_[_0x36a1('0x6e')](_0x5ea57f[_0x36a1('0x4b')],[_0x36a1('0x61'),'id'])||{})[_0x36a1('0x6f')](function(_0x1d70a1){for(var _0x5c0894=0x0;_0x5c0894<_0x5ea57f[_0x36a1('0x4b')][_0x36a1('0x61')][_0x36a1('0x39')];_0x5c0894+=0x1){socket[_0x36a1('0x70')](_0x36a1('0x71'),{'UserId':_0x5ea57f[_0x36a1('0x4b')][_0x36a1('0x61')][_0x5c0894],'TeamId':_0x5ea57f[_0x36a1('0x5d')]['id']});}return _0x1d70a1;});}})[_0x36a1('0x2c')](respondWithResult(_0x11f370,null))['catch'](handleError(_0x11f370,null));};exports[_0x36a1('0x72')]=function(_0x3dd892,_0x16bbb1,_0x2ad782){return db['Team'][_0x36a1('0x51')]({'where':{'id':_0x3dd892[_0x36a1('0x5d')]['id']}})[_0x36a1('0x2c')](handleEntityNotFound(_0x16bbb1,null))[_0x36a1('0x2c')](function(_0x95577){if(_0x95577){return BPromise[_0x36a1('0x66')](['voice',_0x36a1('0x73'),_0x36a1('0x74'),'sms',_0x36a1('0x75'),_0x36a1('0x76'),_0x36a1('0x77')],function(_0x3f9520){return _0x95577[_0x36a1('0x4c')+_[_0x36a1('0x5b')](_0x3f9520)+_0x36a1('0x5f')]({'attributes':['id',_0x36a1('0x30')]})['then'](function(_0x563e0a){return BPromise[_0x36a1('0x66')](_0x563e0a,function(_0x54823a){return _0x54823a[_0x36a1('0x72')](_0x3dd892['query'][_0x36a1('0x61')])[_0x36a1('0x2c')](function(){if(_0x3f9520===_0x36a1('0x78')){return db[_0x36a1('0x79')][_0x36a1('0x2b')]({'where':{'VoiceQueueId':_0x54823a['id'],'UserId':_0x3dd892['query'][_0x36a1('0x61')]}});}});});})['then'](function(){return _0x95577;});})[_0x36a1('0x2c')](function(){return _0x95577;});}})[_0x36a1('0x2c')](function(_0x274a27){if(_0x274a27){return _0x274a27[_0x36a1('0x72')](_0x3dd892[_0x36a1('0x34')][_0x36a1('0x61')])['then'](function(){if(_[_0x36a1('0x7a')](_0x3dd892[_0x36a1('0x34')][_0x36a1('0x61')])){for(var _0x35e0b1=0x0;_0x35e0b1<_0x3dd892[_0x36a1('0x34')][_0x36a1('0x61')]['length'];_0x35e0b1+=0x1){socket['emit']('userTeam:remove',{'UserId':Number(_0x3dd892[_0x36a1('0x34')]['ids'][_0x35e0b1]),'TeamId':Number(_0x3dd892[_0x36a1('0x5d')]['id'])});}}else{socket['emit'](_0x36a1('0x7b'),{'UserId':Number(_0x3dd892['query'][_0x36a1('0x61')]),'TeamId':Number(_0x3dd892[_0x36a1('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x16bbb1,null))[_0x36a1('0x47')](handleError(_0x16bbb1,null));};exports[_0x36a1('0x7c')]=function(_0x4c8b4e,_0x4ddf6d,_0x35ea54){var _0x2ccc18={};var _0x3be3a1={};var _0x4387ca;var _0x309f6f;return db['Team']['findOne']({'where':{'id':_0x4c8b4e[_0x36a1('0x5d')]['id']}})[_0x36a1('0x2c')](handleEntityNotFound(_0x4ddf6d,null))[_0x36a1('0x2c')](function(_0x55f6f1){if(_0x55f6f1){_0x4387ca=_0x55f6f1;_0x3be3a1[_0x36a1('0x33')]=_[_0x36a1('0x35')](db[_0x36a1('0x67')][_0x36a1('0x32')]);_0x3be3a1[_0x36a1('0x34')]=_['keys'](_0x4c8b4e['query']);_0x3be3a1[_0x36a1('0x36')]=_[_0x36a1('0x37')](_0x3be3a1['model'],_0x3be3a1[_0x36a1('0x34')]);_0x2ccc18[_0x36a1('0x38')]=_[_0x36a1('0x37')](_0x3be3a1[_0x36a1('0x33')],qs[_0x36a1('0x48')](_0x4c8b4e[_0x36a1('0x34')][_0x36a1('0x48')]));_0x2ccc18[_0x36a1('0x38')]=_0x2ccc18[_0x36a1('0x38')][_0x36a1('0x39')]?_0x2ccc18[_0x36a1('0x38')]:_0x3be3a1[_0x36a1('0x33')];_0x2ccc18['order']=qs[_0x36a1('0x3d')](_0x4c8b4e[_0x36a1('0x34')]['sort']);_0x2ccc18[_0x36a1('0x3e')]=qs['filters'](_[_0x36a1('0x5a')](_0x4c8b4e[_0x36a1('0x34')],_0x3be3a1[_0x36a1('0x36')]));if(_0x4c8b4e[_0x36a1('0x34')]['filter']){_0x2ccc18[_0x36a1('0x3e')]=_[_0x36a1('0x42')](_0x2ccc18['where'],{'$or':_['map'](_0x2ccc18['attributes'],function(_0x57af13){var _0x4ffbf6={};_0x4ffbf6[_0x57af13]={'$like':'%'+_0x4c8b4e[_0x36a1('0x34')][_0x36a1('0x3f')]+'%'};return _0x4ffbf6;})});}_0x2ccc18=_[_0x36a1('0x42')]({},_0x2ccc18,_0x4c8b4e[_0x36a1('0x43')]);return _0x4387ca[_0x36a1('0x7c')](_0x2ccc18);}})[_0x36a1('0x2c')](function(_0x265862){if(_0x265862){_0x309f6f=_0x265862['length'];if(!_0x4c8b4e[_0x36a1('0x34')]['hasOwnProperty'](_0x36a1('0x3a'))){_0x2ccc18['limit']=qs[_0x36a1('0x3b')](_0x4c8b4e[_0x36a1('0x34')]['limit']);_0x2ccc18['offset']=qs[_0x36a1('0x26')](_0x4c8b4e[_0x36a1('0x34')]['offset']);}return _0x4387ca[_0x36a1('0x7c')](_0x2ccc18);}})[_0x36a1('0x2c')](function(_0x5e0278){if(_0x5e0278){return _0x5e0278?{'count':_0x309f6f,'rows':_0x5e0278}:null;}})[_0x36a1('0x2c')](respondWithResult(_0x4ddf6d,null))[_0x36a1('0x47')](handleError(_0x4ddf6d,null));}; \ No newline at end of file +var _0x3821=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./team.socket','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Teams','UserProfileResource','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Team','includeAll','include','findAll','catch','show','params','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','toLowerCase','capitalize','addQueues','add','Queues','removeQueues','findOne','ids','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','each','User','online','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','omit','spread','emit','userTeam:save','removeAgents','mail','fax','openchannel','whatsapp','voice','isArray','userTeam:remove','getAgents','hasOwnProperty','html-pdf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x3821,0xf7));var _0x1382=function(_0x5cd936,_0x587a12){_0x5cd936=_0x5cd936-0x0;var _0xd4169f=_0x3821[_0x5cd936];return _0xd4169f;};'use strict';var pdf=require(_0x1382('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1382('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1382('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1382('0x3'));var util=require(_0x1382('0x4'));var path=require(_0x1382('0x5'));var sox=require(_0x1382('0x6'));var csv=require(_0x1382('0x7'));var ejs=require(_0x1382('0x8'));var fs=require('fs');var _=require(_0x1382('0x9'));var squel=require(_0x1382('0xa'));var crypto=require(_0x1382('0xb'));var jsforce=require(_0x1382('0xc'));var deskjs=require(_0x1382('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1382('0xe'));var Papa=require(_0x1382('0xf'));var Redis=require(_0x1382('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1382('0x11'));var as=require(_0x1382('0x12'));var hardwareService=require(_0x1382('0x13'));var logger=require(_0x1382('0x14'))(_0x1382('0x15'));var utils=require(_0x1382('0x16'));var config=require(_0x1382('0x17'));var db=require(_0x1382('0x18'))['db'];config[_0x1382('0x19')]=_[_0x1382('0x1a')](config[_0x1382('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1382('0x19')]));require(_0x1382('0x1b'))['register'](socket);function respondWithStatusCode(_0x38e380,_0x49ab67){_0x49ab67=_0x49ab67||0xcc;return function(_0x146102){if(_0x146102){return _0x38e380['sendStatus'](_0x49ab67);}return _0x38e380[_0x1382('0x1c')](_0x49ab67)[_0x1382('0x1d')]();};}function respondWithResult(_0x204418,_0x21f436){_0x21f436=_0x21f436||0xc8;return function(_0x3d4201){if(_0x3d4201){return _0x204418[_0x1382('0x1c')](_0x21f436)[_0x1382('0x1e')](_0x3d4201);}};}function respondWithFilteredResult(_0x1d2a6f,_0x12b023){return function(_0x1102ca){if(_0x1102ca){var _0xa72071=_0x1102ca[_0x1382('0x1f')],_0x39b126=_0x12b023[_0x1382('0x20')],_0x5d94eb=_0x12b023[_0x1382('0x20')]+_0x12b023[_0x1382('0x21')],_0x46e354;if(_0x5d94eb>=_0xa72071){_0x5d94eb=_0xa72071;_0x46e354=0xc8;}else{_0x46e354=0xce;}_0x1d2a6f['status'](_0x46e354);return _0x1d2a6f[_0x1382('0x22')](_0x1382('0x23'),_0x39b126+'-'+_0x5d94eb+'/'+_0xa72071)[_0x1382('0x1e')](_0x1102ca);}return null;};}function patchUpdates(_0x286302){return function(_0x1e4cdc){try{jsonpatch[_0x1382('0x24')](_0x1e4cdc,_0x286302,!![]);}catch(_0x18f732){return BPromise[_0x1382('0x25')](_0x18f732);}return _0x1e4cdc[_0x1382('0x26')]();};}function saveUpdates(_0x24df4d,_0x43bf3a){return function(_0xeffcb2){if(_0xeffcb2){return _0xeffcb2[_0x1382('0x27')](_0x24df4d)[_0x1382('0x28')](function(_0x1325a7){return _0x1325a7;});}return null;};}function removeEntity(_0xdebd1b,_0x3e16c6){return function(_0x4eae34){if(_0x4eae34){return _0x4eae34[_0x1382('0x29')]()[_0x1382('0x28')](function(){var _0x2cff59=_0x4eae34['get']({'plain':!![]});var _0xc6bcc2=_0x1382('0x2a');return db[_0x1382('0x2b')][_0x1382('0x29')]({'where':{'type':_0xc6bcc2,'resourceId':_0x2cff59['id']}})['then'](function(){return _0x4eae34;});})[_0x1382('0x28')](function(){_0xdebd1b['status'](0xcc)[_0x1382('0x1d')]();});}};}function handleEntityNotFound(_0x477408,_0x599c37){return function(_0x5a5ee4){if(!_0x5a5ee4){_0x477408[_0x1382('0x2c')](0x194);}return _0x5a5ee4;};}function handleError(_0x203a43,_0x136310){_0x136310=_0x136310||0x1f4;return function(_0x7740c4){logger[_0x1382('0x2d')](_0x7740c4[_0x1382('0x2e')]);if(_0x7740c4[_0x1382('0x2f')]){delete _0x7740c4[_0x1382('0x2f')];}_0x203a43[_0x1382('0x1c')](_0x136310)[_0x1382('0x30')](_0x7740c4);};}exports[_0x1382('0x31')]=function(_0x35b9df,_0x19ca41){var _0x1ec7ee={},_0x145fe5={},_0xacbed8={'count':0x0,'rows':[]};var _0x206947=_['map'](db['Team'][_0x1382('0x32')],function(_0x5e11db){return{'name':_0x5e11db['fieldName'],'type':_0x5e11db[_0x1382('0x33')][_0x1382('0x34')]};});_0x145fe5[_0x1382('0x35')]=_[_0x1382('0x36')](_0x206947,_0x1382('0x2f'));_0x145fe5[_0x1382('0x37')]=_['keys'](_0x35b9df[_0x1382('0x37')]);_0x145fe5[_0x1382('0x38')]=_[_0x1382('0x39')](_0x145fe5[_0x1382('0x35')],_0x145fe5[_0x1382('0x37')]);_0x1ec7ee['attributes']=_[_0x1382('0x39')](_0x145fe5[_0x1382('0x35')],qs[_0x1382('0x3a')](_0x35b9df['query']['fields']));_0x1ec7ee[_0x1382('0x3b')]=_0x1ec7ee[_0x1382('0x3b')][_0x1382('0x3c')]?_0x1ec7ee[_0x1382('0x3b')]:_0x145fe5['model'];if(!_0x35b9df[_0x1382('0x37')]['hasOwnProperty'](_0x1382('0x3d'))){_0x1ec7ee[_0x1382('0x21')]=qs[_0x1382('0x21')](_0x35b9df[_0x1382('0x37')][_0x1382('0x21')]);_0x1ec7ee[_0x1382('0x20')]=qs[_0x1382('0x20')](_0x35b9df['query'][_0x1382('0x20')]);}_0x1ec7ee[_0x1382('0x3e')]=qs[_0x1382('0x3f')](_0x35b9df[_0x1382('0x37')][_0x1382('0x3f')]);_0x1ec7ee[_0x1382('0x40')]=qs[_0x1382('0x38')](_[_0x1382('0x41')](_0x35b9df[_0x1382('0x37')],_0x145fe5[_0x1382('0x38')]),_0x206947);if(_0x35b9df[_0x1382('0x37')][_0x1382('0x42')]){_0x1ec7ee['where']=_[_0x1382('0x43')](_0x1ec7ee[_0x1382('0x40')],{'$or':_[_0x1382('0x36')](_0x206947,function(_0x28eada){if(_0x28eada[_0x1382('0x33')]!==_0x1382('0x44')){var _0x4ffbc0={};_0x4ffbc0[_0x28eada[_0x1382('0x2f')]]={'$like':'%'+_0x35b9df[_0x1382('0x37')]['filter']+'%'};return _0x4ffbc0;}})});}_0x1ec7ee=_['merge']({},_0x1ec7ee,_0x35b9df[_0x1382('0x45')]);var _0x1d01fd={'where':_0x1ec7ee['where']};return db[_0x1382('0x46')][_0x1382('0x1f')](_0x1d01fd)[_0x1382('0x28')](function(_0x4748e5){_0xacbed8['count']=_0x4748e5;if(_0x35b9df[_0x1382('0x37')][_0x1382('0x47')]){_0x1ec7ee[_0x1382('0x48')]=[{'all':!![]}];}return db[_0x1382('0x46')][_0x1382('0x49')](_0x1ec7ee);})[_0x1382('0x28')](function(_0x39afeb){_0xacbed8['rows']=_0x39afeb;return _0xacbed8;})[_0x1382('0x28')](respondWithFilteredResult(_0x19ca41,_0x1ec7ee))[_0x1382('0x4a')](handleError(_0x19ca41,null));};exports[_0x1382('0x4b')]=function(_0x412338,_0xedf85){var _0x32cf48={'raw':![],'where':{'id':_0x412338[_0x1382('0x4c')]['id']}},_0x45bfba={};_0x45bfba[_0x1382('0x35')]=_['keys'](db[_0x1382('0x46')]['rawAttributes']);_0x45bfba['query']=_[_0x1382('0x4d')](_0x412338[_0x1382('0x37')]);_0x45bfba[_0x1382('0x38')]=_['intersection'](_0x45bfba['model'],_0x45bfba[_0x1382('0x37')]);_0x32cf48[_0x1382('0x3b')]=_[_0x1382('0x39')](_0x45bfba[_0x1382('0x35')],qs[_0x1382('0x3a')](_0x412338['query']['fields']));_0x32cf48['attributes']=_0x32cf48[_0x1382('0x3b')]['length']?_0x32cf48[_0x1382('0x3b')]:_0x45bfba[_0x1382('0x35')];if(_0x412338[_0x1382('0x37')][_0x1382('0x47')]){_0x32cf48[_0x1382('0x48')]=[{'all':!![]}];}_0x32cf48=_['merge']({},_0x32cf48,_0x412338[_0x1382('0x45')]);return db['Team']['find'](_0x32cf48)[_0x1382('0x28')](handleEntityNotFound(_0xedf85,null))[_0x1382('0x28')](respondWithResult(_0xedf85,null))['catch'](handleError(_0xedf85,null));};exports[_0x1382('0x4e')]=function(_0x267b66,_0x57e761){return db[_0x1382('0x46')]['create'](_0x267b66[_0x1382('0x4f')],{})[_0x1382('0x28')](function(_0x2b4c40){var _0x1c0d0c=_0x267b66[_0x1382('0x50')][_0x1382('0x51')]({'plain':!![]});if(!_0x1c0d0c)throw new Error(_0x1382('0x52'));if(_0x1c0d0c[_0x1382('0x53')]===_0x1382('0x50')){var _0x29c754=_0x2b4c40[_0x1382('0x51')]({'plain':!![]});var _0x44afb4=_0x1382('0x2a');return db[_0x1382('0x54')]['find']({'where':{'name':_0x44afb4,'userProfileId':_0x1c0d0c[_0x1382('0x55')]},'raw':!![]})['then'](function(_0x317a35){if(_0x317a35&&_0x317a35[_0x1382('0x56')]===0x0){return db[_0x1382('0x2b')][_0x1382('0x4e')]({'name':_0x29c754[_0x1382('0x2f')],'resourceId':_0x29c754['id'],'type':_0x317a35[_0x1382('0x2f')],'sectionId':_0x317a35['id']},{})[_0x1382('0x28')](function(){return _0x2b4c40;});}else{return _0x2b4c40;}})[_0x1382('0x4a')](function(_0x4b62cb){logger[_0x1382('0x2d')](_0x1382('0x57'),_0x4b62cb);throw _0x4b62cb;});}return _0x2b4c40;})['then'](respondWithResult(_0x57e761,0xc9))[_0x1382('0x4a')](handleError(_0x57e761,null));};exports[_0x1382('0x27')]=function(_0x6c1a28,_0x1e6487){if(_0x6c1a28['body']['id']){delete _0x6c1a28[_0x1382('0x4f')]['id'];}return db['Team'][_0x1382('0x58')]({'where':{'id':_0x6c1a28['params']['id']}})['then'](handleEntityNotFound(_0x1e6487,null))[_0x1382('0x28')](saveUpdates(_0x6c1a28[_0x1382('0x4f')],null))[_0x1382('0x28')](respondWithResult(_0x1e6487,null))[_0x1382('0x4a')](handleError(_0x1e6487,null));};exports[_0x1382('0x29')]=function(_0x4987ef,_0x2cc495){return db[_0x1382('0x46')][_0x1382('0x58')]({'where':{'id':_0x4987ef['params']['id']}})[_0x1382('0x28')](handleEntityNotFound(_0x2cc495,null))[_0x1382('0x28')](removeEntity(_0x2cc495,null))[_0x1382('0x4a')](handleError(_0x2cc495,null));};exports['getQueues']=function(_0x153c9c,_0x1268f5,_0x949e3e){return db[_0x1382('0x46')]['findOne']({'where':{'id':_0x153c9c[_0x1382('0x4c')]['id']}})[_0x1382('0x28')](handleEntityNotFound(_0x1268f5,null))['then'](function(_0xfb9d7a){if(!_0x153c9c['query'][_0x1382('0x59')]||!utils[_0x1382('0x5a')](_0x153c9c[_0x1382('0x37')][_0x1382('0x59')])){throw new db[(_0x1382('0x5b'))][(_0x1382('0x5c'))](_0x1382('0x5d'));}var _0x1e5766={};var _0x5e814a={};_0x5e814a[_0x1382('0x35')]=_[_0x1382('0x4d')](db[_['capitalize'](_0x153c9c[_0x1382('0x37')]['channel'][_0x1382('0x5e')]())+'Queue'][_0x1382('0x32')]);_0x5e814a['query']=_[_0x1382('0x4d')](_0x153c9c[_0x1382('0x37')]);_0x5e814a[_0x1382('0x38')]=_[_0x1382('0x39')](_0x5e814a['model'],_0x5e814a[_0x1382('0x37')]);_0x1e5766['attributes']=_[_0x1382('0x39')](_0x5e814a['model'],qs['fields'](_0x153c9c[_0x1382('0x37')][_0x1382('0x3a')]));_0x1e5766[_0x1382('0x3b')]=_0x1e5766[_0x1382('0x3b')]['length']?_0x1e5766['attributes']:_0x5e814a[_0x1382('0x35')];_0x1e5766[_0x1382('0x21')]=qs[_0x1382('0x21')](_0x153c9c[_0x1382('0x37')][_0x1382('0x21')]);_0x1e5766[_0x1382('0x20')]=qs[_0x1382('0x20')](_0x153c9c[_0x1382('0x37')][_0x1382('0x20')]);_0x1e5766[_0x1382('0x3e')]=qs[_0x1382('0x3f')](_0x153c9c[_0x1382('0x37')][_0x1382('0x3f')]);_0x1e5766[_0x1382('0x40')]=qs[_0x1382('0x38')](_[_0x1382('0x41')](_0x153c9c[_0x1382('0x37')],_0x5e814a[_0x1382('0x38')]));_0x1e5766=_[_0x1382('0x43')]({},_0x1e5766,_0x153c9c['options']);return _0xfb9d7a[_0x1382('0x51')+_[_0x1382('0x5f')](_0x153c9c['query']['channel'][_0x1382('0x5e')]())+'Queues'](_0x1e5766);})[_0x1382('0x28')](respondWithResult(_0x1268f5,null))[_0x1382('0x4a')](handleError(_0x1268f5,null));};exports[_0x1382('0x60')]=function(_0x2cf9fa,_0x57c5c0,_0x486f85){return db['Team']['findOne']({'where':{'id':_0x2cf9fa[_0x1382('0x4c')]['id']}})['then'](function(_0x280775){if(_0x280775){if(!_0x2cf9fa[_0x1382('0x4f')][_0x1382('0x59')]||!utils[_0x1382('0x5a')](_0x2cf9fa[_0x1382('0x4f')][_0x1382('0x59')])){throw new db[(_0x1382('0x5b'))]['ValidationError'](_0x1382('0x5d'));}return _0x280775[_0x1382('0x61')+_[_0x1382('0x5f')](_0x2cf9fa[_0x1382('0x4f')][_0x1382('0x59')]['toLowerCase']())+_0x1382('0x62')](_0x2cf9fa['body']['ids']);}return null;})[_0x1382('0x28')](handleEntityNotFound(_0x57c5c0,null))[_0x1382('0x28')](respondWithStatusCode(_0x57c5c0,null))[_0x1382('0x4a')](handleError(_0x57c5c0,null));};exports[_0x1382('0x63')]=function(_0x84fc8e,_0x325a67,_0x5777fe){return db[_0x1382('0x46')][_0x1382('0x64')]({'where':{'id':_0x84fc8e['params']['id']}})[_0x1382('0x28')](function(_0x19f6b2){if(_0x19f6b2){if(!_0x84fc8e['query'][_0x1382('0x59')]||!utils[_0x1382('0x5a')](_0x84fc8e[_0x1382('0x37')][_0x1382('0x59')])){throw new db[(_0x1382('0x5b'))][(_0x1382('0x5c'))](_0x1382('0x5d'));}return _0x19f6b2['remove'+_[_0x1382('0x5f')](_0x84fc8e['query'][_0x1382('0x59')]['toLowerCase']())+_0x1382('0x62')](_0x84fc8e[_0x1382('0x37')][_0x1382('0x65')]);}return null;})[_0x1382('0x28')](handleEntityNotFound(_0x325a67,null))['then'](respondWithStatusCode(_0x325a67,null))['catch'](handleError(_0x325a67,null));};exports[_0x1382('0x66')]=function(_0x56c4eb,_0x6f71ba,_0x479f63){return db[_0x1382('0x46')][_0x1382('0x58')]({'where':{'id':_0x56c4eb[_0x1382('0x4c')]['id']}})[_0x1382('0x28')](handleEntityNotFound(_0x6f71ba,null))['then'](function(_0x534243){if(_0x534243){var _0xb1cd50=[_0x1382('0x67'),_0x1382('0x68'),_0x1382('0x69'),_0x1382('0x6a'),_0x1382('0x6b'),_0x1382('0x6c'),_0x1382('0x6d')];return BPromise[_0x1382('0x6e')](_0xb1cd50,function(_0x48aeaa){return _0x534243[_0x1382('0x51')+_0x48aeaa+_0x1382('0x62')]({'attributes':['id','name']})['then'](function(_0x342e99){return BPromise[_0x1382('0x6e')](_0x342e99,function(_0x10373e){return _0x10373e[_0x1382('0x66')](_0x56c4eb[_0x1382('0x4f')]['ids'])[_0x1382('0x28')](function(){if(_0x48aeaa===_0x1382('0x67')){return db[_0x1382('0x6f')]['findAll']({'where':{'id':_0x56c4eb[_0x1382('0x4f')][_0x1382('0x65')]},'attributes':['id','name',_0x1382('0x70'),_0x1382('0x71'),_0x1382('0x72')],'raw':!![]})[_0x1382('0x28')](function(_0x332d97){return BPromise[_0x1382('0x6e')](_[_0x1382('0x42')](_0x332d97,{'online':0x1}),function(_0x497115){return db[_0x1382('0x73')]['upsert']({'membername':_0x497115['name'],'UserId':_0x497115['id'],'queue_name':_0x10373e[_0x1382('0x2f')],'VoiceQueueId':_0x10373e['id'],'interface':_[_0x1382('0x74')](_0x497115[_0x1382('0x72')])?util[_0x1382('0x75')](_0x1382('0x76'),_0x497115[_0x1382('0x2f')]):_0x497115[_0x1382('0x72')],'paused':_0x497115[_0x1382('0x71')]||![],'penalty':0x0});});});}});});})[_0x1382('0x28')](function(){return _0x534243;});})['then'](function(){return _0x534243;});}})[_0x1382('0x28')](function(_0x39bd75){if(_0x39bd75){return _0x39bd75[_0x1382('0x66')](_0x56c4eb['body'][_0x1382('0x65')],_[_0x1382('0x77')](_0x56c4eb[_0x1382('0x4f')],['ids','id'])||{})[_0x1382('0x78')](function(_0x3bca78){for(var _0xe62a95=0x0;_0xe62a95<_0x56c4eb[_0x1382('0x4f')]['ids'][_0x1382('0x3c')];_0xe62a95+=0x1){socket[_0x1382('0x79')](_0x1382('0x7a'),{'UserId':_0x56c4eb['body'][_0x1382('0x65')][_0xe62a95],'TeamId':_0x56c4eb['params']['id']});}return _0x3bca78;});}})['then'](respondWithResult(_0x6f71ba,null))[_0x1382('0x4a')](handleError(_0x6f71ba,null));};exports[_0x1382('0x7b')]=function(_0xc1016f,_0x5e27bf,_0xdd25e8){return db['Team']['find']({'where':{'id':_0xc1016f[_0x1382('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5e27bf,null))[_0x1382('0x28')](function(_0x42cc5c){if(_0x42cc5c){return BPromise[_0x1382('0x6e')](['voice','chat',_0x1382('0x7c'),'sms',_0x1382('0x7d'),_0x1382('0x7e'),_0x1382('0x7f')],function(_0x36f9de){return _0x42cc5c[_0x1382('0x51')+_['capitalize'](_0x36f9de)+_0x1382('0x62')]({'attributes':['id',_0x1382('0x2f')]})['then'](function(_0x45af5c){return BPromise[_0x1382('0x6e')](_0x45af5c,function(_0x5c8c23){return _0x5c8c23[_0x1382('0x7b')](_0xc1016f['query'][_0x1382('0x65')])[_0x1382('0x28')](function(){if(_0x36f9de===_0x1382('0x80')){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x5c8c23['id'],'UserId':_0xc1016f['query'][_0x1382('0x65')]}});}});});})[_0x1382('0x28')](function(){return _0x42cc5c;});})[_0x1382('0x28')](function(){return _0x42cc5c;});}})['then'](function(_0x1af7a6){if(_0x1af7a6){return _0x1af7a6[_0x1382('0x7b')](_0xc1016f['query'][_0x1382('0x65')])['then'](function(){if(_[_0x1382('0x81')](_0xc1016f[_0x1382('0x37')][_0x1382('0x65')])){for(var _0x4bf82f=0x0;_0x4bf82f<_0xc1016f['query']['ids'][_0x1382('0x3c')];_0x4bf82f+=0x1){socket[_0x1382('0x79')](_0x1382('0x82'),{'UserId':Number(_0xc1016f[_0x1382('0x37')]['ids'][_0x4bf82f]),'TeamId':Number(_0xc1016f[_0x1382('0x4c')]['id'])});}}else{socket[_0x1382('0x79')](_0x1382('0x82'),{'UserId':Number(_0xc1016f['query'][_0x1382('0x65')]),'TeamId':Number(_0xc1016f[_0x1382('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x5e27bf,null))['catch'](handleError(_0x5e27bf,null));};exports[_0x1382('0x83')]=function(_0x5424fa,_0x2664a2,_0x469f8c){var _0x569a74={};var _0x4e92ca={};var _0x2b9bca;var _0x21afcf;return db[_0x1382('0x46')][_0x1382('0x64')]({'where':{'id':_0x5424fa[_0x1382('0x4c')]['id']}})[_0x1382('0x28')](handleEntityNotFound(_0x2664a2,null))[_0x1382('0x28')](function(_0xef7dfe){if(_0xef7dfe){_0x2b9bca=_0xef7dfe;_0x4e92ca[_0x1382('0x35')]=_['keys'](db[_0x1382('0x6f')]['rawAttributes']);_0x4e92ca[_0x1382('0x37')]=_[_0x1382('0x4d')](_0x5424fa['query']);_0x4e92ca[_0x1382('0x38')]=_[_0x1382('0x39')](_0x4e92ca[_0x1382('0x35')],_0x4e92ca[_0x1382('0x37')]);_0x569a74[_0x1382('0x3b')]=_[_0x1382('0x39')](_0x4e92ca['model'],qs[_0x1382('0x3a')](_0x5424fa['query'][_0x1382('0x3a')]));_0x569a74['attributes']=_0x569a74['attributes'][_0x1382('0x3c')]?_0x569a74[_0x1382('0x3b')]:_0x4e92ca[_0x1382('0x35')];_0x569a74['order']=qs['sort'](_0x5424fa[_0x1382('0x37')][_0x1382('0x3f')]);_0x569a74['where']=qs[_0x1382('0x38')](_[_0x1382('0x41')](_0x5424fa[_0x1382('0x37')],_0x4e92ca[_0x1382('0x38')]));if(_0x5424fa[_0x1382('0x37')][_0x1382('0x42')]){_0x569a74['where']=_['merge'](_0x569a74[_0x1382('0x40')],{'$or':_['map'](_0x569a74['attributes'],function(_0x44fe72){var _0x3b0f19={};_0x3b0f19[_0x44fe72]={'$like':'%'+_0x5424fa[_0x1382('0x37')][_0x1382('0x42')]+'%'};return _0x3b0f19;})});}_0x569a74=_['merge']({},_0x569a74,_0x5424fa[_0x1382('0x45')]);return _0x2b9bca[_0x1382('0x83')](_0x569a74);}})['then'](function(_0x235ee6){if(_0x235ee6){_0x21afcf=_0x235ee6['length'];if(!_0x5424fa[_0x1382('0x37')][_0x1382('0x84')](_0x1382('0x3d'))){_0x569a74[_0x1382('0x21')]=qs[_0x1382('0x21')](_0x5424fa[_0x1382('0x37')][_0x1382('0x21')]);_0x569a74['offset']=qs[_0x1382('0x20')](_0x5424fa[_0x1382('0x37')]['offset']);}return _0x2b9bca['getAgents'](_0x569a74);}})[_0x1382('0x28')](function(_0x2249a0){if(_0x2249a0){return _0x2249a0?{'count':_0x21afcf,'rows':_0x2249a0}:null;}})[_0x1382('0x28')](respondWithResult(_0x2664a2,null))['catch'](handleError(_0x2664a2,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index dbdb47b..4f1247e 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 _0x5866=['hook','exports','../../mysqldb','Team','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x390cea,_0x43c078){var _0x14bf80=function(_0x196f3c){while(--_0x196f3c){_0x390cea['push'](_0x390cea['shift']());}};_0x14bf80(++_0x43c078);}(_0x5866,0x158));var _0x6586=function(_0x174706,_0x110441){_0x174706=_0x174706-0x0;var _0x13bc39=_0x5866[_0x174706];return _0x13bc39;};'use strict';var EventEmitter=require('events');var Team=require(_0x6586('0x0'))['db'][_0x6586('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x6586('0x2')](0x0);var events={'afterCreate':_0x6586('0x3'),'afterUpdate':_0x6586('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3d4ad4){return function(_0x2d3a02,_0x22866a,_0x4231aa){TeamEvents[_0x6586('0x5')](_0x3d4ad4+':'+_0x2d3a02['id'],_0x2d3a02);TeamEvents['emit'](_0x3d4ad4,_0x2d3a02);_0x4231aa(null);};}for(var e in events){if(events[_0x6586('0x6')](e)){var event=events[e];Team[_0x6586('0x7')](e,emitEvent(event));}}module[_0x6586('0x8')]=TeamEvents; \ No newline at end of file +var _0x8baf=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners'];(function(_0x4b7727,_0x4eddad){var _0x25f5ba=function(_0x10aa2f){while(--_0x10aa2f){_0x4b7727['push'](_0x4b7727['shift']());}};_0x25f5ba(++_0x4eddad);}(_0x8baf,0xc2));var _0xf8ba=function(_0x3056c2,_0x3a1621){_0x3056c2=_0x3056c2-0x0;var _0x5b91c8=_0x8baf[_0x3056c2];return _0x5b91c8;};'use strict';var EventEmitter=require(_0xf8ba('0x0'));var Team=require(_0xf8ba('0x1'))['db'][_0xf8ba('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xf8ba('0x3')](0x0);var events={'afterCreate':_0xf8ba('0x4'),'afterUpdate':_0xf8ba('0x5'),'afterDestroy':_0xf8ba('0x6')};function emitEvent(_0x250dce){return function(_0x1a8a83,_0x324955,_0x24b389){TeamEvents[_0xf8ba('0x7')](_0x250dce+':'+_0x1a8a83['id'],_0x1a8a83);TeamEvents[_0xf8ba('0x7')](_0x250dce,_0x1a8a83);_0x24b389(null);};}for(var e in events){if(events[_0xf8ba('0x8')](e)){var event=events[e];Team[_0xf8ba('0x9')](e,emitEvent(event));}}module[_0xf8ba('0xa')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 504d8f4..43d039a 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 _0xaca3=['api','moment','path','rimraf','../../config/environment','./team.attributes','exports','Team','lodash','util'];(function(_0x3fa8ee,_0x3b350d){var _0x36a857=function(_0x289c6c){while(--_0x289c6c){_0x3fa8ee['push'](_0x3fa8ee['shift']());}};_0x36a857(++_0x3b350d);}(_0xaca3,0x116));var _0x3aca=function(_0xc0382f,_0x294c56){_0xc0382f=_0xc0382f-0x0;var _0x36d0ea=_0xaca3[_0xc0382f];return _0x36d0ea;};'use strict';var _=require(_0x3aca('0x0'));var util=require(_0x3aca('0x1'));var logger=require('../../config/logger')(_0x3aca('0x2'));var moment=require(_0x3aca('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3aca('0x4'));var rimraf=require(_0x3aca('0x5'));var config=require(_0x3aca('0x6'));var attributes=require(_0x3aca('0x7'));module[_0x3aca('0x8')]=function(_0x1ff55d,_0x2bd74f){return _0x1ff55d['define'](_0x3aca('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf25=['bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','exports','define','Team','util','../../config/logger','moment'];(function(_0x1846f4,_0x3a6121){var _0xf74891=function(_0x387bce){while(--_0x387bce){_0x1846f4['push'](_0x1846f4['shift']());}};_0xf74891(++_0x3a6121);}(_0xdf25,0xf9));var _0x5df2=function(_0x39b171,_0x2db684){_0x39b171=_0x39b171-0x0;var _0x1fd234=_0xdf25[_0x39b171];return _0x1fd234;};'use strict';var _=require('lodash');var util=require(_0x5df2('0x0'));var logger=require(_0x5df2('0x1'))('api');var moment=require(_0x5df2('0x2'));var BPromise=require(_0x5df2('0x3'));var rp=require(_0x5df2('0x4'));var fs=require('fs');var path=require(_0x5df2('0x5'));var rimraf=require(_0x5df2('0x6'));var config=require(_0x5df2('0x7'));var attributes=require(_0x5df2('0x8'));module[_0x5df2('0x9')]=function(_0x22af1d,_0x51372d){return _0x22af1d[_0x5df2('0xa')](_0x5df2('0xb'),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 fbf6643..debeb8c 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 _0xea8c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','defaults','redis','localhost','socket.io-emitter','register','request','request\x20sent','debug','stringify','code','error','Team,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xea8c,0x8d));var _0xcea8=function(_0x3dc575,_0x359833){_0x3dc575=_0x3dc575-0x0;var _0x5366d9=_0xea8c[_0x3dc575];return _0x5366d9;};'use strict';var _=require(_0xcea8('0x0'));var util=require(_0xcea8('0x1'));var moment=require('moment');var BPromise=require(_0xcea8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcea8('0x3'));var db=require(_0xcea8('0x4'))['db'];var utils=require(_0xcea8('0x5'));var logger=require(_0xcea8('0x6'))(_0xcea8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcea8('0x8')]['http']({'port':0x232a});config['redis']=_[_0xcea8('0x9')](config[_0xcea8('0xa')],{'host':_0xcea8('0xb'),'port':0x18eb});var socket=require(_0xcea8('0xc'))(new Redis(config[_0xcea8('0xa')]));require('./team.socket')[_0xcea8('0xd')](socket);function respondWithRpcPromise(_0x48cf52,_0x2a1866,_0x5e4bea){return new BPromise(function(_0x2cbbeb,_0x5447cc){return client[_0xcea8('0xe')](_0x48cf52,_0x5e4bea)['then'](function(_0x14bbe4){logger['info']('Team,\x20%s,\x20%s',_0x2a1866,_0xcea8('0xf'));logger[_0xcea8('0x10')]('Team,\x20%s,\x20%s,\x20%s',_0x2a1866,_0xcea8('0xf'),JSON[_0xcea8('0x11')](_0x14bbe4));if(_0x14bbe4['error']){if(_0x14bbe4['error'][_0xcea8('0x12')]===0x1f4){logger[_0xcea8('0x13')](_0xcea8('0x14'),_0x2a1866,_0x14bbe4[_0xcea8('0x13')][_0xcea8('0x15')]);return _0x5447cc(_0x14bbe4[_0xcea8('0x13')][_0xcea8('0x15')]);}logger[_0xcea8('0x13')](_0xcea8('0x14'),_0x2a1866,_0x14bbe4[_0xcea8('0x13')][_0xcea8('0x15')]);return _0x2cbbeb(_0x14bbe4[_0xcea8('0x13')][_0xcea8('0x15')]);}else{logger['info'](_0xcea8('0x14'),_0x2a1866,_0xcea8('0xf'));_0x2cbbeb(_0x14bbe4[_0xcea8('0x16')][_0xcea8('0x15')]);}})[_0xcea8('0x17')](function(_0x54f4f0){logger[_0xcea8('0x13')]('Team,\x20%s,\x20%s',_0x2a1866,_0x54f4f0);_0x5447cc(_0x54f4f0);});});} \ No newline at end of file +var _0xb9fb=['Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xb9fb,0x1b5));var _0xbb9f=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xb9fb[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0xbb9f('0x0'));var util=require('util');var moment=require(_0xbb9f('0x1'));var BPromise=require(_0xbb9f('0x2'));var rs=require(_0xbb9f('0x3'));var fs=require('fs');var Redis=require(_0xbb9f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb9f('0x5'));var logger=require(_0xbb9f('0x6'))(_0xbb9f('0x7'));var config=require(_0xbb9f('0x8'));var jayson=require(_0xbb9f('0x9'));var client=jayson[_0xbb9f('0xa')]['http']({'port':0x232a});config[_0xbb9f('0xb')]=_[_0xbb9f('0xc')](config[_0xbb9f('0xb')],{'host':_0xbb9f('0xd'),'port':0x18eb});var socket=require(_0xbb9f('0xe'))(new Redis(config[_0xbb9f('0xb')]));require(_0xbb9f('0xf'))['register'](socket);function respondWithRpcPromise(_0x22eaec,_0x31b412,_0x56f44a){return new BPromise(function(_0x58a46f,_0x586ce1){return client[_0xbb9f('0x10')](_0x22eaec,_0x56f44a)[_0xbb9f('0x11')](function(_0xae1f6f){logger[_0xbb9f('0x12')](_0xbb9f('0x13'),_0x31b412,_0xbb9f('0x14'));logger[_0xbb9f('0x15')](_0xbb9f('0x16'),_0x31b412,_0xbb9f('0x14'),JSON[_0xbb9f('0x17')](_0xae1f6f));if(_0xae1f6f['error']){if(_0xae1f6f[_0xbb9f('0x18')]['code']===0x1f4){logger[_0xbb9f('0x18')](_0xbb9f('0x13'),_0x31b412,_0xae1f6f[_0xbb9f('0x18')]['message']);return _0x586ce1(_0xae1f6f['error'][_0xbb9f('0x19')]);}logger['error'](_0xbb9f('0x13'),_0x31b412,_0xae1f6f[_0xbb9f('0x18')][_0xbb9f('0x19')]);return _0x58a46f(_0xae1f6f[_0xbb9f('0x18')][_0xbb9f('0x19')]);}else{logger[_0xbb9f('0x12')](_0xbb9f('0x13'),_0x31b412,_0xbb9f('0x14'));_0x58a46f(_0xae1f6f[_0xbb9f('0x1a')][_0xbb9f('0x19')]);}})['catch'](function(_0x4389bb){logger[_0xbb9f('0x18')](_0xbb9f('0x13'),_0x31b412,_0x4389bb);_0x586ce1(_0x4389bb);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 8e23dd9..389fd64 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 _0x16ce=['remove','update','removeListener','length','team:','save'];(function(_0x5e40fb,_0x3f837f){var _0x4fdc06=function(_0x815643){while(--_0x815643){_0x5e40fb['push'](_0x5e40fb['shift']());}};_0x4fdc06(++_0x3f837f);}(_0x16ce,0xfb));var _0xe16c=function(_0x5bf0d3,_0xb75557){_0x5bf0d3=_0x5bf0d3-0x0;var _0x1ceed9=_0x16ce[_0x5bf0d3];return _0x1ceed9;};'use strict';var TeamEvents=require('./team.events');var events=[_0xe16c('0x0'),_0xe16c('0x1'),_0xe16c('0x2')];function createListener(_0x33cf7e,_0x3251e3){return function(_0x1864e1){_0x3251e3['emit'](_0x33cf7e,_0x1864e1);};}function removeListener(_0x55c37e,_0x4a5fc8){return function(){TeamEvents[_0xe16c('0x3')](_0x55c37e,_0x4a5fc8);};}exports['register']=function(_0x1707f9){for(var _0x13ee4a=0x0,_0x3b149c=events[_0xe16c('0x4')];_0x13ee4a<_0x3b149c;_0x13ee4a++){var _0x1d8b72=events[_0x13ee4a];var _0x14d6d4=createListener(_0xe16c('0x5')+_0x1d8b72,_0x1707f9);TeamEvents['on'](_0x1d8b72,_0x14d6d4);}}; \ No newline at end of file +var _0x86b8=['save','remove','emit','removeListener','length','team:','./team.events'];(function(_0x2e7266,_0x4340ee){var _0x5d0cc7=function(_0x3df99c){while(--_0x3df99c){_0x2e7266['push'](_0x2e7266['shift']());}};_0x5d0cc7(++_0x4340ee);}(_0x86b8,0x15d));var _0x886b=function(_0x4ff749,_0x24892a){_0x4ff749=_0x4ff749-0x0;var _0x170300=_0x86b8[_0x4ff749];return _0x170300;};'use strict';var TeamEvents=require(_0x886b('0x0'));var events=[_0x886b('0x1'),_0x886b('0x2'),'update'];function createListener(_0x105f5d,_0x5db7b6){return function(_0x3dcb96){_0x5db7b6[_0x886b('0x3')](_0x105f5d,_0x3dcb96);};}function removeListener(_0x4191fb,_0x4d3769){return function(){TeamEvents[_0x886b('0x4')](_0x4191fb,_0x4d3769);};}exports['register']=function(_0x5b5ff5){for(var _0x2c32bc=0x0,_0xd9d9ac=events[_0x886b('0x5')];_0x2c32bc<_0xd9d9ac;_0x2c32bc++){var _0x2f8957=events[_0x2c32bc];var _0xbc2d70=createListener(_0x886b('0x6')+_0x2f8957,_0x5b5ff5);TeamEvents['on'](_0x2f8957,_0xbc2d70);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index d07ff5c..b261554 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 _0x41fb=['index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','get','isAuthenticated'];(function(_0x1e0d2b,_0x1da7e4){var _0x14d132=function(_0x3793c6){while(--_0x3793c6){_0x1e0d2b['push'](_0x1e0d2b['shift']());}};_0x14d132(++_0x1da7e4);}(_0x41fb,0x1e5));var _0xb41f=function(_0x49a357,_0x208352){_0x49a357=_0x49a357-0x0;var _0x3f2206=_0x41fb[_0x49a357];return _0x3f2206;};'use strict';var multer=require(_0xb41f('0x0'));var util=require(_0xb41f('0x1'));var path=require(_0xb41f('0x2'));var timeout=require('connect-timeout');var express=require(_0xb41f('0x3'));var router=express[_0xb41f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb41f('0x5'));var config=require('../../config/environment');var controller=require('./template.controller');router[_0xb41f('0x6')]('/',auth[_0xb41f('0x7')](),controller[_0xb41f('0x8')]);router[_0xb41f('0x6')](_0xb41f('0x9'),auth[_0xb41f('0x7')](),controller[_0xb41f('0xa')]);router['post']('/',auth[_0xb41f('0x7')](),controller[_0xb41f('0xb')]);router[_0xb41f('0xc')](_0xb41f('0x9'),auth[_0xb41f('0x7')](),controller[_0xb41f('0xd')]);router[_0xb41f('0xe')](_0xb41f('0x9'),auth[_0xb41f('0x7')](),controller[_0xb41f('0xf')]);module[_0xb41f('0x10')]=router; \ No newline at end of file +var _0x499e=['update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','index','isAuthenticated'];(function(_0x562c56,_0x5e3c9c){var _0x6daf03=function(_0x2c6064){while(--_0x2c6064){_0x562c56['push'](_0x562c56['shift']());}};_0x6daf03(++_0x5e3c9c);}(_0x499e,0x115));var _0xe499=function(_0xe35c45,_0x336e08){_0xe35c45=_0xe35c45-0x0;var _0x2a8c5b=_0x499e[_0xe35c45];return _0x2a8c5b;};'use strict';var multer=require(_0xe499('0x0'));var util=require(_0xe499('0x1'));var path=require(_0xe499('0x2'));var timeout=require(_0xe499('0x3'));var express=require(_0xe499('0x4'));var router=express[_0xe499('0x5')]();var auth=require(_0xe499('0x6'));var interaction=require(_0xe499('0x7'));var config=require(_0xe499('0x8'));var controller=require(_0xe499('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe499('0xa')]);router['get']('/:id',auth[_0xe499('0xb')](),controller['show']);router['post']('/',auth[_0xe499('0xb')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe499('0xc')]);router[_0xe499('0xd')](_0xe499('0xe'),auth['isAuthenticated'](),controller[_0xe499('0xf')]);module[_0xe499('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 10434eb..3fa35c2 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 _0x97e6=['sequelize','STRING','TEXT'];(function(_0x5565f5,_0x422032){var _0x50426b=function(_0x2ea948){while(--_0x2ea948){_0x5565f5['push'](_0x5565f5['shift']());}};_0x50426b(++_0x422032);}(_0x97e6,0x159));var _0x697e=function(_0x493985,_0xabbee5){_0x493985=_0x493985-0x0;var _0x532b94=_0x97e6[_0x493985];return _0x532b94;};'use strict';var Sequelize=require(_0x697e('0x0'));module['exports']={'name':{'type':Sequelize[_0x697e('0x1')]},'description':{'type':Sequelize[_0x697e('0x1')]},'html':{'type':Sequelize[_0x697e('0x2')]}}; \ No newline at end of file +var _0x734c=['STRING','sequelize','exports'];(function(_0x2c3036,_0x4b944d){var _0xa705c0=function(_0x3d3363){while(--_0x3d3363){_0x2c3036['push'](_0x2c3036['shift']());}};_0xa705c0(++_0x4b944d);}(_0x734c,0xe2));var _0xc734=function(_0x106fdf,_0x1e71e4){_0x106fdf=_0x106fdf-0x0;var _0x24818c=_0x734c[_0x106fdf];return _0x24818c;};'use strict';var Sequelize=require(_0xc734('0x0'));module[_0xc734('0x1')]={'name':{'type':Sequelize[_0xc734('0x2')]},'description':{'type':Sequelize[_0xc734('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 0e6faac..fa6aa19 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 _0xf8e4=['length','hasOwnProperty','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','json','apply','reject','save','update','destroy','then','get','UserProfileResource','name','map','Template','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields'];(function(_0x65c9d8,_0x5952fc){var _0x52de83=function(_0x2365da){while(--_0x2365da){_0x65c9d8['push'](_0x65c9d8['shift']());}};_0x52de83(++_0x5952fc);}(_0xf8e4,0xae));var _0x4f8e=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xf8e4[_0xd09668];return _0x68726;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4f8e('0x0'));var rimraf=require(_0x4f8e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f8e('0x2'));var rp=require(_0x4f8e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4f8e('0x4'));var util=require(_0x4f8e('0x5'));var path=require(_0x4f8e('0x6'));var sox=require(_0x4f8e('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f8e('0x8'));var deskjs=require(_0x4f8e('0x9'));var toCsv=require(_0x4f8e('0xa'));var querystring=require('querystring');var Papa=require(_0x4f8e('0xb'));var Redis=require(_0x4f8e('0xc'));var authService=require(_0x4f8e('0xd'));var qs=require(_0x4f8e('0xe'));var as=require(_0x4f8e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4f8e('0x10'))(_0x4f8e('0x11'));var utils=require(_0x4f8e('0x12'));var config=require(_0x4f8e('0x13'));var db=require(_0x4f8e('0x14'))['db'];function respondWithStatusCode(_0x2dd20d,_0x3c544d){_0x3c544d=_0x3c544d||0xcc;return function(_0x12fc16){if(_0x12fc16){return _0x2dd20d[_0x4f8e('0x15')](_0x3c544d);}return _0x2dd20d[_0x4f8e('0x16')](_0x3c544d)[_0x4f8e('0x17')]();};}function respondWithResult(_0x371245,_0x82621f){_0x82621f=_0x82621f||0xc8;return function(_0x58926e){if(_0x58926e){return _0x371245[_0x4f8e('0x16')](_0x82621f)['json'](_0x58926e);}};}function respondWithFilteredResult(_0x40efcc,_0x3af2b4){return function(_0x123a40){if(_0x123a40){var _0x53aaba=_0x123a40[_0x4f8e('0x18')],_0x77417=_0x3af2b4[_0x4f8e('0x19')],_0x6473d6=_0x3af2b4[_0x4f8e('0x19')]+_0x3af2b4['limit'],_0x4e0a96;if(_0x6473d6>=_0x53aaba){_0x6473d6=_0x53aaba;_0x4e0a96=0xc8;}else{_0x4e0a96=0xce;}_0x40efcc[_0x4f8e('0x16')](_0x4e0a96);return _0x40efcc['set']('Content-Range',_0x77417+'-'+_0x6473d6+'/'+_0x53aaba)[_0x4f8e('0x1a')](_0x123a40);}return null;};}function patchUpdates(_0x373fa6){return function(_0x21ee86){try{jsonpatch[_0x4f8e('0x1b')](_0x21ee86,_0x373fa6,!![]);}catch(_0x56280b){return BPromise[_0x4f8e('0x1c')](_0x56280b);}return _0x21ee86[_0x4f8e('0x1d')]();};}function saveUpdates(_0x2f877e,_0x3f0b54){return function(_0x1c972a){if(_0x1c972a){return _0x1c972a[_0x4f8e('0x1e')](_0x2f877e)['then'](function(_0x14060c){return _0x14060c;});}return null;};}function removeEntity(_0xf272ed,_0x2125c4){return function(_0x292feb){if(_0x292feb){return _0x292feb[_0x4f8e('0x1f')]()[_0x4f8e('0x20')](function(){var _0x5279e4=_0x292feb[_0x4f8e('0x21')]({'plain':!![]});var _0x39d99e='Templates';return db[_0x4f8e('0x22')][_0x4f8e('0x1f')]({'where':{'type':_0x39d99e,'resourceId':_0x5279e4['id']}})['then'](function(){return _0x292feb;});})[_0x4f8e('0x20')](function(){_0xf272ed['status'](0xcc)[_0x4f8e('0x17')]();});}};}function handleEntityNotFound(_0x10b151,_0x301b91){return function(_0x4436d8){if(!_0x4436d8){_0x10b151[_0x4f8e('0x15')](0x194);}return _0x4436d8;};}function handleError(_0x5283bd,_0x339fe4){_0x339fe4=_0x339fe4||0x1f4;return function(_0x194dd1){logger['error'](_0x194dd1['stack']);if(_0x194dd1[_0x4f8e('0x23')]){delete _0x194dd1[_0x4f8e('0x23')];}_0x5283bd[_0x4f8e('0x16')](_0x339fe4)['send'](_0x194dd1);};}exports['index']=function(_0x4e5f1f,_0x7b40cc){var _0x4c0fa1={},_0x50fc1b={},_0x31a2b5={'count':0x0,'rows':[]};var _0x46738f=_[_0x4f8e('0x24')](db[_0x4f8e('0x25')][_0x4f8e('0x26')],function(_0x42a820){return{'name':_0x42a820[_0x4f8e('0x27')],'type':_0x42a820['type'][_0x4f8e('0x28')]};});_0x50fc1b[_0x4f8e('0x29')]=_[_0x4f8e('0x24')](_0x46738f,'name');_0x50fc1b[_0x4f8e('0x2a')]=_[_0x4f8e('0x2b')](_0x4e5f1f[_0x4f8e('0x2a')]);_0x50fc1b[_0x4f8e('0x2c')]=_['intersection'](_0x50fc1b[_0x4f8e('0x29')],_0x50fc1b[_0x4f8e('0x2a')]);_0x4c0fa1[_0x4f8e('0x2d')]=_[_0x4f8e('0x2e')](_0x50fc1b[_0x4f8e('0x29')],qs[_0x4f8e('0x2f')](_0x4e5f1f[_0x4f8e('0x2a')][_0x4f8e('0x2f')]));_0x4c0fa1[_0x4f8e('0x2d')]=_0x4c0fa1[_0x4f8e('0x2d')][_0x4f8e('0x30')]?_0x4c0fa1[_0x4f8e('0x2d')]:_0x50fc1b[_0x4f8e('0x29')];if(!_0x4e5f1f[_0x4f8e('0x2a')][_0x4f8e('0x31')]('nolimit')){_0x4c0fa1[_0x4f8e('0x32')]=qs[_0x4f8e('0x32')](_0x4e5f1f[_0x4f8e('0x2a')][_0x4f8e('0x32')]);_0x4c0fa1[_0x4f8e('0x19')]=qs['offset'](_0x4e5f1f['query']['offset']);}_0x4c0fa1['order']=qs[_0x4f8e('0x33')](_0x4e5f1f[_0x4f8e('0x2a')][_0x4f8e('0x33')]);_0x4c0fa1[_0x4f8e('0x34')]=qs[_0x4f8e('0x2c')](_['pick'](_0x4e5f1f['query'],_0x50fc1b['filters']),_0x46738f);if(_0x4e5f1f['query'][_0x4f8e('0x35')]){_0x4c0fa1[_0x4f8e('0x34')]=_[_0x4f8e('0x36')](_0x4c0fa1['where'],{'$or':_['map'](_0x46738f,function(_0x40cb7d){if(_0x40cb7d['type']!==_0x4f8e('0x37')){var _0x1bf5b5={};_0x1bf5b5[_0x40cb7d[_0x4f8e('0x23')]]={'$like':'%'+_0x4e5f1f[_0x4f8e('0x2a')][_0x4f8e('0x35')]+'%'};return _0x1bf5b5;}})});}_0x4c0fa1=_[_0x4f8e('0x36')]({},_0x4c0fa1,_0x4e5f1f[_0x4f8e('0x38')]);var _0x1575b3={'where':_0x4c0fa1['where']};return db[_0x4f8e('0x25')][_0x4f8e('0x18')](_0x1575b3)[_0x4f8e('0x20')](function(_0x126828){_0x31a2b5[_0x4f8e('0x18')]=_0x126828;if(_0x4e5f1f['query'][_0x4f8e('0x39')]){_0x4c0fa1[_0x4f8e('0x3a')]=[{'all':!![]}];}return db[_0x4f8e('0x25')][_0x4f8e('0x3b')](_0x4c0fa1);})['then'](function(_0xbda8a3){_0x31a2b5['rows']=_0xbda8a3;return _0x31a2b5;})[_0x4f8e('0x20')](respondWithFilteredResult(_0x7b40cc,_0x4c0fa1))[_0x4f8e('0x3c')](handleError(_0x7b40cc,null));};exports[_0x4f8e('0x3d')]=function(_0x34dfb5,_0x277149){var _0x3b0500={'raw':!![],'where':{'id':_0x34dfb5['params']['id']}},_0x35ff54={};_0x35ff54[_0x4f8e('0x29')]=_[_0x4f8e('0x2b')](db[_0x4f8e('0x25')][_0x4f8e('0x26')]);_0x35ff54['query']=_[_0x4f8e('0x2b')](_0x34dfb5[_0x4f8e('0x2a')]);_0x35ff54[_0x4f8e('0x2c')]=_[_0x4f8e('0x2e')](_0x35ff54['model'],_0x35ff54[_0x4f8e('0x2a')]);_0x3b0500[_0x4f8e('0x2d')]=_[_0x4f8e('0x2e')](_0x35ff54['model'],qs[_0x4f8e('0x2f')](_0x34dfb5[_0x4f8e('0x2a')][_0x4f8e('0x2f')]));_0x3b0500[_0x4f8e('0x2d')]=_0x3b0500[_0x4f8e('0x2d')][_0x4f8e('0x30')]?_0x3b0500[_0x4f8e('0x2d')]:_0x35ff54[_0x4f8e('0x29')];if(_0x34dfb5['query'][_0x4f8e('0x39')]){_0x3b0500[_0x4f8e('0x3a')]=[{'all':!![]}];}_0x3b0500=_[_0x4f8e('0x36')]({},_0x3b0500,_0x34dfb5[_0x4f8e('0x38')]);return db[_0x4f8e('0x25')]['find'](_0x3b0500)['then'](handleEntityNotFound(_0x277149,null))['then'](respondWithResult(_0x277149,null))[_0x4f8e('0x3c')](handleError(_0x277149,null));};exports[_0x4f8e('0x3e')]=function(_0x46159f,_0x392b1f){return db[_0x4f8e('0x25')]['create'](_0x46159f['body'],{})[_0x4f8e('0x20')](function(_0x2dac5f){var _0x19d573=_0x46159f[_0x4f8e('0x3f')][_0x4f8e('0x21')]({'plain':!![]});if(!_0x19d573)throw new Error(_0x4f8e('0x40'));if(_0x19d573[_0x4f8e('0x41')]===_0x4f8e('0x3f')){var _0x4e50cd=_0x2dac5f[_0x4f8e('0x21')]({'plain':!![]});var _0x2a5382=_0x4f8e('0x42');return db[_0x4f8e('0x43')]['find']({'where':{'name':_0x2a5382,'userProfileId':_0x19d573[_0x4f8e('0x44')]},'raw':!![]})[_0x4f8e('0x20')](function(_0x1ea2fa){if(_0x1ea2fa&&_0x1ea2fa[_0x4f8e('0x45')]===0x0){return db[_0x4f8e('0x22')][_0x4f8e('0x3e')]({'name':_0x4e50cd[_0x4f8e('0x23')],'resourceId':_0x4e50cd['id'],'type':_0x1ea2fa[_0x4f8e('0x23')],'sectionId':_0x1ea2fa['id']},{})[_0x4f8e('0x20')](function(){return _0x2dac5f;});}else{return _0x2dac5f;}})[_0x4f8e('0x3c')](function(_0x16884c){logger['error'](_0x4f8e('0x46'),_0x16884c);throw _0x16884c;});}return _0x2dac5f;})[_0x4f8e('0x20')](respondWithResult(_0x392b1f,0xc9))[_0x4f8e('0x3c')](handleError(_0x392b1f,null));};exports[_0x4f8e('0x1e')]=function(_0xf1ef29,_0x7b019){if(_0xf1ef29[_0x4f8e('0x47')]['id']){delete _0xf1ef29[_0x4f8e('0x47')]['id'];}return db[_0x4f8e('0x25')][_0x4f8e('0x48')]({'where':{'id':_0xf1ef29['params']['id']}})[_0x4f8e('0x20')](handleEntityNotFound(_0x7b019,null))['then'](saveUpdates(_0xf1ef29['body'],null))[_0x4f8e('0x20')](respondWithResult(_0x7b019,null))[_0x4f8e('0x3c')](handleError(_0x7b019,null));};exports[_0x4f8e('0x1f')]=function(_0x2ff05e,_0x31cba5){return db['Template'][_0x4f8e('0x48')]({'where':{'id':_0x2ff05e[_0x4f8e('0x49')]['id']}})[_0x4f8e('0x20')](handleEntityNotFound(_0x31cba5,null))[_0x4f8e('0x20')](removeEntity(_0x31cba5,null))['catch'](handleError(_0x31cba5,null));}; \ No newline at end of file +var _0x2e57=['role','get','find','userProfileId','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','json','offset','set','apply','reject','save','update','then','destroy','Templates','UserProfileResource','end','sendStatus','error','stack','index','map','rawAttributes','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','where','filters','pick','filter','merge','VIRTUAL','Template','count','includeAll','include','findAll','rows','show','params','keys','options','catch','create','body','user'];(function(_0x3780ed,_0xc188fb){var _0x7b2509=function(_0x2a52c5){while(--_0x2a52c5){_0x3780ed['push'](_0x3780ed['shift']());}};_0x7b2509(++_0xc188fb);}(_0x2e57,0xa4));var _0x72e5=function(_0x2b65c1,_0x20fa1c){_0x2b65c1=_0x2b65c1-0x0;var _0xfaff2d=_0x2e57[_0x2b65c1];return _0xfaff2d;};'use strict';var pdf=require(_0x72e5('0x0'));var emlformat=require(_0x72e5('0x1'));var rimraf=require(_0x72e5('0x2'));var zipdir=require(_0x72e5('0x3'));var jsonpatch=require(_0x72e5('0x4'));var rp=require('request-promise');var moment=require(_0x72e5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x72e5('0x6'));var util=require(_0x72e5('0x7'));var path=require(_0x72e5('0x8'));var sox=require('sox');var csv=require(_0x72e5('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x72e5('0xa'));var squel=require(_0x72e5('0xb'));var crypto=require(_0x72e5('0xc'));var jsforce=require(_0x72e5('0xd'));var deskjs=require(_0x72e5('0xe'));var toCsv=require(_0x72e5('0x9'));var querystring=require('querystring');var Papa=require(_0x72e5('0xf'));var Redis=require(_0x72e5('0x10'));var authService=require(_0x72e5('0x11'));var qs=require(_0x72e5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72e5('0x13'));var logger=require(_0x72e5('0x14'))(_0x72e5('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x72e5('0x16'))['db'];function respondWithStatusCode(_0x929fb6,_0xca2c87){_0xca2c87=_0xca2c87||0xcc;return function(_0xff7326){if(_0xff7326){return _0x929fb6['sendStatus'](_0xca2c87);}return _0x929fb6[_0x72e5('0x17')](_0xca2c87)['end']();};}function respondWithResult(_0x94082c,_0xeae66e){_0xeae66e=_0xeae66e||0xc8;return function(_0x56379b){if(_0x56379b){return _0x94082c['status'](_0xeae66e)[_0x72e5('0x18')](_0x56379b);}};}function respondWithFilteredResult(_0x3955ee,_0x5bf697){return function(_0x55ee14){if(_0x55ee14){var _0x37b38f=_0x55ee14['count'],_0x1296dd=_0x5bf697[_0x72e5('0x19')],_0x55cb1d=_0x5bf697[_0x72e5('0x19')]+_0x5bf697['limit'],_0x405847;if(_0x55cb1d>=_0x37b38f){_0x55cb1d=_0x37b38f;_0x405847=0xc8;}else{_0x405847=0xce;}_0x3955ee[_0x72e5('0x17')](_0x405847);return _0x3955ee[_0x72e5('0x1a')]('Content-Range',_0x1296dd+'-'+_0x55cb1d+'/'+_0x37b38f)[_0x72e5('0x18')](_0x55ee14);}return null;};}function patchUpdates(_0x48f609){return function(_0x2b91d5){try{jsonpatch[_0x72e5('0x1b')](_0x2b91d5,_0x48f609,!![]);}catch(_0x1c5557){return BPromise[_0x72e5('0x1c')](_0x1c5557);}return _0x2b91d5[_0x72e5('0x1d')]();};}function saveUpdates(_0x5da1c,_0x368e13){return function(_0x2b7b4a){if(_0x2b7b4a){return _0x2b7b4a[_0x72e5('0x1e')](_0x5da1c)[_0x72e5('0x1f')](function(_0x36ce74){return _0x36ce74;});}return null;};}function removeEntity(_0x2a4add,_0x106e0f){return function(_0x1d93ff){if(_0x1d93ff){return _0x1d93ff[_0x72e5('0x20')]()[_0x72e5('0x1f')](function(){var _0x3643e7=_0x1d93ff['get']({'plain':!![]});var _0x5ccd8b=_0x72e5('0x21');return db[_0x72e5('0x22')][_0x72e5('0x20')]({'where':{'type':_0x5ccd8b,'resourceId':_0x3643e7['id']}})[_0x72e5('0x1f')](function(){return _0x1d93ff;});})[_0x72e5('0x1f')](function(){_0x2a4add['status'](0xcc)[_0x72e5('0x23')]();});}};}function handleEntityNotFound(_0xb0557f,_0x2a57b6){return function(_0x46e624){if(!_0x46e624){_0xb0557f[_0x72e5('0x24')](0x194);}return _0x46e624;};}function handleError(_0x264308,_0x36945f){_0x36945f=_0x36945f||0x1f4;return function(_0x1abc3e){logger[_0x72e5('0x25')](_0x1abc3e[_0x72e5('0x26')]);if(_0x1abc3e['name']){delete _0x1abc3e['name'];}_0x264308['status'](_0x36945f)['send'](_0x1abc3e);};}exports[_0x72e5('0x27')]=function(_0x210e36,_0x1842a3){var _0xb85de1={},_0x26d7d4={},_0x4bdd86={'count':0x0,'rows':[]};var _0x4decc8=_[_0x72e5('0x28')](db['Template'][_0x72e5('0x29')],function(_0x4e89bf){return{'name':_0x4e89bf['fieldName'],'type':_0x4e89bf[_0x72e5('0x2a')][_0x72e5('0x2b')]};});_0x26d7d4[_0x72e5('0x2c')]=_['map'](_0x4decc8,'name');_0x26d7d4[_0x72e5('0x2d')]=_['keys'](_0x210e36[_0x72e5('0x2d')]);_0x26d7d4['filters']=_[_0x72e5('0x2e')](_0x26d7d4['model'],_0x26d7d4[_0x72e5('0x2d')]);_0xb85de1['attributes']=_[_0x72e5('0x2e')](_0x26d7d4[_0x72e5('0x2c')],qs[_0x72e5('0x2f')](_0x210e36[_0x72e5('0x2d')][_0x72e5('0x2f')]));_0xb85de1[_0x72e5('0x30')]=_0xb85de1['attributes']['length']?_0xb85de1['attributes']:_0x26d7d4[_0x72e5('0x2c')];if(!_0x210e36[_0x72e5('0x2d')][_0x72e5('0x31')](_0x72e5('0x32'))){_0xb85de1[_0x72e5('0x33')]=qs[_0x72e5('0x33')](_0x210e36['query'][_0x72e5('0x33')]);_0xb85de1['offset']=qs['offset'](_0x210e36['query'][_0x72e5('0x19')]);}_0xb85de1[_0x72e5('0x34')]=qs['sort'](_0x210e36[_0x72e5('0x2d')]['sort']);_0xb85de1[_0x72e5('0x35')]=qs[_0x72e5('0x36')](_[_0x72e5('0x37')](_0x210e36[_0x72e5('0x2d')],_0x26d7d4['filters']),_0x4decc8);if(_0x210e36['query'][_0x72e5('0x38')]){_0xb85de1['where']=_[_0x72e5('0x39')](_0xb85de1[_0x72e5('0x35')],{'$or':_['map'](_0x4decc8,function(_0x457359){if(_0x457359[_0x72e5('0x2a')]!==_0x72e5('0x3a')){var _0x227292={};_0x227292[_0x457359['name']]={'$like':'%'+_0x210e36[_0x72e5('0x2d')]['filter']+'%'};return _0x227292;}})});}_0xb85de1=_[_0x72e5('0x39')]({},_0xb85de1,_0x210e36['options']);var _0x2942af={'where':_0xb85de1[_0x72e5('0x35')]};return db[_0x72e5('0x3b')][_0x72e5('0x3c')](_0x2942af)[_0x72e5('0x1f')](function(_0x46a259){_0x4bdd86[_0x72e5('0x3c')]=_0x46a259;if(_0x210e36['query'][_0x72e5('0x3d')]){_0xb85de1[_0x72e5('0x3e')]=[{'all':!![]}];}return db['Template'][_0x72e5('0x3f')](_0xb85de1);})[_0x72e5('0x1f')](function(_0x53dac3){_0x4bdd86[_0x72e5('0x40')]=_0x53dac3;return _0x4bdd86;})['then'](respondWithFilteredResult(_0x1842a3,_0xb85de1))['catch'](handleError(_0x1842a3,null));};exports[_0x72e5('0x41')]=function(_0x5a0fba,_0x1cb461){var _0x5e4ede={'raw':!![],'where':{'id':_0x5a0fba[_0x72e5('0x42')]['id']}},_0x48e97d={};_0x48e97d['model']=_['keys'](db['Template'][_0x72e5('0x29')]);_0x48e97d['query']=_[_0x72e5('0x43')](_0x5a0fba[_0x72e5('0x2d')]);_0x48e97d[_0x72e5('0x36')]=_[_0x72e5('0x2e')](_0x48e97d[_0x72e5('0x2c')],_0x48e97d[_0x72e5('0x2d')]);_0x5e4ede[_0x72e5('0x30')]=_[_0x72e5('0x2e')](_0x48e97d[_0x72e5('0x2c')],qs[_0x72e5('0x2f')](_0x5a0fba[_0x72e5('0x2d')][_0x72e5('0x2f')]));_0x5e4ede[_0x72e5('0x30')]=_0x5e4ede['attributes']['length']?_0x5e4ede[_0x72e5('0x30')]:_0x48e97d[_0x72e5('0x2c')];if(_0x5a0fba[_0x72e5('0x2d')]['includeAll']){_0x5e4ede[_0x72e5('0x3e')]=[{'all':!![]}];}_0x5e4ede=_[_0x72e5('0x39')]({},_0x5e4ede,_0x5a0fba[_0x72e5('0x44')]);return db['Template']['find'](_0x5e4ede)['then'](handleEntityNotFound(_0x1cb461,null))['then'](respondWithResult(_0x1cb461,null))[_0x72e5('0x45')](handleError(_0x1cb461,null));};exports['create']=function(_0x473ea9,_0x211392){return db['Template'][_0x72e5('0x46')](_0x473ea9[_0x72e5('0x47')],{})['then'](function(_0x26fa87){var _0x3b1023=_0x473ea9[_0x72e5('0x48')]['get']({'plain':!![]});if(!_0x3b1023)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b1023[_0x72e5('0x49')]==='user'){var _0x29a31d=_0x26fa87[_0x72e5('0x4a')]({'plain':!![]});var _0x29228e='Templates';return db['UserProfileSection'][_0x72e5('0x4b')]({'where':{'name':_0x29228e,'userProfileId':_0x3b1023[_0x72e5('0x4c')]},'raw':!![]})['then'](function(_0x6fdc90){if(_0x6fdc90&&_0x6fdc90['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x29a31d[_0x72e5('0x4d')],'resourceId':_0x29a31d['id'],'type':_0x6fdc90[_0x72e5('0x4d')],'sectionId':_0x6fdc90['id']},{})[_0x72e5('0x1f')](function(){return _0x26fa87;});}else{return _0x26fa87;}})[_0x72e5('0x45')](function(_0x599fb7){logger[_0x72e5('0x25')](_0x72e5('0x4e'),_0x599fb7);throw _0x599fb7;});}return _0x26fa87;})[_0x72e5('0x1f')](respondWithResult(_0x211392,0xc9))[_0x72e5('0x45')](handleError(_0x211392,null));};exports[_0x72e5('0x1e')]=function(_0x347d6b,_0x1c6948){if(_0x347d6b[_0x72e5('0x47')]['id']){delete _0x347d6b[_0x72e5('0x47')]['id'];}return db[_0x72e5('0x3b')][_0x72e5('0x4b')]({'where':{'id':_0x347d6b[_0x72e5('0x42')]['id']}})[_0x72e5('0x1f')](handleEntityNotFound(_0x1c6948,null))[_0x72e5('0x1f')](saveUpdates(_0x347d6b['body'],null))[_0x72e5('0x1f')](respondWithResult(_0x1c6948,null))[_0x72e5('0x45')](handleError(_0x1c6948,null));};exports[_0x72e5('0x20')]=function(_0x6fffb5,_0x4f970b){return db['Template'][_0x72e5('0x4b')]({'where':{'id':_0x6fffb5[_0x72e5('0x42')]['id']}})[_0x72e5('0x1f')](handleEntityNotFound(_0x4f970b,null))[_0x72e5('0x1f')](removeEntity(_0x4f970b,null))['catch'](handleError(_0x4f970b,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index c55c5b7..03d6ef5 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 _0x6b5f=['bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','../../config/logger','api','moment'];(function(_0x2f370d,_0x11647b){var _0x656fb6=function(_0x4d125b){while(--_0x4d125b){_0x2f370d['push'](_0x2f370d['shift']());}};_0x656fb6(++_0x11647b);}(_0x6b5f,0x13e));var _0xf6b5=function(_0x4e1737,_0x2cfdb3){_0x4e1737=_0x4e1737-0x0;var _0x1137c7=_0x6b5f[_0x4e1737];return _0x1137c7;};'use strict';var _=require(_0xf6b5('0x0'));var util=require('util');var logger=require(_0xf6b5('0x1'))(_0xf6b5('0x2'));var moment=require(_0xf6b5('0x3'));var BPromise=require(_0xf6b5('0x4'));var rp=require(_0xf6b5('0x5'));var fs=require('fs');var path=require(_0xf6b5('0x6'));var rimraf=require(_0xf6b5('0x7'));var config=require(_0xf6b5('0x8'));var attributes=require(_0xf6b5('0x9'));module[_0xf6b5('0xa')]=function(_0x1ffc83,_0x19769e){return _0x1ffc83[_0xf6b5('0xb')](_0xf6b5('0xc'),attributes,{'tableName':_0xf6b5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x697f=['../../config/logger','api','moment','bluebird','./template.attributes','exports','define','Template','tools_templates','lodash','util'];(function(_0x2d7d30,_0x56d3dc){var _0x2c416a=function(_0x3940b7){while(--_0x3940b7){_0x2d7d30['push'](_0x2d7d30['shift']());}};_0x2c416a(++_0x56d3dc);}(_0x697f,0x13d));var _0xf697=function(_0x43b00f,_0x30f616){_0x43b00f=_0x43b00f-0x0;var _0x3f7506=_0x697f[_0x43b00f];return _0x3f7506;};'use strict';var _=require(_0xf697('0x0'));var util=require(_0xf697('0x1'));var logger=require(_0xf697('0x2'))(_0xf697('0x3'));var moment=require(_0xf697('0x4'));var BPromise=require(_0xf697('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf697('0x6'));module[_0xf697('0x7')]=function(_0x3448b4,_0x492116){return _0x3448b4[_0xf697('0x8')](_0xf697('0x9'),attributes,{'tableName':_0xf697('0xa'),'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 3487e0a..119c203 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 _0x3e6e=['options','raw','where','attributes','include','model','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then','info','Template,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','GetTemplate','Template','findAll'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3e6e,0x1e2));var _0xe3e6=function(_0x4145c4,_0x17ac5b){_0x4145c4=_0x4145c4-0x0;var _0xe56287=_0x3e6e[_0x4145c4];return _0xe56287;};'use strict';var _=require(_0xe3e6('0x0'));var util=require('util');var moment=require(_0xe3e6('0x1'));var BPromise=require(_0xe3e6('0x2'));var rs=require(_0xe3e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe3e6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe3e6('0x5'))(_0xe3e6('0x6'));var config=require('../../config/environment');var jayson=require(_0xe3e6('0x7'));var client=jayson['client'][_0xe3e6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x19c54a,_0x4fa86d,_0x1fc409){return new BPromise(function(_0x4fbbbc,_0x32d683){return client['request'](_0x19c54a,_0x1fc409)[_0xe3e6('0x9')](function(_0x2bbc79){logger[_0xe3e6('0xa')](_0xe3e6('0xb'),_0x4fa86d,'request\x20sent');logger[_0xe3e6('0xc')]('Template,\x20%s,\x20%s,\x20%s',_0x4fa86d,_0xe3e6('0xd'),JSON[_0xe3e6('0xe')](_0x2bbc79));if(_0x2bbc79[_0xe3e6('0xf')]){if(_0x2bbc79[_0xe3e6('0xf')][_0xe3e6('0x10')]===0x1f4){logger[_0xe3e6('0xf')]('Template,\x20%s,\x20%s',_0x4fa86d,_0x2bbc79[_0xe3e6('0xf')][_0xe3e6('0x11')]);return _0x32d683(_0x2bbc79['error'][_0xe3e6('0x11')]);}logger['error'](_0xe3e6('0xb'),_0x4fa86d,_0x2bbc79[_0xe3e6('0xf')][_0xe3e6('0x11')]);return _0x4fbbbc(_0x2bbc79[_0xe3e6('0xf')][_0xe3e6('0x11')]);}else{logger[_0xe3e6('0xa')](_0xe3e6('0xb'),_0x4fa86d,_0xe3e6('0xd'));_0x4fbbbc(_0x2bbc79['result']['message']);}})[_0xe3e6('0x12')](function(_0x4cd448){logger['error']('Template,\x20%s,\x20%s',_0x4fa86d,_0x4cd448);_0x32d683(_0x4cd448);});});}exports[_0xe3e6('0x13')]=function(_0x5f27b7){var _0x24e01b=this;return new Promise(function(_0x3a99fa,_0x3714bd){return db[_0xe3e6('0x14')][_0xe3e6('0x15')]({'raw':_0x5f27b7['options']?_0x5f27b7[_0xe3e6('0x16')][_0xe3e6('0x17')]===undefined?!![]:![]:!![],'where':_0x5f27b7[_0xe3e6('0x16')]?_0x5f27b7[_0xe3e6('0x16')][_0xe3e6('0x18')]||null:null,'attributes':_0x5f27b7['options']?_0x5f27b7[_0xe3e6('0x16')][_0xe3e6('0x19')]||null:null,'limit':_0x5f27b7[_0xe3e6('0x16')]?_0x5f27b7[_0xe3e6('0x16')]['limit']||null:null,'include':_0x5f27b7['options']?_0x5f27b7[_0xe3e6('0x16')][_0xe3e6('0x1a')]?_['map'](_0x5f27b7[_0xe3e6('0x16')][_0xe3e6('0x1a')],function(_0x2a7cbd){return{'model':db[_0x2a7cbd[_0xe3e6('0x1b')]],'as':_0x2a7cbd['as'],'attributes':_0x2a7cbd['attributes'],'include':_0x2a7cbd['include']?_['map'](_0x2a7cbd[_0xe3e6('0x1a')],function(_0x25907a){return{'model':db[_0x25907a[_0xe3e6('0x1b')]],'as':_0x25907a['as'],'attributes':_0x25907a[_0xe3e6('0x19')],'include':_0x25907a['include']?_['map'](_0x25907a[_0xe3e6('0x1a')],function(_0x5e2515){return{'model':db[_0x5e2515[_0xe3e6('0x1b')]],'as':_0x5e2515['as'],'attributes':_0x5e2515['attributes']};}):[]};}):[]};}):[]:[]})[_0xe3e6('0x9')](function(_0x3aca75){logger[_0xe3e6('0xa')](_0xe3e6('0x13'),_0x5f27b7);logger['debug']('GetTemplate',_0x5f27b7,JSON[_0xe3e6('0xe')](_0x3aca75));_0x3a99fa(_0x3aca75);})[_0xe3e6('0x12')](function(_0x521426){logger[_0xe3e6('0xf')]('GetTemplate',_0x521426['message'],_0x5f27b7);_0x3714bd(_0x24e01b[_0xe3e6('0xf')](0x1f4,_0x521426[_0xe3e6('0x11')]));});});}; \ No newline at end of file +var _0x5576=['catch','GetTemplate','Template','findAll','options','attributes','limit','include','map','model','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','stringify','error','code','Template,\x20%s,\x20%s','message','result'];(function(_0x53f717,_0x23c0bf){var _0xdf22f5=function(_0x12c5ca){while(--_0x12c5ca){_0x53f717['push'](_0x53f717['shift']());}};_0xdf22f5(++_0x23c0bf);}(_0x5576,0x1db));var _0x6557=function(_0x126f47,_0x2199e9){_0x126f47=_0x126f47-0x0;var _0x49508a=_0x5576[_0x126f47];return _0x49508a;};'use strict';var _=require(_0x6557('0x0'));var util=require('util');var moment=require(_0x6557('0x1'));var BPromise=require('bluebird');var rs=require(_0x6557('0x2'));var fs=require('fs');var Redis=require(_0x6557('0x3'));var db=require(_0x6557('0x4'))['db'];var utils=require(_0x6557('0x5'));var logger=require(_0x6557('0x6'))(_0x6557('0x7'));var config=require(_0x6557('0x8'));var jayson=require(_0x6557('0x9'));var client=jayson['client'][_0x6557('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bd4cb,_0x1db93e,_0x3739b0){return new BPromise(function(_0x2d4267,_0x169cce){return client['request'](_0x5bd4cb,_0x3739b0)[_0x6557('0xb')](function(_0x372a42){logger[_0x6557('0xc')]('Template,\x20%s,\x20%s',_0x1db93e,_0x6557('0xd'));logger[_0x6557('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x1db93e,'request\x20sent',JSON[_0x6557('0xf')](_0x372a42));if(_0x372a42['error']){if(_0x372a42[_0x6557('0x10')][_0x6557('0x11')]===0x1f4){logger['error'](_0x6557('0x12'),_0x1db93e,_0x372a42[_0x6557('0x10')][_0x6557('0x13')]);return _0x169cce(_0x372a42[_0x6557('0x10')][_0x6557('0x13')]);}logger[_0x6557('0x10')](_0x6557('0x12'),_0x1db93e,_0x372a42[_0x6557('0x10')][_0x6557('0x13')]);return _0x2d4267(_0x372a42[_0x6557('0x10')]['message']);}else{logger[_0x6557('0xc')](_0x6557('0x12'),_0x1db93e,_0x6557('0xd'));_0x2d4267(_0x372a42[_0x6557('0x14')]['message']);}})[_0x6557('0x15')](function(_0x26bc76){logger[_0x6557('0x10')](_0x6557('0x12'),_0x1db93e,_0x26bc76);_0x169cce(_0x26bc76);});});}exports[_0x6557('0x16')]=function(_0x49da44){var _0x5a1561=this;return new Promise(function(_0x5620df,_0x3881fe){return db[_0x6557('0x17')][_0x6557('0x18')]({'raw':_0x49da44[_0x6557('0x19')]?_0x49da44[_0x6557('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x49da44[_0x6557('0x19')]?_0x49da44['options']['where']||null:null,'attributes':_0x49da44['options']?_0x49da44[_0x6557('0x19')][_0x6557('0x1a')]||null:null,'limit':_0x49da44[_0x6557('0x19')]?_0x49da44[_0x6557('0x19')][_0x6557('0x1b')]||null:null,'include':_0x49da44['options']?_0x49da44[_0x6557('0x19')][_0x6557('0x1c')]?_[_0x6557('0x1d')](_0x49da44[_0x6557('0x19')][_0x6557('0x1c')],function(_0x3bf88a){return{'model':db[_0x3bf88a[_0x6557('0x1e')]],'as':_0x3bf88a['as'],'attributes':_0x3bf88a['attributes'],'include':_0x3bf88a['include']?_[_0x6557('0x1d')](_0x3bf88a[_0x6557('0x1c')],function(_0x42f1a4){return{'model':db[_0x42f1a4['model']],'as':_0x42f1a4['as'],'attributes':_0x42f1a4['attributes'],'include':_0x42f1a4[_0x6557('0x1c')]?_[_0x6557('0x1d')](_0x42f1a4[_0x6557('0x1c')],function(_0x546a22){return{'model':db[_0x546a22[_0x6557('0x1e')]],'as':_0x546a22['as'],'attributes':_0x546a22[_0x6557('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6557('0xb')](function(_0x30958b){logger[_0x6557('0xc')](_0x6557('0x16'),_0x49da44);logger[_0x6557('0xe')](_0x6557('0x16'),_0x49da44,JSON[_0x6557('0xf')](_0x30958b));_0x5620df(_0x30958b);})[_0x6557('0x15')](function(_0x300d8e){logger[_0x6557('0x10')](_0x6557('0x16'),_0x300d8e['message'],_0x49da44);_0x3881fe(_0x5a1561[_0x6557('0x10')](0x1f4,_0x300d8e[_0x6557('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 0737dd5..bfb6dac 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 _0x75b9=['delete','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','./trigger.controller','get','isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','getActions','create','post','addAllCondition','/:id/any_conditions','addAction','put','update'];(function(_0x139332,_0x439e5f){var _0x208fd9=function(_0x7e3bd3){while(--_0x7e3bd3){_0x139332['push'](_0x139332['shift']());}};_0x208fd9(++_0x439e5f);}(_0x75b9,0xcb));var _0x975b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x75b9[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0x975b('0x0'));var util=require(_0x975b('0x1'));var path=require(_0x975b('0x2'));var timeout=require(_0x975b('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x975b('0x4'));var config=require('../../config/environment');var controller=require(_0x975b('0x5'));router[_0x975b('0x6')]('/',auth[_0x975b('0x7')](),controller['index']);router[_0x975b('0x6')](_0x975b('0x8'),auth[_0x975b('0x7')](),controller[_0x975b('0x9')]);router[_0x975b('0x6')](_0x975b('0xa'),auth[_0x975b('0x7')](),controller[_0x975b('0xb')]);router['get']('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x975b('0xc')]);router['get'](_0x975b('0xd'),auth[_0x975b('0x7')](),controller[_0x975b('0xe')]);router['post']('/',auth[_0x975b('0x7')](),controller[_0x975b('0xf')]);router[_0x975b('0x10')]('/:id/all_conditions',auth[_0x975b('0x7')](),controller[_0x975b('0x11')]);router[_0x975b('0x10')](_0x975b('0x12'),auth[_0x975b('0x7')](),controller['addAnyCondition']);router['post'](_0x975b('0xd'),auth[_0x975b('0x7')](),controller[_0x975b('0x13')]);router[_0x975b('0x14')]('/:id',auth[_0x975b('0x7')](),controller[_0x975b('0x15')]);router[_0x975b('0x16')](_0x975b('0x8'),auth[_0x975b('0x7')](),controller[_0x975b('0x17')]);module[_0x975b('0x18')]=router; \ No newline at end of file +var _0xd190=['/:id','destroy','multer','util','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','create','addAllCondition','addAnyCondition','addAction','put'];(function(_0x597980,_0x2722d9){var _0x5957cf=function(_0x4228a1){while(--_0x4228a1){_0x597980['push'](_0x597980['shift']());}};_0x5957cf(++_0x2722d9);}(_0xd190,0x1ba));var _0x0d19=function(_0x5da93d,_0x3ba8f2){_0x5da93d=_0x5da93d-0x0;var _0x3c5a1f=_0xd190[_0x5da93d];return _0x3c5a1f;};'use strict';var multer=require(_0x0d19('0x0'));var util=require(_0x0d19('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0d19('0x2'));var router=express[_0x0d19('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0d19('0x4'));var config=require(_0x0d19('0x5'));var controller=require('./trigger.controller');router[_0x0d19('0x6')]('/',auth[_0x0d19('0x7')](),controller[_0x0d19('0x8')]);router[_0x0d19('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0d19('0x6')](_0x0d19('0x9'),auth[_0x0d19('0x7')](),controller[_0x0d19('0xa')]);router[_0x0d19('0x6')](_0x0d19('0xb'),auth[_0x0d19('0x7')](),controller[_0x0d19('0xc')]);router[_0x0d19('0x6')](_0x0d19('0xd'),auth['isAuthenticated'](),controller[_0x0d19('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0d19('0xf')]);router['post'](_0x0d19('0x9'),auth[_0x0d19('0x7')](),controller[_0x0d19('0x10')]);router['post'](_0x0d19('0xb'),auth['isAuthenticated'](),controller[_0x0d19('0x11')]);router['post'](_0x0d19('0xd'),auth[_0x0d19('0x7')](),controller[_0x0d19('0x12')]);router[_0x0d19('0x13')]('/:id',auth[_0x0d19('0x7')](),controller['update']);router['delete'](_0x0d19('0x14'),auth[_0x0d19('0x7')](),controller[_0x0d19('0x15')]);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 0bf6661..804de30 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 _0x0631=['sequelize','STRING','BOOLEAN'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0631,0x96));var _0x1063=function(_0x1d6914,_0x2f6a85){_0x1d6914=_0x1d6914-0x0;var _0x511d10=_0x0631[_0x1d6914];return _0x511d10;};'use strict';var Sequelize=require(_0x1063('0x0'));module['exports']={'name':{'type':Sequelize[_0x1063('0x1')]},'channel':{'type':Sequelize[_0x1063('0x1')]},'description':{'type':Sequelize[_0x1063('0x1')]},'status':{'type':Sequelize[_0x1063('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x6dc2=['exports','STRING','sequelize'];(function(_0x38af48,_0x400460){var _0x445384=function(_0x464435){while(--_0x464435){_0x38af48['push'](_0x38af48['shift']());}};_0x445384(++_0x400460);}(_0x6dc2,0x1dc));var _0x26dc=function(_0x16e540,_0x100577){_0x16e540=_0x16e540-0x0;var _0x18999e=_0x6dc2[_0x16e540];return _0x18999e;};'use strict';var Sequelize=require(_0x26dc('0x0'));module[_0x26dc('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x26dc('0x2')]},'description':{'type':Sequelize[_0x26dc('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 6cb60a9..defca5b 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 _0x5ed3=['find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','Triggers','UserProfileResource','sendStatus','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection'];(function(_0x2744ef,_0xb558b6){var _0x183b28=function(_0x28529d){while(--_0x28529d){_0x2744ef['push'](_0x2744ef['shift']());}};_0x183b28(++_0xb558b6);}(_0x5ed3,0x72));var _0x35ed=function(_0x38fa37,_0x2781a9){_0x38fa37=_0x38fa37-0x0;var _0x2f0dbf=_0x5ed3[_0x38fa37];return _0x2f0dbf;};'use strict';var pdf=require(_0x35ed('0x0'));var emlformat=require(_0x35ed('0x1'));var rimraf=require(_0x35ed('0x2'));var zipdir=require(_0x35ed('0x3'));var jsonpatch=require(_0x35ed('0x4'));var rp=require(_0x35ed('0x5'));var moment=require(_0x35ed('0x6'));var BPromise=require(_0x35ed('0x7'));var Mustache=require(_0x35ed('0x8'));var util=require(_0x35ed('0x9'));var path=require(_0x35ed('0xa'));var sox=require(_0x35ed('0xb'));var csv=require(_0x35ed('0xc'));var ejs=require(_0x35ed('0xd'));var fs=require('fs');var _=require(_0x35ed('0xe'));var squel=require(_0x35ed('0xf'));var crypto=require(_0x35ed('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x35ed('0x11'));var toCsv=require('to-csv');var querystring=require(_0x35ed('0x12'));var Papa=require('papaparse');var Redis=require(_0x35ed('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x35ed('0x14'));var as=require(_0x35ed('0x15'));var hardwareService=require(_0x35ed('0x16'));var logger=require(_0x35ed('0x17'))(_0x35ed('0x18'));var utils=require('../../config/utils');var config=require(_0x35ed('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0e53,_0x4042b0){_0x4042b0=_0x4042b0||0xcc;return function(_0x4a59b7){if(_0x4a59b7){return _0x2a0e53['sendStatus'](_0x4042b0);}return _0x2a0e53[_0x35ed('0x1a')](_0x4042b0)[_0x35ed('0x1b')]();};}function respondWithResult(_0x419c08,_0x58051d){_0x58051d=_0x58051d||0xc8;return function(_0x2e9ed9){if(_0x2e9ed9){return _0x419c08[_0x35ed('0x1a')](_0x58051d)[_0x35ed('0x1c')](_0x2e9ed9);}};}function respondWithFilteredResult(_0x5a0630,_0x45b0f9){return function(_0x303715){if(_0x303715){var _0x5704b8=_0x303715[_0x35ed('0x1d')],_0x1cb7a5=_0x45b0f9['offset'],_0xbbfdd4=_0x45b0f9[_0x35ed('0x1e')]+_0x45b0f9[_0x35ed('0x1f')],_0x4f06f7;if(_0xbbfdd4>=_0x5704b8){_0xbbfdd4=_0x5704b8;_0x4f06f7=0xc8;}else{_0x4f06f7=0xce;}_0x5a0630['status'](_0x4f06f7);return _0x5a0630[_0x35ed('0x20')]('Content-Range',_0x1cb7a5+'-'+_0xbbfdd4+'/'+_0x5704b8)[_0x35ed('0x1c')](_0x303715);}return null;};}function patchUpdates(_0x3fb276){return function(_0x3e0a92){try{jsonpatch[_0x35ed('0x21')](_0x3e0a92,_0x3fb276,!![]);}catch(_0x3d4885){return BPromise[_0x35ed('0x22')](_0x3d4885);}return _0x3e0a92[_0x35ed('0x23')]();};}function saveUpdates(_0x1046dc,_0x18e089){return function(_0x1885f7){if(_0x1885f7){return _0x1885f7['update'](_0x1046dc)[_0x35ed('0x24')](function(_0x54b4d9){return _0x54b4d9;});}return null;};}function removeEntity(_0x1788e3,_0x14f7f2){return function(_0x4695fa){if(_0x4695fa){return _0x4695fa[_0x35ed('0x25')]()[_0x35ed('0x24')](function(){var _0xdb933d=_0x4695fa['get']({'plain':!![]});var _0x1febe2=_0x35ed('0x26');return db[_0x35ed('0x27')][_0x35ed('0x25')]({'where':{'type':_0x1febe2,'resourceId':_0xdb933d['id']}})[_0x35ed('0x24')](function(){return _0x4695fa;});})[_0x35ed('0x24')](function(){_0x1788e3[_0x35ed('0x1a')](0xcc)[_0x35ed('0x1b')]();});}};}function handleEntityNotFound(_0x1b82f5,_0x190acd){return function(_0x42b499){if(!_0x42b499){_0x1b82f5[_0x35ed('0x28')](0x194);}return _0x42b499;};}function handleError(_0x30ced6,_0x15d756){_0x15d756=_0x15d756||0x1f4;return function(_0x51acb7){logger['error'](_0x51acb7['stack']);if(_0x51acb7['name']){delete _0x51acb7[_0x35ed('0x29')];}_0x30ced6[_0x35ed('0x1a')](_0x15d756)[_0x35ed('0x2a')](_0x51acb7);};}exports[_0x35ed('0x2b')]=function(_0x43e6de,_0x4834e2){var _0x5b6d05={},_0x3c0643={},_0x5ed27b={'count':0x0,'rows':[]};var _0x99a02d=_[_0x35ed('0x2c')](db[_0x35ed('0x2d')][_0x35ed('0x2e')],function(_0x2c8ef6){return{'name':_0x2c8ef6[_0x35ed('0x2f')],'type':_0x2c8ef6[_0x35ed('0x30')][_0x35ed('0x31')]};});_0x3c0643[_0x35ed('0x32')]=_[_0x35ed('0x2c')](_0x99a02d,_0x35ed('0x29'));_0x3c0643[_0x35ed('0x33')]=_[_0x35ed('0x34')](_0x43e6de[_0x35ed('0x33')]);_0x3c0643['filters']=_[_0x35ed('0x35')](_0x3c0643[_0x35ed('0x32')],_0x3c0643['query']);_0x5b6d05[_0x35ed('0x36')]=_[_0x35ed('0x35')](_0x3c0643[_0x35ed('0x32')],qs[_0x35ed('0x37')](_0x43e6de[_0x35ed('0x33')][_0x35ed('0x37')]));_0x5b6d05[_0x35ed('0x36')]=_0x5b6d05[_0x35ed('0x36')][_0x35ed('0x38')]?_0x5b6d05[_0x35ed('0x36')]:_0x3c0643[_0x35ed('0x32')];if(!_0x43e6de[_0x35ed('0x33')][_0x35ed('0x39')](_0x35ed('0x3a'))){_0x5b6d05['limit']=qs[_0x35ed('0x1f')](_0x43e6de[_0x35ed('0x33')][_0x35ed('0x1f')]);_0x5b6d05[_0x35ed('0x1e')]=qs[_0x35ed('0x1e')](_0x43e6de['query'][_0x35ed('0x1e')]);}_0x5b6d05[_0x35ed('0x3b')]=qs[_0x35ed('0x3c')](_0x43e6de[_0x35ed('0x33')][_0x35ed('0x3c')]);_0x5b6d05[_0x35ed('0x3d')]=qs['filters'](_[_0x35ed('0x3e')](_0x43e6de[_0x35ed('0x33')],_0x3c0643[_0x35ed('0x3f')]),_0x99a02d);if(_0x43e6de[_0x35ed('0x33')][_0x35ed('0x40')]){_0x5b6d05['where']=_[_0x35ed('0x41')](_0x5b6d05[_0x35ed('0x3d')],{'$or':_['map'](_0x99a02d,function(_0x3dd256){if(_0x3dd256[_0x35ed('0x30')]!=='VIRTUAL'){var _0x5d7c9f={};_0x5d7c9f[_0x3dd256[_0x35ed('0x29')]]={'$like':'%'+_0x43e6de['query'][_0x35ed('0x40')]+'%'};return _0x5d7c9f;}})});}_0x5b6d05=_[_0x35ed('0x41')]({},_0x5b6d05,_0x43e6de[_0x35ed('0x42')]);var _0x3e1302={'where':_0x5b6d05[_0x35ed('0x3d')]};return db[_0x35ed('0x2d')][_0x35ed('0x1d')](_0x3e1302)['then'](function(_0x1f1e00){_0x5ed27b['count']=_0x1f1e00;if(_0x43e6de[_0x35ed('0x33')][_0x35ed('0x43')]){_0x5b6d05[_0x35ed('0x44')]=[{'all':!![]}];}return db[_0x35ed('0x2d')][_0x35ed('0x45')](_0x5b6d05);})[_0x35ed('0x24')](function(_0x479778){_0x5ed27b[_0x35ed('0x46')]=_0x479778;return _0x5ed27b;})[_0x35ed('0x24')](respondWithFilteredResult(_0x4834e2,_0x5b6d05))['catch'](handleError(_0x4834e2,null));};exports[_0x35ed('0x47')]=function(_0x5844fb,_0x530c34){var _0xd9a97={'raw':![],'where':{'id':_0x5844fb['params']['id']}},_0x1906cc={};_0x1906cc[_0x35ed('0x32')]=_[_0x35ed('0x34')](db[_0x35ed('0x2d')][_0x35ed('0x2e')]);_0x1906cc[_0x35ed('0x33')]=_[_0x35ed('0x34')](_0x5844fb[_0x35ed('0x33')]);_0x1906cc[_0x35ed('0x3f')]=_[_0x35ed('0x35')](_0x1906cc['model'],_0x1906cc[_0x35ed('0x33')]);_0xd9a97[_0x35ed('0x36')]=_[_0x35ed('0x35')](_0x1906cc[_0x35ed('0x32')],qs['fields'](_0x5844fb[_0x35ed('0x33')]['fields']));_0xd9a97['attributes']=_0xd9a97['attributes'][_0x35ed('0x38')]?_0xd9a97[_0x35ed('0x36')]:_0x1906cc[_0x35ed('0x32')];if(_0x5844fb['query'][_0x35ed('0x43')]){_0xd9a97['include']=[{'all':!![]}];}_0xd9a97=_[_0x35ed('0x41')]({},_0xd9a97,_0x5844fb[_0x35ed('0x42')]);return db[_0x35ed('0x2d')]['find'](_0xd9a97)['then'](handleEntityNotFound(_0x530c34,null))[_0x35ed('0x24')](respondWithResult(_0x530c34,null))[_0x35ed('0x48')](handleError(_0x530c34,null));};exports[_0x35ed('0x49')]=function(_0x3c759f,_0x5cbeb6){return db[_0x35ed('0x2d')][_0x35ed('0x49')](_0x3c759f[_0x35ed('0x4a')],{})[_0x35ed('0x24')](function(_0x2602e6){var _0x1e6d9f=_0x3c759f[_0x35ed('0x4b')]['get']({'plain':!![]});if(!_0x1e6d9f)throw new Error(_0x35ed('0x4c'));if(_0x1e6d9f['role']===_0x35ed('0x4b')){var _0x5aa9d9=_0x2602e6['get']({'plain':!![]});var _0x26aa98='Triggers';return db[_0x35ed('0x4d')][_0x35ed('0x4e')]({'where':{'name':_0x26aa98,'userProfileId':_0x1e6d9f[_0x35ed('0x4f')]},'raw':!![]})['then'](function(_0x3f8465){if(_0x3f8465&&_0x3f8465[_0x35ed('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x5aa9d9[_0x35ed('0x29')],'resourceId':_0x5aa9d9['id'],'type':_0x3f8465['name'],'sectionId':_0x3f8465['id']},{})['then'](function(){return _0x2602e6;});}else{return _0x2602e6;}})[_0x35ed('0x48')](function(_0x3fa8b1){logger[_0x35ed('0x51')](_0x35ed('0x52'),_0x3fa8b1);throw _0x3fa8b1;});}return _0x2602e6;})[_0x35ed('0x24')](respondWithResult(_0x5cbeb6,0xc9))[_0x35ed('0x48')](handleError(_0x5cbeb6,null));};exports[_0x35ed('0x53')]=function(_0x3b4333,_0x8cc83){if(_0x3b4333['body']['id']){delete _0x3b4333[_0x35ed('0x4a')]['id'];}return db[_0x35ed('0x2d')]['find']({'where':{'id':_0x3b4333['params']['id']}})[_0x35ed('0x24')](handleEntityNotFound(_0x8cc83,null))[_0x35ed('0x24')](saveUpdates(_0x3b4333[_0x35ed('0x4a')],null))['then'](respondWithResult(_0x8cc83,null))[_0x35ed('0x48')](handleError(_0x8cc83,null));};exports['destroy']=function(_0x3e37e1,_0x45f273){return db[_0x35ed('0x2d')][_0x35ed('0x4e')]({'where':{'id':_0x3e37e1[_0x35ed('0x54')]['id']}})[_0x35ed('0x24')](handleEntityNotFound(_0x45f273,null))[_0x35ed('0x24')](removeEntity(_0x45f273,null))[_0x35ed('0x48')](handleError(_0x45f273,null));};exports[_0x35ed('0x55')]=function(_0x312e4b,_0x719c04,_0x42f58c){if(_0x312e4b['body']['id']){delete _0x312e4b[_0x35ed('0x4a')]['id'];}return db['Trigger']['find']({'where':{'id':_0x312e4b[_0x35ed('0x54')]['id']}})[_0x35ed('0x24')](handleEntityNotFound(_0x719c04,null))[_0x35ed('0x24')](function(_0x1a8fca){if(_0x1a8fca){_0x312e4b[_0x35ed('0x4a')][_0x35ed('0x56')]=_0x1a8fca['id'];return db[_0x35ed('0x57')]['create'](_0x312e4b[_0x35ed('0x4a')]);}})['then'](respondWithResult(_0x719c04,null))[_0x35ed('0x48')](handleError(_0x719c04,null));};exports[_0x35ed('0x58')]=function(_0x46888d,_0x1c87ee,_0x2253a6){if(_0x46888d[_0x35ed('0x4a')]['id']){delete _0x46888d[_0x35ed('0x4a')]['id'];}return db[_0x35ed('0x2d')][_0x35ed('0x4e')]({'where':{'id':_0x46888d[_0x35ed('0x54')]['id']}})['then'](handleEntityNotFound(_0x1c87ee,null))[_0x35ed('0x24')](function(_0x1bc5a2){if(_0x1bc5a2){_0x46888d[_0x35ed('0x4a')][_0x35ed('0x59')]=_0x1bc5a2['id'];return db[_0x35ed('0x57')][_0x35ed('0x49')](_0x46888d['body']);}})['then'](respondWithResult(_0x1c87ee,null))[_0x35ed('0x48')](handleError(_0x1c87ee,null));};exports[_0x35ed('0x5a')]=function(_0x41952a,_0x5b6618,_0x2b53b0){var _0x7f4c9a={};var _0x12d9e7={};var _0x51c1f0;var _0xe266e0;return db[_0x35ed('0x2d')][_0x35ed('0x5b')]({'where':{'id':_0x41952a[_0x35ed('0x54')]['id']}})[_0x35ed('0x24')](handleEntityNotFound(_0x5b6618,null))[_0x35ed('0x24')](function(_0x3c6b35){if(_0x3c6b35){_0x51c1f0=_0x3c6b35;_0x12d9e7[_0x35ed('0x32')]=_[_0x35ed('0x34')](db['Condition']['rawAttributes']);_0x12d9e7[_0x35ed('0x33')]=_[_0x35ed('0x34')](_0x41952a['query']);_0x12d9e7['filters']=_[_0x35ed('0x35')](_0x12d9e7[_0x35ed('0x32')],_0x12d9e7[_0x35ed('0x33')]);_0x7f4c9a['attributes']=_[_0x35ed('0x35')](_0x12d9e7[_0x35ed('0x32')],qs[_0x35ed('0x37')](_0x41952a[_0x35ed('0x33')][_0x35ed('0x37')]));_0x7f4c9a[_0x35ed('0x36')]=_0x7f4c9a['attributes'][_0x35ed('0x38')]?_0x7f4c9a[_0x35ed('0x36')]:_0x12d9e7[_0x35ed('0x32')];_0x7f4c9a['order']=qs[_0x35ed('0x3c')](_0x41952a[_0x35ed('0x33')]['sort']);_0x7f4c9a[_0x35ed('0x3d')]=qs['filters'](_[_0x35ed('0x3e')](_0x41952a[_0x35ed('0x33')],_0x12d9e7[_0x35ed('0x3f')]));if(_0x41952a[_0x35ed('0x33')]['filter']){_0x7f4c9a[_0x35ed('0x3d')]=_[_0x35ed('0x41')](_0x7f4c9a[_0x35ed('0x3d')],{'$or':_[_0x35ed('0x2c')](_0x7f4c9a[_0x35ed('0x36')],function(_0x247df3){var _0xbb897a={};_0xbb897a[_0x247df3]={'$like':'%'+_0x41952a['query'][_0x35ed('0x40')]+'%'};return _0xbb897a;})});}_0x7f4c9a=_[_0x35ed('0x41')]({},_0x7f4c9a,_0x41952a[_0x35ed('0x42')]);return _0x51c1f0[_0x35ed('0x5a')](_0x7f4c9a);}})[_0x35ed('0x24')](function(_0x108287){if(_0x108287){_0xe266e0=_0x108287[_0x35ed('0x38')];if(!_0x41952a[_0x35ed('0x33')][_0x35ed('0x39')](_0x35ed('0x3a'))){_0x7f4c9a[_0x35ed('0x1f')]=qs[_0x35ed('0x1f')](_0x41952a[_0x35ed('0x33')]['limit']);_0x7f4c9a[_0x35ed('0x1e')]=qs[_0x35ed('0x1e')](_0x41952a[_0x35ed('0x33')][_0x35ed('0x1e')]);}return _0x51c1f0[_0x35ed('0x5a')](_0x7f4c9a);}})[_0x35ed('0x24')](function(_0x34e30d){if(_0x34e30d){return _0x34e30d?{'count':_0xe266e0,'rows':_0x34e30d}:null;}})[_0x35ed('0x24')](respondWithResult(_0x5b6618,null))[_0x35ed('0x48')](handleError(_0x5b6618,null));};exports[_0x35ed('0x5c')]=function(_0x27f366,_0x1f5b13,_0x2326ec){var _0x44c424={};var _0x25a014={};var _0x5b98bb;var _0xb97299;return db[_0x35ed('0x2d')][_0x35ed('0x5b')]({'where':{'id':_0x27f366[_0x35ed('0x54')]['id']}})[_0x35ed('0x24')](handleEntityNotFound(_0x1f5b13,null))[_0x35ed('0x24')](function(_0x3245d3){if(_0x3245d3){_0x5b98bb=_0x3245d3;_0x25a014['model']=_[_0x35ed('0x34')](db['Condition']['rawAttributes']);_0x25a014[_0x35ed('0x33')]=_[_0x35ed('0x34')](_0x27f366['query']);_0x25a014[_0x35ed('0x3f')]=_[_0x35ed('0x35')](_0x25a014[_0x35ed('0x32')],_0x25a014[_0x35ed('0x33')]);_0x44c424[_0x35ed('0x36')]=_[_0x35ed('0x35')](_0x25a014[_0x35ed('0x32')],qs[_0x35ed('0x37')](_0x27f366[_0x35ed('0x33')][_0x35ed('0x37')]));_0x44c424[_0x35ed('0x36')]=_0x44c424[_0x35ed('0x36')]['length']?_0x44c424[_0x35ed('0x36')]:_0x25a014['model'];_0x44c424[_0x35ed('0x3b')]=qs[_0x35ed('0x3c')](_0x27f366[_0x35ed('0x33')][_0x35ed('0x3c')]);_0x44c424[_0x35ed('0x3d')]=qs['filters'](_[_0x35ed('0x3e')](_0x27f366['query'],_0x25a014[_0x35ed('0x3f')]));if(_0x27f366[_0x35ed('0x33')][_0x35ed('0x40')]){_0x44c424[_0x35ed('0x3d')]=_[_0x35ed('0x41')](_0x44c424['where'],{'$or':_[_0x35ed('0x2c')](_0x44c424[_0x35ed('0x36')],function(_0x13399d){var _0x507fd9={};_0x507fd9[_0x13399d]={'$like':'%'+_0x27f366['query'][_0x35ed('0x40')]+'%'};return _0x507fd9;})});}_0x44c424=_[_0x35ed('0x41')]({},_0x44c424,_0x27f366[_0x35ed('0x42')]);return _0x5b98bb[_0x35ed('0x5c')](_0x44c424);}})[_0x35ed('0x24')](function(_0x2b8593){if(_0x2b8593){_0xb97299=_0x2b8593[_0x35ed('0x38')];if(!_0x27f366['query'][_0x35ed('0x39')]('nolimit')){_0x44c424[_0x35ed('0x1f')]=qs[_0x35ed('0x1f')](_0x27f366['query'][_0x35ed('0x1f')]);_0x44c424['offset']=qs[_0x35ed('0x1e')](_0x27f366[_0x35ed('0x33')][_0x35ed('0x1e')]);}return _0x5b98bb['getAnyConditions'](_0x44c424);}})[_0x35ed('0x24')](function(_0x5019a5){if(_0x5019a5){return _0x5019a5?{'count':_0xb97299,'rows':_0x5019a5}:null;}})['then'](respondWithResult(_0x1f5b13,null))[_0x35ed('0x48')](handleError(_0x1f5b13,null));};exports['addAction']=function(_0x34af14,_0xd9b883,_0x10f3ce){if(_0x34af14[_0x35ed('0x4a')]['id']){delete _0x34af14[_0x35ed('0x4a')]['id'];}return db[_0x35ed('0x2d')][_0x35ed('0x4e')]({'where':{'id':_0x34af14['params']['id']}})[_0x35ed('0x24')](handleEntityNotFound(_0xd9b883,null))['then'](function(_0x266b5c){if(_0x266b5c){_0x34af14[_0x35ed('0x4a')][_0x35ed('0x5d')]=_0x266b5c['id'];return db[_0x35ed('0x5e')]['create'](_0x34af14[_0x35ed('0x4a')]);}})[_0x35ed('0x24')](respondWithResult(_0xd9b883,null))[_0x35ed('0x48')](handleError(_0xd9b883,null));};exports[_0x35ed('0x5f')]=function(_0x3c661b,_0x546492,_0x394468){var _0x1f20f3={};var _0x1da924={};var _0x769007;var _0x4c49a2;return db[_0x35ed('0x2d')][_0x35ed('0x5b')]({'where':{'id':_0x3c661b[_0x35ed('0x54')]['id']}})['then'](handleEntityNotFound(_0x546492,null))[_0x35ed('0x24')](function(_0x1a0ecc){if(_0x1a0ecc){_0x769007=_0x1a0ecc;_0x1da924['model']=_[_0x35ed('0x34')](db[_0x35ed('0x5e')][_0x35ed('0x2e')]);_0x1da924[_0x35ed('0x33')]=_[_0x35ed('0x34')](_0x3c661b['query']);_0x1da924[_0x35ed('0x3f')]=_[_0x35ed('0x35')](_0x1da924[_0x35ed('0x32')],_0x1da924[_0x35ed('0x33')]);_0x1f20f3[_0x35ed('0x36')]=_['intersection'](_0x1da924[_0x35ed('0x32')],qs[_0x35ed('0x37')](_0x3c661b[_0x35ed('0x33')][_0x35ed('0x37')]));_0x1f20f3[_0x35ed('0x36')]=_0x1f20f3[_0x35ed('0x36')]['length']?_0x1f20f3[_0x35ed('0x36')]:_0x1da924[_0x35ed('0x32')];_0x1f20f3[_0x35ed('0x3b')]=qs[_0x35ed('0x3c')](_0x3c661b[_0x35ed('0x33')]['sort']);_0x1f20f3[_0x35ed('0x3d')]=qs['filters'](_[_0x35ed('0x3e')](_0x3c661b[_0x35ed('0x33')],_0x1da924[_0x35ed('0x3f')]));if(_0x3c661b[_0x35ed('0x33')][_0x35ed('0x40')]){_0x1f20f3[_0x35ed('0x3d')]=_['merge'](_0x1f20f3['where'],{'$or':_[_0x35ed('0x2c')](_0x1f20f3['attributes'],function(_0x10e4d9){var _0x2c8fd9={};_0x2c8fd9[_0x10e4d9]={'$like':'%'+_0x3c661b[_0x35ed('0x33')][_0x35ed('0x40')]+'%'};return _0x2c8fd9;})});}_0x1f20f3=_[_0x35ed('0x41')]({},_0x1f20f3,_0x3c661b['options']);return _0x769007['getActions'](_0x1f20f3);}})[_0x35ed('0x24')](function(_0x4fc03e){if(_0x4fc03e){_0x4c49a2=_0x4fc03e['length'];if(!_0x3c661b['query'][_0x35ed('0x39')]('nolimit')){_0x1f20f3[_0x35ed('0x1f')]=qs[_0x35ed('0x1f')](_0x3c661b['query'][_0x35ed('0x1f')]);_0x1f20f3[_0x35ed('0x1e')]=qs[_0x35ed('0x1e')](_0x3c661b[_0x35ed('0x33')]['offset']);}return _0x769007[_0x35ed('0x5f')](_0x1f20f3);}})[_0x35ed('0x24')](function(_0x25258c){if(_0x25258c){return _0x25258c?{'count':_0x4c49a2,'rows':_0x25258c}:null;}})[_0x35ed('0x24')](respondWithResult(_0x546492,null))[_0x35ed('0x48')](handleError(_0x546492,null));}; \ No newline at end of file +var _0x71b6=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','get','Triggers','UserProfileResource','sendStatus','error','stack','name','send','type','key','model','map','keys','filters','intersection','fields','query','attributes','hasOwnProperty','order','sort','pick','where','VIRTUAL','merge','options','Trigger','includeAll','findAll','catch','show','params','rawAttributes','length','include','find','create','body','user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','filter','nolimit','getAnyConditions','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto'];(function(_0x4daaa1,_0x4a1bbd){var _0x37a1fd=function(_0xa5d8c1){while(--_0xa5d8c1){_0x4daaa1['push'](_0x4daaa1['shift']());}};_0x37a1fd(++_0x4a1bbd);}(_0x71b6,0x1b8));var _0x671b=function(_0x2e54d2,_0x3fabf0){_0x2e54d2=_0x2e54d2-0x0;var _0x481e50=_0x71b6[_0x2e54d2];return _0x481e50;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x671b('0x0'));var rimraf=require(_0x671b('0x1'));var zipdir=require(_0x671b('0x2'));var jsonpatch=require(_0x671b('0x3'));var rp=require(_0x671b('0x4'));var moment=require(_0x671b('0x5'));var BPromise=require(_0x671b('0x6'));var Mustache=require(_0x671b('0x7'));var util=require(_0x671b('0x8'));var path=require(_0x671b('0x9'));var sox=require(_0x671b('0xa'));var csv=require(_0x671b('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x671b('0xc'));var squel=require(_0x671b('0xd'));var crypto=require(_0x671b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x671b('0xf'));var toCsv=require(_0x671b('0xb'));var querystring=require(_0x671b('0x10'));var Papa=require(_0x671b('0x11'));var Redis=require('ioredis');var authService=require(_0x671b('0x12'));var qs=require(_0x671b('0x13'));var as=require(_0x671b('0x14'));var hardwareService=require(_0x671b('0x15'));var logger=require(_0x671b('0x16'))(_0x671b('0x17'));var utils=require(_0x671b('0x18'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ed5c6,_0x37c22e){_0x37c22e=_0x37c22e||0xcc;return function(_0x1959fc){if(_0x1959fc){return _0x3ed5c6['sendStatus'](_0x37c22e);}return _0x3ed5c6[_0x671b('0x19')](_0x37c22e)[_0x671b('0x1a')]();};}function respondWithResult(_0x55dc9a,_0x35e549){_0x35e549=_0x35e549||0xc8;return function(_0x4f88c7){if(_0x4f88c7){return _0x55dc9a[_0x671b('0x19')](_0x35e549)['json'](_0x4f88c7);}};}function respondWithFilteredResult(_0x5c116e,_0x32a204){return function(_0x549cb1){if(_0x549cb1){var _0xf449c0=_0x549cb1[_0x671b('0x1b')],_0xf15545=_0x32a204[_0x671b('0x1c')],_0x48aba=_0x32a204[_0x671b('0x1c')]+_0x32a204[_0x671b('0x1d')],_0x5252a1;if(_0x48aba>=_0xf449c0){_0x48aba=_0xf449c0;_0x5252a1=0xc8;}else{_0x5252a1=0xce;}_0x5c116e[_0x671b('0x19')](_0x5252a1);return _0x5c116e[_0x671b('0x1e')](_0x671b('0x1f'),_0xf15545+'-'+_0x48aba+'/'+_0xf449c0)[_0x671b('0x20')](_0x549cb1);}return null;};}function patchUpdates(_0x5897b4){return function(_0x21250e){try{jsonpatch[_0x671b('0x21')](_0x21250e,_0x5897b4,!![]);}catch(_0x43413d){return BPromise[_0x671b('0x22')](_0x43413d);}return _0x21250e['save']();};}function saveUpdates(_0x2bc12b,_0x136803){return function(_0x2f7acc){if(_0x2f7acc){return _0x2f7acc[_0x671b('0x23')](_0x2bc12b)[_0x671b('0x24')](function(_0x5c79af){return _0x5c79af;});}return null;};}function removeEntity(_0x4fee00,_0x5b36ae){return function(_0x480284){if(_0x480284){return _0x480284[_0x671b('0x25')]()[_0x671b('0x24')](function(){var _0x39ad2f=_0x480284[_0x671b('0x26')]({'plain':!![]});var _0x15c041=_0x671b('0x27');return db[_0x671b('0x28')][_0x671b('0x25')]({'where':{'type':_0x15c041,'resourceId':_0x39ad2f['id']}})[_0x671b('0x24')](function(){return _0x480284;});})[_0x671b('0x24')](function(){_0x4fee00[_0x671b('0x19')](0xcc)[_0x671b('0x1a')]();});}};}function handleEntityNotFound(_0x50c508,_0x473775){return function(_0x5d9423){if(!_0x5d9423){_0x50c508[_0x671b('0x29')](0x194);}return _0x5d9423;};}function handleError(_0x26a367,_0x28c84d){_0x28c84d=_0x28c84d||0x1f4;return function(_0x1740f3){logger[_0x671b('0x2a')](_0x1740f3[_0x671b('0x2b')]);if(_0x1740f3[_0x671b('0x2c')]){delete _0x1740f3[_0x671b('0x2c')];}_0x26a367['status'](_0x28c84d)[_0x671b('0x2d')](_0x1740f3);};}exports['index']=function(_0x19e1a4,_0x446a32){var _0x44c98f={},_0xc26682={},_0x1d367c={'count':0x0,'rows':[]};var _0x38fdcc=_['map'](db['Trigger']['rawAttributes'],function(_0x37c654){return{'name':_0x37c654['fieldName'],'type':_0x37c654[_0x671b('0x2e')][_0x671b('0x2f')]};});_0xc26682[_0x671b('0x30')]=_[_0x671b('0x31')](_0x38fdcc,_0x671b('0x2c'));_0xc26682['query']=_[_0x671b('0x32')](_0x19e1a4['query']);_0xc26682[_0x671b('0x33')]=_[_0x671b('0x34')](_0xc26682['model'],_0xc26682['query']);_0x44c98f['attributes']=_[_0x671b('0x34')](_0xc26682[_0x671b('0x30')],qs[_0x671b('0x35')](_0x19e1a4[_0x671b('0x36')][_0x671b('0x35')]));_0x44c98f[_0x671b('0x37')]=_0x44c98f[_0x671b('0x37')]['length']?_0x44c98f[_0x671b('0x37')]:_0xc26682[_0x671b('0x30')];if(!_0x19e1a4['query'][_0x671b('0x38')]('nolimit')){_0x44c98f[_0x671b('0x1d')]=qs[_0x671b('0x1d')](_0x19e1a4['query'][_0x671b('0x1d')]);_0x44c98f['offset']=qs['offset'](_0x19e1a4[_0x671b('0x36')][_0x671b('0x1c')]);}_0x44c98f[_0x671b('0x39')]=qs[_0x671b('0x3a')](_0x19e1a4[_0x671b('0x36')][_0x671b('0x3a')]);_0x44c98f['where']=qs[_0x671b('0x33')](_[_0x671b('0x3b')](_0x19e1a4[_0x671b('0x36')],_0xc26682[_0x671b('0x33')]),_0x38fdcc);if(_0x19e1a4['query']['filter']){_0x44c98f['where']=_['merge'](_0x44c98f[_0x671b('0x3c')],{'$or':_[_0x671b('0x31')](_0x38fdcc,function(_0x5a833e){if(_0x5a833e[_0x671b('0x2e')]!==_0x671b('0x3d')){var _0x3eb1c0={};_0x3eb1c0[_0x5a833e['name']]={'$like':'%'+_0x19e1a4[_0x671b('0x36')]['filter']+'%'};return _0x3eb1c0;}})});}_0x44c98f=_[_0x671b('0x3e')]({},_0x44c98f,_0x19e1a4[_0x671b('0x3f')]);var _0x13539a={'where':_0x44c98f[_0x671b('0x3c')]};return db[_0x671b('0x40')][_0x671b('0x1b')](_0x13539a)[_0x671b('0x24')](function(_0x11083e){_0x1d367c[_0x671b('0x1b')]=_0x11083e;if(_0x19e1a4[_0x671b('0x36')][_0x671b('0x41')]){_0x44c98f['include']=[{'all':!![]}];}return db[_0x671b('0x40')][_0x671b('0x42')](_0x44c98f);})[_0x671b('0x24')](function(_0x42a76b){_0x1d367c['rows']=_0x42a76b;return _0x1d367c;})['then'](respondWithFilteredResult(_0x446a32,_0x44c98f))[_0x671b('0x43')](handleError(_0x446a32,null));};exports[_0x671b('0x44')]=function(_0x8dcfcf,_0x45885a){var _0x492164={'raw':![],'where':{'id':_0x8dcfcf[_0x671b('0x45')]['id']}},_0x473f48={};_0x473f48['model']=_[_0x671b('0x32')](db[_0x671b('0x40')][_0x671b('0x46')]);_0x473f48['query']=_[_0x671b('0x32')](_0x8dcfcf[_0x671b('0x36')]);_0x473f48['filters']=_[_0x671b('0x34')](_0x473f48[_0x671b('0x30')],_0x473f48['query']);_0x492164[_0x671b('0x37')]=_['intersection'](_0x473f48[_0x671b('0x30')],qs[_0x671b('0x35')](_0x8dcfcf['query'][_0x671b('0x35')]));_0x492164[_0x671b('0x37')]=_0x492164['attributes'][_0x671b('0x47')]?_0x492164[_0x671b('0x37')]:_0x473f48[_0x671b('0x30')];if(_0x8dcfcf[_0x671b('0x36')][_0x671b('0x41')]){_0x492164[_0x671b('0x48')]=[{'all':!![]}];}_0x492164=_[_0x671b('0x3e')]({},_0x492164,_0x8dcfcf['options']);return db[_0x671b('0x40')][_0x671b('0x49')](_0x492164)[_0x671b('0x24')](handleEntityNotFound(_0x45885a,null))['then'](respondWithResult(_0x45885a,null))[_0x671b('0x43')](handleError(_0x45885a,null));};exports[_0x671b('0x4a')]=function(_0x52be8f,_0x557689){return db['Trigger'][_0x671b('0x4a')](_0x52be8f[_0x671b('0x4b')],{})['then'](function(_0x5a970c){var _0x1a9a48=_0x52be8f[_0x671b('0x4c')][_0x671b('0x26')]({'plain':!![]});if(!_0x1a9a48)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1a9a48['role']==='user'){var _0x3078dc=_0x5a970c[_0x671b('0x26')]({'plain':!![]});var _0x35ecf7=_0x671b('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x35ecf7,'userProfileId':_0x1a9a48[_0x671b('0x4d')]},'raw':!![]})[_0x671b('0x24')](function(_0x48b933){if(_0x48b933&&_0x48b933['autoAssociation']===0x0){return db['UserProfileResource'][_0x671b('0x4a')]({'name':_0x3078dc[_0x671b('0x2c')],'resourceId':_0x3078dc['id'],'type':_0x48b933[_0x671b('0x2c')],'sectionId':_0x48b933['id']},{})[_0x671b('0x24')](function(){return _0x5a970c;});}else{return _0x5a970c;}})[_0x671b('0x43')](function(_0x23c5cc){logger['error'](_0x671b('0x4e'),_0x23c5cc);throw _0x23c5cc;});}return _0x5a970c;})[_0x671b('0x24')](respondWithResult(_0x557689,0xc9))['catch'](handleError(_0x557689,null));};exports[_0x671b('0x23')]=function(_0x547905,_0x5a53d1){if(_0x547905[_0x671b('0x4b')]['id']){delete _0x547905[_0x671b('0x4b')]['id'];}return db['Trigger']['find']({'where':{'id':_0x547905[_0x671b('0x45')]['id']}})[_0x671b('0x24')](handleEntityNotFound(_0x5a53d1,null))[_0x671b('0x24')](saveUpdates(_0x547905[_0x671b('0x4b')],null))[_0x671b('0x24')](respondWithResult(_0x5a53d1,null))[_0x671b('0x43')](handleError(_0x5a53d1,null));};exports[_0x671b('0x25')]=function(_0x50a3f8,_0x4d3b1c){return db['Trigger'][_0x671b('0x49')]({'where':{'id':_0x50a3f8['params']['id']}})[_0x671b('0x24')](handleEntityNotFound(_0x4d3b1c,null))[_0x671b('0x24')](removeEntity(_0x4d3b1c,null))[_0x671b('0x43')](handleError(_0x4d3b1c,null));};exports[_0x671b('0x4f')]=function(_0x9810e,_0x4e4519,_0x3f81a5){if(_0x9810e[_0x671b('0x4b')]['id']){delete _0x9810e['body']['id'];}return db['Trigger'][_0x671b('0x49')]({'where':{'id':_0x9810e[_0x671b('0x45')]['id']}})[_0x671b('0x24')](handleEntityNotFound(_0x4e4519,null))['then'](function(_0x14bf72){if(_0x14bf72){_0x9810e[_0x671b('0x4b')][_0x671b('0x50')]=_0x14bf72['id'];return db[_0x671b('0x51')][_0x671b('0x4a')](_0x9810e['body']);}})['then'](respondWithResult(_0x4e4519,null))[_0x671b('0x43')](handleError(_0x4e4519,null));};exports[_0x671b('0x52')]=function(_0x842e58,_0x50c7aa,_0x58d653){if(_0x842e58[_0x671b('0x4b')]['id']){delete _0x842e58[_0x671b('0x4b')]['id'];}return db['Trigger']['find']({'where':{'id':_0x842e58[_0x671b('0x45')]['id']}})['then'](handleEntityNotFound(_0x50c7aa,null))[_0x671b('0x24')](function(_0x698d80){if(_0x698d80){_0x842e58[_0x671b('0x4b')]['TriggerAnyId']=_0x698d80['id'];return db[_0x671b('0x51')]['create'](_0x842e58['body']);}})['then'](respondWithResult(_0x50c7aa,null))[_0x671b('0x43')](handleError(_0x50c7aa,null));};exports[_0x671b('0x53')]=function(_0x5b38fa,_0x1a1053,_0x31a431){var _0x362dd6={};var _0xef4441={};var _0x15f56;var _0x3f3cdb;return db['Trigger'][_0x671b('0x54')]({'where':{'id':_0x5b38fa[_0x671b('0x45')]['id']}})['then'](handleEntityNotFound(_0x1a1053,null))[_0x671b('0x24')](function(_0x1b2d58){if(_0x1b2d58){_0x15f56=_0x1b2d58;_0xef4441['model']=_[_0x671b('0x32')](db[_0x671b('0x51')][_0x671b('0x46')]);_0xef4441[_0x671b('0x36')]=_[_0x671b('0x32')](_0x5b38fa['query']);_0xef4441['filters']=_[_0x671b('0x34')](_0xef4441[_0x671b('0x30')],_0xef4441[_0x671b('0x36')]);_0x362dd6[_0x671b('0x37')]=_['intersection'](_0xef4441[_0x671b('0x30')],qs['fields'](_0x5b38fa[_0x671b('0x36')][_0x671b('0x35')]));_0x362dd6['attributes']=_0x362dd6[_0x671b('0x37')][_0x671b('0x47')]?_0x362dd6['attributes']:_0xef4441[_0x671b('0x30')];_0x362dd6[_0x671b('0x39')]=qs[_0x671b('0x3a')](_0x5b38fa[_0x671b('0x36')][_0x671b('0x3a')]);_0x362dd6[_0x671b('0x3c')]=qs['filters'](_[_0x671b('0x3b')](_0x5b38fa[_0x671b('0x36')],_0xef4441['filters']));if(_0x5b38fa['query']['filter']){_0x362dd6[_0x671b('0x3c')]=_[_0x671b('0x3e')](_0x362dd6[_0x671b('0x3c')],{'$or':_[_0x671b('0x31')](_0x362dd6[_0x671b('0x37')],function(_0x8186e2){var _0x547035={};_0x547035[_0x8186e2]={'$like':'%'+_0x5b38fa['query'][_0x671b('0x55')]+'%'};return _0x547035;})});}_0x362dd6=_[_0x671b('0x3e')]({},_0x362dd6,_0x5b38fa[_0x671b('0x3f')]);return _0x15f56['getAllConditions'](_0x362dd6);}})['then'](function(_0x205ef7){if(_0x205ef7){_0x3f3cdb=_0x205ef7[_0x671b('0x47')];if(!_0x5b38fa[_0x671b('0x36')][_0x671b('0x38')]('nolimit')){_0x362dd6['limit']=qs['limit'](_0x5b38fa['query']['limit']);_0x362dd6['offset']=qs[_0x671b('0x1c')](_0x5b38fa[_0x671b('0x36')][_0x671b('0x1c')]);}return _0x15f56[_0x671b('0x53')](_0x362dd6);}})[_0x671b('0x24')](function(_0x2d2f3a){if(_0x2d2f3a){return _0x2d2f3a?{'count':_0x3f3cdb,'rows':_0x2d2f3a}:null;}})['then'](respondWithResult(_0x1a1053,null))[_0x671b('0x43')](handleError(_0x1a1053,null));};exports['getAnyConditions']=function(_0x3d77d5,_0x5dc3c1,_0x2965c4){var _0x567dfd={};var _0x1a7677={};var _0x5237e4;var _0x443b27;return db[_0x671b('0x40')][_0x671b('0x54')]({'where':{'id':_0x3d77d5[_0x671b('0x45')]['id']}})['then'](handleEntityNotFound(_0x5dc3c1,null))[_0x671b('0x24')](function(_0x3d07a2){if(_0x3d07a2){_0x5237e4=_0x3d07a2;_0x1a7677[_0x671b('0x30')]=_['keys'](db['Condition'][_0x671b('0x46')]);_0x1a7677[_0x671b('0x36')]=_[_0x671b('0x32')](_0x3d77d5[_0x671b('0x36')]);_0x1a7677['filters']=_[_0x671b('0x34')](_0x1a7677[_0x671b('0x30')],_0x1a7677[_0x671b('0x36')]);_0x567dfd[_0x671b('0x37')]=_['intersection'](_0x1a7677[_0x671b('0x30')],qs['fields'](_0x3d77d5['query'][_0x671b('0x35')]));_0x567dfd[_0x671b('0x37')]=_0x567dfd[_0x671b('0x37')][_0x671b('0x47')]?_0x567dfd[_0x671b('0x37')]:_0x1a7677[_0x671b('0x30')];_0x567dfd[_0x671b('0x39')]=qs[_0x671b('0x3a')](_0x3d77d5[_0x671b('0x36')][_0x671b('0x3a')]);_0x567dfd[_0x671b('0x3c')]=qs[_0x671b('0x33')](_[_0x671b('0x3b')](_0x3d77d5[_0x671b('0x36')],_0x1a7677['filters']));if(_0x3d77d5[_0x671b('0x36')]['filter']){_0x567dfd[_0x671b('0x3c')]=_[_0x671b('0x3e')](_0x567dfd[_0x671b('0x3c')],{'$or':_[_0x671b('0x31')](_0x567dfd[_0x671b('0x37')],function(_0x146ad1){var _0x148a21={};_0x148a21[_0x146ad1]={'$like':'%'+_0x3d77d5[_0x671b('0x36')][_0x671b('0x55')]+'%'};return _0x148a21;})});}_0x567dfd=_[_0x671b('0x3e')]({},_0x567dfd,_0x3d77d5[_0x671b('0x3f')]);return _0x5237e4['getAnyConditions'](_0x567dfd);}})[_0x671b('0x24')](function(_0x497cb4){if(_0x497cb4){_0x443b27=_0x497cb4[_0x671b('0x47')];if(!_0x3d77d5[_0x671b('0x36')]['hasOwnProperty'](_0x671b('0x56'))){_0x567dfd[_0x671b('0x1d')]=qs[_0x671b('0x1d')](_0x3d77d5['query']['limit']);_0x567dfd['offset']=qs['offset'](_0x3d77d5[_0x671b('0x36')][_0x671b('0x1c')]);}return _0x5237e4[_0x671b('0x57')](_0x567dfd);}})[_0x671b('0x24')](function(_0x34acf9){if(_0x34acf9){return _0x34acf9?{'count':_0x443b27,'rows':_0x34acf9}:null;}})['then'](respondWithResult(_0x5dc3c1,null))['catch'](handleError(_0x5dc3c1,null));};exports['addAction']=function(_0x3cd4d6,_0x4afa3d,_0x4b7ce2){if(_0x3cd4d6[_0x671b('0x4b')]['id']){delete _0x3cd4d6[_0x671b('0x4b')]['id'];}return db[_0x671b('0x40')][_0x671b('0x49')]({'where':{'id':_0x3cd4d6[_0x671b('0x45')]['id']}})[_0x671b('0x24')](handleEntityNotFound(_0x4afa3d,null))['then'](function(_0x6f3a84){if(_0x6f3a84){_0x3cd4d6['body'][_0x671b('0x58')]=_0x6f3a84['id'];return db[_0x671b('0x59')][_0x671b('0x4a')](_0x3cd4d6['body']);}})[_0x671b('0x24')](respondWithResult(_0x4afa3d,null))[_0x671b('0x43')](handleError(_0x4afa3d,null));};exports[_0x671b('0x5a')]=function(_0x4fc5bf,_0x1c24cf,_0x36d2e4){var _0x52dde1={};var _0x57c467={};var _0x424e2e;var _0x67a549;return db['Trigger']['findOne']({'where':{'id':_0x4fc5bf[_0x671b('0x45')]['id']}})[_0x671b('0x24')](handleEntityNotFound(_0x1c24cf,null))['then'](function(_0x1a1acf){if(_0x1a1acf){_0x424e2e=_0x1a1acf;_0x57c467[_0x671b('0x30')]=_[_0x671b('0x32')](db[_0x671b('0x59')][_0x671b('0x46')]);_0x57c467[_0x671b('0x36')]=_[_0x671b('0x32')](_0x4fc5bf[_0x671b('0x36')]);_0x57c467[_0x671b('0x33')]=_[_0x671b('0x34')](_0x57c467[_0x671b('0x30')],_0x57c467['query']);_0x52dde1[_0x671b('0x37')]=_['intersection'](_0x57c467[_0x671b('0x30')],qs['fields'](_0x4fc5bf[_0x671b('0x36')]['fields']));_0x52dde1[_0x671b('0x37')]=_0x52dde1[_0x671b('0x37')][_0x671b('0x47')]?_0x52dde1[_0x671b('0x37')]:_0x57c467[_0x671b('0x30')];_0x52dde1[_0x671b('0x39')]=qs[_0x671b('0x3a')](_0x4fc5bf[_0x671b('0x36')][_0x671b('0x3a')]);_0x52dde1['where']=qs[_0x671b('0x33')](_['pick'](_0x4fc5bf['query'],_0x57c467[_0x671b('0x33')]));if(_0x4fc5bf['query']['filter']){_0x52dde1[_0x671b('0x3c')]=_[_0x671b('0x3e')](_0x52dde1['where'],{'$or':_[_0x671b('0x31')](_0x52dde1['attributes'],function(_0x57ca5d){var _0x2cdc14={};_0x2cdc14[_0x57ca5d]={'$like':'%'+_0x4fc5bf[_0x671b('0x36')]['filter']+'%'};return _0x2cdc14;})});}_0x52dde1=_['merge']({},_0x52dde1,_0x4fc5bf['options']);return _0x424e2e[_0x671b('0x5a')](_0x52dde1);}})[_0x671b('0x24')](function(_0x3fd07f){if(_0x3fd07f){_0x67a549=_0x3fd07f[_0x671b('0x47')];if(!_0x4fc5bf[_0x671b('0x36')][_0x671b('0x38')](_0x671b('0x56'))){_0x52dde1[_0x671b('0x1d')]=qs['limit'](_0x4fc5bf[_0x671b('0x36')][_0x671b('0x1d')]);_0x52dde1[_0x671b('0x1c')]=qs[_0x671b('0x1c')](_0x4fc5bf[_0x671b('0x36')][_0x671b('0x1c')]);}return _0x424e2e[_0x671b('0x5a')](_0x52dde1);}})[_0x671b('0x24')](function(_0x271eba){if(_0x271eba){return _0x271eba?{'count':_0x67a549,'rows':_0x271eba}:null;}})[_0x671b('0x24')](respondWithResult(_0x1c24cf,null))['catch'](handleError(_0x1c24cf,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index c14e8d2..4274972 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 _0x5f66=['request-promise','path','../../config/environment','exports','Trigger','tools_triggers','util','api','moment','bluebird'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./trigger.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f66=['request-promise','path','../../config/environment','exports','Trigger','tools_triggers','util','api','moment','bluebird'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x5f66,0x1a0));var _0x65f6=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5f66[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./trigger.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'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 106cd3a..69c3007 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 _0x0972=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetTrigger','Trigger','findAll','options','raw','attributes','limit','include','map','model','catch','find','where','ShowTrigger','util','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x59a216,_0x5094b0){var _0x1111f1=function(_0x3752f8){while(--_0x3752f8){_0x59a216['push'](_0x59a216['shift']());}};_0x1111f1(++_0x5094b0);}(_0x0972,0x64));var _0x2097=function(_0x1a0eae,_0x219bd3){_0x1a0eae=_0x1a0eae-0x0;var _0x217f88=_0x0972[_0x1a0eae];return _0x217f88;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var moment=require('moment');var BPromise=require(_0x2097('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2097('0x2'));var db=require(_0x2097('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2097('0x4'))(_0x2097('0x5'));var config=require(_0x2097('0x6'));var jayson=require(_0x2097('0x7'));var client=jayson[_0x2097('0x8')][_0x2097('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b4f21,_0x59739f,_0x332aac){return new BPromise(function(_0x1e661a,_0x11d263){return client[_0x2097('0xa')](_0x2b4f21,_0x332aac)[_0x2097('0xb')](function(_0x59d947){logger[_0x2097('0xc')](_0x2097('0xd'),_0x59739f,_0x2097('0xe'));logger[_0x2097('0xf')](_0x2097('0x10'),_0x59739f,_0x2097('0xe'),JSON[_0x2097('0x11')](_0x59d947));if(_0x59d947[_0x2097('0x12')]){if(_0x59d947[_0x2097('0x12')][_0x2097('0x13')]===0x1f4){logger[_0x2097('0x12')](_0x2097('0xd'),_0x59739f,_0x59d947[_0x2097('0x12')][_0x2097('0x14')]);return _0x11d263(_0x59d947[_0x2097('0x12')][_0x2097('0x14')]);}logger[_0x2097('0x12')](_0x2097('0xd'),_0x59739f,_0x59d947[_0x2097('0x12')][_0x2097('0x14')]);return _0x1e661a(_0x59d947['error'][_0x2097('0x14')]);}else{logger[_0x2097('0xc')]('Trigger,\x20%s,\x20%s',_0x59739f,'request\x20sent');_0x1e661a(_0x59d947['result'][_0x2097('0x14')]);}})['catch'](function(_0x28c35c){logger[_0x2097('0x12')](_0x2097('0xd'),_0x59739f,_0x28c35c);_0x11d263(_0x28c35c);});});}exports[_0x2097('0x15')]=function(_0x44c584){var _0x53e2b4=this;return new Promise(function(_0x324652,_0x140094){return db[_0x2097('0x16')][_0x2097('0x17')]({'raw':_0x44c584[_0x2097('0x18')]?_0x44c584[_0x2097('0x18')][_0x2097('0x19')]===undefined?!![]:![]:!![],'where':_0x44c584[_0x2097('0x18')]?_0x44c584['options']['where']||null:null,'attributes':_0x44c584[_0x2097('0x18')]?_0x44c584['options'][_0x2097('0x1a')]||null:null,'limit':_0x44c584[_0x2097('0x18')]?_0x44c584['options'][_0x2097('0x1b')]||null:null,'include':_0x44c584['options']?_0x44c584[_0x2097('0x18')][_0x2097('0x1c')]?_[_0x2097('0x1d')](_0x44c584[_0x2097('0x18')][_0x2097('0x1c')],function(_0x35047b){return{'model':db[_0x35047b['model']],'as':_0x35047b['as'],'attributes':_0x35047b[_0x2097('0x1a')],'include':_0x35047b['include']?_[_0x2097('0x1d')](_0x35047b[_0x2097('0x1c')],function(_0x345875){return{'model':db[_0x345875[_0x2097('0x1e')]],'as':_0x345875['as'],'attributes':_0x345875['attributes'],'include':_0x345875[_0x2097('0x1c')]?_[_0x2097('0x1d')](_0x345875['include'],function(_0x1229fc){return{'model':db[_0x1229fc['model']],'as':_0x1229fc['as'],'attributes':_0x1229fc[_0x2097('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xbc0339){logger[_0x2097('0xc')](_0x2097('0x15'),_0x44c584);logger[_0x2097('0xf')](_0x2097('0x15'),_0x44c584,JSON[_0x2097('0x11')](_0xbc0339));_0x324652(_0xbc0339);})[_0x2097('0x1f')](function(_0x4b443d){logger[_0x2097('0x12')](_0x2097('0x15'),_0x4b443d['message'],_0x44c584);_0x140094(_0x53e2b4[_0x2097('0x12')](0x1f4,_0x4b443d[_0x2097('0x14')]));});});};exports['ShowTrigger']=function(_0x4d0916){var _0x312c77=this;return new Promise(function(_0x11b051,_0x1649c8){return db[_0x2097('0x16')][_0x2097('0x20')]({'raw':_0x4d0916[_0x2097('0x18')]?_0x4d0916['options'][_0x2097('0x19')]===undefined?!![]:![]:!![],'where':_0x4d0916['options']?_0x4d0916[_0x2097('0x18')][_0x2097('0x21')]||null:null,'attributes':_0x4d0916[_0x2097('0x18')]?_0x4d0916[_0x2097('0x18')][_0x2097('0x1a')]||null:null,'include':_0x4d0916[_0x2097('0x18')]?_0x4d0916[_0x2097('0x18')][_0x2097('0x1c')]?_[_0x2097('0x1d')](_0x4d0916['options'][_0x2097('0x1c')],function(_0x40baed){return{'model':db[_0x40baed[_0x2097('0x1e')]],'as':_0x40baed['as'],'attributes':_0x40baed['attributes'],'include':_0x40baed[_0x2097('0x1c')]?_[_0x2097('0x1d')](_0x40baed[_0x2097('0x1c')],function(_0x396162){return{'model':db[_0x396162['model']],'as':_0x396162['as'],'attributes':_0x396162['attributes'],'include':_0x396162['include']?_[_0x2097('0x1d')](_0x396162[_0x2097('0x1c')],function(_0x4123b7){return{'model':db[_0x4123b7[_0x2097('0x1e')]],'as':_0x4123b7['as'],'attributes':_0x4123b7[_0x2097('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2097('0xb')](function(_0x49b724){logger[_0x2097('0xc')](_0x2097('0x22'),_0x4d0916);logger[_0x2097('0xf')](_0x2097('0x22'),_0x4d0916,JSON[_0x2097('0x11')](_0x49b724));_0x11b051(_0x49b724);})[_0x2097('0x1f')](function(_0x52b937){logger[_0x2097('0x12')](_0x2097('0x22'),_0x52b937[_0x2097('0x14')],_0x4d0916);_0x1649c8(_0x312c77['error'](0x1f4,_0x52b937['message']));});});}; \ No newline at end of file +var _0xd824=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','ShowTrigger','find','lodash','util','randomstring','ioredis'];(function(_0xceb849,_0x2327c7){var _0x4c6f0d=function(_0x2b9861){while(--_0x2b9861){_0xceb849['push'](_0xceb849['shift']());}};_0x4c6f0d(++_0x2327c7);}(_0xd824,0xc2));var _0x4d82=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd824[_0xfae23b];return _0x200640;};'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 Redis=require(_0x4d82('0x3'));var db=require(_0x4d82('0x4'))['db'];var utils=require(_0x4d82('0x5'));var logger=require(_0x4d82('0x6'))(_0x4d82('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d82('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b842f,_0x464caf,_0xb54db2){return new BPromise(function(_0x13d624,_0x5cccb6){return client[_0x4d82('0x9')](_0x4b842f,_0xb54db2)['then'](function(_0x5356cd){logger[_0x4d82('0xa')](_0x4d82('0xb'),_0x464caf,_0x4d82('0xc'));logger['debug'](_0x4d82('0xd'),_0x464caf,'request\x20sent',JSON[_0x4d82('0xe')](_0x5356cd));if(_0x5356cd[_0x4d82('0xf')]){if(_0x5356cd[_0x4d82('0xf')]['code']===0x1f4){logger['error'](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')][_0x4d82('0x10')]);return _0x5cccb6(_0x5356cd[_0x4d82('0xf')]['message']);}logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')]['message']);return _0x13d624(_0x5356cd[_0x4d82('0xf')]['message']);}else{logger[_0x4d82('0xa')]('Trigger,\x20%s,\x20%s',_0x464caf,_0x4d82('0xc'));_0x13d624(_0x5356cd['result'][_0x4d82('0x10')]);}})[_0x4d82('0x11')](function(_0x461476){logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x461476);_0x5cccb6(_0x461476);});});}exports[_0x4d82('0x12')]=function(_0x258c59){var _0x217b72=this;return new Promise(function(_0x2f2127,_0x5ef783){return db[_0x4d82('0x13')][_0x4d82('0x14')]({'raw':_0x258c59[_0x4d82('0x15')]?_0x258c59[_0x4d82('0x15')][_0x4d82('0x16')]===undefined?!![]:![]:!![],'where':_0x258c59[_0x4d82('0x15')]?_0x258c59[_0x4d82('0x15')][_0x4d82('0x17')]||null:null,'attributes':_0x258c59[_0x4d82('0x15')]?_0x258c59[_0x4d82('0x15')][_0x4d82('0x18')]||null:null,'limit':_0x258c59['options']?_0x258c59[_0x4d82('0x15')][_0x4d82('0x19')]||null:null,'include':_0x258c59['options']?_0x258c59[_0x4d82('0x15')][_0x4d82('0x1a')]?_[_0x4d82('0x1b')](_0x258c59[_0x4d82('0x15')][_0x4d82('0x1a')],function(_0x15f5d1){return{'model':db[_0x15f5d1[_0x4d82('0x1c')]],'as':_0x15f5d1['as'],'attributes':_0x15f5d1[_0x4d82('0x18')],'include':_0x15f5d1[_0x4d82('0x1a')]?_[_0x4d82('0x1b')](_0x15f5d1[_0x4d82('0x1a')],function(_0x395efc){return{'model':db[_0x395efc[_0x4d82('0x1c')]],'as':_0x395efc['as'],'attributes':_0x395efc[_0x4d82('0x18')],'include':_0x395efc[_0x4d82('0x1a')]?_['map'](_0x395efc['include'],function(_0x3dcb0f){return{'model':db[_0x3dcb0f[_0x4d82('0x1c')]],'as':_0x3dcb0f['as'],'attributes':_0x3dcb0f[_0x4d82('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4d82('0x1d')](function(_0x5cbd7e){logger[_0x4d82('0xa')](_0x4d82('0x12'),_0x258c59);logger[_0x4d82('0x1e')](_0x4d82('0x12'),_0x258c59,JSON['stringify'](_0x5cbd7e));_0x2f2127(_0x5cbd7e);})[_0x4d82('0x11')](function(_0x4a7444){logger['error']('GetTrigger',_0x4a7444['message'],_0x258c59);_0x5ef783(_0x217b72[_0x4d82('0xf')](0x1f4,_0x4a7444[_0x4d82('0x10')]));});});};exports[_0x4d82('0x1f')]=function(_0x52e320){var _0x713c56=this;return new Promise(function(_0x37cdc4,_0x5cf3e6){return db['Trigger'][_0x4d82('0x20')]({'raw':_0x52e320[_0x4d82('0x15')]?_0x52e320[_0x4d82('0x15')][_0x4d82('0x16')]===undefined?!![]:![]:!![],'where':_0x52e320['options']?_0x52e320[_0x4d82('0x15')]['where']||null:null,'attributes':_0x52e320[_0x4d82('0x15')]?_0x52e320[_0x4d82('0x15')]['attributes']||null:null,'include':_0x52e320['options']?_0x52e320[_0x4d82('0x15')][_0x4d82('0x1a')]?_[_0x4d82('0x1b')](_0x52e320[_0x4d82('0x15')][_0x4d82('0x1a')],function(_0x420b28){return{'model':db[_0x420b28[_0x4d82('0x1c')]],'as':_0x420b28['as'],'attributes':_0x420b28[_0x4d82('0x18')],'include':_0x420b28[_0x4d82('0x1a')]?_[_0x4d82('0x1b')](_0x420b28['include'],function(_0x382f43){return{'model':db[_0x382f43[_0x4d82('0x1c')]],'as':_0x382f43['as'],'attributes':_0x382f43[_0x4d82('0x18')],'include':_0x382f43['include']?_[_0x4d82('0x1b')](_0x382f43[_0x4d82('0x1a')],function(_0x57826a){return{'model':db[_0x57826a[_0x4d82('0x1c')]],'as':_0x57826a['as'],'attributes':_0x57826a[_0x4d82('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4d82('0x1d')](function(_0x5d0296){logger[_0x4d82('0xa')](_0x4d82('0x1f'),_0x52e320);logger['debug'](_0x4d82('0x1f'),_0x52e320,JSON['stringify'](_0x5d0296));_0x37cdc4(_0x5d0296);})[_0x4d82('0x11')](function(_0x2c21c9){logger['error'](_0x4d82('0x1f'),_0x2c21c9['message'],_0x52e320);_0x5cf3e6(_0x713c56[_0x4d82('0xf')](0x1f4,_0x2c21c9['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 249762c..460f189 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 _0x55ca=['show','post','clone','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id'];(function(_0x2a9f85,_0x124501){var _0x479395=function(_0x46340d){while(--_0x46340d){_0x2a9f85['push'](_0x2a9f85['shift']());}};_0x479395(++_0x124501);}(_0x55ca,0x126));var _0xa55c=function(_0x5c6244,_0x112ab8){_0x5c6244=_0x5c6244-0x0;var _0x5800ce=_0x55ca[_0x5c6244];return _0x5800ce;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0xb')]('/:id/clone',auth[_0xa55c('0x7')](),controller[_0xa55c('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa55c('0xd')]);router[_0xa55c('0xe')](_0xa55c('0x9'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x10')](_0xa55c('0x9'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);module[_0xa55c('0x12')]=router; \ No newline at end of file +var _0xeec6=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','index','isAuthenticated','show','post','/:id/clone','clone','update','exports'];(function(_0x45ceb0,_0x58cb7b){var _0x3d1b1d=function(_0x449462){while(--_0x449462){_0x45ceb0['push'](_0x45ceb0['shift']());}};_0x3d1b1d(++_0x58cb7b);}(_0xeec6,0x1c2));var _0x6eec=function(_0x3a5648,_0x58054e){_0x3a5648=_0x3a5648-0x0;var _0x34126d=_0xeec6[_0x3a5648];return _0x34126d;};'use strict';var multer=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var path=require(_0x6eec('0x2'));var timeout=require(_0x6eec('0x3'));var express=require('express');var router=express[_0x6eec('0x4')]();var auth=require(_0x6eec('0x5'));var interaction=require(_0x6eec('0x6'));var config=require(_0x6eec('0x7'));var controller=require(_0x6eec('0x8'));router[_0x6eec('0x9')]('/',auth['isAuthenticated'](),controller[_0x6eec('0xa')]);router[_0x6eec('0x9')]('/:id',auth[_0x6eec('0xb')](),controller[_0x6eec('0xc')]);router[_0x6eec('0xd')](_0x6eec('0xe'),auth['isAuthenticated'](),controller[_0x6eec('0xf')]);router[_0x6eec('0xd')]('/',auth[_0x6eec('0xb')](),controller['create']);router['put']('/:id',auth[_0x6eec('0xb')](),controller[_0x6eec('0x10')]);router['delete']('/:id',auth[_0x6eec('0xb')](),controller['destroy']);module[_0x6eec('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 3a6695e..5cc9265 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 _0xbf77=['name','peer','friend','STRING','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','rfc2833','info','inband','auto','nonat','outgoing','yes','nat','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<>','always','accept','refuse','uac','uas','pai','fingerprint','active','dynamic','update','update,nonat','BOOLEAN','sequelize','exports'];(function(_0x2a9202,_0x5e68cb){var _0x316625=function(_0x4ae297){while(--_0x4ae297){_0x2a9202['push'](_0x2a9202['shift']());}};_0x316625(++_0x5e68cb);}(_0xbf77,0x97));var _0x7bf7=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xbf77[_0x32f7d7];return _0x133d09;};'use strict';var Sequelize=require(_0x7bf7('0x0'));module[_0x7bf7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7bf7('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend','user',_0x7bf7('0x3')),'allowNull':![],'defaultValue':_0x7bf7('0x4')},'context':{'type':Sequelize[_0x7bf7('0x5')],'allowNull':![],'defaultValue':_0x7bf7('0x6')},'callingpres':{'type':Sequelize[_0x7bf7('0x7')](_0x7bf7('0x8'),_0x7bf7('0x9'),_0x7bf7('0xa'),_0x7bf7('0xb'),_0x7bf7('0xc'),_0x7bf7('0xd'),_0x7bf7('0xe'),_0x7bf7('0xf'))},'deny':{'type':Sequelize[_0x7bf7('0x5')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x7bf7('0x5')]},'md5secret':{'type':Sequelize[_0x7bf7('0x5')]},'remotesecret':{'type':Sequelize[_0x7bf7('0x5')]},'transport':{'type':Sequelize[_0x7bf7('0x5')],'defaultValue':'udp','set':function(_0x1edf47){this[_0x7bf7('0x10')](_0x7bf7('0x11'),_0x1edf47?_0x1edf47[_0x7bf7('0x12')](','):null);},'get':function(){return this[_0x7bf7('0x13')](_0x7bf7('0x11'))?this[_0x7bf7('0x13')](_0x7bf7('0x11'))[_0x7bf7('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x7bf7('0x7')](_0x7bf7('0x15'),_0x7bf7('0x16'),'shortinfo',_0x7bf7('0x17'),_0x7bf7('0x18')),'defaultValue':_0x7bf7('0x15')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x7bf7('0x19'),'update',_0x7bf7('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x7bf7('0x7')](_0x7bf7('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x7bf7('0x5')]},'nat':{'type':Sequelize[_0x7bf7('0x5')],'defaultValue':'force_rport,comedia','set':function(_0x31614b){this[_0x7bf7('0x10')]('nat',_0x31614b?_0x31614b[_0x7bf7('0x12')](','):null);},'get':function(){return this[_0x7bf7('0x13')](_0x7bf7('0x1c'))?this['getDataValue'](_0x7bf7('0x1c'))[_0x7bf7('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x7bf7('0x5')]},'namedcallgroup':{'type':Sequelize[_0x7bf7('0x5')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x7bf7('0x5')]},'language':{'type':Sequelize[_0x7bf7('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7bf7('0x5')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x7bf7('0x1d')},'allow':{'type':Sequelize[_0x7bf7('0x5')],'allowNull':![],'defaultValue':_0x7bf7('0x1e'),'set':function(_0x117702){this[_0x7bf7('0x10')]('allow',_0x117702?_0x117702[_0x7bf7('0x12')](';'):_0x7bf7('0x1e'));},'get':function(){return this['getDataValue'](_0x7bf7('0x1f'))?this['getDataValue'](_0x7bf7('0x1f'))[_0x7bf7('0x14')](';'):null;},'comment':_0x7bf7('0x20')},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x7bf7('0x21'),'set':function(_0x178391){this[_0x7bf7('0x10')](_0x7bf7('0x22'),_0x178391?_0x178391['join'](','):null);},'get':function(){return this[_0x7bf7('0x13')]('insecure')?this[_0x7bf7('0x13')](_0x7bf7('0x22'))[_0x7bf7('0x14')](','):null;},'comment':_0x7bf7('0x23')},'trustrpid':{'type':Sequelize[_0x7bf7('0x7')](_0x7bf7('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7bf7('0x7')](_0x7bf7('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7bf7('0x7')](_0x7bf7('0x1b'),'no',_0x7bf7('0x24'))},'promiscredir':{'type':Sequelize['ENUM'](_0x7bf7('0x1b'),'no')},'useclientcode':{'type':Sequelize[_0x7bf7('0x7')](_0x7bf7('0x1b'),'no')},'accountcode':{'type':Sequelize[_0x7bf7('0x25')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x7bf7('0x26')},'amaflags':{'type':Sequelize[_0x7bf7('0x5')]},'callcounter':{'type':Sequelize[_0x7bf7('0x7')](_0x7bf7('0x1b'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x7bf7('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x7bf7('0x7')](_0x7bf7('0x1b'),'no')},'allowsubscribe':{'type':Sequelize[_0x7bf7('0x7')](_0x7bf7('0x1b'),'no')},'allowtransfer':{'type':Sequelize[_0x7bf7('0x7')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x7bf7('0x7')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x7bf7('0x5')]},'template':{'type':Sequelize[_0x7bf7('0x5')]},'videosupport':{'type':Sequelize['ENUM'](_0x7bf7('0x1b'),'no',_0x7bf7('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x7bf7('0x7')](_0x7bf7('0x1b'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x7bf7('0x7')](_0x7bf7('0x28'),_0x7bf7('0x29'),'originate')},'session_expires':{'type':Sequelize[_0x7bf7('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x7bf7('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x7bf7('0x7')](_0x7bf7('0x2a'),_0x7bf7('0x2b')),'defaultValue':_0x7bf7('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x7bf7('0x5')]},'regexten':{'type':Sequelize[_0x7bf7('0x5')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x7bf7('0x5')]},'port':{'type':Sequelize[_0x7bf7('0x25')](0x5)},'qualify':{'type':Sequelize[_0x7bf7('0x7')](_0x7bf7('0x1b'),'no'),'defaultValue':_0x7bf7('0x1b')},'keepalive':{'type':Sequelize[_0x7bf7('0x25')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x7bf7('0x5')]},'rtptimeout':{'type':Sequelize[_0x7bf7('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x7bf7('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x7bf7('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x7bf7('0x7')]('yes','no',_0x7bf7('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x7bf7('0x5')]},'timert1':{'type':Sequelize[_0x7bf7('0x25')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x7bf7('0x5')]},'contactdeny':{'type':Sequelize[_0x7bf7('0x5')]},'contactacl':{'type':Sequelize[_0x7bf7('0x5')]},'unsolicited_mailbox':{'type':Sequelize[_0x7bf7('0x5')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x7bf7('0x25')](0xb)},'encryption':{'type':Sequelize[_0x7bf7('0x7')](_0x7bf7('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7bf7('0x7')](_0x7bf7('0x1b'),'no')},'force_avp':{'type':Sequelize[_0x7bf7('0x7')](_0x7bf7('0x1b'),'no')},'icesupport':{'type':Sequelize[_0x7bf7('0x7')](_0x7bf7('0x1b'),'no')},'dtlsenable':{'type':Sequelize[_0x7bf7('0x7')](_0x7bf7('0x1b'),'no')},'dtlsverify':{'type':Sequelize[_0x7bf7('0x7')](_0x7bf7('0x1b'),'no',_0x7bf7('0x2d'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x7bf7('0x25')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x7bf7('0x5')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x7bf7('0x5')]},'dtlssetup':{'type':Sequelize[_0x7bf7('0x7')](_0x7bf7('0x2e'),'passive','actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7bf7('0x5')]},'usereqphone':{'type':Sequelize[_0x7bf7('0x7')](_0x7bf7('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x7bf7('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x7bf7('0x1b'),'no')},'subscribemwi':{'type':Sequelize[_0x7bf7('0x7')](_0x7bf7('0x1b'),'no')},'vmexten':{'type':Sequelize[_0x7bf7('0x5')]},'mohinterpret':{'type':Sequelize[_0x7bf7('0x5')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x7bf7('0x5')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x7bf7('0x5')],'defaultValue':_0x7bf7('0x2f')},'canreinvite':{'type':Sequelize['ENUM'](_0x7bf7('0x1b'),'no',_0x7bf7('0x19'),_0x7bf7('0x30'),_0x7bf7('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x7bf7('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x7bf7('0x5')],'defaultValue':'no'}}; \ No newline at end of file +var _0x3202=['name','ENUM','user','peer','friend','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','join','getDataValue','transport','split','rfc2833','info','shortinfo','inband','auto','nonat','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','yes','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','uac','uas','pai','fingerprint','certificate','active','actpass','dynamic','update','update,nonat','sequelize','exports','STRING'];(function(_0xec20ae,_0x518a6e){var _0x5a548f=function(_0x5b0b81){while(--_0x5b0b81){_0xec20ae['push'](_0xec20ae['shift']());}};_0x5a548f(++_0x518a6e);}(_0x3202,0x13b));var _0x2320=function(_0x596fca,_0x561214){_0x596fca=_0x596fca-0x0;var _0x1e64f1=_0x3202[_0x596fca];return _0x1e64f1;};'use strict';var Sequelize=require(_0x2320('0x0'));module[_0x2320('0x1')]={'name':{'type':Sequelize[_0x2320('0x2')],'allowNull':![],'unique':_0x2320('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2320('0x4')]('friend',_0x2320('0x5'),_0x2320('0x6')),'allowNull':![],'defaultValue':_0x2320('0x7')},'context':{'type':Sequelize[_0x2320('0x2')],'allowNull':![],'defaultValue':_0x2320('0x8')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x2320('0x9'),_0x2320('0xa'),_0x2320('0xb'),_0x2320('0xc'),'PROHIB_PASSED_SCREEN',_0x2320('0xd'),_0x2320('0xe'))},'deny':{'type':Sequelize[_0x2320('0x2')]},'permit':{'type':Sequelize[_0x2320('0x2')]},'secret':{'type':Sequelize[_0x2320('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x2320('0x2')]},'transport':{'type':Sequelize[_0x2320('0x2')],'defaultValue':_0x2320('0xf'),'set':function(_0x42065b){this[_0x2320('0x10')]('transport',_0x42065b?_0x42065b[_0x2320('0x11')](','):null);},'get':function(){return this[_0x2320('0x12')]('transport')?this[_0x2320('0x12')](_0x2320('0x13'))[_0x2320('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x15'),_0x2320('0x16'),_0x2320('0x17'),_0x2320('0x18'),_0x2320('0x19')),'defaultValue':_0x2320('0x15')},'directmedia':{'type':Sequelize[_0x2320('0x4')]('yes','no',_0x2320('0x1a'),'update','outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2320('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x2320('0x2')]},'directmediadeny':{'type':Sequelize[_0x2320('0x2')]},'nat':{'type':Sequelize[_0x2320('0x2')],'defaultValue':'force_rport,comedia','set':function(_0x54dae9){this['setDataValue'](_0x2320('0x1b'),_0x54dae9?_0x54dae9['join'](','):null);},'get':function(){return this['getDataValue'](_0x2320('0x1b'))?this[_0x2320('0x12')](_0x2320('0x1b'))[_0x2320('0x14')](','):null;},'comment':_0x2320('0x1c')},'callgroup':{'type':Sequelize[_0x2320('0x2')]},'namedcallgroup':{'type':Sequelize[_0x2320('0x2')]},'pickupgroup':{'type':Sequelize[_0x2320('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x2320('0x2')]},'language':{'type':Sequelize[_0x2320('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2320('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x2320('0x2')],'defaultValue':_0x2320('0x1d')},'allow':{'type':Sequelize[_0x2320('0x2')],'allowNull':![],'defaultValue':_0x2320('0x1e'),'set':function(_0x18d4cb){this[_0x2320('0x10')](_0x2320('0x1f'),_0x18d4cb?_0x18d4cb[_0x2320('0x11')](';'):_0x2320('0x1e'));},'get':function(){return this[_0x2320('0x12')]('allow')?this[_0x2320('0x12')](_0x2320('0x1f'))[_0x2320('0x14')](';'):null;},'comment':_0x2320('0x20')},'autoframing':{'type':Sequelize[_0x2320('0x4')]('yes','no')},'insecure':{'type':Sequelize[_0x2320('0x2')],'defaultValue':_0x2320('0x21'),'set':function(_0x178f56){this[_0x2320('0x10')](_0x2320('0x22'),_0x178f56?_0x178f56[_0x2320('0x11')](','):null);},'get':function(){return this[_0x2320('0x12')]('insecure')?this['getDataValue'](_0x2320('0x22'))[_0x2320('0x14')](','):null;},'comment':_0x2320('0x23')},'trustrpid':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no',_0x2320('0x25'))},'promiscredir':{'type':Sequelize['ENUM'](_0x2320('0x24'),'no')},'useclientcode':{'type':Sequelize['ENUM']('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x2320('0x2')],'defaultValue':_0x2320('0x26')},'amaflags':{'type':Sequelize[_0x2320('0x2')]},'callcounter':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no'),'defaultValue':_0x2320('0x24')},'busylevel':{'type':Sequelize[_0x2320('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no')},'allowsubscribe':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no')},'allowtransfer':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x2320('0x24'),'no')},'subscribecontext':{'type':Sequelize[_0x2320('0x2')]},'template':{'type':Sequelize[_0x2320('0x2')]},'videosupport':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no',_0x2320('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2320('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no')},'mailbox':{'type':Sequelize[_0x2320('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x2320('0x29'),_0x2320('0x2a'),'originate')},'session_expires':{'type':Sequelize[_0x2320('0x27')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x2320('0x2b'),_0x2320('0x2c')),'defaultValue':_0x2320('0x2c')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x2320('0x2')]},'fromdomain':{'type':Sequelize[_0x2320('0x2')]},'fromuser':{'type':Sequelize[_0x2320('0x2')]},'port':{'type':Sequelize[_0x2320('0x27')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x2320('0x24'),'no'),'defaultValue':_0x2320('0x24')},'keepalive':{'type':Sequelize[_0x2320('0x27')](0xb)},'defaultip':{'type':Sequelize[_0x2320('0x2')]},'defaultuser':{'type':Sequelize[_0x2320('0x2')]},'rtptimeout':{'type':Sequelize[_0x2320('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2320('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no',_0x2320('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2320('0x2')]},'callbackextension':{'type':Sequelize[_0x2320('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x2320('0x27')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x2320('0x2')]},'contactdeny':{'type':Sequelize[_0x2320('0x2')]},'contactacl':{'type':Sequelize[_0x2320('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x2320('0x2')]},'use_q850_reason':{'type':Sequelize[_0x2320('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no')},'force_avp':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no')},'icesupport':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no')},'dtlsenable':{'type':Sequelize[_0x2320('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no',_0x2320('0x2e'),_0x2320('0x2f'))},'dtlsrekey':{'type':Sequelize[_0x2320('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0x2320('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x2320('0x2')]},'dtlscipher':{'type':Sequelize[_0x2320('0x2')]},'dtlscafile':{'type':Sequelize[_0x2320('0x2')]},'dtlscapath':{'type':Sequelize[_0x2320('0x2')]},'dtlssetup':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x30'),'passive',_0x2320('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2320('0x2')]},'usereqphone':{'type':Sequelize[_0x2320('0x4')](_0x2320('0x24'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2320('0x2')]},'recordofffeature':{'type':Sequelize[_0x2320('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2320('0x4')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x2320('0x4')]('yes','no')},'vmexten':{'type':Sequelize[_0x2320('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x2320('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x2320('0x2')],'defaultValue':_0x2320('0x32')},'canreinvite':{'type':Sequelize[_0x2320('0x4')]('yes','no',_0x2320('0x1a'),_0x2320('0x33'),_0x2320('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2320('0x2')]},'otherFields':{'type':Sequelize[_0x2320('0x2')]},'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 58b315c..5b457a9 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 _0x9861=['find','clone','params','omit','createdAt','updatedAt','body','create','user','role','UserProfileSection','userProfileId','autoAssociation','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','/etc/asterisk/sip_xcally_registers.conf','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','save','get','UserProfileResource','destroy','sendStatus','name','send','map','Trunk','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','show','rawAttributes','keys'];(function(_0x3dc135,_0x546abc){var _0x517300=function(_0x12dbe7){while(--_0x12dbe7){_0x3dc135['push'](_0x3dc135['shift']());}};_0x517300(++_0x546abc);}(_0x9861,0x176));var _0x1986=function(_0x39e5a2,_0x4a0680){_0x39e5a2=_0x39e5a2-0x0;var _0x39684a=_0x9861[_0x39e5a2];return _0x39684a;};'use strict';var pdf=require(_0x1986('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1986('0x1'));var jsonpatch=require(_0x1986('0x2'));var rp=require(_0x1986('0x3'));var moment=require(_0x1986('0x4'));var BPromise=require(_0x1986('0x5'));var Mustache=require(_0x1986('0x6'));var util=require('util');var path=require(_0x1986('0x7'));var sox=require(_0x1986('0x8'));var csv=require(_0x1986('0x9'));var ejs=require(_0x1986('0xa'));var fs=require('fs');var _=require(_0x1986('0xb'));var squel=require(_0x1986('0xc'));var crypto=require(_0x1986('0xd'));var jsforce=require(_0x1986('0xe'));var deskjs=require(_0x1986('0xf'));var toCsv=require(_0x1986('0x9'));var querystring=require('querystring');var Papa=require(_0x1986('0x10'));var Redis=require(_0x1986('0x11'));var authService=require(_0x1986('0x12'));var qs=require(_0x1986('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1986('0x14'));var logger=require(_0x1986('0x15'))('api');var utils=require(_0x1986('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x1986('0x17'));var client=jayson[_0x1986('0x18')][_0x1986('0x19')]({'port':0x232a});function checkPasswordPattern(_0x2de9ba,_0x15a544,_0x350e4d){if(_0x350e4d){var _0x1dc290=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1dc290[_0x1986('0x1a')](_0x15a544)){return _0x2de9ba;}else{throw new db[(_0x1986('0x1b'))][(_0x1986('0x1c'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x2de9ba;}}function respondWithRpcPromise(_0x570229,_0x12984d,_0x3d0207,_0x59228f){return new BPromise(function(_0x3b4244,_0xf4c7bc){var _0x292d42=_0x59228f||client;return _0x292d42[_0x1986('0x1d')](_0x570229,_0x3d0207)[_0x1986('0x1e')](function(_0x44fcf1){logger[_0x1986('0x1f')](_0x1986('0x20'),_0x12984d,_0x1986('0x21'));logger[_0x1986('0x22')](_0x1986('0x23'),_0x12984d,_0x1986('0x21'),JSON[_0x1986('0x24')](_0x44fcf1));if(_0x44fcf1[_0x1986('0x25')]){if(_0x44fcf1['error'][_0x1986('0x26')]===0x1f4){logger[_0x1986('0x25')]('Trunk,\x20%s,\x20%s',_0x12984d,_0x44fcf1[_0x1986('0x25')][_0x1986('0x27')]);return _0xf4c7bc(_0x44fcf1['error']['message']);}logger[_0x1986('0x25')](_0x1986('0x20'),_0x12984d,_0x44fcf1[_0x1986('0x25')]['message']);return _0x3b4244(_0x44fcf1[_0x1986('0x25')][_0x1986('0x27')]);}else{logger[_0x1986('0x1f')]('Trunk,\x20%s,\x20%s',_0x12984d,_0x1986('0x21'));_0x3b4244(_0x44fcf1[_0x1986('0x28')][_0x1986('0x27')]);}})[_0x1986('0x29')](function(_0x9771ed){logger['error'](_0x1986('0x20'),_0x12984d,_0x9771ed);_0xf4c7bc(_0x9771ed);});});}function respondWithStatusCode(_0x518f3c,_0x19fd8a){_0x19fd8a=_0x19fd8a||0xcc;return function(_0xe23114){if(_0xe23114){return _0x518f3c['sendStatus'](_0x19fd8a);}return _0x518f3c[_0x1986('0x2a')](_0x19fd8a)[_0x1986('0x2b')]();};}function respondWithResult(_0x3b8f25,_0x5790e2){_0x5790e2=_0x5790e2||0xc8;return function(_0x5e09d6){if(_0x5e09d6){return _0x3b8f25[_0x1986('0x2a')](_0x5790e2)[_0x1986('0x2c')](_0x5e09d6);}};}function respondWithFilteredResult(_0x5cd318,_0x2ff2c9){return function(_0x1eb9b0){if(_0x1eb9b0){var _0x1dcd2c=_0x1eb9b0[_0x1986('0x2d')],_0x455937=_0x2ff2c9[_0x1986('0x2e')],_0x4d7ed1=_0x2ff2c9['offset']+_0x2ff2c9[_0x1986('0x2f')],_0x39796d;if(_0x4d7ed1>=_0x1dcd2c){_0x4d7ed1=_0x1dcd2c;_0x39796d=0xc8;}else{_0x39796d=0xce;}_0x5cd318[_0x1986('0x2a')](_0x39796d);return _0x5cd318[_0x1986('0x30')](_0x1986('0x31'),_0x455937+'-'+_0x4d7ed1+'/'+_0x1dcd2c)[_0x1986('0x2c')](_0x1eb9b0);}return null;};}function patchUpdates(_0x27911e){return function(_0x45e90c){try{jsonpatch['apply'](_0x45e90c,_0x27911e,!![]);}catch(_0x3c4b2d){return BPromise[_0x1986('0x32')](_0x3c4b2d);}return _0x45e90c[_0x1986('0x33')]();};}function saveUpdates(_0x48e37b,_0x368234){return function(_0x2d4bcc){if(_0x2d4bcc){return _0x2d4bcc['update'](_0x48e37b)['then'](function(_0x1f7eae){return _0x1f7eae;});}return null;};}function removeEntity(_0x417385,_0x30bef0){return function(_0x3260a4){if(_0x3260a4){return _0x3260a4['destroy']()['then'](function(){var _0x1faed8=_0x3260a4[_0x1986('0x34')]({'plain':!![]});var _0x55ab3d='Trunks';return db[_0x1986('0x35')][_0x1986('0x36')]({'where':{'type':_0x55ab3d,'resourceId':_0x1faed8['id']}})['then'](function(){return _0x3260a4;});})[_0x1986('0x1e')](function(){_0x417385[_0x1986('0x2a')](0xcc)[_0x1986('0x2b')]();});}};}function handleEntityNotFound(_0x1b287f,_0x4f89e3){return function(_0x31fd4e){if(!_0x31fd4e){_0x1b287f[_0x1986('0x37')](0x194);}return _0x31fd4e;};}function handleError(_0x2220c3,_0x4c4bd5){_0x4c4bd5=_0x4c4bd5||0x1f4;return function(_0x57dcaa){logger[_0x1986('0x25')](_0x57dcaa['stack']);if(_0x57dcaa[_0x1986('0x38')]){delete _0x57dcaa[_0x1986('0x38')];}_0x2220c3[_0x1986('0x2a')](_0x4c4bd5)[_0x1986('0x39')](_0x57dcaa);};}exports['index']=function(_0x3ca268,_0xc58f5d){var _0x451727={},_0x35f9a2={},_0x507b91={'count':0x0,'rows':[]};var _0x1da633=_[_0x1986('0x3a')](db[_0x1986('0x3b')]['rawAttributes'],function(_0x406b06){return{'name':_0x406b06[_0x1986('0x3c')],'type':_0x406b06[_0x1986('0x3d')][_0x1986('0x3e')]};});_0x35f9a2[_0x1986('0x3f')]=_['map'](_0x1da633,_0x1986('0x38'));_0x35f9a2['query']=_['keys'](_0x3ca268[_0x1986('0x40')]);_0x35f9a2['filters']=_[_0x1986('0x41')](_0x35f9a2['model'],_0x35f9a2['query']);_0x451727['attributes']=_[_0x1986('0x41')](_0x35f9a2[_0x1986('0x3f')],qs[_0x1986('0x42')](_0x3ca268[_0x1986('0x40')][_0x1986('0x42')]));_0x451727[_0x1986('0x43')]=_0x451727['attributes'][_0x1986('0x44')]?_0x451727[_0x1986('0x43')]:_0x35f9a2[_0x1986('0x3f')];if(!_0x3ca268['query'][_0x1986('0x45')](_0x1986('0x46'))){_0x451727[_0x1986('0x2f')]=qs[_0x1986('0x2f')](_0x3ca268[_0x1986('0x40')]['limit']);_0x451727[_0x1986('0x2e')]=qs[_0x1986('0x2e')](_0x3ca268['query']['offset']);}_0x451727[_0x1986('0x47')]=qs[_0x1986('0x48')](_0x3ca268[_0x1986('0x40')][_0x1986('0x48')]);_0x451727[_0x1986('0x49')]=qs[_0x1986('0x4a')](_[_0x1986('0x4b')](_0x3ca268[_0x1986('0x40')],_0x35f9a2[_0x1986('0x4a')]),_0x1da633);if(_0x3ca268[_0x1986('0x40')]['filter']){_0x451727['where']=_[_0x1986('0x4c')](_0x451727[_0x1986('0x49')],{'$or':_[_0x1986('0x3a')](_0x1da633,function(_0x21a02a){if(_0x21a02a['type']!=='VIRTUAL'){var _0x465d08={};_0x465d08[_0x21a02a['name']]={'$like':'%'+_0x3ca268[_0x1986('0x40')][_0x1986('0x4d')]+'%'};return _0x465d08;}})});}_0x451727=_[_0x1986('0x4c')]({},_0x451727,_0x3ca268[_0x1986('0x4e')]);var _0x43482f={'where':_0x451727[_0x1986('0x49')]};return db[_0x1986('0x3b')]['count'](_0x43482f)[_0x1986('0x1e')](function(_0x396f6b){_0x507b91[_0x1986('0x2d')]=_0x396f6b;if(_0x3ca268[_0x1986('0x40')][_0x1986('0x4f')]){_0x451727[_0x1986('0x50')]=[{'all':!![]}];}return db[_0x1986('0x3b')][_0x1986('0x51')](_0x451727);})[_0x1986('0x1e')](function(_0x360abe){_0x507b91[_0x1986('0x52')]=_0x360abe;return _0x507b91;})[_0x1986('0x1e')](respondWithFilteredResult(_0xc58f5d,_0x451727))[_0x1986('0x29')](handleError(_0xc58f5d,null));};exports[_0x1986('0x53')]=function(_0x335585,_0x43c9d9){var _0x167801={'raw':![],'where':{'id':_0x335585['params']['id']}},_0x20d6e4={};_0x20d6e4[_0x1986('0x3f')]=_['keys'](db[_0x1986('0x3b')][_0x1986('0x54')]);_0x20d6e4[_0x1986('0x40')]=_[_0x1986('0x55')](_0x335585[_0x1986('0x40')]);_0x20d6e4[_0x1986('0x4a')]=_[_0x1986('0x41')](_0x20d6e4[_0x1986('0x3f')],_0x20d6e4[_0x1986('0x40')]);_0x167801[_0x1986('0x43')]=_[_0x1986('0x41')](_0x20d6e4['model'],qs[_0x1986('0x42')](_0x335585['query'][_0x1986('0x42')]));_0x167801['attributes']=_0x167801[_0x1986('0x43')][_0x1986('0x44')]?_0x167801[_0x1986('0x43')]:_0x20d6e4['model'];if(_0x335585[_0x1986('0x40')][_0x1986('0x4f')]){_0x167801[_0x1986('0x50')]=[{'all':!![]}];}_0x167801=_[_0x1986('0x4c')]({},_0x167801,_0x335585[_0x1986('0x4e')]);return db['Trunk'][_0x1986('0x56')](_0x167801)[_0x1986('0x1e')](handleEntityNotFound(_0x43c9d9,null))[_0x1986('0x1e')](respondWithResult(_0x43c9d9,null))[_0x1986('0x29')](handleError(_0x43c9d9,null));};exports[_0x1986('0x57')]=function(_0x5501b4,_0x19b2c0){var _0x126e26={'where':{'id':_0x5501b4[_0x1986('0x58')]['id']}},_0x23a770={};_0x23a770[_0x1986('0x3f')]=_['keys'](db[_0x1986('0x3b')]['rawAttributes']);_0x126e26[_0x1986('0x43')]=_[_0x1986('0x41')](_0x23a770[_0x1986('0x3f')],qs['fields'](_0x5501b4[_0x1986('0x40')][_0x1986('0x42')]));_0x126e26[_0x1986('0x43')]=_0x126e26[_0x1986('0x43')][_0x1986('0x44')]?_0x126e26['attributes']:_0x23a770[_0x1986('0x3f')];if(_0x5501b4[_0x1986('0x40')][_0x1986('0x4f')]){_0x126e26[_0x1986('0x50')]=[{'all':!![]}];}_0x126e26=_['merge']({},_0x126e26,_0x5501b4[_0x1986('0x4e')]);return db[_0x1986('0x3b')][_0x1986('0x56')](_0x126e26)['then'](handleEntityNotFound(_0x19b2c0,null))[_0x1986('0x1e')](function(_0x46dba0){if(_0x46dba0){var _0x177233=_0x46dba0['get']({'plain':!![]});_0x177233=qs[_0x1986('0x59')](_0x177233,['id',_0x1986('0x5a'),_0x1986('0x5b')]);_0x5501b4[_0x1986('0x5c')]=_['omit'](_0x5501b4[_0x1986('0x5c')],['id','createdAt',_0x1986('0x5b')]);return db[_0x1986('0x3b')][_0x1986('0x5d')](_['merge'](_0x177233,_0x5501b4['body']),{'include':_0x5501b4['query'][_0x1986('0x4f')]?[{'all':!![]}]:undefined})[_0x1986('0x1e')](function(_0x4edb5d){var _0x45d460=_0x5501b4[_0x1986('0x5e')][_0x1986('0x34')]({'plain':!![]});if(!_0x45d460)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45d460[_0x1986('0x5f')]==='user'){var _0x3203cf=_0x4edb5d['get']({'plain':!![]});var _0x4a0769='Trunks';return db[_0x1986('0x60')][_0x1986('0x56')]({'where':{'name':_0x4a0769,'userProfileId':_0x45d460[_0x1986('0x61')]},'raw':!![]})[_0x1986('0x1e')](function(_0x27426b){if(_0x27426b&&_0x27426b[_0x1986('0x62')]===0x0){return db[_0x1986('0x35')][_0x1986('0x5d')]({'name':_0x3203cf['name'],'resourceId':_0x3203cf['id'],'type':_0x27426b[_0x1986('0x38')],'sectionId':_0x27426b['id']},{})[_0x1986('0x1e')](function(){return _0x4edb5d;});}else{return _0x4edb5d;}})['catch'](function(_0x1d7c16){logger[_0x1986('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d7c16);throw _0x1d7c16;});}return _0x4edb5d;});}})[_0x1986('0x1e')](respondWithResult(_0x19b2c0,0xc9))[_0x1986('0x29')](handleError(_0x19b2c0,null));};exports[_0x1986('0x5d')]=function(_0x5950d4,_0xd4e7d2,_0x26c476){var _0x420fde;return db[_0x1986('0x3b')]['create'](_0x5950d4[_0x1986('0x5c')],{'raw':!![]})[_0x1986('0x1e')](function(_0x167d2f){_0x420fde=_0x167d2f;return db['Trunk'][_0x1986('0x51')]({'raw':!![]});})[_0x1986('0x1e')](function(_0x537963){var _0x5c9e4e=fs[_0x1986('0x63')](path[_0x1986('0x64')](config[_0x1986('0x65')],_0x1986('0x66')),_0x1986('0x67'));var _0x3c4fdf=fs[_0x1986('0x63')](path['join'](config[_0x1986('0x65')],_0x1986('0x68')),'utf8');var _0x2ccb9b=ejs[_0x1986('0x69')](_0x5c9e4e,{'trunks':_0x537963||[]});fs[_0x1986('0x6a')](_0x1986('0x6b'),_0x2ccb9b);if(_0x420fde[_0x1986('0x6c')]){var _0xd1ce9d=ejs[_0x1986('0x69')](_0x3c4fdf,{'trunks':_0x537963||[]});fs[_0x1986('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0xd1ce9d);}})[_0x1986('0x1e')](function(){return respondWithRpcPromise(_0x1986('0x6d'),'create',{'module':_0x1986('0x6e')});})['then'](function(){var _0x37b337=_0x5950d4['user'][_0x1986('0x34')]({'plain':!![]});if(!_0x37b337)throw new Error(_0x1986('0x6f'));if(_0x37b337[_0x1986('0x5f')]==='user'){var _0x3901f4=_0x420fde[_0x1986('0x34')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'Trunks','userProfileId':_0x37b337[_0x1986('0x61')]},'raw':!![]})['then'](function(_0x5497a5){if(_0x5497a5&&_0x5497a5[_0x1986('0x62')]===0x0){return db[_0x1986('0x35')][_0x1986('0x5d')]({'name':_0x3901f4[_0x1986('0x38')],'resourceId':_0x3901f4['id'],'type':_0x5497a5[_0x1986('0x38')],'sectionId':_0x5497a5['id']},{})[_0x1986('0x1e')](function(){return _0x420fde;});}else{return _0x420fde;}})[_0x1986('0x29')](function(_0x3777e1){logger[_0x1986('0x25')](_0x1986('0x70'),_0x3777e1);throw _0x3777e1;});}return _0x420fde;})[_0x1986('0x1e')](respondWithResult(_0xd4e7d2,0xc9))[_0x1986('0x29')](handleError(_0xd4e7d2,null));};exports[_0x1986('0x71')]=function(_0x5cb9eb,_0x3d078e,_0x4a2ed3){var _0x5ae414;return db[_0x1986('0x3b')][_0x1986('0x56')]({'where':{'id':_0x5cb9eb['params']['id']}})[_0x1986('0x1e')](handleEntityNotFound(_0x3d078e,null))[_0x1986('0x1e')](saveUpdates(_0x5cb9eb[_0x1986('0x5c')],null))[_0x1986('0x1e')](function(_0x18596c){if(_0x18596c){_0x5ae414=_0x18596c;return db[_0x1986('0x3b')]['findAll']({'raw':!![]});}})[_0x1986('0x1e')](function(_0x5c3f28){if(_0x5c3f28){var _0x558df5=fs[_0x1986('0x63')](path[_0x1986('0x64')](config[_0x1986('0x65')],_0x1986('0x66')),_0x1986('0x67'));var _0x249efa=fs['readFileSync'](path[_0x1986('0x64')](config[_0x1986('0x65')],_0x1986('0x68')),'utf8');var _0x1e48d1=ejs[_0x1986('0x69')](_0x558df5,{'trunks':_0x5c3f28||[]});fs[_0x1986('0x6a')](_0x1986('0x6b'),_0x1e48d1);var _0x527673=ejs[_0x1986('0x69')](_0x249efa,{'trunks':_0x5c3f28||[]});fs[_0x1986('0x6a')](_0x1986('0x72'),_0x527673);return respondWithRpcPromise(_0x1986('0x6d'),'update',{'module':_0x1986('0x6e')});}return null;})[_0x1986('0x1e')](function(_0x78802){if(_0x78802){return _0x5ae414;}})['then'](respondWithResult(_0x3d078e,null))[_0x1986('0x29')](handleError(_0x3d078e,null));};exports[_0x1986('0x36')]=function(_0xa3fd12,_0xf84d9b,_0x1e0ad5){var _0x386303;return db[_0x1986('0x3b')][_0x1986('0x56')]({'where':{'id':_0xa3fd12[_0x1986('0x58')]['id']}})[_0x1986('0x1e')](handleEntityNotFound(_0xf84d9b,null))[_0x1986('0x1e')](removeEntity(_0xf84d9b,null))[_0x1986('0x1e')](function(){return db[_0x1986('0x3b')][_0x1986('0x51')]({'raw':!![]});})['then'](function(_0x1cfd2a){var _0x4d23a9=fs[_0x1986('0x63')](path['join'](config[_0x1986('0x65')],'server/files/templates/trunk.ejs'),'utf8');var _0x3f4151=fs[_0x1986('0x63')](path[_0x1986('0x64')](config[_0x1986('0x65')],_0x1986('0x68')),_0x1986('0x67'));var _0x49755c=ejs[_0x1986('0x69')](_0x4d23a9,{'trunks':_0x1cfd2a});var _0x1aae58=ejs[_0x1986('0x69')](_0x3f4151,{'trunks':_0x1cfd2a});fs[_0x1986('0x6a')](_0x1986('0x6b'),_0x49755c);fs[_0x1986('0x6a')](_0x1986('0x72'),_0x1aae58);return respondWithRpcPromise(_0x1986('0x6d'),_0x1986('0x36'),{'module':_0x1986('0x6e')});})[_0x1986('0x29')](handleError(_0xf84d9b,null));}; \ No newline at end of file +var _0xd523=['server/files/templates/trunk.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','server/files/templates/registry.ejs','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','Trunk,\x20%s,\x20%s','message','result','catch','status','end','json','offset','limit','Content-Range','apply','reject','update','destroy','Trunks','UserProfileResource','sendStatus','stack','name','index','map','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','filter','options','count','includeAll','Trunk','show','params','find','clone','include','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','join','root'];(function(_0x3e3509,_0x2531e7){var _0x2d8596=function(_0x4e18fc){while(--_0x4e18fc){_0x3e3509['push'](_0x3e3509['shift']());}};_0x2d8596(++_0x2531e7);}(_0xd523,0x153));var _0x3d52=function(_0xd53b3e,_0x10e746){_0xd53b3e=_0xd53b3e-0x0;var _0x432020=_0xd523[_0xd53b3e];return _0x432020;};'use strict';var pdf=require(_0x3d52('0x0'));var emlformat=require(_0x3d52('0x1'));var rimraf=require(_0x3d52('0x2'));var zipdir=require(_0x3d52('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d52('0x4'));var moment=require(_0x3d52('0x5'));var BPromise=require(_0x3d52('0x6'));var Mustache=require('mustache');var util=require(_0x3d52('0x7'));var path=require(_0x3d52('0x8'));var sox=require(_0x3d52('0x9'));var csv=require(_0x3d52('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x3d52('0xb'));var crypto=require(_0x3d52('0xc'));var jsforce=require(_0x3d52('0xd'));var deskjs=require(_0x3d52('0xe'));var toCsv=require(_0x3d52('0xa'));var querystring=require(_0x3d52('0xf'));var Papa=require(_0x3d52('0x10'));var Redis=require(_0x3d52('0x11'));var authService=require(_0x3d52('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3d52('0x13'));var hardwareService=require(_0x3d52('0x14'));var logger=require(_0x3d52('0x15'))(_0x3d52('0x16'));var utils=require(_0x3d52('0x17'));var config=require('../../config/environment');var db=require(_0x3d52('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x3d52('0x19')]({'port':0x232a});function checkPasswordPattern(_0x42b184,_0x4fcdab,_0x511971){if(_0x511971){var _0x546bb4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x546bb4[_0x3d52('0x1a')](_0x4fcdab)){return _0x42b184;}else{throw new db[(_0x3d52('0x1b'))][(_0x3d52('0x1c'))](_0x3d52('0x1d'));}}else{return _0x42b184;}}function respondWithRpcPromise(_0x336261,_0x5add11,_0x1aaa98,_0x36acb8){return new BPromise(function(_0x2e956d,_0x360659){var _0x153c89=_0x36acb8||client;return _0x153c89[_0x3d52('0x1e')](_0x336261,_0x1aaa98)[_0x3d52('0x1f')](function(_0x10ec1e){logger[_0x3d52('0x20')]('Trunk,\x20%s,\x20%s',_0x5add11,_0x3d52('0x21'));logger[_0x3d52('0x22')](_0x3d52('0x23'),_0x5add11,'request\x20sent',JSON[_0x3d52('0x24')](_0x10ec1e));if(_0x10ec1e[_0x3d52('0x25')]){if(_0x10ec1e[_0x3d52('0x25')]['code']===0x1f4){logger[_0x3d52('0x25')](_0x3d52('0x26'),_0x5add11,_0x10ec1e[_0x3d52('0x25')][_0x3d52('0x27')]);return _0x360659(_0x10ec1e[_0x3d52('0x25')][_0x3d52('0x27')]);}logger[_0x3d52('0x25')](_0x3d52('0x26'),_0x5add11,_0x10ec1e['error'][_0x3d52('0x27')]);return _0x2e956d(_0x10ec1e[_0x3d52('0x25')][_0x3d52('0x27')]);}else{logger['info'](_0x3d52('0x26'),_0x5add11,_0x3d52('0x21'));_0x2e956d(_0x10ec1e[_0x3d52('0x28')][_0x3d52('0x27')]);}})[_0x3d52('0x29')](function(_0x349b30){logger[_0x3d52('0x25')](_0x3d52('0x26'),_0x5add11,_0x349b30);_0x360659(_0x349b30);});});}function respondWithStatusCode(_0x44ba59,_0x16b9d8){_0x16b9d8=_0x16b9d8||0xcc;return function(_0x1ef6db){if(_0x1ef6db){return _0x44ba59['sendStatus'](_0x16b9d8);}return _0x44ba59[_0x3d52('0x2a')](_0x16b9d8)[_0x3d52('0x2b')]();};}function respondWithResult(_0x2e3957,_0xbefe8c){_0xbefe8c=_0xbefe8c||0xc8;return function(_0x490ce5){if(_0x490ce5){return _0x2e3957['status'](_0xbefe8c)[_0x3d52('0x2c')](_0x490ce5);}};}function respondWithFilteredResult(_0x11bf44,_0x28e50d){return function(_0x5adddf){if(_0x5adddf){var _0x209cca=_0x5adddf['count'],_0x4312a7=_0x28e50d[_0x3d52('0x2d')],_0x2fd0ec=_0x28e50d[_0x3d52('0x2d')]+_0x28e50d[_0x3d52('0x2e')],_0x2f2934;if(_0x2fd0ec>=_0x209cca){_0x2fd0ec=_0x209cca;_0x2f2934=0xc8;}else{_0x2f2934=0xce;}_0x11bf44[_0x3d52('0x2a')](_0x2f2934);return _0x11bf44['set'](_0x3d52('0x2f'),_0x4312a7+'-'+_0x2fd0ec+'/'+_0x209cca)['json'](_0x5adddf);}return null;};}function patchUpdates(_0x5f006b){return function(_0x389582){try{jsonpatch[_0x3d52('0x30')](_0x389582,_0x5f006b,!![]);}catch(_0x5e4e7b){return BPromise[_0x3d52('0x31')](_0x5e4e7b);}return _0x389582['save']();};}function saveUpdates(_0x2dd85f,_0x4c0273){return function(_0x56ac79){if(_0x56ac79){return _0x56ac79[_0x3d52('0x32')](_0x2dd85f)[_0x3d52('0x1f')](function(_0xc9b8bc){return _0xc9b8bc;});}return null;};}function removeEntity(_0x2e0cd6,_0x410dc3){return function(_0x453f96){if(_0x453f96){return _0x453f96[_0x3d52('0x33')]()[_0x3d52('0x1f')](function(){var _0x26d1d8=_0x453f96['get']({'plain':!![]});var _0x1919a9=_0x3d52('0x34');return db[_0x3d52('0x35')][_0x3d52('0x33')]({'where':{'type':_0x1919a9,'resourceId':_0x26d1d8['id']}})['then'](function(){return _0x453f96;});})[_0x3d52('0x1f')](function(){_0x2e0cd6[_0x3d52('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f8bb6,_0x4fdb9c){return function(_0x464764){if(!_0x464764){_0x3f8bb6[_0x3d52('0x36')](0x194);}return _0x464764;};}function handleError(_0x3077ed,_0x54880b){_0x54880b=_0x54880b||0x1f4;return function(_0x2798a7){logger['error'](_0x2798a7[_0x3d52('0x37')]);if(_0x2798a7[_0x3d52('0x38')]){delete _0x2798a7[_0x3d52('0x38')];}_0x3077ed['status'](_0x54880b)['send'](_0x2798a7);};}exports[_0x3d52('0x39')]=function(_0xf6de70,_0x98706f){var _0x5a3492={},_0x328138={},_0x22262c={'count':0x0,'rows':[]};var _0xa49220=_[_0x3d52('0x3a')](db['Trunk'][_0x3d52('0x3b')],function(_0x4dc059){return{'name':_0x4dc059['fieldName'],'type':_0x4dc059[_0x3d52('0x3c')]['key']};});_0x328138[_0x3d52('0x3d')]=_['map'](_0xa49220,_0x3d52('0x38'));_0x328138['query']=_[_0x3d52('0x3e')](_0xf6de70[_0x3d52('0x3f')]);_0x328138[_0x3d52('0x40')]=_['intersection'](_0x328138[_0x3d52('0x3d')],_0x328138[_0x3d52('0x3f')]);_0x5a3492['attributes']=_[_0x3d52('0x41')](_0x328138[_0x3d52('0x3d')],qs[_0x3d52('0x42')](_0xf6de70[_0x3d52('0x3f')][_0x3d52('0x42')]));_0x5a3492[_0x3d52('0x43')]=_0x5a3492[_0x3d52('0x43')][_0x3d52('0x44')]?_0x5a3492['attributes']:_0x328138['model'];if(!_0xf6de70['query']['hasOwnProperty'](_0x3d52('0x45'))){_0x5a3492['limit']=qs[_0x3d52('0x2e')](_0xf6de70['query'][_0x3d52('0x2e')]);_0x5a3492[_0x3d52('0x2d')]=qs[_0x3d52('0x2d')](_0xf6de70[_0x3d52('0x3f')]['offset']);}_0x5a3492[_0x3d52('0x46')]=qs[_0x3d52('0x47')](_0xf6de70['query'][_0x3d52('0x47')]);_0x5a3492[_0x3d52('0x48')]=qs[_0x3d52('0x40')](_['pick'](_0xf6de70[_0x3d52('0x3f')],_0x328138['filters']),_0xa49220);if(_0xf6de70['query']['filter']){_0x5a3492['where']=_[_0x3d52('0x49')](_0x5a3492[_0x3d52('0x48')],{'$or':_[_0x3d52('0x3a')](_0xa49220,function(_0x4dbd13){if(_0x4dbd13[_0x3d52('0x3c')]!=='VIRTUAL'){var _0x3b4e1d={};_0x3b4e1d[_0x4dbd13[_0x3d52('0x38')]]={'$like':'%'+_0xf6de70['query'][_0x3d52('0x4a')]+'%'};return _0x3b4e1d;}})});}_0x5a3492=_[_0x3d52('0x49')]({},_0x5a3492,_0xf6de70[_0x3d52('0x4b')]);var _0x2597d4={'where':_0x5a3492['where']};return db['Trunk'][_0x3d52('0x4c')](_0x2597d4)['then'](function(_0x42a438){_0x22262c[_0x3d52('0x4c')]=_0x42a438;if(_0xf6de70[_0x3d52('0x3f')][_0x3d52('0x4d')]){_0x5a3492['include']=[{'all':!![]}];}return db[_0x3d52('0x4e')]['findAll'](_0x5a3492);})[_0x3d52('0x1f')](function(_0x2911da){_0x22262c['rows']=_0x2911da;return _0x22262c;})[_0x3d52('0x1f')](respondWithFilteredResult(_0x98706f,_0x5a3492))[_0x3d52('0x29')](handleError(_0x98706f,null));};exports[_0x3d52('0x4f')]=function(_0x432521,_0x2b0c0e){var _0x3f4db8={'raw':![],'where':{'id':_0x432521[_0x3d52('0x50')]['id']}},_0x439901={};_0x439901[_0x3d52('0x3d')]=_['keys'](db[_0x3d52('0x4e')][_0x3d52('0x3b')]);_0x439901['query']=_[_0x3d52('0x3e')](_0x432521['query']);_0x439901[_0x3d52('0x40')]=_[_0x3d52('0x41')](_0x439901[_0x3d52('0x3d')],_0x439901['query']);_0x3f4db8[_0x3d52('0x43')]=_[_0x3d52('0x41')](_0x439901['model'],qs['fields'](_0x432521[_0x3d52('0x3f')][_0x3d52('0x42')]));_0x3f4db8['attributes']=_0x3f4db8[_0x3d52('0x43')][_0x3d52('0x44')]?_0x3f4db8[_0x3d52('0x43')]:_0x439901[_0x3d52('0x3d')];if(_0x432521[_0x3d52('0x3f')][_0x3d52('0x4d')]){_0x3f4db8['include']=[{'all':!![]}];}_0x3f4db8=_[_0x3d52('0x49')]({},_0x3f4db8,_0x432521[_0x3d52('0x4b')]);return db[_0x3d52('0x4e')][_0x3d52('0x51')](_0x3f4db8)[_0x3d52('0x1f')](handleEntityNotFound(_0x2b0c0e,null))[_0x3d52('0x1f')](respondWithResult(_0x2b0c0e,null))[_0x3d52('0x29')](handleError(_0x2b0c0e,null));};exports[_0x3d52('0x52')]=function(_0x5d0e25,_0x170d2c){var _0x4a005b={'where':{'id':_0x5d0e25[_0x3d52('0x50')]['id']}},_0x2c7496={};_0x2c7496['model']=_['keys'](db[_0x3d52('0x4e')][_0x3d52('0x3b')]);_0x4a005b[_0x3d52('0x43')]=_[_0x3d52('0x41')](_0x2c7496[_0x3d52('0x3d')],qs[_0x3d52('0x42')](_0x5d0e25[_0x3d52('0x3f')][_0x3d52('0x42')]));_0x4a005b[_0x3d52('0x43')]=_0x4a005b['attributes'][_0x3d52('0x44')]?_0x4a005b['attributes']:_0x2c7496[_0x3d52('0x3d')];if(_0x5d0e25[_0x3d52('0x3f')][_0x3d52('0x4d')]){_0x4a005b[_0x3d52('0x53')]=[{'all':!![]}];}_0x4a005b=_[_0x3d52('0x49')]({},_0x4a005b,_0x5d0e25[_0x3d52('0x4b')]);return db['Trunk'][_0x3d52('0x51')](_0x4a005b)[_0x3d52('0x1f')](handleEntityNotFound(_0x170d2c,null))[_0x3d52('0x1f')](function(_0x257646){if(_0x257646){var _0x5538b4=_0x257646[_0x3d52('0x54')]({'plain':!![]});_0x5538b4=qs[_0x3d52('0x55')](_0x5538b4,['id',_0x3d52('0x56'),_0x3d52('0x57')]);_0x5d0e25[_0x3d52('0x58')]=_['omit'](_0x5d0e25[_0x3d52('0x58')],['id','createdAt',_0x3d52('0x57')]);return db['Trunk'][_0x3d52('0x59')](_[_0x3d52('0x49')](_0x5538b4,_0x5d0e25['body']),{'include':_0x5d0e25['query']['includeAll']?[{'all':!![]}]:undefined})[_0x3d52('0x1f')](function(_0x4c7a76){var _0x38db76=_0x5d0e25[_0x3d52('0x5a')]['get']({'plain':!![]});if(!_0x38db76)throw new Error(_0x3d52('0x5b'));if(_0x38db76[_0x3d52('0x5c')]===_0x3d52('0x5a')){var _0x581b60=_0x4c7a76[_0x3d52('0x54')]({'plain':!![]});var _0x31d3a9=_0x3d52('0x34');return db[_0x3d52('0x5d')][_0x3d52('0x51')]({'where':{'name':_0x31d3a9,'userProfileId':_0x38db76[_0x3d52('0x5e')]},'raw':!![]})[_0x3d52('0x1f')](function(_0x111831){if(_0x111831&&_0x111831[_0x3d52('0x5f')]===0x0){return db[_0x3d52('0x35')][_0x3d52('0x59')]({'name':_0x581b60[_0x3d52('0x38')],'resourceId':_0x581b60['id'],'type':_0x111831[_0x3d52('0x38')],'sectionId':_0x111831['id']},{})[_0x3d52('0x1f')](function(){return _0x4c7a76;});}else{return _0x4c7a76;}})[_0x3d52('0x29')](function(_0x337107){logger[_0x3d52('0x25')](_0x3d52('0x60'),_0x337107);throw _0x337107;});}return _0x4c7a76;});}})[_0x3d52('0x1f')](respondWithResult(_0x170d2c,0xc9))['catch'](handleError(_0x170d2c,null));};exports[_0x3d52('0x59')]=function(_0x4ec9d9,_0x47dc11,_0x372374){var _0x238fbd;return db[_0x3d52('0x4e')]['create'](_0x4ec9d9[_0x3d52('0x58')],{'raw':!![]})[_0x3d52('0x1f')](function(_0x162004){_0x238fbd=_0x162004;return db[_0x3d52('0x4e')][_0x3d52('0x61')]({'raw':!![]});})[_0x3d52('0x1f')](function(_0x118b68){var _0xb1e4df=fs[_0x3d52('0x62')](path[_0x3d52('0x63')](config[_0x3d52('0x64')],_0x3d52('0x65')),_0x3d52('0x66'));var _0xe18087=fs[_0x3d52('0x62')](path[_0x3d52('0x63')](config[_0x3d52('0x64')],'server/files/templates/registry.ejs'),_0x3d52('0x66'));var _0xd6a574=ejs[_0x3d52('0x67')](_0xb1e4df,{'trunks':_0x118b68||[]});fs[_0x3d52('0x68')](_0x3d52('0x69'),_0xd6a574);if(_0x238fbd['registry']){var _0x3d7add=ejs[_0x3d52('0x67')](_0xe18087,{'trunks':_0x118b68||[]});fs[_0x3d52('0x68')](_0x3d52('0x6a'),_0x3d7add);}})[_0x3d52('0x1f')](function(){return respondWithRpcPromise(_0x3d52('0x6b'),'create',{'module':_0x3d52('0x6c')});})[_0x3d52('0x1f')](function(){var _0x51f87b=_0x4ec9d9[_0x3d52('0x5a')]['get']({'plain':!![]});if(!_0x51f87b)throw new Error(_0x3d52('0x5b'));if(_0x51f87b[_0x3d52('0x5c')]===_0x3d52('0x5a')){var _0x595a64=_0x238fbd[_0x3d52('0x54')]({'plain':!![]});return db['UserProfileSection'][_0x3d52('0x51')]({'where':{'name':'Trunks','userProfileId':_0x51f87b[_0x3d52('0x5e')]},'raw':!![]})[_0x3d52('0x1f')](function(_0x574f4e){if(_0x574f4e&&_0x574f4e[_0x3d52('0x5f')]===0x0){return db[_0x3d52('0x35')]['create']({'name':_0x595a64['name'],'resourceId':_0x595a64['id'],'type':_0x574f4e[_0x3d52('0x38')],'sectionId':_0x574f4e['id']},{})[_0x3d52('0x1f')](function(){return _0x238fbd;});}else{return _0x238fbd;}})[_0x3d52('0x29')](function(_0x2c4f2c){logger[_0x3d52('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c4f2c);throw _0x2c4f2c;});}return _0x238fbd;})[_0x3d52('0x1f')](respondWithResult(_0x47dc11,0xc9))[_0x3d52('0x29')](handleError(_0x47dc11,null));};exports['update']=function(_0x14a52e,_0x260fe3,_0x4c03d5){var _0x3904e2;return db[_0x3d52('0x4e')]['find']({'where':{'id':_0x14a52e[_0x3d52('0x50')]['id']}})['then'](handleEntityNotFound(_0x260fe3,null))['then'](saveUpdates(_0x14a52e[_0x3d52('0x58')],null))[_0x3d52('0x1f')](function(_0x4e349d){if(_0x4e349d){_0x3904e2=_0x4e349d;return db[_0x3d52('0x4e')]['findAll']({'raw':!![]});}})['then'](function(_0x13b382){if(_0x13b382){var _0x4e6c72=fs['readFileSync'](path['join'](config['root'],_0x3d52('0x65')),_0x3d52('0x66'));var _0x26c99d=fs[_0x3d52('0x62')](path[_0x3d52('0x63')](config[_0x3d52('0x64')],_0x3d52('0x6d')),_0x3d52('0x66'));var _0x2e116f=ejs[_0x3d52('0x67')](_0x4e6c72,{'trunks':_0x13b382||[]});fs['writeFileSync'](_0x3d52('0x69'),_0x2e116f);var _0x4d74ef=ejs[_0x3d52('0x67')](_0x26c99d,{'trunks':_0x13b382||[]});fs[_0x3d52('0x68')](_0x3d52('0x6a'),_0x4d74ef);return respondWithRpcPromise(_0x3d52('0x6b'),'update',{'module':_0x3d52('0x6c')});}return null;})[_0x3d52('0x1f')](function(_0x4f0426){if(_0x4f0426){return _0x3904e2;}})[_0x3d52('0x1f')](respondWithResult(_0x260fe3,null))['catch'](handleError(_0x260fe3,null));};exports['destroy']=function(_0x3b5ebe,_0x2986dd,_0x56d0bd){var _0x46e9cc;return db[_0x3d52('0x4e')][_0x3d52('0x51')]({'where':{'id':_0x3b5ebe['params']['id']}})[_0x3d52('0x1f')](handleEntityNotFound(_0x2986dd,null))[_0x3d52('0x1f')](removeEntity(_0x2986dd,null))[_0x3d52('0x1f')](function(){return db['Trunk']['findAll']({'raw':!![]});})['then'](function(_0x50717d){var _0x1eeed3=fs[_0x3d52('0x62')](path[_0x3d52('0x63')](config['root'],_0x3d52('0x65')),'utf8');var _0xea608b=fs['readFileSync'](path[_0x3d52('0x63')](config['root'],_0x3d52('0x6d')),_0x3d52('0x66'));var _0x446ffd=ejs[_0x3d52('0x67')](_0x1eeed3,{'trunks':_0x50717d});var _0x2a96c9=ejs[_0x3d52('0x67')](_0xea608b,{'trunks':_0x50717d});fs[_0x3d52('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x446ffd);fs[_0x3d52('0x68')](_0x3d52('0x6a'),_0x2a96c9);return respondWithRpcPromise(_0x3d52('0x6b'),'destroy',{'module':_0x3d52('0x6c')});})[_0x3d52('0x29')](handleError(_0x2986dd,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 541e6d0..2b8b1cf 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 _0x0fd5=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','Trunk','tools_trunks','lodash'];(function(_0x1aa28e,_0x3092e7){var _0x4dea1c=function(_0x216800){while(--_0x216800){_0x1aa28e['push'](_0x1aa28e['shift']());}};_0x4dea1c(++_0x3092e7);}(_0x0fd5,0x12b));var _0x50fd=function(_0x49fbaf,_0x3d46e7){_0x49fbaf=_0x49fbaf-0x0;var _0x5e34f5=_0x0fd5[_0x49fbaf];return _0x5e34f5;};'use strict';var _=require(_0x50fd('0x0'));var util=require('util');var logger=require(_0x50fd('0x1'))(_0x50fd('0x2'));var moment=require(_0x50fd('0x3'));var BPromise=require(_0x50fd('0x4'));var rp=require(_0x50fd('0x5'));var fs=require('fs');var path=require(_0x50fd('0x6'));var rimraf=require('rimraf');var config=require(_0x50fd('0x7'));var attributes=require('./trunk.attributes');module[_0x50fd('0x8')]=function(_0xfd7b7e,_0x29df30){return _0xfd7b7e[_0x50fd('0x9')](_0x50fd('0xa'),attributes,{'tableName':_0x50fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x438a=['util','../../config/logger','api','moment','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x438a,0x1cc));var _0xa438=function(_0x2cf08a,_0x352fcb){_0x2cf08a=_0x2cf08a-0x0;var _0x3b35a8=_0x438a[_0x2cf08a];return _0x3b35a8;};'use strict';var _=require('lodash');var util=require(_0xa438('0x0'));var logger=require(_0xa438('0x1'))(_0xa438('0x2'));var moment=require(_0xa438('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa438('0x4'));var attributes=require(_0xa438('0x5'));module[_0xa438('0x6')]=function(_0x390d72,_0x27daa8){return _0x390d72[_0xa438('0x7')](_0xa438('0x8'),attributes,{'tableName':_0xa438('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 d3cf423..8d23d5b 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 _0x757a=['stringify','error','message','result','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','map','model','ShowTrunk','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s'];(function(_0x2f1764,_0x2adcb8){var _0x178abf=function(_0x573b18){while(--_0x573b18){_0x2f1764['push'](_0x2f1764['shift']());}};_0x178abf(++_0x2adcb8);}(_0x757a,0xde));var _0xa757=function(_0x25cadc,_0x45ec3f){_0x25cadc=_0x25cadc-0x0;var _0x5d1b23=_0x757a[_0x25cadc];return _0x5d1b23;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetTrunk',_0x4d9f58);logger['debug']('GetTrunk',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetTrunk',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file +var _0x8603=['result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowTrunk','debug','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x2b323d,_0x1632bf){var _0x4e1623=function(_0x3d4853){while(--_0x3d4853){_0x2b323d['push'](_0x2b323d['shift']());}};_0x4e1623(++_0x1632bf);}(_0x8603,0x190));var _0x3860=function(_0x5dcc04,_0x45c416){_0x5dcc04=_0x5dcc04-0x0;var _0x451853=_0x8603[_0x5dcc04];return _0x451853;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});}exports[_0x3860('0x12')]=function(_0x45b799){var _0x4b6b15=this;return new Promise(function(_0x4863bd,_0x373b06){return db[_0x3860('0x13')][_0x3860('0x14')]({'raw':_0x45b799['options']?_0x45b799[_0x3860('0x15')][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x17')]||null:null,'attributes':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x18')]||null:null,'limit':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x19')]||null:null,'include':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x1a')]?_[_0x3860('0x1b')](_0x45b799['options'][_0x3860('0x1a')],function(_0x133093){return{'model':db[_0x133093[_0x3860('0x1c')]],'as':_0x133093['as'],'attributes':_0x133093[_0x3860('0x18')],'include':_0x133093[_0x3860('0x1a')]?_['map'](_0x133093[_0x3860('0x1a')],function(_0x568515){return{'model':db[_0x568515['model']],'as':_0x568515['as'],'attributes':_0x568515[_0x3860('0x18')],'include':_0x568515[_0x3860('0x1a')]?_['map'](_0x568515['include'],function(_0x5f42d5){return{'model':db[_0x5f42d5[_0x3860('0x1c')]],'as':_0x5f42d5['as'],'attributes':_0x5f42d5[_0x3860('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3860('0x9')](function(_0x371f3a){logger[_0x3860('0xf')](_0x3860('0x12'),_0x45b799);logger['debug']('GetTrunk',_0x45b799,JSON[_0x3860('0x1d')](_0x371f3a));_0x4863bd(_0x371f3a);})[_0x3860('0x11')](function(_0x5a9af2){logger[_0x3860('0xd')](_0x3860('0x12'),_0x5a9af2[_0x3860('0xe')],_0x45b799);_0x373b06(_0x4b6b15[_0x3860('0xd')](0x1f4,_0x5a9af2[_0x3860('0xe')]));});});};exports['ShowTrunk']=function(_0x36ae2b){var _0xf624ba=this;return new Promise(function(_0x367b14,_0x4bd90c){return db[_0x3860('0x13')]['find']({'raw':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b['options'][_0x3860('0x16')]===undefined?!![]:![]:!![],'where':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b[_0x3860('0x15')]['where']||null:null,'attributes':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b[_0x3860('0x15')]['attributes']||null:null,'include':_0x36ae2b[_0x3860('0x15')]?_0x36ae2b['options'][_0x3860('0x1a')]?_[_0x3860('0x1b')](_0x36ae2b[_0x3860('0x15')][_0x3860('0x1a')],function(_0x30dc2a){return{'model':db[_0x30dc2a[_0x3860('0x1c')]],'as':_0x30dc2a['as'],'attributes':_0x30dc2a[_0x3860('0x18')],'include':_0x30dc2a['include']?_[_0x3860('0x1b')](_0x30dc2a[_0x3860('0x1a')],function(_0x4d62e9){return{'model':db[_0x4d62e9[_0x3860('0x1c')]],'as':_0x4d62e9['as'],'attributes':_0x4d62e9[_0x3860('0x18')],'include':_0x4d62e9[_0x3860('0x1a')]?_['map'](_0x4d62e9['include'],function(_0x285b1b){return{'model':db[_0x285b1b[_0x3860('0x1c')]],'as':_0x285b1b['as'],'attributes':_0x285b1b[_0x3860('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3860('0x9')](function(_0x59271f){logger['info'](_0x3860('0x1e'),_0x36ae2b);logger[_0x3860('0x1f')](_0x3860('0x1e'),_0x36ae2b,JSON[_0x3860('0x1d')](_0x59271f));_0x367b14(_0x59271f);})[_0x3860('0x11')](function(_0x4df2a9){logger[_0x3860('0xd')](_0x3860('0x1e'),_0x4df2a9['message'],_0x36ae2b);_0x4bd90c(_0xf624ba['error'](0x1f4,_0x4df2a9[_0x3860('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 1168c85..e5ce4a1 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 _0x6eaa=['addQueues','diskStorage','join','root','server/files/images/','format','originalname','single','file','/:id/login','login','logout','pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/sms_accounts','addChatWebsites','/:id/whatsapp_accounts','addSquareProjects','put','update','/:id/password','changePassword','delete','removeTeams','removeMailInteractions','/:id/fax_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeWhatsappAccounts','removeApiKey','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/:id','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/api_key','getApiKey','post','bulkCreate','addContacts'];(function(_0xd05f9c,_0x15f0a1){var _0x5172ef=function(_0x5b31e2){while(--_0x5b31e2){_0xd05f9c['push'](_0xd05f9c['shift']());}};_0x5172ef(++_0x15f0a1);}(_0x6eaa,0x9e));var _0xa6ea=function(_0x2aa48b,_0x5a4446){_0x2aa48b=_0x2aa48b-0x0;var _0x48caf8=_0x6eaa[_0x2aa48b];return _0x48caf8;};'use strict';var multer=require(_0xa6ea('0x0'));var util=require('util');var path=require(_0xa6ea('0x1'));var timeout=require(_0xa6ea('0x2'));var express=require(_0xa6ea('0x3'));var router=express[_0xa6ea('0x4')]();var auth=require(_0xa6ea('0x5'));var interaction=require(_0xa6ea('0x6'));var config=require(_0xa6ea('0x7'));var controller=require(_0xa6ea('0x8'));router[_0xa6ea('0x9')]('/',auth[_0xa6ea('0xa')](),controller[_0xa6ea('0xb')]);router[_0xa6ea('0x9')](_0xa6ea('0xc'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0xd')]);router[_0xa6ea('0x9')](_0xa6ea('0xe'),auth['isAuthenticated'](),controller[_0xa6ea('0xf')]);router[_0xa6ea('0x9')](_0xa6ea('0x10'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x11')]);router[_0xa6ea('0x9')](_0xa6ea('0x12'),controller[_0xa6ea('0x13')]);router[_0xa6ea('0x9')](_0xa6ea('0x14'),auth['isAuthenticated'](),controller[_0xa6ea('0x15')]);router[_0xa6ea('0x9')](_0xa6ea('0x16'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x17')]);router['get'](_0xa6ea('0x18'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x19')]);router[_0xa6ea('0x9')]('/:id/groups',auth['isAuthenticated'](),controller[_0xa6ea('0x1a')]);router[_0xa6ea('0x9')](_0xa6ea('0x1b'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x1c')]);router[_0xa6ea('0x9')](_0xa6ea('0x1d'),auth[_0xa6ea('0xa')](),controller['getScreenRecordings']);router[_0xa6ea('0x9')](_0xa6ea('0x1e'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x1f')]);router[_0xa6ea('0x9')](_0xa6ea('0x20'),auth['isAuthenticated'](),controller[_0xa6ea('0x21')]);router['get'](_0xa6ea('0x22'),auth['isAuthenticated'](),controller[_0xa6ea('0x23')]);router[_0xa6ea('0x9')](_0xa6ea('0x24'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x25')]);router[_0xa6ea('0x9')](_0xa6ea('0x26'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x27')]);router['get'](_0xa6ea('0x28'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x29')]);router[_0xa6ea('0x9')](_0xa6ea('0x2a'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x2b')]);router[_0xa6ea('0x9')](_0xa6ea('0x2c'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x2d')]);router[_0xa6ea('0x9')](_0xa6ea('0x2e'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x2f')]);router[_0xa6ea('0x9')](_0xa6ea('0x30'),auth['isAuthenticated'](),controller['getVoicePrefixes']);router[_0xa6ea('0x9')](_0xa6ea('0x31'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x32')]);router[_0xa6ea('0x9')](_0xa6ea('0x33'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x34')]);router['get'](_0xa6ea('0x35'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x36')]);router[_0xa6ea('0x9')]('/:id/sms_accounts',auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x37')]);router[_0xa6ea('0x9')](_0xa6ea('0x38'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x39')]);router[_0xa6ea('0x9')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xa6ea('0x3a')]);router[_0xa6ea('0x9')](_0xa6ea('0x3b'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x3c')]);router[_0xa6ea('0x9')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller['getScheduledCalls']);router[_0xa6ea('0x9')](_0xa6ea('0x3d'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x3e')]);router[_0xa6ea('0x3f')]('/create_many',auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x40')]);router[_0xa6ea('0x3f')](_0xa6ea('0x14'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x41')]);router['post']('/',auth[_0xa6ea('0xa')](),controller['create']);router[_0xa6ea('0x3f')]('/:id/queues',auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x42')]);var upload=multer({'storage':multer[_0xa6ea('0x43')]({'destination':function(_0x4befd3,_0x410fe8,_0x2c3df5){_0x2c3df5(null,path[_0xa6ea('0x44')](config[_0xa6ea('0x45')],_0xa6ea('0x46')));},'filename':function(_0x56654e,_0x32de8b,_0xde8e3f){_0xde8e3f(null,util[_0xa6ea('0x47')]('%s-%s',Date['now'](),_0x32de8b[_0xa6ea('0x48')]));}})});router[_0xa6ea('0x3f')]('/:id/avatar',upload[_0xa6ea('0x49')](_0xa6ea('0x4a')),controller['addAvatar']);router['post'](_0xa6ea('0x4b'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x4c')]);router[_0xa6ea('0x3f')]('/:id/logout',auth['isAuthenticated'](),controller[_0xa6ea('0x4d')]);router['post']('/:id/pause',auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x4e')]);router['post']('/:id/unpause',auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x4f')]);router[_0xa6ea('0x3f')](_0xa6ea('0x2a'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x50')]);router[_0xa6ea('0x3f')](_0xa6ea('0x51'),auth['isAuthenticated'](),controller[_0xa6ea('0x52')]);router[_0xa6ea('0x3f')](_0xa6ea('0x53'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x54')]);router[_0xa6ea('0x3f')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0xa6ea('0x55')]);router[_0xa6ea('0x3f')](_0xa6ea('0x56'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x57')]);router['post'](_0xa6ea('0x58'),auth[_0xa6ea('0xa')](),controller['addOpenchannelInteractions']);router[_0xa6ea('0x3f')](_0xa6ea('0x59'),auth['isAuthenticated'](),controller[_0xa6ea('0x5a')]);router['post'](_0xa6ea('0x31'),auth['isAuthenticated'](),controller[_0xa6ea('0x5b')]);router[_0xa6ea('0x3f')]('/:id/mail_accounts',auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x5c')]);router[_0xa6ea('0x3f')](_0xa6ea('0x35'),auth[_0xa6ea('0xa')](),controller['addOpenchannelAccounts']);router[_0xa6ea('0x3f')](_0xa6ea('0x5d'),auth[_0xa6ea('0xa')](),controller['addSmsAccounts']);router[_0xa6ea('0x3f')](_0xa6ea('0x38'),auth['isAuthenticated'](),controller[_0xa6ea('0x5e')]);router[_0xa6ea('0x3f')](_0xa6ea('0x5f'),auth[_0xa6ea('0xa')](),controller['addWhatsappAccounts']);router[_0xa6ea('0x3f')](_0xa6ea('0x3b'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x60')]);router[_0xa6ea('0x3f')](_0xa6ea('0x3d'),auth[_0xa6ea('0xa')](),controller['createApiKey']);router[_0xa6ea('0x61')](_0xa6ea('0x10'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x62')]);router[_0xa6ea('0x61')](_0xa6ea('0x63'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x64')]);router[_0xa6ea('0x65')](_0xa6ea('0x16'),auth['isAuthenticated'](),controller['removeQueues']);router[_0xa6ea('0x65')](_0xa6ea('0x2a'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x66')]);router[_0xa6ea('0x65')]('/:id',auth[_0xa6ea('0xa')](),controller['destroy']);router[_0xa6ea('0x65')](_0xa6ea('0x51'),auth[_0xa6ea('0xa')](),controller['removeChatInteractions']);router['delete']('/:id/mail_interactions',auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x67')]);router['delete'](_0xa6ea('0x68'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router[_0xa6ea('0x65')](_0xa6ea('0x56'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x69')]);router[_0xa6ea('0x65')](_0xa6ea('0x58'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x6a')]);router[_0xa6ea('0x65')](_0xa6ea('0x59'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x6b')]);router[_0xa6ea('0x65')](_0xa6ea('0x31'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x6c')]);router['delete'](_0xa6ea('0x33'),auth['isAuthenticated'](),controller['removeMailAccounts']);router['delete'](_0xa6ea('0x35'),auth[_0xa6ea('0xa')](),controller['removeOpenchannelAccounts']);router['delete']('/:id/sms_accounts',auth[_0xa6ea('0xa')](),controller['removeSmsAccounts']);router[_0xa6ea('0x65')](_0xa6ea('0x38'),auth[_0xa6ea('0xa')](),controller['removeChatWebsites']);router[_0xa6ea('0x65')](_0xa6ea('0x5f'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x6d')]);router['delete'](_0xa6ea('0x3b'),auth[_0xa6ea('0xa')](),controller['removeSquareProjects']);router[_0xa6ea('0x65')](_0xa6ea('0x3d'),auth[_0xa6ea('0xa')](),controller[_0xa6ea('0x6e')]);module[_0xa6ea('0x6f')]=router; \ No newline at end of file +var _0xde9b=['/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','/:id/square_projects','addSquareProjects','put','/:id','/:id/password','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./user.controller','get','index','isAuthenticated','/whoami','whoami','show','/:id/avatar','getAvatar','/:id/contacts','/:id/queues','getQueues','getGroups','/:id/recordings','getRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/create_many','addContacts','addQueues','diskStorage','join','root','server/files/images/','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause'];(function(_0x51185a,_0x2dcfcf){var _0x195001=function(_0x1305a5){while(--_0x1305a5){_0x51185a['push'](_0x51185a['shift']());}};_0x195001(++_0x2dcfcf);}(_0xde9b,0x9e));var _0xbde9=function(_0x51630f,_0x54b703){_0x51630f=_0x51630f-0x0;var _0x2de9ef=_0xde9b[_0x51630f];return _0x2de9ef;};'use strict';var multer=require(_0xbde9('0x0'));var util=require(_0xbde9('0x1'));var path=require(_0xbde9('0x2'));var timeout=require(_0xbde9('0x3'));var express=require(_0xbde9('0x4'));var router=express[_0xbde9('0x5')]();var auth=require(_0xbde9('0x6'));var interaction=require(_0xbde9('0x7'));var config=require('../../config/environment');var controller=require(_0xbde9('0x8'));router[_0xbde9('0x9')]('/',auth['isAuthenticated'](),controller[_0xbde9('0xa')]);router[_0xbde9('0x9')]('/describe',auth[_0xbde9('0xb')](),controller['describe']);router[_0xbde9('0x9')](_0xbde9('0xc'),auth[_0xbde9('0xb')](),controller[_0xbde9('0xd')]);router[_0xbde9('0x9')]('/:id',auth[_0xbde9('0xb')](),controller[_0xbde9('0xe')]);router[_0xbde9('0x9')](_0xbde9('0xf'),controller[_0xbde9('0x10')]);router[_0xbde9('0x9')](_0xbde9('0x11'),auth['isAuthenticated'](),controller['getContacts']);router[_0xbde9('0x9')](_0xbde9('0x12'),auth['isAuthenticated'](),controller[_0xbde9('0x13')]);router['get']('/:id/queues_rt',auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0xbde9('0x9')]('/:id/groups',auth[_0xbde9('0xb')](),controller[_0xbde9('0x14')]);router[_0xbde9('0x9')](_0xbde9('0x15'),auth['isAuthenticated'](),controller[_0xbde9('0x16')]);router[_0xbde9('0x9')]('/:id/screen_recordings',auth[_0xbde9('0xb')](),controller['getScreenRecordings']);router[_0xbde9('0x9')](_0xbde9('0x17'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x18')]);router[_0xbde9('0x9')](_0xbde9('0x19'),auth['isAuthenticated'](),controller[_0xbde9('0x1a')]);router[_0xbde9('0x9')](_0xbde9('0x1b'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x1c')]);router[_0xbde9('0x9')](_0xbde9('0x1d'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x1e')]);router[_0xbde9('0x9')](_0xbde9('0x1f'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x20')]);router[_0xbde9('0x9')](_0xbde9('0x21'),auth['isAuthenticated'](),controller[_0xbde9('0x22')]);router[_0xbde9('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0xbde9('0x23')]);router['get']('/:id/lists',auth['isAuthenticated'](),controller[_0xbde9('0x24')]);router[_0xbde9('0x9')](_0xbde9('0x25'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x26')]);router['get']('/:id/prefixes',auth['isAuthenticated'](),controller[_0xbde9('0x27')]);router[_0xbde9('0x9')](_0xbde9('0x28'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x29')]);router['get'](_0xbde9('0x2a'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x2b')]);router[_0xbde9('0x9')](_0xbde9('0x2c'),auth[_0xbde9('0xb')](),controller['getOpenchannelAccounts']);router['get'](_0xbde9('0x2d'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x2e')]);router[_0xbde9('0x9')](_0xbde9('0x2f'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x30')]);router[_0xbde9('0x9')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xbde9('0x31')]);router['get']('/:id/square_projects',auth[_0xbde9('0xb')](),controller['getSquareProjects']);router[_0xbde9('0x9')](_0xbde9('0x32'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x33')]);router[_0xbde9('0x9')](_0xbde9('0x34'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x35')]);router[_0xbde9('0x36')](_0xbde9('0x37'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0xbde9('0x36')](_0xbde9('0x11'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x38')]);router['post']('/',auth[_0xbde9('0xb')](),controller['create']);router[_0xbde9('0x36')]('/:id/queues',auth[_0xbde9('0xb')](),controller[_0xbde9('0x39')]);var upload=multer({'storage':multer[_0xbde9('0x3a')]({'destination':function(_0x384f8f,_0x5d5e92,_0x2428f0){_0x2428f0(null,path[_0xbde9('0x3b')](config[_0xbde9('0x3c')],_0xbde9('0x3d')));},'filename':function(_0x3e789e,_0x46e387,_0x1c5bd6){_0x1c5bd6(null,util['format'](_0xbde9('0x3e'),Date[_0xbde9('0x3f')](),_0x46e387[_0xbde9('0x40')]));}})});router[_0xbde9('0x36')](_0xbde9('0xf'),upload[_0xbde9('0x41')](_0xbde9('0x42')),controller[_0xbde9('0x43')]);router[_0xbde9('0x36')](_0xbde9('0x44'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x45')]);router[_0xbde9('0x36')](_0xbde9('0x46'),auth['isAuthenticated'](),controller[_0xbde9('0x47')]);router[_0xbde9('0x36')](_0xbde9('0x48'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x49')]);router[_0xbde9('0x36')](_0xbde9('0x4a'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x4b')]);router[_0xbde9('0x36')](_0xbde9('0x4c'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x4d')]);router[_0xbde9('0x36')](_0xbde9('0x4e'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x4f')]);router[_0xbde9('0x36')](_0xbde9('0x50'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x51')]);router['post']('/:id/fax_interactions',auth[_0xbde9('0xb')](),controller[_0xbde9('0x52')]);router[_0xbde9('0x36')](_0xbde9('0x53'),auth[_0xbde9('0xb')](),controller['addSmsInteractions']);router['post'](_0xbde9('0x54'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x55')]);router[_0xbde9('0x36')](_0xbde9('0x56'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x57')]);router['post'](_0xbde9('0x28'),auth[_0xbde9('0xb')](),controller['addFaxAccounts']);router['post'](_0xbde9('0x2a'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x58')]);router[_0xbde9('0x36')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xbde9('0x59')]);router[_0xbde9('0x36')](_0xbde9('0x2d'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x5a')]);router['post']('/:id/chat_websites',auth[_0xbde9('0xb')](),controller[_0xbde9('0x5b')]);router[_0xbde9('0x36')](_0xbde9('0x5c'),auth['isAuthenticated'](),controller[_0xbde9('0x5d')]);router[_0xbde9('0x36')](_0xbde9('0x5e'),auth['isAuthenticated'](),controller[_0xbde9('0x5f')]);router[_0xbde9('0x36')](_0xbde9('0x34'),auth[_0xbde9('0xb')](),controller['createApiKey']);router[_0xbde9('0x60')](_0xbde9('0x61'),auth[_0xbde9('0xb')](),controller['update']);router[_0xbde9('0x60')](_0xbde9('0x62'),auth[_0xbde9('0xb')](),controller['changePassword']);router[_0xbde9('0x63')](_0xbde9('0x12'),auth['isAuthenticated'](),controller[_0xbde9('0x64')]);router[_0xbde9('0x63')](_0xbde9('0x4c'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x65')]);router[_0xbde9('0x63')](_0xbde9('0x61'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x66')]);router[_0xbde9('0x63')]('/:id/chat_interactions',auth[_0xbde9('0xb')](),controller[_0xbde9('0x67')]);router[_0xbde9('0x63')](_0xbde9('0x50'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x68')]);router['delete'](_0xbde9('0x69'),auth['isAuthenticated'](),controller[_0xbde9('0x6a')]);router[_0xbde9('0x63')](_0xbde9('0x53'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x6b')]);router[_0xbde9('0x63')](_0xbde9('0x54'),auth[_0xbde9('0xb')](),controller['removeOpenchannelInteractions']);router[_0xbde9('0x63')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0xbde9('0x6c')]);router[_0xbde9('0x63')](_0xbde9('0x28'),auth['isAuthenticated'](),controller[_0xbde9('0x6d')]);router['delete'](_0xbde9('0x2a'),auth[_0xbde9('0xb')](),controller['removeMailAccounts']);router[_0xbde9('0x63')](_0xbde9('0x2c'),auth[_0xbde9('0xb')](),controller['removeOpenchannelAccounts']);router['delete'](_0xbde9('0x2d'),auth['isAuthenticated'](),controller[_0xbde9('0x6e')]);router[_0xbde9('0x63')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xbde9('0x6f')]);router[_0xbde9('0x63')](_0xbde9('0x5c'),auth['isAuthenticated'](),controller[_0xbde9('0x70')]);router[_0xbde9('0x63')](_0xbde9('0x5e'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x71')]);router[_0xbde9('0x63')](_0xbde9('0x34'),auth[_0xbde9('0xb')](),controller[_0xbde9('0x72')]);module[_0xbde9('0x73')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 17adf9c..99c4144 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 _0x277c=['auto','rfc2833','outgoing','yes','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','nonat','update','update,nonat','showWebBar','get','isArray','encryption','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','wss','avpf','dtlsverify','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','TEXT','permissions','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','util','lodash','exports','STRING','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','internal','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband'];(function(_0x519d91,_0x990829){var _0xcd79e7=function(_0x1eedd1){while(--_0x1eedd1){_0x519d91['push'](_0x519d91['shift']());}};_0xcd79e7(++_0x990829);}(_0x277c,0x194));var _0xc277=function(_0x4cb9bd,_0x4dfd64){_0x4cb9bd=_0x4cb9bd-0x0;var _0x341b08=_0x277c[_0x4cb9bd];return _0x341b08;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0xc277('0x0'));var _=require(_0xc277('0x1'));module[_0xc277('0x2')]={'name':{'type':Sequelize[_0xc277('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x38479d){this[_0xc277('0x4')]('name',_0x38479d);this[_0xc277('0x4')](_0xc277('0x5'),_0x38479d);},'comment':_0xc277('0x6')},'fullname':{'type':Sequelize[_0xc277('0x3')],'allowNull':![],'set':function(_0x2bf880){this[_0xc277('0x4')](_0xc277('0x7'),_0x2bf880);this['setDataValue'](_0xc277('0x8'),util[_0xc277('0x9')]('\x22%s\x22\x20<%s>',_0x2bf880,this['getDataValue']('internal')));}},'alias':{'type':Sequelize[_0xc277('0x3')]},'email':{'type':Sequelize[_0xc277('0x3')],'allowNull':![],'unique':_0xc277('0xa'),'validate':{'isEmail':!![]},'set':function(_0x520df1){if(_0x520df1){this[_0xc277('0x4')](_0xc277('0xa'),_0x520df1[_0xc277('0xb')]());}}},'role':{'type':Sequelize[_0xc277('0xc')](_0xc277('0xd'),_0xc277('0xe'),_0xc277('0xf'),_0xc277('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0xc277('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xc277('0x3')],'defaultValue':_0xc277('0x11')},'internal':{'type':Sequelize[_0xc277('0x12')](0xb),'allowNull':![],'unique':_0xc277('0x13'),'set':function(_0x5c3c4b){this[_0xc277('0x4')](_0xc277('0x13'),_0x5c3c4b);this['setDataValue'](_0xc277('0x14'),_0x5c3c4b);this[_0xc277('0x4')](_0xc277('0x8'),util[_0xc277('0x9')](_0xc277('0x15'),this['getDataValue'](_0xc277('0x7')),_0x5c3c4b));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xc277('0x3')]},'mobile':{'type':Sequelize[_0xc277('0x3')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xc277('0x3')]},'userpic':{'type':Sequelize[_0xc277('0x3')]},'city':{'type':Sequelize[_0xc277('0x3')]},'country':{'type':Sequelize[_0xc277('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xc277('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xc277('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xc277('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xc277('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xc277('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xc277('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xc277('0x12')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xc277('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xc277('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xc277('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xc277('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xc277('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xc277('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xc277('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xc277('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xc277('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xc277('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xc277('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0xc277('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xc277('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xc277('0x12')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xc277('0xc')](_0xc277('0x17'),_0xc277('0xe'),_0xc277('0x18')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xc277('0x19')},'callingpres':{'type':Sequelize[_0xc277('0xc')]('ALLOWED_NOT_SCREENED',_0xc277('0x1a'),_0xc277('0x1b'),'ALLOWED',_0xc277('0x1c'),_0xc277('0x1d'),_0xc277('0x1e'),_0xc277('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![],'defaultValue':_0xc277('0x20'),'set':function(_0x554583){this[_0xc277('0x4')](_0xc277('0x21'),_0x554583?_0x554583[_0xc277('0x22')](','):null);},'get':function(){return this['getDataValue'](_0xc277('0x21'))?this[_0xc277('0x23')](_0xc277('0x21'))[_0xc277('0x24')](','):null;},'comment':_0xc277('0x25')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xc277('0x26'),_0xc277('0x27'),_0xc277('0x28'),_0xc277('0x29')),'allowNull':!![],'defaultValue':_0xc277('0x2a')},'directmedia':{'type':Sequelize['ENUM']('yes','no','nonat','update',_0xc277('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc277('0xc')](_0xc277('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x7fc56c){this[_0xc277('0x4')](_0xc277('0x2d'),_0x7fc56c?_0x7fc56c[_0xc277('0x22')](','):null);},'get':function(){return this[_0xc277('0x23')]('nat')?this[_0xc277('0x23')]('nat')[_0xc277('0x24')](','):null;},'comment':_0xc277('0x2e')},'callgroup':{'type':Sequelize[_0xc277('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xc277('0x3')]},'namedpickupgroup':{'type':Sequelize[_0xc277('0x3')]},'language':{'type':Sequelize[_0xc277('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xc277('0x3')],'allowNull':![],'defaultValue':_0xc277('0x2f'),'set':function(_0x2c0ce5){this[_0xc277('0x4')]('allow',_0x2c0ce5?_0x2c0ce5[_0xc277('0x22')](';'):_0xc277('0x2f'));},'get':function(){return this[_0xc277('0x23')](_0xc277('0x30'))?this[_0xc277('0x23')](_0xc277('0x30'))['split'](';'):null;},'comment':_0xc277('0x31')},'autoframing':{'type':Sequelize[_0xc277('0xc')](_0xc277('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![],'set':function(_0x15a454){this[_0xc277('0x4')](_0xc277('0x32'),_0x15a454?_0x15a454[_0xc277('0x22')](','):null);},'get':function(){return this[_0xc277('0x23')]('insecure')?this[_0xc277('0x23')](_0xc277('0x32'))[_0xc277('0x24')](','):null;},'comment':_0xc277('0x33')},'trustrpid':{'type':Sequelize['ENUM'](_0xc277('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc277('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc277('0xc')](_0xc277('0x2c'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xc277('0xc')](_0xc277('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xc277('0xc')](_0xc277('0x2c'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xc277('0xc')](_0xc277('0x2c'),'no'),'allowNull':!![],'defaultValue':_0xc277('0x2c')},'busylevel':{'type':Sequelize[_0xc277('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xc277('0xc')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xc277('0xc')](_0xc277('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xc277('0xc')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xc277('0xc')](_0xc277('0x2c'),'no',_0xc277('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc277('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xc277('0xc')](_0xc277('0x2c'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xc277('0xc')](_0xc277('0x35'),_0xc277('0x36'),_0xc277('0x37')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xc277('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xc277('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xc277('0xc')](_0xc277('0x38'),_0xc277('0x39')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xc277('0xc')](_0xc277('0x2c'),'no'),'allowNull':!![],'defaultValue':_0xc277('0x2c')},'keepalive':{'type':Sequelize[_0xc277('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xc277('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xc277('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xc277('0x12')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xc277('0xc')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xc277('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xc277('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xc277('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xc277('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc277('0xc')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xc277('0xc')](_0xc277('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xc277('0x2c'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xc277('0xc')](_0xc277('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xc277('0xc')](_0xc277('0x2c'),'no',_0xc277('0x3a'),_0xc277('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xc277('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xc277('0x3c'),_0xc277('0x3d'),_0xc277('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xc277('0xc')](_0xc277('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xc277('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xc277('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xc277('0xc')](_0xc277('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xc277('0xc')](_0xc277('0x2c'),'no',_0xc277('0x3f'),_0xc277('0x40'),_0xc277('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xc277('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xc277('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4e6454){this[_0xc277('0x4')](_0xc277('0x42'),_0x4e6454);var _0x40bfda=this[_0xc277('0x43')]({'plain':!![]});switch(_0x4e6454){case 0x0:case 0x1:var _0x40b4aa=_0x40bfda[_0xc277('0x21')]?_[_0xc277('0x44')](_0x40bfda[_0xc277('0x21')])?_0x40bfda[_0xc277('0x21')]['join']():_0x40bfda['transport']:_0xc277('0x20');if(_0x40b4aa==='wss'){_0x40b4aa=_0xc277('0x20');}this[_0xc277('0x4')](_0xc277('0x21'),_0x40b4aa);this[_0xc277('0x4')](_0xc277('0x45'),'no');this['setDataValue']('avpf',null);this[_0xc277('0x4')]('force_avp',null);this[_0xc277('0x4')](_0xc277('0x46'),null);this[_0xc277('0x4')](_0xc277('0x47'),null);this[_0xc277('0x4')]('dtlsverify',null);this[_0xc277('0x4')](_0xc277('0x48'),null);this[_0xc277('0x4')](_0xc277('0x49'),null);this[_0xc277('0x4')]('dtlsprivatekey',null);this['setDataValue'](_0xc277('0x4a'),'no');break;case 0x2:this[_0xc277('0x4')](_0xc277('0x21'),_0xc277('0x4b'));this[_0xc277('0x4')](_0xc277('0x45'),'yes');this['setDataValue'](_0xc277('0x4c'),_0xc277('0x2c'));this[_0xc277('0x4')]('force_avp',_0xc277('0x2c'));this[_0xc277('0x4')]('icesupport',_0xc277('0x2c'));this[_0xc277('0x4')](_0xc277('0x47'),_0xc277('0x2c'));this[_0xc277('0x4')](_0xc277('0x4d'),'no');this[_0xc277('0x4')](_0xc277('0x48'),_0xc277('0x3e'));this['setDataValue'](_0xc277('0x49'),_0x40bfda['dtlscertfile']||_0xc277('0x4e'));this[_0xc277('0x4')](_0xc277('0x4f'),_0x40bfda[_0xc277('0x4f')]||_0xc277('0x50'));this[_0xc277('0x4')](_0xc277('0x4a'),_0xc277('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0xc277('0x51')],'set':function(_0x21c92d){this[_0xc277('0x4')](_0xc277('0x52'),_0x21c92d?_0x21c92d[_0xc277('0x22')](','):[]);},'get':function(){return this[_0xc277('0x23')](_0xc277('0x52'))?_['map'](this[_0xc277('0x23')]('permissions')[_0xc277('0x24')](','),function(_0x141c78){return parseInt(_0x141c78,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xc277('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xc277('0x3')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xc277('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xc277('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xc277('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xc277('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xc277('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xc277('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xc277('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xc277('0xc')](_0xc277('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xc277('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xc277('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xc277('0x23')](_0xc277('0x53'))?this[_0xc277('0x23')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xc277('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xc277('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xc277('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0xc277('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xc277('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xc277('0x16')],'defaultValue':![],'set':function(_0x240a3b){if(typeof _0x240a3b===_0xc277('0x54')){var _0x468c08=_0x240a3b==='1'?!![]:_0x240a3b==='0'?![]:_0x240a3b==='true'?!![]:_0x240a3b===_0xc277('0x55')?![]:![];this[_0xc277('0x4')](_0xc277('0x56'),_0x468c08);}else{this[_0xc277('0x4')](_0xc277('0x56'),_0x240a3b);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x46e43a){this[_0xc277('0x4')](_0xc277('0x57'),_0x46e43a);if(_0x46e43a===!![]){this[_0xc277('0x4')]('blockedAt',moment());this[_0xc277('0x4')]('loginAttempts',0x0);}else{this[_0xc277('0x4')](_0xc277('0x58'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x84ec=['dtlssetup','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','fullname','callerid','internal','email','toLowerCase','ENUM','admin','local','accountcode','format','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','user','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','auto','yes','nonat','force_rport,comedia','join','nat','ulaw;alaw;gsm','allow','split','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]','\x22\x22\x20<>','always','accept','refuse','uas','fingerprint','active','passive','actpass','update,nonat','get','transport','udp','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlscertfile','rtcp_mux','dtlsverify'];(function(_0x3a0ddd,_0x24432a){var _0xd396c6=function(_0x20adfd){while(--_0x20adfd){_0x3a0ddd['push'](_0x3a0ddd['shift']());}};_0xd396c6(++_0x24432a);}(_0x84ec,0x1b0));var _0xc84e=function(_0x4f28a6,_0x20eaa2){_0x4f28a6=_0x4f28a6-0x0;var _0x3b0d88=_0x84ec[_0x4f28a6];return _0x3b0d88;};'use strict';var Sequelize=require(_0xc84e('0x0'));var moment=require(_0xc84e('0x1'));var util=require(_0xc84e('0x2'));var _=require(_0xc84e('0x3'));module[_0xc84e('0x4')]={'name':{'type':Sequelize[_0xc84e('0x5')],'allowNull':![],'unique':_0xc84e('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x64f367){this['setDataValue'](_0xc84e('0x6'),_0x64f367);this[_0xc84e('0x7')](_0xc84e('0x8'),_0x64f367);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x1ceaf0){this[_0xc84e('0x7')](_0xc84e('0x9'),_0x1ceaf0);this['setDataValue'](_0xc84e('0xa'),util['format']('\x22%s\x22\x20<%s>',_0x1ceaf0,this['getDataValue'](_0xc84e('0xb'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc84e('0xc'),'validate':{'isEmail':!![]},'set':function(_0x1f3d09){if(_0x1f3d09){this[_0xc84e('0x7')](_0xc84e('0xc'),_0x1f3d09[_0xc84e('0xd')]());}}},'role':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0xf'),'user','agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xc84e('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0xc84e('0x10')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xc84e('0xb'),'set':function(_0x48627b){this[_0xc84e('0x7')]('internal',_0x48627b);this[_0xc84e('0x7')](_0xc84e('0x11'),_0x48627b);this['setDataValue'](_0xc84e('0xa'),util[_0xc84e('0x12')]('\x22%s\x22\x20<%s>',this[_0xc84e('0x13')](_0xc84e('0x9')),_0x48627b));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xc84e('0x5')]},'mobile':{'type':Sequelize[_0xc84e('0x5')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xc84e('0x5')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xc84e('0x5')]},'country':{'type':Sequelize[_0xc84e('0x5')]},'online':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xc84e('0x15')]},'voicePause':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xc84e('0x5')],'defaultValue':_0xc84e('0x16')},'lastPauseAt':{'type':Sequelize[_0xc84e('0x15')]},'chatCapacity':{'type':Sequelize[_0xc84e('0x17')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xc84e('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xc84e('0x17')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xc84e('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xc84e('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xc84e('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xc84e('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xc84e('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![],'defaultValue':_0xc84e('0x18')},'ipaddr':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0xc84e('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xc84e('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0xc84e('0x19'),_0xc84e('0x1a'),_0xc84e('0x1b')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![],'defaultValue':_0xc84e('0x1c')},'callingpres':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x1d'),_0xc84e('0x1e'),_0xc84e('0x1f'),'ALLOWED','PROHIB_NOT_SCREENED',_0xc84e('0x20'),_0xc84e('0x21'),_0xc84e('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![],'defaultValue':'udp','set':function(_0x125bb6){this[_0xc84e('0x7')]('transport',_0x125bb6?_0x125bb6['join'](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0xc84e('0x13')]('transport')['split'](','):null;},'comment':_0xc84e('0x23')},'dtmfmode':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x24'),_0xc84e('0x25'),'shortinfo','inband',_0xc84e('0x26')),'allowNull':!![],'defaultValue':_0xc84e('0x24')},'directmedia':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no',_0xc84e('0x28'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'nat':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![],'defaultValue':_0xc84e('0x29'),'set':function(_0x1e8a6a){this[_0xc84e('0x7')]('nat',_0x1e8a6a?_0x1e8a6a[_0xc84e('0x2a')](','):null);},'get':function(){return this['getDataValue'](_0xc84e('0x2b'))?this[_0xc84e('0x13')](_0xc84e('0x2b'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xc84e('0x5')]},'pickupgroup':{'type':Sequelize[_0xc84e('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc84e('0x5')]},'disallow':{'type':Sequelize[_0xc84e('0x5')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xc84e('0x5')],'allowNull':![],'defaultValue':_0xc84e('0x2c'),'set':function(_0x2be38a){this[_0xc84e('0x7')]('allow',_0x2be38a?_0x2be38a[_0xc84e('0x2a')](';'):_0xc84e('0x2c'));},'get':function(){return this[_0xc84e('0x13')]('allow')?this['getDataValue'](_0xc84e('0x2d'))[_0xc84e('0x2e')](';'):null;},'comment':_0xc84e('0x2f')},'autoframing':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![],'set':function(_0x5cf673){this[_0xc84e('0x7')](_0xc84e('0x30'),_0x5cf673?_0x5cf673[_0xc84e('0x2a')](','):null);},'get':function(){return this[_0xc84e('0x13')](_0xc84e('0x30'))?this[_0xc84e('0x13')](_0xc84e('0x30'))[_0xc84e('0x2e')](','):null;},'comment':_0xc84e('0x31')},'trustrpid':{'type':Sequelize['ENUM'](_0xc84e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xc84e('0x27'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xc84e('0x27'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xc84e('0x32')},'amaflags':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xc84e('0x27'),'no'),'allowNull':!![],'defaultValue':_0xc84e('0x27')},'busylevel':{'type':Sequelize[_0xc84e('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xc84e('0x27'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0xc84e('0x27'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xc84e('0xe')]('yes','no',_0xc84e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x34'),_0xc84e('0x35'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xc84e('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xc84e('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xc84e('0xe')]('uac',_0xc84e('0x36')),'allowNull':!![],'defaultValue':_0xc84e('0x36')},'t38pt_usertpsource':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0xc84e('0x27')},'keepalive':{'type':Sequelize[_0xc84e('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xc84e('0x17')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xc84e('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xc84e('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xc84e('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xc84e('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xc84e('0x27'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xc84e('0x27'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no',_0xc84e('0x37'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xc84e('0x17')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x38'),_0xc84e('0x39'),_0xc84e('0x3a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xc84e('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xc84e('0x27'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no','nonat','update',_0xc84e('0x3b')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xc84e('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0xc84e('0x15')]},'showWebBar':{'type':Sequelize[_0xc84e('0x17')],'defaultValue':0x0,'set':function(_0x5a1240){this['setDataValue']('showWebBar',_0x5a1240);var _0x54e81f=this[_0xc84e('0x3c')]({'plain':!![]});switch(_0x5a1240){case 0x0:case 0x1:var _0x2151ad=_0x54e81f[_0xc84e('0x3d')]?_['isArray'](_0x54e81f[_0xc84e('0x3d')])?_0x54e81f[_0xc84e('0x3d')][_0xc84e('0x2a')]():_0x54e81f[_0xc84e('0x3d')]:_0xc84e('0x3e');if(_0x2151ad===_0xc84e('0x3f')){_0x2151ad=_0xc84e('0x3e');}this['setDataValue']('transport',_0x2151ad);this[_0xc84e('0x7')](_0xc84e('0x40'),'no');this[_0xc84e('0x7')](_0xc84e('0x41'),null);this[_0xc84e('0x7')](_0xc84e('0x42'),null);this[_0xc84e('0x7')](_0xc84e('0x43'),null);this[_0xc84e('0x7')](_0xc84e('0x44'),null);this[_0xc84e('0x7')]('dtlsverify',null);this[_0xc84e('0x7')]('dtlssetup',null);this[_0xc84e('0x7')](_0xc84e('0x45'),null);this[_0xc84e('0x7')]('dtlsprivatekey',null);this[_0xc84e('0x7')](_0xc84e('0x46'),'no');break;case 0x2:this['setDataValue']('transport',_0xc84e('0x3f'));this['setDataValue'](_0xc84e('0x40'),_0xc84e('0x27'));this['setDataValue'](_0xc84e('0x41'),_0xc84e('0x27'));this[_0xc84e('0x7')]('force_avp',_0xc84e('0x27'));this[_0xc84e('0x7')](_0xc84e('0x43'),'yes');this[_0xc84e('0x7')]('dtlsenable',_0xc84e('0x27'));this['setDataValue'](_0xc84e('0x47'),'no');this[_0xc84e('0x7')](_0xc84e('0x48'),_0xc84e('0x3a'));this['setDataValue']('dtlscertfile',_0x54e81f[_0xc84e('0x45')]||'/etc/pki/tls/certs/motion.crt');this[_0xc84e('0x7')](_0xc84e('0x49'),_0x54e81f[_0xc84e('0x49')]||_0xc84e('0x4a'));this[_0xc84e('0x7')]('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x3f927f){this['setDataValue'](_0xc84e('0x4b'),_0x3f927f?_0x3f927f[_0xc84e('0x2a')](','):[]);},'get':function(){return this[_0xc84e('0x13')]('permissions')?_[_0xc84e('0x4c')](this[_0xc84e('0x13')](_0xc84e('0x4b'))['split'](','),function(_0x17bdfa){return parseInt(_0x17bdfa,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xc84e('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xc84e('0x5')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xc84e('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xc84e('0xe')](_0xc84e('0x27'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xc84e('0x5')]},'passwordResetAt':{'type':Sequelize[_0xc84e('0x15')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xc84e('0x4d')],'get':function(){return this[_0xc84e('0x13')](_0xc84e('0x4e'))?this[_0xc84e('0x13')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0xc84e('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xc84e('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![],'set':function(_0x58c285){if(typeof _0x58c285===_0xc84e('0x4f')){var _0x4f7508=_0x58c285==='1'?!![]:_0x58c285==='0'?![]:_0x58c285==='true'?!![]:_0x58c285==='false'?![]:![];this[_0xc84e('0x7')](_0xc84e('0x50'),_0x4f7508);}else{this[_0xc84e('0x7')]('screenrecording',_0x58c285);}}},'blocked':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![],'set':function(_0x1e038a){this[_0xc84e('0x7')](_0xc84e('0x51'),_0x1e038a);if(_0x1e038a===!![]){this[_0xc84e('0x7')](_0xc84e('0x52'),moment());this['setDataValue'](_0xc84e('0x53'),0x0);}else{this[_0xc84e('0x7')](_0xc84e('0x52'),null);}}},'blockedAt':{'type':Sequelize[_0xc84e('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xc84e('0x17')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xc84e('0x14')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index e576feb..2f91f2c 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 _0x503e=['getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','phone','loginInPause','LOCAL/%s@from-sip/n','intrf','user:forcelogout','headers','x-forwarded-for','remoteAddress','socket','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','forEach','YYYY-MM-DD\x20HH:mm:ss','all','getChannels','device','PAUSE','LOGININPAUSE','MemberReport','bulkCreate','isMiddleware','resolve','logout','QueuePause','pause','updateAttributes','DEFAULT\x20PAUSE','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','lastPauseAt','unpause','manual','mail','chat','fax','openchannel','%s%s','getTeams','Team','addTeams','setDataValue','Voice','getChatQueues','Chat','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','flatten','transaction','addAgent','each','getDataValue','removeTeams','Mail','getOpenchannelQueues','Openchannel','removeAgent','Queue:remove','getLists','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','isArray','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','CmHopper','concat','$and','$gte','$lt','$lte','$eq','$between','$notBetween','$in','$notIn','$like','$iLike','$notILike','$overlap','$contained','$any','dialActive','getApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','socket.io-emitter','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','status','json','count','offset','set','Content-Range','save','update','destroy','get','Users','user','filter','ignore','map','includes','role','find','name','UserProfileResource','then','stack','send','User','rawAttributes','fieldName','type','model','differenceBy','password','salt','keys','filters','intersection','query','attributes','fields','length','limit','order','sort','where','pick','merge','VIRTUAL','sequelize','lower','col','options','include','rows','show','params','includeAll','body','describe','addContacts','ids','omit','agent','agent\x20role','telephone','../../config/license/util','getLicense','telephones','users','isNil','format','count\x20%s:\x20%s','create','internal','Setting','findById','securePassword','min_internal','max','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','from','voicemail','mailbox','VoiceMail','fullname','email','101','102','104','105','107','109','114','Agents','Telephones','value','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','oldPassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','admin','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','channel','online','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','Queues','penalty','spread','toLowerCase','QueueId','emit','Queue:save','voice','VoiceQueue','push','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','remove','addAvatar','userpic','filename','getAvatar','root','server/files/images/logos/default_profile.png','download','existsSync','join','server/files/images/','getContacts','CmContact','CmList','List','Tag','Tags','color','tag','hasOwnProperty','nolimit','getQueues','Queue','findAll','getVoiceQueuesRt','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions'];(function(_0x2074db,_0x10b81b){var _0x27324c=function(_0x5c3d5c){while(--_0x5c3d5c){_0x2074db['push'](_0x2074db['shift']());}};_0x27324c(++_0x10b81b);}(_0x503e,0x9d));var _0xe503=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x503e[_0x122096];return _0x3d1966;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe503('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe503('0x1'));var jsonpatch=require(_0xe503('0x2'));var rp=require(_0xe503('0x3'));var moment=require(_0xe503('0x4'));var BPromise=require(_0xe503('0x5'));var Mustache=require(_0xe503('0x6'));var util=require(_0xe503('0x7'));var path=require(_0xe503('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe503('0x9'));var fs=require('fs');var _=require(_0xe503('0xa'));var squel=require(_0xe503('0xb'));var crypto=require('crypto');var jsforce=require(_0xe503('0xc'));var deskjs=require(_0xe503('0xd'));var toCsv=require(_0xe503('0xe'));var querystring=require(_0xe503('0xf'));var Papa=require(_0xe503('0x10'));var Redis=require(_0xe503('0x11'));var authService=require(_0xe503('0x12'));var qs=require(_0xe503('0x13'));var as=require(_0xe503('0x14'));var hardwareService=require(_0xe503('0x15'));var logger=require(_0xe503('0x16'))('api');var utils=require(_0xe503('0x17'));var config=require(_0xe503('0x18'));var db=require('../../mysqldb')['db'];config[_0xe503('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe503('0x1a'))(new Redis(config['redis']));require('./user.socket')['register'](socket);var jayson=require(_0xe503('0x1b'));var client=jayson[_0xe503('0x1c')][_0xe503('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x941365,_0x5da62c,_0x19113c){if(_0x19113c){var _0x282350=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x282350[_0xe503('0x1e')](_0x5da62c)){return _0x941365;}else{throw new db[(_0xe503('0x1f'))][(_0xe503('0x20'))](_0xe503('0x21'));}}else{return _0x941365;}}function respondWithRpcPromise(_0x433662,_0x368031,_0x190cc8,_0x387c6d){return new BPromise(function(_0x44ce73,_0x18ab91){var _0x2475f0=_0x387c6d||client;return _0x2475f0['request'](_0x433662,_0x190cc8)['then'](function(_0x36d7d2){logger[_0xe503('0x22')](_0xe503('0x23'),_0x368031,'request\x20sent');logger[_0xe503('0x24')](_0xe503('0x25'),_0x368031,_0xe503('0x26'),JSON[_0xe503('0x27')](_0x36d7d2));if(_0x36d7d2[_0xe503('0x28')]){if(_0x36d7d2['error']['code']===0x1f4){logger[_0xe503('0x28')](_0xe503('0x23'),_0x368031,_0x36d7d2[_0xe503('0x28')][_0xe503('0x29')]);return _0x18ab91(_0x36d7d2[_0xe503('0x28')][_0xe503('0x29')]);}logger[_0xe503('0x28')]('User,\x20%s,\x20%s',_0x368031,_0x36d7d2[_0xe503('0x28')][_0xe503('0x29')]);return _0x44ce73(_0x36d7d2['error']['message']);}else{logger[_0xe503('0x22')](_0xe503('0x23'),_0x368031,_0xe503('0x26'));_0x44ce73(_0x36d7d2[_0xe503('0x2a')]['message']);}})[_0xe503('0x2b')](function(_0x3a8383){logger['error'](_0xe503('0x23'),_0x368031,_0x3a8383);_0x18ab91(_0x3a8383);});});}function respondWithStatusCode(_0x594cce,_0x590e95){_0x590e95=_0x590e95||0xcc;return function(_0x3f5595){if(_0x3f5595){return _0x594cce[_0xe503('0x2c')](_0x590e95);}return _0x594cce['status'](_0x590e95)[_0xe503('0x2d')]();};}function respondWithResult(_0x1efbb8,_0x1636e0){_0x1636e0=_0x1636e0||0xc8;return function(_0x2c1429){if(_0x2c1429){return _0x1efbb8[_0xe503('0x2e')](_0x1636e0)[_0xe503('0x2f')](_0x2c1429);}};}function respondWithFilteredResult(_0x2fc9db,_0x27a113){return function(_0x4769c4){if(_0x4769c4){var _0x524578=_0x4769c4[_0xe503('0x30')],_0x12933a=_0x27a113[_0xe503('0x31')],_0x3a1d04=_0x27a113[_0xe503('0x31')]+_0x27a113['limit'],_0x40c61c;if(_0x3a1d04>=_0x524578){_0x3a1d04=_0x524578;_0x40c61c=0xc8;}else{_0x40c61c=0xce;}_0x2fc9db[_0xe503('0x2e')](_0x40c61c);return _0x2fc9db[_0xe503('0x32')](_0xe503('0x33'),_0x12933a+'-'+_0x3a1d04+'/'+_0x524578)['json'](_0x4769c4);}return null;};}function patchUpdates(_0x261605){return function(_0x1f8861){try{jsonpatch['apply'](_0x1f8861,_0x261605,!![]);}catch(_0x48b943){return BPromise['reject'](_0x48b943);}return _0x1f8861[_0xe503('0x34')]();};}function saveUpdates(_0x25dfb6,_0x51d264){return function(_0x30f68b){if(_0x30f68b){return _0x30f68b[_0xe503('0x35')](_0x25dfb6)['then'](function(_0x458273){return _0x458273;});}return null;};}function removeEntity(_0x33e1e8,_0x4fde75){return function(_0xce561){if(_0xce561){return _0xce561[_0xe503('0x36')]()['then'](function(){var _0x13c949=_0xce561[_0xe503('0x37')]({'plain':!![]});var _0x29461a=[{'name':_0xe503('0x38'),'value':_0xe503('0x39'),'ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x422c66=_(_0x29461a)[_0xe503('0x3a')](_0xe503('0x3b'))[_0xe503('0x3c')]('value')['value']();if(_[_0xe503('0x3d')](_0x422c66,_0x13c949[_0xe503('0x3e')])){return;}var _0xf42fe4=_[_0xe503('0x3f')](_0x29461a,['value',_0x13c949['role']])[_0xe503('0x40')];return db[_0xe503('0x41')]['destroy']({'where':{'type':_0xf42fe4,'resourceId':_0x13c949['id']}})[_0xe503('0x42')](function(){return _0xce561;});})['then'](function(){_0x33e1e8[_0xe503('0x2e')](0xcc)[_0xe503('0x2d')]();});}};}function handleEntityNotFound(_0x33e4e4,_0x237485){return function(_0xd57a75){if(!_0xd57a75){_0x33e4e4[_0xe503('0x2c')](0x194);}return _0xd57a75;};}function handleError(_0x4b5860,_0x2bab11){_0x2bab11=_0x2bab11||0x1f4;return function(_0xb94812){logger[_0xe503('0x28')](_0xb94812[_0xe503('0x43')]);if(_0xb94812[_0xe503('0x40')]){delete _0xb94812[_0xe503('0x40')];}_0x4b5860[_0xe503('0x2e')](_0x2bab11)[_0xe503('0x44')](_0xb94812);};}exports['index']=function(_0x2d903f,_0x452bc0){var _0x4cff9d={},_0x1c54f8={},_0x43a348={'count':0x0,'rows':[]};var _0x3038ae=_[_0xe503('0x3c')](db[_0xe503('0x45')][_0xe503('0x46')],function(_0x518dbe){return{'name':_0x518dbe[_0xe503('0x47')],'type':_0x518dbe[_0xe503('0x48')]['key']};});_0x1c54f8[_0xe503('0x49')]=_[_0xe503('0x4a')](_[_0xe503('0x3c')](_0x3038ae,_0xe503('0x40')),[_0xe503('0x4b'),_0xe503('0x4c')]);_0x1c54f8['query']=_[_0xe503('0x4d')](_0x2d903f['query']);_0x1c54f8[_0xe503('0x4e')]=_[_0xe503('0x4f')](_0x1c54f8[_0xe503('0x49')],_0x1c54f8[_0xe503('0x50')]);_0x4cff9d[_0xe503('0x51')]=_[_0xe503('0x4f')](_0x1c54f8['model'],qs['fields'](_0x2d903f[_0xe503('0x50')][_0xe503('0x52')]));_0x4cff9d[_0xe503('0x51')]=_0x4cff9d['attributes'][_0xe503('0x53')]?_0x4cff9d[_0xe503('0x51')]:_0x1c54f8[_0xe503('0x49')];if(!_0x2d903f[_0xe503('0x50')]['hasOwnProperty']('nolimit')){_0x4cff9d[_0xe503('0x54')]=qs['limit'](_0x2d903f[_0xe503('0x50')][_0xe503('0x54')]);_0x4cff9d[_0xe503('0x31')]=qs['offset'](_0x2d903f[_0xe503('0x50')][_0xe503('0x31')]);}_0x4cff9d[_0xe503('0x55')]=qs[_0xe503('0x56')](_0x2d903f[_0xe503('0x50')][_0xe503('0x56')]);_0x4cff9d[_0xe503('0x57')]=qs[_0xe503('0x4e')](_[_0xe503('0x58')](_0x2d903f[_0xe503('0x50')],_0x1c54f8[_0xe503('0x4e')]),_0x3038ae);if(_0x2d903f[_0xe503('0x50')]['filter']){_0x4cff9d[_0xe503('0x57')]=_[_0xe503('0x59')](_0x4cff9d[_0xe503('0x57')],{'$or':_['map'](_0x3038ae,function(_0x49e931){if(_0x49e931['type']!==_0xe503('0x5a')){return db[_0xe503('0x5b')][_0xe503('0x57')](db[_0xe503('0x5b')]['fn'](_0xe503('0x5c'),db[_0xe503('0x5b')][_0xe503('0x5d')](_0x49e931[_0xe503('0x40')])),{'$like':db['sequelize']['fn'](_0xe503('0x5c'),'%'+_0x2d903f['query'][_0xe503('0x3a')]+'%')});}})});}_0x4cff9d=_[_0xe503('0x59')]({},_0x4cff9d,_0x2d903f[_0xe503('0x5e')]);var _0x7cc8b6={'where':_0x4cff9d[_0xe503('0x57')]};return db[_0xe503('0x45')]['count'](_0x7cc8b6)[_0xe503('0x42')](function(_0x4325f6){_0x43a348[_0xe503('0x30')]=_0x4325f6;if(_0x2d903f[_0xe503('0x50')]['includeAll']){_0x4cff9d[_0xe503('0x5f')]=[{'all':!![]}];}return db['User']['findAll'](_0x4cff9d);})[_0xe503('0x42')](function(_0x2896af){_0x43a348[_0xe503('0x60')]=_0x2896af;return _0x43a348;})[_0xe503('0x42')](respondWithFilteredResult(_0x452bc0,_0x4cff9d))[_0xe503('0x2b')](handleError(_0x452bc0,null));};exports[_0xe503('0x61')]=function(_0x570850,_0x366151){var _0x5aa03a={'raw':![],'where':{'id':_0x570850[_0xe503('0x62')]['id']}},_0x170aaf={};_0x170aaf['model']=_[_0xe503('0x4a')](_['keys'](db['User'][_0xe503('0x46')]),[_0xe503('0x4b'),_0xe503('0x4c')]);_0x170aaf[_0xe503('0x50')]=_['keys'](_0x570850['query']);_0x170aaf['filters']=_[_0xe503('0x4f')](_0x170aaf['model'],_0x170aaf[_0xe503('0x50')]);_0x5aa03a[_0xe503('0x51')]=_['intersection'](_0x170aaf[_0xe503('0x49')],qs[_0xe503('0x52')](_0x570850['query'][_0xe503('0x52')]));_0x5aa03a[_0xe503('0x51')]=_0x5aa03a['attributes'][_0xe503('0x53')]?_0x5aa03a[_0xe503('0x51')]:_0x170aaf[_0xe503('0x49')];if(_0x570850['query'][_0xe503('0x63')]){_0x5aa03a['include']=[{'all':!![]}];}_0x5aa03a=_['merge']({},_0x5aa03a,_0x570850[_0xe503('0x5e')]);return db['User'][_0xe503('0x3f')](_0x5aa03a)['then'](handleEntityNotFound(_0x366151,null))[_0xe503('0x42')](respondWithResult(_0x366151,null))[_0xe503('0x2b')](handleError(_0x366151,null));};exports['bulkCreate']=function(_0x213ee3,_0x53a145){return db[_0xe503('0x45')]['bulkCreate'](_0x213ee3[_0xe503('0x64')],{'raw':![],'individualHooks':!![]})[_0xe503('0x42')](respondWithResult(_0x53a145,0xc9))[_0xe503('0x2b')](handleError(_0x53a145,null));};exports['update']=function(_0x38ffaf,_0x2af45f){if(_0x38ffaf[_0xe503('0x64')]['id']){delete _0x38ffaf[_0xe503('0x64')]['id'];}delete _0x38ffaf['body'][_0xe503('0x3e')];return db['User'][_0xe503('0x3f')]({'where':{'id':_0x38ffaf['params']['id']}})[_0xe503('0x42')](handleEntityNotFound(_0x2af45f,null))['then'](saveUpdates(_0x38ffaf[_0xe503('0x64')],null))[_0xe503('0x42')](respondWithResult(_0x2af45f,null))[_0xe503('0x2b')](handleError(_0x2af45f,null));};exports[_0xe503('0x65')]=function(_0x23da22,_0x5c20f7){return db['User'][_0xe503('0x65')]()['then'](respondWithResult(_0x5c20f7,null))[_0xe503('0x2b')](handleError(_0x5c20f7,null));};exports[_0xe503('0x66')]=function(_0x140bc3,_0x129cc8,_0x52c928){return db['User'][_0xe503('0x3f')]({'where':{'id':_0x140bc3['params']['id']}})[_0xe503('0x42')](handleEntityNotFound(_0x129cc8,null))[_0xe503('0x42')](function(_0x4536cb){if(_0x4536cb){return _0x4536cb[_0xe503('0x66')](_0x140bc3[_0xe503('0x64')][_0xe503('0x67')],_[_0xe503('0x68')](_0x140bc3[_0xe503('0x64')],[_0xe503('0x67'),'id'])||{});}})[_0xe503('0x42')](respondWithResult(_0x129cc8,null))[_0xe503('0x2b')](handleError(_0x129cc8,null));};var getLicense=function(_0x47e6af){return new BPromise(function(_0x3ca6bf,_0x56ff79){var _0x1e9c3e=0x0;_0x47e6af[_0xe503('0x64')][_0xe503('0x3e')]===_0xe503('0x69')&&_0x3ca6bf(_0xe503('0x6a'));return db[_0xe503('0x45')][_0xe503('0x30')]({'where':{'$or':[{'role':_0x47e6af[_0xe503('0x64')]['role']===_0xe503('0x6b')?_0xe503('0x6b'):['admin','user']}]}})['then'](function(_0x1a91d6){_0x1e9c3e=_0x1a91d6;return require(_0xe503('0x6c'))[_0xe503('0x6d')]();})[_0xe503('0x42')](function(_0xfd6b3e){var _0xcc2a6d=_0x47e6af[_0xe503('0x64')][_0xe503('0x3e')]===_0xe503('0x6b')?_0xe503('0x6e'):_0xe503('0x6f');if(!_[_0xe503('0x70')](_0xfd6b3e[_0xcc2a6d])&&_0x1e9c3e>=_0xfd6b3e[_0xcc2a6d]){return _0x56ff79({'message':'License\x20limit\x20reached'});}return _0x3ca6bf(util[_0xe503('0x71')](_0xe503('0x72'),_0xcc2a6d,_0x1e9c3e));})[_0xe503('0x2b')](function(_0x3081e1){return _0x56ff79(_0x3081e1);});});};exports[_0xe503('0x73')]=function(_0x29397e,_0x1474e5){return getLicense(_0x29397e)[_0xe503('0x42')](function(_0x199452){if(!_0x29397e[_0xe503('0x64')][_0xe503('0x74')]){var _0x5db8d5;return db[_0xe503('0x75')][_0xe503('0x76')](0x1)['then'](function(_0x3de947){return checkPasswordPattern(_0x3de947,_0x29397e['body'][_0xe503('0x4b')],_0x3de947[_0xe503('0x77')]);})[_0xe503('0x42')](function(_0x344bda){_0x5db8d5=_0x344bda[_0xe503('0x78')];return db[_0xe503('0x45')][_0xe503('0x79')](_0xe503('0x74'));})[_0xe503('0x42')](function(_0x3d7134){if(_[_0xe503('0x70')](_0x3d7134)){if(_0x5db8d5){_0x29397e[_0xe503('0x64')]['internal']=_0x5db8d5;}else{_0x29397e['body']['internal']=0x1;}}else{if(_[_0xe503('0x70')](_0x5db8d5)||_0x5db8d5==_0x3d7134){_0x29397e[_0xe503('0x64')][_0xe503('0x74')]=_0x3d7134+0x1;}else if(_0x5db8d5>_0x3d7134){_0x29397e[_0xe503('0x64')]['internal']=_0x5db8d5;}else{return db[_0xe503('0x5b')][_0xe503('0x50')](_0xe503('0x7a'),{'type':db[_0xe503('0x5b')][_0xe503('0x7b')]['SELECT']})[_0xe503('0x42')](function(_0x1ffa40){if(_0x1ffa40&&_0x1ffa40[_0xe503('0x53')]){for(var _0x280aca=0x0,_0x558b97=_0x1ffa40[_0xe503('0x53')];_0x280aca<_0x558b97&&_[_0xe503('0x70')](_0x29397e['body'][_0xe503('0x74')]);_0x280aca++){if(_0x5db8d5<=_0x1ffa40[_0x280aca][_0xe503('0x7c')]){_0x29397e['body'][_0xe503('0x74')]=_0x1ffa40[_0x280aca][_0xe503('0x7c')];}else if(_0x5db8d5>_0x1ffa40[_0x280aca]['from']&&_0x5db8d5<=_0x1ffa40[_0x280aca]['to']){_0x29397e[_0xe503('0x64')][_0xe503('0x74')]=_0x5db8d5;}}}if(_[_0xe503('0x70')](_0x29397e[_0xe503('0x64')][_0xe503('0x74')])){_0x29397e['body'][_0xe503('0x74')]=_0x3d7134+0x1;}});}}});}})[_0xe503('0x42')](function(){if(_0x29397e[_0xe503('0x64')][_0xe503('0x7d')]){_0x29397e[_0xe503('0x64')][_0xe503('0x7e')]=_0x29397e['body'][_0xe503('0x74')];_0x29397e[_0xe503('0x64')][_0xe503('0x7f')]={'mailbox':_0x29397e[_0xe503('0x64')][_0xe503('0x74')],'password':_0x29397e[_0xe503('0x64')][_0xe503('0x4b')],'fullname':_0x29397e[_0xe503('0x64')][_0xe503('0x80')],'email':_0x29397e[_0xe503('0x64')][_0xe503('0x81')]};}if(_0x29397e[_0xe503('0x64')]&&_0x29397e[_0xe503('0x64')][_0xe503('0x3e')]===_0xe503('0x69')){if(!_0x29397e[_0xe503('0x64')]['permissions']){_0x29397e[_0xe503('0x64')]['permissions']=[_0xe503('0x82'),_0xe503('0x83'),'103','113','110',_0xe503('0x84'),_0xe503('0x85'),'106',_0xe503('0x86'),'108',_0xe503('0x87'),'100','111',_0xe503('0x88')];}}return db['User'][_0xe503('0x73')](_0x29397e[_0xe503('0x64')],{'include':[{'model':db[_0xe503('0x7f')],'as':'VoiceMail'}]});})['then'](function(_0x289a1e){if(_0x29397e[_0xe503('0x64')][_0xe503('0x3e')]==='user')return _0x289a1e;var _0x98713b=_0x29397e[_0xe503('0x39')]['get']({'plain':!![]});if(!_0x98713b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x98713b['role']===_0xe503('0x39')){var _0xca37cc=_0x289a1e['get']({'plain':!![]});var _0x524145=[{'name':_0xe503('0x89'),'value':_0xe503('0x69')},{'name':_0xe503('0x8a'),'value':_0xe503('0x6b')}];var _0x5d7706=_[_0xe503('0x3f')](_0x524145,[_0xe503('0x8b'),_0xca37cc['role']])['name'];return db[_0xe503('0x8c')][_0xe503('0x3f')]({'where':{'name':_0x5d7706,'userProfileId':_0x98713b[_0xe503('0x8d')]},'raw':!![]})[_0xe503('0x42')](function(_0x36f6a1){if(_0x36f6a1&&_0x36f6a1['autoAssociation']===0x0){return db[_0xe503('0x41')][_0xe503('0x73')]({'name':_0xca37cc[_0xe503('0x40')],'resourceId':_0xca37cc['id'],'type':_0x36f6a1[_0xe503('0x40')],'sectionId':_0x36f6a1['id']},{})['then'](function(){return _0x289a1e;});}else{return _0x289a1e;}})['catch'](function(_0x1e4370){logger[_0xe503('0x28')](_0xe503('0x8e'),_0x1e4370);throw _0x1e4370;});}return _0x289a1e;})[_0xe503('0x42')](respondWithResult(_0x1474e5,0xc9))[_0xe503('0x2b')](handleError(_0x1474e5,null));};exports['changePassword']=function(_0x3a2acb,_0xdeca68,_0x2565bc){var _0x5628cb=![];if(_0x3a2acb[_0xe503('0x64')]['id']){delete _0x3a2acb[_0xe503('0x64')]['id'];}return db[_0xe503('0x75')][_0xe503('0x8f')]({'attributes':['id','securePassword']})[_0xe503('0x42')](function(_0x101e21){_0x5628cb=_0x101e21['securePassword'];return db[_0xe503('0x45')][_0xe503('0x3f')]({'where':{'id':_0x3a2acb[_0xe503('0x62')]['id']}});})[_0xe503('0x42')](function(_0x30c304){if(_0x30c304){if(_0x30c304['id']==_0x3a2acb[_0xe503('0x39')]['id']){if(!_0x3a2acb[_0xe503('0x64')][_0xe503('0x90')]||!_0x3a2acb[_0xe503('0x64')][_0xe503('0x91')]){throw new db[(_0xe503('0x1f'))][(_0xe503('0x20'))](_0xe503('0x92'));}if(!_0x30c304['authenticate'](_0x3a2acb[_0xe503('0x64')][_0xe503('0x90')])){throw new db[(_0xe503('0x1f'))][(_0xe503('0x20'))](_0xe503('0x93'));}if(_0x3a2acb['body'][_0xe503('0x90')]==_0x3a2acb[_0xe503('0x64')][_0xe503('0x91')]){throw new db['Sequelize'][(_0xe503('0x20'))](_0xe503('0x94'));}return _0x30c304;}else if(_0x3a2acb[_0xe503('0x39')][_0xe503('0x3e')]==_0xe503('0x95')){if(!_0x3a2acb[_0xe503('0x64')][_0xe503('0x91')]){throw new db[(_0xe503('0x1f'))]['ValidationError'](_0xe503('0x96'));}return _0x30c304;}else if(_0x3a2acb[_0xe503('0x39')][_0xe503('0x3e')]==_0xe503('0x39')){if(!_0x3a2acb[_0xe503('0x64')]['newPassword']){throw new db[(_0xe503('0x1f'))][(_0xe503('0x20'))](_0xe503('0x96'));}if(_0x30c304[_0xe503('0x3e')]!='agent'){throw new db['Sequelize'][(_0xe503('0x20'))](_0xe503('0x97'));}return _0x30c304;}else{throw new db[(_0xe503('0x1f'))]['ValidationError'](_0xe503('0x97'));}}return null;})['then'](handleEntityNotFound(_0xdeca68,null))[_0xe503('0x42')](function(_0x338c08){return checkPasswordPattern(_0x338c08,_0x3a2acb[_0xe503('0x64')][_0xe503('0x91')],_0x5628cb);})[_0xe503('0x42')](saveUpdates({'password':_0x3a2acb[_0xe503('0x64')][_0xe503('0x91')],'passwordResetAt':_0x3a2acb[_0xe503('0x39')]['id']==_0x3a2acb[_0xe503('0x62')]['id']?moment():null},null))[_0xe503('0x42')](respondWithResult(_0xdeca68,null))[_0xe503('0x2b')](handleError(_0xdeca68,null));};exports[_0xe503('0x98')]=function(_0x55c7d8,_0x728cd5,_0x180b11){var _0x8e5c72=_0x55c7d8[_0xe503('0x64')][_0xe503('0x99')];return db['User'][_0xe503('0x3f')]({'where':{'id':_0x55c7d8[_0xe503('0x62')]['id']},'attributes':['id',_0xe503('0x40'),_0xe503('0x3e'),_0xe503('0x9a'),'loginInPause',_0xe503('0x9b'),_0xe503('0x9c')]})[_0xe503('0x42')](handleEntityNotFound(_0x728cd5,null))[_0xe503('0x42')](function(_0x125829){if(_0x125829){if(!utils[_0xe503('0x9d')](_0x8e5c72)){throw new db['Sequelize'][(_0xe503('0x20'))](_0xe503('0x9e'));}return _0x125829[_0xe503('0x9f')+_[_0xe503('0xa0')](_0x8e5c72['toLowerCase']())+_0xe503('0xa1')](_0x55c7d8[_0xe503('0x64')][_0xe503('0x67')],{'penalty':_0x55c7d8[_0xe503('0x64')][_0xe503('0xa2')]||0x0})[_0xe503('0xa3')](function(_0x3bda51){for(var _0x3da903=0x0;_0x3da903<_0x55c7d8[_0xe503('0x64')]['ids']['length'];_0x3da903+=0x1){var _0x34b40a={'UserId':_0x55c7d8[_0xe503('0x62')]['id']};_0x34b40a[_[_0xe503('0xa0')](_0x8e5c72[_0xe503('0xa4')]())+_0xe503('0xa5')]=_0x55c7d8[_0xe503('0x64')]['ids'][_0x3da903];socket[_0xe503('0xa6')](_0xe503('0x39')+_[_0xe503('0xa0')](_0x8e5c72[_0xe503('0xa4')]())+_0xe503('0xa7'),_0x34b40a);}return _0x3bda51;})['then'](function(){if(_0x8e5c72===_0xe503('0xa8')){return db[_0xe503('0xa9')]['findAll']({'where':{'id':_0x55c7d8[_0xe503('0x64')][_0xe503('0x67')]||[]},'raw':!![],'attributes':['id',_0xe503('0x40')]});}})[_0xe503('0x42')](function(_0x564dac){var _0x1d836e=_0x125829['get']({'plain':!![]});var _0x1009e5=[];if(_0x8e5c72==='voice'&&_0x1d836e['role']===_0xe503('0x69')&&_0x1d836e[_0xe503('0x9a')]){for(var _0x5a7972=0x0;_0x5a7972<_0x564dac[_0xe503('0x53')];_0x5a7972+=0x1){_0x1009e5[_0xe503('0xaa')]({'membername':_0x1d836e[_0xe503('0x40')],'UserId':_0x1d836e['id'],'queue_name':_0x564dac[_0x5a7972]['name'],'VoiceQueueId':_0x564dac[_0x5a7972]['id'],'interface':_[_0xe503('0x70')](_0x1d836e[_0xe503('0x9c')])?util[_0xe503('0x71')](_0xe503('0xab'),_0x1d836e['name']):_0x1d836e['interface'],'paused':_0x1d836e['voicePause']||![],'penalty':_0x55c7d8[_0xe503('0x64')][_0xe503('0xa2')]||0x0});}return BPromise['each'](_0x1009e5,function(_0x571c3a){return db[_0xe503('0xac')][_0xe503('0xad')](_0x571c3a);});}return _0x125829;});}})[_0xe503('0x42')](respondWithStatusCode(_0x728cd5,null))[_0xe503('0x2b')](handleError(_0x728cd5,null));};exports[_0xe503('0xae')]=function(_0x235d95,_0x13b626,_0xd9af83){var _0x224c4f;return db['User'][_0xe503('0x3f')]({'where':{'id':_0x235d95[_0xe503('0x62')]['id']},'attributes':['id',_0xe503('0x40'),_0xe503('0x3e')]})[_0xe503('0x42')](handleEntityNotFound(_0x13b626,null))[_0xe503('0x42')](function(_0x5bfd6e){if(_0x5bfd6e){_0x224c4f=_0x5bfd6e;if(!_0x235d95[_0xe503('0x50')][_0xe503('0x99')]||!utils['isValidChannel'](_0x235d95[_0xe503('0x50')][_0xe503('0x99')])){throw new db[(_0xe503('0x1f'))][(_0xe503('0x20'))](_0xe503('0x9e'));}return _0x5bfd6e[_0xe503('0xaf')+_[_0xe503('0xa0')](_0x235d95['query']['channel'][_0xe503('0xa4')]())+_0xe503('0xa1')](_0x235d95[_0xe503('0x50')][_0xe503('0x67')]);}})['then'](function(_0x4c567b){for(var _0x36cd6a=0x0;_0x36cd6a<_0x235d95[_0xe503('0x50')][_0xe503('0x67')][_0xe503('0x53')];_0x36cd6a+=0x1){var _0x15c875={'UserId':_0x235d95[_0xe503('0x62')]['id']};_0x15c875[_['capitalize'](_0x235d95[_0xe503('0x50')][_0xe503('0x99')]['toLowerCase']())+_0xe503('0xa5')]=_0x235d95['query'][_0xe503('0x67')][_0x36cd6a];socket[_0xe503('0xa6')](_0xe503('0x39')+_[_0xe503('0xa0')](_0x235d95['query'][_0xe503('0x99')][_0xe503('0xa4')]())+'Queue:remove',_0x15c875);}return _0x4c567b;})[_0xe503('0x42')](function(){if(_0x235d95['query']['channel']===_0xe503('0xa8')){return db['UserVoiceQueueRt'][_0xe503('0x36')]({'where':{'UserId':_0x235d95['params']['id'],'VoiceQueueId':_0x235d95['query'][_0xe503('0x67')]},'individualHooks':!![]})[_0xe503('0x42')](function(){return _0x224c4f;});}return _0x224c4f;})[_0xe503('0x42')](respondWithStatusCode(_0x13b626,null))[_0xe503('0x2b')](handleError(_0x13b626,null));};exports[_0xe503('0xb0')]=function(_0x2ea34a,_0x46a6ff,_0x1309ab){_0x2ea34a['body'][_0xe503('0xb1')]=_0x2ea34a['file'][_0xe503('0xb2')];return db[_0xe503('0x45')]['find']({'where':{'id':_0x2ea34a[_0xe503('0x62')]['id']}})[_0xe503('0x42')](handleEntityNotFound(_0x46a6ff,null))[_0xe503('0x42')](saveUpdates(_0x2ea34a['body'],null))[_0xe503('0x42')](respondWithResult(_0x46a6ff,null))[_0xe503('0x2b')](handleError(_0x46a6ff,null));};exports[_0xe503('0xb3')]=function(_0x3e9a9e,_0x4b5b02,_0x51e395){var _0x2a0f65=path['join'](config[_0xe503('0xb4')],_0xe503('0xb5'));return db[_0xe503('0x45')]['find']({'where':{'id':_0x3e9a9e[_0xe503('0x62')]['id']},'attributes':['id',_0xe503('0xb1')],'raw':!![]})[_0xe503('0x42')](handleEntityNotFound(_0x4b5b02,null))[_0xe503('0x42')](function(_0x3f0f75){if(_0x3f0f75){if(_['isNil'](_0x3f0f75['userpic'])){return _0x4b5b02[_0xe503('0xb6')](_0x2a0f65);}else{if(!fs[_0xe503('0xb7')](path[_0xe503('0xb8')](config[_0xe503('0xb4')],_0xe503('0xb9'),_0x3f0f75['userpic']))){return _0x4b5b02[_0xe503('0xb6')](_0x2a0f65);}return _0x4b5b02[_0xe503('0xb6')](path[_0xe503('0xb8')](config[_0xe503('0xb4')],'server/files/images/',_0x3f0f75[_0xe503('0xb1')]));}}})[_0xe503('0x2b')](handleError(_0x4b5b02,null));};exports[_0xe503('0xba')]=function(_0x1d679f,_0x1a509e,_0x2026aa){var _0x33c4a9={};var _0x33a0be={};var _0x36f330;var _0xc0ad0f;return db[_0xe503('0x45')][_0xe503('0x8f')]({'where':{'id':_0x1d679f[_0xe503('0x62')]['id']}})[_0xe503('0x42')](handleEntityNotFound(_0x1a509e,null))[_0xe503('0x42')](function(_0x5a1b08){if(_0x5a1b08){_0x36f330=_0x5a1b08;_0x33a0be[_0xe503('0x49')]=_[_0xe503('0x4d')](db[_0xe503('0xbb')][_0xe503('0x46')]);_0x33a0be[_0xe503('0x50')]=_[_0xe503('0x4d')](_0x1d679f[_0xe503('0x50')]);_0x33a0be[_0xe503('0x4e')]=_['intersection'](_0x33a0be['model'],_0x33a0be[_0xe503('0x50')]);_0x33c4a9[_0xe503('0x51')]=_['intersection'](_0x33a0be[_0xe503('0x49')],qs[_0xe503('0x52')](_0x1d679f[_0xe503('0x50')][_0xe503('0x52')]));_0x33c4a9[_0xe503('0x51')]=_0x33c4a9[_0xe503('0x51')][_0xe503('0x53')]?_0x33c4a9[_0xe503('0x51')]:_0x33a0be[_0xe503('0x49')];_0x33c4a9[_0xe503('0x55')]=qs[_0xe503('0x56')](_0x1d679f['query']['sort']);_0x33c4a9[_0xe503('0x57')]=qs['filters'](_[_0xe503('0x58')](_0x1d679f['query'],_0x33a0be[_0xe503('0x4e')]));if(_0x1d679f[_0xe503('0x50')]['filter']){_0x33c4a9['where']=_['merge'](_0x33c4a9['where'],{'$or':_[_0xe503('0x3c')](_0x33c4a9[_0xe503('0x51')],function(_0x1afa35){var _0x275de0={};_0x275de0[_0x1afa35]={'$like':'%'+_0x1d679f[_0xe503('0x50')]['filter']+'%'};return _0x275de0;})});}_0x33c4a9=_[_0xe503('0x59')]({},_0x33c4a9,_0x1d679f[_0xe503('0x5e')]);return _0x36f330[_0xe503('0xba')](_0x33c4a9);}})[_0xe503('0x42')](function(_0x4d6ab6){if(_0x4d6ab6){_0xc0ad0f=_0x4d6ab6[_0xe503('0x53')];if(_0x1d679f['query']['hasOwnProperty'](_0xe503('0x63'))){_0x33c4a9[_0xe503('0x5f')]=[{'model':db[_0xe503('0xbc')],'as':_0xe503('0xbd'),'required':![]},{'model':db[_0xe503('0xbe')],'as':_0xe503('0xbf'),'attributes':['id',_0xe503('0x40'),_0xe503('0xc0')],'where':_0x1d679f['query'][_0xe503('0xc1')]?{'id':_0x1d679f[_0xe503('0x50')]['tag']}:undefined,'required':_0x1d679f[_0xe503('0x50')][_0xe503('0xc1')]?!![]:![]}];}if(!_0x1d679f['query'][_0xe503('0xc2')](_0xe503('0xc3'))){_0x33c4a9[_0xe503('0x54')]=qs[_0xe503('0x54')](_0x1d679f[_0xe503('0x50')][_0xe503('0x54')]);_0x33c4a9[_0xe503('0x31')]=qs[_0xe503('0x31')](_0x1d679f[_0xe503('0x50')][_0xe503('0x31')]);}return _0x36f330[_0xe503('0xba')](_0x33c4a9);}})[_0xe503('0x42')](function(_0x58be01){if(_0x58be01){return _0x58be01?{'count':_0xc0ad0f,'rows':_0x58be01}:null;}})['then'](respondWithResult(_0x1a509e,null))[_0xe503('0x2b')](handleError(_0x1a509e,null));};exports[_0xe503('0xc4')]=function(_0x5d827a,_0x3c0e49,_0x27d90f){var _0x4326a5;var _0x361f64;var _0x4b44c3={};var _0xed97b4;return db[_0xe503('0x45')][_0xe503('0x8f')]({'where':{'id':_0x5d827a[_0xe503('0x62')]['id']},'attributes':['id',_0xe503('0x40'),_0xe503('0x3e')]})[_0xe503('0x42')](handleEntityNotFound(_0x3c0e49,null))[_0xe503('0x42')](function(_0x16439a){if(!utils['isValidChannel'](_0x5d827a['query']['channel'])){throw new db[(_0xe503('0x1f'))]['ValidationError'](_0xe503('0x9e'));}_0x4326a5=_0x16439a;var _0x27cc1c={};_0x27cc1c[_0xe503('0x49')]=_[_0xe503('0x4d')](db[_[_0xe503('0xa0')](_0x5d827a[_0xe503('0x50')]['channel'])+_0xe503('0xc5')][_0xe503('0x46')]);_0x27cc1c['query']=_[_0xe503('0x4d')](_0x5d827a[_0xe503('0x50')]);_0x27cc1c[_0xe503('0x4e')]=_[_0xe503('0x4f')](_0x27cc1c[_0xe503('0x49')],_0x27cc1c[_0xe503('0x50')]);_0x4b44c3[_0xe503('0x51')]=_[_0xe503('0x4f')](_0x27cc1c['model'],qs['fields'](_0x5d827a['query']['fields']));_0x4b44c3['attributes']=_0x4b44c3[_0xe503('0x51')][_0xe503('0x53')]?_0x4b44c3[_0xe503('0x51')]:_0x27cc1c['model'];_0x4b44c3['order']=qs[_0xe503('0x56')](_0x5d827a[_0xe503('0x50')][_0xe503('0x56')]);_0x4b44c3[_0xe503('0x57')]=qs[_0xe503('0x4e')](_[_0xe503('0x58')](_0x5d827a[_0xe503('0x50')],_0x27cc1c['filters']));if(_0x5d827a['query'][_0xe503('0x3a')]){_0x4b44c3[_0xe503('0x57')]=_['merge'](_0x4b44c3['where'],{'$or':_['map'](_0x4b44c3['attributes'],function(_0x3f3718){var _0xbfad11={};_0xbfad11[_0x3f3718]={'$like':'%'+_0x5d827a[_0xe503('0x50')]['filter']+'%'};return _0xbfad11;})});}_0x4b44c3=_[_0xe503('0x59')]({},_0x4b44c3,_0x5d827a[_0xe503('0x5e')]);switch(_0x4326a5['role']){case _0xe503('0x95'):return db[_[_0xe503('0xa0')](_0x5d827a[_0xe503('0x50')][_0xe503('0x99')])+'Queue']['findAll'](_0x4b44c3);case _0xe503('0x39'):case _0xe503('0x69'):return _0x4326a5[_0xe503('0x37')+_['capitalize'](_0x5d827a[_0xe503('0x50')][_0xe503('0x99')])+_0xe503('0xa1')](_0x4b44c3);default:throw new db[(_0xe503('0x1f'))]['ValidationError']('Unknown\x20role');}})[_0xe503('0x42')](function(_0x49f8ec){_0xed97b4=_0x49f8ec[_0xe503('0x53')];if(!_0x5d827a[_0xe503('0x50')][_0xe503('0xc2')](_0xe503('0xc3'))){_0x4b44c3['limit']=qs[_0xe503('0x54')](_0x5d827a[_0xe503('0x50')]['limit']);_0x4b44c3[_0xe503('0x31')]=qs['offset'](_0x5d827a['query'][_0xe503('0x31')]);}switch(_0x4326a5[_0xe503('0x3e')]){case _0xe503('0x95'):return db[_[_0xe503('0xa0')](_0x5d827a[_0xe503('0x50')][_0xe503('0x99')])+_0xe503('0xc5')][_0xe503('0xc6')](_0x4b44c3);case _0xe503('0x39'):case _0xe503('0x69'):return _0x4326a5['get'+_[_0xe503('0xa0')](_0x5d827a[_0xe503('0x50')][_0xe503('0x99')])+_0xe503('0xa1')](_0x4b44c3);}})[_0xe503('0x42')](function(_0x22c816){return{'count':_0xed97b4,'rows':_0x22c816};})[_0xe503('0x42')](respondWithResult(_0x3c0e49,null))[_0xe503('0x2b')](handleError(_0x3c0e49,null));};exports['getVoiceQueuesRt']=function(_0x3e2dc5,_0x2afa01,_0x47144d){var _0x3fa160={};var _0x559053={};var _0x39b0ed;var _0x511fa9;return db['User'][_0xe503('0x8f')]({'where':{'id':_0x3e2dc5[_0xe503('0x62')]['id']}})['then'](handleEntityNotFound(_0x2afa01,null))['then'](function(_0x48e203){if(_0x48e203){_0x39b0ed=_0x48e203;_0x559053['model']=_['keys'](db[_0xe503('0xac')][_0xe503('0x46')]);_0x559053[_0xe503('0x50')]=_[_0xe503('0x4d')](_0x3e2dc5[_0xe503('0x50')]);_0x559053[_0xe503('0x4e')]=_[_0xe503('0x4f')](_0x559053[_0xe503('0x49')],_0x559053[_0xe503('0x50')]);_0x3fa160[_0xe503('0x51')]=_['intersection'](_0x559053['model'],qs[_0xe503('0x52')](_0x3e2dc5[_0xe503('0x50')]['fields']));_0x3fa160[_0xe503('0x51')]=_0x3fa160[_0xe503('0x51')][_0xe503('0x53')]?_0x3fa160[_0xe503('0x51')]:_0x559053[_0xe503('0x49')];_0x3fa160[_0xe503('0x55')]=qs[_0xe503('0x56')](_0x3e2dc5[_0xe503('0x50')]['sort']);_0x3fa160[_0xe503('0x57')]=qs[_0xe503('0x4e')](_[_0xe503('0x58')](_0x3e2dc5[_0xe503('0x50')],_0x559053[_0xe503('0x4e')]));if(_0x3e2dc5[_0xe503('0x50')][_0xe503('0x3a')]){_0x3fa160[_0xe503('0x57')]=_['merge'](_0x3fa160[_0xe503('0x57')],{'$or':_[_0xe503('0x3c')](_0x3fa160['attributes'],function(_0x1ead0a){var _0x89ab4a={};_0x89ab4a[_0x1ead0a]={'$like':'%'+_0x3e2dc5[_0xe503('0x50')][_0xe503('0x3a')]+'%'};return _0x89ab4a;})});}_0x3fa160=_[_0xe503('0x59')]({},_0x3fa160,_0x3e2dc5['options']);return _0x39b0ed[_0xe503('0xc7')](_0x3fa160);}})[_0xe503('0x42')](function(_0x219aab){if(_0x219aab){_0x511fa9=_0x219aab['length'];if(!_0x3e2dc5[_0xe503('0x50')][_0xe503('0xc2')](_0xe503('0xc3'))){_0x3fa160[_0xe503('0x54')]=qs['limit'](_0x3e2dc5['query'][_0xe503('0x54')]);_0x3fa160[_0xe503('0x31')]=qs[_0xe503('0x31')](_0x3e2dc5[_0xe503('0x50')]['offset']);}return _0x39b0ed[_0xe503('0xc7')](_0x3fa160);}})[_0xe503('0x42')](function(_0x587d4e){if(_0x587d4e){return _0x587d4e?{'count':_0x511fa9,'rows':_0x587d4e}:null;}})['then'](respondWithResult(_0x2afa01,null))[_0xe503('0x2b')](handleError(_0x2afa01,null));};exports[_0xe503('0xc8')]=function(_0x36359b,_0x640e8a,_0xec5d4b){var _0x370732={};var _0x3f2af5={};var _0x13f0f4;var _0x25f37f;return db['User'][_0xe503('0x8f')]({'where':{'id':_0x36359b['params']['id']}})['then'](handleEntityNotFound(_0x640e8a,null))['then'](function(_0x5c9686){if(_0x5c9686){_0x13f0f4=_0x5c9686;_0x3f2af5[_0xe503('0x49')]=_['keys'](db['ChatGroup'][_0xe503('0x46')]);_0x3f2af5['query']=_[_0xe503('0x4d')](_0x36359b[_0xe503('0x50')]);_0x3f2af5[_0xe503('0x4e')]=_[_0xe503('0x4f')](_0x3f2af5['model'],_0x3f2af5['query']);_0x370732['attributes']=_[_0xe503('0x4f')](_0x3f2af5[_0xe503('0x49')],qs[_0xe503('0x52')](_0x36359b[_0xe503('0x50')]['fields']));_0x370732[_0xe503('0x51')]=_0x370732[_0xe503('0x51')][_0xe503('0x53')]?_0x370732['attributes']:_0x3f2af5['model'];_0x370732['order']=qs['sort'](_0x36359b['query'][_0xe503('0x56')]);_0x370732[_0xe503('0x57')]=qs[_0xe503('0x4e')](_[_0xe503('0x58')](_0x36359b['query'],_0x3f2af5[_0xe503('0x4e')]));if(_0x36359b['query'][_0xe503('0x3a')]){_0x370732[_0xe503('0x57')]=_[_0xe503('0x59')](_0x370732[_0xe503('0x57')],{'$or':_[_0xe503('0x3c')](_0x370732[_0xe503('0x51')],function(_0x2eb35e){var _0x34a378={};_0x34a378[_0x2eb35e]={'$like':'%'+_0x36359b['query'][_0xe503('0x3a')]+'%'};return _0x34a378;})});}_0x370732=_[_0xe503('0x59')]({},_0x370732,_0x36359b['options']);return _0x13f0f4['getGroups'](_0x370732);}})[_0xe503('0x42')](function(_0x3b89ba){if(_0x3b89ba){_0x25f37f=_0x3b89ba[_0xe503('0x53')];if(!_0x36359b[_0xe503('0x50')][_0xe503('0xc2')](_0xe503('0xc3'))){_0x370732[_0xe503('0x54')]=qs[_0xe503('0x54')](_0x36359b[_0xe503('0x50')][_0xe503('0x54')]);_0x370732['offset']=qs[_0xe503('0x31')](_0x36359b[_0xe503('0x50')][_0xe503('0x31')]);}return _0x13f0f4[_0xe503('0xc8')](_0x370732);}})[_0xe503('0x42')](function(_0x1c3a2c){if(_0x1c3a2c){return _0x1c3a2c?{'count':_0x25f37f,'rows':_0x1c3a2c}:null;}})[_0xe503('0x42')](respondWithResult(_0x640e8a,null))[_0xe503('0x2b')](handleError(_0x640e8a,null));};exports[_0xe503('0xc9')]=function(_0x56ea05,_0x2a741e,_0x3e1c63){var _0x351118={'raw':!![],'where':{}};var _0x3e7ead={};var _0x427d2e={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x56ea05[_0xe503('0x62')]['id']}})[_0xe503('0x42')](handleEntityNotFound(_0x2a741e,null))[_0xe503('0x42')](function(_0x16c355){if(_0x16c355){_0x3e7ead[_0xe503('0x49')]=_[_0xe503('0x4d')](db[_0xe503('0xca')][_0xe503('0x46')]);_0x3e7ead['query']=_[_0xe503('0x4d')](_0x56ea05[_0xe503('0x50')]);_0x3e7ead['filters']=_['intersection'](_0x3e7ead[_0xe503('0x49')],_0x3e7ead[_0xe503('0x50')]);_0x351118[_0xe503('0x51')]=_['intersection'](_0x3e7ead[_0xe503('0x49')],qs[_0xe503('0x52')](_0x56ea05[_0xe503('0x50')][_0xe503('0x52')]));_0x351118['attributes']=_0x351118[_0xe503('0x51')][_0xe503('0x53')]?_0x351118[_0xe503('0x51')]:_0x3e7ead[_0xe503('0x49')];if(!_0x56ea05[_0xe503('0x50')][_0xe503('0xc2')]('nolimit')){_0x351118[_0xe503('0x54')]=qs['limit'](_0x56ea05[_0xe503('0x50')]['limit']);_0x351118['offset']=qs['offset'](_0x56ea05['query']['offset']);}_0x351118[_0xe503('0x55')]=qs['sort'](_0x56ea05[_0xe503('0x50')]['sort']);_0x351118[_0xe503('0x57')]=qs[_0xe503('0x4e')](_[_0xe503('0x58')](_0x56ea05[_0xe503('0x50')],_0x3e7ead['filters']));_0x351118[_0xe503('0x57')][_0xe503('0xcb')]=_0x16c355['id'];if(_0x56ea05[_0xe503('0x50')]['filter']){_0x351118[_0xe503('0x57')]=_[_0xe503('0x59')](_0x351118[_0xe503('0x57')],{'$or':_['map'](_0x351118[_0xe503('0x51')],function(_0x5731c4){var _0x22567e={};_0x22567e[_0x5731c4]={'$like':'%'+_0x56ea05[_0xe503('0x50')][_0xe503('0x3a')]+'%'};return _0x22567e;})});}_0x351118=_[_0xe503('0x59')]({},_0x351118,_0x56ea05[_0xe503('0x5e')]);return db[_0xe503('0xca')][_0xe503('0x30')]({'where':_0x351118[_0xe503('0x57')]})['then'](function(_0x1853a5){_0x427d2e[_0xe503('0x30')]=_0x1853a5;if(_0x56ea05[_0xe503('0x50')][_0xe503('0x63')]){_0x351118['include']=[{'all':!![]}];}return db[_0xe503('0xca')][_0xe503('0xc6')](_0x351118);})[_0xe503('0x42')](function(_0x3b3e33){_0x427d2e[_0xe503('0x60')]=_0x3b3e33;return _0x427d2e;});}})[_0xe503('0x42')](respondWithFilteredResult(_0x2a741e,_0x351118))[_0xe503('0x2b')](handleError(_0x2a741e,null));};exports[_0xe503('0xcc')]=function(_0x547de2,_0x24751d,_0x18cca5){var _0x2a731b={'raw':!![],'where':{}};var _0x5d209b={};var _0x54b24e={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x547de2['params']['id']}})[_0xe503('0x42')](handleEntityNotFound(_0x24751d,null))['then'](function(_0x5d1bd6){if(_0x5d1bd6){_0x5d209b['model']=_[_0xe503('0x4d')](db[_0xe503('0xcd')][_0xe503('0x46')]);_0x5d209b[_0xe503('0x50')]=_[_0xe503('0x4d')](_0x547de2['query']);_0x5d209b[_0xe503('0x4e')]=_[_0xe503('0x4f')](_0x5d209b[_0xe503('0x49')],_0x5d209b[_0xe503('0x50')]);_0x2a731b[_0xe503('0x51')]=_['intersection'](_0x5d209b[_0xe503('0x49')],qs[_0xe503('0x52')](_0x547de2[_0xe503('0x50')][_0xe503('0x52')]));_0x2a731b['attributes']=_0x2a731b[_0xe503('0x51')]['length']?_0x2a731b[_0xe503('0x51')]:_0x5d209b[_0xe503('0x49')];if(!_0x547de2[_0xe503('0x50')][_0xe503('0xc2')](_0xe503('0xc3'))){_0x2a731b[_0xe503('0x54')]=qs[_0xe503('0x54')](_0x547de2[_0xe503('0x50')][_0xe503('0x54')]);_0x2a731b[_0xe503('0x31')]=qs[_0xe503('0x31')](_0x547de2[_0xe503('0x50')][_0xe503('0x31')]);}_0x2a731b[_0xe503('0x55')]=qs[_0xe503('0x56')](_0x547de2['query'][_0xe503('0x56')]);_0x2a731b[_0xe503('0x57')]=qs[_0xe503('0x4e')](_[_0xe503('0x58')](_0x547de2['query'],_0x5d209b[_0xe503('0x4e')]));_0x2a731b[_0xe503('0x57')]['UserId']=_0x5d1bd6['id'];if(_0x547de2['query'][_0xe503('0x3a')]){_0x2a731b[_0xe503('0x57')]=_[_0xe503('0x59')](_0x2a731b[_0xe503('0x57')],{'$or':_[_0xe503('0x3c')](_0x2a731b[_0xe503('0x51')],function(_0x537c58){var _0x4a69bc={};_0x4a69bc[_0x537c58]={'$like':'%'+_0x547de2['query']['filter']+'%'};return _0x4a69bc;})});}_0x2a731b=_[_0xe503('0x59')]({},_0x2a731b,_0x547de2['options']);return db[_0xe503('0xcd')][_0xe503('0x30')]({'where':_0x2a731b['where']})[_0xe503('0x42')](function(_0x14f84e){_0x54b24e['count']=_0x14f84e;if(_0x547de2['query']['includeAll']){_0x2a731b[_0xe503('0x5f')]=[{'all':!![]}];}return db[_0xe503('0xcd')][_0xe503('0xc6')](_0x2a731b);})['then'](function(_0x726ae8){_0x54b24e['rows']=_0x726ae8;return _0x54b24e;});}})[_0xe503('0x42')](respondWithFilteredResult(_0x24751d,_0x2a731b))['catch'](handleError(_0x24751d,null));};exports['getChatInteractions']=function(_0x22a620,_0x12ce64,_0x331cba){var _0x57dd70={};var _0x1d6e91={};var _0x5f4684;var _0x1ef2bc;return db['User'][_0xe503('0x8f')]({'where':{'id':_0x22a620[_0xe503('0x62')]['id']}})[_0xe503('0x42')](handleEntityNotFound(_0x12ce64,null))['then'](function(_0x1a4fd3){if(_0x1a4fd3){_0x5f4684=_0x1a4fd3;_0x1d6e91[_0xe503('0x49')]=_[_0xe503('0x4d')](db['ChatInteraction']['rawAttributes']);_0x1d6e91[_0xe503('0x50')]=_['keys'](_0x22a620[_0xe503('0x50')]);_0x1d6e91['filters']=_[_0xe503('0x4f')](_0x1d6e91[_0xe503('0x49')],_0x1d6e91[_0xe503('0x50')]);_0x57dd70[_0xe503('0x51')]=_[_0xe503('0x4f')](_0x1d6e91['model'],qs['fields'](_0x22a620[_0xe503('0x50')][_0xe503('0x52')]));_0x57dd70[_0xe503('0x51')]=_0x57dd70[_0xe503('0x51')]['length']?_0x57dd70['attributes']:_0x1d6e91[_0xe503('0x49')];_0x57dd70[_0xe503('0x55')]=qs[_0xe503('0x56')](_0x22a620['query'][_0xe503('0x56')]);_0x57dd70[_0xe503('0x57')]=qs[_0xe503('0x4e')](_[_0xe503('0x58')](_0x22a620[_0xe503('0x50')],_0x1d6e91['filters']));if(_0x22a620[_0xe503('0x50')]['filter']){_0x57dd70[_0xe503('0x57')]=_['merge'](_0x57dd70[_0xe503('0x57')],{'$or':_[_0xe503('0x3c')](_0x57dd70[_0xe503('0x51')],function(_0x50a8d1){var _0x1a9cd8={};_0x1a9cd8[_0x50a8d1]={'$like':'%'+_0x22a620[_0xe503('0x50')][_0xe503('0x3a')]+'%'};return _0x1a9cd8;})});}_0x57dd70=_[_0xe503('0x59')]({},_0x57dd70,_0x22a620['options']);return _0x5f4684[_0xe503('0xce')](_0x57dd70);}})[_0xe503('0x42')](function(_0x2eceaf){if(_0x2eceaf){_0x1ef2bc=_0x2eceaf[_0xe503('0x53')];if(!_0x22a620[_0xe503('0x50')][_0xe503('0xc2')](_0xe503('0xc3'))){_0x57dd70[_0xe503('0x54')]=qs[_0xe503('0x54')](_0x22a620[_0xe503('0x50')][_0xe503('0x54')]);_0x57dd70['offset']=qs[_0xe503('0x31')](_0x22a620[_0xe503('0x50')][_0xe503('0x31')]);}return _0x5f4684[_0xe503('0xce')](_0x57dd70);}})[_0xe503('0x42')](function(_0x3ccf83){if(_0x3ccf83){return _0x3ccf83?{'count':_0x1ef2bc,'rows':_0x3ccf83}:null;}})[_0xe503('0x42')](respondWithResult(_0x12ce64,null))['catch'](handleError(_0x12ce64,null));};exports[_0xe503('0xcf')]=function(_0x41f4e7,_0x1e8543,_0x8dcec8){var _0x3c23de={};var _0x33245b={};var _0x3e52e4;var _0x4f9ffe;return db[_0xe503('0x45')]['findOne']({'where':{'id':_0x41f4e7[_0xe503('0x62')]['id']}})['then'](handleEntityNotFound(_0x1e8543,null))[_0xe503('0x42')](function(_0x45774d){if(_0x45774d){_0x3e52e4=_0x45774d;_0x33245b[_0xe503('0x49')]=_['keys'](db['OpenchannelInteraction'][_0xe503('0x46')]);_0x33245b[_0xe503('0x50')]=_[_0xe503('0x4d')](_0x41f4e7['query']);_0x33245b[_0xe503('0x4e')]=_[_0xe503('0x4f')](_0x33245b[_0xe503('0x49')],_0x33245b['query']);_0x3c23de[_0xe503('0x51')]=_[_0xe503('0x4f')](_0x33245b[_0xe503('0x49')],qs[_0xe503('0x52')](_0x41f4e7['query'][_0xe503('0x52')]));_0x3c23de[_0xe503('0x51')]=_0x3c23de[_0xe503('0x51')][_0xe503('0x53')]?_0x3c23de[_0xe503('0x51')]:_0x33245b[_0xe503('0x49')];_0x3c23de[_0xe503('0x55')]=qs[_0xe503('0x56')](_0x41f4e7[_0xe503('0x50')][_0xe503('0x56')]);_0x3c23de[_0xe503('0x57')]=qs['filters'](_[_0xe503('0x58')](_0x41f4e7[_0xe503('0x50')],_0x33245b[_0xe503('0x4e')]));if(_0x41f4e7[_0xe503('0x50')][_0xe503('0x3a')]){_0x3c23de[_0xe503('0x57')]=_[_0xe503('0x59')](_0x3c23de['where'],{'$or':_[_0xe503('0x3c')](_0x3c23de[_0xe503('0x51')],function(_0x33cbd3){var _0x44955e={};_0x44955e[_0x33cbd3]={'$like':'%'+_0x41f4e7['query'][_0xe503('0x3a')]+'%'};return _0x44955e;})});}_0x3c23de=_[_0xe503('0x59')]({},_0x3c23de,_0x41f4e7[_0xe503('0x5e')]);return _0x3e52e4[_0xe503('0xcf')](_0x3c23de);}})['then'](function(_0x1127a4){if(_0x1127a4){_0x4f9ffe=_0x1127a4[_0xe503('0x53')];if(!_0x41f4e7['query'][_0xe503('0xc2')]('nolimit')){_0x3c23de[_0xe503('0x54')]=qs[_0xe503('0x54')](_0x41f4e7[_0xe503('0x50')]['limit']);_0x3c23de[_0xe503('0x31')]=qs[_0xe503('0x31')](_0x41f4e7[_0xe503('0x50')]['offset']);}return _0x3e52e4[_0xe503('0xcf')](_0x3c23de);}})['then'](function(_0x220a87){if(_0x220a87){return _0x220a87?{'count':_0x4f9ffe,'rows':_0x220a87}:null;}})[_0xe503('0x42')](respondWithResult(_0x1e8543,null))[_0xe503('0x2b')](handleError(_0x1e8543,null));};exports[_0xe503('0xd0')]=function(_0x589c9f,_0x5410c2,_0x4355e2){var _0x3bd34e={'raw':!![],'where':{}};var _0x440f92={};var _0x23c55d={'count':0x0,'rows':[]};return db[_0xe503('0x45')][_0xe503('0x8f')]({'where':{'id':_0x589c9f[_0xe503('0x62')]['id']}})[_0xe503('0x42')](handleEntityNotFound(_0x5410c2,null))[_0xe503('0x42')](function(_0x2b8db4){if(_0x2b8db4){_0x440f92[_0xe503('0x49')]=_[_0xe503('0x4d')](db['MailInteraction'][_0xe503('0x46')]);_0x440f92[_0xe503('0x50')]=_[_0xe503('0x4d')](_0x589c9f[_0xe503('0x50')]);_0x440f92[_0xe503('0x4e')]=_[_0xe503('0x4f')](_0x440f92[_0xe503('0x49')],_0x440f92[_0xe503('0x50')]);_0x3bd34e[_0xe503('0x51')]=_[_0xe503('0x4f')](_0x440f92['model'],qs['fields'](_0x589c9f[_0xe503('0x50')][_0xe503('0x52')]));_0x3bd34e[_0xe503('0x51')]=_0x3bd34e['attributes']['length']?_0x3bd34e[_0xe503('0x51')]:_0x440f92['model'];if(!_0x589c9f[_0xe503('0x50')][_0xe503('0xc2')](_0xe503('0xc3'))){_0x3bd34e['limit']=qs['limit'](_0x589c9f[_0xe503('0x50')]['limit']);_0x3bd34e[_0xe503('0x31')]=qs['offset'](_0x589c9f[_0xe503('0x50')][_0xe503('0x31')]);}_0x3bd34e[_0xe503('0x55')]=qs[_0xe503('0x56')](_0x589c9f[_0xe503('0x50')][_0xe503('0x56')]);_0x3bd34e[_0xe503('0x57')]=qs['filters'](_['pick'](_0x589c9f[_0xe503('0x50')],_0x440f92[_0xe503('0x4e')]));_0x3bd34e[_0xe503('0x57')]['UserId']=_0x2b8db4['id'];if(_0x589c9f[_0xe503('0x50')][_0xe503('0x3a')]){_0x3bd34e['where']=_[_0xe503('0x59')](_0x3bd34e['where'],{'$or':_[_0xe503('0x3c')](_0x3bd34e[_0xe503('0x51')],function(_0x505a01){var _0x396e5e={};_0x396e5e[_0x505a01]={'$like':'%'+_0x589c9f[_0xe503('0x50')][_0xe503('0x3a')]+'%'};return _0x396e5e;})});}_0x3bd34e=_['merge']({},_0x3bd34e,_0x589c9f[_0xe503('0x5e')]);return db['MailInteraction'][_0xe503('0x30')]({'where':_0x3bd34e['where']})[_0xe503('0x42')](function(_0x1253ee){_0x23c55d[_0xe503('0x30')]=_0x1253ee;if(_0x589c9f['query'][_0xe503('0x63')]){_0x3bd34e['include']=[{'all':!![]}];}return db[_0xe503('0xd1')]['findAll'](_0x3bd34e);})['then'](function(_0x110ff6){_0x23c55d[_0xe503('0x60')]=_0x110ff6;return _0x23c55d;});}})[_0xe503('0x42')](respondWithFilteredResult(_0x5410c2,_0x3bd34e))[_0xe503('0x2b')](handleError(_0x5410c2,null));};exports[_0xe503('0xd2')]=function(_0x586235,_0x3f5a91,_0xbe3b){var _0xe6e9fe={};var _0x2ece09={};var _0x578d1a;var _0x245f59;return db[_0xe503('0x45')][_0xe503('0x8f')]({'where':{'id':_0x586235['params']['id']}})[_0xe503('0x42')](handleEntityNotFound(_0x3f5a91,null))['then'](function(_0x30ae39){if(_0x30ae39){_0x578d1a=_0x30ae39;_0x2ece09[_0xe503('0x49')]=_['keys'](db[_0xe503('0xd3')][_0xe503('0x46')]);_0x2ece09[_0xe503('0x50')]=_[_0xe503('0x4d')](_0x586235['query']);_0x2ece09[_0xe503('0x4e')]=_[_0xe503('0x4f')](_0x2ece09[_0xe503('0x49')],_0x2ece09[_0xe503('0x50')]);_0xe6e9fe[_0xe503('0x51')]=_[_0xe503('0x4f')](_0x2ece09[_0xe503('0x49')],qs[_0xe503('0x52')](_0x586235[_0xe503('0x50')][_0xe503('0x52')]));_0xe6e9fe['attributes']=_0xe6e9fe[_0xe503('0x51')]['length']?_0xe6e9fe[_0xe503('0x51')]:_0x2ece09[_0xe503('0x49')];_0xe6e9fe[_0xe503('0x55')]=qs[_0xe503('0x56')](_0x586235[_0xe503('0x50')]['sort']);_0xe6e9fe[_0xe503('0x57')]=qs[_0xe503('0x4e')](_['pick'](_0x586235['query'],_0x2ece09[_0xe503('0x4e')]));if(_0x586235[_0xe503('0x50')][_0xe503('0x3a')]){_0xe6e9fe[_0xe503('0x57')]=_['merge'](_0xe6e9fe['where'],{'$or':_['map'](_0xe6e9fe[_0xe503('0x51')],function(_0x29e860){var _0x17700e={};_0x17700e[_0x29e860]={'$like':'%'+_0x586235['query'][_0xe503('0x3a')]+'%'};return _0x17700e;})});}_0xe6e9fe=_[_0xe503('0x59')]({},_0xe6e9fe,_0x586235[_0xe503('0x5e')]);return _0x578d1a[_0xe503('0xd2')](_0xe6e9fe);}})[_0xe503('0x42')](function(_0x5deb8d){if(_0x5deb8d){_0x245f59=_0x5deb8d[_0xe503('0x53')];if(!_0x586235['query'][_0xe503('0xc2')]('nolimit')){_0xe6e9fe[_0xe503('0x54')]=qs[_0xe503('0x54')](_0x586235[_0xe503('0x50')][_0xe503('0x54')]);_0xe6e9fe[_0xe503('0x31')]=qs[_0xe503('0x31')](_0x586235['query'][_0xe503('0x31')]);}return _0x578d1a[_0xe503('0xd2')](_0xe6e9fe);}})['then'](function(_0x431732){if(_0x431732){return _0x431732?{'count':_0x245f59,'rows':_0x431732}:null;}})[_0xe503('0x42')](respondWithResult(_0x3f5a91,null))[_0xe503('0x2b')](handleError(_0x3f5a91,null));};exports['getFaxInteractions']=function(_0x32232e,_0xa6a906,_0x4da1eb){var _0x556797={};var _0x1db5d5={};var _0x10932c;var _0x51e776;return db['User']['findOne']({'where':{'id':_0x32232e[_0xe503('0x62')]['id']}})[_0xe503('0x42')](handleEntityNotFound(_0xa6a906,null))[_0xe503('0x42')](function(_0x184c73){if(_0x184c73){_0x10932c=_0x184c73;_0x1db5d5[_0xe503('0x49')]=_[_0xe503('0x4d')](db[_0xe503('0xd4')][_0xe503('0x46')]);_0x1db5d5['query']=_['keys'](_0x32232e['query']);_0x1db5d5['filters']=_[_0xe503('0x4f')](_0x1db5d5[_0xe503('0x49')],_0x1db5d5[_0xe503('0x50')]);_0x556797[_0xe503('0x51')]=_[_0xe503('0x4f')](_0x1db5d5[_0xe503('0x49')],qs['fields'](_0x32232e[_0xe503('0x50')][_0xe503('0x52')]));_0x556797[_0xe503('0x51')]=_0x556797[_0xe503('0x51')]['length']?_0x556797['attributes']:_0x1db5d5[_0xe503('0x49')];_0x556797[_0xe503('0x55')]=qs[_0xe503('0x56')](_0x32232e[_0xe503('0x50')][_0xe503('0x56')]);_0x556797[_0xe503('0x57')]=qs[_0xe503('0x4e')](_['pick'](_0x32232e['query'],_0x1db5d5[_0xe503('0x4e')]));if(_0x32232e['query'][_0xe503('0x3a')]){_0x556797['where']=_[_0xe503('0x59')](_0x556797['where'],{'$or':_[_0xe503('0x3c')](_0x556797[_0xe503('0x51')],function(_0xf8eb41){var _0x4b27={};_0x4b27[_0xf8eb41]={'$like':'%'+_0x32232e[_0xe503('0x50')][_0xe503('0x3a')]+'%'};return _0x4b27;})});}_0x556797=_['merge']({},_0x556797,_0x32232e[_0xe503('0x5e')]);return _0x10932c['getFaxInteractions'](_0x556797);}})[_0xe503('0x42')](function(_0x35016a){if(_0x35016a){_0x51e776=_0x35016a[_0xe503('0x53')];if(!_0x32232e[_0xe503('0x50')][_0xe503('0xc2')](_0xe503('0xc3'))){_0x556797[_0xe503('0x54')]=qs[_0xe503('0x54')](_0x32232e[_0xe503('0x50')][_0xe503('0x54')]);_0x556797['offset']=qs[_0xe503('0x31')](_0x32232e[_0xe503('0x50')][_0xe503('0x31')]);}return _0x10932c[_0xe503('0xd5')](_0x556797);}})[_0xe503('0x42')](function(_0x31cb92){if(_0x31cb92){return _0x31cb92?{'count':_0x51e776,'rows':_0x31cb92}:null;}})[_0xe503('0x42')](respondWithResult(_0xa6a906,null))[_0xe503('0x2b')](handleError(_0xa6a906,null));};exports[_0xe503('0xd6')]=function(_0x530514,_0x412a27,_0x57cb79){var _0x28aaa0={};var _0x3d8205={};var _0x249f93;var _0xb524a3;return db[_0xe503('0x45')]['findOne']({'where':{'id':_0x530514[_0xe503('0x62')]['id']}})[_0xe503('0x42')](handleEntityNotFound(_0x412a27,null))[_0xe503('0x42')](function(_0x249fad){if(_0x249fad){_0x249f93=_0x249fad;_0x3d8205[_0xe503('0x49')]=_['keys'](db[_0xe503('0xd7')]['rawAttributes']);_0x3d8205['query']=_[_0xe503('0x4d')](_0x530514[_0xe503('0x50')]);_0x3d8205[_0xe503('0x4e')]=_['intersection'](_0x3d8205['model'],_0x3d8205['query']);_0x28aaa0[_0xe503('0x51')]=_[_0xe503('0x4f')](_0x3d8205['model'],qs[_0xe503('0x52')](_0x530514[_0xe503('0x50')][_0xe503('0x52')]));_0x28aaa0[_0xe503('0x51')]=_0x28aaa0[_0xe503('0x51')]['length']?_0x28aaa0[_0xe503('0x51')]:_0x3d8205[_0xe503('0x49')];_0x28aaa0[_0xe503('0x55')]=qs[_0xe503('0x56')](_0x530514['query'][_0xe503('0x56')]);_0x28aaa0['where']=qs[_0xe503('0x4e')](_[_0xe503('0x58')](_0x530514[_0xe503('0x50')],_0x3d8205[_0xe503('0x4e')]));if(_0x530514['query'][_0xe503('0x3a')]){_0x28aaa0[_0xe503('0x57')]=_['merge'](_0x28aaa0[_0xe503('0x57')],{'$or':_[_0xe503('0x3c')](_0x28aaa0[_0xe503('0x51')],function(_0x244a32){var _0x25210f={};_0x25210f[_0x244a32]={'$like':'%'+_0x530514[_0xe503('0x50')][_0xe503('0x3a')]+'%'};return _0x25210f;})});}_0x28aaa0=_[_0xe503('0x59')]({},_0x28aaa0,_0x530514[_0xe503('0x5e')]);return _0x249f93['getWhatsappInteractions'](_0x28aaa0);}})['then'](function(_0x3e1a67){if(_0x3e1a67){_0xb524a3=_0x3e1a67[_0xe503('0x53')];if(!_0x530514[_0xe503('0x50')][_0xe503('0xc2')](_0xe503('0xc3'))){_0x28aaa0[_0xe503('0x54')]=qs['limit'](_0x530514[_0xe503('0x50')][_0xe503('0x54')]);_0x28aaa0[_0xe503('0x31')]=qs[_0xe503('0x31')](_0x530514[_0xe503('0x50')]['offset']);}return _0x249f93[_0xe503('0xd6')](_0x28aaa0);}})['then'](function(_0x10384a){if(_0x10384a){return _0x10384a?{'count':_0xb524a3,'rows':_0x10384a}:null;}})[_0xe503('0x42')](respondWithResult(_0x412a27,null))['catch'](handleError(_0x412a27,null));};exports['login']=function(_0x15c44e,_0xd6b02c,_0x101857){var _0x22cb84;var _0x469d92;var _0x19e2a6;var _0x37ff4e=!_[_0xe503('0x70')](_0x15c44e[_0xe503('0x62')]['id'])?_0x15c44e[_0xe503('0x62')]['id']:!_[_0xe503('0x70')](_0x15c44e[_0xe503('0x39')]['id'])?_0x15c44e['user']['id']:null;return db['User'][_0xe503('0x3f')]({'where':{'id':_0x37ff4e,'role':{'$or':['admin',_0xe503('0x39'),_0xe503('0x69')]}},'attributes':['id',_0xe503('0x40'),_0xe503('0xd8'),'mobile','role',_0xe503('0x74'),_0xe503('0xd9')]})[_0xe503('0x42')](function(_0x38cd0b){if(_0x38cd0b){if(_0x38cd0b[_0xe503('0x3e')]===_0xe503('0x69')){_0x22cb84=_0x38cd0b;if(_0x15c44e[_0xe503('0x64')]['interface']){_0x19e2a6=util[_0xe503('0x71')](_0xe503('0xda'),_0x22cb84[_0x15c44e[_0xe503('0x64')][_0xe503('0x9c')]]);}else if(_0x15c44e[_0xe503('0x64')][_0xe503('0xdb')]){_0x19e2a6=util[_0xe503('0x71')](_0xe503('0xab'),_0x15c44e['body']['intrf']);}else{_0x19e2a6=util[_0xe503('0x71')]('SIP/%s',_0x22cb84[_0xe503('0x40')]);}socket['to'](util[_0xe503('0x71')]('user:%s',_0x22cb84[_0xe503('0x40')]))['emit'](_0xe503('0xdc'),{'ip':_0x15c44e[_0xe503('0xdd')][_0xe503('0xde')]||_0x15c44e['connection'][_0xe503('0xdf')]||_0x15c44e[_0xe503('0xe0')]['remoteAddress']||_0x15c44e[_0xe503('0xe1')][_0xe503('0xe0')]['remoteAddress']});return db[_0xe503('0xac')][_0xe503('0x36')]({'where':{'membername':_0x22cb84[_0xe503('0x40')]},'individualHooks':!![]});}}else{throw new db[(_0xe503('0x1f'))]['ValidationError'](_0xe503('0xe2'));}})[_0xe503('0x42')](function(){if(_0x22cb84){return _0x22cb84[_0xe503('0xe3')]({'raw':!![]});}})[_0xe503('0x42')](function(_0x1febfa){if(_0x22cb84){var _0x3cd21c=[];if(_0x1febfa){_0x469d92=_0x1febfa;if(_0x469d92[_0xe503('0x53')]){for(var _0x219abd=0x0;_0x219abd<_0x469d92['length'];_0x219abd++){_0x3cd21c[_0xe503('0xaa')]({'membername':_0x22cb84['name'],'UserId':_0x22cb84['id'],'queue_name':_0x469d92[_0x219abd][_0xe503('0x40')],'VoiceQueueId':_0x469d92[_0x219abd]['id'],'interface':_0x19e2a6,'paused':_0x22cb84[_0xe503('0xd9')]||![],'penalty':_0x469d92[_0x219abd]['UserVoiceQueue.penalty']||0x0});}return BPromise['each'](_0x3cd21c,function(_0x13247e){return db[_0xe503('0xac')][_0xe503('0xad')](_0x13247e);});}}}})[_0xe503('0x42')](function(){if(_0x22cb84){return db['MemberReport'][_0xe503('0xc6')]({'where':{'membername':_0x22cb84['name'],'exitAt':null}});}})[_0xe503('0x42')](function(_0x2e28fd){if(_0x22cb84){var _0x976751=[];_0x2e28fd[_0xe503('0xe4')](function(_0x162a48){_0x976751['push'](_0x162a48[_0xe503('0x35')]({'exitAt':moment()[_0xe503('0x71')](_0xe503('0xe5'))}));});return BPromise[_0xe503('0xe6')](_0x976751);}})['then'](function(){if(_0x22cb84){var _0x1a34fa=[];var _0x40b15c=[];var _0x23fcf1=utils[_0xe503('0xe7')]();var _0x400d96={'membername':_0x22cb84['name'],'interface':_0x19e2a6,'enterAt':moment()[_0xe503('0x71')](_0xe503('0xe5')),'role':_0x22cb84['role'],'internal':_0x22cb84[_0xe503('0x74')]};_0x23fcf1['forEach'](function(_0x238bfa){_0x1a34fa[_0xe503('0xaa')](_[_0xe503('0x59')]({'channel':_0x238bfa,'type':'LOGIN','data1':_0x15c44e[_0xe503('0x64')][_0xe503('0xe8')],'data2':_0x19e2a6},_0x400d96));if(_0x22cb84[_0xe503('0xd9')]){_0x40b15c[_0xe503('0xaa')](_['merge']({'channel':_0x238bfa,'type':_0xe503('0xe9'),'data1':_0xe503('0xea')},_0x400d96));}});return db[_0xe503('0xeb')][_0xe503('0xec')](_0x1a34fa['concat'](_0x40b15c),{'individualHooks':!![]});}})[_0xe503('0x42')](function(){if(_0x22cb84){return _0x22cb84[_0xe503('0x35')]({'online':!![],'lastLoginAt':moment()[_0xe503('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x22cb84[_0xe503('0xd9')]||![],'mailPause':_0x22cb84[_0xe503('0xd9')]||![],'chatPause':_0x22cb84[_0xe503('0xd9')]||![],'faxPause':_0x22cb84[_0xe503('0xd9')]||![],'smsPause':_0x22cb84[_0xe503('0xd9')]||![],'openchannelPause':_0x22cb84['loginInPause']||![],'whatsappPause':_0x22cb84['loginInPause']||![],'pauseType':_0x22cb84[_0xe503('0xd9')]?_0xe503('0xea'):null,'interface':_0x19e2a6,'lastPauseAt':moment()[_0xe503('0x71')](_0xe503('0xe5'))});}})[_0xe503('0x42')](function(_0x4069dd){if(_0x15c44e[_0xe503('0xed')]){return _0x101857();}else{return BPromise[_0xe503('0xee')](_0x4069dd)['then'](respondWithResult(_0xd6b02c,null));}})[_0xe503('0x2b')](handleError(_0xd6b02c,null));};exports[_0xe503('0xef')]=function(_0x495422,_0x197e92,_0x463cfa){var _0x6736f;return db['User'][_0xe503('0x3f')]({'where':{'id':_0x495422[_0xe503('0x62')]['id'],'role':_0xe503('0x69')},'attributes':['id',_0xe503('0x40'),_0xe503('0x3e')]})[_0xe503('0x42')](handleEntityNotFound(_0x197e92,null))[_0xe503('0x42')](function(_0x448c6d){if(_0x448c6d){_0x6736f=_0x448c6d;return db[_0xe503('0xac')][_0xe503('0x36')]({'where':{'membername':_0x6736f['name']},'individualHooks':!![]});}})[_0xe503('0x42')](function(){return db[_0xe503('0xeb')][_0xe503('0xc6')]({'where':{'membername':_0x6736f[_0xe503('0x40')],'exitAt':null}});})[_0xe503('0x42')](function(_0x42c353){var _0x4099b6=[];_0x42c353[_0xe503('0xe4')](function(_0x267a35){_0x4099b6[_0xe503('0xaa')](_0x267a35[_0xe503('0x35')]({'exitAt':moment()[_0xe503('0x71')](_0xe503('0xe5'))}));});return BPromise[_0xe503('0xe6')](_0x4099b6);})[_0xe503('0x42')](function(){return _0x6736f[_0xe503('0x35')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xe503('0x42')](respondWithResult(_0x197e92,null))[_0xe503('0x2b')](handleError(_0x197e92,null));};exports['pause']=function(_0x2c77ef,_0x1bb251,_0xe65419){var _0x2fb570;return db[_0xe503('0xac')][_0xe503('0x35')]({'paused':0x1},{'where':{'UserId':_0x2c77ef[_0xe503('0x62')]['id']},'individualHooks':!![]})['then'](function(){return db['User']['find']({'where':{'id':_0x2c77ef[_0xe503('0x62')]['id'],'role':_0xe503('0x69')},'attributes':['id',_0xe503('0x40'),_0xe503('0x3e'),_0xe503('0x74'),_0xe503('0x9c')]});})[_0xe503('0x42')](handleEntityNotFound(_0x1bb251,null))[_0xe503('0x42')](function(_0x4e607b){if(_0x4e607b){_0x2fb570=_0x4e607b;return respondWithRpcPromise(_0xe503('0xf0'),_0xe503('0xf1'),{'id':_0x2fb570['id'],'name':_0x2fb570[_0xe503('0x40')],'pause':!![]});}})[_0xe503('0x42')](function(){if(_0x2fb570){return db[_0xe503('0xeb')][_0xe503('0xc6')]({'where':{'membername':_0x2fb570[_0xe503('0x40')],'type':'PAUSE','exitAt':null}});}})['then'](function(_0x39233e){if(_0x39233e[_0xe503('0x53')]){var _0x44799e=moment()[_0xe503('0x71')](_0xe503('0xe5'));for(var _0x4791e0=0x0,_0x2f8b81=_0x39233e['length'];_0x4791e0<_0x2f8b81;_0x4791e0++){_0x39233e[_0x4791e0][_0xe503('0xf2')]({'exitAt':_0x44799e});}}})[_0xe503('0x42')](function(){var _0x3b95cf=[];var _0x22caf6=utils[_0xe503('0xe7')]();_0x22caf6[_0xe503('0xe4')](function(_0x52a605){_0x3b95cf[_0xe503('0xaa')]({'channel':_0x52a605,'membername':_0x2fb570[_0xe503('0x40')],'interface':_[_0xe503('0x70')](_0x2fb570[_0xe503('0x9c')])?util[_0xe503('0x71')]('SIP/%s',_0x2fb570[_0xe503('0x40')]):_0x2fb570[_0xe503('0x9c')],'type':_0xe503('0xe9'),'enterAt':moment()[_0xe503('0x71')](_0xe503('0xe5')),'data1':_0x2c77ef[_0xe503('0x64')][_0xe503('0x48')]||_0xe503('0xf3'),'role':_0x2fb570[_0xe503('0x3e')],'internal':_0x2fb570[_0xe503('0x74')]});});return db[_0xe503('0xeb')][_0xe503('0xec')](_0x3b95cf,{'individualHooks':!![]});})[_0xe503('0x42')](function(){return _0x2fb570[_0xe503('0x35')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x2c77ef[_0xe503('0x64')][_0xe503('0x48')]||_0xe503('0xf3'),'lastPauseAt':moment()[_0xe503('0x71')]('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x1bb251,null))[_0xe503('0x2b')](handleError(_0x1bb251,null));};exports['unpause']=function(_0x390e27,_0x1f392b,_0x13e5e6){var _0x1a11dd;return db[_0xe503('0x45')]['find']({'where':{'id':_0x390e27[_0xe503('0x62')]['id']},'attributes':['id',_0xe503('0x40'),_0xe503('0x3e'),_0xe503('0x9b'),_0xe503('0xf4'),_0xe503('0xf5'),_0xe503('0xf6'),_0xe503('0xf7'),_0xe503('0xf8'),_0xe503('0xf9'),'pauseType',_0xe503('0xfa')]})[_0xe503('0x42')](handleEntityNotFound(_0x1f392b,null))['then'](function(_0x530ba7){if(_0x530ba7){_0x1a11dd=_0x530ba7;if(_0x390e27[_0xe503('0x64')]['channel']&&!utils['isValidChannel'](_0x390e27[_0xe503('0x64')][_0xe503('0x99')])){throw new db[(_0xe503('0x1f'))][(_0xe503('0x20'))](_0xe503('0x9e'));}switch(_0x390e27[_0xe503('0x64')][_0xe503('0x99')]){case _0xe503('0xa8'):return respondWithRpcPromise('QueuePause',_0xe503('0xfb'),{'id':_0x1a11dd['id'],'name':_0x1a11dd['name'],'pause':![]})[_0xe503('0x42')](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x1a11dd['id']},'individualHooks':!![]});})[_0xe503('0x42')](function(){return db[_0xe503('0xeb')][_0xe503('0x3f')]({'where':{'channel':_0x390e27[_0xe503('0x64')][_0xe503('0x99')],'membername':_0x1a11dd[_0xe503('0x40')],'type':_0xe503('0xe9'),'exitAt':null}});})[_0xe503('0x42')](function(_0x301544){if(_0x301544){return _0x301544[_0xe503('0x35')]({'exitAt':moment()[_0xe503('0x71')](_0xe503('0xe5')),'data2':_0xe503('0xfc')},{'individualHooks':!![]});}return null;})[_0xe503('0x42')](function(){return _0x1a11dd[_0xe503('0x35')]({'voicePause':![]});});case _0xe503('0xfd'):case _0xe503('0xfe'):case _0xe503('0xff'):case'sms':case'whatsapp':case _0xe503('0x100'):return db[_0xe503('0xeb')][_0xe503('0x3f')]({'where':{'channel':_0x390e27[_0xe503('0x64')]['channel'],'membername':_0x1a11dd['name'],'type':'PAUSE','exitAt':null}})[_0xe503('0x42')](function(_0x14bccd){if(_0x14bccd){return _0x14bccd[_0xe503('0x35')]({'exitAt':moment()[_0xe503('0x71')](_0xe503('0xe5')),'data2':_0xe503('0xfc')},{'individualHooks':!![]});}return null;})[_0xe503('0x42')](function(){var _0x2bdeaf={};_[_0xe503('0x32')](_0x2bdeaf,util[_0xe503('0x71')](_0xe503('0x101'),_0x390e27[_0xe503('0x64')][_0xe503('0x99')],'Pause'),![]);return _0x1a11dd[_0xe503('0x35')](_0x2bdeaf);});default:return respondWithRpcPromise(_0xe503('0xf0'),_0xe503('0xfb'),{'id':_0x1a11dd['id'],'name':_0x1a11dd[_0xe503('0x40')],'pause':![]})[_0xe503('0x42')](function(){return db[_0xe503('0xac')][_0xe503('0x35')]({'paused':0x0},{'where':{'UserId':_0x1a11dd['id']}});})[_0xe503('0x42')](function(){return db[_0xe503('0xeb')][_0xe503('0xc6')]({'where':{'membername':_0x1a11dd[_0xe503('0x40')],'type':_0xe503('0xe9'),'exitAt':null}});})['then'](function(_0x279ffe){var _0x514daf=[];_0x279ffe[_0xe503('0xe4')](function(_0x37e4fd){_0x514daf[_0xe503('0xaa')](_0x37e4fd[_0xe503('0x35')]({'exitAt':moment()[_0xe503('0x71')](_0xe503('0xe5')),'data2':_0xe503('0xfc')}));});return BPromise[_0xe503('0xe6')](_0x514daf);})['then'](function(){return _0x1a11dd[_0xe503('0x35')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x1f392b,null))['catch'](handleError(_0x1f392b,null));};exports[_0xe503('0x102')]=function(_0x479ea3,_0x42f651,_0x10abb9){var _0x26ebae={};var _0x1ed438={};var _0x262de6;var _0x5ea1f9;return db[_0xe503('0x45')][_0xe503('0x8f')]({'where':{'id':_0x479ea3['params']['id']}})[_0xe503('0x42')](handleEntityNotFound(_0x42f651,null))['then'](function(_0x4e9d00){if(_0x4e9d00){_0x262de6=_0x4e9d00;_0x1ed438[_0xe503('0x49')]=_['keys'](db[_0xe503('0x103')][_0xe503('0x46')]);_0x1ed438[_0xe503('0x50')]=_[_0xe503('0x4d')](_0x479ea3[_0xe503('0x50')]);_0x1ed438[_0xe503('0x4e')]=_[_0xe503('0x4f')](_0x1ed438[_0xe503('0x49')],_0x1ed438[_0xe503('0x50')]);_0x26ebae[_0xe503('0x51')]=_[_0xe503('0x4f')](_0x1ed438[_0xe503('0x49')],qs[_0xe503('0x52')](_0x479ea3[_0xe503('0x50')][_0xe503('0x52')]));_0x26ebae[_0xe503('0x51')]=_0x26ebae[_0xe503('0x51')][_0xe503('0x53')]?_0x26ebae['attributes']:_0x1ed438[_0xe503('0x49')];_0x26ebae['order']=qs['sort'](_0x479ea3[_0xe503('0x50')][_0xe503('0x56')]);_0x26ebae[_0xe503('0x57')]=qs['filters'](_[_0xe503('0x58')](_0x479ea3[_0xe503('0x50')],_0x1ed438['filters']));if(_0x479ea3['query']['filter']){_0x26ebae['where']=_['merge'](_0x26ebae['where'],{'$or':_['map'](_0x26ebae[_0xe503('0x51')],function(_0xa13d88){var _0x18f4ff={};_0x18f4ff[_0xa13d88]={'$like':'%'+_0x479ea3[_0xe503('0x50')]['filter']+'%'};return _0x18f4ff;})});}_0x26ebae=_[_0xe503('0x59')]({},_0x26ebae,_0x479ea3[_0xe503('0x5e')]);return _0x262de6[_0xe503('0x102')](_0x26ebae);}})[_0xe503('0x42')](function(_0x2217c7){if(_0x2217c7){_0x5ea1f9=_0x2217c7['length'];if(!_0x479ea3[_0xe503('0x50')][_0xe503('0xc2')](_0xe503('0xc3'))){_0x26ebae[_0xe503('0x54')]=qs[_0xe503('0x54')](_0x479ea3[_0xe503('0x50')][_0xe503('0x54')]);_0x26ebae[_0xe503('0x31')]=qs['offset'](_0x479ea3[_0xe503('0x50')][_0xe503('0x31')]);}return _0x262de6[_0xe503('0x102')](_0x26ebae);}})[_0xe503('0x42')](function(_0x461a00){if(_0x461a00){return _0x461a00?{'count':_0x5ea1f9,'rows':_0x461a00}:null;}})[_0xe503('0x42')](respondWithResult(_0x42f651,null))[_0xe503('0x2b')](handleError(_0x42f651,null));};exports[_0xe503('0x104')]=function(_0x4b869e,_0x13faa4){return db[_0xe503('0x45')][_0xe503('0x3f')]({'where':{'id':_0x4b869e[_0xe503('0x62')]['id']}})[_0xe503('0x42')](handleEntityNotFound(_0x13faa4,null))['then'](function(_0x262a91){if(_0x262a91){var _0x3a173c=_0x262a91[_0xe503('0x37')]({'plain':!![]});return _0x262a91[_0xe503('0x104')](_0x4b869e[_0xe503('0x64')][_0xe503('0x67')],_['omit'](_0x4b869e[_0xe503('0x64')],[_0xe503('0x67'),'id'])||{})[_0xe503('0x42')](function(){for(var _0x1038d5=0x0;_0x1038d5<_0x4b869e[_0xe503('0x64')][_0xe503('0x67')][_0xe503('0x53')];_0x1038d5++){var _0x39fb18=[];db[_0xe503('0x103')][_0xe503('0x8f')]({'where':{'id':_0x4b869e[_0xe503('0x64')]['ids'][_0x1038d5]}})[_0xe503('0x42')](function(_0x4dd653){_0x39fb18['push'](_0x4dd653[_0xe503('0xe3')]()[_0xe503('0x42')](function(_0x4c93b7){for(var _0x3eaabf=0x0;_0x3eaabf<_0x4c93b7[_0xe503('0x53')];_0x3eaabf++){_0x4c93b7[_0x3eaabf][_0xe503('0x105')](_0xe503('0x99'),_0xe503('0x106'));}return _0x4c93b7;}));_0x39fb18[_0xe503('0xaa')](_0x4dd653[_0xe503('0x107')]()['then'](function(_0x3f576f){for(var _0x1d4ace=0x0;_0x1d4ace<_0x3f576f[_0xe503('0x53')];_0x1d4ace++){_0x3f576f[_0x1d4ace][_0xe503('0x105')](_0xe503('0x99'),_0xe503('0x108'));}return _0x3f576f;}));_0x39fb18[_0xe503('0xaa')](_0x4dd653['getMailQueues']()[_0xe503('0x42')](function(_0x40f66a){for(var _0x79be48=0x0;_0x79be48<_0x40f66a[_0xe503('0x53')];_0x79be48++){_0x40f66a[_0x79be48][_0xe503('0x105')]('channel','Mail');}return _0x40f66a;}));_0x39fb18[_0xe503('0xaa')](_0x4dd653[_0xe503('0x109')]()[_0xe503('0x42')](function(_0x2b9695){for(var _0x1ff9fc=0x0;_0x1ff9fc<_0x2b9695['length'];_0x1ff9fc++){_0x2b9695[_0x1ff9fc][_0xe503('0x105')](_0xe503('0x99'),_0xe503('0x10a'));}return _0x2b9695;}));_0x39fb18[_0xe503('0xaa')](_0x4dd653[_0xe503('0x10b')]()[_0xe503('0x42')](function(_0x1a0fb1){for(var _0x1ba706=0x0;_0x1ba706<_0x1a0fb1['length'];_0x1ba706++){_0x1a0fb1[_0x1ba706][_0xe503('0x105')](_0xe503('0x99'),_0xe503('0x10c'));}return _0x1a0fb1;}));_0x39fb18[_0xe503('0xaa')](_0x4dd653[_0xe503('0x10d')]()[_0xe503('0x42')](function(_0x9e854){for(var _0x619225=0x0;_0x619225<_0x9e854['length'];_0x619225++){_0x9e854[_0x619225][_0xe503('0x105')]('channel',_0xe503('0x10e'));}return _0x9e854;}));_0x39fb18[_0xe503('0xaa')](_0x4dd653['getOpenchannelQueues']()[_0xe503('0x42')](function(_0x560c8d){for(var _0x2afac2=0x0;_0x2afac2<_0x560c8d[_0xe503('0x53')];_0x2afac2++){_0x560c8d[_0x2afac2][_0xe503('0x105')](_0xe503('0x99'),'Openchannel');}return _0x560c8d;}));return BPromise[_0xe503('0xe6')](_0x39fb18);})[_0xe503('0x42')](function(_0x14addc){var _0x3b04a7=_[_0xe503('0x10f')](_0x14addc);_0x39fb18=[];return db['sequelize'][_0xe503('0x110')](function(_0x19ee75){for(var _0x343237=0x0;_0x343237<_0x3b04a7[_0xe503('0x53')];_0x343237++){_0x39fb18[_0xe503('0xaa')](_0x3b04a7[_0x343237][_0xe503('0x111')](_0x3a173c['id']),{'transaction':_0x19ee75});}return BPromise[_0xe503('0xe6')](_0x39fb18)[_0xe503('0x42')](function(){if(_0x3a173c[_0xe503('0x9a')]){return BPromise[_0xe503('0x112')](_[_0xe503('0x3a')](_0x3b04a7,function(_0x1aa10a){return _0x1aa10a[_0xe503('0x113')](_0xe503('0x99'))===_0xe503('0x106');}),function(_0x5b4a9c){return db['UserVoiceQueueRt']['upsert']({'membername':_0x3a173c[_0xe503('0x40')],'UserId':_0x3a173c['id'],'queue_name':_0x5b4a9c[_0xe503('0x40')],'VoiceQueueId':_0x5b4a9c['id'],'interface':_[_0xe503('0x70')](_0x3a173c[_0xe503('0x9c')])?util[_0xe503('0x71')](_0xe503('0xab'),_0x3a173c['name']):_0x3a173c[_0xe503('0x9c')],'paused':_0x3a173c['voicePause']||![],'penalty':_0x3a173c[_0xe503('0xa2')]},{'transaction':_0x19ee75});});}else{return;}})[_0xe503('0x42')](function(){for(var _0x30baa2=0x0;_0x30baa2<_0x3b04a7[_0xe503('0x53')];_0x30baa2++){var _0xca628d=_0x3b04a7[_0x30baa2]['getDataValue'](_0xe503('0x99'));var _0x46a21e=_0xca628d+'QueueId';socket[_0xe503('0xa6')](_0xe503('0x39')+_0xca628d+'Queue:save',{'UserId':_0x3a173c['id'],['queueField']:_0x3b04a7[_0x30baa2]['id']});}});});});}});}})[_0xe503('0x42')](respondWithStatusCode(_0x13faa4,null))['catch'](handleError(_0x13faa4,null));};exports[_0xe503('0x114')]=function(_0x5e6f7c,_0x39e53f){return db[_0xe503('0x45')][_0xe503('0x8f')]({'where':{'id':_0x5e6f7c[_0xe503('0x62')]['id']}})[_0xe503('0x42')](handleEntityNotFound(_0x39e53f,null))[_0xe503('0x42')](function(_0x34d557){if(_0x34d557){var _0x4c6ec8=_0x34d557[_0xe503('0x37')]({'plain':!![]});var _0xd09d65=_0x5e6f7c['query'][_0xe503('0x67')];return _0x34d557[_0xe503('0x114')](_0xd09d65)['then'](function(){for(var _0x285ac2=0x0;_0x285ac2<_0xd09d65[_0xe503('0x53')];_0x285ac2++){var _0x5b79f6=[];db[_0xe503('0x103')][_0xe503('0x8f')]({'where':{'id':_0xd09d65[_0x285ac2]}})[_0xe503('0x42')](function(_0x2ab2af){_0x5b79f6[_0xe503('0xaa')](_0x2ab2af[_0xe503('0xe3')]()['then'](function(_0x33c2d3){for(var _0x58f812=0x0;_0x58f812<_0x33c2d3[_0xe503('0x53')];_0x58f812++){_0x33c2d3[_0x58f812][_0xe503('0x105')]('channel',_0xe503('0x106'));}return _0x33c2d3;}));_0x5b79f6[_0xe503('0xaa')](_0x2ab2af[_0xe503('0x107')]()[_0xe503('0x42')](function(_0x541e55){for(var _0x2ee038=0x0;_0x2ee038<_0x541e55[_0xe503('0x53')];_0x2ee038++){_0x541e55[_0x2ee038][_0xe503('0x105')](_0xe503('0x99'),_0xe503('0x108'));}return _0x541e55;}));_0x5b79f6[_0xe503('0xaa')](_0x2ab2af['getMailQueues']()['then'](function(_0x3d7774){for(var _0x609c37=0x0;_0x609c37<_0x3d7774[_0xe503('0x53')];_0x609c37++){_0x3d7774[_0x609c37][_0xe503('0x105')](_0xe503('0x99'),_0xe503('0x115'));}return _0x3d7774;}));_0x5b79f6[_0xe503('0xaa')](_0x2ab2af['getSmsQueues']()[_0xe503('0x42')](function(_0x18328d){for(var _0x2d67d3=0x0;_0x2d67d3<_0x18328d[_0xe503('0x53')];_0x2d67d3++){_0x18328d[_0x2d67d3]['setDataValue'](_0xe503('0x99'),_0xe503('0x10a'));}return _0x18328d;}));_0x5b79f6[_0xe503('0xaa')](_0x2ab2af[_0xe503('0x10b')]()[_0xe503('0x42')](function(_0x371d51){for(var _0xb8d363=0x0;_0xb8d363<_0x371d51['length'];_0xb8d363++){_0x371d51[_0xb8d363][_0xe503('0x105')]('channel',_0xe503('0x10c'));}return _0x371d51;}));_0x5b79f6[_0xe503('0xaa')](_0x2ab2af[_0xe503('0x10d')]()['then'](function(_0x4ac050){for(var _0x52384c=0x0;_0x52384c<_0x4ac050['length'];_0x52384c++){_0x4ac050[_0x52384c][_0xe503('0x105')](_0xe503('0x99'),_0xe503('0x10e'));}return _0x4ac050;}));_0x5b79f6[_0xe503('0xaa')](_0x2ab2af[_0xe503('0x116')]()[_0xe503('0x42')](function(_0x343fdb){for(var _0x5f297f=0x0;_0x5f297f<_0x343fdb[_0xe503('0x53')];_0x5f297f++){_0x343fdb[_0x5f297f][_0xe503('0x105')]('channel',_0xe503('0x117'));}return _0x343fdb;}));return BPromise[_0xe503('0xe6')](_0x5b79f6);})[_0xe503('0x42')](function(_0x5226ad){var _0x431dd4=_[_0xe503('0x10f')](_0x5226ad);_0x5b79f6=[];return db[_0xe503('0x5b')][_0xe503('0x110')](function(_0x47e0af){for(var _0xc36bc4=0x0;_0xc36bc4<_0x431dd4[_0xe503('0x53')];_0xc36bc4++){_0x5b79f6[_0xe503('0xaa')](_0x431dd4[_0xc36bc4][_0xe503('0x118')](_0x4c6ec8['id']),{'transaction':_0x47e0af});}return BPromise['all'](_0x5b79f6)[_0xe503('0x42')](function(){if(_0x4c6ec8[_0xe503('0x9a')]){return BPromise[_0xe503('0x112')](_['filter'](_0x431dd4,function(_0x2188e4){return _0x2188e4[_0xe503('0x113')](_0xe503('0x99'))==='Voice';}),function(_0x3f3c3c){return db['UserVoiceQueueRt'][_0xe503('0x36')]({'where':{'VoiceQueueId':_0x3f3c3c['id'],'UserId':_0x4c6ec8['id']},'transaction':_0x47e0af});});}else{return;}})[_0xe503('0x42')](function(){for(var _0x2a66b8=0x0;_0x2a66b8<_0x431dd4[_0xe503('0x53')];_0x2a66b8++){var _0x4d108b=_0x431dd4[_0x2a66b8][_0xe503('0x113')](_0xe503('0x99'));var _0x58c5e1=_0x4d108b+_0xe503('0xa5');socket[_0xe503('0xa6')](_0xe503('0x39')+_0x4d108b+_0xe503('0x119'),{'UserId':_0x4c6ec8['id'],['queueField']:_0x431dd4[_0x2a66b8]['id']});}});});});}});}})[_0xe503('0x42')](respondWithStatusCode(_0x39e53f,null))['catch'](handleError(_0x39e53f,null));};exports[_0xe503('0x11a')]=function(_0x596eda,_0x8c8215,_0x556ded){var _0x584976={};var _0x571d7e={};var _0x303ea9;var _0x45183d;return db['User']['findOne']({'where':{'id':_0x596eda[_0xe503('0x62')]['id']}})[_0xe503('0x42')](handleEntityNotFound(_0x8c8215,null))[_0xe503('0x42')](function(_0x3f877d){if(_0x3f877d){_0x303ea9=_0x3f877d;_0x571d7e[_0xe503('0x49')]=_[_0xe503('0x4d')](db[_0xe503('0xbc')]['rawAttributes']);_0x571d7e['query']=_['keys'](_0x596eda['query']);_0x571d7e[_0xe503('0x4e')]=_['intersection'](_0x571d7e['model'],_0x571d7e[_0xe503('0x50')]);_0x584976[_0xe503('0x51')]=_[_0xe503('0x4f')](_0x571d7e[_0xe503('0x49')],qs['fields'](_0x596eda[_0xe503('0x50')][_0xe503('0x52')]));_0x584976[_0xe503('0x51')]=_0x584976[_0xe503('0x51')][_0xe503('0x53')]?_0x584976[_0xe503('0x51')]:_0x571d7e[_0xe503('0x49')];_0x584976[_0xe503('0x55')]=qs['sort'](_0x596eda[_0xe503('0x50')][_0xe503('0x56')]);_0x584976['where']=qs[_0xe503('0x4e')](_[_0xe503('0x58')](_0x596eda[_0xe503('0x50')],_0x571d7e[_0xe503('0x4e')]));if(_0x596eda[_0xe503('0x50')]['filter']){_0x584976[_0xe503('0x57')]=_[_0xe503('0x59')](_0x584976[_0xe503('0x57')],{'$or':_[_0xe503('0x3c')](_0x584976[_0xe503('0x51')],function(_0x1cd5ce){var _0x3ba95b={};_0x3ba95b[_0x1cd5ce]={'$like':'%'+_0x596eda[_0xe503('0x50')][_0xe503('0x3a')]+'%'};return _0x3ba95b;})});}_0x584976=_[_0xe503('0x59')]({},_0x584976,_0x596eda[_0xe503('0x5e')]);return _0x303ea9[_0xe503('0x11a')](_0x584976);}})[_0xe503('0x42')](function(_0x480e3e){if(_0x480e3e){_0x45183d=_0x480e3e[_0xe503('0x53')];if(!_0x596eda[_0xe503('0x50')][_0xe503('0xc2')](_0xe503('0xc3'))){_0x584976['limit']=qs[_0xe503('0x54')](_0x596eda[_0xe503('0x50')][_0xe503('0x54')]);_0x584976[_0xe503('0x31')]=qs[_0xe503('0x31')](_0x596eda[_0xe503('0x50')][_0xe503('0x31')]);}return _0x303ea9[_0xe503('0x11a')](_0x584976);}})['then'](function(_0x1ba570){if(_0x1ba570){return _0x1ba570?{'count':_0x45183d,'rows':_0x1ba570}:null;}})[_0xe503('0x42')](respondWithResult(_0x8c8215,null))[_0xe503('0x2b')](handleError(_0x8c8215,null));};exports['getAgents']=function(_0x3471d0,_0x26ef93,_0x3cb865){var _0xc0a654={};var _0x18e481={};var _0x209c1b;var _0x1f04de;return db[_0xe503('0x45')][_0xe503('0x8f')]({'where':{'id':_0x3471d0[_0xe503('0x62')]['id']}})[_0xe503('0x42')](handleEntityNotFound(_0x26ef93,null))[_0xe503('0x42')](function(_0x4179a4){if(_0x4179a4){_0x209c1b=_0x4179a4;_0x18e481[_0xe503('0x49')]=_[_0xe503('0x4d')](db['User'][_0xe503('0x46')]);_0x18e481[_0xe503('0x50')]=_['keys'](_0x3471d0[_0xe503('0x50')]);_0x18e481[_0xe503('0x4e')]=_['intersection'](_0x18e481[_0xe503('0x49')],_0x18e481[_0xe503('0x50')]);_0xc0a654['attributes']=_[_0xe503('0x4f')](_0x18e481[_0xe503('0x49')],qs['fields'](_0x3471d0['query'][_0xe503('0x52')]));_0xc0a654[_0xe503('0x51')]=_0xc0a654['attributes']['length']?_0xc0a654[_0xe503('0x51')]:_0x18e481[_0xe503('0x49')];_0xc0a654[_0xe503('0x55')]=qs['sort'](_0x3471d0[_0xe503('0x50')][_0xe503('0x56')]);_0xc0a654[_0xe503('0x57')]=qs[_0xe503('0x4e')](_['pick'](_0x3471d0[_0xe503('0x50')],_0x18e481['filters']));if(_0x3471d0['query']['filter']){_0xc0a654[_0xe503('0x57')]=_[_0xe503('0x59')](_0xc0a654[_0xe503('0x57')],{'$or':_[_0xe503('0x3c')](_0xc0a654['attributes'],function(_0x1f9d84){var _0x448fa8={};_0x448fa8[_0x1f9d84]={'$like':'%'+_0x3471d0['query'][_0xe503('0x3a')]+'%'};return _0x448fa8;})});}_0xc0a654['model']=db[_0xe503('0x45')];_0xc0a654['as']='Agents';_0xc0a654=_[_0xe503('0x59')]({},_0xc0a654,_0x3471d0['options']);return _0x209c1b['getVoiceQueues']({'include':[_0xc0a654]});}})[_0xe503('0x42')](function(_0x4a80aa){if(_0x4a80aa){var _0x1eaa20={},_0x45f7b1=[],_0x42e842=0x0;for(var _0x1a8a8c=0x0;_0x1a8a8c<_0x4a80aa['length'];_0x1a8a8c+=0x1){for(var _0x4d2974=0x0,_0x55abdb;_0x4d2974<_0x4a80aa[_0x1a8a8c][_0xe503('0x89')][_0xe503('0x53')];_0x4d2974+=0x1){_0x55abdb=_0x4a80aa[_0x1a8a8c][_0xe503('0x89')][_0x4d2974]['get']({'plain':!![]});_0x1eaa20[_0x55abdb['id']]=_0x55abdb;}}_0x1eaa20=_[_0xe503('0x11b')](_0x1eaa20);for(var _0x3d256f=qs['offset'](_0x3471d0[_0xe503('0x50')]['offset']);_0x3d256f<_0x1eaa20[_0xe503('0x53')]&&_0x45f7b1[_0xe503('0x53')]=_0xa3d72d){_0x3ca14a=_0xa3d72d;_0x1c0e94=0xc8;}else{_0x1c0e94=0xce;}_0x5e0db8[_0x4ce3('0x30')](_0x1c0e94);return _0x5e0db8['set']('Content-Range',_0x20a016+'-'+_0x3ca14a+'/'+_0xa3d72d)[_0x4ce3('0x32')](_0x5c303b);}return null;};}function patchUpdates(_0x338061){return function(_0x43203a){try{jsonpatch['apply'](_0x43203a,_0x338061,!![]);}catch(_0x47078a){return BPromise[_0x4ce3('0x35')](_0x47078a);}return _0x43203a[_0x4ce3('0x36')]();};}function saveUpdates(_0x44ef5f,_0x16dcf3){return function(_0x277fb5){if(_0x277fb5){return _0x277fb5[_0x4ce3('0x37')](_0x44ef5f)['then'](function(_0x384721){return _0x384721;});}return null;};}function removeEntity(_0x5ad807,_0x1ea6c9){return function(_0x400bc3){if(_0x400bc3){return _0x400bc3[_0x4ce3('0x38')]()[_0x4ce3('0x25')](function(){var _0xdcff35=_0x400bc3[_0x4ce3('0x39')]({'plain':!![]});var _0x30e5d5=[{'name':'Users','value':_0x4ce3('0x3a'),'ignore':!![]},{'name':'Agents','value':_0x4ce3('0x3b'),'ignore':![]},{'name':'Telephones','value':_0x4ce3('0x3c'),'ignore':![]}];var _0x568b63=_(_0x30e5d5)[_0x4ce3('0x3d')]('ignore')['map'](_0x4ce3('0x3e'))['value']();if(_[_0x4ce3('0x3f')](_0x568b63,_0xdcff35['role'])){return;}var _0x1e806e=_[_0x4ce3('0x40')](_0x30e5d5,['value',_0xdcff35[_0x4ce3('0x41')]])['name'];return db['UserProfileResource'][_0x4ce3('0x38')]({'where':{'type':_0x1e806e,'resourceId':_0xdcff35['id']}})[_0x4ce3('0x25')](function(){return _0x400bc3;});})[_0x4ce3('0x25')](function(){_0x5ad807[_0x4ce3('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x73fae6,_0x23735a){return function(_0x1551d3){if(!_0x1551d3){_0x73fae6[_0x4ce3('0x2f')](0x194);}return _0x1551d3;};}function handleError(_0x1567de,_0x3b8cc3){_0x3b8cc3=_0x3b8cc3||0x1f4;return function(_0x3969f1){logger[_0x4ce3('0x2b')](_0x3969f1[_0x4ce3('0x42')]);if(_0x3969f1[_0x4ce3('0x43')]){delete _0x3969f1['name'];}_0x1567de[_0x4ce3('0x30')](_0x3b8cc3)[_0x4ce3('0x44')](_0x3969f1);};}exports[_0x4ce3('0x45')]=function(_0x5c3370,_0x491ed1){var _0x36fa53={},_0x4f1f7d={},_0x44c61b={'count':0x0,'rows':[]};var _0x3f259a=_[_0x4ce3('0x46')](db[_0x4ce3('0x47')][_0x4ce3('0x48')],function(_0x595971){return{'name':_0x595971['fieldName'],'type':_0x595971[_0x4ce3('0x49')]['key']};});_0x4f1f7d[_0x4ce3('0x4a')]=_[_0x4ce3('0x4b')](_[_0x4ce3('0x46')](_0x3f259a,_0x4ce3('0x43')),['password',_0x4ce3('0x4c')]);_0x4f1f7d['query']=_[_0x4ce3('0x4d')](_0x5c3370[_0x4ce3('0x4e')]);_0x4f1f7d[_0x4ce3('0x4f')]=_[_0x4ce3('0x50')](_0x4f1f7d[_0x4ce3('0x4a')],_0x4f1f7d[_0x4ce3('0x4e')]);_0x36fa53[_0x4ce3('0x51')]=_[_0x4ce3('0x50')](_0x4f1f7d['model'],qs['fields'](_0x5c3370['query']['fields']));_0x36fa53[_0x4ce3('0x51')]=_0x36fa53[_0x4ce3('0x51')][_0x4ce3('0x52')]?_0x36fa53[_0x4ce3('0x51')]:_0x4f1f7d['model'];if(!_0x5c3370['query'][_0x4ce3('0x53')](_0x4ce3('0x54'))){_0x36fa53[_0x4ce3('0x34')]=qs[_0x4ce3('0x34')](_0x5c3370[_0x4ce3('0x4e')][_0x4ce3('0x34')]);_0x36fa53[_0x4ce3('0x33')]=qs[_0x4ce3('0x33')](_0x5c3370[_0x4ce3('0x4e')][_0x4ce3('0x33')]);}_0x36fa53['order']=qs[_0x4ce3('0x55')](_0x5c3370[_0x4ce3('0x4e')]['sort']);_0x36fa53['where']=qs[_0x4ce3('0x4f')](_['pick'](_0x5c3370['query'],_0x4f1f7d[_0x4ce3('0x4f')]),_0x3f259a);if(_0x5c3370['query'][_0x4ce3('0x3d')]){_0x36fa53[_0x4ce3('0x56')]=_[_0x4ce3('0x57')](_0x36fa53[_0x4ce3('0x56')],{'$or':_[_0x4ce3('0x46')](_0x3f259a,function(_0x350630){if(_0x350630[_0x4ce3('0x49')]!==_0x4ce3('0x58')){return db[_0x4ce3('0x59')][_0x4ce3('0x56')](db['sequelize']['fn'](_0x4ce3('0x5a'),db[_0x4ce3('0x59')]['col'](_0x350630[_0x4ce3('0x43')])),{'$like':db[_0x4ce3('0x59')]['fn']('lower','%'+_0x5c3370[_0x4ce3('0x4e')][_0x4ce3('0x3d')]+'%')});}})});}_0x36fa53=_[_0x4ce3('0x57')]({},_0x36fa53,_0x5c3370[_0x4ce3('0x5b')]);var _0x10408e={'where':_0x36fa53[_0x4ce3('0x56')]};return db['User'][_0x4ce3('0x5c')](_0x10408e)[_0x4ce3('0x25')](function(_0x4548c6){_0x44c61b[_0x4ce3('0x5c')]=_0x4548c6;if(_0x5c3370['query'][_0x4ce3('0x5d')]){_0x36fa53[_0x4ce3('0x5e')]=[{'all':!![]}];}return db['User'][_0x4ce3('0x5f')](_0x36fa53);})[_0x4ce3('0x25')](function(_0x2d0094){_0x44c61b[_0x4ce3('0x60')]=_0x2d0094;return _0x44c61b;})[_0x4ce3('0x25')](respondWithFilteredResult(_0x491ed1,_0x36fa53))[_0x4ce3('0x2e')](handleError(_0x491ed1,null));};exports['show']=function(_0x2b7aed,_0x5aa211){var _0xcb7676={'raw':![],'where':{'id':_0x2b7aed[_0x4ce3('0x61')]['id']}},_0x426a8f={};_0x426a8f[_0x4ce3('0x4a')]=_[_0x4ce3('0x4b')](_['keys'](db['User'][_0x4ce3('0x48')]),[_0x4ce3('0x62'),_0x4ce3('0x4c')]);_0x426a8f[_0x4ce3('0x4e')]=_[_0x4ce3('0x4d')](_0x2b7aed['query']);_0x426a8f[_0x4ce3('0x4f')]=_[_0x4ce3('0x50')](_0x426a8f[_0x4ce3('0x4a')],_0x426a8f[_0x4ce3('0x4e')]);_0xcb7676['attributes']=_[_0x4ce3('0x50')](_0x426a8f[_0x4ce3('0x4a')],qs[_0x4ce3('0x63')](_0x2b7aed[_0x4ce3('0x4e')]['fields']));_0xcb7676['attributes']=_0xcb7676[_0x4ce3('0x51')][_0x4ce3('0x52')]?_0xcb7676[_0x4ce3('0x51')]:_0x426a8f['model'];if(_0x2b7aed[_0x4ce3('0x4e')]['includeAll']){_0xcb7676[_0x4ce3('0x5e')]=[{'all':!![]}];}_0xcb7676=_[_0x4ce3('0x57')]({},_0xcb7676,_0x2b7aed['options']);return db[_0x4ce3('0x47')][_0x4ce3('0x40')](_0xcb7676)[_0x4ce3('0x25')](handleEntityNotFound(_0x5aa211,null))[_0x4ce3('0x25')](respondWithResult(_0x5aa211,null))[_0x4ce3('0x2e')](handleError(_0x5aa211,null));};exports['bulkCreate']=function(_0x5bebad,_0x9b4c6a){return db[_0x4ce3('0x47')][_0x4ce3('0x64')](_0x5bebad[_0x4ce3('0x65')],{'raw':![],'individualHooks':!![]})[_0x4ce3('0x25')](respondWithResult(_0x9b4c6a,0xc9))['catch'](handleError(_0x9b4c6a,null));};exports[_0x4ce3('0x37')]=function(_0xed107,_0x143067){if(_0xed107['body']['id']){delete _0xed107[_0x4ce3('0x65')]['id'];}delete _0xed107[_0x4ce3('0x65')]['role'];return db[_0x4ce3('0x47')][_0x4ce3('0x40')]({'where':{'id':_0xed107[_0x4ce3('0x61')]['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0x143067,null))['then'](saveUpdates(_0xed107['body'],null))['then'](respondWithResult(_0x143067,null))['catch'](handleError(_0x143067,null));};exports[_0x4ce3('0x66')]=function(_0x3722ca,_0xed6b75){return db[_0x4ce3('0x47')][_0x4ce3('0x66')]()[_0x4ce3('0x25')](respondWithResult(_0xed6b75,null))[_0x4ce3('0x2e')](handleError(_0xed6b75,null));};exports[_0x4ce3('0x67')]=function(_0x4d18f9,_0x577484,_0x17cdcd){return db[_0x4ce3('0x47')][_0x4ce3('0x40')]({'where':{'id':_0x4d18f9[_0x4ce3('0x61')]['id']}})['then'](handleEntityNotFound(_0x577484,null))[_0x4ce3('0x25')](function(_0x252152){if(_0x252152){return _0x252152['addContacts'](_0x4d18f9['body'][_0x4ce3('0x68')],_['omit'](_0x4d18f9['body'],[_0x4ce3('0x68'),'id'])||{});}})[_0x4ce3('0x25')](respondWithResult(_0x577484,null))[_0x4ce3('0x2e')](handleError(_0x577484,null));};var getLicense=function(_0x5bf142){return new BPromise(function(_0x5b6c7f,_0x495a01){var _0x160a99=0x0;_0x5bf142['body'][_0x4ce3('0x41')]==='agent'&&_0x5b6c7f(_0x4ce3('0x69'));return db[_0x4ce3('0x47')]['count']({'where':{'$or':[{'role':_0x5bf142[_0x4ce3('0x65')]['role']==='telephone'?_0x4ce3('0x3c'):[_0x4ce3('0x6a'),'user']}]}})[_0x4ce3('0x25')](function(_0x191a6d){_0x160a99=_0x191a6d;return require(_0x4ce3('0x6b'))['getLicense']();})[_0x4ce3('0x25')](function(_0x23b5df){var _0x1c2a54=_0x5bf142['body'][_0x4ce3('0x41')]===_0x4ce3('0x3c')?_0x4ce3('0x6c'):_0x4ce3('0x6d');if(!_[_0x4ce3('0x6e')](_0x23b5df[_0x1c2a54])&&_0x160a99>=_0x23b5df[_0x1c2a54]){return _0x495a01({'message':'License\x20limit\x20reached'});}return _0x5b6c7f(util['format'](_0x4ce3('0x6f'),_0x1c2a54,_0x160a99));})[_0x4ce3('0x2e')](function(_0x4c54ce){return _0x495a01(_0x4c54ce);});});};exports[_0x4ce3('0x70')]=function(_0x5974b2,_0x385978){return getLicense(_0x5974b2)[_0x4ce3('0x25')](function(_0x584c07){if(!_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x71')]){var _0x445fdb;return db[_0x4ce3('0x72')][_0x4ce3('0x73')](0x1)[_0x4ce3('0x25')](function(_0x2e5473){return checkPasswordPattern(_0x2e5473,_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x62')],_0x2e5473[_0x4ce3('0x74')]);})['then'](function(_0x302ebe){_0x445fdb=_0x302ebe[_0x4ce3('0x75')];return db[_0x4ce3('0x47')][_0x4ce3('0x76')](_0x4ce3('0x71'));})[_0x4ce3('0x25')](function(_0x3873ff){if(_[_0x4ce3('0x6e')](_0x3873ff)){if(_0x445fdb){_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x71')]=_0x445fdb;}else{_0x5974b2['body']['internal']=0x1;}}else{if(_[_0x4ce3('0x6e')](_0x445fdb)||_0x445fdb==_0x3873ff){_0x5974b2['body'][_0x4ce3('0x71')]=_0x3873ff+0x1;}else if(_0x445fdb>_0x3873ff){_0x5974b2['body'][_0x4ce3('0x71')]=_0x445fdb;}else{return db[_0x4ce3('0x59')][_0x4ce3('0x4e')]('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[_0x4ce3('0x59')][_0x4ce3('0x77')]['SELECT']})[_0x4ce3('0x25')](function(_0x214b50){if(_0x214b50&&_0x214b50['length']){for(var _0x30f1e1=0x0,_0x5c747a=_0x214b50[_0x4ce3('0x52')];_0x30f1e1<_0x5c747a&&_[_0x4ce3('0x6e')](_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x71')]);_0x30f1e1++){if(_0x445fdb<=_0x214b50[_0x30f1e1][_0x4ce3('0x78')]){_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x71')]=_0x214b50[_0x30f1e1][_0x4ce3('0x78')];}else if(_0x445fdb>_0x214b50[_0x30f1e1][_0x4ce3('0x78')]&&_0x445fdb<=_0x214b50[_0x30f1e1]['to']){_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x71')]=_0x445fdb;}}}if(_['isNil'](_0x5974b2[_0x4ce3('0x65')]['internal'])){_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x71')]=_0x3873ff+0x1;}});}}});}})[_0x4ce3('0x25')](function(){if(_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x79')]){_0x5974b2['body'][_0x4ce3('0x7a')]=_0x5974b2['body'][_0x4ce3('0x71')];_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x7b')]={'mailbox':_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x71')],'password':_0x5974b2['body'][_0x4ce3('0x62')],'fullname':_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x7c')],'email':_0x5974b2[_0x4ce3('0x65')]['email']};}if(_0x5974b2[_0x4ce3('0x65')]&&_0x5974b2['body'][_0x4ce3('0x41')]===_0x4ce3('0x3b')){if(!_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x7d')]){_0x5974b2[_0x4ce3('0x65')][_0x4ce3('0x7d')]=[_0x4ce3('0x7e'),_0x4ce3('0x7f'),'103',_0x4ce3('0x80'),_0x4ce3('0x81'),'104',_0x4ce3('0x82'),_0x4ce3('0x83'),_0x4ce3('0x84'),_0x4ce3('0x85'),_0x4ce3('0x86'),'100',_0x4ce3('0x87'),_0x4ce3('0x88')];}}return db[_0x4ce3('0x47')][_0x4ce3('0x70')](_0x5974b2['body'],{'include':[{'model':db[_0x4ce3('0x7b')],'as':_0x4ce3('0x7b')}]});})[_0x4ce3('0x25')](function(_0x5877a4){if(_0x5974b2[_0x4ce3('0x65')]['role']===_0x4ce3('0x3a'))return _0x5877a4;var _0x4d296f=_0x5974b2[_0x4ce3('0x3a')]['get']({'plain':!![]});if(!_0x4d296f)throw new Error(_0x4ce3('0x89'));if(_0x4d296f[_0x4ce3('0x41')]===_0x4ce3('0x3a')){var _0x39d7ef=_0x5877a4['get']({'plain':!![]});var _0x5626d5=[{'name':_0x4ce3('0x8a'),'value':_0x4ce3('0x3b')},{'name':'Telephones','value':_0x4ce3('0x3c')}];var _0x231199=_['find'](_0x5626d5,[_0x4ce3('0x3e'),_0x39d7ef[_0x4ce3('0x41')]])[_0x4ce3('0x43')];return db[_0x4ce3('0x8b')]['find']({'where':{'name':_0x231199,'userProfileId':_0x4d296f[_0x4ce3('0x8c')]},'raw':!![]})['then'](function(_0x1a35af){if(_0x1a35af&&_0x1a35af[_0x4ce3('0x8d')]===0x0){return db[_0x4ce3('0x8e')][_0x4ce3('0x70')]({'name':_0x39d7ef[_0x4ce3('0x43')],'resourceId':_0x39d7ef['id'],'type':_0x1a35af[_0x4ce3('0x43')],'sectionId':_0x1a35af['id']},{})['then'](function(){return _0x5877a4;});}else{return _0x5877a4;}})[_0x4ce3('0x2e')](function(_0x13178f){logger[_0x4ce3('0x2b')](_0x4ce3('0x8f'),_0x13178f);throw _0x13178f;});}return _0x5877a4;})[_0x4ce3('0x25')](respondWithResult(_0x385978,0xc9))[_0x4ce3('0x2e')](handleError(_0x385978,null));};exports['changePassword']=function(_0x9b39b6,_0x4ade55,_0x3c2efe){var _0x2b61c7=![];if(_0x9b39b6['body']['id']){delete _0x9b39b6[_0x4ce3('0x65')]['id'];}return db[_0x4ce3('0x72')]['findOne']({'attributes':['id',_0x4ce3('0x74')]})[_0x4ce3('0x25')](function(_0x212c79){_0x2b61c7=_0x212c79['securePassword'];return db[_0x4ce3('0x47')][_0x4ce3('0x40')]({'where':{'id':_0x9b39b6['params']['id']}});})['then'](function(_0x1517f4){if(_0x1517f4){if(_0x1517f4['id']==_0x9b39b6[_0x4ce3('0x3a')]['id']){if(!_0x9b39b6[_0x4ce3('0x65')][_0x4ce3('0x90')]||!_0x9b39b6['body'][_0x4ce3('0x91')]){throw new db[(_0x4ce3('0x92'))][(_0x4ce3('0x23'))](_0x4ce3('0x93'));}if(!_0x1517f4[_0x4ce3('0x94')](_0x9b39b6[_0x4ce3('0x65')][_0x4ce3('0x90')])){throw new db[(_0x4ce3('0x92'))][(_0x4ce3('0x23'))](_0x4ce3('0x95'));}if(_0x9b39b6[_0x4ce3('0x65')][_0x4ce3('0x90')]==_0x9b39b6[_0x4ce3('0x65')]['newPassword']){throw new db[(_0x4ce3('0x92'))][(_0x4ce3('0x23'))](_0x4ce3('0x96'));}return _0x1517f4;}else if(_0x9b39b6[_0x4ce3('0x3a')][_0x4ce3('0x41')]==_0x4ce3('0x6a')){if(!_0x9b39b6['body']['newPassword']){throw new db[(_0x4ce3('0x92'))][(_0x4ce3('0x23'))](_0x4ce3('0x97'));}return _0x1517f4;}else if(_0x9b39b6[_0x4ce3('0x3a')][_0x4ce3('0x41')]=='user'){if(!_0x9b39b6[_0x4ce3('0x65')][_0x4ce3('0x91')]){throw new db['Sequelize'][(_0x4ce3('0x23'))](_0x4ce3('0x97'));}if(_0x1517f4[_0x4ce3('0x41')]!=_0x4ce3('0x3b')){throw new db['Sequelize'][(_0x4ce3('0x23'))]('Unauthorized');}return _0x1517f4;}else{throw new db['Sequelize']['ValidationError'](_0x4ce3('0x98'));}}return null;})[_0x4ce3('0x25')](handleEntityNotFound(_0x4ade55,null))[_0x4ce3('0x25')](function(_0x3dc4cc){return checkPasswordPattern(_0x3dc4cc,_0x9b39b6['body']['newPassword'],_0x2b61c7);})[_0x4ce3('0x25')](saveUpdates({'password':_0x9b39b6['body']['newPassword'],'passwordResetAt':_0x9b39b6[_0x4ce3('0x3a')]['id']==_0x9b39b6[_0x4ce3('0x61')]['id']?moment():null},null))[_0x4ce3('0x25')](respondWithResult(_0x4ade55,null))['catch'](handleError(_0x4ade55,null));};exports[_0x4ce3('0x99')]=function(_0x14ebe9,_0x4fd421,_0x59bcd6){var _0x4e086c=_0x14ebe9[_0x4ce3('0x65')][_0x4ce3('0x9a')];return db[_0x4ce3('0x47')][_0x4ce3('0x40')]({'where':{'id':_0x14ebe9[_0x4ce3('0x61')]['id']},'attributes':['id','name',_0x4ce3('0x41'),_0x4ce3('0x9b'),_0x4ce3('0x9c'),_0x4ce3('0x9d'),_0x4ce3('0x9e')]})[_0x4ce3('0x25')](handleEntityNotFound(_0x4fd421,null))[_0x4ce3('0x25')](function(_0x407a81){if(_0x407a81){if(!utils['isValidChannel'](_0x4e086c)){throw new db[(_0x4ce3('0x92'))][(_0x4ce3('0x23'))](_0x4ce3('0x9f'));}return _0x407a81[_0x4ce3('0xa0')+_[_0x4ce3('0xa1')](_0x4e086c[_0x4ce3('0xa2')]())+_0x4ce3('0xa3')](_0x14ebe9[_0x4ce3('0x65')][_0x4ce3('0x68')],{'penalty':_0x14ebe9['body'][_0x4ce3('0xa4')]||0x0})[_0x4ce3('0xa5')](function(_0x48132b){for(var _0x2e7292=0x0;_0x2e7292<_0x14ebe9[_0x4ce3('0x65')]['ids']['length'];_0x2e7292+=0x1){var _0x44277f={'UserId':_0x14ebe9[_0x4ce3('0x61')]['id']};_0x44277f[_['capitalize'](_0x4e086c['toLowerCase']())+_0x4ce3('0xa6')]=_0x14ebe9['body']['ids'][_0x2e7292];socket[_0x4ce3('0xa7')](_0x4ce3('0x3a')+_['capitalize'](_0x4e086c['toLowerCase']())+_0x4ce3('0xa8'),_0x44277f);}return _0x48132b;})[_0x4ce3('0x25')](function(){if(_0x4e086c===_0x4ce3('0xa9')){return db[_0x4ce3('0xaa')][_0x4ce3('0x5f')]({'where':{'id':_0x14ebe9[_0x4ce3('0x65')][_0x4ce3('0x68')]||[]},'raw':!![],'attributes':['id',_0x4ce3('0x43')]});}})['then'](function(_0xeef4b1){var _0x5ed81a=_0x407a81[_0x4ce3('0x39')]({'plain':!![]});var _0x831a04=[];if(_0x4e086c===_0x4ce3('0xa9')&&_0x5ed81a[_0x4ce3('0x41')]===_0x4ce3('0x3b')&&_0x5ed81a['online']){for(var _0x23417d=0x0;_0x23417d<_0xeef4b1['length'];_0x23417d+=0x1){_0x831a04['push']({'membername':_0x5ed81a[_0x4ce3('0x43')],'UserId':_0x5ed81a['id'],'queue_name':_0xeef4b1[_0x23417d][_0x4ce3('0x43')],'VoiceQueueId':_0xeef4b1[_0x23417d]['id'],'interface':_[_0x4ce3('0x6e')](_0x5ed81a[_0x4ce3('0x9e')])?util[_0x4ce3('0xab')](_0x4ce3('0xac'),_0x5ed81a[_0x4ce3('0x43')]):_0x5ed81a[_0x4ce3('0x9e')],'paused':_0x5ed81a[_0x4ce3('0x9d')]||![],'penalty':_0x14ebe9['body'][_0x4ce3('0xa4')]||0x0});}return BPromise[_0x4ce3('0xad')](_0x831a04,function(_0x530911){return db[_0x4ce3('0xae')][_0x4ce3('0xaf')](_0x530911);});}return _0x407a81;});}})[_0x4ce3('0x25')](respondWithStatusCode(_0x4fd421,null))[_0x4ce3('0x2e')](handleError(_0x4fd421,null));};exports['removeQueues']=function(_0x1fc891,_0x135c0f,_0x52b344){var _0x161373;return db[_0x4ce3('0x47')]['find']({'where':{'id':_0x1fc891[_0x4ce3('0x61')]['id']},'attributes':['id',_0x4ce3('0x43'),'role']})[_0x4ce3('0x25')](handleEntityNotFound(_0x135c0f,null))['then'](function(_0x281b2e){if(_0x281b2e){_0x161373=_0x281b2e;if(!_0x1fc891[_0x4ce3('0x4e')][_0x4ce3('0x9a')]||!utils[_0x4ce3('0xb0')](_0x1fc891[_0x4ce3('0x4e')][_0x4ce3('0x9a')])){throw new db['Sequelize'][(_0x4ce3('0x23'))](_0x4ce3('0x9f'));}return _0x281b2e[_0x4ce3('0xb1')+_[_0x4ce3('0xa1')](_0x1fc891[_0x4ce3('0x4e')][_0x4ce3('0x9a')][_0x4ce3('0xa2')]())+_0x4ce3('0xa3')](_0x1fc891['query']['ids']);}})[_0x4ce3('0x25')](function(_0x14d872){for(var _0xf51e0b=0x0;_0xf51e0b<_0x1fc891[_0x4ce3('0x4e')]['ids'][_0x4ce3('0x52')];_0xf51e0b+=0x1){var _0x3f94df={'UserId':_0x1fc891[_0x4ce3('0x61')]['id']};_0x3f94df[_[_0x4ce3('0xa1')](_0x1fc891[_0x4ce3('0x4e')][_0x4ce3('0x9a')]['toLowerCase']())+_0x4ce3('0xa6')]=_0x1fc891[_0x4ce3('0x4e')][_0x4ce3('0x68')][_0xf51e0b];socket['emit'](_0x4ce3('0x3a')+_['capitalize'](_0x1fc891[_0x4ce3('0x4e')]['channel'][_0x4ce3('0xa2')]())+_0x4ce3('0xb2'),_0x3f94df);}return _0x14d872;})[_0x4ce3('0x25')](function(){if(_0x1fc891[_0x4ce3('0x4e')][_0x4ce3('0x9a')]===_0x4ce3('0xa9')){return db[_0x4ce3('0xae')]['destroy']({'where':{'UserId':_0x1fc891['params']['id'],'VoiceQueueId':_0x1fc891[_0x4ce3('0x4e')][_0x4ce3('0x68')]},'individualHooks':!![]})[_0x4ce3('0x25')](function(){return _0x161373;});}return _0x161373;})[_0x4ce3('0x25')](respondWithStatusCode(_0x135c0f,null))[_0x4ce3('0x2e')](handleError(_0x135c0f,null));};exports[_0x4ce3('0xb3')]=function(_0x14c428,_0xa0e904,_0x1859a5){_0x14c428[_0x4ce3('0x65')][_0x4ce3('0xb4')]=_0x14c428[_0x4ce3('0xb5')][_0x4ce3('0xb6')];return db[_0x4ce3('0x47')][_0x4ce3('0x40')]({'where':{'id':_0x14c428[_0x4ce3('0x61')]['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0xa0e904,null))[_0x4ce3('0x25')](saveUpdates(_0x14c428[_0x4ce3('0x65')],null))[_0x4ce3('0x25')](respondWithResult(_0xa0e904,null))[_0x4ce3('0x2e')](handleError(_0xa0e904,null));};exports[_0x4ce3('0xb7')]=function(_0x4381f1,_0x5dba93,_0xb283c4){var _0x3c5b6c=path[_0x4ce3('0xb8')](config[_0x4ce3('0xb9')],_0x4ce3('0xba'));return db[_0x4ce3('0x47')][_0x4ce3('0x40')]({'where':{'id':_0x4381f1[_0x4ce3('0x61')]['id']},'attributes':['id',_0x4ce3('0xb4')],'raw':!![]})[_0x4ce3('0x25')](handleEntityNotFound(_0x5dba93,null))[_0x4ce3('0x25')](function(_0x3f223a){if(_0x3f223a){if(_['isNil'](_0x3f223a[_0x4ce3('0xb4')])){return _0x5dba93[_0x4ce3('0xbb')](_0x3c5b6c);}else{if(!fs[_0x4ce3('0xbc')](path[_0x4ce3('0xb8')](config[_0x4ce3('0xb9')],_0x4ce3('0xbd'),_0x3f223a[_0x4ce3('0xb4')]))){return _0x5dba93[_0x4ce3('0xbb')](_0x3c5b6c);}return _0x5dba93[_0x4ce3('0xbb')](path[_0x4ce3('0xb8')](config[_0x4ce3('0xb9')],_0x4ce3('0xbd'),_0x3f223a[_0x4ce3('0xb4')]));}}})[_0x4ce3('0x2e')](handleError(_0x5dba93,null));};exports[_0x4ce3('0xbe')]=function(_0x3c6684,_0x434853,_0x1a190f){var _0x556bda={};var _0x295ed2={};var _0x4694ec;var _0x382f85;return db[_0x4ce3('0x47')][_0x4ce3('0xbf')]({'where':{'id':_0x3c6684[_0x4ce3('0x61')]['id']}})['then'](handleEntityNotFound(_0x434853,null))[_0x4ce3('0x25')](function(_0xa0e764){if(_0xa0e764){_0x4694ec=_0xa0e764;_0x295ed2[_0x4ce3('0x4a')]=_['keys'](db['CmContact'][_0x4ce3('0x48')]);_0x295ed2[_0x4ce3('0x4e')]=_[_0x4ce3('0x4d')](_0x3c6684['query']);_0x295ed2[_0x4ce3('0x4f')]=_['intersection'](_0x295ed2[_0x4ce3('0x4a')],_0x295ed2[_0x4ce3('0x4e')]);_0x556bda[_0x4ce3('0x51')]=_[_0x4ce3('0x50')](_0x295ed2[_0x4ce3('0x4a')],qs[_0x4ce3('0x63')](_0x3c6684[_0x4ce3('0x4e')][_0x4ce3('0x63')]));_0x556bda[_0x4ce3('0x51')]=_0x556bda[_0x4ce3('0x51')][_0x4ce3('0x52')]?_0x556bda[_0x4ce3('0x51')]:_0x295ed2['model'];_0x556bda[_0x4ce3('0xc0')]=qs[_0x4ce3('0x55')](_0x3c6684['query']['sort']);_0x556bda['where']=qs[_0x4ce3('0x4f')](_[_0x4ce3('0xc1')](_0x3c6684[_0x4ce3('0x4e')],_0x295ed2[_0x4ce3('0x4f')]));if(_0x3c6684[_0x4ce3('0x4e')][_0x4ce3('0x3d')]){_0x556bda['where']=_[_0x4ce3('0x57')](_0x556bda[_0x4ce3('0x56')],{'$or':_['map'](_0x556bda[_0x4ce3('0x51')],function(_0x3c00aa){var _0x54f446={};_0x54f446[_0x3c00aa]={'$like':'%'+_0x3c6684[_0x4ce3('0x4e')]['filter']+'%'};return _0x54f446;})});}_0x556bda=_[_0x4ce3('0x57')]({},_0x556bda,_0x3c6684[_0x4ce3('0x5b')]);return _0x4694ec[_0x4ce3('0xbe')](_0x556bda);}})[_0x4ce3('0x25')](function(_0x14aa3c){if(_0x14aa3c){_0x382f85=_0x14aa3c[_0x4ce3('0x52')];if(_0x3c6684[_0x4ce3('0x4e')][_0x4ce3('0x53')]('includeAll')){_0x556bda[_0x4ce3('0x5e')]=[{'model':db[_0x4ce3('0xc2')],'as':_0x4ce3('0xc3'),'required':![]},{'model':db[_0x4ce3('0xc4')],'as':_0x4ce3('0xc5'),'attributes':['id',_0x4ce3('0x43'),_0x4ce3('0xc6')],'where':_0x3c6684[_0x4ce3('0x4e')]['tag']?{'id':_0x3c6684['query'][_0x4ce3('0xc7')]}:undefined,'required':_0x3c6684[_0x4ce3('0x4e')][_0x4ce3('0xc7')]?!![]:![]}];}if(!_0x3c6684[_0x4ce3('0x4e')][_0x4ce3('0x53')](_0x4ce3('0x54'))){_0x556bda['limit']=qs[_0x4ce3('0x34')](_0x3c6684[_0x4ce3('0x4e')][_0x4ce3('0x34')]);_0x556bda[_0x4ce3('0x33')]=qs[_0x4ce3('0x33')](_0x3c6684['query'][_0x4ce3('0x33')]);}return _0x4694ec[_0x4ce3('0xbe')](_0x556bda);}})['then'](function(_0x10ccb1){if(_0x10ccb1){return _0x10ccb1?{'count':_0x382f85,'rows':_0x10ccb1}:null;}})[_0x4ce3('0x25')](respondWithResult(_0x434853,null))[_0x4ce3('0x2e')](handleError(_0x434853,null));};exports['getQueues']=function(_0x48903c,_0x5af803,_0x253837){var _0x4e0f5b;var _0x87b777;var _0x5743c6={};var _0x6e10b2;return db['User'][_0x4ce3('0xbf')]({'where':{'id':_0x48903c[_0x4ce3('0x61')]['id']},'attributes':['id',_0x4ce3('0x43'),_0x4ce3('0x41')]})['then'](handleEntityNotFound(_0x5af803,null))['then'](function(_0x34b33b){if(!utils[_0x4ce3('0xb0')](_0x48903c['query'][_0x4ce3('0x9a')])){throw new db[(_0x4ce3('0x92'))][(_0x4ce3('0x23'))](_0x4ce3('0x9f'));}_0x4e0f5b=_0x34b33b;var _0x65fc4b={};_0x65fc4b[_0x4ce3('0x4a')]=_[_0x4ce3('0x4d')](db[_[_0x4ce3('0xa1')](_0x48903c[_0x4ce3('0x4e')][_0x4ce3('0x9a')])+'Queue'][_0x4ce3('0x48')]);_0x65fc4b[_0x4ce3('0x4e')]=_['keys'](_0x48903c['query']);_0x65fc4b['filters']=_[_0x4ce3('0x50')](_0x65fc4b[_0x4ce3('0x4a')],_0x65fc4b[_0x4ce3('0x4e')]);_0x5743c6[_0x4ce3('0x51')]=_[_0x4ce3('0x50')](_0x65fc4b['model'],qs[_0x4ce3('0x63')](_0x48903c[_0x4ce3('0x4e')][_0x4ce3('0x63')]));_0x5743c6[_0x4ce3('0x51')]=_0x5743c6[_0x4ce3('0x51')][_0x4ce3('0x52')]?_0x5743c6[_0x4ce3('0x51')]:_0x65fc4b['model'];_0x5743c6[_0x4ce3('0xc0')]=qs[_0x4ce3('0x55')](_0x48903c[_0x4ce3('0x4e')][_0x4ce3('0x55')]);_0x5743c6[_0x4ce3('0x56')]=qs['filters'](_[_0x4ce3('0xc1')](_0x48903c[_0x4ce3('0x4e')],_0x65fc4b[_0x4ce3('0x4f')]));if(_0x48903c[_0x4ce3('0x4e')][_0x4ce3('0x3d')]){_0x5743c6['where']=_[_0x4ce3('0x57')](_0x5743c6[_0x4ce3('0x56')],{'$or':_[_0x4ce3('0x46')](_0x5743c6[_0x4ce3('0x51')],function(_0x443f93){var _0x5150ca={};_0x5150ca[_0x443f93]={'$like':'%'+_0x48903c[_0x4ce3('0x4e')][_0x4ce3('0x3d')]+'%'};return _0x5150ca;})});}_0x5743c6=_['merge']({},_0x5743c6,_0x48903c[_0x4ce3('0x5b')]);switch(_0x4e0f5b[_0x4ce3('0x41')]){case _0x4ce3('0x6a'):return db[_[_0x4ce3('0xa1')](_0x48903c[_0x4ce3('0x4e')][_0x4ce3('0x9a')])+_0x4ce3('0xc8')]['findAll'](_0x5743c6);case _0x4ce3('0x3a'):case _0x4ce3('0x3b'):return _0x4e0f5b[_0x4ce3('0x39')+_[_0x4ce3('0xa1')](_0x48903c[_0x4ce3('0x4e')][_0x4ce3('0x9a')])+_0x4ce3('0xa3')](_0x5743c6);default:throw new db[(_0x4ce3('0x92'))][(_0x4ce3('0x23'))](_0x4ce3('0xc9'));}})[_0x4ce3('0x25')](function(_0x365311){_0x6e10b2=_0x365311[_0x4ce3('0x52')];if(!_0x48903c[_0x4ce3('0x4e')][_0x4ce3('0x53')](_0x4ce3('0x54'))){_0x5743c6[_0x4ce3('0x34')]=qs[_0x4ce3('0x34')](_0x48903c['query'][_0x4ce3('0x34')]);_0x5743c6[_0x4ce3('0x33')]=qs[_0x4ce3('0x33')](_0x48903c['query'][_0x4ce3('0x33')]);}switch(_0x4e0f5b[_0x4ce3('0x41')]){case _0x4ce3('0x6a'):return db[_['capitalize'](_0x48903c['query'][_0x4ce3('0x9a')])+_0x4ce3('0xc8')][_0x4ce3('0x5f')](_0x5743c6);case _0x4ce3('0x3a'):case _0x4ce3('0x3b'):return _0x4e0f5b[_0x4ce3('0x39')+_[_0x4ce3('0xa1')](_0x48903c[_0x4ce3('0x4e')]['channel'])+_0x4ce3('0xa3')](_0x5743c6);}})[_0x4ce3('0x25')](function(_0xc0eb12){return{'count':_0x6e10b2,'rows':_0xc0eb12};})[_0x4ce3('0x25')](respondWithResult(_0x5af803,null))[_0x4ce3('0x2e')](handleError(_0x5af803,null));};exports['getVoiceQueuesRt']=function(_0x49086d,_0x272c12,_0x52058a){var _0x350bf2={};var _0x1ca044={};var _0x2ec934;var _0x3d2056;return db['User'][_0x4ce3('0xbf')]({'where':{'id':_0x49086d[_0x4ce3('0x61')]['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0x272c12,null))[_0x4ce3('0x25')](function(_0x3b3d67){if(_0x3b3d67){_0x2ec934=_0x3b3d67;_0x1ca044['model']=_['keys'](db[_0x4ce3('0xae')][_0x4ce3('0x48')]);_0x1ca044[_0x4ce3('0x4e')]=_['keys'](_0x49086d[_0x4ce3('0x4e')]);_0x1ca044[_0x4ce3('0x4f')]=_[_0x4ce3('0x50')](_0x1ca044[_0x4ce3('0x4a')],_0x1ca044['query']);_0x350bf2[_0x4ce3('0x51')]=_[_0x4ce3('0x50')](_0x1ca044[_0x4ce3('0x4a')],qs[_0x4ce3('0x63')](_0x49086d['query'][_0x4ce3('0x63')]));_0x350bf2[_0x4ce3('0x51')]=_0x350bf2['attributes'][_0x4ce3('0x52')]?_0x350bf2[_0x4ce3('0x51')]:_0x1ca044[_0x4ce3('0x4a')];_0x350bf2['order']=qs['sort'](_0x49086d[_0x4ce3('0x4e')][_0x4ce3('0x55')]);_0x350bf2['where']=qs['filters'](_[_0x4ce3('0xc1')](_0x49086d[_0x4ce3('0x4e')],_0x1ca044['filters']));if(_0x49086d[_0x4ce3('0x4e')][_0x4ce3('0x3d')]){_0x350bf2[_0x4ce3('0x56')]=_['merge'](_0x350bf2[_0x4ce3('0x56')],{'$or':_[_0x4ce3('0x46')](_0x350bf2[_0x4ce3('0x51')],function(_0x350f8c){var _0x140009={};_0x140009[_0x350f8c]={'$like':'%'+_0x49086d[_0x4ce3('0x4e')][_0x4ce3('0x3d')]+'%'};return _0x140009;})});}_0x350bf2=_[_0x4ce3('0x57')]({},_0x350bf2,_0x49086d[_0x4ce3('0x5b')]);return _0x2ec934[_0x4ce3('0xca')](_0x350bf2);}})[_0x4ce3('0x25')](function(_0x1b8fcd){if(_0x1b8fcd){_0x3d2056=_0x1b8fcd[_0x4ce3('0x52')];if(!_0x49086d['query']['hasOwnProperty']('nolimit')){_0x350bf2['limit']=qs[_0x4ce3('0x34')](_0x49086d['query']['limit']);_0x350bf2[_0x4ce3('0x33')]=qs[_0x4ce3('0x33')](_0x49086d[_0x4ce3('0x4e')][_0x4ce3('0x33')]);}return _0x2ec934[_0x4ce3('0xca')](_0x350bf2);}})[_0x4ce3('0x25')](function(_0x382dfc){if(_0x382dfc){return _0x382dfc?{'count':_0x3d2056,'rows':_0x382dfc}:null;}})[_0x4ce3('0x25')](respondWithResult(_0x272c12,null))[_0x4ce3('0x2e')](handleError(_0x272c12,null));};exports[_0x4ce3('0xcb')]=function(_0x3b84e9,_0x3bd209,_0x5d5310){var _0x4fc6b9={};var _0x198b25={};var _0x29b4c4;var _0x36ca8c;return db[_0x4ce3('0x47')][_0x4ce3('0xbf')]({'where':{'id':_0x3b84e9[_0x4ce3('0x61')]['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0x3bd209,null))['then'](function(_0xe991b4){if(_0xe991b4){_0x29b4c4=_0xe991b4;_0x198b25[_0x4ce3('0x4a')]=_[_0x4ce3('0x4d')](db[_0x4ce3('0xcc')][_0x4ce3('0x48')]);_0x198b25['query']=_['keys'](_0x3b84e9[_0x4ce3('0x4e')]);_0x198b25[_0x4ce3('0x4f')]=_[_0x4ce3('0x50')](_0x198b25['model'],_0x198b25[_0x4ce3('0x4e')]);_0x4fc6b9[_0x4ce3('0x51')]=_[_0x4ce3('0x50')](_0x198b25[_0x4ce3('0x4a')],qs[_0x4ce3('0x63')](_0x3b84e9[_0x4ce3('0x4e')][_0x4ce3('0x63')]));_0x4fc6b9[_0x4ce3('0x51')]=_0x4fc6b9['attributes']['length']?_0x4fc6b9[_0x4ce3('0x51')]:_0x198b25[_0x4ce3('0x4a')];_0x4fc6b9[_0x4ce3('0xc0')]=qs[_0x4ce3('0x55')](_0x3b84e9[_0x4ce3('0x4e')]['sort']);_0x4fc6b9[_0x4ce3('0x56')]=qs[_0x4ce3('0x4f')](_[_0x4ce3('0xc1')](_0x3b84e9[_0x4ce3('0x4e')],_0x198b25[_0x4ce3('0x4f')]));if(_0x3b84e9['query'][_0x4ce3('0x3d')]){_0x4fc6b9[_0x4ce3('0x56')]=_[_0x4ce3('0x57')](_0x4fc6b9[_0x4ce3('0x56')],{'$or':_['map'](_0x4fc6b9['attributes'],function(_0x5cf374){var _0x1fc4fa={};_0x1fc4fa[_0x5cf374]={'$like':'%'+_0x3b84e9[_0x4ce3('0x4e')][_0x4ce3('0x3d')]+'%'};return _0x1fc4fa;})});}_0x4fc6b9=_[_0x4ce3('0x57')]({},_0x4fc6b9,_0x3b84e9[_0x4ce3('0x5b')]);return _0x29b4c4[_0x4ce3('0xcb')](_0x4fc6b9);}})[_0x4ce3('0x25')](function(_0x4d711f){if(_0x4d711f){_0x36ca8c=_0x4d711f['length'];if(!_0x3b84e9['query'][_0x4ce3('0x53')](_0x4ce3('0x54'))){_0x4fc6b9[_0x4ce3('0x34')]=qs[_0x4ce3('0x34')](_0x3b84e9[_0x4ce3('0x4e')][_0x4ce3('0x34')]);_0x4fc6b9[_0x4ce3('0x33')]=qs[_0x4ce3('0x33')](_0x3b84e9[_0x4ce3('0x4e')][_0x4ce3('0x33')]);}return _0x29b4c4['getGroups'](_0x4fc6b9);}})['then'](function(_0x4b7232){if(_0x4b7232){return _0x4b7232?{'count':_0x36ca8c,'rows':_0x4b7232}:null;}})[_0x4ce3('0x25')](respondWithResult(_0x3bd209,null))[_0x4ce3('0x2e')](handleError(_0x3bd209,null));};exports[_0x4ce3('0xcd')]=function(_0x32dad1,_0x59b1ca,_0x36d97e){var _0x380e25={'raw':!![],'where':{}};var _0xf7740b={};var _0x2a7be4={'count':0x0,'rows':[]};return db[_0x4ce3('0x47')][_0x4ce3('0xbf')]({'where':{'id':_0x32dad1['params']['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0x59b1ca,null))[_0x4ce3('0x25')](function(_0x168e1e){if(_0x168e1e){_0xf7740b['model']=_[_0x4ce3('0x4d')](db[_0x4ce3('0xce')][_0x4ce3('0x48')]);_0xf7740b[_0x4ce3('0x4e')]=_[_0x4ce3('0x4d')](_0x32dad1[_0x4ce3('0x4e')]);_0xf7740b['filters']=_[_0x4ce3('0x50')](_0xf7740b['model'],_0xf7740b[_0x4ce3('0x4e')]);_0x380e25['attributes']=_['intersection'](_0xf7740b[_0x4ce3('0x4a')],qs[_0x4ce3('0x63')](_0x32dad1['query'][_0x4ce3('0x63')]));_0x380e25['attributes']=_0x380e25[_0x4ce3('0x51')][_0x4ce3('0x52')]?_0x380e25[_0x4ce3('0x51')]:_0xf7740b[_0x4ce3('0x4a')];if(!_0x32dad1[_0x4ce3('0x4e')]['hasOwnProperty'](_0x4ce3('0x54'))){_0x380e25[_0x4ce3('0x34')]=qs[_0x4ce3('0x34')](_0x32dad1[_0x4ce3('0x4e')][_0x4ce3('0x34')]);_0x380e25[_0x4ce3('0x33')]=qs['offset'](_0x32dad1['query']['offset']);}_0x380e25['order']=qs[_0x4ce3('0x55')](_0x32dad1[_0x4ce3('0x4e')][_0x4ce3('0x55')]);_0x380e25[_0x4ce3('0x56')]=qs[_0x4ce3('0x4f')](_[_0x4ce3('0xc1')](_0x32dad1[_0x4ce3('0x4e')],_0xf7740b[_0x4ce3('0x4f')]));_0x380e25['where'][_0x4ce3('0xcf')]=_0x168e1e['id'];if(_0x32dad1['query'][_0x4ce3('0x3d')]){_0x380e25[_0x4ce3('0x56')]=_['merge'](_0x380e25[_0x4ce3('0x56')],{'$or':_[_0x4ce3('0x46')](_0x380e25['attributes'],function(_0x211fe0){var _0x7e8a07={};_0x7e8a07[_0x211fe0]={'$like':'%'+_0x32dad1[_0x4ce3('0x4e')][_0x4ce3('0x3d')]+'%'};return _0x7e8a07;})});}_0x380e25=_[_0x4ce3('0x57')]({},_0x380e25,_0x32dad1[_0x4ce3('0x5b')]);return db[_0x4ce3('0xce')][_0x4ce3('0x5c')]({'where':_0x380e25[_0x4ce3('0x56')]})[_0x4ce3('0x25')](function(_0x36ebd2){_0x2a7be4['count']=_0x36ebd2;if(_0x32dad1[_0x4ce3('0x4e')][_0x4ce3('0x5d')]){_0x380e25['include']=[{'all':!![]}];}return db[_0x4ce3('0xce')][_0x4ce3('0x5f')](_0x380e25);})['then'](function(_0x17b35c){_0x2a7be4[_0x4ce3('0x60')]=_0x17b35c;return _0x2a7be4;});}})['then'](respondWithFilteredResult(_0x59b1ca,_0x380e25))[_0x4ce3('0x2e')](handleError(_0x59b1ca,null));};exports[_0x4ce3('0xd0')]=function(_0x2df314,_0x4cedb1,_0x2d467e){var _0xc9cad3={'raw':!![],'where':{}};var _0x4a471a={};var _0xed486b={'count':0x0,'rows':[]};return db[_0x4ce3('0x47')][_0x4ce3('0xbf')]({'where':{'id':_0x2df314[_0x4ce3('0x61')]['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0x4cedb1,null))[_0x4ce3('0x25')](function(_0x3762b8){if(_0x3762b8){_0x4a471a['model']=_[_0x4ce3('0x4d')](db['ScreenRecording'][_0x4ce3('0x48')]);_0x4a471a[_0x4ce3('0x4e')]=_[_0x4ce3('0x4d')](_0x2df314[_0x4ce3('0x4e')]);_0x4a471a[_0x4ce3('0x4f')]=_['intersection'](_0x4a471a['model'],_0x4a471a[_0x4ce3('0x4e')]);_0xc9cad3[_0x4ce3('0x51')]=_['intersection'](_0x4a471a[_0x4ce3('0x4a')],qs[_0x4ce3('0x63')](_0x2df314[_0x4ce3('0x4e')]['fields']));_0xc9cad3['attributes']=_0xc9cad3['attributes'][_0x4ce3('0x52')]?_0xc9cad3['attributes']:_0x4a471a['model'];if(!_0x2df314[_0x4ce3('0x4e')][_0x4ce3('0x53')](_0x4ce3('0x54'))){_0xc9cad3[_0x4ce3('0x34')]=qs['limit'](_0x2df314[_0x4ce3('0x4e')][_0x4ce3('0x34')]);_0xc9cad3[_0x4ce3('0x33')]=qs[_0x4ce3('0x33')](_0x2df314[_0x4ce3('0x4e')][_0x4ce3('0x33')]);}_0xc9cad3['order']=qs['sort'](_0x2df314[_0x4ce3('0x4e')][_0x4ce3('0x55')]);_0xc9cad3['where']=qs[_0x4ce3('0x4f')](_[_0x4ce3('0xc1')](_0x2df314[_0x4ce3('0x4e')],_0x4a471a[_0x4ce3('0x4f')]));_0xc9cad3[_0x4ce3('0x56')][_0x4ce3('0xcf')]=_0x3762b8['id'];if(_0x2df314[_0x4ce3('0x4e')]['filter']){_0xc9cad3[_0x4ce3('0x56')]=_[_0x4ce3('0x57')](_0xc9cad3[_0x4ce3('0x56')],{'$or':_[_0x4ce3('0x46')](_0xc9cad3[_0x4ce3('0x51')],function(_0x24f03a){var _0x52a1e3={};_0x52a1e3[_0x24f03a]={'$like':'%'+_0x2df314['query']['filter']+'%'};return _0x52a1e3;})});}_0xc9cad3=_['merge']({},_0xc9cad3,_0x2df314[_0x4ce3('0x5b')]);return db[_0x4ce3('0xd1')][_0x4ce3('0x5c')]({'where':_0xc9cad3[_0x4ce3('0x56')]})['then'](function(_0x38bf48){_0xed486b[_0x4ce3('0x5c')]=_0x38bf48;if(_0x2df314[_0x4ce3('0x4e')][_0x4ce3('0x5d')]){_0xc9cad3[_0x4ce3('0x5e')]=[{'all':!![]}];}return db[_0x4ce3('0xd1')][_0x4ce3('0x5f')](_0xc9cad3);})[_0x4ce3('0x25')](function(_0x148827){_0xed486b['rows']=_0x148827;return _0xed486b;});}})[_0x4ce3('0x25')](respondWithFilteredResult(_0x4cedb1,_0xc9cad3))[_0x4ce3('0x2e')](handleError(_0x4cedb1,null));};exports[_0x4ce3('0xd2')]=function(_0x511252,_0xdddc32,_0x2fc23c){var _0x241ea3={};var _0x30112c={};var _0x49374d;var _0x1cf5fa;return db['User'][_0x4ce3('0xbf')]({'where':{'id':_0x511252[_0x4ce3('0x61')]['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0xdddc32,null))[_0x4ce3('0x25')](function(_0x821e2){if(_0x821e2){_0x49374d=_0x821e2;_0x30112c[_0x4ce3('0x4a')]=_[_0x4ce3('0x4d')](db[_0x4ce3('0xd3')][_0x4ce3('0x48')]);_0x30112c[_0x4ce3('0x4e')]=_[_0x4ce3('0x4d')](_0x511252[_0x4ce3('0x4e')]);_0x30112c[_0x4ce3('0x4f')]=_[_0x4ce3('0x50')](_0x30112c[_0x4ce3('0x4a')],_0x30112c[_0x4ce3('0x4e')]);_0x241ea3[_0x4ce3('0x51')]=_[_0x4ce3('0x50')](_0x30112c[_0x4ce3('0x4a')],qs['fields'](_0x511252[_0x4ce3('0x4e')][_0x4ce3('0x63')]));_0x241ea3[_0x4ce3('0x51')]=_0x241ea3[_0x4ce3('0x51')][_0x4ce3('0x52')]?_0x241ea3[_0x4ce3('0x51')]:_0x30112c['model'];_0x241ea3[_0x4ce3('0xc0')]=qs['sort'](_0x511252[_0x4ce3('0x4e')][_0x4ce3('0x55')]);_0x241ea3[_0x4ce3('0x56')]=qs[_0x4ce3('0x4f')](_[_0x4ce3('0xc1')](_0x511252[_0x4ce3('0x4e')],_0x30112c[_0x4ce3('0x4f')]));if(_0x511252[_0x4ce3('0x4e')][_0x4ce3('0x3d')]){_0x241ea3['where']=_['merge'](_0x241ea3['where'],{'$or':_[_0x4ce3('0x46')](_0x241ea3[_0x4ce3('0x51')],function(_0x22c091){var _0x23cae6={};_0x23cae6[_0x22c091]={'$like':'%'+_0x511252[_0x4ce3('0x4e')]['filter']+'%'};return _0x23cae6;})});}_0x241ea3=_[_0x4ce3('0x57')]({},_0x241ea3,_0x511252['options']);return _0x49374d[_0x4ce3('0xd2')](_0x241ea3);}})[_0x4ce3('0x25')](function(_0x11fc86){if(_0x11fc86){_0x1cf5fa=_0x11fc86[_0x4ce3('0x52')];if(!_0x511252[_0x4ce3('0x4e')]['hasOwnProperty']('nolimit')){_0x241ea3[_0x4ce3('0x34')]=qs[_0x4ce3('0x34')](_0x511252['query']['limit']);_0x241ea3[_0x4ce3('0x33')]=qs[_0x4ce3('0x33')](_0x511252[_0x4ce3('0x4e')][_0x4ce3('0x33')]);}return _0x49374d[_0x4ce3('0xd2')](_0x241ea3);}})[_0x4ce3('0x25')](function(_0x121c8e){if(_0x121c8e){return _0x121c8e?{'count':_0x1cf5fa,'rows':_0x121c8e}:null;}})[_0x4ce3('0x25')](respondWithResult(_0xdddc32,null))[_0x4ce3('0x2e')](handleError(_0xdddc32,null));};exports[_0x4ce3('0xd4')]=function(_0x49ada8,_0x9c7533,_0x56297d){var _0xf9b842={};var _0x2498b6={};var _0x3896c3;var _0x292437;return db[_0x4ce3('0x47')][_0x4ce3('0xbf')]({'where':{'id':_0x49ada8[_0x4ce3('0x61')]['id']}})['then'](handleEntityNotFound(_0x9c7533,null))[_0x4ce3('0x25')](function(_0x170b46){if(_0x170b46){_0x3896c3=_0x170b46;_0x2498b6[_0x4ce3('0x4a')]=_[_0x4ce3('0x4d')](db['OpenchannelInteraction'][_0x4ce3('0x48')]);_0x2498b6[_0x4ce3('0x4e')]=_['keys'](_0x49ada8[_0x4ce3('0x4e')]);_0x2498b6[_0x4ce3('0x4f')]=_[_0x4ce3('0x50')](_0x2498b6[_0x4ce3('0x4a')],_0x2498b6['query']);_0xf9b842['attributes']=_[_0x4ce3('0x50')](_0x2498b6['model'],qs[_0x4ce3('0x63')](_0x49ada8['query'][_0x4ce3('0x63')]));_0xf9b842['attributes']=_0xf9b842['attributes']['length']?_0xf9b842['attributes']:_0x2498b6[_0x4ce3('0x4a')];_0xf9b842[_0x4ce3('0xc0')]=qs[_0x4ce3('0x55')](_0x49ada8[_0x4ce3('0x4e')][_0x4ce3('0x55')]);_0xf9b842['where']=qs[_0x4ce3('0x4f')](_[_0x4ce3('0xc1')](_0x49ada8[_0x4ce3('0x4e')],_0x2498b6[_0x4ce3('0x4f')]));if(_0x49ada8[_0x4ce3('0x4e')][_0x4ce3('0x3d')]){_0xf9b842[_0x4ce3('0x56')]=_[_0x4ce3('0x57')](_0xf9b842[_0x4ce3('0x56')],{'$or':_[_0x4ce3('0x46')](_0xf9b842[_0x4ce3('0x51')],function(_0x1e7a5e){var _0x5dfd1d={};_0x5dfd1d[_0x1e7a5e]={'$like':'%'+_0x49ada8[_0x4ce3('0x4e')][_0x4ce3('0x3d')]+'%'};return _0x5dfd1d;})});}_0xf9b842=_[_0x4ce3('0x57')]({},_0xf9b842,_0x49ada8[_0x4ce3('0x5b')]);return _0x3896c3[_0x4ce3('0xd4')](_0xf9b842);}})[_0x4ce3('0x25')](function(_0x1541f7){if(_0x1541f7){_0x292437=_0x1541f7[_0x4ce3('0x52')];if(!_0x49ada8[_0x4ce3('0x4e')]['hasOwnProperty']('nolimit')){_0xf9b842['limit']=qs['limit'](_0x49ada8[_0x4ce3('0x4e')]['limit']);_0xf9b842[_0x4ce3('0x33')]=qs[_0x4ce3('0x33')](_0x49ada8[_0x4ce3('0x4e')][_0x4ce3('0x33')]);}return _0x3896c3['getOpenchannelInteractions'](_0xf9b842);}})['then'](function(_0x5f0c7b){if(_0x5f0c7b){return _0x5f0c7b?{'count':_0x292437,'rows':_0x5f0c7b}:null;}})[_0x4ce3('0x25')](respondWithResult(_0x9c7533,null))[_0x4ce3('0x2e')](handleError(_0x9c7533,null));};exports[_0x4ce3('0xd5')]=function(_0x52c651,_0x5aa1ce,_0x3eb469){var _0xf9dda6={'raw':!![],'where':{}};var _0xbe429a={};var _0x4e6cd7={'count':0x0,'rows':[]};return db[_0x4ce3('0x47')][_0x4ce3('0xbf')]({'where':{'id':_0x52c651[_0x4ce3('0x61')]['id']}})['then'](handleEntityNotFound(_0x5aa1ce,null))[_0x4ce3('0x25')](function(_0x2b88f0){if(_0x2b88f0){_0xbe429a[_0x4ce3('0x4a')]=_[_0x4ce3('0x4d')](db['MailInteraction'][_0x4ce3('0x48')]);_0xbe429a[_0x4ce3('0x4e')]=_[_0x4ce3('0x4d')](_0x52c651[_0x4ce3('0x4e')]);_0xbe429a[_0x4ce3('0x4f')]=_[_0x4ce3('0x50')](_0xbe429a[_0x4ce3('0x4a')],_0xbe429a[_0x4ce3('0x4e')]);_0xf9dda6['attributes']=_[_0x4ce3('0x50')](_0xbe429a[_0x4ce3('0x4a')],qs[_0x4ce3('0x63')](_0x52c651[_0x4ce3('0x4e')][_0x4ce3('0x63')]));_0xf9dda6[_0x4ce3('0x51')]=_0xf9dda6['attributes'][_0x4ce3('0x52')]?_0xf9dda6[_0x4ce3('0x51')]:_0xbe429a[_0x4ce3('0x4a')];if(!_0x52c651['query']['hasOwnProperty']('nolimit')){_0xf9dda6[_0x4ce3('0x34')]=qs['limit'](_0x52c651[_0x4ce3('0x4e')]['limit']);_0xf9dda6[_0x4ce3('0x33')]=qs[_0x4ce3('0x33')](_0x52c651[_0x4ce3('0x4e')][_0x4ce3('0x33')]);}_0xf9dda6['order']=qs[_0x4ce3('0x55')](_0x52c651[_0x4ce3('0x4e')][_0x4ce3('0x55')]);_0xf9dda6['where']=qs[_0x4ce3('0x4f')](_[_0x4ce3('0xc1')](_0x52c651[_0x4ce3('0x4e')],_0xbe429a[_0x4ce3('0x4f')]));_0xf9dda6[_0x4ce3('0x56')][_0x4ce3('0xcf')]=_0x2b88f0['id'];if(_0x52c651['query'][_0x4ce3('0x3d')]){_0xf9dda6[_0x4ce3('0x56')]=_[_0x4ce3('0x57')](_0xf9dda6[_0x4ce3('0x56')],{'$or':_[_0x4ce3('0x46')](_0xf9dda6[_0x4ce3('0x51')],function(_0x14c739){var _0x3cf782={};_0x3cf782[_0x14c739]={'$like':'%'+_0x52c651[_0x4ce3('0x4e')][_0x4ce3('0x3d')]+'%'};return _0x3cf782;})});}_0xf9dda6=_[_0x4ce3('0x57')]({},_0xf9dda6,_0x52c651['options']);return db['MailInteraction'][_0x4ce3('0x5c')]({'where':_0xf9dda6[_0x4ce3('0x56')]})[_0x4ce3('0x25')](function(_0x5607c6){_0x4e6cd7[_0x4ce3('0x5c')]=_0x5607c6;if(_0x52c651[_0x4ce3('0x4e')][_0x4ce3('0x5d')]){_0xf9dda6[_0x4ce3('0x5e')]=[{'all':!![]}];}return db[_0x4ce3('0xd6')][_0x4ce3('0x5f')](_0xf9dda6);})['then'](function(_0x1a8255){_0x4e6cd7[_0x4ce3('0x60')]=_0x1a8255;return _0x4e6cd7;});}})[_0x4ce3('0x25')](respondWithFilteredResult(_0x5aa1ce,_0xf9dda6))['catch'](handleError(_0x5aa1ce,null));};exports['getSmsInteractions']=function(_0x5a1b38,_0x7c23b3,_0x119eb2){var _0x526661={};var _0x96fbe8={};var _0x36740d;var _0x58b8c5;return db[_0x4ce3('0x47')][_0x4ce3('0xbf')]({'where':{'id':_0x5a1b38[_0x4ce3('0x61')]['id']}})['then'](handleEntityNotFound(_0x7c23b3,null))[_0x4ce3('0x25')](function(_0x5132fb){if(_0x5132fb){_0x36740d=_0x5132fb;_0x96fbe8[_0x4ce3('0x4a')]=_[_0x4ce3('0x4d')](db['SmsInteraction']['rawAttributes']);_0x96fbe8[_0x4ce3('0x4e')]=_[_0x4ce3('0x4d')](_0x5a1b38['query']);_0x96fbe8['filters']=_[_0x4ce3('0x50')](_0x96fbe8[_0x4ce3('0x4a')],_0x96fbe8['query']);_0x526661[_0x4ce3('0x51')]=_['intersection'](_0x96fbe8[_0x4ce3('0x4a')],qs['fields'](_0x5a1b38['query']['fields']));_0x526661[_0x4ce3('0x51')]=_0x526661[_0x4ce3('0x51')][_0x4ce3('0x52')]?_0x526661[_0x4ce3('0x51')]:_0x96fbe8[_0x4ce3('0x4a')];_0x526661['order']=qs[_0x4ce3('0x55')](_0x5a1b38[_0x4ce3('0x4e')]['sort']);_0x526661[_0x4ce3('0x56')]=qs[_0x4ce3('0x4f')](_[_0x4ce3('0xc1')](_0x5a1b38[_0x4ce3('0x4e')],_0x96fbe8[_0x4ce3('0x4f')]));if(_0x5a1b38[_0x4ce3('0x4e')][_0x4ce3('0x3d')]){_0x526661[_0x4ce3('0x56')]=_['merge'](_0x526661[_0x4ce3('0x56')],{'$or':_[_0x4ce3('0x46')](_0x526661[_0x4ce3('0x51')],function(_0x11ec76){var _0x2fd76c={};_0x2fd76c[_0x11ec76]={'$like':'%'+_0x5a1b38[_0x4ce3('0x4e')][_0x4ce3('0x3d')]+'%'};return _0x2fd76c;})});}_0x526661=_[_0x4ce3('0x57')]({},_0x526661,_0x5a1b38['options']);return _0x36740d['getSmsInteractions'](_0x526661);}})['then'](function(_0x5239f2){if(_0x5239f2){_0x58b8c5=_0x5239f2[_0x4ce3('0x52')];if(!_0x5a1b38[_0x4ce3('0x4e')][_0x4ce3('0x53')]('nolimit')){_0x526661[_0x4ce3('0x34')]=qs[_0x4ce3('0x34')](_0x5a1b38[_0x4ce3('0x4e')][_0x4ce3('0x34')]);_0x526661[_0x4ce3('0x33')]=qs[_0x4ce3('0x33')](_0x5a1b38['query']['offset']);}return _0x36740d[_0x4ce3('0xd7')](_0x526661);}})[_0x4ce3('0x25')](function(_0x3971d7){if(_0x3971d7){return _0x3971d7?{'count':_0x58b8c5,'rows':_0x3971d7}:null;}})[_0x4ce3('0x25')](respondWithResult(_0x7c23b3,null))[_0x4ce3('0x2e')](handleError(_0x7c23b3,null));};exports[_0x4ce3('0xd8')]=function(_0x5601cb,_0x1a642f,_0x4725fe){var _0x2141a3={};var _0x4b8a62={};var _0x39bb5c;var _0x9c5852;return db['User']['findOne']({'where':{'id':_0x5601cb[_0x4ce3('0x61')]['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0x1a642f,null))[_0x4ce3('0x25')](function(_0x562bed){if(_0x562bed){_0x39bb5c=_0x562bed;_0x4b8a62[_0x4ce3('0x4a')]=_['keys'](db[_0x4ce3('0xd9')][_0x4ce3('0x48')]);_0x4b8a62[_0x4ce3('0x4e')]=_[_0x4ce3('0x4d')](_0x5601cb[_0x4ce3('0x4e')]);_0x4b8a62[_0x4ce3('0x4f')]=_[_0x4ce3('0x50')](_0x4b8a62['model'],_0x4b8a62['query']);_0x2141a3['attributes']=_[_0x4ce3('0x50')](_0x4b8a62[_0x4ce3('0x4a')],qs[_0x4ce3('0x63')](_0x5601cb[_0x4ce3('0x4e')][_0x4ce3('0x63')]));_0x2141a3[_0x4ce3('0x51')]=_0x2141a3[_0x4ce3('0x51')][_0x4ce3('0x52')]?_0x2141a3[_0x4ce3('0x51')]:_0x4b8a62[_0x4ce3('0x4a')];_0x2141a3['order']=qs[_0x4ce3('0x55')](_0x5601cb[_0x4ce3('0x4e')][_0x4ce3('0x55')]);_0x2141a3[_0x4ce3('0x56')]=qs[_0x4ce3('0x4f')](_['pick'](_0x5601cb[_0x4ce3('0x4e')],_0x4b8a62[_0x4ce3('0x4f')]));if(_0x5601cb[_0x4ce3('0x4e')]['filter']){_0x2141a3[_0x4ce3('0x56')]=_[_0x4ce3('0x57')](_0x2141a3[_0x4ce3('0x56')],{'$or':_[_0x4ce3('0x46')](_0x2141a3[_0x4ce3('0x51')],function(_0x12e690){var _0x403bda={};_0x403bda[_0x12e690]={'$like':'%'+_0x5601cb['query'][_0x4ce3('0x3d')]+'%'};return _0x403bda;})});}_0x2141a3=_['merge']({},_0x2141a3,_0x5601cb[_0x4ce3('0x5b')]);return _0x39bb5c[_0x4ce3('0xd8')](_0x2141a3);}})[_0x4ce3('0x25')](function(_0x193970){if(_0x193970){_0x9c5852=_0x193970[_0x4ce3('0x52')];if(!_0x5601cb[_0x4ce3('0x4e')][_0x4ce3('0x53')](_0x4ce3('0x54'))){_0x2141a3[_0x4ce3('0x34')]=qs[_0x4ce3('0x34')](_0x5601cb[_0x4ce3('0x4e')][_0x4ce3('0x34')]);_0x2141a3[_0x4ce3('0x33')]=qs[_0x4ce3('0x33')](_0x5601cb[_0x4ce3('0x4e')][_0x4ce3('0x33')]);}return _0x39bb5c[_0x4ce3('0xd8')](_0x2141a3);}})[_0x4ce3('0x25')](function(_0x4bd8db){if(_0x4bd8db){return _0x4bd8db?{'count':_0x9c5852,'rows':_0x4bd8db}:null;}})[_0x4ce3('0x25')](respondWithResult(_0x1a642f,null))[_0x4ce3('0x2e')](handleError(_0x1a642f,null));};exports['getWhatsappInteractions']=function(_0x13cb66,_0x3ed45e,_0xac16ea){var _0x14af42={};var _0x27b7fc={};var _0x28a4fb;var _0x2b41ce;return db['User'][_0x4ce3('0xbf')]({'where':{'id':_0x13cb66['params']['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0x3ed45e,null))[_0x4ce3('0x25')](function(_0x23da92){if(_0x23da92){_0x28a4fb=_0x23da92;_0x27b7fc[_0x4ce3('0x4a')]=_['keys'](db[_0x4ce3('0xda')][_0x4ce3('0x48')]);_0x27b7fc[_0x4ce3('0x4e')]=_[_0x4ce3('0x4d')](_0x13cb66[_0x4ce3('0x4e')]);_0x27b7fc[_0x4ce3('0x4f')]=_[_0x4ce3('0x50')](_0x27b7fc[_0x4ce3('0x4a')],_0x27b7fc[_0x4ce3('0x4e')]);_0x14af42[_0x4ce3('0x51')]=_[_0x4ce3('0x50')](_0x27b7fc[_0x4ce3('0x4a')],qs[_0x4ce3('0x63')](_0x13cb66[_0x4ce3('0x4e')][_0x4ce3('0x63')]));_0x14af42['attributes']=_0x14af42[_0x4ce3('0x51')]['length']?_0x14af42[_0x4ce3('0x51')]:_0x27b7fc[_0x4ce3('0x4a')];_0x14af42[_0x4ce3('0xc0')]=qs['sort'](_0x13cb66[_0x4ce3('0x4e')][_0x4ce3('0x55')]);_0x14af42['where']=qs[_0x4ce3('0x4f')](_[_0x4ce3('0xc1')](_0x13cb66[_0x4ce3('0x4e')],_0x27b7fc['filters']));if(_0x13cb66[_0x4ce3('0x4e')][_0x4ce3('0x3d')]){_0x14af42[_0x4ce3('0x56')]=_['merge'](_0x14af42['where'],{'$or':_[_0x4ce3('0x46')](_0x14af42[_0x4ce3('0x51')],function(_0x575196){var _0xafcb5e={};_0xafcb5e[_0x575196]={'$like':'%'+_0x13cb66[_0x4ce3('0x4e')][_0x4ce3('0x3d')]+'%'};return _0xafcb5e;})});}_0x14af42=_[_0x4ce3('0x57')]({},_0x14af42,_0x13cb66[_0x4ce3('0x5b')]);return _0x28a4fb['getWhatsappInteractions'](_0x14af42);}})[_0x4ce3('0x25')](function(_0x2dc504){if(_0x2dc504){_0x2b41ce=_0x2dc504[_0x4ce3('0x52')];if(!_0x13cb66[_0x4ce3('0x4e')]['hasOwnProperty'](_0x4ce3('0x54'))){_0x14af42['limit']=qs[_0x4ce3('0x34')](_0x13cb66[_0x4ce3('0x4e')]['limit']);_0x14af42[_0x4ce3('0x33')]=qs['offset'](_0x13cb66['query'][_0x4ce3('0x33')]);}return _0x28a4fb['getWhatsappInteractions'](_0x14af42);}})[_0x4ce3('0x25')](function(_0x3e92e8){if(_0x3e92e8){return _0x3e92e8?{'count':_0x2b41ce,'rows':_0x3e92e8}:null;}})[_0x4ce3('0x25')](respondWithResult(_0x3ed45e,null))['catch'](handleError(_0x3ed45e,null));};exports[_0x4ce3('0xdb')]=function(_0xb563df,_0x17aaee,_0x59c28e){var _0x3d345d;var _0x1125ab;var _0x36bbf1;var _0x44080c=!_['isNil'](_0xb563df[_0x4ce3('0x61')]['id'])?_0xb563df['params']['id']:!_[_0x4ce3('0x6e')](_0xb563df[_0x4ce3('0x3a')]['id'])?_0xb563df[_0x4ce3('0x3a')]['id']:null;return db[_0x4ce3('0x47')][_0x4ce3('0x40')]({'where':{'id':_0x44080c,'role':{'$or':['admin',_0x4ce3('0x3a'),'agent']}},'attributes':['id','name','phone','mobile',_0x4ce3('0x41'),'internal',_0x4ce3('0x9c')]})[_0x4ce3('0x25')](function(_0x160da5){if(_0x160da5){if(_0x160da5[_0x4ce3('0x41')]===_0x4ce3('0x3b')){_0x3d345d=_0x160da5;if(_0xb563df['body'][_0x4ce3('0x9e')]){_0x36bbf1=util[_0x4ce3('0xab')]('LOCAL/%s@from-sip/n',_0x3d345d[_0xb563df[_0x4ce3('0x65')][_0x4ce3('0x9e')]]);}else if(_0xb563df[_0x4ce3('0x65')]['intrf']){_0x36bbf1=util[_0x4ce3('0xab')](_0x4ce3('0xac'),_0xb563df['body'][_0x4ce3('0xdc')]);}else{_0x36bbf1=util[_0x4ce3('0xab')](_0x4ce3('0xac'),_0x3d345d['name']);}socket['to'](util[_0x4ce3('0xab')](_0x4ce3('0xdd'),_0x3d345d[_0x4ce3('0x43')]))[_0x4ce3('0xa7')](_0x4ce3('0xde'),{'ip':_0xb563df[_0x4ce3('0xdf')][_0x4ce3('0xe0')]||_0xb563df['connection'][_0x4ce3('0xe1')]||_0xb563df[_0x4ce3('0xe2')][_0x4ce3('0xe1')]||_0xb563df[_0x4ce3('0xe3')][_0x4ce3('0xe2')]['remoteAddress']});return db['UserVoiceQueueRt'][_0x4ce3('0x38')]({'where':{'membername':_0x3d345d[_0x4ce3('0x43')]},'individualHooks':!![]});}}else{throw new db[(_0x4ce3('0x92'))]['ValidationError'](_0x4ce3('0xe4'));}})[_0x4ce3('0x25')](function(){if(_0x3d345d){return _0x3d345d[_0x4ce3('0xe5')]({'raw':!![]});}})['then'](function(_0x4e2f07){if(_0x3d345d){var _0x183dc8=[];if(_0x4e2f07){_0x1125ab=_0x4e2f07;if(_0x1125ab[_0x4ce3('0x52')]){for(var _0x2debf7=0x0;_0x2debf7<_0x1125ab['length'];_0x2debf7++){_0x183dc8['push']({'membername':_0x3d345d[_0x4ce3('0x43')],'UserId':_0x3d345d['id'],'queue_name':_0x1125ab[_0x2debf7][_0x4ce3('0x43')],'VoiceQueueId':_0x1125ab[_0x2debf7]['id'],'interface':_0x36bbf1,'paused':_0x3d345d[_0x4ce3('0x9c')]||![],'penalty':_0x1125ab[_0x2debf7][_0x4ce3('0xe6')]||0x0});}return BPromise['each'](_0x183dc8,function(_0x11268e){return db[_0x4ce3('0xae')][_0x4ce3('0xaf')](_0x11268e);});}}}})[_0x4ce3('0x25')](function(){if(_0x3d345d){return db[_0x4ce3('0xe7')][_0x4ce3('0x5f')]({'where':{'membername':_0x3d345d[_0x4ce3('0x43')],'exitAt':null}});}})[_0x4ce3('0x25')](function(_0x340ba8){if(_0x3d345d){var _0x2fab51=[];_0x340ba8[_0x4ce3('0xe8')](function(_0x597d60){_0x2fab51[_0x4ce3('0xe9')](_0x597d60[_0x4ce3('0x37')]({'exitAt':moment()[_0x4ce3('0xab')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x4ce3('0xea')](_0x2fab51);}})['then'](function(){if(_0x3d345d){var _0x2a8467=[];var _0x18e71c=[];var _0x4425bb=utils[_0x4ce3('0xeb')]();var _0x54274a={'membername':_0x3d345d[_0x4ce3('0x43')],'interface':_0x36bbf1,'enterAt':moment()[_0x4ce3('0xab')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x3d345d[_0x4ce3('0x41')],'internal':_0x3d345d['internal']};_0x4425bb[_0x4ce3('0xe8')](function(_0x4d8e9b){_0x2a8467[_0x4ce3('0xe9')](_[_0x4ce3('0x57')]({'channel':_0x4d8e9b,'type':_0x4ce3('0xec'),'data1':_0xb563df['body'][_0x4ce3('0xed')],'data2':_0x36bbf1},_0x54274a));if(_0x3d345d[_0x4ce3('0x9c')]){_0x18e71c[_0x4ce3('0xe9')](_[_0x4ce3('0x57')]({'channel':_0x4d8e9b,'type':_0x4ce3('0xee'),'data1':_0x4ce3('0xef')},_0x54274a));}});return db[_0x4ce3('0xe7')][_0x4ce3('0x64')](_0x2a8467[_0x4ce3('0xf0')](_0x18e71c),{'individualHooks':!![]});}})[_0x4ce3('0x25')](function(){if(_0x3d345d){return _0x3d345d[_0x4ce3('0x37')]({'online':!![],'lastLoginAt':moment()[_0x4ce3('0xab')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3d345d[_0x4ce3('0x9c')]||![],'mailPause':_0x3d345d[_0x4ce3('0x9c')]||![],'chatPause':_0x3d345d[_0x4ce3('0x9c')]||![],'faxPause':_0x3d345d['loginInPause']||![],'smsPause':_0x3d345d[_0x4ce3('0x9c')]||![],'openchannelPause':_0x3d345d[_0x4ce3('0x9c')]||![],'whatsappPause':_0x3d345d[_0x4ce3('0x9c')]||![],'pauseType':_0x3d345d[_0x4ce3('0x9c')]?_0x4ce3('0xef'):null,'interface':_0x36bbf1,'lastPauseAt':moment()[_0x4ce3('0xab')](_0x4ce3('0xf1'))});}})[_0x4ce3('0x25')](function(_0x2dbca9){if(_0xb563df['isMiddleware']){return _0x59c28e();}else{return BPromise[_0x4ce3('0xf2')](_0x2dbca9)[_0x4ce3('0x25')](respondWithResult(_0x17aaee,null));}})[_0x4ce3('0x2e')](handleError(_0x17aaee,null));};exports['logout']=function(_0x525aa7,_0x160505,_0x48019a){var _0x32c807;return db[_0x4ce3('0x47')]['find']({'where':{'id':_0x525aa7[_0x4ce3('0x61')]['id'],'role':_0x4ce3('0x3b')},'attributes':['id',_0x4ce3('0x43'),_0x4ce3('0x41')]})[_0x4ce3('0x25')](handleEntityNotFound(_0x160505,null))['then'](function(_0x116fbb){if(_0x116fbb){_0x32c807=_0x116fbb;return db['UserVoiceQueueRt'][_0x4ce3('0x38')]({'where':{'membername':_0x32c807[_0x4ce3('0x43')]},'individualHooks':!![]});}})['then'](function(){return db[_0x4ce3('0xe7')][_0x4ce3('0x5f')]({'where':{'membername':_0x32c807[_0x4ce3('0x43')],'exitAt':null}});})[_0x4ce3('0x25')](function(_0x393bff){var _0x35ca66=[];_0x393bff[_0x4ce3('0xe8')](function(_0x27426e){_0x35ca66[_0x4ce3('0xe9')](_0x27426e[_0x4ce3('0x37')]({'exitAt':moment()[_0x4ce3('0xab')](_0x4ce3('0xf1'))}));});return BPromise['all'](_0x35ca66);})[_0x4ce3('0x25')](function(){return _0x32c807['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x4ce3('0x25')](respondWithResult(_0x160505,null))[_0x4ce3('0x2e')](handleError(_0x160505,null));};exports[_0x4ce3('0xf3')]=function(_0x447fd5,_0x17df29,_0x11f9c6){var _0x775e;return db['UserVoiceQueueRt'][_0x4ce3('0x37')]({'paused':0x1},{'where':{'UserId':_0x447fd5[_0x4ce3('0x61')]['id']},'individualHooks':!![]})[_0x4ce3('0x25')](function(){return db[_0x4ce3('0x47')]['find']({'where':{'id':_0x447fd5[_0x4ce3('0x61')]['id'],'role':_0x4ce3('0x3b')},'attributes':['id',_0x4ce3('0x43'),_0x4ce3('0x41'),_0x4ce3('0x71'),'interface']});})['then'](handleEntityNotFound(_0x17df29,null))['then'](function(_0x45eb19){if(_0x45eb19){_0x775e=_0x45eb19;return respondWithRpcPromise(_0x4ce3('0xf4'),_0x4ce3('0xf3'),{'id':_0x775e['id'],'name':_0x775e[_0x4ce3('0x43')],'pause':!![]});}})[_0x4ce3('0x25')](function(){if(_0x775e){return db[_0x4ce3('0xe7')][_0x4ce3('0x5f')]({'where':{'membername':_0x775e[_0x4ce3('0x43')],'type':'PAUSE','exitAt':null}});}})[_0x4ce3('0x25')](function(_0x255d5b){if(_0x255d5b['length']){var _0x3ce017=moment()[_0x4ce3('0xab')](_0x4ce3('0xf1'));for(var _0x267005=0x0,_0x18b2bb=_0x255d5b[_0x4ce3('0x52')];_0x267005<_0x18b2bb;_0x267005++){_0x255d5b[_0x267005][_0x4ce3('0xf5')]({'exitAt':_0x3ce017});}}})[_0x4ce3('0x25')](function(){var _0x4c07b8=[];var _0x29fd27=utils[_0x4ce3('0xeb')]();_0x29fd27[_0x4ce3('0xe8')](function(_0x458301){_0x4c07b8[_0x4ce3('0xe9')]({'channel':_0x458301,'membername':_0x775e[_0x4ce3('0x43')],'interface':_['isNil'](_0x775e[_0x4ce3('0x9e')])?util[_0x4ce3('0xab')](_0x4ce3('0xac'),_0x775e[_0x4ce3('0x43')]):_0x775e['interface'],'type':_0x4ce3('0xee'),'enterAt':moment()[_0x4ce3('0xab')](_0x4ce3('0xf1')),'data1':_0x447fd5[_0x4ce3('0x65')][_0x4ce3('0x49')]||_0x4ce3('0xf6'),'role':_0x775e['role'],'internal':_0x775e[_0x4ce3('0x71')]});});return db[_0x4ce3('0xe7')][_0x4ce3('0x64')](_0x4c07b8,{'individualHooks':!![]});})[_0x4ce3('0x25')](function(){return _0x775e['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x447fd5['body'][_0x4ce3('0x49')]||_0x4ce3('0xf6'),'lastPauseAt':moment()['format'](_0x4ce3('0xf1'))});})[_0x4ce3('0x25')](respondWithResult(_0x17df29,null))[_0x4ce3('0x2e')](handleError(_0x17df29,null));};exports['unpause']=function(_0x1e8400,_0x5ecf6a,_0x24e55d){var _0x30b5cd;return db[_0x4ce3('0x47')][_0x4ce3('0x40')]({'where':{'id':_0x1e8400[_0x4ce3('0x61')]['id']},'attributes':['id',_0x4ce3('0x43'),_0x4ce3('0x41'),'voicePause',_0x4ce3('0xf7'),_0x4ce3('0xf8'),_0x4ce3('0xf9'),_0x4ce3('0xfa'),_0x4ce3('0xfb'),_0x4ce3('0xfc'),_0x4ce3('0xfd'),_0x4ce3('0xfe')]})[_0x4ce3('0x25')](handleEntityNotFound(_0x5ecf6a,null))[_0x4ce3('0x25')](function(_0x1cd21a){if(_0x1cd21a){_0x30b5cd=_0x1cd21a;if(_0x1e8400[_0x4ce3('0x65')][_0x4ce3('0x9a')]&&!utils[_0x4ce3('0xb0')](_0x1e8400[_0x4ce3('0x65')][_0x4ce3('0x9a')])){throw new db[(_0x4ce3('0x92'))][(_0x4ce3('0x23'))](_0x4ce3('0x9f'));}switch(_0x1e8400[_0x4ce3('0x65')]['channel']){case _0x4ce3('0xa9'):return respondWithRpcPromise(_0x4ce3('0xf4'),_0x4ce3('0xff'),{'id':_0x30b5cd['id'],'name':_0x30b5cd[_0x4ce3('0x43')],'pause':![]})['then'](function(){return db[_0x4ce3('0xae')]['update']({'paused':0x0},{'where':{'UserId':_0x30b5cd['id']},'individualHooks':!![]});})[_0x4ce3('0x25')](function(){return db[_0x4ce3('0xe7')][_0x4ce3('0x40')]({'where':{'channel':_0x1e8400[_0x4ce3('0x65')][_0x4ce3('0x9a')],'membername':_0x30b5cd[_0x4ce3('0x43')],'type':'PAUSE','exitAt':null}});})['then'](function(_0x3f3c54){if(_0x3f3c54){return _0x3f3c54['update']({'exitAt':moment()[_0x4ce3('0xab')](_0x4ce3('0xf1')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x4ce3('0x25')](function(){return _0x30b5cd['update']({'voicePause':![]});});case'mail':case _0x4ce3('0x100'):case _0x4ce3('0x101'):case _0x4ce3('0x102'):case _0x4ce3('0x103'):case'openchannel':return db[_0x4ce3('0xe7')][_0x4ce3('0x40')]({'where':{'channel':_0x1e8400[_0x4ce3('0x65')][_0x4ce3('0x9a')],'membername':_0x30b5cd['name'],'type':'PAUSE','exitAt':null}})[_0x4ce3('0x25')](function(_0x42a70c){if(_0x42a70c){return _0x42a70c[_0x4ce3('0x37')]({'exitAt':moment()[_0x4ce3('0xab')](_0x4ce3('0xf1')),'data2':_0x4ce3('0x104')},{'individualHooks':!![]});}return null;})[_0x4ce3('0x25')](function(){var _0x3c2c02={};_['set'](_0x3c2c02,util['format']('%s%s',_0x1e8400[_0x4ce3('0x65')][_0x4ce3('0x9a')],_0x4ce3('0x105')),![]);return _0x30b5cd[_0x4ce3('0x37')](_0x3c2c02);});default:return respondWithRpcPromise('QueuePause',_0x4ce3('0xff'),{'id':_0x30b5cd['id'],'name':_0x30b5cd[_0x4ce3('0x43')],'pause':![]})[_0x4ce3('0x25')](function(){return db[_0x4ce3('0xae')][_0x4ce3('0x37')]({'paused':0x0},{'where':{'UserId':_0x30b5cd['id']}});})[_0x4ce3('0x25')](function(){return db[_0x4ce3('0xe7')][_0x4ce3('0x5f')]({'where':{'membername':_0x30b5cd['name'],'type':_0x4ce3('0xee'),'exitAt':null}});})[_0x4ce3('0x25')](function(_0x39bafb){var _0x44a971=[];_0x39bafb[_0x4ce3('0xe8')](function(_0x24097f){_0x44a971[_0x4ce3('0xe9')](_0x24097f[_0x4ce3('0x37')]({'exitAt':moment()['format'](_0x4ce3('0xf1')),'data2':'manual'}));});return BPromise[_0x4ce3('0xea')](_0x44a971);})[_0x4ce3('0x25')](function(){return _0x30b5cd[_0x4ce3('0x37')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x4ce3('0x25')](respondWithResult(_0x5ecf6a,null))[_0x4ce3('0x2e')](handleError(_0x5ecf6a,null));};exports[_0x4ce3('0x106')]=function(_0x4c758a,_0x563ad5,_0x12172a){var _0x1fc820={};var _0x481e81={};var _0x3ddb4f;var _0x39daff;return db[_0x4ce3('0x47')][_0x4ce3('0xbf')]({'where':{'id':_0x4c758a[_0x4ce3('0x61')]['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0x563ad5,null))[_0x4ce3('0x25')](function(_0x23741a){if(_0x23741a){_0x3ddb4f=_0x23741a;_0x481e81[_0x4ce3('0x4a')]=_[_0x4ce3('0x4d')](db['Team'][_0x4ce3('0x48')]);_0x481e81[_0x4ce3('0x4e')]=_[_0x4ce3('0x4d')](_0x4c758a[_0x4ce3('0x4e')]);_0x481e81[_0x4ce3('0x4f')]=_[_0x4ce3('0x50')](_0x481e81[_0x4ce3('0x4a')],_0x481e81[_0x4ce3('0x4e')]);_0x1fc820[_0x4ce3('0x51')]=_['intersection'](_0x481e81['model'],qs[_0x4ce3('0x63')](_0x4c758a['query'][_0x4ce3('0x63')]));_0x1fc820[_0x4ce3('0x51')]=_0x1fc820[_0x4ce3('0x51')][_0x4ce3('0x52')]?_0x1fc820[_0x4ce3('0x51')]:_0x481e81['model'];_0x1fc820[_0x4ce3('0xc0')]=qs[_0x4ce3('0x55')](_0x4c758a['query']['sort']);_0x1fc820[_0x4ce3('0x56')]=qs[_0x4ce3('0x4f')](_[_0x4ce3('0xc1')](_0x4c758a[_0x4ce3('0x4e')],_0x481e81[_0x4ce3('0x4f')]));if(_0x4c758a[_0x4ce3('0x4e')]['filter']){_0x1fc820['where']=_['merge'](_0x1fc820[_0x4ce3('0x56')],{'$or':_[_0x4ce3('0x46')](_0x1fc820[_0x4ce3('0x51')],function(_0x405195){var _0x5b9267={};_0x5b9267[_0x405195]={'$like':'%'+_0x4c758a[_0x4ce3('0x4e')]['filter']+'%'};return _0x5b9267;})});}_0x1fc820=_[_0x4ce3('0x57')]({},_0x1fc820,_0x4c758a[_0x4ce3('0x5b')]);return _0x3ddb4f[_0x4ce3('0x106')](_0x1fc820);}})[_0x4ce3('0x25')](function(_0x1eb9c4){if(_0x1eb9c4){_0x39daff=_0x1eb9c4[_0x4ce3('0x52')];if(!_0x4c758a['query'][_0x4ce3('0x53')](_0x4ce3('0x54'))){_0x1fc820[_0x4ce3('0x34')]=qs[_0x4ce3('0x34')](_0x4c758a['query'][_0x4ce3('0x34')]);_0x1fc820[_0x4ce3('0x33')]=qs[_0x4ce3('0x33')](_0x4c758a[_0x4ce3('0x4e')]['offset']);}return _0x3ddb4f[_0x4ce3('0x106')](_0x1fc820);}})['then'](function(_0x3528ea){if(_0x3528ea){return _0x3528ea?{'count':_0x39daff,'rows':_0x3528ea}:null;}})[_0x4ce3('0x25')](respondWithResult(_0x563ad5,null))[_0x4ce3('0x2e')](handleError(_0x563ad5,null));};exports['addTeams']=function(_0x5555e9,_0xf927ae){return db[_0x4ce3('0x47')]['find']({'where':{'id':_0x5555e9['params']['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0xf927ae,null))[_0x4ce3('0x25')](function(_0x47ddb8){if(_0x47ddb8){var _0x4ff134=_0x47ddb8[_0x4ce3('0x39')]({'plain':!![]});return _0x47ddb8['addTeams'](_0x5555e9['body'][_0x4ce3('0x68')],_[_0x4ce3('0x107')](_0x5555e9[_0x4ce3('0x65')],['ids','id'])||{})[_0x4ce3('0x25')](function(){for(var _0x5b02e7=0x0;_0x5b02e7<_0x5555e9['body']['ids'][_0x4ce3('0x52')];_0x5b02e7++){var _0x251d22=[];db[_0x4ce3('0x108')][_0x4ce3('0xbf')]({'where':{'id':_0x5555e9['body'][_0x4ce3('0x68')][_0x5b02e7]}})[_0x4ce3('0x25')](function(_0x2a5813){_0x251d22[_0x4ce3('0xe9')](_0x2a5813[_0x4ce3('0xe5')]()[_0x4ce3('0x25')](function(_0x2dbd0e){for(var _0x4d0bfc=0x0;_0x4d0bfc<_0x2dbd0e[_0x4ce3('0x52')];_0x4d0bfc++){_0x2dbd0e[_0x4d0bfc]['setDataValue'](_0x4ce3('0x9a'),_0x4ce3('0x109'));}return _0x2dbd0e;}));_0x251d22[_0x4ce3('0xe9')](_0x2a5813['getChatQueues']()['then'](function(_0x57955f){for(var _0x3a605b=0x0;_0x3a605b<_0x57955f[_0x4ce3('0x52')];_0x3a605b++){_0x57955f[_0x3a605b][_0x4ce3('0x10a')]('channel',_0x4ce3('0x10b'));}return _0x57955f;}));_0x251d22[_0x4ce3('0xe9')](_0x2a5813[_0x4ce3('0x10c')]()[_0x4ce3('0x25')](function(_0x490a66){for(var _0x3e3a00=0x0;_0x3e3a00<_0x490a66[_0x4ce3('0x52')];_0x3e3a00++){_0x490a66[_0x3e3a00][_0x4ce3('0x10a')](_0x4ce3('0x9a'),_0x4ce3('0x10d'));}return _0x490a66;}));_0x251d22[_0x4ce3('0xe9')](_0x2a5813['getSmsQueues']()[_0x4ce3('0x25')](function(_0x430052){for(var _0x386185=0x0;_0x386185<_0x430052[_0x4ce3('0x52')];_0x386185++){_0x430052[_0x386185][_0x4ce3('0x10a')](_0x4ce3('0x9a'),_0x4ce3('0x10e'));}return _0x430052;}));_0x251d22[_0x4ce3('0xe9')](_0x2a5813[_0x4ce3('0x10f')]()[_0x4ce3('0x25')](function(_0x214926){for(var _0x4da856=0x0;_0x4da856<_0x214926['length'];_0x4da856++){_0x214926[_0x4da856][_0x4ce3('0x10a')](_0x4ce3('0x9a'),_0x4ce3('0x110'));}return _0x214926;}));_0x251d22[_0x4ce3('0xe9')](_0x2a5813[_0x4ce3('0x111')]()[_0x4ce3('0x25')](function(_0x8ff8f){for(var _0x2636a1=0x0;_0x2636a1<_0x8ff8f[_0x4ce3('0x52')];_0x2636a1++){_0x8ff8f[_0x2636a1][_0x4ce3('0x10a')]('channel','Fax');}return _0x8ff8f;}));_0x251d22['push'](_0x2a5813[_0x4ce3('0x112')]()[_0x4ce3('0x25')](function(_0x471f5f){for(var _0x5ee699=0x0;_0x5ee699<_0x471f5f[_0x4ce3('0x52')];_0x5ee699++){_0x471f5f[_0x5ee699]['setDataValue'](_0x4ce3('0x9a'),_0x4ce3('0x113'));}return _0x471f5f;}));return BPromise['all'](_0x251d22);})[_0x4ce3('0x25')](function(_0x575868){var _0x4a8226=_[_0x4ce3('0x114')](_0x575868);_0x251d22=[];return db[_0x4ce3('0x59')]['transaction'](function(_0x2343d9){for(var _0x37b8ce=0x0;_0x37b8ce<_0x4a8226['length'];_0x37b8ce++){_0x251d22[_0x4ce3('0xe9')](_0x4a8226[_0x37b8ce]['addAgent'](_0x4ff134['id']),{'transaction':_0x2343d9});}return BPromise[_0x4ce3('0xea')](_0x251d22)['then'](function(){if(_0x4ff134[_0x4ce3('0x9b')]){return BPromise['each'](_['filter'](_0x4a8226,function(_0x51b3c4){return _0x51b3c4[_0x4ce3('0x115')](_0x4ce3('0x9a'))===_0x4ce3('0x109');}),function(_0x17675e){return db[_0x4ce3('0xae')]['upsert']({'membername':_0x4ff134[_0x4ce3('0x43')],'UserId':_0x4ff134['id'],'queue_name':_0x17675e[_0x4ce3('0x43')],'VoiceQueueId':_0x17675e['id'],'interface':_[_0x4ce3('0x6e')](_0x4ff134[_0x4ce3('0x9e')])?util[_0x4ce3('0xab')]('SIP/%s',_0x4ff134[_0x4ce3('0x43')]):_0x4ff134[_0x4ce3('0x9e')],'paused':_0x4ff134['voicePause']||![],'penalty':_0x4ff134['penalty']},{'transaction':_0x2343d9});});}else{return;}})[_0x4ce3('0x25')](function(){for(var _0x4fa871=0x0;_0x4fa871<_0x4a8226[_0x4ce3('0x52')];_0x4fa871++){var _0x2c5b18=_0x4a8226[_0x4fa871][_0x4ce3('0x115')]('channel');var _0x3a0402=_0x2c5b18+_0x4ce3('0xa6');socket['emit'](_0x4ce3('0x3a')+_0x2c5b18+_0x4ce3('0xa8'),{'UserId':_0x4ff134['id'],['queueField']:_0x4a8226[_0x4fa871]['id']});}});});});}});}})[_0x4ce3('0x25')](respondWithStatusCode(_0xf927ae,null))['catch'](handleError(_0xf927ae,null));};exports[_0x4ce3('0x116')]=function(_0x15ecc9,_0x29f18a){return db[_0x4ce3('0x47')]['findOne']({'where':{'id':_0x15ecc9[_0x4ce3('0x61')]['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0x29f18a,null))['then'](function(_0x2bca7f){if(_0x2bca7f){var _0x3adfa0=_0x2bca7f[_0x4ce3('0x39')]({'plain':!![]});var _0x4214e8=_0x15ecc9[_0x4ce3('0x4e')][_0x4ce3('0x68')];return _0x2bca7f[_0x4ce3('0x116')](_0x4214e8)['then'](function(){for(var _0x30bde6=0x0;_0x30bde6<_0x4214e8[_0x4ce3('0x52')];_0x30bde6++){var _0x6123cf=[];db[_0x4ce3('0x108')][_0x4ce3('0xbf')]({'where':{'id':_0x4214e8[_0x30bde6]}})['then'](function(_0x12219e){_0x6123cf[_0x4ce3('0xe9')](_0x12219e[_0x4ce3('0xe5')]()[_0x4ce3('0x25')](function(_0x2ff28f){for(var _0x615b73=0x0;_0x615b73<_0x2ff28f[_0x4ce3('0x52')];_0x615b73++){_0x2ff28f[_0x615b73]['setDataValue'](_0x4ce3('0x9a'),_0x4ce3('0x109'));}return _0x2ff28f;}));_0x6123cf[_0x4ce3('0xe9')](_0x12219e[_0x4ce3('0x117')]()[_0x4ce3('0x25')](function(_0x57aa3c){for(var _0x980ff9=0x0;_0x980ff9<_0x57aa3c[_0x4ce3('0x52')];_0x980ff9++){_0x57aa3c[_0x980ff9][_0x4ce3('0x10a')](_0x4ce3('0x9a'),_0x4ce3('0x10b'));}return _0x57aa3c;}));_0x6123cf[_0x4ce3('0xe9')](_0x12219e[_0x4ce3('0x10c')]()['then'](function(_0x1c5b77){for(var _0x48d5b2=0x0;_0x48d5b2<_0x1c5b77['length'];_0x48d5b2++){_0x1c5b77[_0x48d5b2]['setDataValue'](_0x4ce3('0x9a'),_0x4ce3('0x10d'));}return _0x1c5b77;}));_0x6123cf[_0x4ce3('0xe9')](_0x12219e[_0x4ce3('0x118')]()[_0x4ce3('0x25')](function(_0x506ed7){for(var _0x3b85a4=0x0;_0x3b85a4<_0x506ed7[_0x4ce3('0x52')];_0x3b85a4++){_0x506ed7[_0x3b85a4][_0x4ce3('0x10a')](_0x4ce3('0x9a'),_0x4ce3('0x10e'));}return _0x506ed7;}));_0x6123cf[_0x4ce3('0xe9')](_0x12219e[_0x4ce3('0x10f')]()[_0x4ce3('0x25')](function(_0x4cc1b9){for(var _0x4cc4d4=0x0;_0x4cc4d4<_0x4cc1b9[_0x4ce3('0x52')];_0x4cc4d4++){_0x4cc1b9[_0x4cc4d4][_0x4ce3('0x10a')](_0x4ce3('0x9a'),'Whatsapp');}return _0x4cc1b9;}));_0x6123cf[_0x4ce3('0xe9')](_0x12219e['getFaxQueues']()[_0x4ce3('0x25')](function(_0x5bc8de){for(var _0x2a03a8=0x0;_0x2a03a8<_0x5bc8de[_0x4ce3('0x52')];_0x2a03a8++){_0x5bc8de[_0x2a03a8][_0x4ce3('0x10a')](_0x4ce3('0x9a'),'Fax');}return _0x5bc8de;}));_0x6123cf[_0x4ce3('0xe9')](_0x12219e[_0x4ce3('0x112')]()['then'](function(_0x1f9ac7){for(var _0x297a32=0x0;_0x297a32<_0x1f9ac7[_0x4ce3('0x52')];_0x297a32++){_0x1f9ac7[_0x297a32][_0x4ce3('0x10a')](_0x4ce3('0x9a'),_0x4ce3('0x113'));}return _0x1f9ac7;}));return BPromise[_0x4ce3('0xea')](_0x6123cf);})[_0x4ce3('0x25')](function(_0x14894e){var _0x1b8f3c=_['flatten'](_0x14894e);_0x6123cf=[];return db[_0x4ce3('0x59')][_0x4ce3('0x119')](function(_0x146acf){for(var _0x21ea4f=0x0;_0x21ea4f<_0x1b8f3c[_0x4ce3('0x52')];_0x21ea4f++){_0x6123cf[_0x4ce3('0xe9')](_0x1b8f3c[_0x21ea4f][_0x4ce3('0x11a')](_0x3adfa0['id']),{'transaction':_0x146acf});}return BPromise[_0x4ce3('0xea')](_0x6123cf)[_0x4ce3('0x25')](function(){if(_0x3adfa0['online']){return BPromise[_0x4ce3('0xad')](_['filter'](_0x1b8f3c,function(_0x260d36){return _0x260d36[_0x4ce3('0x115')](_0x4ce3('0x9a'))===_0x4ce3('0x109');}),function(_0x4fd374){return db['UserVoiceQueueRt'][_0x4ce3('0x38')]({'where':{'VoiceQueueId':_0x4fd374['id'],'UserId':_0x3adfa0['id']},'transaction':_0x146acf});});}else{return;}})[_0x4ce3('0x25')](function(){for(var _0x189bee=0x0;_0x189bee<_0x1b8f3c['length'];_0x189bee++){var _0x951ae1=_0x1b8f3c[_0x189bee]['getDataValue'](_0x4ce3('0x9a'));var _0x31f670=_0x951ae1+_0x4ce3('0xa6');socket[_0x4ce3('0xa7')](_0x4ce3('0x3a')+_0x951ae1+_0x4ce3('0xb2'),{'UserId':_0x3adfa0['id'],['queueField']:_0x1b8f3c[_0x189bee]['id']});}});});});}});}})[_0x4ce3('0x25')](respondWithStatusCode(_0x29f18a,null))[_0x4ce3('0x2e')](handleError(_0x29f18a,null));};exports['getLists']=function(_0x2d6006,_0x245302,_0x432d63){var _0x569196={};var _0x30f87c={};var _0x214066;var _0x1b95b6;return db['User'][_0x4ce3('0xbf')]({'where':{'id':_0x2d6006[_0x4ce3('0x61')]['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0x245302,null))['then'](function(_0x542932){if(_0x542932){_0x214066=_0x542932;_0x30f87c[_0x4ce3('0x4a')]=_['keys'](db['CmList'][_0x4ce3('0x48')]);_0x30f87c[_0x4ce3('0x4e')]=_[_0x4ce3('0x4d')](_0x2d6006['query']);_0x30f87c[_0x4ce3('0x4f')]=_[_0x4ce3('0x50')](_0x30f87c['model'],_0x30f87c[_0x4ce3('0x4e')]);_0x569196[_0x4ce3('0x51')]=_[_0x4ce3('0x50')](_0x30f87c['model'],qs[_0x4ce3('0x63')](_0x2d6006['query'][_0x4ce3('0x63')]));_0x569196[_0x4ce3('0x51')]=_0x569196[_0x4ce3('0x51')][_0x4ce3('0x52')]?_0x569196['attributes']:_0x30f87c[_0x4ce3('0x4a')];_0x569196[_0x4ce3('0xc0')]=qs[_0x4ce3('0x55')](_0x2d6006['query'][_0x4ce3('0x55')]);_0x569196['where']=qs[_0x4ce3('0x4f')](_[_0x4ce3('0xc1')](_0x2d6006[_0x4ce3('0x4e')],_0x30f87c[_0x4ce3('0x4f')]));if(_0x2d6006['query'][_0x4ce3('0x3d')]){_0x569196['where']=_[_0x4ce3('0x57')](_0x569196[_0x4ce3('0x56')],{'$or':_[_0x4ce3('0x46')](_0x569196['attributes'],function(_0x1335c8){var _0x5a3e65={};_0x5a3e65[_0x1335c8]={'$like':'%'+_0x2d6006[_0x4ce3('0x4e')][_0x4ce3('0x3d')]+'%'};return _0x5a3e65;})});}_0x569196=_['merge']({},_0x569196,_0x2d6006[_0x4ce3('0x5b')]);return _0x214066[_0x4ce3('0x11b')](_0x569196);}})['then'](function(_0xbbae74){if(_0xbbae74){_0x1b95b6=_0xbbae74[_0x4ce3('0x52')];if(!_0x2d6006[_0x4ce3('0x4e')][_0x4ce3('0x53')](_0x4ce3('0x54'))){_0x569196[_0x4ce3('0x34')]=qs[_0x4ce3('0x34')](_0x2d6006[_0x4ce3('0x4e')][_0x4ce3('0x34')]);_0x569196[_0x4ce3('0x33')]=qs['offset'](_0x2d6006[_0x4ce3('0x4e')][_0x4ce3('0x33')]);}return _0x214066['getLists'](_0x569196);}})[_0x4ce3('0x25')](function(_0x46b185){if(_0x46b185){return _0x46b185?{'count':_0x1b95b6,'rows':_0x46b185}:null;}})[_0x4ce3('0x25')](respondWithResult(_0x245302,null))['catch'](handleError(_0x245302,null));};exports['getAgents']=function(_0x3ca02e,_0x14a2a7,_0x564ada){var _0x249ef5={};var _0xfdfdff={};var _0x42d4d5;var _0x1a878e;return db[_0x4ce3('0x47')][_0x4ce3('0xbf')]({'where':{'id':_0x3ca02e[_0x4ce3('0x61')]['id']}})[_0x4ce3('0x25')](handleEntityNotFound(_0x14a2a7,null))[_0x4ce3('0x25')](function(_0x46c98d){if(_0x46c98d){_0x42d4d5=_0x46c98d;_0xfdfdff[_0x4ce3('0x4a')]=_[_0x4ce3('0x4d')](db[_0x4ce3('0x47')][_0x4ce3('0x48')]);_0xfdfdff[_0x4ce3('0x4e')]=_['keys'](_0x3ca02e[_0x4ce3('0x4e')]);_0xfdfdff[_0x4ce3('0x4f')]=_[_0x4ce3('0x50')](_0xfdfdff['model'],_0xfdfdff[_0x4ce3('0x4e')]);_0x249ef5[_0x4ce3('0x51')]=_['intersection'](_0xfdfdff['model'],qs[_0x4ce3('0x63')](_0x3ca02e['query'][_0x4ce3('0x63')]));_0x249ef5[_0x4ce3('0x51')]=_0x249ef5[_0x4ce3('0x51')][_0x4ce3('0x52')]?_0x249ef5[_0x4ce3('0x51')]:_0xfdfdff[_0x4ce3('0x4a')];_0x249ef5[_0x4ce3('0xc0')]=qs[_0x4ce3('0x55')](_0x3ca02e[_0x4ce3('0x4e')]['sort']);_0x249ef5[_0x4ce3('0x56')]=qs[_0x4ce3('0x4f')](_[_0x4ce3('0xc1')](_0x3ca02e[_0x4ce3('0x4e')],_0xfdfdff[_0x4ce3('0x4f')]));if(_0x3ca02e['query'][_0x4ce3('0x3d')]){_0x249ef5['where']=_[_0x4ce3('0x57')](_0x249ef5[_0x4ce3('0x56')],{'$or':_['map'](_0x249ef5[_0x4ce3('0x51')],function(_0x130955){var _0x46330a={};_0x46330a[_0x130955]={'$like':'%'+_0x3ca02e[_0x4ce3('0x4e')][_0x4ce3('0x3d')]+'%'};return _0x46330a;})});}_0x249ef5[_0x4ce3('0x4a')]=db[_0x4ce3('0x47')];_0x249ef5['as']='Agents';_0x249ef5=_['merge']({},_0x249ef5,_0x3ca02e[_0x4ce3('0x5b')]);return _0x42d4d5[_0x4ce3('0xe5')]({'include':[_0x249ef5]});}})[_0x4ce3('0x25')](function(_0x5c35eb){if(_0x5c35eb){var _0x4dec5d={},_0x2f6c24=[],_0x427d9a=0x0;for(var _0x43a201=0x0;_0x43a201<_0x5c35eb['length'];_0x43a201+=0x1){for(var _0x1ede5d=0x0,_0x172421;_0x1ede5d<_0x5c35eb[_0x43a201][_0x4ce3('0x8a')][_0x4ce3('0x52')];_0x1ede5d+=0x1){_0x172421=_0x5c35eb[_0x43a201][_0x4ce3('0x8a')][_0x1ede5d][_0x4ce3('0x39')]({'plain':!![]});_0x4dec5d[_0x172421['id']]=_0x172421;}}_0x4dec5d=_['values'](_0x4dec5d);for(var _0x2bee41=qs[_0x4ce3('0x33')](_0x3ca02e['query'][_0x4ce3('0x33')]);_0x2bee41<_0x4dec5d['length']&&_0x2f6c24[_0x4ce3('0x52')]=_0x5a6bc0[_0xb9fc('0x53')]){throw new Error(_0xb9fc('0x54'));}})[_0xb9fc('0x24')](function(){if(_0x45510a){return db[_0xb9fc('0x3f')][_0xb9fc('0x4a')]({'where':{'membername':_0x45510a[_0xb9fc('0x2a')]},'individualHooks':!![]});}})['then'](function(){if(_0x45510a){return _0x45510a['getVoiceQueues']({'raw':!![]});}})[_0xb9fc('0x24')](function(_0x21cd00){if(_0x45510a){if(_0x21cd00){var _0x30721f=[];_0x27ec36=_0x21cd00;if(_0x27ec36[_0xb9fc('0x30')]){for(var _0x2b3b50=0x0;_0x2b3b50<_0x27ec36[_0xb9fc('0x30')];_0x2b3b50++){_0x30721f[_0xb9fc('0x35')](db[_0xb9fc('0x3f')][_0xb9fc('0x55')]({'membername':_0x45510a[_0xb9fc('0x2a')],'UserId':_0x45510a['id'],'queue_name':_0x27ec36[_0x2b3b50][_0xb9fc('0x2a')],'VoiceQueueId':_0x27ec36[_0x2b3b50]['id'],'interface':_0x4972c5,'paused':_0x45510a[_0xb9fc('0x4e')]||![],'penalty':_0x27ec36[_0x2b3b50][_0xb9fc('0x56')]||0x0}));}return BPromise['all'](_0x30721f);}}}})[_0xb9fc('0x24')](function(){if(_0x45510a){return db['MemberReport']['findAll']({'where':{'membername':_0x45510a[_0xb9fc('0x2a')],'exitAt':null}});}})[_0xb9fc('0x24')](function(_0x16d6b0){if(_0x45510a){if(_0x16d6b0&&_0x16d6b0[_0xb9fc('0x30')]){var _0x18b4c2=[];_0x16d6b0['forEach'](function(_0x321b30){_0x18b4c2[_0xb9fc('0x35')](_0x321b30[_0xb9fc('0x2e')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x18b4c2);}}})['then'](function(_0x2b08b2){if(_0x45510a){var _0x41aed1=[];var _0x4ba708=[];var _0x2098cb=utils['getChannels']();var _0x373fb5={'membername':_0x45510a[_0xb9fc('0x2a')],'interface':_0x4972c5,'enterAt':moment()[_0xb9fc('0x31')](_0xb9fc('0x32')),'role':_0x45510a[_0xb9fc('0x2b')],'internal':_0x45510a['internal']};_0x2098cb[_0xb9fc('0x34')](function(_0x57fc25){_0x41aed1[_0xb9fc('0x35')](_[_0xb9fc('0x57')]({'channel':_0x57fc25,'type':_0xb9fc('0x58'),'data1':_0xb9fc('0x59'),'data2':_0x4972c5},_0x373fb5));if(_0x45510a['loginInPause']){_0x4ba708[_0xb9fc('0x35')](_['merge']({'channel':_0x57fc25,'type':'PAUSE','data1':_0xb9fc('0x5a')},_0x373fb5));}});return db[_0xb9fc('0x2f')][_0xb9fc('0x3a')](_0x41aed1[_0xb9fc('0x5b')](_0x4ba708),{'individualHooks':!![]});}})[_0xb9fc('0x24')](function(){if(_0x45510a){return _0x45510a['update']({'online':!![],'lastLoginAt':moment()[_0xb9fc('0x31')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x45510a['loginInPause']||![],'mailPause':_0x45510a[_0xb9fc('0x4e')]||![],'chatPause':_0x45510a[_0xb9fc('0x4e')]||![],'faxPause':_0x45510a[_0xb9fc('0x4e')]||![],'smsPause':_0x45510a[_0xb9fc('0x4e')]||![],'openchannelPause':_0x45510a['loginInPause']||![],'pauseType':_0x45510a[_0xb9fc('0x4e')]?_0xb9fc('0x5a'):null,'lastPauseAt':moment()['format'](_0xb9fc('0x32')),'interface':_0x4972c5});}})[_0xb9fc('0x24')](function(_0x82904b){_0x1cc3b1(_0x82904b);})[_0xb9fc('0x19')](function(_0x680ea7){_0x4e55cb(_0xbfe8eb[_0xb9fc('0x15')](0x1f4,_0x680ea7[_0xb9fc('0x17')]));});});}; \ No newline at end of file +var _0x6495=['merge','LOGININPAUSE','bulkCreate','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','./user.socket','request','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','User','findAll','options','where','limit','include','model','attributes','map','then','GetUser','ShowUser','PauseUser','find','name','role','UserVoiceQueueRt','update','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','push','isNil','SIP/%s','interface','body','type','DEFAULT\x20PAUSE','internal','findOne','isValidChannel','channel','Unknown\x20channel','voice','system','mail','fax','sms','openchannel','set','%s%s','all','LogoutUser','LoginUser','mobile','phone','count','../../config/license/util','agents','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','callysquare'];(function(_0x2db6b9,_0x12c02f){var _0x4271c4=function(_0x574ea7){while(--_0x574ea7){_0x2db6b9['push'](_0x2db6b9['shift']());}};_0x4271c4(++_0x12c02f);}(_0x6495,0x108));var _0x5649=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6495[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x5649('0x0'));var util=require(_0x5649('0x1'));var moment=require('moment');var BPromise=require(_0x5649('0x2'));var rs=require(_0x5649('0x3'));var fs=require('fs');var Redis=require(_0x5649('0x4'));var db=require(_0x5649('0x5'))['db'];var utils=require(_0x5649('0x6'));var logger=require('../../config/logger')(_0x5649('0x7'));var config=require(_0x5649('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5649('0x9')][_0x5649('0xa')]({'port':0x232a});config[_0x5649('0xb')]=_[_0x5649('0xc')](config[_0x5649('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5649('0xb')]));require(_0x5649('0xd'))['register'](socket);function respondWithRpcPromise(_0x397bf9,_0x2f4074,_0x4699d3){return new BPromise(function(_0x47f482,_0xdba0b1){return client[_0x5649('0xe')](_0x397bf9,_0x4699d3)['then'](function(_0x7ad501){logger[_0x5649('0xf')](_0x5649('0x10'),_0x2f4074,_0x5649('0x11'));logger[_0x5649('0x12')](_0x5649('0x13'),_0x2f4074,_0x5649('0x11'),JSON[_0x5649('0x14')](_0x7ad501));if(_0x7ad501[_0x5649('0x15')]){if(_0x7ad501[_0x5649('0x15')][_0x5649('0x16')]===0x1f4){logger[_0x5649('0x15')]('User,\x20%s,\x20%s',_0x2f4074,_0x7ad501['error']['message']);return _0xdba0b1(_0x7ad501[_0x5649('0x15')]['message']);}logger[_0x5649('0x15')](_0x5649('0x10'),_0x2f4074,_0x7ad501['error'][_0x5649('0x17')]);return _0x47f482(_0x7ad501[_0x5649('0x15')][_0x5649('0x17')]);}else{logger['info'](_0x5649('0x10'),_0x2f4074,_0x5649('0x11'));_0x47f482(_0x7ad501[_0x5649('0x18')][_0x5649('0x17')]);}})[_0x5649('0x19')](function(_0x1e840f){logger[_0x5649('0x15')](_0x5649('0x10'),_0x2f4074,_0x1e840f);_0xdba0b1(_0x1e840f);});});}exports['GetUser']=function(_0x33e410){var _0x17c257=this;return new Promise(function(_0x31ff6a,_0x22a640){return db[_0x5649('0x1a')][_0x5649('0x1b')]({'raw':_0x33e410[_0x5649('0x1c')]?_0x33e410[_0x5649('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x33e410[_0x5649('0x1c')]?_0x33e410[_0x5649('0x1c')][_0x5649('0x1d')]||null:null,'attributes':_0x33e410[_0x5649('0x1c')]?_0x33e410[_0x5649('0x1c')]['attributes']||null:null,'limit':_0x33e410[_0x5649('0x1c')]?_0x33e410['options'][_0x5649('0x1e')]||null:null,'include':_0x33e410[_0x5649('0x1c')]?_0x33e410[_0x5649('0x1c')][_0x5649('0x1f')]?_['map'](_0x33e410['options'][_0x5649('0x1f')],function(_0x51737b){return{'model':db[_0x51737b[_0x5649('0x20')]],'as':_0x51737b['as'],'attributes':_0x51737b[_0x5649('0x21')],'include':_0x51737b[_0x5649('0x1f')]?_[_0x5649('0x22')](_0x51737b[_0x5649('0x1f')],function(_0x3eb60d){return{'model':db[_0x3eb60d['model']],'as':_0x3eb60d['as'],'attributes':_0x3eb60d[_0x5649('0x21')],'include':_0x3eb60d[_0x5649('0x1f')]?_[_0x5649('0x22')](_0x3eb60d['include'],function(_0x18df3a){return{'model':db[_0x18df3a[_0x5649('0x20')]],'as':_0x18df3a['as'],'attributes':_0x18df3a[_0x5649('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5649('0x23')](function(_0x46e809){logger['info'](_0x5649('0x24'),_0x33e410);logger[_0x5649('0x12')](_0x5649('0x24'),_0x33e410,JSON[_0x5649('0x14')](_0x46e809));_0x31ff6a(_0x46e809);})[_0x5649('0x19')](function(_0x462356){logger[_0x5649('0x15')](_0x5649('0x24'),_0x462356[_0x5649('0x17')],_0x33e410);_0x22a640(_0x17c257[_0x5649('0x15')](0x1f4,_0x462356[_0x5649('0x17')]));});});};exports[_0x5649('0x25')]=function(_0x18c227){var _0x2d266a=this;return new Promise(function(_0x5e64ac,_0x156d8e){return db['User']['find']({'raw':_0x18c227[_0x5649('0x1c')]?_0x18c227[_0x5649('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x18c227[_0x5649('0x1c')]?_0x18c227[_0x5649('0x1c')][_0x5649('0x1d')]||null:null,'attributes':_0x18c227[_0x5649('0x1c')]?_0x18c227[_0x5649('0x1c')][_0x5649('0x21')]||null:null,'include':_0x18c227[_0x5649('0x1c')]?_0x18c227['options'][_0x5649('0x1f')]?_[_0x5649('0x22')](_0x18c227[_0x5649('0x1c')][_0x5649('0x1f')],function(_0x18ec91){return{'model':db[_0x18ec91['model']],'as':_0x18ec91['as'],'attributes':_0x18ec91[_0x5649('0x21')],'include':_0x18ec91['include']?_[_0x5649('0x22')](_0x18ec91[_0x5649('0x1f')],function(_0x30c977){return{'model':db[_0x30c977[_0x5649('0x20')]],'as':_0x30c977['as'],'attributes':_0x30c977[_0x5649('0x21')],'include':_0x30c977[_0x5649('0x1f')]?_[_0x5649('0x22')](_0x30c977[_0x5649('0x1f')],function(_0x29352c){return{'model':db[_0x29352c[_0x5649('0x20')]],'as':_0x29352c['as'],'attributes':_0x29352c['attributes']};}):[]};}):[]};}):[]:[]})[_0x5649('0x23')](function(_0xc6031e){logger[_0x5649('0xf')](_0x5649('0x25'),_0x18c227);logger[_0x5649('0x12')](_0x5649('0x25'),_0x18c227,JSON['stringify'](_0xc6031e));_0x5e64ac(_0xc6031e);})['catch'](function(_0x72e348){logger['error']('ShowUser',_0x72e348[_0x5649('0x17')],_0x18c227);_0x156d8e(_0x2d266a[_0x5649('0x15')](0x1f4,_0x72e348[_0x5649('0x17')]));});});};exports[_0x5649('0x26')]=function(_0x4f1525){var _0x2e6295=this;return new Promise(function(_0x32fea8,_0x458e18){var _0x57ff0a;return db[_0x5649('0x1a')][_0x5649('0x27')]({'where':_0x4f1525[_0x5649('0x1c')][_0x5649('0x1d')]||{},'attributes':['id',_0x5649('0x28'),_0x5649('0x29'),'internal','interface']})[_0x5649('0x23')](function(_0x3b1289){if(_0x3b1289){_0x57ff0a=_0x3b1289;return db[_0x5649('0x2a')][_0x5649('0x2b')]({'paused':0x1},{'where':{'UserId':_0x57ff0a['id']},'individualHooks':!![]});}})['then'](function(){if(_0x57ff0a){return db[_0x5649('0x2c')][_0x5649('0x1b')]({'where':{'membername':_0x57ff0a[_0x5649('0x28')],'type':_0x5649('0x2d'),'exitAt':null}});}})[_0x5649('0x23')](function(_0x3dae45){if(_0x57ff0a){if(_0x3dae45&&_0x3dae45[_0x5649('0x2e')]){var _0x3ea615=moment()[_0x5649('0x2f')](_0x5649('0x30'));for(var _0x380ab9=0x0,_0x514dc6=_0x3dae45[_0x5649('0x2e')];_0x380ab9<_0x514dc6;_0x380ab9++){_0x3dae45[_0x380ab9]['updateAttributes']({'exitAt':_0x3ea615});}}}})[_0x5649('0x23')](function(){if(_0x57ff0a){var _0x1e25e4=[];var _0x137d25=utils[_0x5649('0x31')]();_0x137d25[_0x5649('0x32')](function(_0x3b96f8){_0x1e25e4[_0x5649('0x33')]({'channel':_0x3b96f8,'membername':_0x57ff0a[_0x5649('0x28')],'interface':_[_0x5649('0x34')](_0x57ff0a['interface'])?util[_0x5649('0x2f')](_0x5649('0x35'),_0x57ff0a[_0x5649('0x28')]):_0x57ff0a[_0x5649('0x36')],'type':_0x5649('0x2d'),'enterAt':moment()['format'](_0x5649('0x30')),'data1':_0x4f1525[_0x5649('0x37')][_0x5649('0x38')]||_0x5649('0x39'),'role':_0x57ff0a[_0x5649('0x29')],'internal':_0x57ff0a[_0x5649('0x3a')],'uniqueid':_0x4f1525[_0x5649('0x37')]['uniqueid']||null});});return db[_0x5649('0x2c')]['bulkCreate'](_0x1e25e4,{'individualHooks':!![]});}})[_0x5649('0x23')](function(){if(_0x57ff0a){return _0x57ff0a[_0x5649('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x4f1525[_0x5649('0x37')][_0x5649('0x38')]||_0x5649('0x39'),'lastPauseAt':moment()['format'](_0x5649('0x30'))});}})[_0x5649('0x23')](function(_0x31eef0){_0x32fea8(_0x31eef0);})[_0x5649('0x19')](function(_0x45141c){_0x458e18(_0x2e6295[_0x5649('0x15')](0x1f4,_0x45141c['message']));});});};exports['UnpauseUser']=function(_0xb9fc3){var _0x3cc7cd=this;return new Promise(function(_0x255afe,_0x2ba938){var _0xf06f00;return db['User'][_0x5649('0x3b')]({'where':_0xb9fc3[_0x5649('0x1c')][_0x5649('0x1d')]||{},'attributes':['id',_0x5649('0x28')]})[_0x5649('0x23')](function(_0x1bbba2){if(_0x1bbba2){_0xf06f00=_0x1bbba2;if(_0xb9fc3[_0x5649('0x37')]['channel']&&!utils[_0x5649('0x3c')](_0xb9fc3[_0x5649('0x37')][_0x5649('0x3d')])){throw new Error(_0x5649('0x3e'));}switch(_0xb9fc3[_0x5649('0x37')][_0x5649('0x3d')]){case _0x5649('0x3f'):return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0xf06f00['id']}})[_0x5649('0x23')](function(){return db[_0x5649('0x2c')][_0x5649('0x27')]({'where':{'channel':_0xb9fc3[_0x5649('0x37')]['channel'],'membername':_0xf06f00[_0x5649('0x28')],'type':'PAUSE','exitAt':null}});})[_0x5649('0x23')](function(_0x26b031){if(_0x26b031){return _0x26b031[_0x5649('0x2b')]({'exitAt':moment()[_0x5649('0x2f')](_0x5649('0x30')),'data2':_0x5649('0x40')},{'individualHooks':!![]});}return null;})[_0x5649('0x23')](function(){return _0xf06f00['update']({'voicePause':![]});});case _0x5649('0x41'):case'chat':case _0x5649('0x42'):case _0x5649('0x43'):case _0x5649('0x44'):return db['MemberReport'][_0x5649('0x27')]({'where':{'channel':_0xb9fc3[_0x5649('0x37')]['channel'],'membername':_0xf06f00[_0x5649('0x28')],'type':'PAUSE','exitAt':null}})[_0x5649('0x23')](function(_0x87fd52){return _0x87fd52[_0x5649('0x2b')]({'exitAt':moment()[_0x5649('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x5649('0x40')},{'individualHooks':!![]});})[_0x5649('0x23')](function(){var _0x57ef81={};_[_0x5649('0x45')](_0x57ef81,util[_0x5649('0x2f')](_0x5649('0x46'),_0xb9fc3[_0x5649('0x37')]['channel'],'Pause'),![]);return _0xf06f00[_0x5649('0x2b')](_0x57ef81);});default:return db['UserVoiceQueueRt'][_0x5649('0x2b')]({'paused':0x0},{'where':{'UserId':_0xf06f00['id']}})[_0x5649('0x23')](function(){return db[_0x5649('0x2c')][_0x5649('0x1b')]({'where':{'membername':_0xf06f00[_0x5649('0x28')],'type':'PAUSE','exitAt':null}});})['then'](function(_0xcc44e0){var _0x3c45d2=[];_0xcc44e0[_0x5649('0x32')](function(_0x5834da){_0x3c45d2[_0x5649('0x33')](_0x5834da[_0x5649('0x2b')]({'exitAt':moment()[_0x5649('0x2f')](_0x5649('0x30')),'data2':_0x5649('0x40')}));});return BPromise[_0x5649('0x47')](_0x3c45d2);})[_0x5649('0x23')](function(){return _0xf06f00[_0x5649('0x2b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x5649('0x23')](function(_0x356dc0){_0x255afe(_0x356dc0);})[_0x5649('0x19')](function(_0x5cb4c1){_0x2ba938(_0x3cc7cd[_0x5649('0x15')](0x1f4,_0x5cb4c1[_0x5649('0x17')]));});});};exports[_0x5649('0x48')]=function(_0x25d0ae){var _0x3368ae=this;return new Promise(function(_0x1ffca4,_0x2affa8){var _0x3b4693;return db[_0x5649('0x1a')][_0x5649('0x3b')]({'where':_0x25d0ae[_0x5649('0x1c')]['where']||{},'attributes':['id',_0x5649('0x28')]})[_0x5649('0x23')](function(_0xb36432){if(_0xb36432){_0x3b4693=_0xb36432;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x3b4693[_0x5649('0x28')]},'individualHooks':!![]});}})[_0x5649('0x23')](function(){if(_0x3b4693){return db[_0x5649('0x2c')][_0x5649('0x1b')]({'where':{'membername':_0x3b4693[_0x5649('0x28')],'exitAt':null}});}})[_0x5649('0x23')](function(_0xbd6000){if(_0x3b4693){if(_0xbd6000&&_0xbd6000[_0x5649('0x2e')]){var _0xa4191a=[];_0xbd6000[_0x5649('0x32')](function(_0xa88428){_0xa4191a[_0x5649('0x33')](_0xa88428[_0x5649('0x2b')]({'exitAt':moment()[_0x5649('0x2f')](_0x5649('0x30'))}));});return BPromise[_0x5649('0x47')](_0xa4191a);}}})[_0x5649('0x23')](function(){if(_0x3b4693){return _0x3b4693[_0x5649('0x2b')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0xe844ea){_0x1ffca4(_0xe844ea);})[_0x5649('0x19')](function(_0x38fd5d){_0x2affa8(_0x3368ae[_0x5649('0x15')](0x1f4,_0x38fd5d[_0x5649('0x17')]));});});};exports[_0x5649('0x49')]=function(_0x54e88b){var _0x5ebf82=this;return new Promise(function(_0x3facab,_0x32cdd8){var _0xd5f854;var _0x84c689;var _0x1169d0;var _0x3eaada;return db[_0x5649('0x1a')][_0x5649('0x3b')]({'where':_0x54e88b[_0x5649('0x1c')]['where']||{},'attributes':['id',_0x5649('0x28'),_0x5649('0x29'),_0x5649('0x4a'),_0x5649('0x4b'),_0x5649('0x3a'),'loginInPause',_0x5649('0x36')]})[_0x5649('0x23')](function(_0x52ae15){if(_0x52ae15){_0xd5f854=_0x52ae15;_0x3eaada=_0x54e88b['body'][_0x5649('0x36')]?_0x54e88b['body'][_0x5649('0x36')]:util[_0x5649('0x2f')](_0x5649('0x35'),_0xd5f854[_0x5649('0x28')]);return db['User'][_0x5649('0x4c')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0xd5f854['id']}}});}})[_0x5649('0x23')](function(_0x3222da){if(_0x3222da){_0x1169d0=_0x3222da;return require(_0x5649('0x4d'))['getLicense']();}})[_0x5649('0x23')](function(_0x5443b7){if(_0x5443b7&&_0x5443b7[_0x5649('0x4e')]&&_0x1169d0>=_0x5443b7[_0x5649('0x4e')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x5649('0x23')](function(){if(_0xd5f854){return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0xd5f854[_0x5649('0x28')]},'individualHooks':!![]});}})[_0x5649('0x23')](function(){if(_0xd5f854){return _0xd5f854[_0x5649('0x4f')]({'raw':!![]});}})[_0x5649('0x23')](function(_0x44c580){if(_0xd5f854){if(_0x44c580){var _0x13dbd0=[];_0x84c689=_0x44c580;if(_0x84c689[_0x5649('0x2e')]){for(var _0x4183f5=0x0;_0x4183f5<_0x84c689[_0x5649('0x2e')];_0x4183f5++){_0x13dbd0[_0x5649('0x33')](db[_0x5649('0x2a')][_0x5649('0x50')]({'membername':_0xd5f854[_0x5649('0x28')],'UserId':_0xd5f854['id'],'queue_name':_0x84c689[_0x4183f5][_0x5649('0x28')],'VoiceQueueId':_0x84c689[_0x4183f5]['id'],'interface':_0x3eaada,'paused':_0xd5f854[_0x5649('0x51')]||![],'penalty':_0x84c689[_0x4183f5][_0x5649('0x52')]||0x0}));}return BPromise[_0x5649('0x47')](_0x13dbd0);}}}})['then'](function(){if(_0xd5f854){return db[_0x5649('0x2c')][_0x5649('0x1b')]({'where':{'membername':_0xd5f854['name'],'exitAt':null}});}})[_0x5649('0x23')](function(_0x5a55c2){if(_0xd5f854){if(_0x5a55c2&&_0x5a55c2[_0x5649('0x2e')]){var _0x401956=[];_0x5a55c2['forEach'](function(_0x7d35f2){_0x401956[_0x5649('0x33')](_0x7d35f2[_0x5649('0x2b')]({'exitAt':moment()[_0x5649('0x2f')](_0x5649('0x30'))}));});return BPromise[_0x5649('0x47')](_0x401956);}}})[_0x5649('0x23')](function(_0x1ff2dd){if(_0xd5f854){var _0xf370b=[];var _0x3ed56c=[];var _0x2edbbe=utils['getChannels']();var _0x2aa47b={'membername':_0xd5f854[_0x5649('0x28')],'interface':_0x3eaada,'enterAt':moment()['format'](_0x5649('0x30')),'role':_0xd5f854[_0x5649('0x29')],'internal':_0xd5f854[_0x5649('0x3a')]};_0x2edbbe[_0x5649('0x32')](function(_0x9676e5){_0xf370b['push'](_['merge']({'channel':_0x9676e5,'type':'LOGIN','data1':_0x5649('0x53'),'data2':_0x3eaada},_0x2aa47b));if(_0xd5f854[_0x5649('0x51')]){_0x3ed56c[_0x5649('0x33')](_[_0x5649('0x54')]({'channel':_0x9676e5,'type':'PAUSE','data1':_0x5649('0x55')},_0x2aa47b));}});return db['MemberReport'][_0x5649('0x56')](_0xf370b['concat'](_0x3ed56c),{'individualHooks':!![]});}})[_0x5649('0x23')](function(){if(_0xd5f854){return _0xd5f854[_0x5649('0x2b')]({'online':!![],'lastLoginAt':moment()['format'](_0x5649('0x30')),'voicePause':_0xd5f854[_0x5649('0x51')]||![],'mailPause':_0xd5f854['loginInPause']||![],'chatPause':_0xd5f854[_0x5649('0x51')]||![],'faxPause':_0xd5f854[_0x5649('0x51')]||![],'smsPause':_0xd5f854[_0x5649('0x51')]||![],'openchannelPause':_0xd5f854[_0x5649('0x51')]||![],'pauseType':_0xd5f854[_0x5649('0x51')]?_0x5649('0x55'):null,'lastPauseAt':moment()[_0x5649('0x2f')](_0x5649('0x30')),'interface':_0x3eaada});}})['then'](function(_0x127c8d){_0x3facab(_0x127c8d);})['catch'](function(_0x401be5){_0x32cdd8(_0x5ebf82[_0x5649('0x15')](0x1f4,_0x401be5[_0x5649('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 5b2db62..21298c2 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 _0x8f59=['length','user:','save','remove','removeListener','register'];(function(_0x4f613c,_0x425015){var _0x50cffd=function(_0x5b86f1){while(--_0x5b86f1){_0x4f613c['push'](_0x4f613c['shift']());}};_0x50cffd(++_0x425015);}(_0x8f59,0xe0));var _0x98f5=function(_0x2dd493,_0x503661){_0x2dd493=_0x2dd493-0x0;var _0x4af214=_0x8f59[_0x2dd493];return _0x4af214;};'use strict';var UserEvents=require('./user.events');var events=[_0x98f5('0x0'),_0x98f5('0x1'),'update'];function createListener(_0xeb3a96,_0x57412a){return function(_0x2db1ff){_0x57412a['emit'](_0xeb3a96,_0x2db1ff);};}function removeListener(_0x2f1921,_0x5331ed){return function(){UserEvents[_0x98f5('0x2')](_0x2f1921,_0x5331ed);};}exports[_0x98f5('0x3')]=function(_0x102152){for(var _0x3fffea=0x0,_0x4afec7=events[_0x98f5('0x4')];_0x3fffea<_0x4afec7;_0x3fffea++){var _0x5ae748=events[_0x3fffea];var _0x13b6d6=createListener(_0x98f5('0x5')+_0x5ae748,_0x102152);UserEvents['on'](_0x5ae748,_0x13b6d6);}}; \ No newline at end of file +var _0xaa78=['save','remove','update','emit','removeListener','register','user:','./user.events'];(function(_0x41bbfd,_0x5df31a){var _0x5484c1=function(_0x4c5743){while(--_0x4c5743){_0x41bbfd['push'](_0x41bbfd['shift']());}};_0x5484c1(++_0x5df31a);}(_0xaa78,0x197));var _0x8aa7=function(_0x5c0979,_0x287854){_0x5c0979=_0x5c0979-0x0;var _0x309972=_0xaa78[_0x5c0979];return _0x309972;};'use strict';var UserEvents=require(_0x8aa7('0x0'));var events=[_0x8aa7('0x1'),_0x8aa7('0x2'),_0x8aa7('0x3')];function createListener(_0x3ca42b,_0x2090e3){return function(_0x5740ce){_0x2090e3[_0x8aa7('0x4')](_0x3ca42b,_0x5740ce);};}function removeListener(_0x301f1c,_0x1374b5){return function(){UserEvents[_0x8aa7('0x5')](_0x301f1c,_0x1374b5);};}exports[_0x8aa7('0x6')]=function(_0x20c13d){for(var _0x22a25a=0x0,_0x37537b=events['length'];_0x22a25a<_0x37537b;_0x22a25a++){var _0x2dd4ab=events[_0x22a25a];var _0x590a81=createListener(_0x8aa7('0x7')+_0x2dd4ab,_0x20c13d);UserEvents['on'](_0x2dd4ab,_0x590a81);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index f79c262..68ad3a8 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 _0x0f66=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util'];(function(_0x32fcf0,_0x4efe69){var _0x139179=function(_0x530685){while(--_0x530685){_0x32fcf0['push'](_0x32fcf0['shift']());}};_0x139179(++_0x4efe69);}(_0x0f66,0x142));var _0x60f6=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x0f66[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require(_0x60f6('0x0'));var util=require(_0x60f6('0x1'));var path=require('path');var timeout=require(_0x60f6('0x2'));var express=require(_0x60f6('0x3'));var router=express[_0x60f6('0x4')]();var auth=require(_0x60f6('0x5'));var interaction=require(_0x60f6('0x6'));var config=require(_0x60f6('0x7'));module[_0x60f6('0x8')]=router; \ No newline at end of file +var _0x9eb2=['exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5f519b,_0x5b606f){var _0x2461e2=function(_0x510241){while(--_0x510241){_0x5f519b['push'](_0x5f519b['shift']());}};_0x2461e2(++_0x5b606f);}(_0x9eb2,0x1a9));var _0x29eb=function(_0x465f7b,_0x77be70){_0x465f7b=_0x465f7b-0x0;var _0x1927c2=_0x9eb2[_0x465f7b];return _0x1927c2;};'use strict';var multer=require(_0x29eb('0x0'));var util=require(_0x29eb('0x1'));var path=require('path');var timeout=require(_0x29eb('0x2'));var express=require(_0x29eb('0x3'));var router=express['Router']();var auth=require(_0x29eb('0x4'));var interaction=require(_0x29eb('0x5'));var config=require(_0x29eb('0x6'));module[_0x29eb('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 5a5ba54..bcf8ebd 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 _0xd8b0=['exports','sequelize'];(function(_0x2d6faa,_0x442cd3){var _0x4f0bc0=function(_0x561e27){while(--_0x561e27){_0x2d6faa['push'](_0x2d6faa['shift']());}};_0x4f0bc0(++_0x442cd3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x58dbb8,_0x43ff61){var _0x1e83c5=function(_0x299565){while(--_0x299565){_0x58dbb8['push'](_0x58dbb8['shift']());}};_0x1e83c5(++_0x43ff61);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 8e5c237..ab5e66b 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 _0x3dd6=['UserChatQueue','user_has_chat_queues','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define'];(function(_0x4aedf9,_0x259cc2){var _0x57a200=function(_0x44f88a){while(--_0x44f88a){_0x4aedf9['push'](_0x4aedf9['shift']());}};_0x57a200(++_0x259cc2);}(_0x3dd6,0x1bc));var _0x63dd=function(_0x408758,_0x548c1f){_0x408758=_0x408758-0x0;var _0x2e25ae=_0x3dd6[_0x408758];return _0x2e25ae;};'use strict';var _=require('lodash');var util=require(_0x63dd('0x0'));var logger=require('../../config/logger')(_0x63dd('0x1'));var moment=require(_0x63dd('0x2'));var BPromise=require(_0x63dd('0x3'));var rp=require(_0x63dd('0x4'));var fs=require('fs');var path=require(_0x63dd('0x5'));var rimraf=require(_0x63dd('0x6'));var config=require(_0x63dd('0x7'));var attributes=require(_0x63dd('0x8'));module[_0x63dd('0x9')]=function(_0x576cc3,_0x2bbe35){return _0x576cc3[_0x63dd('0xa')](_0x63dd('0xb'),attributes,{'tableName':_0x63dd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafe8=['exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes'];(function(_0x43fe92,_0x2cb722){var _0x104f4f=function(_0x19e572){while(--_0x19e572){_0x43fe92['push'](_0x43fe92['shift']());}};_0x104f4f(++_0x2cb722);}(_0xafe8,0xe4));var _0x8afe=function(_0x1c7137,_0x4c7c26){_0x1c7137=_0x1c7137-0x0;var _0xeb4432=_0xafe8[_0x1c7137];return _0xeb4432;};'use strict';var _=require(_0x8afe('0x0'));var util=require(_0x8afe('0x1'));var logger=require(_0x8afe('0x2'))(_0x8afe('0x3'));var moment=require(_0x8afe('0x4'));var BPromise=require('bluebird');var rp=require(_0x8afe('0x5'));var fs=require('fs');var path=require(_0x8afe('0x6'));var rimraf=require(_0x8afe('0x7'));var config=require(_0x8afe('0x8'));var attributes=require(_0x8afe('0x9'));module[_0x8afe('0xa')]=function(_0x4e614e,_0x31ec0f){return _0x4e614e[_0x8afe('0xb')](_0x8afe('0xc'),attributes,{'tableName':_0x8afe('0xd'),'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 c58cd68..0206ad5 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 _0x19ff=['code','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x30ee75,_0x238fea){var _0x17b2d2=function(_0x37fc29){while(--_0x37fc29){_0x30ee75['push'](_0x30ee75['shift']());}};_0x17b2d2(++_0x238fea);}(_0x19ff,0xcd));var _0xf19f=function(_0x5b8cfb,_0x592639){_0x5b8cfb=_0x5b8cfb-0x0;var _0x1cff97=_0x19ff[_0x5b8cfb];return _0x1cff97;};'use strict';var _=require(_0xf19f('0x0'));var util=require('util');var moment=require(_0xf19f('0x1'));var BPromise=require(_0xf19f('0x2'));var rs=require(_0xf19f('0x3'));var fs=require('fs');var Redis=require(_0xf19f('0x4'));var db=require(_0xf19f('0x5'))['db'];var utils=require(_0xf19f('0x6'));var logger=require(_0xf19f('0x7'))(_0xf19f('0x8'));var config=require(_0xf19f('0x9'));var jayson=require(_0xf19f('0xa'));var client=jayson[_0xf19f('0xb')][_0xf19f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa8fe90,_0x3f5cb3,_0x5966c0){return new BPromise(function(_0x3da6f7,_0x5e8cfb){return client[_0xf19f('0xd')](_0xa8fe90,_0x5966c0)[_0xf19f('0xe')](function(_0x19ea26){logger[_0xf19f('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x3f5cb3,_0xf19f('0x10'));logger[_0xf19f('0x11')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x3f5cb3,'request\x20sent',JSON[_0xf19f('0x12')](_0x19ea26));if(_0x19ea26[_0xf19f('0x13')]){if(_0x19ea26['error'][_0xf19f('0x14')]===0x1f4){logger['error'](_0xf19f('0x15'),_0x3f5cb3,_0x19ea26[_0xf19f('0x13')][_0xf19f('0x16')]);return _0x5e8cfb(_0x19ea26[_0xf19f('0x13')][_0xf19f('0x16')]);}logger['error'](_0xf19f('0x15'),_0x3f5cb3,_0x19ea26[_0xf19f('0x13')][_0xf19f('0x16')]);return _0x3da6f7(_0x19ea26[_0xf19f('0x13')][_0xf19f('0x16')]);}else{logger['info'](_0xf19f('0x15'),_0x3f5cb3,_0xf19f('0x10'));_0x3da6f7(_0x19ea26[_0xf19f('0x17')]['message']);}})[_0xf19f('0x18')](function(_0x4d1fd9){logger[_0xf19f('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x3f5cb3,_0x4d1fd9);_0x5e8cfb(_0x4d1fd9);});});} \ No newline at end of file +var _0xcef9=['request','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x5b6d2a,_0x2a4e3b){var _0x536640=function(_0x38f760){while(--_0x38f760){_0x5b6d2a['push'](_0x5b6d2a['shift']());}};_0x536640(++_0x2a4e3b);}(_0xcef9,0x139));var _0x9cef=function(_0x346db7,_0x57eb0b){_0x346db7=_0x346db7-0x0;var _0x515430=_0xcef9[_0x346db7];return _0x515430;};'use strict';var _=require(_0x9cef('0x0'));var util=require('util');var moment=require(_0x9cef('0x1'));var BPromise=require(_0x9cef('0x2'));var rs=require(_0x9cef('0x3'));var fs=require('fs');var Redis=require(_0x9cef('0x4'));var db=require(_0x9cef('0x5'))['db'];var utils=require(_0x9cef('0x6'));var logger=require(_0x9cef('0x7'))(_0x9cef('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9cef('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x487c90,_0x45b6e1,_0x2262bb){return new BPromise(function(_0x1ca60a,_0x235625){return client[_0x9cef('0xa')](_0x487c90,_0x2262bb)['then'](function(_0x47f33b){logger['info'](_0x9cef('0xb'),_0x45b6e1,_0x9cef('0xc'));logger['debug'](_0x9cef('0xd'),_0x45b6e1,_0x9cef('0xc'),JSON[_0x9cef('0xe')](_0x47f33b));if(_0x47f33b[_0x9cef('0xf')]){if(_0x47f33b['error']['code']===0x1f4){logger[_0x9cef('0xf')](_0x9cef('0xb'),_0x45b6e1,_0x47f33b[_0x9cef('0xf')][_0x9cef('0x10')]);return _0x235625(_0x47f33b[_0x9cef('0xf')][_0x9cef('0x10')]);}logger[_0x9cef('0xf')](_0x9cef('0xb'),_0x45b6e1,_0x47f33b['error'][_0x9cef('0x10')]);return _0x1ca60a(_0x47f33b[_0x9cef('0xf')][_0x9cef('0x10')]);}else{logger[_0x9cef('0x11')](_0x9cef('0xb'),_0x45b6e1,_0x9cef('0xc'));_0x1ca60a(_0x47f33b[_0x9cef('0x12')][_0x9cef('0x10')]);}})['catch'](function(_0x3c2894){logger[_0x9cef('0xf')](_0x9cef('0xb'),_0x45b6e1,_0x3c2894);_0x235625(_0x3c2894);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 9b09602..860350b 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 _0x57de=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x1ec939,_0x12572b){var _0x86e783=function(_0x396625){while(--_0x396625){_0x1ec939['push'](_0x1ec939['shift']());}};_0x86e783(++_0x12572b);}(_0x57de,0x1a5));var _0xe57d=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x57de[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe57d('0x0'));var timeout=require(_0xe57d('0x1'));var express=require(_0xe57d('0x2'));var router=express[_0xe57d('0x3')]();var auth=require(_0xe57d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe57d('0x5'));module[_0xe57d('0x6')]=router; \ No newline at end of file +var _0xdd48=['connect-timeout','Router','../../components/auth/service','../../config/environment','exports','multer','util'];(function(_0x418237,_0x393768){var _0x5734fc=function(_0x281f5a){while(--_0x281f5a){_0x418237['push'](_0x418237['shift']());}};_0x5734fc(++_0x393768);}(_0xdd48,0xec));var _0x8dd4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xdd48[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8dd4('0x0'));var util=require(_0x8dd4('0x1'));var path=require('path');var timeout=require(_0x8dd4('0x2'));var express=require('express');var router=express[_0x8dd4('0x3')]();var auth=require(_0x8dd4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8dd4('0x5'));module[_0x8dd4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 8eed307..022ea92 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 _0x6e6c=['exports','INTEGER','STRING','sequelize'];(function(_0x11a140,_0x14da96){var _0x321eb1=function(_0x908e88){while(--_0x908e88){_0x11a140['push'](_0x11a140['shift']());}};_0x321eb1(++_0x14da96);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc6e6('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xc6e6('0x3')]}}; \ No newline at end of file +var _0xb10b=['STRING','sequelize','INTEGER'];(function(_0x51549f,_0x371d86){var _0x1e0591=function(_0x1a68a1){while(--_0x1a68a1){_0x51549f['push'](_0x51549f['shift']());}};_0x1e0591(++_0x371d86);}(_0xb10b,0x12a));var _0xbb10=function(_0x25c5a4,_0x1922b9){_0x25c5a4=_0x25c5a4-0x0;var _0x3f191b=_0xb10b[_0x25c5a4];return _0x3f191b;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xbb10('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 606272f..fff9652 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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','../../config/logger'];(function(_0x31c27f,_0x40294c){var _0x28f9c6=function(_0x4f7f35){while(--_0x4f7f35){_0x31c27f['push'](_0x31c27f['shift']());}};_0x28f9c6(++_0x40294c);}(_0xb10b,0x12a));var _0xbb10=function(_0x6503ff,_0x2b169a){_0x6503ff=_0x6503ff-0x0;var _0x22e638=_0xb10b[_0x6503ff];return _0x22e638;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserFaxQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','lodash','../../config/logger'];(function(_0xd67723,_0x1e576f){var _0x53b62b=function(_0x2460a3){while(--_0x2460a3){_0xd67723['push'](_0xd67723['shift']());}};_0x53b62b(++_0x1e576f);}(_0xb10b,0x12a));var _0xbb10=function(_0x52c1e1,_0x5d4e83){_0x52c1e1=_0x52c1e1-0x0;var _0x25d937=_0xb10b[_0x52c1e1];return _0x25d937;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserFaxQueue',attributes,{'tableName':_0xbb10('0xb'),'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 2fa6d18..48edfec 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 _0x001a=['request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x001a,0x75));var _0xa001=function(_0x2440fe,_0x281a11){_0x2440fe=_0x2440fe-0x0;var _0x5cf734=_0x001a[_0x2440fe];return _0x5cf734;};'use strict';var _=require(_0xa001('0x0'));var util=require('util');var moment=require(_0xa001('0x1'));var BPromise=require(_0xa001('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa001('0x3'));var db=require(_0xa001('0x4'))['db'];var utils=require(_0xa001('0x5'));var logger=require(_0xa001('0x6'))(_0xa001('0x7'));var config=require('../../config/environment');var jayson=require(_0xa001('0x8'));var client=jayson[_0xa001('0x9')][_0xa001('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x524a10,_0x22e095,_0x302258){return new BPromise(function(_0x5bb397,_0x18cc12){return client[_0xa001('0xb')](_0x524a10,_0x302258)[_0xa001('0xc')](function(_0x5083c5){logger[_0xa001('0xd')](_0xa001('0xe'),_0x22e095,_0xa001('0xf'));logger[_0xa001('0x10')](_0xa001('0x11'),_0x22e095,'request\x20sent',JSON['stringify'](_0x5083c5));if(_0x5083c5['error']){if(_0x5083c5[_0xa001('0x12')][_0xa001('0x13')]===0x1f4){logger[_0xa001('0x12')](_0xa001('0xe'),_0x22e095,_0x5083c5[_0xa001('0x12')][_0xa001('0x14')]);return _0x18cc12(_0x5083c5[_0xa001('0x12')][_0xa001('0x14')]);}logger[_0xa001('0x12')](_0xa001('0xe'),_0x22e095,_0x5083c5[_0xa001('0x12')][_0xa001('0x14')]);return _0x5bb397(_0x5083c5[_0xa001('0x12')]['message']);}else{logger[_0xa001('0xd')](_0xa001('0xe'),_0x22e095,_0xa001('0xf'));_0x5bb397(_0x5083c5[_0xa001('0x15')][_0xa001('0x14')]);}})['catch'](function(_0x25b503){logger['error'](_0xa001('0xe'),_0x22e095,_0x25b503);_0x18cc12(_0x25b503);});});} \ No newline at end of file +var _0xaf23=['jayson/promise','request','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0xb96ae6,_0x4c6602){var _0x2dc126=function(_0x4fe7ed){while(--_0x4fe7ed){_0xb96ae6['push'](_0xb96ae6['shift']());}};_0x2dc126(++_0x4c6602);}(_0xaf23,0x11a));var _0x3af2=function(_0x4f192e,_0x4d1756){_0x4f192e=_0x4f192e-0x0;var _0x49294d=_0xaf23[_0x4f192e];return _0x49294d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3af2('0x0'));var BPromise=require(_0x3af2('0x1'));var rs=require(_0x3af2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3af2('0x3'))['db'];var utils=require(_0x3af2('0x4'));var logger=require('../../config/logger')(_0x3af2('0x5'));var config=require('../../config/environment');var jayson=require(_0x3af2('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x141c5e,_0x1af3de,_0x6df222){return new BPromise(function(_0x27b4b0,_0x587abd){return client[_0x3af2('0x7')](_0x141c5e,_0x6df222)['then'](function(_0x23ebd8){logger['info'](_0x3af2('0x8'),_0x1af3de,_0x3af2('0x9'));logger[_0x3af2('0xa')](_0x3af2('0xb'),_0x1af3de,_0x3af2('0x9'),JSON[_0x3af2('0xc')](_0x23ebd8));if(_0x23ebd8[_0x3af2('0xd')]){if(_0x23ebd8[_0x3af2('0xd')][_0x3af2('0xe')]===0x1f4){logger[_0x3af2('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x1af3de,_0x23ebd8[_0x3af2('0xd')][_0x3af2('0xf')]);return _0x587abd(_0x23ebd8[_0x3af2('0xd')]['message']);}logger['error'](_0x3af2('0x8'),_0x1af3de,_0x23ebd8[_0x3af2('0xd')][_0x3af2('0xf')]);return _0x27b4b0(_0x23ebd8[_0x3af2('0xd')]['message']);}else{logger[_0x3af2('0x10')](_0x3af2('0x8'),_0x1af3de,_0x3af2('0x9'));_0x27b4b0(_0x23ebd8['result'][_0x3af2('0xf')]);}})[_0x3af2('0x11')](function(_0x21f087){logger[_0x3af2('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x1af3de,_0x21f087);_0x587abd(_0x21f087);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index ed63e28..e9ef5f1 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 _0xc96c=['multer','util'];(function(_0x280050,_0x50ab7a){var _0x410988=function(_0x23ea9d){while(--_0x23ea9d){_0x280050['push'](_0x280050['shift']());}};_0x410988(++_0x50ab7a);}(_0xc96c,0xca));var _0xcc96=function(_0x3a7077,_0x1f9d15){_0x3a7077=_0x3a7077-0x0;var _0x3ad27d=_0xc96c[_0x3a7077];return _0x3ad27d;};'use strict';var multer=require(_0xcc96('0x0'));var util=require(_0xcc96('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0xa87e=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x27856d,_0x13b764){var _0x3a80b8=function(_0xe84430){while(--_0xe84430){_0x27856d['push'](_0x27856d['shift']());}};_0x3a80b8(++_0x13b764);}(_0xa87e,0x17a));var _0xea87=function(_0x5c30f9,_0x22f20d){_0x5c30f9=_0x5c30f9-0x0;var _0xf95a16=_0xa87e[_0x5c30f9];return _0xf95a16;};'use strict';var multer=require(_0xea87('0x0'));var util=require(_0xea87('0x1'));var path=require('path');var timeout=require(_0xea87('0x2'));var express=require(_0xea87('0x3'));var router=express[_0xea87('0x4')]();var auth=require(_0xea87('0x5'));var interaction=require(_0xea87('0x6'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 5a3c204..e676e19 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 _0xd8b0=['exports','sequelize'];(function(_0x455e9d,_0x3eb4b4){var _0x5abebd=function(_0x756ec9){while(--_0x756ec9){_0x455e9d['push'](_0x455e9d['shift']());}};_0x5abebd(++_0x3eb4b4);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x459b4a,_0x3f7961){var _0x5d49ae=function(_0x150ecb){while(--_0x150ecb){_0x459b4a['push'](_0x459b4a['shift']());}};_0x5d49ae(++_0x3f7961);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index af84ec4..73ba232 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 _0xa9e0=['../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4bd116,_0x5ef49d){var _0x4113ad=function(_0x2658d4){while(--_0x2658d4){_0x4bd116['push'](_0x4bd116['shift']());}};_0x4113ad(++_0x5ef49d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x105963,_0x1257ba){var _0x59e969=function(_0x1455b5){while(--_0x1455b5){_0x105963['push'](_0x105963['shift']());}};_0x59e969(++_0x1257ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 ed67ee2..edb316b 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 _0x536e=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x46d484,_0x4697b1){var _0x3b7022=function(_0x5056a){while(--_0x5056a){_0x46d484['push'](_0x46d484['shift']());}};_0x3b7022(++_0x4697b1);}(_0x536e,0x155));var _0xe536=function(_0x27f569,_0x11892a){_0x27f569=_0x27f569-0x0;var _0x3774c4=_0x536e[_0x27f569];return _0x3774c4;};'use strict';var _=require(_0xe536('0x0'));var util=require(_0xe536('0x1'));var moment=require(_0xe536('0x2'));var BPromise=require(_0xe536('0x3'));var rs=require(_0xe536('0x4'));var fs=require('fs');var Redis=require(_0xe536('0x5'));var db=require(_0xe536('0x6'))['db'];var utils=require(_0xe536('0x7'));var logger=require(_0xe536('0x8'))(_0xe536('0x9'));var config=require(_0xe536('0xa'));var jayson=require(_0xe536('0xb'));var client=jayson[_0xe536('0xc')][_0xe536('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4c473e,_0x4806bc,_0x442afe){return new BPromise(function(_0xc516f4,_0x59a422){return client[_0xe536('0xe')](_0x4c473e,_0x442afe)[_0xe536('0xf')](function(_0x1dde2b){logger[_0xe536('0x10')](_0xe536('0x11'),_0x4806bc,_0xe536('0x12'));logger[_0xe536('0x13')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x4806bc,'request\x20sent',JSON[_0xe536('0x14')](_0x1dde2b));if(_0x1dde2b[_0xe536('0x15')]){if(_0x1dde2b['error'][_0xe536('0x16')]===0x1f4){logger[_0xe536('0x15')](_0xe536('0x11'),_0x4806bc,_0x1dde2b[_0xe536('0x15')][_0xe536('0x17')]);return _0x59a422(_0x1dde2b[_0xe536('0x15')]['message']);}logger[_0xe536('0x15')](_0xe536('0x11'),_0x4806bc,_0x1dde2b[_0xe536('0x15')][_0xe536('0x17')]);return _0xc516f4(_0x1dde2b[_0xe536('0x15')]['message']);}else{logger[_0xe536('0x10')](_0xe536('0x11'),_0x4806bc,_0xe536('0x12'));_0xc516f4(_0x1dde2b['result'][_0xe536('0x17')]);}})[_0xe536('0x18')](function(_0x25ec38){logger[_0xe536('0x15')]('UserMailQueue,\x20%s,\x20%s',_0x4806bc,_0x25ec38);_0x59a422(_0x25ec38);});});} \ No newline at end of file +var _0xe437=['jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x28cc8f,_0x3d7370){var _0x30e6d3=function(_0x1ab4ef){while(--_0x1ab4ef){_0x28cc8f['push'](_0x28cc8f['shift']());}};_0x30e6d3(++_0x3d7370);}(_0xe437,0x69));var _0x7e43=function(_0x369df8,_0x1e0a6c){_0x369df8=_0x369df8-0x0;var _0x4b5ef3=_0xe437[_0x369df8];return _0x4b5ef3;};'use strict';var _=require(_0x7e43('0x0'));var util=require(_0x7e43('0x1'));var moment=require(_0x7e43('0x2'));var BPromise=require('bluebird');var rs=require(_0x7e43('0x3'));var fs=require('fs');var Redis=require(_0x7e43('0x4'));var db=require(_0x7e43('0x5'))['db'];var utils=require(_0x7e43('0x6'));var logger=require(_0x7e43('0x7'))(_0x7e43('0x8'));var config=require(_0x7e43('0x9'));var jayson=require(_0x7e43('0xa'));var client=jayson['client'][_0x7e43('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bd40f,_0xed5596,_0x8488f6){return new BPromise(function(_0x4fac58,_0x94fd3b){return client[_0x7e43('0xc')](_0x3bd40f,_0x8488f6)[_0x7e43('0xd')](function(_0x43d20b){logger[_0x7e43('0xe')](_0x7e43('0xf'),_0xed5596,_0x7e43('0x10'));logger['debug'](_0x7e43('0x11'),_0xed5596,_0x7e43('0x10'),JSON[_0x7e43('0x12')](_0x43d20b));if(_0x43d20b[_0x7e43('0x13')]){if(_0x43d20b[_0x7e43('0x13')][_0x7e43('0x14')]===0x1f4){logger[_0x7e43('0x13')](_0x7e43('0xf'),_0xed5596,_0x43d20b['error'][_0x7e43('0x15')]);return _0x94fd3b(_0x43d20b['error']['message']);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0xed5596,_0x43d20b[_0x7e43('0x13')]['message']);return _0x4fac58(_0x43d20b['error'][_0x7e43('0x15')]);}else{logger[_0x7e43('0xe')](_0x7e43('0xf'),_0xed5596,_0x7e43('0x10'));_0x4fac58(_0x43d20b['result'][_0x7e43('0x15')]);}})[_0x7e43('0x16')](function(_0x2a66ee){logger[_0x7e43('0x13')](_0x7e43('0xf'),_0xed5596,_0x2a66ee);_0x94fd3b(_0x2a66ee);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index df2e201..c515c44 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 _0xa995=['../../components/interaction/service','exports','util','path','express','Router','../../components/auth/service'];(function(_0x56a061,_0x53fb1b){var _0x105fa0=function(_0x164d08){while(--_0x164d08){_0x56a061['push'](_0x56a061['shift']());}};_0x105fa0(++_0x53fb1b);}(_0xa995,0x144));var _0x5a99=function(_0x1ff31f,_0xdff36f){_0x1ff31f=_0x1ff31f-0x0;var _0x369dcf=_0xa995[_0x1ff31f];return _0x369dcf;};'use strict';var multer=require('multer');var util=require(_0x5a99('0x0'));var path=require(_0x5a99('0x1'));var timeout=require('connect-timeout');var express=require(_0x5a99('0x2'));var router=express[_0x5a99('0x3')]();var auth=require(_0x5a99('0x4'));var interaction=require(_0x5a99('0x5'));var config=require('../../config/environment');module[_0x5a99('0x6')]=router; \ No newline at end of file +var _0xcbe6=['../../config/environment','exports','multer','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x453a8d,_0x2131da){var _0x13eaa1=function(_0x480404){while(--_0x480404){_0x453a8d['push'](_0x453a8d['shift']());}};_0x13eaa1(++_0x2131da);}(_0xcbe6,0x152));var _0x6cbe=function(_0x52385d,_0x378627){_0x52385d=_0x52385d-0x0;var _0xe9f769=_0xcbe6[_0x52385d];return _0xe9f769;};'use strict';var multer=require(_0x6cbe('0x0'));var util=require('util');var path=require(_0x6cbe('0x1'));var timeout=require('connect-timeout');var express=require(_0x6cbe('0x2'));var router=express['Router']();var auth=require(_0x6cbe('0x3'));var interaction=require(_0x6cbe('0x4'));var config=require(_0x6cbe('0x5'));module[_0x6cbe('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 e297564..37135a6 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x3e4d9a,_0x449a9f){var _0x4124d3=function(_0x3dd192){while(--_0x3dd192){_0x3e4d9a['push'](_0x3e4d9a['shift']());}};_0x4124d3(++_0x449a9f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 19bf7ab..59885b6 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 _0x6879=['lodash','util','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x419c11,_0x454503){var _0x29e844=function(_0x43fedc){while(--_0x43fedc){_0x419c11['push'](_0x419c11['shift']());}};_0x29e844(++_0x454503);}(_0x6879,0x84));var _0x9687=function(_0x20c652,_0x45f259){_0x20c652=_0x20c652-0x0;var _0x267e15=_0x6879[_0x20c652];return _0x267e15;};'use strict';var _=require(_0x9687('0x0'));var util=require(_0x9687('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9687('0x2'));var fs=require('fs');var path=require(_0x9687('0x3'));var rimraf=require(_0x9687('0x4'));var config=require(_0x9687('0x5'));var attributes=require(_0x9687('0x6'));module[_0x9687('0x7')]=function(_0x282da4,_0x228b30){return _0x282da4[_0x9687('0x8')](_0x9687('0x9'),attributes,{'tableName':_0x9687('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ac8=['api','path','rimraf','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','../../config/logger'];(function(_0x3bc222,_0x481df5){var _0x574be4=function(_0x1f5a5a){while(--_0x1f5a5a){_0x3bc222['push'](_0x3bc222['shift']());}};_0x574be4(++_0x481df5);}(_0x9ac8,0x18a));var _0x89ac=function(_0xb2b83d,_0x427417){_0xb2b83d=_0xb2b83d-0x0;var _0x25560f=_0x9ac8[_0xb2b83d];return _0x25560f;};'use strict';var _=require(_0x89ac('0x0'));var util=require('util');var logger=require(_0x89ac('0x1'))(_0x89ac('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x89ac('0x3'));var rimraf=require(_0x89ac('0x4'));var config=require('../../config/environment');var attributes=require(_0x89ac('0x5'));module[_0x89ac('0x6')]=function(_0x5a7177,_0x2f41f0){return _0x5a7177[_0x89ac('0x7')]('UserOpenchannelQueue',attributes,{'tableName':_0x89ac('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 8174776..c038a8c 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 _0x29b8=['../../config/utils','rpc','../../config/environment','client','http','debug','request\x20sent','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x43f136,_0x365817){var _0x531928=function(_0x5a59e9){while(--_0x5a59e9){_0x43f136['push'](_0x43f136['shift']());}};_0x531928(++_0x365817);}(_0x29b8,0x163));var _0x829b=function(_0x5c18ef,_0xa2e81d){_0x5c18ef=_0x5c18ef-0x0;var _0x33789d=_0x29b8[_0x5c18ef];return _0x33789d;};'use strict';var _=require(_0x829b('0x0'));var util=require(_0x829b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x829b('0x2'));var fs=require('fs');var Redis=require(_0x829b('0x3'));var db=require(_0x829b('0x4'))['db'];var utils=require(_0x829b('0x5'));var logger=require('../../config/logger')(_0x829b('0x6'));var config=require(_0x829b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x829b('0x8')][_0x829b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a8a07,_0x77116b,_0x3ab7d7){return new BPromise(function(_0x16884d,_0x3fbc42){return client['request'](_0x5a8a07,_0x3ab7d7)['then'](function(_0x14998b){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x77116b,'request\x20sent');logger[_0x829b('0xa')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x77116b,_0x829b('0xb'),JSON['stringify'](_0x14998b));if(_0x14998b[_0x829b('0xc')]){if(_0x14998b[_0x829b('0xc')][_0x829b('0xd')]===0x1f4){logger[_0x829b('0xc')](_0x829b('0xe'),_0x77116b,_0x14998b['error'][_0x829b('0xf')]);return _0x3fbc42(_0x14998b[_0x829b('0xc')]['message']);}logger['error'](_0x829b('0xe'),_0x77116b,_0x14998b[_0x829b('0xc')][_0x829b('0xf')]);return _0x16884d(_0x14998b[_0x829b('0xc')][_0x829b('0xf')]);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x77116b,'request\x20sent');_0x16884d(_0x14998b[_0x829b('0x10')][_0x829b('0xf')]);}})[_0x829b('0x11')](function(_0x2f9d87){logger[_0x829b('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x77116b,_0x2f9d87);_0x3fbc42(_0x2f9d87);});});} \ No newline at end of file +var _0x5920=['UserOpenchannelQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5920,0x153));var _0x0592=function(_0x5929b4,_0x342f8f){_0x5929b4=_0x5929b4-0x0;var _0x3723fa=_0x5920[_0x5929b4];return _0x3723fa;};'use strict';var _=require(_0x0592('0x0'));var util=require(_0x0592('0x1'));var moment=require(_0x0592('0x2'));var BPromise=require(_0x0592('0x3'));var rs=require(_0x0592('0x4'));var fs=require('fs');var Redis=require(_0x0592('0x5'));var db=require(_0x0592('0x6'))['db'];var utils=require(_0x0592('0x7'));var logger=require(_0x0592('0x8'))(_0x0592('0x9'));var config=require(_0x0592('0xa'));var jayson=require(_0x0592('0xb'));var client=jayson[_0x0592('0xc')][_0x0592('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x481c10,_0x2897be,_0x27f59a){return new BPromise(function(_0x4766ef,_0x59a32d){return client[_0x0592('0xe')](_0x481c10,_0x27f59a)['then'](function(_0x5bcb02){logger[_0x0592('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2897be,_0x0592('0x10'));logger['debug'](_0x0592('0x11'),_0x2897be,_0x0592('0x10'),JSON[_0x0592('0x12')](_0x5bcb02));if(_0x5bcb02[_0x0592('0x13')]){if(_0x5bcb02['error'][_0x0592('0x14')]===0x1f4){logger['error'](_0x0592('0x15'),_0x2897be,_0x5bcb02['error']['message']);return _0x59a32d(_0x5bcb02[_0x0592('0x13')][_0x0592('0x16')]);}logger['error'](_0x0592('0x15'),_0x2897be,_0x5bcb02[_0x0592('0x13')][_0x0592('0x16')]);return _0x4766ef(_0x5bcb02['error'][_0x0592('0x16')]);}else{logger['info'](_0x0592('0x15'),_0x2897be,_0x0592('0x10'));_0x4766ef(_0x5bcb02['result']['message']);}})[_0x0592('0x17')](function(_0x33586c){logger[_0x0592('0x13')](_0x0592('0x15'),_0x2897be,_0x33586c);_0x59a32d(_0x33586c);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index a6d4743..356cf93 100644 --- a/server/api/userProfile/index.js +++ b/server/api/userProfile/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeed1=['isAuthenticated','index','describe','/:id','show','/:id/sections','getResources','post','create','/:id/clone','clone','/:id/resources','addResources','put','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','express','Router','./userProfile.controller','get'];(function(_0x81024b,_0x1437bf){var _0x4ee29c=function(_0x3dc297){while(--_0x3dc297){_0x81024b['push'](_0x81024b['shift']());}};_0x4ee29c(++_0x1437bf);}(_0xeed1,0x80));var _0x1eed=function(_0x259c7e,_0x96223a){_0x259c7e=_0x259c7e-0x0;var _0x15d791=_0xeed1[_0x259c7e];return _0x15d791;};'use strict';var multer=require(_0x1eed('0x0'));var util=require(_0x1eed('0x1'));var path=require(_0x1eed('0x2'));var timeout=require('connect-timeout');var express=require(_0x1eed('0x3'));var router=express[_0x1eed('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1eed('0x5'));router[_0x1eed('0x6')]('/',auth[_0x1eed('0x7')](),controller[_0x1eed('0x8')]);router[_0x1eed('0x6')]('/describe',auth[_0x1eed('0x7')](),controller[_0x1eed('0x9')]);router['get'](_0x1eed('0xa'),auth[_0x1eed('0x7')](),controller[_0x1eed('0xb')]);router[_0x1eed('0x6')](_0x1eed('0xc'),auth[_0x1eed('0x7')](),controller['getSections']);router[_0x1eed('0x6')]('/:id/resources',auth[_0x1eed('0x7')](),controller[_0x1eed('0xd')]);router[_0x1eed('0xe')]('/',auth['isAuthenticated'](),controller[_0x1eed('0xf')]);router[_0x1eed('0xe')](_0x1eed('0x10'),auth[_0x1eed('0x7')](),controller[_0x1eed('0x11')]);router[_0x1eed('0xe')](_0x1eed('0xc'),auth['isAuthenticated'](),controller['addSections']);router[_0x1eed('0xe')](_0x1eed('0x12'),auth[_0x1eed('0x7')](),controller[_0x1eed('0x13')]);router[_0x1eed('0x14')](_0x1eed('0xa'),auth['isAuthenticated'](),controller[_0x1eed('0x15')]);router[_0x1eed('0x16')](_0x1eed('0xa'),auth[_0x1eed('0x7')](),controller[_0x1eed('0x17')]);router[_0x1eed('0x16')](_0x1eed('0xc'),auth[_0x1eed('0x7')](),controller[_0x1eed('0x18')]);router[_0x1eed('0x16')](_0x1eed('0x12'),auth[_0x1eed('0x7')](),controller[_0x1eed('0x19')]);module[_0x1eed('0x1a')]=router; \ No newline at end of file +var _0x7895=['/:id/sections','getSections','/:id/resources','getResources','post','/:id/clone','clone','addResources','update','removeSections','delete','removeResources','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x4921fd,_0x45b894){var _0x5812e5=function(_0x360c7d){while(--_0x360c7d){_0x4921fd['push'](_0x4921fd['shift']());}};_0x5812e5(++_0x45b894);}(_0x7895,0x1e1));var _0x5789=function(_0x154ee9,_0x27ce59){_0x154ee9=_0x154ee9-0x0;var _0x3d9be4=_0x7895[_0x154ee9];return _0x3d9be4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5789('0x0'));var timeout=require(_0x5789('0x1'));var express=require(_0x5789('0x2'));var router=express[_0x5789('0x3')]();var auth=require(_0x5789('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5789('0x5'));var controller=require('./userProfile.controller');router[_0x5789('0x6')]('/',auth[_0x5789('0x7')](),controller[_0x5789('0x8')]);router[_0x5789('0x6')](_0x5789('0x9'),auth['isAuthenticated'](),controller[_0x5789('0xa')]);router[_0x5789('0x6')](_0x5789('0xb'),auth[_0x5789('0x7')](),controller[_0x5789('0xc')]);router[_0x5789('0x6')](_0x5789('0xd'),auth[_0x5789('0x7')](),controller[_0x5789('0xe')]);router[_0x5789('0x6')](_0x5789('0xf'),auth[_0x5789('0x7')](),controller[_0x5789('0x10')]);router['post']('/',auth[_0x5789('0x7')](),controller['create']);router[_0x5789('0x11')](_0x5789('0x12'),auth[_0x5789('0x7')](),controller[_0x5789('0x13')]);router[_0x5789('0x11')](_0x5789('0xd'),auth[_0x5789('0x7')](),controller['addSections']);router['post'](_0x5789('0xf'),auth[_0x5789('0x7')](),controller[_0x5789('0x14')]);router['put'](_0x5789('0xb'),auth[_0x5789('0x7')](),controller[_0x5789('0x15')]);router['delete'](_0x5789('0xb'),auth[_0x5789('0x7')](),controller['destroy']);router['delete'](_0x5789('0xd'),auth['isAuthenticated'](),controller[_0x5789('0x16')]);router[_0x5789('0x17')]('/:id/resources',auth[_0x5789('0x7')](),controller[_0x5789('0x18')]);module[_0x5789('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index fc036f3..5d18fc0 100644 --- a/server/api/userProfile/userProfile.attributes.js +++ b/server/api/userProfile/userProfile.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2580=['exports','STRING','crudPermissions','join','getDataValue','split','sequelize'];(function(_0x2cfbf8,_0x249fd8){var _0x4876ed=function(_0x2e1a12){while(--_0x2e1a12){_0x2cfbf8['push'](_0x2cfbf8['shift']());}};_0x4876ed(++_0x249fd8);}(_0x2580,0x156));var _0x0258=function(_0x41d554,_0x1eff62){_0x41d554=_0x41d554-0x0;var _0x182aee=_0x2580[_0x41d554];return _0x182aee;};'use strict';var Sequelize=require(_0x0258('0x0'));module[_0x0258('0x1')]={'name':{'type':Sequelize[_0x0258('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x0258('0x2')],'set':function(_0x3dfee2){this['setDataValue'](_0x0258('0x3'),_0x3dfee2?_0x3dfee2[_0x0258('0x4')](''):[]);},'get':function(){return this[_0x0258('0x5')](_0x0258('0x3'))?this[_0x0258('0x5')](_0x0258('0x3'))[_0x0258('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x0258('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xb8ba=['STRING','setDataValue','join','getDataValue','crudPermissions','sequelize'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xb8ba,0x1a9));var _0xab8b=function(_0x1c31a5,_0x54413b){_0x1c31a5=_0x1c31a5-0x0;var _0x5c8ee9=_0xb8ba[_0x1c31a5];return _0x5c8ee9;};'use strict';var Sequelize=require(_0xab8b('0x0'));module['exports']={'name':{'type':Sequelize[_0xab8b('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0xab8b('0x1')],'set':function(_0x370d48){this[_0xab8b('0x2')]('crudPermissions',_0x370d48?_0x370d48[_0xab8b('0x3')](''):[]);},'get':function(){return this[_0xab8b('0x4')]('crudPermissions')?this['getDataValue'](_0xab8b('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xab8b('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 2a4e80e..dd71e4f 100644 --- a/server/api/userProfile/userProfile.controller.js +++ b/server/api/userProfile/userProfile.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53bb=['projects','JscriptyProject','contacts','ListId','lists','CmList','CmCompany','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','telephone','VoiceQueues','VoiceQueue','inbound','queue','outbound','musiconholds','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','queuecampaigns','QueueCampaigns','users','Users','admin','user','Telephones','zendeskaccounts','salesforceaccounts','FreshdeskAccount','sugarcrmaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','Disposition','customdashboards','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','templates','triggers','Trigger','trunks','Trunk','variables','Variable','Plugin','extractedreports','Reports','metrics','AnalyticMetric','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','merge','where','filter','options','include','UserProfile','findAll','rows','catch','params','keys','length','includeAll','find','create','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','get','UserProfileSection','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','each','removeSections','getSections','enabled','isEmpty','includes','subsections','push','findOne','Dashboard','forEach','resourceId','addResources','bulkCreate','removeResources','ids','getResources','section','undefined','ValidationError','Unknown\x20section','childModel','Sequelize','Invalid\x20section\x20\x27','parentSections','all','ignore','nolimit','pick','VIRTUAL','field','AnalyticExtractedReport','associatedResources','foreignKey','reportType','reportId','DefaultReports','custom','CustomReports','CmContact','Tag','Tags','color','tag','ThroughTags','value','toLowerCase','squareprojects','SquareProject','odbc','SquareRecording','SquareProjects'];(function(_0x2419fd,_0x1d93ce){var _0x58c8f7=function(_0x163121){while(--_0x163121){_0x2419fd['push'](_0x2419fd['shift']());}};_0x58c8f7(++_0x1d93ce);}(_0x53bb,0x147));var _0xb53b=function(_0x12d72b,_0x15f7a8){_0x12d72b=_0x12d72b-0x0;var _0x46591d=_0x53bb[_0x12d72b];return _0x46591d;};'use strict';var pdf=require(_0xb53b('0x0'));var emlformat=require(_0xb53b('0x1'));var rimraf=require(_0xb53b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb53b('0x3'));var rp=require(_0xb53b('0x4'));var moment=require(_0xb53b('0x5'));var BPromise=require(_0xb53b('0x6'));var Mustache=require(_0xb53b('0x7'));var util=require('util');var path=require(_0xb53b('0x8'));var sox=require(_0xb53b('0x9'));var csv=require(_0xb53b('0xa'));var ejs=require(_0xb53b('0xb'));var fs=require('fs');var _=require(_0xb53b('0xc'));var squel=require(_0xb53b('0xd'));var crypto=require(_0xb53b('0xe'));var jsforce=require(_0xb53b('0xf'));var deskjs=require(_0xb53b('0x10'));var toCsv=require(_0xb53b('0xa'));var querystring=require(_0xb53b('0x11'));var Papa=require(_0xb53b('0x12'));var Redis=require('ioredis');var authService=require(_0xb53b('0x13'));var qs=require(_0xb53b('0x14'));var as=require(_0xb53b('0x15'));var hardwareService=require(_0xb53b('0x16'));var logger=require(_0xb53b('0x17'))('api');var utils=require(_0xb53b('0x18'));var config=require(_0xb53b('0x19'));var db=require(_0xb53b('0x1a'))['db'];config[_0xb53b('0x1b')]=_['defaults'](config[_0xb53b('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xb53b('0x1c'))(new Redis(config[_0xb53b('0x1b')]));require('./userProfile.socket')[_0xb53b('0x1d')](socket);function respondWithStatusCode(_0x4b83a2,_0x2779e6){_0x2779e6=_0x2779e6||0xcc;return function(_0x5f39d9){if(_0x5f39d9){return _0x4b83a2[_0xb53b('0x1e')](_0x2779e6);}return _0x4b83a2[_0xb53b('0x1f')](_0x2779e6)[_0xb53b('0x20')]();};}function respondWithResult(_0xdd70f9,_0x3043b5){_0x3043b5=_0x3043b5||0xc8;return function(_0x2da565){if(_0x2da565){return _0xdd70f9[_0xb53b('0x1f')](_0x3043b5)[_0xb53b('0x21')](_0x2da565);}};}function respondWithFilteredResult(_0x28fe95,_0x4eec75){return function(_0x337f61){if(_0x337f61){var _0x482c51=_0x337f61[_0xb53b('0x22')],_0x2e901e=_0x4eec75[_0xb53b('0x23')],_0x10e254=_0x4eec75[_0xb53b('0x23')]+_0x4eec75[_0xb53b('0x24')],_0x42be28;if(_0x10e254>=_0x482c51){_0x10e254=_0x482c51;_0x42be28=0xc8;}else{_0x42be28=0xce;}_0x28fe95[_0xb53b('0x1f')](_0x42be28);return _0x28fe95[_0xb53b('0x25')](_0xb53b('0x26'),_0x2e901e+'-'+_0x10e254+'/'+_0x482c51)['json'](_0x337f61);}return null;};}function patchUpdates(_0x425b13){return function(_0x48fed0){try{jsonpatch[_0xb53b('0x27')](_0x48fed0,_0x425b13,!![]);}catch(_0x12bff6){return BPromise[_0xb53b('0x28')](_0x12bff6);}return _0x48fed0[_0xb53b('0x29')]();};}function saveUpdates(_0x2e5a04,_0x57731a){return function(_0x218b58){if(_0x218b58){return _0x218b58[_0xb53b('0x2a')](_0x2e5a04)['then'](function(_0x26aaa5){return _0x26aaa5;});}return null;};}function removeEntity(_0x1f7064,_0x5ec565){return function(_0x21f779){if(_0x21f779){return _0x21f779[_0xb53b('0x2b')]()[_0xb53b('0x2c')](function(){_0x1f7064['status'](0xcc)[_0xb53b('0x20')]();});}};}function handleEntityNotFound(_0x25bf01,_0x2b624d){return function(_0x2c7bc4){if(!_0x2c7bc4){_0x25bf01[_0xb53b('0x1e')](0x194);}return _0x2c7bc4;};}function handleError(_0x597dfa,_0x20839c){_0x20839c=_0x20839c||0x1f4;return function(_0x750004){logger[_0xb53b('0x2d')](_0x750004[_0xb53b('0x2e')]);if(_0x750004['name']){delete _0x750004[_0xb53b('0x2f')];}_0x597dfa['status'](_0x20839c)['send'](_0x750004);};}exports[_0xb53b('0x30')]=function(_0xf4ac1e,_0x264091){var _0xbf2c84={},_0x4dc0c8={},_0x5f48f2={'count':0x0,'rows':[]};var _0x4b9f11=_[_0xb53b('0x31')](db['UserProfile'][_0xb53b('0x32')],function(_0x2d8903){return{'name':_0x2d8903[_0xb53b('0x33')],'type':_0x2d8903[_0xb53b('0x34')][_0xb53b('0x35')]};});_0x4dc0c8[_0xb53b('0x36')]=_[_0xb53b('0x31')](_0x4b9f11,_0xb53b('0x2f'));_0x4dc0c8['query']=_['keys'](_0xf4ac1e[_0xb53b('0x37')]);_0x4dc0c8[_0xb53b('0x38')]=_['intersection'](_0x4dc0c8[_0xb53b('0x36')],_0x4dc0c8[_0xb53b('0x37')]);_0xbf2c84[_0xb53b('0x39')]=_[_0xb53b('0x3a')](_0x4dc0c8[_0xb53b('0x36')],qs[_0xb53b('0x3b')](_0xf4ac1e[_0xb53b('0x37')]['fields']));_0xbf2c84[_0xb53b('0x39')]=_0xbf2c84[_0xb53b('0x39')]['length']?_0xbf2c84['attributes']:_0x4dc0c8[_0xb53b('0x36')];if(!_0xf4ac1e[_0xb53b('0x37')][_0xb53b('0x3c')]('nolimit')){_0xbf2c84[_0xb53b('0x24')]=qs[_0xb53b('0x24')](_0xf4ac1e['query'][_0xb53b('0x24')]);_0xbf2c84['offset']=qs[_0xb53b('0x23')](_0xf4ac1e[_0xb53b('0x37')]['offset']);}_0xbf2c84[_0xb53b('0x3d')]=qs[_0xb53b('0x3e')](_0xf4ac1e[_0xb53b('0x37')][_0xb53b('0x3e')]);_0xbf2c84['where']=qs[_0xb53b('0x38')](_['pick'](_0xf4ac1e[_0xb53b('0x37')],_0x4dc0c8[_0xb53b('0x38')]),_0x4b9f11);if(_0xf4ac1e[_0xb53b('0x37')]['filter']){_0xbf2c84['where']=_[_0xb53b('0x3f')](_0xbf2c84[_0xb53b('0x40')],{'$or':_[_0xb53b('0x31')](_0x4b9f11,function(_0x186200){if(_0x186200['type']!=='VIRTUAL'){var _0x3cc909={};_0x3cc909[_0x186200[_0xb53b('0x2f')]]={'$like':'%'+_0xf4ac1e[_0xb53b('0x37')][_0xb53b('0x41')]+'%'};return _0x3cc909;}})});}_0xbf2c84=_['merge']({},_0xbf2c84,_0xf4ac1e[_0xb53b('0x42')]);var _0x258dd8={'where':_0xbf2c84[_0xb53b('0x40')]};return db['UserProfile'][_0xb53b('0x22')](_0x258dd8)['then'](function(_0x1fb6bd){_0x5f48f2[_0xb53b('0x22')]=_0x1fb6bd;if(_0xf4ac1e['query']['includeAll']){_0xbf2c84[_0xb53b('0x43')]=[{'all':!![]}];}return db[_0xb53b('0x44')][_0xb53b('0x45')](_0xbf2c84);})[_0xb53b('0x2c')](function(_0xbe8529){_0x5f48f2[_0xb53b('0x46')]=_0xbe8529;return _0x5f48f2;})[_0xb53b('0x2c')](respondWithFilteredResult(_0x264091,_0xbf2c84))[_0xb53b('0x47')](handleError(_0x264091,null));};exports['show']=function(_0x192fe0,_0x271e7d){var _0x5cf133={'raw':![],'where':{'id':_0x192fe0[_0xb53b('0x48')]['id']}},_0x16a628={};_0x16a628['model']=_['keys'](db[_0xb53b('0x44')][_0xb53b('0x32')]);_0x16a628[_0xb53b('0x37')]=_[_0xb53b('0x49')](_0x192fe0['query']);_0x16a628[_0xb53b('0x38')]=_[_0xb53b('0x3a')](_0x16a628[_0xb53b('0x36')],_0x16a628[_0xb53b('0x37')]);_0x5cf133[_0xb53b('0x39')]=_[_0xb53b('0x3a')](_0x16a628[_0xb53b('0x36')],qs[_0xb53b('0x3b')](_0x192fe0[_0xb53b('0x37')][_0xb53b('0x3b')]));_0x5cf133[_0xb53b('0x39')]=_0x5cf133[_0xb53b('0x39')][_0xb53b('0x4a')]?_0x5cf133[_0xb53b('0x39')]:_0x16a628[_0xb53b('0x36')];if(_0x192fe0['query'][_0xb53b('0x4b')]){_0x5cf133['include']=[{'all':!![]}];}_0x5cf133=_[_0xb53b('0x3f')]({},_0x5cf133,_0x192fe0[_0xb53b('0x42')]);return db[_0xb53b('0x44')][_0xb53b('0x4c')](_0x5cf133)[_0xb53b('0x2c')](handleEntityNotFound(_0x271e7d,null))[_0xb53b('0x2c')](respondWithResult(_0x271e7d,null))[_0xb53b('0x47')](handleError(_0x271e7d,null));};exports['create']=function(_0x538ccd,_0x90d3b9){return db[_0xb53b('0x44')][_0xb53b('0x4d')](_0x538ccd['body'],{})['then'](respondWithResult(_0x90d3b9,0xc9))[_0xb53b('0x47')](handleError(_0x90d3b9,null));};exports['clone']=function(_0x5935ad,_0x5e5639){var _0x4172f5={'where':{'id':_0x5935ad['params']['id']}},_0x554305={};_0x554305[_0xb53b('0x36')]=_[_0xb53b('0x49')](db['UserProfile'][_0xb53b('0x32')]);_0x4172f5[_0xb53b('0x39')]=_[_0xb53b('0x3a')](_0x554305[_0xb53b('0x36')],qs[_0xb53b('0x3b')](_0x5935ad['query'][_0xb53b('0x3b')]));_0x4172f5[_0xb53b('0x39')]=_0x4172f5[_0xb53b('0x39')][_0xb53b('0x4a')]?_0x4172f5[_0xb53b('0x39')]:_0x554305[_0xb53b('0x36')];if(_0x5935ad[_0xb53b('0x37')]['includeAll']){_0x4172f5[_0xb53b('0x43')]=[{'all':!![]}];}_0x4172f5=_[_0xb53b('0x3f')]({},_0x4172f5,_0x5935ad[_0xb53b('0x42')]);return db[_0xb53b('0x44')][_0xb53b('0x4c')](_0x4172f5)[_0xb53b('0x2c')](handleEntityNotFound(_0x5e5639,null))[_0xb53b('0x2c')](function(_0x4df318){if(_0x4df318){var _0x2f098b=_0x4df318['get']({'plain':!![]});_0x2f098b=qs[_0xb53b('0x4e')](_0x2f098b,['id',_0xb53b('0x4f'),_0xb53b('0x50'),_0xb53b('0x51')]);_0x5935ad[_0xb53b('0x52')]=_[_0xb53b('0x4e')](_0x5935ad[_0xb53b('0x52')],['id',_0xb53b('0x4f'),_0xb53b('0x50')]);return db[_0xb53b('0x53')][_0xb53b('0x54')](function(_0x3e50c1){return db[_0xb53b('0x44')][_0xb53b('0x4d')](_['merge'](_0x2f098b,_0x5935ad[_0xb53b('0x52')]),{'include':_0x5935ad[_0xb53b('0x37')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x3e50c1})['then'](function(_0x354490){var _0x5637ed=_0x354490[_0xb53b('0x55')]({'plain':!![]});return db[_0xb53b('0x56')]['findAll']({'where':{'userProfileId':_0x5935ad[_0xb53b('0x48')]['id']},'raw':!![]})[_0xb53b('0x2c')](function(_0x536b30){if(_0x536b30){return BPromise['each'](_0x536b30,function(_0x5075b2){return new BPromise(function(_0x2a09b4,_0x29b9bd){if(_0x5075b2[_0xb53b('0x57')]===null||_0x5075b2[_0xb53b('0x57')]===0x1)_0x2a09b4(null);return db[_0xb53b('0x58')][_0xb53b('0x45')]({'where':{'sectionId':_0x5075b2['id']},'raw':!![]})[_0xb53b('0x2c')](function(_0x55cf73){var _0x265752=_['map'](_0x55cf73,function(_0x1ae135){return qs[_0xb53b('0x4e')](_0x1ae135,['id','createdAt',_0xb53b('0x50'),_0xb53b('0x59')]);});_0x2a09b4(_0x265752);})[_0xb53b('0x47')](function(_0x490324){_0x29b9bd(_0x490324);});})[_0xb53b('0x2c')](function(_0x4c167a){var _0x5ef690=qs['omit'](_0x5075b2,['id',_0xb53b('0x4f'),_0xb53b('0x50')]);_0x5ef690[_0xb53b('0x5a')]=_0x5637ed['id'];if(_0x4c167a)_0x5ef690[_0xb53b('0x5b')]=_0x4c167a;return _0x5ef690;})[_0xb53b('0x2c')](function(_0x3fd89e){return db[_0xb53b('0x56')][_0xb53b('0x4d')](_0x3fd89e,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x3e50c1});});})['then'](function(){return _0x5637ed;});}});});});}})['then'](respondWithResult(_0x5e5639,0xc9))['catch'](handleError(_0x5e5639,null));};exports[_0xb53b('0x2a')]=function(_0xc4f189,_0xb98a3f){if(_0xc4f189[_0xb53b('0x52')]['id']){delete _0xc4f189[_0xb53b('0x52')]['id'];}return db[_0xb53b('0x44')][_0xb53b('0x4c')]({'where':{'id':_0xc4f189[_0xb53b('0x48')]['id']}})[_0xb53b('0x2c')](handleEntityNotFound(_0xb98a3f,null))[_0xb53b('0x2c')](saveUpdates(_0xc4f189[_0xb53b('0x52')],null))[_0xb53b('0x2c')](respondWithResult(_0xb98a3f,null))[_0xb53b('0x47')](handleError(_0xb98a3f,null));};exports[_0xb53b('0x2b')]=function(_0x258e50,_0x25d0ff){return db[_0xb53b('0x44')][_0xb53b('0x4c')]({'where':{'id':_0x258e50[_0xb53b('0x48')]['id']}})[_0xb53b('0x2c')](handleEntityNotFound(_0x25d0ff,null))[_0xb53b('0x2c')](removeEntity(_0x25d0ff,null))[_0xb53b('0x47')](handleError(_0x25d0ff,null));};exports[_0xb53b('0x5c')]=function(_0x65aecd,_0x389697){return db[_0xb53b('0x44')][_0xb53b('0x5c')]()[_0xb53b('0x2c')](respondWithResult(_0x389697,null))[_0xb53b('0x47')](handleError(_0x389697,null));};exports['addSections']=function(_0x187d1b,_0x17d677){var _0x9a195f=_0x187d1b[_0xb53b('0x52')];return db[_0xb53b('0x44')]['find']({'where':{'id':_0x187d1b[_0xb53b('0x48')]['id']}})[_0xb53b('0x2c')](handleEntityNotFound(_0x17d677,null))[_0xb53b('0x2c')](function(_0x10705b){if(_0x10705b){return db[_0xb53b('0x53')]['transaction'](function(_0xbaf5c8){return db[_0xb53b('0x56')][_0xb53b('0x2b')]({'where':{'userProfileId':_0x187d1b[_0xb53b('0x48')]['id'],'sectionId':_[_0xb53b('0x31')](_0x9a195f,function(_0x3f7252){return _0x3f7252[_0xb53b('0x59')];})},'transaction':_0xbaf5c8})[_0xb53b('0x2c')](function(){var _0x403e23=_[_0xb53b('0x31')](_0x9a195f,function(_0x8dafd){_0x8dafd[_0xb53b('0x5a')]=_0x187d1b[_0xb53b('0x48')]['id'];return _0x8dafd;});var _0x48acbb=[];return BPromise[_0xb53b('0x5d')](_0x403e23,function(_0x5b12c4){return db[_0xb53b('0x56')][_0xb53b('0x4d')](_0x5b12c4,{'include':[{'model':db[_0xb53b('0x58')],'as':_0xb53b('0x5b')}],'raw':!![],'transaction':_0xbaf5c8})[_0xb53b('0x2c')](function(_0x2565f){_0x48acbb['push'](_0x2565f[_0xb53b('0x55')]({'plain':!![]}));});})[_0xb53b('0x2c')](function(){return _0x48acbb;});});});}})[_0xb53b('0x2c')](function(_0x5e3877){return _0x5e3877;})['then'](respondWithResult(_0x17d677,null))[_0xb53b('0x47')](handleError(_0x17d677,null));};exports[_0xb53b('0x5e')]=function(_0x3fb4a7,_0x257a2d){var _0x64ae7;return db[_0xb53b('0x44')][_0xb53b('0x4c')]({'where':{'id':_0x3fb4a7['params']['id']},'attributes':['id',_0xb53b('0x2f')]})[_0xb53b('0x2c')](handleEntityNotFound(_0x257a2d,null))['then'](function(_0x4013dd){if(_0x4013dd){_0x64ae7=_0x4013dd;return db[_0xb53b('0x56')][_0xb53b('0x2b')]({'where':{'userProfileId':_0x3fb4a7['params']['id'],'sectionId':_0x3fb4a7[_0xb53b('0x37')]['ids']}});}})[_0xb53b('0x2c')](function(){return _0x64ae7;})[_0xb53b('0x2c')](respondWithStatusCode(_0x257a2d,null))[_0xb53b('0x47')](handleError(_0x257a2d,null));};exports[_0xb53b('0x5f')]=function(_0x58dc6a,_0x3d9e48){var _0x3fbf76=[];var _0x5ba3f8=[];return db[_0xb53b('0x56')][_0xb53b('0x45')]({'where':{'userProfileId':_0x58dc6a[_0xb53b('0x48')]['id']},'raw':!![]})[_0xb53b('0x2c')](function(_0x551ef0){_0x3fbf76=_[_0xb53b('0x41')](_0x551ef0,function(_0x286e14){return _0x286e14[_0xb53b('0x60')]===0x1||_['includes']([0x3eb,0x709],_0x286e14[_0xb53b('0x59')]);});if(!_[_0xb53b('0x61')](_0x3fbf76)){return _[_0xb53b('0x31')](_0x3fbf76,function(_0x2279dd){return _0x2279dd[_0xb53b('0x59')];});}else{return;}})[_0xb53b('0x2c')](function(_0xd52147){if(_0xd52147)_0x5ba3f8=_0xd52147;if(_['includes'](_0x5ba3f8,0x64)){var _0x53f810=_[_0xb53b('0x4c')](_0x3fbf76,{'sectionId':0x64});return hasDefaultDashboard(_0x53f810)[_0xb53b('0x2c')](function(_0x488cee){return _[_0xb53b('0x31')](_0x3fbf76,function(_0x3084a9){if(_0x3084a9[_0xb53b('0x59')]===0x64){_0x3084a9['subsections']=_0x488cee;}return _0x3084a9;});});}else{return;}})[_0xb53b('0x2c')](function(_0x3d75c7){if(_0x3d75c7)_0x3fbf76=_0x3d75c7;if(_[_0xb53b('0x62')](_0x5ba3f8,0x3eb)){var _0x36ced1=_[_0xb53b('0x4c')](_0x3fbf76,{'sectionId':0x3eb});return getCustomDashboards(_0x36ced1)[_0xb53b('0x2c')](function(_0x5579f6){return _['map'](_0x3fbf76,function(_0x4e6c0c){if(_0x36ced1[_0xb53b('0x60')]){if(_0x4e6c0c[_0xb53b('0x59')]===0x3eb){_0x4e6c0c[_0xb53b('0x63')]=_0x5579f6;}}else{if(_0x4e6c0c['sectionId']===0x64){_0x4e6c0c['subsections']=_0x5579f6;}}return _0x4e6c0c;});});}else{return;}})[_0xb53b('0x2c')](function(_0x3aadd4){if(_0x3aadd4)_0x3fbf76=_0x3aadd4;if(_['includes'](_0x5ba3f8,0x709)){var _0x102588=_['find'](_0x3fbf76,{'sectionId':0x709});return getPlugins(_0x102588)[_0xb53b('0x2c')](function(_0x73b744){if(_0x102588[_0xb53b('0x60')]){return _[_0xb53b('0x31')](_0x3fbf76,function(_0x2c232c){if(_0x2c232c['sectionId']===0x709){_0x2c232c['subsections']=_0x73b744;}return _0x2c232c;});}else{var _0xc6e925={'sectionId':0x76c,'enabled':0x1,'subsections':_0x73b744};var _0xcee393=_[_0xb53b('0x31')](_0x3fbf76);_0xcee393[_0xb53b('0x64')](_0xc6e925);return _0xcee393;}});}else{return;}})['then'](function(_0x2eb6d3){if(_0x2eb6d3)_0x3fbf76=_0x2eb6d3;return _[_0xb53b('0x41')](_0x3fbf76,[_0xb53b('0x60'),0x1]);})['then'](respondWithResult(_0x3d9e48,null))[_0xb53b('0x47')](handleError(_0x3d9e48,null));};function hasDefaultDashboard(_0xfe950f){var _0x571acc=[0x65];return new BPromise(function(_0x509c26,_0x27cf30){try{if(_0xfe950f['autoAssociation']){_0x509c26(_0x571acc);}else{return db[_0xb53b('0x58')][_0xb53b('0x65')]({'where':{'sectionId':_0xfe950f['id']},'raw':!![]})[_0xb53b('0x2c')](function(_0x5bb658){_0x5bb658?_0x509c26(_0x571acc):_0x509c26();});}}catch(_0xf5d055){_0x27cf30(_0xf5d055);}});}function getCustomDashboards(_0x294666){var _0x2e8543=[];return new BPromise(function(_0x2ed83e,_0x536050){try{if(_0x294666[_0xb53b('0x57')]){return db[_0xb53b('0x66')][_0xb53b('0x45')]({'raw':!![]})[_0xb53b('0x2c')](function(_0x59db4c){_0x59db4c['forEach'](function(_0x372beb){_0x2e8543[_0xb53b('0x64')](_0x372beb['id']+0x1869f);});_0x2ed83e(_0x2e8543);});}else{return db['UserProfileResource'][_0xb53b('0x45')]({'where':{'sectionId':_0x294666['id']},'raw':!![]})[_0xb53b('0x2c')](function(_0x213b23){_0x213b23[_0xb53b('0x67')](function(_0x2e7669){_0x2e8543[_0xb53b('0x64')](_0x2e7669['resourceId']+0x1869f);});_0x2ed83e(_0x2e8543);});}}catch(_0x562de8){_0x536050(_0x562de8);}});}function getPlugins(_0x36d372){var _0x33159a=[];return new BPromise(function(_0xd2cfd,_0x13e976){try{if(_0x36d372[_0xb53b('0x57')]){return db['Plugin']['findAll']({'raw':!![]})[_0xb53b('0x2c')](function(_0x552858){_0x552858[_0xb53b('0x67')](function(_0x590e83){_0x33159a[_0xb53b('0x64')](_0x590e83['id']+0x15b38);});_0xd2cfd(_0x33159a);});}else{return db[_0xb53b('0x58')][_0xb53b('0x45')]({'where':{'sectionId':_0x36d372['id']},'raw':!![]})[_0xb53b('0x2c')](function(_0x2c8f41){_0x2c8f41[_0xb53b('0x67')](function(_0x3eebe4){_0x33159a['push'](_0x3eebe4[_0xb53b('0x68')]+0x15b38);});_0xd2cfd(_0x33159a);});}}catch(_0x34fdfc){_0x13e976(_0x34fdfc);}});}exports[_0xb53b('0x69')]=function(_0x15becc,_0x20eff5){return db[_0xb53b('0x44')]['find']({'where':{'id':_0x15becc['params']['id']}})[_0xb53b('0x2c')](handleEntityNotFound(_0x20eff5,null))[_0xb53b('0x2c')](function(_0x41bbc4){if(_0x41bbc4){return db[_0xb53b('0x53')][_0xb53b('0x54')](function(_0x925bd0){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x15becc[_0xb53b('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0xb53b('0x2c')](function(_0x2545ce){if(_0x2545ce){return db[_0xb53b('0x56')][_0xb53b('0x2b')]({'where':{'userProfileId':_0x15becc[_0xb53b('0x48')]['id'],'id':_[_0xb53b('0x31')](_0x2545ce,function(_0x5da9eb){return _0x5da9eb['id'];})},'transaction':_0x925bd0});}})['then'](function(_0x6e78fd){var _0x5c3044=_[_0xb53b('0x31')](_0x15becc[_0xb53b('0x52')],function(_0xefd015){_0xefd015[_0xb53b('0x5a')]=_0x15becc[_0xb53b('0x48')]['id'];return _0xefd015;});return db['UserProfileSection']['bulkCreate'](_0x5c3044,{'raw':!![],'transaction':_0x925bd0});})[_0xb53b('0x2c')](function(_0x43d989){var _0x45bdec=_[_0xb53b('0x41')](_['map'](_0x43d989,function(_0x754669){return _0x754669[_0xb53b('0x55')]({'plain':!![]});}),{'includeAll':![]});if(_0x45bdec){return db[_0xb53b('0x56')][_0xb53b('0x45')]({'where':{'userProfileId':_0x15becc[_0xb53b('0x48')]['id'],'sectionId':_[_0xb53b('0x31')](_0x45bdec,function(_0x231e24){return _0x231e24['sectionId'];})},'attributes':['id',_0xb53b('0x59')],'raw':!![]})['then'](function(_0x10f1a0){var _0x5058a4=_['map'](_0x15becc[_0xb53b('0x52')],function(_0x17b3b8){_0x17b3b8[_0xb53b('0x5a')]=_0x15becc['params']['id'];return _0x17b3b8;});return db[_0xb53b('0x58')][_0xb53b('0x6a')](_0x5058a4,{'raw':!![],'transaction':_0x925bd0});});}})[_0xb53b('0x47')](handleError(_0x20eff5,null));});}})['then'](function(_0x1c355f){var _0xd17d85=_[_0xb53b('0x31')](_0x1c355f,function(_0xf23647){return _0xf23647[_0xb53b('0x55')]({'plain':!![]});});})[_0xb53b('0x2c')](respondWithResult(_0x20eff5,null))[_0xb53b('0x47')](handleError(_0x20eff5,null));};exports['removeResources']=function(_0x5650ec,_0x522350,_0x12e840){return db[_0xb53b('0x44')][_0xb53b('0x4c')]({'where':{'id':_0x5650ec[_0xb53b('0x48')]['id']}})[_0xb53b('0x2c')](handleEntityNotFound(_0x522350,null))[_0xb53b('0x2c')](function(_0x5a5a4b){if(_0x5a5a4b){return _0x5a5a4b[_0xb53b('0x6b')](_0x5650ec[_0xb53b('0x37')][_0xb53b('0x6c')]);}})[_0xb53b('0x2c')](respondWithStatusCode(_0x522350,null))['catch'](handleError(_0x522350,null));};exports[_0xb53b('0x6d')]=function(_0xe3774a,_0x352efd){var _0x58f77c={'raw':![],'where':{}};var _0x25e3aa={};var _0x30be84={'count':0x0,'rows':[]};var _0x299485=_0xe3774a[_0xb53b('0x37')][_0xb53b('0x6e')];if(typeof _0x299485===_0xb53b('0x6f')){throw new db['Sequelize'][(_0xb53b('0x70'))](_0xb53b('0x71'));}var _0x2a29cd=_0xe3774a[_0xb53b('0x37')]['mergeResources']||![];var _0x2d3696=getQueryModels(_0x299485,_0x2a29cd);if(typeof _0x2d3696[_0xb53b('0x72')]==='undefined'){throw new db[(_0xb53b('0x73'))][(_0xb53b('0x70'))](_0xb53b('0x74')+_0x299485+'\x27');}var _0x1bfd45=[];if(!_[_0xb53b('0x61')](_0x2d3696[_0xb53b('0x75')])){_0x1bfd45=_0x2d3696['parentSections'];}else{_0x1bfd45=[{'name':_0x299485}];}return db[_0xb53b('0x44')][_0xb53b('0x65')]({'where':{'id':_0xe3774a['params']['id']}})['then'](handleEntityNotFound(_0x352efd,null))[_0xb53b('0x2c')](function(_0x30d665){if(_0x30d665){var _0x2914b2=[];for(var _0x366d1d=0x0;_0x366d1d<_0x1bfd45[_0xb53b('0x4a')];_0x366d1d++){_0x2914b2[_0xb53b('0x64')](db[_0xb53b('0x56')][_0xb53b('0x65')]({'where':{'userProfileId':_0x30d665['id'],'name':_0x1bfd45[_0x366d1d][_0xb53b('0x2f')]},'raw':!![]}));}return BPromise[_0xb53b('0x76')](_0x2914b2);}})['then'](function(_0x476c22){var _0x54b078=_['filter'](_0x476c22,function(_0x1e39db){return _0x1e39db?_0x1e39db:undefined;});var _0x1791dd=_[_0xb53b('0x41')](_0x1bfd45,['ignore',!![]]);var _0x3b6423=_[_0xb53b('0x61')](_0x54b078)&&_[_0xb53b('0x61')](_0x1791dd)?null:_['union'](_0x1791dd,_0x54b078);if(_0x3b6423){var _0x424514=[];for(var _0x5a3f5f=0x0;_0x5a3f5f<_0x3b6423['length'];_0x5a3f5f++){var _0x219484=_[_0xb53b('0x4c')](_0x1bfd45,function(_0x30999e){return _0x3b6423[_0x5a3f5f]?_0x30999e[_0xb53b('0x2f')]===_0x3b6423[_0x5a3f5f]['name']:null;});if(_0x219484){if(_0x3b6423[_0x5a3f5f][_0xb53b('0x77')]){_0x424514['push'](getAllResources(_0x2d3696[_0xb53b('0x72')],_0x3b6423[_0x5a3f5f]));}else{if(!_0x3b6423[_0x5a3f5f][_0xb53b('0x57')]){_0x424514[_0xb53b('0x64')](getAllowedResources(_0x219484,_0x3b6423[_0x5a3f5f],_0x2d3696[_0xb53b('0x72')]));}else{if(_0x219484[_0xb53b('0x36')]){_0x424514[_0xb53b('0x64')](getAllFilteredResources(_0x219484,_0x3b6423[_0x5a3f5f]));}}}}}return BPromise[_0xb53b('0x76')](_0x424514);}else{return null;}})[_0xb53b('0x2c')](function(_0x42f7af){var _0x56e23b=_0x42f7af;var _0x21e8d9=null;if(_0x56e23b){_0x21e8d9=_0x56e23b[_0xb53b('0x4a')]===0x1?_0x56e23b[0x0]:null;}if(_0x21e8d9||_0x56e23b){var _0xb55b58=db[_0x2d3696[_0xb53b('0x72')]][_0xb53b('0x32')];_0x25e3aa[_0xb53b('0x36')]=_['keys'](_0xb55b58);_0x25e3aa[_0xb53b('0x37')]=_[_0xb53b('0x49')](_0xe3774a[_0xb53b('0x37')]);_0x25e3aa[_0xb53b('0x38')]=_['intersection'](_0x25e3aa[_0xb53b('0x36')],_0x25e3aa[_0xb53b('0x37')]);_0x58f77c['attributes']=_[_0xb53b('0x3a')](_0x25e3aa[_0xb53b('0x36')],qs[_0xb53b('0x3b')](_0xe3774a[_0xb53b('0x37')][_0xb53b('0x3b')]));_0x58f77c[_0xb53b('0x39')]=_0x58f77c['attributes']['length']?_0x58f77c[_0xb53b('0x39')]:_0x25e3aa['model'];if(!_0xe3774a[_0xb53b('0x37')][_0xb53b('0x3c')](_0xb53b('0x78'))){_0x58f77c[_0xb53b('0x24')]=qs[_0xb53b('0x24')](_0xe3774a[_0xb53b('0x37')][_0xb53b('0x24')]);_0x58f77c[_0xb53b('0x23')]=qs['offset'](_0xe3774a[_0xb53b('0x37')][_0xb53b('0x23')]);}_0x58f77c[_0xb53b('0x3d')]=qs[_0xb53b('0x3e')](_0xe3774a[_0xb53b('0x37')][_0xb53b('0x3e')]);_0x58f77c['where']=qs[_0xb53b('0x38')](_[_0xb53b('0x79')](_0xe3774a[_0xb53b('0x37')],_0x25e3aa['filters']));if(_0xe3774a[_0xb53b('0x37')]['filter']){_0x58f77c[_0xb53b('0x40')]=_[_0xb53b('0x3f')](_0x58f77c[_0xb53b('0x40')],{'$or':_['map'](_0xb55b58,function(_0xd5446e){if(_0xd5446e[_0xb53b('0x34')][_0xb53b('0x35')]!==_0xb53b('0x7a')){var _0x1c6df6={};_0x1c6df6[_0xd5446e['field']]={'$like':'%'+_0xe3774a[_0xb53b('0x37')][_0xb53b('0x41')]+'%'};return _0x1c6df6;}})});}var _0x529eac=[];if(_0x21e8d9){var _0x1d9893=_[_0xb53b('0x4c')](_0x1bfd45,[_0xb53b('0x2f'),_0x21e8d9['name']]);if(_0x1d9893[_0xb53b('0x7b')]){var _0x4be141={};if(_0x2d3696['childModel']===_0xb53b('0x7c')){_0x4be141[_0x1d9893['foreignKey']]=_['map'](_0x21e8d9[_0xb53b('0x7d')],'id');}else{_0x4be141[_0x1d9893[_0xb53b('0x7e')]]=_0x21e8d9[_0xb53b('0x7d')];}_0x529eac['push'](_0x4be141);}else{_0x58f77c['where']['id']=_0x21e8d9[_0xb53b('0x7d')];}}else{for(var _0x43c31f=0x0;_0x43c31f<_0x56e23b[_0xb53b('0x4a')];_0x43c31f++){var _0x1d9893=_[_0xb53b('0x4c')](_0x1bfd45,[_0xb53b('0x2f'),_0x56e23b[_0x43c31f][_0xb53b('0x2f')]]);if(_0x1d9893[_0xb53b('0x7b')]){var _0x4be141={};_0x4be141[_0x1d9893[_0xb53b('0x7e')]]=_0x56e23b[_0x43c31f][_0xb53b('0x7d')];_0x529eac[_0xb53b('0x64')](_0x4be141);}else{if(!_0x58f77c[_0xb53b('0x40')]['id'])_0x58f77c[_0xb53b('0x40')]['id']=[];_0x56e23b[_0x43c31f][_0xb53b('0x7d')][_0xb53b('0x67')](function(_0x2aafeb){_0x58f77c[_0xb53b('0x40')]['id'][_0xb53b('0x64')](_0x2aafeb);});}}}if(!_[_0xb53b('0x61')](_0x529eac)){_0x58f77c['where']=_['merge'](_0x58f77c[_0xb53b('0x40')],{'$and':{'$or':_0x529eac}});}_0x58f77c=_[_0xb53b('0x3f')]({},_0x58f77c,_0xe3774a['options']);if(_0x21e8d9&&!_0x21e8d9[_0xb53b('0x57')]&&_0x2d3696[_0xb53b('0x72')]===_0xb53b('0x7c')){if(_0xe3774a[_0xb53b('0x37')][_0xb53b('0x4b')]){_0x58f77c[_0xb53b('0x43')]=[{'all':!![]}];}return db[_0x2d3696[_0xb53b('0x72')]][_0xb53b('0x45')](_0x58f77c)[_0xb53b('0x2c')](function(_0x1e2c44){var _0x43e332=[];_0x1e2c44[_0xb53b('0x67')](function(_0xfd6e84){var _0x4c1f6d;switch(_0xfd6e84[_0xb53b('0x7f')]){case'default':_0x4c1f6d=_[_0xb53b('0x4c')](_0x21e8d9[_0xb53b('0x7d')],function(_0x4429aa){return _0x4429aa['id']===_0xfd6e84[_0xb53b('0x80')]&&_0x4429aa[_0xb53b('0x34')]===_0xb53b('0x81');});break;case _0xb53b('0x82'):_0x4c1f6d=_[_0xb53b('0x4c')](_0x21e8d9['associatedResources'],function(_0x281bed){return _0x281bed['id']===_0xfd6e84['reportId']&&_0x281bed['type']===_0xb53b('0x83');});break;}if(_0x4c1f6d)_0x43e332[_0xb53b('0x64')](_0xfd6e84);});_0x30be84['count']=_0x43e332[_0xb53b('0x4a')];_0x30be84[_0xb53b('0x46')]=_0x43e332;return _0x30be84;});}else{return db[_0x2d3696[_0xb53b('0x72')]][_0xb53b('0x22')]({'where':_0x58f77c['where']})['then'](function(_0x11580b){_0x30be84['count']=_0x11580b;if(_0xe3774a[_0xb53b('0x37')][_0xb53b('0x4b')]){if(_0x2d3696['childModel']===_0xb53b('0x84')){_0x58f77c[_0xb53b('0x43')]=[{'model':db[_0xb53b('0x85')],'as':_0xb53b('0x86'),'attributes':['id',_0xb53b('0x2f'),_0xb53b('0x87')],'required':_0xe3774a[_0xb53b('0x37')][_0xb53b('0x88')]?!![]:![]},{'model':db[_0xb53b('0x85')],'as':_0xb53b('0x89'),'attributes':['id',_0xb53b('0x2f'),_0xb53b('0x87')],'through':_0xe3774a[_0xb53b('0x37')][_0xb53b('0x88')]?{'attributes':[],'where':{'TagId':_0xe3774a['query'][_0xb53b('0x88')]||undefined}}:{},'required':_0xe3774a[_0xb53b('0x37')]['tag']?!![]:![]}];}else{_0x58f77c[_0xb53b('0x43')]=[{'all':!![]}];}}return db[_0x2d3696[_0xb53b('0x72')]]['findAll'](_0x58f77c);})[_0xb53b('0x2c')](function(_0x5f2ef4){_0x30be84[_0xb53b('0x46')]=_0x5f2ef4;return _0x30be84;});}}else{return _0x30be84;}})[_0xb53b('0x2c')](respondWithFilteredResult(_0x352efd,_0x58f77c))['catch'](handleError(_0x352efd,null));};function getAllResources(_0xec2f77,_0x55c458){return new BPromise(function(_0x26c4f4,_0x52321e){if(_0x55c458){var _0x3d705e=_0x55c458[_0xb53b('0x41')]?{[_0x55c458['filter'][_0xb53b('0x7b')]]:_0x55c458[_0xb53b('0x41')]['value']}:undefined;return db[_0xec2f77]['findAll']({'where':_0x3d705e,'raw':!![]})['then'](function(_0x5d8adc){_0x55c458[_0xb53b('0x7d')]=_[_0xb53b('0x31')](_0x5d8adc,'id');_0x26c4f4(_0x55c458);})[_0xb53b('0x47')](function(_0x1aadff){_0x52321e(_0x1aadff);});}else{_0x26c4f4(null);}});}function getAllFilteredResources(_0x36b9fd,_0x1d24f6){return new BPromise(function(_0x526c11,_0x52e8dd){var _0xf6a05e=_0x36b9fd[_0xb53b('0x41')]?{[_0x36b9fd['filter'][_0xb53b('0x7b')]]:_0x36b9fd[_0xb53b('0x41')][_0xb53b('0x8a')]}:undefined;return db[_0x36b9fd['model']]['findAll']({'where':_0xf6a05e,'raw':!![]})[_0xb53b('0x2c')](function(_0x29cf3e){_0x1d24f6[_0xb53b('0x7d')]=_['map'](_0x29cf3e,function(_0x3ededf){return _0x3ededf[_0xb53b('0x2f')];});_0x526c11(_0x1d24f6);})[_0xb53b('0x47')](function(_0x5b4312){_0x52e8dd(_0x5b4312);});});}function getAllowedResources(_0x2ca5c1,_0x3a9231,_0x422d4f){return new BPromise(function(_0x2fe14f,_0x30ba9c){if(_0x3a9231){return db[_0xb53b('0x58')][_0xb53b('0x45')]({'where':{'sectionId':_0x3a9231['id']},'raw':!![]})[_0xb53b('0x2c')](function(_0x4de30b){if(_0x2ca5c1[_0xb53b('0x7b')]&&_0x2ca5c1[_0xb53b('0x7b')]!=='id'){_0x3a9231[_0xb53b('0x7d')]=_[_0xb53b('0x31')](_0x4de30b,function(_0x10732c){return _0x10732c[_0x2ca5c1[_0xb53b('0x7b')]];});}else{if(_0x422d4f==='AnalyticExtractedReport'){_0x3a9231[_0xb53b('0x7d')]=_[_0xb53b('0x31')](_0x4de30b,function(_0x48e5d9){return{'id':_0x48e5d9[_0xb53b('0x68')],'type':_0x48e5d9[_0xb53b('0x34')]};});}else{_0x3a9231['associatedResources']=_[_0xb53b('0x31')](_0x4de30b,function(_0x388b1){return _0x388b1[_0xb53b('0x68')];});}}_0x2fe14f(_0x3a9231);})[_0xb53b('0x47')](function(_0x4fdd7c){_0x30ba9c(_0x4fdd7c);});}else{_0x2fe14f(null);}});}function getQueryModels(_0x18c9dd,_0x5169c8){var _0x5c77d0=_0x18c9dd[_0xb53b('0x8b')]();var _0x54f7db={'childModel':undefined,'parentSections':[]};switch(_0x5c77d0){case _0xb53b('0x8c'):_0x54f7db[_0xb53b('0x72')]=_0xb53b('0x8d');break;case _0xb53b('0x8e'):_0x54f7db[_0xb53b('0x72')]='SquareOdbc';break;case'squarerecordings':_0x54f7db[_0xb53b('0x72')]=_0xb53b('0x8f');_0x54f7db['parentSections']=[{'name':_0xb53b('0x90'),'field':_0xb53b('0x2f'),'foreignKey':'projectName'}];break;case _0xb53b('0x91'):_0x54f7db[_0xb53b('0x72')]=_0xb53b('0x92');break;case _0xb53b('0x93'):_0x54f7db[_0xb53b('0x72')]=_0xb53b('0x84');_0x54f7db['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0xb53b('0x94')}];break;case _0xb53b('0x95'):_0x54f7db[_0xb53b('0x72')]=_0xb53b('0x96');break;case'companies':_0x54f7db['childModel']=_0xb53b('0x97');break;case'globalcustomfields':_0x54f7db['childModel']=_0xb53b('0x98');break;case'chatqueues':_0x54f7db[_0xb53b('0x72')]=_0xb53b('0x99');break;case _0xb53b('0x9a'):_0x54f7db[_0xb53b('0x72')]=_0xb53b('0x9b');break;case'faxqueues':_0x54f7db[_0xb53b('0x72')]=_0xb53b('0x9c');break;case _0xb53b('0x9d'):_0x54f7db['childModel']=_0xb53b('0x9e');break;case _0xb53b('0x9f'):case _0xb53b('0xa0'):case _0xb53b('0xa1'):_0x54f7db[_0xb53b('0x72')]='VoiceExtension';break;case _0xb53b('0xa2'):_0x54f7db[_0xb53b('0x72')]='VoiceContext';break;case _0xb53b('0xa3'):_0x54f7db['childModel']=_0xb53b('0xa4');break;case _0xb53b('0xa5'):_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xa6');_0x54f7db[_0xb53b('0x75')]=[{'name':_0xb53b('0xa7'),'field':'name','foreignKey':_0xb53b('0xa8'),'model':_0xb53b('0xa9'),'filter':{'field':_0xb53b('0xaa'),'value':[_0xb53b('0xab')]}},{'name':'Telephones','field':_0xb53b('0x2f'),'foreignKey':'membername','model':'User','filter':{'field':'role','value':[_0xb53b('0xac')]}},{'name':_0xb53b('0xad'),'field':_0xb53b('0x2f'),'foreignKey':'queue','model':_0xb53b('0xae'),'filter':{'field':'type','value':[_0xb53b('0xaf')]}},{'name':'QueueCampaigns','field':'name','foreignKey':_0xb53b('0xb0'),'model':_0xb53b('0xae'),'filter':{'field':'type','value':[_0xb53b('0xb1')]}}];break;case _0xb53b('0xb2'):_0x54f7db[_0xb53b('0x72')]='VoiceMusicOnHold';break;case'chanspies':_0x54f7db['childModel']=_0xb53b('0xb3');break;case _0xb53b('0xb4'):_0x54f7db['childModel']='VoicePrefix';break;case _0xb53b('0xb5'):_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xb6');break;case _0xb53b('0xb7'):_0x54f7db[_0xb53b('0x72')]='MailQueue';break;case _0xb53b('0xb8'):_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xb9');break;case _0xb53b('0xba'):_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xbb');break;case'openchannelqueues':_0x54f7db[_0xb53b('0x72')]='OpenchannelQueue';break;case _0xb53b('0xbc'):_0x54f7db['childModel']='OpenchannelAccount';break;case _0xb53b('0xbd'):_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xbe');break;case _0xb53b('0xbf'):_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xc0');break;case _0xb53b('0xc1'):_0x54f7db['childModel']=_0xb53b('0xc2');break;case _0xb53b('0xc3'):_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xc4');break;case'teams':_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xc5');break;case _0xb53b('0xc6'):case _0xb53b('0xc7'):_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xae');if(_0x5169c8){_0x54f7db['parentSections']=[{'name':_0xb53b('0xad')},{'name':_0xb53b('0xc8')}];}break;case _0xb53b('0xc9'):case'agents':case'telephones':_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xa9');if(_0x5169c8){_0x54f7db[_0xb53b('0x75')]=[{'name':_0xb53b('0xca'),'filter':{'field':_0xb53b('0xaa'),'value':[_0xb53b('0xcb'),_0xb53b('0xcc')]},'ignore':!![]},{'name':'Agents'},{'name':_0xb53b('0xcd')}];}break;case _0xb53b('0xce'):_0x54f7db[_0xb53b('0x72')]='ZendeskAccount';break;case _0xb53b('0xcf'):_0x54f7db[_0xb53b('0x72')]='SalesforceAccount';break;case'freshdeskaccounts':_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xd0');break;case _0xb53b('0xd1'):_0x54f7db[_0xb53b('0x72')]='SugarcrmAccount';break;case'deskaccounts':_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xd2');break;case _0xb53b('0xd3'):_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xd4');break;case'vtigeraccounts':_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xa9');break;case _0xb53b('0xd5'):_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xd6');break;case'dispositions':_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xd7');break;case _0xb53b('0xd8'):_0x54f7db[_0xb53b('0x72')]=_0xb53b('0x66');break;case'intervals':_0x54f7db[_0xb53b('0x72')]='Interval';break;case _0xb53b('0xd9'):_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xda');break;case _0xb53b('0xdb'):_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xdc');break;case _0xb53b('0xdd'):_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xde');break;case _0xb53b('0xdf'):_0x54f7db[_0xb53b('0x72')]='Tag';break;case _0xb53b('0xe0'):_0x54f7db['childModel']='Template';break;case _0xb53b('0xe1'):_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xe2');break;case _0xb53b('0xe3'):_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xe4');break;case _0xb53b('0xe5'):_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xe6');break;case'plugins':_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xe7');break;case _0xb53b('0xe8'):_0x54f7db[_0xb53b('0x72')]='AnalyticExtractedReport';_0x54f7db[_0xb53b('0x75')]=[{'name':_0xb53b('0xe9'),'field':'id','foreignKey':'reportId'}];break;case _0xb53b('0xea'):_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xeb');break;case _0xb53b('0xc3'):_0x54f7db[_0xb53b('0x72')]=_0xb53b('0xc4');break;default:return _0x54f7db;}return _0x54f7db;} \ No newline at end of file +var _0x03b5=['includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','params','createdAt','updatedAt','crudPermissions','body','omit','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','push','get','removeSections','ids','getSections','isEmpty','subsections','includes','enabled','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','undefined','mergeResources','childModel','ValidationError','Invalid\x20section\x20\x27','parentSections','findOne','union','field','foreignKey','associatedResources','reportType','reportId','DefaultReports','custom','CustomReports','CmContact','Tag','Tags','color','tag','ThroughTags','value','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','JscriptyProject','contacts','Lists','lists','CmList','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','agent','Telephones','membername','telephone','VoiceQueues','inbound','queue','VoiceQueue','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','users','agents','telephones','role','admin','zendeskaccounts','ZendeskAccount','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','pauses','scheduler','Schedule','Sound','tags','triggers','Trigger','trunks','Trunk','variables','Variable','extractedreports','AnalyticExtractedReport','Reports','metrics','AnalyticMetric','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','index','map','UserProfile','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options'];(function(_0x44dbf9,_0x149390){var _0x29be86=function(_0x8be0d8){while(--_0x8be0d8){_0x44dbf9['push'](_0x44dbf9['shift']());}};_0x29be86(++_0x149390);}(_0x03b5,0xa9));var _0x503b=function(_0x521881,_0x124873){_0x521881=_0x521881-0x0;var _0x1a372f=_0x03b5[_0x521881];return _0x1a372f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x503b('0x0'));var rimraf=require(_0x503b('0x1'));var zipdir=require(_0x503b('0x2'));var jsonpatch=require(_0x503b('0x3'));var rp=require(_0x503b('0x4'));var moment=require(_0x503b('0x5'));var BPromise=require(_0x503b('0x6'));var Mustache=require(_0x503b('0x7'));var util=require('util');var path=require(_0x503b('0x8'));var sox=require('sox');var csv=require(_0x503b('0x9'));var ejs=require(_0x503b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x503b('0xb'));var crypto=require(_0x503b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x503b('0x9'));var querystring=require(_0x503b('0xd'));var Papa=require('papaparse');var Redis=require(_0x503b('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x503b('0xf'));var hardwareService=require(_0x503b('0x10'));var logger=require('../../config/logger')(_0x503b('0x11'));var utils=require(_0x503b('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x503b('0x13')]=_['defaults'](config[_0x503b('0x13')],{'host':_0x503b('0x14'),'port':0x18eb});var socket=require(_0x503b('0x15'))(new Redis(config['redis']));require(_0x503b('0x16'))['register'](socket);function respondWithStatusCode(_0x5b2080,_0x4f2354){_0x4f2354=_0x4f2354||0xcc;return function(_0x313d1f){if(_0x313d1f){return _0x5b2080[_0x503b('0x17')](_0x4f2354);}return _0x5b2080[_0x503b('0x18')](_0x4f2354)['end']();};}function respondWithResult(_0x36e046,_0x2c212f){_0x2c212f=_0x2c212f||0xc8;return function(_0x526dd5){if(_0x526dd5){return _0x36e046['status'](_0x2c212f)[_0x503b('0x19')](_0x526dd5);}};}function respondWithFilteredResult(_0xd87d2e,_0x4f1224){return function(_0x3f54f7){if(_0x3f54f7){var _0xcabd31=_0x3f54f7[_0x503b('0x1a')],_0x221f44=_0x4f1224[_0x503b('0x1b')],_0x5e02e8=_0x4f1224[_0x503b('0x1b')]+_0x4f1224[_0x503b('0x1c')],_0x73981b;if(_0x5e02e8>=_0xcabd31){_0x5e02e8=_0xcabd31;_0x73981b=0xc8;}else{_0x73981b=0xce;}_0xd87d2e[_0x503b('0x18')](_0x73981b);return _0xd87d2e[_0x503b('0x1d')](_0x503b('0x1e'),_0x221f44+'-'+_0x5e02e8+'/'+_0xcabd31)[_0x503b('0x19')](_0x3f54f7);}return null;};}function patchUpdates(_0x139ca2){return function(_0x5a77f6){try{jsonpatch[_0x503b('0x1f')](_0x5a77f6,_0x139ca2,!![]);}catch(_0x5f33c8){return BPromise[_0x503b('0x20')](_0x5f33c8);}return _0x5a77f6[_0x503b('0x21')]();};}function saveUpdates(_0x337a00,_0x354371){return function(_0x34b538){if(_0x34b538){return _0x34b538[_0x503b('0x22')](_0x337a00)[_0x503b('0x23')](function(_0x58b641){return _0x58b641;});}return null;};}function removeEntity(_0x3bbc73,_0x49cfda){return function(_0x64969d){if(_0x64969d){return _0x64969d[_0x503b('0x24')]()['then'](function(){_0x3bbc73['status'](0xcc)[_0x503b('0x25')]();});}};}function handleEntityNotFound(_0x20699f,_0xa7a6c2){return function(_0x1dc880){if(!_0x1dc880){_0x20699f[_0x503b('0x17')](0x194);}return _0x1dc880;};}function handleError(_0x266e60,_0x5c7aa4){_0x5c7aa4=_0x5c7aa4||0x1f4;return function(_0x3ed291){logger['error'](_0x3ed291[_0x503b('0x26')]);if(_0x3ed291[_0x503b('0x27')]){delete _0x3ed291[_0x503b('0x27')];}_0x266e60[_0x503b('0x18')](_0x5c7aa4)['send'](_0x3ed291);};}exports[_0x503b('0x28')]=function(_0x508d5f,_0x21de37){var _0x320325={},_0x43775d={},_0x5e5878={'count':0x0,'rows':[]};var _0x32b2ba=_[_0x503b('0x29')](db[_0x503b('0x2a')]['rawAttributes'],function(_0x7ef4ce){return{'name':_0x7ef4ce[_0x503b('0x2b')],'type':_0x7ef4ce[_0x503b('0x2c')][_0x503b('0x2d')]};});_0x43775d[_0x503b('0x2e')]=_['map'](_0x32b2ba,_0x503b('0x27'));_0x43775d[_0x503b('0x2f')]=_[_0x503b('0x30')](_0x508d5f[_0x503b('0x2f')]);_0x43775d[_0x503b('0x31')]=_[_0x503b('0x32')](_0x43775d[_0x503b('0x2e')],_0x43775d[_0x503b('0x2f')]);_0x320325[_0x503b('0x33')]=_[_0x503b('0x32')](_0x43775d[_0x503b('0x2e')],qs['fields'](_0x508d5f[_0x503b('0x2f')][_0x503b('0x34')]));_0x320325[_0x503b('0x33')]=_0x320325[_0x503b('0x33')][_0x503b('0x35')]?_0x320325[_0x503b('0x33')]:_0x43775d['model'];if(!_0x508d5f['query'][_0x503b('0x36')](_0x503b('0x37'))){_0x320325['limit']=qs[_0x503b('0x1c')](_0x508d5f[_0x503b('0x2f')][_0x503b('0x1c')]);_0x320325[_0x503b('0x1b')]=qs['offset'](_0x508d5f[_0x503b('0x2f')][_0x503b('0x1b')]);}_0x320325[_0x503b('0x38')]=qs['sort'](_0x508d5f[_0x503b('0x2f')][_0x503b('0x39')]);_0x320325[_0x503b('0x3a')]=qs['filters'](_[_0x503b('0x3b')](_0x508d5f[_0x503b('0x2f')],_0x43775d[_0x503b('0x31')]),_0x32b2ba);if(_0x508d5f['query'][_0x503b('0x3c')]){_0x320325[_0x503b('0x3a')]=_['merge'](_0x320325[_0x503b('0x3a')],{'$or':_[_0x503b('0x29')](_0x32b2ba,function(_0x182c8f){if(_0x182c8f[_0x503b('0x2c')]!==_0x503b('0x3d')){var _0x1bf28e={};_0x1bf28e[_0x182c8f[_0x503b('0x27')]]={'$like':'%'+_0x508d5f['query']['filter']+'%'};return _0x1bf28e;}})});}_0x320325=_[_0x503b('0x3e')]({},_0x320325,_0x508d5f[_0x503b('0x3f')]);var _0x20afa2={'where':_0x320325[_0x503b('0x3a')]};return db[_0x503b('0x2a')][_0x503b('0x1a')](_0x20afa2)[_0x503b('0x23')](function(_0x4f145a){_0x5e5878[_0x503b('0x1a')]=_0x4f145a;if(_0x508d5f[_0x503b('0x2f')][_0x503b('0x40')]){_0x320325['include']=[{'all':!![]}];}return db[_0x503b('0x2a')][_0x503b('0x41')](_0x320325);})['then'](function(_0x5934da){_0x5e5878[_0x503b('0x42')]=_0x5934da;return _0x5e5878;})['then'](respondWithFilteredResult(_0x21de37,_0x320325))[_0x503b('0x43')](handleError(_0x21de37,null));};exports[_0x503b('0x44')]=function(_0x43159c,_0x5a65e4){var _0xfee325={'raw':![],'where':{'id':_0x43159c['params']['id']}},_0x3d1fd1={};_0x3d1fd1[_0x503b('0x2e')]=_[_0x503b('0x30')](db[_0x503b('0x2a')][_0x503b('0x45')]);_0x3d1fd1[_0x503b('0x2f')]=_[_0x503b('0x30')](_0x43159c[_0x503b('0x2f')]);_0x3d1fd1[_0x503b('0x31')]=_[_0x503b('0x32')](_0x3d1fd1[_0x503b('0x2e')],_0x3d1fd1[_0x503b('0x2f')]);_0xfee325[_0x503b('0x33')]=_['intersection'](_0x3d1fd1['model'],qs['fields'](_0x43159c['query'][_0x503b('0x34')]));_0xfee325['attributes']=_0xfee325[_0x503b('0x33')][_0x503b('0x35')]?_0xfee325['attributes']:_0x3d1fd1[_0x503b('0x2e')];if(_0x43159c[_0x503b('0x2f')][_0x503b('0x40')]){_0xfee325[_0x503b('0x46')]=[{'all':!![]}];}_0xfee325=_[_0x503b('0x3e')]({},_0xfee325,_0x43159c['options']);return db['UserProfile'][_0x503b('0x47')](_0xfee325)[_0x503b('0x23')](handleEntityNotFound(_0x5a65e4,null))[_0x503b('0x23')](respondWithResult(_0x5a65e4,null))[_0x503b('0x43')](handleError(_0x5a65e4,null));};exports[_0x503b('0x48')]=function(_0x7c30b,_0x48a612){return db[_0x503b('0x2a')][_0x503b('0x48')](_0x7c30b['body'],{})['then'](respondWithResult(_0x48a612,0xc9))['catch'](handleError(_0x48a612,null));};exports['clone']=function(_0x4fba7d,_0x38efd8){var _0x215b95={'where':{'id':_0x4fba7d[_0x503b('0x49')]['id']}},_0x466eac={};_0x466eac['model']=_[_0x503b('0x30')](db[_0x503b('0x2a')][_0x503b('0x45')]);_0x215b95[_0x503b('0x33')]=_[_0x503b('0x32')](_0x466eac['model'],qs[_0x503b('0x34')](_0x4fba7d[_0x503b('0x2f')][_0x503b('0x34')]));_0x215b95[_0x503b('0x33')]=_0x215b95['attributes']['length']?_0x215b95[_0x503b('0x33')]:_0x466eac[_0x503b('0x2e')];if(_0x4fba7d['query']['includeAll']){_0x215b95[_0x503b('0x46')]=[{'all':!![]}];}_0x215b95=_[_0x503b('0x3e')]({},_0x215b95,_0x4fba7d[_0x503b('0x3f')]);return db[_0x503b('0x2a')][_0x503b('0x47')](_0x215b95)[_0x503b('0x23')](handleEntityNotFound(_0x38efd8,null))[_0x503b('0x23')](function(_0x40dde2){if(_0x40dde2){var _0x455270=_0x40dde2['get']({'plain':!![]});_0x455270=qs['omit'](_0x455270,['id',_0x503b('0x4a'),_0x503b('0x4b'),_0x503b('0x4c')]);_0x4fba7d[_0x503b('0x4d')]=_[_0x503b('0x4e')](_0x4fba7d[_0x503b('0x4d')],['id',_0x503b('0x4a'),_0x503b('0x4b')]);return db[_0x503b('0x4f')][_0x503b('0x50')](function(_0x278fa8){return db['UserProfile'][_0x503b('0x48')](_[_0x503b('0x3e')](_0x455270,_0x4fba7d[_0x503b('0x4d')]),{'include':_0x4fba7d[_0x503b('0x2f')][_0x503b('0x40')]?[{'all':!![]}]:undefined,'transaction':_0x278fa8})['then'](function(_0x54d1ea){var _0x2c4986=_0x54d1ea['get']({'plain':!![]});return db[_0x503b('0x51')][_0x503b('0x41')]({'where':{'userProfileId':_0x4fba7d[_0x503b('0x49')]['id']},'raw':!![]})[_0x503b('0x23')](function(_0x188163){if(_0x188163){return BPromise[_0x503b('0x52')](_0x188163,function(_0x11f7bc){return new BPromise(function(_0x2d6877,_0x18aaff){if(_0x11f7bc[_0x503b('0x53')]===null||_0x11f7bc[_0x503b('0x53')]===0x1)_0x2d6877(null);return db[_0x503b('0x54')][_0x503b('0x41')]({'where':{'sectionId':_0x11f7bc['id']},'raw':!![]})[_0x503b('0x23')](function(_0x3356e8){var _0x155b74=_[_0x503b('0x29')](_0x3356e8,function(_0x3dff14){return qs[_0x503b('0x4e')](_0x3dff14,['id','createdAt',_0x503b('0x4b'),_0x503b('0x55')]);});_0x2d6877(_0x155b74);})['catch'](function(_0x42545b){_0x18aaff(_0x42545b);});})[_0x503b('0x23')](function(_0x3d9371){var _0x1e44b8=qs[_0x503b('0x4e')](_0x11f7bc,['id',_0x503b('0x4a'),_0x503b('0x4b')]);_0x1e44b8[_0x503b('0x56')]=_0x2c4986['id'];if(_0x3d9371)_0x1e44b8[_0x503b('0x57')]=_0x3d9371;return _0x1e44b8;})[_0x503b('0x23')](function(_0x51eb6d){return db[_0x503b('0x51')][_0x503b('0x48')](_0x51eb6d,{'include':[{'model':db['UserProfileResource'],'as':_0x503b('0x57')}],'raw':!![],'transaction':_0x278fa8});});})[_0x503b('0x23')](function(){return _0x2c4986;});}});});});}})[_0x503b('0x23')](respondWithResult(_0x38efd8,0xc9))[_0x503b('0x43')](handleError(_0x38efd8,null));};exports['update']=function(_0x3572c5,_0x5f54df){if(_0x3572c5['body']['id']){delete _0x3572c5['body']['id'];}return db['UserProfile'][_0x503b('0x47')]({'where':{'id':_0x3572c5[_0x503b('0x49')]['id']}})['then'](handleEntityNotFound(_0x5f54df,null))[_0x503b('0x23')](saveUpdates(_0x3572c5['body'],null))[_0x503b('0x23')](respondWithResult(_0x5f54df,null))[_0x503b('0x43')](handleError(_0x5f54df,null));};exports[_0x503b('0x24')]=function(_0x5b33b5,_0x1469d7){return db[_0x503b('0x2a')]['find']({'where':{'id':_0x5b33b5[_0x503b('0x49')]['id']}})['then'](handleEntityNotFound(_0x1469d7,null))[_0x503b('0x23')](removeEntity(_0x1469d7,null))[_0x503b('0x43')](handleError(_0x1469d7,null));};exports[_0x503b('0x58')]=function(_0x379d6b,_0x1f4d3b){return db['UserProfile'][_0x503b('0x58')]()[_0x503b('0x23')](respondWithResult(_0x1f4d3b,null))['catch'](handleError(_0x1f4d3b,null));};exports[_0x503b('0x59')]=function(_0x4e9a07,_0x35a1a2){var _0x4702d0=_0x4e9a07[_0x503b('0x4d')];return db[_0x503b('0x2a')][_0x503b('0x47')]({'where':{'id':_0x4e9a07[_0x503b('0x49')]['id']}})[_0x503b('0x23')](handleEntityNotFound(_0x35a1a2,null))[_0x503b('0x23')](function(_0x1ab21f){if(_0x1ab21f){return db[_0x503b('0x4f')][_0x503b('0x50')](function(_0x4303fc){return db[_0x503b('0x51')][_0x503b('0x24')]({'where':{'userProfileId':_0x4e9a07[_0x503b('0x49')]['id'],'sectionId':_[_0x503b('0x29')](_0x4702d0,function(_0x8efb40){return _0x8efb40['sectionId'];})},'transaction':_0x4303fc})[_0x503b('0x23')](function(){var _0x5bb505=_[_0x503b('0x29')](_0x4702d0,function(_0x2bc80c){_0x2bc80c[_0x503b('0x56')]=_0x4e9a07[_0x503b('0x49')]['id'];return _0x2bc80c;});var _0x39853f=[];return BPromise[_0x503b('0x52')](_0x5bb505,function(_0x1ce353){return db['UserProfileSection'][_0x503b('0x48')](_0x1ce353,{'include':[{'model':db[_0x503b('0x54')],'as':_0x503b('0x57')}],'raw':!![],'transaction':_0x4303fc})[_0x503b('0x23')](function(_0xb929b){_0x39853f[_0x503b('0x5a')](_0xb929b[_0x503b('0x5b')]({'plain':!![]}));});})[_0x503b('0x23')](function(){return _0x39853f;});});});}})[_0x503b('0x23')](function(_0x5f4c84){return _0x5f4c84;})[_0x503b('0x23')](respondWithResult(_0x35a1a2,null))['catch'](handleError(_0x35a1a2,null));};exports[_0x503b('0x5c')]=function(_0x2f2c08,_0x4952c4){var _0x390aca;return db[_0x503b('0x2a')][_0x503b('0x47')]({'where':{'id':_0x2f2c08[_0x503b('0x49')]['id']},'attributes':['id',_0x503b('0x27')]})['then'](handleEntityNotFound(_0x4952c4,null))['then'](function(_0x31e8ea){if(_0x31e8ea){_0x390aca=_0x31e8ea;return db['UserProfileSection'][_0x503b('0x24')]({'where':{'userProfileId':_0x2f2c08['params']['id'],'sectionId':_0x2f2c08[_0x503b('0x2f')][_0x503b('0x5d')]}});}})[_0x503b('0x23')](function(){return _0x390aca;})[_0x503b('0x23')](respondWithStatusCode(_0x4952c4,null))['catch'](handleError(_0x4952c4,null));};exports[_0x503b('0x5e')]=function(_0x6dec3d,_0x352e4e){var _0x494477=[];var _0x1ce1f4=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x6dec3d[_0x503b('0x49')]['id']},'raw':!![]})[_0x503b('0x23')](function(_0x8089c1){_0x494477=_[_0x503b('0x3c')](_0x8089c1,function(_0x25bb91){return _0x25bb91['enabled']===0x1||_['includes']([0x3eb,0x709],_0x25bb91[_0x503b('0x55')]);});if(!_[_0x503b('0x5f')](_0x494477)){return _['map'](_0x494477,function(_0x5de6fe){return _0x5de6fe[_0x503b('0x55')];});}else{return;}})['then'](function(_0x2d266d){if(_0x2d266d)_0x1ce1f4=_0x2d266d;if(_['includes'](_0x1ce1f4,0x64)){var _0x3a7091=_[_0x503b('0x47')](_0x494477,{'sectionId':0x64});return hasDefaultDashboard(_0x3a7091)[_0x503b('0x23')](function(_0x419cd7){return _[_0x503b('0x29')](_0x494477,function(_0x30dc66){if(_0x30dc66['sectionId']===0x64){_0x30dc66[_0x503b('0x60')]=_0x419cd7;}return _0x30dc66;});});}else{return;}})[_0x503b('0x23')](function(_0x2386e8){if(_0x2386e8)_0x494477=_0x2386e8;if(_[_0x503b('0x61')](_0x1ce1f4,0x3eb)){var _0x53056f=_[_0x503b('0x47')](_0x494477,{'sectionId':0x3eb});return getCustomDashboards(_0x53056f)[_0x503b('0x23')](function(_0x4d944b){return _['map'](_0x494477,function(_0x339583){if(_0x53056f[_0x503b('0x62')]){if(_0x339583[_0x503b('0x55')]===0x3eb){_0x339583[_0x503b('0x60')]=_0x4d944b;}}else{if(_0x339583[_0x503b('0x55')]===0x64){_0x339583[_0x503b('0x60')]=_0x4d944b;}}return _0x339583;});});}else{return;}})[_0x503b('0x23')](function(_0x4d0579){if(_0x4d0579)_0x494477=_0x4d0579;if(_[_0x503b('0x61')](_0x1ce1f4,0x709)){var _0x555fcc=_[_0x503b('0x47')](_0x494477,{'sectionId':0x709});return getPlugins(_0x555fcc)['then'](function(_0x5f0298){if(_0x555fcc[_0x503b('0x62')]){return _[_0x503b('0x29')](_0x494477,function(_0x4ccf23){if(_0x4ccf23['sectionId']===0x709){_0x4ccf23[_0x503b('0x60')]=_0x5f0298;}return _0x4ccf23;});}else{var _0x10d506={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5f0298};var _0x180a8e=_[_0x503b('0x29')](_0x494477);_0x180a8e[_0x503b('0x5a')](_0x10d506);return _0x180a8e;}});}else{return;}})[_0x503b('0x23')](function(_0x152586){if(_0x152586)_0x494477=_0x152586;return _[_0x503b('0x3c')](_0x494477,[_0x503b('0x62'),0x1]);})[_0x503b('0x23')](respondWithResult(_0x352e4e,null))[_0x503b('0x43')](handleError(_0x352e4e,null));};function hasDefaultDashboard(_0x572d82){var _0x2fae81=[0x65];return new BPromise(function(_0x3015f1,_0x1fefae){try{if(_0x572d82['autoAssociation']){_0x3015f1(_0x2fae81);}else{return db[_0x503b('0x54')]['findOne']({'where':{'sectionId':_0x572d82['id']},'raw':!![]})[_0x503b('0x23')](function(_0x509f18){_0x509f18?_0x3015f1(_0x2fae81):_0x3015f1();});}}catch(_0x6dc97){_0x1fefae(_0x6dc97);}});}function getCustomDashboards(_0x3e16b5){var _0x2096d9=[];return new BPromise(function(_0x39fb30,_0x57b7c4){try{if(_0x3e16b5[_0x503b('0x53')]){return db['Dashboard'][_0x503b('0x41')]({'raw':!![]})[_0x503b('0x23')](function(_0x20ac1e){_0x20ac1e[_0x503b('0x63')](function(_0x2da767){_0x2096d9[_0x503b('0x5a')](_0x2da767['id']+0x1869f);});_0x39fb30(_0x2096d9);});}else{return db[_0x503b('0x54')][_0x503b('0x41')]({'where':{'sectionId':_0x3e16b5['id']},'raw':!![]})[_0x503b('0x23')](function(_0x385857){_0x385857[_0x503b('0x63')](function(_0x370c09){_0x2096d9[_0x503b('0x5a')](_0x370c09[_0x503b('0x64')]+0x1869f);});_0x39fb30(_0x2096d9);});}}catch(_0xe6295f){_0x57b7c4(_0xe6295f);}});}function getPlugins(_0x56fddd){var _0x149a6b=[];return new BPromise(function(_0x50b026,_0x4d32d3){try{if(_0x56fddd[_0x503b('0x53')]){return db[_0x503b('0x65')]['findAll']({'raw':!![]})[_0x503b('0x23')](function(_0xc6d90){_0xc6d90[_0x503b('0x63')](function(_0xdfbe1c){_0x149a6b[_0x503b('0x5a')](_0xdfbe1c['id']+0x15b38);});_0x50b026(_0x149a6b);});}else{return db[_0x503b('0x54')][_0x503b('0x41')]({'where':{'sectionId':_0x56fddd['id']},'raw':!![]})[_0x503b('0x23')](function(_0x5767e4){_0x5767e4['forEach'](function(_0x8f3acb){_0x149a6b[_0x503b('0x5a')](_0x8f3acb[_0x503b('0x64')]+0x15b38);});_0x50b026(_0x149a6b);});}}catch(_0x3e0c69){_0x4d32d3(_0x3e0c69);}});}exports[_0x503b('0x66')]=function(_0x50e6cb,_0x354153){return db[_0x503b('0x2a')][_0x503b('0x47')]({'where':{'id':_0x50e6cb[_0x503b('0x49')]['id']}})[_0x503b('0x23')](handleEntityNotFound(_0x354153,null))[_0x503b('0x23')](function(_0x48a5ee){if(_0x48a5ee){return db['sequelize']['transaction'](function(_0x47a15a){return db[_0x503b('0x51')][_0x503b('0x41')]({'where':{'userProfileId':_0x50e6cb['params']['id']},'attributes':['id'],'raw':!![]})[_0x503b('0x23')](function(_0x529286){if(_0x529286){return db[_0x503b('0x51')][_0x503b('0x24')]({'where':{'userProfileId':_0x50e6cb[_0x503b('0x49')]['id'],'id':_[_0x503b('0x29')](_0x529286,function(_0x33b40a){return _0x33b40a['id'];})},'transaction':_0x47a15a});}})[_0x503b('0x23')](function(_0x4d6f51){var _0x14d863=_[_0x503b('0x29')](_0x50e6cb[_0x503b('0x4d')],function(_0x385c93){_0x385c93['userProfileId']=_0x50e6cb['params']['id'];return _0x385c93;});return db['UserProfileSection'][_0x503b('0x67')](_0x14d863,{'raw':!![],'transaction':_0x47a15a});})[_0x503b('0x23')](function(_0x2f513c){var _0x4b172e=_['filter'](_['map'](_0x2f513c,function(_0x246268){return _0x246268[_0x503b('0x5b')]({'plain':!![]});}),{'includeAll':![]});if(_0x4b172e){return db['UserProfileSection'][_0x503b('0x41')]({'where':{'userProfileId':_0x50e6cb[_0x503b('0x49')]['id'],'sectionId':_[_0x503b('0x29')](_0x4b172e,function(_0x31a46a){return _0x31a46a[_0x503b('0x55')];})},'attributes':['id',_0x503b('0x55')],'raw':!![]})['then'](function(_0x2bf4da){var _0x39a2e8=_[_0x503b('0x29')](_0x50e6cb[_0x503b('0x4d')],function(_0x5ad1db){_0x5ad1db[_0x503b('0x56')]=_0x50e6cb[_0x503b('0x49')]['id'];return _0x5ad1db;});return db[_0x503b('0x54')][_0x503b('0x67')](_0x39a2e8,{'raw':!![],'transaction':_0x47a15a});});}})[_0x503b('0x43')](handleError(_0x354153,null));});}})[_0x503b('0x23')](function(_0x1cad5c){var _0x6b27e4=_[_0x503b('0x29')](_0x1cad5c,function(_0x1921a9){return _0x1921a9[_0x503b('0x5b')]({'plain':!![]});});})[_0x503b('0x23')](respondWithResult(_0x354153,null))[_0x503b('0x43')](handleError(_0x354153,null));};exports['removeResources']=function(_0x521034,_0x4d4258,_0x1e427d){return db['UserProfile'][_0x503b('0x47')]({'where':{'id':_0x521034[_0x503b('0x49')]['id']}})[_0x503b('0x23')](handleEntityNotFound(_0x4d4258,null))[_0x503b('0x23')](function(_0x34ada6){if(_0x34ada6){return _0x34ada6[_0x503b('0x68')](_0x521034[_0x503b('0x2f')][_0x503b('0x5d')]);}})[_0x503b('0x23')](respondWithStatusCode(_0x4d4258,null))[_0x503b('0x43')](handleError(_0x4d4258,null));};exports[_0x503b('0x69')]=function(_0x272e83,_0x6977c9){var _0x1446bd={'raw':![],'where':{}};var _0xc394eb={};var _0x49097c={'count':0x0,'rows':[]};var _0x327f63=_0x272e83['query'][_0x503b('0x6a')];if(typeof _0x327f63===_0x503b('0x6b')){throw new db['Sequelize']['ValidationError']('Unknown\x20section');}var _0x1519e4=_0x272e83['query'][_0x503b('0x6c')]||![];var _0x31262b=getQueryModels(_0x327f63,_0x1519e4);if(typeof _0x31262b[_0x503b('0x6d')]==='undefined'){throw new db['Sequelize'][(_0x503b('0x6e'))](_0x503b('0x6f')+_0x327f63+'\x27');}var _0x41f183=[];if(!_[_0x503b('0x5f')](_0x31262b[_0x503b('0x70')])){_0x41f183=_0x31262b[_0x503b('0x70')];}else{_0x41f183=[{'name':_0x327f63}];}return db[_0x503b('0x2a')][_0x503b('0x71')]({'where':{'id':_0x272e83[_0x503b('0x49')]['id']}})['then'](handleEntityNotFound(_0x6977c9,null))[_0x503b('0x23')](function(_0x2cff98){if(_0x2cff98){var _0x335217=[];for(var _0x4574e4=0x0;_0x4574e4<_0x41f183[_0x503b('0x35')];_0x4574e4++){_0x335217[_0x503b('0x5a')](db['UserProfileSection'][_0x503b('0x71')]({'where':{'userProfileId':_0x2cff98['id'],'name':_0x41f183[_0x4574e4][_0x503b('0x27')]},'raw':!![]}));}return BPromise['all'](_0x335217);}})[_0x503b('0x23')](function(_0x245d18){var _0x25b609=_[_0x503b('0x3c')](_0x245d18,function(_0x2b3c61){return _0x2b3c61?_0x2b3c61:undefined;});var _0x290bd5=_['filter'](_0x41f183,['ignore',!![]]);var _0x2dbd80=_['isEmpty'](_0x25b609)&&_[_0x503b('0x5f')](_0x290bd5)?null:_[_0x503b('0x72')](_0x290bd5,_0x25b609);if(_0x2dbd80){var _0x1e3aab=[];for(var _0x27f9a9=0x0;_0x27f9a9<_0x2dbd80[_0x503b('0x35')];_0x27f9a9++){var _0x10a263=_[_0x503b('0x47')](_0x41f183,function(_0x47ebdb){return _0x2dbd80[_0x27f9a9]?_0x47ebdb[_0x503b('0x27')]===_0x2dbd80[_0x27f9a9]['name']:null;});if(_0x10a263){if(_0x2dbd80[_0x27f9a9]['ignore']){_0x1e3aab[_0x503b('0x5a')](getAllResources(_0x31262b[_0x503b('0x6d')],_0x2dbd80[_0x27f9a9]));}else{if(!_0x2dbd80[_0x27f9a9][_0x503b('0x53')]){_0x1e3aab[_0x503b('0x5a')](getAllowedResources(_0x10a263,_0x2dbd80[_0x27f9a9],_0x31262b[_0x503b('0x6d')]));}else{if(_0x10a263['model']){_0x1e3aab[_0x503b('0x5a')](getAllFilteredResources(_0x10a263,_0x2dbd80[_0x27f9a9]));}}}}}return BPromise['all'](_0x1e3aab);}else{return null;}})[_0x503b('0x23')](function(_0x1ad739){var _0x5dad2d=_0x1ad739;var _0x33fff3=null;if(_0x5dad2d){_0x33fff3=_0x5dad2d[_0x503b('0x35')]===0x1?_0x5dad2d[0x0]:null;}if(_0x33fff3||_0x5dad2d){var _0x3c3e9c=db[_0x31262b['childModel']][_0x503b('0x45')];_0xc394eb['model']=_[_0x503b('0x30')](_0x3c3e9c);_0xc394eb[_0x503b('0x2f')]=_[_0x503b('0x30')](_0x272e83[_0x503b('0x2f')]);_0xc394eb[_0x503b('0x31')]=_[_0x503b('0x32')](_0xc394eb[_0x503b('0x2e')],_0xc394eb['query']);_0x1446bd[_0x503b('0x33')]=_[_0x503b('0x32')](_0xc394eb[_0x503b('0x2e')],qs[_0x503b('0x34')](_0x272e83[_0x503b('0x2f')]['fields']));_0x1446bd[_0x503b('0x33')]=_0x1446bd[_0x503b('0x33')][_0x503b('0x35')]?_0x1446bd[_0x503b('0x33')]:_0xc394eb[_0x503b('0x2e')];if(!_0x272e83[_0x503b('0x2f')]['hasOwnProperty'](_0x503b('0x37'))){_0x1446bd[_0x503b('0x1c')]=qs['limit'](_0x272e83['query'][_0x503b('0x1c')]);_0x1446bd['offset']=qs[_0x503b('0x1b')](_0x272e83[_0x503b('0x2f')]['offset']);}_0x1446bd['order']=qs[_0x503b('0x39')](_0x272e83[_0x503b('0x2f')][_0x503b('0x39')]);_0x1446bd[_0x503b('0x3a')]=qs[_0x503b('0x31')](_['pick'](_0x272e83[_0x503b('0x2f')],_0xc394eb[_0x503b('0x31')]));if(_0x272e83[_0x503b('0x2f')][_0x503b('0x3c')]){_0x1446bd[_0x503b('0x3a')]=_[_0x503b('0x3e')](_0x1446bd[_0x503b('0x3a')],{'$or':_[_0x503b('0x29')](_0x3c3e9c,function(_0x3888aa){if(_0x3888aa[_0x503b('0x2c')][_0x503b('0x2d')]!=='VIRTUAL'){var _0x18c1ef={};_0x18c1ef[_0x3888aa[_0x503b('0x73')]]={'$like':'%'+_0x272e83[_0x503b('0x2f')][_0x503b('0x3c')]+'%'};return _0x18c1ef;}})});}var _0x5eb283=[];if(_0x33fff3){var _0xd4d647=_[_0x503b('0x47')](_0x41f183,['name',_0x33fff3[_0x503b('0x27')]]);if(_0xd4d647[_0x503b('0x73')]){var _0x1f5473={};if(_0x31262b['childModel']==='AnalyticExtractedReport'){_0x1f5473[_0xd4d647[_0x503b('0x74')]]=_[_0x503b('0x29')](_0x33fff3[_0x503b('0x75')],'id');}else{_0x1f5473[_0xd4d647[_0x503b('0x74')]]=_0x33fff3[_0x503b('0x75')];}_0x5eb283['push'](_0x1f5473);}else{_0x1446bd[_0x503b('0x3a')]['id']=_0x33fff3[_0x503b('0x75')];}}else{for(var _0x2dfcbb=0x0;_0x2dfcbb<_0x5dad2d[_0x503b('0x35')];_0x2dfcbb++){var _0xd4d647=_[_0x503b('0x47')](_0x41f183,[_0x503b('0x27'),_0x5dad2d[_0x2dfcbb][_0x503b('0x27')]]);if(_0xd4d647[_0x503b('0x73')]){var _0x1f5473={};_0x1f5473[_0xd4d647[_0x503b('0x74')]]=_0x5dad2d[_0x2dfcbb]['associatedResources'];_0x5eb283[_0x503b('0x5a')](_0x1f5473);}else{if(!_0x1446bd[_0x503b('0x3a')]['id'])_0x1446bd[_0x503b('0x3a')]['id']=[];_0x5dad2d[_0x2dfcbb]['associatedResources']['forEach'](function(_0x40242f){_0x1446bd['where']['id'][_0x503b('0x5a')](_0x40242f);});}}}if(!_['isEmpty'](_0x5eb283)){_0x1446bd['where']=_[_0x503b('0x3e')](_0x1446bd[_0x503b('0x3a')],{'$and':{'$or':_0x5eb283}});}_0x1446bd=_[_0x503b('0x3e')]({},_0x1446bd,_0x272e83[_0x503b('0x3f')]);if(_0x33fff3&&!_0x33fff3['autoAssociation']&&_0x31262b[_0x503b('0x6d')]==='AnalyticExtractedReport'){if(_0x272e83['query'][_0x503b('0x40')]){_0x1446bd['include']=[{'all':!![]}];}return db[_0x31262b[_0x503b('0x6d')]][_0x503b('0x41')](_0x1446bd)['then'](function(_0x288edc){var _0x9a0645=[];_0x288edc[_0x503b('0x63')](function(_0x2a6057){var _0x5341af;switch(_0x2a6057[_0x503b('0x76')]){case'default':_0x5341af=_[_0x503b('0x47')](_0x33fff3['associatedResources'],function(_0x4a86b4){return _0x4a86b4['id']===_0x2a6057[_0x503b('0x77')]&&_0x4a86b4[_0x503b('0x2c')]===_0x503b('0x78');});break;case _0x503b('0x79'):_0x5341af=_['find'](_0x33fff3[_0x503b('0x75')],function(_0x1af61e){return _0x1af61e['id']===_0x2a6057[_0x503b('0x77')]&&_0x1af61e['type']===_0x503b('0x7a');});break;}if(_0x5341af)_0x9a0645['push'](_0x2a6057);});_0x49097c['count']=_0x9a0645[_0x503b('0x35')];_0x49097c['rows']=_0x9a0645;return _0x49097c;});}else{return db[_0x31262b[_0x503b('0x6d')]][_0x503b('0x1a')]({'where':_0x1446bd[_0x503b('0x3a')]})[_0x503b('0x23')](function(_0x5c6834){_0x49097c['count']=_0x5c6834;if(_0x272e83[_0x503b('0x2f')][_0x503b('0x40')]){if(_0x31262b[_0x503b('0x6d')]===_0x503b('0x7b')){_0x1446bd[_0x503b('0x46')]=[{'model':db[_0x503b('0x7c')],'as':_0x503b('0x7d'),'attributes':['id','name',_0x503b('0x7e')],'required':_0x272e83[_0x503b('0x2f')][_0x503b('0x7f')]?!![]:![]},{'model':db[_0x503b('0x7c')],'as':_0x503b('0x80'),'attributes':['id','name',_0x503b('0x7e')],'through':_0x272e83[_0x503b('0x2f')][_0x503b('0x7f')]?{'attributes':[],'where':{'TagId':_0x272e83[_0x503b('0x2f')][_0x503b('0x7f')]||undefined}}:{},'required':_0x272e83['query'][_0x503b('0x7f')]?!![]:![]}];}else{_0x1446bd[_0x503b('0x46')]=[{'all':!![]}];}}return db[_0x31262b[_0x503b('0x6d')]][_0x503b('0x41')](_0x1446bd);})[_0x503b('0x23')](function(_0x3f3d89){_0x49097c[_0x503b('0x42')]=_0x3f3d89;return _0x49097c;});}}else{return _0x49097c;}})['then'](respondWithFilteredResult(_0x6977c9,_0x1446bd))[_0x503b('0x43')](handleError(_0x6977c9,null));};function getAllResources(_0x33146b,_0xa0160e){return new BPromise(function(_0x1ea106,_0x16fdfc){if(_0xa0160e){var _0x31874a=_0xa0160e[_0x503b('0x3c')]?{[_0xa0160e['filter']['field']]:_0xa0160e[_0x503b('0x3c')][_0x503b('0x81')]}:undefined;return db[_0x33146b][_0x503b('0x41')]({'where':_0x31874a,'raw':!![]})['then'](function(_0x530d10){_0xa0160e[_0x503b('0x75')]=_[_0x503b('0x29')](_0x530d10,'id');_0x1ea106(_0xa0160e);})[_0x503b('0x43')](function(_0x291a3f){_0x16fdfc(_0x291a3f);});}else{_0x1ea106(null);}});}function getAllFilteredResources(_0x106a0c,_0x4fcf56){return new BPromise(function(_0x1142ec,_0x482c21){var _0x41c112=_0x106a0c[_0x503b('0x3c')]?{[_0x106a0c['filter']['field']]:_0x106a0c[_0x503b('0x3c')][_0x503b('0x81')]}:undefined;return db[_0x106a0c[_0x503b('0x2e')]][_0x503b('0x41')]({'where':_0x41c112,'raw':!![]})[_0x503b('0x23')](function(_0x4a7c23){_0x4fcf56[_0x503b('0x75')]=_[_0x503b('0x29')](_0x4a7c23,function(_0x23aeea){return _0x23aeea['name'];});_0x1142ec(_0x4fcf56);})[_0x503b('0x43')](function(_0x434d9b){_0x482c21(_0x434d9b);});});}function getAllowedResources(_0x2f91ae,_0x537114,_0xf02797){return new BPromise(function(_0x1ccd0e,_0x3ec78a){if(_0x537114){return db[_0x503b('0x54')][_0x503b('0x41')]({'where':{'sectionId':_0x537114['id']},'raw':!![]})['then'](function(_0x1a39d3){if(_0x2f91ae[_0x503b('0x73')]&&_0x2f91ae[_0x503b('0x73')]!=='id'){_0x537114[_0x503b('0x75')]=_[_0x503b('0x29')](_0x1a39d3,function(_0x547374){return _0x547374[_0x2f91ae[_0x503b('0x73')]];});}else{if(_0xf02797==='AnalyticExtractedReport'){_0x537114[_0x503b('0x75')]=_[_0x503b('0x29')](_0x1a39d3,function(_0x30e272){return{'id':_0x30e272['resourceId'],'type':_0x30e272[_0x503b('0x2c')]};});}else{_0x537114['associatedResources']=_[_0x503b('0x29')](_0x1a39d3,function(_0x10260b){return _0x10260b[_0x503b('0x64')];});}}_0x1ccd0e(_0x537114);})[_0x503b('0x43')](function(_0xef42c1){_0x3ec78a(_0xef42c1);});}else{_0x1ccd0e(null);}});}function getQueryModels(_0x13e97a,_0x1a5de1){var _0x2c9388=_0x13e97a['toLowerCase']();var _0x2d2546={'childModel':undefined,'parentSections':[]};switch(_0x2c9388){case _0x503b('0x82'):_0x2d2546['childModel']=_0x503b('0x83');break;case _0x503b('0x84'):_0x2d2546['childModel']=_0x503b('0x85');break;case _0x503b('0x86'):_0x2d2546['childModel']=_0x503b('0x87');_0x2d2546['parentSections']=[{'name':_0x503b('0x88'),'field':_0x503b('0x27'),'foreignKey':_0x503b('0x89')}];break;case'projects':_0x2d2546[_0x503b('0x6d')]=_0x503b('0x8a');break;case _0x503b('0x8b'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0x7b');_0x2d2546['parentSections']=[{'name':_0x503b('0x8c'),'field':'id','foreignKey':'ListId'}];break;case _0x503b('0x8d'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0x8e');break;case _0x503b('0x8f'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0x90');break;case'globalcustomfields':_0x2d2546['childModel']=_0x503b('0x91');break;case _0x503b('0x92'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0x93');break;case'chatwebsites':_0x2d2546['childModel']=_0x503b('0x94');break;case _0x503b('0x95'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0x96');break;case'faxaccounts':_0x2d2546['childModel']=_0x503b('0x97');break;case'inboundroutes':case _0x503b('0x98'):case _0x503b('0x99'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0x9a');break;case _0x503b('0x9b'):_0x2d2546['childModel']=_0x503b('0x9c');break;case _0x503b('0x9d'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0x9e');break;case _0x503b('0x9f'):_0x2d2546['childModel']=_0x503b('0xa0');_0x2d2546[_0x503b('0x70')]=[{'name':_0x503b('0xa1'),'field':_0x503b('0x27'),'foreignKey':'membername','model':_0x503b('0xa2'),'filter':{'field':'role','value':[_0x503b('0xa3')]}},{'name':_0x503b('0xa4'),'field':_0x503b('0x27'),'foreignKey':_0x503b('0xa5'),'model':'User','filter':{'field':'role','value':[_0x503b('0xa6')]}},{'name':_0x503b('0xa7'),'field':_0x503b('0x27'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x503b('0x2c'),'value':[_0x503b('0xa8')]}},{'name':'QueueCampaigns','field':_0x503b('0x27'),'foreignKey':_0x503b('0xa9'),'model':_0x503b('0xaa'),'filter':{'field':_0x503b('0x2c'),'value':[_0x503b('0xab')]}}];break;case'musiconholds':_0x2d2546[_0x503b('0x6d')]=_0x503b('0xac');break;case _0x503b('0xad'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xae');break;case _0x503b('0xaf'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xb0');break;case'ivrcampaigns':_0x2d2546[_0x503b('0x6d')]=_0x503b('0xb1');break;case'mailqueues':_0x2d2546[_0x503b('0x6d')]='MailQueue';break;case'mailaccounts':_0x2d2546['childModel']=_0x503b('0xb2');break;case _0x503b('0xb3'):_0x2d2546[_0x503b('0x6d')]='MailSubstatus';break;case _0x503b('0xb4'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xb5');break;case _0x503b('0xb6'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xb7');break;case _0x503b('0xb8'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xb9');break;case _0x503b('0xba'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xbb');break;case _0x503b('0xbc'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xbd');break;case _0x503b('0xbe'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xbf');break;case _0x503b('0xc0'):_0x2d2546['childModel']='Team';break;case _0x503b('0xc1'):case _0x503b('0xc2'):_0x2d2546[_0x503b('0x6d')]='VoiceQueue';if(_0x1a5de1){_0x2d2546[_0x503b('0x70')]=[{'name':_0x503b('0xa7')},{'name':'QueueCampaigns'}];}break;case _0x503b('0xc3'):case _0x503b('0xc4'):case _0x503b('0xc5'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xa2');if(_0x1a5de1){_0x2d2546[_0x503b('0x70')]=[{'name':'Users','filter':{'field':_0x503b('0xc6'),'value':[_0x503b('0xc7'),'user']},'ignore':!![]},{'name':_0x503b('0xa1')},{'name':'Telephones'}];}break;case _0x503b('0xc8'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xc9');break;case'salesforceaccounts':_0x2d2546['childModel']=_0x503b('0xca');break;case'freshdeskaccounts':_0x2d2546[_0x503b('0x6d')]=_0x503b('0xcb');break;case _0x503b('0xcc'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xcd');break;case _0x503b('0xce'):_0x2d2546['childModel']=_0x503b('0xcf');break;case _0x503b('0xd0'):_0x2d2546['childModel']=_0x503b('0xd1');break;case _0x503b('0xd2'):_0x2d2546[_0x503b('0x6d')]='User';break;case _0x503b('0xd3'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xd4');break;case _0x503b('0xd5'):_0x2d2546['childModel']=_0x503b('0xd6');break;case _0x503b('0xd7'):_0x2d2546['childModel']='Dashboard';break;case _0x503b('0xd8'):_0x2d2546[_0x503b('0x6d')]='Interval';break;case _0x503b('0xd9'):_0x2d2546[_0x503b('0x6d')]='Pause';break;case _0x503b('0xda'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xdb');break;case'sounds':_0x2d2546[_0x503b('0x6d')]=_0x503b('0xdc');break;case _0x503b('0xdd'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0x7c');break;case'templates':_0x2d2546[_0x503b('0x6d')]='Template';break;case _0x503b('0xde'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xdf');break;case _0x503b('0xe0'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xe1');break;case _0x503b('0xe2'):_0x2d2546['childModel']=_0x503b('0xe3');break;case'plugins':_0x2d2546[_0x503b('0x6d')]=_0x503b('0x65');break;case _0x503b('0xe4'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xe5');_0x2d2546[_0x503b('0x70')]=[{'name':_0x503b('0xe6'),'field':'id','foreignKey':'reportId'}];break;case _0x503b('0xe7'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xe8');break;case _0x503b('0xbe'):_0x2d2546[_0x503b('0x6d')]=_0x503b('0xbf');break;default:return _0x2d2546;}return _0x2d2546;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 8537652..30ce58b 100644 --- a/server/api/userProfile/userProfile.events.js +++ b/server/api/userProfile/userProfile.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc2af=['save','update','remove','emit','exports','events','UserProfile'];(function(_0x5279cb,_0x1601be){var _0x55785a=function(_0x33fd36){while(--_0x33fd36){_0x5279cb['push'](_0x5279cb['shift']());}};_0x55785a(++_0x1601be);}(_0xc2af,0xad));var _0xfc2a=function(_0x22f2f3,_0x7ee36f){_0x22f2f3=_0x22f2f3-0x0;var _0x35bd92=_0xc2af[_0x22f2f3];return _0x35bd92;};'use strict';var EventEmitter=require(_0xfc2a('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xfc2a('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfc2a('0x2'),'afterUpdate':_0xfc2a('0x3'),'afterDestroy':_0xfc2a('0x4')};function emitEvent(_0x51cd36){return function(_0x5c0ab7,_0x5bd98e,_0x5bcc9e){UserProfileEvents[_0xfc2a('0x5')](_0x51cd36+':'+_0x5c0ab7['id'],_0x5c0ab7);UserProfileEvents[_0xfc2a('0x5')](_0x51cd36,_0x5c0ab7);_0x5bcc9e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xfc2a('0x6')]=UserProfileEvents; \ No newline at end of file +var _0x003b=['setMaxListeners','save','update','remove','emit','hook','events','UserProfile'];(function(_0x1ea39b,_0x550554){var _0x3c2e56=function(_0x31edb2){while(--_0x31edb2){_0x1ea39b['push'](_0x1ea39b['shift']());}};_0x3c2e56(++_0x550554);}(_0x003b,0xae));var _0xb003=function(_0x3ca68a,_0x2063fd){_0x3ca68a=_0x3ca68a-0x0;var _0x204c1b=_0x003b[_0x3ca68a];return _0x204c1b;};'use strict';var EventEmitter=require(_0xb003('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xb003('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xb003('0x2')](0x0);var events={'afterCreate':_0xb003('0x3'),'afterUpdate':_0xb003('0x4'),'afterDestroy':_0xb003('0x5')};function emitEvent(_0x1ad6b8){return function(_0xd1f056,_0x3892af,_0x10cc06){UserProfileEvents[_0xb003('0x6')](_0x1ad6b8+':'+_0xd1f056['id'],_0xd1f056);UserProfileEvents[_0xb003('0x6')](_0x1ad6b8,_0xd1f056);_0x10cc06(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xb003('0x7')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index de04c37..5f50b05 100644 --- a/server/api/userProfile/userProfile.model.js +++ b/server/api/userProfile/userProfile.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6282=['exports','define','user_profiles','lodash','util','moment','bluebird','rimraf','../../config/environment'];(function(_0x29b7ca,_0x422055){var _0x129b51=function(_0x3ec57b){while(--_0x3ec57b){_0x29b7ca['push'](_0x29b7ca['shift']());}};_0x129b51(++_0x422055);}(_0x6282,0x159));var _0x2628=function(_0x1a07a1,_0x550320){_0x1a07a1=_0x1a07a1-0x0;var _0x1d76c6=_0x6282[_0x1a07a1];return _0x1d76c6;};'use strict';var _=require(_0x2628('0x0'));var util=require(_0x2628('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2628('0x2'));var BPromise=require(_0x2628('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2628('0x4'));var config=require(_0x2628('0x5'));var attributes=require('./userProfile.attributes');module[_0x2628('0x6')]=function(_0x133ad3,_0x2ac0c1){return _0x133ad3[_0x2628('0x7')]('UserProfile',attributes,{'tableName':_0x2628('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf904=['../../config/environment','define','user_profiles','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x57b4dc,_0x3fbf56){var _0x19a18a=function(_0x31b596){while(--_0x31b596){_0x57b4dc['push'](_0x57b4dc['shift']());}};_0x19a18a(++_0x3fbf56);}(_0xf904,0xc9));var _0x4f90=function(_0x4e783c,_0x51a362){_0x4e783c=_0x4e783c-0x0;var _0x2fbd6d=_0xf904[_0x4e783c];return _0x2fbd6d;};'use strict';var _=require(_0x4f90('0x0'));var util=require(_0x4f90('0x1'));var logger=require(_0x4f90('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4f90('0x3'));var rp=require(_0x4f90('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4f90('0x5'));var config=require(_0x4f90('0x6'));var attributes=require('./userProfile.attributes');module['exports']=function(_0x2814fa,_0x32dd34){return _0x2814fa[_0x4f90('0x7')]('UserProfile',attributes,{'tableName':_0x4f90('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index ee999b1..972eaef 100644 --- a/server/api/userProfile/userProfile.rpc.js +++ b/server/api/userProfile/userProfile.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment'];(function(_0x868b7c,_0xfa438b){var _0x21683c=function(_0x21bc66){while(--_0x21bc66){_0x868b7c['push'](_0x868b7c['shift']());}};_0x21683c(++_0xfa438b);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x153ab3,_0x5c7acb){_0x153ab3=_0x153ab3-0x0;var _0x4e2455=_0x7fbe[_0x153ab3];return _0x4e2455;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});config[_0xe7fb('0xc')]=_[_0xe7fb('0xd')](config['redis'],{'host':_0xe7fb('0xe'),'port':0x18eb});var socket=require(_0xe7fb('0xf'))(new Redis(config[_0xe7fb('0xc')]));require(_0xe7fb('0x10'))['register'](socket);function respondWithRpcPromise(_0x558857,_0x29edb2,_0x2f2ea0){return new BPromise(function(_0x41a514,_0x348a73){return client[_0xe7fb('0x11')](_0x558857,_0x2f2ea0)[_0xe7fb('0x12')](function(_0x3e934b){logger[_0xe7fb('0x13')](_0xe7fb('0x14'),_0x29edb2,_0xe7fb('0x15'));logger[_0xe7fb('0x16')](_0xe7fb('0x17'),_0x29edb2,_0xe7fb('0x15'),JSON[_0xe7fb('0x18')](_0x3e934b));if(_0x3e934b[_0xe7fb('0x19')]){if(_0x3e934b['error'][_0xe7fb('0x1a')]===0x1f4){logger[_0xe7fb('0x19')]('UserProfile,\x20%s,\x20%s',_0x29edb2,_0x3e934b[_0xe7fb('0x19')][_0xe7fb('0x1b')]);return _0x348a73(_0x3e934b['error'][_0xe7fb('0x1b')]);}logger['error'](_0xe7fb('0x14'),_0x29edb2,_0x3e934b[_0xe7fb('0x19')][_0xe7fb('0x1b')]);return _0x41a514(_0x3e934b[_0xe7fb('0x19')]['message']);}else{logger[_0xe7fb('0x13')]('UserProfile,\x20%s,\x20%s',_0x29edb2,_0xe7fb('0x15'));_0x41a514(_0x3e934b['result'][_0xe7fb('0x1b')]);}})[_0xe7fb('0x1c')](function(_0x3f96a7){logger[_0xe7fb('0x19')]('UserProfile,\x20%s,\x20%s',_0x29edb2,_0x3f96a7);_0x348a73(_0x3f96a7);});});} \ No newline at end of file +var _0xb138=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','./userProfile.socket','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error'];(function(_0x854372,_0x13fcbf){var _0x2b0f2d=function(_0x394499){while(--_0x394499){_0x854372['push'](_0x854372['shift']());}};_0x2b0f2d(++_0x13fcbf);}(_0xb138,0x1dd));var _0x8b13=function(_0x2abacb,_0x2887a0){_0x2abacb=_0x2abacb-0x0;var _0x1e0521=_0xb138[_0x2abacb];return _0x1e0521;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var moment=require(_0x8b13('0x2'));var BPromise=require(_0x8b13('0x3'));var rs=require(_0x8b13('0x4'));var fs=require('fs');var Redis=require(_0x8b13('0x5'));var db=require(_0x8b13('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b13('0x7'))(_0x8b13('0x8'));var config=require(_0x8b13('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8b13('0xa')][_0x8b13('0xb')]({'port':0x232a});config['redis']=_[_0x8b13('0xc')](config[_0x8b13('0xd')],{'host':_0x8b13('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b13('0xd')]));require(_0x8b13('0xf'))['register'](socket);function respondWithRpcPromise(_0x53ae50,_0x1f2528,_0x21fcd9){return new BPromise(function(_0x13fbd1,_0x439451){return client[_0x8b13('0x10')](_0x53ae50,_0x21fcd9)['then'](function(_0x11bc89){logger[_0x8b13('0x11')](_0x8b13('0x12'),_0x1f2528,_0x8b13('0x13'));logger[_0x8b13('0x14')](_0x8b13('0x15'),_0x1f2528,'request\x20sent',JSON['stringify'](_0x11bc89));if(_0x11bc89[_0x8b13('0x16')]){if(_0x11bc89[_0x8b13('0x16')]['code']===0x1f4){logger['error']('UserProfile,\x20%s,\x20%s',_0x1f2528,_0x11bc89[_0x8b13('0x16')][_0x8b13('0x17')]);return _0x439451(_0x11bc89[_0x8b13('0x16')][_0x8b13('0x17')]);}logger[_0x8b13('0x16')]('UserProfile,\x20%s,\x20%s',_0x1f2528,_0x11bc89[_0x8b13('0x16')][_0x8b13('0x17')]);return _0x13fbd1(_0x11bc89[_0x8b13('0x16')][_0x8b13('0x17')]);}else{logger[_0x8b13('0x11')](_0x8b13('0x12'),_0x1f2528,_0x8b13('0x13'));_0x13fbd1(_0x11bc89[_0x8b13('0x18')]['message']);}})['catch'](function(_0xae4966){logger[_0x8b13('0x16')](_0x8b13('0x12'),_0x1f2528,_0xae4966);_0x439451(_0xae4966);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index c834d4c..cbca9a6 100644 --- a/server/api/userProfile/userProfile.socket.js +++ b/server/api/userProfile/userProfile.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5852=['./userProfile.events','update','emit','register','length'];(function(_0x216bea,_0x5f8939){var _0x54dbc2=function(_0x21cfb6){while(--_0x21cfb6){_0x216bea['push'](_0x216bea['shift']());}};_0x54dbc2(++_0x5f8939);}(_0x5852,0x1ea));var _0x2585=function(_0x4582e8,_0x45f260){_0x4582e8=_0x4582e8-0x0;var _0x41d8df=_0x5852[_0x4582e8];return _0x41d8df;};'use strict';var UserProfileEvents=require(_0x2585('0x0'));var events=['save','remove',_0x2585('0x1')];function createListener(_0x3f664f,_0x4eb5eb){return function(_0x580329){_0x4eb5eb[_0x2585('0x2')](_0x3f664f,_0x580329);};}function removeListener(_0x15bd38,_0x56bac4){return function(){UserProfileEvents['removeListener'](_0x15bd38,_0x56bac4);};}exports[_0x2585('0x3')]=function(_0x10a023){for(var _0x231d77=0x0,_0x126d94=events[_0x2585('0x4')];_0x231d77<_0x126d94;_0x231d77++){var _0x4fce85=events[_0x231d77];var _0x36969e=createListener('userProfile:'+_0x4fce85,_0x10a023);UserProfileEvents['on'](_0x4fce85,_0x36969e);}}; \ No newline at end of file +var _0x21a3=['length','userProfile:','./userProfile.events','save','remove','removeListener'];(function(_0x24a1db,_0x37ae2a){var _0x59728d=function(_0x10744d){while(--_0x10744d){_0x24a1db['push'](_0x24a1db['shift']());}};_0x59728d(++_0x37ae2a);}(_0x21a3,0x1d0));var _0x321a=function(_0x542da8,_0x509c26){_0x542da8=_0x542da8-0x0;var _0x533d7e=_0x21a3[_0x542da8];return _0x533d7e;};'use strict';var UserProfileEvents=require(_0x321a('0x0'));var events=[_0x321a('0x1'),_0x321a('0x2'),'update'];function createListener(_0x2c23f6,_0x2e18bf){return function(_0x35f058){_0x2e18bf['emit'](_0x2c23f6,_0x35f058);};}function removeListener(_0x526d28,_0x383a0f){return function(){UserProfileEvents[_0x321a('0x3')](_0x526d28,_0x383a0f);};}exports['register']=function(_0x72993){for(var _0x47e0a6=0x0,_0x42adee=events[_0x321a('0x4')];_0x47e0a6<_0x42adee;_0x47e0a6++){var _0x32a01b=events[_0x47e0a6];var _0x2bf6b0=createListener(_0x321a('0x5')+_0x32a01b,_0x72993);UserProfileEvents['on'](_0x32a01b,_0x2bf6b0);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index adf2d92..f6f791a 100644 --- a/server/api/userProfileResource/index.js +++ b/server/api/userProfileResource/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4dd2=['get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','./userProfileResource.controller'];(function(_0x3cc05d,_0x4b8f88){var _0x28b736=function(_0x369b0e){while(--_0x369b0e){_0x3cc05d['push'](_0x3cc05d['shift']());}};_0x28b736(++_0x4b8f88);}(_0x4dd2,0xf1));var _0x24dd=function(_0x3fad5a,_0x2d3b02){_0x3fad5a=_0x3fad5a-0x0;var _0x4ca713=_0x4dd2[_0x3fad5a];return _0x4ca713;};'use strict';var multer=require('multer');var util=require(_0x24dd('0x0'));var path=require(_0x24dd('0x1'));var timeout=require(_0x24dd('0x2'));var express=require('express');var router=express[_0x24dd('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x24dd('0x4'));var config=require('../../config/environment');var controller=require(_0x24dd('0x5'));router[_0x24dd('0x6')]('/',auth[_0x24dd('0x7')](),controller['index']);router['get'](_0x24dd('0x8'),auth[_0x24dd('0x7')](),controller[_0x24dd('0x9')]);router[_0x24dd('0x6')](_0x24dd('0xa'),auth['isAuthenticated'](),controller[_0x24dd('0xb')]);router[_0x24dd('0xc')]('/',auth[_0x24dd('0x7')](),controller[_0x24dd('0xd')]);router[_0x24dd('0xe')]('/:id',auth[_0x24dd('0x7')](),controller[_0x24dd('0xf')]);router[_0x24dd('0x10')](_0x24dd('0xa'),auth[_0x24dd('0x7')](),controller[_0x24dd('0x11')]);module[_0x24dd('0x12')]=router; \ No newline at end of file +var _0xcf8f=['post','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','describe','get','/:id','show'];(function(_0x347862,_0x339566){var _0x2ec88b=function(_0x290bdc){while(--_0x290bdc){_0x347862['push'](_0x347862['shift']());}};_0x2ec88b(++_0x339566);}(_0xcf8f,0x78));var _0xfcf8=function(_0x4ef887,_0x35dfe){_0x4ef887=_0x4ef887-0x0;var _0x482373=_0xcf8f[_0x4ef887];return _0x482373;};'use strict';var multer=require(_0xfcf8('0x0'));var util=require(_0xfcf8('0x1'));var path=require(_0xfcf8('0x2'));var timeout=require('connect-timeout');var express=require(_0xfcf8('0x3'));var router=express[_0xfcf8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xfcf8('0x5'));var config=require(_0xfcf8('0x6'));var controller=require('./userProfileResource.controller');router['get']('/',auth[_0xfcf8('0x7')](),controller[_0xfcf8('0x8')]);router['get']('/describe',auth[_0xfcf8('0x7')](),controller[_0xfcf8('0x9')]);router[_0xfcf8('0xa')](_0xfcf8('0xb'),auth[_0xfcf8('0x7')](),controller[_0xfcf8('0xc')]);router[_0xfcf8('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xfcf8('0xe')](_0xfcf8('0xb'),auth['isAuthenticated'](),controller[_0xfcf8('0xf')]);router[_0xfcf8('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xfcf8('0x11')]);module[_0xfcf8('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 224edf7..5277ce9 100644 --- a/server/api/userProfileResource/userProfileResource.attributes.js +++ b/server/api/userProfileResource/userProfileResource.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4488=['exports','STRING','sequelize'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0x4488,0xa4));var _0x8448=function(_0x14ca5c,_0x11ddea){_0x14ca5c=_0x14ca5c-0x0;var _0x2a59e3=_0x4488[_0x14ca5c];return _0x2a59e3;};'use strict';var Sequelize=require(_0x8448('0x0'));module[_0x8448('0x1')]={'name':{'type':Sequelize[_0x8448('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x8448('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7b2d=['STRING','sequelize','exports'];(function(_0x4c9915,_0x406b1a){var _0x473218=function(_0x2536ba){while(--_0x2536ba){_0x4c9915['push'](_0x4c9915['shift']());}};_0x473218(++_0x406b1a);}(_0x7b2d,0x190));var _0xd7b2=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x7b2d[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0xd7b2('0x0'));module[_0xd7b2('0x1')]={'name':{'type':Sequelize[_0xd7b2('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xd7b2('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index e61711b..7bb3616 100644 --- a/server/api/userProfileResource/userProfileResource.controller.js +++ b/server/api/userProfileResource/userProfileResource.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6334=['desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','json','count','offset','limit','status','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','UserProfileResource','rawAttributes','type','key','model','query','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','include','findAll','rows','catch','show','keys','includeAll','options','find','create','update','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce'];(function(_0x5be652,_0x129d44){var _0x3c89da=function(_0x2f01ac){while(--_0x2f01ac){_0x5be652['push'](_0x5be652['shift']());}};_0x3c89da(++_0x129d44);}(_0x6334,0x119));var _0x4633=function(_0x463376,_0x13871c){_0x463376=_0x463376-0x0;var _0x336ccd=_0x6334[_0x463376];return _0x336ccd;};'use strict';var pdf=require(_0x4633('0x0'));var emlformat=require(_0x4633('0x1'));var rimraf=require(_0x4633('0x2'));var zipdir=require(_0x4633('0x3'));var jsonpatch=require(_0x4633('0x4'));var rp=require(_0x4633('0x5'));var moment=require('moment');var BPromise=require(_0x4633('0x6'));var Mustache=require(_0x4633('0x7'));var util=require(_0x4633('0x8'));var path=require(_0x4633('0x9'));var sox=require(_0x4633('0xa'));var csv=require(_0x4633('0xb'));var ejs=require(_0x4633('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4633('0xd'));var crypto=require('crypto');var jsforce=require(_0x4633('0xe'));var deskjs=require(_0x4633('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4633('0x10'));var Papa=require(_0x4633('0x11'));var Redis=require(_0x4633('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4633('0x13'));var as=require(_0x4633('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4633('0x15'))(_0x4633('0x16'));var utils=require(_0x4633('0x17'));var config=require(_0x4633('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x73b5e4,_0xad405){_0xad405=_0xad405||0xcc;return function(_0x438e87){if(_0x438e87){return _0x73b5e4['sendStatus'](_0xad405);}return _0x73b5e4['status'](_0xad405)['end']();};}function respondWithResult(_0x28e2bc,_0x1fd00c){_0x1fd00c=_0x1fd00c||0xc8;return function(_0x579229){if(_0x579229){return _0x28e2bc['status'](_0x1fd00c)[_0x4633('0x19')](_0x579229);}};}function respondWithFilteredResult(_0x4813c5,_0xcdffcc){return function(_0x33b6e7){if(_0x33b6e7){var _0x2e2dc3=_0x33b6e7[_0x4633('0x1a')],_0x11fef9=_0xcdffcc[_0x4633('0x1b')],_0x5358a3=_0xcdffcc['offset']+_0xcdffcc[_0x4633('0x1c')],_0x2c38e5;if(_0x5358a3>=_0x2e2dc3){_0x5358a3=_0x2e2dc3;_0x2c38e5=0xc8;}else{_0x2c38e5=0xce;}_0x4813c5[_0x4633('0x1d')](_0x2c38e5);return _0x4813c5[_0x4633('0x1e')](_0x4633('0x1f'),_0x11fef9+'-'+_0x5358a3+'/'+_0x2e2dc3)[_0x4633('0x19')](_0x33b6e7);}return null;};}function patchUpdates(_0x5953b8){return function(_0x4691f2){try{jsonpatch[_0x4633('0x20')](_0x4691f2,_0x5953b8,!![]);}catch(_0x5c295d){return BPromise['reject'](_0x5c295d);}return _0x4691f2[_0x4633('0x21')]();};}function saveUpdates(_0x49e5c7,_0x35e2ad){return function(_0x5b5011){if(_0x5b5011){return _0x5b5011['update'](_0x49e5c7)[_0x4633('0x22')](function(_0x177b39){return _0x177b39;});}return null;};}function removeEntity(_0x23bc5e,_0x604f3d){return function(_0xd1fcc6){if(_0xd1fcc6){return _0xd1fcc6[_0x4633('0x23')]()['then'](function(){_0x23bc5e[_0x4633('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22d9c1,_0xcfac3f){return function(_0xe77cfc){if(!_0xe77cfc){_0x22d9c1[_0x4633('0x24')](0x194);}return _0xe77cfc;};}function handleError(_0x45db49,_0x49880a){_0x49880a=_0x49880a||0x1f4;return function(_0x3af747){logger[_0x4633('0x25')](_0x3af747[_0x4633('0x26')]);if(_0x3af747[_0x4633('0x27')]){delete _0x3af747[_0x4633('0x27')];}_0x45db49[_0x4633('0x1d')](_0x49880a)[_0x4633('0x28')](_0x3af747);};}exports[_0x4633('0x29')]=function(_0xef2ecf,_0x7d7f2){var _0x1b9ed8={},_0x2539a2={},_0x1fdc67={'count':0x0,'rows':[]};var _0x2970a6=_[_0x4633('0x2a')](db[_0x4633('0x2b')][_0x4633('0x2c')],function(_0x139e5e){return{'name':_0x139e5e['fieldName'],'type':_0x139e5e[_0x4633('0x2d')][_0x4633('0x2e')]};});_0x2539a2[_0x4633('0x2f')]=_[_0x4633('0x2a')](_0x2970a6,_0x4633('0x27'));_0x2539a2[_0x4633('0x30')]=_['keys'](_0xef2ecf[_0x4633('0x30')]);_0x2539a2['filters']=_[_0x4633('0x31')](_0x2539a2[_0x4633('0x2f')],_0x2539a2[_0x4633('0x30')]);_0x1b9ed8[_0x4633('0x32')]=_[_0x4633('0x31')](_0x2539a2[_0x4633('0x2f')],qs[_0x4633('0x33')](_0xef2ecf[_0x4633('0x30')][_0x4633('0x33')]));_0x1b9ed8[_0x4633('0x32')]=_0x1b9ed8[_0x4633('0x32')][_0x4633('0x34')]?_0x1b9ed8[_0x4633('0x32')]:_0x2539a2[_0x4633('0x2f')];if(!_0xef2ecf['query']['hasOwnProperty'](_0x4633('0x35'))){_0x1b9ed8[_0x4633('0x1c')]=qs['limit'](_0xef2ecf[_0x4633('0x30')][_0x4633('0x1c')]);_0x1b9ed8[_0x4633('0x1b')]=qs[_0x4633('0x1b')](_0xef2ecf['query'][_0x4633('0x1b')]);}_0x1b9ed8['order']=qs[_0x4633('0x36')](_0xef2ecf[_0x4633('0x30')][_0x4633('0x36')]);_0x1b9ed8[_0x4633('0x37')]=qs[_0x4633('0x38')](_[_0x4633('0x39')](_0xef2ecf[_0x4633('0x30')],_0x2539a2[_0x4633('0x38')]),_0x2970a6);if(_0xef2ecf['query'][_0x4633('0x3a')]){_0x1b9ed8[_0x4633('0x37')]=_['merge'](_0x1b9ed8[_0x4633('0x37')],{'$or':_[_0x4633('0x2a')](_0x2970a6,function(_0x11fb61){if(_0x11fb61[_0x4633('0x2d')]!=='VIRTUAL'){var _0x4bb176={};_0x4bb176[_0x11fb61[_0x4633('0x27')]]={'$like':'%'+_0xef2ecf['query']['filter']+'%'};return _0x4bb176;}})});}_0x1b9ed8=_[_0x4633('0x3b')]({},_0x1b9ed8,_0xef2ecf['options']);var _0x4c83b8={'where':_0x1b9ed8[_0x4633('0x37')]};return db[_0x4633('0x2b')][_0x4633('0x1a')](_0x4c83b8)[_0x4633('0x22')](function(_0x2cdb28){_0x1fdc67['count']=_0x2cdb28;if(_0xef2ecf[_0x4633('0x30')]['includeAll']){_0x1b9ed8[_0x4633('0x3c')]=[{'all':!![]}];}return db[_0x4633('0x2b')][_0x4633('0x3d')](_0x1b9ed8);})[_0x4633('0x22')](function(_0x490a18){_0x1fdc67[_0x4633('0x3e')]=_0x490a18;return _0x1fdc67;})['then'](respondWithFilteredResult(_0x7d7f2,_0x1b9ed8))[_0x4633('0x3f')](handleError(_0x7d7f2,null));};exports[_0x4633('0x40')]=function(_0x3c26d6,_0x452096){var _0x350e46={'raw':![],'where':{'id':_0x3c26d6['params']['id']}},_0x4d399f={};_0x4d399f[_0x4633('0x2f')]=_[_0x4633('0x41')](db[_0x4633('0x2b')][_0x4633('0x2c')]);_0x4d399f[_0x4633('0x30')]=_['keys'](_0x3c26d6[_0x4633('0x30')]);_0x4d399f['filters']=_[_0x4633('0x31')](_0x4d399f['model'],_0x4d399f[_0x4633('0x30')]);_0x350e46['attributes']=_[_0x4633('0x31')](_0x4d399f[_0x4633('0x2f')],qs[_0x4633('0x33')](_0x3c26d6[_0x4633('0x30')][_0x4633('0x33')]));_0x350e46[_0x4633('0x32')]=_0x350e46[_0x4633('0x32')][_0x4633('0x34')]?_0x350e46[_0x4633('0x32')]:_0x4d399f[_0x4633('0x2f')];if(_0x3c26d6[_0x4633('0x30')][_0x4633('0x42')]){_0x350e46[_0x4633('0x3c')]=[{'all':!![]}];}_0x350e46=_[_0x4633('0x3b')]({},_0x350e46,_0x3c26d6[_0x4633('0x43')]);return db[_0x4633('0x2b')][_0x4633('0x44')](_0x350e46)[_0x4633('0x22')](handleEntityNotFound(_0x452096,null))[_0x4633('0x22')](respondWithResult(_0x452096,null))[_0x4633('0x3f')](handleError(_0x452096,null));};exports[_0x4633('0x45')]=function(_0x486c29,_0x572102){return db[_0x4633('0x2b')]['create'](_0x486c29['body'],{})['then'](respondWithResult(_0x572102,0xc9))[_0x4633('0x3f')](handleError(_0x572102,null));};exports[_0x4633('0x46')]=function(_0x5cb4cc,_0x35b82a){if(_0x5cb4cc[_0x4633('0x47')]['id']){delete _0x5cb4cc[_0x4633('0x47')]['id'];}return db[_0x4633('0x2b')][_0x4633('0x44')]({'where':{'id':_0x5cb4cc[_0x4633('0x48')]['id']}})['then'](handleEntityNotFound(_0x35b82a,null))['then'](saveUpdates(_0x5cb4cc['body'],null))[_0x4633('0x22')](respondWithResult(_0x35b82a,null))[_0x4633('0x3f')](handleError(_0x35b82a,null));};exports[_0x4633('0x23')]=function(_0x5b6fec,_0x3a565d){return db[_0x4633('0x2b')]['find']({'where':{'id':_0x5b6fec[_0x4633('0x48')]['id']}})[_0x4633('0x22')](handleEntityNotFound(_0x3a565d,null))[_0x4633('0x22')](removeEntity(_0x3a565d,null))['catch'](handleError(_0x3a565d,null));};exports['describe']=function(_0x12e416,_0x4bab8d){return db[_0x4633('0x2b')][_0x4633('0x49')]()[_0x4633('0x22')](respondWithResult(_0x4bab8d,null))['catch'](handleError(_0x4bab8d,null));}; \ No newline at end of file +var _0xe015=['key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','keys','find','catch','create','body','update','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','UserProfileResource'];(function(_0x226836,_0x4b0ee3){var _0x41ad05=function(_0xdef3db){while(--_0xdef3db){_0x226836['push'](_0x226836['shift']());}};_0x41ad05(++_0x4b0ee3);}(_0xe015,0x13b));var _0x5e01=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xe015[_0x27af45];return _0x18df21;};'use strict';var pdf=require(_0x5e01('0x0'));var emlformat=require(_0x5e01('0x1'));var rimraf=require(_0x5e01('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5e01('0x3'));var moment=require('moment');var BPromise=require(_0x5e01('0x4'));var Mustache=require(_0x5e01('0x5'));var util=require(_0x5e01('0x6'));var path=require(_0x5e01('0x7'));var sox=require('sox');var csv=require(_0x5e01('0x8'));var ejs=require(_0x5e01('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5e01('0xa'));var jsforce=require(_0x5e01('0xb'));var deskjs=require(_0x5e01('0xc'));var toCsv=require(_0x5e01('0x8'));var querystring=require(_0x5e01('0xd'));var Papa=require(_0x5e01('0xe'));var Redis=require('ioredis');var authService=require(_0x5e01('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5e01('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e01('0x11'))(_0x5e01('0x12'));var utils=require('../../config/utils');var config=require(_0x5e01('0x13'));var db=require(_0x5e01('0x14'))['db'];function respondWithStatusCode(_0x4a4f01,_0x560ae2){_0x560ae2=_0x560ae2||0xcc;return function(_0x3d0b04){if(_0x3d0b04){return _0x4a4f01[_0x5e01('0x15')](_0x560ae2);}return _0x4a4f01[_0x5e01('0x16')](_0x560ae2)[_0x5e01('0x17')]();};}function respondWithResult(_0x3ecf64,_0x16bc8f){_0x16bc8f=_0x16bc8f||0xc8;return function(_0x4bd426){if(_0x4bd426){return _0x3ecf64[_0x5e01('0x16')](_0x16bc8f)['json'](_0x4bd426);}};}function respondWithFilteredResult(_0x4ab9b2,_0x1df2e0){return function(_0x2dd70c){if(_0x2dd70c){var _0x494b8a=_0x2dd70c['count'],_0x27c6e7=_0x1df2e0[_0x5e01('0x18')],_0x5a532d=_0x1df2e0['offset']+_0x1df2e0[_0x5e01('0x19')],_0x4fb33e;if(_0x5a532d>=_0x494b8a){_0x5a532d=_0x494b8a;_0x4fb33e=0xc8;}else{_0x4fb33e=0xce;}_0x4ab9b2['status'](_0x4fb33e);return _0x4ab9b2['set'](_0x5e01('0x1a'),_0x27c6e7+'-'+_0x5a532d+'/'+_0x494b8a)[_0x5e01('0x1b')](_0x2dd70c);}return null;};}function patchUpdates(_0x4fa1c7){return function(_0xce3f3f){try{jsonpatch[_0x5e01('0x1c')](_0xce3f3f,_0x4fa1c7,!![]);}catch(_0x36b4a7){return BPromise[_0x5e01('0x1d')](_0x36b4a7);}return _0xce3f3f[_0x5e01('0x1e')]();};}function saveUpdates(_0x35eb4e,_0x173410){return function(_0x153eb1){if(_0x153eb1){return _0x153eb1['update'](_0x35eb4e)[_0x5e01('0x1f')](function(_0x208586){return _0x208586;});}return null;};}function removeEntity(_0x4b28ca,_0xf6fe3f){return function(_0x306cff){if(_0x306cff){return _0x306cff[_0x5e01('0x20')]()[_0x5e01('0x1f')](function(){_0x4b28ca[_0x5e01('0x16')](0xcc)[_0x5e01('0x17')]();});}};}function handleEntityNotFound(_0x5efff9,_0x329315){return function(_0x720922){if(!_0x720922){_0x5efff9[_0x5e01('0x15')](0x194);}return _0x720922;};}function handleError(_0x52ccd0,_0x514ade){_0x514ade=_0x514ade||0x1f4;return function(_0x557f06){logger[_0x5e01('0x21')](_0x557f06[_0x5e01('0x22')]);if(_0x557f06['name']){delete _0x557f06[_0x5e01('0x23')];}_0x52ccd0[_0x5e01('0x16')](_0x514ade)[_0x5e01('0x24')](_0x557f06);};}exports[_0x5e01('0x25')]=function(_0x58dc6f,_0x4d0ebe){var _0xca92be={},_0x5f01dd={},_0x14b9f5={'count':0x0,'rows':[]};var _0x1332bb=_[_0x5e01('0x26')](db[_0x5e01('0x27')]['rawAttributes'],function(_0x531f0a){return{'name':_0x531f0a['fieldName'],'type':_0x531f0a['type'][_0x5e01('0x28')]};});_0x5f01dd['model']=_[_0x5e01('0x26')](_0x1332bb,_0x5e01('0x23'));_0x5f01dd[_0x5e01('0x29')]=_['keys'](_0x58dc6f[_0x5e01('0x29')]);_0x5f01dd[_0x5e01('0x2a')]=_[_0x5e01('0x2b')](_0x5f01dd[_0x5e01('0x2c')],_0x5f01dd['query']);_0xca92be['attributes']=_[_0x5e01('0x2b')](_0x5f01dd[_0x5e01('0x2c')],qs[_0x5e01('0x2d')](_0x58dc6f[_0x5e01('0x29')][_0x5e01('0x2d')]));_0xca92be[_0x5e01('0x2e')]=_0xca92be[_0x5e01('0x2e')][_0x5e01('0x2f')]?_0xca92be[_0x5e01('0x2e')]:_0x5f01dd[_0x5e01('0x2c')];if(!_0x58dc6f[_0x5e01('0x29')][_0x5e01('0x30')]('nolimit')){_0xca92be[_0x5e01('0x19')]=qs[_0x5e01('0x19')](_0x58dc6f[_0x5e01('0x29')]['limit']);_0xca92be[_0x5e01('0x18')]=qs[_0x5e01('0x18')](_0x58dc6f['query'][_0x5e01('0x18')]);}_0xca92be[_0x5e01('0x31')]=qs[_0x5e01('0x32')](_0x58dc6f['query'][_0x5e01('0x32')]);_0xca92be[_0x5e01('0x33')]=qs[_0x5e01('0x2a')](_[_0x5e01('0x34')](_0x58dc6f[_0x5e01('0x29')],_0x5f01dd[_0x5e01('0x2a')]),_0x1332bb);if(_0x58dc6f[_0x5e01('0x29')][_0x5e01('0x35')]){_0xca92be[_0x5e01('0x33')]=_[_0x5e01('0x36')](_0xca92be[_0x5e01('0x33')],{'$or':_[_0x5e01('0x26')](_0x1332bb,function(_0x20f3c6){if(_0x20f3c6[_0x5e01('0x37')]!==_0x5e01('0x38')){var _0x578d61={};_0x578d61[_0x20f3c6[_0x5e01('0x23')]]={'$like':'%'+_0x58dc6f['query']['filter']+'%'};return _0x578d61;}})});}_0xca92be=_[_0x5e01('0x36')]({},_0xca92be,_0x58dc6f[_0x5e01('0x39')]);var _0x120b7b={'where':_0xca92be[_0x5e01('0x33')]};return db[_0x5e01('0x27')]['count'](_0x120b7b)[_0x5e01('0x1f')](function(_0x1770e5){_0x14b9f5['count']=_0x1770e5;if(_0x58dc6f[_0x5e01('0x29')][_0x5e01('0x3a')]){_0xca92be[_0x5e01('0x3b')]=[{'all':!![]}];}return db['UserProfileResource'][_0x5e01('0x3c')](_0xca92be);})[_0x5e01('0x1f')](function(_0x503c8c){_0x14b9f5[_0x5e01('0x3d')]=_0x503c8c;return _0x14b9f5;})[_0x5e01('0x1f')](respondWithFilteredResult(_0x4d0ebe,_0xca92be))['catch'](handleError(_0x4d0ebe,null));};exports['show']=function(_0xce5f1b,_0x4fe865){var _0x2d7423={'raw':![],'where':{'id':_0xce5f1b[_0x5e01('0x3e')]['id']}},_0x1b1d35={};_0x1b1d35[_0x5e01('0x2c')]=_['keys'](db[_0x5e01('0x27')][_0x5e01('0x3f')]);_0x1b1d35[_0x5e01('0x29')]=_[_0x5e01('0x40')](_0xce5f1b[_0x5e01('0x29')]);_0x1b1d35[_0x5e01('0x2a')]=_[_0x5e01('0x2b')](_0x1b1d35['model'],_0x1b1d35[_0x5e01('0x29')]);_0x2d7423[_0x5e01('0x2e')]=_[_0x5e01('0x2b')](_0x1b1d35[_0x5e01('0x2c')],qs[_0x5e01('0x2d')](_0xce5f1b['query'][_0x5e01('0x2d')]));_0x2d7423[_0x5e01('0x2e')]=_0x2d7423[_0x5e01('0x2e')][_0x5e01('0x2f')]?_0x2d7423[_0x5e01('0x2e')]:_0x1b1d35[_0x5e01('0x2c')];if(_0xce5f1b[_0x5e01('0x29')]['includeAll']){_0x2d7423[_0x5e01('0x3b')]=[{'all':!![]}];}_0x2d7423=_['merge']({},_0x2d7423,_0xce5f1b[_0x5e01('0x39')]);return db[_0x5e01('0x27')][_0x5e01('0x41')](_0x2d7423)[_0x5e01('0x1f')](handleEntityNotFound(_0x4fe865,null))[_0x5e01('0x1f')](respondWithResult(_0x4fe865,null))[_0x5e01('0x42')](handleError(_0x4fe865,null));};exports['create']=function(_0x24541a,_0x4a5f37){return db[_0x5e01('0x27')][_0x5e01('0x43')](_0x24541a[_0x5e01('0x44')],{})[_0x5e01('0x1f')](respondWithResult(_0x4a5f37,0xc9))[_0x5e01('0x42')](handleError(_0x4a5f37,null));};exports[_0x5e01('0x45')]=function(_0x555204,_0x5cf1e4){if(_0x555204[_0x5e01('0x44')]['id']){delete _0x555204[_0x5e01('0x44')]['id'];}return db[_0x5e01('0x27')][_0x5e01('0x41')]({'where':{'id':_0x555204[_0x5e01('0x3e')]['id']}})[_0x5e01('0x1f')](handleEntityNotFound(_0x5cf1e4,null))[_0x5e01('0x1f')](saveUpdates(_0x555204[_0x5e01('0x44')],null))[_0x5e01('0x1f')](respondWithResult(_0x5cf1e4,null))[_0x5e01('0x42')](handleError(_0x5cf1e4,null));};exports[_0x5e01('0x20')]=function(_0x5cd7ec,_0x470cec){return db[_0x5e01('0x27')][_0x5e01('0x41')]({'where':{'id':_0x5cd7ec['params']['id']}})[_0x5e01('0x1f')](handleEntityNotFound(_0x470cec,null))[_0x5e01('0x1f')](removeEntity(_0x470cec,null))[_0x5e01('0x42')](handleError(_0x470cec,null));};exports[_0x5e01('0x46')]=function(_0x3bb6a8,_0x538a39){return db[_0x5e01('0x27')]['describe']()[_0x5e01('0x1f')](respondWithResult(_0x538a39,null))[_0x5e01('0x42')](handleError(_0x538a39,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 4b58b3a..92007f5 100644 --- a/server/api/userProfileResource/userProfileResource.model.js +++ b/server/api/userProfileResource/userProfileResource.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f7a=['request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','resourceId','sectionId','lodash','util','../../config/logger','api','bluebird'];(function(_0x1d9dfa,_0x30598d){var _0x252661=function(_0x4bcc24){while(--_0x4bcc24){_0x1d9dfa['push'](_0x1d9dfa['shift']());}};_0x252661(++_0x30598d);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x4f13c0,_0x4e143c){_0x4f13c0=_0x4f13c0-0x0;var _0x48221c=_0x6f7a[_0x4f13c0];return _0x48221c;};'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 fs=require('fs');var path=require(_0xa6f7('0x6'));var rimraf=require(_0xa6f7('0x7'));var config=require(_0xa6f7('0x8'));var attributes=require(_0xa6f7('0x9'));module[_0xa6f7('0xa')]=function(_0x20cccd,_0x1fdd5f){return _0x20cccd[_0xa6f7('0xb')](_0xa6f7('0xc'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xa6f7('0xd'),_0xa6f7('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb43b=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId'];(function(_0x216cab,_0x1d8048){var _0x1f7ce7=function(_0x3c585b){while(--_0x3c585b){_0x216cab['push'](_0x216cab['shift']());}};_0x1f7ce7(++_0x1d8048);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5e553c,_0x3b5b19){_0x5e553c=_0x5e553c-0x0;var _0x3da209=_0xb43b[_0x5e553c];return _0x3da209;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[{'name':_0xbb43('0xb'),'fields':[_0xbb43('0xc'),_0xbb43('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index bfe8d77..5f2b530 100644 --- a/server/api/userProfileResource/userProfileResource.rpc.js +++ b/server/api/userProfileResource/userProfileResource.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7486=['request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http'];(function(_0x3a19d4,_0x3f19a4){var _0x5b858b=function(_0x4ddce5){while(--_0x4ddce5){_0x3a19d4['push'](_0x3a19d4['shift']());}};_0x5b858b(++_0x3f19a4);}(_0x7486,0x182));var _0x6748=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7486[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6748('0x0'));var util=require(_0x6748('0x1'));var moment=require(_0x6748('0x2'));var BPromise=require(_0x6748('0x3'));var rs=require(_0x6748('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6748('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6748('0x6'))(_0x6748('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6748('0x8')][_0x6748('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ce459,_0x31f9e9,_0x234e9d){return new BPromise(function(_0x5bc3a1,_0xd59acd){return client[_0x6748('0xa')](_0x5ce459,_0x234e9d)[_0x6748('0xb')](function(_0x235774){logger[_0x6748('0xc')](_0x6748('0xd'),_0x31f9e9,_0x6748('0xe'));logger[_0x6748('0xf')](_0x6748('0x10'),_0x31f9e9,_0x6748('0xe'),JSON['stringify'](_0x235774));if(_0x235774['error']){if(_0x235774['error'][_0x6748('0x11')]===0x1f4){logger[_0x6748('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x31f9e9,_0x235774[_0x6748('0x12')][_0x6748('0x13')]);return _0xd59acd(_0x235774['error']['message']);}logger[_0x6748('0x12')](_0x6748('0xd'),_0x31f9e9,_0x235774[_0x6748('0x12')][_0x6748('0x13')]);return _0x5bc3a1(_0x235774[_0x6748('0x12')][_0x6748('0x13')]);}else{logger[_0x6748('0xc')](_0x6748('0xd'),_0x31f9e9,_0x6748('0xe'));_0x5bc3a1(_0x235774[_0x6748('0x14')][_0x6748('0x13')]);}})[_0x6748('0x15')](function(_0x2d30e6){logger[_0x6748('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x31f9e9,_0x2d30e6);_0xd59acd(_0x2d30e6);});});} \ No newline at end of file +var _0x4156=['message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','request','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x33575a,_0x36431e){var _0x134235=function(_0x2f736f){while(--_0x2f736f){_0x33575a['push'](_0x33575a['shift']());}};_0x134235(++_0x36431e);}(_0x4156,0x122));var _0x6415=function(_0x335fa2,_0x4c6dfb){_0x335fa2=_0x335fa2-0x0;var _0x4e1060=_0x4156[_0x335fa2];return _0x4e1060;};'use strict';var _=require(_0x6415('0x0'));var util=require(_0x6415('0x1'));var moment=require(_0x6415('0x2'));var BPromise=require(_0x6415('0x3'));var rs=require(_0x6415('0x4'));var fs=require('fs');var Redis=require(_0x6415('0x5'));var db=require(_0x6415('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6415('0x7'));var config=require(_0x6415('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6415('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b5157,_0x30b6be,_0x58fc0c){return new BPromise(function(_0x15af40,_0x11a61c){return client[_0x6415('0xa')](_0x2b5157,_0x58fc0c)['then'](function(_0x5203bd){logger['info'](_0x6415('0xb'),_0x30b6be,_0x6415('0xc'));logger[_0x6415('0xd')](_0x6415('0xe'),_0x30b6be,_0x6415('0xc'),JSON[_0x6415('0xf')](_0x5203bd));if(_0x5203bd['error']){if(_0x5203bd[_0x6415('0x10')][_0x6415('0x11')]===0x1f4){logger[_0x6415('0x10')](_0x6415('0xb'),_0x30b6be,_0x5203bd[_0x6415('0x10')][_0x6415('0x12')]);return _0x11a61c(_0x5203bd[_0x6415('0x10')]['message']);}logger[_0x6415('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x30b6be,_0x5203bd[_0x6415('0x10')][_0x6415('0x12')]);return _0x15af40(_0x5203bd[_0x6415('0x10')][_0x6415('0x12')]);}else{logger[_0x6415('0x13')](_0x6415('0xb'),_0x30b6be,_0x6415('0xc'));_0x15af40(_0x5203bd[_0x6415('0x14')][_0x6415('0x12')]);}})[_0x6415('0x15')](function(_0x306557){logger[_0x6415('0x10')](_0x6415('0xb'),_0x30b6be,_0x306557);_0x11a61c(_0x306557);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index ca4e106..5cd8fc3 100644 --- a/server/api/userProfileSection/index.js +++ b/server/api/userProfileSection/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ee9=['describe','/:id','create','put','update','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3ee9,0xd5));var _0x93ee=function(_0x21d1eb,_0x56f664){_0x21d1eb=_0x21d1eb-0x0;var _0x4cb8cd=_0x3ee9[_0x21d1eb];return _0x4cb8cd;};'use strict';var multer=require(_0x93ee('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x93ee('0x1'));var express=require('express');var router=express[_0x93ee('0x2')]();var auth=require(_0x93ee('0x3'));var interaction=require(_0x93ee('0x4'));var config=require(_0x93ee('0x5'));var controller=require(_0x93ee('0x6'));router[_0x93ee('0x7')]('/',auth[_0x93ee('0x8')](),controller[_0x93ee('0x9')]);router[_0x93ee('0x7')](_0x93ee('0xa'),auth[_0x93ee('0x8')](),controller[_0x93ee('0xb')]);router[_0x93ee('0x7')](_0x93ee('0xc'),auth[_0x93ee('0x8')](),controller['show']);router['post']('/',auth[_0x93ee('0x8')](),controller[_0x93ee('0xd')]);router[_0x93ee('0xe')](_0x93ee('0xc'),auth[_0x93ee('0x8')](),controller[_0x93ee('0xf')]);router['delete'](_0x93ee('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5f44=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5f44,0x1c4));var _0x45f4=function(_0x44ade0,_0x1996e2){_0x44ade0=_0x44ade0-0x0;var _0x1fba3c=_0x5f44[_0x44ade0];return _0x1fba3c;};'use strict';var multer=require(_0x45f4('0x0'));var util=require(_0x45f4('0x1'));var path=require('path');var timeout=require(_0x45f4('0x2'));var express=require(_0x45f4('0x3'));var router=express[_0x45f4('0x4')]();var auth=require(_0x45f4('0x5'));var interaction=require(_0x45f4('0x6'));var config=require(_0x45f4('0x7'));var controller=require(_0x45f4('0x8'));router[_0x45f4('0x9')]('/',auth[_0x45f4('0xa')](),controller[_0x45f4('0xb')]);router[_0x45f4('0x9')](_0x45f4('0xc'),auth['isAuthenticated'](),controller[_0x45f4('0xd')]);router[_0x45f4('0x9')](_0x45f4('0xe'),auth[_0x45f4('0xa')](),controller[_0x45f4('0xf')]);router[_0x45f4('0x10')]('/',auth['isAuthenticated'](),controller[_0x45f4('0x11')]);router[_0x45f4('0x12')]('/:id',auth[_0x45f4('0xa')](),controller[_0x45f4('0x13')]);router[_0x45f4('0x14')](_0x45f4('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x45f4('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index fe8b977..b7923b5 100644 --- a/server/api/userProfileSection/userProfileSection.attributes.js +++ b/server/api/userProfileSection/userProfileSection.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44f6=['setDataValue','getDataValue','crudPermissions','split','sequelize','exports','STRING','BOOLEAN'];(function(_0x404afb,_0x6e2ab2){var _0x19b697=function(_0x5bca8f){while(--_0x5bca8f){_0x404afb['push'](_0x404afb['shift']());}};_0x19b697(++_0x6e2ab2);}(_0x44f6,0xa4));var _0x644f=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0x44f6[_0x46efd7];return _0x5637e4;};'use strict';var Sequelize=require(_0x644f('0x0'));module[_0x644f('0x1')]={'name':{'type':Sequelize[_0x644f('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x644f('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x644f('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x644f('0x2')],'set':function(_0x1045bd){this[_0x644f('0x4')]('crudPermissions',_0x1045bd?_0x1045bd['join'](''):[]);},'get':function(){return this[_0x644f('0x5')](_0x644f('0x6'))?this[_0x644f('0x5')](_0x644f('0x6'))[_0x644f('0x7')](''):[];}}}; \ No newline at end of file +var _0x865d=['BOOLEAN','setDataValue','crudPermissions','join','split','sequelize','exports','STRING','INTEGER'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0x865d,0x1d9));var _0xd865=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x865d[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0xd865('0x0'));module[_0xd865('0x1')]={'name':{'type':Sequelize[_0xd865('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xd865('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xd865('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xd865('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xd865('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xd865('0x2')],'set':function(_0x5dfa34){this[_0xd865('0x5')](_0xd865('0x6'),_0x5dfa34?_0x5dfa34[_0xd865('0x7')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this['getDataValue'](_0xd865('0x6'))[_0xd865('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index e19d212..d888f3d 100644 --- a/server/api/userProfileSection/userProfileSection.controller.js +++ b/server/api/userProfileSection/userProfileSection.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4f4=['error','stack','name','send','index','map','UserProfileSection','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy'];(function(_0x1c7071,_0x3dce9c){var _0x352fd9=function(_0x422933){while(--_0x422933){_0x1c7071['push'](_0x1c7071['shift']());}};_0x352fd9(++_0x3dce9c);}(_0xd4f4,0x6d));var _0x4d4f=function(_0x20fa58,_0x29e98e){_0x20fa58=_0x20fa58-0x0;var _0x5c2b70=_0xd4f4[_0x20fa58];return _0x5c2b70;};'use strict';var pdf=require(_0x4d4f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4d4f('0x1'));var zipdir=require(_0x4d4f('0x2'));var jsonpatch=require(_0x4d4f('0x3'));var rp=require(_0x4d4f('0x4'));var moment=require(_0x4d4f('0x5'));var BPromise=require(_0x4d4f('0x6'));var Mustache=require('mustache');var util=require(_0x4d4f('0x7'));var path=require(_0x4d4f('0x8'));var sox=require(_0x4d4f('0x9'));var csv=require(_0x4d4f('0xa'));var ejs=require(_0x4d4f('0xb'));var fs=require('fs');var _=require(_0x4d4f('0xc'));var squel=require('squel');var crypto=require(_0x4d4f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4d4f('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4d4f('0xf'));var Redis=require(_0x4d4f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4d4f('0x11'));var as=require(_0x4d4f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4d4f('0x13'))(_0x4d4f('0x14'));var utils=require(_0x4d4f('0x15'));var config=require(_0x4d4f('0x16'));var db=require(_0x4d4f('0x17'))['db'];function respondWithStatusCode(_0x584eb9,_0x2be82b){_0x2be82b=_0x2be82b||0xcc;return function(_0x103e2f){if(_0x103e2f){return _0x584eb9[_0x4d4f('0x18')](_0x2be82b);}return _0x584eb9[_0x4d4f('0x19')](_0x2be82b)[_0x4d4f('0x1a')]();};}function respondWithResult(_0x349da5,_0x2e9554){_0x2e9554=_0x2e9554||0xc8;return function(_0x195228){if(_0x195228){return _0x349da5[_0x4d4f('0x19')](_0x2e9554)[_0x4d4f('0x1b')](_0x195228);}};}function respondWithFilteredResult(_0x14e231,_0x11ded2){return function(_0x4a4002){if(_0x4a4002){var _0x551b3f=_0x4a4002[_0x4d4f('0x1c')],_0x347fda=_0x11ded2[_0x4d4f('0x1d')],_0xdb0253=_0x11ded2[_0x4d4f('0x1d')]+_0x11ded2['limit'],_0x1dbc2c;if(_0xdb0253>=_0x551b3f){_0xdb0253=_0x551b3f;_0x1dbc2c=0xc8;}else{_0x1dbc2c=0xce;}_0x14e231[_0x4d4f('0x19')](_0x1dbc2c);return _0x14e231[_0x4d4f('0x1e')](_0x4d4f('0x1f'),_0x347fda+'-'+_0xdb0253+'/'+_0x551b3f)['json'](_0x4a4002);}return null;};}function patchUpdates(_0x550df7){return function(_0xaf186){try{jsonpatch[_0x4d4f('0x20')](_0xaf186,_0x550df7,!![]);}catch(_0x5efec7){return BPromise['reject'](_0x5efec7);}return _0xaf186[_0x4d4f('0x21')]();};}function saveUpdates(_0x2d466f,_0x48ab4f){return function(_0x53158d){if(_0x53158d){return _0x53158d[_0x4d4f('0x22')](_0x2d466f)[_0x4d4f('0x23')](function(_0x2e9727){return _0x2e9727;});}return null;};}function removeEntity(_0x5ec797,_0x46b0dd){return function(_0x581ac6){if(_0x581ac6){return _0x581ac6[_0x4d4f('0x24')]()[_0x4d4f('0x23')](function(){_0x5ec797['status'](0xcc)[_0x4d4f('0x1a')]();});}};}function handleEntityNotFound(_0x1b9cf1,_0x3f3e49){return function(_0x33e99d){if(!_0x33e99d){_0x1b9cf1[_0x4d4f('0x18')](0x194);}return _0x33e99d;};}function handleError(_0x58e0f4,_0x40a400){_0x40a400=_0x40a400||0x1f4;return function(_0x420a9b){logger[_0x4d4f('0x25')](_0x420a9b[_0x4d4f('0x26')]);if(_0x420a9b[_0x4d4f('0x27')]){delete _0x420a9b['name'];}_0x58e0f4['status'](_0x40a400)[_0x4d4f('0x28')](_0x420a9b);};}exports[_0x4d4f('0x29')]=function(_0xb66f54,_0x226a98){var _0x44fc94={},_0x207ff3={},_0x48ea7e={'count':0x0,'rows':[]};var _0x42c9d2=_[_0x4d4f('0x2a')](db[_0x4d4f('0x2b')]['rawAttributes'],function(_0x22e935){return{'name':_0x22e935['fieldName'],'type':_0x22e935['type'][_0x4d4f('0x2c')]};});_0x207ff3[_0x4d4f('0x2d')]=_['map'](_0x42c9d2,_0x4d4f('0x27'));_0x207ff3[_0x4d4f('0x2e')]=_[_0x4d4f('0x2f')](_0xb66f54[_0x4d4f('0x2e')]);_0x207ff3[_0x4d4f('0x30')]=_[_0x4d4f('0x31')](_0x207ff3['model'],_0x207ff3[_0x4d4f('0x2e')]);_0x44fc94[_0x4d4f('0x32')]=_[_0x4d4f('0x31')](_0x207ff3['model'],qs[_0x4d4f('0x33')](_0xb66f54[_0x4d4f('0x2e')][_0x4d4f('0x33')]));_0x44fc94['attributes']=_0x44fc94[_0x4d4f('0x32')][_0x4d4f('0x34')]?_0x44fc94[_0x4d4f('0x32')]:_0x207ff3['model'];if(!_0xb66f54['query']['hasOwnProperty'](_0x4d4f('0x35'))){_0x44fc94[_0x4d4f('0x36')]=qs[_0x4d4f('0x36')](_0xb66f54[_0x4d4f('0x2e')][_0x4d4f('0x36')]);_0x44fc94[_0x4d4f('0x1d')]=qs[_0x4d4f('0x1d')](_0xb66f54[_0x4d4f('0x2e')][_0x4d4f('0x1d')]);}_0x44fc94['order']=qs[_0x4d4f('0x37')](_0xb66f54['query'][_0x4d4f('0x37')]);_0x44fc94[_0x4d4f('0x38')]=qs['filters'](_[_0x4d4f('0x39')](_0xb66f54[_0x4d4f('0x2e')],_0x207ff3[_0x4d4f('0x30')]),_0x42c9d2);if(_0xb66f54[_0x4d4f('0x2e')][_0x4d4f('0x3a')]){_0x44fc94[_0x4d4f('0x38')]=_['merge'](_0x44fc94[_0x4d4f('0x38')],{'$or':_[_0x4d4f('0x2a')](_0x42c9d2,function(_0x9d5e0e){if(_0x9d5e0e[_0x4d4f('0x3b')]!==_0x4d4f('0x3c')){var _0x165a5c={};_0x165a5c[_0x9d5e0e[_0x4d4f('0x27')]]={'$like':'%'+_0xb66f54[_0x4d4f('0x2e')][_0x4d4f('0x3a')]+'%'};return _0x165a5c;}})});}_0x44fc94=_[_0x4d4f('0x3d')]({},_0x44fc94,_0xb66f54[_0x4d4f('0x3e')]);var _0x51560a={'where':_0x44fc94[_0x4d4f('0x38')]};return db[_0x4d4f('0x2b')][_0x4d4f('0x1c')](_0x51560a)[_0x4d4f('0x23')](function(_0x3edc2a){_0x48ea7e['count']=_0x3edc2a;if(_0xb66f54[_0x4d4f('0x2e')][_0x4d4f('0x3f')]){_0x44fc94[_0x4d4f('0x40')]=[{'all':!![]}];}return db['UserProfileSection'][_0x4d4f('0x41')](_0x44fc94);})['then'](function(_0x3336fa){_0x48ea7e[_0x4d4f('0x42')]=_0x3336fa;return _0x48ea7e;})[_0x4d4f('0x23')](respondWithFilteredResult(_0x226a98,_0x44fc94))[_0x4d4f('0x43')](handleError(_0x226a98,null));};exports['show']=function(_0x146951,_0x4e53c1){var _0x465c81={'raw':![],'where':{'id':_0x146951[_0x4d4f('0x44')]['id']}},_0x1d127e={};_0x1d127e[_0x4d4f('0x2d')]=_[_0x4d4f('0x2f')](db[_0x4d4f('0x2b')]['rawAttributes']);_0x1d127e['query']=_[_0x4d4f('0x2f')](_0x146951['query']);_0x1d127e[_0x4d4f('0x30')]=_[_0x4d4f('0x31')](_0x1d127e[_0x4d4f('0x2d')],_0x1d127e[_0x4d4f('0x2e')]);_0x465c81[_0x4d4f('0x32')]=_[_0x4d4f('0x31')](_0x1d127e['model'],qs[_0x4d4f('0x33')](_0x146951[_0x4d4f('0x2e')][_0x4d4f('0x33')]));_0x465c81[_0x4d4f('0x32')]=_0x465c81[_0x4d4f('0x32')][_0x4d4f('0x34')]?_0x465c81['attributes']:_0x1d127e[_0x4d4f('0x2d')];if(_0x146951[_0x4d4f('0x2e')][_0x4d4f('0x3f')]){_0x465c81['include']=[{'all':!![]}];}_0x465c81=_[_0x4d4f('0x3d')]({},_0x465c81,_0x146951[_0x4d4f('0x3e')]);return db[_0x4d4f('0x2b')][_0x4d4f('0x45')](_0x465c81)['then'](handleEntityNotFound(_0x4e53c1,null))['then'](respondWithResult(_0x4e53c1,null))[_0x4d4f('0x43')](handleError(_0x4e53c1,null));};exports[_0x4d4f('0x46')]=function(_0x4198ae,_0x2b5d1f){return db[_0x4d4f('0x2b')]['create'](_0x4198ae[_0x4d4f('0x47')],{})['then'](respondWithResult(_0x2b5d1f,0xc9))[_0x4d4f('0x43')](handleError(_0x2b5d1f,null));};exports[_0x4d4f('0x22')]=function(_0x294194,_0x243cfb){if(_0x294194[_0x4d4f('0x47')]['id']){delete _0x294194[_0x4d4f('0x47')]['id'];}return db['UserProfileSection']['find']({'where':{'id':_0x294194[_0x4d4f('0x44')]['id']}})[_0x4d4f('0x23')](handleEntityNotFound(_0x243cfb,null))[_0x4d4f('0x23')](saveUpdates(_0x294194['body'],null))['then'](respondWithResult(_0x243cfb,null))['catch'](handleError(_0x243cfb,null));};exports['destroy']=function(_0x17345d,_0x1b7802){return db[_0x4d4f('0x2b')][_0x4d4f('0x45')]({'where':{'id':_0x17345d[_0x4d4f('0x44')]['id']}})[_0x4d4f('0x23')](handleEntityNotFound(_0x1b7802,null))[_0x4d4f('0x23')](removeEntity(_0x1b7802,null))[_0x4d4f('0x43')](handleError(_0x1b7802,null));};exports[_0x4d4f('0x48')]=function(_0x4ccb0d,_0x369fc4){return db['UserProfileSection'][_0x4d4f('0x48')]()[_0x4d4f('0x23')](respondWithResult(_0x369fc4,null))[_0x4d4f('0x43')](handleError(_0x369fc4,null));}; \ No newline at end of file +var _0x95f2=['VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','stack','name','index','UserProfileSection','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','filter','merge','type'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x95f2,0xdf));var _0x295f=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x95f2[_0x1589dd];return _0x1bddd1;};'use strict';var pdf=require(_0x295f('0x0'));var emlformat=require(_0x295f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x295f('0x2'));var jsonpatch=require(_0x295f('0x3'));var rp=require(_0x295f('0x4'));var moment=require(_0x295f('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x295f('0x6'));var path=require(_0x295f('0x7'));var sox=require(_0x295f('0x8'));var csv=require(_0x295f('0x9'));var ejs=require(_0x295f('0xa'));var fs=require('fs');var _=require(_0x295f('0xb'));var squel=require(_0x295f('0xc'));var crypto=require(_0x295f('0xd'));var jsforce=require(_0x295f('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x295f('0xf'));var Papa=require('papaparse');var Redis=require(_0x295f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x295f('0x11'));var as=require(_0x295f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x295f('0x13'))(_0x295f('0x14'));var utils=require('../../config/utils');var config=require(_0x295f('0x15'));var db=require(_0x295f('0x16'))['db'];function respondWithStatusCode(_0x89f0c8,_0x11b4db){_0x11b4db=_0x11b4db||0xcc;return function(_0x4fdb61){if(_0x4fdb61){return _0x89f0c8[_0x295f('0x17')](_0x11b4db);}return _0x89f0c8[_0x295f('0x18')](_0x11b4db)[_0x295f('0x19')]();};}function respondWithResult(_0xc3f919,_0x2d8066){_0x2d8066=_0x2d8066||0xc8;return function(_0x25a813){if(_0x25a813){return _0xc3f919['status'](_0x2d8066)[_0x295f('0x1a')](_0x25a813);}};}function respondWithFilteredResult(_0x143f9b,_0x369edf){return function(_0x407e60){if(_0x407e60){var _0x1766dc=_0x407e60[_0x295f('0x1b')],_0x3701d4=_0x369edf[_0x295f('0x1c')],_0x26c12d=_0x369edf[_0x295f('0x1c')]+_0x369edf[_0x295f('0x1d')],_0x2e2d17;if(_0x26c12d>=_0x1766dc){_0x26c12d=_0x1766dc;_0x2e2d17=0xc8;}else{_0x2e2d17=0xce;}_0x143f9b[_0x295f('0x18')](_0x2e2d17);return _0x143f9b['set']('Content-Range',_0x3701d4+'-'+_0x26c12d+'/'+_0x1766dc)[_0x295f('0x1a')](_0x407e60);}return null;};}function patchUpdates(_0xf2114a){return function(_0x1dc94a){try{jsonpatch[_0x295f('0x1e')](_0x1dc94a,_0xf2114a,!![]);}catch(_0xd37370){return BPromise[_0x295f('0x1f')](_0xd37370);}return _0x1dc94a[_0x295f('0x20')]();};}function saveUpdates(_0x411bc4,_0x3b8d4d){return function(_0x1bb69a){if(_0x1bb69a){return _0x1bb69a[_0x295f('0x21')](_0x411bc4)[_0x295f('0x22')](function(_0x4c194d){return _0x4c194d;});}return null;};}function removeEntity(_0x270905,_0x1b5ca5){return function(_0x5b5d32){if(_0x5b5d32){return _0x5b5d32[_0x295f('0x23')]()['then'](function(){_0x270905[_0x295f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1df335,_0x4789b3){return function(_0x4e687a){if(!_0x4e687a){_0x1df335[_0x295f('0x17')](0x194);}return _0x4e687a;};}function handleError(_0x463dbf,_0x19dfb7){_0x19dfb7=_0x19dfb7||0x1f4;return function(_0x3bff40){logger['error'](_0x3bff40[_0x295f('0x24')]);if(_0x3bff40[_0x295f('0x25')]){delete _0x3bff40[_0x295f('0x25')];}_0x463dbf[_0x295f('0x18')](_0x19dfb7)['send'](_0x3bff40);};}exports[_0x295f('0x26')]=function(_0x207981,_0x49835d){var _0x3c5f51={},_0x226991={},_0x1b6fbc={'count':0x0,'rows':[]};var _0x37b666=_['map'](db[_0x295f('0x27')]['rawAttributes'],function(_0x1a7d41){return{'name':_0x1a7d41[_0x295f('0x28')],'type':_0x1a7d41['type'][_0x295f('0x29')]};});_0x226991[_0x295f('0x2a')]=_[_0x295f('0x2b')](_0x37b666,_0x295f('0x25'));_0x226991[_0x295f('0x2c')]=_[_0x295f('0x2d')](_0x207981[_0x295f('0x2c')]);_0x226991['filters']=_[_0x295f('0x2e')](_0x226991[_0x295f('0x2a')],_0x226991['query']);_0x3c5f51[_0x295f('0x2f')]=_[_0x295f('0x2e')](_0x226991[_0x295f('0x2a')],qs[_0x295f('0x30')](_0x207981[_0x295f('0x2c')][_0x295f('0x30')]));_0x3c5f51[_0x295f('0x2f')]=_0x3c5f51['attributes'][_0x295f('0x31')]?_0x3c5f51[_0x295f('0x2f')]:_0x226991['model'];if(!_0x207981[_0x295f('0x2c')]['hasOwnProperty'](_0x295f('0x32'))){_0x3c5f51[_0x295f('0x1d')]=qs[_0x295f('0x1d')](_0x207981[_0x295f('0x2c')][_0x295f('0x1d')]);_0x3c5f51[_0x295f('0x1c')]=qs[_0x295f('0x1c')](_0x207981['query']['offset']);}_0x3c5f51[_0x295f('0x33')]=qs[_0x295f('0x34')](_0x207981[_0x295f('0x2c')][_0x295f('0x34')]);_0x3c5f51['where']=qs['filters'](_['pick'](_0x207981['query'],_0x226991[_0x295f('0x35')]),_0x37b666);if(_0x207981['query'][_0x295f('0x36')]){_0x3c5f51['where']=_[_0x295f('0x37')](_0x3c5f51['where'],{'$or':_[_0x295f('0x2b')](_0x37b666,function(_0x269035){if(_0x269035[_0x295f('0x38')]!==_0x295f('0x39')){var _0x2c6575={};_0x2c6575[_0x269035[_0x295f('0x25')]]={'$like':'%'+_0x207981[_0x295f('0x2c')][_0x295f('0x36')]+'%'};return _0x2c6575;}})});}_0x3c5f51=_[_0x295f('0x37')]({},_0x3c5f51,_0x207981['options']);var _0x455be1={'where':_0x3c5f51['where']};return db['UserProfileSection'][_0x295f('0x1b')](_0x455be1)[_0x295f('0x22')](function(_0x4a5474){_0x1b6fbc[_0x295f('0x1b')]=_0x4a5474;if(_0x207981[_0x295f('0x2c')][_0x295f('0x3a')]){_0x3c5f51[_0x295f('0x3b')]=[{'all':!![]}];}return db[_0x295f('0x27')][_0x295f('0x3c')](_0x3c5f51);})[_0x295f('0x22')](function(_0x50f0fe){_0x1b6fbc[_0x295f('0x3d')]=_0x50f0fe;return _0x1b6fbc;})[_0x295f('0x22')](respondWithFilteredResult(_0x49835d,_0x3c5f51))[_0x295f('0x3e')](handleError(_0x49835d,null));};exports['show']=function(_0x1a8d94,_0x519c86){var _0x2c973e={'raw':![],'where':{'id':_0x1a8d94[_0x295f('0x3f')]['id']}},_0x1c65bb={};_0x1c65bb['model']=_['keys'](db[_0x295f('0x27')][_0x295f('0x40')]);_0x1c65bb[_0x295f('0x2c')]=_['keys'](_0x1a8d94['query']);_0x1c65bb[_0x295f('0x35')]=_[_0x295f('0x2e')](_0x1c65bb['model'],_0x1c65bb[_0x295f('0x2c')]);_0x2c973e[_0x295f('0x2f')]=_['intersection'](_0x1c65bb[_0x295f('0x2a')],qs[_0x295f('0x30')](_0x1a8d94[_0x295f('0x2c')]['fields']));_0x2c973e[_0x295f('0x2f')]=_0x2c973e[_0x295f('0x2f')]['length']?_0x2c973e['attributes']:_0x1c65bb[_0x295f('0x2a')];if(_0x1a8d94['query'][_0x295f('0x3a')]){_0x2c973e['include']=[{'all':!![]}];}_0x2c973e=_[_0x295f('0x37')]({},_0x2c973e,_0x1a8d94[_0x295f('0x41')]);return db[_0x295f('0x27')][_0x295f('0x42')](_0x2c973e)['then'](handleEntityNotFound(_0x519c86,null))['then'](respondWithResult(_0x519c86,null))[_0x295f('0x3e')](handleError(_0x519c86,null));};exports[_0x295f('0x43')]=function(_0x2f6df8,_0x31cf4e){return db[_0x295f('0x27')][_0x295f('0x43')](_0x2f6df8[_0x295f('0x44')],{})[_0x295f('0x22')](respondWithResult(_0x31cf4e,0xc9))[_0x295f('0x3e')](handleError(_0x31cf4e,null));};exports[_0x295f('0x21')]=function(_0x104081,_0x538e06){if(_0x104081[_0x295f('0x44')]['id']){delete _0x104081['body']['id'];}return db['UserProfileSection'][_0x295f('0x42')]({'where':{'id':_0x104081[_0x295f('0x3f')]['id']}})[_0x295f('0x22')](handleEntityNotFound(_0x538e06,null))[_0x295f('0x22')](saveUpdates(_0x104081[_0x295f('0x44')],null))[_0x295f('0x22')](respondWithResult(_0x538e06,null))[_0x295f('0x3e')](handleError(_0x538e06,null));};exports[_0x295f('0x23')]=function(_0x4c1b2b,_0x50ac61){return db[_0x295f('0x27')]['find']({'where':{'id':_0x4c1b2b[_0x295f('0x3f')]['id']}})[_0x295f('0x22')](handleEntityNotFound(_0x50ac61,null))[_0x295f('0x22')](removeEntity(_0x50ac61,null))[_0x295f('0x3e')](handleError(_0x50ac61,null));};exports[_0x295f('0x45')]=function(_0x1dca8b,_0x4957ba){return db[_0x295f('0x27')][_0x295f('0x45')]()[_0x295f('0x22')](respondWithResult(_0x4957ba,null))[_0x295f('0x3e')](handleError(_0x4957ba,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 2d770da..5f3926e 100644 --- a/server/api/userProfileSection/userProfileSection.model.js +++ b/server/api/userProfileSection/userProfileSection.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe86d=['api','bluebird','request-promise','path','exports','UserProfileSection','compositeIndex','userProfileId','lodash','util','../../config/logger'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xe86d,0x1cb));var _0xde86=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe86d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xde86('0x0'));var util=require(_0xde86('0x1'));var logger=require(_0xde86('0x2'))(_0xde86('0x3'));var moment=require('moment');var BPromise=require(_0xde86('0x4'));var rp=require(_0xde86('0x5'));var fs=require('fs');var path=require(_0xde86('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0xde86('0x7')]=function(_0x1c325f,_0x3e562c){return _0x1c325f['define'](_0xde86('0x8'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xde86('0x9'),'fields':['sectionId',_0xde86('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f98=['UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define'];(function(_0x1789bc,_0x1acf84){var _0x35efd1=function(_0x2329b2){while(--_0x2329b2){_0x1789bc['push'](_0x1789bc['shift']());}};_0x35efd1(++_0x1acf84);}(_0x4f98,0x160));var _0x84f9=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0x4f98[_0x246148];return _0x453d94;};'use strict';var _=require(_0x84f9('0x0'));var util=require('util');var logger=require(_0x84f9('0x1'))(_0x84f9('0x2'));var moment=require('moment');var BPromise=require(_0x84f9('0x3'));var rp=require(_0x84f9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x84f9('0x5'));var attributes=require('./userProfileSection.attributes');module[_0x84f9('0x6')]=function(_0x33c783,_0x15dc82){return _0x33c783[_0x84f9('0x7')](_0x84f9('0x8'),attributes,{'tableName':_0x84f9('0x9'),'paranoid':![],'indexes':[{'name':_0x84f9('0xa'),'fields':[_0x84f9('0xb'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 026e345..385360a 100644 --- a/server/api/userProfileSection/userProfileSection.rpc.js +++ b/server/api/userProfileSection/userProfileSection.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb50=['result','util','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb50,0x17d));var _0x0bb5=function(_0x11e9e6,_0x40b63c){_0x11e9e6=_0x11e9e6-0x0;var _0x5ebe60=_0xbb50[_0x11e9e6];return _0x5ebe60;};'use strict';var _=require('lodash');var util=require(_0x0bb5('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0bb5('0x1'));var fs=require('fs');var Redis=require(_0x0bb5('0x2'));var db=require(_0x0bb5('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0bb5('0x4'));var config=require('../../config/environment');var jayson=require(_0x0bb5('0x5'));var client=jayson[_0x0bb5('0x6')][_0x0bb5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xe99eab,_0x27ade0,_0x1187c2){return new BPromise(function(_0x38fe84,_0x29cca7){return client[_0x0bb5('0x8')](_0xe99eab,_0x1187c2)[_0x0bb5('0x9')](function(_0x11d021){logger[_0x0bb5('0xa')](_0x0bb5('0xb'),_0x27ade0,'request\x20sent');logger[_0x0bb5('0xc')](_0x0bb5('0xd'),_0x27ade0,_0x0bb5('0xe'),JSON['stringify'](_0x11d021));if(_0x11d021[_0x0bb5('0xf')]){if(_0x11d021[_0x0bb5('0xf')][_0x0bb5('0x10')]===0x1f4){logger[_0x0bb5('0xf')](_0x0bb5('0xb'),_0x27ade0,_0x11d021['error'][_0x0bb5('0x11')]);return _0x29cca7(_0x11d021[_0x0bb5('0xf')][_0x0bb5('0x11')]);}logger[_0x0bb5('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x27ade0,_0x11d021[_0x0bb5('0xf')][_0x0bb5('0x11')]);return _0x38fe84(_0x11d021[_0x0bb5('0xf')]['message']);}else{logger[_0x0bb5('0xa')](_0x0bb5('0xb'),_0x27ade0,_0x0bb5('0xe'));_0x38fe84(_0x11d021[_0x0bb5('0x12')][_0x0bb5('0x11')]);}})['catch'](function(_0x24c388){logger[_0x0bb5('0xf')](_0x0bb5('0xb'),_0x27ade0,_0x24c388);_0x29cca7(_0x24c388);});});} \ No newline at end of file +var _0x25c7=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','UserProfileSection,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x41c88c,_0x381f8d){var _0x2c97ea=function(_0x35fd44){while(--_0x35fd44){_0x41c88c['push'](_0x41c88c['shift']());}};_0x2c97ea(++_0x381f8d);}(_0x25c7,0x103));var _0x725c=function(_0x1ae150,_0x3ff834){_0x1ae150=_0x1ae150-0x0;var _0x52ad8e=_0x25c7[_0x1ae150];return _0x52ad8e;};'use strict';var _=require(_0x725c('0x0'));var util=require(_0x725c('0x1'));var moment=require(_0x725c('0x2'));var BPromise=require(_0x725c('0x3'));var rs=require(_0x725c('0x4'));var fs=require('fs');var Redis=require(_0x725c('0x5'));var db=require(_0x725c('0x6'))['db'];var utils=require(_0x725c('0x7'));var logger=require(_0x725c('0x8'))(_0x725c('0x9'));var config=require(_0x725c('0xa'));var jayson=require(_0x725c('0xb'));var client=jayson['client'][_0x725c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x10c209,_0x162773,_0x55fc20){return new BPromise(function(_0x395d5c,_0x4576af){return client['request'](_0x10c209,_0x55fc20)[_0x725c('0xd')](function(_0x166b61){logger[_0x725c('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x162773,_0x725c('0xf'));logger[_0x725c('0x10')](_0x725c('0x11'),_0x162773,_0x725c('0xf'),JSON[_0x725c('0x12')](_0x166b61));if(_0x166b61[_0x725c('0x13')]){if(_0x166b61[_0x725c('0x13')]['code']===0x1f4){logger[_0x725c('0x13')](_0x725c('0x14'),_0x162773,_0x166b61[_0x725c('0x13')]['message']);return _0x4576af(_0x166b61[_0x725c('0x13')][_0x725c('0x15')]);}logger['error'](_0x725c('0x14'),_0x162773,_0x166b61['error'][_0x725c('0x15')]);return _0x395d5c(_0x166b61[_0x725c('0x13')][_0x725c('0x15')]);}else{logger['info'](_0x725c('0x14'),_0x162773,_0x725c('0xf'));_0x395d5c(_0x166b61[_0x725c('0x16')][_0x725c('0x15')]);}})[_0x725c('0x17')](function(_0x5c6712){logger[_0x725c('0x13')](_0x725c('0x14'),_0x162773,_0x5c6712);_0x4576af(_0x5c6712);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index c076443..ae0cd04 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 _0x7301=['Router','../../components/auth/service','../../config/environment','exports','util','path','connect-timeout','express'];(function(_0x36b4fd,_0x2611ef){var _0x52e51e=function(_0x3bd989){while(--_0x3bd989){_0x36b4fd['push'](_0x36b4fd['shift']());}};_0x52e51e(++_0x2611ef);}(_0x7301,0x104));var _0x1730=function(_0x293518,_0x275b6a){_0x293518=_0x293518-0x0;var _0x9cfc10=_0x7301[_0x293518];return _0x9cfc10;};'use strict';var multer=require('multer');var util=require(_0x1730('0x0'));var path=require(_0x1730('0x1'));var timeout=require(_0x1730('0x2'));var express=require(_0x1730('0x3'));var router=express[_0x1730('0x4')]();var auth=require(_0x1730('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1730('0x6'));module[_0x1730('0x7')]=router; \ No newline at end of file +var _0x04a3=['Router','../../components/auth/service','exports','multer','util','path','connect-timeout'];(function(_0x1fc4e2,_0x493c3b){var _0x2ba184=function(_0x58e64f){while(--_0x58e64f){_0x1fc4e2['push'](_0x1fc4e2['shift']());}};_0x2ba184(++_0x493c3b);}(_0x04a3,0x10d));var _0x304a=function(_0x164c8c,_0x24f2d5){_0x164c8c=_0x164c8c-0x0;var _0x1fd534=_0x04a3[_0x164c8c];return _0x1fd534;};'use strict';var multer=require(_0x304a('0x0'));var util=require(_0x304a('0x1'));var path=require(_0x304a('0x2'));var timeout=require(_0x304a('0x3'));var express=require('express');var router=express[_0x304a('0x4')]();var auth=require(_0x304a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x304a('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 34eb869..8a1f623 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x4d3380,_0x11225b){var _0x5ad885=function(_0x417da5){while(--_0x417da5){_0x4d3380['push'](_0x4d3380['shift']());}};_0x5ad885(++_0x11225b);}(_0xe706,0xa3));var _0x6e70=function(_0x434f2e,_0x68493e){_0x434f2e=_0x434f2e-0x0;var _0x76c0b9=_0xe706[_0x434f2e];return _0x76c0b9;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x107638,_0x3ad732){var _0x492ff7=function(_0x1b8c5c){while(--_0x1b8c5c){_0x107638['push'](_0x107638['shift']());}};_0x492ff7(++_0x3ad732);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 14998bc..0bf424f 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 _0x2182=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues'];(function(_0x159488,_0x148b2d){var _0x570591=function(_0x5a42b5){while(--_0x5a42b5){_0x159488['push'](_0x159488['shift']());}};_0x570591(++_0x148b2d);}(_0x2182,0xea));var _0x2218=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2182[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2218('0x0'));var util=require(_0x2218('0x1'));var logger=require(_0x2218('0x2'))(_0x2218('0x3'));var moment=require('moment');var BPromise=require(_0x2218('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2218('0x5'));var rimraf=require(_0x2218('0x6'));var config=require(_0x2218('0x7'));var attributes=require(_0x2218('0x8'));module[_0x2218('0x9')]=function(_0x1e2df1,_0x199cb3){return _0x1e2df1[_0x2218('0xa')](_0x2218('0xb'),attributes,{'tableName':_0x2218('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x261b=['./userSmsQueue.attributes','define','UserSmsQueue','lodash','util','request-promise','rimraf'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x261b,0x15a));var _0xb261=function(_0x5a3468,_0xf9c673){_0x5a3468=_0x5a3468-0x0;var _0x190610=_0x261b[_0x5a3468];return _0x190610;};'use strict';var _=require(_0xb261('0x0'));var util=require(_0xb261('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb261('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb261('0x3'));var config=require('../../config/environment');var attributes=require(_0xb261('0x4'));module['exports']=function(_0x10f7ba,_0xaf0725){return _0x10f7ba[_0xb261('0x5')](_0xb261('0x6'),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 e5db1a9..b61f4ae 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 _0xe237=['error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x308173,_0x5c770c){var _0xec3c52=function(_0x367e2d){while(--_0x367e2d){_0x308173['push'](_0x308173['shift']());}};_0xec3c52(++_0x5c770c);}(_0xe237,0x163));var _0x7e23=function(_0x3d0824,_0xe802e2){_0x3d0824=_0x3d0824-0x0;var _0x3c1139=_0xe237[_0x3d0824];return _0x3c1139;};'use strict';var _=require(_0x7e23('0x0'));var util=require('util');var moment=require(_0x7e23('0x1'));var BPromise=require(_0x7e23('0x2'));var rs=require(_0x7e23('0x3'));var fs=require('fs');var Redis=require(_0x7e23('0x4'));var db=require(_0x7e23('0x5'))['db'];var utils=require(_0x7e23('0x6'));var logger=require(_0x7e23('0x7'))(_0x7e23('0x8'));var config=require(_0x7e23('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7e23('0xa')][_0x7e23('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfa4110,_0x5b3fa6,_0x213d9b){return new BPromise(function(_0x4e4b0a,_0x4beb88){return client[_0x7e23('0xc')](_0xfa4110,_0x213d9b)['then'](function(_0x4ff66a){logger[_0x7e23('0xd')](_0x7e23('0xe'),_0x5b3fa6,_0x7e23('0xf'));logger[_0x7e23('0x10')](_0x7e23('0x11'),_0x5b3fa6,'request\x20sent',JSON[_0x7e23('0x12')](_0x4ff66a));if(_0x4ff66a[_0x7e23('0x13')]){if(_0x4ff66a['error'][_0x7e23('0x14')]===0x1f4){logger[_0x7e23('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x5b3fa6,_0x4ff66a['error'][_0x7e23('0x15')]);return _0x4beb88(_0x4ff66a[_0x7e23('0x13')][_0x7e23('0x15')]);}logger[_0x7e23('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x5b3fa6,_0x4ff66a['error']['message']);return _0x4e4b0a(_0x4ff66a[_0x7e23('0x13')][_0x7e23('0x15')]);}else{logger[_0x7e23('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x5b3fa6,_0x7e23('0xf'));_0x4e4b0a(_0x4ff66a['result']['message']);}})['catch'](function(_0x36407a){logger[_0x7e23('0x13')](_0x7e23('0xe'),_0x5b3fa6,_0x36407a);_0x4beb88(_0x36407a);});});} \ No newline at end of file +var _0x87a3=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x31b826,_0x327fae){var _0x2efe52=function(_0x1042c0){while(--_0x1042c0){_0x31b826['push'](_0x31b826['shift']());}};_0x2efe52(++_0x327fae);}(_0x87a3,0x16f));var _0x387a=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0x87a3[_0x209fcd];return _0x501d5e;};'use strict';var _=require(_0x387a('0x0'));var util=require('util');var moment=require(_0x387a('0x1'));var BPromise=require(_0x387a('0x2'));var rs=require(_0x387a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x387a('0x4'))['db'];var utils=require(_0x387a('0x5'));var logger=require(_0x387a('0x6'))(_0x387a('0x7'));var config=require('../../config/environment');var jayson=require(_0x387a('0x8'));var client=jayson[_0x387a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ea501,_0x9ae658,_0xe1c95a){return new BPromise(function(_0x53504f,_0x291e1c){return client[_0x387a('0xa')](_0x3ea501,_0xe1c95a)[_0x387a('0xb')](function(_0x556142){logger[_0x387a('0xc')](_0x387a('0xd'),_0x9ae658,_0x387a('0xe'));logger[_0x387a('0xf')](_0x387a('0x10'),_0x9ae658,_0x387a('0xe'),JSON[_0x387a('0x11')](_0x556142));if(_0x556142[_0x387a('0x12')]){if(_0x556142[_0x387a('0x12')][_0x387a('0x13')]===0x1f4){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x9ae658,_0x556142[_0x387a('0x12')][_0x387a('0x14')]);return _0x291e1c(_0x556142[_0x387a('0x12')][_0x387a('0x14')]);}logger[_0x387a('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x9ae658,_0x556142[_0x387a('0x12')]['message']);return _0x53504f(_0x556142[_0x387a('0x12')][_0x387a('0x14')]);}else{logger[_0x387a('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x9ae658,_0x387a('0xe'));_0x53504f(_0x556142[_0x387a('0x15')]['message']);}})[_0x387a('0x16')](function(_0x3b9490){logger[_0x387a('0x12')](_0x387a('0xd'),_0x9ae658,_0x3b9490);_0x291e1c(_0x3b9490);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 59c3be1..885e92b 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 _0xb66c=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path'];(function(_0x431007,_0x213790){var _0x4fc70e=function(_0x2c0b85){while(--_0x2c0b85){_0x431007['push'](_0x431007['shift']());}};_0x4fc70e(++_0x213790);}(_0xb66c,0xc6));var _0xcb66=function(_0xe7acab,_0x299293){_0xe7acab=_0xe7acab-0x0;var _0x1b3fc9=_0xb66c[_0xe7acab];return _0x1b3fc9;};'use strict';var multer=require('multer');var util=require(_0xcb66('0x0'));var path=require(_0xcb66('0x1'));var timeout=require('connect-timeout');var express=require(_0xcb66('0x2'));var router=express[_0xcb66('0x3')]();var auth=require(_0xcb66('0x4'));var interaction=require(_0xcb66('0x5'));var config=require(_0xcb66('0x6'));module[_0xcb66('0x7')]=router; \ No newline at end of file +var _0x1252=['connect-timeout','express','../../components/auth/service','exports','multer'];(function(_0x1b5335,_0x4c291e){var _0x4fbfb5=function(_0x421e9a){while(--_0x421e9a){_0x1b5335['push'](_0x1b5335['shift']());}};_0x4fbfb5(++_0x4c291e);}(_0x1252,0x11c));var _0x2125=function(_0x145e61,_0x2062a0){_0x145e61=_0x145e61-0x0;var _0x1e5050=_0x1252[_0x145e61];return _0x1e5050;};'use strict';var multer=require(_0x2125('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2125('0x1'));var express=require(_0x2125('0x2'));var router=express['Router']();var auth=require(_0x2125('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x2125('0x4')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 7ed4623..ab4227f 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 _0xd8b0=['exports','sequelize'];(function(_0x284622,_0x1e419f){var _0x4d48d6=function(_0x1809d0){while(--_0x1809d0){_0x284622['push'](_0x284622['shift']());}};_0x4d48d6(++_0x1e419f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x31316a,_0x1c57b6){var _0x148799=function(_0x410dea){while(--_0x410dea){_0x31316a['push'](_0x31316a['shift']());}};_0x148799(++_0x1c57b6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index a0b18fd..727b144 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 _0x0c2e=['user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','define','UserVoiceQueue'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0c2e,0x16c));var _0xe0c2=function(_0x2cc618,_0xe1d676){_0x2cc618=_0x2cc618-0x0;var _0x13da6b=_0x0c2e[_0x2cc618];return _0x13da6b;};'use strict';var _=require(_0xe0c2('0x0'));var util=require(_0xe0c2('0x1'));var logger=require(_0xe0c2('0x2'))(_0xe0c2('0x3'));var moment=require(_0xe0c2('0x4'));var BPromise=require(_0xe0c2('0x5'));var rp=require(_0xe0c2('0x6'));var fs=require('fs');var path=require(_0xe0c2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module['exports']=function(_0x43529d,_0x4cd507){return _0x43529d[_0xe0c2('0x8')](_0xe0c2('0x9'),attributes,{'tableName':_0xe0c2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4075=['path','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','util','../../config/logger','api','moment','request-promise'];(function(_0x3562df,_0x1fe6ee){var _0x2775be=function(_0x1d5b04){while(--_0x1d5b04){_0x3562df['push'](_0x3562df['shift']());}};_0x2775be(++_0x1fe6ee);}(_0x4075,0x187));var _0x5407=function(_0x19dd7a,_0x51de21){_0x19dd7a=_0x19dd7a-0x0;var _0x3feb6a=_0x4075[_0x19dd7a];return _0x3feb6a;};'use strict';var _=require('lodash');var util=require(_0x5407('0x0'));var logger=require(_0x5407('0x1'))(_0x5407('0x2'));var moment=require(_0x5407('0x3'));var BPromise=require('bluebird');var rp=require(_0x5407('0x4'));var fs=require('fs');var path=require(_0x5407('0x5'));var rimraf=require('rimraf');var config=require(_0x5407('0x6'));var attributes=require(_0x5407('0x7'));module[_0x5407('0x8')]=function(_0x54e7cd,_0xf740b2){return _0x54e7cd[_0x5407('0x9')](_0x5407('0xa'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index d7f7d5b..8dea7b5 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 _0xfb11=['rpc','../../config/environment','jayson/promise','client','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x171ca2,_0x20bae5){var _0x2b98e3=function(_0x4708bf){while(--_0x4708bf){_0x171ca2['push'](_0x171ca2['shift']());}};_0x2b98e3(++_0x20bae5);}(_0xfb11,0x159));var _0x1fb1=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xfb11[_0x173d7e];return _0x2220d6;};'use strict';var _=require('lodash');var util=require(_0x1fb1('0x0'));var moment=require(_0x1fb1('0x1'));var BPromise=require(_0x1fb1('0x2'));var rs=require(_0x1fb1('0x3'));var fs=require('fs');var Redis=require(_0x1fb1('0x4'));var db=require(_0x1fb1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1fb1('0x6'))(_0x1fb1('0x7'));var config=require(_0x1fb1('0x8'));var jayson=require(_0x1fb1('0x9'));var client=jayson[_0x1fb1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x124f08,_0x5ce153,_0xe5820e){return new BPromise(function(_0x304416,_0x7aec68){return client[_0x1fb1('0xb')](_0x124f08,_0xe5820e)[_0x1fb1('0xc')](function(_0x9c9df7){logger['info'](_0x1fb1('0xd'),_0x5ce153,_0x1fb1('0xe'));logger[_0x1fb1('0xf')](_0x1fb1('0x10'),_0x5ce153,_0x1fb1('0xe'),JSON[_0x1fb1('0x11')](_0x9c9df7));if(_0x9c9df7[_0x1fb1('0x12')]){if(_0x9c9df7[_0x1fb1('0x12')][_0x1fb1('0x13')]===0x1f4){logger[_0x1fb1('0x12')](_0x1fb1('0xd'),_0x5ce153,_0x9c9df7['error']['message']);return _0x7aec68(_0x9c9df7[_0x1fb1('0x12')][_0x1fb1('0x14')]);}logger[_0x1fb1('0x12')](_0x1fb1('0xd'),_0x5ce153,_0x9c9df7[_0x1fb1('0x12')]['message']);return _0x304416(_0x9c9df7[_0x1fb1('0x12')]['message']);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x5ce153,_0x1fb1('0xe'));_0x304416(_0x9c9df7[_0x1fb1('0x15')][_0x1fb1('0x14')]);}})['catch'](function(_0x41e4e4){logger[_0x1fb1('0x12')](_0x1fb1('0xd'),_0x5ce153,_0x41e4e4);_0x7aec68(_0x41e4e4);});});} \ No newline at end of file +var _0x71f1=['jayson/promise','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','bluebird','randomstring','rpc','../../config/environment'];(function(_0x4452f1,_0x5ad396){var _0x6cedd0=function(_0x1448f0){while(--_0x1448f0){_0x4452f1['push'](_0x4452f1['shift']());}};_0x6cedd0(++_0x5ad396);}(_0x71f1,0xea));var _0x171f=function(_0x33626e,_0x2c1e9a){_0x33626e=_0x33626e-0x0;var _0x254df4=_0x71f1[_0x33626e];return _0x254df4;};'use strict';var _=require(_0x171f('0x0'));var util=require(_0x171f('0x1'));var moment=require('moment');var BPromise=require(_0x171f('0x2'));var rs=require(_0x171f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x171f('0x4'));var config=require(_0x171f('0x5'));var jayson=require(_0x171f('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x451f17,_0x7c18f2,_0x2a0d77){return new BPromise(function(_0x376b51,_0x144871){return client[_0x171f('0x7')](_0x451f17,_0x2a0d77)['then'](function(_0x4dc0ec){logger[_0x171f('0x8')](_0x171f('0x9'),_0x7c18f2,_0x171f('0xa'));logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x7c18f2,'request\x20sent',JSON[_0x171f('0xb')](_0x4dc0ec));if(_0x4dc0ec[_0x171f('0xc')]){if(_0x4dc0ec[_0x171f('0xc')][_0x171f('0xd')]===0x1f4){logger['error'](_0x171f('0x9'),_0x7c18f2,_0x4dc0ec['error'][_0x171f('0xe')]);return _0x144871(_0x4dc0ec[_0x171f('0xc')]['message']);}logger[_0x171f('0xc')](_0x171f('0x9'),_0x7c18f2,_0x4dc0ec[_0x171f('0xc')][_0x171f('0xe')]);return _0x376b51(_0x4dc0ec[_0x171f('0xc')][_0x171f('0xe')]);}else{logger['info'](_0x171f('0x9'),_0x7c18f2,'request\x20sent');_0x376b51(_0x4dc0ec['result']['message']);}})['catch'](function(_0x2fdecd){logger[_0x171f('0xc')](_0x171f('0x9'),_0x7c18f2,_0x2fdecd);_0x144871(_0x2fdecd);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index c5e9489..b5e7569 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 _0x2836=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports','multer','util'];(function(_0xbe9b0f,_0xdb6682){var _0x332b78=function(_0x4371c0){while(--_0x4371c0){_0xbe9b0f['push'](_0xbe9b0f['shift']());}};_0x332b78(++_0xdb6682);}(_0x2836,0xbb));var _0x6283=function(_0x4e6383,_0xa529fc){_0x4e6383=_0x4e6383-0x0;var _0x3870d5=_0x2836[_0x4e6383];return _0x3870d5;};'use strict';var multer=require(_0x6283('0x0'));var util=require(_0x6283('0x1'));var path=require(_0x6283('0x2'));var timeout=require(_0x6283('0x3'));var express=require(_0x6283('0x4'));var router=express[_0x6283('0x5')]();var auth=require(_0x6283('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6283('0x7'));module[_0x6283('0x8')]=router; \ No newline at end of file +var _0x80ed=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x80ed,0xa1));var _0xd80e=function(_0x25df98,_0x1bfe49){_0x25df98=_0x25df98-0x0;var _0xcbbcd9=_0x80ed[_0x25df98];return _0xcbbcd9;};'use strict';var multer=require(_0xd80e('0x0'));var util=require(_0xd80e('0x1'));var path=require(_0xd80e('0x2'));var timeout=require(_0xd80e('0x3'));var express=require(_0xd80e('0x4'));var router=express[_0xd80e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd80e('0x6'));var config=require('../../config/environment');module[_0xd80e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 5a7d14e..df1c3e9 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 _0x4466=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x258919,_0x1754e6){var _0xfbd68b=function(_0x3bc3e9){while(--_0x3bc3e9){_0x258919['push'](_0x258919['shift']());}};_0xfbd68b(++_0x1754e6);}(_0x4466,0x149));var _0x6446=function(_0x27bcf5,_0x236765){_0x27bcf5=_0x27bcf5-0x0;var _0x4ce4cf=_0x4466[_0x27bcf5];return _0x4ce4cf;};'use strict';var Sequelize=require(_0x6446('0x0'));module[_0x6446('0x1')]={'uniqueid':{'type':Sequelize[_0x6446('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x6446('0x3')},'membername':{'type':Sequelize[_0x6446('0x4')],'allowNull':![],'comment':_0x6446('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6446('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x6446('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x6446('0x4')],'allowNull':![],'unique':_0x6446('0x5'),'comment':_0x6446('0x3')},'penalty':{'type':Sequelize[_0x6446('0x2')](0xb),'defaultValue':0x0,'comment':_0x6446('0x3')},'paused':{'type':Sequelize[_0x6446('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xa9f2=['INTEGER','STRING','Required\x20by\x20Asterisk','queue_interface','sequelize'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xa9f2,0x167));var _0x2a9f=function(_0x251de1,_0x18882b){_0x251de1=_0x251de1-0x0;var _0xe81f63=_0xa9f2[_0x251de1];return _0xe81f63;};'use strict';var Sequelize=require(_0x2a9f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x2a9f('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x2a9f('0x2')],'allowNull':![],'comment':_0x2a9f('0x3')},'UserId':{'type':Sequelize[_0x2a9f('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x2a9f('0x2')],'allowNull':![],'unique':_0x2a9f('0x4'),'comment':_0x2a9f('0x3')},'VoiceQueueId':{'type':Sequelize[_0x2a9f('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x2a9f('0x2')],'allowNull':![],'unique':'queue_interface','comment':_0x2a9f('0x3')},'penalty':{'type':Sequelize[_0x2a9f('0x1')](0xb),'defaultValue':0x0,'comment':_0x2a9f('0x3')},'paused':{'type':Sequelize[_0x2a9f('0x1')](0xb),'defaultValue':0x0,'comment':_0x2a9f('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 9e7a406..e2fa182 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 _0x6902=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x1dab5f,_0x10cd21){var _0x40c2f3=function(_0x325a0d){while(--_0x325a0d){_0x1dab5f['push'](_0x1dab5f['shift']());}};_0x40c2f3(++_0x10cd21);}(_0x6902,0xa7));var _0x2690=function(_0x548f32,_0x8ec3bc){_0x548f32=_0x548f32-0x0;var _0x543db2=_0x6902[_0x548f32];return _0x543db2;};'use strict';var EventEmitter=require(_0x2690('0x0'));var UserVoiceQueueRt=require(_0x2690('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x2690('0x2')](0x0);var events={'afterCreate':_0x2690('0x3'),'afterUpdate':_0x2690('0x4'),'afterDestroy':_0x2690('0x5')};function emitEvent(_0x175db6){return function(_0x1df9ef,_0x8681fc,_0x2906ec){UserVoiceQueueRtEvents['emit'](_0x175db6+':'+_0x1df9ef['id'],_0x1df9ef);UserVoiceQueueRtEvents[_0x2690('0x6')](_0x175db6,_0x1df9ef);_0x2906ec(null);};}for(var e in events){if(events[_0x2690('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x2690('0x8')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x9400=['save','update','remove','emit','hasOwnProperty','hook','exports','events','UserVoiceQueueRt'];(function(_0x4ce3dc,_0x75cf13){var _0x2880ce=function(_0x8bd46e){while(--_0x8bd46e){_0x4ce3dc['push'](_0x4ce3dc['shift']());}};_0x2880ce(++_0x75cf13);}(_0x9400,0x15d));var _0x0940=function(_0x5d63fb,_0x5da6ab){_0x5d63fb=_0x5d63fb-0x0;var _0x5cc1d6=_0x9400[_0x5d63fb];return _0x5cc1d6;};'use strict';var EventEmitter=require(_0x0940('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x0940('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0940('0x2'),'afterUpdate':_0x0940('0x3'),'afterDestroy':_0x0940('0x4')};function emitEvent(_0x47f4d9){return function(_0x556565,_0x6169fe,_0x1bc2b6){UserVoiceQueueRtEvents['emit'](_0x47f4d9+':'+_0x556565['id'],_0x556565);UserVoiceQueueRtEvents[_0x0940('0x5')](_0x47f4d9,_0x556565);_0x1bc2b6(null);};}for(var e in events){if(events[_0x0940('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x0940('0x7')](e,emitEvent(event));}}module[_0x0940('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 a71bab9..3d0a183 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 _0x89fa=['define','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x465dfc,_0x2b9e73){var _0x49ebb0=function(_0x298b28){while(--_0x298b28){_0x465dfc['push'](_0x465dfc['shift']());}};_0x49ebb0(++_0x2b9e73);}(_0x89fa,0x1af));var _0xa89f=function(_0x272638,_0x42b993){_0x272638=_0x272638-0x0;var _0x19d027=_0x89fa[_0x272638];return _0x19d027;};'use strict';var _=require(_0xa89f('0x0'));var util=require(_0xa89f('0x1'));var logger=require(_0xa89f('0x2'))(_0xa89f('0x3'));var moment=require(_0xa89f('0x4'));var BPromise=require(_0xa89f('0x5'));var rp=require(_0xa89f('0x6'));var fs=require('fs');var path=require(_0xa89f('0x7'));var rimraf=require(_0xa89f('0x8'));var config=require(_0xa89f('0x9'));var attributes=require('./userVoiceQueueRt.attributes');module[_0xa89f('0xa')]=function(_0x44f49a,_0x4f32ea){return _0x44f49a[_0xa89f('0xb')]('UserVoiceQueueRt',attributes,{'tableName':_0xa89f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8630=['bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api','moment'];(function(_0x385c76,_0xb97335){var _0x5c8367=function(_0xdfcd3){while(--_0xdfcd3){_0x385c76['push'](_0x385c76['shift']());}};_0x5c8367(++_0xb97335);}(_0x8630,0x11a));var _0x0863=function(_0x15250a,_0x34d6bf){_0x15250a=_0x15250a-0x0;var _0x14ec2f=_0x8630[_0x15250a];return _0x14ec2f;};'use strict';var _=require(_0x0863('0x0'));var util=require(_0x0863('0x1'));var logger=require('../../config/logger')(_0x0863('0x2'));var moment=require(_0x0863('0x3'));var BPromise=require(_0x0863('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0863('0x5'));var rimraf=require(_0x0863('0x6'));var config=require(_0x0863('0x7'));var attributes=require(_0x0863('0x8'));module['exports']=function(_0x212e13,_0x2b2cb8){return _0x212e13['define'](_0x0863('0x9'),attributes,{'tableName':_0x0863('0xa'),'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 48752f3..8c66f94 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 _0x181e=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','register','then','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','code','error','message','UserVoiceQueueRt,\x20%s,\x20%s','info','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment'];(function(_0x578f11,_0x46203f){var _0x319f2f=function(_0x594f85){while(--_0x594f85){_0x578f11['push'](_0x578f11['shift']());}};_0x319f2f(++_0x46203f);}(_0x181e,0x16f));var _0xe181=function(_0x5948dd,_0x1f6ac8){_0x5948dd=_0x5948dd-0x0;var _0xb1f8be=_0x181e[_0x5948dd];return _0xb1f8be;};'use strict';var _=require(_0xe181('0x0'));var util=require(_0xe181('0x1'));var moment=require(_0xe181('0x2'));var BPromise=require(_0xe181('0x3'));var rs=require(_0xe181('0x4'));var fs=require('fs');var Redis=require(_0xe181('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe181('0x6'));var logger=require(_0xe181('0x7'))(_0xe181('0x8'));var config=require('../../config/environment');var jayson=require(_0xe181('0x9'));var client=jayson['client'][_0xe181('0xa')]({'port':0x232a});config[_0xe181('0xb')]=_['defaults'](config[_0xe181('0xb')],{'host':_0xe181('0xc'),'port':0x18eb});var socket=require(_0xe181('0xd'))(new Redis(config[_0xe181('0xb')]));require('./userVoiceQueueRt.socket')[_0xe181('0xe')](socket);function respondWithRpcPromise(_0x48e94b,_0x3bb64a,_0x36c476){return new BPromise(function(_0x1f0a2e,_0x8c5507){return client['request'](_0x48e94b,_0x36c476)[_0xe181('0xf')](function(_0x3087f5){logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x3bb64a,_0xe181('0x10'));logger[_0xe181('0x11')](_0xe181('0x12'),_0x3bb64a,_0xe181('0x10'),JSON[_0xe181('0x13')](_0x3087f5));if(_0x3087f5['error']){if(_0x3087f5['error'][_0xe181('0x14')]===0x1f4){logger[_0xe181('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3bb64a,_0x3087f5['error'][_0xe181('0x16')]);return _0x8c5507(_0x3087f5['error'][_0xe181('0x16')]);}logger[_0xe181('0x15')](_0xe181('0x17'),_0x3bb64a,_0x3087f5[_0xe181('0x15')][_0xe181('0x16')]);return _0x1f0a2e(_0x3087f5[_0xe181('0x15')][_0xe181('0x16')]);}else{logger[_0xe181('0x18')](_0xe181('0x17'),_0x3bb64a,_0xe181('0x10'));_0x1f0a2e(_0x3087f5[_0xe181('0x19')][_0xe181('0x16')]);}})[_0xe181('0x1a')](function(_0x2215bc){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x3bb64a,_0x2215bc);_0x8c5507(_0x2215bc);});});}exports[_0xe181('0x1b')]=function(_0x248896){var _0x440377=this;return new Promise(function(_0x2ae084,_0x2d8f8f){return db[_0xe181('0x1c')]['findAll']({'raw':_0x248896[_0xe181('0x1d')]?_0x248896[_0xe181('0x1d')][_0xe181('0x1e')]===undefined?!![]:![]:!![],'where':_0x248896['options']?_0x248896[_0xe181('0x1d')][_0xe181('0x1f')]||null:null,'attributes':[[db[_0xe181('0x20')]['fn'](_0xe181('0x21'),db[_0xe181('0x20')]['fn']('IF',db[_0xe181('0x20')][_0xe181('0x22')](_0xe181('0x23')))),_0xe181('0x24')]]})[_0xe181('0xf')](function(_0x280a1e){logger[_0xe181('0x18')](_0xe181('0x1b'),_0x248896);logger[_0xe181('0x11')](_0xe181('0x1b'),_0x248896,JSON[_0xe181('0x13')](_0x280a1e));_0x2ae084(_0x280a1e);})[_0xe181('0x1a')](function(_0x19392f){logger[_0xe181('0x15')](_0xe181('0x1b'),_0x19392f[_0xe181('0x16')],_0x248896);_0x2d8f8f(_0x440377[_0xe181('0x15')](0x1f4,_0x19392f[_0xe181('0x16')]));});});}; \ No newline at end of file +var _0x220f=['code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./userVoiceQueueRt.socket','request','then','info','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error'];(function(_0x4ff961,_0x1c9a75){var _0x47f740=function(_0x53dea4){while(--_0x53dea4){_0x4ff961['push'](_0x4ff961['shift']());}};_0x47f740(++_0x1c9a75);}(_0x220f,0x119));var _0xf220=function(_0x35a56d,_0x4eca8a){_0x35a56d=_0x35a56d-0x0;var _0x48f18f=_0x220f[_0x35a56d];return _0x48f18f;};'use strict';var _=require(_0xf220('0x0'));var util=require(_0xf220('0x1'));var moment=require(_0xf220('0x2'));var BPromise=require(_0xf220('0x3'));var rs=require(_0xf220('0x4'));var fs=require('fs');var Redis=require(_0xf220('0x5'));var db=require(_0xf220('0x6'))['db'];var utils=require(_0xf220('0x7'));var logger=require(_0xf220('0x8'))(_0xf220('0x9'));var config=require(_0xf220('0xa'));var jayson=require(_0xf220('0xb'));var client=jayson[_0xf220('0xc')][_0xf220('0xd')]({'port':0x232a});config[_0xf220('0xe')]=_[_0xf220('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf220('0x10'))['register'](socket);function respondWithRpcPromise(_0x3dcd1c,_0x46e442,_0x3c95fa){return new BPromise(function(_0x36bf12,_0x221758){return client[_0xf220('0x11')](_0x3dcd1c,_0x3c95fa)[_0xf220('0x12')](function(_0x2f5d1c){logger[_0xf220('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x46e442,'request\x20sent');logger[_0xf220('0x14')](_0xf220('0x15'),_0x46e442,'request\x20sent',JSON['stringify'](_0x2f5d1c));if(_0x2f5d1c['error']){if(_0x2f5d1c[_0xf220('0x16')][_0xf220('0x17')]===0x1f4){logger[_0xf220('0x16')](_0xf220('0x18'),_0x46e442,_0x2f5d1c['error'][_0xf220('0x19')]);return _0x221758(_0x2f5d1c[_0xf220('0x16')][_0xf220('0x19')]);}logger[_0xf220('0x16')](_0xf220('0x18'),_0x46e442,_0x2f5d1c[_0xf220('0x16')][_0xf220('0x19')]);return _0x36bf12(_0x2f5d1c['error'][_0xf220('0x19')]);}else{logger[_0xf220('0x13')](_0xf220('0x18'),_0x46e442,'request\x20sent');_0x36bf12(_0x2f5d1c[_0xf220('0x1a')][_0xf220('0x19')]);}})[_0xf220('0x1b')](function(_0x520b04){logger['error'](_0xf220('0x18'),_0x46e442,_0x520b04);_0x221758(_0x520b04);});});}exports[_0xf220('0x1c')]=function(_0x2b0573){var _0x2b3f4f=this;return new Promise(function(_0x44eadd,_0x4d6f59){return db[_0xf220('0x1d')][_0xf220('0x1e')]({'raw':_0x2b0573[_0xf220('0x1f')]?_0x2b0573['options'][_0xf220('0x20')]===undefined?!![]:![]:!![],'where':_0x2b0573[_0xf220('0x1f')]?_0x2b0573[_0xf220('0x1f')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xf220('0x21'),db[_0xf220('0x22')]['fn']('IF',db['sequelize'][_0xf220('0x23')](_0xf220('0x24')))),_0xf220('0x25')]]})['then'](function(_0x379021){logger['info']('GetVoiceQueueRtPauses',_0x2b0573);logger[_0xf220('0x14')](_0xf220('0x1c'),_0x2b0573,JSON['stringify'](_0x379021));_0x44eadd(_0x379021);})[_0xf220('0x1b')](function(_0x3deb86){logger[_0xf220('0x16')]('GetVoiceQueueRtPauses',_0x3deb86[_0xf220('0x19')],_0x2b0573);_0x4d6f59(_0x2b3f4f['error'](0x1f4,_0x3deb86[_0xf220('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index aee7b10..f796ca9 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 _0x51fe=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','update','emit'];(function(_0x3943b8,_0x58e6b2){var _0x4ad1c6=function(_0x1dd2cb){while(--_0x1dd2cb){_0x3943b8['push'](_0x3943b8['shift']());}};_0x4ad1c6(++_0x58e6b2);}(_0x51fe,0x10c));var _0xe51f=function(_0x30717e,_0xd96659){_0x30717e=_0x30717e-0x0;var _0x38e97f=_0x51fe[_0x30717e];return _0x38e97f;};'use strict';var UserVoiceQueueRtEvents=require(_0xe51f('0x0'));var events=[_0xe51f('0x1'),'remove',_0xe51f('0x2')];function createListener(_0xaeedc9,_0x3c7db1){return function(_0xaf016f){_0x3c7db1[_0xe51f('0x3')](_0xaeedc9,_0xaf016f);};}function removeListener(_0x4ef39c,_0x337925){return function(){UserVoiceQueueRtEvents[_0xe51f('0x4')](_0x4ef39c,_0x337925);};}exports[_0xe51f('0x5')]=function(_0xaf90d8){for(var _0x5ce9ec=0x0,_0x44a51a=events[_0xe51f('0x6')];_0x5ce9ec<_0x44a51a;_0x5ce9ec++){var _0x286c76=events[_0x5ce9ec];var _0x9a010d=createListener(_0xe51f('0x7')+_0x286c76,_0xaf90d8);UserVoiceQueueRtEvents['on'](_0x286c76,_0x9a010d);}}; \ No newline at end of file +var _0xa347=['update','emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove'];(function(_0x5b79b0,_0x4faca4){var _0x31348d=function(_0x324ec7){while(--_0x324ec7){_0x5b79b0['push'](_0x5b79b0['shift']());}};_0x31348d(++_0x4faca4);}(_0xa347,0x8d));var _0x7a34=function(_0x7148b6,_0xa61534){_0x7148b6=_0x7148b6-0x0;var _0x111019=_0xa347[_0x7148b6];return _0x111019;};'use strict';var UserVoiceQueueRtEvents=require(_0x7a34('0x0'));var events=[_0x7a34('0x1'),_0x7a34('0x2'),_0x7a34('0x3')];function createListener(_0x410579,_0x1e1439){return function(_0x588395){_0x1e1439[_0x7a34('0x4')](_0x410579,_0x588395);};}function removeListener(_0x36b873,_0x6f8217){return function(){UserVoiceQueueRtEvents[_0x7a34('0x5')](_0x36b873,_0x6f8217);};}exports[_0x7a34('0x6')]=function(_0x2f9135){for(var _0x1fee17=0x0,_0x5a8e1d=events[_0x7a34('0x7')];_0x1fee17<_0x5a8e1d;_0x1fee17++){var _0x4d29b5=events[_0x1fee17];var _0x1cbaf8=createListener(_0x7a34('0x8')+_0x4d29b5,_0x2f9135);UserVoiceQueueRtEvents['on'](_0x4d29b5,_0x1cbaf8);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 6ae497f..d99f152 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b8d=['exports','multer','path','express','Router','../../config/environment'];(function(_0x3f32ca,_0x2212f2){var _0xf444d=function(_0x4b5b04){while(--_0x4b5b04){_0x3f32ca['push'](_0x3f32ca['shift']());}};_0xf444d(++_0x2212f2);}(_0x8b8d,0x67));var _0xd8b8=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x8b8d[_0x2e4aa2];return _0x5e6092;};'use strict';var multer=require(_0xd8b8('0x0'));var util=require('util');var path=require(_0xd8b8('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8b8('0x2'));var router=express[_0xd8b8('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd8b8('0x4'));module[_0xd8b8('0x5')]=router; \ No newline at end of file +var _0x7d3b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x559139,_0xcd4ac8){var _0x6f712c=function(_0x5bbbf9){while(--_0x5bbbf9){_0x559139['push'](_0x559139['shift']());}};_0x6f712c(++_0xcd4ac8);}(_0x7d3b,0x188));var _0xb7d3=function(_0x357caf,_0x444155){_0x357caf=_0x357caf-0x0;var _0x12284b=_0x7d3b[_0x357caf];return _0x12284b;};'use strict';var multer=require(_0xb7d3('0x0'));var util=require(_0xb7d3('0x1'));var path=require(_0xb7d3('0x2'));var timeout=require(_0xb7d3('0x3'));var express=require('express');var router=express[_0xb7d3('0x4')]();var auth=require(_0xb7d3('0x5'));var interaction=require(_0xb7d3('0x6'));var config=require(_0xb7d3('0x7'));module[_0xb7d3('0x8')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index af359ad..7ed6149 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x4b9640,_0x378b28){var _0x122600=function(_0x2784ff){while(--_0x2784ff){_0x4b9640['push'](_0x4b9640['shift']());}};_0x122600(++_0x378b28);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x7d4dc8,_0x14d70e){var _0x20b216=function(_0x3575b0){while(--_0x3575b0){_0x7d4dc8['push'](_0x7d4dc8['shift']());}};_0x20b216(++_0x14d70e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index d094b71..47e1f49 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.model.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb14=['path','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2e655a,_0x6d5799){var _0x26f13b=function(_0x2dd535){while(--_0x2dd535){_0x2e655a['push'](_0x2e655a['shift']());}};_0x26f13b(++_0x6d5799);}(_0xbb14,0xad));var _0x4bb1=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbb14[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x4bb1('0x0'));var util=require(_0x4bb1('0x1'));var logger=require(_0x4bb1('0x2'))(_0x4bb1('0x3'));var moment=require(_0x4bb1('0x4'));var BPromise=require(_0x4bb1('0x5'));var rp=require(_0x4bb1('0x6'));var fs=require('fs');var path=require(_0x4bb1('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4bb1('0x8'));module[_0x4bb1('0x9')]=function(_0x11c707,_0x2e3a07){return _0x11c707[_0x4bb1('0xa')](_0x4bb1('0xb'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2ef=['UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./userWhatsappQueue.attributes','exports','define'];(function(_0x4f0fab,_0x1e487c){var _0x1bfc05=function(_0x5c5135){while(--_0x5c5135){_0x4f0fab['push'](_0x4f0fab['shift']());}};_0x1bfc05(++_0x1e487c);}(_0xb2ef,0x17b));var _0xfb2e=function(_0x506e8a,_0x1225ba){_0x506e8a=_0x506e8a-0x0;var _0x6f5616=_0xb2ef[_0x506e8a];return _0x6f5616;};'use strict';var _=require(_0xfb2e('0x0'));var util=require(_0xfb2e('0x1'));var logger=require(_0xfb2e('0x2'))(_0xfb2e('0x3'));var moment=require(_0xfb2e('0x4'));var BPromise=require(_0xfb2e('0x5'));var rp=require(_0xfb2e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb2e('0x7'));var config=require('../../config/environment');var attributes=require(_0xfb2e('0x8'));module[_0xfb2e('0x9')]=function(_0x200201,_0x226bee){return _0x200201[_0xfb2e('0xa')](_0xfb2e('0xb'),attributes,{'tableName':_0xfb2e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 83d2004..679b5a6 100644 --- a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js +++ b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x424959,_0x2b53c0){var _0x482d03=function(_0x492815){while(--_0x492815){_0x424959['push'](_0x424959['shift']());}};_0x482d03(++_0x2b53c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x576fa3,_0x543cf5){var _0x259c59=function(_0x3f083c){while(--_0x3f083c){_0x576fa3['push'](_0x576fa3['shift']());}};_0x259c59(++_0x543cf5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index b7c22ef..1a4ec9e 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 _0x05f2=['get','show','post','put','/:id','isAuthenticated','update','destroy','exports','multer','path','connect-timeout','../../components/interaction/service','./variable.controller'];(function(_0x4b637d,_0x1ab7ff){var _0x2bd369=function(_0x50ea62){while(--_0x50ea62){_0x4b637d['push'](_0x4b637d['shift']());}};_0x2bd369(++_0x1ab7ff);}(_0x05f2,0x87));var _0x205f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x05f2[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x205f('0x0'));var util=require('util');var path=require(_0x205f('0x1'));var timeout=require(_0x205f('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x205f('0x3'));var config=require('../../config/environment');var controller=require(_0x205f('0x4'));router[_0x205f('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x205f('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x205f('0x6')]);router[_0x205f('0x7')]('/',auth['isAuthenticated'](),controller['create']);router[_0x205f('0x8')](_0x205f('0x9'),auth[_0x205f('0xa')](),controller[_0x205f('0xb')]);router['delete']('/:id',auth[_0x205f('0xa')](),controller[_0x205f('0xc')]);module[_0x205f('0xd')]=router; \ No newline at end of file +var _0xfdb0=['Router','../../components/interaction/service','../../config/environment','./variable.controller','get','index','/:id','isAuthenticated','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x33f669,_0x279fce){var _0x55fa39=function(_0x21b9d8){while(--_0x21b9d8){_0x33f669['push'](_0x33f669['shift']());}};_0x55fa39(++_0x279fce);}(_0xfdb0,0x1d6));var _0x0fdb=function(_0x3df539,_0x2e1a0a){_0x3df539=_0x3df539-0x0;var _0x19e83a=_0xfdb0[_0x3df539];return _0x19e83a;};'use strict';var multer=require(_0x0fdb('0x0'));var util=require(_0x0fdb('0x1'));var path=require(_0x0fdb('0x2'));var timeout=require(_0x0fdb('0x3'));var express=require(_0x0fdb('0x4'));var router=express[_0x0fdb('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0fdb('0x6'));var config=require(_0x0fdb('0x7'));var controller=require(_0x0fdb('0x8'));router[_0x0fdb('0x9')]('/',auth['isAuthenticated'](),controller[_0x0fdb('0xa')]);router[_0x0fdb('0x9')](_0x0fdb('0xb'),auth[_0x0fdb('0xc')](),controller['show']);router[_0x0fdb('0xd')]('/',auth[_0x0fdb('0xc')](),controller[_0x0fdb('0xe')]);router[_0x0fdb('0xf')]('/:id',auth[_0x0fdb('0xc')](),controller[_0x0fdb('0x10')]);router['delete'](_0x0fdb('0xb'),auth[_0x0fdb('0xc')](),controller[_0x0fdb('0x11')]);module[_0x0fdb('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 7ed976d..67d1432 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 _0x3113=['STRING','name','sequelize'];(function(_0x3ea500,_0x2a685e){var _0x51a9d9=function(_0x2733da){while(--_0x2733da){_0x3ea500['push'](_0x3ea500['shift']());}};_0x51a9d9(++_0x2a685e);}(_0x3113,0xbc));var _0x3311=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3113[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x3311('0x0'));module['exports']={'name':{'type':Sequelize[_0x3311('0x1')],'unique':_0x3311('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3311('0x1')]}}; \ No newline at end of file +var _0x85a1=['exports','STRING','sequelize'];(function(_0x566901,_0x4ae7f9){var _0x264942=function(_0x3af8f1){while(--_0x3af8f1){_0x566901['push'](_0x566901['shift']());}};_0x264942(++_0x4ae7f9);}(_0x85a1,0x194));var _0x185a=function(_0x1fd492,_0x9503e9){_0x1fd492=_0x1fd492-0x0;var _0x11da0e=_0x85a1[_0x1fd492];return _0x11da0e;};'use strict';var Sequelize=require(_0x185a('0x0'));module[_0x185a('0x1')]={'name':{'type':Sequelize[_0x185a('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x185a('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 6638dc0..dac2db7 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 _0x39bb=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','UserProfileResource','stack','send','map','Variable','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','sort','where','filters','pick','filter','merge','VIRTUAL','name','options','count','includeAll','findAll','rows','catch','show','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','error'];(function(_0x266ddc,_0x45aa52){var _0x39c1d7=function(_0x4cd07c){while(--_0x4cd07c){_0x266ddc['push'](_0x266ddc['shift']());}};_0x39c1d7(++_0x45aa52);}(_0x39bb,0x1e3));var _0xb39b=function(_0x53080e,_0x252127){_0x53080e=_0x53080e-0x0;var _0x1a0c14=_0x39bb[_0x53080e];return _0x1a0c14;};'use strict';var pdf=require(_0xb39b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb39b('0x1'));var zipdir=require(_0xb39b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb39b('0x3'));var moment=require('moment');var BPromise=require(_0xb39b('0x4'));var Mustache=require(_0xb39b('0x5'));var util=require(_0xb39b('0x6'));var path=require(_0xb39b('0x7'));var sox=require(_0xb39b('0x8'));var csv=require(_0xb39b('0x9'));var ejs=require(_0xb39b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb39b('0xb'));var crypto=require(_0xb39b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb39b('0xd'));var toCsv=require(_0xb39b('0x9'));var querystring=require('querystring');var Papa=require(_0xb39b('0xe'));var Redis=require('ioredis');var authService=require(_0xb39b('0xf'));var qs=require(_0xb39b('0x10'));var as=require(_0xb39b('0x11'));var hardwareService=require(_0xb39b('0x12'));var logger=require(_0xb39b('0x13'))(_0xb39b('0x14'));var utils=require(_0xb39b('0x15'));var config=require(_0xb39b('0x16'));var db=require(_0xb39b('0x17'))['db'];function respondWithStatusCode(_0x1d4809,_0x2bcc96){_0x2bcc96=_0x2bcc96||0xcc;return function(_0x166e49){if(_0x166e49){return _0x1d4809[_0xb39b('0x18')](_0x2bcc96);}return _0x1d4809[_0xb39b('0x19')](_0x2bcc96)[_0xb39b('0x1a')]();};}function respondWithResult(_0x492a25,_0x20c8ab){_0x20c8ab=_0x20c8ab||0xc8;return function(_0x45e70a){if(_0x45e70a){return _0x492a25['status'](_0x20c8ab)[_0xb39b('0x1b')](_0x45e70a);}};}function respondWithFilteredResult(_0x12970c,_0x45538){return function(_0xca0436){if(_0xca0436){var _0x2f8d82=_0xca0436['count'],_0x4153ef=_0x45538[_0xb39b('0x1c')],_0x11e849=_0x45538[_0xb39b('0x1c')]+_0x45538[_0xb39b('0x1d')],_0x4a4744;if(_0x11e849>=_0x2f8d82){_0x11e849=_0x2f8d82;_0x4a4744=0xc8;}else{_0x4a4744=0xce;}_0x12970c[_0xb39b('0x19')](_0x4a4744);return _0x12970c[_0xb39b('0x1e')](_0xb39b('0x1f'),_0x4153ef+'-'+_0x11e849+'/'+_0x2f8d82)['json'](_0xca0436);}return null;};}function patchUpdates(_0x5018d1){return function(_0x38d411){try{jsonpatch['apply'](_0x38d411,_0x5018d1,!![]);}catch(_0x38baaa){return BPromise[_0xb39b('0x20')](_0x38baaa);}return _0x38d411[_0xb39b('0x21')]();};}function saveUpdates(_0x1f5bf0,_0x5ccaa1){return function(_0x2d0ec4){if(_0x2d0ec4){return _0x2d0ec4[_0xb39b('0x22')](_0x1f5bf0)[_0xb39b('0x23')](function(_0x3f8aea){return _0x3f8aea;});}return null;};}function removeEntity(_0x3d5c03,_0x3c2cd3){return function(_0x57d407){if(_0x57d407){return _0x57d407['destroy']()[_0xb39b('0x23')](function(){var _0x300f44=_0x57d407['get']({'plain':!![]});var _0x4ee541='Variables';return db[_0xb39b('0x24')]['destroy']({'where':{'type':_0x4ee541,'resourceId':_0x300f44['id']}})[_0xb39b('0x23')](function(){return _0x57d407;});})['then'](function(){_0x3d5c03[_0xb39b('0x19')](0xcc)[_0xb39b('0x1a')]();});}};}function handleEntityNotFound(_0x13263b,_0x43d99e){return function(_0xdb19e9){if(!_0xdb19e9){_0x13263b[_0xb39b('0x18')](0x194);}return _0xdb19e9;};}function handleError(_0x546084,_0x94168f){_0x94168f=_0x94168f||0x1f4;return function(_0x5f4323){logger['error'](_0x5f4323[_0xb39b('0x25')]);if(_0x5f4323['name']){delete _0x5f4323['name'];}_0x546084[_0xb39b('0x19')](_0x94168f)[_0xb39b('0x26')](_0x5f4323);};}exports['index']=function(_0x56bfcf,_0x18389d){var _0x314f7a={},_0x4e37cf={},_0x10e216={'count':0x0,'rows':[]};var _0x38bdf0=_[_0xb39b('0x27')](db[_0xb39b('0x28')][_0xb39b('0x29')],function(_0x58f3cd){return{'name':_0x58f3cd[_0xb39b('0x2a')],'type':_0x58f3cd[_0xb39b('0x2b')][_0xb39b('0x2c')]};});_0x4e37cf[_0xb39b('0x2d')]=_[_0xb39b('0x27')](_0x38bdf0,'name');_0x4e37cf['query']=_[_0xb39b('0x2e')](_0x56bfcf[_0xb39b('0x2f')]);_0x4e37cf['filters']=_[_0xb39b('0x30')](_0x4e37cf[_0xb39b('0x2d')],_0x4e37cf[_0xb39b('0x2f')]);_0x314f7a[_0xb39b('0x31')]=_[_0xb39b('0x30')](_0x4e37cf[_0xb39b('0x2d')],qs[_0xb39b('0x32')](_0x56bfcf[_0xb39b('0x2f')][_0xb39b('0x32')]));_0x314f7a[_0xb39b('0x31')]=_0x314f7a[_0xb39b('0x31')][_0xb39b('0x33')]?_0x314f7a[_0xb39b('0x31')]:_0x4e37cf[_0xb39b('0x2d')];if(!_0x56bfcf['query']['hasOwnProperty']('nolimit')){_0x314f7a[_0xb39b('0x1d')]=qs[_0xb39b('0x1d')](_0x56bfcf[_0xb39b('0x2f')]['limit']);_0x314f7a[_0xb39b('0x1c')]=qs[_0xb39b('0x1c')](_0x56bfcf[_0xb39b('0x2f')][_0xb39b('0x1c')]);}_0x314f7a['order']=qs[_0xb39b('0x34')](_0x56bfcf[_0xb39b('0x2f')][_0xb39b('0x34')]);_0x314f7a[_0xb39b('0x35')]=qs[_0xb39b('0x36')](_[_0xb39b('0x37')](_0x56bfcf[_0xb39b('0x2f')],_0x4e37cf['filters']),_0x38bdf0);if(_0x56bfcf[_0xb39b('0x2f')][_0xb39b('0x38')]){_0x314f7a[_0xb39b('0x35')]=_[_0xb39b('0x39')](_0x314f7a[_0xb39b('0x35')],{'$or':_['map'](_0x38bdf0,function(_0x402683){if(_0x402683[_0xb39b('0x2b')]!==_0xb39b('0x3a')){var _0x54bf57={};_0x54bf57[_0x402683[_0xb39b('0x3b')]]={'$like':'%'+_0x56bfcf[_0xb39b('0x2f')][_0xb39b('0x38')]+'%'};return _0x54bf57;}})});}_0x314f7a=_[_0xb39b('0x39')]({},_0x314f7a,_0x56bfcf[_0xb39b('0x3c')]);var _0x4abcce={'where':_0x314f7a['where']};return db['Variable'][_0xb39b('0x3d')](_0x4abcce)[_0xb39b('0x23')](function(_0x266191){_0x10e216[_0xb39b('0x3d')]=_0x266191;if(_0x56bfcf[_0xb39b('0x2f')][_0xb39b('0x3e')]){_0x314f7a['include']=[{'all':!![]}];}return db[_0xb39b('0x28')][_0xb39b('0x3f')](_0x314f7a);})[_0xb39b('0x23')](function(_0x40ee4d){_0x10e216[_0xb39b('0x40')]=_0x40ee4d;return _0x10e216;})[_0xb39b('0x23')](respondWithFilteredResult(_0x18389d,_0x314f7a))[_0xb39b('0x41')](handleError(_0x18389d,null));};exports[_0xb39b('0x42')]=function(_0x1603e6,_0x4594a9){var _0x57692c={'raw':!![],'where':{'id':_0x1603e6[_0xb39b('0x43')]['id']}},_0x3e58dc={};_0x3e58dc[_0xb39b('0x2d')]=_[_0xb39b('0x2e')](db[_0xb39b('0x28')]['rawAttributes']);_0x3e58dc[_0xb39b('0x2f')]=_[_0xb39b('0x2e')](_0x1603e6[_0xb39b('0x2f')]);_0x3e58dc[_0xb39b('0x36')]=_['intersection'](_0x3e58dc[_0xb39b('0x2d')],_0x3e58dc[_0xb39b('0x2f')]);_0x57692c[_0xb39b('0x31')]=_['intersection'](_0x3e58dc['model'],qs[_0xb39b('0x32')](_0x1603e6[_0xb39b('0x2f')]['fields']));_0x57692c[_0xb39b('0x31')]=_0x57692c[_0xb39b('0x31')][_0xb39b('0x33')]?_0x57692c[_0xb39b('0x31')]:_0x3e58dc['model'];if(_0x1603e6[_0xb39b('0x2f')][_0xb39b('0x3e')]){_0x57692c['include']=[{'all':!![]}];}_0x57692c=_[_0xb39b('0x39')]({},_0x57692c,_0x1603e6[_0xb39b('0x3c')]);return db['Variable'][_0xb39b('0x44')](_0x57692c)['then'](handleEntityNotFound(_0x4594a9,null))['then'](respondWithResult(_0x4594a9,null))['catch'](handleError(_0x4594a9,null));};exports[_0xb39b('0x45')]=function(_0x16f648,_0x5558b0){return db[_0xb39b('0x28')]['create'](_0x16f648['body'],{})[_0xb39b('0x23')](function(_0x267717){var _0x952259=_0x16f648[_0xb39b('0x46')][_0xb39b('0x47')]({'plain':!![]});if(!_0x952259)throw new Error(_0xb39b('0x48'));if(_0x952259[_0xb39b('0x49')]===_0xb39b('0x46')){var _0x5a237e=_0x267717[_0xb39b('0x47')]({'plain':!![]});var _0x28b16c=_0xb39b('0x4a');return db[_0xb39b('0x4b')][_0xb39b('0x44')]({'where':{'name':_0x28b16c,'userProfileId':_0x952259['userProfileId']},'raw':!![]})[_0xb39b('0x23')](function(_0x190255){if(_0x190255&&_0x190255['autoAssociation']===0x0){return db[_0xb39b('0x24')][_0xb39b('0x45')]({'name':_0x5a237e[_0xb39b('0x3b')],'resourceId':_0x5a237e['id'],'type':_0x190255[_0xb39b('0x3b')],'sectionId':_0x190255['id']},{})['then'](function(){return _0x267717;});}else{return _0x267717;}})[_0xb39b('0x41')](function(_0x302d9b){logger[_0xb39b('0x4c')](_0xb39b('0x4d'),_0x302d9b);throw _0x302d9b;});}return _0x267717;})['then'](respondWithResult(_0x5558b0,0xc9))[_0xb39b('0x41')](handleError(_0x5558b0,null));};exports['update']=function(_0x93449e,_0x5c526a){if(_0x93449e[_0xb39b('0x4e')]['id']){delete _0x93449e[_0xb39b('0x4e')]['id'];}return db[_0xb39b('0x28')][_0xb39b('0x44')]({'where':{'id':_0x93449e[_0xb39b('0x43')]['id']}})['then'](handleEntityNotFound(_0x5c526a,null))[_0xb39b('0x23')](saveUpdates(_0x93449e[_0xb39b('0x4e')],null))['then'](respondWithResult(_0x5c526a,null))['catch'](handleError(_0x5c526a,null));};exports[_0xb39b('0x4f')]=function(_0x74f89a,_0x3ed295){return db['Variable'][_0xb39b('0x44')]({'where':{'id':_0x74f89a['params']['id']}})[_0xb39b('0x23')](handleEntityNotFound(_0x3ed295,null))[_0xb39b('0x23')](removeEntity(_0x3ed295,null))[_0xb39b('0x41')](handleError(_0x3ed295,null));}; \ No newline at end of file +var _0x49b9=['ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Variables','error','send','map','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','Variable','include','findAll','show','params','fields','length','options','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x5e734d,_0x104071){var _0xeae2eb=function(_0x1b01b7){while(--_0x1b01b7){_0x5e734d['push'](_0x5e734d['shift']());}};_0xeae2eb(++_0x104071);}(_0x49b9,0x1da));var _0x949b=function(_0x1bd7ef,_0x1ba909){_0x1bd7ef=_0x1bd7ef-0x0;var _0x20072c=_0x49b9[_0x1bd7ef];return _0x20072c;};'use strict';var pdf=require(_0x949b('0x0'));var emlformat=require(_0x949b('0x1'));var rimraf=require(_0x949b('0x2'));var zipdir=require(_0x949b('0x3'));var jsonpatch=require(_0x949b('0x4'));var rp=require(_0x949b('0x5'));var moment=require(_0x949b('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x949b('0x7'));var util=require(_0x949b('0x8'));var path=require(_0x949b('0x9'));var sox=require(_0x949b('0xa'));var csv=require(_0x949b('0xb'));var ejs=require(_0x949b('0xc'));var fs=require('fs');var _=require(_0x949b('0xd'));var squel=require(_0x949b('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x949b('0xf'));var toCsv=require(_0x949b('0xb'));var querystring=require(_0x949b('0x10'));var Papa=require('papaparse');var Redis=require(_0x949b('0x11'));var authService=require(_0x949b('0x12'));var qs=require(_0x949b('0x13'));var as=require(_0x949b('0x14'));var hardwareService=require(_0x949b('0x15'));var logger=require(_0x949b('0x16'))('api');var utils=require(_0x949b('0x17'));var config=require('../../config/environment');var db=require(_0x949b('0x18'))['db'];function respondWithStatusCode(_0x778ae3,_0x7462cd){_0x7462cd=_0x7462cd||0xcc;return function(_0x3a9071){if(_0x3a9071){return _0x778ae3[_0x949b('0x19')](_0x7462cd);}return _0x778ae3[_0x949b('0x1a')](_0x7462cd)[_0x949b('0x1b')]();};}function respondWithResult(_0x2d5ffc,_0x5a4542){_0x5a4542=_0x5a4542||0xc8;return function(_0x397bd2){if(_0x397bd2){return _0x2d5ffc[_0x949b('0x1a')](_0x5a4542)['json'](_0x397bd2);}};}function respondWithFilteredResult(_0x3a997d,_0x32c9b8){return function(_0x35e3a2){if(_0x35e3a2){var _0x1726c5=_0x35e3a2[_0x949b('0x1c')],_0x36ef3c=_0x32c9b8['offset'],_0xb099ca=_0x32c9b8[_0x949b('0x1d')]+_0x32c9b8[_0x949b('0x1e')],_0x4b8ea9;if(_0xb099ca>=_0x1726c5){_0xb099ca=_0x1726c5;_0x4b8ea9=0xc8;}else{_0x4b8ea9=0xce;}_0x3a997d[_0x949b('0x1a')](_0x4b8ea9);return _0x3a997d[_0x949b('0x1f')](_0x949b('0x20'),_0x36ef3c+'-'+_0xb099ca+'/'+_0x1726c5)['json'](_0x35e3a2);}return null;};}function patchUpdates(_0x4f15b2){return function(_0x44ada8){try{jsonpatch[_0x949b('0x21')](_0x44ada8,_0x4f15b2,!![]);}catch(_0x37926f){return BPromise[_0x949b('0x22')](_0x37926f);}return _0x44ada8[_0x949b('0x23')]();};}function saveUpdates(_0x48f6a3,_0x4f6ece){return function(_0x5b908f){if(_0x5b908f){return _0x5b908f[_0x949b('0x24')](_0x48f6a3)[_0x949b('0x25')](function(_0x4f1e2f){return _0x4f1e2f;});}return null;};}function removeEntity(_0x3c6c9b,_0x1ed213){return function(_0x1a8ed3){if(_0x1a8ed3){return _0x1a8ed3[_0x949b('0x26')]()[_0x949b('0x25')](function(){var _0x5b7b9e=_0x1a8ed3['get']({'plain':!![]});var _0x4126d1=_0x949b('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x4126d1,'resourceId':_0x5b7b9e['id']}})[_0x949b('0x25')](function(){return _0x1a8ed3;});})['then'](function(){_0x3c6c9b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c8139,_0x247c1e){return function(_0x9d6137){if(!_0x9d6137){_0x3c8139[_0x949b('0x19')](0x194);}return _0x9d6137;};}function handleError(_0x51d480,_0x2a79f5){_0x2a79f5=_0x2a79f5||0x1f4;return function(_0x51f221){logger[_0x949b('0x28')](_0x51f221['stack']);if(_0x51f221['name']){delete _0x51f221['name'];}_0x51d480[_0x949b('0x1a')](_0x2a79f5)[_0x949b('0x29')](_0x51f221);};}exports['index']=function(_0x49e151,_0x38d41b){var _0x24a749={},_0x3c23fa={},_0x3e2495={'count':0x0,'rows':[]};var _0x4587d5=_[_0x949b('0x2a')](db['Variable'][_0x949b('0x2b')],function(_0x5c0a76){return{'name':_0x5c0a76[_0x949b('0x2c')],'type':_0x5c0a76['type'][_0x949b('0x2d')]};});_0x3c23fa[_0x949b('0x2e')]=_['map'](_0x4587d5,_0x949b('0x2f'));_0x3c23fa[_0x949b('0x30')]=_[_0x949b('0x31')](_0x49e151[_0x949b('0x30')]);_0x3c23fa[_0x949b('0x32')]=_[_0x949b('0x33')](_0x3c23fa[_0x949b('0x2e')],_0x3c23fa['query']);_0x24a749['attributes']=_['intersection'](_0x3c23fa[_0x949b('0x2e')],qs['fields'](_0x49e151['query']['fields']));_0x24a749[_0x949b('0x34')]=_0x24a749[_0x949b('0x34')]['length']?_0x24a749[_0x949b('0x34')]:_0x3c23fa[_0x949b('0x2e')];if(!_0x49e151['query'][_0x949b('0x35')](_0x949b('0x36'))){_0x24a749['limit']=qs['limit'](_0x49e151[_0x949b('0x30')][_0x949b('0x1e')]);_0x24a749[_0x949b('0x1d')]=qs['offset'](_0x49e151[_0x949b('0x30')]['offset']);}_0x24a749[_0x949b('0x37')]=qs[_0x949b('0x38')](_0x49e151['query'][_0x949b('0x38')]);_0x24a749['where']=qs['filters'](_[_0x949b('0x39')](_0x49e151[_0x949b('0x30')],_0x3c23fa['filters']),_0x4587d5);if(_0x49e151[_0x949b('0x30')][_0x949b('0x3a')]){_0x24a749['where']=_[_0x949b('0x3b')](_0x24a749[_0x949b('0x3c')],{'$or':_[_0x949b('0x2a')](_0x4587d5,function(_0x3f4e03){if(_0x3f4e03['type']!==_0x949b('0x3d')){var _0x3a6c3c={};_0x3a6c3c[_0x3f4e03[_0x949b('0x2f')]]={'$like':'%'+_0x49e151[_0x949b('0x30')][_0x949b('0x3a')]+'%'};return _0x3a6c3c;}})});}_0x24a749=_[_0x949b('0x3b')]({},_0x24a749,_0x49e151['options']);var _0x1a2fa1={'where':_0x24a749[_0x949b('0x3c')]};return db[_0x949b('0x3e')][_0x949b('0x1c')](_0x1a2fa1)[_0x949b('0x25')](function(_0x3b6350){_0x3e2495['count']=_0x3b6350;if(_0x49e151['query']['includeAll']){_0x24a749[_0x949b('0x3f')]=[{'all':!![]}];}return db[_0x949b('0x3e')][_0x949b('0x40')](_0x24a749);})['then'](function(_0x43d73f){_0x3e2495['rows']=_0x43d73f;return _0x3e2495;})[_0x949b('0x25')](respondWithFilteredResult(_0x38d41b,_0x24a749))['catch'](handleError(_0x38d41b,null));};exports[_0x949b('0x41')]=function(_0x5cafff,_0x2c7604){var _0x22b262={'raw':!![],'where':{'id':_0x5cafff[_0x949b('0x42')]['id']}},_0x1e0444={};_0x1e0444['model']=_[_0x949b('0x31')](db[_0x949b('0x3e')][_0x949b('0x2b')]);_0x1e0444['query']=_['keys'](_0x5cafff[_0x949b('0x30')]);_0x1e0444[_0x949b('0x32')]=_[_0x949b('0x33')](_0x1e0444['model'],_0x1e0444['query']);_0x22b262[_0x949b('0x34')]=_[_0x949b('0x33')](_0x1e0444[_0x949b('0x2e')],qs[_0x949b('0x43')](_0x5cafff['query'][_0x949b('0x43')]));_0x22b262['attributes']=_0x22b262[_0x949b('0x34')][_0x949b('0x44')]?_0x22b262[_0x949b('0x34')]:_0x1e0444[_0x949b('0x2e')];if(_0x5cafff[_0x949b('0x30')]['includeAll']){_0x22b262[_0x949b('0x3f')]=[{'all':!![]}];}_0x22b262=_[_0x949b('0x3b')]({},_0x22b262,_0x5cafff[_0x949b('0x45')]);return db['Variable']['find'](_0x22b262)[_0x949b('0x25')](handleEntityNotFound(_0x2c7604,null))[_0x949b('0x25')](respondWithResult(_0x2c7604,null))[_0x949b('0x46')](handleError(_0x2c7604,null));};exports[_0x949b('0x47')]=function(_0x45a6ea,_0x550bc1){return db[_0x949b('0x3e')][_0x949b('0x47')](_0x45a6ea['body'],{})[_0x949b('0x25')](function(_0x3bc313){var _0x238674=_0x45a6ea['user']['get']({'plain':!![]});if(!_0x238674)throw new Error(_0x949b('0x48'));if(_0x238674[_0x949b('0x49')]==='user'){var _0x32d301=_0x3bc313[_0x949b('0x4a')]({'plain':!![]});var _0x40691a='Variables';return db['UserProfileSection'][_0x949b('0x4b')]({'where':{'name':_0x40691a,'userProfileId':_0x238674[_0x949b('0x4c')]},'raw':!![]})[_0x949b('0x25')](function(_0x5f0110){if(_0x5f0110&&_0x5f0110[_0x949b('0x4d')]===0x0){return db[_0x949b('0x4e')]['create']({'name':_0x32d301[_0x949b('0x2f')],'resourceId':_0x32d301['id'],'type':_0x5f0110[_0x949b('0x2f')],'sectionId':_0x5f0110['id']},{})[_0x949b('0x25')](function(){return _0x3bc313;});}else{return _0x3bc313;}})[_0x949b('0x46')](function(_0x485545){logger[_0x949b('0x28')](_0x949b('0x4f'),_0x485545);throw _0x485545;});}return _0x3bc313;})[_0x949b('0x25')](respondWithResult(_0x550bc1,0xc9))['catch'](handleError(_0x550bc1,null));};exports[_0x949b('0x24')]=function(_0x418c13,_0xd782c9){if(_0x418c13['body']['id']){delete _0x418c13[_0x949b('0x50')]['id'];}return db[_0x949b('0x3e')]['find']({'where':{'id':_0x418c13[_0x949b('0x42')]['id']}})[_0x949b('0x25')](handleEntityNotFound(_0xd782c9,null))[_0x949b('0x25')](saveUpdates(_0x418c13[_0x949b('0x50')],null))[_0x949b('0x25')](respondWithResult(_0xd782c9,null))['catch'](handleError(_0xd782c9,null));};exports['destroy']=function(_0x57c6f9,_0x4d7d69){return db[_0x949b('0x3e')]['find']({'where':{'id':_0x57c6f9[_0x949b('0x42')]['id']}})[_0x949b('0x25')](handleEntityNotFound(_0x4d7d69,null))['then'](removeEntity(_0x4d7d69,null))[_0x949b('0x46')](handleError(_0x4d7d69,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 3a5868f..82b29a3 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 _0xc81c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','lodash','api'];(function(_0x2860ab,_0x27440f){var _0x3037c4=function(_0x1eb3f3){while(--_0x1eb3f3){_0x2860ab['push'](_0x2860ab['shift']());}};_0x3037c4(++_0x27440f);}(_0xc81c,0xee));var _0xcc81=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc81c[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xcc81('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcc81('0x1'));var moment=require(_0xcc81('0x2'));var BPromise=require(_0xcc81('0x3'));var rp=require(_0xcc81('0x4'));var fs=require('fs');var path=require(_0xcc81('0x5'));var rimraf=require(_0xcc81('0x6'));var config=require(_0xcc81('0x7'));var attributes=require(_0xcc81('0x8'));module[_0xcc81('0x9')]=function(_0xc4faf9,_0x590453){return _0xc4faf9[_0xcc81('0xa')](_0xcc81('0xb'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb71f=['./variable.attributes','exports','define','tools_variables','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0xa4928c,_0x16b89c){var _0x27cc29=function(_0x14b819){while(--_0x14b819){_0xa4928c['push'](_0xa4928c['shift']());}};_0x27cc29(++_0x16b89c);}(_0xb71f,0x1b4));var _0xfb71=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xb71f[_0x403c20];return _0x2b271a;};'use strict';var _=require(_0xfb71('0x0'));var util=require('util');var logger=require(_0xfb71('0x1'))(_0xfb71('0x2'));var moment=require(_0xfb71('0x3'));var BPromise=require(_0xfb71('0x4'));var rp=require(_0xfb71('0x5'));var fs=require('fs');var path=require(_0xfb71('0x6'));var rimraf=require('rimraf');var config=require(_0xfb71('0x7'));var attributes=require(_0xfb71('0x8'));module[_0xfb71('0x9')]=function(_0x563c93,_0x45c64b){return _0x563c93[_0xfb71('0xa')]('Variable',attributes,{'tableName':_0xfb71('0xb'),'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 4f3d74d..8de6735 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 _0xce3b=['message','info','result','catch','ShowVariable','Variable','find','options','raw','include','model','attributes','map','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','debug','request\x20sent','error','code'];(function(_0x493cf5,_0x49608e){var _0x4bd947=function(_0x319e45){while(--_0x319e45){_0x493cf5['push'](_0x493cf5['shift']());}};_0x4bd947(++_0x49608e);}(_0xce3b,0x137));var _0xbce3=function(_0x2627d6,_0x3b53ac){_0x2627d6=_0x2627d6-0x0;var _0x306117=_0xce3b[_0x2627d6];return _0x306117;};'use strict';var _=require(_0xbce3('0x0'));var util=require(_0xbce3('0x1'));var moment=require(_0xbce3('0x2'));var BPromise=require(_0xbce3('0x3'));var rs=require(_0xbce3('0x4'));var fs=require('fs');var Redis=require(_0xbce3('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbce3('0x6'));var logger=require('../../config/logger')(_0xbce3('0x7'));var config=require(_0xbce3('0x8'));var jayson=require(_0xbce3('0x9'));var client=jayson[_0xbce3('0xa')][_0xbce3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10616d,_0x22fab9,_0x2e9c35){return new BPromise(function(_0x17f98d,_0x1559b6){return client[_0xbce3('0xc')](_0x10616d,_0x2e9c35)[_0xbce3('0xd')](function(_0x273de3){logger['info'](_0xbce3('0xe'),_0x22fab9,'request\x20sent');logger[_0xbce3('0xf')]('Variable,\x20%s,\x20%s,\x20%s',_0x22fab9,_0xbce3('0x10'),JSON['stringify'](_0x273de3));if(_0x273de3[_0xbce3('0x11')]){if(_0x273de3[_0xbce3('0x11')][_0xbce3('0x12')]===0x1f4){logger[_0xbce3('0x11')](_0xbce3('0xe'),_0x22fab9,_0x273de3[_0xbce3('0x11')][_0xbce3('0x13')]);return _0x1559b6(_0x273de3[_0xbce3('0x11')][_0xbce3('0x13')]);}logger[_0xbce3('0x11')](_0xbce3('0xe'),_0x22fab9,_0x273de3[_0xbce3('0x11')]['message']);return _0x17f98d(_0x273de3[_0xbce3('0x11')]['message']);}else{logger[_0xbce3('0x14')]('Variable,\x20%s,\x20%s',_0x22fab9,'request\x20sent');_0x17f98d(_0x273de3[_0xbce3('0x15')][_0xbce3('0x13')]);}})[_0xbce3('0x16')](function(_0x3669c1){logger[_0xbce3('0x11')]('Variable,\x20%s,\x20%s',_0x22fab9,_0x3669c1);_0x1559b6(_0x3669c1);});});}exports[_0xbce3('0x17')]=function(_0x233757){var _0x5e7286=this;return new Promise(function(_0x51b2b6,_0x7c2039){return db[_0xbce3('0x18')][_0xbce3('0x19')]({'raw':_0x233757[_0xbce3('0x1a')]?_0x233757[_0xbce3('0x1a')][_0xbce3('0x1b')]===undefined?!![]:![]:!![],'where':_0x233757['options']?_0x233757[_0xbce3('0x1a')]['where']||null:null,'attributes':_0x233757[_0xbce3('0x1a')]?_0x233757[_0xbce3('0x1a')]['attributes']||null:null,'include':_0x233757[_0xbce3('0x1a')]?_0x233757[_0xbce3('0x1a')][_0xbce3('0x1c')]?_['map'](_0x233757[_0xbce3('0x1a')]['include'],function(_0x24e3cb){return{'model':db[_0x24e3cb['model']],'as':_0x24e3cb['as'],'attributes':_0x24e3cb['attributes'],'include':_0x24e3cb['include']?_['map'](_0x24e3cb[_0xbce3('0x1c')],function(_0x3101db){return{'model':db[_0x3101db[_0xbce3('0x1d')]],'as':_0x3101db['as'],'attributes':_0x3101db[_0xbce3('0x1e')],'include':_0x3101db[_0xbce3('0x1c')]?_[_0xbce3('0x1f')](_0x3101db[_0xbce3('0x1c')],function(_0x2293b2){return{'model':db[_0x2293b2[_0xbce3('0x1d')]],'as':_0x2293b2['as'],'attributes':_0x2293b2[_0xbce3('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20abb3){logger[_0xbce3('0x14')](_0xbce3('0x17'),_0x233757);logger['debug']('ShowVariable',_0x233757,JSON[_0xbce3('0x20')](_0x20abb3));_0x51b2b6(_0x20abb3);})[_0xbce3('0x16')](function(_0x5d3a76){logger[_0xbce3('0x11')]('ShowVariable',_0x5d3a76[_0xbce3('0x13')],_0x233757);_0x7c2039(_0x5e7286[_0xbce3('0x11')](0x1f4,_0x5d3a76[_0xbce3('0x13')]));});});}; \ No newline at end of file +var _0x8dba=['stringify','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','Variable','find','options','raw','include','map','model','attributes','ShowVariable'];(function(_0xf858d,_0x5867e5){var _0x473f59=function(_0x3126a0){while(--_0x3126a0){_0xf858d['push'](_0xf858d['shift']());}};_0x473f59(++_0x5867e5);}(_0x8dba,0xaf));var _0xa8db=function(_0x1f5a2a,_0x4a66f8){_0x1f5a2a=_0x1f5a2a-0x0;var _0x46e23f=_0x8dba[_0x1f5a2a];return _0x46e23f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa8db('0x0'));var BPromise=require(_0xa8db('0x1'));var rs=require(_0xa8db('0x2'));var fs=require('fs');var Redis=require(_0xa8db('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8db('0x4'));var logger=require('../../config/logger')(_0xa8db('0x5'));var config=require(_0xa8db('0x6'));var jayson=require(_0xa8db('0x7'));var client=jayson[_0xa8db('0x8')][_0xa8db('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x857a5d,_0x5eafaa,_0x3d53fe){return new BPromise(function(_0x1decbf,_0x30aba2){return client[_0xa8db('0xa')](_0x857a5d,_0x3d53fe)[_0xa8db('0xb')](function(_0x46ecd6){logger[_0xa8db('0xc')](_0xa8db('0xd'),_0x5eafaa,'request\x20sent');logger['debug'](_0xa8db('0xe'),_0x5eafaa,_0xa8db('0xf'),JSON['stringify'](_0x46ecd6));if(_0x46ecd6[_0xa8db('0x10')]){if(_0x46ecd6[_0xa8db('0x10')]['code']===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x5eafaa,_0x46ecd6[_0xa8db('0x10')][_0xa8db('0x11')]);return _0x30aba2(_0x46ecd6[_0xa8db('0x10')]['message']);}logger[_0xa8db('0x10')](_0xa8db('0xd'),_0x5eafaa,_0x46ecd6['error'][_0xa8db('0x11')]);return _0x1decbf(_0x46ecd6['error']['message']);}else{logger[_0xa8db('0xc')](_0xa8db('0xd'),_0x5eafaa,_0xa8db('0xf'));_0x1decbf(_0x46ecd6['result'][_0xa8db('0x11')]);}})[_0xa8db('0x12')](function(_0x158c0a){logger['error'](_0xa8db('0xd'),_0x5eafaa,_0x158c0a);_0x30aba2(_0x158c0a);});});}exports['ShowVariable']=function(_0x4c579c){var _0x4d05e6=this;return new Promise(function(_0x3ff4bc,_0x36a091){return db[_0xa8db('0x13')][_0xa8db('0x14')]({'raw':_0x4c579c['options']?_0x4c579c[_0xa8db('0x15')][_0xa8db('0x16')]===undefined?!![]:![]:!![],'where':_0x4c579c['options']?_0x4c579c[_0xa8db('0x15')]['where']||null:null,'attributes':_0x4c579c[_0xa8db('0x15')]?_0x4c579c[_0xa8db('0x15')]['attributes']||null:null,'include':_0x4c579c[_0xa8db('0x15')]?_0x4c579c[_0xa8db('0x15')][_0xa8db('0x17')]?_[_0xa8db('0x18')](_0x4c579c[_0xa8db('0x15')][_0xa8db('0x17')],function(_0x39af6a){return{'model':db[_0x39af6a[_0xa8db('0x19')]],'as':_0x39af6a['as'],'attributes':_0x39af6a[_0xa8db('0x1a')],'include':_0x39af6a[_0xa8db('0x17')]?_[_0xa8db('0x18')](_0x39af6a[_0xa8db('0x17')],function(_0x3e8158){return{'model':db[_0x3e8158[_0xa8db('0x19')]],'as':_0x3e8158['as'],'attributes':_0x3e8158['attributes'],'include':_0x3e8158[_0xa8db('0x17')]?_[_0xa8db('0x18')](_0x3e8158[_0xa8db('0x17')],function(_0x2bd8da){return{'model':db[_0x2bd8da[_0xa8db('0x19')]],'as':_0x2bd8da['as'],'attributes':_0x2bd8da[_0xa8db('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa8db('0xb')](function(_0x74c022){logger['info'](_0xa8db('0x1b'),_0x4c579c);logger['debug'](_0xa8db('0x1b'),_0x4c579c,JSON[_0xa8db('0x1c')](_0x74c022));_0x3ff4bc(_0x74c022);})[_0xa8db('0x12')](function(_0xf6e038){logger['error'](_0xa8db('0x1b'),_0xf6e038[_0xa8db('0x11')],_0x4c579c);_0x36a091(_0x4d05e6['error'](0x1f4,_0xf6e038[_0xa8db('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 6be20b9..5f10413 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 _0xa562=['Router','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','fetch','/reset','canUpdate','/pull','pull','/restart','restart','migrations','exports','express'];(function(_0x5a8c7b,_0x42ba28){var _0x3922ed=function(_0x183ae9){while(--_0x183ae9){_0x5a8c7b['push'](_0x5a8c7b['shift']());}};_0x3922ed(++_0x42ba28);}(_0xa562,0xef));var _0x2a56=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0xa562[_0x4fe19c];return _0x952ac7;};'use strict';var express=require(_0x2a56('0x0'));var router=express[_0x2a56('0x1')]();var auth=require(_0x2a56('0x2'));var controller=require(_0x2a56('0x3'));router['get']('/',controller['index']);router[_0x2a56('0x4')](_0x2a56('0x5'),auth[_0x2a56('0x6')](),auth['canUpdate'](),controller[_0x2a56('0x7')]);router[_0x2a56('0x4')](_0x2a56('0x8'),auth[_0x2a56('0x6')](),auth[_0x2a56('0x9')](),controller['reset']);router[_0x2a56('0x4')](_0x2a56('0xa'),auth[_0x2a56('0x6')](),auth[_0x2a56('0x9')](),controller[_0x2a56('0xb')]);router[_0x2a56('0x4')](_0x2a56('0xc'),auth[_0x2a56('0x6')](),controller[_0x2a56('0xd')]);router['get']('/migrations',controller[_0x2a56('0xe')]);module[_0x2a56('0xf')]=router; \ No newline at end of file +var _0x8509=['../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','canUpdate','/reset','reset','/pull','/restart','restart','/migrations','migrations','exports','Router'];(function(_0x33975c,_0x50d085){var _0x1c15ab=function(_0x54e8bc){while(--_0x54e8bc){_0x33975c['push'](_0x33975c['shift']());}};_0x1c15ab(++_0x50d085);}(_0x8509,0x1c1));var _0x9850=function(_0x3e5147,_0x33eef9){_0x3e5147=_0x3e5147-0x0;var _0x18c779=_0x8509[_0x3e5147];return _0x18c779;};'use strict';var express=require('express');var router=express[_0x9850('0x0')]();var auth=require(_0x9850('0x1'));var controller=require(_0x9850('0x2'));router[_0x9850('0x3')]('/',controller['index']);router['get'](_0x9850('0x4'),auth[_0x9850('0x5')](),auth[_0x9850('0x6')](),controller['fetch']);router[_0x9850('0x3')](_0x9850('0x7'),auth[_0x9850('0x5')](),auth[_0x9850('0x6')](),controller[_0x9850('0x8')]);router[_0x9850('0x3')](_0x9850('0x9'),auth[_0x9850('0x5')](),auth[_0x9850('0x6')](),controller['pull']);router[_0x9850('0x3')](_0x9850('0xa'),auth[_0x9850('0x5')](),controller[_0x9850('0xb')]);router[_0x9850('0x3')](_0x9850('0xc'),controller[_0x9850('0xd')]);module[_0x9850('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index ea581ae..50e874f 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 _0xd1f8=['index','version','query','latest','fetch','tags','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','server','length','.js','exports','push','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','exec','../../config/environment','../../config/logger','update','root'];(function(_0x20c33e,_0x37a739){var _0xc7f3db=function(_0x3f0792){while(--_0x3f0792){_0x20c33e['push'](_0x20c33e['shift']());}};_0xc7f3db(++_0x37a739);}(_0xd1f8,0x18e));var _0x8d1f=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0xd1f8[_0x56fe98];return _0x212f4f;};'use strict';var Umzug=require(_0x8d1f('0x0'));var path=require(_0x8d1f('0x1'));var fs=require('fs');var _=require(_0x8d1f('0x2'));var pkginfo=require(_0x8d1f('0x3'))(module,'version');var compareVersions=require(_0x8d1f('0x4'));var exec=require('child_process')[_0x8d1f('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0x8d1f('0x6'));var pm2=require('../../config/pm2');var logger=require(_0x8d1f('0x7'))(_0x8d1f('0x8'));var git=require('simple-git')(config[_0x8d1f('0x9')]);exports[_0x8d1f('0xa')]=function(_0x66ee15,_0x264094){var _0x3f540e={'current':module['exports'][_0x8d1f('0xb')],'phonebar':0x2};if(_0x66ee15[_0x8d1f('0xc')]&&_0x66ee15['query'][_0x8d1f('0xd')]){return git[_0x8d1f('0xe')]()[_0x8d1f('0xf')](function(_0x425838,_0x10891a){_0x3f540e['latest']=(_0x425838?module['exports'][_0x8d1f('0xb')]:_0x10891a['latest'])||_0x8d1f('0x10');return _0x264094[_0x8d1f('0x11')](0xc8)['json'](_0x3f540e);});}else{return _0x264094[_0x8d1f('0x11')](0xc8)[_0x8d1f('0x12')](_0x3f540e);}};exports[_0x8d1f('0xe')]=function(_0x5e0805,_0x7d9ae5){return git[_0x8d1f('0xe')]([_0x8d1f('0x13'),_0x8d1f('0x14')],function(_0x63f46a){if(_0x63f46a){logger[_0x8d1f('0x15')](_0x63f46a);return _0x7d9ae5[_0x8d1f('0x11')](0x1f4)[_0x8d1f('0x12')](_0x63f46a);}logger[_0x8d1f('0x16')](_0x8d1f('0x17'));return _0x7d9ae5[_0x8d1f('0x11')](0xc8)[_0x8d1f('0x12')]({'output':_0x8d1f('0x18')});});};exports[_0x8d1f('0x19')]=function(_0x3b33c9,_0xb5c2e5){return git[_0x8d1f('0x19')](['--hard','FETCH_HEAD'],function(_0x1f921a){if(_0x1f921a){logger[_0x8d1f('0x15')](_0x1f921a);return _0xb5c2e5[_0x8d1f('0x11')](0x1f4)[_0x8d1f('0x12')](_0x1f921a);}logger[_0x8d1f('0x16')](_0x8d1f('0x1a'));return _0xb5c2e5['status'](0xc8)[_0x8d1f('0x12')]({'output':_0x8d1f('0x1b')});});};exports[_0x8d1f('0x1c')]=function(_0x9ce15f,_0x4d5466){exec('npm\x20install\x20--production',function(_0x4519bc,_0x102e98,_0x5175a5){logger[_0x8d1f('0x16')](_0x102e98);logger['info'](_0x5175a5);if(_0x4519bc){logger[_0x8d1f('0x15')](_0x4519bc);return _0x4d5466[_0x8d1f('0x11')](0x1f4)[_0x8d1f('0x12')](_0x4519bc);}return _0x4d5466[_0x8d1f('0x11')](0xc8)[_0x8d1f('0x12')]({'output':_0x102e98});});};exports[_0x8d1f('0x1d')]=function(_0x250e58,_0x38170b){return pm2[_0x8d1f('0x1d')]('motion2')[_0x8d1f('0x1e')](function(_0x213321){logger['info'](_0x8d1f('0x1f'),_0x213321);return _0x38170b[_0x8d1f('0x11')](0xc8)['json']({'output':_0x8d1f('0x20')});})[_0x8d1f('0x21')](function(_0x7d84d8){logger['error'](_0x7d84d8);return _0x38170b[_0x8d1f('0x11')](0x1f4)[_0x8d1f('0x12')](_0x7d84d8);});};exports[_0x8d1f('0x22')]=function(_0x4e7e41,_0x3c15de){var _0x564920=fs['readdirSync'](path[_0x8d1f('0x23')](config[_0x8d1f('0x9')],_0x8d1f('0x24'),_0x8d1f('0x22')));var _0x409788=[];for(var _0x46e90e=0x0;_0x46e90e<_0x564920[_0x8d1f('0x25')];_0x46e90e++){var _0x1da9f8=_0x564920[_0x46e90e]['replace'](_0x8d1f('0x26'),'');if(compareVersions(module[_0x8d1f('0x27')][_0x8d1f('0xb')],_0x1da9f8)===-0x1){_0x409788[_0x8d1f('0x28')](_0x1da9f8);}}if(_0x409788[_0x8d1f('0x25')]){var _0x3b0d09=_0x409788['sort'](compareVersions);var _0x340e44=new Umzug({'storage':_0x8d1f('0x29'),'storageOptions':{'model':db['Migration'],'modelName':_0x8d1f('0x2a'),'columnName':_0x8d1f('0xb')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db['sequelize'][_0x8d1f('0x2b')],function(){throw new Error(_0x8d1f('0x2c'));}],'path':path[_0x8d1f('0x23')](config[_0x8d1f('0x9')],_0x8d1f('0x24'),_0x8d1f('0x22')),'pattern':/\.js$/}});_0x340e44['up']({'migrations':_[_0x8d1f('0x2d')](_0x3b0d09,function(_0x1deac0){return _0x1deac0+'.js';})})['then'](function(){return _0x3c15de['status'](0xc8)[_0x8d1f('0x12')]({'output':_0x8d1f('0x2e')+module[_0x8d1f('0x27')][_0x8d1f('0xb')]+_0x8d1f('0x2f')+_[_0x8d1f('0x30')](_0x3b0d09),'migrations':_['join'](_0x3b0d09)});})[_0x8d1f('0x21')](function(_0x518251){if(_0x518251 instanceof db[_0x8d1f('0x29')][_0x8d1f('0x31')]){return _0x3c15de['status'](0xc8)['json']({'output':_0x8d1f('0x32')});}else{return _0x3c15de[_0x8d1f('0x11')](0x1f4)[_0x8d1f('0x12')](_0x518251);}});}else{return _0x3c15de[_0x8d1f('0x11')](0xc8)[_0x8d1f('0x12')]({'output':_0x8d1f('0x32')});}}; \ No newline at end of file +var _0x2d06=['join','server','length','replace','.js','sort','Migration','sequelize','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','then','Database\x20migrated\x20successfully\x20from\x20version\x20','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','update','root','index','exports','latest','fetch','tags','2.0.0','status','json','master','info','git\x20fetch','git\x20fetch\x20origin\x20master','--hard','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations'];(function(_0x40d48a,_0x1ce6bb){var _0x3c8aa6=function(_0x4ad6fb){while(--_0x4ad6fb){_0x40d48a['push'](_0x40d48a['shift']());}};_0x3c8aa6(++_0x1ce6bb);}(_0x2d06,0x157));var _0x62d0=function(_0x2e4274,_0x26d41a){_0x2e4274=_0x2e4274-0x0;var _0x231211=_0x2d06[_0x2e4274];return _0x231211;};'use strict';var Umzug=require('umzug');var path=require(_0x62d0('0x0'));var fs=require('fs');var _=require(_0x62d0('0x1'));var pkginfo=require(_0x62d0('0x2'))(module,_0x62d0('0x3'));var compareVersions=require('compare-versions');var exec=require(_0x62d0('0x4'))[_0x62d0('0x5')];var db=require(_0x62d0('0x6'))['db'];var config=require(_0x62d0('0x7'));var pm2=require('../../config/pm2');var logger=require(_0x62d0('0x8'))(_0x62d0('0x9'));var git=require('simple-git')(config[_0x62d0('0xa')]);exports[_0x62d0('0xb')]=function(_0x508d82,_0x264cd4){var _0xc4dacc={'current':module[_0x62d0('0xc')][_0x62d0('0x3')],'phonebar':0x2};if(_0x508d82['query']&&_0x508d82['query'][_0x62d0('0xd')]){return git[_0x62d0('0xe')]()[_0x62d0('0xf')](function(_0x26a4c0,_0x3b7959){_0xc4dacc[_0x62d0('0xd')]=(_0x26a4c0?module[_0x62d0('0xc')][_0x62d0('0x3')]:_0x3b7959[_0x62d0('0xd')])||_0x62d0('0x10');return _0x264cd4[_0x62d0('0x11')](0xc8)[_0x62d0('0x12')](_0xc4dacc);});}else{return _0x264cd4[_0x62d0('0x11')](0xc8)[_0x62d0('0x12')](_0xc4dacc);}};exports['fetch']=function(_0x38afb7,_0x23376e){return git[_0x62d0('0xe')](['origin',_0x62d0('0x13')],function(_0x16acd1){if(_0x16acd1){logger['error'](_0x16acd1);return _0x23376e[_0x62d0('0x11')](0x1f4)[_0x62d0('0x12')](_0x16acd1);}logger[_0x62d0('0x14')](_0x62d0('0x15'));return _0x23376e['status'](0xc8)[_0x62d0('0x12')]({'output':_0x62d0('0x16')});});};exports['reset']=function(_0x8bab8,_0x12036c){return git['reset']([_0x62d0('0x17'),'FETCH_HEAD'],function(_0xaa093f){if(_0xaa093f){logger[_0x62d0('0x18')](_0xaa093f);return _0x12036c[_0x62d0('0x11')](0x1f4)['json'](_0xaa093f);}logger[_0x62d0('0x14')](_0x62d0('0x19'));return _0x12036c[_0x62d0('0x11')](0xc8)['json']({'output':_0x62d0('0x1a')});});};exports['pull']=function(_0x186860,_0x489ca2){exec(_0x62d0('0x1b'),function(_0x522bd6,_0x200d3f,_0x211fc7){logger['info'](_0x200d3f);logger[_0x62d0('0x14')](_0x211fc7);if(_0x522bd6){logger['error'](_0x522bd6);return _0x489ca2[_0x62d0('0x11')](0x1f4)['json'](_0x522bd6);}return _0x489ca2[_0x62d0('0x11')](0xc8)[_0x62d0('0x12')]({'output':_0x200d3f});});};exports[_0x62d0('0x1c')]=function(_0x4ba600,_0xe451b8){return pm2[_0x62d0('0x1c')]('motion2')['then'](function(_0x5140e6){logger['info'](_0x62d0('0x1d'),_0x5140e6);return _0xe451b8[_0x62d0('0x11')](0xc8)[_0x62d0('0x12')]({'output':_0x62d0('0x1e')});})[_0x62d0('0x1f')](function(_0x52cec8){logger['error'](_0x52cec8);return _0xe451b8[_0x62d0('0x11')](0x1f4)[_0x62d0('0x12')](_0x52cec8);});};exports[_0x62d0('0x20')]=function(_0x2472cd,_0x502620){var _0x44e51b=fs['readdirSync'](path[_0x62d0('0x21')](config[_0x62d0('0xa')],_0x62d0('0x22'),_0x62d0('0x20')));var _0x35dd07=[];for(var _0x1ff4df=0x0;_0x1ff4df<_0x44e51b[_0x62d0('0x23')];_0x1ff4df++){var _0x382aa6=_0x44e51b[_0x1ff4df][_0x62d0('0x24')](_0x62d0('0x25'),'');if(compareVersions(module[_0x62d0('0xc')][_0x62d0('0x3')],_0x382aa6)===-0x1){_0x35dd07['push'](_0x382aa6);}}if(_0x35dd07['length']){var _0x528117=_0x35dd07[_0x62d0('0x26')](compareVersions);var _0x292f03=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x62d0('0x27')],'modelName':_0x62d0('0x27'),'columnName':'version'},'migrations':{'params':[db[_0x62d0('0x28')][_0x62d0('0x29')](),db[_0x62d0('0x28')]['constructor'],function(){throw new Error(_0x62d0('0x2a'));}],'path':path['join'](config['root'],_0x62d0('0x22'),_0x62d0('0x20')),'pattern':/\.js$/}});_0x292f03['up']({'migrations':_['map'](_0x528117,function(_0x2e42f2){return _0x2e42f2+_0x62d0('0x25');})})[_0x62d0('0x2b')](function(){return _0x502620['status'](0xc8)[_0x62d0('0x12')]({'output':_0x62d0('0x2c')+module[_0x62d0('0xc')][_0x62d0('0x3')]+'\x20to\x20'+_['last'](_0x528117),'migrations':_[_0x62d0('0x21')](_0x528117)});})[_0x62d0('0x1f')](function(_0x812015){if(_0x812015 instanceof db[_0x62d0('0x28')][_0x62d0('0x2d')]){return _0x502620[_0x62d0('0x11')](0xc8)[_0x62d0('0x12')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x502620[_0x62d0('0x11')](0x1f4)['json'](_0x812015);}});}else{return _0x502620['status'](0xc8)[_0x62d0('0x12')]({'output':_0x62d0('0x2e')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index d614d7f..8126b65 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 _0xe9db=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','/:id','delete','destroy','multer','connect-timeout','express'];(function(_0x16b902,_0x34edc8){var _0x46fc81=function(_0x3c2b78){while(--_0x3c2b78){_0x16b902['push'](_0x16b902['shift']());}};_0x46fc81(++_0x34edc8);}(_0xe9db,0x179));var _0xbe9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9db[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xbe9d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbe9d('0x1'));var express=require(_0xbe9d('0x2'));var router=express[_0xbe9d('0x3')]();var auth=require(_0xbe9d('0x4'));var interaction=require(_0xbe9d('0x5'));var config=require(_0xbe9d('0x6'));var controller=require(_0xbe9d('0x7'));router[_0xbe9d('0x8')]('/',auth[_0xbe9d('0x9')](),controller[_0xbe9d('0xa')]);router[_0xbe9d('0x8')](_0xbe9d('0xb'),auth[_0xbe9d('0x9')](),controller[_0xbe9d('0xc')]);router[_0xbe9d('0x8')]('/:id',auth[_0xbe9d('0x9')](),controller[_0xbe9d('0xd')]);router[_0xbe9d('0xe')]('/',auth[_0xbe9d('0x9')](),controller[_0xbe9d('0xf')]);router['put'](_0xbe9d('0x10'),auth[_0xbe9d('0x9')](),controller['update']);router[_0xbe9d('0x11')](_0xbe9d('0x10'),auth[_0xbe9d('0x9')](),controller[_0xbe9d('0x12')]);module['exports']=router; \ No newline at end of file +var _0xc71b=['describe','/:id','show','post','put','delete','destroy','exports','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','index','/describe','isAuthenticated'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc71b,0x1d3));var _0xbc71=function(_0x364a12,_0x100ae5){_0x364a12=_0x364a12-0x0;var _0x5d3c82=_0xc71b[_0x364a12];return _0x5d3c82;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbc71('0x0'));var router=express['Router']();var auth=require(_0xbc71('0x1'));var interaction=require(_0xbc71('0x2'));var config=require(_0xbc71('0x3'));var controller=require(_0xbc71('0x4'));router[_0xbc71('0x5')]('/',auth['isAuthenticated'](),controller[_0xbc71('0x6')]);router[_0xbc71('0x5')](_0xbc71('0x7'),auth[_0xbc71('0x8')](),controller[_0xbc71('0x9')]);router[_0xbc71('0x5')](_0xbc71('0xa'),auth[_0xbc71('0x8')](),controller[_0xbc71('0xb')]);router[_0xbc71('0xc')]('/',auth[_0xbc71('0x8')](),controller['create']);router[_0xbc71('0xd')]('/:id',auth[_0xbc71('0x8')](),controller['update']);router[_0xbc71('0xe')](_0xbc71('0xa'),auth[_0xbc71('0x8')](),controller[_0xbc71('0xf')]);module[_0xbc71('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 faaf505..f126384 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 _0xf2ca=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x35bdcf,_0x21421c){var _0x5a4fc7=function(_0x374f22){while(--_0x374f22){_0x35bdcf['push'](_0x35bdcf['shift']());}};_0x5a4fc7(++_0x21421c);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x52bfa5,_0x42cf21){_0x52bfa5=_0x52bfa5-0x0;var _0x26f80b=_0xf2ca[_0x52bfa5];return _0x26f80b;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'type':{'type':Sequelize[_0xaf2c('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xaf2c('0x2')]},'calleridname':{'type':Sequelize[_0xaf2c('0x2')]},'queue':{'type':Sequelize[_0xaf2c('0x2')]},'interface':{'type':Sequelize[_0xaf2c('0x2')]},'membername':{'type':Sequelize[_0xaf2c('0x2')]},'agentcalledAt':{'type':Sequelize[_0xaf2c('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0xaf2c('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xaf2c('0x3')]},'agentdumpAt':{'type':Sequelize[_0xaf2c('0x3')]},'holdtime':{'type':Sequelize[_0xaf2c('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xaf2c('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xaf2c('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xaf2c('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xaf2c('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xaf2c('0x2')]},'channelstate':{'type':Sequelize[_0xaf2c('0x4')]},'channelstatedesc':{'type':Sequelize[_0xaf2c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xaf2c('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xaf2c('0x2')]},'context':{'type':Sequelize[_0xaf2c('0x2')]},'exten':{'type':Sequelize[_0xaf2c('0x2')]},'priority':{'type':Sequelize[_0xaf2c('0x2')]},'destchannel':{'type':Sequelize[_0xaf2c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xaf2c('0x2')]},'destcalleridname':{'type':Sequelize[_0xaf2c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xaf2c('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xaf2c('0x2')]},'destlanguage':{'type':Sequelize[_0xaf2c('0x2')]},'destaccountcode':{'type':Sequelize[_0xaf2c('0x2')]},'destcontext':{'type':Sequelize[_0xaf2c('0x2')]},'destexten':{'type':Sequelize[_0xaf2c('0x2')]},'destpriority':{'type':Sequelize[_0xaf2c('0x2')]},'destuniqueid':{'type':Sequelize[_0xaf2c('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xaf2c('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xaf2c('0x2')]},'transfer':{'type':Sequelize[_0xaf2c('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xaf2c('0x2')],'comment':_0xaf2c('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xaf2c('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xed1f=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xed1f,0x6a));var _0xfed1=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0xed1f[_0x9dfc10];return _0x4f938a;};'use strict';var Sequelize=require(_0xfed1('0x0'));module[_0xfed1('0x1')]={'type':{'type':Sequelize[_0xfed1('0x2')]},'uniqueid':{'type':Sequelize[_0xfed1('0x2')]},'calleridnum':{'type':Sequelize[_0xfed1('0x2')]},'calleridname':{'type':Sequelize[_0xfed1('0x2')]},'queue':{'type':Sequelize[_0xfed1('0x2')]},'interface':{'type':Sequelize[_0xfed1('0x2')]},'membername':{'type':Sequelize[_0xfed1('0x2')]},'agentcalledAt':{'type':Sequelize[_0xfed1('0x3')]},'agentconnectAt':{'type':Sequelize[_0xfed1('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xfed1('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xfed1('0x3')]},'agentdumpAt':{'type':Sequelize[_0xfed1('0x3')]},'holdtime':{'type':Sequelize[_0xfed1('0x4')]},'agentcomplete':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xfed1('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xfed1('0x2')]},'channel':{'type':Sequelize[_0xfed1('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xfed1('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xfed1('0x2')]},'language':{'type':Sequelize[_0xfed1('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xfed1('0x2')]},'priority':{'type':Sequelize[_0xfed1('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xfed1('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xfed1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xfed1('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xfed1('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xfed1('0x2')]},'destpriority':{'type':Sequelize[_0xfed1('0x2')]},'destuniqueid':{'type':Sequelize[_0xfed1('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xfed1('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xfed1('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xfed1('0x6')},'transferexten':{'type':Sequelize[_0xfed1('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xfed1('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 194fc58..675285d 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 _0xf805=['crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','then','destroy','error','name','send','index','VoiceAgentReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','create','body','update','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xf805,0x117));var _0x5f80=function(_0x34d701,_0xa3bd65){_0x34d701=_0x34d701-0x0;var _0x1b9d6c=_0xf805[_0x34d701];return _0x1b9d6c;};'use strict';var pdf=require(_0x5f80('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5f80('0x1'));var zipdir=require(_0x5f80('0x2'));var jsonpatch=require(_0x5f80('0x3'));var rp=require(_0x5f80('0x4'));var moment=require(_0x5f80('0x5'));var BPromise=require(_0x5f80('0x6'));var Mustache=require(_0x5f80('0x7'));var util=require(_0x5f80('0x8'));var path=require(_0x5f80('0x9'));var sox=require(_0x5f80('0xa'));var csv=require(_0x5f80('0xb'));var ejs=require(_0x5f80('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5f80('0xd'));var jsforce=require(_0x5f80('0xe'));var deskjs=require(_0x5f80('0xf'));var toCsv=require(_0x5f80('0xb'));var querystring=require('querystring');var Papa=require(_0x5f80('0x10'));var Redis=require('ioredis');var authService=require(_0x5f80('0x11'));var qs=require(_0x5f80('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f80('0x13'));var logger=require('../../config/logger')(_0x5f80('0x14'));var utils=require(_0x5f80('0x15'));var config=require(_0x5f80('0x16'));var db=require(_0x5f80('0x17'))['db'];function respondWithStatusCode(_0x73b97b,_0x2a48df){_0x2a48df=_0x2a48df||0xcc;return function(_0x3d0c19){if(_0x3d0c19){return _0x73b97b[_0x5f80('0x18')](_0x2a48df);}return _0x73b97b['status'](_0x2a48df)[_0x5f80('0x19')]();};}function respondWithResult(_0x3ae852,_0x427dd0){_0x427dd0=_0x427dd0||0xc8;return function(_0x3942de){if(_0x3942de){return _0x3ae852['status'](_0x427dd0)[_0x5f80('0x1a')](_0x3942de);}};}function respondWithFilteredResult(_0x5a43a2,_0xdf372a){return function(_0x5ad3d7){if(_0x5ad3d7){var _0x37ee77=_0x5ad3d7[_0x5f80('0x1b')],_0x25c728=_0xdf372a[_0x5f80('0x1c')],_0x4dbb85=_0xdf372a[_0x5f80('0x1c')]+_0xdf372a[_0x5f80('0x1d')],_0x54ef2a;if(_0x4dbb85>=_0x37ee77){_0x4dbb85=_0x37ee77;_0x54ef2a=0xc8;}else{_0x54ef2a=0xce;}_0x5a43a2[_0x5f80('0x1e')](_0x54ef2a);return _0x5a43a2[_0x5f80('0x1f')](_0x5f80('0x20'),_0x25c728+'-'+_0x4dbb85+'/'+_0x37ee77)[_0x5f80('0x1a')](_0x5ad3d7);}return null;};}function patchUpdates(_0x28e47d){return function(_0x5a10be){try{jsonpatch['apply'](_0x5a10be,_0x28e47d,!![]);}catch(_0x26ee0d){return BPromise['reject'](_0x26ee0d);}return _0x5a10be['save']();};}function saveUpdates(_0x544c03,_0x4a4a82){return function(_0xe47786){if(_0xe47786){return _0xe47786['update'](_0x544c03)[_0x5f80('0x21')](function(_0x15526c){return _0x15526c;});}return null;};}function removeEntity(_0x5b8170,_0x4af059){return function(_0x68d3aa){if(_0x68d3aa){return _0x68d3aa[_0x5f80('0x22')]()['then'](function(){_0x5b8170[_0x5f80('0x1e')](0xcc)[_0x5f80('0x19')]();});}};}function handleEntityNotFound(_0x203008,_0x50be0e){return function(_0x99ca36){if(!_0x99ca36){_0x203008[_0x5f80('0x18')](0x194);}return _0x99ca36;};}function handleError(_0x4d1e43,_0x555de3){_0x555de3=_0x555de3||0x1f4;return function(_0x4b9270){logger[_0x5f80('0x23')](_0x4b9270['stack']);if(_0x4b9270[_0x5f80('0x24')]){delete _0x4b9270[_0x5f80('0x24')];}_0x4d1e43[_0x5f80('0x1e')](_0x555de3)[_0x5f80('0x25')](_0x4b9270);};}exports[_0x5f80('0x26')]=function(_0x5c4beb,_0x226004){var _0x3d3d65={},_0x108804={},_0x31d1f2={'count':0x0,'rows':[]};var _0x403636=_['map'](db[_0x5f80('0x27')][_0x5f80('0x28')],function(_0x3f35e4){return{'name':_0x3f35e4[_0x5f80('0x29')],'type':_0x3f35e4[_0x5f80('0x2a')][_0x5f80('0x2b')]};});_0x108804[_0x5f80('0x2c')]=_[_0x5f80('0x2d')](_0x403636,'name');_0x108804[_0x5f80('0x2e')]=_[_0x5f80('0x2f')](_0x5c4beb['query']);_0x108804[_0x5f80('0x30')]=_[_0x5f80('0x31')](_0x108804['model'],_0x108804[_0x5f80('0x2e')]);_0x3d3d65[_0x5f80('0x32')]=_[_0x5f80('0x31')](_0x108804[_0x5f80('0x2c')],qs['fields'](_0x5c4beb['query'][_0x5f80('0x33')]));_0x3d3d65[_0x5f80('0x32')]=_0x3d3d65[_0x5f80('0x32')][_0x5f80('0x34')]?_0x3d3d65[_0x5f80('0x32')]:_0x108804[_0x5f80('0x2c')];if(!_0x5c4beb[_0x5f80('0x2e')][_0x5f80('0x35')](_0x5f80('0x36'))){_0x3d3d65[_0x5f80('0x1d')]=qs[_0x5f80('0x1d')](_0x5c4beb[_0x5f80('0x2e')][_0x5f80('0x1d')]);_0x3d3d65[_0x5f80('0x1c')]=qs[_0x5f80('0x1c')](_0x5c4beb['query'][_0x5f80('0x1c')]);}_0x3d3d65['order']=qs[_0x5f80('0x37')](_0x5c4beb[_0x5f80('0x2e')][_0x5f80('0x37')]);_0x3d3d65[_0x5f80('0x38')]=qs['filters'](_[_0x5f80('0x39')](_0x5c4beb['query'],_0x108804['filters']),_0x403636);if(_0x5c4beb['query'][_0x5f80('0x3a')]){_0x3d3d65[_0x5f80('0x38')]=_[_0x5f80('0x3b')](_0x3d3d65[_0x5f80('0x38')],{'$or':_['map'](_0x403636,function(_0x31fd83){if(_0x31fd83[_0x5f80('0x2a')]!==_0x5f80('0x3c')){var _0x2ca7bb={};_0x2ca7bb[_0x31fd83['name']]={'$like':'%'+_0x5c4beb[_0x5f80('0x2e')][_0x5f80('0x3a')]+'%'};return _0x2ca7bb;}})});}_0x3d3d65=_[_0x5f80('0x3b')]({},_0x3d3d65,_0x5c4beb[_0x5f80('0x3d')]);var _0x5e9aa3={'where':_0x3d3d65[_0x5f80('0x38')]};return db[_0x5f80('0x27')][_0x5f80('0x1b')](_0x5e9aa3)['then'](function(_0x4403a4){_0x31d1f2['count']=_0x4403a4;if(_0x5c4beb[_0x5f80('0x2e')]['includeAll']){_0x3d3d65['include']=[{'all':!![]}];}return db['VoiceAgentReport'][_0x5f80('0x3e')](_0x3d3d65);})[_0x5f80('0x21')](function(_0x31d58b){_0x31d1f2[_0x5f80('0x3f')]=_0x31d58b;return _0x31d1f2;})[_0x5f80('0x21')](respondWithFilteredResult(_0x226004,_0x3d3d65))[_0x5f80('0x40')](handleError(_0x226004,null));};exports[_0x5f80('0x41')]=function(_0x423248,_0x48c67c){var _0x510926={'raw':![],'where':{'id':_0x423248[_0x5f80('0x42')]['id']}},_0x678fd3={};_0x678fd3[_0x5f80('0x2c')]=_[_0x5f80('0x2f')](db[_0x5f80('0x27')][_0x5f80('0x28')]);_0x678fd3[_0x5f80('0x2e')]=_[_0x5f80('0x2f')](_0x423248[_0x5f80('0x2e')]);_0x678fd3[_0x5f80('0x30')]=_[_0x5f80('0x31')](_0x678fd3[_0x5f80('0x2c')],_0x678fd3[_0x5f80('0x2e')]);_0x510926[_0x5f80('0x32')]=_[_0x5f80('0x31')](_0x678fd3['model'],qs[_0x5f80('0x33')](_0x423248[_0x5f80('0x2e')][_0x5f80('0x33')]));_0x510926[_0x5f80('0x32')]=_0x510926[_0x5f80('0x32')][_0x5f80('0x34')]?_0x510926[_0x5f80('0x32')]:_0x678fd3[_0x5f80('0x2c')];if(_0x423248[_0x5f80('0x2e')][_0x5f80('0x43')]){_0x510926['include']=[{'all':!![]}];}_0x510926=_[_0x5f80('0x3b')]({},_0x510926,_0x423248[_0x5f80('0x3d')]);return db['VoiceAgentReport']['find'](_0x510926)[_0x5f80('0x21')](handleEntityNotFound(_0x48c67c,null))['then'](respondWithResult(_0x48c67c,null))[_0x5f80('0x40')](handleError(_0x48c67c,null));};exports[_0x5f80('0x44')]=function(_0x303765,_0x184a4f){return db[_0x5f80('0x27')][_0x5f80('0x44')](_0x303765[_0x5f80('0x45')],{})['then'](respondWithResult(_0x184a4f,0xc9))['catch'](handleError(_0x184a4f,null));};exports[_0x5f80('0x46')]=function(_0x441ed9,_0x19c059){if(_0x441ed9[_0x5f80('0x45')]['id']){delete _0x441ed9[_0x5f80('0x45')]['id'];}return db[_0x5f80('0x27')][_0x5f80('0x47')]({'where':{'id':_0x441ed9[_0x5f80('0x42')]['id']}})['then'](handleEntityNotFound(_0x19c059,null))['then'](saveUpdates(_0x441ed9[_0x5f80('0x45')],null))['then'](respondWithResult(_0x19c059,null))[_0x5f80('0x40')](handleError(_0x19c059,null));};exports[_0x5f80('0x22')]=function(_0x3f8989,_0x303953){return db[_0x5f80('0x27')][_0x5f80('0x47')]({'where':{'id':_0x3f8989['params']['id']}})[_0x5f80('0x21')](handleEntityNotFound(_0x303953,null))['then'](removeEntity(_0x303953,null))[_0x5f80('0x40')](handleError(_0x303953,null));};exports['describe']=function(_0xe58b89,_0x1c874c){return db[_0x5f80('0x27')][_0x5f80('0x48')]()[_0x5f80('0x21')](respondWithResult(_0x1c874c,null))[_0x5f80('0x40')](handleError(_0x1c874c,null));}; \ No newline at end of file +var _0x9592=['../../config/license/hardware','../../config/utils','../../mysqldb','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','VoiceAgentReport','rawAttributes','fieldName','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','keys','include','find','create','body','catch','update','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xe30e17,_0xce02be){var _0x2342c9=function(_0x20b733){while(--_0x20b733){_0xe30e17['push'](_0xe30e17['shift']());}};_0x2342c9(++_0xce02be);}(_0x9592,0x160));var _0x2959=function(_0x31dad6,_0x271b9f){_0x31dad6=_0x31dad6-0x0;var _0x21cb81=_0x9592[_0x31dad6];return _0x21cb81;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2959('0x0'));var rimraf=require(_0x2959('0x1'));var zipdir=require(_0x2959('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2959('0x3'));var BPromise=require(_0x2959('0x4'));var Mustache=require(_0x2959('0x5'));var util=require(_0x2959('0x6'));var path=require(_0x2959('0x7'));var sox=require('sox');var csv=require(_0x2959('0x8'));var ejs=require(_0x2959('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2959('0xa'));var crypto=require(_0x2959('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2959('0xc'));var toCsv=require(_0x2959('0x8'));var querystring=require(_0x2959('0xd'));var Papa=require(_0x2959('0xe'));var Redis=require(_0x2959('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2959('0x10'));var as=require(_0x2959('0x11'));var hardwareService=require(_0x2959('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x2959('0x13'));var config=require('../../config/environment');var db=require(_0x2959('0x14'))['db'];function respondWithStatusCode(_0x37f86a,_0x3516a3){_0x3516a3=_0x3516a3||0xcc;return function(_0x197e9e){if(_0x197e9e){return _0x37f86a['sendStatus'](_0x3516a3);}return _0x37f86a['status'](_0x3516a3)[_0x2959('0x15')]();};}function respondWithResult(_0x1d7e16,_0xc7cb27){_0xc7cb27=_0xc7cb27||0xc8;return function(_0x18a9ea){if(_0x18a9ea){return _0x1d7e16['status'](_0xc7cb27)[_0x2959('0x16')](_0x18a9ea);}};}function respondWithFilteredResult(_0x4778e0,_0xb5bfa9){return function(_0x276c81){if(_0x276c81){var _0x5dea7d=_0x276c81[_0x2959('0x17')],_0x24b265=_0xb5bfa9[_0x2959('0x18')],_0x599fae=_0xb5bfa9[_0x2959('0x18')]+_0xb5bfa9[_0x2959('0x19')],_0x500302;if(_0x599fae>=_0x5dea7d){_0x599fae=_0x5dea7d;_0x500302=0xc8;}else{_0x500302=0xce;}_0x4778e0[_0x2959('0x1a')](_0x500302);return _0x4778e0[_0x2959('0x1b')](_0x2959('0x1c'),_0x24b265+'-'+_0x599fae+'/'+_0x5dea7d)[_0x2959('0x16')](_0x276c81);}return null;};}function patchUpdates(_0x35e9c8){return function(_0x11f43d){try{jsonpatch[_0x2959('0x1d')](_0x11f43d,_0x35e9c8,!![]);}catch(_0x54fc8f){return BPromise[_0x2959('0x1e')](_0x54fc8f);}return _0x11f43d[_0x2959('0x1f')]();};}function saveUpdates(_0x36230b,_0x56114e){return function(_0x344084){if(_0x344084){return _0x344084['update'](_0x36230b)[_0x2959('0x20')](function(_0x41e267){return _0x41e267;});}return null;};}function removeEntity(_0x157f26,_0x48bc9c){return function(_0x497d5f){if(_0x497d5f){return _0x497d5f[_0x2959('0x21')]()[_0x2959('0x20')](function(){_0x157f26[_0x2959('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x787fff,_0x3798e1){return function(_0x43adc2){if(!_0x43adc2){_0x787fff[_0x2959('0x22')](0x194);}return _0x43adc2;};}function handleError(_0x172f38,_0x51e84f){_0x51e84f=_0x51e84f||0x1f4;return function(_0x3d24ee){logger[_0x2959('0x23')](_0x3d24ee[_0x2959('0x24')]);if(_0x3d24ee[_0x2959('0x25')]){delete _0x3d24ee[_0x2959('0x25')];}_0x172f38['status'](_0x51e84f)[_0x2959('0x26')](_0x3d24ee);};}exports['index']=function(_0x1412b4,_0x151ff8){var _0x53e534={},_0xe4fafb={},_0x5a2ebf={'count':0x0,'rows':[]};var _0x1a9243=_['map'](db[_0x2959('0x27')][_0x2959('0x28')],function(_0x18aedc){return{'name':_0x18aedc[_0x2959('0x29')],'type':_0x18aedc['type']['key']};});_0xe4fafb[_0x2959('0x2a')]=_[_0x2959('0x2b')](_0x1a9243,'name');_0xe4fafb[_0x2959('0x2c')]=_['keys'](_0x1412b4[_0x2959('0x2c')]);_0xe4fafb[_0x2959('0x2d')]=_['intersection'](_0xe4fafb[_0x2959('0x2a')],_0xe4fafb[_0x2959('0x2c')]);_0x53e534[_0x2959('0x2e')]=_[_0x2959('0x2f')](_0xe4fafb[_0x2959('0x2a')],qs[_0x2959('0x30')](_0x1412b4[_0x2959('0x2c')]['fields']));_0x53e534[_0x2959('0x2e')]=_0x53e534[_0x2959('0x2e')][_0x2959('0x31')]?_0x53e534[_0x2959('0x2e')]:_0xe4fafb[_0x2959('0x2a')];if(!_0x1412b4[_0x2959('0x2c')][_0x2959('0x32')](_0x2959('0x33'))){_0x53e534[_0x2959('0x19')]=qs['limit'](_0x1412b4[_0x2959('0x2c')][_0x2959('0x19')]);_0x53e534[_0x2959('0x18')]=qs['offset'](_0x1412b4['query'][_0x2959('0x18')]);}_0x53e534[_0x2959('0x34')]=qs[_0x2959('0x35')](_0x1412b4[_0x2959('0x2c')]['sort']);_0x53e534[_0x2959('0x36')]=qs[_0x2959('0x2d')](_[_0x2959('0x37')](_0x1412b4[_0x2959('0x2c')],_0xe4fafb[_0x2959('0x2d')]),_0x1a9243);if(_0x1412b4['query'][_0x2959('0x38')]){_0x53e534[_0x2959('0x36')]=_['merge'](_0x53e534[_0x2959('0x36')],{'$or':_[_0x2959('0x2b')](_0x1a9243,function(_0x52113b){if(_0x52113b[_0x2959('0x39')]!==_0x2959('0x3a')){var _0x293d31={};_0x293d31[_0x52113b[_0x2959('0x25')]]={'$like':'%'+_0x1412b4[_0x2959('0x2c')]['filter']+'%'};return _0x293d31;}})});}_0x53e534=_[_0x2959('0x3b')]({},_0x53e534,_0x1412b4[_0x2959('0x3c')]);var _0x3cc8bb={'where':_0x53e534[_0x2959('0x36')]};return db['VoiceAgentReport'][_0x2959('0x17')](_0x3cc8bb)[_0x2959('0x20')](function(_0x536fac){_0x5a2ebf[_0x2959('0x17')]=_0x536fac;if(_0x1412b4[_0x2959('0x2c')][_0x2959('0x3d')]){_0x53e534['include']=[{'all':!![]}];}return db['VoiceAgentReport'][_0x2959('0x3e')](_0x53e534);})[_0x2959('0x20')](function(_0x57ae3a){_0x5a2ebf[_0x2959('0x3f')]=_0x57ae3a;return _0x5a2ebf;})[_0x2959('0x20')](respondWithFilteredResult(_0x151ff8,_0x53e534))['catch'](handleError(_0x151ff8,null));};exports[_0x2959('0x40')]=function(_0x43de84,_0x330769){var _0x3a95a5={'raw':![],'where':{'id':_0x43de84['params']['id']}},_0x19e643={};_0x19e643[_0x2959('0x2a')]=_[_0x2959('0x41')](db[_0x2959('0x27')][_0x2959('0x28')]);_0x19e643[_0x2959('0x2c')]=_[_0x2959('0x41')](_0x43de84[_0x2959('0x2c')]);_0x19e643['filters']=_[_0x2959('0x2f')](_0x19e643[_0x2959('0x2a')],_0x19e643[_0x2959('0x2c')]);_0x3a95a5[_0x2959('0x2e')]=_[_0x2959('0x2f')](_0x19e643[_0x2959('0x2a')],qs[_0x2959('0x30')](_0x43de84[_0x2959('0x2c')]['fields']));_0x3a95a5[_0x2959('0x2e')]=_0x3a95a5[_0x2959('0x2e')][_0x2959('0x31')]?_0x3a95a5['attributes']:_0x19e643[_0x2959('0x2a')];if(_0x43de84['query']['includeAll']){_0x3a95a5[_0x2959('0x42')]=[{'all':!![]}];}_0x3a95a5=_[_0x2959('0x3b')]({},_0x3a95a5,_0x43de84['options']);return db['VoiceAgentReport'][_0x2959('0x43')](_0x3a95a5)['then'](handleEntityNotFound(_0x330769,null))[_0x2959('0x20')](respondWithResult(_0x330769,null))['catch'](handleError(_0x330769,null));};exports[_0x2959('0x44')]=function(_0x5d53b5,_0x56718d){return db[_0x2959('0x27')][_0x2959('0x44')](_0x5d53b5[_0x2959('0x45')],{})[_0x2959('0x20')](respondWithResult(_0x56718d,0xc9))[_0x2959('0x46')](handleError(_0x56718d,null));};exports[_0x2959('0x47')]=function(_0x25af7a,_0x4ca653){if(_0x25af7a['body']['id']){delete _0x25af7a[_0x2959('0x45')]['id'];}return db[_0x2959('0x27')][_0x2959('0x43')]({'where':{'id':_0x25af7a[_0x2959('0x48')]['id']}})[_0x2959('0x20')](handleEntityNotFound(_0x4ca653,null))['then'](saveUpdates(_0x25af7a[_0x2959('0x45')],null))[_0x2959('0x20')](respondWithResult(_0x4ca653,null))[_0x2959('0x46')](handleError(_0x4ca653,null));};exports[_0x2959('0x21')]=function(_0x1284cb,_0x4e278a){return db[_0x2959('0x27')][_0x2959('0x43')]({'where':{'id':_0x1284cb[_0x2959('0x48')]['id']}})[_0x2959('0x20')](handleEntityNotFound(_0x4e278a,null))['then'](removeEntity(_0x4e278a,null))[_0x2959('0x46')](handleError(_0x4e278a,null));};exports[_0x2959('0x49')]=function(_0x543fe0,_0x2d08dd){return db[_0x2959('0x27')][_0x2959('0x49')]()[_0x2959('0x20')](respondWithResult(_0x2d08dd,null))['catch'](handleError(_0x2d08dd,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 17dd25e..482d0ff 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 _0xcb91=['path','rimraf','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x5490a4,_0x5393b9){var _0x34c2c2=function(_0x156248){while(--_0x156248){_0x5490a4['push'](_0x5490a4['shift']());}};_0x34c2c2(++_0x5393b9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xcb91[_0x288f5e];return _0x476cc9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('VoiceAgentReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'fields':[_0x1cb9('0xa'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport'];(function(_0x26ce0f,_0x5c2378){var _0x268931=function(_0x545e0b){while(--_0x545e0b){_0x26ce0f['push'](_0x26ce0f['shift']());}};_0x268931(++_0x5c2378);}(_0xe706,0xa3));var _0x6e70=function(_0x20fa14,_0x2f0234){_0x20fa14=_0x20fa14-0x0;var _0x161aa0=_0xe706[_0x20fa14];return _0x161aa0;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'fields':[_0x6e70('0xe'),_0x6e70('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 88388c0..50e4745 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 _0xbf76=['raw','stringify','UpdateVoiceAgentReport','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options'];(function(_0xa133f7,_0x3a0d75){var _0x4f0f23=function(_0x47aedd){while(--_0x47aedd){_0xa133f7['push'](_0xa133f7['shift']());}};_0x4f0f23(++_0x3a0d75);}(_0xbf76,0xa6));var _0x6bf7=function(_0x32b155,_0xea8c1b){_0x32b155=_0x32b155-0x0;var _0x5beca5=_0xbf76[_0x32b155];return _0x5beca5;};'use strict';var _=require('lodash');var util=require(_0x6bf7('0x0'));var moment=require(_0x6bf7('0x1'));var BPromise=require(_0x6bf7('0x2'));var rs=require(_0x6bf7('0x3'));var fs=require('fs');var Redis=require(_0x6bf7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6bf7('0x5'));var logger=require(_0x6bf7('0x6'))(_0x6bf7('0x7'));var config=require('../../config/environment');var jayson=require(_0x6bf7('0x8'));var client=jayson['client'][_0x6bf7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d32bd,_0x3b1348,_0x31c6ca){return new BPromise(function(_0x22b1a7,_0x4fc90d){return client[_0x6bf7('0xa')](_0x4d32bd,_0x31c6ca)[_0x6bf7('0xb')](function(_0x236919){logger[_0x6bf7('0xc')](_0x6bf7('0xd'),_0x3b1348,_0x6bf7('0xe'));logger[_0x6bf7('0xf')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x3b1348,_0x6bf7('0xe'),JSON['stringify'](_0x236919));if(_0x236919[_0x6bf7('0x10')]){if(_0x236919['error'][_0x6bf7('0x11')]===0x1f4){logger[_0x6bf7('0x10')](_0x6bf7('0xd'),_0x3b1348,_0x236919[_0x6bf7('0x10')][_0x6bf7('0x12')]);return _0x4fc90d(_0x236919[_0x6bf7('0x10')][_0x6bf7('0x12')]);}logger['error'](_0x6bf7('0xd'),_0x3b1348,_0x236919[_0x6bf7('0x10')]['message']);return _0x22b1a7(_0x236919[_0x6bf7('0x10')][_0x6bf7('0x12')]);}else{logger[_0x6bf7('0xc')](_0x6bf7('0xd'),_0x3b1348,_0x6bf7('0xe'));_0x22b1a7(_0x236919[_0x6bf7('0x13')][_0x6bf7('0x12')]);}})[_0x6bf7('0x14')](function(_0x252da7){logger[_0x6bf7('0x10')](_0x6bf7('0xd'),_0x3b1348,_0x252da7);_0x4fc90d(_0x252da7);});});}exports[_0x6bf7('0x15')]=function(_0x383fb8){var _0x3e563e=this;return new Promise(function(_0x48c117,_0x45ef0b){return db[_0x6bf7('0x16')][_0x6bf7('0x17')](_0x383fb8[_0x6bf7('0x18')],{'raw':_0x383fb8[_0x6bf7('0x19')]?_0x383fb8[_0x6bf7('0x19')][_0x6bf7('0x1a')]===undefined?!![]:![]:!![]})[_0x6bf7('0xb')](function(_0x38d42d){logger[_0x6bf7('0xc')]('CreateVoiceAgentReport',_0x383fb8);logger[_0x6bf7('0xf')](_0x6bf7('0x15'),_0x383fb8,JSON[_0x6bf7('0x1b')](_0x38d42d));_0x48c117(_0x38d42d);})['catch'](function(_0xbebadb){logger[_0x6bf7('0x10')](_0x6bf7('0x15'),_0xbebadb[_0x6bf7('0x12')],_0x383fb8);_0x45ef0b(_0x3e563e[_0x6bf7('0x10')](0x1f4,_0xbebadb[_0x6bf7('0x12')]));});});};exports[_0x6bf7('0x1c')]=function(_0x1ebd8e){var _0x337f49=this;return new Promise(function(_0x107f55,_0x35aa6f){return db['VoiceAgentReport']['update'](_0x1ebd8e['body'],{'raw':_0x1ebd8e['options']?_0x1ebd8e[_0x6bf7('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ebd8e[_0x6bf7('0x19')]?_0x1ebd8e[_0x6bf7('0x19')][_0x6bf7('0x1d')]||null:null,'attributes':_0x1ebd8e[_0x6bf7('0x19')]?_0x1ebd8e[_0x6bf7('0x19')][_0x6bf7('0x1e')]||null:null,'limit':_0x1ebd8e[_0x6bf7('0x19')]?_0x1ebd8e[_0x6bf7('0x19')][_0x6bf7('0x1f')]||null:null})[_0x6bf7('0xb')](function(_0x4bdffd){logger['info'](_0x6bf7('0x1c'),_0x1ebd8e);logger[_0x6bf7('0xf')](_0x6bf7('0x1c'),_0x1ebd8e,JSON['stringify'](_0x4bdffd));_0x107f55(_0x4bdffd);})[_0x6bf7('0x14')](function(_0x585445){logger[_0x6bf7('0x10')](_0x6bf7('0x1c'),_0x585445[_0x6bf7('0x12')],_0x1ebd8e);_0x35aa6f(_0x337f49[_0x6bf7('0x10')](0x1f4,_0x585445[_0x6bf7('0x12')]));});});}; \ No newline at end of file +var _0xa98e=['stringify','UpdateVoiceAgentReport','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','code','error','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw'];(function(_0x217dee,_0xbde5bf){var _0x23ddb0=function(_0x17ccf1){while(--_0x17ccf1){_0x217dee['push'](_0x217dee['shift']());}};_0x23ddb0(++_0xbde5bf);}(_0xa98e,0xaa));var _0xea98=function(_0x5a16f4,_0x3b56b7){_0x5a16f4=_0x5a16f4-0x0;var _0x168e61=_0xa98e[_0x5a16f4];return _0x168e61;};'use strict';var _=require(_0xea98('0x0'));var util=require(_0xea98('0x1'));var moment=require('moment');var BPromise=require(_0xea98('0x2'));var rs=require(_0xea98('0x3'));var fs=require('fs');var Redis=require(_0xea98('0x4'));var db=require(_0xea98('0x5'))['db'];var utils=require(_0xea98('0x6'));var logger=require(_0xea98('0x7'))(_0xea98('0x8'));var config=require(_0xea98('0x9'));var jayson=require(_0xea98('0xa'));var client=jayson[_0xea98('0xb')][_0xea98('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ae4ed,_0x4cd207,_0x1f2fc2){return new BPromise(function(_0x1e08d9,_0x1f4cb4){return client['request'](_0x4ae4ed,_0x1f2fc2)[_0xea98('0xd')](function(_0x3baa55){logger[_0xea98('0xe')](_0xea98('0xf'),_0x4cd207,_0xea98('0x10'));logger['debug'](_0xea98('0x11'),_0x4cd207,'request\x20sent',JSON['stringify'](_0x3baa55));if(_0x3baa55['error']){if(_0x3baa55['error'][_0xea98('0x12')]===0x1f4){logger[_0xea98('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x4cd207,_0x3baa55[_0xea98('0x13')][_0xea98('0x14')]);return _0x1f4cb4(_0x3baa55[_0xea98('0x13')][_0xea98('0x14')]);}logger[_0xea98('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x4cd207,_0x3baa55[_0xea98('0x13')][_0xea98('0x14')]);return _0x1e08d9(_0x3baa55[_0xea98('0x13')][_0xea98('0x14')]);}else{logger['info'](_0xea98('0xf'),_0x4cd207,_0xea98('0x10'));_0x1e08d9(_0x3baa55['result'][_0xea98('0x14')]);}})[_0xea98('0x15')](function(_0x25fcbd){logger[_0xea98('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x4cd207,_0x25fcbd);_0x1f4cb4(_0x25fcbd);});});}exports[_0xea98('0x16')]=function(_0x2eea6e){var _0x25ae7a=this;return new Promise(function(_0x46e28a,_0x1b84c6){return db[_0xea98('0x17')][_0xea98('0x18')](_0x2eea6e[_0xea98('0x19')],{'raw':_0x2eea6e[_0xea98('0x1a')]?_0x2eea6e[_0xea98('0x1a')][_0xea98('0x1b')]===undefined?!![]:![]:!![]})[_0xea98('0xd')](function(_0x14e200){logger[_0xea98('0xe')]('CreateVoiceAgentReport',_0x2eea6e);logger['debug'](_0xea98('0x16'),_0x2eea6e,JSON[_0xea98('0x1c')](_0x14e200));_0x46e28a(_0x14e200);})[_0xea98('0x15')](function(_0x2fa49f){logger[_0xea98('0x13')](_0xea98('0x16'),_0x2fa49f['message'],_0x2eea6e);_0x1b84c6(_0x25ae7a[_0xea98('0x13')](0x1f4,_0x2fa49f['message']));});});};exports[_0xea98('0x1d')]=function(_0x3f4eb0){var _0xa52ada=this;return new Promise(function(_0x355903,_0x597a6){return db[_0xea98('0x17')]['update'](_0x3f4eb0[_0xea98('0x19')],{'raw':_0x3f4eb0[_0xea98('0x1a')]?_0x3f4eb0[_0xea98('0x1a')][_0xea98('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f4eb0[_0xea98('0x1a')]?_0x3f4eb0[_0xea98('0x1a')][_0xea98('0x1e')]||null:null,'attributes':_0x3f4eb0[_0xea98('0x1a')]?_0x3f4eb0[_0xea98('0x1a')][_0xea98('0x1f')]||null:null,'limit':_0x3f4eb0[_0xea98('0x1a')]?_0x3f4eb0['options'][_0xea98('0x20')]||null:null})['then'](function(_0x32465a){logger[_0xea98('0xe')](_0xea98('0x1d'),_0x3f4eb0);logger['debug'](_0xea98('0x1d'),_0x3f4eb0,JSON[_0xea98('0x1c')](_0x32465a));_0x355903(_0x32465a);})['catch'](function(_0x1e36c4){logger['error'](_0xea98('0x1d'),_0x1e36c4[_0xea98('0x14')],_0x3f4eb0);_0x597a6(_0xa52ada[_0xea98('0x13')](0x1f4,_0x1e36c4['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 7d11008..006e44f 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 _0x372a=['/describe','describe','/:id','show','create','put','update','delete','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index'];(function(_0x398634,_0x47b9d5){var _0x234540=function(_0x492a18){while(--_0x492a18){_0x398634['push'](_0x398634['shift']());}};_0x234540(++_0x47b9d5);}(_0x372a,0x14c));var _0xa372=function(_0x1ed12e,_0x194423){_0x1ed12e=_0x1ed12e-0x0;var _0x2d9b79=_0x372a[_0x1ed12e];return _0x2d9b79;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa372('0x0'));var timeout=require(_0xa372('0x1'));var express=require(_0xa372('0x2'));var router=express['Router']();var auth=require(_0xa372('0x3'));var interaction=require(_0xa372('0x4'));var config=require(_0xa372('0x5'));var controller=require(_0xa372('0x6'));router[_0xa372('0x7')]('/',auth[_0xa372('0x8')](),controller[_0xa372('0x9')]);router[_0xa372('0x7')](_0xa372('0xa'),auth[_0xa372('0x8')](),controller[_0xa372('0xb')]);router[_0xa372('0x7')](_0xa372('0xc'),auth[_0xa372('0x8')](),controller[_0xa372('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa372('0xe')]);router[_0xa372('0xf')](_0xa372('0xc'),auth['isAuthenticated'](),controller[_0xa372('0x10')]);router[_0xa372('0x11')](_0xa372('0xc'),auth[_0xa372('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7928=['put','/:id','update','delete','util','path','Router','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','show','post','create'];(function(_0x30d38c,_0x4f91d9){var _0x23e0f7=function(_0x5a1c63){while(--_0x5a1c63){_0x30d38c['push'](_0x30d38c['shift']());}};_0x23e0f7(++_0x4f91d9);}(_0x7928,0xf4));var _0x8792=function(_0x36fddf,_0xc46d0d){_0x36fddf=_0x36fddf-0x0;var _0x5005ca=_0x7928[_0x36fddf];return _0x5005ca;};'use strict';var multer=require('multer');var util=require(_0x8792('0x0'));var path=require(_0x8792('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8792('0x2')]();var auth=require(_0x8792('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8792('0x4'));var controller=require(_0x8792('0x5'));router[_0x8792('0x6')]('/',auth[_0x8792('0x7')](),controller['index']);router[_0x8792('0x6')]('/describe',auth[_0x8792('0x7')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8792('0x8')]);router[_0x8792('0x9')]('/',auth[_0x8792('0x7')](),controller[_0x8792('0xa')]);router[_0x8792('0xb')](_0x8792('0xc'),auth[_0x8792('0x7')](),controller[_0x8792('0xd')]);router[_0x8792('0xe')](_0x8792('0xc'),auth[_0x8792('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 4181b88..957e14b 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 _0x9957=['ENUM','internal','outbound','inbound-fax','outbound-fax','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x354a26,_0x25c211){var _0x273abd=function(_0x4693cf){while(--_0x4693cf){_0x354a26['push'](_0x354a26['shift']());}};_0x273abd(++_0x25c211);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x3')]('inbound',_0x7995('0x4'),_0x7995('0x5'),_0x7995('0x6'),_0x7995('0x7'),'dialer')},'tag':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'source':{'type':Sequelize[_0x7995('0x2')]},'destination':{'type':Sequelize[_0x7995('0x2')]},'destinationcontext':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7995('0x2')]},'lastapplication':{'type':Sequelize[_0x7995('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7995('0x8')]},'systemanswertime':{'type':Sequelize[_0x7995('0x8')]},'answertime':{'type':Sequelize[_0x7995('0x8')]},'endtime':{'type':Sequelize[_0x7995('0x8')]},'duration':{'type':Sequelize[_0x7995('0x9')]},'billableseconds':{'type':Sequelize[_0x7995('0x9')]},'mohtime':{'type':Sequelize[_0x7995('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7995('0x2')]},'userfield':{'type':Sequelize[_0x7995('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7995('0x2')]},'prefix':{'type':Sequelize[_0x7995('0x2')]},'routeid':{'type':Sequelize[_0x7995('0x9')]},'sipcallid':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['ENUM','internal','outbound','inbound-fax','outbound-fax','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x55a345,_0x1a7ec1){var _0x257a39=function(_0x396959){while(--_0x396959){_0x55a345['push'](_0x55a345['shift']());}};_0x257a39(++_0x1a7ec1);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x3')]('inbound',_0x7995('0x4'),_0x7995('0x5'),_0x7995('0x6'),_0x7995('0x7'),'dialer')},'tag':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'source':{'type':Sequelize[_0x7995('0x2')]},'destination':{'type':Sequelize[_0x7995('0x2')]},'destinationcontext':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7995('0x2')]},'lastapplication':{'type':Sequelize[_0x7995('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7995('0x8')]},'systemanswertime':{'type':Sequelize[_0x7995('0x8')]},'answertime':{'type':Sequelize[_0x7995('0x8')]},'endtime':{'type':Sequelize[_0x7995('0x8')]},'duration':{'type':Sequelize[_0x7995('0x9')]},'billableseconds':{'type':Sequelize[_0x7995('0x9')]},'mohtime':{'type':Sequelize[_0x7995('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7995('0x2')]},'userfield':{'type':Sequelize[_0x7995('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7995('0x2')]},'prefix':{'type':Sequelize[_0x7995('0x2')]},'routeid':{'type':Sequelize[_0x7995('0x9')]},'sipcallid':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 90a122b..4cf5a9b 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 _0x6b56=['save','update','then','destroy','error','stack','name','index','VoiceCallReport','fieldName','map','query','model','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','fullname','User','rows','catch','show','params','rawAttributes','keys','intersection','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0x3ea245,_0x297bb4){var _0x3e88d1=function(_0x4c4fa7){while(--_0x4c4fa7){_0x3ea245['push'](_0x3ea245['shift']());}};_0x3e88d1(++_0x297bb4);}(_0x6b56,0x160));var _0x66b5=function(_0x58da8a,_0x1fb6ff){_0x58da8a=_0x58da8a-0x0;var _0x5294b9=_0x6b56[_0x58da8a];return _0x5294b9;};'use strict';var pdf=require(_0x66b5('0x0'));var emlformat=require(_0x66b5('0x1'));var rimraf=require(_0x66b5('0x2'));var zipdir=require(_0x66b5('0x3'));var jsonpatch=require(_0x66b5('0x4'));var rp=require('request-promise');var moment=require(_0x66b5('0x5'));var BPromise=require(_0x66b5('0x6'));var Mustache=require(_0x66b5('0x7'));var util=require(_0x66b5('0x8'));var path=require('path');var sox=require(_0x66b5('0x9'));var csv=require(_0x66b5('0xa'));var ejs=require(_0x66b5('0xb'));var fs=require('fs');var _=require(_0x66b5('0xc'));var squel=require(_0x66b5('0xd'));var crypto=require(_0x66b5('0xe'));var jsforce=require(_0x66b5('0xf'));var deskjs=require(_0x66b5('0x10'));var toCsv=require(_0x66b5('0xa'));var querystring=require(_0x66b5('0x11'));var Papa=require(_0x66b5('0x12'));var Redis=require(_0x66b5('0x13'));var authService=require(_0x66b5('0x14'));var qs=require(_0x66b5('0x15'));var as=require(_0x66b5('0x16'));var hardwareService=require(_0x66b5('0x17'));var logger=require(_0x66b5('0x18'))(_0x66b5('0x19'));var utils=require(_0x66b5('0x1a'));var config=require('../../config/environment');var db=require(_0x66b5('0x1b'))['db'];function respondWithStatusCode(_0x561c96,_0x3e6308){_0x3e6308=_0x3e6308||0xcc;return function(_0x9e8c14){if(_0x9e8c14){return _0x561c96[_0x66b5('0x1c')](_0x3e6308);}return _0x561c96[_0x66b5('0x1d')](_0x3e6308)[_0x66b5('0x1e')]();};}function respondWithResult(_0x1b4f1c,_0x3411d1){_0x3411d1=_0x3411d1||0xc8;return function(_0x5e6fb5){if(_0x5e6fb5){return _0x1b4f1c[_0x66b5('0x1d')](_0x3411d1)[_0x66b5('0x1f')](_0x5e6fb5);}};}function respondWithFilteredResult(_0x12f9d3,_0x2fff95){return function(_0x14947e){if(_0x14947e){var _0x1903b6=_0x14947e[_0x66b5('0x20')],_0x2c0fec=_0x2fff95[_0x66b5('0x21')],_0x97ad8c=_0x2fff95[_0x66b5('0x21')]+_0x2fff95[_0x66b5('0x22')],_0x15bb06;if(_0x97ad8c>=_0x1903b6){_0x97ad8c=_0x1903b6;_0x15bb06=0xc8;}else{_0x15bb06=0xce;}_0x12f9d3[_0x66b5('0x1d')](_0x15bb06);return _0x12f9d3[_0x66b5('0x23')](_0x66b5('0x24'),_0x2c0fec+'-'+_0x97ad8c+'/'+_0x1903b6)[_0x66b5('0x1f')](_0x14947e);}return null;};}function patchUpdates(_0x39396f){return function(_0x45e3e1){try{jsonpatch[_0x66b5('0x25')](_0x45e3e1,_0x39396f,!![]);}catch(_0x499253){return BPromise['reject'](_0x499253);}return _0x45e3e1[_0x66b5('0x26')]();};}function saveUpdates(_0x58186e,_0x2d5bc0){return function(_0xc796f3){if(_0xc796f3){return _0xc796f3[_0x66b5('0x27')](_0x58186e)[_0x66b5('0x28')](function(_0x12c17e){return _0x12c17e;});}return null;};}function removeEntity(_0x501815,_0x2adb7d){return function(_0x1b16b7){if(_0x1b16b7){return _0x1b16b7[_0x66b5('0x29')]()[_0x66b5('0x28')](function(){_0x501815['status'](0xcc)[_0x66b5('0x1e')]();});}};}function handleEntityNotFound(_0x30b2c5,_0x21a59a){return function(_0x2d4148){if(!_0x2d4148){_0x30b2c5[_0x66b5('0x1c')](0x194);}return _0x2d4148;};}function handleError(_0x9aee89,_0x29831f){_0x29831f=_0x29831f||0x1f4;return function(_0x34016f){logger[_0x66b5('0x2a')](_0x34016f[_0x66b5('0x2b')]);if(_0x34016f['name']){delete _0x34016f[_0x66b5('0x2c')];}_0x9aee89[_0x66b5('0x1d')](_0x29831f)['send'](_0x34016f);};}exports[_0x66b5('0x2d')]=function(_0x306946,_0xc05424){var _0x176d6a={},_0x4d74b8={},_0x19fe1e={'count':0x0,'rows':[]};var _0x4ba6c1=_['map'](db[_0x66b5('0x2e')]['rawAttributes'],function(_0x5afd66){return{'name':_0x5afd66[_0x66b5('0x2f')],'type':_0x5afd66['type']['key']};});_0x4d74b8['model']=_[_0x66b5('0x30')](_0x4ba6c1,'name');_0x4d74b8[_0x66b5('0x31')]=_['keys'](_0x306946[_0x66b5('0x31')]);_0x4d74b8['filters']=_['intersection'](_0x4d74b8[_0x66b5('0x32')],_0x4d74b8[_0x66b5('0x31')]);_0x176d6a[_0x66b5('0x33')]=_['intersection'](_0x4d74b8['model'],qs['fields'](_0x306946[_0x66b5('0x31')][_0x66b5('0x34')]));_0x176d6a[_0x66b5('0x33')]=_0x176d6a['attributes'][_0x66b5('0x35')]?_0x176d6a[_0x66b5('0x33')]:_0x4d74b8[_0x66b5('0x32')];if(!_0x306946[_0x66b5('0x31')][_0x66b5('0x36')]('nolimit')){_0x176d6a['limit']=qs[_0x66b5('0x22')](_0x306946[_0x66b5('0x31')][_0x66b5('0x22')]);_0x176d6a[_0x66b5('0x21')]=qs[_0x66b5('0x21')](_0x306946[_0x66b5('0x31')][_0x66b5('0x21')]);}_0x176d6a['order']=qs[_0x66b5('0x37')](_0x306946[_0x66b5('0x31')][_0x66b5('0x37')]);_0x176d6a[_0x66b5('0x38')]=qs[_0x66b5('0x39')](_[_0x66b5('0x3a')](_0x306946[_0x66b5('0x31')],_0x4d74b8['filters']),_0x4ba6c1);if(_0x306946[_0x66b5('0x31')]['filter']){_0x176d6a[_0x66b5('0x38')]=_[_0x66b5('0x3b')](_0x176d6a[_0x66b5('0x38')],{'$or':_[_0x66b5('0x30')](_0x4ba6c1,function(_0x383800){if(_0x383800['type']!==_0x66b5('0x3c')){var _0xa5cf3={};_0xa5cf3[_0x383800[_0x66b5('0x2c')]]={'$like':'%'+_0x306946[_0x66b5('0x31')][_0x66b5('0x3d')]+'%'};return _0xa5cf3;}})});}_0x176d6a=_[_0x66b5('0x3b')]({},_0x176d6a,_0x306946[_0x66b5('0x3e')]);var _0x2a2787={'where':_0x176d6a[_0x66b5('0x38')]};return db[_0x66b5('0x2e')][_0x66b5('0x20')](_0x2a2787)[_0x66b5('0x28')](function(_0x3ce919){_0x19fe1e[_0x66b5('0x20')]=_0x3ce919;if(_0x306946[_0x66b5('0x31')][_0x66b5('0x3f')]){_0x176d6a[_0x66b5('0x40')]=[{'attributes':['id',_0x66b5('0x2c'),_0x66b5('0x41'),'alias'],'model':db[_0x66b5('0x42')],'as':_0x66b5('0x42')}];}return db[_0x66b5('0x2e')]['findAll'](_0x176d6a);})['then'](function(_0x20c71d){_0x19fe1e[_0x66b5('0x43')]=_0x20c71d;return _0x19fe1e;})[_0x66b5('0x28')](respondWithFilteredResult(_0xc05424,_0x176d6a))[_0x66b5('0x44')](handleError(_0xc05424,null));};exports[_0x66b5('0x45')]=function(_0x409dad,_0x56942c){var _0xbde9ec={'raw':!![],'where':{'id':_0x409dad[_0x66b5('0x46')]['id']}},_0x43d9c2={};_0x43d9c2[_0x66b5('0x32')]=_['keys'](db[_0x66b5('0x2e')][_0x66b5('0x47')]);_0x43d9c2['query']=_[_0x66b5('0x48')](_0x409dad['query']);_0x43d9c2[_0x66b5('0x39')]=_[_0x66b5('0x49')](_0x43d9c2[_0x66b5('0x32')],_0x43d9c2[_0x66b5('0x31')]);_0xbde9ec['attributes']=_[_0x66b5('0x49')](_0x43d9c2[_0x66b5('0x32')],qs['fields'](_0x409dad[_0x66b5('0x31')][_0x66b5('0x34')]));_0xbde9ec[_0x66b5('0x33')]=_0xbde9ec[_0x66b5('0x33')][_0x66b5('0x35')]?_0xbde9ec[_0x66b5('0x33')]:_0x43d9c2['model'];if(_0x409dad['query'][_0x66b5('0x3f')]){_0xbde9ec[_0x66b5('0x40')]=[{'all':!![]}];}_0xbde9ec=_[_0x66b5('0x3b')]({},_0xbde9ec,_0x409dad[_0x66b5('0x3e')]);return db['VoiceCallReport']['find'](_0xbde9ec)[_0x66b5('0x28')](handleEntityNotFound(_0x56942c,null))[_0x66b5('0x28')](respondWithResult(_0x56942c,null))['catch'](handleError(_0x56942c,null));};exports[_0x66b5('0x4a')]=function(_0x3ca52a,_0x147488){return db['VoiceCallReport'][_0x66b5('0x4a')](_0x3ca52a[_0x66b5('0x4b')],{})[_0x66b5('0x28')](respondWithResult(_0x147488,0xc9))[_0x66b5('0x44')](handleError(_0x147488,null));};exports[_0x66b5('0x29')]=function(_0x546bd5,_0x37ba45){return db['VoiceCallReport'][_0x66b5('0x4c')]({'where':{'id':_0x546bd5[_0x66b5('0x46')]['id']}})['then'](handleEntityNotFound(_0x37ba45,null))[_0x66b5('0x28')](removeEntity(_0x37ba45,null))[_0x66b5('0x44')](handleError(_0x37ba45,null));};exports['describe']=function(_0x396434,_0x1291a2){return db[_0x66b5('0x2e')][_0x66b5('0x4d')]()['then'](respondWithResult(_0x1291a2,null))[_0x66b5('0x44')](handleError(_0x1291a2,null));};exports[_0x66b5('0x27')]=function(_0x3972da,_0x9d9653){if(_0x3972da[_0x66b5('0x4b')]['uniqueid']){delete _0x3972da[_0x66b5('0x4b')]['uniqueid'];}return db[_0x66b5('0x2e')]['find']({'where':{'uniqueid':_0x3972da[_0x66b5('0x46')]['id'],'UserId':{'$or':[null,_0x3972da['user']['id']]}}})[_0x66b5('0x28')](handleEntityNotFound(_0x9d9653,null))[_0x66b5('0x28')](saveUpdates(_0x3972da[_0x66b5('0x4b')],null))[_0x66b5('0x28')](respondWithResult(_0x9d9653,null))[_0x66b5('0x44')](handleError(_0x9d9653,null));}; \ No newline at end of file +var _0x2607=['pick','filter','merge','type','VIRTUAL','options','VoiceCallReport','includeAll','include','alias','User','findAll','rows','catch','show','keys','length','find','create','params','describe','update','body','uniqueid','user','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','order','sort','where'];(function(_0x389ca2,_0x29e579){var _0x45de57=function(_0x2f8d83){while(--_0x2f8d83){_0x389ca2['push'](_0x389ca2['shift']());}};_0x45de57(++_0x29e579);}(_0x2607,0x14d));var _0x7260=function(_0x1aeda2,_0x1217eb){_0x1aeda2=_0x1aeda2-0x0;var _0x32dc6d=_0x2607[_0x1aeda2];return _0x32dc6d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x7260('0x0'));var zipdir=require(_0x7260('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7260('0x2'));var BPromise=require(_0x7260('0x3'));var Mustache=require('mustache');var util=require(_0x7260('0x4'));var path=require(_0x7260('0x5'));var sox=require(_0x7260('0x6'));var csv=require(_0x7260('0x7'));var ejs=require(_0x7260('0x8'));var fs=require('fs');var _=require(_0x7260('0x9'));var squel=require(_0x7260('0xa'));var crypto=require(_0x7260('0xb'));var jsforce=require(_0x7260('0xc'));var deskjs=require(_0x7260('0xd'));var toCsv=require(_0x7260('0x7'));var querystring=require(_0x7260('0xe'));var Papa=require('papaparse');var Redis=require(_0x7260('0xf'));var authService=require(_0x7260('0x10'));var qs=require(_0x7260('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7260('0x12'));var utils=require(_0x7260('0x13'));var config=require(_0x7260('0x14'));var db=require(_0x7260('0x15'))['db'];function respondWithStatusCode(_0x5a3567,_0x179a9f){_0x179a9f=_0x179a9f||0xcc;return function(_0x213bdf){if(_0x213bdf){return _0x5a3567['sendStatus'](_0x179a9f);}return _0x5a3567['status'](_0x179a9f)[_0x7260('0x16')]();};}function respondWithResult(_0x48678f,_0x581737){_0x581737=_0x581737||0xc8;return function(_0x40fdcc){if(_0x40fdcc){return _0x48678f[_0x7260('0x17')](_0x581737)['json'](_0x40fdcc);}};}function respondWithFilteredResult(_0x185d83,_0x369680){return function(_0x41ed4b){if(_0x41ed4b){var _0x5fec4c=_0x41ed4b[_0x7260('0x18')],_0x5b6659=_0x369680[_0x7260('0x19')],_0x223945=_0x369680[_0x7260('0x19')]+_0x369680[_0x7260('0x1a')],_0x5b8fff;if(_0x223945>=_0x5fec4c){_0x223945=_0x5fec4c;_0x5b8fff=0xc8;}else{_0x5b8fff=0xce;}_0x185d83[_0x7260('0x17')](_0x5b8fff);return _0x185d83[_0x7260('0x1b')](_0x7260('0x1c'),_0x5b6659+'-'+_0x223945+'/'+_0x5fec4c)[_0x7260('0x1d')](_0x41ed4b);}return null;};}function patchUpdates(_0x2939f9){return function(_0x2e30e7){try{jsonpatch[_0x7260('0x1e')](_0x2e30e7,_0x2939f9,!![]);}catch(_0x7955fa){return BPromise[_0x7260('0x1f')](_0x7955fa);}return _0x2e30e7[_0x7260('0x20')]();};}function saveUpdates(_0x3894e9,_0xf3de22){return function(_0x100a72){if(_0x100a72){return _0x100a72['update'](_0x3894e9)[_0x7260('0x21')](function(_0x2f8ef1){return _0x2f8ef1;});}return null;};}function removeEntity(_0x4d6402,_0x478c25){return function(_0x2ea5f7){if(_0x2ea5f7){return _0x2ea5f7[_0x7260('0x22')]()['then'](function(){_0x4d6402[_0x7260('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4264f3,_0x3142c9){return function(_0x511a15){if(!_0x511a15){_0x4264f3[_0x7260('0x23')](0x194);}return _0x511a15;};}function handleError(_0x115a79,_0x51b83a){_0x51b83a=_0x51b83a||0x1f4;return function(_0x42a8f0){logger[_0x7260('0x24')](_0x42a8f0[_0x7260('0x25')]);if(_0x42a8f0[_0x7260('0x26')]){delete _0x42a8f0[_0x7260('0x26')];}_0x115a79['status'](_0x51b83a)['send'](_0x42a8f0);};}exports['index']=function(_0x330792,_0x910260){var _0x4b47e9={},_0x35ff52={},_0x1fc1f5={'count':0x0,'rows':[]};var _0x2adbdc=_[_0x7260('0x27')](db['VoiceCallReport'][_0x7260('0x28')],function(_0x55bd3a){return{'name':_0x55bd3a[_0x7260('0x29')],'type':_0x55bd3a['type'][_0x7260('0x2a')]};});_0x35ff52[_0x7260('0x2b')]=_[_0x7260('0x27')](_0x2adbdc,_0x7260('0x26'));_0x35ff52[_0x7260('0x2c')]=_['keys'](_0x330792[_0x7260('0x2c')]);_0x35ff52[_0x7260('0x2d')]=_[_0x7260('0x2e')](_0x35ff52['model'],_0x35ff52[_0x7260('0x2c')]);_0x4b47e9[_0x7260('0x2f')]=_[_0x7260('0x2e')](_0x35ff52[_0x7260('0x2b')],qs[_0x7260('0x30')](_0x330792[_0x7260('0x2c')][_0x7260('0x30')]));_0x4b47e9[_0x7260('0x2f')]=_0x4b47e9['attributes']['length']?_0x4b47e9['attributes']:_0x35ff52['model'];if(!_0x330792[_0x7260('0x2c')]['hasOwnProperty']('nolimit')){_0x4b47e9[_0x7260('0x1a')]=qs[_0x7260('0x1a')](_0x330792['query']['limit']);_0x4b47e9[_0x7260('0x19')]=qs['offset'](_0x330792[_0x7260('0x2c')][_0x7260('0x19')]);}_0x4b47e9[_0x7260('0x31')]=qs[_0x7260('0x32')](_0x330792[_0x7260('0x2c')][_0x7260('0x32')]);_0x4b47e9[_0x7260('0x33')]=qs['filters'](_[_0x7260('0x34')](_0x330792[_0x7260('0x2c')],_0x35ff52[_0x7260('0x2d')]),_0x2adbdc);if(_0x330792['query'][_0x7260('0x35')]){_0x4b47e9[_0x7260('0x33')]=_[_0x7260('0x36')](_0x4b47e9[_0x7260('0x33')],{'$or':_[_0x7260('0x27')](_0x2adbdc,function(_0x4fba5d){if(_0x4fba5d[_0x7260('0x37')]!==_0x7260('0x38')){var _0x412359={};_0x412359[_0x4fba5d[_0x7260('0x26')]]={'$like':'%'+_0x330792[_0x7260('0x2c')][_0x7260('0x35')]+'%'};return _0x412359;}})});}_0x4b47e9=_[_0x7260('0x36')]({},_0x4b47e9,_0x330792[_0x7260('0x39')]);var _0x489570={'where':_0x4b47e9[_0x7260('0x33')]};return db[_0x7260('0x3a')][_0x7260('0x18')](_0x489570)[_0x7260('0x21')](function(_0x2a980e){_0x1fc1f5[_0x7260('0x18')]=_0x2a980e;if(_0x330792['query'][_0x7260('0x3b')]){_0x4b47e9[_0x7260('0x3c')]=[{'attributes':['id',_0x7260('0x26'),'fullname',_0x7260('0x3d')],'model':db[_0x7260('0x3e')],'as':_0x7260('0x3e')}];}return db[_0x7260('0x3a')][_0x7260('0x3f')](_0x4b47e9);})[_0x7260('0x21')](function(_0x3bb7c1){_0x1fc1f5[_0x7260('0x40')]=_0x3bb7c1;return _0x1fc1f5;})[_0x7260('0x21')](respondWithFilteredResult(_0x910260,_0x4b47e9))[_0x7260('0x41')](handleError(_0x910260,null));};exports[_0x7260('0x42')]=function(_0x3bafd5,_0x4fd046){var _0x30e30b={'raw':!![],'where':{'id':_0x3bafd5['params']['id']}},_0x5114b5={};_0x5114b5['model']=_[_0x7260('0x43')](db['VoiceCallReport'][_0x7260('0x28')]);_0x5114b5[_0x7260('0x2c')]=_[_0x7260('0x43')](_0x3bafd5[_0x7260('0x2c')]);_0x5114b5['filters']=_[_0x7260('0x2e')](_0x5114b5[_0x7260('0x2b')],_0x5114b5[_0x7260('0x2c')]);_0x30e30b[_0x7260('0x2f')]=_[_0x7260('0x2e')](_0x5114b5[_0x7260('0x2b')],qs[_0x7260('0x30')](_0x3bafd5['query'][_0x7260('0x30')]));_0x30e30b[_0x7260('0x2f')]=_0x30e30b[_0x7260('0x2f')][_0x7260('0x44')]?_0x30e30b['attributes']:_0x5114b5[_0x7260('0x2b')];if(_0x3bafd5[_0x7260('0x2c')]['includeAll']){_0x30e30b['include']=[{'all':!![]}];}_0x30e30b=_[_0x7260('0x36')]({},_0x30e30b,_0x3bafd5[_0x7260('0x39')]);return db['VoiceCallReport'][_0x7260('0x45')](_0x30e30b)[_0x7260('0x21')](handleEntityNotFound(_0x4fd046,null))['then'](respondWithResult(_0x4fd046,null))['catch'](handleError(_0x4fd046,null));};exports[_0x7260('0x46')]=function(_0x4e266b,_0x1fc614){return db[_0x7260('0x3a')]['create'](_0x4e266b['body'],{})[_0x7260('0x21')](respondWithResult(_0x1fc614,0xc9))[_0x7260('0x41')](handleError(_0x1fc614,null));};exports[_0x7260('0x22')]=function(_0x49e233,_0x5d64cf){return db[_0x7260('0x3a')][_0x7260('0x45')]({'where':{'id':_0x49e233[_0x7260('0x47')]['id']}})[_0x7260('0x21')](handleEntityNotFound(_0x5d64cf,null))[_0x7260('0x21')](removeEntity(_0x5d64cf,null))[_0x7260('0x41')](handleError(_0x5d64cf,null));};exports['describe']=function(_0x2525ce,_0xe2c1c8){return db[_0x7260('0x3a')][_0x7260('0x48')]()[_0x7260('0x21')](respondWithResult(_0xe2c1c8,null))[_0x7260('0x41')](handleError(_0xe2c1c8,null));};exports[_0x7260('0x49')]=function(_0x5392e1,_0x3d30d2){if(_0x5392e1[_0x7260('0x4a')]['uniqueid']){delete _0x5392e1[_0x7260('0x4a')][_0x7260('0x4b')];}return db[_0x7260('0x3a')]['find']({'where':{'uniqueid':_0x5392e1['params']['id'],'UserId':{'$or':[null,_0x5392e1[_0x7260('0x4c')]['id']]}}})['then'](handleEntityNotFound(_0x3d30d2,null))['then'](saveUpdates(_0x5392e1[_0x7260('0x4a')],null))[_0x7260('0x21')](respondWithResult(_0x3d30d2,null))[_0x7260('0x41')](handleError(_0x3d30d2,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 0a476db..82a2e8b 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 _0x25ad=['bluebird','request-promise','path','../../config/environment','exports','define','report_call','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x169c00,_0x46c6e8){var _0x40c8da=function(_0x1956f5){while(--_0x1956f5){_0x169c00['push'](_0x169c00['shift']());}};_0x40c8da(++_0x46c6e8);}(_0x25ad,0x1c4));var _0xd25a=function(_0x3c4e4c,_0x36ff70){_0x3c4e4c=_0x3c4e4c-0x0;var _0x144a87=_0x25ad[_0x3c4e4c];return _0x144a87;};'use strict';var _=require(_0xd25a('0x0'));var util=require('util');var logger=require(_0xd25a('0x1'))(_0xd25a('0x2'));var moment=require(_0xd25a('0x3'));var BPromise=require(_0xd25a('0x4'));var rp=require(_0xd25a('0x5'));var fs=require('fs');var path=require(_0xd25a('0x6'));var rimraf=require('rimraf');var config=require(_0xd25a('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0xd25a('0x8')]=function(_0x2c00e5,_0x49fb3e){return _0x2c00e5[_0xd25a('0x9')]('VoiceCallReport',attributes,{'tableName':_0xd25a('0xa'),'paranoid':![],'indexes':[{'fields':[_0xd25a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5768=['request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xc53bf5,_0x3b1228){var _0x196ff3=function(_0x115c77){while(--_0x115c77){_0xc53bf5['push'](_0xc53bf5['shift']());}};_0x196ff3(++_0x3b1228);}(_0x5768,0x162));var _0x8576=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x5768[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0x8576('0x0'));var util=require(_0x8576('0x1'));var logger=require(_0x8576('0x2'))(_0x8576('0x3'));var moment=require(_0x8576('0x4'));var BPromise=require(_0x8576('0x5'));var rp=require(_0x8576('0x6'));var fs=require('fs');var path=require(_0x8576('0x7'));var rimraf=require(_0x8576('0x8'));var config=require(_0x8576('0x9'));var attributes=require(_0x8576('0xa'));module[_0x8576('0xb')]=function(_0x519d1d,_0x14a8cd){return _0x519d1d[_0x8576('0xc')]('VoiceCallReport',attributes,{'tableName':_0x8576('0xd'),'paranoid':![],'indexes':[{'fields':[_0x8576('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index cd4d706..1f6cee4 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 _0xac3d=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','limit','include','model','map','info','create','body','UpdateVoiceCallReport','lodash','util','moment','bluebird'];(function(_0x226f2a,_0xa2ce6a){var _0x3dab1f=function(_0x45b915){while(--_0x45b915){_0x226f2a['push'](_0x226f2a['shift']());}};_0x3dab1f(++_0xa2ce6a);}(_0xac3d,0x182));var _0xdac3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xac3d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdac3('0x0'));var util=require(_0xdac3('0x1'));var moment=require(_0xdac3('0x2'));var BPromise=require(_0xdac3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdac3('0x4'));var db=require(_0xdac3('0x5'))['db'];var utils=require(_0xdac3('0x6'));var logger=require(_0xdac3('0x7'))(_0xdac3('0x8'));var config=require(_0xdac3('0x9'));var jayson=require(_0xdac3('0xa'));var client=jayson[_0xdac3('0xb')][_0xdac3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5641d3,_0x718bb4,_0xa47a55){return new BPromise(function(_0x57c3e4,_0x3786b3){return client[_0xdac3('0xd')](_0x5641d3,_0xa47a55)[_0xdac3('0xe')](function(_0x33860c){logger['info'](_0xdac3('0xf'),_0x718bb4,_0xdac3('0x10'));logger[_0xdac3('0x11')](_0xdac3('0x12'),_0x718bb4,'request\x20sent',JSON[_0xdac3('0x13')](_0x33860c));if(_0x33860c['error']){if(_0x33860c[_0xdac3('0x14')][_0xdac3('0x15')]===0x1f4){logger[_0xdac3('0x14')](_0xdac3('0xf'),_0x718bb4,_0x33860c[_0xdac3('0x14')][_0xdac3('0x16')]);return _0x3786b3(_0x33860c[_0xdac3('0x14')][_0xdac3('0x16')]);}logger[_0xdac3('0x14')](_0xdac3('0xf'),_0x718bb4,_0x33860c[_0xdac3('0x14')]['message']);return _0x57c3e4(_0x33860c[_0xdac3('0x14')][_0xdac3('0x16')]);}else{logger['info'](_0xdac3('0xf'),_0x718bb4,_0xdac3('0x10'));_0x57c3e4(_0x33860c[_0xdac3('0x17')][_0xdac3('0x16')]);}})[_0xdac3('0x18')](function(_0x396711){logger[_0xdac3('0x14')]('VoiceCallReport,\x20%s,\x20%s',_0x718bb4,_0x396711);_0x3786b3(_0x396711);});});}exports[_0xdac3('0x19')]=function(_0x372548){var _0x4b106e=this;return new Promise(function(_0x56131b,_0x208ba9){return db[_0xdac3('0x1a')]['findAll']({'raw':_0x372548[_0xdac3('0x1b')]?_0x372548['options'][_0xdac3('0x1c')]===undefined?!![]:![]:!![],'where':_0x372548[_0xdac3('0x1b')]?_0x372548[_0xdac3('0x1b')][_0xdac3('0x1d')]||null:null,'attributes':_0x372548[_0xdac3('0x1b')]?_0x372548[_0xdac3('0x1b')][_0xdac3('0x1e')]||null:null,'limit':_0x372548[_0xdac3('0x1b')]?_0x372548[_0xdac3('0x1b')][_0xdac3('0x1f')]||null:null,'include':_0x372548[_0xdac3('0x1b')]?_0x372548[_0xdac3('0x1b')]['include']?_['map'](_0x372548[_0xdac3('0x1b')][_0xdac3('0x20')],function(_0xaaf81a){return{'model':db[_0xaaf81a[_0xdac3('0x21')]],'as':_0xaaf81a['as'],'attributes':_0xaaf81a[_0xdac3('0x1e')],'include':_0xaaf81a['include']?_[_0xdac3('0x22')](_0xaaf81a[_0xdac3('0x20')],function(_0x50cac7){return{'model':db[_0x50cac7[_0xdac3('0x21')]],'as':_0x50cac7['as'],'attributes':_0x50cac7[_0xdac3('0x1e')],'include':_0x50cac7['include']?_[_0xdac3('0x22')](_0x50cac7['include'],function(_0x41510f){return{'model':db[_0x41510f[_0xdac3('0x21')]],'as':_0x41510f['as'],'attributes':_0x41510f['attributes']};}):[]};}):[]};}):[]:[]})[_0xdac3('0xe')](function(_0x16da8f){logger[_0xdac3('0x23')](_0xdac3('0x19'),_0x372548);logger['debug'](_0xdac3('0x19'),_0x372548,JSON[_0xdac3('0x13')](_0x16da8f));_0x56131b(_0x16da8f);})[_0xdac3('0x18')](function(_0x208841){logger['error'](_0xdac3('0x19'),_0x208841[_0xdac3('0x16')],_0x372548);_0x208ba9(_0x4b106e[_0xdac3('0x14')](0x1f4,_0x208841[_0xdac3('0x16')]));});});};exports['CreateVoiceCallReport']=function(_0x115e39){var _0x41ce22=this;return new Promise(function(_0x12d3d6,_0x1bb972){return db[_0xdac3('0x1a')][_0xdac3('0x24')](_0x115e39[_0xdac3('0x25')],{'raw':_0x115e39[_0xdac3('0x1b')]?_0x115e39['options'][_0xdac3('0x1c')]===undefined?!![]:![]:!![]})[_0xdac3('0xe')](function(_0x477e4e){logger[_0xdac3('0x23')]('CreateVoiceCallReport',_0x115e39);logger['debug']('CreateVoiceCallReport',_0x115e39,JSON[_0xdac3('0x13')](_0x477e4e));_0x12d3d6(_0x477e4e);})[_0xdac3('0x18')](function(_0x1f5d3f){logger[_0xdac3('0x14')]('CreateVoiceCallReport',_0x1f5d3f['message'],_0x115e39);_0x1bb972(_0x41ce22[_0xdac3('0x14')](0x1f4,_0x1f5d3f['message']));});});};exports[_0xdac3('0x26')]=function(_0x24fd18){var _0x33c71e=this;return new Promise(function(_0x1bb142,_0x567be7){return db['VoiceCallReport']['update'](_0x24fd18[_0xdac3('0x25')],{'raw':_0x24fd18['options']?_0x24fd18['options'][_0xdac3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24fd18[_0xdac3('0x1b')]?_0x24fd18[_0xdac3('0x1b')][_0xdac3('0x1d')]||null:null,'attributes':_0x24fd18[_0xdac3('0x1b')]?_0x24fd18['options'][_0xdac3('0x1e')]||null:null,'limit':_0x24fd18[_0xdac3('0x1b')]?_0x24fd18[_0xdac3('0x1b')][_0xdac3('0x1f')]||null:null})['then'](function(_0x839621){logger[_0xdac3('0x23')](_0xdac3('0x26'),_0x24fd18);logger[_0xdac3('0x11')]('UpdateVoiceCallReport',_0x24fd18,JSON[_0xdac3('0x13')](_0x839621));_0x1bb142(_0x839621);})[_0xdac3('0x18')](function(_0x27c810){logger[_0xdac3('0x14')](_0xdac3('0x26'),_0x27c810[_0xdac3('0x16')],_0x24fd18);_0x567be7(_0x33c71e['error'](0x1f4,_0x27c810[_0xdac3('0x16')]));});});}; \ No newline at end of file +var _0xa929=['map','attributes','then','create','CreateVoiceCallReport','body','where','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','limit','include','model'];(function(_0x5b67db,_0x33c4f0){var _0x16b751=function(_0x416fcf){while(--_0x416fcf){_0x5b67db['push'](_0x5b67db['shift']());}};_0x16b751(++_0x33c4f0);}(_0xa929,0x1c0));var _0x9a92=function(_0x4b9bd0,_0x23b665){_0x4b9bd0=_0x4b9bd0-0x0;var _0x59d49f=_0xa929[_0x4b9bd0];return _0x59d49f;};'use strict';var _=require(_0x9a92('0x0'));var util=require(_0x9a92('0x1'));var moment=require(_0x9a92('0x2'));var BPromise=require(_0x9a92('0x3'));var rs=require(_0x9a92('0x4'));var fs=require('fs');var Redis=require(_0x9a92('0x5'));var db=require(_0x9a92('0x6'))['db'];var utils=require(_0x9a92('0x7'));var logger=require(_0x9a92('0x8'))(_0x9a92('0x9'));var config=require(_0x9a92('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9a92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffaa,_0x26656b,_0x59f68f){return new BPromise(function(_0x1a12db,_0x509e86){return client[_0x9a92('0xc')](_0x47ffaa,_0x59f68f)['then'](function(_0x326ae2){logger[_0x9a92('0xd')](_0x9a92('0xe'),_0x26656b,_0x9a92('0xf'));logger[_0x9a92('0x10')](_0x9a92('0x11'),_0x26656b,_0x9a92('0xf'),JSON[_0x9a92('0x12')](_0x326ae2));if(_0x326ae2['error']){if(_0x326ae2[_0x9a92('0x13')][_0x9a92('0x14')]===0x1f4){logger[_0x9a92('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x26656b,_0x326ae2[_0x9a92('0x13')][_0x9a92('0x15')]);return _0x509e86(_0x326ae2['error'][_0x9a92('0x15')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x26656b,_0x326ae2[_0x9a92('0x13')][_0x9a92('0x15')]);return _0x1a12db(_0x326ae2[_0x9a92('0x13')][_0x9a92('0x15')]);}else{logger[_0x9a92('0xd')](_0x9a92('0xe'),_0x26656b,'request\x20sent');_0x1a12db(_0x326ae2[_0x9a92('0x16')][_0x9a92('0x15')]);}})[_0x9a92('0x17')](function(_0x35d9fc){logger[_0x9a92('0x13')](_0x9a92('0xe'),_0x26656b,_0x35d9fc);_0x509e86(_0x35d9fc);});});}exports[_0x9a92('0x18')]=function(_0x323bf9){var _0x3c4fc0=this;return new Promise(function(_0x59f375,_0x487a07){return db[_0x9a92('0x19')][_0x9a92('0x1a')]({'raw':_0x323bf9[_0x9a92('0x1b')]?_0x323bf9[_0x9a92('0x1b')][_0x9a92('0x1c')]===undefined?!![]:![]:!![],'where':_0x323bf9[_0x9a92('0x1b')]?_0x323bf9[_0x9a92('0x1b')]['where']||null:null,'attributes':_0x323bf9[_0x9a92('0x1b')]?_0x323bf9[_0x9a92('0x1b')]['attributes']||null:null,'limit':_0x323bf9[_0x9a92('0x1b')]?_0x323bf9[_0x9a92('0x1b')][_0x9a92('0x1d')]||null:null,'include':_0x323bf9[_0x9a92('0x1b')]?_0x323bf9[_0x9a92('0x1b')][_0x9a92('0x1e')]?_['map'](_0x323bf9[_0x9a92('0x1b')][_0x9a92('0x1e')],function(_0x4af079){return{'model':db[_0x4af079[_0x9a92('0x1f')]],'as':_0x4af079['as'],'attributes':_0x4af079['attributes'],'include':_0x4af079[_0x9a92('0x1e')]?_[_0x9a92('0x20')](_0x4af079['include'],function(_0x4c44e2){return{'model':db[_0x4c44e2[_0x9a92('0x1f')]],'as':_0x4c44e2['as'],'attributes':_0x4c44e2[_0x9a92('0x21')],'include':_0x4c44e2['include']?_[_0x9a92('0x20')](_0x4c44e2['include'],function(_0x260d68){return{'model':db[_0x260d68[_0x9a92('0x1f')]],'as':_0x260d68['as'],'attributes':_0x260d68[_0x9a92('0x21')]};}):[]};}):[]};}):[]:[]})[_0x9a92('0x22')](function(_0x63e91f){logger[_0x9a92('0xd')](_0x9a92('0x18'),_0x323bf9);logger['debug'](_0x9a92('0x18'),_0x323bf9,JSON[_0x9a92('0x12')](_0x63e91f));_0x59f375(_0x63e91f);})[_0x9a92('0x17')](function(_0x3a197f){logger[_0x9a92('0x13')](_0x9a92('0x18'),_0x3a197f[_0x9a92('0x15')],_0x323bf9);_0x487a07(_0x3c4fc0[_0x9a92('0x13')](0x1f4,_0x3a197f[_0x9a92('0x15')]));});});};exports['CreateVoiceCallReport']=function(_0xd5959d){var _0x15df2b=this;return new Promise(function(_0x3cfeb1,_0x9727b3){return db[_0x9a92('0x19')][_0x9a92('0x23')](_0xd5959d['body'],{'raw':_0xd5959d['options']?_0xd5959d['options'][_0x9a92('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x53224c){logger[_0x9a92('0xd')](_0x9a92('0x24'),_0xd5959d);logger['debug'](_0x9a92('0x24'),_0xd5959d,JSON[_0x9a92('0x12')](_0x53224c));_0x3cfeb1(_0x53224c);})['catch'](function(_0x1bedc2){logger['error'](_0x9a92('0x24'),_0x1bedc2[_0x9a92('0x15')],_0xd5959d);_0x9727b3(_0x15df2b[_0x9a92('0x13')](0x1f4,_0x1bedc2[_0x9a92('0x15')]));});});};exports['UpdateVoiceCallReport']=function(_0x3fce73){var _0x41cc48=this;return new Promise(function(_0x4a3be7,_0xa2607a){return db[_0x9a92('0x19')]['update'](_0x3fce73[_0x9a92('0x25')],{'raw':_0x3fce73[_0x9a92('0x1b')]?_0x3fce73['options'][_0x9a92('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fce73['options']?_0x3fce73[_0x9a92('0x1b')][_0x9a92('0x26')]||null:null,'attributes':_0x3fce73[_0x9a92('0x1b')]?_0x3fce73[_0x9a92('0x1b')]['attributes']||null:null,'limit':_0x3fce73['options']?_0x3fce73[_0x9a92('0x1b')][_0x9a92('0x1d')]||null:null})[_0x9a92('0x22')](function(_0x21db2a){logger[_0x9a92('0xd')]('UpdateVoiceCallReport',_0x3fce73);logger[_0x9a92('0x10')](_0x9a92('0x27'),_0x3fce73,JSON[_0x9a92('0x12')](_0x21db2a));_0x4a3be7(_0x21db2a);})[_0x9a92('0x17')](function(_0x2c1d75){logger[_0x9a92('0x13')](_0x9a92('0x27'),_0x2c1d75[_0x9a92('0x15')],_0x3fce73);_0xa2607a(_0x41cc48[_0x9a92('0x13')](0x1f4,_0x2c1d75[_0x9a92('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index fcfd6b7..c3f5ee5 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 _0x9375=['../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','path','connect-timeout','express','Router'];(function(_0x5580ef,_0x4a7e8b){var _0x24068e=function(_0x10dbe9){while(--_0x10dbe9){_0x5580ef['push'](_0x5580ef['shift']());}};_0x24068e(++_0x4a7e8b);}(_0x9375,0xf8));var _0x5937=function(_0x522807,_0x5aebfb){_0x522807=_0x522807-0x0;var _0x40f64e=_0x9375[_0x522807];return _0x40f64e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5937('0x0'));var timeout=require(_0x5937('0x1'));var express=require(_0x5937('0x2'));var router=express[_0x5937('0x3')]();var auth=require(_0x5937('0x4'));var interaction=require(_0x5937('0x5'));var config=require('../../config/environment');var controller=require(_0x5937('0x6'));router[_0x5937('0x7')]('/',auth[_0x5937('0x8')](),controller[_0x5937('0x9')]);router['get'](_0x5937('0xa'),auth[_0x5937('0x8')](),controller[_0x5937('0xb')]);router[_0x5937('0xc')]('/',auth[_0x5937('0x8')](),controller['create']);router[_0x5937('0xd')]('/:id',auth[_0x5937('0x8')](),controller[_0x5937('0xe')]);router[_0x5937('0xf')]('/:id',auth[_0x5937('0x8')](),controller[_0x5937('0x10')]);module[_0x5937('0x11')]=router; \ No newline at end of file +var _0xb698=['create','put','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','post'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xb698,0x16a));var _0x8b69=function(_0x58baa2,_0x4501e9){_0x58baa2=_0x58baa2-0x0;var _0x3e3680=_0xb698[_0x58baa2];return _0x3e3680;};'use strict';var multer=require('multer');var util=require(_0x8b69('0x0'));var path=require(_0x8b69('0x1'));var timeout=require(_0x8b69('0x2'));var express=require(_0x8b69('0x3'));var router=express['Router']();var auth=require(_0x8b69('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8b69('0x5'));var controller=require('./voiceChanSpy.controller');router[_0x8b69('0x6')]('/',auth['isAuthenticated'](),controller[_0x8b69('0x7')]);router['get'](_0x8b69('0x8'),auth[_0x8b69('0x9')](),controller[_0x8b69('0xa')]);router[_0x8b69('0xb')]('/',auth[_0x8b69('0x9')](),controller[_0x8b69('0xc')]);router[_0x8b69('0xd')]('/:id',auth[_0x8b69('0x9')](),controller['update']);router[_0x8b69('0xe')](_0x8b69('0x8'),auth[_0x8b69('0x9')](),controller[_0x8b69('0xf')]);module[_0x8b69('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 331cfc7..9e3d87a 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 _0xebc6=['STRING','name','setDataValue','getDataValue','options','split','BOOLEAN','sequelize'];(function(_0x137da3,_0xa6277a){var _0x1ac46c=function(_0x49e68b){while(--_0x49e68b){_0x137da3['push'](_0x137da3['shift']());}};_0x1ac46c(++_0xa6277a);}(_0xebc6,0xaf));var _0x6ebc=function(_0x487289,_0xced20b){_0x487289=_0x487289-0x0;var _0x2d6d1a=_0xebc6[_0x487289];return _0x2d6d1a;};'use strict';var Sequelize=require(_0x6ebc('0x0'));module['exports']={'name':{'type':Sequelize[_0x6ebc('0x1')]},'prefix':{'type':Sequelize[_0x6ebc('0x1')],'unique':_0x6ebc('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x6ebc('0x1')],'set':function(_0x4ca359){this[_0x6ebc('0x3')]('options',_0x4ca359?_0x4ca359['join'](''):[]);},'get':function(){return this[_0x6ebc('0x4')](_0x6ebc('0x5'))?this[_0x6ebc('0x4')](_0x6ebc('0x5'))[_0x6ebc('0x6')](''):[];}},'auth':{'type':Sequelize[_0x6ebc('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x6ebc('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6ebc('0x1')]}}; \ No newline at end of file +var _0x3240=['options','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue'];(function(_0x5bc6f0,_0x2296b0){var _0x34b12b=function(_0x3f4576){while(--_0x3f4576){_0x5bc6f0['push'](_0x5bc6f0['shift']());}};_0x34b12b(++_0x2296b0);}(_0x3240,0x1a2));var _0x0324=function(_0x2a3147,_0x480a7f){_0x2a3147=_0x2a3147-0x0;var _0x2c35c2=_0x3240[_0x2a3147];return _0x2c35c2;};'use strict';var Sequelize=require(_0x0324('0x0'));module[_0x0324('0x1')]={'name':{'type':Sequelize[_0x0324('0x2')]},'prefix':{'type':Sequelize[_0x0324('0x2')],'unique':_0x0324('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x56d06a){this[_0x0324('0x4')](_0x0324('0x5'),_0x56d06a?_0x56d06a['join'](''):[]);},'get':function(){return this[_0x0324('0x6')]('options')?this[_0x0324('0x6')](_0x0324('0x5'))[_0x0324('0x7')](''):[];}},'auth':{'type':Sequelize[_0x0324('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x0324('0x2')]},'record':{'type':Sequelize[_0x0324('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x0324('0x2')]},'description':{'type':Sequelize[_0x0324('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 48c1669..5f6af31 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 _0x4348=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','then','get','UserProfileResource','destroy','error','stack','name','index','map','VoiceChanSpy','rawAttributes','fieldName','type','query','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x4049bb,_0x1b6a61){var _0x44c6ff=function(_0x3ec0b7){while(--_0x3ec0b7){_0x4049bb['push'](_0x4049bb['shift']());}};_0x44c6ff(++_0x1b6a61);}(_0x4348,0xe5));var _0x8434=function(_0x9fdfa4,_0x13853d){_0x9fdfa4=_0x9fdfa4-0x0;var _0x21d02a=_0x4348[_0x9fdfa4];return _0x21d02a;};'use strict';var pdf=require(_0x8434('0x0'));var emlformat=require(_0x8434('0x1'));var rimraf=require(_0x8434('0x2'));var zipdir=require(_0x8434('0x3'));var jsonpatch=require(_0x8434('0x4'));var rp=require('request-promise');var moment=require(_0x8434('0x5'));var BPromise=require(_0x8434('0x6'));var Mustache=require(_0x8434('0x7'));var util=require(_0x8434('0x8'));var path=require('path');var sox=require(_0x8434('0x9'));var csv=require(_0x8434('0xa'));var ejs=require(_0x8434('0xb'));var fs=require('fs');var _=require(_0x8434('0xc'));var squel=require(_0x8434('0xd'));var crypto=require(_0x8434('0xe'));var jsforce=require(_0x8434('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8434('0xa'));var querystring=require(_0x8434('0x10'));var Papa=require(_0x8434('0x11'));var Redis=require('ioredis');var authService=require(_0x8434('0x12'));var qs=require(_0x8434('0x13'));var as=require(_0x8434('0x14'));var hardwareService=require(_0x8434('0x15'));var logger=require('../../config/logger')(_0x8434('0x16'));var utils=require('../../config/utils');var config=require(_0x8434('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x402a6a,_0x1ac25f){_0x1ac25f=_0x1ac25f||0xcc;return function(_0x150d09){if(_0x150d09){return _0x402a6a[_0x8434('0x18')](_0x1ac25f);}return _0x402a6a['status'](_0x1ac25f)[_0x8434('0x19')]();};}function respondWithResult(_0x5686f5,_0x29f614){_0x29f614=_0x29f614||0xc8;return function(_0x13da83){if(_0x13da83){return _0x5686f5[_0x8434('0x1a')](_0x29f614)[_0x8434('0x1b')](_0x13da83);}};}function respondWithFilteredResult(_0x1662f1,_0x13c16c){return function(_0x128ba2){if(_0x128ba2){var _0x1c150c=_0x128ba2[_0x8434('0x1c')],_0x37d767=_0x13c16c[_0x8434('0x1d')],_0x570e0d=_0x13c16c[_0x8434('0x1d')]+_0x13c16c[_0x8434('0x1e')],_0x5d66cd;if(_0x570e0d>=_0x1c150c){_0x570e0d=_0x1c150c;_0x5d66cd=0xc8;}else{_0x5d66cd=0xce;}_0x1662f1['status'](_0x5d66cd);return _0x1662f1[_0x8434('0x1f')](_0x8434('0x20'),_0x37d767+'-'+_0x570e0d+'/'+_0x1c150c)['json'](_0x128ba2);}return null;};}function patchUpdates(_0x285471){return function(_0x40760b){try{jsonpatch[_0x8434('0x21')](_0x40760b,_0x285471,!![]);}catch(_0xd58310){return BPromise[_0x8434('0x22')](_0xd58310);}return _0x40760b['save']();};}function saveUpdates(_0x148f5,_0x24885c){return function(_0x43ab73){if(_0x43ab73){return _0x43ab73['update'](_0x148f5)[_0x8434('0x23')](function(_0x34b38c){return _0x34b38c;});}return null;};}function removeEntity(_0x4d758c,_0x4261d4){return function(_0x34fe58){if(_0x34fe58){return _0x34fe58['destroy']()[_0x8434('0x23')](function(){var _0x5e5bee=_0x34fe58[_0x8434('0x24')]({'plain':!![]});var _0xab87e9='ChanSpies';return db[_0x8434('0x25')][_0x8434('0x26')]({'where':{'type':_0xab87e9,'resourceId':_0x5e5bee['id']}})[_0x8434('0x23')](function(){return _0x34fe58;});})[_0x8434('0x23')](function(){_0x4d758c[_0x8434('0x1a')](0xcc)[_0x8434('0x19')]();});}};}function handleEntityNotFound(_0x22bb5a,_0x5aa530){return function(_0x5bf69e){if(!_0x5bf69e){_0x22bb5a[_0x8434('0x18')](0x194);}return _0x5bf69e;};}function handleError(_0x151694,_0x5eb693){_0x5eb693=_0x5eb693||0x1f4;return function(_0x44c8a4){logger[_0x8434('0x27')](_0x44c8a4[_0x8434('0x28')]);if(_0x44c8a4[_0x8434('0x29')]){delete _0x44c8a4[_0x8434('0x29')];}_0x151694[_0x8434('0x1a')](_0x5eb693)['send'](_0x44c8a4);};}exports[_0x8434('0x2a')]=function(_0x9eb687,_0x10f6c3){var _0x3803ee={},_0x4ad3ca={},_0x2d385f={'count':0x0,'rows':[]};var _0x3f5f1a=_[_0x8434('0x2b')](db[_0x8434('0x2c')][_0x8434('0x2d')],function(_0xcb6f99){return{'name':_0xcb6f99[_0x8434('0x2e')],'type':_0xcb6f99[_0x8434('0x2f')]['key']};});_0x4ad3ca['model']=_[_0x8434('0x2b')](_0x3f5f1a,_0x8434('0x29'));_0x4ad3ca[_0x8434('0x30')]=_['keys'](_0x9eb687['query']);_0x4ad3ca['filters']=_['intersection'](_0x4ad3ca['model'],_0x4ad3ca[_0x8434('0x30')]);_0x3803ee[_0x8434('0x31')]=_[_0x8434('0x32')](_0x4ad3ca[_0x8434('0x33')],qs[_0x8434('0x34')](_0x9eb687[_0x8434('0x30')][_0x8434('0x34')]));_0x3803ee['attributes']=_0x3803ee[_0x8434('0x31')][_0x8434('0x35')]?_0x3803ee[_0x8434('0x31')]:_0x4ad3ca[_0x8434('0x33')];if(!_0x9eb687[_0x8434('0x30')][_0x8434('0x36')](_0x8434('0x37'))){_0x3803ee['limit']=qs[_0x8434('0x1e')](_0x9eb687[_0x8434('0x30')][_0x8434('0x1e')]);_0x3803ee[_0x8434('0x1d')]=qs[_0x8434('0x1d')](_0x9eb687['query'][_0x8434('0x1d')]);}_0x3803ee['order']=qs[_0x8434('0x38')](_0x9eb687[_0x8434('0x30')][_0x8434('0x38')]);_0x3803ee[_0x8434('0x39')]=qs[_0x8434('0x3a')](_[_0x8434('0x3b')](_0x9eb687['query'],_0x4ad3ca[_0x8434('0x3a')]),_0x3f5f1a);if(_0x9eb687[_0x8434('0x30')][_0x8434('0x3c')]){_0x3803ee[_0x8434('0x39')]=_[_0x8434('0x3d')](_0x3803ee[_0x8434('0x39')],{'$or':_[_0x8434('0x2b')](_0x3f5f1a,function(_0x2bdeed){if(_0x2bdeed[_0x8434('0x2f')]!==_0x8434('0x3e')){var _0x91bc7e={};_0x91bc7e[_0x2bdeed['name']]={'$like':'%'+_0x9eb687[_0x8434('0x30')][_0x8434('0x3c')]+'%'};return _0x91bc7e;}})});}_0x3803ee=_[_0x8434('0x3d')]({},_0x3803ee,_0x9eb687[_0x8434('0x3f')]);var _0xdf20a2={'where':_0x3803ee[_0x8434('0x39')]};return db['VoiceChanSpy'][_0x8434('0x1c')](_0xdf20a2)[_0x8434('0x23')](function(_0x2fab90){_0x2d385f[_0x8434('0x1c')]=_0x2fab90;if(_0x9eb687[_0x8434('0x30')][_0x8434('0x40')]){_0x3803ee[_0x8434('0x41')]=[{'all':!![]}];}return db[_0x8434('0x2c')][_0x8434('0x42')](_0x3803ee);})['then'](function(_0x589c9d){_0x2d385f[_0x8434('0x43')]=_0x589c9d;return _0x2d385f;})[_0x8434('0x23')](respondWithFilteredResult(_0x10f6c3,_0x3803ee))[_0x8434('0x44')](handleError(_0x10f6c3,null));};exports[_0x8434('0x45')]=function(_0x9c82d0,_0x2fab6e){var _0x1294d6={'raw':![],'where':{'id':_0x9c82d0['params']['id']}},_0x2c2fb9={};_0x2c2fb9[_0x8434('0x33')]=_[_0x8434('0x46')](db[_0x8434('0x2c')]['rawAttributes']);_0x2c2fb9['query']=_[_0x8434('0x46')](_0x9c82d0[_0x8434('0x30')]);_0x2c2fb9['filters']=_[_0x8434('0x32')](_0x2c2fb9[_0x8434('0x33')],_0x2c2fb9[_0x8434('0x30')]);_0x1294d6[_0x8434('0x31')]=_[_0x8434('0x32')](_0x2c2fb9[_0x8434('0x33')],qs['fields'](_0x9c82d0[_0x8434('0x30')][_0x8434('0x34')]));_0x1294d6[_0x8434('0x31')]=_0x1294d6['attributes']['length']?_0x1294d6[_0x8434('0x31')]:_0x2c2fb9[_0x8434('0x33')];if(_0x9c82d0[_0x8434('0x30')][_0x8434('0x40')]){_0x1294d6[_0x8434('0x41')]=[{'all':!![]}];}_0x1294d6=_[_0x8434('0x3d')]({},_0x1294d6,_0x9c82d0['options']);return db['VoiceChanSpy'][_0x8434('0x47')](_0x1294d6)[_0x8434('0x23')](handleEntityNotFound(_0x2fab6e,null))[_0x8434('0x23')](respondWithResult(_0x2fab6e,null))['catch'](handleError(_0x2fab6e,null));};exports['create']=function(_0x4714cf,_0x65099b){return db[_0x8434('0x2c')][_0x8434('0x48')](_0x4714cf[_0x8434('0x49')],{})['then'](function(_0x4c9ec9){var _0x2f9ab3=_0x4714cf[_0x8434('0x4a')][_0x8434('0x24')]({'plain':!![]});if(!_0x2f9ab3)throw new Error(_0x8434('0x4b'));if(_0x2f9ab3[_0x8434('0x4c')]===_0x8434('0x4a')){var _0x226321=_0x4c9ec9[_0x8434('0x24')]({'plain':!![]});var _0x408471=_0x8434('0x4d');return db[_0x8434('0x4e')][_0x8434('0x47')]({'where':{'name':_0x408471,'userProfileId':_0x2f9ab3['userProfileId']},'raw':!![]})[_0x8434('0x23')](function(_0x9dd4e3){if(_0x9dd4e3&&_0x9dd4e3[_0x8434('0x4f')]===0x0){return db[_0x8434('0x25')][_0x8434('0x48')]({'name':_0x226321[_0x8434('0x29')],'resourceId':_0x226321['id'],'type':_0x9dd4e3[_0x8434('0x29')],'sectionId':_0x9dd4e3['id']},{})['then'](function(){return _0x4c9ec9;});}else{return _0x4c9ec9;}})[_0x8434('0x44')](function(_0x33edaf){logger[_0x8434('0x27')](_0x8434('0x50'),_0x33edaf);throw _0x33edaf;});}return _0x4c9ec9;})[_0x8434('0x23')](respondWithResult(_0x65099b,0xc9))[_0x8434('0x44')](handleError(_0x65099b,null));};exports[_0x8434('0x51')]=function(_0x44b924,_0x16da14){if(_0x44b924[_0x8434('0x49')]['id']){delete _0x44b924[_0x8434('0x49')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x44b924[_0x8434('0x52')]['id']}})[_0x8434('0x23')](handleEntityNotFound(_0x16da14,null))[_0x8434('0x23')](saveUpdates(_0x44b924[_0x8434('0x49')],null))[_0x8434('0x23')](respondWithResult(_0x16da14,null))[_0x8434('0x44')](handleError(_0x16da14,null));};exports[_0x8434('0x26')]=function(_0x300531,_0x12a953){return db[_0x8434('0x2c')][_0x8434('0x47')]({'where':{'id':_0x300531['params']['id']}})[_0x8434('0x23')](handleEntityNotFound(_0x12a953,null))['then'](removeEntity(_0x12a953,null))[_0x8434('0x44')](handleError(_0x12a953,null));}; \ No newline at end of file +var _0xdedc=['VIRTUAL','options','VoiceChanSpy','includeAll','include','findAll','rows','show','keys','length','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','reject','save','update','then','destroy','ChanSpies','UserProfileResource','end','error','name','send','map','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','nolimit','order','sort','where','filter','merge'];(function(_0x2b5448,_0xe31456){var _0xee510e=function(_0x48a4fa){while(--_0x48a4fa){_0x2b5448['push'](_0x2b5448['shift']());}};_0xee510e(++_0xe31456);}(_0xdedc,0x1ab));var _0xcded=function(_0x65e3dc,_0x10fd05){_0x65e3dc=_0x65e3dc-0x0;var _0x5d475b=_0xdedc[_0x65e3dc];return _0x5d475b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcded('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcded('0x1'));var jsonpatch=require(_0xcded('0x2'));var rp=require(_0xcded('0x3'));var moment=require(_0xcded('0x4'));var BPromise=require(_0xcded('0x5'));var Mustache=require(_0xcded('0x6'));var util=require(_0xcded('0x7'));var path=require(_0xcded('0x8'));var sox=require(_0xcded('0x9'));var csv=require(_0xcded('0xa'));var ejs=require(_0xcded('0xb'));var fs=require('fs');var _=require(_0xcded('0xc'));var squel=require(_0xcded('0xd'));var crypto=require('crypto');var jsforce=require(_0xcded('0xe'));var deskjs=require(_0xcded('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcded('0x10'));var Papa=require(_0xcded('0x11'));var Redis=require(_0xcded('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xcded('0x13'));var as=require(_0xcded('0x14'));var hardwareService=require(_0xcded('0x15'));var logger=require(_0xcded('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xcded('0x17'));var db=require(_0xcded('0x18'))['db'];function respondWithStatusCode(_0x5c3f60,_0x5ea607){_0x5ea607=_0x5ea607||0xcc;return function(_0xe52a1a){if(_0xe52a1a){return _0x5c3f60[_0xcded('0x19')](_0x5ea607);}return _0x5c3f60[_0xcded('0x1a')](_0x5ea607)['end']();};}function respondWithResult(_0x3924f5,_0x1d4bb1){_0x1d4bb1=_0x1d4bb1||0xc8;return function(_0x5bfece){if(_0x5bfece){return _0x3924f5[_0xcded('0x1a')](_0x1d4bb1)[_0xcded('0x1b')](_0x5bfece);}};}function respondWithFilteredResult(_0x597519,_0x2530e8){return function(_0x4b05c2){if(_0x4b05c2){var _0x547a7a=_0x4b05c2[_0xcded('0x1c')],_0x15a036=_0x2530e8[_0xcded('0x1d')],_0x15172b=_0x2530e8[_0xcded('0x1d')]+_0x2530e8[_0xcded('0x1e')],_0x51cb67;if(_0x15172b>=_0x547a7a){_0x15172b=_0x547a7a;_0x51cb67=0xc8;}else{_0x51cb67=0xce;}_0x597519['status'](_0x51cb67);return _0x597519[_0xcded('0x1f')]('Content-Range',_0x15a036+'-'+_0x15172b+'/'+_0x547a7a)[_0xcded('0x1b')](_0x4b05c2);}return null;};}function patchUpdates(_0x573385){return function(_0x32a54f){try{jsonpatch['apply'](_0x32a54f,_0x573385,!![]);}catch(_0x3936fc){return BPromise[_0xcded('0x20')](_0x3936fc);}return _0x32a54f[_0xcded('0x21')]();};}function saveUpdates(_0x16b94f,_0x6461d0){return function(_0x2cd805){if(_0x2cd805){return _0x2cd805[_0xcded('0x22')](_0x16b94f)[_0xcded('0x23')](function(_0x5e0340){return _0x5e0340;});}return null;};}function removeEntity(_0x280be3,_0x19cd81){return function(_0x59d9d9){if(_0x59d9d9){return _0x59d9d9[_0xcded('0x24')]()[_0xcded('0x23')](function(){var _0x3b50fc=_0x59d9d9['get']({'plain':!![]});var _0x45e246=_0xcded('0x25');return db[_0xcded('0x26')][_0xcded('0x24')]({'where':{'type':_0x45e246,'resourceId':_0x3b50fc['id']}})[_0xcded('0x23')](function(){return _0x59d9d9;});})['then'](function(){_0x280be3[_0xcded('0x1a')](0xcc)[_0xcded('0x27')]();});}};}function handleEntityNotFound(_0x3963a0,_0x391472){return function(_0x400c18){if(!_0x400c18){_0x3963a0[_0xcded('0x19')](0x194);}return _0x400c18;};}function handleError(_0x52c50e,_0x50924d){_0x50924d=_0x50924d||0x1f4;return function(_0x458c75){logger[_0xcded('0x28')](_0x458c75['stack']);if(_0x458c75[_0xcded('0x29')]){delete _0x458c75[_0xcded('0x29')];}_0x52c50e['status'](_0x50924d)[_0xcded('0x2a')](_0x458c75);};}exports['index']=function(_0x3c172a,_0xa8897d){var _0x8a0a83={},_0x76d37d={},_0x425c0e={'count':0x0,'rows':[]};var _0x2be8a3=_[_0xcded('0x2b')](db['VoiceChanSpy'][_0xcded('0x2c')],function(_0x558ae5){return{'name':_0x558ae5['fieldName'],'type':_0x558ae5[_0xcded('0x2d')][_0xcded('0x2e')]};});_0x76d37d['model']=_[_0xcded('0x2b')](_0x2be8a3,'name');_0x76d37d[_0xcded('0x2f')]=_['keys'](_0x3c172a[_0xcded('0x2f')]);_0x76d37d[_0xcded('0x30')]=_['intersection'](_0x76d37d[_0xcded('0x31')],_0x76d37d['query']);_0x8a0a83[_0xcded('0x32')]=_[_0xcded('0x33')](_0x76d37d[_0xcded('0x31')],qs['fields'](_0x3c172a['query'][_0xcded('0x34')]));_0x8a0a83['attributes']=_0x8a0a83[_0xcded('0x32')]['length']?_0x8a0a83[_0xcded('0x32')]:_0x76d37d[_0xcded('0x31')];if(!_0x3c172a[_0xcded('0x2f')]['hasOwnProperty'](_0xcded('0x35'))){_0x8a0a83['limit']=qs[_0xcded('0x1e')](_0x3c172a[_0xcded('0x2f')][_0xcded('0x1e')]);_0x8a0a83[_0xcded('0x1d')]=qs[_0xcded('0x1d')](_0x3c172a[_0xcded('0x2f')]['offset']);}_0x8a0a83[_0xcded('0x36')]=qs[_0xcded('0x37')](_0x3c172a[_0xcded('0x2f')][_0xcded('0x37')]);_0x8a0a83[_0xcded('0x38')]=qs['filters'](_['pick'](_0x3c172a[_0xcded('0x2f')],_0x76d37d[_0xcded('0x30')]),_0x2be8a3);if(_0x3c172a[_0xcded('0x2f')][_0xcded('0x39')]){_0x8a0a83['where']=_[_0xcded('0x3a')](_0x8a0a83[_0xcded('0x38')],{'$or':_[_0xcded('0x2b')](_0x2be8a3,function(_0x58ce9b){if(_0x58ce9b[_0xcded('0x2d')]!==_0xcded('0x3b')){var _0x6c20c0={};_0x6c20c0[_0x58ce9b[_0xcded('0x29')]]={'$like':'%'+_0x3c172a[_0xcded('0x2f')][_0xcded('0x39')]+'%'};return _0x6c20c0;}})});}_0x8a0a83=_[_0xcded('0x3a')]({},_0x8a0a83,_0x3c172a[_0xcded('0x3c')]);var _0x648284={'where':_0x8a0a83['where']};return db[_0xcded('0x3d')][_0xcded('0x1c')](_0x648284)[_0xcded('0x23')](function(_0xbfe2b6){_0x425c0e[_0xcded('0x1c')]=_0xbfe2b6;if(_0x3c172a[_0xcded('0x2f')][_0xcded('0x3e')]){_0x8a0a83[_0xcded('0x3f')]=[{'all':!![]}];}return db[_0xcded('0x3d')][_0xcded('0x40')](_0x8a0a83);})[_0xcded('0x23')](function(_0x47afe3){_0x425c0e[_0xcded('0x41')]=_0x47afe3;return _0x425c0e;})[_0xcded('0x23')](respondWithFilteredResult(_0xa8897d,_0x8a0a83))['catch'](handleError(_0xa8897d,null));};exports[_0xcded('0x42')]=function(_0x179878,_0x69470a){var _0x107133={'raw':![],'where':{'id':_0x179878['params']['id']}},_0x5c88a0={};_0x5c88a0[_0xcded('0x31')]=_[_0xcded('0x43')](db[_0xcded('0x3d')][_0xcded('0x2c')]);_0x5c88a0[_0xcded('0x2f')]=_[_0xcded('0x43')](_0x179878['query']);_0x5c88a0[_0xcded('0x30')]=_['intersection'](_0x5c88a0['model'],_0x5c88a0[_0xcded('0x2f')]);_0x107133[_0xcded('0x32')]=_['intersection'](_0x5c88a0[_0xcded('0x31')],qs[_0xcded('0x34')](_0x179878['query']['fields']));_0x107133['attributes']=_0x107133[_0xcded('0x32')][_0xcded('0x44')]?_0x107133[_0xcded('0x32')]:_0x5c88a0[_0xcded('0x31')];if(_0x179878[_0xcded('0x2f')][_0xcded('0x3e')]){_0x107133[_0xcded('0x3f')]=[{'all':!![]}];}_0x107133=_['merge']({},_0x107133,_0x179878[_0xcded('0x3c')]);return db[_0xcded('0x3d')][_0xcded('0x45')](_0x107133)[_0xcded('0x23')](handleEntityNotFound(_0x69470a,null))[_0xcded('0x23')](respondWithResult(_0x69470a,null))[_0xcded('0x46')](handleError(_0x69470a,null));};exports['create']=function(_0x4a2344,_0x19ee19){return db[_0xcded('0x3d')][_0xcded('0x47')](_0x4a2344[_0xcded('0x48')],{})['then'](function(_0x2ffb9a){var _0x1cb7d1=_0x4a2344[_0xcded('0x49')][_0xcded('0x4a')]({'plain':!![]});if(!_0x1cb7d1)throw new Error(_0xcded('0x4b'));if(_0x1cb7d1[_0xcded('0x4c')]===_0xcded('0x49')){var _0x575b32=_0x2ffb9a[_0xcded('0x4a')]({'plain':!![]});var _0x5c28e6=_0xcded('0x25');return db[_0xcded('0x4d')][_0xcded('0x45')]({'where':{'name':_0x5c28e6,'userProfileId':_0x1cb7d1[_0xcded('0x4e')]},'raw':!![]})[_0xcded('0x23')](function(_0xca3041){if(_0xca3041&&_0xca3041[_0xcded('0x4f')]===0x0){return db[_0xcded('0x26')][_0xcded('0x47')]({'name':_0x575b32[_0xcded('0x29')],'resourceId':_0x575b32['id'],'type':_0xca3041[_0xcded('0x29')],'sectionId':_0xca3041['id']},{})[_0xcded('0x23')](function(){return _0x2ffb9a;});}else{return _0x2ffb9a;}})[_0xcded('0x46')](function(_0x242010){logger[_0xcded('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x242010);throw _0x242010;});}return _0x2ffb9a;})[_0xcded('0x23')](respondWithResult(_0x19ee19,0xc9))[_0xcded('0x46')](handleError(_0x19ee19,null));};exports[_0xcded('0x22')]=function(_0x4bff03,_0x3a46b6){if(_0x4bff03['body']['id']){delete _0x4bff03[_0xcded('0x48')]['id'];}return db[_0xcded('0x3d')][_0xcded('0x45')]({'where':{'id':_0x4bff03[_0xcded('0x50')]['id']}})[_0xcded('0x23')](handleEntityNotFound(_0x3a46b6,null))[_0xcded('0x23')](saveUpdates(_0x4bff03[_0xcded('0x48')],null))[_0xcded('0x23')](respondWithResult(_0x3a46b6,null))[_0xcded('0x46')](handleError(_0x3a46b6,null));};exports[_0xcded('0x24')]=function(_0x10f129,_0xa68619){return db[_0xcded('0x3d')][_0xcded('0x45')]({'where':{'id':_0x10f129[_0xcded('0x50')]['id']}})[_0xcded('0x23')](handleEntityNotFound(_0xa68619,null))[_0xcded('0x23')](removeEntity(_0xa68619,null))[_0xcded('0x46')](handleError(_0xa68619,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index c2c0b23..ef16ddb 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 _0x3164=['VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','options','StopMixMonitor','length','concat','internal','name','User','findAll','agent','catch','define'];(function(_0xb651df,_0x3813c4){var _0x2f3c2a=function(_0xc9ce9c){while(--_0xc9ce9c){_0xb651df['push'](_0xb651df['shift']());}};_0x2f3c2a(++_0x3813c4);}(_0x3164,0x182));var _0x4316=function(_0x14363e,_0x4f0e0d){_0x14363e=_0x14363e-0x0;var _0x17c56d=_0x3164[_0x14363e];return _0x17c56d;};'use strict';var _=require(_0x4316('0x0'));var util=require(_0x4316('0x1'));var BPromise=require(_0x4316('0x2'));var attributes=require(_0x4316('0x3'));var getUserApplications=function(_0x169d29,_0x588480,_0x2534d3){var _0x2355a6=0x1;var _0x1235d9=[];var _0x56124c={'context':_0x588480['context']||_0x4316('0x4'),'exten':util[_0x4316('0x5')](_0x4316('0x6'),_0x169d29[_0x4316('0x7')],_0x2534d3),'type':_0x4316('0x8'),'isApp':![],'ChanSpyId':_0x169d29['id'],'UserId':_0x588480['id']};_0x1235d9[_0x4316('0x9')](_[_0x4316('0xa')]({'app':_0x4316('0xb'),'appdata':util[_0x4316('0x5')](_0x4316('0xc'),_0x4316('0xd')),'priority':_0x2355a6++},_0x56124c));if(_0x169d29[_0x4316('0xe')]){_0x1235d9[_0x4316('0x9')](_[_0x4316('0xa')]({'app':'MixMonitor','appdata':util[_0x4316('0x5')](_0x4316('0xf'),_0x169d29[_0x4316('0x10')]),'priority':_0x2355a6++},_0x56124c));}if(_0x169d29[_0x4316('0x11')]){_0x1235d9['push'](_[_0x4316('0xa')]({'app':_0x4316('0x12'),'appdata':_0x169d29[_0x4316('0x13')],'priority':_0x2355a6++},_0x56124c));}_0x1235d9[_0x4316('0x9')](_['merge']({'app':_0x4316('0x14'),'appdata':util['format']('SIP/%s,%s',_0x588480['name'],_0x169d29[_0x4316('0x15')]?_0x169d29[_0x4316('0x15')]['join'](''):''),'priority':_0x2355a6++},_0x56124c));if(_0x169d29[_0x4316('0xe')]){_0x1235d9['push'](_[_0x4316('0xa')]({'app':_0x4316('0x16'),'priority':_0x2355a6++},_0x56124c));}return _0x1235d9;};var getChanSpyApplications=function(_0x211d87,_0x1caa59){var _0x2e1923=[];for(var _0x2d579f=0x0,_0x9f47fc=0x1;_0x2d579f<_0x1caa59[_0x4316('0x17')];_0x2d579f++,_0x9f47fc=0x1){_0x2e1923=_0x2e1923[_0x4316('0x18')](getUserApplications(_0x211d87,_0x1caa59[_0x2d579f],_0x1caa59[_0x2d579f][_0x4316('0x19')]));if(_0x1caa59[_0x2d579f]['internal']!=_0x1caa59[_0x2d579f][_0x4316('0x1a')]){_0x2e1923=_0x2e1923[_0x4316('0x18')](getUserApplications(_0x211d87,_0x1caa59[_0x2d579f],_0x1caa59[_0x2d579f]['name']));}}return _0x2e1923;};var getChanSpyPromise=function(_0x537884,_0x40f660){return new BPromise(function(_0x348ca2,_0x32c332){return _0x537884[_0x4316('0x1b')][_0x4316('0x1c')]({'attributes':['id','name',_0x4316('0x19')],'where':{'role':_0x4316('0x1d'),'chanspy':!![]},'raw':!![]})['then'](function(_0x10187d){if(_0x10187d){return _0x348ca2(getChanSpyApplications(_0x40f660,_0x10187d));}return _0x348ca2([]);})[_0x4316('0x1e')](function(_0x38195f){_0x32c332(_0x38195f);});});};module['exports']=function(_0x1736d0,_0x2f5090){var _0xe4d685=_0x1736d0['models'];return _0x1736d0[_0x4316('0x1f')](_0x4316('0x20'),attributes,{'tableName':_0x4316('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2d2bda,_0x4bd8b2,_0x270688){return getChanSpyPromise(_0xe4d685,_0x2d2bda)[_0x4316('0x22')](function(_0x46bd61){if(_0x46bd61&&_0x46bd61[_0x4316('0x17')]){return _0xe4d685[_0x4316('0x23')][_0x4316('0x24')](_0x46bd61);}})[_0x4316('0x22')](function(){_0x270688();})[_0x4316('0x1e')](function(_0x1f7391){_0x270688(_0x1f7391);});},'afterUpdate':function(_0x22abc7,_0x31cd5f,_0x28e2a2){return _0xe4d685['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x22abc7['id']}})[_0x4316('0x22')](function(){return getChanSpyPromise(_0xe4d685,_0x22abc7);})[_0x4316('0x22')](function(_0xa8dd01){if(_0xa8dd01&&_0xa8dd01[_0x4316('0x17')]){return _0xe4d685[_0x4316('0x23')]['bulkCreate'](_0xa8dd01);}})[_0x4316('0x22')](function(){_0x28e2a2();})['catch'](function(_0x40d575){_0x28e2a2(_0x40d575);});},'afterDestroy':function(_0x52e624,_0x46df48,_0x50e099){return _0xe4d685[_0x4316('0x23')][_0x4316('0x25')]({'where':{'ChanSpyId':_0x52e624['id']}})['then'](function(){_0x50e099();})[_0x4316('0x1e')](function(_0x4b9430){_0x50e099(_0x4b9430);});}}});}; \ No newline at end of file +var _0xdfcc=['name','User','findAll','agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','length','lodash','util','bluebird','format','%s%s','system','push','merge','Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,a','password','ChanSpy','SIP/%s,%s','options','concat','internal'];(function(_0x3b52bf,_0xe47312){var _0x253982=function(_0x13feb2){while(--_0x13feb2){_0x3b52bf['push'](_0x3b52bf['shift']());}};_0x253982(++_0xe47312);}(_0xdfcc,0x8d));var _0xcdfc=function(_0x1646fa,_0x4e5bd7){_0x1646fa=_0x1646fa-0x0;var _0x5a47a5=_0xdfcc[_0x1646fa];return _0x5a47a5;};'use strict';var _=require(_0xcdfc('0x0'));var util=require(_0xcdfc('0x1'));var BPromise=require(_0xcdfc('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x133c72,_0x851248,_0x54bd16){var _0x4aef49=0x1;var _0x468275=[];var _0x4e9e63={'context':_0x851248['context']||'from-sip','exten':util[_0xcdfc('0x3')](_0xcdfc('0x4'),_0x133c72['prefix'],_0x54bd16),'type':_0xcdfc('0x5'),'isApp':![],'ChanSpyId':_0x133c72['id'],'UserId':_0x851248['id']};_0x468275[_0xcdfc('0x6')](_[_0xcdfc('0x7')]({'app':_0xcdfc('0x8'),'appdata':util['format'](_0xcdfc('0x9'),'chanspy'),'priority':_0x4aef49++},_0x4e9e63));if(_0x133c72[_0xcdfc('0xa')]){_0x468275[_0xcdfc('0x6')](_[_0xcdfc('0x7')]({'app':_0xcdfc('0xb'),'appdata':util[_0xcdfc('0x3')](_0xcdfc('0xc'),_0x133c72['recordingFormat']),'priority':_0x4aef49++},_0x4e9e63));}if(_0x133c72['auth']){_0x468275[_0xcdfc('0x6')](_[_0xcdfc('0x7')]({'app':'Authenticate','appdata':_0x133c72[_0xcdfc('0xd')],'priority':_0x4aef49++},_0x4e9e63));}_0x468275[_0xcdfc('0x6')](_['merge']({'app':_0xcdfc('0xe'),'appdata':util[_0xcdfc('0x3')](_0xcdfc('0xf'),_0x851248['name'],_0x133c72[_0xcdfc('0x10')]?_0x133c72[_0xcdfc('0x10')]['join'](''):''),'priority':_0x4aef49++},_0x4e9e63));if(_0x133c72[_0xcdfc('0xa')]){_0x468275[_0xcdfc('0x6')](_[_0xcdfc('0x7')]({'app':'StopMixMonitor','priority':_0x4aef49++},_0x4e9e63));}return _0x468275;};var getChanSpyApplications=function(_0x3834aa,_0x1a8095){var _0x48f497=[];for(var _0x375ae5=0x0,_0x19f868=0x1;_0x375ae5<_0x1a8095['length'];_0x375ae5++,_0x19f868=0x1){_0x48f497=_0x48f497[_0xcdfc('0x11')](getUserApplications(_0x3834aa,_0x1a8095[_0x375ae5],_0x1a8095[_0x375ae5][_0xcdfc('0x12')]));if(_0x1a8095[_0x375ae5][_0xcdfc('0x12')]!=_0x1a8095[_0x375ae5]['name']){_0x48f497=_0x48f497[_0xcdfc('0x11')](getUserApplications(_0x3834aa,_0x1a8095[_0x375ae5],_0x1a8095[_0x375ae5][_0xcdfc('0x13')]));}}return _0x48f497;};var getChanSpyPromise=function(_0x5ad601,_0x3e1707){return new BPromise(function(_0x7e62d0,_0x1efa4e){return _0x5ad601[_0xcdfc('0x14')][_0xcdfc('0x15')]({'attributes':['id',_0xcdfc('0x13'),'internal'],'where':{'role':_0xcdfc('0x16'),'chanspy':!![]},'raw':!![]})['then'](function(_0x2124cf){if(_0x2124cf){return _0x7e62d0(getChanSpyApplications(_0x3e1707,_0x2124cf));}return _0x7e62d0([]);})[_0xcdfc('0x17')](function(_0x2b7868){_0x1efa4e(_0x2b7868);});});};module[_0xcdfc('0x18')]=function(_0x4e58ce,_0x183ada){var _0x1949df=_0x4e58ce[_0xcdfc('0x19')];return _0x4e58ce[_0xcdfc('0x1a')](_0xcdfc('0x1b'),attributes,{'tableName':_0xcdfc('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x101ba0,_0x3bdd7f,_0xf31d8a){return getChanSpyPromise(_0x1949df,_0x101ba0)[_0xcdfc('0x1d')](function(_0x44ab0b){if(_0x44ab0b&&_0x44ab0b['length']){return _0x1949df[_0xcdfc('0x1e')]['bulkCreate'](_0x44ab0b);}})[_0xcdfc('0x1d')](function(){_0xf31d8a();})[_0xcdfc('0x17')](function(_0x762f0e){_0xf31d8a(_0x762f0e);});},'afterUpdate':function(_0x28d4bc,_0x1de322,_0x180198){return _0x1949df[_0xcdfc('0x1e')]['destroy']({'where':{'ChanSpyId':_0x28d4bc['id']}})['then'](function(){return getChanSpyPromise(_0x1949df,_0x28d4bc);})[_0xcdfc('0x1d')](function(_0x260843){if(_0x260843&&_0x260843[_0xcdfc('0x1f')]){return _0x1949df[_0xcdfc('0x1e')]['bulkCreate'](_0x260843);}})[_0xcdfc('0x1d')](function(){_0x180198();})[_0xcdfc('0x17')](function(_0x5561bd){_0x180198(_0x5561bd);});},'afterDestroy':function(_0x5b19e2,_0x29cc4e,_0x3854cf){return _0x1949df[_0xcdfc('0x1e')]['destroy']({'where':{'ChanSpyId':_0x5b19e2['id']}})[_0xcdfc('0x1d')](function(){_0x3854cf();})[_0xcdfc('0x17')](function(_0x40008e){_0x3854cf(_0x40008e);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index ae711dc..441f2d0 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 _0xda12=['bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','lodash','util'];(function(_0x5f46a2,_0x24d125){var _0x273959=function(_0x10ae55){while(--_0x10ae55){_0x5f46a2['push'](_0x5f46a2['shift']());}};_0x273959(++_0x24d125);}(_0xda12,0xbc));var _0x2da1=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xda12[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x2da1('0x0'));var util=require(_0x2da1('0x1'));var moment=require('moment');var BPromise=require(_0x2da1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2da1('0x3'));var db=require(_0x2da1('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2da1('0x5'));var config=require(_0x2da1('0x6'));var jayson=require(_0x2da1('0x7'));var client=jayson[_0x2da1('0x8')][_0x2da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2dfa83,_0x1c20b3,_0x2a9bb7){return new BPromise(function(_0x239ecb,_0x13e0ff){return client['request'](_0x2dfa83,_0x2a9bb7)['then'](function(_0x3a8346){logger[_0x2da1('0xa')]('VoiceChanSpy,\x20%s,\x20%s',_0x1c20b3,_0x2da1('0xb'));logger[_0x2da1('0xc')](_0x2da1('0xd'),_0x1c20b3,_0x2da1('0xb'),JSON[_0x2da1('0xe')](_0x3a8346));if(_0x3a8346[_0x2da1('0xf')]){if(_0x3a8346[_0x2da1('0xf')][_0x2da1('0x10')]===0x1f4){logger['error'](_0x2da1('0x11'),_0x1c20b3,_0x3a8346[_0x2da1('0xf')][_0x2da1('0x12')]);return _0x13e0ff(_0x3a8346['error']['message']);}logger[_0x2da1('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x1c20b3,_0x3a8346[_0x2da1('0xf')][_0x2da1('0x12')]);return _0x239ecb(_0x3a8346[_0x2da1('0xf')][_0x2da1('0x12')]);}else{logger[_0x2da1('0xa')]('VoiceChanSpy,\x20%s,\x20%s',_0x1c20b3,_0x2da1('0xb'));_0x239ecb(_0x3a8346['result'][_0x2da1('0x12')]);}})['catch'](function(_0x33aa24){logger[_0x2da1('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x1c20b3,_0x33aa24);_0x13e0ff(_0x33aa24);});});} \ No newline at end of file +var _0xb85d=['stringify','error','code','message','result','catch','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0x1895b7,_0x21fbc7){var _0x1aecdc=function(_0x44682a){while(--_0x44682a){_0x1895b7['push'](_0x1895b7['shift']());}};_0x1aecdc(++_0x21fbc7);}(_0xb85d,0x78));var _0xdb85=function(_0x205c76,_0x385a60){_0x205c76=_0x205c76-0x0;var _0x5e5ddb=_0xb85d[_0x205c76];return _0x5e5ddb;};'use strict';var _=require('lodash');var util=require(_0xdb85('0x0'));var moment=require(_0xdb85('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdb85('0x2'));var logger=require(_0xdb85('0x3'))(_0xdb85('0x4'));var config=require(_0xdb85('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xdb85('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d932f,_0x3954d5,_0x5ace41){return new BPromise(function(_0x596f4f,_0x1d476d){return client['request'](_0x5d932f,_0x5ace41)[_0xdb85('0x7')](function(_0x501a65){logger[_0xdb85('0x8')](_0xdb85('0x9'),_0x3954d5,_0xdb85('0xa'));logger[_0xdb85('0xb')](_0xdb85('0xc'),_0x3954d5,'request\x20sent',JSON[_0xdb85('0xd')](_0x501a65));if(_0x501a65[_0xdb85('0xe')]){if(_0x501a65[_0xdb85('0xe')][_0xdb85('0xf')]===0x1f4){logger[_0xdb85('0xe')](_0xdb85('0x9'),_0x3954d5,_0x501a65[_0xdb85('0xe')][_0xdb85('0x10')]);return _0x1d476d(_0x501a65[_0xdb85('0xe')][_0xdb85('0x10')]);}logger[_0xdb85('0xe')](_0xdb85('0x9'),_0x3954d5,_0x501a65[_0xdb85('0xe')][_0xdb85('0x10')]);return _0x596f4f(_0x501a65[_0xdb85('0xe')][_0xdb85('0x10')]);}else{logger[_0xdb85('0x8')](_0xdb85('0x9'),_0x3954d5,_0xdb85('0xa'));_0x596f4f(_0x501a65[_0xdb85('0x11')][_0xdb85('0x10')]);}})[_0xdb85('0x12')](function(_0x3c3a67){logger['error'](_0xdb85('0x9'),_0x3954d5,_0x3c3a67);_0x1d476d(_0x3c3a67);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index a8cea85..cae830b 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 _0xad8a=['update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','/:id','show','isAuthenticated','create','put'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xad8a,0xe0));var _0xaad8=function(_0x291fbc,_0x31b55c){_0x291fbc=_0x291fbc-0x0;var _0x586f6f=_0xad8a[_0x291fbc];return _0x586f6f;};'use strict';var multer=require(_0xaad8('0x0'));var util=require(_0xaad8('0x1'));var path=require('path');var timeout=require(_0xaad8('0x2'));var express=require(_0xaad8('0x3'));var router=express[_0xaad8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xaad8('0x5'));var config=require(_0xaad8('0x6'));var controller=require(_0xaad8('0x7'));router[_0xaad8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xaad8('0x9'),auth['isAuthenticated'](),controller[_0xaad8('0xa')]);router['post']('/',auth[_0xaad8('0xb')](),controller[_0xaad8('0xc')]);router[_0xaad8('0xd')]('/:id',auth[_0xaad8('0xb')](),controller[_0xaad8('0xe')]);router[_0xaad8('0xf')](_0xaad8('0x9'),auth[_0xaad8('0xb')](),controller[_0xaad8('0x10')]);module['exports']=router; \ No newline at end of file +var _0x7dbe=['index','/:id','show','post','create','delete','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x46743a,_0x38a26f){var _0x181f33=function(_0x54edd7){while(--_0x54edd7){_0x46743a['push'](_0x46743a['shift']());}};_0x181f33(++_0x38a26f);}(_0x7dbe,0x13a));var _0xe7db=function(_0x2dc205,_0x326e0d){_0x2dc205=_0x2dc205-0x0;var _0x452a76=_0x7dbe[_0x2dc205];return _0x452a76;};'use strict';var multer=require(_0xe7db('0x0'));var util=require('util');var path=require(_0xe7db('0x1'));var timeout=require(_0xe7db('0x2'));var express=require(_0xe7db('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe7db('0x4'));var config=require(_0xe7db('0x5'));var controller=require('./voiceContext.controller');router[_0xe7db('0x6')]('/',auth[_0xe7db('0x7')](),controller[_0xe7db('0x8')]);router[_0xe7db('0x6')](_0xe7db('0x9'),auth[_0xe7db('0x7')](),controller[_0xe7db('0xa')]);router[_0xe7db('0xb')]('/',auth[_0xe7db('0x7')](),controller[_0xe7db('0xc')]);router['put'](_0xe7db('0x9'),auth[_0xe7db('0x7')](),controller['update']);router[_0xe7db('0xd')]('/:id',auth[_0xe7db('0x7')](),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 3d8e3e8..d7c69fb 100644 --- a/server/api/voiceContext/voiceContext.attributes.js +++ b/server/api/voiceContext/voiceContext.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x19adfd,_0x33a819){var _0x115809=function(_0x59f77b){while(--_0x59f77b){_0x19adfd['push'](_0x19adfd['shift']());}};_0x115809(++_0x33a819);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9c44=['BOOLEAN','STRING','name'];(function(_0xeb54a4,_0x53b95e){var _0x597e40=function(_0xcf55f4){while(--_0xcf55f4){_0xeb54a4['push'](_0xeb54a4['shift']());}};_0x597e40(++_0x53b95e);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x49c4('0x0')],'unique':_0x49c4('0x1')},'description':{'type':Sequelize[_0x49c4('0x0')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x49c4('0x2')],'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 3ad2081..a617bb3 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 _0x3e74=['VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','get','Contexts','UserProfileResource','destroy','stack','name','send','map','VoiceContext','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','includeAll','findAll','show','params','include','find','create','join','root','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','readFileSync','server/files/templates/context.ejs','chan_sip.so','render','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','request','then'];(function(_0x5bbd92,_0x50b1c8){var _0x42e410=function(_0x439924){while(--_0x439924){_0x5bbd92['push'](_0x5bbd92['shift']());}};_0x42e410(++_0x50b1c8);}(_0x3e74,0x175));var _0x43e7=function(_0x43e4f4,_0x25481d){_0x43e4f4=_0x43e4f4-0x0;var _0x517b17=_0x3e74[_0x43e4f4];return _0x517b17;};'use strict';var pdf=require(_0x43e7('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x43e7('0x1'));var zipdir=require(_0x43e7('0x2'));var jsonpatch=require(_0x43e7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x43e7('0x4'));var Mustache=require('mustache');var util=require(_0x43e7('0x5'));var path=require(_0x43e7('0x6'));var sox=require(_0x43e7('0x7'));var csv=require(_0x43e7('0x8'));var ejs=require(_0x43e7('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x8'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var db=require('../../mysqldb')['db'];var jayson=require(_0x43e7('0x14'));var client=jayson[_0x43e7('0x15')][_0x43e7('0x16')]({'port':0x232a});function checkPasswordPattern(_0x3bb83f,_0x4e008c,_0x583d85){if(_0x583d85){var _0x2fcb36=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2fcb36[_0x43e7('0x17')](_0x4e008c)){return _0x3bb83f;}else{throw new db[(_0x43e7('0x18'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3bb83f;}}function respondWithRpcPromise(_0x16849c,_0x14c146,_0x203378,_0x328445){return new BPromise(function(_0x4de324,_0x5c4eaa){var _0xdf16c=_0x328445||client;return _0xdf16c[_0x43e7('0x19')](_0x16849c,_0x203378)[_0x43e7('0x1a')](function(_0x5d346f){logger['info'](_0x43e7('0x1b'),_0x14c146,_0x43e7('0x1c'));logger[_0x43e7('0x1d')](_0x43e7('0x1e'),_0x14c146,_0x43e7('0x1c'),JSON[_0x43e7('0x1f')](_0x5d346f));if(_0x5d346f[_0x43e7('0x20')]){if(_0x5d346f[_0x43e7('0x20')][_0x43e7('0x21')]===0x1f4){logger[_0x43e7('0x20')](_0x43e7('0x1b'),_0x14c146,_0x5d346f[_0x43e7('0x20')]['message']);return _0x5c4eaa(_0x5d346f[_0x43e7('0x20')][_0x43e7('0x22')]);}logger['error'](_0x43e7('0x1b'),_0x14c146,_0x5d346f[_0x43e7('0x20')][_0x43e7('0x22')]);return _0x4de324(_0x5d346f[_0x43e7('0x20')][_0x43e7('0x22')]);}else{logger[_0x43e7('0x23')]('VoiceContext,\x20%s,\x20%s',_0x14c146,_0x43e7('0x1c'));_0x4de324(_0x5d346f['result']['message']);}})[_0x43e7('0x24')](function(_0x43f4ff){logger['error'](_0x43e7('0x1b'),_0x14c146,_0x43f4ff);_0x5c4eaa(_0x43f4ff);});});}function respondWithStatusCode(_0x4ca5cf,_0x326dab){_0x326dab=_0x326dab||0xcc;return function(_0x5c5e67){if(_0x5c5e67){return _0x4ca5cf[_0x43e7('0x25')](_0x326dab);}return _0x4ca5cf[_0x43e7('0x26')](_0x326dab)[_0x43e7('0x27')]();};}function respondWithResult(_0x405f85,_0x51f4d7){_0x51f4d7=_0x51f4d7||0xc8;return function(_0x52b7b3){if(_0x52b7b3){return _0x405f85[_0x43e7('0x26')](_0x51f4d7)['json'](_0x52b7b3);}};}function respondWithFilteredResult(_0x2dd5f,_0x40dc8f){return function(_0x3565cf){if(_0x3565cf){var _0xb1fc63=_0x3565cf[_0x43e7('0x28')],_0x5087d7=_0x40dc8f[_0x43e7('0x29')],_0x33a1a5=_0x40dc8f[_0x43e7('0x29')]+_0x40dc8f[_0x43e7('0x2a')],_0x4690a6;if(_0x33a1a5>=_0xb1fc63){_0x33a1a5=_0xb1fc63;_0x4690a6=0xc8;}else{_0x4690a6=0xce;}_0x2dd5f[_0x43e7('0x26')](_0x4690a6);return _0x2dd5f[_0x43e7('0x2b')](_0x43e7('0x2c'),_0x5087d7+'-'+_0x33a1a5+'/'+_0xb1fc63)[_0x43e7('0x2d')](_0x3565cf);}return null;};}function patchUpdates(_0x17df44){return function(_0x19725a){try{jsonpatch[_0x43e7('0x2e')](_0x19725a,_0x17df44,!![]);}catch(_0x208706){return BPromise['reject'](_0x208706);}return _0x19725a[_0x43e7('0x2f')]();};}function saveUpdates(_0x44f6b0,_0x3b8f78){return function(_0x183c81){if(_0x183c81){return _0x183c81[_0x43e7('0x30')](_0x44f6b0)['then'](function(_0x1eba65){return _0x1eba65;});}return null;};}function removeEntity(_0x49b83d,_0x30d47e){return function(_0x3f280d){if(_0x3f280d){return _0x3f280d['destroy']()['then'](function(){var _0x5e203f=_0x3f280d[_0x43e7('0x31')]({'plain':!![]});var _0xbe6e28=_0x43e7('0x32');return db[_0x43e7('0x33')][_0x43e7('0x34')]({'where':{'type':_0xbe6e28,'resourceId':_0x5e203f['id']}})[_0x43e7('0x1a')](function(){return _0x3f280d;});})['then'](function(){_0x49b83d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59e5b2,_0x4e8e86){return function(_0x564f0e){if(!_0x564f0e){_0x59e5b2['sendStatus'](0x194);}return _0x564f0e;};}function handleError(_0x14d888,_0x49cda6){_0x49cda6=_0x49cda6||0x1f4;return function(_0x2b4bfd){logger[_0x43e7('0x20')](_0x2b4bfd[_0x43e7('0x35')]);if(_0x2b4bfd[_0x43e7('0x36')]){delete _0x2b4bfd[_0x43e7('0x36')];}_0x14d888[_0x43e7('0x26')](_0x49cda6)[_0x43e7('0x37')](_0x2b4bfd);};}exports['index']=function(_0x5332d9,_0x5d84f4){var _0xfa0474={},_0xfe70e9={},_0x199ff6={'count':0x0,'rows':[]};var _0x16cdba=_[_0x43e7('0x38')](db[_0x43e7('0x39')][_0x43e7('0x3a')],function(_0x2ffd43){return{'name':_0x2ffd43['fieldName'],'type':_0x2ffd43[_0x43e7('0x3b')][_0x43e7('0x3c')]};});_0xfe70e9['model']=_[_0x43e7('0x38')](_0x16cdba,'name');_0xfe70e9[_0x43e7('0x3d')]=_[_0x43e7('0x3e')](_0x5332d9[_0x43e7('0x3d')]);_0xfe70e9[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0xfe70e9[_0x43e7('0x41')],_0xfe70e9['query']);_0xfa0474['attributes']=_[_0x43e7('0x40')](_0xfe70e9[_0x43e7('0x41')],qs[_0x43e7('0x42')](_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x42')]));_0xfa0474['attributes']=_0xfa0474[_0x43e7('0x43')][_0x43e7('0x44')]?_0xfa0474['attributes']:_0xfe70e9[_0x43e7('0x41')];if(!_0x5332d9['query'][_0x43e7('0x45')]('nolimit')){_0xfa0474[_0x43e7('0x2a')]=qs[_0x43e7('0x2a')](_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x2a')]);_0xfa0474['offset']=qs['offset'](_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x29')]);}_0xfa0474[_0x43e7('0x46')]=qs[_0x43e7('0x47')](_0x5332d9['query']['sort']);_0xfa0474['where']=qs[_0x43e7('0x3f')](_['pick'](_0x5332d9[_0x43e7('0x3d')],_0xfe70e9['filters']),_0x16cdba);if(_0x5332d9['query'][_0x43e7('0x48')]){_0xfa0474['where']=_[_0x43e7('0x49')](_0xfa0474[_0x43e7('0x4a')],{'$or':_[_0x43e7('0x38')](_0x16cdba,function(_0x99b9e1){if(_0x99b9e1['type']!==_0x43e7('0x4b')){var _0x2b9046={};_0x2b9046[_0x99b9e1[_0x43e7('0x36')]]={'$like':'%'+_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x48')]+'%'};return _0x2b9046;}})});}_0xfa0474=_[_0x43e7('0x49')]({},_0xfa0474,_0x5332d9['options']);var _0x4930a2={'where':_0xfa0474[_0x43e7('0x4a')]};return db[_0x43e7('0x39')][_0x43e7('0x28')](_0x4930a2)['then'](function(_0x5c1c18){_0x199ff6['count']=_0x5c1c18;if(_0x5332d9[_0x43e7('0x3d')][_0x43e7('0x4c')]){_0xfa0474['include']=[{'all':!![]}];}return db[_0x43e7('0x39')][_0x43e7('0x4d')](_0xfa0474);})[_0x43e7('0x1a')](function(_0x560329){_0x199ff6['rows']=_0x560329;return _0x199ff6;})['then'](respondWithFilteredResult(_0x5d84f4,_0xfa0474))['catch'](handleError(_0x5d84f4,null));};exports[_0x43e7('0x4e')]=function(_0xe955fc,_0x52fea5){var _0x23e7cb={'raw':![],'where':{'id':_0xe955fc[_0x43e7('0x4f')]['id']}},_0x82d32f={};_0x82d32f[_0x43e7('0x41')]=_['keys'](db[_0x43e7('0x39')]['rawAttributes']);_0x82d32f['query']=_[_0x43e7('0x3e')](_0xe955fc[_0x43e7('0x3d')]);_0x82d32f[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0x82d32f[_0x43e7('0x41')],_0x82d32f[_0x43e7('0x3d')]);_0x23e7cb[_0x43e7('0x43')]=_[_0x43e7('0x40')](_0x82d32f[_0x43e7('0x41')],qs[_0x43e7('0x42')](_0xe955fc['query'][_0x43e7('0x42')]));_0x23e7cb[_0x43e7('0x43')]=_0x23e7cb['attributes'][_0x43e7('0x44')]?_0x23e7cb['attributes']:_0x82d32f[_0x43e7('0x41')];if(_0xe955fc[_0x43e7('0x3d')][_0x43e7('0x4c')]){_0x23e7cb[_0x43e7('0x50')]=[{'all':!![]}];}_0x23e7cb=_[_0x43e7('0x49')]({},_0x23e7cb,_0xe955fc['options']);return db['VoiceContext'][_0x43e7('0x51')](_0x23e7cb)[_0x43e7('0x1a')](handleEntityNotFound(_0x52fea5,null))[_0x43e7('0x1a')](respondWithResult(_0x52fea5,null))[_0x43e7('0x24')](handleError(_0x52fea5,null));};exports[_0x43e7('0x52')]=function(_0x25bb44,_0xa47464,_0x44f8a0){var _0x26d86c;return db[_0x43e7('0x39')][_0x43e7('0x52')](_0x25bb44['body'],{'raw':!![]})[_0x43e7('0x1a')](function(_0x2da2f3){_0x26d86c=_0x2da2f3;return db['VoiceContext'][_0x43e7('0x4d')]({'raw':!![]});})[_0x43e7('0x1a')](function(_0x2d0052){var _0x558d54=fs['readFileSync'](path[_0x43e7('0x53')](config[_0x43e7('0x54')],'server/files/templates/context.ejs'),_0x43e7('0x55'));var _0x54506d=ejs['render'](_0x558d54,{'contexts':_0x2d0052||[]});fs[_0x43e7('0x56')](_0x43e7('0x57'),_0x54506d);})[_0x43e7('0x1a')](function(){return respondWithRpcPromise(_0x43e7('0x58'),_0x43e7('0x52'),{'module':'chan_sip.so'});})[_0x43e7('0x1a')](function(){var _0xdb9fbe=_0x25bb44['user'][_0x43e7('0x31')]({'plain':!![]});if(!_0xdb9fbe)throw new Error(_0x43e7('0x59'));if(_0xdb9fbe[_0x43e7('0x5a')]==='user'){var _0x5a4c95=_0x26d86c['get']({'plain':!![]});return db[_0x43e7('0x5b')][_0x43e7('0x51')]({'where':{'name':_0x43e7('0x32'),'userProfileId':_0xdb9fbe[_0x43e7('0x5c')]},'raw':!![]})['then'](function(_0x5a50fc){if(_0x5a50fc&&_0x5a50fc[_0x43e7('0x5d')]===0x0){return db[_0x43e7('0x33')][_0x43e7('0x52')]({'name':_0x5a4c95[_0x43e7('0x36')],'resourceId':_0x5a4c95['id'],'type':_0x5a50fc['name'],'sectionId':_0x5a50fc['id']},{})[_0x43e7('0x1a')](function(){return _0x26d86c;});}else{return _0x26d86c;}})[_0x43e7('0x24')](function(_0x23595c){logger[_0x43e7('0x20')](_0x43e7('0x5e'),_0x23595c);throw _0x23595c;});}return _0x26d86c;})[_0x43e7('0x1a')](respondWithResult(_0xa47464,0xc9))[_0x43e7('0x24')](handleError(_0xa47464,null));};exports[_0x43e7('0x30')]=function(_0x406155,_0x381208,_0x252f00){var _0x57fdfe;return db['VoiceContext'][_0x43e7('0x51')]({'where':{'id':_0x406155['params']['id']}})['then'](handleEntityNotFound(_0x381208,null))['then'](saveUpdates(_0x406155[_0x43e7('0x5f')],null))[_0x43e7('0x1a')](function(_0x5d7b37){if(_0x5d7b37){_0x57fdfe=_0x5d7b37;return db[_0x43e7('0x39')][_0x43e7('0x4d')]({'raw':!![]});}})[_0x43e7('0x1a')](function(_0x537a53){var _0x2b7406=fs[_0x43e7('0x60')](path[_0x43e7('0x53')](config[_0x43e7('0x54')],_0x43e7('0x61')),_0x43e7('0x55'));var _0x1e02fa=ejs['render'](_0x2b7406,{'contexts':_0x537a53||[]});fs[_0x43e7('0x56')](_0x43e7('0x57'),_0x1e02fa);})[_0x43e7('0x1a')](function(){return respondWithRpcPromise('Reload','update',{'module':_0x43e7('0x62')});})['then'](function(){return _0x57fdfe;})['then'](respondWithResult(_0x381208,null))[_0x43e7('0x24')](handleError(_0x381208,null));};exports[_0x43e7('0x34')]=function(_0x5b5833,_0x88c7f,_0x28b21d){var _0x1e2fed;return db[_0x43e7('0x39')][_0x43e7('0x51')]({'where':{'id':_0x5b5833[_0x43e7('0x4f')]['id']}})[_0x43e7('0x1a')](handleEntityNotFound(_0x88c7f,null))['then'](removeEntity(_0x88c7f,null))[_0x43e7('0x1a')](function(){return db[_0x43e7('0x39')]['findAll']({'raw':!![]});})[_0x43e7('0x1a')](function(_0x5c2c5f){var _0x26ee52=fs[_0x43e7('0x60')](path[_0x43e7('0x53')](config[_0x43e7('0x54')],'server/files/templates/context.ejs'),_0x43e7('0x55'));var _0x2646c2=ejs[_0x43e7('0x63')](_0x26ee52,{'contexts':_0x5c2c5f});fs['writeFileSync'](_0x43e7('0x57'),_0x2646c2);return respondWithRpcPromise(_0x43e7('0x58'),_0x43e7('0x34'),{'module':_0x43e7('0x62')});})[_0x43e7('0x24')](handleError(_0x88c7f,null));}; \ No newline at end of file +var _0xe14b=['query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filters','merge','filter','include','rows','catch','show','params','includeAll','options','create','body','findAll','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','chan_sip.so','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','Contexts','end','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model'];(function(_0x25bb5c,_0x398eed){var _0x3db377=function(_0x5b678e){while(--_0x5b678e){_0x25bb5c['push'](_0x25bb5c['shift']());}};_0x3db377(++_0x398eed);}(_0xe14b,0x93));var _0xbe14=function(_0x4efe12,_0x5cd207){_0x4efe12=_0x4efe12-0x0;var _0x4b0ad3=_0xe14b[_0x4efe12];return _0x4b0ad3;};'use strict';var pdf=require(_0xbe14('0x0'));var emlformat=require(_0xbe14('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe14('0x2'));var rp=require(_0xbe14('0x3'));var moment=require('moment');var BPromise=require(_0xbe14('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbe14('0x5'));var sox=require(_0xbe14('0x6'));var csv=require(_0xbe14('0x7'));var ejs=require(_0xbe14('0x8'));var fs=require('fs');var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var db=require(_0xbe14('0x14'))['db'];var jayson=require(_0xbe14('0x15'));var client=jayson[_0xbe14('0x16')][_0xbe14('0x17')]({'port':0x232a});function checkPasswordPattern(_0x23a730,_0x2850cb,_0x16893f){if(_0x16893f){var _0xa2cf72=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa2cf72[_0xbe14('0x18')](_0x2850cb)){return _0x23a730;}else{throw new db[(_0xbe14('0x19'))][(_0xbe14('0x1a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x23a730;}}function respondWithRpcPromise(_0x55b3a7,_0x3f58f5,_0x3dc4a9,_0xf4ac9){return new BPromise(function(_0x37ce4e,_0x4e8f34){var _0x21c789=_0xf4ac9||client;return _0x21c789[_0xbe14('0x1b')](_0x55b3a7,_0x3dc4a9)[_0xbe14('0x1c')](function(_0x123ede){logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x3f58f5,_0xbe14('0x1f'));logger['debug'](_0xbe14('0x20'),_0x3f58f5,_0xbe14('0x1f'),JSON[_0xbe14('0x21')](_0x123ede));if(_0x123ede[_0xbe14('0x22')]){if(_0x123ede[_0xbe14('0x22')][_0xbe14('0x23')]===0x1f4){logger['error'](_0xbe14('0x1e'),_0x3f58f5,_0x123ede[_0xbe14('0x22')][_0xbe14('0x24')]);return _0x4e8f34(_0x123ede[_0xbe14('0x22')][_0xbe14('0x24')]);}logger['error'](_0xbe14('0x1e'),_0x3f58f5,_0x123ede['error'][_0xbe14('0x24')]);return _0x37ce4e(_0x123ede['error'][_0xbe14('0x24')]);}else{logger['info'](_0xbe14('0x1e'),_0x3f58f5,_0xbe14('0x1f'));_0x37ce4e(_0x123ede['result'][_0xbe14('0x24')]);}})['catch'](function(_0x4587a8){logger['error'](_0xbe14('0x1e'),_0x3f58f5,_0x4587a8);_0x4e8f34(_0x4587a8);});});}function respondWithStatusCode(_0x5fa043,_0x1ee9c1){_0x1ee9c1=_0x1ee9c1||0xcc;return function(_0x39cc81){if(_0x39cc81){return _0x5fa043[_0xbe14('0x25')](_0x1ee9c1);}return _0x5fa043[_0xbe14('0x26')](_0x1ee9c1)['end']();};}function respondWithResult(_0x1822e0,_0x1ba46a){_0x1ba46a=_0x1ba46a||0xc8;return function(_0x391556){if(_0x391556){return _0x1822e0[_0xbe14('0x26')](_0x1ba46a)['json'](_0x391556);}};}function respondWithFilteredResult(_0x16f884,_0x29fc64){return function(_0x59bf34){if(_0x59bf34){var _0x3c3613=_0x59bf34[_0xbe14('0x27')],_0x3b3e84=_0x29fc64[_0xbe14('0x28')],_0x1c7cc7=_0x29fc64[_0xbe14('0x28')]+_0x29fc64[_0xbe14('0x29')],_0x19252f;if(_0x1c7cc7>=_0x3c3613){_0x1c7cc7=_0x3c3613;_0x19252f=0xc8;}else{_0x19252f=0xce;}_0x16f884[_0xbe14('0x26')](_0x19252f);return _0x16f884[_0xbe14('0x2a')](_0xbe14('0x2b'),_0x3b3e84+'-'+_0x1c7cc7+'/'+_0x3c3613)[_0xbe14('0x2c')](_0x59bf34);}return null;};}function patchUpdates(_0x39dc0a){return function(_0x10ae36){try{jsonpatch[_0xbe14('0x2d')](_0x10ae36,_0x39dc0a,!![]);}catch(_0xe6feb2){return BPromise[_0xbe14('0x2e')](_0xe6feb2);}return _0x10ae36[_0xbe14('0x2f')]();};}function saveUpdates(_0x29e76a,_0x14e7c4){return function(_0x581e86){if(_0x581e86){return _0x581e86[_0xbe14('0x30')](_0x29e76a)['then'](function(_0x58f8de){return _0x58f8de;});}return null;};}function removeEntity(_0x46c2d1,_0x4c1e7e){return function(_0x243524){if(_0x243524){return _0x243524[_0xbe14('0x31')]()['then'](function(){var _0x50cb09=_0x243524['get']({'plain':!![]});var _0x412ad5=_0xbe14('0x32');return db['UserProfileResource'][_0xbe14('0x31')]({'where':{'type':_0x412ad5,'resourceId':_0x50cb09['id']}})[_0xbe14('0x1c')](function(){return _0x243524;});})[_0xbe14('0x1c')](function(){_0x46c2d1[_0xbe14('0x26')](0xcc)[_0xbe14('0x33')]();});}};}function handleEntityNotFound(_0x5ef1e5,_0x591a36){return function(_0x15a997){if(!_0x15a997){_0x5ef1e5['sendStatus'](0x194);}return _0x15a997;};}function handleError(_0x5dd7aa,_0x5c5e9f){_0x5c5e9f=_0x5c5e9f||0x1f4;return function(_0x163ef7){logger[_0xbe14('0x22')](_0x163ef7[_0xbe14('0x34')]);if(_0x163ef7[_0xbe14('0x35')]){delete _0x163ef7[_0xbe14('0x35')];}_0x5dd7aa[_0xbe14('0x26')](_0x5c5e9f)[_0xbe14('0x36')](_0x163ef7);};}exports[_0xbe14('0x37')]=function(_0x2d9c12,_0x2dfd5a){var _0x41652d={},_0x32c59d={},_0x539c41={'count':0x0,'rows':[]};var _0x4f51f8=_[_0xbe14('0x38')](db[_0xbe14('0x39')][_0xbe14('0x3a')],function(_0x520e09){return{'name':_0x520e09[_0xbe14('0x3b')],'type':_0x520e09[_0xbe14('0x3c')][_0xbe14('0x3d')]};});_0x32c59d[_0xbe14('0x3e')]=_[_0xbe14('0x38')](_0x4f51f8,_0xbe14('0x35'));_0x32c59d[_0xbe14('0x3f')]=_[_0xbe14('0x40')](_0x2d9c12[_0xbe14('0x3f')]);_0x32c59d['filters']=_[_0xbe14('0x41')](_0x32c59d[_0xbe14('0x3e')],_0x32c59d[_0xbe14('0x3f')]);_0x41652d[_0xbe14('0x42')]=_[_0xbe14('0x41')](_0x32c59d[_0xbe14('0x3e')],qs['fields'](_0x2d9c12[_0xbe14('0x3f')][_0xbe14('0x43')]));_0x41652d[_0xbe14('0x42')]=_0x41652d[_0xbe14('0x42')]['length']?_0x41652d['attributes']:_0x32c59d[_0xbe14('0x3e')];if(!_0x2d9c12[_0xbe14('0x3f')][_0xbe14('0x44')]('nolimit')){_0x41652d['limit']=qs[_0xbe14('0x29')](_0x2d9c12['query']['limit']);_0x41652d[_0xbe14('0x28')]=qs[_0xbe14('0x28')](_0x2d9c12[_0xbe14('0x3f')]['offset']);}_0x41652d['order']=qs['sort'](_0x2d9c12[_0xbe14('0x3f')][_0xbe14('0x45')]);_0x41652d[_0xbe14('0x46')]=qs['filters'](_[_0xbe14('0x47')](_0x2d9c12[_0xbe14('0x3f')],_0x32c59d[_0xbe14('0x48')]),_0x4f51f8);if(_0x2d9c12[_0xbe14('0x3f')]['filter']){_0x41652d['where']=_[_0xbe14('0x49')](_0x41652d[_0xbe14('0x46')],{'$or':_[_0xbe14('0x38')](_0x4f51f8,function(_0xb2b285){if(_0xb2b285[_0xbe14('0x3c')]!=='VIRTUAL'){var _0x51023a={};_0x51023a[_0xb2b285[_0xbe14('0x35')]]={'$like':'%'+_0x2d9c12[_0xbe14('0x3f')][_0xbe14('0x4a')]+'%'};return _0x51023a;}})});}_0x41652d=_[_0xbe14('0x49')]({},_0x41652d,_0x2d9c12['options']);var _0x28b6e3={'where':_0x41652d[_0xbe14('0x46')]};return db['VoiceContext'][_0xbe14('0x27')](_0x28b6e3)[_0xbe14('0x1c')](function(_0x2d6ee8){_0x539c41[_0xbe14('0x27')]=_0x2d6ee8;if(_0x2d9c12['query']['includeAll']){_0x41652d[_0xbe14('0x4b')]=[{'all':!![]}];}return db[_0xbe14('0x39')]['findAll'](_0x41652d);})['then'](function(_0xca8cdb){_0x539c41[_0xbe14('0x4c')]=_0xca8cdb;return _0x539c41;})[_0xbe14('0x1c')](respondWithFilteredResult(_0x2dfd5a,_0x41652d))[_0xbe14('0x4d')](handleError(_0x2dfd5a,null));};exports[_0xbe14('0x4e')]=function(_0xd04fd5,_0x10cd86){var _0x5a4068={'raw':![],'where':{'id':_0xd04fd5[_0xbe14('0x4f')]['id']}},_0xf32e93={};_0xf32e93[_0xbe14('0x3e')]=_[_0xbe14('0x40')](db[_0xbe14('0x39')]['rawAttributes']);_0xf32e93[_0xbe14('0x3f')]=_[_0xbe14('0x40')](_0xd04fd5[_0xbe14('0x3f')]);_0xf32e93[_0xbe14('0x48')]=_[_0xbe14('0x41')](_0xf32e93[_0xbe14('0x3e')],_0xf32e93['query']);_0x5a4068['attributes']=_[_0xbe14('0x41')](_0xf32e93[_0xbe14('0x3e')],qs[_0xbe14('0x43')](_0xd04fd5['query']['fields']));_0x5a4068[_0xbe14('0x42')]=_0x5a4068[_0xbe14('0x42')]['length']?_0x5a4068[_0xbe14('0x42')]:_0xf32e93[_0xbe14('0x3e')];if(_0xd04fd5['query'][_0xbe14('0x50')]){_0x5a4068['include']=[{'all':!![]}];}_0x5a4068=_[_0xbe14('0x49')]({},_0x5a4068,_0xd04fd5[_0xbe14('0x51')]);return db[_0xbe14('0x39')]['find'](_0x5a4068)[_0xbe14('0x1c')](handleEntityNotFound(_0x10cd86,null))[_0xbe14('0x1c')](respondWithResult(_0x10cd86,null))['catch'](handleError(_0x10cd86,null));};exports[_0xbe14('0x52')]=function(_0x42ca15,_0x2210cc,_0x20c48d){var _0x49322f;return db['VoiceContext'][_0xbe14('0x52')](_0x42ca15[_0xbe14('0x53')],{'raw':!![]})[_0xbe14('0x1c')](function(_0x243b9e){_0x49322f=_0x243b9e;return db[_0xbe14('0x39')][_0xbe14('0x54')]({'raw':!![]});})[_0xbe14('0x1c')](function(_0x56ab61){var _0x72c875=fs[_0xbe14('0x55')](path[_0xbe14('0x56')](config[_0xbe14('0x57')],_0xbe14('0x58')),_0xbe14('0x59'));var _0xd8f78f=ejs[_0xbe14('0x5a')](_0x72c875,{'contexts':_0x56ab61||[]});fs[_0xbe14('0x5b')](_0xbe14('0x5c'),_0xd8f78f);})[_0xbe14('0x1c')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0xbe14('0x1c')](function(){var _0x1bfcbf=_0x42ca15[_0xbe14('0x5d')][_0xbe14('0x5e')]({'plain':!![]});if(!_0x1bfcbf)throw new Error(_0xbe14('0x5f'));if(_0x1bfcbf[_0xbe14('0x60')]===_0xbe14('0x5d')){var _0x22bf69=_0x49322f[_0xbe14('0x5e')]({'plain':!![]});return db[_0xbe14('0x61')][_0xbe14('0x62')]({'where':{'name':_0xbe14('0x32'),'userProfileId':_0x1bfcbf[_0xbe14('0x63')]},'raw':!![]})[_0xbe14('0x1c')](function(_0x1c831a){if(_0x1c831a&&_0x1c831a[_0xbe14('0x64')]===0x0){return db[_0xbe14('0x65')][_0xbe14('0x52')]({'name':_0x22bf69[_0xbe14('0x35')],'resourceId':_0x22bf69['id'],'type':_0x1c831a[_0xbe14('0x35')],'sectionId':_0x1c831a['id']},{})['then'](function(){return _0x49322f;});}else{return _0x49322f;}})[_0xbe14('0x4d')](function(_0x9333d){logger[_0xbe14('0x22')](_0xbe14('0x66'),_0x9333d);throw _0x9333d;});}return _0x49322f;})[_0xbe14('0x1c')](respondWithResult(_0x2210cc,0xc9))[_0xbe14('0x4d')](handleError(_0x2210cc,null));};exports[_0xbe14('0x30')]=function(_0x310311,_0x23cb36,_0x100d43){var _0x5917d5;return db[_0xbe14('0x39')][_0xbe14('0x62')]({'where':{'id':_0x310311[_0xbe14('0x4f')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x23cb36,null))[_0xbe14('0x1c')](saveUpdates(_0x310311['body'],null))[_0xbe14('0x1c')](function(_0x120077){if(_0x120077){_0x5917d5=_0x120077;return db[_0xbe14('0x39')][_0xbe14('0x54')]({'raw':!![]});}})[_0xbe14('0x1c')](function(_0x5ed9b3){var _0x48da19=fs[_0xbe14('0x55')](path[_0xbe14('0x56')](config[_0xbe14('0x57')],_0xbe14('0x58')),_0xbe14('0x59'));var _0xd9dd1c=ejs[_0xbe14('0x5a')](_0x48da19,{'contexts':_0x5ed9b3||[]});fs['writeFileSync'](_0xbe14('0x5c'),_0xd9dd1c);})[_0xbe14('0x1c')](function(){return respondWithRpcPromise(_0xbe14('0x67'),_0xbe14('0x30'),{'module':_0xbe14('0x68')});})[_0xbe14('0x1c')](function(){return _0x5917d5;})[_0xbe14('0x1c')](respondWithResult(_0x23cb36,null))['catch'](handleError(_0x23cb36,null));};exports['destroy']=function(_0x12941d,_0x3c2b58,_0x2d2643){var _0x2510a0;return db[_0xbe14('0x39')][_0xbe14('0x62')]({'where':{'id':_0x12941d[_0xbe14('0x4f')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x3c2b58,null))['then'](removeEntity(_0x3c2b58,null))['then'](function(){return db[_0xbe14('0x39')][_0xbe14('0x54')]({'raw':!![]});})[_0xbe14('0x1c')](function(_0x57729f){var _0x76e91e=fs[_0xbe14('0x55')](path[_0xbe14('0x56')](config[_0xbe14('0x57')],_0xbe14('0x58')),_0xbe14('0x59'));var _0x12e23a=ejs['render'](_0x76e91e,{'contexts':_0x57729f});fs[_0xbe14('0x5b')](_0xbe14('0x5c'),_0x12e23a);return respondWithRpcPromise(_0xbe14('0x67'),_0xbe14('0x31'),{'module':_0xbe14('0x68')});})[_0xbe14('0x4d')](handleError(_0x3c2b58,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 327822c..67225c2 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 _0x9957=['exports','define','VoiceContext','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceContext.attributes'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0xb26123,_0x120616){var _0x49add1=function(_0x201621){while(--_0x201621){_0xb26123['push'](_0xb26123['shift']());}};_0x49add1(++_0x120616);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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 1ae2e5a..13bdfe1 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 _0xf3ee=['info','VoiceContext,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf3ee,0xa2));var _0xef3e=function(_0x2569c9,_0x754e66){_0x2569c9=_0x2569c9-0x0;var _0x49564b=_0xf3ee[_0x2569c9];return _0x49564b;};'use strict';var _=require(_0xef3e('0x0'));var util=require('util');var moment=require(_0xef3e('0x1'));var BPromise=require(_0xef3e('0x2'));var rs=require(_0xef3e('0x3'));var fs=require('fs');var Redis=require(_0xef3e('0x4'));var db=require(_0xef3e('0x5'))['db'];var utils=require(_0xef3e('0x6'));var logger=require(_0xef3e('0x7'))(_0xef3e('0x8'));var config=require('../../config/environment');var jayson=require(_0xef3e('0x9'));var client=jayson[_0xef3e('0xa')][_0xef3e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x551958,_0x723940,_0x2f7625){return new BPromise(function(_0x51094c,_0xd2fb96){return client[_0xef3e('0xc')](_0x551958,_0x2f7625)[_0xef3e('0xd')](function(_0x5673f0){logger[_0xef3e('0xe')](_0xef3e('0xf'),_0x723940,'request\x20sent');logger[_0xef3e('0x10')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x723940,_0xef3e('0x11'),JSON['stringify'](_0x5673f0));if(_0x5673f0[_0xef3e('0x12')]){if(_0x5673f0[_0xef3e('0x12')][_0xef3e('0x13')]===0x1f4){logger[_0xef3e('0x12')](_0xef3e('0xf'),_0x723940,_0x5673f0[_0xef3e('0x12')][_0xef3e('0x14')]);return _0xd2fb96(_0x5673f0[_0xef3e('0x12')][_0xef3e('0x14')]);}logger['error'](_0xef3e('0xf'),_0x723940,_0x5673f0[_0xef3e('0x12')][_0xef3e('0x14')]);return _0x51094c(_0x5673f0[_0xef3e('0x12')][_0xef3e('0x14')]);}else{logger[_0xef3e('0xe')]('VoiceContext,\x20%s,\x20%s',_0x723940,_0xef3e('0x11'));_0x51094c(_0x5673f0['result'][_0xef3e('0x14')]);}})[_0xef3e('0x15')](function(_0x4e6c11){logger[_0xef3e('0x12')]('VoiceContext,\x20%s,\x20%s',_0x723940,_0x4e6c11);_0xd2fb96(_0x4e6c11);});});} \ No newline at end of file +var _0xc686=['debug','error','message','VoiceContext,\x20%s,\x20%s','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x40aaa4,_0x3b22f4){var _0x4e21e5=function(_0x35d2f3){while(--_0x35d2f3){_0x40aaa4['push'](_0x40aaa4['shift']());}};_0x4e21e5(++_0x3b22f4);}(_0xc686,0x148));var _0x6c68=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xc686[_0x40ac5e];return _0x2839d6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6c68('0x0'));var BPromise=require('bluebird');var rs=require(_0x6c68('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c68('0x2'))['db'];var utils=require(_0x6c68('0x3'));var logger=require(_0x6c68('0x4'))(_0x6c68('0x5'));var config=require(_0x6c68('0x6'));var jayson=require(_0x6c68('0x7'));var client=jayson[_0x6c68('0x8')][_0x6c68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3dc035,_0x1e88b0,_0x12e935){return new BPromise(function(_0x394644,_0x5634c4){return client[_0x6c68('0xa')](_0x3dc035,_0x12e935)[_0x6c68('0xb')](function(_0x4ff2ce){logger[_0x6c68('0xc')]('VoiceContext,\x20%s,\x20%s',_0x1e88b0,_0x6c68('0xd'));logger[_0x6c68('0xe')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x1e88b0,_0x6c68('0xd'),JSON['stringify'](_0x4ff2ce));if(_0x4ff2ce[_0x6c68('0xf')]){if(_0x4ff2ce[_0x6c68('0xf')]['code']===0x1f4){logger[_0x6c68('0xf')]('VoiceContext,\x20%s,\x20%s',_0x1e88b0,_0x4ff2ce['error'][_0x6c68('0x10')]);return _0x5634c4(_0x4ff2ce['error'][_0x6c68('0x10')]);}logger[_0x6c68('0xf')](_0x6c68('0x11'),_0x1e88b0,_0x4ff2ce['error'][_0x6c68('0x10')]);return _0x394644(_0x4ff2ce[_0x6c68('0xf')][_0x6c68('0x10')]);}else{logger[_0x6c68('0xc')](_0x6c68('0x11'),_0x1e88b0,'request\x20sent');_0x394644(_0x4ff2ce['result']['message']);}})[_0x6c68('0x12')](function(_0x32cfd2){logger[_0x6c68('0xf')](_0x6c68('0x11'),_0x1e88b0,_0x32cfd2);_0x5634c4(_0x32cfd2);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index a7903f0..6cacfbf 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 _0x19fc=['get','isAuthenticated','index','/:id','post','put','update','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x19fc,0x15d));var _0xc19f=function(_0x22f85a,_0x195ed5){_0x22f85a=_0x22f85a-0x0;var _0xaa717=_0x19fc[_0x22f85a];return _0xaa717;};'use strict';var multer=require(_0xc19f('0x0'));var util=require('util');var path=require(_0xc19f('0x1'));var timeout=require(_0xc19f('0x2'));var express=require(_0xc19f('0x3'));var router=express['Router']();var auth=require(_0xc19f('0x4'));var interaction=require(_0xc19f('0x5'));var config=require(_0xc19f('0x6'));var controller=require(_0xc19f('0x7'));router[_0xc19f('0x8')]('/',auth[_0xc19f('0x9')](),controller[_0xc19f('0xa')]);router[_0xc19f('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc19f('0x8')](_0xc19f('0xb'),auth[_0xc19f('0x9')](),controller['show']);router[_0xc19f('0xc')]('/',auth[_0xc19f('0x9')](),controller['create']);router[_0xc19f('0xd')]('/:id',auth[_0xc19f('0x9')](),controller[_0xc19f('0xe')]);router[_0xc19f('0xf')](_0xc19f('0xb'),auth['isAuthenticated'](),controller[_0xc19f('0x10')]);module['exports']=router; \ No newline at end of file +var _0xcb92=['show','post','create','put','destroy','exports','multer','util','connect-timeout','express','Router','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x5f1cf7,_0x47d9a9){var _0x2ab77b=function(_0x3b8a33){while(--_0x3b8a33){_0x5f1cf7['push'](_0x5f1cf7['shift']());}};_0x2ab77b(++_0x47d9a9);}(_0xcb92,0x1a8));var _0x2cb9=function(_0x184060,_0x2c60bd){_0x184060=_0x184060-0x0;var _0x552579=_0xcb92[_0x184060];return _0x552579;};'use strict';var multer=require(_0x2cb9('0x0'));var util=require(_0x2cb9('0x1'));var path=require('path');var timeout=require(_0x2cb9('0x2'));var express=require(_0x2cb9('0x3'));var router=express[_0x2cb9('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2cb9('0x5'));var controller=require(_0x2cb9('0x6'));router[_0x2cb9('0x7')]('/',auth[_0x2cb9('0x8')](),controller[_0x2cb9('0x9')]);router[_0x2cb9('0x7')](_0x2cb9('0xa'),auth[_0x2cb9('0x8')](),controller[_0x2cb9('0xb')]);router[_0x2cb9('0x7')](_0x2cb9('0xc'),auth[_0x2cb9('0x8')](),controller[_0x2cb9('0xd')]);router[_0x2cb9('0xe')]('/',auth[_0x2cb9('0x8')](),controller[_0x2cb9('0xf')]);router[_0x2cb9('0x10')]('/:id',auth[_0x2cb9('0x8')](),controller['update']);router['delete'](_0x2cb9('0xc'),auth[_0x2cb9('0x8')](),controller[_0x2cb9('0x11')]);module[_0x2cb9('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 1d63ce3..334373f 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 _0xd3c2=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x5a7d12,_0x120519){var _0x37bcf9=function(_0x247048){while(--_0x247048){_0x5a7d12['push'](_0x5a7d12['shift']());}};_0x37bcf9(++_0x120519);}(_0xd3c2,0x1b1));var _0x2d3c=function(_0x2433fc,_0x5ed556){_0x2433fc=_0x2433fc-0x0;var _0x528540=_0xd3c2[_0x2433fc];return _0x528540;};'use strict';var Sequelize=require(_0x2d3c('0x0'));module[_0x2d3c('0x1')]={'privilege':{'type':Sequelize[_0x2d3c('0x2')]},'channel':{'type':Sequelize[_0x2d3c('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x2d3c('0x2')]},'calleridnum':{'type':Sequelize[_0x2d3c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x2d3c('0x2')]},'language':{'type':Sequelize[_0x2d3c('0x2')]},'accountcode':{'type':Sequelize[_0x2d3c('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x2d3c('0x2')]},'priority':{'type':Sequelize[_0x2d3c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x2d3c('0x2')]},'destchannel':{'type':Sequelize[_0x2d3c('0x2')]},'destchannelstate':{'type':Sequelize[_0x2d3c('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x2d3c('0x2')]},'destcalleridname':{'type':Sequelize[_0x2d3c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x2d3c('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x2d3c('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x2d3c('0x2')]},'destexten':{'type':Sequelize[_0x2d3c('0x2')]},'destpriority':{'type':Sequelize[_0x2d3c('0x3')]},'destuniqueid':{'type':Sequelize[_0x2d3c('0x2')]},'destlinkedid':{'type':Sequelize[_0x2d3c('0x2')]},'dialstring':{'type':Sequelize[_0x2d3c('0x2')]},'dialstatus':{'type':Sequelize[_0x2d3c('0x2')]},'starttime':{'type':Sequelize[_0x2d3c('0x4')]},'answertime':{'type':Sequelize[_0x2d3c('0x4')]},'endtime':{'type':Sequelize[_0x2d3c('0x4')]},'lastevent':{'type':Sequelize[_0x2d3c('0x2')],'comment':_0x2d3c('0x5')},'routeId':{'type':Sequelize[_0x2d3c('0x3')]},'duration':{'type':Sequelize[_0x2d3c('0x3')]},'holdtime':{'type':Sequelize[_0x2d3c('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x961b=['sequelize','STRING','INTEGER','DATE'];(function(_0x5cd44e,_0x259986){var _0x2f60a0=function(_0x36c6d5){while(--_0x36c6d5){_0x5cd44e['push'](_0x5cd44e['shift']());}};_0x2f60a0(++_0x259986);}(_0x961b,0xa0));var _0xb961=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x961b[_0x468b0f];return _0x3e74d9;};'use strict';var Sequelize=require(_0xb961('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xb961('0x1')]},'channel':{'type':Sequelize[_0xb961('0x1')]},'channelstate':{'type':Sequelize[_0xb961('0x2')]},'channelstatedesc':{'type':Sequelize[_0xb961('0x1')]},'calleridnum':{'type':Sequelize[_0xb961('0x1')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb961('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb961('0x1')]},'context':{'type':Sequelize[_0xb961('0x1')]},'exten':{'type':Sequelize[_0xb961('0x1')]},'priority':{'type':Sequelize[_0xb961('0x2')]},'uniqueid':{'type':Sequelize[_0xb961('0x1')]},'linkedid':{'type':Sequelize[_0xb961('0x1')]},'destchannel':{'type':Sequelize[_0xb961('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xb961('0x1')]},'destcalleridnum':{'type':Sequelize[_0xb961('0x1')]},'destcalleridname':{'type':Sequelize[_0xb961('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xb961('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xb961('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0xb961('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xb961('0x1')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb961('0x3')]},'endtime':{'type':Sequelize[_0xb961('0x3')]},'lastevent':{'type':Sequelize[_0xb961('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xb961('0x2')]},'duration':{'type':Sequelize[_0xb961('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 24a9b34..eaef50f 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 _0x8e0f=['request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','count','offset','limit','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','VoiceDialReport','findAll','catch','show','rawAttributes','length','find','create','body','update','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x116d23,_0x6e35de){var _0x23fac2=function(_0x11d52c){while(--_0x11d52c){_0x116d23['push'](_0x116d23['shift']());}};_0x23fac2(++_0x6e35de);}(_0x8e0f,0x12f));var _0xf8e0=function(_0xefbd0b,_0x594ac5){_0xefbd0b=_0xefbd0b-0x0;var _0x5d85e1=_0x8e0f[_0xefbd0b];return _0x5d85e1;};'use strict';var pdf=require(_0xf8e0('0x0'));var emlformat=require(_0xf8e0('0x1'));var rimraf=require(_0xf8e0('0x2'));var zipdir=require(_0xf8e0('0x3'));var jsonpatch=require(_0xf8e0('0x4'));var rp=require(_0xf8e0('0x5'));var moment=require(_0xf8e0('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xf8e0('0x7'));var util=require('util');var path=require(_0xf8e0('0x8'));var sox=require(_0xf8e0('0x9'));var csv=require('to-csv');var ejs=require(_0xf8e0('0xa'));var fs=require('fs');var _=require(_0xf8e0('0xb'));var squel=require(_0xf8e0('0xc'));var crypto=require(_0xf8e0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf8e0('0xe'));var toCsv=require(_0xf8e0('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf8e0('0x10'));var authService=require(_0xf8e0('0x11'));var qs=require(_0xf8e0('0x12'));var as=require(_0xf8e0('0x13'));var hardwareService=require(_0xf8e0('0x14'));var logger=require(_0xf8e0('0x15'))(_0xf8e0('0x16'));var utils=require(_0xf8e0('0x17'));var config=require(_0xf8e0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1272ff,_0x113b45){_0x113b45=_0x113b45||0xcc;return function(_0x3edb60){if(_0x3edb60){return _0x1272ff[_0xf8e0('0x19')](_0x113b45);}return _0x1272ff['status'](_0x113b45)[_0xf8e0('0x1a')]();};}function respondWithResult(_0x5e958d,_0xea93ae){_0xea93ae=_0xea93ae||0xc8;return function(_0x443445){if(_0x443445){return _0x5e958d[_0xf8e0('0x1b')](_0xea93ae)['json'](_0x443445);}};}function respondWithFilteredResult(_0x173f34,_0x534844){return function(_0x151990){if(_0x151990){var _0x4de3de=_0x151990[_0xf8e0('0x1c')],_0x430b06=_0x534844[_0xf8e0('0x1d')],_0x12d6f0=_0x534844['offset']+_0x534844[_0xf8e0('0x1e')],_0x3a5140;if(_0x12d6f0>=_0x4de3de){_0x12d6f0=_0x4de3de;_0x3a5140=0xc8;}else{_0x3a5140=0xce;}_0x173f34['status'](_0x3a5140);return _0x173f34[_0xf8e0('0x1f')](_0xf8e0('0x20'),_0x430b06+'-'+_0x12d6f0+'/'+_0x4de3de)[_0xf8e0('0x21')](_0x151990);}return null;};}function patchUpdates(_0x366925){return function(_0x548049){try{jsonpatch['apply'](_0x548049,_0x366925,!![]);}catch(_0x11c6bb){return BPromise[_0xf8e0('0x22')](_0x11c6bb);}return _0x548049[_0xf8e0('0x23')]();};}function saveUpdates(_0x1809a4,_0x5e5ad6){return function(_0x21831e){if(_0x21831e){return _0x21831e['update'](_0x1809a4)[_0xf8e0('0x24')](function(_0x31da2f){return _0x31da2f;});}return null;};}function removeEntity(_0x5d8089,_0x2e3826){return function(_0x1b7c3c){if(_0x1b7c3c){return _0x1b7c3c[_0xf8e0('0x25')]()[_0xf8e0('0x24')](function(){_0x5d8089['status'](0xcc)[_0xf8e0('0x1a')]();});}};}function handleEntityNotFound(_0x8d9993,_0x4cb871){return function(_0x4d5255){if(!_0x4d5255){_0x8d9993['sendStatus'](0x194);}return _0x4d5255;};}function handleError(_0x13a022,_0x2fe292){_0x2fe292=_0x2fe292||0x1f4;return function(_0x377503){logger[_0xf8e0('0x26')](_0x377503[_0xf8e0('0x27')]);if(_0x377503[_0xf8e0('0x28')]){delete _0x377503[_0xf8e0('0x28')];}_0x13a022['status'](_0x2fe292)[_0xf8e0('0x29')](_0x377503);};}exports[_0xf8e0('0x2a')]=function(_0x5b6a97,_0x2458a6){var _0x17436a={},_0x37bacd={},_0x257362={'count':0x0,'rows':[]};var _0x585d58=_[_0xf8e0('0x2b')](db['VoiceDialReport']['rawAttributes'],function(_0xb1baa7){return{'name':_0xb1baa7[_0xf8e0('0x2c')],'type':_0xb1baa7[_0xf8e0('0x2d')][_0xf8e0('0x2e')]};});_0x37bacd[_0xf8e0('0x2f')]=_[_0xf8e0('0x2b')](_0x585d58,_0xf8e0('0x28'));_0x37bacd[_0xf8e0('0x30')]=_[_0xf8e0('0x31')](_0x5b6a97[_0xf8e0('0x30')]);_0x37bacd['filters']=_[_0xf8e0('0x32')](_0x37bacd[_0xf8e0('0x2f')],_0x37bacd[_0xf8e0('0x30')]);_0x17436a['attributes']=_[_0xf8e0('0x32')](_0x37bacd['model'],qs[_0xf8e0('0x33')](_0x5b6a97[_0xf8e0('0x30')]['fields']));_0x17436a[_0xf8e0('0x34')]=_0x17436a[_0xf8e0('0x34')]['length']?_0x17436a[_0xf8e0('0x34')]:_0x37bacd[_0xf8e0('0x2f')];if(!_0x5b6a97['query'][_0xf8e0('0x35')]('nolimit')){_0x17436a[_0xf8e0('0x1e')]=qs['limit'](_0x5b6a97['query'][_0xf8e0('0x1e')]);_0x17436a[_0xf8e0('0x1d')]=qs[_0xf8e0('0x1d')](_0x5b6a97[_0xf8e0('0x30')][_0xf8e0('0x1d')]);}_0x17436a[_0xf8e0('0x36')]=qs[_0xf8e0('0x37')](_0x5b6a97[_0xf8e0('0x30')][_0xf8e0('0x37')]);_0x17436a[_0xf8e0('0x38')]=qs[_0xf8e0('0x39')](_[_0xf8e0('0x3a')](_0x5b6a97[_0xf8e0('0x30')],_0x37bacd['filters']),_0x585d58);if(_0x5b6a97[_0xf8e0('0x30')][_0xf8e0('0x3b')]){_0x17436a['where']=_['merge'](_0x17436a[_0xf8e0('0x38')],{'$or':_['map'](_0x585d58,function(_0x4ada71){if(_0x4ada71[_0xf8e0('0x2d')]!==_0xf8e0('0x3c')){var _0x17ff76={};_0x17ff76[_0x4ada71[_0xf8e0('0x28')]]={'$like':'%'+_0x5b6a97['query'][_0xf8e0('0x3b')]+'%'};return _0x17ff76;}})});}_0x17436a=_[_0xf8e0('0x3d')]({},_0x17436a,_0x5b6a97[_0xf8e0('0x3e')]);var _0x154253={'where':_0x17436a[_0xf8e0('0x38')]};return db['VoiceDialReport'][_0xf8e0('0x1c')](_0x154253)[_0xf8e0('0x24')](function(_0x8b9478){_0x257362[_0xf8e0('0x1c')]=_0x8b9478;if(_0x5b6a97[_0xf8e0('0x30')][_0xf8e0('0x3f')]){_0x17436a[_0xf8e0('0x40')]=[{'all':!![]}];}return db[_0xf8e0('0x41')][_0xf8e0('0x42')](_0x17436a);})[_0xf8e0('0x24')](function(_0x13f517){_0x257362['rows']=_0x13f517;return _0x257362;})['then'](respondWithFilteredResult(_0x2458a6,_0x17436a))[_0xf8e0('0x43')](handleError(_0x2458a6,null));};exports[_0xf8e0('0x44')]=function(_0x3a190e,_0x4e1e2f){var _0x3bba78={'raw':!![],'where':{'id':_0x3a190e['params']['id']}},_0x56a89b={};_0x56a89b[_0xf8e0('0x2f')]=_[_0xf8e0('0x31')](db[_0xf8e0('0x41')][_0xf8e0('0x45')]);_0x56a89b[_0xf8e0('0x30')]=_[_0xf8e0('0x31')](_0x3a190e[_0xf8e0('0x30')]);_0x56a89b[_0xf8e0('0x39')]=_[_0xf8e0('0x32')](_0x56a89b[_0xf8e0('0x2f')],_0x56a89b[_0xf8e0('0x30')]);_0x3bba78[_0xf8e0('0x34')]=_[_0xf8e0('0x32')](_0x56a89b[_0xf8e0('0x2f')],qs[_0xf8e0('0x33')](_0x3a190e[_0xf8e0('0x30')][_0xf8e0('0x33')]));_0x3bba78[_0xf8e0('0x34')]=_0x3bba78[_0xf8e0('0x34')][_0xf8e0('0x46')]?_0x3bba78[_0xf8e0('0x34')]:_0x56a89b[_0xf8e0('0x2f')];if(_0x3a190e[_0xf8e0('0x30')][_0xf8e0('0x3f')]){_0x3bba78[_0xf8e0('0x40')]=[{'all':!![]}];}_0x3bba78=_['merge']({},_0x3bba78,_0x3a190e[_0xf8e0('0x3e')]);return db['VoiceDialReport'][_0xf8e0('0x47')](_0x3bba78)[_0xf8e0('0x24')](handleEntityNotFound(_0x4e1e2f,null))[_0xf8e0('0x24')](respondWithResult(_0x4e1e2f,null))[_0xf8e0('0x43')](handleError(_0x4e1e2f,null));};exports[_0xf8e0('0x48')]=function(_0x2f2a24,_0x4790f7){return db[_0xf8e0('0x41')][_0xf8e0('0x48')](_0x2f2a24[_0xf8e0('0x49')],{})[_0xf8e0('0x24')](respondWithResult(_0x4790f7,0xc9))[_0xf8e0('0x43')](handleError(_0x4790f7,null));};exports[_0xf8e0('0x4a')]=function(_0x49cc39,_0x3f3a8a){if(_0x49cc39[_0xf8e0('0x49')]['id']){delete _0x49cc39['body']['id'];}return db[_0xf8e0('0x41')][_0xf8e0('0x47')]({'where':{'id':_0x49cc39[_0xf8e0('0x4b')]['id']}})[_0xf8e0('0x24')](handleEntityNotFound(_0x3f3a8a,null))[_0xf8e0('0x24')](saveUpdates(_0x49cc39[_0xf8e0('0x49')],null))[_0xf8e0('0x24')](respondWithResult(_0x3f3a8a,null))[_0xf8e0('0x43')](handleError(_0x3f3a8a,null));};exports['destroy']=function(_0x576804,_0x77ac7f){return db['VoiceDialReport'][_0xf8e0('0x47')]({'where':{'id':_0x576804[_0xf8e0('0x4b')]['id']}})[_0xf8e0('0x24')](handleEntityNotFound(_0x77ac7f,null))[_0xf8e0('0x24')](removeEntity(_0x77ac7f,null))['catch'](handleError(_0x77ac7f,null));};exports[_0xf8e0('0x4c')]=function(_0x543707,_0xf314a5){return db[_0xf8e0('0x41')]['describe']()[_0xf8e0('0x24')](respondWithResult(_0xf314a5,null))[_0xf8e0('0x43')](handleError(_0xf314a5,null));}; \ No newline at end of file +var _0xb26e=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','VoiceDialReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','where','pick','merge','type','filter','options','includeAll','include','findAll','rows','show','params','create','body','catch','find','describe','html-pdf','fast-json-patch','request-promise'];(function(_0x25451a,_0x11c823){var _0x20a8aa=function(_0xc99869){while(--_0xc99869){_0x25451a['push'](_0x25451a['shift']());}};_0x20a8aa(++_0x11c823);}(_0xb26e,0x11d));var _0xeb26=function(_0x5ccf1,_0x28a9ed){_0x5ccf1=_0x5ccf1-0x0;var _0x2d6b4d=_0xb26e[_0x5ccf1];return _0x2d6b4d;};'use strict';var pdf=require(_0xeb26('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xeb26('0x1'));var rp=require(_0xeb26('0x2'));var moment=require('moment');var BPromise=require(_0xeb26('0x3'));var Mustache=require(_0xeb26('0x4'));var util=require(_0xeb26('0x5'));var path=require(_0xeb26('0x6'));var sox=require(_0xeb26('0x7'));var csv=require(_0xeb26('0x8'));var ejs=require(_0xeb26('0x9'));var fs=require('fs');var _=require(_0xeb26('0xa'));var squel=require(_0xeb26('0xb'));var crypto=require(_0xeb26('0xc'));var jsforce=require(_0xeb26('0xd'));var deskjs=require(_0xeb26('0xe'));var toCsv=require(_0xeb26('0x8'));var querystring=require('querystring');var Papa=require(_0xeb26('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xeb26('0x10'));var as=require(_0xeb26('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeb26('0x12'))('api');var utils=require(_0xeb26('0x13'));var config=require(_0xeb26('0x14'));var db=require(_0xeb26('0x15'))['db'];function respondWithStatusCode(_0xff52af,_0x4540da){_0x4540da=_0x4540da||0xcc;return function(_0x3053a5){if(_0x3053a5){return _0xff52af[_0xeb26('0x16')](_0x4540da);}return _0xff52af['status'](_0x4540da)[_0xeb26('0x17')]();};}function respondWithResult(_0xf791fe,_0x4c7112){_0x4c7112=_0x4c7112||0xc8;return function(_0x3d8643){if(_0x3d8643){return _0xf791fe[_0xeb26('0x18')](_0x4c7112)[_0xeb26('0x19')](_0x3d8643);}};}function respondWithFilteredResult(_0x1e5bea,_0x54740f){return function(_0x17e9d2){if(_0x17e9d2){var _0x1a07ac=_0x17e9d2[_0xeb26('0x1a')],_0x76e697=_0x54740f[_0xeb26('0x1b')],_0x1c0a56=_0x54740f[_0xeb26('0x1b')]+_0x54740f['limit'],_0x473b97;if(_0x1c0a56>=_0x1a07ac){_0x1c0a56=_0x1a07ac;_0x473b97=0xc8;}else{_0x473b97=0xce;}_0x1e5bea[_0xeb26('0x18')](_0x473b97);return _0x1e5bea['set'](_0xeb26('0x1c'),_0x76e697+'-'+_0x1c0a56+'/'+_0x1a07ac)[_0xeb26('0x19')](_0x17e9d2);}return null;};}function patchUpdates(_0x703d48){return function(_0x48e056){try{jsonpatch[_0xeb26('0x1d')](_0x48e056,_0x703d48,!![]);}catch(_0xe15415){return BPromise[_0xeb26('0x1e')](_0xe15415);}return _0x48e056['save']();};}function saveUpdates(_0x1451b5,_0x413108){return function(_0x32dad3){if(_0x32dad3){return _0x32dad3[_0xeb26('0x1f')](_0x1451b5)[_0xeb26('0x20')](function(_0x3a042e){return _0x3a042e;});}return null;};}function removeEntity(_0x2e3f7b,_0x20392f){return function(_0x2dc7ee){if(_0x2dc7ee){return _0x2dc7ee[_0xeb26('0x21')]()[_0xeb26('0x20')](function(){_0x2e3f7b[_0xeb26('0x18')](0xcc)[_0xeb26('0x17')]();});}};}function handleEntityNotFound(_0x40bce7,_0xde4668){return function(_0xcf9673){if(!_0xcf9673){_0x40bce7['sendStatus'](0x194);}return _0xcf9673;};}function handleError(_0x25384d,_0x36ae32){_0x36ae32=_0x36ae32||0x1f4;return function(_0x4c8de2){logger[_0xeb26('0x22')](_0x4c8de2[_0xeb26('0x23')]);if(_0x4c8de2[_0xeb26('0x24')]){delete _0x4c8de2['name'];}_0x25384d[_0xeb26('0x18')](_0x36ae32)[_0xeb26('0x25')](_0x4c8de2);};}exports[_0xeb26('0x26')]=function(_0x2e3bc2,_0x40dc54){var _0x3e3785={},_0x2b2963={},_0x596350={'count':0x0,'rows':[]};var _0x34bfa9=_['map'](db[_0xeb26('0x27')][_0xeb26('0x28')],function(_0x84d448){return{'name':_0x84d448[_0xeb26('0x29')],'type':_0x84d448['type'][_0xeb26('0x2a')]};});_0x2b2963[_0xeb26('0x2b')]=_[_0xeb26('0x2c')](_0x34bfa9,_0xeb26('0x24'));_0x2b2963[_0xeb26('0x2d')]=_[_0xeb26('0x2e')](_0x2e3bc2[_0xeb26('0x2d')]);_0x2b2963[_0xeb26('0x2f')]=_[_0xeb26('0x30')](_0x2b2963[_0xeb26('0x2b')],_0x2b2963[_0xeb26('0x2d')]);_0x3e3785[_0xeb26('0x31')]=_[_0xeb26('0x30')](_0x2b2963[_0xeb26('0x2b')],qs['fields'](_0x2e3bc2[_0xeb26('0x2d')][_0xeb26('0x32')]));_0x3e3785[_0xeb26('0x31')]=_0x3e3785[_0xeb26('0x31')][_0xeb26('0x33')]?_0x3e3785[_0xeb26('0x31')]:_0x2b2963[_0xeb26('0x2b')];if(!_0x2e3bc2[_0xeb26('0x2d')]['hasOwnProperty'](_0xeb26('0x34'))){_0x3e3785['limit']=qs[_0xeb26('0x35')](_0x2e3bc2[_0xeb26('0x2d')][_0xeb26('0x35')]);_0x3e3785['offset']=qs['offset'](_0x2e3bc2[_0xeb26('0x2d')]['offset']);}_0x3e3785[_0xeb26('0x36')]=qs['sort'](_0x2e3bc2['query']['sort']);_0x3e3785[_0xeb26('0x37')]=qs[_0xeb26('0x2f')](_[_0xeb26('0x38')](_0x2e3bc2[_0xeb26('0x2d')],_0x2b2963[_0xeb26('0x2f')]),_0x34bfa9);if(_0x2e3bc2[_0xeb26('0x2d')]['filter']){_0x3e3785[_0xeb26('0x37')]=_[_0xeb26('0x39')](_0x3e3785['where'],{'$or':_[_0xeb26('0x2c')](_0x34bfa9,function(_0x5b6874){if(_0x5b6874[_0xeb26('0x3a')]!=='VIRTUAL'){var _0x1cc068={};_0x1cc068[_0x5b6874[_0xeb26('0x24')]]={'$like':'%'+_0x2e3bc2[_0xeb26('0x2d')][_0xeb26('0x3b')]+'%'};return _0x1cc068;}})});}_0x3e3785=_[_0xeb26('0x39')]({},_0x3e3785,_0x2e3bc2[_0xeb26('0x3c')]);var _0xfa5d7c={'where':_0x3e3785[_0xeb26('0x37')]};return db[_0xeb26('0x27')][_0xeb26('0x1a')](_0xfa5d7c)[_0xeb26('0x20')](function(_0x18ed64){_0x596350[_0xeb26('0x1a')]=_0x18ed64;if(_0x2e3bc2['query'][_0xeb26('0x3d')]){_0x3e3785[_0xeb26('0x3e')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xeb26('0x3f')](_0x3e3785);})[_0xeb26('0x20')](function(_0x355bbe){_0x596350[_0xeb26('0x40')]=_0x355bbe;return _0x596350;})['then'](respondWithFilteredResult(_0x40dc54,_0x3e3785))['catch'](handleError(_0x40dc54,null));};exports[_0xeb26('0x41')]=function(_0x94698a,_0x39effe){var _0x8017fb={'raw':!![],'where':{'id':_0x94698a[_0xeb26('0x42')]['id']}},_0x4db7d5={};_0x4db7d5[_0xeb26('0x2b')]=_[_0xeb26('0x2e')](db[_0xeb26('0x27')][_0xeb26('0x28')]);_0x4db7d5[_0xeb26('0x2d')]=_[_0xeb26('0x2e')](_0x94698a[_0xeb26('0x2d')]);_0x4db7d5[_0xeb26('0x2f')]=_[_0xeb26('0x30')](_0x4db7d5['model'],_0x4db7d5['query']);_0x8017fb['attributes']=_[_0xeb26('0x30')](_0x4db7d5[_0xeb26('0x2b')],qs['fields'](_0x94698a['query'][_0xeb26('0x32')]));_0x8017fb[_0xeb26('0x31')]=_0x8017fb[_0xeb26('0x31')]['length']?_0x8017fb[_0xeb26('0x31')]:_0x4db7d5['model'];if(_0x94698a['query'][_0xeb26('0x3d')]){_0x8017fb[_0xeb26('0x3e')]=[{'all':!![]}];}_0x8017fb=_[_0xeb26('0x39')]({},_0x8017fb,_0x94698a[_0xeb26('0x3c')]);return db[_0xeb26('0x27')]['find'](_0x8017fb)[_0xeb26('0x20')](handleEntityNotFound(_0x39effe,null))[_0xeb26('0x20')](respondWithResult(_0x39effe,null))['catch'](handleError(_0x39effe,null));};exports['create']=function(_0x2c946a,_0x37827a){return db[_0xeb26('0x27')][_0xeb26('0x43')](_0x2c946a[_0xeb26('0x44')],{})[_0xeb26('0x20')](respondWithResult(_0x37827a,0xc9))[_0xeb26('0x45')](handleError(_0x37827a,null));};exports[_0xeb26('0x1f')]=function(_0xaee67a,_0x1a1d38){if(_0xaee67a[_0xeb26('0x44')]['id']){delete _0xaee67a[_0xeb26('0x44')]['id'];}return db[_0xeb26('0x27')][_0xeb26('0x46')]({'where':{'id':_0xaee67a[_0xeb26('0x42')]['id']}})[_0xeb26('0x20')](handleEntityNotFound(_0x1a1d38,null))[_0xeb26('0x20')](saveUpdates(_0xaee67a[_0xeb26('0x44')],null))[_0xeb26('0x20')](respondWithResult(_0x1a1d38,null))['catch'](handleError(_0x1a1d38,null));};exports[_0xeb26('0x21')]=function(_0x3e1979,_0x562bc5){return db[_0xeb26('0x27')][_0xeb26('0x46')]({'where':{'id':_0x3e1979[_0xeb26('0x42')]['id']}})[_0xeb26('0x20')](handleEntityNotFound(_0x562bc5,null))[_0xeb26('0x20')](removeEntity(_0x562bc5,null))[_0xeb26('0x45')](handleError(_0x562bc5,null));};exports[_0xeb26('0x47')]=function(_0x1a2bf0,_0x12152b){return db['VoiceDialReport'][_0xeb26('0x47')]()[_0xeb26('0x20')](respondWithResult(_0x12152b,null))[_0xeb26('0x45')](handleError(_0x12152b,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 453e8e2..f3a9123 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 _0x30d4=['uniqueid','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x30d4,0x1ef));var _0x430d=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x30d4[_0xd1d19a];return _0x52a79d;};'use strict';var _=require('lodash');var util=require(_0x430d('0x0'));var logger=require(_0x430d('0x1'))(_0x430d('0x2'));var moment=require('moment');var BPromise=require(_0x430d('0x3'));var rp=require(_0x430d('0x4'));var fs=require('fs');var path=require(_0x430d('0x5'));var rimraf=require('rimraf');var config=require(_0x430d('0x6'));var attributes=require(_0x430d('0x7'));module[_0x430d('0x8')]=function(_0xfa492b,_0x1bc6ab){return _0xfa492b[_0x430d('0x9')](_0x430d('0xa'),attributes,{'tableName':_0x430d('0xb'),'paranoid':![],'indexes':[{'fields':[_0x430d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe547=['define','VoiceDialReport','report_dial','uniqueid','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xe547,0x1e4));var _0x7e54=function(_0x1dd3ae,_0x5cc628){_0x1dd3ae=_0x1dd3ae-0x0;var _0x1fbe84=_0xe547[_0x1dd3ae];return _0x1fbe84;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7e54('0x0'));var moment=require(_0x7e54('0x1'));var BPromise=require(_0x7e54('0x2'));var rp=require(_0x7e54('0x3'));var fs=require('fs');var path=require(_0x7e54('0x4'));var rimraf=require(_0x7e54('0x5'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x142d01,_0x3b2674){return _0x142d01[_0x7e54('0x6')](_0x7e54('0x7'),attributes,{'tableName':_0x7e54('0x8'),'paranoid':![],'indexes':[{'fields':[_0x7e54('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index cce65b4..536bb68 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 _0xda65=['info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','catch','UpdateVoiceDialReport','update','where','attributes','limit','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x3cb6dc,_0x120dd3){var _0x47ec89=function(_0x55150a){while(--_0x55150a){_0x3cb6dc['push'](_0x3cb6dc['shift']());}};_0x47ec89(++_0x120dd3);}(_0xda65,0x1d0));var _0x5da6=function(_0x322cca,_0x1c6bd7){_0x322cca=_0x322cca-0x0;var _0x2df293=_0xda65[_0x322cca];return _0x2df293;};'use strict';var _=require(_0x5da6('0x0'));var util=require(_0x5da6('0x1'));var moment=require(_0x5da6('0x2'));var BPromise=require('bluebird');var rs=require(_0x5da6('0x3'));var fs=require('fs');var Redis=require(_0x5da6('0x4'));var db=require(_0x5da6('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5da6('0x6'));var config=require(_0x5da6('0x7'));var jayson=require(_0x5da6('0x8'));var client=jayson[_0x5da6('0x9')][_0x5da6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51924c,_0x35aff9,_0x4a7040){return new BPromise(function(_0x55108e,_0x40722c){return client['request'](_0x51924c,_0x4a7040)[_0x5da6('0xb')](function(_0x20cb14){logger[_0x5da6('0xc')](_0x5da6('0xd'),_0x35aff9,_0x5da6('0xe'));logger[_0x5da6('0xf')](_0x5da6('0x10'),_0x35aff9,_0x5da6('0xe'),JSON['stringify'](_0x20cb14));if(_0x20cb14[_0x5da6('0x11')]){if(_0x20cb14[_0x5da6('0x11')][_0x5da6('0x12')]===0x1f4){logger[_0x5da6('0x11')](_0x5da6('0xd'),_0x35aff9,_0x20cb14[_0x5da6('0x11')][_0x5da6('0x13')]);return _0x40722c(_0x20cb14[_0x5da6('0x11')][_0x5da6('0x13')]);}logger['error'](_0x5da6('0xd'),_0x35aff9,_0x20cb14[_0x5da6('0x11')][_0x5da6('0x13')]);return _0x55108e(_0x20cb14[_0x5da6('0x11')][_0x5da6('0x13')]);}else{logger[_0x5da6('0xc')](_0x5da6('0xd'),_0x35aff9,_0x5da6('0xe'));_0x55108e(_0x20cb14[_0x5da6('0x14')][_0x5da6('0x13')]);}})['catch'](function(_0x5207e5){logger[_0x5da6('0x11')](_0x5da6('0xd'),_0x35aff9,_0x5207e5);_0x40722c(_0x5207e5);});});}exports[_0x5da6('0x15')]=function(_0x4c3b2d){var _0x4bc49a=this;return new Promise(function(_0x4b42e4,_0x394c63){return db[_0x5da6('0x16')][_0x5da6('0x17')](_0x4c3b2d[_0x5da6('0x18')],{'raw':_0x4c3b2d['options']?_0x4c3b2d[_0x5da6('0x19')][_0x5da6('0x1a')]===undefined?!![]:![]:!![]})[_0x5da6('0xb')](function(_0x24500d){logger[_0x5da6('0xc')](_0x5da6('0x15'),_0x4c3b2d);logger[_0x5da6('0xf')](_0x5da6('0x15'),_0x4c3b2d,JSON['stringify'](_0x24500d));_0x4b42e4(_0x24500d);})[_0x5da6('0x1b')](function(_0x5ad81b){logger[_0x5da6('0x11')](_0x5da6('0x15'),_0x5ad81b[_0x5da6('0x13')],_0x4c3b2d);_0x394c63(_0x4bc49a[_0x5da6('0x11')](0x1f4,_0x5ad81b[_0x5da6('0x13')]));});});};exports[_0x5da6('0x1c')]=function(_0x1d394e){var _0x2daa71=this;return new Promise(function(_0x5dbe79,_0x51a428){return db[_0x5da6('0x16')][_0x5da6('0x1d')](_0x1d394e['body'],{'raw':_0x1d394e['options']?_0x1d394e[_0x5da6('0x19')][_0x5da6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d394e[_0x5da6('0x19')]?_0x1d394e[_0x5da6('0x19')][_0x5da6('0x1e')]||null:null,'attributes':_0x1d394e['options']?_0x1d394e[_0x5da6('0x19')][_0x5da6('0x1f')]||null:null,'limit':_0x1d394e[_0x5da6('0x19')]?_0x1d394e['options'][_0x5da6('0x20')]||null:null})[_0x5da6('0xb')](function(_0x4fe9b3){logger[_0x5da6('0xc')](_0x5da6('0x1c'),_0x1d394e);logger[_0x5da6('0xf')](_0x5da6('0x1c'),_0x1d394e,JSON[_0x5da6('0x21')](_0x4fe9b3));_0x5dbe79(_0x4fe9b3);})[_0x5da6('0x1b')](function(_0x26cb1a){logger[_0x5da6('0x11')](_0x5da6('0x1c'),_0x26cb1a[_0x5da6('0x13')],_0x1d394e);_0x51a428(_0x2daa71[_0x5da6('0x11')](0x1f4,_0x26cb1a[_0x5da6('0x13')]));});});}; \ No newline at end of file +var _0x4a47=['error','code','message','VoiceDialReport,\x20%s,\x20%s','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','stringify','UpdateVoiceDialReport','update','raw','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s'];(function(_0x463960,_0x23af9e){var _0x48ebe2=function(_0x4ce71a){while(--_0x4ce71a){_0x463960['push'](_0x463960['shift']());}};_0x48ebe2(++_0x23af9e);}(_0x4a47,0xb5));var _0x74a4=function(_0x1c33dc,_0x177c7e){_0x1c33dc=_0x1c33dc-0x0;var _0x405580=_0x4a47[_0x1c33dc];return _0x405580;};'use strict';var _=require(_0x74a4('0x0'));var util=require(_0x74a4('0x1'));var moment=require(_0x74a4('0x2'));var BPromise=require(_0x74a4('0x3'));var rs=require(_0x74a4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74a4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x74a4('0x6'))(_0x74a4('0x7'));var config=require('../../config/environment');var jayson=require(_0x74a4('0x8'));var client=jayson[_0x74a4('0x9')][_0x74a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ebaa6,_0x41ef5a,_0x55e8a1){return new BPromise(function(_0x3122ba,_0x58e307){return client[_0x74a4('0xb')](_0x4ebaa6,_0x55e8a1)[_0x74a4('0xc')](function(_0x19f82b){logger[_0x74a4('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x41ef5a,_0x74a4('0xe'));logger[_0x74a4('0xf')](_0x74a4('0x10'),_0x41ef5a,_0x74a4('0xe'),JSON['stringify'](_0x19f82b));if(_0x19f82b[_0x74a4('0x11')]){if(_0x19f82b[_0x74a4('0x11')][_0x74a4('0x12')]===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x41ef5a,_0x19f82b[_0x74a4('0x11')][_0x74a4('0x13')]);return _0x58e307(_0x19f82b[_0x74a4('0x11')][_0x74a4('0x13')]);}logger[_0x74a4('0x11')](_0x74a4('0x14'),_0x41ef5a,_0x19f82b[_0x74a4('0x11')][_0x74a4('0x13')]);return _0x3122ba(_0x19f82b[_0x74a4('0x11')][_0x74a4('0x13')]);}else{logger[_0x74a4('0xd')](_0x74a4('0x14'),_0x41ef5a,_0x74a4('0xe'));_0x3122ba(_0x19f82b[_0x74a4('0x15')][_0x74a4('0x13')]);}})[_0x74a4('0x16')](function(_0x5d6dad){logger[_0x74a4('0x11')](_0x74a4('0x14'),_0x41ef5a,_0x5d6dad);_0x58e307(_0x5d6dad);});});}exports[_0x74a4('0x17')]=function(_0x2c9130){var _0x55cf53=this;return new Promise(function(_0xf224ef,_0x105998){return db[_0x74a4('0x18')][_0x74a4('0x19')](_0x2c9130['body'],{'raw':_0x2c9130[_0x74a4('0x1a')]?_0x2c9130[_0x74a4('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x74a4('0xc')](function(_0x2d3075){logger['info']('CreateVoiceDialReport',_0x2c9130);logger[_0x74a4('0xf')](_0x74a4('0x17'),_0x2c9130,JSON[_0x74a4('0x1b')](_0x2d3075));_0xf224ef(_0x2d3075);})[_0x74a4('0x16')](function(_0x484802){logger[_0x74a4('0x11')]('CreateVoiceDialReport',_0x484802['message'],_0x2c9130);_0x105998(_0x55cf53[_0x74a4('0x11')](0x1f4,_0x484802[_0x74a4('0x13')]));});});};exports[_0x74a4('0x1c')]=function(_0x5c3362){var _0x22f0fa=this;return new Promise(function(_0x387d89,_0x47c200){return db[_0x74a4('0x18')][_0x74a4('0x1d')](_0x5c3362['body'],{'raw':_0x5c3362[_0x74a4('0x1a')]?_0x5c3362[_0x74a4('0x1a')][_0x74a4('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c3362['options']?_0x5c3362[_0x74a4('0x1a')][_0x74a4('0x1f')]||null:null,'attributes':_0x5c3362[_0x74a4('0x1a')]?_0x5c3362[_0x74a4('0x1a')][_0x74a4('0x20')]||null:null,'limit':_0x5c3362[_0x74a4('0x1a')]?_0x5c3362['options']['limit']||null:null})[_0x74a4('0xc')](function(_0x4fe101){logger[_0x74a4('0xd')]('UpdateVoiceDialReport',_0x5c3362);logger[_0x74a4('0xf')]('UpdateVoiceDialReport',_0x5c3362,JSON['stringify'](_0x4fe101));_0x387d89(_0x4fe101);})[_0x74a4('0x16')](function(_0x376f29){logger[_0x74a4('0x11')]('UpdateVoiceDialReport',_0x376f29['message'],_0x5c3362);_0x47c200(_0x22f0fa['error'](0x1f4,_0x376f29['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 7e66c76..e3805a4 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 _0xd64a=['addApplications','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','post','create','/:id/applications'];(function(_0x4c7116,_0x16b07e){var _0xa171b0=function(_0x101342){while(--_0x101342){_0x4c7116['push'](_0x4c7116['shift']());}};_0xa171b0(++_0x16b07e);}(_0xd64a,0x1e8));var _0xad64=function(_0x25e747,_0x365883){_0x25e747=_0x25e747-0x0;var _0x1292a5=_0xd64a[_0x25e747];return _0x1292a5;};'use strict';var multer=require(_0xad64('0x0'));var util=require(_0xad64('0x1'));var path=require(_0xad64('0x2'));var timeout=require(_0xad64('0x3'));var express=require(_0xad64('0x4'));var router=express[_0xad64('0x5')]();var auth=require(_0xad64('0x6'));var interaction=require(_0xad64('0x7'));var config=require(_0xad64('0x8'));var controller=require('./voiceExtension.controller');router['get']('/',auth[_0xad64('0x9')](),controller['index']);router[_0xad64('0xa')](_0xad64('0xb'),auth[_0xad64('0x9')](),controller[_0xad64('0xc')]);router[_0xad64('0xd')]('/',auth[_0xad64('0x9')](),controller[_0xad64('0xe')]);router[_0xad64('0xd')](_0xad64('0xf'),auth[_0xad64('0x9')](),controller[_0xad64('0x10')]);router['put'](_0xad64('0xb'),auth[_0xad64('0x9')](),controller[_0xad64('0x11')]);router[_0xad64('0x12')](_0xad64('0xb'),auth['isAuthenticated'](),controller[_0xad64('0x13')]);module[_0xad64('0x14')]=router; \ No newline at end of file +var _0xe112=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','index','get','show','post','create','/:id/applications','addApplications','put'];(function(_0x1362f2,_0x532559){var _0xc54836=function(_0x3ca961){while(--_0x3ca961){_0x1362f2['push'](_0x1362f2['shift']());}};_0xc54836(++_0x532559);}(_0xe112,0xf6));var _0x2e11=function(_0xbd6a4d,_0x5f29ed){_0xbd6a4d=_0xbd6a4d-0x0;var _0x5651cf=_0xe112[_0xbd6a4d];return _0x5651cf;};'use strict';var multer=require('multer');var util=require(_0x2e11('0x0'));var path=require(_0x2e11('0x1'));var timeout=require(_0x2e11('0x2'));var express=require(_0x2e11('0x3'));var router=express[_0x2e11('0x4')]();var auth=require(_0x2e11('0x5'));var interaction=require(_0x2e11('0x6'));var config=require(_0x2e11('0x7'));var controller=require(_0x2e11('0x8'));router['get']('/',auth[_0x2e11('0x9')](),controller[_0x2e11('0xa')]);router[_0x2e11('0xb')]('/:id',auth[_0x2e11('0x9')](),controller[_0x2e11('0xc')]);router[_0x2e11('0xd')]('/',auth[_0x2e11('0x9')](),controller[_0x2e11('0xe')]);router[_0x2e11('0xd')](_0x2e11('0xf'),auth[_0x2e11('0x9')](),controller[_0x2e11('0x10')]);router[_0x2e11('0x11')](_0x2e11('0x12'),auth['isAuthenticated'](),controller[_0x2e11('0x13')]);router[_0x2e11('0x14')](_0x2e11('0x12'),auth[_0x2e11('0x9')](),controller['destroy']);module[_0x2e11('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 436fb76..e66ed55 100644 --- a/server/api/voiceExtension/voiceExtension.attributes.js +++ b/server/api/voiceExtension/voiceExtension.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x26daa0,_0x22afee){var _0x536de2=function(_0xcae85e){while(--_0xcae85e){_0x26daa0['push'](_0x26daa0['shift']());}};_0x536de2(++_0x22afee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x3b8bf8,_0x59e09f){var _0x481a4a=function(_0x3b6bf3){while(--_0x3b6bf3){_0x3b8bf8['push'](_0x3b8bf8['shift']());}};_0x481a4a(++_0x59e09f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 5085704..785dec6 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 _0x9f0e=['InternalRoutes','internal','filter','ignore','map','value','type','find','name','UserProfileResource','error','stack','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge','options','VoiceExtension','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','length','include','body','startsWith','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','save','update','destroy','then','get','InboundRoutes','OutboundRoutes','outbound'];(function(_0x11c090,_0x7d8e4e){var _0x444c13=function(_0x2fd312){while(--_0x2fd312){_0x11c090['push'](_0x11c090['shift']());}};_0x444c13(++_0x7d8e4e);}(_0x9f0e,0x116));var _0xe9f0=function(_0x34e19c,_0x4a3b2){_0x34e19c=_0x34e19c-0x0;var _0x30b3bf=_0x9f0e[_0x34e19c];return _0x30b3bf;};'use strict';var pdf=require(_0xe9f0('0x0'));var emlformat=require(_0xe9f0('0x1'));var rimraf=require(_0xe9f0('0x2'));var zipdir=require(_0xe9f0('0x3'));var jsonpatch=require(_0xe9f0('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe9f0('0x5'));var Mustache=require(_0xe9f0('0x6'));var util=require(_0xe9f0('0x7'));var path=require(_0xe9f0('0x8'));var sox=require(_0xe9f0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0xe'));var querystring=require(_0xe9f0('0xf'));var Papa=require(_0xe9f0('0x10'));var Redis=require(_0xe9f0('0x11'));var authService=require(_0xe9f0('0x12'));var qs=require(_0xe9f0('0x13'));var as=require(_0xe9f0('0x14'));var hardwareService=require(_0xe9f0('0x15'));var logger=require('../../config/logger')(_0xe9f0('0x16'));var utils=require(_0xe9f0('0x17'));var config=require(_0xe9f0('0x18'));var db=require('../../mysqldb')['db'];config[_0xe9f0('0x19')]=_['defaults'](config[_0xe9f0('0x19')],{'host':_0xe9f0('0x1a'),'port':0x18eb});var socket=require(_0xe9f0('0x1b'))(new Redis(config[_0xe9f0('0x19')]));require('./voiceExtension.socket')[_0xe9f0('0x1c')](socket);function respondWithStatusCode(_0x5a10c6,_0x1e3ba8){_0x1e3ba8=_0x1e3ba8||0xcc;return function(_0x23914b){if(_0x23914b){return _0x5a10c6[_0xe9f0('0x1d')](_0x1e3ba8);}return _0x5a10c6['status'](_0x1e3ba8)[_0xe9f0('0x1e')]();};}function respondWithResult(_0x33e9e4,_0x2e68ef){_0x2e68ef=_0x2e68ef||0xc8;return function(_0x598eee){if(_0x598eee){return _0x33e9e4[_0xe9f0('0x1f')](_0x2e68ef)[_0xe9f0('0x20')](_0x598eee);}};}function respondWithFilteredResult(_0xcd2042,_0xd71ac8){return function(_0x3ed69a){if(_0x3ed69a){var _0x2ab12b=_0x3ed69a[_0xe9f0('0x21')],_0x3da237=_0xd71ac8[_0xe9f0('0x22')],_0x59bf5a=_0xd71ac8['offset']+_0xd71ac8[_0xe9f0('0x23')],_0x15a33b;if(_0x59bf5a>=_0x2ab12b){_0x59bf5a=_0x2ab12b;_0x15a33b=0xc8;}else{_0x15a33b=0xce;}_0xcd2042[_0xe9f0('0x1f')](_0x15a33b);return _0xcd2042[_0xe9f0('0x24')](_0xe9f0('0x25'),_0x3da237+'-'+_0x59bf5a+'/'+_0x2ab12b)['json'](_0x3ed69a);}return null;};}function patchUpdates(_0x33f143){return function(_0xfaa312){try{jsonpatch['apply'](_0xfaa312,_0x33f143,!![]);}catch(_0x51e03f){return BPromise['reject'](_0x51e03f);}return _0xfaa312[_0xe9f0('0x26')]();};}function saveUpdates(_0xa1ddc,_0x1211ae){return function(_0x316cdf){if(_0x316cdf){return _0x316cdf[_0xe9f0('0x27')](_0xa1ddc)['then'](function(_0x229fe0){return _0x229fe0;});}return null;};}function removeEntity(_0x38b7ee,_0x437d43){return function(_0x10801b){if(_0x10801b){return _0x10801b[_0xe9f0('0x28')]()[_0xe9f0('0x29')](function(){var _0x37c0fc=_0x10801b[_0xe9f0('0x2a')]({'plain':!![]});var _0x3c4ba9=[{'name':_0xe9f0('0x2b'),'value':'inbound','ignore':![]},{'name':_0xe9f0('0x2c'),'value':_0xe9f0('0x2d'),'ignore':![]},{'name':_0xe9f0('0x2e'),'value':_0xe9f0('0x2f'),'ignore':![]}];var _0x4cf1b1=_(_0x3c4ba9)[_0xe9f0('0x30')](_0xe9f0('0x31'))[_0xe9f0('0x32')](_0xe9f0('0x33'))[_0xe9f0('0x33')]();if(_['includes'](_0x4cf1b1,_0x37c0fc[_0xe9f0('0x34')])){return;}var _0xdc16bc=_[_0xe9f0('0x35')](_0x3c4ba9,[_0xe9f0('0x33'),_0x37c0fc[_0xe9f0('0x34')]])[_0xe9f0('0x36')];return db[_0xe9f0('0x37')][_0xe9f0('0x28')]({'where':{'type':_0xdc16bc,'resourceId':_0x37c0fc['id']}})[_0xe9f0('0x29')](function(){return _0x10801b;});})[_0xe9f0('0x29')](function(){_0x38b7ee[_0xe9f0('0x1f')](0xcc)[_0xe9f0('0x1e')]();});}};}function handleEntityNotFound(_0x445ad0,_0x2ab77d){return function(_0x343d18){if(!_0x343d18){_0x445ad0[_0xe9f0('0x1d')](0x194);}return _0x343d18;};}function handleError(_0x80e3ac,_0x3e1846){_0x3e1846=_0x3e1846||0x1f4;return function(_0x2e7535){logger[_0xe9f0('0x38')](_0x2e7535[_0xe9f0('0x39')]);if(_0x2e7535[_0xe9f0('0x36')]){delete _0x2e7535[_0xe9f0('0x36')];}_0x80e3ac[_0xe9f0('0x1f')](_0x3e1846)['send'](_0x2e7535);};}exports['index']=function(_0x58d38b,_0x191a39){var _0x585742={},_0x9bf61d={},_0xc5fa13={'count':0x0,'rows':[]};var _0x4d3bd6=_[_0xe9f0('0x32')](db['VoiceExtension']['rawAttributes'],function(_0x59024e){return{'name':_0x59024e[_0xe9f0('0x3a')],'type':_0x59024e[_0xe9f0('0x34')]['key']};});_0x9bf61d[_0xe9f0('0x3b')]=_[_0xe9f0('0x32')](_0x4d3bd6,_0xe9f0('0x36'));_0x9bf61d['query']=_['keys'](_0x58d38b[_0xe9f0('0x3c')]);_0x9bf61d[_0xe9f0('0x3d')]=_[_0xe9f0('0x3e')](_0x9bf61d['model'],_0x9bf61d[_0xe9f0('0x3c')]);_0x585742[_0xe9f0('0x3f')]=_[_0xe9f0('0x3e')](_0x9bf61d[_0xe9f0('0x3b')],qs[_0xe9f0('0x40')](_0x58d38b['query'][_0xe9f0('0x40')]));_0x585742[_0xe9f0('0x3f')]=_0x585742[_0xe9f0('0x3f')]['length']?_0x585742[_0xe9f0('0x3f')]:_0x9bf61d[_0xe9f0('0x3b')];if(!_0x58d38b['query'][_0xe9f0('0x41')]('nolimit')){_0x585742[_0xe9f0('0x23')]=qs['limit'](_0x58d38b['query']['limit']);_0x585742['offset']=qs['offset'](_0x58d38b[_0xe9f0('0x3c')][_0xe9f0('0x22')]);}_0x585742[_0xe9f0('0x42')]=qs[_0xe9f0('0x43')](_0x58d38b[_0xe9f0('0x3c')][_0xe9f0('0x43')]);_0x585742[_0xe9f0('0x44')]=qs[_0xe9f0('0x3d')](_[_0xe9f0('0x45')](_0x58d38b['query'],_0x9bf61d[_0xe9f0('0x3d')]),_0x4d3bd6);if(_0x58d38b[_0xe9f0('0x3c')][_0xe9f0('0x30')]){_0x585742['where']=_['merge'](_0x585742[_0xe9f0('0x44')],{'$or':_['map'](_0x4d3bd6,function(_0x297689){if(_0x297689[_0xe9f0('0x34')]!==_0xe9f0('0x46')){var _0x42d9d2={};_0x42d9d2[_0x297689['name']]={'$like':'%'+_0x58d38b[_0xe9f0('0x3c')][_0xe9f0('0x30')]+'%'};return _0x42d9d2;}})});}_0x585742=_[_0xe9f0('0x47')]({},_0x585742,_0x58d38b[_0xe9f0('0x48')]);var _0x37a2ac={'where':_0x585742['where']};return db[_0xe9f0('0x49')][_0xe9f0('0x21')](_0x37a2ac)[_0xe9f0('0x29')](function(_0x319380){_0xc5fa13[_0xe9f0('0x21')]=_0x319380;if(_0x58d38b['query'][_0xe9f0('0x4a')]){_0x585742['include']=[{'all':!![]}];}return db['VoiceExtension'][_0xe9f0('0x4b')](_0x585742);})[_0xe9f0('0x29')](function(_0x536734){_0xc5fa13[_0xe9f0('0x4c')]=_0x536734;return _0xc5fa13;})[_0xe9f0('0x29')](respondWithFilteredResult(_0x191a39,_0x585742))[_0xe9f0('0x4d')](handleError(_0x191a39,null));};exports[_0xe9f0('0x4e')]=function(_0xdf4173,_0x410e17){var _0x15d529={'raw':![],'where':{'id':_0xdf4173[_0xe9f0('0x4f')]['id']}},_0x573437={};_0x573437['model']=_[_0xe9f0('0x50')](db['VoiceExtension'][_0xe9f0('0x51')]);_0x573437['query']=_[_0xe9f0('0x50')](_0xdf4173[_0xe9f0('0x3c')]);_0x573437[_0xe9f0('0x3d')]=_['intersection'](_0x573437[_0xe9f0('0x3b')],_0x573437[_0xe9f0('0x3c')]);_0x15d529[_0xe9f0('0x3f')]=_[_0xe9f0('0x3e')](_0x573437[_0xe9f0('0x3b')],qs[_0xe9f0('0x40')](_0xdf4173[_0xe9f0('0x3c')][_0xe9f0('0x40')]));_0x15d529[_0xe9f0('0x3f')]=_0x15d529[_0xe9f0('0x3f')][_0xe9f0('0x52')]?_0x15d529[_0xe9f0('0x3f')]:_0x573437['model'];if(_0xdf4173['query'][_0xe9f0('0x4a')]){_0x15d529[_0xe9f0('0x53')]=[{'all':!![]}];}_0x15d529=_[_0xe9f0('0x47')]({},_0x15d529,_0xdf4173['options']);return db[_0xe9f0('0x49')]['find'](_0x15d529)[_0xe9f0('0x29')](handleEntityNotFound(_0x410e17,null))[_0xe9f0('0x29')](respondWithResult(_0x410e17,null))[_0xe9f0('0x4d')](handleError(_0x410e17,null));};exports[_0xe9f0('0x28')]=function(_0x49fc70,_0xb18f13){return db[_0xe9f0('0x49')]['find']({'where':{'id':_0x49fc70[_0xe9f0('0x4f')]['id']}})[_0xe9f0('0x29')](handleEntityNotFound(_0xb18f13,null))[_0xe9f0('0x29')](removeEntity(_0xb18f13,null))[_0xe9f0('0x4d')](handleError(_0xb18f13,null));};exports['create']=function(_0x182e7f,_0x3a5d19){if(_0x182e7f[_0xe9f0('0x54')][_0xe9f0('0x34')]===_0xe9f0('0x2d')&&!_[_0xe9f0('0x55')](_0x182e7f[_0xe9f0('0x54')][_0xe9f0('0x56')],'_')){_0x182e7f['body'][_0xe9f0('0x56')]='_'[_0xe9f0('0x57')](_0x182e7f[_0xe9f0('0x54')][_0xe9f0('0x56')]);}return db[_0xe9f0('0x49')][_0xe9f0('0x58')](_0x182e7f[_0xe9f0('0x54')],{'raw':![]})[_0xe9f0('0x29')](function(_0xd780f5){var _0x127407=_0x182e7f[_0xe9f0('0x59')][_0xe9f0('0x2a')]({'plain':!![]});if(!_0x127407)throw new Error(_0xe9f0('0x5a'));if(_0x127407[_0xe9f0('0x5b')]==='user'){var _0x37d2af=_0xd780f5[_0xe9f0('0x2a')]({'plain':!![]});var _0x52bcce=[{'name':'InboundRoutes','value':'inbound'},{'name':_0xe9f0('0x2c'),'value':'outbound'},{'name':_0xe9f0('0x2e'),'value':_0xe9f0('0x2f')}];var _0x2b37ff=_['find'](_0x52bcce,[_0xe9f0('0x33'),_0x37d2af[_0xe9f0('0x34')]])[_0xe9f0('0x36')];return db[_0xe9f0('0x5c')]['find']({'where':{'name':_0x2b37ff,'userProfileId':_0x127407[_0xe9f0('0x5d')]},'raw':!![]})[_0xe9f0('0x29')](function(_0x28a66e){if(_0x28a66e&&_0x28a66e[_0xe9f0('0x5e')]===0x0){return db['UserProfileResource']['create']({'name':_0x37d2af[_0xe9f0('0x36')],'resourceId':_0x37d2af['id'],'type':_0x28a66e[_0xe9f0('0x36')],'sectionId':_0x28a66e['id']},{})[_0xe9f0('0x29')](function(){return _0xd780f5;});}else{return _0xd780f5;}})[_0xe9f0('0x4d')](function(_0x7cbe71){logger['error'](_0xe9f0('0x5f'),_0x7cbe71);throw _0x7cbe71;});}return _0xd780f5;})['then'](respondWithResult(_0x3a5d19,0xc9))[_0xe9f0('0x4d')](handleError(_0x3a5d19,null));};exports['update']=function(_0x7c05aa,_0x15ece3){if(_0x7c05aa[_0xe9f0('0x54')]['id']){delete _0x7c05aa[_0xe9f0('0x54')]['id'];}return db[_0xe9f0('0x49')]['find']({'where':{'id':_0x7c05aa['params']['id']}})['then'](handleEntityNotFound(_0x15ece3,null))[_0xe9f0('0x29')](function(_0x260927){if(_0x260927){return db['VoiceExtension'][_0xe9f0('0x27')](_['pick'](_0x7c05aa['body'],[_0xe9f0('0x56'),_0xe9f0('0x60'),_0xe9f0('0x61'),_0xe9f0('0x62'),_0xe9f0('0x63'),_0xe9f0('0x64')]),{'where':{'context':_0x260927['context'],'exten':_0x260927['exten']},'individualHooks':!![]})[_0xe9f0('0x29')](function(_0x248f10){return _0x248f10;});}return null;})[_0xe9f0('0x29')](respondWithStatusCode(_0x15ece3,null))[_0xe9f0('0x4d')](handleError(_0x15ece3,null));};exports['addApplications']=function(_0xb9b439,_0x83dea9,_0x22b44a){return db[_0xe9f0('0x49')][_0xe9f0('0x65')]({'where':{'id':_0xb9b439[_0xe9f0('0x4f')]['id']}})['then'](handleEntityNotFound(_0x83dea9,null))[_0xe9f0('0x29')](function(_0x2b074a){if(_0x2b074a){return db[_0xe9f0('0x66')][_0xe9f0('0x67')](function(_0xb6e75d){return db['VoiceExtension'][_0xe9f0('0x28')]({'where':{'VoiceExtensionId':_0xb9b439[_0xe9f0('0x4f')]['id']},'transaction':_0xb6e75d})[_0xe9f0('0x29')](function(_0x2e2ac7){var _0x214ac0=_[_0xe9f0('0x32')](_0xb9b439[_0xe9f0('0x54')],function(_0x16cc6b){_0x16cc6b[_0xe9f0('0x68')]=_0xb9b439[_0xe9f0('0x4f')]['id'];return _0x16cc6b;});return db[_0xe9f0('0x49')][_0xe9f0('0x69')](_0x214ac0,{'transaction':_0xb6e75d});});})['then'](function(){return db[_0xe9f0('0x49')][_0xe9f0('0x6a')]({'where':{'isApp':!![],'VoiceExtensionId':_0xb9b439[_0xe9f0('0x4f')]['id']},'order':_0xe9f0('0x6b')});});}})[_0xe9f0('0x29')](respondWithResult(_0x83dea9,null))[_0xe9f0('0x4d')](handleError(_0x83dea9,null));}; \ No newline at end of file +var _0xc6ac=['mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','includes','type','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','options','VoiceExtension','includeAll','include','rows','catch','show','params','find','create','body','outbound','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','context'];(function(_0x1bf09a,_0x28ddd6){var _0x268924=function(_0x582c1d){while(--_0x582c1d){_0x1bf09a['push'](_0x1bf09a['shift']());}};_0x268924(++_0x28ddd6);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x43ea01,_0x38a0db){_0x43ea01=_0x43ea01-0x0;var _0xaceb66=_0xc6ac[_0x43ea01];return _0xaceb66;};'use strict';var pdf=require(_0xcc6a('0x0'));var emlformat=require(_0xcc6a('0x1'));var rimraf=require(_0xcc6a('0x2'));var zipdir=require(_0xcc6a('0x3'));var jsonpatch=require(_0xcc6a('0x4'));var rp=require(_0xcc6a('0x5'));var moment=require(_0xcc6a('0x6'));var BPromise=require(_0xcc6a('0x7'));var Mustache=require(_0xcc6a('0x8'));var util=require(_0xcc6a('0x9'));var path=require(_0xcc6a('0xa'));var sox=require(_0xcc6a('0xb'));var csv=require(_0xcc6a('0xc'));var ejs=require(_0xcc6a('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xc'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var db=require(_0xcc6a('0x1a'))['db'];config['redis']=_['defaults'](config[_0xcc6a('0x1b')],{'host':_0xcc6a('0x1c'),'port':0x18eb});var socket=require(_0xcc6a('0x1d'))(new Redis(config['redis']));require('./voiceExtension.socket')[_0xcc6a('0x1e')](socket);function respondWithStatusCode(_0xcb9e2e,_0x43710d){_0x43710d=_0x43710d||0xcc;return function(_0x348af7){if(_0x348af7){return _0xcb9e2e[_0xcc6a('0x1f')](_0x43710d);}return _0xcb9e2e[_0xcc6a('0x20')](_0x43710d)[_0xcc6a('0x21')]();};}function respondWithResult(_0x403b18,_0x56ffb0){_0x56ffb0=_0x56ffb0||0xc8;return function(_0x4e628f){if(_0x4e628f){return _0x403b18['status'](_0x56ffb0)[_0xcc6a('0x22')](_0x4e628f);}};}function respondWithFilteredResult(_0x44910f,_0x307f2a){return function(_0x3e63d9){if(_0x3e63d9){var _0x33079c=_0x3e63d9[_0xcc6a('0x23')],_0x12ef33=_0x307f2a[_0xcc6a('0x24')],_0x2d9585=_0x307f2a[_0xcc6a('0x24')]+_0x307f2a['limit'],_0x412bc7;if(_0x2d9585>=_0x33079c){_0x2d9585=_0x33079c;_0x412bc7=0xc8;}else{_0x412bc7=0xce;}_0x44910f[_0xcc6a('0x20')](_0x412bc7);return _0x44910f[_0xcc6a('0x25')](_0xcc6a('0x26'),_0x12ef33+'-'+_0x2d9585+'/'+_0x33079c)[_0xcc6a('0x22')](_0x3e63d9);}return null;};}function patchUpdates(_0x1495d8){return function(_0x30b8ed){try{jsonpatch[_0xcc6a('0x27')](_0x30b8ed,_0x1495d8,!![]);}catch(_0x43f510){return BPromise[_0xcc6a('0x28')](_0x43f510);}return _0x30b8ed[_0xcc6a('0x29')]();};}function saveUpdates(_0x329d17,_0x845088){return function(_0x51be9a){if(_0x51be9a){return _0x51be9a[_0xcc6a('0x2a')](_0x329d17)[_0xcc6a('0x2b')](function(_0x38f812){return _0x38f812;});}return null;};}function removeEntity(_0x581aae,_0x10016a){return function(_0x294486){if(_0x294486){return _0x294486[_0xcc6a('0x2c')]()[_0xcc6a('0x2b')](function(){var _0x432c23=_0x294486[_0xcc6a('0x2d')]({'plain':!![]});var _0x50abc1=[{'name':_0xcc6a('0x2e'),'value':_0xcc6a('0x2f'),'ignore':![]},{'name':_0xcc6a('0x30'),'value':'outbound','ignore':![]},{'name':_0xcc6a('0x31'),'value':_0xcc6a('0x32'),'ignore':![]}];var _0x4da301=_(_0x50abc1)[_0xcc6a('0x33')](_0xcc6a('0x34'))[_0xcc6a('0x35')](_0xcc6a('0x36'))['value']();if(_[_0xcc6a('0x37')](_0x4da301,_0x432c23[_0xcc6a('0x38')])){return;}var _0x2c6d88=_['find'](_0x50abc1,[_0xcc6a('0x36'),_0x432c23['type']])['name'];return db[_0xcc6a('0x39')][_0xcc6a('0x2c')]({'where':{'type':_0x2c6d88,'resourceId':_0x432c23['id']}})[_0xcc6a('0x2b')](function(){return _0x294486;});})[_0xcc6a('0x2b')](function(){_0x581aae[_0xcc6a('0x20')](0xcc)[_0xcc6a('0x21')]();});}};}function handleEntityNotFound(_0x4e2de4,_0x7b2b54){return function(_0x28e3c3){if(!_0x28e3c3){_0x4e2de4[_0xcc6a('0x1f')](0x194);}return _0x28e3c3;};}function handleError(_0x2faeb5,_0x211a8c){_0x211a8c=_0x211a8c||0x1f4;return function(_0x152ebd){logger[_0xcc6a('0x3a')](_0x152ebd[_0xcc6a('0x3b')]);if(_0x152ebd['name']){delete _0x152ebd[_0xcc6a('0x3c')];}_0x2faeb5[_0xcc6a('0x20')](_0x211a8c)[_0xcc6a('0x3d')](_0x152ebd);};}exports[_0xcc6a('0x3e')]=function(_0x30d6e1,_0x711a58){var _0x28b16e={},_0x5afbbc={},_0x5d2287={'count':0x0,'rows':[]};var _0x5a41b4=_['map'](db['VoiceExtension'][_0xcc6a('0x3f')],function(_0x2a3e93){return{'name':_0x2a3e93[_0xcc6a('0x40')],'type':_0x2a3e93[_0xcc6a('0x38')][_0xcc6a('0x41')]};});_0x5afbbc['model']=_['map'](_0x5a41b4,_0xcc6a('0x3c'));_0x5afbbc[_0xcc6a('0x42')]=_[_0xcc6a('0x43')](_0x30d6e1['query']);_0x5afbbc[_0xcc6a('0x44')]=_[_0xcc6a('0x45')](_0x5afbbc[_0xcc6a('0x46')],_0x5afbbc[_0xcc6a('0x42')]);_0x28b16e[_0xcc6a('0x47')]=_[_0xcc6a('0x45')](_0x5afbbc[_0xcc6a('0x46')],qs[_0xcc6a('0x48')](_0x30d6e1[_0xcc6a('0x42')][_0xcc6a('0x48')]));_0x28b16e[_0xcc6a('0x47')]=_0x28b16e[_0xcc6a('0x47')][_0xcc6a('0x49')]?_0x28b16e[_0xcc6a('0x47')]:_0x5afbbc[_0xcc6a('0x46')];if(!_0x30d6e1[_0xcc6a('0x42')][_0xcc6a('0x4a')](_0xcc6a('0x4b'))){_0x28b16e['limit']=qs['limit'](_0x30d6e1[_0xcc6a('0x42')][_0xcc6a('0x4c')]);_0x28b16e[_0xcc6a('0x24')]=qs[_0xcc6a('0x24')](_0x30d6e1[_0xcc6a('0x42')][_0xcc6a('0x24')]);}_0x28b16e[_0xcc6a('0x4d')]=qs[_0xcc6a('0x4e')](_0x30d6e1['query']['sort']);_0x28b16e[_0xcc6a('0x4f')]=qs['filters'](_['pick'](_0x30d6e1['query'],_0x5afbbc[_0xcc6a('0x44')]),_0x5a41b4);if(_0x30d6e1[_0xcc6a('0x42')][_0xcc6a('0x33')]){_0x28b16e[_0xcc6a('0x4f')]=_[_0xcc6a('0x50')](_0x28b16e['where'],{'$or':_[_0xcc6a('0x35')](_0x5a41b4,function(_0xfbb079){if(_0xfbb079[_0xcc6a('0x38')]!==_0xcc6a('0x51')){var _0x14ca90={};_0x14ca90[_0xfbb079[_0xcc6a('0x3c')]]={'$like':'%'+_0x30d6e1['query'][_0xcc6a('0x33')]+'%'};return _0x14ca90;}})});}_0x28b16e=_[_0xcc6a('0x50')]({},_0x28b16e,_0x30d6e1[_0xcc6a('0x52')]);var _0x11c137={'where':_0x28b16e['where']};return db[_0xcc6a('0x53')]['count'](_0x11c137)[_0xcc6a('0x2b')](function(_0x3f280a){_0x5d2287[_0xcc6a('0x23')]=_0x3f280a;if(_0x30d6e1['query'][_0xcc6a('0x54')]){_0x28b16e[_0xcc6a('0x55')]=[{'all':!![]}];}return db[_0xcc6a('0x53')]['findAll'](_0x28b16e);})['then'](function(_0x3467b1){_0x5d2287[_0xcc6a('0x56')]=_0x3467b1;return _0x5d2287;})[_0xcc6a('0x2b')](respondWithFilteredResult(_0x711a58,_0x28b16e))[_0xcc6a('0x57')](handleError(_0x711a58,null));};exports[_0xcc6a('0x58')]=function(_0x5e59af,_0x16b83b){var _0xff1166={'raw':![],'where':{'id':_0x5e59af[_0xcc6a('0x59')]['id']}},_0x50ef8c={};_0x50ef8c[_0xcc6a('0x46')]=_[_0xcc6a('0x43')](db[_0xcc6a('0x53')][_0xcc6a('0x3f')]);_0x50ef8c[_0xcc6a('0x42')]=_['keys'](_0x5e59af['query']);_0x50ef8c['filters']=_[_0xcc6a('0x45')](_0x50ef8c[_0xcc6a('0x46')],_0x50ef8c[_0xcc6a('0x42')]);_0xff1166[_0xcc6a('0x47')]=_['intersection'](_0x50ef8c[_0xcc6a('0x46')],qs['fields'](_0x5e59af[_0xcc6a('0x42')][_0xcc6a('0x48')]));_0xff1166[_0xcc6a('0x47')]=_0xff1166[_0xcc6a('0x47')][_0xcc6a('0x49')]?_0xff1166[_0xcc6a('0x47')]:_0x50ef8c['model'];if(_0x5e59af[_0xcc6a('0x42')][_0xcc6a('0x54')]){_0xff1166[_0xcc6a('0x55')]=[{'all':!![]}];}_0xff1166=_[_0xcc6a('0x50')]({},_0xff1166,_0x5e59af[_0xcc6a('0x52')]);return db[_0xcc6a('0x53')][_0xcc6a('0x5a')](_0xff1166)[_0xcc6a('0x2b')](handleEntityNotFound(_0x16b83b,null))[_0xcc6a('0x2b')](respondWithResult(_0x16b83b,null))[_0xcc6a('0x57')](handleError(_0x16b83b,null));};exports['destroy']=function(_0x1c8470,_0x3197b5){return db[_0xcc6a('0x53')][_0xcc6a('0x5a')]({'where':{'id':_0x1c8470[_0xcc6a('0x59')]['id']}})[_0xcc6a('0x2b')](handleEntityNotFound(_0x3197b5,null))['then'](removeEntity(_0x3197b5,null))['catch'](handleError(_0x3197b5,null));};exports[_0xcc6a('0x5b')]=function(_0x5eeca6,_0x1ac0f0){if(_0x5eeca6[_0xcc6a('0x5c')][_0xcc6a('0x38')]===_0xcc6a('0x5d')&&!_[_0xcc6a('0x5e')](_0x5eeca6[_0xcc6a('0x5c')][_0xcc6a('0x5f')],'_')){_0x5eeca6[_0xcc6a('0x5c')][_0xcc6a('0x5f')]='_'[_0xcc6a('0x60')](_0x5eeca6[_0xcc6a('0x5c')]['exten']);}return db[_0xcc6a('0x53')]['create'](_0x5eeca6[_0xcc6a('0x5c')],{'raw':![]})[_0xcc6a('0x2b')](function(_0x22acfb){var _0x571a0a=_0x5eeca6[_0xcc6a('0x61')]['get']({'plain':!![]});if(!_0x571a0a)throw new Error(_0xcc6a('0x62'));if(_0x571a0a['role']===_0xcc6a('0x61')){var _0x271d07=_0x22acfb[_0xcc6a('0x2d')]({'plain':!![]});var _0xe212e8=[{'name':_0xcc6a('0x2e'),'value':_0xcc6a('0x2f')},{'name':_0xcc6a('0x30'),'value':_0xcc6a('0x5d')},{'name':'InternalRoutes','value':_0xcc6a('0x32')}];var _0x56d512=_[_0xcc6a('0x5a')](_0xe212e8,['value',_0x271d07[_0xcc6a('0x38')]])[_0xcc6a('0x3c')];return db[_0xcc6a('0x63')]['find']({'where':{'name':_0x56d512,'userProfileId':_0x571a0a[_0xcc6a('0x64')]},'raw':!![]})['then'](function(_0x5e53e4){if(_0x5e53e4&&_0x5e53e4[_0xcc6a('0x65')]===0x0){return db[_0xcc6a('0x39')][_0xcc6a('0x5b')]({'name':_0x271d07[_0xcc6a('0x3c')],'resourceId':_0x271d07['id'],'type':_0x5e53e4[_0xcc6a('0x3c')],'sectionId':_0x5e53e4['id']},{})[_0xcc6a('0x2b')](function(){return _0x22acfb;});}else{return _0x22acfb;}})[_0xcc6a('0x57')](function(_0x5668d1){logger[_0xcc6a('0x3a')](_0xcc6a('0x66'),_0x5668d1);throw _0x5668d1;});}return _0x22acfb;})[_0xcc6a('0x2b')](respondWithResult(_0x1ac0f0,0xc9))[_0xcc6a('0x57')](handleError(_0x1ac0f0,null));};exports[_0xcc6a('0x2a')]=function(_0x483aa4,_0x2a3745){if(_0x483aa4[_0xcc6a('0x5c')]['id']){delete _0x483aa4[_0xcc6a('0x5c')]['id'];}return db[_0xcc6a('0x53')]['find']({'where':{'id':_0x483aa4[_0xcc6a('0x59')]['id']}})[_0xcc6a('0x2b')](handleEntityNotFound(_0x2a3745,null))[_0xcc6a('0x2b')](function(_0x2ffe07){if(_0x2ffe07){return db[_0xcc6a('0x53')][_0xcc6a('0x2a')](_[_0xcc6a('0x67')](_0x483aa4[_0xcc6a('0x5c')],[_0xcc6a('0x5f'),_0xcc6a('0x68'),'description','recordingFormat','cutdigits',_0xcc6a('0x69')]),{'where':{'context':_0x2ffe07[_0xcc6a('0x68')],'exten':_0x2ffe07[_0xcc6a('0x5f')]},'individualHooks':!![]})['then'](function(_0x2f7787){return _0x2f7787;});}return null;})[_0xcc6a('0x2b')](respondWithStatusCode(_0x2a3745,null))[_0xcc6a('0x57')](handleError(_0x2a3745,null));};exports[_0xcc6a('0x6a')]=function(_0x5e1c69,_0x481d25,_0xaec5e8){return db[_0xcc6a('0x53')][_0xcc6a('0x6b')]({'where':{'id':_0x5e1c69[_0xcc6a('0x59')]['id']}})['then'](handleEntityNotFound(_0x481d25,null))[_0xcc6a('0x2b')](function(_0x2e9a9f){if(_0x2e9a9f){return db[_0xcc6a('0x6c')][_0xcc6a('0x6d')](function(_0x3a0d36){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x5e1c69[_0xcc6a('0x59')]['id']},'transaction':_0x3a0d36})[_0xcc6a('0x2b')](function(_0x2d9f02){var _0x144495=_['map'](_0x5e1c69['body'],function(_0x43827c){_0x43827c[_0xcc6a('0x6e')]=_0x5e1c69[_0xcc6a('0x59')]['id'];return _0x43827c;});return db[_0xcc6a('0x53')]['bulkCreate'](_0x144495,{'transaction':_0x3a0d36});});})['then'](function(){return db['VoiceExtension'][_0xcc6a('0x6f')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5e1c69[_0xcc6a('0x59')]['id']},'order':_0xcc6a('0x70')});});}})[_0xcc6a('0x2b')](respondWithResult(_0x481d25,null))['catch'](handleError(_0x481d25,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 4214b5e..9998ad4 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 _0xb675=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','VoiceExtension'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xb675,0xe6));var _0x5b67=function(_0x474035,_0x41e639){_0x474035=_0x474035-0x0;var _0x1b58e0=_0xb675[_0x474035];return _0x1b58e0;};'use strict';var EventEmitter=require(_0x5b67('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x5b67('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x5b67('0x2')](0x0);var events={'afterCreate':_0x5b67('0x3'),'afterUpdate':'update','afterDestroy':_0x5b67('0x4')};function emitEvent(_0x18dbb0){return function(_0x54d6ff,_0x5e7589,_0x45f5e4){VoiceExtensionEvents[_0x5b67('0x5')](_0x18dbb0+':'+_0x54d6ff['id'],_0x54d6ff);VoiceExtensionEvents[_0x5b67('0x5')](_0x18dbb0,_0x54d6ff);_0x45f5e4(null);};}for(var e in events){if(events[_0x5b67('0x6')](e)){var event=events[e];VoiceExtension[_0x5b67('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x78b6=['save','update','remove','hasOwnProperty','exports','events','VoiceExtension','setMaxListeners'];(function(_0x252fd0,_0x33bf8a){var _0x41e841=function(_0x511779){while(--_0x511779){_0x252fd0['push'](_0x252fd0['shift']());}};_0x41e841(++_0x33bf8a);}(_0x78b6,0x75));var _0x678b=function(_0x334524,_0x1fca82){_0x334524=_0x334524-0x0;var _0x870ae9=_0x78b6[_0x334524];return _0x870ae9;};'use strict';var EventEmitter=require(_0x678b('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x678b('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x678b('0x2')](0x0);var events={'afterCreate':_0x678b('0x3'),'afterUpdate':_0x678b('0x4'),'afterDestroy':_0x678b('0x5')};function emitEvent(_0x41f815){return function(_0x445003,_0x33fd38,_0x11f75b){VoiceExtensionEvents['emit'](_0x41f815+':'+_0x445003['id'],_0x445003);VoiceExtensionEvents['emit'](_0x41f815,_0x445003);_0x11f75b(null);};}for(var e in events){if(events[_0x678b('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x678b('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 951beb0..c903e80 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 _0x5fab=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceExtension.attributes','exports','VoiceExtension','voice_extensions','lodash','util'];(function(_0x18a616,_0x39d04a){var _0xcec5ae=function(_0x3ce998){while(--_0x3ce998){_0x18a616['push'](_0x18a616['shift']());}};_0xcec5ae(++_0x39d04a);}(_0x5fab,0x177));var _0xb5fa=function(_0x1d4d75,_0x48b6b4){_0x1d4d75=_0x1d4d75-0x0;var _0x11316d=_0x5fab[_0x1d4d75];return _0x11316d;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var logger=require('../../config/logger')(_0xb5fa('0x2'));var moment=require(_0xb5fa('0x3'));var BPromise=require(_0xb5fa('0x4'));var rp=require(_0xb5fa('0x5'));var fs=require('fs');var path=require(_0xb5fa('0x6'));var rimraf=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var attributes=require(_0xb5fa('0x9'));module[_0xb5fa('0xa')]=function(_0x44df89,_0x4a0249){return _0x44df89['define'](_0xb5fa('0xb'),attributes,{'tableName':_0xb5fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f2f=['bluebird','request-promise','path','./voiceExtension.attributes','exports','define','VoiceExtension','lodash','util','../../config/logger','api','moment'];(function(_0x3650a2,_0x1bc6ae){var _0x1e2ed7=function(_0x2ab7c4){while(--_0x2ab7c4){_0x3650a2['push'](_0x3650a2['shift']());}};_0x1e2ed7(++_0x1bc6ae);}(_0x5f2f,0x73));var _0xf5f2=function(_0x17dcbe,_0x4969ac){_0x17dcbe=_0x17dcbe-0x0;var _0x6065ba=_0x5f2f[_0x17dcbe];return _0x6065ba;};'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 fs=require('fs');var path=require(_0xf5f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf5f2('0x8'));module[_0xf5f2('0x9')]=function(_0xad7f65,_0x3eebf6){return _0xad7f65[_0xf5f2('0xa')](_0xf5f2('0xb'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 019c484..e6bfffe 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 _0x326c=['message','catch','GetVoiceExtension','findAll','raw','options','where','limit','include','attributes','map','debug','stringify','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','VoiceExtension,\x20%s,\x20%s','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x2f84dd,_0x3991d6){var _0x357311=function(_0x405b5a){while(--_0x405b5a){_0x2f84dd['push'](_0x2f84dd['shift']());}};_0x357311(++_0x3991d6);}(_0x326c,0x9d));var _0xc326=function(_0x31ecf1,_0x35c6c9){_0x31ecf1=_0x31ecf1-0x0;var _0x106873=_0x326c[_0x31ecf1];return _0x106873;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc326('0x0'));var BPromise=require('bluebird');var rs=require(_0xc326('0x1'));var fs=require('fs');var Redis=require(_0xc326('0x2'));var db=require(_0xc326('0x3'))['db'];var utils=require(_0xc326('0x4'));var logger=require(_0xc326('0x5'))(_0xc326('0x6'));var config=require(_0xc326('0x7'));var jayson=require(_0xc326('0x8'));var client=jayson[_0xc326('0x9')][_0xc326('0xa')]({'port':0x232a});config[_0xc326('0xb')]=_[_0xc326('0xc')](config['redis'],{'host':_0xc326('0xd'),'port':0x18eb});var socket=require(_0xc326('0xe'))(new Redis(config[_0xc326('0xb')]));require('./voiceExtension.socket')['register'](socket);function respondWithRpcPromise(_0x144e57,_0x549f13,_0x59989f){return new BPromise(function(_0x320ac3,_0x22c104){return client[_0xc326('0xf')](_0x144e57,_0x59989f)[_0xc326('0x10')](function(_0x393a2f){logger[_0xc326('0x11')](_0xc326('0x12'),_0x549f13,'request\x20sent');logger['debug'](_0xc326('0x13'),_0x549f13,_0xc326('0x14'),JSON['stringify'](_0x393a2f));if(_0x393a2f[_0xc326('0x15')]){if(_0x393a2f[_0xc326('0x15')][_0xc326('0x16')]===0x1f4){logger[_0xc326('0x15')](_0xc326('0x12'),_0x549f13,_0x393a2f[_0xc326('0x15')][_0xc326('0x17')]);return _0x22c104(_0x393a2f['error'][_0xc326('0x17')]);}logger['error'](_0xc326('0x12'),_0x549f13,_0x393a2f['error']['message']);return _0x320ac3(_0x393a2f['error']['message']);}else{logger[_0xc326('0x11')](_0xc326('0x12'),_0x549f13,_0xc326('0x14'));_0x320ac3(_0x393a2f['result']['message']);}})[_0xc326('0x18')](function(_0x12ff86){logger[_0xc326('0x15')](_0xc326('0x12'),_0x549f13,_0x12ff86);_0x22c104(_0x12ff86);});});}exports[_0xc326('0x19')]=function(_0x3328e1){var _0x232c40=this;return new Promise(function(_0x45229f,_0x44dfe9){return db['VoiceExtension'][_0xc326('0x1a')]({'raw':_0x3328e1['options']?_0x3328e1['options'][_0xc326('0x1b')]===undefined?!![]:![]:!![],'where':_0x3328e1['options']?_0x3328e1[_0xc326('0x1c')][_0xc326('0x1d')]||null:null,'attributes':_0x3328e1['options']?_0x3328e1['options']['attributes']||null:null,'limit':_0x3328e1[_0xc326('0x1c')]?_0x3328e1[_0xc326('0x1c')][_0xc326('0x1e')]||null:null,'include':_0x3328e1[_0xc326('0x1c')]?_0x3328e1[_0xc326('0x1c')][_0xc326('0x1f')]?_['map'](_0x3328e1['options'][_0xc326('0x1f')],function(_0x3b1586){return{'model':db[_0x3b1586['model']],'as':_0x3b1586['as'],'attributes':_0x3b1586[_0xc326('0x20')],'include':_0x3b1586['include']?_[_0xc326('0x21')](_0x3b1586[_0xc326('0x1f')],function(_0x2c1111){return{'model':db[_0x2c1111['model']],'as':_0x2c1111['as'],'attributes':_0x2c1111[_0xc326('0x20')],'include':_0x2c1111['include']?_[_0xc326('0x21')](_0x2c1111[_0xc326('0x1f')],function(_0x36b4c2){return{'model':db[_0x36b4c2['model']],'as':_0x36b4c2['as'],'attributes':_0x36b4c2[_0xc326('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc326('0x10')](function(_0x1d5e48){logger[_0xc326('0x11')](_0xc326('0x19'),_0x3328e1);logger[_0xc326('0x22')](_0xc326('0x19'),_0x3328e1,JSON[_0xc326('0x23')](_0x1d5e48));_0x45229f(_0x1d5e48);})['catch'](function(_0x65d469){logger[_0xc326('0x15')]('GetVoiceExtension',_0x65d469[_0xc326('0x17')],_0x3328e1);_0x44dfe9(_0x232c40['error'](0x1f4,_0x65d469[_0xc326('0x17')]));});});}; \ No newline at end of file +var _0x573e=['model','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','GetVoiceExtension','options','raw','where','limit','include','attributes','map'];(function(_0xe0e895,_0xf51c5c){var _0x222093=function(_0x295062){while(--_0x295062){_0xe0e895['push'](_0xe0e895['shift']());}};_0x222093(++_0xf51c5c);}(_0x573e,0x68));var _0xe573=function(_0x1df638,_0x41f1c8){_0x1df638=_0x1df638-0x0;var _0x2b97a3=_0x573e[_0x1df638];return _0x2b97a3;};'use strict';var _=require(_0xe573('0x0'));var util=require('util');var moment=require(_0xe573('0x1'));var BPromise=require(_0xe573('0x2'));var rs=require(_0xe573('0x3'));var fs=require('fs');var Redis=require(_0xe573('0x4'));var db=require(_0xe573('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe573('0x6'));var config=require('../../config/environment');var jayson=require(_0xe573('0x7'));var client=jayson[_0xe573('0x8')][_0xe573('0x9')]({'port':0x232a});config[_0xe573('0xa')]=_[_0xe573('0xb')](config[_0xe573('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe573('0xc'))(new Redis(config[_0xe573('0xa')]));require(_0xe573('0xd'))[_0xe573('0xe')](socket);function respondWithRpcPromise(_0x4479e8,_0x45b3c7,_0xed8f39){return new BPromise(function(_0x4ab386,_0x54cdb2){return client['request'](_0x4479e8,_0xed8f39)['then'](function(_0x49f77c){logger['info'](_0xe573('0xf'),_0x45b3c7,_0xe573('0x10'));logger[_0xe573('0x11')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x45b3c7,'request\x20sent',JSON[_0xe573('0x12')](_0x49f77c));if(_0x49f77c[_0xe573('0x13')]){if(_0x49f77c[_0xe573('0x13')][_0xe573('0x14')]===0x1f4){logger['error'](_0xe573('0xf'),_0x45b3c7,_0x49f77c['error'][_0xe573('0x15')]);return _0x54cdb2(_0x49f77c[_0xe573('0x13')][_0xe573('0x15')]);}logger[_0xe573('0x13')](_0xe573('0xf'),_0x45b3c7,_0x49f77c['error'][_0xe573('0x15')]);return _0x4ab386(_0x49f77c[_0xe573('0x13')]['message']);}else{logger[_0xe573('0x16')]('VoiceExtension,\x20%s,\x20%s',_0x45b3c7,_0xe573('0x10'));_0x4ab386(_0x49f77c['result'][_0xe573('0x15')]);}})[_0xe573('0x17')](function(_0x5ae71b){logger[_0xe573('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x45b3c7,_0x5ae71b);_0x54cdb2(_0x5ae71b);});});}exports[_0xe573('0x18')]=function(_0x2fc681){var _0x16ee43=this;return new Promise(function(_0x3ab67c,_0x1e4d19){return db['VoiceExtension']['findAll']({'raw':_0x2fc681['options']?_0x2fc681[_0xe573('0x19')][_0xe573('0x1a')]===undefined?!![]:![]:!![],'where':_0x2fc681[_0xe573('0x19')]?_0x2fc681[_0xe573('0x19')][_0xe573('0x1b')]||null:null,'attributes':_0x2fc681['options']?_0x2fc681[_0xe573('0x19')]['attributes']||null:null,'limit':_0x2fc681[_0xe573('0x19')]?_0x2fc681['options'][_0xe573('0x1c')]||null:null,'include':_0x2fc681['options']?_0x2fc681['options'][_0xe573('0x1d')]?_['map'](_0x2fc681[_0xe573('0x19')][_0xe573('0x1d')],function(_0x12dda1){return{'model':db[_0x12dda1['model']],'as':_0x12dda1['as'],'attributes':_0x12dda1[_0xe573('0x1e')],'include':_0x12dda1['include']?_[_0xe573('0x1f')](_0x12dda1[_0xe573('0x1d')],function(_0x598c75){return{'model':db[_0x598c75[_0xe573('0x20')]],'as':_0x598c75['as'],'attributes':_0x598c75[_0xe573('0x1e')],'include':_0x598c75[_0xe573('0x1d')]?_[_0xe573('0x1f')](_0x598c75[_0xe573('0x1d')],function(_0x1903f2){return{'model':db[_0x1903f2[_0xe573('0x20')]],'as':_0x1903f2['as'],'attributes':_0x1903f2['attributes']};}):[]};}):[]};}):[]:[]})[_0xe573('0x21')](function(_0x44e38e){logger[_0xe573('0x16')](_0xe573('0x18'),_0x2fc681);logger[_0xe573('0x11')](_0xe573('0x18'),_0x2fc681,JSON['stringify'](_0x44e38e));_0x3ab67c(_0x44e38e);})[_0xe573('0x17')](function(_0x51d1b8){logger[_0xe573('0x13')]('GetVoiceExtension',_0x51d1b8[_0xe573('0x15')],_0x2fc681);_0x1e4d19(_0x16ee43['error'](0x1f4,_0x51d1b8[_0xe573('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index fbe541a..4ffab86 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 _0x302c=['emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x302c,0x1b5));var _0xc302=function(_0x568676,_0x2b1c64){_0x568676=_0x568676-0x0;var _0x6c84c2=_0x302c[_0x568676];return _0x6c84c2;};'use strict';var VoiceExtensionEvents=require(_0xc302('0x0'));var events=[_0xc302('0x1'),_0xc302('0x2'),_0xc302('0x3')];function createListener(_0x2c045e,_0x10f217){return function(_0x303f7d){_0x10f217[_0xc302('0x4')](_0x2c045e,_0x303f7d);};}function removeListener(_0x446dd9,_0x283575){return function(){VoiceExtensionEvents[_0xc302('0x5')](_0x446dd9,_0x283575);};}exports[_0xc302('0x6')]=function(_0x1cb09a){for(var _0x40721c=0x0,_0x5c08d8=events[_0xc302('0x7')];_0x40721c<_0x5c08d8;_0x40721c++){var _0x54a5a0=events[_0x40721c];var _0x40370f=createListener(_0xc302('0x8')+_0x54a5a0,_0x1cb09a);VoiceExtensionEvents['on'](_0x54a5a0,_0x40370f);}}; \ No newline at end of file +var _0x11a7=['remove','emit','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x8419b9,_0x2809d9){var _0x522340=function(_0xa8885){while(--_0xa8885){_0x8419b9['push'](_0x8419b9['shift']());}};_0x522340(++_0x2809d9);}(_0x11a7,0x15c));var _0x711a=function(_0x109c40,_0x3463fa){_0x109c40=_0x109c40-0x0;var _0x3d5aed=_0x11a7[_0x109c40];return _0x3d5aed;};'use strict';var VoiceExtensionEvents=require(_0x711a('0x0'));var events=[_0x711a('0x1'),_0x711a('0x2'),'update'];function createListener(_0x5b48fb,_0x5514c8){return function(_0x1bb281){_0x5514c8[_0x711a('0x3')](_0x5b48fb,_0x1bb281);};}function removeListener(_0x214219,_0x4a10b1){return function(){VoiceExtensionEvents['removeListener'](_0x214219,_0x4a10b1);};}exports[_0x711a('0x4')]=function(_0x1839e3){for(var _0x3c78fb=0x0,_0x3bc415=events[_0x711a('0x5')];_0x3c78fb<_0x3bc415;_0x3c78fb++){var _0x1d392a=events[_0x3c78fb];var _0x19088e=createListener(_0x711a('0x6')+_0x1d392a,_0x1839e3);VoiceExtensionEvents['on'](_0x1d392a,_0x19088e);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index c772650..15291c7 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 _0x20a8=['get','/:id','show','/:id/messages','getMessages','post','create','put','update','delete','exports','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceMail.controller','isAuthenticated','index'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x20a8,0x115));var _0x820a=function(_0xc44302,_0x2ab4f4){_0xc44302=_0xc44302-0x0;var _0x5ecb5b=_0x20a8[_0xc44302];return _0x5ecb5b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x820a('0x0'));var express=require(_0x820a('0x1'));var router=express[_0x820a('0x2')]();var auth=require(_0x820a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x820a('0x4'));var controller=require(_0x820a('0x5'));router['get']('/',auth[_0x820a('0x6')](),controller[_0x820a('0x7')]);router[_0x820a('0x8')](_0x820a('0x9'),auth[_0x820a('0x6')](),controller[_0x820a('0xa')]);router[_0x820a('0x8')](_0x820a('0xb'),auth['isAuthenticated'](),controller[_0x820a('0xc')]);router[_0x820a('0xd')]('/',auth[_0x820a('0x6')](),controller[_0x820a('0xe')]);router[_0x820a('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x820a('0x10')]);router[_0x820a('0x11')]('/:id',auth[_0x820a('0x6')](),controller['destroy']);module[_0x820a('0x12')]=router; \ No newline at end of file +var _0xe481=['util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','/:id','show','/:id/messages','getMessages','create','delete','destroy','multer'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe481,0x153));var _0x1e48=function(_0x29a3b7,_0x18d6b6){_0x29a3b7=_0x29a3b7-0x0;var _0x4ab7b2=_0xe481[_0x29a3b7];return _0x4ab7b2;};'use strict';var multer=require(_0x1e48('0x0'));var util=require(_0x1e48('0x1'));var path=require(_0x1e48('0x2'));var timeout=require(_0x1e48('0x3'));var express=require(_0x1e48('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1e48('0x5'));var config=require(_0x1e48('0x6'));var controller=require(_0x1e48('0x7'));router[_0x1e48('0x8')]('/',auth[_0x1e48('0x9')](),controller['index']);router['get'](_0x1e48('0xa'),auth[_0x1e48('0x9')](),controller[_0x1e48('0xb')]);router[_0x1e48('0x8')](_0x1e48('0xc'),auth[_0x1e48('0x9')](),controller[_0x1e48('0xd')]);router['post']('/',auth[_0x1e48('0x9')](),controller[_0x1e48('0xe')]);router['put']('/:id',auth[_0x1e48('0x9')](),controller['update']);router[_0x1e48('0xf')](_0x1e48('0xa'),auth['isAuthenticated'](),controller[_0x1e48('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index b998ef6..6425661 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 _0x4024=['mailbox','sequelize','exports','STRING','from-voicemail','setDataValue','email','string','trim','central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4024,0x89));var _0x4402=function(_0x385df3,_0x5165c3){_0x385df3=_0x385df3-0x0;var _0x3966a1=_0x4024[_0x385df3];return _0x3966a1;};'use strict';var Sequelize=require(_0x4402('0x0'));module[_0x4402('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4402('0x2')],'defaultValue':_0x4402('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x4402('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x4402('0x2')]},'fullname':{'type':Sequelize[_0x4402('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x4f9482){this[_0x4402('0x4')](_0x4402('0x5'),typeof _0x4f9482===_0x4402('0x6')&&_0x4f9482['trim']()?_0x4f9482[_0x4402('0x7')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x4402('0x8')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x4402('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x4402('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x4402('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x4402('0xa')](_0x4402('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x4402('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x4402('0xa')](_0x4402('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x4402('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x4402('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x4402('0xa')](_0x4402('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x4402('0xa')](_0x4402('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x4402('0xa')](_0x4402('0x9'),'no'),'defaultValue':_0x4402('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x4402('0xa')](_0x4402('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x4402('0xa')](_0x4402('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x4402('0xa')](_0x4402('0x9'),'no'),'defaultValue':_0x4402('0x9'),'allowNull':![]},'stamp':{'type':_0x4402('0xc')},'emailsubject':{'type':Sequelize[_0x4402('0x2')]},'emailbody':{'type':Sequelize[_0x4402('0x2')]},'maxsecs':{'type':Sequelize[_0x4402('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x4402('0xe')](_0x4402('0xf'))+'\x20-\x20'+this[_0x4402('0xe')](_0x4402('0x10'));}}}; \ No newline at end of file +var _0xac4a=['contest_mailbox','setDataValue','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail'];(function(_0x4fd03b,_0x1bbda2){var _0x5eaf4a=function(_0x908a80){while(--_0x908a80){_0x4fd03b['push'](_0x4fd03b['shift']());}};_0x5eaf4a(++_0x1bbda2);}(_0xac4a,0x13f));var _0xaac4=function(_0x192e16,_0x467ce1){_0x192e16=_0x192e16-0x0;var _0x583f3d=_0xac4a[_0x192e16];return _0x583f3d;};'use strict';var Sequelize=require(_0xaac4('0x0'));module[_0xaac4('0x1')]={'customer_id':{'type':Sequelize[_0xaac4('0x2')]},'context':{'type':Sequelize[_0xaac4('0x2')],'defaultValue':_0xaac4('0x3'),'unique':_0xaac4('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xaac4('0x2')]},'fullname':{'type':Sequelize[_0xaac4('0x2')]},'email':{'type':Sequelize[_0xaac4('0x2')],'validate':{'isEmail':!![]},'set':function(_0x58ae95){this[_0xaac4('0x5')]('email',typeof _0x58ae95===_0xaac4('0x6')&&_0x58ae95['trim']()?_0x58ae95[_0xaac4('0x7')]():null);}},'pager':{'type':Sequelize[_0xaac4('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0xaac4('0x8')]('yes','no'),'defaultValue':_0xaac4('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xaac4('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xaac4('0x2')]},'callback':{'type':Sequelize[_0xaac4('0x2')]},'review':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xaac4('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xaac4('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xaac4('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':_0xaac4('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xaac4('0x8')](_0xaac4('0x9'),'no'),'defaultValue':_0xaac4('0x9'),'allowNull':![]},'stamp':{'type':_0xaac4('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xaac4('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xaac4('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xaac4('0xd')](_0xaac4('0xe'))+_0xaac4('0xf')+this[_0xaac4('0xd')](_0xaac4('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 1e44be6..7eff43b 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 _0x4d66=['update','then','destroy','get','UserProfileResource','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','show','params','find','create','user','Voicemails','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','VoiceMailMessage','filter','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','limit','Content-Range','reject'];(function(_0x13de08,_0xea3bbb){var _0x5af600=function(_0x2628d4){while(--_0x2628d4){_0x13de08['push'](_0x13de08['shift']());}};_0x5af600(++_0xea3bbb);}(_0x4d66,0x126));var _0x64d6=function(_0x58dc50,_0x2af0b7){_0x58dc50=_0x58dc50-0x0;var _0x1fda34=_0x4d66[_0x58dc50];return _0x1fda34;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x64d6('0x0'));var zipdir=require(_0x64d6('0x1'));var jsonpatch=require(_0x64d6('0x2'));var rp=require(_0x64d6('0x3'));var moment=require(_0x64d6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x64d6('0x5'));var sox=require('sox');var csv=require(_0x64d6('0x6'));var ejs=require(_0x64d6('0x7'));var fs=require('fs');var _=require(_0x64d6('0x8'));var squel=require(_0x64d6('0x9'));var crypto=require('crypto');var jsforce=require(_0x64d6('0xa'));var deskjs=require(_0x64d6('0xb'));var toCsv=require('to-csv');var querystring=require(_0x64d6('0xc'));var Papa=require(_0x64d6('0xd'));var Redis=require(_0x64d6('0xe'));var authService=require(_0x64d6('0xf'));var qs=require(_0x64d6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x64d6('0x11'));var logger=require(_0x64d6('0x12'))(_0x64d6('0x13'));var utils=require(_0x64d6('0x14'));var config=require('../../config/environment');var db=require(_0x64d6('0x15'))['db'];function respondWithStatusCode(_0x3adefe,_0x2c54a){_0x2c54a=_0x2c54a||0xcc;return function(_0x1b8b14){if(_0x1b8b14){return _0x3adefe[_0x64d6('0x16')](_0x2c54a);}return _0x3adefe[_0x64d6('0x17')](_0x2c54a)[_0x64d6('0x18')]();};}function respondWithResult(_0x209ccb,_0x312743){_0x312743=_0x312743||0xc8;return function(_0x1444d6){if(_0x1444d6){return _0x209ccb[_0x64d6('0x17')](_0x312743)[_0x64d6('0x19')](_0x1444d6);}};}function respondWithFilteredResult(_0x1eeab4,_0xb1b212){return function(_0x23ea03){if(_0x23ea03){var _0x1145b5=_0x23ea03[_0x64d6('0x1a')],_0x5f299d=_0xb1b212['offset'],_0x4e0256=_0xb1b212['offset']+_0xb1b212[_0x64d6('0x1b')],_0x1cf7c0;if(_0x4e0256>=_0x1145b5){_0x4e0256=_0x1145b5;_0x1cf7c0=0xc8;}else{_0x1cf7c0=0xce;}_0x1eeab4[_0x64d6('0x17')](_0x1cf7c0);return _0x1eeab4['set'](_0x64d6('0x1c'),_0x5f299d+'-'+_0x4e0256+'/'+_0x1145b5)[_0x64d6('0x19')](_0x23ea03);}return null;};}function patchUpdates(_0x2d9351){return function(_0x5cd33e){try{jsonpatch['apply'](_0x5cd33e,_0x2d9351,!![]);}catch(_0x4a302c){return BPromise[_0x64d6('0x1d')](_0x4a302c);}return _0x5cd33e['save']();};}function saveUpdates(_0x1bbdfe,_0x404476){return function(_0xcc17f1){if(_0xcc17f1){return _0xcc17f1[_0x64d6('0x1e')](_0x1bbdfe)[_0x64d6('0x1f')](function(_0x3a7f34){return _0x3a7f34;});}return null;};}function removeEntity(_0x49f0aa,_0x339d9e){return function(_0x9226ff){if(_0x9226ff){return _0x9226ff[_0x64d6('0x20')]()[_0x64d6('0x1f')](function(){var _0x316247=_0x9226ff[_0x64d6('0x21')]({'plain':!![]});var _0x3d19c7='Voicemails';return db[_0x64d6('0x22')][_0x64d6('0x20')]({'where':{'type':_0x3d19c7,'resourceId':_0x316247['id']}})[_0x64d6('0x1f')](function(){return _0x9226ff;});})[_0x64d6('0x1f')](function(){_0x49f0aa[_0x64d6('0x17')](0xcc)[_0x64d6('0x18')]();});}};}function handleEntityNotFound(_0x2d602f,_0x58320b){return function(_0x2a61a3){if(!_0x2a61a3){_0x2d602f['sendStatus'](0x194);}return _0x2a61a3;};}function handleError(_0x14def2,_0x33f709){_0x33f709=_0x33f709||0x1f4;return function(_0x9a103){logger['error'](_0x9a103['stack']);if(_0x9a103[_0x64d6('0x23')]){delete _0x9a103['name'];}_0x14def2[_0x64d6('0x17')](_0x33f709)[_0x64d6('0x24')](_0x9a103);};}exports[_0x64d6('0x25')]=function(_0x20dc1f,_0x218d49){var _0x3439a9={},_0x247808={},_0x1794ca={'count':0x0,'rows':[]};var _0xba52b5=_[_0x64d6('0x26')](db[_0x64d6('0x27')][_0x64d6('0x28')],function(_0x2b3de5){return{'name':_0x2b3de5[_0x64d6('0x29')],'type':_0x2b3de5[_0x64d6('0x2a')][_0x64d6('0x2b')]};});_0x247808['model']=_[_0x64d6('0x26')](_0xba52b5,'name');_0x247808['query']=_[_0x64d6('0x2c')](_0x20dc1f[_0x64d6('0x2d')]);_0x247808[_0x64d6('0x2e')]=_[_0x64d6('0x2f')](_0x247808[_0x64d6('0x30')],_0x247808[_0x64d6('0x2d')]);_0x3439a9['attributes']=_['intersection'](_0x247808[_0x64d6('0x30')],qs[_0x64d6('0x31')](_0x20dc1f[_0x64d6('0x2d')]['fields']));_0x3439a9[_0x64d6('0x32')]=_0x3439a9[_0x64d6('0x32')][_0x64d6('0x33')]?_0x3439a9['attributes']:_0x247808['model'];if(!_0x20dc1f[_0x64d6('0x2d')][_0x64d6('0x34')](_0x64d6('0x35'))){_0x3439a9[_0x64d6('0x1b')]=qs[_0x64d6('0x1b')](_0x20dc1f['query'][_0x64d6('0x1b')]);_0x3439a9['offset']=qs['offset'](_0x20dc1f[_0x64d6('0x2d')][_0x64d6('0x36')]);}_0x3439a9[_0x64d6('0x37')]=qs[_0x64d6('0x38')](_0x20dc1f['query'][_0x64d6('0x38')]);_0x3439a9[_0x64d6('0x39')]=qs[_0x64d6('0x2e')](_[_0x64d6('0x3a')](_0x20dc1f[_0x64d6('0x2d')],_0x247808[_0x64d6('0x2e')]),_0xba52b5);if(_0x20dc1f[_0x64d6('0x2d')]['filter']){_0x3439a9[_0x64d6('0x39')]=_[_0x64d6('0x3b')](_0x3439a9['where'],{'$or':_[_0x64d6('0x26')](_0xba52b5,function(_0x33b94c){if(_0x33b94c[_0x64d6('0x2a')]!=='VIRTUAL'){var _0x46b63b={};_0x46b63b[_0x33b94c[_0x64d6('0x23')]]={'$like':'%'+_0x20dc1f[_0x64d6('0x2d')]['filter']+'%'};return _0x46b63b;}})});}_0x3439a9=_[_0x64d6('0x3b')]({},_0x3439a9,_0x20dc1f[_0x64d6('0x3c')]);var _0x6c1ad2={'where':_0x3439a9[_0x64d6('0x39')]};return db[_0x64d6('0x27')][_0x64d6('0x1a')](_0x6c1ad2)[_0x64d6('0x1f')](function(_0x458d48){_0x1794ca[_0x64d6('0x1a')]=_0x458d48;if(_0x20dc1f['query'][_0x64d6('0x3d')]){_0x3439a9[_0x64d6('0x3e')]=[{'all':!![]}];}return db[_0x64d6('0x27')][_0x64d6('0x3f')](_0x3439a9);})[_0x64d6('0x1f')](function(_0x247a38){_0x1794ca[_0x64d6('0x40')]=_0x247a38;return _0x1794ca;})['then'](respondWithFilteredResult(_0x218d49,_0x3439a9))['catch'](handleError(_0x218d49,null));};exports[_0x64d6('0x41')]=function(_0x19347f,_0x279648){var _0x733447={'raw':!![],'where':{'id':_0x19347f[_0x64d6('0x42')]['id']}},_0xece593={};_0xece593['model']=_['keys'](db[_0x64d6('0x27')][_0x64d6('0x28')]);_0xece593[_0x64d6('0x2d')]=_[_0x64d6('0x2c')](_0x19347f[_0x64d6('0x2d')]);_0xece593[_0x64d6('0x2e')]=_[_0x64d6('0x2f')](_0xece593['model'],_0xece593[_0x64d6('0x2d')]);_0x733447[_0x64d6('0x32')]=_[_0x64d6('0x2f')](_0xece593[_0x64d6('0x30')],qs[_0x64d6('0x31')](_0x19347f[_0x64d6('0x2d')]['fields']));_0x733447[_0x64d6('0x32')]=_0x733447[_0x64d6('0x32')][_0x64d6('0x33')]?_0x733447['attributes']:_0xece593[_0x64d6('0x30')];if(_0x19347f[_0x64d6('0x2d')][_0x64d6('0x3d')]){_0x733447['include']=[{'all':!![]}];}_0x733447=_[_0x64d6('0x3b')]({},_0x733447,_0x19347f[_0x64d6('0x3c')]);return db['VoiceMail'][_0x64d6('0x43')](_0x733447)[_0x64d6('0x1f')](handleEntityNotFound(_0x279648,null))[_0x64d6('0x1f')](respondWithResult(_0x279648,null))['catch'](handleError(_0x279648,null));};exports['create']=function(_0x3a8dfe,_0x2bd93b){return db[_0x64d6('0x27')][_0x64d6('0x44')](_0x3a8dfe['body'],{})[_0x64d6('0x1f')](function(_0x356bba){var _0x5960e5=_0x3a8dfe['user'][_0x64d6('0x21')]({'plain':!![]});if(!_0x5960e5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5960e5['role']===_0x64d6('0x45')){var _0x15392c=_0x356bba[_0x64d6('0x21')]({'plain':!![]});var _0x1b4385=_0x64d6('0x46');return db[_0x64d6('0x47')]['find']({'where':{'name':_0x1b4385,'userProfileId':_0x5960e5[_0x64d6('0x48')]},'raw':!![]})[_0x64d6('0x1f')](function(_0x3beb77){if(_0x3beb77&&_0x3beb77[_0x64d6('0x49')]===0x0){return db[_0x64d6('0x22')][_0x64d6('0x44')]({'name':_0x15392c[_0x64d6('0x23')],'resourceId':_0x15392c['id'],'type':_0x3beb77[_0x64d6('0x23')],'sectionId':_0x3beb77['id']},{})[_0x64d6('0x1f')](function(){return _0x356bba;});}else{return _0x356bba;}})[_0x64d6('0x4a')](function(_0x4cbb1e){logger[_0x64d6('0x4b')](_0x64d6('0x4c'),_0x4cbb1e);throw _0x4cbb1e;});}return _0x356bba;})[_0x64d6('0x1f')](respondWithResult(_0x2bd93b,0xc9))[_0x64d6('0x4a')](handleError(_0x2bd93b,null));};exports[_0x64d6('0x1e')]=function(_0x5580d2,_0x2efe0e){if(_0x5580d2[_0x64d6('0x4d')]['id']){delete _0x5580d2[_0x64d6('0x4d')]['id'];}return db[_0x64d6('0x27')][_0x64d6('0x43')]({'where':{'id':_0x5580d2[_0x64d6('0x42')]['id']}})[_0x64d6('0x1f')](handleEntityNotFound(_0x2efe0e,null))[_0x64d6('0x1f')](saveUpdates(_0x5580d2['body'],null))[_0x64d6('0x1f')](respondWithResult(_0x2efe0e,null))[_0x64d6('0x4a')](handleError(_0x2efe0e,null));};exports['destroy']=function(_0x40faf6,_0x284ed1){return db['VoiceMail'][_0x64d6('0x43')]({'where':{'id':_0x40faf6[_0x64d6('0x42')]['id']}})['then'](handleEntityNotFound(_0x284ed1,null))[_0x64d6('0x1f')](removeEntity(_0x284ed1,null))['catch'](handleError(_0x284ed1,null));};exports['getMessages']=function(_0x45a269,_0x295c7c,_0x426cf3){return db[_0x64d6('0x27')]['findOne']({'where':{'id':_0x45a269[_0x64d6('0x42')]['id']}})['then'](handleEntityNotFound(_0x295c7c,null))['then'](function(_0x35d19c){var _0x104b3a;var _0x252dfc={},_0x53ec8f={};_0x53ec8f[_0x64d6('0x30')]=_['keys'](db[_0x64d6('0x4e')][_0x64d6('0x28')]);_0x53ec8f['query']=_[_0x64d6('0x2c')](_0x45a269[_0x64d6('0x2d')]);_0x53ec8f[_0x64d6('0x2e')]=_[_0x64d6('0x2f')](_0x53ec8f[_0x64d6('0x30')],_0x53ec8f[_0x64d6('0x2d')]);_0x252dfc[_0x64d6('0x32')]=_[_0x64d6('0x2f')](_0x53ec8f['model'],qs['fields'](_0x45a269[_0x64d6('0x2d')][_0x64d6('0x31')]));_0x252dfc[_0x64d6('0x32')]=_0x252dfc[_0x64d6('0x32')][_0x64d6('0x33')]?_0x252dfc['attributes']:_0x53ec8f[_0x64d6('0x30')];if(!_0x45a269[_0x64d6('0x2d')][_0x64d6('0x34')](_0x64d6('0x35'))){_0x252dfc[_0x64d6('0x1b')]=qs[_0x64d6('0x1b')](_0x45a269[_0x64d6('0x2d')][_0x64d6('0x1b')]);_0x252dfc['offset']=qs['offset'](_0x45a269[_0x64d6('0x2d')][_0x64d6('0x36')]);}_0x252dfc[_0x64d6('0x37')]=qs[_0x64d6('0x38')](_0x45a269[_0x64d6('0x2d')][_0x64d6('0x38')]);_0x252dfc[_0x64d6('0x39')]=qs[_0x64d6('0x2e')](_['pick'](_0x45a269[_0x64d6('0x2d')],_0x53ec8f[_0x64d6('0x2e')]));if(_0x45a269[_0x64d6('0x2d')][_0x64d6('0x4f')]){_0x252dfc[_0x64d6('0x39')]=_[_0x64d6('0x3b')](_0x252dfc[_0x64d6('0x39')],{'$or':_['map'](_0x252dfc[_0x64d6('0x32')],function(_0xf39dca){var _0x3841ce={};_0x3841ce[_0xf39dca]={'$like':'%'+_0x45a269[_0x64d6('0x2d')]['filter']+'%'};return _0x3841ce;})});}_0x252dfc['where']=_[_0x64d6('0x3b')](_0x252dfc['where'],{'mailboxuser':_0x35d19c['mailbox']});_0x252dfc=_['merge']({},_0x252dfc,_0x45a269[_0x64d6('0x3c')]);return db[_0x64d6('0x4e')][_0x64d6('0x50')](_0x252dfc)[_0x64d6('0x1f')](respondWithFilteredResult(_0x295c7c,_0x252dfc));})[_0x64d6('0x4a')](handleError(_0x295c7c,null));}; \ No newline at end of file +var _0x3217=['catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','get','Voicemails','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','map','VIRTUAL','filter','options','VoiceMail','includeAll','include','findAll','rows'];(function(_0x98a27a,_0x274d8e){var _0x3e9725=function(_0x2bcef7){while(--_0x2bcef7){_0x98a27a['push'](_0x98a27a['shift']());}};_0x3e9725(++_0x274d8e);}(_0x3217,0x1d3));var _0x7321=function(_0x26c67f,_0x3c9fab){_0x26c67f=_0x26c67f-0x0;var _0x563266=_0x3217[_0x26c67f];return _0x563266;};'use strict';var pdf=require(_0x7321('0x0'));var emlformat=require(_0x7321('0x1'));var rimraf=require(_0x7321('0x2'));var zipdir=require(_0x7321('0x3'));var jsonpatch=require(_0x7321('0x4'));var rp=require(_0x7321('0x5'));var moment=require(_0x7321('0x6'));var BPromise=require(_0x7321('0x7'));var Mustache=require(_0x7321('0x8'));var util=require(_0x7321('0x9'));var path=require(_0x7321('0xa'));var sox=require(_0x7321('0xb'));var csv=require(_0x7321('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7321('0xd'));var squel=require(_0x7321('0xe'));var crypto=require(_0x7321('0xf'));var jsforce=require(_0x7321('0x10'));var deskjs=require(_0x7321('0x11'));var toCsv=require(_0x7321('0xc'));var querystring=require(_0x7321('0x12'));var Papa=require(_0x7321('0x13'));var Redis=require('ioredis');var authService=require(_0x7321('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7321('0x15'));var hardwareService=require(_0x7321('0x16'));var logger=require(_0x7321('0x17'))(_0x7321('0x18'));var utils=require('../../config/utils');var config=require(_0x7321('0x19'));var db=require(_0x7321('0x1a'))['db'];function respondWithStatusCode(_0x2c9eae,_0x2987ab){_0x2987ab=_0x2987ab||0xcc;return function(_0xb0581a){if(_0xb0581a){return _0x2c9eae[_0x7321('0x1b')](_0x2987ab);}return _0x2c9eae[_0x7321('0x1c')](_0x2987ab)['end']();};}function respondWithResult(_0x5c2333,_0x49d5af){_0x49d5af=_0x49d5af||0xc8;return function(_0x19f5c7){if(_0x19f5c7){return _0x5c2333['status'](_0x49d5af)[_0x7321('0x1d')](_0x19f5c7);}};}function respondWithFilteredResult(_0x4ba662,_0x5bbf58){return function(_0x7edf27){if(_0x7edf27){var _0x3b9f97=_0x7edf27[_0x7321('0x1e')],_0xf82c00=_0x5bbf58[_0x7321('0x1f')],_0x1303d1=_0x5bbf58[_0x7321('0x1f')]+_0x5bbf58[_0x7321('0x20')],_0x3dd6a5;if(_0x1303d1>=_0x3b9f97){_0x1303d1=_0x3b9f97;_0x3dd6a5=0xc8;}else{_0x3dd6a5=0xce;}_0x4ba662[_0x7321('0x1c')](_0x3dd6a5);return _0x4ba662['set'](_0x7321('0x21'),_0xf82c00+'-'+_0x1303d1+'/'+_0x3b9f97)[_0x7321('0x1d')](_0x7edf27);}return null;};}function patchUpdates(_0x3a32ce){return function(_0xf9b954){try{jsonpatch[_0x7321('0x22')](_0xf9b954,_0x3a32ce,!![]);}catch(_0x3862c7){return BPromise[_0x7321('0x23')](_0x3862c7);}return _0xf9b954[_0x7321('0x24')]();};}function saveUpdates(_0x3a323e,_0x2ed124){return function(_0x327f1a){if(_0x327f1a){return _0x327f1a[_0x7321('0x25')](_0x3a323e)['then'](function(_0x36f98a){return _0x36f98a;});}return null;};}function removeEntity(_0x72f543,_0x59c623){return function(_0x2f05fb){if(_0x2f05fb){return _0x2f05fb[_0x7321('0x26')]()[_0x7321('0x27')](function(){var _0x18a925=_0x2f05fb[_0x7321('0x28')]({'plain':!![]});var _0x3d4d42=_0x7321('0x29');return db[_0x7321('0x2a')]['destroy']({'where':{'type':_0x3d4d42,'resourceId':_0x18a925['id']}})['then'](function(){return _0x2f05fb;});})['then'](function(){_0x72f543[_0x7321('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x576bb1,_0x3658cb){return function(_0x596d45){if(!_0x596d45){_0x576bb1[_0x7321('0x1b')](0x194);}return _0x596d45;};}function handleError(_0x2744cd,_0x3713d4){_0x3713d4=_0x3713d4||0x1f4;return function(_0x29037a){logger[_0x7321('0x2b')](_0x29037a[_0x7321('0x2c')]);if(_0x29037a['name']){delete _0x29037a[_0x7321('0x2d')];}_0x2744cd[_0x7321('0x1c')](_0x3713d4)['send'](_0x29037a);};}exports[_0x7321('0x2e')]=function(_0x4f42f0,_0x3f42cc){var _0x567008={},_0x4138b5={},_0xad7ad7={'count':0x0,'rows':[]};var _0x10670c=_['map'](db['VoiceMail'][_0x7321('0x2f')],function(_0x462d87){return{'name':_0x462d87[_0x7321('0x30')],'type':_0x462d87[_0x7321('0x31')]['key']};});_0x4138b5[_0x7321('0x32')]=_['map'](_0x10670c,_0x7321('0x2d'));_0x4138b5[_0x7321('0x33')]=_[_0x7321('0x34')](_0x4f42f0[_0x7321('0x33')]);_0x4138b5[_0x7321('0x35')]=_[_0x7321('0x36')](_0x4138b5[_0x7321('0x32')],_0x4138b5[_0x7321('0x33')]);_0x567008[_0x7321('0x37')]=_[_0x7321('0x36')](_0x4138b5[_0x7321('0x32')],qs[_0x7321('0x38')](_0x4f42f0[_0x7321('0x33')][_0x7321('0x38')]));_0x567008['attributes']=_0x567008[_0x7321('0x37')][_0x7321('0x39')]?_0x567008[_0x7321('0x37')]:_0x4138b5[_0x7321('0x32')];if(!_0x4f42f0['query'][_0x7321('0x3a')](_0x7321('0x3b'))){_0x567008[_0x7321('0x20')]=qs[_0x7321('0x20')](_0x4f42f0[_0x7321('0x33')][_0x7321('0x20')]);_0x567008[_0x7321('0x1f')]=qs['offset'](_0x4f42f0[_0x7321('0x33')][_0x7321('0x1f')]);}_0x567008['order']=qs[_0x7321('0x3c')](_0x4f42f0[_0x7321('0x33')][_0x7321('0x3c')]);_0x567008['where']=qs[_0x7321('0x35')](_[_0x7321('0x3d')](_0x4f42f0[_0x7321('0x33')],_0x4138b5[_0x7321('0x35')]),_0x10670c);if(_0x4f42f0['query']['filter']){_0x567008[_0x7321('0x3e')]=_[_0x7321('0x3f')](_0x567008['where'],{'$or':_[_0x7321('0x40')](_0x10670c,function(_0x3a4513){if(_0x3a4513[_0x7321('0x31')]!==_0x7321('0x41')){var _0x288757={};_0x288757[_0x3a4513[_0x7321('0x2d')]]={'$like':'%'+_0x4f42f0[_0x7321('0x33')][_0x7321('0x42')]+'%'};return _0x288757;}})});}_0x567008=_[_0x7321('0x3f')]({},_0x567008,_0x4f42f0[_0x7321('0x43')]);var _0x1b4337={'where':_0x567008[_0x7321('0x3e')]};return db[_0x7321('0x44')][_0x7321('0x1e')](_0x1b4337)[_0x7321('0x27')](function(_0x40464f){_0xad7ad7[_0x7321('0x1e')]=_0x40464f;if(_0x4f42f0[_0x7321('0x33')][_0x7321('0x45')]){_0x567008[_0x7321('0x46')]=[{'all':!![]}];}return db[_0x7321('0x44')][_0x7321('0x47')](_0x567008);})['then'](function(_0x24a4ae){_0xad7ad7[_0x7321('0x48')]=_0x24a4ae;return _0xad7ad7;})[_0x7321('0x27')](respondWithFilteredResult(_0x3f42cc,_0x567008))[_0x7321('0x49')](handleError(_0x3f42cc,null));};exports[_0x7321('0x4a')]=function(_0x3d5376,_0x51a72d){var _0x37b4bb={'raw':!![],'where':{'id':_0x3d5376[_0x7321('0x4b')]['id']}},_0x5ea656={};_0x5ea656['model']=_['keys'](db[_0x7321('0x44')][_0x7321('0x2f')]);_0x5ea656[_0x7321('0x33')]=_[_0x7321('0x34')](_0x3d5376[_0x7321('0x33')]);_0x5ea656[_0x7321('0x35')]=_['intersection'](_0x5ea656['model'],_0x5ea656[_0x7321('0x33')]);_0x37b4bb[_0x7321('0x37')]=_['intersection'](_0x5ea656[_0x7321('0x32')],qs[_0x7321('0x38')](_0x3d5376[_0x7321('0x33')]['fields']));_0x37b4bb[_0x7321('0x37')]=_0x37b4bb[_0x7321('0x37')][_0x7321('0x39')]?_0x37b4bb['attributes']:_0x5ea656[_0x7321('0x32')];if(_0x3d5376[_0x7321('0x33')][_0x7321('0x45')]){_0x37b4bb['include']=[{'all':!![]}];}_0x37b4bb=_[_0x7321('0x3f')]({},_0x37b4bb,_0x3d5376[_0x7321('0x43')]);return db[_0x7321('0x44')][_0x7321('0x4c')](_0x37b4bb)[_0x7321('0x27')](handleEntityNotFound(_0x51a72d,null))[_0x7321('0x27')](respondWithResult(_0x51a72d,null))[_0x7321('0x49')](handleError(_0x51a72d,null));};exports['create']=function(_0x3a953d,_0x274353){return db[_0x7321('0x44')][_0x7321('0x4d')](_0x3a953d[_0x7321('0x4e')],{})['then'](function(_0x555a1c){var _0x5a90bd=_0x3a953d[_0x7321('0x4f')][_0x7321('0x28')]({'plain':!![]});if(!_0x5a90bd)throw new Error(_0x7321('0x50'));if(_0x5a90bd[_0x7321('0x51')]===_0x7321('0x4f')){var _0x13bb07=_0x555a1c['get']({'plain':!![]});var _0x3630ae=_0x7321('0x29');return db[_0x7321('0x52')][_0x7321('0x4c')]({'where':{'name':_0x3630ae,'userProfileId':_0x5a90bd[_0x7321('0x53')]},'raw':!![]})[_0x7321('0x27')](function(_0x1ae367){if(_0x1ae367&&_0x1ae367[_0x7321('0x54')]===0x0){return db[_0x7321('0x2a')][_0x7321('0x4d')]({'name':_0x13bb07[_0x7321('0x2d')],'resourceId':_0x13bb07['id'],'type':_0x1ae367['name'],'sectionId':_0x1ae367['id']},{})['then'](function(){return _0x555a1c;});}else{return _0x555a1c;}})[_0x7321('0x49')](function(_0xf8d9bb){logger[_0x7321('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf8d9bb);throw _0xf8d9bb;});}return _0x555a1c;})['then'](respondWithResult(_0x274353,0xc9))[_0x7321('0x49')](handleError(_0x274353,null));};exports[_0x7321('0x25')]=function(_0x5ccabc,_0x19b0c2){if(_0x5ccabc[_0x7321('0x4e')]['id']){delete _0x5ccabc[_0x7321('0x4e')]['id'];}return db['VoiceMail'][_0x7321('0x4c')]({'where':{'id':_0x5ccabc[_0x7321('0x4b')]['id']}})[_0x7321('0x27')](handleEntityNotFound(_0x19b0c2,null))['then'](saveUpdates(_0x5ccabc['body'],null))[_0x7321('0x27')](respondWithResult(_0x19b0c2,null))[_0x7321('0x49')](handleError(_0x19b0c2,null));};exports[_0x7321('0x26')]=function(_0x139a7e,_0x422825){return db[_0x7321('0x44')][_0x7321('0x4c')]({'where':{'id':_0x139a7e['params']['id']}})[_0x7321('0x27')](handleEntityNotFound(_0x422825,null))[_0x7321('0x27')](removeEntity(_0x422825,null))[_0x7321('0x49')](handleError(_0x422825,null));};exports[_0x7321('0x55')]=function(_0x356c60,_0x615e47,_0x3a673a){return db['VoiceMail'][_0x7321('0x56')]({'where':{'id':_0x356c60['params']['id']}})['then'](handleEntityNotFound(_0x615e47,null))[_0x7321('0x27')](function(_0x1288ac){var _0x546cc9;var _0x48baa5={},_0x359800={};_0x359800['model']=_[_0x7321('0x34')](db[_0x7321('0x57')]['rawAttributes']);_0x359800[_0x7321('0x33')]=_[_0x7321('0x34')](_0x356c60[_0x7321('0x33')]);_0x359800[_0x7321('0x35')]=_['intersection'](_0x359800['model'],_0x359800[_0x7321('0x33')]);_0x48baa5[_0x7321('0x37')]=_[_0x7321('0x36')](_0x359800[_0x7321('0x32')],qs[_0x7321('0x38')](_0x356c60[_0x7321('0x33')]['fields']));_0x48baa5[_0x7321('0x37')]=_0x48baa5['attributes']['length']?_0x48baa5[_0x7321('0x37')]:_0x359800[_0x7321('0x32')];if(!_0x356c60[_0x7321('0x33')][_0x7321('0x3a')](_0x7321('0x3b'))){_0x48baa5[_0x7321('0x20')]=qs[_0x7321('0x20')](_0x356c60[_0x7321('0x33')]['limit']);_0x48baa5[_0x7321('0x1f')]=qs[_0x7321('0x1f')](_0x356c60['query'][_0x7321('0x1f')]);}_0x48baa5['order']=qs[_0x7321('0x3c')](_0x356c60[_0x7321('0x33')][_0x7321('0x3c')]);_0x48baa5[_0x7321('0x3e')]=qs[_0x7321('0x35')](_[_0x7321('0x3d')](_0x356c60[_0x7321('0x33')],_0x359800[_0x7321('0x35')]));if(_0x356c60[_0x7321('0x33')][_0x7321('0x42')]){_0x48baa5[_0x7321('0x3e')]=_['merge'](_0x48baa5[_0x7321('0x3e')],{'$or':_[_0x7321('0x40')](_0x48baa5[_0x7321('0x37')],function(_0x3ba855){var _0x434b28={};_0x434b28[_0x3ba855]={'$like':'%'+_0x356c60['query']['filter']+'%'};return _0x434b28;})});}_0x48baa5[_0x7321('0x3e')]=_[_0x7321('0x3f')](_0x48baa5['where'],{'mailboxuser':_0x1288ac[_0x7321('0x58')]});_0x48baa5=_['merge']({},_0x48baa5,_0x356c60[_0x7321('0x43')]);return db[_0x7321('0x57')][_0x7321('0x59')](_0x48baa5)[_0x7321('0x27')](respondWithFilteredResult(_0x615e47,_0x48baa5));})['catch'](handleError(_0x615e47,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 26eec9c..e47714e 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 _0xd3f0=['../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','mailbox','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4d717b,_0x3c22c0){var _0x557cb8=function(_0x1d771e){while(--_0x1d771e){_0x4d717b['push'](_0x4d717b['shift']());}};_0x557cb8(++_0x3c22c0);}(_0xd3f0,0xd8));var _0x0d3f=function(_0x4ca838,_0x14b644){_0x4ca838=_0x4ca838-0x0;var _0x385196=_0xd3f0[_0x4ca838];return _0x385196;};'use strict';var _=require(_0x0d3f('0x0'));var util=require(_0x0d3f('0x1'));var logger=require(_0x0d3f('0x2'))(_0x0d3f('0x3'));var moment=require(_0x0d3f('0x4'));var BPromise=require(_0x0d3f('0x5'));var rp=require(_0x0d3f('0x6'));var fs=require('fs');var path=require(_0x0d3f('0x7'));var rimraf=require(_0x0d3f('0x8'));var config=require(_0x0d3f('0x9'));var attributes=require(_0x0d3f('0xa'));module[_0x0d3f('0xb')]=function(_0xef4496,_0x2feebe){return _0xef4496[_0x0d3f('0xc')](_0x0d3f('0xd'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x0d3f('0xe'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7122=['mailbox','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceMail.attributes','VoiceMail','voice_voicemail','mailbox_context'];(function(_0x5e9c3a,_0x13acc2){var _0x12ccb4=function(_0x3ffd23){while(--_0x3ffd23){_0x5e9c3a['push'](_0x5e9c3a['shift']());}};_0x12ccb4(++_0x13acc2);}(_0x7122,0x9d));var _0x2712=function(_0x114b27,_0x42f774){_0x114b27=_0x114b27-0x0;var _0x457a0f=_0x7122[_0x114b27];return _0x457a0f;};'use strict';var _=require(_0x2712('0x0'));var util=require(_0x2712('0x1'));var logger=require(_0x2712('0x2'))(_0x2712('0x3'));var moment=require(_0x2712('0x4'));var BPromise=require(_0x2712('0x5'));var rp=require(_0x2712('0x6'));var fs=require('fs');var path=require(_0x2712('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2712('0x8'));module['exports']=function(_0x480d0d,_0x34fec8){return _0x480d0d['define'](_0x2712('0x9'),attributes,{'tableName':_0x2712('0xa'),'paranoid':![],'indexes':[{'name':_0x2712('0xb'),'fields':[_0x2712('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 9476b61..d2b9b8b 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 _0x710c=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x2c5463,_0x485c01){var _0x31e7c2=function(_0x4716fc){while(--_0x4716fc){_0x2c5463['push'](_0x2c5463['shift']());}};_0x31e7c2(++_0x485c01);}(_0x710c,0x1ce));var _0xc710=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0x710c[_0x9cfe28];return _0x54a1d0;};'use strict';var _=require(_0xc710('0x0'));var util=require(_0xc710('0x1'));var moment=require(_0xc710('0x2'));var BPromise=require(_0xc710('0x3'));var rs=require(_0xc710('0x4'));var fs=require('fs');var Redis=require(_0xc710('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc710('0x6'));var logger=require(_0xc710('0x7'))(_0xc710('0x8'));var config=require(_0xc710('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc710('0xa')][_0xc710('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x821f28,_0x385193,_0x3d680d){return new BPromise(function(_0x377842,_0x5f5a08){return client[_0xc710('0xc')](_0x821f28,_0x3d680d)[_0xc710('0xd')](function(_0x5d2d0c){logger[_0xc710('0xe')](_0xc710('0xf'),_0x385193,'request\x20sent');logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x385193,_0xc710('0x10'),JSON[_0xc710('0x11')](_0x5d2d0c));if(_0x5d2d0c['error']){if(_0x5d2d0c[_0xc710('0x12')]['code']===0x1f4){logger['error'](_0xc710('0xf'),_0x385193,_0x5d2d0c[_0xc710('0x12')][_0xc710('0x13')]);return _0x5f5a08(_0x5d2d0c[_0xc710('0x12')][_0xc710('0x13')]);}logger[_0xc710('0x12')](_0xc710('0xf'),_0x385193,_0x5d2d0c[_0xc710('0x12')][_0xc710('0x13')]);return _0x377842(_0x5d2d0c[_0xc710('0x12')][_0xc710('0x13')]);}else{logger[_0xc710('0xe')]('VoiceMail,\x20%s,\x20%s',_0x385193,_0xc710('0x10'));_0x377842(_0x5d2d0c[_0xc710('0x14')][_0xc710('0x13')]);}})['catch'](function(_0x1a685a){logger[_0xc710('0x12')](_0xc710('0xf'),_0x385193,_0x1a685a);_0x5f5a08(_0x1a685a);});});} \ No newline at end of file +var _0x0dac=['VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info'];(function(_0x3a93f2,_0x4038e0){var _0x357c12=function(_0x5166ce){while(--_0x5166ce){_0x3a93f2['push'](_0x3a93f2['shift']());}};_0x357c12(++_0x4038e0);}(_0x0dac,0xb9));var _0xc0da=function(_0x24271c,_0x4b4104){_0x24271c=_0x24271c-0x0;var _0xa5d9d9=_0x0dac[_0x24271c];return _0xa5d9d9;};'use strict';var _=require(_0xc0da('0x0'));var util=require(_0xc0da('0x1'));var moment=require(_0xc0da('0x2'));var BPromise=require(_0xc0da('0x3'));var rs=require(_0xc0da('0x4'));var fs=require('fs');var Redis=require(_0xc0da('0x5'));var db=require(_0xc0da('0x6'))['db'];var utils=require(_0xc0da('0x7'));var logger=require('../../config/logger')(_0xc0da('0x8'));var config=require(_0xc0da('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc0da('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2adf48,_0x444af0,_0x13e4aa){return new BPromise(function(_0x1b2010,_0x40c4d0){return client[_0xc0da('0xb')](_0x2adf48,_0x13e4aa)['then'](function(_0x3e8474){logger[_0xc0da('0xc')](_0xc0da('0xd'),_0x444af0,_0xc0da('0xe'));logger['debug'](_0xc0da('0xf'),_0x444af0,_0xc0da('0xe'),JSON[_0xc0da('0x10')](_0x3e8474));if(_0x3e8474[_0xc0da('0x11')]){if(_0x3e8474[_0xc0da('0x11')][_0xc0da('0x12')]===0x1f4){logger[_0xc0da('0x11')]('VoiceMail,\x20%s,\x20%s',_0x444af0,_0x3e8474[_0xc0da('0x11')]['message']);return _0x40c4d0(_0x3e8474[_0xc0da('0x11')][_0xc0da('0x13')]);}logger[_0xc0da('0x11')](_0xc0da('0xd'),_0x444af0,_0x3e8474[_0xc0da('0x11')][_0xc0da('0x13')]);return _0x1b2010(_0x3e8474['error'][_0xc0da('0x13')]);}else{logger[_0xc0da('0xc')](_0xc0da('0xd'),_0x444af0,_0xc0da('0xe'));_0x1b2010(_0x3e8474[_0xc0da('0x14')][_0xc0da('0x13')]);}})[_0xc0da('0x15')](function(_0x1c812f){logger[_0xc0da('0x11')](_0xc0da('0xd'),_0x444af0,_0x1c812f);_0x40c4d0(_0x1c812f);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 1f979e5..875846e 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 _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','download','post','create','put','update'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xc4aa[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xac4a('0x6'));router[_0xac4a('0x7')]('/',auth[_0xac4a('0x8')](),controller[_0xac4a('0x9')]);router[_0xac4a('0x7')](_0xac4a('0xa'),auth[_0xac4a('0x8')](),controller[_0xac4a('0xb')]);router['get']('/:id/download',auth[_0xac4a('0x8')](),controller[_0xac4a('0xc')]);router[_0xac4a('0xd')]('/',auth['isAuthenticated'](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')](_0xac4a('0xa'),auth['isAuthenticated'](),controller[_0xac4a('0x10')]);router['delete'](_0xac4a('0xa'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file +var _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','destroy','exports','multer','util'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x814b,0x1a2));var _0xb814=function(_0x45bcb1,_0x46cad0){_0x45bcb1=_0x45bcb1-0x0;var _0x4bd6a3=_0x814b[_0x45bcb1];return _0x4bd6a3;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['show']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 155ed46..1fef37e 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 _0x7494=['sequelize','exports','STRING','BLOB','TIMESTAMP'];(function(_0x2b7f26,_0x2d1964){var _0x2c22ad=function(_0x1e8c20){while(--_0x1e8c20){_0x2b7f26['push'](_0x2b7f26['shift']());}};_0x2c22ad(++_0x2d1964);}(_0x7494,0x10e));var _0x4749=function(_0x532b4c,_0x2d03cc){_0x532b4c=_0x532b4c-0x0;var _0x3b8092=_0x7494[_0x532b4c];return _0x3b8092;};'use strict';var Sequelize=require(_0x4749('0x0'));module[_0x4749('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x558cf2){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x4749('0x2')],'defaultValue':''},'context':{'type':Sequelize[_0x4749('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x4749('0x2')],'defaultValue':''},'origtime':{'type':Sequelize[_0x4749('0x2')],'defaultValue':''},'duration':{'type':Sequelize[_0x4749('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x4749('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x4749('0x2')],'defaultValue':''},'recording':{'type':Sequelize[_0x4749('0x3')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x4749('0x2')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x4749('0x2')],'defaultValue':''},'stamp':{'type':_0x4749('0x4'),'allowNull':![]}}; \ No newline at end of file +var _0xcab7=['sequelize','VIRTUAL','STRING','BLOB','TIMESTAMP'];(function(_0x10e347,_0x53379c){var _0x1c39b7=function(_0x3086ca){while(--_0x3086ca){_0x10e347['push'](_0x10e347['shift']());}};_0x1c39b7(++_0x53379c);}(_0xcab7,0x9b));var _0x7cab=function(_0x3b3f4f,_0x403216){_0x3b3f4f=_0x3b3f4f-0x0;var _0x174dbe=_0xcab7[_0x3b3f4f];return _0x174dbe;};'use strict';var Sequelize=require(_0x7cab('0x0'));module['exports']={'name':{'type':Sequelize[_0x7cab('0x1')],'get':function(_0x9a1659){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x7cab('0x2')],'defaultValue':''},'context':{'type':Sequelize[_0x7cab('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x7cab('0x2')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x7cab('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x7cab('0x2')],'defaultValue':''},'recording':{'type':Sequelize[_0x7cab('0x3')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x7cab('0x4'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index bf5b22b..bec0081 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 _0xeb74=['offset','limit','set','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','.wav\x22','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count'];(function(_0x4e8401,_0x51b328){var _0x17269f=function(_0x35ac65){while(--_0x35ac65){_0x4e8401['push'](_0x4e8401['shift']());}};_0x17269f(++_0x51b328);}(_0xeb74,0xe3));var _0x4eb7=function(_0x342bfa,_0xb82493){_0x342bfa=_0x342bfa-0x0;var _0x26a582=_0xeb74[_0x342bfa];return _0x26a582;};'use strict';var pdf=require(_0x4eb7('0x0'));var emlformat=require(_0x4eb7('0x1'));var rimraf=require(_0x4eb7('0x2'));var zipdir=require(_0x4eb7('0x3'));var jsonpatch=require(_0x4eb7('0x4'));var rp=require(_0x4eb7('0x5'));var moment=require(_0x4eb7('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x4eb7('0x7'));var util=require(_0x4eb7('0x8'));var path=require(_0x4eb7('0x9'));var sox=require(_0x4eb7('0xa'));var csv=require(_0x4eb7('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4eb7('0xc'));var squel=require('squel');var crypto=require(_0x4eb7('0xd'));var jsforce=require(_0x4eb7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4eb7('0xf'));var Papa=require(_0x4eb7('0x10'));var Redis=require('ioredis');var authService=require(_0x4eb7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4eb7('0x12'));var hardwareService=require(_0x4eb7('0x13'));var logger=require(_0x4eb7('0x14'))('api');var utils=require(_0x4eb7('0x15'));var config=require(_0x4eb7('0x16'));var db=require(_0x4eb7('0x17'))['db'];function respondWithStatusCode(_0x3273b1,_0x35fa89){_0x35fa89=_0x35fa89||0xcc;return function(_0x4194e1){if(_0x4194e1){return _0x3273b1[_0x4eb7('0x18')](_0x35fa89);}return _0x3273b1['status'](_0x35fa89)['end']();};}function respondWithResult(_0x5c6bc9,_0x17fb81){_0x17fb81=_0x17fb81||0xc8;return function(_0x51f09d){if(_0x51f09d){return _0x5c6bc9[_0x4eb7('0x19')](_0x17fb81)[_0x4eb7('0x1a')](_0x51f09d);}};}function respondWithFilteredResult(_0x24db56,_0x1c4a97){return function(_0x5d6d5){if(_0x5d6d5){var _0x21433d=_0x5d6d5[_0x4eb7('0x1b')],_0x11674f=_0x1c4a97['offset'],_0x76988=_0x1c4a97[_0x4eb7('0x1c')]+_0x1c4a97[_0x4eb7('0x1d')],_0x157710;if(_0x76988>=_0x21433d){_0x76988=_0x21433d;_0x157710=0xc8;}else{_0x157710=0xce;}_0x24db56[_0x4eb7('0x19')](_0x157710);return _0x24db56[_0x4eb7('0x1e')](_0x4eb7('0x1f'),_0x11674f+'-'+_0x76988+'/'+_0x21433d)[_0x4eb7('0x1a')](_0x5d6d5);}return null;};}function patchUpdates(_0x2d0ea7){return function(_0x16c024){try{jsonpatch['apply'](_0x16c024,_0x2d0ea7,!![]);}catch(_0x3cf53a){return BPromise[_0x4eb7('0x20')](_0x3cf53a);}return _0x16c024[_0x4eb7('0x21')]();};}function saveUpdates(_0x21377b,_0x32f0f5){return function(_0x2efd67){if(_0x2efd67){return _0x2efd67[_0x4eb7('0x22')](_0x21377b)['then'](function(_0x214a28){return _0x214a28;});}return null;};}function removeEntity(_0x28ad09,_0x4783b1){return function(_0x164515){if(_0x164515){return _0x164515[_0x4eb7('0x23')]()[_0x4eb7('0x24')](function(){_0x28ad09[_0x4eb7('0x19')](0xcc)[_0x4eb7('0x25')]();});}};}function handleEntityNotFound(_0x1a2b8b,_0x13e871){return function(_0x4de2d9){if(!_0x4de2d9){_0x1a2b8b[_0x4eb7('0x18')](0x194);}return _0x4de2d9;};}function handleError(_0x2f7a05,_0x2e8de8){_0x2e8de8=_0x2e8de8||0x1f4;return function(_0x43bf73){logger[_0x4eb7('0x26')](_0x43bf73[_0x4eb7('0x27')]);if(_0x43bf73[_0x4eb7('0x28')]){delete _0x43bf73[_0x4eb7('0x28')];}_0x2f7a05[_0x4eb7('0x19')](_0x2e8de8)[_0x4eb7('0x29')](_0x43bf73);};}exports[_0x4eb7('0x2a')]=function(_0x2984b2,_0x2d1773){var _0x1b56a8={},_0x433794={},_0x1c0665={'count':0x0,'rows':[]};var _0x2be00c=_[_0x4eb7('0x2b')](db[_0x4eb7('0x2c')][_0x4eb7('0x2d')],function(_0x114c68){return{'name':_0x114c68[_0x4eb7('0x2e')],'type':_0x114c68[_0x4eb7('0x2f')]['key']};});_0x433794[_0x4eb7('0x30')]=_['differenceBy'](_[_0x4eb7('0x2b')](_0x2be00c,_0x4eb7('0x28')),[_0x4eb7('0x28')]);_0x433794[_0x4eb7('0x31')]=_[_0x4eb7('0x32')](_0x2984b2[_0x4eb7('0x31')]);_0x433794[_0x4eb7('0x33')]=_[_0x4eb7('0x34')](_0x433794[_0x4eb7('0x30')],_0x433794['query']);_0x1b56a8[_0x4eb7('0x35')]=_['intersection'](_0x433794[_0x4eb7('0x30')],qs[_0x4eb7('0x36')](_0x2984b2['query']['fields']));_0x1b56a8[_0x4eb7('0x35')]=_0x1b56a8[_0x4eb7('0x35')][_0x4eb7('0x37')]?_0x1b56a8[_0x4eb7('0x35')]:_0x433794['model'];if(!_0x2984b2[_0x4eb7('0x31')][_0x4eb7('0x38')](_0x4eb7('0x39'))){_0x1b56a8[_0x4eb7('0x1d')]=qs[_0x4eb7('0x1d')](_0x2984b2['query'][_0x4eb7('0x1d')]);_0x1b56a8[_0x4eb7('0x1c')]=qs[_0x4eb7('0x1c')](_0x2984b2['query'][_0x4eb7('0x1c')]);}_0x1b56a8[_0x4eb7('0x3a')]=qs[_0x4eb7('0x3b')](_0x2984b2['query'][_0x4eb7('0x3b')]);_0x1b56a8['where']=qs[_0x4eb7('0x33')](_[_0x4eb7('0x3c')](_0x2984b2[_0x4eb7('0x31')],_0x433794[_0x4eb7('0x33')]),_0x2be00c);if(_0x2984b2['query'][_0x4eb7('0x3d')]){_0x1b56a8[_0x4eb7('0x3e')]=_[_0x4eb7('0x3f')](_0x1b56a8[_0x4eb7('0x3e')],{'$or':_['map'](_0x2be00c,function(_0x51a44b){if(_0x51a44b['type']!==_0x4eb7('0x40')){var _0x398f63={};_0x398f63[_0x51a44b[_0x4eb7('0x28')]]={'$like':'%'+_0x2984b2[_0x4eb7('0x31')][_0x4eb7('0x3d')]+'%'};return _0x398f63;}})});}_0x1b56a8=_[_0x4eb7('0x3f')]({},_0x1b56a8,_0x2984b2[_0x4eb7('0x41')]);var _0x20d2bc={'where':_0x1b56a8[_0x4eb7('0x3e')]};return db[_0x4eb7('0x2c')]['count'](_0x20d2bc)[_0x4eb7('0x24')](function(_0x38218f){_0x1c0665[_0x4eb7('0x1b')]=_0x38218f;if(_0x2984b2[_0x4eb7('0x31')][_0x4eb7('0x42')]){_0x1b56a8[_0x4eb7('0x43')]=[{'all':!![]}];}return db[_0x4eb7('0x2c')][_0x4eb7('0x44')](_0x1b56a8);})[_0x4eb7('0x24')](function(_0x3a31ce){_0x1c0665[_0x4eb7('0x45')]=_0x3a31ce;return _0x1c0665;})[_0x4eb7('0x24')](respondWithFilteredResult(_0x2d1773,_0x1b56a8))[_0x4eb7('0x46')](handleError(_0x2d1773,null));};exports[_0x4eb7('0x47')]=function(_0x38af1f,_0x5b819f){var _0x359bae={'raw':!![],'where':{'id':_0x38af1f[_0x4eb7('0x48')]['id']}},_0xc302ac={};_0xc302ac[_0x4eb7('0x30')]=_['keys'](db[_0x4eb7('0x2c')][_0x4eb7('0x2d')]);_0xc302ac[_0x4eb7('0x31')]=_[_0x4eb7('0x32')](_0x38af1f[_0x4eb7('0x31')]);_0xc302ac[_0x4eb7('0x33')]=_[_0x4eb7('0x34')](_0xc302ac[_0x4eb7('0x30')],_0xc302ac[_0x4eb7('0x31')]);_0x359bae['attributes']=_[_0x4eb7('0x34')](_0xc302ac['model'],qs[_0x4eb7('0x36')](_0x38af1f[_0x4eb7('0x31')][_0x4eb7('0x36')]));_0x359bae['attributes']=_0x359bae[_0x4eb7('0x35')][_0x4eb7('0x37')]?_0x359bae[_0x4eb7('0x35')]:_0xc302ac[_0x4eb7('0x30')];if(_0x38af1f['query'][_0x4eb7('0x42')]){_0x359bae['include']=[{'all':!![]}];}_0x359bae=_[_0x4eb7('0x3f')]({},_0x359bae,_0x38af1f[_0x4eb7('0x41')]);return db[_0x4eb7('0x2c')][_0x4eb7('0x49')](_0x359bae)[_0x4eb7('0x24')](handleEntityNotFound(_0x5b819f,null))['then'](respondWithResult(_0x5b819f,null))['catch'](handleError(_0x5b819f,null));};exports[_0x4eb7('0x4a')]=function(_0x1092b9,_0x289780){return db[_0x4eb7('0x2c')][_0x4eb7('0x4a')](_0x1092b9['body'],{})[_0x4eb7('0x24')](respondWithResult(_0x289780,0xc9))[_0x4eb7('0x46')](handleError(_0x289780,null));};exports['update']=function(_0x22e09c,_0x1cb6aa){if(_0x22e09c['body']['id']){delete _0x22e09c[_0x4eb7('0x4b')]['id'];}return db[_0x4eb7('0x2c')][_0x4eb7('0x49')]({'where':{'id':_0x22e09c['params']['id']}})[_0x4eb7('0x24')](handleEntityNotFound(_0x1cb6aa,null))['then'](saveUpdates(_0x22e09c['body'],null))[_0x4eb7('0x24')](respondWithResult(_0x1cb6aa,null))[_0x4eb7('0x46')](handleError(_0x1cb6aa,null));};exports[_0x4eb7('0x23')]=function(_0x42070c,_0x320c69){return db[_0x4eb7('0x2c')][_0x4eb7('0x49')]({'where':{'id':_0x42070c[_0x4eb7('0x48')]['id']}})[_0x4eb7('0x24')](handleEntityNotFound(_0x320c69,null))[_0x4eb7('0x24')](removeEntity(_0x320c69,null))[_0x4eb7('0x46')](handleError(_0x320c69,null));};exports[_0x4eb7('0x4c')]=function(_0x41e990,_0x143c5e,_0xcbc0d9){return db[_0x4eb7('0x2c')][_0x4eb7('0x49')]({'where':{'id':_0x41e990[_0x4eb7('0x48')]['id']},'attributes':['id',_0x4eb7('0x4d'),_0x4eb7('0x4e')]})['then'](handleEntityNotFound(_0x143c5e,null))[_0x4eb7('0x24')](function(_0x550888){if(_0x550888){if(!_0x550888['recording']){throw new db[(_0x4eb7('0x4f'))][(_0x4eb7('0x50'))](_0x4eb7('0x51'));}var _0x113ed7={'Content-Type':_0x4eb7('0x52'),'Content-Disposition':'attachment'};if(_0x550888['msg_id']){_0x113ed7[_0x4eb7('0x53')]='attachment;\x20filename=\x22'+_0x550888[_0x4eb7('0x4e')]+_0x4eb7('0x54');}_0x143c5e[_0x4eb7('0x1e')](_0x113ed7);return _0x143c5e[_0x4eb7('0x29')](new Buffer(_0x550888['recording']));}})[_0x4eb7('0x46')](handleError(_0x143c5e,null));}; \ No newline at end of file +var _0x84a0=['merge','map','VIRTUAL','options','count','include','findAll','rows','catch','show','find','create','body','params','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','.wav\x22','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','filter'];(function(_0x50b2da,_0x9f4363){var _0x9f30d9=function(_0x1b3e37){while(--_0x1b3e37){_0x50b2da['push'](_0x50b2da['shift']());}};_0x9f30d9(++_0x9f4363);}(_0x84a0,0x66));var _0x084a=function(_0x40aa66,_0x2c7679){_0x40aa66=_0x40aa66-0x0;var _0x593df7=_0x84a0[_0x40aa66];return _0x593df7;};'use strict';var pdf=require(_0x084a('0x0'));var emlformat=require(_0x084a('0x1'));var rimraf=require(_0x084a('0x2'));var zipdir=require(_0x084a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x084a('0x4'));var moment=require(_0x084a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x084a('0x6'));var path=require(_0x084a('0x7'));var sox=require('sox');var csv=require(_0x084a('0x8'));var ejs=require(_0x084a('0x9'));var fs=require('fs');var _=require(_0x084a('0xa'));var squel=require(_0x084a('0xb'));var crypto=require(_0x084a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x084a('0xd'));var toCsv=require(_0x084a('0x8'));var querystring=require(_0x084a('0xe'));var Papa=require(_0x084a('0xf'));var Redis=require(_0x084a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x084a('0x11'));var hardwareService=require(_0x084a('0x12'));var logger=require(_0x084a('0x13'))(_0x084a('0x14'));var utils=require(_0x084a('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc451b1,_0x3ca72f){_0x3ca72f=_0x3ca72f||0xcc;return function(_0xec90a5){if(_0xec90a5){return _0xc451b1[_0x084a('0x16')](_0x3ca72f);}return _0xc451b1[_0x084a('0x17')](_0x3ca72f)[_0x084a('0x18')]();};}function respondWithResult(_0x3ff351,_0x3a76d1){_0x3a76d1=_0x3a76d1||0xc8;return function(_0x5aef40){if(_0x5aef40){return _0x3ff351[_0x084a('0x17')](_0x3a76d1)['json'](_0x5aef40);}};}function respondWithFilteredResult(_0x225de0,_0x3ccaca){return function(_0x366624){if(_0x366624){var _0x2d35b8=_0x366624['count'],_0xd20527=_0x3ccaca[_0x084a('0x19')],_0x4cbd16=_0x3ccaca[_0x084a('0x19')]+_0x3ccaca['limit'],_0x443ebb;if(_0x4cbd16>=_0x2d35b8){_0x4cbd16=_0x2d35b8;_0x443ebb=0xc8;}else{_0x443ebb=0xce;}_0x225de0[_0x084a('0x17')](_0x443ebb);return _0x225de0[_0x084a('0x1a')](_0x084a('0x1b'),_0xd20527+'-'+_0x4cbd16+'/'+_0x2d35b8)[_0x084a('0x1c')](_0x366624);}return null;};}function patchUpdates(_0x33d3a6){return function(_0x145636){try{jsonpatch[_0x084a('0x1d')](_0x145636,_0x33d3a6,!![]);}catch(_0x34e86e){return BPromise[_0x084a('0x1e')](_0x34e86e);}return _0x145636[_0x084a('0x1f')]();};}function saveUpdates(_0x3c7fd6,_0x279e25){return function(_0x116328){if(_0x116328){return _0x116328[_0x084a('0x20')](_0x3c7fd6)[_0x084a('0x21')](function(_0x506f71){return _0x506f71;});}return null;};}function removeEntity(_0x343c5c,_0x1ad257){return function(_0x41a90f){if(_0x41a90f){return _0x41a90f[_0x084a('0x22')]()[_0x084a('0x21')](function(){_0x343c5c['status'](0xcc)[_0x084a('0x18')]();});}};}function handleEntityNotFound(_0x288e9e,_0x6346a5){return function(_0x1f2c9f){if(!_0x1f2c9f){_0x288e9e[_0x084a('0x16')](0x194);}return _0x1f2c9f;};}function handleError(_0x3cdc1e,_0x5be167){_0x5be167=_0x5be167||0x1f4;return function(_0x297e5b){logger[_0x084a('0x23')](_0x297e5b[_0x084a('0x24')]);if(_0x297e5b['name']){delete _0x297e5b[_0x084a('0x25')];}_0x3cdc1e[_0x084a('0x17')](_0x5be167)[_0x084a('0x26')](_0x297e5b);};}exports['index']=function(_0x5596ac,_0x4874fe){var _0x52227a={},_0x33b88f={},_0x5c5efb={'count':0x0,'rows':[]};var _0x5bea78=_['map'](db[_0x084a('0x27')][_0x084a('0x28')],function(_0x388062){return{'name':_0x388062[_0x084a('0x29')],'type':_0x388062[_0x084a('0x2a')][_0x084a('0x2b')]};});_0x33b88f[_0x084a('0x2c')]=_[_0x084a('0x2d')](_['map'](_0x5bea78,_0x084a('0x25')),[_0x084a('0x25')]);_0x33b88f['query']=_[_0x084a('0x2e')](_0x5596ac[_0x084a('0x2f')]);_0x33b88f[_0x084a('0x30')]=_[_0x084a('0x31')](_0x33b88f[_0x084a('0x2c')],_0x33b88f[_0x084a('0x2f')]);_0x52227a[_0x084a('0x32')]=_[_0x084a('0x31')](_0x33b88f[_0x084a('0x2c')],qs[_0x084a('0x33')](_0x5596ac[_0x084a('0x2f')][_0x084a('0x33')]));_0x52227a[_0x084a('0x32')]=_0x52227a['attributes']['length']?_0x52227a[_0x084a('0x32')]:_0x33b88f[_0x084a('0x2c')];if(!_0x5596ac[_0x084a('0x2f')][_0x084a('0x34')](_0x084a('0x35'))){_0x52227a['limit']=qs[_0x084a('0x36')](_0x5596ac[_0x084a('0x2f')][_0x084a('0x36')]);_0x52227a['offset']=qs[_0x084a('0x19')](_0x5596ac[_0x084a('0x2f')][_0x084a('0x19')]);}_0x52227a['order']=qs['sort'](_0x5596ac['query'][_0x084a('0x37')]);_0x52227a[_0x084a('0x38')]=qs[_0x084a('0x30')](_['pick'](_0x5596ac[_0x084a('0x2f')],_0x33b88f[_0x084a('0x30')]),_0x5bea78);if(_0x5596ac[_0x084a('0x2f')][_0x084a('0x39')]){_0x52227a[_0x084a('0x38')]=_[_0x084a('0x3a')](_0x52227a[_0x084a('0x38')],{'$or':_[_0x084a('0x3b')](_0x5bea78,function(_0x434a06){if(_0x434a06[_0x084a('0x2a')]!==_0x084a('0x3c')){var _0x1454a9={};_0x1454a9[_0x434a06[_0x084a('0x25')]]={'$like':'%'+_0x5596ac[_0x084a('0x2f')][_0x084a('0x39')]+'%'};return _0x1454a9;}})});}_0x52227a=_['merge']({},_0x52227a,_0x5596ac[_0x084a('0x3d')]);var _0x1dada8={'where':_0x52227a[_0x084a('0x38')]};return db[_0x084a('0x27')][_0x084a('0x3e')](_0x1dada8)[_0x084a('0x21')](function(_0xa7b652){_0x5c5efb[_0x084a('0x3e')]=_0xa7b652;if(_0x5596ac[_0x084a('0x2f')]['includeAll']){_0x52227a[_0x084a('0x3f')]=[{'all':!![]}];}return db[_0x084a('0x27')][_0x084a('0x40')](_0x52227a);})[_0x084a('0x21')](function(_0x256008){_0x5c5efb[_0x084a('0x41')]=_0x256008;return _0x5c5efb;})['then'](respondWithFilteredResult(_0x4874fe,_0x52227a))[_0x084a('0x42')](handleError(_0x4874fe,null));};exports[_0x084a('0x43')]=function(_0x55c5f4,_0x410fdb){var _0x30428a={'raw':!![],'where':{'id':_0x55c5f4['params']['id']}},_0x68e0d6={};_0x68e0d6[_0x084a('0x2c')]=_[_0x084a('0x2e')](db['VoiceMailMessage'][_0x084a('0x28')]);_0x68e0d6[_0x084a('0x2f')]=_['keys'](_0x55c5f4['query']);_0x68e0d6[_0x084a('0x30')]=_[_0x084a('0x31')](_0x68e0d6[_0x084a('0x2c')],_0x68e0d6[_0x084a('0x2f')]);_0x30428a[_0x084a('0x32')]=_[_0x084a('0x31')](_0x68e0d6[_0x084a('0x2c')],qs[_0x084a('0x33')](_0x55c5f4[_0x084a('0x2f')][_0x084a('0x33')]));_0x30428a[_0x084a('0x32')]=_0x30428a['attributes']['length']?_0x30428a[_0x084a('0x32')]:_0x68e0d6[_0x084a('0x2c')];if(_0x55c5f4[_0x084a('0x2f')]['includeAll']){_0x30428a[_0x084a('0x3f')]=[{'all':!![]}];}_0x30428a=_[_0x084a('0x3a')]({},_0x30428a,_0x55c5f4[_0x084a('0x3d')]);return db[_0x084a('0x27')][_0x084a('0x44')](_0x30428a)['then'](handleEntityNotFound(_0x410fdb,null))[_0x084a('0x21')](respondWithResult(_0x410fdb,null))['catch'](handleError(_0x410fdb,null));};exports[_0x084a('0x45')]=function(_0x4f98c6,_0x1ffd20){return db['VoiceMailMessage']['create'](_0x4f98c6[_0x084a('0x46')],{})[_0x084a('0x21')](respondWithResult(_0x1ffd20,0xc9))['catch'](handleError(_0x1ffd20,null));};exports[_0x084a('0x20')]=function(_0x2c2c2e,_0x12e0d5){if(_0x2c2c2e[_0x084a('0x46')]['id']){delete _0x2c2c2e['body']['id'];}return db[_0x084a('0x27')][_0x084a('0x44')]({'where':{'id':_0x2c2c2e[_0x084a('0x47')]['id']}})[_0x084a('0x21')](handleEntityNotFound(_0x12e0d5,null))['then'](saveUpdates(_0x2c2c2e[_0x084a('0x46')],null))[_0x084a('0x21')](respondWithResult(_0x12e0d5,null))[_0x084a('0x42')](handleError(_0x12e0d5,null));};exports[_0x084a('0x22')]=function(_0x5a718c,_0x502d9a){return db[_0x084a('0x27')][_0x084a('0x44')]({'where':{'id':_0x5a718c[_0x084a('0x47')]['id']}})[_0x084a('0x21')](handleEntityNotFound(_0x502d9a,null))[_0x084a('0x21')](removeEntity(_0x502d9a,null))[_0x084a('0x42')](handleError(_0x502d9a,null));};exports[_0x084a('0x48')]=function(_0x12c3a8,_0xf6ce0d,_0x211606){return db[_0x084a('0x27')][_0x084a('0x44')]({'where':{'id':_0x12c3a8['params']['id']},'attributes':['id',_0x084a('0x49'),_0x084a('0x4a')]})[_0x084a('0x21')](handleEntityNotFound(_0xf6ce0d,null))[_0x084a('0x21')](function(_0x2091b1){if(_0x2091b1){if(!_0x2091b1[_0x084a('0x49')]){throw new db[(_0x084a('0x4b'))]['ValidationError'](_0x084a('0x4c'));}var _0x40dc39={'Content-Type':_0x084a('0x4d'),'Content-Disposition':'attachment'};if(_0x2091b1['msg_id']){_0x40dc39[_0x084a('0x4e')]='attachment;\x20filename=\x22'+_0x2091b1[_0x084a('0x4a')]+_0x084a('0x4f');}_0xf6ce0d['set'](_0x40dc39);return _0xf6ce0d[_0x084a('0x26')](new Buffer(_0x2091b1['recording']));}})['catch'](handleError(_0xf6ce0d,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 5c8428e..1d7347b 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 _0xbfa6=['VoiceMailMessage','dir','lodash','util','bluebird','request-promise','path','../../config/environment','./voiceMailMessage.attributes','exports','define'];(function(_0x39d242,_0xd254af){var _0x4b3ac5=function(_0x407a59){while(--_0x407a59){_0x39d242['push'](_0x39d242['shift']());}};_0x4b3ac5(++_0xd254af);}(_0xbfa6,0x1d0));var _0x6bfa=function(_0x480cca,_0x33709f){_0x480cca=_0x480cca-0x0;var _0x22bcdb=_0xbfa6[_0x480cca];return _0x22bcdb;};'use strict';var _=require(_0x6bfa('0x0'));var util=require(_0x6bfa('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x6bfa('0x2'));var rp=require(_0x6bfa('0x3'));var fs=require('fs');var path=require(_0x6bfa('0x4'));var rimraf=require('rimraf');var config=require(_0x6bfa('0x5'));var attributes=require(_0x6bfa('0x6'));module[_0x6bfa('0x7')]=function(_0x39d9a3,_0x3a3a1a){return _0x39d9a3[_0x6bfa('0x8')](_0x6bfa('0x9'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x6bfa('0xa'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x8a5c=['bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment'];(function(_0x24a531,_0x37a5c6){var _0x3440d8=function(_0x300dab){while(--_0x300dab){_0x24a531['push'](_0x24a531['shift']());}};_0x3440d8(++_0x37a5c6);}(_0x8a5c,0x136));var _0xc8a5=function(_0xb59c62,_0x228786){_0xb59c62=_0xb59c62-0x0;var _0xb67e57=_0x8a5c[_0xb59c62];return _0xb67e57;};'use strict';var _=require(_0xc8a5('0x0'));var util=require(_0xc8a5('0x1'));var logger=require(_0xc8a5('0x2'))(_0xc8a5('0x3'));var moment=require(_0xc8a5('0x4'));var BPromise=require(_0xc8a5('0x5'));var rp=require(_0xc8a5('0x6'));var fs=require('fs');var path=require(_0xc8a5('0x7'));var rimraf=require(_0xc8a5('0x8'));var config=require('../../config/environment');var attributes=require(_0xc8a5('0x9'));module[_0xc8a5('0xa')]=function(_0x5b6cc2,_0x1b4ed4){return _0x5b6cc2[_0xc8a5('0xb')](_0xc8a5('0xc'),attributes,{'tableName':_0xc8a5('0xd'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0xc8a5('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 63318b3..7ed9ad1 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x15599c,_0x1ebd6a){var _0x5f1b30=function(_0x131418){while(--_0x131418){_0x15599c['push'](_0x15599c['shift']());}};_0x5f1b30(++_0x1ebd6a);}(_0x2ef3,0xba));var _0x32ef=function(_0x47cba2,_0x4f5747){_0x47cba2=_0x47cba2-0x0;var _0x3a6605=_0x2ef3[_0x47cba2];return _0x3a6605;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x7440e0,_0x42d9b8){var _0x33ee99=function(_0x3edb33){while(--_0x3edb33){_0x7440e0['push'](_0x7440e0['shift']());}};_0x33ee99(++_0x42d9b8);}(_0xda2d,0x102));var _0xdda2=function(_0x54e391,_0x4c9c53){_0x54e391=_0x54e391-0x0;var _0x445653=_0xda2d[_0x54e391];return _0x445653;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 62aa553..e550054 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 _0x64c0=['isAuthenticated','create','put','destroy','delete','removeSound','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','index','get','/:id','show','/:id/sounds','post'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x64c0,0x193));var _0x064c=function(_0x343dfb,_0xed8587){_0x343dfb=_0x343dfb-0x0;var _0x297fe2=_0x64c0[_0x343dfb];return _0x297fe2;};'use strict';var multer=require(_0x064c('0x0'));var util=require(_0x064c('0x1'));var path=require(_0x064c('0x2'));var timeout=require(_0x064c('0x3'));var express=require('express');var router=express[_0x064c('0x4')]();var auth=require(_0x064c('0x5'));var interaction=require(_0x064c('0x6'));var config=require(_0x064c('0x7'));var controller=require(_0x064c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x064c('0x9')]);router[_0x064c('0xa')](_0x064c('0xb'),auth['isAuthenticated'](),controller[_0x064c('0xc')]);router[_0x064c('0xa')](_0x064c('0xd'),auth['isAuthenticated'](),controller['getSounds']);router[_0x064c('0xe')]('/',auth[_0x064c('0xf')](),controller[_0x064c('0x10')]);router[_0x064c('0xe')](_0x064c('0xd'),auth[_0x064c('0xf')](),controller['addSound']);router[_0x064c('0x11')](_0x064c('0xb'),auth[_0x064c('0xf')](),controller['update']);router['delete']('/:id',auth[_0x064c('0xf')](),controller[_0x064c('0x12')]);router[_0x064c('0x13')]('/:id/sounds/:id2',auth[_0x064c('0xf')](),controller[_0x064c('0x14')]);module[_0x064c('0x15')]=router; \ No newline at end of file +var _0x746b=['show','getSounds','create','post','/:id/sounds','addSound','put','update','delete','destroy','/:id/sounds/:id2','util','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0xea88c1,_0x461ebd){var _0x1082e8=function(_0x53703a){while(--_0x53703a){_0xea88c1['push'](_0xea88c1['shift']());}};_0x1082e8(++_0x461ebd);}(_0x746b,0x1ad));var _0xb746=function(_0x48e06c,_0xd37cb8){_0x48e06c=_0x48e06c-0x0;var _0x45a0df=_0x746b[_0x48e06c];return _0x45a0df;};'use strict';var multer=require('multer');var util=require(_0xb746('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb746('0x1')]();var auth=require(_0xb746('0x2'));var interaction=require(_0xb746('0x3'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router[_0xb746('0x4')]('/',auth[_0xb746('0x5')](),controller[_0xb746('0x6')]);router[_0xb746('0x4')](_0xb746('0x7'),auth[_0xb746('0x5')](),controller[_0xb746('0x8')]);router['get']('/:id/sounds',auth[_0xb746('0x5')](),controller[_0xb746('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb746('0xa')]);router[_0xb746('0xb')](_0xb746('0xc'),auth[_0xb746('0x5')](),controller[_0xb746('0xd')]);router[_0xb746('0xe')]('/:id',auth[_0xb746('0x5')](),controller[_0xb746('0xf')]);router[_0xb746('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xb746('0x11')]);router['delete'](_0xb746('0x12'),auth[_0xb746('0x5')](),controller['removeSound']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 9c39cfa..c3055b9 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 _0x9aca=['STRING','custom','files','quietmp3','alpha','TIMESTAMP','BOOLEAN'];(function(_0x485b86,_0x3df357){var _0x4ebd54=function(_0x298c64){while(--_0x298c64){_0x485b86['push'](_0x485b86['shift']());}};_0x4ebd54(++_0x3df357);}(_0x9aca,0x15e));var _0xa9ac=function(_0x558a70,_0xb9bc02){_0x558a70=_0x558a70-0x0;var _0x306acf=_0x9aca[_0x558a70];return _0x306acf;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa9ac('0x0')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0xa9ac('0x1'),_0xa9ac('0x2'),'mp3nb','quietmp3nb',_0xa9ac('0x3'),'mp3'),'allowNull':!![],'defaultValue':_0xa9ac('0x2')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xa9ac('0x0')],'allowNull':!![]},'digit':{'type':Sequelize[_0xa9ac('0x0')],'allowNull':!![]},'sort':{'type':Sequelize[_0xa9ac('0x0')],'allowNull':!![],'defaultValue':_0xa9ac('0x4')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xa9ac('0x5')},'defaultEntry':{'type':Sequelize[_0xa9ac('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0x496a=['mp3','alpha','TIMESTAMP','BOOLEAN','exports','STRING','files','mp3nb','quietmp3nb','quietmp3'];(function(_0x1fb9a5,_0x1f026c){var _0x5eb7f0=function(_0x5c8979){while(--_0x5c8979){_0x1fb9a5['push'](_0x1fb9a5['shift']());}};_0x5eb7f0(++_0x1f026c);}(_0x496a,0xfe));var _0xa496=function(_0x999d24,_0x1ea701){_0x999d24=_0x999d24-0x0;var _0x2a050d=_0x496a[_0x999d24];return _0x2a050d;};'use strict';var Sequelize=require('sequelize');module[_0xa496('0x0')]={'name':{'type':Sequelize[_0xa496('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM']('custom',_0xa496('0x2'),_0xa496('0x3'),_0xa496('0x4'),_0xa496('0x5'),_0xa496('0x6')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xa496('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xa496('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xa496('0x1')],'allowNull':!![],'defaultValue':_0xa496('0x7')},'format':{'type':Sequelize[_0xa496('0x1')],'allowNull':!![]},'stamp':{'type':_0xa496('0x8')},'defaultEntry':{'type':Sequelize[_0xa496('0x9')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index d4224b2..f0a88b6 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 _0xd8b0=['map','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','VoiceMusicOnHold','count','includeAll','include','findAll','rows','catch','params','keys','find','body','create','transaction','mode','directory','join','root','server/files/moh','files','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','error','sequelize','forEach','unlinkSync','rmdirSync','Sequelize','addSound','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','save_name','symlinkSync','ValidationError','removeSound','id2','message','getSounds','options','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','name','send'];(function(_0x5301ca,_0x438c8d){var _0x350a16=function(_0x1d2e86){while(--_0x1d2e86){_0x5301ca['push'](_0x5301ca['shift']());}};_0x350a16(++_0x438c8d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){var _0x2b924f=_0x56c729[_0x0d8b('0x23')]({'plain':!![]});var _0x38efc8=_0x0d8b('0x24');return db[_0x0d8b('0x25')][_0x0d8b('0x26')]({'where':{'type':_0x38efc8,'resourceId':_0x2b924f['id']}})[_0x0d8b('0x22')](function(){return _0x56c729;});})[_0x0d8b('0x22')](function(){_0x33fb87['status'](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x4463ee,_0x5363e3){return function(_0xe1ef20){if(!_0xe1ef20){_0x4463ee['sendStatus'](0x194);}return _0xe1ef20;};}function handleError(_0x3dd149,_0x234bdd){_0x234bdd=_0x234bdd||0x1f4;return function(_0xa2af02){logger['error'](_0xa2af02['stack']);if(_0xa2af02[_0x0d8b('0x27')]){delete _0xa2af02[_0x0d8b('0x27')];}_0x3dd149['status'](_0x234bdd)[_0x0d8b('0x28')](_0xa2af02);};}exports['index']=function(_0x1b2b59,_0x4b59e5){var _0x97050a={},_0x48f24f={},_0x2ab00d={'count':0x0,'rows':[]};var _0x546bf6=_[_0x0d8b('0x29')](db['VoiceMusicOnHold'][_0x0d8b('0x2a')],function(_0x106e4c){return{'name':_0x106e4c[_0x0d8b('0x2b')],'type':_0x106e4c['type']['key']};});_0x48f24f['model']=_[_0x0d8b('0x29')](_0x546bf6,'name');_0x48f24f[_0x0d8b('0x2c')]=_['keys'](_0x1b2b59['query']);_0x48f24f[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],_0x48f24f[_0x0d8b('0x2c')]);_0x97050a[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],qs[_0x0d8b('0x31')](_0x1b2b59['query'][_0x0d8b('0x31')]));_0x97050a[_0x0d8b('0x30')]=_0x97050a['attributes'][_0x0d8b('0x32')]?_0x97050a[_0x0d8b('0x30')]:_0x48f24f[_0x0d8b('0x2f')];if(!_0x1b2b59['query'][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x97050a[_0x0d8b('0x1b')]=qs[_0x0d8b('0x1b')](_0x1b2b59[_0x0d8b('0x2c')]['limit']);_0x97050a[_0x0d8b('0x1a')]=qs[_0x0d8b('0x1a')](_0x1b2b59['query'][_0x0d8b('0x1a')]);}_0x97050a[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x36')]);_0x97050a['where']=qs['filters'](_[_0x0d8b('0x37')](_0x1b2b59['query'],_0x48f24f['filters']),_0x546bf6);if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x97050a[_0x0d8b('0x39')]=_[_0x0d8b('0x3a')](_0x97050a[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x546bf6,function(_0x579324){if(_0x579324[_0x0d8b('0x3b')]!==_0x0d8b('0x3c')){var _0x28fd82={};_0x28fd82[_0x579324[_0x0d8b('0x27')]]={'$like':'%'+_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x28fd82;}})});}_0x97050a=_[_0x0d8b('0x3a')]({},_0x97050a,_0x1b2b59['options']);var _0x1d06b6={'where':_0x97050a[_0x0d8b('0x39')]};return db[_0x0d8b('0x3d')][_0x0d8b('0x3e')](_0x1d06b6)['then'](function(_0xe0bf42){_0x2ab00d['count']=_0xe0bf42;if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x3f')]){_0x97050a[_0x0d8b('0x40')]=[{'all':!![]}];}return db[_0x0d8b('0x3d')][_0x0d8b('0x41')](_0x97050a);})[_0x0d8b('0x22')](function(_0x1ff17d){_0x2ab00d[_0x0d8b('0x42')]=_0x1ff17d;return _0x2ab00d;})[_0x0d8b('0x22')](respondWithFilteredResult(_0x4b59e5,_0x97050a))[_0x0d8b('0x43')](handleError(_0x4b59e5,null));};exports['show']=function(_0x571acf,_0x576050){var _0x4d0811={'raw':![],'where':{'id':_0x571acf[_0x0d8b('0x44')]['id']}},_0x524d79={};_0x524d79[_0x0d8b('0x2f')]=_[_0x0d8b('0x45')](db['VoiceMusicOnHold']['rawAttributes']);_0x524d79[_0x0d8b('0x2c')]=_[_0x0d8b('0x45')](_0x571acf[_0x0d8b('0x2c')]);_0x524d79['filters']=_[_0x0d8b('0x2e')](_0x524d79[_0x0d8b('0x2f')],_0x524d79['query']);_0x4d0811['attributes']=_[_0x0d8b('0x2e')](_0x524d79['model'],qs[_0x0d8b('0x31')](_0x571acf['query']['fields']));_0x4d0811[_0x0d8b('0x30')]=_0x4d0811[_0x0d8b('0x30')]['length']?_0x4d0811['attributes']:_0x524d79['model'];if(_0x571acf['query'][_0x0d8b('0x3f')]){_0x4d0811[_0x0d8b('0x40')]=[{'all':!![]}];}_0x4d0811=_[_0x0d8b('0x3a')]({},_0x4d0811,_0x571acf['options']);return db[_0x0d8b('0x3d')][_0x0d8b('0x46')](_0x4d0811)[_0x0d8b('0x22')](handleEntityNotFound(_0x576050,null))[_0x0d8b('0x22')](respondWithResult(_0x576050,null))[_0x0d8b('0x43')](handleError(_0x576050,null));};exports[_0x0d8b('0x21')]=function(_0x11d22b,_0x1d5067){if(_0x11d22b[_0x0d8b('0x47')]['id']){delete _0x11d22b[_0x0d8b('0x47')]['id'];}return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0x11d22b[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x1d5067,null))[_0x0d8b('0x22')](saveUpdates(_0x11d22b[_0x0d8b('0x47')],null))[_0x0d8b('0x22')](respondWithResult(_0x1d5067,null))[_0x0d8b('0x43')](handleError(_0x1d5067,null));};exports[_0x0d8b('0x48')]=function(_0x574b90,_0x371fa0,_0x4d8850){return db['sequelize'][_0x0d8b('0x49')](function(_0x113fb7){if(_0x574b90[_0x0d8b('0x47')][_0x0d8b('0x4a')]==='files'){_0x574b90[_0x0d8b('0x47')][_0x0d8b('0x4b')]=path[_0x0d8b('0x4c')](config[_0x0d8b('0x4d')],_0x0d8b('0x4e'),_0x574b90['body']['name']);}return db['VoiceMusicOnHold']['create'](_0x574b90[_0x0d8b('0x47')],{'transaction':_0x113fb7})[_0x0d8b('0x22')](function(_0x5e3bb4){if(_0x574b90['body'][_0x0d8b('0x4a')]===_0x0d8b('0x4f')){fs['mkdirSync'](_0x5e3bb4['directory'],parseInt(_0x0d8b('0x50'),0x8));}var _0xeeefd4=_0x574b90[_0x0d8b('0x51')][_0x0d8b('0x23')]({'plain':!![]});if(!_0xeeefd4)throw new Error(_0x0d8b('0x52'));if(_0xeeefd4['role']===_0x0d8b('0x51')){var _0x2afe34=_0x5e3bb4['get']({'plain':!![]});return db['UserProfileSection'][_0x0d8b('0x46')]({'where':{'name':_0x0d8b('0x24'),'userProfileId':_0xeeefd4['userProfileId']},'raw':!![]})['then'](function(_0xb8be3b){if(_0xb8be3b&&_0xb8be3b[_0x0d8b('0x53')]===0x0){return db[_0x0d8b('0x25')][_0x0d8b('0x48')]({'name':_0x2afe34['name'],'resourceId':_0x2afe34['id'],'type':_0xb8be3b[_0x0d8b('0x27')],'sectionId':_0xb8be3b['id']},{})['then'](function(){return _0x5e3bb4;});}else{return _0x5e3bb4;}})['catch'](function(_0x38c24e){logger[_0x0d8b('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38c24e);});}return _0x5e3bb4;});})['then'](respondWithResult(_0x371fa0,0xc9))[_0x0d8b('0x43')](handleError(_0x371fa0,null));};exports[_0x0d8b('0x26')]=function(_0xccc2a9,_0x2c1eb0,_0x3afc3a){var _0xb66e76;return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0xccc2a9['params']['id']}})[_0x0d8b('0x22')](function(_0x37dc9f){if(_0x37dc9f){return db[_0x0d8b('0x55')][_0x0d8b('0x49')](function(_0x3fb9ea){return _0x37dc9f[_0x0d8b('0x26')]({'transaction':_0x3fb9ea,'raw':!![]})[_0x0d8b('0x22')](function(_0x1c78b6){if(_0x1c78b6[_0x0d8b('0x4b')]){fs['readdirSync'](_0x1c78b6[_0x0d8b('0x4b')])[_0x0d8b('0x56')](function(_0x180b7b){fs[_0x0d8b('0x57')](path[_0x0d8b('0x4c')](_0x1c78b6['directory'],_0x180b7b));});fs[_0x0d8b('0x58')](_0x1c78b6[_0x0d8b('0x4b')]);}return _0x1c78b6;});})[_0x0d8b('0x43')](function(_0x17a87f){throw new db[(_0x0d8b('0x59'))]['ValidationError'](_0x17a87f['message']);});}})[_0x0d8b('0x22')](handleEntityNotFound(_0x2c1eb0,null))[_0x0d8b('0x22')](removeEntity(_0x2c1eb0,null))[_0x0d8b('0x43')](handleError(_0x2c1eb0,null));};exports[_0x0d8b('0x5a')]=function(_0x5a70bd,_0x199122,_0x12aef7){return db[_0x0d8b('0x55')]['transaction'](function(_0x2f19f4){var _0x532a85;return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0x5a70bd[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](function(_0x2b6eb6){if(_0x2b6eb6){_0x532a85=_0x2b6eb6;return _0x2b6eb6[_0x0d8b('0x5a')](_0x5a70bd['body']['id'],{'transaction':_0x2f19f4});}})[_0x0d8b('0x22')](function(_0x4c074d){if(_0x4c074d){return db[_0x0d8b('0x5b')][_0x0d8b('0x5c')]({'where':{'id':_0x5a70bd[_0x0d8b('0x47')]['id']},'attributes':['id',_0x0d8b('0x27'),'save_name',_0x0d8b('0x5d'),_0x0d8b('0x5e')],'raw':!![]});}})[_0x0d8b('0x22')](function(_0x2332fc){if(_0x2332fc){var _0x2ccdae=path[_0x0d8b('0x4c')](config[_0x0d8b('0x4d')],_0x0d8b('0x5f'),util[_0x0d8b('0x60')](_0x0d8b('0x61'),path['basename'](_0x2332fc['save_name'],path[_0x0d8b('0x62')](_0x2332fc[_0x0d8b('0x63')])),_0x2332fc['converted_format']));var _0xb1aa96=path['join'](config['root'],_0x0d8b('0x4e'),_0x532a85[_0x0d8b('0x27')],util['format']('%s.%s',_0x2332fc[_0x0d8b('0x27')],_0x2332fc[_0x0d8b('0x5d')]));fs[_0x0d8b('0x64')](_0x2ccdae,_0xb1aa96);return _0x2332fc;}})[_0x0d8b('0x43')](function(_0x2ab72b){throw new db[(_0x0d8b('0x59'))][(_0x0d8b('0x65'))](_0x2ab72b['message']);});})[_0x0d8b('0x22')](handleEntityNotFound(_0x199122,null))['then'](respondWithResult(_0x199122,0xc9))[_0x0d8b('0x43')](handleError(_0x199122,null));};exports[_0x0d8b('0x66')]=function(_0x2bb690,_0x14a34b,_0x49f610){return db[_0x0d8b('0x55')]['transaction'](function(_0x3a356b){var _0x2c6c5f;return db[_0x0d8b('0x3d')][_0x0d8b('0x5c')]({'where':{'id':_0x2bb690[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x14a34b,null))[_0x0d8b('0x22')](function(_0x91aa89){if(_0x91aa89){_0x2c6c5f=_0x91aa89;return _0x91aa89[_0x0d8b('0x66')](_0x2bb690[_0x0d8b('0x44')]['id2']);}})[_0x0d8b('0x22')](function(_0x54c28b){if(_0x54c28b){return db[_0x0d8b('0x5b')][_0x0d8b('0x5c')]({'where':{'id':_0x2bb690['params'][_0x0d8b('0x67')]},'attributes':['id','name',_0x0d8b('0x63'),_0x0d8b('0x5d'),_0x0d8b('0x5e')],'raw':!![]});}})[_0x0d8b('0x22')](function(_0x2242cd){if(_0x2242cd){fs[_0x0d8b('0x57')](path[_0x0d8b('0x4c')](_0x2c6c5f[_0x0d8b('0x4b')],util['format'](_0x0d8b('0x61'),_0x2242cd[_0x0d8b('0x27')],_0x2242cd['converted_format'])));return _0x2242cd;}})[_0x0d8b('0x43')](function(_0x105df9){throw new db[(_0x0d8b('0x59'))][(_0x0d8b('0x65'))](_0x105df9[_0x0d8b('0x68')]);});})[_0x0d8b('0x22')](handleEntityNotFound(_0x14a34b,null))[_0x0d8b('0x22')](respondWithStatusCode(_0x14a34b,0xcc))[_0x0d8b('0x43')](handleError(_0x14a34b,null));};exports[_0x0d8b('0x69')]=function(_0x5007c0,_0xe35028,_0x16df83){var _0x50c0ff={};var _0x1ece98={};var _0x93fc55;var _0x3acffa;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x5007c0[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0xe35028,null))[_0x0d8b('0x22')](function(_0x5b76af){if(_0x5b76af){_0x93fc55=_0x5b76af;_0x1ece98['model']=_[_0x0d8b('0x45')](db[_0x0d8b('0x5b')][_0x0d8b('0x2a')]);_0x1ece98[_0x0d8b('0x2c')]=_[_0x0d8b('0x45')](_0x5007c0[_0x0d8b('0x2c')]);_0x1ece98[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x1ece98[_0x0d8b('0x2f')],_0x1ece98[_0x0d8b('0x2c')]);_0x50c0ff[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x1ece98[_0x0d8b('0x2f')],qs['fields'](_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x31')]));_0x50c0ff['attributes']=_0x50c0ff['attributes'][_0x0d8b('0x32')]?_0x50c0ff[_0x0d8b('0x30')]:_0x1ece98[_0x0d8b('0x2f')];_0x50c0ff[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x5007c0[_0x0d8b('0x2c')]['sort']);_0x50c0ff['where']=qs['filters'](_[_0x0d8b('0x37')](_0x5007c0[_0x0d8b('0x2c')],_0x1ece98[_0x0d8b('0x2d')]));if(_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x50c0ff[_0x0d8b('0x39')]=_['merge'](_0x50c0ff[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x50c0ff['attributes'],function(_0x30a69d){var _0x57e3c2={};_0x57e3c2[_0x30a69d]={'$like':'%'+_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x57e3c2;})});}_0x50c0ff=_[_0x0d8b('0x3a')]({},_0x50c0ff,_0x5007c0[_0x0d8b('0x6a')]);return _0x93fc55[_0x0d8b('0x69')](_0x50c0ff);}})[_0x0d8b('0x22')](function(_0x424f9d){if(_0x424f9d){_0x3acffa=_0x424f9d[_0x0d8b('0x32')];if(!_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x50c0ff[_0x0d8b('0x1b')]=qs['limit'](_0x5007c0['query'][_0x0d8b('0x1b')]);_0x50c0ff[_0x0d8b('0x1a')]=qs[_0x0d8b('0x1a')](_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x1a')]);}return _0x93fc55[_0x0d8b('0x69')](_0x50c0ff);}})[_0x0d8b('0x22')](function(_0x54674f){if(_0x54674f){return _0x54674f?{'count':_0x3acffa,'rows':_0x54674f}:null;}})[_0x0d8b('0x22')](respondWithResult(_0xe35028,null))['catch'](handleError(_0xe35028,null));}; \ No newline at end of file +var _0xd8b0=['map','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','VoiceMusicOnHold','count','includeAll','include','findAll','rows','catch','params','keys','find','body','create','transaction','mode','directory','join','root','server/files/moh','files','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','error','sequelize','forEach','unlinkSync','rmdirSync','Sequelize','addSound','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','extname','save_name','symlinkSync','ValidationError','removeSound','id2','message','getSounds','options','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','destroy','name','send'];(function(_0x3ca4d0,_0x56b572){var _0xca0702=function(_0x1dc4b9){while(--_0x1dc4b9){_0x3ca4d0['push'](_0x3ca4d0['shift']());}};_0xca0702(++_0x56b572);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x0d8b('0x0'));var emlformat=require(_0x0d8b('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d8b('0x2'));var moment=require(_0x0d8b('0x3'));var BPromise=require(_0x0d8b('0x4'));var Mustache=require(_0x0d8b('0x5'));var util=require(_0x0d8b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0d8b('0x7'));var ejs=require(_0x0d8b('0x8'));var fs=require('fs');var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0x7'));var querystring=require(_0x0d8b('0xc'));var Papa=require(_0x0d8b('0xd'));var Redis=require(_0x0d8b('0xe'));var authService=require(_0x0d8b('0xf'));var qs=require(_0x0d8b('0x10'));var as=require(_0x0d8b('0x11'));var hardwareService=require(_0x0d8b('0x12'));var logger=require('../../config/logger')(_0x0d8b('0x13'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x14'));var db=require(_0x0d8b('0x15'))['db'];function respondWithStatusCode(_0x340cc4,_0x92cdd8){_0x92cdd8=_0x92cdd8||0xcc;return function(_0x35a07b){if(_0x35a07b){return _0x340cc4[_0x0d8b('0x16')](_0x92cdd8);}return _0x340cc4[_0x0d8b('0x17')](_0x92cdd8)[_0x0d8b('0x18')]();};}function respondWithResult(_0x1d4bbc,_0x2ce75e){_0x2ce75e=_0x2ce75e||0xc8;return function(_0x5ad086){if(_0x5ad086){return _0x1d4bbc[_0x0d8b('0x17')](_0x2ce75e)[_0x0d8b('0x19')](_0x5ad086);}};}function respondWithFilteredResult(_0x2d4e1c,_0x4f6f21){return function(_0x23eb7b){if(_0x23eb7b){var _0xa86349=_0x23eb7b['count'],_0x17f7df=_0x4f6f21[_0x0d8b('0x1a')],_0xe2e167=_0x4f6f21[_0x0d8b('0x1a')]+_0x4f6f21[_0x0d8b('0x1b')],_0x2cb03c;if(_0xe2e167>=_0xa86349){_0xe2e167=_0xa86349;_0x2cb03c=0xc8;}else{_0x2cb03c=0xce;}_0x2d4e1c[_0x0d8b('0x17')](_0x2cb03c);return _0x2d4e1c[_0x0d8b('0x1c')](_0x0d8b('0x1d'),_0x17f7df+'-'+_0xe2e167+'/'+_0xa86349)[_0x0d8b('0x19')](_0x23eb7b);}return null;};}function patchUpdates(_0xa3612a){return function(_0x4a15bf){try{jsonpatch[_0x0d8b('0x1e')](_0x4a15bf,_0xa3612a,!![]);}catch(_0x23d58f){return BPromise[_0x0d8b('0x1f')](_0x23d58f);}return _0x4a15bf[_0x0d8b('0x20')]();};}function saveUpdates(_0x24e8ed,_0x5b709c){return function(_0x393beb){if(_0x393beb){return _0x393beb[_0x0d8b('0x21')](_0x24e8ed)['then'](function(_0x4f0a1a){return _0x4f0a1a;});}return null;};}function removeEntity(_0x33fb87,_0x54a9a7){return function(_0x56c729){if(_0x56c729){return _0x56c729['destroy']()[_0x0d8b('0x22')](function(){var _0x2b924f=_0x56c729[_0x0d8b('0x23')]({'plain':!![]});var _0x38efc8=_0x0d8b('0x24');return db[_0x0d8b('0x25')][_0x0d8b('0x26')]({'where':{'type':_0x38efc8,'resourceId':_0x2b924f['id']}})[_0x0d8b('0x22')](function(){return _0x56c729;});})[_0x0d8b('0x22')](function(){_0x33fb87['status'](0xcc)[_0x0d8b('0x18')]();});}};}function handleEntityNotFound(_0x4463ee,_0x5363e3){return function(_0xe1ef20){if(!_0xe1ef20){_0x4463ee['sendStatus'](0x194);}return _0xe1ef20;};}function handleError(_0x3dd149,_0x234bdd){_0x234bdd=_0x234bdd||0x1f4;return function(_0xa2af02){logger['error'](_0xa2af02['stack']);if(_0xa2af02[_0x0d8b('0x27')]){delete _0xa2af02[_0x0d8b('0x27')];}_0x3dd149['status'](_0x234bdd)[_0x0d8b('0x28')](_0xa2af02);};}exports['index']=function(_0x1b2b59,_0x4b59e5){var _0x97050a={},_0x48f24f={},_0x2ab00d={'count':0x0,'rows':[]};var _0x546bf6=_[_0x0d8b('0x29')](db['VoiceMusicOnHold'][_0x0d8b('0x2a')],function(_0x106e4c){return{'name':_0x106e4c[_0x0d8b('0x2b')],'type':_0x106e4c['type']['key']};});_0x48f24f['model']=_[_0x0d8b('0x29')](_0x546bf6,'name');_0x48f24f[_0x0d8b('0x2c')]=_['keys'](_0x1b2b59['query']);_0x48f24f[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],_0x48f24f[_0x0d8b('0x2c')]);_0x97050a[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x48f24f[_0x0d8b('0x2f')],qs[_0x0d8b('0x31')](_0x1b2b59['query'][_0x0d8b('0x31')]));_0x97050a[_0x0d8b('0x30')]=_0x97050a['attributes'][_0x0d8b('0x32')]?_0x97050a[_0x0d8b('0x30')]:_0x48f24f[_0x0d8b('0x2f')];if(!_0x1b2b59['query'][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x97050a[_0x0d8b('0x1b')]=qs[_0x0d8b('0x1b')](_0x1b2b59[_0x0d8b('0x2c')]['limit']);_0x97050a[_0x0d8b('0x1a')]=qs[_0x0d8b('0x1a')](_0x1b2b59['query'][_0x0d8b('0x1a')]);}_0x97050a[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x36')]);_0x97050a['where']=qs['filters'](_[_0x0d8b('0x37')](_0x1b2b59['query'],_0x48f24f['filters']),_0x546bf6);if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x97050a[_0x0d8b('0x39')]=_[_0x0d8b('0x3a')](_0x97050a[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x546bf6,function(_0x579324){if(_0x579324[_0x0d8b('0x3b')]!==_0x0d8b('0x3c')){var _0x28fd82={};_0x28fd82[_0x579324[_0x0d8b('0x27')]]={'$like':'%'+_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x28fd82;}})});}_0x97050a=_[_0x0d8b('0x3a')]({},_0x97050a,_0x1b2b59['options']);var _0x1d06b6={'where':_0x97050a[_0x0d8b('0x39')]};return db[_0x0d8b('0x3d')][_0x0d8b('0x3e')](_0x1d06b6)['then'](function(_0xe0bf42){_0x2ab00d['count']=_0xe0bf42;if(_0x1b2b59[_0x0d8b('0x2c')][_0x0d8b('0x3f')]){_0x97050a[_0x0d8b('0x40')]=[{'all':!![]}];}return db[_0x0d8b('0x3d')][_0x0d8b('0x41')](_0x97050a);})[_0x0d8b('0x22')](function(_0x1ff17d){_0x2ab00d[_0x0d8b('0x42')]=_0x1ff17d;return _0x2ab00d;})[_0x0d8b('0x22')](respondWithFilteredResult(_0x4b59e5,_0x97050a))[_0x0d8b('0x43')](handleError(_0x4b59e5,null));};exports['show']=function(_0x571acf,_0x576050){var _0x4d0811={'raw':![],'where':{'id':_0x571acf[_0x0d8b('0x44')]['id']}},_0x524d79={};_0x524d79[_0x0d8b('0x2f')]=_[_0x0d8b('0x45')](db['VoiceMusicOnHold']['rawAttributes']);_0x524d79[_0x0d8b('0x2c')]=_[_0x0d8b('0x45')](_0x571acf[_0x0d8b('0x2c')]);_0x524d79['filters']=_[_0x0d8b('0x2e')](_0x524d79[_0x0d8b('0x2f')],_0x524d79['query']);_0x4d0811['attributes']=_[_0x0d8b('0x2e')](_0x524d79['model'],qs[_0x0d8b('0x31')](_0x571acf['query']['fields']));_0x4d0811[_0x0d8b('0x30')]=_0x4d0811[_0x0d8b('0x30')]['length']?_0x4d0811['attributes']:_0x524d79['model'];if(_0x571acf['query'][_0x0d8b('0x3f')]){_0x4d0811[_0x0d8b('0x40')]=[{'all':!![]}];}_0x4d0811=_[_0x0d8b('0x3a')]({},_0x4d0811,_0x571acf['options']);return db[_0x0d8b('0x3d')][_0x0d8b('0x46')](_0x4d0811)[_0x0d8b('0x22')](handleEntityNotFound(_0x576050,null))[_0x0d8b('0x22')](respondWithResult(_0x576050,null))[_0x0d8b('0x43')](handleError(_0x576050,null));};exports[_0x0d8b('0x21')]=function(_0x11d22b,_0x1d5067){if(_0x11d22b[_0x0d8b('0x47')]['id']){delete _0x11d22b[_0x0d8b('0x47')]['id'];}return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0x11d22b[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x1d5067,null))[_0x0d8b('0x22')](saveUpdates(_0x11d22b[_0x0d8b('0x47')],null))[_0x0d8b('0x22')](respondWithResult(_0x1d5067,null))[_0x0d8b('0x43')](handleError(_0x1d5067,null));};exports[_0x0d8b('0x48')]=function(_0x574b90,_0x371fa0,_0x4d8850){return db['sequelize'][_0x0d8b('0x49')](function(_0x113fb7){if(_0x574b90[_0x0d8b('0x47')][_0x0d8b('0x4a')]==='files'){_0x574b90[_0x0d8b('0x47')][_0x0d8b('0x4b')]=path[_0x0d8b('0x4c')](config[_0x0d8b('0x4d')],_0x0d8b('0x4e'),_0x574b90['body']['name']);}return db['VoiceMusicOnHold']['create'](_0x574b90[_0x0d8b('0x47')],{'transaction':_0x113fb7})[_0x0d8b('0x22')](function(_0x5e3bb4){if(_0x574b90['body'][_0x0d8b('0x4a')]===_0x0d8b('0x4f')){fs['mkdirSync'](_0x5e3bb4['directory'],parseInt(_0x0d8b('0x50'),0x8));}var _0xeeefd4=_0x574b90[_0x0d8b('0x51')][_0x0d8b('0x23')]({'plain':!![]});if(!_0xeeefd4)throw new Error(_0x0d8b('0x52'));if(_0xeeefd4['role']===_0x0d8b('0x51')){var _0x2afe34=_0x5e3bb4['get']({'plain':!![]});return db['UserProfileSection'][_0x0d8b('0x46')]({'where':{'name':_0x0d8b('0x24'),'userProfileId':_0xeeefd4['userProfileId']},'raw':!![]})['then'](function(_0xb8be3b){if(_0xb8be3b&&_0xb8be3b[_0x0d8b('0x53')]===0x0){return db[_0x0d8b('0x25')][_0x0d8b('0x48')]({'name':_0x2afe34['name'],'resourceId':_0x2afe34['id'],'type':_0xb8be3b[_0x0d8b('0x27')],'sectionId':_0xb8be3b['id']},{})['then'](function(){return _0x5e3bb4;});}else{return _0x5e3bb4;}})['catch'](function(_0x38c24e){logger[_0x0d8b('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38c24e);});}return _0x5e3bb4;});})['then'](respondWithResult(_0x371fa0,0xc9))[_0x0d8b('0x43')](handleError(_0x371fa0,null));};exports[_0x0d8b('0x26')]=function(_0xccc2a9,_0x2c1eb0,_0x3afc3a){var _0xb66e76;return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0xccc2a9['params']['id']}})[_0x0d8b('0x22')](function(_0x37dc9f){if(_0x37dc9f){return db[_0x0d8b('0x55')][_0x0d8b('0x49')](function(_0x3fb9ea){return _0x37dc9f[_0x0d8b('0x26')]({'transaction':_0x3fb9ea,'raw':!![]})[_0x0d8b('0x22')](function(_0x1c78b6){if(_0x1c78b6[_0x0d8b('0x4b')]){fs['readdirSync'](_0x1c78b6[_0x0d8b('0x4b')])[_0x0d8b('0x56')](function(_0x180b7b){fs[_0x0d8b('0x57')](path[_0x0d8b('0x4c')](_0x1c78b6['directory'],_0x180b7b));});fs[_0x0d8b('0x58')](_0x1c78b6[_0x0d8b('0x4b')]);}return _0x1c78b6;});})[_0x0d8b('0x43')](function(_0x17a87f){throw new db[(_0x0d8b('0x59'))]['ValidationError'](_0x17a87f['message']);});}})[_0x0d8b('0x22')](handleEntityNotFound(_0x2c1eb0,null))[_0x0d8b('0x22')](removeEntity(_0x2c1eb0,null))[_0x0d8b('0x43')](handleError(_0x2c1eb0,null));};exports[_0x0d8b('0x5a')]=function(_0x5a70bd,_0x199122,_0x12aef7){return db[_0x0d8b('0x55')]['transaction'](function(_0x2f19f4){var _0x532a85;return db[_0x0d8b('0x3d')][_0x0d8b('0x46')]({'where':{'id':_0x5a70bd[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](function(_0x2b6eb6){if(_0x2b6eb6){_0x532a85=_0x2b6eb6;return _0x2b6eb6[_0x0d8b('0x5a')](_0x5a70bd['body']['id'],{'transaction':_0x2f19f4});}})[_0x0d8b('0x22')](function(_0x4c074d){if(_0x4c074d){return db[_0x0d8b('0x5b')][_0x0d8b('0x5c')]({'where':{'id':_0x5a70bd[_0x0d8b('0x47')]['id']},'attributes':['id',_0x0d8b('0x27'),'save_name',_0x0d8b('0x5d'),_0x0d8b('0x5e')],'raw':!![]});}})[_0x0d8b('0x22')](function(_0x2332fc){if(_0x2332fc){var _0x2ccdae=path[_0x0d8b('0x4c')](config[_0x0d8b('0x4d')],_0x0d8b('0x5f'),util[_0x0d8b('0x60')](_0x0d8b('0x61'),path['basename'](_0x2332fc['save_name'],path[_0x0d8b('0x62')](_0x2332fc[_0x0d8b('0x63')])),_0x2332fc['converted_format']));var _0xb1aa96=path['join'](config['root'],_0x0d8b('0x4e'),_0x532a85[_0x0d8b('0x27')],util['format']('%s.%s',_0x2332fc[_0x0d8b('0x27')],_0x2332fc[_0x0d8b('0x5d')]));fs[_0x0d8b('0x64')](_0x2ccdae,_0xb1aa96);return _0x2332fc;}})[_0x0d8b('0x43')](function(_0x2ab72b){throw new db[(_0x0d8b('0x59'))][(_0x0d8b('0x65'))](_0x2ab72b['message']);});})[_0x0d8b('0x22')](handleEntityNotFound(_0x199122,null))['then'](respondWithResult(_0x199122,0xc9))[_0x0d8b('0x43')](handleError(_0x199122,null));};exports[_0x0d8b('0x66')]=function(_0x2bb690,_0x14a34b,_0x49f610){return db[_0x0d8b('0x55')]['transaction'](function(_0x3a356b){var _0x2c6c5f;return db[_0x0d8b('0x3d')][_0x0d8b('0x5c')]({'where':{'id':_0x2bb690[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0x14a34b,null))[_0x0d8b('0x22')](function(_0x91aa89){if(_0x91aa89){_0x2c6c5f=_0x91aa89;return _0x91aa89[_0x0d8b('0x66')](_0x2bb690[_0x0d8b('0x44')]['id2']);}})[_0x0d8b('0x22')](function(_0x54c28b){if(_0x54c28b){return db[_0x0d8b('0x5b')][_0x0d8b('0x5c')]({'where':{'id':_0x2bb690['params'][_0x0d8b('0x67')]},'attributes':['id','name',_0x0d8b('0x63'),_0x0d8b('0x5d'),_0x0d8b('0x5e')],'raw':!![]});}})[_0x0d8b('0x22')](function(_0x2242cd){if(_0x2242cd){fs[_0x0d8b('0x57')](path[_0x0d8b('0x4c')](_0x2c6c5f[_0x0d8b('0x4b')],util['format'](_0x0d8b('0x61'),_0x2242cd[_0x0d8b('0x27')],_0x2242cd['converted_format'])));return _0x2242cd;}})[_0x0d8b('0x43')](function(_0x105df9){throw new db[(_0x0d8b('0x59'))][(_0x0d8b('0x65'))](_0x105df9[_0x0d8b('0x68')]);});})[_0x0d8b('0x22')](handleEntityNotFound(_0x14a34b,null))[_0x0d8b('0x22')](respondWithStatusCode(_0x14a34b,0xcc))[_0x0d8b('0x43')](handleError(_0x14a34b,null));};exports[_0x0d8b('0x69')]=function(_0x5007c0,_0xe35028,_0x16df83){var _0x50c0ff={};var _0x1ece98={};var _0x93fc55;var _0x3acffa;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x5007c0[_0x0d8b('0x44')]['id']}})[_0x0d8b('0x22')](handleEntityNotFound(_0xe35028,null))[_0x0d8b('0x22')](function(_0x5b76af){if(_0x5b76af){_0x93fc55=_0x5b76af;_0x1ece98['model']=_[_0x0d8b('0x45')](db[_0x0d8b('0x5b')][_0x0d8b('0x2a')]);_0x1ece98[_0x0d8b('0x2c')]=_[_0x0d8b('0x45')](_0x5007c0[_0x0d8b('0x2c')]);_0x1ece98[_0x0d8b('0x2d')]=_[_0x0d8b('0x2e')](_0x1ece98[_0x0d8b('0x2f')],_0x1ece98[_0x0d8b('0x2c')]);_0x50c0ff[_0x0d8b('0x30')]=_[_0x0d8b('0x2e')](_0x1ece98[_0x0d8b('0x2f')],qs['fields'](_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x31')]));_0x50c0ff['attributes']=_0x50c0ff['attributes'][_0x0d8b('0x32')]?_0x50c0ff[_0x0d8b('0x30')]:_0x1ece98[_0x0d8b('0x2f')];_0x50c0ff[_0x0d8b('0x35')]=qs[_0x0d8b('0x36')](_0x5007c0[_0x0d8b('0x2c')]['sort']);_0x50c0ff['where']=qs['filters'](_[_0x0d8b('0x37')](_0x5007c0[_0x0d8b('0x2c')],_0x1ece98[_0x0d8b('0x2d')]));if(_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x38')]){_0x50c0ff[_0x0d8b('0x39')]=_['merge'](_0x50c0ff[_0x0d8b('0x39')],{'$or':_[_0x0d8b('0x29')](_0x50c0ff['attributes'],function(_0x30a69d){var _0x57e3c2={};_0x57e3c2[_0x30a69d]={'$like':'%'+_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x38')]+'%'};return _0x57e3c2;})});}_0x50c0ff=_[_0x0d8b('0x3a')]({},_0x50c0ff,_0x5007c0[_0x0d8b('0x6a')]);return _0x93fc55[_0x0d8b('0x69')](_0x50c0ff);}})[_0x0d8b('0x22')](function(_0x424f9d){if(_0x424f9d){_0x3acffa=_0x424f9d[_0x0d8b('0x32')];if(!_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x33')](_0x0d8b('0x34'))){_0x50c0ff[_0x0d8b('0x1b')]=qs['limit'](_0x5007c0['query'][_0x0d8b('0x1b')]);_0x50c0ff[_0x0d8b('0x1a')]=qs[_0x0d8b('0x1a')](_0x5007c0[_0x0d8b('0x2c')][_0x0d8b('0x1a')]);}return _0x93fc55[_0x0d8b('0x69')](_0x50c0ff);}})[_0x0d8b('0x22')](function(_0x54674f){if(_0x54674f){return _0x54674f?{'count':_0x3acffa,'rows':_0x54674f}:null;}})[_0x0d8b('0x22')](respondWithResult(_0xe35028,null))['catch'](handleError(_0xe35028,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 7b171c8..a6493ff 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 _0x0640=['api','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger'];(function(_0x3d70c7,_0x3c7f8b){var _0x47a3cd=function(_0x478ab7){while(--_0x478ab7){_0x3d70c7['push'](_0x3d70c7['shift']());}};_0x47a3cd(++_0x3c7f8b);}(_0x0640,0xc0));var _0x0064=function(_0x51a989,_0x288387){_0x51a989=_0x51a989-0x0;var _0x1fe565=_0x0640[_0x51a989];return _0x1fe565;};'use strict';var _=require(_0x0064('0x0'));var util=require(_0x0064('0x1'));var logger=require(_0x0064('0x2'))(_0x0064('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0064('0x4'));var fs=require('fs');var path=require(_0x0064('0x5'));var rimraf=require(_0x0064('0x6'));var config=require(_0x0064('0x7'));var attributes=require(_0x0064('0x8'));module[_0x0064('0x9')]=function(_0x58a128,_0x40ff52){return _0x58a128[_0x0064('0xa')](_0x0064('0xb'),attributes,{'tableName':_0x0064('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb62b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold'];(function(_0x3d644f,_0x3b10ed){var _0x4d12f8=function(_0x240b30){while(--_0x240b30){_0x3d644f['push'](_0x3d644f['shift']());}};_0x4d12f8(++_0x3b10ed);}(_0xb62b,0x1a4));var _0xbb62=function(_0x1b9715,_0x2a8d66){_0x1b9715=_0x1b9715-0x0;var _0x496716=_0xb62b[_0x1b9715];return _0x496716;};'use strict';var _=require(_0xbb62('0x0'));var util=require(_0xbb62('0x1'));var logger=require(_0xbb62('0x2'))(_0xbb62('0x3'));var moment=require(_0xbb62('0x4'));var BPromise=require(_0xbb62('0x5'));var rp=require(_0xbb62('0x6'));var fs=require('fs');var path=require(_0xbb62('0x7'));var rimraf=require(_0xbb62('0x8'));var config=require('../../config/environment');var attributes=require(_0xbb62('0x9'));module[_0xbb62('0xa')]=function(_0x39c37f,_0x550063){return _0x39c37f[_0xbb62('0xb')](_0xbb62('0xc'),attributes,{'tableName':_0xbb62('0xd'),'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 dc7079e..1884afb 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 _0x32d2=['../../config/environment','jayson/promise','client','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xc4c1df,_0x26a47e){var _0x1f8b34=function(_0x468c05){while(--_0x468c05){_0xc4c1df['push'](_0xc4c1df['shift']());}};_0x1f8b34(++_0x26a47e);}(_0x32d2,0x99));var _0x232d=function(_0x43cc65,_0x51b16d){_0x43cc65=_0x43cc65-0x0;var _0x12cde2=_0x32d2[_0x43cc65];return _0x12cde2;};'use strict';var _=require(_0x232d('0x0'));var util=require(_0x232d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x232d('0x2'));var fs=require('fs');var Redis=require(_0x232d('0x3'));var db=require(_0x232d('0x4'))['db'];var utils=require(_0x232d('0x5'));var logger=require(_0x232d('0x6'))(_0x232d('0x7'));var config=require(_0x232d('0x8'));var jayson=require(_0x232d('0x9'));var client=jayson[_0x232d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36d401,_0x1dc0e5,_0x16154b){return new BPromise(function(_0x4e2b30,_0x5b80e5){return client[_0x232d('0xb')](_0x36d401,_0x16154b)[_0x232d('0xc')](function(_0x499c0b){logger[_0x232d('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x1dc0e5,'request\x20sent');logger['debug'](_0x232d('0xe'),_0x1dc0e5,_0x232d('0xf'),JSON[_0x232d('0x10')](_0x499c0b));if(_0x499c0b[_0x232d('0x11')]){if(_0x499c0b[_0x232d('0x11')][_0x232d('0x12')]===0x1f4){logger['error'](_0x232d('0x13'),_0x1dc0e5,_0x499c0b['error'][_0x232d('0x14')]);return _0x5b80e5(_0x499c0b['error'][_0x232d('0x14')]);}logger[_0x232d('0x11')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x1dc0e5,_0x499c0b[_0x232d('0x11')][_0x232d('0x14')]);return _0x4e2b30(_0x499c0b[_0x232d('0x11')][_0x232d('0x14')]);}else{logger[_0x232d('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x1dc0e5,_0x232d('0xf'));_0x4e2b30(_0x499c0b[_0x232d('0x15')][_0x232d('0x14')]);}})[_0x232d('0x16')](function(_0x55d37d){logger[_0x232d('0x11')](_0x232d('0x13'),_0x1dc0e5,_0x55d37d);_0x5b80e5(_0x55d37d);});});} \ No newline at end of file +var _0xe72b=['info','VoiceMusicOnHold,\x20%s,\x20%s','error','message','result','catch','util','bluebird','../../config/logger','../../config/environment','jayson/promise','client','then'];(function(_0x5c7694,_0x2056ca){var _0x128872=function(_0x25a914){while(--_0x25a914){_0x5c7694['push'](_0x5c7694['shift']());}};_0x128872(++_0x2056ca);}(_0xe72b,0x18c));var _0xbe72=function(_0x301dab,_0x38050a){_0x301dab=_0x301dab-0x0;var _0x2500a2=_0xe72b[_0x301dab];return _0x2500a2;};'use strict';var _=require('lodash');var util=require(_0xbe72('0x0'));var moment=require('moment');var BPromise=require(_0xbe72('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbe72('0x2'))('rpc');var config=require(_0xbe72('0x3'));var jayson=require(_0xbe72('0x4'));var client=jayson[_0xbe72('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c9b5c,_0x2e6df9,_0x41b2e7){return new BPromise(function(_0x43ced7,_0x42b849){return client['request'](_0x4c9b5c,_0x41b2e7)[_0xbe72('0x6')](function(_0x37ec4f){logger[_0xbe72('0x7')](_0xbe72('0x8'),_0x2e6df9,'request\x20sent');logger['debug']('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2e6df9,'request\x20sent',JSON['stringify'](_0x37ec4f));if(_0x37ec4f[_0xbe72('0x9')]){if(_0x37ec4f[_0xbe72('0x9')]['code']===0x1f4){logger[_0xbe72('0x9')](_0xbe72('0x8'),_0x2e6df9,_0x37ec4f[_0xbe72('0x9')][_0xbe72('0xa')]);return _0x42b849(_0x37ec4f[_0xbe72('0x9')][_0xbe72('0xa')]);}logger[_0xbe72('0x9')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2e6df9,_0x37ec4f[_0xbe72('0x9')]['message']);return _0x43ced7(_0x37ec4f['error'][_0xbe72('0xa')]);}else{logger[_0xbe72('0x7')](_0xbe72('0x8'),_0x2e6df9,'request\x20sent');_0x43ced7(_0x37ec4f[_0xbe72('0xb')][_0xbe72('0xa')]);}})[_0xbe72('0xc')](function(_0x35a31a){logger[_0xbe72('0x9')](_0xbe72('0x8'),_0x2e6df9,_0x35a31a);_0x42b849(_0x35a31a);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 9dea5f2..eedaa2b 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 _0xf9a9=['../../components/interaction/service','./voicePrefix.controller','isAuthenticated','index','get','/describe','show','/:id/users','getAgents','post','create','addAgents','put','/:id','update','delete','destroy','removeAgents','exports','util','path','express','../../components/auth/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf9a9,0x9d));var _0x9f9a=function(_0x512500,_0x62370b){_0x512500=_0x512500-0x0;var _0x371604=_0xf9a9[_0x512500];return _0x371604;};'use strict';var multer=require('multer');var util=require(_0x9f9a('0x0'));var path=require(_0x9f9a('0x1'));var timeout=require('connect-timeout');var express=require(_0x9f9a('0x2'));var router=express['Router']();var auth=require(_0x9f9a('0x3'));var interaction=require(_0x9f9a('0x4'));var config=require('../../config/environment');var controller=require(_0x9f9a('0x5'));router['get']('/',auth[_0x9f9a('0x6')](),controller[_0x9f9a('0x7')]);router[_0x9f9a('0x8')](_0x9f9a('0x9'),auth[_0x9f9a('0x6')](),controller['describe']);router[_0x9f9a('0x8')]('/:id',auth[_0x9f9a('0x6')](),controller[_0x9f9a('0xa')]);router[_0x9f9a('0x8')](_0x9f9a('0xb'),auth[_0x9f9a('0x6')](),controller[_0x9f9a('0xc')]);router[_0x9f9a('0xd')]('/',auth['isAuthenticated'](),controller[_0x9f9a('0xe')]);router['post'](_0x9f9a('0xb'),auth[_0x9f9a('0x6')](),controller[_0x9f9a('0xf')]);router[_0x9f9a('0x10')](_0x9f9a('0x11'),auth[_0x9f9a('0x6')](),controller[_0x9f9a('0x12')]);router[_0x9f9a('0x13')](_0x9f9a('0x11'),auth[_0x9f9a('0x6')](),controller[_0x9f9a('0x14')]);router[_0x9f9a('0x13')](_0x9f9a('0xb'),auth[_0x9f9a('0x6')](),controller[_0x9f9a('0x15')]);module[_0x9f9a('0x16')]=router; \ No newline at end of file +var _0xfdeb=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','isAuthenticated','get','describe','/:id','getAgents','post','create','/:id/users','addAgents','put','delete','destroy','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xfdeb,0x1b9));var _0xbfde=function(_0x4599b6,_0x40c254){_0x4599b6=_0x4599b6-0x0;var _0x2e014c=_0xfdeb[_0x4599b6];return _0x2e014c;};'use strict';var multer=require(_0xbfde('0x0'));var util=require(_0xbfde('0x1'));var path=require(_0xbfde('0x2'));var timeout=require(_0xbfde('0x3'));var express=require(_0xbfde('0x4'));var router=express['Router']();var auth=require(_0xbfde('0x5'));var interaction=require(_0xbfde('0x6'));var config=require('../../config/environment');var controller=require(_0xbfde('0x7'));router['get']('/',auth[_0xbfde('0x8')](),controller['index']);router[_0xbfde('0x9')]('/describe',auth[_0xbfde('0x8')](),controller[_0xbfde('0xa')]);router[_0xbfde('0x9')](_0xbfde('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xbfde('0x9')]('/:id/users',auth[_0xbfde('0x8')](),controller[_0xbfde('0xc')]);router[_0xbfde('0xd')]('/',auth['isAuthenticated'](),controller[_0xbfde('0xe')]);router['post'](_0xbfde('0xf'),auth[_0xbfde('0x8')](),controller[_0xbfde('0x10')]);router[_0xbfde('0x11')](_0xbfde('0xb'),auth[_0xbfde('0x8')](),controller['update']);router[_0xbfde('0x12')](_0xbfde('0xb'),auth[_0xbfde('0x8')](),controller[_0xbfde('0x13')]);router[_0xbfde('0x12')](_0xbfde('0xf'),auth[_0xbfde('0x8')](),controller['removeAgents']);module[_0xbfde('0x14')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 9937f4f..8f39724 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 _0xb7aa=['name','INTEGER','sequelize','exports','STRING','VIRTUAL','getDataValue'];(function(_0x2af24b,_0x18a890){var _0x32aa1b=function(_0x359998){while(--_0x359998){_0x2af24b['push'](_0x2af24b['shift']());}};_0x32aa1b(++_0x18a890);}(_0xb7aa,0x160));var _0xab7a=function(_0xa01b10,_0x437549){_0xa01b10=_0xa01b10-0x0;var _0x341500=_0xb7aa[_0xa01b10];return _0x341500;};'use strict';var Sequelize=require(_0xab7a('0x0'));module[_0xab7a('0x1')]={'name':{'type':Sequelize[_0xab7a('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xab7a('0x3')],'get':function(_0x36a6de){return'system-'+this[_0xab7a('0x4')](_0xab7a('0x5'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xab7a('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xab7a('0x6')]}}; \ No newline at end of file +var _0xcaa4=['INTEGER','sequelize','exports','STRING','name','getDataValue'];(function(_0x176f98,_0x40cea3){var _0x3027b5=function(_0x3ca852){while(--_0x3ca852){_0x176f98['push'](_0x176f98['shift']());}};_0x3027b5(++_0x40cea3);}(_0xcaa4,0x1b7));var _0x4caa=function(_0x2bac1c,_0x4d2517){_0x2bac1c=_0x2bac1c-0x0;var _0x247059=_0xcaa4[_0x2bac1c];return _0x247059;};'use strict';var Sequelize=require(_0x4caa('0x0'));module[_0x4caa('0x1')]={'name':{'type':Sequelize[_0x4caa('0x2')],'allowNull':![],'unique':_0x4caa('0x3')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0xf632bc){return'system-'+this[_0x4caa('0x4')](_0x4caa('0x3'))+'-';}},'description':{'type':Sequelize[_0x4caa('0x2')]},'callerIdAll':{'type':Sequelize[_0x4caa('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x4caa('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 28a95ee..9ae931f 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 _0xcf70=['charAt','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','User','nolimit','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','VoicePrefixes','UserProfileResource','end','error','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','key','model','query','keys','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','includeAll','include','rows','catch','show','params','intersection','length','options','find','describe','create','sequelize','transaction','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','context','from-sip','exten','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','VoiceExtension','VoiceExtensionId','bulkCreate','Extensions\x20creation\x20failed','CDR(prefix)=','callerIdAll','Set','push','${EXTEN:'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0xcf70,0x8d));var _0x0cf7=function(_0x3c0b75,_0x3b5cb3){_0x3c0b75=_0x3c0b75-0x0;var _0x101b35=_0xcf70[_0x3c0b75];return _0x101b35;};'use strict';var pdf=require(_0x0cf7('0x0'));var emlformat=require(_0x0cf7('0x1'));var rimraf=require(_0x0cf7('0x2'));var zipdir=require(_0x0cf7('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0cf7('0x4'));var moment=require(_0x0cf7('0x5'));var BPromise=require(_0x0cf7('0x6'));var Mustache=require(_0x0cf7('0x7'));var util=require('util');var path=require(_0x0cf7('0x8'));var sox=require(_0x0cf7('0x9'));var csv=require(_0x0cf7('0xa'));var ejs=require(_0x0cf7('0xb'));var fs=require('fs');var _=require(_0x0cf7('0xc'));var squel=require(_0x0cf7('0xd'));var crypto=require('crypto');var jsforce=require(_0x0cf7('0xe'));var deskjs=require(_0x0cf7('0xf'));var toCsv=require(_0x0cf7('0xa'));var querystring=require(_0x0cf7('0x10'));var Papa=require(_0x0cf7('0x11'));var Redis=require(_0x0cf7('0x12'));var authService=require(_0x0cf7('0x13'));var qs=require(_0x0cf7('0x14'));var as=require(_0x0cf7('0x15'));var hardwareService=require(_0x0cf7('0x16'));var logger=require(_0x0cf7('0x17'))(_0x0cf7('0x18'));var utils=require(_0x0cf7('0x19'));var config=require('../../config/environment');var db=require(_0x0cf7('0x1a'))['db'];config[_0x0cf7('0x1b')]=_[_0x0cf7('0x1c')](config[_0x0cf7('0x1b')],{'host':_0x0cf7('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0cf7('0x1b')]));require('./voicePrefix.socket')[_0x0cf7('0x1e')](socket);function respondWithStatusCode(_0x4771fa,_0x270da6){_0x270da6=_0x270da6||0xcc;return function(_0x2e04dd){if(_0x2e04dd){return _0x4771fa[_0x0cf7('0x1f')](_0x270da6);}return _0x4771fa[_0x0cf7('0x20')](_0x270da6)['end']();};}function respondWithResult(_0x3477b9,_0x5b6b2f){_0x5b6b2f=_0x5b6b2f||0xc8;return function(_0xc2e7d2){if(_0xc2e7d2){return _0x3477b9[_0x0cf7('0x20')](_0x5b6b2f)['json'](_0xc2e7d2);}};}function respondWithFilteredResult(_0x28e42d,_0x1a14a4){return function(_0x24dc68){if(_0x24dc68){var _0x4743b1=_0x24dc68[_0x0cf7('0x21')],_0x3a26b0=_0x1a14a4[_0x0cf7('0x22')],_0x4f96b2=_0x1a14a4[_0x0cf7('0x22')]+_0x1a14a4[_0x0cf7('0x23')],_0x2cb39a;if(_0x4f96b2>=_0x4743b1){_0x4f96b2=_0x4743b1;_0x2cb39a=0xc8;}else{_0x2cb39a=0xce;}_0x28e42d['status'](_0x2cb39a);return _0x28e42d[_0x0cf7('0x24')](_0x0cf7('0x25'),_0x3a26b0+'-'+_0x4f96b2+'/'+_0x4743b1)[_0x0cf7('0x26')](_0x24dc68);}return null;};}function patchUpdates(_0x417961){return function(_0x3cda69){try{jsonpatch['apply'](_0x3cda69,_0x417961,!![]);}catch(_0x11e517){return BPromise[_0x0cf7('0x27')](_0x11e517);}return _0x3cda69[_0x0cf7('0x28')]();};}function saveUpdates(_0x1632bd,_0x41cdff){return function(_0x337b6b){if(_0x337b6b){return _0x337b6b[_0x0cf7('0x29')](_0x1632bd)[_0x0cf7('0x2a')](function(_0x42b1af){return _0x42b1af;});}return null;};}function removeEntity(_0x538849,_0x54a94c){return function(_0x4864a5){if(_0x4864a5){return _0x4864a5[_0x0cf7('0x2b')]()[_0x0cf7('0x2a')](function(){var _0x3ab507=_0x4864a5['get']({'plain':!![]});var _0xa1d94b=_0x0cf7('0x2c');return db[_0x0cf7('0x2d')]['destroy']({'where':{'type':_0xa1d94b,'resourceId':_0x3ab507['id']}})[_0x0cf7('0x2a')](function(){return _0x4864a5;});})[_0x0cf7('0x2a')](function(){_0x538849[_0x0cf7('0x20')](0xcc)[_0x0cf7('0x2e')]();});}};}function handleEntityNotFound(_0x58804d,_0x4fedd6){return function(_0x2bbb8e){if(!_0x2bbb8e){_0x58804d['sendStatus'](0x194);}return _0x2bbb8e;};}function handleError(_0x2e4023,_0x1b6367){_0x1b6367=_0x1b6367||0x1f4;return function(_0xd89a5b){logger[_0x0cf7('0x2f')](_0xd89a5b[_0x0cf7('0x30')]);if(_0xd89a5b[_0x0cf7('0x31')]){delete _0xd89a5b['name'];}_0x2e4023[_0x0cf7('0x20')](_0x1b6367)[_0x0cf7('0x32')](_0xd89a5b);};}exports['index']=function(_0x4a56c8,_0x5a1160){var _0x5dc2d2={},_0x1efaa4={},_0x518c54={'count':0x0,'rows':[]};var _0x3539ac=_[_0x0cf7('0x33')](db[_0x0cf7('0x34')][_0x0cf7('0x35')],function(_0x4b6a68){return{'name':_0x4b6a68[_0x0cf7('0x36')],'type':_0x4b6a68['type'][_0x0cf7('0x37')]};});_0x1efaa4[_0x0cf7('0x38')]=_[_0x0cf7('0x33')](_0x3539ac,_0x0cf7('0x31'));_0x1efaa4[_0x0cf7('0x39')]=_[_0x0cf7('0x3a')](_0x4a56c8[_0x0cf7('0x39')]);_0x1efaa4['filters']=_['intersection'](_0x1efaa4[_0x0cf7('0x38')],_0x1efaa4[_0x0cf7('0x39')]);_0x5dc2d2[_0x0cf7('0x3b')]=_['intersection'](_0x1efaa4['model'],qs['fields'](_0x4a56c8[_0x0cf7('0x39')][_0x0cf7('0x3c')]));_0x5dc2d2[_0x0cf7('0x3b')]=_0x5dc2d2[_0x0cf7('0x3b')]['length']?_0x5dc2d2['attributes']:_0x1efaa4[_0x0cf7('0x38')];if(!_0x4a56c8['query'][_0x0cf7('0x3d')]('nolimit')){_0x5dc2d2[_0x0cf7('0x23')]=qs[_0x0cf7('0x23')](_0x4a56c8['query'][_0x0cf7('0x23')]);_0x5dc2d2[_0x0cf7('0x22')]=qs[_0x0cf7('0x22')](_0x4a56c8[_0x0cf7('0x39')][_0x0cf7('0x22')]);}_0x5dc2d2[_0x0cf7('0x3e')]=qs[_0x0cf7('0x3f')](_0x4a56c8[_0x0cf7('0x39')][_0x0cf7('0x3f')]);_0x5dc2d2[_0x0cf7('0x40')]=qs[_0x0cf7('0x41')](_[_0x0cf7('0x42')](_0x4a56c8['query'],_0x1efaa4[_0x0cf7('0x41')]),_0x3539ac);if(_0x4a56c8[_0x0cf7('0x39')]['filter']){_0x5dc2d2['where']=_[_0x0cf7('0x43')](_0x5dc2d2[_0x0cf7('0x40')],{'$or':_[_0x0cf7('0x33')](_0x3539ac,function(_0x2eb838){if(_0x2eb838[_0x0cf7('0x44')]!==_0x0cf7('0x45')){var _0x3f6fe6={};_0x3f6fe6[_0x2eb838['name']]={'$like':'%'+_0x4a56c8[_0x0cf7('0x39')][_0x0cf7('0x46')]+'%'};return _0x3f6fe6;}})});}_0x5dc2d2=_[_0x0cf7('0x43')]({},_0x5dc2d2,_0x4a56c8['options']);var _0x2c4364={'where':_0x5dc2d2['where']};return db[_0x0cf7('0x34')][_0x0cf7('0x21')](_0x2c4364)[_0x0cf7('0x2a')](function(_0x65b06){_0x518c54[_0x0cf7('0x21')]=_0x65b06;if(_0x4a56c8[_0x0cf7('0x39')][_0x0cf7('0x47')]){_0x5dc2d2[_0x0cf7('0x48')]=[{'all':!![]}];}return db[_0x0cf7('0x34')]['findAll'](_0x5dc2d2);})['then'](function(_0x4a6814){_0x518c54[_0x0cf7('0x49')]=_0x4a6814;return _0x518c54;})[_0x0cf7('0x2a')](respondWithFilteredResult(_0x5a1160,_0x5dc2d2))[_0x0cf7('0x4a')](handleError(_0x5a1160,null));};exports[_0x0cf7('0x4b')]=function(_0x37f064,_0x1d235f){var _0x5b6c53={'raw':![],'where':{'id':_0x37f064[_0x0cf7('0x4c')]['id']}},_0x9058ff={};_0x9058ff[_0x0cf7('0x38')]=_['keys'](db[_0x0cf7('0x34')]['rawAttributes']);_0x9058ff['query']=_[_0x0cf7('0x3a')](_0x37f064[_0x0cf7('0x39')]);_0x9058ff[_0x0cf7('0x41')]=_['intersection'](_0x9058ff['model'],_0x9058ff[_0x0cf7('0x39')]);_0x5b6c53[_0x0cf7('0x3b')]=_[_0x0cf7('0x4d')](_0x9058ff[_0x0cf7('0x38')],qs['fields'](_0x37f064[_0x0cf7('0x39')][_0x0cf7('0x3c')]));_0x5b6c53[_0x0cf7('0x3b')]=_0x5b6c53[_0x0cf7('0x3b')][_0x0cf7('0x4e')]?_0x5b6c53[_0x0cf7('0x3b')]:_0x9058ff['model'];if(_0x37f064[_0x0cf7('0x39')]['includeAll']){_0x5b6c53[_0x0cf7('0x48')]=[{'all':!![]}];}_0x5b6c53=_[_0x0cf7('0x43')]({},_0x5b6c53,_0x37f064[_0x0cf7('0x4f')]);return db[_0x0cf7('0x34')][_0x0cf7('0x50')](_0x5b6c53)[_0x0cf7('0x2a')](handleEntityNotFound(_0x1d235f,null))[_0x0cf7('0x2a')](respondWithResult(_0x1d235f,null))[_0x0cf7('0x4a')](handleError(_0x1d235f,null));};exports[_0x0cf7('0x2b')]=function(_0x27ae7b,_0x167cde){return db[_0x0cf7('0x34')]['find']({'where':{'id':_0x27ae7b['params']['id']}})[_0x0cf7('0x2a')](handleEntityNotFound(_0x167cde,null))[_0x0cf7('0x2a')](removeEntity(_0x167cde,null))[_0x0cf7('0x4a')](handleError(_0x167cde,null));};exports[_0x0cf7('0x51')]=function(_0x4078ef,_0x525e7a){return db[_0x0cf7('0x34')]['describe']()[_0x0cf7('0x2a')](respondWithResult(_0x525e7a,null))[_0x0cf7('0x4a')](handleError(_0x525e7a,null));};exports[_0x0cf7('0x52')]=function(_0xb87a8c,_0x6cb8af){var _0x14e6ad;return db[_0x0cf7('0x53')][_0x0cf7('0x54')](function(_0x4623fc){return db[_0x0cf7('0x34')][_0x0cf7('0x52')](_0xb87a8c[_0x0cf7('0x55')],{'transaction':_0x4623fc})[_0x0cf7('0x2a')](function(_0x184fa3){_0x14e6ad=_0x184fa3[_0x0cf7('0x56')]({'plain':!![]});return db['VoiceExtension'][_0x0cf7('0x50')]({'where':{'id':_0x14e6ad['VoiceExtensionId']},'raw':!![]})[_0x0cf7('0x2a')](function(_0x342960){return createVoicePrefixExtensions(_0x14e6ad,_0x342960,_0x4623fc);});});})['then'](function(){var _0x17e741=_0xb87a8c['user'][_0x0cf7('0x56')]({'plain':!![]});if(!_0x17e741)throw new Error(_0x0cf7('0x57'));if(_0x17e741[_0x0cf7('0x58')]===_0x0cf7('0x59')){var _0x54fa4a=_0x14e6ad;return db[_0x0cf7('0x5a')][_0x0cf7('0x50')]({'where':{'name':_0x0cf7('0x2c'),'userProfileId':_0x17e741[_0x0cf7('0x5b')]},'raw':!![]})[_0x0cf7('0x2a')](function(_0x570155){if(_0x570155&&_0x570155[_0x0cf7('0x5c')]===0x0){return db[_0x0cf7('0x2d')][_0x0cf7('0x52')]({'name':_0x54fa4a[_0x0cf7('0x31')],'resourceId':_0x54fa4a['id'],'type':_0x570155['name'],'sectionId':_0x570155['id']},{})[_0x0cf7('0x2a')](function(){return _0x14e6ad;});}else{return _0x14e6ad;}})[_0x0cf7('0x4a')](function(_0x91aab7){logger[_0x0cf7('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x91aab7);throw _0x91aab7;});}return _0x14e6ad;})[_0x0cf7('0x2a')](respondWithResult(_0x6cb8af,null))[_0x0cf7('0x4a')](handleError(_0x6cb8af,null));};function Extension(_0x4739ea,_0x428df5,_0x28c200,_0x24daa6){this[_0x0cf7('0x5d')]=_0x0cf7('0x5e');this[_0x0cf7('0x5f')]=_0x4739ea;this['app']=_0x28c200;this[_0x0cf7('0x44')]=_0x0cf7('0x60');this[_0x0cf7('0x61')]=_0x0cf7('0x62');this[_0x0cf7('0x63')]=_0x428df5;this[_0x0cf7('0x64')]=_0x24daa6;}function createVoicePrefixExtensions(_0x4b844c,_0x4ef90d,_0x4a9650){return new BPromise(function(_0x202d8a,_0x412ff4){var _0xab6686=new Extension(formatPrefixName(_0x4b844c[_0x0cf7('0x65')]),0x1,_0x0cf7('0x66'),'Voice\x20Prefix');_0xab6686[_0x0cf7('0x67')]=_0x4b844c['id'];return db[_0x0cf7('0x68')][_0x0cf7('0x52')](_0xab6686,{'transaction':_0x4a9650})['then'](function(_0x2ad9f7){var _0x1fb8d7=_0x2ad9f7[_0x0cf7('0x56')]({'plain':!![]});var _0x2ed9c3=_['map'](addVoicePrefixExtensions(_0x4b844c,_0x4ef90d),function(_0x23db8e){_0x23db8e[_0x0cf7('0x69')]=_0x1fb8d7['id'];_0x23db8e[_0x0cf7('0x67')]=_0x4b844c['id'];return _0x23db8e;});return db[_0x0cf7('0x68')][_0x0cf7('0x6a')](_0x2ed9c3,{'transaction':_0x4a9650})[_0x0cf7('0x2a')](function(_0x4bfddb){if(!_0x4bfddb){return _0x412ff4(_0x0cf7('0x6b'));}else{return _0x202d8a(_0x4bfddb);}})[_0x0cf7('0x4a')](function(_0x5db35b){return _0x412ff4(_0x5db35b);});});;});};function addVoicePrefixExtensions(_0x28e4aa,_0x390172){var _0x2c228f=[];var _0x1ce76f=formatPrefixName(_0x28e4aa[_0x0cf7('0x65')]);_0x2c228f['push'](new Extension(_0x1ce76f,0x2,'Set',_0x0cf7('0x6c')+_0x28e4aa[_0x0cf7('0x31')]));if(_0x28e4aa[_0x0cf7('0x6d')]){_0x2c228f['push'](new Extension(_0x1ce76f,0x3,_0x0cf7('0x6e'),'PREFIX-CALLERIDALL='+_0x28e4aa[_0x0cf7('0x6d')]));}else{_0x2c228f[_0x0cf7('0x6f')](new Extension(_0x1ce76f,0x3,'NoOp','No\x20callerid\x20available'));}_0x2c228f[_0x0cf7('0x6f')](new Extension(_0x1ce76f,0x4,'goto',_0x390172[_0x0cf7('0x5d')]+','+_0x0cf7('0x70')+(0x8+_0x28e4aa[_0x0cf7('0x31')][_0x0cf7('0x4e')])+'}'+','+0x1));return _0x2c228f;}function formatPrefixName(_0x3cb36f){var _0x5414d2='_';for(var _0x32ec91=0x0;_0x32ec91<_0x3cb36f[_0x0cf7('0x4e')];_0x32ec91++){if(_0x3cb36f[_0x0cf7('0x71')](_0x32ec91)=='-'){_0x5414d2+=_0x3cb36f[_0x0cf7('0x71')](_0x32ec91);}else{_0x5414d2+='['+_0x3cb36f[_0x0cf7('0x71')](_0x32ec91)+']';}}_0x5414d2+='.';return _0x5414d2;}exports[_0x0cf7('0x29')]=function(_0x449a0d,_0x33dd1a,_0x871ed4){var _0x48f1a2=_0x449a0d[_0x0cf7('0x55')];_0x48f1a2[_0x0cf7('0x65')]='system-'+_0x48f1a2[_0x0cf7('0x31')]+'-';return db[_0x0cf7('0x53')]['transaction'](function(_0xca57ee){return db[_0x0cf7('0x34')][_0x0cf7('0x29')](_0x48f1a2,{'where':{'id':_0x48f1a2['id']},'transaction':_0xca57ee})[_0x0cf7('0x2a')](function(){return db[_0x0cf7('0x68')][_0x0cf7('0x2b')]({'where':{'VoicePrefixId':_0x48f1a2['id']},'transaction':_0xca57ee})[_0x0cf7('0x2a')](function(){return db[_0x0cf7('0x68')][_0x0cf7('0x50')]({'where':{'id':_0x48f1a2[_0x0cf7('0x69')]},'raw':!![]})[_0x0cf7('0x2a')](function(_0x30f945){return createVoicePrefixExtensions(_0x48f1a2,_0x30f945,_0xca57ee);});});});})[_0x0cf7('0x2a')](function(){return db[_0x0cf7('0x34')][_0x0cf7('0x72')](_0x48f1a2['id']);})['then'](respondWithResult(_0x33dd1a,null))[_0x0cf7('0x4a')](handleError(_0x33dd1a,null));};exports['addAgents']=function(_0x5dec4d,_0x23d818,_0x213f44){return db['VoicePrefix'][_0x0cf7('0x50')]({'where':{'id':_0x5dec4d[_0x0cf7('0x4c')]['id']}})[_0x0cf7('0x2a')](handleEntityNotFound(_0x23d818,null))[_0x0cf7('0x2a')](function(_0x2a7f79){if(_0x2a7f79){return _0x2a7f79[_0x0cf7('0x73')](_0x5dec4d[_0x0cf7('0x55')]['ids'],_[_0x0cf7('0x74')](_0x5dec4d['body'],[_0x0cf7('0x75'),'id'])||{})[_0x0cf7('0x76')](function(_0x1b1e0f){for(var _0x10d261=0x0;_0x10d261<_0x5dec4d[_0x0cf7('0x55')][_0x0cf7('0x75')]['length'];_0x10d261+=0x1){socket[_0x0cf7('0x77')](_0x0cf7('0x78'),{'UserId':_0x5dec4d['body']['ids'][_0x10d261],'VoicePrefixId':_0x5dec4d[_0x0cf7('0x4c')]['id']});}return _0x1b1e0f;});}})[_0x0cf7('0x2a')](respondWithResult(_0x23d818,null))[_0x0cf7('0x4a')](handleError(_0x23d818,null));};exports['removeAgents']=function(_0x5e5937,_0x32193e,_0x27dee9){return db[_0x0cf7('0x34')][_0x0cf7('0x50')]({'where':{'id':_0x5e5937['params']['id']}})[_0x0cf7('0x2a')](handleEntityNotFound(_0x32193e,null))[_0x0cf7('0x2a')](function(_0xf67770){if(_0xf67770){return _0xf67770[_0x0cf7('0x79')](_0x5e5937[_0x0cf7('0x39')][_0x0cf7('0x75')])[_0x0cf7('0x2a')](function(){if(_[_0x0cf7('0x7a')](_0x5e5937[_0x0cf7('0x39')][_0x0cf7('0x75')])){for(var _0x321930=0x0;_0x321930<_0x5e5937[_0x0cf7('0x39')][_0x0cf7('0x75')][_0x0cf7('0x4e')];_0x321930+=0x1){socket[_0x0cf7('0x77')](_0x0cf7('0x7b'),{'UserId':Number(_0x5e5937[_0x0cf7('0x39')][_0x0cf7('0x75')][_0x321930]),'VoicePrefixId':Number(_0x5e5937['params']['id'])});}}else{socket['emit'](_0x0cf7('0x7b'),{'UserId':Number(_0x5e5937['query']['ids']),'VoicePrefixId':Number(_0x5e5937[_0x0cf7('0x4c')]['id'])});}});}})[_0x0cf7('0x2a')](respondWithStatusCode(_0x32193e,null))[_0x0cf7('0x4a')](handleError(_0x32193e,null));};exports[_0x0cf7('0x7c')]=function(_0x4fcc23,_0x5c1f1a,_0x4e09bf){var _0x2893d7={};var _0x1d5686={};var _0x5f3f7c;var _0x58f74d;return db[_0x0cf7('0x34')]['findOne']({'where':{'id':_0x4fcc23[_0x0cf7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5c1f1a,null))[_0x0cf7('0x2a')](function(_0x18a242){if(_0x18a242){_0x5f3f7c=_0x18a242;_0x1d5686['model']=_['keys'](db[_0x0cf7('0x7d')][_0x0cf7('0x35')]);_0x1d5686[_0x0cf7('0x39')]=_[_0x0cf7('0x3a')](_0x4fcc23[_0x0cf7('0x39')]);_0x1d5686[_0x0cf7('0x41')]=_['intersection'](_0x1d5686['model'],_0x1d5686[_0x0cf7('0x39')]);_0x2893d7[_0x0cf7('0x3b')]=_[_0x0cf7('0x4d')](_0x1d5686[_0x0cf7('0x38')],qs[_0x0cf7('0x3c')](_0x4fcc23[_0x0cf7('0x39')][_0x0cf7('0x3c')]));_0x2893d7[_0x0cf7('0x3b')]=_0x2893d7['attributes'][_0x0cf7('0x4e')]?_0x2893d7[_0x0cf7('0x3b')]:_0x1d5686[_0x0cf7('0x38')];_0x2893d7['order']=qs[_0x0cf7('0x3f')](_0x4fcc23[_0x0cf7('0x39')][_0x0cf7('0x3f')]);_0x2893d7[_0x0cf7('0x40')]=qs[_0x0cf7('0x41')](_[_0x0cf7('0x42')](_0x4fcc23[_0x0cf7('0x39')],_0x1d5686[_0x0cf7('0x41')]));if(_0x4fcc23[_0x0cf7('0x39')][_0x0cf7('0x46')]){_0x2893d7['where']=_[_0x0cf7('0x43')](_0x2893d7[_0x0cf7('0x40')],{'$or':_[_0x0cf7('0x33')](_0x2893d7[_0x0cf7('0x3b')],function(_0x3848e0){var _0x3fdcde={};_0x3fdcde[_0x3848e0]={'$like':'%'+_0x4fcc23[_0x0cf7('0x39')][_0x0cf7('0x46')]+'%'};return _0x3fdcde;})});}_0x2893d7=_['merge']({},_0x2893d7,_0x4fcc23[_0x0cf7('0x4f')]);return _0x5f3f7c[_0x0cf7('0x7c')](_0x2893d7);}})[_0x0cf7('0x2a')](function(_0x29a9d2){if(_0x29a9d2){_0x58f74d=_0x29a9d2[_0x0cf7('0x4e')];if(!_0x4fcc23['query']['hasOwnProperty'](_0x0cf7('0x7e'))){_0x2893d7['limit']=qs[_0x0cf7('0x23')](_0x4fcc23[_0x0cf7('0x39')][_0x0cf7('0x23')]);_0x2893d7['offset']=qs[_0x0cf7('0x22')](_0x4fcc23[_0x0cf7('0x39')][_0x0cf7('0x22')]);}return _0x5f3f7c[_0x0cf7('0x7c')](_0x2893d7);}})[_0x0cf7('0x2a')](function(_0x323c50){if(_0x323c50){return _0x323c50?{'count':_0x58f74d,'rows':_0x323c50}:null;}})['then'](respondWithResult(_0x5c1f1a,null))[_0x0cf7('0x4a')](handleError(_0x5c1f1a,null));}; \ No newline at end of file +var _0xf189=['key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','filter','map','VIRTUAL','options','VoicePrefix','count','include','findAll','catch','show','params','rawAttributes','length','merge','find','describe','create','sequelize','transaction','body','get','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','goto','charAt','system-','findById','addAgents','omit','ids','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','User','pick','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','./voicePrefix.socket','register','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','VoicePrefixes','error','name','send','index','type'];(function(_0x8b826b,_0x4401d3){var _0x30505d=function(_0x25ca93){while(--_0x25ca93){_0x8b826b['push'](_0x8b826b['shift']());}};_0x30505d(++_0x4401d3);}(_0xf189,0xc0));var _0x9f18=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf189[_0x19e35c];return _0x3e1fe8;};'use strict';var pdf=require(_0x9f18('0x0'));var emlformat=require(_0x9f18('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9f18('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9f18('0x3'));var moment=require(_0x9f18('0x4'));var BPromise=require(_0x9f18('0x5'));var Mustache=require(_0x9f18('0x6'));var util=require(_0x9f18('0x7'));var path=require(_0x9f18('0x8'));var sox=require(_0x9f18('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9f18('0xa'));var squel=require(_0x9f18('0xb'));var crypto=require(_0x9f18('0xc'));var jsforce=require(_0x9f18('0xd'));var deskjs=require(_0x9f18('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9f18('0xf'));var Papa=require(_0x9f18('0x10'));var Redis=require(_0x9f18('0x11'));var authService=require(_0x9f18('0x12'));var qs=require(_0x9f18('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f18('0x14'))(_0x9f18('0x15'));var utils=require(_0x9f18('0x16'));var config=require(_0x9f18('0x17'));var db=require('../../mysqldb')['db'];config[_0x9f18('0x18')]=_['defaults'](config['redis'],{'host':_0x9f18('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9f18('0x1a'))[_0x9f18('0x1b')](socket);function respondWithStatusCode(_0x1230c6,_0x51069d){_0x51069d=_0x51069d||0xcc;return function(_0x198e3a){if(_0x198e3a){return _0x1230c6[_0x9f18('0x1c')](_0x51069d);}return _0x1230c6['status'](_0x51069d)[_0x9f18('0x1d')]();};}function respondWithResult(_0x22febf,_0x48dbcf){_0x48dbcf=_0x48dbcf||0xc8;return function(_0x6b1a98){if(_0x6b1a98){return _0x22febf['status'](_0x48dbcf)[_0x9f18('0x1e')](_0x6b1a98);}};}function respondWithFilteredResult(_0x4d6ee0,_0x46aade){return function(_0x5ca202){if(_0x5ca202){var _0x30aebf=_0x5ca202['count'],_0x4ab7d7=_0x46aade[_0x9f18('0x1f')],_0x597b3e=_0x46aade[_0x9f18('0x1f')]+_0x46aade[_0x9f18('0x20')],_0x2d4bbf;if(_0x597b3e>=_0x30aebf){_0x597b3e=_0x30aebf;_0x2d4bbf=0xc8;}else{_0x2d4bbf=0xce;}_0x4d6ee0[_0x9f18('0x21')](_0x2d4bbf);return _0x4d6ee0[_0x9f18('0x22')](_0x9f18('0x23'),_0x4ab7d7+'-'+_0x597b3e+'/'+_0x30aebf)[_0x9f18('0x1e')](_0x5ca202);}return null;};}function patchUpdates(_0x5088f7){return function(_0x5e737a){try{jsonpatch[_0x9f18('0x24')](_0x5e737a,_0x5088f7,!![]);}catch(_0x2acfbf){return BPromise[_0x9f18('0x25')](_0x2acfbf);}return _0x5e737a[_0x9f18('0x26')]();};}function saveUpdates(_0x4b4723,_0x2ce7bb){return function(_0x42310b){if(_0x42310b){return _0x42310b[_0x9f18('0x27')](_0x4b4723)[_0x9f18('0x28')](function(_0x9c2d5a){return _0x9c2d5a;});}return null;};}function removeEntity(_0x3f94d4,_0x52774b){return function(_0x5c15ae){if(_0x5c15ae){return _0x5c15ae[_0x9f18('0x29')]()[_0x9f18('0x28')](function(){var _0x2668a3=_0x5c15ae['get']({'plain':!![]});var _0x422142=_0x9f18('0x2a');return db['UserProfileResource'][_0x9f18('0x29')]({'where':{'type':_0x422142,'resourceId':_0x2668a3['id']}})['then'](function(){return _0x5c15ae;});})['then'](function(){_0x3f94d4[_0x9f18('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x114bed,_0x44ce2d){return function(_0x11cec5){if(!_0x11cec5){_0x114bed[_0x9f18('0x1c')](0x194);}return _0x11cec5;};}function handleError(_0x8fa86d,_0x5ca0bd){_0x5ca0bd=_0x5ca0bd||0x1f4;return function(_0x257828){logger[_0x9f18('0x2b')](_0x257828['stack']);if(_0x257828[_0x9f18('0x2c')]){delete _0x257828['name'];}_0x8fa86d[_0x9f18('0x21')](_0x5ca0bd)[_0x9f18('0x2d')](_0x257828);};}exports[_0x9f18('0x2e')]=function(_0x1361b4,_0x2d57cc){var _0x4318ca={},_0x32bf2f={},_0x32e6cc={'count':0x0,'rows':[]};var _0x121c8d=_['map'](db['VoicePrefix']['rawAttributes'],function(_0x589a13){return{'name':_0x589a13['fieldName'],'type':_0x589a13[_0x9f18('0x2f')][_0x9f18('0x30')]};});_0x32bf2f[_0x9f18('0x31')]=_['map'](_0x121c8d,_0x9f18('0x2c'));_0x32bf2f[_0x9f18('0x32')]=_[_0x9f18('0x33')](_0x1361b4['query']);_0x32bf2f['filters']=_[_0x9f18('0x34')](_0x32bf2f['model'],_0x32bf2f[_0x9f18('0x32')]);_0x4318ca[_0x9f18('0x35')]=_[_0x9f18('0x34')](_0x32bf2f[_0x9f18('0x31')],qs[_0x9f18('0x36')](_0x1361b4[_0x9f18('0x32')][_0x9f18('0x36')]));_0x4318ca[_0x9f18('0x35')]=_0x4318ca['attributes']['length']?_0x4318ca['attributes']:_0x32bf2f['model'];if(!_0x1361b4[_0x9f18('0x32')]['hasOwnProperty'](_0x9f18('0x37'))){_0x4318ca[_0x9f18('0x20')]=qs[_0x9f18('0x20')](_0x1361b4[_0x9f18('0x32')][_0x9f18('0x20')]);_0x4318ca[_0x9f18('0x1f')]=qs[_0x9f18('0x1f')](_0x1361b4[_0x9f18('0x32')][_0x9f18('0x1f')]);}_0x4318ca[_0x9f18('0x38')]=qs[_0x9f18('0x39')](_0x1361b4[_0x9f18('0x32')][_0x9f18('0x39')]);_0x4318ca[_0x9f18('0x3a')]=qs[_0x9f18('0x3b')](_['pick'](_0x1361b4[_0x9f18('0x32')],_0x32bf2f[_0x9f18('0x3b')]),_0x121c8d);if(_0x1361b4['query'][_0x9f18('0x3c')]){_0x4318ca[_0x9f18('0x3a')]=_['merge'](_0x4318ca[_0x9f18('0x3a')],{'$or':_[_0x9f18('0x3d')](_0x121c8d,function(_0x5eee42){if(_0x5eee42[_0x9f18('0x2f')]!==_0x9f18('0x3e')){var _0x44f105={};_0x44f105[_0x5eee42[_0x9f18('0x2c')]]={'$like':'%'+_0x1361b4[_0x9f18('0x32')][_0x9f18('0x3c')]+'%'};return _0x44f105;}})});}_0x4318ca=_['merge']({},_0x4318ca,_0x1361b4[_0x9f18('0x3f')]);var _0x31c719={'where':_0x4318ca[_0x9f18('0x3a')]};return db[_0x9f18('0x40')]['count'](_0x31c719)[_0x9f18('0x28')](function(_0x43803d){_0x32e6cc[_0x9f18('0x41')]=_0x43803d;if(_0x1361b4[_0x9f18('0x32')]['includeAll']){_0x4318ca[_0x9f18('0x42')]=[{'all':!![]}];}return db[_0x9f18('0x40')][_0x9f18('0x43')](_0x4318ca);})['then'](function(_0x3457c1){_0x32e6cc['rows']=_0x3457c1;return _0x32e6cc;})[_0x9f18('0x28')](respondWithFilteredResult(_0x2d57cc,_0x4318ca))[_0x9f18('0x44')](handleError(_0x2d57cc,null));};exports[_0x9f18('0x45')]=function(_0x597cfe,_0xc9b528){var _0x5e8714={'raw':![],'where':{'id':_0x597cfe[_0x9f18('0x46')]['id']}},_0x2c2914={};_0x2c2914['model']=_[_0x9f18('0x33')](db['VoicePrefix'][_0x9f18('0x47')]);_0x2c2914[_0x9f18('0x32')]=_[_0x9f18('0x33')](_0x597cfe[_0x9f18('0x32')]);_0x2c2914['filters']=_[_0x9f18('0x34')](_0x2c2914[_0x9f18('0x31')],_0x2c2914[_0x9f18('0x32')]);_0x5e8714['attributes']=_[_0x9f18('0x34')](_0x2c2914[_0x9f18('0x31')],qs[_0x9f18('0x36')](_0x597cfe[_0x9f18('0x32')][_0x9f18('0x36')]));_0x5e8714[_0x9f18('0x35')]=_0x5e8714[_0x9f18('0x35')][_0x9f18('0x48')]?_0x5e8714[_0x9f18('0x35')]:_0x2c2914['model'];if(_0x597cfe[_0x9f18('0x32')]['includeAll']){_0x5e8714[_0x9f18('0x42')]=[{'all':!![]}];}_0x5e8714=_[_0x9f18('0x49')]({},_0x5e8714,_0x597cfe['options']);return db['VoicePrefix']['find'](_0x5e8714)[_0x9f18('0x28')](handleEntityNotFound(_0xc9b528,null))[_0x9f18('0x28')](respondWithResult(_0xc9b528,null))[_0x9f18('0x44')](handleError(_0xc9b528,null));};exports[_0x9f18('0x29')]=function(_0x494406,_0x3534d0){return db[_0x9f18('0x40')][_0x9f18('0x4a')]({'where':{'id':_0x494406[_0x9f18('0x46')]['id']}})[_0x9f18('0x28')](handleEntityNotFound(_0x3534d0,null))['then'](removeEntity(_0x3534d0,null))[_0x9f18('0x44')](handleError(_0x3534d0,null));};exports['describe']=function(_0x11658d,_0xa75f6){return db[_0x9f18('0x40')][_0x9f18('0x4b')]()[_0x9f18('0x28')](respondWithResult(_0xa75f6,null))[_0x9f18('0x44')](handleError(_0xa75f6,null));};exports[_0x9f18('0x4c')]=function(_0x30eec2,_0x5e6d87){var _0x2fc318;return db[_0x9f18('0x4d')][_0x9f18('0x4e')](function(_0x3c3646){return db['VoicePrefix'][_0x9f18('0x4c')](_0x30eec2[_0x9f18('0x4f')],{'transaction':_0x3c3646})[_0x9f18('0x28')](function(_0x5a9732){_0x2fc318=_0x5a9732[_0x9f18('0x50')]({'plain':!![]});return db['VoiceExtension'][_0x9f18('0x4a')]({'where':{'id':_0x2fc318[_0x9f18('0x51')]},'raw':!![]})[_0x9f18('0x28')](function(_0x16616b){return createVoicePrefixExtensions(_0x2fc318,_0x16616b,_0x3c3646);});});})['then'](function(){var _0x417a4b=_0x30eec2['user']['get']({'plain':!![]});if(!_0x417a4b)throw new Error(_0x9f18('0x52'));if(_0x417a4b[_0x9f18('0x53')]==='user'){var _0x54ba81=_0x2fc318;return db[_0x9f18('0x54')]['find']({'where':{'name':_0x9f18('0x2a'),'userProfileId':_0x417a4b[_0x9f18('0x55')]},'raw':!![]})['then'](function(_0x21fd96){if(_0x21fd96&&_0x21fd96[_0x9f18('0x56')]===0x0){return db['UserProfileResource'][_0x9f18('0x4c')]({'name':_0x54ba81[_0x9f18('0x2c')],'resourceId':_0x54ba81['id'],'type':_0x21fd96[_0x9f18('0x2c')],'sectionId':_0x21fd96['id']},{})[_0x9f18('0x28')](function(){return _0x2fc318;});}else{return _0x2fc318;}})[_0x9f18('0x44')](function(_0x23c463){logger[_0x9f18('0x2b')](_0x9f18('0x57'),_0x23c463);throw _0x23c463;});}return _0x2fc318;})[_0x9f18('0x28')](respondWithResult(_0x5e6d87,null))[_0x9f18('0x44')](handleError(_0x5e6d87,null));};function Extension(_0x276d69,_0x11de02,_0x2a519b,_0x138437){this[_0x9f18('0x58')]='from-sip';this['exten']=_0x276d69;this['app']=_0x2a519b;this[_0x9f18('0x2f')]=_0x9f18('0x59');this[_0x9f18('0x5a')]=_0x9f18('0x5b');this[_0x9f18('0x5c')]=_0x11de02;this[_0x9f18('0x5d')]=_0x138437;}function createVoicePrefixExtensions(_0x1924b0,_0x3db7b1,_0x3f8891){return new BPromise(function(_0x1816ad,_0x2d1fee){var _0x37d0d0=new Extension(formatPrefixName(_0x1924b0[_0x9f18('0x5e')]),0x1,_0x9f18('0x5f'),'Voice\x20Prefix');_0x37d0d0[_0x9f18('0x60')]=_0x1924b0['id'];return db[_0x9f18('0x61')][_0x9f18('0x4c')](_0x37d0d0,{'transaction':_0x3f8891})[_0x9f18('0x28')](function(_0x3e66a7){var _0xce729f=_0x3e66a7[_0x9f18('0x50')]({'plain':!![]});var _0xf7b4c6=_['map'](addVoicePrefixExtensions(_0x1924b0,_0x3db7b1),function(_0x5d623a){_0x5d623a[_0x9f18('0x51')]=_0xce729f['id'];_0x5d623a[_0x9f18('0x60')]=_0x1924b0['id'];return _0x5d623a;});return db['VoiceExtension'][_0x9f18('0x62')](_0xf7b4c6,{'transaction':_0x3f8891})[_0x9f18('0x28')](function(_0x17a4ca){if(!_0x17a4ca){return _0x2d1fee(_0x9f18('0x63'));}else{return _0x1816ad(_0x17a4ca);}})[_0x9f18('0x44')](function(_0x5e0b32){return _0x2d1fee(_0x5e0b32);});});;});};function addVoicePrefixExtensions(_0x41059a,_0x5cee5b){var _0x2e17fd=[];var _0x278f07=formatPrefixName(_0x41059a[_0x9f18('0x5e')]);_0x2e17fd[_0x9f18('0x64')](new Extension(_0x278f07,0x2,_0x9f18('0x65'),_0x9f18('0x66')+_0x41059a[_0x9f18('0x2c')]));if(_0x41059a[_0x9f18('0x67')]){_0x2e17fd[_0x9f18('0x64')](new Extension(_0x278f07,0x3,_0x9f18('0x65'),'PREFIX-CALLERIDALL='+_0x41059a['callerIdAll']));}else{_0x2e17fd[_0x9f18('0x64')](new Extension(_0x278f07,0x3,_0x9f18('0x5f'),_0x9f18('0x68')));}_0x2e17fd['push'](new Extension(_0x278f07,0x4,_0x9f18('0x69'),_0x5cee5b['context']+','+'${EXTEN:'+(0x8+_0x41059a['name'][_0x9f18('0x48')])+'}'+','+0x1));return _0x2e17fd;}function formatPrefixName(_0x2710e4){var _0x28cb69='_';for(var _0xb8240f=0x0;_0xb8240f<_0x2710e4[_0x9f18('0x48')];_0xb8240f++){if(_0x2710e4[_0x9f18('0x6a')](_0xb8240f)=='-'){_0x28cb69+=_0x2710e4[_0x9f18('0x6a')](_0xb8240f);}else{_0x28cb69+='['+_0x2710e4[_0x9f18('0x6a')](_0xb8240f)+']';}}_0x28cb69+='.';return _0x28cb69;}exports[_0x9f18('0x27')]=function(_0x3adc18,_0x422f8c,_0x51f445){var _0x1d0f6f=_0x3adc18[_0x9f18('0x4f')];_0x1d0f6f[_0x9f18('0x5e')]=_0x9f18('0x6b')+_0x1d0f6f['name']+'-';return db[_0x9f18('0x4d')][_0x9f18('0x4e')](function(_0x5cbaf1){return db[_0x9f18('0x40')][_0x9f18('0x27')](_0x1d0f6f,{'where':{'id':_0x1d0f6f['id']},'transaction':_0x5cbaf1})[_0x9f18('0x28')](function(){return db['VoiceExtension'][_0x9f18('0x29')]({'where':{'VoicePrefixId':_0x1d0f6f['id']},'transaction':_0x5cbaf1})[_0x9f18('0x28')](function(){return db[_0x9f18('0x61')]['find']({'where':{'id':_0x1d0f6f[_0x9f18('0x51')]},'raw':!![]})[_0x9f18('0x28')](function(_0x3fda69){return createVoicePrefixExtensions(_0x1d0f6f,_0x3fda69,_0x5cbaf1);});});});})[_0x9f18('0x28')](function(){return db[_0x9f18('0x40')][_0x9f18('0x6c')](_0x1d0f6f['id']);})[_0x9f18('0x28')](respondWithResult(_0x422f8c,null))[_0x9f18('0x44')](handleError(_0x422f8c,null));};exports['addAgents']=function(_0x38db22,_0x1f1c8c,_0x10c279){return db[_0x9f18('0x40')]['find']({'where':{'id':_0x38db22[_0x9f18('0x46')]['id']}})[_0x9f18('0x28')](handleEntityNotFound(_0x1f1c8c,null))[_0x9f18('0x28')](function(_0x523b3c){if(_0x523b3c){return _0x523b3c[_0x9f18('0x6d')](_0x38db22[_0x9f18('0x4f')]['ids'],_[_0x9f18('0x6e')](_0x38db22[_0x9f18('0x4f')],[_0x9f18('0x6f'),'id'])||{})['spread'](function(_0x53f867){for(var _0x34d3d6=0x0;_0x34d3d6<_0x38db22['body']['ids'][_0x9f18('0x48')];_0x34d3d6+=0x1){socket[_0x9f18('0x70')](_0x9f18('0x71'),{'UserId':_0x38db22[_0x9f18('0x4f')]['ids'][_0x34d3d6],'VoicePrefixId':_0x38db22['params']['id']});}return _0x53f867;});}})['then'](respondWithResult(_0x1f1c8c,null))['catch'](handleError(_0x1f1c8c,null));};exports[_0x9f18('0x72')]=function(_0x2ed137,_0xe999f1,_0x22212c){return db[_0x9f18('0x40')]['find']({'where':{'id':_0x2ed137[_0x9f18('0x46')]['id']}})[_0x9f18('0x28')](handleEntityNotFound(_0xe999f1,null))[_0x9f18('0x28')](function(_0x30581c){if(_0x30581c){return _0x30581c[_0x9f18('0x72')](_0x2ed137[_0x9f18('0x32')][_0x9f18('0x6f')])[_0x9f18('0x28')](function(){if(_[_0x9f18('0x73')](_0x2ed137[_0x9f18('0x32')][_0x9f18('0x6f')])){for(var _0x188ae3=0x0;_0x188ae3<_0x2ed137[_0x9f18('0x32')][_0x9f18('0x6f')][_0x9f18('0x48')];_0x188ae3+=0x1){socket[_0x9f18('0x70')](_0x9f18('0x74'),{'UserId':Number(_0x2ed137[_0x9f18('0x32')]['ids'][_0x188ae3]),'VoicePrefixId':Number(_0x2ed137['params']['id'])});}}else{socket[_0x9f18('0x70')](_0x9f18('0x74'),{'UserId':Number(_0x2ed137['query'][_0x9f18('0x6f')]),'VoicePrefixId':Number(_0x2ed137['params']['id'])});}});}})[_0x9f18('0x28')](respondWithStatusCode(_0xe999f1,null))[_0x9f18('0x44')](handleError(_0xe999f1,null));};exports[_0x9f18('0x75')]=function(_0x8711e6,_0x21b38c,_0x54d6bc){var _0x950439={};var _0x1c218d={};var _0x306e2e;var _0x16f579;return db[_0x9f18('0x40')]['findOne']({'where':{'id':_0x8711e6['params']['id']}})[_0x9f18('0x28')](handleEntityNotFound(_0x21b38c,null))[_0x9f18('0x28')](function(_0x5395ab){if(_0x5395ab){_0x306e2e=_0x5395ab;_0x1c218d[_0x9f18('0x31')]=_[_0x9f18('0x33')](db[_0x9f18('0x76')][_0x9f18('0x47')]);_0x1c218d[_0x9f18('0x32')]=_[_0x9f18('0x33')](_0x8711e6[_0x9f18('0x32')]);_0x1c218d[_0x9f18('0x3b')]=_[_0x9f18('0x34')](_0x1c218d[_0x9f18('0x31')],_0x1c218d[_0x9f18('0x32')]);_0x950439[_0x9f18('0x35')]=_['intersection'](_0x1c218d['model'],qs[_0x9f18('0x36')](_0x8711e6[_0x9f18('0x32')]['fields']));_0x950439['attributes']=_0x950439[_0x9f18('0x35')]['length']?_0x950439[_0x9f18('0x35')]:_0x1c218d[_0x9f18('0x31')];_0x950439['order']=qs[_0x9f18('0x39')](_0x8711e6[_0x9f18('0x32')][_0x9f18('0x39')]);_0x950439[_0x9f18('0x3a')]=qs[_0x9f18('0x3b')](_[_0x9f18('0x77')](_0x8711e6['query'],_0x1c218d[_0x9f18('0x3b')]));if(_0x8711e6[_0x9f18('0x32')][_0x9f18('0x3c')]){_0x950439[_0x9f18('0x3a')]=_[_0x9f18('0x49')](_0x950439[_0x9f18('0x3a')],{'$or':_[_0x9f18('0x3d')](_0x950439[_0x9f18('0x35')],function(_0x3fdbb4){var _0x278ea0={};_0x278ea0[_0x3fdbb4]={'$like':'%'+_0x8711e6[_0x9f18('0x32')][_0x9f18('0x3c')]+'%'};return _0x278ea0;})});}_0x950439=_[_0x9f18('0x49')]({},_0x950439,_0x8711e6[_0x9f18('0x3f')]);return _0x306e2e[_0x9f18('0x75')](_0x950439);}})['then'](function(_0x4f1e00){if(_0x4f1e00){_0x16f579=_0x4f1e00['length'];if(!_0x8711e6[_0x9f18('0x32')]['hasOwnProperty'](_0x9f18('0x37'))){_0x950439[_0x9f18('0x20')]=qs[_0x9f18('0x20')](_0x8711e6[_0x9f18('0x32')][_0x9f18('0x20')]);_0x950439['offset']=qs['offset'](_0x8711e6[_0x9f18('0x32')][_0x9f18('0x1f')]);}return _0x306e2e['getAgents'](_0x950439);}})[_0x9f18('0x28')](function(_0x278837){if(_0x278837){return _0x278837?{'count':_0x16f579,'rows':_0x278837}:null;}})['then'](respondWithResult(_0x21b38c,null))[_0x9f18('0x44')](handleError(_0x21b38c,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 8637558..27cbec4 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 _0x9c44=['save','update','remove','emit','hasOwnProperty','hook','exports','VoicePrefix','setMaxListeners'];(function(_0x223587,_0x4dfc7e){var _0xb645d5=function(_0x11c66b){while(--_0x11c66b){_0x223587['push'](_0x223587['shift']());}};_0xb645d5(++_0x4dfc7e);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x49c4('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x49c4('0x1')](0x0);var events={'afterCreate':_0x49c4('0x2'),'afterUpdate':_0x49c4('0x3'),'afterDestroy':_0x49c4('0x4')};function emitEvent(_0x2ad237){return function(_0x4e0313,_0x4941f1,_0x41a183){VoicePrefixEvents['emit'](_0x2ad237+':'+_0x4e0313['id'],_0x4e0313);VoicePrefixEvents[_0x49c4('0x5')](_0x2ad237,_0x4e0313);_0x41a183(null);};}for(var e in events){if(events[_0x49c4('0x6')](e)){var event=events[e];VoicePrefix[_0x49c4('0x7')](e,emitEvent(event));}}module[_0x49c4('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xcb91=['save','update','emit','hasOwnProperty','hook','VoicePrefix','setMaxListeners'];(function(_0x279134,_0x5045f9){var _0x49beca=function(_0x3c7fd8){while(--_0x3c7fd8){_0x279134['push'](_0x279134['shift']());}};_0x49beca(++_0x5045f9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4c3ffe,_0x457374){_0x4c3ffe=_0x4c3ffe-0x0;var _0x28d3eb=_0xcb91[_0x4c3ffe];return _0x28d3eb;};'use strict';var EventEmitter=require('events');var VoicePrefix=require('../../mysqldb')['db'][_0x1cb9('0x0')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x1cb9('0x1')](0x0);var events={'afterCreate':_0x1cb9('0x2'),'afterUpdate':_0x1cb9('0x3'),'afterDestroy':'remove'};function emitEvent(_0x8c392f){return function(_0x2c17b8,_0x545a34,_0x13d5fd){VoicePrefixEvents[_0x1cb9('0x4')](_0x8c392f+':'+_0x2c17b8['id'],_0x2c17b8);VoicePrefixEvents['emit'](_0x8c392f,_0x2c17b8);_0x13d5fd(null);};}for(var e in events){if(events[_0x1cb9('0x5')](e)){var event=events[e];VoicePrefix[_0x1cb9('0x6')](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 1a7540b..48bd3d7 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 _0xc094=['path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','util','../../config/logger','bluebird','request-promise'];(function(_0x15c8e0,_0x332c04){var _0xcf223b=function(_0x1dbadb){while(--_0x1dbadb){_0x15c8e0['push'](_0x15c8e0['shift']());}};_0xcf223b(++_0x332c04);}(_0xc094,0x1c4));var _0x4c09=function(_0x14eb58,_0x4f9cf4){_0x14eb58=_0x14eb58-0x0;var _0x3a47ed=_0xc094[_0x14eb58];return _0x3a47ed;};'use strict';var _=require('lodash');var util=require(_0x4c09('0x0'));var logger=require(_0x4c09('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4c09('0x2'));var rp=require(_0x4c09('0x3'));var fs=require('fs');var path=require(_0x4c09('0x4'));var rimraf=require(_0x4c09('0x5'));var config=require(_0x4c09('0x6'));var attributes=require(_0x4c09('0x7'));module[_0x4c09('0x8')]=function(_0x507799,_0x372c73){return _0x507799[_0x4c09('0x9')](_0x4c09('0xa'),attributes,{'tableName':_0x4c09('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf730=['define','VoicePrefix','lodash','util','moment','bluebird','request-promise','rimraf','./voicePrefix.attributes','exports'];(function(_0x203d48,_0x2e28bb){var _0x2a2759=function(_0x5d1280){while(--_0x5d1280){_0x203d48['push'](_0x203d48['shift']());}};_0x2a2759(++_0x2e28bb);}(_0xf730,0xd4));var _0x0f73=function(_0x1a3984,_0x492a1d){_0x1a3984=_0x1a3984-0x0;var _0x386311=_0xf730[_0x1a3984];return _0x386311;};'use strict';var _=require(_0x0f73('0x0'));var util=require(_0x0f73('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0f73('0x2'));var BPromise=require(_0x0f73('0x3'));var rp=require(_0x0f73('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f73('0x5'));var config=require('../../config/environment');var attributes=require(_0x0f73('0x6'));module[_0x0f73('0x7')]=function(_0x392163,_0x2bb970){return _0x392163[_0x0f73('0x8')](_0x0f73('0x9'),attributes,{'tableName':'voice_prefixes','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 d15df2e..c8e97c4 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 _0x06a9=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2ace0f,_0x42535e){var _0x4bddb3=function(_0x33eb91){while(--_0x33eb91){_0x2ace0f['push'](_0x2ace0f['shift']());}};_0x4bddb3(++_0x42535e);}(_0x06a9,0xb7));var _0x906a=function(_0x1b4e8a,_0x2ac96e){_0x1b4e8a=_0x1b4e8a-0x0;var _0x45f3c9=_0x06a9[_0x1b4e8a];return _0x45f3c9;};'use strict';var _=require(_0x906a('0x0'));var util=require(_0x906a('0x1'));var moment=require(_0x906a('0x2'));var BPromise=require(_0x906a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x906a('0x4'));var db=require(_0x906a('0x5'))['db'];var utils=require(_0x906a('0x6'));var logger=require(_0x906a('0x7'))(_0x906a('0x8'));var config=require(_0x906a('0x9'));var jayson=require(_0x906a('0xa'));var client=jayson['client'][_0x906a('0xb')]({'port':0x232a});config[_0x906a('0xc')]=_[_0x906a('0xd')](config['redis'],{'host':_0x906a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x906a('0xc')]));require(_0x906a('0xf'))[_0x906a('0x10')](socket);function respondWithRpcPromise(_0x1fd486,_0x238600,_0x1bfe95){return new BPromise(function(_0x14ae7d,_0x15b278){return client[_0x906a('0x11')](_0x1fd486,_0x1bfe95)[_0x906a('0x12')](function(_0x5d617e){logger[_0x906a('0x13')](_0x906a('0x14'),_0x238600,_0x906a('0x15'));logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x238600,_0x906a('0x15'),JSON[_0x906a('0x16')](_0x5d617e));if(_0x5d617e[_0x906a('0x17')]){if(_0x5d617e[_0x906a('0x17')]['code']===0x1f4){logger[_0x906a('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x238600,_0x5d617e[_0x906a('0x17')][_0x906a('0x18')]);return _0x15b278(_0x5d617e[_0x906a('0x17')][_0x906a('0x18')]);}logger[_0x906a('0x17')](_0x906a('0x14'),_0x238600,_0x5d617e[_0x906a('0x17')][_0x906a('0x18')]);return _0x14ae7d(_0x5d617e[_0x906a('0x17')]['message']);}else{logger[_0x906a('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x238600,_0x906a('0x15'));_0x14ae7d(_0x5d617e[_0x906a('0x19')]['message']);}})[_0x906a('0x1a')](function(_0x142a65){logger[_0x906a('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x238600,_0x142a65);_0x15b278(_0x142a65);});});} \ No newline at end of file +var _0x1794=['localhost','./voicePrefix.socket','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1794,0x1f3));var _0x4179=function(_0x319199,_0x151627){_0x319199=_0x319199-0x0;var _0x5493a2=_0x1794[_0x319199];return _0x5493a2;};'use strict';var _=require(_0x4179('0x0'));var util=require(_0x4179('0x1'));var moment=require(_0x4179('0x2'));var BPromise=require(_0x4179('0x3'));var rs=require(_0x4179('0x4'));var fs=require('fs');var Redis=require(_0x4179('0x5'));var db=require(_0x4179('0x6'))['db'];var utils=require(_0x4179('0x7'));var logger=require(_0x4179('0x8'))(_0x4179('0x9'));var config=require(_0x4179('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x4179('0xb')][_0x4179('0xc')]({'port':0x232a});config[_0x4179('0xd')]=_['defaults'](config['redis'],{'host':_0x4179('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4179('0xd')]));require(_0x4179('0xf'))['register'](socket);function respondWithRpcPromise(_0xefb283,_0x6547c,_0xc69340){return new BPromise(function(_0x441f19,_0x33b6aa){return client['request'](_0xefb283,_0xc69340)[_0x4179('0x10')](function(_0x264f44){logger['info'](_0x4179('0x11'),_0x6547c,_0x4179('0x12'));logger[_0x4179('0x13')](_0x4179('0x14'),_0x6547c,_0x4179('0x12'),JSON[_0x4179('0x15')](_0x264f44));if(_0x264f44['error']){if(_0x264f44[_0x4179('0x16')][_0x4179('0x17')]===0x1f4){logger[_0x4179('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x6547c,_0x264f44[_0x4179('0x16')][_0x4179('0x18')]);return _0x33b6aa(_0x264f44[_0x4179('0x16')][_0x4179('0x18')]);}logger[_0x4179('0x16')](_0x4179('0x11'),_0x6547c,_0x264f44[_0x4179('0x16')]['message']);return _0x441f19(_0x264f44[_0x4179('0x16')][_0x4179('0x18')]);}else{logger['info'](_0x4179('0x11'),_0x6547c,_0x4179('0x12'));_0x441f19(_0x264f44[_0x4179('0x19')][_0x4179('0x18')]);}})[_0x4179('0x1a')](function(_0x33a9b0){logger[_0x4179('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x6547c,_0x33a9b0);_0x33b6aa(_0x33a9b0);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index a235d0a..55c23cb 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 _0x979a=['voicePrefix:','./voicePrefix.events','remove','update','emit','removeListener'];(function(_0x53df97,_0x260c0d){var _0x56295d=function(_0x489ae9){while(--_0x489ae9){_0x53df97['push'](_0x53df97['shift']());}};_0x56295d(++_0x260c0d);}(_0x979a,0xeb));var _0xa979=function(_0x1f1a63,_0x3b5924){_0x1f1a63=_0x1f1a63-0x0;var _0x21492a=_0x979a[_0x1f1a63];return _0x21492a;};'use strict';var VoicePrefixEvents=require(_0xa979('0x0'));var events=['save',_0xa979('0x1'),_0xa979('0x2')];function createListener(_0xda929c,_0x3ed3f4){return function(_0x48ad8c){_0x3ed3f4[_0xa979('0x3')](_0xda929c,_0x48ad8c);};}function removeListener(_0x422942,_0xe37e1c){return function(){VoicePrefixEvents[_0xa979('0x4')](_0x422942,_0xe37e1c);};}exports['register']=function(_0x39d8c7){for(var _0x2afeaf=0x0,_0x1eee34=events['length'];_0x2afeaf<_0x1eee34;_0x2afeaf++){var _0x107b3b=events[_0x2afeaf];var _0x51eae4=createListener(_0xa979('0x5')+_0x107b3b,_0x39d8c7);VoicePrefixEvents['on'](_0x107b3b,_0x51eae4);}}; \ No newline at end of file +var _0x1408=['emit','removeListener','register','voicePrefix:','./voicePrefix.events','save','update'];(function(_0x2cdfba,_0x2e9f8c){var _0x28cd8f=function(_0x584cfb){while(--_0x584cfb){_0x2cdfba['push'](_0x2cdfba['shift']());}};_0x28cd8f(++_0x2e9f8c);}(_0x1408,0x131));var _0x8140=function(_0x367644,_0x508eea){_0x367644=_0x367644-0x0;var _0x4ae940=_0x1408[_0x367644];return _0x4ae940;};'use strict';var VoicePrefixEvents=require(_0x8140('0x0'));var events=[_0x8140('0x1'),'remove',_0x8140('0x2')];function createListener(_0x25884c,_0x40f6f9){return function(_0x51ad69){_0x40f6f9[_0x8140('0x3')](_0x25884c,_0x51ad69);};}function removeListener(_0x3f7712,_0x3510d9){return function(){VoicePrefixEvents[_0x8140('0x4')](_0x3f7712,_0x3510d9);};}exports[_0x8140('0x5')]=function(_0x585648){for(var _0x4e1763=0x0,_0x1ce368=events['length'];_0x4e1763<_0x1ce368;_0x4e1763++){var _0x3ccd16=events[_0x4e1763];var _0x25ecb0=createListener(_0x8140('0x6')+_0x3ccd16,_0x585648);VoicePrefixEvents['on'](_0x3ccd16,_0x25ecb0);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index fb33bfc..5648d40 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 _0xc7ab=['getHopperFinals','/:id/hopper_black','getHopperBlacks','getTeams','/:id/users','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','create','post','/:id/clone','clone','/:id/teams','addAgents','addBlackLists','/:id','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals'];(function(_0x416430,_0x2a5afa){var _0x420b17=function(_0x23b874){while(--_0x23b874){_0x416430['push'](_0x416430['shift']());}};_0x420b17(++_0x2a5afa);}(_0xc7ab,0x114));var _0xbc7a=function(_0x4ba0b3,_0x2ddb1a){_0x4ba0b3=_0x4ba0b3-0x0;var _0x3b4ad3=_0xc7ab[_0x4ba0b3];return _0x3b4ad3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xbc7a('0x0'));var express=require('express');var router=express[_0xbc7a('0x1')]();var auth=require(_0xbc7a('0x2'));var interaction=require(_0xbc7a('0x3'));var config=require(_0xbc7a('0x4'));var controller=require('./voiceQueue.controller');router[_0xbc7a('0x5')]('/',auth[_0xbc7a('0x6')](),controller['index']);router[_0xbc7a('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xbc7a('0x7')]);router[_0xbc7a('0x5')](_0xbc7a('0x8'),auth[_0xbc7a('0x6')](),controller[_0xbc7a('0x9')]);router['get'](_0xbc7a('0xa'),auth[_0xbc7a('0x6')](),controller['getHopperHistories']);router[_0xbc7a('0x5')](_0xbc7a('0xb'),auth[_0xbc7a('0x6')](),controller[_0xbc7a('0xc')]);router['get'](_0xbc7a('0xd'),auth[_0xbc7a('0x6')](),controller[_0xbc7a('0xe')]);router[_0xbc7a('0x5')]('/:id/teams',auth[_0xbc7a('0x6')](),controller[_0xbc7a('0xf')]);router[_0xbc7a('0x5')](_0xbc7a('0x10'),auth[_0xbc7a('0x6')](),controller['getAgents']);router[_0xbc7a('0x5')](_0xbc7a('0x11'),auth['isAuthenticated'](),controller[_0xbc7a('0x12')]);router['get'](_0xbc7a('0x13'),auth['isAuthenticated'](),controller['getLists']);router[_0xbc7a('0x5')](_0xbc7a('0x14'),auth[_0xbc7a('0x6')](),controller[_0xbc7a('0x15')]);router['post']('/',auth[_0xbc7a('0x6')](),controller[_0xbc7a('0x16')]);router[_0xbc7a('0x17')](_0xbc7a('0x18'),auth[_0xbc7a('0x6')](),controller[_0xbc7a('0x19')]);router[_0xbc7a('0x17')](_0xbc7a('0x1a'),auth[_0xbc7a('0x6')](),controller['addTeams']);router['post'](_0xbc7a('0x10'),auth[_0xbc7a('0x6')](),controller[_0xbc7a('0x1b')]);router[_0xbc7a('0x17')]('/:id/lists',auth['isAuthenticated'](),controller['addLists']);router[_0xbc7a('0x17')](_0xbc7a('0x14'),auth['isAuthenticated'](),controller[_0xbc7a('0x1c')]);router['put'](_0xbc7a('0x1d'),auth[_0xbc7a('0x6')](),controller['update']);router['delete']('/:id',auth[_0xbc7a('0x6')](),controller['destroy']);router[_0xbc7a('0x1e')](_0xbc7a('0x1a'),auth[_0xbc7a('0x6')](),controller[_0xbc7a('0x1f')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xbc7a('0x20')]);router[_0xbc7a('0x1e')](_0xbc7a('0x13'),auth['isAuthenticated'](),controller[_0xbc7a('0x21')]);router[_0xbc7a('0x1e')](_0xbc7a('0x14'),auth['isAuthenticated'](),controller[_0xbc7a('0x22')]);module[_0xbc7a('0x23')]=router; \ No newline at end of file +var _0x312a=['Router','../../components/auth/service','./voiceQueue.controller','index','get','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addTeams','addAgents','addLists','put','delete','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout'];(function(_0x497a22,_0x323180){var _0x501e7d=function(_0x252b86){while(--_0x252b86){_0x497a22['push'](_0x497a22['shift']());}};_0x501e7d(++_0x323180);}(_0x312a,0x1dd));var _0xa312=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x312a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa312('0x0'));var util=require(_0xa312('0x1'));var path=require(_0xa312('0x2'));var timeout=require(_0xa312('0x3'));var express=require('express');var router=express[_0xa312('0x4')]();var auth=require(_0xa312('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa312('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xa312('0x7')]);router[_0xa312('0x8')](_0xa312('0x9'),auth[_0xa312('0xa')](),controller[_0xa312('0xb')]);router['get'](_0xa312('0xc'),auth['isAuthenticated'](),controller[_0xa312('0xd')]);router[_0xa312('0x8')]('/:id/hopper_histories',auth[_0xa312('0xa')](),controller['getHopperHistories']);router[_0xa312('0x8')]('/:id/hopper_finals',auth[_0xa312('0xa')](),controller['getHopperFinals']);router[_0xa312('0x8')](_0xa312('0xe'),auth[_0xa312('0xa')](),controller[_0xa312('0xf')]);router[_0xa312('0x8')](_0xa312('0x10'),auth[_0xa312('0xa')](),controller[_0xa312('0x11')]);router['get'](_0xa312('0x12'),auth[_0xa312('0xa')](),controller[_0xa312('0x13')]);router[_0xa312('0x8')]('/:id/members',auth[_0xa312('0xa')](),controller[_0xa312('0x14')]);router[_0xa312('0x8')](_0xa312('0x15'),auth[_0xa312('0xa')](),controller[_0xa312('0x16')]);router[_0xa312('0x8')](_0xa312('0x17'),auth[_0xa312('0xa')](),controller[_0xa312('0x18')]);router[_0xa312('0x19')]('/',auth[_0xa312('0xa')](),controller['create']);router[_0xa312('0x19')](_0xa312('0x1a'),auth[_0xa312('0xa')](),controller[_0xa312('0x1b')]);router[_0xa312('0x19')](_0xa312('0x10'),auth['isAuthenticated'](),controller[_0xa312('0x1c')]);router[_0xa312('0x19')](_0xa312('0x12'),auth[_0xa312('0xa')](),controller[_0xa312('0x1d')]);router[_0xa312('0x19')](_0xa312('0x15'),auth[_0xa312('0xa')](),controller[_0xa312('0x1e')]);router[_0xa312('0x19')](_0xa312('0x17'),auth[_0xa312('0xa')](),controller['addBlackLists']);router[_0xa312('0x1f')](_0xa312('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xa312('0x20')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xa312('0x20')](_0xa312('0x10'),auth[_0xa312('0xa')](),controller['removeTeams']);router[_0xa312('0x20')](_0xa312('0x12'),auth[_0xa312('0xa')](),controller[_0xa312('0x21')]);router[_0xa312('0x20')](_0xa312('0x15'),auth[_0xa312('0xa')](),controller[_0xa312('0x22')]);router[_0xa312('0x20')](_0xa312('0x17'),auth['isAuthenticated'](),controller[_0xa312('0x23')]);module[_0xa312('0x24')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 76dc5d1..33bff38 100644 --- a/server/api/voiceQueue/voiceQueue.attributes.js +++ b/server/api/voiceQueue/voiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x442a5d,_0x2a6745){var _0x51d134=function(_0x5cae90){while(--_0x5cae90){_0x442a5d['push'](_0x442a5d['shift']());}};_0x51d134(++_0x2a6745);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x43f2ed,_0x18ef91){var _0x5f452f=function(_0x4616df){while(--_0x4616df){_0x43f2ed['push'](_0x43f2ed['shift']());}};_0x5f452f(++_0x18ef91);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 17a7677..4a87ac6 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 _0x4785=['./voiceQueue.socket','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','destroy','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map','value','includes','type','find','name','UserProfileResource','end','error','stack','send','fieldName','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','merge','VIRTUAL','options','VoiceQueue','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','clone','omit','updatedAt','body','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getHoppers','findOne','CmHopper','hasOwnProperty','pick','VoiceQueueId','length','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','getTeams','Team','nolimit','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','each','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','SIP/%s','ids','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','all','compact','transaction','removeTeams','isEmpty','emit','userVoiceQueue:remove','addAgents','userVoiceQueue:save','format','removeAgents','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','scheduledAt','ListId','phone','NOW()','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','ContactId','cm_contacts','removeLists','getBlackLists','cm_hopper_black','removeBlackLists','CmHopperBlack','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','sox','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x5d0d42,_0x39bcc9){var _0x320562=function(_0x28894d){while(--_0x28894d){_0x5d0d42['push'](_0x5d0d42['shift']());}};_0x320562(++_0x39bcc9);}(_0x4785,0x14a));var _0x5478=function(_0x2ea183,_0x3cff11){_0x2ea183=_0x2ea183-0x0;var _0x47c16c=_0x4785[_0x2ea183];return _0x47c16c;};'use strict';var pdf=require(_0x5478('0x0'));var emlformat=require(_0x5478('0x1'));var rimraf=require(_0x5478('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5478('0x3'));var BPromise=require(_0x5478('0x4'));var Mustache=require(_0x5478('0x5'));var util=require(_0x5478('0x6'));var path=require('path');var sox=require(_0x5478('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5478('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x5478('0x9'));var toCsv=require(_0x5478('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5478('0xb'));var authService=require(_0x5478('0xc'));var qs=require(_0x5478('0xd'));var as=require(_0x5478('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5478('0xf'))(_0x5478('0x10'));var utils=require('../../config/utils');var config=require(_0x5478('0x11'));var db=require('../../mysqldb')['db'];config[_0x5478('0x12')]=_[_0x5478('0x13')](config[_0x5478('0x12')],{'host':_0x5478('0x14'),'port':0x18eb});var socket=require(_0x5478('0x15'))(new Redis(config[_0x5478('0x12')]));require(_0x5478('0x16'))['register'](socket);function respondWithStatusCode(_0x5318cc,_0x87e8ac){_0x87e8ac=_0x87e8ac||0xcc;return function(_0x274ce5){if(_0x274ce5){return _0x5318cc[_0x5478('0x17')](_0x87e8ac);}return _0x5318cc[_0x5478('0x18')](_0x87e8ac)['end']();};}function respondWithResult(_0x138dcc,_0x1965bb){_0x1965bb=_0x1965bb||0xc8;return function(_0x797ea8){if(_0x797ea8){return _0x138dcc['status'](_0x1965bb)[_0x5478('0x19')](_0x797ea8);}};}function respondWithFilteredResult(_0x3c2037,_0x27e716){return function(_0x4cecfa){if(_0x4cecfa){var _0x5f2c6e=_0x4cecfa[_0x5478('0x1a')],_0x550d2f=_0x27e716['offset'],_0x3e6db8=_0x27e716[_0x5478('0x1b')]+_0x27e716[_0x5478('0x1c')],_0x53602d;if(_0x3e6db8>=_0x5f2c6e){_0x3e6db8=_0x5f2c6e;_0x53602d=0xc8;}else{_0x53602d=0xce;}_0x3c2037[_0x5478('0x18')](_0x53602d);return _0x3c2037[_0x5478('0x1d')](_0x5478('0x1e'),_0x550d2f+'-'+_0x3e6db8+'/'+_0x5f2c6e)[_0x5478('0x19')](_0x4cecfa);}return null;};}function patchUpdates(_0x2299f7){return function(_0x2662ca){try{jsonpatch['apply'](_0x2662ca,_0x2299f7,!![]);}catch(_0x2b8d31){return BPromise[_0x5478('0x1f')](_0x2b8d31);}return _0x2662ca[_0x5478('0x20')]();};}function saveUpdates(_0x14f141,_0x859b25){return function(_0x5a3776){if(_0x5a3776){return _0x5a3776['update'](_0x14f141)['then'](function(_0x5db684){return _0x5db684;});}return null;};}function removeEntity(_0x502d63,_0x12657a){return function(_0x253c00){if(_0x253c00){return _0x253c00[_0x5478('0x21')]()[_0x5478('0x22')](function(){var _0x85aa6b=_0x253c00[_0x5478('0x23')]({'plain':!![]});var _0x58acf5=[{'name':_0x5478('0x24'),'value':_0x5478('0x25'),'ignore':![]},{'name':_0x5478('0x26'),'value':_0x5478('0x27'),'ignore':![]}];var _0x12d2a4=_(_0x58acf5)[_0x5478('0x28')]('ignore')[_0x5478('0x29')](_0x5478('0x2a'))[_0x5478('0x2a')]();if(_[_0x5478('0x2b')](_0x12d2a4,_0x85aa6b[_0x5478('0x2c')])){return;}var _0x9a0f4e=_[_0x5478('0x2d')](_0x58acf5,[_0x5478('0x2a'),_0x85aa6b[_0x5478('0x2c')]])[_0x5478('0x2e')];return db[_0x5478('0x2f')]['destroy']({'where':{'type':_0x9a0f4e,'resourceId':_0x85aa6b['id']}})[_0x5478('0x22')](function(){return _0x253c00;});})[_0x5478('0x22')](function(){_0x502d63[_0x5478('0x18')](0xcc)[_0x5478('0x30')]();});}};}function handleEntityNotFound(_0x25b8b4,_0x50f3dd){return function(_0x247fdc){if(!_0x247fdc){_0x25b8b4[_0x5478('0x17')](0x194);}return _0x247fdc;};}function handleError(_0x441df0,_0x5d498e){_0x5d498e=_0x5d498e||0x1f4;return function(_0x33417b){logger[_0x5478('0x31')](_0x33417b[_0x5478('0x32')]);if(_0x33417b[_0x5478('0x2e')]){delete _0x33417b['name'];}_0x441df0[_0x5478('0x18')](_0x5d498e)[_0x5478('0x33')](_0x33417b);};}exports['index']=function(_0x3dca4f,_0xff6914){var _0x3a44aa={},_0x3b8a4a={},_0xf45d62={'count':0x0,'rows':[]};var _0x3378cc=_[_0x5478('0x29')](db['VoiceQueue']['rawAttributes'],function(_0x5855d8){return{'name':_0x5855d8[_0x5478('0x34')],'type':_0x5855d8[_0x5478('0x2c')][_0x5478('0x35')]};});_0x3b8a4a[_0x5478('0x36')]=_[_0x5478('0x29')](_0x3378cc,_0x5478('0x2e'));_0x3b8a4a[_0x5478('0x37')]=_[_0x5478('0x38')](_0x3dca4f[_0x5478('0x37')]);_0x3b8a4a[_0x5478('0x39')]=_[_0x5478('0x3a')](_0x3b8a4a[_0x5478('0x36')],_0x3b8a4a[_0x5478('0x37')]);_0x3a44aa[_0x5478('0x3b')]=_[_0x5478('0x3a')](_0x3b8a4a['model'],qs[_0x5478('0x3c')](_0x3dca4f[_0x5478('0x37')][_0x5478('0x3c')]));_0x3a44aa['attributes']=_0x3a44aa[_0x5478('0x3b')]['length']?_0x3a44aa[_0x5478('0x3b')]:_0x3b8a4a[_0x5478('0x36')];if(!_0x3dca4f[_0x5478('0x37')]['hasOwnProperty']('nolimit')){_0x3a44aa[_0x5478('0x1c')]=qs[_0x5478('0x1c')](_0x3dca4f[_0x5478('0x37')][_0x5478('0x1c')]);_0x3a44aa[_0x5478('0x1b')]=qs[_0x5478('0x1b')](_0x3dca4f[_0x5478('0x37')][_0x5478('0x1b')]);}_0x3a44aa[_0x5478('0x3d')]=qs[_0x5478('0x3e')](_0x3dca4f[_0x5478('0x37')][_0x5478('0x3e')]);_0x3a44aa[_0x5478('0x3f')]=qs[_0x5478('0x39')](_['pick'](_0x3dca4f['query'],_0x3b8a4a['filters']),_0x3378cc);if(_0x3dca4f[_0x5478('0x37')][_0x5478('0x28')]){_0x3a44aa[_0x5478('0x3f')]=_[_0x5478('0x40')](_0x3a44aa[_0x5478('0x3f')],{'$or':_[_0x5478('0x29')](_0x3378cc,function(_0x3104ae){if(_0x3104ae[_0x5478('0x2c')]!==_0x5478('0x41')){var _0x1743b6={};_0x1743b6[_0x3104ae[_0x5478('0x2e')]]={'$like':'%'+_0x3dca4f[_0x5478('0x37')][_0x5478('0x28')]+'%'};return _0x1743b6;}})});}_0x3a44aa=_[_0x5478('0x40')]({},_0x3a44aa,_0x3dca4f[_0x5478('0x42')]);var _0x3e1012={'where':_0x3a44aa[_0x5478('0x3f')]};return db[_0x5478('0x43')][_0x5478('0x1a')](_0x3e1012)[_0x5478('0x22')](function(_0x4ebc45){_0xf45d62['count']=_0x4ebc45;if(_0x3dca4f[_0x5478('0x37')][_0x5478('0x44')]){_0x3a44aa[_0x5478('0x45')]=[{'all':!![]}];}return db['VoiceQueue'][_0x5478('0x46')](_0x3a44aa);})[_0x5478('0x22')](function(_0x257621){_0xf45d62[_0x5478('0x47')]=_0x257621;return _0xf45d62;})[_0x5478('0x22')](respondWithFilteredResult(_0xff6914,_0x3a44aa))['catch'](handleError(_0xff6914,null));};exports[_0x5478('0x48')]=function(_0x523287,_0x5c8d74){var _0x27d4de={'raw':![],'where':{'id':_0x523287[_0x5478('0x49')]['id']}},_0x227398={};_0x227398[_0x5478('0x36')]=_[_0x5478('0x38')](db[_0x5478('0x43')][_0x5478('0x4a')]);_0x227398[_0x5478('0x37')]=_[_0x5478('0x38')](_0x523287[_0x5478('0x37')]);_0x227398[_0x5478('0x39')]=_[_0x5478('0x3a')](_0x227398[_0x5478('0x36')],_0x227398['query']);_0x27d4de[_0x5478('0x3b')]=_[_0x5478('0x3a')](_0x227398[_0x5478('0x36')],qs['fields'](_0x523287['query'][_0x5478('0x3c')]));_0x27d4de[_0x5478('0x3b')]=_0x27d4de[_0x5478('0x3b')]['length']?_0x27d4de[_0x5478('0x3b')]:_0x227398[_0x5478('0x36')];if(_0x523287[_0x5478('0x37')][_0x5478('0x44')]){_0x27d4de[_0x5478('0x45')]=[{'all':!![]}];}_0x27d4de=_[_0x5478('0x40')]({},_0x27d4de,_0x523287[_0x5478('0x42')]);return db[_0x5478('0x43')][_0x5478('0x2d')](_0x27d4de)[_0x5478('0x22')](handleEntityNotFound(_0x5c8d74,null))['then'](respondWithResult(_0x5c8d74,null))[_0x5478('0x4b')](handleError(_0x5c8d74,null));};exports[_0x5478('0x4c')]=function(_0xaaec4,_0x20f693){return db[_0x5478('0x43')][_0x5478('0x4c')](_0xaaec4['body'],{})['then'](function(_0x106e85){var _0x4dd201=_0xaaec4[_0x5478('0x4d')][_0x5478('0x23')]({'plain':!![]});if(!_0x4dd201)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4dd201[_0x5478('0x4e')]==='user'){var _0x174340=_0x106e85[_0x5478('0x23')]({'plain':!![]});var _0x3dae98=[{'name':_0x5478('0x24'),'value':_0x5478('0x25')},{'name':'QueueCampaigns','value':_0x5478('0x27')}];var _0x4f4985=_[_0x5478('0x2d')](_0x3dae98,['value',_0x174340[_0x5478('0x2c')]])[_0x5478('0x2e')];return db[_0x5478('0x4f')][_0x5478('0x2d')]({'where':{'name':_0x4f4985,'userProfileId':_0x4dd201[_0x5478('0x50')]},'raw':!![]})[_0x5478('0x22')](function(_0x32b11b){if(_0x32b11b&&_0x32b11b[_0x5478('0x51')]===0x0){return db[_0x5478('0x2f')]['create']({'name':_0x174340[_0x5478('0x2e')],'resourceId':_0x174340['id'],'type':_0x32b11b[_0x5478('0x2e')],'sectionId':_0x32b11b['id']},{})[_0x5478('0x22')](function(){return _0x106e85;});}else{return _0x106e85;}})[_0x5478('0x4b')](function(_0x45045c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45045c);throw _0x45045c;});}return _0x106e85;})['then'](respondWithResult(_0x20f693,0xc9))[_0x5478('0x4b')](handleError(_0x20f693,null));};exports[_0x5478('0x52')]=function(_0x3dae1d,_0x245c48){var _0x115ed1={'where':{'id':_0x3dae1d[_0x5478('0x49')]['id']}},_0x40264c={};_0x40264c[_0x5478('0x36')]=_['keys'](db[_0x5478('0x43')][_0x5478('0x4a')]);_0x115ed1[_0x5478('0x3b')]=_[_0x5478('0x3a')](_0x40264c[_0x5478('0x36')],qs[_0x5478('0x3c')](_0x3dae1d[_0x5478('0x37')][_0x5478('0x3c')]));_0x115ed1[_0x5478('0x3b')]=_0x115ed1[_0x5478('0x3b')]['length']?_0x115ed1[_0x5478('0x3b')]:_0x40264c[_0x5478('0x36')];if(_0x3dae1d[_0x5478('0x37')]['includeAll']){_0x115ed1[_0x5478('0x45')]=[{'all':!![]}];}_0x115ed1=_[_0x5478('0x40')]({},_0x115ed1,_0x3dae1d[_0x5478('0x42')]);return db[_0x5478('0x43')][_0x5478('0x2d')](_0x115ed1)['then'](handleEntityNotFound(_0x245c48,null))[_0x5478('0x22')](function(_0x239368){if(_0x239368){var _0x307d72=_0x239368[_0x5478('0x23')]({'plain':!![]});_0x307d72=qs[_0x5478('0x53')](_0x307d72,['id','createdAt',_0x5478('0x54')]);_0x3dae1d['body']=_[_0x5478('0x53')](_0x3dae1d[_0x5478('0x55')],['id',_0x5478('0x56'),_0x5478('0x54')]);return db[_0x5478('0x43')][_0x5478('0x4c')](_[_0x5478('0x40')](_0x307d72,_0x3dae1d[_0x5478('0x55')]),{'include':_0x3dae1d[_0x5478('0x37')][_0x5478('0x44')]?[{'all':!![]}]:undefined})[_0x5478('0x22')](function(_0x3a9286){var _0x31e784=_0x3dae1d['user'][_0x5478('0x23')]({'plain':!![]});if(!_0x31e784)throw new Error(_0x5478('0x57'));if(_0x31e784[_0x5478('0x4e')]===_0x5478('0x4d')){var _0x42a029=_0x3a9286['get']({'plain':!![]});var _0x38e522=[{'name':_0x5478('0x24'),'value':_0x5478('0x25')},{'name':'QueueCampaigns','value':_0x5478('0x27')}];var _0x7338bb=_[_0x5478('0x2d')](_0x38e522,[_0x5478('0x2a'),_0x42a029[_0x5478('0x2c')]])[_0x5478('0x2e')];return db[_0x5478('0x4f')][_0x5478('0x2d')]({'where':{'name':_0x7338bb,'userProfileId':_0x31e784[_0x5478('0x50')]},'raw':!![]})[_0x5478('0x22')](function(_0x3c2f3c){if(_0x3c2f3c&&_0x3c2f3c[_0x5478('0x51')]===0x0){return db[_0x5478('0x2f')][_0x5478('0x4c')]({'name':_0x42a029[_0x5478('0x2e')],'resourceId':_0x42a029['id'],'type':_0x3c2f3c[_0x5478('0x2e')],'sectionId':_0x3c2f3c['id']},{})[_0x5478('0x22')](function(){return _0x3a9286;});}else{return _0x3a9286;}})[_0x5478('0x4b')](function(_0x3a6f8c){logger[_0x5478('0x31')](_0x5478('0x58'),_0x3a6f8c);throw _0x3a6f8c;});}return _0x3a9286;});}})['then'](respondWithResult(_0x245c48,0xc9))[_0x5478('0x4b')](handleError(_0x245c48,null));};exports[_0x5478('0x59')]=function(_0x43cab2,_0x2ecb4d){if(_0x43cab2[_0x5478('0x55')]['id']){delete _0x43cab2[_0x5478('0x55')]['id'];}return db[_0x5478('0x43')][_0x5478('0x2d')]({'where':{'id':_0x43cab2[_0x5478('0x49')]['id']}})[_0x5478('0x22')](handleEntityNotFound(_0x2ecb4d,null))[_0x5478('0x22')](saveUpdates(_0x43cab2['body'],null))[_0x5478('0x22')](respondWithResult(_0x2ecb4d,null))['catch'](handleError(_0x2ecb4d,null));};exports[_0x5478('0x21')]=function(_0x1f7efb,_0x42688c){return db[_0x5478('0x43')][_0x5478('0x2d')]({'where':{'id':_0x1f7efb['params']['id']}})[_0x5478('0x22')](handleEntityNotFound(_0x42688c,null))['then'](removeEntity(_0x42688c,null))['catch'](handleError(_0x42688c,null));};exports[_0x5478('0x5a')]=function(_0x5682e1,_0x2c9f9f,_0x2c0734){var _0x38adc0={'raw':![],'where':{}};var _0x49aec2={};var _0x1e0bdd={'count':0x0,'rows':[]};return db[_0x5478('0x43')][_0x5478('0x5b')]({'where':{'id':_0x5682e1[_0x5478('0x49')]['id']}})['then'](handleEntityNotFound(_0x2c9f9f,null))[_0x5478('0x22')](function(_0x1fcbed){if(_0x1fcbed){_0x49aec2[_0x5478('0x36')]=_[_0x5478('0x38')](db[_0x5478('0x5c')]['rawAttributes']);_0x49aec2[_0x5478('0x37')]=_[_0x5478('0x38')](_0x5682e1[_0x5478('0x37')]);_0x49aec2[_0x5478('0x39')]=_[_0x5478('0x3a')](_0x49aec2[_0x5478('0x36')],_0x49aec2[_0x5478('0x37')]);_0x38adc0[_0x5478('0x3b')]=_[_0x5478('0x3a')](_0x49aec2[_0x5478('0x36')],qs[_0x5478('0x3c')](_0x5682e1[_0x5478('0x37')]['fields']));_0x38adc0[_0x5478('0x3b')]=_0x38adc0[_0x5478('0x3b')]['length']?_0x38adc0[_0x5478('0x3b')]:_0x49aec2[_0x5478('0x36')];if(!_0x5682e1[_0x5478('0x37')][_0x5478('0x5d')]('nolimit')){_0x38adc0[_0x5478('0x1c')]=qs[_0x5478('0x1c')](_0x5682e1[_0x5478('0x37')]['limit']);_0x38adc0[_0x5478('0x1b')]=qs[_0x5478('0x1b')](_0x5682e1['query']['offset']);}_0x38adc0[_0x5478('0x3d')]=qs['sort'](_0x5682e1['query'][_0x5478('0x3e')]);_0x38adc0[_0x5478('0x3f')]=qs['filters'](_[_0x5478('0x5e')](_0x5682e1[_0x5478('0x37')],_0x49aec2['filters']));_0x38adc0[_0x5478('0x3f')][_0x5478('0x5f')]=_0x1fcbed['id'];if(_0x5682e1[_0x5478('0x37')]['filter']){_0x38adc0[_0x5478('0x3f')]=_['merge'](_0x38adc0[_0x5478('0x3f')],{'$or':_[_0x5478('0x29')](_0x38adc0['attributes'],function(_0xd257b3){var _0x2d07ee={};_0x2d07ee[_0xd257b3]={'$like':'%'+_0x5682e1['query'][_0x5478('0x28')]+'%'};return _0x2d07ee;})});}_0x38adc0=_[_0x5478('0x40')]({},_0x38adc0,_0x5682e1[_0x5478('0x42')]);return db[_0x5478('0x5c')][_0x5478('0x1a')]({'where':_0x38adc0[_0x5478('0x3f')]})[_0x5478('0x22')](function(_0x29a317){_0x1e0bdd['count']=_0x29a317;if(_0x5682e1[_0x5478('0x37')][_0x5478('0x44')]){_0x38adc0[_0x5478('0x45')]=[{'all':!![]}];}return db[_0x5478('0x5c')][_0x5478('0x46')](_0x38adc0);})[_0x5478('0x22')](function(_0x16805a){_0x1e0bdd[_0x5478('0x47')]=_0x16805a;return _0x1e0bdd;});}})['then'](respondWithFilteredResult(_0x2c9f9f,_0x38adc0))[_0x5478('0x4b')](handleError(_0x2c9f9f,null));};exports['getHopperHistories']=function(_0x9c8f5c,_0x739d5f,_0xac944c){var _0x2b26eb={'raw':!![],'where':{}};var _0x43d1f3={};var _0x10860e={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x5478('0x5b')]({'where':{'id':_0x9c8f5c[_0x5478('0x49')]['id']}})[_0x5478('0x22')](handleEntityNotFound(_0x739d5f,null))['then'](function(_0x2aa42a){if(_0x2aa42a){_0x43d1f3[_0x5478('0x36')]=_[_0x5478('0x38')](db['CmHopperHistory'][_0x5478('0x4a')]);_0x43d1f3['query']=_[_0x5478('0x38')](_0x9c8f5c['query']);_0x43d1f3[_0x5478('0x39')]=_[_0x5478('0x3a')](_0x43d1f3[_0x5478('0x36')],_0x43d1f3[_0x5478('0x37')]);_0x2b26eb[_0x5478('0x3b')]=_['intersection'](_0x43d1f3[_0x5478('0x36')],qs['fields'](_0x9c8f5c[_0x5478('0x37')][_0x5478('0x3c')]));_0x2b26eb[_0x5478('0x3b')]=_0x2b26eb[_0x5478('0x3b')][_0x5478('0x60')]?_0x2b26eb['attributes']:_0x43d1f3[_0x5478('0x36')];if(!_0x9c8f5c[_0x5478('0x37')][_0x5478('0x5d')]('nolimit')){_0x2b26eb[_0x5478('0x1c')]=qs[_0x5478('0x1c')](_0x9c8f5c[_0x5478('0x37')][_0x5478('0x1c')]);_0x2b26eb[_0x5478('0x1b')]=qs[_0x5478('0x1b')](_0x9c8f5c['query'][_0x5478('0x1b')]);}_0x2b26eb[_0x5478('0x3d')]=qs[_0x5478('0x3e')](_0x9c8f5c['query']['sort']);_0x2b26eb['where']=qs[_0x5478('0x39')](_[_0x5478('0x5e')](_0x9c8f5c[_0x5478('0x37')],_0x43d1f3[_0x5478('0x39')]));_0x2b26eb[_0x5478('0x3f')][_0x5478('0x5f')]=_0x2aa42a['id'];if(_0x9c8f5c['query'][_0x5478('0x28')]){_0x2b26eb['where']=_[_0x5478('0x40')](_0x2b26eb[_0x5478('0x3f')],{'$or':_[_0x5478('0x29')](_0x2b26eb['attributes'],function(_0x404c83){var _0x5063fc={};_0x5063fc[_0x404c83]={'$like':'%'+_0x9c8f5c['query'][_0x5478('0x28')]+'%'};return _0x5063fc;})});}_0x2b26eb=_[_0x5478('0x40')]({},_0x2b26eb,_0x9c8f5c['options']);return db['CmHopperHistory'][_0x5478('0x1a')]({'where':_0x2b26eb[_0x5478('0x3f')]})[_0x5478('0x22')](function(_0x22b9a5){_0x10860e[_0x5478('0x1a')]=_0x22b9a5;if(_0x9c8f5c[_0x5478('0x37')][_0x5478('0x44')]){_0x2b26eb[_0x5478('0x45')]=[{'all':!![]}];}return db[_0x5478('0x61')][_0x5478('0x46')](_0x2b26eb);})['then'](function(_0x52ac02){_0x10860e['rows']=_0x52ac02;return _0x10860e;});}})[_0x5478('0x22')](respondWithFilteredResult(_0x739d5f,_0x2b26eb))[_0x5478('0x4b')](handleError(_0x739d5f,null));};exports[_0x5478('0x62')]=function(_0x1bf506,_0x49299d,_0x5adafa){var _0x3aa259={'raw':!![],'where':{}};var _0x377911={};var _0x28f70b={'count':0x0,'rows':[]};return db[_0x5478('0x43')][_0x5478('0x5b')]({'where':{'id':_0x1bf506[_0x5478('0x49')]['id']}})[_0x5478('0x22')](handleEntityNotFound(_0x49299d,null))[_0x5478('0x22')](function(_0x56a1bd){if(_0x56a1bd){_0x377911[_0x5478('0x36')]=_['keys'](db[_0x5478('0x63')][_0x5478('0x4a')]);_0x377911['query']=_[_0x5478('0x38')](_0x1bf506[_0x5478('0x37')]);_0x377911[_0x5478('0x39')]=_[_0x5478('0x3a')](_0x377911[_0x5478('0x36')],_0x377911[_0x5478('0x37')]);_0x3aa259[_0x5478('0x3b')]=_['intersection'](_0x377911[_0x5478('0x36')],qs[_0x5478('0x3c')](_0x1bf506[_0x5478('0x37')][_0x5478('0x3c')]));_0x3aa259[_0x5478('0x3b')]=_0x3aa259[_0x5478('0x3b')][_0x5478('0x60')]?_0x3aa259[_0x5478('0x3b')]:_0x377911[_0x5478('0x36')];if(!_0x1bf506[_0x5478('0x37')][_0x5478('0x5d')]('nolimit')){_0x3aa259[_0x5478('0x1c')]=qs[_0x5478('0x1c')](_0x1bf506[_0x5478('0x37')][_0x5478('0x1c')]);_0x3aa259[_0x5478('0x1b')]=qs['offset'](_0x1bf506[_0x5478('0x37')][_0x5478('0x1b')]);}_0x3aa259[_0x5478('0x3d')]=qs[_0x5478('0x3e')](_0x1bf506[_0x5478('0x37')][_0x5478('0x3e')]);_0x3aa259[_0x5478('0x3f')]=qs['filters'](_[_0x5478('0x5e')](_0x1bf506[_0x5478('0x37')],_0x377911['filters']));_0x3aa259['where'][_0x5478('0x5f')]=_0x56a1bd['id'];if(_0x1bf506[_0x5478('0x37')]['filter']){_0x3aa259['where']=_[_0x5478('0x40')](_0x3aa259['where'],{'$or':_[_0x5478('0x29')](_0x3aa259[_0x5478('0x3b')],function(_0x13e1d1){var _0x413c67={};_0x413c67[_0x13e1d1]={'$like':'%'+_0x1bf506['query'][_0x5478('0x28')]+'%'};return _0x413c67;})});}_0x3aa259=_[_0x5478('0x40')]({},_0x3aa259,_0x1bf506[_0x5478('0x42')]);return db['CmHopperFinal'][_0x5478('0x1a')]({'where':_0x3aa259[_0x5478('0x3f')]})['then'](function(_0x279f2d){_0x28f70b[_0x5478('0x1a')]=_0x279f2d;if(_0x1bf506[_0x5478('0x37')][_0x5478('0x44')]){_0x3aa259[_0x5478('0x45')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x5478('0x46')](_0x3aa259);})[_0x5478('0x22')](function(_0x219b39){_0x28f70b[_0x5478('0x47')]=_0x219b39;return _0x28f70b;});}})['then'](respondWithFilteredResult(_0x49299d,_0x3aa259))[_0x5478('0x4b')](handleError(_0x49299d,null));};exports[_0x5478('0x64')]=function(_0x4fd9bc,_0x4590e2,_0x5ee6c9){var _0x21e21e={'raw':!![],'where':{}};var _0x523424={};var _0x46ded4={'count':0x0,'rows':[]};return db[_0x5478('0x43')][_0x5478('0x5b')]({'where':{'id':_0x4fd9bc[_0x5478('0x49')]['id']}})[_0x5478('0x22')](handleEntityNotFound(_0x4590e2,null))[_0x5478('0x22')](function(_0x295426){if(_0x295426){_0x523424[_0x5478('0x36')]=_['keys'](db['CmHopperBlack'][_0x5478('0x4a')]);_0x523424[_0x5478('0x37')]=_['keys'](_0x4fd9bc[_0x5478('0x37')]);_0x523424['filters']=_[_0x5478('0x3a')](_0x523424[_0x5478('0x36')],_0x523424[_0x5478('0x37')]);_0x21e21e[_0x5478('0x3b')]=_['intersection'](_0x523424[_0x5478('0x36')],qs[_0x5478('0x3c')](_0x4fd9bc[_0x5478('0x37')][_0x5478('0x3c')]));_0x21e21e[_0x5478('0x3b')]=_0x21e21e[_0x5478('0x3b')]['length']?_0x21e21e[_0x5478('0x3b')]:_0x523424[_0x5478('0x36')];if(!_0x4fd9bc[_0x5478('0x37')][_0x5478('0x5d')]('nolimit')){_0x21e21e['limit']=qs[_0x5478('0x1c')](_0x4fd9bc[_0x5478('0x37')]['limit']);_0x21e21e[_0x5478('0x1b')]=qs[_0x5478('0x1b')](_0x4fd9bc[_0x5478('0x37')][_0x5478('0x1b')]);}_0x21e21e[_0x5478('0x3d')]=qs['sort'](_0x4fd9bc[_0x5478('0x37')][_0x5478('0x3e')]);_0x21e21e[_0x5478('0x3f')]=qs[_0x5478('0x39')](_['pick'](_0x4fd9bc[_0x5478('0x37')],_0x523424[_0x5478('0x39')]));_0x21e21e[_0x5478('0x3f')]['VoiceQueueId']=_0x295426['id'];if(_0x4fd9bc['query'][_0x5478('0x28')]){_0x21e21e[_0x5478('0x3f')]=_[_0x5478('0x40')](_0x21e21e['where'],{'$or':_[_0x5478('0x29')](_0x21e21e[_0x5478('0x3b')],function(_0x77db1f){var _0x5d1ab5={};_0x5d1ab5[_0x77db1f]={'$like':'%'+_0x4fd9bc['query'][_0x5478('0x28')]+'%'};return _0x5d1ab5;})});}_0x21e21e=_[_0x5478('0x40')]({},_0x21e21e,_0x4fd9bc[_0x5478('0x42')]);return db['CmHopperBlack']['count']({'where':_0x21e21e['where']})['then'](function(_0x25f5de){_0x46ded4[_0x5478('0x1a')]=_0x25f5de;if(_0x4fd9bc['query']['includeAll']){_0x21e21e['include']=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x21e21e);})['then'](function(_0x5dfc83){_0x46ded4['rows']=_0x5dfc83;return _0x46ded4;});}})[_0x5478('0x22')](respondWithFilteredResult(_0x4590e2,_0x21e21e))[_0x5478('0x4b')](handleError(_0x4590e2,null));};exports[_0x5478('0x65')]=function(_0x4c6657,_0x57ad41,_0x449506){var _0x2df76a={};var _0xa9fc27={};var _0x1a53c0;var _0x50b839;return db[_0x5478('0x43')][_0x5478('0x5b')]({'where':{'id':_0x4c6657['params']['id']}})[_0x5478('0x22')](handleEntityNotFound(_0x57ad41,null))[_0x5478('0x22')](function(_0x5b4971){if(_0x5b4971){_0x1a53c0=_0x5b4971;_0xa9fc27[_0x5478('0x36')]=_[_0x5478('0x38')](db[_0x5478('0x66')][_0x5478('0x4a')]);_0xa9fc27[_0x5478('0x37')]=_['keys'](_0x4c6657[_0x5478('0x37')]);_0xa9fc27[_0x5478('0x39')]=_[_0x5478('0x3a')](_0xa9fc27[_0x5478('0x36')],_0xa9fc27[_0x5478('0x37')]);_0x2df76a[_0x5478('0x3b')]=_[_0x5478('0x3a')](_0xa9fc27[_0x5478('0x36')],qs[_0x5478('0x3c')](_0x4c6657[_0x5478('0x37')][_0x5478('0x3c')]));_0x2df76a[_0x5478('0x3b')]=_0x2df76a['attributes'][_0x5478('0x60')]?_0x2df76a[_0x5478('0x3b')]:_0xa9fc27[_0x5478('0x36')];_0x2df76a[_0x5478('0x3d')]=qs[_0x5478('0x3e')](_0x4c6657[_0x5478('0x37')][_0x5478('0x3e')]);_0x2df76a['where']=qs['filters'](_[_0x5478('0x5e')](_0x4c6657[_0x5478('0x37')],_0xa9fc27['filters']));if(_0x4c6657[_0x5478('0x37')][_0x5478('0x28')]){_0x2df76a[_0x5478('0x3f')]=_[_0x5478('0x40')](_0x2df76a[_0x5478('0x3f')],{'$or':_[_0x5478('0x29')](_0x2df76a['attributes'],function(_0xd957b1){var _0x4ad10f={};_0x4ad10f[_0xd957b1]={'$like':'%'+_0x4c6657[_0x5478('0x37')][_0x5478('0x28')]+'%'};return _0x4ad10f;})});}_0x2df76a=_[_0x5478('0x40')]({},_0x2df76a,_0x4c6657[_0x5478('0x42')]);return _0x1a53c0[_0x5478('0x65')](_0x2df76a);}})[_0x5478('0x22')](function(_0x2fdee1){if(_0x2fdee1){_0x50b839=_0x2fdee1[_0x5478('0x60')];if(!_0x4c6657[_0x5478('0x37')][_0x5478('0x5d')](_0x5478('0x67'))){_0x2df76a[_0x5478('0x1c')]=qs[_0x5478('0x1c')](_0x4c6657[_0x5478('0x37')]['limit']);_0x2df76a[_0x5478('0x1b')]=qs[_0x5478('0x1b')](_0x4c6657[_0x5478('0x37')]['offset']);}return _0x1a53c0[_0x5478('0x65')](_0x2df76a);}})[_0x5478('0x22')](function(_0x28cfb5){if(_0x28cfb5){return _0x28cfb5?{'count':_0x50b839,'rows':_0x28cfb5}:null;}})['then'](respondWithResult(_0x57ad41,null))[_0x5478('0x4b')](handleError(_0x57ad41,null));};exports['addTeams']=function(_0x4c5971,_0x490cb8,_0x31fadf){var _0x8f0e3c=_0x4c5971['body'][_0x5478('0x68')];var _0x456c8e=_[_0x5478('0x29')](_0x8f0e3c,'id');return db[_0x5478('0x66')][_0x5478('0x46')]({'where':{'id':_0x456c8e},'attributes':['id'],'include':[{'model':db[_0x5478('0x69')],'as':_0x5478('0x6a'),'attributes':['id',_0x5478('0x2e'),_0x5478('0x6b'),_0x5478('0x6c'),_0x5478('0x6d')],'raw':!![]}]})['then'](function(_0x125968){if(_0x125968){var _0x5a3b3e=_[_0x5478('0x6e')](_0x125968,function(_0x1dd405){var _0x3ac4a7=_0x1dd405[_0x5478('0x23')]({'plain':!![]});_0x3ac4a7['Agents'][_0x5478('0x6f')](function(_0x1a68f5){_0x1a68f5[_0x5478('0x70')]=_['find'](_0x8f0e3c,{'id':_0x3ac4a7['id']})['penalty'];});return _0x3ac4a7['Agents'];});return db[_0x5478('0x43')][_0x5478('0x2d')]({'where':{'id':_0x4c5971[_0x5478('0x49')]['id']}})[_0x5478('0x22')](function(_0x4c3dbb){return db['sequelize']['transaction'](function(_0x1bf752){return _0x4c3dbb['addTeams'](_0x456c8e,{'transaction':_0x1bf752})['then'](function(){return BPromise[_0x5478('0x71')](_0x5a3b3e,function(_0x4414f0){return db[_0x5478('0x72')]['findOrCreate']({'where':{'UserId':_0x4414f0['id'],'VoiceQueueId':_0x4c5971[_0x5478('0x49')]['id']},'defaults':{'penalty':_0x4414f0[_0x5478('0x70')]},'transaction':_0x1bf752});});})[_0x5478('0x22')](function(){return BPromise[_0x5478('0x71')](_[_0x5478('0x28')](_0x5a3b3e,{'online':!![]}),function(_0x4eb715){return db[_0x5478('0x73')][_0x5478('0x74')]({'membername':_0x4eb715[_0x5478('0x2e')],'UserId':_0x4eb715['id'],'queue_name':_0x4c3dbb[_0x5478('0x2e')],'VoiceQueueId':_0x4c3dbb['id'],'interface':_[_0x5478('0x75')](_0x4eb715[_0x5478('0x6d')])?util['format'](_0x5478('0x76'),_0x4eb715[_0x5478('0x2e')]):_0x4eb715[_0x5478('0x6d')],'paused':_0x4eb715[_0x5478('0x6c')]||![],'penalty':_0x4eb715[_0x5478('0x70')]},{'transaction':_0x1bf752});});})[_0x5478('0x22')](function(){_0x5a3b3e[_0x5478('0x6f')](function(_0x10c3a5){socket['emit']('userVoiceQueue:save',{'UserId':_0x10c3a5['id'],'VoiceQueueId':_0x4c3dbb['id']});});});});});}})[_0x5478('0x22')](respondWithStatusCode(_0x490cb8,null))[_0x5478('0x4b')](handleError(_0x490cb8,null));};exports['removeTeams']=function(_0x34b3b8,_0x4586ab,_0x1d0a4b){return db['Team']['findAll']({'where':{'id':_0x34b3b8[_0x5478('0x37')][_0x5478('0x77')]},'attributes':['id'],'include':[{'model':db[_0x5478('0x69')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5478('0x22')](handleEntityNotFound(_0x4586ab,null))['then'](function(_0x32bbf5){var _0x5ee8d4=_['map'](_0x32bbf5,'id');var _0x19f7cc=[];var _0x5d53ed=[];var _0x15efdd=squel[_0x5478('0x78')]();_0x15efdd[_0x5478('0x79')](_0x5478('0x7a'))[_0x5478('0x7b')](_0x5478('0x7c'),'tq')[_0x5478('0x7d')](_0x5478('0x7e'),'ut',_0x5478('0x7f'))[_0x5478('0x3f')](_0x5478('0x80'),_0x34b3b8[_0x5478('0x49')]['id']);for(var _0x35c13d=0x0;_0x35c13d<_0x32bbf5[_0x5478('0x60')];_0x35c13d+=0x1){let _0x29a18e=_0x32bbf5[_0x35c13d];for(var _0x3083bb=0x0;_0x3083bb<_0x29a18e[_0x5478('0x6a')]['length'];_0x3083bb+=0x1){let _0x2ee320=_0x29a18e[_0x5478('0x6a')][_0x3083bb];var _0x25ec7c=_0x15efdd[_0x5478('0x52')]();_0x25ec7c[_0x5478('0x3f')](_0x5478('0x81'),_0x2ee320['id']);_0x5d53ed[_0x5478('0x82')](db[_0x5478('0x83')][_0x5478('0x37')](_0x25ec7c[_0x5478('0x84')](),{'type':db[_0x5478('0x83')][_0x5478('0x85')][_0x5478('0x86')]})[_0x5478('0x22')](function(_0x14bf12){if(_0x14bf12[_0x5478('0x60')]===0x1){return _0x2ee320['id'];}else{var _0x40ae8f=_[_0x5478('0x87')](_[_0x5478('0x29')](_0x14bf12,'TeamId'),function(_0x1786de){return _[_0x5478('0x2b')](_0x5ee8d4,_0x1786de);});if(_0x40ae8f){return _0x2ee320['id'];}}}));}}return BPromise[_0x5478('0x88')](_0x5d53ed)[_0x5478('0x22')](function(_0x1a13ea){_0x19f7cc=_(_0x19f7cc)['union'](_0x1a13ea)[_0x5478('0x89')]()[_0x5478('0x2a')]();return db[_0x5478('0x43')][_0x5478('0x2d')]({'where':{'id':_0x34b3b8['params']['id']}})[_0x5478('0x22')](function(_0x593695){return db[_0x5478('0x83')][_0x5478('0x8a')](function(_0x3d4288){return _0x593695[_0x5478('0x8b')](_0x34b3b8['query']['ids'],{'transaction':_0x3d4288})['then'](function(){if(!_[_0x5478('0x8c')](_0x19f7cc)){return _0x593695['removeAgents'](_0x19f7cc,{'transaction':_0x3d4288})['then'](function(){return db[_0x5478('0x73')][_0x5478('0x21')]({'where':{'VoiceQueueId':_0x34b3b8[_0x5478('0x49')]['id'],'UserId':_0x19f7cc},'transaction':_0x3d4288});});}})[_0x5478('0x22')](function(){_0x19f7cc[_0x5478('0x6f')](function(_0x24b234){socket[_0x5478('0x8d')](_0x5478('0x8e'),{'UserId':_0x24b234,'VoiceQueueId':_0x593695['id']});});});});});});})[_0x5478('0x22')](respondWithStatusCode(_0x4586ab,null))[_0x5478('0x4b')](handleError(_0x4586ab,null));};exports[_0x5478('0x8f')]=function(_0x402630,_0x1d6843,_0x269a63){var _0x5b4691,_0xd1f011;return db[_0x5478('0x43')][_0x5478('0x2d')]({'where':{'id':_0x402630[_0x5478('0x49')]['id']}})['then'](handleEntityNotFound(_0x1d6843,null))[_0x5478('0x22')](function(_0x48551c){if(_0x48551c){_0xd1f011=_0x48551c;return _0x48551c[_0x5478('0x8f')](_0x402630[_0x5478('0x55')][_0x5478('0x77')],_[_0x5478('0x53')](_0x402630['body'],[_0x5478('0x77'),'id'])||{})['spread'](function(_0x2d0d5a){for(var _0x15299a=0x0;_0x15299a<_0x402630['body'][_0x5478('0x77')][_0x5478('0x60')];_0x15299a+=0x1){socket[_0x5478('0x8d')](_0x5478('0x90'),{'UserId':_0x402630[_0x5478('0x55')][_0x5478('0x77')][_0x15299a],'VoiceQueueId':_0x402630['params']['id']});}return _0x2d0d5a;});}})['then'](function(_0x3c81db){_0x5b4691=_0x3c81db||[];if(_0xd1f011){return db[_0x5478('0x69')][_0x5478('0x46')]({'where':{'id':_0x402630['body']['ids']},'attributes':['id',_0x5478('0x2e'),_0x5478('0x6b'),_0x5478('0x6c'),'interface'],'raw':!![]});}})['then'](function(_0x3103f1){if(!_[_0x5478('0x8c')](_0x3103f1)){var _0x24e067=[];for(var _0x51d50f=0x0;_0x51d50f<_0x3103f1['length'];_0x51d50f++){if(_0x3103f1[_0x51d50f][_0x5478('0x6b')]){_0x24e067[_0x5478('0x82')](db[_0x5478('0x73')][_0x5478('0x74')]({'membername':_0x3103f1[_0x51d50f][_0x5478('0x2e')],'UserId':_0x3103f1[_0x51d50f]['id'],'queue_name':_0xd1f011[_0x5478('0x2e')],'VoiceQueueId':_0xd1f011['id'],'interface':_[_0x5478('0x75')](_0x3103f1[_0x51d50f][_0x5478('0x6d')])?util[_0x5478('0x91')]('SIP/%s',_0x3103f1[_0x51d50f][_0x5478('0x2e')]):_0x3103f1[_0x51d50f][_0x5478('0x6d')],'paused':_0x3103f1[_0x51d50f]['voicePause']||![],'penalty':_0x402630[_0x5478('0x55')][_0x5478('0x70')]||0x0}));}}return BPromise[_0x5478('0x88')](_0x24e067);}})[_0x5478('0x22')](function(){return _0x5b4691;})[_0x5478('0x22')](respondWithResult(_0x1d6843,null))[_0x5478('0x4b')](handleError(_0x1d6843,null));};exports['removeAgents']=function(_0xb47f3d,_0x4c0584,_0x41edf3){return db[_0x5478('0x43')][_0x5478('0x2d')]({'where':{'id':_0xb47f3d[_0x5478('0x49')]['id']}})['then'](handleEntityNotFound(_0x4c0584,null))['then'](function(_0x51fb5f){if(_0x51fb5f){return _0x51fb5f[_0x5478('0x92')](_0xb47f3d['query'][_0x5478('0x77')])[_0x5478('0x22')](function(){if(_['isArray'](_0xb47f3d[_0x5478('0x37')]['ids'])){for(var _0x51b5a0=0x0;_0x51b5a0<_0xb47f3d[_0x5478('0x37')][_0x5478('0x77')]['length'];_0x51b5a0+=0x1){socket['emit'](_0x5478('0x8e'),{'UserId':Number(_0xb47f3d[_0x5478('0x37')][_0x5478('0x77')][_0x51b5a0]),'VoiceQueueId':Number(_0xb47f3d[_0x5478('0x49')]['id'])});}}else{socket[_0x5478('0x8d')]('userVoiceQueue:remove',{'UserId':Number(_0xb47f3d[_0x5478('0x37')][_0x5478('0x77')]),'VoiceQueueId':Number(_0xb47f3d['params']['id'])});}});}})[_0x5478('0x22')](function(_0x438856){return db[_0x5478('0x73')][_0x5478('0x21')]({'where':{'VoiceQueueId':_0xb47f3d['params']['id'],'UserId':_0xb47f3d[_0x5478('0x37')]['ids']}})[_0x5478('0x22')](function(){return _0x438856;});})[_0x5478('0x22')](respondWithStatusCode(_0x4c0584,null))[_0x5478('0x4b')](handleError(_0x4c0584,null));};exports[_0x5478('0x93')]=function(_0x16cb8c,_0x6d0788,_0x27f035){var _0x19e749={};var _0x57d80c={};var _0x327a6b;var _0x9531aa;return db[_0x5478('0x43')][_0x5478('0x5b')]({'where':{'id':_0x16cb8c['params']['id']}})[_0x5478('0x22')](handleEntityNotFound(_0x6d0788,null))['then'](function(_0x553713){if(_0x553713){_0x327a6b=_0x553713;_0x57d80c[_0x5478('0x36')]=_[_0x5478('0x38')](db['User'][_0x5478('0x4a')]);_0x57d80c['query']=_[_0x5478('0x38')](_0x16cb8c[_0x5478('0x37')]);_0x57d80c['filters']=_[_0x5478('0x3a')](_0x57d80c[_0x5478('0x36')],_0x57d80c[_0x5478('0x37')]);_0x19e749[_0x5478('0x3b')]=_[_0x5478('0x3a')](_0x57d80c[_0x5478('0x36')],qs['fields'](_0x16cb8c[_0x5478('0x37')][_0x5478('0x3c')]));_0x19e749[_0x5478('0x3b')]=_0x19e749['attributes'][_0x5478('0x60')]?_0x19e749[_0x5478('0x3b')]:_0x57d80c[_0x5478('0x36')];_0x19e749['order']=qs[_0x5478('0x3e')](_0x16cb8c['query']['sort']);_0x19e749[_0x5478('0x3f')]=qs[_0x5478('0x39')](_[_0x5478('0x5e')](_0x16cb8c['query'],_0x57d80c[_0x5478('0x39')]));if(_0x16cb8c[_0x5478('0x37')][_0x5478('0x28')]){_0x19e749[_0x5478('0x3f')]=_['merge'](_0x19e749['where'],{'$or':_[_0x5478('0x29')](_0x19e749[_0x5478('0x3b')],function(_0x43aeb9){var _0x409edf={};_0x409edf[_0x43aeb9]={'$like':'%'+_0x16cb8c['query'][_0x5478('0x28')]+'%'};return _0x409edf;})});}_0x19e749=_[_0x5478('0x40')]({},_0x19e749,_0x16cb8c[_0x5478('0x42')]);return _0x327a6b[_0x5478('0x93')](_0x19e749);}})[_0x5478('0x22')](function(_0x40cb03){if(_0x40cb03){_0x9531aa=_0x40cb03[_0x5478('0x60')];if(!_0x16cb8c['query'][_0x5478('0x5d')](_0x5478('0x67'))){_0x19e749['limit']=qs[_0x5478('0x1c')](_0x16cb8c[_0x5478('0x37')][_0x5478('0x1c')]);_0x19e749[_0x5478('0x1b')]=qs['offset'](_0x16cb8c['query'][_0x5478('0x1b')]);}return _0x327a6b[_0x5478('0x93')](_0x19e749);}})[_0x5478('0x22')](function(_0xeae8c9){if(_0xeae8c9){return _0xeae8c9?{'count':_0x9531aa,'rows':_0xeae8c9}:null;}})[_0x5478('0x22')](respondWithResult(_0x6d0788,null))[_0x5478('0x4b')](handleError(_0x6d0788,null));};exports[_0x5478('0x94')]=function(_0x196afe,_0x22cd04,_0xb43053){var _0x51f8a9={};var _0x5a68b0={};var _0x372e5d;var _0x275107;return db['VoiceQueue'][_0x5478('0x5b')]({'where':{'id':_0x196afe['params']['id']}})[_0x5478('0x22')](handleEntityNotFound(_0x22cd04,null))[_0x5478('0x22')](function(_0x4c3fc5){if(_0x4c3fc5){_0x372e5d=_0x4c3fc5;_0x5a68b0[_0x5478('0x36')]=_[_0x5478('0x38')](db['UserVoiceQueueRt'][_0x5478('0x4a')]);_0x5a68b0[_0x5478('0x37')]=_[_0x5478('0x38')](_0x196afe[_0x5478('0x37')]);_0x5a68b0[_0x5478('0x39')]=_[_0x5478('0x3a')](_0x5a68b0[_0x5478('0x36')],_0x5a68b0[_0x5478('0x37')]);_0x51f8a9[_0x5478('0x3b')]=_['intersection'](_0x5a68b0[_0x5478('0x36')],qs[_0x5478('0x3c')](_0x196afe[_0x5478('0x37')][_0x5478('0x3c')]));_0x51f8a9[_0x5478('0x3b')]=_0x51f8a9[_0x5478('0x3b')][_0x5478('0x60')]?_0x51f8a9[_0x5478('0x3b')]:_0x5a68b0[_0x5478('0x36')];_0x51f8a9['order']=qs[_0x5478('0x3e')](_0x196afe[_0x5478('0x37')][_0x5478('0x3e')]);_0x51f8a9[_0x5478('0x3f')]=qs[_0x5478('0x39')](_[_0x5478('0x5e')](_0x196afe[_0x5478('0x37')],_0x5a68b0[_0x5478('0x39')]));if(_0x196afe['query'][_0x5478('0x28')]){_0x51f8a9[_0x5478('0x3f')]=_[_0x5478('0x40')](_0x51f8a9['where'],{'$or':_[_0x5478('0x29')](_0x51f8a9['attributes'],function(_0x4895de){var _0x155096={};_0x155096[_0x4895de]={'$like':'%'+_0x196afe[_0x5478('0x37')][_0x5478('0x28')]+'%'};return _0x155096;})});}_0x51f8a9=_[_0x5478('0x40')]({},_0x51f8a9,_0x196afe[_0x5478('0x42')]);return _0x372e5d[_0x5478('0x94')](_0x51f8a9);}})[_0x5478('0x22')](function(_0xffdd1f){if(_0xffdd1f){_0x275107=_0xffdd1f[_0x5478('0x60')];if(!_0x196afe[_0x5478('0x37')][_0x5478('0x5d')](_0x5478('0x67'))){_0x51f8a9[_0x5478('0x1c')]=qs[_0x5478('0x1c')](_0x196afe[_0x5478('0x37')][_0x5478('0x1c')]);_0x51f8a9[_0x5478('0x1b')]=qs[_0x5478('0x1b')](_0x196afe[_0x5478('0x37')][_0x5478('0x1b')]);}return _0x372e5d[_0x5478('0x94')](_0x51f8a9);}})[_0x5478('0x22')](function(_0x2f382a){return _0x2f382a?{'count':_0x275107,'rows':_0x2f382a}:null;})['then'](respondWithResult(_0x22cd04,null))[_0x5478('0x4b')](handleError(_0x22cd04,null));};exports[_0x5478('0x95')]=function(_0x22ff91,_0x4e27ab,_0x519733){var _0x150f37={};var _0x43284d={};var _0x2385f2;var _0x50d4b4;return db[_0x5478('0x43')][_0x5478('0x5b')]({'where':{'id':_0x22ff91[_0x5478('0x49')]['id']}})[_0x5478('0x22')](handleEntityNotFound(_0x4e27ab,null))[_0x5478('0x22')](function(_0xb4c1ed){if(_0xb4c1ed){_0x2385f2=_0xb4c1ed;_0x43284d['model']=_[_0x5478('0x38')](db[_0x5478('0x96')][_0x5478('0x4a')]);_0x43284d[_0x5478('0x37')]=_[_0x5478('0x38')](_0x22ff91['query']);_0x43284d['filters']=_[_0x5478('0x3a')](_0x43284d[_0x5478('0x36')],_0x43284d['query']);_0x150f37[_0x5478('0x3b')]=_[_0x5478('0x3a')](_0x43284d[_0x5478('0x36')],qs[_0x5478('0x3c')](_0x22ff91['query'][_0x5478('0x3c')]));_0x150f37[_0x5478('0x3b')]=_0x150f37['attributes'][_0x5478('0x60')]?_0x150f37[_0x5478('0x3b')]:_0x43284d['model'];_0x150f37[_0x5478('0x3d')]=qs[_0x5478('0x3e')](_0x22ff91[_0x5478('0x37')][_0x5478('0x3e')]);_0x150f37[_0x5478('0x3f')]=qs['filters'](_['pick'](_0x22ff91['query'],_0x43284d['filters']));if(_0x22ff91[_0x5478('0x37')][_0x5478('0x28')]){_0x150f37[_0x5478('0x3f')]=_[_0x5478('0x40')](_0x150f37['where'],{'$or':_[_0x5478('0x29')](_0x150f37['attributes'],function(_0x3a5e32){var _0x43cfa2={};_0x43cfa2[_0x3a5e32]={'$like':'%'+_0x22ff91[_0x5478('0x37')][_0x5478('0x28')]+'%'};return _0x43cfa2;})});}_0x150f37=_[_0x5478('0x40')]({},_0x150f37,_0x22ff91[_0x5478('0x42')]);return _0x2385f2[_0x5478('0x95')](_0x150f37);}})[_0x5478('0x22')](function(_0x116069){if(_0x116069){_0x50d4b4=_0x116069[_0x5478('0x60')];if(!_0x22ff91['query'][_0x5478('0x5d')](_0x5478('0x67'))){_0x150f37['limit']=qs[_0x5478('0x1c')](_0x22ff91['query']['limit']);_0x150f37[_0x5478('0x1b')]=qs[_0x5478('0x1b')](_0x22ff91[_0x5478('0x37')][_0x5478('0x1b')]);}return _0x2385f2[_0x5478('0x95')](_0x150f37);}})[_0x5478('0x22')](function(_0x490530){if(_0x490530){return _0x490530?{'count':_0x50d4b4,'rows':_0x490530}:null;}})[_0x5478('0x22')](respondWithResult(_0x4e27ab,null))['catch'](handleError(_0x4e27ab,null));};exports[_0x5478('0x97')]=function(_0x35ff21,_0x55f131,_0x26df83){var _0x2b7826,_0x5e5ebf;return db['VoiceQueue'][_0x5478('0x2d')]({'where':{'id':_0x35ff21[_0x5478('0x49')]['id']}})['then'](handleEntityNotFound(_0x55f131,null))[_0x5478('0x22')](function(_0xa0c5a8){if(_0xa0c5a8){_0x5e5ebf=_0xa0c5a8;return _0xa0c5a8[_0x5478('0x97')](_0x35ff21[_0x5478('0x55')]['ids'],_['omit'](_0x35ff21['body'],[_0x5478('0x77'),'id'])||{});}return null;})[_0x5478('0x98')](function(_0x21e072){var _0x515f38;_0x2b7826=_0x21e072||[];var _0xc7188a=[];if(_0x21e072){for(var _0x2a29d3=0x0;_0x2a29d3<_0x21e072[_0x5478('0x60')];_0x2a29d3+=0x1){var _0x406354=_0x21e072[_0x2a29d3][_0x5478('0x23')]({'plain':!![]});_0x5e5ebf['dialCheckDuplicateType']=_0x35ff21[_0x5478('0x55')][_0x5478('0x99')]?_0x35ff21['body'][_0x5478('0x99')]:_0x5e5ebf[_0x5478('0x99')];switch(_0x5e5ebf['dialCheckDuplicateType']){case'always':_0x515f38=squel[_0x5478('0x9a')]()[_0x5478('0x9b')](_0x5478('0x9c'))[_0x5478('0x9d')](['phone',_0x5478('0x9e'),'ContactId',_0x5478('0x9f'),_0x5478('0x5f'),_0x5478('0x56'),'updatedAt'],squel[_0x5478('0x78')]()[_0x5478('0x79')](_0x5478('0xa0'),_0x5478('0xa0'))[_0x5478('0x79')](_0x5478('0xa1'),_0x5478('0x9e'))[_0x5478('0x79')]('id','ContactId')['field'](_0x406354[_0x5478('0xa2')]['toString'](),_0x5478('0x9f'))[_0x5478('0x79')](_0x35ff21[_0x5478('0x49')]['id'][_0x5478('0x84')](),_0x5478('0x5f'))['field']('NOW()',_0x5478('0x56'))[_0x5478('0x79')]('NOW()','updatedAt')[_0x5478('0x7b')]('cm_contacts')[_0x5478('0x3f')](_0x5478('0xa3'))['where'](_0x5478('0xa4'),_0x406354['CmListId'][_0x5478('0x84')]())[_0x5478('0x3f')](_0x5478('0xa5'))[_0x5478('0x3f')](_0x5478('0xa6'),squel[_0x5478('0x78')]()[_0x5478('0x79')]('COALESCE(calleridnum,\x27\x27)')['from']('cm_hopper_final')[_0x5478('0x3f')]('VoiceQueueId\x20=\x20?',_0x35ff21[_0x5478('0x49')]['id'][_0x5478('0x84')]()))[_0x5478('0x3f')](_0x5478('0xa6'),squel[_0x5478('0x78')]()[_0x5478('0x79')](_0x5478('0xa7'))[_0x5478('0x7b')](_0x5478('0x9c'))[_0x5478('0x3f')](_0x5478('0x80'),_0x35ff21[_0x5478('0x49')]['id'][_0x5478('0x84')]())))[_0x5478('0x84')]();break;case _0x5478('0xa8'):_0x515f38=squel[_0x5478('0x9a')]()['into'](_0x5478('0x9c'))[_0x5478('0x9d')](['phone',_0x5478('0x9e'),_0x5478('0xa9'),_0x5478('0x9f'),'VoiceQueueId',_0x5478('0x56'),_0x5478('0x54')],squel[_0x5478('0x78')]()[_0x5478('0x79')]('phone',_0x5478('0xa0'))[_0x5478('0x79')](_0x5478('0xa1'),_0x5478('0x9e'))[_0x5478('0x79')]('id',_0x5478('0xa9'))[_0x5478('0x79')](_0x406354[_0x5478('0xa2')]['toString'](),'ListId')[_0x5478('0x79')](_0x35ff21[_0x5478('0x49')]['id'][_0x5478('0x84')](),_0x5478('0x5f'))[_0x5478('0x79')](_0x5478('0xa1'),'createdAt')['field']('NOW()',_0x5478('0x54'))[_0x5478('0x7b')](_0x5478('0xaa'))['where'](_0x5478('0xa3'))[_0x5478('0x3f')](_0x5478('0xa4'),_0x406354[_0x5478('0xa2')]['toString']())[_0x5478('0x3f')](_0x5478('0xa5'))[_0x5478('0x3f')](_0x5478('0xa6'),squel[_0x5478('0x78')]()[_0x5478('0x79')](_0x5478('0xa7'))[_0x5478('0x7b')](_0x5478('0x9c'))['where'](_0x5478('0x80'),_0x35ff21[_0x5478('0x49')]['id'][_0x5478('0x84')]())))[_0x5478('0x84')]();break;default:_0x515f38=squel[_0x5478('0x9a')]()['into']('cm_hopper')[_0x5478('0x9d')]([_0x5478('0xa0'),_0x5478('0x9e'),_0x5478('0xa9'),'ListId',_0x5478('0x5f'),_0x5478('0x56'),_0x5478('0x54')],squel[_0x5478('0x78')]()[_0x5478('0x79')](_0x5478('0xa0'),'phone')['field'](_0x5478('0xa1'),_0x5478('0x9e'))[_0x5478('0x79')]('id',_0x5478('0xa9'))['field'](_0x406354[_0x5478('0xa2')][_0x5478('0x84')](),_0x5478('0x9f'))['field'](_0x35ff21[_0x5478('0x49')]['id']['toString'](),_0x5478('0x5f'))['field'](_0x5478('0xa1'),'createdAt')[_0x5478('0x79')](_0x5478('0xa1'),_0x5478('0x54'))[_0x5478('0x7b')](_0x5478('0xaa'))[_0x5478('0x3f')](_0x5478('0xa3'))['where']('ListId\x20=\x20?',_0x406354[_0x5478('0xa2')][_0x5478('0x84')]())['where'](_0x5478('0xa5')))['toString']();}_0xc7188a[_0x5478('0x82')](db['sequelize'][_0x5478('0x37')](_0x515f38));}return BPromise[_0x5478('0x88')](_0xc7188a);}})[_0x5478('0x22')](function(){return _0x2b7826;})[_0x5478('0x22')](respondWithResult(_0x55f131,null))[_0x5478('0x4b')](handleError(_0x55f131,null));};exports[_0x5478('0xab')]=function(_0x34d33f,_0x8dd4a6,_0x38dba4){return db[_0x5478('0x43')][_0x5478('0x2d')]({'where':{'id':_0x34d33f['params']['id']}})[_0x5478('0x22')](handleEntityNotFound(_0x8dd4a6,null))[_0x5478('0x22')](function(_0x5bfcf7){if(_0x5bfcf7){return _0x5bfcf7[_0x5478('0xab')](_0x34d33f[_0x5478('0x37')][_0x5478('0x77')]);}})[_0x5478('0x22')](function(_0x120f44){if(_0x120f44){return db[_0x5478('0x5c')][_0x5478('0x21')]({'where':{'ListId':_0x34d33f['query'][_0x5478('0x77')],'VoiceQueueId':_0x34d33f[_0x5478('0x49')]['id']}})[_0x5478('0x22')](function(){return _0x120f44;});}})[_0x5478('0x22')](respondWithStatusCode(_0x8dd4a6,null))['catch'](handleError(_0x8dd4a6,null));};exports[_0x5478('0xac')]=function(_0x191eb9,_0xd7c1ee,_0x411111){var _0x3a8752={};var _0x548d6d={};var _0x3a538d;var _0xc13ab5;return db[_0x5478('0x43')][_0x5478('0x5b')]({'where':{'id':_0x191eb9[_0x5478('0x49')]['id']}})['then'](handleEntityNotFound(_0xd7c1ee,null))[_0x5478('0x22')](function(_0x4df932){if(_0x4df932){_0x3a538d=_0x4df932;_0x548d6d[_0x5478('0x36')]=_[_0x5478('0x38')](db[_0x5478('0x96')][_0x5478('0x4a')]);_0x548d6d['query']=_[_0x5478('0x38')](_0x191eb9[_0x5478('0x37')]);_0x548d6d[_0x5478('0x39')]=_[_0x5478('0x3a')](_0x548d6d['model'],_0x548d6d[_0x5478('0x37')]);_0x3a8752[_0x5478('0x3b')]=_['intersection'](_0x548d6d[_0x5478('0x36')],qs['fields'](_0x191eb9['query'][_0x5478('0x3c')]));_0x3a8752[_0x5478('0x3b')]=_0x3a8752[_0x5478('0x3b')]['length']?_0x3a8752['attributes']:_0x548d6d['model'];_0x3a8752['order']=qs[_0x5478('0x3e')](_0x191eb9[_0x5478('0x37')][_0x5478('0x3e')]);_0x3a8752['where']=qs['filters'](_['pick'](_0x191eb9['query'],_0x548d6d[_0x5478('0x39')]));if(_0x191eb9[_0x5478('0x37')][_0x5478('0x28')]){_0x3a8752[_0x5478('0x3f')]=_[_0x5478('0x40')](_0x3a8752[_0x5478('0x3f')],{'$or':_[_0x5478('0x29')](_0x3a8752[_0x5478('0x3b')],function(_0x1470ff){var _0x1acbcf={};_0x1acbcf[_0x1470ff]={'$like':'%'+_0x191eb9[_0x5478('0x37')][_0x5478('0x28')]+'%'};return _0x1acbcf;})});}_0x3a8752=_[_0x5478('0x40')]({},_0x3a8752,_0x191eb9[_0x5478('0x42')]);return _0x3a538d[_0x5478('0xac')](_0x3a8752);}})[_0x5478('0x22')](function(_0x5db5b2){if(_0x5db5b2){_0xc13ab5=_0x5db5b2[_0x5478('0x60')];if(!_0x191eb9[_0x5478('0x37')][_0x5478('0x5d')](_0x5478('0x67'))){_0x3a8752['limit']=qs[_0x5478('0x1c')](_0x191eb9[_0x5478('0x37')][_0x5478('0x1c')]);_0x3a8752[_0x5478('0x1b')]=qs[_0x5478('0x1b')](_0x191eb9[_0x5478('0x37')]['offset']);}return _0x3a538d['getBlackLists'](_0x3a8752);}})['then'](function(_0x1b2d5e){if(_0x1b2d5e){return _0x1b2d5e?{'count':_0xc13ab5,'rows':_0x1b2d5e}:null;}})[_0x5478('0x22')](respondWithResult(_0xd7c1ee,null))[_0x5478('0x4b')](handleError(_0xd7c1ee,null));};exports['addBlackLists']=function(_0x267ead,_0x26d156,_0x5a23ee){var _0x5937f7,_0x350810;return db[_0x5478('0x43')][_0x5478('0x2d')]({'where':{'id':_0x267ead[_0x5478('0x49')]['id']}})[_0x5478('0x22')](handleEntityNotFound(_0x26d156,null))[_0x5478('0x22')](function(_0x290009){if(_0x290009){_0x350810=_0x290009;return _0x290009['addBlackLists'](_0x267ead[_0x5478('0x55')][_0x5478('0x77')],_[_0x5478('0x53')](_0x267ead[_0x5478('0x55')],['ids','id'])||{});}return null;})[_0x5478('0x98')](function(_0x593d0e){var _0x3e8484;_0x5937f7=_0x593d0e||[];var _0x2a0c2d=[];if(_0x593d0e){for(var _0x20699d=0x0;_0x20699d<_0x593d0e[_0x5478('0x60')];_0x20699d+=0x1){var _0x202fef=_0x593d0e[_0x20699d][_0x5478('0x23')]({'plain':!![]});_0x3e8484=squel[_0x5478('0x9a')]()[_0x5478('0x9b')](_0x5478('0xad'))[_0x5478('0x9d')]([_0x5478('0xa0'),_0x5478('0xa9'),_0x5478('0x9f'),_0x5478('0x5f'),'createdAt',_0x5478('0x54')],squel[_0x5478('0x78')]()[_0x5478('0x79')](_0x5478('0xa0'),_0x5478('0xa0'))[_0x5478('0x79')]('id','ContactId')[_0x5478('0x79')](_0x202fef[_0x5478('0xa2')][_0x5478('0x84')](),_0x5478('0x9f'))[_0x5478('0x79')](_0x267ead[_0x5478('0x49')]['id'][_0x5478('0x84')](),_0x5478('0x5f'))['field'](_0x5478('0xa1'),'createdAt')['field'](_0x5478('0xa1'),'updatedAt')[_0x5478('0x7b')](_0x5478('0xaa'))[_0x5478('0x3f')]('deletedAt\x20IS\x20NULL')['where'](_0x5478('0xa4'),_0x202fef[_0x5478('0xa2')][_0x5478('0x84')]())[_0x5478('0x3f')](_0x5478('0xa5')))[_0x5478('0x84')]();_0x2a0c2d[_0x5478('0x82')](db[_0x5478('0x83')][_0x5478('0x37')](_0x3e8484));}return BPromise[_0x5478('0x88')](_0x2a0c2d);}})[_0x5478('0x22')](function(){return _0x5937f7;})[_0x5478('0x22')](respondWithResult(_0x26d156,null))[_0x5478('0x4b')](handleError(_0x26d156,null));};exports[_0x5478('0xae')]=function(_0x135dc2,_0x2c0f64,_0x55acbf){return db[_0x5478('0x43')][_0x5478('0x2d')]({'where':{'id':_0x135dc2[_0x5478('0x49')]['id']}})[_0x5478('0x22')](handleEntityNotFound(_0x2c0f64,null))[_0x5478('0x22')](function(_0x13e385){if(_0x13e385){return _0x13e385[_0x5478('0xae')](_0x135dc2[_0x5478('0x37')][_0x5478('0x77')]);}})[_0x5478('0x22')](function(_0x2e5769){if(_0x2e5769){return db[_0x5478('0xaf')][_0x5478('0x21')]({'where':{'ListId':_0x135dc2[_0x5478('0x37')]['ids'],'VoiceQueueId':_0x135dc2[_0x5478('0x49')]['id']}})[_0x5478('0x22')](function(){return _0x2e5769;});}})[_0x5478('0x22')](respondWithStatusCode(_0x2c0f64,null))[_0x5478('0x4b')](handleError(_0x2c0f64,null));}; \ No newline at end of file +var _0x6ede=['squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','includes','type','name','UserProfileResource','sendStatus','error','stack','send','index','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','where','pick','filter','options','includeAll','findAll','catch','show','params','include','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','find','getHoppers','findOne','CmHopper','hasOwnProperty','sort','VoiceQueueId','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','online','voicePause','interface','flatMap','penalty','sequelize','transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','User','select','field','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','all','union','isEmpty','removeAgents','forEach','userVoiceQueue:remove','addAgents','spread','push','upsert','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','ListId\x20=\x20?','VoiceQueueId\x20=\x20?','removeLists','getBlackLists','addBlackLists','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox'];(function(_0x6d0a05,_0x545cd2){var _0x17fec8=function(_0x95f7e9){while(--_0x95f7e9){_0x6d0a05['push'](_0x6d0a05['shift']());}};_0x17fec8(++_0x545cd2);}(_0x6ede,0xac));var _0xe6ed=function(_0xcf0d77,_0x2195aa){_0xcf0d77=_0xcf0d77-0x0;var _0x13b05f=_0x6ede[_0xcf0d77];return _0x13b05f;};'use strict';var pdf=require(_0xe6ed('0x0'));var emlformat=require(_0xe6ed('0x1'));var rimraf=require(_0xe6ed('0x2'));var zipdir=require(_0xe6ed('0x3'));var jsonpatch=require(_0xe6ed('0x4'));var rp=require(_0xe6ed('0x5'));var moment=require('moment');var BPromise=require(_0xe6ed('0x6'));var Mustache=require(_0xe6ed('0x7'));var util=require('util');var path=require('path');var sox=require(_0xe6ed('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xe6ed('0x9'));var crypto=require(_0xe6ed('0xa'));var jsforce=require(_0xe6ed('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe6ed('0xc'));var Papa=require(_0xe6ed('0xd'));var Redis=require('ioredis');var authService=require(_0xe6ed('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xe6ed('0xf'));var hardwareService=require(_0xe6ed('0x10'));var logger=require(_0xe6ed('0x11'))(_0xe6ed('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xe6ed('0x13'))['db'];config['redis']=_['defaults'](config[_0xe6ed('0x14')],{'host':_0xe6ed('0x15'),'port':0x18eb});var socket=require(_0xe6ed('0x16'))(new Redis(config[_0xe6ed('0x14')]));require(_0xe6ed('0x17'))[_0xe6ed('0x18')](socket);function respondWithStatusCode(_0x3783f6,_0x3bdd19){_0x3bdd19=_0x3bdd19||0xcc;return function(_0x499ea2){if(_0x499ea2){return _0x3783f6['sendStatus'](_0x3bdd19);}return _0x3783f6[_0xe6ed('0x19')](_0x3bdd19)[_0xe6ed('0x1a')]();};}function respondWithResult(_0x5c0ca2,_0x1a8d9c){_0x1a8d9c=_0x1a8d9c||0xc8;return function(_0x52a1a3){if(_0x52a1a3){return _0x5c0ca2[_0xe6ed('0x19')](_0x1a8d9c)[_0xe6ed('0x1b')](_0x52a1a3);}};}function respondWithFilteredResult(_0x3b2bbd,_0x160335){return function(_0x212e46){if(_0x212e46){var _0x5962ef=_0x212e46[_0xe6ed('0x1c')],_0x1a037b=_0x160335[_0xe6ed('0x1d')],_0x2da725=_0x160335['offset']+_0x160335[_0xe6ed('0x1e')],_0x554895;if(_0x2da725>=_0x5962ef){_0x2da725=_0x5962ef;_0x554895=0xc8;}else{_0x554895=0xce;}_0x3b2bbd['status'](_0x554895);return _0x3b2bbd[_0xe6ed('0x1f')](_0xe6ed('0x20'),_0x1a037b+'-'+_0x2da725+'/'+_0x5962ef)['json'](_0x212e46);}return null;};}function patchUpdates(_0x56f83c){return function(_0x29a66f){try{jsonpatch[_0xe6ed('0x21')](_0x29a66f,_0x56f83c,!![]);}catch(_0x346096){return BPromise['reject'](_0x346096);}return _0x29a66f[_0xe6ed('0x22')]();};}function saveUpdates(_0x3deb06,_0x833d43){return function(_0x288fd4){if(_0x288fd4){return _0x288fd4['update'](_0x3deb06)[_0xe6ed('0x23')](function(_0x4d1068){return _0x4d1068;});}return null;};}function removeEntity(_0x2ad4e5,_0x2277dc){return function(_0x10c73d){if(_0x10c73d){return _0x10c73d[_0xe6ed('0x24')]()['then'](function(){var _0x39fb58=_0x10c73d[_0xe6ed('0x25')]({'plain':!![]});var _0x25ba84=[{'name':_0xe6ed('0x26'),'value':_0xe6ed('0x27'),'ignore':![]},{'name':_0xe6ed('0x28'),'value':_0xe6ed('0x29'),'ignore':![]}];var _0x40da28=_(_0x25ba84)['filter'](_0xe6ed('0x2a'))[_0xe6ed('0x2b')](_0xe6ed('0x2c'))[_0xe6ed('0x2c')]();if(_[_0xe6ed('0x2d')](_0x40da28,_0x39fb58[_0xe6ed('0x2e')])){return;}var _0x18bbb1=_['find'](_0x25ba84,[_0xe6ed('0x2c'),_0x39fb58[_0xe6ed('0x2e')]])[_0xe6ed('0x2f')];return db[_0xe6ed('0x30')][_0xe6ed('0x24')]({'where':{'type':_0x18bbb1,'resourceId':_0x39fb58['id']}})['then'](function(){return _0x10c73d;});})[_0xe6ed('0x23')](function(){_0x2ad4e5[_0xe6ed('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ad400,_0x32b6d2){return function(_0x34f15d){if(!_0x34f15d){_0x4ad400[_0xe6ed('0x31')](0x194);}return _0x34f15d;};}function handleError(_0x710af4,_0x593921){_0x593921=_0x593921||0x1f4;return function(_0x449f0c){logger[_0xe6ed('0x32')](_0x449f0c[_0xe6ed('0x33')]);if(_0x449f0c[_0xe6ed('0x2f')]){delete _0x449f0c[_0xe6ed('0x2f')];}_0x710af4[_0xe6ed('0x19')](_0x593921)[_0xe6ed('0x34')](_0x449f0c);};}exports[_0xe6ed('0x35')]=function(_0x34f12c,_0x265b2e){var _0x139606={},_0x16d1c5={},_0x2d8c={'count':0x0,'rows':[]};var _0x14d20f=_['map'](db[_0xe6ed('0x36')][_0xe6ed('0x37')],function(_0x574c06){return{'name':_0x574c06[_0xe6ed('0x38')],'type':_0x574c06[_0xe6ed('0x2e')][_0xe6ed('0x39')]};});_0x16d1c5[_0xe6ed('0x3a')]=_[_0xe6ed('0x2b')](_0x14d20f,_0xe6ed('0x2f'));_0x16d1c5[_0xe6ed('0x3b')]=_[_0xe6ed('0x3c')](_0x34f12c[_0xe6ed('0x3b')]);_0x16d1c5[_0xe6ed('0x3d')]=_['intersection'](_0x16d1c5[_0xe6ed('0x3a')],_0x16d1c5[_0xe6ed('0x3b')]);_0x139606[_0xe6ed('0x3e')]=_[_0xe6ed('0x3f')](_0x16d1c5[_0xe6ed('0x3a')],qs['fields'](_0x34f12c[_0xe6ed('0x3b')][_0xe6ed('0x40')]));_0x139606[_0xe6ed('0x3e')]=_0x139606[_0xe6ed('0x3e')][_0xe6ed('0x41')]?_0x139606[_0xe6ed('0x3e')]:_0x16d1c5[_0xe6ed('0x3a')];if(!_0x34f12c[_0xe6ed('0x3b')]['hasOwnProperty'](_0xe6ed('0x42'))){_0x139606[_0xe6ed('0x1e')]=qs['limit'](_0x34f12c['query'][_0xe6ed('0x1e')]);_0x139606['offset']=qs[_0xe6ed('0x1d')](_0x34f12c[_0xe6ed('0x3b')][_0xe6ed('0x1d')]);}_0x139606[_0xe6ed('0x43')]=qs['sort'](_0x34f12c[_0xe6ed('0x3b')]['sort']);_0x139606[_0xe6ed('0x44')]=qs[_0xe6ed('0x3d')](_[_0xe6ed('0x45')](_0x34f12c[_0xe6ed('0x3b')],_0x16d1c5[_0xe6ed('0x3d')]),_0x14d20f);if(_0x34f12c['query']['filter']){_0x139606['where']=_['merge'](_0x139606[_0xe6ed('0x44')],{'$or':_['map'](_0x14d20f,function(_0x3747cf){if(_0x3747cf[_0xe6ed('0x2e')]!=='VIRTUAL'){var _0x443913={};_0x443913[_0x3747cf[_0xe6ed('0x2f')]]={'$like':'%'+_0x34f12c[_0xe6ed('0x3b')][_0xe6ed('0x46')]+'%'};return _0x443913;}})});}_0x139606=_['merge']({},_0x139606,_0x34f12c[_0xe6ed('0x47')]);var _0x1165fc={'where':_0x139606[_0xe6ed('0x44')]};return db[_0xe6ed('0x36')][_0xe6ed('0x1c')](_0x1165fc)[_0xe6ed('0x23')](function(_0x64eb9c){_0x2d8c['count']=_0x64eb9c;if(_0x34f12c[_0xe6ed('0x3b')][_0xe6ed('0x48')]){_0x139606['include']=[{'all':!![]}];}return db[_0xe6ed('0x36')][_0xe6ed('0x49')](_0x139606);})[_0xe6ed('0x23')](function(_0x481bd4){_0x2d8c['rows']=_0x481bd4;return _0x2d8c;})[_0xe6ed('0x23')](respondWithFilteredResult(_0x265b2e,_0x139606))[_0xe6ed('0x4a')](handleError(_0x265b2e,null));};exports[_0xe6ed('0x4b')]=function(_0x51bf48,_0x465117){var _0x54c52a={'raw':![],'where':{'id':_0x51bf48[_0xe6ed('0x4c')]['id']}},_0x148a0f={};_0x148a0f[_0xe6ed('0x3a')]=_['keys'](db['VoiceQueue'][_0xe6ed('0x37')]);_0x148a0f['query']=_['keys'](_0x51bf48[_0xe6ed('0x3b')]);_0x148a0f[_0xe6ed('0x3d')]=_[_0xe6ed('0x3f')](_0x148a0f['model'],_0x148a0f[_0xe6ed('0x3b')]);_0x54c52a[_0xe6ed('0x3e')]=_[_0xe6ed('0x3f')](_0x148a0f[_0xe6ed('0x3a')],qs['fields'](_0x51bf48['query'][_0xe6ed('0x40')]));_0x54c52a[_0xe6ed('0x3e')]=_0x54c52a[_0xe6ed('0x3e')][_0xe6ed('0x41')]?_0x54c52a[_0xe6ed('0x3e')]:_0x148a0f['model'];if(_0x51bf48[_0xe6ed('0x3b')][_0xe6ed('0x48')]){_0x54c52a[_0xe6ed('0x4d')]=[{'all':!![]}];}_0x54c52a=_[_0xe6ed('0x4e')]({},_0x54c52a,_0x51bf48[_0xe6ed('0x47')]);return db[_0xe6ed('0x36')]['find'](_0x54c52a)[_0xe6ed('0x23')](handleEntityNotFound(_0x465117,null))['then'](respondWithResult(_0x465117,null))[_0xe6ed('0x4a')](handleError(_0x465117,null));};exports[_0xe6ed('0x4f')]=function(_0x328e4a,_0x2996cd){return db[_0xe6ed('0x36')][_0xe6ed('0x4f')](_0x328e4a[_0xe6ed('0x50')],{})[_0xe6ed('0x23')](function(_0x36ef47){var _0x14d91e=_0x328e4a[_0xe6ed('0x51')][_0xe6ed('0x25')]({'plain':!![]});if(!_0x14d91e)throw new Error(_0xe6ed('0x52'));if(_0x14d91e[_0xe6ed('0x53')]===_0xe6ed('0x51')){var _0x179105=_0x36ef47['get']({'plain':!![]});var _0x11f4ac=[{'name':_0xe6ed('0x26'),'value':_0xe6ed('0x27')},{'name':_0xe6ed('0x28'),'value':_0xe6ed('0x29')}];var _0x81abee=_['find'](_0x11f4ac,[_0xe6ed('0x2c'),_0x179105[_0xe6ed('0x2e')]])[_0xe6ed('0x2f')];return db[_0xe6ed('0x54')]['find']({'where':{'name':_0x81abee,'userProfileId':_0x14d91e[_0xe6ed('0x55')]},'raw':!![]})[_0xe6ed('0x23')](function(_0xcec87c){if(_0xcec87c&&_0xcec87c[_0xe6ed('0x56')]===0x0){return db['UserProfileResource'][_0xe6ed('0x4f')]({'name':_0x179105[_0xe6ed('0x2f')],'resourceId':_0x179105['id'],'type':_0xcec87c[_0xe6ed('0x2f')],'sectionId':_0xcec87c['id']},{})['then'](function(){return _0x36ef47;});}else{return _0x36ef47;}})[_0xe6ed('0x4a')](function(_0x39008d){logger[_0xe6ed('0x32')](_0xe6ed('0x57'),_0x39008d);throw _0x39008d;});}return _0x36ef47;})[_0xe6ed('0x23')](respondWithResult(_0x2996cd,0xc9))[_0xe6ed('0x4a')](handleError(_0x2996cd,null));};exports[_0xe6ed('0x58')]=function(_0x2c37e6,_0x14abef){var _0x51a8f2={'where':{'id':_0x2c37e6[_0xe6ed('0x4c')]['id']}},_0x371ae4={};_0x371ae4[_0xe6ed('0x3a')]=_[_0xe6ed('0x3c')](db['VoiceQueue'][_0xe6ed('0x37')]);_0x51a8f2['attributes']=_['intersection'](_0x371ae4[_0xe6ed('0x3a')],qs[_0xe6ed('0x40')](_0x2c37e6['query'][_0xe6ed('0x40')]));_0x51a8f2[_0xe6ed('0x3e')]=_0x51a8f2['attributes'][_0xe6ed('0x41')]?_0x51a8f2[_0xe6ed('0x3e')]:_0x371ae4[_0xe6ed('0x3a')];if(_0x2c37e6['query'][_0xe6ed('0x48')]){_0x51a8f2[_0xe6ed('0x4d')]=[{'all':!![]}];}_0x51a8f2=_[_0xe6ed('0x4e')]({},_0x51a8f2,_0x2c37e6[_0xe6ed('0x47')]);return db[_0xe6ed('0x36')]['find'](_0x51a8f2)[_0xe6ed('0x23')](handleEntityNotFound(_0x14abef,null))['then'](function(_0x5c03c0){if(_0x5c03c0){var _0x49618a=_0x5c03c0['get']({'plain':!![]});_0x49618a=qs[_0xe6ed('0x59')](_0x49618a,['id',_0xe6ed('0x5a'),'updatedAt']);_0x2c37e6[_0xe6ed('0x50')]=_[_0xe6ed('0x59')](_0x2c37e6[_0xe6ed('0x50')],['id',_0xe6ed('0x5a'),_0xe6ed('0x5b')]);return db['VoiceQueue'][_0xe6ed('0x4f')](_['merge'](_0x49618a,_0x2c37e6[_0xe6ed('0x50')]),{'include':_0x2c37e6[_0xe6ed('0x3b')][_0xe6ed('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x2aa4da){var _0x441f4a=_0x2c37e6[_0xe6ed('0x51')][_0xe6ed('0x25')]({'plain':!![]});if(!_0x441f4a)throw new Error(_0xe6ed('0x52'));if(_0x441f4a['role']===_0xe6ed('0x51')){var _0x1f6452=_0x2aa4da['get']({'plain':!![]});var _0x4ac53a=[{'name':_0xe6ed('0x26'),'value':_0xe6ed('0x27')},{'name':_0xe6ed('0x28'),'value':_0xe6ed('0x29')}];var _0x3e20c3=_[_0xe6ed('0x5c')](_0x4ac53a,[_0xe6ed('0x2c'),_0x1f6452[_0xe6ed('0x2e')]])['name'];return db[_0xe6ed('0x54')][_0xe6ed('0x5c')]({'where':{'name':_0x3e20c3,'userProfileId':_0x441f4a['userProfileId']},'raw':!![]})['then'](function(_0x518ada){if(_0x518ada&&_0x518ada[_0xe6ed('0x56')]===0x0){return db[_0xe6ed('0x30')]['create']({'name':_0x1f6452[_0xe6ed('0x2f')],'resourceId':_0x1f6452['id'],'type':_0x518ada[_0xe6ed('0x2f')],'sectionId':_0x518ada['id']},{})[_0xe6ed('0x23')](function(){return _0x2aa4da;});}else{return _0x2aa4da;}})[_0xe6ed('0x4a')](function(_0x5d8875){logger['error'](_0xe6ed('0x57'),_0x5d8875);throw _0x5d8875;});}return _0x2aa4da;});}})[_0xe6ed('0x23')](respondWithResult(_0x14abef,0xc9))[_0xe6ed('0x4a')](handleError(_0x14abef,null));};exports['update']=function(_0x3d6692,_0x3d42b0){if(_0x3d6692[_0xe6ed('0x50')]['id']){delete _0x3d6692['body']['id'];}return db[_0xe6ed('0x36')][_0xe6ed('0x5c')]({'where':{'id':_0x3d6692[_0xe6ed('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3d42b0,null))[_0xe6ed('0x23')](saveUpdates(_0x3d6692[_0xe6ed('0x50')],null))[_0xe6ed('0x23')](respondWithResult(_0x3d42b0,null))[_0xe6ed('0x4a')](handleError(_0x3d42b0,null));};exports[_0xe6ed('0x24')]=function(_0x2d7b83,_0x264221){return db['VoiceQueue'][_0xe6ed('0x5c')]({'where':{'id':_0x2d7b83['params']['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x264221,null))[_0xe6ed('0x23')](removeEntity(_0x264221,null))['catch'](handleError(_0x264221,null));};exports[_0xe6ed('0x5d')]=function(_0x33f88a,_0x3eb65e,_0x1d94d0){var _0x3c6f70={'raw':![],'where':{}};var _0x2ffdf4={};var _0x19701f={'count':0x0,'rows':[]};return db[_0xe6ed('0x36')][_0xe6ed('0x5e')]({'where':{'id':_0x33f88a[_0xe6ed('0x4c')]['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x3eb65e,null))[_0xe6ed('0x23')](function(_0x560519){if(_0x560519){_0x2ffdf4['model']=_[_0xe6ed('0x3c')](db[_0xe6ed('0x5f')][_0xe6ed('0x37')]);_0x2ffdf4['query']=_[_0xe6ed('0x3c')](_0x33f88a['query']);_0x2ffdf4[_0xe6ed('0x3d')]=_[_0xe6ed('0x3f')](_0x2ffdf4[_0xe6ed('0x3a')],_0x2ffdf4['query']);_0x3c6f70[_0xe6ed('0x3e')]=_[_0xe6ed('0x3f')](_0x2ffdf4[_0xe6ed('0x3a')],qs[_0xe6ed('0x40')](_0x33f88a[_0xe6ed('0x3b')][_0xe6ed('0x40')]));_0x3c6f70[_0xe6ed('0x3e')]=_0x3c6f70[_0xe6ed('0x3e')][_0xe6ed('0x41')]?_0x3c6f70[_0xe6ed('0x3e')]:_0x2ffdf4[_0xe6ed('0x3a')];if(!_0x33f88a[_0xe6ed('0x3b')][_0xe6ed('0x60')]('nolimit')){_0x3c6f70['limit']=qs['limit'](_0x33f88a[_0xe6ed('0x3b')]['limit']);_0x3c6f70['offset']=qs['offset'](_0x33f88a['query'][_0xe6ed('0x1d')]);}_0x3c6f70[_0xe6ed('0x43')]=qs['sort'](_0x33f88a['query'][_0xe6ed('0x61')]);_0x3c6f70[_0xe6ed('0x44')]=qs[_0xe6ed('0x3d')](_['pick'](_0x33f88a[_0xe6ed('0x3b')],_0x2ffdf4[_0xe6ed('0x3d')]));_0x3c6f70[_0xe6ed('0x44')][_0xe6ed('0x62')]=_0x560519['id'];if(_0x33f88a[_0xe6ed('0x3b')][_0xe6ed('0x46')]){_0x3c6f70[_0xe6ed('0x44')]=_[_0xe6ed('0x4e')](_0x3c6f70[_0xe6ed('0x44')],{'$or':_[_0xe6ed('0x2b')](_0x3c6f70['attributes'],function(_0x56e562){var _0x203c24={};_0x203c24[_0x56e562]={'$like':'%'+_0x33f88a[_0xe6ed('0x3b')]['filter']+'%'};return _0x203c24;})});}_0x3c6f70=_['merge']({},_0x3c6f70,_0x33f88a['options']);return db[_0xe6ed('0x5f')][_0xe6ed('0x1c')]({'where':_0x3c6f70[_0xe6ed('0x44')]})['then'](function(_0x345265){_0x19701f['count']=_0x345265;if(_0x33f88a[_0xe6ed('0x3b')][_0xe6ed('0x48')]){_0x3c6f70[_0xe6ed('0x4d')]=[{'all':!![]}];}return db[_0xe6ed('0x5f')][_0xe6ed('0x49')](_0x3c6f70);})[_0xe6ed('0x23')](function(_0x461e22){_0x19701f['rows']=_0x461e22;return _0x19701f;});}})['then'](respondWithFilteredResult(_0x3eb65e,_0x3c6f70))[_0xe6ed('0x4a')](handleError(_0x3eb65e,null));};exports['getHopperHistories']=function(_0x495c55,_0x3ea94d,_0x4bad77){var _0x43eabe={'raw':!![],'where':{}};var _0x4b4128={};var _0x2d8599={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe6ed('0x5e')]({'where':{'id':_0x495c55[_0xe6ed('0x4c')]['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x3ea94d,null))[_0xe6ed('0x23')](function(_0x276768){if(_0x276768){_0x4b4128[_0xe6ed('0x3a')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x4b4128[_0xe6ed('0x3b')]=_[_0xe6ed('0x3c')](_0x495c55[_0xe6ed('0x3b')]);_0x4b4128[_0xe6ed('0x3d')]=_['intersection'](_0x4b4128['model'],_0x4b4128[_0xe6ed('0x3b')]);_0x43eabe['attributes']=_[_0xe6ed('0x3f')](_0x4b4128['model'],qs[_0xe6ed('0x40')](_0x495c55[_0xe6ed('0x3b')][_0xe6ed('0x40')]));_0x43eabe['attributes']=_0x43eabe[_0xe6ed('0x3e')][_0xe6ed('0x41')]?_0x43eabe[_0xe6ed('0x3e')]:_0x4b4128['model'];if(!_0x495c55[_0xe6ed('0x3b')]['hasOwnProperty']('nolimit')){_0x43eabe[_0xe6ed('0x1e')]=qs[_0xe6ed('0x1e')](_0x495c55[_0xe6ed('0x3b')][_0xe6ed('0x1e')]);_0x43eabe['offset']=qs['offset'](_0x495c55[_0xe6ed('0x3b')]['offset']);}_0x43eabe[_0xe6ed('0x43')]=qs[_0xe6ed('0x61')](_0x495c55['query']['sort']);_0x43eabe['where']=qs[_0xe6ed('0x3d')](_[_0xe6ed('0x45')](_0x495c55[_0xe6ed('0x3b')],_0x4b4128[_0xe6ed('0x3d')]));_0x43eabe[_0xe6ed('0x44')][_0xe6ed('0x62')]=_0x276768['id'];if(_0x495c55[_0xe6ed('0x3b')][_0xe6ed('0x46')]){_0x43eabe['where']=_[_0xe6ed('0x4e')](_0x43eabe[_0xe6ed('0x44')],{'$or':_['map'](_0x43eabe['attributes'],function(_0x4fb0a0){var _0x588e62={};_0x588e62[_0x4fb0a0]={'$like':'%'+_0x495c55[_0xe6ed('0x3b')]['filter']+'%'};return _0x588e62;})});}_0x43eabe=_[_0xe6ed('0x4e')]({},_0x43eabe,_0x495c55['options']);return db[_0xe6ed('0x63')]['count']({'where':_0x43eabe[_0xe6ed('0x44')]})[_0xe6ed('0x23')](function(_0x421e53){_0x2d8599[_0xe6ed('0x1c')]=_0x421e53;if(_0x495c55[_0xe6ed('0x3b')][_0xe6ed('0x48')]){_0x43eabe['include']=[{'all':!![]}];}return db[_0xe6ed('0x63')]['findAll'](_0x43eabe);})[_0xe6ed('0x23')](function(_0x31529f){_0x2d8599[_0xe6ed('0x64')]=_0x31529f;return _0x2d8599;});}})[_0xe6ed('0x23')](respondWithFilteredResult(_0x3ea94d,_0x43eabe))[_0xe6ed('0x4a')](handleError(_0x3ea94d,null));};exports[_0xe6ed('0x65')]=function(_0x507296,_0x1504be,_0x3f1d12){var _0x403f33={'raw':!![],'where':{}};var _0x2641dc={};var _0x10c6c3={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xe6ed('0x5e')]({'where':{'id':_0x507296['params']['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x1504be,null))[_0xe6ed('0x23')](function(_0x3e3b78){if(_0x3e3b78){_0x2641dc[_0xe6ed('0x3a')]=_[_0xe6ed('0x3c')](db['CmHopperFinal'][_0xe6ed('0x37')]);_0x2641dc[_0xe6ed('0x3b')]=_[_0xe6ed('0x3c')](_0x507296[_0xe6ed('0x3b')]);_0x2641dc[_0xe6ed('0x3d')]=_[_0xe6ed('0x3f')](_0x2641dc['model'],_0x2641dc['query']);_0x403f33[_0xe6ed('0x3e')]=_[_0xe6ed('0x3f')](_0x2641dc[_0xe6ed('0x3a')],qs[_0xe6ed('0x40')](_0x507296[_0xe6ed('0x3b')][_0xe6ed('0x40')]));_0x403f33['attributes']=_0x403f33[_0xe6ed('0x3e')][_0xe6ed('0x41')]?_0x403f33[_0xe6ed('0x3e')]:_0x2641dc[_0xe6ed('0x3a')];if(!_0x507296[_0xe6ed('0x3b')][_0xe6ed('0x60')](_0xe6ed('0x42'))){_0x403f33[_0xe6ed('0x1e')]=qs['limit'](_0x507296[_0xe6ed('0x3b')][_0xe6ed('0x1e')]);_0x403f33[_0xe6ed('0x1d')]=qs['offset'](_0x507296[_0xe6ed('0x3b')][_0xe6ed('0x1d')]);}_0x403f33[_0xe6ed('0x43')]=qs['sort'](_0x507296['query']['sort']);_0x403f33[_0xe6ed('0x44')]=qs[_0xe6ed('0x3d')](_[_0xe6ed('0x45')](_0x507296[_0xe6ed('0x3b')],_0x2641dc[_0xe6ed('0x3d')]));_0x403f33[_0xe6ed('0x44')][_0xe6ed('0x62')]=_0x3e3b78['id'];if(_0x507296['query']['filter']){_0x403f33[_0xe6ed('0x44')]=_[_0xe6ed('0x4e')](_0x403f33[_0xe6ed('0x44')],{'$or':_[_0xe6ed('0x2b')](_0x403f33[_0xe6ed('0x3e')],function(_0x4de580){var _0x5b8f8f={};_0x5b8f8f[_0x4de580]={'$like':'%'+_0x507296['query'][_0xe6ed('0x46')]+'%'};return _0x5b8f8f;})});}_0x403f33=_[_0xe6ed('0x4e')]({},_0x403f33,_0x507296[_0xe6ed('0x47')]);return db[_0xe6ed('0x66')][_0xe6ed('0x1c')]({'where':_0x403f33[_0xe6ed('0x44')]})[_0xe6ed('0x23')](function(_0x1df8a0){_0x10c6c3[_0xe6ed('0x1c')]=_0x1df8a0;if(_0x507296[_0xe6ed('0x3b')][_0xe6ed('0x48')]){_0x403f33[_0xe6ed('0x4d')]=[{'all':!![]}];}return db[_0xe6ed('0x66')][_0xe6ed('0x49')](_0x403f33);})[_0xe6ed('0x23')](function(_0x41dd7c){_0x10c6c3[_0xe6ed('0x64')]=_0x41dd7c;return _0x10c6c3;});}})['then'](respondWithFilteredResult(_0x1504be,_0x403f33))[_0xe6ed('0x4a')](handleError(_0x1504be,null));};exports['getHopperBlacks']=function(_0x20f7c1,_0x521df3,_0x414881){var _0x26b84a={'raw':!![],'where':{}};var _0x4a465f={};var _0x31e5d9={'count':0x0,'rows':[]};return db[_0xe6ed('0x36')]['findOne']({'where':{'id':_0x20f7c1[_0xe6ed('0x4c')]['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x521df3,null))[_0xe6ed('0x23')](function(_0x230c8c){if(_0x230c8c){_0x4a465f[_0xe6ed('0x3a')]=_['keys'](db[_0xe6ed('0x67')][_0xe6ed('0x37')]);_0x4a465f[_0xe6ed('0x3b')]=_[_0xe6ed('0x3c')](_0x20f7c1[_0xe6ed('0x3b')]);_0x4a465f[_0xe6ed('0x3d')]=_[_0xe6ed('0x3f')](_0x4a465f[_0xe6ed('0x3a')],_0x4a465f['query']);_0x26b84a[_0xe6ed('0x3e')]=_[_0xe6ed('0x3f')](_0x4a465f[_0xe6ed('0x3a')],qs[_0xe6ed('0x40')](_0x20f7c1['query'][_0xe6ed('0x40')]));_0x26b84a['attributes']=_0x26b84a[_0xe6ed('0x3e')]['length']?_0x26b84a['attributes']:_0x4a465f[_0xe6ed('0x3a')];if(!_0x20f7c1[_0xe6ed('0x3b')][_0xe6ed('0x60')](_0xe6ed('0x42'))){_0x26b84a['limit']=qs[_0xe6ed('0x1e')](_0x20f7c1[_0xe6ed('0x3b')][_0xe6ed('0x1e')]);_0x26b84a[_0xe6ed('0x1d')]=qs[_0xe6ed('0x1d')](_0x20f7c1[_0xe6ed('0x3b')][_0xe6ed('0x1d')]);}_0x26b84a['order']=qs[_0xe6ed('0x61')](_0x20f7c1['query'][_0xe6ed('0x61')]);_0x26b84a[_0xe6ed('0x44')]=qs[_0xe6ed('0x3d')](_[_0xe6ed('0x45')](_0x20f7c1[_0xe6ed('0x3b')],_0x4a465f[_0xe6ed('0x3d')]));_0x26b84a[_0xe6ed('0x44')][_0xe6ed('0x62')]=_0x230c8c['id'];if(_0x20f7c1[_0xe6ed('0x3b')][_0xe6ed('0x46')]){_0x26b84a[_0xe6ed('0x44')]=_[_0xe6ed('0x4e')](_0x26b84a[_0xe6ed('0x44')],{'$or':_['map'](_0x26b84a[_0xe6ed('0x3e')],function(_0x59c0b0){var _0x4e75c1={};_0x4e75c1[_0x59c0b0]={'$like':'%'+_0x20f7c1[_0xe6ed('0x3b')]['filter']+'%'};return _0x4e75c1;})});}_0x26b84a=_[_0xe6ed('0x4e')]({},_0x26b84a,_0x20f7c1['options']);return db[_0xe6ed('0x67')]['count']({'where':_0x26b84a['where']})['then'](function(_0x999bd9){_0x31e5d9['count']=_0x999bd9;if(_0x20f7c1['query'][_0xe6ed('0x48')]){_0x26b84a[_0xe6ed('0x4d')]=[{'all':!![]}];}return db[_0xe6ed('0x67')][_0xe6ed('0x49')](_0x26b84a);})[_0xe6ed('0x23')](function(_0x5f5695){_0x31e5d9['rows']=_0x5f5695;return _0x31e5d9;});}})[_0xe6ed('0x23')](respondWithFilteredResult(_0x521df3,_0x26b84a))['catch'](handleError(_0x521df3,null));};exports[_0xe6ed('0x68')]=function(_0x5b0e71,_0x5a3e3b,_0x152d57){var _0x3c2db0={};var _0x2ebfed={};var _0x4d073a;var _0x4ea7e5;return db[_0xe6ed('0x36')]['findOne']({'where':{'id':_0x5b0e71[_0xe6ed('0x4c')]['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x5a3e3b,null))[_0xe6ed('0x23')](function(_0x3cc8e3){if(_0x3cc8e3){_0x4d073a=_0x3cc8e3;_0x2ebfed[_0xe6ed('0x3a')]=_['keys'](db[_0xe6ed('0x69')][_0xe6ed('0x37')]);_0x2ebfed[_0xe6ed('0x3b')]=_[_0xe6ed('0x3c')](_0x5b0e71['query']);_0x2ebfed['filters']=_[_0xe6ed('0x3f')](_0x2ebfed[_0xe6ed('0x3a')],_0x2ebfed[_0xe6ed('0x3b')]);_0x3c2db0[_0xe6ed('0x3e')]=_['intersection'](_0x2ebfed['model'],qs[_0xe6ed('0x40')](_0x5b0e71[_0xe6ed('0x3b')][_0xe6ed('0x40')]));_0x3c2db0[_0xe6ed('0x3e')]=_0x3c2db0['attributes'][_0xe6ed('0x41')]?_0x3c2db0[_0xe6ed('0x3e')]:_0x2ebfed[_0xe6ed('0x3a')];_0x3c2db0[_0xe6ed('0x43')]=qs['sort'](_0x5b0e71[_0xe6ed('0x3b')][_0xe6ed('0x61')]);_0x3c2db0[_0xe6ed('0x44')]=qs['filters'](_[_0xe6ed('0x45')](_0x5b0e71['query'],_0x2ebfed['filters']));if(_0x5b0e71[_0xe6ed('0x3b')][_0xe6ed('0x46')]){_0x3c2db0[_0xe6ed('0x44')]=_[_0xe6ed('0x4e')](_0x3c2db0[_0xe6ed('0x44')],{'$or':_['map'](_0x3c2db0[_0xe6ed('0x3e')],function(_0x5b7db8){var _0x3ea547={};_0x3ea547[_0x5b7db8]={'$like':'%'+_0x5b0e71['query'][_0xe6ed('0x46')]+'%'};return _0x3ea547;})});}_0x3c2db0=_['merge']({},_0x3c2db0,_0x5b0e71[_0xe6ed('0x47')]);return _0x4d073a[_0xe6ed('0x68')](_0x3c2db0);}})[_0xe6ed('0x23')](function(_0x111bc1){if(_0x111bc1){_0x4ea7e5=_0x111bc1['length'];if(!_0x5b0e71[_0xe6ed('0x3b')]['hasOwnProperty'](_0xe6ed('0x42'))){_0x3c2db0[_0xe6ed('0x1e')]=qs[_0xe6ed('0x1e')](_0x5b0e71[_0xe6ed('0x3b')]['limit']);_0x3c2db0[_0xe6ed('0x1d')]=qs[_0xe6ed('0x1d')](_0x5b0e71['query'][_0xe6ed('0x1d')]);}return _0x4d073a[_0xe6ed('0x68')](_0x3c2db0);}})['then'](function(_0x451ea1){if(_0x451ea1){return _0x451ea1?{'count':_0x4ea7e5,'rows':_0x451ea1}:null;}})['then'](respondWithResult(_0x5a3e3b,null))['catch'](handleError(_0x5a3e3b,null));};exports[_0xe6ed('0x6a')]=function(_0x1af203,_0x14927c,_0x4ff0ff){var _0x2fe553=_0x1af203[_0xe6ed('0x50')][_0xe6ed('0x6b')];var _0x358333=_[_0xe6ed('0x2b')](_0x2fe553,'id');return db['Team'][_0xe6ed('0x49')]({'where':{'id':_0x358333},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe6ed('0x6c'),'attributes':['id',_0xe6ed('0x2f'),_0xe6ed('0x6d'),_0xe6ed('0x6e'),_0xe6ed('0x6f')],'raw':!![]}]})[_0xe6ed('0x23')](function(_0x14908c){if(_0x14908c){var _0x27513c=_[_0xe6ed('0x70')](_0x14908c,function(_0x3c0459){var _0x19fed1=_0x3c0459[_0xe6ed('0x25')]({'plain':!![]});_0x19fed1['Agents']['forEach'](function(_0x2efb4f){_0x2efb4f[_0xe6ed('0x71')]=_[_0xe6ed('0x5c')](_0x2fe553,{'id':_0x19fed1['id']})['penalty'];});return _0x19fed1[_0xe6ed('0x6c')];});return db[_0xe6ed('0x36')][_0xe6ed('0x5c')]({'where':{'id':_0x1af203['params']['id']}})[_0xe6ed('0x23')](function(_0x576786){return db[_0xe6ed('0x72')][_0xe6ed('0x73')](function(_0x3eeddc){return _0x576786[_0xe6ed('0x6a')](_0x358333,{'transaction':_0x3eeddc})[_0xe6ed('0x23')](function(){return BPromise[_0xe6ed('0x74')](_0x27513c,function(_0x22342c){return db[_0xe6ed('0x75')][_0xe6ed('0x76')]({'where':{'UserId':_0x22342c['id'],'VoiceQueueId':_0x1af203[_0xe6ed('0x4c')]['id']},'defaults':{'penalty':_0x22342c[_0xe6ed('0x71')]},'transaction':_0x3eeddc});});})[_0xe6ed('0x23')](function(){return BPromise[_0xe6ed('0x74')](_[_0xe6ed('0x46')](_0x27513c,{'online':!![]}),function(_0x155aa6){return db[_0xe6ed('0x77')]['upsert']({'membername':_0x155aa6[_0xe6ed('0x2f')],'UserId':_0x155aa6['id'],'queue_name':_0x576786['name'],'VoiceQueueId':_0x576786['id'],'interface':_[_0xe6ed('0x78')](_0x155aa6[_0xe6ed('0x6f')])?util[_0xe6ed('0x79')](_0xe6ed('0x7a'),_0x155aa6['name']):_0x155aa6['interface'],'paused':_0x155aa6[_0xe6ed('0x6e')]||![],'penalty':_0x155aa6['penalty']},{'transaction':_0x3eeddc});});})[_0xe6ed('0x23')](function(){_0x27513c['forEach'](function(_0xb2ebc3){socket[_0xe6ed('0x7b')](_0xe6ed('0x7c'),{'UserId':_0xb2ebc3['id'],'VoiceQueueId':_0x576786['id']});});});});});}})[_0xe6ed('0x23')](respondWithStatusCode(_0x14927c,null))['catch'](handleError(_0x14927c,null));};exports[_0xe6ed('0x7d')]=function(_0x45c8d5,_0x553c61,_0x482e8c){return db[_0xe6ed('0x69')][_0xe6ed('0x49')]({'where':{'id':_0x45c8d5['query'][_0xe6ed('0x7e')]},'attributes':['id'],'include':[{'model':db[_0xe6ed('0x7f')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x553c61,null))[_0xe6ed('0x23')](function(_0x31f266){var _0x3abfaa=_[_0xe6ed('0x2b')](_0x31f266,'id');var _0x4ed286=[];var _0x13fce1=[];var _0x49667=squel[_0xe6ed('0x80')]();_0x49667[_0xe6ed('0x81')]('tq.TeamId')[_0xe6ed('0x82')](_0xe6ed('0x83'),'tq')['join'](_0xe6ed('0x84'),'ut',_0xe6ed('0x85'))[_0xe6ed('0x44')]('VoiceQueueId\x20=\x20?',_0x45c8d5['params']['id']);for(var _0x1cd28f=0x0;_0x1cd28f<_0x31f266[_0xe6ed('0x41')];_0x1cd28f+=0x1){let _0x3995eb=_0x31f266[_0x1cd28f];for(var _0x207117=0x0;_0x207117<_0x3995eb['Agents'][_0xe6ed('0x41')];_0x207117+=0x1){let _0x333a31=_0x3995eb[_0xe6ed('0x6c')][_0x207117];var _0x56dbf1=_0x49667['clone']();_0x56dbf1[_0xe6ed('0x44')](_0xe6ed('0x86'),_0x333a31['id']);_0x13fce1['push'](db[_0xe6ed('0x72')][_0xe6ed('0x3b')](_0x56dbf1['toString'](),{'type':db[_0xe6ed('0x72')][_0xe6ed('0x87')]['SELECT']})[_0xe6ed('0x23')](function(_0x59f489){if(_0x59f489['length']===0x1){return _0x333a31['id'];}else{var _0x50924c=_[_0xe6ed('0x88')](_[_0xe6ed('0x2b')](_0x59f489,_0xe6ed('0x89')),function(_0x48cb0e){return _['includes'](_0x3abfaa,_0x48cb0e);});if(_0x50924c){return _0x333a31['id'];}}}));}}return BPromise[_0xe6ed('0x8a')](_0x13fce1)[_0xe6ed('0x23')](function(_0x4aeb7){_0x4ed286=_(_0x4ed286)[_0xe6ed('0x8b')](_0x4aeb7)['compact']()[_0xe6ed('0x2c')]();return db[_0xe6ed('0x36')]['find']({'where':{'id':_0x45c8d5[_0xe6ed('0x4c')]['id']}})[_0xe6ed('0x23')](function(_0x155a1f){return db['sequelize'][_0xe6ed('0x73')](function(_0x3abffe){return _0x155a1f[_0xe6ed('0x7d')](_0x45c8d5[_0xe6ed('0x3b')][_0xe6ed('0x7e')],{'transaction':_0x3abffe})[_0xe6ed('0x23')](function(){if(!_[_0xe6ed('0x8c')](_0x4ed286)){return _0x155a1f[_0xe6ed('0x8d')](_0x4ed286,{'transaction':_0x3abffe})['then'](function(){return db[_0xe6ed('0x77')][_0xe6ed('0x24')]({'where':{'VoiceQueueId':_0x45c8d5['params']['id'],'UserId':_0x4ed286},'transaction':_0x3abffe});});}})[_0xe6ed('0x23')](function(){_0x4ed286[_0xe6ed('0x8e')](function(_0x2690be){socket[_0xe6ed('0x7b')](_0xe6ed('0x8f'),{'UserId':_0x2690be,'VoiceQueueId':_0x155a1f['id']});});});});});});})[_0xe6ed('0x23')](respondWithStatusCode(_0x553c61,null))[_0xe6ed('0x4a')](handleError(_0x553c61,null));};exports[_0xe6ed('0x90')]=function(_0x2a91f3,_0x2a7e8f,_0x1d3e6f){var _0x26dca8,_0x32b362;return db[_0xe6ed('0x36')]['find']({'where':{'id':_0x2a91f3[_0xe6ed('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2a7e8f,null))[_0xe6ed('0x23')](function(_0x22b2e4){if(_0x22b2e4){_0x32b362=_0x22b2e4;return _0x22b2e4['addAgents'](_0x2a91f3['body']['ids'],_['omit'](_0x2a91f3['body'],[_0xe6ed('0x7e'),'id'])||{})[_0xe6ed('0x91')](function(_0x3bd36f){for(var _0x33d75f=0x0;_0x33d75f<_0x2a91f3[_0xe6ed('0x50')]['ids'][_0xe6ed('0x41')];_0x33d75f+=0x1){socket[_0xe6ed('0x7b')]('userVoiceQueue:save',{'UserId':_0x2a91f3['body'][_0xe6ed('0x7e')][_0x33d75f],'VoiceQueueId':_0x2a91f3['params']['id']});}return _0x3bd36f;});}})['then'](function(_0x21f2c9){_0x26dca8=_0x21f2c9||[];if(_0x32b362){return db[_0xe6ed('0x7f')][_0xe6ed('0x49')]({'where':{'id':_0x2a91f3[_0xe6ed('0x50')][_0xe6ed('0x7e')]},'attributes':['id',_0xe6ed('0x2f'),_0xe6ed('0x6d'),'voicePause',_0xe6ed('0x6f')],'raw':!![]});}})[_0xe6ed('0x23')](function(_0x5d6a4e){if(!_[_0xe6ed('0x8c')](_0x5d6a4e)){var _0x444323=[];for(var _0x26ec35=0x0;_0x26ec35<_0x5d6a4e[_0xe6ed('0x41')];_0x26ec35++){if(_0x5d6a4e[_0x26ec35][_0xe6ed('0x6d')]){_0x444323[_0xe6ed('0x92')](db[_0xe6ed('0x77')][_0xe6ed('0x93')]({'membername':_0x5d6a4e[_0x26ec35]['name'],'UserId':_0x5d6a4e[_0x26ec35]['id'],'queue_name':_0x32b362[_0xe6ed('0x2f')],'VoiceQueueId':_0x32b362['id'],'interface':_[_0xe6ed('0x78')](_0x5d6a4e[_0x26ec35][_0xe6ed('0x6f')])?util[_0xe6ed('0x79')](_0xe6ed('0x7a'),_0x5d6a4e[_0x26ec35][_0xe6ed('0x2f')]):_0x5d6a4e[_0x26ec35]['interface'],'paused':_0x5d6a4e[_0x26ec35][_0xe6ed('0x6e')]||![],'penalty':_0x2a91f3[_0xe6ed('0x50')][_0xe6ed('0x71')]||0x0}));}}return BPromise[_0xe6ed('0x8a')](_0x444323);}})[_0xe6ed('0x23')](function(){return _0x26dca8;})[_0xe6ed('0x23')](respondWithResult(_0x2a7e8f,null))[_0xe6ed('0x4a')](handleError(_0x2a7e8f,null));};exports[_0xe6ed('0x8d')]=function(_0x64ccc8,_0x4ed684,_0x1acd0e){return db[_0xe6ed('0x36')]['find']({'where':{'id':_0x64ccc8[_0xe6ed('0x4c')]['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x4ed684,null))[_0xe6ed('0x23')](function(_0xeec291){if(_0xeec291){return _0xeec291['removeAgents'](_0x64ccc8[_0xe6ed('0x3b')]['ids'])[_0xe6ed('0x23')](function(){if(_[_0xe6ed('0x94')](_0x64ccc8[_0xe6ed('0x3b')][_0xe6ed('0x7e')])){for(var _0x5bc64b=0x0;_0x5bc64b<_0x64ccc8[_0xe6ed('0x3b')][_0xe6ed('0x7e')][_0xe6ed('0x41')];_0x5bc64b+=0x1){socket[_0xe6ed('0x7b')](_0xe6ed('0x8f'),{'UserId':Number(_0x64ccc8[_0xe6ed('0x3b')][_0xe6ed('0x7e')][_0x5bc64b]),'VoiceQueueId':Number(_0x64ccc8[_0xe6ed('0x4c')]['id'])});}}else{socket['emit'](_0xe6ed('0x8f'),{'UserId':Number(_0x64ccc8['query']['ids']),'VoiceQueueId':Number(_0x64ccc8[_0xe6ed('0x4c')]['id'])});}});}})[_0xe6ed('0x23')](function(_0x15b982){return db['UserVoiceQueueRt'][_0xe6ed('0x24')]({'where':{'VoiceQueueId':_0x64ccc8['params']['id'],'UserId':_0x64ccc8[_0xe6ed('0x3b')][_0xe6ed('0x7e')]}})['then'](function(){return _0x15b982;});})[_0xe6ed('0x23')](respondWithStatusCode(_0x4ed684,null))['catch'](handleError(_0x4ed684,null));};exports[_0xe6ed('0x95')]=function(_0xe90058,_0x422514,_0x19c9c3){var _0x23f5d8={};var _0x17477a={};var _0x246594;var _0x8304ff;return db[_0xe6ed('0x36')][_0xe6ed('0x5e')]({'where':{'id':_0xe90058[_0xe6ed('0x4c')]['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x422514,null))['then'](function(_0x51d868){if(_0x51d868){_0x246594=_0x51d868;_0x17477a[_0xe6ed('0x3a')]=_[_0xe6ed('0x3c')](db[_0xe6ed('0x7f')][_0xe6ed('0x37')]);_0x17477a[_0xe6ed('0x3b')]=_['keys'](_0xe90058[_0xe6ed('0x3b')]);_0x17477a[_0xe6ed('0x3d')]=_[_0xe6ed('0x3f')](_0x17477a[_0xe6ed('0x3a')],_0x17477a['query']);_0x23f5d8['attributes']=_[_0xe6ed('0x3f')](_0x17477a[_0xe6ed('0x3a')],qs[_0xe6ed('0x40')](_0xe90058[_0xe6ed('0x3b')][_0xe6ed('0x40')]));_0x23f5d8['attributes']=_0x23f5d8[_0xe6ed('0x3e')]['length']?_0x23f5d8['attributes']:_0x17477a['model'];_0x23f5d8['order']=qs['sort'](_0xe90058['query'][_0xe6ed('0x61')]);_0x23f5d8[_0xe6ed('0x44')]=qs['filters'](_[_0xe6ed('0x45')](_0xe90058[_0xe6ed('0x3b')],_0x17477a[_0xe6ed('0x3d')]));if(_0xe90058['query'][_0xe6ed('0x46')]){_0x23f5d8[_0xe6ed('0x44')]=_[_0xe6ed('0x4e')](_0x23f5d8[_0xe6ed('0x44')],{'$or':_[_0xe6ed('0x2b')](_0x23f5d8['attributes'],function(_0x253cd9){var _0x26e15d={};_0x26e15d[_0x253cd9]={'$like':'%'+_0xe90058[_0xe6ed('0x3b')]['filter']+'%'};return _0x26e15d;})});}_0x23f5d8=_['merge']({},_0x23f5d8,_0xe90058[_0xe6ed('0x47')]);return _0x246594['getAgents'](_0x23f5d8);}})[_0xe6ed('0x23')](function(_0x2ecd15){if(_0x2ecd15){_0x8304ff=_0x2ecd15[_0xe6ed('0x41')];if(!_0xe90058[_0xe6ed('0x3b')][_0xe6ed('0x60')](_0xe6ed('0x42'))){_0x23f5d8[_0xe6ed('0x1e')]=qs[_0xe6ed('0x1e')](_0xe90058[_0xe6ed('0x3b')]['limit']);_0x23f5d8[_0xe6ed('0x1d')]=qs['offset'](_0xe90058[_0xe6ed('0x3b')][_0xe6ed('0x1d')]);}return _0x246594[_0xe6ed('0x95')](_0x23f5d8);}})[_0xe6ed('0x23')](function(_0x1fd0ad){if(_0x1fd0ad){return _0x1fd0ad?{'count':_0x8304ff,'rows':_0x1fd0ad}:null;}})[_0xe6ed('0x23')](respondWithResult(_0x422514,null))[_0xe6ed('0x4a')](handleError(_0x422514,null));};exports[_0xe6ed('0x96')]=function(_0x29163f,_0x287593,_0x5c7936){var _0xff8039={};var _0x106497={};var _0x16ad62;var _0xd3cfe1;return db['VoiceQueue'][_0xe6ed('0x5e')]({'where':{'id':_0x29163f['params']['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x287593,null))[_0xe6ed('0x23')](function(_0x42b6db){if(_0x42b6db){_0x16ad62=_0x42b6db;_0x106497[_0xe6ed('0x3a')]=_[_0xe6ed('0x3c')](db[_0xe6ed('0x77')][_0xe6ed('0x37')]);_0x106497[_0xe6ed('0x3b')]=_[_0xe6ed('0x3c')](_0x29163f[_0xe6ed('0x3b')]);_0x106497[_0xe6ed('0x3d')]=_['intersection'](_0x106497[_0xe6ed('0x3a')],_0x106497[_0xe6ed('0x3b')]);_0xff8039[_0xe6ed('0x3e')]=_['intersection'](_0x106497[_0xe6ed('0x3a')],qs[_0xe6ed('0x40')](_0x29163f[_0xe6ed('0x3b')]['fields']));_0xff8039['attributes']=_0xff8039[_0xe6ed('0x3e')][_0xe6ed('0x41')]?_0xff8039[_0xe6ed('0x3e')]:_0x106497[_0xe6ed('0x3a')];_0xff8039['order']=qs[_0xe6ed('0x61')](_0x29163f[_0xe6ed('0x3b')]['sort']);_0xff8039[_0xe6ed('0x44')]=qs['filters'](_[_0xe6ed('0x45')](_0x29163f[_0xe6ed('0x3b')],_0x106497[_0xe6ed('0x3d')]));if(_0x29163f[_0xe6ed('0x3b')][_0xe6ed('0x46')]){_0xff8039['where']=_['merge'](_0xff8039[_0xe6ed('0x44')],{'$or':_[_0xe6ed('0x2b')](_0xff8039['attributes'],function(_0x7ccb7c){var _0x363ff3={};_0x363ff3[_0x7ccb7c]={'$like':'%'+_0x29163f[_0xe6ed('0x3b')]['filter']+'%'};return _0x363ff3;})});}_0xff8039=_[_0xe6ed('0x4e')]({},_0xff8039,_0x29163f[_0xe6ed('0x47')]);return _0x16ad62[_0xe6ed('0x96')](_0xff8039);}})[_0xe6ed('0x23')](function(_0x3a3b9f){if(_0x3a3b9f){_0xd3cfe1=_0x3a3b9f[_0xe6ed('0x41')];if(!_0x29163f[_0xe6ed('0x3b')][_0xe6ed('0x60')](_0xe6ed('0x42'))){_0xff8039[_0xe6ed('0x1e')]=qs[_0xe6ed('0x1e')](_0x29163f[_0xe6ed('0x3b')][_0xe6ed('0x1e')]);_0xff8039[_0xe6ed('0x1d')]=qs['offset'](_0x29163f[_0xe6ed('0x3b')][_0xe6ed('0x1d')]);}return _0x16ad62['getMembers'](_0xff8039);}})[_0xe6ed('0x23')](function(_0x2b0095){return _0x2b0095?{'count':_0xd3cfe1,'rows':_0x2b0095}:null;})['then'](respondWithResult(_0x287593,null))['catch'](handleError(_0x287593,null));};exports[_0xe6ed('0x97')]=function(_0x349025,_0x316fdd,_0x487b54){var _0x9b596d={};var _0x3e4b36={};var _0x1820f0;var _0x4bec5d;return db[_0xe6ed('0x36')]['findOne']({'where':{'id':_0x349025[_0xe6ed('0x4c')]['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x316fdd,null))[_0xe6ed('0x23')](function(_0xdd6bed){if(_0xdd6bed){_0x1820f0=_0xdd6bed;_0x3e4b36['model']=_[_0xe6ed('0x3c')](db[_0xe6ed('0x98')]['rawAttributes']);_0x3e4b36[_0xe6ed('0x3b')]=_['keys'](_0x349025[_0xe6ed('0x3b')]);_0x3e4b36['filters']=_[_0xe6ed('0x3f')](_0x3e4b36['model'],_0x3e4b36[_0xe6ed('0x3b')]);_0x9b596d[_0xe6ed('0x3e')]=_['intersection'](_0x3e4b36['model'],qs[_0xe6ed('0x40')](_0x349025['query'][_0xe6ed('0x40')]));_0x9b596d[_0xe6ed('0x3e')]=_0x9b596d[_0xe6ed('0x3e')][_0xe6ed('0x41')]?_0x9b596d[_0xe6ed('0x3e')]:_0x3e4b36[_0xe6ed('0x3a')];_0x9b596d['order']=qs[_0xe6ed('0x61')](_0x349025[_0xe6ed('0x3b')][_0xe6ed('0x61')]);_0x9b596d[_0xe6ed('0x44')]=qs['filters'](_['pick'](_0x349025['query'],_0x3e4b36[_0xe6ed('0x3d')]));if(_0x349025[_0xe6ed('0x3b')]['filter']){_0x9b596d[_0xe6ed('0x44')]=_[_0xe6ed('0x4e')](_0x9b596d['where'],{'$or':_[_0xe6ed('0x2b')](_0x9b596d[_0xe6ed('0x3e')],function(_0x4ec5b1){var _0x24648a={};_0x24648a[_0x4ec5b1]={'$like':'%'+_0x349025[_0xe6ed('0x3b')][_0xe6ed('0x46')]+'%'};return _0x24648a;})});}_0x9b596d=_[_0xe6ed('0x4e')]({},_0x9b596d,_0x349025[_0xe6ed('0x47')]);return _0x1820f0['getLists'](_0x9b596d);}})[_0xe6ed('0x23')](function(_0x2b6369){if(_0x2b6369){_0x4bec5d=_0x2b6369[_0xe6ed('0x41')];if(!_0x349025[_0xe6ed('0x3b')][_0xe6ed('0x60')](_0xe6ed('0x42'))){_0x9b596d['limit']=qs[_0xe6ed('0x1e')](_0x349025[_0xe6ed('0x3b')][_0xe6ed('0x1e')]);_0x9b596d[_0xe6ed('0x1d')]=qs['offset'](_0x349025[_0xe6ed('0x3b')][_0xe6ed('0x1d')]);}return _0x1820f0['getLists'](_0x9b596d);}})[_0xe6ed('0x23')](function(_0x1a818f){if(_0x1a818f){return _0x1a818f?{'count':_0x4bec5d,'rows':_0x1a818f}:null;}})[_0xe6ed('0x23')](respondWithResult(_0x316fdd,null))['catch'](handleError(_0x316fdd,null));};exports[_0xe6ed('0x99')]=function(_0x5f1399,_0x4c21f2,_0x3003ea){var _0x41fcfd,_0x21aa2d;return db['VoiceQueue']['find']({'where':{'id':_0x5f1399['params']['id']}})['then'](handleEntityNotFound(_0x4c21f2,null))['then'](function(_0x2edf1e){if(_0x2edf1e){_0x21aa2d=_0x2edf1e;return _0x2edf1e[_0xe6ed('0x99')](_0x5f1399[_0xe6ed('0x50')][_0xe6ed('0x7e')],_[_0xe6ed('0x59')](_0x5f1399['body'],[_0xe6ed('0x7e'),'id'])||{});}return null;})[_0xe6ed('0x91')](function(_0xcaf268){var _0x41dfc4;_0x41fcfd=_0xcaf268||[];var _0x4f586a=[];if(_0xcaf268){for(var _0x102ab8=0x0;_0x102ab8<_0xcaf268[_0xe6ed('0x41')];_0x102ab8+=0x1){var _0x616133=_0xcaf268[_0x102ab8][_0xe6ed('0x25')]({'plain':!![]});_0x21aa2d['dialCheckDuplicateType']=_0x5f1399['body'][_0xe6ed('0x9a')]?_0x5f1399['body'][_0xe6ed('0x9a')]:_0x21aa2d[_0xe6ed('0x9a')];switch(_0x21aa2d[_0xe6ed('0x9a')]){case _0xe6ed('0x9b'):_0x41dfc4=squel[_0xe6ed('0x9c')]()[_0xe6ed('0x9d')](_0xe6ed('0x9e'))['fromQuery']([_0xe6ed('0x9f'),_0xe6ed('0xa0'),_0xe6ed('0xa1'),_0xe6ed('0xa2'),'VoiceQueueId',_0xe6ed('0x5a'),_0xe6ed('0x5b')],squel[_0xe6ed('0x80')]()[_0xe6ed('0x81')](_0xe6ed('0x9f'),_0xe6ed('0x9f'))[_0xe6ed('0x81')](_0xe6ed('0xa3'),_0xe6ed('0xa0'))[_0xe6ed('0x81')]('id',_0xe6ed('0xa1'))[_0xe6ed('0x81')](_0x616133[_0xe6ed('0xa4')][_0xe6ed('0xa5')](),_0xe6ed('0xa2'))['field'](_0x5f1399[_0xe6ed('0x4c')]['id']['toString'](),_0xe6ed('0x62'))[_0xe6ed('0x81')](_0xe6ed('0xa3'),_0xe6ed('0x5a'))[_0xe6ed('0x81')]('NOW()',_0xe6ed('0x5b'))[_0xe6ed('0x82')](_0xe6ed('0xa6'))[_0xe6ed('0x44')](_0xe6ed('0xa7'))[_0xe6ed('0x44')]('ListId\x20=\x20?',_0x616133[_0xe6ed('0xa4')][_0xe6ed('0xa5')]())[_0xe6ed('0x44')](_0xe6ed('0xa8'))[_0xe6ed('0x44')](_0xe6ed('0xa9'),squel[_0xe6ed('0x80')]()[_0xe6ed('0x81')](_0xe6ed('0xaa'))['from'](_0xe6ed('0xab'))[_0xe6ed('0x44')]('VoiceQueueId\x20=\x20?',_0x5f1399[_0xe6ed('0x4c')]['id'][_0xe6ed('0xa5')]()))[_0xe6ed('0x44')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe6ed('0x80')]()[_0xe6ed('0x81')](_0xe6ed('0xac'))[_0xe6ed('0x82')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x5f1399[_0xe6ed('0x4c')]['id'][_0xe6ed('0xa5')]())))['toString']();break;case _0xe6ed('0xad'):_0x41dfc4=squel[_0xe6ed('0x9c')]()['into'](_0xe6ed('0x9e'))[_0xe6ed('0xae')]([_0xe6ed('0x9f'),_0xe6ed('0xa0'),_0xe6ed('0xa1'),_0xe6ed('0xa2'),_0xe6ed('0x62'),_0xe6ed('0x5a'),_0xe6ed('0x5b')],squel[_0xe6ed('0x80')]()[_0xe6ed('0x81')](_0xe6ed('0x9f'),_0xe6ed('0x9f'))[_0xe6ed('0x81')]('NOW()',_0xe6ed('0xa0'))[_0xe6ed('0x81')]('id',_0xe6ed('0xa1'))['field'](_0x616133[_0xe6ed('0xa4')]['toString'](),_0xe6ed('0xa2'))[_0xe6ed('0x81')](_0x5f1399[_0xe6ed('0x4c')]['id'][_0xe6ed('0xa5')](),_0xe6ed('0x62'))[_0xe6ed('0x81')](_0xe6ed('0xa3'),_0xe6ed('0x5a'))['field']('NOW()','updatedAt')[_0xe6ed('0x82')]('cm_contacts')[_0xe6ed('0x44')](_0xe6ed('0xa7'))['where'](_0xe6ed('0xaf'),_0x616133['CmListId']['toString']())[_0xe6ed('0x44')](_0xe6ed('0xa8'))[_0xe6ed('0x44')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe6ed('0x80')]()['field'](_0xe6ed('0xac'))[_0xe6ed('0x82')]('cm_hopper')[_0xe6ed('0x44')](_0xe6ed('0xb0'),_0x5f1399['params']['id'][_0xe6ed('0xa5')]())))['toString']();break;default:_0x41dfc4=squel[_0xe6ed('0x9c')]()[_0xe6ed('0x9d')]('cm_hopper')[_0xe6ed('0xae')]([_0xe6ed('0x9f'),'scheduledAt',_0xe6ed('0xa1'),'ListId',_0xe6ed('0x62'),_0xe6ed('0x5a'),_0xe6ed('0x5b')],squel[_0xe6ed('0x80')]()['field'](_0xe6ed('0x9f'),_0xe6ed('0x9f'))[_0xe6ed('0x81')]('NOW()','scheduledAt')['field']('id','ContactId')[_0xe6ed('0x81')](_0x616133[_0xe6ed('0xa4')]['toString'](),_0xe6ed('0xa2'))[_0xe6ed('0x81')](_0x5f1399[_0xe6ed('0x4c')]['id'][_0xe6ed('0xa5')](),_0xe6ed('0x62'))['field'](_0xe6ed('0xa3'),_0xe6ed('0x5a'))[_0xe6ed('0x81')]('NOW()',_0xe6ed('0x5b'))[_0xe6ed('0x82')](_0xe6ed('0xa6'))['where'](_0xe6ed('0xa7'))[_0xe6ed('0x44')](_0xe6ed('0xaf'),_0x616133[_0xe6ed('0xa4')][_0xe6ed('0xa5')]())[_0xe6ed('0x44')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x4f586a[_0xe6ed('0x92')](db[_0xe6ed('0x72')][_0xe6ed('0x3b')](_0x41dfc4));}return BPromise[_0xe6ed('0x8a')](_0x4f586a);}})[_0xe6ed('0x23')](function(){return _0x41fcfd;})['then'](respondWithResult(_0x4c21f2,null))[_0xe6ed('0x4a')](handleError(_0x4c21f2,null));};exports[_0xe6ed('0xb1')]=function(_0x157374,_0xaeabea,_0x21b1c0){return db['VoiceQueue'][_0xe6ed('0x5c')]({'where':{'id':_0x157374[_0xe6ed('0x4c')]['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0xaeabea,null))[_0xe6ed('0x23')](function(_0x17d0a3){if(_0x17d0a3){return _0x17d0a3[_0xe6ed('0xb1')](_0x157374[_0xe6ed('0x3b')][_0xe6ed('0x7e')]);}})[_0xe6ed('0x23')](function(_0x21288c){if(_0x21288c){return db[_0xe6ed('0x5f')][_0xe6ed('0x24')]({'where':{'ListId':_0x157374[_0xe6ed('0x3b')][_0xe6ed('0x7e')],'VoiceQueueId':_0x157374[_0xe6ed('0x4c')]['id']}})[_0xe6ed('0x23')](function(){return _0x21288c;});}})['then'](respondWithStatusCode(_0xaeabea,null))[_0xe6ed('0x4a')](handleError(_0xaeabea,null));};exports[_0xe6ed('0xb2')]=function(_0x59d4f5,_0x596518,_0x50bb55){var _0x612062={};var _0x4a9a54={};var _0x9afa7c;var _0x119419;return db['VoiceQueue'][_0xe6ed('0x5e')]({'where':{'id':_0x59d4f5[_0xe6ed('0x4c')]['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x596518,null))[_0xe6ed('0x23')](function(_0xe51e86){if(_0xe51e86){_0x9afa7c=_0xe51e86;_0x4a9a54[_0xe6ed('0x3a')]=_[_0xe6ed('0x3c')](db['CmList'][_0xe6ed('0x37')]);_0x4a9a54[_0xe6ed('0x3b')]=_[_0xe6ed('0x3c')](_0x59d4f5[_0xe6ed('0x3b')]);_0x4a9a54[_0xe6ed('0x3d')]=_[_0xe6ed('0x3f')](_0x4a9a54['model'],_0x4a9a54[_0xe6ed('0x3b')]);_0x612062[_0xe6ed('0x3e')]=_[_0xe6ed('0x3f')](_0x4a9a54[_0xe6ed('0x3a')],qs[_0xe6ed('0x40')](_0x59d4f5['query'][_0xe6ed('0x40')]));_0x612062['attributes']=_0x612062[_0xe6ed('0x3e')][_0xe6ed('0x41')]?_0x612062[_0xe6ed('0x3e')]:_0x4a9a54[_0xe6ed('0x3a')];_0x612062['order']=qs[_0xe6ed('0x61')](_0x59d4f5[_0xe6ed('0x3b')]['sort']);_0x612062[_0xe6ed('0x44')]=qs['filters'](_[_0xe6ed('0x45')](_0x59d4f5[_0xe6ed('0x3b')],_0x4a9a54[_0xe6ed('0x3d')]));if(_0x59d4f5['query'][_0xe6ed('0x46')]){_0x612062[_0xe6ed('0x44')]=_['merge'](_0x612062[_0xe6ed('0x44')],{'$or':_[_0xe6ed('0x2b')](_0x612062[_0xe6ed('0x3e')],function(_0x521e72){var _0x3a8a86={};_0x3a8a86[_0x521e72]={'$like':'%'+_0x59d4f5['query'][_0xe6ed('0x46')]+'%'};return _0x3a8a86;})});}_0x612062=_[_0xe6ed('0x4e')]({},_0x612062,_0x59d4f5[_0xe6ed('0x47')]);return _0x9afa7c[_0xe6ed('0xb2')](_0x612062);}})[_0xe6ed('0x23')](function(_0x2e14b6){if(_0x2e14b6){_0x119419=_0x2e14b6[_0xe6ed('0x41')];if(!_0x59d4f5[_0xe6ed('0x3b')][_0xe6ed('0x60')](_0xe6ed('0x42'))){_0x612062[_0xe6ed('0x1e')]=qs[_0xe6ed('0x1e')](_0x59d4f5[_0xe6ed('0x3b')][_0xe6ed('0x1e')]);_0x612062[_0xe6ed('0x1d')]=qs[_0xe6ed('0x1d')](_0x59d4f5[_0xe6ed('0x3b')]['offset']);}return _0x9afa7c['getBlackLists'](_0x612062);}})['then'](function(_0x13075a){if(_0x13075a){return _0x13075a?{'count':_0x119419,'rows':_0x13075a}:null;}})[_0xe6ed('0x23')](respondWithResult(_0x596518,null))['catch'](handleError(_0x596518,null));};exports['addBlackLists']=function(_0x28bcfe,_0x142142,_0x102f39){var _0x241544,_0x7e59ba;return db['VoiceQueue'][_0xe6ed('0x5c')]({'where':{'id':_0x28bcfe[_0xe6ed('0x4c')]['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x142142,null))[_0xe6ed('0x23')](function(_0x18dc19){if(_0x18dc19){_0x7e59ba=_0x18dc19;return _0x18dc19[_0xe6ed('0xb3')](_0x28bcfe['body'][_0xe6ed('0x7e')],_[_0xe6ed('0x59')](_0x28bcfe[_0xe6ed('0x50')],[_0xe6ed('0x7e'),'id'])||{});}return null;})[_0xe6ed('0x91')](function(_0x118bf0){var _0x2f5c3f;_0x241544=_0x118bf0||[];var _0x518288=[];if(_0x118bf0){for(var _0x2d1455=0x0;_0x2d1455<_0x118bf0['length'];_0x2d1455+=0x1){var _0x4337f=_0x118bf0[_0x2d1455][_0xe6ed('0x25')]({'plain':!![]});_0x2f5c3f=squel['insert']()['into']('cm_hopper_black')['fromQuery'](['phone',_0xe6ed('0xa1'),'ListId',_0xe6ed('0x62'),_0xe6ed('0x5a'),_0xe6ed('0x5b')],squel[_0xe6ed('0x80')]()[_0xe6ed('0x81')]('phone',_0xe6ed('0x9f'))[_0xe6ed('0x81')]('id',_0xe6ed('0xa1'))[_0xe6ed('0x81')](_0x4337f[_0xe6ed('0xa4')]['toString'](),'ListId')[_0xe6ed('0x81')](_0x28bcfe[_0xe6ed('0x4c')]['id'][_0xe6ed('0xa5')](),_0xe6ed('0x62'))[_0xe6ed('0x81')](_0xe6ed('0xa3'),_0xe6ed('0x5a'))['field'](_0xe6ed('0xa3'),_0xe6ed('0x5b'))[_0xe6ed('0x82')]('cm_contacts')[_0xe6ed('0x44')](_0xe6ed('0xa7'))[_0xe6ed('0x44')](_0xe6ed('0xaf'),_0x4337f[_0xe6ed('0xa4')]['toString']())[_0xe6ed('0x44')](_0xe6ed('0xa8')))[_0xe6ed('0xa5')]();_0x518288[_0xe6ed('0x92')](db[_0xe6ed('0x72')]['query'](_0x2f5c3f));}return BPromise['all'](_0x518288);}})[_0xe6ed('0x23')](function(){return _0x241544;})['then'](respondWithResult(_0x142142,null))[_0xe6ed('0x4a')](handleError(_0x142142,null));};exports[_0xe6ed('0xb4')]=function(_0x3a7787,_0x174bd7,_0x114f6e){return db[_0xe6ed('0x36')][_0xe6ed('0x5c')]({'where':{'id':_0x3a7787['params']['id']}})[_0xe6ed('0x23')](handleEntityNotFound(_0x174bd7,null))['then'](function(_0x33b899){if(_0x33b899){return _0x33b899[_0xe6ed('0xb4')](_0x3a7787[_0xe6ed('0x3b')][_0xe6ed('0x7e')]);}})[_0xe6ed('0x23')](function(_0x2f6457){if(_0x2f6457){return db[_0xe6ed('0x67')]['destroy']({'where':{'ListId':_0x3a7787[_0xe6ed('0x3b')][_0xe6ed('0x7e')],'VoiceQueueId':_0x3a7787['params']['id']}})[_0xe6ed('0x23')](function(){return _0x2f6457;});}})[_0xe6ed('0x23')](respondWithStatusCode(_0x174bd7,null))[_0xe6ed('0x4a')](handleError(_0x174bd7,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 471b34d..59e8a9d 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 _0x1389=['remove','emit','hasOwnProperty','exports','events','VoiceQueue','save','update'];(function(_0x484c37,_0x1abc7f){var _0x39b822=function(_0x342591){while(--_0x342591){_0x484c37['push'](_0x484c37['shift']());}};_0x39b822(++_0x1abc7f);}(_0x1389,0x13c));var _0x9138=function(_0x833094,_0x6f783e){_0x833094=_0x833094-0x0;var _0x5da056=_0x1389[_0x833094];return _0x5da056;};'use strict';var EventEmitter=require(_0x9138('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x9138('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9138('0x2'),'afterUpdate':_0x9138('0x3'),'afterDestroy':_0x9138('0x4')};function emitEvent(_0x2fcb8c){return function(_0x52a0a3,_0x18ee4d,_0x472364){VoiceQueueEvents['emit'](_0x2fcb8c+':'+_0x52a0a3['id'],_0x52a0a3);VoiceQueueEvents[_0x9138('0x5')](_0x2fcb8c,_0x52a0a3);_0x472364(null);};}for(var e in events){if(events[_0x9138('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x9138('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0xd748=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','VoiceQueue'];(function(_0x41b29e,_0x34b288){var _0xacd517=function(_0x3318df){while(--_0x3318df){_0x41b29e['push'](_0x41b29e['shift']());}};_0xacd517(++_0x34b288);}(_0xd748,0x184));var _0x8d74=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xd748[_0x29d94e];return _0x106237;};'use strict';var EventEmitter=require(_0x8d74('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x8d74('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x8d74('0x2')](0x0);var events={'afterCreate':_0x8d74('0x3'),'afterUpdate':_0x8d74('0x4'),'afterDestroy':_0x8d74('0x5')};function emitEvent(_0x4d75c8){return function(_0x3b3d21,_0xd5e7d0,_0x23157a){VoiceQueueEvents[_0x8d74('0x6')](_0x4d75c8+':'+_0x3b3d21['id'],_0x3b3d21);VoiceQueueEvents[_0x8d74('0x6')](_0x4d75c8,_0x3b3d21);_0x23157a(null);};}for(var e in events){if(events[_0x8d74('0x7')](e)){var event=events[e];VoiceQueue[_0x8d74('0x8')](e,emitEvent(event));}}module[_0x8d74('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index e02136c..e3a3574 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 _0xe6c2=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','define','VoiceQueue','voice_queues'];(function(_0x98455,_0x538837){var _0x21e763=function(_0x468dc3){while(--_0x468dc3){_0x98455['push'](_0x98455['shift']());}};_0x21e763(++_0x538837);}(_0xe6c2,0x168));var _0x2e6c=function(_0x283abd,_0x20292b){_0x283abd=_0x283abd-0x0;var _0x3df8df=_0xe6c2[_0x283abd];return _0x3df8df;};'use strict';var _=require(_0x2e6c('0x0'));var util=require(_0x2e6c('0x1'));var logger=require(_0x2e6c('0x2'))('api');var moment=require(_0x2e6c('0x3'));var BPromise=require(_0x2e6c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e6c('0x5'));var rimraf=require(_0x2e6c('0x6'));var config=require('../../config/environment');var attributes=require('./voiceQueue.attributes');module['exports']=function(_0x3fedfd,_0x4b9b1c){return _0x3fedfd[_0x2e6c('0x7')](_0x2e6c('0x8'),attributes,{'tableName':_0x2e6c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd479=['define','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x236bd0,_0x131bc9){var _0x16a5da=function(_0x2dab7f){while(--_0x2dab7f){_0x236bd0['push'](_0x236bd0['shift']());}};_0x16a5da(++_0x131bc9);}(_0xd479,0xc1));var _0x9d47=function(_0x23a103,_0x2a4072){_0x23a103=_0x23a103-0x0;var _0x3f8fe7=_0xd479[_0x23a103];return _0x3f8fe7;};'use strict';var _=require(_0x9d47('0x0'));var util=require('util');var logger=require(_0x9d47('0x1'))(_0x9d47('0x2'));var moment=require(_0x9d47('0x3'));var BPromise=require(_0x9d47('0x4'));var rp=require(_0x9d47('0x5'));var fs=require('fs');var path=require(_0x9d47('0x6'));var rimraf=require(_0x9d47('0x7'));var config=require(_0x9d47('0x8'));var attributes=require(_0x9d47('0x9'));module[_0x9d47('0xa')]=function(_0x5b5118,_0x1bc51e){return _0x5b5118[_0x9d47('0xb')]('VoiceQueue',attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 36e51b7..8bc4d75 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 _0x3687=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceQueue','findAll','options','raw','where','attributes','include','map','model','GetVoiceQueue','stringify','ShowVoiceQueue','find','lodash','util','bluebird'];(function(_0x2c4ca7,_0x5abe87){var _0xc82d75=function(_0x27780f){while(--_0x27780f){_0x2c4ca7['push'](_0x2c4ca7['shift']());}};_0xc82d75(++_0x5abe87);}(_0x3687,0x14d));var _0x7368=function(_0x55e4e3,_0x4227db){_0x55e4e3=_0x55e4e3-0x0;var _0x3f5fc8=_0x3687[_0x55e4e3];return _0x3f5fc8;};'use strict';var _=require(_0x7368('0x0'));var util=require(_0x7368('0x1'));var moment=require('moment');var BPromise=require(_0x7368('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7368('0x3'));var db=require(_0x7368('0x4'))['db'];var utils=require(_0x7368('0x5'));var logger=require(_0x7368('0x6'))(_0x7368('0x7'));var config=require(_0x7368('0x8'));var jayson=require(_0x7368('0x9'));var client=jayson[_0x7368('0xa')][_0x7368('0xb')]({'port':0x232a});config['redis']=_[_0x7368('0xc')](config[_0x7368('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x7368('0xe'))(new Redis(config[_0x7368('0xd')]));require(_0x7368('0xf'))[_0x7368('0x10')](socket);function respondWithRpcPromise(_0x2ed6c3,_0x476552,_0x54cf45){return new BPromise(function(_0x44d1a2,_0x32da47){return client[_0x7368('0x11')](_0x2ed6c3,_0x54cf45)[_0x7368('0x12')](function(_0x43d9de){logger[_0x7368('0x13')](_0x7368('0x14'),_0x476552,_0x7368('0x15'));logger[_0x7368('0x16')](_0x7368('0x17'),_0x476552,_0x7368('0x15'),JSON['stringify'](_0x43d9de));if(_0x43d9de['error']){if(_0x43d9de['error'][_0x7368('0x18')]===0x1f4){logger[_0x7368('0x19')](_0x7368('0x14'),_0x476552,_0x43d9de[_0x7368('0x19')][_0x7368('0x1a')]);return _0x32da47(_0x43d9de[_0x7368('0x19')]['message']);}logger['error'](_0x7368('0x14'),_0x476552,_0x43d9de[_0x7368('0x19')][_0x7368('0x1a')]);return _0x44d1a2(_0x43d9de['error'][_0x7368('0x1a')]);}else{logger[_0x7368('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x476552,_0x7368('0x15'));_0x44d1a2(_0x43d9de[_0x7368('0x1b')]['message']);}})[_0x7368('0x1c')](function(_0x5b1394){logger[_0x7368('0x19')](_0x7368('0x14'),_0x476552,_0x5b1394);_0x32da47(_0x5b1394);});});}exports['GetVoiceQueue']=function(_0x497f3d){var _0x9b92fd=this;return new Promise(function(_0x448e17,_0x49d505){return db[_0x7368('0x1d')][_0x7368('0x1e')]({'raw':_0x497f3d[_0x7368('0x1f')]?_0x497f3d[_0x7368('0x1f')][_0x7368('0x20')]===undefined?!![]:![]:!![],'where':_0x497f3d[_0x7368('0x1f')]?_0x497f3d[_0x7368('0x1f')][_0x7368('0x21')]||null:null,'attributes':_0x497f3d['options']?_0x497f3d[_0x7368('0x1f')][_0x7368('0x22')]||null:null,'limit':_0x497f3d[_0x7368('0x1f')]?_0x497f3d[_0x7368('0x1f')]['limit']||null:null,'include':_0x497f3d[_0x7368('0x1f')]?_0x497f3d[_0x7368('0x1f')][_0x7368('0x23')]?_[_0x7368('0x24')](_0x497f3d[_0x7368('0x1f')][_0x7368('0x23')],function(_0x3b7540){return{'model':db[_0x3b7540[_0x7368('0x25')]],'as':_0x3b7540['as'],'attributes':_0x3b7540['attributes'],'include':_0x3b7540[_0x7368('0x23')]?_[_0x7368('0x24')](_0x3b7540[_0x7368('0x23')],function(_0x2f10f2){return{'model':db[_0x2f10f2[_0x7368('0x25')]],'as':_0x2f10f2['as'],'attributes':_0x2f10f2[_0x7368('0x22')],'include':_0x2f10f2['include']?_[_0x7368('0x24')](_0x2f10f2['include'],function(_0x45f9d5){return{'model':db[_0x45f9d5[_0x7368('0x25')]],'as':_0x45f9d5['as'],'attributes':_0x45f9d5[_0x7368('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7368('0x12')](function(_0x28d7ff){logger['info'](_0x7368('0x26'),_0x497f3d);logger[_0x7368('0x16')](_0x7368('0x26'),_0x497f3d,JSON[_0x7368('0x27')](_0x28d7ff));_0x448e17(_0x28d7ff);})['catch'](function(_0x486a99){logger[_0x7368('0x19')](_0x7368('0x26'),_0x486a99['message'],_0x497f3d);_0x49d505(_0x9b92fd['error'](0x1f4,_0x486a99[_0x7368('0x1a')]));});});};exports[_0x7368('0x28')]=function(_0x21bae3){var _0x4b3cd9=this;return new Promise(function(_0x4e5dc5,_0x1ecee5){return db['VoiceQueue'][_0x7368('0x29')]({'raw':_0x21bae3['options']?_0x21bae3[_0x7368('0x1f')][_0x7368('0x20')]===undefined?!![]:![]:!![],'where':_0x21bae3[_0x7368('0x1f')]?_0x21bae3[_0x7368('0x1f')][_0x7368('0x21')]||null:null,'attributes':_0x21bae3[_0x7368('0x1f')]?_0x21bae3['options'][_0x7368('0x22')]||null:null,'include':_0x21bae3[_0x7368('0x1f')]?_0x21bae3['options'][_0x7368('0x23')]?_['map'](_0x21bae3[_0x7368('0x1f')]['include'],function(_0x516419){return{'model':db[_0x516419[_0x7368('0x25')]],'as':_0x516419['as'],'attributes':_0x516419[_0x7368('0x22')],'include':_0x516419[_0x7368('0x23')]?_['map'](_0x516419['include'],function(_0xdace20){return{'model':db[_0xdace20[_0x7368('0x25')]],'as':_0xdace20['as'],'attributes':_0xdace20[_0x7368('0x22')],'include':_0xdace20[_0x7368('0x23')]?_[_0x7368('0x24')](_0xdace20[_0x7368('0x23')],function(_0x6c7a0){return{'model':db[_0x6c7a0[_0x7368('0x25')]],'as':_0x6c7a0['as'],'attributes':_0x6c7a0[_0x7368('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7368('0x12')](function(_0x714e0f){logger[_0x7368('0x13')](_0x7368('0x28'),_0x21bae3);logger[_0x7368('0x16')]('ShowVoiceQueue',_0x21bae3,JSON[_0x7368('0x27')](_0x714e0f));_0x4e5dc5(_0x714e0f);})[_0x7368('0x1c')](function(_0x1ab72e){logger['error']('ShowVoiceQueue',_0x1ab72e[_0x7368('0x1a')],_0x21bae3);_0x1ecee5(_0x4b3cd9[_0x7368('0x19')](0x1f4,_0x1ab72e[_0x7368('0x1a')]));});});}; \ No newline at end of file +var _0x174b=['../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','options','raw','where','attributes','limit','include','map','model','ShowVoiceQueue','find','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2a56dc,_0x3d9117){var _0x5f465f=function(_0xb64e42){while(--_0xb64e42){_0x2a56dc['push'](_0x2a56dc['shift']());}};_0x5f465f(++_0x3d9117);}(_0x174b,0x1d9));var _0xb174=function(_0x3cfec4,_0x1c77c7){_0x3cfec4=_0x3cfec4-0x0;var _0x160f64=_0x174b[_0x3cfec4];return _0x160f64;};'use strict';var _=require('lodash');var util=require(_0xb174('0x0'));var moment=require(_0xb174('0x1'));var BPromise=require(_0xb174('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb174('0x3'))['db'];var utils=require(_0xb174('0x4'));var logger=require(_0xb174('0x5'))(_0xb174('0x6'));var config=require(_0xb174('0x7'));var jayson=require(_0xb174('0x8'));var client=jayson['client'][_0xb174('0x9')]({'port':0x232a});config[_0xb174('0xa')]=_[_0xb174('0xb')](config[_0xb174('0xa')],{'host':_0xb174('0xc'),'port':0x18eb});var socket=require(_0xb174('0xd'))(new Redis(config[_0xb174('0xa')]));require(_0xb174('0xe'))['register'](socket);function respondWithRpcPromise(_0x2d9501,_0x2da92d,_0x36fef7){return new BPromise(function(_0x6b134,_0x3f39ec){return client[_0xb174('0xf')](_0x2d9501,_0x36fef7)[_0xb174('0x10')](function(_0xc3ce50){logger[_0xb174('0x11')](_0xb174('0x12'),_0x2da92d,_0xb174('0x13'));logger[_0xb174('0x14')](_0xb174('0x15'),_0x2da92d,_0xb174('0x13'),JSON[_0xb174('0x16')](_0xc3ce50));if(_0xc3ce50[_0xb174('0x17')]){if(_0xc3ce50[_0xb174('0x17')][_0xb174('0x18')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x2da92d,_0xc3ce50['error']['message']);return _0x3f39ec(_0xc3ce50[_0xb174('0x17')]['message']);}logger[_0xb174('0x17')](_0xb174('0x12'),_0x2da92d,_0xc3ce50['error'][_0xb174('0x19')]);return _0x6b134(_0xc3ce50['error'][_0xb174('0x19')]);}else{logger['info'](_0xb174('0x12'),_0x2da92d,_0xb174('0x13'));_0x6b134(_0xc3ce50[_0xb174('0x1a')][_0xb174('0x19')]);}})[_0xb174('0x1b')](function(_0x6567f2){logger[_0xb174('0x17')](_0xb174('0x12'),_0x2da92d,_0x6567f2);_0x3f39ec(_0x6567f2);});});}exports[_0xb174('0x1c')]=function(_0x55b6e6){var _0x5f24b2=this;return new Promise(function(_0x152292,_0x255070){return db[_0xb174('0x1d')]['findAll']({'raw':_0x55b6e6[_0xb174('0x1e')]?_0x55b6e6[_0xb174('0x1e')][_0xb174('0x1f')]===undefined?!![]:![]:!![],'where':_0x55b6e6[_0xb174('0x1e')]?_0x55b6e6[_0xb174('0x1e')][_0xb174('0x20')]||null:null,'attributes':_0x55b6e6[_0xb174('0x1e')]?_0x55b6e6[_0xb174('0x1e')][_0xb174('0x21')]||null:null,'limit':_0x55b6e6['options']?_0x55b6e6['options'][_0xb174('0x22')]||null:null,'include':_0x55b6e6[_0xb174('0x1e')]?_0x55b6e6[_0xb174('0x1e')][_0xb174('0x23')]?_[_0xb174('0x24')](_0x55b6e6[_0xb174('0x1e')]['include'],function(_0x69da9d){return{'model':db[_0x69da9d[_0xb174('0x25')]],'as':_0x69da9d['as'],'attributes':_0x69da9d[_0xb174('0x21')],'include':_0x69da9d['include']?_['map'](_0x69da9d['include'],function(_0x4a12be){return{'model':db[_0x4a12be['model']],'as':_0x4a12be['as'],'attributes':_0x4a12be[_0xb174('0x21')],'include':_0x4a12be[_0xb174('0x23')]?_['map'](_0x4a12be[_0xb174('0x23')],function(_0xc5ce15){return{'model':db[_0xc5ce15[_0xb174('0x25')]],'as':_0xc5ce15['as'],'attributes':_0xc5ce15[_0xb174('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16b405){logger[_0xb174('0x11')]('GetVoiceQueue',_0x55b6e6);logger[_0xb174('0x14')](_0xb174('0x1c'),_0x55b6e6,JSON[_0xb174('0x16')](_0x16b405));_0x152292(_0x16b405);})[_0xb174('0x1b')](function(_0x1c4434){logger['error']('GetVoiceQueue',_0x1c4434[_0xb174('0x19')],_0x55b6e6);_0x255070(_0x5f24b2[_0xb174('0x17')](0x1f4,_0x1c4434['message']));});});};exports[_0xb174('0x26')]=function(_0x27a4c5){var _0x1bb9db=this;return new Promise(function(_0x777c65,_0x1087ae){return db[_0xb174('0x1d')][_0xb174('0x27')]({'raw':_0x27a4c5['options']?_0x27a4c5['options'][_0xb174('0x1f')]===undefined?!![]:![]:!![],'where':_0x27a4c5['options']?_0x27a4c5[_0xb174('0x1e')][_0xb174('0x20')]||null:null,'attributes':_0x27a4c5[_0xb174('0x1e')]?_0x27a4c5[_0xb174('0x1e')][_0xb174('0x21')]||null:null,'include':_0x27a4c5['options']?_0x27a4c5[_0xb174('0x1e')]['include']?_['map'](_0x27a4c5[_0xb174('0x1e')][_0xb174('0x23')],function(_0x10d232){return{'model':db[_0x10d232['model']],'as':_0x10d232['as'],'attributes':_0x10d232[_0xb174('0x21')],'include':_0x10d232[_0xb174('0x23')]?_[_0xb174('0x24')](_0x10d232[_0xb174('0x23')],function(_0x1239ac){return{'model':db[_0x1239ac[_0xb174('0x25')]],'as':_0x1239ac['as'],'attributes':_0x1239ac[_0xb174('0x21')],'include':_0x1239ac[_0xb174('0x23')]?_[_0xb174('0x24')](_0x1239ac[_0xb174('0x23')],function(_0x284362){return{'model':db[_0x284362[_0xb174('0x25')]],'as':_0x284362['as'],'attributes':_0x284362[_0xb174('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb174('0x10')](function(_0x57999d){logger['info'](_0xb174('0x26'),_0x27a4c5);logger[_0xb174('0x14')](_0xb174('0x26'),_0x27a4c5,JSON['stringify'](_0x57999d));_0x777c65(_0x57999d);})['catch'](function(_0x3299bd){logger[_0xb174('0x17')]('ShowVoiceQueue',_0x3299bd['message'],_0x27a4c5);_0x1087ae(_0x1bb9db[_0xb174('0x17')](0x1f4,_0x3299bd[_0xb174('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 93c4f0c..60f2327 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 _0x0fd7=['save','update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events'];(function(_0x4734d8,_0x479950){var _0x3b1120=function(_0x4a5d1c){while(--_0x4a5d1c){_0x4734d8['push'](_0x4734d8['shift']());}};_0x3b1120(++_0x479950);}(_0x0fd7,0x9f));var _0x70fd=function(_0x57ae48,_0x374483){_0x57ae48=_0x57ae48-0x0;var _0x8f54fa=_0x0fd7[_0x57ae48];return _0x8f54fa;};'use strict';var VoiceQueueEvents=require(_0x70fd('0x0'));var events=[_0x70fd('0x1'),'remove',_0x70fd('0x2')];function createListener(_0x3ceec6,_0x988732){return function(_0x379774){_0x988732[_0x70fd('0x3')](_0x3ceec6,_0x379774);};}function removeListener(_0x5db4b6,_0x40b5da){return function(){VoiceQueueEvents[_0x70fd('0x4')](_0x5db4b6,_0x40b5da);};}exports[_0x70fd('0x5')]=function(_0x59bca1){for(var _0x22e69a=0x0,_0x5b8588=events[_0x70fd('0x6')];_0x22e69a<_0x5b8588;_0x22e69a++){var _0xcbb663=events[_0x22e69a];var _0x430f38=createListener(_0x70fd('0x7')+_0xcbb663,_0x59bca1);VoiceQueueEvents['on'](_0xcbb663,_0x430f38);}}; \ No newline at end of file +var _0xe008=['update','removeListener','register','length','remove'];(function(_0x30f1aa,_0x4caac6){var _0x27ea5f=function(_0x5ea439){while(--_0x5ea439){_0x30f1aa['push'](_0x30f1aa['shift']());}};_0x27ea5f(++_0x4caac6);}(_0xe008,0xcc));var _0x8e00=function(_0x44a80f,_0x4e23cb){_0x44a80f=_0x44a80f-0x0;var _0x34ed16=_0xe008[_0x44a80f];return _0x34ed16;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save',_0x8e00('0x0'),_0x8e00('0x1')];function createListener(_0x42d683,_0x420621){return function(_0x45012f){_0x420621['emit'](_0x42d683,_0x45012f);};}function removeListener(_0x579641,_0x416494){return function(){VoiceQueueEvents[_0x8e00('0x2')](_0x579641,_0x416494);};}exports[_0x8e00('0x3')]=function(_0x328a68){for(var _0x34e7fe=0x0,_0x1b9c06=events[_0x8e00('0x4')];_0x34e7fe<_0x1b9c06;_0x34e7fe++){var _0x3975b4=events[_0x34e7fe];var _0x101d2b=createListener('voiceQueue:'+_0x3975b4,_0x328a68);VoiceQueueEvents['on'](_0x3975b4,_0x101d2b);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 9c738e8..65675a6 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 _0xf40b=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','/describe','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf40b,0xb0));var _0xbf40=function(_0x524efa,_0xbe406e){_0x524efa=_0x524efa-0x0;var _0x775cd5=_0xf40b[_0x524efa];return _0x775cd5;};'use strict';var multer=require('multer');var util=require(_0xbf40('0x0'));var path=require(_0xbf40('0x1'));var timeout=require(_0xbf40('0x2'));var express=require(_0xbf40('0x3'));var router=express['Router']();var auth=require(_0xbf40('0x4'));var interaction=require(_0xbf40('0x5'));var config=require(_0xbf40('0x6'));var controller=require(_0xbf40('0x7'));router[_0xbf40('0x8')]('/',auth['isAuthenticated'](),controller[_0xbf40('0x9')]);router[_0xbf40('0x8')](_0xbf40('0xa'),auth[_0xbf40('0xb')](),controller[_0xbf40('0xc')]);router['get'](_0xbf40('0xd'),auth[_0xbf40('0xb')](),controller[_0xbf40('0xe')]);router[_0xbf40('0x8')](_0xbf40('0xf'),auth[_0xbf40('0xb')](),controller[_0xbf40('0x10')]);router[_0xbf40('0x11')]('/',auth['isAuthenticated'](),controller[_0xbf40('0x12')]);router[_0xbf40('0x13')](_0xbf40('0xf'),auth[_0xbf40('0xb')](),controller[_0xbf40('0x14')]);router[_0xbf40('0x15')](_0xbf40('0xf'),auth[_0xbf40('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2581=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x42f7d1,_0x196c39){var _0x33ecba=function(_0x543d99){while(--_0x543d99){_0x42f7d1['push'](_0x42f7d1['shift']());}};_0x33ecba(++_0x196c39);}(_0x2581,0xcb));var _0x1258=function(_0x3a41a1,_0x1d954b){_0x3a41a1=_0x3a41a1-0x0;var _0x33455f=_0x2581[_0x3a41a1];return _0x33455f;};'use strict';var multer=require(_0x1258('0x0'));var util=require(_0x1258('0x1'));var path=require(_0x1258('0x2'));var timeout=require(_0x1258('0x3'));var express=require(_0x1258('0x4'));var router=express['Router']();var auth=require(_0x1258('0x5'));var interaction=require(_0x1258('0x6'));var config=require(_0x1258('0x7'));var controller=require(_0x1258('0x8'));router[_0x1258('0x9')]('/',auth[_0x1258('0xa')](),controller[_0x1258('0xb')]);router[_0x1258('0x9')]('/describe',auth[_0x1258('0xa')](),controller[_0x1258('0xc')]);router[_0x1258('0x9')](_0x1258('0xd'),auth[_0x1258('0xa')](),controller[_0x1258('0xe')]);router[_0x1258('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x1258('0xf')]);router[_0x1258('0x10')]('/',auth[_0x1258('0xa')](),controller[_0x1258('0x11')]);router['put'](_0x1258('0x12'),auth[_0x1258('0xa')](),controller[_0x1258('0x13')]);router[_0x1258('0x14')]('/:id',auth[_0x1258('0xa')](),controller[_0x1258('0x15')]);module[_0x1258('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 49aa9a3..00854e4 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 _0x6aba=['format','seconds','queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt'];(function(_0x430a22,_0x5ac1b9){var _0x399fbd=function(_0x50acc2){while(--_0x50acc2){_0x430a22['push'](_0x430a22['shift']());}};_0x399fbd(++_0x5ac1b9);}(_0x6aba,0x152));var _0xa6ab=function(_0x5aa94d,_0x569744){_0x5aa94d=_0x5aa94d-0x0;var _0x5d957e=_0x6aba[_0x5aa94d];return _0x5d957e;};'use strict';var Sequelize=require(_0xa6ab('0x0'));var moment=require(_0xa6ab('0x1'));module[_0xa6ab('0x2')]={'type':{'type':Sequelize[_0xa6ab('0x3')]},'uniqueid':{'type':Sequelize[_0xa6ab('0x3')]},'calleridnum':{'type':Sequelize[_0xa6ab('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xa6ab('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xa6ab('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xa6ab('0x4')],'set':function(_0x31b0bc){var _0x15c286=moment(_0x31b0bc);var _0x3b0cad=moment(this[_0xa6ab('0x5')](_0xa6ab('0x6')))[_0xa6ab('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0x252d42=_0x15c286['diff'](_0x3b0cad,_0xa6ab('0x8'));this['setDataValue'](_0xa6ab('0x9'),_0x31b0bc);this[_0xa6ab('0xa')](_0xa6ab('0xb'),_0x252d42||null);}},'position':{'type':Sequelize[_0xa6ab('0xc')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xa6ab('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xa6ab('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xa6ab('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xa6ab('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xa6ab('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xa6ab('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xa6ab('0x3')]},'connectedlinenum':{'type':Sequelize[_0xa6ab('0x3')]},'connectedlinename':{'type':Sequelize[_0xa6ab('0x3')]},'accountcode':{'type':Sequelize[_0xa6ab('0x3')]},'context':{'type':Sequelize[_0xa6ab('0x3')]},'exten':{'type':Sequelize[_0xa6ab('0x3')]},'priority':{'type':Sequelize[_0xa6ab('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xa6ab('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xa6ab('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xa6ab('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa6ab('0x3')],'comment':_0xa6ab('0xe')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xa6ab('0x3')]},'disposition':{'type':Sequelize[_0xa6ab('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xa6ab('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9402=['queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','DATE','sequelize','moment','exports','STRING','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue'];(function(_0x4623fa,_0xbdecc8){var _0x2714b3=function(_0x5e55c4){while(--_0x5e55c4){_0x4623fa['push'](_0x4623fa['shift']());}};_0x2714b3(++_0xbdecc8);}(_0x9402,0x14f));var _0x2940=function(_0x43d97b,_0x27951f){_0x43d97b=_0x43d97b-0x0;var _0x3ccced=_0x9402[_0x43d97b];return _0x3ccced;};'use strict';var Sequelize=require(_0x2940('0x0'));var moment=require(_0x2940('0x1'));module[_0x2940('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2940('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2940('0x3')]},'queue':{'type':Sequelize[_0x2940('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x2e249d){var _0x5233a1=moment(_0x2e249d);var _0x434e0d=moment(this['getDataValue'](_0x2940('0x4')))[_0x2940('0x5')](_0x2940('0x6'));var _0x50107d=_0x5233a1[_0x2940('0x7')](_0x434e0d,_0x2940('0x8'));this[_0x2940('0x9')](_0x2940('0xa'),_0x2e249d);this[_0x2940('0x9')](_0x2940('0xb'),_0x50107d||null);}},'position':{'type':Sequelize[_0x2940('0xc')]},'count':{'type':Sequelize[_0x2940('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x2940('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x2940('0xe')]},'queuecallercomplete':{'type':Sequelize[_0x2940('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x2940('0xe')]},'queuecallerexit':{'type':Sequelize[_0x2940('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x2940('0xe')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x2940('0xc')]},'channel':{'type':Sequelize[_0x2940('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x2940('0x3')]},'accountcode':{'type':Sequelize[_0x2940('0x3')]},'context':{'type':Sequelize[_0x2940('0x3')]},'exten':{'type':Sequelize[_0x2940('0x3')]},'priority':{'type':Sequelize[_0x2940('0x3')]},'holdtime':{'type':Sequelize[_0x2940('0xc')]},'mohtime':{'type':Sequelize[_0x2940('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2940('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x2940('0x3')]},'transfer':{'type':Sequelize[_0x2940('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2940('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x2940('0x3')]},'transferuniqueid':{'type':Sequelize[_0x2940('0x3')]},'disposition':{'type':Sequelize[_0x2940('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x2940('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 9c792d6..2d391c8 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 _0x7a54=['hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','describe','getVoiceQueuesReport','intersection','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x7a54,0x106));var _0x47a5=function(_0x3094e2,_0x4cc4be){_0x3094e2=_0x3094e2-0x0;var _0xa6f29f=_0x7a54[_0x3094e2];return _0xa6f29f;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}exports[_0x47a5('0x2b')]=function(_0x16631f,_0x361bfa){var _0x1127f8={},_0x11a4fa={},_0x3ad507={'count':0x0,'rows':[]};var _0x528582=_[_0x47a5('0x2c')](db['VoiceQueueReport'][_0x47a5('0x2d')],function(_0x9ac908){return{'name':_0x9ac908[_0x47a5('0x2e')],'type':_0x9ac908['type'][_0x47a5('0x2f')]};});_0x11a4fa[_0x47a5('0x30')]=_[_0x47a5('0x2c')](_0x528582,_0x47a5('0x29'));_0x11a4fa['query']=_['keys'](_0x16631f[_0x47a5('0x31')]);_0x11a4fa[_0x47a5('0x32')]=_['intersection'](_0x11a4fa['model'],_0x11a4fa[_0x47a5('0x31')]);_0x1127f8[_0x47a5('0x33')]=_['intersection'](_0x11a4fa[_0x47a5('0x30')],qs['fields'](_0x16631f[_0x47a5('0x31')][_0x47a5('0x34')]));_0x1127f8['attributes']=_0x1127f8['attributes'][_0x47a5('0x35')]?_0x1127f8['attributes']:_0x11a4fa[_0x47a5('0x30')];if(!_0x16631f[_0x47a5('0x31')][_0x47a5('0x36')]('nolimit')){_0x1127f8[_0x47a5('0x1f')]=qs['limit'](_0x16631f['query'][_0x47a5('0x1f')]);_0x1127f8['offset']=qs[_0x47a5('0x1e')](_0x16631f['query'][_0x47a5('0x1e')]);}_0x1127f8[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0x16631f[_0x47a5('0x31')][_0x47a5('0x38')]);_0x1127f8[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0x16631f[_0x47a5('0x31')],_0x11a4fa['filters']),_0x528582);if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x1127f8['where']=_[_0x47a5('0x3c')](_0x1127f8[_0x47a5('0x39')],{'$or':_[_0x47a5('0x2c')](_0x528582,function(_0x49c4b5){if(_0x49c4b5[_0x47a5('0x3d')]!==_0x47a5('0x3e')){var _0x596097={};_0x596097[_0x49c4b5[_0x47a5('0x29')]]={'$like':'%'+_0x16631f[_0x47a5('0x31')]['filter']+'%'};return _0x596097;}})});}_0x1127f8=_['merge']({},_0x1127f8,_0x16631f['options']);var _0x12d9f2={'where':_0x1127f8['where']};return db[_0x47a5('0x3f')][_0x47a5('0x1d')](_0x12d9f2)[_0x47a5('0x26')](function(_0x111f0d){_0x3ad507[_0x47a5('0x1d')]=_0x111f0d;if(_0x16631f[_0x47a5('0x31')][_0x47a5('0x40')]){_0x1127f8[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x1127f8);})[_0x47a5('0x26')](function(_0x1658e8){_0x3ad507[_0x47a5('0x43')]=_0x1658e8;return _0x3ad507;})['then'](respondWithFilteredResult(_0x361bfa,_0x1127f8))[_0x47a5('0x44')](handleError(_0x361bfa,null));};exports[_0x47a5('0x45')]=function(_0x331474,_0x23bd8d){var _0x586f4f={'raw':![],'where':{'id':_0x331474['params']['id']}},_0x7de536={};_0x7de536['model']=_['keys'](db['VoiceQueueReport'][_0x47a5('0x2d')]);_0x7de536['query']=_[_0x47a5('0x46')](_0x331474[_0x47a5('0x31')]);_0x7de536[_0x47a5('0x32')]=_['intersection'](_0x7de536[_0x47a5('0x30')],_0x7de536[_0x47a5('0x31')]);_0x586f4f['attributes']=_['intersection'](_0x7de536[_0x47a5('0x30')],qs['fields'](_0x331474[_0x47a5('0x31')][_0x47a5('0x34')]));_0x586f4f[_0x47a5('0x33')]=_0x586f4f[_0x47a5('0x33')][_0x47a5('0x35')]?_0x586f4f[_0x47a5('0x33')]:_0x7de536[_0x47a5('0x30')];if(_0x331474[_0x47a5('0x31')][_0x47a5('0x40')]){_0x586f4f[_0x47a5('0x41')]=[{'all':!![]}];}_0x586f4f=_[_0x47a5('0x3c')]({},_0x586f4f,_0x331474[_0x47a5('0x47')]);return db[_0x47a5('0x3f')][_0x47a5('0x48')](_0x586f4f)[_0x47a5('0x26')](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x26')](respondWithResult(_0x23bd8d,null))['catch'](handleError(_0x23bd8d,null));};exports[_0x47a5('0x49')]=function(_0x23bb04,_0x49eab1){return db['VoiceQueueReport'][_0x47a5('0x49')](_0x23bb04['body'],{})[_0x47a5('0x26')](respondWithResult(_0x49eab1,0xc9))[_0x47a5('0x44')](handleError(_0x49eab1,null));};exports['update']=function(_0x4f62d3,_0x3d85cc){if(_0x4f62d3['body']['id']){delete _0x4f62d3[_0x47a5('0x4a')]['id'];}return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x4f62d3[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x3d85cc,null))[_0x47a5('0x26')](saveUpdates(_0x4f62d3[_0x47a5('0x4a')],null))['then'](respondWithResult(_0x3d85cc,null))['catch'](handleError(_0x3d85cc,null));};exports[_0x47a5('0x25')]=function(_0x411230,_0x1163e3){return db[_0x47a5('0x3f')][_0x47a5('0x48')]({'where':{'id':_0x411230[_0x47a5('0x4b')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x1163e3,null))['then'](removeEntity(_0x1163e3,null))[_0x47a5('0x44')](handleError(_0x1163e3,null));};exports[_0x47a5('0x4c')]=function(_0x5f6a,_0x5c3c75){return db[_0x47a5('0x3f')]['describe']()[_0x47a5('0x26')](respondWithResult(_0x5c3c75,null))[_0x47a5('0x44')](handleError(_0x5c3c75,null));};exports[_0x47a5('0x4d')]=function(_0xf03bd5,_0x588551){var _0x3adf14={},_0x1e6de3={},_0x2f66e9={'count':0x0,'rows':[]};_0x1e6de3[_0x47a5('0x30')]=_[_0x47a5('0x46')](db[_0x47a5('0x3f')][_0x47a5('0x2d')]);_0x1e6de3['query']=_[_0x47a5('0x46')](_0xf03bd5[_0x47a5('0x31')]);_0x1e6de3[_0x47a5('0x32')]=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],_0x1e6de3[_0x47a5('0x31')]);_0x3adf14['attributes']=_[_0x47a5('0x4e')](_0x1e6de3[_0x47a5('0x30')],qs[_0x47a5('0x34')](_0xf03bd5['query'][_0x47a5('0x34')]));_0x3adf14[_0x47a5('0x33')]=_0x3adf14[_0x47a5('0x33')]['length']?_0x3adf14['attributes']:_0x1e6de3[_0x47a5('0x30')];if(!_0xf03bd5[_0x47a5('0x31')]['hasOwnProperty']('nolimit')){_0x3adf14[_0x47a5('0x1f')]=qs['limit'](_0xf03bd5[_0x47a5('0x31')]['limit']);_0x3adf14['offset']=qs[_0x47a5('0x1e')](_0xf03bd5[_0x47a5('0x31')]['offset']);}_0x3adf14[_0x47a5('0x37')]=qs[_0x47a5('0x38')](_0xf03bd5['query']['sort']);_0x3adf14[_0x47a5('0x39')]=qs[_0x47a5('0x32')](_[_0x47a5('0x3a')](_0xf03bd5[_0x47a5('0x31')],_0x1e6de3['filters']));if(_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]){_0x3adf14[_0x47a5('0x39')]=_['merge'](_0x3adf14[_0x47a5('0x39')],{'$or':_['map'](_0x3adf14[_0x47a5('0x33')],function(_0x470da6){var _0x943a15={};_0x943a15[_0x470da6]={'$like':'%'+_0xf03bd5[_0x47a5('0x31')][_0x47a5('0x3b')]+'%'};return _0x943a15;})});}_0x3adf14=_['merge']({},_0x3adf14,_0xf03bd5[_0x47a5('0x47')]);var _0x5d1550={'where':_0x3adf14['where']};return db['VoiceQueueReport']['count'](_0x5d1550)[_0x47a5('0x26')](function(_0x6cd4ea){_0x2f66e9[_0x47a5('0x1d')]=_0x6cd4ea;if(_0xf03bd5['query']['includeAll']){_0x3adf14[_0x47a5('0x41')]=[{'all':!![]}];}return db[_0x47a5('0x3f')][_0x47a5('0x42')](_0x3adf14);})[_0x47a5('0x26')](function(_0xc45e25){_0x2f66e9['rows']=_0xc45e25;return _0x2f66e9;})[_0x47a5('0x26')](respondWithFilteredResult(_0x588551,_0x3adf14,'getVoiceQueuesReport'))[_0x47a5('0x44')](handleError(_0x588551,null,_0x47a5('0x4d')));}; \ No newline at end of file +var _0x9957=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','set','json','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','VoiceQueueReport','count','include','catch','show','params','keys','length','includeAll','find','create','body','describe','getVoiceQueuesReport','fields','limit','rows','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];config[_0x7995('0x1a')]=_[_0x7995('0x1b')](config[_0x7995('0x1a')],{'host':_0x7995('0x1c'),'port':0x18eb});var socket=require(_0x7995('0x1d'))(new Redis(config[_0x7995('0x1a')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x2b4e94,_0x2233dd){_0x2233dd=_0x2233dd||0xcc;return function(_0x24b5bb){if(_0x24b5bb){return _0x2b4e94[_0x7995('0x1e')](_0x2233dd);}return _0x2b4e94[_0x7995('0x1f')](_0x2233dd)[_0x7995('0x20')]();};}function respondWithResult(_0x2202ce,_0x41cbf0){_0x41cbf0=_0x41cbf0||0xc8;return function(_0x5377e5){if(_0x5377e5){return _0x2202ce[_0x7995('0x1f')](_0x41cbf0)['json'](_0x5377e5);}};}function respondWithFilteredResult(_0x2f832e,_0x37f297){return function(_0x43d4b8){if(_0x43d4b8){var _0x291317=_0x43d4b8['count'],_0x1e1415=_0x37f297[_0x7995('0x21')],_0x37a7d4=_0x37f297['offset']+_0x37f297['limit'],_0x4faa60;if(_0x37a7d4>=_0x291317){_0x37a7d4=_0x291317;_0x4faa60=0xc8;}else{_0x4faa60=0xce;}_0x2f832e[_0x7995('0x1f')](_0x4faa60);return _0x2f832e[_0x7995('0x22')]('Content-Range',_0x1e1415+'-'+_0x37a7d4+'/'+_0x291317)[_0x7995('0x23')](_0x43d4b8);}return null;};}function patchUpdates(_0x51f276){return function(_0x4b1a8e){try{jsonpatch[_0x7995('0x24')](_0x4b1a8e,_0x51f276,!![]);}catch(_0x327b1f){return BPromise[_0x7995('0x25')](_0x327b1f);}return _0x4b1a8e[_0x7995('0x26')]();};}function saveUpdates(_0x460924,_0x1c278a){return function(_0x5d40ae){if(_0x5d40ae){return _0x5d40ae[_0x7995('0x27')](_0x460924)[_0x7995('0x28')](function(_0x204507){return _0x204507;});}return null;};}function removeEntity(_0x285437,_0x563799){return function(_0x13bc35){if(_0x13bc35){return _0x13bc35[_0x7995('0x29')]()[_0x7995('0x28')](function(){_0x285437['status'](0xcc)[_0x7995('0x20')]();});}};}function handleEntityNotFound(_0x34e70c,_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x34e70c[_0x7995('0x1e')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x2a')]);if(_0x47625f[_0x7995('0x2b')]){delete _0x47625f[_0x7995('0x2b')];}_0x2a307e[_0x7995('0x1f')](_0x56691a)[_0x7995('0x2c')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={},_0x3250e0={},_0x4253e5={'count':0x0,'rows':[]};var _0x574574=_['map'](db['VoiceQueueReport'][_0x7995('0x2d')],function(_0xe6b0b3){return{'name':_0xe6b0b3[_0x7995('0x2e')],'type':_0xe6b0b3[_0x7995('0x2f')][_0x7995('0x30')]};});_0x3250e0[_0x7995('0x31')]=_['map'](_0x574574,'name');_0x3250e0[_0x7995('0x32')]=_['keys'](_0x9b2a15[_0x7995('0x32')]);_0x3250e0[_0x7995('0x33')]=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],_0x3250e0[_0x7995('0x32')]);_0x456a28['attributes']=_[_0x7995('0x34')](_0x3250e0[_0x7995('0x31')],qs['fields'](_0x9b2a15['query']['fields']));_0x456a28[_0x7995('0x35')]=_0x456a28[_0x7995('0x35')]['length']?_0x456a28[_0x7995('0x35')]:_0x3250e0['model'];if(!_0x9b2a15[_0x7995('0x32')][_0x7995('0x36')](_0x7995('0x37'))){_0x456a28['limit']=qs['limit'](_0x9b2a15[_0x7995('0x32')]['limit']);_0x456a28['offset']=qs[_0x7995('0x21')](_0x9b2a15[_0x7995('0x32')]['offset']);}_0x456a28[_0x7995('0x38')]=qs[_0x7995('0x39')](_0x9b2a15[_0x7995('0x32')][_0x7995('0x39')]);_0x456a28[_0x7995('0x3a')]=qs['filters'](_[_0x7995('0x3b')](_0x9b2a15[_0x7995('0x32')],_0x3250e0[_0x7995('0x33')]),_0x574574);if(_0x9b2a15[_0x7995('0x32')]['filter']){_0x456a28[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x456a28[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x574574,function(_0x1f5bee){if(_0x1f5bee[_0x7995('0x2f')]!=='VIRTUAL'){var _0x183a68={};_0x183a68[_0x1f5bee[_0x7995('0x2b')]]={'$like':'%'+_0x9b2a15[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x183a68;}})});}_0x456a28=_[_0x7995('0x3c')]({},_0x456a28,_0x9b2a15[_0x7995('0x3f')]);var _0x14d638={'where':_0x456a28[_0x7995('0x3a')]};return db[_0x7995('0x40')][_0x7995('0x41')](_0x14d638)[_0x7995('0x28')](function(_0x270d52){_0x4253e5[_0x7995('0x41')]=_0x270d52;if(_0x9b2a15['query']['includeAll']){_0x456a28[_0x7995('0x42')]=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x456a28);})['then'](function(_0x3f8522){_0x4253e5['rows']=_0x3f8522;return _0x4253e5;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x43')](handleError(_0x514445,null));};exports[_0x7995('0x44')]=function(_0x35c8ff,_0x576b96){var _0x46ac4f={'raw':![],'where':{'id':_0x35c8ff[_0x7995('0x45')]['id']}},_0x5e85b9={};_0x5e85b9['model']=_['keys'](db[_0x7995('0x40')][_0x7995('0x2d')]);_0x5e85b9[_0x7995('0x32')]=_[_0x7995('0x46')](_0x35c8ff['query']);_0x5e85b9[_0x7995('0x33')]=_[_0x7995('0x34')](_0x5e85b9[_0x7995('0x31')],_0x5e85b9[_0x7995('0x32')]);_0x46ac4f['attributes']=_['intersection'](_0x5e85b9[_0x7995('0x31')],qs['fields'](_0x35c8ff[_0x7995('0x32')]['fields']));_0x46ac4f[_0x7995('0x35')]=_0x46ac4f['attributes'][_0x7995('0x47')]?_0x46ac4f[_0x7995('0x35')]:_0x5e85b9['model'];if(_0x35c8ff[_0x7995('0x32')][_0x7995('0x48')]){_0x46ac4f[_0x7995('0x42')]=[{'all':!![]}];}_0x46ac4f=_[_0x7995('0x3c')]({},_0x46ac4f,_0x35c8ff['options']);return db[_0x7995('0x40')][_0x7995('0x49')](_0x46ac4f)[_0x7995('0x28')](handleEntityNotFound(_0x576b96,null))['then'](respondWithResult(_0x576b96,null))[_0x7995('0x43')](handleError(_0x576b96,null));};exports[_0x7995('0x4a')]=function(_0x511567,_0x3d8ae3){return db[_0x7995('0x40')]['create'](_0x511567[_0x7995('0x4b')],{})[_0x7995('0x28')](respondWithResult(_0x3d8ae3,0xc9))['catch'](handleError(_0x3d8ae3,null));};exports[_0x7995('0x27')]=function(_0x5843ba,_0x1d87f9){if(_0x5843ba[_0x7995('0x4b')]['id']){delete _0x5843ba[_0x7995('0x4b')]['id'];}return db[_0x7995('0x40')][_0x7995('0x49')]({'where':{'id':_0x5843ba[_0x7995('0x45')]['id']}})[_0x7995('0x28')](handleEntityNotFound(_0x1d87f9,null))['then'](saveUpdates(_0x5843ba[_0x7995('0x4b')],null))[_0x7995('0x28')](respondWithResult(_0x1d87f9,null))[_0x7995('0x43')](handleError(_0x1d87f9,null));};exports['destroy']=function(_0x19da63,_0x1fe77e){return db[_0x7995('0x40')]['find']({'where':{'id':_0x19da63['params']['id']}})['then'](handleEntityNotFound(_0x1fe77e,null))[_0x7995('0x28')](removeEntity(_0x1fe77e,null))[_0x7995('0x43')](handleError(_0x1fe77e,null));};exports['describe']=function(_0x1cd85,_0x29f300){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x28')](respondWithResult(_0x29f300,null))['catch'](handleError(_0x29f300,null));};exports[_0x7995('0x4d')]=function(_0x4ab09f,_0x14fe7f){var _0x33c801={},_0x206d2a={},_0x50c7b5={'count':0x0,'rows':[]};_0x206d2a['model']=_['keys'](db['VoiceQueueReport'][_0x7995('0x2d')]);_0x206d2a[_0x7995('0x32')]=_[_0x7995('0x46')](_0x4ab09f[_0x7995('0x32')]);_0x206d2a[_0x7995('0x33')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],_0x206d2a[_0x7995('0x32')]);_0x33c801[_0x7995('0x35')]=_[_0x7995('0x34')](_0x206d2a[_0x7995('0x31')],qs[_0x7995('0x4e')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x4e')]));_0x33c801[_0x7995('0x35')]=_0x33c801[_0x7995('0x35')][_0x7995('0x47')]?_0x33c801[_0x7995('0x35')]:_0x206d2a[_0x7995('0x31')];if(!_0x4ab09f['query'][_0x7995('0x36')](_0x7995('0x37'))){_0x33c801[_0x7995('0x4f')]=qs[_0x7995('0x4f')](_0x4ab09f['query']['limit']);_0x33c801[_0x7995('0x21')]=qs[_0x7995('0x21')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x21')]);}_0x33c801['order']=qs[_0x7995('0x39')](_0x4ab09f[_0x7995('0x32')][_0x7995('0x39')]);_0x33c801[_0x7995('0x3a')]=qs['filters'](_['pick'](_0x4ab09f[_0x7995('0x32')],_0x206d2a[_0x7995('0x33')]));if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]){_0x33c801[_0x7995('0x3a')]=_[_0x7995('0x3c')](_0x33c801[_0x7995('0x3a')],{'$or':_[_0x7995('0x3d')](_0x33c801[_0x7995('0x35')],function(_0x50caf5){var _0x18f230={};_0x18f230[_0x50caf5]={'$like':'%'+_0x4ab09f[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x18f230;})});}_0x33c801=_[_0x7995('0x3c')]({},_0x33c801,_0x4ab09f['options']);var _0x51bf6a={'where':_0x33c801[_0x7995('0x3a')]};return db[_0x7995('0x40')]['count'](_0x51bf6a)[_0x7995('0x28')](function(_0x375fc9){_0x50c7b5[_0x7995('0x41')]=_0x375fc9;if(_0x4ab09f[_0x7995('0x32')][_0x7995('0x48')]){_0x33c801['include']=[{'all':!![]}];}return db[_0x7995('0x40')]['findAll'](_0x33c801);})[_0x7995('0x28')](function(_0xe31dcb){_0x50c7b5[_0x7995('0x50')]=_0xe31dcb;return _0x50c7b5;})[_0x7995('0x28')](respondWithFilteredResult(_0x14fe7f,_0x33c801,_0x7995('0x4d')))[_0x7995('0x43')](handleError(_0x14fe7f,null,_0x7995('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 047ef83..63d3558 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 _0xb41f=['events','VoiceQueueReport','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x1043c3,_0x42c46e){var _0x23e719=function(_0x51649d){while(--_0x51649d){_0x1043c3['push'](_0x1043c3['shift']());}};_0x23e719(++_0x42c46e);}(_0xb41f,0xd8));var _0xfb41=function(_0x3b0fd5,_0x5d29ba){_0x3b0fd5=_0x3b0fd5-0x0;var _0x25987f=_0xb41f[_0x3b0fd5];return _0x25987f;};'use strict';var EventEmitter=require(_0xfb41('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xfb41('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfb41('0x2'),'afterUpdate':_0xfb41('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3ac48b){return function(_0x46a9e1,_0x370255,_0x5039a8){VoiceQueueReportEvents[_0xfb41('0x4')](_0x3ac48b+':'+_0x46a9e1['id'],_0x46a9e1);VoiceQueueReportEvents[_0xfb41('0x4')](_0x3ac48b,_0x46a9e1);_0x5039a8(null);};}for(var e in events){if(events[_0xfb41('0x5')](e)){var event=events[e];VoiceQueueReport[_0xfb41('0x6')](e,emitEvent(event));}}module[_0xfb41('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x35d8=['exports','save','update','emit','hook'];(function(_0x2ebbdf,_0x46334b){var _0x421c66=function(_0x29456a){while(--_0x29456a){_0x2ebbdf['push'](_0x2ebbdf['shift']());}};_0x421c66(++_0x46334b);}(_0x35d8,0xc4));var _0x835d=function(_0x322da3,_0xb412d7){_0x322da3=_0x322da3-0x0;var _0x1f303d=_0x35d8[_0x322da3];return _0x1f303d;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x835d('0x0'),'afterUpdate':_0x835d('0x1'),'afterDestroy':'remove'};function emitEvent(_0x1f5fd0){return function(_0x4be49e,_0x29f2ef,_0x30dc7c){VoiceQueueReportEvents[_0x835d('0x2')](_0x1f5fd0+':'+_0x4be49e['id'],_0x4be49e);VoiceQueueReportEvents['emit'](_0x1f5fd0,_0x4be49e);_0x30dc7c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x835d('0x3')](e,emitEvent(event));}}module[_0x835d('0x4')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 8c9f8ad..c9158f5 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 _0xed47=['report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceQueueReport.attributes','define'];(function(_0xb94e6b,_0x5ea016){var _0x558f7a=function(_0x5893c0){while(--_0x5893c0){_0xb94e6b['push'](_0xb94e6b['shift']());}};_0x558f7a(++_0x5ea016);}(_0xed47,0x148));var _0x7ed4=function(_0x261153,_0x174df0){_0x261153=_0x261153-0x0;var _0x5402f9=_0xed47[_0x261153];return _0x5402f9;};'use strict';var _=require(_0x7ed4('0x0'));var util=require(_0x7ed4('0x1'));var logger=require(_0x7ed4('0x2'))(_0x7ed4('0x3'));var moment=require('moment');var BPromise=require(_0x7ed4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ed4('0x5'));var rimraf=require(_0x7ed4('0x6'));var config=require(_0x7ed4('0x7'));var attributes=require(_0x7ed4('0x8'));module['exports']=function(_0x24371c,_0x314092){return _0x24371c[_0x7ed4('0x9')]('VoiceQueueReport',attributes,{'tableName':_0x7ed4('0xa'),'paranoid':![],'indexes':[{'fields':[_0x7ed4('0xb')]},{'fields':[_0x7ed4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6f5b=['define','VoiceQueueReport','report_queue','calleridnum','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0xa0f69c,_0x2b07e8){var _0x540f04=function(_0x4c3866){while(--_0x4c3866){_0xa0f69c['push'](_0xa0f69c['shift']());}};_0x540f04(++_0x2b07e8);}(_0x6f5b,0xa0));var _0xb6f5=function(_0x5d03c7,_0x5f5725){_0x5d03c7=_0x5d03c7-0x0;var _0x4dd1e0=_0x6f5b[_0x5d03c7];return _0x4dd1e0;};'use strict';var _=require(_0xb6f5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb6f5('0x1'));var BPromise=require(_0xb6f5('0x2'));var rp=require(_0xb6f5('0x3'));var fs=require('fs');var path=require(_0xb6f5('0x4'));var rimraf=require(_0xb6f5('0x5'));var config=require(_0xb6f5('0x6'));var attributes=require(_0xb6f5('0x7'));module[_0xb6f5('0x8')]=function(_0x38412d,_0xf2d601){return _0x38412d[_0xb6f5('0x9')](_0xb6f5('0xa'),attributes,{'tableName':_0xb6f5('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xb6f5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 6dd78c5..0f02688 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 _0xb643=['error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','include','map','model','attributes','stringify','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','limit','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5ea12c,_0x2281ad){var _0x36c859=function(_0x272db5){while(--_0x272db5){_0x5ea12c['push'](_0x5ea12c['shift']());}};_0x36c859(++_0x2281ad);}(_0xb643,0x151));var _0x3b64=function(_0x472d62,_0x3b077f){_0x472d62=_0x472d62-0x0;var _0x58f9ec=_0xb643[_0x472d62];return _0x58f9ec;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3b64('0x0'));var BPromise=require(_0x3b64('0x1'));var rs=require(_0x3b64('0x2'));var fs=require('fs');var Redis=require(_0x3b64('0x3'));var db=require(_0x3b64('0x4'))['db'];var utils=require(_0x3b64('0x5'));var logger=require(_0x3b64('0x6'))(_0x3b64('0x7'));var config=require('../../config/environment');var jayson=require(_0x3b64('0x8'));var client=jayson[_0x3b64('0x9')][_0x3b64('0xa')]({'port':0x232a});config[_0x3b64('0xb')]=_[_0x3b64('0xc')](config['redis'],{'host':_0x3b64('0xd'),'port':0x18eb});var socket=require(_0x3b64('0xe'))(new Redis(config[_0x3b64('0xb')]));require(_0x3b64('0xf'))[_0x3b64('0x10')](socket);function respondWithRpcPromise(_0xe15698,_0x3f653d,_0x2e9118){return new BPromise(function(_0x4fc139,_0x57921c){return client[_0x3b64('0x11')](_0xe15698,_0x2e9118)[_0x3b64('0x12')](function(_0x45326c){logger[_0x3b64('0x13')](_0x3b64('0x14'),_0x3f653d,_0x3b64('0x15'));logger[_0x3b64('0x16')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x3f653d,'request\x20sent',JSON['stringify'](_0x45326c));if(_0x45326c[_0x3b64('0x17')]){if(_0x45326c[_0x3b64('0x17')][_0x3b64('0x18')]===0x1f4){logger[_0x3b64('0x17')](_0x3b64('0x14'),_0x3f653d,_0x45326c[_0x3b64('0x17')]['message']);return _0x57921c(_0x45326c['error'][_0x3b64('0x19')]);}logger[_0x3b64('0x17')](_0x3b64('0x14'),_0x3f653d,_0x45326c[_0x3b64('0x17')][_0x3b64('0x19')]);return _0x4fc139(_0x45326c[_0x3b64('0x17')][_0x3b64('0x19')]);}else{logger[_0x3b64('0x13')](_0x3b64('0x14'),_0x3f653d,_0x3b64('0x15'));_0x4fc139(_0x45326c[_0x3b64('0x1a')]['message']);}})[_0x3b64('0x1b')](function(_0x55ea9d){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x3f653d,_0x55ea9d);_0x57921c(_0x55ea9d);});});}exports[_0x3b64('0x1c')]=function(_0x30eeb1){var _0xb0ece9=this;return new Promise(function(_0x52aeae,_0x4366bd){return db[_0x3b64('0x1d')][_0x3b64('0x1e')]({'raw':_0x30eeb1[_0x3b64('0x1f')]?_0x30eeb1['options'][_0x3b64('0x20')]===undefined?!![]:![]:!![],'where':_0x30eeb1[_0x3b64('0x1f')]?_0x30eeb1['options'][_0x3b64('0x21')]||null:null,'attributes':_0x30eeb1[_0x3b64('0x1f')]?_0x30eeb1[_0x3b64('0x1f')]['attributes']||null:null,'limit':_0x30eeb1[_0x3b64('0x1f')]?_0x30eeb1['options']['limit']||null:null,'include':_0x30eeb1[_0x3b64('0x1f')]?_0x30eeb1[_0x3b64('0x1f')][_0x3b64('0x22')]?_[_0x3b64('0x23')](_0x30eeb1['options']['include'],function(_0x1dff9c){return{'model':db[_0x1dff9c[_0x3b64('0x24')]],'as':_0x1dff9c['as'],'attributes':_0x1dff9c[_0x3b64('0x25')],'include':_0x1dff9c[_0x3b64('0x22')]?_['map'](_0x1dff9c[_0x3b64('0x22')],function(_0x5a1374){return{'model':db[_0x5a1374[_0x3b64('0x24')]],'as':_0x5a1374['as'],'attributes':_0x5a1374[_0x3b64('0x25')],'include':_0x5a1374[_0x3b64('0x22')]?_[_0x3b64('0x23')](_0x5a1374[_0x3b64('0x22')],function(_0x46a98f){return{'model':db[_0x46a98f['model']],'as':_0x46a98f['as'],'attributes':_0x46a98f[_0x3b64('0x25')]};}):[]};}):[]};}):[]:[]})[_0x3b64('0x12')](function(_0x2ff8ac){logger['info'](_0x3b64('0x1c'),_0x30eeb1);logger[_0x3b64('0x16')](_0x3b64('0x1c'),_0x30eeb1,JSON[_0x3b64('0x26')](_0x2ff8ac));_0x52aeae(_0x2ff8ac);})[_0x3b64('0x1b')](function(_0x502004){logger['error']('GetVoiceQueueReport',_0x502004[_0x3b64('0x19')],_0x30eeb1);_0x4366bd(_0xb0ece9[_0x3b64('0x17')](0x1f4,_0x502004[_0x3b64('0x19')]));});});};exports[_0x3b64('0x27')]=function(_0x19b328){var _0x2947f8=this;return new Promise(function(_0x2945b0,_0x4458ce){return db[_0x3b64('0x1d')][_0x3b64('0x28')](_0x19b328[_0x3b64('0x29')],{'raw':_0x19b328['options']?_0x19b328[_0x3b64('0x1f')][_0x3b64('0x20')]===undefined?!![]:![]:!![]})[_0x3b64('0x12')](function(_0x5f0034){logger[_0x3b64('0x13')](_0x3b64('0x27'),_0x19b328);logger[_0x3b64('0x16')](_0x3b64('0x27'),_0x19b328,JSON[_0x3b64('0x26')](_0x5f0034));_0x2945b0(_0x5f0034);})['catch'](function(_0x4490bf){logger[_0x3b64('0x17')](_0x3b64('0x27'),_0x4490bf['message'],_0x19b328);_0x4458ce(_0x2947f8[_0x3b64('0x17')](0x1f4,_0x4490bf[_0x3b64('0x19')]));});});};exports[_0x3b64('0x2a')]=function(_0x5cbe2e){var _0x4de79a=this;return new Promise(function(_0x49b71f,_0xf8311d){return db[_0x3b64('0x1d')][_0x3b64('0x2b')](_0x5cbe2e[_0x3b64('0x29')],{'raw':_0x5cbe2e[_0x3b64('0x1f')]?_0x5cbe2e[_0x3b64('0x1f')][_0x3b64('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cbe2e[_0x3b64('0x1f')]?_0x5cbe2e[_0x3b64('0x1f')]['where']||null:null,'attributes':_0x5cbe2e[_0x3b64('0x1f')]?_0x5cbe2e[_0x3b64('0x1f')][_0x3b64('0x25')]||null:null,'limit':_0x5cbe2e[_0x3b64('0x1f')]?_0x5cbe2e['options'][_0x3b64('0x2c')]||null:null})[_0x3b64('0x12')](function(_0x461993){logger['info'](_0x3b64('0x2a'),_0x5cbe2e);logger[_0x3b64('0x16')]('UpdateVoiceQueueReport',_0x5cbe2e,JSON[_0x3b64('0x26')](_0x461993));_0x49b71f(_0x461993);})[_0x3b64('0x1b')](function(_0x42340a){logger[_0x3b64('0x17')]('UpdateVoiceQueueReport',_0x42340a[_0x3b64('0x19')],_0x5cbe2e);_0xf8311d(_0x4de79a[_0x3b64('0x17')](0x1f4,_0x42340a['message']));});});}; \ No newline at end of file +var _0x091e=['create','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','body','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceQueueReport','findAll','options','raw','where','attributes','include','map','model','catch','VoiceQueueReport'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x091e,0x16d));var _0xe091=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x091e[_0x4a3898];return _0x25ceb0;};'use strict';var _=require(_0xe091('0x0'));var util=require(_0xe091('0x1'));var moment=require(_0xe091('0x2'));var BPromise=require(_0xe091('0x3'));var rs=require(_0xe091('0x4'));var fs=require('fs');var Redis=require(_0xe091('0x5'));var db=require(_0xe091('0x6'))['db'];var utils=require(_0xe091('0x7'));var logger=require('../../config/logger')(_0xe091('0x8'));var config=require(_0xe091('0x9'));var jayson=require(_0xe091('0xa'));var client=jayson[_0xe091('0xb')][_0xe091('0xc')]({'port':0x232a});config['redis']=_[_0xe091('0xd')](config['redis'],{'host':_0xe091('0xe'),'port':0x18eb});var socket=require(_0xe091('0xf'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0xe091('0x10')](socket);function respondWithRpcPromise(_0x5de712,_0x46787e,_0x2a62fb){return new BPromise(function(_0x4d317c,_0x1ffe68){return client[_0xe091('0x11')](_0x5de712,_0x2a62fb)[_0xe091('0x12')](function(_0x2ffcd8){logger[_0xe091('0x13')](_0xe091('0x14'),_0x46787e,'request\x20sent');logger[_0xe091('0x15')](_0xe091('0x16'),_0x46787e,_0xe091('0x17'),JSON[_0xe091('0x18')](_0x2ffcd8));if(_0x2ffcd8['error']){if(_0x2ffcd8[_0xe091('0x19')][_0xe091('0x1a')]===0x1f4){logger[_0xe091('0x19')]('VoiceQueueReport,\x20%s,\x20%s',_0x46787e,_0x2ffcd8[_0xe091('0x19')]['message']);return _0x1ffe68(_0x2ffcd8[_0xe091('0x19')]['message']);}logger[_0xe091('0x19')](_0xe091('0x14'),_0x46787e,_0x2ffcd8['error'][_0xe091('0x1b')]);return _0x4d317c(_0x2ffcd8[_0xe091('0x19')][_0xe091('0x1b')]);}else{logger['info'](_0xe091('0x14'),_0x46787e,_0xe091('0x17'));_0x4d317c(_0x2ffcd8[_0xe091('0x1c')][_0xe091('0x1b')]);}})['catch'](function(_0x42b99a){logger[_0xe091('0x19')](_0xe091('0x14'),_0x46787e,_0x42b99a);_0x1ffe68(_0x42b99a);});});}exports[_0xe091('0x1d')]=function(_0x254bfd){var _0x35e0ca=this;return new Promise(function(_0xd391cf,_0x52ba7e){return db['VoiceQueueReport'][_0xe091('0x1e')]({'raw':_0x254bfd[_0xe091('0x1f')]?_0x254bfd[_0xe091('0x1f')][_0xe091('0x20')]===undefined?!![]:![]:!![],'where':_0x254bfd['options']?_0x254bfd['options'][_0xe091('0x21')]||null:null,'attributes':_0x254bfd[_0xe091('0x1f')]?_0x254bfd[_0xe091('0x1f')][_0xe091('0x22')]||null:null,'limit':_0x254bfd['options']?_0x254bfd['options']['limit']||null:null,'include':_0x254bfd[_0xe091('0x1f')]?_0x254bfd['options'][_0xe091('0x23')]?_[_0xe091('0x24')](_0x254bfd[_0xe091('0x1f')][_0xe091('0x23')],function(_0x3d5b4c){return{'model':db[_0x3d5b4c[_0xe091('0x25')]],'as':_0x3d5b4c['as'],'attributes':_0x3d5b4c[_0xe091('0x22')],'include':_0x3d5b4c['include']?_[_0xe091('0x24')](_0x3d5b4c['include'],function(_0x1ac1a3){return{'model':db[_0x1ac1a3['model']],'as':_0x1ac1a3['as'],'attributes':_0x1ac1a3['attributes'],'include':_0x1ac1a3[_0xe091('0x23')]?_[_0xe091('0x24')](_0x1ac1a3[_0xe091('0x23')],function(_0x478090){return{'model':db[_0x478090[_0xe091('0x25')]],'as':_0x478090['as'],'attributes':_0x478090[_0xe091('0x22')]};}):[]};}):[]};}):[]:[]})[_0xe091('0x12')](function(_0x2ecf18){logger[_0xe091('0x13')](_0xe091('0x1d'),_0x254bfd);logger[_0xe091('0x15')](_0xe091('0x1d'),_0x254bfd,JSON[_0xe091('0x18')](_0x2ecf18));_0xd391cf(_0x2ecf18);})[_0xe091('0x26')](function(_0x448f3c){logger[_0xe091('0x19')]('GetVoiceQueueReport',_0x448f3c[_0xe091('0x1b')],_0x254bfd);_0x52ba7e(_0x35e0ca[_0xe091('0x19')](0x1f4,_0x448f3c[_0xe091('0x1b')]));});});};exports['CreateVoiceQueueReport']=function(_0x1c7075){var _0x23fdc2=this;return new Promise(function(_0x4ce657,_0x4c0157){return db[_0xe091('0x27')][_0xe091('0x28')](_0x1c7075['body'],{'raw':_0x1c7075[_0xe091('0x1f')]?_0x1c7075['options'][_0xe091('0x20')]===undefined?!![]:![]:!![]})[_0xe091('0x12')](function(_0x2ea946){logger[_0xe091('0x13')](_0xe091('0x29'),_0x1c7075);logger[_0xe091('0x15')](_0xe091('0x29'),_0x1c7075,JSON['stringify'](_0x2ea946));_0x4ce657(_0x2ea946);})[_0xe091('0x26')](function(_0x543111){logger[_0xe091('0x19')]('CreateVoiceQueueReport',_0x543111[_0xe091('0x1b')],_0x1c7075);_0x4c0157(_0x23fdc2['error'](0x1f4,_0x543111[_0xe091('0x1b')]));});});};exports[_0xe091('0x2a')]=function(_0x5c1e56){var _0x3fa1e2=this;return new Promise(function(_0x27410a,_0x10a528){return db[_0xe091('0x27')][_0xe091('0x2b')](_0x5c1e56[_0xe091('0x2c')],{'raw':_0x5c1e56[_0xe091('0x1f')]?_0x5c1e56['options'][_0xe091('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c1e56[_0xe091('0x1f')]?_0x5c1e56[_0xe091('0x1f')][_0xe091('0x21')]||null:null,'attributes':_0x5c1e56[_0xe091('0x1f')]?_0x5c1e56[_0xe091('0x1f')]['attributes']||null:null,'limit':_0x5c1e56[_0xe091('0x1f')]?_0x5c1e56[_0xe091('0x1f')]['limit']||null:null})[_0xe091('0x12')](function(_0x359cd8){logger[_0xe091('0x13')]('UpdateVoiceQueueReport',_0x5c1e56);logger[_0xe091('0x15')](_0xe091('0x2a'),_0x5c1e56,JSON[_0xe091('0x18')](_0x359cd8));_0x27410a(_0x359cd8);})[_0xe091('0x26')](function(_0x54a8be){logger[_0xe091('0x19')](_0xe091('0x2a'),_0x54a8be['message'],_0x5c1e56);_0x10a528(_0x3fa1e2[_0xe091('0x19')](0x1f4,_0x54a8be['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 521bdfd..d019506 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 _0x76fa=['length','voiceQueueReport:','remove','update','emit','removeListener','register'];(function(_0x873f6c,_0x111311){var _0x286710=function(_0x1e9bcc){while(--_0x1e9bcc){_0x873f6c['push'](_0x873f6c['shift']());}};_0x286710(++_0x111311);}(_0x76fa,0xaa));var _0xa76f=function(_0x174f6e,_0xcd7297){_0x174f6e=_0x174f6e-0x0;var _0x19a1d7=_0x76fa[_0x174f6e];return _0x19a1d7;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save',_0xa76f('0x0'),_0xa76f('0x1')];function createListener(_0x41a01e,_0x4217a7){return function(_0x30fc60){_0x4217a7[_0xa76f('0x2')](_0x41a01e,_0x30fc60);};}function removeListener(_0x8b61b7,_0x59b2bd){return function(){VoiceQueueReportEvents[_0xa76f('0x3')](_0x8b61b7,_0x59b2bd);};}exports[_0xa76f('0x4')]=function(_0x17193a){for(var _0x47cf0c=0x0,_0x4d9a21=events[_0xa76f('0x5')];_0x47cf0c<_0x4d9a21;_0x47cf0c++){var _0x16ddf3=events[_0x47cf0c];var _0x50322c=createListener(_0xa76f('0x6')+_0x16ddf3,_0x17193a);VoiceQueueReportEvents['on'](_0x16ddf3,_0x50322c);}}; \ No newline at end of file +var _0x38fb=['emit','removeListener','register','length','./voiceQueueReport.events','save','remove','update'];(function(_0x31d423,_0x45de45){var _0x28c00d=function(_0x9bde8a){while(--_0x9bde8a){_0x31d423['push'](_0x31d423['shift']());}};_0x28c00d(++_0x45de45);}(_0x38fb,0x6c));var _0xb38f=function(_0x29733c,_0x2da30b){_0x29733c=_0x29733c-0x0;var _0x49e72f=_0x38fb[_0x29733c];return _0x49e72f;};'use strict';var VoiceQueueReportEvents=require(_0xb38f('0x0'));var events=[_0xb38f('0x1'),_0xb38f('0x2'),_0xb38f('0x3')];function createListener(_0x2deb6e,_0x25f5c1){return function(_0xf21260){_0x25f5c1[_0xb38f('0x4')](_0x2deb6e,_0xf21260);};}function removeListener(_0x2a5ea3,_0x116d13){return function(){VoiceQueueReportEvents[_0xb38f('0x5')](_0x2a5ea3,_0x116d13);};}exports[_0xb38f('0x6')]=function(_0x4afce){for(var _0xc542f4=0x0,_0x5ef990=events[_0xb38f('0x7')];_0xc542f4<_0x5ef990;_0xc542f4++){var _0x2ef19c=events[_0xc542f4];var _0x3ee0f0=createListener('voiceQueueReport:'+_0x2ef19c,_0x4afce);VoiceQueueReportEvents['on'](_0x2ef19c,_0x3ee0f0);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 3750e35..522829e 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 _0x5294=['/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get'];(function(_0x45cb10,_0x40a5e0){var _0x16c0b2=function(_0x1ca44d){while(--_0x1ca44d){_0x45cb10['push'](_0x45cb10['shift']());}};_0x16c0b2(++_0x40a5e0);}(_0x5294,0x111));var _0x4529=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x5294[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x4529('0x0'));var util=require(_0x4529('0x1'));var path=require(_0x4529('0x2'));var timeout=require(_0x4529('0x3'));var express=require(_0x4529('0x4'));var router=express[_0x4529('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x4529('0x6'));var config=require(_0x4529('0x7'));var controller=require(_0x4529('0x8'));router['get']('/',auth[_0x4529('0x9')](),controller[_0x4529('0xa')]);router[_0x4529('0xb')](_0x4529('0xc'),auth['isAuthenticated'](),controller[_0x4529('0xd')]);router[_0x4529('0xe')]('/',auth[_0x4529('0x9')](),controller['create']);router['put']('/:id',auth[_0x4529('0x9')](),controller[_0x4529('0xf')]);router[_0x4529('0x10')]('/:id',auth[_0x4529('0x9')](),controller[_0x4529('0x11')]);module[_0x4529('0x12')]=router; \ No newline at end of file +var _0x3f10=['get','/:id','show','post','create','update','delete','destroy','exports','multer','express','Router','../../components/interaction/service','./voiceQueuesLog.controller','isAuthenticated','index'];(function(_0x470f24,_0x2436a9){var _0x2c6fc8=function(_0x3ef190){while(--_0x3ef190){_0x470f24['push'](_0x470f24['shift']());}};_0x2c6fc8(++_0x2436a9);}(_0x3f10,0x69));var _0x03f1=function(_0x89dc5a,_0x1f9a6a){_0x89dc5a=_0x89dc5a-0x0;var _0x3b810e=_0x3f10[_0x89dc5a];return _0x3b810e;};'use strict';var multer=require(_0x03f1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x03f1('0x1'));var router=express[_0x03f1('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x03f1('0x3'));var config=require('../../config/environment');var controller=require(_0x03f1('0x4'));router['get']('/',auth[_0x03f1('0x5')](),controller[_0x03f1('0x6')]);router[_0x03f1('0x7')](_0x03f1('0x8'),auth['isAuthenticated'](),controller[_0x03f1('0x9')]);router[_0x03f1('0xa')]('/',auth[_0x03f1('0x5')](),controller[_0x03f1('0xb')]);router['put'](_0x03f1('0x8'),auth[_0x03f1('0x5')](),controller[_0x03f1('0xc')]);router[_0x03f1('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x03f1('0xe')]);module[_0x03f1('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 37543bb..53b511b 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 _0x9883=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','STRING','DATE'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0x9883,0x15b));var _0x3988=function(_0x42f039,_0x196ad7){_0x42f039=_0x42f039-0x0;var _0x796342=_0x9883[_0x42f039];return _0x796342;};'use strict';var Sequelize=require(_0x3988('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0x3988('0x1')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x3988('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x3988('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x3988('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x3988('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x3988('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x3988('0x2')],'allowNull':![],'defaultValue':moment()[_0x3988('0x3')](_0x3988('0x4'))}}; \ No newline at end of file +var _0x299c=['STRING','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment'];(function(_0x4f005b,_0x46904d){var _0x121ad7=function(_0x5ef99a){while(--_0x5ef99a){_0x4f005b['push'](_0x4f005b['shift']());}};_0x121ad7(++_0x46904d);}(_0x299c,0x15c));var _0xc299=function(_0x5ba1cd,_0x495124){_0x5ba1cd=_0x5ba1cd-0x0;var _0x477409=_0x299c[_0x5ba1cd];return _0x477409;};'use strict';var Sequelize=require(_0xc299('0x0'));var moment=require(_0xc299('0x1'));module['exports']={'time':{'type':Sequelize[_0xc299('0x2')]},'callid':{'type':Sequelize[_0xc299('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xc299('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xc299('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xc299('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xc299('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xc299('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0xc299('0x3')](_0xc299('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 849d122..8a0f6f6 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 _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x340aa5,_0x2d5553){var _0x3a5b7f=function(_0x23758f){while(--_0x23758f){_0x340aa5['push'](_0x340aa5['shift']());}};_0x3a5b7f(++_0x2d5553);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file +var _0xa9e0=['sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit'];(function(_0x4701cd,_0xc24fda){var _0x324b93=function(_0xfa3426){while(--_0xfa3426){_0x4701cd['push'](_0x4701cd['shift']());}};_0x324b93(++_0xc24fda);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];function respondWithStatusCode(_0x36471c,_0xd5b662){_0xd5b662=_0xd5b662||0xcc;return function(_0x26d672){if(_0x26d672){return _0x36471c[_0x0a9e('0x14')](_0xd5b662);}return _0x36471c[_0x0a9e('0x15')](_0xd5b662)['end']();};}function respondWithResult(_0x4283ce,_0x239b12){_0x239b12=_0x239b12||0xc8;return function(_0x2b4227){if(_0x2b4227){return _0x4283ce[_0x0a9e('0x15')](_0x239b12)[_0x0a9e('0x16')](_0x2b4227);}};}function respondWithFilteredResult(_0x4d5611,_0x52a03d){return function(_0x22dccb){if(_0x22dccb){var _0x5d0880=_0x22dccb[_0x0a9e('0x17')],_0x1985b6=_0x52a03d['offset'],_0x519dfd=_0x52a03d[_0x0a9e('0x18')]+_0x52a03d['limit'],_0x16033c;if(_0x519dfd>=_0x5d0880){_0x519dfd=_0x5d0880;_0x16033c=0xc8;}else{_0x16033c=0xce;}_0x4d5611[_0x0a9e('0x15')](_0x16033c);return _0x4d5611[_0x0a9e('0x19')](_0x0a9e('0x1a'),_0x1985b6+'-'+_0x519dfd+'/'+_0x5d0880)[_0x0a9e('0x16')](_0x22dccb);}return null;};}function patchUpdates(_0x31b1ca){return function(_0x2eb11f){try{jsonpatch[_0x0a9e('0x1b')](_0x2eb11f,_0x31b1ca,!![]);}catch(_0x20559e){return BPromise[_0x0a9e('0x1c')](_0x20559e);}return _0x2eb11f[_0x0a9e('0x1d')]();};}function saveUpdates(_0x1c696a,_0x105080){return function(_0x4bb1e3){if(_0x4bb1e3){return _0x4bb1e3[_0x0a9e('0x1e')](_0x1c696a)[_0x0a9e('0x1f')](function(_0x53682f){return _0x53682f;});}return null;};}function removeEntity(_0x20f109,_0x5a09ef){return function(_0x588269){if(_0x588269){return _0x588269[_0x0a9e('0x20')]()[_0x0a9e('0x1f')](function(){_0x20f109[_0x0a9e('0x15')](0xcc)[_0x0a9e('0x21')]();});}};}function handleEntityNotFound(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(!_0x2fb0e4){_0x4abc77[_0x0a9e('0x14')](0x194);}return _0x2fb0e4;};}function handleError(_0x4d00e6,_0x370d86){_0x370d86=_0x370d86||0x1f4;return function(_0x42ac8f){logger[_0x0a9e('0x22')](_0x42ac8f['stack']);if(_0x42ac8f['name']){delete _0x42ac8f[_0x0a9e('0x23')];}_0x4d00e6[_0x0a9e('0x15')](_0x370d86)[_0x0a9e('0x24')](_0x42ac8f);};}exports[_0x0a9e('0x25')]=function(_0x526cf3,_0x384319){var _0x479bc4={},_0x45a1e7={},_0x5bfb33={'count':0x0,'rows':[]};var _0x1dc186=_[_0x0a9e('0x26')](db[_0x0a9e('0x27')][_0x0a9e('0x28')],function(_0x140511){return{'name':_0x140511[_0x0a9e('0x29')],'type':_0x140511[_0x0a9e('0x2a')][_0x0a9e('0x2b')]};});_0x45a1e7['model']=_[_0x0a9e('0x26')](_0x1dc186,_0x0a9e('0x23'));_0x45a1e7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x526cf3['query']);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],_0x45a1e7[_0x0a9e('0x2c')]);_0x479bc4[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x45a1e7[_0x0a9e('0x30')],qs[_0x0a9e('0x32')](_0x526cf3[_0x0a9e('0x2c')]['fields']));_0x479bc4[_0x0a9e('0x31')]=_0x479bc4['attributes'][_0x0a9e('0x33')]?_0x479bc4[_0x0a9e('0x31')]:_0x45a1e7[_0x0a9e('0x30')];if(!_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x34')]('nolimit')){_0x479bc4[_0x0a9e('0x35')]=qs[_0x0a9e('0x35')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x35')]);_0x479bc4[_0x0a9e('0x18')]=qs[_0x0a9e('0x18')](_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x18')]);}_0x479bc4['order']=qs[_0x0a9e('0x36')](_0x526cf3['query'][_0x0a9e('0x36')]);_0x479bc4[_0x0a9e('0x37')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x38')](_0x526cf3['query'],_0x45a1e7[_0x0a9e('0x2e')]),_0x1dc186);if(_0x526cf3[_0x0a9e('0x2c')][_0x0a9e('0x39')]){_0x479bc4[_0x0a9e('0x37')]=_['merge'](_0x479bc4['where'],{'$or':_[_0x0a9e('0x26')](_0x1dc186,function(_0x5640eb){if(_0x5640eb[_0x0a9e('0x2a')]!==_0x0a9e('0x3a')){var _0x381c37={};_0x381c37[_0x5640eb[_0x0a9e('0x23')]]={'$like':'%'+_0x526cf3['query'][_0x0a9e('0x39')]+'%'};return _0x381c37;}})});}_0x479bc4=_[_0x0a9e('0x3b')]({},_0x479bc4,_0x526cf3[_0x0a9e('0x3c')]);var _0x533942={'where':_0x479bc4[_0x0a9e('0x37')]};return db[_0x0a9e('0x27')][_0x0a9e('0x17')](_0x533942)['then'](function(_0x546ef8){_0x5bfb33[_0x0a9e('0x17')]=_0x546ef8;if(_0x526cf3[_0x0a9e('0x2c')]['includeAll']){_0x479bc4[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x27')][_0x0a9e('0x3e')](_0x479bc4);})[_0x0a9e('0x1f')](function(_0x4b38d9){_0x5bfb33['rows']=_0x4b38d9;return _0x5bfb33;})[_0x0a9e('0x1f')](respondWithFilteredResult(_0x384319,_0x479bc4))[_0x0a9e('0x3f')](handleError(_0x384319,null));};exports['show']=function(_0x183991,_0x1dec2e){var _0x1459bb={'raw':!![],'where':{'id':_0x183991[_0x0a9e('0x40')]['id']}},_0x5b4f5e={};_0x5b4f5e[_0x0a9e('0x30')]=_[_0x0a9e('0x2d')](db[_0x0a9e('0x27')][_0x0a9e('0x28')]);_0x5b4f5e[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x183991[_0x0a9e('0x2c')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],_0x5b4f5e[_0x0a9e('0x2c')]);_0x1459bb[_0x0a9e('0x31')]=_[_0x0a9e('0x2f')](_0x5b4f5e[_0x0a9e('0x30')],qs['fields'](_0x183991['query'][_0x0a9e('0x32')]));_0x1459bb[_0x0a9e('0x31')]=_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x33')]?_0x1459bb[_0x0a9e('0x31')]:_0x5b4f5e[_0x0a9e('0x30')];if(_0x183991[_0x0a9e('0x2c')][_0x0a9e('0x41')]){_0x1459bb[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x1459bb=_[_0x0a9e('0x3b')]({},_0x1459bb,_0x183991[_0x0a9e('0x3c')]);return db[_0x0a9e('0x27')]['find'](_0x1459bb)[_0x0a9e('0x1f')](handleEntityNotFound(_0x1dec2e,null))[_0x0a9e('0x1f')](respondWithResult(_0x1dec2e,null))[_0x0a9e('0x3f')](handleError(_0x1dec2e,null));};exports[_0x0a9e('0x42')]=function(_0x2e8caf,_0xbe9d19){return db[_0x0a9e('0x27')][_0x0a9e('0x42')](_0x2e8caf['body'],{})[_0x0a9e('0x1f')](respondWithResult(_0xbe9d19,0xc9))['catch'](handleError(_0xbe9d19,null));};exports[_0x0a9e('0x1e')]=function(_0x476688,_0x8d6dd1){if(_0x476688['body']['id']){delete _0x476688[_0x0a9e('0x43')]['id'];}return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x476688[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x8d6dd1,null))[_0x0a9e('0x1f')](saveUpdates(_0x476688[_0x0a9e('0x43')],null))['then'](respondWithResult(_0x8d6dd1,null))[_0x0a9e('0x3f')](handleError(_0x8d6dd1,null));};exports[_0x0a9e('0x20')]=function(_0x1b5e80,_0x16f976){return db[_0x0a9e('0x27')][_0x0a9e('0x44')]({'where':{'id':_0x1b5e80[_0x0a9e('0x40')]['id']}})[_0x0a9e('0x1f')](handleEntityNotFound(_0x16f976,null))[_0x0a9e('0x1f')](removeEntity(_0x16f976,null))['catch'](handleError(_0x16f976,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 3ff8c14..48ba4ad 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 _0x814b=['event','dtm','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm'];(function(_0x59ca6e,_0x312d64){var _0x11efee=function(_0x1e99db){while(--_0x1e99db){_0x59ca6e['push'](_0x59ca6e['shift']());}};_0x11efee(++_0x312d64);}(_0x814b,0x1a2));var _0xb814=function(_0x17a647,_0x2bbe12){_0x17a647=_0x17a647-0x0;var _0x219a38=_0x814b[_0x17a647];return _0x219a38;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xe'),_0xb814('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x038b=['util','../../config/logger','api','bluebird','path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','dtm'];(function(_0x189d79,_0x470d4e){var _0x481205=function(_0x5eb39b){while(--_0x5eb39b){_0x189d79['push'](_0x189d79['shift']());}};_0x481205(++_0x470d4e);}(_0x038b,0x114));var _0xb038=function(_0x543a22,_0x40534d){_0x543a22=_0x543a22-0x0;var _0x5bc5e9=_0x038b[_0x543a22];return _0x5bc5e9;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));module[_0xb038('0x7')]=function(_0x4fe092,_0x54e1e7){return _0x4fe092[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':_0xb038('0xa'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':['event',_0xb038('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 1f78ee7..3784e8a 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 _0x1eba=['then','info','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueuesLog,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x5a7e3c,_0xdc9219){_0x5a7e3c=_0x5a7e3c-0x0;var _0x59252b=_0x1eba[_0x5a7e3c];return _0x59252b;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var moment=require(_0xa1eb('0x2'));var BPromise=require(_0xa1eb('0x3'));var rs=require(_0xa1eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa1eb('0x5'));var logger=require(_0xa1eb('0x6'))(_0xa1eb('0x7'));var config=require(_0xa1eb('0x8'));var jayson=require(_0xa1eb('0x9'));var client=jayson[_0xa1eb('0xa')][_0xa1eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bfbb0,_0x39a5a3,_0x7d2982){return new BPromise(function(_0x2aebb6,_0x9d7113){return client['request'](_0x2bfbb0,_0x7d2982)[_0xa1eb('0xc')](function(_0x4d4aaf){logger[_0xa1eb('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x39a5a3,_0xa1eb('0xe'));logger['debug'](_0xa1eb('0xf'),_0x39a5a3,'request\x20sent',JSON[_0xa1eb('0x10')](_0x4d4aaf));if(_0x4d4aaf[_0xa1eb('0x11')]){if(_0x4d4aaf[_0xa1eb('0x11')]['code']===0x1f4){logger[_0xa1eb('0x11')](_0xa1eb('0x12'),_0x39a5a3,_0x4d4aaf['error'][_0xa1eb('0x13')]);return _0x9d7113(_0x4d4aaf['error']['message']);}logger[_0xa1eb('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x39a5a3,_0x4d4aaf[_0xa1eb('0x11')][_0xa1eb('0x13')]);return _0x2aebb6(_0x4d4aaf[_0xa1eb('0x11')][_0xa1eb('0x13')]);}else{logger[_0xa1eb('0xd')](_0xa1eb('0x12'),_0x39a5a3,_0xa1eb('0xe'));_0x2aebb6(_0x4d4aaf[_0xa1eb('0x14')][_0xa1eb('0x13')]);}})['catch'](function(_0xbd6a6b){logger['error'](_0xa1eb('0x12'),_0x39a5a3,_0xbd6a6b);_0x9d7113(_0xbd6a6b);});});} \ No newline at end of file +var _0xa45c=['code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x52cfab,_0x1034b5){var _0x58f135=function(_0x430b73){while(--_0x430b73){_0x52cfab['push'](_0x52cfab['shift']());}};_0x58f135(++_0x1034b5);}(_0xa45c,0x6d));var _0xca45=function(_0x549132,_0x1eb1b2){_0x549132=_0x549132-0x0;var _0x594d8a=_0xa45c[_0x549132];return _0x594d8a;};'use strict';var _=require(_0xca45('0x0'));var util=require(_0xca45('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xca45('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca45('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xca45('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xca45('0x5'));var client=jayson[_0xca45('0x6')][_0xca45('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15628b,_0x578a7b,_0x1a8b9c){return new BPromise(function(_0x276897,_0x7ceab1){return client[_0xca45('0x8')](_0x15628b,_0x1a8b9c)[_0xca45('0x9')](function(_0x5c18b9){logger[_0xca45('0xa')](_0xca45('0xb'),_0x578a7b,_0xca45('0xc'));logger[_0xca45('0xd')](_0xca45('0xe'),_0x578a7b,_0xca45('0xc'),JSON[_0xca45('0xf')](_0x5c18b9));if(_0x5c18b9['error']){if(_0x5c18b9[_0xca45('0x10')][_0xca45('0x11')]===0x1f4){logger[_0xca45('0x10')](_0xca45('0xb'),_0x578a7b,_0x5c18b9['error'][_0xca45('0x12')]);return _0x7ceab1(_0x5c18b9[_0xca45('0x10')][_0xca45('0x12')]);}logger['error'](_0xca45('0xb'),_0x578a7b,_0x5c18b9['error'][_0xca45('0x12')]);return _0x276897(_0x5c18b9[_0xca45('0x10')][_0xca45('0x12')]);}else{logger[_0xca45('0xa')](_0xca45('0xb'),_0x578a7b,_0xca45('0xc'));_0x276897(_0x5c18b9[_0xca45('0x13')]['message']);}})[_0xca45('0x14')](function(_0x5b4e29){logger['error'](_0xca45('0xb'),_0x578a7b,_0x5b4e29);_0x7ceab1(_0x5b4e29);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index b259e90..c98b296 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 _0xa9e0=['isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x1f0c9b,_0x234e61){var _0x1283e6=function(_0x5e157c){while(--_0x5e157c){_0x1f0c9b['push'](_0x1f0c9b['shift']());}};_0x1283e6(++_0x234e61);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','/describe','/:id','/:id/download','download','/:id/downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','put','update','delete','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get'];(function(_0x187096,_0x1d5150){var _0x215af8=function(_0x3c1c6b){while(--_0x3c1c6b){_0x187096['push'](_0x187096['shift']());}};_0x215af8(++_0x1d5150);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),controller['downloads']);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x8')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 5893fb7..f301e12 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 _0x3d8c=['FLOAT','BOOLEAN','DATE','format','toString','updatedAt','moment','path','exports','VIRTUAL','getDataValue','extname','value','STRING','channel','membername','split','INTEGER','TEXT'];(function(_0x2e6939,_0x18d0f5){var _0x303fe9=function(_0x5070e7){while(--_0x5070e7){_0x2e6939['push'](_0x2e6939['shift']());}};_0x303fe9(++_0x18d0f5);}(_0x3d8c,0x8b));var _0xc3d8=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0x3d8c[_0x557fd2];return _0x1b54a2;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc3d8('0x0'));var path=require(_0xc3d8('0x1'));module[_0xc3d8('0x2')]={'format':{'type':Sequelize[_0xc3d8('0x3')],'get':function(){return this[_0xc3d8('0x4')]('value')?path[_0xc3d8('0x5')](this[_0xc3d8('0x4')](_0xc3d8('0x6'))):undefined;}},'uniqueid':{'type':Sequelize[_0xc3d8('0x7')]},'channel':{'type':Sequelize['STRING'],'set':function(_0xf922){if(_0xf922){this['setDataValue'](_0xc3d8('0x8'),_0xf922);this['setDataValue'](_0xc3d8('0x9'),_0xf922[_0xc3d8('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xc3d8('0x7')]},'calleridnum':{'type':Sequelize[_0xc3d8('0x7')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xc3d8('0x7')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xc3d8('0x7')]},'context':{'type':Sequelize[_0xc3d8('0x7')]},'exten':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xc3d8('0x7')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize[_0xc3d8('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xc3d8('0x7')]},'userDisposition':{'type':Sequelize[_0xc3d8('0x7')]},'location':{'type':Sequelize['TEXT']},'transcribeName':{'type':Sequelize[_0xc3d8('0x7')]},'transcribeStatus':{'type':Sequelize[_0xc3d8('0x7')],'defaultValue':'NEW'},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0xc3d8('0xc')]},'failureReason':{'type':Sequelize[_0xc3d8('0xc')]},'sentiment':{'type':Sequelize[_0xc3d8('0x7')]},'sPositive':{'type':Sequelize[_0xc3d8('0xd')]},'sNegative':{'type':Sequelize['FLOAT']},'sNeutral':{'type':Sequelize['FLOAT']},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0xc3d8('0xe')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0xc3d8('0xf')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0xc3d8('0x10')]('MM-DD-YYYY\x20HH:mm')[_0xc3d8('0x11')]();}},'updatedAt':{'type':Sequelize[_0xc3d8('0xf')],'get':function(){return moment(this[_0xc3d8('0x4')](_0xc3d8('0x12')))['format']('MM-DD-YYYY\x20HH:mm')[_0xc3d8('0x11')]();}}}; \ No newline at end of file +var _0xc5c9=['getDataValue','STRING','setDataValue','channel','membername','INTEGER','TEXT','FLOAT','BOOLEAN','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','exports','VIRTUAL','value','extname'];(function(_0x57014b,_0x360c0f){var _0x2b258a=function(_0x52c4a3){while(--_0x52c4a3){_0x57014b['push'](_0x57014b['shift']());}};_0x2b258a(++_0x360c0f);}(_0xc5c9,0x18b));var _0x9c5c=function(_0x46ad69,_0x13331d){_0x46ad69=_0x46ad69-0x0;var _0x513d1c=_0xc5c9[_0x46ad69];return _0x513d1c;};'use strict';var Sequelize=require(_0x9c5c('0x0'));var moment=require('moment');var path=require('path');module[_0x9c5c('0x1')]={'format':{'type':Sequelize[_0x9c5c('0x2')],'get':function(){return this['getDataValue'](_0x9c5c('0x3'))?path[_0x9c5c('0x4')](this[_0x9c5c('0x5')](_0x9c5c('0x3'))):undefined;}},'uniqueid':{'type':Sequelize[_0x9c5c('0x6')]},'channel':{'type':Sequelize['STRING'],'set':function(_0x47d84d){if(_0x47d84d){this[_0x9c5c('0x7')](_0x9c5c('0x8'),_0x47d84d);this[_0x9c5c('0x7')](_0x9c5c('0x9'),_0x47d84d['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x9c5c('0x6')]},'calleridnum':{'type':Sequelize[_0x9c5c('0x6')]},'calleridname':{'type':Sequelize[_0x9c5c('0x6')]},'connectedlinenum':{'type':Sequelize[_0x9c5c('0x6')]},'connectedlinename':{'type':Sequelize[_0x9c5c('0x6')]},'accountcode':{'type':Sequelize[_0x9c5c('0x6')]},'context':{'type':Sequelize[_0x9c5c('0x6')]},'exten':{'type':Sequelize[_0x9c5c('0x6')]},'value':{'type':Sequelize[_0x9c5c('0x6')]},'type':{'type':Sequelize[_0x9c5c('0x6')]},'rating':{'type':Sequelize[_0x9c5c('0xa')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x9c5c('0x6')]},'userDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0x9c5c('0xb')]},'transcribeName':{'type':Sequelize[_0x9c5c('0x6')]},'transcribeStatus':{'type':Sequelize[_0x9c5c('0x6')],'defaultValue':'NEW'},'fileUri':{'type':Sequelize[_0x9c5c('0xb')]},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0x9c5c('0x6')]},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0x9c5c('0xc')]},'sNeutral':{'type':Sequelize[_0x9c5c('0xc')]},'sMixed':{'type':Sequelize[_0x9c5c('0xc')]},'tempSentiment':{'type':Sequelize[_0x9c5c('0xd')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x9c5c('0xe')],'get':function(){return moment(this[_0x9c5c('0x5')](_0x9c5c('0xf')))[_0x9c5c('0x10')](_0x9c5c('0x11'))[_0x9c5c('0x12')]();}},'updatedAt':{'type':Sequelize[_0x9c5c('0xe')],'get':function(){return moment(this[_0x9c5c('0x5')](_0x9c5c('0x13')))['format'](_0x9c5c('0x11'))[_0x9c5c('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index fe3e00c..6c57f89 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 _0xccb6=['/server/files/transcribes/transcribe_','.txt','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','send','map','VoiceRecording','rawAttributes','type','key','model','differenceBy','name','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','body','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','extname','unlink','Not\x20found','downloads','sequelize','MD5','token','$and','push','format','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','downloadTranscribe','fileText','root'];(function(_0x26fbe0,_0x401cb9){var _0x5ce614=function(_0x2b2db6){while(--_0x2b2db6){_0x26fbe0['push'](_0x26fbe0['shift']());}};_0x5ce614(++_0x401cb9);}(_0xccb6,0x1c7));var _0x6ccb=function(_0x5cebc3,_0x3f0d41){_0x5cebc3=_0x5cebc3-0x0;var _0x595fa5=_0xccb6[_0x5cebc3];return _0x595fa5;};'use strict';var pdf=require(_0x6ccb('0x0'));var emlformat=require(_0x6ccb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6ccb('0x2'));var jsonpatch=require(_0x6ccb('0x3'));var rp=require(_0x6ccb('0x4'));var moment=require(_0x6ccb('0x5'));var BPromise=require(_0x6ccb('0x6'));var Mustache=require(_0x6ccb('0x7'));var util=require(_0x6ccb('0x8'));var path=require(_0x6ccb('0x9'));var sox=require(_0x6ccb('0xa'));var csv=require('to-csv');var ejs=require(_0x6ccb('0xb'));var fs=require('fs');var _=require(_0x6ccb('0xc'));var squel=require(_0x6ccb('0xd'));var crypto=require(_0x6ccb('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6ccb('0xf'));var querystring=require(_0x6ccb('0x10'));var Papa=require('papaparse');var AWS=require(_0x6ccb('0x11'));var uuidv4=require(_0x6ccb('0x12'));var Redis=require(_0x6ccb('0x13'));var authService=require(_0x6ccb('0x14'));var qs=require(_0x6ccb('0x15'));var as=require(_0x6ccb('0x16'));var hardwareService=require(_0x6ccb('0x17'));var logger=require('../../config/logger')(_0x6ccb('0x18'));var utils=require(_0x6ccb('0x19'));var config=require(_0x6ccb('0x1a'));var db=require(_0x6ccb('0x1b'))['db'];function respondWithStatusCode(_0x111f90,_0x9403ae){_0x9403ae=_0x9403ae||0xcc;return function(_0x34bc0e){if(_0x34bc0e){return _0x111f90[_0x6ccb('0x1c')](_0x9403ae);}return _0x111f90[_0x6ccb('0x1d')](_0x9403ae)['end']();};}function respondWithResult(_0x166f26,_0x16c452){_0x16c452=_0x16c452||0xc8;return function(_0x62eff5){if(_0x62eff5){return _0x166f26[_0x6ccb('0x1d')](_0x16c452)['json'](_0x62eff5);}};}function respondWithFilteredResult(_0x1b1b5f,_0x383c8b){return function(_0x2c621b){if(_0x2c621b){var _0x517308=_0x2c621b[_0x6ccb('0x1e')],_0x4ca2cb=_0x383c8b[_0x6ccb('0x1f')],_0x53e816=_0x383c8b[_0x6ccb('0x1f')]+_0x383c8b[_0x6ccb('0x20')],_0x4736e3;if(_0x53e816>=_0x517308){_0x53e816=_0x517308;_0x4736e3=0xc8;}else{_0x4736e3=0xce;}_0x1b1b5f['status'](_0x4736e3);return _0x1b1b5f[_0x6ccb('0x21')](_0x6ccb('0x22'),_0x4ca2cb+'-'+_0x53e816+'/'+_0x517308)[_0x6ccb('0x23')](_0x2c621b);}return null;};}function patchUpdates(_0x2b1040){return function(_0x1bde87){try{jsonpatch[_0x6ccb('0x24')](_0x1bde87,_0x2b1040,!![]);}catch(_0xb6e0dd){return BPromise[_0x6ccb('0x25')](_0xb6e0dd);}return _0x1bde87[_0x6ccb('0x26')]();};}function saveUpdates(_0x19b700,_0x3ee8e1){return function(_0x42fc4d){if(_0x42fc4d){return _0x42fc4d[_0x6ccb('0x27')](_0x19b700)[_0x6ccb('0x28')](function(_0x1ce7ed){return _0x1ce7ed;});}return null;};}function removeEntity(_0x4be4fc,_0x30ba27){return function(_0x44560c){if(_0x44560c){return _0x44560c[_0x6ccb('0x29')]()['then'](function(){_0x4be4fc[_0x6ccb('0x1d')](0xcc)[_0x6ccb('0x2a')]();});}};}function handleEntityNotFound(_0x21cde8,_0x3f79a0){return function(_0x27c446){if(!_0x27c446){_0x21cde8[_0x6ccb('0x1c')](0x194);}return _0x27c446;};}function handleError(_0x1c226d,_0xe85304){_0xe85304=_0xe85304||0x1f4;return function(_0x393149){logger[_0x6ccb('0x2b')](_0x393149[_0x6ccb('0x2c')]);if(_0x393149['name']){delete _0x393149['name'];}_0x1c226d[_0x6ccb('0x1d')](_0xe85304)[_0x6ccb('0x2d')](_0x393149);};}exports['index']=function(_0xc8de48,_0x3df1a5){var _0x3f00f6={},_0x4bb6c4={},_0x8ad5e5={'count':0x0,'rows':[]};var _0x5f5119=_[_0x6ccb('0x2e')](db[_0x6ccb('0x2f')][_0x6ccb('0x30')],function(_0x72b4c8){return{'name':_0x72b4c8['fieldName'],'type':_0x72b4c8[_0x6ccb('0x31')][_0x6ccb('0x32')]};});_0x4bb6c4[_0x6ccb('0x33')]=_[_0x6ccb('0x34')](_[_0x6ccb('0x2e')](_0x5f5119,_0x6ccb('0x35')),['format']);_0x4bb6c4[_0x6ccb('0x36')]=_[_0x6ccb('0x37')](_0xc8de48[_0x6ccb('0x36')]);_0x4bb6c4['filters']=_[_0x6ccb('0x38')](_0x4bb6c4[_0x6ccb('0x33')],_0x4bb6c4[_0x6ccb('0x36')]);_0x3f00f6[_0x6ccb('0x39')]=_[_0x6ccb('0x38')](_0x4bb6c4[_0x6ccb('0x33')],qs[_0x6ccb('0x3a')](_0xc8de48[_0x6ccb('0x36')][_0x6ccb('0x3a')]));_0x3f00f6[_0x6ccb('0x39')]=_0x3f00f6[_0x6ccb('0x39')][_0x6ccb('0x3b')]?_0x3f00f6['attributes']:_0x4bb6c4[_0x6ccb('0x33')];if(!_0xc8de48['query']['hasOwnProperty'](_0x6ccb('0x3c'))){_0x3f00f6['limit']=qs[_0x6ccb('0x20')](_0xc8de48[_0x6ccb('0x36')]['limit']);_0x3f00f6[_0x6ccb('0x1f')]=qs[_0x6ccb('0x1f')](_0xc8de48['query'][_0x6ccb('0x1f')]);}_0x3f00f6[_0x6ccb('0x3d')]=qs[_0x6ccb('0x3e')](_0xc8de48[_0x6ccb('0x36')][_0x6ccb('0x3e')]);_0x3f00f6[_0x6ccb('0x3f')]=qs[_0x6ccb('0x40')](_[_0x6ccb('0x41')](_0xc8de48[_0x6ccb('0x36')],_0x4bb6c4[_0x6ccb('0x40')]),_0x5f5119);if(_0xc8de48[_0x6ccb('0x36')][_0x6ccb('0x42')]){_0x3f00f6[_0x6ccb('0x3f')]=_[_0x6ccb('0x43')](_0x3f00f6['where'],{'$or':_['map'](_0x5f5119,function(_0x52a92e){if(_0x52a92e['type']!==_0x6ccb('0x44')){var _0x32eb93={};_0x32eb93[_0x52a92e[_0x6ccb('0x35')]]={'$like':'%'+_0xc8de48[_0x6ccb('0x36')]['filter']+'%'};return _0x32eb93;}})});}_0x3f00f6=_[_0x6ccb('0x43')]({},_0x3f00f6,_0xc8de48[_0x6ccb('0x45')]);var _0x39c38f={'where':_0x3f00f6['where']};return db[_0x6ccb('0x2f')]['count'](_0x39c38f)[_0x6ccb('0x28')](function(_0x5e25ae){_0x8ad5e5[_0x6ccb('0x1e')]=_0x5e25ae;if(_0xc8de48[_0x6ccb('0x36')][_0x6ccb('0x46')]){_0x3f00f6[_0x6ccb('0x47')]=[{'all':!![]}];}return db[_0x6ccb('0x2f')]['findAll'](_0x3f00f6);})[_0x6ccb('0x28')](function(_0x5186ce){_0x8ad5e5[_0x6ccb('0x48')]=_0x5186ce;return _0x8ad5e5;})[_0x6ccb('0x28')](respondWithFilteredResult(_0x3df1a5,_0x3f00f6))['catch'](handleError(_0x3df1a5,null));};exports[_0x6ccb('0x49')]=function(_0x450740,_0xcc1c8e){var _0x288020={'raw':![],'where':{'id':_0x450740[_0x6ccb('0x4a')]['id']}},_0x3477e3={};_0x3477e3[_0x6ccb('0x33')]=_[_0x6ccb('0x37')](db[_0x6ccb('0x2f')]['rawAttributes']);_0x3477e3[_0x6ccb('0x36')]=_[_0x6ccb('0x37')](_0x450740['query']);_0x3477e3[_0x6ccb('0x40')]=_[_0x6ccb('0x38')](_0x3477e3[_0x6ccb('0x33')],_0x3477e3['query']);_0x288020[_0x6ccb('0x39')]=_['intersection'](_0x3477e3['model'],qs[_0x6ccb('0x3a')](_0x450740[_0x6ccb('0x36')][_0x6ccb('0x3a')]));_0x288020['attributes']=_0x288020['attributes'][_0x6ccb('0x3b')]?_0x288020[_0x6ccb('0x39')]:_0x3477e3[_0x6ccb('0x33')];if(_0x450740[_0x6ccb('0x36')]['includeAll']){_0x288020[_0x6ccb('0x47')]=[{'all':!![]}];}_0x288020=_['merge']({},_0x288020,_0x450740[_0x6ccb('0x45')]);return db[_0x6ccb('0x2f')][_0x6ccb('0x4b')](_0x288020)['then'](handleEntityNotFound(_0xcc1c8e,null))[_0x6ccb('0x28')](respondWithResult(_0xcc1c8e,null))[_0x6ccb('0x4c')](handleError(_0xcc1c8e,null));};exports[_0x6ccb('0x4d')]=function(_0x1106dd,_0x1967d9){return db[_0x6ccb('0x2f')][_0x6ccb('0x4d')](_0x1106dd[_0x6ccb('0x4e')],{})[_0x6ccb('0x28')](respondWithResult(_0x1967d9,0xc9))[_0x6ccb('0x4c')](handleError(_0x1967d9,null));};exports[_0x6ccb('0x27')]=function(_0x47eb17,_0x58446e){if(_0x47eb17[_0x6ccb('0x4e')]['id']){delete _0x47eb17[_0x6ccb('0x4e')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x47eb17[_0x6ccb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x58446e,null))[_0x6ccb('0x28')](saveUpdates(_0x47eb17[_0x6ccb('0x4e')],null))[_0x6ccb('0x28')](respondWithResult(_0x58446e,null))[_0x6ccb('0x4c')](handleError(_0x58446e,null));};exports['describe']=function(_0x160d7d,_0x37a94a){return db[_0x6ccb('0x2f')]['describe']()[_0x6ccb('0x28')](respondWithResult(_0x37a94a,null))[_0x6ccb('0x4c')](handleError(_0x37a94a,null));};exports['download']=function(_0x22bee2,_0x346f6a,_0x148903){var _0x8139d2=require(_0x6ccb('0x4f'));var _0x5b6b5c=![];var _0x4130f0={};if(_0x22bee2['query']['type']&&_0x22bee2['query'][_0x6ccb('0x31')]===_0x6ccb('0x50')){_0x4130f0[_0x6ccb('0x50')]=_0x22bee2[_0x6ccb('0x4a')]['id'];}else{_0x4130f0['id']=_0x22bee2[_0x6ccb('0x4a')]['id'];}return db[_0x6ccb('0x2f')][_0x6ccb('0x4b')]({'where':_0x4130f0,'attributes':['id',_0x6ccb('0x51')],'raw':!![]})[_0x6ccb('0x28')](handleEntityNotFound(_0x346f6a,null))[_0x6ccb('0x28')](function(_0x286889){if(_0x286889){var _0x4f58f5=_0x286889['value'];var _0x4d7f2d=util['format'](_0x6ccb('0x52'),_0x4f58f5);if(fs[_0x6ccb('0x53')](_0x4d7f2d)){_0x5b6b5c=!![];return _0x8139d2[_0x6ccb('0x54')](_0x4d7f2d,_0x4f58f5,config[_0x6ccb('0x55')][_0x6ccb('0x56')])[_0x6ccb('0x28')](function(){return _0x286889;});}return _0x286889;}})['then'](function(_0x2cc4bc){if(_0x2cc4bc){var _0xc4e9de=_0x2cc4bc['value'];if(!fs[_0x6ccb('0x53')](_0xc4e9de)){throw new db[(_0x6ccb('0x57'))][(_0x6ccb('0x58'))](_0x6ccb('0x59'));}if(_0x2cc4bc[_0x6ccb('0x5a')]){return _0x346f6a[_0x6ccb('0x5b')](_0xc4e9de,_0x2cc4bc['filename']+path[_0x6ccb('0x5c')](_0xc4e9de),function(){if(_0x5b6b5c){fs['unlink'](_0xc4e9de);}});}else{return _0x346f6a['download'](_0xc4e9de,function(_0x585e26){if(_0x5b6b5c){fs[_0x6ccb('0x5d')](_0xc4e9de);}});}}})[_0x6ccb('0x4c')](function(_0x531d00){if(_0x531d00['message']===_0x6ccb('0x59')){_0x346f6a[_0x6ccb('0x1d')](0x194)[_0x6ccb('0x2d')](_0x6ccb('0x5e'));}else{return handleError(_0x346f6a,null);}});};exports[_0x6ccb('0x5f')]=function(_0x37a2af,_0x369fe0,_0x100b52){var _0x4df298=require('../../components/encryptor');var _0x379806=![];var _0xb6eb02={'$and':[db[_0x6ccb('0x60')][_0x6ccb('0x3f')](db[_0x6ccb('0x60')]['fn'](_0x6ccb('0x61'),db[_0x6ccb('0x60')]['col'](_0x6ccb('0x50'))),_0x37a2af['query'][_0x6ccb('0x62')])]};if(_0x37a2af[_0x6ccb('0x36')][_0x6ccb('0x31')]&&_0x37a2af[_0x6ccb('0x36')][_0x6ccb('0x31')]===_0x6ccb('0x50')){_0xb6eb02[_0x6ccb('0x63')][_0x6ccb('0x64')]({'uniqueid':_0x37a2af[_0x6ccb('0x4a')]['id']});}else{_0xb6eb02[_0x6ccb('0x63')][_0x6ccb('0x64')]({'id':_0x37a2af[_0x6ccb('0x4a')]['id']});}return db[_0x6ccb('0x2f')][_0x6ccb('0x4b')]({'where':_0xb6eb02,'attributes':['id',_0x6ccb('0x51')],'raw':!![]})[_0x6ccb('0x28')](handleEntityNotFound(_0x369fe0,null))[_0x6ccb('0x28')](function(_0x5c2521){if(_0x5c2521){var _0xc76554=util[_0x6ccb('0x65')](_0x6ccb('0x52'),_0x5c2521[_0x6ccb('0x51')]);if(fs[_0x6ccb('0x53')](_0xc76554)){_0x379806=!![];return _0x4df298[_0x6ccb('0x54')](_0xc76554,_0x5c2521[_0x6ccb('0x51')],config[_0x6ccb('0x55')][_0x6ccb('0x56')])[_0x6ccb('0x28')](function(){return _0x5c2521;});}return _0x5c2521;}})[_0x6ccb('0x28')](function(_0x3011e1){if(_0x3011e1){if(!fs[_0x6ccb('0x53')](_0x3011e1[_0x6ccb('0x51')])){throw new db[(_0x6ccb('0x57'))][(_0x6ccb('0x58'))]('VoiceRecording\x20not\x20found');}if(_0x3011e1[_0x6ccb('0x5a')]){return _0x369fe0['download'](_0x3011e1['value'],_0x3011e1[_0x6ccb('0x5a')]+path[_0x6ccb('0x5c')](_0x3011e1[_0x6ccb('0x51')]),function(){if(_0x379806){fs['unlink'](_0x3011e1['value']);}});}else{return _0x369fe0[_0x6ccb('0x5b')](_0x3011e1['value'],function(_0xdb5a2b){if(_0x379806){fs['unlink'](_0x3011e1[_0x6ccb('0x51')]);}});}}})[_0x6ccb('0x4c')](handleError(_0x369fe0,null));};exports[_0x6ccb('0x29')]=function(_0x53577c,_0x5f5786){return db[_0x6ccb('0x2f')][_0x6ccb('0x4b')]({'where':{'id':_0x53577c[_0x6ccb('0x4a')]['id']}})[_0x6ccb('0x28')](function(_0x24b6f8){if(!_0x24b6f8)throw new ReferenceError(_0x6ccb('0x66'));return _0x24b6f8;})['then'](function(_0x12ec3f){var _0x5b99df=_0x12ec3f[_0x6ccb('0x51')];logger[_0x6ccb('0x67')](_0x6ccb('0x68'),_0x5b99df);if(!_[_0x6ccb('0x69')](_0x12ec3f[_0x6ccb('0x51')])&&fs[_0x6ccb('0x53')](_0x5b99df)){logger['info'](_0x6ccb('0x6a')+_0x5b99df+_0x6ccb('0x6b'));fs[_0x6ccb('0x6c')](_0x5b99df);}_0x5b99df=_0x5b99df+_0x6ccb('0x6d');if(!_['isNil'](_0x12ec3f[_0x6ccb('0x51')])&&fs[_0x6ccb('0x53')](_0x5b99df)){logger[_0x6ccb('0x67')]('File:\x20\x22'+_0x5b99df+_0x6ccb('0x6b'));fs['unlinkSync'](_0x5b99df);}return _0x12ec3f;})[_0x6ccb('0x28')](function(_0x3a7e80){if(!_0x3a7e80)throw new InternalError();return _0x3a7e80[_0x6ccb('0x29')]();})[_0x6ccb('0x28')](function(){_0x5f5786['status'](0xcc)[_0x6ccb('0x2a')]();})[_0x6ccb('0x4c')](handleError(_0x5f5786,null));};function getBucketslist(_0x2eb48e,_0x55656d,_0x222a55){return new Promise(function(_0x32a18a,_0x160697){var _0x377d83=new AWS['S3']({'accessKeyId':_0x55656d,'secretAccessKey':_0x2eb48e,'region':_0x222a55});_0x377d83[_0x6ccb('0x6e')]({},function(_0xbae7c9,_0x3d1952){if(_0xbae7c9){return _0x160697(_0xbae7c9);}else{return _0x32a18a(_0x3d1952);}});});}function createBucket(_0x2006dd,_0x504841,_0x390f1b,_0xa3dc75){return new Promise(function(_0xd6e17a,_0x24f174){var _0x1c0941=new AWS['S3']({'accessKeyId':_0x504841,'secretAccessKey':_0x2006dd,'region':_0x390f1b});_0x1c0941[_0x6ccb('0x6f')]({'Bucket':_0xa3dc75},function(_0x3dba52,_0x361d70){if(_0x3dba52){return _0x24f174(_0x3dba52);}else{return _0xd6e17a(_0x361d70);}});});}function uploadFile(_0x4be27e,_0x40fa23,_0x46214d,_0x1d8efd,_0x43531f,_0x38b68f){return new Promise(function(_0x1561aa,_0x1e10ea){var _0x39f0e4=new AWS['S3']({'accessKeyId':_0x40fa23,'secretAccessKey':_0x4be27e,'region':_0x46214d});_0x39f0e4[_0x6ccb('0x70')]({'Bucket':_0x1d8efd,'Key':_0x43531f,'Body':_0x38b68f},function(_0x3c2af5,_0x7a609){if(_0x3c2af5){return _0x1e10ea(_0x3c2af5);}else{return _0x1561aa(_0x7a609);}});});}function startTranscribe(_0x38642e,_0x26b5cd,_0x461926,_0x40d12f,_0x3c32cf,_0x42bc16){return new Promise(function(_0x249589,_0x435525){var _0x1f9285=new AWS[(_0x6ccb('0x71'))]({'accessKeyId':_0x26b5cd,'secretAccessKey':_0x38642e,'region':_0x461926});_0x1f9285[_0x6ccb('0x72')]({'TranscriptionJobName':_0x40d12f,'LanguageCode':_0x3c32cf,'Media':{'MediaFileUri':_0x42bc16}},function(_0x213165,_0x16c95a){if(_0x213165){return _0x435525(_0x213165);}else{return _0x249589(_0x16c95a);}});});}function transcribe(_0x301176,_0x2ceb5b,_0x38986c,_0x5e0a6c,_0x2b8539,_0x3d27dc,_0x1b4326){return new Promise(function(_0x17403f,_0xc92ca3){var _0x3b989a={};logger['info'](util[_0x6ccb('0x65')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x301176,_0x2b8539));return uploadFile(_0x2ceb5b,_0x38986c,_0x5e0a6c,_0x2b8539,path[_0x6ccb('0x73')](_0x3d27dc),fs['readFileSync'](_0x3d27dc))['then'](function(_0x5d3b58){logger[_0x6ccb('0x67')](util[_0x6ccb('0x65')](_0x6ccb('0x74'),_0x301176,_0x2b8539,_0x5d3b58[_0x6ccb('0x75')]));_0x3b989a[_0x6ccb('0x76')]=_0x5d3b58[_0x6ccb('0x77')];_0x3b989a['location']=_0x5d3b58[_0x6ccb('0x75')];logger[_0x6ccb('0x67')](util[_0x6ccb('0x65')](_0x6ccb('0x78'),_0x301176));return startTranscribe(_0x2ceb5b,_0x38986c,_0x5e0a6c,uuidv4(),_0x1b4326,_0x5d3b58[_0x6ccb('0x75')]);})['then'](function(_0x31cbe9){logger[_0x6ccb('0x67')](util['format'](_0x6ccb('0x79'),_0x301176,_0x31cbe9['TranscriptionJob'][_0x6ccb('0x7a')]));_0x3b989a[_0x6ccb('0x7b')]=_0x31cbe9[_0x6ccb('0x7c')][_0x6ccb('0x7a')];_0x3b989a[_0x6ccb('0x7d')]=_0x31cbe9[_0x6ccb('0x7c')][_0x6ccb('0x7e')];return _0x17403f(_0x3b989a);})[_0x6ccb('0x4c')](function(_0x1a7f1e){return _0xc92ca3(_0x1a7f1e);});});}exports[_0x6ccb('0x7f')]=function(_0x353909,_0x24eeec,_0x5bc7e6){var _0x2dd7b4;var _0x429271;var _0x6ab7b9;var _0x316e93=require('../../components/encryptor');return db['VoiceRecording'][_0x6ccb('0x80')]({'where':{'id':_0x353909[_0x6ccb('0x4a')]['id']}})[_0x6ccb('0x28')](function(_0x527a86){if(_0x527a86){var _0x5459ae=util[_0x6ccb('0x65')](_0x6ccb('0x52'),_0x527a86['value']);if(fs[_0x6ccb('0x53')](_0x5459ae)){cypher=!![];return _0x316e93[_0x6ccb('0x54')](_0x5459ae,_0x527a86[_0x6ccb('0x51')],config[_0x6ccb('0x55')][_0x6ccb('0x56')])[_0x6ccb('0x28')](function(){return _0x527a86;});}return _0x527a86;}})['then'](function(_0xf33a86){if(!_0xf33a86){throw new db[(_0x6ccb('0x57'))][(_0x6ccb('0x58'))](_0x6ccb('0x81'));}_0x429271=_0xf33a86;return db['Setting'][_0x6ccb('0x80')]({'where':{'id':0x1}});})[_0x6ccb('0x28')](handleEntityNotFound(_0x24eeec,null))[_0x6ccb('0x28')](function(_0x2da423){if(_0x2da423){_0x2dd7b4=_0x2da423;if(!_0x2dd7b4['transcribe']||!_0x2dd7b4['transcribeAccountId']||!_0x2dd7b4[_0x6ccb('0x82')]||!_0x2dd7b4[_0x6ccb('0x83')]||!_0x2dd7b4[_0x6ccb('0x76')]){throw new db['Sequelize'][(_0x6ccb('0x58'))](_0x6ccb('0x84'));}if(_0x353909[_0x6ccb('0x4e')][_0x6ccb('0x85')]&&(!_0x2dd7b4[_0x6ccb('0x86')]||!_0x2dd7b4['sentimentAccountId']||!_0x2dd7b4[_0x6ccb('0x87')]||!_0x2dd7b4['language']||!_0x2dd7b4[_0x6ccb('0x76')])){throw new db[(_0x6ccb('0x57'))][(_0x6ccb('0x58'))](_0x6ccb('0x88'));}return db['CloudProvider']['findOne']({'where':{'id':_0x2dd7b4[_0x6ccb('0x89')]}});}})[_0x6ccb('0x28')](function(_0xb16ffa){if(!_0xb16ffa){throw new db['Sequelize'][(_0x6ccb('0x58'))](_0x6ccb('0x8a'));}if(!_0xb16ffa['data1']||!_0xb16ffa['data2']){throw new db[(_0x6ccb('0x57'))][(_0x6ccb('0x58'))]('Cloud\x20Provider\x20not\x20configured');}_0x6ab7b9=_0xb16ffa;return getBucketslist(_0x6ab7b9[_0x6ccb('0x8b')],_0x6ab7b9[_0x6ccb('0x8c')],_0x2dd7b4[_0x6ccb('0x82')]);})[_0x6ccb('0x28')](function(_0x3bd1ba){if(_0x3bd1ba&&_0x3bd1ba[_0x6ccb('0x8d')]){var _0x2150f3=_[_0x6ccb('0x4b')](_0x3bd1ba[_0x6ccb('0x8d')],function(_0x453eb6){return _0x453eb6['Name']===_0x2dd7b4[_0x6ccb('0x76')];});if(!_0x2150f3){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x353909['params']['id'],_0x2dd7b4[_0x6ccb('0x76')]));return createBucket(_0x6ab7b9[_0x6ccb('0x8b')],_0x6ab7b9[_0x6ccb('0x8c')],_0x2dd7b4[_0x6ccb('0x82')],_0x2dd7b4['bucket']);}logger[_0x6ccb('0x67')](util[_0x6ccb('0x65')](_0x6ccb('0x8e'),_0x353909['params']['id'],_0x2dd7b4['bucket']));return;}})[_0x6ccb('0x28')](function(_0x45a6ff){if(_0x429271[_0x6ccb('0x7d')]===_0x6ccb('0x8f')){return transcribe(_0x353909['params']['id'],_0x6ab7b9[_0x6ccb('0x8b')],_0x6ab7b9['data2'],_0x2dd7b4['transcribeRegion'],_0x2dd7b4[_0x6ccb('0x76')],_0x429271['value'],_0x2dd7b4['language']);}else{logger[_0x6ccb('0x67')](util[_0x6ccb('0x65')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x353909['params']['id']));return{'transcribeStatus':_0x6ccb('0x90')};}})['then'](function(_0x585428){if(_0x585428){_0x585428[_0x6ccb('0x91')]=_0x353909[_0x6ccb('0x4e')][_0x6ccb('0x85')];return _0x429271['updateAttributes'](_0x585428);}})[_0x6ccb('0x28')](respondWithResult(_0x24eeec,null))[_0x6ccb('0x4c')](handleError(_0x24eeec,null));};function writeFile(_0x4158db,_0x58a90a){return new Promise(function(_0x41752b,_0xcdcb70){fs['writeFile'](_0x58a90a,_0x4158db,function(_0x263655,_0x155246){if(_0x263655){return _0xcdcb70(_0x263655);}else{return _0x41752b(_0x155246);}});});}exports[_0x6ccb('0x92')]=function(_0x5960c4,_0x588992,_0x1ef373){return db[_0x6ccb('0x2f')][_0x6ccb('0x80')]({'where':{'id':_0x5960c4[_0x6ccb('0x4a')]['id']}})[_0x6ccb('0x28')](handleEntityNotFound(_0x588992))[_0x6ccb('0x28')](function(_0x2432a8){if(_0x2432a8&&_0x2432a8[_0x6ccb('0x93')]){var _0x59b971=_0x2432a8[_0x6ccb('0x93')];var _0x3c4377=config[_0x6ccb('0x94')]+_0x6ccb('0x95')+_0x2432a8['id']+_0x6ccb('0x96');if(fs[_0x6ccb('0x53')](_0x3c4377)){return _0x3c4377;}return writeFile(_0x59b971,_0x3c4377)[_0x6ccb('0x28')](function(){return _0x3c4377;});}else{throw new db['Sequelize']['ValidationError']('Transcript\x20not\x20available');}})['then'](function(_0x12211b){return _0x588992[_0x6ccb('0x5b')](_0x12211b);})[_0x6ccb('0x4c')](handleError(_0x588992));}; \ No newline at end of file +var _0xb512=['stack','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','name','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','create','body','find','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','sequelize','MD5','col','token','$and','push','recording','destroy','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','isNil','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','transcribe','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','transcribeAccountId','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','language','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','root','Transcript\x20not\x20available','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error'];(function(_0x542c24,_0x39f82f){var _0x1870fa=function(_0x23c023){while(--_0x23c023){_0x542c24['push'](_0x542c24['shift']());}};_0x1870fa(++_0x39f82f);}(_0xb512,0x1a4));var _0x2b51=function(_0x551a03,_0x17ac5d){_0x551a03=_0x551a03-0x0;var _0x2f1d55=_0xb512[_0x551a03];return _0x2f1d55;};'use strict';var pdf=require(_0x2b51('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2b51('0x1'));var zipdir=require(_0x2b51('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b51('0x3'));var moment=require('moment');var BPromise=require(_0x2b51('0x4'));var Mustache=require(_0x2b51('0x5'));var util=require(_0x2b51('0x6'));var path=require(_0x2b51('0x7'));var sox=require(_0x2b51('0x8'));var csv=require('to-csv');var ejs=require(_0x2b51('0x9'));var fs=require('fs');var _=require(_0x2b51('0xa'));var squel=require(_0x2b51('0xb'));var crypto=require(_0x2b51('0xc'));var jsforce=require(_0x2b51('0xd'));var deskjs=require(_0x2b51('0xe'));var toCsv=require(_0x2b51('0xf'));var querystring=require(_0x2b51('0x10'));var Papa=require(_0x2b51('0x11'));var AWS=require(_0x2b51('0x12'));var uuidv4=require(_0x2b51('0x13'));var Redis=require(_0x2b51('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2b51('0x15'));var hardwareService=require(_0x2b51('0x16'));var logger=require(_0x2b51('0x17'))(_0x2b51('0x18'));var utils=require(_0x2b51('0x19'));var config=require(_0x2b51('0x1a'));var db=require(_0x2b51('0x1b'))['db'];function respondWithStatusCode(_0x5e585c,_0x252e99){_0x252e99=_0x252e99||0xcc;return function(_0xd3b81){if(_0xd3b81){return _0x5e585c[_0x2b51('0x1c')](_0x252e99);}return _0x5e585c[_0x2b51('0x1d')](_0x252e99)[_0x2b51('0x1e')]();};}function respondWithResult(_0x2def26,_0x4afdf7){_0x4afdf7=_0x4afdf7||0xc8;return function(_0x146c65){if(_0x146c65){return _0x2def26[_0x2b51('0x1d')](_0x4afdf7)[_0x2b51('0x1f')](_0x146c65);}};}function respondWithFilteredResult(_0x1f0eba,_0x187925){return function(_0x4e5a97){if(_0x4e5a97){var _0xe4b125=_0x4e5a97[_0x2b51('0x20')],_0x33f93e=_0x187925['offset'],_0x4d627d=_0x187925[_0x2b51('0x21')]+_0x187925[_0x2b51('0x22')],_0x84f8a2;if(_0x4d627d>=_0xe4b125){_0x4d627d=_0xe4b125;_0x84f8a2=0xc8;}else{_0x84f8a2=0xce;}_0x1f0eba['status'](_0x84f8a2);return _0x1f0eba['set'](_0x2b51('0x23'),_0x33f93e+'-'+_0x4d627d+'/'+_0xe4b125)[_0x2b51('0x1f')](_0x4e5a97);}return null;};}function patchUpdates(_0x1ef4f4){return function(_0x2160c7){try{jsonpatch[_0x2b51('0x24')](_0x2160c7,_0x1ef4f4,!![]);}catch(_0x304e39){return BPromise[_0x2b51('0x25')](_0x304e39);}return _0x2160c7[_0x2b51('0x26')]();};}function saveUpdates(_0x6a87a0,_0x4c9ddb){return function(_0x4fbdc9){if(_0x4fbdc9){return _0x4fbdc9[_0x2b51('0x27')](_0x6a87a0)[_0x2b51('0x28')](function(_0x4baec8){return _0x4baec8;});}return null;};}function removeEntity(_0x4ad58d,_0x53990c){return function(_0x266482){if(_0x266482){return _0x266482['destroy']()[_0x2b51('0x28')](function(){_0x4ad58d[_0x2b51('0x1d')](0xcc)[_0x2b51('0x1e')]();});}};}function handleEntityNotFound(_0xd0dcfe,_0x3397e7){return function(_0xfd6910){if(!_0xfd6910){_0xd0dcfe['sendStatus'](0x194);}return _0xfd6910;};}function handleError(_0x1766c0,_0x3beb71){_0x3beb71=_0x3beb71||0x1f4;return function(_0x5379aa){logger[_0x2b51('0x29')](_0x5379aa[_0x2b51('0x2a')]);if(_0x5379aa['name']){delete _0x5379aa['name'];}_0x1766c0['status'](_0x3beb71)[_0x2b51('0x2b')](_0x5379aa);};}exports[_0x2b51('0x2c')]=function(_0xed29a,_0x35deaa){var _0x2fffcf={},_0x567e97={},_0x4f7cd0={'count':0x0,'rows':[]};var _0x5bf58d=_[_0x2b51('0x2d')](db[_0x2b51('0x2e')][_0x2b51('0x2f')],function(_0xb7f22d){return{'name':_0xb7f22d[_0x2b51('0x30')],'type':_0xb7f22d[_0x2b51('0x31')][_0x2b51('0x32')]};});_0x567e97[_0x2b51('0x33')]=_[_0x2b51('0x34')](_[_0x2b51('0x2d')](_0x5bf58d,_0x2b51('0x35')),[_0x2b51('0x36')]);_0x567e97[_0x2b51('0x37')]=_[_0x2b51('0x38')](_0xed29a['query']);_0x567e97[_0x2b51('0x39')]=_[_0x2b51('0x3a')](_0x567e97[_0x2b51('0x33')],_0x567e97[_0x2b51('0x37')]);_0x2fffcf[_0x2b51('0x3b')]=_[_0x2b51('0x3a')](_0x567e97[_0x2b51('0x33')],qs['fields'](_0xed29a['query'][_0x2b51('0x3c')]));_0x2fffcf[_0x2b51('0x3b')]=_0x2fffcf[_0x2b51('0x3b')][_0x2b51('0x3d')]?_0x2fffcf[_0x2b51('0x3b')]:_0x567e97[_0x2b51('0x33')];if(!_0xed29a['query'][_0x2b51('0x3e')](_0x2b51('0x3f'))){_0x2fffcf['limit']=qs[_0x2b51('0x22')](_0xed29a[_0x2b51('0x37')]['limit']);_0x2fffcf[_0x2b51('0x21')]=qs[_0x2b51('0x21')](_0xed29a[_0x2b51('0x37')]['offset']);}_0x2fffcf[_0x2b51('0x40')]=qs['sort'](_0xed29a[_0x2b51('0x37')][_0x2b51('0x41')]);_0x2fffcf[_0x2b51('0x42')]=qs['filters'](_[_0x2b51('0x43')](_0xed29a[_0x2b51('0x37')],_0x567e97[_0x2b51('0x39')]),_0x5bf58d);if(_0xed29a[_0x2b51('0x37')][_0x2b51('0x44')]){_0x2fffcf['where']=_['merge'](_0x2fffcf[_0x2b51('0x42')],{'$or':_['map'](_0x5bf58d,function(_0x7078c0){if(_0x7078c0[_0x2b51('0x31')]!==_0x2b51('0x45')){var _0x1f8021={};_0x1f8021[_0x7078c0[_0x2b51('0x35')]]={'$like':'%'+_0xed29a[_0x2b51('0x37')]['filter']+'%'};return _0x1f8021;}})});}_0x2fffcf=_[_0x2b51('0x46')]({},_0x2fffcf,_0xed29a[_0x2b51('0x47')]);var _0x863f1d={'where':_0x2fffcf[_0x2b51('0x42')]};return db['VoiceRecording'][_0x2b51('0x20')](_0x863f1d)[_0x2b51('0x28')](function(_0x19ea31){_0x4f7cd0[_0x2b51('0x20')]=_0x19ea31;if(_0xed29a[_0x2b51('0x37')][_0x2b51('0x48')]){_0x2fffcf[_0x2b51('0x49')]=[{'all':!![]}];}return db[_0x2b51('0x2e')]['findAll'](_0x2fffcf);})['then'](function(_0x30d5ff){_0x4f7cd0[_0x2b51('0x4a')]=_0x30d5ff;return _0x4f7cd0;})['then'](respondWithFilteredResult(_0x35deaa,_0x2fffcf))[_0x2b51('0x4b')](handleError(_0x35deaa,null));};exports['show']=function(_0x381d82,_0x258a0e){var _0x39fec8={'raw':![],'where':{'id':_0x381d82[_0x2b51('0x4c')]['id']}},_0x5c3c61={};_0x5c3c61[_0x2b51('0x33')]=_[_0x2b51('0x38')](db[_0x2b51('0x2e')]['rawAttributes']);_0x5c3c61[_0x2b51('0x37')]=_[_0x2b51('0x38')](_0x381d82[_0x2b51('0x37')]);_0x5c3c61['filters']=_['intersection'](_0x5c3c61[_0x2b51('0x33')],_0x5c3c61['query']);_0x39fec8[_0x2b51('0x3b')]=_['intersection'](_0x5c3c61[_0x2b51('0x33')],qs[_0x2b51('0x3c')](_0x381d82[_0x2b51('0x37')]['fields']));_0x39fec8[_0x2b51('0x3b')]=_0x39fec8[_0x2b51('0x3b')][_0x2b51('0x3d')]?_0x39fec8[_0x2b51('0x3b')]:_0x5c3c61[_0x2b51('0x33')];if(_0x381d82[_0x2b51('0x37')][_0x2b51('0x48')]){_0x39fec8[_0x2b51('0x49')]=[{'all':!![]}];}_0x39fec8=_[_0x2b51('0x46')]({},_0x39fec8,_0x381d82[_0x2b51('0x47')]);return db['VoiceRecording']['find'](_0x39fec8)[_0x2b51('0x28')](handleEntityNotFound(_0x258a0e,null))[_0x2b51('0x28')](respondWithResult(_0x258a0e,null))[_0x2b51('0x4b')](handleError(_0x258a0e,null));};exports[_0x2b51('0x4d')]=function(_0x1691d8,_0x1df1f3){return db[_0x2b51('0x2e')][_0x2b51('0x4d')](_0x1691d8[_0x2b51('0x4e')],{})['then'](respondWithResult(_0x1df1f3,0xc9))[_0x2b51('0x4b')](handleError(_0x1df1f3,null));};exports['update']=function(_0x960172,_0x33fbbe){if(_0x960172[_0x2b51('0x4e')]['id']){delete _0x960172[_0x2b51('0x4e')]['id'];}return db[_0x2b51('0x2e')][_0x2b51('0x4f')]({'where':{'id':_0x960172[_0x2b51('0x4c')]['id']}})['then'](handleEntityNotFound(_0x33fbbe,null))[_0x2b51('0x28')](saveUpdates(_0x960172['body'],null))[_0x2b51('0x28')](respondWithResult(_0x33fbbe,null))['catch'](handleError(_0x33fbbe,null));};exports[_0x2b51('0x50')]=function(_0x3c5bba,_0x50657a){return db['VoiceRecording'][_0x2b51('0x50')]()[_0x2b51('0x28')](respondWithResult(_0x50657a,null))[_0x2b51('0x4b')](handleError(_0x50657a,null));};exports[_0x2b51('0x51')]=function(_0x17b0f7,_0x55e73d,_0x16c2c0){var _0x432e77=require(_0x2b51('0x52'));var _0x5f49e7=![];var _0x240be9={};if(_0x17b0f7['query']['type']&&_0x17b0f7['query']['type']===_0x2b51('0x53')){_0x240be9[_0x2b51('0x53')]=_0x17b0f7[_0x2b51('0x4c')]['id'];}else{_0x240be9['id']=_0x17b0f7[_0x2b51('0x4c')]['id'];}return db[_0x2b51('0x2e')][_0x2b51('0x4f')]({'where':_0x240be9,'attributes':['id',_0x2b51('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x55e73d,null))[_0x2b51('0x28')](function(_0x281b47){if(_0x281b47){var _0xc9f083=_0x281b47[_0x2b51('0x54')];var _0x1cbe1b=util[_0x2b51('0x36')](_0x2b51('0x55'),_0xc9f083);if(fs[_0x2b51('0x56')](_0x1cbe1b)){_0x5f49e7=!![];return _0x432e77[_0x2b51('0x57')](_0x1cbe1b,_0xc9f083,config[_0x2b51('0x58')]['recording'])[_0x2b51('0x28')](function(){return _0x281b47;});}return _0x281b47;}})[_0x2b51('0x28')](function(_0x1b0722){if(_0x1b0722){var _0x2911c1=_0x1b0722[_0x2b51('0x54')];if(!fs[_0x2b51('0x56')](_0x2911c1)){throw new db[(_0x2b51('0x59'))][(_0x2b51('0x5a'))](_0x2b51('0x5b'));}if(_0x1b0722['filename']){return _0x55e73d[_0x2b51('0x51')](_0x2911c1,_0x1b0722[_0x2b51('0x5c')]+path[_0x2b51('0x5d')](_0x2911c1),function(){if(_0x5f49e7){fs[_0x2b51('0x5e')](_0x2911c1);}});}else{return _0x55e73d[_0x2b51('0x51')](_0x2911c1,function(_0x3db393){if(_0x5f49e7){fs[_0x2b51('0x5e')](_0x2911c1);}});}}})[_0x2b51('0x4b')](function(_0x26a91d){if(_0x26a91d[_0x2b51('0x5f')]===_0x2b51('0x5b')){_0x55e73d[_0x2b51('0x1d')](0x194)['send']('Not\x20found');}else{return handleError(_0x55e73d,null);}});};exports[_0x2b51('0x60')]=function(_0x226978,_0x3cfc92,_0x10fb30){var _0x204d8e=require(_0x2b51('0x52'));var _0x29a7f9=![];var _0x11d6ff={'$and':[db[_0x2b51('0x61')][_0x2b51('0x42')](db[_0x2b51('0x61')]['fn'](_0x2b51('0x62'),db[_0x2b51('0x61')][_0x2b51('0x63')](_0x2b51('0x53'))),_0x226978[_0x2b51('0x37')][_0x2b51('0x64')])]};if(_0x226978[_0x2b51('0x37')]['type']&&_0x226978[_0x2b51('0x37')][_0x2b51('0x31')]===_0x2b51('0x53')){_0x11d6ff[_0x2b51('0x65')][_0x2b51('0x66')]({'uniqueid':_0x226978[_0x2b51('0x4c')]['id']});}else{_0x11d6ff[_0x2b51('0x65')][_0x2b51('0x66')]({'id':_0x226978['params']['id']});}return db['VoiceRecording']['find']({'where':_0x11d6ff,'attributes':['id',_0x2b51('0x54')],'raw':!![]})[_0x2b51('0x28')](handleEntityNotFound(_0x3cfc92,null))[_0x2b51('0x28')](function(_0x23c62f){if(_0x23c62f){var _0x211291=util[_0x2b51('0x36')](_0x2b51('0x55'),_0x23c62f[_0x2b51('0x54')]);if(fs[_0x2b51('0x56')](_0x211291)){_0x29a7f9=!![];return _0x204d8e[_0x2b51('0x57')](_0x211291,_0x23c62f[_0x2b51('0x54')],config[_0x2b51('0x58')][_0x2b51('0x67')])[_0x2b51('0x28')](function(){return _0x23c62f;});}return _0x23c62f;}})[_0x2b51('0x28')](function(_0x393828){if(_0x393828){if(!fs[_0x2b51('0x56')](_0x393828[_0x2b51('0x54')])){throw new db['Sequelize'][(_0x2b51('0x5a'))](_0x2b51('0x5b'));}if(_0x393828['filename']){return _0x3cfc92['download'](_0x393828[_0x2b51('0x54')],_0x393828[_0x2b51('0x5c')]+path[_0x2b51('0x5d')](_0x393828[_0x2b51('0x54')]),function(){if(_0x29a7f9){fs['unlink'](_0x393828[_0x2b51('0x54')]);}});}else{return _0x3cfc92[_0x2b51('0x51')](_0x393828['value'],function(_0x357e40){if(_0x29a7f9){fs[_0x2b51('0x5e')](_0x393828[_0x2b51('0x54')]);}});}}})[_0x2b51('0x4b')](handleError(_0x3cfc92,null));};exports[_0x2b51('0x68')]=function(_0xa97db7,_0x3ab1a2){return db[_0x2b51('0x2e')][_0x2b51('0x4f')]({'where':{'id':_0xa97db7[_0x2b51('0x4c')]['id']}})['then'](function(_0x2cf4c9){if(!_0x2cf4c9)throw new ReferenceError('Entity\x20not\x20found');return _0x2cf4c9;})[_0x2b51('0x28')](function(_0xfcfac3){var _0x32f11c=_0xfcfac3[_0x2b51('0x54')];logger[_0x2b51('0x69')](_0x2b51('0x6a'),_0x32f11c);if(!_['isNil'](_0xfcfac3[_0x2b51('0x54')])&&fs[_0x2b51('0x56')](_0x32f11c)){logger[_0x2b51('0x69')](_0x2b51('0x6b')+_0x32f11c+_0x2b51('0x6c'));fs[_0x2b51('0x6d')](_0x32f11c);}_0x32f11c=_0x32f11c+'.cypher';if(!_[_0x2b51('0x6e')](_0xfcfac3[_0x2b51('0x54')])&&fs[_0x2b51('0x56')](_0x32f11c)){logger[_0x2b51('0x69')](_0x2b51('0x6b')+_0x32f11c+_0x2b51('0x6c'));fs[_0x2b51('0x6d')](_0x32f11c);}return _0xfcfac3;})['then'](function(_0x9367f7){if(!_0x9367f7)throw new InternalError();return _0x9367f7[_0x2b51('0x68')]();})[_0x2b51('0x28')](function(){_0x3ab1a2[_0x2b51('0x1d')](0xcc)[_0x2b51('0x1e')]();})[_0x2b51('0x4b')](handleError(_0x3ab1a2,null));};function getBucketslist(_0x310b00,_0x14b98e,_0x216221){return new Promise(function(_0xfe240f,_0x46cad6){var _0x41752c=new AWS['S3']({'accessKeyId':_0x14b98e,'secretAccessKey':_0x310b00,'region':_0x216221});_0x41752c[_0x2b51('0x6f')]({},function(_0x2fce4a,_0x33945a){if(_0x2fce4a){return _0x46cad6(_0x2fce4a);}else{return _0xfe240f(_0x33945a);}});});}function createBucket(_0x561321,_0x417089,_0xe1dfca,_0xaa9ad3){return new Promise(function(_0x3abb5d,_0x1d79ac){var _0x178b7e=new AWS['S3']({'accessKeyId':_0x417089,'secretAccessKey':_0x561321,'region':_0xe1dfca});_0x178b7e[_0x2b51('0x70')]({'Bucket':_0xaa9ad3},function(_0x13a63f,_0x28094f){if(_0x13a63f){return _0x1d79ac(_0x13a63f);}else{return _0x3abb5d(_0x28094f);}});});}function uploadFile(_0x1d9a7b,_0x66f575,_0x4688cb,_0x1230d8,_0x4857cb,_0x325b5d){return new Promise(function(_0x496def,_0x1d6253){var _0x481b3c=new AWS['S3']({'accessKeyId':_0x66f575,'secretAccessKey':_0x1d9a7b,'region':_0x4688cb});_0x481b3c[_0x2b51('0x71')]({'Bucket':_0x1230d8,'Key':_0x4857cb,'Body':_0x325b5d},function(_0x4f909e,_0x5d2c6c){if(_0x4f909e){return _0x1d6253(_0x4f909e);}else{return _0x496def(_0x5d2c6c);}});});}function startTranscribe(_0x1e1e8d,_0x4b4ced,_0x124c75,_0x59dd72,_0x156930,_0x9faaac){return new Promise(function(_0x2b666b,_0x274c96){var _0x27124d=new AWS[(_0x2b51('0x72'))]({'accessKeyId':_0x4b4ced,'secretAccessKey':_0x1e1e8d,'region':_0x124c75});_0x27124d['startTranscriptionJob']({'TranscriptionJobName':_0x59dd72,'LanguageCode':_0x156930,'Media':{'MediaFileUri':_0x9faaac}},function(_0x10a6de,_0x431396){if(_0x10a6de){return _0x274c96(_0x10a6de);}else{return _0x2b666b(_0x431396);}});});}function transcribe(_0x110bd5,_0x55e982,_0x84cbd7,_0xe9cac6,_0xbd31e8,_0xf123b,_0x4648f7){return new Promise(function(_0x19b2d7,_0x92bdbc){var _0x51bd4b={};logger[_0x2b51('0x69')](util['format'](_0x2b51('0x73'),_0x110bd5,_0xbd31e8));return uploadFile(_0x55e982,_0x84cbd7,_0xe9cac6,_0xbd31e8,path[_0x2b51('0x74')](_0xf123b),fs['readFileSync'](_0xf123b))['then'](function(_0x5a16a4){logger[_0x2b51('0x69')](util['format'](_0x2b51('0x75'),_0x110bd5,_0xbd31e8,_0x5a16a4[_0x2b51('0x76')]));_0x51bd4b[_0x2b51('0x77')]=_0x5a16a4[_0x2b51('0x78')];_0x51bd4b[_0x2b51('0x79')]=_0x5a16a4[_0x2b51('0x76')];logger[_0x2b51('0x69')](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x110bd5));return startTranscribe(_0x55e982,_0x84cbd7,_0xe9cac6,uuidv4(),_0x4648f7,_0x5a16a4['Location']);})[_0x2b51('0x28')](function(_0x5a2ac2){logger[_0x2b51('0x69')](util[_0x2b51('0x36')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x110bd5,_0x5a2ac2['TranscriptionJob'][_0x2b51('0x7a')]));_0x51bd4b[_0x2b51('0x7b')]=_0x5a2ac2[_0x2b51('0x7c')][_0x2b51('0x7a')];_0x51bd4b[_0x2b51('0x7d')]=_0x5a2ac2[_0x2b51('0x7c')][_0x2b51('0x7e')];return _0x19b2d7(_0x51bd4b);})[_0x2b51('0x4b')](function(_0x1f9be1){return _0x92bdbc(_0x1f9be1);});});}exports[_0x2b51('0x7f')]=function(_0xe255b0,_0x5d7e47,_0x32ed8f){var _0x28f462;var _0x32712e;var _0x49abb6;var _0x1229a1=require(_0x2b51('0x52'));return db['VoiceRecording'][_0x2b51('0x80')]({'where':{'id':_0xe255b0[_0x2b51('0x4c')]['id']}})[_0x2b51('0x28')](function(_0x4cec31){if(_0x4cec31){var _0x263b56=util[_0x2b51('0x36')](_0x2b51('0x55'),_0x4cec31[_0x2b51('0x54')]);if(fs['existsSync'](_0x263b56)){cypher=!![];return _0x1229a1['decryptFile'](_0x263b56,_0x4cec31[_0x2b51('0x54')],config[_0x2b51('0x58')][_0x2b51('0x67')])[_0x2b51('0x28')](function(){return _0x4cec31;});}return _0x4cec31;}})[_0x2b51('0x28')](function(_0x1bd2ef){if(!_0x1bd2ef){throw new db[(_0x2b51('0x59'))][(_0x2b51('0x5a'))]('Voice\x20Recording\x20not\x20found');}_0x32712e=_0x1bd2ef;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x2b51('0x28')](handleEntityNotFound(_0x5d7e47,null))[_0x2b51('0x28')](function(_0x307bf0){if(_0x307bf0){_0x28f462=_0x307bf0;if(!_0x28f462[_0x2b51('0x81')]||!_0x28f462['transcribeAccountId']||!_0x28f462[_0x2b51('0x82')]||!_0x28f462['language']||!_0x28f462[_0x2b51('0x77')]){throw new db['Sequelize']['ValidationError'](_0x2b51('0x83'));}if(_0xe255b0[_0x2b51('0x4e')][_0x2b51('0x84')]&&(!_0x28f462[_0x2b51('0x85')]||!_0x28f462[_0x2b51('0x86')]||!_0x28f462[_0x2b51('0x87')]||!_0x28f462['language']||!_0x28f462[_0x2b51('0x77')])){throw new db[(_0x2b51('0x59'))][(_0x2b51('0x5a'))](_0x2b51('0x88'));}return db['CloudProvider'][_0x2b51('0x80')]({'where':{'id':_0x28f462[_0x2b51('0x89')]}});}})[_0x2b51('0x28')](function(_0x2c7681){if(!_0x2c7681){throw new db[(_0x2b51('0x59'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x2c7681[_0x2b51('0x8a')]||!_0x2c7681[_0x2b51('0x8b')]){throw new db[(_0x2b51('0x59'))][(_0x2b51('0x5a'))](_0x2b51('0x8c'));}_0x49abb6=_0x2c7681;return getBucketslist(_0x49abb6[_0x2b51('0x8a')],_0x49abb6[_0x2b51('0x8b')],_0x28f462[_0x2b51('0x82')]);})[_0x2b51('0x28')](function(_0x464829){if(_0x464829&&_0x464829[_0x2b51('0x8d')]){var _0x5d5b60=_[_0x2b51('0x4f')](_0x464829['Buckets'],function(_0x4e5f02){return _0x4e5f02[_0x2b51('0x8e')]===_0x28f462[_0x2b51('0x77')];});if(!_0x5d5b60){logger[_0x2b51('0x69')](util['format'](_0x2b51('0x8f'),_0xe255b0[_0x2b51('0x4c')]['id'],_0x28f462['bucket']));return createBucket(_0x49abb6[_0x2b51('0x8a')],_0x49abb6[_0x2b51('0x8b')],_0x28f462[_0x2b51('0x82')],_0x28f462[_0x2b51('0x77')]);}logger[_0x2b51('0x69')](util[_0x2b51('0x36')](_0x2b51('0x90'),_0xe255b0[_0x2b51('0x4c')]['id'],_0x28f462[_0x2b51('0x77')]));return;}})[_0x2b51('0x28')](function(_0x2c96c2){if(_0x32712e[_0x2b51('0x7d')]==='NEW'){return transcribe(_0xe255b0[_0x2b51('0x4c')]['id'],_0x49abb6['data1'],_0x49abb6[_0x2b51('0x8b')],_0x28f462[_0x2b51('0x82')],_0x28f462['bucket'],_0x32712e[_0x2b51('0x54')],_0x28f462[_0x2b51('0x91')]);}else{logger[_0x2b51('0x69')](util[_0x2b51('0x36')](_0x2b51('0x92'),_0xe255b0[_0x2b51('0x4c')]['id']));return{'transcribeStatus':_0x2b51('0x93')};}})[_0x2b51('0x28')](function(_0x3d8727){if(_0x3d8727){_0x3d8727['tempSentiment']=_0xe255b0[_0x2b51('0x4e')][_0x2b51('0x84')];return _0x32712e[_0x2b51('0x94')](_0x3d8727);}})[_0x2b51('0x28')](respondWithResult(_0x5d7e47,null))[_0x2b51('0x4b')](handleError(_0x5d7e47,null));};function writeFile(_0x216d6a,_0x43182e){return new Promise(function(_0xafc2ad,_0x3ee6d6){fs[_0x2b51('0x95')](_0x43182e,_0x216d6a,function(_0xe3d7cb,_0x1f06c2){if(_0xe3d7cb){return _0x3ee6d6(_0xe3d7cb);}else{return _0xafc2ad(_0x1f06c2);}});});}exports[_0x2b51('0x96')]=function(_0x2d1ff3,_0x44ceeb,_0x3c41cb){return db[_0x2b51('0x2e')]['findOne']({'where':{'id':_0x2d1ff3[_0x2b51('0x4c')]['id']}})[_0x2b51('0x28')](handleEntityNotFound(_0x44ceeb))['then'](function(_0x50e14b){if(_0x50e14b&&_0x50e14b[_0x2b51('0x97')]){var _0x3b3dd2=_0x50e14b[_0x2b51('0x97')];var _0x1989ad=config[_0x2b51('0x98')]+'/server/files/transcribes/transcribe_'+_0x50e14b['id']+'.txt';if(fs[_0x2b51('0x56')](_0x1989ad)){return _0x1989ad;}return writeFile(_0x3b3dd2,_0x1989ad)[_0x2b51('0x28')](function(){return _0x1989ad;});}else{throw new db[(_0x2b51('0x59'))][(_0x2b51('0x5a'))](_0x2b51('0x99'));}})[_0x2b51('0x28')](function(_0xa252e8){return _0x44ceeb['download'](_0xa252e8);})['catch'](handleError(_0x44ceeb));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index b416c9b..71d0046 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 _0x3f8a=['define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports'];(function(_0x4580d4,_0xb4514f){var _0x48ce72=function(_0x35194e){while(--_0x35194e){_0x4580d4['push'](_0x4580d4['shift']());}};_0x48ce72(++_0xb4514f);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x1da237,_0x30771a){_0x1da237=_0x1da237-0x0;var _0x4e5078=_0x3f8a[_0x1da237];return _0x4e5078;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));module[_0xa3f8('0xa')]=function(_0x471464,_0x1f160a){return _0x471464[_0xa3f8('0xb')](_0xa3f8('0xc'),attributes,{'tableName':_0xa3f8('0xd'),'paranoid':![],'indexes':[{'name':_0xa3f8('0xe'),'fields':[_0xa3f8('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9fd4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','voice_recordings','uniqueid'];(function(_0x570c8a,_0x4a11cc){var _0x25dc12=function(_0x4585d9){while(--_0x4585d9){_0x570c8a['push'](_0x570c8a['shift']());}};_0x25dc12(++_0x4a11cc);}(_0x9fd4,0x16c));var _0x49fd=function(_0x39b51c,_0x40010d){_0x39b51c=_0x39b51c-0x0;var _0x146312=_0x9fd4[_0x39b51c];return _0x146312;};'use strict';var _=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var logger=require(_0x49fd('0x2'))(_0x49fd('0x3'));var moment=require(_0x49fd('0x4'));var BPromise=require(_0x49fd('0x5'));var rp=require(_0x49fd('0x6'));var fs=require('fs');var path=require(_0x49fd('0x7'));var rimraf=require(_0x49fd('0x8'));var config=require('../../config/environment');var attributes=require('./voiceRecording.attributes');module[_0x49fd('0x9')]=function(_0x42fdc7,_0x1bc16e){return _0x42fdc7[_0x49fd('0xa')]('VoiceRecording',attributes,{'tableName':_0x49fd('0xb'),'paranoid':![],'indexes':[{'name':_0x49fd('0xc'),'fields':[_0x49fd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 1e89f8f..9c0cd58 100644 --- a/server/api/voiceRecording/voiceRecording.rpc.js +++ b/server/api/voiceRecording/voiceRecording.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x479a35,_0x2526b2){var _0x24fea9=function(_0x175905){while(--_0x175905){_0x479a35['push'](_0x479a35['shift']());}};_0x24fea9(++_0x2526b2);}(_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 Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x28ab1a,_0x41638e){var _0x2db742=function(_0x5f5d8f){while(--_0x5f5d8f){_0x28ab1a['push'](_0x28ab1a['shift']());}};_0x2db742(++_0x41638e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 3f54257..c95bcc3 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 _0xd8fb=['util','path','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','/:id','update','multer'];(function(_0x391ff0,_0x46db5d){var _0x33fd7b=function(_0x507185){while(--_0x507185){_0x391ff0['push'](_0x391ff0['shift']());}};_0x33fd7b(++_0x46db5d);}(_0xd8fb,0x99));var _0xbd8f=function(_0x5b428e,_0x5f5cdc){_0x5b428e=_0x5b428e-0x0;var _0x5b5350=_0xd8fb[_0x5b428e];return _0x5b5350;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xbd8f('0x4'));var config=require(_0xbd8f('0x5'));var controller=require('./voiceTransferReport.controller');router[_0xbd8f('0x6')]('/',auth[_0xbd8f('0x7')](),controller['index']);router[_0xbd8f('0x6')]('/:id',auth[_0xbd8f('0x7')](),controller['show']);router[_0xbd8f('0x8')]('/',auth[_0xbd8f('0x7')](),controller['create']);router['put'](_0xbd8f('0x9'),auth[_0xbd8f('0x7')](),controller[_0xbd8f('0xa')]);router['delete'](_0xbd8f('0x9'),auth[_0xbd8f('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5fc3=['post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','/:id','show'];(function(_0x3fa59d,_0x54a194){var _0x56e042=function(_0x294e50){while(--_0x294e50){_0x3fa59d['push'](_0x3fa59d['shift']());}};_0x56e042(++_0x54a194);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0x5fc3[_0x1f6f84];return _0x177f40;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var auth=require(_0x35fc('0x5'));var interaction=require(_0x35fc('0x6'));var config=require('../../config/environment');var controller=require(_0x35fc('0x7'));router[_0x35fc('0x8')]('/',auth[_0x35fc('0x9')](),controller['index']);router['get'](_0x35fc('0xa'),auth['isAuthenticated'](),controller[_0x35fc('0xb')]);router[_0x35fc('0xc')]('/',auth[_0x35fc('0x9')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')](_0x35fc('0xa'),auth[_0x35fc('0x9')](),controller['update']);router[_0x35fc('0xf')](_0x35fc('0xa'),auth['isAuthenticated'](),controller[_0x35fc('0x10')]);module[_0x35fc('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index d4109a8..2aa048c 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 _0xabf3=['STRING','Yes','sequelize','moment','ENUM'];(function(_0x1a8b58,_0x2c6665){var _0x3fa938=function(_0xc93616){while(--_0xc93616){_0x1a8b58['push'](_0x1a8b58['shift']());}};_0x3fa938(++_0x2c6665);}(_0xabf3,0x1bf));var _0x3abf=function(_0x452c2d,_0x4ff6fd){_0x452c2d=_0x452c2d-0x0;var _0x109490=_0xabf3[_0x452c2d];return _0x109490;};'use strict';var Sequelize=require(_0x3abf('0x0'));var moment=require(_0x3abf('0x1'));module['exports']={'type':{'type':Sequelize[_0x3abf('0x2')]('blind','attended')},'result':{'type':Sequelize[_0x3abf('0x3')]},'transfererchannel':{'type':Sequelize[_0x3abf('0x3')]},'transferercalleridnum':{'type':Sequelize[_0x3abf('0x3')]},'transferercalleridname':{'type':Sequelize[_0x3abf('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0x3abf('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0x3abf('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x3abf('0x3')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x3abf('0x3')]},'transfererlinkedid':{'type':Sequelize[_0x3abf('0x3')]},'transfereechannel':{'type':Sequelize[_0x3abf('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x3abf('0x3')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x3abf('0x3')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x3abf('0x3')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x3abf('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x3abf('0x3')]},'isexternal':{'type':Sequelize['ENUM'](_0x3abf('0x4'),'No')},'context':{'type':Sequelize[_0x3abf('0x3')]},'extension':{'type':Sequelize[_0x3abf('0x3')]}}; \ No newline at end of file +var _0x00c9=['Yes','sequelize','ENUM','attended','STRING'];(function(_0x2247ab,_0x3f4162){var _0x430062=function(_0x591dd7){while(--_0x591dd7){_0x2247ab['push'](_0x2247ab['shift']());}};_0x430062(++_0x3f4162);}(_0x00c9,0x14b));var _0x900c=function(_0x1abe83,_0x461d88){_0x1abe83=_0x1abe83-0x0;var _0x29ee41=_0x00c9[_0x1abe83];return _0x29ee41;};'use strict';var Sequelize=require(_0x900c('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x900c('0x1')]('blind',_0x900c('0x2'))},'result':{'type':Sequelize[_0x900c('0x3')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x900c('0x3')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x900c('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0x900c('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x900c('0x3')]},'transferercontext':{'type':Sequelize[_0x900c('0x3')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x900c('0x3')]},'transfereechannel':{'type':Sequelize[_0x900c('0x3')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x900c('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x900c('0x3')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x900c('0x3')]},'transfereeexten':{'type':Sequelize[_0x900c('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x900c('0x3')]},'isexternal':{'type':Sequelize[_0x900c('0x1')](_0x900c('0x4'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 830a4c1..f8a7054 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 _0xac74=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','error','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','count','includeAll','findAll','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs'];(function(_0x301290,_0x18acd1){var _0x4f9973=function(_0x3f9f41){while(--_0x3f9f41){_0x301290['push'](_0x301290['shift']());}};_0x4f9973(++_0x18acd1);}(_0xac74,0x85));var _0x4ac7=function(_0x564821,_0x4d037e){_0x564821=_0x564821-0x0;var _0x2b604d=_0xac74[_0x564821];return _0x2b604d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4ac7('0x0'));var rimraf=require(_0x4ac7('0x1'));var zipdir=require(_0x4ac7('0x2'));var jsonpatch=require(_0x4ac7('0x3'));var rp=require('request-promise');var moment=require(_0x4ac7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ac7('0x5'));var path=require('path');var sox=require(_0x4ac7('0x6'));var csv=require(_0x4ac7('0x7'));var ejs=require(_0x4ac7('0x8'));var fs=require('fs');var _=require(_0x4ac7('0x9'));var squel=require(_0x4ac7('0xa'));var crypto=require(_0x4ac7('0xb'));var jsforce=require(_0x4ac7('0xc'));var deskjs=require(_0x4ac7('0xd'));var toCsv=require(_0x4ac7('0x7'));var querystring=require(_0x4ac7('0xe'));var Papa=require(_0x4ac7('0xf'));var Redis=require('ioredis');var authService=require(_0x4ac7('0x10'));var qs=require(_0x4ac7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4ac7('0x12'))(_0x4ac7('0x13'));var utils=require(_0x4ac7('0x14'));var config=require(_0x4ac7('0x15'));var db=require(_0x4ac7('0x16'))['db'];function respondWithStatusCode(_0x108dd3,_0x4fc094){_0x4fc094=_0x4fc094||0xcc;return function(_0x59eefd){if(_0x59eefd){return _0x108dd3[_0x4ac7('0x17')](_0x4fc094);}return _0x108dd3[_0x4ac7('0x18')](_0x4fc094)[_0x4ac7('0x19')]();};}function respondWithResult(_0x1be7bc,_0x31e565){_0x31e565=_0x31e565||0xc8;return function(_0x10d6e9){if(_0x10d6e9){return _0x1be7bc[_0x4ac7('0x18')](_0x31e565)['json'](_0x10d6e9);}};}function respondWithFilteredResult(_0x157be2,_0x1f6e03){return function(_0x4f5c8e){if(_0x4f5c8e){var _0x4f6dff=_0x4f5c8e['count'],_0x48f1e5=_0x1f6e03[_0x4ac7('0x1a')],_0x764fa5=_0x1f6e03[_0x4ac7('0x1a')]+_0x1f6e03[_0x4ac7('0x1b')],_0x497955;if(_0x764fa5>=_0x4f6dff){_0x764fa5=_0x4f6dff;_0x497955=0xc8;}else{_0x497955=0xce;}_0x157be2[_0x4ac7('0x18')](_0x497955);return _0x157be2[_0x4ac7('0x1c')](_0x4ac7('0x1d'),_0x48f1e5+'-'+_0x764fa5+'/'+_0x4f6dff)[_0x4ac7('0x1e')](_0x4f5c8e);}return null;};}function patchUpdates(_0x2e0299){return function(_0x12aecf){try{jsonpatch[_0x4ac7('0x1f')](_0x12aecf,_0x2e0299,!![]);}catch(_0x529a56){return BPromise[_0x4ac7('0x20')](_0x529a56);}return _0x12aecf[_0x4ac7('0x21')]();};}function saveUpdates(_0x1a3768,_0x19895a){return function(_0x409a03){if(_0x409a03){return _0x409a03[_0x4ac7('0x22')](_0x1a3768)[_0x4ac7('0x23')](function(_0x21dbf4){return _0x21dbf4;});}return null;};}function removeEntity(_0x31b6b4,_0x5adda7){return function(_0x5b8621){if(_0x5b8621){return _0x5b8621['destroy']()[_0x4ac7('0x23')](function(){_0x31b6b4[_0x4ac7('0x18')](0xcc)[_0x4ac7('0x19')]();});}};}function handleEntityNotFound(_0x524a4e,_0x321183){return function(_0x2bfb2c){if(!_0x2bfb2c){_0x524a4e[_0x4ac7('0x17')](0x194);}return _0x2bfb2c;};}function handleError(_0x408ba1,_0x238bff){_0x238bff=_0x238bff||0x1f4;return function(_0x11589c){logger[_0x4ac7('0x24')](_0x11589c['stack']);if(_0x11589c[_0x4ac7('0x25')]){delete _0x11589c[_0x4ac7('0x25')];}_0x408ba1[_0x4ac7('0x18')](_0x238bff)[_0x4ac7('0x26')](_0x11589c);};}exports[_0x4ac7('0x27')]=function(_0x121b47,_0x4b5c88){var _0x893496={},_0x2711f0={},_0x3a1d58={'count':0x0,'rows':[]};var _0x375118=_[_0x4ac7('0x28')](db[_0x4ac7('0x29')][_0x4ac7('0x2a')],function(_0x353063){return{'name':_0x353063[_0x4ac7('0x2b')],'type':_0x353063[_0x4ac7('0x2c')]['key']};});_0x2711f0[_0x4ac7('0x2d')]=_[_0x4ac7('0x28')](_0x375118,_0x4ac7('0x25'));_0x2711f0['query']=_[_0x4ac7('0x2e')](_0x121b47[_0x4ac7('0x2f')]);_0x2711f0[_0x4ac7('0x30')]=_[_0x4ac7('0x31')](_0x2711f0[_0x4ac7('0x2d')],_0x2711f0['query']);_0x893496[_0x4ac7('0x32')]=_[_0x4ac7('0x31')](_0x2711f0[_0x4ac7('0x2d')],qs[_0x4ac7('0x33')](_0x121b47[_0x4ac7('0x2f')][_0x4ac7('0x33')]));_0x893496['attributes']=_0x893496[_0x4ac7('0x32')][_0x4ac7('0x34')]?_0x893496[_0x4ac7('0x32')]:_0x2711f0[_0x4ac7('0x2d')];if(!_0x121b47['query']['hasOwnProperty'](_0x4ac7('0x35'))){_0x893496['limit']=qs[_0x4ac7('0x1b')](_0x121b47['query']['limit']);_0x893496[_0x4ac7('0x1a')]=qs[_0x4ac7('0x1a')](_0x121b47[_0x4ac7('0x2f')][_0x4ac7('0x1a')]);}_0x893496[_0x4ac7('0x36')]=qs[_0x4ac7('0x37')](_0x121b47[_0x4ac7('0x2f')][_0x4ac7('0x37')]);_0x893496[_0x4ac7('0x38')]=qs['filters'](_[_0x4ac7('0x39')](_0x121b47[_0x4ac7('0x2f')],_0x2711f0['filters']),_0x375118);if(_0x121b47[_0x4ac7('0x2f')]['filter']){_0x893496[_0x4ac7('0x38')]=_[_0x4ac7('0x3a')](_0x893496['where'],{'$or':_['map'](_0x375118,function(_0xef9ffd){if(_0xef9ffd['type']!=='VIRTUAL'){var _0x5e80ce={};_0x5e80ce[_0xef9ffd[_0x4ac7('0x25')]]={'$like':'%'+_0x121b47[_0x4ac7('0x2f')][_0x4ac7('0x3b')]+'%'};return _0x5e80ce;}})});}_0x893496=_[_0x4ac7('0x3a')]({},_0x893496,_0x121b47[_0x4ac7('0x3c')]);var _0x1bc93f={'where':_0x893496['where']};return db[_0x4ac7('0x29')][_0x4ac7('0x3d')](_0x1bc93f)[_0x4ac7('0x23')](function(_0x26264a){_0x3a1d58['count']=_0x26264a;if(_0x121b47[_0x4ac7('0x2f')][_0x4ac7('0x3e')]){_0x893496['include']=[{'all':!![]}];}return db[_0x4ac7('0x29')][_0x4ac7('0x3f')](_0x893496);})[_0x4ac7('0x23')](function(_0x3f1fbe){_0x3a1d58['rows']=_0x3f1fbe;return _0x3a1d58;})[_0x4ac7('0x23')](respondWithFilteredResult(_0x4b5c88,_0x893496))[_0x4ac7('0x40')](handleError(_0x4b5c88,null));};exports[_0x4ac7('0x41')]=function(_0x41a1cd,_0x2ec2fd){var _0x450b28={'raw':!![],'where':{'id':_0x41a1cd[_0x4ac7('0x42')]['id']}},_0x1e7156={};_0x1e7156[_0x4ac7('0x2d')]=_[_0x4ac7('0x2e')](db[_0x4ac7('0x29')][_0x4ac7('0x2a')]);_0x1e7156[_0x4ac7('0x2f')]=_[_0x4ac7('0x2e')](_0x41a1cd[_0x4ac7('0x2f')]);_0x1e7156[_0x4ac7('0x30')]=_[_0x4ac7('0x31')](_0x1e7156[_0x4ac7('0x2d')],_0x1e7156[_0x4ac7('0x2f')]);_0x450b28[_0x4ac7('0x32')]=_[_0x4ac7('0x31')](_0x1e7156['model'],qs[_0x4ac7('0x33')](_0x41a1cd['query'][_0x4ac7('0x33')]));_0x450b28['attributes']=_0x450b28[_0x4ac7('0x32')][_0x4ac7('0x34')]?_0x450b28[_0x4ac7('0x32')]:_0x1e7156[_0x4ac7('0x2d')];if(_0x41a1cd[_0x4ac7('0x2f')][_0x4ac7('0x3e')]){_0x450b28['include']=[{'all':!![]}];}_0x450b28=_[_0x4ac7('0x3a')]({},_0x450b28,_0x41a1cd[_0x4ac7('0x3c')]);return db[_0x4ac7('0x29')][_0x4ac7('0x43')](_0x450b28)['then'](handleEntityNotFound(_0x2ec2fd,null))[_0x4ac7('0x23')](respondWithResult(_0x2ec2fd,null))[_0x4ac7('0x40')](handleError(_0x2ec2fd,null));};exports[_0x4ac7('0x44')]=function(_0x1fbce7,_0x29d185){return db['VoiceTransferReport'][_0x4ac7('0x44')](_0x1fbce7[_0x4ac7('0x45')],{})[_0x4ac7('0x23')](respondWithResult(_0x29d185,0xc9))[_0x4ac7('0x40')](handleError(_0x29d185,null));};exports[_0x4ac7('0x22')]=function(_0x596f62,_0x1a03c3){if(_0x596f62[_0x4ac7('0x45')]['id']){delete _0x596f62[_0x4ac7('0x45')]['id'];}return db[_0x4ac7('0x29')][_0x4ac7('0x43')]({'where':{'id':_0x596f62[_0x4ac7('0x42')]['id']}})[_0x4ac7('0x23')](handleEntityNotFound(_0x1a03c3,null))['then'](saveUpdates(_0x596f62[_0x4ac7('0x45')],null))[_0x4ac7('0x23')](respondWithResult(_0x1a03c3,null))[_0x4ac7('0x40')](handleError(_0x1a03c3,null));};exports[_0x4ac7('0x46')]=function(_0x572707,_0x3f894d){return db[_0x4ac7('0x29')][_0x4ac7('0x43')]({'where':{'id':_0x572707['params']['id']}})[_0x4ac7('0x23')](handleEntityNotFound(_0x3f894d,null))[_0x4ac7('0x23')](removeEntity(_0x3f894d,null))['catch'](handleError(_0x3f894d,null));}; \ No newline at end of file +var _0x606f=['limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','VoiceTransferReport','includeAll','include','findAll','rows','catch','show','params','create','body','find','html-pdf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','count','offset'];(function(_0xad81fe,_0x15e345){var _0x36bb5a=function(_0x3c566e){while(--_0x3c566e){_0xad81fe['push'](_0xad81fe['shift']());}};_0x36bb5a(++_0x15e345);}(_0x606f,0x75));var _0xf606=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x606f[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xf606('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf606('0x1'));var jsonpatch=require(_0xf606('0x2'));var rp=require(_0xf606('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf606('0x4'));var util=require(_0xf606('0x5'));var path=require(_0xf606('0x6'));var sox=require(_0xf606('0x7'));var csv=require(_0xf606('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf606('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf606('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf606('0xb'));var Redis=require(_0xf606('0xc'));var authService=require(_0xf606('0xd'));var qs=require(_0xf606('0xe'));var as=require(_0xf606('0xf'));var hardwareService=require(_0xf606('0x10'));var logger=require(_0xf606('0x11'))(_0xf606('0x12'));var utils=require('../../config/utils');var config=require(_0xf606('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d32af,_0x41b5a1){_0x41b5a1=_0x41b5a1||0xcc;return function(_0x1a7a79){if(_0x1a7a79){return _0x1d32af[_0xf606('0x14')](_0x41b5a1);}return _0x1d32af[_0xf606('0x15')](_0x41b5a1)['end']();};}function respondWithResult(_0x204202,_0x14ef27){_0x14ef27=_0x14ef27||0xc8;return function(_0x20412a){if(_0x20412a){return _0x204202[_0xf606('0x15')](_0x14ef27)[_0xf606('0x16')](_0x20412a);}};}function respondWithFilteredResult(_0x311931,_0x2763e7){return function(_0x4879ec){if(_0x4879ec){var _0x27f245=_0x4879ec[_0xf606('0x17')],_0x4d3d79=_0x2763e7[_0xf606('0x18')],_0x462d53=_0x2763e7[_0xf606('0x18')]+_0x2763e7[_0xf606('0x19')],_0x24c550;if(_0x462d53>=_0x27f245){_0x462d53=_0x27f245;_0x24c550=0xc8;}else{_0x24c550=0xce;}_0x311931[_0xf606('0x15')](_0x24c550);return _0x311931[_0xf606('0x1a')](_0xf606('0x1b'),_0x4d3d79+'-'+_0x462d53+'/'+_0x27f245)['json'](_0x4879ec);}return null;};}function patchUpdates(_0x1380f5){return function(_0x3aa7cb){try{jsonpatch[_0xf606('0x1c')](_0x3aa7cb,_0x1380f5,!![]);}catch(_0x285f73){return BPromise[_0xf606('0x1d')](_0x285f73);}return _0x3aa7cb[_0xf606('0x1e')]();};}function saveUpdates(_0x1582ee,_0x5b1a53){return function(_0x53e24c){if(_0x53e24c){return _0x53e24c[_0xf606('0x1f')](_0x1582ee)[_0xf606('0x20')](function(_0x9bd67f){return _0x9bd67f;});}return null;};}function removeEntity(_0x348c88,_0x51c26b){return function(_0x38c467){if(_0x38c467){return _0x38c467[_0xf606('0x21')]()[_0xf606('0x20')](function(){_0x348c88['status'](0xcc)[_0xf606('0x22')]();});}};}function handleEntityNotFound(_0x348497,_0x235ea5){return function(_0x307f77){if(!_0x307f77){_0x348497[_0xf606('0x14')](0x194);}return _0x307f77;};}function handleError(_0x20fdeb,_0x51a906){_0x51a906=_0x51a906||0x1f4;return function(_0x5e4496){logger['error'](_0x5e4496[_0xf606('0x23')]);if(_0x5e4496[_0xf606('0x24')]){delete _0x5e4496[_0xf606('0x24')];}_0x20fdeb['status'](_0x51a906)[_0xf606('0x25')](_0x5e4496);};}exports[_0xf606('0x26')]=function(_0x327f50,_0xeed070){var _0x7470ac={},_0x7b6e74={},_0x2eef21={'count':0x0,'rows':[]};var _0x228744=_[_0xf606('0x27')](db['VoiceTransferReport'][_0xf606('0x28')],function(_0x23478f){return{'name':_0x23478f[_0xf606('0x29')],'type':_0x23478f[_0xf606('0x2a')][_0xf606('0x2b')]};});_0x7b6e74[_0xf606('0x2c')]=_[_0xf606('0x27')](_0x228744,'name');_0x7b6e74[_0xf606('0x2d')]=_[_0xf606('0x2e')](_0x327f50[_0xf606('0x2d')]);_0x7b6e74[_0xf606('0x2f')]=_[_0xf606('0x30')](_0x7b6e74[_0xf606('0x2c')],_0x7b6e74[_0xf606('0x2d')]);_0x7470ac[_0xf606('0x31')]=_['intersection'](_0x7b6e74[_0xf606('0x2c')],qs[_0xf606('0x32')](_0x327f50['query'][_0xf606('0x32')]));_0x7470ac[_0xf606('0x31')]=_0x7470ac[_0xf606('0x31')][_0xf606('0x33')]?_0x7470ac[_0xf606('0x31')]:_0x7b6e74['model'];if(!_0x327f50['query'][_0xf606('0x34')]('nolimit')){_0x7470ac[_0xf606('0x19')]=qs[_0xf606('0x19')](_0x327f50['query']['limit']);_0x7470ac[_0xf606('0x18')]=qs[_0xf606('0x18')](_0x327f50[_0xf606('0x2d')][_0xf606('0x18')]);}_0x7470ac[_0xf606('0x35')]=qs[_0xf606('0x36')](_0x327f50[_0xf606('0x2d')]['sort']);_0x7470ac[_0xf606('0x37')]=qs[_0xf606('0x2f')](_['pick'](_0x327f50[_0xf606('0x2d')],_0x7b6e74[_0xf606('0x2f')]),_0x228744);if(_0x327f50[_0xf606('0x2d')][_0xf606('0x38')]){_0x7470ac[_0xf606('0x37')]=_[_0xf606('0x39')](_0x7470ac['where'],{'$or':_['map'](_0x228744,function(_0x14a7a3){if(_0x14a7a3['type']!==_0xf606('0x3a')){var _0x2aae2b={};_0x2aae2b[_0x14a7a3[_0xf606('0x24')]]={'$like':'%'+_0x327f50[_0xf606('0x2d')][_0xf606('0x38')]+'%'};return _0x2aae2b;}})});}_0x7470ac=_[_0xf606('0x39')]({},_0x7470ac,_0x327f50[_0xf606('0x3b')]);var _0x9a3a77={'where':_0x7470ac[_0xf606('0x37')]};return db[_0xf606('0x3c')][_0xf606('0x17')](_0x9a3a77)[_0xf606('0x20')](function(_0x5eed9b){_0x2eef21[_0xf606('0x17')]=_0x5eed9b;if(_0x327f50[_0xf606('0x2d')][_0xf606('0x3d')]){_0x7470ac[_0xf606('0x3e')]=[{'all':!![]}];}return db[_0xf606('0x3c')][_0xf606('0x3f')](_0x7470ac);})['then'](function(_0x481cff){_0x2eef21[_0xf606('0x40')]=_0x481cff;return _0x2eef21;})['then'](respondWithFilteredResult(_0xeed070,_0x7470ac))[_0xf606('0x41')](handleError(_0xeed070,null));};exports[_0xf606('0x42')]=function(_0x20c5ec,_0x54539e){var _0x433b76={'raw':!![],'where':{'id':_0x20c5ec[_0xf606('0x43')]['id']}},_0x5b0676={};_0x5b0676[_0xf606('0x2c')]=_['keys'](db['VoiceTransferReport'][_0xf606('0x28')]);_0x5b0676[_0xf606('0x2d')]=_['keys'](_0x20c5ec[_0xf606('0x2d')]);_0x5b0676[_0xf606('0x2f')]=_[_0xf606('0x30')](_0x5b0676[_0xf606('0x2c')],_0x5b0676[_0xf606('0x2d')]);_0x433b76[_0xf606('0x31')]=_[_0xf606('0x30')](_0x5b0676[_0xf606('0x2c')],qs[_0xf606('0x32')](_0x20c5ec[_0xf606('0x2d')][_0xf606('0x32')]));_0x433b76[_0xf606('0x31')]=_0x433b76[_0xf606('0x31')][_0xf606('0x33')]?_0x433b76[_0xf606('0x31')]:_0x5b0676[_0xf606('0x2c')];if(_0x20c5ec[_0xf606('0x2d')][_0xf606('0x3d')]){_0x433b76['include']=[{'all':!![]}];}_0x433b76=_[_0xf606('0x39')]({},_0x433b76,_0x20c5ec[_0xf606('0x3b')]);return db[_0xf606('0x3c')]['find'](_0x433b76)[_0xf606('0x20')](handleEntityNotFound(_0x54539e,null))['then'](respondWithResult(_0x54539e,null))[_0xf606('0x41')](handleError(_0x54539e,null));};exports[_0xf606('0x44')]=function(_0x5797cc,_0x30a046){return db[_0xf606('0x3c')][_0xf606('0x44')](_0x5797cc['body'],{})[_0xf606('0x20')](respondWithResult(_0x30a046,0xc9))['catch'](handleError(_0x30a046,null));};exports['update']=function(_0x13832f,_0xbeafea){if(_0x13832f[_0xf606('0x45')]['id']){delete _0x13832f[_0xf606('0x45')]['id'];}return db[_0xf606('0x3c')]['find']({'where':{'id':_0x13832f[_0xf606('0x43')]['id']}})[_0xf606('0x20')](handleEntityNotFound(_0xbeafea,null))[_0xf606('0x20')](saveUpdates(_0x13832f[_0xf606('0x45')],null))[_0xf606('0x20')](respondWithResult(_0xbeafea,null))['catch'](handleError(_0xbeafea,null));};exports['destroy']=function(_0x441e4a,_0x5c3922){return db[_0xf606('0x3c')][_0xf606('0x46')]({'where':{'id':_0x441e4a['params']['id']}})['then'](handleEntityNotFound(_0x5c3922,null))[_0xf606('0x20')](removeEntity(_0x5c3922,null))[_0xf606('0x41')](handleError(_0x5c3922,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 01c6433..0c5945d 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 _0x5bbb=['define','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','exports'];(function(_0xb64018,_0x4a2ebe){var _0x56a70e=function(_0x5adf41){while(--_0x5adf41){_0xb64018['push'](_0xb64018['shift']());}};_0x56a70e(++_0x4a2ebe);}(_0x5bbb,0x64));var _0xb5bb=function(_0x2d8899,_0x155525){_0x2d8899=_0x2d8899-0x0;var _0x181807=_0x5bbb[_0x2d8899];return _0x181807;};'use strict';var _=require(_0xb5bb('0x0'));var util=require(_0xb5bb('0x1'));var logger=require(_0xb5bb('0x2'))(_0xb5bb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb5bb('0x4'));var rimraf=require(_0xb5bb('0x5'));var config=require(_0xb5bb('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0xb5bb('0x7')]=function(_0x1b0bfa,_0x4689ff){return _0x1b0bfa[_0xb5bb('0x8')]('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d18=['../../config/logger','moment','bluebird','request-promise','rimraf','./voiceTransferReport.attributes','exports','define','report_call_transfer','lodash','util'];(function(_0x408778,_0x157bd1){var _0x545940=function(_0x1a4dea){while(--_0x1a4dea){_0x408778['push'](_0x408778['shift']());}};_0x545940(++_0x157bd1);}(_0x3d18,0x169));var _0x83d1=function(_0x3766e0,_0x3203fa){_0x3766e0=_0x3766e0-0x0;var _0x28f495=_0x3d18[_0x3766e0];return _0x28f495;};'use strict';var _=require(_0x83d1('0x0'));var util=require(_0x83d1('0x1'));var logger=require(_0x83d1('0x2'))('api');var moment=require(_0x83d1('0x3'));var BPromise=require(_0x83d1('0x4'));var rp=require(_0x83d1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x83d1('0x6'));var config=require('../../config/environment');var attributes=require(_0x83d1('0x7'));module[_0x83d1('0x8')]=function(_0x4b6b02,_0x49196d){return _0x4b6b02[_0x83d1('0x9')]('VoiceTransferReport',attributes,{'tableName':_0x83d1('0xa'),'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 ed47b32..12dd474 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 _0xd95e=['options','raw','then','debug','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','body'];(function(_0x4b784d,_0x5efb2f){var _0x2cdeaf=function(_0x106242){while(--_0x106242){_0x4b784d['push'](_0x4b784d['shift']());}};_0x2cdeaf(++_0x5efb2f);}(_0xd95e,0x171));var _0xed95=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd95e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xed95('0x0'));var util=require('util');var moment=require(_0xed95('0x1'));var BPromise=require(_0xed95('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed95('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xed95('0x4'));var logger=require(_0xed95('0x5'))(_0xed95('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xed95('0x7')][_0xed95('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c5d9b,_0x20d95e,_0x189d73){return new BPromise(function(_0x48a3f6,_0x22a735){return client[_0xed95('0x9')](_0x5c5d9b,_0x189d73)['then'](function(_0x485974){logger[_0xed95('0xa')](_0xed95('0xb'),_0x20d95e,_0xed95('0xc'));logger['debug'](_0xed95('0xd'),_0x20d95e,_0xed95('0xc'),JSON[_0xed95('0xe')](_0x485974));if(_0x485974[_0xed95('0xf')]){if(_0x485974['error'][_0xed95('0x10')]===0x1f4){logger[_0xed95('0xf')](_0xed95('0xb'),_0x20d95e,_0x485974[_0xed95('0xf')][_0xed95('0x11')]);return _0x22a735(_0x485974[_0xed95('0xf')]['message']);}logger['error'](_0xed95('0xb'),_0x20d95e,_0x485974[_0xed95('0xf')]['message']);return _0x48a3f6(_0x485974[_0xed95('0xf')][_0xed95('0x11')]);}else{logger[_0xed95('0xa')](_0xed95('0xb'),_0x20d95e,_0xed95('0xc'));_0x48a3f6(_0x485974[_0xed95('0x12')][_0xed95('0x11')]);}})['catch'](function(_0x1338c4){logger['error'](_0xed95('0xb'),_0x20d95e,_0x1338c4);_0x22a735(_0x1338c4);});});}exports[_0xed95('0x13')]=function(_0x5cc98d){var _0x30ba25=this;return new Promise(function(_0x5d4ef4,_0x5a9f7c){return db[_0xed95('0x14')][_0xed95('0x15')](_0x5cc98d[_0xed95('0x16')],{'raw':_0x5cc98d[_0xed95('0x17')]?_0x5cc98d[_0xed95('0x17')][_0xed95('0x18')]===undefined?!![]:![]:!![]})[_0xed95('0x19')](function(_0x59763e){logger['info'](_0xed95('0x13'),_0x5cc98d);logger[_0xed95('0x1a')](_0xed95('0x13'),_0x5cc98d,JSON[_0xed95('0xe')](_0x59763e));_0x5d4ef4(_0x59763e);})[_0xed95('0x1b')](function(_0x47e242){logger['error'](_0xed95('0x13'),_0x47e242[_0xed95('0x11')],_0x5cc98d);_0x5a9f7c(_0x30ba25[_0xed95('0xf')](0x1f4,_0x47e242[_0xed95('0x11')]));});});}; \ No newline at end of file +var _0xfa90=['VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','CreateVoiceTransferReport','create','body','options','raw','catch','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VoiceTransferReport,\x20%s,\x20%s','debug'];(function(_0x520e3b,_0x36ddc0){var _0xb07b0a=function(_0x260e9a){while(--_0x260e9a){_0x520e3b['push'](_0x520e3b['shift']());}};_0xb07b0a(++_0x36ddc0);}(_0xfa90,0xbb));var _0x0fa9=function(_0x28475a,_0x4ae9db){_0x28475a=_0x28475a-0x0;var _0x10ec1f=_0xfa90[_0x28475a];return _0x10ec1f;};'use strict';var _=require(_0x0fa9('0x0'));var util=require(_0x0fa9('0x1'));var moment=require(_0x0fa9('0x2'));var BPromise=require('bluebird');var rs=require(_0x0fa9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0fa9('0x4'))(_0x0fa9('0x5'));var config=require(_0x0fa9('0x6'));var jayson=require(_0x0fa9('0x7'));var client=jayson[_0x0fa9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x554b84,_0x5906bd,_0x2cd606){return new BPromise(function(_0x463be3,_0x5e07f2){return client[_0x0fa9('0x9')](_0x554b84,_0x2cd606)[_0x0fa9('0xa')](function(_0x4d0ac0){logger['info'](_0x0fa9('0xb'),_0x5906bd,'request\x20sent');logger[_0x0fa9('0xc')](_0x0fa9('0xd'),_0x5906bd,_0x0fa9('0xe'),JSON[_0x0fa9('0xf')](_0x4d0ac0));if(_0x4d0ac0['error']){if(_0x4d0ac0[_0x0fa9('0x10')]['code']===0x1f4){logger['error'](_0x0fa9('0xb'),_0x5906bd,_0x4d0ac0[_0x0fa9('0x10')][_0x0fa9('0x11')]);return _0x5e07f2(_0x4d0ac0['error'][_0x0fa9('0x11')]);}logger[_0x0fa9('0x10')](_0x0fa9('0xb'),_0x5906bd,_0x4d0ac0['error']['message']);return _0x463be3(_0x4d0ac0[_0x0fa9('0x10')][_0x0fa9('0x11')]);}else{logger[_0x0fa9('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x5906bd,_0x0fa9('0xe'));_0x463be3(_0x4d0ac0['result'][_0x0fa9('0x11')]);}})['catch'](function(_0x32e626){logger[_0x0fa9('0x10')](_0x0fa9('0xb'),_0x5906bd,_0x32e626);_0x5e07f2(_0x32e626);});});}exports[_0x0fa9('0x13')]=function(_0x14346f){var _0x15f550=this;return new Promise(function(_0x36aeb5,_0x11663f){return db['VoiceTransferReport'][_0x0fa9('0x14')](_0x14346f[_0x0fa9('0x15')],{'raw':_0x14346f[_0x0fa9('0x16')]?_0x14346f[_0x0fa9('0x16')][_0x0fa9('0x17')]===undefined?!![]:![]:!![]})[_0x0fa9('0xa')](function(_0x28113a){logger[_0x0fa9('0x12')]('CreateVoiceTransferReport',_0x14346f);logger['debug'](_0x0fa9('0x13'),_0x14346f,JSON[_0x0fa9('0xf')](_0x28113a));_0x36aeb5(_0x28113a);})[_0x0fa9('0x18')](function(_0x3a282b){logger[_0x0fa9('0x10')](_0x0fa9('0x13'),_0x3a282b[_0x0fa9('0x11')],_0x14346f);_0x11663f(_0x15f550[_0x0fa9('0x10')](0x1f4,_0x3a282b[_0x0fa9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index b7a19e1..481bd97 100644 --- a/server/api/webbar/index.js +++ b/server/api/webbar/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9585=['/hangup','/answer','answer','/hold','/unhold','unhold','/calls','calls','transfer','exports','Router','./webbar.controller','post','/originate','isAuthenticated','canUpdate','originate'];(function(_0x5d1cda,_0x42b56f){var _0x429e44=function(_0x2917f1){while(--_0x2917f1){_0x5d1cda['push'](_0x5d1cda['shift']());}};_0x429e44(++_0x42b56f);}(_0x9585,0x15e));var _0x5958=function(_0x9bd21f,_0x40b673){_0x9bd21f=_0x9bd21f-0x0;var _0x33b93d=_0x9585[_0x9bd21f];return _0x33b93d;};'use strict';var express=require('express');var router=express[_0x5958('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5958('0x1'));router[_0x5958('0x2')](_0x5958('0x3'),auth[_0x5958('0x4')](),auth[_0x5958('0x5')](),controller[_0x5958('0x6')]);router[_0x5958('0x2')](_0x5958('0x7'),auth['isAuthenticated'](),auth[_0x5958('0x5')](),controller['hangup']);router[_0x5958('0x2')](_0x5958('0x8'),auth[_0x5958('0x4')](),auth['canUpdate'](),controller[_0x5958('0x9')]);router['post'](_0x5958('0xa'),auth[_0x5958('0x4')](),auth['canUpdate'](),controller['hold']);router[_0x5958('0x2')](_0x5958('0xb'),auth[_0x5958('0x4')](),auth[_0x5958('0x5')](),controller[_0x5958('0xc')]);router['post'](_0x5958('0xd'),auth[_0x5958('0x4')](),auth[_0x5958('0x5')](),controller[_0x5958('0xe')]);router[_0x5958('0x2')]('/transfer',auth['isAuthenticated'](),auth[_0x5958('0x5')](),controller[_0x5958('0xf')]);module[_0x5958('0x10')]=router; \ No newline at end of file +var _0xc368=['calls','/transfer','transfer','exports','Router','./webbar.controller','post','/originate','isAuthenticated','canUpdate','/hangup','/answer','answer','/hold','/unhold','unhold','/calls'];(function(_0x28b83a,_0x401d6f){var _0x5985d9=function(_0x37d489){while(--_0x37d489){_0x28b83a['push'](_0x28b83a['shift']());}};_0x5985d9(++_0x401d6f);}(_0xc368,0x7b));var _0x8c36=function(_0x26541a,_0x53e583){_0x26541a=_0x26541a-0x0;var _0xaaff11=_0xc368[_0x26541a];return _0xaaff11;};'use strict';var express=require('express');var router=express[_0x8c36('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x8c36('0x1'));router[_0x8c36('0x2')](_0x8c36('0x3'),auth[_0x8c36('0x4')](),auth[_0x8c36('0x5')](),controller['originate']);router[_0x8c36('0x2')](_0x8c36('0x6'),auth[_0x8c36('0x4')](),auth[_0x8c36('0x5')](),controller['hangup']);router['post'](_0x8c36('0x7'),auth[_0x8c36('0x4')](),auth[_0x8c36('0x5')](),controller[_0x8c36('0x8')]);router[_0x8c36('0x2')](_0x8c36('0x9'),auth['isAuthenticated'](),auth['canUpdate'](),controller['hold']);router[_0x8c36('0x2')](_0x8c36('0xa'),auth['isAuthenticated'](),auth[_0x8c36('0x5')](),controller[_0x8c36('0xb')]);router[_0x8c36('0x2')](_0x8c36('0xc'),auth[_0x8c36('0x4')](),auth[_0x8c36('0x5')](),controller[_0x8c36('0xd')]);router[_0x8c36('0x2')](_0x8c36('0xe'),auth[_0x8c36('0x4')](),auth[_0x8c36('0x5')](),controller[_0x8c36('0xf')]);module[_0x8c36('0x10')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 8fd979c..f1ef0e9 100644 --- a/server/api/webbar/webbar.controller.js +++ b/server/api/webbar/webbar.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1738=['unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','all','rows','conference','webbar:conference','transfer','webbar:transfer','transfer\x20executed!','path','lodash','util','bluebird','jayson/promise','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','string','callNumber\x20is\x20required','userId\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','stack','name','status','send','request','error','code','message','result','catch','User','findOne','then','VoiceChannels','filter','UserId','sessionId','\x20not\x20found!','originate','originate\x20fired:','body','length','json','userId','callNumber','callerId','callbackUrl','format','user:%s','originate\x20executed!','hangup\x20fired:','entityFound:','webbar:hangup','answer','answer\x20fired:','hold\x20fired:','webbar:hold'];(function(_0x2bbe84,_0x27e011){var _0x5467bd=function(_0x3051e1){while(--_0x3051e1){_0x2bbe84['push'](_0x2bbe84['shift']());}};_0x5467bd(++_0x27e011);}(_0x1738,0x1bc));var _0x8173=function(_0x2cc040,_0x5ae295){_0x2cc040=_0x2cc040-0x0;var _0x43274a=_0x1738[_0x2cc040];return _0x43274a;};'use strict';var path=require(_0x8173('0x0'));var fs=require('fs');var _=require(_0x8173('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var util=require(_0x8173('0x2'));var BPromise=require(_0x8173('0x3'));var jayson=require(_0x8173('0x4'));var amiClient=jayson['client']['http']({'port':0x232a});var logger=require(_0x8173('0x5'))(_0x8173('0x6'));var Redis=require(_0x8173('0x7'));config[_0x8173('0x8')]=_[_0x8173('0x9')](config[_0x8173('0x8')],{'host':_0x8173('0xa'),'port':0x18eb});var io=require(_0x8173('0xb'))(new Redis(config[_0x8173('0x8')]));var Schema=require(_0x8173('0xc'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x8173('0xd'),'required':[!![],_0x8173('0xe')]},'callerId':{'type':_0x8173('0xd')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8173('0xf')]},'sessionId':{'type':_0x8173('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x8173('0x10'),'required':[!![],_0x8173('0xf')]},'sessionId':{'type':_0x8173('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8173('0xf')]},'sessionId':{'type':'string','required':[!![],_0x8173('0x11')]},'transferNumber':{'type':_0x8173('0xd'),'required':[!![],_0x8173('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x8173('0x10'),'required':[!![],_0x8173('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8173('0x10'),'required':[!![],_0x8173('0xf')]},'sessionId':{'type':_0x8173('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x8173('0x10'),'required':[!![],_0x8173('0xf')]}});function emit(_0x2e7ca5,_0x58fcf1,_0x2932b2){logger[_0x8173('0x13')](_0x2e7ca5,_0x58fcf1,JSON['stringify'](_0x2932b2));io['to'](_0x2e7ca5)[_0x8173('0x14')](_0x58fcf1,_0x2932b2);}function handleError(_0x1328dc){return function(_0x1caca9){console[_0x8173('0x15')](_0x8173('0x16'),_0x1caca9,_0x1caca9 instanceof RangeError);logger['error'](_0x1caca9[_0x8173('0x17')]);if(_0x1caca9 instanceof RangeError){if(_0x1caca9[_0x8173('0x18')]){delete _0x1caca9[_0x8173('0x18')];}_0x1328dc[_0x8173('0x19')](0x194)[_0x8173('0x1a')](_0x1caca9);}else{if(_0x1caca9[_0x8173('0x18')]){delete _0x1caca9[_0x8173('0x18')];}_0x1328dc[_0x8173('0x19')](0x1f4)[_0x8173('0x1a')](_0x1caca9);}};}function checkError(){return function(_0x2e6747){if(!_0x2e6747){throw new RangeError('NotFound');}return _0x2e6747;};}function respondWithRpcPromise(_0x331bcb,_0x19a4a7){return new BPromise(function(_0x4c0556,_0x3f613f){var _0x5c6d79=amiClient;return _0x5c6d79[_0x8173('0x1b')](_0x331bcb,_0x19a4a7)['then'](function(_0x2d58ef){if(_0x2d58ef['error']){if(_0x2d58ef[_0x8173('0x1c')][_0x8173('0x1d')]===0x1f4){return _0x3f613f(_0x2d58ef['error'][_0x8173('0x1e')]);}return _0x4c0556(_0x2d58ef['error'][_0x8173('0x1e')]);}else{_0x4c0556(_0x2d58ef[_0x8173('0x1f')]);}})[_0x8173('0x20')](function(_0x39d430){_0x3f613f(_0x39d430);});});}function getAgent(_0x273820){return db[_0x8173('0x21')][_0x8173('0x22')]({'where':{'id':_0x273820,'role':'agent'}})[_0x8173('0x23')](checkError());}function getAgentCheckSession(_0x8fcf1e,_0x4fbe19){return new BPromise(function(_0x52c249,_0x2eea21){var _0xa6389f=respondWithRpcPromise(_0x8173('0x24'));var _0x5ee6e0=getAgent(_0x8fcf1e);Promise['all']([_0xa6389f,_0x5ee6e0])[_0x8173('0x23')](function(_0x469a51){var _0xcd2ac6=_0x469a51[0x0];var _0x10d969=_0x469a51[0x1];var _0x4d849c=_[_0x8173('0x25')](_0xcd2ac6['rows'],function(_0x47f4ce){return _0x47f4ce[_0x8173('0x26')]==_0x10d969['id']&&_0x47f4ce[_0x8173('0x27')]==_0x4fbe19;});if(_0x4d849c['length']==0x1){_0x52c249(_0x10d969);}else{_0x2eea21(new RangeError('sessionId\x20'+_0x4fbe19+_0x8173('0x28')));}});});}exports[_0x8173('0x29')]=function(_0x36c282,_0x55a6df){logger[_0x8173('0x13')](_0x8173('0x2a'),_0x36c282[_0x8173('0x2b')]);var _0x464998=originateValidation[_0x8173('0xc')](_0x36c282['body']);if(_0x464998[_0x8173('0x2c')]>0x0){return _0x55a6df[_0x8173('0x19')](0x190)[_0x8173('0x2d')](_0x464998);}var _0x5c27ba=_0x36c282[_0x8173('0x2b')][_0x8173('0x2e')];var _0x34ba20=_0x36c282[_0x8173('0x2b')][_0x8173('0x2f')];var _0x41ae06=_0x36c282[_0x8173('0x2b')][_0x8173('0x30')];var _0x2e6591=_0x36c282['body'][_0x8173('0x31')];return getAgent(_0x5c27ba)[_0x8173('0x23')](function(_0x1ba0bb){logger[_0x8173('0x13')]('entityFound:',_0x1ba0bb[_0x8173('0x18')]);emit(util[_0x8173('0x32')](_0x8173('0x33'),_0x1ba0bb[_0x8173('0x18')]),'webbar:originate',{'callNumber':_0x34ba20,'callerId':_0x41ae06,'callbackUrl':_0x2e6591});return _0x55a6df[_0x8173('0x19')](0xc8)[_0x8173('0x2d')]({'error':![],'message':_0x8173('0x34')});})[_0x8173('0x20')](handleError(_0x55a6df));};exports['hangup']=function(_0x4416e8,_0x2ab1e4){logger[_0x8173('0x13')](_0x8173('0x35'),_0x4416e8['body']);var _0x52142d=hangupValidation['validate'](_0x4416e8[_0x8173('0x2b')]);if(_0x52142d['length']>0x0){return _0x2ab1e4[_0x8173('0x19')](0x190)['json'](_0x52142d);}var _0x5c2eef=_0x4416e8[_0x8173('0x2b')][_0x8173('0x2e')];var _0x4f069d=_0x4416e8[_0x8173('0x2b')][_0x8173('0x27')];return getAgent(_0x5c2eef)[_0x8173('0x23')](function(_0x48a912){logger[_0x8173('0x13')](_0x8173('0x36'),_0x48a912['name']);emit(util[_0x8173('0x32')](_0x8173('0x33'),_0x48a912['name']),_0x8173('0x37'),{'sessionId':_0x4f069d});return _0x2ab1e4['status'](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})[_0x8173('0x20')](handleError(_0x2ab1e4));};exports[_0x8173('0x38')]=function(_0x1d7e07,_0x4d9ba5){logger[_0x8173('0x13')](_0x8173('0x39'),_0x1d7e07[_0x8173('0x2b')]);var _0x332cda=answerValidation[_0x8173('0xc')](_0x1d7e07[_0x8173('0x2b')]);if(_0x332cda[_0x8173('0x2c')]>0x0){return _0x4d9ba5['status'](0x190)[_0x8173('0x2d')](_0x332cda);}var _0x76f6b=_0x1d7e07[_0x8173('0x2b')][_0x8173('0x2e')];var _0x25c301=_0x1d7e07[_0x8173('0x2b')][_0x8173('0x27')];return getAgent(_0x76f6b)['then'](function(_0x45a19e){logger[_0x8173('0x13')](_0x8173('0x36'),_0x45a19e[_0x8173('0x18')]);emit(util[_0x8173('0x32')](_0x8173('0x33'),_0x45a19e['name']),'webbar:answer',{'sessionId':_0x25c301});return _0x4d9ba5[_0x8173('0x19')](0xc8)[_0x8173('0x2d')]({'error':![],'message':'answer\x20executed!'});})[_0x8173('0x20')](handleError(_0x4d9ba5));};exports['hold']=function(_0x4c8305,_0x440372){logger[_0x8173('0x13')](_0x8173('0x3a'),_0x4c8305[_0x8173('0x2b')]);var _0x252491=holdValidation[_0x8173('0xc')](_0x4c8305[_0x8173('0x2b')]);if(_0x252491[_0x8173('0x2c')]>0x0){return _0x440372[_0x8173('0x19')](0x190)[_0x8173('0x2d')](_0x252491);}var _0x2d472c=_0x4c8305[_0x8173('0x2b')]['userId'];var _0x5944f2=_0x4c8305[_0x8173('0x2b')][_0x8173('0x27')];return getAgent(_0x2d472c)[_0x8173('0x23')](function(_0x426d6){logger[_0x8173('0x13')](_0x8173('0x36'),_0x426d6[_0x8173('0x18')]);emit(util[_0x8173('0x32')](_0x8173('0x33'),_0x426d6[_0x8173('0x18')]),_0x8173('0x3b'),{'sessionId':_0x5944f2});return _0x440372['status'](0xc8)[_0x8173('0x2d')]({'error':![],'message':'hold\x20executed!'});})[_0x8173('0x20')](handleError(_0x440372));};exports[_0x8173('0x3c')]=function(_0x565e06,_0x5c22a2){logger[_0x8173('0x13')](_0x8173('0x3d'),_0x565e06['body']);var _0xeb218e=unholdValidation['validate'](_0x565e06['body']);if(_0xeb218e['length']>0x0){return _0x5c22a2[_0x8173('0x19')](0x190)[_0x8173('0x2d')](_0xeb218e);}var _0x2bf7ae=_0x565e06[_0x8173('0x2b')]['userId'];var _0xc4650f=_0x565e06[_0x8173('0x2b')][_0x8173('0x27')];return getAgent(_0x2bf7ae)[_0x8173('0x23')](function(_0xd4bb3f){logger[_0x8173('0x13')]('entityFound:',_0xd4bb3f[_0x8173('0x18')]);emit(util[_0x8173('0x32')](_0x8173('0x33'),_0xd4bb3f[_0x8173('0x18')]),_0x8173('0x3e'),{'sessionId':_0xc4650f});return _0x5c22a2['status'](0xc8)[_0x8173('0x2d')]({'error':![],'message':_0x8173('0x3f')});})[_0x8173('0x20')](handleError(_0x5c22a2));};exports[_0x8173('0x40')]=function(_0x53d440,_0x7064b8){logger[_0x8173('0x13')]('calls\x20fired:',_0x7064b8[_0x8173('0x2b')]);var _0xcf554e=callsValidation[_0x8173('0xc')](_0x53d440[_0x8173('0x2b')]);if(_0xcf554e[_0x8173('0x2c')]>0x0){return _0x7064b8[_0x8173('0x19')](0x190)[_0x8173('0x2d')](_0xcf554e);}var _0x2f9161=_0x53d440[_0x8173('0x2b')]['userId'];var _0x1dab4a=respondWithRpcPromise(_0x8173('0x24'));var _0x3cb054=getAgent(_0x2f9161);return Promise[_0x8173('0x41')]([_0x1dab4a,_0x3cb054])[_0x8173('0x23')](function(_0x1e2218){var _0x551bf0=_0x1e2218[0x0];var _0x2feeff=_0x1e2218[0x1];var _0x503065=_['filter'](_0x551bf0[_0x8173('0x42')],function(_0x5885e1){return _0x5885e1[_0x8173('0x26')]==_0x2feeff['id'];});return _0x7064b8['status'](0xc8)[_0x8173('0x2d')]({'count':_0x503065[_0x8173('0x2c')],'rows':_0x503065});})['catch'](handleError(_0x7064b8));};exports[_0x8173('0x43')]=function(_0x349e6e,_0xd304e1){logger[_0x8173('0x13')]('conference\x20fired:',_0x349e6e['body']);var _0xf09c23=conferenceValidation[_0x8173('0xc')](_0x349e6e[_0x8173('0x2b')]);if(_0xf09c23[_0x8173('0x2c')]>0x0){return _0xd304e1[_0x8173('0x19')](0x190)['json'](_0xf09c23);}var _0x52b3df=_0x349e6e[_0x8173('0x2b')][_0x8173('0x2e')];return getAgent(_0x52b3df)[_0x8173('0x23')](function(_0x2d4dc7){logger['info']('entityFound:',_0x2d4dc7[_0x8173('0x18')]);emit(util['format'](_0x8173('0x33'),_0x2d4dc7[_0x8173('0x18')]),_0x8173('0x44'));return _0xd304e1[_0x8173('0x19')](0xc8)[_0x8173('0x2d')]({'error':![],'message':'conference\x20executed!'});})[_0x8173('0x20')](handleError(_0xd304e1));};exports[_0x8173('0x45')]=function(_0x15a317,_0x2445f0){logger[_0x8173('0x13')]('transfer\x20fired:',_0x15a317[_0x8173('0x2b')]);var _0x4cf730=transferValidation[_0x8173('0xc')](_0x15a317['body']);if(_0x4cf730[_0x8173('0x2c')]>0x0){return _0x2445f0[_0x8173('0x19')](0x190)[_0x8173('0x2d')](_0x4cf730);}var _0x5d910a=_0x15a317[_0x8173('0x2b')][_0x8173('0x2e')];var _0x41233c=_0x15a317['body'][_0x8173('0x27')];var _0x4b6b90=_0x15a317[_0x8173('0x2b')]['transferNumber'];return getAgent(_0x5d910a)[_0x8173('0x23')](function(_0x3d79ef){logger[_0x8173('0x13')](_0x8173('0x36'),_0x3d79ef[_0x8173('0x18')]);emit(util[_0x8173('0x32')](_0x8173('0x33'),_0x3d79ef['name']),_0x8173('0x46'),{'sessionId':_0x41233c,'transferNumber':_0x4b6b90});return _0x2445f0[_0x8173('0x19')](0xc8)[_0x8173('0x2d')]({'error':![],'message':_0x8173('0x47')});})['catch'](handleError(_0x2445f0));}; \ No newline at end of file +var _0x342b=['json','callNumber','callerId','callbackUrl','info','format','user:%s','webbar:originate','originate\x20executed!','hangup','userId','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','rows','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','path','../../mysqldb','../../config/environment','util','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','emit','log','handleError:','error','stack','name','send','status','NotFound','request','then','code','result','catch','findOne','agent','VoiceChannels','all','filter','UserId','sessionId','length','sessionId\x20','originate','originate\x20fired:','validate','body'];(function(_0x3c85f3,_0x49dc88){var _0x3e0304=function(_0x419808){while(--_0x419808){_0x3c85f3['push'](_0x3c85f3['shift']());}};_0x3e0304(++_0x49dc88);}(_0x342b,0xbc));var _0xb342=function(_0x3c077c,_0x5e47b5){_0x3c077c=_0x3c077c-0x0;var _0x38e047=_0x342b[_0x3c077c];return _0x38e047;};'use strict';var path=require(_0xb342('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0xb342('0x1'))['db'];var config=require(_0xb342('0x2'));var util=require(_0xb342('0x3'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson['client']['http']({'port':0x232a});var logger=require(_0xb342('0x4'))(_0xb342('0x5'));var Redis=require(_0xb342('0x6'));config[_0xb342('0x7')]=_[_0xb342('0x8')](config[_0xb342('0x7')],{'host':_0xb342('0x9'),'port':0x18eb});var io=require(_0xb342('0xa'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xb342('0xb'),'required':[!![],_0xb342('0xc')]},'callNumber':{'type':'string','required':[!![],_0xb342('0xd')]},'callerId':{'type':_0xb342('0xe')},'callbackUrl':{'type':_0xb342('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0xb342('0xb'),'required':[!![],_0xb342('0xc')]},'sessionId':{'type':_0xb342('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xb342('0xb'),'required':[!![],_0xb342('0xc')]},'sessionId':{'type':_0xb342('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xb342('0xb'),'required':[!![],_0xb342('0xc')]},'sessionId':{'type':'string','required':[!![],_0xb342('0xf')]},'transferNumber':{'type':'string','required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xb342('0xc')]},'sessionId':{'type':_0xb342('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xb342('0xb'),'required':[!![],_0xb342('0xc')]},'sessionId':{'type':_0xb342('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xb342('0xb'),'required':[!![],_0xb342('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0xb342('0xb'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x435b8c,_0x1057f9,_0x4ab953){logger['info'](_0x435b8c,_0x1057f9,JSON['stringify'](_0x4ab953));io['to'](_0x435b8c)[_0xb342('0x10')](_0x1057f9,_0x4ab953);}function handleError(_0x1fdb22){return function(_0x52b3b6){console[_0xb342('0x11')](_0xb342('0x12'),_0x52b3b6,_0x52b3b6 instanceof RangeError);logger[_0xb342('0x13')](_0x52b3b6[_0xb342('0x14')]);if(_0x52b3b6 instanceof RangeError){if(_0x52b3b6[_0xb342('0x15')]){delete _0x52b3b6['name'];}_0x1fdb22['status'](0x194)[_0xb342('0x16')](_0x52b3b6);}else{if(_0x52b3b6['name']){delete _0x52b3b6[_0xb342('0x15')];}_0x1fdb22[_0xb342('0x17')](0x1f4)[_0xb342('0x16')](_0x52b3b6);}};}function checkError(){return function(_0xca6906){if(!_0xca6906){throw new RangeError(_0xb342('0x18'));}return _0xca6906;};}function respondWithRpcPromise(_0x553fd3,_0xd3f9be){return new BPromise(function(_0x4dfca1,_0x99593d){var _0x59d63a=amiClient;return _0x59d63a[_0xb342('0x19')](_0x553fd3,_0xd3f9be)[_0xb342('0x1a')](function(_0x422bec){if(_0x422bec[_0xb342('0x13')]){if(_0x422bec['error'][_0xb342('0x1b')]===0x1f4){return _0x99593d(_0x422bec['error']['message']);}return _0x4dfca1(_0x422bec[_0xb342('0x13')]['message']);}else{_0x4dfca1(_0x422bec[_0xb342('0x1c')]);}})[_0xb342('0x1d')](function(_0x2cfb0d){_0x99593d(_0x2cfb0d);});});}function getAgent(_0x14e1e3){return db['User'][_0xb342('0x1e')]({'where':{'id':_0x14e1e3,'role':_0xb342('0x1f')}})[_0xb342('0x1a')](checkError());}function getAgentCheckSession(_0xe36c4b,_0x4696ac){return new BPromise(function(_0x27005b,_0x127dbc){var _0x59f5b4=respondWithRpcPromise(_0xb342('0x20'));var _0x168d1b=getAgent(_0xe36c4b);Promise[_0xb342('0x21')]([_0x59f5b4,_0x168d1b])['then'](function(_0x54cc70){var _0x5f320d=_0x54cc70[0x0];var _0x3abe87=_0x54cc70[0x1];var _0x56dd88=_[_0xb342('0x22')](_0x5f320d['rows'],function(_0x37d262){return _0x37d262[_0xb342('0x23')]==_0x3abe87['id']&&_0x37d262[_0xb342('0x24')]==_0x4696ac;});if(_0x56dd88[_0xb342('0x25')]==0x1){_0x27005b(_0x3abe87);}else{_0x127dbc(new RangeError(_0xb342('0x26')+_0x4696ac+'\x20not\x20found!'));}});});}exports[_0xb342('0x27')]=function(_0x3beb06,_0x18cf78){logger['info'](_0xb342('0x28'),_0x3beb06['body']);var _0x25e83e=originateValidation[_0xb342('0x29')](_0x3beb06[_0xb342('0x2a')]);if(_0x25e83e[_0xb342('0x25')]>0x0){return _0x18cf78[_0xb342('0x17')](0x190)[_0xb342('0x2b')](_0x25e83e);}var _0x46b0c0=_0x3beb06['body']['userId'];var _0x50c23a=_0x3beb06[_0xb342('0x2a')][_0xb342('0x2c')];var _0x4fbe59=_0x3beb06['body'][_0xb342('0x2d')];var _0x14131a=_0x3beb06[_0xb342('0x2a')][_0xb342('0x2e')];return getAgent(_0x46b0c0)[_0xb342('0x1a')](function(_0x1c6e5d){logger[_0xb342('0x2f')]('entityFound:',_0x1c6e5d[_0xb342('0x15')]);emit(util[_0xb342('0x30')](_0xb342('0x31'),_0x1c6e5d[_0xb342('0x15')]),_0xb342('0x32'),{'callNumber':_0x50c23a,'callerId':_0x4fbe59,'callbackUrl':_0x14131a});return _0x18cf78[_0xb342('0x17')](0xc8)['json']({'error':![],'message':_0xb342('0x33')});})[_0xb342('0x1d')](handleError(_0x18cf78));};exports[_0xb342('0x34')]=function(_0x3bd06c,_0x587c48){logger['info']('hangup\x20fired:',_0x3bd06c[_0xb342('0x2a')]);var _0xaa8ef8=hangupValidation[_0xb342('0x29')](_0x3bd06c['body']);if(_0xaa8ef8[_0xb342('0x25')]>0x0){return _0x587c48[_0xb342('0x17')](0x190)['json'](_0xaa8ef8);}var _0x449e6e=_0x3bd06c[_0xb342('0x2a')][_0xb342('0x35')];var _0x3f358a=_0x3bd06c[_0xb342('0x2a')][_0xb342('0x24')];return getAgent(_0x449e6e)[_0xb342('0x1a')](function(_0x58e57f){logger['info'](_0xb342('0x36'),_0x58e57f[_0xb342('0x15')]);emit(util[_0xb342('0x30')](_0xb342('0x31'),_0x58e57f[_0xb342('0x15')]),_0xb342('0x37'),{'sessionId':_0x3f358a});return _0x587c48[_0xb342('0x17')](0xc8)[_0xb342('0x2b')]({'error':![],'message':_0xb342('0x38')});})[_0xb342('0x1d')](handleError(_0x587c48));};exports[_0xb342('0x39')]=function(_0x316083,_0x292ad3){logger[_0xb342('0x2f')](_0xb342('0x3a'),_0x316083[_0xb342('0x2a')]);var _0x4ac3db=answerValidation['validate'](_0x316083['body']);if(_0x4ac3db[_0xb342('0x25')]>0x0){return _0x292ad3[_0xb342('0x17')](0x190)[_0xb342('0x2b')](_0x4ac3db);}var _0x34849c=_0x316083[_0xb342('0x2a')]['userId'];var _0x4cc0fb=_0x316083[_0xb342('0x2a')]['sessionId'];return getAgent(_0x34849c)[_0xb342('0x1a')](function(_0x321dc1){logger[_0xb342('0x2f')](_0xb342('0x36'),_0x321dc1[_0xb342('0x15')]);emit(util[_0xb342('0x30')]('user:%s',_0x321dc1[_0xb342('0x15')]),_0xb342('0x3b'),{'sessionId':_0x4cc0fb});return _0x292ad3[_0xb342('0x17')](0xc8)['json']({'error':![],'message':_0xb342('0x3c')});})[_0xb342('0x1d')](handleError(_0x292ad3));};exports['hold']=function(_0x2f1b9c,_0x58800d){logger[_0xb342('0x2f')]('hold\x20fired:',_0x2f1b9c[_0xb342('0x2a')]);var _0x5b638b=holdValidation['validate'](_0x2f1b9c[_0xb342('0x2a')]);if(_0x5b638b[_0xb342('0x25')]>0x0){return _0x58800d[_0xb342('0x17')](0x190)[_0xb342('0x2b')](_0x5b638b);}var _0x4dff08=_0x2f1b9c[_0xb342('0x2a')][_0xb342('0x35')];var _0x3cd72b=_0x2f1b9c[_0xb342('0x2a')][_0xb342('0x24')];return getAgent(_0x4dff08)[_0xb342('0x1a')](function(_0x4cc2d9){logger[_0xb342('0x2f')](_0xb342('0x36'),_0x4cc2d9['name']);emit(util[_0xb342('0x30')](_0xb342('0x31'),_0x4cc2d9['name']),_0xb342('0x3d'),{'sessionId':_0x3cd72b});return _0x58800d[_0xb342('0x17')](0xc8)[_0xb342('0x2b')]({'error':![],'message':_0xb342('0x3e')});})[_0xb342('0x1d')](handleError(_0x58800d));};exports[_0xb342('0x3f')]=function(_0x1ec165,_0x8736b5){logger[_0xb342('0x2f')](_0xb342('0x40'),_0x1ec165[_0xb342('0x2a')]);var _0xe7928=unholdValidation['validate'](_0x1ec165[_0xb342('0x2a')]);if(_0xe7928[_0xb342('0x25')]>0x0){return _0x8736b5[_0xb342('0x17')](0x190)[_0xb342('0x2b')](_0xe7928);}var _0x338de9=_0x1ec165['body'][_0xb342('0x35')];var _0x215007=_0x1ec165[_0xb342('0x2a')][_0xb342('0x24')];return getAgent(_0x338de9)['then'](function(_0x549076){logger[_0xb342('0x2f')]('entityFound:',_0x549076[_0xb342('0x15')]);emit(util[_0xb342('0x30')](_0xb342('0x31'),_0x549076[_0xb342('0x15')]),_0xb342('0x41'),{'sessionId':_0x215007});return _0x8736b5[_0xb342('0x17')](0xc8)[_0xb342('0x2b')]({'error':![],'message':_0xb342('0x42')});})[_0xb342('0x1d')](handleError(_0x8736b5));};exports[_0xb342('0x43')]=function(_0x34d0ab,_0x19532f){logger[_0xb342('0x2f')](_0xb342('0x44'),_0x19532f[_0xb342('0x2a')]);var _0x1caa1e=callsValidation[_0xb342('0x29')](_0x34d0ab[_0xb342('0x2a')]);if(_0x1caa1e[_0xb342('0x25')]>0x0){return _0x19532f['status'](0x190)['json'](_0x1caa1e);}var _0x2a0b0e=_0x34d0ab[_0xb342('0x2a')][_0xb342('0x35')];var _0x533e28=respondWithRpcPromise(_0xb342('0x20'));var _0x4ec083=getAgent(_0x2a0b0e);return Promise['all']([_0x533e28,_0x4ec083])[_0xb342('0x1a')](function(_0x282713){var _0x407532=_0x282713[0x0];var _0x27b0bf=_0x282713[0x1];var _0xf12e4d=_[_0xb342('0x22')](_0x407532[_0xb342('0x45')],function(_0x4029af){return _0x4029af[_0xb342('0x23')]==_0x27b0bf['id'];});return _0x19532f[_0xb342('0x17')](0xc8)['json']({'count':_0xf12e4d[_0xb342('0x25')],'rows':_0xf12e4d});})['catch'](handleError(_0x19532f));};exports[_0xb342('0x46')]=function(_0x1c03e5,_0x26b2c4){logger[_0xb342('0x2f')](_0xb342('0x47'),_0x1c03e5[_0xb342('0x2a')]);var _0x484a51=conferenceValidation[_0xb342('0x29')](_0x1c03e5['body']);if(_0x484a51['length']>0x0){return _0x26b2c4[_0xb342('0x17')](0x190)[_0xb342('0x2b')](_0x484a51);}var _0x35bcda=_0x1c03e5[_0xb342('0x2a')][_0xb342('0x35')];return getAgent(_0x35bcda)['then'](function(_0x46e6ba){logger[_0xb342('0x2f')](_0xb342('0x36'),_0x46e6ba[_0xb342('0x15')]);emit(util[_0xb342('0x30')](_0xb342('0x31'),_0x46e6ba[_0xb342('0x15')]),_0xb342('0x48'));return _0x26b2c4[_0xb342('0x17')](0xc8)[_0xb342('0x2b')]({'error':![],'message':_0xb342('0x49')});})[_0xb342('0x1d')](handleError(_0x26b2c4));};exports[_0xb342('0x4a')]=function(_0x2f8898,_0x8c1449){logger[_0xb342('0x2f')](_0xb342('0x4b'),_0x2f8898[_0xb342('0x2a')]);var _0x68a12d=transferValidation['validate'](_0x2f8898['body']);if(_0x68a12d[_0xb342('0x25')]>0x0){return _0x8c1449[_0xb342('0x17')](0x190)['json'](_0x68a12d);}var _0x19fc5b=_0x2f8898[_0xb342('0x2a')][_0xb342('0x35')];var _0x2dae90=_0x2f8898[_0xb342('0x2a')][_0xb342('0x24')];var _0x2f2453=_0x2f8898['body']['transferNumber'];return getAgent(_0x19fc5b)['then'](function(_0x25d860){logger[_0xb342('0x2f')]('entityFound:',_0x25d860['name']);emit(util[_0xb342('0x30')]('user:%s',_0x25d860['name']),_0xb342('0x4c'),{'sessionId':_0x2dae90,'transferNumber':_0x2f2453});return _0x8c1449[_0xb342('0x17')](0xc8)[_0xb342('0x2b')]({'error':![],'message':'transfer\x20executed!'});})[_0xb342('0x1d')](handleError(_0x8c1449));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index db46314..05d23e6 100644 --- a/server/api/whatsappAccount/index.js +++ b/server/api/whatsappAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xff02=['../../components/auth/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','index','get','describe','show','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/notify','notify','send','put','update','/:id','destroy','delete','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','Router'];(function(_0x328b1c,_0xec0b4f){var _0x4dbeaa=function(_0x432519){while(--_0x432519){_0x328b1c['push'](_0x328b1c['shift']());}};_0x4dbeaa(++_0xec0b4f);}(_0xff02,0x1e5));var _0x2ff0=function(_0x52ffb6,_0x15120c){_0x52ffb6=_0x52ffb6-0x0;var _0x5b479b=_0xff02[_0x52ffb6];return _0x5b479b;};'use strict';var multer=require(_0x2ff0('0x0'));var util=require(_0x2ff0('0x1'));var path=require('path');var timeout=require(_0x2ff0('0x2'));var express=require(_0x2ff0('0x3'));var router=express[_0x2ff0('0x4')]();var auth=require(_0x2ff0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2ff0('0x6'));var controller=require(_0x2ff0('0x7'));router['get']('/',auth[_0x2ff0('0x8')](),controller[_0x2ff0('0x9')]);router[_0x2ff0('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x2ff0('0xb')]);router[_0x2ff0('0xa')]('/:id',auth[_0x2ff0('0x8')](),controller[_0x2ff0('0xc')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router['get'](_0x2ff0('0xd'),auth['isAuthenticated'](),controller[_0x2ff0('0xe')]);router['get'](_0x2ff0('0xf'),auth[_0x2ff0('0x8')](),controller[_0x2ff0('0x10')]);router[_0x2ff0('0xa')](_0x2ff0('0x11'),auth[_0x2ff0('0x8')](),controller[_0x2ff0('0x12')]);router[_0x2ff0('0x13')]('/',auth[_0x2ff0('0x8')](),controller[_0x2ff0('0x14')]);router[_0x2ff0('0x13')](_0x2ff0('0x15'),auth[_0x2ff0('0x8')](),controller[_0x2ff0('0x16')]);router[_0x2ff0('0x13')](_0x2ff0('0xd'),auth['isAuthenticated'](),controller[_0x2ff0('0x17')]);router['post'](_0x2ff0('0xf'),auth[_0x2ff0('0x8')](),controller['addAgents']);router[_0x2ff0('0x13')](_0x2ff0('0x11'),auth[_0x2ff0('0x8')](),controller['addApplications']);router['post'](_0x2ff0('0x18'),controller[_0x2ff0('0x19')]);router[_0x2ff0('0x13')]('/:id/send',auth['isAuthenticated'](),controller[_0x2ff0('0x1a')]);router[_0x2ff0('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x2ff0('0x1c')]);router['delete'](_0x2ff0('0x1d'),auth[_0x2ff0('0x8')](),controller[_0x2ff0('0x1e')]);router[_0x2ff0('0x1f')]('/:id/dispositions',auth[_0x2ff0('0x8')](),controller[_0x2ff0('0x20')]);router[_0x2ff0('0x1f')](_0x2ff0('0xd'),auth[_0x2ff0('0x8')](),controller[_0x2ff0('0x21')]);router[_0x2ff0('0x1f')](_0x2ff0('0xf'),auth[_0x2ff0('0x8')](),controller['removeAgents']);module[_0x2ff0('0x22')]=router; \ No newline at end of file +var _0x1193=['/describe','isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','post','addAnswer','addAgents','addApplications','notify','send','put','/:id','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','index','get'];(function(_0x2e7e9f,_0x3229ad){var _0x1c5662=function(_0x448110){while(--_0x448110){_0x2e7e9f['push'](_0x2e7e9f['shift']());}};_0x1c5662(++_0x3229ad);}(_0x1193,0x9d));var _0x3119=function(_0x51127a,_0x210758){_0x51127a=_0x51127a-0x0;var _0x423571=_0x1193[_0x51127a];return _0x423571;};'use strict';var multer=require(_0x3119('0x0'));var util=require('util');var path=require(_0x3119('0x1'));var timeout=require(_0x3119('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x3119('0x3'));var interaction=require(_0x3119('0x4'));var config=require('../../config/environment');var controller=require(_0x3119('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x3119('0x6')]);router[_0x3119('0x7')](_0x3119('0x8'),auth[_0x3119('0x9')](),controller[_0x3119('0xa')]);router['get']('/:id',auth[_0x3119('0x9')](),controller[_0x3119('0xb')]);router[_0x3119('0x7')](_0x3119('0xc'),auth[_0x3119('0x9')](),controller[_0x3119('0xd')]);router['get'](_0x3119('0xe'),auth[_0x3119('0x9')](),controller[_0x3119('0xf')]);router[_0x3119('0x7')](_0x3119('0x10'),auth[_0x3119('0x9')](),controller[_0x3119('0x11')]);router[_0x3119('0x7')](_0x3119('0x12'),auth[_0x3119('0x9')](),controller['getApplications']);router[_0x3119('0x13')]('/',auth[_0x3119('0x9')](),controller['create']);router[_0x3119('0x13')]('/:id/dispositions',auth[_0x3119('0x9')](),controller['addDisposition']);router[_0x3119('0x13')](_0x3119('0xe'),auth[_0x3119('0x9')](),controller[_0x3119('0x14')]);router['post']('/:id/users',auth[_0x3119('0x9')](),controller[_0x3119('0x15')]);router['post'](_0x3119('0x12'),auth['isAuthenticated'](),controller[_0x3119('0x16')]);router[_0x3119('0x13')]('/:id/notify',controller[_0x3119('0x17')]);router[_0x3119('0x13')]('/:id/send',auth[_0x3119('0x9')](),controller[_0x3119('0x18')]);router[_0x3119('0x19')](_0x3119('0x1a'),auth[_0x3119('0x9')](),controller[_0x3119('0x1b')]);router['delete'](_0x3119('0x1a'),auth[_0x3119('0x9')](),controller['destroy']);router[_0x3119('0x1c')]('/:id/dispositions',auth[_0x3119('0x9')](),controller[_0x3119('0x1d')]);router[_0x3119('0x1c')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x3119('0x1e')]);router['delete'](_0x3119('0x10'),auth[_0x3119('0x9')](),controller[_0x3119('0x1f')]);module[_0x3119('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 0ced372..438d64b 100644 --- a/server/api/whatsappAccount/whatsappAccount.attributes.js +++ b/server/api/whatsappAccount/whatsappAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed43=['setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x4d4dfc,_0x428b28){var _0x34686e=function(_0x29376c){while(--_0x29376c){_0x4d4dfc['push'](_0x4d4dfc['shift']());}};_0x34686e(++_0x428b28);}(_0xed43,0x1d6));var _0x3ed4=function(_0x37c8ef,_0x334449){_0x37c8ef=_0x37c8ef-0x0;var _0x5eaee9=_0xed43[_0x37c8ef];return _0x5eaee9;};'use strict';var Sequelize=require(_0x3ed4('0x0'));var rs=require(_0x3ed4('0x1'));module[_0x3ed4('0x2')]={'name':{'type':Sequelize[_0x3ed4('0x3')],'unique':_0x3ed4('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x3ed4('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x3ed4('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x3ed4('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3ed4('0x5')]('twilio')},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x3ed4('0x3')]},'notificationTemplate':{'type':Sequelize[_0x3ed4('0x6')],'defaultValue':function(){return _0x3ed4('0x7');}},'notificationSound':{'type':Sequelize[_0x3ed4('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3ed4('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3ed4('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3ed4('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3ed4('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3ed4('0xa'),'set':function(_0x1f3fbd){if(!_0x1f3fbd){this[_0x3ed4('0xb')](_0x3ed4('0xc'),null);}this[_0x3ed4('0xb')]('mandatoryDisposition',_0x1f3fbd);}},'description':{'type':Sequelize[_0x3ed4('0x3')]}}; \ No newline at end of file +var _0xbb6f=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','randomstring','exports','name','STRING','generate','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x529be8,_0x5d98ba){var _0x38db2a=function(_0xc01ab){while(--_0xc01ab){_0x529be8['push'](_0x529be8['shift']());}};_0x38db2a(++_0x5d98ba);}(_0xbb6f,0x137));var _0xfbb6=function(_0x59f13d,_0x34e180){_0x59f13d=_0x59f13d-0x0;var _0x920e2f=_0xbb6f[_0x59f13d];return _0x920e2f;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xfbb6('0x0'));module[_0xfbb6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfbb6('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xfbb6('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xfbb6('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xfbb6('0x4')]();}},'phone':{'type':Sequelize[_0xfbb6('0x3')]},'type':{'type':Sequelize[_0xfbb6('0x5')]('twilio')},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xfbb6('0x3')]},'notificationTemplate':{'type':Sequelize[_0xfbb6('0x6')],'defaultValue':function(){return _0xfbb6('0x7');}},'notificationSound':{'type':Sequelize[_0xfbb6('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xfbb6('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfbb6('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfbb6('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfbb6('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfbb6('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfbb6('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xfbb6('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xfbb6('0x8')],'defaultValue':![],'comment':_0xfbb6('0xb'),'set':function(_0x11c117){if(!_0x11c117){this[_0xfbb6('0xc')]('mandatoryDispositionPauseId',null);}this['setDataValue'](_0xfbb6('0xd'),_0x11c117);}},'description':{'type':Sequelize[_0xfbb6('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 3241648..fb5bc0c 100644 --- a/server/api/whatsappAccount/whatsappAccount.controller.js +++ b/server/api/whatsappAccount/whatsappAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0102=['list','WhatsappInteraction','interaction','autoclose','push','close','*,*,*,*','created','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','debug','text/xml','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','WhatsappMessage','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','destroy','WhatsappAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','length','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','WhatsappAccountId','Disposition','findOne','pick','rows','removeDispositions','addAnswer','CannedAnswer','nolimit','removeAnswers','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','Applications','account','applications','orderBy','asc','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','From','whatsapp:','Body','MessageSid','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC'];(function(_0x3fcfb6,_0x515024){var _0x3b99a7=function(_0x10ddfd){while(--_0x10ddfd){_0x3fcfb6['push'](_0x3fcfb6['shift']());}};_0x3b99a7(++_0x515024);}(_0x0102,0x186));var _0x2010=function(_0x4cd3c1,_0x3fd2ce){_0x4cd3c1=_0x4cd3c1-0x0;var _0x4e4d83=_0x0102[_0x4cd3c1];return _0x4e4d83;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2010('0x0'));var rimraf=require(_0x2010('0x1'));var zipdir=require(_0x2010('0x2'));var jsonpatch=require(_0x2010('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2010('0x4'));var sox=require(_0x2010('0x5'));var csv=require(_0x2010('0x6'));var ejs=require(_0x2010('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2010('0x8'));var crypto=require('crypto');var jsforce=require(_0x2010('0x9'));var deskjs=require(_0x2010('0xa'));var toCsv=require('to-csv');var querystring=require(_0x2010('0xb'));var Papa=require(_0x2010('0xc'));var Redis=require(_0x2010('0xd'));var authService=require(_0x2010('0xe'));var qs=require(_0x2010('0xf'));var as=require(_0x2010('0x10'));var hardwareService=require(_0x2010('0x11'));var logger=require(_0x2010('0x12'))(_0x2010('0x13'));var utils=require(_0x2010('0x14'));var config=require(_0x2010('0x15'));var db=require(_0x2010('0x16'))['db'];config[_0x2010('0x17')]=_[_0x2010('0x18')](config[_0x2010('0x17')],{'host':_0x2010('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2010('0x1a'))[_0x2010('0x1b')](socket);var jayson=require(_0x2010('0x1c'));var client=jayson[_0x2010('0x1d')][_0x2010('0x1e')]({'port':0x232c});function checkPasswordPattern(_0x335be4,_0x517ff4,_0x3195fa){if(_0x3195fa){var _0x136418=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x136418['test'](_0x517ff4)){return _0x335be4;}else{throw new db[(_0x2010('0x1f'))][(_0x2010('0x20'))](_0x2010('0x21'));}}else{return _0x335be4;}}function respondWithRpcPromise(_0x2b403a,_0x2d0bf2,_0x11bd28,_0x83cd35){return new BPromise(function(_0x1476c0,_0x309477){var _0x569de2=_0x83cd35||client;return _0x569de2['request'](_0x2b403a,_0x11bd28)[_0x2010('0x22')](function(_0x38a15a){logger[_0x2010('0x23')](_0x2010('0x24'),_0x2d0bf2,'request\x20sent');logger['debug'](_0x2010('0x25'),_0x2d0bf2,_0x2010('0x26'),JSON[_0x2010('0x27')](_0x38a15a));if(_0x38a15a[_0x2010('0x28')]){if(_0x38a15a[_0x2010('0x28')][_0x2010('0x29')]===0x1f4){logger['error'](_0x2010('0x24'),_0x2d0bf2,_0x38a15a[_0x2010('0x28')]['message']);return _0x309477(_0x38a15a['error']['message']);}logger[_0x2010('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x2d0bf2,_0x38a15a[_0x2010('0x28')]['message']);return _0x1476c0(_0x38a15a['error'][_0x2010('0x2a')]);}else{logger[_0x2010('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x2d0bf2,_0x2010('0x26'));_0x1476c0(_0x38a15a['result'][_0x2010('0x2a')]);}})[_0x2010('0x2b')](function(_0x3929d9){logger[_0x2010('0x28')](_0x2010('0x24'),_0x2d0bf2,_0x3929d9);_0x309477(_0x3929d9);});});}function respondWithStatusCode(_0x2f63bb,_0x981b65){_0x981b65=_0x981b65||0xcc;return function(_0x3eb4dc){if(_0x3eb4dc){return _0x2f63bb[_0x2010('0x2c')](_0x981b65);}return _0x2f63bb[_0x2010('0x2d')](_0x981b65)[_0x2010('0x2e')]();};}function respondWithResult(_0x2ebdbb,_0x499cbe){_0x499cbe=_0x499cbe||0xc8;return function(_0x2a4691){if(_0x2a4691){return _0x2ebdbb['status'](_0x499cbe)[_0x2010('0x2f')](_0x2a4691);}};}function respondWithFilteredResult(_0x147a5a,_0xd16c04){return function(_0x188e35){if(_0x188e35){var _0x564a64=_0x188e35[_0x2010('0x30')],_0x554f66=_0xd16c04[_0x2010('0x31')],_0x136d5f=_0xd16c04['offset']+_0xd16c04[_0x2010('0x32')],_0x48d9f2;if(_0x136d5f>=_0x564a64){_0x136d5f=_0x564a64;_0x48d9f2=0xc8;}else{_0x48d9f2=0xce;}_0x147a5a[_0x2010('0x2d')](_0x48d9f2);return _0x147a5a[_0x2010('0x33')](_0x2010('0x34'),_0x554f66+'-'+_0x136d5f+'/'+_0x564a64)[_0x2010('0x2f')](_0x188e35);}return null;};}function patchUpdates(_0x4e4379){return function(_0x9be262){try{jsonpatch[_0x2010('0x35')](_0x9be262,_0x4e4379,!![]);}catch(_0x33a339){return BPromise['reject'](_0x33a339);}return _0x9be262['save']();};}function saveUpdates(_0x113bc0,_0x21e215){return function(_0x10a425){if(_0x10a425){return _0x10a425['update'](_0x113bc0)['then'](function(_0xac64e1){return _0xac64e1;});}return null;};}function removeEntity(_0xaf5aed,_0x32ddfa){return function(_0x339fd2){if(_0x339fd2){return _0x339fd2[_0x2010('0x36')]()['then'](function(){var _0x569e13=_0x339fd2['get']({'plain':!![]});var _0x238129=_0x2010('0x37');return db[_0x2010('0x38')]['destroy']({'where':{'type':_0x238129,'resourceId':_0x569e13['id']}})[_0x2010('0x22')](function(){return _0x339fd2;});})[_0x2010('0x22')](function(){_0xaf5aed[_0x2010('0x2d')](0xcc)[_0x2010('0x2e')]();});}};}function handleEntityNotFound(_0x4f5106,_0x2b7649){return function(_0x2eb9df){if(!_0x2eb9df){_0x4f5106[_0x2010('0x2c')](0x194);}return _0x2eb9df;};}function handleError(_0x56bba9,_0x232d86){_0x232d86=_0x232d86||0x1f4;return function(_0x5e5dac){logger[_0x2010('0x28')](_0x5e5dac[_0x2010('0x39')]);if(_0x5e5dac[_0x2010('0x3a')]){delete _0x5e5dac[_0x2010('0x3a')];}_0x56bba9[_0x2010('0x2d')](_0x232d86)[_0x2010('0x3b')](_0x5e5dac);};}exports['index']=function(_0x1e4460,_0x4ff805){var _0x3e5422={'include':[{'model':db[_0x2010('0x3c')],'as':_0x2010('0x3d')}]},_0x157c73={},_0x236a04={'count':0x0,'rows':[]};var _0x1f053c=_[_0x2010('0x3e')](db[_0x2010('0x3f')][_0x2010('0x40')],function(_0x281d76){return{'name':_0x281d76[_0x2010('0x41')],'type':_0x281d76[_0x2010('0x42')][_0x2010('0x43')]};});_0x157c73[_0x2010('0x44')]=_['map'](_0x1f053c,'name');_0x157c73[_0x2010('0x45')]=_[_0x2010('0x46')](_0x1e4460[_0x2010('0x45')]);_0x157c73[_0x2010('0x47')]=_[_0x2010('0x48')](_0x157c73[_0x2010('0x44')],_0x157c73[_0x2010('0x45')]);_0x3e5422['attributes']=_[_0x2010('0x48')](_0x157c73['model'],qs[_0x2010('0x49')](_0x1e4460[_0x2010('0x45')][_0x2010('0x49')]));_0x3e5422[_0x2010('0x4a')]=_0x3e5422[_0x2010('0x4a')]['length']?_0x3e5422[_0x2010('0x4a')]:_0x157c73[_0x2010('0x44')];if(!_0x1e4460[_0x2010('0x45')][_0x2010('0x4b')]('nolimit')){_0x3e5422[_0x2010('0x32')]=qs['limit'](_0x1e4460['query']['limit']);_0x3e5422[_0x2010('0x31')]=qs[_0x2010('0x31')](_0x1e4460[_0x2010('0x45')][_0x2010('0x31')]);}_0x3e5422[_0x2010('0x4c')]=qs[_0x2010('0x4d')](_0x1e4460['query'][_0x2010('0x4d')]);_0x3e5422[_0x2010('0x4e')]=qs[_0x2010('0x47')](_['pick'](_0x1e4460['query'],_0x157c73[_0x2010('0x47')]),_0x1f053c);if(_0x1e4460['query'][_0x2010('0x4f')]){_0x3e5422[_0x2010('0x4e')]=_[_0x2010('0x50')](_0x3e5422[_0x2010('0x4e')],{'$or':_['map'](_0x1f053c,function(_0x36acbe){if(_0x36acbe[_0x2010('0x42')]!==_0x2010('0x51')){var _0x231db7={};_0x231db7[_0x36acbe[_0x2010('0x3a')]]={'$like':'%'+_0x1e4460[_0x2010('0x45')]['filter']+'%'};return _0x231db7;}})});}_0x3e5422=_[_0x2010('0x50')]({},_0x3e5422,_0x1e4460[_0x2010('0x52')]);var _0x3e2fcd={'where':_0x3e5422['where']};return db[_0x2010('0x3f')][_0x2010('0x30')](_0x3e2fcd)['then'](function(_0x216cf8){_0x236a04[_0x2010('0x30')]=_0x216cf8;if(_0x1e4460[_0x2010('0x45')][_0x2010('0x53')]){_0x3e5422[_0x2010('0x54')]=[{'all':!![]}];}return db[_0x2010('0x3f')][_0x2010('0x55')](_0x3e5422);})[_0x2010('0x22')](function(_0x5a06b4){_0x236a04['rows']=_0x5a06b4;return _0x236a04;})[_0x2010('0x22')](respondWithFilteredResult(_0x4ff805,_0x3e5422))[_0x2010('0x2b')](handleError(_0x4ff805,null));};exports['show']=function(_0x422b3c,_0x46776b){var _0xcf8c5b={'raw':![],'where':{'id':_0x422b3c[_0x2010('0x56')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xba8504={};_0xba8504[_0x2010('0x44')]=_[_0x2010('0x46')](db[_0x2010('0x3f')][_0x2010('0x40')]);_0xba8504[_0x2010('0x45')]=_[_0x2010('0x46')](_0x422b3c[_0x2010('0x45')]);_0xba8504[_0x2010('0x47')]=_[_0x2010('0x48')](_0xba8504[_0x2010('0x44')],_0xba8504[_0x2010('0x45')]);_0xcf8c5b['attributes']=_[_0x2010('0x48')](_0xba8504[_0x2010('0x44')],qs['fields'](_0x422b3c[_0x2010('0x45')][_0x2010('0x49')]));_0xcf8c5b[_0x2010('0x4a')]=_0xcf8c5b[_0x2010('0x4a')][_0x2010('0x57')]?_0xcf8c5b[_0x2010('0x4a')]:_0xba8504[_0x2010('0x44')];if(_0x422b3c[_0x2010('0x45')][_0x2010('0x53')]){_0xcf8c5b[_0x2010('0x54')]=[{'all':!![]}];}_0xcf8c5b=_[_0x2010('0x50')]({},_0xcf8c5b,_0x422b3c[_0x2010('0x52')]);return db[_0x2010('0x3f')][_0x2010('0x58')](_0xcf8c5b)[_0x2010('0x22')](handleEntityNotFound(_0x46776b,null))[_0x2010('0x22')](respondWithResult(_0x46776b,null))[_0x2010('0x2b')](handleError(_0x46776b,null));};exports[_0x2010('0x59')]=function(_0x2d7765,_0x6f8565){return db[_0x2010('0x3f')][_0x2010('0x59')](_0x2d7765[_0x2010('0x5a')],{})['then'](function(_0x1a9ed0){var _0x4aaa74=_0x2d7765['user'][_0x2010('0x5b')]({'plain':!![]});if(!_0x4aaa74)throw new Error(_0x2010('0x5c'));if(_0x4aaa74['role']===_0x2010('0x5d')){var _0x268543=_0x1a9ed0[_0x2010('0x5b')]({'plain':!![]});var _0x63ae67='WhatsappAccounts';return db[_0x2010('0x5e')][_0x2010('0x58')]({'where':{'name':_0x63ae67,'userProfileId':_0x4aaa74[_0x2010('0x5f')]},'raw':!![]})[_0x2010('0x22')](function(_0x4b4145){if(_0x4b4145&&_0x4b4145[_0x2010('0x60')]===0x0){return db['UserProfileResource'][_0x2010('0x59')]({'name':_0x268543[_0x2010('0x3a')],'resourceId':_0x268543['id'],'type':_0x4b4145[_0x2010('0x3a')],'sectionId':_0x4b4145['id']},{})[_0x2010('0x22')](function(){return _0x1a9ed0;});}else{return _0x1a9ed0;}})['catch'](function(_0x51e15b){logger[_0x2010('0x28')](_0x2010('0x61'),_0x51e15b);throw _0x51e15b;});}return _0x1a9ed0;})['then'](respondWithResult(_0x6f8565,0xc9))['catch'](handleError(_0x6f8565,null));};exports[_0x2010('0x62')]=function(_0x1b7387,_0x419860){if(_0x1b7387[_0x2010('0x5a')]['id']){delete _0x1b7387['body']['id'];}return db[_0x2010('0x3f')]['find']({'where':{'id':_0x1b7387[_0x2010('0x56')]['id']},'include':[{'model':db[_0x2010('0x3c')],'as':_0x2010('0x3d')}]})[_0x2010('0x22')](handleEntityNotFound(_0x419860,null))['then'](saveUpdates(_0x1b7387[_0x2010('0x5a')],null))[_0x2010('0x22')](respondWithResult(_0x419860,null))['catch'](handleError(_0x419860,null));};exports[_0x2010('0x36')]=function(_0x3a608e,_0x23c7d9){return db[_0x2010('0x3f')][_0x2010('0x58')]({'where':{'id':_0x3a608e[_0x2010('0x56')]['id']}})[_0x2010('0x22')](handleEntityNotFound(_0x23c7d9,null))[_0x2010('0x22')](removeEntity(_0x23c7d9,null))[_0x2010('0x2b')](handleError(_0x23c7d9,null));};exports[_0x2010('0x63')]=function(_0x3a8cfb,_0x3ec50f){return db['WhatsappAccount'][_0x2010('0x63')]()[_0x2010('0x22')](respondWithResult(_0x3ec50f,null))[_0x2010('0x2b')](handleError(_0x3ec50f,null));};exports['addDisposition']=function(_0x5ca75a,_0x24466f,_0x16c583){if(_0x5ca75a[_0x2010('0x5a')]['id']){delete _0x5ca75a[_0x2010('0x5a')]['id'];}return db[_0x2010('0x3f')][_0x2010('0x58')]({'where':{'id':_0x5ca75a['params']['id']}})[_0x2010('0x22')](handleEntityNotFound(_0x24466f,null))[_0x2010('0x22')](function(_0x2facf8){if(_0x2facf8){_0x5ca75a['body'][_0x2010('0x64')]=_0x2facf8['id'];return db[_0x2010('0x65')][_0x2010('0x59')](_0x5ca75a['body']);}})[_0x2010('0x22')](respondWithResult(_0x24466f,null))[_0x2010('0x2b')](handleError(_0x24466f,null));};exports['getDispositions']=function(_0x493c89,_0x30b13d,_0x487d55){var _0x4c55be={'raw':![],'where':{}};var _0x166143={};var _0x34ebc6={'count':0x0,'rows':[]};return db[_0x2010('0x3f')][_0x2010('0x66')]({'where':{'id':_0x493c89[_0x2010('0x56')]['id']}})[_0x2010('0x22')](handleEntityNotFound(_0x30b13d,null))[_0x2010('0x22')](function(_0x4d8fa){if(_0x4d8fa){_0x166143[_0x2010('0x44')]=_[_0x2010('0x46')](db['Disposition'][_0x2010('0x40')]);_0x166143[_0x2010('0x45')]=_['keys'](_0x493c89[_0x2010('0x45')]);_0x166143[_0x2010('0x47')]=_[_0x2010('0x48')](_0x166143[_0x2010('0x44')],_0x166143['query']);_0x4c55be[_0x2010('0x4a')]=_[_0x2010('0x48')](_0x166143['model'],qs['fields'](_0x493c89[_0x2010('0x45')]['fields']));_0x4c55be[_0x2010('0x4a')]=_0x4c55be[_0x2010('0x4a')][_0x2010('0x57')]?_0x4c55be[_0x2010('0x4a')]:_0x166143[_0x2010('0x44')];if(!_0x493c89[_0x2010('0x45')][_0x2010('0x4b')]('nolimit')){_0x4c55be[_0x2010('0x32')]=qs[_0x2010('0x32')](_0x493c89[_0x2010('0x45')]['limit']);_0x4c55be[_0x2010('0x31')]=qs[_0x2010('0x31')](_0x493c89[_0x2010('0x45')][_0x2010('0x31')]);}_0x4c55be[_0x2010('0x4c')]=qs[_0x2010('0x4d')](_0x493c89[_0x2010('0x45')][_0x2010('0x4d')]);_0x4c55be['where']=qs[_0x2010('0x47')](_[_0x2010('0x67')](_0x493c89[_0x2010('0x45')],_0x166143['filters']));_0x4c55be[_0x2010('0x4e')][_0x2010('0x64')]=_0x4d8fa['id'];if(_0x493c89['query'][_0x2010('0x4f')]){_0x4c55be[_0x2010('0x4e')]=_[_0x2010('0x50')](_0x4c55be[_0x2010('0x4e')],{'$or':_[_0x2010('0x3e')](_0x4c55be['attributes'],function(_0xe2c487){var _0x31e669={};_0x31e669[_0xe2c487]={'$like':'%'+_0x493c89['query'][_0x2010('0x4f')]+'%'};return _0x31e669;})});}_0x4c55be=_[_0x2010('0x50')]({},_0x4c55be,_0x493c89['options']);return db[_0x2010('0x65')]['count']({'where':_0x4c55be['where']})[_0x2010('0x22')](function(_0x17f7c5){_0x34ebc6[_0x2010('0x30')]=_0x17f7c5;if(_0x493c89[_0x2010('0x45')][_0x2010('0x53')]){_0x4c55be[_0x2010('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x2010('0x55')](_0x4c55be);})[_0x2010('0x22')](function(_0x16db17){_0x34ebc6[_0x2010('0x68')]=_0x16db17;return _0x34ebc6;});}})['then'](respondWithFilteredResult(_0x30b13d,_0x4c55be))[_0x2010('0x2b')](handleError(_0x30b13d,null));};exports['removeDispositions']=function(_0x364d51,_0x30b541,_0x1c202e){return db[_0x2010('0x3f')]['find']({'where':{'id':_0x364d51['params']['id']}})['then'](handleEntityNotFound(_0x30b541,null))[_0x2010('0x22')](function(_0x58ca8f){if(_0x58ca8f){return _0x58ca8f[_0x2010('0x69')](_0x364d51[_0x2010('0x45')]['ids']);}})[_0x2010('0x22')](respondWithStatusCode(_0x30b541,null))['catch'](handleError(_0x30b541,null));};exports[_0x2010('0x6a')]=function(_0x160751,_0x3506c7,_0x29c057){if(_0x160751['body']['id']){delete _0x160751['body']['id'];}return db['WhatsappAccount'][_0x2010('0x58')]({'where':{'id':_0x160751[_0x2010('0x56')]['id']}})['then'](handleEntityNotFound(_0x3506c7,null))[_0x2010('0x22')](function(_0x4b062c){if(_0x4b062c){_0x160751[_0x2010('0x5a')][_0x2010('0x64')]=_0x4b062c['id'];return db[_0x2010('0x6b')][_0x2010('0x59')](_0x160751[_0x2010('0x5a')]);}})[_0x2010('0x22')](respondWithResult(_0x3506c7,null))[_0x2010('0x2b')](handleError(_0x3506c7,null));};exports['getAnswers']=function(_0x2ea2eb,_0x41c530,_0x521f51){var _0x3301e9={'raw':![],'where':{}};var _0x6a0c69={};var _0xbc907d={'count':0x0,'rows':[]};return db[_0x2010('0x3f')][_0x2010('0x66')]({'where':{'id':_0x2ea2eb[_0x2010('0x56')]['id']}})[_0x2010('0x22')](handleEntityNotFound(_0x41c530,null))[_0x2010('0x22')](function(_0x21192b){if(_0x21192b){_0x6a0c69['model']=_[_0x2010('0x46')](db[_0x2010('0x6b')][_0x2010('0x40')]);_0x6a0c69['query']=_['keys'](_0x2ea2eb[_0x2010('0x45')]);_0x6a0c69[_0x2010('0x47')]=_[_0x2010('0x48')](_0x6a0c69[_0x2010('0x44')],_0x6a0c69[_0x2010('0x45')]);_0x3301e9[_0x2010('0x4a')]=_[_0x2010('0x48')](_0x6a0c69[_0x2010('0x44')],qs[_0x2010('0x49')](_0x2ea2eb['query'][_0x2010('0x49')]));_0x3301e9[_0x2010('0x4a')]=_0x3301e9[_0x2010('0x4a')][_0x2010('0x57')]?_0x3301e9[_0x2010('0x4a')]:_0x6a0c69[_0x2010('0x44')];if(!_0x2ea2eb['query']['hasOwnProperty'](_0x2010('0x6c'))){_0x3301e9[_0x2010('0x32')]=qs[_0x2010('0x32')](_0x2ea2eb['query']['limit']);_0x3301e9['offset']=qs[_0x2010('0x31')](_0x2ea2eb['query'][_0x2010('0x31')]);}_0x3301e9[_0x2010('0x4c')]=qs[_0x2010('0x4d')](_0x2ea2eb[_0x2010('0x45')][_0x2010('0x4d')]);_0x3301e9[_0x2010('0x4e')]=qs['filters'](_[_0x2010('0x67')](_0x2ea2eb[_0x2010('0x45')],_0x6a0c69[_0x2010('0x47')]));_0x3301e9[_0x2010('0x4e')]['WhatsappAccountId']=_0x21192b['id'];if(_0x2ea2eb[_0x2010('0x45')][_0x2010('0x4f')]){_0x3301e9[_0x2010('0x4e')]=_[_0x2010('0x50')](_0x3301e9[_0x2010('0x4e')],{'$or':_[_0x2010('0x3e')](_0x3301e9[_0x2010('0x4a')],function(_0x3e6d10){var _0x254c6b={};_0x254c6b[_0x3e6d10]={'$like':'%'+_0x2ea2eb[_0x2010('0x45')][_0x2010('0x4f')]+'%'};return _0x254c6b;})});}_0x3301e9=_[_0x2010('0x50')]({},_0x3301e9,_0x2ea2eb[_0x2010('0x52')]);return db[_0x2010('0x6b')]['count']({'where':_0x3301e9[_0x2010('0x4e')]})[_0x2010('0x22')](function(_0x331edd){_0xbc907d[_0x2010('0x30')]=_0x331edd;if(_0x2ea2eb['query'][_0x2010('0x53')]){_0x3301e9['include']=[{'all':!![]}];}return db[_0x2010('0x6b')][_0x2010('0x55')](_0x3301e9);})[_0x2010('0x22')](function(_0x2689c3){_0xbc907d[_0x2010('0x68')]=_0x2689c3;return _0xbc907d;});}})[_0x2010('0x22')](respondWithFilteredResult(_0x41c530,_0x3301e9))['catch'](handleError(_0x41c530,null));};exports[_0x2010('0x6d')]=function(_0x59f548,_0x10fa60,_0x49f588){return db['WhatsappAccount'][_0x2010('0x58')]({'where':{'id':_0x59f548[_0x2010('0x56')]['id']}})['then'](handleEntityNotFound(_0x10fa60,null))['then'](function(_0x41ec73){if(_0x41ec73){return _0x41ec73['removeAnswers'](_0x59f548[_0x2010('0x45')][_0x2010('0x6e')]);}})['then'](respondWithStatusCode(_0x10fa60,null))[_0x2010('0x2b')](handleError(_0x10fa60,null));};exports[_0x2010('0x6f')]=function(_0x165828,_0x4c8041,_0x5c4b10){return db[_0x2010('0x3f')]['find']({'where':{'id':_0x165828[_0x2010('0x56')]['id']}})['then'](handleEntityNotFound(_0x4c8041,null))[_0x2010('0x22')](function(_0x5efc47){if(_0x5efc47){return _0x5efc47[_0x2010('0x6f')](_0x165828[_0x2010('0x5a')][_0x2010('0x6e')],_[_0x2010('0x70')](_0x165828['body'],['ids','id'])||{})[_0x2010('0x71')](function(_0x229cb7){for(var _0x549504=0x0;_0x549504<_0x165828[_0x2010('0x5a')][_0x2010('0x6e')][_0x2010('0x57')];_0x549504+=0x1){socket[_0x2010('0x72')](_0x2010('0x73'),{'UserId':_0x165828['body'][_0x2010('0x6e')][_0x549504],'WhatsappAccountId':_0x165828[_0x2010('0x56')]['id']});}return _0x229cb7;});}})['then'](respondWithResult(_0x4c8041,null))[_0x2010('0x2b')](handleError(_0x4c8041,null));};exports[_0x2010('0x74')]=function(_0x997a63,_0x3a6d97,_0x316e8a){return db[_0x2010('0x3f')]['find']({'where':{'id':_0x997a63[_0x2010('0x56')]['id']}})[_0x2010('0x22')](handleEntityNotFound(_0x3a6d97,null))['then'](function(_0x3e381a){if(_0x3e381a){return _0x3e381a[_0x2010('0x74')](_0x997a63[_0x2010('0x45')][_0x2010('0x6e')])[_0x2010('0x22')](function(){if(_[_0x2010('0x75')](_0x997a63['query']['ids'])){for(var _0x207799=0x0;_0x207799<_0x997a63[_0x2010('0x45')][_0x2010('0x6e')][_0x2010('0x57')];_0x207799+=0x1){socket[_0x2010('0x72')]('userWhatsappAccount:remove',{'UserId':Number(_0x997a63['query']['ids'][_0x207799]),'WhatsappAccountId':Number(_0x997a63[_0x2010('0x56')]['id'])});}}else{socket[_0x2010('0x72')]('userWhatsappAccount:remove',{'UserId':Number(_0x997a63[_0x2010('0x45')]['ids']),'WhatsappAccountId':Number(_0x997a63[_0x2010('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x3a6d97,null))[_0x2010('0x2b')](handleError(_0x3a6d97,null));};exports[_0x2010('0x76')]=function(_0x2c2873,_0x272a7c,_0x2a8de6){var _0xba3d39={};var _0x5a7723={};var _0x523281;var _0x32baef;return db[_0x2010('0x3f')]['findOne']({'where':{'id':_0x2c2873[_0x2010('0x56')]['id']}})['then'](handleEntityNotFound(_0x272a7c,null))[_0x2010('0x22')](function(_0x524e23){if(_0x524e23){_0x523281=_0x524e23;_0x5a7723['model']=_[_0x2010('0x46')](db[_0x2010('0x77')][_0x2010('0x40')]);_0x5a7723[_0x2010('0x45')]=_[_0x2010('0x46')](_0x2c2873[_0x2010('0x45')]);_0x5a7723[_0x2010('0x47')]=_[_0x2010('0x48')](_0x5a7723['model'],_0x5a7723[_0x2010('0x45')]);_0xba3d39[_0x2010('0x4a')]=_[_0x2010('0x48')](_0x5a7723[_0x2010('0x44')],qs['fields'](_0x2c2873[_0x2010('0x45')][_0x2010('0x49')]));_0xba3d39[_0x2010('0x4a')]=_0xba3d39[_0x2010('0x4a')][_0x2010('0x57')]?_0xba3d39['attributes']:_0x5a7723['model'];_0xba3d39['order']=qs[_0x2010('0x4d')](_0x2c2873[_0x2010('0x45')]['sort']);_0xba3d39['where']=qs[_0x2010('0x47')](_[_0x2010('0x67')](_0x2c2873[_0x2010('0x45')],_0x5a7723[_0x2010('0x47')]));if(_0x2c2873[_0x2010('0x45')]['filter']){_0xba3d39[_0x2010('0x4e')]=_['merge'](_0xba3d39[_0x2010('0x4e')],{'$or':_[_0x2010('0x3e')](_0xba3d39['attributes'],function(_0x4108d8){var _0x12af51={};_0x12af51[_0x4108d8]={'$like':'%'+_0x2c2873[_0x2010('0x45')][_0x2010('0x4f')]+'%'};return _0x12af51;})});}_0xba3d39=_[_0x2010('0x50')]({},_0xba3d39,_0x2c2873['options']);return _0x523281[_0x2010('0x76')](_0xba3d39);}})[_0x2010('0x22')](function(_0x20d2dc){if(_0x20d2dc){_0x32baef=_0x20d2dc[_0x2010('0x57')];if(!_0x2c2873[_0x2010('0x45')][_0x2010('0x4b')](_0x2010('0x6c'))){_0xba3d39['limit']=qs['limit'](_0x2c2873[_0x2010('0x45')][_0x2010('0x32')]);_0xba3d39[_0x2010('0x31')]=qs['offset'](_0x2c2873[_0x2010('0x45')][_0x2010('0x31')]);}return _0x523281['getAgents'](_0xba3d39);}})[_0x2010('0x22')](function(_0x277ff4){if(_0x277ff4){return _0x277ff4?{'count':_0x32baef,'rows':_0x277ff4}:null;}})[_0x2010('0x22')](respondWithResult(_0x272a7c,null))[_0x2010('0x2b')](handleError(_0x272a7c,null));};exports[_0x2010('0x78')]=function(_0x14a229,_0x5d248c,_0x22e8da){return db[_0x2010('0x3f')]['findOne']({'where':{'id':_0x14a229[_0x2010('0x56')]['id']}})[_0x2010('0x22')](handleEntityNotFound(_0x5d248c,null))['then'](function(_0x1697d1){if(_0x1697d1){return db[_0x2010('0x79')][_0x2010('0x7a')](function(_0x2089c9){return db[_0x2010('0x7b')][_0x2010('0x36')]({'where':{'WhatsappAccountId':_0x14a229['params']['id']},'transaction':_0x2089c9})[_0x2010('0x22')](function(_0xeb364b){var _0x35f749=_[_0x2010('0x3e')](_0x14a229['body'],function(_0x483f91){_0x483f91[_0x2010('0x64')]=_0x14a229[_0x2010('0x56')]['id'];return _0x483f91;});return db[_0x2010('0x7b')][_0x2010('0x7c')](_0x35f749,{'transaction':_0x2089c9});});})[_0x2010('0x22')](function(){return db[_0x2010('0x7b')][_0x2010('0x7d')]({'where':{'WhatsappAccountId':_0x14a229[_0x2010('0x56')]['id']},'order':_0x2010('0x7e')});});}})[_0x2010('0x22')](respondWithResult(_0x5d248c,null))['catch'](handleError(_0x5d248c,null));};exports['getApplications']=function(_0x3b3892,_0x59ed22,_0x5aff8d){var _0x55dbf5={};var _0x2af5c3={};var _0x48e068;var _0x17f975;return db[_0x2010('0x3f')][_0x2010('0x66')]({'where':{'id':_0x3b3892['params']['id']}})['then'](handleEntityNotFound(_0x59ed22,null))[_0x2010('0x22')](function(_0x95ada2){if(_0x95ada2){_0x48e068=_0x95ada2;_0x2af5c3[_0x2010('0x44')]=_['keys'](db[_0x2010('0x7b')][_0x2010('0x40')]);_0x2af5c3[_0x2010('0x45')]=_[_0x2010('0x46')](_0x3b3892[_0x2010('0x45')]);_0x2af5c3['filters']=_[_0x2010('0x48')](_0x2af5c3[_0x2010('0x44')],_0x2af5c3[_0x2010('0x45')]);_0x55dbf5[_0x2010('0x4a')]=_[_0x2010('0x48')](_0x2af5c3[_0x2010('0x44')],qs[_0x2010('0x49')](_0x3b3892[_0x2010('0x45')][_0x2010('0x49')]));_0x55dbf5['attributes']=_0x55dbf5[_0x2010('0x4a')]['length']?_0x55dbf5[_0x2010('0x4a')]:_0x2af5c3[_0x2010('0x44')];_0x55dbf5[_0x2010('0x4c')]=qs[_0x2010('0x4d')](_0x3b3892[_0x2010('0x45')][_0x2010('0x4d')]);_0x55dbf5[_0x2010('0x4e')]=qs['filters'](_[_0x2010('0x67')](_0x3b3892[_0x2010('0x45')],_0x2af5c3[_0x2010('0x47')]));if(_0x3b3892[_0x2010('0x45')]['filter']){_0x55dbf5[_0x2010('0x4e')]=_[_0x2010('0x50')](_0x55dbf5[_0x2010('0x4e')],{'$or':_[_0x2010('0x3e')](_0x55dbf5['attributes'],function(_0x87373b){var _0x501f28={};_0x501f28[_0x87373b]={'$like':'%'+_0x3b3892[_0x2010('0x45')]['filter']+'%'};return _0x501f28;})});}_0x55dbf5=_['merge']({},_0x55dbf5,_0x3b3892[_0x2010('0x52')]);return _0x48e068['getApplications'](_0x55dbf5);}})[_0x2010('0x22')](function(_0x23cd4d){if(_0x23cd4d){_0x17f975=_0x23cd4d[_0x2010('0x57')];if(!_0x3b3892[_0x2010('0x45')]['hasOwnProperty'](_0x2010('0x6c'))){_0x55dbf5['limit']=qs[_0x2010('0x32')](_0x3b3892[_0x2010('0x45')][_0x2010('0x32')]);_0x55dbf5[_0x2010('0x31')]=qs[_0x2010('0x31')](_0x3b3892['query'][_0x2010('0x31')]);}return _0x48e068[_0x2010('0x7f')](_0x55dbf5);}})[_0x2010('0x22')](function(_0x361736){if(_0x361736){return _0x361736?{'count':_0x17f975,'rows':_0x361736}:null;}})['then'](respondWithResult(_0x59ed22,null))['catch'](handleError(_0x59ed22,null));};exports[_0x2010('0x80')]=function(_0x5b268a,_0x25d7a7,_0x24cc8d){var _0x9f789={'channel':'whatsapp'};var _0x151c4a=[];var _0x551ab8=[];var _0x14464a={};return db[_0x2010('0x3f')][_0x2010('0x58')]({'where':{'id':_0x5b268a['params']['id']},'include':[{'model':db[_0x2010('0x7b')],'as':_0x2010('0x81')}]})[_0x2010('0x22')](handleEntityNotFound(_0x25d7a7,null))[_0x2010('0x22')](function(_0x54734e){_0x9f789[_0x2010('0x82')]=_0x54734e;_0x9f789[_0x2010('0x83')]=_[_0x2010('0x84')](_0x54734e[_0x2010('0x81')],[_0x2010('0x7e')],[_0x2010('0x85')]);if(_0x9f789[_0x2010('0x82')][_0x2010('0x81')]){delete _0x9f789['account'][_0x2010('0x81')];}return db[_0x2010('0x86')][_0x2010('0x63')]();})[_0x2010('0x22')](function(_0x16ff00){if(!_0x16ff00){throw new db[(_0x2010('0x1f'))][(_0x2010('0x20'))](_0x2010('0x87'));}_0x151c4a=_[_0x2010('0x88')](_['keys'](_0x16ff00),[_0x2010('0x89'),'updatedAt']);_0x551ab8=_[_0x2010('0x88')](_[_0x2010('0x46')](_0x16ff00),['createdAt',_0x2010('0x8a'),_0x2010('0x8b'),_0x2010('0x8c')]);_0x9f789[_0x2010('0x5a')]={'mapKey':'mobile'};if(_0x9f789[_0x2010('0x82')]['type']&&_0x9f789['account'][_0x2010('0x42')]===_0x2010('0x8d')){_0x9f789[_0x2010('0x5a')][_0x2010('0x8e')]=_0x5b268a[_0x2010('0x5a')][_0x2010('0x8f')]['replace'](_0x2010('0x90'),'');_0x9f789['body'][_0x2010('0x5a')]=_0x5b268a[_0x2010('0x5a')][_0x2010('0x91')];_0x9f789[_0x2010('0x5a')]['messageId']=_0x5b268a[_0x2010('0x5a')][_0x2010('0x92')];}if(_0x9f789['body']['id']){delete _0x9f789[_0x2010('0x5a')]['id'];}if(_['isNil'](_0x9f789['body'][_0x2010('0x8e')])){throw new db[(_0x2010('0x1f'))][(_0x2010('0x20'))](_0x2010('0x93'));}if(_[_0x2010('0x94')](_0x9f789['body'][_0x2010('0x5a')])||_0x9f789[_0x2010('0x5a')][_0x2010('0x5a')]===''){throw new db[(_0x2010('0x1f'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2010('0x94')](_0x9f789[_0x2010('0x5a')][_0x2010('0x95')])){throw new db['Sequelize'][(_0x2010('0x20'))](_0x2010('0x96')+_0x551ab8);}if(!_[_0x2010('0x97')](_0x551ab8,_0x9f789[_0x2010('0x5a')][_0x2010('0x95')])){throw new db['Sequelize']['ValidationError'](_0x2010('0x98')+_0x551ab8);}_0x14464a[_0x9f789['body'][_0x2010('0x95')]]=_0x9f789['body'][_0x2010('0x8e')];return db[_0x2010('0x99')]['find']({'where':{'id':_0x9f789[_0x2010('0x82')]['ListId']},'include':[{'model':db[_0x2010('0x86')],'as':_0x2010('0x9a'),'where':_0x14464a,'limit':0x1,'order':[[_0x2010('0x8a'),_0x2010('0x9b')]]}]});})[_0x2010('0x22')](handleEntityNotFound(_0x25d7a7,null))[_0x2010('0x22')](function(_0x520a3a){if(_0x520a3a){_0x9f789[_0x2010('0x9c')]=_[_0x2010('0x70')](_0x520a3a,[_0x2010('0x9a')]);if(_0x520a3a[_0x2010('0x9a')]['length']){return _0x520a3a['Contacts'][0x0];}var _0x4133d8=_[_0x2010('0x18')](_0x9f789[_0x2010('0x5a')],{'firstName':_0x9f789[_0x2010('0x5a')]['from'],'ListId':_0x520a3a['id']});_0x4133d8[_0x9f789[_0x2010('0x5a')][_0x2010('0x95')]]=_0x9f789[_0x2010('0x5a')][_0x2010('0x8e')];return db['CmContact'][_0x2010('0x59')](_0x4133d8,{'fields':_0x151c4a,'raw':!![]});}})[_0x2010('0x22')](handleEntityNotFound(_0x25d7a7,null))[_0x2010('0x22')](function(_0x4528ae){if(_0x4528ae){_0x9f789['contact']=_0x4528ae;var _0x28b322={'ContactId':_0x4528ae['id'],'phone':_0x9f789[_0x2010('0x5a')][_0x2010('0x8e')],'WhatsappAccountId':_0x5b268a['params']['id']};var _0x3ae142={'ContactId':_0x4528ae['id'],'WhatsappAccountId':_0x5b268a['params']['id'],'closed':![]};return db[_0x2010('0x9d')][_0x2010('0x58')]({'where':_0x3ae142})[_0x2010('0x22')](function(_0x13a6c5){if(_0x13a6c5){return[_0x13a6c5,![]];}return db[_0x2010('0x9d')][_0x2010('0x59')](_0x28b322)['then'](function(_0x283ef8){return[_0x283ef8,!![]];});});}})[_0x2010('0x71')](function(_0x205149,_0xbbdd0c){_0x9f789[_0x2010('0x9e')]=_0x205149[_0x2010('0x5b')]({'plain':!![]});_0x9f789[_0x2010('0x9e')]['created']=![];if(_0xbbdd0c){if(_0x9f789[_0x2010('0x82')][_0x2010('0x9f')]){_0x9f789[_0x2010('0x83')][_0x2010('0xa0')]({'id':0x0,'priority':_0x9f789[_0x2010('0x83')]['length']+0x1,'app':_0x2010('0xa1'),'appdata':'unmanaged','interval':_0x2010('0xa2')});}_0x9f789[_0x2010('0x9e')][_0x2010('0xa3')]=!![];}return db['WhatsappMessage'][_0x2010('0x59')]({'phone':_0x9f789['body'][_0x2010('0x8e')],'messageId':_0x9f789[_0x2010('0x5a')]['messageId'],'body':_0x9f789[_0x2010('0x5a')][_0x2010('0x5a')],'WhatsappAccountId':_0x5b268a['params']['id'],'WhatsappInteractionId':_0x205149['id'],'direction':'in','ContactId':_0x205149[_0x2010('0xa4')],'AttachmentId':_0x9f789[_0x2010('0x5a')]['AttachmentId']});})[_0x2010('0x22')](function(_0x33a819){_0x9f789[_0x2010('0x2a')]=_0x33a819;if(_0x9f789[_0x2010('0x9e')][_0x2010('0xa5')]){return db[_0x2010('0x77')]['find']({'attributes':['id','name'],'where':{'id':_0x9f789['interaction'][_0x2010('0xa5')]}})[_0x2010('0x22')](function(_0x830d38){if(_0x830d38){_0x9f789[_0x2010('0x83')][_0x2010('0xa6')]({'id':0x0,'priority':0x0,'app':_0x2010('0xa7'),'appdata':_0x830d38['name']+','+(_0x9f789[_0x2010('0x82')][_0x2010('0xa8')]||0xa),'interval':_0x2010('0xa2')});}return respondWithRpcPromise(_0x2010('0xa9'),_0x2010('0xaa'),_0x9f789);});}return respondWithRpcPromise(_0x2010('0xa9'),'startRouting',_0x9f789);})[_0x2010('0x22')](function(_0x1d63ae){if(_0x1d63ae){var _0x390df0=0xc8;var _0x299074=_0x2010('0xab');logger[_0x2010('0x23')](_0x2010('0x25'),_0x299074,_0x390df0,_0x2010('0xac'));logger[_0x2010('0xad')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x299074,_0x390df0,_0x2010('0xac'),JSON[_0x2010('0x27')](_0x1d63ae));if(_0x9f789[_0x2010('0x82')][_0x2010('0x42')]===_0x2010('0x8d')){return _0x25d7a7[_0x2010('0x2d')](_0x390df0)[_0x2010('0x33')]('Content-Type',_0x2010('0xae'))[_0x2010('0x3b')]('\x0a');}else{return _0x25d7a7[_0x2010('0x2d')](_0x390df0)[_0x2010('0x2f')](_0x1d63ae);}}})[_0x2010('0x2b')](handleError(_0x25d7a7,null));};exports[_0x2010('0x3b')]=function(_0x244f96,_0x372f51,_0x2a3558){var _0x4d1f6c,_0x42c2a7,_0x30d6da;if(_[_0x2010('0x94')](_0x244f96[_0x2010('0x5a')][_0x2010('0x5a')])||_0x244f96[_0x2010('0x5a')]['body']===''){throw new db['Sequelize'][(_0x2010('0x20'))](_0x2010('0xaf'));}if(_[_0x2010('0x94')](_0x244f96['body']['to'])){throw new db[(_0x2010('0x1f'))][(_0x2010('0x20'))](_0x2010('0xb0'));}_0x4d1f6c=_0x244f96[_0x2010('0x5a')]['to'];return db[_0x2010('0x3f')][_0x2010('0x58')]({'where':{'id':_0x244f96[_0x2010('0x56')]['id']},'include':[{'model':db[_0x2010('0x99')],'as':'List','include':[{'model':db[_0x2010('0x86')],'as':_0x2010('0x9a'),'where':{'mobile':_0x4d1f6c},'limit':0x1,'order':[['updatedAt',_0x2010('0x9b')]]}]}]})[_0x2010('0x22')](handleEntityNotFound(_0x372f51,null))[_0x2010('0x22')](function(_0x35ce1){if(_0x35ce1&&_0x35ce1[_0x2010('0xb1')]){_0x42c2a7=_0x35ce1[_0x2010('0x5b')]({'plain':!![]});if(_0x42c2a7[_0x2010('0xb1')]&&_0x42c2a7[_0x2010('0xb1')][_0x2010('0x9a')][_0x2010('0x57')]){return _0x42c2a7[_0x2010('0xb1')][_0x2010('0x9a')][0x0];}return db[_0x2010('0x86')][_0x2010('0x59')](_[_0x2010('0x18')](_0x244f96[_0x2010('0x5a')],{'firstName':_0x4d1f6c,'mobile':_0x4d1f6c,'phone':_0x4d1f6c,'ListId':_0x42c2a7[_0x2010('0x8c')]}));}})[_0x2010('0x22')](handleEntityNotFound(_0x372f51,null))[_0x2010('0x22')](function(_0x5cca38){if(_0x5cca38){_0x30d6da=_0x5cca38;return db[_0x2010('0x9d')][_0x2010('0x58')]({'where':{'ContactId':_0x30d6da['id'],'closed':![],'WhatsappAccountId':_0x42c2a7['id']}})['then'](function(_0x45d04e){if(_0x45d04e){return[_0x45d04e,![]];}return db[_0x2010('0x9d')][_0x2010('0x59')]({'UserId':_0x244f96[_0x2010('0x5d')]['id'],'ContactId':_0x30d6da['id'],'WhatsappAccountId':_0x42c2a7['id'],'phone':_0x4d1f6c,'firstMsgDirection':_0x2010('0xb2'),'Messages':[_[_0x2010('0x50')](_0x244f96[_0x2010('0x5a')],{'read':![],'body':_0x244f96['body'][_0x2010('0x5a')],'phone':_0x4d1f6c,'WhatsappAccountId':_0x42c2a7['id'],'UserId':_0x244f96[_0x2010('0x5d')]['id'],'ContactId':_0x30d6da['id']})]},{'include':[{'model':db[_0x2010('0xb3')],'as':_0x2010('0xb4')}]})['then'](function(_0x2c4992){return[_0x2c4992,!![]];});});}})[_0x2010('0x71')](function(_0x124af2,_0x7732d5){if(_0x7732d5){return _0x124af2;}return db[_0x2010('0xb3')][_0x2010('0x59')](_[_0x2010('0x50')](_0x244f96[_0x2010('0x5a')],{'read':![],'body':_0x244f96['body'][_0x2010('0x5a')],'phone':_0x4d1f6c,'WhatsappAccountId':_0x42c2a7['id'],'WhatsappInteractionId':_0x124af2['id'],'UserId':_0x244f96[_0x2010('0x5d')]['id'],'ContactId':_0x30d6da['id']}))['then'](function(_0x38b003){_0x124af2['dataValues'][_0x2010('0xb4')]=[];_0x124af2[_0x2010('0xb5')][_0x2010('0xb4')][_0x2010('0xa0')](_0x38b003[_0x2010('0xb5')]);return _0x124af2;});})['then'](respondWithResult(_0x372f51,null))['catch'](handleError(_0x372f51,null));}; \ No newline at end of file +var _0x579c=['contact','WhatsappInteraction','interaction','created','applications','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','json','List','out','dataValues','Messages','push','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','client','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','limit','set','apply','reject','save','then','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','map','WhatsappAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','Pause','mandatoryDispositionPause','includeAll','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','describe','WhatsappAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','Applications','account','orderBy','asc','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','mobile','from','From','replace','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list'];(function(_0x3c1dd0,_0x490ac1){var _0x5f3c86=function(_0x389c40){while(--_0x389c40){_0x3c1dd0['push'](_0x3c1dd0['shift']());}};_0x5f3c86(++_0x490ac1);}(_0x579c,0xda));var _0xc579=function(_0x720b33,_0x325d6a){_0x720b33=_0x720b33-0x0;var _0x43032e=_0x579c[_0x720b33];return _0x43032e;};'use strict';var pdf=require(_0xc579('0x0'));var emlformat=require(_0xc579('0x1'));var rimraf=require(_0xc579('0x2'));var zipdir=require(_0xc579('0x3'));var jsonpatch=require(_0xc579('0x4'));var rp=require('request-promise');var moment=require(_0xc579('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc579('0x6'));var util=require(_0xc579('0x7'));var path=require(_0xc579('0x8'));var sox=require(_0xc579('0x9'));var csv=require(_0xc579('0xa'));var ejs=require(_0xc579('0xb'));var fs=require('fs');var _=require(_0xc579('0xc'));var squel=require('squel');var crypto=require(_0xc579('0xd'));var jsforce=require(_0xc579('0xe'));var deskjs=require(_0xc579('0xf'));var toCsv=require(_0xc579('0xa'));var querystring=require(_0xc579('0x10'));var Papa=require(_0xc579('0x11'));var Redis=require(_0xc579('0x12'));var authService=require(_0xc579('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc579('0x14'));var hardwareService=require(_0xc579('0x15'));var logger=require(_0xc579('0x16'))(_0xc579('0x17'));var utils=require(_0xc579('0x18'));var config=require(_0xc579('0x19'));var db=require(_0xc579('0x1a'))['db'];config[_0xc579('0x1b')]=_[_0xc579('0x1c')](config[_0xc579('0x1b')],{'host':_0xc579('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc579('0x1b')]));require('./whatsappAccount.socket')[_0xc579('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc579('0x1f')]['http']({'port':0x232c});function checkPasswordPattern(_0x44cd32,_0x4b3635,_0x349e82){if(_0x349e82){var _0x115276=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x115276['test'](_0x4b3635)){return _0x44cd32;}else{throw new db['Sequelize'][(_0xc579('0x20'))](_0xc579('0x21'));}}else{return _0x44cd32;}}function respondWithRpcPromise(_0x1ddc13,_0x414ee7,_0x7d5865,_0x33d341){return new BPromise(function(_0xbbbe3e,_0x3da8a1){var _0xa41248=_0x33d341||client;return _0xa41248[_0xc579('0x22')](_0x1ddc13,_0x7d5865)['then'](function(_0x463f5e){logger[_0xc579('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x414ee7,_0xc579('0x24'));logger[_0xc579('0x25')](_0xc579('0x26'),_0x414ee7,_0xc579('0x24'),JSON[_0xc579('0x27')](_0x463f5e));if(_0x463f5e[_0xc579('0x28')]){if(_0x463f5e[_0xc579('0x28')][_0xc579('0x29')]===0x1f4){logger['error'](_0xc579('0x2a'),_0x414ee7,_0x463f5e[_0xc579('0x28')][_0xc579('0x2b')]);return _0x3da8a1(_0x463f5e[_0xc579('0x28')][_0xc579('0x2b')]);}logger['error'](_0xc579('0x2a'),_0x414ee7,_0x463f5e[_0xc579('0x28')][_0xc579('0x2b')]);return _0xbbbe3e(_0x463f5e['error'][_0xc579('0x2b')]);}else{logger['info'](_0xc579('0x2a'),_0x414ee7,_0xc579('0x24'));_0xbbbe3e(_0x463f5e[_0xc579('0x2c')]['message']);}})[_0xc579('0x2d')](function(_0x5b5f4e){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x414ee7,_0x5b5f4e);_0x3da8a1(_0x5b5f4e);});});}function respondWithStatusCode(_0x540d90,_0x3f7363){_0x3f7363=_0x3f7363||0xcc;return function(_0xfdbb73){if(_0xfdbb73){return _0x540d90[_0xc579('0x2e')](_0x3f7363);}return _0x540d90[_0xc579('0x2f')](_0x3f7363)[_0xc579('0x30')]();};}function respondWithResult(_0x45fef4,_0x5c272f){_0x5c272f=_0x5c272f||0xc8;return function(_0x4d78bc){if(_0x4d78bc){return _0x45fef4[_0xc579('0x2f')](_0x5c272f)['json'](_0x4d78bc);}};}function respondWithFilteredResult(_0x314daa,_0x56224e){return function(_0x1a4551){if(_0x1a4551){var _0x3fe96b=_0x1a4551[_0xc579('0x31')],_0x1ad8f7=_0x56224e['offset'],_0x156bf5=_0x56224e[_0xc579('0x32')]+_0x56224e[_0xc579('0x33')],_0x45e6a3;if(_0x156bf5>=_0x3fe96b){_0x156bf5=_0x3fe96b;_0x45e6a3=0xc8;}else{_0x45e6a3=0xce;}_0x314daa[_0xc579('0x2f')](_0x45e6a3);return _0x314daa[_0xc579('0x34')]('Content-Range',_0x1ad8f7+'-'+_0x156bf5+'/'+_0x3fe96b)['json'](_0x1a4551);}return null;};}function patchUpdates(_0x21ab16){return function(_0x560e3b){try{jsonpatch[_0xc579('0x35')](_0x560e3b,_0x21ab16,!![]);}catch(_0x1591bc){return BPromise[_0xc579('0x36')](_0x1591bc);}return _0x560e3b[_0xc579('0x37')]();};}function saveUpdates(_0x29d619,_0x552c3a){return function(_0x1959c0){if(_0x1959c0){return _0x1959c0['update'](_0x29d619)[_0xc579('0x38')](function(_0x473000){return _0x473000;});}return null;};}function removeEntity(_0x5ec55f,_0x3535af){return function(_0x249fdc){if(_0x249fdc){return _0x249fdc['destroy']()['then'](function(){var _0x37bce9=_0x249fdc[_0xc579('0x39')]({'plain':!![]});var _0x578094=_0xc579('0x3a');return db[_0xc579('0x3b')]['destroy']({'where':{'type':_0x578094,'resourceId':_0x37bce9['id']}})[_0xc579('0x38')](function(){return _0x249fdc;});})['then'](function(){_0x5ec55f[_0xc579('0x2f')](0xcc)[_0xc579('0x30')]();});}};}function handleEntityNotFound(_0x5c6f38,_0x198d87){return function(_0x288e15){if(!_0x288e15){_0x5c6f38[_0xc579('0x2e')](0x194);}return _0x288e15;};}function handleError(_0x2fcdb5,_0x86e55f){_0x86e55f=_0x86e55f||0x1f4;return function(_0x324b51){logger['error'](_0x324b51[_0xc579('0x3c')]);if(_0x324b51[_0xc579('0x3d')]){delete _0x324b51['name'];}_0x2fcdb5[_0xc579('0x2f')](_0x86e55f)[_0xc579('0x3e')](_0x324b51);};}exports[_0xc579('0x3f')]=function(_0x33f56e,_0x58f293){var _0x3f744f={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2864de={},_0x4160ce={'count':0x0,'rows':[]};var _0x5c9d54=_[_0xc579('0x40')](db[_0xc579('0x41')][_0xc579('0x42')],function(_0xb93094){return{'name':_0xb93094[_0xc579('0x43')],'type':_0xb93094[_0xc579('0x44')]['key']};});_0x2864de[_0xc579('0x45')]=_['map'](_0x5c9d54,_0xc579('0x3d'));_0x2864de[_0xc579('0x46')]=_[_0xc579('0x47')](_0x33f56e[_0xc579('0x46')]);_0x2864de[_0xc579('0x48')]=_[_0xc579('0x49')](_0x2864de[_0xc579('0x45')],_0x2864de[_0xc579('0x46')]);_0x3f744f['attributes']=_[_0xc579('0x49')](_0x2864de[_0xc579('0x45')],qs[_0xc579('0x4a')](_0x33f56e[_0xc579('0x46')][_0xc579('0x4a')]));_0x3f744f[_0xc579('0x4b')]=_0x3f744f['attributes'][_0xc579('0x4c')]?_0x3f744f[_0xc579('0x4b')]:_0x2864de[_0xc579('0x45')];if(!_0x33f56e['query'][_0xc579('0x4d')](_0xc579('0x4e'))){_0x3f744f[_0xc579('0x33')]=qs['limit'](_0x33f56e[_0xc579('0x46')]['limit']);_0x3f744f[_0xc579('0x32')]=qs[_0xc579('0x32')](_0x33f56e[_0xc579('0x46')]['offset']);}_0x3f744f[_0xc579('0x4f')]=qs[_0xc579('0x50')](_0x33f56e['query']['sort']);_0x3f744f[_0xc579('0x51')]=qs[_0xc579('0x48')](_[_0xc579('0x52')](_0x33f56e[_0xc579('0x46')],_0x2864de['filters']),_0x5c9d54);if(_0x33f56e['query'][_0xc579('0x53')]){_0x3f744f[_0xc579('0x51')]=_[_0xc579('0x54')](_0x3f744f[_0xc579('0x51')],{'$or':_['map'](_0x5c9d54,function(_0x38b08f){if(_0x38b08f[_0xc579('0x44')]!=='VIRTUAL'){var _0x40d790={};_0x40d790[_0x38b08f['name']]={'$like':'%'+_0x33f56e['query']['filter']+'%'};return _0x40d790;}})});}_0x3f744f=_[_0xc579('0x54')]({},_0x3f744f,_0x33f56e[_0xc579('0x55')]);var _0x2b7a30={'where':_0x3f744f[_0xc579('0x51')]};return db[_0xc579('0x41')]['count'](_0x2b7a30)[_0xc579('0x38')](function(_0x1c7633){_0x4160ce[_0xc579('0x31')]=_0x1c7633;if(_0x33f56e['query']['includeAll']){_0x3f744f[_0xc579('0x56')]=[{'all':!![]}];}return db[_0xc579('0x41')][_0xc579('0x57')](_0x3f744f);})[_0xc579('0x38')](function(_0x192509){_0x4160ce[_0xc579('0x58')]=_0x192509;return _0x4160ce;})[_0xc579('0x38')](respondWithFilteredResult(_0x58f293,_0x3f744f))['catch'](handleError(_0x58f293,null));};exports['show']=function(_0x43e36d,_0x349c65){var _0x58081f={'raw':![],'where':{'id':_0x43e36d['params']['id']},'include':[{'model':db[_0xc579('0x59')],'as':_0xc579('0x5a')}]},_0x36daa4={};_0x36daa4[_0xc579('0x45')]=_[_0xc579('0x47')](db[_0xc579('0x41')][_0xc579('0x42')]);_0x36daa4['query']=_[_0xc579('0x47')](_0x43e36d[_0xc579('0x46')]);_0x36daa4[_0xc579('0x48')]=_['intersection'](_0x36daa4[_0xc579('0x45')],_0x36daa4['query']);_0x58081f[_0xc579('0x4b')]=_[_0xc579('0x49')](_0x36daa4[_0xc579('0x45')],qs[_0xc579('0x4a')](_0x43e36d['query']['fields']));_0x58081f[_0xc579('0x4b')]=_0x58081f['attributes'][_0xc579('0x4c')]?_0x58081f[_0xc579('0x4b')]:_0x36daa4[_0xc579('0x45')];if(_0x43e36d['query'][_0xc579('0x5b')]){_0x58081f[_0xc579('0x56')]=[{'all':!![]}];}_0x58081f=_['merge']({},_0x58081f,_0x43e36d[_0xc579('0x55')]);return db[_0xc579('0x41')][_0xc579('0x5c')](_0x58081f)[_0xc579('0x38')](handleEntityNotFound(_0x349c65,null))[_0xc579('0x38')](respondWithResult(_0x349c65,null))['catch'](handleError(_0x349c65,null));};exports['create']=function(_0x19765c,_0x409948){return db[_0xc579('0x41')]['create'](_0x19765c['body'],{})[_0xc579('0x38')](function(_0x4554a2){var _0x4fb2fb=_0x19765c[_0xc579('0x5d')][_0xc579('0x39')]({'plain':!![]});if(!_0x4fb2fb)throw new Error(_0xc579('0x5e'));if(_0x4fb2fb[_0xc579('0x5f')]===_0xc579('0x5d')){var _0x469fe5=_0x4554a2[_0xc579('0x39')]({'plain':!![]});var _0x51162b=_0xc579('0x3a');return db[_0xc579('0x60')][_0xc579('0x5c')]({'where':{'name':_0x51162b,'userProfileId':_0x4fb2fb[_0xc579('0x61')]},'raw':!![]})[_0xc579('0x38')](function(_0x4c08c5){if(_0x4c08c5&&_0x4c08c5[_0xc579('0x62')]===0x0){return db[_0xc579('0x3b')][_0xc579('0x63')]({'name':_0x469fe5[_0xc579('0x3d')],'resourceId':_0x469fe5['id'],'type':_0x4c08c5[_0xc579('0x3d')],'sectionId':_0x4c08c5['id']},{})['then'](function(){return _0x4554a2;});}else{return _0x4554a2;}})[_0xc579('0x2d')](function(_0x2f7a84){logger[_0xc579('0x28')](_0xc579('0x64'),_0x2f7a84);throw _0x2f7a84;});}return _0x4554a2;})[_0xc579('0x38')](respondWithResult(_0x409948,0xc9))[_0xc579('0x2d')](handleError(_0x409948,null));};exports['update']=function(_0x3821e0,_0x30b304){if(_0x3821e0[_0xc579('0x65')]['id']){delete _0x3821e0[_0xc579('0x65')]['id'];}return db[_0xc579('0x41')][_0xc579('0x5c')]({'where':{'id':_0x3821e0[_0xc579('0x66')]['id']},'include':[{'model':db[_0xc579('0x59')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x30b304,null))[_0xc579('0x38')](saveUpdates(_0x3821e0[_0xc579('0x65')],null))[_0xc579('0x38')](respondWithResult(_0x30b304,null))[_0xc579('0x2d')](handleError(_0x30b304,null));};exports[_0xc579('0x67')]=function(_0xccec41,_0x40d1c1){return db[_0xc579('0x41')][_0xc579('0x5c')]({'where':{'id':_0xccec41[_0xc579('0x66')]['id']}})[_0xc579('0x38')](handleEntityNotFound(_0x40d1c1,null))[_0xc579('0x38')](removeEntity(_0x40d1c1,null))[_0xc579('0x2d')](handleError(_0x40d1c1,null));};exports[_0xc579('0x68')]=function(_0x535e23,_0x45c6c8){return db[_0xc579('0x41')]['describe']()[_0xc579('0x38')](respondWithResult(_0x45c6c8,null))[_0xc579('0x2d')](handleError(_0x45c6c8,null));};exports['addDisposition']=function(_0x134c7f,_0x167696,_0x1ab782){if(_0x134c7f[_0xc579('0x65')]['id']){delete _0x134c7f[_0xc579('0x65')]['id'];}return db[_0xc579('0x41')][_0xc579('0x5c')]({'where':{'id':_0x134c7f[_0xc579('0x66')]['id']}})[_0xc579('0x38')](handleEntityNotFound(_0x167696,null))[_0xc579('0x38')](function(_0x6ca41c){if(_0x6ca41c){_0x134c7f[_0xc579('0x65')][_0xc579('0x69')]=_0x6ca41c['id'];return db['Disposition'][_0xc579('0x63')](_0x134c7f[_0xc579('0x65')]);}})['then'](respondWithResult(_0x167696,null))[_0xc579('0x2d')](handleError(_0x167696,null));};exports[_0xc579('0x6a')]=function(_0x3f969c,_0x4f1195,_0x42f21b){var _0xea767c={'raw':![],'where':{}};var _0x52b0ed={};var _0x4ac9d3={'count':0x0,'rows':[]};return db[_0xc579('0x41')][_0xc579('0x6b')]({'where':{'id':_0x3f969c[_0xc579('0x66')]['id']}})[_0xc579('0x38')](handleEntityNotFound(_0x4f1195,null))[_0xc579('0x38')](function(_0x26b6f5){if(_0x26b6f5){_0x52b0ed['model']=_['keys'](db[_0xc579('0x6c')][_0xc579('0x42')]);_0x52b0ed[_0xc579('0x46')]=_[_0xc579('0x47')](_0x3f969c[_0xc579('0x46')]);_0x52b0ed[_0xc579('0x48')]=_[_0xc579('0x49')](_0x52b0ed[_0xc579('0x45')],_0x52b0ed[_0xc579('0x46')]);_0xea767c[_0xc579('0x4b')]=_[_0xc579('0x49')](_0x52b0ed[_0xc579('0x45')],qs[_0xc579('0x4a')](_0x3f969c[_0xc579('0x46')][_0xc579('0x4a')]));_0xea767c['attributes']=_0xea767c[_0xc579('0x4b')][_0xc579('0x4c')]?_0xea767c['attributes']:_0x52b0ed[_0xc579('0x45')];if(!_0x3f969c[_0xc579('0x46')][_0xc579('0x4d')](_0xc579('0x4e'))){_0xea767c[_0xc579('0x33')]=qs[_0xc579('0x33')](_0x3f969c[_0xc579('0x46')][_0xc579('0x33')]);_0xea767c[_0xc579('0x32')]=qs[_0xc579('0x32')](_0x3f969c[_0xc579('0x46')][_0xc579('0x32')]);}_0xea767c[_0xc579('0x4f')]=qs[_0xc579('0x50')](_0x3f969c[_0xc579('0x46')][_0xc579('0x50')]);_0xea767c['where']=qs['filters'](_[_0xc579('0x52')](_0x3f969c[_0xc579('0x46')],_0x52b0ed[_0xc579('0x48')]));_0xea767c[_0xc579('0x51')][_0xc579('0x69')]=_0x26b6f5['id'];if(_0x3f969c[_0xc579('0x46')][_0xc579('0x53')]){_0xea767c[_0xc579('0x51')]=_[_0xc579('0x54')](_0xea767c['where'],{'$or':_['map'](_0xea767c[_0xc579('0x4b')],function(_0x4838a8){var _0x5dd473={};_0x5dd473[_0x4838a8]={'$like':'%'+_0x3f969c[_0xc579('0x46')][_0xc579('0x53')]+'%'};return _0x5dd473;})});}_0xea767c=_[_0xc579('0x54')]({},_0xea767c,_0x3f969c[_0xc579('0x55')]);return db[_0xc579('0x6c')][_0xc579('0x31')]({'where':_0xea767c['where']})[_0xc579('0x38')](function(_0x3ecd06){_0x4ac9d3['count']=_0x3ecd06;if(_0x3f969c[_0xc579('0x46')]['includeAll']){_0xea767c['include']=[{'all':!![]}];}return db[_0xc579('0x6c')][_0xc579('0x57')](_0xea767c);})[_0xc579('0x38')](function(_0x26a978){_0x4ac9d3[_0xc579('0x58')]=_0x26a978;return _0x4ac9d3;});}})[_0xc579('0x38')](respondWithFilteredResult(_0x4f1195,_0xea767c))[_0xc579('0x2d')](handleError(_0x4f1195,null));};exports['removeDispositions']=function(_0x33b7e2,_0x41d041,_0x5bdd18){return db[_0xc579('0x41')][_0xc579('0x5c')]({'where':{'id':_0x33b7e2[_0xc579('0x66')]['id']}})[_0xc579('0x38')](handleEntityNotFound(_0x41d041,null))['then'](function(_0x5b8e9e){if(_0x5b8e9e){return _0x5b8e9e[_0xc579('0x6d')](_0x33b7e2[_0xc579('0x46')][_0xc579('0x6e')]);}})['then'](respondWithStatusCode(_0x41d041,null))[_0xc579('0x2d')](handleError(_0x41d041,null));};exports[_0xc579('0x6f')]=function(_0x5b0172,_0x161018,_0xebf56f){if(_0x5b0172[_0xc579('0x65')]['id']){delete _0x5b0172['body']['id'];}return db[_0xc579('0x41')][_0xc579('0x5c')]({'where':{'id':_0x5b0172[_0xc579('0x66')]['id']}})['then'](handleEntityNotFound(_0x161018,null))[_0xc579('0x38')](function(_0x28e9c5){if(_0x28e9c5){_0x5b0172[_0xc579('0x65')][_0xc579('0x69')]=_0x28e9c5['id'];return db[_0xc579('0x70')][_0xc579('0x63')](_0x5b0172[_0xc579('0x65')]);}})['then'](respondWithResult(_0x161018,null))[_0xc579('0x2d')](handleError(_0x161018,null));};exports[_0xc579('0x71')]=function(_0x882c68,_0x183e8c,_0x2530bd){var _0x132d1b={'raw':![],'where':{}};var _0x1166fa={};var _0x2da70e={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xc579('0x6b')]({'where':{'id':_0x882c68[_0xc579('0x66')]['id']}})['then'](handleEntityNotFound(_0x183e8c,null))[_0xc579('0x38')](function(_0x378ec1){if(_0x378ec1){_0x1166fa['model']=_[_0xc579('0x47')](db[_0xc579('0x70')][_0xc579('0x42')]);_0x1166fa[_0xc579('0x46')]=_[_0xc579('0x47')](_0x882c68['query']);_0x1166fa[_0xc579('0x48')]=_[_0xc579('0x49')](_0x1166fa[_0xc579('0x45')],_0x1166fa[_0xc579('0x46')]);_0x132d1b[_0xc579('0x4b')]=_['intersection'](_0x1166fa[_0xc579('0x45')],qs[_0xc579('0x4a')](_0x882c68[_0xc579('0x46')]['fields']));_0x132d1b['attributes']=_0x132d1b[_0xc579('0x4b')][_0xc579('0x4c')]?_0x132d1b[_0xc579('0x4b')]:_0x1166fa[_0xc579('0x45')];if(!_0x882c68[_0xc579('0x46')][_0xc579('0x4d')](_0xc579('0x4e'))){_0x132d1b[_0xc579('0x33')]=qs[_0xc579('0x33')](_0x882c68['query'][_0xc579('0x33')]);_0x132d1b[_0xc579('0x32')]=qs[_0xc579('0x32')](_0x882c68[_0xc579('0x46')]['offset']);}_0x132d1b[_0xc579('0x4f')]=qs[_0xc579('0x50')](_0x882c68[_0xc579('0x46')][_0xc579('0x50')]);_0x132d1b['where']=qs[_0xc579('0x48')](_['pick'](_0x882c68[_0xc579('0x46')],_0x1166fa[_0xc579('0x48')]));_0x132d1b['where'][_0xc579('0x69')]=_0x378ec1['id'];if(_0x882c68['query'][_0xc579('0x53')]){_0x132d1b[_0xc579('0x51')]=_[_0xc579('0x54')](_0x132d1b[_0xc579('0x51')],{'$or':_[_0xc579('0x40')](_0x132d1b['attributes'],function(_0x2e5400){var _0x47e836={};_0x47e836[_0x2e5400]={'$like':'%'+_0x882c68['query'][_0xc579('0x53')]+'%'};return _0x47e836;})});}_0x132d1b=_[_0xc579('0x54')]({},_0x132d1b,_0x882c68['options']);return db['CannedAnswer'][_0xc579('0x31')]({'where':_0x132d1b['where']})[_0xc579('0x38')](function(_0x11f5c5){_0x2da70e[_0xc579('0x31')]=_0x11f5c5;if(_0x882c68[_0xc579('0x46')][_0xc579('0x5b')]){_0x132d1b['include']=[{'all':!![]}];}return db[_0xc579('0x70')][_0xc579('0x57')](_0x132d1b);})[_0xc579('0x38')](function(_0x406fba){_0x2da70e[_0xc579('0x58')]=_0x406fba;return _0x2da70e;});}})[_0xc579('0x38')](respondWithFilteredResult(_0x183e8c,_0x132d1b))[_0xc579('0x2d')](handleError(_0x183e8c,null));};exports[_0xc579('0x72')]=function(_0x4ec8d5,_0x40c2cd,_0x3a7127){return db['WhatsappAccount'][_0xc579('0x5c')]({'where':{'id':_0x4ec8d5['params']['id']}})[_0xc579('0x38')](handleEntityNotFound(_0x40c2cd,null))[_0xc579('0x38')](function(_0xb63e3a){if(_0xb63e3a){return _0xb63e3a[_0xc579('0x72')](_0x4ec8d5[_0xc579('0x46')][_0xc579('0x6e')]);}})[_0xc579('0x38')](respondWithStatusCode(_0x40c2cd,null))[_0xc579('0x2d')](handleError(_0x40c2cd,null));};exports['addAgents']=function(_0x48037d,_0x3ba895,_0x4e418c){return db['WhatsappAccount'][_0xc579('0x5c')]({'where':{'id':_0x48037d['params']['id']}})['then'](handleEntityNotFound(_0x3ba895,null))[_0xc579('0x38')](function(_0x35b10e){if(_0x35b10e){return _0x35b10e[_0xc579('0x73')](_0x48037d[_0xc579('0x65')]['ids'],_[_0xc579('0x74')](_0x48037d[_0xc579('0x65')],[_0xc579('0x6e'),'id'])||{})[_0xc579('0x75')](function(_0x30b033){for(var _0x2053ad=0x0;_0x2053ad<_0x48037d['body']['ids'][_0xc579('0x4c')];_0x2053ad+=0x1){socket[_0xc579('0x76')]('userWhatsappAccount:save',{'UserId':_0x48037d[_0xc579('0x65')]['ids'][_0x2053ad],'WhatsappAccountId':_0x48037d['params']['id']});}return _0x30b033;});}})[_0xc579('0x38')](respondWithResult(_0x3ba895,null))['catch'](handleError(_0x3ba895,null));};exports[_0xc579('0x77')]=function(_0x1b62ea,_0x35175c,_0x5aa10d){return db[_0xc579('0x41')]['find']({'where':{'id':_0x1b62ea['params']['id']}})[_0xc579('0x38')](handleEntityNotFound(_0x35175c,null))[_0xc579('0x38')](function(_0x168ed5){if(_0x168ed5){return _0x168ed5[_0xc579('0x77')](_0x1b62ea['query'][_0xc579('0x6e')])[_0xc579('0x38')](function(){if(_[_0xc579('0x78')](_0x1b62ea['query'][_0xc579('0x6e')])){for(var _0x50b1ef=0x0;_0x50b1ef<_0x1b62ea[_0xc579('0x46')][_0xc579('0x6e')][_0xc579('0x4c')];_0x50b1ef+=0x1){socket[_0xc579('0x76')](_0xc579('0x79'),{'UserId':Number(_0x1b62ea[_0xc579('0x46')][_0xc579('0x6e')][_0x50b1ef]),'WhatsappAccountId':Number(_0x1b62ea['params']['id'])});}}else{socket['emit'](_0xc579('0x79'),{'UserId':Number(_0x1b62ea[_0xc579('0x46')]['ids']),'WhatsappAccountId':Number(_0x1b62ea[_0xc579('0x66')]['id'])});}});}})[_0xc579('0x38')](respondWithStatusCode(_0x35175c,null))[_0xc579('0x2d')](handleError(_0x35175c,null));};exports[_0xc579('0x7a')]=function(_0x103f50,_0x292d7e,_0x3d980b){var _0x195e7d={};var _0x3f8389={};var _0x43a2fd;var _0x31e44c;return db[_0xc579('0x41')][_0xc579('0x6b')]({'where':{'id':_0x103f50[_0xc579('0x66')]['id']}})[_0xc579('0x38')](handleEntityNotFound(_0x292d7e,null))['then'](function(_0x1e69cc){if(_0x1e69cc){_0x43a2fd=_0x1e69cc;_0x3f8389['model']=_[_0xc579('0x47')](db[_0xc579('0x7b')][_0xc579('0x42')]);_0x3f8389['query']=_['keys'](_0x103f50[_0xc579('0x46')]);_0x3f8389[_0xc579('0x48')]=_['intersection'](_0x3f8389[_0xc579('0x45')],_0x3f8389['query']);_0x195e7d[_0xc579('0x4b')]=_['intersection'](_0x3f8389['model'],qs[_0xc579('0x4a')](_0x103f50['query'][_0xc579('0x4a')]));_0x195e7d[_0xc579('0x4b')]=_0x195e7d[_0xc579('0x4b')][_0xc579('0x4c')]?_0x195e7d[_0xc579('0x4b')]:_0x3f8389[_0xc579('0x45')];_0x195e7d[_0xc579('0x4f')]=qs[_0xc579('0x50')](_0x103f50['query'][_0xc579('0x50')]);_0x195e7d[_0xc579('0x51')]=qs[_0xc579('0x48')](_['pick'](_0x103f50[_0xc579('0x46')],_0x3f8389[_0xc579('0x48')]));if(_0x103f50['query'][_0xc579('0x53')]){_0x195e7d[_0xc579('0x51')]=_[_0xc579('0x54')](_0x195e7d[_0xc579('0x51')],{'$or':_[_0xc579('0x40')](_0x195e7d[_0xc579('0x4b')],function(_0x138ec7){var _0x382987={};_0x382987[_0x138ec7]={'$like':'%'+_0x103f50[_0xc579('0x46')][_0xc579('0x53')]+'%'};return _0x382987;})});}_0x195e7d=_['merge']({},_0x195e7d,_0x103f50[_0xc579('0x55')]);return _0x43a2fd[_0xc579('0x7a')](_0x195e7d);}})[_0xc579('0x38')](function(_0x1089e5){if(_0x1089e5){_0x31e44c=_0x1089e5[_0xc579('0x4c')];if(!_0x103f50['query'][_0xc579('0x4d')]('nolimit')){_0x195e7d[_0xc579('0x33')]=qs[_0xc579('0x33')](_0x103f50['query'][_0xc579('0x33')]);_0x195e7d['offset']=qs[_0xc579('0x32')](_0x103f50[_0xc579('0x46')][_0xc579('0x32')]);}return _0x43a2fd[_0xc579('0x7a')](_0x195e7d);}})['then'](function(_0x50eb89){if(_0x50eb89){return _0x50eb89?{'count':_0x31e44c,'rows':_0x50eb89}:null;}})['then'](respondWithResult(_0x292d7e,null))['catch'](handleError(_0x292d7e,null));};exports['addApplications']=function(_0x505d33,_0x1cb42a,_0x35f8f2){return db['WhatsappAccount'][_0xc579('0x6b')]({'where':{'id':_0x505d33['params']['id']}})[_0xc579('0x38')](handleEntityNotFound(_0x1cb42a,null))[_0xc579('0x38')](function(_0x3b86d9){if(_0x3b86d9){return db[_0xc579('0x7c')][_0xc579('0x7d')](function(_0x4d895f){return db[_0xc579('0x7e')][_0xc579('0x67')]({'where':{'WhatsappAccountId':_0x505d33[_0xc579('0x66')]['id']},'transaction':_0x4d895f})[_0xc579('0x38')](function(_0x296b6c){var _0x1d05bc=_[_0xc579('0x40')](_0x505d33[_0xc579('0x65')],function(_0x416a3b){_0x416a3b[_0xc579('0x69')]=_0x505d33[_0xc579('0x66')]['id'];return _0x416a3b;});return db[_0xc579('0x7e')][_0xc579('0x7f')](_0x1d05bc,{'transaction':_0x4d895f});});})[_0xc579('0x38')](function(){return db['WhatsappApplication'][_0xc579('0x80')]({'where':{'WhatsappAccountId':_0x505d33[_0xc579('0x66')]['id']},'order':_0xc579('0x81')});});}})[_0xc579('0x38')](respondWithResult(_0x1cb42a,null))['catch'](handleError(_0x1cb42a,null));};exports['getApplications']=function(_0x111a61,_0x12bf07,_0x2c1861){var _0x9c3592={};var _0x1e55c9={};var _0x38331f;var _0x57554a;return db['WhatsappAccount'][_0xc579('0x6b')]({'where':{'id':_0x111a61[_0xc579('0x66')]['id']}})[_0xc579('0x38')](handleEntityNotFound(_0x12bf07,null))[_0xc579('0x38')](function(_0x2f90d7){if(_0x2f90d7){_0x38331f=_0x2f90d7;_0x1e55c9[_0xc579('0x45')]=_[_0xc579('0x47')](db[_0xc579('0x7e')]['rawAttributes']);_0x1e55c9[_0xc579('0x46')]=_[_0xc579('0x47')](_0x111a61[_0xc579('0x46')]);_0x1e55c9[_0xc579('0x48')]=_[_0xc579('0x49')](_0x1e55c9[_0xc579('0x45')],_0x1e55c9[_0xc579('0x46')]);_0x9c3592['attributes']=_['intersection'](_0x1e55c9[_0xc579('0x45')],qs[_0xc579('0x4a')](_0x111a61[_0xc579('0x46')][_0xc579('0x4a')]));_0x9c3592[_0xc579('0x4b')]=_0x9c3592[_0xc579('0x4b')]['length']?_0x9c3592[_0xc579('0x4b')]:_0x1e55c9[_0xc579('0x45')];_0x9c3592['order']=qs[_0xc579('0x50')](_0x111a61[_0xc579('0x46')]['sort']);_0x9c3592[_0xc579('0x51')]=qs[_0xc579('0x48')](_[_0xc579('0x52')](_0x111a61[_0xc579('0x46')],_0x1e55c9[_0xc579('0x48')]));if(_0x111a61[_0xc579('0x46')][_0xc579('0x53')]){_0x9c3592[_0xc579('0x51')]=_[_0xc579('0x54')](_0x9c3592[_0xc579('0x51')],{'$or':_['map'](_0x9c3592[_0xc579('0x4b')],function(_0x528ead){var _0x2a44fe={};_0x2a44fe[_0x528ead]={'$like':'%'+_0x111a61['query']['filter']+'%'};return _0x2a44fe;})});}_0x9c3592=_['merge']({},_0x9c3592,_0x111a61[_0xc579('0x55')]);return _0x38331f[_0xc579('0x82')](_0x9c3592);}})['then'](function(_0x3dc289){if(_0x3dc289){_0x57554a=_0x3dc289['length'];if(!_0x111a61['query']['hasOwnProperty'](_0xc579('0x4e'))){_0x9c3592[_0xc579('0x33')]=qs[_0xc579('0x33')](_0x111a61[_0xc579('0x46')][_0xc579('0x33')]);_0x9c3592[_0xc579('0x32')]=qs[_0xc579('0x32')](_0x111a61[_0xc579('0x46')][_0xc579('0x32')]);}return _0x38331f[_0xc579('0x82')](_0x9c3592);}})[_0xc579('0x38')](function(_0x4a1b6c){if(_0x4a1b6c){return _0x4a1b6c?{'count':_0x57554a,'rows':_0x4a1b6c}:null;}})[_0xc579('0x38')](respondWithResult(_0x12bf07,null))[_0xc579('0x2d')](handleError(_0x12bf07,null));};exports[_0xc579('0x83')]=function(_0x44c108,_0x55ac32,_0xcbdcd0){var _0x29a134={'channel':'whatsapp'};var _0x32a638=[];var _0x1f29f2=[];var _0x307208={};return db['WhatsappAccount'][_0xc579('0x5c')]({'where':{'id':_0x44c108[_0xc579('0x66')]['id']},'include':[{'model':db[_0xc579('0x7e')],'as':_0xc579('0x84')}]})['then'](handleEntityNotFound(_0x55ac32,null))[_0xc579('0x38')](function(_0x198a3d){_0x29a134[_0xc579('0x85')]=_0x198a3d;_0x29a134['applications']=_[_0xc579('0x86')](_0x198a3d[_0xc579('0x84')],['priority'],[_0xc579('0x87')]);if(_0x29a134[_0xc579('0x85')][_0xc579('0x84')]){delete _0x29a134[_0xc579('0x85')][_0xc579('0x84')];}return db[_0xc579('0x88')][_0xc579('0x68')]();})[_0xc579('0x38')](function(_0x95e144){if(!_0x95e144){throw new db[(_0xc579('0x89'))][(_0xc579('0x20'))](_0xc579('0x8a'));}_0x32a638=_['difference'](_[_0xc579('0x47')](_0x95e144),[_0xc579('0x8b'),_0xc579('0x8c')]);_0x1f29f2=_[_0xc579('0x8d')](_[_0xc579('0x47')](_0x95e144),['createdAt',_0xc579('0x8c'),_0xc579('0x8e'),'ListId']);_0x29a134[_0xc579('0x65')]={'mapKey':_0xc579('0x8f')};if(_0x29a134[_0xc579('0x85')][_0xc579('0x44')]&&_0x29a134[_0xc579('0x85')][_0xc579('0x44')]==='twilio'){_0x29a134[_0xc579('0x65')][_0xc579('0x90')]=_0x44c108[_0xc579('0x65')][_0xc579('0x91')][_0xc579('0x92')](_0xc579('0x93'),'');_0x29a134[_0xc579('0x65')]['body']=_0x44c108[_0xc579('0x65')][_0xc579('0x94')];_0x29a134['body'][_0xc579('0x95')]=_0x44c108[_0xc579('0x65')][_0xc579('0x96')];}if(_0x29a134[_0xc579('0x65')]['id']){delete _0x29a134[_0xc579('0x65')]['id'];}if(_[_0xc579('0x97')](_0x29a134[_0xc579('0x65')]['from'])){throw new db['Sequelize'][(_0xc579('0x20'))](_0xc579('0x98'));}if(_[_0xc579('0x97')](_0x29a134[_0xc579('0x65')][_0xc579('0x65')])||_0x29a134['body'][_0xc579('0x65')]===''){throw new db[(_0xc579('0x89'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc579('0x97')](_0x29a134[_0xc579('0x65')][_0xc579('0x99')])){throw new db[(_0xc579('0x89'))][(_0xc579('0x20'))](_0xc579('0x9a')+_0x1f29f2);}if(!_[_0xc579('0x9b')](_0x1f29f2,_0x29a134[_0xc579('0x65')][_0xc579('0x99')])){throw new db[(_0xc579('0x89'))][(_0xc579('0x20'))](_0xc579('0x9c')+_0x1f29f2);}_0x307208[_0x29a134[_0xc579('0x65')][_0xc579('0x99')]]=_0x29a134[_0xc579('0x65')][_0xc579('0x90')];return db[_0xc579('0x9d')][_0xc579('0x5c')]({'where':{'id':_0x29a134[_0xc579('0x85')][_0xc579('0x9e')]},'include':[{'model':db[_0xc579('0x88')],'as':_0xc579('0x9f'),'where':_0x307208,'limit':0x1,'order':[[_0xc579('0x8c'),_0xc579('0xa0')]]}]});})[_0xc579('0x38')](handleEntityNotFound(_0x55ac32,null))[_0xc579('0x38')](function(_0x216989){if(_0x216989){_0x29a134[_0xc579('0xa1')]=_[_0xc579('0x74')](_0x216989,[_0xc579('0x9f')]);if(_0x216989[_0xc579('0x9f')]['length']){return _0x216989[_0xc579('0x9f')][0x0];}var _0x5cb508=_[_0xc579('0x1c')](_0x29a134[_0xc579('0x65')],{'firstName':_0x29a134['body'][_0xc579('0x90')],'ListId':_0x216989['id']});_0x5cb508[_0x29a134['body'][_0xc579('0x99')]]=_0x29a134['body'][_0xc579('0x90')];return db[_0xc579('0x88')][_0xc579('0x63')](_0x5cb508,{'fields':_0x32a638,'raw':!![]});}})[_0xc579('0x38')](handleEntityNotFound(_0x55ac32,null))[_0xc579('0x38')](function(_0x2ef51e){if(_0x2ef51e){_0x29a134[_0xc579('0xa2')]=_0x2ef51e;var _0x3f0755={'ContactId':_0x2ef51e['id'],'phone':_0x29a134['body'][_0xc579('0x90')],'WhatsappAccountId':_0x44c108['params']['id']};var _0x359457={'ContactId':_0x2ef51e['id'],'WhatsappAccountId':_0x44c108['params']['id'],'closed':![]};return db[_0xc579('0xa3')][_0xc579('0x5c')]({'where':_0x359457})['then'](function(_0x2f431a){if(_0x2f431a){return[_0x2f431a,![]];}return db['WhatsappInteraction']['create'](_0x3f0755)[_0xc579('0x38')](function(_0x40c285){return[_0x40c285,!![]];});});}})['spread'](function(_0x4a8d57,_0x1cf256){_0x29a134[_0xc579('0xa4')]=_0x4a8d57[_0xc579('0x39')]({'plain':!![]});_0x29a134[_0xc579('0xa4')][_0xc579('0xa5')]=![];if(_0x1cf256){if(_0x29a134['account']['autoclose']){_0x29a134[_0xc579('0xa6')]['push']({'id':0x0,'priority':_0x29a134[_0xc579('0xa6')][_0xc579('0x4c')]+0x1,'app':_0xc579('0xa7'),'appdata':_0xc579('0xa8'),'interval':_0xc579('0xa9')});}_0x29a134[_0xc579('0xa4')]['created']=!![];}return db[_0xc579('0xaa')][_0xc579('0x63')]({'phone':_0x29a134[_0xc579('0x65')]['from'],'messageId':_0x29a134[_0xc579('0x65')][_0xc579('0x95')],'body':_0x29a134[_0xc579('0x65')]['body'],'WhatsappAccountId':_0x44c108[_0xc579('0x66')]['id'],'WhatsappInteractionId':_0x4a8d57['id'],'direction':'in','ContactId':_0x4a8d57[_0xc579('0xab')],'AttachmentId':_0x29a134[_0xc579('0x65')][_0xc579('0xac')]});})['then'](function(_0x154c38){_0x29a134[_0xc579('0x2b')]=_0x154c38;if(_0x29a134[_0xc579('0xa4')]['UserId']){return db[_0xc579('0x7b')][_0xc579('0x5c')]({'attributes':['id',_0xc579('0x3d')],'where':{'id':_0x29a134[_0xc579('0xa4')][_0xc579('0xad')]}})[_0xc579('0x38')](function(_0x1b46b1){if(_0x1b46b1){_0x29a134['applications'][_0xc579('0xae')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1b46b1[_0xc579('0x3d')]+','+(_0x29a134[_0xc579('0x85')][_0xc579('0xaf')]||0xa),'interval':_0xc579('0xa9')});}return respondWithRpcPromise(_0xc579('0xb0'),'startRouting',_0x29a134);});}return respondWithRpcPromise('Start',_0xc579('0xb1'),_0x29a134);})['then'](function(_0x56f271){if(_0x56f271){var _0x42f774=0xc8;var _0x5da288=_0xc579('0xb2');logger[_0xc579('0x23')](_0xc579('0x26'),_0x5da288,_0x42f774,_0xc579('0xb3'));logger[_0xc579('0x25')](_0xc579('0xb4'),_0x5da288,_0x42f774,_0xc579('0xb3'),JSON[_0xc579('0x27')](_0x56f271));if(_0x29a134[_0xc579('0x85')][_0xc579('0x44')]===_0xc579('0xb5')){return _0x55ac32['status'](_0x42f774)[_0xc579('0x34')](_0xc579('0xb6'),_0xc579('0xb7'))['send']('\x0a');}else{return _0x55ac32[_0xc579('0x2f')](_0x42f774)[_0xc579('0xb8')](_0x56f271);}}})[_0xc579('0x2d')](handleError(_0x55ac32,null));};exports[_0xc579('0x3e')]=function(_0x3adf5a,_0x5a2a89,_0x5d523f){var _0x41abf5,_0x5ab567,_0x2bac1c;if(_[_0xc579('0x97')](_0x3adf5a[_0xc579('0x65')][_0xc579('0x65')])||_0x3adf5a['body'][_0xc579('0x65')]===''){throw new db['Sequelize'][(_0xc579('0x20'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc579('0x97')](_0x3adf5a[_0xc579('0x65')]['to'])){throw new db[(_0xc579('0x89'))][(_0xc579('0x20'))]('to\x20is\x20mandatory');}_0x41abf5=_0x3adf5a[_0xc579('0x65')]['to'];return db[_0xc579('0x41')][_0xc579('0x5c')]({'where':{'id':_0x3adf5a['params']['id']},'include':[{'model':db[_0xc579('0x9d')],'as':_0xc579('0xb9'),'include':[{'model':db[_0xc579('0x88')],'as':'Contacts','where':{'mobile':_0x41abf5},'limit':0x1,'order':[['updatedAt',_0xc579('0xa0')]]}]}]})[_0xc579('0x38')](handleEntityNotFound(_0x5a2a89,null))['then'](function(_0x42b702){if(_0x42b702&&_0x42b702[_0xc579('0xb9')]){_0x5ab567=_0x42b702[_0xc579('0x39')]({'plain':!![]});if(_0x5ab567[_0xc579('0xb9')]&&_0x5ab567['List'][_0xc579('0x9f')][_0xc579('0x4c')]){return _0x5ab567[_0xc579('0xb9')][_0xc579('0x9f')][0x0];}return db['CmContact'][_0xc579('0x63')](_[_0xc579('0x1c')](_0x3adf5a[_0xc579('0x65')],{'firstName':_0x41abf5,'mobile':_0x41abf5,'phone':_0x41abf5,'ListId':_0x5ab567[_0xc579('0x9e')]}));}})[_0xc579('0x38')](handleEntityNotFound(_0x5a2a89,null))[_0xc579('0x38')](function(_0x12dd99){if(_0x12dd99){_0x2bac1c=_0x12dd99;return db['WhatsappInteraction'][_0xc579('0x5c')]({'where':{'ContactId':_0x2bac1c['id'],'closed':![],'WhatsappAccountId':_0x5ab567['id']}})['then'](function(_0x1651ba){if(_0x1651ba){return[_0x1651ba,![]];}return db[_0xc579('0xa3')]['create']({'UserId':_0x3adf5a['user']['id'],'ContactId':_0x2bac1c['id'],'WhatsappAccountId':_0x5ab567['id'],'phone':_0x41abf5,'firstMsgDirection':_0xc579('0xba'),'Messages':[_[_0xc579('0x54')](_0x3adf5a[_0xc579('0x65')],{'read':![],'body':_0x3adf5a['body'][_0xc579('0x65')],'phone':_0x41abf5,'WhatsappAccountId':_0x5ab567['id'],'UserId':_0x3adf5a[_0xc579('0x5d')]['id'],'ContactId':_0x2bac1c['id']})]},{'include':[{'model':db[_0xc579('0xaa')],'as':'Messages'}]})[_0xc579('0x38')](function(_0x40a493){return[_0x40a493,!![]];});});}})['spread'](function(_0x57242c,_0x3eb634){if(_0x3eb634){return _0x57242c;}return db[_0xc579('0xaa')]['create'](_[_0xc579('0x54')](_0x3adf5a[_0xc579('0x65')],{'read':![],'body':_0x3adf5a['body'][_0xc579('0x65')],'phone':_0x41abf5,'WhatsappAccountId':_0x5ab567['id'],'WhatsappInteractionId':_0x57242c['id'],'UserId':_0x3adf5a['user']['id'],'ContactId':_0x2bac1c['id']}))[_0xc579('0x38')](function(_0x2082fe){_0x57242c[_0xc579('0xbb')][_0xc579('0xbc')]=[];_0x57242c[_0xc579('0xbb')][_0xc579('0xbc')][_0xc579('0xbd')](_0x2082fe[_0xc579('0xbb')]);return _0x57242c;});})[_0xc579('0x38')](respondWithResult(_0x5a2a89,null))[_0xc579('0x2d')](handleError(_0x5a2a89,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index b7e8a70..f6f1744 100644 --- a/server/api/whatsappAccount/whatsappAccount.events.js +++ b/server/api/whatsappAccount/whatsappAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee3c=['events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xee3c,0x14a));var _0xcee3=function(_0x4a2187,_0x492f74){_0x4a2187=_0x4a2187-0x0;var _0x8789e=_0xee3c[_0x4a2187];return _0x8789e;};'use strict';var EventEmitter=require(_0xcee3('0x0'));var WhatsappAccount=require(_0xcee3('0x1'))['db'][_0xcee3('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xcee3('0x3')](0x0);var events={'afterCreate':_0xcee3('0x4'),'afterUpdate':_0xcee3('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4a7681){return function(_0x435892,_0x4cd398,_0x39d2a8){WhatsappAccountEvents[_0xcee3('0x6')](_0x4a7681+':'+_0x435892['id'],_0x435892);WhatsappAccountEvents[_0xcee3('0x6')](_0x4a7681,_0x435892);_0x39d2a8(null);};}for(var e in events){if(events[_0xcee3('0x7')](e)){var event=events[e];WhatsappAccount[_0xcee3('0x8')](e,emitEvent(event));}}module[_0xcee3('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x39e6=['update','remove','emit','hasOwnProperty','hook','exports','events','WhatsappAccount'];(function(_0x2c8c80,_0x20b19a){var _0xc8f3e4=function(_0x4afa4b){while(--_0x4afa4b){_0x2c8c80['push'](_0x2c8c80['shift']());}};_0xc8f3e4(++_0x20b19a);}(_0x39e6,0x9e));var _0x639e=function(_0x248e7c,_0x750e08){_0x248e7c=_0x248e7c-0x0;var _0x1af0d7=_0x39e6[_0x248e7c];return _0x1af0d7;};'use strict';var EventEmitter=require(_0x639e('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x639e('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x639e('0x2'),'afterDestroy':_0x639e('0x3')};function emitEvent(_0x529394){return function(_0x467229,_0x207d6a,_0x199e72){WhatsappAccountEvents[_0x639e('0x4')](_0x529394+':'+_0x467229['id'],_0x467229);WhatsappAccountEvents[_0x639e('0x4')](_0x529394,_0x467229);_0x199e72(null);};}for(var e in events){if(events[_0x639e('0x5')](e)){var event=events[e];WhatsappAccount[_0x639e('0x6')](e,emitEvent(event));}}module[_0x639e('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 75e51fa..f36f025 100644 --- a/server/api/whatsappAccount/whatsappAccount.model.js +++ b/server/api/whatsappAccount/whatsappAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4263=['path','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x4263,0x14b));var _0x3426=function(_0x31c3db,_0x10b243){_0x31c3db=_0x31c3db-0x0;var _0x57c39c=_0x4263[_0x31c3db];return _0x57c39c;};'use strict';var _=require(_0x3426('0x0'));var util=require(_0x3426('0x1'));var logger=require(_0x3426('0x2'))(_0x3426('0x3'));var moment=require(_0x3426('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3426('0x5'));var rimraf=require('rimraf');var config=require(_0x3426('0x6'));var attributes=require(_0x3426('0x7'));module[_0x3426('0x8')]=function(_0x328b86,_0x5d1a1f){return _0x328b86[_0x3426('0x9')](_0x3426('0xa'),attributes,{'tableName':_0x3426('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe340=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xe340,0x145));var _0x0e34=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xe340[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0x0e34('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0e34('0x1'));var moment=require(_0x0e34('0x2'));var BPromise=require(_0x0e34('0x3'));var rp=require(_0x0e34('0x4'));var fs=require('fs');var path=require(_0x0e34('0x5'));var rimraf=require(_0x0e34('0x6'));var config=require(_0x0e34('0x7'));var attributes=require(_0x0e34('0x8'));module[_0x0e34('0x9')]=function(_0x562f70,_0x40b22b){return _0x562f70[_0x0e34('0xa')](_0x0e34('0xb'),attributes,{'tableName':_0x0e34('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 3f081df..c9efe10 100644 --- a/server/api/whatsappAccount/whatsappAccount.rpc.js +++ b/server/api/whatsappAccount/whatsappAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b94=['WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','WhatsappAccount','options','attributes','include','model','ShowWhatsappAccount','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x0b94,0x91));var _0x40b9=function(_0x1d55e2,_0x5c0e52){_0x1d55e2=_0x1d55e2-0x0;var _0x24bfae=_0x0b94[_0x1d55e2];return _0x24bfae;};'use strict';var _=require(_0x40b9('0x0'));var util=require(_0x40b9('0x1'));var moment=require(_0x40b9('0x2'));var BPromise=require(_0x40b9('0x3'));var rs=require(_0x40b9('0x4'));var fs=require('fs');var Redis=require(_0x40b9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x40b9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x40b9('0x7'));var jayson=require(_0x40b9('0x8'));var client=jayson['client'][_0x40b9('0x9')]({'port':0x232a});config[_0x40b9('0xa')]=_[_0x40b9('0xb')](config[_0x40b9('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x40b9('0xc'))(new Redis(config[_0x40b9('0xa')]));require(_0x40b9('0xd'))[_0x40b9('0xe')](socket);function respondWithRpcPromise(_0xf6aa69,_0x33d406,_0x202848){return new BPromise(function(_0x3d7422,_0x38f797){return client[_0x40b9('0xf')](_0xf6aa69,_0x202848)[_0x40b9('0x10')](function(_0x574230){logger[_0x40b9('0x11')](_0x40b9('0x12'),_0x33d406,'request\x20sent');logger[_0x40b9('0x13')](_0x40b9('0x14'),_0x33d406,_0x40b9('0x15'),JSON[_0x40b9('0x16')](_0x574230));if(_0x574230[_0x40b9('0x17')]){if(_0x574230[_0x40b9('0x17')][_0x40b9('0x18')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x33d406,_0x574230[_0x40b9('0x17')]['message']);return _0x38f797(_0x574230['error'][_0x40b9('0x19')]);}logger['error'](_0x40b9('0x12'),_0x33d406,_0x574230[_0x40b9('0x17')]['message']);return _0x3d7422(_0x574230[_0x40b9('0x17')][_0x40b9('0x19')]);}else{logger[_0x40b9('0x11')](_0x40b9('0x12'),_0x33d406,_0x40b9('0x15'));_0x3d7422(_0x574230['result']['message']);}})['catch'](function(_0x535f73){logger[_0x40b9('0x17')](_0x40b9('0x12'),_0x33d406,_0x535f73);_0x38f797(_0x535f73);});});}exports['ShowWhatsappAccount']=function(_0x21c998){var _0x110901=this;return new Promise(function(_0x36733c,_0x19c840){return db[_0x40b9('0x1a')]['find']({'raw':_0x21c998[_0x40b9('0x1b')]?_0x21c998[_0x40b9('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x21c998['options']?_0x21c998[_0x40b9('0x1b')]['where']||null:null,'attributes':_0x21c998[_0x40b9('0x1b')]?_0x21c998[_0x40b9('0x1b')][_0x40b9('0x1c')]||null:null,'include':_0x21c998[_0x40b9('0x1b')]?_0x21c998[_0x40b9('0x1b')]['include']?_['map'](_0x21c998[_0x40b9('0x1b')][_0x40b9('0x1d')],function(_0x107d98){return{'model':db[_0x107d98['model']],'as':_0x107d98['as'],'attributes':_0x107d98[_0x40b9('0x1c')],'include':_0x107d98[_0x40b9('0x1d')]?_['map'](_0x107d98[_0x40b9('0x1d')],function(_0x4e390f){return{'model':db[_0x4e390f[_0x40b9('0x1e')]],'as':_0x4e390f['as'],'attributes':_0x4e390f[_0x40b9('0x1c')],'include':_0x4e390f[_0x40b9('0x1d')]?_['map'](_0x4e390f['include'],function(_0x21aa3c){return{'model':db[_0x21aa3c['model']],'as':_0x21aa3c['as'],'attributes':_0x21aa3c[_0x40b9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x40b9('0x10')](function(_0x21dddc){logger[_0x40b9('0x11')](_0x40b9('0x1f'),_0x21c998);logger[_0x40b9('0x13')](_0x40b9('0x1f'),_0x21c998,JSON[_0x40b9('0x16')](_0x21dddc));_0x36733c(_0x21dddc);})[_0x40b9('0x20')](function(_0x54c306){logger[_0x40b9('0x17')](_0x40b9('0x1f'),_0x54c306[_0x40b9('0x19')],_0x21c998);_0x19c840(_0x110901[_0x40b9('0x17')](0x1f4,_0x54c306[_0x40b9('0x19')]));});});}; \ No newline at end of file +var _0x832c=['redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','stringify','lodash','util','moment','bluebird','ioredis','rpc','jayson/promise','client','http'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0x832c,0x1e5));var _0xc832=function(_0x148df8,_0x37e55c){_0x148df8=_0x148df8-0x0;var _0x5318aa=_0x832c[_0x148df8];return _0x5318aa;};'use strict';var _=require(_0xc832('0x0'));var util=require(_0xc832('0x1'));var moment=require(_0xc832('0x2'));var BPromise=require(_0xc832('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc832('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc832('0x5'));var config=require('../../config/environment');var jayson=require(_0xc832('0x6'));var client=jayson[_0xc832('0x7')][_0xc832('0x8')]({'port':0x232a});config[_0xc832('0x9')]=_[_0xc832('0xa')](config[_0xc832('0x9')],{'host':_0xc832('0xb'),'port':0x18eb});var socket=require(_0xc832('0xc'))(new Redis(config[_0xc832('0x9')]));require(_0xc832('0xd'))[_0xc832('0xe')](socket);function respondWithRpcPromise(_0x48be2d,_0x50ab17,_0x165905){return new BPromise(function(_0x4393d8,_0x37bb0a){return client[_0xc832('0xf')](_0x48be2d,_0x165905)[_0xc832('0x10')](function(_0x44d7e3){logger['info'](_0xc832('0x11'),_0x50ab17,'request\x20sent');logger[_0xc832('0x12')](_0xc832('0x13'),_0x50ab17,'request\x20sent',JSON['stringify'](_0x44d7e3));if(_0x44d7e3['error']){if(_0x44d7e3[_0xc832('0x14')][_0xc832('0x15')]===0x1f4){logger[_0xc832('0x14')](_0xc832('0x11'),_0x50ab17,_0x44d7e3[_0xc832('0x14')][_0xc832('0x16')]);return _0x37bb0a(_0x44d7e3[_0xc832('0x14')][_0xc832('0x16')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x50ab17,_0x44d7e3[_0xc832('0x14')]['message']);return _0x4393d8(_0x44d7e3['error'][_0xc832('0x16')]);}else{logger[_0xc832('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x50ab17,_0xc832('0x18'));_0x4393d8(_0x44d7e3[_0xc832('0x19')][_0xc832('0x16')]);}})[_0xc832('0x1a')](function(_0x54965c){logger[_0xc832('0x14')]('WhatsappAccount,\x20%s,\x20%s',_0x50ab17,_0x54965c);_0x37bb0a(_0x54965c);});});}exports[_0xc832('0x1b')]=function(_0x2b3434){var _0x235916=this;return new Promise(function(_0x3ca30d,_0x42b7f8){return db[_0xc832('0x1c')][_0xc832('0x1d')]({'raw':_0x2b3434['options']?_0x2b3434[_0xc832('0x1e')][_0xc832('0x1f')]===undefined?!![]:![]:!![],'where':_0x2b3434[_0xc832('0x1e')]?_0x2b3434[_0xc832('0x1e')][_0xc832('0x20')]||null:null,'attributes':_0x2b3434[_0xc832('0x1e')]?_0x2b3434[_0xc832('0x1e')][_0xc832('0x21')]||null:null,'include':_0x2b3434[_0xc832('0x1e')]?_0x2b3434[_0xc832('0x1e')][_0xc832('0x22')]?_['map'](_0x2b3434[_0xc832('0x1e')][_0xc832('0x22')],function(_0x4fc7c2){return{'model':db[_0x4fc7c2['model']],'as':_0x4fc7c2['as'],'attributes':_0x4fc7c2[_0xc832('0x21')],'include':_0x4fc7c2['include']?_[_0xc832('0x23')](_0x4fc7c2[_0xc832('0x22')],function(_0x346293){return{'model':db[_0x346293[_0xc832('0x24')]],'as':_0x346293['as'],'attributes':_0x346293[_0xc832('0x21')],'include':_0x346293[_0xc832('0x22')]?_[_0xc832('0x23')](_0x346293[_0xc832('0x22')],function(_0x49fb4e){return{'model':db[_0x49fb4e[_0xc832('0x24')]],'as':_0x49fb4e['as'],'attributes':_0x49fb4e[_0xc832('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc832('0x10')](function(_0x5526a4){logger['info']('ShowWhatsappAccount',_0x2b3434);logger[_0xc832('0x12')](_0xc832('0x1b'),_0x2b3434,JSON[_0xc832('0x25')](_0x5526a4));_0x3ca30d(_0x5526a4);})['catch'](function(_0x197898){logger[_0xc832('0x14')](_0xc832('0x1b'),_0x197898[_0xc832('0x16')],_0x2b3434);_0x42b7f8(_0x235916[_0xc832('0x14')](0x1f4,_0x197898[_0xc832('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 01b2549..b4f05e6 100644 --- a/server/api/whatsappAccount/whatsappAccount.socket.js +++ b/server/api/whatsappAccount/whatsappAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f89=['./whatsappAccount.events','save','remove','update','removeListener','length','whatsappAccount:'];(function(_0x5a6fee,_0x1de8d1){var _0x1c8c42=function(_0x5ed40d){while(--_0x5ed40d){_0x5a6fee['push'](_0x5a6fee['shift']());}};_0x1c8c42(++_0x1de8d1);}(_0x5f89,0x10a));var _0x95f8=function(_0x217449,_0x1caf28){_0x217449=_0x217449-0x0;var _0x2b9e20=_0x5f89[_0x217449];return _0x2b9e20;};'use strict';var WhatsappAccountEvents=require(_0x95f8('0x0'));var events=[_0x95f8('0x1'),_0x95f8('0x2'),_0x95f8('0x3')];function createListener(_0x3adec8,_0x3b509b){return function(_0x4b40f3){_0x3b509b['emit'](_0x3adec8,_0x4b40f3);};}function removeListener(_0xcc22eb,_0x29f737){return function(){WhatsappAccountEvents[_0x95f8('0x4')](_0xcc22eb,_0x29f737);};}exports['register']=function(_0x34dd54){for(var _0x3e5fb9=0x0,_0x174fd8=events[_0x95f8('0x5')];_0x3e5fb9<_0x174fd8;_0x3e5fb9++){var _0x434fff=events[_0x3e5fb9];var _0x3de86c=createListener(_0x95f8('0x6')+_0x434fff,_0x34dd54);WhatsappAccountEvents['on'](_0x434fff,_0x3de86c);}}; \ No newline at end of file +var _0x67b2=['./whatsappAccount.events','save','remove','update','emit','removeListener','register','length','whatsappAccount:'];(function(_0x4c47fb,_0x5834d5){var _0x39381b=function(_0x22a34a){while(--_0x22a34a){_0x4c47fb['push'](_0x4c47fb['shift']());}};_0x39381b(++_0x5834d5);}(_0x67b2,0x15f));var _0x267b=function(_0x41d432,_0x20e878){_0x41d432=_0x41d432-0x0;var _0x1650f9=_0x67b2[_0x41d432];return _0x1650f9;};'use strict';var WhatsappAccountEvents=require(_0x267b('0x0'));var events=[_0x267b('0x1'),_0x267b('0x2'),_0x267b('0x3')];function createListener(_0x59df52,_0x4fd722){return function(_0x4d6562){_0x4fd722[_0x267b('0x4')](_0x59df52,_0x4d6562);};}function removeListener(_0x396b66,_0x924307){return function(){WhatsappAccountEvents[_0x267b('0x5')](_0x396b66,_0x924307);};}exports[_0x267b('0x6')]=function(_0x57006f){for(var _0x4b4afc=0x0,_0x2416e1=events[_0x267b('0x7')];_0x4b4afc<_0x2416e1;_0x4b4afc++){var _0x50001b=events[_0x4b4afc];var _0x3b804b=createListener(_0x267b('0x8')+_0x50001b,_0x57006f);WhatsappAccountEvents['on'](_0x50001b,_0x3b804b);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 195adfe..c0fa454 100644 --- a/server/api/whatsappApplication/index.js +++ b/server/api/whatsappApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x99b8=['exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x99b8,0x190));var _0x899b=function(_0x56decb,_0x1c2262){_0x56decb=_0x56decb-0x0;var _0x1e11c9=_0x99b8[_0x56decb];return _0x1e11c9;};'use strict';var multer=require(_0x899b('0x0'));var util=require('util');var path=require(_0x899b('0x1'));var timeout=require(_0x899b('0x2'));var express=require(_0x899b('0x3'));var router=express['Router']();var auth=require(_0x899b('0x4'));var interaction=require(_0x899b('0x5'));var config=require(_0x899b('0x6'));var controller=require(_0x899b('0x7'));router[_0x899b('0x8')]('/',auth[_0x899b('0x9')](),controller[_0x899b('0xa')]);router[_0x899b('0x8')](_0x899b('0xb'),auth[_0x899b('0x9')](),controller[_0x899b('0xc')]);router[_0x899b('0xd')]('/',auth[_0x899b('0x9')](),controller[_0x899b('0xe')]);router[_0x899b('0xf')](_0x899b('0xb'),auth[_0x899b('0x9')](),controller['update']);router[_0x899b('0x10')](_0x899b('0xb'),auth['isAuthenticated'](),controller[_0x899b('0x11')]);module[_0x899b('0x12')]=router; \ No newline at end of file +var _0x5300=['isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x5300,0x117));var _0x0530=function(_0x7d8a84,_0x53ac6c){_0x7d8a84=_0x7d8a84-0x0;var _0x2991b4=_0x5300[_0x7d8a84];return _0x2991b4;};'use strict';var multer=require(_0x0530('0x0'));var util=require(_0x0530('0x1'));var path=require(_0x0530('0x2'));var timeout=require(_0x0530('0x3'));var express=require(_0x0530('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0530('0x5'));var config=require(_0x0530('0x6'));var controller=require(_0x0530('0x7'));router[_0x0530('0x8')]('/',auth[_0x0530('0x9')](),controller['index']);router[_0x0530('0x8')](_0x0530('0xa'),auth['isAuthenticated'](),controller[_0x0530('0xb')]);router[_0x0530('0xc')]('/',auth[_0x0530('0x9')](),controller[_0x0530('0xd')]);router[_0x0530('0xe')]('/:id',auth[_0x0530('0x9')](),controller['update']);router[_0x0530('0xf')](_0x0530('0xa'),auth[_0x0530('0x9')](),controller[_0x0530('0x10')]);module[_0x0530('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index acc94a6..834a912 100644 --- a/server/api/whatsappApplication/whatsappApplication.attributes.js +++ b/server/api/whatsappApplication/whatsappApplication.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe23d=['TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0x2325b4,_0x472135){var _0x34c1de=function(_0x26e5ea){while(--_0x26e5ea){_0x2325b4['push'](_0x2325b4['shift']());}};_0x34c1de(++_0x472135);}(_0xe23d,0x1c9));var _0xde23=function(_0x2b5897,_0x2bf7ee){_0x2b5897=_0x2b5897-0x0;var _0x4dc5c4=_0xe23d[_0x2b5897];return _0x4dc5c4;};'use strict';var Sequelize=require('sequelize');module[_0xde23('0x0')]={'priority':{'type':Sequelize[_0xde23('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xde23('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xde23('0x3')]()},'description':{'type':Sequelize[_0xde23('0x2')]},'interval':{'type':Sequelize[_0xde23('0x2')],'defaultValue':_0xde23('0x4')}}; \ No newline at end of file +var _0xa52d=['STRING','noop','sequelize','INTEGER'];(function(_0x299b65,_0x1a4e00){var _0x4884e0=function(_0x976e4b){while(--_0x976e4b){_0x299b65['push'](_0x299b65['shift']());}};_0x4884e0(++_0x1a4e00);}(_0xa52d,0x6e));var _0xda52=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0xa52d[_0x25e109];return _0xc0f7d6;};'use strict';var Sequelize=require(_0xda52('0x0'));module['exports']={'priority':{'type':Sequelize[_0xda52('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xda52('0x2')],'allowNull':![],'defaultValue':_0xda52('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xda52('0x2')]},'interval':{'type':Sequelize[_0xda52('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 92a0a31..fe68283 100644 --- a/server/api/whatsappApplication/whatsappApplication.controller.js +++ b/server/api/whatsappApplication/whatsappApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a46=['sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','merge','find','create','body','html-pdf','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x45d980,_0x331970){var _0x3d20d3=function(_0x4fdca6){while(--_0x4fdca6){_0x45d980['push'](_0x45d980['shift']());}};_0x3d20d3(++_0x331970);}(_0x6a46,0x7d));var _0x66a4=function(_0x17ed13,_0x38eeaf){_0x17ed13=_0x17ed13-0x0;var _0x3b275a=_0x6a46[_0x17ed13];return _0x3b275a;};'use strict';var pdf=require(_0x66a4('0x0'));var emlformat=require(_0x66a4('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x66a4('0x2'));var moment=require(_0x66a4('0x3'));var BPromise=require(_0x66a4('0x4'));var Mustache=require(_0x66a4('0x5'));var util=require(_0x66a4('0x6'));var path=require(_0x66a4('0x7'));var sox=require(_0x66a4('0x8'));var csv=require(_0x66a4('0x9'));var ejs=require(_0x66a4('0xa'));var fs=require('fs');var _=require(_0x66a4('0xb'));var squel=require(_0x66a4('0xc'));var crypto=require(_0x66a4('0xd'));var jsforce=require(_0x66a4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x66a4('0x9'));var querystring=require('querystring');var Papa=require(_0x66a4('0xf'));var Redis=require(_0x66a4('0x10'));var authService=require(_0x66a4('0x11'));var qs=require(_0x66a4('0x12'));var as=require(_0x66a4('0x13'));var hardwareService=require(_0x66a4('0x14'));var logger=require(_0x66a4('0x15'))(_0x66a4('0x16'));var utils=require('../../config/utils');var config=require(_0x66a4('0x17'));var db=require(_0x66a4('0x18'))['db'];function respondWithStatusCode(_0x14d777,_0x33f98e){_0x33f98e=_0x33f98e||0xcc;return function(_0x3abc0e){if(_0x3abc0e){return _0x14d777[_0x66a4('0x19')](_0x33f98e);}return _0x14d777[_0x66a4('0x1a')](_0x33f98e)[_0x66a4('0x1b')]();};}function respondWithResult(_0x4802bf,_0x23c5ab){_0x23c5ab=_0x23c5ab||0xc8;return function(_0xfd0fa6){if(_0xfd0fa6){return _0x4802bf[_0x66a4('0x1a')](_0x23c5ab)['json'](_0xfd0fa6);}};}function respondWithFilteredResult(_0x98951e,_0x257f85){return function(_0x4946aa){if(_0x4946aa){var _0xc40d09=_0x4946aa[_0x66a4('0x1c')],_0xffcc37=_0x257f85[_0x66a4('0x1d')],_0x1ce699=_0x257f85[_0x66a4('0x1d')]+_0x257f85[_0x66a4('0x1e')],_0x516aae;if(_0x1ce699>=_0xc40d09){_0x1ce699=_0xc40d09;_0x516aae=0xc8;}else{_0x516aae=0xce;}_0x98951e[_0x66a4('0x1a')](_0x516aae);return _0x98951e['set'](_0x66a4('0x1f'),_0xffcc37+'-'+_0x1ce699+'/'+_0xc40d09)[_0x66a4('0x20')](_0x4946aa);}return null;};}function patchUpdates(_0x18bef2){return function(_0x5cd35d){try{jsonpatch[_0x66a4('0x21')](_0x5cd35d,_0x18bef2,!![]);}catch(_0xd99303){return BPromise[_0x66a4('0x22')](_0xd99303);}return _0x5cd35d[_0x66a4('0x23')]();};}function saveUpdates(_0x4f097b,_0x5dc79e){return function(_0x47b088){if(_0x47b088){return _0x47b088[_0x66a4('0x24')](_0x4f097b)[_0x66a4('0x25')](function(_0x543e85){return _0x543e85;});}return null;};}function removeEntity(_0x4ab88a,_0x545c3e){return function(_0x404ffd){if(_0x404ffd){return _0x404ffd[_0x66a4('0x26')]()['then'](function(){_0x4ab88a[_0x66a4('0x1a')](0xcc)[_0x66a4('0x1b')]();});}};}function handleEntityNotFound(_0x2bf889,_0x16ee1f){return function(_0x359875){if(!_0x359875){_0x2bf889[_0x66a4('0x19')](0x194);}return _0x359875;};}function handleError(_0x32eb75,_0x5ba1ca){_0x5ba1ca=_0x5ba1ca||0x1f4;return function(_0x1d9107){logger[_0x66a4('0x27')](_0x1d9107['stack']);if(_0x1d9107['name']){delete _0x1d9107[_0x66a4('0x28')];}_0x32eb75[_0x66a4('0x1a')](_0x5ba1ca)[_0x66a4('0x29')](_0x1d9107);};}exports['index']=function(_0x4ea886,_0x259162){var _0x1b6251={},_0x2d6f7e={},_0x5f2121={'count':0x0,'rows':[]};var _0x2c8838=_[_0x66a4('0x2a')](db[_0x66a4('0x2b')][_0x66a4('0x2c')],function(_0x3f9296){return{'name':_0x3f9296[_0x66a4('0x2d')],'type':_0x3f9296[_0x66a4('0x2e')][_0x66a4('0x2f')]};});_0x2d6f7e[_0x66a4('0x30')]=_[_0x66a4('0x2a')](_0x2c8838,_0x66a4('0x28'));_0x2d6f7e[_0x66a4('0x31')]=_[_0x66a4('0x32')](_0x4ea886[_0x66a4('0x31')]);_0x2d6f7e[_0x66a4('0x33')]=_[_0x66a4('0x34')](_0x2d6f7e[_0x66a4('0x30')],_0x2d6f7e[_0x66a4('0x31')]);_0x1b6251['attributes']=_[_0x66a4('0x34')](_0x2d6f7e['model'],qs[_0x66a4('0x35')](_0x4ea886[_0x66a4('0x31')][_0x66a4('0x35')]));_0x1b6251[_0x66a4('0x36')]=_0x1b6251['attributes'][_0x66a4('0x37')]?_0x1b6251['attributes']:_0x2d6f7e[_0x66a4('0x30')];if(!_0x4ea886[_0x66a4('0x31')][_0x66a4('0x38')](_0x66a4('0x39'))){_0x1b6251[_0x66a4('0x1e')]=qs[_0x66a4('0x1e')](_0x4ea886[_0x66a4('0x31')][_0x66a4('0x1e')]);_0x1b6251[_0x66a4('0x1d')]=qs[_0x66a4('0x1d')](_0x4ea886[_0x66a4('0x31')][_0x66a4('0x1d')]);}_0x1b6251['order']=qs[_0x66a4('0x3a')](_0x4ea886['query']['sort']);_0x1b6251[_0x66a4('0x3b')]=qs[_0x66a4('0x33')](_[_0x66a4('0x3c')](_0x4ea886[_0x66a4('0x31')],_0x2d6f7e[_0x66a4('0x33')]),_0x2c8838);if(_0x4ea886[_0x66a4('0x31')]['filter']){_0x1b6251['where']=_['merge'](_0x1b6251[_0x66a4('0x3b')],{'$or':_['map'](_0x2c8838,function(_0x455700){if(_0x455700[_0x66a4('0x2e')]!==_0x66a4('0x3d')){var _0x1cf176={};_0x1cf176[_0x455700['name']]={'$like':'%'+_0x4ea886['query'][_0x66a4('0x3e')]+'%'};return _0x1cf176;}})});}_0x1b6251=_['merge']({},_0x1b6251,_0x4ea886[_0x66a4('0x3f')]);var _0x85d160={'where':_0x1b6251[_0x66a4('0x3b')]};return db[_0x66a4('0x2b')][_0x66a4('0x1c')](_0x85d160)['then'](function(_0x5a9b18){_0x5f2121[_0x66a4('0x1c')]=_0x5a9b18;if(_0x4ea886[_0x66a4('0x31')][_0x66a4('0x40')]){_0x1b6251['include']=[{'all':!![]}];}return db[_0x66a4('0x2b')][_0x66a4('0x41')](_0x1b6251);})[_0x66a4('0x25')](function(_0xa81342){_0x5f2121[_0x66a4('0x42')]=_0xa81342;return _0x5f2121;})[_0x66a4('0x25')](respondWithFilteredResult(_0x259162,_0x1b6251))[_0x66a4('0x43')](handleError(_0x259162,null));};exports[_0x66a4('0x44')]=function(_0x111ac6,_0x481d7f){var _0x24c3f5={'raw':!![],'where':{'id':_0x111ac6[_0x66a4('0x45')]['id']}},_0x35e100={};_0x35e100[_0x66a4('0x30')]=_[_0x66a4('0x32')](db[_0x66a4('0x2b')][_0x66a4('0x2c')]);_0x35e100[_0x66a4('0x31')]=_[_0x66a4('0x32')](_0x111ac6['query']);_0x35e100[_0x66a4('0x33')]=_['intersection'](_0x35e100[_0x66a4('0x30')],_0x35e100['query']);_0x24c3f5[_0x66a4('0x36')]=_[_0x66a4('0x34')](_0x35e100[_0x66a4('0x30')],qs[_0x66a4('0x35')](_0x111ac6['query'][_0x66a4('0x35')]));_0x24c3f5[_0x66a4('0x36')]=_0x24c3f5['attributes'][_0x66a4('0x37')]?_0x24c3f5[_0x66a4('0x36')]:_0x35e100[_0x66a4('0x30')];if(_0x111ac6['query'][_0x66a4('0x40')]){_0x24c3f5[_0x66a4('0x46')]=[{'all':!![]}];}_0x24c3f5=_[_0x66a4('0x47')]({},_0x24c3f5,_0x111ac6[_0x66a4('0x3f')]);return db[_0x66a4('0x2b')][_0x66a4('0x48')](_0x24c3f5)[_0x66a4('0x25')](handleEntityNotFound(_0x481d7f,null))['then'](respondWithResult(_0x481d7f,null))[_0x66a4('0x43')](handleError(_0x481d7f,null));};exports[_0x66a4('0x49')]=function(_0x1a4485,_0x1e5965){return db[_0x66a4('0x2b')][_0x66a4('0x49')](_0x1a4485[_0x66a4('0x4a')],{})['then'](respondWithResult(_0x1e5965,0xc9))['catch'](handleError(_0x1e5965,null));};exports[_0x66a4('0x24')]=function(_0x4146dc,_0x46a3f7){if(_0x4146dc[_0x66a4('0x4a')]['id']){delete _0x4146dc[_0x66a4('0x4a')]['id'];}return db[_0x66a4('0x2b')][_0x66a4('0x48')]({'where':{'id':_0x4146dc[_0x66a4('0x45')]['id']}})[_0x66a4('0x25')](handleEntityNotFound(_0x46a3f7,null))['then'](saveUpdates(_0x4146dc[_0x66a4('0x4a')],null))[_0x66a4('0x25')](respondWithResult(_0x46a3f7,null))['catch'](handleError(_0x46a3f7,null));};exports[_0x66a4('0x26')]=function(_0x2bc431,_0x409b52){return db[_0x66a4('0x2b')][_0x66a4('0x48')]({'where':{'id':_0x2bc431[_0x66a4('0x45')]['id']}})[_0x66a4('0x25')](handleEntityNotFound(_0x409b52,null))['then'](removeEntity(_0x409b52,null))[_0x66a4('0x43')](handleError(_0x409b52,null));}; \ No newline at end of file +var _0xdfb0=['status','end','json','offset','limit','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','count','include','findAll','rows','catch','show','includeAll','find','create','body','params','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xdfb0,0x79));var _0x0dfb=function(_0xaa53b7,_0x5ca330){_0xaa53b7=_0xaa53b7-0x0;var _0x5435e7=_0xdfb0[_0xaa53b7];return _0x5435e7;};'use strict';var pdf=require(_0x0dfb('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0dfb('0x1'));var jsonpatch=require(_0x0dfb('0x2'));var rp=require(_0x0dfb('0x3'));var moment=require(_0x0dfb('0x4'));var BPromise=require(_0x0dfb('0x5'));var Mustache=require(_0x0dfb('0x6'));var util=require(_0x0dfb('0x7'));var path=require(_0x0dfb('0x8'));var sox=require(_0x0dfb('0x9'));var csv=require(_0x0dfb('0xa'));var ejs=require(_0x0dfb('0xb'));var fs=require('fs');var _=require(_0x0dfb('0xc'));var squel=require('squel');var crypto=require(_0x0dfb('0xd'));var jsforce=require(_0x0dfb('0xe'));var deskjs=require(_0x0dfb('0xf'));var toCsv=require(_0x0dfb('0xa'));var querystring=require(_0x0dfb('0x10'));var Papa=require('papaparse');var Redis=require(_0x0dfb('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0dfb('0x12'));var hardwareService=require(_0x0dfb('0x13'));var logger=require('../../config/logger')(_0x0dfb('0x14'));var utils=require('../../config/utils');var config=require(_0x0dfb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x509936,_0x452b4a){_0x452b4a=_0x452b4a||0xcc;return function(_0x477244){if(_0x477244){return _0x509936[_0x0dfb('0x16')](_0x452b4a);}return _0x509936[_0x0dfb('0x17')](_0x452b4a)[_0x0dfb('0x18')]();};}function respondWithResult(_0x3bc19b,_0x1ce6f4){_0x1ce6f4=_0x1ce6f4||0xc8;return function(_0x2e7d94){if(_0x2e7d94){return _0x3bc19b['status'](_0x1ce6f4)[_0x0dfb('0x19')](_0x2e7d94);}};}function respondWithFilteredResult(_0x5250df,_0x3b7e5c){return function(_0x30c8c3){if(_0x30c8c3){var _0x1b7f45=_0x30c8c3['count'],_0x5cbd82=_0x3b7e5c[_0x0dfb('0x1a')],_0x180d44=_0x3b7e5c[_0x0dfb('0x1a')]+_0x3b7e5c[_0x0dfb('0x1b')],_0x32e9d2;if(_0x180d44>=_0x1b7f45){_0x180d44=_0x1b7f45;_0x32e9d2=0xc8;}else{_0x32e9d2=0xce;}_0x5250df['status'](_0x32e9d2);return _0x5250df['set'](_0x0dfb('0x1c'),_0x5cbd82+'-'+_0x180d44+'/'+_0x1b7f45)[_0x0dfb('0x19')](_0x30c8c3);}return null;};}function patchUpdates(_0x4ea728){return function(_0x1b596d){try{jsonpatch['apply'](_0x1b596d,_0x4ea728,!![]);}catch(_0x521e26){return BPromise[_0x0dfb('0x1d')](_0x521e26);}return _0x1b596d[_0x0dfb('0x1e')]();};}function saveUpdates(_0x2412f1,_0x195049){return function(_0x4d1d17){if(_0x4d1d17){return _0x4d1d17['update'](_0x2412f1)[_0x0dfb('0x1f')](function(_0x5cb16c){return _0x5cb16c;});}return null;};}function removeEntity(_0x16cf34,_0x7763a7){return function(_0x1cc4f2){if(_0x1cc4f2){return _0x1cc4f2[_0x0dfb('0x20')]()[_0x0dfb('0x1f')](function(){_0x16cf34[_0x0dfb('0x17')](0xcc)[_0x0dfb('0x18')]();});}};}function handleEntityNotFound(_0x5d2817,_0x3e11f1){return function(_0x5a45ad){if(!_0x5a45ad){_0x5d2817[_0x0dfb('0x16')](0x194);}return _0x5a45ad;};}function handleError(_0x5d2f8c,_0x1e5db7){_0x1e5db7=_0x1e5db7||0x1f4;return function(_0x133d78){logger[_0x0dfb('0x21')](_0x133d78[_0x0dfb('0x22')]);if(_0x133d78['name']){delete _0x133d78[_0x0dfb('0x23')];}_0x5d2f8c[_0x0dfb('0x17')](_0x1e5db7)[_0x0dfb('0x24')](_0x133d78);};}exports[_0x0dfb('0x25')]=function(_0x31a0d2,_0x2b1629){var _0x31d9aa={},_0x1d0be7={},_0x1ff2cd={'count':0x0,'rows':[]};var _0x224cb5=_[_0x0dfb('0x26')](db[_0x0dfb('0x27')][_0x0dfb('0x28')],function(_0x25d28f){return{'name':_0x25d28f[_0x0dfb('0x29')],'type':_0x25d28f[_0x0dfb('0x2a')][_0x0dfb('0x2b')]};});_0x1d0be7['model']=_['map'](_0x224cb5,_0x0dfb('0x23'));_0x1d0be7[_0x0dfb('0x2c')]=_[_0x0dfb('0x2d')](_0x31a0d2[_0x0dfb('0x2c')]);_0x1d0be7[_0x0dfb('0x2e')]=_[_0x0dfb('0x2f')](_0x1d0be7[_0x0dfb('0x30')],_0x1d0be7['query']);_0x31d9aa[_0x0dfb('0x31')]=_['intersection'](_0x1d0be7[_0x0dfb('0x30')],qs[_0x0dfb('0x32')](_0x31a0d2[_0x0dfb('0x2c')][_0x0dfb('0x32')]));_0x31d9aa[_0x0dfb('0x31')]=_0x31d9aa[_0x0dfb('0x31')]['length']?_0x31d9aa[_0x0dfb('0x31')]:_0x1d0be7[_0x0dfb('0x30')];if(!_0x31a0d2[_0x0dfb('0x2c')][_0x0dfb('0x33')](_0x0dfb('0x34'))){_0x31d9aa[_0x0dfb('0x1b')]=qs[_0x0dfb('0x1b')](_0x31a0d2[_0x0dfb('0x2c')]['limit']);_0x31d9aa[_0x0dfb('0x1a')]=qs[_0x0dfb('0x1a')](_0x31a0d2[_0x0dfb('0x2c')][_0x0dfb('0x1a')]);}_0x31d9aa[_0x0dfb('0x35')]=qs[_0x0dfb('0x36')](_0x31a0d2[_0x0dfb('0x2c')][_0x0dfb('0x36')]);_0x31d9aa['where']=qs['filters'](_[_0x0dfb('0x37')](_0x31a0d2['query'],_0x1d0be7[_0x0dfb('0x2e')]),_0x224cb5);if(_0x31a0d2[_0x0dfb('0x2c')]['filter']){_0x31d9aa[_0x0dfb('0x38')]=_[_0x0dfb('0x39')](_0x31d9aa[_0x0dfb('0x38')],{'$or':_[_0x0dfb('0x26')](_0x224cb5,function(_0x3897ae){if(_0x3897ae['type']!==_0x0dfb('0x3a')){var _0x27de1c={};_0x27de1c[_0x3897ae[_0x0dfb('0x23')]]={'$like':'%'+_0x31a0d2[_0x0dfb('0x2c')][_0x0dfb('0x3b')]+'%'};return _0x27de1c;}})});}_0x31d9aa=_['merge']({},_0x31d9aa,_0x31a0d2[_0x0dfb('0x3c')]);var _0x2f3a4f={'where':_0x31d9aa[_0x0dfb('0x38')]};return db[_0x0dfb('0x27')][_0x0dfb('0x3d')](_0x2f3a4f)[_0x0dfb('0x1f')](function(_0x83989c){_0x1ff2cd[_0x0dfb('0x3d')]=_0x83989c;if(_0x31a0d2[_0x0dfb('0x2c')]['includeAll']){_0x31d9aa[_0x0dfb('0x3e')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x0dfb('0x3f')](_0x31d9aa);})[_0x0dfb('0x1f')](function(_0xb7468d){_0x1ff2cd[_0x0dfb('0x40')]=_0xb7468d;return _0x1ff2cd;})['then'](respondWithFilteredResult(_0x2b1629,_0x31d9aa))[_0x0dfb('0x41')](handleError(_0x2b1629,null));};exports[_0x0dfb('0x42')]=function(_0xca8733,_0x470d01){var _0x3e8d42={'raw':!![],'where':{'id':_0xca8733['params']['id']}},_0x4408d0={};_0x4408d0[_0x0dfb('0x30')]=_[_0x0dfb('0x2d')](db[_0x0dfb('0x27')][_0x0dfb('0x28')]);_0x4408d0[_0x0dfb('0x2c')]=_['keys'](_0xca8733[_0x0dfb('0x2c')]);_0x4408d0[_0x0dfb('0x2e')]=_[_0x0dfb('0x2f')](_0x4408d0['model'],_0x4408d0[_0x0dfb('0x2c')]);_0x3e8d42[_0x0dfb('0x31')]=_[_0x0dfb('0x2f')](_0x4408d0['model'],qs[_0x0dfb('0x32')](_0xca8733[_0x0dfb('0x2c')][_0x0dfb('0x32')]));_0x3e8d42[_0x0dfb('0x31')]=_0x3e8d42[_0x0dfb('0x31')]['length']?_0x3e8d42['attributes']:_0x4408d0[_0x0dfb('0x30')];if(_0xca8733[_0x0dfb('0x2c')][_0x0dfb('0x43')]){_0x3e8d42['include']=[{'all':!![]}];}_0x3e8d42=_[_0x0dfb('0x39')]({},_0x3e8d42,_0xca8733[_0x0dfb('0x3c')]);return db[_0x0dfb('0x27')][_0x0dfb('0x44')](_0x3e8d42)[_0x0dfb('0x1f')](handleEntityNotFound(_0x470d01,null))[_0x0dfb('0x1f')](respondWithResult(_0x470d01,null))['catch'](handleError(_0x470d01,null));};exports[_0x0dfb('0x45')]=function(_0x497e83,_0x31664d){return db[_0x0dfb('0x27')]['create'](_0x497e83[_0x0dfb('0x46')],{})[_0x0dfb('0x1f')](respondWithResult(_0x31664d,0xc9))['catch'](handleError(_0x31664d,null));};exports['update']=function(_0x3151a1,_0x21602c){if(_0x3151a1[_0x0dfb('0x46')]['id']){delete _0x3151a1[_0x0dfb('0x46')]['id'];}return db[_0x0dfb('0x27')][_0x0dfb('0x44')]({'where':{'id':_0x3151a1[_0x0dfb('0x47')]['id']}})['then'](handleEntityNotFound(_0x21602c,null))[_0x0dfb('0x1f')](saveUpdates(_0x3151a1[_0x0dfb('0x46')],null))['then'](respondWithResult(_0x21602c,null))[_0x0dfb('0x41')](handleError(_0x21602c,null));};exports[_0x0dfb('0x20')]=function(_0x18ed74,_0x50e6b7){return db[_0x0dfb('0x27')][_0x0dfb('0x44')]({'where':{'id':_0x18ed74['params']['id']}})['then'](handleEntityNotFound(_0x50e6b7,null))[_0x0dfb('0x1f')](removeEntity(_0x50e6b7,null))[_0x0dfb('0x41')](handleError(_0x50e6b7,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index b09535c..5142f14 100644 --- a/server/api/whatsappApplication/whatsappApplication.model.js +++ b/server/api/whatsappApplication/whatsappApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0ca5=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','utf8mb4'];(function(_0x149eee,_0x6a1bcd){var _0x689862=function(_0x38b00b){while(--_0x38b00b){_0x149eee['push'](_0x149eee['shift']());}};_0x689862(++_0x6a1bcd);}(_0x0ca5,0xfc));var _0x50ca=function(_0x274047,_0x9b6f0b){_0x274047=_0x274047-0x0;var _0x4327b3=_0x0ca5[_0x274047];return _0x4327b3;};'use strict';var _=require(_0x50ca('0x0'));var util=require(_0x50ca('0x1'));var logger=require(_0x50ca('0x2'))(_0x50ca('0x3'));var moment=require(_0x50ca('0x4'));var BPromise=require(_0x50ca('0x5'));var rp=require(_0x50ca('0x6'));var fs=require('fs');var path=require(_0x50ca('0x7'));var rimraf=require('rimraf');var config=require(_0x50ca('0x8'));var attributes=require(_0x50ca('0x9'));module[_0x50ca('0xa')]=function(_0x404ab9,_0x4815d3){return _0x404ab9[_0x50ca('0xb')](_0x50ca('0xc'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x50ca('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x594d=['whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x594d,0x92));var _0xd594=function(_0xc54bb3,_0x551b5b){_0xc54bb3=_0xc54bb3-0x0;var _0x1e8d40=_0x594d[_0xc54bb3];return _0x1e8d40;};'use strict';var _=require(_0xd594('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd594('0x1'));var moment=require(_0xd594('0x2'));var BPromise=require(_0xd594('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd594('0x4'));var rimraf=require(_0xd594('0x5'));var config=require(_0xd594('0x6'));var attributes=require(_0xd594('0x7'));module['exports']=function(_0x3347cd,_0x498ef4){return _0x3347cd[_0xd594('0x8')](_0xd594('0x9'),attributes,{'tableName':_0xd594('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd594('0xb'),'collate':_0xd594('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index c195bac..da12bd5 100644 --- a/server/api/whatsappApplication/whatsappApplication.rpc.js +++ b/server/api/whatsappApplication/whatsappApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b8f=['debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x60f69d,_0x1e2dbd){var _0x647b3f=function(_0x34eec0){while(--_0x34eec0){_0x60f69d['push'](_0x60f69d['shift']());}};_0x647b3f(++_0x1e2dbd);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x59f614,_0x55fe66){_0x59f614=_0x59f614-0x0;var _0x2e0506=_0x6b8f[_0x59f614];return _0x2e0506;};'use strict';var _=require('lodash');var util=require(_0xf6b8('0x0'));var moment=require('moment');var BPromise=require(_0xf6b8('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf6b8('0x2'))['db'];var utils=require(_0xf6b8('0x3'));var logger=require('../../config/logger')(_0xf6b8('0x4'));var config=require(_0xf6b8('0x5'));var jayson=require(_0xf6b8('0x6'));var client=jayson['client'][_0xf6b8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x79c66d,_0x446336,_0x3c3430){return new BPromise(function(_0x557910,_0x5f07f4){return client[_0xf6b8('0x8')](_0x79c66d,_0x3c3430)['then'](function(_0x24458c){logger[_0xf6b8('0x9')](_0xf6b8('0xa'),_0x446336,_0xf6b8('0xb'));logger[_0xf6b8('0xc')](_0xf6b8('0xd'),_0x446336,'request\x20sent',JSON['stringify'](_0x24458c));if(_0x24458c['error']){if(_0x24458c[_0xf6b8('0xe')][_0xf6b8('0xf')]===0x1f4){logger[_0xf6b8('0xe')](_0xf6b8('0xa'),_0x446336,_0x24458c['error']['message']);return _0x5f07f4(_0x24458c[_0xf6b8('0xe')][_0xf6b8('0x10')]);}logger['error'](_0xf6b8('0xa'),_0x446336,_0x24458c[_0xf6b8('0xe')][_0xf6b8('0x10')]);return _0x557910(_0x24458c['error'][_0xf6b8('0x10')]);}else{logger['info'](_0xf6b8('0xa'),_0x446336,_0xf6b8('0xb'));_0x557910(_0x24458c[_0xf6b8('0x11')][_0xf6b8('0x10')]);}})[_0xf6b8('0x12')](function(_0x567b58){logger['error'](_0xf6b8('0xa'),_0x446336,_0x567b58);_0x5f07f4(_0x567b58);});});} \ No newline at end of file +var _0xb4c7=['client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x195d44,_0x7c56f8){var _0x46a0e7=function(_0xb30c3d){while(--_0xb30c3d){_0x195d44['push'](_0x195d44['shift']());}};_0x46a0e7(++_0x7c56f8);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x3643dc,_0x3ee6e4){_0x3643dc=_0x3643dc-0x0;var _0x4102e4=_0xb4c7[_0x3643dc];return _0x4102e4;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var moment=require(_0x7b4c('0x2'));var BPromise=require(_0x7b4c('0x3'));var rs=require(_0x7b4c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b4c('0x5'))['db'];var utils=require(_0x7b4c('0x6'));var logger=require(_0x7b4c('0x7'))(_0x7b4c('0x8'));var config=require(_0x7b4c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7b4c('0xa')][_0x7b4c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dd5c7,_0x4bf85d,_0x2d7b7e){return new BPromise(function(_0x21687f,_0x570daa){return client[_0x7b4c('0xc')](_0x2dd5c7,_0x2d7b7e)[_0x7b4c('0xd')](function(_0x28e902){logger[_0x7b4c('0xe')](_0x7b4c('0xf'),_0x4bf85d,_0x7b4c('0x10'));logger[_0x7b4c('0x11')](_0x7b4c('0x12'),_0x4bf85d,_0x7b4c('0x10'),JSON[_0x7b4c('0x13')](_0x28e902));if(_0x28e902['error']){if(_0x28e902['error'][_0x7b4c('0x14')]===0x1f4){logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);return _0x570daa(_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);}logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x28e902[_0x7b4c('0x15')]['message']);return _0x21687f(_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);}else{logger[_0x7b4c('0xe')](_0x7b4c('0xf'),_0x4bf85d,_0x7b4c('0x10'));_0x21687f(_0x28e902[_0x7b4c('0x17')][_0x7b4c('0x16')]);}})[_0x7b4c('0x18')](function(_0x4d3f5e){logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x4d3f5e);_0x570daa(_0x4d3f5e);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index ff1c4ff..36c8d20 100644 --- a/server/api/whatsappInteraction/index.js +++ b/server/api/whatsappInteraction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f88=['getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update','update','delete','whatsapp','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','describe','show','/:id/messages'];(function(_0x5d81b3,_0xad3e52){var _0xa8c58d=function(_0x3b4e0b){while(--_0x3b4e0b){_0x5d81b3['push'](_0x5d81b3['shift']());}};_0xa8c58d(++_0xad3e52);}(_0x4f88,0xf3));var _0x84f8=function(_0x20aadb,_0x5a607a){_0x20aadb=_0x20aadb-0x0;var _0x520018=_0x4f88[_0x20aadb];return _0x520018;};'use strict';var multer=require(_0x84f8('0x0'));var util=require(_0x84f8('0x1'));var path=require('path');var timeout=require(_0x84f8('0x2'));var express=require(_0x84f8('0x3'));var router=express[_0x84f8('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x84f8('0x5'));var controller=require(_0x84f8('0x6'));router[_0x84f8('0x7')]('/',auth[_0x84f8('0x8')](),controller[_0x84f8('0x9')]);router[_0x84f8('0x7')]('/describe',auth[_0x84f8('0x8')](),controller[_0x84f8('0xa')]);router['get']('/:id',auth[_0x84f8('0x8')](),controller[_0x84f8('0xb')]);router[_0x84f8('0x7')](_0x84f8('0xc'),auth[_0x84f8('0x8')](),controller[_0x84f8('0xd')]);router[_0x84f8('0x7')](_0x84f8('0xe'),auth['isAuthenticated'](),controller['download']);router[_0x84f8('0xf')]('/',auth[_0x84f8('0x8')](),controller[_0x84f8('0x10')]);router[_0x84f8('0xf')](_0x84f8('0xc'),auth['isAuthenticated'](),controller[_0x84f8('0x11')]);router[_0x84f8('0xf')](_0x84f8('0x12'),auth[_0x84f8('0x8')](),interaction[_0x84f8('0x13')]('whatsapp',_0x84f8('0x14')),controller[_0x84f8('0x15')]);router[_0x84f8('0x16')](_0x84f8('0x17'),auth['isAuthenticated'](),interaction[_0x84f8('0x13')]('whatsapp',_0x84f8('0x18')),controller[_0x84f8('0x19')]);router[_0x84f8('0x1a')]('/:id',auth[_0x84f8('0x8')](),interaction[_0x84f8('0x13')](_0x84f8('0x1b'),_0x84f8('0x1c')),controller[_0x84f8('0x1d')]);router[_0x84f8('0x1a')]('/:id/tags',auth[_0x84f8('0x8')](),controller[_0x84f8('0x1e')]);module[_0x84f8('0x1f')]=router; \ No newline at end of file +var _0x5977=['../../components/interaction/service','./whatsappInteraction.controller','isAuthenticated','index','describe','get','show','getMessages','/:id/download','post','create','/:id/messages','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','whatsapp','update','delete','/:id','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5977,0xeb));var _0x7597=function(_0x39d9ea,_0x124cf1){_0x39d9ea=_0x39d9ea-0x0;var _0x535d4c=_0x5977[_0x39d9ea];return _0x535d4c;};'use strict';var multer=require(_0x7597('0x0'));var util=require(_0x7597('0x1'));var path=require(_0x7597('0x2'));var timeout=require('connect-timeout');var express=require(_0x7597('0x3'));var router=express[_0x7597('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7597('0x5'));var config=require('../../config/environment');var controller=require(_0x7597('0x6'));router['get']('/',auth[_0x7597('0x7')](),controller[_0x7597('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7597('0x9')]);router[_0x7597('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x7597('0xb')]);router['get']('/:id/messages',auth[_0x7597('0x7')](),controller[_0x7597('0xc')]);router[_0x7597('0xa')](_0x7597('0xd'),auth[_0x7597('0x7')](),controller['download']);router[_0x7597('0xe')]('/',auth[_0x7597('0x7')](),controller[_0x7597('0xf')]);router[_0x7597('0xe')](_0x7597('0x10'),auth['isAuthenticated'](),controller['addMessage']);router[_0x7597('0xe')](_0x7597('0x11'),auth[_0x7597('0x7')](),interaction[_0x7597('0x12')]('whatsapp',_0x7597('0x13')),controller[_0x7597('0x14')]);router[_0x7597('0x15')]('/:id',auth['isAuthenticated'](),interaction[_0x7597('0x12')](_0x7597('0x16'),'whatsappinteraction:update'),controller[_0x7597('0x17')]);router[_0x7597('0x18')](_0x7597('0x19'),auth[_0x7597('0x7')](),interaction[_0x7597('0x12')](_0x7597('0x16'),_0x7597('0x1a')),controller[_0x7597('0x1b')]);router[_0x7597('0x18')](_0x7597('0x11'),auth['isAuthenticated'](),controller[_0x7597('0x1c')]);module[_0x7597('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 7e8e9c1..03fe665 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.attributes.js +++ b/server/api/whatsappInteraction/whatsappInteraction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc649=['out','sequelize','STRING','DATE','ENUM'];(function(_0x645963,_0x29be3b){var _0x2a8cff=function(_0x42d7ac){while(--_0x42d7ac){_0x645963['push'](_0x645963['shift']());}};_0x2a8cff(++_0x29be3b);}(_0xc649,0x19b));var _0x9c64=function(_0x39f98c,_0x5638ad){_0x39f98c=_0x39f98c-0x0;var _0x5bdc39=_0xc649[_0x39f98c];return _0x5bdc39;};'use strict';var Sequelize=require(_0x9c64('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x9c64('0x1')]},'note':{'type':Sequelize[_0x9c64('0x1')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x9c64('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x9c64('0x3')]('in',_0x9c64('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9c64('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x9c64('0x3')]('in',_0x9c64('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xc3f4=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0xc3f4,0x9e));var _0x4c3f=function(_0x5d1ebc,_0x59f486){_0x5d1ebc=_0x5d1ebc-0x0;var _0x2b1741=_0xc3f4[_0x5d1ebc];return _0x2b1741;};'use strict';var Sequelize=require(_0x4c3f('0x0'));var moment=require(_0x4c3f('0x1'));module[_0x4c3f('0x2')]={'closed':{'type':Sequelize[_0x4c3f('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4c3f('0x4')]},'disposition':{'type':Sequelize[_0x4c3f('0x5')]},'note':{'type':Sequelize[_0x4c3f('0x5')]},'phone':{'type':Sequelize[_0x4c3f('0x5')]},'read1stAt':{'type':Sequelize[_0x4c3f('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4c3f('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x4c3f('0x6')]('in',_0x4c3f('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 92e9459..74aeb8e 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.controller.js +++ b/server/api/whatsappInteraction/whatsappInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','push','catch','WhatsappInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','length','getFullTextValue','ContactId','buildExpression','type','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','i.phone\x20LIKE\x20?','group','QueryTypes','SELECT','clone','order','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','include','merge','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','omit','emit','whatsappInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','createdAt','secret','WhatsappAccount','Account','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','format','%s\x20#%d','Whatsapp','YYYY-MM-DD','Owner','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','downloadInteraction.html','transcript-','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus'];(function(_0x1be694,_0x1e0d10){var _0x256fb9=function(_0x2efdbc){while(--_0x2efdbc){_0x1be694['push'](_0x1be694['shift']());}};_0x256fb9(++_0x1e0d10);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc4aa[_0x3ab51d];return _0x29a04e;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];config[_0xac4a('0x16')]=_[_0xac4a('0x17')](config['redis'],{'host':_0xac4a('0x18'),'port':0x18eb});var socket=require(_0xac4a('0x19'))(new Redis(config[_0xac4a('0x16')]));require(_0xac4a('0x1a'))[_0xac4a('0x1b')](socket);function respondWithStatusCode(_0x3b71c0,_0x34bc01){_0x34bc01=_0x34bc01||0xcc;return function(_0x33c287){if(_0x33c287){return _0x3b71c0[_0xac4a('0x1c')](_0x34bc01);}return _0x3b71c0[_0xac4a('0x1d')](_0x34bc01)[_0xac4a('0x1e')]();};}function respondWithResult(_0x26dbb8,_0x4a2119){_0x4a2119=_0x4a2119||0xc8;return function(_0x402fff){if(_0x402fff){return _0x26dbb8[_0xac4a('0x1d')](_0x4a2119)[_0xac4a('0x1f')](_0x402fff);}};}function respondWithFilteredResult(_0x144553,_0x3e88e3){return function(_0x387a54){if(_0x387a54){var _0x28e304=_0x387a54[_0xac4a('0x20')],_0x44ec59=_0x3e88e3[_0xac4a('0x21')],_0x546c5d=_0x3e88e3[_0xac4a('0x21')]+_0x3e88e3['limit'],_0x5ac21e;if(_0x546c5d>=_0x28e304){_0x546c5d=_0x28e304;_0x5ac21e=0xc8;}else{_0x5ac21e=0xce;}_0x144553[_0xac4a('0x1d')](_0x5ac21e);return _0x144553[_0xac4a('0x22')](_0xac4a('0x23'),_0x44ec59+'-'+_0x546c5d+'/'+_0x28e304)[_0xac4a('0x1f')](_0x387a54);}return null;};}function patchUpdates(_0x123694){return function(_0x3e829c){try{jsonpatch[_0xac4a('0x24')](_0x3e829c,_0x123694,!![]);}catch(_0x3ca790){return BPromise['reject'](_0x3ca790);}return _0x3e829c[_0xac4a('0x25')]();};}function saveUpdates(_0x3204ad,_0x599787){return function(_0x3d7ce0){if(_0x3d7ce0){return _0x3d7ce0[_0xac4a('0x26')](_0x3204ad)[_0xac4a('0x27')](function(_0x947d8e){return _0x947d8e;});}return null;};}function removeEntity(_0x4d2d6c,_0x1b7998){return function(_0x2503d8){if(_0x2503d8){return _0x2503d8[_0xac4a('0x28')]()[_0xac4a('0x27')](function(){_0x4d2d6c[_0xac4a('0x1d')](0xcc)[_0xac4a('0x1e')]();});}};}function handleEntityNotFound(_0x222507,_0x36054a){return function(_0x3e2c69){if(!_0x3e2c69){_0x222507[_0xac4a('0x1c')](0x194);}return _0x3e2c69;};}function handleError(_0x1d0539,_0x215a31){_0x215a31=_0x215a31||0x1f4;return function(_0x14832b){logger[_0xac4a('0x29')](_0x14832b[_0xac4a('0x2a')]);if(_0x14832b[_0xac4a('0x2b')]){delete _0x14832b['name'];}_0x1d0539[_0xac4a('0x1d')](_0x215a31)[_0xac4a('0x2c')](_0x14832b);};}function getInteractionUsers(_0x42a33c,_0x2772fe){return new BPromise(function(_0x116700,_0x4a5a9e){try{if(_0x2772fe[_0x42a33c['id']]){_0x42a33c['Users']=_[_0xac4a('0x2d')](_0x2772fe[_0x42a33c['id']],function(_0x7a948b){return{'id':_0x7a948b['id'],'fullname':_0x7a948b[_0xac4a('0x2e')]};});}}catch(_0x546b65){_0x4a5a9e(_0x546b65);}_0x116700(_0x42a33c);});}function getInteractionTags(_0x4bda1f,_0x355755){return new BPromise(function(_0x2896bc,_0x228629){try{if(_0x4bda1f[_0xac4a('0x2f')]){_0x4bda1f[_0xac4a('0x30')]=[];_0x4bda1f['TagIds'][_0xac4a('0x31')](',')['forEach'](function(_0x30364b){_0x4bda1f['Tags'][_0xac4a('0x32')](_0x355755[_0x30364b]);});}delete _0x4bda1f[_0xac4a('0x2f')];}catch(_0x31501b){_0x228629(_0x31501b);}_0x2896bc(_0x4bda1f);});}function updateWhatsappInteraction(_0x228aa7,_0x34577f,_0x61e552){return new BPromise(function(_0xbd4591,_0x1f13f3){return getInteractionUsers(_0x228aa7,_0x61e552)[_0xac4a('0x27')](function(_0xfd7c16){return getInteractionTags(_0xfd7c16,_0x34577f);})[_0xac4a('0x27')](function(_0x1634df){_0xbd4591(_0x1634df);})[_0xac4a('0x33')](function(_0x1a9d4e){_0x1f13f3(_0x1a9d4e);});});}exports['index']=function(_0x30442d,_0x1c41fb){var _0x5a4e2b={},_0x2a5419={},_0x1af1c1={'count':0x0,'rows':[]};var _0x565164=_['map'](db[_0xac4a('0x34')][_0xac4a('0x35')],function(_0x1b42b6){return{'name':_0x1b42b6[_0xac4a('0x36')],'type':_0x1b42b6['type'][_0xac4a('0x37')]};});_0x2a5419[_0xac4a('0x38')]=_['map'](_0x565164,_0xac4a('0x2b'));_0x2a5419[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x30442d['query']);_0x2a5419[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x2a5419[_0xac4a('0x38')],_0x2a5419['query']);_0x5a4e2b[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x2a5419['model'],qs['fields'](_0x30442d[_0xac4a('0x39')]['fields']));_0x5a4e2b['attributes']=_0x5a4e2b['attributes']['length']?_0x5a4e2b[_0xac4a('0x3d')]:_0x2a5419[_0xac4a('0x38')];if(!_0x30442d[_0xac4a('0x39')][_0xac4a('0x3e')](_0xac4a('0x3f'))){_0x5a4e2b[_0xac4a('0x40')]=qs[_0xac4a('0x40')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x40')]);_0x5a4e2b[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x30442d[_0xac4a('0x39')]['offset']);}_0x5a4e2b['order']=qs['sort'](_0x30442d[_0xac4a('0x39')][_0xac4a('0x41')]);_0x5a4e2b[_0xac4a('0x42')]=qs[_0xac4a('0x3b')](_[_0xac4a('0x43')](_0x30442d[_0xac4a('0x39')],_0x2a5419[_0xac4a('0x3b')]),_0x565164);var _0x3441f2=[];var _0x3e9973=squel[_0xac4a('0x44')]()['field']('id')[_0xac4a('0x45')](_0xac4a('0x2b'))[_0xac4a('0x45')](_0xac4a('0x46'))[_0xac4a('0x47')]('tools_tags');var _0x8700b4=squel[_0xac4a('0x44')]()['field'](_0xac4a('0x48'))['field'](_0xac4a('0x49'))[_0xac4a('0x45')](_0xac4a('0x4a'))[_0xac4a('0x47')](_0xac4a('0x4b'),'ui')[_0xac4a('0x4c')](_0xac4a('0x4d'),'u',_0xac4a('0x4e'));var _0x98e0c4=squel[_0xac4a('0x44')]()[_0xac4a('0x47')](_0xac4a('0x4f'),'i')['left_join'](_0xac4a('0x50'),'c',_0xac4a('0x51'))[_0xac4a('0x4c')]('users','o',_0xac4a('0x52'))[_0xac4a('0x4c')]('whatsapp_accounts','a',_0xac4a('0x53'))['left_join'](_0xac4a('0x54'),'me',_0xac4a('0x55'))[_0xac4a('0x4c')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xac4a('0x4c')]('tools_tags','t',_0xac4a('0x56'));var _0x566258=squel[_0xac4a('0x57')]();var _0x530bbb=[];var _0x3be103=squel[_0xac4a('0x57')]();var _0x424f9b;if(_0x30442d[_0xac4a('0x39')]['search']){_0x424f9b=as[_0xac4a('0x58')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x59')]);var _0x1ee454=_0x424f9b[_0xac4a('0x5a')];for(var _0x138876=0x0;_0x138876<_0x424f9b[_0xac4a('0x5b')]['length'];_0x138876++){var _0x35dee5=_0x424f9b[_0xac4a('0x5b')][_0x138876];var _0x4828e3='i';var _0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0x35dee5[_0xac4a('0x45')]]);if(!_0x16afbe){switch(_0x35dee5['field']){case _0xac4a('0x5d'):if(_0x35dee5[_0xac4a('0x5e')]==0x1){_0x98e0c4[_0xac4a('0x5f')]('`'+_0x35dee5[_0xac4a('0x45')]+_0xac4a('0x60'));}else{_0x98e0c4['having']('`'+_0x35dee5[_0xac4a('0x45')]+'`\x20>\x200');}break;case _0xac4a('0x61'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){if(_0x35dee5['value'][_0xac4a('0x31')]('\x20')[_0xac4a('0x63')]>0x1){_0x566258[_0x1ee454]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x35dee5[_0xac4a('0x5e')]),null);}else{var _0x26b582='%'+_0x35dee5[_0xac4a('0x5e')]+'%';_0x566258[_0x1ee454]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x26b582,_0x26b582,_0x26b582);}}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0xac4a('0x65')]);_0x35dee5[_0xac4a('0x45')]=_0xac4a('0x65');_0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c['text'],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x69'):var _0x2ac1e9=_0x35dee5[_0xac4a('0x5e')][_0xac4a('0x31')](',')[_0xac4a('0x2d')](function(_0x786d9){return Number(_0x786d9);});_0x2ac1e9[_0xac4a('0x6a')](function(_0x38dd4f){_0x3be103['or'](_0xac4a('0x6b'),'%,'+_0x38dd4f+',%');});_0x530bbb=_[_0xac4a('0x6c')](_0x530bbb,_0x2ac1e9);break;case _0xac4a('0x6d'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){_0x566258[_0x1ee454](_0xac4a('0x6e'),'%'+_0x35dee5['value']+'%',null);}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,['name',_0xac4a('0x6f')]);_0x35dee5['field']=_0xac4a('0x6f');_0x19ce2c=as['buildExpression'](_0x4828e3,_0x16afbe['type'],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x71'):_0x19ce2c=as['buildExpression']('me',null,_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c['value'][_0xac4a('0x68')],_0x19ce2c['value'][_0xac4a('0x1e')]);break;}}else{var _0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}}}else{var _0x430dd0=_(_0x30442d[_0xac4a('0x39')])[_0xac4a('0x3a')]()[_0xac4a('0x2d')](function(_0x2cc410){return _[_0xac4a('0x72')](_0x565164,[_0xac4a('0x2b'),_0x2cc410])?_0x2cc410:undefined;})[_0xac4a('0x73')]()['value']();if(!_[_0xac4a('0x74')](_0x430dd0)){_0x430dd0[_0xac4a('0x6a')](function(_0x4fb812){if(_0x4fb812===_0xac4a('0x75')){_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),[][_0xac4a('0x77')](_0x30442d[_0xac4a('0x39')][_0x4fb812]));}else if(_0x4fb812==='createdAt'){var _0x47c6d8=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x79')];var _0x148288=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x7a')];_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x7b'),_0x47c6d8,_0x148288);}else{if(_0x30442d[_0xac4a('0x39')][_0x4fb812]===_0xac4a('0x7c')){_0x98e0c4['where']('i.'+_0x4fb812+'\x20IS\x20NULL');}else{_0x98e0c4[_0xac4a('0x42')]('i.'+_0x4fb812+_0xac4a('0x7d'),_0x30442d[_0xac4a('0x39')][_0x4fb812]);}}});}if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]==0x1){_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x7f'));}else{_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x80'));}}if(_0x30442d[_0xac4a('0x39')]['tag']){_0x530bbb=_[_0xac4a('0x81')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x82')])?_0x30442d[_0xac4a('0x39')]['tag']:new Array(_0x30442d[_0xac4a('0x39')]['tag']);_0x530bbb[_0xac4a('0x6a')](function(_0x3af39a){_0x3be103['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3af39a+',%');});}if(_0x30442d['query'][_0xac4a('0x83')]){var _0x3b8974=_0x30442d[_0xac4a('0x39')]['filter'][_0xac4a('0x84')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xac4a('0x85'));if(qs['isNumeric'](_0x3b8974)){_0x566258['or']('i.id\x20LIKE\x20?',_0x3b8974+'%')['or'](_0xac4a('0x86'),_0x3b8974+'%');}else{_0x566258['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x3b8974))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3b8974+'%');}}}_0x98e0c4[_0xac4a('0x42')](_0x566258);_0x98e0c4[_0xac4a('0x87')]('i.id');var _0x3980ae={'type':db['Sequelize'][_0xac4a('0x88')][_0xac4a('0x89')],'raw':!![]};var _0x522949=_0x98e0c4[_0xac4a('0x8a')]();_0x522949['field']('i.id');_0x522949[_0xac4a('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xac4a('0x5d'));if(_0x5a4e2b['order']){_0x5a4e2b['order'][_0xac4a('0x6a')](function(_0x4065c0){_0x98e0c4[_0xac4a('0x8b')]('i.'+_0x4065c0[0x0],_0x4065c0[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x530bbb)){_0x98e0c4[_0xac4a('0x5f')](_0x3be103);_0x522949[_0xac4a('0x42')]('t.id\x20IN\x20?',_0x530bbb);}BPromise['resolve']()[_0xac4a('0x27')](function(){if(!_0x424f9b){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x75')]||_0x30442d[_0xac4a('0x39')][_0xac4a('0x8c')])return;_0x522949[_0xac4a('0x42')](_0xac4a('0x8d'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8d'));return;}return _0x30442d['user'][_0xac4a('0x8e')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x27')](function(_0x3ba61e){if(_['isEmpty'](_0x3ba61e)){_0x522949[_0xac4a('0x42')](_0xac4a('0x8f'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8f'));}else{_0x522949[_0xac4a('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0xac4a('0x2d')](_0x3ba61e,'id'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),_[_0xac4a('0x2d')](_0x3ba61e,'id'));}});})[_0xac4a('0x27')](function(){db[_0xac4a('0x90')][_0xac4a('0x39')](_0x522949['toString'](),_0x3980ae)[_0xac4a('0x27')](function(_0x2be178){_0x1af1c1[_0xac4a('0x20')]=_0x2be178[_0xac4a('0x63')];if(_0x1af1c1[_0xac4a('0x20')]===0x0)return[];return db[_0xac4a('0x90')]['query'](_0x3e9973[_0xac4a('0x91')](),_0x3980ae)[_0xac4a('0x27')](function(_0x1b9a33){_0x3441f2=_[_0xac4a('0x92')](_0x1b9a33,'id');_0x3980ae=_['merge'](_0x3980ae,{'model':db[_0xac4a('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x30442d['query'][_0xac4a('0x93')]){_0x5a4e2b[_0xac4a('0x3d')]['forEach'](function(_0x5b95ab){_0x98e0c4[_0xac4a('0x45')]('i.'+_0x5b95ab);});}else{_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x94'),'unreadMessages');_0x98e0c4[_0xac4a('0x45')]('a.key',_0xac4a('0x95'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x96'),_0xac4a('0x97'));_0x98e0c4[_0xac4a('0x45')]('i.*');_0x98e0c4['field'](_0xac4a('0x98'),_0xac4a('0x99'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9a'),_0xac4a('0x9b'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9c'),_0xac4a('0x9d'));_0x98e0c4['field']('c.phone',_0xac4a('0x9e'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9f'),_0xac4a('0xa0'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa1'),_0xac4a('0xa2'));_0x98e0c4[_0xac4a('0x45')]('o.fullname','Owner.fullname');_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa3'),_0xac4a('0xa4'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa5'),_0xac4a('0x2f'));}if(_0x5a4e2b[_0xac4a('0x40')])_0x98e0c4['limit'](_0x5a4e2b[_0xac4a('0x40')]);if(_0x5a4e2b[_0xac4a('0x21')])_0x98e0c4[_0xac4a('0x21')](_0x5a4e2b['offset']);return db[_0xac4a('0x90')][_0xac4a('0x39')](_0x98e0c4[_0xac4a('0x91')](),_0x3980ae);})[_0xac4a('0x27')](function(_0x1a7448){_0x8700b4[_0xac4a('0x42')](_0xac4a('0xa6'),_[_0xac4a('0x2d')](_0x1a7448,'id'));return db[_0xac4a('0x90')]['query'](_0x8700b4[_0xac4a('0x91')](),_0x3980ae)['then'](function(_0x203321){var _0x1199f6=_[_0xac4a('0xa7')](_0x203321,_0xac4a('0xa8'));var _0x840fec=[];_0x1a7448[_0xac4a('0x6a')](function(_0x19766a){_0x840fec['push'](updateWhatsappInteraction(_0x19766a,_0x3441f2,_0x1199f6));});return BPromise[_0xac4a('0xa9')](_0x840fec);});});})[_0xac4a('0x27')](function(_0x279f9b){_0x1af1c1[_0xac4a('0xaa')]=_0x279f9b;return _0x1af1c1;})[_0xac4a('0x27')](respondWithFilteredResult(_0x1c41fb,_0x5a4e2b));})['catch'](handleError(_0x1c41fb,null));};exports[_0xac4a('0xab')]=function(_0x360d4f,_0x4f2b19){var _0x55af32={'raw':![],'where':{'id':_0x360d4f[_0xac4a('0xac')]['id']}},_0x386d6d={};_0x386d6d['model']=_[_0xac4a('0x3a')](db[_0xac4a('0x34')][_0xac4a('0x35')]);_0x386d6d[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x360d4f[_0xac4a('0x39')]);_0x386d6d['filters']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],_0x386d6d[_0xac4a('0x39')]);_0x55af32['attributes']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],qs[_0xac4a('0x93')](_0x360d4f[_0xac4a('0x39')][_0xac4a('0x93')]));_0x55af32[_0xac4a('0x3d')]=_0x55af32['attributes'][_0xac4a('0x63')]?_0x55af32[_0xac4a('0x3d')]:_0x386d6d['model'];if(_0x360d4f[_0xac4a('0x39')]['includeAll']){_0x55af32[_0xac4a('0xad')]=[{'all':!![]}];}_0x55af32=_[_0xac4a('0xae')]({},_0x55af32,_0x360d4f['options']);return db[_0xac4a('0x34')]['find'](_0x55af32)[_0xac4a('0x27')](handleEntityNotFound(_0x4f2b19,null))['then'](respondWithResult(_0x4f2b19,null))[_0xac4a('0x33')](handleError(_0x4f2b19,null));};exports[_0xac4a('0xaf')]=function(_0x24f464,_0xfe8977){return db[_0xac4a('0x34')][_0xac4a('0xaf')](_0x24f464[_0xac4a('0x71')],{})[_0xac4a('0x27')](respondWithResult(_0xfe8977,0xc9))[_0xac4a('0x33')](handleError(_0xfe8977,null));};exports[_0xac4a('0x26')]=function(_0x3a0163,_0x455eb7){if(_0x3a0163[_0xac4a('0x71')]['id']){delete _0x3a0163[_0xac4a('0x71')]['id'];}return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x3a0163[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x455eb7,null))[_0xac4a('0x27')](saveUpdates(_0x3a0163[_0xac4a('0x71')],null))[_0xac4a('0x27')](respondWithResult(_0x455eb7,null))[_0xac4a('0x33')](handleError(_0x455eb7,null));};exports[_0xac4a('0x28')]=function(_0x5d5bb3,_0x101137){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x5d5bb3[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x101137,null))[_0xac4a('0x27')](removeEntity(_0x101137,null))['catch'](handleError(_0x101137,null));};exports[_0xac4a('0xb0')]=function(_0x55866d,_0x277fd1){return db[_0xac4a('0x34')][_0xac4a('0xb0')]()['then'](respondWithResult(_0x277fd1,null))[_0xac4a('0x33')](handleError(_0x277fd1,null));};exports[_0xac4a('0xb1')]=function(_0x127ede,_0x52f3f2,_0x2da95f){return db[_0xac4a('0xb2')][_0xac4a('0x5c')]({'where':{'id':_0x127ede[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x52f3f2,null))[_0xac4a('0x27')](function(_0x3b4183){if(_0x3b4183){return _0x3b4183[_0xac4a('0xb1')](_0x127ede['body'][_0xac4a('0xb3')],_['omit'](_0x127ede['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x52f3f2,null))['catch'](handleError(_0x52f3f2,null));};exports[_0xac4a('0xb4')]=function(_0x58fcb0,_0xc014a6,_0x377444){var _0x2132b2={'raw':![],'where':{}};var _0x525d50={};var _0x9ea4d1={'count':0x0,'rows':[]};return db[_0xac4a('0x34')][_0xac4a('0xb5')]({'where':{'id':_0x58fcb0[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0xc014a6,null))[_0xac4a('0x27')](function(_0x7a1b25){if(_0x7a1b25){_0x525d50[_0xac4a('0x38')]=_['keys'](db[_0xac4a('0xb2')][_0xac4a('0x35')]);_0x525d50[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x58fcb0[_0xac4a('0x39')]);_0x525d50[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x525d50['model'],_0x525d50['query']);_0x2132b2[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x525d50['model'],qs[_0xac4a('0x93')](_0x58fcb0[_0xac4a('0x39')]['fields']));_0x2132b2['attributes']=_0x2132b2[_0xac4a('0x3d')][_0xac4a('0x63')]?_0x2132b2[_0xac4a('0x3d')]:_0x525d50[_0xac4a('0x38')];if(!_0x58fcb0[_0xac4a('0x39')]['hasOwnProperty'](_0xac4a('0x3f'))){_0x2132b2['limit']=qs['limit'](_0x58fcb0['query'][_0xac4a('0x40')]);_0x2132b2[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x21')]);}_0x2132b2[_0xac4a('0x8b')]=qs[_0xac4a('0x41')](_0x58fcb0[_0xac4a('0x39')]['sort']);_0x2132b2['where']=qs['filters'](_[_0xac4a('0x43')](_0x58fcb0[_0xac4a('0x39')],_0x525d50[_0xac4a('0x3b')]));_0x2132b2[_0xac4a('0x42')][_0xac4a('0xa8')]=_0x7a1b25['id'];if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]){_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],{'$or':_[_0xac4a('0x2d')](_0x2132b2[_0xac4a('0x3d')],function(_0xe0fd57){var _0x32b013={};_0x32b013[_0xe0fd57]={'$like':'%'+_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]+'%'};return _0x32b013;})});}if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')]){var _0x41cdb5=_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')][_0xac4a('0x31')](',');var _0x3e2575={};_0x3e2575[_0x41cdb5[0x0]]={'$gte':moment(_0x41cdb5[0x1])['format'](_0xac4a('0xb6'))};_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],_0x3e2575);}_0x2132b2=_[_0xac4a('0xae')]({},_0x2132b2,_0x58fcb0[_0xac4a('0xb7')]);return db[_0xac4a('0xb2')][_0xac4a('0x20')]({'where':_0x2132b2['where']})['then'](function(_0x113f80){_0x9ea4d1[_0xac4a('0x20')]=_0x113f80;if(_0x58fcb0[_0xac4a('0x39')]['includeAll']){_0x2132b2['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xac4a('0xb8')](_0x2132b2);})['then'](function(_0x59e82c){_0x9ea4d1[_0xac4a('0xaa')]=_0x59e82c;return _0x9ea4d1;});}})['then'](respondWithFilteredResult(_0xc014a6,_0x2132b2))[_0xac4a('0x33')](handleError(_0xc014a6,null));};exports['addTags']=function(_0x3f95a4,_0x2b4f28,_0x413f5f){return db[_0xac4a('0x34')][_0xac4a('0x5c')]({'where':{'id':_0x3f95a4[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x2b4f28,null))[_0xac4a('0x27')](function(_0x34b6d7){if(_0x34b6d7){return _0x34b6d7[_0xac4a('0xb9')](_0x3f95a4['body'][_0xac4a('0xb3')],_[_0xac4a('0xba')](_0x3f95a4[_0xac4a('0x71')],[_0xac4a('0xb3'),'id'])||{})['spread'](function(){return db[_0xac4a('0x69')][_0xac4a('0xb8')]({'attributes':['id',_0xac4a('0x2b'),_0xac4a('0x46')],'where':{'id':_0x3f95a4[_0xac4a('0x71')][_0xac4a('0xb3')]}});})['then'](function(_0x57d3cd){socket[_0xac4a('0xbb')](_0xac4a('0xbc'),{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]});return{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]};});}})[_0xac4a('0x27')](respondWithResult(_0x2b4f28,null))[_0xac4a('0x33')](handleError(_0x2b4f28,null));};exports['removeTags']=function(_0x21a6f6,_0x580c9b,_0xe4165d){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x21a6f6[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x580c9b,null))[_0xac4a('0x27')](function(_0x5650ce){if(_0x5650ce){return _0x5650ce[_0xac4a('0xbd')](_0x21a6f6[_0xac4a('0x39')][_0xac4a('0xb3')]);}})[_0xac4a('0x27')](respondWithStatusCode(_0x580c9b,null))[_0xac4a('0x33')](handleError(_0x580c9b,null));};exports['download']=function(_0x3dd60a,_0xbe1958){var _0x462964=moment()[_0xac4a('0xbe')]()[_0xac4a('0x91')]();var _0x5e5eb1=path[_0xac4a('0xbf')](config[_0xac4a('0xc0')],_0xac4a('0xc1'),_0xac4a('0xc2'),_0xac4a('0xc3'));var _0x55ccc3=path['join'](config['root'],'server',_0xac4a('0xc2'),_0xac4a('0xc4'));var _0x17f815=path[_0xac4a('0xbf')](_0x5e5eb1,_0x462964);var _0xa8b5bb=util['format'](_0xac4a('0xc5'),_0x3dd60a[_0xac4a('0xac')]['id'],_0x462964);var _0x5aad90=path[_0xac4a('0xbf')](_0x5e5eb1,_0xa8b5bb);var _0x14b425=[];_0x14b425[_0xac4a('0x32')]({'model':db['User'],'as':_0xac4a('0x6d'),'attributes':['id',_0xac4a('0x2e')],'raw':!![]});_0x14b425[_0xac4a('0x32')]({'model':db[_0xac4a('0xc6')],'as':_0xac4a('0x61'),'attributes':['id',_0xac4a('0xc7'),_0xac4a('0xc8')],'raw':!![]});if(_0x3dd60a[_0xac4a('0x39')][_0xac4a('0xc4')]){_0x14b425['push']({'model':db[_0xac4a('0xc9')],'as':_0xac4a('0xc9'),'raw':!![]});}var _0x579181=[{'model':db[_0xac4a('0xb2')],'as':'Messages','attributes':['id',_0xac4a('0x71'),_0xac4a('0xca'),'direction',_0xac4a('0xcb'),_0xac4a('0x7e')],'include':_0x14b425}];_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0xcc')],'as':_0xac4a('0xcd'),'attributes':['id',_0xac4a('0x2b')]});_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0x6d')],'as':'Owner','attributes':['id','fullname']});return db[_0xac4a('0x34')]['find']({'where':{'id':_0x3dd60a['params']['id']},'include':_0x579181})[_0xac4a('0x27')](handleEntityNotFound(_0xbe1958,null))[_0xac4a('0x27')](function(_0x3254c3){if(_0x3254c3){var _0x516225=_0x3254c3[_0xac4a('0xce')]({'plain':!![]});fs[_0xac4a('0xcf')](_0x17f815);var _0x5a2abf={'format':'A4','border':'10px','header':{'height':_0xac4a('0xd0'),'contents':{'first':_0xac4a('0xd1')}},'footer':{'height':_0xac4a('0xd2'),'contents':{'default':util[_0xac4a('0xd3')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xac4a('0xd3')](_0xac4a('0xd4'),_0xac4a('0xd5'),_0x516225['id']),moment()['format'](_0xac4a('0xd6'))[_0xac4a('0x91')]())}}};var _0x15b97a={'channel':_0xac4a('0xd5'),'account':_0x516225[_0xac4a('0xcd')]['name'],'agent':_0x516225['Owner']?_0x516225[_0xac4a('0xd7')][_0xac4a('0x2e')]:_0xac4a('0xd8'),'createdAt':moment(_0x516225[_0xac4a('0xca')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')](),'closedAt':_0x516225[_0xac4a('0xd9')]?moment(_0x516225[_0xac4a('0xda')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')]():'','disposition':_0x516225[_0xac4a('0xdb')],'messages':_(_0x516225['Messages'])[_0xac4a('0x83')]({'secret':![]})['map'](function(_0x4ec2c3){if(_0x4ec2c3[_0xac4a('0xc9')]){var _0x27833a=path[_0xac4a('0xbf')](_0x55ccc3,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]);if(fs[_0xac4a('0xdd')](_0x27833a)){fs[_0xac4a('0xde')](_0x27833a)[_0xac4a('0xdf')](fs[_0xac4a('0xe0')](path['join'](_0x17f815,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')])));}}return{'date':moment(_0x4ec2c3[_0xac4a('0xca')])[_0xac4a('0xd3')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x4ec2c3[_0xac4a('0xe1')]===_0xac4a('0xe2')?_0x4ec2c3[_0xac4a('0x6d')]?_0x4ec2c3[_0xac4a('0x6d')][_0xac4a('0x2e')]:_0xac4a('0xe3'):_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc7')]+(_0x4ec2c3[_0xac4a('0x61')]['lastName']?'\x20'+_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc8')]:''),'body':_0x4ec2c3[_0xac4a('0xc9')]?_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]:_0x4ec2c3[_0xac4a('0x71')],'direction':_0x4ec2c3['direction']==='out'?'A':'C','secret':_0x4ec2c3['secret'],'read':_0x4ec2c3[_0xac4a('0x7e')],'attachment':_0x4ec2c3[_0xac4a('0xc9')]};})['value']()};return ejs['renderFile'](path[_0xac4a('0xbf')](config['root'],_0xac4a('0xc1'),'views',_0xac4a('0xe4')),{'interaction':_0x15b97a})[_0xac4a('0x27')](function(_0x1888c3){return new BPromise(function(_0x4a04c3,_0x14435d){pdf[_0xac4a('0xaf')](_0x1888c3,_0x5a2abf)['toFile'](path[_0xac4a('0xbf')](_0x17f815,_0xac4a('0xe5')+_0x516225['id']+'-'+_0x462964+'.pdf'),function(_0x48a75c,_0x4514a5){if(_0x48a75c)return _0x14435d(_0x48a75c);_0x4a04c3(_0x4514a5);});});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x43df37,_0x45e45b){zipdir(_0x17f815,{'saveTo':_0x5aad90},function(_0x367254,_0x22cc71){if(_0x367254)return _0x45e45b(_0x367254);return _0x43df37(_0x22cc71);});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x1ea4ef,_0x156b67){rimraf(_0x17f815,function(_0x330070){if(_0x330070)_0x156b67(_0x330070);return _0x1ea4ef();});});})[_0xac4a('0x27')](function(){return _0xbe1958[_0xac4a('0xe6')](_0x5aad90,_0xa8b5bb,function(_0x2d755c){if(_0x2d755c){console[_0xac4a('0xe7')](_0xac4a('0xe8'),_0x2d755c);}else{fs[_0xac4a('0xe9')](_0x5aad90);}});});});}else{return _0xbe1958[_0xac4a('0x1c')](0xc8);}})['catch'](handleError(_0xbe1958,null));}; \ No newline at end of file +var _0x7a54=['attachments','Attachment','direction','secret','WhatsappAccount','Account','Owner','mkdirSync','30px','%s\x20#%d','Whatsapp','YYYY-MM-DD','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','System','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','select','color','tools_tags','u.id','field','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','whatsapp_messages','whatsapp_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','UserId','buildExpression','start','body','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','$gte','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','forEach','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','rows','show','params','includeAll','include','WhatsappInteraction','create','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','format','options','findAll','emit','removeTags','unix','root','files','tmp','server','join','transcript-%d-%s.zip','User','firstName','lastName'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x7a54,0x106));var _0x47a5=function(_0x24289b,_0x2e8d17){_0x24289b=_0x24289b-0x0;var _0x158e8d=_0x7a54[_0x24289b];return _0x158e8d;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];config[_0x47a5('0x15')]=_[_0x47a5('0x16')](config[_0x47a5('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0x17'))(new Redis(config[_0x47a5('0x15')]));require(_0x47a5('0x18'))[_0x47a5('0x19')](socket);function respondWithStatusCode(_0x139f25,_0x620ee9){_0x620ee9=_0x620ee9||0xcc;return function(_0x3c6c46){if(_0x3c6c46){return _0x139f25[_0x47a5('0x1a')](_0x620ee9);}return _0x139f25['status'](_0x620ee9)[_0x47a5('0x1b')]();};}function respondWithResult(_0x11faf5,_0x3b001e){_0x3b001e=_0x3b001e||0xc8;return function(_0x2a2cbb){if(_0x2a2cbb){return _0x11faf5[_0x47a5('0x1c')](_0x3b001e)['json'](_0x2a2cbb);}};}function respondWithFilteredResult(_0x549de3,_0x138bc0){return function(_0x4b966e){if(_0x4b966e){var _0x5247fd=_0x4b966e[_0x47a5('0x1d')],_0x423a81=_0x138bc0[_0x47a5('0x1e')],_0xaf70a6=_0x138bc0[_0x47a5('0x1e')]+_0x138bc0[_0x47a5('0x1f')],_0x2ce454;if(_0xaf70a6>=_0x5247fd){_0xaf70a6=_0x5247fd;_0x2ce454=0xc8;}else{_0x2ce454=0xce;}_0x549de3[_0x47a5('0x1c')](_0x2ce454);return _0x549de3[_0x47a5('0x20')]('Content-Range',_0x423a81+'-'+_0xaf70a6+'/'+_0x5247fd)[_0x47a5('0x21')](_0x4b966e);}return null;};}function patchUpdates(_0xf160ba){return function(_0x47cf3c){try{jsonpatch[_0x47a5('0x22')](_0x47cf3c,_0xf160ba,!![]);}catch(_0x1f03f7){return BPromise[_0x47a5('0x23')](_0x1f03f7);}return _0x47cf3c['save']();};}function saveUpdates(_0xb8ae6c,_0x2f142b){return function(_0x23db32){if(_0x23db32){return _0x23db32[_0x47a5('0x24')](_0xb8ae6c)['then'](function(_0xe2dea9){return _0xe2dea9;});}return null;};}function removeEntity(_0x385687,_0x513981){return function(_0x28747d){if(_0x28747d){return _0x28747d[_0x47a5('0x25')]()[_0x47a5('0x26')](function(){_0x385687[_0x47a5('0x1c')](0xcc)[_0x47a5('0x1b')]();});}};}function handleEntityNotFound(_0x50bf17,_0x53078a){return function(_0x136745){if(!_0x136745){_0x50bf17['sendStatus'](0x194);}return _0x136745;};}function handleError(_0x1ea9c8,_0x5b6c4e){_0x5b6c4e=_0x5b6c4e||0x1f4;return function(_0x23cb77){logger[_0x47a5('0x27')](_0x23cb77[_0x47a5('0x28')]);if(_0x23cb77[_0x47a5('0x29')]){delete _0x23cb77[_0x47a5('0x29')];}_0x1ea9c8[_0x47a5('0x1c')](_0x5b6c4e)[_0x47a5('0x2a')](_0x23cb77);};}function getInteractionUsers(_0x136b14,_0x16631f){return new BPromise(function(_0x361bfa,_0x1127f8){try{if(_0x16631f[_0x136b14['id']]){_0x136b14[_0x47a5('0x2b')]=_[_0x47a5('0x2c')](_0x16631f[_0x136b14['id']],function(_0x528582){return{'id':_0x528582['id'],'fullname':_0x528582[_0x47a5('0x2d')]};});}}catch(_0x51833b){_0x1127f8(_0x51833b);}_0x361bfa(_0x136b14);});}function getInteractionTags(_0x2ef875,_0x9ac908){return new BPromise(function(_0x16901f,_0x4d6b57){try{if(_0x2ef875[_0x47a5('0x2e')]){_0x2ef875[_0x47a5('0x2f')]=[];_0x2ef875[_0x47a5('0x2e')][_0x47a5('0x30')](',')['forEach'](function(_0x50d875){_0x2ef875[_0x47a5('0x2f')][_0x47a5('0x31')](_0x9ac908[_0x50d875]);});}delete _0x2ef875['TagIds'];}catch(_0x4e1006){_0x4d6b57(_0x4e1006);}_0x16901f(_0x2ef875);});}function updateWhatsappInteraction(_0x836303,_0x51544e,_0x57bff6){return new BPromise(function(_0x42f70c,_0x53119b){return getInteractionUsers(_0x836303,_0x57bff6)[_0x47a5('0x26')](function(_0xd972c){return getInteractionTags(_0xd972c,_0x51544e);})['then'](function(_0x4843c0){_0x42f70c(_0x4843c0);})[_0x47a5('0x32')](function(_0x5910bb){_0x53119b(_0x5910bb);});});}exports[_0x47a5('0x33')]=function(_0x87e4c9,_0xf269a8){var _0x52749b={},_0x18f7e9={},_0x50c086={'count':0x0,'rows':[]};var _0x53c754=_[_0x47a5('0x2c')](db['WhatsappInteraction'][_0x47a5('0x34')],function(_0x5ef577){return{'name':_0x5ef577[_0x47a5('0x35')],'type':_0x5ef577[_0x47a5('0x36')][_0x47a5('0x37')]};});_0x18f7e9[_0x47a5('0x38')]=_[_0x47a5('0x2c')](_0x53c754,_0x47a5('0x29'));_0x18f7e9[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x87e4c9[_0x47a5('0x39')]);_0x18f7e9['filters']=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],_0x18f7e9['query']);_0x52749b[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x18f7e9[_0x47a5('0x38')],qs['fields'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x3d')]));_0x52749b['attributes']=_0x52749b[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x52749b['attributes']:_0x18f7e9['model'];if(!_0x87e4c9['query'][_0x47a5('0x3f')]('nolimit')){_0x52749b[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1f')]);_0x52749b[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x52749b[_0x47a5('0x40')]=qs[_0x47a5('0x41')](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x41')]);_0x52749b[_0x47a5('0x42')]=qs['filters'](_[_0x47a5('0x43')](_0x87e4c9[_0x47a5('0x39')],_0x18f7e9[_0x47a5('0x44')]),_0x53c754);var _0x23bd8d=[];var _0x586f4f=squel[_0x47a5('0x45')]()['field']('id')['field']('name')['field'](_0x47a5('0x46'))['from'](_0x47a5('0x47'));var _0x3a740b=squel[_0x47a5('0x45')]()['field'](_0x47a5('0x48'))[_0x47a5('0x49')]('u.fullname')['field'](_0x47a5('0x4a'))['from'](_0x47a5('0x4b'),'ui')[_0x47a5('0x4c')](_0x47a5('0x4d'),'u',_0x47a5('0x4e'));var _0x34a9ae=squel[_0x47a5('0x45')]()[_0x47a5('0x4f')](_0x47a5('0x50'),'i')[_0x47a5('0x4c')](_0x47a5('0x51'),'c',_0x47a5('0x52'))[_0x47a5('0x4c')](_0x47a5('0x4d'),'o',_0x47a5('0x53'))[_0x47a5('0x4c')](_0x47a5('0x54'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x47a5('0x4c')](_0x47a5('0x55'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x47a5('0x56'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x47a5('0x4c')](_0x47a5('0x47'),'t','t.id\x20=\x20it.TagId');var _0x4f62d3=squel[_0x47a5('0x57')]();var _0x52d409=[];var _0x2d147c=squel[_0x47a5('0x57')]();var _0x3548bc;if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x58')]){_0x3548bc=as[_0x47a5('0x59')](_0x87e4c9[_0x47a5('0x39')]['search']);var _0x48a0ef=_0x3548bc[_0x47a5('0x5a')];for(var _0x411230=0x0;_0x411230<_0x3548bc[_0x47a5('0x5b')][_0x47a5('0x3e')];_0x411230++){var _0x2c7020=_0x3548bc[_0x47a5('0x5b')][_0x411230];var _0x249de5='i';var _0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x2c7020[_0x47a5('0x49')]]);if(!_0x492cf7){switch(_0x2c7020['field']){case _0x47a5('0x5d'):if(_0x2c7020['value']==0x1){_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020[_0x47a5('0x49')]+_0x47a5('0x5f'));}else{_0x34a9ae[_0x47a5('0x5e')]('`'+_0x2c7020['field']+_0x47a5('0x60'));}break;case _0x47a5('0x61'):if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){if(_0x2c7020[_0x47a5('0x64')][_0x47a5('0x30')]('\x20')[_0x47a5('0x3e')]>0x1){_0x4f62d3[_0x48a0ef]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x47a5('0x65')](_0x2c7020[_0x47a5('0x64')]),null);}else{var _0x187d7e='%'+_0x2c7020[_0x47a5('0x64')]+'%';_0x4f62d3[_0x48a0ef](_0x47a5('0x66'),_0x187d7e,_0x187d7e,_0x187d7e);}}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,['name',_0x47a5('0x67')]);_0x2c7020[_0x47a5('0x49')]=_0x47a5('0x67');_0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x69'):var _0x4fa1da=_0x2c7020['value'][_0x47a5('0x30')](',')['map'](function(_0x16bb8a){return Number(_0x16bb8a);});_0x4fa1da['forEach'](function(_0x482de6){_0x2d147c['or'](_0x47a5('0x6a'),'%,'+_0x482de6+',%');});_0x52d409=_[_0x47a5('0x6b')](_0x52d409,_0x4fa1da);break;case'User':if(_0x2c7020[_0x47a5('0x62')]===_0x47a5('0x63')){_0x4f62d3[_0x48a0ef]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2c7020['value']+'%',null);}else{_0x492cf7=_[_0x47a5('0x5c')](_0x53c754,[_0x47a5('0x29'),_0x47a5('0x6c')]);_0x2c7020[_0x47a5('0x49')]='UserId';_0x5cbe97=as[_0x47a5('0x6d')](_0x249de5,_0x492cf7[_0x47a5('0x36')],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97['value'][_0x47a5('0x6e')],_0x5cbe97['value'][_0x47a5('0x1b')]);}break;case _0x47a5('0x6f'):_0x5cbe97=as[_0x47a5('0x6d')]('me',null,_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')]['start'],_0x5cbe97[_0x47a5('0x64')]['end']);break;}}else{var _0x5cbe97=as['buildExpression'](_0x249de5,_0x492cf7['type'],_0x2c7020);_0x4f62d3[_0x48a0ef](_0x5cbe97[_0x47a5('0x68')],_0x5cbe97[_0x47a5('0x64')][_0x47a5('0x6e')],_0x5cbe97['value']['end']);}}}else{var _0x139229=_(_0x87e4c9[_0x47a5('0x39')])[_0x47a5('0x3a')]()[_0x47a5('0x2c')](function(_0xc45e25){return _['some'](_0x53c754,[_0x47a5('0x29'),_0xc45e25])?_0xc45e25:undefined;})['compact']()[_0x47a5('0x64')]();if(!_[_0x47a5('0x70')](_0x139229)){_0x139229['forEach'](function(_0x32b4de){if(_0x32b4de===_0x47a5('0x71')){_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x72'),[][_0x47a5('0x73')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de]));}else if(_0x32b4de===_0x47a5('0x74')){var _0x3ac38c=JSON['parse'](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])[_0x47a5('0x75')];var _0x3c75c6=JSON[_0x47a5('0x76')](_0x87e4c9[_0x47a5('0x39')][_0x32b4de])['$lte'];_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x77'),_0x3ac38c,_0x3c75c6);}else{if(_0x87e4c9[_0x47a5('0x39')][_0x32b4de]===_0x47a5('0x78')){_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x79'));}else{_0x34a9ae[_0x47a5('0x42')]('i.'+_0x32b4de+_0x47a5('0x7a'),_0x87e4c9[_0x47a5('0x39')][_0x32b4de]);}}});}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7b')]==0x1){_0x34a9ae[_0x47a5('0x5e')](_0x47a5('0x7c'));}else{_0x34a9ae['having'](_0x47a5('0x7d'));}}if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]){_0x52d409=_['isArray'](_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')])?_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7e')]:new Array(_0x87e4c9['query'][_0x47a5('0x7e')]);_0x52d409['forEach'](function(_0x2d5ee6){_0x2d147c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2d5ee6+',%');});}if(_0x87e4c9[_0x47a5('0x39')]['filter']){var _0x7c1190=_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x7f')]['replace']('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0x47a5('0x80')](_0x7c1190)){_0x4f62d3['or'](_0x47a5('0x81'),_0x7c1190+'%')['or'](_0x47a5('0x82'),_0x7c1190+'%');}else{_0x4f62d3['or'](_0x47a5('0x83'),qs['getFullTextValue'](_0x7c1190))['or'](_0x47a5('0x84'),_0x7c1190+'%');}}}_0x34a9ae[_0x47a5('0x42')](_0x4f62d3);_0x34a9ae[_0x47a5('0x85')](_0x47a5('0x86'));var _0x308c9a={'type':db[_0x47a5('0x87')][_0x47a5('0x88')][_0x47a5('0x89')],'raw':!![]};var _0x4618a0=_0x34a9ae[_0x47a5('0x8a')]();_0x4618a0[_0x47a5('0x49')](_0x47a5('0x86'));_0x4618a0['field'](_0x47a5('0x8b'),'unreadMessages');if(_0x52749b[_0x47a5('0x40')]){_0x52749b[_0x47a5('0x40')][_0x47a5('0x8c')](function(_0x12fec9){_0x34a9ae[_0x47a5('0x40')]('i.'+_0x12fec9[0x0],_0x12fec9[0x1]===_0x47a5('0x8d')?![]:!![]);});}if(!_[_0x47a5('0x70')](_0x52d409)){_0x34a9ae[_0x47a5('0x5e')](_0x2d147c);_0x4618a0[_0x47a5('0x42')](_0x47a5('0x8e'),_0x52d409);}BPromise[_0x47a5('0x8f')]()[_0x47a5('0x26')](function(){if(!_0x3548bc){if(_0x87e4c9[_0x47a5('0x39')][_0x47a5('0x71')]||_0x87e4c9[_0x47a5('0x39')]['journey'])return;_0x4618a0['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x34a9ae['where'](_0x47a5('0x90'));return;}return _0x87e4c9[_0x47a5('0x91')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x47a5('0x26')](function(_0x44dda2){if(_[_0x47a5('0x70')](_0x44dda2)){_0x4618a0[_0x47a5('0x42')](_0x47a5('0x92'));_0x34a9ae[_0x47a5('0x42')](_0x47a5('0x92'));}else{_0x4618a0[_0x47a5('0x42')](_0x47a5('0x72'),_[_0x47a5('0x2c')](_0x44dda2,'id'));_0x34a9ae[_0x47a5('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0x47a5('0x2c')](_0x44dda2,'id'));}});})[_0x47a5('0x26')](function(){db[_0x47a5('0x93')]['query'](_0x4618a0[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x17b61d){_0x50c086['count']=_0x17b61d[_0x47a5('0x3e')];if(_0x50c086['count']===0x0)return[];return db['sequelize'][_0x47a5('0x39')](_0x586f4f[_0x47a5('0x94')](),_0x308c9a)[_0x47a5('0x26')](function(_0x27333e){_0x23bd8d=_[_0x47a5('0x95')](_0x27333e,'id');_0x308c9a=_[_0x47a5('0x96')](_0x308c9a,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x87e4c9['query'][_0x47a5('0x3d')]){_0x52749b['attributes'][_0x47a5('0x8c')](function(_0x3fffd1){_0x34a9ae[_0x47a5('0x49')]('i.'+_0x3fffd1);});}else{_0x34a9ae[_0x47a5('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x47a5('0x5d'));_0x34a9ae['field']('a.key',_0x47a5('0x97'));_0x34a9ae[_0x47a5('0x49')]('a.mandatoryDisposition',_0x47a5('0x98'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x99'));_0x34a9ae['field'](_0x47a5('0x9a'),'Contact.firstName');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0x9b'),_0x47a5('0x9c'));_0x34a9ae['field'](_0x47a5('0x9d'),_0x47a5('0x9e'));_0x34a9ae[_0x47a5('0x49')]('c.phone',_0x47a5('0x9f'));_0x34a9ae['field'](_0x47a5('0xa0'),'Contact.mobile');_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa1'),_0x47a5('0xa2'));_0x34a9ae[_0x47a5('0x49')]('o.fullname',_0x47a5('0xa3'));_0x34a9ae[_0x47a5('0x49')](_0x47a5('0xa4'),_0x47a5('0xa5'));_0x34a9ae[_0x47a5('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x52749b[_0x47a5('0x1f')])_0x34a9ae['limit'](_0x52749b[_0x47a5('0x1f')]);if(_0x52749b[_0x47a5('0x1e')])_0x34a9ae[_0x47a5('0x1e')](_0x52749b['offset']);return db[_0x47a5('0x93')][_0x47a5('0x39')](_0x34a9ae['toString'](),_0x308c9a);})[_0x47a5('0x26')](function(_0x8a9dea){_0x3a740b[_0x47a5('0x42')](_0x47a5('0xa6'),_['map'](_0x8a9dea,'id'));return db['sequelize'][_0x47a5('0x39')](_0x3a740b[_0x47a5('0x94')](),_0x308c9a)['then'](function(_0x27d422){var _0x23f055=_['groupBy'](_0x27d422,_0x47a5('0xa7'));var _0x2a02cd=[];_0x8a9dea[_0x47a5('0x8c')](function(_0x59f010){_0x2a02cd[_0x47a5('0x31')](updateWhatsappInteraction(_0x59f010,_0x23bd8d,_0x23f055));});return BPromise['all'](_0x2a02cd);});});})[_0x47a5('0x26')](function(_0x5e2946){_0x50c086[_0x47a5('0xa8')]=_0x5e2946;return _0x50c086;})[_0x47a5('0x26')](respondWithFilteredResult(_0xf269a8,_0x52749b));})['catch'](handleError(_0xf269a8,null));};exports[_0x47a5('0xa9')]=function(_0x597cb2,_0x1eabef){var _0x36f619={'raw':![],'where':{'id':_0x597cb2[_0x47a5('0xaa')]['id']}},_0x37e045={};_0x37e045['model']=_[_0x47a5('0x3a')](db['WhatsappInteraction']['rawAttributes']);_0x37e045[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x597cb2[_0x47a5('0x39')]);_0x37e045[_0x47a5('0x44')]=_[_0x47a5('0x3b')](_0x37e045['model'],_0x37e045[_0x47a5('0x39')]);_0x36f619[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x37e045[_0x47a5('0x38')],qs['fields'](_0x597cb2[_0x47a5('0x39')]['fields']));_0x36f619[_0x47a5('0x3c')]=_0x36f619[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x36f619[_0x47a5('0x3c')]:_0x37e045[_0x47a5('0x38')];if(_0x597cb2[_0x47a5('0x39')][_0x47a5('0xab')]){_0x36f619[_0x47a5('0xac')]=[{'all':!![]}];}_0x36f619=_[_0x47a5('0x96')]({},_0x36f619,_0x597cb2['options']);return db[_0x47a5('0xad')][_0x47a5('0x5c')](_0x36f619)['then'](handleEntityNotFound(_0x1eabef,null))[_0x47a5('0x26')](respondWithResult(_0x1eabef,null))[_0x47a5('0x32')](handleError(_0x1eabef,null));};exports[_0x47a5('0xae')]=function(_0x5b85cd,_0x4bf1f5){return db[_0x47a5('0xad')][_0x47a5('0xae')](_0x5b85cd['body'],{})['then'](respondWithResult(_0x4bf1f5,0xc9))[_0x47a5('0x32')](handleError(_0x4bf1f5,null));};exports[_0x47a5('0x24')]=function(_0x54eab1,_0x29e384){if(_0x54eab1[_0x47a5('0x6f')]['id']){delete _0x54eab1['body']['id'];}return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x54eab1[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x29e384,null))[_0x47a5('0x26')](saveUpdates(_0x54eab1[_0x47a5('0x6f')],null))['then'](respondWithResult(_0x29e384,null))['catch'](handleError(_0x29e384,null));};exports['destroy']=function(_0x133b7a,_0xce5ada){return db['WhatsappInteraction'][_0x47a5('0x5c')]({'where':{'id':_0x133b7a[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0xce5ada,null))[_0x47a5('0x26')](removeEntity(_0xce5ada,null))[_0x47a5('0x32')](handleError(_0xce5ada,null));};exports['describe']=function(_0x3e7750,_0x548a06){return db['WhatsappInteraction']['describe']()[_0x47a5('0x26')](respondWithResult(_0x548a06,null))['catch'](handleError(_0x548a06,null));};exports[_0x47a5('0xaf')]=function(_0xf3edc8,_0x5a316e,_0x49f791){return db[_0x47a5('0xb0')][_0x47a5('0x5c')]({'where':{'id':_0xf3edc8[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x5a316e,null))[_0x47a5('0x26')](function(_0x581a87){if(_0x581a87){return _0x581a87[_0x47a5('0xaf')](_0xf3edc8[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb1')](_0xf3edc8[_0x47a5('0x6f')],[_0x47a5('0xb2'),'id'])||{});}})[_0x47a5('0x26')](respondWithResult(_0x5a316e,null))[_0x47a5('0x32')](handleError(_0x5a316e,null));};exports[_0x47a5('0xb3')]=function(_0x5112d7,_0x6a8174,_0x2e418d){var _0x50b236={'raw':![],'where':{}};var _0x263521={};var _0x9769b5={'count':0x0,'rows':[]};return db[_0x47a5('0xad')][_0x47a5('0xb4')]({'where':{'id':_0x5112d7['params']['id']}})['then'](handleEntityNotFound(_0x6a8174,null))['then'](function(_0x4eee99){if(_0x4eee99){_0x263521[_0x47a5('0x38')]=_[_0x47a5('0x3a')](db[_0x47a5('0xb0')][_0x47a5('0x34')]);_0x263521[_0x47a5('0x39')]=_[_0x47a5('0x3a')](_0x5112d7[_0x47a5('0x39')]);_0x263521[_0x47a5('0x44')]=_['intersection'](_0x263521[_0x47a5('0x38')],_0x263521[_0x47a5('0x39')]);_0x50b236[_0x47a5('0x3c')]=_[_0x47a5('0x3b')](_0x263521['model'],qs['fields'](_0x5112d7[_0x47a5('0x39')]['fields']));_0x50b236['attributes']=_0x50b236[_0x47a5('0x3c')][_0x47a5('0x3e')]?_0x50b236['attributes']:_0x263521[_0x47a5('0x38')];if(!_0x5112d7[_0x47a5('0x39')][_0x47a5('0x3f')]('nolimit')){_0x50b236[_0x47a5('0x1f')]=qs[_0x47a5('0x1f')](_0x5112d7['query'][_0x47a5('0x1f')]);_0x50b236[_0x47a5('0x1e')]=qs[_0x47a5('0x1e')](_0x5112d7[_0x47a5('0x39')][_0x47a5('0x1e')]);}_0x50b236[_0x47a5('0x40')]=qs['sort'](_0x5112d7[_0x47a5('0x39')]['sort']);_0x50b236[_0x47a5('0x42')]=qs[_0x47a5('0x44')](_[_0x47a5('0x43')](_0x5112d7[_0x47a5('0x39')],_0x263521['filters']));_0x50b236[_0x47a5('0x42')][_0x47a5('0xa7')]=_0x4eee99['id'];if(_0x5112d7[_0x47a5('0x39')][_0x47a5('0x7f')]){_0x50b236[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x50b236[_0x47a5('0x42')],{'$or':_[_0x47a5('0x2c')](_0x50b236[_0x47a5('0x3c')],function(_0xa2045c){var _0x109738={};_0x109738[_0xa2045c]={'$like':'%'+_0x5112d7[_0x47a5('0x39')]['filter']+'%'};return _0x109738;})});}if(_0x5112d7[_0x47a5('0x39')][_0x47a5('0x75')]){var _0x591bde=_0x5112d7[_0x47a5('0x39')][_0x47a5('0x75')][_0x47a5('0x30')](',');var _0x2ccf21={};_0x2ccf21[_0x591bde[0x0]]={'$gte':moment(_0x591bde[0x1])[_0x47a5('0xb5')]('YYYY-MM-DD\x20HH:mm:ss')};_0x50b236[_0x47a5('0x42')]=_[_0x47a5('0x96')](_0x50b236[_0x47a5('0x42')],_0x2ccf21);}_0x50b236=_[_0x47a5('0x96')]({},_0x50b236,_0x5112d7[_0x47a5('0xb6')]);return db[_0x47a5('0xb0')][_0x47a5('0x1d')]({'where':_0x50b236['where']})['then'](function(_0xa3d578){_0x9769b5['count']=_0xa3d578;if(_0x5112d7[_0x47a5('0x39')]['includeAll']){_0x50b236[_0x47a5('0xac')]=[{'all':!![]}];}return db[_0x47a5('0xb0')][_0x47a5('0xb7')](_0x50b236);})[_0x47a5('0x26')](function(_0x49cb8c){_0x9769b5[_0x47a5('0xa8')]=_0x49cb8c;return _0x9769b5;});}})[_0x47a5('0x26')](respondWithFilteredResult(_0x6a8174,_0x50b236))[_0x47a5('0x32')](handleError(_0x6a8174,null));};exports['addTags']=function(_0x581759,_0x30375f,_0x29015a){return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x581759[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x30375f,null))[_0x47a5('0x26')](function(_0xe662d7){if(_0xe662d7){return _0xe662d7['setTags'](_0x581759[_0x47a5('0x6f')]['ids'],_[_0x47a5('0xb1')](_0x581759[_0x47a5('0x6f')],['ids','id'])||{})['spread'](function(){return db[_0x47a5('0x69')][_0x47a5('0xb7')]({'attributes':['id','name',_0x47a5('0x46')],'where':{'id':_0x581759[_0x47a5('0x6f')][_0x47a5('0xb2')]}});})[_0x47a5('0x26')](function(_0x5a7f32){socket[_0x47a5('0xb8')]('whatsappInteractionTags:save',{'id':Number(_0x581759['params']['id']),'tags':_0x5a7f32||[]});return{'id':Number(_0x581759['params']['id']),'tags':_0x5a7f32||[]};});}})[_0x47a5('0x26')](respondWithResult(_0x30375f,null))['catch'](handleError(_0x30375f,null));};exports[_0x47a5('0xb9')]=function(_0x156d51,_0x401139,_0x2005d5){return db[_0x47a5('0xad')][_0x47a5('0x5c')]({'where':{'id':_0x156d51[_0x47a5('0xaa')]['id']}})[_0x47a5('0x26')](handleEntityNotFound(_0x401139,null))[_0x47a5('0x26')](function(_0x2200f9){if(_0x2200f9){return _0x2200f9[_0x47a5('0xb9')](_0x156d51[_0x47a5('0x39')][_0x47a5('0xb2')]);}})[_0x47a5('0x26')](respondWithStatusCode(_0x401139,null))[_0x47a5('0x32')](handleError(_0x401139,null));};exports['download']=function(_0xdd95c8,_0x40aee5){var _0x322cee=moment()[_0x47a5('0xba')]()['toString']();var _0x367662=path['join'](config[_0x47a5('0xbb')],'server',_0x47a5('0xbc'),_0x47a5('0xbd'));var _0x3b894d=path['join'](config[_0x47a5('0xbb')],_0x47a5('0xbe'),_0x47a5('0xbc'),'attachments');var _0x52798d=path[_0x47a5('0xbf')](_0x367662,_0x322cee);var _0x1a5e07=util[_0x47a5('0xb5')](_0x47a5('0xc0'),_0xdd95c8[_0x47a5('0xaa')]['id'],_0x322cee);var _0x579e5c=path[_0x47a5('0xbf')](_0x367662,_0x1a5e07);var _0x4b3ae4=[];_0x4b3ae4[_0x47a5('0x31')]({'model':db[_0x47a5('0xc1')],'as':_0x47a5('0xc1'),'attributes':['id',_0x47a5('0x2d')],'raw':!![]});_0x4b3ae4['push']({'model':db['CmContact'],'as':_0x47a5('0x61'),'attributes':['id',_0x47a5('0xc2'),_0x47a5('0xc3')],'raw':!![]});if(_0xdd95c8[_0x47a5('0x39')][_0x47a5('0xc4')]){_0x4b3ae4[_0x47a5('0x31')]({'model':db[_0x47a5('0xc5')],'as':_0x47a5('0xc5'),'raw':!![]});}var _0x2c2245=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x47a5('0x6f'),'createdAt',_0x47a5('0xc6'),_0x47a5('0xc7'),_0x47a5('0x7b')],'include':_0x4b3ae4}];_0x2c2245['push']({'model':db[_0x47a5('0xc8')],'as':_0x47a5('0xc9'),'attributes':['id','name']});_0x2c2245[_0x47a5('0x31')]({'model':db['User'],'as':_0x47a5('0xca'),'attributes':['id',_0x47a5('0x2d')]});return db[_0x47a5('0xad')]['find']({'where':{'id':_0xdd95c8['params']['id']},'include':_0x2c2245})['then'](handleEntityNotFound(_0x40aee5,null))['then'](function(_0x5075a6){if(_0x5075a6){var _0x1ba5b6=_0x5075a6['get']({'plain':!![]});fs[_0x47a5('0xcb')](_0x52798d);var _0x2287b0={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':_0x47a5('0xcc'),'contents':{'default':util['format']('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util['format'](_0x47a5('0xcd'),_0x47a5('0xce'),_0x1ba5b6['id']),moment()[_0x47a5('0xb5')](_0x47a5('0xcf'))['toString']())}}};var _0xdda046={'channel':'Whatsapp','account':_0x1ba5b6[_0x47a5('0xc9')]['name'],'agent':_0x1ba5b6[_0x47a5('0xca')]?_0x1ba5b6[_0x47a5('0xca')][_0x47a5('0x2d')]:'N.A.','createdAt':moment(_0x1ba5b6[_0x47a5('0x74')])[_0x47a5('0xb5')](_0x47a5('0xd0'))[_0x47a5('0x94')](),'closedAt':_0x1ba5b6['closed']?moment(_0x1ba5b6[_0x47a5('0xd1')])[_0x47a5('0xb5')](_0x47a5('0xd0'))[_0x47a5('0x94')]():'','disposition':_0x1ba5b6[_0x47a5('0xd2')],'messages':_(_0x1ba5b6[_0x47a5('0xd3')])['filter']({'secret':![]})[_0x47a5('0x2c')](function(_0xe245ca){if(_0xe245ca[_0x47a5('0xc5')]){var _0xac8d4f=path[_0x47a5('0xbf')](_0x3b894d,_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')]);if(fs[_0x47a5('0xd5')](_0xac8d4f)){fs[_0x47a5('0xd6')](_0xac8d4f)[_0x47a5('0xd7')](fs[_0x47a5('0xd8')](path[_0x47a5('0xbf')](_0x52798d,_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')])));}}return{'date':moment(_0xe245ca[_0x47a5('0x74')])[_0x47a5('0xb5')](_0x47a5('0xd0'))['toString'](),'sender':_0xe245ca[_0x47a5('0xc6')]==='out'?_0xe245ca['User']?_0xe245ca[_0x47a5('0xc1')][_0x47a5('0x2d')]:_0x47a5('0xd9'):_0xe245ca['Contact'][_0x47a5('0xc2')]+(_0xe245ca[_0x47a5('0x61')][_0x47a5('0xc3')]?'\x20'+_0xe245ca[_0x47a5('0x61')][_0x47a5('0xc3')]:''),'body':_0xe245ca[_0x47a5('0xc5')]?_0xe245ca[_0x47a5('0xc5')][_0x47a5('0xd4')]:_0xe245ca[_0x47a5('0x6f')],'direction':_0xe245ca[_0x47a5('0xc6')]===_0x47a5('0xda')?'A':'C','secret':_0xe245ca[_0x47a5('0xc7')],'read':_0xe245ca[_0x47a5('0x7b')],'attachment':_0xe245ca['Attachment']};})['value']()};return ejs[_0x47a5('0xdb')](path['join'](config[_0x47a5('0xbb')],_0x47a5('0xbe'),_0x47a5('0xdc'),_0x47a5('0xdd')),{'interaction':_0xdda046})[_0x47a5('0x26')](function(_0x3708ea){return new BPromise(function(_0x583b37,_0x2b4039){pdf[_0x47a5('0xae')](_0x3708ea,_0x2287b0)[_0x47a5('0xde')](path['join'](_0x52798d,_0x47a5('0xdf')+_0x1ba5b6['id']+'-'+_0x322cee+_0x47a5('0xe0')),function(_0x3ecc41,_0x3e4148){if(_0x3ecc41)return _0x2b4039(_0x3ecc41);_0x583b37(_0x3e4148);});});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x23e649,_0x35e20f){zipdir(_0x52798d,{'saveTo':_0x579e5c},function(_0x46615a,_0xd6e255){if(_0x46615a)return _0x35e20f(_0x46615a);return _0x23e649(_0xd6e255);});})[_0x47a5('0x26')](function(){return new BPromise(function(_0x1b91ad,_0x40b7a5){rimraf(_0x52798d,function(_0x28e998){if(_0x28e998)_0x40b7a5(_0x28e998);return _0x1b91ad();});});})[_0x47a5('0x26')](function(){return _0x40aee5[_0x47a5('0xe1')](_0x579e5c,_0x1a5e07,function(_0x3f7fdc){if(_0x3f7fdc){console[_0x47a5('0xe2')](_0x47a5('0xe3'),_0x3f7fdc);}else{fs[_0x47a5('0xe4')](_0x579e5c);}});});});}else{return _0x40aee5[_0x47a5('0x1a')](0xc8);}})[_0x47a5('0x32')](handleError(_0x40aee5,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index bb10424..f8b4674 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.events.js +++ b/server/api/whatsappInteraction/whatsappInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a92=['events','../../mysqldb','WhatsappInteraction','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map','findAll','unreadMessages','catch','hasOwnProperty','hook','exports'];(function(_0x476b09,_0x46095d){var _0x327088=function(_0x1a2ec9){while(--_0x1a2ec9){_0x476b09['push'](_0x476b09['shift']());}};_0x327088(++_0x46095d);}(_0x5a92,0x77));var _0x25a9=function(_0x8cabb2,_0xaecc43){_0x8cabb2=_0x8cabb2-0x0;var _0x17e0d7=_0x5a92[_0x8cabb2];return _0x17e0d7;};'use strict';var EventEmitter=require(_0x25a9('0x0'));var WhatsappInteraction=require(_0x25a9('0x1'))['db'][_0x25a9('0x2')];var WhatsappMessage=require(_0x25a9('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x25a9('0x3')](0x0);var events={'afterCreate':_0x25a9('0x4'),'afterUpdate':_0x25a9('0x5'),'afterDestroy':_0x25a9('0x6')};function emitEvent(_0x5a6ba3){return function(_0x1e4bc5,_0x5db6d5,_0x4bfaef){_0x1e4bc5[_0x25a9('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4ee578){_0x1e4bc5[_0x25a9('0x8')](_0x25a9('0x9'),_0x4ee578[_0x25a9('0xa')](function(_0x3e18c2){return{'id':_0x3e18c2['id']};}));return WhatsappMessage[_0x25a9('0xb')]({'where':{'WhatsappInteractionId':_0x1e4bc5['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x494c1d){_0x1e4bc5[_0x25a9('0x8')](_0x25a9('0xc'),_0x494c1d['length']);WhatsappInteractionEvents['emit'](_0x5a6ba3+':'+_0x1e4bc5['id'],_0x1e4bc5);WhatsappInteractionEvents['emit'](_0x5a6ba3,_0x1e4bc5);_0x4bfaef(null);})[_0x25a9('0xd')](_0x4bfaef(null));};}for(var e in events){if(events[_0x25a9('0xe')](e)){var event=events[e];WhatsappInteraction[_0x25a9('0xf')](e,emitEvent(event));}}module[_0x25a9('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xa5f1=['emit','hasOwnProperty','exports','events','WhatsappInteraction','../../mysqldb','WhatsappMessage','setMaxListeners','save','remove','getUsers','then','Users','map','setDataValue','unreadMessages'];(function(_0x1c6bbb,_0x1019b7){var _0x5b876d=function(_0x5a8ac4){while(--_0x5a8ac4){_0x1c6bbb['push'](_0x1c6bbb['shift']());}};_0x5b876d(++_0x1019b7);}(_0xa5f1,0x173));var _0x1a5f=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa5f1[_0x411add];return _0x238242;};'use strict';var EventEmitter=require(_0x1a5f('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x1a5f('0x1')];var WhatsappMessage=require(_0x1a5f('0x2'))['db'][_0x1a5f('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x1a5f('0x4')](0x0);var events={'afterCreate':_0x1a5f('0x5'),'afterUpdate':'update','afterDestroy':_0x1a5f('0x6')};function emitEvent(_0x5cc7ee){return function(_0x48f1e6,_0x5071f2,_0x411123){_0x48f1e6[_0x1a5f('0x7')]({'attributes':['id'],'raw':!![]})[_0x1a5f('0x8')](function(_0x1113ab){_0x48f1e6['setDataValue'](_0x1a5f('0x9'),_0x1113ab[_0x1a5f('0xa')](function(_0x157ba0){return{'id':_0x157ba0['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x48f1e6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1a5f('0x8')](function(_0x4a7281){_0x48f1e6[_0x1a5f('0xb')](_0x1a5f('0xc'),_0x4a7281['length']);WhatsappInteractionEvents[_0x1a5f('0xd')](_0x5cc7ee+':'+_0x48f1e6['id'],_0x48f1e6);WhatsappInteractionEvents['emit'](_0x5cc7ee,_0x48f1e6);_0x411123(null);})['catch'](_0x411123(null));};}for(var e in events){if(events[_0x1a5f('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x1a5f('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 329d00f..24d1a53 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.model.js +++ b/server/api/whatsappInteraction/whatsappInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','WhatsappInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0x6eb2c8,_0x972cac){var _0x3cdb03=function(_0x4a16db){while(--_0x4a16db){_0x6eb2c8['push'](_0x6eb2c8['shift']());}};_0x3cdb03(++_0x972cac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x503809,_0xe42b77,_0x56465b){if(_0x503809['changed'](_0x0a9e('0xb'))){_0x503809[_0x0a9e('0xc')]=moment()[_0x0a9e('0xd')](_0x0a9e('0xe'));}_0x56465b(null,_0x503809);}}});}; \ No newline at end of file +var _0xa9e0=['define','WhatsappInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0x11648d,_0x1c3bd1){var _0x5cfdb7=function(_0x31f659){while(--_0x31f659){_0x11648d['push'](_0x11648d['shift']());}};_0x5cfdb7(++_0x1c3bd1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x503809,_0xe42b77,_0x56465b){if(_0x503809['changed'](_0x0a9e('0xb'))){_0x503809[_0x0a9e('0xc')]=moment()[_0x0a9e('0xd')](_0x0a9e('0xe'));}_0x56465b(null,_0x503809);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index c9ce5ff..02e2849 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.rpc.js +++ b/server/api/whatsappInteraction/whatsappInteraction.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf556=['socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost'];(function(_0x2db26c,_0xdcc76b){var _0x14994b=function(_0x5388b4){while(--_0x5388b4){_0x2db26c['push'](_0x2db26c['shift']());}};_0x14994b(++_0xdcc76b);}(_0xf556,0x133));var _0x6f55=function(_0x590314,_0x5f5a6f){_0x590314=_0x590314-0x0;var _0x128197=_0xf556[_0x590314];return _0x128197;};'use strict';var _=require(_0x6f55('0x0'));var util=require(_0x6f55('0x1'));var moment=require(_0x6f55('0x2'));var BPromise=require('bluebird');var rs=require(_0x6f55('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f55('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6f55('0x5'));var config=require(_0x6f55('0x6'));var jayson=require(_0x6f55('0x7'));var client=jayson[_0x6f55('0x8')][_0x6f55('0x9')]({'port':0x232a});config['redis']=_[_0x6f55('0xa')](config[_0x6f55('0xb')],{'host':_0x6f55('0xc'),'port':0x18eb});var socket=require(_0x6f55('0xd'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x6f55('0xe')](socket);function respondWithRpcPromise(_0x5ef813,_0x1aecdb,_0x2cfb31){return new BPromise(function(_0xd3a63b,_0x2c87c2){return client[_0x6f55('0xf')](_0x5ef813,_0x2cfb31)[_0x6f55('0x10')](function(_0xe207bd){logger[_0x6f55('0x11')](_0x6f55('0x12'),_0x1aecdb,_0x6f55('0x13'));logger[_0x6f55('0x14')](_0x6f55('0x15'),_0x1aecdb,_0x6f55('0x13'),JSON[_0x6f55('0x16')](_0xe207bd));if(_0xe207bd[_0x6f55('0x17')]){if(_0xe207bd[_0x6f55('0x17')]['code']===0x1f4){logger[_0x6f55('0x17')](_0x6f55('0x12'),_0x1aecdb,_0xe207bd[_0x6f55('0x17')][_0x6f55('0x18')]);return _0x2c87c2(_0xe207bd[_0x6f55('0x17')][_0x6f55('0x18')]);}logger[_0x6f55('0x17')](_0x6f55('0x12'),_0x1aecdb,_0xe207bd[_0x6f55('0x17')][_0x6f55('0x18')]);return _0xd3a63b(_0xe207bd[_0x6f55('0x17')]['message']);}else{logger['info'](_0x6f55('0x12'),_0x1aecdb,'request\x20sent');_0xd3a63b(_0xe207bd[_0x6f55('0x19')][_0x6f55('0x18')]);}})[_0x6f55('0x1a')](function(_0x23ce2b){logger[_0x6f55('0x17')](_0x6f55('0x12'),_0x1aecdb,_0x23ce2b);_0x2c87c2(_0x23ce2b);});});}exports['UpdateWhatsappInteraction']=function(_0x9b0555){var _0x526d01=this;return new Promise(function(_0x25bd2c,_0x56de8a){return db['WhatsappInteraction']['update'](_0x9b0555[_0x6f55('0x1b')],{'raw':_0x9b0555[_0x6f55('0x1c')]?_0x9b0555[_0x6f55('0x1c')][_0x6f55('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9b0555[_0x6f55('0x1c')]?_0x9b0555[_0x6f55('0x1c')][_0x6f55('0x1e')]||null:null,'attributes':_0x9b0555[_0x6f55('0x1c')]?_0x9b0555['options'][_0x6f55('0x1f')]||null:null,'limit':_0x9b0555[_0x6f55('0x1c')]?_0x9b0555[_0x6f55('0x1c')][_0x6f55('0x20')]||null:null})[_0x6f55('0x10')](function(_0x5c2fee){logger[_0x6f55('0x11')](_0x6f55('0x21'),_0x9b0555);logger['debug']('UpdateWhatsappInteraction',_0x9b0555,JSON[_0x6f55('0x16')](_0x5c2fee));_0x25bd2c(_0x5c2fee);})['catch'](function(_0xf46d23){logger[_0x6f55('0x17')](_0x6f55('0x21'),_0xf46d23[_0x6f55('0x18')],_0x9b0555);_0x56de8a(_0x526d01[_0x6f55('0x17')](0x1f4,_0xf46d23[_0x6f55('0x18')]));});});};exports[_0x6f55('0x22')]=function(_0x44ff0e){return new Promise(function(_0x42c23f,_0x189703){return db['WhatsappInteraction'][_0x6f55('0x23')]({'where':_0x44ff0e[_0x6f55('0x1c')]?_0x44ff0e['options'][_0x6f55('0x1e')]||null:null})[_0x6f55('0x10')](function(_0xb5294f){if(_0xb5294f){return _0xb5294f['addTags'](_0x44ff0e[_0x6f55('0x1b')][_0x6f55('0x24')],_[_0x6f55('0x25')](_0x44ff0e['body'],[_0x6f55('0x24'),'id'])||{});}})[_0x6f55('0x26')](function(_0x47c2b6){logger[_0x6f55('0x11')](_0x6f55('0x27'),_0x44ff0e);logger[_0x6f55('0x14')](_0x6f55('0x27'),_0x44ff0e,JSON[_0x6f55('0x16')](_0x47c2b6));_0x42c23f(_0x47c2b6);})[_0x6f55('0x1a')](function(_0x444e2a){logger[_0x6f55('0x17')]('AddTags',_0x444e2a[_0x6f55('0x18')],_0x44ff0e);_0x189703(_this[_0x6f55('0x17')](0x1f4,_0x444e2a[_0x6f55('0x18')]));});});}; \ No newline at end of file +var _0x2d52=['request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','raw','options','then','catch','AddTagsToWhatsappInteraction','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./whatsappInteraction.socket'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d52,0x1e8));var _0x22d5=function(_0x319696,_0x477274){_0x319696=_0x319696-0x0;var _0x44085a=_0x2d52[_0x319696];return _0x44085a;};'use strict';var _=require(_0x22d5('0x0'));var util=require(_0x22d5('0x1'));var moment=require(_0x22d5('0x2'));var BPromise=require(_0x22d5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x22d5('0x4'));var db=require(_0x22d5('0x5'))['db'];var utils=require(_0x22d5('0x6'));var logger=require(_0x22d5('0x7'))(_0x22d5('0x8'));var config=require(_0x22d5('0x9'));var jayson=require(_0x22d5('0xa'));var client=jayson['client'][_0x22d5('0xb')]({'port':0x232a});config['redis']=_[_0x22d5('0xc')](config[_0x22d5('0xd')],{'host':_0x22d5('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x22d5('0xf'))['register'](socket);function respondWithRpcPromise(_0x17b961,_0xa1472e,_0x46cc06){return new BPromise(function(_0x273cd2,_0xddc18d){return client[_0x22d5('0x10')](_0x17b961,_0x46cc06)['then'](function(_0x2a5ab6){logger[_0x22d5('0x11')](_0x22d5('0x12'),_0xa1472e,_0x22d5('0x13'));logger[_0x22d5('0x14')](_0x22d5('0x15'),_0xa1472e,_0x22d5('0x13'),JSON[_0x22d5('0x16')](_0x2a5ab6));if(_0x2a5ab6[_0x22d5('0x17')]){if(_0x2a5ab6['error'][_0x22d5('0x18')]===0x1f4){logger[_0x22d5('0x17')](_0x22d5('0x12'),_0xa1472e,_0x2a5ab6['error'][_0x22d5('0x19')]);return _0xddc18d(_0x2a5ab6['error']['message']);}logger[_0x22d5('0x17')](_0x22d5('0x12'),_0xa1472e,_0x2a5ab6[_0x22d5('0x17')][_0x22d5('0x19')]);return _0x273cd2(_0x2a5ab6[_0x22d5('0x17')]['message']);}else{logger['info'](_0x22d5('0x12'),_0xa1472e,_0x22d5('0x13'));_0x273cd2(_0x2a5ab6[_0x22d5('0x1a')][_0x22d5('0x19')]);}})['catch'](function(_0x333251){logger['error'](_0x22d5('0x12'),_0xa1472e,_0x333251);_0xddc18d(_0x333251);});});}exports[_0x22d5('0x1b')]=function(_0x4fac12){var _0x1ca254=this;return new Promise(function(_0x22afec,_0x593881){return db[_0x22d5('0x1c')][_0x22d5('0x1d')](_0x4fac12[_0x22d5('0x1e')],{'raw':_0x4fac12['options']?_0x4fac12['options'][_0x22d5('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fac12['options']?_0x4fac12[_0x22d5('0x20')]['where']||null:null,'attributes':_0x4fac12[_0x22d5('0x20')]?_0x4fac12['options']['attributes']||null:null,'limit':_0x4fac12[_0x22d5('0x20')]?_0x4fac12['options']['limit']||null:null})[_0x22d5('0x21')](function(_0x41ae24){logger[_0x22d5('0x11')](_0x22d5('0x1b'),_0x4fac12);logger[_0x22d5('0x14')](_0x22d5('0x1b'),_0x4fac12,JSON[_0x22d5('0x16')](_0x41ae24));_0x22afec(_0x41ae24);})[_0x22d5('0x22')](function(_0x4b9008){logger[_0x22d5('0x17')]('UpdateWhatsappInteraction',_0x4b9008[_0x22d5('0x19')],_0x4fac12);_0x593881(_0x1ca254[_0x22d5('0x17')](0x1f4,_0x4b9008[_0x22d5('0x19')]));});});};exports[_0x22d5('0x23')]=function(_0x155ab4){return new Promise(function(_0x1201a8,_0x146b6e){return db[_0x22d5('0x1c')]['find']({'where':_0x155ab4[_0x22d5('0x20')]?_0x155ab4['options'][_0x22d5('0x24')]||null:null})[_0x22d5('0x21')](function(_0x5428d9){if(_0x5428d9){return _0x5428d9[_0x22d5('0x25')](_0x155ab4[_0x22d5('0x1e')][_0x22d5('0x26')],_[_0x22d5('0x27')](_0x155ab4[_0x22d5('0x1e')],['ids','id'])||{});}})[_0x22d5('0x28')](function(_0x1b5a52){logger[_0x22d5('0x11')](_0x22d5('0x29'),_0x155ab4);logger[_0x22d5('0x14')](_0x22d5('0x29'),_0x155ab4,JSON[_0x22d5('0x16')](_0x1b5a52));_0x1201a8(_0x1b5a52);})[_0x22d5('0x22')](function(_0xf5ff6b){logger[_0x22d5('0x17')]('AddTags',_0xf5ff6b[_0x22d5('0x19')],_0x155ab4);_0x146b6e(_this[_0x22d5('0x17')](0x1f4,_0xf5ff6b[_0x22d5('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index e3673b1..1823145 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.socket.js +++ b/server/api/whatsappInteraction/whatsappInteraction.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf51=['length','whatsappInteraction:','remove','update','emit','register'];(function(_0xde76e0,_0xed9c7f){var _0x1d37d2=function(_0x21544e){while(--_0x21544e){_0xde76e0['push'](_0xde76e0['shift']());}};_0x1d37d2(++_0xed9c7f);}(_0xbf51,0xbc));var _0x1bf5=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xbf51[_0x1762b4];return _0x29beda;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0x1bf5('0x0'),_0x1bf5('0x1')];function createListener(_0x17992a,_0x364cdd){return function(_0x4b3ed2){_0x364cdd[_0x1bf5('0x2')](_0x17992a,_0x4b3ed2);};}function removeListener(_0x272669,_0x48ae5a){return function(){WhatsappInteractionEvents['removeListener'](_0x272669,_0x48ae5a);};}exports[_0x1bf5('0x3')]=function(_0x1d770b){for(var _0x54fbf0=0x0,_0x4fd193=events[_0x1bf5('0x4')];_0x54fbf0<_0x4fd193;_0x54fbf0++){var _0x5393b7=events[_0x54fbf0];var _0x4fdcab=createListener(_0x1bf5('0x5')+_0x5393b7,_0x1d770b);WhatsappInteractionEvents['on'](_0x5393b7,_0x4fdcab);}}; \ No newline at end of file +var _0xb8a4=['whatsappInteraction:','./whatsappInteraction.events','save','remove','removeListener','length'];(function(_0x3e1151,_0x55eb14){var _0x5e7a3f=function(_0x5978e0){while(--_0x5978e0){_0x3e1151['push'](_0x3e1151['shift']());}};_0x5e7a3f(++_0x55eb14);}(_0xb8a4,0x109));var _0x4b8a=function(_0xcd939f,_0x33117d){_0xcd939f=_0xcd939f-0x0;var _0xe23e6f=_0xb8a4[_0xcd939f];return _0xe23e6f;};'use strict';var WhatsappInteractionEvents=require(_0x4b8a('0x0'));var events=[_0x4b8a('0x1'),_0x4b8a('0x2'),'update'];function createListener(_0x25cfb0,_0x36497e){return function(_0x4c9332){_0x36497e['emit'](_0x25cfb0,_0x4c9332);};}function removeListener(_0x3e5288,_0x5eea74){return function(){WhatsappInteractionEvents[_0x4b8a('0x3')](_0x3e5288,_0x5eea74);};}exports['register']=function(_0xa7518e){for(var _0x5c6c97=0x0,_0x3111a7=events[_0x4b8a('0x4')];_0x5c6c97<_0x3111a7;_0x5c6c97++){var _0x19bbe=events[_0x5c6c97];var _0x28def0=createListener(_0x4b8a('0x5')+_0x19bbe,_0xa7518e);WhatsappInteractionEvents['on'](_0x19bbe,_0x28def0);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 4f01412..2d505ee 100644 --- a/server/api/whatsappMessage/index.js +++ b/server/api/whatsappMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2c88=['accept','/:id/reject','reject','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','index','get','/describe','isAuthenticated','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','update','/:id/accept'];(function(_0x55754d,_0x317587){var _0x332acc=function(_0x3ee8ef){while(--_0x3ee8ef){_0x55754d['push'](_0x55754d['shift']());}};_0x332acc(++_0x317587);}(_0x2c88,0x170));var _0x82c8=function(_0xc9272a,_0x2054bb){_0xc9272a=_0xc9272a-0x0;var _0x48dc11=_0x2c88[_0xc9272a];return _0x48dc11;};'use strict';var multer=require(_0x82c8('0x0'));var util=require(_0x82c8('0x1'));var path=require(_0x82c8('0x2'));var timeout=require('connect-timeout');var express=require(_0x82c8('0x3'));var router=express[_0x82c8('0x4')]();var auth=require(_0x82c8('0x5'));var interaction=require(_0x82c8('0x6'));var config=require(_0x82c8('0x7'));var controller=require(_0x82c8('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x82c8('0x9')]);router[_0x82c8('0xa')](_0x82c8('0xb'),auth[_0x82c8('0xc')](),controller['describe']);router[_0x82c8('0xa')](_0x82c8('0xd'),auth[_0x82c8('0xc')](),controller[_0x82c8('0xe')]);router[_0x82c8('0xf')]('/',auth[_0x82c8('0xc')](),interaction[_0x82c8('0x10')](_0x82c8('0x11'),_0x82c8('0x12')),controller[_0x82c8('0x13')]);router['post'](_0x82c8('0x14'),controller['status']);router[_0x82c8('0x15')]('/:id',auth[_0x82c8('0xc')](),controller[_0x82c8('0x16')]);router[_0x82c8('0x15')](_0x82c8('0x17'),auth[_0x82c8('0xc')](),controller[_0x82c8('0x18')]);router['put'](_0x82c8('0x19'),auth[_0x82c8('0xc')](),controller[_0x82c8('0x1a')]);router[_0x82c8('0x1b')](_0x82c8('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5b93=['isAuthenticated','/describe','describe','get','/:id','show','whatsapp','whatsappmessage:create','create','post','/:id/status','status','put','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x5b93,0x1de));var _0x35b9=function(_0x6d0a94,_0x198e6d){_0x6d0a94=_0x6d0a94-0x0;var _0x5e8056=_0x5b93[_0x6d0a94];return _0x5e8056;};'use strict';var multer=require(_0x35b9('0x0'));var util=require(_0x35b9('0x1'));var path=require('path');var timeout=require(_0x35b9('0x2'));var express=require(_0x35b9('0x3'));var router=express['Router']();var auth=require(_0x35b9('0x4'));var interaction=require(_0x35b9('0x5'));var config=require(_0x35b9('0x6'));var controller=require(_0x35b9('0x7'));router['get']('/',auth[_0x35b9('0x8')](),controller['index']);router['get'](_0x35b9('0x9'),auth[_0x35b9('0x8')](),controller[_0x35b9('0xa')]);router[_0x35b9('0xb')](_0x35b9('0xc'),auth[_0x35b9('0x8')](),controller[_0x35b9('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0x35b9('0xe'),_0x35b9('0xf')),controller[_0x35b9('0x10')]);router[_0x35b9('0x11')](_0x35b9('0x12'),controller[_0x35b9('0x13')]);router[_0x35b9('0x14')](_0x35b9('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x35b9('0x14')]('/:id/accept',auth[_0x35b9('0x8')](),controller[_0x35b9('0x15')]);router['put'](_0x35b9('0x16'),auth[_0x35b9('0x8')](),controller[_0x35b9('0x17')]);router[_0x35b9('0x18')](_0x35b9('0xc'),auth[_0x35b9('0x8')](),controller[_0x35b9('0x19')]);module[_0x35b9('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index da30da5..b4bcd9c 100644 --- a/server/api/whatsappMessage/whatsappMessage.attributes.js +++ b/server/api/whatsappMessage/whatsappMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91dd=['ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x4dff44,_0x425c3f){var _0x261b6b=function(_0x1418d5){while(--_0x1418d5){_0x4dff44['push'](_0x4dff44['shift']());}};_0x261b6b(++_0x425c3f);}(_0x91dd,0x136));var _0xd91d=function(_0x34a19b,_0x34290d){_0x34a19b=_0x34a19b-0x0;var _0x1c9490=_0x91dd[_0x34a19b];return _0x1c9490;};'use strict';var Sequelize=require(_0xd91d('0x0'));module[_0xd91d('0x1')]={'body':{'type':Sequelize[_0xd91d('0x2')](_0xd91d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd91d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd91d('0x5')]('in',_0xd91d('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xd91d('0x7')](0xbe)},'phone':{'type':Sequelize[_0xd91d('0x7')]},'readAt':{'type':Sequelize[_0xd91d('0x8')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8bc8=['TEXT','medium','ENUM','DATE','sequelize','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x8bc8,0xc4));var _0x88bc=function(_0x517869,_0x1f383b){_0x517869=_0x517869-0x0;var _0x2e6dd7=_0x8bc8[_0x517869];return _0x2e6dd7;};'use strict';var Sequelize=require(_0x88bc('0x0'));module[_0x88bc('0x1')]={'body':{'type':Sequelize[_0x88bc('0x2')](_0x88bc('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x88bc('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x88bc('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index e4a06f8..cf8a8bd 100644 --- a/server/api/whatsappMessage/whatsappMessage.controller.js +++ b/server/api/whatsappMessage/whatsappMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4339=['count','includeAll','include','findAll','catch','show','params','keys','length','find','create','body','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','Contact','get','WhatsappInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','type','inspect','MessageSid','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','stack','name','index','map','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','hasOwnProperty','limit','sort','where','filters','filter','merge','options','WhatsappMessage'];(function(_0x4c6736,_0x568075){var _0x3b9469=function(_0x44195e){while(--_0x44195e){_0x4c6736['push'](_0x4c6736['shift']());}};_0x3b9469(++_0x568075);}(_0x4339,0x1b9));var _0x9433=function(_0x62a397,_0x41ac33){_0x62a397=_0x62a397-0x0;var _0x51da4a=_0x4339[_0x62a397];return _0x51da4a;};'use strict';var pdf=require(_0x9433('0x0'));var emlformat=require(_0x9433('0x1'));var rimraf=require(_0x9433('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9433('0x3'));var rp=require('request-promise');var moment=require(_0x9433('0x4'));var BPromise=require(_0x9433('0x5'));var Mustache=require(_0x9433('0x6'));var util=require('util');var path=require(_0x9433('0x7'));var sox=require(_0x9433('0x8'));var csv=require(_0x9433('0x9'));var ejs=require(_0x9433('0xa'));var fs=require('fs');var _=require(_0x9433('0xb'));var squel=require(_0x9433('0xc'));var crypto=require(_0x9433('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9433('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9433('0xf'));var Papa=require(_0x9433('0x10'));var Redis=require(_0x9433('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9433('0x12'));var logger=require('../../config/logger')(_0x9433('0x13'));var utils=require(_0x9433('0x14'));var config=require(_0x9433('0x15'));var db=require(_0x9433('0x16'))['db'];config['redis']=_[_0x9433('0x17')](config[_0x9433('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x9433('0x19'))(new Redis(config[_0x9433('0x18')]));require(_0x9433('0x1a'))['register'](socket);var jayson=require(_0x9433('0x1b'));var client=jayson[_0x9433('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x9433('0x1c')][_0x9433('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x6b4e05,_0x40cf21,_0x383250){if(_0x383250){var _0xde4fec=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xde4fec[_0x9433('0x1e')](_0x40cf21)){return _0x6b4e05;}else{throw new db['Sequelize'][(_0x9433('0x1f'))](_0x9433('0x20'));}}else{return _0x6b4e05;}}function respondWithRpcPromise(_0xdcaf7b,_0x529ac6,_0x2a3d4d,_0x2ce13a){return new BPromise(function(_0x547646,_0x48d097){var _0x18b74c=_0x2ce13a||client;return _0x18b74c[_0x9433('0x21')](_0xdcaf7b,_0x2a3d4d)[_0x9433('0x22')](function(_0x1849a4){logger[_0x9433('0x23')](_0x9433('0x24'),_0x529ac6,_0x9433('0x25'));logger[_0x9433('0x26')](_0x9433('0x27'),_0x529ac6,_0x9433('0x25'),JSON[_0x9433('0x28')](_0x1849a4));if(_0x1849a4[_0x9433('0x29')]){if(_0x1849a4[_0x9433('0x29')]['code']===0x1f4){logger['error'](_0x9433('0x24'),_0x529ac6,_0x1849a4[_0x9433('0x29')][_0x9433('0x2a')]);return _0x48d097(_0x1849a4['error'][_0x9433('0x2a')]);}logger[_0x9433('0x29')](_0x9433('0x24'),_0x529ac6,_0x1849a4['error']['message']);return _0x547646(_0x1849a4[_0x9433('0x29')][_0x9433('0x2a')]);}else{logger['info'](_0x9433('0x24'),_0x529ac6,_0x9433('0x25'));_0x547646(_0x1849a4[_0x9433('0x2b')][_0x9433('0x2a')]);}})['catch'](function(_0x47d3b9){logger['error'](_0x9433('0x24'),_0x529ac6,_0x47d3b9);_0x48d097(_0x47d3b9);});});}function respondWithStatusCode(_0x4ae4d3,_0x5b5c7b){_0x5b5c7b=_0x5b5c7b||0xcc;return function(_0x3ca43d){if(_0x3ca43d){return _0x4ae4d3[_0x9433('0x2c')](_0x5b5c7b);}return _0x4ae4d3[_0x9433('0x2d')](_0x5b5c7b)[_0x9433('0x2e')]();};}function respondWithResult(_0x52b3ab,_0x267c9e){_0x267c9e=_0x267c9e||0xc8;return function(_0x579dfd){if(_0x579dfd){return _0x52b3ab[_0x9433('0x2d')](_0x267c9e)[_0x9433('0x2f')](_0x579dfd);}};}function respondWithFilteredResult(_0x3ab2c3,_0x4cfccf){return function(_0x4b5279){if(_0x4b5279){var _0xd2795d=_0x4b5279['count'],_0x26c93e=_0x4cfccf[_0x9433('0x30')],_0x244ae9=_0x4cfccf['offset']+_0x4cfccf['limit'],_0x190aa5;if(_0x244ae9>=_0xd2795d){_0x244ae9=_0xd2795d;_0x190aa5=0xc8;}else{_0x190aa5=0xce;}_0x3ab2c3['status'](_0x190aa5);return _0x3ab2c3[_0x9433('0x31')](_0x9433('0x32'),_0x26c93e+'-'+_0x244ae9+'/'+_0xd2795d)[_0x9433('0x2f')](_0x4b5279);}return null;};}function patchUpdates(_0x465113){return function(_0x9ce74b){try{jsonpatch[_0x9433('0x33')](_0x9ce74b,_0x465113,!![]);}catch(_0x5481bb){return BPromise[_0x9433('0x34')](_0x5481bb);}return _0x9ce74b['save']();};}function saveUpdates(_0x20134a,_0x2a6648){return function(_0x48a6cf){if(_0x48a6cf){return _0x48a6cf[_0x9433('0x35')](_0x20134a)[_0x9433('0x22')](function(_0x3706a4){return _0x3706a4;});}return null;};}function removeEntity(_0x3cc03b,_0x3dceb1){return function(_0x5423a6){if(_0x5423a6){return _0x5423a6['destroy']()['then'](function(){_0x3cc03b[_0x9433('0x2d')](0xcc)[_0x9433('0x2e')]();});}};}function handleEntityNotFound(_0x3cb235,_0x1a3f25){return function(_0x2aeae5){if(!_0x2aeae5){_0x3cb235[_0x9433('0x2c')](0x194);}return _0x2aeae5;};}function handleError(_0x29f127,_0x1dd8dc){_0x1dd8dc=_0x1dd8dc||0x1f4;return function(_0x2b3362){logger[_0x9433('0x29')](_0x2b3362[_0x9433('0x36')]);if(_0x2b3362[_0x9433('0x37')]){delete _0x2b3362[_0x9433('0x37')];}_0x29f127['status'](_0x1dd8dc)['send'](_0x2b3362);};}exports[_0x9433('0x38')]=function(_0x9b047d,_0x3d53e6){var _0x56cc1b={},_0x34466c={},_0x556455={'count':0x0,'rows':[]};var _0x29adb9=_[_0x9433('0x39')](db['WhatsappMessage'][_0x9433('0x3a')],function(_0x5378ab){return{'name':_0x5378ab[_0x9433('0x3b')],'type':_0x5378ab['type'][_0x9433('0x3c')]};});_0x34466c['model']=_[_0x9433('0x39')](_0x29adb9,_0x9433('0x37'));_0x34466c[_0x9433('0x3d')]=_['keys'](_0x9b047d[_0x9433('0x3d')]);_0x34466c['filters']=_[_0x9433('0x3e')](_0x34466c[_0x9433('0x3f')],_0x34466c[_0x9433('0x3d')]);_0x56cc1b[_0x9433('0x40')]=_['intersection'](_0x34466c[_0x9433('0x3f')],qs[_0x9433('0x41')](_0x9b047d['query'][_0x9433('0x41')]));_0x56cc1b[_0x9433('0x40')]=_0x56cc1b[_0x9433('0x40')]['length']?_0x56cc1b[_0x9433('0x40')]:_0x34466c['model'];if(!_0x9b047d[_0x9433('0x3d')][_0x9433('0x42')]('nolimit')){_0x56cc1b[_0x9433('0x43')]=qs[_0x9433('0x43')](_0x9b047d[_0x9433('0x3d')]['limit']);_0x56cc1b['offset']=qs[_0x9433('0x30')](_0x9b047d['query']['offset']);}_0x56cc1b['order']=qs['sort'](_0x9b047d[_0x9433('0x3d')][_0x9433('0x44')]);_0x56cc1b[_0x9433('0x45')]=qs[_0x9433('0x46')](_['pick'](_0x9b047d[_0x9433('0x3d')],_0x34466c[_0x9433('0x46')]),_0x29adb9);if(_0x9b047d[_0x9433('0x3d')][_0x9433('0x47')]){_0x56cc1b['where']=_[_0x9433('0x48')](_0x56cc1b[_0x9433('0x45')],{'$or':_[_0x9433('0x39')](_0x29adb9,function(_0x5b4edd){if(_0x5b4edd['type']!=='VIRTUAL'){var _0x2ae76b={};_0x2ae76b[_0x5b4edd['name']]={'$like':'%'+_0x9b047d[_0x9433('0x3d')][_0x9433('0x47')]+'%'};return _0x2ae76b;}})});}_0x56cc1b=_[_0x9433('0x48')]({},_0x56cc1b,_0x9b047d[_0x9433('0x49')]);var _0x2df8ce={'where':_0x56cc1b[_0x9433('0x45')]};return db[_0x9433('0x4a')][_0x9433('0x4b')](_0x2df8ce)[_0x9433('0x22')](function(_0x1c6f7c){_0x556455[_0x9433('0x4b')]=_0x1c6f7c;if(_0x9b047d[_0x9433('0x3d')][_0x9433('0x4c')]){_0x56cc1b[_0x9433('0x4d')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x9433('0x4e')](_0x56cc1b);})[_0x9433('0x22')](function(_0x478d76){_0x556455['rows']=_0x478d76;return _0x556455;})[_0x9433('0x22')](respondWithFilteredResult(_0x3d53e6,_0x56cc1b))[_0x9433('0x4f')](handleError(_0x3d53e6,null));};exports[_0x9433('0x50')]=function(_0x343011,_0xdc0688){var _0x5986a9={'raw':!![],'where':{'id':_0x343011[_0x9433('0x51')]['id']}},_0x45beae={};_0x45beae[_0x9433('0x3f')]=_['keys'](db[_0x9433('0x4a')][_0x9433('0x3a')]);_0x45beae['query']=_[_0x9433('0x52')](_0x343011[_0x9433('0x3d')]);_0x45beae['filters']=_[_0x9433('0x3e')](_0x45beae[_0x9433('0x3f')],_0x45beae['query']);_0x5986a9['attributes']=_[_0x9433('0x3e')](_0x45beae[_0x9433('0x3f')],qs['fields'](_0x343011['query'][_0x9433('0x41')]));_0x5986a9[_0x9433('0x40')]=_0x5986a9[_0x9433('0x40')][_0x9433('0x53')]?_0x5986a9['attributes']:_0x45beae['model'];if(_0x343011[_0x9433('0x3d')][_0x9433('0x4c')]){_0x5986a9[_0x9433('0x4d')]=[{'all':!![]}];}_0x5986a9=_[_0x9433('0x48')]({},_0x5986a9,_0x343011[_0x9433('0x49')]);return db['WhatsappMessage'][_0x9433('0x54')](_0x5986a9)['then'](handleEntityNotFound(_0xdc0688,null))[_0x9433('0x22')](respondWithResult(_0xdc0688,null))[_0x9433('0x4f')](handleError(_0xdc0688,null));};exports[_0x9433('0x55')]=function(_0xb9bf78,_0x5abd47){return db[_0x9433('0x4a')][_0x9433('0x55')](_0xb9bf78[_0x9433('0x56')],{})['then'](respondWithResult(_0x5abd47,0xc9))[_0x9433('0x4f')](handleError(_0x5abd47,null));};exports['update']=function(_0x51a9b3,_0x339339){if(_0x51a9b3[_0x9433('0x56')]['id']){delete _0x51a9b3['body']['id'];}return db[_0x9433('0x4a')][_0x9433('0x54')]({'where':{'id':_0x51a9b3[_0x9433('0x51')]['id']}})[_0x9433('0x22')](handleEntityNotFound(_0x339339,null))[_0x9433('0x22')](saveUpdates(_0x51a9b3['body'],null))['then'](respondWithResult(_0x339339,null))[_0x9433('0x4f')](handleError(_0x339339,null));};exports['destroy']=function(_0x81eee0,_0x2080a2){return db['WhatsappMessage'][_0x9433('0x54')]({'where':{'id':_0x81eee0[_0x9433('0x51')]['id']}})[_0x9433('0x22')](handleEntityNotFound(_0x2080a2,null))['then'](removeEntity(_0x2080a2,null))['catch'](handleError(_0x2080a2,null));};exports[_0x9433('0x57')]=function(_0x165999,_0x2d1843){return db[_0x9433('0x4a')][_0x9433('0x57')]()[_0x9433('0x22')](respondWithResult(_0x2d1843,null))[_0x9433('0x4f')](handleError(_0x2d1843,null));};var interaction_log=require(_0x9433('0x58'))(_0x9433('0x59'));exports[_0x9433('0x5a')]=function(_0x4dbfda,_0x3571aa,_0x316e08){var _0x4d723d={'channel':_0x9433('0x5b')};if(_0x4dbfda[_0x9433('0x56')]['id']){delete _0x4dbfda[_0x9433('0x56')]['id'];}_0x4dbfda['body'][_0x9433('0x5c')]=!![];_0x4dbfda[_0x9433('0x56')][_0x9433('0x5d')]=moment()[_0x9433('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x4dbfda[_0x9433('0x56')][_0x9433('0x5f')]=_0x4dbfda[_0x9433('0x56')][_0x9433('0x5f')]||_0x4dbfda[_0x9433('0x60')]['id'];return db['WhatsappMessage']['find']({'where':{'id':_0x4dbfda[_0x9433('0x51')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x9433('0x61')}]})['then'](handleEntityNotFound(_0x3571aa,null))['then'](saveUpdates(_0x4dbfda[_0x9433('0x56')],null))[_0x9433('0x22')](function(_0x3a3bfc){if(_0x3a3bfc){_0x4d723d[_0x9433('0x2a')]=_0x3a3bfc[_0x9433('0x62')]({'plain':!![]});return db[_0x9433('0x63')][_0x9433('0x54')]({'where':{'id':_0x3a3bfc['WhatsappInteractionId']}});}return null;})[_0x9433('0x22')](handleEntityNotFound(_0x3571aa,null))[_0x9433('0x22')](function(_0x58d6f3){if(_0x58d6f3){return _0x58d6f3[_0x9433('0x35')]({'UserId':_0x4dbfda[_0x9433('0x56')][_0x9433('0x5f')],'read1stAt':_[_0x9433('0x64')](_0x58d6f3[_0x9433('0x65')])?moment()[_0x9433('0x5e')](_0x9433('0x66')):undefined});}return null;})['then'](function(_0x363d54){if(_0x363d54){_0x4d723d[_0x9433('0x67')]=_0x363d54[_0x9433('0x62')]({'plain':!![]});interaction_log[_0x9433('0x23')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4dbfda[_0x9433('0x60')]['id'],_0x4dbfda[_0x9433('0x60')][_0x9433('0x37')],_0x4dbfda[_0x9433('0x60')][_0x9433('0x68')],_0x4d723d[_0x9433('0x67')]['id'],_0x4dbfda[_0x9433('0x56')]?JSON[_0x9433('0x28')](_0x4dbfda['body']):'null');return respondWithRpcPromise(_0x9433('0x69'),_0x9433('0x6a'),_0x4d723d);}return null;})[_0x9433('0x22')](function(_0x5dc2af){if(_0x5dc2af){if(_0x4dbfda[_0x9433('0x56')][_0x9433('0x6b')]){_0x4d723d['message'][_0x9433('0x6c')]=util['format'](_0x9433('0x6d'),_0x4dbfda[_0x9433('0x60')][_0x9433('0x37')]);_0x4d723d[_0x9433('0x2a')][_0x9433('0x6e')]=_0x4d723d[_0x9433('0x6e')];_0x4d723d[_0x9433('0x2a')][_0x9433('0x6f')]=_0x9433('0x5a');return respondWithRpcPromise(_0x9433('0x70'),_0x9433('0x70'),{'event':_0x9433('0x71'),'message':_0x4d723d[_0x9433('0x2a')]},client9002)[_0x9433('0x22')](function(){return _0x4d723d;});}return _0x4d723d;}return null;})['then'](respondWithResult(_0x3571aa,null))['catch'](handleError(_0x3571aa,null));};var interaction_log=require(_0x9433('0x58'))(_0x9433('0x59'));exports[_0x9433('0x34')]=function(_0x293777,_0x1bafa4,_0x4f87f){var _0x161a07={'agent':{},'channel':'whatsapp'};if(_0x293777[_0x9433('0x56')]['id']){delete _0x293777['body']['id'];}_0x293777[_0x9433('0x56')]['UserId']=_0x293777['body'][_0x9433('0x5f')]||_0x293777[_0x9433('0x60')]['id'];_0x161a07[_0x9433('0x72')]['id']=_0x293777[_0x9433('0x56')][_0x9433('0x5f')];return db[_0x9433('0x4a')][_0x9433('0x54')]({'where':{'id':_0x293777['params']['id'],'UserId':null}})[_0x9433('0x22')](handleEntityNotFound(_0x1bafa4,null))[_0x9433('0x22')](function(_0x41d566){if(_0x41d566){_0x161a07['message']=_0x41d566[_0x9433('0x62')]({'plain':!![]});return db[_0x9433('0x63')][_0x9433('0x54')]({'where':{'id':_0x41d566[_0x9433('0x73')]}});}return null;})[_0x9433('0x22')](handleEntityNotFound(_0x1bafa4,null))[_0x9433('0x22')](function(_0x3a93f5){if(_0x3a93f5){_0x161a07[_0x9433('0x67')]=_0x3a93f5[_0x9433('0x62')]({'plain':!![]});interaction_log['info'](_0x9433('0x74'),_0x293777[_0x9433('0x60')]['id'],_0x293777[_0x9433('0x60')]['name'],_0x293777[_0x9433('0x60')][_0x9433('0x68')],_0x161a07['interaction']['id'],_0x293777[_0x9433('0x56')]?JSON[_0x9433('0x28')](_0x293777[_0x9433('0x56')]):_0x9433('0x75'));return respondWithRpcPromise(_0x9433('0x76'),_0x9433('0x77'),_0x161a07);}return null;})[_0x9433('0x22')](function(_0x1d3f6b){if(_0x1d3f6b){_0x1d3f6b[_0x9433('0x2a')][_0x9433('0x6c')]=util[_0x9433('0x5e')]('SIP/%s',_0x293777[_0x9433('0x60')]['name']);_0x1d3f6b['message']['channel']=_0x161a07[_0x9433('0x6e')];_0x1d3f6b[_0x9433('0x2a')][_0x9433('0x6f')]=_0x9433('0x34');respondWithRpcPromise(_0x9433('0x70'),'EventManager',{'event':_0x9433('0x78'),'message':_0x1d3f6b[_0x9433('0x2a')]},client9002);return _0x161a07;}return null;})[_0x9433('0x22')](respondWithResult(_0x1bafa4,null))[_0x9433('0x4f')](handleError(_0x1bafa4,null));};exports[_0x9433('0x2d')]=function(_0x13dd40,_0x2b2b55,_0x12b310){if(_0x13dd40[_0x9433('0x56')]['id']){delete _0x13dd40[_0x9433('0x56')]['id'];}var _0x2f69c7;return db[_0x9433('0x4a')][_0x9433('0x54')]({'where':{'id':_0x13dd40[_0x9433('0x51')]['id']}})[_0x9433('0x22')](handleEntityNotFound(_0x2b2b55,null))['then'](function(_0x2032e4){if(_0x2032e4){_0x2f69c7=_0x2032e4;return db[_0x9433('0x79')][_0x9433('0x54')]({'where':{'id':_0x2032e4[_0x9433('0x7a')]}});}})[_0x9433('0x22')](handleEntityNotFound(_0x2b2b55,null))[_0x9433('0x22')](function(_0xc0340a){if(_0xc0340a){logger[_0x9433('0x26')](_0x9433('0x7b'),_0x9433('0x2d'),'received\x20delivery\x20report\x20from',_0xc0340a[_0x9433('0x7c')],util[_0x9433('0x7d')](_0x13dd40[_0x9433('0x56')],{'showHidden':![],'depth':null}));switch(_0xc0340a[_0x9433('0x7c')]){case'twilio':if(_0x13dd40[_0x9433('0x56')][_0x9433('0x7e')]&&_0x13dd40[_0x9433('0x56')][_0x9433('0x7e')]===_0x2f69c7['messageId']&&_0x13dd40['body']['MessageStatus']&&_0x13dd40[_0x9433('0x56')]['MessageStatus']===_0x9433('0x5c')){return _0x2f69c7[_0x9433('0x35')]({'read':!![]});}else{logger[_0x9433('0x29')](_0x9433('0x7f'),_0x9433('0x2d'),_0x9433('0x80'),util[_0x9433('0x7d')](_0x13dd40[_0x9433('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x2f69c7;}})[_0x9433('0x22')](respondWithResult(_0x2b2b55,null))[_0x9433('0x4f')](handleError(_0x2b2b55,null));}; \ No newline at end of file +var _0x05f9=['order','sort','where','merge','includeAll','findAll','rows','show','include','options','find','create','body','params','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','whatsapp-interactions','agent','get','null','RejectMessage','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','MessageStatus','inspect','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','index','map','WhatsappMessage','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit'];(function(_0x130fb3,_0x11188e){var _0x284fa0=function(_0x87e976){while(--_0x87e976){_0x130fb3['push'](_0x130fb3['shift']());}};_0x284fa0(++_0x11188e);}(_0x05f9,0xba));var _0x905f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x05f9[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x905f('0x0'));var zipdir=require(_0x905f('0x1'));var jsonpatch=require(_0x905f('0x2'));var rp=require(_0x905f('0x3'));var moment=require(_0x905f('0x4'));var BPromise=require(_0x905f('0x5'));var Mustache=require(_0x905f('0x6'));var util=require(_0x905f('0x7'));var path=require(_0x905f('0x8'));var sox=require(_0x905f('0x9'));var csv=require(_0x905f('0xa'));var ejs=require(_0x905f('0xb'));var fs=require('fs');var _=require(_0x905f('0xc'));var squel=require('squel');var crypto=require(_0x905f('0xd'));var jsforce=require(_0x905f('0xe'));var deskjs=require(_0x905f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x905f('0x10'));var Papa=require('papaparse');var Redis=require(_0x905f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x905f('0x12'));var hardwareService=require(_0x905f('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x905f('0x14'));var config=require(_0x905f('0x15'));var db=require(_0x905f('0x16'))['db'];config[_0x905f('0x17')]=_[_0x905f('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x905f('0x19'))(new Redis(config[_0x905f('0x17')]));require(_0x905f('0x1a'))[_0x905f('0x1b')](socket);var jayson=require(_0x905f('0x1c'));var client=jayson[_0x905f('0x1d')][_0x905f('0x1e')]({'port':0x232c});var client9002=jayson[_0x905f('0x1d')][_0x905f('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x1dafce,_0x5a5fb9,_0x212267){if(_0x212267){var _0x9a5a97=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x9a5a97[_0x905f('0x1f')](_0x5a5fb9)){return _0x1dafce;}else{throw new db[(_0x905f('0x20'))][(_0x905f('0x21'))](_0x905f('0x22'));}}else{return _0x1dafce;}}function respondWithRpcPromise(_0x58451c,_0x278e86,_0x2e8945,_0x5ed985){return new BPromise(function(_0x4bdc4a,_0x204db4){var _0x2c76e9=_0x5ed985||client;return _0x2c76e9[_0x905f('0x23')](_0x58451c,_0x2e8945)[_0x905f('0x24')](function(_0x38bb27){logger[_0x905f('0x25')](_0x905f('0x26'),_0x278e86,'request\x20sent');logger[_0x905f('0x27')](_0x905f('0x28'),_0x278e86,_0x905f('0x29'),JSON[_0x905f('0x2a')](_0x38bb27));if(_0x38bb27[_0x905f('0x2b')]){if(_0x38bb27['error'][_0x905f('0x2c')]===0x1f4){logger['error'](_0x905f('0x26'),_0x278e86,_0x38bb27[_0x905f('0x2b')]['message']);return _0x204db4(_0x38bb27[_0x905f('0x2b')]['message']);}logger[_0x905f('0x2b')]('WhatsappMessage,\x20%s,\x20%s',_0x278e86,_0x38bb27['error'][_0x905f('0x2d')]);return _0x4bdc4a(_0x38bb27[_0x905f('0x2b')][_0x905f('0x2d')]);}else{logger[_0x905f('0x25')](_0x905f('0x26'),_0x278e86,_0x905f('0x29'));_0x4bdc4a(_0x38bb27[_0x905f('0x2e')]['message']);}})[_0x905f('0x2f')](function(_0x3def52){logger[_0x905f('0x2b')]('WhatsappMessage,\x20%s,\x20%s',_0x278e86,_0x3def52);_0x204db4(_0x3def52);});});}function respondWithStatusCode(_0x5de988,_0x527fb5){_0x527fb5=_0x527fb5||0xcc;return function(_0x49d918){if(_0x49d918){return _0x5de988[_0x905f('0x30')](_0x527fb5);}return _0x5de988[_0x905f('0x31')](_0x527fb5)[_0x905f('0x32')]();};}function respondWithResult(_0xeb858a,_0x5c79f9){_0x5c79f9=_0x5c79f9||0xc8;return function(_0x30aae6){if(_0x30aae6){return _0xeb858a['status'](_0x5c79f9)[_0x905f('0x33')](_0x30aae6);}};}function respondWithFilteredResult(_0x42405d,_0x5b976f){return function(_0xc1df34){if(_0xc1df34){var _0x116f3e=_0xc1df34[_0x905f('0x34')],_0x3ae18c=_0x5b976f['offset'],_0x94cdcf=_0x5b976f[_0x905f('0x35')]+_0x5b976f[_0x905f('0x36')],_0x223eca;if(_0x94cdcf>=_0x116f3e){_0x94cdcf=_0x116f3e;_0x223eca=0xc8;}else{_0x223eca=0xce;}_0x42405d['status'](_0x223eca);return _0x42405d[_0x905f('0x37')]('Content-Range',_0x3ae18c+'-'+_0x94cdcf+'/'+_0x116f3e)[_0x905f('0x33')](_0xc1df34);}return null;};}function patchUpdates(_0x5d66b1){return function(_0x4531da){try{jsonpatch[_0x905f('0x38')](_0x4531da,_0x5d66b1,!![]);}catch(_0x3b758f){return BPromise[_0x905f('0x39')](_0x3b758f);}return _0x4531da[_0x905f('0x3a')]();};}function saveUpdates(_0xcbed46,_0xb1533){return function(_0x1bdd31){if(_0x1bdd31){return _0x1bdd31[_0x905f('0x3b')](_0xcbed46)[_0x905f('0x24')](function(_0x199968){return _0x199968;});}return null;};}function removeEntity(_0x590f9f,_0x382b2b){return function(_0x4d96f0){if(_0x4d96f0){return _0x4d96f0[_0x905f('0x3c')]()[_0x905f('0x24')](function(){_0x590f9f[_0x905f('0x31')](0xcc)[_0x905f('0x32')]();});}};}function handleEntityNotFound(_0x50e97d,_0x23b7a1){return function(_0x436394){if(!_0x436394){_0x50e97d[_0x905f('0x30')](0x194);}return _0x436394;};}function handleError(_0x3a9612,_0xcf9e47){_0xcf9e47=_0xcf9e47||0x1f4;return function(_0x129e3d){logger[_0x905f('0x2b')](_0x129e3d[_0x905f('0x3d')]);if(_0x129e3d[_0x905f('0x3e')]){delete _0x129e3d[_0x905f('0x3e')];}_0x3a9612[_0x905f('0x31')](_0xcf9e47)['send'](_0x129e3d);};}exports[_0x905f('0x3f')]=function(_0x13f388,_0x34aa21){var _0x40a173={},_0x2447f5={},_0x5661b0={'count':0x0,'rows':[]};var _0x106398=_[_0x905f('0x40')](db[_0x905f('0x41')][_0x905f('0x42')],function(_0x3125ed){return{'name':_0x3125ed[_0x905f('0x43')],'type':_0x3125ed[_0x905f('0x44')]['key']};});_0x2447f5[_0x905f('0x45')]=_[_0x905f('0x40')](_0x106398,_0x905f('0x3e'));_0x2447f5[_0x905f('0x46')]=_[_0x905f('0x47')](_0x13f388[_0x905f('0x46')]);_0x2447f5[_0x905f('0x48')]=_['intersection'](_0x2447f5[_0x905f('0x45')],_0x2447f5['query']);_0x40a173[_0x905f('0x49')]=_[_0x905f('0x4a')](_0x2447f5[_0x905f('0x45')],qs['fields'](_0x13f388[_0x905f('0x46')][_0x905f('0x4b')]));_0x40a173['attributes']=_0x40a173[_0x905f('0x49')]['length']?_0x40a173[_0x905f('0x49')]:_0x2447f5['model'];if(!_0x13f388['query'][_0x905f('0x4c')](_0x905f('0x4d'))){_0x40a173['limit']=qs[_0x905f('0x36')](_0x13f388[_0x905f('0x46')][_0x905f('0x36')]);_0x40a173[_0x905f('0x35')]=qs['offset'](_0x13f388['query'][_0x905f('0x35')]);}_0x40a173[_0x905f('0x4e')]=qs[_0x905f('0x4f')](_0x13f388[_0x905f('0x46')]['sort']);_0x40a173[_0x905f('0x50')]=qs['filters'](_['pick'](_0x13f388[_0x905f('0x46')],_0x2447f5[_0x905f('0x48')]),_0x106398);if(_0x13f388[_0x905f('0x46')]['filter']){_0x40a173[_0x905f('0x50')]=_['merge'](_0x40a173[_0x905f('0x50')],{'$or':_[_0x905f('0x40')](_0x106398,function(_0x5ada6c){if(_0x5ada6c[_0x905f('0x44')]!=='VIRTUAL'){var _0x14ca54={};_0x14ca54[_0x5ada6c['name']]={'$like':'%'+_0x13f388[_0x905f('0x46')]['filter']+'%'};return _0x14ca54;}})});}_0x40a173=_[_0x905f('0x51')]({},_0x40a173,_0x13f388['options']);var _0x9b6a4d={'where':_0x40a173[_0x905f('0x50')]};return db[_0x905f('0x41')][_0x905f('0x34')](_0x9b6a4d)[_0x905f('0x24')](function(_0x4e026d){_0x5661b0[_0x905f('0x34')]=_0x4e026d;if(_0x13f388[_0x905f('0x46')][_0x905f('0x52')]){_0x40a173['include']=[{'all':!![]}];}return db[_0x905f('0x41')][_0x905f('0x53')](_0x40a173);})['then'](function(_0x2a1b45){_0x5661b0[_0x905f('0x54')]=_0x2a1b45;return _0x5661b0;})['then'](respondWithFilteredResult(_0x34aa21,_0x40a173))['catch'](handleError(_0x34aa21,null));};exports[_0x905f('0x55')]=function(_0x303e3a,_0x136382){var _0x10097d={'raw':!![],'where':{'id':_0x303e3a['params']['id']}},_0x5d7c2d={};_0x5d7c2d[_0x905f('0x45')]=_['keys'](db[_0x905f('0x41')]['rawAttributes']);_0x5d7c2d[_0x905f('0x46')]=_[_0x905f('0x47')](_0x303e3a[_0x905f('0x46')]);_0x5d7c2d[_0x905f('0x48')]=_[_0x905f('0x4a')](_0x5d7c2d['model'],_0x5d7c2d[_0x905f('0x46')]);_0x10097d[_0x905f('0x49')]=_['intersection'](_0x5d7c2d['model'],qs[_0x905f('0x4b')](_0x303e3a[_0x905f('0x46')][_0x905f('0x4b')]));_0x10097d[_0x905f('0x49')]=_0x10097d[_0x905f('0x49')]['length']?_0x10097d[_0x905f('0x49')]:_0x5d7c2d[_0x905f('0x45')];if(_0x303e3a[_0x905f('0x46')][_0x905f('0x52')]){_0x10097d[_0x905f('0x56')]=[{'all':!![]}];}_0x10097d=_['merge']({},_0x10097d,_0x303e3a[_0x905f('0x57')]);return db[_0x905f('0x41')][_0x905f('0x58')](_0x10097d)[_0x905f('0x24')](handleEntityNotFound(_0x136382,null))[_0x905f('0x24')](respondWithResult(_0x136382,null))['catch'](handleError(_0x136382,null));};exports[_0x905f('0x59')]=function(_0x15c67e,_0x4155b1){return db[_0x905f('0x41')]['create'](_0x15c67e[_0x905f('0x5a')],{})[_0x905f('0x24')](respondWithResult(_0x4155b1,0xc9))[_0x905f('0x2f')](handleError(_0x4155b1,null));};exports[_0x905f('0x3b')]=function(_0x5d5c32,_0x4b7b65){if(_0x5d5c32[_0x905f('0x5a')]['id']){delete _0x5d5c32['body']['id'];}return db[_0x905f('0x41')][_0x905f('0x58')]({'where':{'id':_0x5d5c32[_0x905f('0x5b')]['id']}})[_0x905f('0x24')](handleEntityNotFound(_0x4b7b65,null))['then'](saveUpdates(_0x5d5c32['body'],null))[_0x905f('0x24')](respondWithResult(_0x4b7b65,null))[_0x905f('0x2f')](handleError(_0x4b7b65,null));};exports['destroy']=function(_0x2631d7,_0x259d3d){return db[_0x905f('0x41')][_0x905f('0x58')]({'where':{'id':_0x2631d7[_0x905f('0x5b')]['id']}})[_0x905f('0x24')](handleEntityNotFound(_0x259d3d,null))['then'](removeEntity(_0x259d3d,null))[_0x905f('0x2f')](handleError(_0x259d3d,null));};exports[_0x905f('0x5c')]=function(_0x51d6ab,_0x3b4790){return db[_0x905f('0x41')]['describe']()['then'](respondWithResult(_0x3b4790,null))[_0x905f('0x2f')](handleError(_0x3b4790,null));};var interaction_log=require(_0x905f('0x5d'))('whatsapp-interactions');exports[_0x905f('0x5e')]=function(_0x289e22,_0x46e712,_0xb6ebdd){var _0x136153={'channel':'whatsapp'};if(_0x289e22['body']['id']){delete _0x289e22[_0x905f('0x5a')]['id'];}_0x289e22[_0x905f('0x5a')][_0x905f('0x5f')]=!![];_0x289e22[_0x905f('0x5a')][_0x905f('0x60')]=moment()['format'](_0x905f('0x61'));_0x289e22[_0x905f('0x5a')][_0x905f('0x62')]=_0x289e22[_0x905f('0x5a')][_0x905f('0x62')]||_0x289e22[_0x905f('0x63')]['id'];return db[_0x905f('0x41')][_0x905f('0x58')]({'where':{'id':_0x289e22['params']['id'],'UserId':null},'include':[{'model':db[_0x905f('0x64')],'as':_0x905f('0x65')}]})['then'](handleEntityNotFound(_0x46e712,null))[_0x905f('0x24')](saveUpdates(_0x289e22[_0x905f('0x5a')],null))[_0x905f('0x24')](function(_0x34c58a){if(_0x34c58a){_0x136153[_0x905f('0x2d')]=_0x34c58a['get']({'plain':!![]});return db[_0x905f('0x66')][_0x905f('0x58')]({'where':{'id':_0x34c58a[_0x905f('0x67')]}});}return null;})[_0x905f('0x24')](handleEntityNotFound(_0x46e712,null))['then'](function(_0x5101f3){if(_0x5101f3){return _0x5101f3[_0x905f('0x3b')]({'UserId':_0x289e22[_0x905f('0x5a')][_0x905f('0x62')],'read1stAt':_[_0x905f('0x68')](_0x5101f3[_0x905f('0x69')])?moment()[_0x905f('0x6a')](_0x905f('0x61')):undefined});}return null;})[_0x905f('0x24')](function(_0x2fbf4e){if(_0x2fbf4e){_0x136153[_0x905f('0x6b')]=_0x2fbf4e['get']({'plain':!![]});interaction_log[_0x905f('0x25')](_0x905f('0x6c'),_0x289e22[_0x905f('0x63')]['id'],_0x289e22['user'][_0x905f('0x3e')],_0x289e22[_0x905f('0x63')][_0x905f('0x6d')],_0x136153[_0x905f('0x6b')]['id'],_0x289e22[_0x905f('0x5a')]?JSON[_0x905f('0x2a')](_0x289e22['body']):'null');return respondWithRpcPromise(_0x905f('0x6e'),_0x905f('0x6f'),_0x136153);}return null;})[_0x905f('0x24')](function(_0x5cdb79){if(_0x5cdb79){if(_0x289e22['body'][_0x905f('0x70')]){_0x136153[_0x905f('0x2d')][_0x905f('0x71')]=util['format'](_0x905f('0x72'),_0x289e22['user'][_0x905f('0x3e')]);_0x136153[_0x905f('0x2d')][_0x905f('0x73')]=_0x136153[_0x905f('0x73')];_0x136153[_0x905f('0x2d')][_0x905f('0x74')]=_0x905f('0x5e');return respondWithRpcPromise(_0x905f('0x75'),'EventManager',{'event':_0x905f('0x76'),'message':_0x136153[_0x905f('0x2d')]},client9002)['then'](function(){return _0x136153;});}return _0x136153;}return null;})[_0x905f('0x24')](respondWithResult(_0x46e712,null))['catch'](handleError(_0x46e712,null));};var interaction_log=require(_0x905f('0x5d'))(_0x905f('0x77'));exports[_0x905f('0x39')]=function(_0x4ff396,_0x110a45,_0x379ac7){var _0x2525e0={'agent':{},'channel':'whatsapp'};if(_0x4ff396['body']['id']){delete _0x4ff396[_0x905f('0x5a')]['id'];}_0x4ff396[_0x905f('0x5a')][_0x905f('0x62')]=_0x4ff396['body'][_0x905f('0x62')]||_0x4ff396[_0x905f('0x63')]['id'];_0x2525e0[_0x905f('0x78')]['id']=_0x4ff396[_0x905f('0x5a')][_0x905f('0x62')];return db['WhatsappMessage'][_0x905f('0x58')]({'where':{'id':_0x4ff396[_0x905f('0x5b')]['id'],'UserId':null}})[_0x905f('0x24')](handleEntityNotFound(_0x110a45,null))[_0x905f('0x24')](function(_0x4c5f76){if(_0x4c5f76){_0x2525e0['message']=_0x4c5f76['get']({'plain':!![]});return db[_0x905f('0x66')]['find']({'where':{'id':_0x4c5f76[_0x905f('0x67')]}});}return null;})[_0x905f('0x24')](handleEntityNotFound(_0x110a45,null))[_0x905f('0x24')](function(_0xfd1ca3){if(_0xfd1ca3){_0x2525e0[_0x905f('0x6b')]=_0xfd1ca3[_0x905f('0x79')]({'plain':!![]});interaction_log[_0x905f('0x25')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4ff396['user']['id'],_0x4ff396['user'][_0x905f('0x3e')],_0x4ff396['user'][_0x905f('0x6d')],_0x2525e0[_0x905f('0x6b')]['id'],_0x4ff396[_0x905f('0x5a')]?JSON[_0x905f('0x2a')](_0x4ff396[_0x905f('0x5a')]):_0x905f('0x7a'));return respondWithRpcPromise(_0x905f('0x7b'),'rejectMessage',_0x2525e0);}return null;})[_0x905f('0x24')](function(_0x12c69f){if(_0x12c69f){_0x12c69f[_0x905f('0x2d')][_0x905f('0x71')]=util[_0x905f('0x6a')]('SIP/%s',_0x4ff396['user'][_0x905f('0x3e')]);_0x12c69f['message']['channel']=_0x2525e0[_0x905f('0x73')];_0x12c69f[_0x905f('0x2d')][_0x905f('0x74')]='reject';respondWithRpcPromise(_0x905f('0x75'),_0x905f('0x75'),{'event':_0x905f('0x7c'),'message':_0x12c69f[_0x905f('0x2d')]},client9002);return _0x2525e0;}return null;})[_0x905f('0x24')](respondWithResult(_0x110a45,null))[_0x905f('0x2f')](handleError(_0x110a45,null));};exports['status']=function(_0x292ad7,_0x5424bc,_0x9f34d0){if(_0x292ad7['body']['id']){delete _0x292ad7[_0x905f('0x5a')]['id'];}var _0x56ecb3;return db[_0x905f('0x41')][_0x905f('0x58')]({'where':{'id':_0x292ad7[_0x905f('0x5b')]['id']}})[_0x905f('0x24')](handleEntityNotFound(_0x5424bc,null))[_0x905f('0x24')](function(_0x511637){if(_0x511637){_0x56ecb3=_0x511637;return db[_0x905f('0x7d')][_0x905f('0x58')]({'where':{'id':_0x511637['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x5424bc,null))[_0x905f('0x24')](function(_0x573bc1){if(_0x573bc1){logger['debug'](_0x905f('0x7e'),'status',_0x905f('0x7f'),_0x573bc1[_0x905f('0x44')],util['inspect'](_0x292ad7['body'],{'showHidden':![],'depth':null}));switch(_0x573bc1['type']){case _0x905f('0x80'):if(_0x292ad7[_0x905f('0x5a')]['MessageSid']&&_0x292ad7[_0x905f('0x5a')][_0x905f('0x81')]===_0x56ecb3['messageId']&&_0x292ad7[_0x905f('0x5a')][_0x905f('0x82')]&&_0x292ad7['body'][_0x905f('0x82')]===_0x905f('0x5f')){return _0x56ecb3[_0x905f('0x3b')]({'read':!![]});}else{logger[_0x905f('0x2b')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x905f('0x31'),_0x905f('0x80'),util[_0x905f('0x83')](_0x292ad7[_0x905f('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x56ecb3;}})[_0x905f('0x24')](respondWithResult(_0x5424bc,null))[_0x905f('0x2f')](handleError(_0x5424bc,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 2955185..ddf0710 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0xf17422,_0x36fff5){var _0x26a503=function(_0x40e663){while(--_0x40e663){_0xf17422['push'](_0xf17422['shift']());}};_0x26a503(++_0x36fff5);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a7f3c,_0x74b703){_0x4a7f3c=_0x4a7f3c-0x0;var _0x89d3ae=_0xb10b[_0x4a7f3c];return _0x89d3ae;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x3c54e1,_0x3440e5){var _0x125cde=function(_0x5f42e0){while(--_0x5f42e0){_0x3c54e1['push'](_0x3c54e1['shift']());}};_0x125cde(++_0x3440e5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x50cd31,_0x33368c){_0x50cd31=_0x50cd31-0x0;var _0x3143ef=_0x5f2f[_0x50cd31];return _0x3143ef;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index c25ece5..19b466b 100644 --- a/server/api/whatsappMessage/whatsappMessage.model.js +++ b/server/api/whatsappMessage/whatsappMessage.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeff3=['Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','messageId','fti_whatsapp_messages','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','accountSid','messages','create','body','whatsapp:','phone','remote','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect'];(function(_0x71e493,_0x4308b7){var _0x3d40ab=function(_0x29715){while(--_0x29715){_0x71e493['push'](_0x71e493['shift']());}};_0x3d40ab(++_0x4308b7);}(_0xeff3,0xc3));var _0x3eff=function(_0x4a8bad,_0x4bfb2f){_0x4a8bad=_0x4a8bad-0x0;var _0x30cf32=_0xeff3[_0x4a8bad];return _0x30cf32;};'use strict';var _=require('lodash');var util=require(_0x3eff('0x0'));var logger=require(_0x3eff('0x1'))(_0x3eff('0x2'));var moment=require(_0x3eff('0x3'));var BPromise=require(_0x3eff('0x4'));var rp=require(_0x3eff('0x5'));var fs=require('fs');var path=require(_0x3eff('0x6'));var rimraf=require(_0x3eff('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0x3eff('0x8')]=function(_0x5af8a7,_0xae5149){return _0x5af8a7[_0x3eff('0x9')]('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x3eff('0xa'),'fields':[_0x3eff('0xa')]},{'name':_0x3eff('0xb'),'fields':['body'],'type':_0x3eff('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b3b43,_0x4b8d44,_0xc14255){var _0x58b5dc=_0x5af8a7[_0x3eff('0xd')];var _0x3d03cb=_0x2b3b43['get']({'plain':!![]});if(_0x3d03cb[_0x3eff('0xe')][_0x3eff('0xf')]()==='in'||_0x3d03cb[_0x3eff('0xe')][_0x3eff('0xf')]()===_0x3eff('0x10')&&!_0x3d03cb[_0x3eff('0x11')]&&!_['isNil'](_0x3d03cb[_0x3eff('0x12')])){_0x58b5dc[_0x3eff('0x13')][_0x3eff('0x14')]({'where':{'id':_0x3d03cb[_0x3eff('0x15')]}})[_0x3eff('0x16')](function(_0x383592){if(_0x383592){_0x383592[_0x3eff('0x17')]({'lastMsgAt':_0x3d03cb[_0x3eff('0x18')],'lastMsgDirection':_0x3d03cb[_0x3eff('0xe')]['toLowerCase']()});}})[_0x3eff('0x19')](function(_0x9ac668){console[_0x3eff('0x1a')](_0x9ac668);});}if(_0x3d03cb[_0x3eff('0xe')]===_0x3eff('0x10')&&!_0x3d03cb[_0x3eff('0x11')]){var _0x513c9f;_0x58b5dc[_0x3eff('0x1b')][_0x3eff('0x1c')]({'where':{'id':_0x3d03cb[_0x3eff('0x1d')]},'raw':!![]})[_0x3eff('0x16')](function(_0x2ffb30){_0x513c9f=_0x2ffb30;if(_0x513c9f&&_0x513c9f[_0x3eff('0x1e')]){switch(_0x513c9f[_0x3eff('0x1e')]){case'twilio':var _0x16b3d9=require(_0x3eff('0x1f'));if(_0x513c9f['accountSid']&&_0x513c9f[_0x3eff('0x20')]&&_0x513c9f['phone']){var _0x4d2fa4=new _0x16b3d9(_0x513c9f[_0x3eff('0x21')],_0x513c9f[_0x3eff('0x20')]);_0x4d2fa4[_0x3eff('0x22')][_0x3eff('0x23')]({'body':_0x3d03cb[_0x3eff('0x24')],'to':_0x3eff('0x25')+_0x3d03cb[_0x3eff('0x26')],'from':_0x3eff('0x25')+_0x513c9f['phone'],'statusCallback':_0x513c9f[_0x3eff('0x27')]+'/api/whatsapp/messages/'+_0x3d03cb['id']+_0x3eff('0x28')+_0x513c9f['token']})[_0x3eff('0x16')](function(_0x5196aa){if(_0x5196aa[_0x3eff('0x29')]){return _0x2b3b43[_0x3eff('0x17')]({'messageId':_0x5196aa[_0x3eff('0x29')]});}})[_0x3eff('0x19')](function(_0x248363){logger[_0x3eff('0x1a')](_0x3eff('0x2a'),_0x3eff('0x2b'),_0x3eff('0x1f'),util[_0x3eff('0x2c')](_0x248363,{'showHidden':![],'depth':null}));});}else{logger[_0x3eff('0x1a')](_0x3eff('0x2a'),_0x3eff('0x2b'),'twilio',_0x3eff('0x2d'));}break;}}})[_0x3eff('0x2e')](function(){_0xc14255();});}else{_0xc14255();}}},'charset':'utf8mb4','collate':_0x3eff('0x2f')});}; \ No newline at end of file +var _0xec7e=['messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','secret','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','whatsapp:','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','whatsapp_messages'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0xec7e,0x83));var _0xeec7=function(_0x2a191b,_0x53e5ce){_0x2a191b=_0x2a191b-0x0;var _0x488906=_0xec7e[_0x2a191b];return _0x488906;};'use strict';var _=require(_0xeec7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xeec7('0x1'));var moment=require(_0xeec7('0x2'));var BPromise=require(_0xeec7('0x3'));var rp=require(_0xeec7('0x4'));var fs=require('fs');var path=require(_0xeec7('0x5'));var rimraf=require('rimraf');var config=require(_0xeec7('0x6'));var attributes=require('./whatsappMessage.attributes');module[_0xeec7('0x7')]=function(_0x53fd2d,_0x440434){return _0x53fd2d[_0xeec7('0x8')]('WhatsappMessage',attributes,{'tableName':_0xeec7('0x9'),'paranoid':![],'indexes':[{'name':_0xeec7('0xa'),'fields':[_0xeec7('0xa')]},{'name':_0xeec7('0xb'),'fields':[_0xeec7('0xc')],'type':_0xeec7('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4af3f7,_0x249e71,_0x3217e6){var _0x2d4482=_0x53fd2d[_0xeec7('0xe')];var _0x5e0916=_0x4af3f7[_0xeec7('0xf')]({'plain':!![]});if(_0x5e0916[_0xeec7('0x10')][_0xeec7('0x11')]()==='in'||_0x5e0916[_0xeec7('0x10')][_0xeec7('0x11')]()===_0xeec7('0x12')&&!_0x5e0916['secret']&&!_[_0xeec7('0x13')](_0x5e0916[_0xeec7('0x14')])){_0x2d4482[_0xeec7('0x15')][_0xeec7('0x16')]({'where':{'id':_0x5e0916[_0xeec7('0x17')]}})[_0xeec7('0x18')](function(_0x4cb8dd){if(_0x4cb8dd){_0x4cb8dd[_0xeec7('0x19')]({'lastMsgAt':_0x5e0916[_0xeec7('0x1a')],'lastMsgDirection':_0x5e0916[_0xeec7('0x10')][_0xeec7('0x11')]()});}})[_0xeec7('0x1b')](function(_0x93ae7d){console[_0xeec7('0x1c')](_0x93ae7d);});}if(_0x5e0916['direction']===_0xeec7('0x12')&&!_0x5e0916[_0xeec7('0x1d')]){var _0x8f0cef;_0x2d4482['WhatsappAccount']['find']({'where':{'id':_0x5e0916[_0xeec7('0x1e')]},'raw':!![]})['then'](function(_0x25d309){_0x8f0cef=_0x25d309;if(_0x8f0cef&&_0x8f0cef['type']){switch(_0x8f0cef[_0xeec7('0x1f')]){case _0xeec7('0x20'):var _0x1f2dee=require(_0xeec7('0x20'));if(_0x8f0cef['accountSid']&&_0x8f0cef[_0xeec7('0x21')]&&_0x8f0cef[_0xeec7('0x22')]){var _0x5a22d3=new _0x1f2dee(_0x8f0cef[_0xeec7('0x23')],_0x8f0cef[_0xeec7('0x21')]);_0x5a22d3[_0xeec7('0x24')]['create']({'body':_0x5e0916[_0xeec7('0xc')],'to':_0xeec7('0x25')+_0x5e0916[_0xeec7('0x22')],'from':_0xeec7('0x25')+_0x8f0cef[_0xeec7('0x22')],'statusCallback':_0x8f0cef['remote']+_0xeec7('0x26')+_0x5e0916['id']+_0xeec7('0x27')+_0x8f0cef[_0xeec7('0x28')]})[_0xeec7('0x18')](function(_0x590230){if(_0x590230[_0xeec7('0x29')]){return _0x4af3f7[_0xeec7('0x19')]({'messageId':_0x590230[_0xeec7('0x29')]});}})[_0xeec7('0x1b')](function(_0xd7231d){logger[_0xeec7('0x1c')](_0xeec7('0x2a'),'afterCreate',_0xeec7('0x20'),util['inspect'](_0xd7231d,{'showHidden':![],'depth':null}));});}else{logger[_0xeec7('0x1c')](_0xeec7('0x2a'),'afterCreate',_0xeec7('0x20'),_0xeec7('0x2b'));}break;}}})[_0xeec7('0x2c')](function(){_0x3217e6();});}else{_0x3217e6();}}},'charset':_0xeec7('0x2d'),'collate':_0xeec7('0x2e')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 59d7ced..afb7b68 100644 --- a/server/api/whatsappMessage/whatsappMessage.rpc.js +++ b/server/api/whatsappMessage/whatsappMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31e3=['register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','WhatsappMessage','create','body','options','then','CreateWhatsappMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket'];(function(_0x573dd6,_0x5c0e71){var _0x86b700=function(_0x18f9b5){while(--_0x18f9b5){_0x573dd6['push'](_0x573dd6['shift']());}};_0x86b700(++_0x5c0e71);}(_0x31e3,0x10e));var _0x331e=function(_0x400a1e,_0x2023a5){_0x400a1e=_0x400a1e-0x0;var _0x24536b=_0x31e3[_0x400a1e];return _0x24536b;};'use strict';var _=require(_0x331e('0x0'));var util=require(_0x331e('0x1'));var moment=require(_0x331e('0x2'));var BPromise=require(_0x331e('0x3'));var rs=require(_0x331e('0x4'));var fs=require('fs');var Redis=require(_0x331e('0x5'));var db=require(_0x331e('0x6'))['db'];var utils=require(_0x331e('0x7'));var logger=require(_0x331e('0x8'))(_0x331e('0x9'));var config=require(_0x331e('0xa'));var jayson=require(_0x331e('0xb'));var client=jayson[_0x331e('0xc')]['http']({'port':0x232a});config[_0x331e('0xd')]=_[_0x331e('0xe')](config[_0x331e('0xd')],{'host':_0x331e('0xf'),'port':0x18eb});var socket=require(_0x331e('0x10'))(new Redis(config[_0x331e('0xd')]));require(_0x331e('0x11'))[_0x331e('0x12')](socket);function respondWithRpcPromise(_0x25b2fa,_0xe60935,_0x3d8713){return new BPromise(function(_0x5c2f61,_0x9675d4){return client[_0x331e('0x13')](_0x25b2fa,_0x3d8713)['then'](function(_0x149149){logger[_0x331e('0x14')](_0x331e('0x15'),_0xe60935,_0x331e('0x16'));logger[_0x331e('0x17')](_0x331e('0x18'),_0xe60935,_0x331e('0x16'),JSON['stringify'](_0x149149));if(_0x149149[_0x331e('0x19')]){if(_0x149149['error'][_0x331e('0x1a')]===0x1f4){logger[_0x331e('0x19')](_0x331e('0x15'),_0xe60935,_0x149149[_0x331e('0x19')][_0x331e('0x1b')]);return _0x9675d4(_0x149149['error'][_0x331e('0x1b')]);}logger[_0x331e('0x19')](_0x331e('0x15'),_0xe60935,_0x149149['error'][_0x331e('0x1b')]);return _0x5c2f61(_0x149149[_0x331e('0x19')][_0x331e('0x1b')]);}else{logger[_0x331e('0x14')](_0x331e('0x15'),_0xe60935,'request\x20sent');_0x5c2f61(_0x149149[_0x331e('0x1c')][_0x331e('0x1b')]);}})[_0x331e('0x1d')](function(_0x5b6b08){logger['error'](_0x331e('0x15'),_0xe60935,_0x5b6b08);_0x9675d4(_0x5b6b08);});});}exports['CreateWhatsappMessage']=function(_0x4e53da){var _0x4ad093=this;return new Promise(function(_0x39461e,_0x3db67f){return db[_0x331e('0x1e')][_0x331e('0x1f')](_0x4e53da[_0x331e('0x20')],{'raw':_0x4e53da[_0x331e('0x21')]?_0x4e53da[_0x331e('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x331e('0x22')](function(_0xace1b6){logger['info'](_0x331e('0x23'),_0x4e53da);logger['debug'](_0x331e('0x23'),_0x4e53da,JSON['stringify'](_0xace1b6));_0x39461e(_0xace1b6);})['catch'](function(_0x4bf86a){logger[_0x331e('0x19')](_0x331e('0x23'),_0x4bf86a[_0x331e('0x1b')],_0x4e53da);_0x3db67f(_0x4ad093[_0x331e('0x19')](0x1f4,_0x4bf86a['message']));});});}; \ No newline at end of file +var _0x1058=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','socket.io-emitter','./whatsappMessage.socket','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','lodash','util'];(function(_0x417ca3,_0x54f30a){var _0x5f4ded=function(_0x46e366){while(--_0x46e366){_0x417ca3['push'](_0x417ca3['shift']());}};_0x5f4ded(++_0x54f30a);}(_0x1058,0x1de));var _0x8105=function(_0x50929b,_0x448269){_0x50929b=_0x50929b-0x0;var _0x4db45d=_0x1058[_0x50929b];return _0x4db45d;};'use strict';var _=require(_0x8105('0x0'));var util=require(_0x8105('0x1'));var moment=require(_0x8105('0x2'));var BPromise=require(_0x8105('0x3'));var rs=require(_0x8105('0x4'));var fs=require('fs');var Redis=require(_0x8105('0x5'));var db=require(_0x8105('0x6'))['db'];var utils=require(_0x8105('0x7'));var logger=require(_0x8105('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8105('0x9'));var client=jayson[_0x8105('0xa')][_0x8105('0xb')]({'port':0x232a});config['redis']=_[_0x8105('0xc')](config[_0x8105('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x8105('0xe'))(new Redis(config['redis']));require(_0x8105('0xf'))[_0x8105('0x10')](socket);function respondWithRpcPromise(_0x4885d5,_0x52cfbc,_0x297a4f){return new BPromise(function(_0x5d788f,_0x57f466){return client[_0x8105('0x11')](_0x4885d5,_0x297a4f)['then'](function(_0x3b7b2b){logger[_0x8105('0x12')](_0x8105('0x13'),_0x52cfbc,_0x8105('0x14'));logger[_0x8105('0x15')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x52cfbc,_0x8105('0x14'),JSON[_0x8105('0x16')](_0x3b7b2b));if(_0x3b7b2b['error']){if(_0x3b7b2b[_0x8105('0x17')]['code']===0x1f4){logger[_0x8105('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x52cfbc,_0x3b7b2b[_0x8105('0x17')][_0x8105('0x18')]);return _0x57f466(_0x3b7b2b['error'][_0x8105('0x18')]);}logger[_0x8105('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x52cfbc,_0x3b7b2b[_0x8105('0x17')][_0x8105('0x18')]);return _0x5d788f(_0x3b7b2b[_0x8105('0x17')][_0x8105('0x18')]);}else{logger[_0x8105('0x12')](_0x8105('0x13'),_0x52cfbc,_0x8105('0x14'));_0x5d788f(_0x3b7b2b[_0x8105('0x19')][_0x8105('0x18')]);}})[_0x8105('0x1a')](function(_0x254476){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x52cfbc,_0x254476);_0x57f466(_0x254476);});});}exports[_0x8105('0x1b')]=function(_0x27f49d){var _0x20d2c2=this;return new Promise(function(_0x3caa8d,_0x37570d){return db[_0x8105('0x1c')][_0x8105('0x1d')](_0x27f49d[_0x8105('0x1e')],{'raw':_0x27f49d['options']?_0x27f49d[_0x8105('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xb5f611){logger[_0x8105('0x12')]('CreateWhatsappMessage',_0x27f49d);logger[_0x8105('0x15')](_0x8105('0x1b'),_0x27f49d,JSON[_0x8105('0x16')](_0xb5f611));_0x3caa8d(_0xb5f611);})[_0x8105('0x1a')](function(_0x5a639c){logger[_0x8105('0x17')](_0x8105('0x1b'),_0x5a639c[_0x8105('0x18')],_0x27f49d);_0x37570d(_0x20d2c2[_0x8105('0x17')](0x1f4,_0x5a639c[_0x8105('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 0054d53..4a8bc13 100644 --- a/server/api/whatsappMessage/whatsappMessage.socket.js +++ b/server/api/whatsappMessage/whatsappMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ca8=['save','remove','update','removeListener','length','./whatsappMessage.events'];(function(_0x245208,_0x5ed2c6){var _0x5187dc=function(_0x3aa563){while(--_0x3aa563){_0x245208['push'](_0x245208['shift']());}};_0x5187dc(++_0x5ed2c6);}(_0x5ca8,0x71));var _0x85ca=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5ca8[_0x57b54c];return _0x59cc19;};'use strict';var WhatsappMessageEvents=require(_0x85ca('0x0'));var events=[_0x85ca('0x1'),_0x85ca('0x2'),_0x85ca('0x3')];function createListener(_0x41050d,_0x32140c){return function(_0xf0e3fc){_0x32140c['emit'](_0x41050d,_0xf0e3fc);};}function removeListener(_0x28f2d3,_0x110d3a){return function(){WhatsappMessageEvents[_0x85ca('0x4')](_0x28f2d3,_0x110d3a);};}exports['register']=function(_0x27627e){for(var _0x4bef1e=0x0,_0x248c30=events[_0x85ca('0x5')];_0x4bef1e<_0x248c30;_0x4bef1e++){var _0x27c10b=events[_0x4bef1e];var _0x11e91b=createListener('whatsappMessage:'+_0x27c10b,_0x27627e);WhatsappMessageEvents['on'](_0x27c10b,_0x11e91b);}}; \ No newline at end of file +var _0xab72=['removeListener','register','whatsappMessage:','remove','update','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xab72,0x123));var _0x2ab7=function(_0x76782a,_0x815cde){_0x76782a=_0x76782a-0x0;var _0x29ebb6=_0xab72[_0x76782a];return _0x29ebb6;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0x2ab7('0x0'),_0x2ab7('0x1')];function createListener(_0xf333d0,_0x27dedd){return function(_0x28fc27){_0x27dedd[_0x2ab7('0x2')](_0xf333d0,_0x28fc27);};}function removeListener(_0x34540d,_0x34d14a){return function(){WhatsappMessageEvents[_0x2ab7('0x3')](_0x34540d,_0x34d14a);};}exports[_0x2ab7('0x4')]=function(_0x6919d7){for(var _0x1177cd=0x0,_0x49c770=events['length'];_0x1177cd<_0x49c770;_0x1177cd++){var _0x10b8ef=events[_0x1177cd];var _0x3be695=createListener(_0x2ab7('0x5')+_0x10b8ef,_0x6919d7);WhatsappMessageEvents['on'](_0x10b8ef,_0x3be695);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 485e367..5dfe8b5 100644 --- a/server/api/whatsappQueue/index.js +++ b/server/api/whatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x144d=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','create','post','addTeams','addAgents','put','destroy','delete','removeTeams','removeAgents','exports'];(function(_0x24faaf,_0x5e2f27){var _0x1197ae=function(_0x40ffd5){while(--_0x40ffd5){_0x24faaf['push'](_0x24faaf['shift']());}};_0x1197ae(++_0x5e2f27);}(_0x144d,0x155));var _0xd144=function(_0x204c5a,_0x1a588a){_0x204c5a=_0x204c5a-0x0;var _0x2927d5=_0x144d[_0x204c5a];return _0x2927d5;};'use strict';var multer=require(_0xd144('0x0'));var util=require(_0xd144('0x1'));var path=require(_0xd144('0x2'));var timeout=require(_0xd144('0x3'));var express=require(_0xd144('0x4'));var router=express[_0xd144('0x5')]();var auth=require(_0xd144('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd144('0x7'));var controller=require(_0xd144('0x8'));router[_0xd144('0x9')]('/',auth[_0xd144('0xa')](),controller[_0xd144('0xb')]);router[_0xd144('0x9')](_0xd144('0xc'),auth[_0xd144('0xa')](),controller[_0xd144('0xd')]);router[_0xd144('0x9')](_0xd144('0xe'),auth[_0xd144('0xa')](),controller[_0xd144('0xf')]);router[_0xd144('0x9')](_0xd144('0x10'),auth[_0xd144('0xa')](),controller[_0xd144('0x11')]);router[_0xd144('0x9')](_0xd144('0x12'),auth['isAuthenticated'](),controller['getTeams']);router[_0xd144('0x9')](_0xd144('0x13'),auth['isAuthenticated'](),controller[_0xd144('0x14')]);router['post']('/',auth[_0xd144('0xa')](),controller[_0xd144('0x15')]);router[_0xd144('0x16')](_0xd144('0x12'),auth[_0xd144('0xa')](),controller[_0xd144('0x17')]);router[_0xd144('0x16')](_0xd144('0x13'),auth[_0xd144('0xa')](),controller[_0xd144('0x18')]);router[_0xd144('0x19')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xd144('0xe'),auth[_0xd144('0xa')](),controller[_0xd144('0x1a')]);router[_0xd144('0x1b')](_0xd144('0x12'),auth[_0xd144('0xa')](),controller[_0xd144('0x1c')]);router[_0xd144('0x1b')](_0xd144('0x13'),auth[_0xd144('0xa')](),controller[_0xd144('0x1d')]);module[_0xd144('0x1e')]=router; \ No newline at end of file +var _0xe604=['removeAgents','util','connect-timeout','Router','../../config/environment','./whatsappQueue.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','post','addAgents','put','update','delete','removeTeams'];(function(_0x353d59,_0xbc0e8e){var _0x59d50f=function(_0x397865){while(--_0x397865){_0x353d59['push'](_0x353d59['shift']());}};_0x59d50f(++_0xbc0e8e);}(_0xe604,0xdd));var _0x4e60=function(_0x52b3e3,_0x4a3615){_0x52b3e3=_0x52b3e3-0x0;var _0x31b17d=_0xe604[_0x52b3e3];return _0x31b17d;};'use strict';var multer=require('multer');var util=require(_0x4e60('0x0'));var path=require('path');var timeout=require(_0x4e60('0x1'));var express=require('express');var router=express[_0x4e60('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4e60('0x3'));var controller=require(_0x4e60('0x4'));router['get']('/',auth[_0x4e60('0x5')](),controller['index']);router[_0x4e60('0x6')](_0x4e60('0x7'),auth[_0x4e60('0x5')](),controller[_0x4e60('0x8')]);router[_0x4e60('0x6')](_0x4e60('0x9'),auth[_0x4e60('0x5')](),controller[_0x4e60('0xa')]);router[_0x4e60('0x6')](_0x4e60('0xb'),auth[_0x4e60('0x5')](),controller[_0x4e60('0xc')]);router[_0x4e60('0x6')](_0x4e60('0xd'),auth[_0x4e60('0x5')](),controller['getTeams']);router[_0x4e60('0x6')](_0x4e60('0xe'),auth['isAuthenticated'](),controller['getAgents']);router[_0x4e60('0xf')]('/',auth[_0x4e60('0x5')](),controller['create']);router[_0x4e60('0xf')](_0x4e60('0xd'),auth[_0x4e60('0x5')](),controller['addTeams']);router['post']('/:id/users',auth[_0x4e60('0x5')](),controller[_0x4e60('0x10')]);router[_0x4e60('0x11')](_0x4e60('0x9'),auth[_0x4e60('0x5')](),controller[_0x4e60('0x12')]);router['delete']('/:id',auth[_0x4e60('0x5')](),controller['destroy']);router[_0x4e60('0x13')](_0x4e60('0xd'),auth[_0x4e60('0x5')](),controller[_0x4e60('0x14')]);router[_0x4e60('0x13')](_0x4e60('0xe'),auth[_0x4e60('0x5')](),controller[_0x4e60('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 8af1312..64af4a4 100644 --- a/server/api/whatsappQueue/whatsappQueue.attributes.js +++ b/server/api/whatsappQueue/whatsappQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6f5=['beepall','roundrobin','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xc6f5,0x1f2));var _0x5c6f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc6f5[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0x5c6f('0x0')]={'name':{'type':Sequelize[_0x5c6f('0x1')],'unique':_0x5c6f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x5c6f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5c6f('0x4')](_0x5c6f('0x5'),_0x5c6f('0x6'),_0x5c6f('0x7'))},'description':{'type':Sequelize[_0x5c6f('0x1')]}}; \ No newline at end of file +var _0xa422=['beepall','roundrobin','sequelize','INTEGER','ENUM'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xa422,0x16f));var _0x2a42=function(_0x3715df,_0x578cb0){_0x3715df=_0x3715df-0x0;var _0xdf69b=_0xa422[_0x3715df];return _0xdf69b;};'use strict';var Sequelize=require(_0x2a42('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x2a42('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2a42('0x2')]('rrmemory',_0x2a42('0x3'),_0x2a42('0x4'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 2a79b7b..7fcc1f4 100644 --- a/server/api/whatsappQueue/whatsappQueue.controller.js +++ b/server/api/whatsappQueue/whatsappQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x68e8=['findAll','findAndCountAll','UserId','agent','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','Team','getTeams','addTeams','ids','User','Agents','online','interface','flatMap','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','value','isEmpty','userWhatsappQueue:remove','addAgents','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','then','WhatsappQueues','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','WhatsappQueue','rows','catch','show','params','length','find','create','body','user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','WhatsappQueueId'];(function(_0x1d9ba7,_0x3709a2){var _0xfbb9c9=function(_0x17ee9f){while(--_0x17ee9f){_0x1d9ba7['push'](_0x1d9ba7['shift']());}};_0xfbb9c9(++_0x3709a2);}(_0x68e8,0x1d4));var _0x868e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x68e8[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x868e('0x0'));var emlformat=require(_0x868e('0x1'));var rimraf=require(_0x868e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x868e('0x3'));var rp=require(_0x868e('0x4'));var moment=require('moment');var BPromise=require(_0x868e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x868e('0x6'));var sox=require(_0x868e('0x7'));var csv=require(_0x868e('0x8'));var ejs=require(_0x868e('0x9'));var fs=require('fs');var _=require(_0x868e('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x868e('0xb'));var deskjs=require(_0x868e('0xc'));var toCsv=require(_0x868e('0x8'));var querystring=require(_0x868e('0xd'));var Papa=require(_0x868e('0xe'));var Redis=require(_0x868e('0xf'));var authService=require(_0x868e('0x10'));var qs=require(_0x868e('0x11'));var as=require(_0x868e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x868e('0x13'));var config=require(_0x868e('0x14'));var db=require(_0x868e('0x15'))['db'];config[_0x868e('0x16')]=_[_0x868e('0x17')](config[_0x868e('0x16')],{'host':_0x868e('0x18'),'port':0x18eb});var socket=require(_0x868e('0x19'))(new Redis(config[_0x868e('0x16')]));require(_0x868e('0x1a'))[_0x868e('0x1b')](socket);function respondWithStatusCode(_0x517fc2,_0x5aadfc){_0x5aadfc=_0x5aadfc||0xcc;return function(_0xbaf4ff){if(_0xbaf4ff){return _0x517fc2[_0x868e('0x1c')](_0x5aadfc);}return _0x517fc2['status'](_0x5aadfc)[_0x868e('0x1d')]();};}function respondWithResult(_0x14c5d8,_0x1d7cce){_0x1d7cce=_0x1d7cce||0xc8;return function(_0x4800f6){if(_0x4800f6){return _0x14c5d8[_0x868e('0x1e')](_0x1d7cce)['json'](_0x4800f6);}};}function respondWithFilteredResult(_0x3b110c,_0x125f22){return function(_0x27e336){if(_0x27e336){var _0x13e5c4=_0x27e336[_0x868e('0x1f')],_0xd4dd74=_0x125f22[_0x868e('0x20')],_0x14889b=_0x125f22['offset']+_0x125f22[_0x868e('0x21')],_0x2fe657;if(_0x14889b>=_0x13e5c4){_0x14889b=_0x13e5c4;_0x2fe657=0xc8;}else{_0x2fe657=0xce;}_0x3b110c[_0x868e('0x1e')](_0x2fe657);return _0x3b110c[_0x868e('0x22')](_0x868e('0x23'),_0xd4dd74+'-'+_0x14889b+'/'+_0x13e5c4)[_0x868e('0x24')](_0x27e336);}return null;};}function patchUpdates(_0x3e4f92){return function(_0x89045){try{jsonpatch[_0x868e('0x25')](_0x89045,_0x3e4f92,!![]);}catch(_0x2a9961){return BPromise['reject'](_0x2a9961);}return _0x89045[_0x868e('0x26')]();};}function saveUpdates(_0x221bc3,_0x2467b3){return function(_0x406fd6){if(_0x406fd6){return _0x406fd6[_0x868e('0x27')](_0x221bc3)['then'](function(_0x2e07bb){return _0x2e07bb;});}return null;};}function removeEntity(_0x5a2cd1,_0x4ab0b0){return function(_0x1cd121){if(_0x1cd121){return _0x1cd121[_0x868e('0x28')]()[_0x868e('0x29')](function(){var _0xeac1e2=_0x1cd121['get']({'plain':!![]});var _0x34987a=_0x868e('0x2a');return db['UserProfileResource'][_0x868e('0x28')]({'where':{'type':_0x34987a,'resourceId':_0xeac1e2['id']}})['then'](function(){return _0x1cd121;});})[_0x868e('0x29')](function(){_0x5a2cd1[_0x868e('0x1e')](0xcc)[_0x868e('0x1d')]();});}};}function handleEntityNotFound(_0x1aef9a,_0x1fb34c){return function(_0x2596ea){if(!_0x2596ea){_0x1aef9a[_0x868e('0x1c')](0x194);}return _0x2596ea;};}function handleError(_0x2365df,_0x104f1c){_0x104f1c=_0x104f1c||0x1f4;return function(_0x16c86e){logger['error'](_0x16c86e[_0x868e('0x2b')]);if(_0x16c86e[_0x868e('0x2c')]){delete _0x16c86e[_0x868e('0x2c')];}_0x2365df[_0x868e('0x1e')](_0x104f1c)[_0x868e('0x2d')](_0x16c86e);};}exports[_0x868e('0x2e')]=function(_0x59bf0a,_0x2f263a){var _0x232433={},_0x300d02={},_0x50eaf5={'count':0x0,'rows':[]};var _0x41d2ea=_[_0x868e('0x2f')](db['WhatsappQueue'][_0x868e('0x30')],function(_0x2619d8){return{'name':_0x2619d8[_0x868e('0x31')],'type':_0x2619d8[_0x868e('0x32')]['key']};});_0x300d02[_0x868e('0x33')]=_[_0x868e('0x2f')](_0x41d2ea,_0x868e('0x2c'));_0x300d02[_0x868e('0x34')]=_[_0x868e('0x35')](_0x59bf0a[_0x868e('0x34')]);_0x300d02[_0x868e('0x36')]=_[_0x868e('0x37')](_0x300d02[_0x868e('0x33')],_0x300d02['query']);_0x232433[_0x868e('0x38')]=_['intersection'](_0x300d02[_0x868e('0x33')],qs[_0x868e('0x39')](_0x59bf0a[_0x868e('0x34')][_0x868e('0x39')]));_0x232433[_0x868e('0x38')]=_0x232433['attributes']['length']?_0x232433[_0x868e('0x38')]:_0x300d02['model'];if(!_0x59bf0a['query']['hasOwnProperty']('nolimit')){_0x232433[_0x868e('0x21')]=qs[_0x868e('0x21')](_0x59bf0a[_0x868e('0x34')]['limit']);_0x232433[_0x868e('0x20')]=qs[_0x868e('0x20')](_0x59bf0a['query'][_0x868e('0x20')]);}_0x232433[_0x868e('0x3a')]=qs[_0x868e('0x3b')](_0x59bf0a['query'][_0x868e('0x3b')]);_0x232433['where']=qs[_0x868e('0x36')](_[_0x868e('0x3c')](_0x59bf0a[_0x868e('0x34')],_0x300d02['filters']),_0x41d2ea);if(_0x59bf0a[_0x868e('0x34')][_0x868e('0x3d')]){_0x232433[_0x868e('0x3e')]=_[_0x868e('0x3f')](_0x232433['where'],{'$or':_[_0x868e('0x2f')](_0x41d2ea,function(_0x2ffd94){if(_0x2ffd94['type']!==_0x868e('0x40')){var _0x142599={};_0x142599[_0x2ffd94['name']]={'$like':'%'+_0x59bf0a[_0x868e('0x34')]['filter']+'%'};return _0x142599;}})});}_0x232433=_['merge']({},_0x232433,_0x59bf0a[_0x868e('0x41')]);var _0x4e7a40={'where':_0x232433[_0x868e('0x3e')]};return db['WhatsappQueue'][_0x868e('0x1f')](_0x4e7a40)[_0x868e('0x29')](function(_0x31bb25){_0x50eaf5['count']=_0x31bb25;if(_0x59bf0a[_0x868e('0x34')][_0x868e('0x42')]){_0x232433[_0x868e('0x43')]=[{'all':!![]}];}return db[_0x868e('0x44')]['findAll'](_0x232433);})[_0x868e('0x29')](function(_0x4fd34a){_0x50eaf5[_0x868e('0x45')]=_0x4fd34a;return _0x50eaf5;})['then'](respondWithFilteredResult(_0x2f263a,_0x232433))[_0x868e('0x46')](handleError(_0x2f263a,null));};exports[_0x868e('0x47')]=function(_0x481fdc,_0x478057){var _0x2de1a6={'raw':!![],'where':{'id':_0x481fdc[_0x868e('0x48')]['id']}},_0x49f23e={};_0x49f23e[_0x868e('0x33')]=_[_0x868e('0x35')](db[_0x868e('0x44')][_0x868e('0x30')]);_0x49f23e[_0x868e('0x34')]=_[_0x868e('0x35')](_0x481fdc['query']);_0x49f23e['filters']=_[_0x868e('0x37')](_0x49f23e[_0x868e('0x33')],_0x49f23e[_0x868e('0x34')]);_0x2de1a6[_0x868e('0x38')]=_[_0x868e('0x37')](_0x49f23e['model'],qs['fields'](_0x481fdc[_0x868e('0x34')][_0x868e('0x39')]));_0x2de1a6[_0x868e('0x38')]=_0x2de1a6[_0x868e('0x38')][_0x868e('0x49')]?_0x2de1a6['attributes']:_0x49f23e[_0x868e('0x33')];if(_0x481fdc[_0x868e('0x34')]['includeAll']){_0x2de1a6[_0x868e('0x43')]=[{'all':!![]}];}_0x2de1a6=_[_0x868e('0x3f')]({},_0x2de1a6,_0x481fdc['options']);return db[_0x868e('0x44')][_0x868e('0x4a')](_0x2de1a6)[_0x868e('0x29')](handleEntityNotFound(_0x478057,null))[_0x868e('0x29')](respondWithResult(_0x478057,null))['catch'](handleError(_0x478057,null));};exports[_0x868e('0x4b')]=function(_0x1a2741,_0x4cc74f){return db[_0x868e('0x44')]['create'](_0x1a2741[_0x868e('0x4c')],{})[_0x868e('0x29')](function(_0x2b9371){var _0x5300c1=_0x1a2741[_0x868e('0x4d')][_0x868e('0x4e')]({'plain':!![]});if(!_0x5300c1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5300c1['role']===_0x868e('0x4d')){var _0x57cd13=_0x2b9371[_0x868e('0x4e')]({'plain':!![]});var _0x418c37='WhatsappQueues';return db[_0x868e('0x4f')][_0x868e('0x4a')]({'where':{'name':_0x418c37,'userProfileId':_0x5300c1[_0x868e('0x50')]},'raw':!![]})['then'](function(_0x1c0b58){if(_0x1c0b58&&_0x1c0b58[_0x868e('0x51')]===0x0){return db[_0x868e('0x52')][_0x868e('0x4b')]({'name':_0x57cd13['name'],'resourceId':_0x57cd13['id'],'type':_0x1c0b58[_0x868e('0x2c')],'sectionId':_0x1c0b58['id']},{})[_0x868e('0x29')](function(){return _0x2b9371;});}else{return _0x2b9371;}})[_0x868e('0x46')](function(_0x3a51c8){logger[_0x868e('0x53')](_0x868e('0x54'),_0x3a51c8);throw _0x3a51c8;});}return _0x2b9371;})[_0x868e('0x29')](respondWithResult(_0x4cc74f,0xc9))[_0x868e('0x46')](handleError(_0x4cc74f,null));};exports[_0x868e('0x27')]=function(_0x3ffe26,_0x2ef31){if(_0x3ffe26[_0x868e('0x4c')]['id']){delete _0x3ffe26['body']['id'];}return db[_0x868e('0x44')]['find']({'where':{'id':_0x3ffe26[_0x868e('0x48')]['id']}})['then'](handleEntityNotFound(_0x2ef31,null))['then'](saveUpdates(_0x3ffe26[_0x868e('0x4c')],null))[_0x868e('0x29')](respondWithResult(_0x2ef31,null))['catch'](handleError(_0x2ef31,null));};exports[_0x868e('0x28')]=function(_0x1eb4a4,_0x471bbd){return db['WhatsappQueue'][_0x868e('0x4a')]({'where':{'id':_0x1eb4a4['params']['id']}})[_0x868e('0x29')](handleEntityNotFound(_0x471bbd,null))[_0x868e('0x29')](removeEntity(_0x471bbd,null))[_0x868e('0x46')](handleError(_0x471bbd,null));};exports['describe']=function(_0x10a9cc,_0x1b5522){return db[_0x868e('0x44')][_0x868e('0x55')]()[_0x868e('0x29')](respondWithResult(_0x1b5522,null))[_0x868e('0x46')](handleError(_0x1b5522,null));};exports[_0x868e('0x56')]=function(_0x4b61df,_0xacce89,_0x4dec9e){var _0x3c89e9={'raw':!![],'where':{}},_0x59b69a={},_0x32daff;return db[_0x868e('0x44')][_0x868e('0x57')]({'where':{'id':_0x4b61df['params']['id']}})[_0x868e('0x29')](handleEntityNotFound(_0xacce89,null))[_0x868e('0x29')](function(_0x2656b3){if(_0x2656b3){_0x32daff=_0x2656b3[_0x868e('0x4e')]({'plain':!![]});_0x59b69a['model']=_['keys'](db[_0x868e('0x58')][_0x868e('0x30')]);_0x59b69a[_0x868e('0x34')]=_[_0x868e('0x35')](_0x4b61df['query']);_0x59b69a[_0x868e('0x36')]=_[_0x868e('0x37')](_0x59b69a[_0x868e('0x33')],_0x59b69a[_0x868e('0x34')]);_0x3c89e9[_0x868e('0x38')]=_[_0x868e('0x37')](_0x59b69a[_0x868e('0x33')],qs[_0x868e('0x39')](_0x4b61df[_0x868e('0x34')]['fields']));_0x3c89e9['attributes']=_0x3c89e9[_0x868e('0x38')][_0x868e('0x49')]?_0x3c89e9[_0x868e('0x38')]:_0x59b69a[_0x868e('0x33')];if(!_0x4b61df[_0x868e('0x34')][_0x868e('0x59')](_0x868e('0x5a'))){_0x3c89e9[_0x868e('0x21')]=qs['limit'](_0x4b61df[_0x868e('0x34')][_0x868e('0x21')]);_0x3c89e9[_0x868e('0x20')]=qs['offset'](_0x4b61df[_0x868e('0x34')][_0x868e('0x20')]);}_0x3c89e9[_0x868e('0x3a')]=qs[_0x868e('0x3b')](_0x4b61df[_0x868e('0x34')][_0x868e('0x3b')]);_0x3c89e9[_0x868e('0x3e')]=qs[_0x868e('0x36')](_[_0x868e('0x3c')](_0x4b61df['query'],_0x59b69a[_0x868e('0x36')]));_0x3c89e9[_0x868e('0x3e')][_0x868e('0x5b')]=_0x2656b3['id'];if(_0x4b61df[_0x868e('0x34')][_0x868e('0x3d')]){_0x3c89e9['where']=_[_0x868e('0x3f')](_0x3c89e9[_0x868e('0x3e')],{'$or':_[_0x868e('0x2f')](_0x3c89e9[_0x868e('0x38')],function(_0x58b01b){var _0x59b0d7={};_0x59b0d7[_0x58b01b]={'$like':'%'+_0x4b61df[_0x868e('0x34')][_0x868e('0x3d')]+'%'};return _0x59b0d7;})});}_0x3c89e9=_['merge']({},_0x3c89e9,_0x4b61df[_0x868e('0x41')]);return db[_0x868e('0x58')][_0x868e('0x5c')](_0x3c89e9);}})['then'](function(_0x20e55a){if(_0x20e55a){return db['User'][_0x868e('0x5d')]({'where':{'id':_[_0x868e('0x2f')](_0x20e55a,_0x868e('0x5e')),'role':_0x868e('0x5f')},'attributes':['id',_0x868e('0x2c'),_0x868e('0x60'),'updatedAt',_0x868e('0x61')]});}})[_0x868e('0x29')](function(_0x32f490){if(_0x32f490){return{'count':_0x32f490[_0x868e('0x1f')],'rows':_[_0x868e('0x2f')](_0x32f490[_0x868e('0x45')],function(_0x4a11a6){return{'membername':_0x4a11a6[_0x868e('0x2c')],'UserId':_0x4a11a6['id'],'queue_name':_0x32daff[_0x868e('0x2c')],'WhatsappQueueId':_0x32daff['id'],'interface':util[_0x868e('0x62')](_0x868e('0x63'),_0x868e('0x64'),_0x4a11a6['name']),'penalty':0x0,'paused':_0x4a11a6[_0x868e('0x60')],'createdAt':_0x4a11a6[_0x868e('0x61')],'updatedAt':_0x4a11a6[_0x868e('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x868e('0x29')](respondWithFilteredResult(_0xacce89,_0x3c89e9))['catch'](handleError(_0xacce89,null));};exports['getTeams']=function(_0x2e16c8,_0x1728a9,_0x1dc636){var _0x3d077c={};var _0x4d1e8c={};var _0x2e430e;var _0x2cc83f;return db['WhatsappQueue'][_0x868e('0x57')]({'where':{'id':_0x2e16c8[_0x868e('0x48')]['id']}})[_0x868e('0x29')](handleEntityNotFound(_0x1728a9,null))[_0x868e('0x29')](function(_0x12cdd6){if(_0x12cdd6){_0x2e430e=_0x12cdd6;_0x4d1e8c['model']=_[_0x868e('0x35')](db[_0x868e('0x66')][_0x868e('0x30')]);_0x4d1e8c[_0x868e('0x34')]=_[_0x868e('0x35')](_0x2e16c8['query']);_0x4d1e8c['filters']=_['intersection'](_0x4d1e8c[_0x868e('0x33')],_0x4d1e8c[_0x868e('0x34')]);_0x3d077c['attributes']=_[_0x868e('0x37')](_0x4d1e8c[_0x868e('0x33')],qs[_0x868e('0x39')](_0x2e16c8['query'][_0x868e('0x39')]));_0x3d077c[_0x868e('0x38')]=_0x3d077c[_0x868e('0x38')]['length']?_0x3d077c['attributes']:_0x4d1e8c[_0x868e('0x33')];_0x3d077c[_0x868e('0x3a')]=qs[_0x868e('0x3b')](_0x2e16c8[_0x868e('0x34')][_0x868e('0x3b')]);_0x3d077c[_0x868e('0x3e')]=qs[_0x868e('0x36')](_[_0x868e('0x3c')](_0x2e16c8[_0x868e('0x34')],_0x4d1e8c[_0x868e('0x36')]));if(_0x2e16c8[_0x868e('0x34')][_0x868e('0x3d')]){_0x3d077c[_0x868e('0x3e')]=_[_0x868e('0x3f')](_0x3d077c[_0x868e('0x3e')],{'$or':_[_0x868e('0x2f')](_0x3d077c[_0x868e('0x38')],function(_0x393bbe){var _0x20d938={};_0x20d938[_0x393bbe]={'$like':'%'+_0x2e16c8[_0x868e('0x34')][_0x868e('0x3d')]+'%'};return _0x20d938;})});}_0x3d077c=_[_0x868e('0x3f')]({},_0x3d077c,_0x2e16c8[_0x868e('0x41')]);return _0x2e430e[_0x868e('0x67')](_0x3d077c);}})[_0x868e('0x29')](function(_0x2ad20f){if(_0x2ad20f){_0x2cc83f=_0x2ad20f['length'];if(!_0x2e16c8[_0x868e('0x34')]['hasOwnProperty'](_0x868e('0x5a'))){_0x3d077c[_0x868e('0x21')]=qs[_0x868e('0x21')](_0x2e16c8[_0x868e('0x34')]['limit']);_0x3d077c[_0x868e('0x20')]=qs[_0x868e('0x20')](_0x2e16c8[_0x868e('0x34')][_0x868e('0x20')]);}return _0x2e430e['getTeams'](_0x3d077c);}})[_0x868e('0x29')](function(_0x5d2eb1){if(_0x5d2eb1){return _0x5d2eb1?{'count':_0x2cc83f,'rows':_0x5d2eb1}:null;}})[_0x868e('0x29')](respondWithResult(_0x1728a9,null))['catch'](handleError(_0x1728a9,null));};exports[_0x868e('0x68')]=function(_0x24e92f,_0x5badc9,_0x14964c){var _0x4f9cbc=_0x24e92f['body'][_0x868e('0x69')];return db['Team'][_0x868e('0x5c')]({'where':{'id':_0x4f9cbc},'attributes':['id'],'include':[{'model':db[_0x868e('0x6a')],'as':_0x868e('0x6b'),'attributes':['id',_0x868e('0x2c'),_0x868e('0x6c'),'voicePause',_0x868e('0x6d')],'raw':!![]}]})[_0x868e('0x29')](function(_0x3d658c){if(_0x3d658c){var _0x164e54=_[_0x868e('0x6e')](_0x3d658c,function(_0x1cdf0d){var _0x54741d=_0x1cdf0d[_0x868e('0x4e')]({'plain':!![]});return _0x54741d['Agents'];});return db[_0x868e('0x44')][_0x868e('0x4a')]({'where':{'id':_0x24e92f['params']['id']}})[_0x868e('0x29')](function(_0x13d056){return db['sequelize']['transaction'](function(_0x17a0f1){return _0x13d056['addTeams'](_0x4f9cbc,{'transaction':_0x17a0f1})[_0x868e('0x29')](function(){return BPromise[_0x868e('0x6f')](_0x164e54,function(_0x1d0cd6){return db[_0x868e('0x58')][_0x868e('0x70')]({'where':{'UserId':_0x1d0cd6['id'],'WhatsappQueueId':_0x24e92f['params']['id']},'transaction':_0x17a0f1});});})[_0x868e('0x29')](function(){_0x164e54[_0x868e('0x71')](function(_0x47d72f){socket[_0x868e('0x72')](_0x868e('0x73'),{'UserId':_0x47d72f['id'],'WhatsappQueueId':_0x13d056['id']});});});});});}})[_0x868e('0x29')](respondWithStatusCode(_0x5badc9,null))[_0x868e('0x46')](handleError(_0x5badc9,null));};exports[_0x868e('0x74')]=function(_0x434328,_0xb426f6,_0x5babb6){return db[_0x868e('0x66')]['findAll']({'where':{'id':_0x434328['query'][_0x868e('0x69')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x868e('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x868e('0x29')](handleEntityNotFound(_0xb426f6,null))['then'](function(_0x4d6db1){var _0x3ca664=_['map'](_0x4d6db1,'id');var _0x9c0c7f=[];var _0x49ffed=[];var _0x1b72e7=squel[_0x868e('0x75')]();_0x1b72e7[_0x868e('0x76')](_0x868e('0x77'))[_0x868e('0x78')](_0x868e('0x79'),'tq')['join']('user_has_teams','ut',_0x868e('0x7a'))[_0x868e('0x3e')](_0x868e('0x7b'),_0x434328[_0x868e('0x48')]['id']);for(var _0x3b442a=0x0;_0x3b442a<_0x4d6db1['length'];_0x3b442a+=0x1){let _0x1d910d=_0x4d6db1[_0x3b442a];for(var _0x1ce69b=0x0;_0x1ce69b<_0x1d910d[_0x868e('0x6b')][_0x868e('0x49')];_0x1ce69b+=0x1){let _0x121f06=_0x1d910d[_0x868e('0x6b')][_0x1ce69b];var _0x1ecce7=_0x1b72e7[_0x868e('0x7c')]();_0x1ecce7[_0x868e('0x3e')](_0x868e('0x7d'),_0x121f06['id']);_0x49ffed['push'](db[_0x868e('0x7e')][_0x868e('0x34')](_0x1ecce7[_0x868e('0x7f')](),{'type':db[_0x868e('0x7e')][_0x868e('0x80')][_0x868e('0x81')]})['then'](function(_0x43ac84){if(_0x43ac84[_0x868e('0x49')]===0x1){return _0x121f06['id'];}else{var _0x2053f1=_[_0x868e('0x82')](_[_0x868e('0x2f')](_0x43ac84,_0x868e('0x83')),function(_0x1c4a1c){return _[_0x868e('0x84')](_0x3ca664,_0x1c4a1c);});if(_0x2053f1){return _0x121f06['id'];}}}));}}return BPromise['all'](_0x49ffed)[_0x868e('0x29')](function(_0x454639){_0x9c0c7f=_(_0x9c0c7f)['union'](_0x454639)['compact']()[_0x868e('0x85')]();return db[_0x868e('0x44')][_0x868e('0x4a')]({'where':{'id':_0x434328[_0x868e('0x48')]['id']}})[_0x868e('0x29')](function(_0x2a6cf6){return db[_0x868e('0x7e')]['transaction'](function(_0x5493d0){return _0x2a6cf6[_0x868e('0x74')](_0x434328['query']['ids'],{'transaction':_0x5493d0})[_0x868e('0x29')](function(){if(!_[_0x868e('0x86')](_0x9c0c7f)){return _0x2a6cf6['removeAgents'](_0x9c0c7f,{'transaction':_0x5493d0});}})[_0x868e('0x29')](function(){_0x9c0c7f[_0x868e('0x71')](function(_0x35b8ee){socket[_0x868e('0x72')](_0x868e('0x87'),{'UserId':_0x35b8ee,'WhatsappQueueId':_0x2a6cf6['id']});});});});});});})['then'](respondWithStatusCode(_0xb426f6,null))[_0x868e('0x46')](handleError(_0xb426f6,null));};exports[_0x868e('0x88')]=function(_0x23a3be,_0xe4ac20,_0x44c0d1){return db[_0x868e('0x44')][_0x868e('0x4a')]({'where':{'id':_0x23a3be[_0x868e('0x48')]['id']}})['then'](handleEntityNotFound(_0xe4ac20,null))[_0x868e('0x29')](function(_0x5e3200){if(_0x5e3200){return _0x5e3200[_0x868e('0x88')](_0x23a3be[_0x868e('0x4c')][_0x868e('0x69')],_['omit'](_0x23a3be[_0x868e('0x4c')],[_0x868e('0x69'),'id'])||{})['spread'](function(_0x136f6e){for(var _0x266106=0x0;_0x266106<_0x23a3be[_0x868e('0x4c')][_0x868e('0x69')]['length'];_0x266106+=0x1){socket['emit']('userWhatsappQueue:save',{'UserId':_0x23a3be[_0x868e('0x4c')][_0x868e('0x69')][_0x266106],'WhatsappQueueId':_0x23a3be['params']['id']});}return _0x136f6e;});}})[_0x868e('0x29')](respondWithResult(_0xe4ac20,null))[_0x868e('0x46')](handleError(_0xe4ac20,null));};exports[_0x868e('0x89')]=function(_0x3e19df,_0xfd6c63,_0x1f3e55){return db[_0x868e('0x44')][_0x868e('0x4a')]({'where':{'id':_0x3e19df[_0x868e('0x48')]['id']}})[_0x868e('0x29')](handleEntityNotFound(_0xfd6c63,null))[_0x868e('0x29')](function(_0x181446){if(_0x181446){return _0x181446[_0x868e('0x89')](_0x3e19df['query'][_0x868e('0x69')])['then'](function(){if(_[_0x868e('0x8a')](_0x3e19df[_0x868e('0x34')]['ids'])){for(var _0x49673d=0x0;_0x49673d<_0x3e19df['query'][_0x868e('0x69')][_0x868e('0x49')];_0x49673d+=0x1){socket[_0x868e('0x72')](_0x868e('0x87'),{'UserId':Number(_0x3e19df['query']['ids'][_0x49673d]),'WhatsappQueueId':Number(_0x3e19df[_0x868e('0x48')]['id'])});}}else{socket[_0x868e('0x72')](_0x868e('0x87'),{'UserId':Number(_0x3e19df[_0x868e('0x34')][_0x868e('0x69')]),'WhatsappQueueId':Number(_0x3e19df[_0x868e('0x48')]['id'])});}});}})[_0x868e('0x29')](respondWithStatusCode(_0xfd6c63,null))[_0x868e('0x46')](handleError(_0xfd6c63,null));};exports[_0x868e('0x8b')]=function(_0x74726f,_0x2ac033,_0x257135){var _0x4f0af0={};var _0x4a5190={};var _0x4aed31;var _0x1bac62;return db['WhatsappQueue'][_0x868e('0x57')]({'where':{'id':_0x74726f[_0x868e('0x48')]['id']}})[_0x868e('0x29')](handleEntityNotFound(_0x2ac033,null))[_0x868e('0x29')](function(_0x48eaa1){if(_0x48eaa1){_0x4aed31=_0x48eaa1;_0x4a5190[_0x868e('0x33')]=_[_0x868e('0x35')](db[_0x868e('0x6a')][_0x868e('0x30')]);_0x4a5190['query']=_[_0x868e('0x35')](_0x74726f[_0x868e('0x34')]);_0x4a5190['filters']=_[_0x868e('0x37')](_0x4a5190[_0x868e('0x33')],_0x4a5190[_0x868e('0x34')]);_0x4f0af0[_0x868e('0x38')]=_[_0x868e('0x37')](_0x4a5190[_0x868e('0x33')],qs['fields'](_0x74726f[_0x868e('0x34')][_0x868e('0x39')]));_0x4f0af0[_0x868e('0x38')]=_0x4f0af0[_0x868e('0x38')][_0x868e('0x49')]?_0x4f0af0['attributes']:_0x4a5190[_0x868e('0x33')];_0x4f0af0[_0x868e('0x3a')]=qs['sort'](_0x74726f[_0x868e('0x34')][_0x868e('0x3b')]);_0x4f0af0['where']=qs['filters'](_[_0x868e('0x3c')](_0x74726f[_0x868e('0x34')],_0x4a5190[_0x868e('0x36')]));if(_0x74726f[_0x868e('0x34')][_0x868e('0x3d')]){_0x4f0af0[_0x868e('0x3e')]=_[_0x868e('0x3f')](_0x4f0af0[_0x868e('0x3e')],{'$or':_['map'](_0x4f0af0[_0x868e('0x38')],function(_0x16ab3b){var _0x27a363={};_0x27a363[_0x16ab3b]={'$like':'%'+_0x74726f[_0x868e('0x34')]['filter']+'%'};return _0x27a363;})});}_0x4f0af0=_[_0x868e('0x3f')]({},_0x4f0af0,_0x74726f['options']);return _0x4aed31[_0x868e('0x8b')](_0x4f0af0);}})['then'](function(_0x25f0a8){if(_0x25f0a8){_0x1bac62=_0x25f0a8['length'];if(!_0x74726f[_0x868e('0x34')]['hasOwnProperty'](_0x868e('0x5a'))){_0x4f0af0[_0x868e('0x21')]=qs['limit'](_0x74726f[_0x868e('0x34')][_0x868e('0x21')]);_0x4f0af0[_0x868e('0x20')]=qs[_0x868e('0x20')](_0x74726f[_0x868e('0x34')][_0x868e('0x20')]);}return _0x4aed31[_0x868e('0x8b')](_0x4f0af0);}})[_0x868e('0x29')](function(_0x5f3b0c){if(_0x5f3b0c){return _0x5f3b0c?{'count':_0x1bac62,'rows':_0x5f3b0c}:null;}})[_0x868e('0x29')](respondWithResult(_0x2ac033,null))['catch'](handleError(_0x2ac033,null));}; \ No newline at end of file +var _0xcff3=['SIP','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','isEmpty','userWhatsappQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','redis','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','WhatsappQueues','UserProfileResource','end','error','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','WhatsappQueue','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMembers','UserWhatsappQueue','WhatsappQueueId','User','findAndCountAll','UserId','agent','updatedAt','format'];(function(_0x45564a,_0x160043){var _0x1184c7=function(_0x529f16){while(--_0x529f16){_0x45564a['push'](_0x45564a['shift']());}};_0x1184c7(++_0x160043);}(_0xcff3,0x14b));var _0x3cff=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xcff3[_0xbd08b4];return _0x314f1e;};'use strict';var pdf=require(_0x3cff('0x0'));var emlformat=require(_0x3cff('0x1'));var rimraf=require(_0x3cff('0x2'));var zipdir=require(_0x3cff('0x3'));var jsonpatch=require(_0x3cff('0x4'));var rp=require(_0x3cff('0x5'));var moment=require(_0x3cff('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x3cff('0x7'));var util=require(_0x3cff('0x8'));var path=require(_0x3cff('0x9'));var sox=require(_0x3cff('0xa'));var csv=require(_0x3cff('0xb'));var ejs=require(_0x3cff('0xc'));var fs=require('fs');var _=require(_0x3cff('0xd'));var squel=require(_0x3cff('0xe'));var crypto=require(_0x3cff('0xf'));var jsforce=require(_0x3cff('0x10'));var deskjs=require(_0x3cff('0x11'));var toCsv=require(_0x3cff('0xb'));var querystring=require(_0x3cff('0x12'));var Papa=require(_0x3cff('0x13'));var Redis=require(_0x3cff('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x3cff('0x15'));var as=require(_0x3cff('0x16'));var hardwareService=require(_0x3cff('0x17'));var logger=require(_0x3cff('0x18'))(_0x3cff('0x19'));var utils=require(_0x3cff('0x1a'));var config=require(_0x3cff('0x1b'));var db=require(_0x3cff('0x1c'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3cff('0x1d'))(new Redis(config[_0x3cff('0x1e')]));require('./whatsappQueue.socket')[_0x3cff('0x1f')](socket);function respondWithStatusCode(_0x24258b,_0x3c8686){_0x3c8686=_0x3c8686||0xcc;return function(_0x570e11){if(_0x570e11){return _0x24258b[_0x3cff('0x20')](_0x3c8686);}return _0x24258b['status'](_0x3c8686)['end']();};}function respondWithResult(_0x1c9455,_0x268690){_0x268690=_0x268690||0xc8;return function(_0x1237d6){if(_0x1237d6){return _0x1c9455[_0x3cff('0x21')](_0x268690)[_0x3cff('0x22')](_0x1237d6);}};}function respondWithFilteredResult(_0x13a1ec,_0xcd9b31){return function(_0x2eea66){if(_0x2eea66){var _0x231422=_0x2eea66[_0x3cff('0x23')],_0x5cf134=_0xcd9b31[_0x3cff('0x24')],_0x4c5df8=_0xcd9b31[_0x3cff('0x24')]+_0xcd9b31[_0x3cff('0x25')],_0x2bbddb;if(_0x4c5df8>=_0x231422){_0x4c5df8=_0x231422;_0x2bbddb=0xc8;}else{_0x2bbddb=0xce;}_0x13a1ec[_0x3cff('0x21')](_0x2bbddb);return _0x13a1ec[_0x3cff('0x26')](_0x3cff('0x27'),_0x5cf134+'-'+_0x4c5df8+'/'+_0x231422)[_0x3cff('0x22')](_0x2eea66);}return null;};}function patchUpdates(_0x2a25ce){return function(_0x279210){try{jsonpatch[_0x3cff('0x28')](_0x279210,_0x2a25ce,!![]);}catch(_0x5eb182){return BPromise['reject'](_0x5eb182);}return _0x279210[_0x3cff('0x29')]();};}function saveUpdates(_0x37d563,_0x2c556){return function(_0x53a314){if(_0x53a314){return _0x53a314[_0x3cff('0x2a')](_0x37d563)[_0x3cff('0x2b')](function(_0x182e98){return _0x182e98;});}return null;};}function removeEntity(_0x223757,_0x221505){return function(_0x3f4281){if(_0x3f4281){return _0x3f4281[_0x3cff('0x2c')]()['then'](function(){var _0x4e4663=_0x3f4281['get']({'plain':!![]});var _0x5e2a1f=_0x3cff('0x2d');return db[_0x3cff('0x2e')][_0x3cff('0x2c')]({'where':{'type':_0x5e2a1f,'resourceId':_0x4e4663['id']}})[_0x3cff('0x2b')](function(){return _0x3f4281;});})[_0x3cff('0x2b')](function(){_0x223757[_0x3cff('0x21')](0xcc)[_0x3cff('0x2f')]();});}};}function handleEntityNotFound(_0x35403b,_0x2d8caf){return function(_0x53fa4d){if(!_0x53fa4d){_0x35403b[_0x3cff('0x20')](0x194);}return _0x53fa4d;};}function handleError(_0x256a9b,_0x2b043e){_0x2b043e=_0x2b043e||0x1f4;return function(_0x2f0659){logger[_0x3cff('0x30')](_0x2f0659['stack']);if(_0x2f0659[_0x3cff('0x31')]){delete _0x2f0659[_0x3cff('0x31')];}_0x256a9b[_0x3cff('0x21')](_0x2b043e)[_0x3cff('0x32')](_0x2f0659);};}exports['index']=function(_0x4d0a8d,_0x4ee55d){var _0xb69a18={},_0x52fef8={},_0x571c65={'count':0x0,'rows':[]};var _0x31f162=_[_0x3cff('0x33')](db['WhatsappQueue'][_0x3cff('0x34')],function(_0x396c82){return{'name':_0x396c82[_0x3cff('0x35')],'type':_0x396c82[_0x3cff('0x36')][_0x3cff('0x37')]};});_0x52fef8[_0x3cff('0x38')]=_[_0x3cff('0x33')](_0x31f162,'name');_0x52fef8[_0x3cff('0x39')]=_['keys'](_0x4d0a8d[_0x3cff('0x39')]);_0x52fef8[_0x3cff('0x3a')]=_[_0x3cff('0x3b')](_0x52fef8[_0x3cff('0x38')],_0x52fef8[_0x3cff('0x39')]);_0xb69a18[_0x3cff('0x3c')]=_[_0x3cff('0x3b')](_0x52fef8[_0x3cff('0x38')],qs['fields'](_0x4d0a8d['query']['fields']));_0xb69a18['attributes']=_0xb69a18[_0x3cff('0x3c')][_0x3cff('0x3d')]?_0xb69a18['attributes']:_0x52fef8[_0x3cff('0x38')];if(!_0x4d0a8d['query'][_0x3cff('0x3e')](_0x3cff('0x3f'))){_0xb69a18['limit']=qs['limit'](_0x4d0a8d[_0x3cff('0x39')][_0x3cff('0x25')]);_0xb69a18['offset']=qs[_0x3cff('0x24')](_0x4d0a8d['query'][_0x3cff('0x24')]);}_0xb69a18[_0x3cff('0x40')]=qs[_0x3cff('0x41')](_0x4d0a8d[_0x3cff('0x39')][_0x3cff('0x41')]);_0xb69a18['where']=qs[_0x3cff('0x3a')](_[_0x3cff('0x42')](_0x4d0a8d[_0x3cff('0x39')],_0x52fef8[_0x3cff('0x3a')]),_0x31f162);if(_0x4d0a8d[_0x3cff('0x39')][_0x3cff('0x43')]){_0xb69a18[_0x3cff('0x44')]=_[_0x3cff('0x45')](_0xb69a18[_0x3cff('0x44')],{'$or':_[_0x3cff('0x33')](_0x31f162,function(_0x398f2b){if(_0x398f2b[_0x3cff('0x36')]!==_0x3cff('0x46')){var _0x22d1fe={};_0x22d1fe[_0x398f2b[_0x3cff('0x31')]]={'$like':'%'+_0x4d0a8d[_0x3cff('0x39')][_0x3cff('0x43')]+'%'};return _0x22d1fe;}})});}_0xb69a18=_[_0x3cff('0x45')]({},_0xb69a18,_0x4d0a8d[_0x3cff('0x47')]);var _0x2ab760={'where':_0xb69a18['where']};return db[_0x3cff('0x48')][_0x3cff('0x23')](_0x2ab760)[_0x3cff('0x2b')](function(_0x34ce23){_0x571c65[_0x3cff('0x23')]=_0x34ce23;if(_0x4d0a8d[_0x3cff('0x39')][_0x3cff('0x49')]){_0xb69a18[_0x3cff('0x4a')]=[{'all':!![]}];}return db[_0x3cff('0x48')][_0x3cff('0x4b')](_0xb69a18);})[_0x3cff('0x2b')](function(_0x28a1d7){_0x571c65[_0x3cff('0x4c')]=_0x28a1d7;return _0x571c65;})[_0x3cff('0x2b')](respondWithFilteredResult(_0x4ee55d,_0xb69a18))[_0x3cff('0x4d')](handleError(_0x4ee55d,null));};exports[_0x3cff('0x4e')]=function(_0x49282c,_0x18d4ca){var _0x41d2f7={'raw':!![],'where':{'id':_0x49282c[_0x3cff('0x4f')]['id']}},_0x145fc0={};_0x145fc0['model']=_[_0x3cff('0x50')](db[_0x3cff('0x48')]['rawAttributes']);_0x145fc0[_0x3cff('0x39')]=_[_0x3cff('0x50')](_0x49282c[_0x3cff('0x39')]);_0x145fc0[_0x3cff('0x3a')]=_[_0x3cff('0x3b')](_0x145fc0[_0x3cff('0x38')],_0x145fc0[_0x3cff('0x39')]);_0x41d2f7[_0x3cff('0x3c')]=_[_0x3cff('0x3b')](_0x145fc0[_0x3cff('0x38')],qs['fields'](_0x49282c[_0x3cff('0x39')][_0x3cff('0x51')]));_0x41d2f7['attributes']=_0x41d2f7[_0x3cff('0x3c')][_0x3cff('0x3d')]?_0x41d2f7[_0x3cff('0x3c')]:_0x145fc0[_0x3cff('0x38')];if(_0x49282c[_0x3cff('0x39')]['includeAll']){_0x41d2f7[_0x3cff('0x4a')]=[{'all':!![]}];}_0x41d2f7=_[_0x3cff('0x45')]({},_0x41d2f7,_0x49282c[_0x3cff('0x47')]);return db[_0x3cff('0x48')][_0x3cff('0x52')](_0x41d2f7)['then'](handleEntityNotFound(_0x18d4ca,null))[_0x3cff('0x2b')](respondWithResult(_0x18d4ca,null))['catch'](handleError(_0x18d4ca,null));};exports['create']=function(_0x3bc407,_0x35c361){return db[_0x3cff('0x48')][_0x3cff('0x53')](_0x3bc407[_0x3cff('0x54')],{})[_0x3cff('0x2b')](function(_0x52ebd6){var _0x28e42d=_0x3bc407['user'][_0x3cff('0x55')]({'plain':!![]});if(!_0x28e42d)throw new Error(_0x3cff('0x56'));if(_0x28e42d[_0x3cff('0x57')]===_0x3cff('0x58')){var _0x4f0758=_0x52ebd6[_0x3cff('0x55')]({'plain':!![]});var _0x195082='WhatsappQueues';return db[_0x3cff('0x59')][_0x3cff('0x52')]({'where':{'name':_0x195082,'userProfileId':_0x28e42d[_0x3cff('0x5a')]},'raw':!![]})[_0x3cff('0x2b')](function(_0x667df){if(_0x667df&&_0x667df['autoAssociation']===0x0){return db[_0x3cff('0x2e')][_0x3cff('0x53')]({'name':_0x4f0758[_0x3cff('0x31')],'resourceId':_0x4f0758['id'],'type':_0x667df[_0x3cff('0x31')],'sectionId':_0x667df['id']},{})[_0x3cff('0x2b')](function(){return _0x52ebd6;});}else{return _0x52ebd6;}})['catch'](function(_0x5bd691){logger[_0x3cff('0x30')](_0x3cff('0x5b'),_0x5bd691);throw _0x5bd691;});}return _0x52ebd6;})[_0x3cff('0x2b')](respondWithResult(_0x35c361,0xc9))[_0x3cff('0x4d')](handleError(_0x35c361,null));};exports[_0x3cff('0x2a')]=function(_0x2ccc45,_0x3f255e){if(_0x2ccc45[_0x3cff('0x54')]['id']){delete _0x2ccc45[_0x3cff('0x54')]['id'];}return db[_0x3cff('0x48')][_0x3cff('0x52')]({'where':{'id':_0x2ccc45[_0x3cff('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3f255e,null))[_0x3cff('0x2b')](saveUpdates(_0x2ccc45[_0x3cff('0x54')],null))['then'](respondWithResult(_0x3f255e,null))[_0x3cff('0x4d')](handleError(_0x3f255e,null));};exports[_0x3cff('0x2c')]=function(_0x1916ae,_0x7737dc){return db[_0x3cff('0x48')][_0x3cff('0x52')]({'where':{'id':_0x1916ae[_0x3cff('0x4f')]['id']}})[_0x3cff('0x2b')](handleEntityNotFound(_0x7737dc,null))[_0x3cff('0x2b')](removeEntity(_0x7737dc,null))['catch'](handleError(_0x7737dc,null));};exports['describe']=function(_0x576749,_0x42992e){return db[_0x3cff('0x48')]['describe']()[_0x3cff('0x2b')](respondWithResult(_0x42992e,null))[_0x3cff('0x4d')](handleError(_0x42992e,null));};exports[_0x3cff('0x5c')]=function(_0x4244e9,_0x1aa975,_0x3a146a){var _0x336310={'raw':!![],'where':{}},_0x2d485d={},_0x3a7d5d;return db[_0x3cff('0x48')]['findOne']({'where':{'id':_0x4244e9[_0x3cff('0x4f')]['id']}})[_0x3cff('0x2b')](handleEntityNotFound(_0x1aa975,null))[_0x3cff('0x2b')](function(_0x2a1a4c){if(_0x2a1a4c){_0x3a7d5d=_0x2a1a4c[_0x3cff('0x55')]({'plain':!![]});_0x2d485d['model']=_[_0x3cff('0x50')](db[_0x3cff('0x5d')][_0x3cff('0x34')]);_0x2d485d[_0x3cff('0x39')]=_['keys'](_0x4244e9[_0x3cff('0x39')]);_0x2d485d['filters']=_[_0x3cff('0x3b')](_0x2d485d[_0x3cff('0x38')],_0x2d485d['query']);_0x336310['attributes']=_['intersection'](_0x2d485d['model'],qs[_0x3cff('0x51')](_0x4244e9[_0x3cff('0x39')][_0x3cff('0x51')]));_0x336310['attributes']=_0x336310[_0x3cff('0x3c')][_0x3cff('0x3d')]?_0x336310['attributes']:_0x2d485d[_0x3cff('0x38')];if(!_0x4244e9[_0x3cff('0x39')]['hasOwnProperty'](_0x3cff('0x3f'))){_0x336310[_0x3cff('0x25')]=qs['limit'](_0x4244e9[_0x3cff('0x39')][_0x3cff('0x25')]);_0x336310[_0x3cff('0x24')]=qs[_0x3cff('0x24')](_0x4244e9[_0x3cff('0x39')][_0x3cff('0x24')]);}_0x336310[_0x3cff('0x40')]=qs[_0x3cff('0x41')](_0x4244e9[_0x3cff('0x39')][_0x3cff('0x41')]);_0x336310[_0x3cff('0x44')]=qs[_0x3cff('0x3a')](_[_0x3cff('0x42')](_0x4244e9[_0x3cff('0x39')],_0x2d485d[_0x3cff('0x3a')]));_0x336310[_0x3cff('0x44')][_0x3cff('0x5e')]=_0x2a1a4c['id'];if(_0x4244e9[_0x3cff('0x39')][_0x3cff('0x43')]){_0x336310[_0x3cff('0x44')]=_[_0x3cff('0x45')](_0x336310[_0x3cff('0x44')],{'$or':_[_0x3cff('0x33')](_0x336310['attributes'],function(_0x561e2b){var _0xbb9f39={};_0xbb9f39[_0x561e2b]={'$like':'%'+_0x4244e9[_0x3cff('0x39')][_0x3cff('0x43')]+'%'};return _0xbb9f39;})});}_0x336310=_[_0x3cff('0x45')]({},_0x336310,_0x4244e9['options']);return db[_0x3cff('0x5d')][_0x3cff('0x4b')](_0x336310);}})[_0x3cff('0x2b')](function(_0x2c4ce8){if(_0x2c4ce8){return db[_0x3cff('0x5f')][_0x3cff('0x60')]({'where':{'id':_[_0x3cff('0x33')](_0x2c4ce8,_0x3cff('0x61')),'role':_0x3cff('0x62')},'attributes':['id',_0x3cff('0x31'),'whatsappPause',_0x3cff('0x63'),'createdAt']});}})[_0x3cff('0x2b')](function(_0xc6ea7c){if(_0xc6ea7c){return{'count':_0xc6ea7c[_0x3cff('0x23')],'rows':_['map'](_0xc6ea7c[_0x3cff('0x4c')],function(_0x8bfc17){return{'membername':_0x8bfc17[_0x3cff('0x31')],'UserId':_0x8bfc17['id'],'queue_name':_0x3a7d5d['name'],'WhatsappQueueId':_0x3a7d5d['id'],'interface':util[_0x3cff('0x64')]('%s/%s',_0x3cff('0x65'),_0x8bfc17['name']),'penalty':0x0,'paused':_0x8bfc17['whatsappPause'],'createdAt':_0x8bfc17['createdAt'],'updatedAt':_0x8bfc17['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3cff('0x2b')](respondWithFilteredResult(_0x1aa975,_0x336310))[_0x3cff('0x4d')](handleError(_0x1aa975,null));};exports[_0x3cff('0x66')]=function(_0x358655,_0x371934,_0x182093){var _0x263d85={};var _0x2ad953={};var _0x4a42ca;var _0x182675;return db[_0x3cff('0x48')][_0x3cff('0x67')]({'where':{'id':_0x358655[_0x3cff('0x4f')]['id']}})[_0x3cff('0x2b')](handleEntityNotFound(_0x371934,null))['then'](function(_0x2323e5){if(_0x2323e5){_0x4a42ca=_0x2323e5;_0x2ad953[_0x3cff('0x38')]=_[_0x3cff('0x50')](db[_0x3cff('0x68')][_0x3cff('0x34')]);_0x2ad953[_0x3cff('0x39')]=_[_0x3cff('0x50')](_0x358655['query']);_0x2ad953[_0x3cff('0x3a')]=_[_0x3cff('0x3b')](_0x2ad953[_0x3cff('0x38')],_0x2ad953['query']);_0x263d85[_0x3cff('0x3c')]=_[_0x3cff('0x3b')](_0x2ad953[_0x3cff('0x38')],qs[_0x3cff('0x51')](_0x358655[_0x3cff('0x39')][_0x3cff('0x51')]));_0x263d85[_0x3cff('0x3c')]=_0x263d85[_0x3cff('0x3c')][_0x3cff('0x3d')]?_0x263d85[_0x3cff('0x3c')]:_0x2ad953['model'];_0x263d85['order']=qs['sort'](_0x358655[_0x3cff('0x39')]['sort']);_0x263d85['where']=qs[_0x3cff('0x3a')](_['pick'](_0x358655['query'],_0x2ad953[_0x3cff('0x3a')]));if(_0x358655[_0x3cff('0x39')][_0x3cff('0x43')]){_0x263d85[_0x3cff('0x44')]=_[_0x3cff('0x45')](_0x263d85[_0x3cff('0x44')],{'$or':_[_0x3cff('0x33')](_0x263d85['attributes'],function(_0x478bc4){var _0x3dedc5={};_0x3dedc5[_0x478bc4]={'$like':'%'+_0x358655[_0x3cff('0x39')][_0x3cff('0x43')]+'%'};return _0x3dedc5;})});}_0x263d85=_[_0x3cff('0x45')]({},_0x263d85,_0x358655[_0x3cff('0x47')]);return _0x4a42ca[_0x3cff('0x66')](_0x263d85);}})[_0x3cff('0x2b')](function(_0xf3cce9){if(_0xf3cce9){_0x182675=_0xf3cce9[_0x3cff('0x3d')];if(!_0x358655['query'][_0x3cff('0x3e')](_0x3cff('0x3f'))){_0x263d85[_0x3cff('0x25')]=qs['limit'](_0x358655['query'][_0x3cff('0x25')]);_0x263d85[_0x3cff('0x24')]=qs[_0x3cff('0x24')](_0x358655['query'][_0x3cff('0x24')]);}return _0x4a42ca[_0x3cff('0x66')](_0x263d85);}})[_0x3cff('0x2b')](function(_0x35679b){if(_0x35679b){return _0x35679b?{'count':_0x182675,'rows':_0x35679b}:null;}})['then'](respondWithResult(_0x371934,null))['catch'](handleError(_0x371934,null));};exports[_0x3cff('0x69')]=function(_0x47e9c2,_0x3c8933,_0x35716c){var _0x38958c=_0x47e9c2[_0x3cff('0x54')][_0x3cff('0x6a')];return db[_0x3cff('0x68')][_0x3cff('0x4b')]({'where':{'id':_0x38958c},'attributes':['id'],'include':[{'model':db[_0x3cff('0x5f')],'as':_0x3cff('0x6b'),'attributes':['id',_0x3cff('0x31'),_0x3cff('0x6c'),_0x3cff('0x6d'),_0x3cff('0x6e')],'raw':!![]}]})[_0x3cff('0x2b')](function(_0x2255a2){if(_0x2255a2){var _0x11b3a2=_[_0x3cff('0x6f')](_0x2255a2,function(_0x43678b){var _0x49f355=_0x43678b[_0x3cff('0x55')]({'plain':!![]});return _0x49f355[_0x3cff('0x6b')];});return db[_0x3cff('0x48')][_0x3cff('0x52')]({'where':{'id':_0x47e9c2[_0x3cff('0x4f')]['id']}})[_0x3cff('0x2b')](function(_0xa6b439){return db[_0x3cff('0x70')][_0x3cff('0x71')](function(_0x1bd6dc){return _0xa6b439['addTeams'](_0x38958c,{'transaction':_0x1bd6dc})[_0x3cff('0x2b')](function(){return BPromise[_0x3cff('0x72')](_0x11b3a2,function(_0x357e34){return db[_0x3cff('0x5d')]['findOrCreate']({'where':{'UserId':_0x357e34['id'],'WhatsappQueueId':_0x47e9c2[_0x3cff('0x4f')]['id']},'transaction':_0x1bd6dc});});})[_0x3cff('0x2b')](function(){_0x11b3a2['forEach'](function(_0x17da08){socket[_0x3cff('0x73')](_0x3cff('0x74'),{'UserId':_0x17da08['id'],'WhatsappQueueId':_0xa6b439['id']});});});});});}})[_0x3cff('0x2b')](respondWithStatusCode(_0x3c8933,null))['catch'](handleError(_0x3c8933,null));};exports[_0x3cff('0x75')]=function(_0x239c5e,_0x41f8a3,_0x10f836){return db[_0x3cff('0x68')]['findAll']({'where':{'id':_0x239c5e[_0x3cff('0x39')][_0x3cff('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x3cff('0x5f')],'as':_0x3cff('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x3cff('0x2b')](handleEntityNotFound(_0x41f8a3,null))[_0x3cff('0x2b')](function(_0x1bab7f){var _0x1737f3=_[_0x3cff('0x33')](_0x1bab7f,'id');var _0x496ca0=[];var _0x1208fa=[];var _0x5b9e70=squel[_0x3cff('0x76')]();_0x5b9e70[_0x3cff('0x77')](_0x3cff('0x78'))[_0x3cff('0x79')](_0x3cff('0x7a'),'tq')[_0x3cff('0x7b')](_0x3cff('0x7c'),'ut',_0x3cff('0x7d'))[_0x3cff('0x44')](_0x3cff('0x7e'),_0x239c5e[_0x3cff('0x4f')]['id']);for(var _0x48f6a3=0x0;_0x48f6a3<_0x1bab7f[_0x3cff('0x3d')];_0x48f6a3+=0x1){let _0x157cc4=_0x1bab7f[_0x48f6a3];for(var _0x1bca79=0x0;_0x1bca79<_0x157cc4[_0x3cff('0x6b')][_0x3cff('0x3d')];_0x1bca79+=0x1){let _0x5308aa=_0x157cc4[_0x3cff('0x6b')][_0x1bca79];var _0x6ab894=_0x5b9e70['clone']();_0x6ab894['where'](_0x3cff('0x7f'),_0x5308aa['id']);_0x1208fa[_0x3cff('0x80')](db[_0x3cff('0x70')]['query'](_0x6ab894[_0x3cff('0x81')](),{'type':db['sequelize']['QueryTypes'][_0x3cff('0x82')]})[_0x3cff('0x2b')](function(_0x583f09){if(_0x583f09[_0x3cff('0x3d')]===0x1){return _0x5308aa['id'];}else{var _0x2c8e20=_[_0x3cff('0x83')](_['map'](_0x583f09,_0x3cff('0x84')),function(_0x1f541f){return _[_0x3cff('0x85')](_0x1737f3,_0x1f541f);});if(_0x2c8e20){return _0x5308aa['id'];}}}));}}return BPromise[_0x3cff('0x86')](_0x1208fa)[_0x3cff('0x2b')](function(_0x29c429){_0x496ca0=_(_0x496ca0)[_0x3cff('0x87')](_0x29c429)[_0x3cff('0x88')]()['value']();return db[_0x3cff('0x48')][_0x3cff('0x52')]({'where':{'id':_0x239c5e['params']['id']}})[_0x3cff('0x2b')](function(_0x552cd5){return db[_0x3cff('0x70')][_0x3cff('0x71')](function(_0x1ba1b1){return _0x552cd5[_0x3cff('0x75')](_0x239c5e['query'][_0x3cff('0x6a')],{'transaction':_0x1ba1b1})[_0x3cff('0x2b')](function(){if(!_[_0x3cff('0x89')](_0x496ca0)){return _0x552cd5['removeAgents'](_0x496ca0,{'transaction':_0x1ba1b1});}})[_0x3cff('0x2b')](function(){_0x496ca0['forEach'](function(_0x5921fc){socket[_0x3cff('0x73')](_0x3cff('0x8a'),{'UserId':_0x5921fc,'WhatsappQueueId':_0x552cd5['id']});});});});});});})[_0x3cff('0x2b')](respondWithStatusCode(_0x41f8a3,null))[_0x3cff('0x4d')](handleError(_0x41f8a3,null));};exports['addAgents']=function(_0x547a01,_0x1d8427,_0x10896e){return db[_0x3cff('0x48')][_0x3cff('0x52')]({'where':{'id':_0x547a01[_0x3cff('0x4f')]['id']}})[_0x3cff('0x2b')](handleEntityNotFound(_0x1d8427,null))[_0x3cff('0x2b')](function(_0x3ecf7f){if(_0x3ecf7f){return _0x3ecf7f[_0x3cff('0x8b')](_0x547a01[_0x3cff('0x54')][_0x3cff('0x6a')],_['omit'](_0x547a01[_0x3cff('0x54')],[_0x3cff('0x6a'),'id'])||{})[_0x3cff('0x8c')](function(_0x371604){for(var _0x3308bd=0x0;_0x3308bd<_0x547a01[_0x3cff('0x54')][_0x3cff('0x6a')][_0x3cff('0x3d')];_0x3308bd+=0x1){socket[_0x3cff('0x73')]('userWhatsappQueue:save',{'UserId':_0x547a01[_0x3cff('0x54')]['ids'][_0x3308bd],'WhatsappQueueId':_0x547a01[_0x3cff('0x4f')]['id']});}return _0x371604;});}})[_0x3cff('0x2b')](respondWithResult(_0x1d8427,null))[_0x3cff('0x4d')](handleError(_0x1d8427,null));};exports[_0x3cff('0x8d')]=function(_0x344bf2,_0x387620,_0xbd7ebb){return db[_0x3cff('0x48')][_0x3cff('0x52')]({'where':{'id':_0x344bf2[_0x3cff('0x4f')]['id']}})['then'](handleEntityNotFound(_0x387620,null))[_0x3cff('0x2b')](function(_0x147b91){if(_0x147b91){return _0x147b91[_0x3cff('0x8d')](_0x344bf2['query'][_0x3cff('0x6a')])[_0x3cff('0x2b')](function(){if(_[_0x3cff('0x8e')](_0x344bf2[_0x3cff('0x39')][_0x3cff('0x6a')])){for(var _0x4272be=0x0;_0x4272be<_0x344bf2['query'][_0x3cff('0x6a')]['length'];_0x4272be+=0x1){socket['emit'](_0x3cff('0x8a'),{'UserId':Number(_0x344bf2[_0x3cff('0x39')][_0x3cff('0x6a')][_0x4272be]),'WhatsappQueueId':Number(_0x344bf2['params']['id'])});}}else{socket[_0x3cff('0x73')](_0x3cff('0x8a'),{'UserId':Number(_0x344bf2[_0x3cff('0x39')][_0x3cff('0x6a')]),'WhatsappQueueId':Number(_0x344bf2['params']['id'])});}});}})[_0x3cff('0x2b')](respondWithStatusCode(_0x387620,null))[_0x3cff('0x4d')](handleError(_0x387620,null));};exports[_0x3cff('0x8f')]=function(_0x4c5ad8,_0x40b8c0,_0x51aed7){var _0x4c74e8={};var _0x1db694={};var _0x30fdb0;var _0x51f3b7;return db[_0x3cff('0x48')]['findOne']({'where':{'id':_0x4c5ad8[_0x3cff('0x4f')]['id']}})[_0x3cff('0x2b')](handleEntityNotFound(_0x40b8c0,null))[_0x3cff('0x2b')](function(_0x14cdda){if(_0x14cdda){_0x30fdb0=_0x14cdda;_0x1db694[_0x3cff('0x38')]=_[_0x3cff('0x50')](db['User'][_0x3cff('0x34')]);_0x1db694[_0x3cff('0x39')]=_[_0x3cff('0x50')](_0x4c5ad8[_0x3cff('0x39')]);_0x1db694[_0x3cff('0x3a')]=_[_0x3cff('0x3b')](_0x1db694['model'],_0x1db694[_0x3cff('0x39')]);_0x4c74e8['attributes']=_['intersection'](_0x1db694[_0x3cff('0x38')],qs[_0x3cff('0x51')](_0x4c5ad8[_0x3cff('0x39')]['fields']));_0x4c74e8[_0x3cff('0x3c')]=_0x4c74e8[_0x3cff('0x3c')][_0x3cff('0x3d')]?_0x4c74e8[_0x3cff('0x3c')]:_0x1db694['model'];_0x4c74e8[_0x3cff('0x40')]=qs[_0x3cff('0x41')](_0x4c5ad8['query']['sort']);_0x4c74e8[_0x3cff('0x44')]=qs[_0x3cff('0x3a')](_[_0x3cff('0x42')](_0x4c5ad8[_0x3cff('0x39')],_0x1db694[_0x3cff('0x3a')]));if(_0x4c5ad8[_0x3cff('0x39')]['filter']){_0x4c74e8[_0x3cff('0x44')]=_['merge'](_0x4c74e8[_0x3cff('0x44')],{'$or':_[_0x3cff('0x33')](_0x4c74e8['attributes'],function(_0x49d051){var _0x2eede9={};_0x2eede9[_0x49d051]={'$like':'%'+_0x4c5ad8[_0x3cff('0x39')][_0x3cff('0x43')]+'%'};return _0x2eede9;})});}_0x4c74e8=_[_0x3cff('0x45')]({},_0x4c74e8,_0x4c5ad8[_0x3cff('0x47')]);return _0x30fdb0[_0x3cff('0x8f')](_0x4c74e8);}})[_0x3cff('0x2b')](function(_0x1aade6){if(_0x1aade6){_0x51f3b7=_0x1aade6[_0x3cff('0x3d')];if(!_0x4c5ad8[_0x3cff('0x39')][_0x3cff('0x3e')](_0x3cff('0x3f'))){_0x4c74e8[_0x3cff('0x25')]=qs[_0x3cff('0x25')](_0x4c5ad8['query'][_0x3cff('0x25')]);_0x4c74e8[_0x3cff('0x24')]=qs[_0x3cff('0x24')](_0x4c5ad8[_0x3cff('0x39')][_0x3cff('0x24')]);}return _0x30fdb0[_0x3cff('0x8f')](_0x4c74e8);}})[_0x3cff('0x2b')](function(_0x1c741b){if(_0x1c741b){return _0x1c741b?{'count':_0x51f3b7,'rows':_0x1c741b}:null;}})[_0x3cff('0x2b')](respondWithResult(_0x40b8c0,null))['catch'](handleError(_0x40b8c0,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 4d1ddbe..a9e0f0e 100644 --- a/server/api/whatsappQueue/whatsappQueue.events.js +++ b/server/api/whatsappQueue/whatsappQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01d7=['hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x01d7,0xba));var _0x701d=function(_0xd38b1,_0x57dd1d){_0xd38b1=_0xd38b1-0x0;var _0x2abb43=_0x01d7[_0xd38b1];return _0x2abb43;};'use strict';var EventEmitter=require(_0x701d('0x0'));var WhatsappQueue=require(_0x701d('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x701d('0x2')](0x0);var events={'afterCreate':_0x701d('0x3'),'afterUpdate':'update','afterDestroy':_0x701d('0x4')};function emitEvent(_0x1e9471){return function(_0xa14d70,_0x2e91b6,_0x16cc5c){WhatsappQueueEvents[_0x701d('0x5')](_0x1e9471+':'+_0xa14d70['id'],_0xa14d70);WhatsappQueueEvents[_0x701d('0x5')](_0x1e9471,_0xa14d70);_0x16cc5c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x701d('0x6')](e,emitEvent(event));}}module[_0x701d('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x69ae=['hasOwnProperty','hook','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit'];(function(_0x4ec805,_0x3b8515){var _0x386805=function(_0x58c4c0){while(--_0x58c4c0){_0x4ec805['push'](_0x4ec805['shift']());}};_0x386805(++_0x3b8515);}(_0x69ae,0x1ba));var _0xe69a=function(_0x144767,_0x475e1b){_0x144767=_0x144767-0x0;var _0x437ca7=_0x69ae[_0x144767];return _0x437ca7;};'use strict';var EventEmitter=require(_0xe69a('0x0'));var WhatsappQueue=require(_0xe69a('0x1'))['db'][_0xe69a('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xe69a('0x3')](0x0);var events={'afterCreate':_0xe69a('0x4'),'afterUpdate':_0xe69a('0x5'),'afterDestroy':_0xe69a('0x6')};function emitEvent(_0x59219e){return function(_0x919232,_0x2abda4,_0x7949e4){WhatsappQueueEvents[_0xe69a('0x7')](_0x59219e+':'+_0x919232['id'],_0x919232);WhatsappQueueEvents[_0xe69a('0x7')](_0x59219e,_0x919232);_0x7949e4(null);};}for(var e in events){if(events[_0xe69a('0x8')](e)){var event=events[e];WhatsappQueue[_0xe69a('0x9')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 6639449..3468366 100644 --- a/server/api/whatsappQueue/whatsappQueue.model.js +++ b/server/api/whatsappQueue/whatsappQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe36c=['moment','bluebird','request-promise','path','rimraf','exports','define','util','../../config/logger','api'];(function(_0x5c5ad8,_0x346509){var _0xa17c5c=function(_0x47100b){while(--_0x47100b){_0x5c5ad8['push'](_0x5c5ad8['shift']());}};_0xa17c5c(++_0x346509);}(_0xe36c,0x129));var _0xce36=function(_0x57b157,_0x1f43c4){_0x57b157=_0x57b157-0x0;var _0x367422=_0xe36c[_0x57b157];return _0x367422;};'use strict';var _=require('lodash');var util=require(_0xce36('0x0'));var logger=require(_0xce36('0x1'))(_0xce36('0x2'));var moment=require(_0xce36('0x3'));var BPromise=require(_0xce36('0x4'));var rp=require(_0xce36('0x5'));var fs=require('fs');var path=require(_0xce36('0x6'));var rimraf=require(_0xce36('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0xce36('0x8')]=function(_0x3d428b,_0x533db8){return _0x3d428b[_0xce36('0x9')]('WhatsappQueue',attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x847b=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','whatsapp_queues','lodash','../../config/logger'];(function(_0xa1b5fb,_0x41a2bd){var _0x123597=function(_0x1b3157){while(--_0x1b3157){_0xa1b5fb['push'](_0xa1b5fb['shift']());}};_0x123597(++_0x41a2bd);}(_0x847b,0x1ac));var _0xb847=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x847b[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xb847('0x0'));var util=require('util');var logger=require(_0xb847('0x1'))(_0xb847('0x2'));var moment=require('moment');var BPromise=require(_0xb847('0x3'));var rp=require(_0xb847('0x4'));var fs=require('fs');var path=require(_0xb847('0x5'));var rimraf=require(_0xb847('0x6'));var config=require(_0xb847('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0xb847('0x8')]=function(_0x32b381,_0x4124f2){return _0x32b381['define']('WhatsappQueue',attributes,{'tableName':_0xb847('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 355283b..aef0b9e 100644 --- a/server/api/whatsappQueue/whatsappQueue.rpc.js +++ b/server/api/whatsappQueue/whatsappQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8aa1=['attributes','map','debug','stringify','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit','include','model'];(function(_0x26c67a,_0x5a6b65){var _0x389403=function(_0x5bd00f){while(--_0x5bd00f){_0x26c67a['push'](_0x26c67a['shift']());}};_0x389403(++_0x5a6b65);}(_0x8aa1,0xc3));var _0x18aa=function(_0x208961,_0x5e6cf6){_0x208961=_0x208961-0x0;var _0x4236f5=_0x8aa1[_0x208961];return _0x4236f5;};'use strict';var _=require(_0x18aa('0x0'));var util=require(_0x18aa('0x1'));var moment=require(_0x18aa('0x2'));var BPromise=require(_0x18aa('0x3'));var rs=require(_0x18aa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x18aa('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x18aa('0x6'));var jayson=require(_0x18aa('0x7'));var client=jayson[_0x18aa('0x8')][_0x18aa('0x9')]({'port':0x232a});config[_0x18aa('0xa')]=_['defaults'](config[_0x18aa('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x18aa('0xb'))(new Redis(config[_0x18aa('0xa')]));require(_0x18aa('0xc'))[_0x18aa('0xd')](socket);function respondWithRpcPromise(_0x58119a,_0x17505a,_0x44677c){return new BPromise(function(_0x48a2e2,_0x5a1c09){return client[_0x18aa('0xe')](_0x58119a,_0x44677c)[_0x18aa('0xf')](function(_0x1b92ba){logger[_0x18aa('0x10')](_0x18aa('0x11'),_0x17505a,_0x18aa('0x12'));logger['debug'](_0x18aa('0x13'),_0x17505a,_0x18aa('0x12'),JSON['stringify'](_0x1b92ba));if(_0x1b92ba[_0x18aa('0x14')]){if(_0x1b92ba[_0x18aa('0x14')][_0x18aa('0x15')]===0x1f4){logger[_0x18aa('0x14')](_0x18aa('0x11'),_0x17505a,_0x1b92ba[_0x18aa('0x14')]['message']);return _0x5a1c09(_0x1b92ba[_0x18aa('0x14')][_0x18aa('0x16')]);}logger[_0x18aa('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x17505a,_0x1b92ba[_0x18aa('0x14')][_0x18aa('0x16')]);return _0x48a2e2(_0x1b92ba[_0x18aa('0x14')][_0x18aa('0x16')]);}else{logger[_0x18aa('0x10')](_0x18aa('0x11'),_0x17505a,_0x18aa('0x12'));_0x48a2e2(_0x1b92ba['result']['message']);}})[_0x18aa('0x17')](function(_0x53e6e4){logger[_0x18aa('0x14')](_0x18aa('0x11'),_0x17505a,_0x53e6e4);_0x5a1c09(_0x53e6e4);});});}exports[_0x18aa('0x18')]=function(_0x55dd7b){var _0x4ddd91=this;return new Promise(function(_0x3e54d6,_0x47322a){return db[_0x18aa('0x19')][_0x18aa('0x1a')]({'raw':_0x55dd7b[_0x18aa('0x1b')]?_0x55dd7b[_0x18aa('0x1b')][_0x18aa('0x1c')]===undefined?!![]:![]:!![],'where':_0x55dd7b['options']?_0x55dd7b[_0x18aa('0x1b')][_0x18aa('0x1d')]||null:null,'attributes':_0x55dd7b[_0x18aa('0x1b')]?_0x55dd7b['options']['attributes']||null:null,'limit':_0x55dd7b[_0x18aa('0x1b')]?_0x55dd7b['options'][_0x18aa('0x1e')]||null:null,'include':_0x55dd7b[_0x18aa('0x1b')]?_0x55dd7b['options'][_0x18aa('0x1f')]?_['map'](_0x55dd7b[_0x18aa('0x1b')][_0x18aa('0x1f')],function(_0x359ae8){return{'model':db[_0x359ae8[_0x18aa('0x20')]],'as':_0x359ae8['as'],'attributes':_0x359ae8[_0x18aa('0x21')],'include':_0x359ae8['include']?_['map'](_0x359ae8[_0x18aa('0x1f')],function(_0xa99ce3){return{'model':db[_0xa99ce3[_0x18aa('0x20')]],'as':_0xa99ce3['as'],'attributes':_0xa99ce3[_0x18aa('0x21')],'include':_0xa99ce3['include']?_[_0x18aa('0x22')](_0xa99ce3[_0x18aa('0x1f')],function(_0x2bbf66){return{'model':db[_0x2bbf66['model']],'as':_0x2bbf66['as'],'attributes':_0x2bbf66['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dfe2f){logger[_0x18aa('0x10')](_0x18aa('0x18'),_0x55dd7b);logger[_0x18aa('0x23')](_0x18aa('0x18'),_0x55dd7b,JSON[_0x18aa('0x24')](_0x3dfe2f));_0x3e54d6(_0x3dfe2f);})['catch'](function(_0x3fbc55){logger['error'](_0x18aa('0x18'),_0x3fbc55[_0x18aa('0x16')],_0x55dd7b);_0x47322a(_0x4ddd91[_0x18aa('0x14')](0x1f4,_0x3fbc55[_0x18aa('0x16')]));});});};exports[_0x18aa('0x25')]=function(_0x4eb31b){var _0x4ab943=this;return new Promise(function(_0x2d1ad1,_0x30f0e4){return db[_0x18aa('0x19')]['find']({'raw':_0x4eb31b['options']?_0x4eb31b[_0x18aa('0x1b')][_0x18aa('0x1c')]===undefined?!![]:![]:!![],'where':_0x4eb31b[_0x18aa('0x1b')]?_0x4eb31b[_0x18aa('0x1b')][_0x18aa('0x1d')]||null:null,'attributes':_0x4eb31b['options']?_0x4eb31b[_0x18aa('0x1b')][_0x18aa('0x21')]||null:null,'include':_0x4eb31b['options']?_0x4eb31b[_0x18aa('0x1b')][_0x18aa('0x1f')]?_[_0x18aa('0x22')](_0x4eb31b[_0x18aa('0x1b')][_0x18aa('0x1f')],function(_0x2227f4){return{'model':db[_0x2227f4[_0x18aa('0x20')]],'as':_0x2227f4['as'],'attributes':_0x2227f4['attributes'],'include':_0x2227f4[_0x18aa('0x1f')]?_[_0x18aa('0x22')](_0x2227f4[_0x18aa('0x1f')],function(_0x4a97c9){return{'model':db[_0x4a97c9[_0x18aa('0x20')]],'as':_0x4a97c9['as'],'attributes':_0x4a97c9[_0x18aa('0x21')],'include':_0x4a97c9[_0x18aa('0x1f')]?_[_0x18aa('0x22')](_0x4a97c9['include'],function(_0x5837ce){return{'model':db[_0x5837ce[_0x18aa('0x20')]],'as':_0x5837ce['as'],'attributes':_0x5837ce[_0x18aa('0x21')]};}):[]};}):[]};}):[]:[]})[_0x18aa('0xf')](function(_0x4bee68){logger[_0x18aa('0x10')]('ShowWhatsappQueue',_0x4eb31b);logger[_0x18aa('0x23')](_0x18aa('0x25'),_0x4eb31b,JSON['stringify'](_0x4bee68));_0x2d1ad1(_0x4bee68);})['catch'](function(_0x3a0a4c){logger[_0x18aa('0x14')](_0x18aa('0x25'),_0x3a0a4c[_0x18aa('0x16')],_0x4eb31b);_0x30f0e4(_0x4ab943[_0x18aa('0x14')](0x1f4,_0x3a0a4c['message']));});});}; \ No newline at end of file +var _0xb87a=['stringify','ShowWhatsappQueue','find','where','catch','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','WhatsappQueue,\x20%s,\x20%s','message','WhatsappQueue','options','raw','attributes','limit','include','model','map','info','GetWhatsappQueue','debug'];(function(_0xd3c1fc,_0x54e814){var _0x2735ed=function(_0x4547e7){while(--_0x4547e7){_0xd3c1fc['push'](_0xd3c1fc['shift']());}};_0x2735ed(++_0x54e814);}(_0xb87a,0x6e));var _0xab87=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xb87a[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab87('0x0'));var db=require(_0xab87('0x1'))['db'];var utils=require(_0xab87('0x2'));var logger=require(_0xab87('0x3'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xab87('0x4')]['http']({'port':0x232a});config[_0xab87('0x5')]=_[_0xab87('0x6')](config[_0xab87('0x5')],{'host':_0xab87('0x7'),'port':0x18eb});var socket=require(_0xab87('0x8'))(new Redis(config['redis']));require(_0xab87('0x9'))[_0xab87('0xa')](socket);function respondWithRpcPromise(_0xb7cd9f,_0x5d7a3b,_0x8606d4){return new BPromise(function(_0xd6edcc,_0x18bed6){return client[_0xab87('0xb')](_0xb7cd9f,_0x8606d4)[_0xab87('0xc')](function(_0x3b142d){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x5d7a3b,_0xab87('0xd'));logger['debug'](_0xab87('0xe'),_0x5d7a3b,_0xab87('0xd'),JSON['stringify'](_0x3b142d));if(_0x3b142d[_0xab87('0xf')]){if(_0x3b142d['error'][_0xab87('0x10')]===0x1f4){logger[_0xab87('0xf')](_0xab87('0x11'),_0x5d7a3b,_0x3b142d[_0xab87('0xf')][_0xab87('0x12')]);return _0x18bed6(_0x3b142d[_0xab87('0xf')]['message']);}logger[_0xab87('0xf')](_0xab87('0x11'),_0x5d7a3b,_0x3b142d[_0xab87('0xf')]['message']);return _0xd6edcc(_0x3b142d[_0xab87('0xf')]['message']);}else{logger['info'](_0xab87('0x11'),_0x5d7a3b,_0xab87('0xd'));_0xd6edcc(_0x3b142d['result'][_0xab87('0x12')]);}})['catch'](function(_0x45c638){logger['error'](_0xab87('0x11'),_0x5d7a3b,_0x45c638);_0x18bed6(_0x45c638);});});}exports['GetWhatsappQueue']=function(_0xe8e026){var _0x3b80d=this;return new Promise(function(_0xb8e431,_0x478ce3){return db[_0xab87('0x13')]['findAll']({'raw':_0xe8e026[_0xab87('0x14')]?_0xe8e026['options'][_0xab87('0x15')]===undefined?!![]:![]:!![],'where':_0xe8e026['options']?_0xe8e026[_0xab87('0x14')]['where']||null:null,'attributes':_0xe8e026[_0xab87('0x14')]?_0xe8e026['options'][_0xab87('0x16')]||null:null,'limit':_0xe8e026[_0xab87('0x14')]?_0xe8e026[_0xab87('0x14')][_0xab87('0x17')]||null:null,'include':_0xe8e026[_0xab87('0x14')]?_0xe8e026[_0xab87('0x14')][_0xab87('0x18')]?_['map'](_0xe8e026['options'][_0xab87('0x18')],function(_0x5df21e){return{'model':db[_0x5df21e[_0xab87('0x19')]],'as':_0x5df21e['as'],'attributes':_0x5df21e[_0xab87('0x16')],'include':_0x5df21e[_0xab87('0x18')]?_[_0xab87('0x1a')](_0x5df21e[_0xab87('0x18')],function(_0x312842){return{'model':db[_0x312842['model']],'as':_0x312842['as'],'attributes':_0x312842[_0xab87('0x16')],'include':_0x312842[_0xab87('0x18')]?_[_0xab87('0x1a')](_0x312842[_0xab87('0x18')],function(_0x187f98){return{'model':db[_0x187f98[_0xab87('0x19')]],'as':_0x187f98['as'],'attributes':_0x187f98[_0xab87('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a7f53){logger[_0xab87('0x1b')](_0xab87('0x1c'),_0xe8e026);logger[_0xab87('0x1d')](_0xab87('0x1c'),_0xe8e026,JSON[_0xab87('0x1e')](_0x4a7f53));_0xb8e431(_0x4a7f53);})['catch'](function(_0x9d84ef){logger[_0xab87('0xf')](_0xab87('0x1c'),_0x9d84ef[_0xab87('0x12')],_0xe8e026);_0x478ce3(_0x3b80d['error'](0x1f4,_0x9d84ef[_0xab87('0x12')]));});});};exports[_0xab87('0x1f')]=function(_0x4d1331){var _0x14255f=this;return new Promise(function(_0x37ab63,_0x5f398a){return db[_0xab87('0x13')][_0xab87('0x20')]({'raw':_0x4d1331['options']?_0x4d1331[_0xab87('0x14')][_0xab87('0x15')]===undefined?!![]:![]:!![],'where':_0x4d1331[_0xab87('0x14')]?_0x4d1331[_0xab87('0x14')][_0xab87('0x21')]||null:null,'attributes':_0x4d1331[_0xab87('0x14')]?_0x4d1331[_0xab87('0x14')][_0xab87('0x16')]||null:null,'include':_0x4d1331[_0xab87('0x14')]?_0x4d1331[_0xab87('0x14')]['include']?_[_0xab87('0x1a')](_0x4d1331['options'][_0xab87('0x18')],function(_0x5b40cc){return{'model':db[_0x5b40cc['model']],'as':_0x5b40cc['as'],'attributes':_0x5b40cc[_0xab87('0x16')],'include':_0x5b40cc['include']?_[_0xab87('0x1a')](_0x5b40cc[_0xab87('0x18')],function(_0xb17a17){return{'model':db[_0xb17a17[_0xab87('0x19')]],'as':_0xb17a17['as'],'attributes':_0xb17a17[_0xab87('0x16')],'include':_0xb17a17[_0xab87('0x18')]?_[_0xab87('0x1a')](_0xb17a17['include'],function(_0x48bd7b){return{'model':db[_0x48bd7b[_0xab87('0x19')]],'as':_0x48bd7b['as'],'attributes':_0x48bd7b[_0xab87('0x16')]};}):[]};}):[]};}):[]:[]})[_0xab87('0xc')](function(_0x17a343){logger[_0xab87('0x1b')](_0xab87('0x1f'),_0x4d1331);logger[_0xab87('0x1d')](_0xab87('0x1f'),_0x4d1331,JSON[_0xab87('0x1e')](_0x17a343));_0x37ab63(_0x17a343);})[_0xab87('0x22')](function(_0x17ed8d){logger[_0xab87('0xf')](_0xab87('0x1f'),_0x17ed8d['message'],_0x4d1331);_0x5f398a(_0x14255f['error'](0x1f4,_0x17ed8d[_0xab87('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 8ae9a83..ec0c069 100644 --- a/server/api/whatsappQueue/whatsappQueue.socket.js +++ b/server/api/whatsappQueue/whatsappQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbde8=['emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','update'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xbde8,0x155));var _0x8bde=function(_0x41cfd4,_0x1ed2cc){_0x41cfd4=_0x41cfd4-0x0;var _0x190f48=_0xbde8[_0x41cfd4];return _0x190f48;};'use strict';var WhatsappQueueEvents=require(_0x8bde('0x0'));var events=[_0x8bde('0x1'),'remove',_0x8bde('0x2')];function createListener(_0x298116,_0x1480d1){return function(_0x5de776){_0x1480d1[_0x8bde('0x3')](_0x298116,_0x5de776);};}function removeListener(_0x235330,_0x1e3137){return function(){WhatsappQueueEvents[_0x8bde('0x4')](_0x235330,_0x1e3137);};}exports[_0x8bde('0x5')]=function(_0x26e75c){for(var _0x2a3965=0x0,_0x2fa161=events[_0x8bde('0x6')];_0x2a3965<_0x2fa161;_0x2a3965++){var _0x54050c=events[_0x2a3965];var _0x9812c9=createListener(_0x8bde('0x7')+_0x54050c,_0x26e75c);WhatsappQueueEvents['on'](_0x54050c,_0x9812c9);}}; \ No newline at end of file +var _0xbabf=['./whatsappQueue.events','update','emit','register','length','whatsappQueue:'];(function(_0x3042c5,_0x36cb88){var _0x7cd140=function(_0x4cdcd8){while(--_0x4cdcd8){_0x3042c5['push'](_0x3042c5['shift']());}};_0x7cd140(++_0x36cb88);}(_0xbabf,0x156));var _0xfbab=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbabf[_0x126558];return _0x1f6d14;};'use strict';var WhatsappQueueEvents=require(_0xfbab('0x0'));var events=['save','remove',_0xfbab('0x1')];function createListener(_0x3d4983,_0x5d27bf){return function(_0x482fef){_0x5d27bf[_0xfbab('0x2')](_0x3d4983,_0x482fef);};}function removeListener(_0x18357c,_0x2d2eb3){return function(){WhatsappQueueEvents['removeListener'](_0x18357c,_0x2d2eb3);};}exports[_0xfbab('0x3')]=function(_0x181a19){for(var _0x42bc34=0x0,_0x3cf9a0=events[_0xfbab('0x4')];_0x42bc34<_0x3cf9a0;_0x42bc34++){var _0x328d2f=events[_0x42bc34];var _0x1484d4=createListener(_0xfbab('0x5')+_0x328d2f,_0x181a19);WhatsappQueueEvents['on'](_0x328d2f,_0x1484d4);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index a59162e..132865d 100644 --- a/server/api/whatsappQueueReport/index.js +++ b/server/api/whatsappQueueReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97a0=['/describe','describe','show','post','create','put','/:id','update','delete','destroy','multer','util','path','express','../../components/interaction/service','get','isAuthenticated'];(function(_0x10224e,_0x46a037){var _0x57e372=function(_0x5b19bd){while(--_0x5b19bd){_0x10224e['push'](_0x10224e['shift']());}};_0x57e372(++_0x46a037);}(_0x97a0,0xc5));var _0x097a=function(_0x5b9cee,_0x170f86){_0x5b9cee=_0x5b9cee-0x0;var _0x1770e2=_0x97a0[_0x5b9cee];return _0x1770e2;};'use strict';var multer=require(_0x097a('0x0'));var util=require(_0x097a('0x1'));var path=require(_0x097a('0x2'));var timeout=require('connect-timeout');var express=require(_0x097a('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x097a('0x4'));var config=require('../../config/environment');var controller=require('./whatsappQueueReport.controller');router[_0x097a('0x5')]('/',auth[_0x097a('0x6')](),controller['index']);router[_0x097a('0x5')](_0x097a('0x7'),auth['isAuthenticated'](),controller[_0x097a('0x8')]);router[_0x097a('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x097a('0x9')]);router[_0x097a('0xa')]('/',auth[_0x097a('0x6')](),controller[_0x097a('0xb')]);router[_0x097a('0xc')](_0x097a('0xd'),auth[_0x097a('0x6')](),controller[_0x097a('0xe')]);router[_0x097a('0xf')](_0x097a('0xd'),auth[_0x097a('0x6')](),controller[_0x097a('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8bca=['post','create','put','update','delete','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x50e29a,_0x1d4ba0){var _0x46179b=function(_0x1bb32d){while(--_0x1bb32d){_0x50e29a['push'](_0x50e29a['shift']());}};_0x46179b(++_0x1d4ba0);}(_0x8bca,0x12b));var _0xa8bc=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x8bca[_0x2ec461];return _0x28603d;};'use strict';var multer=require(_0xa8bc('0x0'));var util=require(_0xa8bc('0x1'));var path=require(_0xa8bc('0x2'));var timeout=require('connect-timeout');var express=require(_0xa8bc('0x3'));var router=express[_0xa8bc('0x4')]();var auth=require(_0xa8bc('0x5'));var interaction=require(_0xa8bc('0x6'));var config=require(_0xa8bc('0x7'));var controller=require(_0xa8bc('0x8'));router[_0xa8bc('0x9')]('/',auth[_0xa8bc('0xa')](),controller[_0xa8bc('0xb')]);router[_0xa8bc('0x9')](_0xa8bc('0xc'),auth['isAuthenticated'](),controller[_0xa8bc('0xd')]);router[_0xa8bc('0x9')](_0xa8bc('0xe'),auth[_0xa8bc('0xa')](),controller[_0xa8bc('0xf')]);router[_0xa8bc('0x10')]('/',auth[_0xa8bc('0xa')](),controller[_0xa8bc('0x11')]);router[_0xa8bc('0x12')](_0xa8bc('0xe'),auth[_0xa8bc('0xa')](),controller[_0xa8bc('0x13')]);router[_0xa8bc('0x14')](_0xa8bc('0xe'),auth[_0xa8bc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 6d1af7e..354a9ec 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x1422ed,_0x51c9b8){var _0x2fd8f4=function(_0x25a4fc){while(--_0x25a4fc){_0x1422ed['push'](_0x1422ed['shift']());}};_0x2fd8f4(++_0x51c9b8);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING','DATE'];(function(_0x40ec05,_0x179503){var _0x569be9=function(_0x490021){while(--_0x490021){_0x40ec05['push'](_0x40ec05['shift']());}};_0x569be9(++_0x179503);}(_0x34e8,0x12c));var _0x834e=function(_0x5be951,_0x1047fe){_0x5be951=_0x5be951-0x0;var _0x5c1063=_0x34e8[_0x5be951];return _0x5c1063;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'uniqueid':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x834e('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x834e('0x3')]},'acceptAt':{'type':Sequelize[_0x834e('0x3')]},'exitAt':{'type':Sequelize[_0x834e('0x3')]},'reason':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 807fdb6..31669f9 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x36d3=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','include','create','body','update','find','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','stack','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x36d3,0xb5));var _0x336d=function(_0x113c21,_0x30b9be){_0x113c21=_0x113c21-0x0;var _0xe51ead=_0x36d3[_0x113c21];return _0xe51ead;};'use strict';var pdf=require(_0x336d('0x0'));var emlformat=require(_0x336d('0x1'));var rimraf=require(_0x336d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x336d('0x3'));var moment=require(_0x336d('0x4'));var BPromise=require(_0x336d('0x5'));var Mustache=require(_0x336d('0x6'));var util=require(_0x336d('0x7'));var path=require(_0x336d('0x8'));var sox=require(_0x336d('0x9'));var csv=require(_0x336d('0xa'));var ejs=require(_0x336d('0xb'));var fs=require('fs');var _=require(_0x336d('0xc'));var squel=require(_0x336d('0xd'));var crypto=require(_0x336d('0xe'));var jsforce=require(_0x336d('0xf'));var deskjs=require(_0x336d('0x10'));var toCsv=require(_0x336d('0xa'));var querystring=require(_0x336d('0x11'));var Papa=require('papaparse');var Redis=require(_0x336d('0x12'));var authService=require(_0x336d('0x13'));var qs=require(_0x336d('0x14'));var as=require(_0x336d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x336d('0x16'))(_0x336d('0x17'));var utils=require(_0x336d('0x18'));var config=require(_0x336d('0x19'));var db=require(_0x336d('0x1a'))['db'];function respondWithStatusCode(_0x2c4bb3,_0x2cbea8){_0x2cbea8=_0x2cbea8||0xcc;return function(_0x271716){if(_0x271716){return _0x2c4bb3[_0x336d('0x1b')](_0x2cbea8);}return _0x2c4bb3[_0x336d('0x1c')](_0x2cbea8)[_0x336d('0x1d')]();};}function respondWithResult(_0x2ab8b1,_0x167720){_0x167720=_0x167720||0xc8;return function(_0x2ad93a){if(_0x2ad93a){return _0x2ab8b1[_0x336d('0x1c')](_0x167720)[_0x336d('0x1e')](_0x2ad93a);}};}function respondWithFilteredResult(_0x5bd2b5,_0x3ce54a){return function(_0x2c488e){if(_0x2c488e){var _0x470254=_0x2c488e[_0x336d('0x1f')],_0x970cb8=_0x3ce54a['offset'],_0x2dafce=_0x3ce54a[_0x336d('0x20')]+_0x3ce54a[_0x336d('0x21')],_0x587ecc;if(_0x2dafce>=_0x470254){_0x2dafce=_0x470254;_0x587ecc=0xc8;}else{_0x587ecc=0xce;}_0x5bd2b5[_0x336d('0x1c')](_0x587ecc);return _0x5bd2b5[_0x336d('0x22')](_0x336d('0x23'),_0x970cb8+'-'+_0x2dafce+'/'+_0x470254)[_0x336d('0x1e')](_0x2c488e);}return null;};}function patchUpdates(_0x4c5cc2){return function(_0x1f14b8){try{jsonpatch[_0x336d('0x24')](_0x1f14b8,_0x4c5cc2,!![]);}catch(_0x5439c7){return BPromise[_0x336d('0x25')](_0x5439c7);}return _0x1f14b8['save']();};}function saveUpdates(_0x11075f,_0x24f781){return function(_0x1dcce8){if(_0x1dcce8){return _0x1dcce8['update'](_0x11075f)[_0x336d('0x26')](function(_0x4a64ba){return _0x4a64ba;});}return null;};}function removeEntity(_0x557979,_0xe71ed6){return function(_0xec828d){if(_0xec828d){return _0xec828d[_0x336d('0x27')]()[_0x336d('0x26')](function(){_0x557979[_0x336d('0x1c')](0xcc)[_0x336d('0x1d')]();});}};}function handleEntityNotFound(_0x5a7bba,_0xeaa7cf){return function(_0x23ba74){if(!_0x23ba74){_0x5a7bba['sendStatus'](0x194);}return _0x23ba74;};}function handleError(_0x30d903,_0x111074){_0x111074=_0x111074||0x1f4;return function(_0xb241f2){logger['error'](_0xb241f2[_0x336d('0x28')]);if(_0xb241f2[_0x336d('0x29')]){delete _0xb241f2['name'];}_0x30d903[_0x336d('0x1c')](_0x111074)[_0x336d('0x2a')](_0xb241f2);};}exports['index']=function(_0x285b37,_0x3fd544){var _0x4e33ed={},_0x1e6428={},_0x178b4f={'count':0x0,'rows':[]};var _0x1834ef=_[_0x336d('0x2b')](db[_0x336d('0x2c')][_0x336d('0x2d')],function(_0x5c20a0){return{'name':_0x5c20a0[_0x336d('0x2e')],'type':_0x5c20a0[_0x336d('0x2f')][_0x336d('0x30')]};});_0x1e6428[_0x336d('0x31')]=_[_0x336d('0x2b')](_0x1834ef,_0x336d('0x29'));_0x1e6428[_0x336d('0x32')]=_['keys'](_0x285b37[_0x336d('0x32')]);_0x1e6428[_0x336d('0x33')]=_[_0x336d('0x34')](_0x1e6428[_0x336d('0x31')],_0x1e6428['query']);_0x4e33ed[_0x336d('0x35')]=_[_0x336d('0x34')](_0x1e6428['model'],qs['fields'](_0x285b37['query'][_0x336d('0x36')]));_0x4e33ed[_0x336d('0x35')]=_0x4e33ed[_0x336d('0x35')][_0x336d('0x37')]?_0x4e33ed['attributes']:_0x1e6428['model'];if(!_0x285b37['query'][_0x336d('0x38')](_0x336d('0x39'))){_0x4e33ed[_0x336d('0x21')]=qs['limit'](_0x285b37['query'][_0x336d('0x21')]);_0x4e33ed[_0x336d('0x20')]=qs[_0x336d('0x20')](_0x285b37[_0x336d('0x32')][_0x336d('0x20')]);}_0x4e33ed['order']=qs[_0x336d('0x3a')](_0x285b37[_0x336d('0x32')][_0x336d('0x3a')]);_0x4e33ed[_0x336d('0x3b')]=qs['filters'](_[_0x336d('0x3c')](_0x285b37[_0x336d('0x32')],_0x1e6428['filters']),_0x1834ef);if(_0x285b37['query'][_0x336d('0x3d')]){_0x4e33ed[_0x336d('0x3b')]=_[_0x336d('0x3e')](_0x4e33ed['where'],{'$or':_['map'](_0x1834ef,function(_0x9046a1){if(_0x9046a1[_0x336d('0x2f')]!==_0x336d('0x3f')){var _0x11f1ae={};_0x11f1ae[_0x9046a1[_0x336d('0x29')]]={'$like':'%'+_0x285b37[_0x336d('0x32')][_0x336d('0x3d')]+'%'};return _0x11f1ae;}})});}_0x4e33ed=_['merge']({},_0x4e33ed,_0x285b37[_0x336d('0x40')]);var _0x27572e={'where':_0x4e33ed[_0x336d('0x3b')]};return db[_0x336d('0x2c')][_0x336d('0x1f')](_0x27572e)['then'](function(_0x36a4f4){_0x178b4f['count']=_0x36a4f4;if(_0x285b37[_0x336d('0x32')][_0x336d('0x41')]){_0x4e33ed['include']=[{'all':!![]}];}return db[_0x336d('0x2c')][_0x336d('0x42')](_0x4e33ed);})[_0x336d('0x26')](function(_0xd18406){_0x178b4f['rows']=_0xd18406;return _0x178b4f;})['then'](respondWithFilteredResult(_0x3fd544,_0x4e33ed))[_0x336d('0x43')](handleError(_0x3fd544,null));};exports[_0x336d('0x44')]=function(_0x596f56,_0x4de7ef){var _0x5f576d={'raw':!![],'where':{'id':_0x596f56[_0x336d('0x45')]['id']}},_0x1c5750={};_0x1c5750[_0x336d('0x31')]=_[_0x336d('0x46')](db[_0x336d('0x2c')][_0x336d('0x2d')]);_0x1c5750[_0x336d('0x32')]=_[_0x336d('0x46')](_0x596f56['query']);_0x1c5750['filters']=_['intersection'](_0x1c5750['model'],_0x1c5750[_0x336d('0x32')]);_0x5f576d[_0x336d('0x35')]=_[_0x336d('0x34')](_0x1c5750['model'],qs[_0x336d('0x36')](_0x596f56[_0x336d('0x32')][_0x336d('0x36')]));_0x5f576d[_0x336d('0x35')]=_0x5f576d[_0x336d('0x35')]['length']?_0x5f576d[_0x336d('0x35')]:_0x1c5750['model'];if(_0x596f56[_0x336d('0x32')][_0x336d('0x41')]){_0x5f576d[_0x336d('0x47')]=[{'all':!![]}];}_0x5f576d=_[_0x336d('0x3e')]({},_0x5f576d,_0x596f56[_0x336d('0x40')]);return db['WhatsappQueueReport']['find'](_0x5f576d)[_0x336d('0x26')](handleEntityNotFound(_0x4de7ef,null))[_0x336d('0x26')](respondWithResult(_0x4de7ef,null))[_0x336d('0x43')](handleError(_0x4de7ef,null));};exports[_0x336d('0x48')]=function(_0x119573,_0x35aec0){return db[_0x336d('0x2c')]['create'](_0x119573[_0x336d('0x49')],{})[_0x336d('0x26')](respondWithResult(_0x35aec0,0xc9))['catch'](handleError(_0x35aec0,null));};exports[_0x336d('0x4a')]=function(_0x383d3f,_0x46e7fb){if(_0x383d3f['body']['id']){delete _0x383d3f['body']['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x383d3f[_0x336d('0x45')]['id']}})['then'](handleEntityNotFound(_0x46e7fb,null))[_0x336d('0x26')](saveUpdates(_0x383d3f[_0x336d('0x49')],null))['then'](respondWithResult(_0x46e7fb,null))[_0x336d('0x43')](handleError(_0x46e7fb,null));};exports[_0x336d('0x27')]=function(_0x4222e4,_0x51c1ca){return db[_0x336d('0x2c')][_0x336d('0x4b')]({'where':{'id':_0x4222e4[_0x336d('0x45')]['id']}})[_0x336d('0x26')](handleEntityNotFound(_0x51c1ca,null))[_0x336d('0x26')](removeEntity(_0x51c1ca,null))[_0x336d('0x43')](handleError(_0x51c1ca,null));};exports[_0x336d('0x4c')]=function(_0x1a9f54,_0x4c93f1){return db[_0x336d('0x2c')][_0x336d('0x4c')]()[_0x336d('0x26')](respondWithResult(_0x4c93f1,null))[_0x336d('0x43')](handleError(_0x4c93f1,null));}; \ No newline at end of file +var _0xe1d1=['fields','merge','options','find','create','catch','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','then','name','send','index','map','WhatsappQueueReport','rawAttributes','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','rows','show','keys'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xe1d1,0x131));var _0x1e1d=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xe1d1[_0x2235bf];return _0x4c3a64;};'use strict';var pdf=require(_0x1e1d('0x0'));var emlformat=require(_0x1e1d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1e1d('0x2'));var jsonpatch=require(_0x1e1d('0x3'));var rp=require(_0x1e1d('0x4'));var moment=require(_0x1e1d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1e1d('0x6'));var util=require(_0x1e1d('0x7'));var path=require(_0x1e1d('0x8'));var sox=require(_0x1e1d('0x9'));var csv=require(_0x1e1d('0xa'));var ejs=require(_0x1e1d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1e1d('0xc'));var crypto=require(_0x1e1d('0xd'));var jsforce=require(_0x1e1d('0xe'));var deskjs=require(_0x1e1d('0xf'));var toCsv=require(_0x1e1d('0xa'));var querystring=require(_0x1e1d('0x10'));var Papa=require('papaparse');var Redis=require(_0x1e1d('0x11'));var authService=require(_0x1e1d('0x12'));var qs=require(_0x1e1d('0x13'));var as=require(_0x1e1d('0x14'));var hardwareService=require(_0x1e1d('0x15'));var logger=require(_0x1e1d('0x16'))(_0x1e1d('0x17'));var utils=require('../../config/utils');var config=require(_0x1e1d('0x18'));var db=require(_0x1e1d('0x19'))['db'];function respondWithStatusCode(_0x1ebf5e,_0x1c209d){_0x1c209d=_0x1c209d||0xcc;return function(_0x37fd79){if(_0x37fd79){return _0x1ebf5e['sendStatus'](_0x1c209d);}return _0x1ebf5e[_0x1e1d('0x1a')](_0x1c209d)[_0x1e1d('0x1b')]();};}function respondWithResult(_0x3f2e59,_0x50f09a){_0x50f09a=_0x50f09a||0xc8;return function(_0x38aa77){if(_0x38aa77){return _0x3f2e59[_0x1e1d('0x1a')](_0x50f09a)[_0x1e1d('0x1c')](_0x38aa77);}};}function respondWithFilteredResult(_0x119a87,_0x157840){return function(_0x5c4ae1){if(_0x5c4ae1){var _0x16cdf5=_0x5c4ae1[_0x1e1d('0x1d')],_0x466bdb=_0x157840[_0x1e1d('0x1e')],_0x2bc2cf=_0x157840[_0x1e1d('0x1e')]+_0x157840[_0x1e1d('0x1f')],_0x274b76;if(_0x2bc2cf>=_0x16cdf5){_0x2bc2cf=_0x16cdf5;_0x274b76=0xc8;}else{_0x274b76=0xce;}_0x119a87['status'](_0x274b76);return _0x119a87[_0x1e1d('0x20')]('Content-Range',_0x466bdb+'-'+_0x2bc2cf+'/'+_0x16cdf5)[_0x1e1d('0x1c')](_0x5c4ae1);}return null;};}function patchUpdates(_0x5eae62){return function(_0x2cb5ab){try{jsonpatch[_0x1e1d('0x21')](_0x2cb5ab,_0x5eae62,!![]);}catch(_0x148d32){return BPromise[_0x1e1d('0x22')](_0x148d32);}return _0x2cb5ab[_0x1e1d('0x23')]();};}function saveUpdates(_0x4b2f34,_0x1ef527){return function(_0x2ed406){if(_0x2ed406){return _0x2ed406[_0x1e1d('0x24')](_0x4b2f34)['then'](function(_0x511548){return _0x511548;});}return null;};}function removeEntity(_0x747fc7,_0x24b1bb){return function(_0x53e8a1){if(_0x53e8a1){return _0x53e8a1[_0x1e1d('0x25')]()[_0x1e1d('0x26')](function(){_0x747fc7[_0x1e1d('0x1a')](0xcc)[_0x1e1d('0x1b')]();});}};}function handleEntityNotFound(_0xc0d6c0,_0x59124f){return function(_0x1a11dc){if(!_0x1a11dc){_0xc0d6c0['sendStatus'](0x194);}return _0x1a11dc;};}function handleError(_0x5f05f1,_0x3c3cb6){_0x3c3cb6=_0x3c3cb6||0x1f4;return function(_0x26aeab){logger['error'](_0x26aeab['stack']);if(_0x26aeab[_0x1e1d('0x27')]){delete _0x26aeab[_0x1e1d('0x27')];}_0x5f05f1['status'](_0x3c3cb6)[_0x1e1d('0x28')](_0x26aeab);};}exports[_0x1e1d('0x29')]=function(_0xdc69ee,_0x4427e9){var _0x82ee43={},_0x15f703={},_0x3c1181={'count':0x0,'rows':[]};var _0x47cb5f=_[_0x1e1d('0x2a')](db[_0x1e1d('0x2b')][_0x1e1d('0x2c')],function(_0xb1388b){return{'name':_0xb1388b['fieldName'],'type':_0xb1388b['type'][_0x1e1d('0x2d')]};});_0x15f703[_0x1e1d('0x2e')]=_[_0x1e1d('0x2a')](_0x47cb5f,'name');_0x15f703[_0x1e1d('0x2f')]=_['keys'](_0xdc69ee[_0x1e1d('0x2f')]);_0x15f703[_0x1e1d('0x30')]=_[_0x1e1d('0x31')](_0x15f703[_0x1e1d('0x2e')],_0x15f703[_0x1e1d('0x2f')]);_0x82ee43[_0x1e1d('0x32')]=_[_0x1e1d('0x31')](_0x15f703['model'],qs['fields'](_0xdc69ee[_0x1e1d('0x2f')]['fields']));_0x82ee43['attributes']=_0x82ee43[_0x1e1d('0x32')][_0x1e1d('0x33')]?_0x82ee43[_0x1e1d('0x32')]:_0x15f703['model'];if(!_0xdc69ee[_0x1e1d('0x2f')][_0x1e1d('0x34')](_0x1e1d('0x35'))){_0x82ee43['limit']=qs['limit'](_0xdc69ee[_0x1e1d('0x2f')][_0x1e1d('0x1f')]);_0x82ee43[_0x1e1d('0x1e')]=qs['offset'](_0xdc69ee['query'][_0x1e1d('0x1e')]);}_0x82ee43[_0x1e1d('0x36')]=qs[_0x1e1d('0x37')](_0xdc69ee[_0x1e1d('0x2f')]['sort']);_0x82ee43[_0x1e1d('0x38')]=qs['filters'](_[_0x1e1d('0x39')](_0xdc69ee['query'],_0x15f703[_0x1e1d('0x30')]),_0x47cb5f);if(_0xdc69ee[_0x1e1d('0x2f')][_0x1e1d('0x3a')]){_0x82ee43[_0x1e1d('0x38')]=_['merge'](_0x82ee43[_0x1e1d('0x38')],{'$or':_['map'](_0x47cb5f,function(_0x36daf2){if(_0x36daf2['type']!==_0x1e1d('0x3b')){var _0x2cd83d={};_0x2cd83d[_0x36daf2[_0x1e1d('0x27')]]={'$like':'%'+_0xdc69ee[_0x1e1d('0x2f')]['filter']+'%'};return _0x2cd83d;}})});}_0x82ee43=_['merge']({},_0x82ee43,_0xdc69ee['options']);var _0x2dbd33={'where':_0x82ee43[_0x1e1d('0x38')]};return db['WhatsappQueueReport'][_0x1e1d('0x1d')](_0x2dbd33)[_0x1e1d('0x26')](function(_0x5bc7d5){_0x3c1181[_0x1e1d('0x1d')]=_0x5bc7d5;if(_0xdc69ee['query'][_0x1e1d('0x3c')]){_0x82ee43[_0x1e1d('0x3d')]=[{'all':!![]}];}return db[_0x1e1d('0x2b')]['findAll'](_0x82ee43);})[_0x1e1d('0x26')](function(_0x5e478b){_0x3c1181[_0x1e1d('0x3e')]=_0x5e478b;return _0x3c1181;})[_0x1e1d('0x26')](respondWithFilteredResult(_0x4427e9,_0x82ee43))['catch'](handleError(_0x4427e9,null));};exports[_0x1e1d('0x3f')]=function(_0x45a174,_0x65d921){var _0x2e4528={'raw':!![],'where':{'id':_0x45a174['params']['id']}},_0x1ae1d8={};_0x1ae1d8[_0x1e1d('0x2e')]=_['keys'](db[_0x1e1d('0x2b')][_0x1e1d('0x2c')]);_0x1ae1d8[_0x1e1d('0x2f')]=_[_0x1e1d('0x40')](_0x45a174['query']);_0x1ae1d8['filters']=_[_0x1e1d('0x31')](_0x1ae1d8[_0x1e1d('0x2e')],_0x1ae1d8[_0x1e1d('0x2f')]);_0x2e4528[_0x1e1d('0x32')]=_[_0x1e1d('0x31')](_0x1ae1d8['model'],qs[_0x1e1d('0x41')](_0x45a174['query'][_0x1e1d('0x41')]));_0x2e4528[_0x1e1d('0x32')]=_0x2e4528[_0x1e1d('0x32')][_0x1e1d('0x33')]?_0x2e4528[_0x1e1d('0x32')]:_0x1ae1d8[_0x1e1d('0x2e')];if(_0x45a174[_0x1e1d('0x2f')][_0x1e1d('0x3c')]){_0x2e4528[_0x1e1d('0x3d')]=[{'all':!![]}];}_0x2e4528=_[_0x1e1d('0x42')]({},_0x2e4528,_0x45a174[_0x1e1d('0x43')]);return db[_0x1e1d('0x2b')][_0x1e1d('0x44')](_0x2e4528)[_0x1e1d('0x26')](handleEntityNotFound(_0x65d921,null))[_0x1e1d('0x26')](respondWithResult(_0x65d921,null))['catch'](handleError(_0x65d921,null));};exports['create']=function(_0x585636,_0x110195){return db[_0x1e1d('0x2b')][_0x1e1d('0x45')](_0x585636['body'],{})['then'](respondWithResult(_0x110195,0xc9))[_0x1e1d('0x46')](handleError(_0x110195,null));};exports['update']=function(_0xb6e13f,_0x31bb95){if(_0xb6e13f[_0x1e1d('0x47')]['id']){delete _0xb6e13f['body']['id'];}return db[_0x1e1d('0x2b')][_0x1e1d('0x44')]({'where':{'id':_0xb6e13f[_0x1e1d('0x48')]['id']}})[_0x1e1d('0x26')](handleEntityNotFound(_0x31bb95,null))[_0x1e1d('0x26')](saveUpdates(_0xb6e13f[_0x1e1d('0x47')],null))[_0x1e1d('0x26')](respondWithResult(_0x31bb95,null))[_0x1e1d('0x46')](handleError(_0x31bb95,null));};exports[_0x1e1d('0x25')]=function(_0x1e7bc3,_0x57f008){return db[_0x1e1d('0x2b')][_0x1e1d('0x44')]({'where':{'id':_0x1e7bc3['params']['id']}})[_0x1e1d('0x26')](handleEntityNotFound(_0x57f008,null))['then'](removeEntity(_0x57f008,null))['catch'](handleError(_0x57f008,null));};exports[_0x1e1d('0x49')]=function(_0x5fd2e1,_0x999266){return db[_0x1e1d('0x2b')][_0x1e1d('0x49')]()['then'](respondWithResult(_0x999266,null))[_0x1e1d('0x46')](handleError(_0x999266,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 147ef82..dec8088 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.model.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb1a4=['util','../../config/logger','request-promise','path','../../config/environment','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash'];(function(_0x3bd269,_0x264451){var _0x38f86d=function(_0x35fed3){while(--_0x35fed3){_0x3bd269['push'](_0x3bd269['shift']());}};_0x38f86d(++_0x264451);}(_0xb1a4,0x16a));var _0x4b1a=function(_0x46fe45,_0x3fa9a6){_0x46fe45=_0x46fe45-0x0;var _0x35eedb=_0xb1a4[_0x46fe45];return _0x35eedb;};'use strict';var _=require(_0x4b1a('0x0'));var util=require(_0x4b1a('0x1'));var logger=require(_0x4b1a('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4b1a('0x3'));var fs=require('fs');var path=require(_0x4b1a('0x4'));var rimraf=require('rimraf');var config=require(_0x4b1a('0x5'));var attributes=require('./whatsappQueueReport.attributes');module[_0x4b1a('0x6')]=function(_0x349b65,_0x5e1826){return _0x349b65[_0x4b1a('0x7')](_0x4b1a('0x8'),attributes,{'tableName':_0x4b1a('0x9'),'paranoid':![],'indexes':[{'name':_0x4b1a('0xa'),'fields':[_0x4b1a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9a37=['define','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x9a37,0x17d));var _0x79a3=function(_0x286354,_0x128be5){_0x286354=_0x286354-0x0;var _0x30fe4d=_0x9a37[_0x286354];return _0x30fe4d;};'use strict';var _=require(_0x79a3('0x0'));var util=require(_0x79a3('0x1'));var logger=require(_0x79a3('0x2'))(_0x79a3('0x3'));var moment=require(_0x79a3('0x4'));var BPromise=require(_0x79a3('0x5'));var rp=require(_0x79a3('0x6'));var fs=require('fs');var path=require(_0x79a3('0x7'));var rimraf=require(_0x79a3('0x8'));var config=require(_0x79a3('0x9'));var attributes=require('./whatsappQueueReport.attributes');module[_0x79a3('0xa')]=function(_0x566a18,_0xb857de){return _0x566a18[_0x79a3('0xb')]('WhatsappQueueReport',attributes,{'tableName':_0x79a3('0xc'),'paranoid':![],'indexes':[{'name':_0x79a3('0xd'),'fields':[_0x79a3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index c59922e..9eba439 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0268=['info','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','WhatsappQueueReport','body','options','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','where','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x58dd67,_0x38a11){var _0x524526=function(_0x370274){while(--_0x370274){_0x58dd67['push'](_0x58dd67['shift']());}};_0x524526(++_0x38a11);}(_0x0268,0xb9));var _0x8026=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0268[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x8026('0x0'));var moment=require(_0x8026('0x1'));var BPromise=require(_0x8026('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8026('0x3'));var db=require(_0x8026('0x4'))['db'];var utils=require(_0x8026('0x5'));var logger=require(_0x8026('0x6'))(_0x8026('0x7'));var config=require(_0x8026('0x8'));var jayson=require(_0x8026('0x9'));var client=jayson[_0x8026('0xa')][_0x8026('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c2a95,_0x120ac2,_0x45cb30){return new BPromise(function(_0x5e11b7,_0x1afd90){return client['request'](_0x5c2a95,_0x45cb30)[_0x8026('0xc')](function(_0x45589a){logger[_0x8026('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x120ac2,'request\x20sent');logger[_0x8026('0xe')](_0x8026('0xf'),_0x120ac2,_0x8026('0x10'),JSON[_0x8026('0x11')](_0x45589a));if(_0x45589a['error']){if(_0x45589a[_0x8026('0x12')][_0x8026('0x13')]===0x1f4){logger[_0x8026('0x12')](_0x8026('0x14'),_0x120ac2,_0x45589a[_0x8026('0x12')][_0x8026('0x15')]);return _0x1afd90(_0x45589a[_0x8026('0x12')]['message']);}logger[_0x8026('0x12')](_0x8026('0x14'),_0x120ac2,_0x45589a['error'][_0x8026('0x15')]);return _0x5e11b7(_0x45589a[_0x8026('0x12')][_0x8026('0x15')]);}else{logger[_0x8026('0xd')](_0x8026('0x14'),_0x120ac2,'request\x20sent');_0x5e11b7(_0x45589a[_0x8026('0x16')][_0x8026('0x15')]);}})[_0x8026('0x17')](function(_0x2ceef8){logger['error'](_0x8026('0x14'),_0x120ac2,_0x2ceef8);_0x1afd90(_0x2ceef8);});});}exports['CreateWhatsappQueueReport']=function(_0x1b2e80){var _0x5910a4=this;return new Promise(function(_0x5d85cb,_0x2508c0){return db[_0x8026('0x18')]['create'](_0x1b2e80[_0x8026('0x19')],{'raw':_0x1b2e80[_0x8026('0x1a')]?_0x1b2e80['options']['raw']===undefined?!![]:![]:!![]})[_0x8026('0xc')](function(_0x4c7a11){logger[_0x8026('0xd')](_0x8026('0x1b'),_0x1b2e80);logger[_0x8026('0xe')](_0x8026('0x1b'),_0x1b2e80,JSON[_0x8026('0x11')](_0x4c7a11));_0x5d85cb(_0x4c7a11);})['catch'](function(_0x30474a){logger[_0x8026('0x12')](_0x8026('0x1b'),_0x30474a['message'],_0x1b2e80);_0x2508c0(_0x5910a4[_0x8026('0x12')](0x1f4,_0x30474a[_0x8026('0x15')]));});});};exports[_0x8026('0x1c')]=function(_0x2845fb){var _0x520821=this;return new Promise(function(_0x1fd13d,_0x18489f){return db['WhatsappQueueReport'][_0x8026('0x1d')](_0x2845fb['body'],{'raw':_0x2845fb[_0x8026('0x1a')]?_0x2845fb['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2845fb['options']?_0x2845fb[_0x8026('0x1a')][_0x8026('0x1e')]||null:null,'attributes':_0x2845fb[_0x8026('0x1a')]?_0x2845fb[_0x8026('0x1a')][_0x8026('0x1f')]||null:null,'limit':_0x2845fb[_0x8026('0x1a')]?_0x2845fb['options'][_0x8026('0x20')]||null:null})['then'](function(_0x70f474){logger[_0x8026('0xd')](_0x8026('0x1c'),_0x2845fb);logger[_0x8026('0xe')]('UpdateWhatsappQueueReport',_0x2845fb,JSON[_0x8026('0x11')](_0x70f474));_0x1fd13d(_0x70f474);})[_0x8026('0x17')](function(_0x4748f1){logger[_0x8026('0x12')]('UpdateWhatsappQueueReport',_0x4748f1[_0x8026('0x15')],_0x2845fb);_0x18489f(_0x520821[_0x8026('0x12')](0x1f4,_0x4748f1[_0x8026('0x15')]));});});}; \ No newline at end of file +var _0x2745=['lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','UpdateWhatsappQueueReport','update','body','where','attributes','limit'];(function(_0x24bf11,_0x320ad8){var _0x20f05b=function(_0x175223){while(--_0x175223){_0x24bf11['push'](_0x24bf11['shift']());}};_0x20f05b(++_0x320ad8);}(_0x2745,0x155));var _0x5274=function(_0x53088c,_0x328aa2){_0x53088c=_0x53088c-0x0;var _0x330c89=_0x2745[_0x53088c];return _0x330c89;};'use strict';var _=require(_0x5274('0x0'));var util=require(_0x5274('0x1'));var moment=require('moment');var BPromise=require(_0x5274('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5274('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5274('0x4'))(_0x5274('0x5'));var config=require('../../config/environment');var jayson=require(_0x5274('0x6'));var client=jayson[_0x5274('0x7')][_0x5274('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c8271,_0x2e95d6,_0x59d6b4){return new BPromise(function(_0x1db6ab,_0x29bc57){return client['request'](_0x5c8271,_0x59d6b4)[_0x5274('0x9')](function(_0x43c92f){logger[_0x5274('0xa')](_0x5274('0xb'),_0x2e95d6,_0x5274('0xc'));logger[_0x5274('0xd')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x2e95d6,'request\x20sent',JSON[_0x5274('0xe')](_0x43c92f));if(_0x43c92f[_0x5274('0xf')]){if(_0x43c92f[_0x5274('0xf')][_0x5274('0x10')]===0x1f4){logger['error'](_0x5274('0xb'),_0x2e95d6,_0x43c92f[_0x5274('0xf')][_0x5274('0x11')]);return _0x29bc57(_0x43c92f[_0x5274('0xf')]['message']);}logger[_0x5274('0xf')](_0x5274('0xb'),_0x2e95d6,_0x43c92f[_0x5274('0xf')][_0x5274('0x11')]);return _0x1db6ab(_0x43c92f[_0x5274('0xf')]['message']);}else{logger[_0x5274('0xa')](_0x5274('0xb'),_0x2e95d6,_0x5274('0xc'));_0x1db6ab(_0x43c92f[_0x5274('0x12')][_0x5274('0x11')]);}})[_0x5274('0x13')](function(_0x548755){logger[_0x5274('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2e95d6,_0x548755);_0x29bc57(_0x548755);});});}exports[_0x5274('0x14')]=function(_0x230c78){var _0x506f7c=this;return new Promise(function(_0x4239ff,_0x465b77){return db[_0x5274('0x15')][_0x5274('0x16')](_0x230c78['body'],{'raw':_0x230c78[_0x5274('0x17')]?_0x230c78['options'][_0x5274('0x18')]===undefined?!![]:![]:!![]})[_0x5274('0x9')](function(_0x4781dc){logger[_0x5274('0xa')](_0x5274('0x14'),_0x230c78);logger[_0x5274('0xd')](_0x5274('0x14'),_0x230c78,JSON[_0x5274('0xe')](_0x4781dc));_0x4239ff(_0x4781dc);})[_0x5274('0x13')](function(_0x5a6edc){logger[_0x5274('0xf')](_0x5274('0x14'),_0x5a6edc[_0x5274('0x11')],_0x230c78);_0x465b77(_0x506f7c[_0x5274('0xf')](0x1f4,_0x5a6edc[_0x5274('0x11')]));});});};exports[_0x5274('0x19')]=function(_0x1f29f1){var _0x13df9c=this;return new Promise(function(_0x145232,_0x26c799){return db[_0x5274('0x15')][_0x5274('0x1a')](_0x1f29f1[_0x5274('0x1b')],{'raw':_0x1f29f1['options']?_0x1f29f1['options'][_0x5274('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f29f1[_0x5274('0x17')]?_0x1f29f1[_0x5274('0x17')][_0x5274('0x1c')]||null:null,'attributes':_0x1f29f1[_0x5274('0x17')]?_0x1f29f1[_0x5274('0x17')][_0x5274('0x1d')]||null:null,'limit':_0x1f29f1[_0x5274('0x17')]?_0x1f29f1[_0x5274('0x17')][_0x5274('0x1e')]||null:null})[_0x5274('0x9')](function(_0x445653){logger[_0x5274('0xa')](_0x5274('0x19'),_0x1f29f1);logger[_0x5274('0xd')]('UpdateWhatsappQueueReport',_0x1f29f1,JSON['stringify'](_0x445653));_0x145232(_0x445653);})['catch'](function(_0x34db9a){logger[_0x5274('0xf')](_0x5274('0x19'),_0x34db9a['message'],_0x1f29f1);_0x26c799(_0x13df9c[_0x5274('0xf')](0x1f4,_0x34db9a['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index bbb70eb..e5d8432 100644 --- a/server/api/whatsappTransferReport/index.js +++ b/server/api/whatsappTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x117c=['Router','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','multer','path','express'];(function(_0x4b06ad,_0x1c8583){var _0x24f38e=function(_0x545fdc){while(--_0x545fdc){_0x4b06ad['push'](_0x4b06ad['shift']());}};_0x24f38e(++_0x1c8583);}(_0x117c,0x11d));var _0xc117=function(_0x2e81f4,_0x44f46a){_0x2e81f4=_0x2e81f4-0x0;var _0x198f70=_0x117c[_0x2e81f4];return _0x198f70;};'use strict';var multer=require(_0xc117('0x0'));var util=require('util');var path=require(_0xc117('0x1'));var timeout=require('connect-timeout');var express=require(_0xc117('0x2'));var router=express[_0xc117('0x3')]();var auth=require(_0xc117('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc117('0x5'));var controller=require('./whatsappTransferReport.controller');router[_0xc117('0x6')]('/',auth[_0xc117('0x7')](),controller['index']);router[_0xc117('0x6')]('/describe',auth[_0xc117('0x7')](),controller[_0xc117('0x8')]);router['get'](_0xc117('0x9'),auth[_0xc117('0x7')](),controller[_0xc117('0xa')]);router[_0xc117('0xb')]('/',auth['isAuthenticated'](),controller[_0xc117('0xc')]);router[_0xc117('0xd')](_0xc117('0x9'),auth[_0xc117('0x7')](),controller[_0xc117('0xe')]);router['delete'](_0xc117('0x9'),auth[_0xc117('0x7')](),controller[_0xc117('0xf')]);module['exports']=router; \ No newline at end of file +var _0x8a17=['put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','create'];(function(_0x389c94,_0x2a93d9){var _0x1455cb=function(_0x5903d6){while(--_0x5903d6){_0x389c94['push'](_0x389c94['shift']());}};_0x1455cb(++_0x2a93d9);}(_0x8a17,0x135));var _0x78a1=function(_0x3d4876,_0x366386){_0x3d4876=_0x3d4876-0x0;var _0x58ca9d=_0x8a17[_0x3d4876];return _0x58ca9d;};'use strict';var multer=require(_0x78a1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x78a1('0x1'));var express=require(_0x78a1('0x2'));var router=express[_0x78a1('0x3')]();var auth=require(_0x78a1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x78a1('0x5'));var controller=require(_0x78a1('0x6'));router[_0x78a1('0x7')]('/',auth[_0x78a1('0x8')](),controller[_0x78a1('0x9')]);router[_0x78a1('0x7')](_0x78a1('0xa'),auth[_0x78a1('0x8')](),controller['describe']);router[_0x78a1('0x7')](_0x78a1('0xb'),auth[_0x78a1('0x8')](),controller[_0x78a1('0xc')]);router['post']('/',auth[_0x78a1('0x8')](),controller[_0x78a1('0xd')]);router[_0x78a1('0xe')](_0x78a1('0xb'),auth[_0x78a1('0x8')](),controller[_0x78a1('0xf')]);router[_0x78a1('0x10')](_0x78a1('0xb'),auth['isAuthenticated'](),controller[_0x78a1('0x11')]);module[_0x78a1('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index c8f4f92..d02d3cf 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['ENUM','account','queue','DATE','sequelize','STRING'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xb10b,0x12a));var _0xbb10=function(_0xce4c29,_0x4029e5){_0xce4c29=_0xce4c29-0x0;var _0x3e7922=_0xb10b[_0xce4c29];return _0x3e7922;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbb10('0x2')](_0xbb10('0x3'),'agent',_0xbb10('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xbb10('0x5')]}}; \ No newline at end of file +var _0x5f2f=['agent','queue','DATE','sequelize','exports','STRING','ENUM','account'];(function(_0x2f8f88,_0x158be2){var _0x2aaff1=function(_0x379097){while(--_0x379097){_0x2f8f88['push'](_0x2f8f88['shift']());}};_0x2aaff1(++_0x158be2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x7e269,_0x1049df){_0x7e269=_0x7e269-0x0;var _0xaf2fb9=_0x5f2f[_0x7e269];return _0xaf2fb9;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'uniqueid':{'type':Sequelize[_0xf5f2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf5f2('0x3')](_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf5f2('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index b6c5cae..845279a 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b1c=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','WhatsappTransferReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','rimraf','zip-dir','moment','bluebird','mustache','util','path','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x360afd,_0x331095){var _0x1624eb=function(_0x1f02fd){while(--_0x1f02fd){_0x360afd['push'](_0x360afd['shift']());}};_0x1624eb(++_0x331095);}(_0x8b1c,0x1e4));var _0xc8b1=function(_0x455ef2,_0x4fc88f){_0x455ef2=_0x455ef2-0x0;var _0x928a71=_0x8b1c[_0x455ef2];return _0x928a71;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc8b1('0x0'));var zipdir=require(_0xc8b1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc8b1('0x2'));var BPromise=require(_0xc8b1('0x3'));var Mustache=require(_0xc8b1('0x4'));var util=require(_0xc8b1('0x5'));var path=require(_0xc8b1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc8b1('0x7'));var squel=require(_0xc8b1('0x8'));var crypto=require(_0xc8b1('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc8b1('0xa'));var toCsv=require(_0xc8b1('0xb'));var querystring=require(_0xc8b1('0xc'));var Papa=require('papaparse');var Redis=require(_0xc8b1('0xd'));var authService=require(_0xc8b1('0xe'));var qs=require(_0xc8b1('0xf'));var as=require(_0xc8b1('0x10'));var hardwareService=require(_0xc8b1('0x11'));var logger=require(_0xc8b1('0x12'))(_0xc8b1('0x13'));var utils=require(_0xc8b1('0x14'));var config=require(_0xc8b1('0x15'));var db=require(_0xc8b1('0x16'))['db'];function respondWithStatusCode(_0xe3b0a9,_0x2238a3){_0x2238a3=_0x2238a3||0xcc;return function(_0xece31e){if(_0xece31e){return _0xe3b0a9[_0xc8b1('0x17')](_0x2238a3);}return _0xe3b0a9[_0xc8b1('0x18')](_0x2238a3)[_0xc8b1('0x19')]();};}function respondWithResult(_0x24b7c1,_0x40b16e){_0x40b16e=_0x40b16e||0xc8;return function(_0x495d65){if(_0x495d65){return _0x24b7c1['status'](_0x40b16e)['json'](_0x495d65);}};}function respondWithFilteredResult(_0x47d7de,_0x15f765){return function(_0x402ece){if(_0x402ece){var _0x76c4bb=_0x402ece[_0xc8b1('0x1a')],_0x3a4e96=_0x15f765[_0xc8b1('0x1b')],_0xf80647=_0x15f765[_0xc8b1('0x1b')]+_0x15f765[_0xc8b1('0x1c')],_0x33ddf7;if(_0xf80647>=_0x76c4bb){_0xf80647=_0x76c4bb;_0x33ddf7=0xc8;}else{_0x33ddf7=0xce;}_0x47d7de[_0xc8b1('0x18')](_0x33ddf7);return _0x47d7de[_0xc8b1('0x1d')](_0xc8b1('0x1e'),_0x3a4e96+'-'+_0xf80647+'/'+_0x76c4bb)['json'](_0x402ece);}return null;};}function patchUpdates(_0x1aaf33){return function(_0x2bfc61){try{jsonpatch[_0xc8b1('0x1f')](_0x2bfc61,_0x1aaf33,!![]);}catch(_0x4d4913){return BPromise[_0xc8b1('0x20')](_0x4d4913);}return _0x2bfc61['save']();};}function saveUpdates(_0x367948,_0x140779){return function(_0x422b1a){if(_0x422b1a){return _0x422b1a[_0xc8b1('0x21')](_0x367948)[_0xc8b1('0x22')](function(_0x65588b){return _0x65588b;});}return null;};}function removeEntity(_0x4a777d,_0x5d1e0c){return function(_0x3f014c){if(_0x3f014c){return _0x3f014c[_0xc8b1('0x23')]()['then'](function(){_0x4a777d['status'](0xcc)[_0xc8b1('0x19')]();});}};}function handleEntityNotFound(_0x10e059,_0x23c4b0){return function(_0x11ddc8){if(!_0x11ddc8){_0x10e059['sendStatus'](0x194);}return _0x11ddc8;};}function handleError(_0x127716,_0x481e50){_0x481e50=_0x481e50||0x1f4;return function(_0x5b2ecb){logger['error'](_0x5b2ecb[_0xc8b1('0x24')]);if(_0x5b2ecb[_0xc8b1('0x25')]){delete _0x5b2ecb[_0xc8b1('0x25')];}_0x127716[_0xc8b1('0x18')](_0x481e50)[_0xc8b1('0x26')](_0x5b2ecb);};}exports[_0xc8b1('0x27')]=function(_0x537870,_0x5576a3){var _0x592c3b={},_0x1ea02f={},_0x2680b0={'count':0x0,'rows':[]};var _0x229cdf=_['map'](db[_0xc8b1('0x28')][_0xc8b1('0x29')],function(_0x3e0fa9){return{'name':_0x3e0fa9[_0xc8b1('0x2a')],'type':_0x3e0fa9[_0xc8b1('0x2b')]['key']};});_0x1ea02f[_0xc8b1('0x2c')]=_[_0xc8b1('0x2d')](_0x229cdf,'name');_0x1ea02f[_0xc8b1('0x2e')]=_[_0xc8b1('0x2f')](_0x537870['query']);_0x1ea02f[_0xc8b1('0x30')]=_[_0xc8b1('0x31')](_0x1ea02f['model'],_0x1ea02f[_0xc8b1('0x2e')]);_0x592c3b['attributes']=_[_0xc8b1('0x31')](_0x1ea02f[_0xc8b1('0x2c')],qs[_0xc8b1('0x32')](_0x537870[_0xc8b1('0x2e')][_0xc8b1('0x32')]));_0x592c3b[_0xc8b1('0x33')]=_0x592c3b['attributes'][_0xc8b1('0x34')]?_0x592c3b[_0xc8b1('0x33')]:_0x1ea02f['model'];if(!_0x537870[_0xc8b1('0x2e')][_0xc8b1('0x35')](_0xc8b1('0x36'))){_0x592c3b['limit']=qs['limit'](_0x537870[_0xc8b1('0x2e')][_0xc8b1('0x1c')]);_0x592c3b['offset']=qs[_0xc8b1('0x1b')](_0x537870['query']['offset']);}_0x592c3b['order']=qs[_0xc8b1('0x37')](_0x537870[_0xc8b1('0x2e')][_0xc8b1('0x37')]);_0x592c3b[_0xc8b1('0x38')]=qs[_0xc8b1('0x30')](_['pick'](_0x537870[_0xc8b1('0x2e')],_0x1ea02f[_0xc8b1('0x30')]),_0x229cdf);if(_0x537870[_0xc8b1('0x2e')][_0xc8b1('0x39')]){_0x592c3b[_0xc8b1('0x38')]=_[_0xc8b1('0x3a')](_0x592c3b[_0xc8b1('0x38')],{'$or':_[_0xc8b1('0x2d')](_0x229cdf,function(_0xfc7aeb){if(_0xfc7aeb['type']!==_0xc8b1('0x3b')){var _0x22f5b2={};_0x22f5b2[_0xfc7aeb[_0xc8b1('0x25')]]={'$like':'%'+_0x537870[_0xc8b1('0x2e')][_0xc8b1('0x39')]+'%'};return _0x22f5b2;}})});}_0x592c3b=_[_0xc8b1('0x3a')]({},_0x592c3b,_0x537870['options']);var _0x3a96a1={'where':_0x592c3b[_0xc8b1('0x38')]};return db[_0xc8b1('0x28')][_0xc8b1('0x1a')](_0x3a96a1)['then'](function(_0x2f1516){_0x2680b0['count']=_0x2f1516;if(_0x537870[_0xc8b1('0x2e')][_0xc8b1('0x3c')]){_0x592c3b[_0xc8b1('0x3d')]=[{'all':!![]}];}return db[_0xc8b1('0x28')][_0xc8b1('0x3e')](_0x592c3b);})['then'](function(_0x2c8c78){_0x2680b0[_0xc8b1('0x3f')]=_0x2c8c78;return _0x2680b0;})[_0xc8b1('0x22')](respondWithFilteredResult(_0x5576a3,_0x592c3b))[_0xc8b1('0x40')](handleError(_0x5576a3,null));};exports[_0xc8b1('0x41')]=function(_0x49c12f,_0x2d86f5){var _0xc50f45={'raw':!![],'where':{'id':_0x49c12f[_0xc8b1('0x42')]['id']}},_0x1f4b1b={};_0x1f4b1b[_0xc8b1('0x2c')]=_[_0xc8b1('0x2f')](db[_0xc8b1('0x28')][_0xc8b1('0x29')]);_0x1f4b1b[_0xc8b1('0x2e')]=_['keys'](_0x49c12f['query']);_0x1f4b1b[_0xc8b1('0x30')]=_[_0xc8b1('0x31')](_0x1f4b1b['model'],_0x1f4b1b[_0xc8b1('0x2e')]);_0xc50f45[_0xc8b1('0x33')]=_[_0xc8b1('0x31')](_0x1f4b1b[_0xc8b1('0x2c')],qs[_0xc8b1('0x32')](_0x49c12f['query'][_0xc8b1('0x32')]));_0xc50f45[_0xc8b1('0x33')]=_0xc50f45[_0xc8b1('0x33')][_0xc8b1('0x34')]?_0xc50f45[_0xc8b1('0x33')]:_0x1f4b1b[_0xc8b1('0x2c')];if(_0x49c12f[_0xc8b1('0x2e')][_0xc8b1('0x3c')]){_0xc50f45[_0xc8b1('0x3d')]=[{'all':!![]}];}_0xc50f45=_[_0xc8b1('0x3a')]({},_0xc50f45,_0x49c12f[_0xc8b1('0x43')]);return db[_0xc8b1('0x28')][_0xc8b1('0x44')](_0xc50f45)['then'](handleEntityNotFound(_0x2d86f5,null))[_0xc8b1('0x22')](respondWithResult(_0x2d86f5,null))['catch'](handleError(_0x2d86f5,null));};exports[_0xc8b1('0x45')]=function(_0x28f9f2,_0x4d0fe7){return db[_0xc8b1('0x28')][_0xc8b1('0x45')](_0x28f9f2[_0xc8b1('0x46')],{})[_0xc8b1('0x22')](respondWithResult(_0x4d0fe7,0xc9))['catch'](handleError(_0x4d0fe7,null));};exports[_0xc8b1('0x21')]=function(_0x1488e6,_0x3bf33a){if(_0x1488e6[_0xc8b1('0x46')]['id']){delete _0x1488e6[_0xc8b1('0x46')]['id'];}return db[_0xc8b1('0x28')][_0xc8b1('0x44')]({'where':{'id':_0x1488e6[_0xc8b1('0x42')]['id']}})[_0xc8b1('0x22')](handleEntityNotFound(_0x3bf33a,null))['then'](saveUpdates(_0x1488e6[_0xc8b1('0x46')],null))[_0xc8b1('0x22')](respondWithResult(_0x3bf33a,null))[_0xc8b1('0x40')](handleError(_0x3bf33a,null));};exports[_0xc8b1('0x23')]=function(_0x4ceea7,_0x1ab975){return db[_0xc8b1('0x28')][_0xc8b1('0x44')]({'where':{'id':_0x4ceea7[_0xc8b1('0x42')]['id']}})[_0xc8b1('0x22')](handleEntityNotFound(_0x1ab975,null))['then'](removeEntity(_0x1ab975,null))[_0xc8b1('0x40')](handleError(_0x1ab975,null));};exports[_0xc8b1('0x47')]=function(_0x1aa91d,_0x25a00e){return db[_0xc8b1('0x28')][_0xc8b1('0x47')]()[_0xc8b1('0x22')](respondWithResult(_0x25a00e,null))[_0xc8b1('0x40')](handleError(_0x25a00e,null));}; \ No newline at end of file +var _0xa595=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','WhatsappTransferReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','show','params','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x363b81,_0x81e6ca){var _0x1d92fb=function(_0x129644){while(--_0x129644){_0x363b81['push'](_0x363b81['shift']());}};_0x1d92fb(++_0x81e6ca);}(_0xa595,0xe0));var _0x5a59=function(_0x166c59,_0xb34c4c){_0x166c59=_0x166c59-0x0;var _0x3aff11=_0xa595[_0x166c59];return _0x3aff11;};'use strict';var pdf=require(_0x5a59('0x0'));var emlformat=require(_0x5a59('0x1'));var rimraf=require(_0x5a59('0x2'));var zipdir=require(_0x5a59('0x3'));var jsonpatch=require(_0x5a59('0x4'));var rp=require(_0x5a59('0x5'));var moment=require(_0x5a59('0x6'));var BPromise=require(_0x5a59('0x7'));var Mustache=require(_0x5a59('0x8'));var util=require(_0x5a59('0x9'));var path=require(_0x5a59('0xa'));var sox=require(_0x5a59('0xb'));var csv=require(_0x5a59('0xc'));var ejs=require(_0x5a59('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5a59('0xe'));var crypto=require(_0x5a59('0xf'));var jsforce=require(_0x5a59('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x5a59('0xc'));var querystring=require(_0x5a59('0x11'));var Papa=require(_0x5a59('0x12'));var Redis=require(_0x5a59('0x13'));var authService=require(_0x5a59('0x14'));var qs=require(_0x5a59('0x15'));var as=require(_0x5a59('0x16'));var hardwareService=require(_0x5a59('0x17'));var logger=require(_0x5a59('0x18'))(_0x5a59('0x19'));var utils=require(_0x5a59('0x1a'));var config=require(_0x5a59('0x1b'));var db=require(_0x5a59('0x1c'))['db'];function respondWithStatusCode(_0x587140,_0x4599a7){_0x4599a7=_0x4599a7||0xcc;return function(_0x1b54eb){if(_0x1b54eb){return _0x587140[_0x5a59('0x1d')](_0x4599a7);}return _0x587140[_0x5a59('0x1e')](_0x4599a7)[_0x5a59('0x1f')]();};}function respondWithResult(_0x267281,_0x31c1a3){_0x31c1a3=_0x31c1a3||0xc8;return function(_0x388a3c){if(_0x388a3c){return _0x267281[_0x5a59('0x1e')](_0x31c1a3)[_0x5a59('0x20')](_0x388a3c);}};}function respondWithFilteredResult(_0x13b8e7,_0x90a2be){return function(_0x3ce290){if(_0x3ce290){var _0xdac385=_0x3ce290[_0x5a59('0x21')],_0x549502=_0x90a2be[_0x5a59('0x22')],_0x136542=_0x90a2be[_0x5a59('0x22')]+_0x90a2be[_0x5a59('0x23')],_0x25b596;if(_0x136542>=_0xdac385){_0x136542=_0xdac385;_0x25b596=0xc8;}else{_0x25b596=0xce;}_0x13b8e7['status'](_0x25b596);return _0x13b8e7['set'](_0x5a59('0x24'),_0x549502+'-'+_0x136542+'/'+_0xdac385)[_0x5a59('0x20')](_0x3ce290);}return null;};}function patchUpdates(_0x471ee8){return function(_0x7259f8){try{jsonpatch[_0x5a59('0x25')](_0x7259f8,_0x471ee8,!![]);}catch(_0x513bba){return BPromise[_0x5a59('0x26')](_0x513bba);}return _0x7259f8['save']();};}function saveUpdates(_0x57aa6a,_0x1d6ee8){return function(_0x1662bb){if(_0x1662bb){return _0x1662bb[_0x5a59('0x27')](_0x57aa6a)[_0x5a59('0x28')](function(_0x1754dc){return _0x1754dc;});}return null;};}function removeEntity(_0x5a073b,_0x4b40f7){return function(_0x245257){if(_0x245257){return _0x245257[_0x5a59('0x29')]()[_0x5a59('0x28')](function(){_0x5a073b[_0x5a59('0x1e')](0xcc)[_0x5a59('0x1f')]();});}};}function handleEntityNotFound(_0x1a59b7,_0x5997b2){return function(_0x12834e){if(!_0x12834e){_0x1a59b7[_0x5a59('0x1d')](0x194);}return _0x12834e;};}function handleError(_0x4c6aad,_0x4da2e4){_0x4da2e4=_0x4da2e4||0x1f4;return function(_0x427dd9){logger[_0x5a59('0x2a')](_0x427dd9[_0x5a59('0x2b')]);if(_0x427dd9[_0x5a59('0x2c')]){delete _0x427dd9[_0x5a59('0x2c')];}_0x4c6aad[_0x5a59('0x1e')](_0x4da2e4)[_0x5a59('0x2d')](_0x427dd9);};}exports['index']=function(_0x50e047,_0x4e5148){var _0x99ccd9={},_0x2f5bf0={},_0x1b3a8f={'count':0x0,'rows':[]};var _0x54e6bb=_[_0x5a59('0x2e')](db[_0x5a59('0x2f')][_0x5a59('0x30')],function(_0x4da90e){return{'name':_0x4da90e[_0x5a59('0x31')],'type':_0x4da90e[_0x5a59('0x32')]['key']};});_0x2f5bf0[_0x5a59('0x33')]=_[_0x5a59('0x2e')](_0x54e6bb,_0x5a59('0x2c'));_0x2f5bf0[_0x5a59('0x34')]=_[_0x5a59('0x35')](_0x50e047['query']);_0x2f5bf0['filters']=_[_0x5a59('0x36')](_0x2f5bf0['model'],_0x2f5bf0[_0x5a59('0x34')]);_0x99ccd9[_0x5a59('0x37')]=_[_0x5a59('0x36')](_0x2f5bf0[_0x5a59('0x33')],qs[_0x5a59('0x38')](_0x50e047[_0x5a59('0x34')][_0x5a59('0x38')]));_0x99ccd9[_0x5a59('0x37')]=_0x99ccd9[_0x5a59('0x37')][_0x5a59('0x39')]?_0x99ccd9['attributes']:_0x2f5bf0[_0x5a59('0x33')];if(!_0x50e047[_0x5a59('0x34')]['hasOwnProperty'](_0x5a59('0x3a'))){_0x99ccd9[_0x5a59('0x23')]=qs['limit'](_0x50e047[_0x5a59('0x34')]['limit']);_0x99ccd9[_0x5a59('0x22')]=qs[_0x5a59('0x22')](_0x50e047[_0x5a59('0x34')][_0x5a59('0x22')]);}_0x99ccd9[_0x5a59('0x3b')]=qs[_0x5a59('0x3c')](_0x50e047['query'][_0x5a59('0x3c')]);_0x99ccd9['where']=qs[_0x5a59('0x3d')](_[_0x5a59('0x3e')](_0x50e047[_0x5a59('0x34')],_0x2f5bf0[_0x5a59('0x3d')]),_0x54e6bb);if(_0x50e047[_0x5a59('0x34')][_0x5a59('0x3f')]){_0x99ccd9[_0x5a59('0x40')]=_[_0x5a59('0x41')](_0x99ccd9[_0x5a59('0x40')],{'$or':_[_0x5a59('0x2e')](_0x54e6bb,function(_0x162cf8){if(_0x162cf8['type']!=='VIRTUAL'){var _0x2e2301={};_0x2e2301[_0x162cf8[_0x5a59('0x2c')]]={'$like':'%'+_0x50e047[_0x5a59('0x34')][_0x5a59('0x3f')]+'%'};return _0x2e2301;}})});}_0x99ccd9=_[_0x5a59('0x41')]({},_0x99ccd9,_0x50e047[_0x5a59('0x42')]);var _0x2342f4={'where':_0x99ccd9[_0x5a59('0x40')]};return db[_0x5a59('0x2f')]['count'](_0x2342f4)['then'](function(_0x1a2205){_0x1b3a8f['count']=_0x1a2205;if(_0x50e047[_0x5a59('0x34')][_0x5a59('0x43')]){_0x99ccd9[_0x5a59('0x44')]=[{'all':!![]}];}return db[_0x5a59('0x2f')]['findAll'](_0x99ccd9);})[_0x5a59('0x28')](function(_0x598a8d){_0x1b3a8f['rows']=_0x598a8d;return _0x1b3a8f;})[_0x5a59('0x28')](respondWithFilteredResult(_0x4e5148,_0x99ccd9))['catch'](handleError(_0x4e5148,null));};exports[_0x5a59('0x45')]=function(_0x470de6,_0x97d1b9){var _0x121edf={'raw':!![],'where':{'id':_0x470de6[_0x5a59('0x46')]['id']}},_0x216578={};_0x216578[_0x5a59('0x33')]=_[_0x5a59('0x35')](db[_0x5a59('0x2f')][_0x5a59('0x30')]);_0x216578['query']=_[_0x5a59('0x35')](_0x470de6[_0x5a59('0x34')]);_0x216578[_0x5a59('0x3d')]=_['intersection'](_0x216578[_0x5a59('0x33')],_0x216578[_0x5a59('0x34')]);_0x121edf[_0x5a59('0x37')]=_[_0x5a59('0x36')](_0x216578['model'],qs[_0x5a59('0x38')](_0x470de6['query'][_0x5a59('0x38')]));_0x121edf['attributes']=_0x121edf[_0x5a59('0x37')]['length']?_0x121edf[_0x5a59('0x37')]:_0x216578[_0x5a59('0x33')];if(_0x470de6['query'][_0x5a59('0x43')]){_0x121edf[_0x5a59('0x44')]=[{'all':!![]}];}_0x121edf=_[_0x5a59('0x41')]({},_0x121edf,_0x470de6['options']);return db[_0x5a59('0x2f')][_0x5a59('0x47')](_0x121edf)['then'](handleEntityNotFound(_0x97d1b9,null))[_0x5a59('0x28')](respondWithResult(_0x97d1b9,null))[_0x5a59('0x48')](handleError(_0x97d1b9,null));};exports[_0x5a59('0x49')]=function(_0x2d6848,_0x1b6899){return db[_0x5a59('0x2f')][_0x5a59('0x49')](_0x2d6848[_0x5a59('0x4a')],{})['then'](respondWithResult(_0x1b6899,0xc9))['catch'](handleError(_0x1b6899,null));};exports[_0x5a59('0x27')]=function(_0x5bd251,_0xadf0d5){if(_0x5bd251[_0x5a59('0x4a')]['id']){delete _0x5bd251['body']['id'];}return db[_0x5a59('0x2f')][_0x5a59('0x47')]({'where':{'id':_0x5bd251[_0x5a59('0x46')]['id']}})['then'](handleEntityNotFound(_0xadf0d5,null))[_0x5a59('0x28')](saveUpdates(_0x5bd251[_0x5a59('0x4a')],null))[_0x5a59('0x28')](respondWithResult(_0xadf0d5,null))[_0x5a59('0x48')](handleError(_0xadf0d5,null));};exports['destroy']=function(_0x49b87b,_0x1b9521){return db['WhatsappTransferReport']['find']({'where':{'id':_0x49b87b[_0x5a59('0x46')]['id']}})[_0x5a59('0x28')](handleEntityNotFound(_0x1b9521,null))[_0x5a59('0x28')](removeEntity(_0x1b9521,null))[_0x5a59('0x48')](handleError(_0x1b9521,null));};exports[_0x5a59('0x4b')]=function(_0x4ce57f,_0xbe27ae){return db[_0x5a59('0x2f')]['describe']()[_0x5a59('0x28')](respondWithResult(_0xbe27ae,null))['catch'](handleError(_0xbe27ae,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 6d4b623..397c15d 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.model.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa93=['./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x23db57,_0x1a8ee1){var _0x3b4067=function(_0x532214){while(--_0x532214){_0x23db57['push'](_0x23db57['shift']());}};_0x3b4067(++_0x1a8ee1);}(_0xaa93,0x130));var _0x3aa9=function(_0x4875a7,_0x2fcb27){_0x4875a7=_0x4875a7-0x0;var _0x41f3a4=_0xaa93[_0x4875a7];return _0x41f3a4;};'use strict';var _=require(_0x3aa9('0x0'));var util=require(_0x3aa9('0x1'));var logger=require('../../config/logger')(_0x3aa9('0x2'));var moment=require(_0x3aa9('0x3'));var BPromise=require(_0x3aa9('0x4'));var rp=require(_0x3aa9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3aa9('0x6'));var config=require(_0x3aa9('0x7'));var attributes=require(_0x3aa9('0x8'));module[_0x3aa9('0x9')]=function(_0x142312,_0x462624){return _0x142312[_0x3aa9('0xa')](_0x3aa9('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x3aa9('0xc'),'fields':[_0x3aa9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x18db=['request-promise','path','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3b6888,_0x29ad85){var _0xbda3fd=function(_0x2cc245){while(--_0x2cc245){_0x3b6888['push'](_0x3b6888['shift']());}};_0xbda3fd(++_0x29ad85);}(_0x18db,0xd8));var _0xb18d=function(_0x16535d,_0xe13222){_0x16535d=_0x16535d-0x0;var _0x4a0239=_0x18db[_0x16535d];return _0x4a0239;};'use strict';var _=require(_0xb18d('0x0'));var util=require(_0xb18d('0x1'));var logger=require(_0xb18d('0x2'))('api');var moment=require(_0xb18d('0x3'));var BPromise=require(_0xb18d('0x4'));var rp=require(_0xb18d('0x5'));var fs=require('fs');var path=require(_0xb18d('0x6'));var rimraf=require('rimraf');var config=require(_0xb18d('0x7'));var attributes=require(_0xb18d('0x8'));module[_0xb18d('0x9')]=function(_0x3865f8,_0x4c921c){return _0x3865f8['define'](_0xb18d('0xa'),attributes,{'tableName':_0xb18d('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xb18d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index b770bcf..b352341 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x539c88,_0x317b05){var _0xfa38dd=function(_0x1544ee){while(--_0x1544ee){_0x539c88['push'](_0x539c88['shift']());}};_0xfa38dd(++_0x317b05);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x17961e,_0x543fcf){var _0x101136=function(_0x4d5660){while(--_0x4d5660){_0x17961e['push'](_0x17961e['shift']());}};_0x101136(++_0x543fcf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 65e0e41..d41fa3d 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c11=['./config/environment','./config/logger','app','./config/pm2/config','./config/schedule/transcribe','sequelize','then','listen','info','start','map','join','Offline\x20apps:','status','seedDB','default','./config/license','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb'];(function(_0x60d68b,_0x698b94){var _0x1cfce9=function(_0x136931){while(--_0x136931){_0x60d68b['push'](_0x60d68b['shift']());}};_0x1cfce9(++_0x698b94);}(_0x3c11,0xbb));var _0x13c1=function(_0x3e4874,_0x10125a){_0x3e4874=_0x3e4874-0x0;var _0x36c486=_0x3c11[_0x3e4874];return _0x36c486;};'use strict';var _=require(_0x13c1('0x0'));var mysqldb=require(_0x13c1('0x1'));var rpc=require('./rpc');var config=require(_0x13c1('0x2'));var logger=require(_0x13c1('0x3'))(_0x13c1('0x4'));var pm2=require('./config/pm2');var pm2Config=require(_0x13c1('0x5'));var schedule=require('./config/schedule');var chat=require('./config/schedule/chat');var transcribe=require(_0x13c1('0x6'));function main(){return mysqldb['db'][_0x13c1('0x7')]['sync']()[_0x13c1('0x8')](function(){return rpc[_0x13c1('0x9')]();})[_0x13c1('0x8')](function(_0x48275c){logger[_0x13c1('0xa')](_0x48275c);return chat['start']();})[_0x13c1('0x8')](function(){return schedule[_0x13c1('0xb')]();})['then'](function(){return transcribe[_0x13c1('0xb')]();})[_0x13c1('0x8')](function(_0x586212){logger[_0x13c1('0xa')](_0x586212);return pm2['start'](pm2Config);})['then'](function(_0x24be54){logger['info']('Online\x20apps:',_[_0x13c1('0xc')](_['filter'](_0x24be54,{'status':'online'}),'name')[_0x13c1('0xd')]());logger[_0x13c1('0xa')](_0x13c1('0xe'),_[_0x13c1('0xc')](_['filter'](_0x24be54,function(_0x47744a){return _0x47744a[_0x13c1('0xf')]!=='online';}),'name')[_0x13c1('0xd')]()||'None');config[_0x13c1('0x10')]&&require('./config/seedDB')[_0x13c1('0x11')]();require(_0x13c1('0x12'))[_0x13c1('0x11')]();})[_0x13c1('0x13')](function(_0x33b4de){logger['error'](_0x13c1('0x14'),_0x33b4de);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x38f9=['name','Offline\x20apps:','status','join','None','seedDB','default','./config/license','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sync','then','listen','info','start','Online\x20apps:','map','filter','online'];(function(_0x2598a2,_0x282a18){var _0x21a10f=function(_0x23a906){while(--_0x23a906){_0x2598a2['push'](_0x2598a2['shift']());}};_0x21a10f(++_0x282a18);}(_0x38f9,0x14a));var _0x938f=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x38f9[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var mysqldb=require(_0x938f('0x0'));var rpc=require(_0x938f('0x1'));var config=require(_0x938f('0x2'));var logger=require(_0x938f('0x3'))(_0x938f('0x4'));var pm2=require('./config/pm2');var pm2Config=require(_0x938f('0x5'));var schedule=require(_0x938f('0x6'));var chat=require(_0x938f('0x7'));var transcribe=require(_0x938f('0x8'));function main(){return mysqldb['db']['sequelize'][_0x938f('0x9')]()[_0x938f('0xa')](function(){return rpc[_0x938f('0xb')]();})[_0x938f('0xa')](function(_0x19a5d0){logger[_0x938f('0xc')](_0x19a5d0);return chat[_0x938f('0xd')]();})['then'](function(){return schedule[_0x938f('0xd')]();})[_0x938f('0xa')](function(){return transcribe[_0x938f('0xd')]();})['then'](function(_0x436496){logger[_0x938f('0xc')](_0x436496);return pm2[_0x938f('0xd')](pm2Config);})[_0x938f('0xa')](function(_0x102efd){logger['info'](_0x938f('0xe'),_[_0x938f('0xf')](_[_0x938f('0x10')](_0x102efd,{'status':_0x938f('0x11')}),_0x938f('0x12'))['join']());logger[_0x938f('0xc')](_0x938f('0x13'),_[_0x938f('0xf')](_[_0x938f('0x10')](_0x102efd,function(_0x1dd5a0){return _0x1dd5a0[_0x938f('0x14')]!==_0x938f('0x11');}),'name')[_0x938f('0x15')]()||_0x938f('0x16'));config[_0x938f('0x17')]&&require('./config/seedDB')[_0x938f('0x18')]();require(_0x938f('0x19'))[_0x938f('0x18')]();})['catch'](function(_0x229aca){logger[_0x938f('0x1a')](_0x938f('0x1b'),_0x229aca);process[_0x938f('0x1c')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 92d88a3..e45d427 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 _0xba67=['phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','closed','disposition','then','status','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','Basic','find','authenticate','json','Unknown\x20authorization\x20format','query','apikey','getUuid','User','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','User\x20not\x20found.','canUpdate','../../config/license/util','getLicense','update','Forbidden','isMiddleware','motion.token','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','sign','secret','payload','promisify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','secrets','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0xba67,0xf2));var _0x7ba6=function(_0x461246,_0xcad4f3){_0x461246=_0x461246-0x0;var _0x5c262f=_0xba67[_0x461246];return _0x5c262f;};'use strict';var db=require(_0x7ba6('0x0'))['db'];var config=require(_0x7ba6('0x1'));var hardwareConf=require(_0x7ba6('0x2'));var _=require(_0x7ba6('0x3'));var jwt=require(_0x7ba6('0x4'));var expressJwt=require(_0x7ba6('0x5'));var compose=require(_0x7ba6('0x6'));var basicAuth=require(_0x7ba6('0x7'));var crypto=require(_0x7ba6('0x8'));var BPromise=require(_0x7ba6('0x9'));var validateJwt=expressJwt({'secret':config[_0x7ba6('0xa')][_0x7ba6('0xb')]});var userAttributes=['id',_0x7ba6('0xc'),_0x7ba6('0xd'),_0x7ba6('0xe'),_0x7ba6('0xf'),_0x7ba6('0x10'),_0x7ba6('0x11'),_0x7ba6('0x12'),_0x7ba6('0x13'),_0x7ba6('0x14'),_0x7ba6('0x15'),_0x7ba6('0x16'),_0x7ba6('0x17'),_0x7ba6('0x18'),_0x7ba6('0x19'),'pauseType','showWebBar',_0x7ba6('0x1a'),_0x7ba6('0x1b'),_0x7ba6('0x1c'),_0x7ba6('0x1d'),'passwordResetAt',_0x7ba6('0x1e'),_0x7ba6('0x1f'),_0x7ba6('0x20'),_0x7ba6('0x21'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0x7ba6('0x22'),_0x7ba6('0x23'),_0x7ba6('0x24'),_0x7ba6('0x25'),_0x7ba6('0x26'),_0x7ba6('0x27'),'interface','userProfileId'];exports[_0x7ba6('0x28')]=function(){return this[_0x7ba6('0x29')](!![])[_0x7ba6('0x2a')](function(_0x44e58a,_0x1665ce,_0x215ec7){if(_0x44e58a[_0x7ba6('0x2b')]){_0x215ec7();}else{return db[_0x7ba6('0x2c')]['findOne']({'where':{'id':_0x44e58a['params']['id']},'attributes':['id',_0x7ba6('0x2d'),_0x7ba6('0x2e')],'raw':!![]})[_0x7ba6('0x2f')](function(_0x1f6352){if(_0x1f6352&&_0x1f6352[_0x7ba6('0x2d')]){return _0x1665ce[_0x7ba6('0x30')](_0x1f6352[_0x7ba6('0x2e')]===_0x7ba6('0x31')?0x195:0x193)['json']({'message':_0x1f6352[_0x7ba6('0x2e')]===_0x7ba6('0x31')?_0x7ba6('0x32'):_0x7ba6('0x33')});}else{_0x215ec7();}})[_0x7ba6('0x34')](function(_0xf221f2){_0x215ec7(_0xf221f2);});}});};exports[_0x7ba6('0x29')]=function isAuthenticated(_0xd8f2a1){return compose()['use'](function(_0x21525b,_0x2da379,_0x4f212e){if(_0x21525b[_0x7ba6('0x35')][_0x7ba6('0x36')]){if(_['startsWith'](_0x21525b[_0x7ba6('0x35')][_0x7ba6('0x36')],_0x7ba6('0x37'))){var _0x5affe4=basicAuth(_0x21525b);db['User'][_0x7ba6('0x38')]({'where':{'name':_0x5affe4['name']}})[_0x7ba6('0x2f')](function(_0xa05036){if(!_0xa05036||!_0xa05036[_0x7ba6('0x39')](_0x5affe4['pass'])){return _0x2da379['status'](0x191)[_0x7ba6('0x3a')]({'message':'Wrong\x20credentials.'});}_0x21525b[_0x7ba6('0x2b')]={'id':_0xa05036['id']};_0x4f212e();})[_0x7ba6('0x34')](function(_0x492df8){_0x4f212e(_0x492df8);});}else if(_['startsWith'](_0x21525b[_0x7ba6('0x35')]['authorization'],'Bearer')){validateJwt(_0x21525b,_0x2da379,_0x4f212e);}else{if(_0xd8f2a1){_0x4f212e();}else{return _0x2da379[_0x7ba6('0x30')](0x193)[_0x7ba6('0x3a')]({'message':_0x7ba6('0x3b')});}}}else if(_0x21525b[_0x7ba6('0x3c')][_0x7ba6('0x3d')]){try{var _0x520bb1={'audience':hardwareConf[_0x7ba6('0x3e')](),'issuer':hardwareConf[_0x7ba6('0x3e')]()};verifyJwt(_0x21525b[_0x7ba6('0x3c')][_0x7ba6('0x3d')],_0x520bb1)[_0x7ba6('0x2f')](function(_0x2414dc){return db[_0x7ba6('0x3f')][_0x7ba6('0x38')]({'where':{'id':_0x2414dc['sub']}})['then'](function(_0x46cfb0){if(!_0x46cfb0||!_['isEqual'](_0x46cfb0[_0x7ba6('0x40')],_0x2414dc[_0x7ba6('0x41')])){return _0x2da379[_0x7ba6('0x30')](0x191)[_0x7ba6('0x3a')]({'message':_0x7ba6('0x42')});}_0x21525b['user']={'id':_0x46cfb0['id']};_0x4f212e();});})[_0x7ba6('0x34')](function(){return _0x2da379[_0x7ba6('0x30')](0x191)[_0x7ba6('0x3a')]({'message':_0x7ba6('0x43')});});}catch(_0x438da6){_0x4f212e(_0x438da6);}}else if(_0xd8f2a1){_0x4f212e();}else{return _0x2da379[_0x7ba6('0x30')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0x7ba6('0x2a')](function(_0xe48ca5,_0x41f9c9,_0x49b1){if(_0xe48ca5[_0x7ba6('0x2b')]){db[_0x7ba6('0x3f')][_0x7ba6('0x38')]({'where':{'id':_0xe48ca5['user']['id']},'attributes':userAttributes})[_0x7ba6('0x2f')](function(_0x5c8483){if(!_0x5c8483){return _0x41f9c9[_0x7ba6('0x30')](0x194)['json']({'message':_0x7ba6('0x44')});}_0xe48ca5[_0x7ba6('0x2b')]=_0x5c8483;_0x49b1();})[_0x7ba6('0x34')](function(_0x40a76d){_0x49b1(_0x40a76d);});}else if(_0xd8f2a1){_0x49b1();}else{return _0x41f9c9[_0x7ba6('0x30')](0x194)[_0x7ba6('0x3a')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x7ba6('0x45')]=function canUpdate(){return compose()[_0x7ba6('0x2a')](function(_0x1b9ddc,_0x241d58,_0x135ed0){return require(_0x7ba6('0x46'))[_0x7ba6('0x47')]()['then'](function(_0xe8d574){if(_0xe8d574[_0x7ba6('0x48')]){_0x135ed0();}else{return _0x241d58[_0x7ba6('0x30')](0x193)[_0x7ba6('0x3a')]({'message':_0x7ba6('0x49')});}})[_0x7ba6('0x34')](function(_0x5959c){_0x135ed0(_0x5959c);});});};exports[_0x7ba6('0x4a')]=function(_0x2aa578,_0x381028,_0x7688ad){_0x2aa578[_0x7ba6('0x4a')]=!![];return _0x7688ad();};exports['signToken']=function signToken(_0x6fb2a4){return signJwt(_0x6fb2a4);};exports['setTokenCookie']=function(_0x3eb424,_0x220184){if(!_0x3eb424[_0x7ba6('0x2b')]){return _0x220184[_0x7ba6('0x30')](0x194)[_0x7ba6('0x3a')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x49fe89={'payload':{'id':_0x3eb424[_0x7ba6('0x2b')]['id'],'role':_0x3eb424[_0x7ba6('0x2b')][_0x7ba6('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x49fe89)['then'](function(_0x277cd5){_0x220184['cookie'](_0x7ba6('0x4b'),_0x277cd5);_0x220184['redirect'](_0x7ba6('0x4c'));})[_0x7ba6('0x34')](function(_0xffc016){return _0x220184[_0x7ba6('0x30')](0x1f4)['send'](_0xffc016);});};exports[_0x7ba6('0x4d')]=function(_0x17d78e){if(_[_0x7ba6('0x4e')](_0x17d78e[_0x7ba6('0x40')])||_[_0x7ba6('0x4e')](_0x17d78e[_0x7ba6('0x4f')])){return null;}else{return createJwt(_0x17d78e);}};exports[_0x7ba6('0x50')]=function(_0x1dbc29){_0x1dbc29[_0x7ba6('0x40')]=generateNonce();_0x1dbc29[_0x7ba6('0x4f')]=generateIssuedAt();return createJwt(_0x1dbc29);};exports[_0x7ba6('0x51')]=function(_0x1a8c3c,_0x554ba4){var _0x56cfb9=_0x1a8c3c[_0x7ba6('0x3c')]['apikey'];if(_0x56cfb9){var _0xcf34a3={'nonce':_0x554ba4[_0x7ba6('0x40')],'iat':_0x554ba4[_0x7ba6('0x4f')],'audience':hardwareConf[_0x7ba6('0x3e')](),'issuer':hardwareConf[_0x7ba6('0x3e')]()};return verifyJwt(_0x56cfb9,_0xcf34a3)[_0x7ba6('0x2f')](function(){return generateApiKey(_0x554ba4);});}else{throw{'message':_0x7ba6('0x52')};}};function signJwt(_0x1f7797){var _0x4ad5e9=BPromise['promisify'](jwt[_0x7ba6('0x53')],{'context':jwt});var _0x4b4042=_0x1f7797[_0x7ba6('0x54')]||config[_0x7ba6('0xa')]['session'];return new BPromise(function(_0x24bb08,_0x1021ad){_0x4ad5e9(_0x1f7797[_0x7ba6('0x55')],_0x4b4042,_0x1f7797['options'])[_0x7ba6('0x2f')](function(_0x5cbf12){_0x24bb08(_0x5cbf12);})[_0x7ba6('0x34')](function(_0x200922){_0x1021ad(_0x200922);});});}function verifyJwt(_0x3462e8,_0x1f7144,_0x30df19){var _0x50bab8=BPromise[_0x7ba6('0x56')](jwt['verify'],{'context':jwt});var _0x3f0973=_0x30df19||config[_0x7ba6('0xa')][_0x7ba6('0xb')];return new BPromise(function(_0x24fad0,_0x481b86){_0x50bab8(_0x3462e8,_0x3f0973,_0x1f7144)[_0x7ba6('0x2f')](function(_0x393a08){_0x24fad0(_0x393a08);})[_0x7ba6('0x34')](function(_0x6091fe){_0x481b86(_0x6091fe);});});}function generateNonce(){return crypto[_0x7ba6('0x57')](0x10)[_0x7ba6('0x58')](_0x7ba6('0x59'));}function generateIssuedAt(){return Math[_0x7ba6('0x5a')](Date[_0x7ba6('0x5b')]()/0x3e8)[_0x7ba6('0x58')]();}function createJwt(_0x18074c){var _0x2bccab={'payload':{'iat':_0x18074c['apiKeyIat'],'nonce':_0x18074c[_0x7ba6('0x40')]},'options':{'algorithm':'HS512','subject':_0x18074c['id'][_0x7ba6('0x58')](),'issuer':hardwareConf[_0x7ba6('0x3e')](),'audience':hardwareConf[_0x7ba6('0x3e')]()}};return signJwt(_0x2bccab)[_0x7ba6('0x2f')](function(_0x45fe7f){return{'iat':_0x18074c[_0x7ba6('0x4f')],'nonce':_0x18074c['apiKeyNonce'],'token':_0x45fe7f};});} \ No newline at end of file +var _0x6609=['params','disposition','then','closed','status','json','Unmanaged.','catch','headers','authorization','startsWith','find','authenticate','Wrong\x20credentials.','user','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','sub','isEqual','apiKeyNonce','Invalid\x20API\x20access\x20key','User','User\x20not\x20found.','canUpdate','../../config/license/util','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','sign','secret','payload','verify','randomBytes','toString','hex','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','secrets','session','role','fullname','name','permissions','voicePause','chatPause','mailPause','faxPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne'];(function(_0x5c0389,_0xc9f662){var _0xdc2e9e=function(_0x54766b){while(--_0x54766b){_0x5c0389['push'](_0x5c0389['shift']());}};_0xdc2e9e(++_0xc9f662);}(_0x6609,0xf3));var _0x9660=function(_0x540c8e,_0x441ea6){_0x540c8e=_0x540c8e-0x0;var _0x573f84=_0x6609[_0x540c8e];return _0x573f84;};'use strict';var db=require(_0x9660('0x0'))['db'];var config=require(_0x9660('0x1'));var hardwareConf=require(_0x9660('0x2'));var _=require(_0x9660('0x3'));var jwt=require(_0x9660('0x4'));var expressJwt=require(_0x9660('0x5'));var compose=require(_0x9660('0x6'));var basicAuth=require(_0x9660('0x7'));var crypto=require(_0x9660('0x8'));var BPromise=require(_0x9660('0x9'));var validateJwt=expressJwt({'secret':config[_0x9660('0xa')][_0x9660('0xb')]});var userAttributes=['id',_0x9660('0xc'),_0x9660('0xd'),_0x9660('0xe'),'internal','email','userpic',_0x9660('0xf'),'md5secret',_0x9660('0x10'),_0x9660('0x11'),_0x9660('0x12'),_0x9660('0x13'),'smsPause','openchannelPause',_0x9660('0x14'),'showWebBar',_0x9660('0x15'),_0x9660('0x16'),_0x9660('0x17'),'allowmessenger','passwordResetAt',_0x9660('0x18'),_0x9660('0x19'),_0x9660('0x1a'),_0x9660('0x1b'),'phoneBarEnableRecording',_0x9660('0x1c'),_0x9660('0x1d'),_0x9660('0x1e'),_0x9660('0x1f'),_0x9660('0x20'),_0x9660('0x21'),_0x9660('0x22'),_0x9660('0x23'),_0x9660('0x24')];exports[_0x9660('0x25')]=function(){return this[_0x9660('0x26')](!![])[_0x9660('0x27')](function(_0x31612d,_0xc3cb29,_0x190fbd){if(_0x31612d['user']){_0x190fbd();}else{return db[_0x9660('0x28')][_0x9660('0x29')]({'where':{'id':_0x31612d[_0x9660('0x2a')]['id']},'attributes':['id','closed',_0x9660('0x2b')],'raw':!![]})[_0x9660('0x2c')](function(_0x3f7b02){if(_0x3f7b02&&_0x3f7b02[_0x9660('0x2d')]){return _0xc3cb29[_0x9660('0x2e')](_0x3f7b02[_0x9660('0x2b')]==='unmanaged'?0x195:0x193)[_0x9660('0x2f')]({'message':_0x3f7b02['disposition']==='unmanaged'?_0x9660('0x30'):'Forbidden.'});}else{_0x190fbd();}})[_0x9660('0x31')](function(_0xc60b2a){_0x190fbd(_0xc60b2a);});}});};exports[_0x9660('0x26')]=function isAuthenticated(_0x26685c){return compose()[_0x9660('0x27')](function(_0x35f66d,_0xbbb938,_0x4b72ee){if(_0x35f66d[_0x9660('0x32')][_0x9660('0x33')]){if(_[_0x9660('0x34')](_0x35f66d[_0x9660('0x32')][_0x9660('0x33')],'Basic')){var _0x80ce74=basicAuth(_0x35f66d);db['User'][_0x9660('0x35')]({'where':{'name':_0x80ce74[_0x9660('0xe')]}})['then'](function(_0x439c59){if(!_0x439c59||!_0x439c59[_0x9660('0x36')](_0x80ce74['pass'])){return _0xbbb938[_0x9660('0x2e')](0x191)[_0x9660('0x2f')]({'message':_0x9660('0x37')});}_0x35f66d[_0x9660('0x38')]={'id':_0x439c59['id']};_0x4b72ee();})[_0x9660('0x31')](function(_0x23beaf){_0x4b72ee(_0x23beaf);});}else if(_[_0x9660('0x34')](_0x35f66d[_0x9660('0x32')][_0x9660('0x33')],_0x9660('0x39'))){validateJwt(_0x35f66d,_0xbbb938,_0x4b72ee);}else{if(_0x26685c){_0x4b72ee();}else{return _0xbbb938['status'](0x193)[_0x9660('0x2f')]({'message':_0x9660('0x3a')});}}}else if(_0x35f66d['query'][_0x9660('0x3b')]){try{var _0x3290a7={'audience':hardwareConf[_0x9660('0x3c')](),'issuer':hardwareConf[_0x9660('0x3c')]()};verifyJwt(_0x35f66d[_0x9660('0x3d')][_0x9660('0x3b')],_0x3290a7)[_0x9660('0x2c')](function(_0x13e3ed){return db['User'][_0x9660('0x35')]({'where':{'id':_0x13e3ed[_0x9660('0x3e')]}})['then'](function(_0xc08e97){if(!_0xc08e97||!_[_0x9660('0x3f')](_0xc08e97[_0x9660('0x40')],_0x13e3ed['nonce'])){return _0xbbb938[_0x9660('0x2e')](0x191)[_0x9660('0x2f')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0x35f66d[_0x9660('0x38')]={'id':_0xc08e97['id']};_0x4b72ee();});})[_0x9660('0x31')](function(){return _0xbbb938[_0x9660('0x2e')](0x191)[_0x9660('0x2f')]({'message':_0x9660('0x41')});});}catch(_0x324ea2){_0x4b72ee(_0x324ea2);}}else if(_0x26685c){_0x4b72ee();}else{return _0xbbb938[_0x9660('0x2e')](0x193)['json']({'message':_0x9660('0x3a')});}})[_0x9660('0x27')](function(_0x1ee2a0,_0x23627e,_0x454bdb){if(_0x1ee2a0['user']){db[_0x9660('0x42')][_0x9660('0x35')]({'where':{'id':_0x1ee2a0[_0x9660('0x38')]['id']},'attributes':userAttributes})['then'](function(_0x25d644){if(!_0x25d644){return _0x23627e['status'](0x194)['json']({'message':_0x9660('0x43')});}_0x1ee2a0[_0x9660('0x38')]=_0x25d644;_0x454bdb();})[_0x9660('0x31')](function(_0x550103){_0x454bdb(_0x550103);});}else if(_0x26685c){_0x454bdb();}else{return _0x23627e[_0x9660('0x2e')](0x194)[_0x9660('0x2f')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x9660('0x44')]=function canUpdate(){return compose()[_0x9660('0x27')](function(_0x241fb2,_0x196018,_0xad5707){return require(_0x9660('0x45'))[_0x9660('0x46')]()[_0x9660('0x2c')](function(_0x266ee7){if(_0x266ee7[_0x9660('0x47')]){_0xad5707();}else{return _0x196018[_0x9660('0x2e')](0x193)[_0x9660('0x2f')]({'message':_0x9660('0x48')});}})[_0x9660('0x31')](function(_0x307ce4){_0xad5707(_0x307ce4);});});};exports[_0x9660('0x49')]=function(_0x5d2737,_0x131964,_0x2a4e96){_0x5d2737[_0x9660('0x49')]=!![];return _0x2a4e96();};exports[_0x9660('0x4a')]=function signToken(_0x31e405){return signJwt(_0x31e405);};exports[_0x9660('0x4b')]=function(_0x210cf9,_0x4b6ebd){if(!_0x210cf9[_0x9660('0x38')]){return _0x4b6ebd['status'](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x401758={'payload':{'id':_0x210cf9[_0x9660('0x38')]['id'],'role':_0x210cf9[_0x9660('0x38')][_0x9660('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x401758)[_0x9660('0x2c')](function(_0x27e7b8){_0x4b6ebd[_0x9660('0x4c')](_0x9660('0x4d'),_0x27e7b8);_0x4b6ebd[_0x9660('0x4e')](_0x9660('0x4f'));})['catch'](function(_0x567c15){return _0x4b6ebd[_0x9660('0x2e')](0x1f4)[_0x9660('0x50')](_0x567c15);});};exports[_0x9660('0x51')]=function(_0xb1e45e){if(_[_0x9660('0x52')](_0xb1e45e[_0x9660('0x40')])||_['isNil'](_0xb1e45e[_0x9660('0x53')])){return null;}else{return createJwt(_0xb1e45e);}};exports['generateApiKey']=function(_0x58e8cb){_0x58e8cb[_0x9660('0x40')]=generateNonce();_0x58e8cb[_0x9660('0x53')]=generateIssuedAt();return createJwt(_0x58e8cb);};exports[_0x9660('0x54')]=function(_0x14604b,_0x286c4d){var _0x30a686=_0x14604b[_0x9660('0x3d')][_0x9660('0x3b')];if(_0x30a686){var _0x4b044e={'nonce':_0x286c4d['apiKeyNonce'],'iat':_0x286c4d[_0x9660('0x53')],'audience':hardwareConf[_0x9660('0x3c')](),'issuer':hardwareConf[_0x9660('0x3c')]()};return verifyJwt(_0x30a686,_0x4b044e)['then'](function(){return generateApiKey(_0x286c4d);});}else{throw{'message':_0x9660('0x55')};}};function signJwt(_0x2aa7fc){var _0x1d1212=BPromise['promisify'](jwt[_0x9660('0x56')],{'context':jwt});var _0x16a745=_0x2aa7fc[_0x9660('0x57')]||config['secrets'][_0x9660('0xb')];return new BPromise(function(_0xd8c9b0,_0x129583){_0x1d1212(_0x2aa7fc[_0x9660('0x58')],_0x16a745,_0x2aa7fc['options'])[_0x9660('0x2c')](function(_0xa222c7){_0xd8c9b0(_0xa222c7);})[_0x9660('0x31')](function(_0x248d4a){_0x129583(_0x248d4a);});});}function verifyJwt(_0x25d1ac,_0x48852c,_0xa3e658){var _0x459809=BPromise['promisify'](jwt[_0x9660('0x59')],{'context':jwt});var _0x24fc2c=_0xa3e658||config[_0x9660('0xa')][_0x9660('0xb')];return new BPromise(function(_0x1d2b4a,_0x5bf5b4){_0x459809(_0x25d1ac,_0x24fc2c,_0x48852c)[_0x9660('0x2c')](function(_0x380887){_0x1d2b4a(_0x380887);})[_0x9660('0x31')](function(_0x7c32f5){_0x5bf5b4(_0x7c32f5);});});}function generateNonce(){return crypto[_0x9660('0x5a')](0x10)[_0x9660('0x5b')](_0x9660('0x5c'));}function generateIssuedAt(){return Math['floor'](Date[_0x9660('0x5d')]()/0x3e8)[_0x9660('0x5b')]();}function createJwt(_0x2f17b3){var _0x358451={'payload':{'iat':_0x2f17b3[_0x9660('0x53')],'nonce':_0x2f17b3['apiKeyNonce']},'options':{'algorithm':_0x9660('0x5e'),'subject':_0x2f17b3['id']['toString'](),'issuer':hardwareConf[_0x9660('0x3c')](),'audience':hardwareConf[_0x9660('0x3c')]()}};return signJwt(_0x358451)[_0x9660('0x2c')](function(_0xd7ce48){return{'iat':_0x2f17b3['apiKeyIat'],'nonce':_0x2f17b3['apiKeyNonce'],'token':_0xd7ce48};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index b878563..e446b18 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 _0xbaf0=['data','update','binary','write','end','decryptFile','createDecipher','final','close','unlink','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm'];(function(_0x4bc4c8,_0x3139d3){var _0x3bb121=function(_0x95ad12){while(--_0x95ad12){_0x4bc4c8['push'](_0x4bc4c8['shift']());}};_0x3bb121(++_0x3139d3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x0baf('0x0'));var defaultOptions={'algorithm':_0x0baf('0x1')};function combineOptions(_0x1e212d){var _0x263f79={};for(var _0x1688bc in defaultOptions){if(defaultOptions[_0x0baf('0x2')](_0x1688bc)){_0x263f79[_0x1688bc]=defaultOptions[_0x1688bc];}}if(_0x1e212d){for(var _0x5a3e42 in _0x1e212d){if(_0x1e212d[_0x0baf('0x2')](_0x5a3e42)){_0x263f79[_0x5a3e42]=_0x1e212d[_0x5a3e42];}}}return _0x263f79;}exports[_0x0baf('0x3')]=function(_0x2d3fa5,_0x39b8f3,_0xe4c3c4,_0x335e24){return new BPromise(function(_0x1a10b1,_0x2dcaac){_0x335e24=combineOptions(_0x335e24);var _0x1d0a0d=new Buffer(_0xe4c3c4);var _0x5f5030=fs[_0x0baf('0x4')](_0x2d3fa5);var _0x5f20aa=fs[_0x0baf('0x5')](_0x39b8f3);var _0x2c7442=crypto[_0x0baf('0x6')](_0x335e24[_0x0baf('0x7')],_0x1d0a0d);_0x5f5030['on'](_0x0baf('0x8'),function(_0xf4c8ac){var _0x41cead=new Buffer(_0x2c7442[_0x0baf('0x9')](_0xf4c8ac),_0x0baf('0xa'));_0x5f20aa[_0x0baf('0xb')](_0x41cead);});_0x5f5030['on'](_0x0baf('0xc'),function(){try{var _0x51d93c=new Buffer(_0x2c7442['final'](_0x0baf('0xa')),_0x0baf('0xa'));_0x5f20aa[_0x0baf('0xb')](_0x51d93c);_0x5f20aa[_0x0baf('0xc')]();_0x5f20aa['on']('close',function(){return _0x1a10b1(_0x39b8f3);});}catch(_0x2ab33e){fs['unlink'](_0x39b8f3);return _0x2dcaac(_0x2ab33e);}});});};exports[_0x0baf('0xd')]=function(_0x1f50c3,_0x7fbf67,_0x2bc381,_0xb8339e){return new BPromise(function(_0x469599,_0x4f80a8){_0xb8339e=combineOptions(_0xb8339e);var _0x4cd79d=new Buffer(_0x2bc381);var _0x2312c7=fs[_0x0baf('0x4')](_0x1f50c3);var _0x283408=fs[_0x0baf('0x5')](_0x7fbf67);var _0x2cf7da=crypto[_0x0baf('0xe')](_0xb8339e['algorithm'],_0x4cd79d);_0x2312c7['on'](_0x0baf('0x8'),function(_0xfbecec){var _0x1ef0e5=new Buffer(_0x2cf7da[_0x0baf('0x9')](_0xfbecec),_0x0baf('0xa'));_0x283408[_0x0baf('0xb')](_0x1ef0e5);});_0x2312c7['on']('end',function(){try{var _0x5cff5d=new Buffer(_0x2cf7da[_0x0baf('0xf')](_0x0baf('0xa')),_0x0baf('0xa'));_0x283408[_0x0baf('0xb')](_0x5cff5d);_0x283408[_0x0baf('0xc')]();_0x283408['on'](_0x0baf('0x10'),function(){return _0x469599(_0x7fbf67);});}catch(_0x210cd8){fs[_0x0baf('0x11')](_0x7fbf67);return _0x4f80a8(_0x210cd8);}});});}; \ No newline at end of file +var _0xa9e0=['update','close','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createCipher','algorithm','data','final','binary','write','end','unlink','decryptFile'];(function(_0x7de353,_0x58d7e6){var _0x3500a1=function(_0x3ca5a7){while(--_0x3ca5a7){_0x7de353['push'](_0x7de353['shift']());}};_0x3500a1(++_0x58d7e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var crypto=require(_0x0a9e('0x0'));var fs=require('fs');var BPromise=require(_0x0a9e('0x1'));var defaultOptions={'algorithm':_0x0a9e('0x2')};function combineOptions(_0x5dd881){var _0x550fbc={};for(var _0x18d5c9 in defaultOptions){if(defaultOptions['hasOwnProperty'](_0x18d5c9)){_0x550fbc[_0x18d5c9]=defaultOptions[_0x18d5c9];}}if(_0x5dd881){for(var _0x333808 in _0x5dd881){if(_0x5dd881[_0x0a9e('0x3')](_0x333808)){_0x550fbc[_0x333808]=_0x5dd881[_0x333808];}}}return _0x550fbc;}exports[_0x0a9e('0x4')]=function(_0x991246,_0x981158,_0x57b080,_0x219af0){return new BPromise(function(_0x441e3a,_0x2cc193){_0x219af0=combineOptions(_0x219af0);var _0x5f41ea=new Buffer(_0x57b080);var _0x503809=fs[_0x0a9e('0x5')](_0x991246);var _0x56465b=fs['createWriteStream'](_0x981158);var _0x39753a=crypto[_0x0a9e('0x6')](_0x219af0[_0x0a9e('0x7')],_0x5f41ea);_0x503809['on'](_0x0a9e('0x8'),function(_0xfeb75b){var _0xbd1168=new Buffer(_0x39753a['update'](_0xfeb75b),'binary');_0x56465b['write'](_0xbd1168);});_0x503809['on']('end',function(){try{var _0x273d4d=new Buffer(_0x39753a[_0x0a9e('0x9')](_0x0a9e('0xa')),_0x0a9e('0xa'));_0x56465b[_0x0a9e('0xb')](_0x273d4d);_0x56465b[_0x0a9e('0xc')]();_0x56465b['on']('close',function(){return _0x441e3a(_0x981158);});}catch(_0x4283ce){fs[_0x0a9e('0xd')](_0x981158);return _0x2cc193(_0x4283ce);}});});};exports[_0x0a9e('0xe')]=function(_0x281129,_0x44dcfd,_0x4d5611,_0x52a03d){return new BPromise(function(_0x22dccb,_0x5d0880){_0x52a03d=combineOptions(_0x52a03d);var _0x1985b6=new Buffer(_0x4d5611);var _0x519dfd=fs[_0x0a9e('0x5')](_0x281129);var _0x12066b=fs['createWriteStream'](_0x44dcfd);var _0x225616=crypto['createDecipher'](_0x52a03d[_0x0a9e('0x7')],_0x1985b6);_0x519dfd['on'](_0x0a9e('0x8'),function(_0x106033){var _0x205fd6=new Buffer(_0x225616[_0x0a9e('0xf')](_0x106033),_0x0a9e('0xa'));_0x12066b[_0x0a9e('0xb')](_0x205fd6);});_0x519dfd['on'](_0x0a9e('0xc'),function(){try{var _0x1314ae=new Buffer(_0x225616[_0x0a9e('0x9')](_0x0a9e('0xa')),_0x0a9e('0xa'));_0x12066b['write'](_0x1314ae);_0x12066b[_0x0a9e('0xc')]();_0x12066b['on'](_0x0a9e('0x10'),function(){return _0x22dccb(_0x44dcfd);});}catch(_0x53682f){fs[_0x0a9e('0xd')](_0x44dcfd);return _0x5d0880(_0x53682f);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 34e3c17..0143de5 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 _0xa75b=['to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','push','dirname','basename','existsSync','join','each','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','util'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0xa75b,0x170));var _0xba75=function(_0x4fafd8,_0x53c660){_0x4fafd8=_0x4fafd8-0x0;var _0x5957a5=_0xa75b[_0x4fafd8];return _0x5957a5;};'use strict';var util=require(_0xba75('0x0'));var path=require('path');var _=require('lodash');var csv=require(_0xba75('0x1'));var fs=require('fs');var BPromise=require(_0xba75('0x2'));var zipdir=require(_0xba75('0x3'));var rimraf=require(_0xba75('0x4'));var db=require(_0xba75('0x5'))['db'];var dbH=require(_0xba75('0x5'))[_0xba75('0x6')];var logger=require(_0xba75('0x7'))(_0xba75('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xba75('0x9')][0x2]);var QUERY=process[_0xba75('0x9')][0x3];var PATH=process[_0xba75('0x9')][0x4];function analyticExtractedReport(_0x3ccab5,_0x5c79e3){var _0x4b842d={'status':_0x3ccab5};var _0x731cae={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5c79e3){_0x4b842d['savename']=_0x5c79e3;}return db['AnalyticExtractedReport'][_0xba75('0xa')](_0x4b842d,_0x731cae);}function main(){var _0x4f4d0a=0x1388;var _0x2e8905;logger[_0xba75('0xb')](util[_0xba75('0xc')](_0xba75('0xd'),EXTRACTED_REPORT_ID,_0xba75('0xe')));return db[_0xba75('0xf')][_0xba75('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xba75('0x11'),_0xba75('0x12')]})[_0xba75('0x13')](function(_0x8116d8){if(_0x8116d8){_0x2e8905=_0x8116d8;_0x4f4d0a=_0x2e8905[_0xba75('0x12')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0xba75('0x14')](util['format'](_0xba75('0x15'),QUERY),{'type':dbH[_0xba75('0x16')][_0xba75('0x17')][_0xba75('0x18')]});})['then'](function(_0x31b3b3){if(!_0x31b3b3[0x0][_0xba75('0x19')]){return analyticExtractedReport(_0xba75('0x1a'));}var _0x4028f9=[];var _0x41c9e5=0x0;var _0x51112b=!![];if(_0x31b3b3&&_0x31b3b3[_0xba75('0x1b')]){var _0x2bf023=_0x31b3b3[0x0][_0xba75('0x19')]%(_0x41c9e5+_0x4f4d0a);if(_0x2e8905['split']){for(;_0x51112b;_0x41c9e5+=_0x4f4d0a,_0x2bf023=_0x31b3b3[0x0][_0xba75('0x19')]%(_0x41c9e5+_0x4f4d0a)){if(_0x2bf023==0x0||_0x2bf023==_0x31b3b3[0x0][_0xba75('0x19')]){_0x51112b=![];}_0x4028f9[_0xba75('0x1c')](dbH[_0xba75('0x16')][_0xba75('0x14')](util[_0xba75('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4f4d0a,_0x41c9e5),{'type':dbH[_0xba75('0x16')][_0xba75('0x17')]['SELECT']}));}}else{_0x4028f9['push'](dbH[_0xba75('0x16')][_0xba75('0x14')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xba75('0x18')]}));}}var _0x4e79a9=path[_0xba75('0x1d')](PATH);var _0x2ece41=path[_0xba75('0x1e')](PATH,'.csv');var _0x458475=_0x2e8905[_0xba75('0x11')]&&_0x4028f9[_0xba75('0x1b')]>0x1;var _0x3e9bd9=[];if(!fs[_0xba75('0x1f')](path[_0xba75('0x20')](_0x4e79a9,_0x2ece41))&&_0x458475){fs['mkdirSync'](path[_0xba75('0x20')](_0x4e79a9,_0x2ece41));}return BPromise[_0xba75('0x21')](_0x4028f9,function(_0xe579fb){_0x3e9bd9[_0xba75('0x1c')](_0xe579fb);})[_0xba75('0x13')](function(){for(var _0x44b1d4=0x0;_0x44b1d4<_0x3e9bd9[_0xba75('0x1b')];_0x44b1d4+=0x1){var _0x37f7c8;var _0x35c571=_0x3e9bd9[_0x44b1d4];if(_0x458475){_0x37f7c8=path[_0xba75('0x20')](_0x4e79a9,_0x2ece41,util['format']('%s%d.%s',_0x2ece41,_0x44b1d4,'csv'));}else{_0x37f7c8=path[_0xba75('0x20')](_0x4e79a9,util['format'](_0xba75('0x22'),_0x2ece41,'csv'));}fs[_0xba75('0x23')](_0x37f7c8,csv(_0x35c571));}})[_0xba75('0x13')](function(){if(_0x458475){zipdir(path[_0xba75('0x20')](_0x4e79a9,_0x2ece41),{'saveTo':path['join'](_0x4e79a9,util[_0xba75('0xc')](_0xba75('0x22'),_0x2ece41,_0xba75('0x24')))},function(_0x2808f0,_0x5d9f78){});rimraf(path['join'](_0x4e79a9,_0x2ece41),function(){});}})[_0xba75('0x13')](function(){logger['info'](util[_0xba75('0xc')](_0xba75('0x25'),EXTRACTED_REPORT_ID,_0xba75('0xe')));return analyticExtractedReport(_0xba75('0x26'),_0x458475?util['format'](_0xba75('0x22'),_0x2ece41,_0x458475?_0xba75('0x24'):'csv'):null);});})[_0xba75('0x27')](function(_0x37d6bb){logger[_0xba75('0xb')](util[_0xba75('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xba75('0xe')),util[_0xba75('0x28')](_0x37d6bb,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0xedd9=['path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','CSV','Setting','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','push','dirname','basename','existsSync','mkdirSync','join','each','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','csv','inspect','Failed'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0xedd9,0xfc));var _0x9edd=function(_0x12401e,_0x919ac3){_0x12401e=_0x12401e-0x0;var _0x29aae4=_0xedd9[_0x12401e];return _0x29aae4;};'use strict';var util=require('util');var path=require(_0x9edd('0x0'));var _=require(_0x9edd('0x1'));var csv=require(_0x9edd('0x2'));var fs=require('fs');var BPromise=require(_0x9edd('0x3'));var zipdir=require(_0x9edd('0x4'));var rimraf=require(_0x9edd('0x5'));var db=require(_0x9edd('0x6'))['db'];var dbH=require(_0x9edd('0x6'))['dbH'];var logger=require(_0x9edd('0x7'))(_0x9edd('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x9edd('0x9')][0x2]);var QUERY=process[_0x9edd('0x9')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0xf0b2d8,_0x571af9){var _0x172522={'status':_0xf0b2d8};var _0x190185={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x571af9){_0x172522[_0x9edd('0xa')]=_0x571af9;}return db[_0x9edd('0xb')]['update'](_0x172522,_0x190185);}function main(){var _0x494a24=0x1388;var _0x5d2f90;logger[_0x9edd('0xc')](util[_0x9edd('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9edd('0xe')));return db[_0x9edd('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9edd('0x10'),_0x9edd('0x11')]})[_0x9edd('0x12')](function(_0xfd544a){if(_0xfd544a){_0x5d2f90=_0xfd544a;_0x494a24=_0x5d2f90[_0x9edd('0x11')]||0x1388;}})[_0x9edd('0x12')](function(){return dbH[_0x9edd('0x13')][_0x9edd('0x14')](util['format'](_0x9edd('0x15'),QUERY),{'type':dbH[_0x9edd('0x13')][_0x9edd('0x16')][_0x9edd('0x17')]});})[_0x9edd('0x12')](function(_0x338f3c){if(!_0x338f3c[0x0][_0x9edd('0x18')]){return analyticExtractedReport(_0x9edd('0x19'));}var _0x4ea60f=[];var _0x5f5bf4=0x0;var _0x448996=!![];if(_0x338f3c&&_0x338f3c[_0x9edd('0x1a')]){var _0x5acf65=_0x338f3c[0x0][_0x9edd('0x18')]%(_0x5f5bf4+_0x494a24);if(_0x5d2f90[_0x9edd('0x10')]){for(;_0x448996;_0x5f5bf4+=_0x494a24,_0x5acf65=_0x338f3c[0x0][_0x9edd('0x18')]%(_0x5f5bf4+_0x494a24)){if(_0x5acf65==0x0||_0x5acf65==_0x338f3c[0x0]['num']){_0x448996=![];}_0x4ea60f[_0x9edd('0x1b')](dbH['sequelize'][_0x9edd('0x14')](util[_0x9edd('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x494a24,_0x5f5bf4),{'type':dbH['sequelize'][_0x9edd('0x16')]['SELECT']}));}}else{_0x4ea60f[_0x9edd('0x1b')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x9edd('0x13')][_0x9edd('0x16')]['SELECT']}));}}var _0x5823bc=path[_0x9edd('0x1c')](PATH);var _0x186186=path[_0x9edd('0x1d')](PATH,'.csv');var _0x3741c8=_0x5d2f90[_0x9edd('0x10')]&&_0x4ea60f[_0x9edd('0x1a')]>0x1;var _0x2ca65f=[];if(!fs[_0x9edd('0x1e')](path['join'](_0x5823bc,_0x186186))&&_0x3741c8){fs[_0x9edd('0x1f')](path[_0x9edd('0x20')](_0x5823bc,_0x186186));}return BPromise[_0x9edd('0x21')](_0x4ea60f,function(_0x2f9f86){_0x2ca65f[_0x9edd('0x1b')](_0x2f9f86);})['then'](function(){for(var _0x4b3d1b=0x0;_0x4b3d1b<_0x2ca65f[_0x9edd('0x1a')];_0x4b3d1b+=0x1){var _0xfeca7b;var _0x8d67aa=_0x2ca65f[_0x4b3d1b];if(_0x3741c8){_0xfeca7b=path[_0x9edd('0x20')](_0x5823bc,_0x186186,util[_0x9edd('0xd')]('%s%d.%s',_0x186186,_0x4b3d1b,'csv'));}else{_0xfeca7b=path[_0x9edd('0x20')](_0x5823bc,util[_0x9edd('0xd')](_0x9edd('0x22'),_0x186186,'csv'));}fs[_0x9edd('0x23')](_0xfeca7b,csv(_0x8d67aa));}})[_0x9edd('0x12')](function(){if(_0x3741c8){zipdir(path[_0x9edd('0x20')](_0x5823bc,_0x186186),{'saveTo':path[_0x9edd('0x20')](_0x5823bc,util['format'](_0x9edd('0x22'),_0x186186,_0x9edd('0x24')))},function(_0xbe87e1,_0x12c1bc){});rimraf(path[_0x9edd('0x20')](_0x5823bc,_0x186186),function(){});}})[_0x9edd('0x12')](function(){logger[_0x9edd('0xc')](util[_0x9edd('0xd')](_0x9edd('0x25'),EXTRACTED_REPORT_ID,_0x9edd('0xe')));return analyticExtractedReport(_0x9edd('0x26'),_0x3741c8?util[_0x9edd('0xd')](_0x9edd('0x22'),_0x186186,_0x3741c8?_0x9edd('0x24'):_0x9edd('0x27')):null);});})['catch'](function(_0x1453d2){logger[_0x9edd('0xc')](util[_0x9edd('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9edd('0xe')),util[_0x9edd('0x28')](_0x1453d2,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x9edd('0x29'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 3cbc67d..e29e661 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x332a87,_0x1d69fa){var _0x583d34=function(_0x130067){while(--_0x130067){_0x332a87['push'](_0x332a87['shift']());}};_0x583d34(++_0x1d69fa);}(_0xb10b,0x12a));var _0xbb10=function(_0x217483,_0x422422){_0x217483=_0x217483-0x0;var _0x37f8a4=_0xb10b[_0x217483];return _0x37f8a4;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file +var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x25c3bb,_0x253aa6){var _0x36b047=function(_0x5d1d57){while(--_0x5d1d57){_0x25c3bb['push'](_0x25c3bb['shift']());}};_0x36b047(++_0x253aa6);}(_0xb10b,0x12a));var _0xbb10=function(_0x55c3d9,_0x3bf75c){_0x55c3d9=_0x55c3d9-0x0;var _0x19fd97=_0xb10b[_0x55c3d9];return _0x19fd97;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index e76434f..b6e20e3 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 _0xf801=['xlsx','%s.%s','binary','zip','info','XLSX','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','then','splitSizeXlsx','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','num','Empty','%s\x20limit\x20%d\x20OFFSET\x20%d','push','QueryTypes','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','length','%s%d.%s'];(function(_0x354e8c,_0x1e9a3b){var _0x31f82c=function(_0x4b0d32){while(--_0x4b0d32){_0x354e8c['push'](_0x354e8c['shift']());}};_0x31f82c(++_0x1e9a3b);}(_0xf801,0x96));var _0x1f80=function(_0x465a22,_0x6bfa46){_0x465a22=_0x465a22-0x0;var _0x5ad9da=_0xf801[_0x465a22];return _0x5ad9da;};'use strict';var util=require(_0x1f80('0x0'));var path=require(_0x1f80('0x1'));var _=require(_0x1f80('0x2'));var fs=require('fs');var json2xls=require(_0x1f80('0x3'));var BPromise=require('bluebird');var zipdir=require(_0x1f80('0x4'));var rimraf=require(_0x1f80('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0x1f80('0x6'))[_0x1f80('0x7')];var logger=require(_0x1f80('0x8'))(_0x1f80('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x1f80('0xa')][0x4];function analyticExtractedReport(_0x51d2b3,_0x1512cc){var _0x289c3e={'status':_0x51d2b3};var _0x325857={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1512cc){_0x289c3e[_0x1f80('0xb')]=_0x1512cc;}return db[_0x1f80('0xc')][_0x1f80('0xd')](_0x289c3e,_0x325857);}function main(){var _0x2dc697=0x1388;var _0x2e9bc7;logger['info'](util['format'](_0x1f80('0xe'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x1f80('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1f80('0x10'),'splitSizeXlsx']})[_0x1f80('0x11')](function(_0x296437){if(_0x296437){_0x2e9bc7=_0x296437;_0x2dc697=_0x2e9bc7[_0x1f80('0x12')]||0x1388;}})[_0x1f80('0x11')](function(){return dbH['sequelize'][_0x1f80('0x13')](util[_0x1f80('0x14')](_0x1f80('0x15'),QUERY),{'type':dbH[_0x1f80('0x16')]['QueryTypes'][_0x1f80('0x17')]});})[_0x1f80('0x11')](function(_0x4edb4f){if(!_0x4edb4f[0x0][_0x1f80('0x18')]){return analyticExtractedReport(_0x1f80('0x19'));}var _0x48b65c=[];var _0x1ac41b=0x0;var _0x21f697=!![];if(_0x2e9bc7[_0x1f80('0x10')]){if(_0x4edb4f&&_0x4edb4f['length']){var _0x3d150d=_0x4edb4f[0x0][_0x1f80('0x18')]%(_0x1ac41b+_0x2dc697);for(;_0x21f697;_0x1ac41b+=_0x2dc697,_0x3d150d=_0x4edb4f[0x0][_0x1f80('0x18')]%(_0x1ac41b+_0x2dc697)){if(_0x3d150d==0x0||_0x3d150d==_0x4edb4f[0x0][_0x1f80('0x18')]){_0x21f697=![];}_0x48b65c['push'](dbH[_0x1f80('0x16')][_0x1f80('0x13')](util[_0x1f80('0x14')](_0x1f80('0x1a'),QUERY,_0x2dc697,_0x1ac41b),{'type':dbH[_0x1f80('0x16')]['QueryTypes'][_0x1f80('0x17')]}));}}}else{_0x48b65c[_0x1f80('0x1b')](dbH['sequelize'][_0x1f80('0x13')](QUERY,{'type':dbH[_0x1f80('0x16')][_0x1f80('0x1c')][_0x1f80('0x17')]}));}var _0x362c07=path[_0x1f80('0x1d')](PATH);var _0x5aa737=path[_0x1f80('0x1e')](PATH,_0x1f80('0x1f'));var _0x1cb10e=_0x2e9bc7[_0x1f80('0x10')]&&_0x48b65c['length']>0x1;var _0x298a0e=[];if(!fs[_0x1f80('0x20')](path[_0x1f80('0x21')](_0x362c07,_0x5aa737))&&_0x1cb10e){fs[_0x1f80('0x22')](path[_0x1f80('0x21')](_0x362c07,_0x5aa737));}return BPromise[_0x1f80('0x23')](_0x48b65c,function(_0x17f81b){_0x298a0e['push'](_0x17f81b);})['then'](function(){for(var _0x28547f=0x0;_0x28547f<_0x298a0e[_0x1f80('0x24')];_0x28547f+=0x1){var _0x33c783;var _0x430cc6=_0x298a0e[_0x28547f];if(_0x1cb10e){_0x33c783=path[_0x1f80('0x21')](_0x362c07,_0x5aa737,util[_0x1f80('0x14')](_0x1f80('0x25'),_0x5aa737,_0x28547f,_0x1f80('0x26')));}else{_0x33c783=path[_0x1f80('0x21')](_0x362c07,util[_0x1f80('0x14')](_0x1f80('0x27'),_0x5aa737,_0x1f80('0x26')));}fs['writeFileSync'](_0x33c783,json2xls(_0x430cc6),_0x1f80('0x28'));}})[_0x1f80('0x11')](function(){if(_0x1cb10e){zipdir(path['join'](_0x362c07,_0x5aa737),{'saveTo':path[_0x1f80('0x21')](_0x362c07,util[_0x1f80('0x14')]('%s.%s',_0x5aa737,_0x1f80('0x29')))},function(_0x5cd668,_0x3f510e){});rimraf(path[_0x1f80('0x21')](_0x362c07,_0x5aa737),function(){});}})[_0x1f80('0x11')](function(){logger[_0x1f80('0x2a')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x1f80('0x2b')));return analyticExtractedReport('Completed',_0x1cb10e?util['format'](_0x1f80('0x27'),_0x5aa737,_0x1cb10e?'zip':_0x1f80('0x26')):null);});})['catch'](function(_0x279836){logger[_0x1f80('0x2a')](util[_0x1f80('0x14')](_0x1f80('0x2c'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x1f80('0x2d')](_0x279836,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x1f80('0x2e'));});}main(); \ No newline at end of file +var _0x3e49=['.xlsx','existsSync','join','mkdirSync','xlsx','%s.%s','writeFileSync','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','json2xls','zip-dir','rimraf','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e49,0xfb));var _0x93e4=function(_0x1a1cdf,_0x3b662f){_0x1a1cdf=_0x1a1cdf-0x0;var _0x1a9ea4=_0x3e49[_0x1a1cdf];return _0x1a9ea4;};'use strict';var util=require(_0x93e4('0x0'));var path=require(_0x93e4('0x1'));var _=require(_0x93e4('0x2'));var fs=require('fs');var json2xls=require(_0x93e4('0x3'));var BPromise=require('bluebird');var zipdir=require(_0x93e4('0x4'));var rimraf=require(_0x93e4('0x5'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')(_0x93e4('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x93e4('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x93e4('0x7')][0x4];function analyticExtractedReport(_0x438831,_0x33390d){var _0x195909={'status':_0x438831};var _0x206a64={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x33390d){_0x195909[_0x93e4('0x8')]=_0x33390d;}return db[_0x93e4('0x9')]['update'](_0x195909,_0x206a64);}function main(){var _0x113d53=0x1388;var _0x53a943;logger[_0x93e4('0xa')](util[_0x93e4('0xb')](_0x93e4('0xc'),EXTRACTED_REPORT_ID,_0x93e4('0xd')));return db[_0x93e4('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x93e4('0xf'),_0x93e4('0x10')]})[_0x93e4('0x11')](function(_0x4d5d66){if(_0x4d5d66){_0x53a943=_0x4d5d66;_0x113d53=_0x53a943[_0x93e4('0x10')]||0x1388;}})[_0x93e4('0x11')](function(){return dbH['sequelize'][_0x93e4('0x12')](util[_0x93e4('0xb')](_0x93e4('0x13'),QUERY),{'type':dbH[_0x93e4('0x14')]['QueryTypes'][_0x93e4('0x15')]});})['then'](function(_0x4ba240){if(!_0x4ba240[0x0][_0x93e4('0x16')]){return analyticExtractedReport(_0x93e4('0x17'));}var _0x5b1a67=[];var _0x123da8=0x0;var _0x1e869d=!![];if(_0x53a943['split']){if(_0x4ba240&&_0x4ba240[_0x93e4('0x18')]){var _0x3dcd64=_0x4ba240[0x0]['num']%(_0x123da8+_0x113d53);for(;_0x1e869d;_0x123da8+=_0x113d53,_0x3dcd64=_0x4ba240[0x0][_0x93e4('0x16')]%(_0x123da8+_0x113d53)){if(_0x3dcd64==0x0||_0x3dcd64==_0x4ba240[0x0]['num']){_0x1e869d=![];}_0x5b1a67[_0x93e4('0x19')](dbH[_0x93e4('0x14')]['query'](util[_0x93e4('0xb')](_0x93e4('0x1a'),QUERY,_0x113d53,_0x123da8),{'type':dbH[_0x93e4('0x14')][_0x93e4('0x1b')][_0x93e4('0x15')]}));}}}else{_0x5b1a67[_0x93e4('0x19')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x93e4('0x14')][_0x93e4('0x1b')][_0x93e4('0x15')]}));}var _0x5e5d80=path['dirname'](PATH);var _0x24d823=path[_0x93e4('0x1c')](PATH,_0x93e4('0x1d'));var _0x134b06=_0x53a943[_0x93e4('0xf')]&&_0x5b1a67[_0x93e4('0x18')]>0x1;var _0xfb0f51=[];if(!fs[_0x93e4('0x1e')](path[_0x93e4('0x1f')](_0x5e5d80,_0x24d823))&&_0x134b06){fs[_0x93e4('0x20')](path[_0x93e4('0x1f')](_0x5e5d80,_0x24d823));}return BPromise['each'](_0x5b1a67,function(_0xd3559e){_0xfb0f51[_0x93e4('0x19')](_0xd3559e);})[_0x93e4('0x11')](function(){for(var _0x2f259b=0x0;_0x2f259b<_0xfb0f51[_0x93e4('0x18')];_0x2f259b+=0x1){var _0xd292c;var _0x3761c9=_0xfb0f51[_0x2f259b];if(_0x134b06){_0xd292c=path[_0x93e4('0x1f')](_0x5e5d80,_0x24d823,util[_0x93e4('0xb')]('%s%d.%s',_0x24d823,_0x2f259b,_0x93e4('0x21')));}else{_0xd292c=path[_0x93e4('0x1f')](_0x5e5d80,util['format'](_0x93e4('0x22'),_0x24d823,_0x93e4('0x21')));}fs[_0x93e4('0x23')](_0xd292c,json2xls(_0x3761c9),'binary');}})[_0x93e4('0x11')](function(){if(_0x134b06){zipdir(path[_0x93e4('0x1f')](_0x5e5d80,_0x24d823),{'saveTo':path[_0x93e4('0x1f')](_0x5e5d80,util['format']('%s.%s',_0x24d823,'zip'))},function(_0x29ecec,_0x1091e7){});rimraf(path[_0x93e4('0x1f')](_0x5e5d80,_0x24d823),function(){});}})[_0x93e4('0x11')](function(){logger[_0x93e4('0xa')](util[_0x93e4('0xb')](_0x93e4('0x24'),EXTRACTED_REPORT_ID,_0x93e4('0xd')));return analyticExtractedReport('Completed',_0x134b06?util[_0x93e4('0xb')](_0x93e4('0x22'),_0x24d823,_0x134b06?'zip':_0x93e4('0x21')):null);});})['catch'](function(_0x173746){logger['info'](util[_0x93e4('0xb')](_0x93e4('0x25'),EXTRACTED_REPORT_ID,_0x93e4('0xd')),util[_0x93e4('0x26')](_0x173746,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x93e4('0x27'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index f330123..d014f33 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 _0x838f=['wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','map','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','IntervalId','VoiceExtension','exten','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','format','CDR(type)=%s','context','outbound','Set','${EXTEN:','cutdigits','${EXTEN}','VoiceExtensionId','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT='];(function(_0x486b00,_0x501df5){var _0x47ea82=function(_0x997782){while(--_0x997782){_0x486b00['push'](_0x486b00['shift']());}};_0x47ea82(++_0x501df5);}(_0x838f,0x101));var _0xf838=function(_0x45bde9,_0x1c32c1){_0x45bde9=_0x45bde9-0x0;var _0x5b1a16=_0x838f[_0x45bde9];return _0x5b1a16;};'use strict';var _=require(_0xf838('0x0'));var util=require(_0xf838('0x1'));function rewrite(_0xace182,_0x38783d){var _0x3569ac=this;return _0xace182[_0xf838('0x2')][_0xf838('0x3')][_0xf838('0x4')]({'raw':!![]})[_0xf838('0x5')](function(_0x285cb4){_0x3569ac[_0xf838('0x6')]=_0x285cb4;return _0xace182[_0xf838('0x2')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x38783d[_0xf838('0x7')]},'raw':!![]});})[_0xf838('0x5')](function(_0x31688b){return _0xace182['models'][_0xf838('0x8')][_0xf838('0x4')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x31688b,_0xf838('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xf838('0x5')](function(_0x3d398b){var _0x5ddc67=_['filter'](_0x3d398b,{'priority':'1'});var _0x50a885=_[_0xf838('0xa')](_0x3d398b,{'isApp':0x1});var _0x4bd73f=_[_0xf838('0xb')](_0x50a885,_0xf838('0x9'));var _0xeaba9b=[_0xf838('0xc'),_0xf838('0xd')];var _0x575b79=[];var _0x2fd65a=[];for(var _0x9b216b in _0x4bd73f){if(_0x4bd73f[_0xf838('0xe')](_0x9b216b)){_0x3569ac[_0xf838('0xf')]=0x2;_0x3569ac[_0xf838('0x10')]=[];_0x3569ac[_0xf838('0x11')]=_[_0xf838('0x12')](_0x5ddc67,{'exten':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x9')]});_0x3569ac[_0xf838('0x10')][_0xf838('0x13')]({'type':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x14')],'app':'Set','appdata':util[_0xf838('0x15')](_0xf838('0x16'),_0x4bd73f[_0x9b216b][0x0]['type']),'context':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x17')],'exten':_0x4bd73f[_0x9b216b][0x0]['exten'],'priority':_0x3569ac['priority']++,'VoiceExtensionId':_0x4bd73f[_0x9b216b][0x0]['VoiceExtensionId']});if(_0x4bd73f[_0x9b216b][0x0][_0xf838('0x14')]===_0xf838('0x18')){if(_0x3569ac[_0xf838('0x11')]){_0x3569ac['extensions']['push']({'type':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x14')],'app':_0xf838('0x19'),'appdata':'CDR(destination)='+(_0x3569ac[_0xf838('0x11')]['cutdigits']?_0xf838('0x1a')+_0x3569ac[_0xf838('0x11')][_0xf838('0x1b')]+'}':_0xf838('0x1c')),'context':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x17')],'exten':_0x4bd73f[_0x9b216b][0x0]['exten'],'priority':_0x3569ac[_0xf838('0xf')]++,'VoiceExtensionId':_0x4bd73f[_0x9b216b][0x0]['VoiceExtensionId']});}_0x3569ac[_0xf838('0x10')][_0xf838('0x13')]({'type':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x14')],'app':_0xf838('0x19'),'appdata':'CDR(routeid)='+_0x4bd73f[_0x9b216b][0x0][_0xf838('0x1d')],'context':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x17')],'exten':_0x4bd73f[_0x9b216b][0x0]['exten'],'priority':_0x3569ac['priority']++,'VoiceExtensionId':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x1d')]});var _0x43a049=_0x3569ac[_0xf838('0xf')]++;_0x3569ac[_0xf838('0x10')][_0xf838('0x13')]({'type':_0x4bd73f[_0x9b216b][0x0]['type'],'app':_0xf838('0x1e'),'appdata':_0xf838('0x1f')+(_0x43a049+0x2)+'):Goto('+(_0x43a049+0x1)+')','context':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x17')],'exten':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x9')],'priority':_0x43a049,'VoiceExtensionId':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x1d')]});if(_0x3569ac[_0xf838('0x11')]){_0x3569ac[_0xf838('0x10')][_0xf838('0x13')]({'type':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x14')],'app':'Set','appdata':_0x3569ac[_0xf838('0x11')]['cutdigits']?_0xf838('0x20')+_0x3569ac[_0xf838('0x11')][_0xf838('0x1b')]+'}':_0xf838('0x21'),'context':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x17')],'exten':_0x4bd73f[_0x9b216b][0x0]['exten'],'priority':_0x3569ac['priority']++,'VoiceExtensionId':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x1d')]});}_0x3569ac[_0xf838('0x10')][_0xf838('0x13')]({'type':_0x4bd73f[_0x9b216b][0x0]['type'],'app':_0xf838('0x19'),'appdata':_0xf838('0x22')+_0x4bd73f[_0x9b216b][0x0][_0xf838('0x1d')],'context':_0x4bd73f[_0x9b216b][0x0]['context'],'exten':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x9')],'priority':_0x3569ac['priority']++,'VoiceExtensionId':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x1d')]});if(_0x3569ac['extension']&&_0x3569ac[_0xf838('0x11')][_0xf838('0xe')](_0xf838('0x23'))&&_0x3569ac[_0xf838('0x11')][_0xf838('0x23')]!==_0xf838('0x24')){_0x3569ac['extensions']['push']({'type':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x14')],'app':_0xf838('0x19'),'appdata':_0xf838('0x25'),'context':_0x4bd73f[_0x9b216b][0x0]['context'],'exten':_0x4bd73f[_0x9b216b][0x0]['exten'],'priority':_0x3569ac[_0xf838('0xf')]++,'VoiceExtensionId':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x1d')]});_0x3569ac[_0xf838('0x10')][_0xf838('0x13')]({'type':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x14')],'app':'Set','appdata':_0xf838('0x26')+_0x3569ac[_0xf838('0x11')][_0xf838('0x23')]||_0xf838('0x27'),'context':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x17')],'exten':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x9')],'priority':_0x3569ac[_0xf838('0xf')]++,'VoiceExtensionId':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x1d')]});}}_0x3569ac['extensions']['push']({'type':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x14')],'app':_0xf838('0x19'),'appdata':_0xf838('0x28'),'context':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x17')],'exten':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x9')],'priority':_0x3569ac['priority']++,'VoiceExtensionId':_0x4bd73f[_0x9b216b][0x0]['VoiceExtensionId']});_0x3569ac['extensions']['push']({'type':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x14')],'app':'Set','appdata':_0xf838('0x29'),'context':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x17')],'exten':_0x4bd73f[_0x9b216b][0x0]['exten'],'priority':_0x3569ac[_0xf838('0xf')]++,'VoiceExtensionId':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x1d')]});_0x3569ac[_0xf838('0x10')][_0xf838('0x13')]({'type':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x14')],'app':_0xf838('0x19'),'appdata':_0xf838('0x2a'),'context':_0x4bd73f[_0x9b216b][0x0]['context'],'exten':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x9')],'priority':_0x3569ac['priority']++,'VoiceExtensionId':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x1d')]});for(var _0x4f07f8=0x0,_0x1b6afd=0x0;_0x4f07f8<_0x4bd73f[_0x9b216b][_0xf838('0x2b')];_0x4f07f8+=0x1,_0x1b6afd=0x0){var _0x515e55=_0x4bd73f[_0x9b216b][_0x4f07f8];if(_0x515e55['type']){_0x515e55['type']=_0x515e55[_0xf838('0x14')]['toLowerCase']();}var _0x500a27=[];var _0x368c96=[];delete _0x515e55['id'];delete _0x515e55[_0xf838('0x2c')];delete _0x515e55[_0xf838('0x2d')];var _0x4d86b0=_0x515e55[_0xf838('0x2e')]!==_0xf838('0x2f')?[_0x515e55[_0xf838('0x2e')]]:_0x515e55[_0xf838('0x7')]?_[_0xf838('0x30')](_[_0xf838('0xa')](_0x3569ac[_0xf838('0x6')],{'IntervalId':_0x515e55[_0xf838('0x7')]}),_0xf838('0x2e')):[];if(_0x515e55[_0xf838('0xe')]('tag')){if(_0x515e55[_0xf838('0x31')]&&_0x515e55['tag']!=='--'){_0x500a27[_0xf838('0x13')]({'type':_0x515e55[_0xf838('0x14')],'app':_0xf838('0x19'),'appdata':_0xf838('0x32')+_0x515e55[_0xf838('0x31')],'context':_0x515e55[_0xf838('0x17')],'exten':_0x515e55[_0xf838('0x9')],'priority':_0x4d86b0[_0xf838('0x2b')]+_0x3569ac[_0xf838('0xf')]+_0x1b6afd++,'VoiceExtensionId':_0x515e55[_0xf838('0x1d')]});}}if(_0x515e55[_0xf838('0x14')]===_0xf838('0x18')&&_0x515e55[_0xf838('0xe')](_0xf838('0x33'))){if(_0x515e55['callerID']){_0x500a27[_0xf838('0x13')]({'type':_0x515e55[_0xf838('0x14')],'app':_0xf838('0x1e'),'appdata':_0xf838('0x34')+_0x515e55[_0xf838('0x33')]+')','context':_0x515e55['context'],'exten':_0x515e55['exten'],'priority':_0x4d86b0[_0xf838('0x2b')]+_0x3569ac['priority']+_0x1b6afd++,'VoiceExtensionId':_0x515e55['VoiceExtensionId']});}else{_0x500a27[_0xf838('0x13')]({'type':_0x515e55[_0xf838('0x14')],'app':_0xf838('0x1e'),'appdata':_0xf838('0x35'),'context':_0x515e55[_0xf838('0x17')],'exten':_0x515e55[_0xf838('0x9')],'priority':_0x4d86b0[_0xf838('0x2b')]+_0x3569ac['priority']+_0x1b6afd++,'VoiceExtensionId':_0x515e55['VoiceExtensionId']});}}if(_0x515e55[_0xf838('0xe')](_0xf838('0x36'))){if(_0xeaba9b[_0xf838('0x37')](_0x515e55['app']['toLowerCase']())>=0x0&&_0x515e55[_0xf838('0x38')]!=='custom'){if(_0x515e55['answer']){_0x500a27[_0xf838('0x13')]({'type':_0x515e55[_0xf838('0x14')],'app':_0xf838('0x1e'),'appdata':_0xf838('0x39'),'context':_0x515e55[_0xf838('0x17')],'exten':_0x515e55[_0xf838('0x9')],'priority':_0x4d86b0['length']+_0x3569ac['priority']+_0x1b6afd++,'VoiceExtensionId':_0x515e55[_0xf838('0x1d')]});_0x500a27[_0xf838('0x13')]({'type':_0x515e55[_0xf838('0x14')],'app':_0xf838('0x19'),'appdata':_0xf838('0x3a'),'context':_0x515e55['context'],'exten':_0x515e55[_0xf838('0x9')],'priority':_0x4d86b0['length']+_0x3569ac[_0xf838('0xf')]+_0x1b6afd++,'VoiceExtensionId':_0x515e55[_0xf838('0x1d')]});}else{_0x500a27[_0xf838('0x13')]({'type':_0x515e55['type'],'app':_0xf838('0x1e'),'appdata':_0xf838('0x3b'),'context':_0x515e55[_0xf838('0x17')],'exten':_0x515e55[_0xf838('0x9')],'priority':_0x4d86b0[_0xf838('0x2b')]+_0x3569ac[_0xf838('0xf')]+_0x1b6afd++,'VoiceExtensionId':_0x515e55['VoiceExtensionId']});_0x500a27[_0xf838('0x13')]({'type':_0x515e55[_0xf838('0x14')],'app':_0xf838('0x19'),'appdata':_0xf838('0x3c'),'context':_0x515e55[_0xf838('0x17')],'exten':_0x515e55[_0xf838('0x9')],'priority':_0x4d86b0[_0xf838('0x2b')]+_0x3569ac[_0xf838('0xf')]+_0x1b6afd++,'VoiceExtensionId':_0x515e55[_0xf838('0x1d')]});}}}for(var _0x14d0e8=0x0;_0x14d0e8<_0x4d86b0[_0xf838('0x2b')];_0x14d0e8+=0x1){var _0x14263a=_0x3569ac['priority']+_0x4d86b0[_0xf838('0x2b')];var _0x236903=_0x14d0e8===_0x4d86b0[_0xf838('0x2b')]-0x1?_0x3569ac[_0xf838('0xf')]+_0x500a27[_0xf838('0x2b')]+_0x368c96[_0xf838('0x2b')]+0x2:_0x3569ac[_0xf838('0xf')]+_0x14d0e8+0x1;_0x500a27[_0xf838('0x3d')](_0x14d0e8,0x0,{'type':_0x515e55[_0xf838('0x14')],'app':_0xf838('0x3e'),'appdata':_0x4d86b0[_0x14d0e8]+'?'+_0x515e55[_0xf838('0x17')]+_0xf838('0x3f')+_0x14263a+':'+_0x515e55['context']+_0xf838('0x3f')+_0x236903,'exten':_0x515e55[_0xf838('0x9')],'context':_0x515e55[_0xf838('0x17')],'priority':_0x3569ac[_0xf838('0xf')]+_0x14d0e8,'VoiceExtensionId':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x1d')]});}_0x515e55[_0xf838('0xf')]=_0x500a27[_0xf838('0x2b')]?_[_0xf838('0x40')](_0x500a27)['priority']+0x1:_0x3569ac['priority'];_0x3569ac['priority']=(_0x368c96[_0xf838('0x2b')]?_[_0xf838('0x40')](_0x368c96)[_0xf838('0xf')]:_0x515e55[_0xf838('0xf')])+0x1;_0x3569ac[_0xf838('0x10')]=_[_0xf838('0x41')](_0x3569ac[_0xf838('0x10')],_0x500a27,[_0x515e55],_0x368c96);}_0x3569ac['extensions'][_0xf838('0x13')]({'type':_0x4bd73f[_0x9b216b][0x0]['type'],'app':_0xf838('0x42'),'exten':_0x4bd73f[_0x9b216b][0x0][_0xf838('0x9')],'context':_0x4bd73f[_0x9b216b][0x0]['context'],'priority':_0x3569ac['priority'],'VoiceExtensionId':_0x4bd73f[_0x9b216b][0x0]['VoiceExtensionId']});_0x575b79['push'](_0x4bd73f[_0x9b216b][0x0][_0xf838('0x1d')]);_0x2fd65a=_[_0xf838('0x41')](_0x2fd65a,_0x3569ac[_0xf838('0x10')]);}}return _0xace182[_0xf838('0x43')](function(_0x52be4e){return _0xace182[_0xf838('0x2')][_0xf838('0x8')][_0xf838('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x575b79}},'transaction':_0x52be4e})[_0xf838('0x5')](function(_0x4f1b24){return _0xace182['models'][_0xf838('0x8')][_0xf838('0x45')](_[_0xf838('0x46')](_0x2fd65a,_0xf838('0xf')),{'transaction':_0x52be4e});});});})[_0xf838('0x47')](function(_0x18f29d){console[_0xf838('0x48')](_0x18f29d);});}exports[_0xf838('0x49')]=rewrite; \ No newline at end of file +var _0x0c39=['CDR(type)=%s','type','priority','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN}','context','ExecIf','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','toLowerCase','createdAt','interval','IntervalId','tag','length','callerID','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','catch','error','rewrite','lodash','util','models','Interval','findAll','intervals','VoiceExtension','uniq','map','exten','then','filter','queue','hasOwnProperty','extension','find','extensions','push','Set','format'];(function(_0x1f683b,_0x46d82f){var _0x5d3942=function(_0x244c11){while(--_0x244c11){_0x1f683b['push'](_0x1f683b['shift']());}};_0x5d3942(++_0x46d82f);}(_0x0c39,0x1b3));var _0x90c3=function(_0x17e742,_0xea41ae){_0x17e742=_0x17e742-0x0;var _0x59692b=_0x0c39[_0x17e742];return _0x59692b;};'use strict';var _=require(_0x90c3('0x0'));var util=require(_0x90c3('0x1'));function rewrite(_0x4ad325,_0x2aed18){var _0x5760f9=this;return _0x4ad325[_0x90c3('0x2')][_0x90c3('0x3')][_0x90c3('0x4')]({'raw':!![]})['then'](function(_0xdb1e35){_0x5760f9[_0x90c3('0x5')]=_0xdb1e35;return _0x4ad325[_0x90c3('0x2')][_0x90c3('0x6')][_0x90c3('0x4')]({'where':{'IntervalId':_0x2aed18['IntervalId']},'raw':!![]});})['then'](function(_0x292444){return _0x4ad325[_0x90c3('0x2')][_0x90c3('0x6')][_0x90c3('0x4')]({'where':{'exten':{'$in':_[_0x90c3('0x7')](_[_0x90c3('0x8')](_0x292444,_0x90c3('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x90c3('0xa')](function(_0x34ba1e){var _0x5b351c=_[_0x90c3('0xb')](_0x34ba1e,{'priority':'1'});var _0x391d1b=_[_0x90c3('0xb')](_0x34ba1e,{'isApp':0x1});var _0x1fdf57=_['groupBy'](_0x391d1b,_0x90c3('0x9'));var _0x4be865=[_0x90c3('0xc'),'playback'];var _0x13f5dd=[];var _0x1992a8=[];for(var _0x527ae0 in _0x1fdf57){if(_0x1fdf57[_0x90c3('0xd')](_0x527ae0)){_0x5760f9['priority']=0x2;_0x5760f9['extensions']=[];_0x5760f9[_0x90c3('0xe')]=_[_0x90c3('0xf')](_0x5b351c,{'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')]});_0x5760f9[_0x90c3('0x10')][_0x90c3('0x11')]({'type':_0x1fdf57[_0x527ae0][0x0]['type'],'app':_0x90c3('0x12'),'appdata':util[_0x90c3('0x13')](_0x90c3('0x14'),_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x15')]),'context':_0x1fdf57[_0x527ae0][0x0]['context'],'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')],'priority':_0x5760f9[_0x90c3('0x16')]++,'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]});if(_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x15')]===_0x90c3('0x18')){if(_0x5760f9['extension']){_0x5760f9[_0x90c3('0x10')][_0x90c3('0x11')]({'type':_0x1fdf57[_0x527ae0][0x0]['type'],'app':_0x90c3('0x12'),'appdata':_0x90c3('0x19')+(_0x5760f9['extension'][_0x90c3('0x1a')]?'${EXTEN:'+_0x5760f9['extension'][_0x90c3('0x1a')]+'}':_0x90c3('0x1b')),'context':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x1c')],'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')],'priority':_0x5760f9['priority']++,'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]});}_0x5760f9[_0x90c3('0x10')][_0x90c3('0x11')]({'type':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x15')],'app':_0x90c3('0x12'),'appdata':'CDR(routeid)='+_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')],'context':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x1c')],'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')],'priority':_0x5760f9[_0x90c3('0x16')]++,'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]});var _0x3ac883=_0x5760f9['priority']++;_0x5760f9['extensions'][_0x90c3('0x11')]({'type':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x15')],'app':_0x90c3('0x1d'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3ac883+0x2)+'):Goto('+(_0x3ac883+0x1)+')','context':_0x1fdf57[_0x527ae0][0x0]['context'],'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')],'priority':_0x3ac883,'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]});if(_0x5760f9['extension']){_0x5760f9['extensions']['push']({'type':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x15')],'app':_0x90c3('0x12'),'appdata':_0x5760f9[_0x90c3('0xe')][_0x90c3('0x1a')]?_0x90c3('0x1e')+_0x5760f9[_0x90c3('0xe')][_0x90c3('0x1a')]+'}':_0x90c3('0x1f'),'context':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x1c')],'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')],'priority':_0x5760f9[_0x90c3('0x16')]++,'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]});}_0x5760f9[_0x90c3('0x10')][_0x90c3('0x11')]({'type':_0x1fdf57[_0x527ae0][0x0]['type'],'app':'Set','appdata':_0x90c3('0x20')+_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')],'context':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x1c')],'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')],'priority':_0x5760f9[_0x90c3('0x16')]++,'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]});if(_0x5760f9[_0x90c3('0xe')]&&_0x5760f9[_0x90c3('0xe')]['hasOwnProperty'](_0x90c3('0x21'))&&_0x5760f9[_0x90c3('0xe')][_0x90c3('0x21')]!=='none'){_0x5760f9[_0x90c3('0x10')]['push']({'type':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x15')],'app':_0x90c3('0x12'),'appdata':_0x90c3('0x22'),'context':_0x1fdf57[_0x527ae0][0x0]['context'],'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')],'priority':_0x5760f9[_0x90c3('0x16')]++,'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]});_0x5760f9[_0x90c3('0x10')][_0x90c3('0x11')]({'type':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x15')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x5760f9[_0x90c3('0xe')][_0x90c3('0x21')]||_0x90c3('0x23'),'context':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x1c')],'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')],'priority':_0x5760f9[_0x90c3('0x16')]++,'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0]['VoiceExtensionId']});}}_0x5760f9[_0x90c3('0x10')][_0x90c3('0x11')]({'type':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x15')],'app':_0x90c3('0x12'),'appdata':_0x90c3('0x24'),'context':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x1c')],'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')],'priority':_0x5760f9['priority']++,'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]});_0x5760f9[_0x90c3('0x10')][_0x90c3('0x11')]({'type':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x15')],'app':_0x90c3('0x12'),'appdata':_0x90c3('0x25'),'context':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x1c')],'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')],'priority':_0x5760f9[_0x90c3('0x16')]++,'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]});_0x5760f9[_0x90c3('0x10')][_0x90c3('0x11')]({'type':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x15')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x1c')],'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')],'priority':_0x5760f9[_0x90c3('0x16')]++,'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]});for(var _0x44616f=0x0,_0x1c1adf=0x0;_0x44616f<_0x1fdf57[_0x527ae0]['length'];_0x44616f+=0x1,_0x1c1adf=0x0){var _0x58c0f0=_0x1fdf57[_0x527ae0][_0x44616f];if(_0x58c0f0['type']){_0x58c0f0[_0x90c3('0x15')]=_0x58c0f0[_0x90c3('0x15')][_0x90c3('0x26')]();}var _0x421803=[];var _0x50e1f0=[];delete _0x58c0f0['id'];delete _0x58c0f0[_0x90c3('0x27')];delete _0x58c0f0['updatedAt'];var _0x50bef=_0x58c0f0[_0x90c3('0x28')]!=='*,*,*,*'?[_0x58c0f0['interval']]:_0x58c0f0[_0x90c3('0x29')]?_['map'](_[_0x90c3('0xb')](_0x5760f9[_0x90c3('0x5')],{'IntervalId':_0x58c0f0[_0x90c3('0x29')]}),_0x90c3('0x28')):[];if(_0x58c0f0[_0x90c3('0xd')]('tag')){if(_0x58c0f0['tag']&&_0x58c0f0[_0x90c3('0x2a')]!=='--'){_0x421803[_0x90c3('0x11')]({'type':_0x58c0f0[_0x90c3('0x15')],'app':_0x90c3('0x12'),'appdata':'CDR(tag)='+_0x58c0f0[_0x90c3('0x2a')],'context':_0x58c0f0['context'],'exten':_0x58c0f0['exten'],'priority':_0x50bef[_0x90c3('0x2b')]+_0x5760f9[_0x90c3('0x16')]+_0x1c1adf++,'VoiceExtensionId':_0x58c0f0[_0x90c3('0x17')]});}}if(_0x58c0f0['type']===_0x90c3('0x18')&&_0x58c0f0[_0x90c3('0xd')](_0x90c3('0x2c'))){if(_0x58c0f0[_0x90c3('0x2c')]){_0x421803[_0x90c3('0x11')]({'type':_0x58c0f0['type'],'app':_0x90c3('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x58c0f0[_0x90c3('0x2c')]+')','context':_0x58c0f0['context'],'exten':_0x58c0f0[_0x90c3('0x9')],'priority':_0x50bef['length']+_0x5760f9[_0x90c3('0x16')]+_0x1c1adf++,'VoiceExtensionId':_0x58c0f0[_0x90c3('0x17')]});}else{_0x421803[_0x90c3('0x11')]({'type':_0x58c0f0['type'],'app':_0x90c3('0x1d'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x58c0f0[_0x90c3('0x1c')],'exten':_0x58c0f0[_0x90c3('0x9')],'priority':_0x50bef['length']+_0x5760f9[_0x90c3('0x16')]+_0x1c1adf++,'VoiceExtensionId':_0x58c0f0['VoiceExtensionId']});}}if(_0x58c0f0[_0x90c3('0xd')](_0x90c3('0x2d'))){if(_0x4be865[_0x90c3('0x2e')](_0x58c0f0[_0x90c3('0x2f')][_0x90c3('0x26')]())>=0x0&&_0x58c0f0[_0x90c3('0x30')]!==_0x90c3('0x31')){if(_0x58c0f0['answer']){_0x421803[_0x90c3('0x11')]({'type':_0x58c0f0[_0x90c3('0x15')],'app':_0x90c3('0x1d'),'appdata':_0x90c3('0x32'),'context':_0x58c0f0[_0x90c3('0x1c')],'exten':_0x58c0f0[_0x90c3('0x9')],'priority':_0x50bef[_0x90c3('0x2b')]+_0x5760f9[_0x90c3('0x16')]+_0x1c1adf++,'VoiceExtensionId':_0x58c0f0[_0x90c3('0x17')]});_0x421803[_0x90c3('0x11')]({'type':_0x58c0f0[_0x90c3('0x15')],'app':_0x90c3('0x12'),'appdata':_0x90c3('0x33'),'context':_0x58c0f0[_0x90c3('0x1c')],'exten':_0x58c0f0[_0x90c3('0x9')],'priority':_0x50bef[_0x90c3('0x2b')]+_0x5760f9[_0x90c3('0x16')]+_0x1c1adf++,'VoiceExtensionId':_0x58c0f0['VoiceExtensionId']});}else{_0x421803[_0x90c3('0x11')]({'type':_0x58c0f0[_0x90c3('0x15')],'app':_0x90c3('0x1d'),'appdata':_0x90c3('0x34'),'context':_0x58c0f0[_0x90c3('0x1c')],'exten':_0x58c0f0[_0x90c3('0x9')],'priority':_0x50bef['length']+_0x5760f9[_0x90c3('0x16')]+_0x1c1adf++,'VoiceExtensionId':_0x58c0f0[_0x90c3('0x17')]});_0x421803[_0x90c3('0x11')]({'type':_0x58c0f0[_0x90c3('0x15')],'app':_0x90c3('0x12'),'appdata':_0x90c3('0x35'),'context':_0x58c0f0[_0x90c3('0x1c')],'exten':_0x58c0f0[_0x90c3('0x9')],'priority':_0x50bef[_0x90c3('0x2b')]+_0x5760f9[_0x90c3('0x16')]+_0x1c1adf++,'VoiceExtensionId':_0x58c0f0[_0x90c3('0x17')]});}}}for(var _0x1e6373=0x0;_0x1e6373<_0x50bef[_0x90c3('0x2b')];_0x1e6373+=0x1){var _0x390b08=_0x5760f9[_0x90c3('0x16')]+_0x50bef[_0x90c3('0x2b')];var _0x7f1467=_0x1e6373===_0x50bef[_0x90c3('0x2b')]-0x1?_0x5760f9[_0x90c3('0x16')]+_0x421803[_0x90c3('0x2b')]+_0x50e1f0['length']+0x2:_0x5760f9[_0x90c3('0x16')]+_0x1e6373+0x1;_0x421803['splice'](_0x1e6373,0x0,{'type':_0x58c0f0['type'],'app':_0x90c3('0x36'),'appdata':_0x50bef[_0x1e6373]+'?'+_0x58c0f0[_0x90c3('0x1c')]+_0x90c3('0x37')+_0x390b08+':'+_0x58c0f0[_0x90c3('0x1c')]+_0x90c3('0x37')+_0x7f1467,'exten':_0x58c0f0[_0x90c3('0x9')],'context':_0x58c0f0[_0x90c3('0x1c')],'priority':_0x5760f9[_0x90c3('0x16')]+_0x1e6373,'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]});}_0x58c0f0[_0x90c3('0x16')]=_0x421803[_0x90c3('0x2b')]?_[_0x90c3('0x38')](_0x421803)[_0x90c3('0x16')]+0x1:_0x5760f9[_0x90c3('0x16')];_0x5760f9[_0x90c3('0x16')]=(_0x50e1f0['length']?_[_0x90c3('0x38')](_0x50e1f0)[_0x90c3('0x16')]:_0x58c0f0[_0x90c3('0x16')])+0x1;_0x5760f9[_0x90c3('0x10')]=_[_0x90c3('0x39')](_0x5760f9[_0x90c3('0x10')],_0x421803,[_0x58c0f0],_0x50e1f0);}_0x5760f9[_0x90c3('0x10')]['push']({'type':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x15')],'app':_0x90c3('0x3a'),'exten':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x9')],'context':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x1c')],'priority':_0x5760f9[_0x90c3('0x16')],'VoiceExtensionId':_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]});_0x13f5dd['push'](_0x1fdf57[_0x527ae0][0x0][_0x90c3('0x17')]);_0x1992a8=_['concat'](_0x1992a8,_0x5760f9['extensions']);}}return _0x4ad325[_0x90c3('0x3b')](function(_0x2a0646){return _0x4ad325[_0x90c3('0x2')]['VoiceExtension'][_0x90c3('0x3c')]({'where':{'VoiceExtensionId':{'$in':_0x13f5dd}},'transaction':_0x2a0646})[_0x90c3('0xa')](function(_0x463209){return _0x4ad325[_0x90c3('0x2')][_0x90c3('0x6')][_0x90c3('0x3d')](_['sortBy'](_0x1992a8,_0x90c3('0x16')),{'transaction':_0x2a0646});});});})[_0x90c3('0x3e')](function(_0xf5891e){console[_0x90c3('0x3f')](_0xf5891e);});}exports[_0x90c3('0x40')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index eded596..6434891 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 _0xbaf0=['YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','into','phone','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','fromQuery','cm_contacts','str','cm_hopper_final','\x20=\x20?','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','CmList','Lists','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','onlyIfOpen','catch','all','BlackLists','get','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','duplicate','pause','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','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','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate'];(function(_0xfcb7b9,_0x3cd94d){var _0x343364=function(_0x462d56){while(--_0x462d56){_0xfcb7b9['push'](_0xfcb7b9['shift']());}};_0x343364(++_0x3cd94d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xbaf0[_0x432682];return _0x463d05;};'use strict';var BPromise=require('bluebird');var util=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var fs=require('fs');var squel=require(_0x0baf('0x2'));var Papa=require(_0x0baf('0x3'));var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));config[_0x0baf('0x8')]=_[_0x0baf('0x9')](config[_0x0baf('0x8')],{'host':_0x0baf('0xa'),'port':0x18eb});var socket=require(_0x0baf('0xb'))(new Redis(config[_0x0baf('0x8')]));require(_0x0baf('0xc'))['register'](socket);try{if(!process[_0x0baf('0xd')][0x2]||process['argv'][0x2]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x2]===_0x0baf('0xf')){throw new Error(_0x0baf('0x10'));}var FILEPATH=process[_0x0baf('0xd')][0x2];if(!process[_0x0baf('0xd')][0x3]||process[_0x0baf('0xd')][0x3]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x3]===_0x0baf('0xf')||!process[_0x0baf('0xd')][0x4]||process['argv'][0x4]==='undefined'||process[_0x0baf('0xd')][0x4]===_0x0baf('0xf')){throw new Error(_0x0baf('0x11'));}var FIELDS=_[_0x0baf('0x12')](process['argv'][0x3][_0x0baf('0x13')](','),process['argv'][0x4][_0x0baf('0x13')](','));if(!process[_0x0baf('0xd')][0x5]||process[_0x0baf('0xd')][0x5]===_0x0baf('0xe')||process[_0x0baf('0xd')][0x5]===_0x0baf('0xf')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x0baf('0xd')][0x6]&&process[_0x0baf('0xd')][0x6]!==_0x0baf('0xe')&&process[_0x0baf('0xd')][0x6]!==_0x0baf('0xf')?process[_0x0baf('0xd')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x0baf('0xd')][0x7]!==_0x0baf('0xe')&&process[_0x0baf('0xd')][0x7]!==_0x0baf('0xf')?process[_0x0baf('0xd')][0x7]:null;if(!process[_0x0baf('0xd')][0x8]||process['argv'][0x8]==='undefined'||process[_0x0baf('0xd')][0x8]===_0x0baf('0xf')){throw new Error(_0x0baf('0x14'));}var SOCKET_TIMESTAMP=process[_0x0baf('0xd')][0x8];}catch(_0x1fa92b){logger[_0x0baf('0x15')](_0x1fa92b);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(_0x210cd8,_0x636a13,_0x2c42e2,_0x15a2c3){var _0x54f2fa={'message':_0x636a13};_0x54f2fa[_0x210cd8]=!![];if(_0x2c42e2){_0x54f2fa[_0x0baf('0x16')]=_0x2c42e2;}if(_0x15a2c3){_0x54f2fa['index']=_0x15a2c3;}return _0x54f2fa;}function isEmail(_0xf6c158){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'](_0xf6c158);}function checkRow(_0x4de74c,_0x2ef0aa,_0x48a0e9){return new BPromise(function(_0x4be1b9,_0x47c4b){if(_[_0x0baf('0x17')](_0x4de74c)){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x18'),null,_0x48a0e9));}if(_0x4de74c[_0x0baf('0x19')]&&_0x4de74c['errors'][_0x0baf('0x1a')]){var _0x4681c5=_[_0x0baf('0x1b')](_0x4de74c[_0x0baf('0x19')],_0x0baf('0x1c'))[_0x0baf('0x1d')](';');return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x4681c5,null,_0x48a0e9));}var _0x549fd0={};for(var _0x1590b4 in FIELDS){if(FIELDS[_0x0baf('0x1e')](_0x1590b4)&&FIELDS[_0x1590b4]){_0x549fd0[_0x1590b4]=_0x4de74c[_0x0baf('0x1f')][0x0][FIELDS[_0x1590b4]]||_0x4de74c[_0x0baf('0x1f')][0x0]['\ufeff'+FIELDS[_0x1590b4]];}}if(!_0x549fd0['firstName']){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x20'),null,_0x48a0e9));}if(!_0x549fd0['phone']){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x21'),null,_0x48a0e9));}if(_0x549fd0[_0x0baf('0x22')]){var _0xb4dbb1=moment(_0x549fd0[_0x0baf('0x22')],_0x0baf('0x23'));if(!_0xb4dbb1[_0x0baf('0x24')]()){return _0x47c4b(handleCheckRowError('error',_0x0baf('0x25'),null,_0x48a0e9));}}if(_0x549fd0[_0x0baf('0x26')]){if(!isEmail(_0x549fd0[_0x0baf('0x26')])){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x27'),null,_0x48a0e9));}}_0x549fd0[_0x0baf('0x28')]=LISTID;_0x549fd0[_0x0baf('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0baf('0x1a')]&&_0x2ef0aa){var _0x59431b={};for(var _0x3ded64=0x0,_0x2adfd7=DUPLICATES[_0x0baf('0x1a')];_0x3ded64<_0x2adfd7;_0x3ded64+=0x1){_0x59431b[DUPLICATES[_0x3ded64]]=_0x549fd0[DUPLICATES[_0x3ded64]];}var _0x45294a=_[_0x0baf('0x2a')](_0x2ef0aa,_0x59431b);if(_0x45294a){return _0x47c4b(handleCheckRowError('duplicate',_0x0baf('0x2b'),_0x45294a,_0x48a0e9));}}return db['CmContact'][_0x0baf('0x2c')](_0x549fd0,{'raw':!![],'hooks':![],'fields':_[_0x0baf('0x2d')](_0x549fd0)})[_0x0baf('0x2e')](function(_0x3d65f2){if(DUPLICATES&&DUPLICATES['length']&&_0x2ef0aa){_0x2ef0aa[_0x0baf('0x2f')](_[_0x0baf('0x30')](_0x549fd0,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3d65f2['id'];return _0x4be1b9();})['catch'](function(_0x23d890){return _0x47c4b(handleCheckRowError(_0x0baf('0x15'),_0x0baf('0x31')+(_0x23d890[_0x0baf('0x1c')]||JSON[_0x0baf('0x32')](_0x23d890)),null,_0x48a0e9));});});}function checkHopper(){function _0x1b0991(){return function(_0xe03d82){logger[_0x0baf('0x15')]('cmContact',_0x0baf('0x33'),util[_0x0baf('0x34')](_0xe03d82,{'showHidden':![],'depth':null}));};}var _0x5b991f=function(_0x32c022,_0x57783c){var _0x5c545f=squel[_0x0baf('0x35')]()[_0x0baf('0x36')]('cm_hopper')['fromQuery']([_0x0baf('0x37'),_0x0baf('0x38'),_0x0baf('0x39'),_0x0baf('0x28'),_0x57783c,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),_0x0baf('0x37'))[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x38'))[_0x0baf('0x3d')]('id','ContactId')[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),'ListId')[_0x0baf('0x3d')](_0x32c022['id'][_0x0baf('0x3f')](),_0x57783c)[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3a'))[_0x0baf('0x3d')]('NOW()',_0x0baf('0x3b'))[_0x0baf('0x40')]('cm_contacts')[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')](_0x0baf('0x43'),LISTID['toString']())[_0x0baf('0x41')](_0x0baf('0x44'))[_0x0baf('0x41')](_0x0baf('0x45'),squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'))[_0x0baf('0x40')](_0x0baf('0x46'))[_0x0baf('0x41')](_0x57783c+'\x20=\x20?',_0x32c022['id'][_0x0baf('0x3f')]())))[_0x0baf('0x3f')]();return _0x5c545f;};var _0x1daf1d=function(_0x339aff,_0x22207a){var _0x55f4f8=squel[_0x0baf('0x35')]()[_0x0baf('0x36')](_0x0baf('0x46'))[_0x0baf('0x47')]([_0x0baf('0x37'),'scheduledAt',_0x0baf('0x39'),_0x0baf('0x28'),_0x22207a,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),'phone')[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x38'))['field']('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),_0x0baf('0x28'))[_0x0baf('0x3d')](_0x339aff['id'][_0x0baf('0x3f')](),_0x22207a)[_0x0baf('0x3d')]('NOW()',_0x0baf('0x3a'))[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')](_0x0baf('0x43'),LISTID[_0x0baf('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44'))[_0x0baf('0x41')](_0x0baf('0x45'),squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')]('calleridnum')[_0x0baf('0x40')](_0x0baf('0x4a'))[_0x0baf('0x41')](_0x22207a+_0x0baf('0x4b'),_0x339aff['id'][_0x0baf('0x3f')]()))[_0x0baf('0x41')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0baf('0x3c')]()['field'](_0x0baf('0x37'))['from'](_0x0baf('0x46'))['where'](_0x22207a+_0x0baf('0x4b'),_0x339aff['id']['toString']())))[_0x0baf('0x3f')]();return _0x55f4f8;};function _0xcf7b8d(_0x411c1f,_0x4520d1){var _0x42a68b=squel['insert']()[_0x0baf('0x36')](_0x0baf('0x46'))[_0x0baf('0x47')]([_0x0baf('0x37'),_0x0baf('0x38'),_0x0baf('0x39'),'ListId',_0x4520d1,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()[_0x0baf('0x3d')](_0x0baf('0x37'),_0x0baf('0x37'))[_0x0baf('0x3d')]('NOW()','scheduledAt')[_0x0baf('0x3d')]('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),_0x0baf('0x28'))[_0x0baf('0x3d')](_0x411c1f['id'][_0x0baf('0x3f')](),_0x4520d1)[_0x0baf('0x3d')](_0x0baf('0x3e'),'createdAt')[_0x0baf('0x3d')](_0x0baf('0x3e'),_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))['where'](_0x0baf('0x43'),LISTID[_0x0baf('0x3f')]())[_0x0baf('0x41')](_0x0baf('0x4c'),squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44')))[_0x0baf('0x3f')]();return _0x42a68b;}function _0x498405(_0x178495,_0x5dc434){var _0x3c00e7=squel['insert']()['into'](_0x0baf('0x4d'))['fromQuery']([_0x0baf('0x37'),_0x0baf('0x39'),'ListId',_0x5dc434,_0x0baf('0x3a'),_0x0baf('0x3b')],squel[_0x0baf('0x3c')]()['field']('phone',_0x0baf('0x37'))[_0x0baf('0x3d')]('id',_0x0baf('0x39'))[_0x0baf('0x3d')](LISTID[_0x0baf('0x3f')](),'ListId')[_0x0baf('0x3d')](_0x178495['id']['toString'](),_0x5dc434)['field']('NOW()',_0x0baf('0x3a'))['field']('NOW()',_0x0baf('0x3b'))[_0x0baf('0x40')](_0x0baf('0x48'))[_0x0baf('0x41')](_0x0baf('0x42'))[_0x0baf('0x41')]('ListId\x20=\x20?',LISTID[_0x0baf('0x3f')]())[_0x0baf('0x41')](_0x0baf('0x4c'),squel[_0x0baf('0x49')](hopperContacts))[_0x0baf('0x41')](_0x0baf('0x44')))['toString']();return _0x3c00e7;}return db[_0x0baf('0x4e')][_0x0baf('0x4f')]({'where':{'type':_0x0baf('0x50')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x0baf('0x51')],'as':_0x0baf('0x52'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x2c20fe){var _0x125906=[];if(_0x2c20fe){var _0x27a959;for(var _0x4cc046=0x0,_0x5874cc;_0x4cc046<_0x2c20fe['length'];_0x4cc046+=0x1){_0x5874cc=_0x2c20fe[_0x4cc046]['get']({'plain':!![]});switch(_0x5874cc[_0x0baf('0x53')]){case _0x0baf('0x54'):_0x125906[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x1daf1d(_0x5874cc,_0x0baf('0x57')))['then'](function(){})['catch'](_0x1b0991()));break;case _0x0baf('0x58'):_0x125906['push'](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x5b991f(_0x5874cc,'VoiceQueueId'))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));break;default:_0x125906[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0xcf7b8d(_0x5874cc,_0x0baf('0x57')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}}return _0x125906;})[_0x0baf('0x5a')]()['then'](function(){return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0baf('0x5b'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x333b07){var _0x20a514=[];if(_0x333b07){var _0x5093f5;for(var _0x1be7f2=0x0,_0x410f6c;_0x1be7f2<_0x333b07['length'];_0x1be7f2+=0x1){_0x410f6c=_0x333b07[_0x1be7f2]['get']({'plain':!![]});_0x20a514[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x498405(_0x410f6c,_0x0baf('0x57')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}return _0x20a514;})[_0x0baf('0x5a')]();})[_0x0baf('0x2e')](function(){return db['Campaign'][_0x0baf('0x4f')]({'attributes':['id',_0x0baf('0x53')],'include':[{'model':db['CmList'],'as':_0x0baf('0x52'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x538f24){var _0x97d385=[];if(_0x538f24){for(var _0x4043d5=0x0,_0x421ca0;_0x4043d5<_0x538f24[_0x0baf('0x1a')];_0x4043d5+=0x1){_0x421ca0=_0x538f24[_0x4043d5][_0x0baf('0x5c')]({'plain':!![]});switch(_0x421ca0['dialCheckDuplicateType']){case'always':_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')]['query'](_0x1daf1d(_0x421ca0,_0x0baf('0x5d')))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));break;case'onlyIfOpen':_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0x5b991f(_0x421ca0,'CampaignId'))[_0x0baf('0x2e')](function(){})['catch'](_0x1b0991()));break;default:_0x97d385[_0x0baf('0x2f')](db[_0x0baf('0x55')][_0x0baf('0x56')](_0xcf7b8d(_0x421ca0,_0x0baf('0x5d')))[_0x0baf('0x2e')](function(){})['catch'](_0x1b0991()));}}}return _0x97d385;})[_0x0baf('0x5a')]();})[_0x0baf('0x2e')](function(){return db['Campaign'][_0x0baf('0x4f')]({'attributes':['id'],'include':[{'model':db[_0x0baf('0x51')],'as':_0x0baf('0x5b'),'where':{'id':LISTID}}]})[_0x0baf('0x2e')](function(_0x1cbbcc){var _0x250df2=[];if(_0x1cbbcc){for(var _0xa4fd1b=0x0,_0x1cda78;_0xa4fd1b<_0x1cbbcc[_0x0baf('0x1a')];_0xa4fd1b+=0x1){_0x1cda78=_0x1cbbcc[_0xa4fd1b][_0x0baf('0x5c')]({'plain':!![]});_0x250df2[_0x0baf('0x2f')](db[_0x0baf('0x55')]['query'](_0x498405(_0x1cda78,'CampaignId'))[_0x0baf('0x2e')](function(){})[_0x0baf('0x59')](_0x1b0991()));}}return _0x250df2;})[_0x0baf('0x5a')]();})['catch'](function(_0x507783){logger[_0x0baf('0x15')](_0x0baf('0x5e'),_0x0baf('0x5f'),_0x507783[_0x0baf('0x1c')]);});}var processPromises=function(_0x2dcdfe){return BPromise[_0x0baf('0x5a')](promises)[_0x0baf('0x2e')](function(_0xa2d315){})[_0x0baf('0x59')](function(_0x4e8e85){logger[_0x0baf('0x15')](_0x0baf('0x60'),JSON[_0x0baf('0x32')](_0x4e8e85));})[_0x0baf('0x61')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2dcdfe){return _0x2dcdfe['resume']();}});};var endCsv=function(){return BPromise[_0x0baf('0x62')]()[_0x0baf('0x2e')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit'](_0x0baf('0x63')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0baf('0x64')](FILEPATH);}catch(_0x52e0c4){logger[_0x0baf('0x15')](_0x0baf('0x65'),JSON[_0x0baf('0x32')](_0x52e0c4));}finally{process[_0x0baf('0x66')](0x0);}});};process['on'](_0x0baf('0x67'),function(){logger[_0x0baf('0x68')](_0x0baf('0x69'));endCsv();});function main(){return BPromise[_0x0baf('0x62')]()[_0x0baf('0x2e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0baf('0x13')](',');return db[_0x0baf('0x6a')][_0x0baf('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x1ed607){var _0xd0f63b=fs[_0x0baf('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0baf('0x6c')](_0xd0f63b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3c37b4,_0x195303){total+=0x1;var _0x49d411=total;promises[_0x0baf('0x2f')](checkRow(_0x3c37b4,_0x1ed607,_0x49d411)[_0x0baf('0x2e')](function(){success+=0x1;})[_0x0baf('0x59')](function(_0x457ae8){if(_0x457ae8[_0x0baf('0x15')]){errors+=0x1;delete _0x457ae8['error'];}else if(_0x457ae8[_0x0baf('0x6d')]){duplicates+=0x1;delete _0x457ae8[_0x0baf('0x6d')];}rows[_0x0baf('0x2f')](_0x457ae8);}));if(total%0xc8===0x0){_0x195303[_0x0baf('0x6e')]();return processPromises(_0x195303);}},'complete':function(){return processPromises()[_0x0baf('0x2e')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0xb5f4e5,_0x5a2454){logger[_0x0baf('0x68')]('CSV\x20parse\x20error',JSON[_0x0baf('0x32')](_0xb5f4e5));endCsv();}});})[_0x0baf('0x59')](function(_0x1ce7bb){logger[_0x0baf('0x15')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x0baf('0x32')](_0x1ce7bb));});}main(); \ No newline at end of file +var _0x0713=['papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','fromQuery','phone','scheduledAt','updatedAt','field','NOW()','ContactId','toString','createdAt','from','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','\x20=\x20?','into','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','cm_contacts','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','push','all','CmList','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x3071('0x0'));var fs=require('fs');var squel=require(_0x3071('0x1'));var Papa=require(_0x3071('0x2'));var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));config[_0x3071('0x7')]=_[_0x3071('0x8')](config[_0x3071('0x7')],{'host':_0x3071('0x9'),'port':0x18eb});var socket=require(_0x3071('0xa'))(new Redis(config[_0x3071('0x7')]));require(_0x3071('0xb'))[_0x3071('0xc')](socket);try{if(!process[_0x3071('0xd')][0x2]||process[_0x3071('0xd')][0x2]===_0x3071('0xe')||process['argv'][0x2]===_0x3071('0xf')){throw new Error(_0x3071('0x10'));}var FILEPATH=process[_0x3071('0xd')][0x2];if(!process[_0x3071('0xd')][0x3]||process[_0x3071('0xd')][0x3]==='undefined'||process[_0x3071('0xd')][0x3]===_0x3071('0xf')||!process[_0x3071('0xd')][0x4]||process[_0x3071('0xd')][0x4]===_0x3071('0xe')||process['argv'][0x4]==='null'){throw new Error(_0x3071('0x11'));}var FIELDS=_['zipObject'](process[_0x3071('0xd')][0x3][_0x3071('0x12')](','),process['argv'][0x4][_0x3071('0x12')](','));if(!process['argv'][0x5]||process[_0x3071('0xd')][0x5]===_0x3071('0xe')||process[_0x3071('0xd')][0x5]===_0x3071('0xf')){throw new Error(_0x3071('0x13'));}var LISTID=process[_0x3071('0xd')][0x5];var COMPANYID=process[_0x3071('0xd')][0x6]&&process[_0x3071('0xd')][0x6]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x6]!=='null'?process[_0x3071('0xd')][0x6]:null;var DUPLICATES=process[_0x3071('0xd')][0x7]&&process[_0x3071('0xd')][0x7]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x7]!==_0x3071('0xf')?process[_0x3071('0xd')][0x7]:null;if(!process[_0x3071('0xd')][0x8]||process['argv'][0x8]===_0x3071('0xe')||process[_0x3071('0xd')][0x8]===_0x3071('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x3071('0xd')][0x8];}catch(_0x5cd80d){logger[_0x3071('0x14')](_0x5cd80d);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(_0x43128c,_0x3762d8,_0x457b57,_0x33090c){var _0x34c50e={'message':_0x3762d8};_0x34c50e[_0x43128c]=!![];if(_0x457b57){_0x34c50e[_0x3071('0x15')]=_0x457b57;}if(_0x33090c){_0x34c50e[_0x3071('0x16')]=_0x33090c;}return _0x34c50e;}function isEmail(_0x542646){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'](_0x542646);}function checkRow(_0x2ce48a,_0xb05b1d,_0x412652){return new BPromise(function(_0x13df9f,_0x2793ef){if(_[_0x3071('0x17')](_0x2ce48a)){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x18'),null,_0x412652));}if(_0x2ce48a[_0x3071('0x19')]&&_0x2ce48a['errors'][_0x3071('0x1a')]){var _0x3f1e6e=_[_0x3071('0x1b')](_0x2ce48a['errors'],_0x3071('0x1c'))[_0x3071('0x1d')](';');return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3f1e6e,null,_0x412652));}var _0x950fde={};for(var _0x3fa3b8 in FIELDS){if(FIELDS[_0x3071('0x1e')](_0x3fa3b8)&&FIELDS[_0x3fa3b8]){_0x950fde[_0x3fa3b8]=_0x2ce48a[_0x3071('0x1f')][0x0][FIELDS[_0x3fa3b8]]||_0x2ce48a[_0x3071('0x1f')][0x0]['\ufeff'+FIELDS[_0x3fa3b8]];}}if(!_0x950fde[_0x3071('0x20')]){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x21'),null,_0x412652));}if(!_0x950fde['phone']){return _0x2793ef(handleCheckRowError('error',_0x3071('0x22'),null,_0x412652));}if(_0x950fde[_0x3071('0x23')]){var _0x6ddf96=moment(_0x950fde[_0x3071('0x23')],_0x3071('0x24'));if(!_0x6ddf96[_0x3071('0x25')]()){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x26'),null,_0x412652));}}if(_0x950fde['email']){if(!isEmail(_0x950fde['email'])){return _0x2793ef(handleCheckRowError('error',_0x3071('0x27'),null,_0x412652));}}_0x950fde[_0x3071('0x28')]=LISTID;_0x950fde['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){var _0x28747d={};for(var _0x25250e=0x0,_0x13ae2c=DUPLICATES['length'];_0x25250e<_0x13ae2c;_0x25250e+=0x1){_0x28747d[DUPLICATES[_0x25250e]]=_0x950fde[DUPLICATES[_0x25250e]];}var _0x218a82=_[_0x3071('0x29')](_0xb05b1d,_0x28747d);if(_0x218a82){return _0x2793ef(handleCheckRowError(_0x3071('0x2a'),_0x3071('0x2b'),_0x218a82,_0x412652));}}return db[_0x3071('0x2c')][_0x3071('0x2d')](_0x950fde,{'raw':!![],'hooks':![],'fields':_[_0x3071('0x2e')](_0x950fde)})[_0x3071('0x2f')](function(_0x596cc3){if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){_0xb05b1d['push'](_['pick'](_0x950fde,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x596cc3['id'];return _0x13df9f();})[_0x3071('0x30')](function(_0xa3a7ae){return _0x2793ef(handleCheckRowError('error',_0x3071('0x31')+(_0xa3a7ae[_0x3071('0x1c')]||JSON[_0x3071('0x32')](_0xa3a7ae)),null,_0x412652));});});}function checkHopper(){function _0x14ac42(){return function(_0xc60572){logger[_0x3071('0x14')]('cmContact',_0x3071('0x33'),util[_0x3071('0x34')](_0xc60572,{'showHidden':![],'depth':null}));};}var _0x4ce6d4=function(_0x44ad05,_0x5b1392){var _0x28f855=squel[_0x3071('0x35')]()['into']('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),'ContactId',_0x3071('0x28'),_0x5b1392,'createdAt',_0x3071('0x39')],squel['select']()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x44ad05['id'][_0x3071('0x3d')](),_0x5b1392)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),'updatedAt')[_0x3071('0x3f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x3071('0x40'),LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x5b1392+_0x3071('0x46'),_0x44ad05['id'][_0x3071('0x3d')]())))['toString']();return _0x28f855;};var _0x5c93c7=function(_0x1721d0,_0x3c2f5e){var _0x1fe5e0=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')](['phone',_0x3071('0x38'),'ContactId','ListId',_0x3c2f5e,_0x3071('0x3e'),'updatedAt'],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')[_0x3071('0x3a')]('id','ContactId')[_0x3071('0x3a')](LISTID['toString'](),_0x3071('0x28'))[_0x3071('0x3a')](_0x1721d0['id']['toString'](),_0x3c2f5e)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')](_0x3071('0x40'),LISTID['toString']())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x4b'))[_0x3071('0x3f')](_0x3071('0x4c'))[_0x3071('0x41')](_0x3c2f5e+_0x3071('0x46'),_0x1721d0['id'][_0x3071('0x3d')]()))[_0x3071('0x41')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x3c2f5e+'\x20=\x20?',_0x1721d0['id'][_0x3071('0x3d')]())))[_0x3071('0x3d')]();return _0x1fe5e0;};function _0x5bc69e(_0x4b8ec0,_0x1b89ea){var _0x15abc4=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),_0x3071('0x3c'),_0x3071('0x28'),_0x1b89ea,'createdAt',_0x3071('0x39')],squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))['field'](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x4b8ec0['id'][_0x3071('0x3d')](),_0x1b89ea)[_0x3071('0x3a')]('NOW()',_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')]('ListId\x20=\x20?',LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))[_0x3071('0x3d')]();return _0x15abc4;}function _0x2e39ff(_0x3b47e8,_0x5cb3b3){var _0x5d1316=squel[_0x3071('0x35')]()[_0x3071('0x47')](_0x3071('0x4d'))[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x3c'),_0x3071('0x28'),_0x5cb3b3,_0x3071('0x3e'),_0x3071('0x39')],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')]('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))[_0x3071('0x3a')](_0x3b47e8['id']['toString'](),_0x5cb3b3)[_0x3071('0x3a')](_0x3071('0x3b'),'createdAt')['field'](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')](_0x3071('0x4e'))['where']('deletedAt\x20IS\x20NULL')[_0x3071('0x41')]('ListId\x20=\x20?',LISTID['toString']())['where']('id\x20IN\x20?',squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))['toString']();return _0x5d1316;}return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id',_0x3071('0x52')],'include':[{'model':db['CmList'],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x588406){var _0x1b35d3=[];if(_0x588406){var _0x29ee70;for(var _0x388cd1=0x0,_0x40c258;_0x388cd1<_0x588406[_0x3071('0x1a')];_0x388cd1+=0x1){_0x40c258=_0x588406[_0x388cd1][_0x3071('0x54')]({'plain':!![]});switch(_0x40c258[_0x3071('0x52')]){case'always':_0x1b35d3['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x40c258,_0x3071('0x57')))['then'](function(){})['catch'](_0x14ac42()));break;case _0x3071('0x58'):_0x1b35d3[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x40c258,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x1b35d3[_0x3071('0x59')](db['sequelize'][_0x3071('0x56')](_0x5bc69e(_0x40c258,'VoiceQueueId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x1b35d3;})[_0x3071('0x5a')]()[_0x3071('0x2f')](function(){return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x138a94){var _0x1da477=[];if(_0x138a94){var _0x4f06c0;for(var _0x2a2e7a=0x0,_0x22ec7b;_0x2a2e7a<_0x138a94[_0x3071('0x1a')];_0x2a2e7a+=0x1){_0x22ec7b=_0x138a94[_0x2a2e7a]['get']({'plain':!![]});_0x1da477['push'](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x22ec7b,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}return _0x1da477;})[_0x3071('0x5a')]();})[_0x3071('0x2f')](function(){return db[_0x3071('0x5c')][_0x3071('0x50')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x3cc937){var _0x98d0fb=[];if(_0x3cc937){for(var _0x1fea60=0x0,_0x435dcb;_0x1fea60<_0x3cc937[_0x3071('0x1a')];_0x1fea60+=0x1){_0x435dcb=_0x3cc937[_0x1fea60]['get']({'plain':!![]});switch(_0x435dcb[_0x3071('0x52')]){case'always':_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;case _0x3071('0x58'):_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x435dcb,'CampaignId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x98d0fb['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5bc69e(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x98d0fb;})['all']();})['then'](function(){return db[_0x3071('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x5e'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x136278){var _0x22783b=[];if(_0x136278){for(var _0x2f31b7=0x0,_0x568386;_0x2f31b7<_0x136278[_0x3071('0x1a')];_0x2f31b7+=0x1){_0x568386=_0x136278[_0x2f31b7][_0x3071('0x54')]({'plain':!![]});_0x22783b[_0x3071('0x59')](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x568386,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})['catch'](_0x14ac42()));}}return _0x22783b;})[_0x3071('0x5a')]();})[_0x3071('0x30')](function(_0x391887){logger[_0x3071('0x14')](_0x3071('0x5f'),'generalCheckHopper',_0x391887[_0x3071('0x1c')]);});}var processPromises=function(_0x479fe7){return BPromise[_0x3071('0x5a')](promises)[_0x3071('0x2f')](function(_0x39060f){})[_0x3071('0x30')](function(_0x1120ec){logger[_0x3071('0x14')](_0x3071('0x60'),JSON[_0x3071('0x32')](_0x1120ec));})['finally'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x479fe7){return _0x479fe7[_0x3071('0x63')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x3071('0x2f')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3071('0x64')](FILEPATH);}catch(_0x5e0cbd){logger[_0x3071('0x14')](_0x3071('0x65'),JSON[_0x3071('0x32')](_0x5e0cbd));}finally{process[_0x3071('0x66')](0x0);}});};process['on'](_0x3071('0x67'),function(){logger[_0x3071('0x68')](_0x3071('0x69'));endCsv();});function main(){return BPromise[_0x3071('0x6a')]()[_0x3071('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x3071('0x2c')][_0x3071('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3071('0x2f')](function(_0x5b2830){var _0x561030=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x561030,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4eb9e2,_0x8c77b7){total+=0x1;var _0x44b4c9=total;promises['push'](checkRow(_0x4eb9e2,_0x5b2830,_0x44b4c9)[_0x3071('0x2f')](function(){success+=0x1;})[_0x3071('0x30')](function(_0x1f61df){if(_0x1f61df['error']){errors+=0x1;delete _0x1f61df['error'];}else if(_0x1f61df[_0x3071('0x2a')]){duplicates+=0x1;delete _0x1f61df[_0x3071('0x2a')];}rows[_0x3071('0x59')](_0x1f61df);}));if(total%0xc8===0x0){_0x8c77b7[_0x3071('0x6b')]();return processPromises(_0x8c77b7);}},'complete':function(){return processPromises()[_0x3071('0x2f')](function(){logger[_0x3071('0x68')](_0x3071('0x6c'));endCsv();});},'error':function(_0x5eb60d,_0x58b62c){logger[_0x3071('0x68')](_0x3071('0x6d'),JSON[_0x3071('0x32')](_0x5eb60d));endCsv();}});})[_0x3071('0x30')](function(_0x5a3b64){logger[_0x3071('0x14')](_0x3071('0x6e'),JSON[_0x3071('0x32')](_0x5a3b64));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 41abfb1..e4f633e 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 _0x7a54=['.CmListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.priority','UserId','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','spread','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','query','length','all','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','header',',utcOffset','writeFileSync','parse','createReadStream','data','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','then','format','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_lists','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','localhost','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.updatedAt','insert','into','cm_hopper_black','fields','cm_contacts.ListId\x20=\x20'];(function(_0x305b20,_0x5e57e9){var _0x26d64a=function(_0x2e17f0){while(--_0x2e17f0){_0x305b20['push'](_0x305b20['shift']());}};_0x26d64a(++_0x5e57e9);}(_0x7a54,0x106));var _0x47a5=function(_0x5d5828,_0x3a5505){_0x5d5828=_0x5d5828-0x0;var _0x255c8b=_0x7a54[_0x5d5828];return _0x255c8b;};'use strict';var fs=require('fs');var path=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var Papa=require(_0x47a5('0x2'));var util=require('util');var BPromise=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var squel=require('squel');var Redis=require(_0x47a5('0x5'));var db=require(_0x47a5('0x6'))['db'];var config=require(_0x47a5('0x7'));var shared=require(_0x47a5('0x8'));var logger=require(_0x47a5('0x9'))('import');config[_0x47a5('0xa')]=_['defaults'](config[_0x47a5('0xa')],{'host':_0x47a5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x582352){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))*$/[_0x47a5('0xc')](_0x582352);}function selectNotIn(_0x2baee7,_0x5e31dd,_0x2eb0dd,_0x49e844,_0x5de6d7){return squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0xf'))[_0x47a5('0x10')](_0x49e844)[_0x47a5('0x11')](_0x5e31dd,null,_0x5e31dd+_0x47a5('0x12')+_0x49e844+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x49e844+'.'+_0x2eb0dd+'\x20=\x20'+_0x2baee7+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x5e31dd+_0x47a5('0x14')+_0x5de6d7[_0x47a5('0x11')]()+')');}function insertCmHopper(_0x711793,_0x139f25,_0x620ee9,_0x3c6c46,_0x190faa){var _0x4e99a8=[_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18'),_0x139f25+'.'+_0x3c6c46,_0x47a5('0x19'),'cm_contacts.updatedAt','cm_contacts.priority',_0x47a5('0x1a'),'\x22'+_0x190faa+'\x22'];return squel['insert']()['into'](_0x47a5('0x1b'))[_0x47a5('0x1c')]([_0x47a5('0xf'),_0x47a5('0x1d'),_0x47a5('0x1e'),_0x47a5('0x1f'),_0x3c6c46,_0x47a5('0x20'),_0x47a5('0x21'),_0x47a5('0x22'),'UserId',_0x47a5('0x23')],squel[_0x47a5('0xd')]()['fields'](_0x4e99a8)[_0x47a5('0x10')](_0x139f25)[_0x47a5('0x11')](_0x47a5('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x139f25+_0x47a5('0x25'))[_0x47a5('0x11')](_0x620ee9,null,_0x620ee9+_0x47a5('0x12')+_0x139f25+'.'+_0x3c6c46)[_0x47a5('0x13')](_0x139f25+'.CmListId\x20=\x20?',_0x711793)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)['where'](_0x47a5('0x27'),selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))[_0x47a5('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,'cm_hopper',[_0x47a5('0x28')])))['toString']();}function insertCmHopperBlack(_0x1ea9c8,_0x5b6c4e,_0x23cb77,_0x378208){var _0x36ad34=[_0x47a5('0x15'),_0x47a5('0x17'),_0x47a5('0x18'),_0x5b6c4e+'.'+_0x378208,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x47a5('0x2d'))[_0x47a5('0x1c')]([_0x47a5('0xf'),'ContactId',_0x47a5('0x1f'),_0x378208,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x36ad34)['from'](_0x5b6c4e)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x5b6c4e+_0x47a5('0x25'))['join'](_0x23cb77,null,_0x23cb77+'.id\x20=\x20'+_0x5b6c4e+'.'+_0x378208)[_0x47a5('0x13')](_0x5b6c4e+_0x47a5('0x30'),_0x1ea9c8)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')]('phone')[_0x47a5('0x10')](_0x47a5('0x2d'))['where']('ListId\x20=\x20?',_0x1ea9c8)[_0x47a5('0x13')](_0x378208+'\x20=\x20?',_0x5b6c4e+'.'+_0x378208)))[_0x47a5('0x31')]();}function insertTzCmHopper(_0x87e4c9,_0xf269a8,_0x52749b,_0x18f7e9,_0x50c086,_0x53c754){var _0x65542e=['cm_contacts.phone',_0x47a5('0x32')+_0x53c754+'.offset-cm_contacts.utcOffset\x20minute)',_0x47a5('0x17'),_0x47a5('0x18'),_0xf269a8+'.'+_0x18f7e9,_0x47a5('0x19'),_0x47a5('0x2a'),_0x47a5('0x33'),_0x47a5('0x1a'),'\x22'+_0x50c086+'\x22'];var _0xee582c=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')]('cm_hopper')[_0x47a5('0x1c')]([_0x47a5('0xf'),'scheduledat',_0x47a5('0x1e'),_0x47a5('0x1f'),_0x18f7e9,_0x47a5('0x20'),'updatedAt',_0x47a5('0x22'),_0x47a5('0x34'),'recallme'],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x65542e)['from'](_0xf269a8)['join']('cm_contacts',null,_0x47a5('0x2f')+_0xf269a8+'.CmListId')[_0x47a5('0x11')](_0x52749b,null,_0x52749b+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x11')](_0x53c754,null,_0x53c754+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x13')](_0xf269a8+_0x47a5('0x30'),_0x87e4c9)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))['where'](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28')])))[_0x47a5('0x31')]();return _0xee582c;}function insertTzCmHopperBlack(_0x586f4f,_0x7de536,_0x528ef3,_0x47c7a2){var _0x55c43d=['cm_contacts.phone',_0x47a5('0x17'),'cm_contacts.ListId',_0x7de536+'.'+_0x47c7a2,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()['into'](_0x47a5('0x2d'))[_0x47a5('0x1c')](['phone','ContactId',_0x47a5('0x1f'),_0x47c7a2,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x55c43d)[_0x47a5('0x10')](_0x7de536)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x7de536+_0x47a5('0x25'))[_0x47a5('0x11')](_0x528ef3,null,_0x528ef3+_0x47a5('0x12')+_0x7de536+'.'+_0x47c7a2)[_0x47a5('0x13')](_0x7de536+_0x47a5('0x30'),_0x586f4f)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')](_0x47a5('0xf'))['from']('cm_hopper_black')[_0x47a5('0x13')]('ListId\x20=\x20?',_0x586f4f)[_0x47a5('0x13')](_0x47c7a2+_0x47a5('0x35'),_0x7de536+'.'+_0x47c7a2)))['toString']();}function insertCmContact(_0x4f62d3,_0x3d85cc,_0x52d409,_0x2d147c){var _0x1d1039=_[_0x47a5('0x36')](_[_0x47a5('0x37')](_0x2d147c),[_0x47a5('0x1f'),_0x47a5('0x38'),_0x47a5('0x20'),'updatedAt']);return squel['insert']()[_0x47a5('0x2c')](_0x47a5('0x24'))[_0x47a5('0x1c')](_0x1d1039,squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x1d1039)[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x13')]('('+_0x52d409['join'](',')+_0x47a5('0x39'),squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x52d409)['from'](_0x47a5('0x24'))['where'](_0x47a5('0x3a'),_0x4f62d3)[_0x47a5('0x13')](_0x47a5('0x3b')))[_0x47a5('0x13')]('id\x20IN\x20?',squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0x3c'),_0x47a5('0x3d'))[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x3e')](_0x52d409[_0x47a5('0x11')](','))))['toString']();}function handleStop(){logger[_0x47a5('0x3f')](_0x47a5('0x40'));stopped=!![];}function handleUncaughtException(_0x187d7e){logger[_0x47a5('0x41')](_0x187d7e[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}function handleError(_0x572233,_0x1ad6a9){stats[_0x47a5('0x44')][_0x47a5('0x45')]({'name':_0x1ad6a9['code'],'message':_0x1ad6a9[_0x47a5('0x42')],'row':_0x572233});}function handleQuery(_0x3c78b7){logger[_0x47a5('0x3f')](_0x3c78b7);return db['sequelize']['query'](_0x3c78b7)[_0x47a5('0x46')](function(_0x376e1d){results['push'](_0x376e1d);})['catch'](function(_0x6d6b2b){logger['error'](_0x6d6b2b[_0x47a5('0x42')]);});}function updateTzCampaigns(_0x5d383d){return new Promise(function(_0x482de6,_0x389ed9){var _0x46d2d3=squel['select']()[_0x47a5('0x2e')]([_0x47a5('0x47'),'campaigns.dialTimezone'])['from'](_0x47a5('0x48'))[_0x47a5('0x11')](_0x47a5('0x49'),null,_0x47a5('0x4a'))['where'](_0x47a5('0x4b')+_0x5d383d);db[_0x47a5('0x4c')][_0x47a5('0x4d')](_0x46d2d3['toString']())[_0x47a5('0x46')](function(_0x4db625){var _0x485e3c=[];for(var _0x470da6=0x0;_0x470da6<_0x4db625[_0x47a5('0x4e')];_0x470da6++){_0x485e3c[_0x47a5('0x45')](getTimezoneData(_0x4db625[_0x470da6],tmp_campaigns));}BPromise[_0x47a5('0x4f')](_0x485e3c)['then'](function(){_0x482de6({'val':0x1});});})[_0x47a5('0x50')](function(_0x5d1550){logger['error'](_0x5d1550['message']);_0x482de6({'val':0x0});});});}function updateTzVoiceQueues(_0x4f8564){return new Promise(function(_0x212d92,_0x6cd4ea){var _0x1e2bb4=squel['select']()['fields']([_0x47a5('0x51'),_0x47a5('0x52')])[_0x47a5('0x10')](_0x47a5('0x53'))[_0x47a5('0x11')]('voice_queues_has_cm_lists',null,_0x47a5('0x54'))['where'](_0x47a5('0x55')+_0x4f8564);db[_0x47a5('0x4c')]['query'](_0x1e2bb4[_0x47a5('0x31')]())[_0x47a5('0x46')](function(_0x132854){var _0x3e8274=[];for(var _0x2d6494=0x0;_0x2d6494<_0x132854[_0x47a5('0x4e')];_0x2d6494++){_0x3e8274[_0x47a5('0x45')](getTimezoneData(_0x132854[_0x2d6494],tmp_voice_queues));}BPromise[_0x47a5('0x4f')](_0x3e8274)['then'](function(){_0x212d92({'val':0x1});});})[_0x47a5('0x50')](function(_0x2a3a57){logger[_0x47a5('0x41')](_0x2a3a57[_0x47a5('0x42')]);_0x212d92({'val':0x0});});});}function getTimezoneData(_0x396cb0,_0x4bbe14){return new Promise(function(_0xbec033,_0xdfcecc){var _0x1224bc=shared[_0x47a5('0x56')];var _0x4228a3=_0x1224bc[_0x396cb0[_0x47a5('0x57')]];if(_[_0x47a5('0x58')](_0x4228a3)){_0xbec033({'ret':0x1});}else{var _0x149d34=_0x4228a3[_0x47a5('0x59')];var _0x44cb90=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x4bbe14)[_0x47a5('0x5a')]('id',_0x396cb0['id'])[_0x47a5('0x5a')](_0x47a5('0x5b'),_0x149d34)['set'](_0x47a5('0x57'),_0x396cb0[_0x47a5('0x57')])[_0x47a5('0x31')]();return db['sequelize'][_0x47a5('0x4d')](_0x44cb90)[_0x47a5('0x46')](function(_0x36c67){_0xbec033({'ret':0x1});})[_0x47a5('0x50')](function(_0x5d9822){logger[_0x47a5('0x41')](_0x5d9822['message']);_0xdfcecc({'ret':0x1});});}});}function handleTZQuery(_0x2d5ee6){logger['info'](_0x2d5ee6);return db[_0x47a5('0x4c')]['query'](_0x2d5ee6)[_0x47a5('0x46')](function(_0x2f27c3){})[_0x47a5('0x50')](function(_0x58473b){logger['error'](_0x58473b['message']);});}function main(_0x4164a3,_0x2b1303,_0xe3c0a7,_0x117510){logger['info'](_0x47a5('0x5c'),_0x4164a3,JSON[_0x47a5('0x5d')](_0x2b1303));process[_0x47a5('0x5e')](_0x47a5('0x5f'));var _0x308c9a=_0x2b1303[_0x47a5('0x60')];var _0x1155f6=_0x2b1303[_0x47a5('0x61')];var _0x4618a0=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),_0x1155f6+'.csv');hasTZ=_[_0x47a5('0x37')](_0x308c9a)['includes'](_0x47a5('0x57'));var _0x2ac30f=_[_0x47a5('0x37')](_0x308c9a)[_0x47a5('0x11')]();logger[_0x47a5('0x3f')](_0x47a5('0x64'),_0x2ac30f);if(hasTZ)_0x2ac30f+=_0x47a5('0x65');fs[_0x47a5('0x66')](_0x4618a0,_0x2ac30f+'\x0a');Papa[_0x47a5('0x67')](fs[_0x47a5('0x68')](_0x4164a3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1cfb37,_0x1f07ac){try{for(var _0x8f0035=0x0,_0x2d434c=[];_0x8f0035<_0x1cfb37[_0x47a5('0x69')]['length'];_0x8f0035++){stats['rows']+=0x1;if(_0x1cfb37['errors'][_0x8f0035]){handleError(_0x1cfb37['data'][_0x8f0035],_0x1cfb37[_0x47a5('0x44')][_0x8f0035]);}else{var _0x28b8e9=[];for(var _0x5d6916 in _0x308c9a){if(_0x308c9a[_0x47a5('0x6a')](_0x5d6916)){if(_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]]){var _0x1baa5a=_[_0x47a5('0x6b')](_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]][_0x47a5('0x6c')](/"/g,'\x27'));switch(_0x5d6916){case _0x47a5('0x1d'):var _0x1c7302=moment(_0x1baa5a,_0x47a5('0x6d'),!![]);if(_0x1c7302[_0x47a5('0x6e')]()){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x6f'));}break;case _0x47a5('0x22'):var _0x420671=parseInt(_0x1baa5a);_0x1baa5a=_['isNaN'](_0x420671)||_0x420671<0x0||_0x420671>0x4?_0x117510?0x3:0x2:_0x420671;_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');break;case _0x47a5('0x34'):var _0x17b61d=parseInt(_0x1baa5a);if(_['isNumber'](_0x17b61d)&&_[_0x47a5('0x70')](_0xe3c0a7,_0x17b61d)){_0x2d434c['push']('\x22'+_0x17b61d+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x71'));}break;case _0x47a5('0x72'):if(isEmail(_0x1baa5a)){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x73'));}break;case _0x47a5('0x74'):var _0x479a82=moment(_0x1baa5a,'YYYY-MM-DD',!![]);if(_0x479a82[_0x47a5('0x6e')]()){_0x2d434c['push']('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x75'));}break;case _0x47a5('0x57'):var _0xb16bdd=shared['timezones'];var _0x3c66e3=_0xb16bdd[_0x1baa5a];if(!_['isNil'](_0x3c66e3)){var _0x5f3a04=_0x3c66e3[_0x47a5('0x59')];_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');_0x2d434c['push']('\x22'+_0x5f3a04+'\x22');}break;default:_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}}else{switch(_0x5d6916){case _0x47a5('0x76'):case _0x47a5('0xf'):_0x28b8e9['push'](_0x5d6916+_0x47a5('0x77'));break;default:_0x2d434c['push']('\x22\x22');}}}}if(_0x28b8e9[_0x47a5('0x4e')]){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x78'),'message':_0x28b8e9['join']()});}else{fs[_0x47a5('0x79')](_0x4618a0,_0x2d434c[_0x47a5('0x11')]()+'\x0a');}_0x2d434c=[];}if(!(stats[_0x47a5('0x7a')]%0xc8)){socket['emit'](_0x47a5('0x7b')+_0x1155f6,stats);stats['errors']=[];}}if(stopped){logger[_0x47a5('0x3f')]('Abort\x20parser');_0x1f07ac[_0x47a5('0x7c')]();}}catch(_0x20d8bd){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x7d'),'message':_0x20d8bd['message']});logger[_0x47a5('0x41')](_0x47a5('0x7e'),_0x20d8bd[_0x47a5('0x42')]);}},'complete':function(){try{var _0x1bbfba=[];var _0x22d84a=[];var _0x57ac25='cm_contacts';if(_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates'][_0x47a5('0x4e')]){_0x57ac25=_0x47a5('0x80')+_0x1155f6;_0x1bbfba[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+_0x57ac25+_0x47a5('0x81'));}tmp_campaigns=_0x47a5('0x82')+_0x1155f6;tmp_voice_queues='voice_queues_'+_0x1155f6;_0x22d84a[_0x47a5('0x45')](_0x47a5('0x83')+tmp_campaigns+_0x47a5('0x84'));_0x22d84a[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x47a5('0x85')](_0x22d84a,handleTZQuery)[_0x47a5('0x86')](function(_0x48e7f3){updateTzCampaigns(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x5a0901){updateTzVoiceQueues(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x2930d9){var _0x59f010=util[_0x47a5('0x87')]('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',_0x4618a0,_0x57ac25,_0x2ac30f,_0x2b1303[_0x47a5('0x1f')],_0x2b1303['CompanyId']||null,NOW,NOW);if(_[_0x47a5('0x58')](_0x308c9a[_0x47a5('0x1d')])){_0x59f010+=',\x20scheduledAt\x20=\x20NOW()';}_0x1bbfba[_0x47a5('0x45')](_0x59f010);if(_0x2b1303['duplicates']&&_0x2b1303[_0x47a5('0x7f')][_0x47a5('0x4e')]){_0x1bbfba[_0x47a5('0x45')](insertCmContact(_0x2b1303[_0x47a5('0x1f')],_0x57ac25,_0x2b1303['duplicates'],_0x308c9a));}if(hasTZ){_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303['ListId'],'voice_queues_has_cm_lists',_0x47a5('0x53'),_0x47a5('0x88'),_0x117510,tmp_voice_queues));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x49'),'campaigns',_0x47a5('0x8a'),_0x117510,tmp_campaigns));_0x1bbfba['push'](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8b'),_0x47a5('0x48'),_0x47a5('0x8a')));}else{_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8c'),_0x47a5('0x53'),_0x47a5('0x88'),_0x117510));_0x1bbfba['push'](insertCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],'campaigns_has_cm_lists','campaigns',_0x47a5('0x8a'),_0x117510));_0x1bbfba[_0x47a5('0x45')](insertCmHopperBlack(_0x2b1303['ListId'],'campaigns_has_cm_blacklists',_0x47a5('0x48'),_0x47a5('0x8a')));}_0x1bbfba['push'](_0x47a5('0x8d')+tmp_campaigns+';');_0x1bbfba[_0x47a5('0x45')]('DROP\x20TABLE\x20'+tmp_voice_queues+';');BPromise[_0x47a5('0x85')](_0x1bbfba,handleQuery)[_0x47a5('0x86')](function(_0x109805){stats[_0x47a5('0x8e')]=!![];stats[_0x47a5('0x8f')]=_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates']['length']?results[0x2]['affectedRows']:results[0x0][_0x47a5('0x8f')];socket[_0x47a5('0x90')]('contact:import:'+_0x1155f6,stats);fs[_0x47a5('0x91')](_0x4164a3);fs[_0x47a5('0x91')](_0x4618a0);process[_0x47a5('0x43')](0x0);})[_0x47a5('0x50')](function(_0xcdbfd7){logger['error'](_0xcdbfd7[_0x47a5('0x42')]);process['exit'](0x1);});})['catch'](function(_0x5db0ed){logger[_0x47a5('0x41')](_0x5db0ed['message']);process[_0x47a5('0x43')](0x1);});});});}catch(_0xf3edc8){logger[_0x47a5('0x41')]('complete',_0xf3edc8[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}},'error':function(_0x35bf37,_0x121750,_0x392ad7,_0x581a87){throw new Error(_0x581a87);}});}function validate(){if(process[_0x47a5('0x92')]&&process[_0x47a5('0x92')]['length']<0x4){throw new Error(_0x47a5('0x93'));}var _0x419870=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),process[_0x47a5('0x92')][0x2]);if(!fs['existsSync'](_0x419870)){throw new Error(_0x47a5('0x94'));}var _0x2e418d={};try{_0x2e418d=JSON['parse'](process[_0x47a5('0x92')][0x3]);if(!_0x2e418d[_0x47a5('0x60')]){throw new Error(_0x47a5('0x95'));}if(!_0x2e418d[_0x47a5('0x60')]['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0x2e418d['binding']['firstName']){throw new Error(_0x47a5('0x96'));}var _0x27793e=0x0;if(_0x2e418d[_0x47a5('0x60')][_0x47a5('0x34')]){_0x27793e=0x1;}if(!_0x2e418d[_0x47a5('0x1f')]){throw new Error(_0x47a5('0x97'));}}catch(_0xac1f9e){throw new Error(_0x47a5('0x98'));}var _0x4bd164=[];try{_0x4bd164=_[_0x47a5('0x99')](JSON[_0x47a5('0x67')](process[_0x47a5('0x92')][0x4]),'id');}catch(_0x399528){logger['info']('No\x20agent\x20available');}main(_0x419870,_0x2e418d,_0x4bd164,_0x27793e);}validate();process['on'](_0x47a5('0x9a'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x7a54=['.CmListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.priority','UserId','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','spread','campaigns.id','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','sequelize','query','length','all','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','set','offset','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','header',',utcOffset','writeFileSync','parse','createReadStream','data','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','rows','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','then','format','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_lists','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','localhost','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','cm_contacts','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.updatedAt','insert','into','cm_hopper_black','fields','cm_contacts.ListId\x20=\x20'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0x7a54,0x106));var _0x47a5=function(_0x21caff,_0x5158a7){_0x21caff=_0x21caff-0x0;var _0x748c92=_0x7a54[_0x21caff];return _0x748c92;};'use strict';var fs=require('fs');var path=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var Papa=require(_0x47a5('0x2'));var util=require('util');var BPromise=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var squel=require('squel');var Redis=require(_0x47a5('0x5'));var db=require(_0x47a5('0x6'))['db'];var config=require(_0x47a5('0x7'));var shared=require(_0x47a5('0x8'));var logger=require(_0x47a5('0x9'))('import');config[_0x47a5('0xa')]=_['defaults'](config[_0x47a5('0xa')],{'host':_0x47a5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x582352){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))*$/[_0x47a5('0xc')](_0x582352);}function selectNotIn(_0x2baee7,_0x5e31dd,_0x2eb0dd,_0x49e844,_0x5de6d7){return squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0xf'))[_0x47a5('0x10')](_0x49e844)[_0x47a5('0x11')](_0x5e31dd,null,_0x5e31dd+_0x47a5('0x12')+_0x49e844+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x49e844+'.'+_0x2eb0dd+'\x20=\x20'+_0x2baee7+'.'+_0x2eb0dd)[_0x47a5('0x13')](_0x5e31dd+_0x47a5('0x14')+_0x5de6d7[_0x47a5('0x11')]()+')');}function insertCmHopper(_0x711793,_0x139f25,_0x620ee9,_0x3c6c46,_0x190faa){var _0x4e99a8=[_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18'),_0x139f25+'.'+_0x3c6c46,_0x47a5('0x19'),'cm_contacts.updatedAt','cm_contacts.priority',_0x47a5('0x1a'),'\x22'+_0x190faa+'\x22'];return squel['insert']()['into'](_0x47a5('0x1b'))[_0x47a5('0x1c')]([_0x47a5('0xf'),_0x47a5('0x1d'),_0x47a5('0x1e'),_0x47a5('0x1f'),_0x3c6c46,_0x47a5('0x20'),_0x47a5('0x21'),_0x47a5('0x22'),'UserId',_0x47a5('0x23')],squel[_0x47a5('0xd')]()['fields'](_0x4e99a8)[_0x47a5('0x10')](_0x139f25)[_0x47a5('0x11')](_0x47a5('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x139f25+_0x47a5('0x25'))[_0x47a5('0x11')](_0x620ee9,null,_0x620ee9+_0x47a5('0x12')+_0x139f25+'.'+_0x3c6c46)[_0x47a5('0x13')](_0x139f25+'.CmListId\x20=\x20?',_0x711793)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)['where'](_0x47a5('0x27'),selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))[_0x47a5('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x139f25,_0x620ee9,_0x3c6c46,'cm_hopper',[_0x47a5('0x28')])))['toString']();}function insertCmHopperBlack(_0x1ea9c8,_0x5b6c4e,_0x23cb77,_0x378208){var _0x36ad34=[_0x47a5('0x15'),_0x47a5('0x17'),_0x47a5('0x18'),_0x5b6c4e+'.'+_0x378208,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x47a5('0x2d'))[_0x47a5('0x1c')]([_0x47a5('0xf'),'ContactId',_0x47a5('0x1f'),_0x378208,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x36ad34)['from'](_0x5b6c4e)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x5b6c4e+_0x47a5('0x25'))['join'](_0x23cb77,null,_0x23cb77+'.id\x20=\x20'+_0x5b6c4e+'.'+_0x378208)[_0x47a5('0x13')](_0x5b6c4e+_0x47a5('0x30'),_0x1ea9c8)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')]('phone')[_0x47a5('0x10')](_0x47a5('0x2d'))['where']('ListId\x20=\x20?',_0x1ea9c8)[_0x47a5('0x13')](_0x378208+'\x20=\x20?',_0x5b6c4e+'.'+_0x378208)))[_0x47a5('0x31')]();}function insertTzCmHopper(_0x87e4c9,_0xf269a8,_0x52749b,_0x18f7e9,_0x50c086,_0x53c754){var _0x65542e=['cm_contacts.phone',_0x47a5('0x32')+_0x53c754+'.offset-cm_contacts.utcOffset\x20minute)',_0x47a5('0x17'),_0x47a5('0x18'),_0xf269a8+'.'+_0x18f7e9,_0x47a5('0x19'),_0x47a5('0x2a'),_0x47a5('0x33'),_0x47a5('0x1a'),'\x22'+_0x50c086+'\x22'];var _0xee582c=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')]('cm_hopper')[_0x47a5('0x1c')]([_0x47a5('0xf'),'scheduledat',_0x47a5('0x1e'),_0x47a5('0x1f'),_0x18f7e9,_0x47a5('0x20'),'updatedAt',_0x47a5('0x22'),_0x47a5('0x34'),'recallme'],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x65542e)['from'](_0xf269a8)['join']('cm_contacts',null,_0x47a5('0x2f')+_0xf269a8+'.CmListId')[_0x47a5('0x11')](_0x52749b,null,_0x52749b+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x11')](_0x53c754,null,_0x53c754+_0x47a5('0x12')+_0xf269a8+'.'+_0x18f7e9)[_0x47a5('0x13')](_0xf269a8+_0x47a5('0x30'),_0x87e4c9)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28'),_0x47a5('0x29')]))['where'](_0x47a5('0x27'),selectNotIn(_0xf269a8,_0x52749b,_0x18f7e9,_0x47a5('0x1b'),[_0x47a5('0x28')])))[_0x47a5('0x31')]();return _0xee582c;}function insertTzCmHopperBlack(_0x586f4f,_0x7de536,_0x528ef3,_0x47c7a2){var _0x55c43d=['cm_contacts.phone',_0x47a5('0x17'),'cm_contacts.ListId',_0x7de536+'.'+_0x47c7a2,_0x47a5('0x19'),_0x47a5('0x2a')];return squel[_0x47a5('0x2b')]()['into'](_0x47a5('0x2d'))[_0x47a5('0x1c')](['phone','ContactId',_0x47a5('0x1f'),_0x47c7a2,'createdAt',_0x47a5('0x21')],squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x55c43d)[_0x47a5('0x10')](_0x7de536)[_0x47a5('0x11')](_0x47a5('0x24'),null,_0x47a5('0x2f')+_0x7de536+_0x47a5('0x25'))[_0x47a5('0x11')](_0x528ef3,null,_0x528ef3+_0x47a5('0x12')+_0x7de536+'.'+_0x47c7a2)[_0x47a5('0x13')](_0x7de536+_0x47a5('0x30'),_0x586f4f)[_0x47a5('0x13')](_0x47a5('0x26'),NOW)[_0x47a5('0x13')](_0x47a5('0x27'),squel['select']()[_0x47a5('0xe')](_0x47a5('0xf'))['from']('cm_hopper_black')[_0x47a5('0x13')]('ListId\x20=\x20?',_0x586f4f)[_0x47a5('0x13')](_0x47c7a2+_0x47a5('0x35'),_0x7de536+'.'+_0x47c7a2)))['toString']();}function insertCmContact(_0x4f62d3,_0x3d85cc,_0x52d409,_0x2d147c){var _0x1d1039=_[_0x47a5('0x36')](_[_0x47a5('0x37')](_0x2d147c),[_0x47a5('0x1f'),_0x47a5('0x38'),_0x47a5('0x20'),'updatedAt']);return squel['insert']()[_0x47a5('0x2c')](_0x47a5('0x24'))[_0x47a5('0x1c')](_0x1d1039,squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x1d1039)[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x13')]('('+_0x52d409['join'](',')+_0x47a5('0x39'),squel[_0x47a5('0xd')]()[_0x47a5('0x2e')](_0x52d409)['from'](_0x47a5('0x24'))['where'](_0x47a5('0x3a'),_0x4f62d3)[_0x47a5('0x13')](_0x47a5('0x3b')))[_0x47a5('0x13')]('id\x20IN\x20?',squel[_0x47a5('0xd')]()[_0x47a5('0xe')](_0x47a5('0x3c'),_0x47a5('0x3d'))[_0x47a5('0x10')](_0x3d85cc)[_0x47a5('0x3e')](_0x52d409[_0x47a5('0x11')](','))))['toString']();}function handleStop(){logger[_0x47a5('0x3f')](_0x47a5('0x40'));stopped=!![];}function handleUncaughtException(_0x187d7e){logger[_0x47a5('0x41')](_0x187d7e[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}function handleError(_0x572233,_0x1ad6a9){stats[_0x47a5('0x44')][_0x47a5('0x45')]({'name':_0x1ad6a9['code'],'message':_0x1ad6a9[_0x47a5('0x42')],'row':_0x572233});}function handleQuery(_0x3c78b7){logger[_0x47a5('0x3f')](_0x3c78b7);return db['sequelize']['query'](_0x3c78b7)[_0x47a5('0x46')](function(_0x376e1d){results['push'](_0x376e1d);})['catch'](function(_0x6d6b2b){logger['error'](_0x6d6b2b[_0x47a5('0x42')]);});}function updateTzCampaigns(_0x5d383d){return new Promise(function(_0x482de6,_0x389ed9){var _0x46d2d3=squel['select']()[_0x47a5('0x2e')]([_0x47a5('0x47'),'campaigns.dialTimezone'])['from'](_0x47a5('0x48'))[_0x47a5('0x11')](_0x47a5('0x49'),null,_0x47a5('0x4a'))['where'](_0x47a5('0x4b')+_0x5d383d);db[_0x47a5('0x4c')][_0x47a5('0x4d')](_0x46d2d3['toString']())[_0x47a5('0x46')](function(_0x4db625){var _0x485e3c=[];for(var _0x470da6=0x0;_0x470da6<_0x4db625[_0x47a5('0x4e')];_0x470da6++){_0x485e3c[_0x47a5('0x45')](getTimezoneData(_0x4db625[_0x470da6],tmp_campaigns));}BPromise[_0x47a5('0x4f')](_0x485e3c)['then'](function(){_0x482de6({'val':0x1});});})[_0x47a5('0x50')](function(_0x5d1550){logger['error'](_0x5d1550['message']);_0x482de6({'val':0x0});});});}function updateTzVoiceQueues(_0x4f8564){return new Promise(function(_0x212d92,_0x6cd4ea){var _0x1e2bb4=squel['select']()['fields']([_0x47a5('0x51'),_0x47a5('0x52')])[_0x47a5('0x10')](_0x47a5('0x53'))[_0x47a5('0x11')]('voice_queues_has_cm_lists',null,_0x47a5('0x54'))['where'](_0x47a5('0x55')+_0x4f8564);db[_0x47a5('0x4c')]['query'](_0x1e2bb4[_0x47a5('0x31')]())[_0x47a5('0x46')](function(_0x132854){var _0x3e8274=[];for(var _0x2d6494=0x0;_0x2d6494<_0x132854[_0x47a5('0x4e')];_0x2d6494++){_0x3e8274[_0x47a5('0x45')](getTimezoneData(_0x132854[_0x2d6494],tmp_voice_queues));}BPromise[_0x47a5('0x4f')](_0x3e8274)['then'](function(){_0x212d92({'val':0x1});});})[_0x47a5('0x50')](function(_0x2a3a57){logger[_0x47a5('0x41')](_0x2a3a57[_0x47a5('0x42')]);_0x212d92({'val':0x0});});});}function getTimezoneData(_0x396cb0,_0x4bbe14){return new Promise(function(_0xbec033,_0xdfcecc){var _0x1224bc=shared[_0x47a5('0x56')];var _0x4228a3=_0x1224bc[_0x396cb0[_0x47a5('0x57')]];if(_[_0x47a5('0x58')](_0x4228a3)){_0xbec033({'ret':0x1});}else{var _0x149d34=_0x4228a3[_0x47a5('0x59')];var _0x44cb90=squel[_0x47a5('0x2b')]()[_0x47a5('0x2c')](_0x4bbe14)[_0x47a5('0x5a')]('id',_0x396cb0['id'])[_0x47a5('0x5a')](_0x47a5('0x5b'),_0x149d34)['set'](_0x47a5('0x57'),_0x396cb0[_0x47a5('0x57')])[_0x47a5('0x31')]();return db['sequelize'][_0x47a5('0x4d')](_0x44cb90)[_0x47a5('0x46')](function(_0x36c67){_0xbec033({'ret':0x1});})[_0x47a5('0x50')](function(_0x5d9822){logger[_0x47a5('0x41')](_0x5d9822['message']);_0xdfcecc({'ret':0x1});});}});}function handleTZQuery(_0x2d5ee6){logger['info'](_0x2d5ee6);return db[_0x47a5('0x4c')]['query'](_0x2d5ee6)[_0x47a5('0x46')](function(_0x2f27c3){})[_0x47a5('0x50')](function(_0x58473b){logger['error'](_0x58473b['message']);});}function main(_0x4164a3,_0x2b1303,_0xe3c0a7,_0x117510){logger['info'](_0x47a5('0x5c'),_0x4164a3,JSON[_0x47a5('0x5d')](_0x2b1303));process[_0x47a5('0x5e')](_0x47a5('0x5f'));var _0x308c9a=_0x2b1303[_0x47a5('0x60')];var _0x1155f6=_0x2b1303[_0x47a5('0x61')];var _0x4618a0=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),_0x1155f6+'.csv');hasTZ=_[_0x47a5('0x37')](_0x308c9a)['includes'](_0x47a5('0x57'));var _0x2ac30f=_[_0x47a5('0x37')](_0x308c9a)[_0x47a5('0x11')]();logger[_0x47a5('0x3f')](_0x47a5('0x64'),_0x2ac30f);if(hasTZ)_0x2ac30f+=_0x47a5('0x65');fs[_0x47a5('0x66')](_0x4618a0,_0x2ac30f+'\x0a');Papa[_0x47a5('0x67')](fs[_0x47a5('0x68')](_0x4164a3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x1cfb37,_0x1f07ac){try{for(var _0x8f0035=0x0,_0x2d434c=[];_0x8f0035<_0x1cfb37[_0x47a5('0x69')]['length'];_0x8f0035++){stats['rows']+=0x1;if(_0x1cfb37['errors'][_0x8f0035]){handleError(_0x1cfb37['data'][_0x8f0035],_0x1cfb37[_0x47a5('0x44')][_0x8f0035]);}else{var _0x28b8e9=[];for(var _0x5d6916 in _0x308c9a){if(_0x308c9a[_0x47a5('0x6a')](_0x5d6916)){if(_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]]){var _0x1baa5a=_[_0x47a5('0x6b')](_0x1cfb37[_0x47a5('0x69')][_0x8f0035][_0x308c9a[_0x5d6916]][_0x47a5('0x6c')](/"/g,'\x27'));switch(_0x5d6916){case _0x47a5('0x1d'):var _0x1c7302=moment(_0x1baa5a,_0x47a5('0x6d'),!![]);if(_0x1c7302[_0x47a5('0x6e')]()){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x6f'));}break;case _0x47a5('0x22'):var _0x420671=parseInt(_0x1baa5a);_0x1baa5a=_['isNaN'](_0x420671)||_0x420671<0x0||_0x420671>0x4?_0x117510?0x3:0x2:_0x420671;_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');break;case _0x47a5('0x34'):var _0x17b61d=parseInt(_0x1baa5a);if(_['isNumber'](_0x17b61d)&&_[_0x47a5('0x70')](_0xe3c0a7,_0x17b61d)){_0x2d434c['push']('\x22'+_0x17b61d+'\x22');}else{_0x28b8e9['push'](_0x47a5('0x71'));}break;case _0x47a5('0x72'):if(isEmail(_0x1baa5a)){_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x73'));}break;case _0x47a5('0x74'):var _0x479a82=moment(_0x1baa5a,'YYYY-MM-DD',!![]);if(_0x479a82[_0x47a5('0x6e')]()){_0x2d434c['push']('\x22'+_0x1baa5a+'\x22');}else{_0x28b8e9[_0x47a5('0x45')](_0x47a5('0x75'));}break;case _0x47a5('0x57'):var _0xb16bdd=shared['timezones'];var _0x3c66e3=_0xb16bdd[_0x1baa5a];if(!_['isNil'](_0x3c66e3)){var _0x5f3a04=_0x3c66e3[_0x47a5('0x59')];_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');_0x2d434c['push']('\x22'+_0x5f3a04+'\x22');}break;default:_0x2d434c[_0x47a5('0x45')]('\x22'+_0x1baa5a+'\x22');}}else{switch(_0x5d6916){case _0x47a5('0x76'):case _0x47a5('0xf'):_0x28b8e9['push'](_0x5d6916+_0x47a5('0x77'));break;default:_0x2d434c['push']('\x22\x22');}}}}if(_0x28b8e9[_0x47a5('0x4e')]){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x78'),'message':_0x28b8e9['join']()});}else{fs[_0x47a5('0x79')](_0x4618a0,_0x2d434c[_0x47a5('0x11')]()+'\x0a');}_0x2d434c=[];}if(!(stats[_0x47a5('0x7a')]%0xc8)){socket['emit'](_0x47a5('0x7b')+_0x1155f6,stats);stats['errors']=[];}}if(stopped){logger[_0x47a5('0x3f')]('Abort\x20parser');_0x1f07ac[_0x47a5('0x7c')]();}}catch(_0x20d8bd){handleError(_0x1cfb37[_0x47a5('0x69')][_0x8f0035],{'code':_0x47a5('0x7d'),'message':_0x20d8bd['message']});logger[_0x47a5('0x41')](_0x47a5('0x7e'),_0x20d8bd[_0x47a5('0x42')]);}},'complete':function(){try{var _0x1bbfba=[];var _0x22d84a=[];var _0x57ac25='cm_contacts';if(_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates'][_0x47a5('0x4e')]){_0x57ac25=_0x47a5('0x80')+_0x1155f6;_0x1bbfba[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+_0x57ac25+_0x47a5('0x81'));}tmp_campaigns=_0x47a5('0x82')+_0x1155f6;tmp_voice_queues='voice_queues_'+_0x1155f6;_0x22d84a[_0x47a5('0x45')](_0x47a5('0x83')+tmp_campaigns+_0x47a5('0x84'));_0x22d84a[_0x47a5('0x45')]('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x47a5('0x85')](_0x22d84a,handleTZQuery)[_0x47a5('0x86')](function(_0x48e7f3){updateTzCampaigns(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x5a0901){updateTzVoiceQueues(_0x2b1303[_0x47a5('0x1f')])[_0x47a5('0x86')](function(_0x2930d9){var _0x59f010=util[_0x47a5('0x87')]('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',_0x4618a0,_0x57ac25,_0x2ac30f,_0x2b1303[_0x47a5('0x1f')],_0x2b1303['CompanyId']||null,NOW,NOW);if(_[_0x47a5('0x58')](_0x308c9a[_0x47a5('0x1d')])){_0x59f010+=',\x20scheduledAt\x20=\x20NOW()';}_0x1bbfba[_0x47a5('0x45')](_0x59f010);if(_0x2b1303['duplicates']&&_0x2b1303[_0x47a5('0x7f')][_0x47a5('0x4e')]){_0x1bbfba[_0x47a5('0x45')](insertCmContact(_0x2b1303[_0x47a5('0x1f')],_0x57ac25,_0x2b1303['duplicates'],_0x308c9a));}if(hasTZ){_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303['ListId'],'voice_queues_has_cm_lists',_0x47a5('0x53'),_0x47a5('0x88'),_0x117510,tmp_voice_queues));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertTzCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x49'),'campaigns',_0x47a5('0x8a'),_0x117510,tmp_campaigns));_0x1bbfba['push'](insertTzCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8b'),_0x47a5('0x48'),_0x47a5('0x8a')));}else{_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x8c'),_0x47a5('0x53'),_0x47a5('0x88'),_0x117510));_0x1bbfba['push'](insertCmHopperBlack(_0x2b1303[_0x47a5('0x1f')],_0x47a5('0x89'),'voice_queues',_0x47a5('0x88')));_0x1bbfba[_0x47a5('0x45')](insertCmHopper(_0x2b1303[_0x47a5('0x1f')],'campaigns_has_cm_lists','campaigns',_0x47a5('0x8a'),_0x117510));_0x1bbfba[_0x47a5('0x45')](insertCmHopperBlack(_0x2b1303['ListId'],'campaigns_has_cm_blacklists',_0x47a5('0x48'),_0x47a5('0x8a')));}_0x1bbfba['push'](_0x47a5('0x8d')+tmp_campaigns+';');_0x1bbfba[_0x47a5('0x45')]('DROP\x20TABLE\x20'+tmp_voice_queues+';');BPromise[_0x47a5('0x85')](_0x1bbfba,handleQuery)[_0x47a5('0x86')](function(_0x109805){stats[_0x47a5('0x8e')]=!![];stats[_0x47a5('0x8f')]=_0x2b1303[_0x47a5('0x7f')]&&_0x2b1303['duplicates']['length']?results[0x2]['affectedRows']:results[0x0][_0x47a5('0x8f')];socket[_0x47a5('0x90')]('contact:import:'+_0x1155f6,stats);fs[_0x47a5('0x91')](_0x4164a3);fs[_0x47a5('0x91')](_0x4618a0);process[_0x47a5('0x43')](0x0);})[_0x47a5('0x50')](function(_0xcdbfd7){logger['error'](_0xcdbfd7[_0x47a5('0x42')]);process['exit'](0x1);});})['catch'](function(_0x5db0ed){logger[_0x47a5('0x41')](_0x5db0ed['message']);process[_0x47a5('0x43')](0x1);});});});}catch(_0xf3edc8){logger[_0x47a5('0x41')]('complete',_0xf3edc8[_0x47a5('0x42')]);process[_0x47a5('0x43')](0x1);}},'error':function(_0x35bf37,_0x121750,_0x392ad7,_0x581a87){throw new Error(_0x581a87);}});}function validate(){if(process[_0x47a5('0x92')]&&process[_0x47a5('0x92')]['length']<0x4){throw new Error(_0x47a5('0x93'));}var _0x419870=path[_0x47a5('0x11')](config[_0x47a5('0x62')],_0x47a5('0x63'),process[_0x47a5('0x92')][0x2]);if(!fs['existsSync'](_0x419870)){throw new Error(_0x47a5('0x94'));}var _0x2e418d={};try{_0x2e418d=JSON['parse'](process[_0x47a5('0x92')][0x3]);if(!_0x2e418d[_0x47a5('0x60')]){throw new Error(_0x47a5('0x95'));}if(!_0x2e418d[_0x47a5('0x60')]['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0x2e418d['binding']['firstName']){throw new Error(_0x47a5('0x96'));}var _0x27793e=0x0;if(_0x2e418d[_0x47a5('0x60')][_0x47a5('0x34')]){_0x27793e=0x1;}if(!_0x2e418d[_0x47a5('0x1f')]){throw new Error(_0x47a5('0x97'));}}catch(_0xac1f9e){throw new Error(_0x47a5('0x98'));}var _0x4bd164=[];try{_0x4bd164=_[_0x47a5('0x99')](JSON[_0x47a5('0x67')](process[_0x47a5('0x92')][0x4]),'id');}catch(_0x399528){logger['info']('No\x20agent\x20available');}main(_0x419870,_0x2e418d,_0x4bd164,_0x27793e);}validate();process['on'](_0x47a5('0x9a'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index d02fb18..65ddbba 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf203=['localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','spread','isNil','AdditionalPhones','push','all','then','error','message','split','length','filter','CmContactHasItem','findOne','update','create','inserted','CmHopper','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','ContactId','ListId','createdAt','updatedAt','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.createdAt','fromQuery','cm_contacts.createdAt\x20=\x20?','cm_hopper_black','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','info','exit','errors','code','catch','main','stringify','send','start','binding','clone','root','.csv','body','ContactItemType','findAll','name','data','find','hasOwnProperty','trim','replace','scheduledat','priority','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','each','contactId','orderBy','DROP\x20TABLE\x20','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','parse','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/logger','import','defaults','redis'];(function(_0x35f7f5,_0x4e2ee1){var _0x5567a4=function(_0x3e5df0){while(--_0x3e5df0){_0x35f7f5['push'](_0x35f7f5['shift']());}};_0x5567a4(++_0x4e2ee1);}(_0xf203,0x124));var _0x3f20=function(_0x184dd1,_0x28fead){_0x184dd1=_0x184dd1-0x0;var _0x356421=_0xf203[_0x184dd1];return _0x356421;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0x3f20('0x0'));var util=require(_0x3f20('0x1'));var BPromise=require(_0x3f20('0x2'));var moment=require(_0x3f20('0x3'));var squel=require(_0x3f20('0x4'));var Redis=require('ioredis');var db=require(_0x3f20('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x3f20('0x6'))(_0x3f20('0x7'));config['redis']=_[_0x3f20('0x8')](config[_0x3f20('0x9')],{'host':_0x3f20('0xa'),'port':0x18eb});var socket=require(_0x3f20('0xb'))(new Redis(config[_0x3f20('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0x3f20('0xc'));var tempTableName='cm_contacts_temp_'+moment()[_0x3f20('0xd')]('YYYYMMDDHHmmss');var contactItemTypes=[];var hasAdditionalPhones=![];function isEmail(_0x48827c){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))*$/[_0x3f20('0xe')](_0x48827c);}function selectNotIn(_0x383b0b,_0x5a986a,_0x5b06cc,_0x24a027,_0x16e827){return squel[_0x3f20('0xf')]()[_0x3f20('0x10')](_0x3f20('0x11'))[_0x3f20('0x12')](_0x24a027)[_0x3f20('0x13')](_0x5a986a,null,_0x5a986a+_0x3f20('0x14')+_0x24a027+'.'+_0x5b06cc)[_0x3f20('0x15')](_0x24a027+'.'+_0x5b06cc+'\x20=\x20'+_0x383b0b+'.'+_0x5b06cc)[_0x3f20('0x15')](_0x5a986a+_0x3f20('0x16')+_0x16e827[_0x3f20('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3755d6,_0x1aea81){promisesAdditionalPhones=[];promisesContact=[];return db[_0x3f20('0x17')][_0x3f20('0x18')]('select\x20*\x20from\x20'+tempTableName)[_0x3f20('0x19')](function(_0x1e45c8){if(_0x1e45c8!==null){var _0x157b69=[];for(var _0x6b0961=0x0;_0x6b0961<_0x1e45c8['length'];_0x6b0961++){var _0x42954c=_0x1e45c8[_0x6b0961];if(!_[_0x3f20('0x1a')](_0x42954c['phone'])){if(!_[_0x3f20('0x1a')](_0x42954c[_0x3f20('0x1b')]))_0x157b69[_0x3f20('0x1c')](insertAdditionalPhones(_0x42954c));promisesContact[_0x3f20('0x1c')]({'contact':_0x42954c});}}}Promise[_0x3f20('0x1d')](_0x157b69)[_0x3f20('0x1e')](function(){_0x3755d6({'val':0x1});});})['catch'](function(_0x5852d6){logger[_0x3f20('0x1f')](_0x5852d6[_0x3f20('0x20')]);});});}function insertAdditionalPhones(_0x3fcc7b){return new Promise(function(_0x183c85,_0x150809){var _0x357b6f=_0x3fcc7b[_0x3f20('0x1b')];if(_[_0x3f20('0x1a')](_0x357b6f))_0x150809({'val':0x0});else{var _0x11c56f=_0x357b6f[_0x3f20('0x21')](';');var _0x24910d=[];orderBy=0x0;for(var _0x4a271c=0x0;_0x4a271c<_0x11c56f[_0x3f20('0x22')];_0x4a271c++){_0x24910d[_0x3f20('0x1c')](splitAdditionalPhone(_0x3fcc7b['id'],_0x11c56f[_0x4a271c]));}Promise[_0x3f20('0x1d')](_0x24910d)[_0x3f20('0x1e')](function(){_0x183c85({'val':_0x11c56f[_0x3f20('0x22')]});});}});}function splitAdditionalPhone(_0x1ace56,_0x29645e){return new Promise(function(_0x390528,_0x455bb0){var _0x414eff=_0x29645e[_0x3f20('0x21')](':');var _0x43bcea=_0x414eff[0x0];var _0x5f2854=_0x414eff[0x1];if(_0x5f2854!==''){var _0x4fe836=_0x5f2854[_0x3f20('0x21')]('|');var _0x22fbc0=[];for(var _0x14f7a6=0x0;_0x14f7a6<_0x4fe836[_0x3f20('0x22')];_0x14f7a6++){if(_0x4fe836[_0x14f7a6]!==''){var _0x432fb2=_[_0x3f20('0x23')](promisesAdditionalPhones,{'contactId':_0x1ace56,'phone':_0x4fe836[_0x14f7a6]});if(_0x432fb2[_0x3f20('0x22')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x1ace56,'contactTypeId':_0x43bcea,'phone':_0x4fe836[_0x14f7a6],'orderBy':orderBy});}}}_0x390528({'ok':0x1});}else _0x390528({'res':0x0});});}function createAdditionalPhone(_0x2bf290,_0x3e3e50,_0x221cf6,_0xdbd81f){return new Promise(function(_0x1fc882,_0x244c34){return db[_0x3f20('0x24')][_0x3f20('0x25')]({'where':{'CmContactId':_0x2bf290,'item':_0x221cf6}})[_0x3f20('0x1e')](function(_0x1994e0){if(_0x1994e0){return db[_0x3f20('0x24')][_0x3f20('0x26')]({'ItemTypeId':_0x3e3e50,'OrderBy':_0xdbd81f},{'where':{'CmContactId':_0x2bf290,'item':_0x221cf6}})['then'](function(_0x35d83f){_0x1fc882({'res':'updated'});});}else{return db[_0x3f20('0x24')][_0x3f20('0x27')]({'CmContactId':_0x2bf290,'item':_0x221cf6,'ItemTypeId':_0x3e3e50,'OrderBy':_0xdbd81f,'ItemClass':'PHONE'})[_0x3f20('0x1e')](function(_0x7c544){_0x1fc882({'res':_0x3f20('0x28')});});}});});}function updateContact(_0x440730){return new Promise(function(_0x2321b5,_0x2b6989){var _0x5724ee=_0x440730['id'];delete _0x440730['id'];return db['CmContact']['update'](_0x440730,{'where':{'id':_0x5724ee}})[_0x3f20('0x1e')](function(_0x2c6ca1){updatedRows+=0x1;return db[_0x3f20('0x29')][_0x3f20('0x26')]({'phone':_0x440730[_0x3f20('0x11')]},{'where':{'ContactId':_0x5724ee}})[_0x3f20('0x1e')](function(_0xb5fe8e){_0x2321b5({'ret':'OK'});});});});}function insertCmHopper(_0x1cfc8f,_0x4ce828,_0x2be592,_0x14a6f7,_0x41fbdc){var _0x51bdad=['cm_contacts.phone','cm_contacts.scheduledat',_0x3f20('0x2a'),_0x3f20('0x2b'),_0x4ce828+'.'+_0x14a6f7,'cm_contacts.createdAt',_0x3f20('0x2c'),_0x3f20('0x2d'),'cm_contacts.UserId','\x22'+_0x41fbdc+'\x22'];return squel[_0x3f20('0x2e')]()[_0x3f20('0x2f')](_0x3f20('0x30'))['fromQuery'](['phone','scheduledat',_0x3f20('0x31'),_0x3f20('0x32'),_0x14a6f7,_0x3f20('0x33'),_0x3f20('0x34'),'priority',_0x3f20('0x35'),_0x3f20('0x36')],squel[_0x3f20('0xf')]()[_0x3f20('0x37')](_0x51bdad)[_0x3f20('0x12')](_0x4ce828)['join'](_0x3f20('0x38'),null,_0x3f20('0x39')+_0x4ce828+_0x3f20('0x3a'))[_0x3f20('0x13')](_0x2be592,null,_0x2be592+'.id\x20=\x20'+_0x4ce828+'.'+_0x14a6f7)['where'](_0x4ce828+_0x3f20('0x3b'),_0x1cfc8f)[_0x3f20('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x3f20('0x3c'),selectNotIn(_0x4ce828,_0x2be592,_0x14a6f7,_0x3f20('0x30'),['\x22always\x22',_0x3f20('0x3d')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4ce828,_0x2be592,_0x14a6f7,'cm_hopper',[_0x3f20('0x3e')])))[_0x3f20('0x3f')]();}function insertCmHopperBlack(_0x4d9f5b,_0x7ab82f,_0x423df8,_0x537382){var _0x2db512=['cm_contacts.phone','cm_contacts.id','cm_contacts.ListId',_0x7ab82f+'.'+_0x537382,_0x3f20('0x40'),_0x3f20('0x2c')];return squel[_0x3f20('0x2e')]()[_0x3f20('0x2f')]('cm_hopper_black')[_0x3f20('0x41')](['phone',_0x3f20('0x31'),'ListId',_0x537382,'createdAt',_0x3f20('0x34')],squel[_0x3f20('0xf')]()['fields'](_0x2db512)[_0x3f20('0x12')](_0x7ab82f)[_0x3f20('0x13')](_0x3f20('0x38'),null,_0x3f20('0x39')+_0x7ab82f+_0x3f20('0x3a'))[_0x3f20('0x13')](_0x423df8,null,_0x423df8+_0x3f20('0x14')+_0x7ab82f+'.'+_0x537382)[_0x3f20('0x15')](_0x7ab82f+_0x3f20('0x3b'),_0x4d9f5b)[_0x3f20('0x15')](_0x3f20('0x42'),NOW)[_0x3f20('0x15')](_0x3f20('0x3c'),squel[_0x3f20('0xf')]()['field']('phone')[_0x3f20('0x12')](_0x3f20('0x43'))[_0x3f20('0x15')](_0x3f20('0x44'),_0x4d9f5b)[_0x3f20('0x15')](_0x537382+'\x20=\x20?',_0x7ab82f+'.'+_0x537382)))[_0x3f20('0x3f')]();}function insertCmHopperAdditionalPhones(_0x34bab7){var _0x1006cf=[_0x3f20('0x45'),_0x3f20('0x46'),_0x3f20('0x47'),_0x3f20('0x48'),'cm_contact_has_items.updatedAt'];return squel[_0x3f20('0x2e')]()['into'](_0x3f20('0x49'))['fromQuery'](['CmHopperId',_0x3f20('0x11'),_0x3f20('0x4a'),'createdAt',_0x3f20('0x34')],squel['select']()['fields'](_0x1006cf)[_0x3f20('0x12')](_0x3f20('0x30'))['join'](_0x3f20('0x38'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')['join'](_0x3f20('0x4b'),null,_0x3f20('0x4c'))[_0x3f20('0x15')]('cm_hopper.ListId\x20=\x20?',_0x34bab7)[_0x3f20('0x15')](_0x3f20('0x42'),NOW))['toString']();}function insertCmContact(_0x43e84a,_0x275aca,_0x179a27,_0x315e2b){var _0x44858a=_[_0x3f20('0x4d')](_[_0x3f20('0x4e')](_0x315e2b),['ListId','CompanyId',_0x3f20('0x33'),_0x3f20('0x34')]);return squel[_0x3f20('0x2e')]()['into'](_0x3f20('0x38'))['fromQuery'](_0x44858a,squel[_0x3f20('0xf')]()[_0x3f20('0x37')](_0x44858a)['from'](_0x275aca)[_0x3f20('0x15')]('('+_0x179a27[_0x3f20('0x13')](',')+_0x3f20('0x4f'),squel[_0x3f20('0xf')]()[_0x3f20('0x37')](_0x179a27)[_0x3f20('0x12')](_0x3f20('0x38'))[_0x3f20('0x15')](_0x3f20('0x44'),_0x43e84a))[_0x3f20('0x15')](_0x3f20('0x50'),squel['select']()['field'](_0x3f20('0x51'),_0x3f20('0x52'))['from'](_0x275aca)['group'](_0x179a27[_0x3f20('0x13')](','))))[_0x3f20('0x3f')]();}function handleStop(){logger[_0x3f20('0x53')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x500673){logger[_0x3f20('0x1f')](_0x500673[_0x3f20('0x20')]);process[_0x3f20('0x54')](0x1);}function handleError(_0xb64ee5,_0x3aecbe){stats[_0x3f20('0x55')][_0x3f20('0x1c')]({'name':_0x3aecbe[_0x3f20('0x56')],'message':_0x3aecbe[_0x3f20('0x20')],'row':_0xb64ee5});}function handleQuery(_0x520958){logger[_0x3f20('0x53')](_0x520958);return db[_0x3f20('0x17')]['query'](_0x520958)[_0x3f20('0x19')](function(_0x5d82cf){results[_0x3f20('0x1c')](_0x5d82cf);})[_0x3f20('0x57')](function(_0x5738b2){logger[_0x3f20('0x1f')](_0x5738b2['message']);});}function main(_0x1bc76e,_0x5de902,_0x3ad257,_0x223494){logger[_0x3f20('0x53')](_0x3f20('0x58'),_0x1bc76e,JSON[_0x3f20('0x59')](_0x5de902));process[_0x3f20('0x5a')](_0x3f20('0x5b'));var _0x15aa53=_0x5de902[_0x3f20('0x5c')];var _0x4ea71b=_[_0x3f20('0x5d')](_0x15aa53);var _0x23f35b=_0x5de902['socket_timestamp'];var _0x3240a0=path[_0x3f20('0x13')](config[_0x3f20('0x5e')],'server/files/tmp',_0x23f35b+_0x3f20('0x5f'));logger[_0x3f20('0x53')](_0x3f20('0x60'),_0x5de902);db[_0x3f20('0x61')][_0x3f20('0x62')]({'raw':!![],'attributes':['id','name']})[_0x3f20('0x1e')](function(_0x4c7295){for(var _0x3a2671=0x0;_0x3a2671<_0x4c7295[_0x3f20('0x22')];_0x3a2671++){if(_0x4c7295[_0x3a2671][_0x3f20('0x63')]in _0x15aa53){contactItemTypes[_0x3f20('0x1c')](_0x4c7295[_0x3a2671]);delete _0x4ea71b[_0x4c7295[_0x3a2671][_0x3f20('0x63')]];hasAdditionalPhones=!![];}else{}}if(hasAdditionalPhones)_0x4ea71b[_0x3f20('0x1b')]='';var _0x59b9c2=_[_0x3f20('0x4e')](_0x4ea71b)[_0x3f20('0x13')]();logger['info']('header',_0x59b9c2);fs['writeFileSync'](_0x3240a0,_0x59b9c2+'\x0a');Papa['parse'](fs['createReadStream'](_0x1bc76e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x22e731,_0x4b995f){try{for(var _0x25711e=0x0,_0xa3b28e=[];_0x25711e<_0x22e731[_0x3f20('0x64')][_0x3f20('0x22')];_0x25711e++){stats['rows']+=0x1;if(_0x22e731[_0x3f20('0x55')][_0x25711e]){handleError(_0x22e731[_0x3f20('0x64')][_0x25711e],_0x22e731[_0x3f20('0x55')][_0x25711e]);}else{var _0x59b7ca=[];var _0xbe5d66=[];for(var _0x4bde72 in _0x15aa53){let _0x4eb94d=contactItemTypes[_0x3f20('0x65')](_0x49f6f=>_0x49f6f['name']===_0x4bde72);if(_['isNil'](_0x4eb94d)){if(_0x15aa53[_0x3f20('0x66')](_0x4bde72)){if(_0x22e731[_0x3f20('0x64')][_0x25711e][_0x15aa53[_0x4bde72]]){var _0x5c3b84=_[_0x3f20('0x67')](_0x22e731[_0x3f20('0x64')][_0x25711e][_0x15aa53[_0x4bde72]][_0x3f20('0x68')](/"/g,'\x27'));switch(_0x4bde72){case _0x3f20('0x69'):var _0x4e57eb=moment(_0x5c3b84,_0x3f20('0xc'),!![]);if(_0x4e57eb['isValid']()){_0xa3b28e['push']('\x22'+_0x5c3b84+'\x22');}else{_0x59b7ca[_0x3f20('0x1c')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x3f20('0x6a'):var _0x58a4e2=parseInt(_0x5c3b84);_0x5c3b84=_[_0x3f20('0x6b')](_0x58a4e2)||_0x58a4e2<0x0||_0x58a4e2>0x4?_0x223494?0x3:0x2:_0x58a4e2;_0xa3b28e['push']('\x22'+_0x5c3b84+'\x22');break;case _0x3f20('0x35'):var _0x4b8dac=parseInt(_0x5c3b84);if(_[_0x3f20('0x6c')](_0x4b8dac)&&_[_0x3f20('0x6d')](_0x3ad257,_0x4b8dac)){_0xa3b28e[_0x3f20('0x1c')]('\x22'+_0x4b8dac+'\x22');}else{_0x59b7ca['push'](_0x3f20('0x6e'));}break;case _0x3f20('0x6f'):if(isEmail(_0x5c3b84)){_0xa3b28e['push']('\x22'+_0x5c3b84+'\x22');}else{_0x59b7ca[_0x3f20('0x1c')](_0x3f20('0x70'));}break;case _0x3f20('0x71'):var _0x1eb837=moment(_0x5c3b84,_0x3f20('0x72'),!![]);if(_0x1eb837[_0x3f20('0x73')]()){_0xa3b28e[_0x3f20('0x1c')]('\x22'+_0x5c3b84+'\x22');}else{_0x59b7ca[_0x3f20('0x1c')](_0x3f20('0x74'));}break;default:_0xa3b28e[_0x3f20('0x1c')]('\x22'+_0x5c3b84+'\x22');}}else{switch(_0x4bde72){case _0x3f20('0x75'):case'phone':_0x59b7ca[_0x3f20('0x1c')](_0x4bde72+_0x3f20('0x76'));break;default:_0xa3b28e['push']('\x22\x22');}}}}else{var _0x2c3342='';for(var _0x29f4c3=0x0;_0x29f4c3<_0x15aa53[_0x4bde72][_0x3f20('0x22')];_0x29f4c3++){var _0x5c3b84=_[_0x3f20('0x67')](_0x22e731[_0x3f20('0x64')][_0x25711e][_0x15aa53[_0x4bde72][_0x29f4c3]]['replace'](/"/g,'\x27'));if(_0x2c3342=='')_0x2c3342=_0x5c3b84;else _0x2c3342+='|'+_0x5c3b84;}_0xbe5d66['push'](_0x4eb94d['id']+':'+_0x2c3342);}}if(hasAdditionalPhones){_0xa3b28e[_0x3f20('0x1c')]('\x22'+_0xbe5d66[_0x3f20('0x13')](';')+'\x22');}if(_0x59b7ca['length']){handleError(_0x22e731[_0x3f20('0x64')][_0x25711e],{'code':_0x3f20('0x77'),'message':_0x59b7ca[_0x3f20('0x13')]()});}else{fs[_0x3f20('0x78')](_0x3240a0,_0xa3b28e['join']()+'\x0a');}_0xa3b28e=[];}if(!(stats['rows']%0xc8)){socket[_0x3f20('0x79')](_0x3f20('0x7a')+_0x23f35b,stats);stats[_0x3f20('0x55')]=[];}}if(stopped){logger[_0x3f20('0x53')](_0x3f20('0x7b'));_0x4b995f[_0x3f20('0x7c')]();}}catch(_0x243867){handleError(_0x22e731[_0x3f20('0x64')][_0x25711e],{'code':'SystemError','message':_0x243867[_0x3f20('0x20')]});logger[_0x3f20('0x1f')](_0x3f20('0x7d'),_0x243867['message']);}},'complete':function(){try{var _0x20d659=[];var _0x4c3011=tempTableName;_0x20d659[_0x3f20('0x1c')](_0x3f20('0x7e')+_0x4c3011+_0x3f20('0x7f'));logger['info'](_0x3f20('0x80'),contactItemTypes[_0x3f20('0x22')]);var _0x2056f5=util[_0x3f20('0xd')](_0x3f20('0x81'),_0x3240a0,_0x4c3011,_0x59b9c2,_0x5de902[_0x3f20('0x32')],_0x5de902[_0x3f20('0x82')]||null,NOW,NOW);if(_[_0x3f20('0x1a')](_0x15aa53[_0x3f20('0x69')])){_0x2056f5+=_0x3f20('0x83');}_0x20d659[_0x3f20('0x1c')](_0x2056f5);BPromise[_0x3f20('0x84')](_0x20d659,handleQuery)[_0x3f20('0x1e')](function(_0x4a825d){BPromise[_0x3f20('0x1d')]([handleAdditionalPhones()])[_0x3f20('0x1e')](function(){_0x20d659=[];for(var _0x144f30=0x0;_0x144f30_0x3b209d[_0x645b('0x6d')]===_0x1064e6);if(_[_0x645b('0x1d')](_0x508537)){if(_0x56ecbd[_0x645b('0x76')](_0x1064e6)){if(_0x3e3542[_0x645b('0x73')][_0x43a214][_0x56ecbd[_0x1064e6]]){var _0x2b5b87=_[_0x645b('0x77')](_0x3e3542[_0x645b('0x73')][_0x43a214][_0x56ecbd[_0x1064e6]][_0x645b('0x78')](/"/g,'\x27'));switch(_0x1064e6){case'scheduledat':var _0xe2f0c4=moment(_0x2b5b87,_0x645b('0xd'),!![]);if(_0xe2f0c4['isValid']()){_0x558fb1['push']('\x22'+_0x2b5b87+'\x22');}else{_0x32a8fa[_0x645b('0x1f')](_0x645b('0x79'));}break;case _0x645b('0x3b'):var _0x58d88d=parseInt(_0x2b5b87);_0x2b5b87=_['isNaN'](_0x58d88d)||_0x58d88d<0x0||_0x58d88d>0x4?_0x5cf729?0x3:0x2:_0x58d88d;_0x558fb1['push']('\x22'+_0x2b5b87+'\x22');break;case _0x645b('0x3c'):var _0xa477a4=parseInt(_0x2b5b87);if(_[_0x645b('0x7a')](_0xa477a4)&&_['includes'](_0x3d286d,_0xa477a4)){_0x558fb1[_0x645b('0x1f')]('\x22'+_0xa477a4+'\x22');}else{_0x32a8fa['push'](_0x645b('0x7b'));}break;case _0x645b('0x7c'):if(isEmail(_0x2b5b87)){_0x558fb1[_0x645b('0x1f')]('\x22'+_0x2b5b87+'\x22');}else{_0x32a8fa[_0x645b('0x1f')](_0x645b('0x7d'));}break;case _0x645b('0x7e'):var _0x1f93d5=moment(_0x2b5b87,_0x645b('0x7f'),!![]);if(_0x1f93d5[_0x645b('0x80')]()){_0x558fb1[_0x645b('0x1f')]('\x22'+_0x2b5b87+'\x22');}else{_0x32a8fa[_0x645b('0x1f')](_0x645b('0x81'));}break;default:_0x558fb1['push']('\x22'+_0x2b5b87+'\x22');}}else{switch(_0x1064e6){case _0x645b('0x82'):case _0x645b('0x2e'):_0x32a8fa[_0x645b('0x1f')](_0x1064e6+_0x645b('0x83'));break;default:_0x558fb1[_0x645b('0x1f')]('\x22\x22');}}}}else{var _0x1e55b2='';for(var _0x1d153b=0x0;_0x1d153b<_0x56ecbd[_0x1064e6][_0x645b('0x1c')];_0x1d153b++){var _0x2b5b87=_[_0x645b('0x77')](_0x3e3542[_0x645b('0x73')][_0x43a214][_0x56ecbd[_0x1064e6][_0x1d153b]][_0x645b('0x78')](/"/g,'\x27'));if(_0x1e55b2=='')_0x1e55b2=_0x2b5b87;else _0x1e55b2+='|'+_0x2b5b87;}_0x44b2a3['push'](_0x508537['id']+':'+_0x1e55b2);}}if(hasAdditionalPhones){_0x558fb1['push']('\x22'+_0x44b2a3[_0x645b('0x14')](';')+'\x22');}if(_0x32a8fa['length']){handleError(_0x3e3542['data'][_0x43a214],{'code':_0x645b('0x84'),'message':_0x32a8fa[_0x645b('0x14')]()});}else{fs[_0x645b('0x85')](_0x4adb83,_0x558fb1[_0x645b('0x14')]()+'\x0a');}_0x558fb1=[];}if(!(stats[_0x645b('0x74')]%0xc8)){socket[_0x645b('0x86')]('contact:import:'+_0x5f2d63,stats);stats[_0x645b('0x62')]=[];}}if(stopped){logger['info'](_0x645b('0x87'));_0x141170[_0x645b('0x88')]();}}catch(_0x452c58){handleError(_0x3e3542['data'][_0x43a214],{'code':_0x645b('0x89'),'message':_0x452c58[_0x645b('0x24')]});logger[_0x645b('0x23')]('step',_0x452c58[_0x645b('0x24')]);}},'complete':function(){try{var _0x50122a=[];var _0x1b392d=tempTableName;_0x50122a[_0x645b('0x1f')](_0x645b('0x8a')+_0x1b392d+_0x645b('0x8b'));logger['info'](_0x645b('0x8c'),contactItemTypes[_0x645b('0x1c')]);var _0x5063aa=util['format'](_0x645b('0x8d'),_0x4adb83,_0x1b392d,_0x437b90,_0x5b340d['ListId'],_0x5b340d[_0x645b('0x5a')]||null,NOW,NOW);if(_[_0x645b('0x1d')](_0x56ecbd['scheduledat'])){_0x5063aa+=_0x645b('0x8e');}_0x50122a['push'](_0x5063aa);BPromise[_0x645b('0x8f')](_0x50122a,handleQuery)['then'](function(_0x2516cd){BPromise[_0x645b('0x20')]([handleAdditionalPhones()])[_0x645b('0x21')](function(){_0x50122a=[];for(var _0x2d27cd=0x0;_0x2d27cd\x20\x20');}var _0x43faad=path[_0x645b('0x14')](config['root'],_0x645b('0x99'),process[_0x645b('0x98')][0x2]);if(!fs['existsSync'](_0x43faad)){throw new Error(_0x645b('0x9a'));}var _0x1f62ef={};try{_0x1f62ef=JSON[_0x645b('0x71')](process[_0x645b('0x98')][0x3]);if(!_0x1f62ef['binding']){throw new Error(_0x645b('0x9b'));}var _0x422f92=0x0;if(_0x1f62ef['binding']['UserId']){_0x422f92=0x1;}if(!_0x1f62ef[_0x645b('0x39')]){throw new Error(_0x645b('0x9c'));}}catch(_0x54f65f){throw new Error('body\x20id\x20mandatory');}var _0x5d9d3f=[];try{_0x5d9d3f=_[_0x645b('0x9d')](JSON[_0x645b('0x71')](process[_0x645b('0x98')][0x4]),'id');}catch(_0x32fe83){logger[_0x645b('0x5f')](_0x645b('0x9e'));}main(_0x43faad,_0x1f62ef,_0x5d9d3f,_0x422f92);}validate();process['on'](_0x645b('0x9f'),handleStop);process['on'](_0x645b('0xa0'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 30a6504..8a89523 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 _0x4213=['Caller\x20Number','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Hold\x20Time','Talk\x20Time','talktime','Called\x20Number','membername','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','push','variable','queue','calleridnum','outbound','Outbound\x20Call','voice','inbound','***\x20Call\x20Info\x20***'];(function(_0xd51099,_0x7f758b){var _0x4c0914=function(_0x13bd4f){while(--_0x13bd4f){_0xd51099['push'](_0xd51099['shift']());}};_0x4c0914(++_0x7f758b);}(_0x4213,0x77));var _0x3421=function(_0x4fa232,_0x54f958){_0x4fa232=_0x4fa232-0x0;var _0x3d457e=_0x4213[_0x4fa232];return _0x3d457e;};'use strict';exports[_0x3421('0x0')]=function(_0x445ef6,_0x324515){var _0x7870a4=[{'type':_0x3421('0x1'),'content':_0x3421('0x2'),'variableName':null}];switch(_0x445ef6[_0x3421('0x3')]()){case'voice':switch(_0x324515[_0x3421('0x3')]()){case'inbound':_0x7870a4[_0x3421('0x4')]({'type':_0x3421('0x5'),'content':'','variableName':_0x3421('0x6')});_0x7870a4[_0x3421('0x4')]({'type':'variable','content':'','variableName':_0x3421('0x7')});break;case _0x3421('0x8'):_0x7870a4[_0x3421('0x4')]({'type':_0x3421('0x1'),'content':_0x3421('0x9'),'variableName':null});_0x7870a4['push']({'type':_0x3421('0x5'),'content':'','variableName':'destcalleridnum'});break;}}return _0x7870a4;};exports['getDescriptions']=function(_0x12eee0,_0x4b9d24){var _0x2d8676=[];switch(_0x12eee0[_0x3421('0x3')]()){case _0x3421('0xa'):switch(_0x4b9d24[_0x3421('0x3')]()){case _0x3421('0xb'):_0x2d8676=[{'type':_0x3421('0x1'),'content':_0x3421('0xc'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x3421('0xd'),'keyType':_0x3421('0x5'),'variableName':_0x3421('0x7')},{'type':_0x3421('0xe'),'content':'','key':_0x3421('0xf'),'keyType':_0x3421('0x5'),'variableName':_0x3421('0x10')},{'type':'keyValue','content':'','key':_0x3421('0x11'),'keyType':'variable','variableName':_0x3421('0x12')},{'type':_0x3421('0xe'),'content':'','key':'Queue','keyType':_0x3421('0x5'),'variableName':'queue'},{'type':_0x3421('0xe'),'content':'','key':_0x3421('0x13'),'keyType':'variable','variableName':_0x3421('0x14')},{'type':_0x3421('0xe'),'content':'','key':_0x3421('0x15'),'keyType':_0x3421('0x5'),'variableName':_0x3421('0x16')},{'type':_0x3421('0x1'),'content':_0x3421('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x3421('0xe'),'content':'','key':_0x3421('0x18'),'keyType':_0x3421('0x5'),'variableName':_0x3421('0x19')},{'type':'keyValue','content':'','key':_0x3421('0x1a'),'keyType':'variable','variableName':'destcalleridnum'},{'type':'string','content':_0x3421('0x1b'),'key':null,'keyType':null,'variableName':null},{'type':_0x3421('0xe'),'content':'','key':_0x3421('0x1c'),'keyType':_0x3421('0x5'),'variableName':_0x3421('0x16')},{'type':_0x3421('0xe'),'content':'','key':_0x3421('0x1d'),'keyType':_0x3421('0x5'),'variableName':_0x3421('0x1e')},{'type':_0x3421('0xe'),'content':'','key':'Agent\x20Complete','keyType':'variable','variableName':'agentcompleteAt'},{'type':_0x3421('0xe'),'content':'','key':_0x3421('0x1f'),'keyType':_0x3421('0x5'),'variableName':'holdtime'},{'type':'keyValue','content':'','key':_0x3421('0x20'),'keyType':'variable','variableName':_0x3421('0x21')}];break;case'outbound':_0x2d8676=[{'type':_0x3421('0x1'),'content':_0x3421('0xc'),'variableName':null},{'type':_0x3421('0xe'),'content':'','key':_0x3421('0x22'),'keyType':_0x3421('0x5'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0x3421('0xe'),'content':'','key':'Member\x20Name','keyType':'variable','keyContent':'','variableName':_0x3421('0x23')},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0x3421('0x5'),'keyContent':'','variableName':'uniqueid'},{'type':_0x3421('0xe'),'content':'','key':'Date','keyType':_0x3421('0x5'),'keyContent':'','variableName':_0x3421('0x24')},{'type':'string','content':_0x3421('0x1b')},{'type':_0x3421('0xe'),'content':'','key':_0x3421('0x25'),'keyType':'variable','keyContent':'','variableName':_0x3421('0x26')},{'type':'keyValue','content':'','key':_0x3421('0x27'),'keyType':_0x3421('0x5'),'keyContent':'','variableName':_0x3421('0x28')},{'type':_0x3421('0xe'),'content':'','key':_0x3421('0x29'),'keyType':_0x3421('0x5'),'keyContent':'','variableName':_0x3421('0x2a')},{'type':_0x3421('0xe'),'content':'','key':_0x3421('0x2b'),'keyType':_0x3421('0x5'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x2d8676;}; \ No newline at end of file +var _0x5ba3=['talktime','Called\x20Number','Member\x20Name','membername','starttime','Answer\x20Time','answertime','Complete\x20Time','Duration','duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','calleridnum','outbound','string','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Queue','UniqueId','uniqueid','Date','agentcalledAt','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','holdtime','Talk\x20Time'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x5ba3,0x140));var _0x35ba=function(_0x2b9dfc,_0x266fa8){_0x2b9dfc=_0x2b9dfc-0x0;var _0x1bae14=_0x5ba3[_0x2b9dfc];return _0x1bae14;};'use strict';exports[_0x35ba('0x0')]=function(_0x536d80,_0xa1a1e0){var _0x212d3a=[{'type':'string','content':_0x35ba('0x1'),'variableName':null}];switch(_0x536d80[_0x35ba('0x2')]()){case _0x35ba('0x3'):switch(_0xa1a1e0['toLowerCase']()){case _0x35ba('0x4'):_0x212d3a[_0x35ba('0x5')]({'type':_0x35ba('0x6'),'content':'','variableName':'queue'});_0x212d3a['push']({'type':_0x35ba('0x6'),'content':'','variableName':_0x35ba('0x7')});break;case _0x35ba('0x8'):_0x212d3a['push']({'type':_0x35ba('0x9'),'content':'Outbound\x20Call','variableName':null});_0x212d3a[_0x35ba('0x5')]({'type':_0x35ba('0x6'),'content':'','variableName':_0x35ba('0xa')});break;}}return _0x212d3a;};exports[_0x35ba('0xb')]=function(_0x4c3b87,_0x92bf63){var _0x57d5ee=[];switch(_0x4c3b87['toLowerCase']()){case'voice':switch(_0x92bf63[_0x35ba('0x2')]()){case _0x35ba('0x4'):_0x57d5ee=[{'type':_0x35ba('0x9'),'content':_0x35ba('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x35ba('0xd'),'content':'','key':_0x35ba('0xe'),'keyType':_0x35ba('0x6'),'variableName':_0x35ba('0x7')},{'type':'keyValue','content':'','key':_0x35ba('0xf'),'keyType':_0x35ba('0x6'),'variableName':_0x35ba('0x10')},{'type':_0x35ba('0xd'),'content':'','key':'Call\x20To','keyType':_0x35ba('0x6'),'variableName':'destexten'},{'type':'keyValue','content':'','key':_0x35ba('0x11'),'keyType':_0x35ba('0x6'),'variableName':'queue'},{'type':_0x35ba('0xd'),'content':'','key':_0x35ba('0x12'),'keyType':_0x35ba('0x6'),'variableName':_0x35ba('0x13')},{'type':_0x35ba('0xd'),'content':'','key':_0x35ba('0x14'),'keyType':'variable','variableName':_0x35ba('0x15')},{'type':_0x35ba('0x9'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x35ba('0xd'),'content':'','key':_0x35ba('0x16'),'keyType':_0x35ba('0x6'),'variableName':_0x35ba('0x17')},{'type':_0x35ba('0xd'),'content':'','key':_0x35ba('0x18'),'keyType':_0x35ba('0x6'),'variableName':_0x35ba('0xa')},{'type':_0x35ba('0x9'),'content':_0x35ba('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0x35ba('0xd'),'content':'','key':_0x35ba('0x1a'),'keyType':'variable','variableName':_0x35ba('0x15')},{'type':_0x35ba('0xd'),'content':'','key':_0x35ba('0x1b'),'keyType':_0x35ba('0x6'),'variableName':_0x35ba('0x1c')},{'type':_0x35ba('0xd'),'content':'','key':_0x35ba('0x1d'),'keyType':_0x35ba('0x6'),'variableName':'agentcompleteAt'},{'type':_0x35ba('0xd'),'content':'','key':'Hold\x20Time','keyType':'variable','variableName':_0x35ba('0x1e')},{'type':'keyValue','content':'','key':_0x35ba('0x1f'),'keyType':_0x35ba('0x6'),'variableName':_0x35ba('0x20')}];break;case _0x35ba('0x8'):_0x57d5ee=[{'type':_0x35ba('0x9'),'content':_0x35ba('0xc'),'variableName':null},{'type':_0x35ba('0xd'),'content':'','key':_0x35ba('0x21'),'keyType':_0x35ba('0x6'),'keyContent':'','variableName':_0x35ba('0xa')},{'type':_0x35ba('0xd'),'content':'','key':_0x35ba('0x22'),'keyType':_0x35ba('0x6'),'keyContent':'','variableName':_0x35ba('0x23')},{'type':_0x35ba('0xd'),'content':'','key':_0x35ba('0x12'),'keyType':'variable','keyContent':'','variableName':_0x35ba('0x13')},{'type':_0x35ba('0xd'),'content':'','key':_0x35ba('0x14'),'keyType':_0x35ba('0x6'),'keyContent':'','variableName':_0x35ba('0x24')},{'type':_0x35ba('0x9'),'content':_0x35ba('0x19')},{'type':_0x35ba('0xd'),'content':'','key':_0x35ba('0x25'),'keyType':'variable','keyContent':'','variableName':_0x35ba('0x26')},{'type':_0x35ba('0xd'),'content':'','key':_0x35ba('0x27'),'keyType':_0x35ba('0x6'),'keyContent':'','variableName':'endtime'},{'type':'keyValue','content':'','key':_0x35ba('0x28'),'keyType':_0x35ba('0x6'),'keyContent':'','variableName':_0x35ba('0x29')},{'type':'keyValue','content':'','key':_0x35ba('0x2a'),'keyType':'variable','keyContent':'','variableName':_0x35ba('0x2b')}];break;}}return _0x57d5ee;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index d7ed229..0bf204d 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 _0x54a1=['openchannel-interactions','fax-interactions','sms-interactions','chat-interactions','InteractionId','upperFirst','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','Interaction','findOne','then','update','info','error','tracked','user','query','body','omit','html','phone','fax','lodash','../../config/logger'];(function(_0x28669c,_0x1f62c4){var _0x4a3af6=function(_0x3e25d5){while(--_0x3e25d5){_0x28669c['push'](_0x28669c['shift']());}};_0x4a3af6(++_0x1f62c4);}(_0x54a1,0xf1));var _0x154a=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x54a1[_0x24259d];return _0x5a701;};'use strict';var _=require(_0x154a('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x154a('0x1'))(_0x154a('0x2')),'mail':require('../../config/logger')('mail-interactions'),'fax':require('../../config/logger')(_0x154a('0x3')),'sms':require('../../config/logger')(_0x154a('0x4')),'chat':require('../../config/logger')(_0x154a('0x5')),'whatsapp':require(_0x154a('0x1'))('whatsapp-interactions')};function getInteractionId(_0x311183,_0x465407,_0x139865){if(_0x311183&&_0x311183[_['upperFirst'](_0x139865)+_0x154a('0x6')]){return _0x311183[_[_0x154a('0x7')](_0x139865)+'InteractionId'];}else if(_0x311183&&_0x311183['id']){return _0x311183['id'];}else if(_0x465407&&_0x465407['id']){return _0x465407['id'];}else{return'unknown';}}function log(_0x2c155b,_0x4a7783,_0x296f4a,_0x4e8720,_0x2a8a93,_0xe878ad){loggers[_0x2a8a93[_0x154a('0x8')]()][_0x2c155b](_0x154a('0x9'),_0xe878ad['toUpperCase'](),_0x4a7783?_0x4a7783['id']:null,_0x4a7783?_0x4a7783['name']:null,_0x4a7783?_0x4a7783[_0x154a('0xa')]:null,getInteractionId(_0x296f4a,_0x4e8720,_0x2a8a93),_0x296f4a?JSON[_0x154a('0xb')](_0x296f4a):_0x154a('0xc'));}function updateUser(_0x5e75ce,_0xd5127c,_0x363028,_0x152075,_0x50f8e2){db[_[_0x154a('0x7')](_0x152075)+_0x154a('0xd')][_0x154a('0xe')]({'where':{'id':getInteractionId(_0xd5127c,_0x363028,_0x152075)}})[_0x154a('0xf')](function(_0x478f11){if(_0x478f11){return _0x478f11[_0x154a('0x10')]({'UserId':_0x5e75ce?_0x5e75ce['id']:null});}})[_0x154a('0xf')](function(_0x1c567e){if(_0x1c567e){log(_0x154a('0x11'),_0x5e75ce,_0xd5127c,_0x363028,_0x152075,_0x50f8e2);}})['catch'](function(){log(_0x154a('0x12'),_0x5e75ce,_0xd5127c,_0x363028,_0x152075,_0x50f8e2);});}exports[_0x154a('0x13')]=function(_0x99de63,_0x2a9bfe){return function(_0x2c5830,_0xb19354,_0xd3ecce){var _0x251b83=_0x2c5830[_0x154a('0x14')];var _0x5967bc={};var _0x4d237b=_0x2c5830[_0x154a('0x15')];if(_0x5967bc){_0x5967bc=_['clone'](_0x2c5830[_0x154a('0x16')]);_0x5967bc=_[_0x154a('0x17')](_0x5967bc,[_0x154a('0x16'),_0x154a('0x18'),_0x154a('0x19'),_0x154a('0x1a'),'mobile']);}updateUser(_0x251b83,_0x5967bc,_0x4d237b,_0x99de63,_0x2a9bfe);_0xd3ecce(null);};}; \ No newline at end of file +var _0xaf9b=['sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','toUpperCase','name','role','stringify','then','update','info','tracked','query','body','omit','phone','fax','mobile','lodash','../../config/logger','mail-interactions','fax-interactions'];(function(_0x4f2ac6,_0x518edb){var _0x22e36f=function(_0x5ef505){while(--_0x5ef505){_0x4f2ac6['push'](_0x4f2ac6['shift']());}};_0x22e36f(++_0x518edb);}(_0xaf9b,0x1d7));var _0xbaf9=function(_0x155177,_0x12c72b){_0x155177=_0x155177-0x0;var _0x5d6f46=_0xaf9b[_0x155177];return _0x5d6f46;};'use strict';var _=require(_0xbaf9('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0xbaf9('0x1'))('openchannel-interactions'),'mail':require(_0xbaf9('0x1'))(_0xbaf9('0x2')),'fax':require(_0xbaf9('0x1'))(_0xbaf9('0x3')),'sms':require('../../config/logger')(_0xbaf9('0x4')),'chat':require(_0xbaf9('0x1'))(_0xbaf9('0x5')),'whatsapp':require('../../config/logger')(_0xbaf9('0x6'))};function getInteractionId(_0x3578fd,_0x4db9a3,_0x4a8f38){if(_0x3578fd&&_0x3578fd[_[_0xbaf9('0x7')](_0x4a8f38)+_0xbaf9('0x8')]){return _0x3578fd[_[_0xbaf9('0x7')](_0x4a8f38)+_0xbaf9('0x8')];}else if(_0x3578fd&&_0x3578fd['id']){return _0x3578fd['id'];}else if(_0x4db9a3&&_0x4db9a3['id']){return _0x4db9a3['id'];}else{return _0xbaf9('0x9');}}function log(_0x1356fb,_0x3281cd,_0x34c5da,_0x37a933,_0x1b2d3f,_0x30fa1f){loggers[_0x1b2d3f[_0xbaf9('0xa')]()][_0x1356fb]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x30fa1f[_0xbaf9('0xb')](),_0x3281cd?_0x3281cd['id']:null,_0x3281cd?_0x3281cd[_0xbaf9('0xc')]:null,_0x3281cd?_0x3281cd[_0xbaf9('0xd')]:null,getInteractionId(_0x34c5da,_0x37a933,_0x1b2d3f),_0x34c5da?JSON[_0xbaf9('0xe')](_0x34c5da):'null');}function updateUser(_0x30a913,_0x37bc0c,_0x54d89b,_0x3e27f5,_0x46f3a4){db[_[_0xbaf9('0x7')](_0x3e27f5)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x37bc0c,_0x54d89b,_0x3e27f5)}})[_0xbaf9('0xf')](function(_0x5d96fb){if(_0x5d96fb){return _0x5d96fb[_0xbaf9('0x10')]({'UserId':_0x30a913?_0x30a913['id']:null});}})[_0xbaf9('0xf')](function(_0x2cd568){if(_0x2cd568){log(_0xbaf9('0x11'),_0x30a913,_0x37bc0c,_0x54d89b,_0x3e27f5,_0x46f3a4);}})['catch'](function(){log('error',_0x30a913,_0x37bc0c,_0x54d89b,_0x3e27f5,_0x46f3a4);});}exports[_0xbaf9('0x12')]=function(_0x3e3d4c,_0x17704c){return function(_0x125c7e,_0x2c3ef6,_0x380f02){var _0x1a1d1b=_0x125c7e['user'];var _0x41f050={};var _0x237c18=_0x125c7e[_0xbaf9('0x13')];if(_0x41f050){_0x41f050=_['clone'](_0x125c7e[_0xbaf9('0x14')]);_0x41f050=_[_0xbaf9('0x15')](_0x41f050,[_0xbaf9('0x14'),'html',_0xbaf9('0x16'),_0xbaf9('0x17'),_0xbaf9('0x18')]);}updateUser(_0x1a1d1b,_0x41f050,_0x237c18,_0x3e3d4c,_0x17704c);_0x380f02(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index c7e68e7..1b78a72 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 _0x6d94=['format','%s:%s:%s','update','base64','utf8','final','parse','use','License','then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','crypto','composable-middleware','../../mysqldb','data1','license','split','createDecipher','aes-256-ctr'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x6d94,0x1a1));var _0x46d9=function(_0x5e49e5,_0x401d55){_0x5e49e5=_0x5e49e5-0x0;var _0x807fa5=_0x6d94[_0x5e49e5];return _0x807fa5;};'use strict';var crypto=require(_0x46d9('0x0'));var util=require('util');var compose=require(_0x46d9('0x1'));var db=require(_0x46d9('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0xe27233,_0x4951be){if(_0xe27233&&_0x4951be){if(_0x4951be[_0x46d9('0x3')]&&_0x4951be[_0x46d9('0x4')]){var _0x17ba03=_0x4951be[_0x46d9('0x3')];var _0x312453=_0x4951be[_0x46d9('0x4')];var _0x4ca97a=_0x17ba03[_0x46d9('0x5')]('-')[0x4];var _0x1b781a=_0x17ba03['split']('-')[0x0];var _0x1aab31=crypto[_0x46d9('0x6')](_0x46d9('0x7'),util[_0x46d9('0x8')](_0x46d9('0x9'),_0x4ca97a,_0x17ba03,_0x1b781a));var _0x4ed58c=_0x1aab31[_0x46d9('0xa')](_0x312453,_0x46d9('0xb'),_0x46d9('0xc'));_0x4ed58c+=_0x1aab31[_0x46d9('0xd')]('utf8');var _0x36eaa6=JSON[_0x46d9('0xe')](_0x4ed58c);return _0x36eaa6['hasOwnProperty'](_0xe27233)?_0x36eaa6[_0xe27233]:null;}}return null;}function isLimit(_0x1321d0,_0x311ad8,_0x3e45e7,_0x5380fe){var _0x48f524=_0x311ad8;return compose()[_0x46d9('0xf')](function(_0x80c640,_0x4818e6,_0x11d072){return db[_0x46d9('0x10')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x46d9('0x11')](function(_0x27eaa8){var _0x212c22=getValueFromLicense(_0x1321d0,_0x27eaa8);return _0x212c22?_0x212c22:_0x48f524;})['then'](function(_0x370873){_0x48f524=_0x370873;return _0x3e45e7[_0x46d9('0x12')](_0x5380fe);})[_0x46d9('0x11')](function(_0x229ef7){if(_0x229ef7>=_0x48f524){return _0x4818e6[_0x46d9('0x13')](0x193)['json']({'message':util[_0x46d9('0x8')](_0x46d9('0x14'),_0x1321d0)});}_0x11d072();})[_0x46d9('0x15')](function(_0x2a165e){_0x11d072(_0x2a165e);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x46d9('0x16')],{'where':{'$or':[{'role':_0x46d9('0x17')},{'role':_0x46d9('0x18')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xab17=['then','count','catch','users','User','user','isUserLimit','crypto','util','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','format','update','utf8','final','parse','use','License','findOne'];(function(_0x25b492,_0x4b3669){var _0x20c178=function(_0x242313){while(--_0x242313){_0x25b492['push'](_0x25b492['shift']());}};_0x20c178(++_0x4b3669);}(_0xab17,0x1ea));var _0x7ab1=function(_0x1e694a,_0x110d04){_0x1e694a=_0x1e694a-0x0;var _0x431eef=_0xab17[_0x1e694a];return _0x431eef;};'use strict';var crypto=require(_0x7ab1('0x0'));var util=require(_0x7ab1('0x1'));var compose=require('composable-middleware');var db=require(_0x7ab1('0x2'))['db'];var config=require(_0x7ab1('0x3'));function getValueFromLicense(_0x29c299,_0x302464){if(_0x29c299&&_0x302464){if(_0x302464[_0x7ab1('0x4')]&&_0x302464[_0x7ab1('0x5')]){var _0x21eeab=_0x302464['data1'];var _0x5624d7=_0x302464[_0x7ab1('0x5')];var _0x449485=_0x21eeab[_0x7ab1('0x6')]('-')[0x4];var _0x596e8a=_0x21eeab[_0x7ab1('0x6')]('-')[0x0];var _0x4a6a80=crypto['createDecipher'](_0x7ab1('0x7'),util[_0x7ab1('0x8')]('%s:%s:%s',_0x449485,_0x21eeab,_0x596e8a));var _0x164ab1=_0x4a6a80[_0x7ab1('0x9')](_0x5624d7,'base64',_0x7ab1('0xa'));_0x164ab1+=_0x4a6a80[_0x7ab1('0xb')](_0x7ab1('0xa'));var _0x1093a8=JSON[_0x7ab1('0xc')](_0x164ab1);return _0x1093a8['hasOwnProperty'](_0x29c299)?_0x1093a8[_0x29c299]:null;}}return null;}function isLimit(_0x59fe2e,_0x4989fe,_0x1fc8fe,_0x159f2e){var _0x4bc157=_0x4989fe;return compose()[_0x7ab1('0xd')](function(_0x2b746a,_0x2fa0c1,_0x3f765c){return db[_0x7ab1('0xe')][_0x7ab1('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x7ab1('0x10')](function(_0x5b6411){var _0x5d0dc2=getValueFromLicense(_0x59fe2e,_0x5b6411);return _0x5d0dc2?_0x5d0dc2:_0x4bc157;})[_0x7ab1('0x10')](function(_0x504512){_0x4bc157=_0x504512;return _0x1fc8fe[_0x7ab1('0x11')](_0x159f2e);})[_0x7ab1('0x10')](function(_0x7dcacd){if(_0x7dcacd>=_0x4bc157){return _0x2fa0c1['status'](0x193)['json']({'message':util[_0x7ab1('0x8')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x59fe2e)});}_0x3f765c();})[_0x7ab1('0x12')](function(_0x32c36f){_0x3f765c(_0x32c36f);});});}function isUserLimit(){return isLimit(_0x7ab1('0x13'),0x1,db[_0x7ab1('0x14')],{'where':{'$or':[{'role':'admin'},{'role':_0x7ab1('0x15')}]}});}exports[_0x7ab1('0x16')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index d1b87d4..80f80d3 100644 --- a/server/components/parsers/advancedSearch.js +++ b/server/components/parsers/advancedSearch.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce27=['$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','LIKE\x20?','$lt','$gt','>\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$startsWith','$endsWith','pop','utcOffset','format','hours','seconds','lodash','moment','parseSearch','sqlOperator','[$or]','and','[$and]','replace','split','length','slice','forEach','shift','indexOf','map','conditions','push','buildExpression','DATE','operator','$between','$lte','value','add','days','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','$ne','$notIn','field'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0xce27,0x1f1));var _0x7ce2=function(_0x5e8326,_0x45f7ca){_0x5e8326=_0x5e8326-0x0;var _0x34fca9=_0xce27[_0x5e8326];return _0x34fca9;};'use strict';var _=require(_0x7ce2('0x0'));var moment=require(_0x7ce2('0x1'));exports[_0x7ce2('0x2')]=function(_0x3f3b12){var _0x91b1e1={'conditions':[]};_0x91b1e1[_0x7ce2('0x3')]=_['startsWith'](_0x3f3b12,_0x7ce2('0x4'))?'or':_0x7ce2('0x5');var _0x28800e=_0x3f3b12['replace'](_0x7ce2('0x6'),'')[_0x7ce2('0x7')](_0x7ce2('0x4'),'')[_0x7ce2('0x8')]('||');for(var _0x4f1561=0x0;_0x4f1561<_0x28800e[_0x7ce2('0x9')];_0x4f1561++){var _0x1db86d=_0x28800e[_0x4f1561]['split'](':=');var _0x1ebf62=_0x1db86d[0x0];var _0x49d997=_0x1db86d[_0x7ce2('0xa')](0x1);_0x49d997[_0x7ce2('0xb')](function(_0x153ec8){var _0x18d799=_0x153ec8['split']('[')[_0x7ce2('0xc')]();var _0x3aad7c=_0x153ec8['match'](/\[(.*?)\]/g);_0x3aad7c[_0x7ce2('0xb')](function(_0x2edfb6){var _0x51d042=_0x2edfb6[_0x7ce2('0x8')]('[')['filter'](function(_0x1f3ef8){return _0x1f3ef8[_0x7ce2('0xd')](']')>-0x1;})[_0x7ce2('0xe')](function(_0x46eb28){return _0x46eb28[_0x7ce2('0x8')](']')[0x0];})[0x0];_0x91b1e1[_0x7ce2('0xf')][_0x7ce2('0x10')]({'field':_0x1ebf62,'operator':_0x18d799,'value':_0x51d042});});});}return _0x91b1e1;};exports[_0x7ce2('0x11')]=function(_0x50263c,_0x1f7d1d,_0x435e72){var _0xc175e={};if(_0x1f7d1d===_0x7ce2('0x12')){if(_0x435e72[_0x7ce2('0x13')]==='$eq'){_0x435e72[_0x7ce2('0x13')]=_0x7ce2('0x14');_0x435e72['value']+=','+_0x435e72['value'];}else if(_['includes'](['$gt',_0x7ce2('0x15')],_0x435e72['operator'])){_0x435e72[_0x7ce2('0x16')]=moment(_0x435e72[_0x7ce2('0x16')])[_0x7ce2('0x17')](0x1,_0x7ce2('0x18'))['format'](_0x7ce2('0x19'));}}if(_0x435e72[_0x7ce2('0x1a')]){_0x1f7d1d=_0x435e72[_0x7ce2('0x1a')];_0xc175e[_0x7ce2('0x1b')]=_0x7ce2('0x1c')+_0x50263c+'.'+_0x435e72['field']+_0x7ce2('0x1d')+_0x435e72[_0x7ce2('0x1a')]+')\x20'+parseOperator(_0x435e72[_0x7ce2('0x13')]);}else{_0xc175e[_0x7ce2('0x1b')]=_0x50263c+'.'+_0x435e72['field']+'\x20'+parseOperator(_0x435e72['operator']);}if(_['includes']([_0x7ce2('0x1e'),_0x7ce2('0x1f')],_0x435e72[_0x7ce2('0x13')]))_0xc175e[_0x7ce2('0x1b')]='('+_0xc175e[_0x7ce2('0x1b')]+'\x20OR\x20'+_0x50263c+'.'+_0x435e72[_0x7ce2('0x20')]+'\x20IS\x20NULL)';_0xc175e[_0x7ce2('0x16')]=parseValue(_0x1f7d1d,_0x435e72[_0x7ce2('0x13')],_0x435e72[_0x7ce2('0x16')]);return _0xc175e;};function parseOperator(_0x454a30){var _0x1371c6;switch(_0x454a30){case _0x7ce2('0x21'):_0x1371c6=_0x7ce2('0x22');break;case _0x7ce2('0x1f'):_0x1371c6=_0x7ce2('0x23');break;case'$eq':_0x1371c6=_0x7ce2('0x24');break;case'$ne':_0x1371c6=_0x7ce2('0x25');break;case _0x7ce2('0x26'):case'$startsWith':case'$endsWith':_0x1371c6=_0x7ce2('0x27');break;case _0x7ce2('0x28'):_0x1371c6='<\x20?';break;case _0x7ce2('0x29'):_0x1371c6=_0x7ce2('0x2a');break;case _0x7ce2('0x15'):_0x1371c6='<=\x20?';break;case'$gte':_0x1371c6=_0x7ce2('0x2b');break;case _0x7ce2('0x14'):_0x1371c6=_0x7ce2('0x2c');break;}return _0x1371c6;}function parseValue(_0x5c19fd,_0x389860,_0x108f61){var _0x172dbc={'start':undefined,'end':undefined};switch(_0x389860){case _0x7ce2('0x21'):case _0x7ce2('0x1f'):_0x172dbc[_0x7ce2('0x2d')]=_0x108f61[_0x7ce2('0x8')](',');break;case _0x7ce2('0x26'):_0x172dbc['start']='%'+_0x108f61+'%';break;case _0x7ce2('0x2e'):_0x172dbc[_0x7ce2('0x2d')]=_0x108f61+'%';break;case _0x7ce2('0x2f'):_0x172dbc[_0x7ce2('0x2d')]='%'+_0x108f61;break;case'$between':var _0x34550f=_0x108f61['split'](',');var _0x108f61=_0x34550f['shift']();var _0x5cfc9b=_0x34550f[_0x7ce2('0x30')]();if(_0x5c19fd===_0x7ce2('0x12')){_0x108f61=moment(_0x108f61)[_0x7ce2('0x31')](0x0,!![])[_0x7ce2('0x32')]();_0x5cfc9b=moment(_0x5cfc9b)[_0x7ce2('0x31')](0x0,!![])[_0x7ce2('0x17')](0x17,_0x7ce2('0x33'))[_0x7ce2('0x17')](0x3b,'minutes')['add'](0x3b,_0x7ce2('0x34'))[_0x7ce2('0x32')]();}_0x172dbc={'start':_0x108f61,'end':_0x5cfc9b};break;default:_0x172dbc[_0x7ce2('0x2d')]=_0x108f61;break;}return _0x172dbc;} \ No newline at end of file +var _0x285c=['$gte','BETWEEN\x20?\x20AND\x20?','start','shift','pop','utcOffset','hours','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','forEach','match','filter','indexOf','buildExpression','DATE','$eq','operator','$between','value','includes','$gt','$lte','add','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$notIn','\x20IS\x20NULL)','$in','IN\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?'];(function(_0x5d9867,_0x5e9030){var _0x7d2118=function(_0x2e5149){while(--_0x2e5149){_0x5d9867['push'](_0x5d9867['shift']());}};_0x7d2118(++_0x5e9030);}(_0x285c,0x72));var _0xc285=function(_0x3318ef,_0x2cb6f4){_0x3318ef=_0x3318ef-0x0;var _0x59638a=_0x285c[_0x3318ef];return _0x59638a;};'use strict';var _=require('lodash');var moment=require(_0xc285('0x0'));exports[_0xc285('0x1')]=function(_0x845832){var _0x5babf1={'conditions':[]};_0x5babf1[_0xc285('0x2')]=_[_0xc285('0x3')](_0x845832,_0xc285('0x4'))?'or':_0xc285('0x5');var _0x27c4da=_0x845832[_0xc285('0x6')](_0xc285('0x7'),'')[_0xc285('0x6')](_0xc285('0x4'),'')[_0xc285('0x8')]('||');for(var _0x186d02=0x0;_0x186d02<_0x27c4da[_0xc285('0x9')];_0x186d02++){var _0x349956=_0x27c4da[_0x186d02][_0xc285('0x8')](':=');var _0x14b644=_0x349956[0x0];var _0x2eff6b=_0x349956['slice'](0x1);_0x2eff6b[_0xc285('0xa')](function(_0x5cc94a){var _0x4f4c8e=_0x5cc94a['split']('[')['shift']();var _0x494173=_0x5cc94a[_0xc285('0xb')](/\[(.*?)\]/g);_0x494173[_0xc285('0xa')](function(_0x4c2458){var _0x43cbde=_0x4c2458[_0xc285('0x8')]('[')[_0xc285('0xc')](function(_0x516012){return _0x516012[_0xc285('0xd')](']')>-0x1;})['map'](function(_0x196268){return _0x196268[_0xc285('0x8')](']')[0x0];})[0x0];_0x5babf1['conditions']['push']({'field':_0x14b644,'operator':_0x4f4c8e,'value':_0x43cbde});});});}return _0x5babf1;};exports[_0xc285('0xe')]=function(_0x291e03,_0x14be6e,_0x3fd878){var _0x52c72e={};if(_0x14be6e===_0xc285('0xf')){if(_0x3fd878['operator']===_0xc285('0x10')){_0x3fd878[_0xc285('0x11')]=_0xc285('0x12');_0x3fd878[_0xc285('0x13')]+=','+_0x3fd878[_0xc285('0x13')];}else if(_[_0xc285('0x14')]([_0xc285('0x15'),_0xc285('0x16')],_0x3fd878[_0xc285('0x11')])){_0x3fd878['value']=moment(_0x3fd878['value'])[_0xc285('0x17')](0x1,'days')[_0xc285('0x18')](_0xc285('0x19'));}}if(_0x3fd878[_0xc285('0x1a')]){_0x14be6e=_0x3fd878[_0xc285('0x1a')];_0x52c72e[_0xc285('0x1b')]=_0xc285('0x1c')+_0x291e03+'.'+_0x3fd878[_0xc285('0x1d')]+_0xc285('0x1e')+_0x3fd878[_0xc285('0x1a')]+')\x20'+parseOperator(_0x3fd878[_0xc285('0x11')]);}else{_0x52c72e['text']=_0x291e03+'.'+_0x3fd878[_0xc285('0x1d')]+'\x20'+parseOperator(_0x3fd878[_0xc285('0x11')]);}if(_[_0xc285('0x14')](['$ne',_0xc285('0x1f')],_0x3fd878[_0xc285('0x11')]))_0x52c72e['text']='('+_0x52c72e['text']+'\x20OR\x20'+_0x291e03+'.'+_0x3fd878[_0xc285('0x1d')]+_0xc285('0x20');_0x52c72e['value']=parseValue(_0x14be6e,_0x3fd878['operator'],_0x3fd878[_0xc285('0x13')]);return _0x52c72e;};function parseOperator(_0x58b2ea){var _0x1c085b;switch(_0x58b2ea){case _0xc285('0x21'):_0x1c085b=_0xc285('0x22');break;case _0xc285('0x1f'):_0x1c085b='NOT\x20IN\x20?';break;case _0xc285('0x10'):_0x1c085b='=\x20?';break;case _0xc285('0x23'):_0x1c085b=_0xc285('0x24');break;case _0xc285('0x25'):case _0xc285('0x26'):case _0xc285('0x27'):_0x1c085b=_0xc285('0x28');break;case _0xc285('0x29'):_0x1c085b=_0xc285('0x2a');break;case'$gt':_0x1c085b=_0xc285('0x2b');break;case _0xc285('0x16'):_0x1c085b=_0xc285('0x2c');break;case _0xc285('0x2d'):_0x1c085b='>=\x20?';break;case _0xc285('0x12'):_0x1c085b=_0xc285('0x2e');break;}return _0x1c085b;}function parseValue(_0x9ff102,_0x3b3646,_0x4b9bf4){var _0x4b6739={'start':undefined,'end':undefined};switch(_0x3b3646){case _0xc285('0x21'):case _0xc285('0x1f'):_0x4b6739[_0xc285('0x2f')]=_0x4b9bf4[_0xc285('0x8')](',');break;case'$substring':_0x4b6739['start']='%'+_0x4b9bf4+'%';break;case _0xc285('0x26'):_0x4b6739[_0xc285('0x2f')]=_0x4b9bf4+'%';break;case _0xc285('0x27'):_0x4b6739['start']='%'+_0x4b9bf4;break;case _0xc285('0x12'):var _0x30445f=_0x4b9bf4[_0xc285('0x8')](',');var _0x4b9bf4=_0x30445f[_0xc285('0x30')]();var _0x1bb1a4=_0x30445f[_0xc285('0x31')]();if(_0x9ff102==='DATE'){_0x4b9bf4=moment(_0x4b9bf4)[_0xc285('0x32')](0x0,!![])[_0xc285('0x18')]();_0x1bb1a4=moment(_0x1bb1a4)['utcOffset'](0x0,!![])['add'](0x17,_0xc285('0x33'))[_0xc285('0x17')](0x3b,'minutes')[_0xc285('0x17')](0x3b,_0xc285('0x34'))[_0xc285('0x18')]();}_0x4b6739={'start':_0x4b9bf4,'end':_0x1bb1a4};break;default:_0x4b6739[_0xc285('0x2f')]=_0x4b9bf4;break;}return _0x4b6739;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 7b5f204..2a55ddc 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 _0xb299=['join','lodash','moment','fields','split','filters','isEmpty','forOwn','find','DATE','parse','format','utc','$lte','YYYY-MM-DD','subtract','isArray','limit','offset','sort','map','indexOf','priority','unsigned','substr','DESC','cast','col','ASC','length','omit','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[0-9]*$','getFullTextValue','push','toString'];(function(_0xc7003b,_0xb085b0){var _0x76406c=function(_0x43d459){while(--_0x43d459){_0xc7003b['push'](_0xc7003b['shift']());}};_0x76406c(++_0xb085b0);}(_0xb299,0x19b));var _0x9b29=function(_0x5bb725,_0x2fc0d9){_0x5bb725=_0x5bb725-0x0;var _0x41be84=_0xb299[_0x5bb725];return _0x41be84;};'use strict';var _=require(_0x9b29('0x0'));var sequelize=require('sequelize');var moment=require(_0x9b29('0x1'));var LIMIT_VALUE=0xfa;exports[_0x9b29('0x2')]=function(_0x14663c){var _0x3d0722=null;if(_0x14663c){_0x3d0722=_0x14663c[_0x9b29('0x3')](',');}return _0x3d0722;};exports[_0x9b29('0x4')]=function(_0x3e70a3,_0x5248ce){var _0xd65e9e={};if(!_[_0x9b29('0x5')](_0x3e70a3)){_[_0x9b29('0x6')](_0x3e70a3,function(_0x321436,_0x1a9963){try{if(_0x5248ce){var _0x2f6f26=_[_0x9b29('0x7')](_0x5248ce,{'name':_0x1a9963})||{};if(_0x2f6f26['type']===_0x9b29('0x8')&&_['isPlainObject'](_0x321436)){var _0x4eb6e9=JSON[_0x9b29('0x9')](_0x321436);var _0x9955b2={'$gte':moment(moment(_0x4eb6e9['$gte'])[_0x9b29('0xa')]('YYYY-MM-DD'))[_0x9b29('0xb')]()[_0x9b29('0xa')](),'$lte':moment(moment(_0x4eb6e9[_0x9b29('0xc')])['format'](_0x9b29('0xd')))[_0x9b29('0xb')]()[_0x9b29('0xe')](0x1,'s')[_0x9b29('0xa')]()};_0xd65e9e[_0x1a9963]=_0x9955b2;}else{_0xd65e9e[_0x1a9963]=_[_0x9b29('0xf')](_0x321436)?_0x321436:JSON[_0x9b29('0x9')](_0x321436);}}else{_0xd65e9e[_0x1a9963]=_[_0x9b29('0xf')](_0x321436)?_0x321436:JSON[_0x9b29('0x9')](_0x321436);}}catch(_0xd333bf){_0xd65e9e[_0x1a9963]=_0x321436[_0x9b29('0x3')](',');}});}return _0xd65e9e;};exports[_0x9b29('0x10')]=function(_0x292a5f){_0x292a5f=parseInt(_0x292a5f,0xa);if(!_0x292a5f||_0x292a5f<0x0){_0x292a5f=LIMIT_VALUE;}return _0x292a5f;};exports[_0x9b29('0x11')]=function(_0x22d2cf){_0x22d2cf=parseInt(_0x22d2cf,0xa);if(!_0x22d2cf||_0x22d2cf<0x0){_0x22d2cf=0x0;}return _0x22d2cf;};exports[_0x9b29('0x12')]=function(_0x2e5976){var _0x4773c3,_0x45b857=null;if(_0x2e5976){_0x4773c3=_0x2e5976[_0x9b29('0x3')](',');_0x45b857=_[_0x9b29('0x13')](_0x4773c3,function(_0x28dc39){if(_0x28dc39[_0x9b29('0x14')]('-')===0x0){return[_0x28dc39==='priority'?sequelize['cast'](sequelize['col'](_0x9b29('0x15')),_0x9b29('0x16')):_0x28dc39[_0x9b29('0x17')](0x1),_0x9b29('0x18')];}else{return[_0x28dc39===_0x9b29('0x15')?sequelize[_0x9b29('0x19')](sequelize[_0x9b29('0x1a')](_0x9b29('0x15')),_0x9b29('0x16')):_0x28dc39,_0x9b29('0x1b')];}});}return _0x45b857;};exports['omit']=function(_0x598d3f,_0xdebf3e){if(_[_0x9b29('0x5')](_0x598d3f)){return _0x598d3f;}if(_[_0x9b29('0xf')](_0x598d3f)){for(var _0x140e3c=0x0;_0x140e3c<_0x598d3f[_0x9b29('0x1c')];_0x140e3c+=0x1){_0x598d3f[_0x140e3c]=this[_0x9b29('0x1d')](_0x598d3f[_0x140e3c],_0xdebf3e);}return _0x598d3f;}if(!_[_0x9b29('0x1e')](_0x598d3f)){return _0x598d3f;}if(_[_0x9b29('0x1f')](_0xdebf3e)){_0xdebf3e=[_0xdebf3e];}if(!_[_0x9b29('0xf')](_0xdebf3e)){return _0x598d3f;}for(var _0x2d7279=0x0;_0x2d7279<_0xdebf3e['length'];_0x2d7279+=0x1){_[_0x9b29('0x20')](_0x598d3f,_0xdebf3e[_0x2d7279]);}for(var _0x1861a4 in _0x598d3f){if(_0x598d3f[_0x9b29('0x21')](_0x1861a4)){_0x598d3f[_0x1861a4]=this['omit'](_0x598d3f[_0x1861a4],_0xdebf3e);}}return _0x598d3f;};exports[_0x9b29('0x22')]=function(_0x4c1341){return _0x4c1341[_0x9b29('0x23')](RegExp(_0x9b29('0x24')))?!![]:![];};exports['isEmail']=function(_0x4ef61f){return _0x4ef61f[_0x9b29('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0x9b29('0x25')]=function(_0x50ea3d){var _0x3fa7b6=[];_0x50ea3d[_0x9b29('0x3')]('\x20')['forEach'](function(_0x4113de){_0x3fa7b6[_0x9b29('0x26')]('+'+_0x4113de[_0x9b29('0x27')]()+'*');});return _0x3fa7b6[_0x9b29('0x28')]('\x20');}; \ No newline at end of file +var _0x4b5d=['sort','map','indexOf','priority','col','unsigned','substr','DESC','cast','ASC','omit','length','isString','^[0-9]*$','isEmail','getFullTextValue','forEach','push','toString','join','sequelize','moment','fields','split','filters','isEmpty','forOwn','type','isPlainObject','parse','$gte','format','YYYY-MM-DD','$lte','isArray','limit','offset'];(function(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0x4b5d,0x1ab));var _0xd4b5=function(_0x27d0d8,_0x2b657d){_0x27d0d8=_0x27d0d8-0x0;var _0x2b79d1=_0x4b5d[_0x27d0d8];return _0x2b79d1;};'use strict';var _=require('lodash');var sequelize=require(_0xd4b5('0x0'));var moment=require(_0xd4b5('0x1'));var LIMIT_VALUE=0xfa;exports[_0xd4b5('0x2')]=function(_0x4eb60d){var _0xa81afe=null;if(_0x4eb60d){_0xa81afe=_0x4eb60d[_0xd4b5('0x3')](',');}return _0xa81afe;};exports[_0xd4b5('0x4')]=function(_0x15abce,_0x2d8bb0){var _0x29a626={};if(!_[_0xd4b5('0x5')](_0x15abce)){_[_0xd4b5('0x6')](_0x15abce,function(_0x5b6dda,_0xa767bb){try{if(_0x2d8bb0){var _0x459337=_['find'](_0x2d8bb0,{'name':_0xa767bb})||{};if(_0x459337[_0xd4b5('0x7')]==='DATE'&&_[_0xd4b5('0x8')](_0x5b6dda)){var _0x351a44=JSON[_0xd4b5('0x9')](_0x5b6dda);var _0x5c1695={'$gte':moment(moment(_0x351a44[_0xd4b5('0xa')])[_0xd4b5('0xb')](_0xd4b5('0xc')))['utc']()[_0xd4b5('0xb')](),'$lte':moment(moment(_0x351a44[_0xd4b5('0xd')])[_0xd4b5('0xb')](_0xd4b5('0xc')))['utc']()['subtract'](0x1,'s')[_0xd4b5('0xb')]()};_0x29a626[_0xa767bb]=_0x5c1695;}else{_0x29a626[_0xa767bb]=_[_0xd4b5('0xe')](_0x5b6dda)?_0x5b6dda:JSON[_0xd4b5('0x9')](_0x5b6dda);}}else{_0x29a626[_0xa767bb]=_[_0xd4b5('0xe')](_0x5b6dda)?_0x5b6dda:JSON[_0xd4b5('0x9')](_0x5b6dda);}}catch(_0x258603){_0x29a626[_0xa767bb]=_0x5b6dda[_0xd4b5('0x3')](',');}});}return _0x29a626;};exports[_0xd4b5('0xf')]=function(_0x1bbc0b){_0x1bbc0b=parseInt(_0x1bbc0b,0xa);if(!_0x1bbc0b||_0x1bbc0b<0x0){_0x1bbc0b=LIMIT_VALUE;}return _0x1bbc0b;};exports[_0xd4b5('0x10')]=function(_0x1ab690){_0x1ab690=parseInt(_0x1ab690,0xa);if(!_0x1ab690||_0x1ab690<0x0){_0x1ab690=0x0;}return _0x1ab690;};exports[_0xd4b5('0x11')]=function(_0x2fb47f){var _0x1eaa13,_0x4b892c=null;if(_0x2fb47f){_0x1eaa13=_0x2fb47f[_0xd4b5('0x3')](',');_0x4b892c=_[_0xd4b5('0x12')](_0x1eaa13,function(_0x5e4965){if(_0x5e4965[_0xd4b5('0x13')]('-')===0x0){return[_0x5e4965===_0xd4b5('0x14')?sequelize['cast'](sequelize[_0xd4b5('0x15')](_0xd4b5('0x14')),_0xd4b5('0x16')):_0x5e4965[_0xd4b5('0x17')](0x1),_0xd4b5('0x18')];}else{return[_0x5e4965===_0xd4b5('0x14')?sequelize[_0xd4b5('0x19')](sequelize['col'](_0xd4b5('0x14')),_0xd4b5('0x16')):_0x5e4965,_0xd4b5('0x1a')];}});}return _0x4b892c;};exports[_0xd4b5('0x1b')]=function(_0x190440,_0x5a99ef){if(_[_0xd4b5('0x5')](_0x190440)){return _0x190440;}if(_['isArray'](_0x190440)){for(var _0x75d185=0x0;_0x75d185<_0x190440[_0xd4b5('0x1c')];_0x75d185+=0x1){_0x190440[_0x75d185]=this['omit'](_0x190440[_0x75d185],_0x5a99ef);}return _0x190440;}if(!_['isObject'](_0x190440)){return _0x190440;}if(_[_0xd4b5('0x1d')](_0x5a99ef)){_0x5a99ef=[_0x5a99ef];}if(!_['isArray'](_0x5a99ef)){return _0x190440;}for(var _0x2005c2=0x0;_0x2005c2<_0x5a99ef[_0xd4b5('0x1c')];_0x2005c2+=0x1){_['unset'](_0x190440,_0x5a99ef[_0x2005c2]);}for(var _0x48b3d6 in _0x190440){if(_0x190440['hasOwnProperty'](_0x48b3d6)){_0x190440[_0x48b3d6]=this[_0xd4b5('0x1b')](_0x190440[_0x48b3d6],_0x5a99ef);}}return _0x190440;};exports['isNumeric']=function(_0x5925bb){return _0x5925bb['match'](RegExp(_0xd4b5('0x1e')))?!![]:![];};exports[_0xd4b5('0x1f')]=function(_0x29e1df){return _0x29e1df['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xd4b5('0x20')]=function(_0x5db426){var _0x3dca08=[];_0x5db426[_0xd4b5('0x3')]('\x20')[_0xd4b5('0x21')](function(_0x4ab7ce){_0x3dca08[_0xd4b5('0x22')]('+'+_0x4ab7ce[_0xd4b5('0x23')]()+'*');});return _0x3dca08[_0xd4b5('0x24')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 679ae8f..b066c93 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6385=['cors','moment','./environment','../mysqldb','default','get','env','production','appPath','join','root','public','development','test','set','client','use','json\x20replacer','toISOString','views','/server/views','engine','html','ejs','view\x20engine','urlencoded','50mb','json','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path'];(function(_0x2eac4f,_0x5173f9){var _0x58f73b=function(_0x529f28){while(--_0x529f28){_0x2eac4f['push'](_0x2eac4f['shift']());}};_0x58f73b(++_0x5173f9);}(_0x6385,0x1cd));var _0x5638=function(_0x4f3c9b,_0x28e078){_0x4f3c9b=_0x4f3c9b-0x0;var _0x84e58a=_0x6385[_0x4f3c9b];return _0x84e58a;};'use strict';var express=require(_0x5638('0x0'));var favicon=require(_0x5638('0x1'));var bodyParser=require(_0x5638('0x2'));var methodOverride=require(_0x5638('0x3'));var cookieParser=require(_0x5638('0x4'));var errorHandler=require(_0x5638('0x5'));var path=require(_0x5638('0x6'));var passport=require('passport');var cors=require(_0x5638('0x7'));var moment=require(_0x5638('0x8'));var config=require(_0x5638('0x9'));var db=require(_0x5638('0xa'))['db'];exports[_0x5638('0xb')]=function(_0x163ac9){var _0x4d6c57=_0x163ac9[_0x5638('0xc')](_0x5638('0xd'));if(_0x4d6c57===_0x5638('0xe')){_0x163ac9['set'](_0x5638('0xf'),path[_0x5638('0x10')](config[_0x5638('0x11')],_0x5638('0x12')));}if(_0x4d6c57===_0x5638('0x13')||_0x4d6c57===_0x5638('0x14')){_0x163ac9[_0x5638('0x15')](_0x5638('0xf'),path[_0x5638('0x10')](config[_0x5638('0x11')],_0x5638('0x16')));_0x163ac9[_0x5638('0x17')](errorHandler());}_0x163ac9[_0x5638('0x15')](_0x5638('0x18'),function(_0x6a0261,_0x4f65a0){if(this[_0x6a0261]instanceof Date){_0x4f65a0=this[_0x6a0261][_0x5638('0x19')]()['split']('.')[0x0]+'Z';}return _0x4f65a0;});_0x163ac9[_0x5638('0x17')](express['static'](_0x163ac9[_0x5638('0xc')](_0x5638('0xf'))));_0x163ac9['set'](_0x5638('0x1a'),config[_0x5638('0x11')]+_0x5638('0x1b'));_0x163ac9[_0x5638('0x1c')](_0x5638('0x1d'),require(_0x5638('0x1e'))['renderFile']);_0x163ac9['set'](_0x5638('0x1f'),_0x5638('0x1d'));_0x163ac9[_0x5638('0x17')](bodyParser[_0x5638('0x20')]({'limit':_0x5638('0x21'),'extended':!![]}));_0x163ac9[_0x5638('0x17')](bodyParser[_0x5638('0x22')]({'limit':_0x5638('0x21')}));_0x163ac9[_0x5638('0x17')](cors());_0x163ac9[_0x5638('0x17')](methodOverride());_0x163ac9['use'](cookieParser());_0x163ac9['use'](passport[_0x5638('0x23')]());}; \ No newline at end of file +var _0x3bd3=['join','test','client','use','toISOString','split','static','views','root','engine','html','renderFile','urlencoded','50mb','json','initialize','express','serve-favicon','path','moment','./environment','default','get','env','set','appPath'];(function(_0x1165c5,_0x1f8921){var _0x1c4139=function(_0x319f44){while(--_0x319f44){_0x1165c5['push'](_0x1165c5['shift']());}};_0x1c4139(++_0x1f8921);}(_0x3bd3,0x162));var _0x33bd=function(_0xb66224,_0x3a3f2f){_0xb66224=_0xb66224-0x0;var _0x346365=_0x3bd3[_0xb66224];return _0x346365;};'use strict';var express=require(_0x33bd('0x0'));var favicon=require(_0x33bd('0x1'));var bodyParser=require('body-parser');var methodOverride=require('method-override');var cookieParser=require('cookie-parser');var errorHandler=require('errorhandler');var path=require(_0x33bd('0x2'));var passport=require('passport');var cors=require('cors');var moment=require(_0x33bd('0x3'));var config=require(_0x33bd('0x4'));var db=require('../mysqldb')['db'];exports[_0x33bd('0x5')]=function(_0x25a2ff){var _0x5aecc4=_0x25a2ff[_0x33bd('0x6')](_0x33bd('0x7'));if(_0x5aecc4==='production'){_0x25a2ff[_0x33bd('0x8')](_0x33bd('0x9'),path[_0x33bd('0xa')](config['root'],'public'));}if(_0x5aecc4==='development'||_0x5aecc4===_0x33bd('0xb')){_0x25a2ff[_0x33bd('0x8')](_0x33bd('0x9'),path[_0x33bd('0xa')](config['root'],_0x33bd('0xc')));_0x25a2ff[_0x33bd('0xd')](errorHandler());}_0x25a2ff[_0x33bd('0x8')]('json\x20replacer',function(_0x2ddafa,_0x3a94f7){if(this[_0x2ddafa]instanceof Date){_0x3a94f7=this[_0x2ddafa][_0x33bd('0xe')]()[_0x33bd('0xf')]('.')[0x0]+'Z';}return _0x3a94f7;});_0x25a2ff[_0x33bd('0xd')](express[_0x33bd('0x10')](_0x25a2ff[_0x33bd('0x6')](_0x33bd('0x9'))));_0x25a2ff[_0x33bd('0x8')](_0x33bd('0x11'),config[_0x33bd('0x12')]+'/server/views');_0x25a2ff[_0x33bd('0x13')](_0x33bd('0x14'),require('ejs')[_0x33bd('0x15')]);_0x25a2ff[_0x33bd('0x8')]('view\x20engine','html');_0x25a2ff[_0x33bd('0xd')](bodyParser[_0x33bd('0x16')]({'limit':_0x33bd('0x17'),'extended':!![]}));_0x25a2ff[_0x33bd('0xd')](bodyParser[_0x33bd('0x18')]({'limit':_0x33bd('0x17')}));_0x25a2ff[_0x33bd('0xd')](cors());_0x25a2ff['use'](methodOverride());_0x25a2ff['use'](cookieParser());_0x25a2ff[_0x33bd('0xd')](passport[_0x33bd('0x19')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 9f469f9..ffb28cc 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 _0x3937=['md5','update','digest','hex','getUuid','dmidecode\x20--string\x20system-uuid','hostname','macAddress','substring','lodash','bimedia-machine-uuid','child_process','networkInterfaces','orderBy','keys','length','filter','family','IPv4','head','mac','00:00:00:00:00:00','cpus','model','join','createHash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3937,0xbf));var _0x7393=function(_0x346e0e,_0x1c4fb2){_0x346e0e=_0x346e0e-0x0;var _0x533660=_0x3937[_0x346e0e];return _0x533660;};'use strict';var _=require(_0x7393('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x7393('0x1'));var exec=require(_0x7393('0x2'))['execSync'];function getInterfaces(){var _0x45cd02=[];var _0x503841=os[_0x7393('0x3')]();var _0x4c9c71=_[_0x7393('0x4')](_[_0x7393('0x5')](_0x503841));for(var _0x20011b=0x0;_0x20011b<_0x4c9c71[_0x7393('0x6')];_0x20011b++){var _0x15eabd=_0x503841[_0x4c9c71[_0x20011b]][_0x7393('0x7')](function(_0x3f0800){return _0x3f0800[_0x7393('0x8')]===_0x7393('0x9')&&_0x3f0800['internal']===![];});_0x45cd02=_0x45cd02['concat'](_0x15eabd);}return _0x45cd02;}function getFirstInterface(){var _0x287359=_[_0x7393('0xa')](getInterfaces());return{'macAddress':_0x287359&&_0x287359[_0x7393('0xb')]?_0x287359['mac']:_0x7393('0xc'),'ipAddress':_0x287359&&_0x287359['address']?_0x287359['address']:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0xe00598=_[_0x7393('0x4')](os[_0x7393('0xd')]()['map'](function(_0x79fc4e){return _0x79fc4e[_0x7393('0xe')];}))[_0x7393('0xf')](':');return crypto[_0x7393('0x10')](_0x7393('0x11'))[_0x7393('0x12')](_0xe00598)[_0x7393('0x13')](_0x7393('0x14'));}exports[_0x7393('0x15')]=function(){switch(os['platform']()){case'win32':return exec(_0x7393('0x16'),{'encoding':'utf8'})['replace']('\x0d\x0a','');default:var _0x4e7ec6=getFirstInterface();var _0x82f5fa=getCPUhash();var _0x54dc47=_0x82f5fa+'|'+os[_0x7393('0x17')]()+'|'+_0x4e7ec6[_0x7393('0x18')]+'|'+_0x4e7ec6['ipAddress'];var _0x459abf=crypto['createHash']('md5')[_0x7393('0x12')](_0x54dc47)[_0x7393('0x13')](_0x7393('0x14'));return _0x459abf[_0x7393('0x19')](0x0,0x8)+'-'+_0x459abf[_0x7393('0x19')](0x8,0xc)+'-'+_0x459abf[_0x7393('0x19')](0xc,0x10)+'-'+_0x459abf[_0x7393('0x19')](0x10,0x14)+'-'+_0x459abf[_0x7393('0x19')](0x14);}}; \ No newline at end of file +var _0x43fd=['hex','getUuid','platform','replace','hostname','substring','crypto','execSync','networkInterfaces','orderBy','keys','length','filter','family','IPv4','concat','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','model','join','createHash','md5','update'];(function(_0x2c4e1b,_0x48a2dc){var _0x335117=function(_0x3cac61){while(--_0x3cac61){_0x2c4e1b['push'](_0x2c4e1b['shift']());}};_0x335117(++_0x48a2dc);}(_0x43fd,0x1ec));var _0xd43f=function(_0x417e32,_0x216bae){_0x417e32=_0x417e32-0x0;var _0x2bb8a8=_0x43fd[_0x417e32];return _0x2bb8a8;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0xd43f('0x0'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0xd43f('0x1')];function getInterfaces(){var _0x1ead65=[];var _0x484615=os[_0xd43f('0x2')]();var _0x48f953=_[_0xd43f('0x3')](_[_0xd43f('0x4')](_0x484615));for(var _0x1d36b7=0x0;_0x1d36b7<_0x48f953[_0xd43f('0x5')];_0x1d36b7++){var _0x52e75f=_0x484615[_0x48f953[_0x1d36b7]][_0xd43f('0x6')](function(_0xad5196){return _0xad5196[_0xd43f('0x7')]===_0xd43f('0x8')&&_0xad5196['internal']===![];});_0x1ead65=_0x1ead65[_0xd43f('0x9')](_0x52e75f);}return _0x1ead65;}function getFirstInterface(){var _0x20d066=_['head'](getInterfaces());return{'macAddress':_0x20d066&&_0x20d066[_0xd43f('0xa')]?_0x20d066[_0xd43f('0xa')]:_0xd43f('0xb'),'ipAddress':_0x20d066&&_0x20d066[_0xd43f('0xc')]?_0x20d066[_0xd43f('0xc')]:'127.0.0.1'};}exports[_0xd43f('0xd')]=getFirstInterface;function getCPUhash(){var _0x32e210=_[_0xd43f('0x3')](os[_0xd43f('0xe')]()[_0xd43f('0xf')](function(_0x396916){return _0x396916[_0xd43f('0x10')];}))[_0xd43f('0x11')](':');return crypto[_0xd43f('0x12')](_0xd43f('0x13'))[_0xd43f('0x14')](_0x32e210)['digest'](_0xd43f('0x15'));}exports[_0xd43f('0x16')]=function(){switch(os[_0xd43f('0x17')]()){case'win32':return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0xd43f('0x18')]('\x0d\x0a','');default:var _0x3ca2d4=getFirstInterface();var _0x4f8862=getCPUhash();var _0x3c0953=_0x4f8862+'|'+os[_0xd43f('0x19')]()+'|'+_0x3ca2d4['macAddress']+'|'+_0x3ca2d4['ipAddress'];var _0x4fd639=crypto['createHash'](_0xd43f('0x13'))[_0xd43f('0x14')](_0x3c0953)['digest'](_0xd43f('0x15'));return _0x4fd639[_0xd43f('0x1a')](0x0,0x8)+'-'+_0x4fd639[_0xd43f('0x1a')](0x8,0xc)+'-'+_0x4fd639[_0xd43f('0x1a')](0xc,0x10)+'-'+_0x4fd639['substring'](0x10,0x14)+'-'+_0x4fd639[_0xd43f('0x1a')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 3793e7f..dce392b 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 _0xd117=['THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','diff','days','catch','error','message','finally','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','crypto','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../environment','./hardware','../logger','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','createCipher','secrets','session','update','utf8','base64','final','createDecipher','||FIELD||VALUE||\x0a','findOne','admin','fullname','email','|reason|','|uuid|','|name|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','active','info'];(function(_0x3d4c6f,_0x443db6){var _0x451178=function(_0x35216d){while(--_0x35216d){_0x3d4c6f['push'](_0x3d4c6f['shift']());}};_0x451178(++_0x443db6);}(_0xd117,0x182));var _0x7d11=function(_0x384231,_0x50be41){_0x384231=_0x384231-0x0;var _0x2480bf=_0xd117[_0x384231];return _0x2480bf;};'use strict';var util=require(_0x7d11('0x0'));var crypto=require(_0x7d11('0x1'));var moment=require(_0x7d11('0x2'));var rp=require(_0x7d11('0x3'));var BPromise=require(_0x7d11('0x4'));var pkginfo=require(_0x7d11('0x5'))(module,_0x7d11('0x6'));var db=require(_0x7d11('0x7'))['db'];var config=require(_0x7d11('0x8'));var hardware=require(_0x7d11('0x9'));var logger=require(_0x7d11('0xa'))(_0x7d11('0xb'));var jira=require(_0x7d11('0xc'));var HOST=_0x7d11('0xd');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x345602){return new BPromise(function(_0x3c8d66,_0x47b5e6){var _0x3803b5=util[_0x7d11('0xe')](_0x7d11('0xf'),HOST,_0x345602,module['exports'][_0x7d11('0x6')]);if(oldToken){_0x3803b5=util[_0x7d11('0xe')](_0x7d11('0x10'),HOST,_0x345602,module['exports'][_0x7d11('0x6')],oldToken);}var _0x48b0f1={'uri':_0x3803b5,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x48b0f1)[_0x7d11('0x11')](function(_0x5c6d5d){_0x3c8d66(_0x5c6d5d);})['catch'](function(_0xc52a95){_0x47b5e6(_0xc52a95);});});}function encryptDate(_0x48f576){var _0x4767d5=crypto[_0x7d11('0x12')]('aes-256-ctr',config[_0x7d11('0x13')][_0x7d11('0x14')]);var _0x4cda5d=_0x4767d5[_0x7d11('0x15')](_0x48f576,_0x7d11('0x16'),_0x7d11('0x17'));_0x4cda5d+=_0x4767d5[_0x7d11('0x18')](_0x7d11('0x17'));return _0x4cda5d;}function decryptDate(_0xeae744){var _0x2a269e=crypto[_0x7d11('0x19')]('aes-256-ctr',config[_0x7d11('0x13')][_0x7d11('0x14')]);var _0x169733=_0x2a269e[_0x7d11('0x15')](_0xeae744,_0x7d11('0x17'),'utf8');_0x169733+=_0x2a269e[_0x7d11('0x18')](_0x7d11('0x16'));return _0x169733;}function sendJiraAlert(_0x4d1306,_0x5459df,_0x2ca3a2){var _0x52a6ae=_0x7d11('0x1a');return db['User'][_0x7d11('0x1b')]({'where':{'role':_0x7d11('0x1c')},'attributes':[_0x7d11('0x1d'),_0x7d11('0x1e')],'raw':!![]})[_0x7d11('0x11')](function(_0x117bb9){ADMIN=_0x117bb9;_0x52a6ae+=_0x7d11('0x1f')+_0x2ca3a2+'|\x0a';_0x52a6ae+=_0x7d11('0x20')+_0x4d1306+'|\x0a';_0x52a6ae+='|machineUuid|'+_0x5459df+'|\x0a';_0x52a6ae+=_0x7d11('0x21')+ADMIN['fullname']+'|\x0a';_0x52a6ae+='|email|'+ADMIN['email']+'|\x0a';return _0x52a6ae;})[_0x7d11('0x11')](function(_0x3545dc){var _0x44476c=hardware[_0x7d11('0x22')]()[_0x7d11('0x23')];return jira[_0x7d11('0x24')]({'key':_0x7d11('0x25'),'summary':_0x7d11('0x26'),'description':_0x3545dc,'issuetype':'Alert','oldToken':_0x4d1306,'newToken':_0x5459df,'email':ADMIN[_0x7d11('0x1e')],'name':ADMIN['fullname'],'reason':GRAY_PERIOD_REASON,'ip':_0x44476c});});}function manageLicense(_0x4bfa76,_0x5126cf){var _0x3ba092=_0x5126cf['get']({'plain':!![]});httpRequest(_0x4bfa76)[_0x7d11('0x11')](function(_0x30e4c6){if(oldToken){oldToken=undefined;}if(_0x30e4c6[_0x7d11('0x27')]){if(!_0x3ba092['license']&&_0x3ba092[_0x7d11('0xb')]!=_0x30e4c6[_0x7d11('0xb')]||_0x3ba092[_0x7d11('0xb')]&&_0x3ba092['data2']){logger[_0x7d11('0x28')](_0x7d11('0x29'));}if(_0x3ba092[_0x7d11('0xb')]&&!_0x3ba092[_0x7d11('0x2a')]&&_0x3ba092['license']!=_0x30e4c6[_0x7d11('0xb')]){logger['info'](_0x7d11('0x2b'));}if(_0x3ba092['license']&&!_0x3ba092[_0x7d11('0x2a')]&&_0x3ba092[_0x7d11('0xb')]==_0x30e4c6[_0x7d11('0xb')]){return _0x5126cf;}return _0x5126cf['update']({'data1':_0x4bfa76,'data2':null,'license':_0x30e4c6['license']});}else{if(_0x30e4c6[_0x7d11('0xb')]||_0x3ba092[_0x7d11('0xb')]){if(!_0x3ba092['data2']){if(_0x3ba092[_0x7d11('0x2c')]==_0x4bfa76){GRAY_PERIOD_REASON=_0x7d11('0x2d');logger[_0x7d11('0x28')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x7d11('0x2e');oldToken=_0x3ba092['data1'];logger['info'](_0x7d11('0x2f'),_0x3ba092['data1'],_0x4bfa76);}sendJiraAlert(_0x3ba092[_0x7d11('0x2c')],_0x30e4c6[_0x7d11('0x30')],GRAY_PERIOD_REASON);logger[_0x7d11('0x28')](_0x7d11('0x31'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x7d11('0xe')](_0x7d11('0x32')));return _0x5126cf['update']({'data2':encryptDate(moment()['format'](_0x7d11('0x32')))});}else{if(moment()[_0x7d11('0x33')](decryptDate(_0x3ba092['data2']),_0x7d11('0x34'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0x7d11('0xe')]('YYYY-MM-DD\x20HH:mm'));return _0x5126cf['update']({'data1':_0x4bfa76,'data2':null,'license':null});}}}else{if(_0x3ba092[_0x7d11('0x2c')]!=_0x4bfa76){logger[_0x7d11('0x28')](_0x7d11('0x2f'),_0x3ba092[_0x7d11('0x2c')],_0x4bfa76);return _0x5126cf[_0x7d11('0x15')]({'data1':_0x4bfa76,'data2':null,'license':null});}}}return _0x5126cf;})[_0x7d11('0x11')](function(_0x7c9516){_0x5126cf=_0x7c9516;})[_0x7d11('0x35')](function(_0x2bbaee){logger[_0x7d11('0x36')](_0x2bbaee[_0x7d11('0x37')]);})[_0x7d11('0x38')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x5126cf);},TIME);});}function defaultLicense(){var _0x157731=hardware['getUuid']();if(_0x157731){return db[_0x7d11('0x39')][_0x7d11('0x3a')]({'where':{'id':0x1},'defaults':{'data1':_0x157731}})[_0x7d11('0x3b')](function(_0xa37410,_0x4f8fd2){logger[_0x7d11('0x28')](_0x7d11('0x3c'),_0x157731);manageLicense(_0x157731,_0xa37410);})[_0x7d11('0x35')](function(_0xa900fc){logger['error'](_0xa900fc[_0x7d11('0x37')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xde9f=['|reason|','|uuid|','|machineUuid|','|name|','getFirstInterface','openIssue','MOTLICENSE','Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','Disabled','Changed','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','request-promise','bluebird','version','../../mysqldb','./hardware','../logger','license','../../api/jira/jira.controller','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','createCipher','aes-256-ctr','secrets','session','utf8','base64','final','createDecipher','update','User','findOne','admin','fullname','email'];(function(_0x1be96f,_0x6cf028){var _0x56019f=function(_0x185004){while(--_0x185004){_0x1be96f['push'](_0x1be96f['shift']());}};_0x56019f(++_0x6cf028);}(_0xde9f,0x118));var _0xfde9=function(_0x330414,_0x4f3207){_0x330414=_0x330414-0x0;var _0x99dbff=_0xde9f[_0x330414];return _0x99dbff;};'use strict';var util=require(_0xfde9('0x0'));var crypto=require('crypto');var moment=require('moment');var rp=require(_0xfde9('0x1'));var BPromise=require(_0xfde9('0x2'));var pkginfo=require('pkginfo')(module,_0xfde9('0x3'));var db=require(_0xfde9('0x4'))['db'];var config=require('../environment');var hardware=require(_0xfde9('0x5'));var logger=require(_0xfde9('0x6'))(_0xfde9('0x7'));var jira=require(_0xfde9('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x4c3e01){return new BPromise(function(_0x179ee0,_0x18a202){var _0x5569c2=util[_0xfde9('0x9')](_0xfde9('0xa'),HOST,_0x4c3e01,module[_0xfde9('0xb')][_0xfde9('0x3')]);if(oldToken){_0x5569c2=util[_0xfde9('0x9')](_0xfde9('0xc'),HOST,_0x4c3e01,module[_0xfde9('0xb')][_0xfde9('0x3')],oldToken);}var _0x3fa916={'uri':_0x5569c2,'method':_0xfde9('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x3fa916)[_0xfde9('0xe')](function(_0x350a86){_0x179ee0(_0x350a86);})[_0xfde9('0xf')](function(_0x3bdd36){_0x18a202(_0x3bdd36);});});}function encryptDate(_0x4d6825){var _0x5742c7=crypto[_0xfde9('0x10')](_0xfde9('0x11'),config[_0xfde9('0x12')][_0xfde9('0x13')]);var _0x52aacf=_0x5742c7['update'](_0x4d6825,_0xfde9('0x14'),_0xfde9('0x15'));_0x52aacf+=_0x5742c7[_0xfde9('0x16')](_0xfde9('0x15'));return _0x52aacf;}function decryptDate(_0x29fa8a){var _0x489841=crypto[_0xfde9('0x17')](_0xfde9('0x11'),config[_0xfde9('0x12')]['session']);var _0x31b1c7=_0x489841[_0xfde9('0x18')](_0x29fa8a,_0xfde9('0x15'),'utf8');_0x31b1c7+=_0x489841['final']('utf8');return _0x31b1c7;}function sendJiraAlert(_0x544f19,_0x166f1c,_0x3f1ab3){var _0x48aafd='||FIELD||VALUE||\x0a';return db[_0xfde9('0x19')][_0xfde9('0x1a')]({'where':{'role':_0xfde9('0x1b')},'attributes':[_0xfde9('0x1c'),_0xfde9('0x1d')],'raw':!![]})[_0xfde9('0xe')](function(_0x335e55){ADMIN=_0x335e55;_0x48aafd+=_0xfde9('0x1e')+_0x3f1ab3+'|\x0a';_0x48aafd+=_0xfde9('0x1f')+_0x544f19+'|\x0a';_0x48aafd+=_0xfde9('0x20')+_0x166f1c+'|\x0a';_0x48aafd+=_0xfde9('0x21')+ADMIN[_0xfde9('0x1c')]+'|\x0a';_0x48aafd+='|email|'+ADMIN[_0xfde9('0x1d')]+'|\x0a';return _0x48aafd;})['then'](function(_0x33e016){var _0x159141=hardware[_0xfde9('0x22')]()['ipAddress'];return jira[_0xfde9('0x23')]({'key':_0xfde9('0x24'),'summary':'Motion\x20License\x20Alert','description':_0x33e016,'issuetype':_0xfde9('0x25'),'oldToken':_0x544f19,'newToken':_0x166f1c,'email':ADMIN[_0xfde9('0x1d')],'name':ADMIN[_0xfde9('0x1c')],'reason':GRAY_PERIOD_REASON,'ip':_0x159141});});}function manageLicense(_0x242dae,_0x36967c){var _0x37ad02=_0x36967c[_0xfde9('0x26')]({'plain':!![]});httpRequest(_0x242dae)[_0xfde9('0xe')](function(_0x1457f8){if(oldToken){oldToken=undefined;}if(_0x1457f8[_0xfde9('0x27')]){if(!_0x37ad02[_0xfde9('0x7')]&&_0x37ad02[_0xfde9('0x7')]!=_0x1457f8[_0xfde9('0x7')]||_0x37ad02[_0xfde9('0x7')]&&_0x37ad02[_0xfde9('0x28')]){logger[_0xfde9('0x29')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x37ad02['license']&&!_0x37ad02[_0xfde9('0x28')]&&_0x37ad02[_0xfde9('0x7')]!=_0x1457f8['license']){logger[_0xfde9('0x29')](_0xfde9('0x2a'));}if(_0x37ad02[_0xfde9('0x7')]&&!_0x37ad02[_0xfde9('0x28')]&&_0x37ad02[_0xfde9('0x7')]==_0x1457f8['license']){return _0x36967c;}return _0x36967c[_0xfde9('0x18')]({'data1':_0x242dae,'data2':null,'license':_0x1457f8[_0xfde9('0x7')]});}else{if(_0x1457f8['license']||_0x37ad02[_0xfde9('0x7')]){if(!_0x37ad02[_0xfde9('0x28')]){if(_0x37ad02[_0xfde9('0x2b')]==_0x242dae){GRAY_PERIOD_REASON=_0xfde9('0x2c');logger[_0xfde9('0x29')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xfde9('0x2d');oldToken=_0x37ad02['data1'];logger[_0xfde9('0x29')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x37ad02[_0xfde9('0x2b')],_0x242dae);}sendJiraAlert(_0x37ad02['data1'],_0x1457f8[_0xfde9('0x2e')],GRAY_PERIOD_REASON);logger['info'](_0xfde9('0x2f'),GRAY_PERIOD_REASON[_0xfde9('0x30')](),moment()[_0xfde9('0x9')](_0xfde9('0x31')));return _0x36967c[_0xfde9('0x18')]({'data2':encryptDate(moment()[_0xfde9('0x9')](_0xfde9('0x31')))});}else{if(moment()[_0xfde9('0x32')](decryptDate(_0x37ad02[_0xfde9('0x28')]),_0xfde9('0x33'))>DAYS){logger[_0xfde9('0x29')]('DEMO\x20START\x20AT\x20%s',moment()[_0xfde9('0x9')](_0xfde9('0x31')));return _0x36967c[_0xfde9('0x18')]({'data1':_0x242dae,'data2':null,'license':null});}}}else{if(_0x37ad02[_0xfde9('0x2b')]!=_0x242dae){logger['info'](_0xfde9('0x34'),_0x37ad02[_0xfde9('0x2b')],_0x242dae);return _0x36967c[_0xfde9('0x18')]({'data1':_0x242dae,'data2':null,'license':null});}}}return _0x36967c;})[_0xfde9('0xe')](function(_0x21b30f){_0x36967c=_0x21b30f;})[_0xfde9('0xf')](function(_0x481488){logger[_0xfde9('0x35')](_0x481488['message']);})[_0xfde9('0x36')](function(){setTimeout(function(){manageLicense(hardware[_0xfde9('0x37')](),_0x36967c);},TIME);});}function defaultLicense(){var _0xbd5dd8=hardware['getUuid']();if(_0xbd5dd8){return db[_0xfde9('0x38')][_0xfde9('0x39')]({'where':{'id':0x1},'defaults':{'data1':_0xbd5dd8}})[_0xfde9('0x3a')](function(_0x2f8f83,_0x22e2dc){logger[_0xfde9('0x29')](_0xfde9('0x3b'),_0xbd5dd8);manageLicense(_0xbd5dd8,_0x2f8f83);})[_0xfde9('0xf')](function(_0x552d2d){logger[_0xfde9('0x35')](_0x552d2d[_0xfde9('0x3c')]);});}}exports[_0xfde9('0x3d')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 2a7330d..b857264 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 _0xf068=['lodash','moment','./hardware','../environment','../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8','final','demo','machineUuid','getUuid','session','deadline','days','uuid','disabled','Breaking\x20license','message','2027-01-01T00:00:00.000Z','Demo\x20license','getLicense','License','find','defaults','then','crypto','util'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf068,0x101));var _0x8f06=function(_0x570f1b,_0x4824d3){_0x570f1b=_0x570f1b-0x0;var _0x39a983=_0xf068[_0x570f1b];return _0x39a983;};'use strict';var crypto=require(_0x8f06('0x0'));var util=require(_0x8f06('0x1'));var _=require(_0x8f06('0x2'));var moment=require(_0x8f06('0x3'));var hardware=require(_0x8f06('0x4'));var config=require(_0x8f06('0x5'));var db=require(_0x8f06('0x6'))['db'];function checkLicense(_0x519a4f,_0x2ceaba){if(_0x519a4f){try{var _0x523430=_0x2ceaba||_0x519a4f[_0x8f06('0x7')];if(_[_0x8f06('0x8')](_0x523430)){throw new Error(_0x8f06('0x9'));}var _0x2afd96=_0x519a4f[_0x8f06('0xa')];var _0x11dc35=_0x519a4f[_0x8f06('0xb')];var _0x18e352=_0x2afd96[_0x8f06('0xc')]('-')[0x4];var _0x2c736f=_0x2afd96[_0x8f06('0xc')]('-')[0x0];var _0x5d2049=crypto[_0x8f06('0xd')](_0x8f06('0xe'),util[_0x8f06('0xf')](_0x8f06('0x10'),_0x18e352,_0x2afd96,_0x2c736f));var _0x46d89a=_0x5d2049[_0x8f06('0x11')](_0x523430,'base64',_0x8f06('0x12'));_0x46d89a+=_0x5d2049[_0x8f06('0x13')](_0x8f06('0x12'));var _0x517cf0=JSON['parse'](_0x46d89a);_0x517cf0[_0x8f06('0x14')]=![];_0x517cf0['uuid']=_0x2afd96;_0x517cf0[_0x8f06('0x15')]=hardware[_0x8f06('0x16')]();if(_0x11dc35){var _0x32dae9=crypto[_0x8f06('0xd')](_0x8f06('0xe'),config['secrets'][_0x8f06('0x17')]);var _0x2a6052=_0x32dae9[_0x8f06('0x11')](_0x11dc35,'base64',_0x8f06('0x12'));_0x2a6052+=_0x32dae9['final'](_0x8f06('0x12'));_0x517cf0['gray']=_0x2a6052;_0x517cf0[_0x8f06('0x18')]=moment(_0x2a6052)['add'](0x7,_0x8f06('0x19'))[_0x8f06('0xf')]();_0x517cf0['grayReason']=_0x517cf0[_0x8f06('0x1a')]!=_0x517cf0['machineUuid']?'changed':_0x8f06('0x1b');}return _0x517cf0;}catch(_0x559399){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x8f06('0x1c'),'uuid':_0x519a4f['data1'],'machineUuid':hardware[_0x8f06('0x16')](),'message':_0x559399[_0x8f06('0x1d')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x8f06('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x8f06('0x1f'),'uuid':_0x519a4f['data1'],'machineUuid':hardware[_0x8f06('0x16')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports[_0x8f06('0x20')]=function(_0x50c018){return db[_0x8f06('0x21')][_0x8f06('0x22')](_[_0x8f06('0x23')](_0x50c018,{'raw':!![],'where':{'id':0x1}}))[_0x8f06('0x24')](function(_0x271aaf){return checkLicense(_0x271aaf,null);});};exports['checkLicense']=checkLicense; \ No newline at end of file +var _0x35f2=['then','checkLicense','util','lodash','moment','../../mysqldb','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','utf8','parse','demo','uuid','machineUuid','getUuid','secrets','base64','deadline','add','days','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','Demo\x20license','License','find'];(function(_0x371187,_0xe7b303){var _0x37eaae=function(_0x51d843){while(--_0x51d843){_0x371187['push'](_0x371187['shift']());}};_0x37eaae(++_0xe7b303);}(_0x35f2,0x68));var _0x235f=function(_0x5a5c11,_0x358f6b){_0x5a5c11=_0x5a5c11-0x0;var _0x5d6ba7=_0x35f2[_0x5a5c11];return _0x5d6ba7;};'use strict';var crypto=require('crypto');var util=require(_0x235f('0x0'));var _=require(_0x235f('0x1'));var moment=require(_0x235f('0x2'));var hardware=require('./hardware');var config=require('../environment');var db=require(_0x235f('0x3'))['db'];function checkLicense(_0x48212c,_0x6622fa){if(_0x48212c){try{var _0x466de1=_0x6622fa||_0x48212c['license'];if(_[_0x235f('0x4')](_0x466de1)){throw new Error(_0x235f('0x5'));}var _0x31c167=_0x48212c[_0x235f('0x6')];var _0x2cd07b=_0x48212c[_0x235f('0x7')];var _0x4ca6c3=_0x31c167[_0x235f('0x8')]('-')[0x4];var _0x441c9b=_0x31c167[_0x235f('0x8')]('-')[0x0];var _0x2831aa=crypto[_0x235f('0x9')](_0x235f('0xa'),util[_0x235f('0xb')](_0x235f('0xc'),_0x4ca6c3,_0x31c167,_0x441c9b));var _0x189670=_0x2831aa[_0x235f('0xd')](_0x466de1,'base64',_0x235f('0xe'));_0x189670+=_0x2831aa['final'](_0x235f('0xe'));var _0x515cfd=JSON[_0x235f('0xf')](_0x189670);_0x515cfd[_0x235f('0x10')]=![];_0x515cfd[_0x235f('0x11')]=_0x31c167;_0x515cfd[_0x235f('0x12')]=hardware[_0x235f('0x13')]();if(_0x2cd07b){var _0x47214a=crypto[_0x235f('0x9')](_0x235f('0xa'),config[_0x235f('0x14')]['session']);var _0x4aa0f7=_0x47214a[_0x235f('0xd')](_0x2cd07b,_0x235f('0x15'),_0x235f('0xe'));_0x4aa0f7+=_0x47214a['final']('utf8');_0x515cfd['gray']=_0x4aa0f7;_0x515cfd[_0x235f('0x16')]=moment(_0x4aa0f7)[_0x235f('0x17')](0x7,_0x235f('0x18'))[_0x235f('0xb')]();_0x515cfd[_0x235f('0x19')]=_0x515cfd[_0x235f('0x11')]!=_0x515cfd[_0x235f('0x12')]?_0x235f('0x1a'):_0x235f('0x1b');}return _0x515cfd;}catch(_0xe05334){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x235f('0x1c'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','uuid':_0x48212c[_0x235f('0x6')],'machineUuid':hardware[_0x235f('0x13')](),'message':_0xe05334['message'],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x235f('0x1c'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x235f('0x1d'),'uuid':_0x48212c[_0x235f('0x6')],'machineUuid':hardware[_0x235f('0x13')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};}exports['getLicense']=function(_0x1f925f){return db[_0x235f('0x1e')][_0x235f('0x1f')](_['defaults'](_0x1f925f,{'raw':!![],'where':{'id':0x1}}))[_0x235f('0x20')](function(_0x2ed6e2){return checkLicense(_0x2ed6e2,null);});};exports[_0x235f('0x21')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 3187ef2..53d2b69 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 _0xc4fd=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x5e1df3,_0x4998b6){var _0x3f1719=function(_0x54e018){while(--_0x54e018){_0x5e1df3['push'](_0x5e1df3['shift']());}};_0x3f1719(++_0x4998b6);}(_0xc4fd,0x167));var _0xdc4f=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0xc4fd[_0x519756];return _0x37047e;};'use strict';module[_0xdc4f('0x0')]={'DOMAIN':_0xdc4f('0x1'),'SESSION_SECRET':_0xdc4f('0x2'),'GOOGLE_ID':_0xdc4f('0x3'),'GOOGLE_SECRET':_0xdc4f('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x108a=['http://localhost:9000','myappanuglar-secret'];(function(_0xcde681,_0x2d0464){var _0x4e58bf=function(_0x36e953){while(--_0x36e953){_0xcde681['push'](_0xcde681['shift']());}};_0x4e58bf(++_0x2d0464);}(_0x108a,0x172));var _0xa108=function(_0x131f6e,_0x92b13d){_0x131f6e=_0x131f6e-0x0;var _0x4adf97=_0x108a[_0x131f6e];return _0x4adf97;};'use strict';module['exports']={'DOMAIN':_0xa108('0x0'),'SESSION_SECRET':_0xa108('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 8b512f7..6c33a46 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d86=['YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','transports','File','%s-%s','error','info','Console','env','moment','winston','util','path','join','/var','log','xcally','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s'];(function(_0x27e86e,_0x49d030){var _0x57d83e=function(_0x425a6e){while(--_0x425a6e){_0x27e86e['push'](_0x27e86e['shift']());}};_0x57d83e(++_0x49d030);}(_0x2d86,0x96));var _0x62d8=function(_0x2eb3db,_0x4a32c0){_0x2eb3db=_0x2eb3db-0x0;var _0x358f33=_0x2d86[_0x2eb3db];return _0x358f33;};'use strict';var moment=require(_0x62d8('0x0'));var winston=require(_0x62d8('0x1'));var util=require(_0x62d8('0x2'));var path=require(_0x62d8('0x3'));var debugLevel='INFO';function filename(_0x661c46,_0x590db8){return path[_0x62d8('0x4')](_0x62d8('0x5'),_0x62d8('0x6'),_0x62d8('0x7'),util[_0x62d8('0x8')](_0x62d8('0x9'),_0x661c46,_0x590db8));}function formatter(_0x41de04,_0x39fb11){return util[_0x62d8('0x8')](_0x62d8('0xa'),moment()[_0x62d8('0x8')](_0x62d8('0xb')),_0x39fb11[_0x62d8('0xc')][_0x62d8('0xd')](),_0x41de04,_0x39fb11['message']);}module[_0x62d8('0xe')]=function(_0x3b0320){return new winston[(_0x62d8('0xf'))]({'transports':[new winston[(_0x62d8('0x10'))][(_0x62d8('0x11'))]({'name':util['format'](_0x62d8('0x12'),_0x3b0320,_0x62d8('0x13')),'filename':filename(_0x3b0320,_0x62d8('0x13')),'level':_0x62d8('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xb0b0dc){return formatter(_0x3b0320,_0xb0b0dc);}}),new winston[(_0x62d8('0x10'))]['File']({'name':util[_0x62d8('0x8')](_0x62d8('0x12'),_0x3b0320,_0x62d8('0x14')),'filename':filename(_0x3b0320,_0x62d8('0x14')),'level':_0x62d8('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x464ad9){return formatter(_0x3b0320,_0x464ad9);}}),new winston[(_0x62d8('0x10'))][(_0x62d8('0x15'))]({'level':process[_0x62d8('0x16')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x60c737){return formatter(_0x3b0320,_0x60c737);}})]});}; \ No newline at end of file +var _0x16a4=['exports','transports','File','%s-%s','error','info','moment','winston','util','path','INFO','join','/var','log','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message'];(function(_0x56bdf8,_0x8bf571){var _0x2f44d9=function(_0x34ee87){while(--_0x34ee87){_0x56bdf8['push'](_0x56bdf8['shift']());}};_0x2f44d9(++_0x8bf571);}(_0x16a4,0x1d4));var _0x416a=function(_0x22e170,_0x267235){_0x22e170=_0x22e170-0x0;var _0x4d3dfe=_0x16a4[_0x22e170];return _0x4d3dfe;};'use strict';var moment=require(_0x416a('0x0'));var winston=require(_0x416a('0x1'));var util=require(_0x416a('0x2'));var path=require(_0x416a('0x3'));var debugLevel=_0x416a('0x4');function filename(_0x1e221d,_0x358c67){return path[_0x416a('0x5')](_0x416a('0x6'),_0x416a('0x7'),'xcally',util[_0x416a('0x8')](_0x416a('0x9'),_0x1e221d,_0x358c67));}function formatter(_0x2bb9e2,_0x128e22){return util[_0x416a('0x8')](_0x416a('0xa'),moment()[_0x416a('0x8')](_0x416a('0xb')),_0x128e22[_0x416a('0xc')][_0x416a('0xd')](),_0x2bb9e2,_0x128e22[_0x416a('0xe')]);}module[_0x416a('0xf')]=function(_0x48aad6){return new winston['Logger']({'transports':[new winston[(_0x416a('0x10'))][(_0x416a('0x11'))]({'name':util[_0x416a('0x8')](_0x416a('0x12'),_0x48aad6,_0x416a('0x13')),'filename':filename(_0x48aad6,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1f5ab4){return formatter(_0x48aad6,_0x1f5ab4);}}),new winston[(_0x416a('0x10'))][(_0x416a('0x11'))]({'name':util[_0x416a('0x8')](_0x416a('0x12'),_0x48aad6,_0x416a('0x14')),'filename':filename(_0x48aad6,'info'),'level':_0x416a('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3d59ab){return formatter(_0x48aad6,_0x3d59ab);}}),new winston[(_0x416a('0x10'))]['Console']({'level':process['env']['debugLevel']||debugLevel,'json':![],'formatter':function(_0x49b2bf){return formatter(_0x48aad6,_0x49b2bf);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 017a082..0f2e923 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 _0xed7f=['../../services/express/index.js','ami','join','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/routing/index.js','exports'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xed7f,0xd8));var _0xfed7=function(_0x20e8d6,_0x4d9a75){_0x20e8d6=_0x20e8d6-0x0;var _0x44ea29=_0xed7f[_0x20e8d6];return _0x44ea29;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path['join'](__dirname,_0xfed7('0x0'))},{'name':_0xfed7('0x1'),'script':path[_0xfed7('0x2')](__dirname,_0xfed7('0x3'))},{'name':_0xfed7('0x4'),'script':path[_0xfed7('0x2')](__dirname,_0xfed7('0x5'))},{'name':_0xfed7('0x6'),'script':path[_0xfed7('0x2')](__dirname,'../../services/email/index.js')},{'name':'routing','script':path[_0xfed7('0x2')](__dirname,_0xfed7('0x7'))},{'name':'xdr','script':path[_0xfed7('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0xfed7('0x8')]=config; \ No newline at end of file +var _0x1e69=['routing','../../services/routing/index.js','exports','path','../../services/express/index.js','ami','join','agi','../../services/agi/index.js','email'];(function(_0x1be35b,_0xa49780){var _0xd22f6=function(_0x4322a8){while(--_0x4322a8){_0x1be35b['push'](_0x1be35b['shift']());}};_0xd22f6(++_0xa49780);}(_0x1e69,0x19d));var _0x91e6=function(_0x50745e,_0x4722a9){_0x50745e=_0x50745e-0x0;var _0x17886c=_0x1e69[_0x50745e];return _0x17886c;};'use strict';var path=require(_0x91e6('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path['join'](__dirname,_0x91e6('0x1'))},{'name':_0x91e6('0x2'),'script':path[_0x91e6('0x3')](__dirname,'../../services/ami/index.js')},{'name':_0x91e6('0x4'),'script':path['join'](__dirname,_0x91e6('0x5'))},{'name':_0x91e6('0x6'),'script':path['join'](__dirname,'../../services/email/index.js')},{'name':_0x91e6('0x7'),'script':path['join'](__dirname,_0x91e6('0x8'))},{'name':'xdr','script':path[_0x91e6('0x3')](__dirname,'../../services/xdr/index.js')}]};module[_0x91e6('0x9')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index f05d16e..beb1014 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 _0x8bea=['connect','connected','start','then','stop','disconnect','restart','list','describe','delete','dump','saved','pm2','bluebird','./config'];(function(_0x15b5c4,_0x21f73b){var _0x3703e4=function(_0x2488f1){while(--_0x2488f1){_0x15b5c4['push'](_0x15b5c4['shift']());}};_0x3703e4(++_0x21f73b);}(_0x8bea,0xfc));var _0xa8be=function(_0x555481,_0x4e1bf3){_0x555481=_0x555481-0x0;var _0x4b4a4f=_0x8bea[_0x555481];return _0x4b4a4f;};'use strict';var pm2=require(_0xa8be('0x0'));var BPromise=require(_0xa8be('0x1'));var config=require(_0xa8be('0x2'));function connect(){return new BPromise(function(_0x196b12,_0x2fe52e){return pm2[_0xa8be('0x3')](function(_0x5ac9c1){if(_0x5ac9c1){return _0x2fe52e(_0x5ac9c1);}return _0x196b12(_0xa8be('0x4'));});});};exports[_0xa8be('0x5')]=function(_0x1fc3a0){return connect()[_0xa8be('0x6')](function(){return new BPromise(function(_0x203e17,_0x39d97b){return pm2[_0xa8be('0x5')](_0x1fc3a0,function(_0x200872,_0x4066a2){if(_0x200872){return _0x39d97b(_0x200872);}pm2['disconnect']();return _0x203e17(_0x4066a2);});});});};exports[_0xa8be('0x7')]=function(_0x28363e){return connect()['then'](function(){return new BPromise(function(_0x1c4b09,_0x32eded){return pm2['stop'](_0x28363e,function(_0x27dce4,_0x1c1d9c){if(_0x27dce4){return _0x32eded(_0x27dce4);}pm2[_0xa8be('0x8')]();return _0x1c4b09(_0x1c1d9c);});});});};exports[_0xa8be('0x9')]=function(_0x12c051){return connect()[_0xa8be('0x6')](function(){return new BPromise(function(_0x137cf5,_0x54fa96){return pm2[_0xa8be('0x9')](_0x12c051,function(_0xbca4f,_0x1523b3){if(_0xbca4f){return _0x54fa96(_0xbca4f);}pm2[_0xa8be('0x8')]();return _0x137cf5(_0x1523b3);});});});};exports[_0xa8be('0xa')]=function(){return connect()[_0xa8be('0x6')](function(){return new BPromise(function(_0x5cdc84,_0x4d412d){return pm2[_0xa8be('0xa')](function(_0x253a33,_0x252ab7){if(_0x253a33){return _0x4d412d(_0x253a33);}pm2[_0xa8be('0x8')]();return _0x5cdc84(_0x252ab7);});});});};exports[_0xa8be('0xb')]=function(_0x2b9783){return connect()[_0xa8be('0x6')](function(){return new BPromise(function(_0x129c4f,_0xc49b85){return pm2[_0xa8be('0xb')](_0x2b9783,function(_0x1835ec,_0x347912){if(_0x1835ec){return _0xc49b85(_0x1835ec);}pm2['disconnect']();return _0x129c4f(_0x347912);});});});};exports[_0xa8be('0xc')]=function(_0x4a350b){return connect()[_0xa8be('0x6')](function(){return new BPromise(function(_0x5ccc0b,_0x1beb6a){return pm2[_0xa8be('0xc')](_0x4a350b,function(_0x561340,_0x4dd0b5){if(_0x561340){return _0x1beb6a(_0x561340);}pm2[_0xa8be('0x8')]();return _0x5ccc0b(_0x4dd0b5);});});});};exports[_0xa8be('0xd')]=function(){return connect()[_0xa8be('0x6')](function(){return new BPromise(function(_0x3c1074,_0x5264dd){return pm2[_0xa8be('0xd')](function(_0x25e09e){if(_0x25e09e){return _0x5264dd(_0x25e09e);}return _0x3c1074(_0xa8be('0xe'));});});});}; \ No newline at end of file +var _0x3baf=['disconnect','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','connected','start','then','stop'];(function(_0x1bf45b,_0x1eee87){var _0x3a2d5d=function(_0x423951){while(--_0x423951){_0x1bf45b['push'](_0x1bf45b['shift']());}};_0x3a2d5d(++_0x1eee87);}(_0x3baf,0xf7));var _0xf3ba=function(_0x4fdd16,_0x3174cb){_0x4fdd16=_0x4fdd16-0x0;var _0x553370=_0x3baf[_0x4fdd16];return _0x553370;};'use strict';var pm2=require(_0xf3ba('0x0'));var BPromise=require(_0xf3ba('0x1'));var config=require(_0xf3ba('0x2'));function connect(){return new BPromise(function(_0x3979b3,_0x29bbc2){return pm2[_0xf3ba('0x3')](function(_0xfce22){if(_0xfce22){return _0x29bbc2(_0xfce22);}return _0x3979b3(_0xf3ba('0x4'));});});};exports[_0xf3ba('0x5')]=function(_0x1ae6e6){return connect()[_0xf3ba('0x6')](function(){return new BPromise(function(_0x1c7a62,_0x475268){return pm2[_0xf3ba('0x5')](_0x1ae6e6,function(_0x1284b7,_0x4de144){if(_0x1284b7){return _0x475268(_0x1284b7);}pm2['disconnect']();return _0x1c7a62(_0x4de144);});});});};exports['stop']=function(_0x32f810){return connect()['then'](function(){return new BPromise(function(_0x346f5b,_0x1a2166){return pm2[_0xf3ba('0x7')](_0x32f810,function(_0x40cff2,_0x3a5714){if(_0x40cff2){return _0x1a2166(_0x40cff2);}pm2[_0xf3ba('0x8')]();return _0x346f5b(_0x3a5714);});});});};exports[_0xf3ba('0x9')]=function(_0x318b41){return connect()[_0xf3ba('0x6')](function(){return new BPromise(function(_0x301ca1,_0x302bcb){return pm2[_0xf3ba('0x9')](_0x318b41,function(_0x46c2cf,_0x85939e){if(_0x46c2cf){return _0x302bcb(_0x46c2cf);}pm2[_0xf3ba('0x8')]();return _0x301ca1(_0x85939e);});});});};exports[_0xf3ba('0xa')]=function(){return connect()[_0xf3ba('0x6')](function(){return new BPromise(function(_0x3e44d6,_0x505b8d){return pm2[_0xf3ba('0xa')](function(_0x56816b,_0x815037){if(_0x56816b){return _0x505b8d(_0x56816b);}pm2[_0xf3ba('0x8')]();return _0x3e44d6(_0x815037);});});});};exports[_0xf3ba('0xb')]=function(_0x1e2969){return connect()[_0xf3ba('0x6')](function(){return new BPromise(function(_0x53f848,_0x301856){return pm2[_0xf3ba('0xb')](_0x1e2969,function(_0x13d899,_0x550dd3){if(_0x13d899){return _0x301856(_0x13d899);}pm2[_0xf3ba('0x8')]();return _0x53f848(_0x550dd3);});});});};exports[_0xf3ba('0xc')]=function(_0x430d64){return connect()[_0xf3ba('0x6')](function(){return new BPromise(function(_0x4d3c0a,_0x1e18ed){return pm2[_0xf3ba('0xc')](_0x430d64,function(_0x4e601c,_0x479d65){if(_0x4e601c){return _0x1e18ed(_0x4e601c);}pm2[_0xf3ba('0x8')]();return _0x4d3c0a(_0x479d65);});});});};exports[_0xf3ba('0xd')]=function(){return connect()[_0xf3ba('0x6')](function(){return new BPromise(function(_0x5d351f,_0x375bcf){return pm2[_0xf3ba('0xd')](function(_0x35d6d4){if(_0x35d6d4){return _0x375bcf(_0x35d6d4);}return _0x5d351f(_0xf3ba('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index df5a61a..5156c56 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 _0x6adf=['minutes','system','YYYY-MM-DD\x20HH:mm:ss','map','then','length','emit','chatInteraction:update','catch','start','lodash','ioredis','../../mysqldb','../../config/environment','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','lastMsgAt','subtract'];(function(_0x31a0a3,_0x26f0ae){var _0x4f9d89=function(_0x37916e){while(--_0x37916e){_0x31a0a3['push'](_0x31a0a3['shift']());}};_0x4f9d89(++_0x26f0ae);}(_0x6adf,0x163));var _0xf6ad=function(_0x5f45ba,_0x8dfbc7){_0x5f45ba=_0x5f45ba-0x0;var _0x59501e=_0x6adf[_0x5f45ba];return _0x59501e;};'use strict';var _=require(_0xf6ad('0x0'));var moment=require('moment');var Redis=require(_0xf6ad('0x1'));var db=require(_0xf6ad('0x2'))['db'];var config=require(_0xf6ad('0x3'));config[_0xf6ad('0x4')]=_['defaults'](config[_0xf6ad('0x4')],{'host':_0xf6ad('0x5'),'port':0x18eb});var io=require(_0xf6ad('0x6'))(new Redis(config['redis']));function closeInteractions(){var _0x35f2a2=0x0;var _0x30d709=[];return db[_0xf6ad('0x7')][_0xf6ad('0x8')]({'raw':!![],'attributes':['id',_0xf6ad('0x9')],'where':{'id':0x1}})['then'](function(_0x576acd){_0x35f2a2=_0x576acd[_0xf6ad('0x9')];if(_0x35f2a2){return db[_0xf6ad('0xa')]['findAll']({'raw':!![],'attributes':['id',_0xf6ad('0xb')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xf6ad('0xc')](_0x576acd[_0xf6ad('0x9')],_0xf6ad('0xd'))}}});}else{return[];}})['then'](function(_0x215d6b){_0x30d709=_0x215d6b;if(_0x35f2a2){return db[_0xf6ad('0xa')]['update']({'closeReason':_0xf6ad('0xe'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0xf6ad('0xf'))},{'where':{'id':_[_0xf6ad('0x10')](_0x30d709||[],'id')}});}})[_0xf6ad('0x11')](function(_0x32b4a3){for(var _0x5d977d=0x0;_0x5d977d<_0x30d709[_0xf6ad('0x12')];_0x5d977d++){io[_0xf6ad('0x13')](_0xf6ad('0x14'),{'id':_0x30d709[_0x5d977d]['id'],'closed':!![]});}})[_0xf6ad('0x15')](function(_0xcf6a6e){console['error'](_0xcf6a6e);});}exports[_0xf6ad('0x16')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xcf11=['chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','update','timeout','length','emit','error','start','moment','ioredis','../../mysqldb','../../config/environment','redis','defaults','socket.io-emitter','Setting','find'];(function(_0x2e5008,_0x34e9b2){var _0x375c23=function(_0x298543){while(--_0x298543){_0x2e5008['push'](_0x2e5008['shift']());}};_0x375c23(++_0x34e9b2);}(_0xcf11,0x183));var _0x1cf1=function(_0xc6879,_0x84a966){_0xc6879=_0xc6879-0x0;var _0x54f7a4=_0xcf11[_0xc6879];return _0x54f7a4;};'use strict';var _=require('lodash');var moment=require(_0x1cf1('0x0'));var Redis=require(_0x1cf1('0x1'));var db=require(_0x1cf1('0x2'))['db'];var config=require(_0x1cf1('0x3'));config[_0x1cf1('0x4')]=_[_0x1cf1('0x5')](config[_0x1cf1('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x1cf1('0x6'))(new Redis(config[_0x1cf1('0x4')]));function closeInteractions(){var _0x1d67b4=0x0;var _0x515983=[];return db[_0x1cf1('0x7')][_0x1cf1('0x8')]({'raw':!![],'attributes':['id',_0x1cf1('0x9')],'where':{'id':0x1}})[_0x1cf1('0xa')](function(_0x3ea3bb){_0x1d67b4=_0x3ea3bb[_0x1cf1('0x9')];if(_0x1d67b4){return db[_0x1cf1('0xb')][_0x1cf1('0xc')]({'raw':!![],'attributes':['id',_0x1cf1('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x1cf1('0xe')](_0x3ea3bb[_0x1cf1('0x9')],_0x1cf1('0xf'))}}});}else{return[];}})[_0x1cf1('0xa')](function(_0x5a54a6){_0x515983=_0x5a54a6;if(_0x1d67b4){return db[_0x1cf1('0xb')][_0x1cf1('0x10')]({'closeReason':'system','disposition':_0x1cf1('0x11'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_['map'](_0x515983||[],'id')}});}})[_0x1cf1('0xa')](function(_0x3de1f6){for(var _0x27e079=0x0;_0x27e079<_0x515983[_0x1cf1('0x12')];_0x27e079++){io[_0x1cf1('0x13')]('chatInteraction:update',{'id':_0x515983[_0x27e079]['id'],'closed':!![]});}})['catch'](function(_0x13dab2){console[_0x1cf1('0x14')](_0x13dab2);});}exports[_0x1cf1('0x15')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 872b0fe..aaee876 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 _0x1e9e=['path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','auth','pass','format','\x22%s\x22\x20<%s>','name','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','basename','savename','extname','zip','existsSync','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','status','Sent','text','sendIfEmpty','request','SendMail','then','error','error\x20mail','stringify','email\x20sent','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','exec\x20defaul\x20report\x20id:%s','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','resolve','run\x20job','cron','active','isBetween','endAt','add','add\x20cron','startAt','update','update\x20cron','run','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1e9e,0x16b));var _0xe1e9=function(_0x286019,_0x27c3af){_0x286019=_0x286019-0x0;var _0xa465b8=_0x1e9e[_0x286019];return _0xa465b8;};'use strict';var fs=require('fs');var util=require(_0xe1e9('0x0'));var path=require(_0xe1e9('0x1'));var _=require(_0xe1e9('0x2'));var moment=require(_0xe1e9('0x3'));var CronJobManager=require(_0xe1e9('0x4'));var jayson=require(_0xe1e9('0x5'));var BPromise=require(_0xe1e9('0x6'));var logger=require(_0xe1e9('0x7'))('schedule');var db=require(_0xe1e9('0x8'))['db'];var analyticCustomReportController=require(_0xe1e9('0x9'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client']['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4e7fa7,_0x1b4e5a){return function(){logger[_0xe1e9('0xa')](_0xe1e9('0xb'),_0x4e7fa7[_0xe1e9('0xc')]);var _0xb4fd34=!![];var _0x54eee5={'tls':{'rejectUnauthorized':![]}};if(_0x4e7fa7[_0xe1e9('0xd')][_0xe1e9('0xe')][_0xe1e9('0xf')]){_0x54eee5[_0xe1e9('0xf')]=_0x4e7fa7[_0xe1e9('0xd')][_0xe1e9('0xe')][_0xe1e9('0xf')];}else{_0x54eee5[_0xe1e9('0x10')]=_0x4e7fa7['MailAccount'][_0xe1e9('0xe')]['host'];_0x54eee5['port']=_0x4e7fa7[_0xe1e9('0xd')][_0xe1e9('0xe')][_0xe1e9('0x11')];_0x54eee5['secure']=_0x4e7fa7['MailAccount'][_0xe1e9('0xe')][_0xe1e9('0x12')];}if(_0x4e7fa7[_0xe1e9('0xd')]['Smtp']['authentication']){_0x54eee5[_0xe1e9('0x13')]={'user':_0x4e7fa7[_0xe1e9('0xd')][_0xe1e9('0xe')]['user'],'pass':_0x4e7fa7['MailAccount'][_0xe1e9('0xe')][_0xe1e9('0x14')]};}var _0x340aca={'account':_0x54eee5,'message':{'from':util[_0xe1e9('0x15')](_0xe1e9('0x16'),_0x4e7fa7[_0xe1e9('0xd')][_0xe1e9('0x17')],_0x4e7fa7[_0xe1e9('0xd')]['email']||_0x4e7fa7[_0xe1e9('0xd')]['Smtp'][_0xe1e9('0x18')]),'to':_0x4e7fa7[_0xe1e9('0xc')],'cc':_0x4e7fa7['cc'],'bcc':_0x4e7fa7[_0xe1e9('0x19')],'subject':util[_0xe1e9('0x15')](_0xe1e9('0x1a'),_0x1b4e5a['name'],_0x4e7fa7[_0xe1e9('0x1b')],_0x4e7fa7[_0xe1e9('0x1c')])}};var _0x31e9ae=path[_0xe1e9('0x1d')](__dirname,_0xe1e9('0x1e'));var _0x3062e5=_0x1b4e5a['savename'];var _0x1fb50c=util['format'](_0xe1e9('0x1f'),path[_0xe1e9('0x20')](_0x1b4e5a[_0xe1e9('0x21')],path[_0xe1e9('0x22')](_0x1b4e5a['savename'])),_0xe1e9('0x23'));var _0x5a6b16=path[_0xe1e9('0x1d')](_0x31e9ae,_0x3062e5);var _0x1fa19e=path[_0xe1e9('0x1d')](_0x31e9ae,_0x1fb50c);if(fs[_0xe1e9('0x24')](_0x5a6b16)){_0x1b4e5a['status']='Sent';_0x340aca[_0xe1e9('0x25')][_0xe1e9('0x26')]=[{'filename':_0x3062e5,'path':_0x5a6b16}];_0x340aca[_0xe1e9('0x25')]['text']=util[_0xe1e9('0x15')](_0xe1e9('0x27'),JSON['stringify'](_0x1b4e5a,null,0x2));}else if(fs[_0xe1e9('0x24')](_0x1fa19e)){_0x1b4e5a[_0xe1e9('0x28')]=_0xe1e9('0x29');_0x340aca[_0xe1e9('0x25')]['attachments']=[{'filename':_0x1fb50c,'path':_0x1fa19e}];}else{_0x340aca['message'][_0xe1e9('0x2a')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x4e7fa7[_0xe1e9('0x2b')]){_0xb4fd34=![];logger[_0xe1e9('0xa')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0xb4fd34){return client[_0xe1e9('0x2c')](_0xe1e9('0x2d'),_0x340aca)[_0xe1e9('0x2e')](function(_0x5a7af2){if(_0x5a7af2[_0xe1e9('0x2f')]){return logger['error'](_0xe1e9('0x30'),JSON[_0xe1e9('0x31')](_0x5a7af2));}return logger[_0xe1e9('0xa')](_0xe1e9('0x32'));})[_0xe1e9('0x33')](function(_0x46a28b){return logger['error'](_0xe1e9('0x30'),JSON[_0xe1e9('0x31')](_0x46a28b));});}};}function handleError(){return function(_0x4d83d3){return logger[_0xe1e9('0x2f')](JSON[_0xe1e9('0x31')](_0x4d83d3));};}function handleResult(_0x546b57){return function(_0x2fa417){logger['info']('data',JSON[_0xe1e9('0x31')](_0x2fa417));if(_0x546b57['MailAccount']&&_0x546b57[_0xe1e9('0xd')][_0xe1e9('0xe')]&&!_[_0xe1e9('0x34')](_0x546b57['email'])){setTimeout(handleSendEmail(_0x546b57,_0x2fa417),0x3c*0x3e8);}};}function handleJob(_0xfd939a){return function(){try{if(_[_0xe1e9('0x34')](_0xfd939a['subtractNumber'])){return logger[_0xe1e9('0xa')](_0xe1e9('0x35'));}if(_[_0xe1e9('0x34')](_0xfd939a['subtractUnit'])){return logger[_0xe1e9('0xa')](_0xe1e9('0x36'));}var _0x167f41={'startDate':moment()[_0xe1e9('0x37')](_0xfd939a[_0xe1e9('0x1b')],_0xfd939a[_0xe1e9('0x1c')])[_0xe1e9('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xe1e9('0x15')](_0xe1e9('0x38')),'type':_0xe1e9('0x39'),'output':_0xfd939a['output'],'name':_0xfd939a[_0xe1e9('0x17')]};if(!_[_0xe1e9('0x34')](_0xfd939a['DefaultReportId'])){logger[_0xe1e9('0xa')](_0xe1e9('0x3a'),_0xfd939a[_0xe1e9('0x3b')]);return analyticDefaultReportController['runReport']({'id':_0xfd939a[_0xe1e9('0x3b')]},_0x167f41)[_0xe1e9('0x2e')](handleResult(_0xfd939a))['catch'](handleError());}if(!_[_0xe1e9('0x34')](_0xfd939a[_0xe1e9('0x3c')])){logger[_0xe1e9('0xa')](_0xe1e9('0x3d'),_0xfd939a['CustomReportId']);return analyticCustomReportController[_0xe1e9('0x3e')]({'id':_0xfd939a[_0xe1e9('0x3c')]},_0x167f41)[_0xe1e9('0x2e')](handleResult(_0xfd939a))[_0xe1e9('0x33')](handleError());}}catch(_0x4f1922){logger[_0xe1e9('0x2f')](JSON[_0xe1e9('0x31')](_0x4f1922));}return logger['info'](_0xe1e9('0x3f'));};}function getJobs(_0x398a6d){var _0x1f2112={};if(_0x398a6d){_0x1f2112['id']=_0x398a6d;}return db[_0xe1e9('0x40')][_0xe1e9('0x41')]({'where':_0x1f2112,'include':[{'model':db[_0xe1e9('0xd')],'attributes':['id',_0xe1e9('0x17'),_0xe1e9('0xc')],'include':[{'model':db[_0xe1e9('0x42')],'as':'Smtp'}]}]})[_0xe1e9('0x2e')](function(_0x4522ae){var _0x15fe70=_['keys'](manager['jobs']);var _0x25e2a7=_[_0xe1e9('0x43')](_0x4522ae,function(_0x190e46){return _0x190e46['id'][_0xe1e9('0x44')]();});var _0x5397e3=_[_0xe1e9('0x45')](_0x4522ae,function(_0x3bf67e){return _0x3bf67e['id']['toString']();});var _0x3e0c79=_0x398a6d?_0x25e2a7:_[_0xe1e9('0x46')](_0x25e2a7,_0x15fe70);var _0x514f50=_[_0xe1e9('0x47')](_0x25e2a7,_0x15fe70);var _0x464486=_[_0xe1e9('0x46')](_0x15fe70,_0x25e2a7);var _0x596fc7;var _0x44c29f;for(_0x596fc7=0x0;_0x596fc7<_0x464486[_0xe1e9('0x48')]&&!_0x398a6d;_0x596fc7+=0x1){_0x44c29f=_0x464486[_0x596fc7]['toString']();if(manager[_0xe1e9('0x49')](_0x44c29f)){manager[_0xe1e9('0x4a')](_0x44c29f);manager[_0xe1e9('0x4b')](_0x44c29f);logger[_0xe1e9('0xa')](_0xe1e9('0x4c'),_0x44c29f);}}logger[_0xe1e9('0xa')](_0xe1e9('0x4d'),JSON['stringify'](_0x3e0c79));for(_0x596fc7=0x0;_0x596fc7<_0x3e0c79[_0xe1e9('0x48')];_0x596fc7+=0x1){_0x44c29f=_0x3e0c79[_0x596fc7][_0xe1e9('0x44')]();logger['info'](_0xe1e9('0x4e'),_0x44c29f);if(_0x398a6d){logger['info']('my\x20id',_0x398a6d);logger[_0xe1e9('0xa')](JSON['stringify'](_0x5397e3[_0x44c29f]));BPromise[_0xe1e9('0x4f')]()[_0xe1e9('0x2e')](handleJob(_0x5397e3[_0x44c29f]));logger[_0xe1e9('0xa')](_0xe1e9('0x50'),_0x5397e3[_0x44c29f]['name'],_0x5397e3[_0x44c29f][_0xe1e9('0x51')]);}else if(_0x5397e3[_0x44c29f][_0xe1e9('0x51')]&&_0x5397e3[_0x44c29f][_0xe1e9('0x52')]&&moment()[_0xe1e9('0x53')](_0x5397e3[_0x44c29f]['startAt'],_0x5397e3[_0x44c29f][_0xe1e9('0x54')])){manager[_0xe1e9('0x55')](_0x44c29f,_0x5397e3[_0x44c29f]['cron'],handleJob(_0x5397e3[_0x44c29f]));manager['start'](_0x44c29f);logger[_0xe1e9('0xa')](_0xe1e9('0x56'),_0x5397e3[_0x44c29f][_0xe1e9('0x17')],_0x5397e3[_0x44c29f]['cron']);}else if(manager[_0xe1e9('0x49')](_0x44c29f)){manager[_0xe1e9('0x4a')](_0x44c29f);manager[_0xe1e9('0x4b')](_0x44c29f);logger[_0xe1e9('0xa')]('stop\x20cron',_0x5397e3[_0x44c29f][_0xe1e9('0x17')],_0x5397e3[_0x44c29f][_0xe1e9('0x51')]);}}for(_0x596fc7=0x0,_0x44c29f;_0x596fc7<_0x514f50['length']&&!_0x398a6d;_0x596fc7+=0x1){_0x44c29f=_0x514f50[_0x596fc7][_0xe1e9('0x44')]();if(manager['exists'](_0x44c29f)){if(_0x5397e3[_0x44c29f][_0xe1e9('0x51')]&&_0x5397e3[_0x44c29f][_0xe1e9('0x52')]&&moment()[_0xe1e9('0x53')](_0x5397e3[_0x44c29f][_0xe1e9('0x57')],_0x5397e3[_0x44c29f][_0xe1e9('0x54')])){manager[_0xe1e9('0x58')](_0x44c29f,_0x5397e3[_0x44c29f][_0xe1e9('0x51')],handleJob(_0x5397e3[_0x44c29f]));logger['info'](_0xe1e9('0x59'),_0x5397e3[_0x44c29f][_0xe1e9('0x17')],_0x5397e3[_0x44c29f][_0xe1e9('0x51')]);}else{manager[_0xe1e9('0x4a')](_0x44c29f);manager[_0xe1e9('0x4b')](_0x44c29f);logger[_0xe1e9('0xa')]('stop\x20cron',_0x5397e3[_0x44c29f]['name'],_0x5397e3[_0x44c29f][_0xe1e9('0x51')]);}}}})[_0xe1e9('0x33')](function(_0x3104a1){logger[_0xe1e9('0x2f')](JSON[_0xe1e9('0x31')](_0x3104a1));});}exports[_0xe1e9('0x5a')]=function(_0x5aee99){return getJobs(_0x5aee99);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xc550=['resolve','run\x20job','cron','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','active','update\x20cron','run','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','email','Smtp','service','MailAccount','host','port','secure','authentication','auth','user','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','%s.%s','basename','savename','extname','zip','join','status','attachments','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','Sent','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error\x20mail','catch','error','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','keys','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','index','my\x20id'];(function(_0x3077c3,_0x44c4a9){var _0x134f18=function(_0xb9bf78){while(--_0xb9bf78){_0x3077c3['push'](_0x3077c3['shift']());}};_0x134f18(++_0x44c4a9);}(_0xc550,0x10f));var _0x0c55=function(_0x9ab282,_0x224526){_0x9ab282=_0x9ab282-0x0;var _0x3ae406=_0xc550[_0x9ab282];return _0x3ae406;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x0c55('0x0'));var _=require(_0x0c55('0x1'));var moment=require(_0x0c55('0x2'));var CronJobManager=require(_0x0c55('0x3'));var jayson=require(_0x0c55('0x4'));var BPromise=require(_0x0c55('0x5'));var logger=require(_0x0c55('0x6'))(_0x0c55('0x7'));var db=require(_0x0c55('0x8'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x0c55('0x9'));var client=jayson[_0x0c55('0xa')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xa9e3a8,_0x5f158a){return function(){logger[_0x0c55('0xb')]('Try\x20to\x20send\x20a\x20mail\x20to',_0xa9e3a8[_0x0c55('0xc')]);var _0x34e658=!![];var _0x31f791={'tls':{'rejectUnauthorized':![]}};if(_0xa9e3a8['MailAccount'][_0x0c55('0xd')][_0x0c55('0xe')]){_0x31f791['service']=_0xa9e3a8[_0x0c55('0xf')][_0x0c55('0xd')][_0x0c55('0xe')];}else{_0x31f791[_0x0c55('0x10')]=_0xa9e3a8[_0x0c55('0xf')][_0x0c55('0xd')][_0x0c55('0x10')];_0x31f791[_0x0c55('0x11')]=_0xa9e3a8[_0x0c55('0xf')][_0x0c55('0xd')][_0x0c55('0x11')];_0x31f791[_0x0c55('0x12')]=_0xa9e3a8['MailAccount']['Smtp'][_0x0c55('0x12')];}if(_0xa9e3a8[_0x0c55('0xf')][_0x0c55('0xd')][_0x0c55('0x13')]){_0x31f791[_0x0c55('0x14')]={'user':_0xa9e3a8[_0x0c55('0xf')]['Smtp'][_0x0c55('0x15')],'pass':_0xa9e3a8[_0x0c55('0xf')][_0x0c55('0xd')]['pass']};}var _0xc4fc38={'account':_0x31f791,'message':{'from':util[_0x0c55('0x16')](_0x0c55('0x17'),_0xa9e3a8[_0x0c55('0xf')][_0x0c55('0x18')],_0xa9e3a8[_0x0c55('0xf')][_0x0c55('0xc')]||_0xa9e3a8['MailAccount'][_0x0c55('0xd')]['user']),'to':_0xa9e3a8[_0x0c55('0xc')],'cc':_0xa9e3a8['cc'],'bcc':_0xa9e3a8[_0x0c55('0x19')],'subject':util['format'](_0x0c55('0x1a'),_0x5f158a[_0x0c55('0x18')],_0xa9e3a8[_0x0c55('0x1b')],_0xa9e3a8[_0x0c55('0x1c')])}};var _0x118608=path['join'](__dirname,'../../files/reports');var _0xcc7978=_0x5f158a['savename'];var _0x9a7d91=util[_0x0c55('0x16')](_0x0c55('0x1d'),path[_0x0c55('0x1e')](_0x5f158a[_0x0c55('0x1f')],path[_0x0c55('0x20')](_0x5f158a[_0x0c55('0x1f')])),_0x0c55('0x21'));var _0x11d6c1=path[_0x0c55('0x22')](_0x118608,_0xcc7978);var _0x49b35e=path[_0x0c55('0x22')](_0x118608,_0x9a7d91);if(fs['existsSync'](_0x11d6c1)){_0x5f158a[_0x0c55('0x23')]='Sent';_0xc4fc38['message'][_0x0c55('0x24')]=[{'filename':_0xcc7978,'path':_0x11d6c1}];_0xc4fc38[_0x0c55('0x25')][_0x0c55('0x26')]=util[_0x0c55('0x16')](_0x0c55('0x27'),JSON[_0x0c55('0x28')](_0x5f158a,null,0x2));}else if(fs['existsSync'](_0x49b35e)){_0x5f158a[_0x0c55('0x23')]=_0x0c55('0x29');_0xc4fc38[_0x0c55('0x25')]['attachments']=[{'filename':_0x9a7d91,'path':_0x49b35e}];}else{_0xc4fc38['message'][_0x0c55('0x26')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0xa9e3a8['sendIfEmpty']){_0x34e658=![];logger[_0x0c55('0xb')](_0x0c55('0x2a'));}}if(_0x34e658){return client['request'](_0x0c55('0x2b'),_0xc4fc38)[_0x0c55('0x2c')](function(_0x535a37){if(_0x535a37['error']){return logger['error'](_0x0c55('0x2d'),JSON[_0x0c55('0x28')](_0x535a37));}return logger[_0x0c55('0xb')]('email\x20sent');})[_0x0c55('0x2e')](function(_0x200356){return logger[_0x0c55('0x2f')]('error\x20mail',JSON['stringify'](_0x200356));});}};}function handleError(){return function(_0x5eaeef){return logger[_0x0c55('0x2f')](JSON[_0x0c55('0x28')](_0x5eaeef));};}function handleResult(_0x1478cc){return function(_0x57c9a3){logger[_0x0c55('0xb')](_0x0c55('0x30'),JSON['stringify'](_0x57c9a3));if(_0x1478cc[_0x0c55('0xf')]&&_0x1478cc[_0x0c55('0xf')][_0x0c55('0xd')]&&!_[_0x0c55('0x31')](_0x1478cc[_0x0c55('0xc')])){setTimeout(handleSendEmail(_0x1478cc,_0x57c9a3),0x3c*0x3e8);}};}function handleJob(_0x5d9c13){return function(){try{if(_[_0x0c55('0x31')](_0x5d9c13[_0x0c55('0x1b')])){return logger['info'](_0x0c55('0x32'));}if(_[_0x0c55('0x31')](_0x5d9c13['subtractUnit'])){return logger[_0x0c55('0xb')](_0x0c55('0x33'));}var _0x4ebe62={'startDate':moment()[_0x0c55('0x34')](_0x5d9c13[_0x0c55('0x1b')],_0x5d9c13[_0x0c55('0x1c')])['format'](_0x0c55('0x35')),'endDate':moment()[_0x0c55('0x16')](_0x0c55('0x35')),'type':'scheduled','output':_0x5d9c13[_0x0c55('0x36')],'name':_0x5d9c13[_0x0c55('0x18')]};if(!_['isNil'](_0x5d9c13['DefaultReportId'])){logger[_0x0c55('0xb')]('exec\x20defaul\x20report\x20id:%s',_0x5d9c13[_0x0c55('0x37')]);return analyticDefaultReportController[_0x0c55('0x38')]({'id':_0x5d9c13[_0x0c55('0x37')]},_0x4ebe62)['then'](handleResult(_0x5d9c13))['catch'](handleError());}if(!_[_0x0c55('0x31')](_0x5d9c13['CustomReportId'])){logger[_0x0c55('0xb')](_0x0c55('0x39'),_0x5d9c13[_0x0c55('0x3a')]);return analyticCustomReportController[_0x0c55('0x38')]({'id':_0x5d9c13['CustomReportId']},_0x4ebe62)[_0x0c55('0x2c')](handleResult(_0x5d9c13))['catch'](handleError());}}catch(_0x38e625){logger[_0x0c55('0x2f')](JSON[_0x0c55('0x28')](_0x38e625));}return logger[_0x0c55('0xb')](_0x0c55('0x3b'));};}function getJobs(_0x5e7c46){var _0x3c1a1b={};if(_0x5e7c46){_0x3c1a1b['id']=_0x5e7c46;}return db[_0x0c55('0x3c')][_0x0c55('0x3d')]({'where':_0x3c1a1b,'include':[{'model':db[_0x0c55('0xf')],'attributes':['id',_0x0c55('0x18'),_0x0c55('0xc')],'include':[{'model':db['MailServerOut'],'as':_0x0c55('0xd')}]}]})['then'](function(_0x169f52){var _0x49a748=_[_0x0c55('0x3e')](manager['jobs']);var _0x37ff5a=_['map'](_0x169f52,function(_0x34e3f1){return _0x34e3f1['id'][_0x0c55('0x3f')]();});var _0x57abf6=_[_0x0c55('0x40')](_0x169f52,function(_0x71c947){return _0x71c947['id'][_0x0c55('0x3f')]();});var _0x253385=_0x5e7c46?_0x37ff5a:_[_0x0c55('0x41')](_0x37ff5a,_0x49a748);var _0x23b619=_[_0x0c55('0x42')](_0x37ff5a,_0x49a748);var _0x100395=_['difference'](_0x49a748,_0x37ff5a);var _0x2daec0;var _0x3fd471;for(_0x2daec0=0x0;_0x2daec0<_0x100395[_0x0c55('0x43')]&&!_0x5e7c46;_0x2daec0+=0x1){_0x3fd471=_0x100395[_0x2daec0][_0x0c55('0x3f')]();if(manager[_0x0c55('0x44')](_0x3fd471)){manager[_0x0c55('0x45')](_0x3fd471);manager[_0x0c55('0x46')](_0x3fd471);logger[_0x0c55('0xb')]('delete\x20cron',_0x3fd471);}}logger[_0x0c55('0xb')]('toRun',JSON[_0x0c55('0x28')](_0x253385));for(_0x2daec0=0x0;_0x2daec0<_0x253385[_0x0c55('0x43')];_0x2daec0+=0x1){_0x3fd471=_0x253385[_0x2daec0][_0x0c55('0x3f')]();logger[_0x0c55('0xb')](_0x0c55('0x47'),_0x3fd471);if(_0x5e7c46){logger[_0x0c55('0xb')](_0x0c55('0x48'),_0x5e7c46);logger['info'](JSON[_0x0c55('0x28')](_0x57abf6[_0x3fd471]));BPromise[_0x0c55('0x49')]()['then'](handleJob(_0x57abf6[_0x3fd471]));logger[_0x0c55('0xb')](_0x0c55('0x4a'),_0x57abf6[_0x3fd471][_0x0c55('0x18')],_0x57abf6[_0x3fd471][_0x0c55('0x4b')]);}else if(_0x57abf6[_0x3fd471][_0x0c55('0x4b')]&&_0x57abf6[_0x3fd471]['active']&&moment()[_0x0c55('0x4c')](_0x57abf6[_0x3fd471][_0x0c55('0x4d')],_0x57abf6[_0x3fd471][_0x0c55('0x4e')])){manager[_0x0c55('0x4f')](_0x3fd471,_0x57abf6[_0x3fd471][_0x0c55('0x4b')],handleJob(_0x57abf6[_0x3fd471]));manager[_0x0c55('0x50')](_0x3fd471);logger[_0x0c55('0xb')](_0x0c55('0x51'),_0x57abf6[_0x3fd471]['name'],_0x57abf6[_0x3fd471][_0x0c55('0x4b')]);}else if(manager[_0x0c55('0x44')](_0x3fd471)){manager[_0x0c55('0x45')](_0x3fd471);manager['deleteJob'](_0x3fd471);logger[_0x0c55('0xb')](_0x0c55('0x52'),_0x57abf6[_0x3fd471][_0x0c55('0x18')],_0x57abf6[_0x3fd471]['cron']);}}for(_0x2daec0=0x0,_0x3fd471;_0x2daec0<_0x23b619['length']&&!_0x5e7c46;_0x2daec0+=0x1){_0x3fd471=_0x23b619[_0x2daec0][_0x0c55('0x3f')]();if(manager[_0x0c55('0x44')](_0x3fd471)){if(_0x57abf6[_0x3fd471][_0x0c55('0x4b')]&&_0x57abf6[_0x3fd471][_0x0c55('0x53')]&&moment()[_0x0c55('0x4c')](_0x57abf6[_0x3fd471][_0x0c55('0x4d')],_0x57abf6[_0x3fd471][_0x0c55('0x4e')])){manager['update'](_0x3fd471,_0x57abf6[_0x3fd471][_0x0c55('0x4b')],handleJob(_0x57abf6[_0x3fd471]));logger[_0x0c55('0xb')](_0x0c55('0x54'),_0x57abf6[_0x3fd471][_0x0c55('0x18')],_0x57abf6[_0x3fd471][_0x0c55('0x4b')]);}else{manager['stop'](_0x3fd471);manager[_0x0c55('0x46')](_0x3fd471);logger[_0x0c55('0xb')](_0x0c55('0x52'),_0x57abf6[_0x3fd471][_0x0c55('0x18')],_0x57abf6[_0x3fd471]['cron']);}}}})[_0x0c55('0x2e')](function(_0x378a8b){logger[_0x0c55('0x2f')](JSON[_0x0c55('0x28')](_0x378a8b));});}exports[_0x0c55('0x55')]=function(_0x5d2282){return getJobs(_0x5d2282);};exports[_0x0c55('0x50')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 626a453..74034e8 100644 --- a/server/config/schedule/transcribe.js +++ b/server/config/schedule/transcribe.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b3b=['update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Sequelize','ValidationError','Cloud\x20Provider\x20not\x20available','data1','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20requested','Cloud\x20Provider\x20not\x20configured','Negative','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','start','lodash','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','TranscribeService','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','[RECORDING:%d]\x20Get\x20transcript','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','transcripts','results','length','transcript'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x3b3b,0xc0));var _0xb3b3=function(_0x2b7608,_0xf1ef74){_0x2b7608=_0x2b7608-0x0;var _0x4c23bd=_0x3b3b[_0x2b7608];return _0x4c23bd;};var _=require(_0xb3b3('0x0'));var AWS=require(_0xb3b3('0x1'));var rp=require(_0xb3b3('0x2'));var util=require(_0xb3b3('0x3'));var BPromise=require('bluebird');var db=require(_0xb3b3('0x4'))['db'];var logger=require(_0xb3b3('0x5'))(_0xb3b3('0x6'));function getTranscriptionJob(_0x1720dd,_0x53102f,_0x3b3bfd,_0x4c506b){return new Promise(function(_0x3f401d,_0x3d0f8f){var _0x31dc0a=new AWS[(_0xb3b3('0x7'))]({'accessKeyId':_0x53102f,'secretAccessKey':_0x1720dd,'region':_0x3b3bfd});_0x31dc0a['getTranscriptionJob']({'TranscriptionJobName':_0x4c506b},function(_0x3248bc,_0x1de364){if(_0x3248bc){return _0x3d0f8f(_0x3248bc);}else{return _0x3f401d(_0x1de364);}});});}function sentiment(_0x4b8879,_0x435b72,_0x3249a7,_0x395d5d,_0x48be0f){return new Promise(function(_0x416a6d,_0x355676){var _0x138678=new AWS['Comprehend']({'accessKeyId':_0x435b72,'secretAccessKey':_0x4b8879,'region':_0x3249a7});_0x138678[_0xb3b3('0x8')]({'Text':_0x395d5d,'LanguageCode':_0x48be0f[_0xb3b3('0x9')](0x0,0x2)},function(_0x24f99f,_0x4c3d91){if(_0x24f99f){return _0x355676(_0x24f99f);}else{return _0x416a6d(_0x4c3d91);}});});}function checkTranscribeJob(_0x202b81,_0x118cff,_0x5d8a47){var _0x3899df;return new BPromise(function(_0x396ba4,_0x49514a){logger['info'](util[_0xb3b3('0xa')](_0xb3b3('0xb'),_0x202b81['id'],_0x202b81[_0xb3b3('0xc')]));return getTranscriptionJob(_0x5d8a47['data1'],_0x5d8a47[_0xb3b3('0xd')],_0x118cff[_0xb3b3('0xe')],_0x202b81[_0xb3b3('0xc')])[_0xb3b3('0xf')](function(_0x23b000){logger[_0xb3b3('0x10')](util[_0xb3b3('0xa')](_0xb3b3('0x11'),_0x202b81['id'],_0x202b81[_0xb3b3('0xc')],_0x23b000[_0xb3b3('0x12')][_0xb3b3('0x13')]));if(!_0x202b81[_0xb3b3('0x14')]){switch(_0x23b000[_0xb3b3('0x12')][_0xb3b3('0x13')]){case _0xb3b3('0x15'):var _0x363e5f={'transcribeStatus':_0x23b000[_0xb3b3('0x12')][_0xb3b3('0x13')],'fileUri':_0x23b000[_0xb3b3('0x12')]['Transcript']['TranscriptFileUri']};logger[_0xb3b3('0x10')](util[_0xb3b3('0xa')](_0xb3b3('0x16'),_0x202b81['id']));return rp({'uri':_0x23b000[_0xb3b3('0x12')][_0xb3b3('0x17')][_0xb3b3('0x18')],'json':!![]})['then'](function(_0x1813cb){logger[_0xb3b3('0x10')](util[_0xb3b3('0xa')](_0xb3b3('0x19'),_0x202b81['id']));if(_0x1813cb&&_0x1813cb['results']&&_0x1813cb['results'][_0xb3b3('0x1a')]&&_0x1813cb[_0xb3b3('0x1b')][_0xb3b3('0x1a')][_0xb3b3('0x1c')]){_0x363e5f[_0xb3b3('0x14')]='';for(var _0x4c4565=0x0;_0x4c4565<_0x1813cb['results']['transcripts']['length'];_0x4c4565++){_0x363e5f['fileText']+=_0x1813cb[_0xb3b3('0x1b')]['transcripts'][_0x4c4565][_0xb3b3('0x1d')]+'';}}return _0x202b81[_0xb3b3('0x1e')](_0x363e5f);})['then'](function(){logger[_0xb3b3('0x10')](util[_0xb3b3('0xa')](_0xb3b3('0x1f'),_0x202b81['id']));if(!_0x202b81[_0xb3b3('0x20')]){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x118cff[_0xb3b3('0x21')]||!_0x118cff[_0xb3b3('0x22')]||!_0x118cff[_0xb3b3('0x23')]||!_0x118cff[_0xb3b3('0x24')]||!_0x118cff[_0xb3b3('0x25')]){throw new db['Sequelize']['ValidationError'](_0xb3b3('0x26'));}if(!_0x363e5f[_0xb3b3('0x14')]){throw new Error(_0xb3b3('0x27'));}if(_0x118cff[_0xb3b3('0x22')]===_0x5d8a47['id']){return _0x5d8a47;}else{return db[_0xb3b3('0x28')][_0xb3b3('0x29')]({'where':{'id':_settings[_0xb3b3('0x22')]}});}})[_0xb3b3('0xf')](function(_0x4e845f){if(!_0x4e845f){throw new db[(_0xb3b3('0x2a'))][(_0xb3b3('0x2b'))](_0xb3b3('0x2c'));}if(!_0x4e845f[_0xb3b3('0x2d')]||!_0x4e845f[_0xb3b3('0xd')]){throw new db[(_0xb3b3('0x2a'))][(_0xb3b3('0x2b'))]('Cloud\x20Provider\x20not\x20configured');}_0x3899df=_0x4e845f;logger['info'](util['format'](_0xb3b3('0x2e'),_0x202b81['id']));return sentiment(_0x3899df[_0xb3b3('0x2d')],_0x3899df['data2'],_0x118cff[_0xb3b3('0x23')],_0x363e5f[_0xb3b3('0x14')],_0x118cff['language']);})[_0xb3b3('0xf')](function(_0x2c49a6){logger[_0xb3b3('0x10')](util[_0xb3b3('0xa')](_0xb3b3('0x2f'),_0x202b81['id']));return _0x202b81[_0xb3b3('0x1e')]({'sentiment':_0x2c49a6[_0xb3b3('0x30')],'sPositive':_0x2c49a6[_0xb3b3('0x31')]['Positive'],'sNegative':_0x2c49a6[_0xb3b3('0x31')]['Negative'],'sMixed':_0x2c49a6[_0xb3b3('0x31')][_0xb3b3('0x32')],'sNeutral':_0x2c49a6[_0xb3b3('0x31')][_0xb3b3('0x33')]});})[_0xb3b3('0xf')](function(){logger[_0xb3b3('0x10')](util[_0xb3b3('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x202b81['id']));_0x396ba4();});case _0xb3b3('0x34'):return _0x202b81['update']({'transcribeStatus':'FAILED','failureReason':_0x23b000[_0xb3b3('0x12')]['FailureReason']})[_0xb3b3('0xf')](function(){logger[_0xb3b3('0x10')](util[_0xb3b3('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x202b81['id']));_0x396ba4();});default:logger[_0xb3b3('0x10')](util['format'](_0xb3b3('0x35'),_0x202b81['id']));break;}}else{return BPromise[_0xb3b3('0x36')]()[_0xb3b3('0xf')](function(){if(!_0x202b81[_0xb3b3('0x20')]){throw new db[(_0xb3b3('0x2a'))][(_0xb3b3('0x2b'))](_0xb3b3('0x37'));}if(!_0x118cff['sentiment']||!_0x118cff[_0xb3b3('0x22')]||!_0x118cff[_0xb3b3('0x23')]||!_0x118cff[_0xb3b3('0x24')]||!_0x118cff[_0xb3b3('0x25')]){throw new db[(_0xb3b3('0x2a'))][(_0xb3b3('0x2b'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x202b81[_0xb3b3('0x14')]){throw new Error(_0xb3b3('0x27'));}if(_0x118cff[_0xb3b3('0x22')]===_0x5d8a47['id']){return _0x5d8a47;}else{return db[_0xb3b3('0x28')][_0xb3b3('0x29')]({'where':{'id':_settings[_0xb3b3('0x22')]}});}})[_0xb3b3('0xf')](function(_0x442909){if(!_0x442909){throw new db[(_0xb3b3('0x2a'))][(_0xb3b3('0x2b'))](_0xb3b3('0x2c'));}if(!_0x442909['data1']||!_0x442909[_0xb3b3('0xd')]){throw new db['Sequelize'][(_0xb3b3('0x2b'))](_0xb3b3('0x38'));}_0x3899df=_0x442909;logger[_0xb3b3('0x10')](util[_0xb3b3('0xa')](_0xb3b3('0x2e'),_0x202b81['id']));return sentiment(_0x3899df[_0xb3b3('0x2d')],_0x3899df[_0xb3b3('0xd')],_0x118cff['sentimentRegion'],_0x202b81[_0xb3b3('0x14')],_0x118cff[_0xb3b3('0x24')]);})[_0xb3b3('0xf')](function(_0x5be0cd){logger['info'](util[_0xb3b3('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x202b81['id']));return _0x202b81['update']({'sentiment':_0x5be0cd[_0xb3b3('0x30')],'sPositive':_0x5be0cd[_0xb3b3('0x31')]['Positive'],'sNegative':_0x5be0cd[_0xb3b3('0x31')][_0xb3b3('0x39')],'sMixed':_0x5be0cd[_0xb3b3('0x31')][_0xb3b3('0x32')],'sNeutral':_0x5be0cd[_0xb3b3('0x31')][_0xb3b3('0x33')],'transcribeStatus':'COMPLETED'});})['then'](function(){logger[_0xb3b3('0x10')](util[_0xb3b3('0xa')](_0xb3b3('0x1f'),_0x202b81['id']));_0x396ba4();});}})[_0xb3b3('0x3a')](function(_0x1c16e5){if(_0x1c16e5){if(!_0x1c16e5[_0xb3b3('0x3b')]||_0x1c16e5['name']!==_0xb3b3('0x3c')){logger[_0xb3b3('0x3d')](util[_0xb3b3('0xa')](_0xb3b3('0x3e'),_0x202b81['id']),util[_0xb3b3('0x3f')](_0x1c16e5,{'showHidden':![],'depth':null}));}}_0x396ba4();});});}function checkTranscribe(){var _0x5ccf49;var _0x5d2fa3;var _0x265960;return db[_0xb3b3('0x40')][_0xb3b3('0x41')]({'where':{'transcribeStatus':_0xb3b3('0x42')}})[_0xb3b3('0xf')](function(_0x436150){if(!_0x436150||!_0x436150[_0xb3b3('0x1c')]){throw new db[(_0xb3b3('0x2a'))][(_0xb3b3('0x2b'))](_0xb3b3('0x43'));}_0x5ccf49=_0x436150;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0xb3b3('0xf')](function(_0x208656){if(!_0x208656){throw new db[(_0xb3b3('0x2a'))][(_0xb3b3('0x2b'))]('Settings\x20not\x20available');}_0x5d2fa3=_0x208656;if(!_0x5d2fa3['transcribe']||!_0x5d2fa3[_0xb3b3('0x44')]||!_0x5d2fa3['transcribeRegion']||!_0x5d2fa3[_0xb3b3('0x24')]||!_0x5d2fa3[_0xb3b3('0x25')]){throw new db[(_0xb3b3('0x2a'))][(_0xb3b3('0x2b'))](_0xb3b3('0x45'));}return db['CloudProvider'][_0xb3b3('0x29')]({'where':{'id':_0x5d2fa3[_0xb3b3('0x44')]}});})['then'](function(_0x2c743d){if(!_0x2c743d){throw new db[(_0xb3b3('0x2a'))][(_0xb3b3('0x2b'))](_0xb3b3('0x2c'));}if(!_0x2c743d[_0xb3b3('0x2d')]||!_0x2c743d[_0xb3b3('0xd')]){throw new db['Sequelize'][(_0xb3b3('0x2b'))]('Cloud\x20Provider\x20not\x20configured');}_0x265960=_0x2c743d;var _0x18c32a=[];_0x5ccf49[_0xb3b3('0x46')](function(_0x21bf92){_0x18c32a[_0xb3b3('0x47')](checkTranscribeJob(_0x21bf92,_0x5d2fa3,_0x265960));});return BPromise[_0xb3b3('0x48')](_0x18c32a);})[_0xb3b3('0x3a')](function(_0x4f5720){if(_0x4f5720){if(!_0x4f5720['name']||_0x4f5720['name']!=='SequelizeValidationError'){logger[_0xb3b3('0x3d')](util[_0xb3b3('0x3f')](_0x4f5720,{'showHidden':![],'depth':null}));}}});}exports[_0xb3b3('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x0a46=['results','transcripts','length','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','Cloud\x20Provider\x20not\x20configured','Negative','catch','name','SequelizeValidationError','inspect','VoiceRecording','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','start','aws-sdk','util','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','fileText','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript'];(function(_0xb182c1,_0x293c93){var _0x43932d=function(_0x46d22f){while(--_0x46d22f){_0xb182c1['push'](_0xb182c1['shift']());}};_0x43932d(++_0x293c93);}(_0x0a46,0x177));var _0x60a4=function(_0x40248e,_0xbb7396){_0x40248e=_0x40248e-0x0;var _0x19b76=_0x0a46[_0x40248e];return _0x19b76;};var _=require('lodash');var AWS=require(_0x60a4('0x0'));var rp=require('request-promise');var util=require(_0x60a4('0x1'));var BPromise=require('bluebird');var db=require(_0x60a4('0x2'))['db'];var logger=require(_0x60a4('0x3'))('transcribe');function getTranscriptionJob(_0x116e0c,_0x2b5769,_0x3858cc,_0x5778dc){return new Promise(function(_0x4ec5c5,_0x36232b){var _0x51db14=new AWS[(_0x60a4('0x4'))]({'accessKeyId':_0x2b5769,'secretAccessKey':_0x116e0c,'region':_0x3858cc});_0x51db14[_0x60a4('0x5')]({'TranscriptionJobName':_0x5778dc},function(_0x4c030c,_0x477696){if(_0x4c030c){return _0x36232b(_0x4c030c);}else{return _0x4ec5c5(_0x477696);}});});}function sentiment(_0x424597,_0x97586e,_0x5d75e7,_0x365a92,_0x1e0057){return new Promise(function(_0x5d5536,_0x3d1669){var _0x211660=new AWS['Comprehend']({'accessKeyId':_0x97586e,'secretAccessKey':_0x424597,'region':_0x5d75e7});_0x211660[_0x60a4('0x6')]({'Text':_0x365a92,'LanguageCode':_0x1e0057['substring'](0x0,0x2)},function(_0x52efcc,_0x564381){if(_0x52efcc){return _0x3d1669(_0x52efcc);}else{return _0x5d5536(_0x564381);}});});}function checkTranscribeJob(_0x50b9a9,_0x1c12e5,_0x31a690){var _0x4e6a56;return new BPromise(function(_0x588a4e,_0xb7fd70){logger[_0x60a4('0x7')](util[_0x60a4('0x8')](_0x60a4('0x9'),_0x50b9a9['id'],_0x50b9a9[_0x60a4('0xa')]));return getTranscriptionJob(_0x31a690[_0x60a4('0xb')],_0x31a690[_0x60a4('0xc')],_0x1c12e5['transcribeRegion'],_0x50b9a9[_0x60a4('0xa')])[_0x60a4('0xd')](function(_0x4a7b00){logger[_0x60a4('0x7')](util[_0x60a4('0x8')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x50b9a9['id'],_0x50b9a9[_0x60a4('0xa')],_0x4a7b00['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x50b9a9[_0x60a4('0xe')]){switch(_0x4a7b00[_0x60a4('0xf')][_0x60a4('0x10')]){case _0x60a4('0x11'):var _0x524d45={'transcribeStatus':_0x4a7b00[_0x60a4('0xf')][_0x60a4('0x10')],'fileUri':_0x4a7b00[_0x60a4('0xf')][_0x60a4('0x12')][_0x60a4('0x13')]};logger[_0x60a4('0x7')](util[_0x60a4('0x8')](_0x60a4('0x14'),_0x50b9a9['id']));return rp({'uri':_0x4a7b00['TranscriptionJob']['Transcript']['TranscriptFileUri'],'json':!![]})['then'](function(_0x4dd76e){logger[_0x60a4('0x7')](util[_0x60a4('0x8')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x50b9a9['id']));if(_0x4dd76e&&_0x4dd76e[_0x60a4('0x15')]&&_0x4dd76e['results'][_0x60a4('0x16')]&&_0x4dd76e[_0x60a4('0x15')]['transcripts'][_0x60a4('0x17')]){_0x524d45[_0x60a4('0xe')]='';for(var _0x103151=0x0;_0x103151<_0x4dd76e['results']['transcripts']['length'];_0x103151++){_0x524d45[_0x60a4('0xe')]+=_0x4dd76e[_0x60a4('0x15')][_0x60a4('0x16')][_0x103151]['transcript']+'';}}return _0x50b9a9['update'](_0x524d45);})['then'](function(){logger[_0x60a4('0x7')](util[_0x60a4('0x8')](_0x60a4('0x18'),_0x50b9a9['id']));if(!_0x50b9a9[_0x60a4('0x19')]){throw new db['Sequelize']['ValidationError'](_0x60a4('0x1a'));}if(!_0x1c12e5['sentiment']||!_0x1c12e5[_0x60a4('0x1b')]||!_0x1c12e5[_0x60a4('0x1c')]||!_0x1c12e5[_0x60a4('0x1d')]||!_0x1c12e5[_0x60a4('0x1e')]){throw new db[(_0x60a4('0x1f'))][(_0x60a4('0x20'))](_0x60a4('0x21'));}if(!_0x524d45[_0x60a4('0xe')]){throw new Error(_0x60a4('0x22'));}if(_0x1c12e5['sentimentAccountId']===_0x31a690['id']){return _0x31a690;}else{return db[_0x60a4('0x23')][_0x60a4('0x24')]({'where':{'id':_settings[_0x60a4('0x1b')]}});}})[_0x60a4('0xd')](function(_0x1ef033){if(!_0x1ef033){throw new db[(_0x60a4('0x1f'))][(_0x60a4('0x20'))](_0x60a4('0x25'));}if(!_0x1ef033[_0x60a4('0xb')]||!_0x1ef033[_0x60a4('0xc')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x4e6a56=_0x1ef033;logger[_0x60a4('0x7')](util[_0x60a4('0x8')](_0x60a4('0x26'),_0x50b9a9['id']));return sentiment(_0x4e6a56['data1'],_0x4e6a56['data2'],_0x1c12e5['sentimentRegion'],_0x524d45[_0x60a4('0xe')],_0x1c12e5[_0x60a4('0x1d')]);})['then'](function(_0x161b9c){logger[_0x60a4('0x7')](util[_0x60a4('0x8')](_0x60a4('0x27'),_0x50b9a9['id']));return _0x50b9a9[_0x60a4('0x28')]({'sentiment':_0x161b9c[_0x60a4('0x29')],'sPositive':_0x161b9c[_0x60a4('0x2a')][_0x60a4('0x2b')],'sNegative':_0x161b9c[_0x60a4('0x2a')]['Negative'],'sMixed':_0x161b9c['SentimentScore'][_0x60a4('0x2c')],'sNeutral':_0x161b9c['SentimentScore'][_0x60a4('0x2d')]});})['then'](function(){logger[_0x60a4('0x7')](util[_0x60a4('0x8')](_0x60a4('0x18'),_0x50b9a9['id']));_0x588a4e();});case _0x60a4('0x2e'):return _0x50b9a9['update']({'transcribeStatus':_0x60a4('0x2e'),'failureReason':_0x4a7b00['TranscriptionJob'][_0x60a4('0x2f')]})[_0x60a4('0xd')](function(){logger['info'](util['format'](_0x60a4('0x18'),_0x50b9a9['id']));_0x588a4e();});default:logger[_0x60a4('0x7')](util[_0x60a4('0x8')](_0x60a4('0x30'),_0x50b9a9['id']));break;}}else{return BPromise[_0x60a4('0x31')]()[_0x60a4('0xd')](function(){if(!_0x50b9a9['tempSentiment']){throw new db[(_0x60a4('0x1f'))][(_0x60a4('0x20'))](_0x60a4('0x1a'));}if(!_0x1c12e5[_0x60a4('0x32')]||!_0x1c12e5[_0x60a4('0x1b')]||!_0x1c12e5[_0x60a4('0x1c')]||!_0x1c12e5['language']||!_0x1c12e5['bucket']){throw new db[(_0x60a4('0x1f'))][(_0x60a4('0x20'))](_0x60a4('0x21'));}if(!_0x50b9a9[_0x60a4('0xe')]){throw new Error(_0x60a4('0x22'));}if(_0x1c12e5['sentimentAccountId']===_0x31a690['id']){return _0x31a690;}else{return db[_0x60a4('0x23')]['findOne']({'where':{'id':_settings[_0x60a4('0x1b')]}});}})[_0x60a4('0xd')](function(_0x120f7){if(!_0x120f7){throw new db[(_0x60a4('0x1f'))][(_0x60a4('0x20'))](_0x60a4('0x25'));}if(!_0x120f7['data1']||!_0x120f7['data2']){throw new db['Sequelize'][(_0x60a4('0x20'))](_0x60a4('0x33'));}_0x4e6a56=_0x120f7;logger[_0x60a4('0x7')](util['format'](_0x60a4('0x26'),_0x50b9a9['id']));return sentiment(_0x4e6a56[_0x60a4('0xb')],_0x4e6a56[_0x60a4('0xc')],_0x1c12e5[_0x60a4('0x1c')],_0x50b9a9[_0x60a4('0xe')],_0x1c12e5[_0x60a4('0x1d')]);})[_0x60a4('0xd')](function(_0x16bd23){logger['info'](util[_0x60a4('0x8')](_0x60a4('0x27'),_0x50b9a9['id']));return _0x50b9a9[_0x60a4('0x28')]({'sentiment':_0x16bd23[_0x60a4('0x29')],'sPositive':_0x16bd23[_0x60a4('0x2a')][_0x60a4('0x2b')],'sNegative':_0x16bd23[_0x60a4('0x2a')][_0x60a4('0x34')],'sMixed':_0x16bd23[_0x60a4('0x2a')][_0x60a4('0x2c')],'sNeutral':_0x16bd23[_0x60a4('0x2a')]['Neutral'],'transcribeStatus':_0x60a4('0x11')});})[_0x60a4('0xd')](function(){logger['info'](util[_0x60a4('0x8')](_0x60a4('0x18'),_0x50b9a9['id']));_0x588a4e();});}})[_0x60a4('0x35')](function(_0x364947){if(_0x364947){if(!_0x364947[_0x60a4('0x36')]||_0x364947['name']!==_0x60a4('0x37')){logger['error'](util[_0x60a4('0x8')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x50b9a9['id']),util[_0x60a4('0x38')](_0x364947,{'showHidden':![],'depth':null}));}}_0x588a4e();});});}function checkTranscribe(){var _0x3b06f2;var _0xa94d5a;var _0x18305d;return db[_0x60a4('0x39')]['findAll']({'where':{'transcribeStatus':_0x60a4('0x3a')}})[_0x60a4('0xd')](function(_0xf8d99b){if(!_0xf8d99b||!_0xf8d99b[_0x60a4('0x17')]){throw new db['Sequelize'][(_0x60a4('0x20'))]('No\x20transcribe\x20job\x20to\x20check');}_0x3b06f2=_0xf8d99b;return db[_0x60a4('0x3b')]['findOne']({'where':{'id':0x1}});})['then'](function(_0xae2aa0){if(!_0xae2aa0){throw new db['Sequelize']['ValidationError'](_0x60a4('0x3c'));}_0xa94d5a=_0xae2aa0;if(!_0xa94d5a[_0x60a4('0x3d')]||!_0xa94d5a[_0x60a4('0x3e')]||!_0xa94d5a[_0x60a4('0x3f')]||!_0xa94d5a[_0x60a4('0x1d')]||!_0xa94d5a[_0x60a4('0x1e')]){throw new db[(_0x60a4('0x1f'))][(_0x60a4('0x20'))](_0x60a4('0x40'));}return db[_0x60a4('0x23')][_0x60a4('0x24')]({'where':{'id':_0xa94d5a[_0x60a4('0x3e')]}});})[_0x60a4('0xd')](function(_0x20abad){if(!_0x20abad){throw new db[(_0x60a4('0x1f'))][(_0x60a4('0x20'))](_0x60a4('0x25'));}if(!_0x20abad[_0x60a4('0xb')]||!_0x20abad[_0x60a4('0xc')]){throw new db[(_0x60a4('0x1f'))]['ValidationError'](_0x60a4('0x33'));}_0x18305d=_0x20abad;var _0x4c29d8=[];_0x3b06f2['forEach'](function(_0xa56946){_0x4c29d8['push'](checkTranscribeJob(_0xa56946,_0xa94d5a,_0x18305d));});return BPromise['all'](_0x4c29d8);})[_0x60a4('0x35')](function(_0x4a2902){if(_0x4a2902){if(!_0x4a2902[_0x60a4('0x36')]||_0x4a2902[_0x60a4('0x36')]!==_0x60a4('0x37')){logger['error'](util[_0x60a4('0x38')](_0x4a2902,{'showHidden':![],'depth':null}));}}});}exports[_0x60a4('0x41')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 0502bf6..3732726 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x46a2=['then','log','finished\x20populating','CmHopper','hopper1','bulkCreate','contacts2','hopper2','util','../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','destroy'];(function(_0x2b7041,_0x3302e5){var _0x544bc2=function(_0x2bee0f){while(--_0x2bee0f){_0x2b7041['push'](_0x2b7041['shift']());}};_0x544bc2(++_0x3302e5);}(_0x46a2,0x128));var _0x246a=function(_0x58c851,_0x1f3d96){_0x58c851=_0x58c851-0x0;var _0x534d8a=_0x46a2[_0x58c851];return _0x534d8a;};'use strict';var util=require(_0x246a('0x0'));var db=require(_0x246a('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x246a('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x246a('0x3')+i,'phone':0xf879fb460+i,'email':_0x246a('0x4')+i+_0x246a('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x246a('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x246a('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x246a('0x6')](),'updatedAt':Date[_0x246a('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x246a('0x2')]({'id':i,'firstName':_0x246a('0x7')+i,'lastName':_0x246a('0x3')+i,'phone':0xf879fb460+i,'email':_0x246a('0x4')+i+_0x246a('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x246a('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x246a('0x6')]()});}db[_0x246a('0x8')][_0x246a('0x9')]({'where':{}})[_0x246a('0xa')](function(){return db[_0x246a('0x8')]['bulkCreate'](contacts);})[_0x246a('0xa')](function(){console[_0x246a('0xb')](_0x246a('0xc'),'contacts1');return db[_0x246a('0xd')][_0x246a('0x9')]({'where':{}});})[_0x246a('0xa')](function(){return db[_0x246a('0xd')]['bulkCreate'](hopper);})['then'](function(){console[_0x246a('0xb')](_0x246a('0xc'),_0x246a('0xe'));return db[_0x246a('0x8')][_0x246a('0xf')](contacts2);})[_0x246a('0xa')](function(){console[_0x246a('0xb')](_0x246a('0xc'),_0x246a('0x10'));return db[_0x246a('0xd')]['bulkCreate'](hopper2);})[_0x246a('0xa')](function(){console[_0x246a('0xb')](_0x246a('0xc'),_0x246a('0x11'));})['catch'](function(_0xfc58f5){console['log'](_0xfc58f5);}); \ No newline at end of file +var _0xe87a=['finished\x20populating','contacts1','CmHopper','hopper1','hopper2','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','destroy','then','CmContact','bulkCreate','log'];(function(_0xdd9511,_0x365c33){var _0x36f266=function(_0x126cf6){while(--_0x126cf6){_0xdd9511['push'](_0xdd9511['shift']());}};_0x36f266(++_0x365c33);}(_0xe87a,0x15b));var _0xae87=function(_0x174ac2,_0xe1253){_0x174ac2=_0x174ac2-0x0;var _0x58a9a0=_0xe87a[_0x174ac2];return _0x58a9a0;};'use strict';var util=require(_0xae87('0x0'));var db=require(_0xae87('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xae87('0x2')]({'id':i,'firstName':_0xae87('0x3')+i,'lastName':_0xae87('0x4')+i,'phone':0xf879fb460+i,'email':_0xae87('0x5')+i+_0xae87('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xae87('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xae87('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xae87('0x7')](),'updatedAt':Date[_0xae87('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xae87('0x4')+i,'phone':0xf879fb460+i,'email':_0xae87('0x5')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xae87('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xae87('0x7')]()});}db['CmContact'][_0xae87('0x8')]({'where':{}})[_0xae87('0x9')](function(){return db[_0xae87('0xa')][_0xae87('0xb')](contacts);})[_0xae87('0x9')](function(){console[_0xae87('0xc')](_0xae87('0xd'),_0xae87('0xe'));return db[_0xae87('0xf')][_0xae87('0x8')]({'where':{}});})['then'](function(){return db[_0xae87('0xf')]['bulkCreate'](hopper);})['then'](function(){console[_0xae87('0xc')](_0xae87('0xd'),_0xae87('0x10'));return db[_0xae87('0xa')][_0xae87('0xb')](contacts2);})[_0xae87('0x9')](function(){console[_0xae87('0xc')](_0xae87('0xd'),'contacts2');return db[_0xae87('0xf')][_0xae87('0xb')](hopper2);})[_0xae87('0x9')](function(){console['log'](_0xae87('0xd'),_0xae87('0x11'));})['catch'](function(_0x40e18a){console[_0xae87('0xc')](_0x40e18a);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index f9b96bb..fcd6bd0 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5983=['yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','log','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','udp','all','ulaw'];(function(_0x4c1832,_0x11e246){var _0x1a6d24=function(_0xe43c2f){while(--_0xe43c2f){_0x4c1832['push'](_0x4c1832['shift']());}};_0x1a6d24(++_0x11e246);}(_0x5983,0xe5));var _0x3598=function(_0x2b53ba,_0x54c027){_0x2b53ba=_0x2b53ba-0x0;var _0x5d933e=_0x5983[_0x2b53ba];return _0x5d933e;};'use strict';var util=require(_0x3598('0x0'));var db=require(_0x3598('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x3598('0x2')]({'name':util[_0x3598('0x3')](_0x3598('0x4'),_0x3598('0x5'),i),'fullname':util[_0x3598('0x3')](_0x3598('0x4'),'agent',i),'email':util[_0x3598('0x3')](_0x3598('0x6'),_0x3598('0x5'),i),'role':_0x3598('0x5'),'password':_0x3598('0x7'),'internal':0xfa0+i,'type':'friend','transport':[_0x3598('0x8'),'ws','wss'],'disallow':[_0x3598('0x9')],'allow':[_0x3598('0xa')],'defaultuser':util[_0x3598('0x3')](_0x3598('0x4'),_0x3598('0x5'),i),'encryption':_0x3598('0xb'),'avpf':'yes','force_avp':_0x3598('0xb'),'icesupport':_0x3598('0xb'),'dtlsenable':_0x3598('0xb'),'dtlsverify':'no','dtlscertfile':_0x3598('0xc'),'dtlsprivatekey':_0x3598('0xd'),'dtlssetup':_0x3598('0xe'),'callerid':util[_0x3598('0x3')](_0x3598('0xf'),util[_0x3598('0x3')]('%s%s',_0x3598('0x5'),i),0xfa0+i)});}db[_0x3598('0x10')]['bulkCreate'](users)[_0x3598('0x11')](function(){console[_0x3598('0x12')]('add\x20user');})[_0x3598('0x13')](function(_0x5f3000){console[_0x3598('0x12')](_0x5f3000);}); \ No newline at end of file +var _0xa951=['all','ulaw','yes','actpass','User','then','log','add\x20user','catch','util','../mysqldb','push','agent','format','%s%s','%s%s@xcally.com','password','friend','udp','wss'];(function(_0x3c57ef,_0x1d1b77){var _0x32fd64=function(_0x550361){while(--_0x550361){_0x3c57ef['push'](_0x3c57ef['shift']());}};_0x32fd64(++_0x1d1b77);}(_0xa951,0xf9));var _0x1a95=function(_0x42db5a,_0x27d793){_0x42db5a=_0x42db5a-0x0;var _0x5ba992=_0xa951[_0x42db5a];return _0x5ba992;};'use strict';var util=require(_0x1a95('0x0'));var db=require(_0x1a95('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x1a95('0x2')]({'name':util['format']('%s%s',_0x1a95('0x3'),i),'fullname':util[_0x1a95('0x4')](_0x1a95('0x5'),'agent',i),'email':util[_0x1a95('0x4')](_0x1a95('0x6'),'agent',i),'role':_0x1a95('0x3'),'password':_0x1a95('0x7'),'internal':0xfa0+i,'type':_0x1a95('0x8'),'transport':[_0x1a95('0x9'),'ws',_0x1a95('0xa')],'disallow':[_0x1a95('0xb')],'allow':[_0x1a95('0xc')],'defaultuser':util['format'](_0x1a95('0x5'),_0x1a95('0x3'),i),'encryption':'yes','avpf':_0x1a95('0xd'),'force_avp':_0x1a95('0xd'),'icesupport':'yes','dtlsenable':_0x1a95('0xd'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x1a95('0xe'),'callerid':util[_0x1a95('0x4')]('\x22%s\x22\x20<%s>',util[_0x1a95('0x4')](_0x1a95('0x5'),_0x1a95('0x3'),i),0xfa0+i)});}db[_0x1a95('0xf')]['bulkCreate'](users)[_0x1a95('0x10')](function(){console[_0x1a95('0x11')](_0x1a95('0x12'));})[_0x1a95('0x13')](function(_0x3ae659){console[_0x1a95('0x11')](_0x3ae659);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 021228d..d5f295e 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe398=['all','voice','fax','sms','mail','whatsapp','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','address','request','remoteAddress','connectedAt','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','map','where','Campaign','ivr','format','%s:queue:%s','length','user:%s','handshake','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','SmsQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0xe398,0x83));var _0x8e39=function(_0x33c811,_0x2ccc92){_0x33c811=_0x33c811-0x0;var _0x27dc79=_0xe398[_0x33c811];return _0x27dc79;};'use strict';var _=require(_0x8e39('0x0'));var util=require('util');var BPromise=require(_0x8e39('0x1'));var db=require(_0x8e39('0x2'))['db'];var config=require(_0x8e39('0x3'));var queryQueues={'attributes':['id',_0x8e39('0x4')],'include':[{'as':_0x8e39('0x5'),'model':db[_0x8e39('0x6')],'attributes':['id',_0x8e39('0x4'),_0x8e39('0x7')],'raw':!![],'where':{'role':_0x8e39('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x8e39('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x8e39('0x4'),'type'],'where':{'type':'ivr'}};function getAssociatedResources(_0x16098e,_0x43e2e4,_0xa87058){return db[_0x8e39('0xa')]['findOne']({'where':{'name':_0x16098e,'userProfileId':_0x43e2e4},'raw':!![]})[_0x8e39('0xb')](function(_0x5f2153){if(_0x5f2153){if(_0x5f2153[_0x8e39('0xc')]){switch(_0x16098e){case _0x8e39('0xd'):case _0x8e39('0xe'):case _0x8e39('0xf'):case'SmsQueues':case _0x8e39('0x10'):case'OpenchannelQueues':case _0x8e39('0x11'):return db[_0xa87058][_0x8e39('0x12')](queryQueues);case _0x8e39('0x13'):return db[_0xa87058][_0x8e39('0x12')](queryTelephones);case _0x8e39('0x14'):return db[_0xa87058][_0x8e39('0x12')](queryTrunks);case _0x8e39('0x15'):return db[_0xa87058][_0x8e39('0x12')](queryCampaigns);}}else{return db['UserProfileResource'][_0x8e39('0x12')]({'attributes':[_0x8e39('0x16')],'where':{'sectionId':_0x5f2153['id']},'raw':!![]})[_0x8e39('0xb')](function(_0x31b35e){if(_0x31b35e){var _0x18cadf={'where':{'id':_[_0x8e39('0x17')](_0x31b35e,'resourceId')},'raw':!![]};switch(_0xa87058){case _0x8e39('0x6'):_0x18cadf[_0x8e39('0x18')][_0x8e39('0x7')]=_0x8e39('0x9');break;case _0x8e39('0x19'):_0x18cadf['where']['type']=_0x8e39('0x1a');break;}return db[_0xa87058][_0x8e39('0x12')](_0x18cadf);}else{return[];}});}}else{return[];}})[_0x8e39('0xb')](function(_0x2fc686){return _0x2fc686;});}function joinOrLeaveQueues(_0x3d3e95,_0x3a6b11,_0x25b55c,_0x451f72){_0x3d3e95[_0x3a6b11](util[_0x8e39('0x1b')](_0x8e39('0x1c'),_0x25b55c,_0x451f72[_0x8e39('0x4')]));if(_0x451f72[_0x8e39('0x5')]){for(var _0x36ccc8=0x0;_0x36ccc8<_0x451f72[_0x8e39('0x5')][_0x8e39('0x1d')];_0x36ccc8+=0x1){_0x3d3e95[_0x3a6b11](util[_0x8e39('0x1b')](_0x8e39('0x1e'),_0x451f72[_0x8e39('0x5')][_0x36ccc8]['name']));}}}function joinOrLeave(_0x2a39ed,_0x58c726,_0x3050d5){var _0x4c1ffd;if(_0x2a39ed[_0x8e39('0x1f')]['query']['id']){db['User']['find']({'attributes':['id',_0x8e39('0x4'),'role',_0x8e39('0x20')],'where':{'id':_0x2a39ed['handshake']['query']['id']},'include':[{'model':db[_0x8e39('0x21')],'as':_0x8e39('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x8e39('0x23')],'as':_0x8e39('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x8e39('0x25')],'as':_0x8e39('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x8e39('0x27')],'as':_0x8e39('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x8e39('0x29')],'as':_0x8e39('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x8e39('0x2b')],'as':_0x8e39('0x2c'),'attributes':['id'],'raw':!![]}]})[_0x8e39('0xb')](function(_0x3d6801){if(_0x3d6801){_0x4c1ffd=_0x3d6801;_0x2a39ed[_0x58c726](util[_0x8e39('0x1b')](_0x8e39('0x1e'),_0x3d6801[_0x8e39('0x4')]));var _0x339360=[];switch(_0x3d6801[_0x8e39('0x7')]){case'admin':_0x2a39ed[_0x58c726](_0x8e39('0x2d'));_0x2a39ed[_0x58c726](_0x8e39('0x2e'));if(queryQueues[_0x8e39('0x2f')]('include')){delete queryQueues['include'];}_0x339360[_0x8e39('0x30')](db[_0x8e39('0x31')][_0x8e39('0x12')](queryQueues));_0x339360[_0x8e39('0x30')](db[_0x8e39('0x32')][_0x8e39('0x12')](queryQueues));_0x339360[_0x8e39('0x30')](db[_0x8e39('0x33')][_0x8e39('0x12')](queryQueues));_0x339360['push'](db[_0x8e39('0x34')][_0x8e39('0x12')](queryQueues));_0x339360[_0x8e39('0x30')](db[_0x8e39('0x35')][_0x8e39('0x12')](queryQueues));_0x339360[_0x8e39('0x30')](db[_0x8e39('0x36')][_0x8e39('0x12')](queryQueues));_0x339360[_0x8e39('0x30')](db['WhatsappQueue']['findAll'](queryQueues));_0x339360[_0x8e39('0x30')](db['User']['findAll'](queryTelephones));_0x339360[_0x8e39('0x30')](db[_0x8e39('0x37')]['findAll'](queryTrunks));_0x339360['push'](db[_0x8e39('0x19')][_0x8e39('0x12')](queryCampaigns));_0x339360['push'](db['User']['findAll'](queryAgents));break;case'user':_0x2a39ed[_0x58c726]('voice:inbound');_0x2a39ed[_0x58c726]('voice:outbound');_0x339360[_0x8e39('0x30')](getAssociatedResources(_0x8e39('0xd'),_0x3d6801[_0x8e39('0x20')],_0x8e39('0x31')));_0x339360[_0x8e39('0x30')](getAssociatedResources(_0x8e39('0xe'),_0x3d6801[_0x8e39('0x20')],_0x8e39('0x32')));_0x339360[_0x8e39('0x30')](getAssociatedResources(_0x8e39('0xf'),_0x3d6801['userProfileId'],_0x8e39('0x33')));_0x339360[_0x8e39('0x30')](getAssociatedResources(_0x8e39('0x38'),_0x3d6801[_0x8e39('0x20')],_0x8e39('0x34')));_0x339360[_0x8e39('0x30')](getAssociatedResources(_0x8e39('0x10'),_0x3d6801[_0x8e39('0x20')],_0x8e39('0x35')));_0x339360[_0x8e39('0x30')](getAssociatedResources('OpenchannelQueues',_0x3d6801[_0x8e39('0x20')],_0x8e39('0x36')));_0x339360[_0x8e39('0x30')](getAssociatedResources(_0x8e39('0x11'),_0x3d6801[_0x8e39('0x20')],'WhatsappQueue'));_0x339360['push'](getAssociatedResources(_0x8e39('0x13'),_0x3d6801[_0x8e39('0x20')],_0x8e39('0x6')));_0x339360['push'](getAssociatedResources('Trunks',_0x3d6801[_0x8e39('0x20')],_0x8e39('0x37')));_0x339360[_0x8e39('0x30')](getAssociatedResources(_0x8e39('0x15'),_0x3d6801[_0x8e39('0x20')],'Campaign'));_0x339360[_0x8e39('0x30')](db[_0x8e39('0x6')]['findAll'](queryAgents));break;case _0x8e39('0x8'):_0x2a39ed[_0x58c726](_0x8e39('0x2d'));_0x2a39ed[_0x58c726](_0x8e39('0x2e'));_0x339360[_0x8e39('0x30')](_0x3d6801['getVoiceQueues']({'attributes':['id',_0x8e39('0x4')]}));_0x339360['push'](_0x3d6801[_0x8e39('0x39')]({'attributes':['id',_0x8e39('0x4')]}));_0x339360['push'](_0x3d6801[_0x8e39('0x3a')]({'attributes':['id',_0x8e39('0x4')]}));_0x339360[_0x8e39('0x30')](_0x3d6801[_0x8e39('0x3b')]({'attributes':['id','name']}));_0x339360['push'](_0x3d6801[_0x8e39('0x3c')]({'attributes':['id',_0x8e39('0x4')]}));_0x339360[_0x8e39('0x30')](_0x3d6801[_0x8e39('0x3d')]({'attributes':['id',_0x8e39('0x4')]}));_0x339360[_0x8e39('0x30')](_0x3d6801[_0x8e39('0x3e')]({'attributes':['id',_0x8e39('0x4')]}));break;}return BPromise[_0x8e39('0x3f')](_0x339360);}})[_0x8e39('0xb')](function(_0x292b12){if(_0x292b12&&_0x292b12[_0x8e39('0x1d')]){for(var _0x1d3d19=0x0;_0x1d3d19<_0x292b12[_0x8e39('0x1d')];_0x1d3d19+=0x1){for(var _0x424772=0x0;_0x424772<_0x292b12[_0x1d3d19]['length'];_0x424772+=0x1){switch(_0x1d3d19){case 0x0:joinOrLeaveQueues(_0x2a39ed,_0x58c726,_0x8e39('0x40'),_0x292b12[_0x1d3d19][_0x424772]);break;case 0x1:joinOrLeaveQueues(_0x2a39ed,_0x58c726,'chat',_0x292b12[_0x1d3d19][_0x424772]);break;case 0x2:joinOrLeaveQueues(_0x2a39ed,_0x58c726,_0x8e39('0x41'),_0x292b12[_0x1d3d19][_0x424772]);break;case 0x3:joinOrLeaveQueues(_0x2a39ed,_0x58c726,_0x8e39('0x42'),_0x292b12[_0x1d3d19][_0x424772]);break;case 0x4:joinOrLeaveQueues(_0x2a39ed,_0x58c726,_0x8e39('0x43'),_0x292b12[_0x1d3d19][_0x424772]);break;case 0x5:joinOrLeaveQueues(_0x2a39ed,_0x58c726,'openchannel',_0x292b12[_0x1d3d19][_0x424772]);break;case 0x6:joinOrLeaveQueues(_0x2a39ed,_0x58c726,_0x8e39('0x44'),_0x292b12[_0x1d3d19][_0x424772]);break;case 0x7:_0x2a39ed[_0x58c726](util[_0x8e39('0x1b')]('telephone:%s',_0x292b12[_0x1d3d19][_0x424772][_0x8e39('0x4')]));break;case 0x8:_0x2a39ed[_0x58c726](util[_0x8e39('0x1b')](_0x8e39('0x45'),_0x292b12[_0x1d3d19][_0x424772][_0x8e39('0x4')]));break;case 0x9:_0x2a39ed[_0x58c726](util['format'](_0x8e39('0x46'),_0x292b12[_0x1d3d19][_0x424772]['type'],_0x292b12[_0x1d3d19][_0x424772]['name']));break;case 0xa:_0x2a39ed[_0x58c726](util[_0x8e39('0x1b')](_0x8e39('0x1e'),_0x292b12[_0x1d3d19][_0x424772][_0x8e39('0x4')]));break;}}}}})['then'](function(){if(_0x58c726===_0x8e39('0x47')){var _0x153d08=_[_0x8e39('0x17')](_0x4c1ffd[_0x8e39('0x22')],'id');return _0x4c1ffd[_0x8e39('0x48')](_0x153d08)['then'](function(){for(var _0x3e692d=0x0;_0x3e692d<_0x153d08[_0x8e39('0x1d')];_0x3e692d+=0x1){_0x3050d5[_0x8e39('0x49')](_0x8e39('0x4a'),{'ChatInteractionId':Number(_0x153d08[_0x3e692d]),'UserId':Number(_0x4c1ffd['id'])});}});}})['then'](function(){if(_0x58c726===_0x8e39('0x47')){var _0x34f82f=_[_0x8e39('0x17')](_0x4c1ffd['MailInteractions'],'id');return _0x4c1ffd[_0x8e39('0x4b')](_0x34f82f)['then'](function(){for(var _0x4d8503=0x0;_0x4d8503<_0x34f82f[_0x8e39('0x1d')];_0x4d8503+=0x1){_0x3050d5[_0x8e39('0x49')](_0x8e39('0x4c'),{'MailInteractionId':Number(_0x34f82f[_0x4d8503]),'UserId':Number(_0x4c1ffd['id'])});}});}})['then'](function(){if(_0x58c726==='leave'){var _0x415213=_[_0x8e39('0x17')](_0x4c1ffd[_0x8e39('0x26')],'id');return _0x4c1ffd[_0x8e39('0x4d')](_0x415213)[_0x8e39('0xb')](function(){for(var _0x3bd8d8=0x0;_0x3bd8d8<_0x415213[_0x8e39('0x1d')];_0x3bd8d8+=0x1){_0x3050d5[_0x8e39('0x49')](_0x8e39('0x4e'),{'FaxInteractionId':Number(_0x415213[_0x3bd8d8]),'UserId':Number(_0x4c1ffd['id'])});}});}})[_0x8e39('0xb')](function(){if(_0x58c726===_0x8e39('0x47')){var _0x465891=_['map'](_0x4c1ffd[_0x8e39('0x28')],'id');return _0x4c1ffd['removeSmsInteractions'](_0x465891)['then'](function(){for(var _0x3be29b=0x0;_0x3be29b<_0x465891[_0x8e39('0x1d')];_0x3be29b+=0x1){_0x3050d5['emit'](_0x8e39('0x4f'),{'SmsInteractionId':Number(_0x465891[_0x3be29b]),'UserId':Number(_0x4c1ffd['id'])});}});}})[_0x8e39('0xb')](function(){if(_0x58c726===_0x8e39('0x47')){var _0x351578=_[_0x8e39('0x17')](_0x4c1ffd['OpenchannelInteractions'],'id');return _0x4c1ffd[_0x8e39('0x50')](_0x351578)[_0x8e39('0xb')](function(){for(var _0x436f03=0x0;_0x436f03<_0x351578[_0x8e39('0x1d')];_0x436f03+=0x1){_0x3050d5['emit'](_0x8e39('0x51'),{'OpenchannelInteractionId':Number(_0x351578[_0x436f03]),'UserId':Number(_0x4c1ffd['id'])});}});}})[_0x8e39('0xb')](function(){if(_0x58c726==='leave'){var _0x1fd525=_['map'](_0x4c1ffd[_0x8e39('0x2c')],'id');return _0x4c1ffd[_0x8e39('0x52')](_0x1fd525)[_0x8e39('0xb')](function(){for(var _0x213095=0x0;_0x213095<_0x1fd525[_0x8e39('0x1d')];_0x213095+=0x1){_0x3050d5[_0x8e39('0x49')](_0x8e39('0x53'),{'WhatsappInteractionId':Number(_0x1fd525[_0x213095]),'UserId':Number(_0x4c1ffd['id'])});}});}})['catch'](function(_0x3bfef9){_0x2a39ed[_0x8e39('0x54')](_0x3bfef9);});}}function onDisconnect(_0x3bb4a5,_0x868da8){joinOrLeave(_0x3bb4a5,_0x8e39('0x47'),_0x868da8);}function onConnect(_0x25a04c){joinOrLeave(_0x25a04c,_0x8e39('0x55'));}exports[_0x8e39('0x56')]=function(_0xc0638a){_0xc0638a['on'](_0x8e39('0x57'),function(_0x22aab9){_0x22aab9[_0x8e39('0x58')](0x0);_0x22aab9[_0x8e39('0x59')]=_0x22aab9[_0x8e39('0x5a')]['connection'][_0x8e39('0x5b')]+':'+_0x22aab9[_0x8e39('0x5a')][_0x8e39('0x57')]['remotePort'];_0x22aab9[_0x8e39('0x5c')]=new Date();_0x22aab9[_0x8e39('0x54')]=function(_0x42c3a7){console[_0x8e39('0x54')]('SocketIO\x20'+_0x22aab9[_0x8e39('0x5d')][_0x8e39('0x4')]+'['+_0x22aab9[_0x8e39('0x59')]+']',_0x42c3a7);};_0x22aab9['on'](_0x8e39('0x5e'),function(){onDisconnect(_0x22aab9,_0xc0638a);_0x22aab9[_0x8e39('0x54')](_0x8e39('0x5f'));});onConnect(_0x22aab9);_0x22aab9[_0x8e39('0x54')](_0x8e39('0x60'));});}; \ No newline at end of file +var _0x4ce6=['hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','VoiceQueues','userProfileId','VoiceQueue','SmsQueues','MailQueue','Campaign','getVoiceQueues','getFaxQueues','getSmsQueues','all','length','voice','chat','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','removeFaxInteractions','emit','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','catch','log','join','setMaxListeners','address','request','connection','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','lodash','util','bluebird','../mysqldb','./environment','Agents','name','role','agent','telephone','type','ivr','UserProfileSection','findOne','autoAssociation','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','User','where','then','format','handshake','query','find','ChatInteraction','ChatInteractions','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:inbound','voice:outbound'];(function(_0x313a89,_0xafa484){var _0x3cf3bf=function(_0x215908){while(--_0x215908){_0x313a89['push'](_0x313a89['shift']());}};_0x3cf3bf(++_0xafa484);}(_0x4ce6,0x15a));var _0x64ce=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0x4ce6[_0x245afe];return _0x4eefde;};'use strict';var _=require(_0x64ce('0x0'));var util=require(_0x64ce('0x1'));var BPromise=require(_0x64ce('0x2'));var db=require(_0x64ce('0x3'))['db'];var config=require(_0x64ce('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x64ce('0x5'),'model':db['User'],'attributes':['id',_0x64ce('0x6'),_0x64ce('0x7')],'raw':!![],'where':{'role':_0x64ce('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x64ce('0x6')],'where':{'role':_0x64ce('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x64ce('0x6')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x64ce('0x6'),_0x64ce('0xa')],'where':{'type':_0x64ce('0xb')}};function getAssociatedResources(_0x363a00,_0x54caed,_0x58baf6){return db[_0x64ce('0xc')][_0x64ce('0xd')]({'where':{'name':_0x363a00,'userProfileId':_0x54caed},'raw':!![]})['then'](function(_0x2f956f){if(_0x2f956f){if(_0x2f956f[_0x64ce('0xe')]){switch(_0x363a00){case'VoiceQueues':case _0x64ce('0xf'):case _0x64ce('0x10'):case'SmsQueues':case _0x64ce('0x11'):case _0x64ce('0x12'):case _0x64ce('0x13'):return db[_0x58baf6]['findAll'](queryQueues);case'Telephones':return db[_0x58baf6][_0x64ce('0x14')](queryTelephones);case _0x64ce('0x15'):return db[_0x58baf6][_0x64ce('0x14')](queryTrunks);case _0x64ce('0x16'):return db[_0x58baf6][_0x64ce('0x14')](queryCampaigns);}}else{return db[_0x64ce('0x17')]['findAll']({'attributes':[_0x64ce('0x18')],'where':{'sectionId':_0x2f956f['id']},'raw':!![]})['then'](function(_0x3f7aa7){if(_0x3f7aa7){var _0x572c4a={'where':{'id':_[_0x64ce('0x19')](_0x3f7aa7,_0x64ce('0x18'))},'raw':!![]};switch(_0x58baf6){case _0x64ce('0x1a'):_0x572c4a[_0x64ce('0x1b')][_0x64ce('0x7')]=_0x64ce('0x9');break;case'Campaign':_0x572c4a[_0x64ce('0x1b')][_0x64ce('0xa')]=_0x64ce('0xb');break;}return db[_0x58baf6][_0x64ce('0x14')](_0x572c4a);}else{return[];}});}}else{return[];}})[_0x64ce('0x1c')](function(_0x389eb1){return _0x389eb1;});}function joinOrLeaveQueues(_0x2e871b,_0x3a465b,_0x70239e,_0x281398){_0x2e871b[_0x3a465b](util[_0x64ce('0x1d')]('%s:queue:%s',_0x70239e,_0x281398['name']));if(_0x281398[_0x64ce('0x5')]){for(var _0x30f767=0x0;_0x30f767<_0x281398['Agents']['length'];_0x30f767+=0x1){_0x2e871b[_0x3a465b](util[_0x64ce('0x1d')]('user:%s',_0x281398[_0x64ce('0x5')][_0x30f767][_0x64ce('0x6')]));}}}function joinOrLeave(_0x40e475,_0x1974c1,_0xf13f0a){var _0x1db89f;if(_0x40e475[_0x64ce('0x1e')][_0x64ce('0x1f')]['id']){db[_0x64ce('0x1a')][_0x64ce('0x20')]({'attributes':['id',_0x64ce('0x6'),_0x64ce('0x7'),'userProfileId'],'where':{'id':_0x40e475[_0x64ce('0x1e')][_0x64ce('0x1f')]['id']},'include':[{'model':db[_0x64ce('0x21')],'as':_0x64ce('0x22'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x64ce('0x23'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x64ce('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x64ce('0x25')],'as':_0x64ce('0x26'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x64ce('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x64ce('0x28')],'as':_0x64ce('0x29'),'attributes':['id'],'raw':!![]}]})[_0x64ce('0x1c')](function(_0x37c4f4){if(_0x37c4f4){_0x1db89f=_0x37c4f4;_0x40e475[_0x1974c1](util[_0x64ce('0x1d')](_0x64ce('0x2a'),_0x37c4f4[_0x64ce('0x6')]));var _0x3ecafc=[];switch(_0x37c4f4[_0x64ce('0x7')]){case _0x64ce('0x2b'):_0x40e475[_0x1974c1](_0x64ce('0x2c'));_0x40e475[_0x1974c1](_0x64ce('0x2d'));if(queryQueues[_0x64ce('0x2e')](_0x64ce('0x2f'))){delete queryQueues[_0x64ce('0x2f')];}_0x3ecafc['push'](db['VoiceQueue'][_0x64ce('0x14')](queryQueues));_0x3ecafc[_0x64ce('0x30')](db[_0x64ce('0x31')]['findAll'](queryQueues));_0x3ecafc[_0x64ce('0x30')](db[_0x64ce('0x32')][_0x64ce('0x14')](queryQueues));_0x3ecafc['push'](db[_0x64ce('0x33')]['findAll'](queryQueues));_0x3ecafc[_0x64ce('0x30')](db['MailQueue'][_0x64ce('0x14')](queryQueues));_0x3ecafc[_0x64ce('0x30')](db[_0x64ce('0x34')]['findAll'](queryQueues));_0x3ecafc[_0x64ce('0x30')](db[_0x64ce('0x35')][_0x64ce('0x14')](queryQueues));_0x3ecafc['push'](db['User']['findAll'](queryTelephones));_0x3ecafc[_0x64ce('0x30')](db[_0x64ce('0x36')]['findAll'](queryTrunks));_0x3ecafc[_0x64ce('0x30')](db['Campaign'][_0x64ce('0x14')](queryCampaigns));_0x3ecafc[_0x64ce('0x30')](db['User'][_0x64ce('0x14')](queryAgents));break;case _0x64ce('0x37'):_0x40e475[_0x1974c1](_0x64ce('0x2c'));_0x40e475[_0x1974c1](_0x64ce('0x2d'));_0x3ecafc[_0x64ce('0x30')](getAssociatedResources(_0x64ce('0x38'),_0x37c4f4[_0x64ce('0x39')],_0x64ce('0x3a')));_0x3ecafc[_0x64ce('0x30')](getAssociatedResources(_0x64ce('0xf'),_0x37c4f4['userProfileId'],_0x64ce('0x31')));_0x3ecafc[_0x64ce('0x30')](getAssociatedResources('FaxQueues',_0x37c4f4[_0x64ce('0x39')],_0x64ce('0x32')));_0x3ecafc[_0x64ce('0x30')](getAssociatedResources(_0x64ce('0x3b'),_0x37c4f4['userProfileId'],_0x64ce('0x33')));_0x3ecafc[_0x64ce('0x30')](getAssociatedResources(_0x64ce('0x11'),_0x37c4f4['userProfileId'],_0x64ce('0x3c')));_0x3ecafc[_0x64ce('0x30')](getAssociatedResources(_0x64ce('0x12'),_0x37c4f4[_0x64ce('0x39')],_0x64ce('0x34')));_0x3ecafc[_0x64ce('0x30')](getAssociatedResources(_0x64ce('0x13'),_0x37c4f4[_0x64ce('0x39')],_0x64ce('0x35')));_0x3ecafc['push'](getAssociatedResources('Telephones',_0x37c4f4[_0x64ce('0x39')],_0x64ce('0x1a')));_0x3ecafc['push'](getAssociatedResources(_0x64ce('0x15'),_0x37c4f4[_0x64ce('0x39')],_0x64ce('0x36')));_0x3ecafc[_0x64ce('0x30')](getAssociatedResources(_0x64ce('0x16'),_0x37c4f4['userProfileId'],_0x64ce('0x3d')));_0x3ecafc['push'](db[_0x64ce('0x1a')]['findAll'](queryAgents));break;case'agent':_0x40e475[_0x1974c1](_0x64ce('0x2c'));_0x40e475[_0x1974c1]('voice:outbound');_0x3ecafc[_0x64ce('0x30')](_0x37c4f4[_0x64ce('0x3e')]({'attributes':['id',_0x64ce('0x6')]}));_0x3ecafc['push'](_0x37c4f4['getChatQueues']({'attributes':['id',_0x64ce('0x6')]}));_0x3ecafc[_0x64ce('0x30')](_0x37c4f4[_0x64ce('0x3f')]({'attributes':['id',_0x64ce('0x6')]}));_0x3ecafc['push'](_0x37c4f4[_0x64ce('0x40')]({'attributes':['id',_0x64ce('0x6')]}));_0x3ecafc['push'](_0x37c4f4['getMailQueues']({'attributes':['id',_0x64ce('0x6')]}));_0x3ecafc[_0x64ce('0x30')](_0x37c4f4['getOpenchannelQueues']({'attributes':['id','name']}));_0x3ecafc[_0x64ce('0x30')](_0x37c4f4['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0x64ce('0x41')](_0x3ecafc);}})['then'](function(_0x3e59e3){if(_0x3e59e3&&_0x3e59e3[_0x64ce('0x42')]){for(var _0x3bb548=0x0;_0x3bb548<_0x3e59e3[_0x64ce('0x42')];_0x3bb548+=0x1){for(var _0x3deeba=0x0;_0x3deeba<_0x3e59e3[_0x3bb548][_0x64ce('0x42')];_0x3deeba+=0x1){switch(_0x3bb548){case 0x0:joinOrLeaveQueues(_0x40e475,_0x1974c1,_0x64ce('0x43'),_0x3e59e3[_0x3bb548][_0x3deeba]);break;case 0x1:joinOrLeaveQueues(_0x40e475,_0x1974c1,_0x64ce('0x44'),_0x3e59e3[_0x3bb548][_0x3deeba]);break;case 0x2:joinOrLeaveQueues(_0x40e475,_0x1974c1,'fax',_0x3e59e3[_0x3bb548][_0x3deeba]);break;case 0x3:joinOrLeaveQueues(_0x40e475,_0x1974c1,_0x64ce('0x45'),_0x3e59e3[_0x3bb548][_0x3deeba]);break;case 0x4:joinOrLeaveQueues(_0x40e475,_0x1974c1,_0x64ce('0x46'),_0x3e59e3[_0x3bb548][_0x3deeba]);break;case 0x5:joinOrLeaveQueues(_0x40e475,_0x1974c1,_0x64ce('0x47'),_0x3e59e3[_0x3bb548][_0x3deeba]);break;case 0x6:joinOrLeaveQueues(_0x40e475,_0x1974c1,_0x64ce('0x48'),_0x3e59e3[_0x3bb548][_0x3deeba]);break;case 0x7:_0x40e475[_0x1974c1](util[_0x64ce('0x1d')](_0x64ce('0x49'),_0x3e59e3[_0x3bb548][_0x3deeba]['name']));break;case 0x8:_0x40e475[_0x1974c1](util[_0x64ce('0x1d')](_0x64ce('0x4a'),_0x3e59e3[_0x3bb548][_0x3deeba][_0x64ce('0x6')]));break;case 0x9:_0x40e475[_0x1974c1](util[_0x64ce('0x1d')](_0x64ce('0x4b'),_0x3e59e3[_0x3bb548][_0x3deeba]['type'],_0x3e59e3[_0x3bb548][_0x3deeba][_0x64ce('0x6')]));break;case 0xa:_0x40e475[_0x1974c1](util[_0x64ce('0x1d')](_0x64ce('0x2a'),_0x3e59e3[_0x3bb548][_0x3deeba]['name']));break;}}}}})['then'](function(){if(_0x1974c1===_0x64ce('0x4c')){var _0x519618=_[_0x64ce('0x19')](_0x1db89f[_0x64ce('0x22')],'id');return _0x1db89f[_0x64ce('0x4d')](_0x519618)[_0x64ce('0x1c')](function(){for(var _0x13b7da=0x0;_0x13b7da<_0x519618['length'];_0x13b7da+=0x1){_0xf13f0a['emit'](_0x64ce('0x4e'),{'ChatInteractionId':Number(_0x519618[_0x13b7da]),'UserId':Number(_0x1db89f['id'])});}});}})[_0x64ce('0x1c')](function(){if(_0x1974c1===_0x64ce('0x4c')){var _0x20c2a5=_[_0x64ce('0x19')](_0x1db89f[_0x64ce('0x23')],'id');return _0x1db89f[_0x64ce('0x4f')](_0x20c2a5)[_0x64ce('0x1c')](function(){for(var _0x3c8b2d=0x0;_0x3c8b2d<_0x20c2a5[_0x64ce('0x42')];_0x3c8b2d+=0x1){_0xf13f0a['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x20c2a5[_0x3c8b2d]),'UserId':Number(_0x1db89f['id'])});}});}})[_0x64ce('0x1c')](function(){if(_0x1974c1===_0x64ce('0x4c')){var _0x4a5cc5=_['map'](_0x1db89f[_0x64ce('0x24')],'id');return _0x1db89f[_0x64ce('0x50')](_0x4a5cc5)[_0x64ce('0x1c')](function(){for(var _0x4fc876=0x0;_0x4fc876<_0x4a5cc5[_0x64ce('0x42')];_0x4fc876+=0x1){_0xf13f0a[_0x64ce('0x51')](_0x64ce('0x52'),{'FaxInteractionId':Number(_0x4a5cc5[_0x4fc876]),'UserId':Number(_0x1db89f['id'])});}});}})[_0x64ce('0x1c')](function(){if(_0x1974c1===_0x64ce('0x4c')){var _0x2eb82a=_[_0x64ce('0x19')](_0x1db89f['SmsInteractions'],'id');return _0x1db89f[_0x64ce('0x53')](_0x2eb82a)[_0x64ce('0x1c')](function(){for(var _0x26072c=0x0;_0x26072c<_0x2eb82a[_0x64ce('0x42')];_0x26072c+=0x1){_0xf13f0a[_0x64ce('0x51')](_0x64ce('0x54'),{'SmsInteractionId':Number(_0x2eb82a[_0x26072c]),'UserId':Number(_0x1db89f['id'])});}});}})[_0x64ce('0x1c')](function(){if(_0x1974c1==='leave'){var _0x576ac6=_[_0x64ce('0x19')](_0x1db89f[_0x64ce('0x27')],'id');return _0x1db89f['removeOpenchannelInteractions'](_0x576ac6)[_0x64ce('0x1c')](function(){for(var _0x175afd=0x0;_0x175afd<_0x576ac6[_0x64ce('0x42')];_0x175afd+=0x1){_0xf13f0a[_0x64ce('0x51')](_0x64ce('0x55'),{'OpenchannelInteractionId':Number(_0x576ac6[_0x175afd]),'UserId':Number(_0x1db89f['id'])});}});}})[_0x64ce('0x1c')](function(){if(_0x1974c1===_0x64ce('0x4c')){var _0x80ab89=_[_0x64ce('0x19')](_0x1db89f[_0x64ce('0x29')],'id');return _0x1db89f['removeWhatsappInteractions'](_0x80ab89)[_0x64ce('0x1c')](function(){for(var _0x5381a7=0x0;_0x5381a7<_0x80ab89[_0x64ce('0x42')];_0x5381a7+=0x1){_0xf13f0a[_0x64ce('0x51')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x80ab89[_0x5381a7]),'UserId':Number(_0x1db89f['id'])});}});}})[_0x64ce('0x56')](function(_0x2d8818){_0x40e475[_0x64ce('0x57')](_0x2d8818);});}}function onDisconnect(_0x3c9fd4,_0xfe3a3a){joinOrLeave(_0x3c9fd4,'leave',_0xfe3a3a);}function onConnect(_0x2e2583){joinOrLeave(_0x2e2583,_0x64ce('0x58'));}exports['default']=function(_0x5a7d58){_0x5a7d58['on']('connection',function(_0x8a268){_0x8a268[_0x64ce('0x59')](0x0);_0x8a268[_0x64ce('0x5a')]=_0x8a268['request']['connection']['remoteAddress']+':'+_0x8a268[_0x64ce('0x5b')][_0x64ce('0x5c')][_0x64ce('0x5d')];_0x8a268[_0x64ce('0x5e')]=new Date();_0x8a268[_0x64ce('0x57')]=function(_0x53213e){console[_0x64ce('0x57')](_0x64ce('0x5f')+_0x8a268[_0x64ce('0x60')]['name']+'['+_0x8a268[_0x64ce('0x5a')]+']',_0x53213e);};_0x8a268['on'](_0x64ce('0x61'),function(){onDisconnect(_0x8a268,_0x5a7d58);_0x8a268[_0x64ce('0x57')]('DISCONNECTED');});onConnect(_0x8a268);_0x8a268[_0x64ce('0x57')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 6cc9cb1..52ec154 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 _0x297f=['toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','Fax','FaxInteraction','Mail','MailInteraction','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','error','code','Trigger,\x20%s','catch','get','channel','event','direction','User','UserId','interface','format','SIP/%s','incomingmessage','outgoingmessage','opened','changed','closed','find','name','default','model','hook','callback'];(function(_0x13357f,_0x210dc8){var _0x1fbbf1=function(_0x505bf2){while(--_0x505bf2){_0x13357f['push'](_0x13357f['shift']());}};_0x1fbbf1(++_0x210dc8);}(_0x297f,0x191));var _0xf297=function(_0x319aae,_0x1ba4b0){_0x319aae=_0x319aae-0x0;var _0x5d50c3=_0x297f[_0x319aae];return _0x5d50c3;};'use strict';var util=require(_0xf297('0x0'));var db=require(_0xf297('0x1'))['db'];var jayson=require(_0xf297('0x2'));var logger=require(_0xf297('0x3'))(_0xf297('0x4'));var client=jayson[_0xf297('0x5')][_0xf297('0x6')]({'port':0x232a});var triggers=[{'channel':_0xf297('0x7'),'model':_0xf297('0x8'),'event':_0xf297('0x9'),'condition':_0xf297('0xa'),'callback':afterCreate},{'channel':_0xf297('0x7'),'model':_0xf297('0x8'),'event':_0xf297('0xb'),'condition':_0xf297('0xc'),'callback':afterUpdate},{'channel':_0xf297('0x7'),'model':_0xf297('0xd'),'event':'afterCreate','condition':_0xf297('0xe'),'callback':afterCreateMessage},{'channel':_0xf297('0xf'),'model':_0xf297('0x10'),'event':_0xf297('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xf297('0xf'),'model':'SmsInteraction','event':_0xf297('0xb'),'condition':_0xf297('0xc'),'callback':afterUpdate},{'channel':_0xf297('0xf'),'model':_0xf297('0x11'),'event':_0xf297('0x9'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xf297('0x12'),'model':_0xf297('0x13'),'event':'afterCreate','condition':_0xf297('0xa'),'callback':afterCreate},{'channel':_0xf297('0x12'),'model':_0xf297('0x13'),'event':_0xf297('0xb'),'condition':_0xf297('0xc'),'callback':afterUpdate},{'channel':_0xf297('0x12'),'model':'WhatsappMessage','event':_0xf297('0x9'),'condition':_0xf297('0xe'),'callback':afterCreateMessage},{'channel':_0xf297('0x14'),'model':_0xf297('0x15'),'event':_0xf297('0x9'),'condition':_0xf297('0xa'),'callback':afterCreate},{'channel':_0xf297('0x14'),'model':'FaxInteraction','event':'afterUpdate','condition':_0xf297('0xc'),'callback':afterUpdate},{'channel':_0xf297('0x14'),'model':'FaxMessage','event':_0xf297('0x9'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xf297('0x16'),'model':_0xf297('0x17'),'event':_0xf297('0x9'),'condition':_0xf297('0xa'),'callback':afterCreate},{'channel':_0xf297('0x16'),'model':_0xf297('0x17'),'event':_0xf297('0xb'),'condition':_0xf297('0xc'),'callback':afterUpdate},{'channel':_0xf297('0x16'),'model':'MailMessage','event':_0xf297('0x9'),'condition':_0xf297('0xe'),'callback':afterCreateMessage},{'channel':_0xf297('0x18'),'model':_0xf297('0x19'),'event':_0xf297('0x9'),'condition':_0xf297('0xa'),'callback':afterCreate},{'channel':_0xf297('0x18'),'model':'OpenchannelInteraction','event':'afterUpdate','condition':_0xf297('0xc'),'callback':afterUpdate},{'channel':_0xf297('0x18'),'model':_0xf297('0x1a'),'event':_0xf297('0x9'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x4c60b2){return client[_0xf297('0x1b')](_0xf297('0x1c'),_0x4c60b2)[_0xf297('0x1d')](function(_0x2eea23){logger[_0xf297('0x1e')]('Trigger,\x20%s',_0xf297('0x1c'),_0x2eea23);if(_0x2eea23[_0xf297('0x1f')]){if(_0x2eea23[_0xf297('0x1f')][_0xf297('0x20')]===0x1f4){logger[_0xf297('0x1f')](_0xf297('0x21'),_0xf297('0x1c'),_0x2eea23['error']);}}})[_0xf297('0x22')](function(_0xea1b86){logger[_0xf297('0x1f')](_0xf297('0x21'),_0xf297('0x1c'),_0xea1b86);});}function afterCreateMessage(_0x4e5d06,_0x2c5e84){return function(_0x2b72d1,_0x5192bf){_0x2b72d1=_0x2b72d1[_0xf297('0x23')]({'plain':!![]});_0x2b72d1[_0xf297('0x24')]=_0x4e5d06;_0x2b72d1[_0xf297('0x25')]=_0x2b72d1[_0xf297('0x26')];if(_0x2b72d1['UserId']){return db[_0xf297('0x27')]['find']({'where':{'id':_0x2b72d1[_0xf297('0x28')]},'attributes':['id','name'],'raw':!![]})[_0xf297('0x1d')](function(_0x173c83){_0x2b72d1[_0xf297('0x29')]=util[_0xf297('0x2a')](_0xf297('0x2b'),_0x173c83['name']);_0x2b72d1[_0xf297('0x24')]=_0x4e5d06;return request({'event':_0xf297('0x2c'),'message':_0x2b72d1});})['catch'](function(_0xa05666){console['error'](_0xa05666);});}else{return request({'event':_0xf297('0x2d'),'message':_0x2b72d1});}};}function afterCreate(_0x5ad616,_0x3be85e){return function(_0x42f69e,_0x25a71d){_0x42f69e=_0x42f69e['get']({'plain':!![]});_0x42f69e[_0xf297('0x24')]=_0x5ad616;_0x42f69e[_0xf297('0x25')]=_0xf297('0x2e');return request({'event':_0x3be85e,'message':_0x42f69e});};}function afterUpdate(_0x2b7106,_0x26a3a6){return function(_0x1a0cd8,_0x495478){if(_0x1a0cd8[_0xf297('0x2f')](_0xf297('0x30'))&&_0x1a0cd8[_0xf297('0x30')]){_0x1a0cd8=_0x1a0cd8[_0xf297('0x23')]({'plain':!![]});_0x1a0cd8[_0xf297('0x24')]=_0x2b7106;_0x1a0cd8[_0xf297('0x25')]=_0xf297('0x30');if(_0x1a0cd8[_0xf297('0x28')]){return db[_0xf297('0x27')][_0xf297('0x31')]({'where':{'id':_0x1a0cd8['UserId']},'attributes':['id',_0xf297('0x32')],'raw':!![]})[_0xf297('0x1d')](function(_0x1061aa){_0x1a0cd8[_0xf297('0x29')]=util['format'](_0xf297('0x2b'),_0x1061aa['name']);return request({'event':_0x26a3a6,'message':_0x1a0cd8});})[_0xf297('0x22')](function(_0x4f23a8){console[_0xf297('0x1f')](_0x4f23a8);});}else{return request({'event':_0x26a3a6,'message':_0x1a0cd8});}}};}exports[_0xf297('0x33')]=function(){for(var _0xd4aac6=0x0;_0xd4aac6=_0x2353d7[_0x6fc7('0x15')]){throw Error(_0x6fc7('0x16'));}_0x5d3761(_0x192a8e);})[_0x6fc7('0x17')](function(_0x82aa3e){_0x38b2ee(_0x82aa3e);});});}; \ No newline at end of file +var _0x1123=['voice','mail','chat','fax','sms','whatsapp','openchannel','isValidChannel','includes','isUndefined','blockedAt','getLicense','role','agent','User','count','then','lodash','bluebird','../mysqldb','./license/util'];(function(_0x565eae,_0x176003){var _0x38744d=function(_0xb3a06e){while(--_0xb3a06e){_0x565eae['push'](_0x565eae['shift']());}};_0x38744d(++_0x176003);}(_0x1123,0x1b5));var _0x3112=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1123[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x3112('0x0'));var BPromise=require(_0x3112('0x1'));var db=require(_0x3112('0x2'))['db'];var util=require(_0x3112('0x3'));var channels=[_0x3112('0x4'),_0x3112('0x5'),_0x3112('0x6'),_0x3112('0x7'),_0x3112('0x8'),_0x3112('0x9'),_0x3112('0xa')];exports['getChannels']=function(){return channels;};exports[_0x3112('0xb')]=function(_0x19f813){_0x19f813=_0x19f813['toLowerCase']();return _[_0x3112('0xc')](channels,_0x19f813);};exports['clearBlockUser']=function(_0x2aff9f,_0x753e1e,_0x3ec1ba,_0x293cad){var _0x51309e={'loginAttempts':_0x753e1e,'blocked':_0x3ec1ba};if(!_[_0x3112('0xd')](_0x293cad)){_0x51309e[_0x3112('0xe')]=_0x293cad;}return _0x2aff9f['updateAttributes'](_0x51309e);};exports[_0x3112('0xf')]=function(_0x516a1f){return new BPromise(function(_0x576877,_0x5162b2){var _0x120940=0x0;if(_0x516a1f[_0x3112('0x10')]!==_0x3112('0x11')){_0x576877(_0x516a1f);}db[_0x3112('0x12')][_0x3112('0x13')]({'where':{'role':_0x3112('0x11'),'online':!![],'id':{'$ne':_0x516a1f['id']}}})[_0x3112('0x14')](function(_0x2048f2){_0x120940=_0x2048f2;return util[_0x3112('0xf')]();})[_0x3112('0x14')](function(_0x58355d){if(_0x58355d&&_0x58355d['agents']&&_0x120940>=_0x58355d['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x576877(_0x516a1f);})['catch'](function(_0x5f1306){_0x5162b2(_0x5f1306);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 0f5d5e1..178190e 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee05=['send','exports','404','status','render','json'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xee05,0xa3));var _0x5ee0=function(_0x484351,_0x45b168){_0x484351=_0x484351-0x0;var _0x20a53a=_0xee05[_0x484351];return _0x20a53a;};'use strict';module[_0x5ee0('0x0')][0x194]=function pageNotFound(_0xe3cca3,_0x597256){var _0x1051c2=_0x5ee0('0x1');var _0x26fc52=0x194;var _0x2f400b={'status':_0x26fc52};_0x597256['status'](_0x2f400b[_0x5ee0('0x2')]);_0x597256[_0x5ee0('0x3')](_0x1051c2,{},function(_0x48f207,_0x3963ef){if(_0x48f207){return _0x597256['status'](_0x2f400b['status'])[_0x5ee0('0x4')](_0x2f400b);}_0x597256[_0x5ee0('0x5')](_0x3963ef);});}; \ No newline at end of file +var _0x380c=['render','json','exports','404','status'];(function(_0x286a12,_0x4d60ac){var _0x2157fc=function(_0x27638e){while(--_0x27638e){_0x286a12['push'](_0x286a12['shift']());}};_0x2157fc(++_0x4d60ac);}(_0x380c,0x1e2));var _0xc380=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x380c[_0xa464c9];return _0x3d73c4;};'use strict';module[_0xc380('0x0')][0x194]=function pageNotFound(_0x1471a0,_0xad8823){var _0x183e93=_0xc380('0x1');var _0xc6d7b7=0x194;var _0x40e00a={'status':_0xc6d7b7};_0xad8823[_0xc380('0x2')](_0x40e00a[_0xc380('0x2')]);_0xad8823[_0xc380('0x3')](_0x183e93,{},function(_0x37b269,_0x316c52){if(_0x37b269){return _0xad8823[_0xc380('0x2')](_0x40e00a[_0xc380('0x2')])[_0xc380('0x4')](_0x40e00a);}_0xad8823['send'](_0x316c52);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 41b31ee..a76c8fe 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4453=['Contact','ContactId','MailAccountId','Imap','Smtp','Disposition','Dispositions','MailMessage','CmList','List','ListId','Template','Agents','MailInteractionId','Account','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','Interaction','restrict','Items','FaxAccountId','Answers','TagId','FaxInteractionId','Owner','fax_interaction_has_tags','team_has_fax_queues','SmsAccountId','Interactions','SmsApplication','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','AttachmentId','ChatWebsiteId','ProactiveActions','ChatApplication','ChatMessage','Queue','ChatQueueId','Website','chat_interaction_has_tags','user_has_chat_interactions','ChatInteractionId','ChatOfflineMessage','team_has_chat_queues','ChatGroupId','HopperFinals','cm_contact_has_tags','Agent','CampaignId','OwnerId','OneAll','Any','OneAny','AutomationAnyId','AutomationId','Intervals','MailApplications','Schedule','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','Trigger','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','AnalyticMetric','MetricId','SalesforceAccount','Configurations','SubjectId','Descriptions','DescriptionId','FieldId','AccountId','Description','Field','Variable','VariableId','SugarcrmConfiguration','SugarcrmField','Subjects','Subject','DeskAccount','DeskConfiguration','DeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','Dynamics365Account','Dynamics365Configuration','FreshsalesField','FromId','ToId','SessionId','JscriptyAnswerReport','SmsQueueReport','ProjectId','team_has_openchannel_queues','team_has_whatsapp_queues','WhatsappQueues','SquareProjectId','campaigns_has_cm_lists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToAgent','ToMailQueueId','ToAccount','ChatTransferReport','FromUserId','ToUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','UserProfileSection','UserProfileSections','sectionId','WhatsappMessage','user_has_whatsapp_accounts','WhatsappInteractionId','WhatsappAccountId','WhatsappQueueReport','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','lodash','jstz','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8_general_ci','sequelizeHistory','utf8','database','username','password','options','User','import','../api/user/user.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','../api/pause/pause.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/trigger/trigger.model','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfileSection/userProfileSection.model','UserProfileResource','Notification','../api/notification/notification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','../api/whatsappTransferReport/whatsappTransferReport.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','cascade','UserId','hasMany','VoiceQueuesRt','Extensions','CmHopperFinal','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','Notifications','SenderId','belongsTo','userProfileId','belongsToMany','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_fax_interactions','user_has_sms_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','MailQueues','ChatQueues','FaxQueues','SmsQueue','SmsQueues','OpenchannelQueues','WhatsappQueue','VoicePrefixes','user_has_voice_prefixes','ChatWebsite','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SquareProject','SquareProjects','user_has_square_projects','ChanSpyId','Applications','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','CmHopperBlack','HopperBlacks','JscriptySessionReport','JscriptySessions','Trunk','TrunkId','TrunkBackup','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','team_has_voice_queues','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports'];(function(_0x4a56ef,_0x1aff28){var _0x4d3724=function(_0x106b4d){while(--_0x106b4d){_0x4a56ef['push'](_0x4a56ef['shift']());}};_0x4d3724(++_0x1aff28);}(_0x4453,0x9c));var _0x3445=function(_0x268bc2,_0x4b6170){_0x268bc2=_0x268bc2-0x0;var _0x31c724=_0x4453[_0x268bc2];return _0x31c724;};'use strict';var path=require(_0x3445('0x0'));var config=require(_0x3445('0x1'));var Sequelize=require('sequelize');var _=require(_0x3445('0x2'));var jstz=require(_0x3445('0x3'));var timezone=jstz['determine']();config[_0x3445('0x4')]=_[_0x3445('0x5')](config[_0x3445('0x4')],{'database':_0x3445('0x6'),'username':_0x3445('0x7'),'password':_0x3445('0x8'),'options':{'host':_0x3445('0x9'),'port':0xcea,'dialect':_0x3445('0xa'),'dialectOptions':{'charset':_0x3445('0xb')},'logging':![],'timezone':timezone[_0x3445('0xc')](),'define':{'charset':'utf8','collate':_0x3445('0xd')}}});config[_0x3445('0xe')]=_[_0x3445('0x5')](config[_0x3445('0xe')],{'database':_0x3445('0x6'),'username':_0x3445('0x7'),'password':_0x3445('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x3445('0xa'),'dialectOptions':{'charset':_0x3445('0xb')},'logging':![],'timezone':timezone[_0x3445('0xc')](),'define':{'charset':_0x3445('0xf'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x3445('0x4')][_0x3445('0x10')],config[_0x3445('0x4')][_0x3445('0x11')],config[_0x3445('0x4')][_0x3445('0x12')],config[_0x3445('0x4')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x3445('0x10')],config['sequelizeHistory'][_0x3445('0x11')],config['sequelizeHistory'][_0x3445('0x12')],config[_0x3445('0xe')][_0x3445('0x13')])};db[_0x3445('0x14')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x16'));db['VoiceChanSpy']=db[_0x3445('0x4')][_0x3445('0x15')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x3445('0x17')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x18'));db[_0x3445('0x19')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x1a'));db[_0x3445('0x1b')]=db['sequelize'][_0x3445('0x15')](_0x3445('0x1c'));db[_0x3445('0x1d')]=db['sequelize']['import'](_0x3445('0x1e'));db[_0x3445('0x1f')]=db[_0x3445('0x4')]['import'](_0x3445('0x20'));db[_0x3445('0x21')]=db['sequelize'][_0x3445('0x15')]('../api/screenRecording/screenRecording.model');db[_0x3445('0x22')]=db['sequelize'][_0x3445('0x15')]('../api/voiceMail/voiceMail.model');db[_0x3445('0x23')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x24'));db['VoiceCallReport']=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x25'));db[_0x3445('0x26')]=db[_0x3445('0x4')][_0x3445('0x15')]('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db[_0x3445('0x4')][_0x3445('0x15')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x3445('0x27')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x28'));db['MemberReport']=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x29'));db['Trunk']=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x2a'));db['VoiceTransferReport']=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x2b'));db[_0x3445('0x2c')]=db['sequelize']['import'](_0x3445('0x2d'));db['UserVoiceQueue']=db[_0x3445('0x4')]['import'](_0x3445('0x2e'));db[_0x3445('0x2f')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x30'));db[_0x3445('0x31')]=db[_0x3445('0x4')]['import']('../api/userMailQueue/userMailQueue.model');db[_0x3445('0x32')]=db['sequelize'][_0x3445('0x15')]('../api/userFaxQueue/userFaxQueue.model');db[_0x3445('0x33')]=db[_0x3445('0x4')][_0x3445('0x15')]('../api/userSmsQueue/userSmsQueue.model');db[_0x3445('0x34')]=db['sequelize']['import'](_0x3445('0x35'));db[_0x3445('0x36')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x37'));db[_0x3445('0x38')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x39'));db[_0x3445('0x3a')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x3b'));db[_0x3445('0x3c')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x3d'));db[_0x3445('0x3e')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x3f'));db[_0x3445('0x40')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x41'));db[_0x3445('0x42')]=db['sequelize'][_0x3445('0x15')]('../api/mailInteraction/mailInteraction.model');db['MailMessage']=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x43'));db[_0x3445('0x44')]=db['sequelize'][_0x3445('0x15')](_0x3445('0x45'));db[_0x3445('0x46')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x47'));db[_0x3445('0x48')]=db['sequelize'][_0x3445('0x15')](_0x3445('0x49'));db[_0x3445('0x4a')]=db['sequelize'][_0x3445('0x15')](_0x3445('0x4b'));db[_0x3445('0x4c')]=db[_0x3445('0x4')]['import']('../api/faxAccount/faxAccount.model');db[_0x3445('0x4d')]=db['sequelize'][_0x3445('0x15')]('../api/faxApplication/faxApplication.model');db[_0x3445('0x4e')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x4f'));db[_0x3445('0x50')]=db['sequelize']['import'](_0x3445('0x51'));db[_0x3445('0x52')]=db[_0x3445('0x4')][_0x3445('0x15')]('../api/faxQueue/faxQueue.model');db[_0x3445('0x53')]=db[_0x3445('0x4')]['import'](_0x3445('0x54'));db[_0x3445('0x55')]=db[_0x3445('0x4')][_0x3445('0x15')]('../api/smsAccount/smsAccount.model');db['SmsApplication']=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x56'));db[_0x3445('0x57')]=db['sequelize'][_0x3445('0x15')]('../api/smsInteraction/smsInteraction.model');db[_0x3445('0x58')]=db['sequelize'][_0x3445('0x15')](_0x3445('0x59'));db['SmsQueue']=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x5a'));db[_0x3445('0x5b')]=db['sequelize']['import']('../api/openchannelAccount/openchannelAccount.model');db[_0x3445('0x5c')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x5d'));db[_0x3445('0x5e')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x5f'));db[_0x3445('0x60')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x61'));db[_0x3445('0x62')]=db['sequelize'][_0x3445('0x15')](_0x3445('0x63'));db['ChatWebsite']=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x64'));db[_0x3445('0x65')]=db['sequelize'][_0x3445('0x15')](_0x3445('0x66'));db['ChatApplication']=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x67'));db[_0x3445('0x68')]=db['sequelize']['import'](_0x3445('0x69'));db['ChatMessage']=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x6a'));db['ChatOfflineMessage']=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x6b'));db[_0x3445('0x6c')]=db[_0x3445('0x4')][_0x3445('0x15')]('../api/chatQueue/chatQueue.model');db[_0x3445('0x6d')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x6e'));db[_0x3445('0x6f')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x70'));db[_0x3445('0x71')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x72'));db[_0x3445('0x73')]=db[_0x3445('0x4')][_0x3445('0x15')]('../api/cmContact/cmContact.model');db[_0x3445('0x74')]=db[_0x3445('0x4')][_0x3445('0x15')]('../api/cmHopper/cmHopper.model');db['CmHopperBlack']=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x75'));db['CmHopperFinal']=db['sequelize'][_0x3445('0x15')]('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db[_0x3445('0x4')]['import'](_0x3445('0x76'));db[_0x3445('0x77')]=db[_0x3445('0x4')][_0x3445('0x15')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x3445('0x78')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x79'));db[_0x3445('0x7a')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x7b'));db[_0x3445('0x7c')]=db['sequelize'][_0x3445('0x15')]('../api/automation/automation.model');db[_0x3445('0x7d')]=db['sequelize'][_0x3445('0x15')](_0x3445('0x7e'));db['Disposition']=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x7f'));db[_0x3445('0x80')]=db['sequelize'][_0x3445('0x15')]('../api/condition/condition.model');db[_0x3445('0x81')]=db['sequelize'][_0x3445('0x15')](_0x3445('0x82'));db['Pause']=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x83'));db['Cdr']=db[_0x3445('0x4')][_0x3445('0x15')]('../api/cdr/cdr.model');db['VoiceQueuesLog']=db['sequelize'][_0x3445('0x15')]('../api/voiceQueuesLog/voiceQueuesLog.model');db['Schedule']=db['sequelize'][_0x3445('0x15')](_0x3445('0x84'));db[_0x3445('0x85')]=db[_0x3445('0x4')]['import'](_0x3445('0x86'));db[_0x3445('0x87')]=db['sequelize'][_0x3445('0x15')](_0x3445('0x88'));db['Template']=db[_0x3445('0x4')]['import']('../api/template/template.model');db['Trigger']=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x89'));db['Variable']=db[_0x3445('0x4')]['import']('../api/variable/variable.model');db[_0x3445('0x8a')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x8b'));db[_0x3445('0x8c')]=db[_0x3445('0x4')][_0x3445('0x15')]('../api/integrationReport/integrationReport.model');db[_0x3445('0x8d')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x8e'));db[_0x3445('0x8f')]=db['sequelize']['import'](_0x3445('0x90'));db['AnalyticExtractedReport']=db[_0x3445('0x4')][_0x3445('0x15')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db['sequelize'][_0x3445('0x15')](_0x3445('0x91'));db[_0x3445('0x92')]=db[_0x3445('0x4')][_0x3445('0x15')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0x3445('0x93')]=db['sequelize'][_0x3445('0x15')]('../api/analyticTreeReport/analyticTreeReport.model');db['SalesforceAccount']=db['sequelize'][_0x3445('0x15')](_0x3445('0x94'));db[_0x3445('0x95')]=db[_0x3445('0x4')][_0x3445('0x15')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x3445('0x96')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x97'));db[_0x3445('0x98')]=db[_0x3445('0x4')]['import'](_0x3445('0x99'));db['SugarcrmConfiguration']=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x9a'));db['SugarcrmField']=db['sequelize'][_0x3445('0x15')]('../api/intSugarcrmField/intSugarcrmField.model');db['DeskAccount']=db[_0x3445('0x4')][_0x3445('0x15')]('../api/intDeskAccount/intDeskAccount.model');db['DeskConfiguration']=db[_0x3445('0x4')]['import'](_0x3445('0x9b'));db['DeskField']=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x9c'));db[_0x3445('0x9d')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x9e'));db[_0x3445('0x9f')]=db[_0x3445('0x4')]['import'](_0x3445('0xa0'));db[_0x3445('0xa1')]=db[_0x3445('0x4')]['import'](_0x3445('0xa2'));db[_0x3445('0xa3')]=db[_0x3445('0x4')][_0x3445('0x15')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x3445('0xa4')]=db['sequelize']['import'](_0x3445('0xa5'));db[_0x3445('0xa6')]=db['sequelize'][_0x3445('0x15')]('../api/intZendeskField/intZendeskField.model');db[_0x3445('0xa7')]=db['sequelize'][_0x3445('0x15')](_0x3445('0xa8'));db[_0x3445('0xa9')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0xaa'));db[_0x3445('0xab')]=db[_0x3445('0x4')]['import'](_0x3445('0xac'));db[_0x3445('0xad')]=db['sequelize'][_0x3445('0x15')](_0x3445('0xae'));db['VtigerConfiguration']=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0xaf'));db[_0x3445('0xb0')]=db['sequelize'][_0x3445('0x15')](_0x3445('0xb1'));db[_0x3445('0xb2')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0xb3'));db[_0x3445('0xb4')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0xb5'));db[_0x3445('0xb6')]=db[_0x3445('0x4')]['import']('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0xb7'));db['Dynamics365Configuration']=db[_0x3445('0x4')][_0x3445('0x15')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x3445('0xb8')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0xb9'));db[_0x3445('0xba')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0xbb'));db[_0x3445('0xbc')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0xbd'));db['FreshsalesField']=db['sequelize'][_0x3445('0x15')](_0x3445('0xbe'));db[_0x3445('0x8a')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0x8b'));db[_0x3445('0xbf')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0xc0'));db[_0x3445('0xc1')]=db['sequelize'][_0x3445('0x15')](_0x3445('0xc2'));db[_0x3445('0xc3')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0xc4'));db['JscriptyAnswerReport']=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0xc5'));db[_0x3445('0xc6')]=db[_0x3445('0x4')][_0x3445('0x15')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0x3445('0x4')]['import'](_0x3445('0xc7'));db['SmsQueueReport']=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0xc8'));db[_0x3445('0xc9')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0xca'));db[_0x3445('0xcb')]=db[_0x3445('0x4')][_0x3445('0x15')]('../api/squareReportDetail/squareReportDetail.model');db[_0x3445('0xcc')]=db[_0x3445('0x4')][_0x3445('0x15')]('../api/jscriptyProject/jscriptyProject.model');db[_0x3445('0xcd')]=db[_0x3445('0x4')]['import'](_0x3445('0xce'));db[_0x3445('0xcf')]=db['sequelize'][_0x3445('0x15')]('../api/squareOdbc/squareOdbc.model');db['SquareProject']=db['sequelize']['import'](_0x3445('0xd0'));db[_0x3445('0xd1')]=db['sequelize'][_0x3445('0x15')]('../api/squareRecording/squareRecording.model');db[_0x3445('0xd2')]=db[_0x3445('0x4')]['import'](_0x3445('0xd3'));db[_0x3445('0xd4')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0xd5'));db[_0x3445('0xd6')]=db['sequelize'][_0x3445('0x15')](_0x3445('0xd7'));db[_0x3445('0xd8')]=db['sequelize'][_0x3445('0x15')]('../api/campaign/campaign.model');db['Migration']=db[_0x3445('0x4')]['import'](_0x3445('0xd9'));db[_0x3445('0xda')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0xdb'));db[_0x3445('0xdc')]=db['sequelize'][_0x3445('0x15')](_0x3445('0xdd'));db['MailTransferReport']=db['sequelize'][_0x3445('0x15')]('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0xde'));db[_0x3445('0xdf')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0xe0'));db[_0x3445('0xe1')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0xe2'));db['SmsTransferReport']=db[_0x3445('0x4')]['import'](_0x3445('0xe3'));db['CmList']=db['sequelize']['import']('../api/cmList/cmList.model');db[_0x3445('0xe4')]=db[_0x3445('0x4')]['import'](_0x3445('0xe5'));db[_0x3445('0xe6')]=db[_0x3445('0x4')][_0x3445('0x15')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db['sequelize'][_0x3445('0x15')](_0x3445('0xe7'));db[_0x3445('0xe8')]=db['sequelize'][_0x3445('0x15')]('../api/userProfileResource/userProfileResource.model');db[_0x3445('0xe9')]=db['sequelize'][_0x3445('0x15')](_0x3445('0xea'));db[_0x3445('0xeb')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0xec'));db[_0x3445('0xed')]=db['sequelize'][_0x3445('0x15')](_0x3445('0xee'));db[_0x3445('0xef')]=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0xf0'));db['WhatsappMessage']=db[_0x3445('0x4')][_0x3445('0x15')](_0x3445('0xf1'));db['WhatsappQueueReport']=db['sequelize']['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db['WhatsappTransferReport']=db['sequelize']['import'](_0x3445('0xf2'));db['WhatsappQueue']=db['sequelize']['import']('../api/whatsappQueue/whatsappQueue.model');db[_0x3445('0xf3')]=db['sequelize']['import'](_0x3445('0xf4'));db['User'][_0x3445('0xf5')](db[_0x3445('0x22')],{'as':'VoiceMail','onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0xf7')});db[_0x3445('0x14')][_0x3445('0xf8')](db[_0x3445('0x1f')],{'as':'Recordings','foreignKey':_0x3445('0xf7')});db[_0x3445('0x14')]['hasMany'](db[_0x3445('0x2c')],{'as':_0x3445('0xf9'),'foreignKey':'UserId'});db[_0x3445('0x14')][_0x3445('0xf8')](db[_0x3445('0x19')],{'as':_0x3445('0xfa'),'onDelete':_0x3445('0xf6'),'hooks':!![]});db['User'][_0x3445('0xf8')](db[_0x3445('0xfb')],{'as':'HopperFinals','foreignKey':_0x3445('0xf7')});db['User'][_0x3445('0xf8')](db[_0x3445('0xfc')],{'as':_0x3445('0xfd'),'foreignKey':'UserId'});db[_0x3445('0x14')]['hasMany'](db['ReportAgentPreview'],{'as':_0x3445('0x77'),'foreignKey':'UserId'});db[_0x3445('0x14')][_0x3445('0xf8')](db['OpenchannelInteraction'],{'as':_0x3445('0xfe'),'foreignKey':_0x3445('0xf7')});db[_0x3445('0x14')][_0x3445('0xf8')](db[_0x3445('0x68')],{'as':_0x3445('0xff'),'foreignKey':'UserId'});db['User'][_0x3445('0xf8')](db['SmsInteraction'],{'as':_0x3445('0x100'),'foreignKey':_0x3445('0xf7')});db[_0x3445('0x14')]['hasMany'](db[_0x3445('0x4e')],{'as':_0x3445('0x101'),'foreignKey':'UserId'});db[_0x3445('0x14')][_0x3445('0xf8')](db[_0x3445('0x42')],{'as':_0x3445('0x102'),'foreignKey':'UserId'});db[_0x3445('0x14')][_0x3445('0xf8')](db[_0x3445('0xef')],{'as':'WhatsappInteractions','foreignKey':_0x3445('0xf7')});db[_0x3445('0x14')][_0x3445('0xf8')](db[_0x3445('0xe9')],{'as':_0x3445('0x103'),'foreignKey':_0x3445('0x104')});db[_0x3445('0x14')][_0x3445('0x105')](db[_0x3445('0xe6')],{'as':_0x3445('0xe6'),'foreignKey':_0x3445('0x106')});db[_0x3445('0x14')][_0x3445('0x107')](db['ChatGroup'],{'as':'Groups','through':_0x3445('0x108')});db[_0x3445('0x14')][_0x3445('0x107')](db[_0x3445('0x73')],{'as':_0x3445('0x109'),'through':_0x3445('0x10a')});db[_0x3445('0x14')]['belongsToMany'](db['CmList'],{'as':_0x3445('0x10b'),'through':_0x3445('0x10c')});db[_0x3445('0x14')][_0x3445('0x107')](db['Team'],{'through':_0x3445('0x10d')});db[_0x3445('0x14')][_0x3445('0x107')](db[_0x3445('0x42')],{'as':'MailInteractions','through':'user_has_mail_interactions'});db[_0x3445('0x14')][_0x3445('0x107')](db[_0x3445('0x68')],{'as':_0x3445('0xff'),'through':'user_has_chat_interactions'});db[_0x3445('0x14')][_0x3445('0x107')](db[_0x3445('0x4e')],{'as':'FaxInteractions','through':_0x3445('0x10e')});db[_0x3445('0x14')]['belongsToMany'](db[_0x3445('0x57')],{'as':'SmsInteractions','through':_0x3445('0x10f')});db[_0x3445('0x14')][_0x3445('0x107')](db['OpenchannelInteraction'],{'as':_0x3445('0xfe'),'through':'user_has_openchannel_interactions'});db[_0x3445('0x14')][_0x3445('0x107')](db[_0x3445('0xef')],{'as':_0x3445('0x110'),'through':_0x3445('0x111')});db[_0x3445('0x14')][_0x3445('0x107')](db[_0x3445('0x1d')],{'as':_0x3445('0x112'),'through':_0x3445('0x113'),'required':![]});db[_0x3445('0x14')][_0x3445('0x107')](db[_0x3445('0x3e')],{'as':_0x3445('0x114'),'through':'UserMailQueue','required':![]});db[_0x3445('0x14')]['belongsToMany'](db[_0x3445('0x6c')],{'as':_0x3445('0x115'),'through':_0x3445('0x2f'),'required':![],'hooks':!![]});db['User'][_0x3445('0x107')](db['FaxQueue'],{'as':_0x3445('0x116'),'through':_0x3445('0x32'),'required':![]});db[_0x3445('0x14')][_0x3445('0x107')](db[_0x3445('0x117')],{'as':_0x3445('0x118'),'through':'UserSmsQueue','required':![]});db[_0x3445('0x14')]['belongsToMany'](db[_0x3445('0x62')],{'as':_0x3445('0x119'),'through':'UserOpenchannelQueue','required':![]});db[_0x3445('0x14')]['belongsToMany'](db[_0x3445('0x11a')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db['User'][_0x3445('0x107')](db['CmList'],{'through':'cm_user_has_lists'});db[_0x3445('0x14')][_0x3445('0x107')](db[_0x3445('0xe4')],{'as':_0x3445('0x11b'),'through':_0x3445('0x11c'),'required':![]});db[_0x3445('0x14')]['belongsToMany'](db[_0x3445('0x11d')],{'as':'ChatWebsites','through':_0x3445('0x11e')});db[_0x3445('0x14')][_0x3445('0x107')](db[_0x3445('0x4c')],{'as':'FaxAccounts','through':_0x3445('0x11f')});db['User']['belongsToMany'](db[_0x3445('0x3c')],{'as':_0x3445('0x120'),'through':_0x3445('0x121')});db[_0x3445('0x14')][_0x3445('0x107')](db[_0x3445('0x5b')],{'as':_0x3445('0x122'),'through':_0x3445('0x123')});db[_0x3445('0x14')][_0x3445('0x107')](db['SmsAccount'],{'as':_0x3445('0x124'),'through':_0x3445('0x125')});db[_0x3445('0x14')][_0x3445('0x107')](db[_0x3445('0xeb')],{'as':_0x3445('0x126'),'through':'user_has_whatsapp_accounts'});db['User']['belongsToMany'](db[_0x3445('0x127')],{'as':_0x3445('0x128'),'through':_0x3445('0x129')});db['VoiceChanSpy']['hasMany'](db[_0x3445('0x19')],{'as':'SpiedAgents','onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x12a')});db[_0x3445('0x17')][_0x3445('0xf8')](db[_0x3445('0x19')],{'onDelete':_0x3445('0xf6')});db[_0x3445('0x19')][_0x3445('0xf8')](db[_0x3445('0x19')],{'as':_0x3445('0x12b'),'onDelete':_0x3445('0xf6')});db[_0x3445('0x1b')][_0x3445('0x107')](db[_0x3445('0x85')],{'as':'Sounds','through':_0x3445('0x12c')});db['VoiceQueue'][_0x3445('0xf8')](db[_0x3445('0x2c')],{'as':_0x3445('0x12d'),'foreignKey':_0x3445('0x12e')});db[_0x3445('0x1d')][_0x3445('0xf8')](db['CmHopper'],{'as':_0x3445('0x12f'),'foreignKey':_0x3445('0x12e')});db[_0x3445('0x1d')][_0x3445('0xf8')](db[_0x3445('0xfb')],{'as':'HopperFinals','foreignKey':_0x3445('0x12e')});db[_0x3445('0x1d')]['hasMany'](db[_0x3445('0xfc')],{'as':_0x3445('0x130'),'foreignKey':_0x3445('0x12e')});db['VoiceQueue']['hasMany'](db[_0x3445('0x77')],{'as':_0x3445('0x77'),'foreignKey':'VoiceQueueId'});db[_0x3445('0x1d')][_0x3445('0xf8')](db[_0x3445('0x131')],{'as':_0x3445('0x132'),'foreignKey':_0x3445('0x12e')});db[_0x3445('0x1d')]['hasMany'](db[_0x3445('0x133')],{'as':_0x3445('0x134'),'foreignKey':_0x3445('0x12e')});db[_0x3445('0x1d')][_0x3445('0x105')](db[_0x3445('0x135')],{'as':'Trunk','foreignKey':_0x3445('0x136')});db[_0x3445('0x1d')]['belongsTo'](db['Trunk'],{'as':_0x3445('0x137'),'foreignKey':'TrunkBackupId'});db['VoiceQueue'][_0x3445('0x105')](db[_0x3445('0x81')],{'as':_0x3445('0x81'),'foreignKey':_0x3445('0x138')});db[_0x3445('0x1d')][_0x3445('0x105')](db[_0x3445('0x139')],{'as':_0x3445('0x13a'),'foreignKey':_0x3445('0x13b')});db['VoiceQueue'][_0x3445('0x107')](db['CmList'],{'as':_0x3445('0x10b'),'through':_0x3445('0x13c')});db[_0x3445('0x1d')][_0x3445('0x107')](db[_0x3445('0x14')],{'as':'Agents','through':_0x3445('0x113')});db[_0x3445('0x1d')][_0x3445('0x107')](db['Team'],{'as':_0x3445('0x13d'),'through':_0x3445('0x13e')});db[_0x3445('0x1d')]['belongsToMany'](db['CmList'],{'as':'BlackLists','through':_0x3445('0x13f')});db[_0x3445('0x1f')]['belongsTo'](db[_0x3445('0x14')],{'as':'User','foreignKey':'UserId'});db[_0x3445('0x21')]['belongsTo'](db[_0x3445('0x14')],{'as':'User','foreignKey':_0x3445('0xf7')});db[_0x3445('0x22')][_0x3445('0xf8')](db[_0x3445('0x23')],{'as':_0x3445('0x140'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':_0x3445('0x141')});db[_0x3445('0x23')][_0x3445('0x105')](db[_0x3445('0x22')],{'foreignKey':_0x3445('0x142'),'targetKey':_0x3445('0x141')});db[_0x3445('0x143')][_0x3445('0xf8')](db['VoiceQueueReport'],{'as':_0x3445('0x144'),'foreignKey':_0x3445('0x145'),'constraints':![]});db['VoiceCallReport']['hasMany'](db[_0x3445('0x146')],{'as':_0x3445('0x147'),'foreignKey':_0x3445('0x145'),'constraints':![]});db[_0x3445('0x143')][_0x3445('0x105')](db[_0x3445('0x14')],{'as':_0x3445('0x14'),'foreignKey':_0x3445('0xf7')});db[_0x3445('0x143')][_0x3445('0x105')](db[_0x3445('0x73')],{'as':_0x3445('0x148'),'foreignKey':_0x3445('0x149')});db[_0x3445('0x38')][_0x3445('0x105')](db['MailAccount'],{'as':_0x3445('0x3c'),'foreignKey':'MailAccountId'});db[_0x3445('0x3a')][_0x3445('0x105')](db[_0x3445('0x3c')],{'as':_0x3445('0x3c'),'foreignKey':_0x3445('0x14a')});db[_0x3445('0x3c')][_0x3445('0xf5')](db['MailServerIn'],{'as':_0x3445('0x14b'),'onDelete':_0x3445('0xf6')});db[_0x3445('0x3c')][_0x3445('0xf5')](db[_0x3445('0x3a')],{'as':_0x3445('0x14c'),'onDelete':'cascade'});db[_0x3445('0x3c')][_0x3445('0xf8')](db[_0x3445('0x14d')],{'as':_0x3445('0x14e'),'foreignKey':_0x3445('0x14a')});db['MailAccount']['hasMany'](db[_0x3445('0x7d')],{'as':'Answers','foreignKey':_0x3445('0x14a')});db[_0x3445('0x3c')]['hasMany'](db[_0x3445('0x14f')],{'as':_0x3445('0x140'),'foreignKey':'MailAccountId'});db[_0x3445('0x3c')][_0x3445('0xf8')](db[_0x3445('0x42')],{'as':'Interactions'});db[_0x3445('0x3c')][_0x3445('0xf8')](db[_0x3445('0x44')],{'as':_0x3445('0x12b')});db[_0x3445('0x3c')][_0x3445('0x105')](db[_0x3445('0x150')],{'as':_0x3445('0x151'),'foreignKey':_0x3445('0x152')});db[_0x3445('0x3c')][_0x3445('0x105')](db['Template'],{'as':_0x3445('0x153'),'foreignKey':'TemplateId'});db[_0x3445('0x3c')][_0x3445('0x105')](db[_0x3445('0x139')],{'as':_0x3445('0x13a'),'foreignKey':_0x3445('0x13b')});db[_0x3445('0x3c')][_0x3445('0x107')](db['User'],{'as':_0x3445('0x154'),'through':_0x3445('0x121')});db['MailQueue'][_0x3445('0x107')](db['User'],{'as':_0x3445('0x154'),'through':_0x3445('0x31')});db[_0x3445('0x3e')][_0x3445('0x107')](db['Team'],{'through':'team_has_mail_queues','as':_0x3445('0x13d')});db['MailInteraction'][_0x3445('0xf8')](db['MailMessage'],{'as':_0x3445('0x140'),'onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x155')});db['MailInteraction'][_0x3445('0x105')](db[_0x3445('0x3c')],{'as':_0x3445('0x156'),'foreignKey':_0x3445('0x14a')});db[_0x3445('0x42')][_0x3445('0x105')](db[_0x3445('0x73')],{'as':_0x3445('0x148'),'foreignKey':'ContactId'});db['MailInteraction']['belongsTo'](db[_0x3445('0x14')],{'as':'Owner','foreignKey':'UserId'});db[_0x3445('0x42')][_0x3445('0x107')](db[_0x3445('0x87')],{'through':_0x3445('0x157'),'as':_0x3445('0x158')});db['MailInteraction']['belongsToMany'](db[_0x3445('0x87')],{'through':'mail_interaction_has_tags','as':_0x3445('0x159')});db[_0x3445('0x42')][_0x3445('0x107')](db['User'],{'as':_0x3445('0x15a'),'through':_0x3445('0x15b'),'foreignKey':_0x3445('0x155')});db[_0x3445('0x14f')][_0x3445('0xf8')](db[_0x3445('0xda')],{'as':_0x3445('0x15c'),'onDelete':_0x3445('0xf6')});db[_0x3445('0x14f')][_0x3445('0x105')](db[_0x3445('0x14')],{'as':_0x3445('0x14')});db[_0x3445('0x14f')][_0x3445('0x105')](db[_0x3445('0x73')],{'onDelete':_0x3445('0xf6'),'as':'Contact'});db[_0x3445('0x14f')][_0x3445('0x105')](db[_0x3445('0x42')],{'as':_0x3445('0x15d'),'foreignKey':_0x3445('0x155')});db['MailMessage'][_0x3445('0x105')](db['MailAccount'],{'as':_0x3445('0x156'),'foreignKey':'MailAccountId'});db[_0x3445('0x44')][_0x3445('0x105')](db[_0x3445('0x14')],{'onDelete':'restrict'});db[_0x3445('0x44')][_0x3445('0x105')](db[_0x3445('0x3e')],{'onDelete':'restrict'});db['MailApplication'][_0x3445('0x105')](db[_0x3445('0x3c')],{'onDelete':_0x3445('0x15e')});db[_0x3445('0x44')]['belongsTo'](db[_0x3445('0x81')],{'onDelete':'restrict','foreignKey':_0x3445('0x138')});db['MailApplication'][_0x3445('0x105')](db['Tag'],{'onDelete':_0x3445('0x15e'),'foreignKey':'TagId'});db[_0x3445('0x46')]['belongsTo'](db[_0x3445('0x3c')],{});db['MailQueueReport']['belongsTo'](db[_0x3445('0x150')],{'as':_0x3445('0x151'),'foreignKey':_0x3445('0x152')});db[_0x3445('0x46')]['belongsTo'](db[_0x3445('0x73')],{'as':_0x3445('0x148'),'foreignKey':_0x3445('0x149')});db[_0x3445('0x46')]['belongsTo'](db[_0x3445('0x42')],{});db[_0x3445('0x46')][_0x3445('0x105')](db['MailMessage'],{});db[_0x3445('0x46')][_0x3445('0x105')](db['User'],{});db[_0x3445('0x46')][_0x3445('0x105')](db[_0x3445('0x3e')],{});db['Dashboard'][_0x3445('0xf8')](db[_0x3445('0x4a')],{'as':_0x3445('0x15f'),'onDelete':_0x3445('0xf6')});db[_0x3445('0x4c')]['hasMany'](db[_0x3445('0x14d')],{'as':_0x3445('0x14e'),'foreignKey':_0x3445('0x160')});db[_0x3445('0x4c')][_0x3445('0xf8')](db[_0x3445('0x7d')],{'as':_0x3445('0x161'),'foreignKey':_0x3445('0x160')});db[_0x3445('0x4c')]['hasMany'](db[_0x3445('0x4e')],{'as':'Interactions'});db[_0x3445('0x4c')][_0x3445('0xf8')](db[_0x3445('0x4d')],{'as':_0x3445('0x12b')});db[_0x3445('0x4c')]['hasMany'](db[_0x3445('0x19')],{'as':'Exntensions','onDelete':_0x3445('0xf6')});db[_0x3445('0x4c')]['hasMany'](db['FaxMessage'],{'as':_0x3445('0x140')});db[_0x3445('0x4c')]['belongsTo'](db[_0x3445('0x135')],{'as':_0x3445('0x135')});db[_0x3445('0x4c')]['belongsTo'](db[_0x3445('0x150')],{'as':'List','foreignKey':'ListId'});db[_0x3445('0x4c')][_0x3445('0x105')](db['Pause'],{'as':_0x3445('0x13a'),'foreignKey':_0x3445('0x13b')});db[_0x3445('0x4c')][_0x3445('0x107')](db[_0x3445('0x14')],{'as':_0x3445('0x154'),'through':_0x3445('0x11f')});db[_0x3445('0x4d')][_0x3445('0x105')](db[_0x3445('0x14')],{'onDelete':_0x3445('0x15e')});db[_0x3445('0x4d')][_0x3445('0x105')](db[_0x3445('0x52')],{'onDelete':'restrict'});db[_0x3445('0x4d')][_0x3445('0x105')](db[_0x3445('0x4c')],{'onDelete':_0x3445('0x15e')});db[_0x3445('0x4d')][_0x3445('0x105')](db[_0x3445('0x87')],{'onDelete':_0x3445('0x15e'),'foreignKey':_0x3445('0x162')});db[_0x3445('0x4e')][_0x3445('0xf8')](db[_0x3445('0x50')],{'as':'Messages','onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x163')});db[_0x3445('0x4e')][_0x3445('0x105')](db[_0x3445('0x4c')],{'as':'Account','foreignKey':_0x3445('0x160')});db[_0x3445('0x4e')][_0x3445('0x105')](db[_0x3445('0x73')],{'as':_0x3445('0x148'),'foreignKey':'ContactId'});db[_0x3445('0x4e')][_0x3445('0x105')](db[_0x3445('0x14')],{'as':_0x3445('0x164'),'foreignKey':'UserId'});db[_0x3445('0x4e')][_0x3445('0x107')](db[_0x3445('0x87')],{'through':_0x3445('0x165'),'as':_0x3445('0x158')});db[_0x3445('0x4e')]['belongsToMany'](db['Tag'],{'through':_0x3445('0x165'),'as':_0x3445('0x159')});db[_0x3445('0x4e')]['belongsToMany'](db[_0x3445('0x14')],{'as':_0x3445('0x15a'),'through':_0x3445('0x10e'),'foreignKey':_0x3445('0x163')});db[_0x3445('0x50')][_0x3445('0x105')](db['User'],{'onDelete':_0x3445('0xf6'),'as':_0x3445('0x14')});db[_0x3445('0x50')]['belongsTo'](db[_0x3445('0x4e')],{'as':_0x3445('0x15d'),'foreignKey':_0x3445('0x163')});db[_0x3445('0x50')][_0x3445('0x105')](db[_0x3445('0x73')],{'onDelete':_0x3445('0xf6'),'as':'Contact'});db[_0x3445('0x50')]['belongsTo'](db[_0x3445('0xda')],{'as':_0x3445('0xda'),'foreignKey':'AttachmentId'});db[_0x3445('0x50')][_0x3445('0x105')](db['FaxAccount'],{'as':_0x3445('0x156'),'foreignKey':'FaxAccountId'});db[_0x3445('0x52')]['belongsToMany'](db[_0x3445('0x14')],{'as':_0x3445('0x154'),'through':'UserFaxQueue'});db[_0x3445('0x52')]['belongsToMany'](db['Team'],{'through':_0x3445('0x166'),'as':_0x3445('0x13d')});db[_0x3445('0x53')][_0x3445('0x105')](db['FaxAccount'],{});db[_0x3445('0x53')][_0x3445('0x105')](db[_0x3445('0x150')],{'as':_0x3445('0x151'),'foreignKey':_0x3445('0x152')});db[_0x3445('0x53')]['belongsTo'](db['CmContact'],{'as':_0x3445('0x148'),'foreignKey':_0x3445('0x149')});db['FaxQueueReport'][_0x3445('0x105')](db[_0x3445('0x4e')],{});db[_0x3445('0x53')][_0x3445('0x105')](db[_0x3445('0x50')],{});db[_0x3445('0x53')][_0x3445('0x105')](db[_0x3445('0x14')],{});db[_0x3445('0x53')][_0x3445('0x105')](db[_0x3445('0x52')],{});db[_0x3445('0x55')][_0x3445('0xf8')](db[_0x3445('0x14d')],{'as':_0x3445('0x14e'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x3445('0xf8')](db[_0x3445('0x7d')],{'as':_0x3445('0x161'),'foreignKey':'SmsAccountId'});db[_0x3445('0x55')][_0x3445('0xf8')](db[_0x3445('0x58')],{'as':'Messages','foreignKey':_0x3445('0x167')});db[_0x3445('0x55')][_0x3445('0xf8')](db[_0x3445('0x57')],{'as':_0x3445('0x168')});db['SmsAccount'][_0x3445('0xf8')](db[_0x3445('0x169')],{'as':_0x3445('0x12b')});db[_0x3445('0x55')][_0x3445('0x105')](db[_0x3445('0x150')],{'as':_0x3445('0x151'),'foreignKey':_0x3445('0x152')});db[_0x3445('0x55')][_0x3445('0x105')](db[_0x3445('0x139')],{'as':_0x3445('0x13a'),'foreignKey':_0x3445('0x13b')});db[_0x3445('0x55')][_0x3445('0x107')](db[_0x3445('0x14')],{'as':_0x3445('0x154'),'through':_0x3445('0x125')});db[_0x3445('0x169')][_0x3445('0x105')](db['User'],{'onDelete':_0x3445('0x15e')});db[_0x3445('0x169')][_0x3445('0x105')](db['SmsQueue'],{'onDelete':_0x3445('0x15e')});db[_0x3445('0x169')][_0x3445('0x105')](db[_0x3445('0x55')],{'onDelete':_0x3445('0x15e')});db[_0x3445('0x169')]['belongsTo'](db[_0x3445('0x81')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x3445('0x169')][_0x3445('0x105')](db['Tag'],{'onDelete':_0x3445('0x15e'),'foreignKey':_0x3445('0x162')});db['SmsInteraction'][_0x3445('0xf8')](db[_0x3445('0x58')],{'as':_0x3445('0x140'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0x3445('0x57')][_0x3445('0x105')](db['SmsAccount'],{'as':_0x3445('0x156'),'foreignKey':'SmsAccountId'});db[_0x3445('0x57')]['belongsTo'](db[_0x3445('0x73')],{'as':_0x3445('0x148'),'foreignKey':'ContactId'});db[_0x3445('0x57')][_0x3445('0x105')](db[_0x3445('0x14')],{'as':_0x3445('0x164'),'foreignKey':_0x3445('0xf7')});db[_0x3445('0x57')][_0x3445('0x107')](db[_0x3445('0x87')],{'through':_0x3445('0x16a'),'as':'Tags'});db[_0x3445('0x57')][_0x3445('0x107')](db[_0x3445('0x87')],{'through':_0x3445('0x16a'),'as':'ThroughTags'});db[_0x3445('0x57')][_0x3445('0x107')](db[_0x3445('0x14')],{'as':_0x3445('0x15a'),'through':'user_has_sms_interactions','foreignKey':_0x3445('0x16b')});db[_0x3445('0x58')][_0x3445('0x105')](db[_0x3445('0x14')],{'as':_0x3445('0x14')});db[_0x3445('0x58')][_0x3445('0x105')](db[_0x3445('0x73')],{'onDelete':_0x3445('0xf6'),'as':_0x3445('0x148')});db['SmsMessage'][_0x3445('0x105')](db[_0x3445('0x57')],{'onDelete':_0x3445('0xf6'),'as':_0x3445('0x15d'),'foreignKey':_0x3445('0x16b')});db[_0x3445('0x58')][_0x3445('0x105')](db[_0x3445('0x55')],{'as':_0x3445('0x156'),'foreignKey':_0x3445('0x167')});db[_0x3445('0x117')][_0x3445('0x107')](db['User'],{'as':_0x3445('0x154'),'through':_0x3445('0x33'),'foreignKey':_0x3445('0x16c')});db[_0x3445('0x117')]['belongsToMany'](db[_0x3445('0xd4')],{'through':_0x3445('0x16d'),'as':_0x3445('0x13d')});db[_0x3445('0x5b')][_0x3445('0xf8')](db[_0x3445('0x14d')],{'as':'Dispositions','foreignKey':_0x3445('0x16e')});db['OpenchannelAccount'][_0x3445('0xf8')](db[_0x3445('0x7d')],{'as':_0x3445('0x161'),'foreignKey':'OpenchannelAccountId'});db[_0x3445('0x5b')][_0x3445('0xf8')](db[_0x3445('0x5e')],{'as':_0x3445('0x168'),'foreignKey':'OpenchannelAccountId'});db[_0x3445('0x5b')][_0x3445('0xf8')](db[_0x3445('0x60')],{'as':'Messages','foreignKey':_0x3445('0x16e')});db[_0x3445('0x5b')]['hasMany'](db[_0x3445('0x5c')],{'as':_0x3445('0x12b'),'foreignKey':_0x3445('0x16e')});db[_0x3445('0x5b')]['belongsTo'](db[_0x3445('0x150')],{'as':_0x3445('0x151'),'foreignKey':_0x3445('0x152')});db[_0x3445('0x5b')][_0x3445('0x105')](db[_0x3445('0x139')],{'as':_0x3445('0x13a'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x3445('0x5b')][_0x3445('0x107')](db[_0x3445('0x14')],{'as':_0x3445('0x154'),'through':_0x3445('0x123')});db[_0x3445('0x5c')][_0x3445('0x105')](db[_0x3445('0x14')],{'onDelete':_0x3445('0x15e')});db[_0x3445('0x5c')][_0x3445('0x105')](db['OpenchannelQueue'],{'onDelete':_0x3445('0x15e'),'foreignKey':_0x3445('0x16f')});db[_0x3445('0x5c')][_0x3445('0x105')](db[_0x3445('0x5b')],{'onDelete':_0x3445('0x15e'),'foreignKey':'OpenchannelAccountId'});db[_0x3445('0x5c')][_0x3445('0x105')](db[_0x3445('0x81')],{'onDelete':_0x3445('0x15e'),'foreignKey':_0x3445('0x138')});db['OpenchannelApplication']['belongsTo'](db[_0x3445('0x87')],{'onDelete':_0x3445('0x15e'),'foreignKey':'TagId'});db[_0x3445('0x5e')][_0x3445('0xf8')](db['OpenchannelMessage'],{'as':_0x3445('0x140'),'onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x170')});db[_0x3445('0x5e')]['belongsTo'](db[_0x3445('0x5b')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x3445('0x5e')]['belongsTo'](db['CmContact'],{'as':_0x3445('0x148'),'foreignKey':_0x3445('0x149')});db[_0x3445('0x5e')][_0x3445('0x105')](db[_0x3445('0x14')],{'as':_0x3445('0x164'),'foreignKey':_0x3445('0xf7')});db[_0x3445('0x5e')][_0x3445('0x107')](db[_0x3445('0x87')],{'through':_0x3445('0x171'),'as':_0x3445('0x158')});db[_0x3445('0x5e')][_0x3445('0x107')](db[_0x3445('0x87')],{'through':_0x3445('0x171'),'as':_0x3445('0x159')});db['OpenchannelInteraction'][_0x3445('0x107')](db[_0x3445('0x14')],{'as':_0x3445('0x15a'),'through':_0x3445('0x172'),'foreignKey':'OpenchannelInteractionId'});db[_0x3445('0x60')][_0x3445('0x105')](db[_0x3445('0x14')],{'onDelete':_0x3445('0xf6'),'as':'User'});db[_0x3445('0x60')][_0x3445('0x105')](db[_0x3445('0x73')],{'onDelete':_0x3445('0xf6'),'as':_0x3445('0x148')});db[_0x3445('0x60')][_0x3445('0x105')](db[_0x3445('0x5e')],{'onDelete':'cascade','as':_0x3445('0x15d'),'foreignKey':_0x3445('0x170')});db[_0x3445('0x60')][_0x3445('0x105')](db[_0x3445('0xda')],{'as':_0x3445('0xda'),'foreignKey':_0x3445('0x173')});db[_0x3445('0x60')][_0x3445('0x105')](db[_0x3445('0x5b')],{'as':'Account','foreignKey':_0x3445('0x16e')});db[_0x3445('0x62')][_0x3445('0x107')](db[_0x3445('0x14')],{'as':_0x3445('0x154'),'through':_0x3445('0x34'),'foreignKey':_0x3445('0x16f')});db[_0x3445('0x62')]['belongsToMany'](db['Team'],{'through':'team_has_openchannel_queues','as':'Teams'});db['ChatWebsite'][_0x3445('0xf8')](db[_0x3445('0x14d')],{'as':_0x3445('0x14e'),'foreignKey':'ChatWebsiteId'});db[_0x3445('0x11d')]['hasMany'](db['CannedAnswer'],{'as':_0x3445('0x161'),'foreignKey':_0x3445('0x174')});db['ChatWebsite'][_0x3445('0xf8')](db[_0x3445('0x6f')],{'as':_0x3445('0x175')});db[_0x3445('0x11d')]['hasMany'](db[_0x3445('0x68')],{'as':_0x3445('0x168')});db['ChatWebsite'][_0x3445('0xf8')](db[_0x3445('0x176')],{'as':'Applications'});db[_0x3445('0x11d')][_0x3445('0xf8')](db[_0x3445('0x177')],{'as':'Messages'});db[_0x3445('0x11d')][_0x3445('0x105')](db[_0x3445('0x150')],{'as':_0x3445('0x151'),'foreignKey':'ListId'});db[_0x3445('0x11d')][_0x3445('0x105')](db[_0x3445('0x81')],{'as':_0x3445('0x81'),'foreignKey':_0x3445('0x138')});db[_0x3445('0x11d')][_0x3445('0x105')](db[_0x3445('0x139')],{'as':_0x3445('0x13a'),'foreignKey':_0x3445('0x13b')});db[_0x3445('0x11d')][_0x3445('0x107')](db[_0x3445('0x14')],{'as':_0x3445('0x154'),'through':_0x3445('0x11e')});db[_0x3445('0x65')][_0x3445('0x105')](db[_0x3445('0x5b')],{});db[_0x3445('0x65')][_0x3445('0x105')](db[_0x3445('0x150')],{'as':_0x3445('0x151'),'foreignKey':_0x3445('0x152')});db[_0x3445('0x65')][_0x3445('0x105')](db[_0x3445('0x73')],{'as':_0x3445('0x148'),'foreignKey':_0x3445('0x149')});db[_0x3445('0x65')][_0x3445('0x105')](db[_0x3445('0x5e')],{});db[_0x3445('0x65')][_0x3445('0x105')](db[_0x3445('0x60')],{});db['OpenchannelQueueReport'][_0x3445('0x105')](db['User'],{});db['OpenchannelQueueReport'][_0x3445('0x105')](db[_0x3445('0x62')],{});db['ChatApplication'][_0x3445('0x105')](db[_0x3445('0x14')],{'as':'Agent','foreignKey':_0x3445('0xf7'),'onDelete':_0x3445('0x15e')});db[_0x3445('0x176')][_0x3445('0x105')](db[_0x3445('0x6c')],{'as':_0x3445('0x178'),'foreignKey':_0x3445('0x179'),'onDelete':'restrict'});db[_0x3445('0x176')][_0x3445('0x105')](db[_0x3445('0x11d')],{'as':_0x3445('0x17a'),'foreignKey':_0x3445('0x174'),'onDelete':_0x3445('0x15e')});db[_0x3445('0x176')][_0x3445('0x105')](db['Tag'],{'onDelete':'restrict','foreignKey':_0x3445('0x162')});db[_0x3445('0x68')]['hasMany'](db[_0x3445('0x177')],{'as':'Messages','onDelete':_0x3445('0xf6'),'foreignKey':'ChatInteractionId'});db[_0x3445('0x68')][_0x3445('0x105')](db[_0x3445('0x11d')],{'as':'Account','foreignKey':_0x3445('0x174')});db['ChatInteraction']['belongsTo'](db['CmContact'],{'as':_0x3445('0x148'),'foreignKey':_0x3445('0x149')});db['ChatInteraction']['belongsTo'](db[_0x3445('0x14')],{'as':_0x3445('0x164'),'foreignKey':_0x3445('0xf7')});db[_0x3445('0x68')][_0x3445('0x107')](db[_0x3445('0x87')],{'through':_0x3445('0x17b'),'as':'Tags'});db[_0x3445('0x68')][_0x3445('0x107')](db[_0x3445('0x87')],{'through':_0x3445('0x17b'),'as':_0x3445('0x159')});db[_0x3445('0x68')]['belongsToMany'](db[_0x3445('0x14')],{'as':'Users','through':_0x3445('0x17c'),'foreignKey':_0x3445('0x17d')});db[_0x3445('0x177')][_0x3445('0x105')](db[_0x3445('0x14')],{'onDelete':_0x3445('0xf6'),'as':_0x3445('0x14')});db['ChatMessage'][_0x3445('0x105')](db['CmContact'],{'onDelete':_0x3445('0xf6'),'as':_0x3445('0x148'),'foreignKey':_0x3445('0x149')});db[_0x3445('0x177')][_0x3445('0x105')](db[_0x3445('0x68')],{'onDelete':'cascade','as':_0x3445('0x15d'),'foreignKey':'ChatInteractionId'});db[_0x3445('0x177')][_0x3445('0x105')](db[_0x3445('0xda')],{'as':_0x3445('0xda'),'foreignKey':_0x3445('0x173')});db[_0x3445('0x177')]['belongsTo'](db[_0x3445('0x11d')],{'as':_0x3445('0x156'),'foreignKey':_0x3445('0x174')});db[_0x3445('0x17e')][_0x3445('0x105')](db[_0x3445('0x73')],{'onDelete':_0x3445('0xf6'),'as':_0x3445('0x148'),'foreignKey':_0x3445('0x149')});db[_0x3445('0x17e')][_0x3445('0x105')](db[_0x3445('0x11d')],{'as':_0x3445('0x156'),'foreignKey':'ChatWebsiteId'});db['ChatQueue'][_0x3445('0x107')](db['User'],{'as':_0x3445('0x154'),'through':_0x3445('0x2f'),'hooks':!![]});db[_0x3445('0x6c')][_0x3445('0x107')](db['Team'],{'through':_0x3445('0x17f'),'as':_0x3445('0x13d')});db[_0x3445('0x6d')][_0x3445('0xf8')](db[_0x3445('0xc3')],{'as':_0x3445('0x140'),'foreignKey':_0x3445('0x180'),'onDelete':_0x3445('0xf6')});db['ChatGroup']['belongsToMany'](db[_0x3445('0x14')],{'as':_0x3445('0x12d'),'through':'chat_group_has_users'});db['ChatProactiveAction'][_0x3445('0x105')](db[_0x3445('0x11d')],{'as':'Website','foreignKey':'ChatWebsiteId'});db[_0x3445('0x71')][_0x3445('0xf8')](db[_0x3445('0x73')],{'as':'Contacts','foreignKey':'CompanyId'});db[_0x3445('0x73')][_0x3445('0xf8')](db[_0x3445('0x74')],{'as':_0x3445('0x12f'),'foreignKey':_0x3445('0x149')});db[_0x3445('0x73')]['hasMany'](db['CmHopperFinal'],{'as':_0x3445('0x181'),'foreignKey':_0x3445('0x149')});db['CmContact'][_0x3445('0xf8')](db[_0x3445('0xfc')],{'as':'HopperHistories','foreignKey':_0x3445('0x149')});db[_0x3445('0x73')][_0x3445('0xf8')](db[_0x3445('0x77')],{'as':_0x3445('0x77'),'foreignKey':_0x3445('0x149')});db[_0x3445('0x73')][_0x3445('0xf8')](db[_0x3445('0x133')],{'as':'JscriptySessions','foreignKey':_0x3445('0x149')});db[_0x3445('0x73')][_0x3445('0xf8')](db[_0x3445('0x5e')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x3445('0x15e')});db[_0x3445('0x73')][_0x3445('0xf8')](db[_0x3445('0x68')],{'as':'ChatInteractions','foreignKey':_0x3445('0x149'),'onDelete':_0x3445('0x15e')});db[_0x3445('0x73')]['hasMany'](db[_0x3445('0x57')],{'as':_0x3445('0x100'),'foreignKey':'ContactId','onDelete':_0x3445('0x15e')});db[_0x3445('0x73')][_0x3445('0xf8')](db[_0x3445('0x4e')],{'as':_0x3445('0x101'),'foreignKey':_0x3445('0x149'),'onDelete':'restrict'});db[_0x3445('0x73')][_0x3445('0xf8')](db[_0x3445('0x42')],{'as':_0x3445('0x102'),'foreignKey':_0x3445('0x149'),'onDelete':_0x3445('0x15e')});db[_0x3445('0x73')][_0x3445('0x105')](db[_0x3445('0x71')],{'as':'Company','foreignKey':'CompanyId'});db['CmContact'][_0x3445('0x105')](db[_0x3445('0x150')],{'as':'List','foreignKey':_0x3445('0x152'),'onDelete':'cascade'});db['CmContact'][_0x3445('0x107')](db[_0x3445('0x14')],{'as':'Users','through':_0x3445('0x10a')});db[_0x3445('0x73')][_0x3445('0x107')](db['Tag'],{'as':_0x3445('0x158'),'through':_0x3445('0x182')});db[_0x3445('0x73')][_0x3445('0x107')](db[_0x3445('0x87')],{'through':'cm_contact_has_tags','as':_0x3445('0x159')});db[_0x3445('0x74')][_0x3445('0x105')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x3445('0xf6')});db[_0x3445('0x74')][_0x3445('0x105')](db[_0x3445('0x150')],{'as':_0x3445('0x151'),'foreignKey':_0x3445('0x152'),'onDelete':_0x3445('0xf6')});db['CmHopper'][_0x3445('0x105')](db[_0x3445('0x14')],{'as':_0x3445('0x183'),'foreignKey':_0x3445('0xf7')});db[_0x3445('0x74')][_0x3445('0x105')](db['VoiceQueue'],{'as':_0x3445('0x178'),'foreignKey':_0x3445('0x12e'),'onDelete':'cascade'});db[_0x3445('0x74')]['belongsTo'](db[_0x3445('0xd8')],{'as':'Campaign','foreignKey':_0x3445('0x184'),'onDelete':'cascade'});db[_0x3445('0x74')]['belongsTo'](db[_0x3445('0x14')],{'as':_0x3445('0x164'),'foreignKey':_0x3445('0x185')});db['CmHopperBlack'][_0x3445('0x105')](db['CmContact'],{'as':'Contact','foreignKey':_0x3445('0x149'),'onDelete':'cascade'});db[_0x3445('0x131')][_0x3445('0x105')](db[_0x3445('0x150')],{'as':_0x3445('0x151'),'foreignKey':'ListId','onDelete':_0x3445('0xf6')});db['CmHopperBlack'][_0x3445('0x105')](db[_0x3445('0x1d')],{'as':_0x3445('0x178'),'foreignKey':'VoiceQueueId','onDelete':_0x3445('0xf6')});db[_0x3445('0x131')][_0x3445('0x105')](db[_0x3445('0xd8')],{'as':_0x3445('0xd8'),'foreignKey':'CampaignId','onDelete':_0x3445('0xf6')});db['Automation'][_0x3445('0xf8')](db[_0x3445('0x80')],{'as':{'plural':'All','singular':_0x3445('0x186')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x3445('0x7c')][_0x3445('0xf8')](db['Condition'],{'as':{'plural':_0x3445('0x187'),'singular':_0x3445('0x188')},'foreignKey':_0x3445('0x189'),'onDelete':_0x3445('0xf6'),'hooks':!![]});db[_0x3445('0x7c')][_0x3445('0xf8')](db[_0x3445('0x7a')],{'as':'Actions','foreignKey':_0x3445('0x18a'),'onDelete':_0x3445('0xf6'),'hooks':!![]});db[_0x3445('0x81')][_0x3445('0xf8')](db['Interval'],{'as':_0x3445('0x18b'),'foreignKey':_0x3445('0x138'),'onDelete':_0x3445('0xf6'),'hooks':!![],'required':![]});db[_0x3445('0x81')][_0x3445('0xf8')](db[_0x3445('0x19')],{'as':_0x3445('0xfa'),'foreignKey':_0x3445('0x138'),'onDelete':'restrict'});db[_0x3445('0x81')][_0x3445('0xf8')](db[_0x3445('0x44')],{'as':_0x3445('0x18c'),'foreignKey':_0x3445('0x138')});db[_0x3445('0x81')][_0x3445('0xf8')](db['ChatApplication'],{'as':'ChatApplications','foreignKey':_0x3445('0x138')});db[_0x3445('0x81')][_0x3445('0xf8')](db[_0x3445('0x4d')],{'as':'FaxApplications','foreignKey':_0x3445('0x138')});db[_0x3445('0x81')][_0x3445('0xf8')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x3445('0x138')});db[_0x3445('0x18d')][_0x3445('0x105')](db['MailAccount'],{});db[_0x3445('0x18d')][_0x3445('0x105')](db[_0x3445('0x8f')],{'foreignKey':_0x3445('0x18e')});db[_0x3445('0x18d')][_0x3445('0x105')](db[_0x3445('0x8d')],{'foreignKey':_0x3445('0x18f')});db[_0x3445('0x85')][_0x3445('0x107')](db[_0x3445('0x1b')],{'as':_0x3445('0x190'),'through':'moh_has_sounds','onDelete':_0x3445('0x15e')});db[_0x3445('0x87')][_0x3445('0x107')](db[_0x3445('0x73')],{'through':'cm_contact_has_tags'});db[_0x3445('0x87')][_0x3445('0x107')](db[_0x3445('0x68')],{'through':_0x3445('0x17b')});db[_0x3445('0x87')][_0x3445('0x107')](db[_0x3445('0x42')],{'through':_0x3445('0x157')});db[_0x3445('0x87')][_0x3445('0x107')](db[_0x3445('0x57')],{'through':'sms_interaction_has_tags'});db[_0x3445('0x87')][_0x3445('0x107')](db[_0x3445('0x4e')],{'through':_0x3445('0x165')});db['Tag'][_0x3445('0x107')](db['OpenchannelInteraction'],{'through':_0x3445('0x171')});db[_0x3445('0x87')][_0x3445('0x107')](db['WhatsappInteraction'],{'through':_0x3445('0x191')});db['Trigger'][_0x3445('0xf8')](db[_0x3445('0x80')],{'as':{'plural':_0x3445('0x192'),'singular':_0x3445('0x193')},'foreignKey':'TriggerAllId','onDelete':'cascade','hooks':!![]});db[_0x3445('0x194')][_0x3445('0xf8')](db[_0x3445('0x80')],{'as':{'plural':'AnyConditions','singular':_0x3445('0x195')},'foreignKey':_0x3445('0x196'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0x3445('0xf8')](db[_0x3445('0x7a')],{'as':_0x3445('0x197'),'foreignKey':_0x3445('0x198'),'onDelete':'cascade','hooks':!![]});db[_0x3445('0x8d')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x3445('0x199'),'onDelete':_0x3445('0xf6'),'foreignKey':'CustomReportId','hooks':!![]});db[_0x3445('0x8f')][_0x3445('0xf8')](db[_0x3445('0x92')],{'as':_0x3445('0x199'),'onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x18e')});db[_0x3445('0x19a')][_0x3445('0xf8')](db['AnalyticFieldReport'],{'as':_0x3445('0x199'),'onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x19b')});db[_0x3445('0x92')][_0x3445('0x105')](db[_0x3445('0x19a')],{'foreignKey':'MetricId'});db[_0x3445('0x19c')][_0x3445('0xf8')](db['SalesforceConfiguration'],{'as':_0x3445('0x19d'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x3445('0x95')][_0x3445('0xf8')](db[_0x3445('0x96')],{'as':'Subjects','onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x19e')});db[_0x3445('0x95')][_0x3445('0xf8')](db[_0x3445('0x96')],{'as':_0x3445('0x19f'),'onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x1a0')});db[_0x3445('0x95')][_0x3445('0xf8')](db['SalesforceField'],{'as':_0x3445('0x199'),'onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x1a1')});db['SalesforceConfiguration']['belongsTo'](db[_0x3445('0x19c')],{'as':_0x3445('0x156'),'foreignKey':_0x3445('0x1a2')});db[_0x3445('0x96')][_0x3445('0xf8')](db['SalesforceField'],{'as':'Subject','foreignKey':_0x3445('0x19e')});db[_0x3445('0x96')][_0x3445('0xf8')](db[_0x3445('0x96')],{'as':_0x3445('0x1a3'),'foreignKey':_0x3445('0x1a0')});db[_0x3445('0x96')][_0x3445('0xf8')](db[_0x3445('0x96')],{'as':_0x3445('0x1a4'),'foreignKey':_0x3445('0x1a1')});db[_0x3445('0x96')]['belongsTo'](db['Variable'],{'as':_0x3445('0x1a5'),'foreignKey':_0x3445('0x1a6')});db['SugarcrmAccount'][_0x3445('0xf8')](db[_0x3445('0x1a7')],{'as':_0x3445('0x19d'),'onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x1a2')});db['SugarcrmConfiguration']['hasMany'](db[_0x3445('0x1a8')],{'as':_0x3445('0x1a9'),'onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x19e')});db['SugarcrmConfiguration'][_0x3445('0xf8')](db[_0x3445('0x1a8')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x3445('0x1a0')});db[_0x3445('0x1a7')]['hasMany'](db[_0x3445('0x1a8')],{'as':_0x3445('0x199'),'onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x1a1')});db[_0x3445('0x1a7')]['belongsTo'](db[_0x3445('0x98')],{'as':_0x3445('0x156'),'foreignKey':'AccountId'});db['SugarcrmField'][_0x3445('0xf8')](db[_0x3445('0x1a8')],{'as':_0x3445('0x1aa'),'foreignKey':_0x3445('0x19e')});db[_0x3445('0x1a8')][_0x3445('0xf8')](db['SugarcrmField'],{'as':_0x3445('0x1a3'),'foreignKey':_0x3445('0x1a0')});db[_0x3445('0x1a8')][_0x3445('0xf8')](db[_0x3445('0x1a8')],{'as':_0x3445('0x1a4'),'foreignKey':_0x3445('0x1a1')});db['SugarcrmField']['belongsTo'](db['Variable'],{'as':_0x3445('0x1a5'),'foreignKey':_0x3445('0x1a6')});db[_0x3445('0x1ab')]['hasMany'](db[_0x3445('0x1ac')],{'as':_0x3445('0x19d'),'onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x1a2')});db[_0x3445('0x1ac')][_0x3445('0xf8')](db['DeskField'],{'as':_0x3445('0x1a9'),'onDelete':_0x3445('0xf6'),'foreignKey':'SubjectId'});db[_0x3445('0x1ac')][_0x3445('0xf8')](db['DeskField'],{'as':_0x3445('0x19f'),'onDelete':_0x3445('0xf6'),'foreignKey':'DescriptionId'});db['DeskConfiguration'][_0x3445('0xf8')](db[_0x3445('0x1ad')],{'as':_0x3445('0x199'),'onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x1a1')});db[_0x3445('0x1ac')][_0x3445('0x105')](db[_0x3445('0x1ab')],{'as':_0x3445('0x156'),'foreignKey':_0x3445('0x1a2')});db[_0x3445('0x1ac')]['belongsToMany'](db['Tag'],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x3445('0xf8')](db[_0x3445('0x1ad')],{'as':_0x3445('0x1aa'),'foreignKey':_0x3445('0x19e')});db['DeskField']['hasMany'](db[_0x3445('0x1ad')],{'as':_0x3445('0x1a3'),'foreignKey':_0x3445('0x1a0')});db[_0x3445('0x1ad')][_0x3445('0xf8')](db['DeskField'],{'as':'Field','foreignKey':_0x3445('0x1a1')});db[_0x3445('0x1ad')][_0x3445('0x105')](db[_0x3445('0x1a5')],{'as':'Variable','foreignKey':'VariableId'});db[_0x3445('0x9d')]['hasMany'](db[_0x3445('0x9f')],{'as':_0x3445('0x19d'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x3445('0x9f')][_0x3445('0xf8')](db[_0x3445('0xa1')],{'as':_0x3445('0x1a9'),'onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x19e')});db[_0x3445('0x9f')]['hasMany'](db['ZohoField'],{'as':_0x3445('0x19f'),'onDelete':'cascade','foreignKey':_0x3445('0x1a0')});db[_0x3445('0x9f')][_0x3445('0xf8')](db[_0x3445('0xa1')],{'as':_0x3445('0x199'),'onDelete':'cascade','foreignKey':_0x3445('0x1a1')});db[_0x3445('0x9f')]['belongsTo'](db[_0x3445('0x9d')],{'as':'Account','foreignKey':_0x3445('0x1a2')});db[_0x3445('0xa1')][_0x3445('0xf8')](db[_0x3445('0xa1')],{'as':_0x3445('0x1aa'),'foreignKey':_0x3445('0x19e')});db[_0x3445('0xa1')][_0x3445('0xf8')](db[_0x3445('0xa1')],{'as':_0x3445('0x1a3'),'foreignKey':_0x3445('0x1a0')});db[_0x3445('0xa1')][_0x3445('0xf8')](db['ZohoField'],{'as':_0x3445('0x1a4'),'foreignKey':_0x3445('0x1a1')});db[_0x3445('0xa1')]['belongsTo'](db[_0x3445('0x1a5')],{'as':_0x3445('0x1a5'),'foreignKey':_0x3445('0x1a6')});db[_0x3445('0xa3')]['hasMany'](db[_0x3445('0xa4')],{'as':'Configurations','onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x1a2')});db[_0x3445('0xa4')]['hasMany'](db[_0x3445('0xa6')],{'as':'Subjects','foreignKey':_0x3445('0x19e')});db[_0x3445('0xa4')][_0x3445('0xf8')](db['ZendeskField'],{'as':_0x3445('0x19f'),'foreignKey':_0x3445('0x1a0')});db[_0x3445('0xa4')][_0x3445('0xf8')](db[_0x3445('0xa6')],{'as':_0x3445('0x199'),'foreignKey':'FieldId'});db[_0x3445('0xa4')][_0x3445('0x105')](db[_0x3445('0xa3')],{'as':_0x3445('0x156'),'foreignKey':_0x3445('0x1a2')});db[_0x3445('0xa4')]['belongsToMany'](db[_0x3445('0x87')],{'through':_0x3445('0x1ae')});db[_0x3445('0xa6')]['hasMany'](db[_0x3445('0xa6')],{'as':_0x3445('0x1aa'),'foreignKey':_0x3445('0x19e')});db['ZendeskField']['hasMany'](db[_0x3445('0xa6')],{'as':_0x3445('0x1a3'),'foreignKey':_0x3445('0x1a0')});db[_0x3445('0xa6')][_0x3445('0xf8')](db[_0x3445('0xa6')],{'as':_0x3445('0x1a4'),'foreignKey':_0x3445('0x1a1')});db[_0x3445('0xa6')][_0x3445('0x105')](db[_0x3445('0x1a5')],{'as':_0x3445('0x1a5'),'foreignKey':_0x3445('0x1a6')});db[_0x3445('0xa7')][_0x3445('0xf8')](db[_0x3445('0xa9')],{'as':_0x3445('0x19d'),'onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x1a2')});db['FreshdeskConfiguration']['hasMany'](db[_0x3445('0xab')],{'as':_0x3445('0x1a9'),'onDelete':_0x3445('0xf6'),'foreignKey':'SubjectId'});db[_0x3445('0xa9')][_0x3445('0xf8')](db[_0x3445('0xab')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x3445('0xa9')][_0x3445('0xf8')](db[_0x3445('0xab')],{'as':'Fields','onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x1a1')});db[_0x3445('0xa9')][_0x3445('0x105')](db[_0x3445('0xa7')],{'as':_0x3445('0x156'),'foreignKey':'AccountId'});db[_0x3445('0xa9')][_0x3445('0x107')](db[_0x3445('0x87')],{'through':_0x3445('0x1af')});db['FreshdeskField'][_0x3445('0xf8')](db[_0x3445('0xab')],{'as':_0x3445('0x1aa'),'foreignKey':'SubjectId'});db['FreshdeskField'][_0x3445('0xf8')](db[_0x3445('0xab')],{'as':_0x3445('0x1a3'),'foreignKey':_0x3445('0x1a0')});db['FreshdeskField']['hasMany'](db[_0x3445('0xab')],{'as':_0x3445('0x1a4'),'foreignKey':'FieldId'});db[_0x3445('0xab')][_0x3445('0x105')](db[_0x3445('0x1a5')],{'as':_0x3445('0x1a5'),'foreignKey':_0x3445('0x1a6')});db[_0x3445('0xad')][_0x3445('0xf8')](db[_0x3445('0x1b0')],{'as':_0x3445('0x19d'),'onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x1a2')});db[_0x3445('0x1b0')][_0x3445('0xf8')](db[_0x3445('0xb0')],{'as':'Subjects','foreignKey':_0x3445('0x19e')});db[_0x3445('0x1b0')][_0x3445('0xf8')](db[_0x3445('0xb0')],{'as':_0x3445('0x19f'),'foreignKey':_0x3445('0x1a0')});db[_0x3445('0x1b0')][_0x3445('0xf8')](db['VtigerField'],{'as':_0x3445('0x199'),'foreignKey':'FieldId'});db[_0x3445('0x1b0')][_0x3445('0x105')](db[_0x3445('0xad')],{'as':'Account','foreignKey':_0x3445('0x1a2')});db[_0x3445('0xb0')][_0x3445('0xf8')](db[_0x3445('0xb0')],{'as':_0x3445('0x1aa'),'foreignKey':_0x3445('0x19e')});db['VtigerField'][_0x3445('0xf8')](db['VtigerField'],{'as':_0x3445('0x1a3'),'foreignKey':_0x3445('0x1a0')});db['VtigerField'][_0x3445('0xf8')](db['VtigerField'],{'as':_0x3445('0x1a4'),'foreignKey':'FieldId'});db['VtigerField'][_0x3445('0x105')](db[_0x3445('0x1a5')],{'as':_0x3445('0x1a5'),'foreignKey':'VariableId'});db[_0x3445('0xb2')][_0x3445('0xf8')](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x1a2')});db[_0x3445('0xb4')]['hasMany'](db[_0x3445('0xb6')],{'as':'Subjects','foreignKey':_0x3445('0x19e')});db[_0x3445('0xb4')][_0x3445('0xf8')](db[_0x3445('0xb6')],{'as':_0x3445('0x19f'),'foreignKey':_0x3445('0x1a0')});db['ServicenowConfiguration'][_0x3445('0xf8')](db[_0x3445('0xb6')],{'as':_0x3445('0x199'),'foreignKey':_0x3445('0x1a1')});db[_0x3445('0xb4')]['belongsTo'](db[_0x3445('0xb2')],{'as':_0x3445('0x156'),'foreignKey':_0x3445('0x1a2')});db[_0x3445('0xb6')][_0x3445('0xf8')](db[_0x3445('0xb6')],{'as':'Subject','foreignKey':_0x3445('0x19e')});db[_0x3445('0xb6')][_0x3445('0xf8')](db[_0x3445('0xb6')],{'as':'Description','foreignKey':_0x3445('0x1a0')});db[_0x3445('0xb6')]['hasMany'](db['ServicenowField'],{'as':_0x3445('0x1a4'),'foreignKey':'FieldId'});db[_0x3445('0xb6')]['belongsTo'](db['Variable'],{'as':_0x3445('0x1a5'),'foreignKey':_0x3445('0x1a6')});db[_0x3445('0x1b1')]['hasMany'](db[_0x3445('0x1b2')],{'as':_0x3445('0x19d'),'onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x1a2')});db['Dynamics365Configuration'][_0x3445('0xf8')](db[_0x3445('0xb8')],{'as':_0x3445('0x1a9'),'onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x19e')});db[_0x3445('0x1b2')]['hasMany'](db['Dynamics365Field'],{'as':_0x3445('0x19f'),'onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x1a0')});db[_0x3445('0x1b2')]['hasMany'](db[_0x3445('0xb8')],{'as':'Fields','onDelete':_0x3445('0xf6'),'foreignKey':'FieldId'});db['Dynamics365Configuration']['belongsTo'](db[_0x3445('0x1b1')],{'as':_0x3445('0x156'),'foreignKey':_0x3445('0x1a2')});db[_0x3445('0xb8')][_0x3445('0xf8')](db['Dynamics365Field'],{'as':_0x3445('0x1aa'),'foreignKey':_0x3445('0x19e')});db[_0x3445('0xb8')][_0x3445('0xf8')](db['Dynamics365Field'],{'as':_0x3445('0x1a3'),'foreignKey':_0x3445('0x1a0')});db['Dynamics365Field']['hasMany'](db[_0x3445('0xb8')],{'as':_0x3445('0x1a4'),'foreignKey':'FieldId'});db['Dynamics365Field']['belongsTo'](db[_0x3445('0x1a5')],{'as':'Variable','foreignKey':_0x3445('0x1a6')});db[_0x3445('0xba')]['hasMany'](db['FreshsalesConfiguration'],{'as':_0x3445('0x19d'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x3445('0xbc')][_0x3445('0xf8')](db[_0x3445('0x1b3')],{'as':_0x3445('0x1a9'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration'][_0x3445('0xf8')](db[_0x3445('0x1b3')],{'as':_0x3445('0x19f'),'foreignKey':'DescriptionId'});db[_0x3445('0xbc')][_0x3445('0xf8')](db[_0x3445('0x1b3')],{'as':_0x3445('0x199'),'foreignKey':'FieldId'});db[_0x3445('0xbc')][_0x3445('0x105')](db[_0x3445('0xba')],{'as':'Account','foreignKey':_0x3445('0x1a2')});db[_0x3445('0x1b3')][_0x3445('0xf8')](db[_0x3445('0x1b3')],{'as':_0x3445('0x1aa'),'foreignKey':_0x3445('0x19e')});db['FreshsalesField']['hasMany'](db[_0x3445('0x1b3')],{'as':_0x3445('0x1a3'),'foreignKey':_0x3445('0x1a0')});db[_0x3445('0x1b3')][_0x3445('0xf8')](db[_0x3445('0x1b3')],{'as':'Field','foreignKey':'FieldId'});db[_0x3445('0x1b3')]['belongsTo'](db[_0x3445('0x1a5')],{'as':'Variable','foreignKey':_0x3445('0x1a6')});db[_0x3445('0xc1')][_0x3445('0x105')](db[_0x3445('0x11d')],{});db['ChatQueueReport'][_0x3445('0x105')](db[_0x3445('0x150')],{'as':'List','foreignKey':'ListId'});db[_0x3445('0xc1')][_0x3445('0x105')](db[_0x3445('0x73')],{'as':_0x3445('0x148'),'foreignKey':_0x3445('0x149')});db[_0x3445('0xc1')][_0x3445('0x105')](db[_0x3445('0x68')],{});db[_0x3445('0xc1')][_0x3445('0x105')](db[_0x3445('0x177')],{});db[_0x3445('0xc1')][_0x3445('0x105')](db[_0x3445('0x14')],{});db[_0x3445('0xc1')][_0x3445('0x105')](db[_0x3445('0x6c')],{});db['ChatInternalMessage']['belongsTo'](db[_0x3445('0x14')],{'onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x1b4')});db[_0x3445('0xc3')]['belongsTo'](db['User'],{'onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x1b5')});db[_0x3445('0x133')]['hasMany'](db[_0x3445('0xc6')],{'foreignKey':_0x3445('0x1b6'),'onDelete':_0x3445('0xf6')});db[_0x3445('0x133')]['hasMany'](db[_0x3445('0x1b7')],{'foreignKey':_0x3445('0x1b6'),'onDelete':'cascade'});db[_0x3445('0x1b8')][_0x3445('0x105')](db['SmsAccount'],{});db['SmsQueueReport']['belongsTo'](db[_0x3445('0x150')],{'as':_0x3445('0x151'),'foreignKey':_0x3445('0x152')});db[_0x3445('0x1b8')]['belongsTo'](db[_0x3445('0x73')],{'as':_0x3445('0x148'),'foreignKey':'ContactId'});db[_0x3445('0x1b8')][_0x3445('0x105')](db[_0x3445('0x57')],{});db[_0x3445('0x1b8')]['belongsTo'](db[_0x3445('0x58')],{});db[_0x3445('0x1b8')][_0x3445('0x105')](db[_0x3445('0x14')],{});db['SmsQueueReport'][_0x3445('0x105')](db[_0x3445('0x117')],{});db['JscriptyProject'][_0x3445('0xf8')](db[_0x3445('0x133')],{'foreignKey':_0x3445('0x1b9')});db[_0x3445('0xcc')][_0x3445('0xf8')](db[_0x3445('0xc6')],{'foreignKey':'ProjectId'});db[_0x3445('0xcc')][_0x3445('0xf8')](db[_0x3445('0x1b7')],{'foreignKey':_0x3445('0x1b9')});db[_0x3445('0x127')][_0x3445('0x107')](db[_0x3445('0x14')],{'as':_0x3445('0x15a'),'through':_0x3445('0x129')});db[_0x3445('0xd4')][_0x3445('0x107')](db[_0x3445('0x14')],{'as':'Agents','through':_0x3445('0x10d')});db[_0x3445('0xd4')][_0x3445('0x107')](db[_0x3445('0x1d')],{'through':_0x3445('0x13e'),'as':'VoiceQueues'});db[_0x3445('0xd4')][_0x3445('0x107')](db[_0x3445('0x3e')],{'through':'team_has_mail_queues','as':_0x3445('0x114')});db['Team'][_0x3445('0x107')](db[_0x3445('0x6c')],{'through':_0x3445('0x17f'),'as':_0x3445('0x115')});db[_0x3445('0xd4')]['belongsToMany'](db[_0x3445('0x52')],{'through':_0x3445('0x166'),'as':'FaxQueues'});db[_0x3445('0xd4')]['belongsToMany'](db[_0x3445('0x117')],{'through':'team_has_sms_queues','as':'SmsQueues'});db['Team']['belongsToMany'](db['OpenchannelQueue'],{'through':_0x3445('0x1ba'),'as':_0x3445('0x119')});db['Team'][_0x3445('0x107')](db['WhatsappQueue'],{'through':_0x3445('0x1bb'),'as':_0x3445('0x1bc')});db[_0x3445('0xd8')][_0x3445('0xf8')](db[_0x3445('0x74')],{'as':_0x3445('0x12f'),'foreignKey':_0x3445('0x184')});db[_0x3445('0xd8')][_0x3445('0xf8')](db[_0x3445('0xfb')],{'as':_0x3445('0x181'),'foreignKey':_0x3445('0x184')});db[_0x3445('0xd8')]['hasMany'](db[_0x3445('0xfc')],{'as':_0x3445('0x130'),'foreignKey':_0x3445('0x184')});db[_0x3445('0xd8')][_0x3445('0xf8')](db[_0x3445('0x131')],{'as':_0x3445('0x132'),'foreignKey':'CampaignId'});db[_0x3445('0xd8')][_0x3445('0x105')](db[_0x3445('0x135')],{'as':_0x3445('0x135'),'foreignKey':_0x3445('0x136')});db['Campaign'][_0x3445('0x105')](db[_0x3445('0x135')],{'as':_0x3445('0x137'),'foreignKey':'TrunkBackupId'});db[_0x3445('0xd8')][_0x3445('0x105')](db[_0x3445('0x81')],{'as':_0x3445('0x81'),'foreignKey':'IntervalId'});db['Campaign'][_0x3445('0x105')](db['SquareProject'],{'as':_0x3445('0x127'),'foreignKey':_0x3445('0x1bd')});db['Campaign'][_0x3445('0x107')](db[_0x3445('0x150')],{'as':_0x3445('0x10b'),'through':_0x3445('0x1be')});db['Campaign'][_0x3445('0x107')](db[_0x3445('0x150')],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db[_0x3445('0x1bf')][_0x3445('0x105')](db[_0x3445('0x14f')],{});db[_0x3445('0x1bf')][_0x3445('0x105')](db[_0x3445('0x42')],{});db[_0x3445('0x1bf')]['belongsTo'](db[_0x3445('0x3c')],{'foreignKey':_0x3445('0x1c0'),'as':_0x3445('0x1c1')});db[_0x3445('0x1bf')][_0x3445('0x105')](db['User'],{'foreignKey':'FromUserId','as':_0x3445('0x1c2')});db[_0x3445('0x1bf')][_0x3445('0x105')](db[_0x3445('0x14')],{'foreignKey':'ToUserId','as':_0x3445('0x1c3')});db[_0x3445('0x1bf')][_0x3445('0x105')](db['MailQueue'],{'foreignKey':_0x3445('0x1c4'),'as':'ToQueue'});db[_0x3445('0x1bf')]['belongsTo'](db[_0x3445('0x3c')],{'foreignKey':'ToMailAccountId','as':_0x3445('0x1c5')});db[_0x3445('0x1c6')]['belongsTo'](db[_0x3445('0x177')],{});db[_0x3445('0x1c6')][_0x3445('0x105')](db[_0x3445('0x68')],{});db[_0x3445('0x1c6')][_0x3445('0x105')](db[_0x3445('0x11d')],{'foreignKey':'FromChatWebsiteId','as':_0x3445('0x1c1')});db['ChatTransferReport'][_0x3445('0x105')](db[_0x3445('0x14')],{'foreignKey':_0x3445('0x1c7'),'as':'FromAgent'});db[_0x3445('0x1c6')][_0x3445('0x105')](db[_0x3445('0x14')],{'foreignKey':_0x3445('0x1c8'),'as':_0x3445('0x1c3')});db[_0x3445('0x1c6')][_0x3445('0x105')](db[_0x3445('0x6c')],{'foreignKey':_0x3445('0x1c9'),'as':'ToQueue'});db[_0x3445('0x1c6')][_0x3445('0x105')](db[_0x3445('0x11d')],{'foreignKey':_0x3445('0x1ca'),'as':_0x3445('0x1c5')});db['FaxTransferReport'][_0x3445('0x105')](db['FaxMessage'],{});db[_0x3445('0xdf')][_0x3445('0x105')](db[_0x3445('0x4e')],{});db['FaxTransferReport'][_0x3445('0x105')](db[_0x3445('0x4c')],{'foreignKey':_0x3445('0x1cb'),'as':'FromAccount'});db[_0x3445('0xdf')][_0x3445('0x105')](db[_0x3445('0x14')],{'foreignKey':_0x3445('0x1c7'),'as':_0x3445('0x1c2')});db['FaxTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x3445('0x1c8'),'as':_0x3445('0x1c3')});db[_0x3445('0xdf')][_0x3445('0x105')](db[_0x3445('0x52')],{'foreignKey':_0x3445('0x1cc'),'as':_0x3445('0x1cd')});db[_0x3445('0xdf')][_0x3445('0x105')](db['FaxAccount'],{'foreignKey':_0x3445('0x1ce'),'as':'ToAccount'});db[_0x3445('0xe1')]['belongsTo'](db[_0x3445('0x60')],{});db[_0x3445('0xe1')][_0x3445('0x105')](db[_0x3445('0x5e')],{});db[_0x3445('0xe1')][_0x3445('0x105')](db['OpenchannelAccount'],{'foreignKey':_0x3445('0x1cf'),'as':'FromAccount'});db['OpenchannelTransferReport']['belongsTo'](db[_0x3445('0x14')],{'foreignKey':'FromUserId','as':'FromAgent'});db['OpenchannelTransferReport'][_0x3445('0x105')](db[_0x3445('0x14')],{'foreignKey':_0x3445('0x1c8'),'as':_0x3445('0x1c3')});db[_0x3445('0xe1')][_0x3445('0x105')](db[_0x3445('0x62')],{'foreignKey':'ToOpenchannelQueueId','as':_0x3445('0x1cd')});db[_0x3445('0xe1')][_0x3445('0x105')](db[_0x3445('0x5b')],{'foreignKey':_0x3445('0x1d0'),'as':_0x3445('0x1c5')});db[_0x3445('0x1d1')][_0x3445('0x105')](db['SmsMessage'],{});db[_0x3445('0x1d1')][_0x3445('0x105')](db['SmsInteraction'],{});db['SmsTransferReport'][_0x3445('0x105')](db['SmsAccount'],{'foreignKey':_0x3445('0x1d2'),'as':_0x3445('0x1c1')});db[_0x3445('0x1d1')]['belongsTo'](db[_0x3445('0x14')],{'foreignKey':_0x3445('0x1c7'),'as':_0x3445('0x1c2')});db[_0x3445('0x1d1')][_0x3445('0x105')](db[_0x3445('0x14')],{'foreignKey':'ToUserId','as':_0x3445('0x1c3')});db['SmsTransferReport'][_0x3445('0x105')](db[_0x3445('0x117')],{'foreignKey':_0x3445('0x1d3'),'as':_0x3445('0x1cd')});db['SmsTransferReport'][_0x3445('0x105')](db['SmsAccount'],{'foreignKey':_0x3445('0x1d4'),'as':_0x3445('0x1c5')});db[_0x3445('0x150')][_0x3445('0xf8')](db[_0x3445('0x14d')],{'as':_0x3445('0x14e'),'foreignKey':_0x3445('0x152')});db[_0x3445('0x150')][_0x3445('0xf8')](db[_0x3445('0x78')],{'as':_0x3445('0x1d5'),'foreignKey':_0x3445('0x152')});db[_0x3445('0x150')][_0x3445('0xf8')](db[_0x3445('0x73')],{'as':_0x3445('0x109'),'onDelete':_0x3445('0xf6'),'foreignKey':_0x3445('0x152')});db[_0x3445('0x150')][_0x3445('0xf8')](db[_0x3445('0xfb')],{'as':'HopperFinals','foreignKey':_0x3445('0x152')});db[_0x3445('0x150')]['hasMany'](db['CmHopperHistory'],{'as':_0x3445('0xfd'),'foreignKey':'ListId'});db[_0x3445('0x150')][_0x3445('0xf8')](db[_0x3445('0x77')],{'as':_0x3445('0x77'),'foreignKey':_0x3445('0x152')});db[_0x3445('0x150')]['belongsToMany'](db[_0x3445('0x1d')],{'as':'Queues','through':_0x3445('0x13c')});db['CmList'][_0x3445('0x107')](db[_0x3445('0x14')],{'as':'Agents','through':_0x3445('0x10c')});db[_0x3445('0xe4')][_0x3445('0xf8')](db[_0x3445('0x19')],{'as':_0x3445('0xfa'),'onDelete':_0x3445('0xf6')});db[_0x3445('0xe4')][_0x3445('0x107')](db['User'],{'as':'Agents','through':_0x3445('0x11c')});db[_0x3445('0xe6')][_0x3445('0xf8')](db['User'],{'as':_0x3445('0x15a'),'foreignKey':_0x3445('0x106')});db[_0x3445('0xe6')][_0x3445('0xf8')](db[_0x3445('0x1d6')],{'as':_0x3445('0x1d7'),'foreignKey':'userProfileId','onDelete':_0x3445('0xf6')});db['UserProfileSection'][_0x3445('0xf8')](db[_0x3445('0xe8')],{'as':'Resources','foreignKey':_0x3445('0x1d8'),'onDelete':_0x3445('0xf6')});db['WhatsappAccount'][_0x3445('0xf8')](db['Disposition'],{'as':_0x3445('0x14e'),'foreignKey':'WhatsappAccountId'});db[_0x3445('0xeb')]['hasMany'](db[_0x3445('0x7d')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db[_0x3445('0xeb')]['hasMany'](db[_0x3445('0x1d9')],{'as':'Messages','foreignKey':'WhatsappAccountId'});db[_0x3445('0xeb')][_0x3445('0xf8')](db[_0x3445('0xef')],{'as':_0x3445('0x168')});db[_0x3445('0xeb')][_0x3445('0xf8')](db['WhatsappApplication'],{'as':_0x3445('0x12b')});db['WhatsappAccount']['belongsTo'](db[_0x3445('0x150')],{'as':_0x3445('0x151'),'foreignKey':_0x3445('0x152')});db[_0x3445('0xeb')][_0x3445('0x105')](db[_0x3445('0x139')],{'as':_0x3445('0x13a'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x3445('0xeb')][_0x3445('0x107')](db[_0x3445('0x14')],{'as':'Agents','through':_0x3445('0x1da')});db[_0x3445('0xed')][_0x3445('0x105')](db[_0x3445('0x14')],{'onDelete':_0x3445('0x15e')});db[_0x3445('0xed')][_0x3445('0x105')](db[_0x3445('0x11a')],{'onDelete':_0x3445('0x15e')});db['WhatsappApplication'][_0x3445('0x105')](db[_0x3445('0xeb')],{'onDelete':_0x3445('0x15e')});db['WhatsappApplication'][_0x3445('0x105')](db[_0x3445('0x81')],{'onDelete':_0x3445('0x15e'),'foreignKey':_0x3445('0x138')});db['WhatsappApplication'][_0x3445('0x105')](db[_0x3445('0x87')],{'onDelete':'restrict','foreignKey':_0x3445('0x162')});db[_0x3445('0xef')][_0x3445('0xf8')](db[_0x3445('0x1d9')],{'as':_0x3445('0x140'),'onDelete':_0x3445('0xf6'),'foreignKey':'WhatsappInteractionId'});db[_0x3445('0xef')][_0x3445('0x105')](db[_0x3445('0xeb')],{'as':_0x3445('0x156'),'foreignKey':'WhatsappAccountId'});db[_0x3445('0xef')][_0x3445('0x105')](db['CmContact'],{'as':'Contact','foreignKey':_0x3445('0x149')});db[_0x3445('0xef')]['belongsTo'](db[_0x3445('0x14')],{'as':_0x3445('0x164'),'foreignKey':_0x3445('0xf7')});db[_0x3445('0xef')][_0x3445('0x107')](db[_0x3445('0x87')],{'through':_0x3445('0x191'),'as':_0x3445('0x158')});db[_0x3445('0xef')]['belongsToMany'](db[_0x3445('0x87')],{'through':'whatsapp_interaction_has_tags','as':_0x3445('0x159')});db['WhatsappInteraction'][_0x3445('0x107')](db[_0x3445('0x14')],{'as':_0x3445('0x15a'),'through':_0x3445('0x111'),'foreignKey':_0x3445('0x1db')});db[_0x3445('0x1d9')][_0x3445('0x105')](db['User'],{'as':_0x3445('0x14')});db['WhatsappMessage'][_0x3445('0x105')](db[_0x3445('0x73')],{'onDelete':_0x3445('0xf6'),'as':_0x3445('0x148')});db[_0x3445('0x1d9')][_0x3445('0x105')](db[_0x3445('0xef')],{'onDelete':_0x3445('0xf6'),'as':_0x3445('0x15d'),'foreignKey':'WhatsappInteractionId'});db[_0x3445('0x1d9')][_0x3445('0x105')](db['WhatsappAccount'],{'as':_0x3445('0x156'),'foreignKey':_0x3445('0x1dc')});db[_0x3445('0x1dd')][_0x3445('0x105')](db[_0x3445('0xeb')],{});db[_0x3445('0x1dd')][_0x3445('0x105')](db[_0x3445('0x150')],{'as':_0x3445('0x151'),'foreignKey':_0x3445('0x152')});db[_0x3445('0x1dd')]['belongsTo'](db[_0x3445('0x73')],{'as':'Contact','foreignKey':'ContactId'});db[_0x3445('0x1dd')][_0x3445('0x105')](db[_0x3445('0xef')],{});db['WhatsappQueueReport'][_0x3445('0x105')](db[_0x3445('0x11a')],{});db[_0x3445('0x1dd')][_0x3445('0x105')](db[_0x3445('0x1d9')],{});db[_0x3445('0x1dd')][_0x3445('0x105')](db['User'],{});db['WhatsappTransferReport'][_0x3445('0x105')](db[_0x3445('0x1d9')],{});db[_0x3445('0x1de')]['belongsTo'](db[_0x3445('0xef')],{});db['WhatsappTransferReport'][_0x3445('0x105')](db[_0x3445('0xeb')],{'foreignKey':_0x3445('0x1df'),'as':_0x3445('0x1c1')});db['WhatsappTransferReport'][_0x3445('0x105')](db[_0x3445('0xeb')],{'foreignKey':_0x3445('0x1e0'),'as':_0x3445('0x1c5')});db[_0x3445('0x1de')]['belongsTo'](db[_0x3445('0x11a')],{'foreignKey':_0x3445('0x1e1'),'as':_0x3445('0x1cd')});db[_0x3445('0x1de')][_0x3445('0x105')](db[_0x3445('0x14')],{'foreignKey':'FromUserId','as':_0x3445('0x1c2')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x3445('0x1c8'),'as':'ToAgent'});db[_0x3445('0x11a')][_0x3445('0x107')](db[_0x3445('0x14')],{'as':_0x3445('0x154'),'through':_0x3445('0x36'),'foreignKey':_0x3445('0x1e2')});db[_0x3445('0x11a')][_0x3445('0x107')](db[_0x3445('0xd4')],{'through':_0x3445('0x1bb'),'as':'Teams'});module[_0x3445('0x1e3')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x44e8=['FaxInteractions','Notifications','SenderId','belongsToMany','Groups','Contacts','cm_user_has_contacts','cm_user_has_lists','MailInteractions','ChatInteractions','SmsInteractions','user_has_sms_interactions','WhatsappInteractions','VoiceQueue','VoiceQueues','ChatQueues','FaxQueues','UserFaxQueue','SmsQueue','SmsQueues','UserOpenchannelQueue','WhatsappQueue','WhatsappQueues','CmList','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','CmHopperFinal','HopperHistories','CmHopperBlack','belongsTo','TrunkId','TrunkBackup','TrunkBackupId','Interval','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','team_has_voice_queues','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','Contact','ContactId','MailServerOut','Smtp','Disposition','Dispositions','MailAccountId','Applications','List','ListId','Template','TemplateId','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','Users','user_has_mail_interactions','Interaction','restrict','IntervalId','Items','FaxAccountId','Interactions','Exntensions','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','AttachmentId','team_has_fax_queues','SmsAccountId','user_has_sms_accounts','TagId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','ThroughTags','user_has_openchannel_interactions','team_has_openchannel_queues','Answers','ChatWebsiteId','ChatProactiveAction','ProactiveActions','Website','ChatInteractionId','team_has_chat_queues','ChatGroupId','chat_group_has_users','CmCompany','JscriptySessions','Company','cm_contact_has_tags','Queue','CampaignId','OwnerId','All','AutomationAllId','Actions','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','chat_interaction_has_tags','AnyConditions','AnyCondition','TriggerAnyId','Fields','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','Subject','Description','Field','FieldId','VariableId','DeskAccount','DeskConfiguration','int_desk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerConfiguration','VtigerField','ServicenowField','FreshsalesConfiguration','ChatQueueReport','FromId','ToId','JscriptyQuestionReport','SessionId','ProjectId','MailQueues','HopperBlacks','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromUserId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','userProfileId','UserProfileSections','Resources','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','user_has_whatsapp_interactions','WhatsappTransferReport','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','exports','path','lodash','jstz','determine','sequelize','motion2','xcall','xC@LL1234','mysql','utf8mb4','name','utf8','sequelizeHistory','defaultsDeep','utf8_general_ci','database','username','options','password','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceAgentReport','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Condition','../api/condition/condition.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/sound/sound.model','Tag','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/cmList/cmList.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','Notification','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','hasOne','cascade','UserId','Recordings','hasMany','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteraction'];(function(_0x56c2bd,_0x307141){var _0x1edc9c=function(_0x12d5e2){while(--_0x12d5e2){_0x56c2bd['push'](_0x56c2bd['shift']());}};_0x1edc9c(++_0x307141);}(_0x44e8,0xd7));var _0x844e=function(_0x4b2611,_0x381474){_0x4b2611=_0x4b2611-0x0;var _0x1ea173=_0x44e8[_0x4b2611];return _0x1ea173;};'use strict';var path=require(_0x844e('0x0'));var config=require('../config/environment');var Sequelize=require('sequelize');var _=require(_0x844e('0x1'));var jstz=require(_0x844e('0x2'));var timezone=jstz[_0x844e('0x3')]();config[_0x844e('0x4')]=_['defaultsDeep'](config[_0x844e('0x4')],{'database':_0x844e('0x5'),'username':_0x844e('0x6'),'password':_0x844e('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x844e('0x8'),'dialectOptions':{'charset':_0x844e('0x9')},'logging':![],'timezone':timezone[_0x844e('0xa')](),'define':{'charset':_0x844e('0xb'),'collate':'utf8_general_ci'}}});config[_0x844e('0xc')]=_[_0x844e('0xd')](config[_0x844e('0xc')],{'database':_0x844e('0x5'),'username':_0x844e('0x6'),'password':_0x844e('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x844e('0x8'),'dialectOptions':{'charset':_0x844e('0x9')},'logging':![],'timezone':timezone[_0x844e('0xa')](),'define':{'charset':_0x844e('0xb'),'collate':_0x844e('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x844e('0x4')][_0x844e('0xf')],config['sequelize'][_0x844e('0x10')],config[_0x844e('0x4')]['password'],config[_0x844e('0x4')][_0x844e('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x844e('0xf')],config[_0x844e('0xc')][_0x844e('0x10')],config['sequelizeHistory'][_0x844e('0x12')],config[_0x844e('0xc')][_0x844e('0x11')])};db[_0x844e('0x13')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x15'));db[_0x844e('0x16')]=db['sequelize'][_0x844e('0x14')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x844e('0x17')]=db['sequelize'][_0x844e('0x14')]('../api/voiceContext/voiceContext.model');db[_0x844e('0x18')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x19'));db[_0x844e('0x1a')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x1b'));db['VoiceQueue']=db[_0x844e('0x4')]['import']('../api/voiceQueue/voiceQueue.model');db[_0x844e('0x1c')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x1d'));db['ScreenRecording']=db[_0x844e('0x4')][_0x844e('0x14')]('../api/screenRecording/screenRecording.model');db[_0x844e('0x1e')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x1f'));db[_0x844e('0x20')]=db[_0x844e('0x4')]['import'](_0x844e('0x21'));db[_0x844e('0x22')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x23'));db['VoiceDialReport']=db[_0x844e('0x4')]['import']('../api/voiceDialReport/voiceDialReport.model');db[_0x844e('0x24')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x844e('0x25')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x844e('0x26')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x27'));db[_0x844e('0x28')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x29'));db[_0x844e('0x2a')]=db[_0x844e('0x4')]['import'](_0x844e('0x2b'));db[_0x844e('0x2c')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x2d'));db[_0x844e('0x2e')]=db[_0x844e('0x4')]['import'](_0x844e('0x2f'));db[_0x844e('0x30')]=db[_0x844e('0x4')]['import'](_0x844e('0x31'));db[_0x844e('0x32')]=db['sequelize'][_0x844e('0x14')](_0x844e('0x33'));db['UserFaxQueue']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x34'));db[_0x844e('0x35')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x36'));db['UserOpenchannelQueue']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x37'));db[_0x844e('0x38')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x39'));db[_0x844e('0x3a')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x3b'));db['MailServerOut']=db['sequelize'][_0x844e('0x14')](_0x844e('0x3c'));db[_0x844e('0x3d')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x3e'));db[_0x844e('0x3f')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/mailQueue/mailQueue.model');db[_0x844e('0x40')]=db['sequelize'][_0x844e('0x14')]('../api/mailSubstatus/mailSubstatus.model');db[_0x844e('0x41')]=db['sequelize'][_0x844e('0x14')](_0x844e('0x42'));db[_0x844e('0x43')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x44'));db[_0x844e('0x45')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x46'));db[_0x844e('0x47')]=db['sequelize'][_0x844e('0x14')](_0x844e('0x48'));db[_0x844e('0x49')]=db['sequelize']['import'](_0x844e('0x4a'));db[_0x844e('0x4b')]=db[_0x844e('0x4')]['import']('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db['sequelize'][_0x844e('0x14')](_0x844e('0x4c'));db[_0x844e('0x4d')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/faxApplication/faxApplication.model');db[_0x844e('0x4e')]=db['sequelize']['import'](_0x844e('0x4f'));db[_0x844e('0x50')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/faxMessage/faxMessage.model');db[_0x844e('0x51')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/faxQueue/faxQueue.model');db[_0x844e('0x52')]=db[_0x844e('0x4')]['import'](_0x844e('0x53'));db[_0x844e('0x54')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x55'));db[_0x844e('0x56')]=db['sequelize'][_0x844e('0x14')](_0x844e('0x57'));db[_0x844e('0x58')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x59'));db[_0x844e('0x5a')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x5b'));db['SmsQueue']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x5c'));db['OpenchannelAccount']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x5d'));db[_0x844e('0x5e')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x5f'));db['OpenchannelInteraction']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x60'));db[_0x844e('0x61')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x62'));db[_0x844e('0x63')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x64'));db[_0x844e('0x65')]=db[_0x844e('0x4')]['import'](_0x844e('0x66'));db[_0x844e('0x67')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x68'));db[_0x844e('0x69')]=db['sequelize'][_0x844e('0x14')](_0x844e('0x6a'));db['ChatInteraction']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x6b'));db[_0x844e('0x6c')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x6d'));db[_0x844e('0x6e')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x6f'));db[_0x844e('0x70')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/chatQueue/chatQueue.model');db[_0x844e('0x71')]=db[_0x844e('0x4')]['import'](_0x844e('0x72'));db['ChatProactiveAction']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x73'));db['CmCompany']=db['sequelize'][_0x844e('0x14')](_0x844e('0x74'));db[_0x844e('0x75')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/cmContact/cmContact.model');db[_0x844e('0x76')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x77'));db['CmHopperBlack']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x78'));db['CmHopperFinal']=db['sequelize'][_0x844e('0x14')](_0x844e('0x79'));db[_0x844e('0x7a')]=db['sequelize']['import'](_0x844e('0x7b'));db[_0x844e('0x7c')]=db[_0x844e('0x4')]['import'](_0x844e('0x7d'));db[_0x844e('0x7e')]=db[_0x844e('0x4')]['import'](_0x844e('0x7f'));db[_0x844e('0x80')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/action/action.model');db[_0x844e('0x81')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x82'));db[_0x844e('0x83')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x84'));db['Disposition']=db['sequelize'][_0x844e('0x14')]('../api/disposition/disposition.model');db[_0x844e('0x85')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x86'));db['Interval']=db['sequelize']['import']('../api/interval/interval.model');db['Pause']=db['sequelize'][_0x844e('0x14')](_0x844e('0x87'));db[_0x844e('0x88')]=db['sequelize'][_0x844e('0x14')](_0x844e('0x89'));db['VoiceQueuesLog']=db[_0x844e('0x4')]['import'](_0x844e('0x8a'));db[_0x844e('0x8b')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/schedule/schedule.model');db['Sound']=db['sequelize'][_0x844e('0x14')](_0x844e('0x8c'));db[_0x844e('0x8d')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/tag/tag.model');db['Template']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x8e'));db[_0x844e('0x8f')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/trigger/trigger.model');db[_0x844e('0x90')]=db[_0x844e('0x4')]['import'](_0x844e('0x91'));db[_0x844e('0x92')]=db['sequelize']['import'](_0x844e('0x93'));db[_0x844e('0x94')]=db[_0x844e('0x4')]['import']('../api/integrationReport/integrationReport.model');db['AnalyticCustomReport']=db[_0x844e('0x4')]['import'](_0x844e('0x95'));db[_0x844e('0x96')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x97'));db[_0x844e('0x98')]=db['sequelize'][_0x844e('0x14')](_0x844e('0x99'));db['AnalyticMetric']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x9a'));db[_0x844e('0x9b')]=db[_0x844e('0x4')]['import']('../api/analyticFieldReport/analyticFieldReport.model');db[_0x844e('0x9c')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x9d'));db[_0x844e('0x9e')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x844e('0x9f')]=db[_0x844e('0x4')]['import'](_0x844e('0xa0'));db[_0x844e('0xa1')]=db[_0x844e('0x4')]['import']('../api/intSalesforceField/intSalesforceField.model');db[_0x844e('0xa2')]=db[_0x844e('0x4')]['import'](_0x844e('0xa3'));db[_0x844e('0xa4')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xa5'));db[_0x844e('0xa6')]=db[_0x844e('0x4')]['import'](_0x844e('0xa7'));db['DeskAccount']=db[_0x844e('0x4')]['import'](_0x844e('0xa8'));db['DeskConfiguration']=db[_0x844e('0x4')][_0x844e('0x14')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x844e('0xa9')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xaa'));db[_0x844e('0xab')]=db['sequelize'][_0x844e('0x14')](_0x844e('0xac'));db[_0x844e('0xad')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xae'));db[_0x844e('0xaf')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xb0'));db['ZendeskAccount']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xb1'));db[_0x844e('0xb2')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xb3'));db[_0x844e('0xb4')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xb5'));db[_0x844e('0xb6')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xb7'));db['FreshdeskConfiguration']=db[_0x844e('0x4')]['import'](_0x844e('0xb8'));db[_0x844e('0xb9')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xba'));db['VtigerAccount']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xbb'));db['VtigerConfiguration']=db['sequelize'][_0x844e('0x14')](_0x844e('0xbc'));db['VtigerField']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xbd'));db[_0x844e('0xbe')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xbf'));db[_0x844e('0xc0')]=db[_0x844e('0x4')]['import'](_0x844e('0xc1'));db['ServicenowField']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xc2'));db[_0x844e('0xc3')]=db[_0x844e('0x4')]['import'](_0x844e('0xc4'));db[_0x844e('0xc5')]=db['sequelize'][_0x844e('0x14')](_0x844e('0xc6'));db[_0x844e('0xc7')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x844e('0xc8')]=db[_0x844e('0x4')]['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db['FreshsalesConfiguration']=db[_0x844e('0x4')][_0x844e('0x14')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x844e('0xc9')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xca'));db[_0x844e('0x92')]=db['sequelize']['import']('../api/integration/integration.model');db[_0x844e('0xcb')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xcc'));db['ChatQueueReport']=db['sequelize'][_0x844e('0x14')](_0x844e('0xcd'));db[_0x844e('0xce')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x844e('0xcf')]=db[_0x844e('0x4')]['import'](_0x844e('0xd0'));db['JscriptyQuestionReport']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xd1'));db[_0x844e('0xd2')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xd3'));db[_0x844e('0xd4')]=db['sequelize'][_0x844e('0x14')](_0x844e('0xd5'));db[_0x844e('0xd6')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/squareReport/squareReport.model');db[_0x844e('0xd7')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xd8'));db[_0x844e('0xd9')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/jscriptyProject/jscriptyProject.model');db['Setting']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xda'));db['SquareOdbc']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xdb'));db[_0x844e('0xdc')]=db['sequelize'][_0x844e('0x14')](_0x844e('0xdd'));db[_0x844e('0xde')]=db['sequelize'][_0x844e('0x14')](_0x844e('0xdf'));db['SquareMessage']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xe0'));db[_0x844e('0xe1')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/team/team.model');db[_0x844e('0xe2')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xe3'));db[_0x844e('0xe4')]=db[_0x844e('0x4')]['import'](_0x844e('0xe5'));db[_0x844e('0xe6')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xe7'));db[_0x844e('0xe8')]=db[_0x844e('0x4')]['import']('../api/attachment/attachment.model');db['Plugin']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xe9'));db[_0x844e('0xea')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xeb'));db[_0x844e('0xec')]=db[_0x844e('0x4')]['import']('../api/chatTransferReport/chatTransferReport.model');db[_0x844e('0xed')]=db['sequelize'][_0x844e('0x14')]('../api/faxTransferReport/faxTransferReport.model');db[_0x844e('0xee')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xef'));db[_0x844e('0xf0')]=db[_0x844e('0x4')]['import']('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xf1'));db[_0x844e('0xf2')]=db['sequelize']['import']('../api/voicePrefix/voicePrefix.model');db[_0x844e('0xf3')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xf4'));db[_0x844e('0xf5')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/userProfileSection/userProfileSection.model');db[_0x844e('0xf6')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/userProfileResource/userProfileResource.model');db[_0x844e('0xf7')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/notification/notification.model');db['WhatsappAccount']=db[_0x844e('0x4')]['import']('../api/whatsappAccount/whatsappAccount.model');db[_0x844e('0xf8')]=db[_0x844e('0x4')]['import'](_0x844e('0xf9'));db[_0x844e('0xfa')]=db[_0x844e('0x4')]['import'](_0x844e('0xfb'));db[_0x844e('0xfc')]=db[_0x844e('0x4')][_0x844e('0x14')]('../api/whatsappMessage/whatsappMessage.model');db[_0x844e('0xfd')]=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xfe'));db['WhatsappTransferReport']=db[_0x844e('0x4')][_0x844e('0x14')]('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0xff'));db['CloudProvider']=db[_0x844e('0x4')][_0x844e('0x14')](_0x844e('0x100'));db['User'][_0x844e('0x101')](db[_0x844e('0x1e')],{'as':'VoiceMail','onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x103')});db[_0x844e('0x13')]['hasMany'](db[_0x844e('0x1c')],{'as':_0x844e('0x104'),'foreignKey':'UserId'});db[_0x844e('0x13')][_0x844e('0x105')](db[_0x844e('0x2c')],{'as':_0x844e('0x106'),'foreignKey':'UserId'});db[_0x844e('0x13')]['hasMany'](db[_0x844e('0x18')],{'as':_0x844e('0x107'),'onDelete':_0x844e('0x102'),'hooks':!![]});db['User'][_0x844e('0x105')](db['CmHopperFinal'],{'as':_0x844e('0x108'),'foreignKey':_0x844e('0x103')});db[_0x844e('0x13')]['hasMany'](db[_0x844e('0x7a')],{'as':_0x844e('0x109'),'foreignKey':_0x844e('0x103')});db[_0x844e('0x13')][_0x844e('0x105')](db[_0x844e('0x7c')],{'as':_0x844e('0x7c'),'foreignKey':_0x844e('0x103')});db[_0x844e('0x13')][_0x844e('0x105')](db[_0x844e('0x10a')],{'as':_0x844e('0x10b'),'foreignKey':_0x844e('0x103')});db[_0x844e('0x13')][_0x844e('0x105')](db[_0x844e('0x10c')],{'as':'ChatInteractions','foreignKey':_0x844e('0x103')});db[_0x844e('0x13')][_0x844e('0x105')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x844e('0x103')});db[_0x844e('0x13')][_0x844e('0x105')](db[_0x844e('0x4e')],{'as':_0x844e('0x10d'),'foreignKey':'UserId'});db[_0x844e('0x13')][_0x844e('0x105')](db[_0x844e('0x41')],{'as':'MailInteractions','foreignKey':'UserId'});db[_0x844e('0x13')][_0x844e('0x105')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':_0x844e('0x103')});db[_0x844e('0x13')][_0x844e('0x105')](db['Notification'],{'as':_0x844e('0x10e'),'foreignKey':_0x844e('0x10f')});db['User']['belongsTo'](db['UserProfile'],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0x71')],{'as':_0x844e('0x111'),'through':'chat_group_has_users'});db['User'][_0x844e('0x110')](db['CmContact'],{'as':_0x844e('0x112'),'through':_0x844e('0x113')});db[_0x844e('0x13')][_0x844e('0x110')](db['CmList'],{'as':'Lists','through':_0x844e('0x114')});db['User'][_0x844e('0x110')](db['Team'],{'through':'user_has_teams'});db[_0x844e('0x13')][_0x844e('0x110')](db['MailInteraction'],{'as':_0x844e('0x115'),'through':'user_has_mail_interactions'});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0x10c')],{'as':_0x844e('0x116'),'through':'user_has_chat_interactions'});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0x4e')],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0x58')],{'as':_0x844e('0x117'),'through':_0x844e('0x118')});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0x10a')],{'as':_0x844e('0x10b'),'through':'user_has_openchannel_interactions'});db[_0x844e('0x13')]['belongsToMany'](db[_0x844e('0xfa')],{'as':_0x844e('0x119'),'through':'user_has_whatsapp_interactions'});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0x11a')],{'as':_0x844e('0x11b'),'through':'UserVoiceQueue','required':![]});db['User'][_0x844e('0x110')](db[_0x844e('0x3f')],{'as':'MailQueues','through':_0x844e('0x32'),'required':![]});db[_0x844e('0x13')]['belongsToMany'](db[_0x844e('0x70')],{'as':_0x844e('0x11c'),'through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0x844e('0x110')](db[_0x844e('0x51')],{'as':_0x844e('0x11d'),'through':_0x844e('0x11e'),'required':![]});db['User'][_0x844e('0x110')](db[_0x844e('0x11f')],{'as':_0x844e('0x120'),'through':_0x844e('0x35'),'required':![]});db[_0x844e('0x13')]['belongsToMany'](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':_0x844e('0x121'),'required':![]});db[_0x844e('0x13')]['belongsToMany'](db[_0x844e('0x122')],{'as':_0x844e('0x123'),'through':_0x844e('0x38'),'required':![]});db['User'][_0x844e('0x110')](db[_0x844e('0x124')],{'through':_0x844e('0x114')});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0xf2')],{'as':'VoicePrefixes','through':_0x844e('0x125'),'required':![]});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0x65')],{'as':_0x844e('0x126'),'through':_0x844e('0x127')});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0x128')],{'as':_0x844e('0x129'),'through':_0x844e('0x12a')});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0x3d')],{'as':'MailAccounts','through':_0x844e('0x12b')});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0x12c')],{'as':_0x844e('0x12d'),'through':_0x844e('0x12e')});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0x54')],{'as':_0x844e('0x12f'),'through':'user_has_sms_accounts'});db[_0x844e('0x13')]['belongsToMany'](db[_0x844e('0x130')],{'as':_0x844e('0x131'),'through':_0x844e('0x132')});db[_0x844e('0x13')][_0x844e('0x110')](db[_0x844e('0xdc')],{'as':_0x844e('0x133'),'through':_0x844e('0x134')});db[_0x844e('0x16')][_0x844e('0x105')](db['VoiceExtension'],{'as':_0x844e('0x135'),'onDelete':'cascade','foreignKey':'ChanSpyId'});db[_0x844e('0x17')]['hasMany'](db[_0x844e('0x18')],{'onDelete':'cascade'});db[_0x844e('0x18')]['hasMany'](db[_0x844e('0x18')],{'as':'Applications','onDelete':_0x844e('0x102')});db[_0x844e('0x1a')]['belongsToMany'](db[_0x844e('0x136')],{'as':_0x844e('0x137'),'through':_0x844e('0x138')});db['VoiceQueue'][_0x844e('0x105')](db[_0x844e('0x2c')],{'as':_0x844e('0x139'),'foreignKey':_0x844e('0x13a')});db[_0x844e('0x11a')]['hasMany'](db['CmHopper'],{'as':_0x844e('0x13b'),'foreignKey':_0x844e('0x13a')});db[_0x844e('0x11a')][_0x844e('0x105')](db[_0x844e('0x13c')],{'as':_0x844e('0x108'),'foreignKey':_0x844e('0x13a')});db[_0x844e('0x11a')][_0x844e('0x105')](db[_0x844e('0x7a')],{'as':_0x844e('0x13d'),'foreignKey':_0x844e('0x13a')});db[_0x844e('0x11a')]['hasMany'](db['ReportAgentPreview'],{'as':_0x844e('0x7c'),'foreignKey':'VoiceQueueId'});db[_0x844e('0x11a')]['hasMany'](db[_0x844e('0x13e')],{'as':'HopperBlacks','foreignKey':_0x844e('0x13a')});db[_0x844e('0x11a')][_0x844e('0x105')](db[_0x844e('0xd2')],{'as':'JscriptySessions','foreignKey':_0x844e('0x13a')});db[_0x844e('0x11a')][_0x844e('0x13f')](db[_0x844e('0x28')],{'as':_0x844e('0x28'),'foreignKey':_0x844e('0x140')});db[_0x844e('0x11a')][_0x844e('0x13f')](db[_0x844e('0x28')],{'as':_0x844e('0x141'),'foreignKey':_0x844e('0x142')});db[_0x844e('0x11a')][_0x844e('0x13f')](db[_0x844e('0x143')],{'as':_0x844e('0x143'),'foreignKey':'IntervalId'});db[_0x844e('0x11a')][_0x844e('0x13f')](db[_0x844e('0x144')],{'as':_0x844e('0x145'),'foreignKey':_0x844e('0x146')});db[_0x844e('0x11a')][_0x844e('0x110')](db['CmList'],{'as':_0x844e('0x147'),'through':_0x844e('0x148')});db[_0x844e('0x11a')]['belongsToMany'](db[_0x844e('0x13')],{'as':_0x844e('0x149'),'through':_0x844e('0x2e')});db[_0x844e('0x11a')]['belongsToMany'](db[_0x844e('0xe1')],{'as':_0x844e('0x14a'),'through':_0x844e('0x14b')});db[_0x844e('0x11a')]['belongsToMany'](db[_0x844e('0x124')],{'as':'BlackLists','through':_0x844e('0x14c')});db[_0x844e('0x1c')]['belongsTo'](db[_0x844e('0x13')],{'as':_0x844e('0x13'),'foreignKey':_0x844e('0x103')});db['ScreenRecording'][_0x844e('0x13f')](db[_0x844e('0x13')],{'as':'User','foreignKey':_0x844e('0x103')});db[_0x844e('0x1e')][_0x844e('0x105')](db[_0x844e('0x20')],{'as':_0x844e('0x14d'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x14e'),'sourceKey':'mailbox'});db[_0x844e('0x20')][_0x844e('0x13f')](db[_0x844e('0x1e')],{'foreignKey':_0x844e('0x14e'),'targetKey':_0x844e('0x14f')});db[_0x844e('0x22')]['hasMany'](db[_0x844e('0x25')],{'as':_0x844e('0x150'),'foreignKey':_0x844e('0x151'),'constraints':![]});db[_0x844e('0x22')][_0x844e('0x105')](db[_0x844e('0x24')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x844e('0x13f')](db[_0x844e('0x13')],{'as':_0x844e('0x13'),'foreignKey':_0x844e('0x103')});db[_0x844e('0x22')][_0x844e('0x13f')](db[_0x844e('0x75')],{'as':_0x844e('0x152'),'foreignKey':_0x844e('0x153')});db[_0x844e('0x3a')][_0x844e('0x13f')](db['MailAccount'],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x844e('0x154')][_0x844e('0x13f')](db['MailAccount'],{'as':_0x844e('0x3d'),'foreignKey':'MailAccountId'});db[_0x844e('0x3d')][_0x844e('0x101')](db['MailServerIn'],{'as':'Imap','onDelete':_0x844e('0x102')});db[_0x844e('0x3d')][_0x844e('0x101')](db['MailServerOut'],{'as':_0x844e('0x155'),'onDelete':_0x844e('0x102')});db[_0x844e('0x3d')]['hasMany'](db[_0x844e('0x156')],{'as':_0x844e('0x157'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x844e('0x105')](db[_0x844e('0x83')],{'as':'Answers','foreignKey':_0x844e('0x158')});db[_0x844e('0x3d')]['hasMany'](db[_0x844e('0x43')],{'as':'Messages','foreignKey':'MailAccountId'});db['MailAccount']['hasMany'](db['MailInteraction'],{'as':'Interactions'});db['MailAccount'][_0x844e('0x105')](db[_0x844e('0x45')],{'as':_0x844e('0x159')});db[_0x844e('0x3d')][_0x844e('0x13f')](db[_0x844e('0x124')],{'as':_0x844e('0x15a'),'foreignKey':_0x844e('0x15b')});db[_0x844e('0x3d')][_0x844e('0x13f')](db[_0x844e('0x15c')],{'as':'Template','foreignKey':_0x844e('0x15d')});db[_0x844e('0x3d')][_0x844e('0x13f')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x844e('0x146')});db[_0x844e('0x3d')][_0x844e('0x110')](db['User'],{'as':'Agents','through':_0x844e('0x12b')});db[_0x844e('0x3f')][_0x844e('0x110')](db[_0x844e('0x13')],{'as':_0x844e('0x149'),'through':'UserMailQueue'});db[_0x844e('0x3f')][_0x844e('0x110')](db[_0x844e('0xe1')],{'through':_0x844e('0x15e'),'as':_0x844e('0x14a')});db[_0x844e('0x41')][_0x844e('0x105')](db[_0x844e('0x43')],{'as':'Messages','onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x15f')});db[_0x844e('0x41')][_0x844e('0x13f')](db['MailAccount'],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x158')});db['MailInteraction']['belongsTo'](db[_0x844e('0x75')],{'as':_0x844e('0x152'),'foreignKey':_0x844e('0x153')});db[_0x844e('0x41')][_0x844e('0x13f')](db[_0x844e('0x13')],{'as':_0x844e('0x161'),'foreignKey':'UserId'});db[_0x844e('0x41')][_0x844e('0x110')](db[_0x844e('0x8d')],{'through':_0x844e('0x162'),'as':_0x844e('0x163')});db[_0x844e('0x41')][_0x844e('0x110')](db[_0x844e('0x8d')],{'through':_0x844e('0x162'),'as':'ThroughTags'});db[_0x844e('0x41')][_0x844e('0x110')](db[_0x844e('0x13')],{'as':_0x844e('0x164'),'through':_0x844e('0x165'),'foreignKey':_0x844e('0x15f')});db[_0x844e('0x43')][_0x844e('0x105')](db[_0x844e('0xe8')],{'as':'Attachments','onDelete':'cascade'});db['MailMessage'][_0x844e('0x13f')](db[_0x844e('0x13')],{'as':_0x844e('0x13')});db[_0x844e('0x43')]['belongsTo'](db[_0x844e('0x75')],{'onDelete':_0x844e('0x102'),'as':_0x844e('0x152')});db[_0x844e('0x43')]['belongsTo'](db[_0x844e('0x41')],{'as':_0x844e('0x166'),'foreignKey':_0x844e('0x15f')});db[_0x844e('0x43')][_0x844e('0x13f')](db[_0x844e('0x3d')],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x158')});db[_0x844e('0x45')]['belongsTo'](db[_0x844e('0x13')],{'onDelete':_0x844e('0x167')});db[_0x844e('0x45')][_0x844e('0x13f')](db[_0x844e('0x3f')],{'onDelete':_0x844e('0x167')});db['MailApplication'][_0x844e('0x13f')](db[_0x844e('0x3d')],{'onDelete':_0x844e('0x167')});db[_0x844e('0x45')][_0x844e('0x13f')](db['Interval'],{'onDelete':_0x844e('0x167'),'foreignKey':_0x844e('0x168')});db[_0x844e('0x45')][_0x844e('0x13f')](db[_0x844e('0x8d')],{'onDelete':_0x844e('0x167'),'foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db[_0x844e('0x3d')],{});db[_0x844e('0x47')]['belongsTo'](db[_0x844e('0x124')],{'as':_0x844e('0x15a'),'foreignKey':_0x844e('0x15b')});db['MailQueueReport'][_0x844e('0x13f')](db[_0x844e('0x75')],{'as':_0x844e('0x152'),'foreignKey':_0x844e('0x153')});db[_0x844e('0x47')]['belongsTo'](db[_0x844e('0x41')],{});db[_0x844e('0x47')]['belongsTo'](db[_0x844e('0x43')],{});db[_0x844e('0x47')]['belongsTo'](db[_0x844e('0x13')],{});db[_0x844e('0x47')]['belongsTo'](db[_0x844e('0x3f')],{});db[_0x844e('0x49')][_0x844e('0x105')](db[_0x844e('0x4b')],{'as':_0x844e('0x169'),'onDelete':_0x844e('0x102')});db[_0x844e('0x128')][_0x844e('0x105')](db[_0x844e('0x156')],{'as':_0x844e('0x157'),'foreignKey':_0x844e('0x16a')});db[_0x844e('0x128')][_0x844e('0x105')](db[_0x844e('0x83')],{'as':'Answers','foreignKey':_0x844e('0x16a')});db[_0x844e('0x128')]['hasMany'](db[_0x844e('0x4e')],{'as':_0x844e('0x16b')});db[_0x844e('0x128')][_0x844e('0x105')](db[_0x844e('0x4d')],{'as':_0x844e('0x159')});db['FaxAccount'][_0x844e('0x105')](db['VoiceExtension'],{'as':_0x844e('0x16c'),'onDelete':_0x844e('0x102')});db[_0x844e('0x128')][_0x844e('0x105')](db[_0x844e('0x50')],{'as':_0x844e('0x14d')});db[_0x844e('0x128')]['belongsTo'](db[_0x844e('0x28')],{'as':'Trunk'});db['FaxAccount']['belongsTo'](db[_0x844e('0x124')],{'as':_0x844e('0x15a'),'foreignKey':_0x844e('0x15b')});db['FaxAccount'][_0x844e('0x13f')](db[_0x844e('0x144')],{'as':_0x844e('0x145'),'foreignKey':_0x844e('0x146')});db[_0x844e('0x128')][_0x844e('0x110')](db[_0x844e('0x13')],{'as':'Agents','through':'user_has_fax_accounts'});db[_0x844e('0x4d')]['belongsTo'](db[_0x844e('0x13')],{'onDelete':_0x844e('0x167')});db[_0x844e('0x4d')][_0x844e('0x13f')](db['FaxQueue'],{'onDelete':_0x844e('0x167')});db[_0x844e('0x4d')][_0x844e('0x13f')](db[_0x844e('0x128')],{'onDelete':_0x844e('0x167')});db[_0x844e('0x4d')]['belongsTo'](db['Tag'],{'onDelete':_0x844e('0x167'),'foreignKey':'TagId'});db[_0x844e('0x4e')]['hasMany'](db[_0x844e('0x50')],{'as':_0x844e('0x14d'),'onDelete':'cascade','foreignKey':_0x844e('0x16d')});db[_0x844e('0x4e')][_0x844e('0x13f')](db[_0x844e('0x128')],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x16a')});db['FaxInteraction']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x844e('0x153')});db[_0x844e('0x4e')][_0x844e('0x13f')](db['User'],{'as':_0x844e('0x161'),'foreignKey':_0x844e('0x103')});db[_0x844e('0x4e')][_0x844e('0x110')](db['Tag'],{'through':_0x844e('0x16e'),'as':_0x844e('0x163')});db['FaxInteraction'][_0x844e('0x110')](db[_0x844e('0x8d')],{'through':_0x844e('0x16e'),'as':'ThroughTags'});db[_0x844e('0x4e')][_0x844e('0x110')](db[_0x844e('0x13')],{'as':'Users','through':_0x844e('0x16f'),'foreignKey':'FaxInteractionId'});db[_0x844e('0x50')][_0x844e('0x13f')](db[_0x844e('0x13')],{'onDelete':_0x844e('0x102'),'as':_0x844e('0x13')});db[_0x844e('0x50')][_0x844e('0x13f')](db[_0x844e('0x4e')],{'as':_0x844e('0x166'),'foreignKey':_0x844e('0x16d')});db[_0x844e('0x50')][_0x844e('0x13f')](db['CmContact'],{'onDelete':_0x844e('0x102'),'as':_0x844e('0x152')});db['FaxMessage'][_0x844e('0x13f')](db[_0x844e('0xe8')],{'as':_0x844e('0xe8'),'foreignKey':_0x844e('0x170')});db[_0x844e('0x50')][_0x844e('0x13f')](db[_0x844e('0x128')],{'as':_0x844e('0x160'),'foreignKey':'FaxAccountId'});db[_0x844e('0x51')]['belongsToMany'](db[_0x844e('0x13')],{'as':_0x844e('0x149'),'through':_0x844e('0x11e')});db[_0x844e('0x51')][_0x844e('0x110')](db['Team'],{'through':_0x844e('0x171'),'as':'Teams'});db[_0x844e('0x52')][_0x844e('0x13f')](db[_0x844e('0x128')],{});db['FaxQueueReport'][_0x844e('0x13f')](db[_0x844e('0x124')],{'as':_0x844e('0x15a'),'foreignKey':_0x844e('0x15b')});db[_0x844e('0x52')]['belongsTo'](db['CmContact'],{'as':_0x844e('0x152'),'foreignKey':_0x844e('0x153')});db[_0x844e('0x52')][_0x844e('0x13f')](db[_0x844e('0x4e')],{});db[_0x844e('0x52')][_0x844e('0x13f')](db[_0x844e('0x50')],{});db[_0x844e('0x52')]['belongsTo'](db[_0x844e('0x13')],{});db['FaxQueueReport'][_0x844e('0x13f')](db[_0x844e('0x51')],{});db['SmsAccount'][_0x844e('0x105')](db[_0x844e('0x156')],{'as':_0x844e('0x157'),'foreignKey':_0x844e('0x172')});db[_0x844e('0x54')]['hasMany'](db[_0x844e('0x83')],{'as':'Answers','foreignKey':_0x844e('0x172')});db[_0x844e('0x54')]['hasMany'](db['SmsMessage'],{'as':_0x844e('0x14d'),'foreignKey':_0x844e('0x172')});db[_0x844e('0x54')][_0x844e('0x105')](db['SmsInteraction'],{'as':_0x844e('0x16b')});db[_0x844e('0x54')][_0x844e('0x105')](db[_0x844e('0x56')],{'as':_0x844e('0x159')});db['SmsAccount'][_0x844e('0x13f')](db[_0x844e('0x124')],{'as':_0x844e('0x15a'),'foreignKey':'ListId'});db[_0x844e('0x54')]['belongsTo'](db[_0x844e('0x144')],{'as':_0x844e('0x145'),'foreignKey':_0x844e('0x146')});db[_0x844e('0x54')]['belongsToMany'](db[_0x844e('0x13')],{'as':_0x844e('0x149'),'through':_0x844e('0x173')});db[_0x844e('0x56')][_0x844e('0x13f')](db[_0x844e('0x13')],{'onDelete':'restrict'});db[_0x844e('0x56')]['belongsTo'](db[_0x844e('0x11f')],{'onDelete':'restrict'});db[_0x844e('0x56')][_0x844e('0x13f')](db[_0x844e('0x54')],{'onDelete':_0x844e('0x167')});db[_0x844e('0x56')][_0x844e('0x13f')](db[_0x844e('0x143')],{'onDelete':'restrict','foreignKey':_0x844e('0x168')});db['SmsApplication'][_0x844e('0x13f')](db['Tag'],{'onDelete':_0x844e('0x167'),'foreignKey':_0x844e('0x174')});db[_0x844e('0x58')][_0x844e('0x105')](db[_0x844e('0x5a')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x844e('0x175')});db['SmsInteraction'][_0x844e('0x13f')](db['SmsAccount'],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x172')});db[_0x844e('0x58')]['belongsTo'](db[_0x844e('0x75')],{'as':'Contact','foreignKey':_0x844e('0x153')});db[_0x844e('0x58')][_0x844e('0x13f')](db[_0x844e('0x13')],{'as':_0x844e('0x161'),'foreignKey':_0x844e('0x103')});db[_0x844e('0x58')][_0x844e('0x110')](db[_0x844e('0x8d')],{'through':_0x844e('0x176'),'as':_0x844e('0x163')});db['SmsInteraction'][_0x844e('0x110')](db['Tag'],{'through':_0x844e('0x176'),'as':'ThroughTags'});db[_0x844e('0x58')][_0x844e('0x110')](db[_0x844e('0x13')],{'as':_0x844e('0x164'),'through':_0x844e('0x118'),'foreignKey':_0x844e('0x175')});db[_0x844e('0x5a')]['belongsTo'](db[_0x844e('0x13')],{'as':_0x844e('0x13')});db[_0x844e('0x5a')][_0x844e('0x13f')](db[_0x844e('0x75')],{'onDelete':_0x844e('0x102'),'as':_0x844e('0x152')});db[_0x844e('0x5a')]['belongsTo'](db[_0x844e('0x58')],{'onDelete':_0x844e('0x102'),'as':'Interaction','foreignKey':_0x844e('0x175')});db[_0x844e('0x5a')][_0x844e('0x13f')](db[_0x844e('0x54')],{'as':_0x844e('0x160'),'foreignKey':'SmsAccountId'});db[_0x844e('0x11f')][_0x844e('0x110')](db[_0x844e('0x13')],{'as':_0x844e('0x149'),'through':_0x844e('0x35'),'foreignKey':_0x844e('0x177')});db[_0x844e('0x11f')]['belongsToMany'](db[_0x844e('0xe1')],{'through':_0x844e('0x178'),'as':'Teams'});db['OpenchannelAccount'][_0x844e('0x105')](db['Disposition'],{'as':_0x844e('0x157'),'foreignKey':'OpenchannelAccountId'});db[_0x844e('0x12c')][_0x844e('0x105')](db['CannedAnswer'],{'as':'Answers','foreignKey':'OpenchannelAccountId'});db[_0x844e('0x12c')][_0x844e('0x105')](db[_0x844e('0x10a')],{'as':_0x844e('0x16b'),'foreignKey':_0x844e('0x179')});db[_0x844e('0x12c')][_0x844e('0x105')](db[_0x844e('0x61')],{'as':_0x844e('0x14d'),'foreignKey':_0x844e('0x179')});db['OpenchannelAccount'][_0x844e('0x105')](db[_0x844e('0x5e')],{'as':_0x844e('0x159'),'foreignKey':_0x844e('0x179')});db[_0x844e('0x12c')]['belongsTo'](db[_0x844e('0x124')],{'as':_0x844e('0x15a'),'foreignKey':_0x844e('0x15b')});db[_0x844e('0x12c')][_0x844e('0x13f')](db[_0x844e('0x144')],{'as':_0x844e('0x145'),'foreignKey':_0x844e('0x146')});db[_0x844e('0x12c')]['belongsToMany'](db[_0x844e('0x13')],{'as':_0x844e('0x149'),'through':_0x844e('0x12e')});db[_0x844e('0x5e')][_0x844e('0x13f')](db['User'],{'onDelete':'restrict'});db[_0x844e('0x5e')][_0x844e('0x13f')](db[_0x844e('0x63')],{'onDelete':'restrict','foreignKey':_0x844e('0x17a')});db[_0x844e('0x5e')]['belongsTo'](db[_0x844e('0x12c')],{'onDelete':_0x844e('0x167'),'foreignKey':_0x844e('0x179')});db[_0x844e('0x5e')][_0x844e('0x13f')](db[_0x844e('0x143')],{'onDelete':_0x844e('0x167'),'foreignKey':_0x844e('0x168')});db[_0x844e('0x5e')][_0x844e('0x13f')](db[_0x844e('0x8d')],{'onDelete':_0x844e('0x167'),'foreignKey':_0x844e('0x174')});db[_0x844e('0x10a')][_0x844e('0x105')](db['OpenchannelMessage'],{'as':_0x844e('0x14d'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x17b')});db[_0x844e('0x10a')][_0x844e('0x13f')](db[_0x844e('0x12c')],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x179')});db[_0x844e('0x10a')][_0x844e('0x13f')](db['CmContact'],{'as':_0x844e('0x152'),'foreignKey':_0x844e('0x153')});db['OpenchannelInteraction']['belongsTo'](db[_0x844e('0x13')],{'as':_0x844e('0x161'),'foreignKey':'UserId'});db[_0x844e('0x10a')][_0x844e('0x110')](db[_0x844e('0x8d')],{'through':_0x844e('0x17c'),'as':'Tags'});db[_0x844e('0x10a')][_0x844e('0x110')](db[_0x844e('0x8d')],{'through':'openchannel_interaction_has_tags','as':_0x844e('0x17d')});db[_0x844e('0x10a')][_0x844e('0x110')](db[_0x844e('0x13')],{'as':_0x844e('0x164'),'through':_0x844e('0x17e'),'foreignKey':_0x844e('0x17b')});db[_0x844e('0x61')]['belongsTo'](db['User'],{'onDelete':_0x844e('0x102'),'as':_0x844e('0x13')});db[_0x844e('0x61')][_0x844e('0x13f')](db['CmContact'],{'onDelete':_0x844e('0x102'),'as':_0x844e('0x152')});db[_0x844e('0x61')][_0x844e('0x13f')](db['OpenchannelInteraction'],{'onDelete':_0x844e('0x102'),'as':_0x844e('0x166'),'foreignKey':'OpenchannelInteractionId'});db[_0x844e('0x61')]['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':_0x844e('0x170')});db['OpenchannelMessage'][_0x844e('0x13f')](db[_0x844e('0x12c')],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x179')});db['OpenchannelQueue']['belongsToMany'](db[_0x844e('0x13')],{'as':_0x844e('0x149'),'through':_0x844e('0x121'),'foreignKey':_0x844e('0x17a')});db[_0x844e('0x63')]['belongsToMany'](db[_0x844e('0xe1')],{'through':_0x844e('0x17f'),'as':_0x844e('0x14a')});db[_0x844e('0x65')][_0x844e('0x105')](db[_0x844e('0x156')],{'as':_0x844e('0x157'),'foreignKey':'ChatWebsiteId'});db[_0x844e('0x65')][_0x844e('0x105')](db[_0x844e('0x83')],{'as':_0x844e('0x180'),'foreignKey':_0x844e('0x181')});db[_0x844e('0x65')][_0x844e('0x105')](db[_0x844e('0x182')],{'as':_0x844e('0x183')});db['ChatWebsite'][_0x844e('0x105')](db['ChatInteraction'],{'as':'Interactions'});db[_0x844e('0x65')][_0x844e('0x105')](db[_0x844e('0x69')],{'as':_0x844e('0x159')});db['ChatWebsite'][_0x844e('0x105')](db[_0x844e('0x6c')],{'as':_0x844e('0x14d')});db['ChatWebsite']['belongsTo'](db['CmList'],{'as':_0x844e('0x15a'),'foreignKey':_0x844e('0x15b')});db[_0x844e('0x65')][_0x844e('0x13f')](db[_0x844e('0x143')],{'as':'Interval','foreignKey':_0x844e('0x168')});db[_0x844e('0x65')][_0x844e('0x13f')](db[_0x844e('0x144')],{'as':_0x844e('0x145'),'foreignKey':_0x844e('0x146')});db[_0x844e('0x65')][_0x844e('0x110')](db['User'],{'as':_0x844e('0x149'),'through':_0x844e('0x127')});db[_0x844e('0x67')][_0x844e('0x13f')](db[_0x844e('0x12c')],{});db[_0x844e('0x67')]['belongsTo'](db[_0x844e('0x124')],{'as':_0x844e('0x15a'),'foreignKey':_0x844e('0x15b')});db[_0x844e('0x67')][_0x844e('0x13f')](db[_0x844e('0x75')],{'as':_0x844e('0x152'),'foreignKey':'ContactId'});db[_0x844e('0x67')][_0x844e('0x13f')](db[_0x844e('0x10a')],{});db[_0x844e('0x67')][_0x844e('0x13f')](db[_0x844e('0x61')],{});db[_0x844e('0x67')][_0x844e('0x13f')](db[_0x844e('0x13')],{});db[_0x844e('0x67')][_0x844e('0x13f')](db[_0x844e('0x63')],{});db[_0x844e('0x69')][_0x844e('0x13f')](db[_0x844e('0x13')],{'as':'Agent','foreignKey':_0x844e('0x103'),'onDelete':_0x844e('0x167')});db[_0x844e('0x69')][_0x844e('0x13f')](db[_0x844e('0x70')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0x844e('0x167')});db[_0x844e('0x69')][_0x844e('0x13f')](db['ChatWebsite'],{'as':_0x844e('0x184'),'foreignKey':_0x844e('0x181'),'onDelete':'restrict'});db[_0x844e('0x69')][_0x844e('0x13f')](db[_0x844e('0x8d')],{'onDelete':_0x844e('0x167'),'foreignKey':_0x844e('0x174')});db[_0x844e('0x10c')][_0x844e('0x105')](db[_0x844e('0x6c')],{'as':_0x844e('0x14d'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x185')});db['ChatInteraction']['belongsTo'](db[_0x844e('0x65')],{'as':_0x844e('0x160'),'foreignKey':'ChatWebsiteId'});db[_0x844e('0x10c')][_0x844e('0x13f')](db[_0x844e('0x75')],{'as':'Contact','foreignKey':_0x844e('0x153')});db['ChatInteraction'][_0x844e('0x13f')](db[_0x844e('0x13')],{'as':_0x844e('0x161'),'foreignKey':_0x844e('0x103')});db['ChatInteraction'][_0x844e('0x110')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x844e('0x163')});db[_0x844e('0x10c')][_0x844e('0x110')](db[_0x844e('0x8d')],{'through':'chat_interaction_has_tags','as':_0x844e('0x17d')});db[_0x844e('0x10c')]['belongsToMany'](db[_0x844e('0x13')],{'as':_0x844e('0x164'),'through':'user_has_chat_interactions','foreignKey':'ChatInteractionId'});db[_0x844e('0x6c')][_0x844e('0x13f')](db[_0x844e('0x13')],{'onDelete':_0x844e('0x102'),'as':_0x844e('0x13')});db[_0x844e('0x6c')][_0x844e('0x13f')](db['CmContact'],{'onDelete':_0x844e('0x102'),'as':'Contact','foreignKey':_0x844e('0x153')});db['ChatMessage'][_0x844e('0x13f')](db['ChatInteraction'],{'onDelete':_0x844e('0x102'),'as':_0x844e('0x166'),'foreignKey':'ChatInteractionId'});db[_0x844e('0x6c')][_0x844e('0x13f')](db[_0x844e('0xe8')],{'as':_0x844e('0xe8'),'foreignKey':_0x844e('0x170')});db[_0x844e('0x6c')][_0x844e('0x13f')](db[_0x844e('0x65')],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x181')});db[_0x844e('0x6e')][_0x844e('0x13f')](db[_0x844e('0x75')],{'onDelete':_0x844e('0x102'),'as':_0x844e('0x152'),'foreignKey':_0x844e('0x153')});db[_0x844e('0x6e')]['belongsTo'](db[_0x844e('0x65')],{'as':_0x844e('0x160'),'foreignKey':'ChatWebsiteId'});db[_0x844e('0x70')][_0x844e('0x110')](db['User'],{'as':'Agents','through':_0x844e('0x30'),'hooks':!![]});db[_0x844e('0x70')][_0x844e('0x110')](db[_0x844e('0xe1')],{'through':_0x844e('0x186'),'as':'Teams'});db[_0x844e('0x71')][_0x844e('0x105')](db['ChatInternalMessage'],{'as':_0x844e('0x14d'),'foreignKey':_0x844e('0x187'),'onDelete':_0x844e('0x102')});db['ChatGroup'][_0x844e('0x110')](db[_0x844e('0x13')],{'as':_0x844e('0x139'),'through':_0x844e('0x188')});db[_0x844e('0x182')]['belongsTo'](db[_0x844e('0x65')],{'as':'Website','foreignKey':_0x844e('0x181')});db[_0x844e('0x189')][_0x844e('0x105')](db[_0x844e('0x75')],{'as':'Contacts','foreignKey':'CompanyId'});db[_0x844e('0x75')]['hasMany'](db[_0x844e('0x76')],{'as':_0x844e('0x13b'),'foreignKey':_0x844e('0x153')});db[_0x844e('0x75')][_0x844e('0x105')](db[_0x844e('0x13c')],{'as':'HopperFinals','foreignKey':_0x844e('0x153')});db[_0x844e('0x75')][_0x844e('0x105')](db[_0x844e('0x7a')],{'as':_0x844e('0x13d'),'foreignKey':'ContactId'});db[_0x844e('0x75')][_0x844e('0x105')](db[_0x844e('0x7c')],{'as':_0x844e('0x7c'),'foreignKey':'ContactId'});db['CmContact'][_0x844e('0x105')](db[_0x844e('0xd2')],{'as':_0x844e('0x18a'),'foreignKey':'ContactId'});db['CmContact'][_0x844e('0x105')](db[_0x844e('0x10a')],{'as':_0x844e('0x10b'),'foreignKey':_0x844e('0x153'),'onDelete':_0x844e('0x167')});db[_0x844e('0x75')][_0x844e('0x105')](db['ChatInteraction'],{'as':_0x844e('0x116'),'foreignKey':'ContactId','onDelete':_0x844e('0x167')});db[_0x844e('0x75')][_0x844e('0x105')](db[_0x844e('0x58')],{'as':_0x844e('0x117'),'foreignKey':_0x844e('0x153'),'onDelete':_0x844e('0x167')});db['CmContact'][_0x844e('0x105')](db[_0x844e('0x4e')],{'as':'FaxInteractions','foreignKey':_0x844e('0x153'),'onDelete':_0x844e('0x167')});db[_0x844e('0x75')][_0x844e('0x105')](db[_0x844e('0x41')],{'as':_0x844e('0x115'),'foreignKey':_0x844e('0x153'),'onDelete':_0x844e('0x167')});db[_0x844e('0x75')]['belongsTo'](db[_0x844e('0x189')],{'as':_0x844e('0x18b'),'foreignKey':'CompanyId'});db['CmContact'][_0x844e('0x13f')](db[_0x844e('0x124')],{'as':'List','foreignKey':'ListId','onDelete':_0x844e('0x102')});db[_0x844e('0x75')]['belongsToMany'](db[_0x844e('0x13')],{'as':_0x844e('0x164'),'through':'cm_user_has_contacts'});db['CmContact']['belongsToMany'](db['Tag'],{'as':'Tags','through':_0x844e('0x18c')});db[_0x844e('0x75')][_0x844e('0x110')](db['Tag'],{'through':_0x844e('0x18c'),'as':_0x844e('0x17d')});db[_0x844e('0x76')]['belongsTo'](db['CmContact'],{'as':_0x844e('0x152'),'foreignKey':_0x844e('0x153'),'onDelete':_0x844e('0x102')});db[_0x844e('0x76')][_0x844e('0x13f')](db[_0x844e('0x124')],{'as':_0x844e('0x15a'),'foreignKey':'ListId','onDelete':_0x844e('0x102')});db[_0x844e('0x76')][_0x844e('0x13f')](db[_0x844e('0x13')],{'as':'Agent','foreignKey':_0x844e('0x103')});db[_0x844e('0x76')][_0x844e('0x13f')](db[_0x844e('0x11a')],{'as':_0x844e('0x18d'),'foreignKey':_0x844e('0x13a'),'onDelete':_0x844e('0x102')});db[_0x844e('0x76')][_0x844e('0x13f')](db[_0x844e('0xe4')],{'as':_0x844e('0xe4'),'foreignKey':_0x844e('0x18e'),'onDelete':_0x844e('0x102')});db['CmHopper']['belongsTo'](db[_0x844e('0x13')],{'as':_0x844e('0x161'),'foreignKey':_0x844e('0x18f')});db[_0x844e('0x13e')][_0x844e('0x13f')](db[_0x844e('0x75')],{'as':_0x844e('0x152'),'foreignKey':'ContactId','onDelete':_0x844e('0x102')});db['CmHopperBlack'][_0x844e('0x13f')](db['CmList'],{'as':_0x844e('0x15a'),'foreignKey':_0x844e('0x15b'),'onDelete':_0x844e('0x102')});db['CmHopperBlack'][_0x844e('0x13f')](db['VoiceQueue'],{'as':'Queue','foreignKey':_0x844e('0x13a'),'onDelete':'cascade'});db[_0x844e('0x13e')][_0x844e('0x13f')](db[_0x844e('0xe4')],{'as':_0x844e('0xe4'),'foreignKey':_0x844e('0x18e'),'onDelete':_0x844e('0x102')});db[_0x844e('0x81')][_0x844e('0x105')](db[_0x844e('0x85')],{'as':{'plural':_0x844e('0x190'),'singular':'OneAll'},'foreignKey':_0x844e('0x191'),'onDelete':_0x844e('0x102'),'hooks':!![]});db[_0x844e('0x81')][_0x844e('0x105')](db['Condition'],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0x844e('0x102'),'hooks':!![]});db[_0x844e('0x81')][_0x844e('0x105')](db[_0x844e('0x80')],{'as':_0x844e('0x192'),'foreignKey':'AutomationId','onDelete':_0x844e('0x102'),'hooks':!![]});db[_0x844e('0x143')]['hasMany'](db[_0x844e('0x143')],{'as':_0x844e('0x193'),'foreignKey':'IntervalId','onDelete':_0x844e('0x102'),'hooks':!![],'required':![]});db[_0x844e('0x143')][_0x844e('0x105')](db['VoiceExtension'],{'as':_0x844e('0x107'),'foreignKey':_0x844e('0x168'),'onDelete':_0x844e('0x167')});db[_0x844e('0x143')][_0x844e('0x105')](db[_0x844e('0x45')],{'as':_0x844e('0x194'),'foreignKey':_0x844e('0x168')});db['Interval'][_0x844e('0x105')](db[_0x844e('0x69')],{'as':_0x844e('0x195'),'foreignKey':'IntervalId'});db[_0x844e('0x143')]['hasMany'](db[_0x844e('0x4d')],{'as':_0x844e('0x196'),'foreignKey':_0x844e('0x168')});db[_0x844e('0x143')]['hasMany'](db[_0x844e('0x56')],{'as':_0x844e('0x197'),'foreignKey':'IntervalId'});db[_0x844e('0x8b')][_0x844e('0x13f')](db[_0x844e('0x3d')],{});db['Schedule'][_0x844e('0x13f')](db[_0x844e('0x96')],{'foreignKey':_0x844e('0x198')});db['Schedule']['belongsTo'](db[_0x844e('0x199')],{'foreignKey':_0x844e('0x19a')});db[_0x844e('0x136')][_0x844e('0x110')](db[_0x844e('0x1a')],{'as':'Mohs','through':_0x844e('0x138'),'onDelete':'restrict'});db['Tag'][_0x844e('0x110')](db[_0x844e('0x75')],{'through':_0x844e('0x18c')});db['Tag']['belongsToMany'](db['ChatInteraction'],{'through':_0x844e('0x19b')});db[_0x844e('0x8d')][_0x844e('0x110')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0x844e('0x8d')][_0x844e('0x110')](db[_0x844e('0x58')],{'through':_0x844e('0x176')});db['Tag'][_0x844e('0x110')](db[_0x844e('0x4e')],{'through':'fax_interaction_has_tags'});db[_0x844e('0x8d')][_0x844e('0x110')](db[_0x844e('0x10a')],{'through':_0x844e('0x17c')});db[_0x844e('0x8d')][_0x844e('0x110')](db[_0x844e('0xfa')],{'through':'whatsapp_interaction_has_tags'});db[_0x844e('0x8f')][_0x844e('0x105')](db[_0x844e('0x85')],{'as':{'plural':'AllConditions','singular':'AllCondition'},'foreignKey':'TriggerAllId','onDelete':_0x844e('0x102'),'hooks':!![]});db['Trigger'][_0x844e('0x105')](db['Condition'],{'as':{'plural':_0x844e('0x19c'),'singular':_0x844e('0x19d')},'foreignKey':_0x844e('0x19e'),'onDelete':_0x844e('0x102'),'hooks':!![]});db['Trigger'][_0x844e('0x105')](db[_0x844e('0x80')],{'as':'Actions','foreignKey':'TriggerId','onDelete':_0x844e('0x102'),'hooks':!![]});db[_0x844e('0x199')][_0x844e('0x105')](db[_0x844e('0x9b')],{'as':_0x844e('0x19f'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x19a'),'hooks':!![]});db[_0x844e('0x96')][_0x844e('0x105')](db[_0x844e('0x9b')],{'as':_0x844e('0x19f'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x198')});db['AnalyticMetric'][_0x844e('0x105')](db['AnalyticFieldReport'],{'as':_0x844e('0x19f'),'onDelete':_0x844e('0x102'),'foreignKey':'MetricId'});db[_0x844e('0x9b')]['belongsTo'](db[_0x844e('0x1a0')],{'foreignKey':_0x844e('0x1a1')});db[_0x844e('0x9e')][_0x844e('0x105')](db[_0x844e('0x9f')],{'as':_0x844e('0x1a2'),'onDelete':'cascade','foreignKey':_0x844e('0x1a3')});db[_0x844e('0x9f')][_0x844e('0x105')](db[_0x844e('0xa1')],{'as':_0x844e('0x1a4'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a5')});db[_0x844e('0x9f')][_0x844e('0x105')](db[_0x844e('0xa1')],{'as':_0x844e('0x1a6'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a7')});db[_0x844e('0x9f')][_0x844e('0x105')](db[_0x844e('0xa1')],{'as':_0x844e('0x19f'),'onDelete':_0x844e('0x102'),'foreignKey':'FieldId'});db[_0x844e('0x9f')][_0x844e('0x13f')](db[_0x844e('0x9e')],{'as':_0x844e('0x160'),'foreignKey':'AccountId'});db[_0x844e('0xa1')]['hasMany'](db[_0x844e('0xa1')],{'as':_0x844e('0x1a8'),'foreignKey':_0x844e('0x1a5')});db[_0x844e('0xa1')]['hasMany'](db[_0x844e('0xa1')],{'as':_0x844e('0x1a9'),'foreignKey':'DescriptionId'});db[_0x844e('0xa1')][_0x844e('0x105')](db[_0x844e('0xa1')],{'as':_0x844e('0x1aa'),'foreignKey':_0x844e('0x1ab')});db[_0x844e('0xa1')][_0x844e('0x13f')](db[_0x844e('0x90')],{'as':_0x844e('0x90'),'foreignKey':_0x844e('0x1ac')});db[_0x844e('0xa2')][_0x844e('0x105')](db['SugarcrmConfiguration'],{'as':_0x844e('0x1a2'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a3')});db[_0x844e('0xa4')][_0x844e('0x105')](db[_0x844e('0xa6')],{'as':_0x844e('0x1a4'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a5')});db['SugarcrmConfiguration']['hasMany'](db[_0x844e('0xa6')],{'as':_0x844e('0x1a6'),'onDelete':'cascade','foreignKey':_0x844e('0x1a7')});db[_0x844e('0xa4')]['hasMany'](db[_0x844e('0xa6')],{'as':'Fields','onDelete':_0x844e('0x102'),'foreignKey':'FieldId'});db['SugarcrmConfiguration']['belongsTo'](db['SugarcrmAccount'],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x1a3')});db[_0x844e('0xa6')][_0x844e('0x105')](db[_0x844e('0xa6')],{'as':_0x844e('0x1a8'),'foreignKey':'SubjectId'});db[_0x844e('0xa6')][_0x844e('0x105')](db[_0x844e('0xa6')],{'as':_0x844e('0x1a9'),'foreignKey':_0x844e('0x1a7')});db[_0x844e('0xa6')][_0x844e('0x105')](db[_0x844e('0xa6')],{'as':_0x844e('0x1aa'),'foreignKey':'FieldId'});db['SugarcrmField'][_0x844e('0x13f')](db[_0x844e('0x90')],{'as':_0x844e('0x90'),'foreignKey':_0x844e('0x1ac')});db[_0x844e('0x1ad')]['hasMany'](db[_0x844e('0x1ae')],{'as':_0x844e('0x1a2'),'onDelete':_0x844e('0x102'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0x844e('0x105')](db[_0x844e('0xa9')],{'as':_0x844e('0x1a4'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a5')});db[_0x844e('0x1ae')]['hasMany'](db['DeskField'],{'as':_0x844e('0x1a6'),'onDelete':_0x844e('0x102'),'foreignKey':'DescriptionId'});db[_0x844e('0x1ae')][_0x844e('0x105')](db[_0x844e('0xa9')],{'as':_0x844e('0x19f'),'onDelete':'cascade','foreignKey':_0x844e('0x1ab')});db[_0x844e('0x1ae')][_0x844e('0x13f')](db['DeskAccount'],{'as':_0x844e('0x160'),'foreignKey':'AccountId'});db[_0x844e('0x1ae')]['belongsToMany'](db['Tag'],{'through':_0x844e('0x1af')});db['DeskField'][_0x844e('0x105')](db[_0x844e('0xa9')],{'as':_0x844e('0x1a8'),'foreignKey':'SubjectId'});db[_0x844e('0xa9')][_0x844e('0x105')](db[_0x844e('0xa9')],{'as':_0x844e('0x1a9'),'foreignKey':_0x844e('0x1a7')});db['DeskField']['hasMany'](db[_0x844e('0xa9')],{'as':_0x844e('0x1aa'),'foreignKey':'FieldId'});db[_0x844e('0xa9')][_0x844e('0x13f')](db['Variable'],{'as':_0x844e('0x90'),'foreignKey':_0x844e('0x1ac')});db['ZohoAccount'][_0x844e('0x105')](db[_0x844e('0xad')],{'as':'Configurations','onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a3')});db[_0x844e('0xad')][_0x844e('0x105')](db[_0x844e('0xaf')],{'as':_0x844e('0x1a4'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a5')});db[_0x844e('0xad')]['hasMany'](db[_0x844e('0xaf')],{'as':_0x844e('0x1a6'),'onDelete':_0x844e('0x102'),'foreignKey':'DescriptionId'});db['ZohoConfiguration'][_0x844e('0x105')](db['ZohoField'],{'as':_0x844e('0x19f'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1ab')});db[_0x844e('0xad')][_0x844e('0x13f')](db[_0x844e('0xab')],{'as':'Account','foreignKey':_0x844e('0x1a3')});db['ZohoField'][_0x844e('0x105')](db[_0x844e('0xaf')],{'as':_0x844e('0x1a8'),'foreignKey':'SubjectId'});db['ZohoField']['hasMany'](db[_0x844e('0xaf')],{'as':'Description','foreignKey':_0x844e('0x1a7')});db[_0x844e('0xaf')]['hasMany'](db[_0x844e('0xaf')],{'as':'Field','foreignKey':'FieldId'});db['ZohoField'][_0x844e('0x13f')](db[_0x844e('0x90')],{'as':_0x844e('0x90'),'foreignKey':_0x844e('0x1ac')});db['ZendeskAccount'][_0x844e('0x105')](db[_0x844e('0xb2')],{'as':_0x844e('0x1a2'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a3')});db['ZendeskConfiguration']['hasMany'](db[_0x844e('0xb4')],{'as':'Subjects','foreignKey':_0x844e('0x1a5')});db['ZendeskConfiguration'][_0x844e('0x105')](db['ZendeskField'],{'as':_0x844e('0x1a6'),'foreignKey':_0x844e('0x1a7')});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':'Fields','foreignKey':_0x844e('0x1ab')});db[_0x844e('0xb2')][_0x844e('0x13f')](db['ZendeskAccount'],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x1a3')});db[_0x844e('0xb2')][_0x844e('0x110')](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x844e('0x105')](db['ZendeskField'],{'as':'Subject','foreignKey':_0x844e('0x1a5')});db[_0x844e('0xb4')][_0x844e('0x105')](db[_0x844e('0xb4')],{'as':'Description','foreignKey':_0x844e('0x1a7')});db[_0x844e('0xb4')][_0x844e('0x105')](db[_0x844e('0xb4')],{'as':_0x844e('0x1aa'),'foreignKey':_0x844e('0x1ab')});db[_0x844e('0xb4')][_0x844e('0x13f')](db['Variable'],{'as':'Variable','foreignKey':_0x844e('0x1ac')});db['FreshdeskAccount']['hasMany'](db[_0x844e('0x1b0')],{'as':_0x844e('0x1a2'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a3')});db[_0x844e('0x1b0')][_0x844e('0x105')](db[_0x844e('0xb9')],{'as':_0x844e('0x1a4'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a5')});db[_0x844e('0x1b0')]['hasMany'](db[_0x844e('0xb9')],{'as':_0x844e('0x1a6'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a7')});db[_0x844e('0x1b0')][_0x844e('0x105')](db[_0x844e('0xb9')],{'as':_0x844e('0x19f'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1ab')});db[_0x844e('0x1b0')]['belongsTo'](db['FreshdeskAccount'],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x1a3')});db[_0x844e('0x1b0')][_0x844e('0x110')](db[_0x844e('0x8d')],{'through':_0x844e('0x1b1')});db[_0x844e('0xb9')][_0x844e('0x105')](db[_0x844e('0xb9')],{'as':'Subject','foreignKey':_0x844e('0x1a5')});db[_0x844e('0xb9')]['hasMany'](db[_0x844e('0xb9')],{'as':'Description','foreignKey':_0x844e('0x1a7')});db[_0x844e('0xb9')][_0x844e('0x105')](db[_0x844e('0xb9')],{'as':_0x844e('0x1aa'),'foreignKey':_0x844e('0x1ab')});db[_0x844e('0xb9')][_0x844e('0x13f')](db[_0x844e('0x90')],{'as':_0x844e('0x90'),'foreignKey':_0x844e('0x1ac')});db[_0x844e('0x1b2')][_0x844e('0x105')](db[_0x844e('0x1b3')],{'as':'Configurations','onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a3')});db['VtigerConfiguration']['hasMany'](db['VtigerField'],{'as':_0x844e('0x1a4'),'foreignKey':_0x844e('0x1a5')});db[_0x844e('0x1b3')]['hasMany'](db['VtigerField'],{'as':_0x844e('0x1a6'),'foreignKey':_0x844e('0x1a7')});db['VtigerConfiguration']['hasMany'](db[_0x844e('0x1b4')],{'as':_0x844e('0x19f'),'foreignKey':'FieldId'});db[_0x844e('0x1b3')][_0x844e('0x13f')](db[_0x844e('0x1b2')],{'as':'Account','foreignKey':_0x844e('0x1a3')});db['VtigerField']['hasMany'](db['VtigerField'],{'as':'Subject','foreignKey':_0x844e('0x1a5')});db[_0x844e('0x1b4')][_0x844e('0x105')](db[_0x844e('0x1b4')],{'as':_0x844e('0x1a9'),'foreignKey':_0x844e('0x1a7')});db[_0x844e('0x1b4')][_0x844e('0x105')](db[_0x844e('0x1b4')],{'as':_0x844e('0x1aa'),'foreignKey':_0x844e('0x1ab')});db[_0x844e('0x1b4')][_0x844e('0x13f')](db[_0x844e('0x90')],{'as':_0x844e('0x90'),'foreignKey':_0x844e('0x1ac')});db[_0x844e('0xbe')][_0x844e('0x105')](db[_0x844e('0xc0')],{'as':_0x844e('0x1a2'),'onDelete':'cascade','foreignKey':_0x844e('0x1a3')});db[_0x844e('0xc0')][_0x844e('0x105')](db[_0x844e('0x1b5')],{'as':_0x844e('0x1a4'),'foreignKey':_0x844e('0x1a5')});db['ServicenowConfiguration'][_0x844e('0x105')](db[_0x844e('0x1b5')],{'as':'Descriptions','foreignKey':_0x844e('0x1a7')});db['ServicenowConfiguration'][_0x844e('0x105')](db[_0x844e('0x1b5')],{'as':_0x844e('0x19f'),'foreignKey':_0x844e('0x1ab')});db[_0x844e('0xc0')][_0x844e('0x13f')](db[_0x844e('0xbe')],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x1a3')});db[_0x844e('0x1b5')]['hasMany'](db[_0x844e('0x1b5')],{'as':_0x844e('0x1a8'),'foreignKey':'SubjectId'});db[_0x844e('0x1b5')]['hasMany'](db['ServicenowField'],{'as':'Description','foreignKey':_0x844e('0x1a7')});db[_0x844e('0x1b5')][_0x844e('0x105')](db[_0x844e('0x1b5')],{'as':_0x844e('0x1aa'),'foreignKey':_0x844e('0x1ab')});db[_0x844e('0x1b5')][_0x844e('0x13f')](db[_0x844e('0x90')],{'as':_0x844e('0x90'),'foreignKey':'VariableId'});db[_0x844e('0xc3')][_0x844e('0x105')](db['Dynamics365Configuration'],{'as':_0x844e('0x1a2'),'onDelete':'cascade','foreignKey':_0x844e('0x1a3')});db['Dynamics365Configuration'][_0x844e('0x105')](db[_0x844e('0xc7')],{'as':'Subjects','onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a5')});db[_0x844e('0xc5')][_0x844e('0x105')](db[_0x844e('0xc7')],{'as':_0x844e('0x1a6'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1a7')});db[_0x844e('0xc5')][_0x844e('0x105')](db[_0x844e('0xc7')],{'as':_0x844e('0x19f'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x844e('0xc5')]['belongsTo'](db['Dynamics365Account'],{'as':'Account','foreignKey':'AccountId'});db[_0x844e('0xc7')][_0x844e('0x105')](db[_0x844e('0xc7')],{'as':_0x844e('0x1a8'),'foreignKey':_0x844e('0x1a5')});db['Dynamics365Field']['hasMany'](db[_0x844e('0xc7')],{'as':_0x844e('0x1a9'),'foreignKey':_0x844e('0x1a7')});db[_0x844e('0xc7')][_0x844e('0x105')](db[_0x844e('0xc7')],{'as':_0x844e('0x1aa'),'foreignKey':'FieldId'});db[_0x844e('0xc7')][_0x844e('0x13f')](db['Variable'],{'as':_0x844e('0x90'),'foreignKey':_0x844e('0x1ac')});db[_0x844e('0xc8')][_0x844e('0x105')](db[_0x844e('0x1b6')],{'as':_0x844e('0x1a2'),'onDelete':'cascade','foreignKey':_0x844e('0x1a3')});db['FreshsalesConfiguration'][_0x844e('0x105')](db['FreshsalesField'],{'as':_0x844e('0x1a4'),'foreignKey':'SubjectId'});db[_0x844e('0x1b6')]['hasMany'](db[_0x844e('0xc9')],{'as':_0x844e('0x1a6'),'foreignKey':_0x844e('0x1a7')});db[_0x844e('0x1b6')]['hasMany'](db[_0x844e('0xc9')],{'as':_0x844e('0x19f'),'foreignKey':_0x844e('0x1ab')});db[_0x844e('0x1b6')]['belongsTo'](db[_0x844e('0xc8')],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x1a3')});db['FreshsalesField']['hasMany'](db[_0x844e('0xc9')],{'as':_0x844e('0x1a8'),'foreignKey':'SubjectId'});db[_0x844e('0xc9')][_0x844e('0x105')](db['FreshsalesField'],{'as':_0x844e('0x1a9'),'foreignKey':'DescriptionId'});db['FreshsalesField']['hasMany'](db[_0x844e('0xc9')],{'as':_0x844e('0x1aa'),'foreignKey':_0x844e('0x1ab')});db[_0x844e('0xc9')][_0x844e('0x13f')](db['Variable'],{'as':_0x844e('0x90'),'foreignKey':_0x844e('0x1ac')});db[_0x844e('0x1b7')]['belongsTo'](db['ChatWebsite'],{});db[_0x844e('0x1b7')][_0x844e('0x13f')](db[_0x844e('0x124')],{'as':'List','foreignKey':'ListId'});db[_0x844e('0x1b7')][_0x844e('0x13f')](db[_0x844e('0x75')],{'as':_0x844e('0x152'),'foreignKey':_0x844e('0x153')});db[_0x844e('0x1b7')]['belongsTo'](db[_0x844e('0x10c')],{});db[_0x844e('0x1b7')][_0x844e('0x13f')](db[_0x844e('0x6c')],{});db[_0x844e('0x1b7')][_0x844e('0x13f')](db[_0x844e('0x13')],{});db[_0x844e('0x1b7')]['belongsTo'](db[_0x844e('0x70')],{});db[_0x844e('0xce')]['belongsTo'](db['User'],{'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1b8')});db[_0x844e('0xce')][_0x844e('0x13f')](db[_0x844e('0x13')],{'onDelete':'cascade','foreignKey':_0x844e('0x1b9')});db['JscriptySessionReport'][_0x844e('0x105')](db[_0x844e('0x1ba')],{'foreignKey':_0x844e('0x1bb'),'onDelete':'cascade'});db[_0x844e('0xd2')]['hasMany'](db[_0x844e('0xcf')],{'foreignKey':_0x844e('0x1bb'),'onDelete':_0x844e('0x102')});db['SmsQueueReport'][_0x844e('0x13f')](db[_0x844e('0x54')],{});db[_0x844e('0xd4')]['belongsTo'](db[_0x844e('0x124')],{'as':'List','foreignKey':'ListId'});db[_0x844e('0xd4')][_0x844e('0x13f')](db[_0x844e('0x75')],{'as':_0x844e('0x152'),'foreignKey':_0x844e('0x153')});db['SmsQueueReport']['belongsTo'](db[_0x844e('0x58')],{});db[_0x844e('0xd4')][_0x844e('0x13f')](db[_0x844e('0x5a')],{});db[_0x844e('0xd4')]['belongsTo'](db['User'],{});db[_0x844e('0xd4')]['belongsTo'](db[_0x844e('0x11f')],{});db[_0x844e('0xd9')][_0x844e('0x105')](db[_0x844e('0xd2')],{'foreignKey':_0x844e('0x1bc')});db[_0x844e('0xd9')][_0x844e('0x105')](db[_0x844e('0x1ba')],{'foreignKey':_0x844e('0x1bc')});db[_0x844e('0xd9')][_0x844e('0x105')](db[_0x844e('0xcf')],{'foreignKey':_0x844e('0x1bc')});db['SquareProject']['belongsToMany'](db[_0x844e('0x13')],{'as':_0x844e('0x164'),'through':'user_has_square_projects'});db[_0x844e('0xe1')][_0x844e('0x110')](db[_0x844e('0x13')],{'as':'Agents','through':'user_has_teams'});db[_0x844e('0xe1')]['belongsToMany'](db[_0x844e('0x11a')],{'through':_0x844e('0x14b'),'as':_0x844e('0x11b')});db['Team'][_0x844e('0x110')](db[_0x844e('0x3f')],{'through':_0x844e('0x15e'),'as':_0x844e('0x1bd')});db[_0x844e('0xe1')][_0x844e('0x110')](db[_0x844e('0x70')],{'through':_0x844e('0x186'),'as':_0x844e('0x11c')});db[_0x844e('0xe1')][_0x844e('0x110')](db[_0x844e('0x51')],{'through':_0x844e('0x171'),'as':_0x844e('0x11d')});db[_0x844e('0xe1')]['belongsToMany'](db['SmsQueue'],{'through':_0x844e('0x178'),'as':_0x844e('0x120')});db[_0x844e('0xe1')][_0x844e('0x110')](db[_0x844e('0x63')],{'through':_0x844e('0x17f'),'as':'OpenchannelQueues'});db[_0x844e('0xe1')][_0x844e('0x110')](db[_0x844e('0x122')],{'through':'team_has_whatsapp_queues','as':'WhatsappQueues'});db[_0x844e('0xe4')][_0x844e('0x105')](db[_0x844e('0x76')],{'as':'Hoppers','foreignKey':_0x844e('0x18e')});db[_0x844e('0xe4')]['hasMany'](db[_0x844e('0x13c')],{'as':_0x844e('0x108'),'foreignKey':_0x844e('0x18e')});db[_0x844e('0xe4')][_0x844e('0x105')](db[_0x844e('0x7a')],{'as':_0x844e('0x13d'),'foreignKey':_0x844e('0x18e')});db[_0x844e('0xe4')][_0x844e('0x105')](db['CmHopperBlack'],{'as':_0x844e('0x1be'),'foreignKey':_0x844e('0x18e')});db['Campaign'][_0x844e('0x13f')](db[_0x844e('0x28')],{'as':_0x844e('0x28'),'foreignKey':_0x844e('0x140')});db[_0x844e('0xe4')]['belongsTo'](db['Trunk'],{'as':_0x844e('0x141'),'foreignKey':'TrunkBackupId'});db[_0x844e('0xe4')][_0x844e('0x13f')](db[_0x844e('0x143')],{'as':_0x844e('0x143'),'foreignKey':_0x844e('0x168')});db['Campaign'][_0x844e('0x13f')](db[_0x844e('0xdc')],{'as':_0x844e('0xdc'),'foreignKey':'SquareProjectId'});db[_0x844e('0xe4')]['belongsToMany'](db[_0x844e('0x124')],{'as':_0x844e('0x147'),'through':_0x844e('0x1bf')});db[_0x844e('0xe4')][_0x844e('0x110')](db[_0x844e('0x124')],{'as':_0x844e('0x1c0'),'through':_0x844e('0x1c1')});db[_0x844e('0xea')][_0x844e('0x13f')](db[_0x844e('0x43')],{});db[_0x844e('0xea')][_0x844e('0x13f')](db[_0x844e('0x41')],{});db[_0x844e('0xea')][_0x844e('0x13f')](db[_0x844e('0x3d')],{'foreignKey':_0x844e('0x1c2'),'as':_0x844e('0x1c3')});db[_0x844e('0xea')][_0x844e('0x13f')](db['User'],{'foreignKey':'FromUserId','as':_0x844e('0x1c4')});db[_0x844e('0xea')][_0x844e('0x13f')](db[_0x844e('0x13')],{'foreignKey':_0x844e('0x1c5'),'as':_0x844e('0x1c6')});db['MailTransferReport'][_0x844e('0x13f')](db[_0x844e('0x3f')],{'foreignKey':_0x844e('0x1c7'),'as':_0x844e('0x1c8')});db[_0x844e('0xea')][_0x844e('0x13f')](db[_0x844e('0x3d')],{'foreignKey':_0x844e('0x1c9'),'as':_0x844e('0x1ca')});db[_0x844e('0xec')]['belongsTo'](db[_0x844e('0x6c')],{});db[_0x844e('0xec')][_0x844e('0x13f')](db[_0x844e('0x10c')],{});db[_0x844e('0xec')][_0x844e('0x13f')](db[_0x844e('0x65')],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db['ChatTransferReport']['belongsTo'](db[_0x844e('0x13')],{'foreignKey':'FromUserId','as':_0x844e('0x1c4')});db['ChatTransferReport'][_0x844e('0x13f')](db['User'],{'foreignKey':_0x844e('0x1c5'),'as':'ToAgent'});db[_0x844e('0xec')][_0x844e('0x13f')](db[_0x844e('0x70')],{'foreignKey':_0x844e('0x1cb'),'as':'ToQueue'});db[_0x844e('0xec')][_0x844e('0x13f')](db[_0x844e('0x65')],{'foreignKey':_0x844e('0x1cc'),'as':'ToAccount'});db[_0x844e('0xed')][_0x844e('0x13f')](db['FaxMessage'],{});db[_0x844e('0xed')][_0x844e('0x13f')](db[_0x844e('0x4e')],{});db[_0x844e('0xed')][_0x844e('0x13f')](db['FaxAccount'],{'foreignKey':_0x844e('0x1cd'),'as':_0x844e('0x1c3')});db[_0x844e('0xed')][_0x844e('0x13f')](db[_0x844e('0x13')],{'foreignKey':'FromUserId','as':_0x844e('0x1c4')});db[_0x844e('0xed')]['belongsTo'](db[_0x844e('0x13')],{'foreignKey':_0x844e('0x1c5'),'as':_0x844e('0x1c6')});db[_0x844e('0xed')][_0x844e('0x13f')](db[_0x844e('0x51')],{'foreignKey':_0x844e('0x1ce'),'as':_0x844e('0x1c8')});db[_0x844e('0xed')][_0x844e('0x13f')](db[_0x844e('0x128')],{'foreignKey':_0x844e('0x1cf'),'as':_0x844e('0x1ca')});db[_0x844e('0xee')][_0x844e('0x13f')](db[_0x844e('0x61')],{});db[_0x844e('0xee')][_0x844e('0x13f')](db[_0x844e('0x10a')],{});db[_0x844e('0xee')]['belongsTo'](db[_0x844e('0x12c')],{'foreignKey':'FromOpenchannelAccountId','as':_0x844e('0x1c3')});db[_0x844e('0xee')][_0x844e('0x13f')](db[_0x844e('0x13')],{'foreignKey':_0x844e('0x1d0'),'as':_0x844e('0x1c4')});db[_0x844e('0xee')][_0x844e('0x13f')](db[_0x844e('0x13')],{'foreignKey':_0x844e('0x1c5'),'as':'ToAgent'});db['OpenchannelTransferReport'][_0x844e('0x13f')](db['OpenchannelQueue'],{'foreignKey':_0x844e('0x1d1'),'as':'ToQueue'});db[_0x844e('0xee')][_0x844e('0x13f')](db[_0x844e('0x12c')],{'foreignKey':_0x844e('0x1d2'),'as':_0x844e('0x1ca')});db[_0x844e('0xf0')][_0x844e('0x13f')](db['SmsMessage'],{});db['SmsTransferReport'][_0x844e('0x13f')](db[_0x844e('0x58')],{});db[_0x844e('0xf0')][_0x844e('0x13f')](db[_0x844e('0x54')],{'foreignKey':_0x844e('0x1d3'),'as':'FromAccount'});db[_0x844e('0xf0')][_0x844e('0x13f')](db[_0x844e('0x13')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x844e('0xf0')]['belongsTo'](db[_0x844e('0x13')],{'foreignKey':_0x844e('0x1c5'),'as':'ToAgent'});db[_0x844e('0xf0')]['belongsTo'](db[_0x844e('0x11f')],{'foreignKey':_0x844e('0x1d4'),'as':'ToQueue'});db[_0x844e('0xf0')][_0x844e('0x13f')](db[_0x844e('0x54')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0x844e('0x124')][_0x844e('0x105')](db['Disposition'],{'as':_0x844e('0x157'),'foreignKey':_0x844e('0x15b')});db[_0x844e('0x124')][_0x844e('0x105')](db[_0x844e('0x7e')],{'as':_0x844e('0x1d5'),'foreignKey':_0x844e('0x15b')});db['CmList'][_0x844e('0x105')](db[_0x844e('0x75')],{'as':'Contacts','onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x15b')});db['CmList'][_0x844e('0x105')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x844e('0x15b')});db[_0x844e('0x124')][_0x844e('0x105')](db[_0x844e('0x7a')],{'as':_0x844e('0x109'),'foreignKey':_0x844e('0x15b')});db[_0x844e('0x124')][_0x844e('0x105')](db[_0x844e('0x7c')],{'as':_0x844e('0x7c'),'foreignKey':_0x844e('0x15b')});db['CmList']['belongsToMany'](db[_0x844e('0x11a')],{'as':_0x844e('0x1d6'),'through':_0x844e('0x148')});db[_0x844e('0x124')]['belongsToMany'](db['User'],{'as':_0x844e('0x149'),'through':'cm_user_has_lists'});db[_0x844e('0xf2')][_0x844e('0x105')](db[_0x844e('0x18')],{'as':'Extensions','onDelete':_0x844e('0x102')});db['VoicePrefix'][_0x844e('0x110')](db['User'],{'as':_0x844e('0x149'),'through':'user_has_voice_prefixes'});db[_0x844e('0xf3')][_0x844e('0x105')](db[_0x844e('0x13')],{'as':_0x844e('0x164'),'foreignKey':_0x844e('0x1d7')});db[_0x844e('0xf3')][_0x844e('0x105')](db[_0x844e('0xf5')],{'as':_0x844e('0x1d8'),'foreignKey':'userProfileId','onDelete':_0x844e('0x102')});db['UserProfileSection'][_0x844e('0x105')](db[_0x844e('0xf6')],{'as':_0x844e('0x1d9'),'foreignKey':'sectionId','onDelete':_0x844e('0x102')});db[_0x844e('0x130')][_0x844e('0x105')](db['Disposition'],{'as':_0x844e('0x157'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x844e('0x105')](db[_0x844e('0x83')],{'as':_0x844e('0x180'),'foreignKey':_0x844e('0x1da')});db[_0x844e('0x130')][_0x844e('0x105')](db[_0x844e('0xfc')],{'as':_0x844e('0x14d'),'foreignKey':_0x844e('0x1da')});db['WhatsappAccount'][_0x844e('0x105')](db['WhatsappInteraction'],{'as':_0x844e('0x16b')});db[_0x844e('0x130')][_0x844e('0x105')](db[_0x844e('0xf8')],{'as':_0x844e('0x159')});db['WhatsappAccount'][_0x844e('0x13f')](db[_0x844e('0x124')],{'as':_0x844e('0x15a'),'foreignKey':'ListId'});db[_0x844e('0x130')][_0x844e('0x13f')](db[_0x844e('0x144')],{'as':_0x844e('0x145'),'foreignKey':_0x844e('0x146')});db['WhatsappAccount'][_0x844e('0x110')](db[_0x844e('0x13')],{'as':_0x844e('0x149'),'through':_0x844e('0x132')});db[_0x844e('0xf8')][_0x844e('0x13f')](db['User'],{'onDelete':_0x844e('0x167')});db[_0x844e('0xf8')][_0x844e('0x13f')](db[_0x844e('0x122')],{'onDelete':_0x844e('0x167')});db[_0x844e('0xf8')]['belongsTo'](db[_0x844e('0x130')],{'onDelete':_0x844e('0x167')});db[_0x844e('0xf8')][_0x844e('0x13f')](db['Interval'],{'onDelete':_0x844e('0x167'),'foreignKey':_0x844e('0x168')});db[_0x844e('0xf8')][_0x844e('0x13f')](db[_0x844e('0x8d')],{'onDelete':_0x844e('0x167'),'foreignKey':_0x844e('0x174')});db[_0x844e('0xfa')]['hasMany'](db[_0x844e('0xfc')],{'as':_0x844e('0x14d'),'onDelete':_0x844e('0x102'),'foreignKey':_0x844e('0x1db')});db[_0x844e('0xfa')][_0x844e('0x13f')](db[_0x844e('0x130')],{'as':_0x844e('0x160'),'foreignKey':_0x844e('0x1da')});db[_0x844e('0xfa')]['belongsTo'](db[_0x844e('0x75')],{'as':_0x844e('0x152'),'foreignKey':_0x844e('0x153')});db['WhatsappInteraction']['belongsTo'](db[_0x844e('0x13')],{'as':'Owner','foreignKey':_0x844e('0x103')});db[_0x844e('0xfa')]['belongsToMany'](db[_0x844e('0x8d')],{'through':_0x844e('0x1dc'),'as':_0x844e('0x163')});db[_0x844e('0xfa')][_0x844e('0x110')](db[_0x844e('0x8d')],{'through':_0x844e('0x1dc'),'as':_0x844e('0x17d')});db[_0x844e('0xfa')]['belongsToMany'](db[_0x844e('0x13')],{'as':_0x844e('0x164'),'through':_0x844e('0x1dd'),'foreignKey':_0x844e('0x1db')});db[_0x844e('0xfc')]['belongsTo'](db[_0x844e('0x13')],{'as':'User'});db[_0x844e('0xfc')]['belongsTo'](db[_0x844e('0x75')],{'onDelete':_0x844e('0x102'),'as':_0x844e('0x152')});db['WhatsappMessage'][_0x844e('0x13f')](db[_0x844e('0xfa')],{'onDelete':_0x844e('0x102'),'as':_0x844e('0x166'),'foreignKey':'WhatsappInteractionId'});db[_0x844e('0xfc')][_0x844e('0x13f')](db[_0x844e('0x130')],{'as':'Account','foreignKey':_0x844e('0x1da')});db[_0x844e('0xfd')]['belongsTo'](db[_0x844e('0x130')],{});db[_0x844e('0xfd')][_0x844e('0x13f')](db[_0x844e('0x124')],{'as':_0x844e('0x15a'),'foreignKey':_0x844e('0x15b')});db[_0x844e('0xfd')]['belongsTo'](db[_0x844e('0x75')],{'as':'Contact','foreignKey':_0x844e('0x153')});db[_0x844e('0xfd')][_0x844e('0x13f')](db[_0x844e('0xfa')],{});db[_0x844e('0xfd')][_0x844e('0x13f')](db[_0x844e('0x122')],{});db['WhatsappQueueReport'][_0x844e('0x13f')](db[_0x844e('0xfc')],{});db[_0x844e('0xfd')]['belongsTo'](db['User'],{});db[_0x844e('0x1de')][_0x844e('0x13f')](db['WhatsappMessage'],{});db[_0x844e('0x1de')][_0x844e('0x13f')](db[_0x844e('0xfa')],{});db['WhatsappTransferReport'][_0x844e('0x13f')](db[_0x844e('0x130')],{'foreignKey':_0x844e('0x1df'),'as':_0x844e('0x1c3')});db[_0x844e('0x1de')][_0x844e('0x13f')](db[_0x844e('0x130')],{'foreignKey':'ToWhatsappAccountId','as':'ToAccount'});db['WhatsappTransferReport']['belongsTo'](db[_0x844e('0x122')],{'foreignKey':_0x844e('0x1e0'),'as':_0x844e('0x1c8')});db[_0x844e('0x1de')]['belongsTo'](db[_0x844e('0x13')],{'foreignKey':'FromUserId','as':_0x844e('0x1c4')});db[_0x844e('0x1de')][_0x844e('0x13f')](db[_0x844e('0x13')],{'foreignKey':'ToUserId','as':_0x844e('0x1c6')});db[_0x844e('0x122')]['belongsToMany'](db[_0x844e('0x13')],{'as':_0x844e('0x149'),'through':'UserWhatsappQueue','foreignKey':_0x844e('0x1e1')});db[_0x844e('0x122')]['belongsToMany'](db[_0x844e('0xe1')],{'through':_0x844e('0x1e2'),'as':_0x844e('0x14a')});module[_0x844e('0x1e3')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 2261be7..415bf1b 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x010f=['/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','/api/license','/api/campaigns','/api/migrations','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','./api/notification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/cloudProviders','/api/auth/local','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','static','join','root','/apidoc','/www','/demo','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','express-winston','util','./errors','./config/environment','./config/logger','api','auth','default','use','logger','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','user','name','role','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','responseTime','other','agent_name','test','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/queues','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','./api/cmCustomField','./api/action','/api/automations','/api/canned_answers','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/sound','./api/tag','/api/templates','./api/template','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport'];(function(_0x26d126,_0xb142de){var _0x476747=function(_0x25e7cf){while(--_0x25e7cf){_0x26d126['push'](_0x26d126['shift']());}};_0x476747(++_0xb142de);}(_0x010f,0x19c));var _0xf010=function(_0x3e1c68,_0x495527){_0x3e1c68=_0x3e1c68-0x0;var _0x45fa51=_0x010f[_0x3e1c68];return _0x45fa51;};'use strict';var path=require(_0xf010('0x0'));var express=require(_0xf010('0x1'));var ewinston=require(_0xf010('0x2'));var util=require(_0xf010('0x3'));var errors=require(_0xf010('0x4'));var config=require(_0xf010('0x5'));var logger=require(_0xf010('0x6'))(_0xf010('0x7'));var authLogger=require(_0xf010('0x6'))(_0xf010('0x8'));exports[_0xf010('0x9')]=function(_0x4af090){_0x4af090[_0xf010('0xa')](ewinston[_0xf010('0xb')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x1305fa,_0xd2395a){return util[_0xf010('0xc')]('%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s',_0x1305fa[_0xf010('0xd')],_0x1305fa[_0xf010('0xe')]['x-forwarded-for']?_0x1305fa[_0xf010('0xe')][_0xf010('0xf')]:_0x1305fa[_0xf010('0x10')][_0xf010('0x11')]||_0x1305fa['ip'],_0x1305fa[_0xf010('0x12')],_0xd2395a[_0xf010('0x13')],_0xd2395a['responseTime'],_0x1305fa[_0xf010('0x14')]?_0x1305fa['user']['id']:null,_0x1305fa['user']?_0x1305fa[_0xf010('0x14')][_0xf010('0x15')]:null,_0x1305fa[_0xf010('0x14')]?_0x1305fa[_0xf010('0x14')][_0xf010('0x16')]:null);}}));_0x4af090[_0xf010('0xa')](ewinston[_0xf010('0xb')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0xcb4964,_0x375de6){var _0x2982b4='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0xcb4964['body']&&_0xcb4964[_0xf010('0x17')][_0xf010('0x18')]&&_0xcb4964[_0xf010('0x17')][_0xf010('0x19')]){_0x2982b4=_0xf010('0x1a');}return util[_0xf010('0xc')](_0x2982b4,_0xcb4964[_0xf010('0xd')],_0xcb4964[_0xf010('0xe')][_0xf010('0xf')]?_0xcb4964[_0xf010('0xe')]['x-forwarded-for']:_0xcb4964[_0xf010('0x10')]['remoteAddress']||_0xcb4964['ip'],_0xcb4964[_0xf010('0x12')],_0x375de6[_0xf010('0x13')],_0x375de6[_0xf010('0x1b')],_0xcb4964[_0xf010('0x14')]?_0xcb4964[_0xf010('0x14')]['id']:null,_0xcb4964['user']?_0xcb4964[_0xf010('0x14')][_0xf010('0x15')]:null,_0xcb4964['user']?_0xcb4964[_0xf010('0x14')]['role']:null,_0xcb4964['body']&&_0xcb4964['body']['device']?_0xcb4964[_0xf010('0x17')][_0xf010('0x18')]:_0xf010('0x1c'),_0xcb4964[_0xf010('0x17')]&&_0xcb4964[_0xf010('0x17')][_0xf010('0x19')]?_0xcb4964['body'][_0xf010('0x19')]:'',_0xcb4964[_0xf010('0x17')]&&_0xcb4964['body'][_0xf010('0x1d')]?_0xcb4964[_0xf010('0x17')]['agent_name']:'');},'ignoreRoute':function(_0x142885){var _0x2042c0=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2042c0[_0xf010('0x1e')](_0x142885[_0xf010('0x12')]);}}));_0x4af090[_0xf010('0xa')]('/api/users',require('./api/user'));_0x4af090[_0xf010('0xa')](_0xf010('0x1f'),require(_0xf010('0x20')));_0x4af090[_0xf010('0xa')](_0xf010('0x21'),require(_0xf010('0x22')));_0x4af090[_0xf010('0xa')]('/api/voice/extensions',require('./api/voiceExtension'));_0x4af090[_0xf010('0xa')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x4af090[_0xf010('0xa')](_0xf010('0x23'),require('./api/voiceQueue'));_0x4af090[_0xf010('0xa')](_0xf010('0x24'),require('./api/voiceRecording'));_0x4af090[_0xf010('0xa')](_0xf010('0x25'),require(_0xf010('0x26')));_0x4af090[_0xf010('0xa')](_0xf010('0x27'),require(_0xf010('0x28')));_0x4af090[_0xf010('0xa')](_0xf010('0x29'),require('./api/voiceMailMessage'));_0x4af090[_0xf010('0xa')](_0xf010('0x2a'),require(_0xf010('0x2b')));_0x4af090[_0xf010('0xa')]('/api/voice/dials/reports',require(_0xf010('0x2c')));_0x4af090[_0xf010('0xa')](_0xf010('0x2d'),require(_0xf010('0x2e')));_0x4af090[_0xf010('0xa')](_0xf010('0x2f'),require(_0xf010('0x30')));_0x4af090[_0xf010('0xa')](_0xf010('0x31'),require(_0xf010('0x32')));_0x4af090[_0xf010('0xa')](_0xf010('0x33'),require(_0xf010('0x34')));_0x4af090[_0xf010('0xa')]('/api/voice/transfers/reports',require(_0xf010('0x35')));_0x4af090[_0xf010('0xa')](_0xf010('0x36'),require(_0xf010('0x37')));_0x4af090['use'](_0xf010('0x38'),require(_0xf010('0x39')));_0x4af090[_0xf010('0xa')](_0xf010('0x3a'),require(_0xf010('0x3b')));_0x4af090['use'](_0xf010('0x3c'),require(_0xf010('0x3d')));_0x4af090[_0xf010('0xa')](_0xf010('0x3e'),require('./api/mailInteraction'));_0x4af090['use'](_0xf010('0x3f'),require(_0xf010('0x40')));_0x4af090['use'](_0xf010('0x41'),require(_0xf010('0x42')));_0x4af090[_0xf010('0xa')](_0xf010('0x43'),require(_0xf010('0x44')));_0x4af090[_0xf010('0xa')](_0xf010('0x45'),require('./api/dashboard'));_0x4af090[_0xf010('0xa')](_0xf010('0x46'),require('./api/dashboardItem'));_0x4af090[_0xf010('0xa')](_0xf010('0x47'),require('./api/faxAccount'));_0x4af090[_0xf010('0xa')](_0xf010('0x48'),require(_0xf010('0x49')));_0x4af090['use'](_0xf010('0x4a'),require(_0xf010('0x4b')));_0x4af090[_0xf010('0xa')](_0xf010('0x4c'),require(_0xf010('0x4d')));_0x4af090[_0xf010('0xa')]('/api/fax/queues',require(_0xf010('0x4e')));_0x4af090[_0xf010('0xa')](_0xf010('0x4f'),require(_0xf010('0x50')));_0x4af090[_0xf010('0xa')](_0xf010('0x51'),require(_0xf010('0x52')));_0x4af090[_0xf010('0xa')](_0xf010('0x53'),require('./api/smsApplication'));_0x4af090[_0xf010('0xa')](_0xf010('0x54'),require(_0xf010('0x55')));_0x4af090['use']('/api/sms/messages',require('./api/smsMessage'));_0x4af090[_0xf010('0xa')](_0xf010('0x56'),require(_0xf010('0x57')));_0x4af090[_0xf010('0xa')]('/api/openchannel/accounts',require(_0xf010('0x58')));_0x4af090[_0xf010('0xa')](_0xf010('0x59'),require(_0xf010('0x5a')));_0x4af090[_0xf010('0xa')](_0xf010('0x5b'),require(_0xf010('0x5c')));_0x4af090[_0xf010('0xa')]('/api/openchannel/messages',require('./api/openchannelMessage'));_0x4af090[_0xf010('0xa')](_0xf010('0x5d'),require(_0xf010('0x5e')));_0x4af090[_0xf010('0xa')]('/api/chat/websites',require(_0xf010('0x5f')));_0x4af090['use'](_0xf010('0x60'),require(_0xf010('0x61')));_0x4af090[_0xf010('0xa')]('/api/chat/applications',require(_0xf010('0x62')));_0x4af090['use'](_0xf010('0x63'),require(_0xf010('0x64')));_0x4af090[_0xf010('0xa')](_0xf010('0x65'),require(_0xf010('0x66')));_0x4af090[_0xf010('0xa')](_0xf010('0x67'),require('./api/chatOfflineMessage'));_0x4af090[_0xf010('0xa')]('/api/chat/queues',require(_0xf010('0x68')));_0x4af090[_0xf010('0xa')](_0xf010('0x69'),require('./api/chatGroup'));_0x4af090[_0xf010('0xa')](_0xf010('0x6a'),require(_0xf010('0x6b')));_0x4af090['use'](_0xf010('0x6c'),require(_0xf010('0x6d')));_0x4af090[_0xf010('0xa')](_0xf010('0x6e'),require('./api/cmContact'));_0x4af090['use'](_0xf010('0x6f'),require(_0xf010('0x70')));_0x4af090[_0xf010('0xa')]('/api/cm/hopper_black',require(_0xf010('0x71')));_0x4af090[_0xf010('0xa')](_0xf010('0x72'),require(_0xf010('0x73')));_0x4af090[_0xf010('0xa')]('/api/cm/hopper_history',require(_0xf010('0x74')));_0x4af090[_0xf010('0xa')]('/api/cm/custom_fields',require(_0xf010('0x75')));_0x4af090[_0xf010('0xa')]('/api/actions',require(_0xf010('0x76')));_0x4af090[_0xf010('0xa')](_0xf010('0x77'),require('./api/automation'));_0x4af090['use'](_0xf010('0x78'),require('./api/cannedAnswer'));_0x4af090[_0xf010('0xa')]('/api/dispositions',require('./api/disposition'));_0x4af090['use']('/api/conditions',require('./api/condition'));_0x4af090[_0xf010('0xa')](_0xf010('0x79'),require(_0xf010('0x7a')));_0x4af090[_0xf010('0xa')](_0xf010('0x7b'),require(_0xf010('0x7c')));_0x4af090[_0xf010('0xa')](_0xf010('0x7d'),require(_0xf010('0x7e')));_0x4af090[_0xf010('0xa')](_0xf010('0x7f'),require(_0xf010('0x80')));_0x4af090['use']('/api/schedules',require('./api/schedule'));_0x4af090[_0xf010('0xa')]('/api/sounds',require(_0xf010('0x81')));_0x4af090[_0xf010('0xa')]('/api/tags',require(_0xf010('0x82')));_0x4af090[_0xf010('0xa')](_0xf010('0x83'),require(_0xf010('0x84')));_0x4af090['use']('/api/triggers',require('./api/trigger'));_0x4af090[_0xf010('0xa')](_0xf010('0x85'),require(_0xf010('0x86')));_0x4af090[_0xf010('0xa')](_0xf010('0x87'),require(_0xf010('0x88')));_0x4af090[_0xf010('0xa')](_0xf010('0x89'),require(_0xf010('0x8a')));_0x4af090[_0xf010('0xa')](_0xf010('0x8b'),require(_0xf010('0x8c')));_0x4af090['use'](_0xf010('0x8d'),require(_0xf010('0x8e')));_0x4af090['use']('/api/analytics/extracted_reports',require(_0xf010('0x8f')));_0x4af090[_0xf010('0xa')](_0xf010('0x90'),require(_0xf010('0x91')));_0x4af090[_0xf010('0xa')]('/api/analytics/field_reports',require(_0xf010('0x92')));_0x4af090[_0xf010('0xa')](_0xf010('0x93'),require(_0xf010('0x94')));_0x4af090[_0xf010('0xa')](_0xf010('0x95'),require('./api/intSalesforceAccount'));_0x4af090[_0xf010('0xa')](_0xf010('0x96'),require(_0xf010('0x97')));_0x4af090[_0xf010('0xa')](_0xf010('0x98'),require(_0xf010('0x99')));_0x4af090[_0xf010('0xa')](_0xf010('0x9a'),require(_0xf010('0x9b')));_0x4af090['use'](_0xf010('0x9c'),require(_0xf010('0x9d')));_0x4af090['use']('/api/integrations/sugarcrm/fields',require(_0xf010('0x9e')));_0x4af090[_0xf010('0xa')](_0xf010('0x9f'),require(_0xf010('0xa0')));_0x4af090[_0xf010('0xa')]('/api/integrations/desk/configurations',require(_0xf010('0xa1')));_0x4af090[_0xf010('0xa')](_0xf010('0xa2'),require(_0xf010('0xa3')));_0x4af090['use'](_0xf010('0xa4'),require(_0xf010('0xa5')));_0x4af090[_0xf010('0xa')](_0xf010('0xa6'),require(_0xf010('0xa7')));_0x4af090[_0xf010('0xa')](_0xf010('0xa8'),require(_0xf010('0xa9')));_0x4af090[_0xf010('0xa')](_0xf010('0xaa'),require(_0xf010('0xab')));_0x4af090[_0xf010('0xa')](_0xf010('0xac'),require(_0xf010('0xad')));_0x4af090[_0xf010('0xa')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x4af090[_0xf010('0xa')]('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x4af090[_0xf010('0xa')](_0xf010('0xae'),require('./api/intFreshdeskConfiguration'));_0x4af090['use'](_0xf010('0xaf'),require(_0xf010('0xb0')));_0x4af090[_0xf010('0xa')]('/api/integrations/vtiger/accounts',require(_0xf010('0xb1')));_0x4af090[_0xf010('0xa')](_0xf010('0xb2'),require(_0xf010('0xb3')));_0x4af090['use'](_0xf010('0xb4'),require('./api/intVtigerField'));_0x4af090[_0xf010('0xa')]('/api/integrations/servicenow/accounts',require('./api/intServicenowAccount'));_0x4af090[_0xf010('0xa')](_0xf010('0xb5'),require(_0xf010('0xb6')));_0x4af090['use'](_0xf010('0xb7'),require(_0xf010('0xb8')));_0x4af090[_0xf010('0xa')](_0xf010('0xb9'),require(_0xf010('0xba')));_0x4af090[_0xf010('0xa')]('/api/integrations/dynamics365/configurations',require(_0xf010('0xbb')));_0x4af090['use'](_0xf010('0xbc'),require(_0xf010('0xbd')));_0x4af090[_0xf010('0xa')]('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x4af090[_0xf010('0xa')](_0xf010('0xbe'),require(_0xf010('0xbf')));_0x4af090['use'](_0xf010('0xc0'),require(_0xf010('0xc1')));_0x4af090['use'](_0xf010('0xc2'),require(_0xf010('0xc3')));_0x4af090['use']('/api/chat/reports/queue',require(_0xf010('0xc4')));_0x4af090['use'](_0xf010('0xc5'),require(_0xf010('0xc6')));_0x4af090['use'](_0xf010('0xc7'),require(_0xf010('0xc8')));_0x4af090[_0xf010('0xa')](_0xf010('0xc9'),require(_0xf010('0xca')));_0x4af090[_0xf010('0xa')]('/api/jscripty/sessions/reports',require(_0xf010('0xcb')));_0x4af090[_0xf010('0xa')](_0xf010('0xcc'),require(_0xf010('0xcd')));_0x4af090[_0xf010('0xa')](_0xf010('0xce'),require(_0xf010('0xcf')));_0x4af090[_0xf010('0xa')]('/api/square/details/reports',require(_0xf010('0xd0')));_0x4af090[_0xf010('0xa')](_0xf010('0xd1'),require(_0xf010('0xd2')));_0x4af090[_0xf010('0xa')]('/api/settings',require(_0xf010('0xd3')));_0x4af090[_0xf010('0xa')]('/api/square/odbc',require(_0xf010('0xd4')));_0x4af090[_0xf010('0xa')](_0xf010('0xd5'),require(_0xf010('0xd6')));_0x4af090['use'](_0xf010('0xd7'),require('./api/squareRecording'));_0x4af090[_0xf010('0xa')](_0xf010('0xd8'),require('./api/squareMessage'));_0x4af090[_0xf010('0xa')]('/api/teams',require('./api/team'));_0x4af090[_0xf010('0xa')](_0xf010('0xd9'),require('./api/license'));_0x4af090[_0xf010('0xa')](_0xf010('0xda'),require('./api/campaign'));_0x4af090['use'](_0xf010('0xdb'),require('./api/migration'));_0x4af090['use'](_0xf010('0xdc'),require(_0xf010('0xdd')));_0x4af090[_0xf010('0xa')]('/api/plugins',require(_0xf010('0xde')));_0x4af090['use'](_0xf010('0xdf'),require(_0xf010('0xe0')));_0x4af090[_0xf010('0xa')]('/api/chat/reports/transfer',require(_0xf010('0xe1')));_0x4af090[_0xf010('0xa')](_0xf010('0xe2'),require(_0xf010('0xe3')));_0x4af090[_0xf010('0xa')](_0xf010('0xe4'),require('./api/openchannelTransferReport'));_0x4af090[_0xf010('0xa')]('/api/sms/reports/transfer',require(_0xf010('0xe5')));_0x4af090['use']('/api/cm/lists',require(_0xf010('0xe6')));_0x4af090[_0xf010('0xa')](_0xf010('0xe7'),require(_0xf010('0xe8')));_0x4af090[_0xf010('0xa')](_0xf010('0xe9'),require('./api/userProfile'));_0x4af090[_0xf010('0xa')](_0xf010('0xea'),require(_0xf010('0xeb')));_0x4af090[_0xf010('0xa')]('/api/userProfile/resources',require(_0xf010('0xec')));_0x4af090['use']('/api/notifications',require(_0xf010('0xed')));_0x4af090[_0xf010('0xa')](_0xf010('0xee'),require(_0xf010('0xef')));_0x4af090[_0xf010('0xa')](_0xf010('0xf0'),require(_0xf010('0xf1')));_0x4af090['use'](_0xf010('0xf2'),require('./api/whatsappInteraction'));_0x4af090[_0xf010('0xa')](_0xf010('0xf3'),require('./api/whatsappMessage'));_0x4af090[_0xf010('0xa')](_0xf010('0xf4'),require(_0xf010('0xf5')));_0x4af090['use'](_0xf010('0xf6'),require(_0xf010('0xf7')));_0x4af090[_0xf010('0xa')]('/api/whatsapp/queues',require('./api/whatsappQueue'));_0x4af090[_0xf010('0xa')](_0xf010('0xf8'),require('./api/cloudProvider'));_0x4af090[_0xf010('0xa')](_0xf010('0xf9'),require('./api/authLocal'));_0x4af090['use'](_0xf010('0xfa'),require(_0xf010('0xfb')));_0x4af090[_0xf010('0xa')](_0xf010('0xfc'),require(_0xf010('0xfd')));_0x4af090[_0xf010('0xa')](_0xf010('0xfe'),require(_0xf010('0xff')));_0x4af090[_0xf010('0xa')](_0xf010('0x100'),require('./api/version'));_0x4af090[_0xf010('0xa')](_0xf010('0x101'),require(_0xf010('0x102')));_0x4af090[_0xf010('0xa')]('/api/pm2',require(_0xf010('0x103')));_0x4af090[_0xf010('0xa')](_0xf010('0x104'),require(_0xf010('0x105')));_0x4af090[_0xf010('0xa')]('/apidoc',express[_0xf010('0x106')](path[_0xf010('0x107')](config[_0xf010('0x108')],_0xf010('0x109'))));_0x4af090[_0xf010('0xa')](_0xf010('0x10a'),express[_0xf010('0x106')](path['join'](config[_0xf010('0x108')],_0xf010('0x10a'))));_0x4af090[_0xf010('0xa')](_0xf010('0x10b'),express['static'](path[_0xf010('0x107')](config[_0xf010('0x108')],_0xf010('0x10b'))));_0x4af090[_0xf010('0xa')]('/snippet',express[_0xf010('0x106')](path['join'](config['root'],'snippet',_0xf010('0x10c'))));_0x4af090['use'](_0xf010('0x10d'),express[_0xf010('0x106')](path[_0xf010('0x107')](config[_0xf010('0x108')],_0xf010('0x10e'))));_0x4af090[_0xf010('0x10f')](_0xf010('0x110'))[_0xf010('0x111')](errors[0x194]);_0x4af090[_0xf010('0x10f')]('/*')[_0xf010('0x111')](function(_0x492fde,_0x15bbb6){_0x15bbb6[_0xf010('0x112')](path[_0xf010('0x113')](_0x4af090['get'](_0xf010('0x114'))+_0xf010('0x115')));});}; \ No newline at end of file +var _0x9511=['api','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','use','/api/voice/contexts','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/applications','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxMessage','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/messages','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/fields','./api/intDynamics365Account','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/userProfile','./api/userProfileSection','./api/userProfileResource','/api/notifications','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','./api/rpc','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','/apidoc','join','root','/www','static','/demo','/snippet','snippet','1.0.16','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','appPath','/index.html','path','express-winston','util','./errors','./config/environment'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x9511,0x10c));var _0x1951=function(_0xc31458,_0x45ee76){_0xc31458=_0xc31458-0x0;var _0x1b4a90=_0x9511[_0xc31458];return _0x1b4a90;};'use strict';var path=require(_0x1951('0x0'));var express=require('express');var ewinston=require(_0x1951('0x1'));var util=require(_0x1951('0x2'));var errors=require(_0x1951('0x3'));var config=require(_0x1951('0x4'));var logger=require('./config/logger')(_0x1951('0x5'));var authLogger=require('./config/logger')('auth');exports['default']=function(_0x1759bc){_0x1759bc['use'](ewinston[_0x1951('0x6')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0xed37fd,_0x22cff3){return util[_0x1951('0x7')](_0x1951('0x8'),_0xed37fd[_0x1951('0x9')],_0xed37fd[_0x1951('0xa')][_0x1951('0xb')]?_0xed37fd[_0x1951('0xa')]['x-forwarded-for']:_0xed37fd[_0x1951('0xc')][_0x1951('0xd')]||_0xed37fd['ip'],_0xed37fd[_0x1951('0xe')],_0x22cff3[_0x1951('0xf')],_0x22cff3['responseTime'],_0xed37fd[_0x1951('0x10')]?_0xed37fd['user']['id']:null,_0xed37fd['user']?_0xed37fd['user'][_0x1951('0x11')]:null,_0xed37fd['user']?_0xed37fd[_0x1951('0x10')][_0x1951('0x12')]:null);}}));_0x1759bc['use'](ewinston[_0x1951('0x6')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x9f33c4,_0x5dcf38){var _0x36391d=_0x1951('0x13');if(_0x9f33c4[_0x1951('0x14')]&&_0x9f33c4['body'][_0x1951('0x15')]&&_0x9f33c4[_0x1951('0x14')][_0x1951('0x16')]){_0x36391d=_0x1951('0x17');}return util[_0x1951('0x7')](_0x36391d,_0x9f33c4[_0x1951('0x9')],_0x9f33c4[_0x1951('0xa')][_0x1951('0xb')]?_0x9f33c4[_0x1951('0xa')][_0x1951('0xb')]:_0x9f33c4[_0x1951('0xc')][_0x1951('0xd')]||_0x9f33c4['ip'],_0x9f33c4[_0x1951('0xe')],_0x5dcf38[_0x1951('0xf')],_0x5dcf38['responseTime'],_0x9f33c4[_0x1951('0x10')]?_0x9f33c4[_0x1951('0x10')]['id']:null,_0x9f33c4[_0x1951('0x10')]?_0x9f33c4['user']['name']:null,_0x9f33c4[_0x1951('0x10')]?_0x9f33c4[_0x1951('0x10')]['role']:null,_0x9f33c4[_0x1951('0x14')]&&_0x9f33c4[_0x1951('0x14')][_0x1951('0x15')]?_0x9f33c4['body']['device']:_0x1951('0x18'),_0x9f33c4[_0x1951('0x14')]&&_0x9f33c4[_0x1951('0x14')][_0x1951('0x16')]?_0x9f33c4[_0x1951('0x14')]['agent_id']:'',_0x9f33c4[_0x1951('0x14')]&&_0x9f33c4[_0x1951('0x14')][_0x1951('0x19')]?_0x9f33c4[_0x1951('0x14')][_0x1951('0x19')]:'');},'ignoreRoute':function(_0x5604ec){var _0x25b593=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x25b593[_0x1951('0x1a')](_0x5604ec[_0x1951('0xe')]);}}));_0x1759bc['use'](_0x1951('0x1b'),require(_0x1951('0x1c')));_0x1759bc['use'](_0x1951('0x1d'),require(_0x1951('0x1e')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x20'),require('./api/voiceContext'));_0x1759bc[_0x1951('0x1f')]('/api/voice/extensions',require(_0x1951('0x21')));_0x1759bc['use'](_0x1951('0x22'),require('./api/voiceMusicOnHold'));_0x1759bc['use'](_0x1951('0x23'),require(_0x1951('0x24')));_0x1759bc['use']('/api/voice/recordings',require(_0x1951('0x25')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x26'),require(_0x1951('0x27')));_0x1759bc[_0x1951('0x1f')]('/api/voice/mails',require('./api/voiceMail'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x28'),require('./api/voiceMailMessage'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x29'),require('./api/voiceCallReport'));_0x1759bc[_0x1951('0x1f')]('/api/voice/dials/reports',require(_0x1951('0x2a')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x2b'),require(_0x1951('0x2c')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x2d'),require('./api/voiceQueueReport'));_0x1759bc[_0x1951('0x1f')]('/api/members/reports',require(_0x1951('0x2e')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x2f'),require('./api/trunk'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x30'),require(_0x1951('0x31')));_0x1759bc['use'](_0x1951('0x32'),require(_0x1951('0x33')));_0x1759bc[_0x1951('0x1f')]('/api/mail/accounts',require(_0x1951('0x34')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x35'),require('./api/mailQueue'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x36'),require(_0x1951('0x37')));_0x1759bc[_0x1951('0x1f')]('/api/mail/interactions',require(_0x1951('0x38')));_0x1759bc[_0x1951('0x1f')]('/api/mail/messages',require('./api/mailMessage'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x39'),require('./api/mailApplication'));_0x1759bc['use']('/api/mail/reports/queue',require(_0x1951('0x3a')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x3b'),require(_0x1951('0x3c')));_0x1759bc[_0x1951('0x1f')]('/api/dashboards/items',require(_0x1951('0x3d')));_0x1759bc[_0x1951('0x1f')]('/api/fax/accounts',require(_0x1951('0x3e')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x3f'),require('./api/faxApplication'));_0x1759bc[_0x1951('0x1f')]('/api/fax/interactions',require('./api/faxInteraction'));_0x1759bc[_0x1951('0x1f')]('/api/fax/messages',require(_0x1951('0x40')));_0x1759bc[_0x1951('0x1f')]('/api/fax/queues',require('./api/faxQueue'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x41'),require(_0x1951('0x42')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x43'),require('./api/smsAccount'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x44'),require(_0x1951('0x45')));_0x1759bc[_0x1951('0x1f')]('/api/sms/interactions',require(_0x1951('0x46')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x47'),require(_0x1951('0x48')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x49'),require(_0x1951('0x4a')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x4b'),require(_0x1951('0x4c')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x4d'),require(_0x1951('0x4e')));_0x1759bc['use']('/api/openchannel/interactions',require('./api/openchannelInteraction'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x4f'),require('./api/openchannelMessage'));_0x1759bc[_0x1951('0x1f')]('/api/openchannel/queues',require(_0x1951('0x50')));_0x1759bc['use'](_0x1951('0x51'),require('./api/chatWebsite'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x52'),require(_0x1951('0x53')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x54'),require(_0x1951('0x55')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x56'),require('./api/chatInteraction'));_0x1759bc[_0x1951('0x1f')]('/api/chat/messages',require(_0x1951('0x57')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x58'),require(_0x1951('0x59')));_0x1759bc['use'](_0x1951('0x5a'),require(_0x1951('0x5b')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x5c'),require(_0x1951('0x5d')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x5e'),require(_0x1951('0x5f')));_0x1759bc['use'](_0x1951('0x60'),require(_0x1951('0x61')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x62'),require(_0x1951('0x63')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x64'),require(_0x1951('0x65')));_0x1759bc[_0x1951('0x1f')]('/api/cm/hopper_black',require(_0x1951('0x66')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x67'),require('./api/cmHopperFinal'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x68'),require('./api/cmHopperHistory'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x69'),require(_0x1951('0x6a')));_0x1759bc['use'](_0x1951('0x6b'),require(_0x1951('0x6c')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x6d'),require(_0x1951('0x6e')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x6f'),require('./api/cannedAnswer'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x70'),require(_0x1951('0x71')));_0x1759bc['use'](_0x1951('0x72'),require(_0x1951('0x73')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x74'),require('./api/interval'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x75'),require(_0x1951('0x76')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x77'),require(_0x1951('0x78')));_0x1759bc['use']('/api/voiceQueuesLog',require(_0x1951('0x79')));_0x1759bc['use'](_0x1951('0x7a'),require(_0x1951('0x7b')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x7c'),require(_0x1951('0x7d')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x7e'),require(_0x1951('0x7f')));_0x1759bc[_0x1951('0x1f')]('/api/templates',require(_0x1951('0x80')));_0x1759bc[_0x1951('0x1f')]('/api/triggers',require(_0x1951('0x81')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x82'),require(_0x1951('0x83')));_0x1759bc['use'](_0x1951('0x84'),require('./api/integration'));_0x1759bc[_0x1951('0x1f')]('/api/integrations/reports',require(_0x1951('0x85')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x86'),require(_0x1951('0x87')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x88'),require(_0x1951('0x89')));_0x1759bc['use'](_0x1951('0x8a'),require(_0x1951('0x8b')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x8c'),require(_0x1951('0x8d')));_0x1759bc[_0x1951('0x1f')]('/api/analytics/field_reports',require(_0x1951('0x8e')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x8f'),require(_0x1951('0x90')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x91'),require(_0x1951('0x92')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x93'),require(_0x1951('0x94')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x95'),require(_0x1951('0x96')));_0x1759bc[_0x1951('0x1f')]('/api/integrations/sugarcrm/accounts',require(_0x1951('0x97')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x98'),require(_0x1951('0x99')));_0x1759bc['use'](_0x1951('0x9a'),require(_0x1951('0x9b')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x9c'),require(_0x1951('0x9d')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x9e'),require('./api/intDeskConfiguration'));_0x1759bc[_0x1951('0x1f')](_0x1951('0x9f'),require(_0x1951('0xa0')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xa1'),require(_0x1951('0xa2')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xa3'),require('./api/intZohoConfiguration'));_0x1759bc['use'](_0x1951('0xa4'),require('./api/intZohoField'));_0x1759bc[_0x1951('0x1f')](_0x1951('0xa5'),require('./api/intZendeskAccount'));_0x1759bc[_0x1951('0x1f')](_0x1951('0xa6'),require(_0x1951('0xa7')));_0x1759bc['use'](_0x1951('0xa8'),require('./api/intZendeskField'));_0x1759bc[_0x1951('0x1f')]('/api/integrations/freshdesk/accounts',require(_0x1951('0xa9')));_0x1759bc[_0x1951('0x1f')]('/api/integrations/freshdesk/configurations',require(_0x1951('0xaa')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xab'),require(_0x1951('0xac')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xad'),require('./api/intVtigerAccount'));_0x1759bc[_0x1951('0x1f')](_0x1951('0xae'),require(_0x1951('0xaf')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xb0'),require(_0x1951('0xb1')));_0x1759bc['use'](_0x1951('0xb2'),require(_0x1951('0xb3')));_0x1759bc[_0x1951('0x1f')]('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x1759bc[_0x1951('0x1f')](_0x1951('0xb4'),require('./api/intServicenowField'));_0x1759bc[_0x1951('0x1f')]('/api/integrations/dynamics365/accounts',require(_0x1951('0xb5')));_0x1759bc[_0x1951('0x1f')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x1759bc['use']('/api/integrations/dynamics365/fields',require(_0x1951('0xb6')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xb7'),require('./api/intFreshsalesAccount'));_0x1759bc['use'](_0x1951('0xb8'),require(_0x1951('0xb9')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xba'),require(_0x1951('0xbb')));_0x1759bc['use'](_0x1951('0xbc'),require('./api/network'));_0x1759bc['use'](_0x1951('0xbd'),require(_0x1951('0xbe')));_0x1759bc['use'](_0x1951('0xbf'),require(_0x1951('0xc0')));_0x1759bc[_0x1951('0x1f')]('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x1759bc[_0x1951('0x1f')](_0x1951('0xc1'),require(_0x1951('0xc2')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xc3'),require(_0x1951('0xc4')));_0x1759bc[_0x1951('0x1f')]('/api/sms/reports/queue',require(_0x1951('0xc5')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xc6'),require(_0x1951('0xc7')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xc8'),require(_0x1951('0xc9')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xca'),require(_0x1951('0xcb')));_0x1759bc['use'](_0x1951('0xcc'),require('./api/setting'));_0x1759bc[_0x1951('0x1f')]('/api/square/odbc',require(_0x1951('0xcd')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xce'),require('./api/squareProject'));_0x1759bc[_0x1951('0x1f')](_0x1951('0xcf'),require(_0x1951('0xd0')));_0x1759bc['use'](_0x1951('0xd1'),require(_0x1951('0xd2')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xd3'),require(_0x1951('0xd4')));_0x1759bc[_0x1951('0x1f')]('/api/license',require('./api/license'));_0x1759bc['use']('/api/campaigns',require('./api/campaign'));_0x1759bc[_0x1951('0x1f')](_0x1951('0xd5'),require(_0x1951('0xd6')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xd7'),require(_0x1951('0xd8')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xd9'),require(_0x1951('0xda')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xdb'),require(_0x1951('0xdc')));_0x1759bc['use'](_0x1951('0xdd'),require(_0x1951('0xde')));_0x1759bc[_0x1951('0x1f')]('/api/fax/reports/transfer',require(_0x1951('0xdf')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xe0'),require('./api/openchannelTransferReport'));_0x1759bc[_0x1951('0x1f')](_0x1951('0xe1'),require(_0x1951('0xe2')));_0x1759bc['use']('/api/cm/lists',require(_0x1951('0xe3')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xe4'),require('./api/voicePrefix'));_0x1759bc[_0x1951('0x1f')]('/api/userProfiles',require(_0x1951('0xe5')));_0x1759bc[_0x1951('0x1f')]('/api/userProfile/sections',require(_0x1951('0xe6')));_0x1759bc[_0x1951('0x1f')]('/api/userProfile/resources',require(_0x1951('0xe7')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xe8'),require('./api/notification'));_0x1759bc[_0x1951('0x1f')]('/api/whatsapp/accounts',require(_0x1951('0xe9')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xea'),require(_0x1951('0xeb')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xec'),require(_0x1951('0xed')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xee'),require(_0x1951('0xef')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xf0'),require(_0x1951('0xf1')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xf2'),require('./api/whatsappTransferReport'));_0x1759bc['use'](_0x1951('0xf3'),require(_0x1951('0xf4')));_0x1759bc[_0x1951('0x1f')]('/api/cloudProviders',require(_0x1951('0xf5')));_0x1759bc['use'](_0x1951('0xf6'),require(_0x1951('0xf7')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xf8'),require(_0x1951('0xf9')));_0x1759bc[_0x1951('0x1f')](_0x1951('0xfa'),require(_0x1951('0xfb')));_0x1759bc[_0x1951('0x1f')]('/api/rpc',require(_0x1951('0xfc')));_0x1759bc[_0x1951('0x1f')]('/api/version',require('./api/version'));_0x1759bc[_0x1951('0x1f')](_0x1951('0xfd'),require(_0x1951('0xfe')));_0x1759bc['use'](_0x1951('0xff'),require('./api/pm2'));_0x1759bc['use'](_0x1951('0x100'),require(_0x1951('0x101')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x102'),express['static'](path[_0x1951('0x103')](config[_0x1951('0x104')],'/apidoc')));_0x1759bc[_0x1951('0x1f')](_0x1951('0x105'),express[_0x1951('0x106')](path[_0x1951('0x103')](config['root'],_0x1951('0x105'))));_0x1759bc['use'](_0x1951('0x107'),express['static'](path[_0x1951('0x103')](config[_0x1951('0x104')],_0x1951('0x107'))));_0x1759bc[_0x1951('0x1f')](_0x1951('0x108'),express[_0x1951('0x106')](path['join'](config[_0x1951('0x104')],_0x1951('0x109'),_0x1951('0x10a'))));_0x1759bc[_0x1951('0x1f')]('/plugins',express[_0x1951('0x106')](path[_0x1951('0x103')](config[_0x1951('0x104')],_0x1951('0x10b'))));_0x1759bc[_0x1951('0x10c')](_0x1951('0x10d'))[_0x1951('0x10e')](errors[0x194]);_0x1759bc['route']('/*')['get'](function(_0x5083e0,_0x535b3a){_0x535b3a['sendFile'](path['resolve'](_0x1759bc[_0x1951('0x10e')](_0x1951('0x10f'))+_0x1951('0x110')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 13d1bc8..c53e0d8 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e40=['../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc'];(function(_0x5dbb84,_0x1bbce9){var _0x1d6eae=function(_0xd93967){while(--_0xd93967){_0x5dbb84['push'](_0x5dbb84['shift']());}};_0x1d6eae(++_0x1bbce9);}(_0x1e40,0x1b0));var _0x01e4=function(_0x4d65bc,_0x2d7c03){_0x4d65bc=_0x4d65bc-0x0;var _0x466e8c=_0x1e40[_0x4d65bc];return _0x466e8c;};'use strict';var jayson=require(_0x01e4('0x0'));var BPromise=require(_0x01e4('0x1'));var _=require('lodash');var config=require(_0x01e4('0x2'));exports[_0x01e4('0x3')]=function(){return new BPromise(function(_0x28d358,_0x2a08ba){var _0x5a305a={};_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x5')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x6')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x7')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x8')));_0x5a305a=_['merge'](_0x5a305a,require(_0x01e4('0x9')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0xa')));_0x5a305a=_['merge'](_0x5a305a,require(_0x01e4('0xb')));_0x5a305a=_['merge'](_0x5a305a,require(_0x01e4('0xc')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0xd')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0xe')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0xf')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require('../api/mailAccount/mailAccount.rpc'));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x10')));_0x5a305a=_['merge'](_0x5a305a,require(_0x01e4('0x11')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x12')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x13')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x14')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require('../api/faxAccount/faxAccount.rpc'));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require('../api/faxApplication/faxApplication.rpc'));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x15')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require('../api/faxMessage/faxMessage.rpc'));_0x5a305a=_['merge'](_0x5a305a,require(_0x01e4('0x16')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x17')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x18')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x19')));_0x5a305a=_['merge'](_0x5a305a,require('../api/smsMessage/smsMessage.rpc'));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x1a')));_0x5a305a=_['merge'](_0x5a305a,require(_0x01e4('0x1b')));_0x5a305a=_['merge'](_0x5a305a,require(_0x01e4('0x1c')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x1d')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x1e')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x1f')));_0x5a305a=_['merge'](_0x5a305a,require(_0x01e4('0x20')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x21')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x22')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x23')));_0x5a305a=_['merge'](_0x5a305a,require('../api/cmHopper/cmHopper.rpc'));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x24')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x25')));_0x5a305a=_['merge'](_0x5a305a,require(_0x01e4('0x26')));_0x5a305a=_['merge'](_0x5a305a,require(_0x01e4('0x27')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x28')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x29')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x2a')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x2b')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require('../api/variable/variable.rpc'));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x5a305a=_['merge'](_0x5a305a,require(_0x01e4('0x2c')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x2d')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x2e')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x2f')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x30')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x31')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x32')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x33')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x34')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x35')));_0x5a305a=_['merge'](_0x5a305a,require(_0x01e4('0x36')));_0x5a305a=_['merge'](_0x5a305a,require(_0x01e4('0x37')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x38')));_0x5a305a=_['merge'](_0x5a305a,require('../api/squareOdbc/squareOdbc.rpc'));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x39')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x3a')));_0x5a305a=_['merge'](_0x5a305a,require(_0x01e4('0x3b')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require('../api/campaign/campaign.rpc'));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require('../api/attachment/attachment.rpc'));_0x5a305a=_['merge'](_0x5a305a,require('../api/plugin/plugin.rpc'));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x3c')));_0x5a305a=_['merge'](_0x5a305a,require(_0x01e4('0x3d')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x3e')));_0x5a305a=_[_0x01e4('0x4')](_0x5a305a,require(_0x01e4('0x3f')));var _0x953b2a=jayson[_0x01e4('0x40')](_0x5a305a)[_0x01e4('0x41')]();var _0x5edec5=config[_0x01e4('0x42')]['port']||config[_0x01e4('0x43')]+0x1;var _0x4339e4=config[_0x01e4('0x42')]['ip']||_0x01e4('0x44');_0x953b2a['on']('error',function(_0x2af42b){return _0x2a08ba(_0x2af42b);});_0x953b2a[_0x01e4('0x3')](_0x5edec5,_0x4339e4,function(){console[_0x01e4('0x45')](_0x01e4('0x46'),_0x4339e4,_0x5edec5);require(_0x01e4('0x47'))[_0x01e4('0x48')]();return _0x28d358(_0x01e4('0x49')+_0x4339e4+':'+_0x5edec5);});});}; \ No newline at end of file +var _0x9af4=['../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9af4,0x1af));var _0x49af=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x9af4[_0x397e5f];return _0x5302b8;};'use strict';var jayson=require(_0x49af('0x0'));var BPromise=require('bluebird');var _=require(_0x49af('0x1'));var config=require(_0x49af('0x2'));exports['listen']=function(){return new BPromise(function(_0xe213b6,_0x486661){var _0x5efd2c={};_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x4')));_0x5efd2c=_['merge'](_0x5efd2c,require('../api/voiceExtension/voiceExtension.rpc'));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x5')));_0x5efd2c=_['merge'](_0x5efd2c,require('../api/voiceRecording/voiceRecording.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x6')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x7')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x8')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x9')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0xa')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0xb')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x5efd2c=_['merge'](_0x5efd2c,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0xc')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0xd')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/mailQueue/mailQueue.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0xe')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0xf')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x10')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x11')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/faxApplication/faxApplication.rpc'));_0x5efd2c=_['merge'](_0x5efd2c,require('../api/faxInteraction/faxInteraction.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x12')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x13')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x14')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x15')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x16')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x17')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x18')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x19')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x1a')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x1b')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x1c')));_0x5efd2c=_['merge'](_0x5efd2c,require('../api/chatInteraction/chatInteraction.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x1d')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x1e')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x1f')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x20')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x21')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x22')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x23')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x24')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x25')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x26')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x27')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x28')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/variable/variable.rpc'));_0x5efd2c=_['merge'](_0x5efd2c,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x29')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x2a')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x2b')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x2c')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x2d')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x2e')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x2f')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x30')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x31')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/squareOdbc/squareOdbc.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x32')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x33')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x34')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/campaign/campaign.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x35')));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x36')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x37')));_0x5efd2c=_['merge'](_0x5efd2c,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x5efd2c=_['merge'](_0x5efd2c,require(_0x49af('0x38')));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x5efd2c=_[_0x49af('0x3')](_0x5efd2c,require(_0x49af('0x39')));var _0xa2cdf8=jayson[_0x49af('0x3a')](_0x5efd2c)[_0x49af('0x3b')]();var _0xd029b7=config[_0x49af('0x3c')][_0x49af('0x3d')]||config['port']+0x1;var _0x33a467=config[_0x49af('0x3c')]['ip']||_0x49af('0x3e');_0xa2cdf8['on']('error',function(_0x4850af){return _0x486661(_0x4850af);});_0xa2cdf8[_0x49af('0x3f')](_0xd029b7,_0x33a467,function(){console[_0x49af('0x40')](_0x49af('0x41'),_0x33a467,_0xd029b7);require(_0x49af('0x42'))[_0x49af('0x43')]();return _0xe213b6(_0x49af('0x44')+_0x33a467+':'+_0xd029b7);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 6c2405d..f61621c 100644 --- a/server/services/agi/channel.js +++ b/server/services/agi/channel.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b89=['ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','utf8','setTimeout','setEncoding','headers','emit','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','result=','indexOf','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','log','write','inherits','sendRequest','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','prototype','exec','isArray','join','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','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','getvariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','wait','WAIT'];(function(_0x51a049,_0x46353b){var _0x4d1063=function(_0x1a95dc){while(--_0x1a95dc){_0x51a049['push'](_0x51a049['shift']());}};_0x4d1063(++_0x46353b);}(_0x7b89,0xab));var _0x97b8=function(_0x4c3557,_0x4c6b96){_0x4c3557=_0x4c3557-0x0;var _0x1672d8=_0x7b89[_0x4c3557];return _0x1672d8;};'use strict';var util=require(_0x97b8('0x0'));var _=require(_0x97b8('0x1'));var EventEmitter=require(_0x97b8('0x2'))[_0x97b8('0x3')];var AGIReply=require(_0x97b8('0x4'));var AGIError=require(_0x97b8('0x5'));function AGIChannel(_0xbe74be){var _0x3d7815=this,_0x4d486e=new AGIReply(),_0x1f157e=![],_0x59024f={};EventEmitter['call'](_0x3d7815);_0xbe74be['setEncoding'](_0x97b8('0x6'));_0xbe74be[_0x97b8('0x7')](0x8*0x3c*0x3c*0x3e8);_0x4d486e[_0x97b8('0x8')](_0x97b8('0x6'));_0x4d486e['on'](_0x97b8('0x9'),function(_0x2ef2f1){for(var _0x19cf4c in _0x2ef2f1){_0x3d7815[_0x19cf4c]=_0x2ef2f1[_0x19cf4c];}_0x3d7815[_0x97b8('0xa')]('ready');});_0x4d486e['on'](_0x97b8('0xb'),function(_0x4aa524){if(_0x4aa524['toLowerCase']()==_0x97b8('0xc')){_0x3d7815[_0x97b8('0xa')](_0x97b8('0xc'));return;}if(_0x4aa524[_0x97b8('0xd')](0x0,0xb)==_0x97b8('0xe')){_0x1f157e=!![];}if(_0x1f157e){_0x59024f['rx']+=_0x4aa524+'\x0a';if(_0x4aa524[_0x97b8('0xf')](_0x97b8('0x10'))!=-0x1){_0x1f157e=![];}}else{_0x59024f['rx']=_0x4aa524;}if(_0x1f157e){return;}if(typeof _0x59024f['cb']==_0x97b8('0x11')){var _0x4f8aab=_0x59024f['rx'][_0x97b8('0xd')](0x0,0x3),_0x542ad1=null,_0xe6c332=null;_0x4f8aab=parseInt(_0x4f8aab);if(isNaN(_0x4f8aab)){_0x59024f['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x4f8aab!=0xc8){_0x59024f['cb'](null,{'code':_0x4f8aab,'result':-0x1,'extra':'KO'});return;}_0x542ad1=_0x59024f['rx'][_0x97b8('0xd')](0x4)['replace'](_0x97b8('0x12'),'');if(_0x542ad1[_0x97b8('0x13')]('\x20')!=-0x1){_0x542ad1=_0x542ad1['substr'](0x0,_0x542ad1[_0x97b8('0x13')]('\x20'));}if(_[_0x97b8('0x14')](_0x542ad1,'-1')){_0x542ad1=parseInt(_0x542ad1);}_0xe6c332=_0x59024f['rx'][_0x97b8('0x15')]('\x20');if(_0xe6c332[_0x97b8('0x16')]==0x3){_0xe6c332=_0xe6c332[0x2][_0x97b8('0xd')](0x1,_0xe6c332[0x2][_0x97b8('0x16')]-0x1);}else if(_0xe6c332[_0x97b8('0x16')]>0x3){var _0x506c7e=/\((.+)\)/;var _0x48e383=_0x59024f['rx'][_0x97b8('0x17')](_0x506c7e);if(_0x48e383){_0xe6c332=_0x48e383[0x1];}else{_0xe6c332=null;}}else{_0xe6c332=null;}_0x59024f['cb'](null,{'code':_0x4f8aab,'result':_0x542ad1,'extra':_0xe6c332});}});_0xbe74be['on'](_0x97b8('0x18'),function(_0x1a694b){_0x3d7815['emit'](_0x97b8('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x1a694b[_0x97b8('0x19')]));});_0xbe74be['on']('close',function(){_0x3d7815[_0x97b8('0xa')](_0x97b8('0x1a'),new AGIError(_0x97b8('0x1b')));});_0xbe74be['on'](_0x97b8('0x1c'),function(){_0x3d7815[_0x97b8('0xa')](_0x97b8('0x1c'),new AGIError(_0x97b8('0x1d')));_0xbe74be[_0x97b8('0x1e')]();});_0xbe74be[_0x97b8('0x1f')](_0x4d486e);this[_0x97b8('0x20')]=function(_0x66e340,_0x454638){console[_0x97b8('0x21')]('command=',_0x66e340);var _0x66e340=_0x66e340||'',_0x454638=typeof _0x454638==_0x97b8('0x11')?_0x454638:new Function();_0x59024f={'tx':_0x66e340,'rx':'','cb':_0x454638};_0xbe74be[_0x97b8('0x22')](_0x66e340+'\x0a');},this[_0x97b8('0x1a')]=function(){_0xbe74be[_0x97b8('0x1e')]();};}util[_0x97b8('0x23')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x97b8('0x24')]=function(_0x45c055){return this[_0x97b8('0x20')][_0x97b8('0x25')](this,_0x45c055);};AGIChannel['prototype'][_0x97b8('0x26')]=function(){return this[_0x97b8('0x24')](_0x97b8('0x27'));};AGIChannel['prototype'][_0x97b8('0x28')]=function(_0x2d7e14,_0x50b5e4,_0x418ccb){_0x2d7e14=_0x2d7e14===undefined?_0x97b8('0x29'):_0x2d7e14;_0x50b5e4=_0x50b5e4===undefined?'5':_0x50b5e4;_0x418ccb=_0x418ccb===undefined?'1':_0x418ccb;return this[_0x97b8('0x24')](util[_0x97b8('0x2a')](_0x97b8('0x2b'),_0x2d7e14,_0x50b5e4*0x3e8,_0x418ccb));};AGIChannel['prototype'][_0x97b8('0x2c')]=function(_0x5c44de){_0x5c44de=_0x5c44de||_0x97b8('0x2d');return this['sendRequest'](util[_0x97b8('0x2a')]('VERBOSE\x20\x22%s\x22',_0x5c44de));};AGIChannel[_0x97b8('0x2e')][_0x97b8('0x2f')]=function(_0x53e99f,_0x16c762){if(_[_0x97b8('0x30')](_0x16c762)){return this['sendRequest'](util['format']('EXEC\x20%s\x20%s',_0x53e99f,_0x16c762[_0x97b8('0x31')](',')));}return this[_0x97b8('0x24')](util[_0x97b8('0x2a')](_0x97b8('0x32'),_0x53e99f,_0x16c762));};AGIChannel[_0x97b8('0x2e')][_0x97b8('0x33')]=function(_0x1b5e88){return this[_0x97b8('0x24')](util['format'](_0x97b8('0x34'),_0x1b5e88));};AGIChannel[_0x97b8('0x2e')][_0x97b8('0x35')]=function(_0x9a8656){return this[_0x97b8('0x24')](util['format']('SET\x20EXTENSION\x20%s',_0x9a8656));};AGIChannel[_0x97b8('0x2e')][_0x97b8('0x36')]=function(_0x215823){return this[_0x97b8('0x24')](util[_0x97b8('0x2a')](_0x97b8('0x37'),_0x215823));};AGIChannel[_0x97b8('0x2e')][_0x97b8('0xc')]=function(){return this[_0x97b8('0x24')](_0x97b8('0x38'));};AGIChannel[_0x97b8('0x2e')][_0x97b8('0x39')]=function(_0x16fda2,_0x48e09f){var _0x1308e8=_[_0x97b8('0x3a')](_0x48e09f)||_['isNumber'](_0x48e09f)?_0x48e09f[_0x97b8('0x3b')]():_0x48e09f;return this[_0x97b8('0x24')](util[_0x97b8('0x2a')](_0x97b8('0x3c'),_0x16fda2,_0x1308e8?_0x1308e8[_0x97b8('0x3b')]()[_0x97b8('0x3d')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x97b8('0x2e')]['sayNumber']=function(_0x2025d7,_0x14c50a){return this[_0x97b8('0x24')](util[_0x97b8('0x2a')](_0x97b8('0x3e'),_0x2025d7,_0x14c50a));};AGIChannel[_0x97b8('0x2e')][_0x97b8('0x3f')]=function(_0x10ee4b,_0x21994c){return this['sendRequest'](util[_0x97b8('0x2a')](_0x97b8('0x40'),_0x10ee4b,_0x21994c));};AGIChannel[_0x97b8('0x2e')][_0x97b8('0x41')]=function(_0x522ade,_0x42527f){return this['sendRequest'](util[_0x97b8('0x2a')](_0x97b8('0x42'),_0x522ade,_0x42527f));};AGIChannel['prototype'][_0x97b8('0x43')]=function(_0x3be6cf,_0x4b2174,_0x2ec1ae){_0x4b2174=_0x4b2174||this[_0x97b8('0x44')];_0x2ec1ae=_0x2ec1ae||0x1;this['setContext'](_0x3be6cf);this['setExtension'](_0x4b2174);this[_0x97b8('0x36')](_0x2ec1ae);return this[_0x97b8('0x2c')](util[_0x97b8('0x2a')](_0x97b8('0x45'),_0x3be6cf,_0x4b2174,_0x2ec1ae));};AGIChannel['prototype'][_0x97b8('0x46')]=function(_0xda2336){console[_0x97b8('0x21')](_0x97b8('0x47'),_0xda2336);return this[_0x97b8('0x24')](util['format'](_0x97b8('0x48'),_0xda2336));};AGIChannel[_0x97b8('0x2e')][_0x97b8('0x49')]=function(_0x14c2e8,_0x1d6596,_0x2325e0,_0x5222fc,_0x284215,_0x200534){_0x1d6596=_0x1d6596||'wav';_0x2325e0=_0x2325e0||'';_0x5222fc=_0x5222fc===undefined?-0x1:_0x5222fc==='-1'?-0x1:_0x5222fc*0x3e8;_0x284215=_0x284215===undefined?'':'s='+_0x284215;_0x200534=_0x200534?_0x97b8('0x4a'):'';return this[_0x97b8('0x24')](util[_0x97b8('0x2a')](_0x97b8('0x4b'),_0x14c2e8,_0x1d6596,_0x2325e0,_0x5222fc,_0x200534,_0x284215));};AGIChannel['prototype'][_0x97b8('0x4c')]=function(_0x506868,_0x5d1611){_0x5d1611=_0x5d1611||'';return this['sendRequest'](util[_0x97b8('0x2a')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x506868,_0x5d1611));};AGIChannel[_0x97b8('0x2e')][_0x97b8('0x4d')]=function(_0x3cc589){return this[_0x97b8('0x2f')](_0x97b8('0x4e'),_0x3cc589);};AGIChannel[_0x97b8('0x2e')][_0x97b8('0x4f')]=function(_0x2ef9fc){return this['exec'](_0x97b8('0x50'),_0x2ef9fc);};AGIChannel[_0x97b8('0x2e')][_0x97b8('0x18')]=function(_0x2b2011,_0x3dce1c){this[_0x97b8('0x2c')](util['format'](_0x97b8('0x51'),_0x2b2011['id'],_0x2b2011[_0x97b8('0x52')],_0x3dce1c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x97b8('0x53')]=AGIChannel; \ No newline at end of file +var _0x86bf=['SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','replace','sayNumber','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','wav','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','label','exports','util','lodash','events','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','result=','indexOf','substr','startsWith','split','length','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','log','command=','function','destroy','inherits','prototype','sendRequest','sync','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','VERBOSE\x20\x22%s\x22','exec','isArray','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','HANGUP','setVariable'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x86bf,0x1d6));var _0xf86b=function(_0x7de7fd,_0x2a0693){_0x7de7fd=_0x7de7fd-0x0;var _0x1c975f=_0x86bf[_0x7de7fd];return _0x1c975f;};'use strict';var util=require(_0xf86b('0x0'));var _=require(_0xf86b('0x1'));var EventEmitter=require(_0xf86b('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0xf86b('0x3'));function AGIChannel(_0x5d2498){var _0x2ae23c=this,_0x47b80a=new AGIReply(),_0x221b72=![],_0x274727={};EventEmitter[_0xf86b('0x4')](_0x2ae23c);_0x5d2498[_0xf86b('0x5')](_0xf86b('0x6'));_0x5d2498[_0xf86b('0x7')](0x8*0x3c*0x3c*0x3e8);_0x47b80a[_0xf86b('0x5')](_0xf86b('0x6'));_0x47b80a['on'](_0xf86b('0x8'),function(_0x1e88e6){for(var _0x2dd0da in _0x1e88e6){_0x2ae23c[_0x2dd0da]=_0x1e88e6[_0x2dd0da];}_0x2ae23c[_0xf86b('0x9')](_0xf86b('0xa'));});_0x47b80a['on'](_0xf86b('0xb'),function(_0x3683ea){if(_0x3683ea[_0xf86b('0xc')]()=='hangup'){_0x2ae23c['emit'](_0xf86b('0xd'));return;}if(_0x3683ea[_0xf86b('0xe')](0x0,0xb)==_0xf86b('0xf')){_0x221b72=!![];}if(_0x221b72){_0x274727['rx']+=_0x3683ea+'\x0a';if(_0x3683ea[_0xf86b('0x10')](_0xf86b('0x11'))!=-0x1){_0x221b72=![];}}else{_0x274727['rx']=_0x3683ea;}if(_0x221b72){return;}if(typeof _0x274727['cb']=='function'){var _0x3c1db3=_0x274727['rx']['substring'](0x0,0x3),_0x41bf28=null,_0x3077aa=null;_0x3c1db3=parseInt(_0x3c1db3);if(isNaN(_0x3c1db3)){_0x274727['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xf86b('0x12')});return;}if(_0x3c1db3!=0xc8){_0x274727['cb'](null,{'code':_0x3c1db3,'result':-0x1,'extra':'KO'});return;}_0x41bf28=_0x274727['rx']['substring'](0x4)['replace'](_0xf86b('0x13'),'');if(_0x41bf28[_0xf86b('0x14')]('\x20')!=-0x1){_0x41bf28=_0x41bf28[_0xf86b('0x15')](0x0,_0x41bf28['indexOf']('\x20'));}if(_[_0xf86b('0x16')](_0x41bf28,'-1')){_0x41bf28=parseInt(_0x41bf28);}_0x3077aa=_0x274727['rx'][_0xf86b('0x17')]('\x20');if(_0x3077aa['length']==0x3){_0x3077aa=_0x3077aa[0x2]['substring'](0x1,_0x3077aa[0x2][_0xf86b('0x18')]-0x1);}else if(_0x3077aa[_0xf86b('0x18')]>0x3){var _0x1814c5=/\((.+)\)/;var _0x4e0230=_0x274727['rx']['match'](_0x1814c5);if(_0x4e0230){_0x3077aa=_0x4e0230[0x1];}else{_0x3077aa=null;}}else{_0x3077aa=null;}_0x274727['cb'](null,{'code':_0x3c1db3,'result':_0x41bf28,'extra':_0x3077aa});}});_0x5d2498['on'](_0xf86b('0x19'),function(_0x542faa){_0x2ae23c['emit']('error',new AGIError('E_AGI_SOCKET_ERROR',_0x542faa[_0xf86b('0x1a')]));});_0x5d2498['on'](_0xf86b('0x1b'),function(){_0x2ae23c[_0xf86b('0x9')]('close',new AGIError(_0xf86b('0x1c')));});_0x5d2498['on']('timeout',function(){_0x2ae23c[_0xf86b('0x9')](_0xf86b('0x1d'),new AGIError(_0xf86b('0x1e')));_0x5d2498['destroy']();});_0x5d2498[_0xf86b('0x1f')](_0x47b80a);this[_0xf86b('0x20')]=function(_0xb5147f,_0x44197e){console[_0xf86b('0x21')](_0xf86b('0x22'),_0xb5147f);var _0xb5147f=_0xb5147f||'',_0x44197e=typeof _0x44197e==_0xf86b('0x23')?_0x44197e:new Function();_0x274727={'tx':_0xb5147f,'rx':'','cb':_0x44197e};_0x5d2498['write'](_0xb5147f+'\x0a');},this[_0xf86b('0x1b')]=function(){_0x5d2498[_0xf86b('0x24')]();};}util[_0xf86b('0x25')](AGIChannel,EventEmitter);AGIChannel[_0xf86b('0x26')][_0xf86b('0x27')]=function(_0x26e59b){return this[_0xf86b('0x20')][_0xf86b('0x28')](this,_0x26e59b);};AGIChannel[_0xf86b('0x26')]['answer']=function(){return this['sendRequest'](_0xf86b('0x29'));};AGIChannel[_0xf86b('0x26')][_0xf86b('0x2a')]=function(_0x23ca3b,_0x2b3c44,_0x495cd2){_0x23ca3b=_0x23ca3b===undefined?_0xf86b('0x2b'):_0x23ca3b;_0x2b3c44=_0x2b3c44===undefined?'5':_0x2b3c44;_0x495cd2=_0x495cd2===undefined?'1':_0x495cd2;return this[_0xf86b('0x27')](util[_0xf86b('0x2c')](_0xf86b('0x2d'),_0x23ca3b,_0x2b3c44*0x3e8,_0x495cd2));};AGIChannel['prototype']['noop']=function(_0xdf0bf3){_0xdf0bf3=_0xdf0bf3||'NO\x20MESSAGE';return this[_0xf86b('0x27')](util[_0xf86b('0x2c')](_0xf86b('0x2e'),_0xdf0bf3));};AGIChannel[_0xf86b('0x26')][_0xf86b('0x2f')]=function(_0xfc8efa,_0x1670fa){if(_[_0xf86b('0x30')](_0x1670fa)){return this[_0xf86b('0x27')](util[_0xf86b('0x2c')]('EXEC\x20%s\x20%s',_0xfc8efa,_0x1670fa['join'](',')));}return this[_0xf86b('0x27')](util[_0xf86b('0x2c')]('EXEC\x20%s\x20%s',_0xfc8efa,_0x1670fa));};AGIChannel['prototype'][_0xf86b('0x31')]=function(_0x5d6007){return this[_0xf86b('0x27')](util[_0xf86b('0x2c')](_0xf86b('0x32'),_0x5d6007));};AGIChannel['prototype'][_0xf86b('0x33')]=function(_0x5246da){return this[_0xf86b('0x27')](util[_0xf86b('0x2c')]('SET\x20EXTENSION\x20%s',_0x5246da));};AGIChannel[_0xf86b('0x26')][_0xf86b('0x34')]=function(_0x1f4ef1){return this[_0xf86b('0x27')](util['format']('SET\x20PRIORITY\x20%s',_0x1f4ef1));};AGIChannel[_0xf86b('0x26')][_0xf86b('0xd')]=function(){return this[_0xf86b('0x27')](_0xf86b('0x35'));};AGIChannel[_0xf86b('0x26')][_0xf86b('0x36')]=function(_0x4d6db2,_0x5afe1e){var _0x52f530=_['isBoolean'](_0x5afe1e)||_['isNumber'](_0x5afe1e)?_0x5afe1e['toString']():_0x5afe1e;return this['sendRequest'](util[_0xf86b('0x2c')](_0xf86b('0x37'),_0x4d6db2,_0x52f530?_0x52f530[_0xf86b('0x38')]()[_0xf86b('0x39')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xf86b('0x3a')]=function(_0x200fe4,_0x595203){return this['sendRequest'](util[_0xf86b('0x2c')]('SAY\x20NUMBER\x20%s\x20%s',_0x200fe4,_0x595203));};AGIChannel[_0xf86b('0x26')]['sayDigits']=function(_0x20a51f,_0x34661b){return this['sendRequest'](util['format'](_0xf86b('0x3b'),_0x20a51f,_0x34661b));};AGIChannel['prototype'][_0xf86b('0x3c')]=function(_0x1ce84a,_0x415f8f){return this[_0xf86b('0x27')](util['format'](_0xf86b('0x3d'),_0x1ce84a,_0x415f8f));};AGIChannel['prototype']['continueAt']=function(_0x48ae57,_0x556cdb,_0x55e210){_0x556cdb=_0x556cdb||this[_0xf86b('0x3e')];_0x55e210=_0x55e210||0x1;this[_0xf86b('0x31')](_0x48ae57);this['setExtension'](_0x556cdb);this[_0xf86b('0x34')](_0x55e210);return this[_0xf86b('0x3f')](util['format'](_0xf86b('0x40'),_0x48ae57,_0x556cdb,_0x55e210));};AGIChannel['prototype'][_0xf86b('0x41')]=function(_0x37c000){console[_0xf86b('0x21')]('getvariable',_0x37c000);return this[_0xf86b('0x27')](util[_0xf86b('0x2c')]('GET\x20VARIABLE\x20\x22%s\x22',_0x37c000));};AGIChannel[_0xf86b('0x26')]['recordFile']=function(_0x530e37,_0x2ae2cb,_0x20e613,_0x3f37f9,_0x202eb1,_0x1975f3){_0x2ae2cb=_0x2ae2cb||_0xf86b('0x42');_0x20e613=_0x20e613||'';_0x3f37f9=_0x3f37f9===undefined?-0x1:_0x3f37f9==='-1'?-0x1:_0x3f37f9*0x3e8;_0x202eb1=_0x202eb1===undefined?'':'s='+_0x202eb1;_0x1975f3=_0x1975f3?'BEEP':'';return this[_0xf86b('0x27')](util['format'](_0xf86b('0x43'),_0x530e37,_0x2ae2cb,_0x20e613,_0x3f37f9,_0x1975f3,_0x202eb1));};AGIChannel[_0xf86b('0x26')][_0xf86b('0x44')]=function(_0x35d31f,_0x2c7a34){_0x2c7a34=_0x2c7a34||'';return this[_0xf86b('0x27')](util['format'](_0xf86b('0x45'),_0x35d31f,_0x2c7a34));};AGIChannel['prototype'][_0xf86b('0x46')]=function(_0x3fdf67){return this[_0xf86b('0x2f')](_0xf86b('0x47'),_0x3fdf67);};AGIChannel[_0xf86b('0x26')]['wait']=function(_0x18907c){return this[_0xf86b('0x2f')](_0xf86b('0x48'),_0x18907c);};AGIChannel[_0xf86b('0x26')][_0xf86b('0x19')]=function(_0xe52acf,_0x12d92e){this[_0xf86b('0x3f')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0xe52acf['id'],_0xe52acf[_0xf86b('0x49')],_0x12d92e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xf86b('0x4a')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 1979d54..e6c9351 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 _0x37a4=['Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x3b7ec9,_0x176dec){var _0x21cdb2=function(_0x5b1f0a){while(--_0x5b1f0a){_0x3b7ec9['push'](_0x3b7ec9['shift']());}};_0x21cdb2(++_0x176dec);}(_0x37a4,0xcb));var _0x437a=function(_0x2acdca,_0x5b3b00){_0x2acdca=_0x2acdca-0x0;var _0x3129d7=_0x37a4[_0x2acdca];return _0x3129d7;};'use strict';var util=require(_0x437a('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x437a('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x437a('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x437a('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x437a('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x437a('0x5'),'E_AGI_COMMAND_EMPTY':_0x437a('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x437a('0x7'),'E_AGI_IVR_ENTRY':_0x437a('0x8')};function AGIError(_0x5f5067){var _0x5f5067=_0x5f5067||null,_0x3a4961=_0x3a4961||[],_0x5017ce=0x1,_0x36270b='';if(!error[_0x5f5067]){_0x5f5067=_0x437a('0x9');}_0x3a4961[_0x437a('0xa')](error[_0x5f5067]);while(arguments[_0x5017ce]){_0x3a4961[_0x437a('0xa')](arguments[_0x5017ce]);_0x5017ce++;}_0x36270b=util[_0x437a('0xb')][_0x437a('0xc')](util,_0x3a4961);this[_0x437a('0xd')]=_0x36270b;this[_0x437a('0xe')]=_0x5f5067;}module[_0x437a('0xf')]=AGIError; \ No newline at end of file +var _0xb613=['apply','message','name','exports','util','Undefined\x20error.','Server\x20closed.','[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.','E_AGI_UNDEFINED','push','format'];(function(_0x2cb3da,_0x4c84c0){var _0x4c50c6=function(_0x46735b){while(--_0x46735b){_0x2cb3da['push'](_0x2cb3da['shift']());}};_0x4c50c6(++_0x4c84c0);}(_0xb613,0x9d));var _0x3b61=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0xb613[_0x2f87cd];return _0x5d7eda;};'use strict';var util=require(_0x3b61('0x0'));var error={'E_AGI_UNDEFINED':_0x3b61('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x3b61('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x3b61('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x3b61('0x4'),'E_AGI_SOCKET_CLOSE':_0x3b61('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x3b61('0x6'),'E_AGI_COMMAND_EMPTY':_0x3b61('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x3b61('0x8'),'E_AGI_IVR_ENTRY':_0x3b61('0x9')};function AGIError(_0x167261){var _0x167261=_0x167261||null,_0x3d3c71=_0x3d3c71||[],_0x4282e4=0x1,_0x2e0a08='';if(!error[_0x167261]){_0x167261=_0x3b61('0xa');}_0x3d3c71[_0x3b61('0xb')](error[_0x167261]);while(arguments[_0x4282e4]){_0x3d3c71[_0x3b61('0xb')](arguments[_0x4282e4]);_0x4282e4++;}_0x2e0a08=util[_0x3b61('0xc')][_0x3b61('0xd')](util,_0x3d3c71);this[_0x3b61('0xe')]=_0x2e0a08;this[_0x3b61('0xf')]=_0x167261;}module[_0x3b61('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 586367f..c42ae22 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 _0x705f=['no\x20vertex\x20found','info','length','no\x20edge/s\x20available','condition','agicommand','target','menu','invalid','vswitch','includes','max\x20retry\x20reach','condition\x20not\x20found','agi','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','push','size','relations','getVertex','traverseBFS'];(function(_0x215723,_0xf52617){var _0x5878ca=function(_0x242cd1){while(--_0x242cd1){_0x215723['push'](_0x215723['shift']());}};_0x5878ca(++_0xf52617);}(_0x705f,0x75));var _0xf705=function(_0x3a8b7c,_0x3e5db2){_0x3a8b7c=_0x3a8b7c-0x0;var _0x40eb80=_0x705f[_0x3a8b7c];return _0x40eb80;};'use strict';var _=require('lodash');var logger=require('../../../config/logger')(_0xf705('0x0'));var verticesWithRetry=['menu',_0xf705('0x1'),_0xf705('0x2')];var Graph=function(){this[_0xf705('0x3')]={};this[_0xf705('0x4')]={};this[_0xf705('0x5')]=0x0;};Graph[_0xf705('0x6')][_0xf705('0x7')]=function(_0x240742){this[_0xf705('0x3')][_0x240742['id']]=_0x240742;this[_0xf705('0x4')][_0x240742['id']]=[];};Graph[_0xf705('0x6')]['addEdge']=function(_0x51fda8,_0xc244e3,_0x58cae9){this[_0xf705('0x4')][_0x51fda8][_0xf705('0x8')]({'target':_0xc244e3,'condition':_0x58cae9});this['numberOfEdges']+=0x1;};Graph['prototype'][_0xf705('0x9')]=function(){return _[_0xf705('0x9')](this[_0xf705('0x3')]);};Graph[_0xf705('0x6')][_0xf705('0xa')]=function(){return this[_0xf705('0x5')];};Graph[_0xf705('0x6')][_0xf705('0xb')]=function(_0x4a92bb){return this[_0xf705('0x3')][_0x4a92bb];};Graph[_0xf705('0x6')][_0xf705('0xc')]=function(_0xf625da,_0x31e6f5){if(!this['vertices'][_0xf625da]){return logger['info'](_0xf705('0xd'));}var _0x10763f=_0x31e6f5(this[_0xf705('0x3')][_0xf625da]);if(!_0x10763f){return logger[_0xf705('0xe')]('stop\x20traverse');}if(this[_0xf705('0x4')][_0xf625da][_0xf705('0xf')]===0x0){return logger[_0xf705('0xe')](_0xf705('0x10'));}for(var _0x572efc=0x0,_0x11dcbc=[],_0x479b31=![];_0x572efc\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','sync','production','SQUAREROOT','start','joinAt','vertices','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','LOOP\x20through\x20graph','traverseBFS','clear','vertex','stringify','VERTEX','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','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','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','./server','listening','xml2json','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','error','[ERROR]\x20%s','stack','calleridname','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','evtHangup','toJson','mxGraphModel','root','agicommand','maxRetry','retry','omit','mxCell','hasOwnProperty','isArray'];(function(_0x2db667,_0x193cf5){var _0x83ff9=function(_0x5da022){while(--_0x5da022){_0x2db667['push'](_0x2db667['shift']());}};_0x83ff9(++_0x193cf5);}(_0x5b1c,0x1b9));var _0xc5b1=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5b1c[_0x167cc1];return _0x10bc4b;};'use strict';var parser=require(_0xc5b1('0x0'));var _=require('lodash');var syncho=require(_0xc5b1('0x1'));var util=require(_0xc5b1('0x2'));var moment=require(_0xc5b1('0x3'));var config=require(_0xc5b1('0x4'));var logger=require(_0xc5b1('0x5'))(_0xc5b1('0x6'));var utilLicense=require(_0xc5b1('0x7'));var rpc=require(_0xc5b1('0x8'));var mailRpc=require(_0xc5b1('0x9'));var Graph=require(_0xc5b1('0xa'));var Vertices=require(_0xc5b1('0xb'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xc5b1('0x6')]=_[_0xc5b1('0xc')](config[_0xc5b1('0x6')],{'ip':_0xc5b1('0xd'),'port':0x11dd});function connectionHandler(_0x5d88fe){process[_0xc5b1('0xe')](function(){syncho(function(){try{setChannelVariables(_0x5d88fe);agiHandler(_0x5d88fe);}catch(_0x2727d6){logger['error'](_0x2727d6['stack']);}});});}function listeningHandler(){console[_0xc5b1('0xf')](_0xc5b1('0x10'),config[_0xc5b1('0x6')][_0xc5b1('0x11')]);logger[_0xc5b1('0x12')](util[_0xc5b1('0x13')](_0xc5b1('0x14'),config[_0xc5b1('0x6')]['ip'],config['agi'][_0xc5b1('0x11')]));}function errorHandler(_0x32deda){if(_0x32deda&&_0x32deda[_0xc5b1('0x15')]&&_0x32deda[_0xc5b1('0x16')]){logger['error'](util['format'](_0xc5b1('0x17'),_0x32deda[_0xc5b1('0x15')],_0x32deda[_0xc5b1('0x16')]));}else{logger[_0xc5b1('0x18')](util[_0xc5b1('0x13')](_0xc5b1('0x19'),_0x32deda[_0xc5b1('0x1a')]));}}function closeHandler(){logger[_0xc5b1('0x12')](util[_0xc5b1('0x13')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0xc5b1('0x1b')],this['callerid'],this[_0xc5b1('0x1c')],this[_0xc5b1('0x1d')]));try{createSquareReport(this);}catch(_0x3bc11b){logger[_0xc5b1('0x18')](_0x3bc11b['stack']);}}function timeoutHandler(){logger[_0xc5b1('0x12')](util[_0xc5b1('0x13')](_0xc5b1('0x1e'),this[_0xc5b1('0x1f')],this[_0xc5b1('0x1b')],this['callerid'],this['dnid'],this[_0xc5b1('0x1d')]));}function hangupHandler(){logger[_0xc5b1('0x12')](util[_0xc5b1('0x13')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xc5b1('0x1f')],this['calleridname'],this[_0xc5b1('0x20')],this[_0xc5b1('0x1c')],this[_0xc5b1('0x1d')]));this[_0xc5b1('0x21')]=!![];}function getRoot(_0x24335f){return parser[_0xc5b1('0x22')](_0x24335f,{'object':!![]})[_0xc5b1('0x23')][_0xc5b1('0x24')];}function addVertex(_0xe7acf3,_0x48f28d,_0x51b37b){_0x48f28d[_0xc5b1('0x25')]=_0x51b37b;if(_0x48f28d['hasOwnProperty']('retry')){_0x48f28d[_0xc5b1('0x26')]=parseInt(_0x48f28d[_0xc5b1('0x27')],0xa);}_0xe7acf3['addVertex'](_[_0xc5b1('0x28')](_0x48f28d,_0xc5b1('0x29')));}function initGraph(_0x29d52a,_0x536efa){var _0x36aa94=new Graph();for(var _0x39cd10 in _0x29d52a){if(_0x29d52a[_0xc5b1('0x2a')](_0x39cd10)){if(_[_0xc5b1('0x2b')](_0x29d52a[_0x39cd10])){for(var _0xa0b9bc=0x0;_0xa0b9bc<_0x29d52a[_0x39cd10][_0xc5b1('0x2c')];_0xa0b9bc+=0x1){addVertex(_0x36aa94,_0x29d52a[_0x39cd10][_0xa0b9bc],_0x39cd10);}}else{addVertex(_0x36aa94,_0x29d52a[_0x39cd10],_0x39cd10);}}}for(var _0x317f3f=0x0;_0x317f3f<_0x536efa[_0xc5b1('0x2c')];_0x317f3f+=0x1){if(_0x536efa[_0x317f3f][_0xc5b1('0x2d')]&&_0x536efa[_0x317f3f][_0xc5b1('0x2e')]){_0x36aa94[_0xc5b1('0x2f')](_0x536efa[_0x317f3f][_0xc5b1('0x2d')],_0x536efa[_0x317f3f][_0xc5b1('0x2e')],_0x536efa[_0x317f3f][_0xc5b1('0x30')]);}}return _0x36aa94;}function getSquareProject(_0x10f07c,_0x2d2e7d){rpc[_0xc5b1('0x31')](_0x10f07c)[_0xc5b1('0x32')](function(_0x3f4ae0){_0x2d2e7d(null,_0x3f4ae0);})[_0xc5b1('0x33')](function(_0x2fe48d){_0x2d2e7d(null,_0x2fe48d);});}function createSquareReport(_0x1fc834,_0x1c19d2){rpc['createSquareReport'](_0x1fc834)[_0xc5b1('0x32')](function(_0x5d407e){if(_0x1c19d2){_0x1c19d2(null,_0x5d407e);}})[_0xc5b1('0x33')](function(_0x30a782){if(_0x1c19d2){_0x1c19d2(null,_0x30a782);}});}function setChannelVariables(_0x310c49){for(var _0x1ccf03 in _0x310c49){if(_0x310c49[_0xc5b1('0x2a')](_0x1ccf03)){if(_0x1ccf03[_0xc5b1('0x34')](_0xc5b1('0x35'))===0x0){_0x310c49[_0x1ccf03[_0xc5b1('0x36')](0x4)]=_0x310c49[_0x1ccf03];delete _0x310c49[_0x1ccf03];}}}}function getLogFromObject(_0x8935d5){return util[_0xc5b1('0x37')](_0x8935d5,{'showHidden':![],'depth':null});}function agiHandler(_0x40cf6b){var _0x1e9170,_0x5478c6,_0x10d005,_0x3ea467,_0x4aafc5;logger[_0xc5b1('0x38')](_0xc5b1('0x39'),JSON['stringify'](_0x40cf6b,null,0x2));logger[_0xc5b1('0x12')](util[_0xc5b1('0x13')](_0xc5b1('0x3a'),_0x40cf6b[_0xc5b1('0x1f')],_0x40cf6b[_0xc5b1('0x1b')],_0x40cf6b[_0xc5b1('0x20')],_0x40cf6b[_0xc5b1('0x1c')],_0x40cf6b[_0xc5b1('0x1d')]));_0x40cf6b['on'](_0xc5b1('0x18'),errorHandler);_0x40cf6b['on'](_0xc5b1('0x3b'),closeHandler);_0x40cf6b['on'](_0xc5b1('0x3c'),timeoutHandler);_0x40cf6b[_0xc5b1('0x21')]=![];_0x40cf6b['on']('hangup',hangupHandler);var _0x18d76e=getSquareProject[_0xc5b1('0x3d')](null,_0x40cf6b[_0xc5b1('0x1f')]);if(_0x18d76e){if(_0x18d76e[_0xc5b1('0x3e')]){_0x1e9170=getRoot(_0x18d76e[_0xc5b1('0x3e')]);console[_0xc5b1('0xf')](_0xc5b1('0x3f'),_0x1e9170);if(_0x1e9170&&_0x1e9170[_0xc5b1('0x40')]){logger['debug'](_0xc5b1('0x24'),JSON['stringify'](_0x1e9170,null,0x2));_0x40cf6b[_0xc5b1('0x41')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5478c6=initGraph(_[_0xc5b1('0x28')](_0x1e9170,'mxCell'),_0x1e9170[_0xc5b1('0x29')]);_0x10d005=new Vertices(_0x40cf6b,rpc,mailRpc);console['log'](_0xc5b1('0x42'),_0x10d005);logger[_0xc5b1('0x12')](util[_0xc5b1('0x13')](_0xc5b1('0x43'),_0x40cf6b[_0xc5b1('0x1f')],_0x40cf6b[_0xc5b1('0x1b')],_0x40cf6b[_0xc5b1('0x20')],_0x40cf6b['dnid'],_0x40cf6b[_0xc5b1('0x1d')]));console['log'](_0xc5b1('0x44'));_0x5478c6[_0xc5b1('0x45')](_0x1e9170['start']['id'],function(_0x1954c1){try{_0x1954c1=_0x10d005[_0xc5b1('0x46')](_0x1954c1);logger[_0xc5b1('0x38')](_0xc5b1('0x47'),JSON[_0xc5b1('0x48')](_0x1954c1,null,0x2));console[_0xc5b1('0xf')](_0xc5b1('0x49'),_0x1954c1);if(_0x1954c1[_0xc5b1('0x25')]===_0xc5b1('0x4a')){logger[_0xc5b1('0x12')](_0xc5b1('0x4b'));_0x40cf6b['context']=_0x1954c1['context']||_0x40cf6b[_0xc5b1('0x4c')];_0x40cf6b[_0xc5b1('0x4d')]=_0x1954c1[_0xc5b1('0x4d')];_0x40cf6b[_0xc5b1('0x4e')]=_0x1954c1['priority']?_0x1954c1[_0xc5b1('0x4e')]-0x1:0x1;return null;}else if(_0x1954c1&&_0x10d005[_0x1954c1[_0xc5b1('0x25')]]){_0x4aafc5=_0x10d005[_0x1954c1[_0xc5b1('0x25')]](_0x1954c1);console[_0xc5b1('0xf')]('vresponse',_0x4aafc5);logger[_0xc5b1('0x12')](_0xc5b1('0x4f'),JSON[_0xc5b1('0x48')](_0x4aafc5,null,0x2));if(_0x4aafc5&&_0x4aafc5[_0xc5b1('0x50')]===AGI_CODE_SUCCESS&&_0x4aafc5[_0xc5b1('0x51')]!==AGI_RESULT_ERROR&&!_0x40cf6b[_0xc5b1('0x21')]){logger[_0xc5b1('0x38')](_0xc5b1('0x4f'),getLogFromObject(_0x4aafc5));return _[_0xc5b1('0x52')](_0x4aafc5[_0xc5b1('0x51')])?null:_0x4aafc5[_0xc5b1('0x51')][_0xc5b1('0x53')]();}else{logger[_0xc5b1('0x18')](_0xc5b1('0x4f'),getLogFromObject(_0x4aafc5));return null;}}else{logger[_0xc5b1('0x18')](_0xc5b1('0x54'));return null;}}catch(_0x15dbbf){logger[_0xc5b1('0x18')](_0x15dbbf[_0xc5b1('0x1a')]);return null;}});if(_0x1e9170[_0xc5b1('0x55')]){logger['info'](util[_0xc5b1('0x13')](_0xc5b1('0x56'),_0x40cf6b[_0xc5b1('0x1f')],_0x40cf6b['calleridname'],_0x40cf6b['callerid'],_0x40cf6b[_0xc5b1('0x1c')],_0x40cf6b['uniqueid']));_0x5478c6[_0xc5b1('0x45')](_0x1e9170[_0xc5b1('0x55')]['id'],function(_0x5d748d){try{_0x5d748d=_0x10d005[_0xc5b1('0x46')](_0x5d748d);logger[_0xc5b1('0x38')]('vertex',JSON[_0xc5b1('0x48')](_0x5d748d,null,0x2));if(_0x5d748d&&_0x10d005[_0x5d748d['agicommand']]){_0x4aafc5=_0x10d005[_0x5d748d[_0xc5b1('0x25')]](_0x5d748d);if(_0x4aafc5){logger[_0xc5b1('0x38')](_0xc5b1('0x4f'),getLogFromObject(_0x4aafc5));return _[_0xc5b1('0x52')](_0x4aafc5[_0xc5b1('0x51')])?null:_0x4aafc5[_0xc5b1('0x51')][_0xc5b1('0x53')]();}else{logger['error'](_0xc5b1('0x4f'),getLogFromObject(_0x4aafc5));return null;}}else{logger[_0xc5b1('0x18')](_0xc5b1('0x54'));return null;}}catch(_0x5669d2){logger[_0xc5b1('0x18')](_0x5669d2['stack']);return null;}});}logger['info'](util[_0xc5b1('0x13')](_0xc5b1('0x57'),_0x40cf6b[_0xc5b1('0x1f')],_0x40cf6b[_0xc5b1('0x1b')],_0x40cf6b[_0xc5b1('0x20')],_0x40cf6b[_0xc5b1('0x1c')],_0x40cf6b[_0xc5b1('0x1d')]));logger['info'](util[_0xc5b1('0x13')](_0xc5b1('0x58'),_0x40cf6b['context'],_0x40cf6b[_0xc5b1('0x4d')],parseInt(_0x40cf6b[_0xc5b1('0x4e')],0xa)+0x1));_0x40cf6b[_0xc5b1('0x59')](_0x40cf6b['context'],_0x40cf6b[_0xc5b1('0x4d')],parseInt(_0x40cf6b['priority'],0xa)+0x1);_0x40cf6b[_0xc5b1('0x3b')]();}}else{logger[_0xc5b1('0x18')](util[_0xc5b1('0x13')]('Project\x20%s\x20not\x20published',_0x40cf6b[_0xc5b1('0x1f')]));_0x40cf6b['continueAt'](_0x40cf6b[_0xc5b1('0x4c')],_0x40cf6b['extension'],parseInt(_0x40cf6b['priority'],0xa)+0x1);_0x40cf6b[_0xc5b1('0x3b')]();}}else{logger['error'](util[_0xc5b1('0x13')]('Project\x20%s\x20not\x20found',_0x40cf6b[_0xc5b1('0x1f')]));_0x40cf6b[_0xc5b1('0x59')](_0x40cf6b[_0xc5b1('0x4c')],_0x40cf6b[_0xc5b1('0x4d')],parseInt(_0x40cf6b[_0xc5b1('0x4e')],0xa)+0x1);_0x40cf6b[_0xc5b1('0x3b')]();}}function main(){var _0x355edf;return utilLicense[_0xc5b1('0x5a')]()[_0xc5b1('0x32')](function(_0x452ff9){if(_0x452ff9){if(_0x452ff9[_0xc5b1('0x5b')]){if(_0x452ff9[_0xc5b1('0x5c')]&&_0x452ff9[_0xc5b1('0x5c')]>0x0){logger['info'](util[_0xc5b1('0x13')]('[LICENSE]\x20CHANNELS:\x20%s',_0x452ff9[_0xc5b1('0x5c')]));_0x355edf=_0x452ff9['callysquare'];}else{logger[_0xc5b1('0x12')](_0xc5b1('0x5d'));}}else{logger[_0xc5b1('0x12')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x355edf=-0x1;}}})[_0xc5b1('0x33')](function(_0x5bf9c8){logger[_0xc5b1('0x18')](_0xc5b1('0x5e'),_0x5bf9c8[_0xc5b1('0x1a')]);})['finally'](function(){var _0x28553a=require(_0xc5b1('0x5f'))(config['agi'][_0xc5b1('0x11')],config[_0xc5b1('0x6')]['ip'],_0x355edf);_0x28553a['on'](_0xc5b1('0x18'),errorHandler);_0x28553a['on'](_0xc5b1('0x60'),listeningHandler);_0x28553a['on']('connection',connectionHandler);_0x28553a['on'](_0xc5b1('0x3b'),closeHandler);});}main(); \ No newline at end of file +var _0xc306=['value','getSquareProject','catch','createSquareReport','then','indexOf','substring','inspect','debug','variables','stringify','close','timeout','hangup','sync','production','SQUAREROOT','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','vertices','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','LOOP\x20through\x20graph','traverseBFS','clear','VERTEX','gotoc','context','extension','priority','vresponse','response','isUndefined','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','[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','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','connection','xml2json','syncho','util','moment','../../config/environment','../../config/logger','../../config/license/util','./mailRpc','./graph','./vertices','agi','defaults','127.0.0.1','nextTick','error','log','port','name','message','format','[ERROR]\x20%s','stack','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','mxCell','length','source','target','addEdge'];(function(_0x10b67e,_0x440062){var _0x2d688a=function(_0x4e9982){while(--_0x4e9982){_0x10b67e['push'](_0x10b67e['shift']());}};_0x2d688a(++_0x440062);}(_0xc306,0x1a9));var _0x6c30=function(_0x2ff56a,_0x305966){_0x2ff56a=_0x2ff56a-0x0;var _0x18a66d=_0xc306[_0x2ff56a];return _0x18a66d;};'use strict';var parser=require(_0x6c30('0x0'));var _=require('lodash');var syncho=require(_0x6c30('0x1'));var util=require(_0x6c30('0x2'));var moment=require(_0x6c30('0x3'));var config=require(_0x6c30('0x4'));var logger=require(_0x6c30('0x5'))('agi');var utilLicense=require(_0x6c30('0x6'));var rpc=require('./rpc');var mailRpc=require(_0x6c30('0x7'));var Graph=require(_0x6c30('0x8'));var Vertices=require(_0x6c30('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x6c30('0xa')]=_[_0x6c30('0xb')](config[_0x6c30('0xa')],{'ip':_0x6c30('0xc'),'port':0x11dd});function connectionHandler(_0x4e0017){process[_0x6c30('0xd')](function(){syncho(function(){try{setChannelVariables(_0x4e0017);agiHandler(_0x4e0017);}catch(_0x3f937a){logger[_0x6c30('0xe')](_0x3f937a['stack']);}});});}function listeningHandler(){console[_0x6c30('0xf')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0x6c30('0x10')]);logger['info'](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x6c30('0xa')]['ip'],config[_0x6c30('0xa')][_0x6c30('0x10')]));}function errorHandler(_0x4db908){if(_0x4db908&&_0x4db908[_0x6c30('0x11')]&&_0x4db908['message']){logger[_0x6c30('0xe')](util['format']('[%s]\x20%s',_0x4db908[_0x6c30('0x11')],_0x4db908[_0x6c30('0x12')]));}else{logger['error'](util[_0x6c30('0x13')](_0x6c30('0x14'),_0x4db908[_0x6c30('0x15')]));}}function closeHandler(){logger[_0x6c30('0x16')](util['format'](_0x6c30('0x17'),this[_0x6c30('0x18')],this[_0x6c30('0x19')],this[_0x6c30('0x1a')],this[_0x6c30('0x1b')],this[_0x6c30('0x1c')]));try{createSquareReport(this);}catch(_0x439581){logger[_0x6c30('0xe')](_0x439581[_0x6c30('0x15')]);}}function timeoutHandler(){logger[_0x6c30('0x16')](util['format'](_0x6c30('0x1d'),this[_0x6c30('0x18')],this[_0x6c30('0x19')],this[_0x6c30('0x1a')],this[_0x6c30('0x1b')],this['uniqueid']));}function hangupHandler(){logger[_0x6c30('0x16')](util[_0x6c30('0x13')](_0x6c30('0x1e'),this[_0x6c30('0x18')],this[_0x6c30('0x19')],this[_0x6c30('0x1a')],this['dnid'],this['uniqueid']));this[_0x6c30('0x1f')]=!![];}function getRoot(_0x4688fa){return parser[_0x6c30('0x20')](_0x4688fa,{'object':!![]})[_0x6c30('0x21')][_0x6c30('0x22')];}function addVertex(_0x34ddb6,_0x17c025,_0x726de6){_0x17c025[_0x6c30('0x23')]=_0x726de6;if(_0x17c025[_0x6c30('0x24')](_0x6c30('0x25'))){_0x17c025[_0x6c30('0x26')]=parseInt(_0x17c025[_0x6c30('0x25')],0xa);}_0x34ddb6[_0x6c30('0x27')](_['omit'](_0x17c025,_0x6c30('0x28')));}function initGraph(_0x1152f3,_0x56f3eb){var _0x190693=new Graph();for(var _0x6fc3f8 in _0x1152f3){if(_0x1152f3[_0x6c30('0x24')](_0x6fc3f8)){if(_['isArray'](_0x1152f3[_0x6fc3f8])){for(var _0x2706ae=0x0;_0x2706ae<_0x1152f3[_0x6fc3f8][_0x6c30('0x29')];_0x2706ae+=0x1){addVertex(_0x190693,_0x1152f3[_0x6fc3f8][_0x2706ae],_0x6fc3f8);}}else{addVertex(_0x190693,_0x1152f3[_0x6fc3f8],_0x6fc3f8);}}}for(var _0x3471dc=0x0;_0x3471dc<_0x56f3eb[_0x6c30('0x29')];_0x3471dc+=0x1){if(_0x56f3eb[_0x3471dc][_0x6c30('0x2a')]&&_0x56f3eb[_0x3471dc][_0x6c30('0x2b')]){_0x190693[_0x6c30('0x2c')](_0x56f3eb[_0x3471dc][_0x6c30('0x2a')],_0x56f3eb[_0x3471dc]['target'],_0x56f3eb[_0x3471dc][_0x6c30('0x2d')]);}}return _0x190693;}function getSquareProject(_0x2ff96a,_0x231ec0){rpc[_0x6c30('0x2e')](_0x2ff96a)['then'](function(_0x5b0990){_0x231ec0(null,_0x5b0990);})[_0x6c30('0x2f')](function(_0x53551f){_0x231ec0(null,_0x53551f);});}function createSquareReport(_0x29bc69,_0x428f61){rpc[_0x6c30('0x30')](_0x29bc69)[_0x6c30('0x31')](function(_0x2a14f7){if(_0x428f61){_0x428f61(null,_0x2a14f7);}})[_0x6c30('0x2f')](function(_0x16dd6f){if(_0x428f61){_0x428f61(null,_0x16dd6f);}});}function setChannelVariables(_0x27ddc4){for(var _0x4ec2a9 in _0x27ddc4){if(_0x27ddc4[_0x6c30('0x24')](_0x4ec2a9)){if(_0x4ec2a9[_0x6c30('0x32')]('agi_')===0x0){_0x27ddc4[_0x4ec2a9[_0x6c30('0x33')](0x4)]=_0x27ddc4[_0x4ec2a9];delete _0x27ddc4[_0x4ec2a9];}}}}function getLogFromObject(_0x1e9997){return util[_0x6c30('0x34')](_0x1e9997,{'showHidden':![],'depth':null});}function agiHandler(_0x4cf1c5){var _0x57153e,_0x11612c,_0x4c5a45,_0x5e852c,_0x5d1f3e;logger[_0x6c30('0x35')](_0x6c30('0x36'),JSON[_0x6c30('0x37')](_0x4cf1c5,null,0x2));logger[_0x6c30('0x16')](util[_0x6c30('0x13')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4cf1c5['arg_1'],_0x4cf1c5[_0x6c30('0x19')],_0x4cf1c5['callerid'],_0x4cf1c5['dnid'],_0x4cf1c5[_0x6c30('0x1c')]));_0x4cf1c5['on'](_0x6c30('0xe'),errorHandler);_0x4cf1c5['on'](_0x6c30('0x38'),closeHandler);_0x4cf1c5['on'](_0x6c30('0x39'),timeoutHandler);_0x4cf1c5[_0x6c30('0x1f')]=![];_0x4cf1c5['on'](_0x6c30('0x3a'),hangupHandler);var _0x472664=getSquareProject[_0x6c30('0x3b')](null,_0x4cf1c5[_0x6c30('0x18')]);if(_0x472664){if(_0x472664[_0x6c30('0x3c')]){_0x57153e=getRoot(_0x472664[_0x6c30('0x3c')]);console[_0x6c30('0xf')](_0x6c30('0x3d'),_0x57153e);if(_0x57153e&&_0x57153e['start']){logger[_0x6c30('0x35')](_0x6c30('0x22'),JSON[_0x6c30('0x37')](_0x57153e,null,0x2));_0x4cf1c5[_0x6c30('0x3e')]=moment()[_0x6c30('0x13')](_0x6c30('0x3f'));_0x11612c=initGraph(_[_0x6c30('0x40')](_0x57153e,_0x6c30('0x28')),_0x57153e[_0x6c30('0x28')]);_0x4c5a45=new Vertices(_0x4cf1c5,rpc,mailRpc);console['log'](_0x6c30('0x41'),_0x4c5a45);logger[_0x6c30('0x16')](util[_0x6c30('0x13')](_0x6c30('0x42'),_0x4cf1c5[_0x6c30('0x18')],_0x4cf1c5['calleridname'],_0x4cf1c5[_0x6c30('0x1a')],_0x4cf1c5[_0x6c30('0x1b')],_0x4cf1c5[_0x6c30('0x1c')]));console[_0x6c30('0xf')](_0x6c30('0x43'));_0x11612c[_0x6c30('0x44')](_0x57153e['start']['id'],function(_0x3e29a1){try{_0x3e29a1=_0x4c5a45[_0x6c30('0x45')](_0x3e29a1);logger['debug']('vertex',JSON[_0x6c30('0x37')](_0x3e29a1,null,0x2));console[_0x6c30('0xf')](_0x6c30('0x46'),_0x3e29a1);if(_0x3e29a1[_0x6c30('0x23')]===_0x6c30('0x47')){logger[_0x6c30('0x16')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x4cf1c5[_0x6c30('0x48')]=_0x3e29a1['context']||_0x4cf1c5[_0x6c30('0x48')];_0x4cf1c5[_0x6c30('0x49')]=_0x3e29a1[_0x6c30('0x49')];_0x4cf1c5['priority']=_0x3e29a1[_0x6c30('0x4a')]?_0x3e29a1[_0x6c30('0x4a')]-0x1:0x1;return null;}else if(_0x3e29a1&&_0x4c5a45[_0x3e29a1['agicommand']]){_0x5d1f3e=_0x4c5a45[_0x3e29a1[_0x6c30('0x23')]](_0x3e29a1);console[_0x6c30('0xf')](_0x6c30('0x4b'),_0x5d1f3e);logger['info'](_0x6c30('0x4c'),JSON['stringify'](_0x5d1f3e,null,0x2));if(_0x5d1f3e&&_0x5d1f3e['code']===AGI_CODE_SUCCESS&&_0x5d1f3e['result']!==AGI_RESULT_ERROR&&!_0x4cf1c5[_0x6c30('0x1f')]){logger[_0x6c30('0x35')](_0x6c30('0x4c'),getLogFromObject(_0x5d1f3e));return _[_0x6c30('0x4d')](_0x5d1f3e['result'])?null:_0x5d1f3e[_0x6c30('0x4e')][_0x6c30('0x4f')]();}else{logger[_0x6c30('0xe')](_0x6c30('0x4c'),getLogFromObject(_0x5d1f3e));return null;}}else{logger['error'](_0x6c30('0x50'));return null;}}catch(_0x20891a){logger[_0x6c30('0xe')](_0x20891a[_0x6c30('0x15')]);return null;}});if(_0x57153e[_0x6c30('0x51')]){logger[_0x6c30('0x16')](util['format'](_0x6c30('0x52'),_0x4cf1c5[_0x6c30('0x18')],_0x4cf1c5[_0x6c30('0x19')],_0x4cf1c5['callerid'],_0x4cf1c5['dnid'],_0x4cf1c5['uniqueid']));_0x11612c[_0x6c30('0x44')](_0x57153e[_0x6c30('0x51')]['id'],function(_0x1c02c2){try{_0x1c02c2=_0x4c5a45[_0x6c30('0x45')](_0x1c02c2);logger[_0x6c30('0x35')]('vertex',JSON[_0x6c30('0x37')](_0x1c02c2,null,0x2));if(_0x1c02c2&&_0x4c5a45[_0x1c02c2[_0x6c30('0x23')]]){_0x5d1f3e=_0x4c5a45[_0x1c02c2[_0x6c30('0x23')]](_0x1c02c2);if(_0x5d1f3e){logger[_0x6c30('0x35')](_0x6c30('0x4c'),getLogFromObject(_0x5d1f3e));return _[_0x6c30('0x4d')](_0x5d1f3e[_0x6c30('0x4e')])?null:_0x5d1f3e[_0x6c30('0x4e')][_0x6c30('0x4f')]();}else{logger[_0x6c30('0xe')](_0x6c30('0x4c'),getLogFromObject(_0x5d1f3e));return null;}}else{logger['error'](_0x6c30('0x50'));return null;}}catch(_0x29f9d0){logger[_0x6c30('0xe')](_0x29f9d0[_0x6c30('0x15')]);return null;}});}logger[_0x6c30('0x16')](util[_0x6c30('0x13')](_0x6c30('0x53'),_0x4cf1c5[_0x6c30('0x18')],_0x4cf1c5[_0x6c30('0x19')],_0x4cf1c5['callerid'],_0x4cf1c5[_0x6c30('0x1b')],_0x4cf1c5[_0x6c30('0x1c')]));logger['info'](util[_0x6c30('0x13')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x4cf1c5[_0x6c30('0x48')],_0x4cf1c5['extension'],parseInt(_0x4cf1c5[_0x6c30('0x4a')],0xa)+0x1));_0x4cf1c5[_0x6c30('0x54')](_0x4cf1c5[_0x6c30('0x48')],_0x4cf1c5[_0x6c30('0x49')],parseInt(_0x4cf1c5[_0x6c30('0x4a')],0xa)+0x1);_0x4cf1c5[_0x6c30('0x38')]();}}else{logger[_0x6c30('0xe')](util[_0x6c30('0x13')](_0x6c30('0x55'),_0x4cf1c5[_0x6c30('0x18')]));_0x4cf1c5[_0x6c30('0x54')](_0x4cf1c5['context'],_0x4cf1c5['extension'],parseInt(_0x4cf1c5['priority'],0xa)+0x1);_0x4cf1c5[_0x6c30('0x38')]();}}else{logger['error'](util['format'](_0x6c30('0x56'),_0x4cf1c5[_0x6c30('0x18')]));_0x4cf1c5[_0x6c30('0x54')](_0x4cf1c5[_0x6c30('0x48')],_0x4cf1c5[_0x6c30('0x49')],parseInt(_0x4cf1c5['priority'],0xa)+0x1);_0x4cf1c5[_0x6c30('0x38')]();}}function main(){var _0x5d7432;return utilLicense[_0x6c30('0x57')]()[_0x6c30('0x31')](function(_0x11df70){if(_0x11df70){if(_0x11df70['voice']){if(_0x11df70[_0x6c30('0x58')]&&_0x11df70[_0x6c30('0x58')]>0x0){logger[_0x6c30('0x16')](util[_0x6c30('0x13')](_0x6c30('0x59'),_0x11df70[_0x6c30('0x58')]));_0x5d7432=_0x11df70[_0x6c30('0x58')];}else{logger[_0x6c30('0x16')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x6c30('0x16')](_0x6c30('0x5a'));_0x5d7432=-0x1;}}})[_0x6c30('0x2f')](function(_0x33cbf8){logger[_0x6c30('0xe')](_0x6c30('0x5b'),_0x33cbf8['stack']);})['finally'](function(){var _0x115efb=require('./server')(config[_0x6c30('0xa')][_0x6c30('0x10')],config[_0x6c30('0xa')]['ip'],_0x5d7432);_0x115efb['on'](_0x6c30('0xe'),errorHandler);_0x115efb['on'](_0x6c30('0x5c'),listeningHandler);_0x115efb['on'](_0x6c30('0x5d'),connectionHandler);_0x115efb['on'](_0x6c30('0x38'),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 411d1c8..3ec557d 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 _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x1c2868,_0x23b30e){var _0x26a7e7=function(_0x5ddd0a){while(--_0x5ddd0a){_0x1c2868['push'](_0x1c2868['shift']());}};_0x26a7e7(++_0x23b30e);}(_0x814b,0x1a2));var _0xb814=function(_0xdcda3,_0x4252fb){_0xdcda3=_0xdcda3-0x0;var _0x2bec82=_0x814b[_0xdcda3];return _0x2bec82;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x59a19f,_0x180d37){var _0x22418b=function(_0xb17b8b){while(--_0xb17b8b){_0x59a19f['push'](_0x59a19f['shift']());}};_0x22418b(++_0x180d37);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index fa3da1a..975d025 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(_0x99ff94,_0x47a1b1){var _0x1b5bc0=function(_0x25821f){while(--_0x25821f){_0x99ff94['push'](_0x99ff94['shift']());}};_0x1b5bc0(++_0x47a1b1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x33f86e,_0x54322c){_0x33f86e=_0x33f86e-0x0;var _0x1d2e63=_0x5f2f[_0x33f86e];return _0x1d2e63;};'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(_0x919445,_0x5467dc){var _0x511b3e=function(_0xde10f3){while(--_0xde10f3){_0x919445['push'](_0x919445['shift']());}};_0x511b3e(++_0x5467dc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2fca8a,_0x321893){_0x2fca8a=_0x2fca8a-0x0;var _0xe6cada=_0x5f2f[_0x2fca8a];return _0xe6cada;};'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 1f41d1a..eb28809 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 _0x0dce=['ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','log','rpcreq','getTrunkById','ShowTrunk','getSoundById','ShowSound','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','CreateSquareMessage','createCmContact','ShowCmHopper','phone','then','CreateCmContact','agentLogin','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','error','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','name','email','getSquareProjectById','getVoiceQueueById'];(function(_0x114fbe,_0x494c38){var _0x2f9a39=function(_0x41a768){while(--_0x41a768){_0x114fbe['push'](_0x114fbe['shift']());}};_0x2f9a39(++_0x494c38);}(_0x0dce,0x119));var _0xe0dc=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x0dce[_0x3ab9ee];return _0x82ee88;};'use strict';var BPromise=require(_0xe0dc('0x0'));var moment=require(_0xe0dc('0x1'));var _=require(_0xe0dc('0x2'));var util=require(_0xe0dc('0x3'));var jayson=require(_0xe0dc('0x4'));var client=jayson[_0xe0dc('0x5')]['http']({'port':0x2329});function request(_0xb0764c,_0x294125){return new BPromise(function(_0x57d385,_0xf10601){return client['request'](_0xb0764c,_0x294125)['then'](function(_0x37ac19){if(_0x37ac19['error']){return _0xf10601(_0x37ac19[_0xe0dc('0x6')]['message']);}else{return _0x57d385(_0x37ac19[_0xe0dc('0x7')]);}})[_0xe0dc('0x8')](function(_0x2098a3){return _0xf10601(_0x2098a3);});});}exports[_0xe0dc('0x9')]=function(_0x17101c){return request(_0xe0dc('0xa'),{'options':{'raw':![],'where':{'name':_0x17101c},'attributes':[_0xe0dc('0xb')]}});};exports[_0xe0dc('0xc')]=function(_0x50c11d){return request(_0xe0dc('0xd'),{'options':{'raw':![],'where':{'id':_0x50c11d},'include':[{'model':_0xe0dc('0xe'),'as':'Smtp'}],'attributes':['id',_0xe0dc('0xf'),_0xe0dc('0x10')]}});};exports[_0xe0dc('0x11')]=function(_0x374307){return request(_0xe0dc('0xa'),{'options':{'where':{'id':_0x374307},'attributes':[_0xe0dc('0xf')]}});};exports[_0xe0dc('0x12')]=function(_0x588ebf){return request(_0xe0dc('0x13'),{'options':{'where':{'id':_0x588ebf},'attributes':[_0xe0dc('0xf')]}});};exports[_0xe0dc('0x14')]=function(_0x368ffb){return request(_0xe0dc('0x15'),{'options':{'where':{'id':_0x368ffb},'attributes':[_0xe0dc('0xf')]}});};exports[_0xe0dc('0x16')]=function(_0x798f5d){return request(_0xe0dc('0x17'),{'options':{'where':{'id':_0x798f5d},'attributes':[_0xe0dc('0x18')]}});};exports[_0xe0dc('0x19')]=function(_0x2358ab){return request(_0xe0dc('0x1a'),{'options':{'where':{'id':_0x2358ab},'attributes':[_0xe0dc('0xf')]}});};exports[_0xe0dc('0x1b')]=function(_0x44f5da){console[_0xe0dc('0x1c')](_0xe0dc('0x1d'),_0x44f5da);return request(_0xe0dc('0x1b'),{'options':{'where':{'phone':_0x44f5da},'attributes':['id']}});};exports[_0xe0dc('0x1e')]=function(_0x356dbf){return request(_0xe0dc('0x1f'),{'options':{'where':{'id':_0x356dbf},'attributes':[_0xe0dc('0xf')]}});};exports[_0xe0dc('0x20')]=function(_0x240e8f){return request(_0xe0dc('0x21'),{'options':{'where':{'id':_0x240e8f},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x7c06cc){return request(_0xe0dc('0x22'),{'options':{'raw':![],'where':{'id':_0x7c06cc},'include':[{'model':_0xe0dc('0x23'),'as':_0xe0dc('0x24')}]}});};exports[_0xe0dc('0x25')]=function(_0x1c3d24){return request(_0xe0dc('0x26'),{'options':{'where':{'id':_0x1c3d24},'attributes':['id',_0xe0dc('0xf')]}});};exports[_0xe0dc('0x27')]=function(_0x10ad63){return request(_0xe0dc('0x28'),{'body':_0x10ad63});};exports['createSquareDetailsReport']=function(_0x3e8e36){return request(_0xe0dc('0x29'),{'body':_0x3e8e36});};exports[_0xe0dc('0x2a')]=function(_0xf4e323){return request(_0xe0dc('0x2b'),{'body':_[_0xe0dc('0x2c')](_0xf4e323,{'project_name':_0xf4e323['arg_1'],'prev_project_name':_0xf4e323[_0xe0dc('0x2d')]||'','is_subproject':_0xf4e323[_0xe0dc('0x2d')]?!![]:![],'leaveAt':moment()[_0xe0dc('0x2e')](_0xe0dc('0x2f'))})});};exports['createSquareRecording']=function(_0x582e04){return request('CreateSquareRecording',{'body':_0x582e04});};exports['createSquareMessage']=function(_0x1e078d){return request(_0xe0dc('0x30'),{'body':_0x1e078d});};exports[_0xe0dc('0x31')]=function(_0x102993){return request(_0xe0dc('0x32'),{'options':{'raw':![],'where':{'phone':_0x102993[_0xe0dc('0x33')],'ListId':_0x102993['ListId']}}})[_0xe0dc('0x34')](function(_0x5110bb){if(_0x5110bb){return _0x5110bb;}return request(_0xe0dc('0x35'),{'body':_0x102993});});};exports['getPauseById']=function(_0x3d308f){return request('ShowPause',{'options':{'where':{'id':_0x3d308f},'attributes':[_0xe0dc('0xf')]}});};exports[_0xe0dc('0x36')]=function(_0x202ccf,_0x24d77a){return request('LoginUser',{'body':{'interface':_0x24d77a},'options':{'where':_0x202ccf}});};exports[_0xe0dc('0x37')]=function(_0x1be184,_0x37ba90,_0x3a8a3d){return request(_0xe0dc('0x38'),{'body':{'type':_0x37ba90,'uniqueid':_0x3a8a3d},'options':{'where':_0x1be184}});};exports['agentUnpause']=function(_0x501253){return request(_0xe0dc('0x39'),{'body':{},'options':{'where':_0x501253}});};exports[_0xe0dc('0x3a')]=function(_0x36f3ed){return request(_0xe0dc('0x3b'),{'body':{},'options':{'where':_0x36f3ed}});}; \ No newline at end of file +var _0xfc4e=['ShowMailAccount','MailServerOut','Smtp','name','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','log','rpcreq','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','ShowCmHopper','ListId','CreateCmContact','ShowPause','LoginUser','agentPause','PauseUser','agentLogout','LogoutUser','moment','lodash','jayson/promise','client','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','production'];(function(_0x540de6,_0x594803){var _0x1df335=function(_0x30b552){while(--_0x30b552){_0x540de6['push'](_0x540de6['shift']());}};_0x1df335(++_0x594803);}(_0xfc4e,0x67));var _0xefc4=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xfc4e[_0x1d1779];return _0x2377e9;};'use strict';var BPromise=require('bluebird');var moment=require(_0xefc4('0x0'));var _=require(_0xefc4('0x1'));var util=require('util');var jayson=require(_0xefc4('0x2'));var client=jayson[_0xefc4('0x3')]['http']({'port':0x2329});function request(_0x5f14ef,_0x3888a8){return new BPromise(function(_0x430a67,_0x2af421){return client[_0xefc4('0x4')](_0x5f14ef,_0x3888a8)[_0xefc4('0x5')](function(_0x218dde){if(_0x218dde[_0xefc4('0x6')]){return _0x2af421(_0x218dde['error'][_0xefc4('0x7')]);}else{return _0x430a67(_0x218dde[_0xefc4('0x8')]);}})[_0xefc4('0x9')](function(_0x42280d){return _0x2af421(_0x42280d);});});}exports[_0xefc4('0xa')]=function(_0x417aaf){return request(_0xefc4('0xb'),{'options':{'raw':![],'where':{'name':_0x417aaf},'attributes':[_0xefc4('0xc')]}});};exports['getMailAccountById']=function(_0x6cd01a){return request(_0xefc4('0xd'),{'options':{'raw':![],'where':{'id':_0x6cd01a},'include':[{'model':_0xefc4('0xe'),'as':_0xefc4('0xf')}],'attributes':['id',_0xefc4('0x10'),'email']}});};exports[_0xefc4('0x11')]=function(_0x4c7b07){return request(_0xefc4('0xb'),{'options':{'where':{'id':_0x4c7b07},'attributes':[_0xefc4('0x10')]}});};exports[_0xefc4('0x12')]=function(_0x5e74e8){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x5e74e8},'attributes':['name']}});};exports[_0xefc4('0x13')]=function(_0x25db4b){return request(_0xefc4('0x14'),{'options':{'where':{'id':_0x25db4b},'attributes':[_0xefc4('0x10')]}});};exports[_0xefc4('0x15')]=function(_0x2fc301){return request(_0xefc4('0x16'),{'options':{'where':{'id':_0x2fc301},'attributes':['dsn']}});};exports[_0xefc4('0x17')]=function(_0x5e9ffb){return request(_0xefc4('0x18'),{'options':{'where':{'id':_0x5e9ffb},'attributes':['name']}});};exports[_0xefc4('0x19')]=function(_0x21169a){console[_0xefc4('0x1a')](_0xefc4('0x1b'),_0x21169a);return request(_0xefc4('0x1c'),{'options':{'where':{'phone':_0x21169a},'attributes':['id']}});};exports[_0xefc4('0x1d')]=function(_0x1af760){return request(_0xefc4('0x1e'),{'options':{'where':{'id':_0x1af760},'attributes':[_0xefc4('0x10')]}});};exports[_0xefc4('0x1f')]=function(_0x3cca2c){return request(_0xefc4('0x20'),{'options':{'where':{'id':_0x3cca2c},'attributes':[_0xefc4('0x21')]}});};exports['getIntervalById']=function(_0x26d8ff){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x26d8ff},'include':[{'model':_0xefc4('0x22'),'as':_0xefc4('0x23')}]}});};exports[_0xefc4('0x24')]=function(_0x5bb17b){return request('ShowSmsAccount',{'options':{'where':{'id':_0x5bb17b},'attributes':['id',_0xefc4('0x10')]}});};exports[_0xefc4('0x25')]=function(_0xdeea64){return request(_0xefc4('0x26'),{'body':_0xdeea64});};exports['createSquareDetailsReport']=function(_0x1af5fc){return request(_0xefc4('0x27'),{'body':_0x1af5fc});};exports[_0xefc4('0x28')]=function(_0x13838b){return request(_0xefc4('0x29'),{'body':_[_0xefc4('0x2a')](_0x13838b,{'project_name':_0x13838b['arg_1'],'prev_project_name':_0x13838b[_0xefc4('0x2b')]||'','is_subproject':_0x13838b[_0xefc4('0x2b')]?!![]:![],'leaveAt':moment()[_0xefc4('0x2c')](_0xefc4('0x2d'))})});};exports[_0xefc4('0x2e')]=function(_0x2d4538){return request(_0xefc4('0x2f'),{'body':_0x2d4538});};exports['createSquareMessage']=function(_0x55b19f){return request(_0xefc4('0x30'),{'body':_0x55b19f});};exports['createCmContact']=function(_0x4b430c){return request(_0xefc4('0x31'),{'options':{'raw':![],'where':{'phone':_0x4b430c['phone'],'ListId':_0x4b430c[_0xefc4('0x32')]}}})[_0xefc4('0x5')](function(_0x1ea3c8){if(_0x1ea3c8){return _0x1ea3c8;}return request(_0xefc4('0x33'),{'body':_0x4b430c});});};exports['getPauseById']=function(_0x1a5863){return request(_0xefc4('0x34'),{'options':{'where':{'id':_0x1a5863},'attributes':[_0xefc4('0x10')]}});};exports['agentLogin']=function(_0x3f0096,_0x5dc910){return request(_0xefc4('0x35'),{'body':{'interface':_0x5dc910},'options':{'where':_0x3f0096}});};exports[_0xefc4('0x36')]=function(_0x494ca1,_0x1e22f5,_0x18479f){return request(_0xefc4('0x37'),{'body':{'type':_0x1e22f5,'uniqueid':_0x18479f},'options':{'where':_0x494ca1}});};exports['agentUnpause']=function(_0x5d395f){return request('UnpauseUser',{'body':{},'options':{'where':_0x5d395f}});};exports[_0xefc4('0x38')]=function(_0x2e57d0){return request(_0xefc4('0x39'),{'body':{},'options':{'where':_0x2e57d0}});}; \ 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 f9e0ed9..6e7ead8 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 _0xac31=['exports','./polly','./lex'];(function(_0x229b13,_0x4ac627){var _0x4be521=function(_0x339a61){while(--_0x339a61){_0x229b13['push'](_0x229b13['shift']());}};_0x4be521(++_0x4ac627);}(_0xac31,0xca));var _0x1ac3=function(_0x17d5ef,_0x25279f){_0x17d5ef=_0x17d5ef-0x0;var _0x3cb382=_0xac31[_0x17d5ef];return _0x3cb382;};var polly=require(_0x1ac3('0x0'));var lex=require(_0x1ac3('0x1'));module[_0x1ac3('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x0ba7=['exports','./polly'];(function(_0x12a3ee,_0x492ca0){var _0x263f16=function(_0x4f28e8){while(--_0x4f28e8){_0x12a3ee['push'](_0x12a3ee['shift']());}};_0x263f16(++_0x492ca0);}(_0x0ba7,0x16d));var _0x70ba=function(_0x50081a,_0x5968dc){_0x50081a=_0x50081a-0x0;var _0x3be578=_0x0ba7[_0x50081a];return _0x3be578;};var polly=require(_0x70ba('0x0'));var lex=require('./lex');module[_0x70ba('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 2e36f53..dddd11c 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f9f=['exports'];(function(_0x28f1de,_0x355054){var _0x5b5dad=function(_0x399b72){while(--_0x399b72){_0x28f1de['push'](_0x28f1de['shift']());}};_0x5b5dad(++_0x355054);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x13cf0e,_0x5c3c6d){_0x13cf0e=_0x13cf0e-0x0;var _0x1b013a=_0x0f9f[_0x13cf0e];return _0x1b013a;};'use strict';var lex=require('./lib/api');module[_0xf0f9('0x0')]=function(_0x438c8d,_0x1eba20,_0x48fa0e,_0x5cf55e,_0x45cc98,_0x257b44){return lex(_0x438c8d,_0x1eba20,_0x48fa0e,_0x5cf55e,_0x45cc98,_0x257b44);}; \ No newline at end of file +var _0xde9d=['./lib/api','exports'];(function(_0x1e746c,_0x372d4c){var _0x17d8e2=function(_0x20039d){while(--_0x20039d){_0x1e746c['push'](_0x1e746c['shift']());}};_0x17d8e2(++_0x372d4c);}(_0xde9d,0x156));var _0xdde9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xde9d[_0xa464c9];return _0x3d73c4;};'use strict';var lex=require(_0xdde9('0x0'));module[_0xdde9('0x1')]=function(_0x207feb,_0x4013c5,_0x20ab4a,_0x49fbbe,_0x2a7fa7,_0x28cc44){return lex(_0x207feb,_0x4013c5,_0x20ab4a,_0x49fbbe,_0x2a7fa7,_0x28cc44);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index dea1d0e..ce0bb11 100644 --- a/server/services/agi/scripts/aws/lex/lib/api.js +++ b/server/services/agi/scripts/aws/lex/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8aad=['slot_','exports','LexRuntime','$LATEST','bluebird','postText','slots'];(function(_0x25eadc,_0x4de9c1){var _0x35008c=function(_0x3f0196){while(--_0x3f0196){_0x25eadc['push'](_0x25eadc['shift']());}};_0x35008c(++_0x4de9c1);}(_0x8aad,0x10e));var _0xd8aa=function(_0x265b06,_0xd03cb7){_0x265b06=_0x265b06-0x0;var _0x36020=_0x8aad[_0x265b06];return _0x36020;};'use strict';var BPromise=require(_0xd8aa('0x0'));var AWS=require('aws-sdk');function lexResult(_0x454b23,_0x376972){return new BPromise(function(_0x272859,_0x364aef){_0x454b23[_0xd8aa('0x1')](_0x376972,function(_0x4276c4,_0x326332){if(_0x4276c4){_0x364aef(_0x4276c4);}if(_0x326332['slots']){for(const _0x2e325a in _0x326332[_0xd8aa('0x2')]){if(_0x326332['slots']['hasOwnProperty'](_0x2e325a)){var _0x48c7a6=_0x326332['slots'][_0x2e325a];_0x326332[_0xd8aa('0x3')+_0x2e325a]=_0x48c7a6;}}}_0x272859(_0x326332);});});}module[_0xd8aa('0x4')]=function(_0x4233b0,_0x59ffd5,_0x39ea7a,_0x1cc43e,_0x3cf3d2,_0x1e4675){var _0x7df1da=new AWS[(_0xd8aa('0x5'))]({'accessKeyId':_0x59ffd5,'secretAccessKey':_0x39ea7a,'region':_0x1cc43e});var _0x932a10={'botAlias':_0xd8aa('0x6'),'botName':_0x1e4675,'inputText':_0x3cf3d2,'userId':_0x4233b0};return lexResult(_0x7df1da,_0x932a10);}; \ No newline at end of file +var _0x6bcf=['$LATEST','bluebird','aws-sdk','slots','slot_','exports','LexRuntime'];(function(_0x4a90df,_0x23954a){var _0x115f05=function(_0x36eb97){while(--_0x36eb97){_0x4a90df['push'](_0x4a90df['shift']());}};_0x115f05(++_0x23954a);}(_0x6bcf,0xb7));var _0xf6bc=function(_0x4173d0,_0x3d5eff){_0x4173d0=_0x4173d0-0x0;var _0xaee602=_0x6bcf[_0x4173d0];return _0xaee602;};'use strict';var BPromise=require(_0xf6bc('0x0'));var AWS=require(_0xf6bc('0x1'));function lexResult(_0xdebb85,_0x41019e){return new BPromise(function(_0x13b4ff,_0x5d1424){_0xdebb85['postText'](_0x41019e,function(_0x87b9b9,_0x422b09){if(_0x87b9b9){_0x5d1424(_0x87b9b9);}if(_0x422b09[_0xf6bc('0x2')]){for(const _0x45d0fd in _0x422b09['slots']){if(_0x422b09['slots']['hasOwnProperty'](_0x45d0fd)){var _0x2756f9=_0x422b09[_0xf6bc('0x2')][_0x45d0fd];_0x422b09[_0xf6bc('0x3')+_0x45d0fd]=_0x2756f9;}}}_0x13b4ff(_0x422b09);});});}module[_0xf6bc('0x4')]=function(_0x5f0c00,_0xeb9ff5,_0x567f51,_0x42fc1c,_0x1b6359,_0x3de9d3){var _0x17c369=new AWS[(_0xf6bc('0x5'))]({'accessKeyId':_0xeb9ff5,'secretAccessKey':_0x567f51,'region':_0x42fc1c});var _0x343a20={'botAlias':_0xf6bc('0x6'),'botName':_0x3de9d3,'inputText':_0x1b6359,'userId':_0x5f0c00};return lexResult(_0x17c369,_0x343a20);}; \ 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 963e17f..36df02c 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 _0xd04b=['./lib/api'];(function(_0x5c7055,_0x550d42){var _0x20d196=function(_0x47e15e){while(--_0x47e15e){_0x5c7055['push'](_0x5c7055['shift']());}};_0x20d196(++_0x550d42);}(_0xd04b,0x7c));var _0xbd04=function(_0x3a313a,_0x45bf36){_0x3a313a=_0x3a313a-0x0;var _0x35d862=_0xd04b[_0x3a313a];return _0x35d862;};'use strict';var polly=require(_0xbd04('0x0'));module['exports']=function(_0x18f5ea,_0x4ed6db,_0x416abd,_0x126f91,_0x94e133,_0x3a5264,_0x2e8f75){return polly(_0x18f5ea,_0x4ed6db,_0x416abd,_0x126f91,_0x94e133,_0x3a5264,_0x2e8f75);}; \ No newline at end of file +var _0x83a4=['./lib/api'];(function(_0x36ba3b,_0x3bf009){var _0x5f2390=function(_0xf32888){while(--_0xf32888){_0x36ba3b['push'](_0x36ba3b['shift']());}};_0x5f2390(++_0x3bf009);}(_0x83a4,0x17e));var _0x483a=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x83a4[_0x5608a3];return _0x1ed50a;};'use strict';var polly=require(_0x483a('0x0'));module['exports']=function(_0x55297d,_0x2d8da0,_0x5c0b9c,_0x4ec294,_0x41afea,_0xda7289,_0x8f96d2){return polly(_0x55297d,_0x2d8da0,_0x5c0b9c,_0x4ec294,_0x41afea,_0xda7289,_0x8f96d2);}; \ 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 d1a1197..01fc6f5 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 _0xb676=['mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text'];(function(_0x449862,_0x37dc81){var _0x3cc436=function(_0x30cb35){while(--_0x30cb35){_0x449862['push'](_0x449862['shift']());}};_0x3cc436(++_0x37dc81);}(_0xb676,0x121));var _0x6b67=function(_0x946518,_0x22816f){_0x946518=_0x946518-0x0;var _0x909b69=_0xb676[_0x946518];return _0x909b69;};'use strict';var fs=require('fs');var path=require(_0x6b67('0x0'));var BPromise=require(_0x6b67('0x1'));var rs=require(_0x6b67('0x2'));var AWS=require(_0x6b67('0x3'));function pollyResult(_0x489e9b,_0x1cb12f,_0x2ca4af){return new BPromise(function(_0x2aa605,_0xb2a781){_0x489e9b[_0x6b67('0x4')](_0x1cb12f,function(_0x369cb5,_0x3aaa91){if(_0x369cb5){_0xb2a781(_0x369cb5);}else if(_0x3aaa91){if(_0x3aaa91[_0x6b67('0x5')]instanceof Buffer){fs['writeFile'](_0x2ca4af,_0x3aaa91[_0x6b67('0x5')],function(_0x4ee325){if(_0x4ee325){_0xb2a781(_0x4ee325);}else{_0x2aa605();}});}else{_0xb2a781(new Error(_0x6b67('0x6')));}}else{_0xb2a781(new Error(_0x6b67('0x7')));}});});}module[_0x6b67('0x8')]=function(_0x2a3aef,_0x5a1d92,_0x3fd5d4,_0x212bd4,_0x4f41cb,_0x1c46c1,_0x3676d2){var _0xa5e9b3=new AWS[(_0x6b67('0x9'))]({'accessKeyId':_0x2a3aef,'secretAccessKey':_0x5a1d92,'region':_0x3fd5d4});var _0x1eaf44={'Text':_0x4f41cb,'TextType':_0x1c46c1||_0x6b67('0xa'),'OutputFormat':_0x6b67('0xb'),'VoiceId':_0x212bd4};return pollyResult(_0xa5e9b3,_0x1eaf44,_0x3676d2);}; \ No newline at end of file +var _0x55f7=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x55f7,0x1e8));var _0x755f=function(_0x39dba1,_0x4d0883){_0x39dba1=_0x39dba1-0x0;var _0x2c28e7=_0x55f7[_0x39dba1];return _0x2c28e7;};'use strict';var fs=require('fs');var path=require(_0x755f('0x0'));var BPromise=require(_0x755f('0x1'));var rs=require(_0x755f('0x2'));var AWS=require(_0x755f('0x3'));function pollyResult(_0x4b95f5,_0x5a97e9,_0x256714){return new BPromise(function(_0x2a4549,_0x445398){_0x4b95f5[_0x755f('0x4')](_0x5a97e9,function(_0x45cba7,_0x29e93e){if(_0x45cba7){_0x445398(_0x45cba7);}else if(_0x29e93e){if(_0x29e93e[_0x755f('0x5')]instanceof Buffer){fs['writeFile'](_0x256714,_0x29e93e[_0x755f('0x5')],function(_0x226d6d){if(_0x226d6d){_0x445398(_0x226d6d);}else{_0x2a4549();}});}else{_0x445398(new Error(_0x755f('0x6')));}}else{_0x445398(new Error(_0x755f('0x7')));}});});}module[_0x755f('0x8')]=function(_0x30a9ba,_0x54dbd1,_0x3c08ae,_0xd8b06b,_0xabcd8a,_0x170c6d,_0x340c24){var _0x37da2e=new AWS[(_0x755f('0x9'))]({'accessKeyId':_0x30a9ba,'secretAccessKey':_0x54dbd1,'region':_0x3c08ae});var _0x577d41={'Text':_0xabcd8a,'TextType':_0x170c6d||'text','OutputFormat':_0x755f('0xa'),'VoiceId':_0xd8b06b};return pollyResult(_0x37da2e,_0x577d41,_0x340c24);}; \ 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 57ec47b..379e0ec 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaecf=['./lib/api','exports'];(function(_0x4e26c6,_0x2194f7){var _0x475714=function(_0x321e88){while(--_0x321e88){_0x4e26c6['push'](_0x4e26c6['shift']());}};_0x475714(++_0x2194f7);}(_0xaecf,0x74));var _0xfaec=function(_0x339037,_0xb8dcf6){_0x339037=_0x339037-0x0;var _0x2eaff5=_0xaecf[_0x339037];return _0x2eaff5;};'use strict';var asr=require(_0xfaec('0x0'));module[_0xfaec('0x1')]=function(_0x42d34a,_0x25f461,_0x290793,_0x15fd24){return asr(_0x42d34a,_0x25f461,_0x290793);}; \ No newline at end of file +var _0x34af=['exports'];(function(_0x3cb1f4,_0x247a6c){var _0x5ce790=function(_0xd84742){while(--_0xd84742){_0x3cb1f4['push'](_0x3cb1f4['shift']());}};_0x5ce790(++_0x247a6c);}(_0x34af,0x110));var _0xf34a=function(_0xfc5ab8,_0x3d0e85){_0xfc5ab8=_0xfc5ab8-0x0;var _0x4c0211=_0x34af[_0xfc5ab8];return _0x4c0211;};'use strict';var asr=require('./lib/api');module[_0xf34a('0x0')]=function(_0x4361cf,_0x230572,_0x1a5e3a,_0x4706fb){return asr(_0x4361cf,_0x230572,_0x1a5e3a);}; \ 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 e748965..6b28c6f 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 _0x5de3=['toString','/v1/speech:recognize?key=','LINEAR16','8000','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x5de3,0x160));var _0x35de=function(_0x51445e,_0x4b4e65){_0x51445e=_0x51445e-0x0;var _0x477ea9=_0x5de3[_0x51445e];return _0x477ea9;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0x35de('0x0')]=function(_0x2ae3a6,_0x57b598,_0x322c04){return new BPromise(function(_0x1b1c2e,_0x1fba76){var _0x1236e4;if(typeof _0x2ae3a6!==_0x35de('0x1')||_0x2ae3a6[_0x35de('0x2')]===0x0){return _0x1fba76(_0x35de('0x3'));}if(typeof _0x57b598!==_0x35de('0x1')||_0x57b598[_0x35de('0x2')]===0x0){return _0x1fba76(_0x35de('0x4'));}if(typeof _0x322c04!==_0x35de('0x5')&&(typeof _0x322c04!==_0x35de('0x1')||_0x322c04['length']===0x0)){return _0x1fba76(_0x35de('0x6'));}try{_0x1236e4=fs[_0x35de('0x7')](_0x2ae3a6)[_0x35de('0x8')]('base64');}catch(_0x577d1b){return _0x1fba76(_0x577d1b);}return _0x1b1c2e({'method':'POST','uri':host+_0x35de('0x9')+_0x57b598,'body':{'config':{'encoding':_0x35de('0xa'),'sampleRateHertz':_0x35de('0xb'),'languageCode':_0x322c04},'audio':{'content':_0x1236e4}},'json':!![]});});}; \ No newline at end of file +var _0x1283=['undefined','readFileSync','toString','POST','/v1/speech:recognize?key=','8000','url','bluebird','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string'];(function(_0x224810,_0x523695){var _0x53f0de=function(_0x494ffb){while(--_0x494ffb){_0x224810['push'](_0x224810['shift']());}};_0x53f0de(++_0x523695);}(_0x1283,0x1c0));var _0x3128=function(_0x2567f0,_0x4fa60){_0x2567f0=_0x2567f0-0x0;var _0x14852a=_0x1283[_0x2567f0];return _0x14852a;};'use strict';var url=require(_0x3128('0x0'));var BPromise=require(_0x3128('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x3128('0x2')]=function(_0x529d1c,_0x30d65d,_0x24fd46){return new BPromise(function(_0x41f62b,_0x450b3d){var _0x5a028e;if(typeof _0x529d1c!=='string'||_0x529d1c[_0x3128('0x3')]===0x0){return _0x450b3d(_0x3128('0x4'));}if(typeof _0x30d65d!==_0x3128('0x5')||_0x30d65d[_0x3128('0x3')]===0x0){return _0x450b3d(_0x3128('0x6'));}if(typeof _0x24fd46!==_0x3128('0x7')&&(typeof _0x24fd46!==_0x3128('0x5')||_0x24fd46['length']===0x0)){return _0x450b3d('lang\x20should\x20be\x20a\x20string');}try{_0x5a028e=fs[_0x3128('0x8')](_0x529d1c)[_0x3128('0x9')]('base64');}catch(_0x1b2112){return _0x450b3d(_0x1b2112);}return _0x41f62b({'method':_0x3128('0xa'),'uri':host+_0x3128('0xb')+_0x30d65d,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x3128('0xc'),'languageCode':_0x24fd46},'audio':{'content':_0x5a028e}},'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 7d36895..3021518 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 _0x01a6=['./asr'];(function(_0x1a91e8,_0x316322){var _0x1637be=function(_0x251fb9){while(--_0x251fb9){_0x1a91e8['push'](_0x1a91e8['shift']());}};_0x1637be(++_0x316322);}(_0x01a6,0x162));var _0x601a=function(_0x484f15,_0x13f161){_0x484f15=_0x484f15-0x0;var _0x32c47a=_0x01a6[_0x484f15];return _0x32c47a;};var asr=require(_0x601a('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x7e27=['exports','./asr'];(function(_0x1ec904,_0x524ad0){var _0x3f11c1=function(_0x2250a5){while(--_0x2250a5){_0x1ec904['push'](_0x1ec904['shift']());}};_0x3f11c1(++_0x524ad0);}(_0x7e27,0xdd));var _0x77e2=function(_0x548924,_0x2d19b7){_0x548924=_0x548924-0x0;var _0x4b716f=_0x7e27[_0x548924];return _0x4b716f;};var asr=require(_0x77e2('0x0'));module[_0x77e2('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 1ade39a..c8737bc 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 _0xb68d=['writeFile','googleCloudTTS\x20path','split','googleTTS','googleASR','uri','results','alternatives','transcript','join','map','confidence','catch','[%s]\x20%s:%s','name','message','stringify','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','code','metadata','isFallbackIntent','Tilde\x20ASR\x20transcription','lex','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','path','url','parse','bluebird','randomstring','sox','util','google-tts-api','apiai-promise','md5','./tilde','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','get','error','request\x20to\x20','statusCode','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','download\x20error','pipe','end','data','transcode','wav','error\x20convert','start','resolve','.wav','writeFileSync','then','unlink','chmodSync','777','readFileSync','base64','googleCloudTTS','input','voice','MP3','text:synthesize','POST','tmp','generate','.mp3','from','audioContent'];(function(_0x5985ff,_0x4cc788){var _0x58af53=function(_0x2586d8){while(--_0x2586d8){_0x5985ff['push'](_0x5985ff['shift']());}};_0x58af53(++_0x4cc788);}(_0xb68d,0x8c));var _0xdb68=function(_0x1f7377,_0x27e6a5){_0x1f7377=_0x1f7377-0x0;var _0x858ccd=_0xb68d[_0x1f7377];return _0x858ccd;};'use strict';var fs=require('fs');var path=require(_0xdb68('0x0'));var http=require('http');var https=require('https');var urlParse=require(_0xdb68('0x1'))[_0xdb68('0x2')];var BPromise=require(_0xdb68('0x3'));var rs=require(_0xdb68('0x4'));var sox=require(_0xdb68('0x5'));var rp=require('request-promise');var util=require(_0xdb68('0x6'));var querystring=require('querystring');var tts=require(_0xdb68('0x7'));var apiai=require(_0xdb68('0x8'));var md5=require(_0xdb68('0x9'));var google=require('./google');var aws=require('./aws');var tilde=require(_0xdb68('0xa'));var sestek=require(_0xdb68('0xb'));var logger=require(_0xdb68('0xc'))(_0xdb68('0xd'));var ISPEECH_API=_0xdb68('0xe');function downloadFile(_0x4e12a4,_0x50798d){return new BPromise(function(_0x21aa2a,_0x3cfc98){var _0x23b0d4=urlParse(_0x4e12a4);var _0x6bdafd=_0x23b0d4[_0xdb68('0xf')]==='https:'?https:http;var _0x2f5e11={'host':_0x23b0d4[_0xdb68('0x10')],'path':_0x23b0d4[_0xdb68('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x6bdafd[_0xdb68('0x11')](_0x2f5e11,function(_0x468863){if(_0x468863['statusCode']!==0xc8){logger[_0xdb68('0x12')](_0xdb68('0x13')+_0x4e12a4+'\x20failed,\x20status\x20code\x20=\x20'+_0x468863[_0xdb68('0x14')]+'\x20('+_0x468863['statusMessage']+')');_0x3cfc98(new Error('request\x20to\x20'+_0x4e12a4+_0xdb68('0x15')+_0x468863[_0xdb68('0x14')]+'\x20('+_0x468863[_0xdb68('0x16')]+')'));return;}var _0x4c3bfb=fs[_0xdb68('0x17')](_0x50798d);_0x4c3bfb['on'](_0xdb68('0x18'),function(){logger[_0xdb68('0x19')](_0xdb68('0x1a'));_0x4c3bfb[_0xdb68('0x1b')](_0x21aa2a);});_0x4c3bfb['on']('error',function(_0x4a7bc4){fs['unlink'](_0x50798d);logger['error'](_0xdb68('0x1c'),_0x4a7bc4);_0x3cfc98(_0x4a7bc4);});_0x468863[_0xdb68('0x1d')](_0x4c3bfb);})['on'](_0xdb68('0x12'),function(_0x56f38b){logger['error'](_0x56f38b);_0x3cfc98(_0x56f38b);})[_0xdb68('0x1e')]();});}function uploadFile(_0x34fcc4){return new BPromise(function(_0x49ffe1,_0x298a7e){var _0x1d87d5=urlParse(_0x34fcc4);var _0x2b002b=_0x1d87d5['protocol']==='https:'?https:http;var _0x2183e0={'host':_0x1d87d5[_0xdb68('0x10')],'path':_0x1d87d5[_0xdb68('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x2b002b[_0xdb68('0x11')](_0x2183e0,function(_0x33dd4b){if(_0x33dd4b[_0xdb68('0x14')]!==0xc8){_0x298a7e(new Error(_0xdb68('0x13')+_0x34fcc4+'\x20failed,\x20status\x20code\x20=\x20'+_0x33dd4b[_0xdb68('0x14')]+'\x20('+_0x33dd4b[_0xdb68('0x16')]+')'));return;}var _0x24698b='';_0x33dd4b['on'](_0xdb68('0x1f'),function(_0x429b6c){_0x24698b+=_0x429b6c;});_0x33dd4b['on'](_0xdb68('0x1e'),function(){_0x49ffe1(_0x24698b);});})['on'](_0xdb68('0x12'),function(_0x54bb31){_0x298a7e(_0x54bb31);})[_0xdb68('0x1e')]();});}function convertFile(_0x2749d2,_0x1c3cab){return new BPromise(function(_0x21ab7b,_0x32664a){var _0x1f86ec=sox[_0xdb68('0x20')](_0x2749d2,_0x1c3cab,{'sampleRate':0x1f40,'format':_0xdb68('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1f86ec['on'](_0xdb68('0x12'),function(_0x5afb8c){logger[_0xdb68('0x12')](_0xdb68('0x22'),_0x5afb8c);_0x32664a(_0x5afb8c);});_0x1f86ec['on'](_0xdb68('0x1e'),function(){logger[_0xdb68('0x19')]('finish\x20to\x20convert');_0x21ab7b();});_0x1f86ec[_0xdb68('0x23')]();});}function base64Decode(_0x125c34,_0x47821f){var _0x192d35=path[_0xdb68('0x24')](__dirname,'tmp',rs['generate'](0x4)+_0xdb68('0x25'));fs[_0xdb68('0x26')](_0x192d35,_0x125c34,'base64');return convertFile(_0x192d35,_0x47821f)[_0xdb68('0x27')](function(){try{fs[_0xdb68('0x28')](_0x192d35);fs[_0xdb68('0x29')](_0x47821f,_0xdb68('0x2a'));}catch(_0x195d82){logger['error'](_0x195d82);}return _0x47821f['split']('.')[0x0];});}function base64Encode(_0x46cd1f){var _0x1e08af=fs[_0xdb68('0x2b')](_0x46cd1f);return new Buffer(_0x1e08af)['toString'](_0xdb68('0x2c'));}exports[_0xdb68('0x2d')]=function(_0x5fd012,_0x18d8a1,_0xd70c8,_0x452d35,_0x525230,_0xaba612){var _0x5861d7,_0xaa6173;var _0x9c1746='https://texttospeech.googleapis.com/v1/';var _0x399105='?key='+_0x5fd012;var _0x449e5b={};if(_0x18d8a1==='ssml'){_0x449e5b['input']={'ssml':_0xd70c8};}else{_0x449e5b[_0xdb68('0x2e')]={'text':_0xd70c8};};_0x449e5b[_0xdb68('0x2f')]={'languageCode':_0x452d35,'ssmlGender':_0x525230};_0x449e5b['audioConfig']={'audioEncoding':_0xdb68('0x30'),'sampleRateHertz':0x1f40};var _0x49ee4d={'url':_0x9c1746+_0xdb68('0x31')+_0x399105,'method':_0xdb68('0x32'),'json':!![],'body':_0x449e5b};return rp(_0x49ee4d)[_0xdb68('0x27')](function(_0x3333cd){return new BPromise(function(_0x2bc9c6,_0xf5e8f7){_0x5861d7=path[_0xdb68('0x24')](__dirname,_0xdb68('0x33'),rs[_0xdb68('0x34')](0x4)+_0xdb68('0x35'));var _0x1082fd=Buffer[_0xdb68('0x36')](_0x3333cd[_0xdb68('0x37')],'base64');return fs[_0xdb68('0x38')](_0x5861d7,_0x1082fd,function(_0x22579d){_0xf5e8f7(_0x22579d);},function(_0x3bcd41){fs[_0xdb68('0x29')](_0x5861d7,_0xdb68('0x2a'));_0x2bc9c6(_0x3bcd41);});});})[_0xdb68('0x27')](function(_0x3a740c){_0xaa6173=path[_0xdb68('0x24')](__dirname,_0xdb68('0x33'),rs[_0xdb68('0x34')](0x4)+'.wav');return convertFile(_0x5861d7,_0xaa6173);})['then'](function(){try{fs['unlink'](_0x5861d7);fs[_0xdb68('0x29')](_0xaa6173,_0xdb68('0x2a'));}catch(_0x2b270a){logger[_0xdb68('0x12')](_0x2b270a);}logger['info'](_0xdb68('0x39'),_0xaa6173[_0xdb68('0x3a')]('.')[0x0]);return _0xaa6173['split']('.')[0x0];});};exports[_0xdb68('0x3b')]=function(_0x4c8d3b,_0x1b02ee){var _0x732f97,_0x117deb;return tts(_0x4c8d3b,_0x1b02ee||'en',0x1)[_0xdb68('0x27')](function(_0x1eb7d5){logger[_0xdb68('0x19')](_0x1eb7d5);_0x732f97=path[_0xdb68('0x24')](__dirname,_0xdb68('0x33'),rs[_0xdb68('0x34')](0x4)+_0xdb68('0x35'));return downloadFile(_0x1eb7d5,_0x732f97);})['then'](function(){_0x117deb=path[_0xdb68('0x24')](__dirname,_0xdb68('0x33'),rs[_0xdb68('0x34')](0x4)+_0xdb68('0x25'));return convertFile(_0x732f97,_0x117deb);})['then'](function(){try{fs[_0xdb68('0x28')](_0x732f97);fs[_0xdb68('0x29')](_0x117deb,_0xdb68('0x2a'));}catch(_0x4eb65e){logger['error'](_0x4eb65e);}logger[_0xdb68('0x19')]('goggleTTS\x20path',_0x117deb[_0xdb68('0x3a')]('.')[0x0]);return _0x117deb[_0xdb68('0x3a')]('.')[0x0];});};exports[_0xdb68('0x3c')]=function(_0x2df00f,_0x3879c1,_0x5f1c6d){return google['asr'](_0x2df00f,_0x3879c1,_0x5f1c6d)[_0xdb68('0x27')](function(_0x18ae26){logger['info'](_0x18ae26[_0xdb68('0x3d')]);return rp(_0x18ae26);})['then'](function(_0x3d66d8){var _0x22cf0b='';var _0x453049=0x0;try{fs['unlink'](_0x2df00f);}catch(_0x321116){logger[_0xdb68('0x12')](_0x321116);}if(_0x3d66d8&&_0x3d66d8[_0xdb68('0x3e')]){_0x22cf0b=_0x3d66d8[_0xdb68('0x3e')]['map'](function(_0x4fdf4e){return _0x4fdf4e&&_0x4fdf4e[_0xdb68('0x3f')][0x0]&&_0x4fdf4e['alternatives'][0x0][_0xdb68('0x40')]?_0x4fdf4e[_0xdb68('0x3f')][0x0][_0xdb68('0x40')]:'';})[_0xdb68('0x41')]('\x0a');_0x453049=_0x3d66d8[_0xdb68('0x3e')][_0xdb68('0x42')](function(_0x2a3c9d){return _0x2a3c9d&&_0x2a3c9d[_0xdb68('0x3f')][0x0]&&_0x2a3c9d[_0xdb68('0x3f')][0x0][_0xdb68('0x43')]?_0x2a3c9d[_0xdb68('0x3f')][0x0][_0xdb68('0x43')]:0x0;})[_0xdb68('0x41')]('\x0a');}logger['info']('googleASR\x20transcription',_0x22cf0b);logger['info']('googleASR\x20confidence',_0x453049);return{'transcript':_0x22cf0b,'confidence':_0x453049};})[_0xdb68('0x44')](function(_0x121f30){logger[_0xdb68('0x12')](_0xdb68('0x45'),_0x121f30[_0xdb68('0x14')],_0x121f30[_0xdb68('0x46')],_0x121f30[_0xdb68('0x47')]);});};exports['googleDialogflow']=function(_0x3988e0,_0x2db5ec,_0x2cd109,_0x960f1c){var _0x59cfe8=apiai(_0x2db5ec,{'language':_0x960f1c||'en'});return _0x59cfe8['textRequest'](_0x2cd109,{'sessionId':md5(_0x3988e0)})[_0xdb68('0x27')](function(_0x479528){logger[_0xdb68('0x19')](JSON[_0xdb68('0x48')](_0x479528));return{'source':_0x479528[_0xdb68('0x49')][_0xdb68('0x4a')],'resolvedQuery':_0x479528[_0xdb68('0x49')][_0xdb68('0x4b')],'action':_0x479528[_0xdb68('0x49')]['action'],'actionIncomplete':_0x479528[_0xdb68('0x49')][_0xdb68('0x4c')],'speech':_0x479528['result'][_0xdb68('0x4d')][_0xdb68('0x4e')],'score':_0x479528['result'][_0xdb68('0x4f')],'statusCode':_0x479528[_0xdb68('0x50')][_0xdb68('0x51')],'endConversation':_0x479528[_0xdb68('0x49')]['metadata']['endConversation']||![],'isFallbackIntent':_0x479528[_0xdb68('0x49')][_0xdb68('0x52')][_0xdb68('0x53')]};});};exports['tildeASR']=function(_0x580472,_0x647fd1,_0x94ec7b,_0x8add9){return tilde['asr'](_0x580472,_0x647fd1,_0x94ec7b,_0x8add9)[_0xdb68('0x27')](function(_0x480a4c){try{fs[_0xdb68('0x28')](_0x580472);}catch(_0x7402dc){logger['error'](_0x7402dc);}logger[_0xdb68('0x19')](_0xdb68('0x54'),_0x480a4c[_0xdb68('0x40')]);logger[_0xdb68('0x19')]('Tilde\x20ASR\x20confidence',_0x480a4c['confidence']);return _0x480a4c;});};exports['awsPolly']=function(_0x1a7b0d,_0x528e80,_0x1e6c32,_0x252715,_0x29627e,_0x16c8ca){var _0x14b807=path[_0xdb68('0x24')](__dirname,_0xdb68('0x33'),rs[_0xdb68('0x34')](0x4)+_0xdb68('0x35'));var _0x12a624;return aws['polly'](_0x1a7b0d,_0x528e80,_0x1e6c32,_0x252715,_0x29627e,_0x16c8ca,_0x14b807)[_0xdb68('0x27')](function(){_0x12a624=path['resolve'](__dirname,_0xdb68('0x33'),rs[_0xdb68('0x34')](0x4)+_0xdb68('0x25'));return convertFile(_0x14b807,_0x12a624);})['then'](function(){try{fs[_0xdb68('0x28')](_0x14b807);fs['chmodSync'](_0x12a624,_0xdb68('0x2a'));}catch(_0x144319){logger[_0xdb68('0x12')](_0x144319);}return _0x12a624[_0xdb68('0x3a')]('.')[0x0];});};exports['awsLex']=function(_0x39b048,_0x2894ad,_0x21ae45,_0x448d10,_0x3c0587,_0x5862cb){return aws[_0xdb68('0x55')](_0x39b048,_0x2894ad,_0x21ae45,_0x448d10,_0x3c0587,_0x5862cb)[_0xdb68('0x27')](function(_0x21889a){logger[_0xdb68('0x19')](JSON[_0xdb68('0x48')](_0x21889a));return _0x21889a;});};exports['ispeechTTS']=function(_0x5194f0,_0x1c7fe4,_0x463058,_0x36c88a){var _0x482194=util['format'](_0xdb68('0x56'),ISPEECH_API,_0x5194f0,encodeURIComponent(_0x1c7fe4),_0x463058,_0x36c88a);var _0x540fcf=path[_0xdb68('0x24')](__dirname,_0xdb68('0x33'),rs[_0xdb68('0x34')](0x4)+'.mp3');var _0x45fb86;return downloadFile(_0x482194,_0x540fcf)[_0xdb68('0x27')](function(){_0x45fb86=path[_0xdb68('0x24')](__dirname,_0xdb68('0x33'),rs['generate'](0x4)+_0xdb68('0x25'));return convertFile(_0x540fcf,_0x45fb86);})[_0xdb68('0x27')](function(){try{fs[_0xdb68('0x28')](_0x540fcf);fs[_0xdb68('0x29')](_0x45fb86,_0xdb68('0x2a'));}catch(_0x514c7f){logger[_0xdb68('0x12')](_0x514c7f);}return _0x45fb86[_0xdb68('0x3a')]('.')[0x0];});};exports[_0xdb68('0x57')]=function(_0x513a95,_0x2ebfaf,_0x25da78,_0x28b3ae){var _0x5c75fd=util[_0xdb68('0x58')](_0xdb68('0x59'),ISPEECH_API,_0x2ebfaf,_0x25da78,base64Encode(_0x513a95),_0x28b3ae?util[_0xdb68('0x58')](_0xdb68('0x5a'),encodeURIComponent(_0x28b3ae)):_0xdb68('0x5b'));return uploadFile(_0x5c75fd)[_0xdb68('0x27')](function(_0x507f82){return querystring['parse'](_0x507f82);});};exports['sestekNDA']=function(_0x14d2a6,_0x138a51){return sestek['nda'](_0x14d2a6,_0x138a51)[_0xdb68('0x27')](function(_0x3ff439){logger[_0xdb68('0x19')](JSON[_0xdb68('0x48')](_0x3ff439));var _0x398f5b={'speech':_0x3ff439['text'],'action':_0x3ff439[_0xdb68('0x5c')]?_0x3ff439[_0xdb68('0x5c')]['CustomAction']:undefined,'actiondata':_0x3ff439[_0xdb68('0x5c')]?_0x3ff439[_0xdb68('0x5c')][_0xdb68('0x5d')]:undefined};if(_0x3ff439['channelData']&&_0x3ff439['channelData'][_0xdb68('0x5e')]){return base64Decode(_0x3ff439[_0xdb68('0x5c')][_0xdb68('0x5e')][_0xdb68('0x5f')],path[_0xdb68('0x24')](__dirname,_0xdb68('0x33'),rs[_0xdb68('0x34')](0x4)+'.wav'))[_0xdb68('0x27')](function(_0x1bf864){_0x398f5b[_0xdb68('0x60')]=_0x1bf864;return _0x398f5b;});}return _0x398f5b;});};exports[_0xdb68('0x61')]=function(){return __dirname;}; \ No newline at end of file +var _0x6bf8=['voice','MP3','text:synthesize','POST','resolve','from','audioContent','writeFile','chmodSync','googleCloudTTS\x20path','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','stringify','result','source','resolvedQuery','speech','score','status','metadata','endConversation','isFallbackIntent','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','.mp3','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','format','model=%s','freeform=3','sestekNDA','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','path','http','url','bluebird','randomstring','request-promise','querystring','google-tts-api','apiai-promise','md5','./google','./aws','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','host','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','close','unlink','https:','statusCode','data','end','transcode','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x6bf8,0x177));var _0x86bf=function(_0x2b5494,_0x56fe1d){_0x2b5494=_0x2b5494-0x0;var _0x419d6d=_0x6bf8[_0x2b5494];return _0x419d6d;};'use strict';var fs=require('fs');var path=require(_0x86bf('0x0'));var http=require(_0x86bf('0x1'));var https=require('https');var urlParse=require(_0x86bf('0x2'))['parse'];var BPromise=require(_0x86bf('0x3'));var rs=require(_0x86bf('0x4'));var sox=require('sox');var rp=require(_0x86bf('0x5'));var util=require('util');var querystring=require(_0x86bf('0x6'));var tts=require(_0x86bf('0x7'));var apiai=require(_0x86bf('0x8'));var md5=require(_0x86bf('0x9'));var google=require(_0x86bf('0xa'));var aws=require(_0x86bf('0xb'));var tilde=require(_0x86bf('0xc'));var sestek=require('./sestek');var logger=require(_0x86bf('0xd'))(_0x86bf('0xe'));var ISPEECH_API=_0x86bf('0xf');function downloadFile(_0x44d01a,_0xc5c2ec){return new BPromise(function(_0x3db067,_0x4a4187){var _0x2714bf=urlParse(_0x44d01a);var _0x5c3eff=_0x2714bf['protocol']==='https:'?https:http;var _0x30aa95={'host':_0x2714bf[_0x86bf('0x10')],'path':_0x2714bf[_0x86bf('0x0')],'headers':{'user-agent':_0x86bf('0x11')}};_0x5c3eff[_0x86bf('0x12')](_0x30aa95,function(_0x1e3c10){if(_0x1e3c10['statusCode']!==0xc8){logger[_0x86bf('0x13')](_0x86bf('0x14')+_0x44d01a+_0x86bf('0x15')+_0x1e3c10['statusCode']+'\x20('+_0x1e3c10[_0x86bf('0x16')]+')');_0x4a4187(new Error(_0x86bf('0x14')+_0x44d01a+'\x20failed,\x20status\x20code\x20=\x20'+_0x1e3c10['statusCode']+'\x20('+_0x1e3c10['statusMessage']+')'));return;}var _0x20d402=fs['createWriteStream'](_0xc5c2ec);_0x20d402['on'](_0x86bf('0x17'),function(){logger[_0x86bf('0x18')]('finish\x20download\x20file');_0x20d402[_0x86bf('0x19')](_0x3db067);});_0x20d402['on'](_0x86bf('0x13'),function(_0x51c5d2){fs[_0x86bf('0x1a')](_0xc5c2ec);logger[_0x86bf('0x13')]('download\x20error',_0x51c5d2);_0x4a4187(_0x51c5d2);});_0x1e3c10['pipe'](_0x20d402);})['on'](_0x86bf('0x13'),function(_0x2d92eb){logger[_0x86bf('0x13')](_0x2d92eb);_0x4a4187(_0x2d92eb);})['end']();});}function uploadFile(_0x404daa){return new BPromise(function(_0x3e60b4,_0x49b473){var _0x205d6d=urlParse(_0x404daa);var _0x2cd432=_0x205d6d['protocol']===_0x86bf('0x1b')?https:http;var _0x3cb4cb={'host':_0x205d6d[_0x86bf('0x10')],'path':_0x205d6d[_0x86bf('0x0')],'headers':{'user-agent':_0x86bf('0x11')}};_0x2cd432[_0x86bf('0x12')](_0x3cb4cb,function(_0x5f8b0){if(_0x5f8b0[_0x86bf('0x1c')]!==0xc8){_0x49b473(new Error(_0x86bf('0x14')+_0x404daa+_0x86bf('0x15')+_0x5f8b0[_0x86bf('0x1c')]+'\x20('+_0x5f8b0[_0x86bf('0x16')]+')'));return;}var _0x51aa31='';_0x5f8b0['on'](_0x86bf('0x1d'),function(_0x4b1525){_0x51aa31+=_0x4b1525;});_0x5f8b0['on']('end',function(){_0x3e60b4(_0x51aa31);});})['on']('error',function(_0x22ed49){_0x49b473(_0x22ed49);})[_0x86bf('0x1e')]();});}function convertFile(_0xfe850f,_0x1f6f16){return new BPromise(function(_0x1a774f,_0x420e8f){var _0xeaa613=sox[_0x86bf('0x1f')](_0xfe850f,_0x1f6f16,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xeaa613['on'](_0x86bf('0x13'),function(_0x3c618b){logger[_0x86bf('0x13')]('error\x20convert',_0x3c618b);_0x420e8f(_0x3c618b);});_0xeaa613['on'](_0x86bf('0x1e'),function(){logger[_0x86bf('0x18')](_0x86bf('0x20'));_0x1a774f();});_0xeaa613[_0x86bf('0x21')]();});}function base64Decode(_0x3e35,_0x4cf47b){var _0x28cc37=path['resolve'](__dirname,_0x86bf('0x22'),rs[_0x86bf('0x23')](0x4)+_0x86bf('0x24'));fs[_0x86bf('0x25')](_0x28cc37,_0x3e35,_0x86bf('0x26'));return convertFile(_0x28cc37,_0x4cf47b)[_0x86bf('0x27')](function(){try{fs[_0x86bf('0x1a')](_0x28cc37);fs['chmodSync'](_0x4cf47b,_0x86bf('0x28'));}catch(_0x721625){logger[_0x86bf('0x13')](_0x721625);}return _0x4cf47b[_0x86bf('0x29')]('.')[0x0];});}function base64Encode(_0x1ef8db){var _0x306403=fs[_0x86bf('0x2a')](_0x1ef8db);return new Buffer(_0x306403)[_0x86bf('0x2b')]('base64');}exports[_0x86bf('0x2c')]=function(_0x2252b5,_0xf97345,_0x2af80f,_0x2fa724,_0x58606c,_0x23936d){var _0x1d33b1,_0x220930;var _0x4f8433=_0x86bf('0x2d');var _0x38d0f4=_0x86bf('0x2e')+_0x2252b5;var _0xed8d4={};if(_0xf97345===_0x86bf('0x2f')){_0xed8d4[_0x86bf('0x30')]={'ssml':_0x2af80f};}else{_0xed8d4[_0x86bf('0x30')]={'text':_0x2af80f};};_0xed8d4[_0x86bf('0x31')]={'languageCode':_0x2fa724,'ssmlGender':_0x58606c};_0xed8d4['audioConfig']={'audioEncoding':_0x86bf('0x32'),'sampleRateHertz':0x1f40};var _0x586682={'url':_0x4f8433+_0x86bf('0x33')+_0x38d0f4,'method':_0x86bf('0x34'),'json':!![],'body':_0xed8d4};return rp(_0x586682)['then'](function(_0x399a38){return new BPromise(function(_0x4feaab,_0x9e1e89){_0x1d33b1=path[_0x86bf('0x35')](__dirname,'tmp',rs[_0x86bf('0x23')](0x4)+'.mp3');var _0x4aaa4b=Buffer[_0x86bf('0x36')](_0x399a38[_0x86bf('0x37')],_0x86bf('0x26'));return fs[_0x86bf('0x38')](_0x1d33b1,_0x4aaa4b,function(_0x3ee23d){_0x9e1e89(_0x3ee23d);},function(_0xec15fa){fs[_0x86bf('0x39')](_0x1d33b1,_0x86bf('0x28'));_0x4feaab(_0xec15fa);});});})[_0x86bf('0x27')](function(_0x375485){_0x220930=path['resolve'](__dirname,_0x86bf('0x22'),rs[_0x86bf('0x23')](0x4)+'.wav');return convertFile(_0x1d33b1,_0x220930);})[_0x86bf('0x27')](function(){try{fs[_0x86bf('0x1a')](_0x1d33b1);fs[_0x86bf('0x39')](_0x220930,_0x86bf('0x28'));}catch(_0x4d16aa){logger[_0x86bf('0x13')](_0x4d16aa);}logger['info'](_0x86bf('0x3a'),_0x220930['split']('.')[0x0]);return _0x220930[_0x86bf('0x29')]('.')[0x0];});};exports['googleTTS']=function(_0x4e8c1f,_0x56cf9c){var _0x12296f,_0xe55270;return tts(_0x4e8c1f,_0x56cf9c||'en',0x1)['then'](function(_0x3022b1){logger[_0x86bf('0x18')](_0x3022b1);_0x12296f=path[_0x86bf('0x35')](__dirname,_0x86bf('0x22'),rs[_0x86bf('0x23')](0x4)+'.mp3');return downloadFile(_0x3022b1,_0x12296f);})[_0x86bf('0x27')](function(){_0xe55270=path['resolve'](__dirname,_0x86bf('0x22'),rs[_0x86bf('0x23')](0x4)+_0x86bf('0x24'));return convertFile(_0x12296f,_0xe55270);})[_0x86bf('0x27')](function(){try{fs['unlink'](_0x12296f);fs[_0x86bf('0x39')](_0xe55270,_0x86bf('0x28'));}catch(_0x70342b){logger['error'](_0x70342b);}logger['info'](_0x86bf('0x3b'),_0xe55270[_0x86bf('0x29')]('.')[0x0]);return _0xe55270['split']('.')[0x0];});};exports[_0x86bf('0x3c')]=function(_0x488630,_0x574a51,_0x401371){return google[_0x86bf('0x3d')](_0x488630,_0x574a51,_0x401371)[_0x86bf('0x27')](function(_0x5bccb2){logger['info'](_0x5bccb2[_0x86bf('0x3e')]);return rp(_0x5bccb2);})['then'](function(_0x2ca222){var _0xbc49a6='';var _0x22a96e=0x0;try{fs['unlink'](_0x488630);}catch(_0x375768){logger['error'](_0x375768);}if(_0x2ca222&&_0x2ca222[_0x86bf('0x3f')]){_0xbc49a6=_0x2ca222[_0x86bf('0x3f')][_0x86bf('0x40')](function(_0x258c30){return _0x258c30&&_0x258c30[_0x86bf('0x41')][0x0]&&_0x258c30['alternatives'][0x0]['transcript']?_0x258c30['alternatives'][0x0][_0x86bf('0x42')]:'';})[_0x86bf('0x43')]('\x0a');_0x22a96e=_0x2ca222[_0x86bf('0x3f')]['map'](function(_0x45f6e7){return _0x45f6e7&&_0x45f6e7[_0x86bf('0x41')][0x0]&&_0x45f6e7['alternatives'][0x0][_0x86bf('0x44')]?_0x45f6e7[_0x86bf('0x41')][0x0]['confidence']:0x0;})[_0x86bf('0x43')]('\x0a');}logger['info'](_0x86bf('0x45'),_0xbc49a6);logger[_0x86bf('0x18')](_0x86bf('0x46'),_0x22a96e);return{'transcript':_0xbc49a6,'confidence':_0x22a96e};})[_0x86bf('0x47')](function(_0x4acf17){logger['error'](_0x86bf('0x48'),_0x4acf17[_0x86bf('0x1c')],_0x4acf17[_0x86bf('0x49')],_0x4acf17['message']);});};exports[_0x86bf('0x4a')]=function(_0x302d89,_0x3613c7,_0x50f136,_0x1c41b1){var _0x576920=apiai(_0x3613c7,{'language':_0x1c41b1||'en'});return _0x576920['textRequest'](_0x50f136,{'sessionId':md5(_0x302d89)})[_0x86bf('0x27')](function(_0x258db5){logger[_0x86bf('0x18')](JSON[_0x86bf('0x4b')](_0x258db5));return{'source':_0x258db5[_0x86bf('0x4c')][_0x86bf('0x4d')],'resolvedQuery':_0x258db5['result'][_0x86bf('0x4e')],'action':_0x258db5['result']['action'],'actionIncomplete':_0x258db5[_0x86bf('0x4c')]['actionIncomplete'],'speech':_0x258db5['result']['fulfillment'][_0x86bf('0x4f')],'score':_0x258db5[_0x86bf('0x4c')][_0x86bf('0x50')],'statusCode':_0x258db5[_0x86bf('0x51')]['code'],'endConversation':_0x258db5[_0x86bf('0x4c')][_0x86bf('0x52')][_0x86bf('0x53')]||![],'isFallbackIntent':_0x258db5[_0x86bf('0x4c')][_0x86bf('0x52')][_0x86bf('0x54')]};});};exports['tildeASR']=function(_0x111b94,_0xa8f391,_0x165ab1,_0x100088){return tilde[_0x86bf('0x3d')](_0x111b94,_0xa8f391,_0x165ab1,_0x100088)[_0x86bf('0x27')](function(_0x2fc258){try{fs['unlink'](_0x111b94);}catch(_0x3834bd){logger[_0x86bf('0x13')](_0x3834bd);}logger[_0x86bf('0x18')](_0x86bf('0x55'),_0x2fc258[_0x86bf('0x42')]);logger['info'](_0x86bf('0x56'),_0x2fc258[_0x86bf('0x44')]);return _0x2fc258;});};exports[_0x86bf('0x57')]=function(_0x46adf0,_0x737afe,_0x305b83,_0x579af8,_0x4d1491,_0x3a6e80){var _0x5a5646=path[_0x86bf('0x35')](__dirname,'tmp',rs[_0x86bf('0x23')](0x4)+_0x86bf('0x58'));var _0x4f5009;return aws[_0x86bf('0x59')](_0x46adf0,_0x737afe,_0x305b83,_0x579af8,_0x4d1491,_0x3a6e80,_0x5a5646)[_0x86bf('0x27')](function(){_0x4f5009=path[_0x86bf('0x35')](__dirname,_0x86bf('0x22'),rs[_0x86bf('0x23')](0x4)+_0x86bf('0x24'));return convertFile(_0x5a5646,_0x4f5009);})[_0x86bf('0x27')](function(){try{fs[_0x86bf('0x1a')](_0x5a5646);fs[_0x86bf('0x39')](_0x4f5009,_0x86bf('0x28'));}catch(_0x56e59a){logger[_0x86bf('0x13')](_0x56e59a);}return _0x4f5009[_0x86bf('0x29')]('.')[0x0];});};exports[_0x86bf('0x5a')]=function(_0x3627ba,_0x43f79f,_0x3870ac,_0x1eed27,_0x1685c1,_0x5baff7){return aws[_0x86bf('0x5b')](_0x3627ba,_0x43f79f,_0x3870ac,_0x1eed27,_0x1685c1,_0x5baff7)[_0x86bf('0x27')](function(_0x121c1b){logger[_0x86bf('0x18')](JSON[_0x86bf('0x4b')](_0x121c1b));return _0x121c1b;});};exports[_0x86bf('0x5c')]=function(_0xafd03b,_0x6095e9,_0x24ce34,_0x473ba1){var _0x29d1c3=util['format'](_0x86bf('0x5d'),ISPEECH_API,_0xafd03b,encodeURIComponent(_0x6095e9),_0x24ce34,_0x473ba1);var _0x5534a4=path[_0x86bf('0x35')](__dirname,_0x86bf('0x22'),rs['generate'](0x4)+_0x86bf('0x58'));var _0x5a2075;return downloadFile(_0x29d1c3,_0x5534a4)['then'](function(){_0x5a2075=path[_0x86bf('0x35')](__dirname,_0x86bf('0x22'),rs[_0x86bf('0x23')](0x4)+_0x86bf('0x24'));return convertFile(_0x5534a4,_0x5a2075);})[_0x86bf('0x27')](function(){try{fs['unlink'](_0x5534a4);fs[_0x86bf('0x39')](_0x5a2075,_0x86bf('0x28'));}catch(_0x2d4978){logger[_0x86bf('0x13')](_0x2d4978);}return _0x5a2075[_0x86bf('0x29')]('.')[0x0];});};exports['ispeechASR']=function(_0x348189,_0x369099,_0x4bef02,_0x107a33){var _0x3deda2=util['format'](_0x86bf('0x5e'),ISPEECH_API,_0x369099,_0x4bef02,base64Encode(_0x348189),_0x107a33?util[_0x86bf('0x5f')](_0x86bf('0x60'),encodeURIComponent(_0x107a33)):_0x86bf('0x61'));return uploadFile(_0x3deda2)[_0x86bf('0x27')](function(_0x172cf0){return querystring['parse'](_0x172cf0);});};exports[_0x86bf('0x62')]=function(_0x4999c0,_0x3b5bf8){return sestek['nda'](_0x4999c0,_0x3b5bf8)['then'](function(_0x518d32){logger[_0x86bf('0x18')](JSON[_0x86bf('0x4b')](_0x518d32));var _0x7c547d={'speech':_0x518d32[_0x86bf('0x63')],'action':_0x518d32[_0x86bf('0x64')]?_0x518d32[_0x86bf('0x64')]['CustomAction']:undefined,'actiondata':_0x518d32[_0x86bf('0x64')]?_0x518d32[_0x86bf('0x64')][_0x86bf('0x65')]:undefined};if(_0x518d32[_0x86bf('0x64')]&&_0x518d32[_0x86bf('0x64')][_0x86bf('0x66')]){return base64Decode(_0x518d32['channelData'][_0x86bf('0x66')][_0x86bf('0x67')],path[_0x86bf('0x35')](__dirname,_0x86bf('0x22'),rs[_0x86bf('0x23')](0x4)+_0x86bf('0x24')))['then'](function(_0x4d831a){_0x7c547d[_0x86bf('0x68')]=_0x4d831a;return _0x7c547d;});}return _0x7c547d;});};exports[_0x86bf('0x69')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index c5b4574..e5694a9 100644 --- a/server/services/agi/scripts/sestek/index.js +++ b/server/services/agi/scripts/sestek/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c0f=['./nda','exports'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0x6c0f,0x186));var _0xf6c0=function(_0x5e2e54,_0x42e06b){_0x5e2e54=_0x5e2e54-0x0;var _0x24334f=_0x6c0f[_0x5e2e54];return _0x24334f;};var nda=require(_0xf6c0('0x0'));module[_0xf6c0('0x1')]={'nda':nda}; \ No newline at end of file +var _0x3521=['exports'];(function(_0x25148e,_0x2dbfff){var _0x36284a=function(_0x117b04){while(--_0x117b04){_0x25148e['push'](_0x25148e['shift']());}};_0x36284a(++_0x2dbfff);}(_0x3521,0x179));var _0x1352=function(_0x4b824a,_0x275d05){_0x4b824a=_0x4b824a-0x0;var _0x3779ab=_0x3521[_0x4b824a];return _0x3779ab;};var nda=require('./nda');module[_0x1352('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 77dd960..92cc040 100644 --- a/server/services/agi/scripts/sestek/nda/index.js +++ b/server/services/agi/scripts/sestek/nda/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1ede=['channelData','AudioOutputSettings','audio/wav','CustomAction','custom_action_data','CustomActionData','info','../../../../../config/logger','agi','exports','POST','ndauth_url','password','username','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','text','Bearer\x20','project','body'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1ede,0x13b));var _0xe1ed=function(_0x349b03,_0x90520a){_0x349b03=_0x349b03-0x0;var _0x9b741a=_0x1ede[_0x349b03];return _0x9b741a;};'use strict';var rp=require('request-promise');var url=require('url');var logger=require(_0xe1ed('0x0'))(_0xe1ed('0x1'));module[_0xe1ed('0x2')]=function(_0xe257bc,_0x2213b5){var _0x2c6db5={'method':_0xe1ed('0x3'),'uri':url['resolve'](_0x2213b5[_0xe1ed('0x4')],'/token'),'form':{'grant_type':_0xe1ed('0x5'),'username':_0x2213b5[_0xe1ed('0x6')],'password':_0x2213b5[_0xe1ed('0x5')]},'json':!![]};return rp(_0x2c6db5)[_0xe1ed('0x7')](function(_0x57c362){var _0x58a169={'method':_0xe1ed('0x3'),'uri':url[_0xe1ed('0x8')](_0x2213b5[_0xe1ed('0x9')],_0xe1ed('0xa')),'body':{'type':_0x2213b5[_0xe1ed('0xb')]||_0xe1ed('0xc'),'channelId':_0xe1ed('0xd'),'conversation':{'id':_0xe257bc[_0xe1ed('0xe')]},'from':{'id':_0xe257bc[_0xe1ed('0xf')],'name':_0xe257bc[_0xe1ed('0x10')]},'recipient':{'id':_0xe257bc['dnid'],'name':_0xe257bc['extension']},'text':_0x2213b5[_0xe1ed('0x11')],'channelData':{}},'headers':{'Authorization':_0xe1ed('0x12')+_0x57c362['access_token']},'json':!![]};if(_0x2213b5[_0xe1ed('0x13')]){_0x58a169[_0xe1ed('0x14')][_0xe1ed('0x15')]['ProjectName']=_0x2213b5[_0xe1ed('0x13')];}if(_0x2213b5['ndagenerate_audio']=='1'){_0x58a169[_0xe1ed('0x14')][_0xe1ed('0x15')][_0xe1ed('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xe1ed('0x17')};}if(_0x2213b5['custom_action']){_0x58a169[_0xe1ed('0x14')][_0xe1ed('0x15')][_0xe1ed('0x18')]=_0x2213b5['custom_action'];if(_0x2213b5[_0xe1ed('0x19')]){_0x58a169[_0xe1ed('0x14')]['channelData'][_0xe1ed('0x1a')]=_0x2213b5[_0xe1ed('0x19')];}}logger[_0xe1ed('0x1b')](JSON['stringify'](_0x58a169));return rp(_0x58a169);});}; \ No newline at end of file +var _0xc0f6=['Nda','callerid','calleridname','dnid','extension','Bearer\x20','access_token','project','body','ProjectName','ndagenerate_audio','channelData','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','resolve','ndauth_url','/token','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message'];(function(_0x50583c,_0x2d2dee){var _0x358ba5=function(_0x1aa091){while(--_0x1aa091){_0x50583c['push'](_0x50583c['shift']());}};_0x358ba5(++_0x2d2dee);}(_0xc0f6,0xb9));var _0x6c0f=function(_0x23da4d,_0x63498c){_0x23da4d=_0x23da4d-0x0;var _0x4ae55=_0xc0f6[_0x23da4d];return _0x4ae55;};'use strict';var rp=require(_0x6c0f('0x0'));var url=require(_0x6c0f('0x1'));var logger=require(_0x6c0f('0x2'))(_0x6c0f('0x3'));module['exports']=function(_0x317d90,_0x2198eb){var _0x1f1184={'method':'POST','uri':url[_0x6c0f('0x4')](_0x2198eb[_0x6c0f('0x5')],_0x6c0f('0x6')),'form':{'grant_type':'password','username':_0x2198eb[_0x6c0f('0x7')],'password':_0x2198eb['password']},'json':!![]};return rp(_0x1f1184)[_0x6c0f('0x8')](function(_0x1fd684){var _0x35c56b={'method':'POST','uri':url[_0x6c0f('0x4')](_0x2198eb[_0x6c0f('0x9')],_0x6c0f('0xa')),'body':{'type':_0x2198eb[_0x6c0f('0xb')]||_0x6c0f('0xc'),'channelId':_0x6c0f('0xd'),'conversation':{'id':_0x317d90['uniqueid']},'from':{'id':_0x317d90[_0x6c0f('0xe')],'name':_0x317d90[_0x6c0f('0xf')]},'recipient':{'id':_0x317d90[_0x6c0f('0x10')],'name':_0x317d90[_0x6c0f('0x11')]},'text':_0x2198eb['text'],'channelData':{}},'headers':{'Authorization':_0x6c0f('0x12')+_0x1fd684[_0x6c0f('0x13')]},'json':!![]};if(_0x2198eb[_0x6c0f('0x14')]){_0x35c56b[_0x6c0f('0x15')]['channelData'][_0x6c0f('0x16')]=_0x2198eb[_0x6c0f('0x14')];}if(_0x2198eb[_0x6c0f('0x17')]=='1'){_0x35c56b[_0x6c0f('0x15')][_0x6c0f('0x18')][_0x6c0f('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6c0f('0x1a')};}if(_0x2198eb[_0x6c0f('0x1b')]){_0x35c56b['body'][_0x6c0f('0x18')][_0x6c0f('0x1c')]=_0x2198eb[_0x6c0f('0x1b')];if(_0x2198eb[_0x6c0f('0x1d')]){_0x35c56b['body']['channelData'][_0x6c0f('0x1e')]=_0x2198eb[_0x6c0f('0x1d')];}}logger[_0x6c0f('0x1f')](JSON[_0x6c0f('0x20')](_0x35c56b));return rp(_0x35c56b);});}; \ 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 776b2f3..9555e1c 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 _0xf8ee=['exports','./lib/api'];(function(_0x3f4ed1,_0x2b5dad){var _0x26b597=function(_0x44edb3){while(--_0x44edb3){_0x3f4ed1['push'](_0x3f4ed1['shift']());}};_0x26b597(++_0x2b5dad);}(_0xf8ee,0xff));var _0xef8e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf8ee[_0x122ef9];return _0x42fba0;};'use strict';var asr=require(_0xef8e('0x0'));module[_0xef8e('0x1')]=function(_0x41be07,_0x51be47,_0x579908,_0x4b68ce){return asr(_0x41be07,_0x51be47,_0x579908,_0x4b68ce);}; \ No newline at end of file +var _0x9633=['./lib/api','exports'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x9633,0x148));var _0x3963=function(_0x5a61f9,_0x537e3e){_0x5a61f9=_0x5a61f9-0x0;var _0xae67b2=_0x9633[_0x5a61f9];return _0xae67b2;};'use strict';var asr=require(_0x3963('0x0'));module[_0x3963('0x1')]=function(_0x6abcc5,_0x293560,_0xde15fb,_0x382452){return asr(_0x6abcc5,_0x293560,_0xde15fb,_0x382452);}; \ 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 93c7b48..0094c42 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 _0x041c=['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','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','EOS','error','terminate','parse','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports'];(function(_0x47c52e,_0x34721a){var _0x4ee659=function(_0x897944){while(--_0x897944){_0x47c52e['push'](_0x47c52e['shift']());}};_0x4ee659(++_0x34721a);}(_0x041c,0xdd));var _0xc041=function(_0x537b07,_0x3a3855){_0x537b07=_0x537b07-0x0;var _0x371389=_0x041c[_0x537b07];return _0x371389;};'use strict';var BPromise=require(_0xc041('0x0'));var _=require(_0xc041('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xc041('0x2'));var crypto=require(_0xc041('0x3'));var logger=require(_0xc041('0x4'))(_0xc041('0x5'));module[_0xc041('0x6')]=function(_0x3b5e66,_0x4ee9bb,_0x47eee8,_0x1f9420){return new BPromise(function(_0x364169,_0x1b7d79){logger[_0xc041('0x7')]('Tilde\x20URI',_0x1f9420||_0xc041('0x8'));var _0x3965e5=new WebSocket(_0x1f9420||_0xc041('0x8'),{'perMessageDeflate':![]});var _0x50b9fb='';var _0x5a03ec='0';var _0x3d87b5='1';var _0x7517a3=_0xc041('0x9');function _0x327124(_0x1dc027){var _0x18acff=crypto['createHash'](_0xc041('0xa'));_0x18acff[_0xc041('0xb')](_0x1dc027);return _0x18acff[_0xc041('0xc')](_0xc041('0xd'));}function _0x1a597b(){try{logger[_0xc041('0x7')](_0xc041('0xe'));var _0x54c491=moment()[_0xc041('0xf')]();var _0xe98eda=_0x327124(_0x54c491+_0x4ee9bb+_0x47eee8);_0x3965e5[_0xc041('0x10')](JSON[_0xc041('0x11')]({'appID':_0x4ee9bb,'timestamp':_0x54c491,'appKey':_0xe98eda}));var _0xc74b87=fs['createReadStream'](_0x3b5e66);_0xc74b87['on'](_0xc041('0x12'),function(_0x172d13){_0x3965e5[_0xc041('0x10')](_0x172d13);});_0xc74b87['on'](_0xc041('0x13'),function(){_0x3965e5[_0xc041('0x10')](_0xc041('0x14'));});}catch(_0x24efa1){logger[_0xc041('0x15')]('Tilde\x20ASR\x20send\x20error',JSON[_0xc041('0x11')](_0x24efa1));_0x3965e5[_0xc041('0x16')]();}}function _0x5d470f(_0x4f91ec){try{if(_0x4f91ec){var _0x43a805=JSON[_0xc041('0x17')](_0x4f91ec);switch(_0x43a805['status']){case 0x0:if(_0x43a805['result']){if(_0x43a805[_0xc041('0x18')]['final']){logger[_0xc041('0x7')](_0xc041('0x19'),JSON[_0xc041('0x11')](_0x43a805[_0xc041('0x18')]['hypotheses']));_0x50b9fb=_0x43a805[_0xc041('0x18')][_0xc041('0x1a')][0x0][_0xc041('0x1b')];_0x5a03ec=_0x43a805[_0xc041('0x18')]['hypotheses'][0x0][_0xc041('0x1c')];_0x3d87b5='0';_0x7517a3='Success.';_0x3965e5[_0xc041('0x16')]();}}break;case 0x1:logger[_0xc041('0x7')](_0xc041('0x9'));_0x3d87b5='1';_0x7517a3=_0xc041('0x9');break;case 0x2:logger[_0xc041('0x7')](_0xc041('0x1d'));_0x3d87b5='2';_0x7517a3=_0xc041('0x1d');break;case 0x9:logger['info'](_0xc041('0x1e'));_0x3d87b5='9';_0x7517a3=_0xc041('0x1e');break;case 0xa:logger[_0xc041('0x7')](_0xc041('0x1f'));_0x3d87b5='10';_0x7517a3='Authentication\x20failed.';break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x3d87b5='11';_0x7517a3='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x35cf5d){logger[_0xc041('0x15')](_0xc041('0x20'),JSON[_0xc041('0x11')](_0x35cf5d));_0x3965e5[_0xc041('0x16')]();}}function _0x4da30c(){logger[_0xc041('0x7')](_0xc041('0x21'));_0x364169({'transcript':_0x50b9fb,'confidence':_0x5a03ec,'status':_0x3d87b5,'status_message':_0x7517a3});}function _0x4f2557(_0x7bfe44){logger[_0xc041('0x15')](_0xc041('0x22'));if(!_[_0xc041('0x23')](_0x7bfe44)){logger[_0xc041('0x15')](_['isObject'](_0x7bfe44)?JSON[_0xc041('0x11')](_0x7bfe44):_0x7bfe44);}}_0x3965e5['on'](_0xc041('0x24'),_0x1a597b);_0x3965e5['on'](_0xc041('0x25'),_0x5d470f);_0x3965e5['on'](_0xc041('0x13'),_0x4da30c);_0x3965e5['on']('error',_0x4f2557);});}; \ No newline at end of file +var _0xc6b5=['isNil','isObject','open','message','bluebird','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','transcript','hypotheses','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket'];(function(_0x5ebf10,_0x2f1aaa){var _0x3ecc0a=function(_0x38383f){while(--_0x38383f){_0x5ebf10['push'](_0x5ebf10['shift']());}};_0x3ecc0a(++_0x2f1aaa);}(_0xc6b5,0xac));var _0x5c6b=function(_0x491e10,_0x266113){_0x491e10=_0x491e10-0x0;var _0x1a5d6e=_0xc6b5[_0x491e10];return _0x1a5d6e;};'use strict';var BPromise=require(_0x5c6b('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x5c6b('0x1'));var logger=require(_0x5c6b('0x2'))(_0x5c6b('0x3'));module[_0x5c6b('0x4')]=function(_0x4a53e0,_0x294d9c,_0xa25be2,_0x4ef39d){return new BPromise(function(_0x15abc4,_0x59824d){logger[_0x5c6b('0x5')](_0x5c6b('0x6'),_0x4ef39d||_0x5c6b('0x7'));var _0x1e629d=new WebSocket(_0x4ef39d||_0x5c6b('0x7'),{'perMessageDeflate':![]});var _0x1ef61a='';var _0x4f3c9a='0';var _0x435aec='1';var _0x99b725=_0x5c6b('0x8');function _0x283928(_0x3639a0){var _0x255354=crypto[_0x5c6b('0x9')](_0x5c6b('0xa'));_0x255354[_0x5c6b('0xb')](_0x3639a0);return _0x255354[_0x5c6b('0xc')](_0x5c6b('0xd'));}function _0xc6e7b3(){try{logger[_0x5c6b('0x5')](_0x5c6b('0xe'));var _0x57cac8=moment()[_0x5c6b('0xf')]();var _0x575117=_0x283928(_0x57cac8+_0x294d9c+_0xa25be2);_0x1e629d[_0x5c6b('0x10')](JSON['stringify']({'appID':_0x294d9c,'timestamp':_0x57cac8,'appKey':_0x575117}));var _0x375bc9=fs[_0x5c6b('0x11')](_0x4a53e0);_0x375bc9['on'](_0x5c6b('0x12'),function(_0x3e1e10){_0x1e629d[_0x5c6b('0x10')](_0x3e1e10);});_0x375bc9['on'](_0x5c6b('0x13'),function(){_0x1e629d[_0x5c6b('0x10')](_0x5c6b('0x14'));});}catch(_0x536996){logger[_0x5c6b('0x15')](_0x5c6b('0x16'),JSON[_0x5c6b('0x17')](_0x536996));_0x1e629d[_0x5c6b('0x18')]();}}function _0x18bec0(_0x116abb){try{if(_0x116abb){var _0x5af775=JSON[_0x5c6b('0x19')](_0x116abb);switch(_0x5af775[_0x5c6b('0x1a')]){case 0x0:if(_0x5af775[_0x5c6b('0x1b')]){if(_0x5af775['result']['final']){logger[_0x5c6b('0x5')](_0x5c6b('0x1c'),JSON[_0x5c6b('0x17')](_0x5af775[_0x5c6b('0x1b')]['hypotheses']));_0x1ef61a=_0x5af775[_0x5c6b('0x1b')]['hypotheses'][0x0][_0x5c6b('0x1d')];_0x4f3c9a=_0x5af775['result'][_0x5c6b('0x1e')][0x0]['likelihood'];_0x435aec='0';_0x99b725=_0x5c6b('0x1f');_0x1e629d['terminate']();}}break;case 0x1:logger[_0x5c6b('0x5')](_0x5c6b('0x8'));_0x435aec='1';_0x99b725=_0x5c6b('0x8');break;case 0x2:logger[_0x5c6b('0x5')](_0x5c6b('0x20'));_0x435aec='2';_0x99b725='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x5c6b('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x435aec='9';_0x99b725='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info']('Authentication\x20failed.');_0x435aec='10';_0x99b725=_0x5c6b('0x21');break;case 0xb:logger[_0x5c6b('0x5')](_0x5c6b('0x22'));_0x435aec='11';_0x99b725='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x51863f){logger[_0x5c6b('0x15')](_0x5c6b('0x23'),JSON[_0x5c6b('0x17')](_0x51863f));_0x1e629d[_0x5c6b('0x18')]();}}function _0xe22ca0(){logger[_0x5c6b('0x5')](_0x5c6b('0x24'));_0x15abc4({'transcript':_0x1ef61a,'confidence':_0x4f3c9a,'status':_0x435aec,'status_message':_0x99b725});}function _0xcadc07(_0x3c1baa){logger[_0x5c6b('0x15')](_0x5c6b('0x25'));if(!_[_0x5c6b('0x26')](_0x3c1baa)){logger[_0x5c6b('0x15')](_[_0x5c6b('0x27')](_0x3c1baa)?JSON['stringify'](_0x3c1baa):_0x3c1baa);}}_0x1e629d['on'](_0x5c6b('0x28'),_0xc6e7b3);_0x1e629d['on'](_0x5c6b('0x29'),_0x18bec0);_0x1e629d['on'](_0x5c6b('0x13'),_0xe22ca0);_0x1e629d['on']('error',_0xcadc07);});}; \ 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 c0e98f3..10cb4be 100644 --- a/server/services/agi/scripts/tilde/index.js +++ b/server/services/agi/scripts/tilde/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0901=['./asr'];(function(_0x222bd3,_0x4c9a4f){var _0x4bed46=function(_0x4a0261){while(--_0x4a0261){_0x222bd3['push'](_0x222bd3['shift']());}};_0x4bed46(++_0x4c9a4f);}(_0x0901,0xb6));var _0x1090=function(_0x4bd638,_0x37bdf9){_0x4bd638=_0x4bd638-0x0;var _0x3605dd=_0x0901[_0x4bd638];return _0x3605dd;};var asr=require(_0x1090('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 2f82696..71e6f27 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 _0xe914=['getConnections','error','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','util','net','EventEmitter','./error','./channel','127.0.0.1','call','E_AGI_ARGUMENT_PORT','listening','emit','connection'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xe914,0x7f));var _0x4e91=function(_0x3e0058,_0xcb5844){_0x3e0058=_0x3e0058-0x0;var _0x307c16=_0xe914[_0x3e0058];return _0x307c16;};'use strict';var util=require(_0x4e91('0x0'));var net=require(_0x4e91('0x1'));var EventEmitter=require('events')[_0x4e91('0x2')];var AGIError=require(_0x4e91('0x3'));var AGIChannel=require(_0x4e91('0x4'));var AGIServer=function(_0x471f1d,_0x297dc0,_0x59e102){var _0x4f4e88=this,_0x471f1d=_0x471f1d||0x11dd,_0x297dc0=_0x297dc0||_0x4e91('0x5'),_0x5d4c14=null,_0x29c27c=0x0;EventEmitter[_0x4e91('0x6')](_0x4f4e88);function _0x2f2098(){if(!_0x471f1d){_0x4f4e88['emit']('error',new AGIError(_0x4e91('0x7')));return![];}_0x5d4c14=net['createServer']();_0x5d4c14['listen'](_0x471f1d,_0x297dc0);_0x5d4c14['on'](_0x4e91('0x8'),function(){_0x4f4e88[_0x4e91('0x9')](_0x4e91('0x8'));});_0x5d4c14['on'](_0x4e91('0xa'),function(_0x4c690f){_0x5d4c14[_0x4e91('0xb')](function(_0x200bd1,_0x38d3b4){if(_0x200bd1){_0x4f4e88['emit'](_0x4e91('0xc'),new AGIError(_0x4e91('0xd'),_0x200bd1));}else if(_0x59e102&&_0x59e102<0x0){_0x4f4e88[_0x4e91('0x9')](_0x4e91('0xc'),new AGIError(_0x4e91('0xe')));_0x4c690f[_0x4e91('0xf')]();}else if(_0x59e102&&_0x59e102>0x0&&_0x59e102<_0x38d3b4){_0x29c27c+=0x1;_0x4f4e88[_0x4e91('0x9')](_0x4e91('0xc'),new AGIError(_0x4e91('0x10'),_0x29c27c));_0x4c690f['destroy']();}else{var _0x523594=new AGIChannel(_0x4c690f);_0x523594['on'](_0x4e91('0x11'),function(){_0x4f4e88[_0x4e91('0x9')]('connection',_0x523594);});}});});_0x5d4c14['on'](_0x4e91('0xc'),function(_0x83fe44){_0x4f4e88[_0x4e91('0x9')](_0x4e91('0xc'),new AGIError(_0x4e91('0xd'),_0x83fe44[_0x4e91('0x12')]));});_0x5d4c14['on'](_0x4e91('0x13'),function(){_0x4f4e88[_0x4e91('0x9')]('close',new AGIError(_0x4e91('0x14')));});}process[_0x4e91('0x15')](function(){_0x2f2098();});};util[_0x4e91('0x16')](AGIServer,EventEmitter);module['exports']=function(_0x23caed,_0x16947e,_0x4a332b){return new AGIServer(_0x23caed,_0x16947e,_0x4a332b);}; \ No newline at end of file +var _0xdb13=['error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','E_AGI_SERVER_ERROR','code','close','nextTick','exports','net','events','EventEmitter','./error','./channel','127.0.0.1','call','emit'];(function(_0x1bd51d,_0x46f25e){var _0x116b83=function(_0x2d447c){while(--_0x2d447c){_0x1bd51d['push'](_0x1bd51d['shift']());}};_0x116b83(++_0x46f25e);}(_0xdb13,0x10c));var _0x3db1=function(_0x4348e5,_0x4dec8b){_0x4348e5=_0x4348e5-0x0;var _0x458d2f=_0xdb13[_0x4348e5];return _0x458d2f;};'use strict';var util=require('util');var net=require(_0x3db1('0x0'));var EventEmitter=require(_0x3db1('0x1'))[_0x3db1('0x2')];var AGIError=require(_0x3db1('0x3'));var AGIChannel=require(_0x3db1('0x4'));var AGIServer=function(_0xd23f18,_0x581a73,_0x3352e3){var _0x41fb5d=this,_0xd23f18=_0xd23f18||0x11dd,_0x581a73=_0x581a73||_0x3db1('0x5'),_0x342b84=null,_0x5a2345=0x0;EventEmitter[_0x3db1('0x6')](_0x41fb5d);function _0x28e7b6(){if(!_0xd23f18){_0x41fb5d[_0x3db1('0x7')](_0x3db1('0x8'),new AGIError(_0x3db1('0x9')));return![];}_0x342b84=net[_0x3db1('0xa')]();_0x342b84[_0x3db1('0xb')](_0xd23f18,_0x581a73);_0x342b84['on'](_0x3db1('0xc'),function(){_0x41fb5d[_0x3db1('0x7')](_0x3db1('0xc'));});_0x342b84['on'](_0x3db1('0xd'),function(_0x51d421){_0x342b84[_0x3db1('0xe')](function(_0xad7eab,_0x2bab87){if(_0xad7eab){_0x41fb5d[_0x3db1('0x7')]('error',new AGIError('E_AGI_SERVER_ERROR',_0xad7eab));}else if(_0x3352e3&&_0x3352e3<0x0){_0x41fb5d[_0x3db1('0x7')](_0x3db1('0x8'),new AGIError(_0x3db1('0xf')));_0x51d421[_0x3db1('0x10')]();}else if(_0x3352e3&&_0x3352e3>0x0&&_0x3352e3<_0x2bab87){_0x5a2345+=0x1;_0x41fb5d[_0x3db1('0x7')]('error',new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x5a2345));_0x51d421['destroy']();}else{var _0x5f1633=new AGIChannel(_0x51d421);_0x5f1633['on'](_0x3db1('0x11'),function(){_0x41fb5d[_0x3db1('0x7')](_0x3db1('0xd'),_0x5f1633);});}});});_0x342b84['on'](_0x3db1('0x8'),function(_0xe390b3){_0x41fb5d[_0x3db1('0x7')]('error',new AGIError(_0x3db1('0x12'),_0xe390b3[_0x3db1('0x13')]));});_0x342b84['on']('close',function(){_0x41fb5d[_0x3db1('0x7')](_0x3db1('0x14'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x3db1('0x15')](function(){_0x28e7b6();});};util['inherits'](AGIServer,EventEmitter);module[_0x3db1('0x16')]=function(_0x475208,_0x1eb147,_0x435a76){return new AGIServer(_0x475208,_0x1eb147,_0x435a76);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 2c2698e..b7e7c37 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 _0xaa3f=['TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeechTTS','ispeech\x20TTS\x20is\x20unreachable','login','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','number','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','subject','service','host','port','secure','authentication','auth','pass','account_id','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','sendSMS','sms_account_id','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','arg_1','agi://%s/square,\x22%s\x22,\x22%s\x22','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','apiKey','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','util','shelljs','odbc','mustache','request-promise','agi','../../config/environment/shared','/var/opt/motion2/server/files','rawHeaders','rawBody','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUser','getUserById','name','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','Intervals','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','createSquareRecording','callerid','calleridname','context','extension','priority','accountcode','file','createSquareMessage','createCmContact','log','in\x20createcmcontact','dialTimezone','isNil','VALUE\x20TZ','CALLERID(dialTimezone)','getContactByPhone','phone','RETVALRPC','isEmpty','callback_','random','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','trim','googleCloudTTS','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','speed','ispeechASR','ispeech_asr_language','model','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','uri','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','saveRestApiResult','setVariable','%s.%s','replaceall\x20init','split','nextbracket','length','replaceAll','extra','replaceall\x20end','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','Enter\x20in\x20AGI\x20(%s)\x20block','command','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','enter\x20in\x20callbackblock','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','before\x20createcmcontact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','RECOG_CONFIDENCE()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','getQueryOdbc','variable_id','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','out','Dialogflow\x20Result\x20%s','speech','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','response','mindigit','maxdigit','no\x20variable\x20found','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','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','awsPolly','aws\x20Polly\x20%s\x20file\x20created','streamFile','.wav','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','AWS_LEX_%s','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xaa3f,0x95));var _0xfaa3=function(_0x444b29,_0x127582){_0x444b29=_0x444b29-0x0;var _0x428314=_0xaa3f[_0x444b29];return _0x428314;};'use strict';var fs=require('fs');var path=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var _=require('lodash');var sh=require(_0xfaa3('0x2'));var odbc=require(_0xfaa3('0x3'))();var rs=require('randomstring');var moment=require('moment');var Mustache=require(_0xfaa3('0x4'));var rp=require(_0xfaa3('0x5'));var logger=require('../../config/logger')(_0xfaa3('0x6'));var config=require('../../config/environment');var shared=require(_0xfaa3('0x7'));var scripts=require('./scripts');var FILES_PATH=_0xfaa3('0x8');var recursiveMapAttributes=[_0xfaa3('0x9'),_0xfaa3('0xa')];var verticesWithRetry=['menu','getdigits',_0xfaa3('0xb')];var AGIVertices=function(_0x27f678,_0x2a7856,_0x5091ac){this[_0xfaa3('0xc')]=_0x27f678;this[_0xfaa3('0xd')]=_0x2a7856;this['mailRpc']=_0x5091ac;};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0xf')]=function(_0xe0f5ed,_0x527b37){this[_0xfaa3('0xd')][_0xfaa3('0x10')](_0xe0f5ed)[_0xfaa3('0x11')](function(_0x18ee95){_0x527b37(null,_0x18ee95?_0x18ee95['name']:![]);})[_0xfaa3('0x12')](function(_0x1ea8ed){_0x527b37(_0x1ea8ed);});};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x13')]=function(_0x1720bb,_0x408854){this['rpc'][_0xfaa3('0x14')](_0x1720bb)[_0xfaa3('0x11')](function(_0x39812b){_0x408854(null,_0x39812b?_0x39812b['name']:![]);})[_0xfaa3('0x12')](function(_0xdcb52){_0x408854(_0xdcb52);});};AGIVertices['prototype'][_0xfaa3('0x15')]=function(_0x5856c1,_0x5d0552){this['rpc'][_0xfaa3('0x16')](_0x5856c1)[_0xfaa3('0x11')](function(_0xd732ce){_0x5d0552(null,_0xd732ce?_0xd732ce['name']:![]);})['catch'](function(_0x54c96f){_0x5d0552(_0x54c96f);});};AGIVertices['prototype'][_0xfaa3('0x17')]=function(_0x4d3833,_0x1f893d){this['rpc']['getSquareOdbcById'](_0x4d3833)['then'](function(_0x13305e){_0x1f893d(null,_0x13305e?_0x13305e[_0xfaa3('0x18')]:![]);})[_0xfaa3('0x12')](function(_0xdf7a71){_0x1f893d(_0xdf7a71);});};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x19')]=function(_0x4e264f,_0x1daa2d){this[_0xfaa3('0xd')][_0xfaa3('0x1a')](_0x4e264f)[_0xfaa3('0x11')](function(_0x602eab){_0x1daa2d(null,_0x602eab?_0x602eab[_0xfaa3('0x1b')]:![]);})[_0xfaa3('0x12')](function(_0x62fcd7){_0x1daa2d(_0x62fcd7);});};AGIVertices['prototype'][_0xfaa3('0x1c')]=function(_0x38636a,_0x5000ec){this['rpc'][_0xfaa3('0x1d')](_0x38636a)['then'](function(_0xdba825){_0x5000ec(null,_0xdba825?_0xdba825['name']:![]);})[_0xfaa3('0x12')](function(_0x19b6f4){_0x5000ec(_0x19b6f4);});};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x1e')]=function(_0x255eda,_0x2fb407){var _0xa756cb=this;this['rpc'][_0xfaa3('0x1f')](_0x255eda)[_0xfaa3('0x11')](function(_0xf65fe0){_0x2fb407(null,_0xf65fe0?_0xa756cb[_0xfaa3('0x20')](_0xf65fe0['save_name']):![]);})['catch'](function(_0x830564){_0x2fb407(_0x830564);});};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x21')]=function(_0x26d0da,_0x591b3a){this[_0xfaa3('0xd')][_0xfaa3('0x22')](_0x26d0da)[_0xfaa3('0x11')](function(_0x4c4494){_0x591b3a(null,_0x4c4494?_0x4c4494:![]);})[_0xfaa3('0x12')](function(_0x13dc00){_0x591b3a(_0x13dc00);});};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x23')]=function(_0x51ff50,_0x1e5deb,_0xd7aab8){this['mailRpc'][_0xfaa3('0x23')](_0x51ff50,_0x1e5deb)[_0xfaa3('0x11')](function(){_0xd7aab8(null);})[_0xfaa3('0x12')](function(_0x3d2af3){_0xd7aab8(_0x3d2af3);});};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x24')]=function(_0x285dcb,_0x4ffb79){this[_0xfaa3('0xd')][_0xfaa3('0x25')](_0x285dcb)['then'](function(_0x21a496){if(_0x21a496){if(_0x21a496[_0xfaa3('0x26')]){_0x4ffb79(null,[_0x21a496[_0xfaa3('0x27')]]);}else{_0x4ffb79(null,_['map'](_0x21a496[_0xfaa3('0x28')],_0xfaa3('0x27')));}}else{_0x4ffb79(null,![]);}})['catch'](function(_0x5dc127){_0x4ffb79(_0x5dc127);});};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x20')]=function(_0x224622){return util[_0xfaa3('0x29')](_0xfaa3('0x2a'),FILES_PATH,_0x224622);};AGIVertices[_0xfaa3('0xe')]['getQueryOdbc']=function(_0x56461f,_0x5c107c,_0x22ff28){odbc[_0xfaa3('0x2b')](_0x56461f,function(_0x5ae36e){if(_0x5ae36e){logger[_0xfaa3('0x2c')](_0xfaa3('0x2d'),_0x5ae36e);_0x22ff28(_0x5ae36e);}else{logger[_0xfaa3('0x2e')](_0xfaa3('0x2f'));odbc[_0xfaa3('0x30')](_0x5c107c,function(_0x3407fc,_0x2a7b80){if(_0x3407fc){logger[_0xfaa3('0x2e')](_0xfaa3('0x31'),_0x5c107c);_0x22ff28(_0x3407fc);}else{logger[_0xfaa3('0x2e')](_0xfaa3('0x32'),_0x5c107c);odbc[_0xfaa3('0x33')](function(_0x45f01f){if(_0x45f01f){logger[_0xfaa3('0x2c')](_0xfaa3('0x34'),_0x45f01f);}_0x22ff28(null,_0x2a7b80);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x3b69d2,_0x44aa6c){this[_0xfaa3('0xd')][_0xfaa3('0x35')](_0x3b69d2)['then'](function(_0x13cb73){_0x44aa6c(null,_0x13cb73?_0x13cb73:![]);})[_0xfaa3('0x12')](function(_0x4650f0){_0x44aa6c(_0x4650f0);});};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x36')]=function(_0x2b7fd0,_0x3c1dff){this[_0xfaa3('0xd')][_0xfaa3('0x36')](_0x2b7fd0)[_0xfaa3('0x11')](function(_0xd54211){_0x3c1dff(null,_0xd54211);})[_0xfaa3('0x12')](function(_0x150b49){_0x3c1dff(_0x150b49);});};AGIVertices[_0xfaa3('0xe')]['createSquareDetailsReport']=function(_0x2b1db7,_0x149d27,_0x16dd72){this[_0xfaa3('0xd')][_0xfaa3('0x37')]({'uniqueid':this[_0xfaa3('0xc')][_0xfaa3('0x38')],'node':_0x2b1db7[_0xfaa3('0x39')],'application':_0x2b1db7[_0xfaa3('0x3a')],'data':_0x149d27||null,'project_name':this[_0xfaa3('0xc')]['arg_1'],'callerid':this['channel']['callerid']})[_0xfaa3('0x11')](function(_0x592f9a){if(_0x16dd72){_0x16dd72(null,_0x592f9a);}})[_0xfaa3('0x12')](function(_0x13125e){if(_0x16dd72){_0x16dd72(_0x13125e);}});};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x3b')]=function(_0x25b148,_0x454912,_0x366f6e,_0x4d999b){this[_0xfaa3('0xd')][_0xfaa3('0x3b')]({'uniqueid':this['channel'][_0xfaa3('0x38')],'callerid':this['channel'][_0xfaa3('0x3c')],'calleridname':this[_0xfaa3('0xc')][_0xfaa3('0x3d')],'context':this[_0xfaa3('0xc')][_0xfaa3('0x3e')],'extension':this['channel'][_0xfaa3('0x3f')],'priority':this[_0xfaa3('0xc')][_0xfaa3('0x40')],'accountcode':this[_0xfaa3('0xc')][_0xfaa3('0x41')],'dnid':this[_0xfaa3('0xc')]['dnid'],'projectName':this['channel']['arg_1'],'saveName':_0x454912,'filename':_0x25b148[_0xfaa3('0x42')]||_0x454912,'savePath':_0x366f6e})[_0xfaa3('0x11')](function(_0x28bdb9){_0x4d999b(null,_0x28bdb9);})[_0xfaa3('0x12')](function(_0x132557){_0x4d999b(_0x132557);});};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x43')]=function(_0x1b9355,_0x36465b,_0x154626){this[_0xfaa3('0xd')][_0xfaa3('0x43')]({'uniqueid':this[_0xfaa3('0xc')][_0xfaa3('0x38')],'body':_0x1b9355,'direction':_0x36465b})['then'](function(_0x525f75){if(_0x154626){_0x154626(null,_0x525f75);}})[_0xfaa3('0x12')](function(_0x1253cd){if(_0x154626){_0x154626(_0x1253cd);}});};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x44')]=function(_0x5641ed,_0xa3cd71){console[_0xfaa3('0x45')](_0xfaa3('0x46'),_0x5641ed);console['log']('in\x20createcmcontact\x20callback',_0xa3cd71);var _0x4ee5bb=0x0;if(_['has'](_0x5641ed,_0xfaa3('0x47'))){if(!_[_0xfaa3('0x48')](_0x5641ed[_0xfaa3('0x47')])){var _0x54d2d2=_0x5641ed['dialTimezone'];console[_0xfaa3('0x45')](_0xfaa3('0x49'),_0x54d2d2);if(_0x5641ed[_0xfaa3('0x47')]==_0xfaa3('0x4a')){this[_0xfaa3('0xd')][_0xfaa3('0x4b')]({'phone':_0x5641ed[_0xfaa3('0x4c')]})['then'](function(_0x472dc2){console[_0xfaa3('0x45')](_0xfaa3('0x4d'),_0x472dc2);_0xa3cd71(null,_0x472dc2);});}else{console[_0xfaa3('0x45')]('TZ\x20found\x20in\x20shared:',shared[_0x54d2d2]);}}}this[_0xfaa3('0xd')][_0xfaa3('0x44')]({'firstName':_[_0xfaa3('0x4e')](_0x5641ed[_0xfaa3('0x1b')])||_[_0xfaa3('0x48')](_0x5641ed['name'])?_0xfaa3('0x4f')+Math[_0xfaa3('0x50')]():_0x5641ed[_0xfaa3('0x1b')],'lastName':_[_0xfaa3('0x4e')](_0x5641ed[_0xfaa3('0x51')])||_[_0xfaa3('0x48')](_0x5641ed[_0xfaa3('0x51')])?null:_0x5641ed[_0xfaa3('0x51')],'phone':_0x5641ed[_0xfaa3('0x4c')],'ListId':_0x5641ed[_0xfaa3('0x52')],'scheduledat':_0x5641ed[_0xfaa3('0x53')],'callbackUniqueid':this['channel'][_0xfaa3('0x38')],'tags':_0xfaa3('0x54'),'description':_0xfaa3('0x55')+_0x5641ed[_0xfaa3('0x53')][_0xfaa3('0x56')](),'priority':_0x5641ed[_0xfaa3('0x57')]})[_0xfaa3('0x11')](function(_0x4d0feb){_0xa3cd71(null,_0x4d0feb);})[_0xfaa3('0x12')](function(_0x5b2a81){_0xa3cd71(_0x5b2a81);});};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x58')]=function(_0x11e497,_0x327c7a){this[_0xfaa3('0xd')][_0xfaa3('0x59')](_0x11e497)[_0xfaa3('0x11')](function(_0x294dd0){_0x327c7a(null,_0x294dd0?_0x294dd0[_0xfaa3('0x1b')]:![]);})[_0xfaa3('0x12')](function(_0x2be27c){_0x327c7a(_0x2be27c);});};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x5a')]=function(_0x58230f,_0x2a8237,_0x424452){var _0x4e7514={'role':_0xfaa3('0x5b')};_0x4e7514[_0x58230f]=this[_0xfaa3('0xc')][_0xfaa3('0x3c')];this['rpc'][_0xfaa3('0x5a')](_0x4e7514,_0x2a8237,this[_0xfaa3('0xc')][_0xfaa3('0x38')])[_0xfaa3('0x11')](function(_0x461c2c){_0x424452(null,_[_0xfaa3('0x48')](_0x461c2c)?![]:!![]);})[_0xfaa3('0x12')](function(_0x4d75ec){logger[_0xfaa3('0x2c')](_0x4d75ec);_0x424452(null,![]);});};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x5c')]=function(_0x57b717,_0x1c7fa3){var _0x2fb068={'role':_0xfaa3('0x5b')};_0x2fb068[_0x57b717]=this[_0xfaa3('0xc')]['callerid'];this[_0xfaa3('0xd')]['agentUnpause'](_0x2fb068)[_0xfaa3('0x11')](function(_0x2bab29){_0x1c7fa3(null,_[_0xfaa3('0x48')](_0x2bab29)?![]:!![]);})['catch'](function(_0x19869){logger['error'](_0x19869);_0x1c7fa3(null,![]);});};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x5d')]=function(_0x5ebd5a,_0x5da38f){var _0x272927={'role':_0xfaa3('0x5b')};_0x272927[_0x5ebd5a]=this[_0xfaa3('0xc')][_0xfaa3('0x3c')];this[_0xfaa3('0xd')][_0xfaa3('0x5d')](_0x272927)['then'](function(_0x3ea040){_0x5da38f(null,_[_0xfaa3('0x48')](_0x3ea040)?![]:!![]);})[_0xfaa3('0x12')](function(_0x47be12){logger['error'](_0x47be12);_0x5da38f(null,![]);});};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x5e')]=function(_0x2b8337,_0x591439){var _0x3cc244={'role':_0xfaa3('0x5b')};_0x3cc244[_0x2b8337]=this[_0xfaa3('0xc')][_0xfaa3('0x3c')];var _0x1732c6=_0x2b8337!=_0xfaa3('0x5f')?util[_0xfaa3('0x29')](_0xfaa3('0x60'),_0xfaa3('0x61'),this[_0xfaa3('0xc')]['callerid']):undefined;this[_0xfaa3('0xd')][_0xfaa3('0x5e')](_0x3cc244,_0x1732c6)[_0xfaa3('0x11')](function(_0x4b3cc8){_0x591439(null,_[_0xfaa3('0x48')](_0x4b3cc8)?![]:!![]);})[_0xfaa3('0x12')](function(_0xdad92c){logger[_0xfaa3('0x2c')](_0xdad92c);_0x591439(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x1409e8,_0x419619){sh[_0xfaa3('0x62')](_[_0xfaa3('0x63')](_0x1409e8),function(_0x954255,_0x325828){var _0x21dfbe=_0x325828['replace'](/(\r\n|\n|\r)/gm,'');_0x419619(null,_0x21dfbe);});};AGIVertices['prototype'][_0xfaa3('0x64')]=function(_0x5da61f,_0x27d204){scripts[_0xfaa3('0x64')](_0x5da61f['apiKey'],_0x5da61f[_0xfaa3('0x65')]||_0xfaa3('0x66'),_0x5da61f[_0xfaa3('0x66')],_0x5da61f[_0xfaa3('0x67')]||_0xfaa3('0x68'),_0x5da61f[_0xfaa3('0x69')]||_0xfaa3('0x6a'),_0x5da61f[_0xfaa3('0x6b')]||_0xfaa3('0x6c'))[_0xfaa3('0x11')](function(_0x565bf5){_0x27d204(null,_0x565bf5);})[_0xfaa3('0x12')](function(_0x453d92){_0x27d204(_0x453d92);});};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x6d')]=function(_0x2f7832,_0x396613){scripts[_0xfaa3('0x6d')](_0x2f7832['text'],_0x2f7832[_0xfaa3('0x6e')]||'en',0x1)[_0xfaa3('0x11')](function(_0x46e9ce){_0x396613(null,_0x46e9ce);})[_0xfaa3('0x12')](function(_0x5ed8f6){_0x396613(_0x5ed8f6);});};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x6f')]=function(_0x2a3e25,_0x24b35d){var _0x552be2={'uri':_0x2a3e25[_0xfaa3('0x70')],'method':_0x2a3e25[_0xfaa3('0x71')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2a3e25[_0xfaa3('0x72')])==='number'&&parseInt(_0x2a3e25['timeout'])>=0x1?parseInt(_0x2a3e25[_0xfaa3('0x72')])*0x3e8:0x5*0x3e8};if(_[_0xfaa3('0x73')]([_0xfaa3('0x74'),_0xfaa3('0x75')],_0x552be2[_0xfaa3('0x71')][_0xfaa3('0x76')]())){try{_0x552be2[_0xfaa3('0x77')]=_0x2a3e25['rawBody']?JSON[_0xfaa3('0x78')](_0x2a3e25[_0xfaa3('0xa')]):{};}catch(_0x5d0767){logger['error'](_0xfaa3('0x79'),_0x5d0767);}}try{_0x552be2[_0xfaa3('0x7a')]=_0x2a3e25[_0xfaa3('0x9')]?JSON[_0xfaa3('0x78')](_0x2a3e25[_0xfaa3('0x9')]):{};}catch(_0x3d8e3b){logger['error']('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x3d8e3b);}if(_0x2a3e25[_0xfaa3('0x7b')]){try{var _0x27e556=require(_0x2a3e25[_0xfaa3('0x7b')])[_0xfaa3('0x7c')](this,_0x552be2);_0x552be2['uri']=Mustache[_0xfaa3('0x7d')](_0x2a3e25[_0xfaa3('0x70')],_0x27e556,{},['$$','$$']);if(_0x552be2[_0xfaa3('0x7a')]){_0x552be2['headers']=JSON[_0xfaa3('0x78')](Mustache['render'](JSON[_0xfaa3('0x7e')](_0x552be2[_0xfaa3('0x7a')]),_0x27e556,{},['$$','$$']));}if(_0x552be2[_0xfaa3('0x77')]){_0x552be2[_0xfaa3('0x77')]=JSON[_0xfaa3('0x78')](Mustache[_0xfaa3('0x7d')](JSON[_0xfaa3('0x7e')](_0x552be2[_0xfaa3('0x77')]),_0x27e556,{},['$$','$$']));}}catch(_0x48b541){logger['error'](_0xfaa3('0x7f'),_0x48b541);}}rp(_0x552be2)[_0xfaa3('0x11')](function(_0x1a6ab3){var _0x238998={'statusCode':_0x1a6ab3[_0xfaa3('0x80')]||0xc8,'statusMessage':_0x1a6ab3[_0xfaa3('0x81')]||'OK','headers':_0x1a6ab3[_0xfaa3('0x7a')]||{},'body':_0x1a6ab3[_0xfaa3('0x77')]||{}};_0x24b35d(null,_0x238998);})[_0xfaa3('0x12')](function(_0x29a060){var _0x4f577c={'statusCode':_0x29a060[_0xfaa3('0x80')]||0x1f4,'statusMessage':_0x29a060[_0xfaa3('0x82')]||_0xfaa3('0x83'),'headers':_0x29a060[_0xfaa3('0x84')][_0xfaa3('0x7a')]||{},'body':_0x29a060[_0xfaa3('0x84')]['body']||{}};_0x24b35d(null,_0x4f577c);});};AGIVertices['prototype'][_0xfaa3('0x85')]=function(_0x399aba,_0x2acc18){scripts['googleDialogflow'](this[_0xfaa3('0xc')]['uniqueid'],_0x399aba[_0xfaa3('0x86')],_0x399aba['text'],_0x399aba[_0xfaa3('0x87')]||'en')['then'](function(_0xe5f36c){_0x2acc18(null,_0xe5f36c);})[_0xfaa3('0x12')](function(_0x148173){_0x2acc18(_0x148173);});};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x88')]=function(_0x530c17,_0xf165){scripts[_0xfaa3('0x88')](this[_0xfaa3('0xc')],_0x530c17)[_0xfaa3('0x11')](function(_0x4db735){_0xf165(null,_0x4db735);})[_0xfaa3('0x12')](function(_0x521d0a){_0xf165(_0x521d0a);});};AGIVertices[_0xfaa3('0xe')]['ispeechTTS']=function(_0x1cfadc,_0x5890c1){scripts['ispeechTTS'](_0x1cfadc[_0xfaa3('0x86')],_0x1cfadc['text'],_0x1cfadc['ispeech_tts_language']||_0xfaa3('0x68'),_0x1cfadc[_0xfaa3('0x89')])[_0xfaa3('0x11')](function(_0x52adfd){_0x5890c1(null,_0x52adfd);})[_0xfaa3('0x12')](function(_0x2166ef){_0x5890c1(_0x2166ef);});};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x8a')]=function(_0x482a8d,_0xccc575,_0x2a4b48){scripts[_0xfaa3('0x8a')](_0xccc575,_0x482a8d['key'],_0x482a8d[_0xfaa3('0x8b')]||_0xfaa3('0x68'),this['isConfigured'](_0x482a8d[_0xfaa3('0x8c')])?_0x482a8d[_0xfaa3('0x8c')]:undefined)[_0xfaa3('0x11')](function(_0x391c20){_0x2a4b48(null,_0x391c20);})[_0xfaa3('0x12')](function(_0x1a0a15){_0x2a4b48(_0x1a0a15);});};AGIVertices[_0xfaa3('0xe')]['awsPolly']=function(_0x1b3fa9,_0x204f0a){scripts['awsPolly'](_0x1b3fa9[_0xfaa3('0x8d')],_0x1b3fa9[_0xfaa3('0x8e')],_0x1b3fa9[_0xfaa3('0x8f')],_0x1b3fa9[_0xfaa3('0x90')]||_0xfaa3('0x91'),_0x1b3fa9[_0xfaa3('0x66')],_0x1b3fa9[_0xfaa3('0x92')]||_0xfaa3('0x66'))['then'](function(_0x5a8005){_0x204f0a(null,_0x5a8005);})[_0xfaa3('0x12')](function(_0x5ac7a0){_0x204f0a(_0x5ac7a0);});};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x93')]=function(_0x14241e,_0x2eab9a){scripts[_0xfaa3('0x93')](this['channel'][_0xfaa3('0x38')],_0x14241e[_0xfaa3('0x8d')],_0x14241e[_0xfaa3('0x8e')],_0x14241e['aws_lex_region'],_0x14241e[_0xfaa3('0x66')],_0x14241e[_0xfaa3('0x94')])[_0xfaa3('0x11')](function(_0x1b9671){_0x2eab9a(null,_0x1b9671);})[_0xfaa3('0x12')](function(_0x7703e5){_0x2eab9a(_0x7703e5);});};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x95')]=function(_0x2b384c,_0x24d657,_0x51d490){scripts[_0xfaa3('0x95')](_0x24d657,_0x2b384c['key'],_0x2b384c[_0xfaa3('0x96')]||_0xfaa3('0x68'))[_0xfaa3('0x11')](function(_0x4fc698){_0x51d490(null,_0x4fc698);})[_0xfaa3('0x12')](function(_0x690f7c){_0x51d490(_0x690f7c);});};AGIVertices['prototype'][_0xfaa3('0x97')]=function(_0x3d4735,_0x1f8127,_0x22e879){scripts[_0xfaa3('0x97')](_0x1f8127,_0x3d4735[_0xfaa3('0x98')],_0x3d4735['appsecret'],_0x3d4735[_0xfaa3('0x99')])['then'](function(_0x5dea93){_0x22e879(null,_0x5dea93);})[_0xfaa3('0x12')](function(_0x3530c6){_0x22e879(_0x3530c6);});};AGIVertices[_0xfaa3('0xe')]['clear']=function(_0x83eaaf){var _0x33a3ba=_[_0xfaa3('0x73')](verticesWithRetry,_0x83eaaf['agicommand'])?_0x83eaaf:_[_0xfaa3('0x9a')](_0x83eaaf);for(var _0x572d63 in _0x33a3ba){if(_0x33a3ba[_0xfaa3('0x9b')](_0x572d63)){if(_0x33a3ba[_0x572d63]&&_[_0xfaa3('0x9c')](_0x33a3ba[_0x572d63])){if(_[_0xfaa3('0x73')](recursiveMapAttributes,_0x572d63)){_0x33a3ba[_0x572d63]=this[_0xfaa3('0x9d')](_0x33a3ba[_0x572d63]);}else{_0x33a3ba[_0x572d63]=this[_0xfaa3('0x9e')](_0x33a3ba[_0x572d63]);}}}}return _0x33a3ba;};AGIVertices[_0xfaa3('0xe')]['recursiveNodeIndex']=function(_0x277f4c){for(var _0x550bde in _0x277f4c){if(_0x277f4c['hasOwnProperty'](_0x550bde)){if(_['isPlainObject'](_0x277f4c[_0x550bde])){this[_0xfaa3('0x9f')](_0x277f4c[_0x550bde]);}else if(_[_0xfaa3('0xa0')](_0x277f4c[_0x550bde])){for(var _0x38c77b=0x0;_0x38c77b<_0x277f4c[_0x550bde]['length'];_0x38c77b++){this[_0xfaa3('0x9f')](_0x277f4c[_0x550bde][_0x38c77b]);}}else if(_[_0xfaa3('0x9c')](_0x277f4c[_0x550bde])){_0x277f4c[_0x550bde]=this[_0xfaa3('0x9e')](_0x277f4c[_0x550bde]);}}}};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0xa1')]=function(_0x1fa7ad,_0x3bfd93){for(var _0x561515 in _0x1fa7ad){if(_0x1fa7ad[_0xfaa3('0x9b')](_0x561515)){if(_['isPlainObject'](_0x1fa7ad[_0x561515])){if(!_[_0xfaa3('0x4e')](_0x1fa7ad[_0x561515])){this['saveRestApiResult'](_0x1fa7ad[_0x561515],util[_0xfaa3('0x29')]('%s.%s',_0x3bfd93,_0x561515));}}else if(_['isArray'](_0x1fa7ad[_0x561515])){for(var _0x444957=0x0;_0x444957<_0x1fa7ad[_0x561515]['length'];_0x444957++){this[_0xfaa3('0xa1')](_0x1fa7ad[_0x561515][_0x444957],util['format']('%s.%s',_0x3bfd93,_0x561515+'['+_0x444957+']'));}}else{if(!_['isNil'](_0x1fa7ad[_0x561515])){this[_0xfaa3('0xc')][_0xfaa3('0xa2')](util[_0xfaa3('0x29')](_0xfaa3('0xa3'),_0x3bfd93,_0x561515),_0x1fa7ad[_0x561515]);}}}}};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x9d')]=function(_0x564fbf){try{var _0x12171f=JSON[_0xfaa3('0x78')](_0x564fbf);this[_0xfaa3('0x9f')](_0x12171f);return JSON[_0xfaa3('0x7e')](_0x12171f);}catch(_0x4776ff){return this[_0xfaa3('0x9e')](_0x564fbf);}};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x9e')]=function(_0x14d93f){console['log'](_0xfaa3('0xa4'),_0x14d93f);var _0x991eb1=_0x14d93f[_0xfaa3('0xa5')]('{');for(var _0x3583ac=0x1;_0x3583ac<_0x991eb1['length'];_0x3583ac+=0x1){var _0x8e9921=_0x991eb1[_0x3583ac][_0xfaa3('0xa5')]('}');console[_0xfaa3('0x45')](_0xfaa3('0xa6'),_0x8e9921);if(_0x8e9921[_0xfaa3('0xa7')]>0x1){_0x14d93f=_0x14d93f[_0xfaa3('0xa8')]('{'+_0x8e9921[0x0]+'}',this[_0xfaa3('0xc')][_0xfaa3('0xf')](_0x8e9921[0x0])[_0xfaa3('0xa9')]||_0x8e9921[0x0]);}}if(_0x991eb1['length']===0x1){return _0x14d93f['toString']();}console[_0xfaa3('0x45')](_0xfaa3('0xaa'),_0x14d93f);return this['replaceAllVariables'](_0x14d93f);};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0xab')]=function(_0x38fe9b,_0x449aed){var _0xa79d9c=this[_0xfaa3('0xc')][_0xfaa3('0xf')](_0x38fe9b);if(_0xa79d9c[_0xfaa3('0xac')]===-0x1){return _0xa79d9c;}logger['info'](util['format'](_0xfaa3('0xad'),_0x449aed,_0xa79d9c[_0xfaa3('0xa9')]));return this[_0xfaa3('0xc')]['setVariable'](_0x449aed,_0xa79d9c[_0xfaa3('0xa9')]);};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0xae')]=function(_0x400f99){return _0x400f99&&_0x400f99!=='0'&&_0x400f99!=='-1'&&_0x400f99!=='';};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0xaf')]=function(_0x3dc0c6){this[_0xfaa3('0x37')]['sync'](this,_0x3dc0c6,'-');_0x3dc0c6[_0xfaa3('0xb0')]=_0x3dc0c6[_0xfaa3('0xaf')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0xb1')]=function(_0x298402){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0xb2'),_0x298402[_0xfaa3('0x39')]));if(!this[_0xfaa3('0xae')](_0x298402[_0xfaa3('0x66')])){return this['channel'][_0xfaa3('0xb3')]('no\x20text\x20configured');}var _0x4be1f9='\x22'+_0x298402['text']+'\x22';if(this['isConfigured'](_0x298402[_0xfaa3('0x84')])){_0x4be1f9+=','+_0x298402['options'];}var _0x547260=this[_0xfaa3('0xc')]['exec'](_0xfaa3('0xb4'),_0x4be1f9);if(_0x547260[_0xfaa3('0xac')]===-0x1){return _0x547260;}return this[_0xfaa3('0xc')][_0xfaa3('0xb3')](util[_0xfaa3('0x29')](_0xfaa3('0xb5'),_0x4be1f9));};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0xb6')]=function(_0x2205b6){logger[_0xfaa3('0x2e')](util['format'](_0xfaa3('0xb7'),_0x2205b6[_0xfaa3('0x39')]));if(!this['isConfigured'](_0x2205b6[_0xfaa3('0xb8')])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x4c8433=_0x2205b6[_0xfaa3('0xb8')];if(this['isConfigured'](_0x2205b6['options'])){_0x4c8433+=','+_0x2205b6[_0xfaa3('0x84')];}var _0x40d522=this['channel'][_0xfaa3('0x62')](_0xfaa3('0xb9'),_0x4c8433);if(_0x40d522[_0xfaa3('0xac')]===-0x1){return _0x40d522;}var _0x39ef9a=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xfaa3('0xba'));if(_0x39ef9a['result']===-0x1){return _0x39ef9a;}var _0x58f1b2=this['getAndSetVariable'](_0xfaa3('0xbb'),'MRCP_RECOG_TRANSCRIPT');if(_0x58f1b2[_0xfaa3('0xac')]===-0x1){return _0x58f1b2;}var _0x3b63a5=this[_0xfaa3('0xab')](_0xfaa3('0xbc'),'MRCP_RECOG_INSTANCE');if(_0x3b63a5[_0xfaa3('0xac')]===-0x1){return _0x3b63a5;}return this['channel'][_0xfaa3('0xb3')](util[_0xfaa3('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x4c8433));};AGIVertices['prototype'][_0xfaa3('0x6')]=function(_0x404387){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0xbd'),_0x404387['label']));return this[_0xfaa3('0xc')][_0xfaa3('0x6')]([_0x404387[_0xfaa3('0xbe')],_0x404387['args']]);};AGIVertices[_0xfaa3('0xe')]['answer']=function(_0x10027f){logger[_0xfaa3('0x2e')](util['format'](_0xfaa3('0xbf'),_0x10027f[_0xfaa3('0x39')]));if(this[_0xfaa3('0xae')](_0x10027f[_0xfaa3('0x72')])){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0xc0'),_0x10027f[_0xfaa3('0x72')]));var _0x2872f2=this['channel'][_0xfaa3('0xc1')](_0x10027f[_0xfaa3('0x72')]);if(_0x2872f2['result']===-0x1){return _0x2872f2;}}return this[_0xfaa3('0xc')][_0xfaa3('0xc2')]();};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x54')]=function(_0x95f0b3){console[_0xfaa3('0x45')](_0xfaa3('0xc3'),_0x95f0b3);logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0xc4'),_0x95f0b3[_0xfaa3('0x39')]));if(!this[_0xfaa3('0xae')](_0x95f0b3[_0xfaa3('0x52')])){return this['channel'][_0xfaa3('0x2c')](_0x95f0b3,_0xfaa3('0xc5'));}_0x95f0b3['scheduledAt']=moment();if(this[_0xfaa3('0xae')](_0x95f0b3[_0xfaa3('0xc6')])){_0x95f0b3[_0xfaa3('0x53')]=moment()[_0xfaa3('0xc7')](_0x95f0b3[_0xfaa3('0xc6')],_0xfaa3('0xc8'));}if(!this[_0xfaa3('0xae')](_0x95f0b3[_0xfaa3('0x57')])){_0x95f0b3[_0xfaa3('0x57')]=0x2;}console['log'](_0xfaa3('0xc9'),_0x95f0b3);this[_0xfaa3('0x44')][_0xfaa3('0x7c')](this,_0x95f0b3);return this[_0xfaa3('0xc')][_0xfaa3('0xb3')](util[_0xfaa3('0x29')](_0xfaa3('0xca'),_0x95f0b3[_0xfaa3('0x4c')],_0x95f0b3[_0xfaa3('0x52')],_0x95f0b3[_0xfaa3('0x53')]));};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0xcb')]=function(_0x2a54c4){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x2a54c4['label']));var _0x3fd99c=this[_0xfaa3('0xc')][_0xfaa3('0x62')](_0x2a54c4['application'],_0x2a54c4[_0xfaa3('0x84')]);if(_0x3fd99c['result']===-0x1){return _0x3fd99c;}return this['channel']['noop'](util['format'](_0xfaa3('0xcc'),_0x2a54c4['application'],_0x2a54c4[_0xfaa3('0x84')]));};AGIVertices['prototype'][_0xfaa3('0xcd')]=function(_0x202cfe){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0xce'),_0x202cfe[_0xfaa3('0x39')]));if(!this[_0xfaa3('0xae')](_0x202cfe['text'])){return this[_0xfaa3('0xc')][_0xfaa3('0xb3')](_0xfaa3('0xcf'));}var _0x21415c='\x22'+_0x202cfe[_0xfaa3('0x66')]+'\x22';if(this['isConfigured'](_0x202cfe['options'])){_0x21415c+=','+_0x202cfe[_0xfaa3('0x84')];}var _0x19973c=this['channel']['exec'](_0xfaa3('0xb4'),_0x21415c);if(_0x19973c['result']===-0x1){return _0x19973c;}return this[_0xfaa3('0xc')]['noop'](util['format'](_0xfaa3('0xb5'),_0x21415c));};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0xd0')]=function(_0x468a9e){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x468a9e[_0xfaa3('0x39')]));if(!this['isConfigured'](_0x468a9e['text'])){return this[_0xfaa3('0xc')][_0xfaa3('0xb3')](_0xfaa3('0xcf'));}var _0x28d58b='\x22'+_0x468a9e[_0xfaa3('0x66')]+'\x22';if(this['isConfigured'](_0x468a9e['options'])){_0x28d58b+=','+_0x468a9e['options'];}var _0x4d2ca6=this['channel']['exec'](_0xfaa3('0xb4'),_0x28d58b);if(_0x4d2ca6[_0xfaa3('0xac')]===-0x1){return _0x4d2ca6;}return this['channel'][_0xfaa3('0xb3')](util[_0xfaa3('0x29')]('Executed\x20command\x20MRCPSynth\x20%s',_0x28d58b));};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0xd1')]=function(_0x95a5da){logger[_0xfaa3('0x2e')](util['format'](_0xfaa3('0xd2'),_0x95a5da[_0xfaa3('0x39')]));if(!this[_0xfaa3('0xae')](_0x95a5da['grammar'])){return this['channel'][_0xfaa3('0xb3')](_0xfaa3('0xd3'));}var _0x5d14cb=_0x95a5da['grammar'];if(this[_0xfaa3('0xae')](_0x95a5da[_0xfaa3('0x84')])){_0x5d14cb+=','+_0x95a5da['options'];}var _0x350e99=this[_0xfaa3('0xc')][_0xfaa3('0x62')]('MRCPRecog',_0x5d14cb);if(_0x350e99[_0xfaa3('0xac')]===-0x1){return _0x350e99;}var _0x5cacdd=this[_0xfaa3('0xab')](_0xfaa3('0xd4'),'LUMENVOX_ASR_CONFIDENCE');if(_0x5cacdd['result']===-0x1){return _0x5cacdd;}var _0x4d8748=this[_0xfaa3('0xab')](_0xfaa3('0xbb'),_0xfaa3('0xd5'));if(_0x4d8748[_0xfaa3('0xac')]===-0x1){return _0x4d8748;}var _0x37b2a2=this[_0xfaa3('0xab')](_0xfaa3('0xbc'),_0xfaa3('0xd6'));if(_0x37b2a2[_0xfaa3('0xac')]===-0x1){return _0x37b2a2;}return this[_0xfaa3('0xc')]['noop'](util[_0xfaa3('0x29')](_0xfaa3('0xd7'),_0x5d14cb));};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0xd8')]=function(_0x4bea3d){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0xd9'),_0x4bea3d[_0xfaa3('0x39')]));if(!this['isConfigured'](_0x4bea3d[_0xfaa3('0xb8')])){return this[_0xfaa3('0xc')][_0xfaa3('0xb3')](_0xfaa3('0xd3'));}var _0x22741b=_0x4bea3d[_0xfaa3('0xb8')];if(this[_0xfaa3('0xae')](_0x4bea3d[_0xfaa3('0x84')])){_0x22741b+=','+_0x4bea3d[_0xfaa3('0x84')];}var _0x389173=this[_0xfaa3('0xc')][_0xfaa3('0x62')](_0xfaa3('0xb9'),_0x22741b);if(_0x389173[_0xfaa3('0xac')]===-0x1){return _0x389173;}var _0x46b72a=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xfaa3('0xda'));if(_0x46b72a[_0xfaa3('0xac')]===-0x1){return _0x46b72a;}var _0x584542=this[_0xfaa3('0xab')](_0xfaa3('0xbb'),_0xfaa3('0xdb'));if(_0x584542['result']===-0x1){return _0x584542;}var _0x4bc7b6=this[_0xfaa3('0xab')](_0xfaa3('0xbc'),_0xfaa3('0xdc'));if(_0x4bc7b6['result']===-0x1){return _0x4bc7b6;}return this[_0xfaa3('0xc')]['noop'](util[_0xfaa3('0x29')](_0xfaa3('0xd7'),_0x22741b));};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0xdd')]=function(_0x5d020a){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0xde'),_0x5d020a[_0xfaa3('0x39')]));if(!this[_0xfaa3('0xae')](_0x5d020a[_0xfaa3('0xdf')])){return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0x5d020a,_0xfaa3('0xe0'));}var _0xa8f2cb=this[_0xfaa3('0x17')][_0xfaa3('0x7c')](this,_0x5d020a['odbc_id']);if(!_0xa8f2cb){return this['channel'][_0xfaa3('0x2c')](_0x5d020a,_0xfaa3('0xe1'));}if(!this[_0xfaa3('0xae')](_0x5d020a[_0xfaa3('0x30')])){return this[_0xfaa3('0xc')]['error'](_0x5d020a,_0xfaa3('0xe2'));}var _0x11c8aa=_0x5d020a['query'][_0xfaa3('0xe3')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xfaa3('0xb3')](util['format']('query:\x20%s',_0x11c8aa));var _0x34c1cf=this[_0xfaa3('0xe4')][_0xfaa3('0x7c')](this,_0xa8f2cb,_0x11c8aa);this[_0xfaa3('0x37')][_0xfaa3('0x7c')](this,_0x5d020a,_0x11c8aa);if(!this[_0xfaa3('0xae')](_0x5d020a[_0xfaa3('0xe5')])){return this['channel'][_0xfaa3('0xb3')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x152433=this[_0xfaa3('0xf')][_0xfaa3('0x7c')](this,_0x5d020a[_0xfaa3('0xe5')]);if(!_0x152433){return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0x5d020a,'no\x20variable\x20found');}var _0x147a34=this;_0x34c1cf[_0xfaa3('0xe6')](function(_0x4a4599,_0x13244c){Object[_0xfaa3('0xe7')](_0x4a4599)[_0xfaa3('0xe6')](function(_0x34a4c4){_0x147a34[_0xfaa3('0xc')]['setVariable'](util['format'](_0xfaa3('0xe8'),_0x152433,_0x13244c,_0x34a4c4),_0x4a4599[_0x34a4c4]);});});this[_0xfaa3('0xc')][_0xfaa3('0xa2')](util[_0xfaa3('0x29')](_0xfaa3('0xe9'),_0x152433),_0x34c1cf['length']);return this[_0xfaa3('0xc')][_0xfaa3('0xb3')](util['format'](_0xfaa3('0xea'),_0x152433));};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0xeb')]=function(_0xa0df07){logger[_0xfaa3('0xec')](util[_0xfaa3('0x29')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0xa0df07[_0xfaa3('0x39')]));if(!this[_0xfaa3('0xae')](_0xa0df07[_0xfaa3('0xed')])){return this[_0xfaa3('0xc')]['error'](_0xa0df07,'no\x20user\x20selected');}var _0x4355be=this[_0xfaa3('0x19')][_0xfaa3('0x7c')](this,_0xa0df07[_0xfaa3('0xed')]);if(!_0x4355be){return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0xa0df07,_0xfaa3('0xee'));}var _0x3c6778=this['channel']['exec'](_0xfaa3('0xef'),[util[_0xfaa3('0x29')](_0xfaa3('0xf0'),_0x4355be),_0xa0df07[_0xfaa3('0x72')],_0xa0df07[_0xfaa3('0xf1')],_0xa0df07['url']]);if(_0x3c6778[_0xfaa3('0xac')]===-0x1){return _0x3c6778;}return this[_0xfaa3('0xc')][_0xfaa3('0xb3')](util[_0xfaa3('0x29')](_0xfaa3('0xf2'),'DIAL'));};AGIVertices['prototype'][_0xfaa3('0xf3')]=function(_0x412716){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0xf4'),_0x412716[_0xfaa3('0x39')]));if(!this['isConfigured'](_0x412716[_0xfaa3('0x86')])){return this['channel'][_0xfaa3('0xb3')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x412716[_0xfaa3('0x66')])){return this[_0xfaa3('0xc')]['noop']('no\x20text\x20configured');}this[_0xfaa3('0xc')][_0xfaa3('0xf5')]=!![];this[_0xfaa3('0x37')](_0x412716);this[_0xfaa3('0x43')](_0x412716[_0xfaa3('0x66')],'in');this[_0xfaa3('0xc')][_0xfaa3('0xb3')](util[_0xfaa3('0x29')](_0xfaa3('0xf6'),_0x412716['text']));var _0x50f0d4=this[_0xfaa3('0x85')]['sync'](this,_0x412716);if(_0x50f0d4){for(var _0x260dcc in _0x50f0d4){if(_0x50f0d4[_0xfaa3('0x9b')](_0x260dcc)){this['channel'][_0xfaa3('0xa2')](util[_0xfaa3('0x29')]('DIALOGFLOW_%s',_0x260dcc['toUpperCase']()),_0x50f0d4[_0x260dcc]);}}this[_0xfaa3('0x43')](_0x50f0d4['speech'],_0xfaa3('0xf7'));return this[_0xfaa3('0xc')]['noop'](util[_0xfaa3('0x29')](_0xfaa3('0xf8'),_0x50f0d4[_0xfaa3('0xf9')]));}return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0x412716,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype']['sesteknda']=function(_0x496db9){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0xfa'),_0x496db9[_0xfaa3('0x39')]));if(!this[_0xfaa3('0xae')](_0x496db9[_0xfaa3('0xfb')])){return this['channel'][_0xfaa3('0xb3')](_0xfaa3('0xfc'));}if(!this[_0xfaa3('0xae')](_0x496db9[_0xfaa3('0xfd')])){return this[_0xfaa3('0xc')]['noop']('no\x20username\x20configured');}if(!this[_0xfaa3('0xae')](_0x496db9[_0xfaa3('0xfe')])){return this[_0xfaa3('0xc')][_0xfaa3('0xb3')](_0xfaa3('0xff'));}if(!this[_0xfaa3('0xae')](_0x496db9[_0xfaa3('0x100')])){return this[_0xfaa3('0xc')]['noop'](_0xfaa3('0xcf'));}this['channel'][_0xfaa3('0xf5')]=!![];this[_0xfaa3('0x37')](_0x496db9);this['createSquareMessage'](_0x496db9['text'],'in');this[_0xfaa3('0xc')]['noop'](util[_0xfaa3('0x29')](_0xfaa3('0x101'),_0x496db9[_0xfaa3('0x66')]));var _0x2bd7e6=this[_0xfaa3('0x88')]['sync'](this,_0x496db9);if(_0x2bd7e6){for(var _0x168993 in _0x2bd7e6){if(_0x2bd7e6[_0xfaa3('0x9b')](_0x168993)){this[_0xfaa3('0xc')][_0xfaa3('0xa2')](util['format']('SESTEK_NDA_%s',_0x168993[_0xfaa3('0x76')]()),_0x2bd7e6[_0x168993]);}}this[_0xfaa3('0x43')](_0x2bd7e6['speech'],_0xfaa3('0xf7'));if(_0x2bd7e6[_0xfaa3('0x102')]){this[_0xfaa3('0xc')][_0xfaa3('0xb3')](util[_0xfaa3('0x29')](_0xfaa3('0x103'),_0x2bd7e6[_0xfaa3('0x102')]));var _0x1138b1=this[_0xfaa3('0xc')]['streamFile'](_0x2bd7e6[_0xfaa3('0x102')]);try{fs[_0xfaa3('0x104')](_0x2bd7e6[_0xfaa3('0x102')]+'.wav');}catch(_0x4f53aa){logger[_0xfaa3('0x2c')](_0x4f53aa);}return _0x1138b1;}else{return this[_0xfaa3('0xc')]['noop'](util['format'](_0xfaa3('0x105'),_0x2bd7e6['speech']));}}return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0x496db9,_0xfaa3('0x106'));};AGIVertices[_0xfaa3('0xe')]['end']=function(_0x3af0a6){logger['info'](util[_0xfaa3('0x29')](_0xfaa3('0x107'),_0x3af0a6[_0xfaa3('0x39')]));return this['channel'][_0xfaa3('0xb3')]('end');};AGIVertices[_0xfaa3('0xe')]['ext_dial']=function(_0x1c9614){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0x108'),_0x1c9614['label']));var _0x91850b='';if(_0x1c9614[_0xfaa3('0x109')]){if(!this[_0xfaa3('0xae')](_0x1c9614[_0xfaa3('0x109')])){return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0x1c9614,_0xfaa3('0x10a'));}else{var _0x4f3f66=parseInt(_0x1c9614[_0xfaa3('0x109')],0xa);if(isNaN(_0x4f3f66)){_0x91850b=_0x1c9614[_0xfaa3('0x109')];}else{_0x91850b=this[_0xfaa3('0x1c')][_0xfaa3('0x7c')](this,_0x1c9614[_0xfaa3('0x109')]);if(!_0x91850b){return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0x1c9614,_0xfaa3('0x10b'));}}}}else if(_0x1c9614[_0xfaa3('0x10c')]){_0x91850b=_0x1c9614['trunk_name'];}else{return this['channel'][_0xfaa3('0x2c')](_0x1c9614,_0xfaa3('0x10a'));}var _0x20dc34=this[_0xfaa3('0xc')][_0xfaa3('0x62')]('DIAL',[util[_0xfaa3('0x29')](_0xfaa3('0x10d'),_0x91850b,_0x1c9614['phone']),_0x1c9614[_0xfaa3('0x72')],_0x1c9614[_0xfaa3('0xf1')],_0x1c9614['url']]);if(_0x20dc34[_0xfaa3('0xac')]===-0x1){return _0x20dc34;}return this[_0xfaa3('0xc')][_0xfaa3('0xb3')](util[_0xfaa3('0x29')](_0xfaa3('0xf2'),'DIAL'));};AGIVertices[_0xfaa3('0xe')]['finally']=function(_0x18ab80){logger['info'](util[_0xfaa3('0x29')](_0xfaa3('0x10e'),_0x18ab80['label']));return this[_0xfaa3('0xc')]['noop'](_0xfaa3('0x10f'));};AGIVertices[_0xfaa3('0xe')]['getdigits']=function(_0xbb5469){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0xbb5469[_0xfaa3('0x39')]));if(_0xbb5469[_0xfaa3('0xb0')]===0x0){return this[_0xfaa3('0xaf')](_0xbb5469);}_0xbb5469[_0xfaa3('0xb0')]-=0x1;if(!this[_0xfaa3('0xae')](_0xbb5469['file_id'])){return this[_0xfaa3('0xc')]['error'](_0xbb5469,_0xfaa3('0x110'));}var _0x5acdb6=this[_0xfaa3('0x1e')][_0xfaa3('0x7c')](this,_0xbb5469[_0xfaa3('0x111')]);if(!_0x5acdb6){return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0xbb5469,_0xfaa3('0x112'));}if(!this[_0xfaa3('0xae')](_0xbb5469[_0xfaa3('0xe5')])){return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0xfaa3('0x113'));}var _0x1ed175=this['channel'][_0xfaa3('0x114')](_0x5acdb6,_0xbb5469[_0xfaa3('0x115')],_0xbb5469['maxdigit']);var _0x3ab274=_0x1ed175[_0xfaa3('0xac')]?_0x1ed175[_0xfaa3('0xac')][_0xfaa3('0x56')]():'';logger[_0xfaa3('0x2e')]('test',JSON[_0xfaa3('0x7e')](_0x1ed175));if(_0x1ed175['result']===-0x1){this[_0xfaa3('0x37')]['sync'](this,_0xbb5469,_0x3ab274);return _0x1ed175;}else if(_0x1ed175[_0xfaa3('0xa9')]==='timeout'){_0x1ed175[_0xfaa3('0xac')]=_0x3ab274[_0xfaa3('0xa7')]>=parseInt(_0xbb5469[_0xfaa3('0x116')])?'x':'i';}else{_0x1ed175['result']=_0x3ab274[_0xfaa3('0xa7')]>=parseInt(_0xbb5469['mindigit'])&&_0x3ab274['length']<=parseInt(_0xbb5469[_0xfaa3('0x117')])?'x':'i';}var _0x22e266=this[_0xfaa3('0xf')][_0xfaa3('0x7c')](this,_0xbb5469['variable_id']);if(!_0x22e266){return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0xbb5469,_0xfaa3('0x118'));}this[_0xfaa3('0xc')][_0xfaa3('0xa2')](_0x22e266,_0x3ab274);if(this[_0xfaa3('0xae')](_0xbb5469['hiddendigitsnum'])){var _0x35ca06=parseInt(_0xbb5469[_0xfaa3('0x119')],0xa);var _0x54d508=rs['generate']({'charset':'*','length':_0x35ca06});var _0x4b2dc4=_0x3ab274[_0xfaa3('0xa7')];if(_0x4b2dc4>0x0){if(_0x4b2dc4>_0x35ca06){this[_0xfaa3('0x37')][_0xfaa3('0x7c')](this,_0xbb5469,_0xbb5469[_0xfaa3('0x11a')]===_0xfaa3('0x11b')?_0x54d508+_0x3ab274['substr'](_0x35ca06):_0x3ab274[_0xfaa3('0x11c')](0x0,_0x4b2dc4-_0x35ca06)+_0x54d508);}else{this[_0xfaa3('0x37')][_0xfaa3('0x7c')](this,_0xbb5469,rs[_0xfaa3('0x11d')]({'charset':'*','length':_0x4b2dc4}));}}else{this[_0xfaa3('0x37')]['sync'](this,_0xbb5469,'');}}else{this['createSquareDetailsReport']['sync'](this,_0xbb5469,_0x3ab274);}return _0x1ed175;};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0xb')]=function(_0x45d6c9){logger[_0xfaa3('0x2e')](util['format'](_0xfaa3('0x11e'),_0x45d6c9[_0xfaa3('0x39')]));return this['getdigits'](_0x45d6c9);};AGIVertices['prototype']['goal']=function(_0x37d61a){logger[_0xfaa3('0x2e')](util['format'](_0xfaa3('0x11f'),_0x37d61a[_0xfaa3('0x39')]));this[_0xfaa3('0x37')]['sync'](this,_0x37d61a,_0x37d61a[_0xfaa3('0x120')]);return this['channel'][_0xfaa3('0xb3')](util[_0xfaa3('0x29')](_0xfaa3('0x121'),_0x37d61a[_0xfaa3('0x120')]));};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x122')]=function(_0x59b468){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0x123'),_0x59b468[_0xfaa3('0x39')]));if(!this['isConfigured'](_0x59b468['aws_access_key_id'])||!this[_0xfaa3('0xae')](_0x59b468[_0xfaa3('0x8e')])){return this[_0xfaa3('0xc')][_0xfaa3('0xb3')](_0xfaa3('0x124'));}if(!this['isConfigured'](_0x59b468[_0xfaa3('0x66')])){return this[_0xfaa3('0xc')]['noop'](_0xfaa3('0xcf'));}this[_0xfaa3('0xc')][_0xfaa3('0xb3')](util['format'](_0xfaa3('0x125'),_0x59b468[_0xfaa3('0x66')]));var _0xb7e99d=this[_0xfaa3('0x126')]['sync'](this,_0x59b468);if(_0xb7e99d){this[_0xfaa3('0xc')]['noop'](util[_0xfaa3('0x29')](_0xfaa3('0x127'),_0xb7e99d));var _0xa89b1d=this[_0xfaa3('0xc')][_0xfaa3('0x128')](_0xb7e99d);try{fs[_0xfaa3('0x104')](_0xb7e99d+_0xfaa3('0x129'));}catch(_0x1762cc){logger['error'](_0x1762cc);}return _0xa89b1d;}return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0x59b468,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x12a')]=function(_0x4e2250){logger['info'](util[_0xfaa3('0x29')](_0xfaa3('0x12b'),_0x4e2250[_0xfaa3('0x39')]));if(!this[_0xfaa3('0xae')](_0x4e2250['aws_access_key_id'])||!this['isConfigured'](_0x4e2250[_0xfaa3('0x8e')])){return this[_0xfaa3('0xc')][_0xfaa3('0xb3')](_0xfaa3('0x124'));}if(!this['isConfigured'](_0x4e2250[_0xfaa3('0x94')])){return this[_0xfaa3('0xc')][_0xfaa3('0xb3')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x4e2250[_0xfaa3('0x66')])){return this['channel'][_0xfaa3('0xb3')]('no\x20text\x20configured');}this[_0xfaa3('0xc')]['bot']=!![];this['createSquareDetailsReport'](_0x4e2250);this['createSquareMessage'](_0x4e2250['text'],'in');this[_0xfaa3('0xc')][_0xfaa3('0xb3')](util['format']('Trying\x20Amazon\x20Lex:\x20%s',_0x4e2250[_0xfaa3('0x66')]));var _0x58fcf8=this[_0xfaa3('0x93')][_0xfaa3('0x7c')](this,_0x4e2250);if(_0x58fcf8){for(var _0x5b9ffe in _0x58fcf8){if(_0x58fcf8[_0xfaa3('0x9b')](_0x5b9ffe)&&_[_0xfaa3('0x9c')](_0x58fcf8[_0x5b9ffe])){this[_0xfaa3('0xc')][_0xfaa3('0xa2')](util['format'](_0xfaa3('0x12c'),_0x5b9ffe['toUpperCase']()),_0x58fcf8[_0x5b9ffe]);}}if(_[_0xfaa3('0x48')](_0x58fcf8[_0xfaa3('0x82')])){return this[_0xfaa3('0xc')][_0xfaa3('0xb3')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this['createSquareMessage'](_0x58fcf8[_0xfaa3('0x82')],_0xfaa3('0xf7'));return this['channel'][_0xfaa3('0xb3')](util[_0xfaa3('0x29')](_0xfaa3('0x12d'),_0x58fcf8[_0xfaa3('0x82')]));}}return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0x4e2250,_0xfaa3('0x12e'));};AGIVertices['prototype'][_0xfaa3('0x12f')]=function(_0x297983){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x297983[_0xfaa3('0x39')],_0x297983[_0xfaa3('0x72')]));if(!this[_0xfaa3('0xae')](_0x297983[_0xfaa3('0x86')])){return this[_0xfaa3('0xc')][_0xfaa3('0xb3')](_0xfaa3('0x130'));}var _0x28a39c=_0xfaa3('0x131');var _0x5e3815=util[_0xfaa3('0x29')](_0xfaa3('0x132'),FILES_PATH,rs['generate'](0x4));var _0x319982=util[_0xfaa3('0x29')]('%s.%s',_0x5e3815,_0x28a39c);var _0xe8f8c7=!![];if(_0x297983[_0xfaa3('0x133')]===_0xfaa3('0x134')){_0xe8f8c7=![];}var _0x3187ae=this[_0xfaa3('0xc')][_0xfaa3('0x135')](_0x5e3815,_0x28a39c,_0x297983[_0xfaa3('0x136')],_0x297983[_0xfaa3('0x72')],undefined,_0xe8f8c7);if(_0x3187ae[_0xfaa3('0xac')]!==-0x1){this['channel'][_0xfaa3('0xb3')](util[_0xfaa3('0x29')](_0xfaa3('0x137'),_0x319982));var _0x1b1a1b=this[_0xfaa3('0x95')][_0xfaa3('0x7c')](this,_0x297983,_0x319982);if(_0x1b1a1b){for(var _0x508dcf in _0x1b1a1b){if(_0x1b1a1b['hasOwnProperty'](_0x508dcf)){this[_0xfaa3('0xc')][_0xfaa3('0xa2')](util[_0xfaa3('0x29')](_0xfaa3('0x138'),_0x508dcf[_0xfaa3('0x76')]()),_0x1b1a1b[_0x508dcf]);}}return this[_0xfaa3('0xc')]['noop'](util[_0xfaa3('0x29')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x1b1a1b)));}}return _0x3187ae;};AGIVertices['prototype']['tildeasr']=function(_0x3b77c2){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x3b77c2[_0xfaa3('0x39')]));if(!this[_0xfaa3('0xae')](_0x3b77c2[_0xfaa3('0x98')])){return this['channel'][_0xfaa3('0xb3')](_0xfaa3('0x139'));}if(!this['isConfigured'](_0x3b77c2[_0xfaa3('0x13a')])){return this['channel'][_0xfaa3('0xb3')](_0xfaa3('0x13b'));}var _0x518518='wav';var _0x45dcb2=util[_0xfaa3('0x29')](_0xfaa3('0x132'),FILES_PATH,rs[_0xfaa3('0x11d')](0x4));var _0x46b24b=util[_0xfaa3('0x29')](_0xfaa3('0xa3'),_0x45dcb2,_0x518518);var _0x5de480=!![];if(_0x3b77c2[_0xfaa3('0x133')]===_0xfaa3('0x134')){_0x5de480=![];}var _0x481c2d=this['channel'][_0xfaa3('0x135')](_0x45dcb2,_0x518518,_0x3b77c2[_0xfaa3('0x136')],_0x3b77c2[_0xfaa3('0x72')],undefined,_0x5de480);if(_0x481c2d[_0xfaa3('0xac')]!==-0x1){this['channel'][_0xfaa3('0xb3')](util['format'](_0xfaa3('0x13c'),_0x46b24b));var _0x3552e8=this[_0xfaa3('0x97')]['sync'](this,_0x3b77c2,_0x46b24b);if(_0x3552e8){for(var _0x53c9c9 in _0x3552e8){if(_0x3552e8['hasOwnProperty'](_0x53c9c9)){this['channel'][_0xfaa3('0xa2')](util['format'](_0xfaa3('0x13d'),_0x53c9c9[_0xfaa3('0x76')]()),_0x3552e8[_0x53c9c9]);}}return this[_0xfaa3('0xc')][_0xfaa3('0xb3')](util['format'](_0xfaa3('0x13e'),JSON[_0xfaa3('0x7e')](_0x3552e8)));}}return _0x481c2d;};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x13f')]=function(_0x566104){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0x140'),_0x566104[_0xfaa3('0x39')]));return this[_0xfaa3('0xc')][_0xfaa3('0x141')](_0x566104[_0xfaa3('0x3e')],_0x566104[_0xfaa3('0x3f')],_0x566104[_0xfaa3('0x40')]);};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x142')]=function(_0x78bc14){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x78bc14['label']));if(!this[_0xfaa3('0xae')](_0x78bc14[_0xfaa3('0x143')])){return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0x78bc14,_0xfaa3('0x144'));}try{var _0x530ba5=eval(_0x78bc14[_0xfaa3('0x143')])?_0xfaa3('0x145'):'false';this[_0xfaa3('0xc')][_0xfaa3('0xb3')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x78bc14[_0xfaa3('0x143')],_0x530ba5));return{'code':0xc8,'result':_0x530ba5};}catch(_0x23539f){return{'code':0xc8,'result':_0xfaa3('0x146')};}};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x147')]=function(_0x4cd698){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0x148'),_0x4cd698[_0xfaa3('0x39')]));if(!this[_0xfaa3('0xae')](_0x4cd698[_0xfaa3('0x149')])){return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0x4cd698,_0xfaa3('0x14a'));}var _0x2a0efd=this[_0xfaa3('0x24')][_0xfaa3('0x7c')](this,_0x4cd698[_0xfaa3('0x149')]);if(!_0x2a0efd){return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0x4cd698,'no\x20intervals\x20found');}for(var _0x325e08=0x0;_0x325e08<_0x2a0efd[_0xfaa3('0xa7')];_0x325e08+=0x1){var _0xb1fc48=this[_0xfaa3('0xc')]['getVariable'](util[_0xfaa3('0x29')]('IFTIME(%s?true:false)',_0x2a0efd[_0x325e08]));if(_0xb1fc48['result']===-0x1){return _0xb1fc48;}logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')]('IFTIME\x20%s\x20%s',_0x2a0efd[_0x325e08],_0xb1fc48[_0xfaa3('0xa9')]));if(_0xb1fc48[_0xfaa3('0xa9')]===_0xfaa3('0x145')){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0x14b'),_0x2a0efd[_0x325e08],'true'));this[_0xfaa3('0xc')]['noop'](util['format']('IFTIME\x20%s\x20%s',_0x2a0efd[_0x325e08],_0xfaa3('0x145')));return{'code':0xc8,'result':_0xfaa3('0x145')};}else{logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0x14b'),_0x2a0efd[_0x325e08],_0xfaa3('0x146')));this['channel'][_0xfaa3('0xb3')](util[_0xfaa3('0x29')](_0xfaa3('0x14b'),_0x2a0efd[_0x325e08],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x14c')]=function(_0x28f514){logger['info'](util['format'](_0xfaa3('0x14d'),_0x28f514[_0xfaa3('0x39')]));return this[_0xfaa3('0xc')]['hangup']();};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x14e')]=function(_0x202b5e){logger['info'](util['format'](_0xfaa3('0x14f'),_0x202b5e[_0xfaa3('0x39')]));if(!this[_0xfaa3('0xae')](_0x202b5e['key'])){return this[_0xfaa3('0xc')]['noop'](_0xfaa3('0x130'));}var _0x853640=_0xfaa3('0x131');var _0x564cbc=util[_0xfaa3('0x29')]('%s/recordings/%s',FILES_PATH,rs[_0xfaa3('0x11d')](0x4));var _0x46eeff=util['format'](_0xfaa3('0xa3'),_0x564cbc,_0x853640);var _0x3f42e5=!![];if(_0x202b5e['beep']===_0xfaa3('0x134')){_0x3f42e5=![];}var _0x2447a1=this['channel'][_0xfaa3('0x135')](_0x564cbc,_0x853640,_0x202b5e['intKey'],_0x202b5e[_0xfaa3('0x72')],undefined,_0x3f42e5);if(_0x2447a1[_0xfaa3('0xac')]!==-0x1){this['channel']['noop'](util[_0xfaa3('0x29')](_0xfaa3('0x150'),_0x46eeff));var _0x512086=this[_0xfaa3('0x8a')]['sync'](this,_0x202b5e,_0x46eeff);if(_0x512086){for(var _0x20e3ac in _0x512086){if(_0x512086[_0xfaa3('0x9b')](_0x20e3ac)){this['channel'][_0xfaa3('0xa2')](util[_0xfaa3('0x29')](_0xfaa3('0x151'),_0x20e3ac[_0xfaa3('0x76')]()),_0x512086[_0x20e3ac]);}}return this['channel'][_0xfaa3('0xb3')](util['format']('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x512086)));}}return _0x2447a1;};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x152')]=function(_0x28131e){logger['info'](util['format'](_0xfaa3('0x153'),_0x28131e[_0xfaa3('0x39')]));if(!this[_0xfaa3('0xae')](_0x28131e[_0xfaa3('0x86')])){return this[_0xfaa3('0xc')][_0xfaa3('0xb3')]('no\x20key\x20configured');}if(!this[_0xfaa3('0xae')](_0x28131e[_0xfaa3('0x66')])){return this[_0xfaa3('0xc')][_0xfaa3('0xb3')](_0xfaa3('0xcf'));}this[_0xfaa3('0xc')][_0xfaa3('0xb3')](util[_0xfaa3('0x29')](_0xfaa3('0x154'),_0x28131e[_0xfaa3('0x66')]));var _0x2cabf8=this[_0xfaa3('0x155')][_0xfaa3('0x7c')](this,_0x28131e);if(_0x2cabf8){this[_0xfaa3('0xc')][_0xfaa3('0xb3')](util['format'](_0xfaa3('0x150'),_0x2cabf8));var _0x4b6198=this['channel'][_0xfaa3('0x128')](_0x2cabf8,_0x28131e['intKey']);try{fs['unlink'](_0x2cabf8+_0xfaa3('0x129'));}catch(_0x49ad78){logger[_0xfaa3('0x2c')](_0x49ad78);}return _0x4b6198;}return this[_0xfaa3('0xc')]['error'](_0x28131e,_0xfaa3('0x156'));};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x157')]=function(_0x5d6ba8){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x5d6ba8['label']));if(!this[_0xfaa3('0xae')](_0x5d6ba8[_0xfaa3('0x158')])){return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0x5d6ba8,'no\x20find\x20by\x20configured');}logger[_0xfaa3('0x2e')](util['format'](_0xfaa3('0x159'),this[_0xfaa3('0xc')][_0xfaa3('0x3c')],_0x5d6ba8['findBy']));var _0x46ab4f=this[_0xfaa3('0x5e')]['sync'](this,_0x5d6ba8['findBy']);if(_0x46ab4f){logger['info'](util[_0xfaa3('0x29')](_0xfaa3('0x15a'),this[_0xfaa3('0xc')][_0xfaa3('0x3c')],_0x5d6ba8[_0xfaa3('0x158')]));this['channel']['noop'](util[_0xfaa3('0x29')](_0xfaa3('0x15a'),this['channel'][_0xfaa3('0x3c')],_0x5d6ba8[_0xfaa3('0x158')]));return{'code':0xc8,'result':_0xfaa3('0x15b')};}else{logger['info'](util['format'](_0xfaa3('0x15c'),this[_0xfaa3('0xc')][_0xfaa3('0x3c')],_0x5d6ba8[_0xfaa3('0x158')]));this[_0xfaa3('0xc')][_0xfaa3('0xb3')](util[_0xfaa3('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xfaa3('0x3c')],_0x5d6ba8['findBy']));return{'code':0xc8,'result':_0xfaa3('0x15d')};}};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x15e')]=function(_0x2edc71){logger['info'](util[_0xfaa3('0x29')](_0xfaa3('0x15f'),_0x2edc71['label']));if(!this['isConfigured'](_0x2edc71['findBy'])){return this[_0xfaa3('0xc')]['error'](_0x2edc71,_0xfaa3('0x160'));}logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x2edc71[_0xfaa3('0x158')]));var _0xe780cb=this[_0xfaa3('0x5d')][_0xfaa3('0x7c')](this,_0x2edc71[_0xfaa3('0x158')]);if(_0xe780cb){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0x15a'),this['channel'][_0xfaa3('0x3c')],_0x2edc71[_0xfaa3('0x158')]));this[_0xfaa3('0xc')]['noop'](util[_0xfaa3('0x29')](_0xfaa3('0x15a'),this[_0xfaa3('0xc')][_0xfaa3('0x3c')],_0x2edc71[_0xfaa3('0x158')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xfaa3('0x29')](_0xfaa3('0x15c'),this['channel'][_0xfaa3('0x3c')],_0x2edc71['findBy']));this[_0xfaa3('0xc')]['noop'](util[_0xfaa3('0x29')](_0xfaa3('0x15c'),this[_0xfaa3('0xc')][_0xfaa3('0x3c')],_0x2edc71[_0xfaa3('0x158')]));return{'code':0xc8,'result':_0xfaa3('0x15d')};}};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x161')]=function(_0x1c93ef){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0x162'),_0x1c93ef[_0xfaa3('0x39')]));if(!this['isConfigured'](_0x1c93ef[_0xfaa3('0x163')])){return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0x1c93ef,_0xfaa3('0x164'));}this[_0xfaa3('0xc')][_0xfaa3('0xb3')](util[_0xfaa3('0x29')](_0xfaa3('0x165'),_0x1c93ef[_0xfaa3('0x163')]));var _0x4a051b=eval(_0x1c93ef[_0xfaa3('0x163')]);if(!this[_0xfaa3('0xae')](_0x1c93ef[_0xfaa3('0xe5')])){return this[_0xfaa3('0xc')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4fc8e3=this[_0xfaa3('0xf')][_0xfaa3('0x7c')](this,_0x1c93ef['variable_id']);if(!_0x4fc8e3){return this[_0xfaa3('0xc')]['error'](_0x1c93ef,_0xfaa3('0x118'));}if(_['isArray'](_0x4a051b)){var _0x44664b=this;_0x4a051b[_0xfaa3('0xe6')](function(_0x186324,_0x22377d){_0x44664b[_0xfaa3('0xc')][_0xfaa3('0xa2')](util['format'](_0xfaa3('0x166'),_0x4fc8e3,_0x22377d),_0x186324);});return this['channel'][_0xfaa3('0xb3')](util[_0xfaa3('0x29')](_0xfaa3('0x167'),_0x4fc8e3));}else{return this[_0xfaa3('0xc')][_0xfaa3('0xa2')](_0x4fc8e3,_0x4a051b);}};AGIVertices['prototype'][_0xfaa3('0x168')]=function(_0x376d7c){logger[_0xfaa3('0x2e')](util['format'](_0xfaa3('0x169'),_0x376d7c['label']));if(_0x376d7c[_0xfaa3('0xb0')]===0x0){return this[_0xfaa3('0xaf')](_0x376d7c);}_0x376d7c[_0xfaa3('0xb0')]-=0x1;if(!this[_0xfaa3('0xae')](_0x376d7c[_0xfaa3('0x111')])){return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0x376d7c,_0xfaa3('0x110'));}var _0x1e92c6=this[_0xfaa3('0x1e')][_0xfaa3('0x7c')](this,_0x376d7c[_0xfaa3('0x111')]);if(!_0x1e92c6){return this[_0xfaa3('0xc')]['error'](_0x376d7c,_0xfaa3('0x112'));}var _0x6b435f=this[_0xfaa3('0xc')][_0xfaa3('0x114')](_0x1e92c6,_0x376d7c[_0xfaa3('0x115')],_0x376d7c[_0xfaa3('0x16a')]);var _0x40e9c4=_0x6b435f['result'];if(_0x6b435f[_0xfaa3('0xac')]===-0x1){this[_0xfaa3('0x37')][_0xfaa3('0x7c')](this,_0x376d7c,'-1');return _0x6b435f;}else if(_0x6b435f[_0xfaa3('0xa9')]==='timeout'){_0x6b435f[_0xfaa3('0xac')]=_0x6b435f[_0xfaa3('0xac')][_0xfaa3('0xa7')]>0x0?_0x6b435f[_0xfaa3('0xac')]:'t';}else if(_[_0xfaa3('0x4e')](_0x6b435f[_0xfaa3('0xac')])){_0x6b435f['result']='#';_0x40e9c4='#';}if(!this['isConfigured'](_0x376d7c[_0xfaa3('0xe5')])){this[_0xfaa3('0xc')][_0xfaa3('0xb3')](_0xfaa3('0x113'));}else{var _0xed1f6=this[_0xfaa3('0xf')][_0xfaa3('0x7c')](this,_0x376d7c[_0xfaa3('0xe5')]);if(!_0xed1f6){return this[_0xfaa3('0xc')]['error'](_0x376d7c,_0xfaa3('0x118'));}this[_0xfaa3('0xc')][_0xfaa3('0xa2')](_0xed1f6,_0x40e9c4);}this['createSquareDetailsReport'][_0xfaa3('0x7c')](this,_0x376d7c,_0x40e9c4);return _0x6b435f;};AGIVertices['prototype'][_0xfaa3('0xb3')]=function(_0x56e156){logger['info'](util[_0xfaa3('0x29')](_0xfaa3('0x16b'),_0x56e156['label']));return this[_0xfaa3('0xc')][_0xfaa3('0xb3')](_0x56e156[_0xfaa3('0x16c')]||_0x56e156[_0xfaa3('0x39')]);};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x16d')]=function(_0x3e5df1){logger['info'](util[_0xfaa3('0x29')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x3e5df1['label']));if(!this[_0xfaa3('0xae')](_0x3e5df1[_0xfaa3('0x158')])){return this[_0xfaa3('0xc')]['error'](_0x3e5df1,_0xfaa3('0x160'));}logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0x159'),this[_0xfaa3('0xc')][_0xfaa3('0x3c')],_0x3e5df1[_0xfaa3('0x158')]));var _0x4d9aa2=this['getPause'][_0xfaa3('0x7c')](this,_0x3e5df1[_0xfaa3('0x16e')]);var _0x13bd2c=this['agentPause'][_0xfaa3('0x7c')](this,_0x3e5df1[_0xfaa3('0x158')],_0x4d9aa2);if(_0x13bd2c){logger['info'](util[_0xfaa3('0x29')](_0xfaa3('0x15a'),this[_0xfaa3('0xc')][_0xfaa3('0x3c')],_0x3e5df1[_0xfaa3('0x158')]));this['channel'][_0xfaa3('0xb3')](util[_0xfaa3('0x29')](_0xfaa3('0x15a'),this[_0xfaa3('0xc')][_0xfaa3('0x3c')],_0x3e5df1[_0xfaa3('0x158')]));return{'code':0xc8,'result':'success'};}else{logger[_0xfaa3('0x2e')](util['format'](_0xfaa3('0x15c'),this[_0xfaa3('0xc')][_0xfaa3('0x3c')],_0x3e5df1[_0xfaa3('0x158')]));this['channel'][_0xfaa3('0xb3')](util[_0xfaa3('0x29')](_0xfaa3('0x15a'),this[_0xfaa3('0xc')][_0xfaa3('0x3c')],_0x3e5df1[_0xfaa3('0x158')]));return{'code':0xc8,'result':_0xfaa3('0x15d')};}};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x16f')]=function(_0x34a444){logger['info'](util[_0xfaa3('0x29')](_0xfaa3('0x170'),_0x34a444['label']));if(!this[_0xfaa3('0xae')](_0x34a444[_0xfaa3('0x111')])){return this[_0xfaa3('0xc')]['error'](_0x34a444,_0xfaa3('0x110'));}var _0x753057=this[_0xfaa3('0x1e')][_0xfaa3('0x7c')](this,_0x34a444[_0xfaa3('0x111')]);if(!_0x753057){return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0x34a444,_0xfaa3('0x112'));}var _0x5467d3=this[_0xfaa3('0xc')][_0xfaa3('0x62')]('PLAYBACK',[_0x753057,_0x34a444[_0xfaa3('0xf1')]]);if(_0x5467d3[_0xfaa3('0xac')]===-0x1){return _0x5467d3;}return this[_0xfaa3('0xc')]['noop'](util[_0xfaa3('0x29')](_0xfaa3('0xcc'),_0xfaa3('0x171'),_0x753057));};AGIVertices['prototype'][_0xfaa3('0x172')]=function(_0x1c0f88){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0x173'),_0x1c0f88[_0xfaa3('0x39')]));if(!this[_0xfaa3('0xae')](_0x1c0f88[_0xfaa3('0x174')])){return this[_0xfaa3('0xc')]['error'](_0x1c0f88,_0xfaa3('0x175'));}var _0x16a163='';var _0x5cdc01=parseInt(_0x1c0f88[_0xfaa3('0x174')],0xa);if(isNaN(_0x5cdc01)){_0x16a163=_0x1c0f88[_0xfaa3('0x174')];}else{_0x16a163=this[_0xfaa3('0x13')][_0xfaa3('0x7c')](this,_0x1c0f88[_0xfaa3('0x174')]);if(!_0x16a163){return this['channel'][_0xfaa3('0x2c')](_0x1c0f88,_0xfaa3('0x176'));}}var _0x15b25c='';if(this['isConfigured'](_0x1c0f88['file_id'])){var _0xba44aa=this[_0xfaa3('0x1e')]['sync'](this,_0x1c0f88[_0xfaa3('0x111')]);if(_0xba44aa){_0x15b25c=_0xba44aa;}}this[_0xfaa3('0x37')]['sync'](this,_0x1c0f88,_0x16a163);if(_0x1c0f88[_0xfaa3('0xf1')][_0xfaa3('0x177')]('x')<0x0){_0x1c0f88[_0xfaa3('0xf1')]+='x';}if(_0x1c0f88[_0xfaa3('0xf1')]['indexOf']('X')<0x0){_0x1c0f88[_0xfaa3('0xf1')]+='X';}this[_0xfaa3('0xc')][_0xfaa3('0xa2')]('XMCS-QUEUE',_0x16a163?_0x16a163[_0xfaa3('0x178')]():'');var _0x30bd2e=this[_0xfaa3('0xc')][_0xfaa3('0x62')](_0xfaa3('0x179'),[_0x16a163,_0x1c0f88[_0xfaa3('0xf1')],_0x1c0f88[_0xfaa3('0x70')],_0x15b25c,_0x1c0f88['timeout'],_0x1c0f88[_0xfaa3('0x6')],_0x1c0f88['macro'],_0x1c0f88[_0xfaa3('0x17a')],'',_0x1c0f88[_0xfaa3('0x17b')]]);if(_0x30bd2e[_0xfaa3('0xac')]===-0x1){return _0x30bd2e;}return this[_0xfaa3('0xc')]['noop'](util[_0xfaa3('0x29')](_0xfaa3('0xcc'),_0xfaa3('0x179'),_0x16a163));};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x17c')]=function(_0x572394){logger['info'](util[_0xfaa3('0x29')](_0xfaa3('0x17d'),_0x572394['label']));var _0x14dc36=_0x572394[_0xfaa3('0x17e')]||'wav';var _0x42e466=util[_0xfaa3('0x29')](_0xfaa3('0x17f'),this[_0xfaa3('0xc')][_0xfaa3('0x38')],rs[_0xfaa3('0x11d')](0x5));var _0x3be8cf=util['format'](_0xfaa3('0x180'),FILES_PATH,_0x42e466,_0x14dc36);var _0x46cb92=util[_0xfaa3('0x29')](_0xfaa3('0x132'),FILES_PATH,_0x42e466);this[_0xfaa3('0x3b')][_0xfaa3('0x7c')](this,_0x572394,_0x42e466,_0x3be8cf);this[_0xfaa3('0xc')]['setVariable'](_0xfaa3('0x181'),_0x42e466);logger['info'](_0xfaa3('0x182'),_0x46cb92,_0x14dc36,_0x572394[_0xfaa3('0x183')],_0x572394['timeout']);return this[_0xfaa3('0xc')][_0xfaa3('0x135')](_0x46cb92,_0x14dc36,_0x572394[_0xfaa3('0x183')],_0x572394['timeout'],undefined,!![]);};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x184')]=function(_0x31b510){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0x185'),_0x31b510[_0xfaa3('0x39')]));if(!this[_0xfaa3('0xae')](_0x31b510[_0xfaa3('0x70')])){return this[_0xfaa3('0xc')]['noop'](_0xfaa3('0x186'));}var _0x503af7=this['restAPI'][_0xfaa3('0x7c')](this,_0x31b510);logger['info'](util[_0xfaa3('0x29')](_0xfaa3('0x187'),util[_0xfaa3('0x188')](_0x503af7,{'showHidden':![],'depth':null})));if(!this[_0xfaa3('0xae')](_0x31b510['variable_id'])){return this['channel'][_0xfaa3('0xb3')](_0xfaa3('0x189'));}var _0x2e585a=this[_0xfaa3('0xf')]['sync'](this,_0x31b510['variable_id']);if(!_0x2e585a){return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0x31b510,_0xfaa3('0x118'));}this[_0xfaa3('0xc')][_0xfaa3('0xa2')](util[_0xfaa3('0x29')](_0xfaa3('0x18a'),_0x2e585a),_0x503af7[_0xfaa3('0x80')]?_0x503af7[_0xfaa3('0x80')]:_0xfaa3('0x18b'));this['channel'][_0xfaa3('0xa2')](util[_0xfaa3('0x29')]('%s_STATUS_MESSAGE',_0x2e585a),_0x503af7['statusMessage']?_0x503af7[_0xfaa3('0x81')]:'OK');if(_0x503af7[_0xfaa3('0x77')]){try{this[_0xfaa3('0xa1')](_0x503af7[_0xfaa3('0x77')],_0x2e585a);}catch(_0x45889){logger[_0xfaa3('0x2c')](util[_0xfaa3('0x29')](_0xfaa3('0x18c'),_0x2e585a));}}return this[_0xfaa3('0xc')][_0xfaa3('0xb3')](util[_0xfaa3('0x29')]('variable\x20%s\x20set',_0x2e585a));};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x18d')]=function(_0x3dd912){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0x18e'),_0x3dd912[_0xfaa3('0x39')]));return this[_0xfaa3('0xc')][_0xfaa3('0x18f')](_0x3dd912[_0xfaa3('0x190')]['replace'](/\s+/g,''),_0x3dd912[_0xfaa3('0x183')]);};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x191')]=function(_0x2063c7){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0x192'),_0x2063c7[_0xfaa3('0x39')]));return this['channel']['sayNumber'](_0x2063c7[_0xfaa3('0x193')][_0xfaa3('0xe3')](/\s+/g,''),_0x2063c7[_0xfaa3('0x183')]);};AGIVertices['prototype'][_0xfaa3('0x194')]=function(_0x517f80){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x517f80['label']));return this[_0xfaa3('0xc')][_0xfaa3('0x195')](_0x517f80[_0xfaa3('0x66')],_0x517f80['escape_digits']);};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x196')]=function(_0x1a8b93){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0x197'),_0x1a8b93[_0xfaa3('0x39')]));if(!this[_0xfaa3('0xae')](_0x1a8b93['account_id'])){return this[_0xfaa3('0xc')][_0xfaa3('0xb3')](_0xfaa3('0x198'));}var _0x1b2834=this[_0xfaa3('0x21')]['sync'](this,_0x1a8b93['account_id']);if(!_0x1b2834||!_0x1b2834[_0xfaa3('0x199')]){return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0x1a8b93,_0xfaa3('0x19a'));}var _0x56277a={'from':util['format'](_0xfaa3('0x19b'),_0x1b2834[_0xfaa3('0x1b')],_0x1b2834['email']||_0x1b2834[_0xfaa3('0x199')][_0xfaa3('0x19c')]),'to':_0x1a8b93['to']||'','cc':_0x1a8b93['cc']||'','bcc':_0x1a8b93[_0xfaa3('0x19d')]||'','subject':_0x1a8b93[_0xfaa3('0x19e')],'html':_0x1a8b93[_0xfaa3('0x66')],'text':_0x1a8b93[_0xfaa3('0x66')]};var _0x5dc6ec={'tls':{'rejectUnauthorized':![]}};if(_0x1b2834[_0xfaa3('0x199')][_0xfaa3('0x19f')]){_0x5dc6ec[_0xfaa3('0x19f')]=_0x1b2834[_0xfaa3('0x199')][_0xfaa3('0x19f')];}else{_0x5dc6ec[_0xfaa3('0x1a0')]=_0x1b2834[_0xfaa3('0x199')][_0xfaa3('0x1a0')];_0x5dc6ec[_0xfaa3('0x1a1')]=_0x1b2834[_0xfaa3('0x199')]['port'];_0x5dc6ec[_0xfaa3('0x1a2')]=_0x1b2834[_0xfaa3('0x199')]['secure'];}if(_0x1b2834['Smtp'][_0xfaa3('0x1a3')]){_0x5dc6ec[_0xfaa3('0x1a4')]={'user':_0x1b2834[_0xfaa3('0x199')][_0xfaa3('0x19c')],'pass':_0x1b2834['Smtp'][_0xfaa3('0x1a5')]};}if(this[_0xfaa3('0xae')](_0x1a8b93['template_id'])){}logger[_0xfaa3('0xec')]('sendMail\x20message',JSON[_0xfaa3('0x7e')](_0x56277a));this['createSquareDetailsReport']['sync'](this,_0x1a8b93,_0x1a8b93[_0xfaa3('0x1a6')]);this[_0xfaa3('0xc')][_0xfaa3('0xb3')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x1b2834['name']));this[_0xfaa3('0x23')]['sync'](this,_0x5dc6ec,_0x56277a);return this[_0xfaa3('0xc')][_0xfaa3('0xb3')](_0xfaa3('0x1a7'));};AGIVertices['prototype'][_0xfaa3('0x1a8')]=function(_0x550a01){logger[_0xfaa3('0x2e')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x550a01[_0xfaa3('0x39')]));return this['channel'][_0xfaa3('0xb3')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x1a9')]=function(_0x4505a5){logger[_0xfaa3('0x2e')](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x4505a5[_0xfaa3('0x39')]));if(!this['isConfigured'](_0x4505a5[_0xfaa3('0x1aa')])){return this['channel'][_0xfaa3('0xb3')]('no\x20sms\x20account\x20configured');}var _0xcfc4a3=this[_0xfaa3('0x1ab')][_0xfaa3('0x7c')](this,_0x4505a5['sms_account_id']);if(!_0xcfc4a3){return this[_0xfaa3('0xc')]['error'](_0x4505a5,_0xfaa3('0x1ac'));}var _0x4eab28={'body':_0x4505a5[_0xfaa3('0x1ad')],'phone':_0x4505a5['to']||'','SmsAccountId':_0xcfc4a3['id']};logger[_0xfaa3('0xec')](_0xfaa3('0x1ae'),JSON['stringify'](_0x4eab28));this[_0xfaa3('0x37')][_0xfaa3('0x7c')](this,_0x4505a5,_0x4505a5[_0xfaa3('0x1aa')]);this[_0xfaa3('0xc')]['noop'](util['format'](_0xfaa3('0x1af'),_0xcfc4a3[_0xfaa3('0x1b')]));this[_0xfaa3('0x36')][_0xfaa3('0x7c')](this,_0x4eab28);return this[_0xfaa3('0xc')]['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xfaa3('0xe')]['set']=function(_0x4ae7bf){logger['info'](util[_0xfaa3('0x29')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x4ae7bf['label']));if(!this[_0xfaa3('0xae')](_0x4ae7bf['variable_id'])){return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0x4ae7bf,_0xfaa3('0x1b0'));}var _0x30b681=this['getVariable'][_0xfaa3('0x7c')](this,_0x4ae7bf['variable_id']);if(!_0x30b681){return this[_0xfaa3('0xc')]['error'](_0x4ae7bf,_0xfaa3('0x118'));}return this['channel'][_0xfaa3('0xa2')](_0x30b681,_0x4ae7bf[_0xfaa3('0x1b1')]);};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x1b2')]=function(_0x3d4666){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0x1b3'),_0x3d4666['label']));this[_0xfaa3('0xc')][_0xfaa3('0xb3')]('START\x20CALLY\x20SQUARE');if(_0x3d4666[_0xfaa3('0xc2')]==='yes'){this['channel'][_0xfaa3('0xb3')](_0xfaa3('0x1b4'));return this[_0xfaa3('0xc')][_0xfaa3('0xc2')]();}return this[_0xfaa3('0xc')]['noop'](_0xfaa3('0x1b5'));};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x1b6')]=function(_0xdfa70e){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0x1b7'),_0xdfa70e[_0xfaa3('0x39')]));if(!this['isConfigured'](_0xdfa70e[_0xfaa3('0x1b8')])){return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0xdfa70e,_0xfaa3('0x1b9'));}var _0x34704e=this['getSquareProject'][_0xfaa3('0x7c')](this,_0xdfa70e[_0xfaa3('0x1b8')]);if(!this[_0xfaa3('0xae')](_0x34704e)){return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0xdfa70e,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0xdfa70e[_0xfaa3('0x1b8')]));}if(_0x34704e===this[_0xfaa3('0xc')][_0xfaa3('0x1ba')]){return this['channel'][_0xfaa3('0x2c')](_0xdfa70e,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport'][_0xfaa3('0x7c')](this,_0xdfa70e,_0x34704e);var _0x4c6aeb=this[_0xfaa3('0xc')][_0xfaa3('0x62')]('AGI',util[_0xfaa3('0x29')](_0xfaa3('0x1bb'),config[_0xfaa3('0x6')]['host']||'127.0.0.1',_0x34704e,this[_0xfaa3('0xc')][_0xfaa3('0x1ba')]));if(_0x4c6aeb[_0xfaa3('0xac')]===-0x1){return _0x4c6aeb;}return this[_0xfaa3('0xc')]['noop'](util[_0xfaa3('0x29')](_0xfaa3('0xcc'),_0xfaa3('0x1bc'),_0x34704e));};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x1bd')]=function(_0xf1d059){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0x1be'),_0xf1d059['label']));var _0x401b0f=this['shellCommand'][_0xfaa3('0x7c')](this,_0xf1d059[_0xfaa3('0xbe')]);this['createSquareDetailsReport'][_0xfaa3('0x7c')](this,_0xf1d059,_0xf1d059[_0xfaa3('0xbe')]);if(this[_0xfaa3('0xae')](_0xf1d059[_0xfaa3('0xe5')])){var _0x4ce2d4=this[_0xfaa3('0xf')][_0xfaa3('0x7c')](this,_0xf1d059[_0xfaa3('0xe5')]);if(_0x4ce2d4){this['channel'][_0xfaa3('0xa2')](_0x4ce2d4,_0x401b0f);return this[_0xfaa3('0xc')][_0xfaa3('0xb3')](util[_0xfaa3('0x29')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0xf1d059[_0xfaa3('0xbe')],_0x4ce2d4));}}return this[_0xfaa3('0xc')]['noop'](util[_0xfaa3('0x29')](_0xfaa3('0x1bf'),_0xf1d059[_0xfaa3('0xbe')]));};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x1c0')]=function(_0x7a0793){logger[_0xfaa3('0x2e')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x7a0793['label']));_0x7a0793[_0xfaa3('0x66')]=_0x7a0793[_0xfaa3('0x66')][_0xfaa3('0xe3')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xfaa3('0xae')](_0x7a0793[_0xfaa3('0x1c1')])){return this[_0xfaa3('0xc')]['noop'](_0xfaa3('0x1c2'));}if(!this[_0xfaa3('0xae')](_0x7a0793[_0xfaa3('0x66')])){return this['channel']['noop'](_0xfaa3('0xcf'));}this['channel'][_0xfaa3('0xb3')](util[_0xfaa3('0x29')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x7a0793[_0xfaa3('0x66')]));var _0x67d425=this[_0xfaa3('0x64')]['sync'](this,_0x7a0793);if(_0x67d425){this[_0xfaa3('0xc')][_0xfaa3('0xb3')](util['format'](_0xfaa3('0x1c3'),_0x67d425));var _0x418d4b=this[_0xfaa3('0xc')][_0xfaa3('0x128')](_0x67d425);try{fs[_0xfaa3('0x104')](_0x67d425+_0xfaa3('0x129'));}catch(_0x5b9d20){logger[_0xfaa3('0x2c')](_0x5b9d20);}return _0x418d4b;}return this['channel'][_0xfaa3('0x2c')](_0x7a0793,_0xfaa3('0x1c4'));};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x1c5')]=function(_0x258ea9){logger['info'](util[_0xfaa3('0x29')](_0xfaa3('0x1c6'),_0x258ea9[_0xfaa3('0x39')]));_0x258ea9[_0xfaa3('0x66')]=_0x258ea9[_0xfaa3('0x66')][_0xfaa3('0xe3')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xfaa3('0xae')](_0x258ea9[_0xfaa3('0x66')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0xfaa3('0xc')][_0xfaa3('0xb3')](util[_0xfaa3('0x29')](_0xfaa3('0x1c7'),_0x258ea9[_0xfaa3('0x66')]));var _0x419d9c=this[_0xfaa3('0x6d')][_0xfaa3('0x7c')](this,_0x258ea9);if(_0x419d9c){this[_0xfaa3('0xc')][_0xfaa3('0xb3')](util[_0xfaa3('0x29')]('Google\x20TTS\x20%s\x20file\x20created',_0x419d9c));var _0x4180f5=this[_0xfaa3('0xc')][_0xfaa3('0x128')](_0x419d9c);try{fs['unlink'](_0x419d9c+_0xfaa3('0x129'));}catch(_0x109998){logger[_0xfaa3('0x2c')](_0x109998);}return _0x4180f5;}return this[_0xfaa3('0xc')]['error'](_0x258ea9,_0xfaa3('0x1c8'));};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x1c9')]=function(_0x16b936){logger['info'](util[_0xfaa3('0x29')](_0xfaa3('0x1ca'),_0x16b936['label']));if(!this[_0xfaa3('0xae')](_0x16b936[_0xfaa3('0x158')])){return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0x16b936,_0xfaa3('0x160'));}logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xfaa3('0xc')][_0xfaa3('0x3c')],_0x16b936[_0xfaa3('0x158')]));var _0x172e2e=this['agentUnpause'][_0xfaa3('0x7c')](this,_0x16b936[_0xfaa3('0x158')]);if(_0x172e2e){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0x15a'),this[_0xfaa3('0xc')]['callerid'],_0x16b936[_0xfaa3('0x158')]));this[_0xfaa3('0xc')][_0xfaa3('0xb3')](util[_0xfaa3('0x29')](_0xfaa3('0x15a'),this['channel'][_0xfaa3('0x3c')],_0x16b936[_0xfaa3('0x158')]));return{'code':0xc8,'result':_0xfaa3('0x15b')};}else{logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0x15c'),this[_0xfaa3('0xc')][_0xfaa3('0x3c')],_0x16b936[_0xfaa3('0x158')]));this[_0xfaa3('0xc')][_0xfaa3('0xb3')](util[_0xfaa3('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xfaa3('0xc')][_0xfaa3('0x3c')],_0x16b936[_0xfaa3('0x158')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xfaa3('0xe')][_0xfaa3('0x1cb')]=function(_0xb1d64f){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0xb1d64f[_0xfaa3('0x39')]));var _0x55692c=this[_0xfaa3('0xc')][_0xfaa3('0x62')](_0xfaa3('0x1cc'),[_0xb1d64f[_0xfaa3('0x1cd')],_0xb1d64f[_0xfaa3('0x84')]]);if(_0x55692c['result']===-0x1){return _0x55692c;}return this[_0xfaa3('0xc')]['noop'](util['format'](_0xfaa3('0xcc'),_0xfaa3('0x1cc'),_0xb1d64f['mailbox']));};AGIVertices['prototype'][_0xfaa3('0x1ce')]=function(_0xeb9e36){logger[_0xfaa3('0x2e')](util[_0xfaa3('0x29')](_0xfaa3('0x1cf'),_0xeb9e36[_0xfaa3('0x39')]));if(!this[_0xfaa3('0xae')](_0xeb9e36[_0xfaa3('0xe5')])){return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0xeb9e36,'no\x20variable\x20selected');}var _0x351b69=this[_0xfaa3('0xf')][_0xfaa3('0x7c')](this,_0xeb9e36[_0xfaa3('0xe5')]);if(!_0x351b69){return this[_0xfaa3('0xc')][_0xfaa3('0x2c')](_0xeb9e36,_0xfaa3('0x118'));}var _0x7e4e9b=this[_0xfaa3('0xc')][_0xfaa3('0xf')](_0x351b69);return{'code':0xc8,'result':_0x7e4e9b[_0xfaa3('0xa9')]?_0x7e4e9b[_0xfaa3('0xa9')]:'-'};};String['prototype'][_0xfaa3('0xa8')]=function(_0x30d691,_0x18f4a7){return this[_0xfaa3('0xa5')](_0x30d691)[_0xfaa3('0x1d0')](_0x18f4a7);};module[_0xfaa3('0x1d1')]=AGIVertices; \ No newline at end of file +var _0xddee=['moment','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','prototype','getVariable','getVariableById','then','name','catch','rpc','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSoundById','getSoundPath','getMailAccountById','sendMailMessage','mailRpc','getIntervalById','IntervalId','map','Intervals','interval','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','priority','dnid','file','createSquareMessage','createCmContact','in\x20createcmcontact','in\x20createcmcontact\x20callback','has','dialTimezone','isNil','log','VALUE\x20TZ','getContactByPhone','RETVALRPC','TZ\x20found\x20in\x20shared:','isEmpty','callback_','lastName','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','getPause','getPauseById','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','googleCloudTTS','apiKey','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','body','statusCode','statusMessage','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','isString','saveRestApiResult','isPlainObject','%s.%s','setVariable','replaceall\x20init','split','nextbracket','extra','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','exec','result','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','enter\x20in\x20callbackblock','Enter\x20in\x20CALLBACK\x20(%s)\x20block','add','minutes','callback_priority','before\x20createcmcontact','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','forEach','keys','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','failure','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','QUEUE','macro','gosub','position','Executed\x20command\x20%s\x20%s','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','service','host','secure','auth','user','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','sms_account_id','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','lodash','shelljs','odbc'];(function(_0x61c01a,_0x3fca41){var _0x498cbd=function(_0x135f4b){while(--_0x135f4b){_0x61c01a['push'](_0x61c01a['shift']());}};_0x498cbd(++_0x3fca41);}(_0xddee,0x1d2));var _0xedde=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0xddee[_0x4e7d25];return _0x526fe6;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require(_0xedde('0x0'));var sh=require(_0xedde('0x1'));var odbc=require(_0xedde('0x2'))();var rs=require('randomstring');var moment=require(_0xedde('0x3'));var Mustache=require(_0xedde('0x4'));var rp=require(_0xedde('0x5'));var logger=require(_0xedde('0x6'))(_0xedde('0x7'));var config=require(_0xedde('0x8'));var shared=require(_0xedde('0x9'));var scripts=require(_0xedde('0xa'));var FILES_PATH=_0xedde('0xb');var recursiveMapAttributes=[_0xedde('0xc'),'rawBody'];var verticesWithRetry=[_0xedde('0xd'),_0xedde('0xe'),_0xedde('0xf')];var AGIVertices=function(_0x209964,_0x2c83e9,_0x2a13c8){this[_0xedde('0x10')]=_0x209964;this['rpc']=_0x2c83e9;this['mailRpc']=_0x2a13c8;};AGIVertices[_0xedde('0x11')][_0xedde('0x12')]=function(_0x2d555f,_0x3e3a15){this['rpc'][_0xedde('0x13')](_0x2d555f)[_0xedde('0x14')](function(_0x3fc766){_0x3e3a15(null,_0x3fc766?_0x3fc766[_0xedde('0x15')]:![]);})[_0xedde('0x16')](function(_0x431bb8){_0x3e3a15(_0x431bb8);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x6995cd,_0x59efae){this[_0xedde('0x17')][_0xedde('0x18')](_0x6995cd)[_0xedde('0x14')](function(_0x25ec5b){_0x59efae(null,_0x25ec5b?_0x25ec5b['name']:![]);})[_0xedde('0x16')](function(_0x11fe07){_0x59efae(_0x11fe07);});};AGIVertices[_0xedde('0x11')][_0xedde('0x19')]=function(_0x2ed3fc,_0x11a989){this[_0xedde('0x17')][_0xedde('0x1a')](_0x2ed3fc)[_0xedde('0x14')](function(_0x5abe1f){_0x11a989(null,_0x5abe1f?_0x5abe1f[_0xedde('0x15')]:![]);})[_0xedde('0x16')](function(_0x2b1b79){_0x11a989(_0x2b1b79);});};AGIVertices[_0xedde('0x11')][_0xedde('0x1b')]=function(_0xd43a19,_0x591c6b){this[_0xedde('0x17')][_0xedde('0x1c')](_0xd43a19)[_0xedde('0x14')](function(_0x488cad){_0x591c6b(null,_0x488cad?_0x488cad[_0xedde('0x1d')]:![]);})[_0xedde('0x16')](function(_0x3e189a){_0x591c6b(_0x3e189a);});};AGIVertices['prototype'][_0xedde('0x1e')]=function(_0x48f78b,_0x5e7058){this['rpc'][_0xedde('0x1f')](_0x48f78b)[_0xedde('0x14')](function(_0x33548e){_0x5e7058(null,_0x33548e?_0x33548e[_0xedde('0x15')]:![]);})['catch'](function(_0x5c0c1e){_0x5e7058(_0x5c0c1e);});};AGIVertices['prototype'][_0xedde('0x20')]=function(_0x5924a3,_0x2f3c8c){this['rpc']['getTrunkById'](_0x5924a3)[_0xedde('0x14')](function(_0x221f21){_0x2f3c8c(null,_0x221f21?_0x221f21[_0xedde('0x15')]:![]);})[_0xedde('0x16')](function(_0x21c847){_0x2f3c8c(_0x21c847);});};AGIVertices['prototype']['getSound']=function(_0x2c8a24,_0x5e1866){var _0x48b896=this;this[_0xedde('0x17')][_0xedde('0x21')](_0x2c8a24)['then'](function(_0x8e8c6e){_0x5e1866(null,_0x8e8c6e?_0x48b896[_0xedde('0x22')](_0x8e8c6e['save_name']):![]);})[_0xedde('0x16')](function(_0x3b6903){_0x5e1866(_0x3b6903);});};AGIVertices[_0xedde('0x11')]['getMailAccount']=function(_0x47cf2d,_0x3e7b9d){this[_0xedde('0x17')][_0xedde('0x23')](_0x47cf2d)[_0xedde('0x14')](function(_0x46e717){_0x3e7b9d(null,_0x46e717?_0x46e717:![]);})['catch'](function(_0x5a3327){_0x3e7b9d(_0x5a3327);});};AGIVertices[_0xedde('0x11')][_0xedde('0x24')]=function(_0x16a8fe,_0x263601,_0x513f99){this[_0xedde('0x25')]['sendMailMessage'](_0x16a8fe,_0x263601)['then'](function(){_0x513f99(null);})[_0xedde('0x16')](function(_0x45a9ae){_0x513f99(_0x45a9ae);});};AGIVertices['prototype']['getIntervals']=function(_0x144cbe,_0x4ef0be){this[_0xedde('0x17')][_0xedde('0x26')](_0x144cbe)[_0xedde('0x14')](function(_0x242827){if(_0x242827){if(_0x242827[_0xedde('0x27')]){_0x4ef0be(null,[_0x242827['interval']]);}else{_0x4ef0be(null,_[_0xedde('0x28')](_0x242827[_0xedde('0x29')],_0xedde('0x2a')));}}else{_0x4ef0be(null,![]);}})['catch'](function(_0x1eeaf8){_0x4ef0be(_0x1eeaf8);});};AGIVertices['prototype'][_0xedde('0x22')]=function(_0x1f5904){return util[_0xedde('0x2b')](_0xedde('0x2c'),FILES_PATH,_0x1f5904);};AGIVertices['prototype'][_0xedde('0x2d')]=function(_0x4fbd8d,_0x750e2a,_0xb3362a){odbc['open'](_0x4fbd8d,function(_0x48af61){if(_0x48af61){logger[_0xedde('0x2e')](_0xedde('0x2f'),_0x48af61);_0xb3362a(_0x48af61);}else{logger[_0xedde('0x30')](_0xedde('0x31'));odbc[_0xedde('0x32')](_0x750e2a,function(_0x3ef35e,_0x2c76c8){if(_0x3ef35e){logger[_0xedde('0x30')](_0xedde('0x33'),_0x750e2a);_0xb3362a(_0x3ef35e);}else{logger[_0xedde('0x30')](_0xedde('0x34'),_0x750e2a);odbc[_0xedde('0x35')](function(_0x3e3322){if(_0x3e3322){logger[_0xedde('0x2e')](_0xedde('0x36'),_0x3e3322);}_0xb3362a(null,_0x2c76c8);});}});}});};AGIVertices[_0xedde('0x11')][_0xedde('0x37')]=function(_0x2e3da4,_0x8802fa){this[_0xedde('0x17')][_0xedde('0x38')](_0x2e3da4)[_0xedde('0x14')](function(_0x4d7a84){_0x8802fa(null,_0x4d7a84?_0x4d7a84:![]);})[_0xedde('0x16')](function(_0x3120be){_0x8802fa(_0x3120be);});};AGIVertices[_0xedde('0x11')][_0xedde('0x39')]=function(_0x9d3d1c,_0x57cbfd){this['rpc'][_0xedde('0x39')](_0x9d3d1c)['then'](function(_0x4e1c7d){_0x57cbfd(null,_0x4e1c7d);})[_0xedde('0x16')](function(_0x225b68){_0x57cbfd(_0x225b68);});};AGIVertices[_0xedde('0x11')][_0xedde('0x3a')]=function(_0x4aa8b4,_0x42fa0f,_0x4a5c2f){this[_0xedde('0x17')][_0xedde('0x3a')]({'uniqueid':this[_0xedde('0x10')][_0xedde('0x3b')],'node':_0x4aa8b4['label'],'application':_0x4aa8b4[_0xedde('0x3c')],'data':_0x42fa0f||null,'project_name':this['channel'][_0xedde('0x3d')],'callerid':this[_0xedde('0x10')][_0xedde('0x3e')]})['then'](function(_0x347889){if(_0x4a5c2f){_0x4a5c2f(null,_0x347889);}})['catch'](function(_0xdd82b8){if(_0x4a5c2f){_0x4a5c2f(_0xdd82b8);}});};AGIVertices[_0xedde('0x11')][_0xedde('0x3f')]=function(_0x464760,_0x2a22d8,_0x571ad5,_0xadb0d8){this[_0xedde('0x17')][_0xedde('0x3f')]({'uniqueid':this[_0xedde('0x10')][_0xedde('0x3b')],'callerid':this[_0xedde('0x10')][_0xedde('0x3e')],'calleridname':this[_0xedde('0x10')][_0xedde('0x40')],'context':this[_0xedde('0x10')]['context'],'extension':this['channel'][_0xedde('0x41')],'priority':this[_0xedde('0x10')][_0xedde('0x42')],'accountcode':this['channel']['accountcode'],'dnid':this['channel'][_0xedde('0x43')],'projectName':this[_0xedde('0x10')][_0xedde('0x3d')],'saveName':_0x2a22d8,'filename':_0x464760[_0xedde('0x44')]||_0x2a22d8,'savePath':_0x571ad5})[_0xedde('0x14')](function(_0xecd12b){_0xadb0d8(null,_0xecd12b);})[_0xedde('0x16')](function(_0x57c62b){_0xadb0d8(_0x57c62b);});};AGIVertices[_0xedde('0x11')][_0xedde('0x45')]=function(_0x45b792,_0x16af5e,_0x4232c9){this['rpc'][_0xedde('0x45')]({'uniqueid':this['channel']['uniqueid'],'body':_0x45b792,'direction':_0x16af5e})[_0xedde('0x14')](function(_0x27bc51){if(_0x4232c9){_0x4232c9(null,_0x27bc51);}})[_0xedde('0x16')](function(_0x52a17a){if(_0x4232c9){_0x4232c9(_0x52a17a);}});};AGIVertices[_0xedde('0x11')][_0xedde('0x46')]=function(_0x1d9c4b,_0x119ca1){console['log'](_0xedde('0x47'),_0x1d9c4b);console['log'](_0xedde('0x48'),_0x119ca1);var _0x1c7309=0x0;if(_[_0xedde('0x49')](_0x1d9c4b,_0xedde('0x4a'))){if(!_[_0xedde('0x4b')](_0x1d9c4b[_0xedde('0x4a')])){var _0xb18fcb=_0x1d9c4b[_0xedde('0x4a')];console[_0xedde('0x4c')](_0xedde('0x4d'),_0xb18fcb);if(_0x1d9c4b['dialTimezone']=='CALLERID(dialTimezone)'){this[_0xedde('0x17')][_0xedde('0x4e')]({'phone':_0x1d9c4b['phone']})[_0xedde('0x14')](function(_0x352676){console['log'](_0xedde('0x4f'),_0x352676);_0x119ca1(null,_0x352676);});}else{console[_0xedde('0x4c')](_0xedde('0x50'),shared[_0xb18fcb]);}}}this[_0xedde('0x17')][_0xedde('0x46')]({'firstName':_[_0xedde('0x51')](_0x1d9c4b[_0xedde('0x15')])||_[_0xedde('0x4b')](_0x1d9c4b['name'])?_0xedde('0x52')+Math['random']():_0x1d9c4b['name'],'lastName':_[_0xedde('0x51')](_0x1d9c4b[_0xedde('0x53')])||_[_0xedde('0x4b')](_0x1d9c4b[_0xedde('0x53')])?null:_0x1d9c4b[_0xedde('0x53')],'phone':_0x1d9c4b[_0xedde('0x54')],'ListId':_0x1d9c4b[_0xedde('0x55')],'scheduledat':_0x1d9c4b['scheduledAt'],'callbackUniqueid':this[_0xedde('0x10')][_0xedde('0x3b')],'tags':_0xedde('0x56'),'description':_0xedde('0x57')+_0x1d9c4b[_0xedde('0x58')][_0xedde('0x59')](),'priority':_0x1d9c4b['callback_priority']})[_0xedde('0x14')](function(_0x4bb7be){_0x119ca1(null,_0x4bb7be);})[_0xedde('0x16')](function(_0x327b05){_0x119ca1(_0x327b05);});};AGIVertices['prototype'][_0xedde('0x5a')]=function(_0xe8f3c4,_0x42cb0a){this[_0xedde('0x17')][_0xedde('0x5b')](_0xe8f3c4)[_0xedde('0x14')](function(_0x3b8aaa){_0x42cb0a(null,_0x3b8aaa?_0x3b8aaa[_0xedde('0x15')]:![]);})[_0xedde('0x16')](function(_0x1e70af){_0x42cb0a(_0x1e70af);});};AGIVertices[_0xedde('0x11')][_0xedde('0x5c')]=function(_0x53bbff,_0x49577a,_0x2ad9b1){var _0x47f555={'role':'agent'};_0x47f555[_0x53bbff]=this[_0xedde('0x10')][_0xedde('0x3e')];this[_0xedde('0x17')]['agentPause'](_0x47f555,_0x49577a,this[_0xedde('0x10')][_0xedde('0x3b')])[_0xedde('0x14')](function(_0x514377){_0x2ad9b1(null,_['isNil'](_0x514377)?![]:!![]);})[_0xedde('0x16')](function(_0x22b26f){logger['error'](_0x22b26f);_0x2ad9b1(null,![]);});};AGIVertices[_0xedde('0x11')][_0xedde('0x5d')]=function(_0x51df79,_0x2fb10d){var _0x1dab83={'role':_0xedde('0x5e')};_0x1dab83[_0x51df79]=this[_0xedde('0x10')]['callerid'];this[_0xedde('0x17')][_0xedde('0x5d')](_0x1dab83)[_0xedde('0x14')](function(_0x2014c6){_0x2fb10d(null,_[_0xedde('0x4b')](_0x2014c6)?![]:!![]);})['catch'](function(_0x50c3a3){logger[_0xedde('0x2e')](_0x50c3a3);_0x2fb10d(null,![]);});};AGIVertices[_0xedde('0x11')][_0xedde('0x5f')]=function(_0x4dd5aa,_0x30b634){var _0x1439b4={'role':_0xedde('0x5e')};_0x1439b4[_0x4dd5aa]=this[_0xedde('0x10')][_0xedde('0x3e')];this[_0xedde('0x17')][_0xedde('0x5f')](_0x1439b4)[_0xedde('0x14')](function(_0x5c9a2f){_0x30b634(null,_['isNil'](_0x5c9a2f)?![]:!![]);})[_0xedde('0x16')](function(_0x21a9e5){logger['error'](_0x21a9e5);_0x30b634(null,![]);});};AGIVertices[_0xedde('0x11')][_0xedde('0x60')]=function(_0x5a1d98,_0x4fc555){var _0x380f69={'role':_0xedde('0x5e')};_0x380f69[_0x5a1d98]=this[_0xedde('0x10')][_0xedde('0x3e')];var _0xb7c76f=_0x5a1d98!=_0xedde('0x61')?util['format'](_0xedde('0x62'),_0xedde('0x63'),this[_0xedde('0x10')]['callerid']):undefined;this[_0xedde('0x17')]['agentLogin'](_0x380f69,_0xb7c76f)[_0xedde('0x14')](function(_0x4cae93){_0x4fc555(null,_['isNil'](_0x4cae93)?![]:!![]);})[_0xedde('0x16')](function(_0x192412){logger[_0xedde('0x2e')](_0x192412);_0x4fc555(null,![]);});};AGIVertices[_0xedde('0x11')][_0xedde('0x64')]=function(_0x46df96,_0x533554){sh['exec'](_['trim'](_0x46df96),function(_0x3c544a,_0x423d74){var _0x5c6827=_0x423d74['replace'](/(\r\n|\n|\r)/gm,'');_0x533554(null,_0x5c6827);});};AGIVertices[_0xedde('0x11')][_0xedde('0x65')]=function(_0x3d92b0,_0x2c60e1){scripts[_0xedde('0x65')](_0x3d92b0[_0xedde('0x66')],_0x3d92b0['google_cloud_tts_text_type']||'text',_0x3d92b0[_0xedde('0x67')],_0x3d92b0[_0xedde('0x68')]||_0xedde('0x69'),_0x3d92b0['ssmlGender']||_0xedde('0x6a'),_0x3d92b0[_0xedde('0x6b')]||_0xedde('0x6c'))['then'](function(_0x4202ac){_0x2c60e1(null,_0x4202ac);})[_0xedde('0x16')](function(_0x2cb2c0){_0x2c60e1(_0x2cb2c0);});};AGIVertices[_0xedde('0x11')][_0xedde('0x6d')]=function(_0x47cc06,_0x2da882){scripts[_0xedde('0x6d')](_0x47cc06[_0xedde('0x67')],_0x47cc06[_0xedde('0x6e')]||'en',0x1)[_0xedde('0x14')](function(_0x15b353){_0x2da882(null,_0x15b353);})[_0xedde('0x16')](function(_0x273a25){_0x2da882(_0x273a25);});};AGIVertices[_0xedde('0x11')][_0xedde('0x6f')]=function(_0x363df5,_0x1f8f8b){var _0x2ea4fa={'uri':_0x363df5[_0xedde('0x70')],'method':_0x363df5[_0xedde('0x71')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x363df5[_0xedde('0x72')])===_0xedde('0x73')&&parseInt(_0x363df5[_0xedde('0x72')])>=0x1?parseInt(_0x363df5['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xedde('0x74')]([_0xedde('0x75'),_0xedde('0x76')],_0x2ea4fa[_0xedde('0x71')][_0xedde('0x77')]())){try{_0x2ea4fa['body']=_0x363df5[_0xedde('0x78')]?JSON[_0xedde('0x79')](_0x363df5['rawBody']):{};}catch(_0x264dfd){logger[_0xedde('0x2e')](_0xedde('0x7a'),_0x264dfd);}}try{_0x2ea4fa[_0xedde('0x7b')]=_0x363df5['rawHeaders']?JSON[_0xedde('0x79')](_0x363df5[_0xedde('0xc')]):{};}catch(_0x26daae){logger[_0xedde('0x2e')](_0xedde('0x7c'),_0x26daae);}if(_0x363df5[_0xedde('0x7d')]){try{var _0x1be4be=require(_0x363df5['computedVariables'])[_0xedde('0x7e')](this,_0x2ea4fa);_0x2ea4fa[_0xedde('0x7f')]=Mustache[_0xedde('0x80')](_0x363df5[_0xedde('0x70')],_0x1be4be,{},['$$','$$']);if(_0x2ea4fa[_0xedde('0x7b')]){_0x2ea4fa[_0xedde('0x7b')]=JSON['parse'](Mustache[_0xedde('0x80')](JSON[_0xedde('0x81')](_0x2ea4fa[_0xedde('0x7b')]),_0x1be4be,{},['$$','$$']));}if(_0x2ea4fa['body']){_0x2ea4fa['body']=JSON[_0xedde('0x79')](Mustache[_0xedde('0x80')](JSON['stringify'](_0x2ea4fa[_0xedde('0x82')]),_0x1be4be,{},['$$','$$']));}}catch(_0x2aa27a){logger[_0xedde('0x2e')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x2aa27a);}}rp(_0x2ea4fa)['then'](function(_0x390b9){var _0x1ee03f={'statusCode':_0x390b9[_0xedde('0x83')]||0xc8,'statusMessage':_0x390b9[_0xedde('0x84')]||'OK','headers':_0x390b9['headers']||{},'body':_0x390b9[_0xedde('0x82')]||{}};_0x1f8f8b(null,_0x1ee03f);})[_0xedde('0x16')](function(_0x2be0c4){var _0x1971ed={'statusCode':_0x2be0c4[_0xedde('0x83')]||0x1f4,'statusMessage':_0x2be0c4['message']||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x2be0c4[_0xedde('0x85')][_0xedde('0x7b')]||{},'body':_0x2be0c4['options']['body']||{}};_0x1f8f8b(null,_0x1971ed);});};AGIVertices[_0xedde('0x11')][_0xedde('0x86')]=function(_0x212eff,_0x13ec46){scripts[_0xedde('0x86')](this['channel'][_0xedde('0x3b')],_0x212eff[_0xedde('0x87')],_0x212eff[_0xedde('0x67')],_0x212eff[_0xedde('0x88')]||'en')[_0xedde('0x14')](function(_0x500b43){_0x13ec46(null,_0x500b43);})[_0xedde('0x16')](function(_0x20aa0e){_0x13ec46(_0x20aa0e);});};AGIVertices[_0xedde('0x11')]['sestekNDA']=function(_0x489bad,_0x4fdbab){scripts[_0xedde('0x89')](this[_0xedde('0x10')],_0x489bad)[_0xedde('0x14')](function(_0x2aafad){_0x4fdbab(null,_0x2aafad);})[_0xedde('0x16')](function(_0x44c078){_0x4fdbab(_0x44c078);});};AGIVertices[_0xedde('0x11')]['ispeechTTS']=function(_0x2b5e3b,_0x1abbf0){scripts[_0xedde('0x8a')](_0x2b5e3b['key'],_0x2b5e3b[_0xedde('0x67')],_0x2b5e3b[_0xedde('0x8b')]||'en-US',_0x2b5e3b[_0xedde('0x8c')])[_0xedde('0x14')](function(_0x29abb0){_0x1abbf0(null,_0x29abb0);})[_0xedde('0x16')](function(_0x5a5efd){_0x1abbf0(_0x5a5efd);});};AGIVertices[_0xedde('0x11')][_0xedde('0x8d')]=function(_0x17e0cc,_0x326009,_0x270949){scripts['ispeechASR'](_0x326009,_0x17e0cc[_0xedde('0x87')],_0x17e0cc['ispeech_asr_language']||_0xedde('0x69'),this[_0xedde('0x8e')](_0x17e0cc['model'])?_0x17e0cc['model']:undefined)['then'](function(_0x1dbf2d){_0x270949(null,_0x1dbf2d);})[_0xedde('0x16')](function(_0x1e569d){_0x270949(_0x1e569d);});};AGIVertices['prototype']['awsPolly']=function(_0x18db3b,_0x5cfbfc){scripts[_0xedde('0x8f')](_0x18db3b[_0xedde('0x90')],_0x18db3b[_0xedde('0x91')],_0x18db3b[_0xedde('0x92')],_0x18db3b['aws_polly_voice']||_0xedde('0x93'),_0x18db3b[_0xedde('0x67')],_0x18db3b['aws_text_type']||_0xedde('0x67'))[_0xedde('0x14')](function(_0x5a5350){_0x5cfbfc(null,_0x5a5350);})[_0xedde('0x16')](function(_0xd6aff7){_0x5cfbfc(_0xd6aff7);});};AGIVertices[_0xedde('0x11')][_0xedde('0x94')]=function(_0x5154c3,_0x2f63a9){scripts['awsLex'](this[_0xedde('0x10')]['uniqueid'],_0x5154c3['aws_access_key_id'],_0x5154c3['aws_secret_access_key'],_0x5154c3[_0xedde('0x95')],_0x5154c3[_0xedde('0x67')],_0x5154c3['aws_bot_name'])[_0xedde('0x14')](function(_0x11e015){_0x2f63a9(null,_0x11e015);})[_0xedde('0x16')](function(_0x19358c){_0x2f63a9(_0x19358c);});};AGIVertices[_0xedde('0x11')][_0xedde('0x96')]=function(_0x1ffaf5,_0x317388,_0x112c5a){scripts[_0xedde('0x96')](_0x317388,_0x1ffaf5[_0xedde('0x87')],_0x1ffaf5[_0xedde('0x97')]||_0xedde('0x69'))[_0xedde('0x14')](function(_0x2fa793){_0x112c5a(null,_0x2fa793);})['catch'](function(_0x4427a6){_0x112c5a(_0x4427a6);});};AGIVertices[_0xedde('0x11')][_0xedde('0x98')]=function(_0x4bae7a,_0x122e9c,_0x48dc10){scripts['tildeASR'](_0x122e9c,_0x4bae7a[_0xedde('0x99')],_0x4bae7a[_0xedde('0x9a')],_0x4bae7a[_0xedde('0x7f')])['then'](function(_0x39e9eb){_0x48dc10(null,_0x39e9eb);})['catch'](function(_0x7c6f0e){_0x48dc10(_0x7c6f0e);});};AGIVertices[_0xedde('0x11')][_0xedde('0x9b')]=function(_0x557225){var _0x13300b=_['includes'](verticesWithRetry,_0x557225[_0xedde('0x3c')])?_0x557225:_[_0xedde('0x9c')](_0x557225);for(var _0xeef56d in _0x13300b){if(_0x13300b[_0xedde('0x9d')](_0xeef56d)){if(_0x13300b[_0xeef56d]&&_['isString'](_0x13300b[_0xeef56d])){if(_['includes'](recursiveMapAttributes,_0xeef56d)){_0x13300b[_0xeef56d]=this[_0xedde('0x9e')](_0x13300b[_0xeef56d]);}else{_0x13300b[_0xeef56d]=this[_0xedde('0x9f')](_0x13300b[_0xeef56d]);}}}}return _0x13300b;};AGIVertices[_0xedde('0x11')][_0xedde('0xa0')]=function(_0x27f48d){for(var _0x50c8ca in _0x27f48d){if(_0x27f48d[_0xedde('0x9d')](_0x50c8ca)){if(_['isPlainObject'](_0x27f48d[_0x50c8ca])){this[_0xedde('0xa0')](_0x27f48d[_0x50c8ca]);}else if(_[_0xedde('0xa1')](_0x27f48d[_0x50c8ca])){for(var _0x408fc4=0x0;_0x408fc4<_0x27f48d[_0x50c8ca][_0xedde('0xa2')];_0x408fc4++){this[_0xedde('0xa0')](_0x27f48d[_0x50c8ca][_0x408fc4]);}}else if(_[_0xedde('0xa3')](_0x27f48d[_0x50c8ca])){_0x27f48d[_0x50c8ca]=this['replaceAllVariables'](_0x27f48d[_0x50c8ca]);}}}};AGIVertices[_0xedde('0x11')][_0xedde('0xa4')]=function(_0x29d0a3,_0x6097f2){for(var _0x564d6a in _0x29d0a3){if(_0x29d0a3[_0xedde('0x9d')](_0x564d6a)){if(_[_0xedde('0xa5')](_0x29d0a3[_0x564d6a])){if(!_[_0xedde('0x51')](_0x29d0a3[_0x564d6a])){this[_0xedde('0xa4')](_0x29d0a3[_0x564d6a],util[_0xedde('0x2b')]('%s.%s',_0x6097f2,_0x564d6a));}}else if(_[_0xedde('0xa1')](_0x29d0a3[_0x564d6a])){for(var _0x46c236=0x0;_0x46c236<_0x29d0a3[_0x564d6a]['length'];_0x46c236++){this[_0xedde('0xa4')](_0x29d0a3[_0x564d6a][_0x46c236],util[_0xedde('0x2b')](_0xedde('0xa6'),_0x6097f2,_0x564d6a+'['+_0x46c236+']'));}}else{if(!_['isNil'](_0x29d0a3[_0x564d6a])){this[_0xedde('0x10')][_0xedde('0xa7')](util['format'](_0xedde('0xa6'),_0x6097f2,_0x564d6a),_0x29d0a3[_0x564d6a]);}}}}};AGIVertices[_0xedde('0x11')][_0xedde('0x9e')]=function(_0x32e51f){try{var _0x2a8e4b=JSON['parse'](_0x32e51f);this[_0xedde('0xa0')](_0x2a8e4b);return JSON[_0xedde('0x81')](_0x2a8e4b);}catch(_0x1ea148){return this['replaceAllVariables'](_0x32e51f);}};AGIVertices[_0xedde('0x11')][_0xedde('0x9f')]=function(_0x267c2e){console['log'](_0xedde('0xa8'),_0x267c2e);var _0x544812=_0x267c2e['split']('{');for(var _0x3efa02=0x1;_0x3efa02<_0x544812[_0xedde('0xa2')];_0x3efa02+=0x1){var _0x51e966=_0x544812[_0x3efa02][_0xedde('0xa9')]('}');console[_0xedde('0x4c')](_0xedde('0xaa'),_0x51e966);if(_0x51e966[_0xedde('0xa2')]>0x1){_0x267c2e=_0x267c2e['replaceAll']('{'+_0x51e966[0x0]+'}',this[_0xedde('0x10')]['getVariable'](_0x51e966[0x0])[_0xedde('0xab')]||_0x51e966[0x0]);}}if(_0x544812[_0xedde('0xa2')]===0x1){return _0x267c2e['toString']();}console['log']('replaceall\x20end',_0x267c2e);return this[_0xedde('0x9f')](_0x267c2e);};AGIVertices[_0xedde('0x11')]['getAndSetVariable']=function(_0x16b924,_0x20c485){var _0x4cd5f9=this['channel'][_0xedde('0x12')](_0x16b924);if(_0x4cd5f9['result']===-0x1){return _0x4cd5f9;}logger['info'](util[_0xedde('0x2b')](_0xedde('0xac'),_0x20c485,_0x4cd5f9[_0xedde('0xab')]));return this[_0xedde('0x10')][_0xedde('0xa7')](_0x20c485,_0x4cd5f9[_0xedde('0xab')]);};AGIVertices['prototype'][_0xedde('0x8e')]=function(_0x56392c){return _0x56392c&&_0x56392c!=='0'&&_0x56392c!=='-1'&&_0x56392c!=='';};AGIVertices[_0xedde('0x11')][_0xedde('0xad')]=function(_0x3c33b7){this[_0xedde('0x3a')]['sync'](this,_0x3c33b7,'-');_0x3c33b7[_0xedde('0xae')]=_0x3c33b7[_0xedde('0xad')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xedde('0x11')][_0xedde('0xaf')]=function(_0x398f57){logger['info'](util[_0xedde('0x2b')](_0xedde('0xb0'),_0x398f57[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x398f57[_0xedde('0x67')])){return this['channel'][_0xedde('0xb2')]('no\x20text\x20configured');}var _0x24acf2='\x22'+_0x398f57[_0xedde('0x67')]+'\x22';if(this[_0xedde('0x8e')](_0x398f57[_0xedde('0x85')])){_0x24acf2+=','+_0x398f57['options'];}var _0x2c4c06=this[_0xedde('0x10')][_0xedde('0xb3')]('MRCPSynth',_0x24acf2);if(_0x2c4c06[_0xedde('0xb4')]===-0x1){return _0x2c4c06;}return this[_0xedde('0x10')][_0xedde('0xb2')](util['format'](_0xedde('0xb5'),_0x24acf2));};AGIVertices[_0xedde('0x11')][_0xedde('0xb6')]=function(_0x1f7c8d){logger[_0xedde('0x30')](util[_0xedde('0x2b')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x1f7c8d[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x1f7c8d[_0xedde('0xb7')])){return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0xb8'));}var _0x2c5454=_0x1f7c8d[_0xedde('0xb7')];if(this[_0xedde('0x8e')](_0x1f7c8d[_0xedde('0x85')])){_0x2c5454+=','+_0x1f7c8d[_0xedde('0x85')];}var _0x362ced=this[_0xedde('0x10')][_0xedde('0xb3')](_0xedde('0xb9'),_0x2c5454);if(_0x362ced[_0xedde('0xb4')]===-0x1){return _0x362ced;}var _0x20f1b9=this[_0xedde('0xba')](_0xedde('0xbb'),'MRCP_RECOG_CONFIDENCE');if(_0x20f1b9[_0xedde('0xb4')]===-0x1){return _0x20f1b9;}var _0x14eab1=this['getAndSetVariable'](_0xedde('0xbc'),_0xedde('0xbd'));if(_0x14eab1[_0xedde('0xb4')]===-0x1){return _0x14eab1;}var _0x2794fb=this[_0xedde('0xba')]('RECOG_INSTANCE()',_0xedde('0xbe'));if(_0x2794fb[_0xedde('0xb4')]===-0x1){return _0x2794fb;}return this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0xbf'),_0x2c5454));};AGIVertices[_0xedde('0x11')]['agi']=function(_0x177827){logger[_0xedde('0x30')](util[_0xedde('0x2b')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x177827['label']));return this['channel'][_0xedde('0x7')]([_0x177827[_0xedde('0xc0')],_0x177827[_0xedde('0xc1')]]);};AGIVertices['prototype'][_0xedde('0xc2')]=function(_0x23541e){logger[_0xedde('0x30')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x23541e['label']));if(this[_0xedde('0x8e')](_0x23541e[_0xedde('0x72')])){logger['info'](util[_0xedde('0x2b')](_0xedde('0xc3'),_0x23541e[_0xedde('0x72')]));var _0xb4523c=this['channel'][_0xedde('0xc4')](_0x23541e[_0xedde('0x72')]);if(_0xb4523c[_0xedde('0xb4')]===-0x1){return _0xb4523c;}}return this[_0xedde('0x10')][_0xedde('0xc2')]();};AGIVertices[_0xedde('0x11')][_0xedde('0x56')]=function(_0x4ba3c8){console[_0xedde('0x4c')](_0xedde('0xc5'),_0x4ba3c8);logger[_0xedde('0x30')](util['format'](_0xedde('0xc6'),_0x4ba3c8['label']));if(!this[_0xedde('0x8e')](_0x4ba3c8[_0xedde('0x55')])){return this['channel'][_0xedde('0x2e')](_0x4ba3c8,'no\x20list\x20selected');}_0x4ba3c8[_0xedde('0x58')]=moment();if(this[_0xedde('0x8e')](_0x4ba3c8['delay'])){_0x4ba3c8[_0xedde('0x58')]=moment()[_0xedde('0xc7')](_0x4ba3c8['delay'],_0xedde('0xc8'));}if(!this[_0xedde('0x8e')](_0x4ba3c8[_0xedde('0xc9')])){_0x4ba3c8[_0xedde('0xc9')]=0x2;}console[_0xedde('0x4c')](_0xedde('0xca'),_0x4ba3c8);this[_0xedde('0x46')]['sync'](this,_0x4ba3c8);return this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0xcb'),_0x4ba3c8[_0xedde('0x54')],_0x4ba3c8[_0xedde('0x55')],_0x4ba3c8['scheduledAt']));};AGIVertices[_0xedde('0x11')][_0xedde('0xcc')]=function(_0xab3c6f){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0xcd'),_0xab3c6f[_0xedde('0xb1')]));var _0x35b5e6=this[_0xedde('0x10')][_0xedde('0xb3')](_0xab3c6f['application'],_0xab3c6f[_0xedde('0x85')]);if(_0x35b5e6[_0xedde('0xb4')]===-0x1){return _0x35b5e6;}return this['channel'][_0xedde('0xb2')](util['format']('Executed\x20command\x20%s\x20%s',_0xab3c6f['application'],_0xab3c6f[_0xedde('0x85')]));};AGIVertices[_0xedde('0x11')][_0xedde('0xce')]=function(_0x4b2b8f){logger['info'](util[_0xedde('0x2b')](_0xedde('0xcf'),_0x4b2b8f['label']));if(!this[_0xedde('0x8e')](_0x4b2b8f['text'])){return this['channel'][_0xedde('0xb2')]('no\x20text\x20configured');}var _0x1f7fd4='\x22'+_0x4b2b8f[_0xedde('0x67')]+'\x22';if(this[_0xedde('0x8e')](_0x4b2b8f[_0xedde('0x85')])){_0x1f7fd4+=','+_0x4b2b8f['options'];}var _0x24de14=this[_0xedde('0x10')][_0xedde('0xb3')]('MRCPSynth',_0x1f7fd4);if(_0x24de14[_0xedde('0xb4')]===-0x1){return _0x24de14;}return this[_0xedde('0x10')][_0xedde('0xb2')](util['format'](_0xedde('0xb5'),_0x1f7fd4));};AGIVertices[_0xedde('0x11')]['sestektts']=function(_0x3435f3){logger['info'](util['format'](_0xedde('0xd0'),_0x3435f3[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x3435f3['text'])){return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0xd1'));}var _0x1e50d1='\x22'+_0x3435f3[_0xedde('0x67')]+'\x22';if(this[_0xedde('0x8e')](_0x3435f3[_0xedde('0x85')])){_0x1e50d1+=','+_0x3435f3[_0xedde('0x85')];}var _0x1a12cf=this['channel'][_0xedde('0xb3')](_0xedde('0xd2'),_0x1e50d1);if(_0x1a12cf[_0xedde('0xb4')]===-0x1){return _0x1a12cf;}return this['channel']['noop'](util[_0xedde('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x1e50d1));};AGIVertices[_0xedde('0x11')]['lumenvoxasr']=function(_0x4af9e1){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0xd3'),_0x4af9e1['label']));if(!this['isConfigured'](_0x4af9e1['grammar'])){return this['channel'][_0xedde('0xb2')](_0xedde('0xb8'));}var _0x2c5746=_0x4af9e1['grammar'];if(this[_0xedde('0x8e')](_0x4af9e1[_0xedde('0x85')])){_0x2c5746+=','+_0x4af9e1[_0xedde('0x85')];}var _0xad0777=this['channel'][_0xedde('0xb3')]('MRCPRecog',_0x2c5746);if(_0xad0777['result']===-0x1){return _0xad0777;}var _0x319049=this[_0xedde('0xba')]('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x319049[_0xedde('0xb4')]===-0x1){return _0x319049;}var _0x4b8880=this[_0xedde('0xba')](_0xedde('0xbc'),_0xedde('0xd4'));if(_0x4b8880[_0xedde('0xb4')]===-0x1){return _0x4b8880;}var _0x2d6d65=this[_0xedde('0xba')](_0xedde('0xd5'),_0xedde('0xd6'));if(_0x2d6d65[_0xedde('0xb4')]===-0x1){return _0x2d6d65;}return this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0xbf'),_0x2c5746));};AGIVertices[_0xedde('0x11')][_0xedde('0xd7')]=function(_0x27f15c){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0xd8'),_0x27f15c[_0xedde('0xb1')]));if(!this['isConfigured'](_0x27f15c[_0xedde('0xb7')])){return this[_0xedde('0x10')][_0xedde('0xb2')]('no\x20grammar\x20configured');}var _0x391d38=_0x27f15c['grammar'];if(this[_0xedde('0x8e')](_0x27f15c[_0xedde('0x85')])){_0x391d38+=','+_0x27f15c[_0xedde('0x85')];}var _0x423482=this[_0xedde('0x10')][_0xedde('0xb3')](_0xedde('0xb9'),_0x391d38);if(_0x423482['result']===-0x1){return _0x423482;}var _0x2f2bc1=this[_0xedde('0xba')](_0xedde('0xbb'),'SESTEK_ASR_CONFIDENCE');if(_0x2f2bc1[_0xedde('0xb4')]===-0x1){return _0x2f2bc1;}var _0x55423a=this[_0xedde('0xba')](_0xedde('0xbc'),_0xedde('0xd9'));if(_0x55423a['result']===-0x1){return _0x55423a;}var _0x1fb6d3=this[_0xedde('0xba')](_0xedde('0xd5'),_0xedde('0xda'));if(_0x1fb6d3[_0xedde('0xb4')]===-0x1){return _0x1fb6d3;}return this['channel'][_0xedde('0xb2')](util[_0xedde('0x2b')]('Executed\x20command\x20MRCPRecog\x20%s',_0x391d38));};AGIVertices['prototype'][_0xedde('0xdb')]=function(_0x2b3178){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0xdc'),_0x2b3178[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x2b3178[_0xedde('0xdd')])){return this[_0xedde('0x10')]['error'](_0x2b3178,_0xedde('0xde'));}var _0x1e0a79=this[_0xedde('0x1b')]['sync'](this,_0x2b3178[_0xedde('0xdd')]);if(!_0x1e0a79){return this[_0xedde('0x10')]['error'](_0x2b3178,_0xedde('0xdf'));}if(!this[_0xedde('0x8e')](_0x2b3178[_0xedde('0x32')])){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x2b3178,_0xedde('0xe0'));}var _0x53bc21=_0x2b3178['query'][_0xedde('0xe1')](/(\r\n|\n|\r)/gm,'\x20');this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0xe2'),_0x53bc21));var _0x1c1d51=this['getQueryOdbc'][_0xedde('0x7e')](this,_0x1e0a79,_0x53bc21);this[_0xedde('0x3a')][_0xedde('0x7e')](this,_0x2b3178,_0x53bc21);if(!this[_0xedde('0x8e')](_0x2b3178['variable_id'])){return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0xe3'));}var _0x1bebb1=this[_0xedde('0x12')][_0xedde('0x7e')](this,_0x2b3178[_0xedde('0xe4')]);if(!_0x1bebb1){return this[_0xedde('0x10')]['error'](_0x2b3178,'no\x20variable\x20found');}var _0x3322eb=this;_0x1c1d51[_0xedde('0xe5')](function(_0x3c029b,_0x44ef36){Object[_0xedde('0xe6')](_0x3c029b)['forEach'](function(_0x261119){_0x3322eb[_0xedde('0x10')][_0xedde('0xa7')](util['format']('%s[%s][%s]',_0x1bebb1,_0x44ef36,_0x261119),_0x3c029b[_0x261119]);});});this[_0xedde('0x10')][_0xedde('0xa7')](util[_0xedde('0x2b')]('%s_ROWS_COUNT',_0x1bebb1),_0x1c1d51['length']);return this['channel'][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0xe7'),_0x1bebb1));};AGIVertices[_0xedde('0x11')][_0xedde('0xe8')]=function(_0x2526e5){logger[_0xedde('0xe9')](util[_0xedde('0x2b')](_0xedde('0xea'),_0x2526e5[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x2526e5[_0xedde('0xeb')])){return this[_0xedde('0x10')]['error'](_0x2526e5,'no\x20user\x20selected');}var _0x2fc8b0=this['getUser'][_0xedde('0x7e')](this,_0x2526e5[_0xedde('0xeb')]);if(!_0x2fc8b0){return this['channel'][_0xedde('0x2e')](_0x2526e5,'no\x20user\x20found');}var _0x31b653=this['channel'][_0xedde('0xb3')](_0xedde('0xec'),[util['format']('SIP/%s',_0x2fc8b0),_0x2526e5[_0xedde('0x72')],_0x2526e5[_0xedde('0xed')],_0x2526e5[_0xedde('0x70')]]);if(_0x31b653[_0xedde('0xb4')]===-0x1){return _0x31b653;}return this[_0xedde('0x10')]['noop'](util['format'](_0xedde('0xee'),_0xedde('0xec')));};AGIVertices[_0xedde('0x11')][_0xedde('0xef')]=function(_0x5e45c0){logger['info'](util[_0xedde('0x2b')](_0xedde('0xf0'),_0x5e45c0[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x5e45c0['key'])){return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0xf1'));}if(!this['isConfigured'](_0x5e45c0['text'])){return this['channel'][_0xedde('0xb2')]('no\x20text\x20configured');}this[_0xedde('0x10')][_0xedde('0xf2')]=!![];this[_0xedde('0x3a')](_0x5e45c0);this['createSquareMessage'](_0x5e45c0[_0xedde('0x67')],'in');this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0xf3'),_0x5e45c0['text']));var _0x5958ce=this['googleDialogflow']['sync'](this,_0x5e45c0);if(_0x5958ce){for(var _0x2cb507 in _0x5958ce){if(_0x5958ce[_0xedde('0x9d')](_0x2cb507)){this[_0xedde('0x10')]['setVariable'](util[_0xedde('0x2b')](_0xedde('0xf4'),_0x2cb507['toUpperCase']()),_0x5958ce[_0x2cb507]);}}this[_0xedde('0x45')](_0x5958ce[_0xedde('0xf5')],_0xedde('0xf6'));return this['channel'][_0xedde('0xb2')](util[_0xedde('0x2b')]('Dialogflow\x20Result\x20%s',_0x5958ce[_0xedde('0xf5')]));}return this[_0xedde('0x10')][_0xedde('0x2e')](_0x5e45c0,_0xedde('0xf7'));};AGIVertices[_0xedde('0x11')][_0xedde('0xf8')]=function(_0x5275a5){logger['info'](util[_0xedde('0x2b')](_0xedde('0xf9'),_0x5275a5['label']));if(!this['isConfigured'](_0x5275a5[_0xedde('0xfa')])){return this['channel'][_0xedde('0xb2')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xedde('0x8e')](_0x5275a5[_0xedde('0xfb')])){return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0xfc'));}if(!this[_0xedde('0x8e')](_0x5275a5[_0xedde('0xfd')])){return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0xfe'));}if(!this[_0xedde('0x8e')](_0x5275a5[_0xedde('0xff')])){return this[_0xedde('0x10')]['noop'](_0xedde('0xd1'));}this[_0xedde('0x10')][_0xedde('0xf2')]=!![];this[_0xedde('0x3a')](_0x5275a5);this[_0xedde('0x45')](_0x5275a5[_0xedde('0x67')],'in');this['channel'][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x100'),_0x5275a5[_0xedde('0x67')]));var _0x28f7de=this['sestekNDA'][_0xedde('0x7e')](this,_0x5275a5);if(_0x28f7de){for(var _0x137713 in _0x28f7de){if(_0x28f7de['hasOwnProperty'](_0x137713)){this[_0xedde('0x10')][_0xedde('0xa7')](util[_0xedde('0x2b')](_0xedde('0x101'),_0x137713[_0xedde('0x77')]()),_0x28f7de[_0x137713]);}}this['createSquareMessage'](_0x28f7de[_0xedde('0xf5')],'out');if(_0x28f7de[_0xedde('0x102')]){this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x103'),_0x28f7de[_0xedde('0x102')]));var _0xd24882=this['channel'][_0xedde('0x104')](_0x28f7de['audiofile']);try{fs[_0xedde('0x105')](_0x28f7de[_0xedde('0x102')]+_0xedde('0x106'));}catch(_0x1ed47c){logger['error'](_0x1ed47c);}return _0xd24882;}else{return this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x107'),_0x28f7de[_0xedde('0xf5')]));}}return this['channel']['error'](_0x5275a5,_0xedde('0x108'));};AGIVertices[_0xedde('0x11')]['end']=function(_0x1297b){logger[_0xedde('0x30')](util['format']('Enter\x20in\x20END\x20(%s)\x20block',_0x1297b[_0xedde('0xb1')]));return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0x109'));};AGIVertices[_0xedde('0x11')][_0xedde('0x10a')]=function(_0x43b526){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x10b'),_0x43b526[_0xedde('0xb1')]));var _0x57383b='';if(_0x43b526[_0xedde('0x10c')]){if(!this[_0xedde('0x8e')](_0x43b526['trunk_id'])){return this[_0xedde('0x10')]['error'](_0x43b526,'no\x20trunk\x20selected');}else{var _0x39f74f=parseInt(_0x43b526[_0xedde('0x10c')],0xa);if(isNaN(_0x39f74f)){_0x57383b=_0x43b526[_0xedde('0x10c')];}else{_0x57383b=this['getTrunk'][_0xedde('0x7e')](this,_0x43b526[_0xedde('0x10c')]);if(!_0x57383b){return this[_0xedde('0x10')]['error'](_0x43b526,_0xedde('0x10d'));}}}}else if(_0x43b526[_0xedde('0x10e')]){_0x57383b=_0x43b526[_0xedde('0x10e')];}else{return this[_0xedde('0x10')][_0xedde('0x2e')](_0x43b526,_0xedde('0x10f'));}var _0x308ffa=this['channel']['exec'](_0xedde('0xec'),[util[_0xedde('0x2b')](_0xedde('0x110'),_0x57383b,_0x43b526['phone']),_0x43b526[_0xedde('0x72')],_0x43b526[_0xedde('0xed')],_0x43b526[_0xedde('0x70')]]);if(_0x308ffa[_0xedde('0xb4')]===-0x1){return _0x308ffa;}return this['channel'][_0xedde('0xb2')](util['format'](_0xedde('0xee'),_0xedde('0xec')));};AGIVertices['prototype']['finally']=function(_0x29feab){logger[_0xedde('0x30')](util['format'](_0xedde('0x111'),_0x29feab['label']));return this[_0xedde('0x10')][_0xedde('0xb2')]('finally');};AGIVertices[_0xedde('0x11')][_0xedde('0xe')]=function(_0xceef23){logger[_0xedde('0x30')](util['format'](_0xedde('0x112'),_0xceef23[_0xedde('0xb1')]));if(_0xceef23[_0xedde('0xae')]===0x0){return this[_0xedde('0xad')](_0xceef23);}_0xceef23[_0xedde('0xae')]-=0x1;if(!this[_0xedde('0x8e')](_0xceef23[_0xedde('0x113')])){return this[_0xedde('0x10')][_0xedde('0x2e')](_0xceef23,_0xedde('0x114'));}var _0x4fa1c5=this[_0xedde('0x115')]['sync'](this,_0xceef23['file_id']);if(!_0x4fa1c5){return this[_0xedde('0x10')][_0xedde('0x2e')](_0xceef23,_0xedde('0x116'));}if(!this['isConfigured'](_0xceef23['variable_id'])){return this[_0xedde('0x10')][_0xedde('0x2e')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x3a2b10=this[_0xedde('0x10')][_0xedde('0x117')](_0x4fa1c5,_0xceef23[_0xedde('0x118')],_0xceef23[_0xedde('0x119')]);var _0x33c7eb=_0x3a2b10[_0xedde('0xb4')]?_0x3a2b10[_0xedde('0xb4')][_0xedde('0x59')]():'';logger['info'](_0xedde('0x11a'),JSON[_0xedde('0x81')](_0x3a2b10));if(_0x3a2b10[_0xedde('0xb4')]===-0x1){this['createSquareDetailsReport'][_0xedde('0x7e')](this,_0xceef23,_0x33c7eb);return _0x3a2b10;}else if(_0x3a2b10['extra']===_0xedde('0x72')){_0x3a2b10['result']=_0x33c7eb[_0xedde('0xa2')]>=parseInt(_0xceef23[_0xedde('0x11b')])?'x':'i';}else{_0x3a2b10['result']=_0x33c7eb[_0xedde('0xa2')]>=parseInt(_0xceef23['mindigit'])&&_0x33c7eb['length']<=parseInt(_0xceef23[_0xedde('0x119')])?'x':'i';}var _0x4a987c=this[_0xedde('0x12')][_0xedde('0x7e')](this,_0xceef23[_0xedde('0xe4')]);if(!_0x4a987c){return this['channel'][_0xedde('0x2e')](_0xceef23,_0xedde('0x11c'));}this[_0xedde('0x10')][_0xedde('0xa7')](_0x4a987c,_0x33c7eb);if(this[_0xedde('0x8e')](_0xceef23[_0xedde('0x11d')])){var _0x5320b6=parseInt(_0xceef23[_0xedde('0x11d')],0xa);var _0x8fa85e=rs[_0xedde('0x11e')]({'charset':'*','length':_0x5320b6});var _0xdcd35c=_0x33c7eb[_0xedde('0xa2')];if(_0xdcd35c>0x0){if(_0xdcd35c>_0x5320b6){this['createSquareDetailsReport']['sync'](this,_0xceef23,_0xceef23[_0xedde('0x11f')]==='first'?_0x8fa85e+_0x33c7eb['substr'](_0x5320b6):_0x33c7eb[_0xedde('0x120')](0x0,_0xdcd35c-_0x5320b6)+_0x8fa85e);}else{this[_0xedde('0x3a')][_0xedde('0x7e')](this,_0xceef23,rs[_0xedde('0x11e')]({'charset':'*','length':_0xdcd35c}));}}else{this[_0xedde('0x3a')][_0xedde('0x7e')](this,_0xceef23,'');}}else{this[_0xedde('0x3a')][_0xedde('0x7e')](this,_0xceef23,_0x33c7eb);}return _0x3a2b10;};AGIVertices[_0xedde('0x11')][_0xedde('0xf')]=function(_0x289022){logger['info'](util[_0xedde('0x2b')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x289022[_0xedde('0xb1')]));return this[_0xedde('0xe')](_0x289022);};AGIVertices[_0xedde('0x11')][_0xedde('0x121')]=function(_0x14e145){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x122'),_0x14e145['label']));this[_0xedde('0x3a')][_0xedde('0x7e')](this,_0x14e145,_0x14e145[_0xedde('0x123')]);return this[_0xedde('0x10')][_0xedde('0xb2')](util['format'](_0xedde('0x124'),_0x14e145['goalname']));};AGIVertices[_0xedde('0x11')][_0xedde('0x125')]=function(_0x31b2c0){logger[_0xedde('0x30')](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x31b2c0[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x31b2c0[_0xedde('0x90')])||!this[_0xedde('0x8e')](_0x31b2c0[_0xedde('0x91')])){return this['channel'][_0xedde('0xb2')](_0xedde('0x126'));}if(!this[_0xedde('0x8e')](_0x31b2c0[_0xedde('0x67')])){return this['channel'][_0xedde('0xb2')](_0xedde('0xd1'));}this['channel']['noop'](util[_0xedde('0x2b')]('Trying\x20aws\x20Polly\x20%s',_0x31b2c0[_0xedde('0x67')]));var _0x3bde46=this[_0xedde('0x8f')]['sync'](this,_0x31b2c0);if(_0x3bde46){this[_0xedde('0x10')]['noop'](util[_0xedde('0x2b')](_0xedde('0x127'),_0x3bde46));var _0x5bf4e1=this[_0xedde('0x10')]['streamFile'](_0x3bde46);try{fs['unlink'](_0x3bde46+_0xedde('0x106'));}catch(_0x1950fd){logger['error'](_0x1950fd);}return _0x5bf4e1;}return this['channel'][_0xedde('0x2e')](_0x31b2c0,_0xedde('0x128'));};AGIVertices[_0xedde('0x11')][_0xedde('0x129')]=function(_0x1f5612){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x12a'),_0x1f5612[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x1f5612[_0xedde('0x90')])||!this[_0xedde('0x8e')](_0x1f5612[_0xedde('0x91')])){return this['channel'][_0xedde('0xb2')](_0xedde('0x126'));}if(!this[_0xedde('0x8e')](_0x1f5612[_0xedde('0x12b')])){return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0x12c'));}if(!this['isConfigured'](_0x1f5612['text'])){return this[_0xedde('0x10')]['noop'](_0xedde('0xd1'));}this[_0xedde('0x10')][_0xedde('0xf2')]=!![];this[_0xedde('0x3a')](_0x1f5612);this[_0xedde('0x45')](_0x1f5612[_0xedde('0x67')],'in');this[_0xedde('0x10')]['noop'](util[_0xedde('0x2b')](_0xedde('0x12d'),_0x1f5612[_0xedde('0x67')]));var _0x2c605c=this[_0xedde('0x94')][_0xedde('0x7e')](this,_0x1f5612);if(_0x2c605c){for(var _0x229110 in _0x2c605c){if(_0x2c605c[_0xedde('0x9d')](_0x229110)&&_[_0xedde('0xa3')](_0x2c605c[_0x229110])){this[_0xedde('0x10')]['setVariable'](util['format'](_0xedde('0x12e'),_0x229110[_0xedde('0x77')]()),_0x2c605c[_0x229110]);}}if(_['isNil'](_0x2c605c[_0xedde('0x12f')])){return this[_0xedde('0x10')]['noop'](_0xedde('0x130'));}else{this[_0xedde('0x45')](_0x2c605c['message'],_0xedde('0xf6'));return this['channel'][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x131'),_0x2c605c['message']));}}return this[_0xedde('0x10')][_0xedde('0x2e')](_0x1f5612,_0xedde('0x132'));};AGIVertices[_0xedde('0x11')][_0xedde('0x133')]=function(_0x32e88b){logger['info'](util['format'](_0xedde('0x134'),_0x32e88b[_0xedde('0xb1')],_0x32e88b[_0xedde('0x72')]));if(!this['isConfigured'](_0x32e88b[_0xedde('0x87')])){return this['channel'][_0xedde('0xb2')](_0xedde('0xf1'));}var _0x495021=_0xedde('0x135');var _0x39f738=util['format'](_0xedde('0x136'),FILES_PATH,rs[_0xedde('0x11e')](0x4));var _0x3af4af=util[_0xedde('0x2b')](_0xedde('0xa6'),_0x39f738,_0x495021);var _0x2e4e16=!![];if(_0x32e88b[_0xedde('0x137')]===_0xedde('0x138')){_0x2e4e16=![];}var _0x679f0a=this[_0xedde('0x10')][_0xedde('0x139')](_0x39f738,_0x495021,_0x32e88b[_0xedde('0x13a')],_0x32e88b[_0xedde('0x72')],undefined,_0x2e4e16);if(_0x679f0a[_0xedde('0xb4')]!==-0x1){this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x13b'),_0x3af4af));var _0x58739e=this['googleASR'][_0xedde('0x7e')](this,_0x32e88b,_0x3af4af);if(_0x58739e){for(var _0x547cb2 in _0x58739e){if(_0x58739e[_0xedde('0x9d')](_0x547cb2)){this[_0xedde('0x10')][_0xedde('0xa7')](util[_0xedde('0x2b')](_0xedde('0x13c'),_0x547cb2[_0xedde('0x77')]()),_0x58739e[_0x547cb2]);}}return this['channel'][_0xedde('0xb2')](util[_0xedde('0x2b')]('GoogleASR\x20Result\x20%s',JSON[_0xedde('0x81')](_0x58739e)));}}return _0x679f0a;};AGIVertices[_0xedde('0x11')][_0xedde('0x13d')]=function(_0x2ba7bc){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x13e'),_0x2ba7bc[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x2ba7bc[_0xedde('0x99')])){return this[_0xedde('0x10')]['noop'](_0xedde('0x13f'));}if(!this['isConfigured'](_0x2ba7bc[_0xedde('0x9a')])){return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0x140'));}var _0x1b0eb0=_0xedde('0x135');var _0x46c440=util[_0xedde('0x2b')](_0xedde('0x136'),FILES_PATH,rs[_0xedde('0x11e')](0x4));var _0x33c5e6=util[_0xedde('0x2b')](_0xedde('0xa6'),_0x46c440,_0x1b0eb0);var _0x3614d3=!![];if(_0x2ba7bc[_0xedde('0x137')]===_0xedde('0x138')){_0x3614d3=![];}var _0x36d10c=this['channel']['recordFile'](_0x46c440,_0x1b0eb0,_0x2ba7bc[_0xedde('0x13a')],_0x2ba7bc['timeout'],undefined,_0x3614d3);if(_0x36d10c[_0xedde('0xb4')]!==-0x1){this[_0xedde('0x10')]['noop'](util[_0xedde('0x2b')](_0xedde('0x141'),_0x33c5e6));var _0x310c9d=this[_0xedde('0x98')][_0xedde('0x7e')](this,_0x2ba7bc,_0x33c5e6);if(_0x310c9d){for(var _0x5bf804 in _0x310c9d){if(_0x310c9d[_0xedde('0x9d')](_0x5bf804)){this[_0xedde('0x10')][_0xedde('0xa7')](util['format'](_0xedde('0x142'),_0x5bf804[_0xedde('0x77')]()),_0x310c9d[_0x5bf804]);}}return this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')]('TildeASR\x20Result\x20%s',JSON[_0xedde('0x81')](_0x310c9d)));}}return _0x36d10c;};AGIVertices[_0xedde('0x11')]['gotoc']=function(_0x1a8974){logger['info'](util[_0xedde('0x2b')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x1a8974[_0xedde('0xb1')]));return this['channel'][_0xedde('0x143')](_0x1a8974['context'],_0x1a8974[_0xedde('0x41')],_0x1a8974[_0xedde('0x42')]);};AGIVertices['prototype'][_0xedde('0x144')]=function(_0x4bd6b2){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x145'),_0x4bd6b2[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x4bd6b2[_0xedde('0x146')])){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x4bd6b2,_0xedde('0x147'));}try{var _0x40ee6d=eval(_0x4bd6b2[_0xedde('0x146')])?'true':_0xedde('0x148');this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x149'),_0x4bd6b2['condition'],_0x40ee6d));return{'code':0xc8,'result':_0x40ee6d};}catch(_0x5adecd){return{'code':0xc8,'result':_0xedde('0x148')};}};AGIVertices['prototype'][_0xedde('0x14a')]=function(_0x5a36cd){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x14b'),_0x5a36cd['label']));if(!this[_0xedde('0x8e')](_0x5a36cd['interval_id'])){return this['channel'][_0xedde('0x2e')](_0x5a36cd,_0xedde('0x14c'));}var _0x4e1a80=this['getIntervals'][_0xedde('0x7e')](this,_0x5a36cd[_0xedde('0x14d')]);if(!_0x4e1a80){return this[_0xedde('0x10')]['error'](_0x5a36cd,_0xedde('0x14e'));}for(var _0x22a06b=0x0;_0x22a06b<_0x4e1a80['length'];_0x22a06b+=0x1){var _0x32c0ab=this['channel'][_0xedde('0x12')](util[_0xedde('0x2b')](_0xedde('0x14f'),_0x4e1a80[_0x22a06b]));if(_0x32c0ab['result']===-0x1){return _0x32c0ab;}logger['info'](util['format'](_0xedde('0x150'),_0x4e1a80[_0x22a06b],_0x32c0ab[_0xedde('0xab')]));if(_0x32c0ab[_0xedde('0xab')]==='true'){logger[_0xedde('0x30')](util[_0xedde('0x2b')]('IFTIME\x20%s\x20%s',_0x4e1a80[_0x22a06b],'true'));this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x150'),_0x4e1a80[_0x22a06b],_0xedde('0x151')));return{'code':0xc8,'result':_0xedde('0x151')};}else{logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x150'),_0x4e1a80[_0x22a06b],_0xedde('0x148')));this['channel'][_0xedde('0xb2')](util[_0xedde('0x2b')]('IFTIME\x20%s\x20%s',_0x4e1a80[_0x22a06b],_0xedde('0x148')));}}return{'code':0xc8,'result':_0xedde('0x148')};};AGIVertices[_0xedde('0x11')][_0xedde('0x152')]=function(_0x35bbaf){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x153'),_0x35bbaf['label']));return this[_0xedde('0x10')][_0xedde('0x152')]();};AGIVertices[_0xedde('0x11')][_0xedde('0x154')]=function(_0x2a51f9){logger['info'](util[_0xedde('0x2b')](_0xedde('0x155'),_0x2a51f9[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x2a51f9[_0xedde('0x87')])){return this[_0xedde('0x10')][_0xedde('0xb2')]('no\x20key\x20configured');}var _0x1fa1bb='wav';var _0x41431e=util[_0xedde('0x2b')](_0xedde('0x136'),FILES_PATH,rs[_0xedde('0x11e')](0x4));var _0x392706=util[_0xedde('0x2b')](_0xedde('0xa6'),_0x41431e,_0x1fa1bb);var _0x3980f3=!![];if(_0x2a51f9[_0xedde('0x137')]===_0xedde('0x138')){_0x3980f3=![];}var _0x57e101=this[_0xedde('0x10')]['recordFile'](_0x41431e,_0x1fa1bb,_0x2a51f9[_0xedde('0x13a')],_0x2a51f9[_0xedde('0x72')],undefined,_0x3980f3);if(_0x57e101[_0xedde('0xb4')]!==-0x1){this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x156'),_0x392706));var _0x53af34=this['ispeechASR']['sync'](this,_0x2a51f9,_0x392706);if(_0x53af34){for(var _0xfd1137 in _0x53af34){if(_0x53af34[_0xedde('0x9d')](_0xfd1137)){this[_0xedde('0x10')][_0xedde('0xa7')](util[_0xedde('0x2b')](_0xedde('0x157'),_0xfd1137[_0xedde('0x77')]()),_0x53af34[_0xfd1137]);}}return this['channel'][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x158'),JSON[_0xedde('0x81')](_0x53af34)));}}return _0x57e101;};AGIVertices[_0xedde('0x11')][_0xedde('0x159')]=function(_0x25e33a){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x15a'),_0x25e33a['label']));if(!this[_0xedde('0x8e')](_0x25e33a[_0xedde('0x87')])){return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0xf1'));}if(!this[_0xedde('0x8e')](_0x25e33a[_0xedde('0x67')])){return this[_0xedde('0x10')]['noop'](_0xedde('0xd1'));}this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')]('Trying\x20ispeech\x20TTS\x20%s',_0x25e33a[_0xedde('0x67')]));var _0x54bd2d=this['ispeechTTS'][_0xedde('0x7e')](this,_0x25e33a);if(_0x54bd2d){this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')]('ispeech\x20%s\x20file\x20created',_0x54bd2d));var _0x2376ac=this[_0xedde('0x10')][_0xedde('0x104')](_0x54bd2d,_0x25e33a[_0xedde('0x13a')]);try{fs[_0xedde('0x105')](_0x54bd2d+_0xedde('0x106'));}catch(_0x43e48e){logger[_0xedde('0x2e')](_0x43e48e);}return _0x2376ac;}return this[_0xedde('0x10')][_0xedde('0x2e')](_0x25e33a,_0xedde('0x15b'));};AGIVertices[_0xedde('0x11')][_0xedde('0x15c')]=function(_0x49bc7c){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x15d'),_0x49bc7c[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x49bc7c['findBy'])){return this['channel']['error'](_0x49bc7c,_0xedde('0x15e'));}logger[_0xedde('0x30')](util['format'](_0xedde('0x15f'),this[_0xedde('0x10')]['callerid'],_0x49bc7c[_0xedde('0x160')]));var _0x22f31d=this[_0xedde('0x60')]['sync'](this,_0x49bc7c[_0xedde('0x160')]);if(_0x22f31d){logger[_0xedde('0x30')](util['format'](_0xedde('0x161'),this[_0xedde('0x10')]['callerid'],_0x49bc7c[_0xedde('0x160')]));this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x161'),this[_0xedde('0x10')][_0xedde('0x3e')],_0x49bc7c['findBy']));return{'code':0xc8,'result':_0xedde('0x162')};}else{logger['info'](util['format'](_0xedde('0x163'),this[_0xedde('0x10')][_0xedde('0x3e')],_0x49bc7c[_0xedde('0x160')]));this[_0xedde('0x10')]['noop'](util[_0xedde('0x2b')](_0xedde('0x163'),this[_0xedde('0x10')][_0xedde('0x3e')],_0x49bc7c[_0xedde('0x160')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xedde('0x11')][_0xedde('0x164')]=function(_0x48c697){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x165'),_0x48c697[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x48c697[_0xedde('0x160')])){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x48c697,_0xedde('0x15e'));}logger['info'](util['format'](_0xedde('0x15f'),this[_0xedde('0x10')][_0xedde('0x3e')],_0x48c697[_0xedde('0x160')]));var _0x34da2e=this[_0xedde('0x5f')][_0xedde('0x7e')](this,_0x48c697[_0xedde('0x160')]);if(_0x34da2e){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x161'),this['channel'][_0xedde('0x3e')],_0x48c697['findBy']));this[_0xedde('0x10')]['noop'](util[_0xedde('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xedde('0x10')][_0xedde('0x3e')],_0x48c697[_0xedde('0x160')]));return{'code':0xc8,'result':'success'};}else{logger[_0xedde('0x30')](util['format'](_0xedde('0x163'),this[_0xedde('0x10')]['callerid'],_0x48c697[_0xedde('0x160')]));this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x163'),this[_0xedde('0x10')][_0xedde('0x3e')],_0x48c697[_0xedde('0x160')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xedde('0x11')][_0xedde('0x166')]=function(_0x1ece8f){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x167'),_0x1ece8f[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x1ece8f[_0xedde('0x168')])){return this[_0xedde('0x10')]['error'](_0x1ece8f,_0xedde('0x169'));}this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x16a'),_0x1ece8f[_0xedde('0x168')]));var _0x292bb5=eval(_0x1ece8f[_0xedde('0x168')]);if(!this[_0xedde('0x8e')](_0x1ece8f[_0xedde('0xe4')])){return this['channel'][_0xedde('0xb2')](_0xedde('0xe3'));}var _0x47f4d5=this[_0xedde('0x12')]['sync'](this,_0x1ece8f[_0xedde('0xe4')]);if(!_0x47f4d5){return this[_0xedde('0x10')]['error'](_0x1ece8f,'no\x20variable\x20found');}if(_[_0xedde('0xa1')](_0x292bb5)){var _0x5b365c=this;_0x292bb5[_0xedde('0xe5')](function(_0x21ae8a,_0x344585){_0x5b365c[_0xedde('0x10')]['setVariable'](util[_0xedde('0x2b')](_0xedde('0x16b'),_0x47f4d5,_0x344585),_0x21ae8a);});return this['channel'][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x16c'),_0x47f4d5));}else{return this['channel']['setVariable'](_0x47f4d5,_0x292bb5);}};AGIVertices[_0xedde('0x11')][_0xedde('0xd')]=function(_0x2c55e3){logger[_0xedde('0x30')](util['format'](_0xedde('0x16d'),_0x2c55e3[_0xedde('0xb1')]));if(_0x2c55e3[_0xedde('0xae')]===0x0){return this[_0xedde('0xad')](_0x2c55e3);}_0x2c55e3[_0xedde('0xae')]-=0x1;if(!this[_0xedde('0x8e')](_0x2c55e3[_0xedde('0x113')])){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x2c55e3,_0xedde('0x114'));}var _0xbe46f0=this[_0xedde('0x115')][_0xedde('0x7e')](this,_0x2c55e3[_0xedde('0x113')]);if(!_0xbe46f0){return this['channel'][_0xedde('0x2e')](_0x2c55e3,'no\x20file\x20audio\x20found');}var _0x5aaeb0=this['channel']['getData'](_0xbe46f0,_0x2c55e3[_0xedde('0x118')],_0x2c55e3['digit']);var _0x3619b6=_0x5aaeb0[_0xedde('0xb4')];if(_0x5aaeb0[_0xedde('0xb4')]===-0x1){this[_0xedde('0x3a')]['sync'](this,_0x2c55e3,'-1');return _0x5aaeb0;}else if(_0x5aaeb0[_0xedde('0xab')]===_0xedde('0x72')){_0x5aaeb0[_0xedde('0xb4')]=_0x5aaeb0[_0xedde('0xb4')][_0xedde('0xa2')]>0x0?_0x5aaeb0[_0xedde('0xb4')]:'t';}else if(_[_0xedde('0x51')](_0x5aaeb0[_0xedde('0xb4')])){_0x5aaeb0[_0xedde('0xb4')]='#';_0x3619b6='#';}if(!this[_0xedde('0x8e')](_0x2c55e3['variable_id'])){this[_0xedde('0x10')][_0xedde('0xb2')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x2f030d=this[_0xedde('0x12')][_0xedde('0x7e')](this,_0x2c55e3['variable_id']);if(!_0x2f030d){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x2c55e3,_0xedde('0x11c'));}this[_0xedde('0x10')][_0xedde('0xa7')](_0x2f030d,_0x3619b6);}this[_0xedde('0x3a')][_0xedde('0x7e')](this,_0x2c55e3,_0x3619b6);return _0x5aaeb0;};AGIVertices[_0xedde('0x11')][_0xedde('0xb2')]=function(_0x26efbc){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x16e'),_0x26efbc['label']));return this['channel'][_0xedde('0xb2')](_0x26efbc[_0xedde('0x16f')]||_0x26efbc[_0xedde('0xb1')]);};AGIVertices[_0xedde('0x11')]['pause']=function(_0x50ec06){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x170'),_0x50ec06[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x50ec06[_0xedde('0x160')])){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x50ec06,'no\x20find\x20by\x20configured');}logger[_0xedde('0x30')](util['format'](_0xedde('0x15f'),this[_0xedde('0x10')]['callerid'],_0x50ec06[_0xedde('0x160')]));var _0x247bd6=this['getPause'][_0xedde('0x7e')](this,_0x50ec06[_0xedde('0x171')]);var _0x194267=this[_0xedde('0x5c')][_0xedde('0x7e')](this,_0x50ec06[_0xedde('0x160')],_0x247bd6);if(_0x194267){logger[_0xedde('0x30')](util[_0xedde('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xedde('0x10')]['callerid'],_0x50ec06[_0xedde('0x160')]));this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x161'),this['channel'][_0xedde('0x3e')],_0x50ec06[_0xedde('0x160')]));return{'code':0xc8,'result':_0xedde('0x162')};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xedde('0x10')][_0xedde('0x3e')],_0x50ec06[_0xedde('0x160')]));this[_0xedde('0x10')][_0xedde('0xb2')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xedde('0x10')][_0xedde('0x3e')],_0x50ec06[_0xedde('0x160')]));return{'code':0xc8,'result':_0xedde('0x172')};}};AGIVertices[_0xedde('0x11')]['playback']=function(_0x5bbfb2){logger[_0xedde('0x30')](util['format'](_0xedde('0x173'),_0x5bbfb2[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x5bbfb2[_0xedde('0x113')])){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x5bbfb2,_0xedde('0x114'));}var _0x3f37e1=this[_0xedde('0x115')]['sync'](this,_0x5bbfb2[_0xedde('0x113')]);if(!_0x3f37e1){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x5bbfb2,_0xedde('0x116'));}var _0x479e30=this[_0xedde('0x10')][_0xedde('0xb3')](_0xedde('0x174'),[_0x3f37e1,_0x5bbfb2[_0xedde('0xed')]]);if(_0x479e30[_0xedde('0xb4')]===-0x1){return _0x479e30;}return this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x3f37e1));};AGIVertices[_0xedde('0x11')][_0xedde('0x175')]=function(_0x559ba8){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x176'),_0x559ba8['label']));if(!this[_0xedde('0x8e')](_0x559ba8[_0xedde('0x177')])){return this['channel']['error'](_0x559ba8,_0xedde('0x178'));}var _0x5e059e='';var _0x3165fe=parseInt(_0x559ba8[_0xedde('0x177')],0xa);if(isNaN(_0x3165fe)){_0x5e059e=_0x559ba8['queue_id'];}else{_0x5e059e=this[_0xedde('0x179')][_0xedde('0x7e')](this,_0x559ba8[_0xedde('0x177')]);if(!_0x5e059e){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x559ba8,_0xedde('0x17a'));}}var _0x113a71='';if(this[_0xedde('0x8e')](_0x559ba8[_0xedde('0x113')])){var _0xee5db8=this['getSound']['sync'](this,_0x559ba8[_0xedde('0x113')]);if(_0xee5db8){_0x113a71=_0xee5db8;}}this['createSquareDetailsReport'][_0xedde('0x7e')](this,_0x559ba8,_0x5e059e);if(_0x559ba8[_0xedde('0xed')][_0xedde('0x17b')]('x')<0x0){_0x559ba8[_0xedde('0xed')]+='x';}if(_0x559ba8[_0xedde('0xed')][_0xedde('0x17b')]('X')<0x0){_0x559ba8[_0xedde('0xed')]+='X';}this['channel']['setVariable']('XMCS-QUEUE',_0x5e059e?_0x5e059e['toLowerCase']():'');var _0x9250c8=this['channel'][_0xedde('0xb3')](_0xedde('0x17c'),[_0x5e059e,_0x559ba8[_0xedde('0xed')],_0x559ba8[_0xedde('0x70')],_0x113a71,_0x559ba8[_0xedde('0x72')],_0x559ba8[_0xedde('0x7')],_0x559ba8[_0xedde('0x17d')],_0x559ba8[_0xedde('0x17e')],'',_0x559ba8[_0xedde('0x17f')]]);if(_0x9250c8[_0xedde('0xb4')]===-0x1){return _0x9250c8;}return this[_0xedde('0x10')][_0xedde('0xb2')](util['format'](_0xedde('0x180'),_0xedde('0x17c'),_0x5e059e));};AGIVertices[_0xedde('0x11')]['record']=function(_0x54b770){logger['info'](util['format'](_0xedde('0x181'),_0x54b770[_0xedde('0xb1')]));var _0x5104d0=_0x54b770[_0xedde('0x182')]||'wav';var _0x5a59fd=util[_0xedde('0x2b')]('%s_%s',this['channel'][_0xedde('0x3b')],rs['generate'](0x5));var _0x649d47=util[_0xedde('0x2b')](_0xedde('0x183'),FILES_PATH,_0x5a59fd,_0x5104d0);var _0x3373cf=util['format'](_0xedde('0x136'),FILES_PATH,_0x5a59fd);this[_0xedde('0x3f')][_0xedde('0x7e')](this,_0x54b770,_0x5a59fd,_0x649d47);this[_0xedde('0x10')][_0xedde('0xa7')](_0xedde('0x184'),_0x5a59fd);logger[_0xedde('0x30')](_0xedde('0x185'),_0x3373cf,_0x5104d0,_0x54b770[_0xedde('0x186')],_0x54b770[_0xedde('0x72')]);return this[_0xedde('0x10')][_0xedde('0x139')](_0x3373cf,_0x5104d0,_0x54b770[_0xedde('0x186')],_0x54b770[_0xedde('0x72')],undefined,!![]);};AGIVertices['prototype'][_0xedde('0x187')]=function(_0x44ad6d){logger[_0xedde('0x30')](util[_0xedde('0x2b')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x44ad6d[_0xedde('0xb1')]));if(!this['isConfigured'](_0x44ad6d['url'])){return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0x188'));}var _0x446af=this[_0xedde('0x6f')]['sync'](this,_0x44ad6d);logger['info'](util['format'](_0xedde('0x189'),util[_0xedde('0x18a')](_0x446af,{'showHidden':![],'depth':null})));if(!this[_0xedde('0x8e')](_0x44ad6d[_0xedde('0xe4')])){return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0x18b'));}var _0x5ad2dd=this['getVariable'][_0xedde('0x7e')](this,_0x44ad6d[_0xedde('0xe4')]);if(!_0x5ad2dd){return this[_0xedde('0x10')]['error'](_0x44ad6d,'no\x20variable\x20found');}this['channel']['setVariable'](util[_0xedde('0x2b')]('%s_STATUS_CODE',_0x5ad2dd),_0x446af[_0xedde('0x83')]?_0x446af[_0xedde('0x83')]:'200');this[_0xedde('0x10')][_0xedde('0xa7')](util['format'](_0xedde('0x18c'),_0x5ad2dd),_0x446af[_0xedde('0x84')]?_0x446af['statusMessage']:'OK');if(_0x446af['body']){try{this[_0xedde('0xa4')](_0x446af['body'],_0x5ad2dd);}catch(_0x52a842){logger[_0xedde('0x2e')](util[_0xedde('0x2b')](_0xedde('0x18d'),_0x5ad2dd));}}return this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0xe7'),_0x5ad2dd));};AGIVertices[_0xedde('0x11')][_0xedde('0x18e')]=function(_0x2a0efd){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x18f'),_0x2a0efd['label']));return this[_0xedde('0x10')][_0xedde('0x190')](_0x2a0efd[_0xedde('0x191')][_0xedde('0xe1')](/\s+/g,''),_0x2a0efd['escape_digits']);};AGIVertices[_0xedde('0x11')][_0xedde('0x192')]=function(_0x1b3521){logger[_0xedde('0x30')](util['format'](_0xedde('0x193'),_0x1b3521['label']));return this[_0xedde('0x10')][_0xedde('0x194')](_0x1b3521['number'][_0xedde('0xe1')](/\s+/g,''),_0x1b3521[_0xedde('0x186')]);};AGIVertices['prototype']['sayphonetic']=function(_0x26e66b){logger[_0xedde('0x30')](util['format'](_0xedde('0x195'),_0x26e66b['label']));return this[_0xedde('0x10')][_0xedde('0x196')](_0x26e66b[_0xedde('0x67')],_0x26e66b[_0xedde('0x186')]);};AGIVertices[_0xedde('0x11')]['sendMail']=function(_0x3cedb6){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x197'),_0x3cedb6[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x3cedb6[_0xedde('0x198')])){return this[_0xedde('0x10')]['noop'](_0xedde('0x199'));}var _0x30e1de=this[_0xedde('0x19a')][_0xedde('0x7e')](this,_0x3cedb6[_0xedde('0x198')]);if(!_0x30e1de||!_0x30e1de[_0xedde('0x19b')]){return this['channel'][_0xedde('0x2e')](_0x3cedb6,_0xedde('0x19c'));}var _0x36a607={'from':util['format'](_0xedde('0x19d'),_0x30e1de[_0xedde('0x15')],_0x30e1de[_0xedde('0x19e')]||_0x30e1de[_0xedde('0x19b')]['user']),'to':_0x3cedb6['to']||'','cc':_0x3cedb6['cc']||'','bcc':_0x3cedb6[_0xedde('0x19f')]||'','subject':_0x3cedb6['subject'],'html':_0x3cedb6[_0xedde('0x67')],'text':_0x3cedb6['text']};var _0x6fc309={'tls':{'rejectUnauthorized':![]}};if(_0x30e1de[_0xedde('0x19b')]['service']){_0x6fc309[_0xedde('0x1a0')]=_0x30e1de[_0xedde('0x19b')][_0xedde('0x1a0')];}else{_0x6fc309[_0xedde('0x1a1')]=_0x30e1de[_0xedde('0x19b')][_0xedde('0x1a1')];_0x6fc309['port']=_0x30e1de[_0xedde('0x19b')]['port'];_0x6fc309[_0xedde('0x1a2')]=_0x30e1de['Smtp'][_0xedde('0x1a2')];}if(_0x30e1de[_0xedde('0x19b')]['authentication']){_0x6fc309[_0xedde('0x1a3')]={'user':_0x30e1de[_0xedde('0x19b')][_0xedde('0x1a4')],'pass':_0x30e1de['Smtp'][_0xedde('0x1a5')]};}if(this[_0xedde('0x8e')](_0x3cedb6[_0xedde('0x1a6')])){}logger[_0xedde('0xe9')](_0xedde('0x1a7'),JSON[_0xedde('0x81')](_0x36a607));this[_0xedde('0x3a')]['sync'](this,_0x3cedb6,_0x3cedb6['account_id']);this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x1a8'),_0x30e1de['name']));this[_0xedde('0x24')]['sync'](this,_0x6fc309,_0x36a607);return this[_0xedde('0x10')][_0xedde('0xb2')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0xedde('0x1a9')]=function(_0x291f77){logger[_0xedde('0x30')](util[_0xedde('0x2b')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x291f77['label']));return this[_0xedde('0x10')][_0xedde('0xb2')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xedde('0x11')]['sendSMS']=function(_0x4bd7d6){logger[_0xedde('0x30')](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x4bd7d6[_0xedde('0xb1')]));if(!this['isConfigured'](_0x4bd7d6['sms_account_id'])){return this['channel'][_0xedde('0xb2')](_0xedde('0x1aa'));}var _0x300519=this[_0xedde('0x37')][_0xedde('0x7e')](this,_0x4bd7d6['sms_account_id']);if(!_0x300519){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x4bd7d6,_0xedde('0x1ab'));}var _0x2e5d42={'body':_0x4bd7d6[_0xedde('0x1ac')],'phone':_0x4bd7d6['to']||'','SmsAccountId':_0x300519['id']};logger[_0xedde('0xe9')](_0xedde('0x1ad'),JSON['stringify'](_0x2e5d42));this[_0xedde('0x3a')]['sync'](this,_0x4bd7d6,_0x4bd7d6[_0xedde('0x1ae')]);this['channel'][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x1af'),_0x300519['name']));this[_0xedde('0x39')][_0xedde('0x7e')](this,_0x2e5d42);return this['channel'][_0xedde('0xb2')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xedde('0x11')][_0xedde('0x1b0')]=function(_0x448ea4){logger['info'](util['format'](_0xedde('0x1b1'),_0x448ea4[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x448ea4[_0xedde('0xe4')])){return this['channel']['error'](_0x448ea4,_0xedde('0x1b2'));}var _0x17feaf=this[_0xedde('0x12')][_0xedde('0x7e')](this,_0x448ea4[_0xedde('0xe4')]);if(!_0x17feaf){return this['channel'][_0xedde('0x2e')](_0x448ea4,'no\x20variable\x20found');}return this[_0xedde('0x10')]['setVariable'](_0x17feaf,_0x448ea4[_0xedde('0x1b3')]);};AGIVertices['prototype'][_0xedde('0x1b4')]=function(_0x464f89){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x1b5'),_0x464f89[_0xedde('0xb1')]));this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0x1b6'));if(_0x464f89[_0xedde('0xc2')]===_0xedde('0x1b7')){this['channel']['noop']('Answer');return this[_0xedde('0x10')][_0xedde('0xc2')]();}return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0x1b8'));};AGIVertices[_0xedde('0x11')][_0xedde('0x1b9')]=function(_0x2d37c2){logger['info'](util[_0xedde('0x2b')](_0xedde('0x1ba'),_0x2d37c2[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x2d37c2[_0xedde('0x1bb')])){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x2d37c2,_0xedde('0x1bc'));}var _0x374756=this[_0xedde('0x19')]['sync'](this,_0x2d37c2[_0xedde('0x1bb')]);if(!this[_0xedde('0x8e')](_0x374756)){return this['channel'][_0xedde('0x2e')](_0x2d37c2,util[_0xedde('0x2b')](_0xedde('0x1bd'),_0x2d37c2[_0xedde('0x1bb')]));}if(_0x374756===this['channel'][_0xedde('0x3d')]){return this['channel'][_0xedde('0x2e')](_0x2d37c2,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport'][_0xedde('0x7e')](this,_0x2d37c2,_0x374756);var _0x273d4c=this['channel'][_0xedde('0xb3')](_0xedde('0x1be'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xedde('0x7')][_0xedde('0x1a1')]||_0xedde('0x1bf'),_0x374756,this[_0xedde('0x10')][_0xedde('0x3d')]));if(_0x273d4c[_0xedde('0xb4')]===-0x1){return _0x273d4c;}return this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x180'),'AGI',_0x374756));};AGIVertices[_0xedde('0x11')][_0xedde('0x1c0')]=function(_0x1888fa){logger[_0xedde('0x30')](util[_0xedde('0x2b')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x1888fa[_0xedde('0xb1')]));var _0x5d43e6=this[_0xedde('0x64')][_0xedde('0x7e')](this,_0x1888fa[_0xedde('0xc0')]);this[_0xedde('0x3a')][_0xedde('0x7e')](this,_0x1888fa,_0x1888fa[_0xedde('0xc0')]);if(this[_0xedde('0x8e')](_0x1888fa[_0xedde('0xe4')])){var _0x374d28=this['getVariable'][_0xedde('0x7e')](this,_0x1888fa[_0xedde('0xe4')]);if(_0x374d28){this[_0xedde('0x10')][_0xedde('0xa7')](_0x374d28,_0x5d43e6);return this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x1c1'),_0x1888fa[_0xedde('0xc0')],_0x374d28));}}return this['channel'][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x1c2'),_0x1888fa['command']));};AGIVertices[_0xedde('0x11')]['google_cloud_tts']=function(_0x1b62f2){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x1c3'),_0x1b62f2[_0xedde('0xb1')]));_0x1b62f2[_0xedde('0x67')]=_0x1b62f2['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xedde('0x8e')](_0x1b62f2['apiKey'])){return this[_0xedde('0x10')][_0xedde('0xb2')]('no\x20apiKey\x20configured');}if(!this[_0xedde('0x8e')](_0x1b62f2['text'])){return this[_0xedde('0x10')][_0xedde('0xb2')]('no\x20text\x20configured');}this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x1c4'),_0x1b62f2[_0xedde('0x67')]));var _0x4ebba7=this[_0xedde('0x65')]['sync'](this,_0x1b62f2);if(_0x4ebba7){this['channel']['noop'](util[_0xedde('0x2b')](_0xedde('0x1c5'),_0x4ebba7));var _0x3070e6=this[_0xedde('0x10')][_0xedde('0x104')](_0x4ebba7);try{fs[_0xedde('0x105')](_0x4ebba7+_0xedde('0x106'));}catch(_0x5c0be7){logger['error'](_0x5c0be7);}return _0x3070e6;}return this[_0xedde('0x10')][_0xedde('0x2e')](_0x1b62f2,_0xedde('0x1c6'));};AGIVertices[_0xedde('0x11')][_0xedde('0x1c7')]=function(_0x4cc30c){logger['info'](util[_0xedde('0x2b')](_0xedde('0x1c8'),_0x4cc30c['label']));_0x4cc30c[_0xedde('0x67')]=_0x4cc30c[_0xedde('0x67')][_0xedde('0xe1')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x4cc30c['text'])){return this[_0xedde('0x10')][_0xedde('0xb2')](_0xedde('0xd1'));}this[_0xedde('0x10')][_0xedde('0xb2')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x4cc30c[_0xedde('0x67')]));var _0x2b3961=this[_0xedde('0x6d')][_0xedde('0x7e')](this,_0x4cc30c);if(_0x2b3961){this['channel'][_0xedde('0xb2')](util['format'](_0xedde('0x1c9'),_0x2b3961));var _0x4d99d8=this[_0xedde('0x10')][_0xedde('0x104')](_0x2b3961);try{fs[_0xedde('0x105')](_0x2b3961+_0xedde('0x106'));}catch(_0x1ac5e0){logger[_0xedde('0x2e')](_0x1ac5e0);}return _0x4d99d8;}return this[_0xedde('0x10')][_0xedde('0x2e')](_0x4cc30c,_0xedde('0x1ca'));};AGIVertices[_0xedde('0x11')][_0xedde('0x1cb')]=function(_0x52a8fb){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x1cc'),_0x52a8fb['label']));if(!this['isConfigured'](_0x52a8fb[_0xedde('0x160')])){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x52a8fb,_0xedde('0x15e'));}logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x15f'),this[_0xedde('0x10')][_0xedde('0x3e')],_0x52a8fb[_0xedde('0x160')]));var _0x269fda=this['agentUnpause'][_0xedde('0x7e')](this,_0x52a8fb[_0xedde('0x160')]);if(_0x269fda){logger['info'](util[_0xedde('0x2b')](_0xedde('0x161'),this[_0xedde('0x10')][_0xedde('0x3e')],_0x52a8fb[_0xedde('0x160')]));this[_0xedde('0x10')][_0xedde('0xb2')](util['format'](_0xedde('0x161'),this[_0xedde('0x10')][_0xedde('0x3e')],_0x52a8fb['findBy']));return{'code':0xc8,'result':_0xedde('0x162')};}else{logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x163'),this[_0xedde('0x10')][_0xedde('0x3e')],_0x52a8fb['findBy']));this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x163'),this[_0xedde('0x10')][_0xedde('0x3e')],_0x52a8fb[_0xedde('0x160')]));return{'code':0xc8,'result':_0xedde('0x172')};}};AGIVertices[_0xedde('0x11')][_0xedde('0x1cd')]=function(_0x45fdbc){logger[_0xedde('0x30')](util[_0xedde('0x2b')](_0xedde('0x1ce'),_0x45fdbc[_0xedde('0xb1')]));var _0x42d7ec=this['channel']['exec'](_0xedde('0x1cf'),[_0x45fdbc['mailbox'],_0x45fdbc[_0xedde('0x85')]]);if(_0x42d7ec[_0xedde('0xb4')]===-0x1){return _0x42d7ec;}return this[_0xedde('0x10')][_0xedde('0xb2')](util[_0xedde('0x2b')](_0xedde('0x180'),_0xedde('0x1cf'),_0x45fdbc[_0xedde('0x1d0')]));};AGIVertices[_0xedde('0x11')][_0xedde('0x1d1')]=function(_0x20c09f){logger[_0xedde('0x30')](util['format'](_0xedde('0x1d2'),_0x20c09f[_0xedde('0xb1')]));if(!this[_0xedde('0x8e')](_0x20c09f[_0xedde('0xe4')])){return this['channel']['error'](_0x20c09f,_0xedde('0x1b2'));}var _0x2aebc0=this[_0xedde('0x12')]['sync'](this,_0x20c09f['variable_id']);if(!_0x2aebc0){return this[_0xedde('0x10')][_0xedde('0x2e')](_0x20c09f,_0xedde('0x11c'));}var _0x594681=this[_0xedde('0x10')][_0xedde('0x12')](_0x2aebc0);return{'code':0xc8,'result':_0x594681[_0xedde('0xab')]?_0x594681[_0xedde('0xab')]:'-'};};String[_0xedde('0x11')][_0xedde('0x1d3')]=function(_0x2e2bbe,_0x59f0e7){return this[_0xedde('0xa9')](_0x2e2bbe)[_0xedde('0x1d4')](_0x59f0e7);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 3d59e44..45eb3df 100644 --- a/server/services/ami/acw/index.js +++ b/server/services/ami/acw/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee14=['diff','seconds','prototype','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','info','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','lastPauseAt','update','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','message','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','startAcw','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds'];(function(_0x2d2998,_0x4783d8){var _0x3c9531=function(_0x5789df){while(--_0x5789df){_0x2d2998['push'](_0x2d2998['shift']());}};_0x3c9531(++_0x4783d8);}(_0xee14,0x13a));var _0x4ee1=function(_0x31ea88,_0x179587){_0x31ea88=_0x31ea88-0x0;var _0x495567=_0xee14[_0x31ea88];return _0x495567;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x4ee1('0x0'));var ami=require(_0x4ee1('0x1'));var logger=require(_0x4ee1('0x2'))(_0x4ee1('0x3'));var RpcUser=require(_0x4ee1('0x4'));var RpcVoiceAgentReport=require(_0x4ee1('0x5'));function Acw(_0x34a0ae){this[_0x4ee1('0x6')]=_0x34a0ae[_0x4ee1('0x6')];this['agents']=_0x34a0ae[_0x4ee1('0x7')];this['timers']=_0x34a0ae[_0x4ee1('0x8')];this[_0x4ee1('0x9')]={};ami['on'](_0x4ee1('0xa'),this[_0x4ee1('0xb')][_0x4ee1('0xc')](this));ami['on'](_0x4ee1('0xd'),this['syncHangupRequest'][_0x4ee1('0xc')](this));ami['on'](_0x4ee1('0xe'),this['syncHangup'][_0x4ee1('0xc')](this));ami['on'](_0x4ee1('0xf'),this[_0x4ee1('0x10')][_0x4ee1('0xc')](this));ami['on']('attendedtransfer',this[_0x4ee1('0x11')][_0x4ee1('0xc')](this));ami['on'](_0x4ee1('0x12'),this[_0x4ee1('0x13')][_0x4ee1('0xc')](this));ami['on'](_0x4ee1('0x14'),this['syncAgentConnectPreview'][_0x4ee1('0xc')](this));}function getDiff(_0x461f99){var _0x1096a5=moment()[_0x4ee1('0x15')](0x0);var _0x46d2c2=moment(_0x461f99)[_0x4ee1('0x15')](0x0);return _0x1096a5[_0x4ee1('0x16')](_0x46d2c2,_0x4ee1('0x17'));}Acw[_0x4ee1('0x18')]['startAcw']=function(_0x2f9194){try{var _0x38008f=this;var _0x34651b=this[_0x4ee1('0x9')][_0x2f9194][_0x4ee1('0x19')];var _0x38fc33=this[_0x4ee1('0x9')][_0x2f9194][_0x4ee1('0x1a')];var _0x360056=this[_0x4ee1('0x6')][_0x38fc33];var _0x274de5=![];var _0x5d76de=_0x4ee1('0x1b');if(_0x360056[_0x4ee1('0x1c')]){if(_0x360056[_0x4ee1('0x1d')][_0x4ee1('0x1e')]){_0x274de5=!![];_0x5d76de=_0x360056[_0x4ee1('0x1d')][_0x4ee1('0x1e')];}}ami['Action']({'action':_0x4ee1('0x1f'),'interface':_0x34651b,'paused':!![],'reason':_0x5d76de})[_0x4ee1('0x20')](function(_0x46611a){if(_0x38008f[_0x4ee1('0x7')][_0x34651b]){return RpcUser[_0x4ee1('0x21')](_0x38008f[_0x4ee1('0x7')][_0x34651b]['id'])[_0x4ee1('0x20')](function(_0x40fd98){if(_0x40fd98&&!_0x40fd98[_0x4ee1('0x22')]){logger[_0x4ee1('0x23')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x2f9194,_0x34651b,_0x38fc33);var _0x53d43f=_0x38008f[_0x4ee1('0x9')][_0x2f9194][_0x4ee1('0x24')]&&_0x38008f[_0x4ee1('0x9')][_0x2f9194][_0x4ee1('0x25')]?_0x38008f[_0x4ee1('0x9')][_0x2f9194][_0x4ee1('0x25')]:_0x2f9194;return RpcUser['savePause'](_0x38008f['agents'][_0x34651b],_0x5d76de,_0x53d43f)[_0x4ee1('0x20')](function(_0x28b7e1){if(!_0x274de5){_0x38008f['timers'][_0x34651b]={};logger[_0x4ee1('0x23')](_0x4ee1('0x26'),_0x2f9194,_0x38008f[_0x4ee1('0x6')][_0x38fc33][_0x4ee1('0x27')],_0x34651b,_0x38fc33);_0x38008f[_0x4ee1('0x8')][_0x34651b][_0x4ee1('0x28')]=setTimeout(_0x38008f[_0x4ee1('0x29')]['bind'](_0x38008f,_0x34651b),_0x38008f[_0x4ee1('0x6')][_0x38fc33]['acwTimeout']*0x3e8);_0x38008f[_0x4ee1('0x8')][_0x34651b]['lastPauseAt']=moment()[_0x4ee1('0x2a')](_0x4ee1('0x2b'));_0x38008f[_0x4ee1('0x8')][_0x34651b][_0x4ee1('0x2c')]=_0x2f9194;_0x38008f[_0x4ee1('0x8')][_0x34651b]['queue']=_0x38fc33;_0x38008f[_0x4ee1('0x8')][_0x34651b]['updateAcw']=function(){var _0x121301=getDiff(_0x38008f[_0x4ee1('0x8')][_0x34651b][_0x4ee1('0x2d')]);clearTimeout(_0x38008f[_0x4ee1('0x8')][_0x34651b][_0x4ee1('0x28')]);_0x38008f['timers'][_0x34651b][_0x4ee1('0x28')]=![];RpcVoiceAgentReport[_0x4ee1('0x2e')]({'acwtime':_0x121301},_0x38008f[_0x4ee1('0x8')][_0x34651b][_0x4ee1('0x2c')],_0x34651b)[_0x4ee1('0x20')](function(_0x393990){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x2f9194,_0x121301,_0x393990);})[_0x4ee1('0x2f')](function(_0x54482b){logger[_0x4ee1('0x30')]('[%s][UPDATE][ERRORS:%s]',_0x2f9194,_0x54482b);});delete _0x38008f[_0x4ee1('0x8')][_0x34651b];};}});}else{logger[_0x4ee1('0x23')](_0x4ee1('0x31'),_0x2f9194,_0x34651b,_0x38fc33);}});}})[_0x4ee1('0x2f')](function(_0x9f882d){logger[_0x4ee1('0x30')](_0x4ee1('0x26'),_0x2f9194,_0x38008f[_0x4ee1('0x6')][_0x38fc33][_0x4ee1('0x27')],_0x34651b,_0x38fc33);})[_0x4ee1('0x32')](function(){delete _0x38008f[_0x4ee1('0x9')][_0x2f9194];});}catch(_0x1f3371){logger[_0x4ee1('0x30')]('[ACW][START]\x20%s',_0x1f3371[_0x4ee1('0x33')]);}};Acw[_0x4ee1('0x18')][_0x4ee1('0x29')]=function(_0x50539f){try{var _0x4858f9=this;if(_0x4858f9[_0x4ee1('0x8')][_0x50539f]){_0x4858f9[_0x4ee1('0x8')][_0x50539f][_0x4ee1('0x28')]=![];var _0x1f2b4b=_0x4858f9['timers'][_0x50539f][_0x4ee1('0x2c')];var _0x2ed16f=_0x4858f9[_0x4ee1('0x8')][_0x50539f][_0x4ee1('0x1a')];var _0x2653c4=_0x4858f9[_0x4ee1('0x6')][_0x2ed16f][_0x4ee1('0x27')];logger[_0x4ee1('0x23')]('[TIMER][STOP][AGENT:%s]',_0x50539f);RpcUser[_0x4ee1('0x34')](this[_0x4ee1('0x7')][_0x50539f]);RpcVoiceAgentReport[_0x4ee1('0x2e')]({'acwtime':_0x2653c4,'agentacw':!![]},_0x1f2b4b,_0x50539f)[_0x4ee1('0x20')](function(_0x45bb22){logger[_0x4ee1('0x23')]('[%s][UPDATE][ACWTIME:%s]',_0x1f2b4b,_0x2653c4,_0x45bb22);})[_0x4ee1('0x2f')](function(_0x37176a){logger[_0x4ee1('0x30')](_0x4ee1('0x35'),_0x1f2b4b,_0x37176a);});}else{logger[_0x4ee1('0x30')](_0x4ee1('0x36'),_0x50539f);if(_0x4858f9[_0x4ee1('0x8')]){logger[_0x4ee1('0x23')](_0x4ee1('0x37'),JSON[_0x4ee1('0x38')](_0x4858f9[_0x4ee1('0x8')]));}}}catch(_0x46bf93){logger[_0x4ee1('0x30')]('[ACW][STOP]\x20%s',_0x46bf93[_0x4ee1('0x33')]);}};Acw[_0x4ee1('0x18')]['syncAgentConnect']=function(_0x3c759f){try{if(this['voiceQueues'][_0x3c759f[_0x4ee1('0x1a')]]&&(this['voiceQueues'][_0x3c759f[_0x4ee1('0x1a')]][_0x4ee1('0x3')]||this['voiceQueues'][_0x3c759f[_0x4ee1('0x1a')]][_0x4ee1('0x1c')])){if(this[_0x4ee1('0x7')][_0x3c759f[_0x4ee1('0x19')]]){this['channels'][_0x3c759f[_0x4ee1('0x2c')]]={'queue':_0x3c759f[_0x4ee1('0x1a')],'interface':_0x3c759f[_0x4ee1('0x19')],'destlinkedid':_0x3c759f['destlinkedid']};}}}catch(_0x4fbe92){logger[_0x4ee1('0x30')](_0x4ee1('0x39'),_0x4fbe92[_0x4ee1('0x33')]);}};Acw[_0x4ee1('0x18')][_0x4ee1('0x3a')]=function(_0x4ebcca){try{if(this['voiceQueues'][_0x4ebcca[_0x4ee1('0x1a')]]&&(this[_0x4ee1('0x6')][_0x4ebcca[_0x4ee1('0x1a')]][_0x4ee1('0x3')]||this['voiceQueues'][_0x4ebcca[_0x4ee1('0x1a')]][_0x4ee1('0x1c')])){if(this['agents'][_0x4ebcca[_0x4ee1('0x19')]]){this[_0x4ee1('0x9')][_0x4ebcca[_0x4ee1('0x2c')]]={'queue':_0x4ebcca[_0x4ee1('0x1a')],'interface':_0x4ebcca[_0x4ee1('0x19')]};}}}catch(_0x154ec0){logger[_0x4ee1('0x30')](_0x4ee1('0x3b'),_0x154ec0[_0x4ee1('0x33')]);}};Acw['prototype']['syncHangupRequest']=function(_0x1a972b){try{if(this[_0x4ee1('0x9')][_0x1a972b[_0x4ee1('0x2c')]]&&_[_0x4ee1('0x3c')](this['channels'][_0x1a972b[_0x4ee1('0x2c')]][_0x4ee1('0x24')])){logger[_0x4ee1('0x23')](_0x4ee1('0x3d'),_0x1a972b[_0x4ee1('0x2c')]);this['startAcw'](_0x1a972b[_0x4ee1('0x2c')]);}else if(this[_0x4ee1('0x9')][_0x1a972b[_0x4ee1('0x3e')]]&&_['isUndefined'](this[_0x4ee1('0x9')][_0x1a972b['linkedid']][_0x4ee1('0x24')])){logger['info'](_0x4ee1('0x3f'),_0x1a972b['linkedid']);this[_0x4ee1('0x40')](_0x1a972b['linkedid']);}}catch(_0x58919){logger[_0x4ee1('0x30')](_0x4ee1('0x41'),_0x58919['message']);}};Acw[_0x4ee1('0x18')][_0x4ee1('0x42')]=function(_0xcdb873){try{if(this[_0x4ee1('0x9')][_0xcdb873[_0x4ee1('0x2c')]]&&this[_0x4ee1('0x9')][_0xcdb873[_0x4ee1('0x2c')]]['attended']){logger['info'](_0x4ee1('0x43'),_0xcdb873[_0x4ee1('0x2c')]);this[_0x4ee1('0x40')](_0xcdb873[_0x4ee1('0x2c')]);}else if(this[_0x4ee1('0x9')][_0xcdb873[_0x4ee1('0x3e')]]&&this[_0x4ee1('0x9')][_0xcdb873[_0x4ee1('0x3e')]][_0x4ee1('0x24')]){logger[_0x4ee1('0x23')](_0x4ee1('0x44'),_0xcdb873[_0x4ee1('0x3e')]);this[_0x4ee1('0x40')](_0xcdb873['linkedid']);}}catch(_0x1bafa8){logger['error'](_0x4ee1('0x45'),_0x1bafa8[_0x4ee1('0x33')]);}};Acw['prototype'][_0x4ee1('0x11')]=function(_0x184e36){try{if(!_['isNil'](this['channels'][_0x184e36[_0x4ee1('0x46')]])){this['startAcw'](_0x184e36[_0x4ee1('0x46')]);if(this[_0x4ee1('0x9')][_0x184e36['secondtransfereruniqueid']]){this[_0x4ee1('0x9')][_0x184e36[_0x4ee1('0x47')]][_0x4ee1('0x24')]=!![];this[_0x4ee1('0x9')][_0x184e36[_0x4ee1('0x48')]]=this[_0x4ee1('0x9')][_0x184e36[_0x4ee1('0x47')]];delete this['channels'][_0x184e36['secondtransfereruniqueid']];}}else if(!_[_0x4ee1('0x49')](this[_0x4ee1('0x9')][_0x184e36['transfertargetuniqueid']])){this[_0x4ee1('0x40')](_0x184e36[_0x4ee1('0x48')]);if(this[_0x4ee1('0x9')][_0x184e36['origtransfereruniqueid']]){this[_0x4ee1('0x9')][_0x184e36['origtransfereruniqueid']][_0x4ee1('0x24')]=!![];this['channels'][_0x184e36['transfereeuniqueid']]=this[_0x4ee1('0x9')][_0x184e36[_0x4ee1('0x4a')]];delete this[_0x4ee1('0x9')][_0x184e36[_0x4ee1('0x4a')]];}}}catch(_0x38e889){logger['error'](_0x4ee1('0x4b'),_0x38e889[_0x4ee1('0x33')]);}};Acw[_0x4ee1('0x18')]['syncBlindTransfer']=function(_0x368e82){try{if(this[_0x4ee1('0x9')][_0x368e82[_0x4ee1('0x4c')]]){logger[_0x4ee1('0x23')](_0x4ee1('0x4d'),JSON[_0x4ee1('0x38')](_0x368e82[_0x4ee1('0x4c')]));this[_0x4ee1('0x40')](_0x368e82[_0x4ee1('0x4c')]);}else if(this[_0x4ee1('0x9')][_0x368e82[_0x4ee1('0x4e')]]){logger[_0x4ee1('0x23')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x4ee1('0x38')](_0x368e82['transfererlinkedid']));this[_0x4ee1('0x40')](_0x368e82['transfererlinkedid']);}}catch(_0x15834b){logger[_0x4ee1('0x30')](_0x4ee1('0x4f'),_0x15834b[_0x4ee1('0x33')]);}};Acw[_0x4ee1('0x18')][_0x4ee1('0x10')]=function(_0x342aa1){try{if(this[_0x4ee1('0x6')][_0x342aa1[_0x4ee1('0x1a')]]&&this[_0x4ee1('0x6')][_0x342aa1[_0x4ee1('0x1a')]][_0x4ee1('0x50')]==='all'){if(this[_0x4ee1('0x7')][_0x342aa1[_0x4ee1('0x19')]]){logger[_0x4ee1('0x23')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x342aa1['uniqueid'],_0x342aa1[_0x4ee1('0x19')],_0x342aa1[_0x4ee1('0x1a')]);return RpcUser['savePause'](this[_0x4ee1('0x7')][_0x342aa1[_0x4ee1('0x19')]],_0x4ee1('0x51'),_0x342aa1[_0x4ee1('0x2c')]);}}}catch(_0x42240f){logger[_0x4ee1('0x30')](_0x4ee1('0x52'),_0x42240f[_0x4ee1('0x33')]);}};module[_0x4ee1('0x53')]=Acw; \ No newline at end of file +var _0x98a8=['destlinkedid','savePause','acwTimeout','timer','stopAcw','uniqueid','updateAcw','lastPauseAt','update','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','message','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','prototype','syncAgentConnect','mandatoryDisposition','interface','syncAgentConnectPreview','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','startAcw','channels','queue','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]'];(function(_0x3b74bc,_0x21b50e){var _0x5a3fdc=function(_0x161f1c){while(--_0x161f1c){_0x3b74bc['push'](_0x3b74bc['shift']());}};_0x5a3fdc(++_0x21b50e);}(_0x98a8,0x12c));var _0x898a=function(_0x3bd3cf,_0x3813e7){_0x3bd3cf=_0x3bd3cf-0x0;var _0x8e4ca3=_0x98a8[_0x3bd3cf];return _0x8e4ca3;};'use strict';var util=require(_0x898a('0x0'));var _=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var ami=require(_0x898a('0x3'));var logger=require(_0x898a('0x4'))(_0x898a('0x5'));var RpcUser=require(_0x898a('0x6'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x2bb3e2){this[_0x898a('0x7')]=_0x2bb3e2[_0x898a('0x7')];this[_0x898a('0x8')]=_0x2bb3e2[_0x898a('0x8')];this['timers']=_0x2bb3e2[_0x898a('0x9')];this['channels']={};ami['on'](_0x898a('0xa'),this['syncAgentConnect'][_0x898a('0xb')](this));ami['on'](_0x898a('0xc'),this[_0x898a('0xd')][_0x898a('0xb')](this));ami['on'](_0x898a('0xe'),this[_0x898a('0xf')][_0x898a('0xb')](this));ami['on'](_0x898a('0x10'),this[_0x898a('0x11')]['bind'](this));ami['on'](_0x898a('0x12'),this['syncAttendedTransfer'][_0x898a('0xb')](this));ami['on']('blindtransfer',this[_0x898a('0x13')][_0x898a('0xb')](this));ami['on'](_0x898a('0x14'),this['syncAgentConnectPreview']['bind'](this));}function getDiff(_0x5b5c9c){var _0x373d53=moment()[_0x898a('0x15')](0x0);var _0xb24335=moment(_0x5b5c9c)[_0x898a('0x15')](0x0);return _0x373d53[_0x898a('0x16')](_0xb24335,_0x898a('0x17'));}Acw['prototype'][_0x898a('0x18')]=function(_0x53a4b8){try{var _0x3fec7a=this;var _0x5c96a6=this[_0x898a('0x19')][_0x53a4b8]['interface'];var _0x18d167=this['channels'][_0x53a4b8][_0x898a('0x1a')];var _0x3197f7=this[_0x898a('0x7')][_0x18d167];var _0x4ddd4d=![];var _0x1faf4c='ACW';if(_0x3197f7['mandatoryDisposition']){if(_0x3197f7[_0x898a('0x1b')][_0x898a('0x1c')]){_0x4ddd4d=!![];_0x1faf4c=_0x3197f7['mandatoryDispositionPause']['name'];}}ami[_0x898a('0x1d')]({'action':_0x898a('0x1e'),'interface':_0x5c96a6,'paused':!![],'reason':_0x1faf4c})[_0x898a('0x1f')](function(_0x2917ff){if(_0x3fec7a[_0x898a('0x8')][_0x5c96a6]){return RpcUser[_0x898a('0x20')](_0x3fec7a[_0x898a('0x8')][_0x5c96a6]['id'])['then'](function(_0x247cfc){if(_0x247cfc&&!_0x247cfc[_0x898a('0x21')]){logger[_0x898a('0x22')](_0x898a('0x23'),_0x53a4b8,_0x5c96a6,_0x18d167);var _0x30495a=_0x3fec7a[_0x898a('0x19')][_0x53a4b8]['attended']&&_0x3fec7a[_0x898a('0x19')][_0x53a4b8][_0x898a('0x24')]?_0x3fec7a[_0x898a('0x19')][_0x53a4b8][_0x898a('0x24')]:_0x53a4b8;return RpcUser[_0x898a('0x25')](_0x3fec7a[_0x898a('0x8')][_0x5c96a6],_0x1faf4c,_0x30495a)['then'](function(_0x20bde0){if(!_0x4ddd4d){_0x3fec7a['timers'][_0x5c96a6]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x53a4b8,_0x3fec7a[_0x898a('0x7')][_0x18d167][_0x898a('0x26')],_0x5c96a6,_0x18d167);_0x3fec7a[_0x898a('0x9')][_0x5c96a6][_0x898a('0x27')]=setTimeout(_0x3fec7a[_0x898a('0x28')][_0x898a('0xb')](_0x3fec7a,_0x5c96a6),_0x3fec7a[_0x898a('0x7')][_0x18d167][_0x898a('0x26')]*0x3e8);_0x3fec7a[_0x898a('0x9')][_0x5c96a6]['lastPauseAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3fec7a[_0x898a('0x9')][_0x5c96a6][_0x898a('0x29')]=_0x53a4b8;_0x3fec7a[_0x898a('0x9')][_0x5c96a6][_0x898a('0x1a')]=_0x18d167;_0x3fec7a[_0x898a('0x9')][_0x5c96a6][_0x898a('0x2a')]=function(){var _0xe3c983=getDiff(_0x3fec7a[_0x898a('0x9')][_0x5c96a6][_0x898a('0x2b')]);clearTimeout(_0x3fec7a[_0x898a('0x9')][_0x5c96a6][_0x898a('0x27')]);_0x3fec7a[_0x898a('0x9')][_0x5c96a6]['timer']=![];RpcVoiceAgentReport[_0x898a('0x2c')]({'acwtime':_0xe3c983},_0x3fec7a[_0x898a('0x9')][_0x5c96a6][_0x898a('0x29')],_0x5c96a6)[_0x898a('0x1f')](function(_0x2aa99e){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x53a4b8,_0xe3c983,_0x2aa99e);})[_0x898a('0x2d')](function(_0x1e2fd4){logger[_0x898a('0x2e')]('[%s][UPDATE][ERRORS:%s]',_0x53a4b8,_0x1e2fd4);});delete _0x3fec7a[_0x898a('0x9')][_0x5c96a6];};}});}else{logger[_0x898a('0x22')](_0x898a('0x2f'),_0x53a4b8,_0x5c96a6,_0x18d167);}});}})[_0x898a('0x2d')](function(_0x41cd46){logger[_0x898a('0x2e')](_0x898a('0x30'),_0x53a4b8,_0x3fec7a[_0x898a('0x7')][_0x18d167]['acwTimeout'],_0x5c96a6,_0x18d167);})[_0x898a('0x31')](function(){delete _0x3fec7a['channels'][_0x53a4b8];});}catch(_0x573eb3){logger[_0x898a('0x2e')]('[ACW][START]\x20%s',_0x573eb3[_0x898a('0x32')]);}};Acw['prototype'][_0x898a('0x28')]=function(_0x4f202c){try{var _0x299371=this;if(_0x299371[_0x898a('0x9')][_0x4f202c]){_0x299371[_0x898a('0x9')][_0x4f202c]['timer']=![];var _0x554897=_0x299371['timers'][_0x4f202c][_0x898a('0x29')];var _0x429c32=_0x299371['timers'][_0x4f202c][_0x898a('0x1a')];var _0x3d3463=_0x299371[_0x898a('0x7')][_0x429c32][_0x898a('0x26')];logger['info']('[TIMER][STOP][AGENT:%s]',_0x4f202c);RpcUser[_0x898a('0x33')](this[_0x898a('0x8')][_0x4f202c]);RpcVoiceAgentReport['update']({'acwtime':_0x3d3463,'agentacw':!![]},_0x554897,_0x4f202c)['then'](function(_0x168f92){logger[_0x898a('0x22')](_0x898a('0x34'),_0x554897,_0x3d3463,_0x168f92);})[_0x898a('0x2d')](function(_0x51681f){logger[_0x898a('0x2e')](_0x898a('0x35'),_0x554897,_0x51681f);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x4f202c);if(_0x299371['timers']){logger[_0x898a('0x22')](_0x898a('0x36'),JSON[_0x898a('0x37')](_0x299371[_0x898a('0x9')]));}}}catch(_0x20a6eb){logger[_0x898a('0x2e')](_0x898a('0x38'),_0x20a6eb[_0x898a('0x32')]);}};Acw[_0x898a('0x39')][_0x898a('0x3a')]=function(_0x246048){try{if(this[_0x898a('0x7')][_0x246048[_0x898a('0x1a')]]&&(this[_0x898a('0x7')][_0x246048[_0x898a('0x1a')]]['acw']||this[_0x898a('0x7')][_0x246048[_0x898a('0x1a')]][_0x898a('0x3b')])){if(this['agents'][_0x246048[_0x898a('0x3c')]]){this[_0x898a('0x19')][_0x246048[_0x898a('0x29')]]={'queue':_0x246048[_0x898a('0x1a')],'interface':_0x246048[_0x898a('0x3c')],'destlinkedid':_0x246048[_0x898a('0x24')]};}}}catch(_0x2d1323){logger[_0x898a('0x2e')]('[ACW][syncAgentConnect]\x20%s',_0x2d1323[_0x898a('0x32')]);}};Acw[_0x898a('0x39')][_0x898a('0x3d')]=function(_0x21a990){try{if(this['voiceQueues'][_0x21a990[_0x898a('0x1a')]]&&(this[_0x898a('0x7')][_0x21a990['queue']][_0x898a('0x5')]||this['voiceQueues'][_0x21a990[_0x898a('0x1a')]]['mandatoryDisposition'])){if(this['agents'][_0x21a990[_0x898a('0x3c')]]){this['channels'][_0x21a990[_0x898a('0x29')]]={'queue':_0x21a990[_0x898a('0x1a')],'interface':_0x21a990['interface']};}}}catch(_0x247347){logger[_0x898a('0x2e')]('[ACW][syncAgentConnectPreview]\x20%s',_0x247347[_0x898a('0x32')]);}};Acw[_0x898a('0x39')][_0x898a('0xd')]=function(_0x118240){try{if(this['channels'][_0x118240[_0x898a('0x29')]]&&_[_0x898a('0x3e')](this['channels'][_0x118240[_0x898a('0x29')]][_0x898a('0x3f')])){logger['info'](_0x898a('0x40'),_0x118240['uniqueid']);this[_0x898a('0x18')](_0x118240[_0x898a('0x29')]);}else if(this[_0x898a('0x19')][_0x118240['linkedid']]&&_[_0x898a('0x3e')](this[_0x898a('0x19')][_0x118240[_0x898a('0x41')]][_0x898a('0x3f')])){logger['info'](_0x898a('0x42'),_0x118240['linkedid']);this[_0x898a('0x18')](_0x118240[_0x898a('0x41')]);}}catch(_0x3159d0){logger['error'](_0x898a('0x43'),_0x3159d0[_0x898a('0x32')]);}};Acw[_0x898a('0x39')]['syncHangup']=function(_0x52f8c6){try{if(this[_0x898a('0x19')][_0x52f8c6[_0x898a('0x29')]]&&this[_0x898a('0x19')][_0x52f8c6[_0x898a('0x29')]][_0x898a('0x3f')]){logger[_0x898a('0x22')](_0x898a('0x44'),_0x52f8c6[_0x898a('0x29')]);this[_0x898a('0x18')](_0x52f8c6[_0x898a('0x29')]);}else if(this[_0x898a('0x19')][_0x52f8c6['linkedid']]&&this[_0x898a('0x19')][_0x52f8c6[_0x898a('0x41')]]['attended']){logger[_0x898a('0x22')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x52f8c6['linkedid']);this[_0x898a('0x18')](_0x52f8c6[_0x898a('0x41')]);}}catch(_0x209529){logger['error']('[ACW][syncHangup]\x20%s',_0x209529[_0x898a('0x32')]);}};Acw[_0x898a('0x39')]['syncAttendedTransfer']=function(_0xaa96f7){try{if(!_[_0x898a('0x45')](this['channels'][_0xaa96f7[_0x898a('0x46')]])){this[_0x898a('0x18')](_0xaa96f7[_0x898a('0x46')]);if(this['channels'][_0xaa96f7[_0x898a('0x47')]]){this[_0x898a('0x19')][_0xaa96f7[_0x898a('0x47')]][_0x898a('0x3f')]=!![];this[_0x898a('0x19')][_0xaa96f7[_0x898a('0x48')]]=this['channels'][_0xaa96f7[_0x898a('0x47')]];delete this['channels'][_0xaa96f7[_0x898a('0x47')]];}}else if(!_[_0x898a('0x45')](this[_0x898a('0x19')][_0xaa96f7[_0x898a('0x48')]])){this[_0x898a('0x18')](_0xaa96f7[_0x898a('0x48')]);if(this[_0x898a('0x19')][_0xaa96f7[_0x898a('0x49')]]){this[_0x898a('0x19')][_0xaa96f7['origtransfereruniqueid']][_0x898a('0x3f')]=!![];this[_0x898a('0x19')][_0xaa96f7[_0x898a('0x46')]]=this[_0x898a('0x19')][_0xaa96f7[_0x898a('0x49')]];delete this[_0x898a('0x19')][_0xaa96f7[_0x898a('0x49')]];}}}catch(_0x68fd81){logger[_0x898a('0x2e')](_0x898a('0x4a'),_0x68fd81[_0x898a('0x32')]);}};Acw[_0x898a('0x39')][_0x898a('0x13')]=function(_0x3f76e1){try{if(this[_0x898a('0x19')][_0x3f76e1['transfereruniqueid']]){logger[_0x898a('0x22')](_0x898a('0x4b'),JSON['stringify'](_0x3f76e1[_0x898a('0x4c')]));this[_0x898a('0x18')](_0x3f76e1['transfereruniqueid']);}else if(this[_0x898a('0x19')][_0x3f76e1[_0x898a('0x4d')]]){logger[_0x898a('0x22')](_0x898a('0x4e'),JSON['stringify'](_0x3f76e1[_0x898a('0x4d')]));this[_0x898a('0x18')](_0x3f76e1[_0x898a('0x4d')]);}}catch(_0xf86633){logger['error'](_0x898a('0x4f'),_0xf86633[_0x898a('0x32')]);}};Acw['prototype'][_0x898a('0x11')]=function(_0x3c0bf6){try{if(this['voiceQueues'][_0x3c0bf6[_0x898a('0x1a')]]&&this['voiceQueues'][_0x3c0bf6[_0x898a('0x1a')]]['autopause']==='all'){if(this['agents'][_0x3c0bf6[_0x898a('0x3c')]]){logger[_0x898a('0x22')](_0x898a('0x50'),_0x3c0bf6[_0x898a('0x29')],_0x3c0bf6['interface'],_0x3c0bf6['queue']);return RpcUser[_0x898a('0x25')](this[_0x898a('0x8')][_0x3c0bf6[_0x898a('0x3c')]],_0x898a('0x51'),_0x3c0bf6[_0x898a('0x29')]);}}}catch(_0x41cf94){logger[_0x898a('0x2e')](_0x898a('0x52'),_0x41cf94['message']);}};module[_0x898a('0x53')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 43fe81e..1433cc6 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 _0x537c=['inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipPeerStatus','log','exports','asterisk-manager','bluebird','moment','util','lodash','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s'];(function(_0x5efbd0,_0x299553){var _0x475ec9=function(_0x3752ec){while(--_0x3752ec){_0x5efbd0['push'](_0x5efbd0['shift']());}};_0x475ec9(++_0x299553);}(_0x537c,0x157));var _0xc537=function(_0x60c2e2,_0x1ec57a){_0x60c2e2=_0x60c2e2-0x0;var _0x36a7d5=_0x537c[_0x60c2e2];return _0x36a7d5;};'use strict';var Manager=require(_0xc537('0x0'));var BPromise=require(_0xc537('0x1'));var moment=require(_0xc537('0x2'));var util=require(_0xc537('0x3'));var _=require(_0xc537('0x4'));var logger=require(_0xc537('0x5'))(_0xc537('0x6'));var config=require(_0xc537('0x7'));var ami=new Manager(config[_0xc537('0x8')][_0xc537('0x9')],config['asterisk']['ip'],config[_0xc537('0x8')][_0xc537('0xa')],config[_0xc537('0x8')][_0xc537('0xb')],!![]);ami[_0xc537('0xc')]();ami['Action']=BPromise[_0xc537('0xd')](ami['action']);function error(_0x26a444){logger[_0xc537('0xe')](util[_0xc537('0xf')](_0xc537('0x10'),config[_0xc537('0x8')][_0xc537('0xa')],config[_0xc537('0x8')]['ip'],config['asterisk'][_0xc537('0x9')],util[_0xc537('0x11')](_0x26a444,![],null)));}function close(){logger[_0xc537('0xe')](util[_0xc537('0xf')](_0xc537('0x12'),config[_0xc537('0x8')][_0xc537('0xa')],config['asterisk']['ip'],config[_0xc537('0x8')]['port']));}ami[_0xc537('0x13')]=function(){return function(){return ami[_0xc537('0x14')]({'action':_0xc537('0x15')});};};ami[_0xc537('0x16')]=function(){return function(){return ami['Action']({'action':_0xc537('0x17')});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0xc537('0x18')});};};ami[_0xc537('0x19')]=function(){return function(){return ami[_0xc537('0x14')]({'action':_0xc537('0x1a')});};};ami[_0xc537('0x1b')]=function(){return function(){return ami[_0xc537('0x14')]({'action':'coreshowchannels'});};};function connect(_0x1c4d27){logger[_0xc537('0x1c')](util[_0xc537('0xf')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xc537('0x8')][_0xc537('0xa')],config[_0xc537('0x8')]['ip'],config[_0xc537('0x8')][_0xc537('0x9')]));ami[_0xc537('0x1d')](_0xc537('0xe'),error);ami[_0xc537('0x1d')](_0xc537('0x1e'),close);}ami['on'](_0xc537('0x1f'),connect);ami['on'](_0xc537('0x20'),function(_0x56c2dd){logger['info'](util['format'](_0xc537('0x21'),config[_0xc537('0x8')][_0xc537('0xa')],config[_0xc537('0x8')]['ip'],config['asterisk'][_0xc537('0x9')],util[_0xc537('0x11')](_0x56c2dd,![],null)));});ami['on']('fullybooted',function(_0x355c78){logger[_0xc537('0x1c')](util[_0xc537('0xf')](_0xc537('0x22'),config['asterisk'][_0xc537('0xa')],config['asterisk']['ip'],config['asterisk'][_0xc537('0x9')]));return BPromise[_0xc537('0x23')]()['then'](ami[_0xc537('0x13')]())[_0xc537('0x24')](ami[_0xc537('0x16')]())[_0xc537('0x24')](ami[_0xc537('0x25')]())[_0xc537('0x24')](ami[_0xc537('0x19')]())[_0xc537('0x24')](ami[_0xc537('0x1b')]())['catch'](function(_0xbb685b){console[_0xc537('0x26')](_0xbb685b);});});ami[_0xc537('0x1d')](_0xc537('0xe'),error);ami['once'](_0xc537('0x1e'),close);module[_0xc537('0x27')]=ami; \ No newline at end of file +var _0xda25=['Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','exports','asterisk-manager','bluebird','moment','lodash','../../config/logger','ami','asterisk','username','password','keepConnected','Action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','format','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels'];(function(_0xc01be5,_0x529a48){var _0x2e93d0=function(_0x204bd3){while(--_0x204bd3){_0xc01be5['push'](_0xc01be5['shift']());}};_0x2e93d0(++_0x529a48);}(_0xda25,0x72));var _0x5da2=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xda25[_0x44bcb0];return _0xfaf881;};'use strict';var Manager=require(_0x5da2('0x0'));var BPromise=require(_0x5da2('0x1'));var moment=require(_0x5da2('0x2'));var util=require('util');var _=require(_0x5da2('0x3'));var logger=require(_0x5da2('0x4'))(_0x5da2('0x5'));var config=require('../../config/environment');var ami=new Manager(config['asterisk']['port'],config[_0x5da2('0x6')]['ip'],config[_0x5da2('0x6')][_0x5da2('0x7')],config[_0x5da2('0x6')][_0x5da2('0x8')],!![]);ami[_0x5da2('0x9')]();ami[_0x5da2('0xa')]=BPromise['promisify'](ami['action']);function error(_0x4a6705){logger[_0x5da2('0xb')](util['format'](_0x5da2('0xc'),config['asterisk']['username'],config[_0x5da2('0x6')]['ip'],config['asterisk'][_0x5da2('0xd')],util['inspect'](_0x4a6705,![],null)));}function close(){logger[_0x5da2('0xb')](util[_0x5da2('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk']['username'],config[_0x5da2('0x6')]['ip'],config[_0x5da2('0x6')][_0x5da2('0xd')]));}ami[_0x5da2('0xf')]=function(){return function(){return ami[_0x5da2('0xa')]({'action':'sipshowregistry'});};};ami[_0x5da2('0x10')]=function(){return function(){return ami[_0x5da2('0xa')]({'action':'devicestatelist'});};};ami[_0x5da2('0x11')]=function(){return function(){return ami[_0x5da2('0xa')]({'action':_0x5da2('0x12')});};};ami[_0x5da2('0x13')]=function(){return function(){return ami[_0x5da2('0xa')]({'action':_0x5da2('0x14')});};};ami['actionCoreShowChannels']=function(){return function(){return ami['Action']({'action':_0x5da2('0x15')});};};function connect(_0x2f19f0){logger['info'](util['format'](_0x5da2('0x16'),config[_0x5da2('0x6')]['username'],config[_0x5da2('0x6')]['ip'],config[_0x5da2('0x6')]['port']));ami[_0x5da2('0x17')](_0x5da2('0xb'),error);ami[_0x5da2('0x17')](_0x5da2('0x18'),close);}ami['on'](_0x5da2('0x19'),connect);ami['on']('shutdown',function(_0x28f0b6){logger[_0x5da2('0x1a')](util[_0x5da2('0xe')](_0x5da2('0x1b'),config['asterisk'][_0x5da2('0x7')],config[_0x5da2('0x6')]['ip'],config[_0x5da2('0x6')][_0x5da2('0xd')],util['inspect'](_0x28f0b6,![],null)));});ami['on'](_0x5da2('0x1c'),function(_0x2d1351){logger[_0x5da2('0x1a')](util[_0x5da2('0xe')](_0x5da2('0x1d'),config['asterisk'][_0x5da2('0x7')],config['asterisk']['ip'],config[_0x5da2('0x6')][_0x5da2('0xd')]));return BPromise[_0x5da2('0x1e')]()['then'](ami[_0x5da2('0xf')]())[_0x5da2('0x1f')](ami['actionDeviceStateList']())[_0x5da2('0x1f')](ami[_0x5da2('0x11')]())[_0x5da2('0x1f')](ami[_0x5da2('0x13')]())[_0x5da2('0x1f')](ami['actionCoreShowChannels']())[_0x5da2('0x20')](function(_0x5681e3){console['log'](_0x5681e3);});});ami[_0x5da2('0x17')](_0x5da2('0xb'),error);ami['once'](_0x5da2('0x18'),close);module[_0x5da2('0x21')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index ab652ea..883bbb0 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 _0x480b=['debug','rpc','memberReport','error','message','catch','exports','bluebird','ami','client','Request','then'];(function(_0x5a3707,_0x3fdff4){var _0x36afc1=function(_0x309852){while(--_0x309852){_0x5a3707['push'](_0x5a3707['shift']());}};_0x36afc1(++_0x3fdff4);}(_0x480b,0xc7));var _0xb480=function(_0x342528,_0x315d62){_0x342528=_0x342528-0x0;var _0x102d7f=_0x480b[_0x342528];return _0x102d7f;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xb480('0x0'));var logger=require('../../config/logger')(_0xb480('0x1'));var client=jayson[_0xb480('0x2')]['http']({'port':0x2329});client[_0xb480('0x3')]=function(_0x2bfa15,_0x36ec5b){return new BPromise(function(_0x3fec18,_0x2f7d36){return client['request'](_0x2bfa15,_0x36ec5b)[_0xb480('0x4')](function(_0x204f1f){logger[_0xb480('0x5')](_0xb480('0x6'),_0xb480('0x7'),_0x2bfa15,_0x36ec5b,_0x204f1f);if(_0x204f1f['error']){logger['error'](_0xb480('0x6'),_0xb480('0x7'),_0x2bfa15,_0x204f1f[_0xb480('0x8')][_0xb480('0x9')],_0x36ec5b);return _0x2f7d36(_0x204f1f[_0xb480('0x8')][_0xb480('0x9')]);}else{return _0x3fec18(_0x204f1f['result']);}})[_0xb480('0xa')](function(_0x151611){logger[_0xb480('0x8')]('rpc',_0xb480('0x7'),_0x2bfa15,_0x151611,_0x36ec5b);return _0x2f7d36(_0x151611);});});};module[_0xb480('0xb')]=client; \ No newline at end of file +var _0xe0db=['error','message','result','exports','bluebird','client','http','request','then','debug','rpc','memberReport'];(function(_0x541b9a,_0x169793){var _0x52c418=function(_0x33bc73){while(--_0x33bc73){_0x541b9a['push'](_0x541b9a['shift']());}};_0x52c418(++_0x169793);}(_0xe0db,0xb8));var _0xbe0d=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xe0db[_0x28947d];return _0x12d2ee;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xbe0d('0x0'));var logger=require('../../config/logger')('ami');var client=jayson[_0xbe0d('0x1')][_0xbe0d('0x2')]({'port':0x2329});client['Request']=function(_0xb9fba4,_0x830f8f){return new BPromise(function(_0x27cf4b,_0x574e5d){return client[_0xbe0d('0x3')](_0xb9fba4,_0x830f8f)[_0xbe0d('0x4')](function(_0x4e179d){logger[_0xbe0d('0x5')](_0xbe0d('0x6'),_0xbe0d('0x7'),_0xb9fba4,_0x830f8f,_0x4e179d);if(_0x4e179d[_0xbe0d('0x8')]){logger[_0xbe0d('0x8')](_0xbe0d('0x6'),'memberReport',_0xb9fba4,_0x4e179d[_0xbe0d('0x8')][_0xbe0d('0x9')],_0x830f8f);return _0x574e5d(_0x4e179d['error'][_0xbe0d('0x9')]);}else{return _0x27cf4b(_0x4e179d[_0xbe0d('0xa')]);}})['catch'](function(_0x27fcfb){logger['error']('rpc',_0xbe0d('0x7'),_0xb9fba4,_0x27fcfb,_0x830f8f);return _0x574e5d(_0x27fcfb);});});};module[_0xbe0d('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index cc1dfd8..4972376 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 _0x16e3=['util','string','uniqueid','Contact','number','queue','name','active','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','dialCutDigit','substring','voiceQueue','getQueue','exports'];(function(_0x5ed571,_0x2d48fe){var _0x3307ed=function(_0x159b70){while(--_0x159b70){_0x5ed571['push'](_0x5ed571['shift']());}};_0x3307ed(++_0x2d48fe);}(_0x16e3,0x168));var _0x316e=function(_0x3f84dd,_0x209999){_0x3f84dd=_0x3f84dd-0x0;var _0x2516cb=_0x16e3[_0x3f84dd];return _0x2516cb;};'use strict';var util=require(_0x316e('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x3bbc58,_0x5dc80a,_0x4381dc){var _0x95932e='';if(!_['isNil'](_0x5dc80a)&&_0x316e('0x1')===typeof _0x5dc80a){_0x95932e+=_0x5dc80a;}if(!_['isNil'](_0x4381dc)&&_0x316e('0x1')===typeof _0x4381dc){_0x95932e+='\x20'+_0x4381dc;}if(_0x95932e!==''){return _0x95932e;}return _0x3bbc58;}function Action(_0x338bdb,_0x52af3d,_0x3ef0e3){this['voiceQueue']=_0x338bdb;this[_0x316e('0x2')]=_0x3ef0e3||undefined;this['name']=checkNameSurname(_0x52af3d[_0x316e('0x3')]['phone'],_0x52af3d[_0x316e('0x3')]['firstName'],_0x52af3d['Contact']['lastName']);this[_0x316e('0x4')]=_0x52af3d[_0x316e('0x3')]['phone'];this[_0x316e('0x5')]=_0x338bdb[_0x316e('0x6')];this['active']=_0x52af3d[_0x316e('0x7')]||![];this['type']=_0x338bdb['type'];this[_0x316e('0x8')]=_0x338bdb[_0x316e('0x8')]||0x3;this[_0x316e('0x9')]=_0x52af3d[_0x316e('0x9')];this['countbusyretry']=_0x52af3d[_0x316e('0xa')];this['countcongestionretry']=_0x52af3d[_0x316e('0xb')];this[_0x316e('0xc')]=_0x52af3d[_0x316e('0xc')];this['countnosuchnumberretry']=_0x52af3d[_0x316e('0xd')];this[_0x316e('0xe')]=_0x52af3d[_0x316e('0xe')];this['countabandonedretry']=_0x52af3d[_0x316e('0xf')];this[_0x316e('0x10')]=_0x52af3d[_0x316e('0x10')];this[_0x316e('0x11')]=_0x52af3d[_0x316e('0x11')];this[_0x316e('0x12')]=_0x52af3d[_0x316e('0x12')];this['ListId']=_0x52af3d[_0x316e('0x13')];this[_0x316e('0x14')]=_0x52af3d[_0x316e('0x14')];this[_0x316e('0x15')]=_0x52af3d[_0x316e('0x15')];this[_0x316e('0x16')]=_0x52af3d[_0x316e('0x16')];this[_0x316e('0x17')]=_0x52af3d['id'];this['ContactFirstName']=_0x52af3d[_0x316e('0x3')]['firstName']||'';this[_0x316e('0x18')]=moment()[_0x316e('0x19')](_0x316e('0x1a'));this[_0x316e('0x1b')]=_0x52af3d[_0x316e('0x1b')];this[_0x316e('0x1c')]=_0x52af3d[_0x316e('0x1c')];this[_0x316e('0x1d')]=_0x52af3d[_0x316e('0x1d')];this[_0x316e('0x1e')]=_0x52af3d[_0x316e('0x1e')];this[_0x316e('0x1f')]='';this[_0x316e('0x20')]='';}Action[_0x316e('0x21')][_0x316e('0x22')]=function(){return util[_0x316e('0x19')]('\x22%s\x22\x20<%s>',this[_0x316e('0x6')],this['voiceQueue'][_0x316e('0x23')]>0x0?this[_0x316e('0x4')][_0x316e('0x24')](this[_0x316e('0x25')][_0x316e('0x23')]):this[_0x316e('0x4')]);};Action[_0x316e('0x21')][_0x316e('0x26')]=function(){return this[_0x316e('0x5')];};module[_0x316e('0x27')]=Action; \ No newline at end of file +var _0x48bc=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','util','lodash','moment','isNil','string','voiceQueue','uniqueid','Contact','firstName','lastName','number','phone','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x48bc,0x1b6));var _0xc48b=function(_0x3deffc,_0x38d990){_0x3deffc=_0x3deffc-0x0;var _0x302890=_0x48bc[_0x3deffc];return _0x302890;};'use strict';var util=require(_0xc48b('0x0'));var _=require(_0xc48b('0x1'));var moment=require(_0xc48b('0x2'));function checkNameSurname(_0x48f245,_0x29e2d4,_0x427753){var _0x15b642='';if(!_[_0xc48b('0x3')](_0x29e2d4)&&_0xc48b('0x4')===typeof _0x29e2d4){_0x15b642+=_0x29e2d4;}if(!_[_0xc48b('0x3')](_0x427753)&&_0xc48b('0x4')===typeof _0x427753){_0x15b642+='\x20'+_0x427753;}if(_0x15b642!==''){return _0x15b642;}return _0x48f245;}function Action(_0x52796c,_0x221555,_0x4c001c){this[_0xc48b('0x5')]=_0x52796c;this[_0xc48b('0x6')]=_0x4c001c||undefined;this['name']=checkNameSurname(_0x221555[_0xc48b('0x7')]['phone'],_0x221555[_0xc48b('0x7')][_0xc48b('0x8')],_0x221555['Contact'][_0xc48b('0x9')]);this[_0xc48b('0xa')]=_0x221555[_0xc48b('0x7')][_0xc48b('0xb')];this[_0xc48b('0xc')]=_0x52796c[_0xc48b('0xd')];this[_0xc48b('0xe')]=_0x221555[_0xc48b('0xe')]||![];this[_0xc48b('0xf')]=_0x52796c[_0xc48b('0xf')];this[_0xc48b('0x10')]=_0x52796c[_0xc48b('0x10')]||0x3;this['scheduledat']=_0x221555[_0xc48b('0x11')];this[_0xc48b('0x12')]=_0x221555[_0xc48b('0x12')];this['countcongestionretry']=_0x221555[_0xc48b('0x13')];this[_0xc48b('0x14')]=_0x221555[_0xc48b('0x14')];this[_0xc48b('0x15')]=_0x221555[_0xc48b('0x15')];this[_0xc48b('0x16')]=_0x221555[_0xc48b('0x16')];this[_0xc48b('0x17')]=_0x221555['countabandonedretry'];this[_0xc48b('0x18')]=_0x221555['countmachineretry'];this['countagentrejectretry']=_0x221555[_0xc48b('0x19')];this['ContactId']=_0x221555[_0xc48b('0x1a')];this['ListId']=_0x221555[_0xc48b('0x1b')];this['UserId']=_0x221555[_0xc48b('0x1c')];this[_0xc48b('0x1d')]=_0x221555[_0xc48b('0x1d')];this['CampaignId']=_0x221555['CampaignId'];this[_0xc48b('0x1e')]=_0x221555['id'];this['ContactFirstName']=_0x221555[_0xc48b('0x7')][_0xc48b('0x8')]||'';this[_0xc48b('0x1f')]=moment()[_0xc48b('0x20')](_0xc48b('0x21'));this[_0xc48b('0x22')]=_0x221555[_0xc48b('0x22')];this[_0xc48b('0x23')]=_0x221555[_0xc48b('0x23')];this['callbackat']=_0x221555[_0xc48b('0x24')];this[_0xc48b('0x25')]=_0x221555[_0xc48b('0x25')];this[_0xc48b('0x26')]='';this[_0xc48b('0x27')]='';}Action[_0xc48b('0x28')][_0xc48b('0x29')]=function(){return util[_0xc48b('0x20')](_0xc48b('0x2a'),this[_0xc48b('0xd')],this[_0xc48b('0x5')][_0xc48b('0x2b')]>0x0?this['number'][_0xc48b('0x2c')](this[_0xc48b('0x5')][_0xc48b('0x2b')]):this[_0xc48b('0xa')]);};Action[_0xc48b('0x28')][_0xc48b('0x2d')]=function(){return this[_0xc48b('0xc')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index cf2f623..8a57c07 100644 --- a/server/services/ami/dialer/additionalPhone.js +++ b/server/services/ami/dialer/additionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc161=['scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid'];(function(_0x52f28a,_0x4c2a3a){var _0x19f018=function(_0x435b81){while(--_0x435b81){_0x52f28a['push'](_0x52f28a['shift']());}};_0x19f018(++_0x4c2a3a);}(_0xc161,0x99));var _0x1c16=function(_0x1646fa,_0x4e5bd7){_0x1646fa=_0x1646fa-0x0;var _0x5a47a5=_0xc161[_0x1646fa];return _0x5a47a5;};'use strict';var util=require(_0x1c16('0x0'));var _=require(_0x1c16('0x1'));var moment=require(_0x1c16('0x2'));function getSeconds(_0x3d45a7,_0x472ebd){var _0x5da70e=moment(_0x3d45a7)[_0x1c16('0x3')](0x0);var _0x487e90=moment(_0x472ebd)[_0x1c16('0x3')](0x0);return _0x5da70e[_0x1c16('0x4')](_0x487e90,_0x1c16('0x5'));}function AdditionalPhone(_0x5dea05){this[_0x1c16('0x6')]=_0x5dea05[_0x1c16('0x6')];this[_0x1c16('0x7')]=_0x5dea05[_0x1c16('0x7')]||undefined;this[_0x1c16('0x8')]=_0x5dea05[_0x1c16('0x8')];this['campaigntype']=_0x5dea05['type']===_0x1c16('0x9')?_0x1c16('0xa'):_0x5dea05['type'];this[_0x1c16('0xb')]=_0x5dea05[_0x1c16('0xb')];this[_0x1c16('0xc')]=_0x5dea05[_0x1c16('0xc')];this[_0x1c16('0xd')]=_0x5dea05[_0x1c16('0xd')];this['countglobal']=_0x5dea05['countbusyretry']+_0x5dea05[_0x1c16('0xc')]+_0x5dea05['countnoanswerretry']+_0x5dea05[_0x1c16('0xe')]+_0x5dea05[_0x1c16('0xf')]+_0x5dea05[_0x1c16('0x10')]+_0x5dea05['countmachineretry']+_0x5dea05[_0x1c16('0x11')];this[_0x1c16('0xe')]=_0x5dea05[_0x1c16('0xe')];this[_0x1c16('0xf')]=_0x5dea05[_0x1c16('0xf')];this['countabandonedretry']=_0x5dea05['countabandonedretry'];this[_0x1c16('0x12')]=_0x5dea05['countmachineretry'];this['countagentrejectretry']=_0x5dea05[_0x1c16('0x11')];this[_0x1c16('0xa')]=_0x5dea05[_0x1c16('0xa')];this[_0x1c16('0x13')]=_0x5dea05[_0x1c16('0x14')];this[_0x1c16('0x15')]=_0x5dea05[_0x1c16('0x16')];this[_0x1c16('0x17')]=_0x5dea05[_0x1c16('0x17')];this[_0x1c16('0x18')]=_0x5dea05[_0x1c16('0x18')];this[_0x1c16('0x19')]=_0x5dea05[_0x1c16('0x18')];this[_0x1c16('0x1a')]=getSeconds(_0x5dea05[_0x1c16('0x18')],_0x5dea05[_0x1c16('0x17')]);this[_0x1c16('0x1b')]=0x0;this[_0x1c16('0x1c')]=0x0;this[_0x1c16('0x1d')]=_0x5dea05[_0x1c16('0x1d')];this[_0x1c16('0x1e')]=_0x5dea05[_0x1c16('0x1e')];this[_0x1c16('0x1f')]=_0x5dea05['callbackat'];this[_0x1c16('0x20')]=_0x5dea05['recallme'];this['ContactId']=_0x5dea05['ContactId'];this[_0x1c16('0x21')]=_0x5dea05['ListId'];this[_0x1c16('0x22')]=_0x5dea05[_0x1c16('0x22')];this[_0x1c16('0x23')]=_0x5dea05[_0x1c16('0x23')];this[_0x1c16('0x24')]=_0x5dea05[_0x1c16('0x24')];this['originatecalleridnum']=_0x5dea05[_0x1c16('0x25')]||'';this[_0x1c16('0x26')]=_0x5dea05[_0x1c16('0x26')]||'';}module[_0x1c16('0x27')]=History; \ No newline at end of file +var _0xa4d7=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid'];(function(_0x5ff517,_0x3e4ee0){var _0x19a245=function(_0x4c00ac){while(--_0x4c00ac){_0x5ff517['push'](_0x5ff517['shift']());}};_0x19a245(++_0x3e4ee0);}(_0xa4d7,0xc8));var _0x7a4d=function(_0x210b24,_0x11eea6){_0x210b24=_0x210b24-0x0;var _0x267fad=_0xa4d7[_0x210b24];return _0x267fad;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x7a4d('0x0'));function getSeconds(_0xead091,_0x254d3a){var _0x541e0f=moment(_0xead091)[_0x7a4d('0x1')](0x0);var _0x46ab8c=moment(_0x254d3a)[_0x7a4d('0x1')](0x0);return _0x541e0f[_0x7a4d('0x2')](_0x46ab8c,_0x7a4d('0x3'));}function AdditionalPhone(_0x8770bc){this[_0x7a4d('0x4')]=_0x8770bc[_0x7a4d('0x4')];this[_0x7a4d('0x5')]=_0x8770bc[_0x7a4d('0x5')]||undefined;this[_0x7a4d('0x6')]=_0x8770bc['type'];this[_0x7a4d('0x7')]=_0x8770bc[_0x7a4d('0x6')]==='outbound'?_0x7a4d('0x8'):_0x8770bc['type'];this[_0x7a4d('0x9')]=_0x8770bc[_0x7a4d('0x9')];this[_0x7a4d('0xa')]=_0x8770bc[_0x7a4d('0xa')];this[_0x7a4d('0xb')]=_0x8770bc[_0x7a4d('0xb')];this['countglobal']=_0x8770bc[_0x7a4d('0x9')]+_0x8770bc[_0x7a4d('0xa')]+_0x8770bc[_0x7a4d('0xb')]+_0x8770bc['countnosuchnumberretry']+_0x8770bc['countdropretry']+_0x8770bc[_0x7a4d('0xc')]+_0x8770bc['countmachineretry']+_0x8770bc[_0x7a4d('0xd')];this[_0x7a4d('0xe')]=_0x8770bc[_0x7a4d('0xe')];this[_0x7a4d('0xf')]=_0x8770bc['countdropretry'];this[_0x7a4d('0xc')]=_0x8770bc[_0x7a4d('0xc')];this[_0x7a4d('0x10')]=_0x8770bc['countmachineretry'];this[_0x7a4d('0xd')]=_0x8770bc['countagentrejectretry'];this[_0x7a4d('0x8')]=_0x8770bc[_0x7a4d('0x8')];this[_0x7a4d('0x11')]=_0x8770bc[_0x7a4d('0x12')];this[_0x7a4d('0x13')]=_0x8770bc[_0x7a4d('0x14')];this[_0x7a4d('0x15')]=_0x8770bc['starttime'];this[_0x7a4d('0x16')]=_0x8770bc['responsetime'];this[_0x7a4d('0x17')]=_0x8770bc[_0x7a4d('0x16')];this[_0x7a4d('0x18')]=getSeconds(_0x8770bc[_0x7a4d('0x16')],_0x8770bc['starttime']);this['holdtime']=0x0;this[_0x7a4d('0x19')]=0x0;this[_0x7a4d('0x1a')]=_0x8770bc[_0x7a4d('0x1a')];this['callbackuniqueid']=_0x8770bc[_0x7a4d('0x1b')];this[_0x7a4d('0x1c')]=_0x8770bc['callbackat'];this['recallme']=_0x8770bc[_0x7a4d('0x1d')];this[_0x7a4d('0x1e')]=_0x8770bc[_0x7a4d('0x1e')];this[_0x7a4d('0x1f')]=_0x8770bc[_0x7a4d('0x1f')];this[_0x7a4d('0x20')]=_0x8770bc['UserId'];this['VoiceQueueId']=_0x8770bc[_0x7a4d('0x21')];this[_0x7a4d('0x22')]=_0x8770bc['CampaignId'];this[_0x7a4d('0x23')]=_0x8770bc['originatecalleridnum']||'';this[_0x7a4d('0x24')]=_0x8770bc['originatecalleridname']||'';}module[_0x7a4d('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 22446bc..0d17203 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 _0x0783=['answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','responsetime','talktime','membername','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','lodash','milliseconds','diff','state','statedesc','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime'];(function(_0x232583,_0x44bdb5){var _0x49ddc1=function(_0x134f3f){while(--_0x134f3f){_0x232583['push'](_0x232583['shift']());}};_0x49ddc1(++_0x44bdb5);}(_0x0783,0x152));var _0x3078=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0783[_0x20a584];return _0x4b41a8;};'use strict';var util=require('util');var _=require(_0x3078('0x0'));var moment=require('moment');function getSeconds(_0x129e2d,_0x34a968){var _0xf1fa1d=moment(_0x129e2d)[_0x3078('0x1')](0x0);var _0x890049=moment(_0x34a968)[_0x3078('0x1')](0x0);return _0xf1fa1d[_0x3078('0x2')](_0x890049,'seconds');}function AgentComplete(_0x2b4375,_0xb17554){this[_0x3078('0x3')]=0x4;this[_0x3078('0x4')]='Answer';this[_0x3078('0x5')]=_0x2b4375[_0x3078('0x5')];this[_0x3078('0x6')]=_0x2b4375[_0x3078('0x6')];this['campaigntype']=_0x2b4375[_0x3078('0x6')]===_0x3078('0x7')?_0x3078('0x8'):_0x2b4375[_0x3078('0x6')];this[_0x3078('0x9')]=_0x2b4375[_0x3078('0x9')];this[_0x3078('0xa')]=_0x2b4375[_0x3078('0xa')];this[_0x3078('0xb')]=_0x2b4375[_0x3078('0xb')];this[_0x3078('0xc')]=_0x2b4375[_0x3078('0x9')]+_0x2b4375[_0x3078('0xa')]+_0x2b4375['countnoanswerretry']+_0x2b4375[_0x3078('0xd')]+_0x2b4375['countdropretry']+_0x2b4375['countabandonedretry']+_0x2b4375[_0x3078('0xe')]+_0x2b4375['countagentrejectretry'];this[_0x3078('0xd')]=_0x2b4375['countnosuchnumberretry'];this['countdropretry']=_0x2b4375['countdropretry'];this['countabandonedretry']=_0x2b4375[_0x3078('0xf')];this['countmachineretry']=_0x2b4375[_0x3078('0xe')];this['countagentrejectretry']=_0x2b4375[_0x3078('0x10')];this[_0x3078('0x11')]=_0xb17554[_0x3078('0x11')];this[_0x3078('0x12')]=_0x2b4375['name'];this[_0x3078('0x13')]=_0x2b4375[_0x3078('0x14')];this[_0x3078('0x15')]=_0x2b4375[_0x3078('0x15')];this['responsetime']=_0x2b4375['responsetime'];this[_0x3078('0x16')]=_0x2b4375[_0x3078('0x16')];this[_0x3078('0x17')]=moment()[_0x3078('0x18')](_0x3078('0x19'));this[_0x3078('0x1a')]=getSeconds(_0x2b4375['responsetime'],_0x2b4375['starttime']);this[_0x3078('0x1b')]=getSeconds(_0x2b4375[_0x3078('0x16')],_0x2b4375[_0x3078('0x1c')]);this[_0x3078('0x1d')]=getSeconds(this[_0x3078('0x17')],_0x2b4375[_0x3078('0x16')]);this[_0x3078('0x8')]=_0xb17554[_0x3078('0x8')];this[_0x3078('0x1e')]=_0xb17554[_0x3078('0x1e')];this['reason']=_0xb17554['reason'];this[_0x3078('0x1f')]=_0x2b4375[_0x3078('0x1f')];this[_0x3078('0x20')]=_0x2b4375[_0x3078('0x20')];this[_0x3078('0x21')]=_0x2b4375[_0x3078('0x21')];this['recallme']=_0x2b4375['recallme'];this[_0x3078('0x22')]=_0x2b4375[_0x3078('0x22')];this['ListId']=_0x2b4375[_0x3078('0x23')];this[_0x3078('0x24')]=_0x2b4375[_0x3078('0x24')];this[_0x3078('0x25')]=_0x2b4375[_0x3078('0x25')];this[_0x3078('0x26')]=_0x2b4375['CampaignId'];this[_0x3078('0x27')]=_0x2b4375[_0x3078('0x27')]||'';this['originatecalleridname']=_0x2b4375['originatecalleridname']||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0x9c78=['membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime'];(function(_0x440917,_0x20ea7b){var _0x5e906b=function(_0x27cba5){while(--_0x27cba5){_0x440917['push'](_0x440917['shift']());}};_0x5e906b(++_0x20ea7b);}(_0x9c78,0x1da));var _0x89c7=function(_0x1d2ce2,_0x4e0f33){_0x1d2ce2=_0x1d2ce2-0x0;var _0x3afba0=_0x9c78[_0x1d2ce2];return _0x3afba0;};'use strict';var util=require('util');var _=require(_0x89c7('0x0'));var moment=require(_0x89c7('0x1'));function getSeconds(_0x1f5e5e,_0x15bf6d){var _0x597a38=moment(_0x1f5e5e)[_0x89c7('0x2')](0x0);var _0x4b2aca=moment(_0x15bf6d)[_0x89c7('0x2')](0x0);return _0x597a38['diff'](_0x4b2aca,_0x89c7('0x3'));}function AgentComplete(_0x31b873,_0x5cdbfb){this[_0x89c7('0x4')]=0x4;this[_0x89c7('0x5')]=_0x89c7('0x6');this['scheduledat']=_0x31b873[_0x89c7('0x7')];this[_0x89c7('0x8')]=_0x31b873[_0x89c7('0x8')];this['campaigntype']=_0x31b873[_0x89c7('0x8')]===_0x89c7('0x9')?_0x89c7('0xa'):_0x31b873[_0x89c7('0x8')];this[_0x89c7('0xb')]=_0x31b873[_0x89c7('0xb')];this[_0x89c7('0xc')]=_0x31b873[_0x89c7('0xc')];this['countnoanswerretry']=_0x31b873[_0x89c7('0xd')];this[_0x89c7('0xe')]=_0x31b873[_0x89c7('0xb')]+_0x31b873[_0x89c7('0xc')]+_0x31b873[_0x89c7('0xd')]+_0x31b873[_0x89c7('0xf')]+_0x31b873[_0x89c7('0x10')]+_0x31b873[_0x89c7('0x11')]+_0x31b873[_0x89c7('0x12')]+_0x31b873[_0x89c7('0x13')];this[_0x89c7('0xf')]=_0x31b873[_0x89c7('0xf')];this[_0x89c7('0x10')]=_0x31b873[_0x89c7('0x10')];this['countabandonedretry']=_0x31b873[_0x89c7('0x11')];this[_0x89c7('0x12')]=_0x31b873['countmachineretry'];this[_0x89c7('0x13')]=_0x31b873[_0x89c7('0x13')];this[_0x89c7('0x14')]=_0x5cdbfb[_0x89c7('0x14')];this[_0x89c7('0x15')]=_0x31b873['name'];this[_0x89c7('0x16')]=_0x31b873[_0x89c7('0x17')];this['starttime']=_0x31b873[_0x89c7('0x18')];this[_0x89c7('0x19')]=_0x31b873['responsetime'];this[_0x89c7('0x1a')]=_0x31b873[_0x89c7('0x1a')];this[_0x89c7('0x1b')]=moment()[_0x89c7('0x1c')](_0x89c7('0x1d'));this['ringtime']=getSeconds(_0x31b873[_0x89c7('0x19')],_0x31b873[_0x89c7('0x18')]);this[_0x89c7('0x1e')]=getSeconds(_0x31b873[_0x89c7('0x1a')],_0x31b873[_0x89c7('0x19')]);this[_0x89c7('0x1f')]=getSeconds(this[_0x89c7('0x1b')],_0x31b873[_0x89c7('0x1a')]);this['queue']=_0x5cdbfb[_0x89c7('0xa')];this[_0x89c7('0x20')]=_0x5cdbfb['membername'];this[_0x89c7('0x21')]=_0x5cdbfb['reason'];this[_0x89c7('0x22')]=_0x31b873['callback'];this[_0x89c7('0x23')]=_0x31b873[_0x89c7('0x23')];this[_0x89c7('0x24')]=_0x31b873[_0x89c7('0x24')];this[_0x89c7('0x25')]=_0x31b873['recallme'];this[_0x89c7('0x26')]=_0x31b873[_0x89c7('0x26')];this[_0x89c7('0x27')]=_0x31b873[_0x89c7('0x27')];this[_0x89c7('0x28')]=_0x31b873[_0x89c7('0x28')];this[_0x89c7('0x29')]=_0x31b873[_0x89c7('0x29')];this[_0x89c7('0x2a')]=_0x31b873[_0x89c7('0x2a')];this['originatecalleridnum']=_0x31b873[_0x89c7('0x2b')]||'';this[_0x89c7('0x2c')]=_0x31b873[_0x89c7('0x2c')]||'';}module[_0x89c7('0x2d')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 7130097..4c0acf2 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 _0x5b34=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue'];(function(_0x17d713,_0x19b690){var _0x452666=function(_0xaff2b4){while(--_0xaff2b4){_0x17d713['push'](_0x17d713['shift']());}};_0x452666(++_0x19b690);}(_0x5b34,0x182));var _0x45b3=function(_0x1ab371,_0x1ee946){_0x1ab371=_0x1ab371-0x0;var _0x20e701=_0x5b34[_0x1ab371];return _0x20e701;};'use strict';var util=require(_0x45b3('0x0'));var _=require('lodash');var moment=require(_0x45b3('0x1'));function getSeconds(_0x23f917,_0x4546d7){var _0xc416d3=moment(_0x23f917)[_0x45b3('0x2')](0x0);var _0x3fa603=moment(_0x4546d7)[_0x45b3('0x2')](0x0);return _0xc416d3[_0x45b3('0x3')](_0x3fa603,'seconds');}function Final(_0x20f571){this['uniqueid']=_0x20f571[_0x45b3('0x4')];this[_0x45b3('0x5')]=_0x20f571[_0x45b3('0x5')];this[_0x45b3('0x6')]=_0x20f571['type'];this[_0x45b3('0x7')]=_0x20f571[_0x45b3('0x6')]===_0x45b3('0x8')?_0x45b3('0x9'):_0x20f571[_0x45b3('0x6')];this[_0x45b3('0xa')]=_0x20f571[_0x45b3('0xa')];this[_0x45b3('0xb')]=_0x20f571[_0x45b3('0xb')];this[_0x45b3('0xc')]=_0x20f571[_0x45b3('0xc')];this[_0x45b3('0xd')]=_0x20f571[_0x45b3('0xa')]+_0x20f571['countcongestionretry']+_0x20f571[_0x45b3('0xc')]+_0x20f571[_0x45b3('0xe')]+_0x20f571[_0x45b3('0xf')]+_0x20f571[_0x45b3('0x10')]+_0x20f571['countmachineretry']+_0x20f571[_0x45b3('0x11')];this['countnosuchnumberretry']=_0x20f571['countnosuchnumberretry'];this['countdropretry']=_0x20f571[_0x45b3('0xf')];this[_0x45b3('0x10')]=_0x20f571[_0x45b3('0x10')];this[_0x45b3('0x12')]=_0x20f571[_0x45b3('0x12')];this[_0x45b3('0x11')]=_0x20f571['countagentrejectretry'];this[_0x45b3('0x9')]=_0x20f571['queue'];this[_0x45b3('0x13')]=_0x20f571[_0x45b3('0x13')];this[_0x45b3('0x14')]=_0x20f571[_0x45b3('0x14')];this[_0x45b3('0x15')]=_0x20f571[_0x45b3('0x15')];this['responsetime']=_0x20f571[_0x45b3('0x16')];this[_0x45b3('0x17')]=_0x20f571[_0x45b3('0x16')];this[_0x45b3('0x18')]=_0x20f571[_0x45b3('0x18')]||0x0;this[_0x45b3('0x19')]=_0x20f571[_0x45b3('0x19')]||0x0;this[_0x45b3('0x1a')]=_0x20f571[_0x45b3('0x1a')]||0x0;this['callback']=_0x20f571[_0x45b3('0x1b')];this['callbackuniqueid']=_0x20f571['callbackuniqueid'];this[_0x45b3('0x1c')]=_0x20f571[_0x45b3('0x1c')];this[_0x45b3('0x1d')]=_0x20f571['recallme'];this[_0x45b3('0x1e')]=_0x20f571[_0x45b3('0x1e')];this[_0x45b3('0x1f')]=_0x20f571[_0x45b3('0x1f')];this['UserId']=_0x20f571['UserId'];this[_0x45b3('0x20')]=_0x20f571[_0x45b3('0x20')];this[_0x45b3('0x21')]=_0x20f571['CampaignId'];this[_0x45b3('0x22')]=_0x20f571['originatecalleridnum']||'';this['originatecalleridname']=_0x20f571['originatecalleridname']||'';}module[_0x45b3('0x23')]=Final; \ No newline at end of file +var _0x1b1f=['responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','calleridname','calleridnum','starttime'];(function(_0xbc544b,_0xda1fbb){var _0x3a507e=function(_0x5ba812){while(--_0x5ba812){_0xbc544b['push'](_0xbc544b['shift']());}};_0x3a507e(++_0xda1fbb);}(_0x1b1f,0x128));var _0xf1b1=function(_0x181067,_0x1be5b1){_0x181067=_0x181067-0x0;var _0x25f99b=_0x1b1f[_0x181067];return _0x25f99b;};'use strict';var util=require(_0xf1b1('0x0'));var _=require(_0xf1b1('0x1'));var moment=require(_0xf1b1('0x2'));function getSeconds(_0x4542e8,_0x3bf816){var _0x5baa66=moment(_0x4542e8)[_0xf1b1('0x3')](0x0);var _0x47968e=moment(_0x3bf816)['milliseconds'](0x0);return _0x5baa66[_0xf1b1('0x4')](_0x47968e,_0xf1b1('0x5'));}function Final(_0x5184e5){this[_0xf1b1('0x6')]=_0x5184e5[_0xf1b1('0x6')];this[_0xf1b1('0x7')]=_0x5184e5[_0xf1b1('0x7')];this[_0xf1b1('0x8')]=_0x5184e5[_0xf1b1('0x8')];this[_0xf1b1('0x9')]=_0x5184e5['type']===_0xf1b1('0xa')?'queue':_0x5184e5[_0xf1b1('0x8')];this['countbusyretry']=_0x5184e5['countbusyretry'];this['countcongestionretry']=_0x5184e5[_0xf1b1('0xb')];this[_0xf1b1('0xc')]=_0x5184e5[_0xf1b1('0xc')];this[_0xf1b1('0xd')]=_0x5184e5[_0xf1b1('0xe')]+_0x5184e5[_0xf1b1('0xb')]+_0x5184e5[_0xf1b1('0xc')]+_0x5184e5[_0xf1b1('0xf')]+_0x5184e5[_0xf1b1('0x10')]+_0x5184e5['countabandonedretry']+_0x5184e5[_0xf1b1('0x11')]+_0x5184e5[_0xf1b1('0x12')];this['countnosuchnumberretry']=_0x5184e5['countnosuchnumberretry'];this[_0xf1b1('0x10')]=_0x5184e5[_0xf1b1('0x10')];this['countabandonedretry']=_0x5184e5[_0xf1b1('0x13')];this[_0xf1b1('0x11')]=_0x5184e5[_0xf1b1('0x11')];this[_0xf1b1('0x12')]=_0x5184e5[_0xf1b1('0x12')];this[_0xf1b1('0x14')]=_0x5184e5['queue'];this[_0xf1b1('0x15')]=_0x5184e5[_0xf1b1('0x15')];this[_0xf1b1('0x16')]=_0x5184e5['calleridnum'];this[_0xf1b1('0x17')]=_0x5184e5[_0xf1b1('0x17')];this[_0xf1b1('0x18')]=_0x5184e5[_0xf1b1('0x18')];this[_0xf1b1('0x19')]=_0x5184e5[_0xf1b1('0x18')];this[_0xf1b1('0x1a')]=_0x5184e5[_0xf1b1('0x1a')]||0x0;this[_0xf1b1('0x1b')]=_0x5184e5[_0xf1b1('0x1b')]||0x0;this[_0xf1b1('0x1c')]=_0x5184e5['talktime']||0x0;this['callback']=_0x5184e5[_0xf1b1('0x1d')];this[_0xf1b1('0x1e')]=_0x5184e5[_0xf1b1('0x1e')];this[_0xf1b1('0x1f')]=_0x5184e5['callbackat'];this[_0xf1b1('0x20')]=_0x5184e5[_0xf1b1('0x20')];this[_0xf1b1('0x21')]=_0x5184e5[_0xf1b1('0x21')];this[_0xf1b1('0x22')]=_0x5184e5[_0xf1b1('0x22')];this['UserId']=_0x5184e5['UserId'];this[_0xf1b1('0x23')]=_0x5184e5[_0xf1b1('0x23')];this[_0xf1b1('0x24')]=_0x5184e5['CampaignId'];this[_0xf1b1('0x25')]=_0x5184e5[_0xf1b1('0x25')]||'';this[_0xf1b1('0x26')]=_0x5184e5['originatecalleridname']||'';}module[_0xf1b1('0x27')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 1881df8..3ecf0ee 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 _0xbbee=['membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','milliseconds','diff','seconds','state','Answer','scheduledat','campaigntype','type','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime'];(function(_0x551259,_0x1ffe2e){var _0x4974a9=function(_0x5d3aeb){while(--_0x5d3aeb){_0x551259['push'](_0x551259['shift']());}};_0x4974a9(++_0x1ffe2e);}(_0xbbee,0x91));var _0xebbe=function(_0x557297,_0x5dc297){_0x557297=_0x557297-0x0;var _0x1ca9f2=_0xbbee[_0x557297];return _0x1ca9f2;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xebbe('0x0'));function getSeconds(_0x521ba6,_0x1d9d21){var _0x44f271=moment(_0x521ba6)['milliseconds'](0x0);var _0x4ad4b5=moment(_0x1d9d21)[_0xebbe('0x1')](0x0);return _0x44f271[_0xebbe('0x2')](_0x4ad4b5,_0xebbe('0x3'));}function Hangup(_0x423354,_0x73b983){this[_0xebbe('0x4')]=0x4;this['statedesc']=_0xebbe('0x5');this[_0xebbe('0x6')]=_0x423354[_0xebbe('0x6')];this['type']=_0x423354['type'];this[_0xebbe('0x7')]=_0x423354[_0xebbe('0x8')]===_0xebbe('0x9')?_0xebbe('0xa'):_0x423354[_0xebbe('0x8')];this['countbusyretry']=_0x423354['countbusyretry'];this[_0xebbe('0xb')]=_0x423354[_0xebbe('0xb')];this[_0xebbe('0xc')]=_0x423354[_0xebbe('0xc')];this[_0xebbe('0xd')]=_0x423354[_0xebbe('0xe')]+_0x423354[_0xebbe('0xb')]+_0x423354[_0xebbe('0xc')]+_0x423354[_0xebbe('0xf')]+_0x423354[_0xebbe('0x10')]+_0x423354['countabandonedretry']+_0x423354[_0xebbe('0x11')]+_0x423354[_0xebbe('0x12')];this[_0xebbe('0xf')]=_0x423354[_0xebbe('0xf')];this[_0xebbe('0x10')]=_0x423354[_0xebbe('0x10')];this[_0xebbe('0x13')]=_0x423354[_0xebbe('0x13')];this['countmachineretry']=_0x423354[_0xebbe('0x11')];this['countagentrejectretry']=_0x423354[_0xebbe('0x12')];this['uniqueid']=_0x73b983[_0xebbe('0x14')];this[_0xebbe('0x15')]=_0x423354['name'];this[_0xebbe('0x16')]=_0x423354[_0xebbe('0x17')];this[_0xebbe('0x18')]=_0x423354[_0xebbe('0x18')];this[_0xebbe('0x19')]=_0x423354['responsetime'];this[_0xebbe('0x1a')]=moment()[_0xebbe('0x1b')](_0xebbe('0x1c'));this['ringtime']=getSeconds(_0x423354[_0xebbe('0x19')],_0x423354[_0xebbe('0x18')]);this[_0xebbe('0x1d')]=0x0;this[_0xebbe('0x1e')]=getSeconds(this[_0xebbe('0x1a')],_0x423354[_0xebbe('0x19')]);this[_0xebbe('0xa')]=_0x423354[_0xebbe('0xa')];this[_0xebbe('0x1f')]=_0xebbe('0x20');this[_0xebbe('0x21')]=_0x73b983[_0xebbe('0x22')];this['callback']=_0x423354[_0xebbe('0x23')];this[_0xebbe('0x24')]=_0x423354['callbackuniqueid'];this[_0xebbe('0x25')]=_0x423354[_0xebbe('0x25')];this[_0xebbe('0x26')]=_0x423354[_0xebbe('0x26')];this[_0xebbe('0x27')]=_0x423354[_0xebbe('0x27')];this[_0xebbe('0x28')]=_0x423354[_0xebbe('0x28')];this[_0xebbe('0x29')]=_0x423354['UserId'];this[_0xebbe('0x2a')]=_0x423354['VoiceQueueId'];this[_0xebbe('0x2b')]=_0x423354[_0xebbe('0x2b')];}module['exports']=Hangup; \ No newline at end of file +var _0x55f8=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','number','starttime','responsetime','endtime','format','ringtime','holdtime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','seconds','state','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x546033,_0x5b7e36){var _0x393c71=function(_0x1ad8f9){while(--_0x1ad8f9){_0x546033['push'](_0x546033['shift']());}};_0x393c71(++_0x5b7e36);}(_0x55f8,0x1e1));var _0x855f=function(_0x4e8b59,_0x2207ff){_0x4e8b59=_0x4e8b59-0x0;var _0x41de06=_0x55f8[_0x4e8b59];return _0x41de06;};'use strict';var util=require(_0x855f('0x0'));var _=require(_0x855f('0x1'));var moment=require(_0x855f('0x2'));function getSeconds(_0x18b6ef,_0x4132cd){var _0x2c7926=moment(_0x18b6ef)['milliseconds'](0x0);var _0x334641=moment(_0x4132cd)['milliseconds'](0x0);return _0x2c7926['diff'](_0x334641,_0x855f('0x3'));}function Hangup(_0x257d89,_0x1cbea5){this[_0x855f('0x4')]=0x4;this['statedesc']=_0x855f('0x5');this[_0x855f('0x6')]=_0x257d89[_0x855f('0x6')];this[_0x855f('0x7')]=_0x257d89[_0x855f('0x7')];this[_0x855f('0x8')]=_0x257d89[_0x855f('0x7')]==='outbound'?_0x855f('0x9'):_0x257d89[_0x855f('0x7')];this['countbusyretry']=_0x257d89[_0x855f('0xa')];this['countcongestionretry']=_0x257d89['countcongestionretry'];this[_0x855f('0xb')]=_0x257d89[_0x855f('0xb')];this['countglobal']=_0x257d89[_0x855f('0xa')]+_0x257d89['countcongestionretry']+_0x257d89['countnoanswerretry']+_0x257d89[_0x855f('0xc')]+_0x257d89[_0x855f('0xd')]+_0x257d89[_0x855f('0xe')]+_0x257d89[_0x855f('0xf')]+_0x257d89['countagentrejectretry'];this[_0x855f('0xc')]=_0x257d89[_0x855f('0xc')];this[_0x855f('0xd')]=_0x257d89[_0x855f('0xd')];this[_0x855f('0xe')]=_0x257d89['countabandonedretry'];this[_0x855f('0xf')]=_0x257d89[_0x855f('0xf')];this[_0x855f('0x10')]=_0x257d89[_0x855f('0x10')];this['uniqueid']=_0x1cbea5['uniqueid'];this[_0x855f('0x11')]=_0x257d89['name'];this['calleridnum']=_0x257d89[_0x855f('0x12')];this[_0x855f('0x13')]=_0x257d89[_0x855f('0x13')];this[_0x855f('0x14')]=_0x257d89[_0x855f('0x14')];this[_0x855f('0x15')]=moment()[_0x855f('0x16')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x855f('0x17')]=getSeconds(_0x257d89[_0x855f('0x14')],_0x257d89[_0x855f('0x13')]);this[_0x855f('0x18')]=0x0;this['talktime']=getSeconds(this[_0x855f('0x15')],_0x257d89[_0x855f('0x14')]);this[_0x855f('0x9')]=_0x257d89[_0x855f('0x9')];this[_0x855f('0x19')]=_0x855f('0x1a');this[_0x855f('0x1b')]=_0x1cbea5['cause-txt'];this[_0x855f('0x1c')]=_0x257d89[_0x855f('0x1c')];this[_0x855f('0x1d')]=_0x257d89[_0x855f('0x1d')];this[_0x855f('0x1e')]=_0x257d89[_0x855f('0x1e')];this[_0x855f('0x1f')]=_0x257d89[_0x855f('0x1f')];this['ContactId']=_0x257d89[_0x855f('0x20')];this[_0x855f('0x21')]=_0x257d89[_0x855f('0x21')];this[_0x855f('0x22')]=_0x257d89[_0x855f('0x22')];this[_0x855f('0x23')]=_0x257d89[_0x855f('0x23')];this[_0x855f('0x24')]=_0x257d89[_0x855f('0x24')];}module[_0x855f('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 022f1a8..16335fc 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 _0xbb97=['CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0xaa656e,_0x250a02){var _0x2b2d99=function(_0x56d72f){while(--_0x56d72f){_0xaa656e['push'](_0xaa656e['shift']());}};_0x2b2d99(++_0x250a02);}(_0xbb97,0xa8));var _0x7bb9=function(_0x1b3886,_0x1497de){_0x1b3886=_0x1b3886-0x0;var _0x420f0d=_0xbb97[_0x1b3886];return _0x420f0d;};'use strict';var util=require('util');var _=require(_0x7bb9('0x0'));var moment=require(_0x7bb9('0x1'));function getSeconds(_0x3edde0,_0x422832){var _0x273f1c=moment(_0x3edde0)[_0x7bb9('0x2')](0x0);var _0x4a6cfa=moment(_0x422832)['milliseconds'](0x0);return _0x273f1c[_0x7bb9('0x3')](_0x4a6cfa,_0x7bb9('0x4'));}function History(_0x82f4db){this[_0x7bb9('0x5')]=_0x82f4db['uniqueid'];this[_0x7bb9('0x6')]=_0x82f4db[_0x7bb9('0x6')]||undefined;this['type']=_0x82f4db[_0x7bb9('0x7')];this[_0x7bb9('0x8')]=_0x82f4db[_0x7bb9('0x7')]===_0x7bb9('0x9')?_0x7bb9('0xa'):_0x82f4db['type'];this['countbusyretry']=_0x82f4db[_0x7bb9('0xb')];this['countcongestionretry']=_0x82f4db[_0x7bb9('0xc')];this['countnoanswerretry']=_0x82f4db[_0x7bb9('0xd')];this[_0x7bb9('0xe')]=_0x82f4db['countbusyretry']+_0x82f4db[_0x7bb9('0xc')]+_0x82f4db[_0x7bb9('0xd')]+_0x82f4db[_0x7bb9('0xf')]+_0x82f4db[_0x7bb9('0x10')]+_0x82f4db[_0x7bb9('0x11')]+_0x82f4db[_0x7bb9('0x12')]+_0x82f4db[_0x7bb9('0x13')];this[_0x7bb9('0xf')]=_0x82f4db[_0x7bb9('0xf')];this['countdropretry']=_0x82f4db[_0x7bb9('0x10')];this[_0x7bb9('0x11')]=_0x82f4db[_0x7bb9('0x11')];this[_0x7bb9('0x12')]=_0x82f4db['countmachineretry'];this[_0x7bb9('0x13')]=_0x82f4db[_0x7bb9('0x13')];this[_0x7bb9('0xa')]=_0x82f4db[_0x7bb9('0xa')];this[_0x7bb9('0x14')]=_0x82f4db['name'];this[_0x7bb9('0x15')]=_0x82f4db[_0x7bb9('0x16')];this['starttime']=_0x82f4db[_0x7bb9('0x17')];this['responsetime']=_0x82f4db[_0x7bb9('0x18')];this[_0x7bb9('0x19')]=_0x82f4db[_0x7bb9('0x18')];this[_0x7bb9('0x1a')]=getSeconds(_0x82f4db[_0x7bb9('0x18')],_0x82f4db[_0x7bb9('0x17')]);this[_0x7bb9('0x1b')]=0x0;this[_0x7bb9('0x1c')]=0x0;this[_0x7bb9('0x1d')]=_0x82f4db[_0x7bb9('0x1d')];this[_0x7bb9('0x1e')]=_0x82f4db[_0x7bb9('0x1e')];this[_0x7bb9('0x1f')]=_0x82f4db[_0x7bb9('0x1f')];this['recallme']=_0x82f4db[_0x7bb9('0x20')];this[_0x7bb9('0x21')]=_0x82f4db[_0x7bb9('0x21')];this['ListId']=_0x82f4db[_0x7bb9('0x22')];this[_0x7bb9('0x23')]=_0x82f4db[_0x7bb9('0x23')];this[_0x7bb9('0x24')]=_0x82f4db[_0x7bb9('0x24')];this[_0x7bb9('0x25')]=_0x82f4db[_0x7bb9('0x25')];this[_0x7bb9('0x26')]=_0x82f4db[_0x7bb9('0x26')]||'';this[_0x7bb9('0x27')]=_0x82f4db[_0x7bb9('0x27')]||'';}module[_0x7bb9('0x28')]=History; \ No newline at end of file +var _0x5e67=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','type','campaigntype'];(function(_0x1bc762,_0x523eb3){var _0x40f70c=function(_0x3c206e){while(--_0x3c206e){_0x1bc762['push'](_0x1bc762['shift']());}};_0x40f70c(++_0x523eb3);}(_0x5e67,0x70));var _0x75e6=function(_0x36f6b3,_0xfc71a6){_0x36f6b3=_0x36f6b3-0x0;var _0x4983d3=_0x5e67[_0x36f6b3];return _0x4983d3;};'use strict';var util=require(_0x75e6('0x0'));var _=require(_0x75e6('0x1'));var moment=require(_0x75e6('0x2'));function getSeconds(_0x307d03,_0x2f7528){var _0x2d5d89=moment(_0x307d03)[_0x75e6('0x3')](0x0);var _0x2f3320=moment(_0x2f7528)[_0x75e6('0x3')](0x0);return _0x2d5d89[_0x75e6('0x4')](_0x2f3320,_0x75e6('0x5'));}function History(_0x172f8a){this['uniqueid']=_0x172f8a['uniqueid'];this['scheduledat']=_0x172f8a['scheduledat']||undefined;this[_0x75e6('0x6')]=_0x172f8a['type'];this[_0x75e6('0x7')]=_0x172f8a[_0x75e6('0x6')]===_0x75e6('0x8')?_0x75e6('0x9'):_0x172f8a['type'];this[_0x75e6('0xa')]=_0x172f8a[_0x75e6('0xa')];this[_0x75e6('0xb')]=_0x172f8a['countcongestionretry'];this['countnoanswerretry']=_0x172f8a[_0x75e6('0xc')];this[_0x75e6('0xd')]=_0x172f8a['countbusyretry']+_0x172f8a['countcongestionretry']+_0x172f8a[_0x75e6('0xc')]+_0x172f8a[_0x75e6('0xe')]+_0x172f8a[_0x75e6('0xf')]+_0x172f8a[_0x75e6('0x10')]+_0x172f8a[_0x75e6('0x11')]+_0x172f8a[_0x75e6('0x12')];this[_0x75e6('0xe')]=_0x172f8a[_0x75e6('0xe')];this['countdropretry']=_0x172f8a[_0x75e6('0xf')];this[_0x75e6('0x10')]=_0x172f8a[_0x75e6('0x10')];this[_0x75e6('0x11')]=_0x172f8a['countmachineretry'];this[_0x75e6('0x12')]=_0x172f8a[_0x75e6('0x12')];this['queue']=_0x172f8a['queue'];this[_0x75e6('0x13')]=_0x172f8a[_0x75e6('0x14')];this[_0x75e6('0x15')]=_0x172f8a[_0x75e6('0x16')];this[_0x75e6('0x17')]=_0x172f8a[_0x75e6('0x17')];this[_0x75e6('0x18')]=_0x172f8a['responsetime'];this[_0x75e6('0x19')]=_0x172f8a[_0x75e6('0x18')];this[_0x75e6('0x1a')]=getSeconds(_0x172f8a['responsetime'],_0x172f8a[_0x75e6('0x17')]);this[_0x75e6('0x1b')]=0x0;this['talktime']=0x0;this[_0x75e6('0x1c')]=_0x172f8a[_0x75e6('0x1c')];this['callbackuniqueid']=_0x172f8a[_0x75e6('0x1d')];this[_0x75e6('0x1e')]=_0x172f8a['callbackat'];this[_0x75e6('0x1f')]=_0x172f8a[_0x75e6('0x1f')];this[_0x75e6('0x20')]=_0x172f8a['ContactId'];this[_0x75e6('0x21')]=_0x172f8a[_0x75e6('0x21')];this[_0x75e6('0x22')]=_0x172f8a[_0x75e6('0x22')];this[_0x75e6('0x23')]=_0x172f8a[_0x75e6('0x23')];this[_0x75e6('0x24')]=_0x172f8a[_0x75e6('0x24')];this[_0x75e6('0x25')]=_0x172f8a[_0x75e6('0x25')]||'';this[_0x75e6('0x26')]=_0x172f8a[_0x75e6('0x26')]||'';}module[_0x75e6('0x27')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 3939cc9..c36259c 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 _0x93b1=['---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','error','inspect','length','hasOwnProperty','originated','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','state','starttime','clearZombieChannels','uniqueId','[actions]','isNil','Action','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','countReScheduled','resolve','then','checkIsBlackList','catch','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','rescheduleContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','notFound','merge','pick','UserId','CampaignId','[emptyContact]','Success','isTrunkReachable','active','SIP/%s','reachable','unmonitored','saveInDb','syncVarSet','uniqueid','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','statedesc','HangupInAMD','[syncHangupInAMD][createHistory]','MACHINE','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','AMD','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','ContactId','ListId','VoiceQueueId','[rescheduleContact][Machine]','HANGUP','membername','[syncHangupInAMDIvr]','Machine','countagentrejectretry','dialMachineMaxRetry','minutes','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','cause-txt','Unknow','syncAgentComplete','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','droptime','YYYY-MM-DD\x20HH:mm:ss','responsetime','Drop','dropreason','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','endtime','calleridname','calleridnum','CALLEREXIT','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','queueBooked','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','dialPowerLevel','booked','Queue','launchHandleIvr','loggedIn','dialGlobalInterval','checkIfTimeIntervals','dialTimezone','[syncQueueSummary]','checkIsTrunkReachable','[syncCampaigns]','\x5cw{0,','replace','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','Contact','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','dialQueueOptions','dialQueueTimeout','NONE','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','tags','createdAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','dialCutDigit','trim','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','getQueue','isSuccess','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialGlobalMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','custom:agentnosuchnumber','buildObj','nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','Global','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','busyFactor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','log','Contact\x20updated','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','inBlackList','handleIvr','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','emptyContact','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','not_inuse','[actionOriginate]\x20','[getContactDialer2]','dialLimitQueue','tryOriginatePredictive','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','Ts\x20=\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','redis','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','rrmemory','roundrobin','prototype','tail','finally','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','syncHangup','newexten','syncNewExten','varset','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','message','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','milliseconds','diff','seconds','emit','outbound','strategy','answered','pTalking','sumBillable','sumHoldTime','talking','total','type','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangAbandonmentRate','Trunk','callerid','stringify','format','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'];(function(_0x16e016,_0x98a546){var _0x45644d=function(_0x35df0f){while(--_0x35df0f){_0x16e016['push'](_0x16e016['shift']());}};_0x45644d(++_0x98a546);}(_0x93b1,0x196));var _0x193b=function(_0xb35ffd,_0x3541fb){_0xb35ffd=_0xb35ffd-0x0;var _0x51499a=_0x93b1[_0xb35ffd];return _0x51499a;};'use strict';var util=require('util');var _=require(_0x193b('0x0'));var BPromise=require(_0x193b('0x1'));var uuid=require(_0x193b('0x2'));var moment=require(_0x193b('0x3'));var rr=require('rr');var md5=require(_0x193b('0x4'));var Redis=require(_0x193b('0x5'));var ut=require(_0x193b('0x6'));var config=require(_0x193b('0x7'));var logger=require(_0x193b('0x8'))(_0x193b('0x9'));var loggerBooked=require(_0x193b('0x8'))('booked');var loggerPredictive=require(_0x193b('0x8'))(_0x193b('0xa'));var loggerPredictiveCalls=require(_0x193b('0x8'))(_0x193b('0xb'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x193b('0xc'));var ami=require('../ami');config[_0x193b('0xd')]=_['defaults'](config[_0x193b('0xd')],{'host':'localhost','port':0x18eb});var io=require(_0x193b('0xe'))(new Redis(config[_0x193b('0xd')]));var cmHopper=require(_0x193b('0xf'));var cmHopperFinal=require(_0x193b('0x10'));var cmHopperHistory=require(_0x193b('0x11'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x193b('0x12'));var Action=require('./action');var History=require(_0x193b('0x13'));var Final=require(_0x193b('0x14'));var AgentComplete=require(_0x193b('0x15'));var QueueCallerAbandon=require(_0x193b('0x16'));var Hangup=require(_0x193b('0x17'));var ipAgi=process[_0x193b('0x18')]['XCALLY_IP_AGI']||'127.0.0.1';var strategy={'rrmemory':_0x193b('0x19'),'roundrobin':_0x193b('0x1a')};var Sequence=function(){};Sequence[_0x193b('0x1b')]['enqueue']=function(_0x328a25){this['tail']=this[_0x193b('0x1c')]?this[_0x193b('0x1c')][_0x193b('0x1d')](_0x328a25):_0x328a25();};function Dialer(_0x14dddb,_0x5ece01){this['sequence']=new Sequence();this['preview']=_0x5ece01;this[_0x193b('0x1e')]=_0x14dddb['voiceQueues'];this[_0x193b('0x1f')]=_0x14dddb['campaigns'];this[_0x193b('0x20')]=_0x14dddb['agents'];this['trunks']=_0x14dddb[_0x193b('0x21')];this[_0x193b('0x22')]=config[_0x193b('0x22')]||0x2;this['channels']={};this[_0x193b('0x23')]={};this[_0x193b('0x24')]={};this['uniqueId']={};this[_0x193b('0x25')]={};this[_0x193b('0x26')]={};this[_0x193b('0x27')]={};this[_0x193b('0x28')]={};this['queueBooked']={};this[_0x193b('0x29')]={};ami['on'](_0x193b('0x2a'),this[_0x193b('0x2b')][_0x193b('0x2c')](this));ami['on'](_0x193b('0x2d'),this[_0x193b('0x2e')][_0x193b('0x2c')](this));ami['on'](_0x193b('0x2f'),this[_0x193b('0x30')][_0x193b('0x2c')](this));ami['on'](_0x193b('0x31'),this['syncAgentComplete'][_0x193b('0x2c')](this));ami['on'](_0x193b('0x32'),this[_0x193b('0xc')][_0x193b('0x2c')](this));ami['on']('hangup',this[_0x193b('0x33')]['bind'](this));ami['on'](_0x193b('0x34'),this[_0x193b('0x35')][_0x193b('0x2c')](this));ami['on'](_0x193b('0x36'),this['syncVarSet']['bind'](this));ami['on'](_0x193b('0x37'),this[_0x193b('0x38')][_0x193b('0x2c')](this));ami['on']('queuestatuscomplete',this[_0x193b('0x39')][_0x193b('0x2c')](this));this[_0x193b('0x3a')]();this[_0x193b('0x3b')]();}function isNotNull(_0x562460){return _0x562460!==null&&!_['isUndefined'](_0x562460);}function checkIsLoggedIn(_0x591fa7,_0x2224d1){return function(){if(_0x2224d1<=0x0){_0x591fa7[_0x193b('0x3c')]='AGENTS_NOT_LOGGED';throw _0x591fa7['name']+_0x193b('0x3d');}};}function isActive(_0x214a40){return _0x214a40;}function checkIsActive(_0x1de4cc,_0x4bb806){return function(){if(!isActive(_0x4bb806)){_0x1de4cc[_0x193b('0x3c')]=_0x193b('0x3e');throw _0x1de4cc[_0x193b('0x3f')]+_0x193b('0x40');}};}function checkInterval(_0x11f677){return function(){if(!isNotNull(_0x11f677[_0x193b('0x41')])){_0x11f677[_0x193b('0x3c')]=_0x193b('0x42');throw _0x11f677[_0x193b('0x3f')]+_0x193b('0x43');}if(!isNotNull(_0x11f677[_0x193b('0x41')][_0x193b('0x44')])){_0x11f677[_0x193b('0x3c')]='INTERVAL_IS_NULL';throw _0x11f677[_0x193b('0x3f')]+_0x193b('0x43');}if(!isNotNull(_[_0x193b('0x45')](_0x11f677[_0x193b('0x41')]['Intervals']))){_0x11f677[_0x193b('0x3c')]=_0x193b('0x42');throw _0x11f677['name']+_0x193b('0x43');}};}function msgResponse(_0x17ef60,_0x5d86e5,_0x87ea17){return{'action':_0x17ef60,'response':_0x5d86e5,'message':_0x87ea17,'stack':_0x87ea17};}function myreject(_0x51b172){return function(_0x9b2cde){return _0x51b172(msgResponse(_0x193b('0x46'),_0x193b('0x47'),JSON['stringify'](_0x9b2cde)));};}function getSeconds(_0xd130d2,_0x22179d){var _0x3aa9ae=moment(_0xd130d2)[_0x193b('0x48')](0x0);var _0x202f39=moment(_0x22179d)[_0x193b('0x48')](0x0);return _0x3aa9ae[_0x193b('0x49')](_0x202f39,_0x193b('0x4a'));}function emit(_0x493199,_0xbb2b7f,_0xf72aed){io['to'](_0x493199)[_0x193b('0x4b')](_0xbb2b7f,_0xf72aed);}function emitVoiceQueueSummary(_0x564e14){if(_0x564e14['type']===_0x193b('0x4c')){var _0x2026d6={'id':_0x564e14['id'],'name':_0x564e14[_0x193b('0x3f')],'strategy':_0x564e14[_0x193b('0x4d')],'answered':_0x564e14[_0x193b('0x4e')],'available':_0x564e14['available'],'loggedIn':_0x564e14['loggedIn'],'pTalking':_0x564e14[_0x193b('0x4f')],'sumBillable':_0x564e14[_0x193b('0x50')],'sumDuration':_0x564e14['sumDuration'],'sumHoldTime':_0x564e14[_0x193b('0x51')]||0x0,'talking':_0x564e14[_0x193b('0x52')],'total':_0x564e14[_0x193b('0x53')],'type':_0x564e14[_0x193b('0x54')],'unmanaged':_0x564e14['unmanaged'],'abandoned':_0x564e14[_0x193b('0x55')],'waiting':_0x564e14[_0x193b('0x56')],'loggedInDb':_0x564e14[_0x193b('0x57')],'dialActive':_0x564e14[_0x193b('0x58')],'dialMethod':_0x564e14[_0x193b('0x59')],'dialOriginateCallerIdName':_0x564e14[_0x193b('0x5a')],'dialOriginateCallerIdNumber':_0x564e14['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x564e14[_0x193b('0x5b')],'dialPrefix':_0x564e14[_0x193b('0x5c')],'outboundAnswerAgiCallsDay':_0x564e14['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x564e14['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x564e14[_0x193b('0x5d')],'outboundBusyCallsDay':_0x564e14[_0x193b('0x5e')],'outboundCongestionCallsDay':_0x564e14[_0x193b('0x5f')],'outboundDropCallsDayACS':_0x564e14[_0x193b('0x60')],'outboundDropCallsDayCallersExit':_0x564e14[_0x193b('0x61')],'outboundDropCallsDayTimeout':_0x564e14[_0x193b('0x62')],'outboundNoAnswerCallsDay':_0x564e14[_0x193b('0x63')],'outboundNoSuchCallsDay':_0x564e14[_0x193b('0x64')],'outboundOriginateFailureCallsDay':_0x564e14[_0x193b('0x65')],'outboundReCallsDay':_0x564e14['outboundReCallsDay'],'outboundRejectCallsDay':_0x564e14[_0x193b('0x66')],'outboundUnknownCallsDay':_0x564e14['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x564e14[_0x193b('0x67')],'predictiveIntervalAvgHoldtime':_0x564e14['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x564e14[_0x193b('0x68')],'predictiveIntervalDroppedCallsCallersExit':_0x564e14[_0x193b('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x564e14[_0x193b('0x6a')],'predictiveIntervalErlangCalls':_0x564e14[_0x193b('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0x564e14[_0x193b('0x6c')],'predictiveIntervalHitRate':_0x564e14[_0x193b('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x564e14[_0x193b('0x6e')],'predictiveIntervalPauses':_0x564e14['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x564e14[_0x193b('0x6f')],'predictiveIntervalTotalCalls':_0x564e14[_0x193b('0x70')],'message':_0x564e14[_0x193b('0x3c')],'originated':_0x564e14['originated'],'erlangCalls':_0x564e14[_0x193b('0x71')],'erlangCallToSecond':_0x564e14['erlangCallToSecond'],'erlangAbandonmentRate':_0x564e14[_0x193b('0x72')],'erlangBusyFactor':_0x564e14['erlangBusyFactor'],'startPredictive':_0x564e14[_0x193b('0x26')],'startProgressive':_0x564e14[_0x193b('0x27')]};if(_0x564e14[_0x193b('0x73')]){_0x2026d6['Trunk']={'id':_0x564e14[_0x193b('0x73')]['id'],'name':_0x564e14['Trunk']['name'],'active':_0x564e14[_0x193b('0x73')]['active'],'callerid':_0x564e14[_0x193b('0x73')][_0x193b('0x74')]};}if(_0x564e14[_0x193b('0x41')]){_0x2026d6[_0x193b('0x41')]={'id':_0x564e14[_0x193b('0x41')]['id'],'name':_0x564e14[_0x193b('0x41')][_0x193b('0x3f')]};}var _0x359d48=md5(JSON[_0x193b('0x75')](_0x2026d6));if(_0x564e14[_0x193b('0x4')]!==_0x359d48){_0x564e14[_0x193b('0x4')]=_0x359d48;emit(util[_0x193b('0x76')]('voice:queue:%s',_0x2026d6[_0x193b('0x3f')]),_0x193b('0x77'),_0x2026d6);}}}function emitCampaignSummary(_0x31bc0d){if(_0x31bc0d[_0x193b('0x54')]===_0x193b('0x78')){emit(util[_0x193b('0x76')](_0x193b('0x79'),_0x31bc0d[_0x193b('0x3f')]),_0x193b('0x7a'),_0x31bc0d);}}function checkGetDataPredictive(_0x2dfe9b){if(isNotNull(_0x2dfe9b)){if(!_[_0x193b('0x45')](_0x2dfe9b)){loggerPredictive[_0x193b('0x7b')](_0x193b('0x7c'));loggerPredictive[_0x193b('0x7b')](_0x193b('0x7d'),_0x2dfe9b[_0x193b('0x70')]);loggerPredictive[_0x193b('0x7b')](_0x193b('0x7e'),_0x2dfe9b[_0x193b('0x67')]);loggerPredictive[_0x193b('0x7b')](_0x193b('0x7f'),_0x2dfe9b['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x193b('0x7b')](_0x193b('0x80'),_0x2dfe9b[_0x193b('0x69')]);loggerPredictive[_0x193b('0x7b')](_0x193b('0x81'),_0x2dfe9b[_0x193b('0x82')]);loggerPredictive[_0x193b('0x7b')](_0x193b('0x83'),_0x2dfe9b[_0x193b('0x68')]);loggerPredictive['info'](_0x193b('0x84'));if(_0x2dfe9b[_0x193b('0x70')]>0x0){if(!_[_0x193b('0x85')](_0x2dfe9b[_0x193b('0x68')])&&_0x2dfe9b[_0x193b('0x68')]>0x0){return!![];}else{loggerPredictive[_0x193b('0x7b')](_0x193b('0x86'));}if(!_[_0x193b('0x85')](_0x2dfe9b[_0x193b('0x82')])&&_0x2dfe9b[_0x193b('0x82')]>0x0){return!![];}else{loggerPredictive['info'](_0x193b('0x87'));}}else{loggerPredictive[_0x193b('0x7b')](_0x193b('0x88'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}}else{loggerPredictive[_0x193b('0x7b')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x4bf971){return function(_0x400302){loggerPredictive['info'](_0x193b('0x89'));loggerPredictive[_0x193b('0x7b')](_0x193b('0x8a'),_0x400302[_0x193b('0x71')]);loggerPredictive[_0x193b('0x7b')](_0x193b('0x8b'),_0x400302[_0x193b('0x8c')]);loggerPredictive[_0x193b('0x7b')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x400302[_0x193b('0x72')]);loggerPredictive[_0x193b('0x7b')](_0x193b('0x8d'),_0x400302[_0x193b('0x8e')]);loggerPredictive[_0x193b('0x7b')](_0x193b('0x8f'),_0x400302[_0x193b('0x72')]);loggerPredictive['info'](_0x193b('0x84'));_['merge'](_0x4bf971,_0x400302);};}function getDiff(_0x1af14f){var _0x11135f=moment()['milliseconds'](0x0);var _0x44c1ee=moment(_0x1af14f)[_0x193b('0x48')](0x0);return _0x11135f[_0x193b('0x49')](_0x44c1ee,_0x193b('0x4a'));}function ifInterval(_0x26f4c2,_0x2d9017){if(_[_0x193b('0x85')](_0x2d9017)){return![];}if(getDiff(_0x2d9017)<_0x26f4c2*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x2eaf4c){if(isNotNull(_0x2eaf4c)){if(!_['isUndefined'](_0x2eaf4c[_0x193b('0x27')])){_0x2eaf4c[_0x193b('0x27')]=undefined;loggerPredictive[_0x193b('0x7b')](_0x2eaf4c[_0x193b('0x3f')],_0x193b('0x90'));}if(!_['isUndefined'](_0x2eaf4c['startPredictive'])){_0x2eaf4c[_0x193b('0x26')]=undefined;loggerPredictive[_0x193b('0x7b')](_0x2eaf4c[_0x193b('0x3f')],_0x193b('0x91'));}if(!_[_0x193b('0x85')](_0x2eaf4c[_0x193b('0x92')])){clearInterval(_0x2eaf4c[_0x193b('0x92')]);_0x2eaf4c['handlePredictive']=undefined;loggerPredictive[_0x193b('0x7b')](_0x2eaf4c[_0x193b('0x3f')],_0x193b('0x93'));}}}function erlangb(_0x577dec,_0x1144c9){if(_0x1144c9===0x0){return 0x0;}var _0x1df777=0x1;for(var _0x1a48d7=0x1;_0x1a48d7<=_0x1144c9;_0x1a48d7+=0x1){_0x1df777=0x1+_0x1df777*_0x1a48d7/_0x577dec;}return 0x1/_0x1df777;}function isVoiceQueueOutbound(_0x2e7060){return _0x2e7060===_0x193b('0x4c');}function isNotPreview(_0x1d4262){return _0x1d4262!==_0x193b('0x94');}function isCampaignIvr(_0x15527d){return _0x15527d===_0x193b('0x78');}function getCallerId(_0x59362c,_0x5c8ddb,_0x5c702a){if(!_[_0x193b('0x85')](_0x5c702a)&&'string'===typeof _0x5c702a&&!_['isEmpty'](_0x5c702a)){if(!_[_0x193b('0x85')](_0x5c8ddb)&&'string'===typeof _0x5c8ddb&&!_[_0x193b('0x45')](_0x5c8ddb)){return util[_0x193b('0x76')](_0x193b('0x95'),_0x5c8ddb,_0x5c702a);}return util[_0x193b('0x76')](_0x193b('0x95'),_0x5c702a,_0x5c702a);}if(!_[_0x193b('0x85')](_0x59362c)&&_0x193b('0x96')===typeof _0x59362c&&!_[_0x193b('0x45')](_0x59362c)){return _0x59362c;}return _0x193b('0x97');}function loggerCatchQueueSummary(_0xc73a78,_0x1232c3){return function(_0x2582ff){freeVariablesPredictive(_0x1232c3);emitVoiceQueueSummary(_0x1232c3);emitCampaignSummary(_0x1232c3);loggerSyncQueueSummary[_0x193b('0x98')](_0xc73a78,util['inspect'](_0x2582ff,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5d3264,_0x670426){return function(_0x1e222c){loggerPredictive['error'](_0x670426['name'],_0x5d3264);loggerPredictive[_0x193b('0x98')](_0x1e222c['stack']);freeVariablesPredictive(_0x670426);};}function loggerCatch(_0x2ca547){return function(_0x3d4213){logger[_0x193b('0x98')](_0x2ca547,util[_0x193b('0x99')](_0x3d4213,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2cda5c){return _0x2cda5c&&!_[_0x193b('0x85')](_0x2cda5c)&&_0x2cda5c[_0x193b('0x9a')]>0x0;}function decremetOriginate(_0x50c1cc){if(!_[_0x193b('0x85')](_0x50c1cc)&&_0x50c1cc!==null){if(_0x50c1cc[_0x193b('0x9b')]('originated')){if(_0x50c1cc[_0x193b('0x9c')]>0x0){_0x50c1cc[_0x193b('0x9c')]-=0x1;}else{logger[_0x193b('0x98')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x193b('0x98')](_0x193b('0x9d'));}}function checkContactLowerLimitOriginate(_0x22740d,_0x2523da,_0x5d87a4){if(_0x2523da>_0x5d87a4){for(var _0x545968=0x0;_0x545968<_0x2523da-_0x5d87a4;_0x545968+=0x1){decremetOriginate(_0x22740d);}}}function loggerGetContactDialer(_0x1d2aeb,_0x85cd04,_0x488666){return function(_0xfe6f03){checkContactLowerLimitOriginate(_0x85cd04,_0x488666,0x0);logger[_0x193b('0x98')](_0x1d2aeb,util[_0x193b('0x99')](_0xfe6f03,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5d4ca7){return function(_0xcff865){if(isNotNull(_0xcff865)&&isNotNull(_0xcff865[0x0])){if(_0xcff865[0x0]['contactsRescheduled']>0x0){_0x5d4ca7[_0x193b('0x3c')]='RESCHEDULED_CONTACTS';logger[_0x193b('0x7b')]('[getContactDialer2][ReScheduled]'+_0x5d4ca7[_0x193b('0x3f')],_0xcff865[0x0][_0x193b('0x9e')],'contacts');}else{_0x5d4ca7[_0x193b('0x3c')]=_0x193b('0x9f');logger[_0x193b('0x7b')](_0x193b('0xa0')+_0x5d4ca7['name']);}}};}function notSendMessagesQueue(_0x3b8af2){if(_0x3b8af2['sendMessageOneNotActive']){freeVariablesPredictive(_0x3b8af2);if(_0x3b8af2[_0x193b('0x9c')]===0x0&&_0x3b8af2[_0x193b('0x52')]===0x0&&_0x3b8af2[_0x193b('0x56')]===0x0&&(_0x3b8af2[_0x193b('0x4f')]||0x0)===0x0){_0x3b8af2[_0x193b('0xa1')]=![];_0x3b8af2[_0x193b('0xa2')]=0x0;_0x3b8af2[_0x193b('0x3c')]=_0x193b('0x3e');loggerSyncQueueSummary[_0x193b('0x98')](_0x193b('0xa3'),_0x3b8af2[_0x193b('0x3f')],'is\x20not\x20active');}else{_0x3b8af2['message']='IS_DISACTIVED';loggerSyncQueueSummary[_0x193b('0x98')](_0x193b('0xa3'),_0x3b8af2[_0x193b('0x3f')],'is\x20disactive');}emitVoiceQueueSummary(_0x3b8af2);}}function notSendMessagesCampaign(_0x382031){if(_0x382031['sendMessageOneNotActive']){if(_0x382031[_0x193b('0x9c')]===0x0){_0x382031[_0x193b('0xa1')]=![];_0x382031['message']=_0x193b('0x3e');loggerSyncQueueSummary[_0x193b('0x98')](_0x193b('0xa4'),_0x382031[_0x193b('0x3f')],_0x193b('0xa5'));}else{_0x382031['message']=_0x193b('0xa6');loggerSyncQueueSummary[_0x193b('0x98')](_0x193b('0xa4'),_0x382031[_0x193b('0x3f')],_0x193b('0xa7'));}emitCampaignSummary(_0x382031);}}function createObjHistory(_0x37f158,_0x524c63,_0x118884,_0x4053d8,_0x40c41c){_0x37f158[_0x193b('0x3c')]=_0x118884;var _0x4d8c93=new Action(_0x37f158,_0x524c63);var _0x45adc8=new History(_0x4d8c93);_0x45adc8[_0x193b('0xa8')]=_0x4053d8;_0x45adc8['statedesc']=_0x40c41c;_0x45adc8['endtime']=_0x4d8c93[_0x193b('0xa9')];return _0x45adc8;}Dialer[_0x193b('0x1b')]['loopClearZombieChannels']=function(){var _0x294e0e=this;setInterval(function(){_0x294e0e[_0x193b('0xaa')](_0x294e0e[_0x193b('0xab')],'[uniqueid]');_0x294e0e[_0x193b('0xaa')](_0x294e0e['actions'],_0x193b('0xac'));},0x32c8);};Dialer[_0x193b('0x1b')]['clearZombieChannels']=function(_0x1b5b48,_0x1afa49){var _0x1e1ce3=this;for(var _0x225569 in _0x1b5b48){if(_0x1b5b48['hasOwnProperty'](_0x225569)){this['sequence']['enqueue'](function(){if(!_[_0x193b('0xad')](_0x1b5b48[_0x225569])){return ami[_0x193b('0xae')]({'action':_0x193b('0xaf'),'channel':_0x1b5b48[_0x225569][_0x193b('0xb0')]})['catch'](function(_0x3bea87){if(_0x3bea87[_0x193b('0x3c')]===_0x193b('0xb1')){setTimeout(function(){if(_0x1b5b48[_0x225569]&&_0x1b5b48[_0x225569][_0x193b('0x54')]!==_0x193b('0x78')){_0x1e1ce3[_0x193b('0xb2')](_0x1e1ce3[_0x193b('0x1e')][_0x1b5b48[_0x225569][_0x193b('0xb3')]]);logger['error'](_0x193b('0xb4'),_0x1afa49,_0x225569,_0x1b5b48[_0x225569]['queue']);delete _0x1b5b48[_0x225569];}if(_0x1b5b48[_0x225569]&&_0x1b5b48[_0x225569][_0x193b('0x54')]===_0x193b('0x78')){_0x1e1ce3['updateOriginated'](_0x1e1ce3[_0x193b('0x1f')][_0x1b5b48[_0x225569][_0x193b('0xb3')]]);logger[_0x193b('0x98')]('[Dialer][checkChannel][ivr]',_0x1afa49,_0x225569,_0x1b5b48[_0x225569][_0x193b('0xb3')]);delete _0x1b5b48[_0x225569];}},0x2328);}});}});}}};Dialer['prototype'][_0x193b('0xb5')]=function(_0x2a9fd7){return BPromise[_0x193b('0xb6')]()[_0x193b('0xb7')](cmHopper[_0x193b('0xb5')](_0x2a9fd7))['catch'](loggerCatch('[countReScheduled]\x20'));};Dialer['prototype'][_0x193b('0xb8')]=function(_0x823aff){return BPromise[_0x193b('0xb6')]()['then'](cmHopperBlack[_0x193b('0xb8')](_0x823aff))[_0x193b('0xb9')](loggerCatch(_0x193b('0xba')));};Dialer[_0x193b('0x1b')][_0x193b('0xbb')]=function(_0x2a74a2){return BPromise[_0x193b('0xb6')]()['then'](cmHopperBlack[_0x193b('0xbb')](_0x2a74a2))[_0x193b('0xb9')](loggerCatch(_0x193b('0xbc')));};Dialer[_0x193b('0x1b')][_0x193b('0xbd')]=function(_0x5ec0d4){return BPromise[_0x193b('0xb6')]()['then'](cmHopperHistory[_0x193b('0xbe')](_0x5ec0d4))['catch'](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0x193b('0x1b')][_0x193b('0xbf')]=function(_0xd6e00c){return BPromise[_0x193b('0xb6')]()[_0x193b('0xb7')](cmHopper['rescheduleContact'](_0xd6e00c))[_0x193b('0xb9')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x193b('0x1b')]['unlockContact']=function(_0x421f54,_0x3d8dfd,_0x3c4d06){return BPromise[_0x193b('0xb6')]()[_0x193b('0xb7')](cmHopper['unlockContact'](_0x421f54,_0x3d8dfd,_0x3c4d06))[_0x193b('0xb9')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x193b('0x1b')][_0x193b('0xc0')]=function(_0x230281,_0x610c39,_0x5c0670,_0x5d8a4d){return BPromise['resolve']()[_0x193b('0xb7')](cmHopper[_0x193b('0xc0')](_0x230281,_0x610c39,_0x5c0670,_0x5d8a4d))[_0x193b('0xb9')](loggerCatch(_0x193b('0xc1')));};Dialer[_0x193b('0x1b')][_0x193b('0xc2')]=function(_0x35b2e8,_0x124c6c,_0x2f2720){return BPromise[_0x193b('0xb6')]()['then'](cmHopper['getContactDialerIvr'](_0x35b2e8,_0x124c6c,_0x2f2720))[_0x193b('0xb9')](loggerCatch(_0x193b('0xc1')));};Dialer[_0x193b('0x1b')]['getVoiceQueueRtPauses']=function(_0x511626){return BPromise['resolve']()['then'](voiceQueueRt[_0x193b('0xc3')](_0x511626))[_0x193b('0xb9')](loggerCatch(_0x193b('0xc4')));};Dialer['prototype'][_0x193b('0xc5')]=function(_0x3cd3be){return BPromise[_0x193b('0xb6')]()[_0x193b('0xb7')](cmHopper[_0x193b('0xc5')](_0x3cd3be))[_0x193b('0xb9')](loggerCatch(_0x193b('0xc6')));};Dialer[_0x193b('0x1b')][_0x193b('0xc7')]=function(_0x1ff670){return BPromise[_0x193b('0xb6')]()[_0x193b('0xb7')](cmHopperHistory['createHistory'](_0x1ff670))[_0x193b('0xb9')](loggerCatch(_0x193b('0xc8')));};Dialer[_0x193b('0x1b')][_0x193b('0xb2')]=function(_0x2fdb6e){if(!_['isUndefined'](_0x2fdb6e)&&_0x2fdb6e!==null){if(_0x2fdb6e[_0x193b('0x9b')](_0x193b('0x9c'))){if(_0x2fdb6e[_0x193b('0x9c')]>0x0){_0x2fdb6e['originated']-=0x1;}else{logger['error'](_0x193b('0xc9'));}}}else{logger[_0x193b('0x98')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer['prototype'][_0x193b('0xca')]=function(_0x3cef2b,_0x20aed3){var _0x5ab3a6=this;return function(_0x244f96){_0x5ab3a6[_0x193b('0xb2')](_0x20aed3);logger[_0x193b('0x98')](_0x3cef2b,util[_0x193b('0x99')](_0x244f96,{'showHidden':![],'depth':null}));};};Dialer[_0x193b('0x1b')]['emptyContact']=function(_0x2e3863,_0x35b92d,_0x2c9f02){var _0x664684={'state':0x19,'statedesc':_0x193b('0xcb')};this[_0x193b('0xb2')](_0x35b92d);this['saveInDb'](_[_0x193b('0xcc')](_0x664684,_[_0x193b('0xcd')](_0x2c9f02,['ContactId','ListId',_0x193b('0xce'),'VoiceQueueId',_0x193b('0xcf')])),'[emptyContact][createHistory]',_0x193b('0xd0'));logger[_0x193b('0x98')](_0x2e3863);};Dialer[_0x193b('0x1b')]['isSuccess']=function(_0x202924){return _0x202924===_0x193b('0xd1');};Dialer['prototype'][_0x193b('0xd2')]=function(_0x4981b4){return!_[_0x193b('0x85')](_0x4981b4)&&_0x4981b4&&!_['isUndefined'](_0x4981b4['name'])&&!_[_0x193b('0x85')](_0x4981b4[_0x193b('0xd3')])&&_0x4981b4[_0x193b('0xd3')]&&(this['trunks'][util['format'](_0x193b('0xd4'),_0x4981b4['name'])][_0x193b('0xaf')]===_0x193b('0xd5')||this['trunks'][util[_0x193b('0x76')](_0x193b('0xd4'),_0x4981b4['name'])][_0x193b('0xaf')]===_0x193b('0xd6'));};Dialer[_0x193b('0x1b')][_0x193b('0xd7')]=function(_0x24645e,_0x4bfbb7,_0x24a657){this[_0x193b('0xc7')](_0x24645e)[_0x193b('0xb9')](loggerCatch(_0x4bfbb7));this[_0x193b('0xc5')](_0x24645e)[_0x193b('0xb9')](loggerCatch(_0x24a657));};Dialer[_0x193b('0x1b')][_0x193b('0xd8')]=function(_0x1b4adf){var _0x4e889f=this['uniqueId'][_0x1b4adf[_0x193b('0xd9')]];var _0x16c6bf;if(!_['isNil'](_0x1b4adf)&&!_[_0x193b('0xad')](_0x1b4adf[_0x193b('0xda')])&&!_['isNil'](_0x1b4adf[_0x193b('0xda')][_0x193b('0xdb')])&&_0x1b4adf['exten']===_0x193b('0xdc')&&_0x4e889f){if(_0x4e889f[_0x193b('0x54')]!==_0x193b('0x78')&&this[_0x193b('0x1e')][_0x4e889f[_0x193b('0xb3')]][_0x193b('0xdd')]&&_0x1b4adf[_0x193b('0xde')]==='HANGUP'){delete this[_0x193b('0xab')][_0x1b4adf[_0x193b('0xd9')]];this[_0x193b('0xb2')](this['voiceQueues'][_0x4e889f['queue']]);this[_0x193b('0x1e')][_0x4e889f[_0x193b('0xb3')]]['outboundAnswerCallsDay']+=0x1;this[_0x193b('0x1e')][_0x4e889f[_0x193b('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;_0x16c6bf=new Hangup(_0x4e889f,_0x1b4adf);_0x16c6bf[_0x193b('0xa8')]=0x12;_0x16c6bf[_0x193b('0xdf')]=_0x193b('0xe0');_0x16c6bf['membername']='AMD';this['saveInDb'](_0x16c6bf,_0x193b('0xe1'),'[syncHangupInAMD]');}if(_0x4e889f['type']!==_0x193b('0x78')&&this[_0x193b('0x1e')][_0x4e889f['queue']][_0x193b('0xdd')]&&_0x1b4adf['value']===_0x193b('0xe2')){var _0x59b8ad=this;return new BPromise(function(_0x388e07,_0x5806aa){delete _0x59b8ad['uniqueId'][_0x1b4adf['uniqueid']];_0x59b8ad[_0x193b('0xb2')](_0x59b8ad[_0x193b('0x1e')][_0x4e889f['queue']]);_0x59b8ad[_0x193b('0x1e')][_0x4e889f[_0x193b('0xb3')]][_0x193b('0xe3')]+=0x1;_0x59b8ad[_0x193b('0x1e')][_0x4e889f[_0x193b('0xb3')]][_0x193b('0xe4')]+=0x1;var _0xadc8b9=_0x59b8ad[_0x193b('0x1e')][_0x4e889f[_0x193b('0xb3')]];var _0x652435=new Hangup(_0x4e889f,_0x1b4adf);_0x652435[_0x193b('0xa8')]=0x13;_0x652435['statedesc']='Machine';_0x652435['membername']=_0x193b('0xe5');_0x652435[_0x193b('0xe6')]+=0x1;_0x652435[_0x193b('0xe7')]+=0x1;_0x652435[_0x193b('0xe8')]=!![];_0x59b8ad['createHistory'](_0x652435)[_0x193b('0xb9')](loggerCatch(_0x193b('0xe9')));if(_0x652435[_0x193b('0xea')]+_0x652435[_0x193b('0xeb')]+_0x652435[_0x193b('0xec')]+_0x652435[_0x193b('0xed')]+_0x652435[_0x193b('0xee')]+_0x652435[_0x193b('0xef')]+_0x652435[_0x193b('0xe6')]+_0x652435['countagentrejectretry']>=_0xadc8b9['dialGlobalMaxRetry']){_0x59b8ad[_0x193b('0xf0')](_0x652435,_0x388e07,_0x5806aa,_0x193b('0xf1'));}else{if(_0x652435['countmachineretry']>=_0xadc8b9['dialMachineMaxRetry']){_0x59b8ad[_0x193b('0xf2')](_0x652435,_0x388e07,_0x5806aa,_0x193b('0xf3'));}else{_0x59b8ad[_0x193b('0xbf')]({'active':![],'countmachineretry':_0x652435[_0x193b('0xe6')],'scheduledat':moment()[_0x193b('0xf4')](_0xadc8b9[_0x193b('0xf5')],'minutes')[_0x193b('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x652435[_0x193b('0xf6')],'ListId':_0x652435[_0x193b('0xf7')],'VoiceQueueId':_0x652435[_0x193b('0xf8')]||undefined,'CampaignId':_0x652435['CampaignId']||undefined})[_0x193b('0xb9')](loggerCatch(_0x193b('0xf9')));_0x388e07({'reschedule':0x1});}}});}if(_0x4e889f[_0x193b('0x54')]===_0x193b('0x78')&&this[_0x193b('0x1f')][_0x4e889f[_0x193b('0xb3')]]['dialAMDActive']&&_0x1b4adf['value']===_0x193b('0xfa')){delete this[_0x193b('0xab')][_0x1b4adf[_0x193b('0xd9')]];this[_0x193b('0xb2')](this[_0x193b('0x1f')][_0x4e889f['queue']]);_0x16c6bf=new Hangup(_0x4e889f,_0x1b4adf);_0x16c6bf[_0x193b('0xa8')]=0x12;_0x16c6bf[_0x193b('0xdf')]=_0x193b('0xe0');_0x16c6bf[_0x193b('0xfb')]=_0x193b('0xe5');this[_0x193b('0xd7')](_0x16c6bf,'[syncHangupInAMDIvr][createHistory]',_0x193b('0xfc'));}if(_0x4e889f[_0x193b('0x54')]===_0x193b('0x78')&&this[_0x193b('0x1f')][_0x4e889f[_0x193b('0xb3')]]['dialAMDActive']&&_0x1b4adf[_0x193b('0xde')]===_0x193b('0xe2')){var _0x59b8ad=this;return new BPromise(function(_0x4e706d,_0x2d9dbc){delete _0x59b8ad['uniqueId'][_0x1b4adf[_0x193b('0xd9')]];_0x59b8ad[_0x193b('0xb2')](_0x59b8ad[_0x193b('0x1f')][_0x4e889f[_0x193b('0xb3')]]);_0x59b8ad[_0x193b('0x1f')][_0x4e889f[_0x193b('0xb3')]][_0x193b('0xe3')]+=0x1;_0x59b8ad[_0x193b('0x1f')][_0x4e889f[_0x193b('0xb3')]][_0x193b('0xe4')]+=0x1;var _0xe88527=_0x59b8ad[_0x193b('0x1f')][_0x4e889f[_0x193b('0xb3')]];var _0x6260a8=new Hangup(_0x4e889f,_0x1b4adf);_0x6260a8[_0x193b('0xa8')]=0x13;_0x6260a8[_0x193b('0xdf')]=_0x193b('0xfd');_0x6260a8[_0x193b('0xfb')]='AMD';_0x6260a8['countmachineretry']+=0x1;_0x6260a8[_0x193b('0xe7')]+=0x1;_0x6260a8[_0x193b('0xe8')]=!![];_0x59b8ad['createHistory'](_0x6260a8)[_0x193b('0xb9')](loggerCatch(_0x193b('0xe9')));if(_0x6260a8[_0x193b('0xea')]+_0x6260a8[_0x193b('0xeb')]+_0x6260a8[_0x193b('0xec')]+_0x6260a8[_0x193b('0xed')]+_0x6260a8['countdropretry']+_0x6260a8['countabandonedretry']+_0x6260a8['countmachineretry']+_0x6260a8[_0x193b('0xfe')]>=_0xe88527['dialGlobalMaxRetry']){_0x59b8ad[_0x193b('0xf0')](_0x6260a8,_0x4e706d,_0x2d9dbc,'reason19\x20machine....');}else{if(_0x6260a8[_0x193b('0xe6')]>=_0xe88527[_0x193b('0xff')]){_0x59b8ad['createStateFinal'](_0x6260a8,_0x4e706d,_0x2d9dbc,_0x193b('0xf3'));}else{_0x59b8ad[_0x193b('0xbf')]({'active':![],'countmachineretry':_0x6260a8[_0x193b('0xe6')],'scheduledat':moment()[_0x193b('0xf4')](_0xe88527[_0x193b('0xf5')],_0x193b('0x100'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x6260a8[_0x193b('0xf6')],'ListId':_0x6260a8['ListId'],'VoiceQueueId':_0x6260a8[_0x193b('0xf8')]||undefined,'CampaignId':_0x6260a8['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x4e706d({'reschedule':0x1});}}});}}};Dialer[_0x193b('0x1b')][_0x193b('0x33')]=function(_0x380f44){var _0x3ed006=this[_0x193b('0xab')][_0x380f44[_0x193b('0xd9')]];var _0x5817a9=this;var _0x2f1c29;if(_0x3ed006&&_0x3ed006[_0x193b('0x54')]===_0x193b('0x78')){delete this['uniqueId'][_0x380f44[_0x193b('0xd9')]];this['updateOriginated'](this[_0x193b('0x1f')][_0x3ed006[_0x193b('0xb3')]]);this[_0x193b('0x1f')][_0x3ed006[_0x193b('0xb3')]][_0x193b('0x101')]+=0x1;_0x2f1c29=new Hangup(_0x3ed006,_0x380f44);this['createHistory'](_0x2f1c29)[_0x193b('0xb9')](loggerCatch(_0x193b('0x102')));this[_0x193b('0xc5')](_0x2f1c29)[_0x193b('0xb9')](loggerCatch(_0x193b('0x103')));}if(_0x3ed006&&_0x3ed006['type']!=='ivr'&&isNotNull(this[_0x193b('0x1e')][_0x3ed006[_0x193b('0xb3')]]['dialQueueProject'])){delete this[_0x193b('0xab')][_0x380f44[_0x193b('0xd9')]];this[_0x193b('0xb2')](this[_0x193b('0x1e')][_0x3ed006['queue']]);this[_0x193b('0x1e')][_0x3ed006[_0x193b('0xb3')]][_0x193b('0xe3')]+=0x1;this['voiceQueues'][_0x3ed006[_0x193b('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;_0x2f1c29=new Hangup(_0x3ed006,_0x380f44);_0x2f1c29[_0x193b('0xa8')]=0x10;_0x2f1c29['statedesc']=_0x193b('0x104');_0x2f1c29['membername']=_0x193b('0x105');this[_0x193b('0xc7')](_0x2f1c29)[_0x193b('0xb9')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x193b('0xc5')](_0x2f1c29)[_0x193b('0xb9')](loggerCatch(_0x193b('0x103')));}if(_0x3ed006&&_0x3ed006['type']!=='ivr'&&!isNotNull(this[_0x193b('0x1e')][_0x3ed006[_0x193b('0xb3')]][_0x193b('0x106')])){delete this[_0x193b('0xab')][_0x380f44[_0x193b('0xd9')]];this[_0x193b('0xb2')](this[_0x193b('0x1e')][_0x3ed006[_0x193b('0xb3')]]);this[_0x193b('0x1e')][_0x3ed006[_0x193b('0xb3')]]['outboundUnknownCallsDay']+=0x1;_0x2f1c29=new Hangup(_0x3ed006,_0x380f44);_0x2f1c29[_0x193b('0xa8')]=0xc;_0x2f1c29[_0x193b('0xdf')]=_0x380f44[_0x193b('0x107')];_0x2f1c29[_0x193b('0xfb')]=_0x193b('0x108');this[_0x193b('0xc7')](_0x2f1c29)[_0x193b('0xb9')](loggerCatch(_0x193b('0x102')));this[_0x193b('0xc5')](_0x2f1c29)[_0x193b('0xb9')](loggerCatch(_0x193b('0x103')));}};Dialer[_0x193b('0x1b')][_0x193b('0x109')]=function(_0x348565){var _0x27a894=this['uniqueId'][_0x348565[_0x193b('0xd9')]];var _0x480b8f=this;if(this[_0x193b('0x1e')][_0x348565[_0x193b('0xb3')]]){if(_0x27a894&&_0x27a894[_0x193b('0x54')]!=='ivr'){delete this[_0x193b('0xab')][_0x348565[_0x193b('0xd9')]];this[_0x193b('0x1e')][_0x348565[_0x193b('0xb3')]][_0x193b('0xe3')]+=0x1;var _0x40e2ee=new AgentComplete(_0x27a894,_0x348565);if(_0x348565[_0x193b('0x10a')]===_0x193b('0x10b')){_0x40e2ee[_0x193b('0x10c')]=this[_0x193b('0x1e')][_0x348565['queue']][_0x193b('0x10d')]&&this['voiceQueues'][_0x348565[_0x193b('0xb3')]][_0x193b('0x10e')]?moment()[_0x193b('0x76')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x193b('0xc7')](_0x40e2ee)[_0x193b('0xb9')](loggerCatch(_0x193b('0x10f')));this[_0x193b('0xc5')](_0x40e2ee)['catch'](loggerCatch(_0x193b('0x110')));}}};Dialer[_0x193b('0x1b')]['syncAgentConnect']=function(_0x206da0){if(this[_0x193b('0x1e')][_0x206da0[_0x193b('0xb3')]]){if(this[_0x193b('0xab')][_0x206da0[_0x193b('0xd9')]]&&this[_0x193b('0xab')][_0x206da0['uniqueid']][_0x193b('0x54')]!==_0x193b('0x78')){this[_0x193b('0xb2')](this[_0x193b('0x1e')][_0x206da0['queue']]);this['uniqueId'][_0x206da0['uniqueid']][_0x193b('0x111')]=moment()[_0x193b('0x76')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x8a2d0b){this[_0x193b('0xc7')](_0x8a2d0b)[_0x193b('0xb9')](loggerCatch(_0x193b('0x10f')));this[_0x193b('0xc5')](_0x8a2d0b)[_0x193b('0xb9')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x193b('0x1b')][_0x193b('0x2e')]=function(_0x4c6c9f){var _0x12c1a2=this['uniqueId'][_0x4c6c9f['uniqueid']];var _0x4b5a20=this;if(this[_0x193b('0x1e')][_0x4c6c9f[_0x193b('0xb3')]]){if(_0x12c1a2&&_0x12c1a2['type']!=='ivr'){delete this[_0x193b('0xab')][_0x4c6c9f[_0x193b('0xd9')]];this[_0x193b('0xb2')](this[_0x193b('0x1e')][_0x4c6c9f[_0x193b('0xb3')]]);_0x12c1a2[_0x193b('0x112')]=moment()[_0x193b('0x76')](_0x193b('0x113'));var _0x2262c7=new QueueCallerAbandon(_0x12c1a2,_0x4c6c9f);if(getSeconds(_0x12c1a2[_0x193b('0x112')],_0x12c1a2[_0x193b('0x114')])>=_0x12c1a2['dialQueueTimeout']){this[_0x193b('0x1e')][_0x4c6c9f['queue']][_0x193b('0x6a')]+=0x1;this[_0x193b('0x1e')][_0x4c6c9f['queue']]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x4c6c9f[_0x193b('0xb3')]][_0x193b('0x6c')]+=0x1;_0x2262c7[_0x193b('0xa8')]=0xa;_0x2262c7['statedesc']=_0x193b('0x115');_0x2262c7[_0x193b('0x116')]='TIMEOUT';_0x2262c7[_0x193b('0x10c')]=this[_0x193b('0x1e')][_0x4c6c9f['queue']][_0x193b('0x10d')]?moment()[_0x193b('0x76')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x2262c7['countdropretry']+=0x1;_0x2262c7[_0x193b('0xe7')]+=0x1;if(_0x2262c7[_0x193b('0xee')]>=this[_0x193b('0x1e')][_0x4c6c9f[_0x193b('0xb3')]][_0x193b('0x117')]){this[_0x193b('0x118')](_0x2262c7);}else{this[_0x193b('0xbf')]({'active':![],'countdropretry':_0x2262c7['countdropretry'],'scheduledat':moment()[_0x193b('0xf4')](this[_0x193b('0x1e')][_0x4c6c9f[_0x193b('0xb3')]][_0x193b('0x119')],_0x193b('0x100'))[_0x193b('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x12c1a2[_0x193b('0xf6')],'ListId':_0x12c1a2[_0x193b('0xf7')],'VoiceQueueId':_0x12c1a2[_0x193b('0xf8')]||undefined,'CampaignId':_0x12c1a2['CampaignId']||undefined})[_0x193b('0xb9')](loggerCatch('[rescheduleContact][Drop]'));var _0x467891=new History(_0x2262c7);_0x467891['state']=0xa;_0x467891[_0x193b('0xdf')]=_0x193b('0x115');_0x467891['starttime']=moment()[_0x193b('0x76')](_0x193b('0x113'));_0x467891[_0x193b('0x11a')]=_0x467891[_0x193b('0xa9')];_0x467891[_0x193b('0x11b')]=_0x2262c7['calleridname'];_0x467891['calleridnum']=_0x2262c7[_0x193b('0x11c')];this['createHistory'](_0x467891)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0x193b('0x1e')][_0x4c6c9f[_0x193b('0xb3')]][_0x193b('0x69')]+=0x1;this[_0x193b('0x1e')][_0x4c6c9f[_0x193b('0xb3')]][_0x193b('0x61')]+=0x1;_0x2262c7[_0x193b('0xa8')]=0xb;_0x2262c7['statedesc']='Abandoned';_0x2262c7['dropreason']=_0x193b('0x11d');_0x2262c7[_0x193b('0xef')]+=0x1;_0x2262c7[_0x193b('0xe7')]+=0x1;if(_0x2262c7['countabandonedretry']>=this[_0x193b('0x1e')][_0x4c6c9f[_0x193b('0xb3')]]['dialAbandonedMaxRetry']){this[_0x193b('0x118')](_0x2262c7);}else{this[_0x193b('0xbf')]({'active':![],'countabandonedretry':_0x2262c7[_0x193b('0xef')],'scheduledat':moment()[_0x193b('0xf4')](this[_0x193b('0x1e')][_0x4c6c9f['queue']]['dialAbandonedRetryFrequency'],_0x193b('0x100'))[_0x193b('0x76')](_0x193b('0x113')),'ContactId':_0x12c1a2[_0x193b('0xf6')],'ListId':_0x12c1a2[_0x193b('0xf7')],'VoiceQueueId':_0x12c1a2['VoiceQueueId']||undefined,'CampaignId':_0x12c1a2[_0x193b('0xcf')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x467891=new History(_0x2262c7);_0x467891[_0x193b('0xa8')]=0xb;_0x467891[_0x193b('0xdf')]='Abandoned';_0x467891['starttime']=moment()[_0x193b('0x76')](_0x193b('0x113'));_0x467891[_0x193b('0x11a')]=_0x467891[_0x193b('0xa9')];_0x467891[_0x193b('0x11b')]=_0x2262c7['calleridname'];_0x467891[_0x193b('0x11c')]=_0x2262c7[_0x193b('0x11c')];this['createHistory'](_0x467891)['catch'](loggerCatch(_0x193b('0x11e')));}}}}};Dialer['prototype'][_0x193b('0x35')]=function(_0x142bd4){if(this[_0x193b('0x23')][_0x142bd4[_0x193b('0xd9')]]){this[_0x193b('0x23')][_0x142bd4['uniqueid']][_0x193b('0xb0')]=_0x142bd4[_0x193b('0xb0')];}if(this['uniqueId'][_0x142bd4[_0x193b('0xd9')]]){this[_0x193b('0xab')][_0x142bd4[_0x193b('0xd9')]][_0x193b('0xb0')]=_0x142bd4['channel'];}};Dialer['prototype'][_0x193b('0x38')]=function(_0x58b9ad){if(strategy[this[_0x193b('0x1e')][this[_0x193b('0x23')][_0x58b9ad[_0x193b('0x11f')]]['queue']][_0x193b('0x4d')]]===_0x193b('0x1a')){if(this[_0x193b('0x23')][_0x58b9ad['actionid']]&&_[_0x193b('0xad')](this[_0x193b('0x23')][_0x58b9ad[_0x193b('0x11f')]][_0x193b('0x120')])&&_0x58b9ad[_0x193b('0xaf')]==='1'&&_0x58b9ad[_0x193b('0x121')]==='0'){if(this[_0x193b('0x20')][_0x58b9ad[_0x193b('0x122')]]){if(!this[_0x193b('0x20')][_0x58b9ad[_0x193b('0x122')]][_0x193b('0x120')]){this[_0x193b('0x20')][_0x58b9ad[_0x193b('0x122')]][_0x193b('0x120')]=!![];this[_0x193b('0x23')][_0x58b9ad[_0x193b('0x11f')]][_0x193b('0x120')]=!![];this[_0x193b('0x23')][_0x58b9ad[_0x193b('0x11f')]]['stateinterface']=_0x58b9ad['stateinterface'];}}}}else if((strategy[this[_0x193b('0x1e')][this[_0x193b('0x23')][_0x58b9ad['actionid']][_0x193b('0xb3')]][_0x193b('0x4d')]]||_0x193b('0x19'))===_0x193b('0x19')){if(this[_0x193b('0x23')][_0x58b9ad[_0x193b('0x11f')]]){if(this[_0x193b('0x20')][_0x58b9ad[_0x193b('0x122')]]){this[_0x193b('0x23')][_0x58b9ad['actionid']][_0x193b('0x122')]=_0x58b9ad[_0x193b('0x122')];if(_['isNil'](this[_0x193b('0x123')][this[_0x193b('0x23')][_0x58b9ad['actionid']][_0x193b('0xb3')]])){this[_0x193b('0x123')][this[_0x193b('0x23')][_0x58b9ad[_0x193b('0x11f')]][_0x193b('0xb3')]]=[];}this['queueBooked'][this[_0x193b('0x23')][_0x58b9ad['actionid']][_0x193b('0xb3')]][_0x193b('0x124')](_[_0x193b('0xcc')](_[_0x193b('0xcd')](this['actions'][_0x58b9ad[_0x193b('0x11f')]],[_0x193b('0x125'),'stateinterface']),{'status':_0x58b9ad[_0x193b('0xaf')],'paused':_0x58b9ad[_0x193b('0x121')]}));}}}};function unlockQueueStatus(_0xa6d0ca,_0x301db2){setTimeout(function(){if(_[_0x193b('0x85')](_0xa6d0ca[_0x193b('0x126')])){loggerBooked[_0x193b('0x98')](_0x193b('0x127'),_0x301db2);}_0xa6d0ca['queueStatusComplete']=!![];loggerBooked[_0x193b('0x7b')]('[booked][unlockQueueStatus]',_0x301db2,JSON[_0x193b('0x75')](_[_0x193b('0xcd')](_0xa6d0ca,[_0x193b('0x3f'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x193b('0x1b')][_0x193b('0x39')]=function(_0x331ae1){var _0x5f2cb4=this;var _0x1c2295=_0x5f2cb4[_0x193b('0x1e')][_0x5f2cb4[_0x193b('0x23')][_0x331ae1[_0x193b('0x11f')]][_0x193b('0xb3')]];if(strategy[this[_0x193b('0x1e')][this[_0x193b('0x23')][_0x331ae1[_0x193b('0x11f')]][_0x193b('0xb3')]][_0x193b('0x4d')]]===_0x193b('0x1a')){if(this[_0x193b('0x23')][_0x331ae1['actionid']]&&this[_0x193b('0x23')][_0x331ae1['actionid']][_0x193b('0x122')]){this['preview']['run'](this[_0x193b('0x23')][_0x331ae1[_0x193b('0x11f')]][_0x193b('0x125')],this['actions'][_0x331ae1[_0x193b('0x11f')]]['stateinterface'])[_0x193b('0xb9')](function(_0xba9497){logger['error'](_0x193b('0x128'),util[_0x193b('0x99')](_0xba9497,{'showHidden':![],'depth':null}));})[_0x193b('0x1d')](function(){_0x5f2cb4[_0x193b('0xb2')](_0x5f2cb4['voiceQueues'][_0x5f2cb4[_0x193b('0x23')][_0x331ae1[_0x193b('0x11f')]]['queue']]);_0x5f2cb4[_0x193b('0x20')][_0x5f2cb4[_0x193b('0x23')][_0x331ae1[_0x193b('0x11f')]][_0x193b('0x122')]][_0x193b('0x120')]=![];delete _0x5f2cb4['actions'][_0x331ae1[_0x193b('0x11f')]];unlockQueueStatus(_0x1c2295);});}else{this[_0x193b('0xb2')](this['voiceQueues'][this[_0x193b('0x23')][_0x331ae1[_0x193b('0x11f')]][_0x193b('0xb3')]]);this[_0x193b('0xbf')]({'active':![],'ContactId':this[_0x193b('0x23')][_0x331ae1[_0x193b('0x11f')]]['ContactId'],'ListId':this[_0x193b('0x23')][_0x331ae1[_0x193b('0x11f')]][_0x193b('0xf7')],'VoiceQueueId':this[_0x193b('0x23')][_0x331ae1[_0x193b('0x11f')]][_0x193b('0xf8')]||undefined,'CampaignId':this[_0x193b('0x23')][_0x331ae1[_0x193b('0x11f')]][_0x193b('0xcf')]||undefined})[_0x193b('0xb9')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x193b('0x23')][_0x331ae1[_0x193b('0x11f')]];unlockQueueStatus(_0x1c2295);}}else if((strategy[this[_0x193b('0x1e')][this[_0x193b('0x23')][_0x331ae1[_0x193b('0x11f')]]['queue']][_0x193b('0x4d')]]||_0x193b('0x19'))==='rrmemory'){var _0x431152;if(this[_0x193b('0x23')][_0x331ae1[_0x193b('0x11f')]]&&!_[_0x193b('0x45')](this[_0x193b('0x123')][this[_0x193b('0x23')][_0x331ae1[_0x193b('0x11f')]]['queue']])){if(this[_0x193b('0x29')][_0x5f2cb4[_0x193b('0x23')][_0x331ae1['actionid']]['queue']]){this['queueBookedRR'][_0x5f2cb4['actions'][_0x331ae1[_0x193b('0x11f')]][_0x193b('0xb3')]]=this[_0x193b('0x29')][this[_0x193b('0x23')][_0x331ae1['actionid']][_0x193b('0xb3')]]?this[_0x193b('0x29')][this[_0x193b('0x23')][_0x331ae1[_0x193b('0x11f')]][_0x193b('0xb3')]]:this[_0x193b('0x123')][this['actions'][_0x331ae1[_0x193b('0x11f')]][_0x193b('0xb3')]]?this['queueBooked'][this[_0x193b('0x23')][_0x331ae1[_0x193b('0x11f')]]['queue']][_0x193b('0x129')]||0x0:0x0;}this[_0x193b('0x123')][this[_0x193b('0x23')][_0x331ae1['actionid']][_0x193b('0xb3')]][_0x193b('0x129')]=this[_0x193b('0x29')][this['actions'][_0x331ae1['actionid']][_0x193b('0xb3')]];for(var _0x1ca461=0x0;_0x1ca461=0x0?!![]:![];})[_0x193b('0xb9')](myreject(_0x166fbf)));}}else{_0x3afc47[_0x193b('0x124')](ami[_0x193b('0xae')]({'action':_0x193b('0x13f'),'command':util[_0x193b('0x76')](_0x193b('0x140'),_0x369f16,!_['isUndefined'](config[_0x193b('0x13b')][_0x28d13e])?_0x28d13e:'')})[_0x193b('0xb7')](function(_0x26c289){return _0x26c289[_0x193b('0x142')][_0x193b('0x143')](_0x193b('0x144'))>=0x0?!![]:![];})[_0x193b('0xb9')](myreject(_0x166fbf)));}BPromise[_0x193b('0x145')](_0x3afc47)['then'](function(_0x34639b){var _0x42b855=_[_0x193b('0x146')](_0x34639b);if(_0x42b855){return _0x4d4f8a(_0x42b855);}else{_0x2b76a4['message']=_0x115be9?_0x193b('0x147'):'INTERVAL_IS_OVERTIME';return _0x166fbf(msgResponse(_0x193b('0x148'),_0x193b('0x139'),_0x193b('0x149')+_0x115be9+'\x20'+_0x240895+_0x193b('0x14a')+util[_0x193b('0x99')](_0x369f16,{'showHidden':![],'depth':null})+_0x193b('0x14b')+_0x28d13e));}})[_0x193b('0xb9')](function(_0x7e66d6){return _0x166fbf(msgResponse(_0x193b('0x138'),_0x193b('0x139'),JSON['stringify'](_0x7e66d6)));});});};Dialer[_0x193b('0x1b')][_0x193b('0x14c')]=function(_0x4d63dc){var _0x4ae067=this;return function(){switch(_0x4d63dc[_0x193b('0x59')]){case _0x193b('0x14d'):freeVariablesPredictive(_0x4d63dc);_0x4ae067[_0x193b('0x14e')](_0x4d63dc,0x1);break;case'power':freeVariablesPredictive(_0x4d63dc);_0x4ae067['handlePower'](_0x4d63dc,_0x4d63dc[_0x193b('0x14f')]);break;case _0x193b('0xa'):_0x4ae067[_0x193b('0xa')](_0x4d63dc);break;case _0x193b('0x150'):freeVariablesPredictive(_0x4d63dc);_0x4ae067[_0x193b('0x14e')](_0x4d63dc,0x1);break;default:freeVariablesPredictive(_0x4d63dc);logger['error'](_0x193b('0x151'),_0x4d63dc[_0x193b('0x3f')],'method\x20not\x20recognized');}};};Dialer['prototype'][_0x193b('0x152')]=function(_0x23d25e){var _0x8b6cf2=this;return function(){_0x8b6cf2['handleIvr'](_0x23d25e);};};Dialer[_0x193b('0x1b')][_0x193b('0xc')]=function(_0x4a69ca){var _0x49a8c2=this;if(isNotPreview(_0x4a69ca['dialMethod'])){if(isVoiceQueueOutbound(_0x4a69ca[_0x193b('0x54')])&&isActive(_0x4a69ca[_0x193b('0x58')])){_0x4a69ca[_0x193b('0xa1')]=!![];BPromise[_0x193b('0xb6')]()[_0x193b('0xb7')](checkIsLoggedIn(_0x4a69ca,_0x4a69ca[_0x193b('0x153')]))[_0x193b('0xb7')](checkIsActive(_0x4a69ca,_0x4a69ca[_0x193b('0x58')]))[_0x193b('0xb7')](checkInterval(_0x4a69ca))[_0x193b('0xb7')](_0x49a8c2['checkIsTrunkReachable'](_0x4a69ca))['then'](_0x49a8c2[_0x193b('0x137')](_0x4a69ca[_0x193b('0x154')],_0x4a69ca['dialTimezone'],_0x4a69ca['name'],_0x4a69ca))[_0x193b('0xb7')](_0x49a8c2[_0x193b('0x155')](_0x4a69ca[_0x193b('0x41')],_0x4a69ca[_0x193b('0x156')],_0x4a69ca[_0x193b('0x3f')],_0x4a69ca))[_0x193b('0xb7')](_0x49a8c2[_0x193b('0x14c')](_0x4a69ca))[_0x193b('0xb9')](loggerCatchQueueSummary(_0x193b('0x157'),_0x4a69ca));}else{notSendMessagesQueue(_0x4a69ca);}}else{freeVariablesPredictive(_0x4a69ca);}};Dialer[_0x193b('0x1b')][_0x193b('0x133')]=function(){var _0x574fbe=this;var _0x109c29;for(var _0xf28bb3 in this[_0x193b('0x1f')]){if(this[_0x193b('0x1f')][_0x193b('0x9b')](_0xf28bb3)){_0x109c29=this[_0x193b('0x1f')][_0xf28bb3];if(isCampaignIvr(_0x109c29[_0x193b('0x54')])&&isActive(_0x109c29[_0x193b('0xd3')])){_0x109c29['sendMessageOneNotActive']=!![];BPromise[_0x193b('0xb6')]()['then'](checkIsActive(_0x109c29,_0x109c29[_0x193b('0xd3')]))[_0x193b('0xb7')](checkInterval(_0x109c29))[_0x193b('0xb7')](_0x574fbe[_0x193b('0x158')](_0x109c29))[_0x193b('0xb7')](_0x574fbe[_0x193b('0x137')](_0x109c29[_0x193b('0x154')],_0x109c29[_0x193b('0x156')],_0x109c29[_0x193b('0x3f')],_0x109c29))[_0x193b('0xb7')](_0x574fbe[_0x193b('0x155')](_0x109c29[_0x193b('0x41')],_0x109c29[_0x193b('0x156')],_0x109c29[_0x193b('0x3f')],_0x109c29))[_0x193b('0xb7')](_0x574fbe[_0x193b('0x152')](_0x109c29))[_0x193b('0xb9')](loggerCatchQueueSummary(_0x193b('0x159'),_0x109c29));}else{notSendMessagesCampaign(_0x109c29);}}}};function getCallerIdRandom(_0x3ece87,_0x2f85ee){var _0x3aee63,_0xe28d0d,_0x34d0fd;if(_0x2f85ee<=0x0){_0x2f85ee=0x1;}_0x3aee63=new RegExp(_0x193b('0x15a')+_0x2f85ee+'}$');_0xe28d0d=Math['pow'](0xa,_0x2f85ee-0x1);_0x34d0fd=Math['pow'](0xa,_0x2f85ee)-0x1;return util[_0x193b('0x76')]('%s',_[_0x193b('0x15b')](_0x3ece87,_0x3aee63,_[_0x193b('0x15c')](_0xe28d0d,_0x34d0fd)));}function extractCalleridName(_0x3aa747){var _0x28f1ab=_0x3aa747[_0x193b('0x15d')](/"(.*?)"/);return _0x28f1ab?_0x28f1ab[0x1]:_0x3aa747;}function extractCalleridNumber(_0x5d5cd5){var _0x379aab=_0x5d5cd5[_0x193b('0x15d')](/<(.*?)>/);return _0x379aab?_0x379aab[0x1]:_0x5d5cd5;}Dialer[_0x193b('0x1b')][_0x193b('0x15e')]=function(_0x26a3d3,_0x579ed0){var _0x3269ad=this;var _0x3bc181=uuid['v4']();this['actions'][_0x3bc181]=new Action(_0x26a3d3,_0x579ed0,_0x3bc181);return new BPromise(function(_0x3940e0,_0x38cfcd){if(_[_0x193b('0x85')](_0x26a3d3)&&_0x193b('0x15f')!==typeof _0x26a3d3){return _0x38cfcd(msgResponse('originate',_0x193b('0x139'),_0x193b('0x160')));}if(_[_0x193b('0x85')](_0x579ed0['Contact'][_0x193b('0x161')])||_0x579ed0[_0x193b('0x162')][_0x193b('0x161')]===null){return _0x38cfcd(msgResponse(_0x193b('0x163'),_0x193b('0x139'),_0x193b('0x164')));}var _0x1d2fea={'XMD-CALLERID':_0x3269ad[_0x193b('0x23')][_0x3bc181][_0x193b('0x165')](),'XMD-AGI':_0x26a3d3['dialQueueProject']?util[_0x193b('0x76')](_0x193b('0x166'),ipAgi,_0x26a3d3[_0x193b('0x106')]):'NONE','XMD-AGIAFTER':_0x26a3d3[_0x193b('0x10d')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x26a3d3[_0x193b('0x10d')]):'NONE','XMD-QUEUE':_0x26a3d3[_0x193b('0x54')]===_0x193b('0x4c')?util[_0x193b('0x76')]('\x22%s,%s%s,,,%s\x22',_0x26a3d3['name'],_0x26a3d3[_0x193b('0x167')]||'',_0x26a3d3['dialAgiAfterHangupAgent']?'c':'',_0x26a3d3[_0x193b('0x168')]||0x3):_0x193b('0x169'),'XMD-CONTACTID':_0x579ed0[_0x193b('0xf6')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x3269ad[_0x193b('0x23')][_0x3bc181][_0x193b('0x165')](),'XMD-AMD':_0x26a3d3['dialAMDActive']?_0x193b('0x16a'):_0x193b('0x169'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x26a3d3[_0x193b('0xdd')]){_0x1d2fea[_0x193b('0x16b')]=_0x26a3d3[_0x193b('0x16c')]||0x9c4;_0x1d2fea[_0x193b('0x16d')]=_0x26a3d3['dialAMDGreeting']||0x5dc;_0x1d2fea['XMD-AMDAFTERGREETINGSILENCE']=_0x26a3d3[_0x193b('0x16e')]||0x320;_0x1d2fea[_0x193b('0x16f')]=_0x26a3d3[_0x193b('0x170')]||0x1388;_0x1d2fea[_0x193b('0x171')]=_0x26a3d3[_0x193b('0x172')]||0x64;_0x1d2fea[_0x193b('0x173')]=_0x26a3d3[_0x193b('0x174')]||0x32;_0x1d2fea[_0x193b('0x175')]=_0x26a3d3[_0x193b('0x176')]||0x3;_0x1d2fea[_0x193b('0x177')]=_0x26a3d3[_0x193b('0x178')]||0x100;_0x1d2fea[_0x193b('0x179')]=_0x26a3d3[_0x193b('0x17a')]||0x1388;}if(_0x26a3d3[_0x193b('0x54')]===_0x193b('0x4c')){_0x1d2fea[_0x193b('0x17b')]=_0x579ed0[_0x193b('0xf8')];}else{_0x1d2fea['XMD-CAMPAIGNID']=_0x579ed0['CampaignId'];}for(var _0x10655d in _0x579ed0[_0x193b('0x162')]){if(_0x579ed0['Contact'][_0x193b('0x9b')](_0x10655d)){if(isNotNull(_0x579ed0['Contact'][_0x10655d])&&_0x10655d!=='id'&&_0x10655d!==_0x193b('0x17c')&&_0x10655d!==_0x193b('0x17d')&&_0x10655d!=='updatedAt'){_0x1d2fea[util[_0x193b('0x76')](_0x193b('0x17e'),_0x193b('0x17f'),_[_0x193b('0x180')](_0x10655d))]=_0x579ed0['Contact'][_0x10655d];}}}var _0x4ecda9=_0x3269ad[_0x193b('0xd2')](_0x26a3d3[_0x193b('0x73')])?getCallerId(_0x26a3d3['Trunk'][_0x193b('0x74')],_0x26a3d3[_0x193b('0x5a')],_0x26a3d3['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x26a3d3['dialOriginateCallerIdNumber'],_0x26a3d3[_0x193b('0x181')]):_0x26a3d3[_0x193b('0x182')]):getCallerId(_[_0x193b('0xad')](_0x26a3d3['TrunkBackup'])?_0x26a3d3[_0x193b('0x73')][_0x193b('0x74')]:_0x26a3d3[_0x193b('0x134')][_0x193b('0x74')],_0x26a3d3[_0x193b('0x5a')],_0x26a3d3[_0x193b('0x181')]>0x0?getCallerIdRandom(_0x26a3d3[_0x193b('0x182')],_0x26a3d3[_0x193b('0x181')]):_0x26a3d3[_0x193b('0x182')]);if(_0x4ecda9){_0x1d2fea[_0x193b('0x183')]=_0x3269ad[_0x193b('0x23')][_0x3bc181][_0x193b('0x184')]=extractCalleridName(_0x4ecda9);_0x1d2fea[_0x193b('0x185')]=_0x3269ad['actions'][_0x3bc181][_0x193b('0x186')]=extractCalleridNumber(_0x4ecda9);}return ami[_0x193b('0xae')]({'actionid':_0x3bc181,'action':_0x193b('0x163'),'channel':_0x3269ad[_0x193b('0xd2')](_0x26a3d3[_0x193b('0x73')])?util['format'](_0x193b('0x187'),_0x26a3d3[_0x193b('0x73')][_0x193b('0x3f')],isNotNull(_0x26a3d3['dialPrefix'])?_0x26a3d3[_0x193b('0x5c')]['trim']()||'':'',_0x26a3d3[_0x193b('0x188')]>0x0?_0x579ed0[_0x193b('0x162')][_0x193b('0x161')]['substring'](_0x26a3d3[_0x193b('0x188')]):_0x579ed0[_0x193b('0x162')]['phone']):util[_0x193b('0x76')]('SIP/%s/%s%s',_[_0x193b('0xad')](_0x26a3d3[_0x193b('0x134')])?_0x26a3d3['Trunk']['name']:_0x26a3d3[_0x193b('0x134')]['name'],isNotNull(_0x26a3d3[_0x193b('0x5c')])?_0x26a3d3[_0x193b('0x5c')][_0x193b('0x189')]()||'':'',_0x26a3d3['dialCutDigit']>0x0?_0x579ed0[_0x193b('0x162')][_0x193b('0x161')]['substring'](_0x26a3d3['dialCutDigit']):_0x579ed0[_0x193b('0x162')][_0x193b('0x161')]),'callerid':_0x4ecda9,'Exten':_0x193b('0xdc'),'Context':_0x193b('0x18a'),'Priority':'1','variable':_0x1d2fea,'timeout':(_0x26a3d3['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x3bc181})[_0x193b('0xb7')](function(_0x10072b){return _0x3940e0(_0x10072b);})[_0x193b('0xb9')](function(_0x1f1e20){_0x26a3d3[_0x193b('0x65')]+=0x1;var _0x202605=new History(_0x3269ad[_0x193b('0x23')][_0x3bc181]);logger[_0x193b('0x98')](util['format'](_0x193b('0x18b'),JSON['stringify'](_0x1f1e20)));_0x202605[_0x193b('0xa8')]=0xe;_0x202605[_0x193b('0xdf')]=_0x193b('0x18c');_0x202605[_0x193b('0xa9')]=moment()[_0x193b('0x76')](_0x193b('0x113'));_0x202605[_0x193b('0x11a')]=_0x202605[_0x193b('0xa9')];_0x3269ad[_0x193b('0xc7')](_0x202605)[_0x193b('0xb9')](loggerCatch(_0x193b('0x18d')));_0x3269ad[_0x193b('0xc5')](_0x202605)[_0x193b('0xb9')](loggerCatch(_0x193b('0x18d')))[_0x193b('0x1d')](function(){delete _0x3269ad[_0x193b('0x23')][_0x3bc181];return _0x38cfcd(msgResponse(_0x193b('0x163'),_0x193b('0x47'),'originate\x20action\x20Error'));});});});};Dialer[_0x193b('0x1b')][_0x193b('0x30')]=function(_0x5f4a5f){var _0x1c9bca=this[_0x193b('0x23')][_0x5f4a5f[_0x193b('0x11f')]];var _0x24adfb=this;if(_0x1c9bca){delete this[_0x193b('0x23')][_0x5f4a5f[_0x193b('0x11f')]];_0x1c9bca[_0x193b('0x114')]=moment()[_0x193b('0x76')](_0x193b('0x113'));var _0x37d28d=_0x1c9bca['type']==='ivr'?this['campaigns'][_0x1c9bca[_0x193b('0xb3')]]:this['voiceQueues'][_0x1c9bca[_0x193b('0x18e')]()];if(!this[_0x193b('0x18f')](_0x5f4a5f[_0x193b('0x190')])){this[_0x193b('0xb2')](_0x37d28d);return this[_0x193b('0x191')](_0x1c9bca,_0x37d28d,_0x5f4a5f)[_0x193b('0xb7')](function(_0x5ece58){})[_0x193b('0xb9')](loggerCatch(_0x193b('0x192')));}else{this[_0x193b('0xab')][_0x5f4a5f[_0x193b('0xd9')]]=_0x1c9bca;}}};Dialer[_0x193b('0x1b')][_0x193b('0x193')]=function(_0x13e44b,_0x3c3aab,_0x2a7dc2){var _0x118cea=new History(_0x3c3aab);if(_0x118cea[_0x193b('0xea')]+_0x118cea[_0x193b('0xeb')]+_0x118cea[_0x193b('0xec')]+_0x118cea[_0x193b('0xed')]+_0x118cea[_0x193b('0xee')]+_0x118cea[_0x193b('0xef')]+_0x118cea[_0x193b('0xe6')]+_0x118cea[_0x193b('0xfe')]>=_0x2a7dc2[_0x193b('0x194')]-0x1){return!![];}switch(_0x13e44b){case 0x3:if(_0x118cea[_0x193b('0xec')]>=_0x2a7dc2[_0x193b('0x195')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnoanswerretry':_0x118cea[_0x193b('0xec')]+=0x1,'scheduledat':moment()['add'](_0x2a7dc2[_0x193b('0x196')],_0x193b('0x100'))[_0x193b('0x76')](_0x193b('0x113')),'ContactId':_0x118cea[_0x193b('0xf6')],'ListId':_0x118cea[_0x193b('0xf7')],'VoiceQueueId':_0x118cea[_0x193b('0xf8')]||undefined,'CampaignId':_0x118cea[_0x193b('0xcf')]||undefined})[_0x193b('0xb9')](loggerCatch(_0x193b('0x197')));}break;case 0x5:if(_0x118cea[_0x193b('0xea')]>=_0x2a7dc2[_0x193b('0x198')]-0x1){return!![];}else{this[_0x193b('0xbf')]({'active':![],'countbusyretry':_0x118cea[_0x193b('0xea')]+=0x1,'scheduledat':moment()['add'](_0x2a7dc2[_0x193b('0x199')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x118cea['ContactId'],'ListId':_0x118cea[_0x193b('0xf7')],'VoiceQueueId':_0x118cea[_0x193b('0xf8')]||undefined,'CampaignId':_0x118cea[_0x193b('0xcf')]||undefined})['catch'](loggerCatch(_0x193b('0x19a')));}break;case 0x8:if(_0x118cea[_0x193b('0xeb')]>=_0x2a7dc2['dialCongestionMaxRetry']-0x1){return!![];}else{this[_0x193b('0xbf')]({'active':![],'countcongestionretry':_0x118cea[_0x193b('0xeb')]+=0x1,'scheduledat':moment()[_0x193b('0xf4')](_0x2a7dc2[_0x193b('0x19b')],'minutes')[_0x193b('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x118cea[_0x193b('0xf6')],'ListId':_0x118cea['ListId'],'VoiceQueueId':_0x118cea[_0x193b('0xf8')]||undefined,'CampaignId':_0x118cea[_0x193b('0xcf')]||undefined})[_0x193b('0xb9')](loggerCatch(_0x193b('0x19c')));}break;case 0x0:if(_0x118cea[_0x193b('0xed')]>=_0x2a7dc2['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x193b('0xbf')]({'active':![],'countnosuchnumberretry':_0x118cea[_0x193b('0xed')]+=0x1,'scheduledat':moment()[_0x193b('0xf4')](_0x2a7dc2[_0x193b('0x19d')],_0x193b('0x100'))['format'](_0x193b('0x113')),'ContactId':_0x118cea[_0x193b('0xf6')],'ListId':_0x118cea[_0x193b('0xf7')],'VoiceQueueId':_0x118cea['VoiceQueueId']||undefined,'CampaignId':_0x118cea['CampaignId']||undefined})[_0x193b('0xb9')](loggerCatch(_0x193b('0x19e')));}break;case 0xa:if(_0x118cea[_0x193b('0xee')]>=_0x2a7dc2['dialDropMaxRetry']-0x1){return!![];}else{this[_0x193b('0xbf')]({'active':![],'countdropretry':_0x118cea[_0x193b('0xee')]+=0x1,'scheduledat':moment()[_0x193b('0xf4')](_0x2a7dc2[_0x193b('0x119')],_0x193b('0x100'))['format'](_0x193b('0x113')),'ContactId':_0x118cea[_0x193b('0xf6')],'ListId':_0x118cea['ListId'],'VoiceQueueId':_0x118cea[_0x193b('0xf8')]||undefined,'CampaignId':_0x118cea[_0x193b('0xcf')]||undefined})[_0x193b('0xb9')](loggerCatch(_0x193b('0x19f')));}break;case 0xb:if(_0x118cea[_0x193b('0xef')]>=_0x2a7dc2[_0x193b('0x1a0')]-0x1){return!![];}else{this[_0x193b('0xbf')]({'active':![],'countabandonedretry':_0x118cea['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x2a7dc2['dialAbandonedRetryFrequency'],_0x193b('0x100'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x118cea[_0x193b('0xf6')],'ListId':_0x118cea[_0x193b('0xf7')],'VoiceQueueId':_0x118cea['VoiceQueueId']||undefined,'CampaignId':_0x118cea['CampaignId']||undefined})[_0x193b('0xb9')](loggerCatch(_0x193b('0x1a1')));}break;case 0x13:if(_0x118cea[_0x193b('0xe6')]>=_0x2a7dc2['dialMachineMaxRetry']-0x1){return!![];}else{this[_0x193b('0xbf')]({'active':![],'countmachineretry':_0x118cea['countmachineretry']+=0x1,'scheduledat':moment()[_0x193b('0xf4')](_0x2a7dc2[_0x193b('0xf5')],_0x193b('0x100'))[_0x193b('0x76')](_0x193b('0x113')),'ContactId':_0x118cea['ContactId'],'ListId':_0x118cea['ListId'],'VoiceQueueId':_0x118cea[_0x193b('0xf8')]||undefined,'CampaignId':_0x118cea[_0x193b('0xcf')]||undefined})[_0x193b('0xb9')](loggerCatch('[rescheduleContact][Machine]'));}break;case 0x14:if(_0x118cea[_0x193b('0xfe')]>=_0x2a7dc2[_0x193b('0x1a2')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countagentrejectretry':_0x118cea[_0x193b('0xfe')]+=0x1,'scheduledat':moment()[_0x193b('0xf4')](_0x2a7dc2[_0x193b('0x1a3')],_0x193b('0x100'))[_0x193b('0x76')](_0x193b('0x113')),'ContactId':_0x118cea[_0x193b('0xf6')],'ListId':_0x118cea[_0x193b('0xf7')],'VoiceQueueId':_0x118cea[_0x193b('0xf8')]||undefined,'CampaignId':_0x118cea['CampaignId']||undefined})[_0x193b('0xb9')](loggerCatch(_0x193b('0x1a4')));}break;default:return!![];}};Dialer[_0x193b('0x1b')][_0x193b('0x191')]=function(_0x3af47d,_0x5ae546,_0x3e0dfe){var _0x99fae8=this;var _0x22bdfd=new History(_0x3af47d);return new BPromise(function(_0xbf30e1,_0x1fb02d){if(_[_0x193b('0x85')](_0x5ae546)&&_0x193b('0x15f')!==typeof _0x5ae546){return _0x1fb02d(msgResponse('[callProgressDetecting]',_0x193b('0x139'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x3e0dfe)&&_0x193b('0x15f')!==typeof _0x3e0dfe){return _0x1fb02d(msgResponse(_0x193b('0x1a5'),_0x193b('0x139'),_0x193b('0x1a6')));}switch(_0x3e0dfe[_0x193b('0x10a')]){case'0':_0x5ae546[_0x193b('0x64')]+=0x1;_0x22bdfd[_0x193b('0xa8')]=0x0;_0x22bdfd[_0x193b('0xdf')]='NoSuchNumber';_0x22bdfd[_0x193b('0xed')]+=0x1;_0x22bdfd[_0x193b('0xe7')]+=0x1;ami['emit'](_0x193b('0x1a7'),ut[_0x193b('0x1a8')](_0x3af47d,_0x193b('0x1a9')));_0x99fae8[_0x193b('0xc7')](_0x22bdfd)[_0x193b('0xb9')](loggerCatch(_0x193b('0xe9')));if(_0x99fae8[_0x193b('0x193')](0x0,_0x3af47d,_0x5ae546)){if(_0x22bdfd[_0x193b('0xed')]>=_0x5ae546[_0x193b('0x1aa')]){_0x99fae8[_0x193b('0xf2')](_0x22bdfd,_0xbf30e1,_0x1fb02d,_0x193b('0x1ab'));}else{_0x99fae8[_0x193b('0xf0')](_0x22bdfd,_0xbf30e1,_0x1fb02d,_0x193b('0x1ab'));}}break;case'3':_0x5ae546[_0x193b('0x63')]+=0x1;_0x22bdfd[_0x193b('0xa8')]=0x3;_0x22bdfd[_0x193b('0xdf')]=_0x193b('0x1ac');_0x22bdfd[_0x193b('0xec')]+=0x1;_0x22bdfd['countglobal']+=0x1;ami[_0x193b('0x4b')]('custom:agentnoanswer',ut[_0x193b('0x1a8')](_0x3af47d,_0x193b('0x1ad')));_0x99fae8[_0x193b('0xc7')](_0x22bdfd)['catch'](loggerCatch(_0x193b('0x1ae')));if(_0x99fae8[_0x193b('0x193')](0x3,_0x3af47d,_0x5ae546)){if(_0x22bdfd[_0x193b('0xec')]>=_0x5ae546[_0x193b('0x195')]){_0x99fae8[_0x193b('0xf2')](_0x22bdfd,_0xbf30e1,_0x1fb02d,'reason\x203\x20ringing\x20no\x20answer');}else{_0x99fae8[_0x193b('0xf0')](_0x22bdfd,_0xbf30e1,_0x1fb02d,_0x193b('0x1af'));}}break;case'5':_0x5ae546[_0x193b('0x5e')]+=0x1;_0x22bdfd['state']=0x5;_0x22bdfd[_0x193b('0xdf')]=_0x193b('0x1b0');_0x22bdfd[_0x193b('0xea')]+=0x1;_0x22bdfd['countglobal']+=0x1;ami[_0x193b('0x4b')](_0x193b('0x1b1'),ut[_0x193b('0x1a8')](_0x3af47d,_0x193b('0x1b2')));_0x99fae8[_0x193b('0xc7')](_0x22bdfd)[_0x193b('0xb9')](loggerCatch(_0x193b('0x1b3')));if(_0x99fae8[_0x193b('0x193')](0x5,_0x3af47d,_0x5ae546)){if(_0x22bdfd[_0x193b('0xea')]>=_0x5ae546[_0x193b('0x198')]){_0x99fae8[_0x193b('0xf2')](_0x22bdfd,_0xbf30e1,_0x1fb02d,_0x193b('0x1b4'));}else{_0x99fae8[_0x193b('0xf0')](_0x22bdfd,_0xbf30e1,_0x1fb02d,'reason\x205\x20busy');}}break;case'8':_0x5ae546['outboundCongestionCallsDay']+=0x1;_0x22bdfd[_0x193b('0xa8')]=0x8;_0x22bdfd[_0x193b('0xdf')]=_0x193b('0x1b5');_0x22bdfd[_0x193b('0xeb')]+=0x1;_0x22bdfd[_0x193b('0xe7')]+=0x1;ami[_0x193b('0x4b')]('custom:agentcongestion',ut[_0x193b('0x1a8')](_0x3af47d,'congestion'));_0x99fae8[_0x193b('0xc7')](_0x22bdfd)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x99fae8[_0x193b('0x193')](0x8,_0x3af47d,_0x5ae546)){if(_0x22bdfd[_0x193b('0xeb')]>=_0x5ae546['dialCongestionMaxRetry']){_0x99fae8[_0x193b('0xf2')](_0x22bdfd,_0xbf30e1,_0x1fb02d,_0x193b('0x1b6'));}else{_0x99fae8['stateGlobal'](_0x22bdfd,_0xbf30e1,_0x1fb02d,_0x193b('0x1b6'));}}break;case'11':_0x5ae546[_0x193b('0x1b7')]+=0x1;_0x22bdfd[_0x193b('0xa8')]=0xb;_0x22bdfd[_0x193b('0xdf')]=_0x193b('0x1b8');_0x22bdfd[_0x193b('0xef')]+=0x1;_0x22bdfd[_0x193b('0xe7')]+=0x1;_0x99fae8[_0x193b('0xc7')](_0x22bdfd)[_0x193b('0xb9')](loggerCatch(_0x193b('0x11e')));if(_0x99fae8[_0x193b('0x193')](0xb,_0x3af47d,_0x5ae546)){if(_0x22bdfd['countabandonedretry']>=_0x5ae546['dialAbandonedMaxRetry']){_0x99fae8[_0x193b('0xf2')](_0x22bdfd,_0xbf30e1,_0x1fb02d,'reason\x2011\x20abandoned');}else{_0x99fae8[_0x193b('0xf0')](_0x22bdfd,_0xbf30e1,_0x1fb02d,'reason\x2011\x20abandoned');}}break;case'20':_0x5ae546['outboundRejectCallsDay']+=0x1;_0x22bdfd['state']=0x14;_0x22bdfd['statedesc']=_0x193b('0x1b9');_0x22bdfd[_0x193b('0xfe')]+=0x1;_0x22bdfd[_0x193b('0xe7')]+=0x1;ami[_0x193b('0x4b')](_0x193b('0x1ba'),ut[_0x193b('0x1a8')](_0x3af47d,'agentreject'));_0x99fae8[_0x193b('0xc7')](_0x22bdfd)[_0x193b('0xb9')](loggerCatch(_0x193b('0x1bb')));if(_0x99fae8[_0x193b('0x193')](0x14,_0x3af47d,_0x5ae546)){if(_0x22bdfd[_0x193b('0xfe')]>=_0x5ae546[_0x193b('0x1a2')]){_0x99fae8['createStateFinal'](_0x22bdfd,_0xbf30e1,_0x1fb02d,_0x193b('0x1bc'));}else{_0x99fae8['stateGlobal'](_0x22bdfd,_0xbf30e1,_0x1fb02d,_0x193b('0x1bc'));}}break;default:_0x5ae546[_0x193b('0x1bd')]+=0x1;_0x22bdfd['state']=0xc;_0x22bdfd['statedesc']=_0x3e0dfe[_0x193b('0x10a')];_0x99fae8['createHistory'](_0x22bdfd)[_0x193b('0xb9')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x99fae8[_0x193b('0x193')](_0x3e0dfe[_0x193b('0x10a')],_0x3af47d,_0x5ae546)){if(_0x22bdfd[_0x193b('0xea')]+_0x22bdfd['countcongestionretry']+_0x22bdfd[_0x193b('0xec')]+_0x22bdfd['countnosuchnumberretry']+_0x22bdfd['countdropretry']+_0x22bdfd['countabandonedretry']+_0x22bdfd['countmachineretry']+_0x22bdfd[_0x193b('0xfe')]>=_0x5ae546[_0x193b('0x194')]){_0x99fae8['stateGlobal'](_0x22bdfd,_0xbf30e1,_0x1fb02d,_0x3e0dfe[_0x193b('0x10a')]);}else{_0x99fae8[_0x193b('0xf2')](_0x22bdfd,_0xbf30e1,_0x1fb02d,_0x3e0dfe['reason']);}}}});};Dialer['prototype']['stateGlobal']=function(_0x274b0f,_0x39bf49,_0x108ccd,_0x7e0007){var _0x45cbbe=new Final(_0x274b0f);_0x45cbbe[_0x193b('0xa8')]=0xf;_0x45cbbe['statedesc']=_0x193b('0x1be');this[_0x193b('0xf2')](_0x45cbbe,_0x39bf49,_0x108ccd,_0x7e0007);};Dialer[_0x193b('0x1b')]['createStateFinal']=function(_0x151bd5,_0x1744b3,_0x48b463,_0x163733){this['moveContactManagedDialer'](_0x151bd5)[_0x193b('0xb7')](function(_0xb9f0e1){return _0x1744b3(msgResponse(_0x193b('0x1a5'),_0x193b('0xd1'),_0x163733));})['catch'](function(_0x2c71b4){return _0x48b463(msgResponse('[moveContactManagedDialer][0]',_0x193b('0x139'),_0x193b('0x1bf')));});};Dialer[_0x193b('0x1b')][_0x193b('0xa')]=function(_0x307a65){var _0x24b7d0=this;var _0x5e5369=_0x307a65[_0x193b('0x1c0')]/0x64;var _0x26ff4d=_0x307a65[_0x193b('0x62')]/(_0x307a65[_0x193b('0x62')]+_0x307a65['outboundAnswerCallsDay']);var _0x4d82b6=Math[_0x193b('0x1c1')](_0x307a65[_0x193b('0x6f')]*(_0x307a65['predictiveIntervalMaxThreshold']/0x64));var _0x541ce9=Math[_0x193b('0x1c1')](_0x307a65[_0x193b('0x6f')]*(_0x307a65[_0x193b('0x1c2')]/0x64));var _0xa2669f=_0x307a65['available']+_0x307a65[_0x193b('0x52')];var _0x37da4a=Math[_0x193b('0x1c3')](_0x307a65['erlangCalls']*_0x307a65[_0x193b('0x72')]*_0x307a65['predictiveIntervalHitRate']*_0x307a65[_0x193b('0x6e')]);if(_['isUndefined'](_0x307a65[_0x193b('0x27')])){if(!_[_0x193b('0x85')](_0x307a65[_0x193b('0x26')])){_0x307a65['startPredictive']=undefined;loggerPredictive[_0x193b('0x98')](_0x193b('0x1c4'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x193b('0x85')](_0x307a65[_0x193b('0x92')])){loggerPredictive[_0x193b('0x98')](_0x193b('0x1c4'),_0x193b('0x1c5'));clearInterval(_0x307a65['handlePredictive']);_0x307a65[_0x193b('0x92')]=undefined;}_0x307a65[_0x193b('0x27')]=moment()[_0x193b('0x76')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x193b('0x7b')](_0x307a65['name'],_0x193b('0x1c6'),_0x307a65['startProgressive']);this['handlePower'](_0x307a65,0x1);}else if(ifInterval(_0x307a65[_0x193b('0x1c7')],_0x307a65[_0x193b('0x27')])){this[_0x193b('0x14e')](_0x307a65,0x1);loggerPredictiveCalls[_0x193b('0x7b')]('[startMethodPredictive][StartProgressive][Loop]',_0x307a65[_0x193b('0x27')],_0x307a65[_0x193b('0x3f')]);_0x307a65['erlangCalls']=0x0;_0x307a65[_0x193b('0x6c')]=0x0;}else if(_0x5e5369<_0x26ff4d&&_0x307a65[_0x193b('0x1c8')]===_0x193b('0x1c9')){freeVariablesPredictive(_0x307a65);loggerPredictive[_0x193b('0x7b')](_0x193b('0x1ca'),_0x193b('0x1cb'),_0x26ff4d,'startProgressive',_0x307a65[_0x193b('0x3f')]);}else if(_0x37da4a<_0x307a65[_0x193b('0x6c')]&&_0x307a65[_0x193b('0x1c8')]===_0x193b('0x1c9')){freeVariablesPredictive(_0x307a65);loggerPredictive[_0x193b('0x7b')](_0x193b('0x1cc'),_0x193b('0x1cd'),_0x37da4a,_0x193b('0x1ce'),_0x307a65[_0x193b('0x6c')],'startProgressive',_0x307a65[_0x193b('0x3f')]);}else if(!ifInterval(_0x307a65[_0x193b('0x1c7')],_0x307a65[_0x193b('0x27')])&&_[_0x193b('0x85')](_0x307a65[_0x193b('0x26')])&&!_[_0x193b('0x85')](_0x307a65[_0x193b('0x27')])){_0x307a65[_0x193b('0x26')]=moment()[_0x193b('0x76')](_0x193b('0x113'));loggerPredictive['info'](_0x307a65[_0x193b('0x3f')],_0x193b('0x1cf'),_0x307a65[_0x193b('0x26')]);this[_0x193b('0xbd')](_0x307a65[_0x193b('0x1c7')])['then'](this[_0x193b('0x1d0')](_0x307a65))['then'](mergeDataErlangB(_0x307a65))[_0x193b('0xb7')](this[_0x193b('0x1d1')](_0x307a65))[_0x193b('0xb9')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x307a65));}else if(!ifInterval(_0x307a65[_0x193b('0x1c7')],_0x307a65[_0x193b('0x26')])){_0x307a65[_0x193b('0x6c')]=0x0;_0x307a65[_0x193b('0x26')]=moment()[_0x193b('0x76')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x193b('0x7b')](_0x307a65[_0x193b('0x3f')],'recalculate\x20predictive\x20at',_0x307a65[_0x193b('0x26')]);clearInterval(_0x307a65[_0x193b('0x92')]);_0x307a65[_0x193b('0x92')]=undefined;this['averageHandleTime'](_0x307a65['dialPredictiveInterval'])[_0x193b('0xb7')](this['getDataPredictive'](_0x307a65))[_0x193b('0xb7')](mergeDataErlangB(_0x307a65))[_0x193b('0xb7')](this[_0x193b('0x1d1')](_0x307a65))[_0x193b('0xb9')](loggerCatchPredictive(_0x193b('0x1d2'),_0x307a65));}else if(_0x307a65[_0x193b('0x6f')]&&_0xa2669f<_0x307a65[_0x193b('0x6f')]-_0x541ce9){freeVariablesPredictive(_0x307a65);loggerPredictive['info'](_0x307a65[_0x193b('0x3f')],_0x193b('0x1d3'),_0xa2669f,_0x193b('0x1d4'),_0x307a65[_0x193b('0x6f')],'-',_0x541ce9,'=',_0x307a65[_0x193b('0x6f')]-_0x541ce9,')');}else if(_0x307a65[_0x193b('0x6f')]&&_0xa2669f>_0x307a65['predictiveIntervalAvailable']+_0x4d82b6){freeVariablesPredictive(_0x307a65);loggerPredictive['info'](_0x307a65[_0x193b('0x3f')],_0x193b('0x1d3'),_0xa2669f,')\x20are\x20more\x20than\x20threshold\x20(',_0x307a65[_0x193b('0x6f')],'+',_0x4d82b6,'=',_0x307a65['predictiveIntervalAvailable']+_0x4d82b6,')');}};Dialer[_0x193b('0x1b')][_0x193b('0x1d0')]=function(_0x49000b){var _0x4833c9=this;return function(_0x4b4281){return new BPromise(function(_0x5a42c6,_0x5b2f01){_['merge'](_0x49000b,_0x4b4281[0x0]);if(checkGetDataPredictive(_0x4b4281[0x0])){var _0x4dc1c4=_0x49000b[_0x193b('0x6f')]=_0x49000b[_0x193b('0x52')]+_0x49000b['available'];var _0x1101cc=_0x49000b[_0x193b('0x1c7')]*0x3c;var _0x1a2c18=_0x4b4281[0x0][_0x193b('0x68')]+_0x4b4281[0x0][_0x193b('0x82')];var _0x9300f=(_0x4b4281[0x0][_0x193b('0x67')]+_0x4b4281[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4b4281[0x0][_0x193b('0x69')])/_0x4b4281[0x0][_0x193b('0x70')];_0x49000b[_0x193b('0x6d')]=_0x9300f>0x0?_0x9300f:0x1;switch(_0x49000b[_0x193b('0x1c8')]){case _0x193b('0x1c9'):var _0x54b3df=_0x49000b[_0x193b('0x1c0')]/0x64;return _0x4833c9[_0x193b('0x1d5')](_0x4dc1c4,_0x1101cc,_0x1a2c18,_0x9300f,_0x54b3df)[_0x193b('0xb7')](function(_0x888fe9){return _0x5a42c6(_0x888fe9);});case _0x193b('0x1d6'):var _0x3d7768=_0x49000b['dialPredictiveOptimizationPercentage']/0x64;return _0x4833c9['busyFactor'](_0x4dc1c4,_0x1101cc,_0x1a2c18,_0x9300f,_0x3d7768)[_0x193b('0xb7')](function(_0x28e078){return _0x5a42c6(_0x28e078);});default:return _0x5b2f01(msgResponse(_0x193b('0x1d7'),_0x193b('0x139'),_0x193b('0x1d8')));}}else{return _0x5b2f01(msgResponse(_0x193b('0x1d7'),_0x193b('0x139'),_0x193b('0x1d9')));}});};};Dialer[_0x193b('0x1b')][_0x193b('0x1da')]=function(_0x3b17a8){var _0x5721f5=this;return function(_0x77cf94){return new BPromise(function(_0xbc0a7d,_0x44f68a){_[_0x193b('0xcc')](_0x3b17a8,_0x77cf94[0x0]);if(checkGetDataPredictive(_0x77cf94[0x0])){loggerPredictive[_0x193b('0x7b')](JSON[_0x193b('0x75')](_0x77cf94[0x0]));if(_0x3b17a8['dialPredictiveOptimization']===_0x193b('0x1c9')){return _0x5721f5[_0x193b('0xc3')](_0x3b17a8['id'])[_0x193b('0xb7')](function(_0x7684d7){var _0x25981d=_0x3b17a8[_0x193b('0x153')]-_0x7684d7[0x0][_0x193b('0x1db')];var _0x163248=_0x3b17a8['dialPredictiveInterval']*0x3c;var _0x5ec7c1=_0x77cf94[0x0][_0x193b('0x68')]+_0x77cf94[0x0][_0x193b('0x82')];var _0x1fb655=(_0x77cf94[0x0][_0x193b('0x67')]+_0x77cf94[0x0][_0x193b('0x6a')]+_0x77cf94[0x0][_0x193b('0x69')])/_0x77cf94[0x0][_0x193b('0x70')];var _0x3193a5=_0x3b17a8[_0x193b('0x1c0')]/0x64;_0x3b17a8[_0x193b('0x1dc')]=_0x7684d7[0x0][_0x193b('0x1db')]||0x0;_0x3b17a8['predictiveIntervalHitRate']=_0x1fb655>0x0?_0x1fb655:0x1;return _0x5721f5[_0x193b('0x1d5')](_0x25981d,_0x163248,_0x5ec7c1,_0x1fb655,_0x3193a5);})[_0x193b('0xb7')](function(_0xd23258){return _0xbc0a7d(_0xd23258);})['catch'](function(_0x5f4f6e){return _0x44f68a(msgResponse(_0x193b('0x1dd'),_0x193b('0x139'),JSON[_0x193b('0x75')](_0x5f4f6e)));});}if(_0x3b17a8['dialPredictiveOptimization']===_0x193b('0x1d6')){return _0x5721f5[_0x193b('0xc3')](_0x3b17a8['id'])[_0x193b('0xb7')](function(_0x28503a){var _0x1cdbb5=_0x3b17a8[_0x193b('0x153')]-_0x28503a[0x0]['outboundQueuePauses'];var _0x55d296=_0x3b17a8[_0x193b('0x1c7')]*0x3c;var _0x46fc4e=_0x77cf94[0x0][_0x193b('0x68')]+_0x77cf94[0x0][_0x193b('0x82')];var _0x6fc623=(_0x77cf94[0x0][_0x193b('0x67')]+_0x77cf94[0x0][_0x193b('0x6a')]+_0x77cf94[0x0][_0x193b('0x69')])/_0x77cf94[0x0][_0x193b('0x70')];var _0x1aa0df=_0x3b17a8[_0x193b('0x1c0')]/0x64;_0x3b17a8['predictiveIntervalPauses']=_0x28503a[0x0][_0x193b('0x1db')]||0x0;_0x3b17a8[_0x193b('0x6d')]=_0x6fc623>0x0?_0x6fc623:0x1;return _0x5721f5[_0x193b('0x1de')](_0x1cdbb5,_0x55d296,_0x46fc4e,_0x6fc623,_0x1aa0df);})[_0x193b('0xb7')](function(_0x498790){return _0xbc0a7d(_0x498790);})[_0x193b('0xb9')](function(_0x1ed6ee){return _0x44f68a(msgResponse(_0x193b('0x1dd'),_0x193b('0x139'),JSON[_0x193b('0x75')](_0x1ed6ee)));});}}else{return _0x44f68a(msgResponse(_0x193b('0x1d7'),_0x193b('0x139'),_0x193b('0x1d9')));}});};};Dialer[_0x193b('0x1b')][_0x193b('0x1d1')]=function(_0x1e2c85){var _0x322ac8=this;return function(){var _0x529eca=0x0;var _0xef161d=Math[_0x193b('0x1c3')](_0x1e2c85[_0x193b('0x8c')]*0x3e8);if(_0xef161d>0x0){_0xef161d=_0xef161d<0x64?0x64:_0xef161d;loggerPredictive[_0x193b('0x7b')](_0x1e2c85[_0x193b('0x3f')],_0x193b('0x1df'),_0xef161d,_0x193b('0x48'));_0x1e2c85[_0x193b('0x92')]=setInterval(function(){_0x322ac8[_0x193b('0x92')](_0x1e2c85);loggerPredictiveCalls['info'](_0x193b('0x1e0'),_0x529eca+=0x1);},_0xef161d);}else{loggerPredictive[_0x193b('0x7b')](_0x1e2c85[_0x193b('0x3f')],_0x193b('0x1e1'));}};};Dialer[_0x193b('0x1b')][_0x193b('0x1e2')]=function(_0x57d5f4,_0x370f89){var _0x1a1143=this;return function(_0x595921){if(_[_0x193b('0x45')](_0x595921)){if(_[_0x193b('0xad')](_0x370f89[_0x193b('0xce')])||!_0x370f89[_0x193b('0x1e3')]){if(_0x57d5f4[_0x193b('0x59')]==='booked'){_0x57d5f4[_0x193b('0x126')]=_[_0x193b('0x85')](_0x57d5f4['queueStatusComplete'])?!![]:_0x57d5f4[_0x193b('0x126')];var _0x346cc8=uuid['v4']();_0x1a1143[_0x193b('0x23')][_0x346cc8]=new Action(_0x57d5f4,_0x370f89,_0x346cc8);loggerBooked[_0x193b('0x7b')](_0x193b('0x1e4'),_0x346cc8,_0x193b('0x1e5'),JSON[_0x193b('0x75')](_0x57d5f4['queueStatusComplete']),_0x193b('0x1e6'),_0x57d5f4[_0x193b('0x3f')]);if(_0x57d5f4[_0x193b('0x126')]){_0x57d5f4[_0x193b('0x126')]=![];_0x1a1143[_0x193b('0x123')][_0x1a1143[_0x193b('0x23')][_0x346cc8][_0x193b('0xb3')]]=[];ami['Action']({'actionid':_0x346cc8,'action':_0x193b('0x1e7'),'queue':_0x57d5f4[_0x193b('0x3f')]})[_0x193b('0xb9')](function(_0x5e4631){_0x1a1143['updateOriginated'](_0x57d5f4);_0x1a1143[_0x193b('0xbf')]({'active':![],'ContactId':_0x1a1143['actions'][_0x346cc8]['ContactId'],'ListId':_0x1a1143['actions'][_0x346cc8]['ListId'],'VoiceQueueId':_0x1a1143[_0x193b('0x23')][_0x346cc8]['VoiceQueueId']||undefined,'CampaignId':_0x1a1143['actions'][_0x346cc8][_0x193b('0xcf')]||undefined})['catch'](loggerCatch(_0x193b('0x1e8')));delete _0x1a1143['actions'][_0x346cc8];});}else{loggerBooked[_0x193b('0x7b')](_0x193b('0x1e9'),JSON[_0x193b('0x75')](_0x57d5f4['queueStatusComplete']),_0x193b('0x1e6'),_0x57d5f4['name']);_0x1a1143[_0x193b('0xb2')](_0x57d5f4);_0x1a1143['rescheduleContact']({'active':![],'ContactId':_0x1a1143[_0x193b('0x23')][_0x346cc8][_0x193b('0xf6')],'ListId':_0x1a1143[_0x193b('0x23')][_0x346cc8][_0x193b('0xf7')],'VoiceQueueId':_0x1a1143[_0x193b('0x23')][_0x346cc8][_0x193b('0xf8')]||undefined,'CampaignId':_0x1a1143[_0x193b('0x23')][_0x346cc8][_0x193b('0xcf')]||undefined})[_0x193b('0xb9')](loggerCatch(_0x193b('0x1e8')));delete _0x1a1143[_0x193b('0x23')][_0x346cc8];}}else{return _0x1a1143[_0x193b('0x15e')](_0x57d5f4,_0x370f89);}}else{if(getDiff(_0x370f89[_0x193b('0x1ea')])<_0x57d5f4[_0x193b('0x1eb')]*0x3c){if(_0x370f89[_0x193b('0x1ec')]&&!_0x370f89[_0x193b('0x1ec')][_0x193b('0x1ed')]){_0x1a1143[_0x193b('0x94')]['run'](_0x370f89['id'])[_0x193b('0x1d')](function(){_0x1a1143[_0x193b('0xb2')](_0x57d5f4);});}else{_0x1a1143['unlockContact']({'active':![]},_0x370f89['id'],0x1)['finally'](function(){console[_0x193b('0x1ee')](_0x193b('0x1ef'));_0x1a1143[_0x193b('0xb2')](_0x57d5f4);});}}else{_0x57d5f4['outboundReCallsDay']+=0x1;_0x1a1143[_0x193b('0xb2')](_0x57d5f4);if(_0x57d5f4[_0x193b('0x1f0')]){_0x1a1143[_0x193b('0xbf')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x370f89[_0x193b('0xf6')],'ListId':_0x370f89[_0x193b('0xf7')],'VoiceQueueId':_0x370f89['VoiceQueueId']||undefined,'CampaignId':_0x370f89[_0x193b('0xcf')]||undefined})['catch'](loggerCatch(_0x193b('0x1f1')));_0x1a1143[_0x193b('0xc7')](createObjHistory(_0x57d5f4,_0x370f89,'RECALLINQUEUE',0x17,_0x193b('0x1f2')))[_0x193b('0xb9')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x1a1143[_0x193b('0xd7')](createObjHistory(_0x57d5f4,_0x370f89,_0x193b('0x1f3'),0x16,_0x193b('0x1f4')),_0x193b('0x1f5'),_0x193b('0x1f6'));}}}}else{_0x57d5f4[_0x193b('0x5d')]+=0x1;_0x1a1143[_0x193b('0xd7')](createObjHistory(_0x57d5f4,_0x370f89,_0x193b('0x1f7'),0xd,'Blacklist'),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw _0x193b('0x1f8');}};};Dialer[_0x193b('0x1b')][_0x193b('0x1f9')]=function(_0x46e448){var _0x42fb07=this;var _0x21ff40=[];var _0x196234=_0x46e448[_0x193b('0x1fa')]-_0x46e448[_0x193b('0x9c')]-_0x46e448['temp'];emitCampaignSummary(_0x46e448);if(_0x196234>0x0){if(_0x196234>this[_0x193b('0x22')]){_0x196234=this[_0x193b('0x22')];}_0x46e448[_0x193b('0x1fb')]+=_0x196234;this[_0x193b('0xc2')](_0x46e448['id'],_0x196234,_0x46e448[_0x193b('0x1fc')])[_0x193b('0xb7')](function(_0x385988){_0x46e448[_0x193b('0x1fb')]-=_0x196234;_0x46e448[_0x193b('0x1fb')]=_0x46e448[_0x193b('0x1fb')]>0x0?_0x46e448[_0x193b('0x1fb')]:0x0;if(!checkContactEmpty(_0x385988)){_0x46e448[_0x193b('0x3c')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x193b('0x7b')](_0x193b('0x1fd')+_0x46e448[_0x193b('0x3f')]);}else{_0x46e448[_0x193b('0x9c')]+=_0x385988[_0x193b('0x9a')];_0x46e448[_0x193b('0x3c')]=_0x193b('0x1fe');for(var _0x1db235=0x0;_0x1db235<_0x385988[_0x193b('0x9a')];_0x1db235+=0x1){_0x46e448['ivrTotalCallsDays']+=0x1;if(_[_0x193b('0xad')](_0x385988[_0x1db235])||_[_0x193b('0xad')](_0x385988[_0x1db235][_0x193b('0x162')])||_['isNil'](_0x385988[_0x1db235][_0x193b('0x162')]['phone'])){_0x42fb07[_0x193b('0x1ff')]('[actionOriginate]\x20',_0x46e448,_0x385988[_0x1db235]);}else{_0x42fb07[_0x193b('0xbb')](_[_0x193b('0xcd')](_0x385988[_0x1db235],['CampaignId',_0x193b('0x200')]))['then'](_0x42fb07[_0x193b('0x1e2')](_0x46e448,_0x385988[_0x1db235]))['catch'](_0x42fb07[_0x193b('0xca')](_0x193b('0x201'),_0x46e448));}}}})[_0x193b('0xb9')](loggerGetContactDialer(_0x193b('0x202'),_0x46e448,_0x196234));}};Dialer[_0x193b('0x1b')]['handlePower']=function(_0x20f532,_0x4a9e09){var _0x5272e5=this;var _0x3eabf4=[];var _0x4d750a=_0x4a9e09>=0x1?_0x4a9e09:0x1;var _0x2f24ef=[];if(_0x20f532[_0x193b('0x59')]===_0x193b('0x150')){_0x4d750a=0x1;}var _0x26e1f3=Math['floor'](_0x20f532[_0x193b('0xa2')]*_0x4d750a)-_0x20f532['originated']-_0x20f532['temp'];emitVoiceQueueSummary(_0x20f532);if(_0x20f532['dialLimitQueue']>0x0){var _0x403533=_0x20f532['dialLimitQueue']-_0x20f532['originated']-_0x20f532['talking']-_0x20f532['temp']-_0x20f532[_0x193b('0x4f')];if(_0x26e1f3>_0x403533){_0x26e1f3=_0x403533;}}if(_0x26e1f3>0x0){if(_0x20f532[_0x193b('0x59')]===_0x193b('0x150')){_0x26e1f3=0x1;}if(_0x26e1f3>this['maxNumberOriginate']){_0x26e1f3=this['maxNumberOriginate'];}_0x20f532[_0x193b('0x1fb')]+=_0x26e1f3;for(var _0x3b238f in this[_0x193b('0x20')]){if(this[_0x193b('0x20')][_0x193b('0x9b')](_0x3b238f)){if(this[_0x193b('0x20')][_0x3b238f][_0x193b('0xa8')]===_0x193b('0x203')&&this['agents'][_0x3b238f][_0x193b('0xaf')]===_0x193b('0xd5')){_0x3eabf4[_0x193b('0x124')](this[_0x193b('0x20')][_0x3b238f]['id']);}}}this[_0x193b('0xc0')](_0x20f532['id'],_0x3eabf4,_0x26e1f3,_0x20f532[_0x193b('0x1fc')])[_0x193b('0xb7')](function(_0x57c48a){_0x20f532[_0x193b('0x1fb')]-=_0x26e1f3;_0x20f532[_0x193b('0x1fb')]=_0x20f532[_0x193b('0x1fb')]>0x0?_0x20f532['temp']:0x0;if(!checkContactEmpty(_0x57c48a)){_0x5272e5['countReScheduled'](_0x20f532)[_0x193b('0xb7')](sendMessageReschedule(_0x20f532))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x20f532['originated']+=_0x57c48a['length'];_0x20f532[_0x193b('0x3c')]=_0x20f532[_0x193b('0x59')]==='booked'?_0x193b('0x16a'):_0x193b('0x1fe');for(var _0x7a3b5c=0x0;_0x7a3b5c<_0x57c48a['length'];_0x7a3b5c+=0x1){if(_[_0x193b('0xad')](_0x57c48a[_0x7a3b5c])||_['isNil'](_0x57c48a[_0x7a3b5c]['Contact'])||_[_0x193b('0xad')](_0x57c48a[_0x7a3b5c][_0x193b('0x162')][_0x193b('0x161')])){_0x5272e5[_0x193b('0x1ff')](_0x193b('0x204'),_0x20f532,_0x57c48a[_0x7a3b5c]);}else{_0x5272e5[_0x193b('0xb8')](_[_0x193b('0xcd')](_0x57c48a[_0x7a3b5c],['VoiceQueueId',_0x193b('0x200')]))[_0x193b('0xb7')](_0x5272e5[_0x193b('0x1e2')](_0x20f532,_0x57c48a[_0x7a3b5c]))[_0x193b('0xb9')](_0x5272e5['loggerHandler'](_0x193b('0x204'),_0x20f532));}}}})[_0x193b('0xb9')](loggerGetContactDialer(_0x193b('0x205'),_0x20f532,_0x26e1f3));}};Dialer[_0x193b('0x1b')][_0x193b('0x92')]=function(_0x2bfc71){var _0x35bf64=this;if(_0x2bfc71['dialLimitQueue']>0x0){var _0x1da384=_0x2bfc71[_0x193b('0x206')]-_0x2bfc71[_0x193b('0x9c')]-_0x2bfc71[_0x193b('0x52')];if(_0x1da384>0x0){this[_0x193b('0x207')](_0x2bfc71);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0x193b('0x207')](_0x2bfc71);}};Dialer['prototype'][_0x193b('0x207')]=function(_0x523ef2){var _0x51adcc=this;var _0x869521=[];_0x523ef2[_0x193b('0x9c')]+=0x1;for(var _0x2255a8 in this[_0x193b('0x20')]){if(this[_0x193b('0x20')][_0x193b('0x9b')](_0x2255a8)){if(this[_0x193b('0x20')][_0x2255a8]['state']==='not_inuse'&&this[_0x193b('0x20')][_0x2255a8][_0x193b('0xaf')]===_0x193b('0xd5')){_0x869521[_0x193b('0x124')](this['agents'][_0x2255a8]['id']);}}}this['getContactDialer'](_0x523ef2['id'],_0x869521,0x1,_0x523ef2[_0x193b('0x1fc')])[_0x193b('0xb7')](function(_0x2f3731){if(!checkContactEmpty(_0x2f3731)){checkContactLowerLimitOriginate(_0x523ef2,0x1,0x0);_0x51adcc[_0x193b('0xb5')](_0x523ef2)[_0x193b('0xb7')](sendMessageReschedule(_0x523ef2))[_0x193b('0xb9')](loggerCatch('[countReScheduled]\x20'));}else{_0x523ef2[_0x193b('0x3c')]=_0x193b('0x1fe');if(_[_0x193b('0xad')](_0x2f3731[0x0])||_[_0x193b('0xad')](_0x2f3731[0x0][_0x193b('0x162')])||_[_0x193b('0xad')](_0x2f3731[0x0][_0x193b('0x162')][_0x193b('0x161')])){_0x51adcc['emptyContact'](_0x193b('0x204'),_0x523ef2,_0x2f3731[0x0]);}else{_0x51adcc[_0x193b('0xb8')](_[_0x193b('0xcd')](_0x2f3731[0x0],[_0x193b('0xf8'),'Contact.phone']))[_0x193b('0xb7')](_0x51adcc[_0x193b('0x1e2')](_0x523ef2,_0x2f3731[0x0]))[_0x193b('0xb9')](_0x51adcc[_0x193b('0xca')]('[actionOriginatePredictive]\x20',_0x523ef2));}}})['catch'](loggerGetContactDialer(_0x193b('0x208'),_0x523ef2,0x1));emitVoiceQueueSummary(_0x523ef2);};Dialer[_0x193b('0x1b')][_0x193b('0x1d5')]=function(_0x3facbc,_0x48e2fd,_0xb4a8ed,_0x189bae,_0x3806e3,_0x41efe9){loggerPredictive[_0x193b('0x7b')](_0x193b('0x209'));loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3facbc);loggerPredictive['info'](_0x193b('0x20a'),_0x48e2fd);loggerPredictive['info'](_0x193b('0x20b'),_0xb4a8ed);loggerPredictive[_0x193b('0x7b')](_0x193b('0x20c'),_0x189bae);loggerPredictive[_0x193b('0x7b')](_0x193b('0x20d'),_0x3806e3);loggerPredictive[_0x193b('0x7b')](_0x193b('0x84'));return new BPromise(function(_0x3c505d,_0x4b4810){if(_0x3facbc<=0x0||isNaN(_0x3facbc)){return _0x4b4810(msgResponse('[abandonmentRate]',_0x193b('0x47'),_0x193b('0x20e')+_0x3facbc));}if(_0xb4a8ed<=0x0||isNaN(_0xb4a8ed)){return _0x4b4810(msgResponse('[abandonmentRate]',_0x193b('0x47'),_0x193b('0x20f')+_0xb4a8ed));}if(_0x189bae<=0x0||isNaN(_0x189bae)){return _0x4b4810(msgResponse(_0x193b('0x210'),_0x193b('0x47'),_0x193b('0x211')+_0x189bae));}if(_0x48e2fd<=0x0||isNaN(_0x48e2fd)){return _0x4b4810(msgResponse('[abandonmentRate]','Error',_0x193b('0x212')+_0x48e2fd));}if(_0x3806e3<=0x0||isNaN(_0x3806e3)){return _0x4b4810(msgResponse(_0x193b('0x210'),_0x193b('0x47'),_0x193b('0x213')+_0x3806e3));}_0x41efe9=_0x41efe9||0x0;var _0xdb2f84=0x1/_0xb4a8ed;var _0x564106=0x0;var _0x42f7c6=0x0;var _0x1296e5=0x0;var _0x3a3099=0x0;for(var _0x11b2f6=0x0;_0x1296e5<_0x3806e3;_0x11b2f6+=0x1){_0x42f7c6=_0x11b2f6/_0x48e2fd;_0x564106=(_0x189bae*_0x42f7c6+_0x41efe9)/_0xdb2f84;_0x1296e5=erlangb(_0x564106,_0x3facbc);_0x3a3099=_0x564106/_0x3facbc*(0x1-erlangb(_0x564106,_0x3facbc));}return _0x3c505d({'erlangCalls':_0x11b2f6,'erlangCallToSecond':_0x48e2fd/_0x11b2f6,'erlangAbandonmentRate':_0x1296e5,'erlangBusyFactor':_0x3a3099});});};Dialer[_0x193b('0x1b')][_0x193b('0x1de')]=function(_0x400583,_0x26f418,_0x3bf398,_0x2ca9a7,_0x538e81,_0x55ecb2){loggerPredictive[_0x193b('0x7b')](_0x193b('0x214'));loggerPredictive[_0x193b('0x7b')](_0x193b('0x215'),_0x400583);loggerPredictive['info'](_0x193b('0x20a'),_0x26f418);loggerPredictive['info'](_0x193b('0x20b'),_0x3bf398);loggerPredictive[_0x193b('0x7b')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2ca9a7);loggerPredictive['info'](_0x193b('0x216'),_0x538e81);loggerPredictive['info'](_0x193b('0x84'));return new BPromise(function(_0x7426cf,_0x41cc0d){if(_0x400583<=0x0||isNaN(_0x400583)){return _0x41cc0d(msgResponse(_0x193b('0x217'),_0x193b('0x47'),_0x193b('0x20e')+_0x400583));}if(_0x3bf398<=0x0||isNaN(_0x3bf398)){return _0x41cc0d(msgResponse(_0x193b('0x217'),_0x193b('0x47'),'Ts\x20=\x20'+_0x3bf398));}if(_0x2ca9a7<=0x0||isNaN(_0x2ca9a7)){return _0x41cc0d(msgResponse(_0x193b('0x217'),_0x193b('0x47'),_0x193b('0x211')+_0x2ca9a7));}if(_0x26f418<=0x0||isNaN(_0x26f418)){return _0x41cc0d(msgResponse(_0x193b('0x217'),_0x193b('0x47'),'interval\x20=\x20'+_0x26f418));}if(_0x538e81<=0x0||isNaN(_0x538e81)){return _0x41cc0d(msgResponse('[busyFactor]','Error',_0x193b('0x218')+_0x538e81));}_0x55ecb2=_0x55ecb2||0x0;var _0x2323c2=0x1/_0x3bf398;var _0x3f4718=0x0;var _0x2d0846=0x0;var _0x25f2f1=0x0;var _0x258226=0x0;for(var _0x4c05c7=0x0;_0x258226<_0x538e81;_0x4c05c7+=0x1){_0x2d0846=_0x4c05c7/_0x26f418;_0x3f4718=(_0x2ca9a7*_0x2d0846+_0x55ecb2)/_0x2323c2;_0x25f2f1=erlangb(_0x3f4718,_0x400583);_0x258226=_0x3f4718/_0x400583*(0x1-erlangb(_0x3f4718,_0x400583));}return _0x7426cf({'erlangCalls':_0x4c05c7,'erlangCallToSecond':_0x26f418/_0x4c05c7,'erlangAbandonmentRate':_0x25f2f1,'erlangBusyFactor':_0x258226});});};module[_0x193b('0x219')]=Dialer; \ No newline at end of file +var _0x580a=['syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','command','iftime\x20%s,%s','timezones','content','indexOf','true','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','dialMethod','progressive','dialPowerLevel','predictive','handlePower','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialTimezone','checkIfTimeIntervals','[syncQueueSummary]','dialGlobalInterval','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','object','originate','Contact','phone','getCaller','\x22agi://%s/square,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','NONE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','responsetime','response','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','evt\x20is\x20undefine','custom:agentnosuchnumber','stateGlobal','reason\x200\x20no\x20such\x20number....','buildObj','noanswer','[syncAgentComplete][createHistory][3]','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','reason','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','abandonmentRate','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','Queue:\x20','dialRecallMeTimeout','Agent','voicePause','log','Contact\x20updated','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','countReScheduled','[countReScheduled]\x20','ACTIVE','emptyContact','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','reachable','RUNNING','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','moment','md5','ioredis','../../../config/logger','dialer','booked','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','startProgressive','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','isUndefined','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','message','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','abandoned','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','startPredictive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','waiting','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','endtime','starttime','loopClearZombieChannels','clearZombieChannels','uniqueId','[uniqueid]','[actions]','isNil','Action','status','catch','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','resolve','then','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','pick','ContactId','ListId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','unmonitored','uniqueid','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','state','statedesc','HangupInAMD','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','membername','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','countnoanswerretry','countnosuchnumberretry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','dialQueueProject','cause-txt','agent','agiafterat','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','dialQueueTimeout','Drop','TIMEOUT','dialQueueProject2','dialDropRetryFrequency','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','CALLEREXIT','dialAbandonedMaxRetry','countabandonedretry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','channel','actionid','strategy','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','syncQueueStatusComplete','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]'];(function(_0x43f0d3,_0x529d98){var _0x459008=function(_0x1bb3d6){while(--_0x1bb3d6){_0x43f0d3['push'](_0x43f0d3['shift']());}};_0x459008(++_0x529d98);}(_0x580a,0xda));var _0xa580=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x580a[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xa580('0x0'));var _=require(_0xa580('0x1'));var BPromise=require('bluebird');var uuid=require(_0xa580('0x2'));var moment=require(_0xa580('0x3'));var rr=require('rr');var md5=require(_0xa580('0x4'));var Redis=require(_0xa580('0x5'));var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0xa580('0x6'))(_0xa580('0x7'));var loggerBooked=require(_0xa580('0x6'))(_0xa580('0x8'));var loggerPredictive=require(_0xa580('0x6'))('predictive');var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0xa580('0x6'))(_0xa580('0x9'));var ami=require(_0xa580('0xa'));config[_0xa580('0xb')]=_[_0xa580('0xc')](config[_0xa580('0xb')],{'host':_0xa580('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa580('0xb')]));var cmHopper=require(_0xa580('0xe'));var cmHopperFinal=require(_0xa580('0xf'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xa580('0x10'));var voiceQueueRt=require(_0xa580('0x11'));var Action=require(_0xa580('0x12'));var History=require(_0xa580('0x13'));var Final=require(_0xa580('0x14'));var AgentComplete=require(_0xa580('0x15'));var QueueCallerAbandon=require(_0xa580('0x16'));var Hangup=require('./hangup');var ipAgi=process[_0xa580('0x17')][_0xa580('0x18')]||_0xa580('0x19');var strategy={'rrmemory':_0xa580('0x1a'),'roundrobin':_0xa580('0x1b')};var Sequence=function(){};Sequence[_0xa580('0x1c')][_0xa580('0x1d')]=function(_0x354fc4){this[_0xa580('0x1e')]=this['tail']?this[_0xa580('0x1e')][_0xa580('0x1f')](_0x354fc4):_0x354fc4();};function Dialer(_0x357e64,_0x252104){this[_0xa580('0x20')]=new Sequence();this['preview']=_0x252104;this[_0xa580('0x21')]=_0x357e64[_0xa580('0x21')];this[_0xa580('0x22')]=_0x357e64[_0xa580('0x22')];this[_0xa580('0x23')]=_0x357e64[_0xa580('0x23')];this[_0xa580('0x24')]=_0x357e64['trunks'];this[_0xa580('0x25')]=config[_0xa580('0x25')]||0x2;this[_0xa580('0x26')]={};this[_0xa580('0x27')]={};this['contactsId']={};this['uniqueId']={};this['optionPredictive']={};this['startPredictive']={};this[_0xa580('0x28')]={};this['ivrOriginated']={};this[_0xa580('0x29')]={};this[_0xa580('0x2a')]={};ami['on'](_0xa580('0x2b'),this['syncAgentConnect'][_0xa580('0x2c')](this));ami['on'](_0xa580('0x2d'),this[_0xa580('0x2e')]['bind'](this));ami['on'](_0xa580('0x2f'),this[_0xa580('0x30')][_0xa580('0x2c')](this));ami['on']('agentcomplete',this[_0xa580('0x31')][_0xa580('0x2c')](this));ami['on'](_0xa580('0x32'),this['syncQueueSummary'][_0xa580('0x2c')](this));ami['on'](_0xa580('0x33'),this[_0xa580('0x34')]['bind'](this));ami['on'](_0xa580('0x35'),this[_0xa580('0x36')]['bind'](this));ami['on']('varset',this[_0xa580('0x37')][_0xa580('0x2c')](this));ami['on'](_0xa580('0x38'),this[_0xa580('0x39')][_0xa580('0x2c')](this));ami['on'](_0xa580('0x3a'),this['syncQueueStatusComplete'][_0xa580('0x2c')](this));this[_0xa580('0x3b')]();this['loopClearZombieChannels']();}function isNotNull(_0x4e7ef2){return _0x4e7ef2!==null&&!_[_0xa580('0x3c')](_0x4e7ef2);}function checkIsLoggedIn(_0x1e3f1e,_0x190294){return function(){if(_0x190294<=0x0){_0x1e3f1e['message']=_0xa580('0x3d');throw _0x1e3f1e[_0xa580('0x3e')]+_0xa580('0x3f');}};}function isActive(_0x5af69b){return _0x5af69b;}function checkIsActive(_0x469840,_0x3c242d){return function(){if(!isActive(_0x3c242d)){_0x469840['message']=_0xa580('0x40');throw _0x469840['name']+_0xa580('0x41');}};}function checkInterval(_0x1cabff){return function(){if(!isNotNull(_0x1cabff['Interval'])){_0x1cabff[_0xa580('0x42')]=_0xa580('0x43');throw _0x1cabff[_0xa580('0x3e')]+_0xa580('0x44');}if(!isNotNull(_0x1cabff[_0xa580('0x45')][_0xa580('0x46')])){_0x1cabff[_0xa580('0x42')]=_0xa580('0x43');throw _0x1cabff[_0xa580('0x3e')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xa580('0x47')](_0x1cabff[_0xa580('0x45')][_0xa580('0x46')]))){_0x1cabff[_0xa580('0x42')]='INTERVAL_IS_NULL';throw _0x1cabff['name']+_0xa580('0x44');}};}function msgResponse(_0x5b7b7c,_0x23633f,_0x2f4647){return{'action':_0x5b7b7c,'response':_0x23633f,'message':_0x2f4647,'stack':_0x2f4647};}function myreject(_0x53342d){return function(_0x277893){return _0x53342d(msgResponse(_0xa580('0x48'),_0xa580('0x49'),JSON[_0xa580('0x4a')](_0x277893)));};}function getSeconds(_0x284da3,_0xa01831){var _0x5a53ff=moment(_0x284da3)[_0xa580('0x4b')](0x0);var _0x5c0629=moment(_0xa01831)[_0xa580('0x4b')](0x0);return _0x5a53ff[_0xa580('0x4c')](_0x5c0629,_0xa580('0x4d'));}function emit(_0x885544,_0x333387,_0x222197){io['to'](_0x885544)[_0xa580('0x4e')](_0x333387,_0x222197);}function emitVoiceQueueSummary(_0x350c1a){if(_0x350c1a[_0xa580('0x4f')]===_0xa580('0x50')){var _0x2e2025={'id':_0x350c1a['id'],'name':_0x350c1a[_0xa580('0x3e')],'strategy':_0x350c1a['strategy'],'answered':_0x350c1a[_0xa580('0x51')],'available':_0x350c1a[_0xa580('0x52')],'loggedIn':_0x350c1a[_0xa580('0x53')],'pTalking':_0x350c1a[_0xa580('0x54')],'sumBillable':_0x350c1a[_0xa580('0x55')],'sumDuration':_0x350c1a[_0xa580('0x56')],'sumHoldTime':_0x350c1a[_0xa580('0x57')]||0x0,'talking':_0x350c1a['talking'],'total':_0x350c1a[_0xa580('0x58')],'type':_0x350c1a[_0xa580('0x4f')],'unmanaged':_0x350c1a[_0xa580('0x59')],'abandoned':_0x350c1a[_0xa580('0x5a')],'waiting':_0x350c1a['waiting'],'loggedInDb':_0x350c1a['loggedInDb'],'dialActive':_0x350c1a[_0xa580('0x5b')],'dialMethod':_0x350c1a['dialMethod'],'dialOriginateCallerIdName':_0x350c1a[_0xa580('0x5c')],'dialOriginateCallerIdNumber':_0x350c1a[_0xa580('0x5d')],'dialOriginateTimeout':_0x350c1a[_0xa580('0x5e')],'dialPrefix':_0x350c1a['dialPrefix'],'outboundAnswerAgiCallsDay':_0x350c1a[_0xa580('0x5f')],'outboundAnswerCallsDay':_0x350c1a[_0xa580('0x60')],'outboundBlacklistCallsDay':_0x350c1a[_0xa580('0x61')],'outboundBusyCallsDay':_0x350c1a['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x350c1a['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x350c1a['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x350c1a[_0xa580('0x62')],'outboundDropCallsDayTimeout':_0x350c1a[_0xa580('0x63')],'outboundNoAnswerCallsDay':_0x350c1a[_0xa580('0x64')],'outboundNoSuchCallsDay':_0x350c1a[_0xa580('0x65')],'outboundOriginateFailureCallsDay':_0x350c1a[_0xa580('0x66')],'outboundReCallsDay':_0x350c1a['outboundReCallsDay'],'outboundRejectCallsDay':_0x350c1a[_0xa580('0x67')],'outboundUnknownCallsDay':_0x350c1a[_0xa580('0x68')],'predictiveIntervalAnsweredCalls':_0x350c1a['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x350c1a[_0xa580('0x69')],'predictiveIntervalAvgTalktime':_0x350c1a['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x350c1a[_0xa580('0x6a')],'predictiveIntervalDroppedCallsTimeout':_0x350c1a['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x350c1a[_0xa580('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0x350c1a[_0xa580('0x6c')],'predictiveIntervalHitRate':_0x350c1a[_0xa580('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x350c1a[_0xa580('0x6e')],'predictiveIntervalPauses':_0x350c1a[_0xa580('0x6f')],'predictiveIntervalAvailable':_0x350c1a[_0xa580('0x70')],'predictiveIntervalTotalCalls':_0x350c1a[_0xa580('0x71')],'message':_0x350c1a['message'],'originated':_0x350c1a[_0xa580('0x72')],'erlangCalls':_0x350c1a[_0xa580('0x73')],'erlangCallToSecond':_0x350c1a[_0xa580('0x74')],'erlangAbandonmentRate':_0x350c1a[_0xa580('0x75')],'erlangBusyFactor':_0x350c1a[_0xa580('0x76')],'startPredictive':_0x350c1a['startPredictive'],'startProgressive':_0x350c1a[_0xa580('0x28')]};if(_0x350c1a['Trunk']){_0x2e2025[_0xa580('0x77')]={'id':_0x350c1a[_0xa580('0x77')]['id'],'name':_0x350c1a[_0xa580('0x77')][_0xa580('0x3e')],'active':_0x350c1a['Trunk'][_0xa580('0x78')],'callerid':_0x350c1a[_0xa580('0x77')][_0xa580('0x79')]};}if(_0x350c1a[_0xa580('0x45')]){_0x2e2025[_0xa580('0x45')]={'id':_0x350c1a['Interval']['id'],'name':_0x350c1a[_0xa580('0x45')][_0xa580('0x3e')]};}var _0x2e4e33=md5(JSON[_0xa580('0x4a')](_0x2e2025));if(_0x350c1a[_0xa580('0x4')]!==_0x2e4e33){_0x350c1a[_0xa580('0x4')]=_0x2e4e33;emit(util[_0xa580('0x7a')]('voice:queue:%s',_0x2e2025[_0xa580('0x3e')]),_0xa580('0x7b'),_0x2e2025);}}}function emitCampaignSummary(_0x3f0057){if(_0x3f0057[_0xa580('0x4f')]===_0xa580('0x7c')){emit(util['format'](_0xa580('0x7d'),_0x3f0057[_0xa580('0x3e')]),_0xa580('0x7e'),_0x3f0057);}}function checkGetDataPredictive(_0x54c97e){if(isNotNull(_0x54c97e)){if(!_[_0xa580('0x47')](_0x54c97e)){loggerPredictive[_0xa580('0x7f')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xa580('0x7f')](_0xa580('0x80'),_0x54c97e[_0xa580('0x71')]);loggerPredictive['info'](_0xa580('0x81'),_0x54c97e[_0xa580('0x82')]);loggerPredictive[_0xa580('0x7f')](_0xa580('0x83'),_0x54c97e[_0xa580('0x84')]);loggerPredictive['info'](_0xa580('0x85'),_0x54c97e[_0xa580('0x6a')]);loggerPredictive[_0xa580('0x7f')](_0xa580('0x86'),_0x54c97e[_0xa580('0x69')]);loggerPredictive[_0xa580('0x7f')](_0xa580('0x87'),_0x54c97e[_0xa580('0x88')]);loggerPredictive['info'](_0xa580('0x89'));if(_0x54c97e[_0xa580('0x71')]>0x0){if(!_[_0xa580('0x3c')](_0x54c97e[_0xa580('0x88')])&&_0x54c97e[_0xa580('0x88')]>0x0){return!![];}else{loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}if(!_['isUndefined'](_0x54c97e[_0xa580('0x69')])&&_0x54c97e[_0xa580('0x69')]>0x0){return!![];}else{loggerPredictive[_0xa580('0x7f')](_0xa580('0x8a'));}}else{loggerPredictive[_0xa580('0x7f')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0xa580('0x8b'));}}else{loggerPredictive[_0xa580('0x7f')](_0xa580('0x8b'));}return![];}function mergeDataErlangB(_0x4e4585){return function(_0x1e2149){loggerPredictive['info'](_0xa580('0x8c'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e2149['erlangCalls']);loggerPredictive[_0xa580('0x7f')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e2149['erlangCallToSecond']);loggerPredictive[_0xa580('0x7f')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e2149['erlangAbandonmentRate']);loggerPredictive[_0xa580('0x7f')](_0xa580('0x8d'),_0x1e2149[_0xa580('0x76')]);loggerPredictive['info'](_0xa580('0x8e'),_0x1e2149[_0xa580('0x75')]);loggerPredictive[_0xa580('0x7f')](_0xa580('0x89'));_[_0xa580('0x8f')](_0x4e4585,_0x1e2149);};}function getDiff(_0x3fce23){var _0x55bc18=moment()['milliseconds'](0x0);var _0x21e94e=moment(_0x3fce23)[_0xa580('0x4b')](0x0);return _0x55bc18['diff'](_0x21e94e,_0xa580('0x4d'));}function ifInterval(_0x5d9873,_0x396991){if(_[_0xa580('0x3c')](_0x396991)){return![];}if(getDiff(_0x396991)<_0x5d9873*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x2fb53c){if(isNotNull(_0x2fb53c)){if(!_['isUndefined'](_0x2fb53c[_0xa580('0x28')])){_0x2fb53c['startProgressive']=undefined;loggerPredictive[_0xa580('0x7f')](_0x2fb53c[_0xa580('0x3e')],_0xa580('0x90'));}if(!_['isUndefined'](_0x2fb53c['startPredictive'])){_0x2fb53c[_0xa580('0x91')]=undefined;loggerPredictive['info'](_0x2fb53c[_0xa580('0x3e')],_0xa580('0x92'));}if(!_[_0xa580('0x3c')](_0x2fb53c[_0xa580('0x93')])){clearInterval(_0x2fb53c[_0xa580('0x93')]);_0x2fb53c[_0xa580('0x93')]=undefined;loggerPredictive['info'](_0x2fb53c[_0xa580('0x3e')],_0xa580('0x94'));}}}function erlangb(_0x5b8c12,_0x3724da){if(_0x3724da===0x0){return 0x0;}var _0x3c8b82=0x1;for(var _0x5a0faa=0x1;_0x5a0faa<=_0x3724da;_0x5a0faa+=0x1){_0x3c8b82=0x1+_0x3c8b82*_0x5a0faa/_0x5b8c12;}return 0x1/_0x3c8b82;}function isVoiceQueueOutbound(_0x4df2cf){return _0x4df2cf===_0xa580('0x50');}function isNotPreview(_0x377780){return _0x377780!==_0xa580('0x95');}function isCampaignIvr(_0x484586){return _0x484586==='ivr';}function getCallerId(_0x3a0054,_0x4e241e,_0x37210d){if(!_[_0xa580('0x3c')](_0x37210d)&&_0xa580('0x96')===typeof _0x37210d&&!_[_0xa580('0x47')](_0x37210d)){if(!_[_0xa580('0x3c')](_0x4e241e)&&_0xa580('0x96')===typeof _0x4e241e&&!_[_0xa580('0x47')](_0x4e241e)){return util['format'](_0xa580('0x97'),_0x4e241e,_0x37210d);}return util[_0xa580('0x7a')](_0xa580('0x97'),_0x37210d,_0x37210d);}if(!_['isUndefined'](_0x3a0054)&&_0xa580('0x96')===typeof _0x3a0054&&!_[_0xa580('0x47')](_0x3a0054)){return _0x3a0054;}return _0xa580('0x98');}function loggerCatchQueueSummary(_0x1501b1,_0x124cec){return function(_0x3e5bc9){freeVariablesPredictive(_0x124cec);emitVoiceQueueSummary(_0x124cec);emitCampaignSummary(_0x124cec);loggerSyncQueueSummary[_0xa580('0x99')](_0x1501b1,util[_0xa580('0x9a')](_0x3e5bc9,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4c5129,_0x224850){return function(_0x47bc81){loggerPredictive['error'](_0x224850[_0xa580('0x3e')],_0x4c5129);loggerPredictive[_0xa580('0x99')](_0x47bc81[_0xa580('0x9b')]);freeVariablesPredictive(_0x224850);};}function loggerCatch(_0x35e091){return function(_0xe906af){logger[_0xa580('0x99')](_0x35e091,util[_0xa580('0x9a')](_0xe906af,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x45a3ab){return _0x45a3ab&&!_[_0xa580('0x3c')](_0x45a3ab)&&_0x45a3ab[_0xa580('0x9c')]>0x0;}function decremetOriginate(_0x11f808){if(!_[_0xa580('0x3c')](_0x11f808)&&_0x11f808!==null){if(_0x11f808[_0xa580('0x9d')](_0xa580('0x72'))){if(_0x11f808['originated']>0x0){_0x11f808[_0xa580('0x72')]-=0x1;}else{logger[_0xa580('0x99')](_0xa580('0x9e'));}}}else{logger['error']('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x4ecb7c,_0x3ec737,_0x4273b4){if(_0x3ec737>_0x4273b4){for(var _0x6b5a78=0x0;_0x6b5a78<_0x3ec737-_0x4273b4;_0x6b5a78+=0x1){decremetOriginate(_0x4ecb7c);}}}function loggerGetContactDialer(_0x47e5a9,_0x379d28,_0x37ef1e){return function(_0x2cc0aa){checkContactLowerLimitOriginate(_0x379d28,_0x37ef1e,0x0);logger[_0xa580('0x99')](_0x47e5a9,util[_0xa580('0x9a')](_0x2cc0aa,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xfb92cd){return function(_0x2a129c){if(isNotNull(_0x2a129c)&&isNotNull(_0x2a129c[0x0])){if(_0x2a129c[0x0][_0xa580('0x9f')]>0x0){_0xfb92cd[_0xa580('0x42')]=_0xa580('0xa0');logger[_0xa580('0x7f')](_0xa580('0xa1')+_0xfb92cd['name'],_0x2a129c[0x0]['contactsRescheduled'],_0xa580('0xa2'));}else{_0xfb92cd[_0xa580('0x42')]=_0xa580('0xa3');logger[_0xa580('0x7f')](_0xa580('0xa4')+_0xfb92cd[_0xa580('0x3e')]);}}};}function notSendMessagesQueue(_0x2ed072){if(_0x2ed072[_0xa580('0xa5')]){freeVariablesPredictive(_0x2ed072);if(_0x2ed072['originated']===0x0&&_0x2ed072[_0xa580('0xa6')]===0x0&&_0x2ed072[_0xa580('0xa7')]===0x0&&(_0x2ed072[_0xa580('0x54')]||0x0)===0x0){_0x2ed072[_0xa580('0xa5')]=![];_0x2ed072['available']=0x0;_0x2ed072[_0xa580('0x42')]=_0xa580('0x40');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x2ed072[_0xa580('0x3e')],_0xa580('0xa8'));}else{_0x2ed072['message']=_0xa580('0xa9');loggerSyncQueueSummary['error'](_0xa580('0xaa'),_0x2ed072[_0xa580('0x3e')],_0xa580('0xab'));}emitVoiceQueueSummary(_0x2ed072);}}function notSendMessagesCampaign(_0x365b22){if(_0x365b22['sendMessageOneNotActive']){if(_0x365b22[_0xa580('0x72')]===0x0){_0x365b22[_0xa580('0xa5')]=![];_0x365b22[_0xa580('0x42')]=_0xa580('0x40');loggerSyncQueueSummary[_0xa580('0x99')](_0xa580('0xac'),_0x365b22[_0xa580('0x3e')],_0xa580('0xa8'));}else{_0x365b22['message']=_0xa580('0xa9');loggerSyncQueueSummary[_0xa580('0x99')](_0xa580('0xac'),_0x365b22[_0xa580('0x3e')],'is\x20disactive');}emitCampaignSummary(_0x365b22);}}function createObjHistory(_0x2083ab,_0x75f615,_0x145300,_0x1b85d5,_0x14bcbc){_0x2083ab[_0xa580('0x42')]=_0x145300;var _0x4dfcec=new Action(_0x2083ab,_0x75f615);var _0x4d42c6=new History(_0x4dfcec);_0x4d42c6['state']=_0x1b85d5;_0x4d42c6['statedesc']=_0x14bcbc;_0x4d42c6[_0xa580('0xad')]=_0x4dfcec[_0xa580('0xae')];return _0x4d42c6;}Dialer[_0xa580('0x1c')][_0xa580('0xaf')]=function(){var _0x1faf0e=this;setInterval(function(){_0x1faf0e[_0xa580('0xb0')](_0x1faf0e[_0xa580('0xb1')],_0xa580('0xb2'));_0x1faf0e[_0xa580('0xb0')](_0x1faf0e['actions'],_0xa580('0xb3'));},0x32c8);};Dialer[_0xa580('0x1c')][_0xa580('0xb0')]=function(_0x44f493,_0x28c845){var _0x186fc8=this;for(var _0x2e9380 in _0x44f493){if(_0x44f493[_0xa580('0x9d')](_0x2e9380)){this[_0xa580('0x20')][_0xa580('0x1d')](function(){if(!_[_0xa580('0xb4')](_0x44f493[_0x2e9380])){return ami[_0xa580('0xb5')]({'action':_0xa580('0xb6'),'channel':_0x44f493[_0x2e9380]['channel']})[_0xa580('0xb7')](function(_0x5a72d7){if(_0x5a72d7[_0xa580('0x42')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x44f493[_0x2e9380]&&_0x44f493[_0x2e9380][_0xa580('0x4f')]!==_0xa580('0x7c')){_0x186fc8[_0xa580('0xb8')](_0x186fc8['voiceQueues'][_0x44f493[_0x2e9380][_0xa580('0xb9')]]);logger[_0xa580('0x99')](_0xa580('0xba'),_0x28c845,_0x2e9380,_0x44f493[_0x2e9380][_0xa580('0xb9')]);delete _0x44f493[_0x2e9380];}if(_0x44f493[_0x2e9380]&&_0x44f493[_0x2e9380]['type']===_0xa580('0x7c')){_0x186fc8[_0xa580('0xb8')](_0x186fc8[_0xa580('0x22')][_0x44f493[_0x2e9380][_0xa580('0xb9')]]);logger[_0xa580('0x99')](_0xa580('0xbb'),_0x28c845,_0x2e9380,_0x44f493[_0x2e9380][_0xa580('0xb9')]);delete _0x44f493[_0x2e9380];}},0x2328);}});}});}}};Dialer[_0xa580('0x1c')]['countReScheduled']=function(_0x15dd9c){return BPromise[_0xa580('0xbc')]()[_0xa580('0xbd')](cmHopper['countReScheduled'](_0x15dd9c))[_0xa580('0xb7')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xa580('0x1c')]['checkIsBlackList']=function(_0x2fedfd){return BPromise[_0xa580('0xbc')]()[_0xa580('0xbd')](cmHopperBlack['checkIsBlackList'](_0x2fedfd))[_0xa580('0xb7')](loggerCatch(_0xa580('0xbe')));};Dialer[_0xa580('0x1c')][_0xa580('0xbf')]=function(_0xf5f428){return BPromise['resolve']()[_0xa580('0xbd')](cmHopperBlack[_0xa580('0xbf')](_0xf5f428))['catch'](loggerCatch(_0xa580('0xc0')));};Dialer[_0xa580('0x1c')][_0xa580('0xc1')]=function(_0x289148){return BPromise[_0xa580('0xbc')]()['then'](cmHopperHistory['avgHandleTime'](_0x289148))[_0xa580('0xb7')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xa580('0x1c')][_0xa580('0xc2')]=function(_0x3acc8f){return BPromise[_0xa580('0xbc')]()[_0xa580('0xbd')](cmHopper[_0xa580('0xc2')](_0x3acc8f))[_0xa580('0xb7')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0xa580('0x1c')][_0xa580('0xc3')]=function(_0x55dece,_0x12ee74,_0x2ada34){return BPromise[_0xa580('0xbc')]()[_0xa580('0xbd')](cmHopper[_0xa580('0xc3')](_0x55dece,_0x12ee74,_0x2ada34))[_0xa580('0xb7')](loggerCatch(_0xa580('0xc4')));};Dialer[_0xa580('0x1c')][_0xa580('0xc5')]=function(_0x44b0dc,_0x50b0fe,_0x4d06bd,_0x2c238a){return BPromise[_0xa580('0xbc')]()[_0xa580('0xbd')](cmHopper['getContactDialer'](_0x44b0dc,_0x50b0fe,_0x4d06bd,_0x2c238a))['catch'](loggerCatch(_0xa580('0xc6')));};Dialer[_0xa580('0x1c')][_0xa580('0xc7')]=function(_0x49546e,_0x46c1de,_0x21d00e){return BPromise['resolve']()['then'](cmHopper[_0xa580('0xc7')](_0x49546e,_0x46c1de,_0x21d00e))[_0xa580('0xb7')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xa580('0x1c')][_0xa580('0xc8')]=function(_0x135a4b){return BPromise[_0xa580('0xbc')]()[_0xa580('0xbd')](voiceQueueRt[_0xa580('0xc8')](_0x135a4b))[_0xa580('0xb7')](loggerCatch(_0xa580('0xc9')));};Dialer[_0xa580('0x1c')][_0xa580('0xca')]=function(_0x37f8ac){return BPromise[_0xa580('0xbc')]()[_0xa580('0xbd')](cmHopper[_0xa580('0xca')](_0x37f8ac))['catch'](loggerCatch(_0xa580('0xcb')));};Dialer[_0xa580('0x1c')][_0xa580('0xcc')]=function(_0x3791c4){return BPromise[_0xa580('0xbc')]()[_0xa580('0xbd')](cmHopperHistory['createHistory'](_0x3791c4))['catch'](loggerCatch('[createHistory]\x20'));};Dialer[_0xa580('0x1c')]['updateOriginated']=function(_0x1d2bb6){if(!_[_0xa580('0x3c')](_0x1d2bb6)&&_0x1d2bb6!==null){if(_0x1d2bb6[_0xa580('0x9d')](_0xa580('0x72'))){if(_0x1d2bb6[_0xa580('0x72')]>0x0){_0x1d2bb6[_0xa580('0x72')]-=0x1;}else{logger[_0xa580('0x99')](_0xa580('0xcd'));}}}else{logger['error'](_0xa580('0xce'));}};Dialer[_0xa580('0x1c')][_0xa580('0xcf')]=function(_0xc80661,_0x24709e){var _0x366caf=this;return function(_0x1e617d){_0x366caf[_0xa580('0xb8')](_0x24709e);logger['error'](_0xc80661,util[_0xa580('0x9a')](_0x1e617d,{'showHidden':![],'depth':null}));};};Dialer[_0xa580('0x1c')]['emptyContact']=function(_0x2b409a,_0x4d1929,_0xd39958){var _0x38a00d={'state':0x19,'statedesc':_0xa580('0xd0')};this[_0xa580('0xb8')](_0x4d1929);this[_0xa580('0xd1')](_[_0xa580('0x8f')](_0x38a00d,_[_0xa580('0xd2')](_0xd39958,[_0xa580('0xd3'),_0xa580('0xd4'),'UserId','VoiceQueueId',_0xa580('0xd5')])),_0xa580('0xd6'),_0xa580('0xd7'));logger['error'](_0x2b409a);};Dialer[_0xa580('0x1c')][_0xa580('0xd8')]=function(_0x479308){return _0x479308===_0xa580('0xd9');};Dialer[_0xa580('0x1c')][_0xa580('0xda')]=function(_0x1e966c){return!_[_0xa580('0x3c')](_0x1e966c)&&_0x1e966c&&!_[_0xa580('0x3c')](_0x1e966c[_0xa580('0x3e')])&&!_[_0xa580('0x3c')](_0x1e966c[_0xa580('0x78')])&&_0x1e966c[_0xa580('0x78')]&&(this['trunks'][util[_0xa580('0x7a')](_0xa580('0xdb'),_0x1e966c[_0xa580('0x3e')])][_0xa580('0xb6')]==='reachable'||this[_0xa580('0x24')][util[_0xa580('0x7a')](_0xa580('0xdb'),_0x1e966c['name'])][_0xa580('0xb6')]===_0xa580('0xdc'));};Dialer[_0xa580('0x1c')]['saveInDb']=function(_0x12940e,_0xe651fa,_0x5e88f7){this['createHistory'](_0x12940e)[_0xa580('0xb7')](loggerCatch(_0xe651fa));this['moveContactManagedDialer'](_0x12940e)[_0xa580('0xb7')](loggerCatch(_0x5e88f7));};Dialer[_0xa580('0x1c')]['syncVarSet']=function(_0x4a67dd){var _0x3ff8db=this['uniqueId'][_0x4a67dd[_0xa580('0xdd')]];var _0x311014;if(!_[_0xa580('0xb4')](_0x4a67dd)&&!_[_0xa580('0xb4')](_0x4a67dd[_0xa580('0xde')])&&!_[_0xa580('0xb4')](_0x4a67dd[_0xa580('0xde')]['amdstatus'])&&_0x4a67dd[_0xa580('0xdf')]===_0xa580('0xe0')&&_0x3ff8db){if(_0x3ff8db[_0xa580('0x4f')]!==_0xa580('0x7c')&&this[_0xa580('0x21')][_0x3ff8db[_0xa580('0xb9')]][_0xa580('0xe1')]&&_0x4a67dd[_0xa580('0xe2')]===_0xa580('0xe3')){delete this[_0xa580('0xb1')][_0x4a67dd[_0xa580('0xdd')]];this[_0xa580('0xb8')](this[_0xa580('0x21')][_0x3ff8db[_0xa580('0xb9')]]);this[_0xa580('0x21')][_0x3ff8db['queue']]['outboundAnswerCallsDay']+=0x1;this[_0xa580('0x21')][_0x3ff8db[_0xa580('0xb9')]][_0xa580('0x5f')]+=0x1;_0x311014=new Hangup(_0x3ff8db,_0x4a67dd);_0x311014[_0xa580('0xe4')]=0x12;_0x311014[_0xa580('0xe5')]=_0xa580('0xe6');_0x311014['membername']=_0xa580('0xe7');this['saveInDb'](_0x311014,_0xa580('0xe8'),_0xa580('0xe9'));}if(_0x3ff8db['type']!==_0xa580('0x7c')&&this[_0xa580('0x21')][_0x3ff8db['queue']][_0xa580('0xe1')]&&_0x4a67dd[_0xa580('0xe2')]===_0xa580('0xea')){var _0x3804ce=this;return new BPromise(function(_0x54c7a2,_0x2c23c9){delete _0x3804ce['uniqueId'][_0x4a67dd['uniqueid']];_0x3804ce['updateOriginated'](_0x3804ce[_0xa580('0x21')][_0x3ff8db[_0xa580('0xb9')]]);_0x3804ce['voiceQueues'][_0x3ff8db['queue']][_0xa580('0x60')]+=0x1;_0x3804ce[_0xa580('0x21')][_0x3ff8db['queue']][_0xa580('0x5f')]+=0x1;var _0x3c0454=_0x3804ce['voiceQueues'][_0x3ff8db['queue']];var _0x5b4638=new Hangup(_0x3ff8db,_0x4a67dd);_0x5b4638[_0xa580('0xe4')]=0x13;_0x5b4638[_0xa580('0xe5')]='Machine';_0x5b4638[_0xa580('0xeb')]=_0xa580('0xe7');_0x5b4638[_0xa580('0xec')]+=0x1;_0x5b4638[_0xa580('0xed')]+=0x1;_0x5b4638[_0xa580('0xee')]=!![];_0x3804ce['createHistory'](_0x5b4638)[_0xa580('0xb7')](loggerCatch(_0xa580('0xef')));if(_0x5b4638[_0xa580('0xf0')]+_0x5b4638[_0xa580('0xf1')]+_0x5b4638['countnoanswerretry']+_0x5b4638['countnosuchnumberretry']+_0x5b4638[_0xa580('0xf2')]+_0x5b4638['countabandonedretry']+_0x5b4638['countmachineretry']+_0x5b4638[_0xa580('0xf3')]>=_0x3c0454[_0xa580('0xf4')]){_0x3804ce['stateGlobal'](_0x5b4638,_0x54c7a2,_0x2c23c9,_0xa580('0xf5'));}else{if(_0x5b4638['countmachineretry']>=_0x3c0454[_0xa580('0xf6')]){_0x3804ce[_0xa580('0xf7')](_0x5b4638,_0x54c7a2,_0x2c23c9,_0xa580('0xf8'));}else{_0x3804ce[_0xa580('0xc2')]({'active':![],'countmachineretry':_0x5b4638['countmachineretry'],'scheduledat':moment()[_0xa580('0xf9')](_0x3c0454[_0xa580('0xfa')],_0xa580('0xfb'))['format'](_0xa580('0xfc')),'ContactId':_0x5b4638[_0xa580('0xd3')],'ListId':_0x5b4638['ListId'],'VoiceQueueId':_0x5b4638[_0xa580('0xfd')]||undefined,'CampaignId':_0x5b4638[_0xa580('0xd5')]||undefined})[_0xa580('0xb7')](loggerCatch(_0xa580('0xfe')));_0x54c7a2({'reschedule':0x1});}}});}if(_0x3ff8db[_0xa580('0x4f')]===_0xa580('0x7c')&&this[_0xa580('0x22')][_0x3ff8db[_0xa580('0xb9')]][_0xa580('0xe1')]&&_0x4a67dd['value']==='HANGUP'){delete this[_0xa580('0xb1')][_0x4a67dd[_0xa580('0xdd')]];this[_0xa580('0xb8')](this[_0xa580('0x22')][_0x3ff8db[_0xa580('0xb9')]]);_0x311014=new Hangup(_0x3ff8db,_0x4a67dd);_0x311014[_0xa580('0xe4')]=0x12;_0x311014[_0xa580('0xe5')]=_0xa580('0xe6');_0x311014['membername']=_0xa580('0xe7');this['saveInDb'](_0x311014,_0xa580('0xff'),_0xa580('0x100'));}if(_0x3ff8db[_0xa580('0x4f')]===_0xa580('0x7c')&&this['campaigns'][_0x3ff8db[_0xa580('0xb9')]]['dialAMDActive']&&_0x4a67dd[_0xa580('0xe2')]==='MACHINE'){var _0x3804ce=this;return new BPromise(function(_0x5bb6ae,_0x5e2860){delete _0x3804ce[_0xa580('0xb1')][_0x4a67dd[_0xa580('0xdd')]];_0x3804ce[_0xa580('0xb8')](_0x3804ce['campaigns'][_0x3ff8db['queue']]);_0x3804ce[_0xa580('0x22')][_0x3ff8db['queue']][_0xa580('0x60')]+=0x1;_0x3804ce[_0xa580('0x22')][_0x3ff8db[_0xa580('0xb9')]][_0xa580('0x5f')]+=0x1;var _0xf4e83f=_0x3804ce[_0xa580('0x22')][_0x3ff8db[_0xa580('0xb9')]];var _0x4cd723=new Hangup(_0x3ff8db,_0x4a67dd);_0x4cd723[_0xa580('0xe4')]=0x13;_0x4cd723[_0xa580('0xe5')]=_0xa580('0x101');_0x4cd723[_0xa580('0xeb')]=_0xa580('0xe7');_0x4cd723[_0xa580('0xec')]+=0x1;_0x4cd723['countglobal']+=0x1;_0x4cd723[_0xa580('0xee')]=!![];_0x3804ce[_0xa580('0xcc')](_0x4cd723)[_0xa580('0xb7')](loggerCatch(_0xa580('0xef')));if(_0x4cd723[_0xa580('0xf0')]+_0x4cd723[_0xa580('0xf1')]+_0x4cd723[_0xa580('0x102')]+_0x4cd723[_0xa580('0x103')]+_0x4cd723[_0xa580('0xf2')]+_0x4cd723['countabandonedretry']+_0x4cd723['countmachineretry']+_0x4cd723[_0xa580('0xf3')]>=_0xf4e83f[_0xa580('0xf4')]){_0x3804ce['stateGlobal'](_0x4cd723,_0x5bb6ae,_0x5e2860,_0xa580('0xf5'));}else{if(_0x4cd723['countmachineretry']>=_0xf4e83f[_0xa580('0xf6')]){_0x3804ce[_0xa580('0xf7')](_0x4cd723,_0x5bb6ae,_0x5e2860,_0xa580('0xf8'));}else{_0x3804ce[_0xa580('0xc2')]({'active':![],'countmachineretry':_0x4cd723[_0xa580('0xec')],'scheduledat':moment()[_0xa580('0xf9')](_0xf4e83f['dialMachineRetryFrequency'],_0xa580('0xfb'))['format'](_0xa580('0xfc')),'ContactId':_0x4cd723['ContactId'],'ListId':_0x4cd723['ListId'],'VoiceQueueId':_0x4cd723[_0xa580('0xfd')]||undefined,'CampaignId':_0x4cd723[_0xa580('0xd5')]||undefined})[_0xa580('0xb7')](loggerCatch(_0xa580('0xfe')));_0x5bb6ae({'reschedule':0x1});}}});}}};Dialer['prototype']['syncHangup']=function(_0x4f3314){var _0x452717=this['uniqueId'][_0x4f3314[_0xa580('0xdd')]];var _0x1058ba=this;var _0x131df6;if(_0x452717&&_0x452717[_0xa580('0x4f')]===_0xa580('0x7c')){delete this['uniqueId'][_0x4f3314[_0xa580('0xdd')]];this[_0xa580('0xb8')](this[_0xa580('0x22')][_0x452717[_0xa580('0xb9')]]);this[_0xa580('0x22')][_0x452717[_0xa580('0xb9')]][_0xa580('0x104')]+=0x1;_0x131df6=new Hangup(_0x452717,_0x4f3314);this[_0xa580('0xcc')](_0x131df6)[_0xa580('0xb7')](loggerCatch(_0xa580('0x105')));this[_0xa580('0xca')](_0x131df6)[_0xa580('0xb7')](loggerCatch(_0xa580('0x106')));}if(_0x452717&&_0x452717[_0xa580('0x4f')]!=='ivr'&&isNotNull(this[_0xa580('0x21')][_0x452717[_0xa580('0xb9')]]['dialQueueProject'])){delete this[_0xa580('0xb1')][_0x4f3314['uniqueid']];this[_0xa580('0xb8')](this['voiceQueues'][_0x452717[_0xa580('0xb9')]]);this[_0xa580('0x21')][_0x452717[_0xa580('0xb9')]][_0xa580('0x60')]+=0x1;this[_0xa580('0x21')][_0x452717[_0xa580('0xb9')]][_0xa580('0x5f')]+=0x1;_0x131df6=new Hangup(_0x452717,_0x4f3314);_0x131df6['state']=0x10;_0x131df6[_0xa580('0xe5')]=_0xa580('0x107');_0x131df6[_0xa580('0xeb')]='AGI';this[_0xa580('0xcc')](_0x131df6)[_0xa580('0xb7')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xa580('0xca')](_0x131df6)[_0xa580('0xb7')](loggerCatch(_0xa580('0x106')));}if(_0x452717&&_0x452717['type']!=='ivr'&&!isNotNull(this[_0xa580('0x21')][_0x452717[_0xa580('0xb9')]][_0xa580('0x108')])){delete this['uniqueId'][_0x4f3314[_0xa580('0xdd')]];this[_0xa580('0xb8')](this['voiceQueues'][_0x452717[_0xa580('0xb9')]]);this['voiceQueues'][_0x452717[_0xa580('0xb9')]][_0xa580('0x68')]+=0x1;_0x131df6=new Hangup(_0x452717,_0x4f3314);_0x131df6['state']=0xc;_0x131df6[_0xa580('0xe5')]=_0x4f3314[_0xa580('0x109')];_0x131df6['membername']='Unknow';this['createHistory'](_0x131df6)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xa580('0xca')](_0x131df6)[_0xa580('0xb7')](loggerCatch(_0xa580('0x106')));}};Dialer[_0xa580('0x1c')][_0xa580('0x31')]=function(_0x4e9429){var _0x16771c=this['uniqueId'][_0x4e9429['uniqueid']];var _0x4c705d=this;if(this[_0xa580('0x21')][_0x4e9429[_0xa580('0xb9')]]){if(_0x16771c&&_0x16771c[_0xa580('0x4f')]!==_0xa580('0x7c')){delete this[_0xa580('0xb1')][_0x4e9429[_0xa580('0xdd')]];this[_0xa580('0x21')][_0x4e9429[_0xa580('0xb9')]][_0xa580('0x60')]+=0x1;var _0x446538=new AgentComplete(_0x16771c,_0x4e9429);if(_0x4e9429['reason']===_0xa580('0x10a')){_0x446538[_0xa580('0x10b')]=this[_0xa580('0x21')][_0x4e9429['queue']]['dialQueueProject2']&&this[_0xa580('0x21')][_0x4e9429[_0xa580('0xb9')]]['dialAgiAfterHangupAgent']?moment()['format'](_0xa580('0xfc')):undefined;}this['createHistory'](_0x446538)[_0xa580('0xb7')](loggerCatch(_0xa580('0x10c')));this['moveContactManagedDialer'](_0x446538)[_0xa580('0xb7')](loggerCatch(_0xa580('0x10d')));}}};Dialer[_0xa580('0x1c')][_0xa580('0x10e')]=function(_0x5c29cd){if(this[_0xa580('0x21')][_0x5c29cd[_0xa580('0xb9')]]){if(this[_0xa580('0xb1')][_0x5c29cd['uniqueid']]&&this[_0xa580('0xb1')][_0x5c29cd['uniqueid']]['type']!==_0xa580('0x7c')){this[_0xa580('0xb8')](this[_0xa580('0x21')][_0x5c29cd[_0xa580('0xb9')]]);this[_0xa580('0xb1')][_0x5c29cd[_0xa580('0xdd')]][_0xa580('0x10f')]=moment()[_0xa580('0x7a')](_0xa580('0xfc'));}}};Dialer['prototype'][_0xa580('0x110')]=function(_0x479dbf){this['createHistory'](_0x479dbf)[_0xa580('0xb7')](loggerCatch(_0xa580('0x10c')));this[_0xa580('0xca')](_0x479dbf)[_0xa580('0xb7')](loggerCatch(_0xa580('0x111')));};Dialer[_0xa580('0x1c')]['syncQueueCallerAbandon']=function(_0x4c4a8a){var _0x461c5b=this[_0xa580('0xb1')][_0x4c4a8a[_0xa580('0xdd')]];var _0x75b99c=this;if(this[_0xa580('0x21')][_0x4c4a8a[_0xa580('0xb9')]]){if(_0x461c5b&&_0x461c5b['type']!=='ivr'){delete this[_0xa580('0xb1')][_0x4c4a8a[_0xa580('0xdd')]];this[_0xa580('0xb8')](this[_0xa580('0x21')][_0x4c4a8a[_0xa580('0xb9')]]);_0x461c5b['droptime']=moment()['format'](_0xa580('0xfc'));var _0xefa6cc=new QueueCallerAbandon(_0x461c5b,_0x4c4a8a);if(getSeconds(_0x461c5b['droptime'],_0x461c5b['responsetime'])>=_0x461c5b[_0xa580('0x112')]){this['voiceQueues'][_0x4c4a8a[_0xa580('0xb9')]][_0xa580('0x84')]+=0x1;this['voiceQueues'][_0x4c4a8a[_0xa580('0xb9')]][_0xa580('0x63')]+=0x1;this[_0xa580('0x21')][_0x4c4a8a[_0xa580('0xb9')]][_0xa580('0x6c')]+=0x1;_0xefa6cc[_0xa580('0xe4')]=0xa;_0xefa6cc[_0xa580('0xe5')]=_0xa580('0x113');_0xefa6cc['dropreason']=_0xa580('0x114');_0xefa6cc[_0xa580('0x10b')]=this[_0xa580('0x21')][_0x4c4a8a[_0xa580('0xb9')]][_0xa580('0x115')]?moment()[_0xa580('0x7a')](_0xa580('0xfc')):undefined;_0xefa6cc[_0xa580('0xf2')]+=0x1;_0xefa6cc[_0xa580('0xed')]+=0x1;if(_0xefa6cc[_0xa580('0xf2')]>=this[_0xa580('0x21')][_0x4c4a8a[_0xa580('0xb9')]]['dialDropMaxRetry']){this[_0xa580('0x110')](_0xefa6cc);}else{this[_0xa580('0xc2')]({'active':![],'countdropretry':_0xefa6cc[_0xa580('0xf2')],'scheduledat':moment()[_0xa580('0xf9')](this['voiceQueues'][_0x4c4a8a[_0xa580('0xb9')]][_0xa580('0x116')],'minutes')[_0xa580('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x461c5b['ContactId'],'ListId':_0x461c5b['ListId'],'VoiceQueueId':_0x461c5b[_0xa580('0xfd')]||undefined,'CampaignId':_0x461c5b[_0xa580('0xd5')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x430de7=new History(_0xefa6cc);_0x430de7[_0xa580('0xe4')]=0xa;_0x430de7['statedesc']=_0xa580('0x113');_0x430de7[_0xa580('0xae')]=moment()[_0xa580('0x7a')](_0xa580('0xfc'));_0x430de7[_0xa580('0xad')]=_0x430de7[_0xa580('0xae')];_0x430de7['calleridname']=_0xefa6cc[_0xa580('0x117')];_0x430de7[_0xa580('0x118')]=_0xefa6cc['calleridnum'];this['createHistory'](_0x430de7)[_0xa580('0xb7')](loggerCatch(_0xa580('0x119')));}}else{this['voiceQueues'][_0x4c4a8a['queue']][_0xa580('0x6a')]+=0x1;this[_0xa580('0x21')][_0x4c4a8a['queue']][_0xa580('0x62')]+=0x1;_0xefa6cc[_0xa580('0xe4')]=0xb;_0xefa6cc['statedesc']=_0xa580('0x11a');_0xefa6cc[_0xa580('0x11b')]=_0xa580('0x11c');_0xefa6cc['countabandonedretry']+=0x1;_0xefa6cc[_0xa580('0xed')]+=0x1;if(_0xefa6cc['countabandonedretry']>=this['voiceQueues'][_0x4c4a8a[_0xa580('0xb9')]][_0xa580('0x11d')]){this['queueCallerAbandonCreateState'](_0xefa6cc);}else{this[_0xa580('0xc2')]({'active':![],'countabandonedretry':_0xefa6cc[_0xa580('0x11e')],'scheduledat':moment()[_0xa580('0xf9')](this['voiceQueues'][_0x4c4a8a[_0xa580('0xb9')]][_0xa580('0x11f')],_0xa580('0xfb'))[_0xa580('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x461c5b[_0xa580('0xd3')],'ListId':_0x461c5b['ListId'],'VoiceQueueId':_0x461c5b[_0xa580('0xfd')]||undefined,'CampaignId':_0x461c5b['CampaignId']||undefined})[_0xa580('0xb7')](loggerCatch(_0xa580('0x120')));var _0x430de7=new History(_0xefa6cc);_0x430de7[_0xa580('0xe4')]=0xb;_0x430de7[_0xa580('0xe5')]=_0xa580('0x11a');_0x430de7[_0xa580('0xae')]=moment()[_0xa580('0x7a')](_0xa580('0xfc'));_0x430de7[_0xa580('0xad')]=_0x430de7[_0xa580('0xae')];_0x430de7[_0xa580('0x117')]=_0xefa6cc[_0xa580('0x117')];_0x430de7[_0xa580('0x118')]=_0xefa6cc[_0xa580('0x118')];this[_0xa580('0xcc')](_0x430de7)[_0xa580('0xb7')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0xa580('0x1c')][_0xa580('0x36')]=function(_0x19c281){if(this['actions'][_0x19c281[_0xa580('0xdd')]]){this[_0xa580('0x27')][_0x19c281['uniqueid']]['channel']=_0x19c281[_0xa580('0x121')];}if(this[_0xa580('0xb1')][_0x19c281[_0xa580('0xdd')]]){this['uniqueId'][_0x19c281[_0xa580('0xdd')]][_0xa580('0x121')]=_0x19c281[_0xa580('0x121')];}};Dialer[_0xa580('0x1c')][_0xa580('0x39')]=function(_0x5ca46e){if(strategy[this[_0xa580('0x21')][this[_0xa580('0x27')][_0x5ca46e[_0xa580('0x122')]][_0xa580('0xb9')]][_0xa580('0x123')]]===_0xa580('0x1b')){if(this[_0xa580('0x27')][_0x5ca46e['actionid']]&&_[_0xa580('0xb4')](this[_0xa580('0x27')][_0x5ca46e[_0xa580('0x122')]][_0xa580('0x124')])&&_0x5ca46e[_0xa580('0xb6')]==='1'&&_0x5ca46e[_0xa580('0x125')]==='0'){if(this['agents'][_0x5ca46e[_0xa580('0x126')]]){if(!this['agents'][_0x5ca46e[_0xa580('0x126')]]['locked']){this['agents'][_0x5ca46e[_0xa580('0x126')]][_0xa580('0x124')]=!![];this['actions'][_0x5ca46e[_0xa580('0x122')]][_0xa580('0x124')]=!![];this[_0xa580('0x27')][_0x5ca46e[_0xa580('0x122')]][_0xa580('0x126')]=_0x5ca46e[_0xa580('0x126')];}}}}else if((strategy[this[_0xa580('0x21')][this[_0xa580('0x27')][_0x5ca46e[_0xa580('0x122')]][_0xa580('0xb9')]][_0xa580('0x123')]]||'rrmemory')==='rrmemory'){if(this[_0xa580('0x27')][_0x5ca46e[_0xa580('0x122')]]){if(this[_0xa580('0x23')][_0x5ca46e[_0xa580('0x126')]]){this[_0xa580('0x27')][_0x5ca46e[_0xa580('0x122')]][_0xa580('0x126')]=_0x5ca46e[_0xa580('0x126')];if(_['isNil'](this[_0xa580('0x29')][this[_0xa580('0x27')][_0x5ca46e[_0xa580('0x122')]][_0xa580('0xb9')]])){this[_0xa580('0x29')][this['actions'][_0x5ca46e['actionid']]['queue']]=[];}this[_0xa580('0x29')][this[_0xa580('0x27')][_0x5ca46e[_0xa580('0x122')]][_0xa580('0xb9')]][_0xa580('0x127')](_[_0xa580('0x8f')](_[_0xa580('0xd2')](this[_0xa580('0x27')][_0x5ca46e[_0xa580('0x122')]],[_0xa580('0x128'),_0xa580('0x126')]),{'status':_0x5ca46e[_0xa580('0xb6')],'paused':_0x5ca46e[_0xa580('0x125')]}));}}}};function unlockQueueStatus(_0x25a983,_0x1c5771){setTimeout(function(){if(_[_0xa580('0x3c')](_0x25a983[_0xa580('0x129')])){loggerBooked[_0xa580('0x99')](_0xa580('0x12a'),_0x1c5771);}_0x25a983[_0xa580('0x129')]=!![];loggerBooked[_0xa580('0x7f')](_0xa580('0x12b'),_0x1c5771,JSON[_0xa580('0x4a')](_['pick'](_0x25a983,[_0xa580('0x3e'),'queueStatusComplete'])));},0x1f3);}Dialer[_0xa580('0x1c')][_0xa580('0x12c')]=function(_0x1bff93){var _0xa6a114=this;var _0x366e12=_0xa6a114[_0xa580('0x21')][_0xa6a114['actions'][_0x1bff93[_0xa580('0x122')]][_0xa580('0xb9')]];if(strategy[this['voiceQueues'][this[_0xa580('0x27')][_0x1bff93[_0xa580('0x122')]][_0xa580('0xb9')]][_0xa580('0x123')]]===_0xa580('0x1b')){if(this[_0xa580('0x27')][_0x1bff93['actionid']]&&this[_0xa580('0x27')][_0x1bff93['actionid']][_0xa580('0x126')]){this[_0xa580('0x95')][_0xa580('0x12d')](this[_0xa580('0x27')][_0x1bff93[_0xa580('0x122')]][_0xa580('0x128')],this[_0xa580('0x27')][_0x1bff93[_0xa580('0x122')]][_0xa580('0x126')])[_0xa580('0xb7')](function(_0x63b57f){logger[_0xa580('0x99')](_0xa580('0x12e'),util[_0xa580('0x9a')](_0x63b57f,{'showHidden':![],'depth':null}));})[_0xa580('0x1f')](function(){_0xa6a114[_0xa580('0xb8')](_0xa6a114[_0xa580('0x21')][_0xa6a114['actions'][_0x1bff93['actionid']][_0xa580('0xb9')]]);_0xa6a114[_0xa580('0x23')][_0xa6a114[_0xa580('0x27')][_0x1bff93[_0xa580('0x122')]]['stateinterface']]['locked']=![];delete _0xa6a114[_0xa580('0x27')][_0x1bff93['actionid']];unlockQueueStatus(_0x366e12);});}else{this['updateOriginated'](this[_0xa580('0x21')][this['actions'][_0x1bff93[_0xa580('0x122')]][_0xa580('0xb9')]]);this[_0xa580('0xc2')]({'active':![],'ContactId':this[_0xa580('0x27')][_0x1bff93[_0xa580('0x122')]]['ContactId'],'ListId':this[_0xa580('0x27')][_0x1bff93['actionid']]['ListId'],'VoiceQueueId':this[_0xa580('0x27')][_0x1bff93['actionid']][_0xa580('0xfd')]||undefined,'CampaignId':this['actions'][_0x1bff93['actionid']][_0xa580('0xd5')]||undefined})[_0xa580('0xb7')](loggerCatch(_0xa580('0x12f')));delete this[_0xa580('0x27')][_0x1bff93[_0xa580('0x122')]];unlockQueueStatus(_0x366e12);}}else if((strategy[this['voiceQueues'][this['actions'][_0x1bff93[_0xa580('0x122')]][_0xa580('0xb9')]][_0xa580('0x123')]]||_0xa580('0x1a'))===_0xa580('0x1a')){var _0x5d765a;if(this['actions'][_0x1bff93[_0xa580('0x122')]]&&!_[_0xa580('0x47')](this[_0xa580('0x29')][this[_0xa580('0x27')][_0x1bff93[_0xa580('0x122')]][_0xa580('0xb9')]])){if(this[_0xa580('0x2a')][_0xa6a114[_0xa580('0x27')][_0x1bff93[_0xa580('0x122')]][_0xa580('0xb9')]]){this[_0xa580('0x2a')][_0xa6a114[_0xa580('0x27')][_0x1bff93[_0xa580('0x122')]][_0xa580('0xb9')]]=this[_0xa580('0x2a')][this[_0xa580('0x27')][_0x1bff93[_0xa580('0x122')]][_0xa580('0xb9')]]?this['queueBookedRR'][this['actions'][_0x1bff93[_0xa580('0x122')]][_0xa580('0xb9')]]:this[_0xa580('0x29')][this['actions'][_0x1bff93[_0xa580('0x122')]]['queue']]?this[_0xa580('0x29')][this['actions'][_0x1bff93['actionid']][_0xa580('0xb9')]][_0xa580('0x130')]||0x0:0x0;}this[_0xa580('0x29')][this['actions'][_0x1bff93[_0xa580('0x122')]][_0xa580('0xb9')]][_0xa580('0x130')]=this[_0xa580('0x2a')][this[_0xa580('0x27')][_0x1bff93[_0xa580('0x122')]]['queue']];for(var _0x5036db=0x0;_0x5036db=0x0?!![]:![];})[_0xa580('0xb7')](myreject(_0x19358b)));}}else{_0x41c8f6[_0xa580('0x127')](ami[_0xa580('0xb5')]({'action':_0xa580('0x142'),'command':util[_0xa580('0x7a')](_0xa580('0x143'),_0x3b5c59,!_[_0xa580('0x3c')](config['timezones'][_0x45cf21])?_0x45cf21:'')})[_0xa580('0xbd')](function(_0x2bb413){return _0x2bb413[_0xa580('0x145')][_0xa580('0x146')](_0xa580('0x147'))>=0x0?!![]:![];})[_0xa580('0xb7')](myreject(_0x19358b)));}BPromise['all'](_0x41c8f6)[_0xa580('0xbd')](function(_0x95189){var _0x40cb5e=_[_0xa580('0x148')](_0x95189);if(_0x40cb5e){return _0x291ab3(_0x40cb5e);}else{_0x10e33d[_0xa580('0x42')]=_0x341bcc?_0xa580('0x149'):'INTERVAL_IS_OVERTIME';return _0x19358b(msgResponse(_0xa580('0x14a'),_0xa580('0x13f'),_0xa580('0x14b')+_0x341bcc+'\x20'+_0x5469d8+_0xa580('0x14c')+util[_0xa580('0x9a')](_0x3b5c59,{'showHidden':![],'depth':null})+_0xa580('0x14d')+_0x45cf21));}})[_0xa580('0xb7')](function(_0x528c8d){return _0x19358b(msgResponse(_0xa580('0x13e'),'Failure',JSON['stringify'](_0x528c8d)));});});};Dialer[_0xa580('0x1c')][_0xa580('0x14e')]=function(_0x3b3978){var _0x1000ee=this;return function(){switch(_0x3b3978[_0xa580('0x14f')]){case _0xa580('0x150'):freeVariablesPredictive(_0x3b3978);_0x1000ee['handlePower'](_0x3b3978,0x1);break;case'power':freeVariablesPredictive(_0x3b3978);_0x1000ee['handlePower'](_0x3b3978,_0x3b3978[_0xa580('0x151')]);break;case _0xa580('0x152'):_0x1000ee[_0xa580('0x152')](_0x3b3978);break;case _0xa580('0x8'):freeVariablesPredictive(_0x3b3978);_0x1000ee[_0xa580('0x153')](_0x3b3978,0x1);break;default:freeVariablesPredictive(_0x3b3978);logger[_0xa580('0x99')](_0xa580('0x154'),_0x3b3978[_0xa580('0x3e')],_0xa580('0x155'));}};};Dialer[_0xa580('0x1c')][_0xa580('0x156')]=function(_0x23f33c){var _0x573ce6=this;return function(){_0x573ce6[_0xa580('0x157')](_0x23f33c);};};Dialer[_0xa580('0x1c')]['syncQueueSummary']=function(_0x311fdf){var _0x200f06=this;if(isNotPreview(_0x311fdf[_0xa580('0x14f')])){if(isVoiceQueueOutbound(_0x311fdf[_0xa580('0x4f')])&&isActive(_0x311fdf[_0xa580('0x5b')])){_0x311fdf[_0xa580('0xa5')]=!![];BPromise[_0xa580('0xbc')]()['then'](checkIsLoggedIn(_0x311fdf,_0x311fdf[_0xa580('0x53')]))['then'](checkIsActive(_0x311fdf,_0x311fdf[_0xa580('0x5b')]))['then'](checkInterval(_0x311fdf))['then'](_0x200f06[_0xa580('0x139')](_0x311fdf))['then'](_0x200f06[_0xa580('0x13d')](_0x311fdf['dialGlobalInterval'],_0x311fdf[_0xa580('0x158')],_0x311fdf[_0xa580('0x3e')],_0x311fdf))[_0xa580('0xbd')](_0x200f06[_0xa580('0x159')](_0x311fdf[_0xa580('0x45')],_0x311fdf[_0xa580('0x158')],_0x311fdf[_0xa580('0x3e')],_0x311fdf))[_0xa580('0xbd')](_0x200f06[_0xa580('0x14e')](_0x311fdf))[_0xa580('0xb7')](loggerCatchQueueSummary(_0xa580('0x15a'),_0x311fdf));}else{notSendMessagesQueue(_0x311fdf);}}else{freeVariablesPredictive(_0x311fdf);}};Dialer[_0xa580('0x1c')][_0xa580('0x138')]=function(){var _0x350bbb=this;var _0x3eae17;for(var _0x28477a in this[_0xa580('0x22')]){if(this['campaigns']['hasOwnProperty'](_0x28477a)){_0x3eae17=this[_0xa580('0x22')][_0x28477a];if(isCampaignIvr(_0x3eae17[_0xa580('0x4f')])&&isActive(_0x3eae17['active'])){_0x3eae17[_0xa580('0xa5')]=!![];BPromise['resolve']()[_0xa580('0xbd')](checkIsActive(_0x3eae17,_0x3eae17[_0xa580('0x78')]))['then'](checkInterval(_0x3eae17))[_0xa580('0xbd')](_0x350bbb[_0xa580('0x139')](_0x3eae17))[_0xa580('0xbd')](_0x350bbb[_0xa580('0x13d')](_0x3eae17[_0xa580('0x15b')],_0x3eae17[_0xa580('0x158')],_0x3eae17[_0xa580('0x3e')],_0x3eae17))[_0xa580('0xbd')](_0x350bbb[_0xa580('0x159')](_0x3eae17['Interval'],_0x3eae17[_0xa580('0x158')],_0x3eae17[_0xa580('0x3e')],_0x3eae17))[_0xa580('0xbd')](_0x350bbb[_0xa580('0x156')](_0x3eae17))['catch'](loggerCatchQueueSummary(_0xa580('0x15c'),_0x3eae17));}else{notSendMessagesCampaign(_0x3eae17);}}}};function getCallerIdRandom(_0x14fcda,_0x47fe74){var _0x465365,_0x7fe8a5,_0x4459cf;if(_0x47fe74<=0x0){_0x47fe74=0x1;}_0x465365=new RegExp(_0xa580('0x15d')+_0x47fe74+'}$');_0x7fe8a5=Math[_0xa580('0x15e')](0xa,_0x47fe74-0x1);_0x4459cf=Math[_0xa580('0x15e')](0xa,_0x47fe74)-0x1;return util[_0xa580('0x7a')]('%s',_[_0xa580('0x15f')](_0x14fcda,_0x465365,_[_0xa580('0x160')](_0x7fe8a5,_0x4459cf)));}function extractCalleridName(_0x54966b){var _0x53a0a3=_0x54966b[_0xa580('0x161')](/"(.*?)"/);return _0x53a0a3?_0x53a0a3[0x1]:_0x54966b;}function extractCalleridNumber(_0x323e05){var _0x527e72=_0x323e05['match'](/<(.*?)>/);return _0x527e72?_0x527e72[0x1]:_0x323e05;}Dialer[_0xa580('0x1c')]['actionOriginate']=function(_0x4e4734,_0x12f3ca){var _0x5a494a=this;var _0x1783d7=uuid['v4']();this[_0xa580('0x27')][_0x1783d7]=new Action(_0x4e4734,_0x12f3ca,_0x1783d7);return new BPromise(function(_0x3a8698,_0x2c1f85){if(_[_0xa580('0x3c')](_0x4e4734)&&_0xa580('0x162')!==typeof _0x4e4734){return _0x2c1f85(msgResponse(_0xa580('0x163'),_0xa580('0x13f'),'voiceQueue\x20is\x20undefine'));}if(_[_0xa580('0x3c')](_0x12f3ca[_0xa580('0x164')][_0xa580('0x165')])||_0x12f3ca[_0xa580('0x164')][_0xa580('0x165')]===null){return _0x2c1f85(msgResponse(_0xa580('0x163'),_0xa580('0x13f'),'contact\x20is\x20undefine'));}var _0x11d214={'XMD-CALLERID':_0x5a494a[_0xa580('0x27')][_0x1783d7][_0xa580('0x166')](),'XMD-AGI':_0x4e4734[_0xa580('0x108')]?util[_0xa580('0x7a')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4e4734[_0xa580('0x108')]):'NONE','XMD-AGIAFTER':_0x4e4734[_0xa580('0x115')]?util[_0xa580('0x7a')](_0xa580('0x167'),ipAgi,_0x4e4734[_0xa580('0x115')]):'NONE','XMD-QUEUE':_0x4e4734[_0xa580('0x4f')]===_0xa580('0x50')?util[_0xa580('0x7a')]('\x22%s,%s%s,,,%s\x22',_0x4e4734['name'],_0x4e4734[_0xa580('0x168')]||'',_0x4e4734[_0xa580('0x169')]?'c':'',_0x4e4734[_0xa580('0x112')]||0x3):'NONE','XMD-CONTACTID':_0x12f3ca['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x5a494a['actions'][_0x1783d7]['getCaller'](),'XMD-AMD':_0x4e4734[_0xa580('0xe1')]?'ACTIVE':_0xa580('0x16a'),'XMD-DESTINATION':_0xa580('0xe0')};if(_0x4e4734[_0xa580('0xe1')]){_0x11d214[_0xa580('0x16b')]=_0x4e4734['dialAMDInitialSilence']||0x9c4;_0x11d214[_0xa580('0x16c')]=_0x4e4734[_0xa580('0x16d')]||0x5dc;_0x11d214[_0xa580('0x16e')]=_0x4e4734['dialAMDAfterGreetingSilence']||0x320;_0x11d214['XMD-AMDTOTALANALYSISTIME']=_0x4e4734[_0xa580('0x16f')]||0x1388;_0x11d214[_0xa580('0x170')]=_0x4e4734[_0xa580('0x171')]||0x64;_0x11d214[_0xa580('0x172')]=_0x4e4734[_0xa580('0x173')]||0x32;_0x11d214['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x4e4734['dialAMDMaximumNumberOfWords']||0x3;_0x11d214[_0xa580('0x174')]=_0x4e4734[_0xa580('0x175')]||0x100;_0x11d214[_0xa580('0x176')]=_0x4e4734[_0xa580('0x177')]||0x1388;}if(_0x4e4734[_0xa580('0x4f')]===_0xa580('0x50')){_0x11d214['XMD-VOICEQUEUEID']=_0x12f3ca['VoiceQueueId'];}else{_0x11d214[_0xa580('0x178')]=_0x12f3ca[_0xa580('0xd5')];}for(var _0x4796b4 in _0x12f3ca[_0xa580('0x164')]){if(_0x12f3ca['Contact']['hasOwnProperty'](_0x4796b4)){if(isNotNull(_0x12f3ca['Contact'][_0x4796b4])&&_0x4796b4!=='id'&&_0x4796b4!=='tags'&&_0x4796b4!=='createdAt'&&_0x4796b4!==_0xa580('0x179')){_0x11d214[util[_0xa580('0x7a')]('%s%s',_0xa580('0x17a'),_[_0xa580('0x17b')](_0x4796b4))]=_0x12f3ca[_0xa580('0x164')][_0x4796b4];}}}var _0x3d76ea=_0x5a494a['isTrunkReachable'](_0x4e4734['Trunk'])?getCallerId(_0x4e4734[_0xa580('0x77')]['callerid'],_0x4e4734[_0xa580('0x5c')],_0x4e4734[_0xa580('0x17c')]>0x0?getCallerIdRandom(_0x4e4734[_0xa580('0x5d')],_0x4e4734[_0xa580('0x17c')]):_0x4e4734[_0xa580('0x5d')]):getCallerId(_[_0xa580('0xb4')](_0x4e4734[_0xa580('0x13a')])?_0x4e4734[_0xa580('0x77')][_0xa580('0x79')]:_0x4e4734[_0xa580('0x13a')]['callerid'],_0x4e4734[_0xa580('0x5c')],_0x4e4734[_0xa580('0x17c')]>0x0?getCallerIdRandom(_0x4e4734[_0xa580('0x5d')],_0x4e4734['dialRandomLastDigitCallerIdNumber']):_0x4e4734['dialOriginateCallerIdNumber']);if(_0x3d76ea){_0x11d214[_0xa580('0x17d')]=_0x5a494a['actions'][_0x1783d7][_0xa580('0x17e')]=extractCalleridName(_0x3d76ea);_0x11d214['XMD-ORIGINATECALLERIDNUM']=_0x5a494a[_0xa580('0x27')][_0x1783d7][_0xa580('0x17f')]=extractCalleridNumber(_0x3d76ea);}return ami[_0xa580('0xb5')]({'actionid':_0x1783d7,'action':_0xa580('0x163'),'channel':_0x5a494a[_0xa580('0xda')](_0x4e4734[_0xa580('0x77')])?util[_0xa580('0x7a')](_0xa580('0x180'),_0x4e4734[_0xa580('0x77')]['name'],isNotNull(_0x4e4734[_0xa580('0x181')])?_0x4e4734[_0xa580('0x181')][_0xa580('0x182')]()||'':'',_0x4e4734[_0xa580('0x183')]>0x0?_0x12f3ca[_0xa580('0x164')][_0xa580('0x165')][_0xa580('0x184')](_0x4e4734[_0xa580('0x183')]):_0x12f3ca[_0xa580('0x164')][_0xa580('0x165')]):util[_0xa580('0x7a')](_0xa580('0x180'),_['isNil'](_0x4e4734[_0xa580('0x13a')])?_0x4e4734[_0xa580('0x77')][_0xa580('0x3e')]:_0x4e4734[_0xa580('0x13a')][_0xa580('0x3e')],isNotNull(_0x4e4734[_0xa580('0x181')])?_0x4e4734[_0xa580('0x181')][_0xa580('0x182')]()||'':'',_0x4e4734[_0xa580('0x183')]>0x0?_0x12f3ca['Contact']['phone'][_0xa580('0x184')](_0x4e4734[_0xa580('0x183')]):_0x12f3ca['Contact']['phone']),'callerid':_0x3d76ea,'Exten':_0xa580('0xe0'),'Context':_0xa580('0x185'),'Priority':'1','variable':_0x11d214,'timeout':(_0x4e4734[_0xa580('0x5e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1783d7})['then'](function(_0x3e3afa){return _0x3a8698(_0x3e3afa);})[_0xa580('0xb7')](function(_0x25b2f0){_0x4e4734['outboundOriginateFailureCallsDay']+=0x1;var _0xbd37b3=new History(_0x5a494a['actions'][_0x1783d7]);logger['error'](util['format'](_0xa580('0x186'),JSON['stringify'](_0x25b2f0)));_0xbd37b3[_0xa580('0xe4')]=0xe;_0xbd37b3[_0xa580('0xe5')]=_0xa580('0x187');_0xbd37b3[_0xa580('0xae')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xbd37b3[_0xa580('0xad')]=_0xbd37b3[_0xa580('0xae')];_0x5a494a[_0xa580('0xcc')](_0xbd37b3)[_0xa580('0xb7')](loggerCatch(_0xa580('0x188')));_0x5a494a[_0xa580('0xca')](_0xbd37b3)[_0xa580('0xb7')](loggerCatch(_0xa580('0x188')))[_0xa580('0x1f')](function(){delete _0x5a494a[_0xa580('0x27')][_0x1783d7];return _0x2c1f85(msgResponse(_0xa580('0x163'),_0xa580('0x49'),'originate\x20action\x20Error'));});});});};Dialer['prototype']['syncOriginateResponse']=function(_0x3c97bf){var _0x23e90f=this[_0xa580('0x27')][_0x3c97bf[_0xa580('0x122')]];var _0x2f894b=this;if(_0x23e90f){delete this['actions'][_0x3c97bf[_0xa580('0x122')]];_0x23e90f[_0xa580('0x189')]=moment()['format'](_0xa580('0xfc'));var _0x3c328c=_0x23e90f[_0xa580('0x4f')]===_0xa580('0x7c')?this['campaigns'][_0x23e90f[_0xa580('0xb9')]]:this[_0xa580('0x21')][_0x23e90f['getQueue']()];if(!this[_0xa580('0xd8')](_0x3c97bf[_0xa580('0x18a')])){this[_0xa580('0xb8')](_0x3c328c);return this['callProgressDetecting'](_0x23e90f,_0x3c328c,_0x3c97bf)[_0xa580('0xbd')](function(_0x4a434e){})[_0xa580('0xb7')](loggerCatch(_0xa580('0x18b')));}else{this[_0xa580('0xb1')][_0x3c97bf['uniqueid']]=_0x23e90f;}}};Dialer['prototype'][_0xa580('0x18c')]=function(_0x46b0c7,_0x5232dd,_0x29c508){var _0x509b16=new History(_0x5232dd);if(_0x509b16['countbusyretry']+_0x509b16[_0xa580('0xf1')]+_0x509b16[_0xa580('0x102')]+_0x509b16[_0xa580('0x103')]+_0x509b16[_0xa580('0xf2')]+_0x509b16[_0xa580('0x11e')]+_0x509b16[_0xa580('0xec')]+_0x509b16[_0xa580('0xf3')]>=_0x29c508[_0xa580('0xf4')]-0x1){return!![];}switch(_0x46b0c7){case 0x3:if(_0x509b16[_0xa580('0x102')]>=_0x29c508[_0xa580('0x18d')]-0x1){return!![];}else{this[_0xa580('0xc2')]({'active':![],'countnoanswerretry':_0x509b16[_0xa580('0x102')]+=0x1,'scheduledat':moment()['add'](_0x29c508['dialNoAnswerRetryFrequency'],_0xa580('0xfb'))[_0xa580('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x509b16[_0xa580('0xd3')],'ListId':_0x509b16['ListId'],'VoiceQueueId':_0x509b16[_0xa580('0xfd')]||undefined,'CampaignId':_0x509b16[_0xa580('0xd5')]||undefined})[_0xa580('0xb7')](loggerCatch(_0xa580('0x18e')));}break;case 0x5:if(_0x509b16[_0xa580('0xf0')]>=_0x29c508[_0xa580('0x18f')]-0x1){return!![];}else{this[_0xa580('0xc2')]({'active':![],'countbusyretry':_0x509b16[_0xa580('0xf0')]+=0x1,'scheduledat':moment()[_0xa580('0xf9')](_0x29c508[_0xa580('0x190')],_0xa580('0xfb'))[_0xa580('0x7a')](_0xa580('0xfc')),'ContactId':_0x509b16[_0xa580('0xd3')],'ListId':_0x509b16[_0xa580('0xd4')],'VoiceQueueId':_0x509b16[_0xa580('0xfd')]||undefined,'CampaignId':_0x509b16['CampaignId']||undefined})[_0xa580('0xb7')](loggerCatch('[rescheduleContact]\x20[Busy]'));}break;case 0x8:if(_0x509b16[_0xa580('0xf1')]>=_0x29c508[_0xa580('0x191')]-0x1){return!![];}else{this[_0xa580('0xc2')]({'active':![],'countcongestionretry':_0x509b16['countcongestionretry']+=0x1,'scheduledat':moment()[_0xa580('0xf9')](_0x29c508['dialCongestionRetryFrequency'],_0xa580('0xfb'))[_0xa580('0x7a')](_0xa580('0xfc')),'ContactId':_0x509b16['ContactId'],'ListId':_0x509b16[_0xa580('0xd4')],'VoiceQueueId':_0x509b16[_0xa580('0xfd')]||undefined,'CampaignId':_0x509b16[_0xa580('0xd5')]||undefined})[_0xa580('0xb7')](loggerCatch(_0xa580('0x192')));}break;case 0x0:if(_0x509b16[_0xa580('0x103')]>=_0x29c508[_0xa580('0x193')]-0x1){return!![];}else{this[_0xa580('0xc2')]({'active':![],'countnosuchnumberretry':_0x509b16[_0xa580('0x103')]+=0x1,'scheduledat':moment()[_0xa580('0xf9')](_0x29c508[_0xa580('0x194')],'minutes')['format'](_0xa580('0xfc')),'ContactId':_0x509b16[_0xa580('0xd3')],'ListId':_0x509b16['ListId'],'VoiceQueueId':_0x509b16[_0xa580('0xfd')]||undefined,'CampaignId':_0x509b16['CampaignId']||undefined})[_0xa580('0xb7')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x509b16[_0xa580('0xf2')]>=_0x29c508['dialDropMaxRetry']-0x1){return!![];}else{this[_0xa580('0xc2')]({'active':![],'countdropretry':_0x509b16[_0xa580('0xf2')]+=0x1,'scheduledat':moment()[_0xa580('0xf9')](_0x29c508['dialDropRetryFrequency'],_0xa580('0xfb'))[_0xa580('0x7a')](_0xa580('0xfc')),'ContactId':_0x509b16[_0xa580('0xd3')],'ListId':_0x509b16[_0xa580('0xd4')],'VoiceQueueId':_0x509b16[_0xa580('0xfd')]||undefined,'CampaignId':_0x509b16[_0xa580('0xd5')]||undefined})['catch'](loggerCatch(_0xa580('0x195')));}break;case 0xb:if(_0x509b16[_0xa580('0x11e')]>=_0x29c508[_0xa580('0x11d')]-0x1){return!![];}else{this[_0xa580('0xc2')]({'active':![],'countabandonedretry':_0x509b16[_0xa580('0x11e')]+=0x1,'scheduledat':moment()[_0xa580('0xf9')](_0x29c508['dialAbandonedRetryFrequency'],_0xa580('0xfb'))[_0xa580('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x509b16[_0xa580('0xd3')],'ListId':_0x509b16['ListId'],'VoiceQueueId':_0x509b16['VoiceQueueId']||undefined,'CampaignId':_0x509b16['CampaignId']||undefined})[_0xa580('0xb7')](loggerCatch(_0xa580('0x120')));}break;case 0x13:if(_0x509b16[_0xa580('0xec')]>=_0x29c508[_0xa580('0xf6')]-0x1){return!![];}else{this[_0xa580('0xc2')]({'active':![],'countmachineretry':_0x509b16[_0xa580('0xec')]+=0x1,'scheduledat':moment()['add'](_0x29c508[_0xa580('0xfa')],'minutes')[_0xa580('0x7a')](_0xa580('0xfc')),'ContactId':_0x509b16[_0xa580('0xd3')],'ListId':_0x509b16[_0xa580('0xd4')],'VoiceQueueId':_0x509b16[_0xa580('0xfd')]||undefined,'CampaignId':_0x509b16[_0xa580('0xd5')]||undefined})[_0xa580('0xb7')](loggerCatch(_0xa580('0xfe')));}break;case 0x14:if(_0x509b16['countagentrejectretry']>=_0x29c508[_0xa580('0x196')]-0x1){return!![];}else{this[_0xa580('0xc2')]({'active':![],'countagentrejectretry':_0x509b16['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x29c508[_0xa580('0x197')],_0xa580('0xfb'))[_0xa580('0x7a')](_0xa580('0xfc')),'ContactId':_0x509b16[_0xa580('0xd3')],'ListId':_0x509b16[_0xa580('0xd4')],'VoiceQueueId':_0x509b16['VoiceQueueId']||undefined,'CampaignId':_0x509b16[_0xa580('0xd5')]||undefined})[_0xa580('0xb7')](loggerCatch(_0xa580('0x198')));}break;default:return!![];}};Dialer['prototype'][_0xa580('0x199')]=function(_0x559de8,_0x44429a,_0x216d31){var _0x357262=this;var _0x1440ad=new History(_0x559de8);return new BPromise(function(_0x5d02af,_0x3d1036){if(_[_0xa580('0x3c')](_0x44429a)&&_0xa580('0x162')!==typeof _0x44429a){return _0x3d1036(msgResponse('[callProgressDetecting]',_0xa580('0x13f'),'entity\x20is\x20undefine'));}if(_[_0xa580('0x3c')](_0x216d31)&&_0xa580('0x162')!==typeof _0x216d31){return _0x3d1036(msgResponse(_0xa580('0x19a'),'Failure',_0xa580('0x19b')));}switch(_0x216d31['reason']){case'0':_0x44429a['outboundNoSuchCallsDay']+=0x1;_0x1440ad[_0xa580('0xe4')]=0x0;_0x1440ad[_0xa580('0xe5')]='NoSuchNumber';_0x1440ad[_0xa580('0x103')]+=0x1;_0x1440ad[_0xa580('0xed')]+=0x1;ami[_0xa580('0x4e')](_0xa580('0x19c'),ut['buildObj'](_0x559de8,'nosuchnumber'));_0x357262['createHistory'](_0x1440ad)[_0xa580('0xb7')](loggerCatch(_0xa580('0xef')));if(_0x357262['checkRetriveMax'](0x0,_0x559de8,_0x44429a)){if(_0x1440ad[_0xa580('0x103')]>=_0x44429a[_0xa580('0x193')]){_0x357262[_0xa580('0xf7')](_0x1440ad,_0x5d02af,_0x3d1036,'reason\x200\x20no\x20such\x20number....');}else{_0x357262[_0xa580('0x19d')](_0x1440ad,_0x5d02af,_0x3d1036,_0xa580('0x19e'));}}break;case'3':_0x44429a['outboundNoAnswerCallsDay']+=0x1;_0x1440ad[_0xa580('0xe4')]=0x3;_0x1440ad[_0xa580('0xe5')]='NoAnswer';_0x1440ad[_0xa580('0x102')]+=0x1;_0x1440ad[_0xa580('0xed')]+=0x1;ami[_0xa580('0x4e')]('custom:agentnoanswer',ut[_0xa580('0x19f')](_0x559de8,_0xa580('0x1a0')));_0x357262[_0xa580('0xcc')](_0x1440ad)['catch'](loggerCatch(_0xa580('0x1a1')));if(_0x357262[_0xa580('0x18c')](0x3,_0x559de8,_0x44429a)){if(_0x1440ad[_0xa580('0x102')]>=_0x44429a[_0xa580('0x18d')]){_0x357262['createStateFinal'](_0x1440ad,_0x5d02af,_0x3d1036,'reason\x203\x20ringing\x20no\x20answer');}else{_0x357262[_0xa580('0x19d')](_0x1440ad,_0x5d02af,_0x3d1036,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x44429a[_0xa580('0x1a2')]+=0x1;_0x1440ad['state']=0x5;_0x1440ad['statedesc']=_0xa580('0x1a3');_0x1440ad[_0xa580('0xf0')]+=0x1;_0x1440ad[_0xa580('0xed')]+=0x1;ami[_0xa580('0x4e')](_0xa580('0x1a4'),ut['buildObj'](_0x559de8,_0xa580('0x1a5')));_0x357262[_0xa580('0xcc')](_0x1440ad)['catch'](loggerCatch(_0xa580('0x1a6')));if(_0x357262[_0xa580('0x18c')](0x5,_0x559de8,_0x44429a)){if(_0x1440ad['countbusyretry']>=_0x44429a['dialBusyMaxRetry']){_0x357262[_0xa580('0xf7')](_0x1440ad,_0x5d02af,_0x3d1036,_0xa580('0x1a7'));}else{_0x357262[_0xa580('0x19d')](_0x1440ad,_0x5d02af,_0x3d1036,_0xa580('0x1a7'));}}break;case'8':_0x44429a['outboundCongestionCallsDay']+=0x1;_0x1440ad[_0xa580('0xe4')]=0x8;_0x1440ad[_0xa580('0xe5')]=_0xa580('0x1a8');_0x1440ad['countcongestionretry']+=0x1;_0x1440ad[_0xa580('0xed')]+=0x1;ami[_0xa580('0x4e')](_0xa580('0x1a9'),ut[_0xa580('0x19f')](_0x559de8,_0xa580('0x1aa')));_0x357262[_0xa580('0xcc')](_0x1440ad)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x357262['checkRetriveMax'](0x8,_0x559de8,_0x44429a)){if(_0x1440ad['countcongestionretry']>=_0x44429a[_0xa580('0x191')]){_0x357262[_0xa580('0xf7')](_0x1440ad,_0x5d02af,_0x3d1036,_0xa580('0x1ab'));}else{_0x357262[_0xa580('0x19d')](_0x1440ad,_0x5d02af,_0x3d1036,_0xa580('0x1ab'));}}break;case'11':_0x44429a[_0xa580('0x1ac')]+=0x1;_0x1440ad['state']=0xb;_0x1440ad[_0xa580('0xe5')]='Abandoned';_0x1440ad[_0xa580('0x11e')]+=0x1;_0x1440ad[_0xa580('0xed')]+=0x1;_0x357262[_0xa580('0xcc')](_0x1440ad)['catch'](loggerCatch(_0xa580('0x1ad')));if(_0x357262[_0xa580('0x18c')](0xb,_0x559de8,_0x44429a)){if(_0x1440ad[_0xa580('0x11e')]>=_0x44429a[_0xa580('0x11d')]){_0x357262[_0xa580('0xf7')](_0x1440ad,_0x5d02af,_0x3d1036,_0xa580('0x1ae'));}else{_0x357262[_0xa580('0x19d')](_0x1440ad,_0x5d02af,_0x3d1036,_0xa580('0x1ae'));}}break;case'20':_0x44429a['outboundRejectCallsDay']+=0x1;_0x1440ad[_0xa580('0xe4')]=0x14;_0x1440ad[_0xa580('0xe5')]='AgentReject';_0x1440ad[_0xa580('0xf3')]+=0x1;_0x1440ad[_0xa580('0xed')]+=0x1;ami[_0xa580('0x4e')](_0xa580('0x1af'),ut[_0xa580('0x19f')](_0x559de8,_0xa580('0x1b0')));_0x357262[_0xa580('0xcc')](_0x1440ad)[_0xa580('0xb7')](loggerCatch(_0xa580('0x1b1')));if(_0x357262[_0xa580('0x18c')](0x14,_0x559de8,_0x44429a)){if(_0x1440ad[_0xa580('0xf3')]>=_0x44429a[_0xa580('0x196')]){_0x357262[_0xa580('0xf7')](_0x1440ad,_0x5d02af,_0x3d1036,_0xa580('0x1b2'));}else{_0x357262['stateGlobal'](_0x1440ad,_0x5d02af,_0x3d1036,_0xa580('0x1b2'));}}break;default:_0x44429a[_0xa580('0x68')]+=0x1;_0x1440ad[_0xa580('0xe4')]=0xc;_0x1440ad[_0xa580('0xe5')]=_0x216d31[_0xa580('0x1b3')];_0x357262[_0xa580('0xcc')](_0x1440ad)[_0xa580('0xb7')](loggerCatch(_0xa580('0x1b4')));if(_0x357262[_0xa580('0x18c')](_0x216d31[_0xa580('0x1b3')],_0x559de8,_0x44429a)){if(_0x1440ad[_0xa580('0xf0')]+_0x1440ad[_0xa580('0xf1')]+_0x1440ad[_0xa580('0x102')]+_0x1440ad[_0xa580('0x103')]+_0x1440ad[_0xa580('0xf2')]+_0x1440ad[_0xa580('0x11e')]+_0x1440ad[_0xa580('0xec')]+_0x1440ad[_0xa580('0xf3')]>=_0x44429a[_0xa580('0xf4')]){_0x357262[_0xa580('0x19d')](_0x1440ad,_0x5d02af,_0x3d1036,_0x216d31[_0xa580('0x1b3')]);}else{_0x357262[_0xa580('0xf7')](_0x1440ad,_0x5d02af,_0x3d1036,_0x216d31['reason']);}}}});};Dialer['prototype'][_0xa580('0x19d')]=function(_0x126f79,_0x3fb0d7,_0x7355aa,_0x1267f1){var _0x414fb8=new Final(_0x126f79);_0x414fb8[_0xa580('0xe4')]=0xf;_0x414fb8['statedesc']=_0xa580('0x1b5');this[_0xa580('0xf7')](_0x414fb8,_0x3fb0d7,_0x7355aa,_0x1267f1);};Dialer['prototype']['createStateFinal']=function(_0x5f3466,_0x56f0c6,_0x3bcc04,_0x3252bd){this[_0xa580('0xca')](_0x5f3466)[_0xa580('0xbd')](function(_0x12b7aa){return _0x56f0c6(msgResponse('[callProgressDetecting]',_0xa580('0xd9'),_0x3252bd));})[_0xa580('0xb7')](function(_0x48ec3b){return _0x3bcc04(msgResponse(_0xa580('0x1b6'),_0xa580('0x13f'),_0xa580('0x1b7')));});};Dialer['prototype'][_0xa580('0x152')]=function(_0x33838e){var _0x232832=this;var _0x37c4ad=_0x33838e[_0xa580('0x1b8')]/0x64;var _0x1279b7=_0x33838e[_0xa580('0x63')]/(_0x33838e[_0xa580('0x63')]+_0x33838e[_0xa580('0x60')]);var _0x27b0fa=Math[_0xa580('0x1b9')](_0x33838e[_0xa580('0x70')]*(_0x33838e[_0xa580('0x1ba')]/0x64));var _0x3ec4f0=Math[_0xa580('0x1b9')](_0x33838e[_0xa580('0x70')]*(_0x33838e[_0xa580('0x1bb')]/0x64));var _0x5cb918=_0x33838e[_0xa580('0x52')]+_0x33838e['talking'];var _0x45248a=Math[_0xa580('0x1bc')](_0x33838e['erlangCalls']*_0x33838e[_0xa580('0x75')]*_0x33838e[_0xa580('0x6d')]*_0x33838e[_0xa580('0x6e')]);if(_[_0xa580('0x3c')](_0x33838e[_0xa580('0x28')])){if(!_[_0xa580('0x3c')](_0x33838e[_0xa580('0x91')])){_0x33838e[_0xa580('0x91')]=undefined;loggerPredictive[_0xa580('0x99')](_0xa580('0x1bd'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xa580('0x3c')](_0x33838e[_0xa580('0x93')])){loggerPredictive[_0xa580('0x99')](_0xa580('0x1bd'),_0xa580('0x1be'));clearInterval(_0x33838e[_0xa580('0x93')]);_0x33838e[_0xa580('0x93')]=undefined;}_0x33838e[_0xa580('0x28')]=moment()[_0xa580('0x7a')](_0xa580('0xfc'));loggerPredictive[_0xa580('0x7f')](_0x33838e[_0xa580('0x3e')],_0xa580('0x1bf'),_0x33838e[_0xa580('0x28')]);this[_0xa580('0x153')](_0x33838e,0x1);}else if(ifInterval(_0x33838e[_0xa580('0x1c0')],_0x33838e[_0xa580('0x28')])){this[_0xa580('0x153')](_0x33838e,0x1);loggerPredictiveCalls[_0xa580('0x7f')](_0xa580('0x1c1'),_0x33838e[_0xa580('0x28')],_0x33838e[_0xa580('0x3e')]);_0x33838e[_0xa580('0x73')]=0x0;_0x33838e[_0xa580('0x6c')]=0x0;}else if(_0x37c4ad<_0x1279b7&&_0x33838e[_0xa580('0x1c2')]===_0xa580('0x1c3')){freeVariablesPredictive(_0x33838e);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x1279b7,_0xa580('0x28'),_0x33838e[_0xa580('0x3e')]);}else if(_0x45248a<_0x33838e[_0xa580('0x6c')]&&_0x33838e[_0xa580('0x1c2')]===_0xa580('0x1c3')){freeVariablesPredictive(_0x33838e);loggerPredictive[_0xa580('0x7f')](_0xa580('0x1c4'),_0xa580('0x1c5'),_0x45248a,_0xa580('0x1c6'),_0x33838e['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x33838e[_0xa580('0x3e')]);}else if(!ifInterval(_0x33838e[_0xa580('0x1c0')],_0x33838e[_0xa580('0x28')])&&_['isUndefined'](_0x33838e[_0xa580('0x91')])&&!_[_0xa580('0x3c')](_0x33838e['startProgressive'])){_0x33838e[_0xa580('0x91')]=moment()[_0xa580('0x7a')](_0xa580('0xfc'));loggerPredictive[_0xa580('0x7f')](_0x33838e[_0xa580('0x3e')],'started\x20in\x20predictive\x20at',_0x33838e['startPredictive']);this[_0xa580('0xc1')](_0x33838e[_0xa580('0x1c0')])[_0xa580('0xbd')](this['getDataPredictive'](_0x33838e))[_0xa580('0xbd')](mergeDataErlangB(_0x33838e))[_0xa580('0xbd')](this[_0xa580('0x1c7')](_0x33838e))[_0xa580('0xb7')](loggerCatchPredictive(_0xa580('0x1c8'),_0x33838e));}else if(!ifInterval(_0x33838e[_0xa580('0x1c0')],_0x33838e[_0xa580('0x91')])){_0x33838e[_0xa580('0x6c')]=0x0;_0x33838e['startPredictive']=moment()['format'](_0xa580('0xfc'));loggerPredictive[_0xa580('0x7f')](_0x33838e[_0xa580('0x3e')],_0xa580('0x1c9'),_0x33838e[_0xa580('0x91')]);clearInterval(_0x33838e[_0xa580('0x93')]);_0x33838e['handlePredictive']=undefined;this[_0xa580('0xc1')](_0x33838e[_0xa580('0x1c0')])['then'](this[_0xa580('0x1ca')](_0x33838e))[_0xa580('0xbd')](mergeDataErlangB(_0x33838e))['then'](this[_0xa580('0x1c7')](_0x33838e))[_0xa580('0xb7')](loggerCatchPredictive(_0xa580('0x1cb'),_0x33838e));}else if(_0x33838e[_0xa580('0x70')]&&_0x5cb918<_0x33838e[_0xa580('0x70')]-_0x3ec4f0){freeVariablesPredictive(_0x33838e);loggerPredictive[_0xa580('0x7f')](_0x33838e[_0xa580('0x3e')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x5cb918,')\x20are\x20less\x20than\x20threshold\x20(',_0x33838e[_0xa580('0x70')],'-',_0x3ec4f0,'=',_0x33838e['predictiveIntervalAvailable']-_0x3ec4f0,')');}else if(_0x33838e['predictiveIntervalAvailable']&&_0x5cb918>_0x33838e[_0xa580('0x70')]+_0x27b0fa){freeVariablesPredictive(_0x33838e);loggerPredictive[_0xa580('0x7f')](_0x33838e[_0xa580('0x3e')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x5cb918,')\x20are\x20more\x20than\x20threshold\x20(',_0x33838e['predictiveIntervalAvailable'],'+',_0x27b0fa,'=',_0x33838e['predictiveIntervalAvailable']+_0x27b0fa,')');}};Dialer[_0xa580('0x1c')]['getDataPredictive']=function(_0x28359c){var _0x1397a6=this;return function(_0x532a8d){return new BPromise(function(_0x57b3c0,_0x463356){_['merge'](_0x28359c,_0x532a8d[0x0]);if(checkGetDataPredictive(_0x532a8d[0x0])){var _0x2ab91a=_0x28359c[_0xa580('0x70')]=_0x28359c[_0xa580('0xa6')]+_0x28359c[_0xa580('0x52')];var _0x92f3c6=_0x28359c[_0xa580('0x1c0')]*0x3c;var _0x166ace=_0x532a8d[0x0][_0xa580('0x88')]+_0x532a8d[0x0][_0xa580('0x69')];var _0x5e6b49=(_0x532a8d[0x0][_0xa580('0x82')]+_0x532a8d[0x0][_0xa580('0x84')]+_0x532a8d[0x0][_0xa580('0x6a')])/_0x532a8d[0x0][_0xa580('0x71')];_0x28359c[_0xa580('0x6d')]=_0x5e6b49>0x0?_0x5e6b49:0x1;switch(_0x28359c[_0xa580('0x1c2')]){case'dropRate':var _0x34fe27=_0x28359c[_0xa580('0x1b8')]/0x64;return _0x1397a6[_0xa580('0x1cc')](_0x2ab91a,_0x92f3c6,_0x166ace,_0x5e6b49,_0x34fe27)[_0xa580('0xbd')](function(_0x158c3b){return _0x57b3c0(_0x158c3b);});case'agentBusyFactor':var _0xc47e31=_0x28359c[_0xa580('0x1b8')]/0x64;return _0x1397a6[_0xa580('0x1cd')](_0x2ab91a,_0x92f3c6,_0x166ace,_0x5e6b49,_0xc47e31)['then'](function(_0x5f0834){return _0x57b3c0(_0x5f0834);});default:return _0x463356(msgResponse(_0xa580('0x1ce'),_0xa580('0x13f'),'Unknown\x20Predictive'));}}else{return _0x463356(msgResponse(_0xa580('0x1ce'),_0xa580('0x13f'),_0xa580('0x1cf')));}});};};Dialer[_0xa580('0x1c')][_0xa580('0x1d0')]=function(_0x43e9f0){var _0x126815=this;return function(_0x5a9449){return new BPromise(function(_0x1ccc2,_0x1576ad){_[_0xa580('0x8f')](_0x43e9f0,_0x5a9449[0x0]);if(checkGetDataPredictive(_0x5a9449[0x0])){loggerPredictive[_0xa580('0x7f')](JSON[_0xa580('0x4a')](_0x5a9449[0x0]));if(_0x43e9f0[_0xa580('0x1c2')]==='dropRate'){return _0x126815[_0xa580('0xc8')](_0x43e9f0['id'])[_0xa580('0xbd')](function(_0x3d160a){var _0x44771e=_0x43e9f0[_0xa580('0x53')]-_0x3d160a[0x0]['outboundQueuePauses'];var _0xe50ba=_0x43e9f0['dialPredictiveInterval']*0x3c;var _0xe77130=_0x5a9449[0x0][_0xa580('0x88')]+_0x5a9449[0x0]['predictiveIntervalAvgHoldtime'];var _0x5bb07f=(_0x5a9449[0x0][_0xa580('0x82')]+_0x5a9449[0x0][_0xa580('0x84')]+_0x5a9449[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x5a9449[0x0][_0xa580('0x71')];var _0x1a2e4f=_0x43e9f0[_0xa580('0x1b8')]/0x64;_0x43e9f0[_0xa580('0x6f')]=_0x3d160a[0x0][_0xa580('0x1d1')]||0x0;_0x43e9f0[_0xa580('0x6d')]=_0x5bb07f>0x0?_0x5bb07f:0x1;return _0x126815[_0xa580('0x1cc')](_0x44771e,_0xe50ba,_0xe77130,_0x5bb07f,_0x1a2e4f);})[_0xa580('0xbd')](function(_0x1351f7){return _0x1ccc2(_0x1351f7);})[_0xa580('0xb7')](function(_0x2229f7){return _0x1576ad(msgResponse(_0xa580('0x1d2'),_0xa580('0x13f'),JSON[_0xa580('0x4a')](_0x2229f7)));});}if(_0x43e9f0[_0xa580('0x1c2')]===_0xa580('0x1d3')){return _0x126815[_0xa580('0xc8')](_0x43e9f0['id'])['then'](function(_0x551cc0){var _0x2581dc=_0x43e9f0[_0xa580('0x53')]-_0x551cc0[0x0]['outboundQueuePauses'];var _0x280a7c=_0x43e9f0[_0xa580('0x1c0')]*0x3c;var _0x59bf85=_0x5a9449[0x0]['predictiveIntervalAvgTalktime']+_0x5a9449[0x0][_0xa580('0x69')];var _0x6accc2=(_0x5a9449[0x0][_0xa580('0x82')]+_0x5a9449[0x0][_0xa580('0x84')]+_0x5a9449[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x5a9449[0x0][_0xa580('0x71')];var _0x2968ef=_0x43e9f0[_0xa580('0x1b8')]/0x64;_0x43e9f0[_0xa580('0x6f')]=_0x551cc0[0x0][_0xa580('0x1d1')]||0x0;_0x43e9f0[_0xa580('0x6d')]=_0x6accc2>0x0?_0x6accc2:0x1;return _0x126815['busyFactor'](_0x2581dc,_0x280a7c,_0x59bf85,_0x6accc2,_0x2968ef);})[_0xa580('0xbd')](function(_0x3eb2bb){return _0x1ccc2(_0x3eb2bb);})['catch'](function(_0x1d2a2d){return _0x1576ad(msgResponse(_0xa580('0x1d2'),_0xa580('0x13f'),JSON['stringify'](_0x1d2a2d)));});}}else{return _0x1576ad(msgResponse('[getDataPredictive]',_0xa580('0x13f'),_0xa580('0x1cf')));}});};};Dialer[_0xa580('0x1c')]['startMethodPredictive']=function(_0x1eae85){var _0x57b1b8=this;return function(){var _0x3bfde7=0x0;var _0x329d7e=Math['floor'](_0x1eae85['erlangCallToSecond']*0x3e8);if(_0x329d7e>0x0){_0x329d7e=_0x329d7e<0x64?0x64:_0x329d7e;loggerPredictive['info'](_0x1eae85[_0xa580('0x3e')],_0xa580('0x1d4'),_0x329d7e,_0xa580('0x4b'));_0x1eae85['handlePredictive']=setInterval(function(){_0x57b1b8['handlePredictive'](_0x1eae85);loggerPredictiveCalls[_0xa580('0x7f')](_0xa580('0x1d5'),_0x3bfde7+=0x1);},_0x329d7e);}else{loggerPredictive['info'](_0x1eae85[_0xa580('0x3e')],_0xa580('0x1d6'));}};};Dialer[_0xa580('0x1c')][_0xa580('0x1d7')]=function(_0x34a589,_0x376f76){var _0x8d060c=this;return function(_0x263b2d){if(_[_0xa580('0x47')](_0x263b2d)){if(_[_0xa580('0xb4')](_0x376f76['UserId'])||!_0x376f76[_0xa580('0x1d8')]){if(_0x34a589[_0xa580('0x14f')]==='booked'){_0x34a589[_0xa580('0x129')]=_[_0xa580('0x3c')](_0x34a589[_0xa580('0x129')])?!![]:_0x34a589[_0xa580('0x129')];var _0x1644e1=uuid['v4']();_0x8d060c['actions'][_0x1644e1]=new Action(_0x34a589,_0x376f76,_0x1644e1);loggerBooked[_0xa580('0x7f')](_0xa580('0x1d9'),_0x1644e1,_0xa580('0x1da'),JSON[_0xa580('0x4a')](_0x34a589[_0xa580('0x129')]),'Queue:\x20',_0x34a589[_0xa580('0x3e')]);if(_0x34a589['queueStatusComplete']){_0x34a589['queueStatusComplete']=![];_0x8d060c[_0xa580('0x29')][_0x8d060c[_0xa580('0x27')][_0x1644e1][_0xa580('0xb9')]]=[];ami['Action']({'actionid':_0x1644e1,'action':_0xa580('0x1db'),'queue':_0x34a589[_0xa580('0x3e')]})[_0xa580('0xb7')](function(_0x5344e9){_0x8d060c[_0xa580('0xb8')](_0x34a589);_0x8d060c[_0xa580('0xc2')]({'active':![],'ContactId':_0x8d060c[_0xa580('0x27')][_0x1644e1]['ContactId'],'ListId':_0x8d060c[_0xa580('0x27')][_0x1644e1]['ListId'],'VoiceQueueId':_0x8d060c[_0xa580('0x27')][_0x1644e1][_0xa580('0xfd')]||undefined,'CampaignId':_0x8d060c[_0xa580('0x27')][_0x1644e1][_0xa580('0xd5')]||undefined})[_0xa580('0xb7')](loggerCatch(_0xa580('0x1dc')));delete _0x8d060c[_0xa580('0x27')][_0x1644e1];});}else{loggerBooked[_0xa580('0x7f')]('[booked][checkContactBlack][else]',JSON[_0xa580('0x4a')](_0x34a589[_0xa580('0x129')]),_0xa580('0x1dd'),_0x34a589[_0xa580('0x3e')]);_0x8d060c['updateOriginated'](_0x34a589);_0x8d060c[_0xa580('0xc2')]({'active':![],'ContactId':_0x8d060c[_0xa580('0x27')][_0x1644e1][_0xa580('0xd3')],'ListId':_0x8d060c[_0xa580('0x27')][_0x1644e1][_0xa580('0xd4')],'VoiceQueueId':_0x8d060c[_0xa580('0x27')][_0x1644e1]['VoiceQueueId']||undefined,'CampaignId':_0x8d060c[_0xa580('0x27')][_0x1644e1]['CampaignId']||undefined})[_0xa580('0xb7')](loggerCatch(_0xa580('0x1dc')));delete _0x8d060c[_0xa580('0x27')][_0x1644e1];}}else{return _0x8d060c['actionOriginate'](_0x34a589,_0x376f76);}}else{if(getDiff(_0x376f76['scheduledat'])<_0x34a589[_0xa580('0x1de')]*0x3c){if(_0x376f76[_0xa580('0x1df')]&&!_0x376f76[_0xa580('0x1df')][_0xa580('0x1e0')]){_0x8d060c[_0xa580('0x95')]['run'](_0x376f76['id'])[_0xa580('0x1f')](function(){_0x8d060c['updateOriginated'](_0x34a589);});}else{_0x8d060c[_0xa580('0xc3')]({'active':![]},_0x376f76['id'],0x1)[_0xa580('0x1f')](function(){console[_0xa580('0x1e1')](_0xa580('0x1e2'));_0x8d060c[_0xa580('0xb8')](_0x34a589);});}}else{_0x34a589['outboundReCallsDay']+=0x1;_0x8d060c['updateOriginated'](_0x34a589);if(_0x34a589['dialRecallInQueue']){_0x8d060c['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x376f76['ContactId'],'ListId':_0x376f76[_0xa580('0xd4')],'VoiceQueueId':_0x376f76[_0xa580('0xfd')]||undefined,'CampaignId':_0x376f76['CampaignId']||undefined})[_0xa580('0xb7')](loggerCatch(_0xa580('0x1e3')));_0x8d060c['createHistory'](createObjHistory(_0x34a589,_0x376f76,_0xa580('0x1e4'),0x17,_0xa580('0x1e5')))[_0xa580('0xb7')](loggerCatch(_0xa580('0x1e6')));}else{_0x8d060c[_0xa580('0xd1')](createObjHistory(_0x34a589,_0x376f76,_0xa580('0x1e7'),0x16,_0xa580('0x1e8')),_0xa580('0x1e9'),_0xa580('0x1ea'));}}}}else{_0x34a589[_0xa580('0x61')]+=0x1;_0x8d060c[_0xa580('0xd1')](createObjHistory(_0x34a589,_0x376f76,'BLACKLIST',0xd,_0xa580('0x1eb')),_0xa580('0x1ec'),_0xa580('0x1ed'));throw'inBlackList';}};};Dialer[_0xa580('0x1c')][_0xa580('0x157')]=function(_0x5dd296){var _0x4cc3f5=this;var _0x4397a5=[];var _0x466447=_0x5dd296['limitCalls']-_0x5dd296[_0xa580('0x72')]-_0x5dd296[_0xa580('0x1ee')];emitCampaignSummary(_0x5dd296);if(_0x466447>0x0){if(_0x466447>this[_0xa580('0x25')]){_0x466447=this['maxNumberOriginate'];}_0x5dd296[_0xa580('0x1ee')]+=_0x466447;this[_0xa580('0xc7')](_0x5dd296['id'],_0x466447,_0x5dd296[_0xa580('0x1ef')])[_0xa580('0xbd')](function(_0x2b9685){_0x5dd296['temp']-=_0x466447;_0x5dd296['temp']=_0x5dd296[_0xa580('0x1ee')]>0x0?_0x5dd296['temp']:0x0;if(!checkContactEmpty(_0x2b9685)){_0x5dd296['message']=_0xa580('0xa3');logger['info'](_0xa580('0x1f0')+_0x5dd296[_0xa580('0x3e')]);}else{_0x5dd296[_0xa580('0x72')]+=_0x2b9685[_0xa580('0x9c')];_0x5dd296[_0xa580('0x42')]='RUNNING';for(var _0x32d235=0x0;_0x32d235<_0x2b9685[_0xa580('0x9c')];_0x32d235+=0x1){_0x5dd296[_0xa580('0x1f1')]+=0x1;if(_[_0xa580('0xb4')](_0x2b9685[_0x32d235])||_[_0xa580('0xb4')](_0x2b9685[_0x32d235][_0xa580('0x164')])||_[_0xa580('0xb4')](_0x2b9685[_0x32d235][_0xa580('0x164')][_0xa580('0x165')])){_0x4cc3f5['emptyContact'](_0xa580('0x1f2'),_0x5dd296,_0x2b9685[_0x32d235]);}else{_0x4cc3f5['checkIsBlackListIvr'](_[_0xa580('0xd2')](_0x2b9685[_0x32d235],[_0xa580('0xd5'),_0xa580('0x1f3')]))[_0xa580('0xbd')](_0x4cc3f5['checkContactBlack'](_0x5dd296,_0x2b9685[_0x32d235]))[_0xa580('0xb7')](_0x4cc3f5[_0xa580('0xcf')](_0xa580('0x1f4'),_0x5dd296));}}}})['catch'](loggerGetContactDialer(_0xa580('0x1f5'),_0x5dd296,_0x466447));}};Dialer[_0xa580('0x1c')][_0xa580('0x153')]=function(_0x443823,_0x52ede9){var _0x2e899a=this;var _0x4634ee=[];var _0x52d0d6=_0x52ede9>=0x1?_0x52ede9:0x1;var _0x44909c=[];if(_0x443823[_0xa580('0x14f')]===_0xa580('0x8')){_0x52d0d6=0x1;}var _0x483646=Math['floor'](_0x443823[_0xa580('0x52')]*_0x52d0d6)-_0x443823[_0xa580('0x72')]-_0x443823[_0xa580('0x1ee')];emitVoiceQueueSummary(_0x443823);if(_0x443823['dialLimitQueue']>0x0){var _0x1b53f1=_0x443823[_0xa580('0x1f6')]-_0x443823['originated']-_0x443823['talking']-_0x443823[_0xa580('0x1ee')]-_0x443823[_0xa580('0x54')];if(_0x483646>_0x1b53f1){_0x483646=_0x1b53f1;}}if(_0x483646>0x0){if(_0x443823['dialMethod']===_0xa580('0x8')){_0x483646=0x1;}if(_0x483646>this[_0xa580('0x25')]){_0x483646=this['maxNumberOriginate'];}_0x443823['temp']+=_0x483646;for(var _0x29c405 in this['agents']){if(this[_0xa580('0x23')]['hasOwnProperty'](_0x29c405)){if(this[_0xa580('0x23')][_0x29c405][_0xa580('0xe4')]==='not_inuse'&&this[_0xa580('0x23')][_0x29c405]['status']==='reachable'){_0x4634ee['push'](this[_0xa580('0x23')][_0x29c405]['id']);}}}this[_0xa580('0xc5')](_0x443823['id'],_0x4634ee,_0x483646,_0x443823[_0xa580('0x1ef')])[_0xa580('0xbd')](function(_0x29d231){_0x443823[_0xa580('0x1ee')]-=_0x483646;_0x443823['temp']=_0x443823[_0xa580('0x1ee')]>0x0?_0x443823[_0xa580('0x1ee')]:0x0;if(!checkContactEmpty(_0x29d231)){_0x2e899a[_0xa580('0x1f7')](_0x443823)[_0xa580('0xbd')](sendMessageReschedule(_0x443823))['catch'](loggerCatch(_0xa580('0x1f8')));}else{_0x443823[_0xa580('0x72')]+=_0x29d231['length'];_0x443823['message']=_0x443823[_0xa580('0x14f')]===_0xa580('0x8')?_0xa580('0x1f9'):'RUNNING';for(var _0x1db23e=0x0;_0x1db23e<_0x29d231[_0xa580('0x9c')];_0x1db23e+=0x1){if(_[_0xa580('0xb4')](_0x29d231[_0x1db23e])||_[_0xa580('0xb4')](_0x29d231[_0x1db23e][_0xa580('0x164')])||_['isNil'](_0x29d231[_0x1db23e]['Contact'][_0xa580('0x165')])){_0x2e899a[_0xa580('0x1fa')](_0xa580('0x1f2'),_0x443823,_0x29d231[_0x1db23e]);}else{_0x2e899a[_0xa580('0x1fb')](_[_0xa580('0xd2')](_0x29d231[_0x1db23e],[_0xa580('0xfd'),_0xa580('0x1f3')]))[_0xa580('0xbd')](_0x2e899a[_0xa580('0x1d7')](_0x443823,_0x29d231[_0x1db23e]))[_0xa580('0xb7')](_0x2e899a[_0xa580('0xcf')](_0xa580('0x1f2'),_0x443823));}}}})[_0xa580('0xb7')](loggerGetContactDialer(_0xa580('0x1fc'),_0x443823,_0x483646));}};Dialer[_0xa580('0x1c')]['handlePredictive']=function(_0x1c4c78){var _0x32ba9d=this;if(_0x1c4c78[_0xa580('0x1f6')]>0x0){var _0x46687d=_0x1c4c78['dialLimitQueue']-_0x1c4c78['originated']-_0x1c4c78['talking'];if(_0x46687d>0x0){this[_0xa580('0x1fd')](_0x1c4c78);}else{loggerPredictiveCalls[_0xa580('0x7f')](_0xa580('0x1fe'));}}else{this[_0xa580('0x1fd')](_0x1c4c78);}};Dialer[_0xa580('0x1c')][_0xa580('0x1fd')]=function(_0x34afe4){var _0x579ac0=this;var _0x3f764e=[];_0x34afe4['originated']+=0x1;for(var _0x7b3d8e in this[_0xa580('0x23')]){if(this[_0xa580('0x23')]['hasOwnProperty'](_0x7b3d8e)){if(this[_0xa580('0x23')][_0x7b3d8e][_0xa580('0xe4')]===_0xa580('0x1ff')&&this['agents'][_0x7b3d8e][_0xa580('0xb6')]===_0xa580('0x200')){_0x3f764e[_0xa580('0x127')](this[_0xa580('0x23')][_0x7b3d8e]['id']);}}}this[_0xa580('0xc5')](_0x34afe4['id'],_0x3f764e,0x1,_0x34afe4[_0xa580('0x1ef')])[_0xa580('0xbd')](function(_0x387e10){if(!checkContactEmpty(_0x387e10)){checkContactLowerLimitOriginate(_0x34afe4,0x1,0x0);_0x579ac0[_0xa580('0x1f7')](_0x34afe4)[_0xa580('0xbd')](sendMessageReschedule(_0x34afe4))['catch'](loggerCatch(_0xa580('0x1f8')));}else{_0x34afe4[_0xa580('0x42')]=_0xa580('0x201');if(_[_0xa580('0xb4')](_0x387e10[0x0])||_[_0xa580('0xb4')](_0x387e10[0x0][_0xa580('0x164')])||_[_0xa580('0xb4')](_0x387e10[0x0][_0xa580('0x164')][_0xa580('0x165')])){_0x579ac0[_0xa580('0x1fa')](_0xa580('0x1f2'),_0x34afe4,_0x387e10[0x0]);}else{_0x579ac0['checkIsBlackList'](_[_0xa580('0xd2')](_0x387e10[0x0],[_0xa580('0xfd'),_0xa580('0x1f3')]))['then'](_0x579ac0['checkContactBlack'](_0x34afe4,_0x387e10[0x0]))[_0xa580('0xb7')](_0x579ac0[_0xa580('0xcf')](_0xa580('0x202'),_0x34afe4));}}})[_0xa580('0xb7')](loggerGetContactDialer(_0xa580('0x203'),_0x34afe4,0x1));emitVoiceQueueSummary(_0x34afe4);};Dialer[_0xa580('0x1c')][_0xa580('0x1cc')]=function(_0x580ba6,_0x10a939,_0x8a3016,_0x58d682,_0x4f62a3,_0x24b64b){loggerPredictive[_0xa580('0x7f')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info'](_0xa580('0x204'),_0x580ba6);loggerPredictive[_0xa580('0x7f')](_0xa580('0x205'),_0x10a939);loggerPredictive[_0xa580('0x7f')](_0xa580('0x206'),_0x8a3016);loggerPredictive[_0xa580('0x7f')]('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x58d682);loggerPredictive[_0xa580('0x7f')](_0xa580('0x207'),_0x4f62a3);loggerPredictive[_0xa580('0x7f')](_0xa580('0x89'));return new BPromise(function(_0x13cc22,_0xaccc27){if(_0x580ba6<=0x0||isNaN(_0x580ba6)){return _0xaccc27(msgResponse(_0xa580('0x208'),_0xa580('0x49'),_0xa580('0x209')+_0x580ba6));}if(_0x8a3016<=0x0||isNaN(_0x8a3016)){return _0xaccc27(msgResponse(_0xa580('0x208'),_0xa580('0x49'),_0xa580('0x20a')+_0x8a3016));}if(_0x58d682<=0x0||isNaN(_0x58d682)){return _0xaccc27(msgResponse(_0xa580('0x208'),'Error',_0xa580('0x20b')+_0x58d682));}if(_0x10a939<=0x0||isNaN(_0x10a939)){return _0xaccc27(msgResponse(_0xa580('0x208'),_0xa580('0x49'),_0xa580('0x20c')+_0x10a939));}if(_0x4f62a3<=0x0||isNaN(_0x4f62a3)){return _0xaccc27(msgResponse(_0xa580('0x208'),'Error','Amax\x20=\x20'+_0x4f62a3));}_0x24b64b=_0x24b64b||0x0;var _0x2402de=0x1/_0x8a3016;var _0x115d68=0x0;var _0x18b975=0x0;var _0x88050f=0x0;var _0xe40498=0x0;for(var _0x628c93=0x0;_0x88050f<_0x4f62a3;_0x628c93+=0x1){_0x18b975=_0x628c93/_0x10a939;_0x115d68=(_0x58d682*_0x18b975+_0x24b64b)/_0x2402de;_0x88050f=erlangb(_0x115d68,_0x580ba6);_0xe40498=_0x115d68/_0x580ba6*(0x1-erlangb(_0x115d68,_0x580ba6));}return _0x13cc22({'erlangCalls':_0x628c93,'erlangCallToSecond':_0x10a939/_0x628c93,'erlangAbandonmentRate':_0x88050f,'erlangBusyFactor':_0xe40498});});};Dialer['prototype'][_0xa580('0x1cd')]=function(_0x2b8de3,_0x1de9ab,_0x22f30d,_0x159e8d,_0x4c9f57,_0x281f87){loggerPredictive[_0xa580('0x7f')](_0xa580('0x20d'));loggerPredictive[_0xa580('0x7f')](_0xa580('0x204'),_0x2b8de3);loggerPredictive[_0xa580('0x7f')](_0xa580('0x205'),_0x1de9ab);loggerPredictive[_0xa580('0x7f')](_0xa580('0x206'),_0x22f30d);loggerPredictive[_0xa580('0x7f')](_0xa580('0x20e'),_0x159e8d);loggerPredictive[_0xa580('0x7f')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4c9f57);loggerPredictive[_0xa580('0x7f')](_0xa580('0x89'));return new BPromise(function(_0x116acc,_0x2d66fb){if(_0x2b8de3<=0x0||isNaN(_0x2b8de3)){return _0x2d66fb(msgResponse(_0xa580('0x20f'),'Error',_0xa580('0x209')+_0x2b8de3));}if(_0x22f30d<=0x0||isNaN(_0x22f30d)){return _0x2d66fb(msgResponse(_0xa580('0x20f'),'Error',_0xa580('0x20a')+_0x22f30d));}if(_0x159e8d<=0x0||isNaN(_0x159e8d)){return _0x2d66fb(msgResponse('[busyFactor]',_0xa580('0x49'),_0xa580('0x20b')+_0x159e8d));}if(_0x1de9ab<=0x0||isNaN(_0x1de9ab)){return _0x2d66fb(msgResponse('[busyFactor]',_0xa580('0x49'),_0xa580('0x20c')+_0x1de9ab));}if(_0x4c9f57<=0x0||isNaN(_0x4c9f57)){return _0x2d66fb(msgResponse(_0xa580('0x20f'),_0xa580('0x49'),_0xa580('0x210')+_0x4c9f57));}_0x281f87=_0x281f87||0x0;var _0x11d4f6=0x1/_0x22f30d;var _0x46c7da=0x0;var _0x338b57=0x0;var _0x205b11=0x0;var _0x319a6e=0x0;for(var _0x4051cf=0x0;_0x319a6e<_0x4c9f57;_0x4051cf+=0x1){_0x338b57=_0x4051cf/_0x1de9ab;_0x46c7da=(_0x159e8d*_0x338b57+_0x281f87)/_0x11d4f6;_0x205b11=erlangb(_0x46c7da,_0x2b8de3);_0x319a6e=_0x46c7da/_0x2b8de3*(0x1-erlangb(_0x46c7da,_0x2b8de3));}return _0x116acc({'erlangCalls':_0x4051cf,'erlangCallToSecond':_0x1de9ab/_0x4051cf,'erlangAbandonmentRate':_0x205b11,'erlangBusyFactor':_0x319a6e});});};module[_0xa580('0x211')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 41d27b2..3d9cc10 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 _0x4bd3=['CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','seconds','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x4bd3,0x1f0));var _0x34bd=function(_0x50dc3c,_0x4d513){_0x50dc3c=_0x50dc3c-0x0;var _0x10c1d3=_0x4bd3[_0x50dc3c];return _0x10c1d3;};'use strict';var util=require(_0x34bd('0x0'));var _=require(_0x34bd('0x1'));var moment=require('moment');function getSeconds(_0x4c7716,_0x4e85af){var _0x22ae0f=moment(_0x4c7716)[_0x34bd('0x2')](0x0);var _0x8c8b87=moment(_0x4e85af)['milliseconds'](0x0);return _0x22ae0f['diff'](_0x8c8b87,_0x34bd('0x3'));}function QueueCallerAbandon(_0x388bfe,_0x4b7f2c){this[_0x34bd('0x4')]=_0x388bfe['scheduledat'];this['type']=_0x388bfe[_0x34bd('0x5')];this['campaigntype']=_0x388bfe[_0x34bd('0x5')]==='outbound'?_0x34bd('0x6'):_0x388bfe['type'];this[_0x34bd('0x7')]=_0x388bfe[_0x34bd('0x7')];this[_0x34bd('0x8')]=_0x388bfe[_0x34bd('0x8')];this['countnoanswerretry']=_0x388bfe['countnoanswerretry'];this['countglobal']=_0x388bfe['countbusyretry']+_0x388bfe[_0x34bd('0x8')]+_0x388bfe[_0x34bd('0x9')]+_0x388bfe[_0x34bd('0xa')]+_0x388bfe[_0x34bd('0xb')]+_0x388bfe[_0x34bd('0xc')]+_0x388bfe[_0x34bd('0xd')]+_0x388bfe[_0x34bd('0xe')];this['countnosuchnumberretry']=_0x388bfe[_0x34bd('0xa')];this[_0x34bd('0xb')]=_0x388bfe[_0x34bd('0xb')];this[_0x34bd('0xc')]=_0x388bfe[_0x34bd('0xc')];this[_0x34bd('0xd')]=_0x388bfe[_0x34bd('0xd')];this[_0x34bd('0xe')]=_0x388bfe['countagentrejectretry'];this['uniqueid']=_0x4b7f2c['uniqueid'];this[_0x34bd('0xf')]=_0x388bfe[_0x34bd('0x10')];this[_0x34bd('0x11')]=_0x388bfe[_0x34bd('0x12')];this[_0x34bd('0x13')]=_0x388bfe[_0x34bd('0x13')];this[_0x34bd('0x14')]=_0x388bfe[_0x34bd('0x14')];this[_0x34bd('0x15')]=_0x388bfe[_0x34bd('0x15')];this[_0x34bd('0x16')]=this['droptime'];this[_0x34bd('0x17')]=getSeconds(_0x388bfe['responsetime'],_0x388bfe[_0x34bd('0x13')]);this[_0x34bd('0x18')]=getSeconds(this[_0x34bd('0x15')],_0x388bfe[_0x34bd('0x14')]);this[_0x34bd('0x19')]=0x0;this[_0x34bd('0x6')]=_0x4b7f2c['queue'];this[_0x34bd('0x1a')]=_0x4b7f2c[_0x34bd('0x1b')];this[_0x34bd('0x1c')]=_0x4b7f2c['reason'];this[_0x34bd('0x1d')]=_0x388bfe['callback'];this[_0x34bd('0x1e')]=_0x388bfe[_0x34bd('0x1e')];this[_0x34bd('0x1f')]=_0x388bfe[_0x34bd('0x1f')];this[_0x34bd('0x20')]=_0x388bfe[_0x34bd('0x20')];this['ContactId']=_0x388bfe[_0x34bd('0x21')];this[_0x34bd('0x22')]=_0x388bfe[_0x34bd('0x22')];this[_0x34bd('0x23')]=_0x388bfe['UserId'];this['VoiceQueueId']=_0x388bfe[_0x34bd('0x24')];this[_0x34bd('0x25')]=_0x388bfe[_0x34bd('0x25')];this[_0x34bd('0x26')]=_0x388bfe[_0x34bd('0x26')]||'';this[_0x34bd('0x27')]=_0x388bfe[_0x34bd('0x27')]||'';}module[_0x34bd('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0x3060=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','lodash','moment','milliseconds','diff','seconds','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','starttime','responsetime','endtime','droptime','ringtime','holdtime','talktime','queue','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme'];(function(_0x284bb4,_0x598e6c){var _0x574d5b=function(_0x4e3dac){while(--_0x4e3dac){_0x284bb4['push'](_0x284bb4['shift']());}};_0x574d5b(++_0x598e6c);}(_0x3060,0xeb));var _0x0306=function(_0x56138f,_0x1e9ebb){_0x56138f=_0x56138f-0x0;var _0x1acaf7=_0x3060[_0x56138f];return _0x1acaf7;};'use strict';var util=require('util');var _=require(_0x0306('0x0'));var moment=require(_0x0306('0x1'));function getSeconds(_0x11e354,_0x388170){var _0xd37d3f=moment(_0x11e354)[_0x0306('0x2')](0x0);var _0x577457=moment(_0x388170)[_0x0306('0x2')](0x0);return _0xd37d3f[_0x0306('0x3')](_0x577457,_0x0306('0x4'));}function QueueCallerAbandon(_0x4f3a76,_0x5a32e7){this[_0x0306('0x5')]=_0x4f3a76[_0x0306('0x5')];this[_0x0306('0x6')]=_0x4f3a76['type'];this['campaigntype']=_0x4f3a76[_0x0306('0x6')]==='outbound'?'queue':_0x4f3a76[_0x0306('0x6')];this[_0x0306('0x7')]=_0x4f3a76[_0x0306('0x7')];this[_0x0306('0x8')]=_0x4f3a76['countcongestionretry'];this['countnoanswerretry']=_0x4f3a76[_0x0306('0x9')];this['countglobal']=_0x4f3a76[_0x0306('0x7')]+_0x4f3a76['countcongestionretry']+_0x4f3a76['countnoanswerretry']+_0x4f3a76[_0x0306('0xa')]+_0x4f3a76[_0x0306('0xb')]+_0x4f3a76[_0x0306('0xc')]+_0x4f3a76['countmachineretry']+_0x4f3a76['countagentrejectretry'];this['countnosuchnumberretry']=_0x4f3a76[_0x0306('0xa')];this[_0x0306('0xb')]=_0x4f3a76[_0x0306('0xb')];this[_0x0306('0xc')]=_0x4f3a76[_0x0306('0xc')];this[_0x0306('0xd')]=_0x4f3a76[_0x0306('0xd')];this[_0x0306('0xe')]=_0x4f3a76['countagentrejectretry'];this[_0x0306('0xf')]=_0x5a32e7[_0x0306('0xf')];this[_0x0306('0x10')]=_0x4f3a76['name'];this['calleridnum']=_0x4f3a76['number'];this[_0x0306('0x11')]=_0x4f3a76[_0x0306('0x11')];this[_0x0306('0x12')]=_0x4f3a76['responsetime'];this['droptime']=_0x4f3a76['droptime'];this[_0x0306('0x13')]=this[_0x0306('0x14')];this[_0x0306('0x15')]=getSeconds(_0x4f3a76['responsetime'],_0x4f3a76[_0x0306('0x11')]);this[_0x0306('0x16')]=getSeconds(this[_0x0306('0x14')],_0x4f3a76[_0x0306('0x12')]);this[_0x0306('0x17')]=0x0;this[_0x0306('0x18')]=_0x5a32e7[_0x0306('0x18')];this['membername']=_0x5a32e7[_0x0306('0x19')];this[_0x0306('0x1a')]=_0x5a32e7[_0x0306('0x1a')];this[_0x0306('0x1b')]=_0x4f3a76['callback'];this[_0x0306('0x1c')]=_0x4f3a76[_0x0306('0x1c')];this['callbackat']=_0x4f3a76[_0x0306('0x1d')];this[_0x0306('0x1e')]=_0x4f3a76['recallme'];this[_0x0306('0x1f')]=_0x4f3a76[_0x0306('0x1f')];this[_0x0306('0x20')]=_0x4f3a76[_0x0306('0x20')];this[_0x0306('0x21')]=_0x4f3a76['UserId'];this[_0x0306('0x22')]=_0x4f3a76[_0x0306('0x22')];this[_0x0306('0x23')]=_0x4f3a76[_0x0306('0x23')];this[_0x0306('0x24')]=_0x4f3a76[_0x0306('0x24')]||'';this['originatecalleridname']=_0x4f3a76['originatecalleridname']||'';}module[_0x0306('0x25')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 427f57d..c4d22f6 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 _0xf637=['tech','Trunk','name','fax','localstationid','headerinfo','path','AttachmentId','util','lodash','moment','uniqueid','channel','format','%s/%s/%s'];(function(_0x1e6db3,_0x5643ac){var _0x1de886=function(_0x351318){while(--_0x351318){_0x1e6db3['push'](_0x1e6db3['shift']());}};_0x1de886(++_0x5643ac);}(_0xf637,0x1ca));var _0x7f63=function(_0x11e2c2,_0x8aa693){_0x11e2c2=_0x11e2c2-0x0;var _0x5707ed=_0xf637[_0x11e2c2];return _0x5707ed;};'use strict';var util=require(_0x7f63('0x0'));var _=require(_0x7f63('0x1'));var moment=require(_0x7f63('0x2'));function Action(_0x145cc9,_0x5e0dcc,_0x176edc){this[_0x7f63('0x3')]=_0x145cc9||undefined;this[_0x7f63('0x4')]=util[_0x7f63('0x5')](_0x7f63('0x6'),_0x5e0dcc[_0x7f63('0x7')],_0x5e0dcc[_0x7f63('0x8')][_0x7f63('0x9')],_0x176edc[_0x7f63('0xa')]);this['localstationid']=_0x5e0dcc[_0x7f63('0xb')];this[_0x7f63('0xc')]=_0x5e0dcc[_0x7f63('0xc')];this[_0x7f63('0xd')]=_0x176edc[_0x7f63('0xd')];this['AttachmentId']=_0x176edc[_0x7f63('0xe')];}module['exports']=Action; \ No newline at end of file +var _0x182c=['util','lodash','uniqueid','channel','format','%s/%s/%s','tech','Trunk','name','localstationid','headerinfo','path','AttachmentId'];(function(_0x4ab3fb,_0x776775){var _0x34fe1e=function(_0x1c94c5){while(--_0x1c94c5){_0x4ab3fb['push'](_0x4ab3fb['shift']());}};_0x34fe1e(++_0x776775);}(_0x182c,0x179));var _0xc182=function(_0xaec7d,_0x44dce6){_0xaec7d=_0xaec7d-0x0;var _0x54a0ce=_0x182c[_0xaec7d];return _0x54a0ce;};'use strict';var util=require(_0xc182('0x0'));var _=require(_0xc182('0x1'));var moment=require('moment');function Action(_0x388b5e,_0x5625a6,_0x1c0524){this[_0xc182('0x2')]=_0x388b5e||undefined;this[_0xc182('0x3')]=util[_0xc182('0x4')](_0xc182('0x5'),_0x5625a6[_0xc182('0x6')],_0x5625a6[_0xc182('0x7')][_0xc182('0x8')],_0x1c0524['fax']);this['localstationid']=_0x5625a6[_0xc182('0x9')];this['headerinfo']=_0x5625a6[_0xc182('0xa')];this['path']=_0x1c0524[_0xc182('0xb')];this[_0xc182('0xc')]=_0x1c0524[_0xc182('0xc')];}module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 17d1614..d0dc1e1 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 _0x550b=['faxstatus','receivefax','syncReceiveFax','hangup','originateresponse','prototype','syncNewchannel','context','hasOwnProperty','exten','localstationid','uniqueid','name','info','channel','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','value','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','resolution','calleridnum','pagestransferred','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','parse','application/pdf','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','merge','pick','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','then','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','execute','format','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','exports','util','bluebird','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','channels','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten'];(function(_0x154940,_0x4a448a){var _0x401409=function(_0x45cdcf){while(--_0x45cdcf){_0x154940['push'](_0x154940['shift']());}};_0x401409(++_0x4a448a);}(_0x550b,0x14a));var _0xb550=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0x550b[_0x44a64f];return _0x52024b;};'use strict';var util=require(_0xb550('0x0'));var _=require('lodash');var BPromise=require(_0xb550('0x1'));var uuid=require('uuid');var moment=require('moment');var path=require(_0xb550('0x2'));var tiff2pdf=require(_0xb550('0x3'));var gs=require(_0xb550('0x4'));var logger=require(_0xb550('0x5'))(_0xb550('0x6'));var ami=require(_0xb550('0x7'));var rpcDb=require('./rpcDb');var Channel=require(_0xb550('0x8'));var ut=require(_0xb550('0x9'));var Action=require(_0xb550('0xa'));var faxAccount=require(_0xb550('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x5e75ca){this[_0xb550('0xc')]={};this[_0xb550('0xd')]=_0x5e75ca[_0xb550('0xd')];this[_0xb550('0xe')]=_0x5e75ca[_0xb550('0xe')];this[_0xb550('0xf')]={};ami['on'](_0xb550('0x10'),this['syncNewchannel'][_0xb550('0x11')](this));ami['on'](_0xb550('0x12'),this[_0xb550('0x13')][_0xb550('0x11')](this));ami['on'](_0xb550('0x14'),this[_0xb550('0x15')][_0xb550('0x11')](this));ami['on'](_0xb550('0x16'),this[_0xb550('0x17')][_0xb550('0x11')](this));ami['on'](_0xb550('0x18'),this['syncFaxStatus']['bind'](this));ami['on'](_0xb550('0x19'),this[_0xb550('0x1a')][_0xb550('0x11')](this));ami['on'](_0xb550('0x1b'),this['syncHangup'][_0xb550('0x11')](this));ami['on'](_0xb550('0x1c'),this['syncOriginateResponse']['bind'](this));}Fax[_0xb550('0x1d')][_0xb550('0x1e')]=function(_0x21434b){if(_0x21434b[_0xb550('0x1f')]==='from-voip-provider'){for(var _0x4cca14 in this[_0xb550('0xd')]){if(this[_0xb550('0xd')][_0xb550('0x20')](_0x4cca14)){if(_0x21434b[_0xb550('0x21')]===this[_0xb550('0xd')][_0x4cca14][_0xb550('0x22')]){this[_0xb550('0xc')][_0x21434b['uniqueid']]={};this[_0xb550('0xc')][_0x21434b[_0xb550('0x23')]]['channel']=_0x21434b['channel'];this[_0xb550('0xc')][_0x21434b[_0xb550('0x23')]]['id']=this['faxAccounts'][_0x4cca14]['id'];this['channels'][_0x21434b[_0xb550('0x23')]][_0xb550('0x24')]=this[_0xb550('0xd')][_0x4cca14][_0xb550('0x24')];logger[_0xb550('0x25')](_0x21434b['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this[_0xb550('0xf')][_0x21434b['uniqueid']]){this['channels'][_0x21434b[_0xb550('0x23')]]={};this[_0xb550('0xc')][_0x21434b[_0xb550('0x23')]][_0xb550('0x26')]=_0x21434b[_0xb550('0x26')];logger[_0xb550('0x25')](_0x21434b['uniqueid'],_0xb550('0x27'));}};Fax[_0xb550('0x1d')]['syncVarSet']=function(_0x29f25c){if(this['channels'][_0x29f25c[_0xb550('0x23')]]){for(var _0x25ebb6 in _0x29f25c['variable']){if(_0x29f25c[_0xb550('0x28')][_0xb550('0x20')](_0x25ebb6)){this[_0xb550('0xc')][_0x29f25c[_0xb550('0x23')]][_0x25ebb6]=_0x29f25c['value'];}}}};Fax[_0xb550('0x1d')][_0xb550('0x15')]=function(_0x4f62b0){if(this[_0xb550('0xc')][_0x4f62b0['uniqueid']]){this['channels'][_0x4f62b0['uniqueid']][_0xb550('0x29')]=_0x4f62b0[_0xb550('0x29')];this['channels'][_0x4f62b0[_0xb550('0x23')]][_0xb550('0x2a')]=_0x4f62b0[_0xb550('0x2a')];}};Fax['prototype'][_0xb550('0x17')]=function(_0x273e0d){if(this[_0xb550('0xc')][_0x273e0d['uniqueid']]){for(var _0x363c99 in _0x273e0d[_0xb550('0x28')]){if(_0x273e0d[_0xb550('0x28')][_0xb550('0x20')](_0x363c99)){this[_0xb550('0xc')][_0x273e0d['uniqueid']][_0x363c99]=_0x273e0d[_0xb550('0x2b')];}}}};Fax['prototype'][_0xb550('0x2c')]=function(_0x24bca1){if(this[_0xb550('0xc')][_0x24bca1[_0xb550('0x23')]]){this[_0xb550('0xc')][_0x24bca1[_0xb550('0x23')]][_0xb550('0x2d')]=_0x24bca1[_0xb550('0x2d')];this[_0xb550('0xc')][_0x24bca1[_0xb550('0x23')]][_0xb550('0x2e')]=_0x24bca1[_0xb550('0x2e')];this[_0xb550('0xc')][_0x24bca1['uniqueid']][_0xb550('0x22')]=_0x24bca1['localstationid'];this[_0xb550('0xc')][_0x24bca1[_0xb550('0x23')]][_0xb550('0x2f')]=_0x24bca1['filename'];logger[_0xb550('0x25')](_0x24bca1[_0xb550('0x23')],_0xb550('0x30'));}};Fax[_0xb550('0x1d')][_0xb550('0x1a')]=function(_0x432dce){var _0x5c9724=this;if(this[_0xb550('0xc')][_0x432dce[_0xb550('0x23')]]){var _0x3e2471=this[_0xb550('0xc')][_0x432dce[_0xb550('0x23')]]['id'];this['channels'][_0x432dce['uniqueid']][_0xb550('0x31')]=_0x432dce['remotestationid'];this[_0xb550('0xc')][_0x432dce[_0xb550('0x23')]]['pagestransferred']=_0x432dce['pagestransferred'];this[_0xb550('0xc')][_0x432dce[_0xb550('0x23')]][_0xb550('0x22')]=_0x432dce['localstationid'];this[_0xb550('0xc')][_0x432dce[_0xb550('0x23')]][_0xb550('0x32')]=_0x432dce[_0xb550('0x32')];this[_0xb550('0xc')][_0x432dce[_0xb550('0x23')]]['transferrate']=_0x432dce['transferrate'];this[_0xb550('0xc')][_0x432dce[_0xb550('0x23')]][_0xb550('0x2f')]=_0x432dce[_0xb550('0x2f')];this[_0xb550('0xc')][_0x432dce[_0xb550('0x23')]][_0xb550('0x33')]=_0x432dce['calleridnum'];if(this[_0xb550('0xc')][_0x432dce[_0xb550('0x23')]][_0xb550('0x34')]>0x0){tiff2pdf(_0x432dce[_0xb550('0x2f')],_0xb550('0x35'),function(_0x5515eb){logger[_0xb550('0x25')](_0x432dce[_0xb550('0x23')],_0xb550('0x36'),_0x5515eb['message']);attachment['create']({'name':path[_0xb550('0x37')](_0x432dce[_0xb550('0x2f')])[_0xb550('0x24')],'basename':path[_0xb550('0x37')](_0x432dce[_0xb550('0x2f')])[_0xb550('0x24')]+'.pdf','type':_0xb550('0x38')})['then'](function(_0x2527d0){faxAccount[_0xb550('0x39')](_0x3e2471,{'from':_0x432dce['calleridnum'],'mapKey':_0xb550('0x6'),'body':path[_0xb550('0x37')](_0x432dce[_0xb550('0x2f')])[_0xb550('0x24')]+'.pdf','AttachmentId':_0x2527d0['id']})['catch'](function(_0x48655d){logger[_0xb550('0x3a')](_0x432dce[_0xb550('0x23')],_0xb550('0x3b'),JSON[_0xb550('0x3c')](_0x48655d));});})[_0xb550('0x3d')](function(_0x5860e1){logger[_0xb550('0x3a')](_0x432dce['uniqueid'],_0xb550('0x3e'),JSON[_0xb550('0x3c')](_0x5860e1));});});}logger[_0xb550('0x25')](_0x432dce[_0xb550('0x23')],_0xb550('0x3e'));}};Fax[_0xb550('0x1d')]['syncOriginateResponse']=function(_0x1dc551){if(this[_0xb550('0xf')][_0x1dc551[_0xb550('0x23')]]){_[_0xb550('0x3f')](this[_0xb550('0xc')][_0x1dc551[_0xb550('0x23')]],_[_0xb550('0x40')](_0x1dc551,[_0xb550('0x41'),_0xb550('0x42')]));}};function updateStatus(_0x398941){if(_0x398941['AttachmentId']){faxMessage[_0xb550('0x43')](_0x398941[_0xb550('0x44')],{'failMessage':_0xb550('0x45')})['then'](function(_0x4a5070){ut['logger']('[Fax][Message][Error][Updated]',_0x4a5070);})[_0xb550('0x3d')](function(_0x18a532){ut[_0xb550('0x46')](_0xb550('0x47'),_0x18a532);});}else{ut['logger'](_0xb550('0x48'));}}Fax[_0xb550('0x1d')][_0xb550('0x49')]=function(_0x1220f0,_0x43b2e9,_0x105918){var _0x3e9884=this;var _0x30eba0={};if(_0x43b2e9){_0x30eba0={'read':_0x43b2e9};}else{_0x30eba0={'failMessage':_0x105918};}if(this[_0xb550('0xf')][_0x1220f0][_0xb550('0x44')]){faxMessage[_0xb550('0x43')](this['actions'][_0x1220f0][_0xb550('0x44')],_0x30eba0)[_0xb550('0x4a')](function(_0x2db958){ut[_0xb550('0x46')](_0xb550('0x4b'),_0x2db958);})[_0xb550('0x3d')](function(_0x4f6414){ut[_0xb550('0x46')](_0xb550('0x4c'),_0x4f6414);})[_0xb550('0x4d')](function(){delete _0x3e9884['channels'][_0x1220f0];delete _0x3e9884[_0xb550('0xf')][_0x1220f0];});}else{ut[_0xb550('0x46')](_0xb550('0x4e'));delete this[_0xb550('0xc')][_0x1220f0];delete this['actions'][_0x1220f0];}};Fax[_0xb550('0x1d')][_0xb550('0x4f')]=function(_0x46c3b6){var _0x4529c9=this;if(this[_0xb550('0xc')][_0x46c3b6[_0xb550('0x23')]]){if(this[_0xb550('0xf')][_0x46c3b6['uniqueid']]){this[_0xb550('0xc')][_0x46c3b6[_0xb550('0x23')]]['id']=this[_0xb550('0xf')][_0x46c3b6[_0xb550('0x23')]]['id'];this[_0xb550('0xc')][_0x46c3b6[_0xb550('0x23')]][_0xb550('0x24')]=this[_0xb550('0xf')][_0x46c3b6[_0xb550('0x23')]][_0xb550('0x24')];}logger[_0xb550('0x25')](_0x46c3b6[_0xb550('0x23')],this[_0xb550('0xf')][_0x46c3b6[_0xb550('0x23')]]?_0xb550('0x50'):_0xb550('0x51'),JSON[_0xb550('0x3c')](this['channels'][_0x46c3b6['uniqueid']]));if(this[_0xb550('0xf')][_0x46c3b6['uniqueid']]){if(this[_0xb550('0xc')][_0x46c3b6['uniqueid']][_0xb550('0x52')]>0x0&&this[_0xb550('0xc')][_0x46c3b6[_0xb550('0x23')]][_0xb550('0x18')]==='SUCCESS'){this[_0xb550('0x49')](_0x46c3b6[_0xb550('0x23')],!![]);}else{this[_0xb550('0x49')](_0x46c3b6[_0xb550('0x23')],![],this['channels'][_0x46c3b6['uniqueid']][_0xb550('0x53')]?_0xb550('0x54')+this[_0xb550('0xc')][_0x46c3b6[_0xb550('0x23')]]['faxstatusstring']:_0xb550('0x55'));}}}};Fax[_0xb550('0x1d')][_0xb550('0x56')]=function(_0x3bd826){var _0x1e090b=this;return new BPromise(function(_0x133712,_0x249fb2){_0x1e090b[_0xb550('0x57')](_0x3bd826,_0x1e090b[_0xb550('0xd')][_0x3bd826[_0xb550('0x58')]])['then'](function(_0x4fcd8c){ut[_0xb550('0x46')](_0xb550('0x59'),_0x4fcd8c);_0x133712(ut[_0xb550('0x5a')](_0xb550('0x5b')));})[_0xb550('0x3d')](function(_0x2f97d4){ut['logger']('[Fax][execOriginate][failure]',_0x2f97d4);updateStatus(_0x3bd826);_0x249fb2(ut[_0xb550('0x5a')](_0xb550('0x5c')));});});};Fax[_0xb550('0x1d')]['checkAfterSend']=function(_0x4ee642){var _0x2b1f55=this;return new BPromise(function(_0x4900b5,_0x133877){var _0x2ede75=_0x2b1f55[_0xb550('0x5d')](_0x2b1f55[_0xb550('0xd')][_0x4ee642[_0xb550('0x58')]][_0xb550('0x5e')],_0x4ee642);if(_0x2ede75[_0xb550('0x5f')]){_0x4900b5(ut[_0xb550('0x5a')](_0xb550('0x60')));}else{_0x133877(ut[_0xb550('0x5a')](_0x2ede75['message']));}});};function originate(_0x508b33,_0xbce5c9,_0x11103a){return new BPromise(function(_0x1cd504,_0x3d66c7){if(_0x11103a){var _0x13bcb3=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[_0xb550('0x37')](_0x508b33['path'])[_0xb550('0x24')],_0x508b33[_0xb550('0x2')]);gs[_0xb550('0x61')](_0x13bcb3)[_0xb550('0x4a')](function(){_0x508b33[_0xb550('0x2')]=util[_0xb550('0x62')]('%s/%s.tif',path[_0xb550('0x37')](_0x508b33[_0xb550('0x2')])[_0xb550('0x63')],path[_0xb550('0x37')](_0x508b33[_0xb550('0x2')])[_0xb550('0x24')]);_0xbce5c9[_0xb550('0x64')]=_0x508b33['path'];ut[_0xb550('0x46')](_0xb550('0x65'),'');ami[_0xb550('0x66')](ut[_0xb550('0x67')](_0x508b33,_0xbce5c9))['then'](function(_0x18dde2){_0x1cd504(_0x18dde2);})[_0xb550('0x3d')](function(_0x1fa215){_0x3d66c7(_0x1fa215);});})[_0xb550('0x3d')](function(_0x196535){_0x3d66c7(_0x196535);});}else{ami[_0xb550('0x66')](ut['variablesAction'](_0x508b33,_0xbce5c9))[_0xb550('0x4a')](function(_0x350249){_0x1cd504(_0x350249);})[_0xb550('0x3d')](function(_0x51558f){_0x3d66c7(_0x51558f);});}});}Fax[_0xb550('0x1d')][_0xb550('0x57')]=function(_0x46bba0,_0x2a480a){var _0x3ed29d=this;return new BPromise(function(_0x4084c1,_0x26ae6e){var _0x116821=uuid['v4']();var _0x1efe90=ut[_0xb550('0x68')](_0x46bba0,_0x2a480a);_0x3ed29d[_0xb550('0xf')][_0x116821]=new Action(_0x116821,_0x2a480a,_0x46bba0);var _0x4600c9=_0x3ed29d[_0xb550('0xf')][_0x116821];if(path[_0xb550('0x37')](_0x46bba0[_0xb550('0x2')])[_0xb550('0x69')]==='.pdf'){originate(_0x4600c9,_0x1efe90,!![])[_0xb550('0x4a')](function(_0x55e684){_0x4084c1(_0x55e684);})[_0xb550('0x3d')](function(_0x46ed49){_0x26ae6e(_0x46ed49);});}else{originate(_0x4600c9,_0x1efe90,![])['then'](function(_0x1d2c55){_0x4084c1(_0x1d2c55);})['catch'](function(_0x47ce16){_0x26ae6e(_0x47ce16);});}});};Fax[_0xb550('0x1d')][_0xb550('0x6a')]=function(_0x3a6e0c){return!_['isNil'](_0x3a6e0c)&&!_['isNil'](_0x3a6e0c[_0xb550('0x24')])&&!_[_0xb550('0x6b')](_0x3a6e0c['active'])&&_0x3a6e0c[_0xb550('0x6c')]&&!_['isNil'](this[_0xb550('0xe')][util[_0xb550('0x62')]('SIP/%s',_0x3a6e0c[_0xb550('0x24')])])&&!_[_0xb550('0x6b')](this[_0xb550('0xe')][util[_0xb550('0x62')](_0xb550('0x6d'),_0x3a6e0c[_0xb550('0x24')])][_0xb550('0x2e')])&&(this['trunks'][util[_0xb550('0x62')]('SIP/%s',_0x3a6e0c[_0xb550('0x24')])][_0xb550('0x2e')]===_0xb550('0x6e')||this[_0xb550('0xe')][util[_0xb550('0x62')](_0xb550('0x6d'),_0x3a6e0c[_0xb550('0x24')])][_0xb550('0x2e')]===_0xb550('0x6f'));};Fax[_0xb550('0x1d')][_0xb550('0x5d')]=function(_0x164462,_0x3795aa){if(!this[_0xb550('0x6a')](_0x164462)){ut['logger'](_0xb550('0x70'),_[_0xb550('0x6b')](_0x164462)?'':_0x164462[_0xb550('0x24')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xb550('0x71')};}if(_[_0xb550('0x6b')](_0x3795aa[_0xb550('0x6')])){ut[_0xb550('0x46')](_0xb550('0x72'),JSON[_0xb550('0x3c')](_0x3795aa));return{'isValid':![],'message':_0xb550('0x73')};}if(_[_0xb550('0x6b')](_0x3795aa[_0xb550('0x2')])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON[_0xb550('0x3c')](_0x3795aa));return{'isValid':![],'message':_0xb550('0x74')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0xb550('0x75')]=Fax; \ No newline at end of file +var _0xfa7d=['uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','then','notify','fax','.pdf','catch','error','\x20receiveFax\x20','stringify','syncOriginateResponse','actions','merge','pick','response','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','execOriginate','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','util','lodash','uuid','moment','path','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','newchannel','bind','varset','syncVarSet','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','originateresponse','prototype','syncNewchannel','from-voip-provider','hasOwnProperty','exten','localstationid'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xfa7d,0xcc));var _0xdfa7=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xfa7d[_0x16d10f];return _0x50c823;};'use strict';var util=require(_0xdfa7('0x0'));var _=require(_0xdfa7('0x1'));var BPromise=require('bluebird');var uuid=require(_0xdfa7('0x2'));var moment=require(_0xdfa7('0x3'));var path=require(_0xdfa7('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0xdfa7('0x5'));var logger=require(_0xdfa7('0x6'))('fax');var ami=require(_0xdfa7('0x7'));var rpcDb=require(_0xdfa7('0x8'));var Channel=require(_0xdfa7('0x9'));var ut=require('./util/util');var Action=require(_0xdfa7('0xa'));var faxAccount=require(_0xdfa7('0xb'));var attachment=require(_0xdfa7('0xc'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x50b7f3){this[_0xdfa7('0xd')]={};this[_0xdfa7('0xe')]=_0x50b7f3[_0xdfa7('0xe')];this[_0xdfa7('0xf')]=_0x50b7f3[_0xdfa7('0xf')];this['actions']={};ami['on'](_0xdfa7('0x10'),this['syncNewchannel'][_0xdfa7('0x11')](this));ami['on'](_0xdfa7('0x12'),this[_0xdfa7('0x13')][_0xdfa7('0x11')](this));ami['on'](_0xdfa7('0x14'),this['syncNewState']['bind'](this));ami['on'](_0xdfa7('0x15'),this[_0xdfa7('0x16')]['bind'](this));ami['on'](_0xdfa7('0x17'),this[_0xdfa7('0x18')][_0xdfa7('0x11')](this));ami['on']('receivefax',this[_0xdfa7('0x19')][_0xdfa7('0x11')](this));ami['on'](_0xdfa7('0x1a'),this['syncHangup'][_0xdfa7('0x11')](this));ami['on'](_0xdfa7('0x1b'),this['syncOriginateResponse'][_0xdfa7('0x11')](this));}Fax[_0xdfa7('0x1c')][_0xdfa7('0x1d')]=function(_0x455abe){if(_0x455abe['context']===_0xdfa7('0x1e')){for(var _0x2f857c in this['faxAccounts']){if(this[_0xdfa7('0xe')][_0xdfa7('0x1f')](_0x2f857c)){if(_0x455abe[_0xdfa7('0x20')]===this[_0xdfa7('0xe')][_0x2f857c][_0xdfa7('0x21')]){this['channels'][_0x455abe[_0xdfa7('0x22')]]={};this[_0xdfa7('0xd')][_0x455abe[_0xdfa7('0x22')]][_0xdfa7('0x23')]=_0x455abe[_0xdfa7('0x23')];this[_0xdfa7('0xd')][_0x455abe['uniqueid']]['id']=this[_0xdfa7('0xe')][_0x2f857c]['id'];this[_0xdfa7('0xd')][_0x455abe[_0xdfa7('0x22')]][_0xdfa7('0x24')]=this['faxAccounts'][_0x2f857c][_0xdfa7('0x24')];logger[_0xdfa7('0x25')](_0x455abe['uniqueid'],_0xdfa7('0x26'));}}}}if(this['actions'][_0x455abe['uniqueid']]){this[_0xdfa7('0xd')][_0x455abe[_0xdfa7('0x22')]]={};this[_0xdfa7('0xd')][_0x455abe[_0xdfa7('0x22')]][_0xdfa7('0x23')]=_0x455abe[_0xdfa7('0x23')];logger[_0xdfa7('0x25')](_0x455abe[_0xdfa7('0x22')],_0xdfa7('0x26'));}};Fax[_0xdfa7('0x1c')][_0xdfa7('0x13')]=function(_0xa9c32a){if(this[_0xdfa7('0xd')][_0xa9c32a[_0xdfa7('0x22')]]){for(var _0x198eec in _0xa9c32a[_0xdfa7('0x27')]){if(_0xa9c32a[_0xdfa7('0x27')]['hasOwnProperty'](_0x198eec)){this[_0xdfa7('0xd')][_0xa9c32a[_0xdfa7('0x22')]][_0x198eec]=_0xa9c32a[_0xdfa7('0x28')];}}}};Fax[_0xdfa7('0x1c')][_0xdfa7('0x29')]=function(_0x49ced7){if(this[_0xdfa7('0xd')][_0x49ced7[_0xdfa7('0x22')]]){this[_0xdfa7('0xd')][_0x49ced7[_0xdfa7('0x22')]][_0xdfa7('0x2a')]=_0x49ced7[_0xdfa7('0x2a')];this[_0xdfa7('0xd')][_0x49ced7['uniqueid']][_0xdfa7('0x2b')]=_0x49ced7['channelstatedesc'];}};Fax[_0xdfa7('0x1c')]['syncNewExten']=function(_0x250a33){if(this['channels'][_0x250a33[_0xdfa7('0x22')]]){for(var _0x29fa64 in _0x250a33[_0xdfa7('0x27')]){if(_0x250a33[_0xdfa7('0x27')][_0xdfa7('0x1f')](_0x29fa64)){this[_0xdfa7('0xd')][_0x250a33[_0xdfa7('0x22')]][_0x29fa64]=_0x250a33['value'];}}}};Fax[_0xdfa7('0x1c')]['syncFaxStatus']=function(_0x5a985d){if(this[_0xdfa7('0xd')][_0x5a985d[_0xdfa7('0x22')]]){this['channels'][_0x5a985d[_0xdfa7('0x22')]][_0xdfa7('0x2c')]=_0x5a985d['operation'];this[_0xdfa7('0xd')][_0x5a985d['uniqueid']][_0xdfa7('0x2d')]=_0x5a985d['status'];this[_0xdfa7('0xd')][_0x5a985d['uniqueid']][_0xdfa7('0x21')]=_0x5a985d[_0xdfa7('0x21')];this[_0xdfa7('0xd')][_0x5a985d[_0xdfa7('0x22')]][_0xdfa7('0x2e')]=_0x5a985d[_0xdfa7('0x2e')];logger[_0xdfa7('0x25')](_0x5a985d[_0xdfa7('0x22')],_0xdfa7('0x2f'));}};Fax[_0xdfa7('0x1c')][_0xdfa7('0x19')]=function(_0x4ae484){var _0x51799f=this;if(this['channels'][_0x4ae484[_0xdfa7('0x22')]]){var _0x430317=this[_0xdfa7('0xd')][_0x4ae484[_0xdfa7('0x22')]]['id'];this[_0xdfa7('0xd')][_0x4ae484[_0xdfa7('0x22')]][_0xdfa7('0x30')]=_0x4ae484[_0xdfa7('0x30')];this['channels'][_0x4ae484['uniqueid']][_0xdfa7('0x31')]=_0x4ae484['pagestransferred'];this[_0xdfa7('0xd')][_0x4ae484['uniqueid']][_0xdfa7('0x21')]=_0x4ae484[_0xdfa7('0x21')];this['channels'][_0x4ae484[_0xdfa7('0x22')]][_0xdfa7('0x32')]=_0x4ae484[_0xdfa7('0x32')];this['channels'][_0x4ae484['uniqueid']][_0xdfa7('0x33')]=_0x4ae484[_0xdfa7('0x33')];this[_0xdfa7('0xd')][_0x4ae484[_0xdfa7('0x22')]][_0xdfa7('0x2e')]=_0x4ae484[_0xdfa7('0x2e')];this[_0xdfa7('0xd')][_0x4ae484[_0xdfa7('0x22')]][_0xdfa7('0x34')]=_0x4ae484[_0xdfa7('0x34')];if(this[_0xdfa7('0xd')][_0x4ae484[_0xdfa7('0x22')]][_0xdfa7('0x31')]>0x0){tiff2pdf(_0x4ae484[_0xdfa7('0x2e')],'/var/opt/motion2/server/files/attachments/',function(_0x54e4e0){logger[_0xdfa7('0x25')](_0x4ae484['uniqueid'],_0xdfa7('0x35'),_0x54e4e0[_0xdfa7('0x36')]);attachment[_0xdfa7('0x37')]({'name':path[_0xdfa7('0x38')](_0x4ae484['filename'])[_0xdfa7('0x24')],'basename':path[_0xdfa7('0x38')](_0x4ae484[_0xdfa7('0x2e')])[_0xdfa7('0x24')]+'.pdf','type':'application/pdf'})[_0xdfa7('0x39')](function(_0x42447f){faxAccount[_0xdfa7('0x3a')](_0x430317,{'from':_0x4ae484[_0xdfa7('0x34')],'mapKey':_0xdfa7('0x3b'),'body':path[_0xdfa7('0x38')](_0x4ae484[_0xdfa7('0x2e')])[_0xdfa7('0x24')]+_0xdfa7('0x3c'),'AttachmentId':_0x42447f['id']})[_0xdfa7('0x3d')](function(_0xba0d12){logger[_0xdfa7('0x3e')](_0x4ae484[_0xdfa7('0x22')],'\x20notify\x20',JSON['stringify'](_0xba0d12));});})[_0xdfa7('0x3d')](function(_0x3f4410){logger[_0xdfa7('0x3e')](_0x4ae484['uniqueid'],_0xdfa7('0x3f'),JSON[_0xdfa7('0x40')](_0x3f4410));});});}logger[_0xdfa7('0x25')](_0x4ae484[_0xdfa7('0x22')],_0xdfa7('0x3f'));}};Fax[_0xdfa7('0x1c')][_0xdfa7('0x41')]=function(_0x2dd7d9){if(this[_0xdfa7('0x42')][_0x2dd7d9[_0xdfa7('0x22')]]){_[_0xdfa7('0x43')](this[_0xdfa7('0xd')][_0x2dd7d9[_0xdfa7('0x22')]],_[_0xdfa7('0x44')](_0x2dd7d9,[_0xdfa7('0x45'),'reason']));}};function updateStatus(_0x5cccdc){if(_0x5cccdc[_0xdfa7('0x46')]){faxMessage[_0xdfa7('0x47')](_0x5cccdc[_0xdfa7('0x46')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xdfa7('0x39')](function(_0x4a4f11){ut[_0xdfa7('0x48')](_0xdfa7('0x49'),_0x4a4f11);})['catch'](function(_0x7e04c7){ut[_0xdfa7('0x48')](_0xdfa7('0x4a'),_0x7e04c7);});}else{ut[_0xdfa7('0x48')](_0xdfa7('0x4b'));}}Fax[_0xdfa7('0x1c')]['updateStatus']=function(_0x3b0666,_0x40b250,_0x2c7f9f){var _0x5b56ad=this;var _0xd288d4={};if(_0x40b250){_0xd288d4={'read':_0x40b250};}else{_0xd288d4={'failMessage':_0x2c7f9f};}if(this['actions'][_0x3b0666][_0xdfa7('0x46')]){faxMessage['update'](this[_0xdfa7('0x42')][_0x3b0666][_0xdfa7('0x46')],_0xd288d4)['then'](function(_0x50e620){ut[_0xdfa7('0x48')]('[Fax][Message][Updated]',_0x50e620);})[_0xdfa7('0x3d')](function(_0x231def){ut[_0xdfa7('0x48')](_0xdfa7('0x4c'),_0x231def);})['finally'](function(){delete _0x5b56ad[_0xdfa7('0xd')][_0x3b0666];delete _0x5b56ad['actions'][_0x3b0666];});}else{ut[_0xdfa7('0x48')](_0xdfa7('0x4d'));delete this[_0xdfa7('0xd')][_0x3b0666];delete this[_0xdfa7('0x42')][_0x3b0666];}};Fax[_0xdfa7('0x1c')][_0xdfa7('0x4e')]=function(_0x117709){var _0x154f30=this;if(this[_0xdfa7('0xd')][_0x117709['uniqueid']]){if(this['actions'][_0x117709[_0xdfa7('0x22')]]){this['channels'][_0x117709[_0xdfa7('0x22')]]['id']=this['actions'][_0x117709['uniqueid']]['id'];this['channels'][_0x117709['uniqueid']]['name']=this[_0xdfa7('0x42')][_0x117709['uniqueid']][_0xdfa7('0x24')];}logger['info'](_0x117709['uniqueid'],this['actions'][_0x117709['uniqueid']]?_0xdfa7('0x4f'):_0xdfa7('0x50'),JSON[_0xdfa7('0x40')](this['channels'][_0x117709[_0xdfa7('0x22')]]));if(this[_0xdfa7('0x42')][_0x117709[_0xdfa7('0x22')]]){if(this[_0xdfa7('0xd')][_0x117709['uniqueid']][_0xdfa7('0x51')]>0x0&&this[_0xdfa7('0xd')][_0x117709[_0xdfa7('0x22')]][_0xdfa7('0x17')]===_0xdfa7('0x52')){this['updateStatus'](_0x117709['uniqueid'],!![]);}else{this['updateStatus'](_0x117709[_0xdfa7('0x22')],![],this[_0xdfa7('0xd')][_0x117709[_0xdfa7('0x22')]]['faxstatusstring']?_0xdfa7('0x53')+this[_0xdfa7('0xd')][_0x117709[_0xdfa7('0x22')]][_0xdfa7('0x54')]:_0xdfa7('0x55'));}}}};Fax[_0xdfa7('0x1c')][_0xdfa7('0x56')]=function(_0x5dcf51){var _0x46b365=this;return new BPromise(function(_0x1c2f99,_0x102c33){_0x46b365[_0xdfa7('0x57')](_0x5dcf51,_0x46b365[_0xdfa7('0xe')][_0x5dcf51['FaxAccountId']])[_0xdfa7('0x39')](function(_0x36f685){ut[_0xdfa7('0x48')]('[Fax][execOriginate][success]',_0x36f685);_0x1c2f99(ut[_0xdfa7('0x36')](_0xdfa7('0x58')));})[_0xdfa7('0x3d')](function(_0x16b8fb){ut[_0xdfa7('0x48')](_0xdfa7('0x59'),_0x16b8fb);updateStatus(_0x5dcf51);_0x102c33(ut[_0xdfa7('0x36')](_0xdfa7('0x5a')));});});};Fax[_0xdfa7('0x1c')][_0xdfa7('0x5b')]=function(_0x2ba77e){var _0x566f25=this;return new BPromise(function(_0x14d08c,_0x9f5ad9){var _0x5378a9=_0x566f25[_0xdfa7('0x5c')](_0x566f25[_0xdfa7('0xe')][_0x2ba77e[_0xdfa7('0x5d')]][_0xdfa7('0x5e')],_0x2ba77e);if(_0x5378a9['isValid']){_0x14d08c(ut['message'](_0xdfa7('0x5f')));}else{_0x9f5ad9(ut[_0xdfa7('0x36')](_0x5378a9[_0xdfa7('0x36')]));}});};function originate(_0x40d7d1,_0x4f6f01,_0x584ec6){return new BPromise(function(_0x24c50d,_0x4c2e37){if(_0x584ec6){var _0x1f6956=util[_0xdfa7('0x60')](_0xdfa7('0x61'),path[_0xdfa7('0x38')](_0x40d7d1[_0xdfa7('0x4')])[_0xdfa7('0x24')],_0x40d7d1[_0xdfa7('0x4')]);gs[_0xdfa7('0x62')](_0x1f6956)[_0xdfa7('0x39')](function(){_0x40d7d1[_0xdfa7('0x4')]=util[_0xdfa7('0x60')](_0xdfa7('0x63'),path[_0xdfa7('0x38')](_0x40d7d1[_0xdfa7('0x4')])[_0xdfa7('0x64')],path[_0xdfa7('0x38')](_0x40d7d1['path'])[_0xdfa7('0x24')]);_0x4f6f01[_0xdfa7('0x65')]=_0x40d7d1['path'];ut[_0xdfa7('0x48')](_0xdfa7('0x66'),'');ami[_0xdfa7('0x67')](ut[_0xdfa7('0x68')](_0x40d7d1,_0x4f6f01))[_0xdfa7('0x39')](function(_0x1ebc88){_0x24c50d(_0x1ebc88);})['catch'](function(_0x5a6b84){_0x4c2e37(_0x5a6b84);});})[_0xdfa7('0x3d')](function(_0x17e7bf){_0x4c2e37(_0x17e7bf);});}else{ami['Action'](ut[_0xdfa7('0x68')](_0x40d7d1,_0x4f6f01))[_0xdfa7('0x39')](function(_0x242cc6){_0x24c50d(_0x242cc6);})['catch'](function(_0xaecbfb){_0x4c2e37(_0xaecbfb);});}});}Fax[_0xdfa7('0x1c')][_0xdfa7('0x57')]=function(_0x53f165,_0x36046b){var _0x524ae4=this;return new BPromise(function(_0x1014c7,_0x5d663f){var _0x51decc=uuid['v4']();var _0x5adb12=ut[_0xdfa7('0x69')](_0x53f165,_0x36046b);_0x524ae4[_0xdfa7('0x42')][_0x51decc]=new Action(_0x51decc,_0x36046b,_0x53f165);var _0x481b49=_0x524ae4[_0xdfa7('0x42')][_0x51decc];if(path['parse'](_0x53f165[_0xdfa7('0x4')])[_0xdfa7('0x6a')]==='.pdf'){originate(_0x481b49,_0x5adb12,!![])[_0xdfa7('0x39')](function(_0x51065f){_0x1014c7(_0x51065f);})[_0xdfa7('0x3d')](function(_0x39c958){_0x5d663f(_0x39c958);});}else{originate(_0x481b49,_0x5adb12,![])[_0xdfa7('0x39')](function(_0xa90492){_0x1014c7(_0xa90492);})[_0xdfa7('0x3d')](function(_0x501426){_0x5d663f(_0x501426);});}});};Fax[_0xdfa7('0x1c')][_0xdfa7('0x6b')]=function(_0x2c1b8b){return!_[_0xdfa7('0x6c')](_0x2c1b8b)&&!_[_0xdfa7('0x6c')](_0x2c1b8b[_0xdfa7('0x24')])&&!_[_0xdfa7('0x6c')](_0x2c1b8b[_0xdfa7('0x6d')])&&_0x2c1b8b[_0xdfa7('0x6d')]&&!_[_0xdfa7('0x6c')](this[_0xdfa7('0xf')][util[_0xdfa7('0x60')](_0xdfa7('0x6e'),_0x2c1b8b[_0xdfa7('0x24')])])&&!_[_0xdfa7('0x6c')](this[_0xdfa7('0xf')][util[_0xdfa7('0x60')](_0xdfa7('0x6e'),_0x2c1b8b[_0xdfa7('0x24')])][_0xdfa7('0x2d')])&&(this[_0xdfa7('0xf')][util['format']('SIP/%s',_0x2c1b8b[_0xdfa7('0x24')])][_0xdfa7('0x2d')]===_0xdfa7('0x6f')||this[_0xdfa7('0xf')][util[_0xdfa7('0x60')](_0xdfa7('0x6e'),_0x2c1b8b['name'])][_0xdfa7('0x2d')]===_0xdfa7('0x70'));};Fax[_0xdfa7('0x1c')]['checkTrunk']=function(_0x3304fd,_0x279693){if(!this[_0xdfa7('0x6b')](_0x3304fd)){ut[_0xdfa7('0x48')](_0xdfa7('0x71'),_[_0xdfa7('0x6c')](_0x3304fd)?'':_0x3304fd[_0xdfa7('0x24')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xdfa7('0x72')};}if(_[_0xdfa7('0x6c')](_0x279693['fax'])){ut['logger'](_0xdfa7('0x73'),JSON['stringify'](_0x279693));return{'isValid':![],'message':_0xdfa7('0x74')};}if(_[_0xdfa7('0x6c')](_0x279693[_0xdfa7('0x4')])){ut[_0xdfa7('0x48')](_0xdfa7('0x75'),JSON[_0xdfa7('0x40')](_0x279693));return{'isValid':![],'message':_0xdfa7('0x76')};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index ac32902..b1d8d1f 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 _0xc912=['util','../../../config/logger','lodash','../rpc/faxAccount','error','inspect','notify','resolve','catch','[Notify]\x20'];(function(_0x5bbe2f,_0x37f35e){var _0x1e59e5=function(_0x524e29){while(--_0x524e29){_0x5bbe2f['push'](_0x5bbe2f['shift']());}};_0x1e59e5(++_0x37f35e);}(_0xc912,0x172));var _0x2c91=function(_0x1257c8,_0x2f22de){_0x1257c8=_0x1257c8-0x0;var _0x2bb98d=_0xc912[_0x1257c8];return _0x2bb98d;};'use strict';var util=require(_0x2c91('0x0'));var BPromise=require('bluebird');var logger=require(_0x2c91('0x1'))('preview');var _=require(_0x2c91('0x2'));var faxAccount=require(_0x2c91('0x3'));function loggerCatch(_0x147943){return function(_0x4b7813){logger[_0x2c91('0x4')](_0x147943,util[_0x2c91('0x5')](_0x4b7813,{'showHidden':![],'depth':null}));};}exports[_0x2c91('0x6')]=function(_0xee1a74,_0x78f820){return BPromise[_0x2c91('0x7')]()['then'](faxAccount[_0x2c91('0x6')](_0xee1a74,_0x78f820))[_0x2c91('0x8')](loggerCatch(_0x2c91('0x9')));}; \ No newline at end of file +var _0x3932=['[Notify]\x20','util','../../../config/logger','preview','lodash','../rpc/faxAccount','error','notify','resolve','then','catch'];(function(_0x1f19da,_0x2cd3d3){var _0x18ff49=function(_0x40a555){while(--_0x40a555){_0x1f19da['push'](_0x1f19da['shift']());}};_0x18ff49(++_0x2cd3d3);}(_0x3932,0x6f));var _0x2393=function(_0x1a04a6,_0x1b9764){_0x1a04a6=_0x1a04a6-0x0;var _0xb3f005=_0x3932[_0x1a04a6];return _0xb3f005;};'use strict';var util=require(_0x2393('0x0'));var BPromise=require('bluebird');var logger=require(_0x2393('0x1'))(_0x2393('0x2'));var _=require(_0x2393('0x3'));var faxAccount=require(_0x2393('0x4'));function loggerCatch(_0xa8e3f4){return function(_0x9c4139){logger[_0x2393('0x5')](_0xa8e3f4,util['inspect'](_0x9c4139,{'showHidden':![],'depth':null}));};}exports[_0x2393('0x6')]=function(_0x2445e7,_0x75716c){return BPromise[_0x2393('0x7')]()[_0x2393('0x8')](faxAccount[_0x2393('0x6')](_0x2445e7,_0x75716c))[_0x2393('0x9')](loggerCatch(_0x2393('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 5b4c15b..450be31 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 _0x086e=['util','../../../../config/logger','fax','bluebird','child_process','exec','Exec\x20gs','info','inspect'];(function(_0x1ae491,_0x5b83b9){var _0x4958a5=function(_0xf0f364){while(--_0xf0f364){_0x1ae491['push'](_0x1ae491['shift']());}};_0x4958a5(++_0x5b83b9);}(_0x086e,0x1b0));var _0xe086=function(_0x2f3be2,_0x224419){_0x2f3be2=_0x2f3be2-0x0;var _0x4cf7b0=_0x086e[_0x2f3be2];return _0x4cf7b0;};'use strict';var util=require(_0xe086('0x0'));var logger=require(_0xe086('0x1'))(_0xe086('0x2'));var BPromise=require(_0xe086('0x3'));var exec=require(_0xe086('0x4'))[_0xe086('0x5')];exports['execute']=function(_0x211f1d){return new BPromise(function(_0x44562a,_0x2a20f5){exec(_0x211f1d,function(_0x25bf31,_0x39e932,_0x3444b8){logger['info'](_0xe086('0x6'),_0x39e932);if(_0x25bf31){logger[_0xe086('0x7')](_0xe086('0x6'),'\x20Error\x20:',util[_0xe086('0x8')](_0x25bf31,{'showHidden':![],'depth':null}),_0x39e932,_0x3444b8);_0x2a20f5(_0x25bf31);}_0x44562a(_0x39e932);});});}; \ No newline at end of file +var _0x044e=['\x20Error\x20:','inspect','util','../../../../config/logger','fax','child_process','exec','execute','info','Exec\x20gs'];(function(_0x59b48b,_0x584733){var _0x4c3f79=function(_0x3f2e94){while(--_0x3f2e94){_0x59b48b['push'](_0x59b48b['shift']());}};_0x4c3f79(++_0x584733);}(_0x044e,0x1b0));var _0xe044=function(_0x4998f7,_0x43137b){_0x4998f7=_0x4998f7-0x0;var _0x15cab9=_0x044e[_0x4998f7];return _0x15cab9;};'use strict';var util=require(_0xe044('0x0'));var logger=require(_0xe044('0x1'))(_0xe044('0x2'));var BPromise=require('bluebird');var exec=require(_0xe044('0x3'))[_0xe044('0x4')];exports[_0xe044('0x5')]=function(_0x30fe5f){return new BPromise(function(_0x4c4885,_0x457f3a){exec(_0x30fe5f,function(_0x23f176,_0x490d30,_0x46b46c){logger[_0xe044('0x6')](_0xe044('0x7'),_0x490d30);if(_0x23f176){logger[_0xe044('0x6')]('Exec\x20gs',_0xe044('0x8'),util[_0xe044('0x9')](_0x23f176,{'showHidden':![],'depth':null}),_0x490d30,_0x46b46c);_0x457f3a(_0x23f176);}_0x4c4885(_0x490d30);});});}; \ 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 1e0f86d..2bf0044 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 _0x8ce3=['logger','info','addVariables','ecm','headerinfo','maxrate','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>','util','lodash','../../../../config/logger','fax','message'];(function(_0x5322a9,_0x1dda8d){var _0x2d1359=function(_0x52b581){while(--_0x52b581){_0x5322a9['push'](_0x5322a9['shift']());}};_0x2d1359(++_0x1dda8d);}(_0x8ce3,0xc3));var _0x38ce=function(_0x49a982,_0x129a07){_0x49a982=_0x49a982-0x0;var _0x2a0bc9=_0x8ce3[_0x49a982];return _0x2a0bc9;};'use strict';var util=require(_0x38ce('0x0'));var _=require(_0x38ce('0x1'));var moment=require('moment');var logger=require(_0x38ce('0x2'))(_0x38ce('0x3'));exports[_0x38ce('0x4')]=function(_0x26ec48){return{'message':_0x26ec48};};exports[_0x38ce('0x5')]=function(_0x17b96d,_0x1efae3){logger[_0x38ce('0x6')](_0x17b96d,util['inspect'](_0x1efae3,{'showHidden':![],'depth':null}));};exports[_0x38ce('0x7')]=function(_0xb24f4c,_0x58074c){var _0x262b13={'XMF-ECM':_0x58074c[_0x38ce('0x8')],'XMF-HEADERINFO':_0x58074c[_0x38ce('0x9')],'XMF-MINRATE':_0x58074c['minrate'],'XMF-MAXRATE':_0x58074c[_0x38ce('0xa')],'XMF-MODEM':util['format'](_0x38ce('0xb'),_0x58074c['modem']),'XMF-GATEWAY':_0x58074c[_0x38ce('0xc')],'XMF-FAXDETECT':_0x58074c[_0x38ce('0xd')],'XMF-T38TIMEOUT':_0x58074c[_0x38ce('0xe')],'XMF-LOCALSTATIONID':_0x58074c[_0x38ce('0xf')],'XMF-PATH':_0xb24f4c[_0x38ce('0x10')]};return _0x262b13;};exports[_0x38ce('0x11')]=function(_0x2a9045,_0x171a02){return{'actionid':_0x2a9045[_0x38ce('0x12')],'action':_0x38ce('0x13'),'channel':_0x2a9045[_0x38ce('0x14')],'Exten':_0x38ce('0x15'),'Context':_0x38ce('0x16'),'Priority':'1','callerid':util[_0x38ce('0x17')](_0x38ce('0x18'),_0x2a9045[_0x38ce('0x9')]?_0x2a9045['headerinfo']:'',_0x2a9045['localstationid']),'variable':_0x171a02,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2a9045[_0x38ce('0x12')]};}; \ No newline at end of file +var _0x524a=['gateway','t38timeout','localstationid','uniqueid','xcally-motion-fax','util','lodash','moment','../../../../config/logger','message','logger','info','inspect','addVariables','ecm','headerinfo','maxrate','format','\x22%s\x22','modem'];(function(_0x52de9b,_0x19df61){var _0x1ad0c7=function(_0x26a38c){while(--_0x26a38c){_0x52de9b['push'](_0x52de9b['shift']());}};_0x1ad0c7(++_0x19df61);}(_0x524a,0xf5));var _0xa524=function(_0x5410bf,_0x5f5356){_0x5410bf=_0x5410bf-0x0;var _0x287ded=_0x524a[_0x5410bf];return _0x287ded;};'use strict';var util=require(_0xa524('0x0'));var _=require(_0xa524('0x1'));var moment=require(_0xa524('0x2'));var logger=require(_0xa524('0x3'))('fax');exports[_0xa524('0x4')]=function(_0x2ef77c){return{'message':_0x2ef77c};};exports[_0xa524('0x5')]=function(_0x56ab08,_0x50ec75){logger[_0xa524('0x6')](_0x56ab08,util[_0xa524('0x7')](_0x50ec75,{'showHidden':![],'depth':null}));};exports[_0xa524('0x8')]=function(_0x5f472f,_0x460738){var _0x56bd0e={'XMF-ECM':_0x460738[_0xa524('0x9')],'XMF-HEADERINFO':_0x460738[_0xa524('0xa')],'XMF-MINRATE':_0x460738['minrate'],'XMF-MAXRATE':_0x460738[_0xa524('0xb')],'XMF-MODEM':util[_0xa524('0xc')](_0xa524('0xd'),_0x460738[_0xa524('0xe')]),'XMF-GATEWAY':_0x460738[_0xa524('0xf')],'XMF-FAXDETECT':_0x460738['faxdetect'],'XMF-T38TIMEOUT':_0x460738[_0xa524('0x10')],'XMF-LOCALSTATIONID':_0x460738[_0xa524('0x11')],'XMF-PATH':_0x5f472f['path']};return _0x56bd0e;};exports['variablesAction']=function(_0x2fc0f9,_0xdbba15){return{'actionid':_0x2fc0f9[_0xa524('0x12')],'action':'originate','channel':_0x2fc0f9['channel'],'Exten':_0xa524('0x13'),'Context':'from-sip','Priority':'1','callerid':util[_0xa524('0xc')]('\x22%s\x22\x20<%s>',_0x2fc0f9[_0xa524('0xa')]?_0x2fc0f9['headerinfo']:'',_0x2fc0f9[_0xa524('0x11')]),'variable':_0xdbba15,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2fc0f9[_0xa524('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index ed4af5c..bb11c06 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 _0x281d=['./trigger','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','hour','get','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','util','./report'];(function(_0x23b599,_0x259a07){var _0x143c82=function(_0x4fcec0){while(--_0x4fcec0){_0x23b599['push'](_0x23b599['shift']());}};_0x143c82(++_0x259a07);}(_0x281d,0x87));var _0xd281=function(_0x50b9f4,_0x33047c){_0x50b9f4=_0x50b9f4-0x0;var _0x588b57=_0x281d[_0x50b9f4];return _0x588b57;};'use strict';var BPromise=require(_0xd281('0x0'));var util=require(_0xd281('0x1'));var moment=require('moment');var server=require('./server');var Realtime=require('./realtime');var Report=require(_0xd281('0x2'));var Acw=require('./acw');var Trigger=require(_0xd281('0x3'));var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require(_0xd281('0x4'));var user=require(_0xd281('0x5'));var voiceQueue=require(_0xd281('0x6'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xd281('0x7'));var trunk=require('./rpc/trunk');var trigger=require(_0xd281('0x8'));var template=require(_0xd281('0x9'));var cmHopperHistory=require(_0xd281('0xa'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xd281('0xb'));var faxAccount=require(_0xd281('0xc'));var zendesk=require(_0xd281('0xd'));var salesforce=require(_0xd281('0xe'));var sugarcrm=require(_0xd281('0xf'));var freshdesk=require(_0xd281('0x10'));var desk=require('./rpc/integrations/desk');var zoho=require(_0xd281('0x11'));var vtiger=require(_0xd281('0x12'));var freshsales=require(_0xd281('0x13'));var servicenow=require(_0xd281('0x14'));var dynamics365=require(_0xd281('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()['get'](_0xd281('0x16'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xd281('0x17')](_0xd281('0x16'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xd281('0x18')]()[_0xd281('0x19')](user[_0xd281('0x1a')]())[_0xd281('0x19')](realtime[_0xd281('0x1b')]())[_0xd281('0x19')](user[_0xd281('0x1c')]())[_0xd281('0x19')](realtime[_0xd281('0x1d')]())[_0xd281('0x19')](trunk[_0xd281('0x1e')]())[_0xd281('0x19')](realtime[_0xd281('0x1f')]())['then'](voiceQueue[_0xd281('0x20')]())[_0xd281('0x19')](realtime[_0xd281('0x21')]())['then'](trigger[_0xd281('0x22')]())[_0xd281('0x19')](realtime[_0xd281('0x23')]())[_0xd281('0x19')](template[_0xd281('0x24')]())[_0xd281('0x19')](realtime[_0xd281('0x25')]())[_0xd281('0x19')](zendesk['getZendeskAccounts']())[_0xd281('0x19')](realtime[_0xd281('0x26')]())['then'](salesforce[_0xd281('0x27')]())[_0xd281('0x19')](realtime[_0xd281('0x28')]())[_0xd281('0x19')](sugarcrm[_0xd281('0x29')]())[_0xd281('0x19')](realtime[_0xd281('0x2a')]())[_0xd281('0x19')](freshdesk[_0xd281('0x2b')]())[_0xd281('0x19')](realtime[_0xd281('0x2c')]())[_0xd281('0x19')](desk[_0xd281('0x2d')]())[_0xd281('0x19')](realtime[_0xd281('0x2e')]())[_0xd281('0x19')](zoho['getZohoAccounts']())['then'](realtime['initZohoAccounts']())[_0xd281('0x19')](vtiger['getVtigerAccounts']())[_0xd281('0x19')](realtime[_0xd281('0x2f')]())[_0xd281('0x19')](freshsales[_0xd281('0x30')]())[_0xd281('0x19')](realtime[_0xd281('0x31')]())[_0xd281('0x19')](servicenow[_0xd281('0x32')]())[_0xd281('0x19')](realtime[_0xd281('0x33')]())[_0xd281('0x19')](dynamics365[_0xd281('0x34')]())[_0xd281('0x19')](realtime['initDynamics365Accounts']())[_0xd281('0x19')](campaign[_0xd281('0x35')]())['then'](realtime[_0xd281('0x36')]())[_0xd281('0x19')](voiceExtension[_0xd281('0x37')]())[_0xd281('0x19')](realtime[_0xd281('0x38')]())[_0xd281('0x19')](faxAccount[_0xd281('0x39')]())['then'](realtime[_0xd281('0x3a')]())['then'](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0xd281('0x19')](voiceQueueReport[_0xd281('0x3b')]())[_0xd281('0x19')](realtime[_0xd281('0x3c')]())['then'](cmHopperHistory[_0xd281('0x3d')]())[_0xd281('0x19')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0xd281('0x3e')]())[_0xd281('0x19')](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0xd281('0x3f')]())[_0xd281('0x19')](realtime[_0xd281('0x40')]())[_0xd281('0x19')](function(_0x456b09){})[_0xd281('0x41')](function(_0x4a5de9){console[_0xd281('0x42')](_0x4a5de9);});}function main(){return server[_0xd281('0x43')](realtime,preview,fax)[_0xd281('0x19')](function(_0x4b2c13){return initRealtime();})[_0xd281('0x19')](function(){return initParams();})[_0xd281('0x19')](function(){report[_0xd281('0x44')]();setInterval(initRealtime,0x1388);})[_0xd281('0x41')](function(_0x33aaeb){console[_0xd281('0x42')](_0x33aaeb);});}main(); \ No newline at end of file +var _0x020e=['./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','bluebird','moment','./server'];(function(_0x1b95a6,_0x45d97a){var _0x496ac8=function(_0x1b35a1){while(--_0x1b35a1){_0x1b95a6['push'](_0x1b95a6['shift']());}};_0x496ac8(++_0x45d97a);}(_0x020e,0xc0));var _0xe020=function(_0x20fcfa,_0x40d572){_0x20fcfa=_0x20fcfa-0x0;var _0x2c48c8=_0x020e[_0x20fcfa];return _0x2c48c8;};'use strict';var BPromise=require(_0xe020('0x0'));var util=require('util');var moment=require(_0xe020('0x1'));var server=require(_0xe020('0x2'));var Realtime=require('./realtime');var Report=require(_0xe020('0x3'));var Acw=require(_0xe020('0x4'));var Trigger=require(_0xe020('0x5'));var Dialer=require(_0xe020('0x6'));var Preview=require(_0xe020('0x7'));var Fax=require(_0xe020('0x8'));var user=require('./rpc/user');var voiceQueue=require(_0xe020('0x9'));var voiceQueueReport=require(_0xe020('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xe020('0xb'));var trigger=require(_0xe020('0xc'));var template=require(_0xe020('0xd'));var cmHopperHistory=require(_0xe020('0xe'));var campaign=require(_0xe020('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xe020('0x10'));var salesforce=require(_0xe020('0x11'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xe020('0x12'));var zoho=require(_0xe020('0x13'));var vtiger=require(_0xe020('0x14'));var freshsales=require(_0xe020('0x15'));var servicenow=require(_0xe020('0x16'));var dynamics365=require(_0xe020('0x17'));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()[_0xe020('0x18')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xe020('0x18')](_0xe020('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xe020('0x1a')](user['getAgents']())[_0xe020('0x1a')](realtime[_0xe020('0x1b')]())[_0xe020('0x1a')](user[_0xe020('0x1c')]())[_0xe020('0x1a')](realtime[_0xe020('0x1d')]())[_0xe020('0x1a')](trunk[_0xe020('0x1e')]())[_0xe020('0x1a')](realtime[_0xe020('0x1f')]())[_0xe020('0x1a')](voiceQueue[_0xe020('0x20')]())['then'](realtime[_0xe020('0x21')]())['then'](trigger[_0xe020('0x22')]())['then'](realtime['initTriggers']())[_0xe020('0x1a')](template['getTemplates']())[_0xe020('0x1a')](realtime['initTemplates']())[_0xe020('0x1a')](zendesk[_0xe020('0x23')]())[_0xe020('0x1a')](realtime[_0xe020('0x24')]())[_0xe020('0x1a')](salesforce[_0xe020('0x25')]())[_0xe020('0x1a')](realtime[_0xe020('0x26')]())[_0xe020('0x1a')](sugarcrm[_0xe020('0x27')]())[_0xe020('0x1a')](realtime[_0xe020('0x28')]())['then'](freshdesk[_0xe020('0x29')]())[_0xe020('0x1a')](realtime[_0xe020('0x2a')]())['then'](desk[_0xe020('0x2b')]())['then'](realtime[_0xe020('0x2c')]())[_0xe020('0x1a')](zoho[_0xe020('0x2d')]())[_0xe020('0x1a')](realtime['initZohoAccounts']())[_0xe020('0x1a')](vtiger['getVtigerAccounts']())[_0xe020('0x1a')](realtime[_0xe020('0x2e')]())[_0xe020('0x1a')](freshsales[_0xe020('0x2f')]())[_0xe020('0x1a')](realtime[_0xe020('0x30')]())['then'](servicenow[_0xe020('0x31')]())[_0xe020('0x1a')](realtime[_0xe020('0x32')]())['then'](dynamics365[_0xe020('0x33')]())[_0xe020('0x1a')](realtime[_0xe020('0x34')]())[_0xe020('0x1a')](campaign[_0xe020('0x35')]())[_0xe020('0x1a')](realtime['initCampaigns']())[_0xe020('0x1a')](voiceExtension[_0xe020('0x36')]())[_0xe020('0x1a')](realtime['initVoiceExtensions']())['then'](faxAccount[_0xe020('0x37')]())[_0xe020('0x1a')](realtime[_0xe020('0x38')]())[_0xe020('0x1a')](function(){return realtime;});}function initParams(){return BPromise[_0xe020('0x39')]()[_0xe020('0x1a')](voiceQueueReport[_0xe020('0x3a')]())[_0xe020('0x1a')](realtime['initVoiceQueueReports']())[_0xe020('0x1a')](cmHopperHistory[_0xe020('0x3b')]())[_0xe020('0x1a')](realtime[_0xe020('0x3c')]())[_0xe020('0x1a')](cmHopperHistory[_0xe020('0x3d')]())[_0xe020('0x1a')](realtime[_0xe020('0x3e')]())[_0xe020('0x1a')](voiceCallReport[_0xe020('0x3f')]())[_0xe020('0x1a')](realtime['initVoiceCallReports']())[_0xe020('0x1a')](function(_0x1cf65c){})['catch'](function(_0x698a3f){console['log'](_0x698a3f);});}function main(){return server['listen'](realtime,preview,fax)[_0xe020('0x1a')](function(_0x45b47b){return initRealtime();})['then'](function(){return initParams();})[_0xe020('0x1a')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xe020('0x40')](function(_0x56065b){console['log'](_0x56065b);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index db189d1..0c45efd 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 _0x8514=['accountcode','fullname','unknown','address','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','inuse','toNumber','format','stateTime','status','stringify','user:%s','emit','lodash','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x8514,0x1e0));var _0x4851=function(_0x468e2b,_0x49c833){_0x468e2b=_0x468e2b-0x0;var _0x4e5e76=_0x8514[_0x468e2b];return _0x4e5e76;};'use strict';var _=require(_0x4851('0x0'));var util=require('util');var moment=require('moment');var md5=require(_0x4851('0x1'));var Redis=require(_0x4851('0x2'));var config=require(_0x4851('0x3'));config['redis']=_[_0x4851('0x4')](config[_0x4851('0x5')],{'host':_0x4851('0x6'),'port':0x18eb});var io=require(_0x4851('0x7'))(new Redis(config[_0x4851('0x5')]));function Agent(_0x3dd096){this['id']=_0x3dd096['id']||0x0;this[_0x4851('0x8')]=_0x3dd096[_0x4851('0x8')]||'';this[_0x4851('0x9')]=_0x3dd096['email']||'';this[_0x4851('0xa')]=_0x3dd096['accountcode']||'';this['fullname']=_0x3dd096[_0x4851('0xb')]||'';this['state']=_0x4851('0xc');this['stateTime']=0x0;this['status']=_0x4851('0xc');this[_0x4851('0xd')]='';this['phone']='';this['mobile']='';this[_0x4851('0xe')]='';this[_0x4851('0xf')]=_0x3dd096['online']||![];this[_0x4851('0x10')]=_0x4851('0xc');this[_0x4851('0x11')]=0x0;this[_0x4851('0x12')]='';this[_0x4851('0x13')]='';this[_0x4851('0x14')]=![];this[_0x4851('0x15')]=![];this[_0x4851('0x1')]='';}Agent[_0x4851('0x16')][_0x4851('0x17')]=function(_0x2f3d6e){var _0x510a92;if(_0x2f3d6e&&_0x2f3d6e['state']){_0x510a92=_0x2f3d6e[_0x4851('0x18')][_0x4851('0x19')]();switch(_0x510a92){case _0x4851('0x1a'):_0x510a92='idle';break;case _0x4851('0x1b'):_0x510a92='talking';break;}}if(_0x510a92&&this[_0x4851('0x10')]!==_0x510a92||_0x2f3d6e['statePause']){this[_0x4851('0x11')]=_[_0x4851('0x1c')](moment()[_0x4851('0x1d')]('x'));}if(_0x510a92){this[_0x4851('0x10')]=_0x510a92;}var _0x2b2f9f={'id':this['id'],'name':this[_0x4851('0x8')],'email':this[_0x4851('0x9')],'accountcode':this[_0x4851('0xa')],'fullname':this['fullname'],'state':this[_0x4851('0x18')],'stateTime':this[_0x4851('0x1e')],'status':this[_0x4851('0x1f')],'address':this[_0x4851('0xd')],'online':this['online'],'voiceStatus':this[_0x4851('0x10')],'voiceStatusTime':this[_0x4851('0x11')],'voiceStatusCallerIdNumber':this[_0x4851('0x12')],'voiceStatusQueue':this[_0x4851('0x13')],'interface':this[_0x4851('0xe')],'onhold':this[_0x4851('0x14')]};var _0x1107d5=md5(JSON[_0x4851('0x20')](_0x2b2f9f));if(this[_0x4851('0x1')]!==_0x1107d5){this[_0x4851('0x1')]=_0x1107d5;io['to'](util[_0x4851('0x1d')](_0x4851('0x21'),_0x2b2f9f[_0x4851('0x8')]))[_0x4851('0x22')]('user:save',_0x2b2f9f);}};module['exports']=Agent; \ No newline at end of file +var _0x7b44=['unknown','address','phone','mobile','interface','online','voiceStatusTime','onhold','md5','updateStatusRealtime','toLowerCase','not_inuse','idle','talking','voiceStatus','format','stateTime','status','voiceStatusCallerIdNumber','voiceStatusQueue','stringify','user:%s','emit','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','email','accountcode','fullname','state'];(function(_0x11de10,_0x3f7597){var _0x492991=function(_0x262282){while(--_0x262282){_0x11de10['push'](_0x11de10['shift']());}};_0x492991(++_0x3f7597);}(_0x7b44,0x1c8));var _0x47b4=function(_0x3c0c76,_0x10018a){_0x3c0c76=_0x3c0c76-0x0;var _0x137ea7=_0x7b44[_0x3c0c76];return _0x137ea7;};'use strict';var _=require(_0x47b4('0x0'));var util=require(_0x47b4('0x1'));var moment=require('moment');var md5=require('md5');var Redis=require(_0x47b4('0x2'));var config=require(_0x47b4('0x3'));config[_0x47b4('0x4')]=_[_0x47b4('0x5')](config[_0x47b4('0x4')],{'host':_0x47b4('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x47b4('0x4')]));function Agent(_0x41c285){this['id']=_0x41c285['id']||0x0;this[_0x47b4('0x7')]=_0x41c285[_0x47b4('0x7')]||'';this['email']=_0x41c285[_0x47b4('0x8')]||'';this[_0x47b4('0x9')]=_0x41c285[_0x47b4('0x9')]||'';this[_0x47b4('0xa')]=_0x41c285[_0x47b4('0xa')]||'';this[_0x47b4('0xb')]='unknown';this['stateTime']=0x0;this['status']=_0x47b4('0xc');this[_0x47b4('0xd')]='';this[_0x47b4('0xe')]='';this[_0x47b4('0xf')]='';this[_0x47b4('0x10')]='';this[_0x47b4('0x11')]=_0x41c285[_0x47b4('0x11')]||![];this['voiceStatus']=_0x47b4('0xc');this[_0x47b4('0x12')]=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this[_0x47b4('0x13')]=![];this['local']=![];this[_0x47b4('0x14')]='';}Agent['prototype'][_0x47b4('0x15')]=function(_0x14a323){var _0x21729e;if(_0x14a323&&_0x14a323[_0x47b4('0xb')]){_0x21729e=_0x14a323[_0x47b4('0xb')][_0x47b4('0x16')]();switch(_0x21729e){case _0x47b4('0x17'):_0x21729e=_0x47b4('0x18');break;case'inuse':_0x21729e=_0x47b4('0x19');break;}}if(_0x21729e&&this[_0x47b4('0x1a')]!==_0x21729e||_0x14a323['statePause']){this[_0x47b4('0x12')]=_['toNumber'](moment()[_0x47b4('0x1b')]('x'));}if(_0x21729e){this['voiceStatus']=_0x21729e;}var _0x4283fe={'id':this['id'],'name':this[_0x47b4('0x7')],'email':this['email'],'accountcode':this['accountcode'],'fullname':this[_0x47b4('0xa')],'state':this['state'],'stateTime':this[_0x47b4('0x1c')],'status':this[_0x47b4('0x1d')],'address':this[_0x47b4('0xd')],'online':this[_0x47b4('0x11')],'voiceStatus':this[_0x47b4('0x1a')],'voiceStatusTime':this[_0x47b4('0x12')],'voiceStatusCallerIdNumber':this[_0x47b4('0x1e')],'voiceStatusQueue':this[_0x47b4('0x1f')],'interface':this[_0x47b4('0x10')],'onhold':this[_0x47b4('0x13')]};var _0x2f44fa=md5(JSON[_0x47b4('0x20')](_0x4283fe));if(this[_0x47b4('0x14')]!==_0x2f44fa){this[_0x47b4('0x14')]=_0x2f44fa;io['to'](util[_0x47b4('0x1b')](_0x47b4('0x21'),_0x4283fe[_0x47b4('0x7')]))[_0x47b4('0x22')]('user:save',_0x4283fe);}};module[_0x47b4('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 59a9ce1..120088d 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 _0xaa4c=['Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup'];(function(_0x37dbb1,_0x174761){var _0x2ab7c6=function(_0x5badf9){while(--_0x5badf9){_0x37dbb1['push'](_0x37dbb1['shift']());}};_0x2ab7c6(++_0x174761);}(_0xaa4c,0x112));var _0xcaa4=function(_0x7c0b02,_0x36886f){_0x7c0b02=_0x7c0b02-0x0;var _0x519618=_0xaa4c[_0x7c0b02];return _0x519618;};'use strict';function Campaign(_0xbc6fa8){this['id']=_0xbc6fa8['id']||0x0;this[_0xcaa4('0x0')]=_0xbc6fa8[_0xcaa4('0x0')]||'';this[_0xcaa4('0x1')]=_0xbc6fa8['type']||_0xcaa4('0x2');this[_0xcaa4('0x3')]=0x0;this[_0xcaa4('0x4')]=0x0;this[_0xcaa4('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0xcaa4('0x6')]='';this[_0xcaa4('0x7')]=!![];this[_0xcaa4('0x8')]=_0xbc6fa8['active'];this[_0xcaa4('0x9')]=_0xbc6fa8[_0xcaa4('0x9')];this[_0xcaa4('0xa')]=_0xbc6fa8[_0xcaa4('0xa')]||null;this[_0xcaa4('0xb')]=_0xbc6fa8[_0xcaa4('0xb')]?_0xbc6fa8[_0xcaa4('0xb')]:null;this[_0xcaa4('0xc')]=_0xbc6fa8['dialOriginateCallerIdName'];this[_0xcaa4('0xd')]=_0xbc6fa8[_0xcaa4('0xd')];this[_0xcaa4('0xe')]=_0xbc6fa8[_0xcaa4('0xe')]||0x1e;this[_0xcaa4('0xf')]=_0xbc6fa8[_0xcaa4('0xf')];this[_0xcaa4('0x10')]=_0xbc6fa8[_0xcaa4('0x10')];this[_0xcaa4('0x11')]=_0xbc6fa8[_0xcaa4('0x11')];this[_0xcaa4('0x12')]=_0xbc6fa8[_0xcaa4('0x12')];this[_0xcaa4('0x13')]=_0xbc6fa8[_0xcaa4('0x13')];this[_0xcaa4('0x14')]=_0xbc6fa8['dialNoAnswerRetryFrequency'];this[_0xcaa4('0x15')]=_0xbc6fa8[_0xcaa4('0x15')];this['dialNoSuchNumberMaxRetry']=_0xbc6fa8[_0xcaa4('0x16')]||0x3;this[_0xcaa4('0x17')]=_0xbc6fa8[_0xcaa4('0x17')]||0x96;this[_0xcaa4('0x18')]=_0xbc6fa8[_0xcaa4('0x18')]||0x3;this[_0xcaa4('0x19')]=_0xbc6fa8[_0xcaa4('0x19')]||0x96;this[_0xcaa4('0x1a')]=_0xbc6fa8[_0xcaa4('0x1a')]||0x3;this[_0xcaa4('0x1b')]=_0xbc6fa8[_0xcaa4('0x1b')]||0x96;this['dialMachineMaxRetry']=_0xbc6fa8[_0xcaa4('0x1c')]||0x3;this[_0xcaa4('0x1d')]=_0xbc6fa8[_0xcaa4('0x1d')]||0x96;this[_0xcaa4('0x1e')]=_0xbc6fa8['dialAgentRejectMaxRetry']||0x3;this[_0xcaa4('0x1f')]=_0xbc6fa8[_0xcaa4('0x1f')]||0x96;this[_0xcaa4('0x20')]=_0xbc6fa8[_0xcaa4('0x20')]||_0xcaa4('0x21');this[_0xcaa4('0x22')]=_0xbc6fa8[_0xcaa4('0x22')]||undefined;this[_0xcaa4('0x23')]=_0xbc6fa8[_0xcaa4('0x23')]||undefined;this['dialCutDigit']=_0xbc6fa8[_0xcaa4('0x24')]||undefined;this[_0xcaa4('0x25')]=_0xbc6fa8[_0xcaa4('0x25')]?_0xbc6fa8[_0xcaa4('0x25')]:undefined;this['Trunk']=_0xbc6fa8['Trunk']?_0xbc6fa8[_0xcaa4('0x26')]:undefined;this[_0xcaa4('0x27')]=_0xbc6fa8['Interval']?_0xbc6fa8[_0xcaa4('0x27')]:undefined;this[_0xcaa4('0x28')]=_0xbc6fa8[_0xcaa4('0x28')]?_0xbc6fa8[_0xcaa4('0x28')]:undefined;this[_0xcaa4('0x29')]=_0xbc6fa8['SquareProject']?_0xbc6fa8[_0xcaa4('0x28')][_0xcaa4('0x0')]:undefined;this[_0xcaa4('0x2a')]=_0xbc6fa8[_0xcaa4('0x2a')]||![];this[_0xcaa4('0x2b')]=_0xbc6fa8[_0xcaa4('0x2b')];this[_0xcaa4('0x2c')]=_0xbc6fa8[_0xcaa4('0x2c')];this[_0xcaa4('0x2d')]=_0xbc6fa8[_0xcaa4('0x2d')];this[_0xcaa4('0x2e')]=_0xbc6fa8[_0xcaa4('0x2e')];this[_0xcaa4('0x2f')]=_0xbc6fa8[_0xcaa4('0x2f')];this['dialAMDBetweenWordsSilence']=_0xbc6fa8[_0xcaa4('0x30')];this[_0xcaa4('0x31')]=_0xbc6fa8[_0xcaa4('0x31')];this[_0xcaa4('0x32')]=_0xbc6fa8[_0xcaa4('0x32')];this['dialAMDMaximumWordLength']=_0xbc6fa8[_0xcaa4('0x33')];}module['exports']=Campaign; \ No newline at end of file +var _0xad99=['name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0xad99,0x64));var _0x9ad9=function(_0x495f44,_0x20ec8b){_0x495f44=_0x495f44-0x0;var _0x3761a0=_0xad99[_0x495f44];return _0x3761a0;};'use strict';function Campaign(_0x4672de){this['id']=_0x4672de['id']||0x0;this[_0x9ad9('0x0')]=_0x4672de[_0x9ad9('0x0')]||'';this['type']=_0x4672de[_0x9ad9('0x1')]||_0x9ad9('0x2');this[_0x9ad9('0x3')]=0x0;this['temp']=0x0;this[_0x9ad9('0x4')]=0x0;this[_0x9ad9('0x5')]=0x0;this[_0x9ad9('0x6')]='';this[_0x9ad9('0x7')]=!![];this[_0x9ad9('0x8')]=_0x4672de[_0x9ad9('0x8')];this[_0x9ad9('0x9')]=_0x4672de[_0x9ad9('0x9')];this[_0x9ad9('0xa')]=_0x4672de[_0x9ad9('0xa')]||null;this[_0x9ad9('0xb')]=_0x4672de['dialGlobalInterval']?_0x4672de[_0x9ad9('0xb')]:null;this[_0x9ad9('0xc')]=_0x4672de[_0x9ad9('0xc')];this['dialOriginateCallerIdNumber']=_0x4672de[_0x9ad9('0xd')];this[_0x9ad9('0xe')]=_0x4672de[_0x9ad9('0xe')]||0x1e;this['dialCongestionMaxRetry']=_0x4672de[_0x9ad9('0xf')];this[_0x9ad9('0x10')]=_0x4672de[_0x9ad9('0x10')];this[_0x9ad9('0x11')]=_0x4672de['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x4672de[_0x9ad9('0x12')];this[_0x9ad9('0x13')]=_0x4672de[_0x9ad9('0x13')];this[_0x9ad9('0x14')]=_0x4672de[_0x9ad9('0x14')];this[_0x9ad9('0x15')]=_0x4672de[_0x9ad9('0x15')];this[_0x9ad9('0x16')]=_0x4672de[_0x9ad9('0x16')]||0x3;this[_0x9ad9('0x17')]=_0x4672de[_0x9ad9('0x17')]||0x96;this[_0x9ad9('0x18')]=_0x4672de[_0x9ad9('0x18')]||0x3;this[_0x9ad9('0x19')]=_0x4672de[_0x9ad9('0x19')]||0x96;this[_0x9ad9('0x1a')]=_0x4672de[_0x9ad9('0x1a')]||0x3;this[_0x9ad9('0x1b')]=_0x4672de[_0x9ad9('0x1b')]||0x96;this[_0x9ad9('0x1c')]=_0x4672de[_0x9ad9('0x1c')]||0x3;this['dialMachineRetryFrequency']=_0x4672de['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x4672de[_0x9ad9('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x4672de[_0x9ad9('0x1e')]||0x96;this[_0x9ad9('0x1f')]=_0x4672de[_0x9ad9('0x1f')]||_0x9ad9('0x20');this['dialPrefix']=_0x4672de[_0x9ad9('0x21')]||undefined;this[_0x9ad9('0x22')]=_0x4672de[_0x9ad9('0x22')]||undefined;this['dialCutDigit']=_0x4672de[_0x9ad9('0x23')]||undefined;this[_0x9ad9('0x24')]=_0x4672de['TrunkBackup']?_0x4672de[_0x9ad9('0x24')]:undefined;this[_0x9ad9('0x25')]=_0x4672de[_0x9ad9('0x25')]?_0x4672de[_0x9ad9('0x25')]:undefined;this[_0x9ad9('0x26')]=_0x4672de[_0x9ad9('0x26')]?_0x4672de[_0x9ad9('0x26')]:undefined;this[_0x9ad9('0x27')]=_0x4672de['SquareProject']?_0x4672de[_0x9ad9('0x27')]:undefined;this[_0x9ad9('0x28')]=_0x4672de[_0x9ad9('0x27')]?_0x4672de['SquareProject'][_0x9ad9('0x0')]:undefined;this[_0x9ad9('0x29')]=_0x4672de[_0x9ad9('0x29')]||![];this[_0x9ad9('0x2a')]=_0x4672de[_0x9ad9('0x2a')];this['dialAMDGreeting']=_0x4672de[_0x9ad9('0x2b')];this[_0x9ad9('0x2c')]=_0x4672de[_0x9ad9('0x2c')];this['dialAMDTotalAnalysisTime']=_0x4672de[_0x9ad9('0x2d')];this[_0x9ad9('0x2e')]=_0x4672de['dialAMDMinWordLength'];this[_0x9ad9('0x2f')]=_0x4672de[_0x9ad9('0x2f')];this[_0x9ad9('0x30')]=_0x4672de[_0x9ad9('0x30')];this['dialAMDSilenceThreshold']=_0x4672de['dialAMDSilenceThreshold'];this[_0x9ad9('0x31')]=_0x4672de[_0x9ad9('0x31')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 699e81c..2b5f7bd 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 _0xc8ac=['transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','connectedlinenum','accountcode','context','uniqueid','linkedid','exten','endtime','unmanaged','abandoned','duration','billableseconds','type','tag','monitor','monitors','transfercalleridnum'];(function(_0x5878e1,_0x40d74e){var _0x2c3c2f=function(_0x175644){while(--_0x175644){_0x5878e1['push'](_0x5878e1['shift']());}};_0x2c3c2f(++_0x40d74e);}(_0xc8ac,0xe9));var _0xcc8a=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0xc8ac[_0x173452];return _0xee3fd0;};'use strict';function Channel(){this[_0xcc8a('0x0')]=null;this[_0xcc8a('0x1')]='';this[_0xcc8a('0x2')]='';this[_0xcc8a('0x3')]=0x0;this['calleridname']='';this[_0xcc8a('0x4')]=undefined;this['connectedlinename']=undefined;this[_0xcc8a('0x5')]=0x0;this[_0xcc8a('0x6')]='';this[_0xcc8a('0x7')]=0x0;this[_0xcc8a('0x8')]=0x0;this[_0xcc8a('0x9')]=0x0;this['answered']=![];this['answertime']=null;this[_0xcc8a('0xa')]=null;this[_0xcc8a('0xb')]=![];this[_0xcc8a('0xc')]=![];this['lastapplication']='';this['lastdata']='';this[_0xcc8a('0xd')]=0x0;this[_0xcc8a('0xe')]=0x0;this['holdtime']=0x0;this[_0xcc8a('0xf')]=null;this[_0xcc8a('0x10')]=null;this['disposition']=null;this[_0xcc8a('0x11')]=![];this['monitorFilename']=null;this['queue']=null;this[_0xcc8a('0x12')]=[];this[_0xcc8a('0x13')]=undefined;this[_0xcc8a('0x14')]=undefined;this[_0xcc8a('0x15')]=0x0;}module[_0xcc8a('0x16')]=Channel; \ No newline at end of file +var _0x7d37=['answertime','unmanaged','abandoned','duration','billableseconds','type','disposition','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinenum','connectedlinename','context','uniqueid','exten'];(function(_0x3a10e3,_0x3cdb35){var _0xf067c8=function(_0x184beb){while(--_0x184beb){_0x3a10e3['push'](_0x3a10e3['shift']());}};_0xf067c8(++_0x3cdb35);}(_0x7d37,0x1db));var _0x77d3=function(_0x1d8e12,_0x35b2fd){_0x1d8e12=_0x1d8e12-0x0;var _0x220407=_0x7d37[_0x1d8e12];return _0x220407;};'use strict';function Channel(){this[_0x77d3('0x0')]=null;this[_0x77d3('0x1')]='';this[_0x77d3('0x2')]='';this['calleridnum']=0x0;this[_0x77d3('0x3')]='';this[_0x77d3('0x4')]=undefined;this[_0x77d3('0x5')]=undefined;this['accountcode']=0x0;this[_0x77d3('0x6')]='';this[_0x77d3('0x7')]=0x0;this['linkedid']=0x0;this[_0x77d3('0x8')]=0x0;this['answered']=![];this[_0x77d3('0x9')]=null;this['endtime']=null;this[_0x77d3('0xa')]=![];this[_0x77d3('0xb')]=![];this['lastapplication']='';this['lastdata']='';this[_0x77d3('0xc')]=0x0;this[_0x77d3('0xd')]=0x0;this['holdtime']=0x0;this[_0x77d3('0xe')]=null;this['tag']=null;this[_0x77d3('0xf')]=null;this['monitor']=![];this[_0x77d3('0x10')]=null;this['queue']=null;this[_0x77d3('0x11')]=[];this[_0x77d3('0x12')]=undefined;this[_0x77d3('0x13')]=undefined;this[_0x77d3('0x14')]=0x0;}module[_0x77d3('0x15')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index ee257eb..e23ff84 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 _0x6a88=['type','serverUrl','Configurations','exports','name','username','remoteUri','authType','consumerKey','consumerSecret','tokenSecret'];(function(_0x15c672,_0xf6bcc){var _0xf51618=function(_0x70db22){while(--_0x70db22){_0x15c672['push'](_0x15c672['shift']());}};_0xf51618(++_0xf6bcc);}(_0x6a88,0xa9));var _0x86a8=function(_0x2c7377,_0x32ade5){_0x2c7377=_0x2c7377-0x0;var _0x35e181=_0x6a88[_0x2c7377];return _0x35e181;};'use strict';function DeskAccount(_0x3e65be){this['id']=_0x3e65be['id']||0x0;this[_0x86a8('0x0')]=_0x3e65be[_0x86a8('0x0')]||'';this[_0x86a8('0x1')]=_0x3e65be[_0x86a8('0x1')]||'';this[_0x86a8('0x2')]=_0x3e65be[_0x86a8('0x2')]||'';this['authType']=_0x3e65be[_0x86a8('0x3')]||'';this['password']=_0x3e65be['password']||'';this[_0x86a8('0x4')]=_0x3e65be[_0x86a8('0x4')]||'';this['consumerSecret']=_0x3e65be[_0x86a8('0x5')]||'';this['token']=_0x3e65be['token']||'';this[_0x86a8('0x6')]=_0x3e65be[_0x86a8('0x6')]||'';this['type']=_0x3e65be[_0x86a8('0x7')]||'';this[_0x86a8('0x8')]=_0x3e65be['serverUrl']||'';this['Configurations']=_0x3e65be[_0x86a8('0x9')]||{};}module[_0x86a8('0xa')]=DeskAccount; \ No newline at end of file +var _0x0d4e=['serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x15abaf,_0x25193c){var _0x2de8fd=function(_0x1f7a56){while(--_0x1f7a56){_0x15abaf['push'](_0x15abaf['shift']());}};_0x2de8fd(++_0x25193c);}(_0x0d4e,0x1ca));var _0xe0d4=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x0d4e[_0x4e676e];return _0x336a3c;};'use strict';function DeskAccount(_0x176261){this['id']=_0x176261['id']||0x0;this[_0xe0d4('0x0')]=_0x176261[_0xe0d4('0x0')]||'';this[_0xe0d4('0x1')]=_0x176261[_0xe0d4('0x1')]||'';this[_0xe0d4('0x2')]=_0x176261[_0xe0d4('0x2')]||'';this[_0xe0d4('0x3')]=_0x176261[_0xe0d4('0x3')]||'';this['password']=_0x176261[_0xe0d4('0x4')]||'';this[_0xe0d4('0x5')]=_0x176261[_0xe0d4('0x5')]||'';this[_0xe0d4('0x6')]=_0x176261['consumerSecret']||'';this['token']=_0x176261[_0xe0d4('0x7')]||'';this[_0xe0d4('0x8')]=_0x176261[_0xe0d4('0x8')]||'';this[_0xe0d4('0x9')]=_0x176261[_0xe0d4('0x9')]||'';this[_0xe0d4('0xa')]=_0x176261[_0xe0d4('0xa')]||'';this[_0xe0d4('0xb')]=_0x176261[_0xe0d4('0xb')]||{};}module[_0xe0d4('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 1320f0d..37d5ac2 100644 --- a/server/services/ami/model/dynamics365Account.js +++ b/server/services/ami/model/dynamics365Account.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55a2=['Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x55a2,0x17e));var _0x255a=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0x55a2[_0x5eaa0b];return _0x28b295;};'use strict';function Dynamics365Account(_0x563423){this['id']=_0x563423['id']||0x0;this[_0x255a('0x0')]=_0x563423['name']||'';this[_0x255a('0x1')]=_0x563423['username']||'';this['password']=_0x563423[_0x255a('0x2')]||'';this[_0x255a('0x3')]=_0x563423[_0x255a('0x3')]||'';this[_0x255a('0x4')]=_0x563423[_0x255a('0x4')]||'';this['clientId']=_0x563423[_0x255a('0x5')]||'';this[_0x255a('0x6')]=_0x563423['clientSecret']||{};this[_0x255a('0x7')]=_0x563423[_0x255a('0x7')]||'';this[_0x255a('0x8')]=_0x563423[_0x255a('0x8')]||{};}module[_0x255a('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x67ad=['tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x53e518,_0x42c044){var _0xca67bc=function(_0xa05cf0){while(--_0xa05cf0){_0x53e518['push'](_0x53e518['shift']());}};_0xca67bc(++_0x42c044);}(_0x67ad,0x1f0));var _0xd67a=function(_0xc4e8bb,_0x197ca8){_0xc4e8bb=_0xc4e8bb-0x0;var _0x4069fb=_0x67ad[_0xc4e8bb];return _0x4069fb;};'use strict';function Dynamics365Account(_0x27d9ea){this['id']=_0x27d9ea['id']||0x0;this[_0xd67a('0x0')]=_0x27d9ea['name']||'';this[_0xd67a('0x1')]=_0x27d9ea[_0xd67a('0x1')]||'';this['password']=_0x27d9ea[_0xd67a('0x2')]||'';this['remoteUri']=_0x27d9ea[_0xd67a('0x3')]||'';this[_0xd67a('0x4')]=_0x27d9ea[_0xd67a('0x4')]||'';this[_0xd67a('0x5')]=_0x27d9ea[_0xd67a('0x5')]||'';this['clientSecret']=_0x27d9ea[_0xd67a('0x6')]||{};this[_0xd67a('0x7')]=_0x27d9ea['serverUrl']||'';this[_0xd67a('0x8')]=_0x27d9ea[_0xd67a('0x8')]||{};}module[_0xd67a('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index b49a737..55991e5 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 _0x2854=['tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','maxrate','modem','gateway','faxdetect','t38timeout'];(function(_0x4a532b,_0x5042a2){var _0x3d8b14=function(_0x404b4b){while(--_0x404b4b){_0x4a532b['push'](_0x4a532b['shift']());}};_0x3d8b14(++_0x5042a2);}(_0x2854,0xaa));var _0x4285=function(_0x562a01,_0x1685ea){_0x562a01=_0x562a01-0x0;var _0x2fa4d6=_0x2854[_0x562a01];return _0x2fa4d6;};'use strict';function FaxAccount(_0x4aaa18){this['id']=_0x4aaa18['id']||0x0;this['name']=_0x4aaa18[_0x4285('0x0')]||'';this['description']=_0x4aaa18[_0x4285('0x1')];this[_0x4285('0x2')]=_0x4aaa18[_0x4285('0x2')];this[_0x4285('0x3')]=_0x4aaa18[_0x4285('0x3')];this[_0x4285('0x4')]=_0x4aaa18[_0x4285('0x4')];this['minrate']=_0x4aaa18['minrate']||0x960;this['maxrate']=_0x4aaa18[_0x4285('0x5')]||0x3840;this[_0x4285('0x6')]=_0x4aaa18[_0x4285('0x6')]||'v17,v27,v29';this[_0x4285('0x7')]=_0x4aaa18[_0x4285('0x7')]||'no';this['faxdetect']=_0x4aaa18[_0x4285('0x8')]||'no';this[_0x4285('0x9')]=_0x4aaa18[_0x4285('0x9')]||0x1388;this[_0x4285('0xa')]=_0x4aaa18[_0x4285('0xa')]||_0x4285('0xb');this[_0x4285('0xc')]=_0x4aaa18[_0x4285('0xc')]?_0x4aaa18['Trunk']:undefined;this[_0x4285('0xd')]=_0x4aaa18[_0x4285('0xd')];this[_0x4285('0xe')]=_0x4aaa18[_0x4285('0xe')];}module['exports']=FaxAccount; \ No newline at end of file +var _0x01db=['modem','v17,v27,v29','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','description','ecm','headerinfo','localstationid','minrate','maxrate'];(function(_0x3b0c5a,_0x4c00f0){var _0x726852=function(_0x2d610e){while(--_0x2d610e){_0x3b0c5a['push'](_0x3b0c5a['shift']());}};_0x726852(++_0x4c00f0);}(_0x01db,0x171));var _0xb01d=function(_0x1dc463,_0x11db3d){_0x1dc463=_0x1dc463-0x0;var _0x5af4fb=_0x01db[_0x1dc463];return _0x5af4fb;};'use strict';function FaxAccount(_0x123688){this['id']=_0x123688['id']||0x0;this['name']=_0x123688['name']||'';this[_0xb01d('0x0')]=_0x123688[_0xb01d('0x0')];this[_0xb01d('0x1')]=_0x123688['ecm'];this[_0xb01d('0x2')]=_0x123688['headerinfo'];this['localstationid']=_0x123688[_0xb01d('0x3')];this[_0xb01d('0x4')]=_0x123688[_0xb01d('0x4')]||0x960;this[_0xb01d('0x5')]=_0x123688[_0xb01d('0x5')]||0x3840;this[_0xb01d('0x6')]=_0x123688[_0xb01d('0x6')]||_0xb01d('0x7');this['gateway']=_0x123688['gateway']||'no';this[_0xb01d('0x8')]=_0x123688[_0xb01d('0x8')]||'no';this[_0xb01d('0x9')]=_0x123688[_0xb01d('0x9')]||0x1388;this[_0xb01d('0xa')]=_0x123688[_0xb01d('0xa')]||'SIP';this['Trunk']=_0x123688[_0xb01d('0xb')]?_0x123688[_0xb01d('0xb')]:undefined;this[_0xb01d('0xc')]=_0x123688[_0xb01d('0xc')];this[_0xb01d('0xd')]=_0x123688[_0xb01d('0xd')];}module[_0xb01d('0xe')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 73b8dc2..b2ef666 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 _0x9bda=['name','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x1b8966,_0x1647a7){var _0x4d4a4b=function(_0x562562){while(--_0x562562){_0x1b8966['push'](_0x1b8966['shift']());}};_0x4d4a4b(++_0x1647a7);}(_0x9bda,0x1dc));var _0xa9bd=function(_0x36b2c5,_0x5eaf9a){_0x36b2c5=_0x36b2c5-0x0;var _0x919462=_0x9bda[_0x36b2c5];return _0x919462;};'use strict';function FreshdeskAccount(_0x1e82a5){this['id']=_0x1e82a5['id']||0x0;this[_0xa9bd('0x0')]=_0x1e82a5[_0xa9bd('0x0')]||'';this['username']=_0x1e82a5['username']||'';this[_0xa9bd('0x1')]=_0x1e82a5[_0xa9bd('0x2')]||'';this[_0xa9bd('0x3')]=_0x1e82a5['remoteUri']||'';this[_0xa9bd('0x4')]=_0x1e82a5['serverUrl']||'';this[_0xa9bd('0x5')]=_0x1e82a5[_0xa9bd('0x5')]||{};}module[_0xa9bd('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x4016=['Configurations','exports','name','username','token','remoteUri'];(function(_0xd6f5a1,_0x2666e3){var _0xb0814=function(_0x46c73){while(--_0x46c73){_0xd6f5a1['push'](_0xd6f5a1['shift']());}};_0xb0814(++_0x2666e3);}(_0x4016,0x140));var _0x6401=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4016[_0xa464c9];return _0x3d73c4;};'use strict';function FreshdeskAccount(_0x2a0ef6){this['id']=_0x2a0ef6['id']||0x0;this[_0x6401('0x0')]=_0x2a0ef6['name']||'';this[_0x6401('0x1')]=_0x2a0ef6['username']||'';this['apiKey']=_0x2a0ef6[_0x6401('0x2')]||'';this[_0x6401('0x3')]=_0x2a0ef6[_0x6401('0x3')]||'';this['serverUrl']=_0x2a0ef6['serverUrl']||'';this[_0x6401('0x4')]=_0x2a0ef6[_0x6401('0x4')]||{};}module[_0x6401('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index cd37137..10e6a64 100644 --- a/server/services/ami/model/freshsalesAccount.js +++ b/server/services/ami/model/freshsalesAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d15=['remoteUri','serverUrl','Configurations','name','username'];(function(_0x202f02,_0x189280){var _0xcadb80=function(_0x1a74bc){while(--_0x1a74bc){_0x202f02['push'](_0x202f02['shift']());}};_0xcadb80(++_0x189280);}(_0x0d15,0xbc));var _0x50d1=function(_0x3a73a1,_0x38b351){_0x3a73a1=_0x3a73a1-0x0;var _0x16cea2=_0x0d15[_0x3a73a1];return _0x16cea2;};'use strict';function FreshsalesAccount(_0x1e38ff){this['id']=_0x1e38ff['id']||0x0;this[_0x50d1('0x0')]=_0x1e38ff[_0x50d1('0x0')]||'';this[_0x50d1('0x1')]=_0x1e38ff[_0x50d1('0x1')]||'';this['apiKey']=_0x1e38ff['token']||'';this[_0x50d1('0x2')]=_0x1e38ff[_0x50d1('0x2')]||'';this['serverUrl']=_0x1e38ff[_0x50d1('0x3')]||'';this[_0x50d1('0x4')]=_0x1e38ff[_0x50d1('0x4')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xc9e6=['username','apiKey','token','serverUrl','Configurations','exports','name'];(function(_0x4c06a3,_0x1e6b6f){var _0x7ff53c=function(_0x559eff){while(--_0x559eff){_0x4c06a3['push'](_0x4c06a3['shift']());}};_0x7ff53c(++_0x1e6b6f);}(_0xc9e6,0x172));var _0x6c9e=function(_0x4630c9,_0xd229d3){_0x4630c9=_0x4630c9-0x0;var _0x10b8bd=_0xc9e6[_0x4630c9];return _0x10b8bd;};'use strict';function FreshsalesAccount(_0x33f0a2){this['id']=_0x33f0a2['id']||0x0;this[_0x6c9e('0x0')]=_0x33f0a2['name']||'';this[_0x6c9e('0x1')]=_0x33f0a2[_0x6c9e('0x1')]||'';this[_0x6c9e('0x2')]=_0x33f0a2[_0x6c9e('0x3')]||'';this['remoteUri']=_0x33f0a2['remoteUri']||'';this[_0x6c9e('0x4')]=_0x33f0a2[_0x6c9e('0x4')]||'';this[_0x6c9e('0x5')]=_0x33f0a2['Configurations']||{};}module[_0x6c9e('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index c18cfc3..2b3e950 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 _0xbba6=['queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','channel','connectedlinename','accountcode','context','exten','priority','holdtime','mohtime','variables','exports','type','inbound','uniqueid','calleridname','queue'];(function(_0x2c0b5e,_0x569bc0){var _0x590aa8=function(_0x29dcbb){while(--_0x29dcbb){_0x2c0b5e['push'](_0x2c0b5e['shift']());}};_0x590aa8(++_0x569bc0);}(_0xbba6,0x1a4));var _0x6bba=function(_0xc5fc84,_0x19f628){_0xc5fc84=_0xc5fc84-0x0;var _0x45e695=_0xbba6[_0xc5fc84];return _0x45e695;};'use strict';function QueueReport(){this[_0x6bba('0x0')]=_0x6bba('0x1');this[_0x6bba('0x2')]='';this['calleridnum']='';this[_0x6bba('0x3')]='';this[_0x6bba('0x4')]='';this[_0x6bba('0x5')]=null;this[_0x6bba('0x6')]=null;this[_0x6bba('0x7')]=0x1;this[_0x6bba('0x8')]=0x1;this[_0x6bba('0x9')]=![];this[_0x6bba('0xa')]=null;this[_0x6bba('0xb')]=![];this[_0x6bba('0xc')]=null;this[_0x6bba('0xd')]=![];this['queuecallerexitAt']=null;this[_0x6bba('0xe')]=0x1;this[_0x6bba('0xf')]='';this['connectedlinenum']='';this[_0x6bba('0x10')]='';this[_0x6bba('0x11')]='';this[_0x6bba('0x12')]='';this[_0x6bba('0x13')]='';this[_0x6bba('0x14')]='';this[_0x6bba('0x15')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0x6bba('0x16')]=0x0;this[_0x6bba('0x17')]={};}module[_0x6bba('0x18')]=QueueReport; \ No newline at end of file +var _0x89b9=['queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','holdtime','lastAssignedTo','mohtime','inbound','uniqueid','calleridnum','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x89b9,0x9e));var _0x989b=function(_0x1b68ca,_0x324020){_0x1b68ca=_0x1b68ca-0x0;var _0x1a14d4=_0x89b9[_0x1b68ca];return _0x1a14d4;};'use strict';function QueueReport(){this['type']=_0x989b('0x0');this[_0x989b('0x1')]='';this[_0x989b('0x2')]='';this['calleridname']='';this['queue']='';this['queuecallerjoinAt']=null;this[_0x989b('0x3')]=null;this['position']=0x1;this[_0x989b('0x4')]=0x1;this[_0x989b('0x5')]=![];this[_0x989b('0x6')]=null;this[_0x989b('0x7')]=![];this[_0x989b('0x8')]=null;this[_0x989b('0x9')]=![];this[_0x989b('0xa')]=null;this[_0x989b('0xb')]=0x1;this[_0x989b('0xc')]='';this[_0x989b('0xd')]='';this[_0x989b('0xe')]='';this[_0x989b('0xf')]='';this[_0x989b('0x10')]='';this[_0x989b('0x11')]='';this['priority']='';this[_0x989b('0x12')]=0x0;this['assigned']=![];this[_0x989b('0x13')]='';this[_0x989b('0x14')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 6f1257e..b59be54 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 _0xed4f=['integrationTab','Configurations','exports','name','username','remoteUri','clientId','clientSecret','securityToken','type'];(function(_0x3825a8,_0x2ce1a2){var _0xabc9bc=function(_0x101073){while(--_0x101073){_0x3825a8['push'](_0x3825a8['shift']());}};_0xabc9bc(++_0x2ce1a2);}(_0xed4f,0x111));var _0xfed4=function(_0x2cc8d4,_0xa4d7f5){_0x2cc8d4=_0x2cc8d4-0x0;var _0x4bd01a=_0xed4f[_0x2cc8d4];return _0x4bd01a;};'use strict';function SalesforceAccount(_0x2f0c61){this['id']=_0x2f0c61['id']||0x0;this[_0xfed4('0x0')]=_0x2f0c61[_0xfed4('0x0')]||'';this['username']=_0x2f0c61[_0xfed4('0x1')]||'';this[_0xfed4('0x2')]=_0x2f0c61['remoteUri']||'';this['password']=_0x2f0c61['password']||'';this['clientId']=_0x2f0c61[_0xfed4('0x3')]||'';this['clientSecret']=_0x2f0c61[_0xfed4('0x4')]||'';this[_0xfed4('0x5')]=_0x2f0c61[_0xfed4('0x5')]||'';this['type']=_0x2f0c61[_0xfed4('0x6')]||_0xfed4('0x7');this['serverUrl']=_0x2f0c61['serverUrl']||'';this['Configurations']=_0x2f0c61[_0xfed4('0x8')]||{};}module[_0xfed4('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x36e9=['remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','Configurations','exports','name','username'];(function(_0x460f42,_0x52a23a){var _0x2f8ab9=function(_0x15d6cf){while(--_0x15d6cf){_0x460f42['push'](_0x460f42['shift']());}};_0x2f8ab9(++_0x52a23a);}(_0x36e9,0x106));var _0x936e=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x36e9[_0x164eca];return _0x2ce562;};'use strict';function SalesforceAccount(_0x3f4b39){this['id']=_0x3f4b39['id']||0x0;this[_0x936e('0x0')]=_0x3f4b39[_0x936e('0x0')]||'';this['username']=_0x3f4b39[_0x936e('0x1')]||'';this[_0x936e('0x2')]=_0x3f4b39[_0x936e('0x2')]||'';this[_0x936e('0x3')]=_0x3f4b39[_0x936e('0x3')]||'';this[_0x936e('0x4')]=_0x3f4b39[_0x936e('0x4')]||'';this[_0x936e('0x5')]=_0x3f4b39[_0x936e('0x5')]||'';this[_0x936e('0x6')]=_0x3f4b39['securityToken']||'';this[_0x936e('0x7')]=_0x3f4b39[_0x936e('0x7')]||_0x936e('0x8');this['serverUrl']=_0x3f4b39['serverUrl']||'';this['Configurations']=_0x3f4b39[_0x936e('0x9')]||{};}module[_0x936e('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index f7cd63a..aedde76 100644 --- a/server/services/ami/model/servicenowAccount.js +++ b/server/services/ami/model/servicenowAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ba7=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x4cfb91,_0x52c779){var _0x22d5a4=function(_0x2b2ebc){while(--_0x2b2ebc){_0x4cfb91['push'](_0x4cfb91['shift']());}};_0x22d5a4(++_0x52c779);}(_0x4ba7,0x1d3));var _0x74ba=function(_0x133280,_0x1d32e2){_0x133280=_0x133280-0x0;var _0x48ec24=_0x4ba7[_0x133280];return _0x48ec24;};'use strict';function ServicenowAccount(_0x5da698){this['id']=_0x5da698['id']||0x0;this[_0x74ba('0x0')]=_0x5da698[_0x74ba('0x0')]||'';this[_0x74ba('0x1')]=_0x5da698['username']||'';this[_0x74ba('0x2')]=_0x5da698['password']||'';this['remoteUri']=_0x5da698[_0x74ba('0x3')]||'';this[_0x74ba('0x4')]=_0x5da698[_0x74ba('0x4')]||'';this['Configurations']=_0x5da698[_0x74ba('0x5')]||{};}module[_0x74ba('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x25d9=['exports','username','password','remoteUri','Configurations'];(function(_0x246b0b,_0xa02c6e){var _0x57f051=function(_0x431516){while(--_0x431516){_0x246b0b['push'](_0x246b0b['shift']());}};_0x57f051(++_0xa02c6e);}(_0x25d9,0xe7));var _0x925d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x25d9[_0x19950b];return _0x3c6b41;};'use strict';function ServicenowAccount(_0x1de1c0){this['id']=_0x1de1c0['id']||0x0;this['name']=_0x1de1c0['name']||'';this[_0x925d('0x0')]=_0x1de1c0[_0x925d('0x0')]||'';this[_0x925d('0x1')]=_0x1de1c0[_0x925d('0x1')]||'';this[_0x925d('0x2')]=_0x1de1c0['remoteUri']||'';this['serverUrl']=_0x1de1c0['serverUrl']||'';this[_0x925d('0x3')]=_0x1de1c0[_0x925d('0x3')]||{};}module[_0x925d('0x4')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 7344b47..56d989a 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 _0x6768=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6768,0x108));var _0x8676=function(_0x238b4b,_0x2fe72d){_0x238b4b=_0x238b4b-0x0;var _0x4fe904=_0x6768[_0x238b4b];return _0x4fe904;};'use strict';function SugarcrmAccount(_0x1b3cdc){this['id']=_0x1b3cdc['id']||0x0;this[_0x8676('0x0')]=_0x1b3cdc['name']||'';this[_0x8676('0x1')]=_0x1b3cdc['username']||'';this[_0x8676('0x2')]=_0x1b3cdc[_0x8676('0x2')]||'';this['remoteUri']=_0x1b3cdc[_0x8676('0x3')]||'';this[_0x8676('0x4')]=_0x1b3cdc['serverUrl']||'';this[_0x8676('0x5')]=_0x1b3cdc[_0x8676('0x5')]||{};}module[_0x8676('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x7fc9=['name','username','remoteUri','serverUrl','Configurations','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7fc9,0xae));var _0x97fc=function(_0x3256c6,_0x3166f8){_0x3256c6=_0x3256c6-0x0;var _0x19ae14=_0x7fc9[_0x3256c6];return _0x19ae14;};'use strict';function SugarcrmAccount(_0x518053){this['id']=_0x518053['id']||0x0;this[_0x97fc('0x0')]=_0x518053[_0x97fc('0x0')]||'';this[_0x97fc('0x1')]=_0x518053[_0x97fc('0x1')]||'';this['password']=_0x518053['password']||'';this[_0x97fc('0x2')]=_0x518053[_0x97fc('0x2')]||'';this[_0x97fc('0x3')]=_0x518053[_0x97fc('0x3')]||'';this[_0x97fc('0x4')]=_0x518053[_0x97fc('0x4')]||{};}module[_0x97fc('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 15973fc..10b506a 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 _0xea36=['name','accountcode','unknown','stateTime','status','address'];(function(_0x5e84ee,_0x9645a6){var _0xa2b329=function(_0x2337a1){while(--_0x2337a1){_0x5e84ee['push'](_0x5e84ee['shift']());}};_0xa2b329(++_0x9645a6);}(_0xea36,0xd8));var _0x6ea3=function(_0x5738e1,_0x58c55f){_0x5738e1=_0x5738e1-0x0;var _0x8704a9=_0xea36[_0x5738e1];return _0x8704a9;};'use strict';function Telephone(_0x388427){this['id']=_0x388427['id']||0x0;this[_0x6ea3('0x0')]=_0x388427[_0x6ea3('0x0')]||'';this[_0x6ea3('0x1')]=_0x388427[_0x6ea3('0x1')]||'';this['state']=_0x6ea3('0x2');this[_0x6ea3('0x3')]=0x0;this[_0x6ea3('0x4')]=_0x6ea3('0x2');this[_0x6ea3('0x5')]='';}module['exports']=Telephone; \ No newline at end of file +var _0xb272=['unknown','stateTime','status','address','exports','name','accountcode','state'];(function(_0x33c98e,_0x4eb3d0){var _0x39a756=function(_0x3cfded){while(--_0x3cfded){_0x33c98e['push'](_0x33c98e['shift']());}};_0x39a756(++_0x4eb3d0);}(_0xb272,0xed));var _0x2b27=function(_0x19a0bc,_0x2f7125){_0x19a0bc=_0x19a0bc-0x0;var _0x4d6c30=_0xb272[_0x19a0bc];return _0x4d6c30;};'use strict';function Telephone(_0x8143ac){this['id']=_0x8143ac['id']||0x0;this[_0x2b27('0x0')]=_0x8143ac[_0x2b27('0x0')]||'';this[_0x2b27('0x1')]=_0x8143ac[_0x2b27('0x1')]||'';this[_0x2b27('0x2')]=_0x2b27('0x3');this[_0x2b27('0x4')]=0x0;this[_0x2b27('0x5')]=_0x2b27('0x3');this[_0x2b27('0x6')]='';}module[_0x2b27('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index bed1b70..96fa39a 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 _0x6a56=['html','exports','name'];(function(_0x208d26,_0x295cfe){var _0xfd53fa=function(_0x2dc6f8){while(--_0x2dc6f8){_0x208d26['push'](_0x208d26['shift']());}};_0xfd53fa(++_0x295cfe);}(_0x6a56,0x182));var _0x66a5=function(_0x5a4400,_0xfae3b6){_0x5a4400=_0x5a4400-0x0;var _0xf9b532=_0x6a56[_0x5a4400];return _0xf9b532;};'use strict';function template(_0x2f4468){this['id']=_0x2f4468['id']||0x0;this[_0x66a5('0x0')]=_0x2f4468[_0x66a5('0x0')]||'';this[_0x66a5('0x1')]=_0x2f4468[_0x66a5('0x1')]||'';}module[_0x66a5('0x2')]=template; \ No newline at end of file +var _0x515f=['name','html','exports'];(function(_0xc8069a,_0x2968fc){var _0x16bc69=function(_0x4e8a44){while(--_0x4e8a44){_0xc8069a['push'](_0xc8069a['shift']());}};_0x16bc69(++_0x2968fc);}(_0x515f,0x165));var _0xf515=function(_0x4a0984,_0x4060df){_0x4a0984=_0x4a0984-0x0;var _0x4be527=_0x515f[_0x4a0984];return _0x4be527;};'use strict';function template(_0x2e4c38){this['id']=_0x2e4c38['id']||0x0;this[_0xf515('0x0')]=_0x2e4c38['name']||'';this[_0xf515('0x1')]=_0x2e4c38[_0xf515('0x1')]||'';}module[_0xf515('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 64a01a8..74e2696 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 _0x7217=['voice','status','AllConditions','AnyConditions','Actions','exports','name','channel'];(function(_0x1bbd0f,_0x5cc6cd){var _0x4456ad=function(_0xd2c2f0){while(--_0xd2c2f0){_0x1bbd0f['push'](_0x1bbd0f['shift']());}};_0x4456ad(++_0x5cc6cd);}(_0x7217,0x19e));var _0x7721=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x7217[_0x46aff0];return _0x9d78cf;};'use strict';function Trigger(_0x516f0e){this['id']=_0x516f0e['id']||0x0;this['name']=_0x516f0e[_0x7721('0x0')]||'';this[_0x7721('0x1')]=_0x516f0e[_0x7721('0x1')]||_0x7721('0x2');this[_0x7721('0x3')]=_0x516f0e['status']||![];this['AllConditions']=_0x516f0e[_0x7721('0x4')]||[];this[_0x7721('0x5')]=_0x516f0e[_0x7721('0x5')]||[];this[_0x7721('0x6')]=_0x516f0e[_0x7721('0x6')]||[];}module[_0x7721('0x7')]=Trigger; \ No newline at end of file +var _0x8ef6=['status','AllConditions','AnyConditions','exports','name','channel','voice'];(function(_0x3d1bc4,_0x1de49f){var _0x5a93b5=function(_0x21a128){while(--_0x21a128){_0x3d1bc4['push'](_0x3d1bc4['shift']());}};_0x5a93b5(++_0x1de49f);}(_0x8ef6,0xf2));var _0x68ef=function(_0x48fa45,_0x421f38){_0x48fa45=_0x48fa45-0x0;var _0x314faa=_0x8ef6[_0x48fa45];return _0x314faa;};'use strict';function Trigger(_0x58ecc7){this['id']=_0x58ecc7['id']||0x0;this[_0x68ef('0x0')]=_0x58ecc7[_0x68ef('0x0')]||'';this[_0x68ef('0x1')]=_0x58ecc7[_0x68ef('0x1')]||_0x68ef('0x2');this[_0x68ef('0x3')]=_0x58ecc7['status']||![];this[_0x68ef('0x4')]=_0x58ecc7[_0x68ef('0x4')]||[];this[_0x68ef('0x5')]=_0x58ecc7[_0x68ef('0x5')]||[];this['Actions']=_0x58ecc7['Actions']||[];}module[_0x68ef('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index a0d64b5..4a19c4a 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 _0x56c6=['unknown','stateTime','status','registry','indexOf','host','domain','domainport','refresh','stateRegistry','address','exports','active','name'];(function(_0x2678fa,_0x542d78){var _0x5072d1=function(_0xcf5102){while(--_0xcf5102){_0x2678fa['push'](_0x2678fa['shift']());}};_0x5072d1(++_0x542d78);}(_0x56c6,0x116));var _0x656c=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x56c6[_0x68c979];return _0x4f0001;};'use strict';function Trunk(_0xdfb48f){this['id']=_0xdfb48f['id']||0x0;this[_0x656c('0x0')]=_0xdfb48f[_0x656c('0x0')]||![];this[_0x656c('0x1')]=_0xdfb48f[_0x656c('0x1')]||'';this['state']=_0x656c('0x2');this[_0x656c('0x3')]=0x0;this[_0x656c('0x4')]=_0x656c('0x2');this['registry']=_0xdfb48f[_0x656c('0x5')]&&_0xdfb48f['registry'][_0x656c('0x6')](':')?_0xdfb48f['registry']['split'](':')[0x0]:'';this[_0x656c('0x7')]='';this['port']='';this[_0x656c('0x8')]='';this[_0x656c('0x9')]='';this[_0x656c('0xa')]='';this[_0x656c('0xb')]=_0x656c('0x2');this['registrationtime']='';this[_0x656c('0xc')]='';}module[_0x656c('0xd')]=Trunk; \ No newline at end of file +var _0x8fc1=['exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','port','domain','stateRegistry','registrationtime','address'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8fc1,0x141));var _0x18fc=function(_0x5d1ae9,_0x1279b1){_0x5d1ae9=_0x5d1ae9-0x0;var _0x40d737=_0x8fc1[_0x5d1ae9];return _0x40d737;};'use strict';function Trunk(_0x31b82d){this['id']=_0x31b82d['id']||0x0;this[_0x18fc('0x0')]=_0x31b82d[_0x18fc('0x0')]||![];this[_0x18fc('0x1')]=_0x31b82d[_0x18fc('0x1')]||'';this[_0x18fc('0x2')]=_0x18fc('0x3');this[_0x18fc('0x4')]=0x0;this[_0x18fc('0x5')]=_0x18fc('0x3');this[_0x18fc('0x6')]=_0x31b82d[_0x18fc('0x6')]&&_0x31b82d['registry'][_0x18fc('0x7')](':')?_0x31b82d[_0x18fc('0x6')][_0x18fc('0x8')](':')[0x0]:'';this[_0x18fc('0x9')]='';this[_0x18fc('0xa')]='';this[_0x18fc('0xb')]='';this['domainport']='';this['refresh']='';this[_0x18fc('0xc')]=_0x18fc('0x3');this[_0x18fc('0xd')]='';this[_0x18fc('0xe')]='';}module[_0x18fc('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 aac7e33..21afd57 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 _0xbabb=['none','exten','recordingFormat'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xbabb,0x13c));var _0xbbab=function(_0x38b687,_0xde964f){_0x38b687=_0x38b687-0x0;var _0x4376b5=_0xbabb[_0x38b687];return _0x4376b5;};'use strict';function voiceExtension(_0x38f19f){this['id']=_0x38f19f['id']||0x0;this[_0xbbab('0x0')]=_0x38f19f[_0xbbab('0x0')]||'';this[_0xbbab('0x1')]=_0x38f19f[_0xbbab('0x1')]||_0xbbab('0x2');this['mandatoryDisposition']=_0x38f19f['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0xcb14=['recordingFormat','none','mandatoryDisposition','exten'];(function(_0x54a892,_0x1a4eeb){var _0x1f24f1=function(_0x2044d5){while(--_0x2044d5){_0x54a892['push'](_0x54a892['shift']());}};_0x1f24f1(++_0x1a4eeb);}(_0xcb14,0x9f));var _0x4cb1=function(_0x75caa,_0x390e63){_0x75caa=_0x75caa-0x0;var _0x8c7804=_0xcb14[_0x75caa];return _0x8c7804;};'use strict';function voiceExtension(_0x462ab1){this['id']=_0x462ab1['id']||0x0;this[_0x4cb1('0x0')]=_0x462ab1[_0x4cb1('0x0')]||'';this[_0x4cb1('0x1')]=_0x462ab1[_0x4cb1('0x1')]||_0x4cb1('0x2');this[_0x4cb1('0x3')]=_0x462ab1[_0x4cb1('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 4a0c2d7..887b882 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 _0x0999=['dialAMDMaximumWordLength','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','not_inuse','inuse','busy','invalid','unavailable','ringinuse','onhold','wav49','roundrobin','name','monitor_format','type','inbound','waiting','talking','sumDuration','sumBillable','abandoned','available','acw','acwTimeout','autopause','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitQueue','dialPredictiveOptimization','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold'];(function(_0x13e300,_0x1bcb41){var _0x5a3eea=function(_0x2dfd2a){while(--_0x2dfd2a){_0x13e300['push'](_0x13e300['shift']());}};_0x5a3eea(++_0x1bcb41);}(_0x0999,0x95));var _0x9099=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x0999[_0x5c9307];return _0x373e29;};'use strict';var statusDesc=['unknown',_0x9099('0x0'),_0x9099('0x1'),_0x9099('0x2'),_0x9099('0x3'),_0x9099('0x4'),'ringing',_0x9099('0x5'),_0x9099('0x6')];var monitorFormat={'wav':'wav','wav49':_0x9099('0x7'),'gsm':'gsm'};var strategy={'rrmemory':'rrmemory','roundrobin':_0x9099('0x8')};function VoiceQueue(_0x2fb4d2){this['id']=_0x2fb4d2['id']||0x0;this['name']=_0x2fb4d2[_0x9099('0x9')]||'';this[_0x9099('0xa')]=_0x2fb4d2[_0x9099('0xa')]||'';this[_0x9099('0xb')]=_0x2fb4d2[_0x9099('0xb')]||_0x9099('0xc');this[_0x9099('0xd')]=0x0;this[_0x9099('0xe')]=0x0;this['total']=0x0;this['answered']=0x0;this[_0x9099('0xf')]=0x0;this['sumHoldTime']=0x0;this[_0x9099('0x10')]=0x0;this['unmanaged']=0x0;this[_0x9099('0x11')]=0x0;this['loggedIn']=0x0;this[_0x9099('0x12')]=0x0;this[_0x9099('0x13')]=_0x2fb4d2['acw']||![];this[_0x9099('0x14')]=_0x2fb4d2['acwTimeout']||0xa;this[_0x9099('0x15')]=_0x2fb4d2[_0x9099('0x15')]||'no';this['sendMessageOneNotActive']=!![];this['message']='';this[_0x9099('0x16')]=0x0;this[_0x9099('0x17')]=0x0;this[_0x9099('0x18')]=_0x2fb4d2['dialTimezone']||null;this[_0x9099('0x19')]=_0x2fb4d2[_0x9099('0x19')]?_0x2fb4d2[_0x9099('0x19')]:null;this[_0x9099('0x1a')]=_0x2fb4d2['dialActive'];this[_0x9099('0x1b')]=_0x2fb4d2['dialMethod']||_0x9099('0x1c');this['dialLimitChannel']=_0x2fb4d2['dialLimitChannel']||0x0;this[_0x9099('0x1d')]=_0x2fb4d2[_0x9099('0x1d')]||0x0;this['dialPowerLevel']=_0x2fb4d2['dialPowerLevel']||0x1;this[_0x9099('0x1e')]=_0x2fb4d2[_0x9099('0x1e')]||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x2fb4d2['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x2fb4d2['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x2fb4d2[_0x9099('0x1f')]||'anonymous';this[_0x9099('0x20')]=_0x2fb4d2['dialOriginateCallerIdNumber']||_0x9099('0x21');this['dialOriginateTimeout']=_0x2fb4d2[_0x9099('0x22')]||0x1e;this['dialQueueOptions']=_0x2fb4d2[_0x9099('0x23')]||'tTxX';this[_0x9099('0x24')]=_0x2fb4d2['dialQueueTimeout']||0x3;this[_0x9099('0x25')]=_0x2fb4d2[_0x9099('0x25')]||undefined;this[_0x9099('0x26')]=_0x2fb4d2['dialCongestionMaxRetry']||0x3;this[_0x9099('0x27')]=_0x2fb4d2[_0x9099('0x27')]||0x96;this[_0x9099('0x28')]=_0x2fb4d2[_0x9099('0x28')]||0x3;this[_0x9099('0x29')]=_0x2fb4d2['dialBusyRetryFrequency']||0x96;this[_0x9099('0x2a')]=_0x2fb4d2[_0x9099('0x2a')]||0x3;this['dialNoAnswerRetryFrequency']=_0x2fb4d2[_0x9099('0x2b')]||0x96;this[_0x9099('0x2c')]=_0x2fb4d2['dialNoSuchNumberMaxRetry']||0x3;this[_0x9099('0x2d')]=_0x2fb4d2[_0x9099('0x2d')]||0x96;this[_0x9099('0x2e')]=_0x2fb4d2[_0x9099('0x2e')]||0x3;this[_0x9099('0x2f')]=_0x2fb4d2[_0x9099('0x2f')]||0x96;this[_0x9099('0x30')]=_0x2fb4d2['dialAbandonedMaxRetry']||0x3;this[_0x9099('0x31')]=_0x2fb4d2[_0x9099('0x31')]||0x96;this[_0x9099('0x32')]=_0x2fb4d2['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x2fb4d2[_0x9099('0x33')]||0x96;this['dialAgentRejectMaxRetry']=_0x2fb4d2[_0x9099('0x34')]||0x3;this[_0x9099('0x35')]=_0x2fb4d2[_0x9099('0x35')]||0x96;this[_0x9099('0x36')]=_0x2fb4d2[_0x9099('0x36')]||0x4;this['Trunk']=_0x2fb4d2['Trunk']?_0x2fb4d2[_0x9099('0x37')]:undefined;this[_0x9099('0x38')]=_0x2fb4d2['TrunkBackup']?_0x2fb4d2[_0x9099('0x38')]:undefined;this['dialPrefix']=_0x2fb4d2[_0x9099('0x39')]||undefined;this[_0x9099('0x3a')]=_0x2fb4d2[_0x9099('0x3a')]?_0x2fb4d2[_0x9099('0x3a')]:undefined;this[_0x9099('0x3b')]=_0x2fb4d2[_0x9099('0x3b')]||_0x9099('0x3c');this[_0x9099('0x3d')]=_0x2fb4d2['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x2fb4d2[_0x9099('0x3e')]||undefined;this[_0x9099('0x3f')]=strategy[_0x2fb4d2['strategy']]||_0x9099('0x40');this[_0x9099('0x41')]=!![];this[_0x9099('0x42')]=_0x2fb4d2[_0x9099('0x42')]||![];this[_0x9099('0x43')]=_0x2fb4d2[_0x9099('0x43')];this[_0x9099('0x44')]=_0x2fb4d2[_0x9099('0x44')];this[_0x9099('0x45')]=_0x2fb4d2[_0x9099('0x45')];this['dialAMDTotalAnalysisTime']=_0x2fb4d2[_0x9099('0x46')];this[_0x9099('0x47')]=_0x2fb4d2['dialAMDMinWordLength'];this[_0x9099('0x48')]=_0x2fb4d2['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x2fb4d2[_0x9099('0x49')];this[_0x9099('0x4a')]=_0x2fb4d2[_0x9099('0x4a')];this[_0x9099('0x4b')]=_0x2fb4d2['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0x9099('0x4c')]=_0x2fb4d2['timeout'];this[_0x9099('0x4d')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x9099('0x4e')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x9099('0x4f')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x9099('0x50')]=0x0;this[_0x9099('0x51')]=0x0;this[_0x9099('0x52')]=0x0;this[_0x9099('0x53')]=0x0;this[_0x9099('0x54')]=0x0;this[_0x9099('0x55')]=0x0;this[_0x9099('0x56')]=0x0;this[_0x9099('0x57')]=0x0;this['startProgressive']=undefined;this[_0x9099('0x58')]=undefined;this['handlePredictive']=undefined;this[_0x9099('0x59')]=1.05;this[_0x9099('0x5a')]=0x0;this[_0x9099('0x5b')]=0x0;this[_0x9099('0x5c')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x9099('0x5d')]=0x0;this[_0x9099('0x5e')]=0x0;this[_0x9099('0x5f')]=0x0;this[_0x9099('0x60')]=0x0;this[_0x9099('0x61')]=_0x2fb4d2[_0x9099('0x62')]||0x14;this[_0x9099('0x63')]=_0x2fb4d2[_0x9099('0x62')]||0xa;this[_0x9099('0x64')]=0x0;this[_0x9099('0x65')]=0x0;this[_0x9099('0x66')]=0x1;this['erlangCalls']=0x0;this[_0x9099('0x67')]=0x0;this[_0x9099('0x68')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x2fb4d2[_0x9099('0x69')]||0x1e;this[_0x9099('0x6a')]=_0x2fb4d2[_0x9099('0x6a')]||![];this[_0x9099('0x6b')]=_0x2fb4d2[_0x9099('0x6b')]||undefined;this[_0x9099('0x6c')]=_0x2fb4d2[_0x9099('0x6c')]||![];this[_0x9099('0x6d')]=_0x2fb4d2[_0x9099('0x6d')]||![];this[_0x9099('0xa')]=monitorFormat[_0x2fb4d2[_0x9099('0xa')]]?monitorFormat[_0x2fb4d2[_0x9099('0xa')]]:undefined;this[_0x9099('0x6e')]=_0x2fb4d2[_0x9099('0x6e')]||![];this[_0x9099('0x6f')]=_0x2fb4d2[_0x9099('0x6f')]?_0x2fb4d2[_0x9099('0x6f')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0x488f=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','busy','invalid','ringinuse','onhold','wav','gsm','rrmemory','roundrobin','name','monitor_format','type','waiting','talking','total','sumDuration','sumHoldTime','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency'];(function(_0x3c8f59,_0x454ec3){var _0x168fe7=function(_0x24c9d2){while(--_0x24c9d2){_0x3c8f59['push'](_0x3c8f59['shift']());}};_0x168fe7(++_0x454ec3);}(_0x488f,0xbf));var _0xf488=function(_0xfc36d,_0x1a875e){_0xfc36d=_0xfc36d-0x0;var _0x5b711b=_0x488f[_0xfc36d];return _0x5b711b;};'use strict';var statusDesc=['unknown',_0xf488('0x0'),_0xf488('0x1'),_0xf488('0x2'),_0xf488('0x3'),'unavailable','ringing',_0xf488('0x4'),_0xf488('0x5')];var monitorFormat={'wav':_0xf488('0x6'),'wav49':'wav49','gsm':_0xf488('0x7')};var strategy={'rrmemory':_0xf488('0x8'),'roundrobin':_0xf488('0x9')};function VoiceQueue(_0x75eac){this['id']=_0x75eac['id']||0x0;this[_0xf488('0xa')]=_0x75eac[_0xf488('0xa')]||'';this['monitor_format']=_0x75eac[_0xf488('0xb')]||'';this[_0xf488('0xc')]=_0x75eac[_0xf488('0xc')]||'inbound';this[_0xf488('0xd')]=0x0;this[_0xf488('0xe')]=0x0;this[_0xf488('0xf')]=0x0;this['answered']=0x0;this[_0xf488('0x10')]=0x0;this[_0xf488('0x11')]=0x0;this[_0xf488('0x12')]=0x0;this['unmanaged']=0x0;this[_0xf488('0x13')]=0x0;this[_0xf488('0x14')]=0x0;this[_0xf488('0x15')]=0x0;this[_0xf488('0x16')]=_0x75eac['acw']||![];this[_0xf488('0x17')]=_0x75eac['acwTimeout']||0xa;this[_0xf488('0x18')]=_0x75eac[_0xf488('0x18')]||'no';this[_0xf488('0x19')]=!![];this[_0xf488('0x1a')]='';this['originated']=0x0;this[_0xf488('0x1b')]=0x0;this['dialTimezone']=_0x75eac[_0xf488('0x1c')]||null;this['dialGlobalInterval']=_0x75eac['dialGlobalInterval']?_0x75eac[_0xf488('0x1d')]:null;this[_0xf488('0x1e')]=_0x75eac[_0xf488('0x1e')];this[_0xf488('0x1f')]=_0x75eac['dialMethod']||_0xf488('0x20');this[_0xf488('0x21')]=_0x75eac[_0xf488('0x21')]||0x0;this[_0xf488('0x22')]=_0x75eac['dialLimitQueue']||0x0;this[_0xf488('0x23')]=_0x75eac[_0xf488('0x23')]||0x1;this['dialPredictiveOptimization']=_0x75eac[_0xf488('0x24')]||_0xf488('0x25');this['dialPredictiveOptimizationPercentage']=_0x75eac[_0xf488('0x26')]||0.03;this[_0xf488('0x27')]=_0x75eac[_0xf488('0x27')]||0x258;this[_0xf488('0x28')]=_0x75eac[_0xf488('0x28')]||_0xf488('0x29');this[_0xf488('0x2a')]=_0x75eac[_0xf488('0x2a')]||_0xf488('0x29');this[_0xf488('0x2b')]=_0x75eac[_0xf488('0x2b')]||0x1e;this[_0xf488('0x2c')]=_0x75eac[_0xf488('0x2c')]||'tTxX';this[_0xf488('0x2d')]=_0x75eac['dialQueueTimeout']||0x3;this[_0xf488('0x2e')]=_0x75eac[_0xf488('0x2e')]||undefined;this['dialCongestionMaxRetry']=_0x75eac[_0xf488('0x2f')]||0x3;this[_0xf488('0x30')]=_0x75eac[_0xf488('0x30')]||0x96;this[_0xf488('0x31')]=_0x75eac[_0xf488('0x31')]||0x3;this[_0xf488('0x32')]=_0x75eac[_0xf488('0x32')]||0x96;this[_0xf488('0x33')]=_0x75eac[_0xf488('0x33')]||0x3;this['dialNoAnswerRetryFrequency']=_0x75eac['dialNoAnswerRetryFrequency']||0x96;this[_0xf488('0x34')]=_0x75eac[_0xf488('0x34')]||0x3;this[_0xf488('0x35')]=_0x75eac[_0xf488('0x35')]||0x96;this[_0xf488('0x36')]=_0x75eac[_0xf488('0x36')]||0x3;this['dialDropRetryFrequency']=_0x75eac[_0xf488('0x37')]||0x96;this[_0xf488('0x38')]=_0x75eac['dialAbandonedMaxRetry']||0x3;this[_0xf488('0x39')]=_0x75eac[_0xf488('0x39')]||0x96;this['dialMachineMaxRetry']=_0x75eac[_0xf488('0x3a')]||0x3;this[_0xf488('0x3b')]=_0x75eac[_0xf488('0x3b')]||0x96;this[_0xf488('0x3c')]=_0x75eac[_0xf488('0x3c')]||0x3;this[_0xf488('0x3d')]=_0x75eac[_0xf488('0x3d')]||0x96;this[_0xf488('0x3e')]=_0x75eac[_0xf488('0x3e')]||0x4;this[_0xf488('0x3f')]=_0x75eac[_0xf488('0x3f')]?_0x75eac[_0xf488('0x3f')]:undefined;this[_0xf488('0x40')]=_0x75eac[_0xf488('0x40')]?_0x75eac[_0xf488('0x40')]:undefined;this['dialPrefix']=_0x75eac[_0xf488('0x41')]||undefined;this['Interval']=_0x75eac['Interval']?_0x75eac[_0xf488('0x42')]:undefined;this[_0xf488('0x43')]=_0x75eac[_0xf488('0x43')]||_0xf488('0x44');this[_0xf488('0x45')]=_0x75eac[_0xf488('0x45')]||undefined;this['dialCutDigit']=_0x75eac[_0xf488('0x46')]||undefined;this[_0xf488('0x47')]=strategy[_0x75eac['strategy']]||_0xf488('0x8');this['queueStatusComplete']=!![];this[_0xf488('0x48')]=_0x75eac['dialAMDActive']||![];this[_0xf488('0x49')]=_0x75eac[_0xf488('0x49')];this[_0xf488('0x4a')]=_0x75eac[_0xf488('0x4a')];this[_0xf488('0x4b')]=_0x75eac[_0xf488('0x4b')];this[_0xf488('0x4c')]=_0x75eac[_0xf488('0x4c')];this['dialAMDMinWordLength']=_0x75eac['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x75eac[_0xf488('0x4d')];this[_0xf488('0x4e')]=_0x75eac[_0xf488('0x4e')];this[_0xf488('0x4f')]=_0x75eac[_0xf488('0x4f')];this[_0xf488('0x50')]=_0x75eac['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0xf488('0x51')]=0x0;this[_0xf488('0x52')]=_0x75eac[_0xf488('0x52')];this[_0xf488('0x53')]=0x0;this[_0xf488('0x54')]=0x0;this[_0xf488('0x55')]=0x0;this[_0xf488('0x56')]=0x0;this[_0xf488('0x57')]=0x0;this[_0xf488('0x58')]=0x0;this[_0xf488('0x59')]=0x0;this[_0xf488('0x5a')]=0x0;this[_0xf488('0x5b')]=0x0;this[_0xf488('0x5c')]=0x0;this[_0xf488('0x5d')]=0x0;this[_0xf488('0x5e')]=0x0;this[_0xf488('0x5f')]=0x0;this[_0xf488('0x60')]=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this[_0xf488('0x61')]=undefined;this[_0xf488('0x62')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xf488('0x63')]=0x0;this[_0xf488('0x64')]=0x0;this[_0xf488('0x65')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xf488('0x66')]=0x0;this[_0xf488('0x67')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xf488('0x68')]=_0x75eac[_0xf488('0x69')]||0x14;this[_0xf488('0x6a')]=_0x75eac[_0xf488('0x69')]||0xa;this[_0xf488('0x6b')]=0x0;this[_0xf488('0x6c')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xf488('0x6d')]=0x0;this['erlangCallToSecond']=0x0;this[_0xf488('0x6e')]=0x0;this[_0xf488('0x6f')]=0x0;this['dialRecallMeTimeout']=_0x75eac[_0xf488('0x70')]||0x1e;this['dialRecallInQueue']=_0x75eac[_0xf488('0x71')]||![];this[_0xf488('0x72')]=_0x75eac['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x75eac[_0xf488('0x73')]||![];this[_0xf488('0x74')]=_0x75eac[_0xf488('0x74')]||![];this[_0xf488('0xb')]=monitorFormat[_0x75eac[_0xf488('0xb')]]?monitorFormat[_0x75eac[_0xf488('0xb')]]:undefined;this[_0xf488('0x75')]=_0x75eac['mandatoryDisposition']||![];this['mandatoryDispositionPause']=_0x75eac[_0xf488('0x76')]?_0x75eac[_0xf488('0x76')]:undefined;}module[_0xf488('0x77')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 91033c4..192128d 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 _0x21de=['exports','name','username','remoteUri','serverUrl','Configurations'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x21de,0x103));var _0xe21d=function(_0x57e5db,_0x3d6ace){_0x57e5db=_0x57e5db-0x0;var _0x2c1f43=_0x21de[_0x57e5db];return _0x2c1f43;};'use strict';function VtigerAccount(_0x18b0f2){this['id']=_0x18b0f2['id']||0x0;this[_0xe21d('0x0')]=_0x18b0f2[_0xe21d('0x0')]||'';this[_0xe21d('0x1')]=_0x18b0f2[_0xe21d('0x1')]||'';this['accessKey']=_0x18b0f2['accessKey']||'';this[_0xe21d('0x2')]=_0x18b0f2[_0xe21d('0x2')]||'';this['serverUrl']=_0x18b0f2[_0xe21d('0x3')]||'';this[_0xe21d('0x4')]=_0x18b0f2[_0xe21d('0x4')]||{};}module[_0xe21d('0x5')]=VtigerAccount; \ No newline at end of file +var _0x7e46=['serverUrl','Configurations','name','username','accessKey','remoteUri'];(function(_0x457f4e,_0x2d1d0a){var _0x241e9a=function(_0x5d81e8){while(--_0x5d81e8){_0x457f4e['push'](_0x457f4e['shift']());}};_0x241e9a(++_0x2d1d0a);}(_0x7e46,0x1a6));var _0x67e4=function(_0x440976,_0x272140){_0x440976=_0x440976-0x0;var _0x45e5a0=_0x7e46[_0x440976];return _0x45e5a0;};'use strict';function VtigerAccount(_0x353afb){this['id']=_0x353afb['id']||0x0;this[_0x67e4('0x0')]=_0x353afb[_0x67e4('0x0')]||'';this[_0x67e4('0x1')]=_0x353afb['username']||'';this[_0x67e4('0x2')]=_0x353afb[_0x67e4('0x2')]||'';this[_0x67e4('0x3')]=_0x353afb['remoteUri']||'';this[_0x67e4('0x4')]=_0x353afb[_0x67e4('0x4')]||'';this[_0x67e4('0x5')]=_0x353afb[_0x67e4('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 7a4cc74..ad4e2a6 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 _0x2ef3=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x3bd722,_0x2ac0c1){var _0x366a2c=function(_0x2dfa1d){while(--_0x2dfa1d){_0x3bd722['push'](_0x3bd722['shift']());}};_0x366a2c(++_0x2ac0c1);}(_0x2ef3,0xba));var _0x32ef=function(_0x76ee5b,_0x4af143){_0x76ee5b=_0x76ee5b-0x0;var _0x584e32=_0x2ef3[_0x76ee5b];return _0x584e32;};'use strict';function ZendeskAccount(_0x4d5ac8){this['id']=_0x4d5ac8['id']||0x0;this[_0x32ef('0x0')]=_0x4d5ac8[_0x32ef('0x0')]||'';this[_0x32ef('0x1')]=_0x4d5ac8[_0x32ef('0x1')]||'';this[_0x32ef('0x2')]=_0x4d5ac8['password']||'';this[_0x32ef('0x3')]=_0x4d5ac8[_0x32ef('0x3')]||'';this['remoteUri']=_0x4d5ac8[_0x32ef('0x4')]||'';this[_0x32ef('0x5')]=_0x4d5ac8['authType']||'';this['type']=_0x4d5ac8[_0x32ef('0x6')]||_0x32ef('0x7');this[_0x32ef('0x8')]=_0x4d5ac8[_0x32ef('0x8')]||'';this[_0x32ef('0x9')]=_0x4d5ac8[_0x32ef('0x9')]||{};}module[_0x32ef('0xa')]=ZendeskAccount; \ No newline at end of file +var _0xdb28=['Configurations','exports','name','username','password','token','remoteUri','authType','integrationTab','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x3c2b46,_0x34e6a3){_0x3c2b46=_0x3c2b46-0x0;var _0x14e29d=_0xdb28[_0x3c2b46];return _0x14e29d;};'use strict';function ZendeskAccount(_0x2f1285){this['id']=_0x2f1285['id']||0x0;this[_0x8db2('0x0')]=_0x2f1285[_0x8db2('0x0')]||'';this[_0x8db2('0x1')]=_0x2f1285['username']||'';this[_0x8db2('0x2')]=_0x2f1285[_0x8db2('0x2')]||'';this[_0x8db2('0x3')]=_0x2f1285[_0x8db2('0x3')]||'';this[_0x8db2('0x4')]=_0x2f1285['remoteUri']||'';this[_0x8db2('0x5')]=_0x2f1285[_0x8db2('0x5')]||'';this['type']=_0x2f1285['type']||_0x8db2('0x6');this[_0x8db2('0x7')]=_0x2f1285[_0x8db2('0x7')]||'';this[_0x8db2('0x8')]=_0x2f1285[_0x8db2('0x8')]||{};}module[_0x8db2('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 7e1e0dd..c705302 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 _0x352e=['refreshToken','Configurations','name','description','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x292bab,_0x18b725){var _0x3a1de1=function(_0x8d52cf){while(--_0x8d52cf){_0x292bab['push'](_0x292bab['shift']());}};_0x3a1de1(++_0x18b725);}(_0x352e,0x1a6));var _0xe352=function(_0x1b2d54,_0x335cf5){_0x1b2d54=_0x1b2d54-0x0;var _0x2f6d0f=_0x352e[_0x1b2d54];return _0x2f6d0f;};'use strict';function ZohoAccount(_0x3370ac){this['id']=_0x3370ac['id']||0x0;this[_0xe352('0x0')]=_0x3370ac[_0xe352('0x0')]||'';this[_0xe352('0x1')]=_0x3370ac[_0xe352('0x1')]||'';this[_0xe352('0x2')]=_0x3370ac[_0xe352('0x2')]||'';this[_0xe352('0x3')]=_0x3370ac['zone']||'';this[_0xe352('0x4')]=_0x3370ac[_0xe352('0x4')]||'';this['clientSecret']=_0x3370ac[_0xe352('0x5')]||'';this[_0xe352('0x6')]=_0x3370ac[_0xe352('0x6')]||'';this[_0xe352('0x7')]=_0x3370ac['code']||'';this[_0xe352('0x8')]=_0x3370ac[_0xe352('0x8')]||'';this[_0xe352('0x9')]=_0x3370ac[_0xe352('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0xf5b6=['serverUrl','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf5b6,0x1b4));var _0x6f5b=function(_0x5d1b38,_0x12c2cf){_0x5d1b38=_0x5d1b38-0x0;var _0x46a311=_0xf5b6[_0x5d1b38];return _0x46a311;};'use strict';function ZohoAccount(_0x42c7f9){this['id']=_0x42c7f9['id']||0x0;this['name']=_0x42c7f9[_0x6f5b('0x0')]||'';this[_0x6f5b('0x1')]=_0x42c7f9[_0x6f5b('0x1')]||'';this[_0x6f5b('0x2')]=_0x42c7f9['host']||'';this[_0x6f5b('0x3')]=_0x42c7f9[_0x6f5b('0x3')]||'';this[_0x6f5b('0x4')]=_0x42c7f9[_0x6f5b('0x4')]||'';this['clientSecret']=_0x42c7f9['clientSecret']||'';this[_0x6f5b('0x5')]=_0x42c7f9[_0x6f5b('0x5')]||'';this['code']=_0x42c7f9['code']||'';this[_0x6f5b('0x6')]=_0x42c7f9['refreshToken']||'';this[_0x6f5b('0x7')]=_0x42c7f9[_0x6f5b('0x7')]||{};}module[_0x6f5b('0x8')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index cf91b2c..302972b 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 _0xb407=['name','channelAgent','SIP/%s','calleridname','Contact','active','calleridnum','scheduledat','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','getCaller','format','number','exports','moment','isNil','string','idContact','queue','type','campaigntype','membername','Agent'];(function(_0x2e8802,_0x59ad8c){var _0x4617aa=function(_0x4380b4){while(--_0x4380b4){_0x2e8802['push'](_0x2e8802['shift']());}};_0x4617aa(++_0x59ad8c);}(_0xb407,0x17d));var _0x7b40=function(_0x3302de,_0x43d975){_0x3302de=_0x3302de-0x0;var _0x214103=_0xb407[_0x3302de];return _0x214103;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x7b40('0x0'));function checkNameSurname(_0xd73a3d,_0x17bf58,_0x502bf4){var _0x59d1ce='';if(!_[_0x7b40('0x1')](_0x17bf58)&&_0x7b40('0x2')===typeof _0x17bf58){_0x59d1ce+=_0x17bf58;}if(!_[_0x7b40('0x1')](_0x502bf4)&&_0x7b40('0x2')===typeof _0x502bf4){_0x59d1ce+='\x20'+_0x502bf4;}if(_0x59d1ce!==''){return _0x59d1ce;}return _0xd73a3d;}function Action(_0x271389,_0x383faa,_0x2d9592,_0x86570d,_0x5b609b){this['uniqueid']=_0x2d9592||undefined;this[_0x7b40('0x3')]=_0x271389['id'];this[_0x7b40('0x4')]=_0x383faa['name'];this[_0x7b40('0x5')]=_0x383faa[_0x7b40('0x5')];this[_0x7b40('0x6')]='queue';this['dialAnswer']=![];this[_0x7b40('0x7')]=_['isNil'](_0x271389[_0x7b40('0x8')])?undefined:_0x271389[_0x7b40('0x8')][_0x7b40('0x9')];this[_0x7b40('0xa')]=this[_0x7b40('0x7')]?util['format'](_0x7b40('0xb'),this['membername']):_0x86570d||undefined;this[_0x7b40('0xc')]=checkNameSurname(_0x271389['Contact']['phone'],_0x271389[_0x7b40('0xd')]['firstName'],_0x271389[_0x7b40('0xd')]['lastName']);this[_0x7b40('0xe')]=_0x271389[_0x7b40('0xe')]||![];this[_0x7b40('0xf')]=_0x271389[_0x7b40('0xd')]['phone'];this[_0x7b40('0x10')]=_0x271389[_0x7b40('0x10')];this['countbusyretry']=_0x271389['countbusyretry']||0x0;this[_0x7b40('0x11')]=_0x271389[_0x7b40('0x11')]||0x0;this[_0x7b40('0x12')]=_0x271389[_0x7b40('0x12')]||0x0;this[_0x7b40('0x13')]=(_0x271389[_0x7b40('0x14')]||0x0)+(_0x271389['countcongestionretry']||0x0)+(_0x271389[_0x7b40('0x12')]||0x0)+(_0x271389[_0x7b40('0x15')]||0x0)+(_0x271389[_0x7b40('0x16')]||0x0)+(_0x271389[_0x7b40('0x17')]||0x0)+(_0x271389[_0x7b40('0x18')]||0x0)+(_0x271389[_0x7b40('0x19')]||0x0);this[_0x7b40('0x15')]=_0x271389['countnosuchnumberretry']||0x0;this['countdropretry']=_0x271389[_0x7b40('0x16')]||0x0;this[_0x7b40('0x17')]=_0x271389[_0x7b40('0x17')]||0x0;this[_0x7b40('0x18')]=_0x271389['countmachineretry']||0x0;this[_0x7b40('0x19')]=_0x271389[_0x7b40('0x19')]||0x0;this[_0x7b40('0x1a')]=_0x271389[_0x7b40('0x1a')];this[_0x7b40('0x1b')]=_0x271389[_0x7b40('0x1b')];this[_0x7b40('0x1c')]=_0x271389[_0x7b40('0x1c')];this['recallme']=_0x271389[_0x7b40('0x1d')];this['ContactId']=_0x271389[_0x7b40('0x1e')];this[_0x7b40('0x1f')]=_0x271389[_0x7b40('0x1f')];this['UserId']=_[_0x7b40('0x1')](_0x271389[_0x7b40('0x8')])?_0x271389[_0x7b40('0x20')]:_0x271389[_0x7b40('0x8')]['id'];this[_0x7b40('0x21')]=_0x271389[_0x7b40('0x21')];this['originatecalleridnum']='';this[_0x7b40('0x22')]='';}Action['prototype'][_0x7b40('0x23')]=function(){return util[_0x7b40('0x24')]('\x22%s\x22\x20<%s>',this['calleridname'],this[_0x7b40('0x25')]);};module[_0x7b40('0x26')]=Action; \ No newline at end of file +var _0xa141=['dialAnswer','Agent','channelAgent','membername','format','SIP/%s','calleridname','Contact','phone','firstName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','lodash','moment','string','isNil','uniqueid','idContact','name','type','campaigntype'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xa141,0x1c3));var _0x1a14=function(_0x5583d3,_0x3b6d76){_0x5583d3=_0x5583d3-0x0;var _0x2d8923=_0xa141[_0x5583d3];return _0x2d8923;};'use strict';var util=require('util');var _=require(_0x1a14('0x0'));var moment=require(_0x1a14('0x1'));function checkNameSurname(_0x1f9942,_0x527baa,_0x4b8c70){var _0x1e4b3e='';if(!_['isNil'](_0x527baa)&&_0x1a14('0x2')===typeof _0x527baa){_0x1e4b3e+=_0x527baa;}if(!_[_0x1a14('0x3')](_0x4b8c70)&&_0x1a14('0x2')===typeof _0x4b8c70){_0x1e4b3e+='\x20'+_0x4b8c70;}if(_0x1e4b3e!==''){return _0x1e4b3e;}return _0x1f9942;}function Action(_0x4ecf7d,_0x491d07,_0xbfecc0,_0x207a10,_0x2c6957){this[_0x1a14('0x4')]=_0xbfecc0||undefined;this[_0x1a14('0x5')]=_0x4ecf7d['id'];this['queue']=_0x491d07[_0x1a14('0x6')];this[_0x1a14('0x7')]=_0x491d07[_0x1a14('0x7')];this[_0x1a14('0x8')]='queue';this[_0x1a14('0x9')]=![];this['membername']=_[_0x1a14('0x3')](_0x4ecf7d[_0x1a14('0xa')])?undefined:_0x4ecf7d[_0x1a14('0xa')][_0x1a14('0x6')];this[_0x1a14('0xb')]=this[_0x1a14('0xc')]?util[_0x1a14('0xd')](_0x1a14('0xe'),this[_0x1a14('0xc')]):_0x207a10||undefined;this[_0x1a14('0xf')]=checkNameSurname(_0x4ecf7d[_0x1a14('0x10')][_0x1a14('0x11')],_0x4ecf7d[_0x1a14('0x10')][_0x1a14('0x12')],_0x4ecf7d[_0x1a14('0x10')]['lastName']);this[_0x1a14('0x13')]=_0x4ecf7d[_0x1a14('0x13')]||![];this[_0x1a14('0x14')]=_0x4ecf7d[_0x1a14('0x10')][_0x1a14('0x11')];this[_0x1a14('0x15')]=_0x4ecf7d[_0x1a14('0x15')];this[_0x1a14('0x16')]=_0x4ecf7d['countbusyretry']||0x0;this[_0x1a14('0x17')]=_0x4ecf7d[_0x1a14('0x17')]||0x0;this[_0x1a14('0x18')]=_0x4ecf7d[_0x1a14('0x18')]||0x0;this[_0x1a14('0x19')]=(_0x4ecf7d[_0x1a14('0x16')]||0x0)+(_0x4ecf7d[_0x1a14('0x17')]||0x0)+(_0x4ecf7d[_0x1a14('0x18')]||0x0)+(_0x4ecf7d['countnosuchnumberretry']||0x0)+(_0x4ecf7d[_0x1a14('0x1a')]||0x0)+(_0x4ecf7d[_0x1a14('0x1b')]||0x0)+(_0x4ecf7d[_0x1a14('0x1c')]||0x0)+(_0x4ecf7d[_0x1a14('0x1d')]||0x0);this['countnosuchnumberretry']=_0x4ecf7d[_0x1a14('0x1e')]||0x0;this[_0x1a14('0x1a')]=_0x4ecf7d[_0x1a14('0x1a')]||0x0;this[_0x1a14('0x1b')]=_0x4ecf7d[_0x1a14('0x1b')]||0x0;this['countmachineretry']=_0x4ecf7d['countmachineretry']||0x0;this[_0x1a14('0x1d')]=_0x4ecf7d[_0x1a14('0x1d')]||0x0;this[_0x1a14('0x1f')]=_0x4ecf7d[_0x1a14('0x1f')];this[_0x1a14('0x20')]=_0x4ecf7d[_0x1a14('0x20')];this[_0x1a14('0x21')]=_0x4ecf7d[_0x1a14('0x21')];this[_0x1a14('0x22')]=_0x4ecf7d['recallme'];this[_0x1a14('0x23')]=_0x4ecf7d['ContactId'];this[_0x1a14('0x24')]=_0x4ecf7d[_0x1a14('0x24')];this[_0x1a14('0x25')]=_[_0x1a14('0x3')](_0x4ecf7d[_0x1a14('0xa')])?_0x4ecf7d['UserId']:_0x4ecf7d['Agent']['id'];this[_0x1a14('0x26')]=_0x4ecf7d[_0x1a14('0x26')];this[_0x1a14('0x27')]='';this[_0x1a14('0x28')]='';}Action[_0x1a14('0x29')][_0x1a14('0x2a')]=function(){return util['format'](_0x1a14('0x2b'),this[_0x1a14('0xf')],this[_0x1a14('0x2c')]);};module[_0x1a14('0x2d')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 0f2a2a9..3ded321 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 _0x0033=['connect','acw','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','outboundBusyCallsDay','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','scheduledAt','NOANSWER','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','[Blacklist][error]','active','SIP/%s','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','isValid','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdName','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','isFailure','response','unlockContact','idContact','custom:agentringnoanswer','[syncHangup][talking]','callProgressDetectingCustomer','cause','[syncHangup][talking][cause]','statedesc','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/logger','actionPreview','../ami','./rpcDb','./util/util','defaults','localhost','socket.io-emitter','redis','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','name','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','loggedInDb','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','format','voice:queue:%s','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','sendMessageOneNotActive','message','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','preview','dialMethod','booked','type','outbound','clearZombieChannels','dialActive','setMessage','recallMe','isNil','info','[clearZombieChannels][talking]','Queue','originated:\x20','queue','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','loggerError','[Dialer][checkChannel][Preview]','size','agentReadyId','then','length','getDiff','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','unlockAgent','activeContact','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20'];(function(_0x156c3b,_0x1c2e76){var _0x39750c=function(_0x368b35){while(--_0x368b35){_0x156c3b['push'](_0x156c3b['shift']());}};_0x39750c(++_0x1c2e76);}(_0x0033,0x95));var _0x3003=function(_0x37fcda,_0x2f5aa1){_0x37fcda=_0x37fcda-0x0;var _0xf5ed91=_0x0033[_0x37fcda];return _0xf5ed91;};'use strict';var util=require(_0x3003('0x0'));var _=require(_0x3003('0x1'));var BPromise=require(_0x3003('0x2'));var uuid=require(_0x3003('0x3'));var moment=require(_0x3003('0x4'));var md5=require(_0x3003('0x5'));var Redis=require(_0x3003('0x6'));var config=require('../../../config/environment');var logger=require(_0x3003('0x7'))('preview');var loggerAction=require('../../../config/logger')(_0x3003('0x8'));var ami=require(_0x3003('0x9'));var rpcDb=require(_0x3003('0xa'));var Action=require('./action');var ut=require(_0x3003('0xb'));config['redis']=_[_0x3003('0xc')](config['redis'],{'host':_0x3003('0xd'),'port':0x18eb});var io=require(_0x3003('0xe'))(new Redis(config[_0x3003('0xf')]));var Sequence=function(){};Sequence[_0x3003('0x10')][_0x3003('0x11')]=function(_0x1abce5){this[_0x3003('0x12')]=this[_0x3003('0x12')]?this[_0x3003('0x12')][_0x3003('0x13')](_0x1abce5):_0x1abce5();};function Preview(_0x1d47c7){this[_0x3003('0x14')]=new Sequence();this[_0x3003('0x15')]=_0x1d47c7[_0x3003('0x16')];this['trunks']=_0x1d47c7[_0x3003('0x17')];this[_0x3003('0x18')]={};this[_0x3003('0x19')]=_0x1d47c7['agents'];this[_0x3003('0x1a')]=0x0;ami['on'](_0x3003('0x1b'),this[_0x3003('0x1c')][_0x3003('0x1d')](this));ami['on'](_0x3003('0x1e'),this[_0x3003('0x1f')][_0x3003('0x1d')](this));ami['on'](_0x3003('0x20'),this[_0x3003('0x21')][_0x3003('0x1d')](this));ami['on'](_0x3003('0x22'),this[_0x3003('0x23')]['bind'](this));ami['on'](_0x3003('0x24'),this[_0x3003('0x25')]['bind'](this));ami['on'](_0x3003('0x26'),this[_0x3003('0x27')]['bind'](this));ami['on']('attendedtransfer',this[_0x3003('0x28')]['bind'](this));ami['on']('blindtransfer',this[_0x3003('0x29')][_0x3003('0x1d')](this));this[_0x3003('0x2a')](this[_0x3003('0x15')]);}function emit(_0x22292f,_0x2da13d,_0xa79f96){io['to'](_0x22292f)[_0x3003('0x2b')](_0x2da13d,_0xa79f96);}function emitCampaignPreview(_0xed8dbe){if(_0xed8dbe['type']==='outbound'){var _0xaf4c97={'id':_0xed8dbe['id'],'name':_0xed8dbe[_0x3003('0x2c')],'strategy':_0xed8dbe['strategy'],'answered':_0xed8dbe[_0x3003('0x2d')],'available':_0xed8dbe[_0x3003('0x2e')],'loggedIn':_0xed8dbe[_0x3003('0x2f')],'pTalking':_0xed8dbe[_0x3003('0x30')],'sumBillable':_0xed8dbe[_0x3003('0x31')],'sumDuration':_0xed8dbe[_0x3003('0x32')],'sumHoldTime':_0xed8dbe[_0x3003('0x33')]||0x0,'talking':_0xed8dbe['talking'],'total':_0xed8dbe[_0x3003('0x34')],'type':_0xed8dbe['type'],'unmanaged':_0xed8dbe[_0x3003('0x35')],'abandoned':_0xed8dbe['abandoned'],'waiting':_0xed8dbe['waiting'],'loggedInDb':_0xed8dbe[_0x3003('0x36')],'dialActive':_0xed8dbe['dialActive'],'dialMethod':_0xed8dbe['dialMethod'],'dialOriginateCallerIdName':_0xed8dbe['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0xed8dbe[_0x3003('0x37')],'dialOriginateTimeout':_0xed8dbe[_0x3003('0x38')],'dialPrefix':_0xed8dbe[_0x3003('0x39')],'outboundAnswerAgiCallsDay':_0xed8dbe[_0x3003('0x3a')],'outboundAnswerCallsDay':_0xed8dbe[_0x3003('0x3b')],'outboundBlacklistCallsDay':_0xed8dbe[_0x3003('0x3c')],'outboundBusyCallsDay':_0xed8dbe['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0xed8dbe[_0x3003('0x3d')],'outboundDropCallsDayACS':_0xed8dbe['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0xed8dbe['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0xed8dbe[_0x3003('0x3e')],'outboundNoAnswerCallsDay':_0xed8dbe[_0x3003('0x3f')],'outboundNoSuchCallsDay':_0xed8dbe[_0x3003('0x40')],'outboundOriginateFailureCallsDay':_0xed8dbe[_0x3003('0x41')],'outboundReCallsDay':_0xed8dbe[_0x3003('0x42')],'outboundRejectCallsDay':_0xed8dbe['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0xed8dbe[_0x3003('0x43')],'outboundAbandonedCallsDay':_0xed8dbe[_0x3003('0x44')],'predictiveIntervalAnsweredCalls':_0xed8dbe['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0xed8dbe[_0x3003('0x45')],'predictiveIntervalAvgTalktime':_0xed8dbe[_0x3003('0x46')],'predictiveIntervalDroppedCallsCallersExit':_0xed8dbe[_0x3003('0x47')],'predictiveIntervalDroppedCallsTimeout':_0xed8dbe[_0x3003('0x48')],'predictiveIntervalErlangCalls':_0xed8dbe[_0x3003('0x49')],'predictiveIntervalErlangCallsDroppedCalls':_0xed8dbe[_0x3003('0x4a')],'predictiveIntervalHitRate':_0xed8dbe['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0xed8dbe[_0x3003('0x4b')],'predictiveIntervalPauses':_0xed8dbe[_0x3003('0x4c')],'predictiveIntervalAvailable':_0xed8dbe[_0x3003('0x4d')],'predictiveIntervalTotalCalls':_0xed8dbe[_0x3003('0x4e')],'message':_0xed8dbe['message'],'originated':_0xed8dbe[_0x3003('0x4f')],'erlangCalls':_0xed8dbe[_0x3003('0x50')],'erlangCallToSecond':_0xed8dbe['erlangCallToSecond'],'erlangAbandonmentRate':_0xed8dbe[_0x3003('0x51')],'erlangBusyFactor':_0xed8dbe[_0x3003('0x52')],'startPredictive':_0xed8dbe[_0x3003('0x53')],'startProgressive':_0xed8dbe[_0x3003('0x54')]};if(_0xed8dbe[_0x3003('0x55')]){_0xaf4c97[_0x3003('0x55')]={'id':_0xed8dbe[_0x3003('0x55')]['id'],'name':_0xed8dbe['Trunk'][_0x3003('0x2c')],'active':_0xed8dbe['Trunk']['active'],'callerid':_0xed8dbe[_0x3003('0x55')][_0x3003('0x56')]};}if(_0xed8dbe[_0x3003('0x57')]){_0xaf4c97[_0x3003('0x57')]={'id':_0xed8dbe[_0x3003('0x57')]['id'],'name':_0xed8dbe[_0x3003('0x57')][_0x3003('0x2c')]};}var _0x1d6ce2=md5(JSON['stringify'](_0xaf4c97));if(_0xed8dbe[_0x3003('0x5')]!==_0x1d6ce2){_0xed8dbe[_0x3003('0x5')]=_0x1d6ce2;emit(util[_0x3003('0x58')](_0x3003('0x59'),_0xaf4c97[_0x3003('0x2c')]),'voice_queue:save',_0xaf4c97);}}}function emitVoiceQueueChannelRemove(_0x5e6887){logger['info'](_0x3003('0x5a'),JSON[_0x3003('0x5b')](_0x5e6887));emit(util[_0x3003('0x58')](_0x3003('0x59'),_0x5e6887[_0x3003('0x2c')]),_0x3003('0x5c'),_0x5e6887);}function notSendMessagesQueue(_0x6c6e24){if(_0x6c6e24[_0x3003('0x5d')]){if(_0x6c6e24[_0x3003('0x4f')]===0x0&&_0x6c6e24[_0x3003('0x30')]===0x0){_0x6c6e24[_0x3003('0x5d')]=![];_0x6c6e24[_0x3003('0x2e')]=0x0;_0x6c6e24['paused']=0x0;_0x6c6e24[_0x3003('0x5e')]=_0x3003('0x5f');ut[_0x3003('0x60')](_0x3003('0x61'),_0x6c6e24[_0x3003('0x2c')]+_0x3003('0x62'));}else{_0x6c6e24[_0x3003('0x5e')]=_0x3003('0x63');ut['logger'](_0x3003('0x61'),_0x6c6e24[_0x3003('0x2c')]+_0x3003('0x64'));}emitCampaignPreview(_0x6c6e24);}}Preview[_0x3003('0x10')][_0x3003('0x2a')]=function(){var _0x47743f=this;setInterval(function(){_0x47743f['syncCampaigns']();},0x7cf);};Preview[_0x3003('0x10')][_0x3003('0x65')]=function(){var _0x17a821=this[_0x3003('0x15')];this[_0x3003('0x1a')]+=0x1;for(var _0x19482d in _0x17a821){if(_0x17a821[_0x3003('0x66')](_0x19482d)&&(_0x17a821[_0x19482d]['dialMethod']===_0x3003('0x67')||_0x17a821[_0x19482d][_0x3003('0x68')]===_0x3003('0x69'))&&_0x17a821[_0x19482d][_0x3003('0x6a')]===_0x3003('0x6b')){if(this[_0x3003('0x1a')]>0x7){this[_0x3003('0x1a')]=0x0;this[_0x3003('0x6c')]();}}if(_0x17a821['hasOwnProperty'](_0x19482d)&&_0x17a821[_0x19482d]['dialMethod']===_0x3003('0x67')&&_0x17a821[_0x19482d][_0x3003('0x6a')]===_0x3003('0x6b')){if(_0x17a821[_0x19482d][_0x3003('0x6d')]){this[_0x3003('0x6e')](_0x17a821[_0x19482d]);this[_0x3003('0x6f')](_0x17a821[_0x19482d]);}else{notSendMessagesQueue(_0x17a821[_0x19482d]);}}}};Preview[_0x3003('0x10')]['clearZombieChannel']=function(_0x5db645){var _0x2f6f5d=this;this[_0x3003('0x14')][_0x3003('0x11')](function(){if(!_[_0x3003('0x70')](_0x2f6f5d[_0x3003('0x18')][_0x5db645])){loggerAction[_0x3003('0x71')](_0x3003('0x72'),_0x5db645,_0x3003('0x73'),_0x2f6f5d['actions'][_0x5db645]['queue'],_0x3003('0x74'),JSON[_0x3003('0x5b')](_0x2f6f5d[_0x3003('0x15')][_0x2f6f5d[_0x3003('0x18')][_0x5db645][_0x3003('0x75')]]['originated']),'pTalking:\x20',JSON[_0x3003('0x5b')](_0x2f6f5d[_0x3003('0x15')][_0x2f6f5d[_0x3003('0x18')][_0x5db645][_0x3003('0x75')]][_0x3003('0x30')]),JSON[_0x3003('0x5b')](_0x2f6f5d[_0x3003('0x18')][_0x5db645][_0x3003('0x76')]),JSON[_0x3003('0x5b')](_[_0x3003('0x77')](_0x2f6f5d['actions'][_0x5db645],['contactId',_0x3003('0x78'),_0x3003('0x79'),_0x3003('0x7a')])));return ami[_0x3003('0x7b')]({'action':_0x3003('0x7c'),'channel':_0x2f6f5d[_0x3003('0x18')][_0x5db645][_0x3003('0x7d')]})[_0x3003('0x7e')](function(_0x427740){if(_0x427740[_0x3003('0x5e')]===_0x3003('0x7f')){setTimeout(function(){if(_0x2f6f5d[_0x3003('0x18')][_0x5db645]){ut['updateOriginated'](_0x2f6f5d[_0x3003('0x15')][_0x2f6f5d[_0x3003('0x18')][_0x5db645]['queue']],_0x3003('0x80'));if(_0x2f6f5d['actions'][_0x5db645][_0x3003('0x76')]===!![]){ut['decrementTalkink'](_0x2f6f5d['campaignsPreview'][_0x2f6f5d[_0x3003('0x18')][_0x5db645]['queue']],'[clearZombieChannel]');ut[_0x3003('0x81')]('[Dialer][checkChannel][pTalking][Preview]'+_0x5db645,_0x2f6f5d[_0x3003('0x18')][_0x5db645][_0x3003('0x75')]);}ut[_0x3003('0x81')](_0x3003('0x82')+_0x5db645,_0x2f6f5d[_0x3003('0x18')][_0x5db645]['queue']);delete _0x2f6f5d[_0x3003('0x18')][_0x5db645];}},0x2328);}});}});};Preview[_0x3003('0x10')]['clearZombieChannels']=function(){var _0x24b6c8=this;loggerAction[_0x3003('0x71')]('[action]',_[_0x3003('0x83')](this[_0x3003('0x18')]));for(var _0x35e804 in this[_0x3003('0x18')]){if(_0x24b6c8[_0x3003('0x18')]['hasOwnProperty'](_0x35e804)){_0x24b6c8['clearZombieChannel'](_0x35e804);}}};Preview['prototype'][_0x3003('0x6f')]=function(_0x3f15bd){var _0x4ab8d4=this;rpcDb['getContactRecallMe'](_0x3f15bd['id'],ut[_0x3003('0x84')](this[_0x3003('0x19')]))[_0x3003('0x85')](function(_0x11fc98){if(!_[_0x3003('0x70')](_0x11fc98)){for(var _0x5abcf7=0x0;_0x5abcf7<_0x11fc98[_0x3003('0x86')];_0x5abcf7+=0x1){if(ut[_0x3003('0x87')](_0x11fc98[_0x5abcf7][_0x3003('0x88')])<_0x3f15bd['dialRecallMeTimeout']*0x3c){if(_0x11fc98[_0x5abcf7][_0x3003('0x89')]&&!_0x11fc98[_0x5abcf7][_0x3003('0x89')][_0x3003('0x8a')]){_0x4ab8d4[_0x3003('0x8b')](_0x11fc98[_0x5abcf7]['id'])['then'](ut[_0x3003('0x8c')](_0x3003('0x8d')))['catch'](ut['logger2'](_0x3003('0x8d')));}else{rpcDb[_0x3003('0x8e')](_0x11fc98[_0x5abcf7]['id']);}}else{var _0x4c90e2=new Action(_0x11fc98[_0x5abcf7],_0x3f15bd);_0x4c90e2[_0x3003('0x8f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3f15bd[_0x3003('0x42')]+=0x1;ut[_0x3003('0x90')](_0x4c90e2,0x17,_0x3003('0x91'));if(_0x3f15bd['dialRecallInQueue']){rpcDb[_0x3003('0x92')](ut[_0x3003('0x93')](_0x11fc98[_0x5abcf7]));rpcDb[_0x3003('0x94')](_0x4c90e2,_0x3003('0x95'));}else{ut['logCustomer'](_0x4c90e2,0x16,_0x3003('0x96'));rpcDb[_0x3003('0x94')](_0x4c90e2,_0x3003('0x97'));rpcDb[_0x3003('0x98')](_0x4c90e2,_0x3003('0x97'));}}}}})[_0x3003('0x7e')](ut[_0x3003('0x8c')](_0x3003('0x99')));};Preview[_0x3003('0x10')][_0x3003('0x6e')]=function(_0x91f1e7){_0x91f1e7['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x91f1e7[_0x3003('0x2f')])){_0x91f1e7[_0x3003('0x5e')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x3003('0x9a')](_0x91f1e7[_0x3003('0x6d')])){_0x91f1e7['message']='NOT_ACTIVE';}else if(!this[_0x3003('0x9b')](_0x91f1e7[_0x3003('0x55')])){if(!this['isTrunkReachable'](_0x91f1e7[_0x3003('0x9c')])){_0x91f1e7[_0x3003('0x5e')]=_0x3003('0x9d');}else{_0x91f1e7[_0x3003('0x5e')]=_0x3003('0x9e');}}else{_0x91f1e7[_0x3003('0x5e')]=_0x3003('0x9e');}emitCampaignPreview(_0x91f1e7);};Preview[_0x3003('0x10')]['callProgressDetectingCustomer']=function(_0x229d61,_0x4d18db,_0x17f8ff){var _0x5dfaef=this;var _0x5121fd=this['actions'][_0x4d18db];var _0xec2b83=this[_0x3003('0x15')][_0x5121fd[_0x3003('0x75')]];var _0xe3434f;if(_0xec2b83){switch(_0x17f8ff){case'1':_0xec2b83['outboundNoSuchCallsDay']+=0x1;_0x5121fd[_0x3003('0x9f')]+=0x1;_0x5121fd[_0x3003('0xa0')]=ut['totalGlobal'](_0x5121fd);ut[_0x3003('0x90')](_0x5121fd,0x0,_0x3003('0xa1'));ami[_0x3003('0x2b')](_0x3003('0xa2'),ut[_0x3003('0xa3')](_0x5121fd,_0x3003('0xa4')));rpcDb[_0x3003('0x94')](_0x5121fd,_0x3003('0xa5'));if(ut[_0x3003('0xa6')](_0x5121fd)>=_0xec2b83[_0x3003('0xa7')]){_0xe3434f=ut[_0x3003('0xa8')](_0x5121fd,0xf,_0x3003('0xa9'));rpcDb['createCustomerFinal'](_0xe3434f,_0x3003('0xaa'));}else{if(_0x5121fd[_0x3003('0x9f')]>=_0xec2b83[_0x3003('0xab')]){rpcDb[_0x3003('0x98')](_0x5121fd,_0x3003('0xaa'));}else{rpcDb[_0x3003('0xac')](ut['scheduledAt'](_0x5121fd,'countnosuchnumberretry',_0xec2b83['dialNoSuchNumberRetryFrequency']),_0x5121fd[_0x3003('0xad')],_0x5121fd[_0x3003('0xae')]);}}delete this[_0x3003('0x18')][_0x229d61[_0x3003('0xaf')]];break;case _0x3003('0xb0'):var _0x106fbd=moment()[_0x3003('0x58')](_0x3003('0xb1'));_0x5121fd[_0x3003('0xb2')]=_0x106fbd;_0x5121fd[_0x3003('0xb3')]=_0x106fbd;_0x5121fd['dialAnswer']=!![];_0xec2b83['pTalking']+=0x1;logger[_0x3003('0x71')](_0x3003('0xb4'),_0x5121fd[_0x3003('0xb5')],_0x3003('0xb6'),_0xec2b83['name'],_0x3003('0xb7'),_0xec2b83[_0x3003('0x30')]);ami[_0x3003('0x2b')]('custom:agentconnect',ut['buildObj'](_0x5121fd,_0x3003('0xb8')));if(_0xec2b83[_0x3003('0xb9')]){ami[_0x3003('0x2b')]('custom:agentConnectPreview',ut[_0x3003('0xba')](_0x5121fd));}break;case'16':ami[_0x3003('0x2b')](_0x3003('0xbb'),ut[_0x3003('0xa3')](_0x5121fd,_0x3003('0xbc')));emitVoiceQueueChannelRemove(ut[_0x3003('0xa3')](_0x5121fd,_0x3003('0xbc')));_0xec2b83['outboundAnswerCallsDay']+=0x1;_0xec2b83['total']+=0x1;_0xec2b83['answered']+=0x1;ut['decrementTalkink'](_0xec2b83,_0x3003('0xbd'));_0x5121fd[_0x3003('0xa0')]=ut[_0x3003('0xa6')](_0x5121fd);ut['logCustomer'](_0x5121fd,0x4,_0x3003('0xbe'));rpcDb[_0x3003('0x94')](_0x5121fd,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x3003('0x98')](_0x5121fd,_0x3003('0xbf'));rpcDb[_0x3003('0xc0')](_0x5121fd);_0xec2b83[_0x3003('0x32')]+=_0x5121fd[_0x3003('0xc1')];_0xec2b83[_0x3003('0x31')]+=_0x5121fd[_0x3003('0xc1')];logger[_0x3003('0x71')](_0x3003('0xc2'),_0x5121fd['uniqueid'],_0x3003('0xb6'),_0xec2b83[_0x3003('0x2c')],_0x3003('0xb7'),_0xec2b83[_0x3003('0x30')]);delete this[_0x3003('0x18')][_0x229d61['linkedid']];break;case'BUSY':_0xec2b83[_0x3003('0xc3')]+=0x1;_0x5121fd['countbusyretry']+=0x1;_0x5121fd[_0x3003('0xa0')]=ut[_0x3003('0xa6')](_0x5121fd);ut['logCustomer'](_0x5121fd,0x5,_0x3003('0xc4'));ami[_0x3003('0x2b')](_0x3003('0xc5'),ut[_0x3003('0xa3')](_0x5121fd,'busy'));rpcDb[_0x3003('0x94')](_0x5121fd,_0x3003('0xc6'));if(ut[_0x3003('0xa6')](_0x5121fd)>=_0xec2b83[_0x3003('0xa7')]){_0xe3434f=ut['cloneAction'](_0x5121fd,0xf,_0x3003('0xa9'));rpcDb[_0x3003('0x98')](_0xe3434f,_0x3003('0xc7'));}else{if(_0x5121fd[_0x3003('0xc8')]>=_0xec2b83[_0x3003('0xc9')]){rpcDb[_0x3003('0x98')](_0x5121fd,_0x3003('0xc6'));}else{rpcDb['rescheduleContact'](ut[_0x3003('0xca')](_0x5121fd,_0x3003('0xc8'),_0xec2b83['dialBusyRetryFrequency']),_0x5121fd[_0x3003('0xad')],_0x5121fd[_0x3003('0xae')]);}}break;case _0x3003('0xcb'):_0xec2b83[_0x3003('0x3f')]+=0x1;_0x5121fd['countnoanswerretry']+=0x1;_0x5121fd['countglobal']=ut[_0x3003('0xa6')](_0x5121fd);ut[_0x3003('0x90')](_0x5121fd,0x3,_0x3003('0xcc'));ami['emit'](_0x3003('0xcd'),ut[_0x3003('0xa3')](_0x5121fd,'noanswer'));rpcDb[_0x3003('0x94')](_0x5121fd,_0x3003('0xce'));if(ut[_0x3003('0xa6')](_0x5121fd)>=_0xec2b83[_0x3003('0xa7')]){_0xe3434f=ut[_0x3003('0xa8')](_0x5121fd,0xf,_0x3003('0xa9'));rpcDb['createCustomerFinal'](_0xe3434f,_0x3003('0xcf'));}else{if(_0x5121fd[_0x3003('0xd0')]>=_0xec2b83[_0x3003('0xd1')]){rpcDb[_0x3003('0x98')](_0x5121fd,_0x3003('0xce'));}else{rpcDb[_0x3003('0xac')](ut[_0x3003('0xca')](_0x5121fd,'countnoanswerretry',_0xec2b83['dialNoAnswerRetryFrequency']),_0x5121fd[_0x3003('0xad')],_0x5121fd[_0x3003('0xae')]);}}break;case _0x3003('0xd2'):_0xec2b83[_0x3003('0x3d')]+=0x1;_0x5121fd[_0x3003('0xd3')]+=0x1;_0x5121fd['countglobal']=ut['totalGlobal'](_0x5121fd);ut[_0x3003('0x90')](_0x5121fd,0x8,_0x3003('0xd4'));ami[_0x3003('0x2b')](_0x3003('0xd5'),ut[_0x3003('0xa3')](_0x5121fd,_0x3003('0xd6')));rpcDb[_0x3003('0x94')](_0x5121fd,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x3003('0xa6')](_0x5121fd)>=_0xec2b83[_0x3003('0xa7')]){_0xe3434f=ut['cloneAction'](_0x5121fd,0xf,_0x3003('0xa9'));rpcDb[_0x3003('0x98')](_0xe3434f,_0x3003('0xd7'));}else{if(_0x5121fd['countcongestionretry']>=_0xec2b83[_0x3003('0xd8')]){rpcDb[_0x3003('0x98')](_0x5121fd,_0x3003('0xd9'));}else{rpcDb[_0x3003('0xac')](ut[_0x3003('0xca')](_0x5121fd,_0x3003('0xd3'),_0xec2b83['dialBusyRetryFrequency']),_0x5121fd[_0x3003('0xad')],_0x5121fd['activeContact']);}}break;case _0x3003('0xda'):_0xec2b83[_0x3003('0xdb')]+=0x1;_0x5121fd[_0x3003('0xdc')]+=0x1;_0x5121fd[_0x3003('0xa0')]=ut[_0x3003('0xa6')](_0x5121fd);ut[_0x3003('0x90')](_0x5121fd,0x14,_0x3003('0xdd'));ami['emit'](_0x3003('0xde'),ut[_0x3003('0xa3')](_0x5121fd,_0x3003('0xdf')));rpcDb[_0x3003('0x94')](_0x5121fd,'[syncHangupRequest][logAgentReject]');if(ut[_0x3003('0xa6')](_0x5121fd)>=_0xec2b83[_0x3003('0xa7')]){_0xe3434f=ut['cloneAction'](_0x5121fd,0x14,_0x3003('0xdd'));rpcDb[_0x3003('0x98')](_0xe3434f,_0x3003('0xe0'));}else{if(_0x5121fd[_0x3003('0xdc')]>=_0xec2b83[_0x3003('0xe1')]){rpcDb['createCustomerFinal'](_0x5121fd,_0x3003('0xe0'));}else{rpcDb[_0x3003('0xac')](ut['scheduledAt'](_0x5121fd,'countagentrejectretry',_0xec2b83[_0x3003('0xe2')]),_0x5121fd[_0x3003('0xad')],_0x5121fd[_0x3003('0xae')]);}}break;case'ABANDONED':_0xec2b83[_0x3003('0x44')]+=0x1;_0x5121fd[_0x3003('0xe3')]+=0x1;_0x5121fd[_0x3003('0xa0')]=ut['totalGlobal'](_0x5121fd);ut[_0x3003('0x90')](_0x5121fd,0xb,_0x3003('0xe4'));rpcDb[_0x3003('0x94')](_0x5121fd,_0x3003('0xe5'));if(ut[_0x3003('0xa6')](_0x5121fd)>=_0xec2b83[_0x3003('0xa7')]){_0xe3434f=ut[_0x3003('0xa8')](_0x5121fd,0xf,_0x3003('0xa9'));rpcDb[_0x3003('0x98')](_0xe3434f,_0x3003('0xe5'));}else{if(_0x5121fd[_0x3003('0xe6')]>=_0xec2b83[_0x3003('0xe7')]){rpcDb['createCustomerFinal'](_0x5121fd,_0x3003('0xe5'));}else{rpcDb[_0x3003('0xac')](ut[_0x3003('0xca')](_0x5121fd,_0x3003('0xe3'),_0xec2b83[_0x3003('0xe8')]),_0x5121fd[_0x3003('0xad')],_0x5121fd[_0x3003('0xae')]);}}break;default:if(_0x5121fd['dialAnswer']){ut['decrementTalkink'](_0xec2b83,'[default]');ut[_0x3003('0x81')](_0x3003('0xe9')+_0xec2b83['name'],_0x229d61);}_0xec2b83['outboundUnknownCallsDay']+=0x1;_0x5121fd[_0x3003('0xa0')]=ut['totalGlobal'](_0x5121fd);ut[_0x3003('0x90')](_0x5121fd,0xc,_0x229d61[_0x3003('0xea')]||_0x229d61[_0x3003('0xeb')]);rpcDb[_0x3003('0x94')](_0x5121fd,_0x3003('0xec'));if(ut[_0x3003('0xa6')](_0x5121fd)>=_0xec2b83[_0x3003('0xa7')]){_0xe3434f=ut[_0x3003('0xa8')](_0x5121fd,0xf,_0x3003('0xa9'));rpcDb['createCustomerFinal'](_0xe3434f,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x3003('0x98')](_0x5121fd,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x229d61['linkedid']];}if(!(_0x5121fd[_0x3003('0x76')]&&_0x17f8ff==='16')){ut[_0x3003('0xed')](_0xec2b83,'[callProgressDetectingCustomer]');logger[_0x3003('0x71')](_0x3003('0xee'),_0x5121fd[_0x3003('0xb5')],'\x20Queue',_0xec2b83[_0x3003('0x2c')],_0x3003('0x74'),_0xec2b83[_0x3003('0x4f')]);}if(_0x17f8ff!=='ANSWER'){delete this['actions'][_0x229d61['linkedid']];delete this[_0x3003('0x18')][_0x229d61[_0x3003('0xef')]];}}};Preview[_0x3003('0x10')][_0x3003('0xf0')]=function(_0x486e00,_0xb94139,_0x5efe16){if(_['isUndefined'](_0xb94139)&&'object'!==typeof _0xb94139){return;}if(_[_0x3003('0xf1')](_0x5efe16)&&_0x3003('0xf2')!==typeof _0x5efe16){return;}switch(_0x5efe16[_0x3003('0xf3')]){case'0':ut[_0x3003('0xf4')](_0x486e00,0x0,_0x3003('0xa1'));rpcDb['createAgentHistory'](_0x486e00,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x3003('0xf4')](_0x486e00,0x3,_0x3003('0xcc'));rpcDb[_0x3003('0xf5')](_0x486e00,_0x3003('0xf6'));break;case'5':ut['logAgent'](_0x486e00,0x5,_0x3003('0xc4'));rpcDb[_0x3003('0xf5')](_0x486e00,_0x3003('0xf7'));break;case'8':ut[_0x3003('0xf4')](_0x486e00,0x8,_0x3003('0xd4'));rpcDb[_0x3003('0xf5')](_0x486e00,_0x3003('0xf8'));break;case'22':ut[_0x3003('0xf4')](_0x486e00,0x16,_0x3003('0xf9'));rpcDb['createAgentHistory'](_0x486e00,_0x3003('0xfa'));break;default:ut[_0x3003('0xf4')](_0x486e00,0xc,_0x5efe16[_0x3003('0xf3')]);rpcDb['createAgentHistory'](_0x486e00,_0x3003('0xf8'));}ut[_0x3003('0xed')](_0xb94139,_0x3003('0xfb'));logger[_0x3003('0x71')](_0x3003('0xfc'),_0x486e00[_0x3003('0xb5')],_0x3003('0xb6'),_0xb94139[_0x3003('0x2c')],_0x3003('0x74'),_0xb94139[_0x3003('0x4f')]);delete this[_0x3003('0x18')][_0x486e00[_0x3003('0xb5')]];};Preview[_0x3003('0x10')]['checkInBlack']=function(_0x1377c7,_0x45f15e,_0x2d5a83,_0x3e81cc,_0x36bb45){var _0x350f18=this;return new BPromise(function(_0x50fd66,_0x2e7b65){if(_['isNil'](_0x45f15e)||_[_0x3003('0x70')](_0x45f15e['Contact'])||_[_0x3003('0x70')](_0x45f15e[_0x3003('0xfd')][_0x3003('0xfe')])||_[_0x3003('0x70')](_0x45f15e[_0x3003('0x79')])){_0x2e7b65(ut['message'](_0x3003('0xff'),_0x3e81cc,_0x36bb45));return;}var _0x1e0893=uuid['v4']();var _0x3002bb=_0x350f18[_0x3003('0x15')][_0x45f15e[_0x3003('0x73')][_0x3003('0x2c')]];var _0x1bc42e=_0x2d5a83?_0x350f18[_0x3003('0x19')][_0x2d5a83]['id']:undefined;_0x350f18[_0x3003('0x18')][_0x1e0893]=new Action(_0x45f15e,_0x3002bb,_0x1e0893,_0x2d5a83,_0x1bc42e);var _0x471d94=_0x350f18[_0x3003('0x18')][_0x1e0893];_0x471d94[_0x3003('0xad')]=_0x3e81cc;_0x471d94[_0x3003('0xae')]=_0x36bb45;_0x471d94[_0x3003('0x100')]=_0x2d5a83;if(_[_0x3003('0x101')](_0x1377c7)){_0x350f18[_0x3003('0x102')](_0x471d94,_0x3002bb,_0x45f15e,_0x2d5a83)[_0x3003('0x85')](function(_0x2de0ba){logger[_0x3003('0x71')](_0x3003('0x103'),'Queue:\x20'+_0x471d94[_0x3003('0x75')]+_0x3003('0x104')+_0x471d94['idContact'],JSON[_0x3003('0x5b')](_0x2de0ba));ami[_0x3003('0x2b')](_0x3003('0x105'),ut[_0x3003('0xa3')](_0x471d94,_0x3003('0x106')));_0x50fd66(ut['message'](_0x3003('0x107')));})[_0x3003('0x7e')](function(_0x4e7e91){ut['logger'](_0x3003('0x108'),_0x4e7e91);_0x2e7b65(ut[_0x3003('0x5e')]('Call\x20failed',_0x3e81cc,_0x36bb45));});}else{_0x3002bb[_0x3003('0x3c')]+=0x1;ut['logBlacklist'](_0x471d94);rpcDb['createHistory'](_0x471d94,_0x3003('0x109'));delete _0x350f18[_0x3003('0x18')][_0x1e0893];_0x2e7b65(ut[_0x3003('0x5e')]('Contact\x20in\x20black\x20List',_0x3e81cc,_0x36bb45));}});};Preview[_0x3003('0x10')]['isTrunkReachable']=function(_0x521f24){return!_[_0x3003('0x70')](_0x521f24)&&!_['isNil'](_0x521f24[_0x3003('0x2c')])&&!_[_0x3003('0x70')](_0x521f24[_0x3003('0x10a')])&&_0x521f24[_0x3003('0x10a')]&&!_['isNil'](this[_0x3003('0x17')][util[_0x3003('0x58')](_0x3003('0x10b'),_0x521f24[_0x3003('0x2c')])])&&!_['isNil'](this[_0x3003('0x17')][util[_0x3003('0x58')](_0x3003('0x10b'),_0x521f24[_0x3003('0x2c')])][_0x3003('0x7c')])&&(this[_0x3003('0x17')][util[_0x3003('0x58')](_0x3003('0x10b'),_0x521f24[_0x3003('0x2c')])]['status']===_0x3003('0x10c')||this[_0x3003('0x17')][util[_0x3003('0x58')]('SIP/%s',_0x521f24[_0x3003('0x2c')])][_0x3003('0x7c')]===_0x3003('0x10d'));};Preview['prototype'][_0x3003('0x8b')]=function(_0x5dccfc,_0x39827d){var _0x3e3466=this;return new BPromise(function(_0xa780f9,_0x43fb06){_0x3e3466[_0x3003('0x10e')](_0x5dccfc,_0x39827d)[_0x3003('0x85')](function(_0x77d57b){_0xa780f9(_['pick'](_0x77d57b,[_0x3003('0x5e')]));})[_0x3003('0x7e')](function(_0x220cd5){if(_0x220cd5[_0x3003('0x10f')]){rpcDb['unlockContact'](_0x5dccfc);}if(_0x220cd5[_0x3003('0x10a')]){rpcDb['disableContact'](_0x5dccfc);}_0x43fb06(_[_0x3003('0x77')](_0x220cd5,['message']));});});};Preview['prototype'][_0x3003('0x10e')]=function(_0x12f035,_0x31a894){var _0x2f5b0e=this;return new BPromise(function(_0x4554ad,_0x28cb09){var _0x314eed,_0x17da0e;rpcDb[_0x3003('0x110')](_0x12f035)[_0x3003('0x85')](function(_0x533feb){if(!_['isNil'](_0x533feb[0x0])){_0x17da0e=_0x533feb[0x0][_0x3003('0x111')]?![]:!![];_0x314eed=_0x533feb[0x0][_0x3003('0x111')]?!![]:![];_0x314eed=_0x31a894?!![]:_0x314eed;}var _0x3bdf9c=_0x2f5b0e['validateContact'](_0x533feb);if(_0x3bdf9c[_0x3003('0x112')]){rpcDb['checkIsBlackList'](_[_0x3003('0x77')](_0x533feb[0x0],[_0x3003('0x79'),'Contact.phone']))['then'](function(_0xd27a3){_0x2f5b0e[_0x3003('0x113')](_0xd27a3,_0x533feb[0x0],_0x31a894,_0x17da0e,_0x314eed)['then'](function(_0x43d067){_0x4554ad(_0x43d067);})['catch'](function(_0x474c8c){_0x28cb09(_0x474c8c);});})[_0x3003('0x7e')](function(_0x8c9592){ut[_0x3003('0x60')](_0x3003('0x114'),_0x8c9592);_0x28cb09(ut[_0x3003('0x5e')](_0x3003('0x115'),_0x17da0e,_0x314eed));});}else{_0x28cb09(ut['message'](_0x3bdf9c[_0x3003('0x5e')],_0x17da0e,_0x314eed));}})[_0x3003('0x7e')](function(_0x19df5d){ut[_0x3003('0x60')](_0x3003('0x116'),_0x19df5d);_0x28cb09(ut[_0x3003('0x5e')](_0x3003('0x115'),![],!![]));});});};Preview[_0x3003('0x10')]['validateContact']=function(_0x1269f1){if(_[_0x3003('0x70')](_0x1269f1)||_[_0x3003('0x101')](_0x1269f1)||!_[_0x3003('0x70')](_0x1269f1[0x0][_0x3003('0x89')])&&_['isNil'](_0x1269f1[0x0][_0x3003('0x89')][_0x3003('0x2c')])){ut['logger'](_0x3003('0x117'),_0x1269f1);return{'isValid':![],'message':_0x3003('0x118')};}var _0x5d156b=this[_0x3003('0x15')][_0x1269f1[0x0][_0x3003('0x73')][_0x3003('0x2c')]];_0x5d156b[_0x3003('0x5e')]=_0x3003('0x9e');if(_['isNil'](_0x5d156b)){ut[_0x3003('0x60')](_0x3003('0x119'),_0x5d156b);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x5d156b[_0x3003('0x55')])){ut[_0x3003('0x60')](_0x3003('0x11a'),_0x3003('0x11b')+_0x5d156b[_0x3003('0x2c')]+_0x3003('0x11c'));if(!this[_0x3003('0x9b')](_0x5d156b[_0x3003('0x9c')])){ut[_0x3003('0x60')](_0x3003('0x11a'),_0x5d156b[_0x3003('0x2c')]+_0x3003('0x11d'));return{'isValid':![],'message':_0x3003('0x11e')};}}if(!ut['isActive'](_0x5d156b[_0x3003('0x6d')])){ut[_0x3003('0x60')]('[Preview][validateContact][Campaign\x20Active]',_0x5d156b['name']+_0x3003('0x11f'));return{'isValid':![],'message':_0x3003('0x11b')+_0x5d156b[_0x3003('0x2c')]+_0x3003('0x11f')};}return{'isValid':!![],'message':_0x3003('0x120')};};Preview[_0x3003('0x10')]['execCall']=function(_0x13856f,_0xa8a862,_0x47406d,_0x41dd82){var _0x1274e7=this;return new BPromise(function(_0x11d764,_0x49a383){var _0x566af2=_0x13856f['uniqueid'];var _0x2043e6=_0x1274e7[_0x3003('0x9b')](_0xa8a862['Trunk'])?util[_0x3003('0x58')](_0x3003('0x121'),_0xa8a862[_0x3003('0x55')]['name'],_['isNil'](_0xa8a862[_0x3003('0x39')])?'':_0xa8a862[_0x3003('0x39')][_0x3003('0x122')]()||'',_0xa8a862[_0x3003('0x123')]>0x0?_0x47406d['Contact']['phone']['substring'](_0xa8a862[_0x3003('0x123')]):_0x47406d['Contact'][_0x3003('0xfe')]):util[_0x3003('0x58')](_0x3003('0x121'),_[_0x3003('0x70')](_0xa8a862[_0x3003('0x9c')])?_0xa8a862['Trunk'][_0x3003('0x2c')]:_0xa8a862[_0x3003('0x9c')][_0x3003('0x2c')],_[_0x3003('0x70')](_0xa8a862['dialPrefix'])?'':_0xa8a862[_0x3003('0x39')][_0x3003('0x122')]()||'',_0xa8a862[_0x3003('0x123')]>0x0?_0x47406d['Contact'][_0x3003('0xfe')]['substring'](_0xa8a862[_0x3003('0x123')]):_0x47406d[_0x3003('0xfd')][_0x3003('0xfe')]);var _0x22d4cb=_0x1274e7[_0x3003('0x9b')](_0xa8a862['Trunk'])?ut['getCallerId'](_0xa8a862[_0x3003('0x55')][_0x3003('0x56')],_0xa8a862['dialOriginateCallerIdName'],_0xa8a862[_0x3003('0x124')]>0x0?ut['getCallerIdRandom'](_0xa8a862[_0x3003('0x37')],_0xa8a862[_0x3003('0x124')]):_0xa8a862['dialOriginateCallerIdNumber']):ut['getCallerId'](_[_0x3003('0x70')](_0xa8a862[_0x3003('0x9c')])?_0xa8a862[_0x3003('0x55')][_0x3003('0x56')]:_0xa8a862[_0x3003('0x9c')]['callerid'],_0xa8a862[_0x3003('0x125')],_0xa8a862['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x3003('0x126')](_0xa8a862['dialOriginateCallerIdNumber'],_0xa8a862[_0x3003('0x124')]):_0xa8a862[_0x3003('0x37')]);if(_0x22d4cb){_0x13856f[_0x3003('0x127')]=ut[_0x3003('0x128')](_0x22d4cb);_0x13856f[_0x3003('0x129')]=ut[_0x3003('0x12a')](_0x22d4cb);}var _0x49b9dd=ut[_0x3003('0x12b')](_0xa8a862,_0x47406d,_0x2043e6,_0x22d4cb,_0x566af2,_0x13856f);_[_0x3003('0x12c')](_0x13856f,ut[_0x3003('0x12d')](_0x49b9dd));_0x13856f[_0x3003('0x8f')]=moment()[_0x3003('0x58')](_0x3003('0xb1'));ami[_0x3003('0x7b')](ut[_0x3003('0x12e')](_0x13856f,_0xa8a862,_0x49b9dd,_0x13856f['activeContact'],_0x41dd82))[_0x3003('0x85')](function(_0x78978f){_0xa8a862[_0x3003('0x4f')]+=0x1;logger[_0x3003('0x71')]('[originated][increment]',_0x566af2,_0x3003('0xb6'),_0xa8a862['name'],_0x3003('0x74'),_0xa8a862[_0x3003('0x4f')]);_0x11d764(_0x78978f);})[_0x3003('0x7e')](function(_0x357edb){ut[_0x3003('0xf4')](_0x13856f,0xe,_0x3003('0x12f'));rpcDb[_0x3003('0xf5')](_0x13856f,_0x3003('0x130'));_0x49a383(_0x357edb);});});};Preview['prototype'][_0x3003('0x25')]=function(_0x51d0d3){if(this[_0x3003('0x18')][_0x51d0d3[_0x3003('0xaf')]]){this[_0x3003('0x18')][_0x51d0d3[_0x3003('0xaf')]]['channel']=_0x51d0d3[_0x3003('0x7d')];}};Preview[_0x3003('0x10')][_0x3003('0x1c')]=function(_0x35a89b){var _0x1c50c1=this;var _0x1ed89c=this['actions'][_0x35a89b[_0x3003('0x131')]];if(_0x1ed89c){if(_0x1ed89c['lookAgent']&&this['agents'][_0x1ed89c[_0x3003('0x100')]]){ut[_0x3003('0x132')](_0x1ed89c,this[_0x3003('0x19')][_0x1ed89c[_0x3003('0x100')]][_0x3003('0x2c')],this['agents'][_0x1ed89c['lookAgent']]['id']);}var _0x588b79=_['clone'](_0x1ed89c);_0x588b79[_0x3003('0xb2')]=moment()[_0x3003('0x58')](_0x3003('0xb1'));var _0xbebc98=_0x1c50c1[_0x3003('0x15')][_0x1ed89c[_0x3003('0x75')]];if(ut[_0x3003('0x133')](_0x35a89b[_0x3003('0x134')])){if(_0x1ed89c['unlockAgent']){rpcDb[_0x3003('0x135')](_0x1ed89c[_0x3003('0x136')]);}if(_0x1ed89c[_0x3003('0xae')]){rpcDb[_0x3003('0x8e')](_0x1ed89c[_0x3003('0x136')]);}ami[_0x3003('0x2b')](_0x3003('0x137'),ut[_0x3003('0xa3')](_0x1ed89c,'rejected'));this[_0x3003('0xf0')](_0x588b79,_0xbebc98,_0x35a89b);}else{_0x1ed89c[_0x3003('0x8f')]=moment()[_0x3003('0x58')](_0x3003('0xb1'));ut[_0x3003('0xf4')](_0x588b79,0x4,_0x3003('0xbe'));rpcDb['createAgentHistory'](_0x588b79,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x3003('0x10')]['syncHangup']=function(_0x5d3181){var _0x5a9ee4=this;var _0x34a1b8=this[_0x3003('0x18')][_0x5d3181[_0x3003('0xaf')]];var _0x92d128;if(_0x34a1b8){_0x92d128=this[_0x3003('0x15')][_0x34a1b8[_0x3003('0x75')]];logger['info'](_0x3003('0x138'),_0x5d3181[_0x3003('0xaf')],'\x20Queue',_0x92d128[_0x3003('0x2c')],_0x3003('0xb7'),_0x92d128[_0x3003('0x30')]);}if(this['actions'][_0x5d3181[_0x3003('0xaf')]]&&_0x5d3181[_0x3003('0xaf')]!==_0x5d3181[_0x3003('0xb5')]){if(_0x5d3181['cause']==='16'&&this[_0x3003('0x18')][_0x5d3181['linkedid']][_0x3003('0x76')]){this[_0x3003('0x139')](_0x5d3181,_0x5d3181[_0x3003('0xaf')],_0x5d3181[_0x3003('0x13a')]);}else if(this[_0x3003('0x18')][_0x5d3181['linkedid']][_0x3003('0x76')]){logger['info'](_0x3003('0x13b'),_0x5d3181[_0x3003('0xaf')],_0x5d3181[_0x3003('0x13a')],_0x3003('0xb6'),_0x92d128[_0x3003('0x2c')],_0x3003('0xb7'),_0x92d128['pTalking']);this[_0x3003('0x139')](_0x5d3181,_0x5d3181[_0x3003('0xaf')],_0x5d3181[_0x3003('0x13a')]);}}else if(_0x34a1b8&&_[_0x3003('0x70')](_0x34a1b8[_0x3003('0x13c')])&&_0x92d128['dialQueueProject']&&_0x5d3181[_0x3003('0xaf')]===_0x5d3181['uniqueid']&&_['isNil'](_0x5d3181[_0x3003('0xf3')])&&_0x5d3181[_0x3003('0x13a')]==='16'&&_0x5d3181[_0x3003('0x13d')]==='6'&&_[_0x3003('0xf1')](_0x34a1b8[_0x3003('0x13e')])){if(_0x34a1b8['unlockAgent']){rpcDb[_0x3003('0x135')](_0x34a1b8[_0x3003('0x136')]);}if(_0x34a1b8[_0x3003('0xae')]){rpcDb[_0x3003('0x8e')](_0x34a1b8['idContact']);}_0x5d3181['reason']='22';this[_0x3003('0xf0')](_0x34a1b8,_0x92d128,_0x5d3181);}else if(_0x34a1b8&&_0x34a1b8[_0x3003('0x13e')]){if(_0x5d3181[_0x3003('0x13a')]==='16'&&this[_0x3003('0x18')][_0x5d3181['linkedid']][_0x3003('0x76')]){logger[_0x3003('0x71')](_0x3003('0x13f'),_0x5d3181['linkedid'],_0x5d3181[_0x3003('0x13a')],_0x3003('0xb6'),_0x92d128[_0x3003('0x2c')],_0x3003('0xb7'),_0x92d128['pTalking']);this[_0x3003('0x139')](_0x5d3181,_0x5d3181['linkedid'],_0x5d3181[_0x3003('0x13a')]);}else if(this[_0x3003('0x18')][_0x5d3181['linkedid']][_0x3003('0x76')]){logger[_0x3003('0x71')](_0x3003('0x13b'),_0x5d3181[_0x3003('0xaf')],_0x5d3181[_0x3003('0x13a')],_0x3003('0xb6'),_0x92d128['name'],_0x3003('0xb7'),_0x92d128[_0x3003('0x30')]);this['callProgressDetectingCustomer'](_0x5d3181,_0x5d3181['linkedid'],_0x5d3181[_0x3003('0x13a')]);}}};Preview['prototype'][_0x3003('0x23')]=function(_0xf5c4a1){if(this[_0x3003('0x18')][_0xf5c4a1[_0x3003('0xef')]]&&_0xf5c4a1['destlinkedid']!==_0xf5c4a1[_0x3003('0x140')]){this[_0x3003('0x139')](_0xf5c4a1,_0xf5c4a1[_0x3003('0xef')],_0xf5c4a1['dialstatus']);}};Preview['prototype'][_0x3003('0x21')]=function(_0x1a0cf0){if(this[_0x3003('0x18')][_0x1a0cf0[_0x3003('0xaf')]]&&_0x1a0cf0['linkedid']!==_0x1a0cf0[_0x3003('0xb5')]&&!this[_0x3003('0x18')][_0x1a0cf0['linkedid']][_0x3003('0x76')]){if(_0x1a0cf0['cause']==='1'){this['callProgressDetectingCustomer'](_0x1a0cf0,_0x1a0cf0[_0x3003('0xaf')],_0x1a0cf0['cause']);}}};Preview[_0x3003('0x10')][_0x3003('0x141')]=function(_0xf56f45,_0x3a6ba6,_0xa2ee55){if(this[_0x3003('0x18')][_0xf56f45]){if(_['isNil'](this['actions'][_0xf56f45]['variables'])){this[_0x3003('0x18')][_0xf56f45][_0x3003('0x142')]={};}this[_0x3003('0x18')][_0xf56f45][_0x3003('0x142')][_0x3a6ba6]=_0xa2ee55;}};Preview[_0x3003('0x10')][_0x3003('0x27')]=function(_0x4c63d3){try{if(!_[_0x3003('0x70')](_0x4c63d3)){if(ut[_0x3003('0x143')](_[_0x3003('0x144')](_0x4c63d3[_0x3003('0x145')])[0x0])){this[_0x3003('0x141')](_0x4c63d3[_0x3003('0xb5')],_[_0x3003('0x144')](_0x4c63d3[_0x3003('0x145')])[0x0],_0x4c63d3[_0x3003('0x146')]);}}}catch(_0x3413af){logger[_0x3003('0x147')](_0x3003('0x148'),util[_0x3003('0x149')](_0x3413af,{'showHidden':![],'depth':null}));}};Preview[_0x3003('0x10')]['syncAttendedTransfer']=function(_0x3c9777){if(_0x3c9777){if(this[_0x3003('0x18')][_0x3c9777[_0x3003('0x14a')]]){this['actions'][_0x3c9777['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0x3003('0x10')]['syncBlindTransfer']=function(_0x1bcf65){if(_0x1bcf65){if(this[_0x3003('0x18')][_0x1bcf65[_0x3003('0x14b')]]){this[_0x3003('0x18')][_0x1bcf65[_0x3003('0x14b')]][_0x3003('0x13e')]=!![];}}};module[_0x3003('0x14c')]=Preview; \ No newline at end of file +var _0xba4b=['cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','linkedid','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','reason','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','Queue','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','idContact','custom:agentcalled','[Preview][execCall][failure]','Call\x20failed','createHistory','[Blacklist][error]','SIP/%s','reachable','unlock','unlockContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','substring','dialCutDigit','TrunkBackup','trim','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','merge','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','lookAgent','clone','responsetime','isFailure','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','filterKey','keys','variable','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','lodash','bluebird','uuid','moment','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','redis','localhost','enqueue','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','hangup','syncHangup','hanguprequest','syncHangupRequest','bind','dialend','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','campaignsPreview','emit','type','outbound','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','name','active','Interval','stringify','md5','voice:queue:%s','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice_queue_channel:remove','sendMessageOneNotActive','paused','message','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','prototype','loopCampaigns','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','recallMe','clearZombieChannel','info','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','getContactRecallMe','agentReadyId','then','isNil','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','catch','logger2','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','[syncHangup][talking][increment]','uniqueid','\x20Queue','connect','custom:agentConnectPreview','buildAcw','complete','outboundAnswerCallsDay','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','sumBillable','BUSY','countbusyretry','Busy','busy','[callProgressDetectingCustomer][logBusy]','NOANSWER','NoAnswer','noanswer','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialBusyRetryFrequency','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','[Dialer][decrementTalkink][no\x20Hangup][Preview]'];(function(_0x404991,_0x2729b3){var _0x379bbb=function(_0x3a4310){while(--_0x3a4310){_0x404991['push'](_0x404991['shift']());}};_0x379bbb(++_0x2729b3);}(_0xba4b,0x1af));var _0xbba4=function(_0x5783e5,_0x480b90){_0x5783e5=_0x5783e5-0x0;var _0x3021e4=_0xba4b[_0x5783e5];return _0x3021e4;};'use strict';var util=require('util');var _=require(_0xbba4('0x0'));var BPromise=require(_0xbba4('0x1'));var uuid=require(_0xbba4('0x2'));var moment=require(_0xbba4('0x3'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xbba4('0x4'));var logger=require('../../../config/logger')(_0xbba4('0x5'));var loggerAction=require(_0xbba4('0x6'))(_0xbba4('0x7'));var ami=require(_0xbba4('0x8'));var rpcDb=require(_0xbba4('0x9'));var Action=require(_0xbba4('0xa'));var ut=require(_0xbba4('0xb'));config[_0xbba4('0xc')]=_['defaults'](config['redis'],{'host':_0xbba4('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbba4('0xc')]));var Sequence=function(){};Sequence['prototype'][_0xbba4('0xe')]=function(_0xb97e13){this['tail']=this[_0xbba4('0xf')]?this[_0xbba4('0xf')][_0xbba4('0x10')](_0xb97e13):_0xb97e13();};function Preview(_0x4a859f){this[_0xbba4('0x11')]=new Sequence();this['campaignsPreview']=_0x4a859f[_0xbba4('0x12')];this[_0xbba4('0x13')]=_0x4a859f['trunks'];this[_0xbba4('0x14')]={};this[_0xbba4('0x15')]=_0x4a859f[_0xbba4('0x15')];this[_0xbba4('0x16')]=0x0;ami['on'](_0xbba4('0x17'),this['syncOriginateResponse']['bind'](this));ami['on'](_0xbba4('0x18'),this[_0xbba4('0x19')]['bind'](this));ami['on'](_0xbba4('0x1a'),this[_0xbba4('0x1b')][_0xbba4('0x1c')](this));ami['on'](_0xbba4('0x1d'),this[_0xbba4('0x1e')][_0xbba4('0x1c')](this));ami['on']('newexten',this[_0xbba4('0x1f')][_0xbba4('0x1c')](this));ami['on'](_0xbba4('0x20'),this[_0xbba4('0x21')][_0xbba4('0x1c')](this));ami['on'](_0xbba4('0x22'),this[_0xbba4('0x23')][_0xbba4('0x1c')](this));ami['on'](_0xbba4('0x24'),this[_0xbba4('0x25')]['bind'](this));this['loopCampaigns'](this[_0xbba4('0x26')]);}function emit(_0x3bc54b,_0x423417,_0x1db993){io['to'](_0x3bc54b)[_0xbba4('0x27')](_0x423417,_0x1db993);}function emitCampaignPreview(_0x3243a7){if(_0x3243a7[_0xbba4('0x28')]===_0xbba4('0x29')){var _0xb3a1d9={'id':_0x3243a7['id'],'name':_0x3243a7['name'],'strategy':_0x3243a7['strategy'],'answered':_0x3243a7[_0xbba4('0x2a')],'available':_0x3243a7[_0xbba4('0x2b')],'loggedIn':_0x3243a7[_0xbba4('0x2c')],'pTalking':_0x3243a7[_0xbba4('0x2d')],'sumBillable':_0x3243a7['sumBillable'],'sumDuration':_0x3243a7[_0xbba4('0x2e')],'sumHoldTime':_0x3243a7[_0xbba4('0x2f')]||0x0,'talking':_0x3243a7['talking'],'total':_0x3243a7[_0xbba4('0x30')],'type':_0x3243a7[_0xbba4('0x28')],'unmanaged':_0x3243a7[_0xbba4('0x31')],'abandoned':_0x3243a7[_0xbba4('0x32')],'waiting':_0x3243a7[_0xbba4('0x33')],'loggedInDb':_0x3243a7[_0xbba4('0x34')],'dialActive':_0x3243a7[_0xbba4('0x35')],'dialMethod':_0x3243a7[_0xbba4('0x36')],'dialOriginateCallerIdName':_0x3243a7[_0xbba4('0x37')],'dialOriginateCallerIdNumber':_0x3243a7[_0xbba4('0x38')],'dialOriginateTimeout':_0x3243a7[_0xbba4('0x39')],'dialPrefix':_0x3243a7[_0xbba4('0x3a')],'outboundAnswerAgiCallsDay':_0x3243a7[_0xbba4('0x3b')],'outboundAnswerCallsDay':_0x3243a7['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x3243a7[_0xbba4('0x3c')],'outboundBusyCallsDay':_0x3243a7[_0xbba4('0x3d')],'outboundCongestionCallsDay':_0x3243a7[_0xbba4('0x3e')],'outboundDropCallsDayACS':_0x3243a7[_0xbba4('0x3f')],'outboundDropCallsDayCallersExit':_0x3243a7[_0xbba4('0x40')],'outboundDropCallsDayTimeout':_0x3243a7[_0xbba4('0x41')],'outboundNoAnswerCallsDay':_0x3243a7[_0xbba4('0x42')],'outboundNoSuchCallsDay':_0x3243a7['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x3243a7[_0xbba4('0x43')],'outboundReCallsDay':_0x3243a7[_0xbba4('0x44')],'outboundRejectCallsDay':_0x3243a7[_0xbba4('0x45')],'outboundUnknownCallsDay':_0x3243a7[_0xbba4('0x46')],'outboundAbandonedCallsDay':_0x3243a7['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x3243a7['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x3243a7['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x3243a7[_0xbba4('0x47')],'predictiveIntervalDroppedCallsCallersExit':_0x3243a7[_0xbba4('0x48')],'predictiveIntervalDroppedCallsTimeout':_0x3243a7[_0xbba4('0x49')],'predictiveIntervalErlangCalls':_0x3243a7[_0xbba4('0x4a')],'predictiveIntervalErlangCallsDroppedCalls':_0x3243a7[_0xbba4('0x4b')],'predictiveIntervalHitRate':_0x3243a7[_0xbba4('0x4c')],'predictiveIntervalMultiplicativeFactor':_0x3243a7[_0xbba4('0x4d')],'predictiveIntervalPauses':_0x3243a7[_0xbba4('0x4e')],'predictiveIntervalAvailable':_0x3243a7[_0xbba4('0x4f')],'predictiveIntervalTotalCalls':_0x3243a7[_0xbba4('0x50')],'message':_0x3243a7['message'],'originated':_0x3243a7[_0xbba4('0x51')],'erlangCalls':_0x3243a7[_0xbba4('0x52')],'erlangCallToSecond':_0x3243a7[_0xbba4('0x53')],'erlangAbandonmentRate':_0x3243a7[_0xbba4('0x54')],'erlangBusyFactor':_0x3243a7[_0xbba4('0x55')],'startPredictive':_0x3243a7[_0xbba4('0x56')],'startProgressive':_0x3243a7['startProgressive']};if(_0x3243a7[_0xbba4('0x57')]){_0xb3a1d9[_0xbba4('0x57')]={'id':_0x3243a7['Trunk']['id'],'name':_0x3243a7[_0xbba4('0x57')][_0xbba4('0x58')],'active':_0x3243a7['Trunk'][_0xbba4('0x59')],'callerid':_0x3243a7[_0xbba4('0x57')]['callerid']};}if(_0x3243a7[_0xbba4('0x5a')]){_0xb3a1d9['Interval']={'id':_0x3243a7[_0xbba4('0x5a')]['id'],'name':_0x3243a7[_0xbba4('0x5a')][_0xbba4('0x58')]};}var _0x211b5e=md5(JSON[_0xbba4('0x5b')](_0xb3a1d9));if(_0x3243a7[_0xbba4('0x5c')]!==_0x211b5e){_0x3243a7[_0xbba4('0x5c')]=_0x211b5e;emit(util['format'](_0xbba4('0x5d'),_0xb3a1d9[_0xbba4('0x58')]),_0xbba4('0x5e'),_0xb3a1d9);}}}function emitVoiceQueueChannelRemove(_0x4537c8){logger['info'](_0xbba4('0x5f'),JSON[_0xbba4('0x5b')](_0x4537c8));emit(util[_0xbba4('0x60')](_0xbba4('0x5d'),_0x4537c8[_0xbba4('0x58')]),_0xbba4('0x61'),_0x4537c8);}function notSendMessagesQueue(_0x36b159){if(_0x36b159[_0xbba4('0x62')]){if(_0x36b159[_0xbba4('0x51')]===0x0&&_0x36b159['pTalking']===0x0){_0x36b159[_0xbba4('0x62')]=![];_0x36b159[_0xbba4('0x2b')]=0x0;_0x36b159[_0xbba4('0x63')]=0x0;_0x36b159[_0xbba4('0x64')]=_0xbba4('0x65');ut[_0xbba4('0x66')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x36b159[_0xbba4('0x58')]+_0xbba4('0x67'));}else{_0x36b159['message']=_0xbba4('0x68');ut[_0xbba4('0x66')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x36b159[_0xbba4('0x58')]+_0xbba4('0x69'));}emitCampaignPreview(_0x36b159);}}Preview[_0xbba4('0x6a')][_0xbba4('0x6b')]=function(){var _0x1ed9cc=this;setInterval(function(){_0x1ed9cc[_0xbba4('0x6c')]();},0x7cf);};Preview[_0xbba4('0x6a')][_0xbba4('0x6c')]=function(){var _0x558620=this[_0xbba4('0x26')];this['clockClearZombieChannels']+=0x1;for(var _0x30717d in _0x558620){if(_0x558620[_0xbba4('0x6d')](_0x30717d)&&(_0x558620[_0x30717d][_0xbba4('0x36')]===_0xbba4('0x5')||_0x558620[_0x30717d][_0xbba4('0x36')]===_0xbba4('0x6e'))&&_0x558620[_0x30717d]['type']===_0xbba4('0x29')){if(this[_0xbba4('0x16')]>0x7){this[_0xbba4('0x16')]=0x0;this[_0xbba4('0x6f')]();}}if(_0x558620[_0xbba4('0x6d')](_0x30717d)&&_0x558620[_0x30717d][_0xbba4('0x36')]===_0xbba4('0x5')&&_0x558620[_0x30717d][_0xbba4('0x28')]===_0xbba4('0x29')){if(_0x558620[_0x30717d][_0xbba4('0x35')]){this['setMessage'](_0x558620[_0x30717d]);this[_0xbba4('0x70')](_0x558620[_0x30717d]);}else{notSendMessagesQueue(_0x558620[_0x30717d]);}}}};Preview['prototype'][_0xbba4('0x71')]=function(_0x1dc1d1){var _0x3cd4df=this;this['sequence'][_0xbba4('0xe')](function(){if(!_['isNil'](_0x3cd4df['actions'][_0x1dc1d1])){loggerAction[_0xbba4('0x72')](_0xbba4('0x73'),_0x1dc1d1,'Queue',_0x3cd4df[_0xbba4('0x14')][_0x1dc1d1][_0xbba4('0x74')],_0xbba4('0x75'),JSON[_0xbba4('0x5b')](_0x3cd4df[_0xbba4('0x26')][_0x3cd4df[_0xbba4('0x14')][_0x1dc1d1][_0xbba4('0x74')]][_0xbba4('0x51')]),_0xbba4('0x76'),JSON[_0xbba4('0x5b')](_0x3cd4df[_0xbba4('0x26')][_0x3cd4df[_0xbba4('0x14')][_0x1dc1d1][_0xbba4('0x74')]][_0xbba4('0x2d')]),JSON[_0xbba4('0x5b')](_0x3cd4df['actions'][_0x1dc1d1][_0xbba4('0x77')]),JSON[_0xbba4('0x5b')](_[_0xbba4('0x78')](_0x3cd4df[_0xbba4('0x14')][_0x1dc1d1],[_0xbba4('0x79'),_0xbba4('0x7a'),_0xbba4('0x7b'),_0xbba4('0x7c')])));return ami[_0xbba4('0x7d')]({'action':_0xbba4('0x7e'),'channel':_0x3cd4df[_0xbba4('0x14')][_0x1dc1d1][_0xbba4('0x7f')]})['catch'](function(_0x24bbea){if(_0x24bbea[_0xbba4('0x64')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x3cd4df['actions'][_0x1dc1d1]){ut[_0xbba4('0x80')](_0x3cd4df['campaignsPreview'][_0x3cd4df['actions'][_0x1dc1d1][_0xbba4('0x74')]],_0xbba4('0x81'));if(_0x3cd4df[_0xbba4('0x14')][_0x1dc1d1][_0xbba4('0x77')]===!![]){ut[_0xbba4('0x82')](_0x3cd4df[_0xbba4('0x26')][_0x3cd4df[_0xbba4('0x14')][_0x1dc1d1][_0xbba4('0x74')]],'[clearZombieChannel]');ut[_0xbba4('0x83')](_0xbba4('0x84')+_0x1dc1d1,_0x3cd4df[_0xbba4('0x14')][_0x1dc1d1][_0xbba4('0x74')]);}ut[_0xbba4('0x83')](_0xbba4('0x85')+_0x1dc1d1,_0x3cd4df[_0xbba4('0x14')][_0x1dc1d1][_0xbba4('0x74')]);delete _0x3cd4df['actions'][_0x1dc1d1];}},0x2328);}});}});};Preview[_0xbba4('0x6a')]['clearZombieChannels']=function(){var _0x2555cc=this;loggerAction['info']('[action]',_[_0xbba4('0x86')](this[_0xbba4('0x14')]));for(var _0x55a674 in this[_0xbba4('0x14')]){if(_0x2555cc['actions'][_0xbba4('0x6d')](_0x55a674)){_0x2555cc['clearZombieChannel'](_0x55a674);}}};Preview[_0xbba4('0x6a')][_0xbba4('0x70')]=function(_0x1258fe){var _0xb26d4d=this;rpcDb[_0xbba4('0x87')](_0x1258fe['id'],ut[_0xbba4('0x88')](this[_0xbba4('0x15')]))[_0xbba4('0x89')](function(_0x2a53a0){if(!_[_0xbba4('0x8a')](_0x2a53a0)){for(var _0x57247a=0x0;_0x57247a<_0x2a53a0[_0xbba4('0x8b')];_0x57247a+=0x1){if(ut['getDiff'](_0x2a53a0[_0x57247a][_0xbba4('0x8c')])<_0x1258fe[_0xbba4('0x8d')]*0x3c){if(_0x2a53a0[_0x57247a][_0xbba4('0x8e')]&&!_0x2a53a0[_0x57247a][_0xbba4('0x8e')][_0xbba4('0x8f')]){_0xb26d4d[_0xbba4('0x90')](_0x2a53a0[_0x57247a]['id'])[_0xbba4('0x89')](ut['logger2'](_0xbba4('0x91')))['catch'](ut['logger2'](_0xbba4('0x91')));}else{rpcDb[_0xbba4('0x92')](_0x2a53a0[_0x57247a]['id']);}}else{var _0x2a036f=new Action(_0x2a53a0[_0x57247a],_0x1258fe);_0x2a036f[_0xbba4('0x93')]=moment()[_0xbba4('0x60')](_0xbba4('0x94'));_0x1258fe[_0xbba4('0x44')]+=0x1;ut[_0xbba4('0x95')](_0x2a036f,0x17,_0xbba4('0x96'));if(_0x1258fe[_0xbba4('0x97')]){rpcDb['rescheduleContactInQueue'](ut[_0xbba4('0x98')](_0x2a53a0[_0x57247a]));rpcDb[_0xbba4('0x99')](_0x2a036f,_0xbba4('0x9a'));}else{ut['logCustomer'](_0x2a036f,0x16,_0xbba4('0x9b'));rpcDb[_0xbba4('0x99')](_0x2a036f,_0xbba4('0x9c'));rpcDb[_0xbba4('0x9d')](_0x2a036f,'[HistoryRecallClose]');}}}}})[_0xbba4('0x9e')](ut[_0xbba4('0x9f')]('[getContactRecallMe]'));};Preview['prototype'][_0xbba4('0xa0')]=function(_0x46c3f3){_0x46c3f3[_0xbba4('0x62')]=!![];if(ut[_0xbba4('0xa1')](_0x46c3f3[_0xbba4('0x2c')])){_0x46c3f3[_0xbba4('0x64')]=_0xbba4('0xa2');}else if(!ut['isActive'](_0x46c3f3[_0xbba4('0x35')])){_0x46c3f3[_0xbba4('0x64')]=_0xbba4('0x65');}else if(!this[_0xbba4('0xa3')](_0x46c3f3['Trunk'])){if(!this[_0xbba4('0xa3')](_0x46c3f3['TrunkBackup'])){_0x46c3f3[_0xbba4('0x64')]=_0xbba4('0xa4');}else{_0x46c3f3[_0xbba4('0x64')]=_0xbba4('0xa5');}}else{_0x46c3f3['message']='ACTIVE';}emitCampaignPreview(_0x46c3f3);};Preview[_0xbba4('0x6a')][_0xbba4('0xa6')]=function(_0x33bc12,_0x3750b8,_0x2789ee){var _0x4e9746=this;var _0x219037=this[_0xbba4('0x14')][_0x3750b8];var _0x382a77=this[_0xbba4('0x26')][_0x219037[_0xbba4('0x74')]];var _0x32ee02;if(_0x382a77){switch(_0x2789ee){case'1':_0x382a77[_0xbba4('0xa7')]+=0x1;_0x219037[_0xbba4('0xa8')]+=0x1;_0x219037[_0xbba4('0xa9')]=ut[_0xbba4('0xaa')](_0x219037);ut[_0xbba4('0x95')](_0x219037,0x0,_0xbba4('0xab'));ami['emit']('custom:agentnosuchnumber',ut[_0xbba4('0xac')](_0x219037,_0xbba4('0xad')));rpcDb[_0xbba4('0x99')](_0x219037,_0xbba4('0xae'));if(ut['totalGlobal'](_0x219037)>=_0x382a77[_0xbba4('0xaf')]){_0x32ee02=ut[_0xbba4('0xb0')](_0x219037,0xf,_0xbba4('0xb1'));rpcDb[_0xbba4('0x9d')](_0x32ee02,_0xbba4('0xb2'));}else{if(_0x219037[_0xbba4('0xa8')]>=_0x382a77[_0xbba4('0xb3')]){rpcDb['createCustomerFinal'](_0x219037,_0xbba4('0xb2'));}else{rpcDb[_0xbba4('0xb4')](ut[_0xbba4('0xb5')](_0x219037,_0xbba4('0xa8'),_0x382a77[_0xbba4('0xb6')]),_0x219037[_0xbba4('0xb7')],_0x219037[_0xbba4('0xb8')]);}}delete this[_0xbba4('0x14')][_0x33bc12['linkedid']];break;case'ANSWER':var _0x4e3006=moment()[_0xbba4('0x60')](_0xbba4('0x94'));_0x219037['responsetime']=_0x4e3006;_0x219037['answertime']=_0x4e3006;_0x219037[_0xbba4('0x77')]=!![];_0x382a77['pTalking']+=0x1;logger[_0xbba4('0x72')](_0xbba4('0xb9'),_0x219037[_0xbba4('0xba')],_0xbba4('0xbb'),_0x382a77[_0xbba4('0x58')],'pTalking:\x20',_0x382a77['pTalking']);ami[_0xbba4('0x27')]('custom:agentconnect',ut[_0xbba4('0xac')](_0x219037,_0xbba4('0xbc')));if(_0x382a77['acw']){ami['emit'](_0xbba4('0xbd'),ut[_0xbba4('0xbe')](_0x219037));}break;case'16':ami[_0xbba4('0x27')]('custom:agentcomplete',ut['buildObj'](_0x219037,_0xbba4('0xbf')));emitVoiceQueueChannelRemove(ut[_0xbba4('0xac')](_0x219037,'complete'));_0x382a77[_0xbba4('0xc0')]+=0x1;_0x382a77[_0xbba4('0x30')]+=0x1;_0x382a77[_0xbba4('0x2a')]+=0x1;ut[_0xbba4('0x82')](_0x382a77,'[16]');_0x219037[_0xbba4('0xa9')]=ut[_0xbba4('0xaa')](_0x219037);ut[_0xbba4('0x95')](_0x219037,0x4,_0xbba4('0xc1'));rpcDb[_0xbba4('0x99')](_0x219037,_0xbba4('0xc2'));rpcDb[_0xbba4('0x9d')](_0x219037,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xbba4('0xc3')](_0x219037);_0x382a77[_0xbba4('0x2e')]+=_0x219037[_0xbba4('0xc4')];_0x382a77[_0xbba4('0xc5')]+=_0x219037['talktime'];logger[_0xbba4('0x72')]('[syncHangup][talking][decrement]',_0x219037[_0xbba4('0xba')],_0xbba4('0xbb'),_0x382a77[_0xbba4('0x58')],_0xbba4('0x76'),_0x382a77[_0xbba4('0x2d')]);delete this[_0xbba4('0x14')][_0x33bc12['linkedid']];break;case _0xbba4('0xc6'):_0x382a77[_0xbba4('0x3d')]+=0x1;_0x219037[_0xbba4('0xc7')]+=0x1;_0x219037['countglobal']=ut[_0xbba4('0xaa')](_0x219037);ut[_0xbba4('0x95')](_0x219037,0x5,_0xbba4('0xc8'));ami[_0xbba4('0x27')]('custom:agentbusy',ut[_0xbba4('0xac')](_0x219037,_0xbba4('0xc9')));rpcDb[_0xbba4('0x99')](_0x219037,_0xbba4('0xca'));if(ut[_0xbba4('0xaa')](_0x219037)>=_0x382a77[_0xbba4('0xaf')]){_0x32ee02=ut['cloneAction'](_0x219037,0xf,'Global');rpcDb[_0xbba4('0x9d')](_0x32ee02,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x219037[_0xbba4('0xc7')]>=_0x382a77['dialBusyMaxRetry']){rpcDb[_0xbba4('0x9d')](_0x219037,_0xbba4('0xca'));}else{rpcDb[_0xbba4('0xb4')](ut[_0xbba4('0xb5')](_0x219037,_0xbba4('0xc7'),_0x382a77['dialBusyRetryFrequency']),_0x219037[_0xbba4('0xb7')],_0x219037[_0xbba4('0xb8')]);}}break;case _0xbba4('0xcb'):_0x382a77['outboundNoAnswerCallsDay']+=0x1;_0x219037['countnoanswerretry']+=0x1;_0x219037['countglobal']=ut[_0xbba4('0xaa')](_0x219037);ut[_0xbba4('0x95')](_0x219037,0x3,_0xbba4('0xcc'));ami['emit']('custom:agentnoanswer',ut[_0xbba4('0xac')](_0x219037,_0xbba4('0xcd')));rpcDb[_0xbba4('0x99')](_0x219037,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0xbba4('0xaa')](_0x219037)>=_0x382a77[_0xbba4('0xaf')]){_0x32ee02=ut[_0xbba4('0xb0')](_0x219037,0xf,_0xbba4('0xb1'));rpcDb[_0xbba4('0x9d')](_0x32ee02,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x219037[_0xbba4('0xce')]>=_0x382a77[_0xbba4('0xcf')]){rpcDb['createCustomerFinal'](_0x219037,_0xbba4('0xd0'));}else{rpcDb[_0xbba4('0xb4')](ut[_0xbba4('0xb5')](_0x219037,'countnoanswerretry',_0x382a77[_0xbba4('0xd1')]),_0x219037[_0xbba4('0xb7')],_0x219037[_0xbba4('0xb8')]);}}break;case _0xbba4('0xd2'):_0x382a77[_0xbba4('0x3e')]+=0x1;_0x219037[_0xbba4('0xd3')]+=0x1;_0x219037[_0xbba4('0xa9')]=ut[_0xbba4('0xaa')](_0x219037);ut[_0xbba4('0x95')](_0x219037,0x8,_0xbba4('0xd4'));ami[_0xbba4('0x27')](_0xbba4('0xd5'),ut[_0xbba4('0xac')](_0x219037,_0xbba4('0xd6')));rpcDb[_0xbba4('0x99')](_0x219037,_0xbba4('0xd7'));if(ut[_0xbba4('0xaa')](_0x219037)>=_0x382a77['dialGlobalMaxRetry']){_0x32ee02=ut[_0xbba4('0xb0')](_0x219037,0xf,'Global');rpcDb[_0xbba4('0x9d')](_0x32ee02,_0xbba4('0xd8'));}else{if(_0x219037[_0xbba4('0xd3')]>=_0x382a77['dialCongestionMaxRetry']){rpcDb[_0xbba4('0x9d')](_0x219037,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xbba4('0xb4')](ut[_0xbba4('0xb5')](_0x219037,_0xbba4('0xd3'),_0x382a77[_0xbba4('0xd9')]),_0x219037['unlockAgent'],_0x219037['activeContact']);}}break;case'CANCEL':_0x382a77[_0xbba4('0x45')]+=0x1;_0x219037[_0xbba4('0xda')]+=0x1;_0x219037[_0xbba4('0xa9')]=ut[_0xbba4('0xaa')](_0x219037);ut['logCustomer'](_0x219037,0x14,_0xbba4('0xdb'));ami[_0xbba4('0x27')](_0xbba4('0xdc'),ut['buildObj'](_0x219037,_0xbba4('0xdd')));rpcDb[_0xbba4('0x99')](_0x219037,_0xbba4('0xde'));if(ut['totalGlobal'](_0x219037)>=_0x382a77[_0xbba4('0xaf')]){_0x32ee02=ut['cloneAction'](_0x219037,0x14,_0xbba4('0xdb'));rpcDb['createCustomerFinal'](_0x32ee02,_0xbba4('0xdf'));}else{if(_0x219037[_0xbba4('0xda')]>=_0x382a77[_0xbba4('0xe0')]){rpcDb[_0xbba4('0x9d')](_0x219037,_0xbba4('0xdf'));}else{rpcDb[_0xbba4('0xb4')](ut['scheduledAt'](_0x219037,_0xbba4('0xda'),_0x382a77['dialAgentRejectRetryFrequency']),_0x219037[_0xbba4('0xb7')],_0x219037[_0xbba4('0xb8')]);}}break;case _0xbba4('0xe1'):_0x382a77[_0xbba4('0xe2')]+=0x1;_0x219037[_0xbba4('0xe3')]+=0x1;_0x219037[_0xbba4('0xa9')]=ut['totalGlobal'](_0x219037);ut['logCustomer'](_0x219037,0xb,'Abandoned');rpcDb[_0xbba4('0x99')](_0x219037,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0xbba4('0xaa')](_0x219037)>=_0x382a77[_0xbba4('0xaf')]){_0x32ee02=ut[_0xbba4('0xb0')](_0x219037,0xf,_0xbba4('0xb1'));rpcDb[_0xbba4('0x9d')](_0x32ee02,_0xbba4('0xe4'));}else{if(_0x219037[_0xbba4('0xe5')]>=_0x382a77['dialAbandonedMaxRety']){rpcDb[_0xbba4('0x9d')](_0x219037,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xbba4('0xb4')](ut['scheduledAt'](_0x219037,_0xbba4('0xe3'),_0x382a77['dialAbandonedRetryFrequency']),_0x219037['unlockAgent'],_0x219037[_0xbba4('0xb8')]);}}break;default:if(_0x219037['dialAnswer']){ut[_0xbba4('0x82')](_0x382a77,'[default]');ut['loggerError'](_0xbba4('0xe6')+_0x382a77[_0xbba4('0x58')],_0x33bc12);}_0x382a77[_0xbba4('0x46')]+=0x1;_0x219037[_0xbba4('0xa9')]=ut[_0xbba4('0xaa')](_0x219037);ut[_0xbba4('0x95')](_0x219037,0xc,_0x33bc12[_0xbba4('0xe7')]||_0x33bc12[_0xbba4('0xe8')]);rpcDb['createCustomerHistory'](_0x219037,_0xbba4('0xe9'));if(ut[_0xbba4('0xaa')](_0x219037)>=_0x382a77[_0xbba4('0xaf')]){_0x32ee02=ut['cloneAction'](_0x219037,0xf,_0xbba4('0xb1'));rpcDb[_0xbba4('0x9d')](_0x32ee02,_0xbba4('0xea'));}else{rpcDb[_0xbba4('0x9d')](_0x219037,_0xbba4('0xea'));}delete this['actions'][_0x33bc12[_0xbba4('0xeb')]];}if(!(_0x219037[_0xbba4('0x77')]&&_0x2789ee==='16')){ut[_0xbba4('0x80')](_0x382a77,_0xbba4('0xec'));logger['info'](_0xbba4('0xed'),_0x219037[_0xbba4('0xba')],'\x20Queue',_0x382a77[_0xbba4('0x58')],_0xbba4('0x75'),_0x382a77[_0xbba4('0x51')]);}if(_0x2789ee!==_0xbba4('0xee')){delete this[_0xbba4('0x14')][_0x33bc12[_0xbba4('0xeb')]];delete this['actions'][_0x33bc12[_0xbba4('0xef')]];}}};Preview[_0xbba4('0x6a')][_0xbba4('0xf0')]=function(_0x5c3bfd,_0x1d83e3,_0x5962bc){if(_[_0xbba4('0xf1')](_0x1d83e3)&&_0xbba4('0xf2')!==typeof _0x1d83e3){return;}if(_[_0xbba4('0xf1')](_0x5962bc)&&_0xbba4('0xf2')!==typeof _0x5962bc){return;}switch(_0x5962bc['reason']){case'0':ut[_0xbba4('0xf3')](_0x5c3bfd,0x0,_0xbba4('0xab'));rpcDb['createAgentHistory'](_0x5c3bfd,_0xbba4('0xf4'));break;case'3':ut['logAgent'](_0x5c3bfd,0x3,'NoAnswer');rpcDb[_0xbba4('0xf5')](_0x5c3bfd,_0xbba4('0xf6'));break;case'5':ut['logAgent'](_0x5c3bfd,0x5,'Busy');rpcDb[_0xbba4('0xf5')](_0x5c3bfd,_0xbba4('0xf7'));break;case'8':ut[_0xbba4('0xf3')](_0x5c3bfd,0x8,_0xbba4('0xd4'));rpcDb[_0xbba4('0xf5')](_0x5c3bfd,_0xbba4('0xf8'));break;case'22':ut['logAgent'](_0x5c3bfd,0x16,_0xbba4('0xf9'));rpcDb[_0xbba4('0xf5')](_0x5c3bfd,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xbba4('0xf3')](_0x5c3bfd,0xc,_0x5962bc[_0xbba4('0xfa')]);rpcDb['createAgentHistory'](_0x5c3bfd,'[callProgressDetectingAgent][logCongestion]');}ut[_0xbba4('0x80')](_0x1d83e3,'[callProgressDetectingAgent]');logger[_0xbba4('0x72')](_0xbba4('0xfb'),_0x5c3bfd[_0xbba4('0xba')],_0xbba4('0xbb'),_0x1d83e3[_0xbba4('0x58')],_0xbba4('0x75'),_0x1d83e3['originated']);delete this[_0xbba4('0x14')][_0x5c3bfd[_0xbba4('0xba')]];};Preview[_0xbba4('0x6a')][_0xbba4('0xfc')]=function(_0x4089c0,_0x3506b2,_0x58dac2,_0xfe1516,_0x12b653){var _0x242511=this;return new BPromise(function(_0x3b0332,_0x5b3c59){if(_[_0xbba4('0x8a')](_0x3506b2)||_[_0xbba4('0x8a')](_0x3506b2['Contact'])||_['isNil'](_0x3506b2[_0xbba4('0xfd')][_0xbba4('0xfe')])||_[_0xbba4('0x8a')](_0x3506b2['VoiceQueueId'])){_0x5b3c59(ut[_0xbba4('0x64')](_0xbba4('0xff'),_0xfe1516,_0x12b653));return;}var _0x4803de=uuid['v4']();var _0x39683d=_0x242511[_0xbba4('0x26')][_0x3506b2[_0xbba4('0x100')][_0xbba4('0x58')]];var _0x54e2b7=_0x58dac2?_0x242511[_0xbba4('0x15')][_0x58dac2]['id']:undefined;_0x242511[_0xbba4('0x14')][_0x4803de]=new Action(_0x3506b2,_0x39683d,_0x4803de,_0x58dac2,_0x54e2b7);var _0x378aee=_0x242511[_0xbba4('0x14')][_0x4803de];_0x378aee['unlockAgent']=_0xfe1516;_0x378aee[_0xbba4('0xb8')]=_0x12b653;_0x378aee['lookAgent']=_0x58dac2;if(_[_0xbba4('0x101')](_0x4089c0)){_0x242511[_0xbba4('0x102')](_0x378aee,_0x39683d,_0x3506b2,_0x58dac2)[_0xbba4('0x89')](function(_0x5eba97){logger[_0xbba4('0x72')](_0xbba4('0x103'),'Queue:\x20'+_0x378aee[_0xbba4('0x74')]+_0xbba4('0x104')+_0x378aee[_0xbba4('0x105')],JSON[_0xbba4('0x5b')](_0x5eba97));ami[_0xbba4('0x27')](_0xbba4('0x106'),ut[_0xbba4('0xac')](_0x378aee,'called'));_0x3b0332(ut[_0xbba4('0x64')]('Calling'));})['catch'](function(_0x16c849){ut['logger'](_0xbba4('0x107'),_0x16c849);_0x5b3c59(ut[_0xbba4('0x64')](_0xbba4('0x108'),_0xfe1516,_0x12b653));});}else{_0x39683d[_0xbba4('0x3c')]+=0x1;ut['logBlacklist'](_0x378aee);rpcDb[_0xbba4('0x109')](_0x378aee,_0xbba4('0x10a'));delete _0x242511[_0xbba4('0x14')][_0x4803de];_0x5b3c59(ut[_0xbba4('0x64')]('Contact\x20in\x20black\x20List',_0xfe1516,_0x12b653));}});};Preview[_0xbba4('0x6a')][_0xbba4('0xa3')]=function(_0x400491){return!_[_0xbba4('0x8a')](_0x400491)&&!_[_0xbba4('0x8a')](_0x400491[_0xbba4('0x58')])&&!_[_0xbba4('0x8a')](_0x400491[_0xbba4('0x59')])&&_0x400491[_0xbba4('0x59')]&&!_['isNil'](this[_0xbba4('0x13')][util[_0xbba4('0x60')](_0xbba4('0x10b'),_0x400491[_0xbba4('0x58')])])&&!_['isNil'](this[_0xbba4('0x13')][util[_0xbba4('0x60')](_0xbba4('0x10b'),_0x400491[_0xbba4('0x58')])]['status'])&&(this[_0xbba4('0x13')][util[_0xbba4('0x60')](_0xbba4('0x10b'),_0x400491[_0xbba4('0x58')])][_0xbba4('0x7e')]===_0xbba4('0x10c')||this['trunks'][util['format']('SIP/%s',_0x400491['name'])]['status']==='unmonitored');};Preview[_0xbba4('0x6a')][_0xbba4('0x90')]=function(_0x27149e,_0x34cc1e){var _0x32d0d6=this;return new BPromise(function(_0xf913,_0x132154){_0x32d0d6['execRun'](_0x27149e,_0x34cc1e)[_0xbba4('0x89')](function(_0x454d47){_0xf913(_[_0xbba4('0x78')](_0x454d47,[_0xbba4('0x64')]));})[_0xbba4('0x9e')](function(_0x322ec4){if(_0x322ec4[_0xbba4('0x10d')]){rpcDb[_0xbba4('0x10e')](_0x27149e);}if(_0x322ec4['active']){rpcDb['disableContact'](_0x27149e);}_0x132154(_[_0xbba4('0x78')](_0x322ec4,[_0xbba4('0x64')]));});});};Preview[_0xbba4('0x6a')][_0xbba4('0x10f')]=function(_0xdf0648,_0x404ec3){var _0x210b2b=this;return new BPromise(function(_0x4b47da,_0x39c948){var _0x133f1f,_0x4cf012;rpcDb[_0xbba4('0x110')](_0xdf0648)[_0xbba4('0x89')](function(_0xb69459){if(!_['isNil'](_0xb69459[0x0])){_0x4cf012=_0xb69459[0x0]['recallme']?![]:!![];_0x133f1f=_0xb69459[0x0][_0xbba4('0x111')]?!![]:![];_0x133f1f=_0x404ec3?!![]:_0x133f1f;}var _0x3eb613=_0x210b2b[_0xbba4('0x112')](_0xb69459);if(_0x3eb613[_0xbba4('0x113')]){rpcDb[_0xbba4('0x114')](_[_0xbba4('0x78')](_0xb69459[0x0],[_0xbba4('0x7b'),_0xbba4('0x115')]))[_0xbba4('0x89')](function(_0x40bdf0){_0x210b2b[_0xbba4('0xfc')](_0x40bdf0,_0xb69459[0x0],_0x404ec3,_0x4cf012,_0x133f1f)[_0xbba4('0x89')](function(_0x4d998a){_0x4b47da(_0x4d998a);})[_0xbba4('0x9e')](function(_0x1dc281){_0x39c948(_0x1dc281);});})[_0xbba4('0x9e')](function(_0x934c2d){ut['logger'](_0xbba4('0x116'),_0x934c2d);_0x39c948(ut[_0xbba4('0x64')](_0xbba4('0x117'),_0x4cf012,_0x133f1f));});}else{_0x39c948(ut['message'](_0x3eb613['message'],_0x4cf012,_0x133f1f));}})['catch'](function(_0x47eac5){ut['logger'](_0xbba4('0x118'),_0x47eac5);_0x39c948(ut[_0xbba4('0x64')](_0xbba4('0x117'),![],!![]));});});};Preview['prototype'][_0xbba4('0x112')]=function(_0x21edf1){if(_['isNil'](_0x21edf1)||_[_0xbba4('0x101')](_0x21edf1)||!_[_0xbba4('0x8a')](_0x21edf1[0x0][_0xbba4('0x8e')])&&_[_0xbba4('0x8a')](_0x21edf1[0x0][_0xbba4('0x8e')][_0xbba4('0x58')])){ut['logger'](_0xbba4('0x119'),_0x21edf1);return{'isValid':![],'message':_0xbba4('0x11a')};}var _0x5eb92a=this[_0xbba4('0x26')][_0x21edf1[0x0][_0xbba4('0x100')][_0xbba4('0x58')]];_0x5eb92a[_0xbba4('0x64')]='ACTIVE';if(_[_0xbba4('0x8a')](_0x5eb92a)){ut[_0xbba4('0x66')]('[Preview][validateContact][Empty\x20Campaign]',_0x5eb92a);return{'isValid':![],'message':_0xbba4('0x11b')};}if(!this[_0xbba4('0xa3')](_0x5eb92a[_0xbba4('0x57')])){ut['logger'](_0xbba4('0x11c'),_0xbba4('0x11d')+_0x5eb92a[_0xbba4('0x58')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xbba4('0xa3')](_0x5eb92a['TrunkBackup'])){ut[_0xbba4('0x66')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x5eb92a['name']+_0xbba4('0x11e'));return{'isValid':![],'message':_0xbba4('0x11f')};}}if(!ut['isActive'](_0x5eb92a['dialActive'])){ut[_0xbba4('0x66')](_0xbba4('0x120'),_0x5eb92a['name']+_0xbba4('0x121'));return{'isValid':![],'message':_0xbba4('0x11d')+_0x5eb92a[_0xbba4('0x58')]+_0xbba4('0x121')};}return{'isValid':!![],'message':_0xbba4('0x122')};};Preview[_0xbba4('0x6a')][_0xbba4('0x102')]=function(_0x2e6c8b,_0x2c8343,_0x1cbc53,_0x535a43){var _0x2093fa=this;return new BPromise(function(_0x186a86,_0x9bc490){var _0x2dd617=_0x2e6c8b[_0xbba4('0xba')];var _0x465ce0=_0x2093fa[_0xbba4('0xa3')](_0x2c8343[_0xbba4('0x57')])?util[_0xbba4('0x60')](_0xbba4('0x123'),_0x2c8343[_0xbba4('0x57')]['name'],_[_0xbba4('0x8a')](_0x2c8343[_0xbba4('0x3a')])?'':_0x2c8343[_0xbba4('0x3a')]['trim']()||'',_0x2c8343['dialCutDigit']>0x0?_0x1cbc53[_0xbba4('0xfd')][_0xbba4('0xfe')][_0xbba4('0x124')](_0x2c8343[_0xbba4('0x125')]):_0x1cbc53[_0xbba4('0xfd')][_0xbba4('0xfe')]):util[_0xbba4('0x60')](_0xbba4('0x123'),_['isNil'](_0x2c8343[_0xbba4('0x126')])?_0x2c8343[_0xbba4('0x57')][_0xbba4('0x58')]:_0x2c8343['TrunkBackup'][_0xbba4('0x58')],_[_0xbba4('0x8a')](_0x2c8343['dialPrefix'])?'':_0x2c8343['dialPrefix'][_0xbba4('0x127')]()||'',_0x2c8343[_0xbba4('0x125')]>0x0?_0x1cbc53['Contact']['phone'][_0xbba4('0x124')](_0x2c8343[_0xbba4('0x125')]):_0x1cbc53[_0xbba4('0xfd')][_0xbba4('0xfe')]);var _0x1d92d3=_0x2093fa[_0xbba4('0xa3')](_0x2c8343['Trunk'])?ut[_0xbba4('0x128')](_0x2c8343[_0xbba4('0x57')][_0xbba4('0x129')],_0x2c8343[_0xbba4('0x37')],_0x2c8343[_0xbba4('0x12a')]>0x0?ut[_0xbba4('0x12b')](_0x2c8343[_0xbba4('0x38')],_0x2c8343['dialRandomLastDigitCallerIdNumber']):_0x2c8343[_0xbba4('0x38')]):ut['getCallerId'](_[_0xbba4('0x8a')](_0x2c8343[_0xbba4('0x126')])?_0x2c8343[_0xbba4('0x57')][_0xbba4('0x129')]:_0x2c8343[_0xbba4('0x126')]['callerid'],_0x2c8343['dialOriginateCallerIdName'],_0x2c8343[_0xbba4('0x12a')]>0x0?ut[_0xbba4('0x12b')](_0x2c8343['dialOriginateCallerIdNumber'],_0x2c8343[_0xbba4('0x12a')]):_0x2c8343[_0xbba4('0x38')]);if(_0x1d92d3){_0x2e6c8b[_0xbba4('0x12c')]=ut['extractCalleridName'](_0x1d92d3);_0x2e6c8b[_0xbba4('0x12d')]=ut[_0xbba4('0x12e')](_0x1d92d3);}var _0x265313=ut[_0xbba4('0x12f')](_0x2c8343,_0x1cbc53,_0x465ce0,_0x1d92d3,_0x2dd617,_0x2e6c8b);_[_0xbba4('0x130')](_0x2e6c8b,ut['toLowerVariables'](_0x265313));_0x2e6c8b[_0xbba4('0x93')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ami[_0xbba4('0x7d')](ut['variablesAction'](_0x2e6c8b,_0x2c8343,_0x265313,_0x2e6c8b['activeContact'],_0x535a43))['then'](function(_0x1e8214){_0x2c8343[_0xbba4('0x51')]+=0x1;logger[_0xbba4('0x72')](_0xbba4('0x131'),_0x2dd617,'\x20Queue',_0x2c8343[_0xbba4('0x58')],_0xbba4('0x75'),_0x2c8343['originated']);_0x186a86(_0x1e8214);})['catch'](function(_0x2ee4df){ut[_0xbba4('0xf3')](_0x2e6c8b,0xe,_0xbba4('0x132'));rpcDb[_0xbba4('0xf5')](_0x2e6c8b,_0xbba4('0x133'));_0x9bc490(_0x2ee4df);});});};Preview[_0xbba4('0x6a')][_0xbba4('0x1f')]=function(_0x34e6a5){if(this[_0xbba4('0x14')][_0x34e6a5['linkedid']]){this[_0xbba4('0x14')][_0x34e6a5[_0xbba4('0xeb')]][_0xbba4('0x7f')]=_0x34e6a5[_0xbba4('0x7f')];}};Preview[_0xbba4('0x6a')][_0xbba4('0x134')]=function(_0x21bdcc){var _0x3e908a=this;var _0x43af97=this[_0xbba4('0x14')][_0x21bdcc[_0xbba4('0x135')]];if(_0x43af97){if(_0x43af97['lookAgent']&&this['agents'][_0x43af97[_0xbba4('0x136')]]){ut['logLookAgent'](_0x43af97,this[_0xbba4('0x15')][_0x43af97['lookAgent']]['name'],this[_0xbba4('0x15')][_0x43af97[_0xbba4('0x136')]]['id']);}var _0x8c97e0=_[_0xbba4('0x137')](_0x43af97);_0x8c97e0[_0xbba4('0x138')]=moment()[_0xbba4('0x60')]('YYYY-MM-DD\x20HH:mm:ss');var _0x395e1b=_0x3e908a['campaignsPreview'][_0x43af97[_0xbba4('0x74')]];if(ut[_0xbba4('0x139')](_0x21bdcc['response'])){if(_0x43af97[_0xbba4('0xb7')]){rpcDb[_0xbba4('0x10e')](_0x43af97[_0xbba4('0x105')]);}if(_0x43af97[_0xbba4('0xb8')]){rpcDb[_0xbba4('0x92')](_0x43af97['idContact']);}ami[_0xbba4('0x27')]('custom:agentringnoanswer',ut['buildObj'](_0x43af97,'rejected'));this[_0xbba4('0xf0')](_0x8c97e0,_0x395e1b,_0x21bdcc);}else{_0x43af97['starttime']=moment()[_0xbba4('0x60')](_0xbba4('0x94'));ut[_0xbba4('0xf3')](_0x8c97e0,0x4,_0xbba4('0xc1'));rpcDb[_0xbba4('0xf5')](_0x8c97e0,_0xbba4('0x13a'));}}};Preview[_0xbba4('0x6a')][_0xbba4('0x19')]=function(_0x4ca9ae){var _0x52a16d=this;var _0x3401f7=this[_0xbba4('0x14')][_0x4ca9ae[_0xbba4('0xeb')]];var _0xfb5caf;if(_0x3401f7){_0xfb5caf=this[_0xbba4('0x26')][_0x3401f7['queue']];logger[_0xbba4('0x72')]('[syncHangup][talking]',_0x4ca9ae['linkedid'],_0xbba4('0xbb'),_0xfb5caf[_0xbba4('0x58')],_0xbba4('0x76'),_0xfb5caf[_0xbba4('0x2d')]);}if(this[_0xbba4('0x14')][_0x4ca9ae[_0xbba4('0xeb')]]&&_0x4ca9ae[_0xbba4('0xeb')]!==_0x4ca9ae[_0xbba4('0xba')]){if(_0x4ca9ae[_0xbba4('0x13b')]==='16'&&this[_0xbba4('0x14')][_0x4ca9ae[_0xbba4('0xeb')]]['dialAnswer']){this['callProgressDetectingCustomer'](_0x4ca9ae,_0x4ca9ae[_0xbba4('0xeb')],_0x4ca9ae[_0xbba4('0x13b')]);}else if(this[_0xbba4('0x14')][_0x4ca9ae[_0xbba4('0xeb')]][_0xbba4('0x77')]){logger[_0xbba4('0x72')](_0xbba4('0x13c'),_0x4ca9ae[_0xbba4('0xeb')],_0x4ca9ae[_0xbba4('0x13b')],_0xbba4('0xbb'),_0xfb5caf[_0xbba4('0x58')],_0xbba4('0x76'),_0xfb5caf[_0xbba4('0x2d')]);this[_0xbba4('0xa6')](_0x4ca9ae,_0x4ca9ae[_0xbba4('0xeb')],_0x4ca9ae[_0xbba4('0x13b')]);}}else if(_0x3401f7&&_[_0xbba4('0x8a')](_0x3401f7['statedesc'])&&_0xfb5caf['dialQueueProject']&&_0x4ca9ae['linkedid']===_0x4ca9ae[_0xbba4('0xba')]&&_[_0xbba4('0x8a')](_0x4ca9ae['reason'])&&_0x4ca9ae['cause']==='16'&&_0x4ca9ae[_0xbba4('0x13d')]==='6'&&_[_0xbba4('0xf1')](_0x3401f7[_0xbba4('0x13e')])){if(_0x3401f7[_0xbba4('0xb7')]){rpcDb[_0xbba4('0x10e')](_0x3401f7['idContact']);}if(_0x3401f7['activeContact']){rpcDb[_0xbba4('0x92')](_0x3401f7['idContact']);}_0x4ca9ae[_0xbba4('0xfa')]='22';this[_0xbba4('0xf0')](_0x3401f7,_0xfb5caf,_0x4ca9ae);}else if(_0x3401f7&&_0x3401f7['transfer']){if(_0x4ca9ae['cause']==='16'&&this[_0xbba4('0x14')][_0x4ca9ae[_0xbba4('0xeb')]][_0xbba4('0x77')]){logger[_0xbba4('0x72')](_0xbba4('0x13f'),_0x4ca9ae[_0xbba4('0xeb')],_0x4ca9ae['cause'],'\x20Queue',_0xfb5caf[_0xbba4('0x58')],_0xbba4('0x76'),_0xfb5caf[_0xbba4('0x2d')]);this[_0xbba4('0xa6')](_0x4ca9ae,_0x4ca9ae[_0xbba4('0xeb')],_0x4ca9ae[_0xbba4('0x13b')]);}else if(this[_0xbba4('0x14')][_0x4ca9ae[_0xbba4('0xeb')]][_0xbba4('0x77')]){logger['info'](_0xbba4('0x13c'),_0x4ca9ae['linkedid'],_0x4ca9ae[_0xbba4('0x13b')],'\x20Queue',_0xfb5caf[_0xbba4('0x58')],_0xbba4('0x76'),_0xfb5caf['pTalking']);this[_0xbba4('0xa6')](_0x4ca9ae,_0x4ca9ae[_0xbba4('0xeb')],_0x4ca9ae[_0xbba4('0x13b')]);}}};Preview[_0xbba4('0x6a')][_0xbba4('0x1e')]=function(_0x9cd099){if(this[_0xbba4('0x14')][_0x9cd099['destlinkedid']]&&_0x9cd099['destlinkedid']!==_0x9cd099[_0xbba4('0x140')]){this[_0xbba4('0xa6')](_0x9cd099,_0x9cd099[_0xbba4('0xef')],_0x9cd099[_0xbba4('0xe8')]);}};Preview[_0xbba4('0x6a')][_0xbba4('0x1b')]=function(_0x465b45){if(this['actions'][_0x465b45[_0xbba4('0xeb')]]&&_0x465b45[_0xbba4('0xeb')]!==_0x465b45[_0xbba4('0xba')]&&!this['actions'][_0x465b45[_0xbba4('0xeb')]][_0xbba4('0x77')]){if(_0x465b45[_0xbba4('0x13b')]==='1'){this['callProgressDetectingCustomer'](_0x465b45,_0x465b45[_0xbba4('0xeb')],_0x465b45['cause']);}}};Preview['prototype'][_0xbba4('0x141')]=function(_0x56253,_0x22a2a7,_0x302875){if(this[_0xbba4('0x14')][_0x56253]){if(_[_0xbba4('0x8a')](this[_0xbba4('0x14')][_0x56253][_0xbba4('0x142')])){this['actions'][_0x56253][_0xbba4('0x142')]={};}this[_0xbba4('0x14')][_0x56253][_0xbba4('0x142')][_0x22a2a7]=_0x302875;}};Preview[_0xbba4('0x6a')][_0xbba4('0x21')]=function(_0x2181ce){try{if(!_[_0xbba4('0x8a')](_0x2181ce)){if(ut[_0xbba4('0x143')](_[_0xbba4('0x144')](_0x2181ce[_0xbba4('0x145')])[0x0])){this[_0xbba4('0x141')](_0x2181ce[_0xbba4('0xba')],_[_0xbba4('0x144')](_0x2181ce['variable'])[0x0],_0x2181ce['value']);}}}catch(_0x361373){logger[_0xbba4('0x146')](_0xbba4('0x147'),util['inspect'](_0x361373,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x560860){if(_0x560860){if(this[_0xbba4('0x14')][_0x560860[_0xbba4('0x148')]]){this[_0xbba4('0x14')][_0x560860['transfertargetlinkedid']][_0xbba4('0x13e')]=!![];}}};Preview['prototype'][_0xbba4('0x25')]=function(_0x5062fb){if(_0x5062fb){if(this[_0xbba4('0x14')][_0x5062fb[_0xbba4('0x149')]]){this[_0xbba4('0x14')][_0x5062fb['transfererlinkedid']]['transfer']=!![];}}};module[_0xbba4('0x14a')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 4835104..cf9a1a0 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 _0x25fa=['util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/agentReportPreview','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20'];(function(_0x3b9d5f,_0x2e9039){var _0x39924e=function(_0x5752ee){while(--_0x5752ee){_0x3b9d5f['push'](_0x3b9d5f['shift']());}};_0x39924e(++_0x2e9039);}(_0x25fa,0x109));var _0xa25f=function(_0xd65dc0,_0x19215a){_0xd65dc0=_0xd65dc0-0x0;var _0x4d4fd4=_0x25fa[_0xd65dc0];return _0x4d4fd4;};'use strict';var util=require(_0xa25f('0x0'));var BPromise=require('bluebird');var logger=require(_0xa25f('0x1'))(_0xa25f('0x2'));var _=require('lodash');var cmHopper=require(_0xa25f('0x3'));var cmHopperFinal=require(_0xa25f('0x4'));var cmHopperHistory=require(_0xa25f('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xa25f('0x6'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x2ea9ea){return function(_0x3ab530){logger[_0xa25f('0x7')](_0x2ea9ea,util[_0xa25f('0x8')](_0x3ab530,{'showHidden':![],'depth':null}));};}function create(_0x22982b){return BPromise[_0xa25f('0x9')]()[_0xa25f('0xa')](cmHopperHistory[_0xa25f('0xb')](_0x22982b))[_0xa25f('0xc')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x1bca18){return BPromise[_0xa25f('0x9')]()['then'](agentReportPreview[_0xa25f('0xb')](_0x1bca18))[_0xa25f('0xc')](loggerCatch(_0xa25f('0xd')));}function moveContact(_0x22df56){return BPromise['resolve']()[_0xa25f('0xa')](cmHopper[_0xa25f('0xe')](_0x22df56,!![]))['catch'](loggerCatch(_0xa25f('0xf')));}exports[_0xa25f('0x10')]=function(_0x50bb78){return BPromise[_0xa25f('0x9')]()[_0xa25f('0xa')](cmHopperBlack[_0xa25f('0x10')](_0x50bb78))[_0xa25f('0xc')](loggerCatch(_0xa25f('0x11')));};exports[_0xa25f('0x12')]=function(_0x46cd8c){return BPromise[_0xa25f('0x9')]()[_0xa25f('0xa')](cmHopper[_0xa25f('0x12')](_0x46cd8c))[_0xa25f('0xc')](loggerCatch(_0xa25f('0x13')));};exports['createHistory']=function(_0x2d4f0f,_0x471679){create(_0x2d4f0f)[_0xa25f('0xc')](loggerCatch(_0x471679));moveContact(_0x2d4f0f)[_0xa25f('0xc')](loggerCatch(_0x471679));};exports[_0xa25f('0x14')]=function(_0x427105,_0x4a4805){createAgent(_0x427105)[_0xa25f('0xc')](loggerCatch(_0x4a4805));};exports['createCustomerHistory']=function(_0x32b868,_0x562573){create(_0x32b868)['catch'](loggerCatch(_0x562573));};exports[_0xa25f('0x15')]=function(_0x489c83,_0x46bb31){moveContact(_0x489c83)[_0xa25f('0xc')](loggerCatch(_0x46bb31));};exports[_0xa25f('0x16')]=function(_0x3c2665,_0x21d035,_0x504135){if(_0x21d035){_0x3c2665[_0xa25f('0x17')]=null;}if(_0x504135){_0x3c2665[_0xa25f('0x18')]=![];}return BPromise[_0xa25f('0x9')]()[_0xa25f('0xa')](cmHopper['rescheduleContact'](_0x3c2665))[_0xa25f('0xc')](loggerCatch(_0xa25f('0x19')));};exports[_0xa25f('0x1a')]=function(_0x3675b5){return BPromise['resolve']()[_0xa25f('0xa')](cmHopper[_0xa25f('0x1a')](_0x3675b5))[_0xa25f('0xc')](loggerCatch(_0xa25f('0x1b')));};exports['unlockContact']=function(_0x2812d7){return BPromise[_0xa25f('0x9')]()['then'](cmHopper[_0xa25f('0x1c')]({'UserId':null},_0x2812d7,0x1))['catch'](loggerCatch(_0xa25f('0x1d')));};exports['disableContact']=function(_0x1e1fbd){return BPromise[_0xa25f('0x9')]()['then'](cmHopper[_0xa25f('0x1c')]({'active':![]},_0x1e1fbd,0x1))[_0xa25f('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0xa25f('0x1e')]=function(_0x5d39c7){var _0x1030c4={};_0x1030c4[_0xa25f('0x1f')]=_0x5d39c7[_0xa25f('0x1f')];_0x1030c4[_0xa25f('0x20')]=_0x5d39c7[_0xa25f('0x20')];_0x1030c4['calleridnum']=_0x5d39c7[_0xa25f('0x21')];_0x1030c4[_0xa25f('0x22')]=_0x5d39c7[_0xa25f('0x22')];_0x1030c4[_0xa25f('0x23')]=_0x5d39c7[_0xa25f('0x23')];_0x1030c4['queuecallerjoinAt']=_0x5d39c7[_0xa25f('0x24')];_0x1030c4[_0xa25f('0x25')]=_0x5d39c7[_0xa25f('0x24')];_0x1030c4[_0xa25f('0x26')]=0x1;_0x1030c4[_0xa25f('0x27')]=_0x5d39c7[_0xa25f('0x28')];_0x1030c4[_0xa25f('0x29')]=_0x5d39c7[_0xa25f('0x2a')];_0x1030c4[_0xa25f('0x2b')]='from-sip';_0x1030c4['exten']='xcally-motion-preview';_0x1030c4[_0xa25f('0x2c')]=0x0;_0x1030c4[_0xa25f('0x2d')]=0x1;_0x1030c4[_0xa25f('0x2e')]=_0x5d39c7[_0xa25f('0x2a')];_0x1030c4[_0xa25f('0x2f')]=_0xa25f('0x30');return BPromise[_0xa25f('0x9')]()[_0xa25f('0xa')](voiceQueueReport[_0xa25f('0x31')](_0x1030c4))[_0xa25f('0xc')](loggerCatch(_0xa25f('0x32')));};exports['getContactRecallMe']=function(_0x58ee76,_0xeb44b1){return BPromise[_0xa25f('0x9')]()[_0xa25f('0xa')](cmHopper['getContactRecallMe'](_0x58ee76,_0xeb44b1))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xa25f('0x33')]=function(_0x25952d){return BPromise[_0xa25f('0x9')]()['then'](cmHopper['rescheduleContact'](_0x25952d,!![],!![]))[_0xa25f('0xc')](loggerCatch(_0xa25f('0x34')));}; \ No newline at end of file +var _0x56a4=['catch','createHistory','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerFinal','rescheduleContact','active','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','endtime','connectedlinename','context','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','membername','queuecallerexitreason','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','lodash','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','resolve','then'];(function(_0x52a0f9,_0x1613f8){var _0x43dafa=function(_0x8f2924){while(--_0x8f2924){_0x52a0f9['push'](_0x52a0f9['shift']());}};_0x43dafa(++_0x1613f8);}(_0x56a4,0x11b));var _0x456a=function(_0x4e4061,_0x26503b){_0x4e4061=_0x4e4061-0x0;var _0x371dbd=_0x56a4[_0x4e4061];return _0x371dbd;};'use strict';var util=require(_0x456a('0x0'));var BPromise=require(_0x456a('0x1'));var logger=require('../../../config/logger')(_0x456a('0x2'));var _=require(_0x456a('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x456a('0x4'));var cmHopperBlack=require(_0x456a('0x5'));var voiceQueueRt=require(_0x456a('0x6'));var agentReportPreview=require(_0x456a('0x7'));var voiceQueueReport=require(_0x456a('0x8'));function loggerCatch(_0x4b8eec){return function(_0x3b0145){logger['error'](_0x4b8eec,util['inspect'](_0x3b0145,{'showHidden':![],'depth':null}));};}function create(_0x2b6329){return BPromise[_0x456a('0x9')]()[_0x456a('0xa')](cmHopperHistory['createHistory'](_0x2b6329))[_0x456a('0xb')](loggerCatch('[createHistory]\x20'));}function createAgent(_0xb56df){return BPromise[_0x456a('0x9')]()[_0x456a('0xa')](agentReportPreview[_0x456a('0xc')](_0xb56df))[_0x456a('0xb')](loggerCatch(_0x456a('0xd')));}function moveContact(_0x1179fa){return BPromise[_0x456a('0x9')]()[_0x456a('0xa')](cmHopper[_0x456a('0xe')](_0x1179fa,!![]))[_0x456a('0xb')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x456a('0xf')]=function(_0x5284ce){return BPromise['resolve']()[_0x456a('0xa')](cmHopperBlack[_0x456a('0xf')](_0x5284ce))[_0x456a('0xb')](loggerCatch(_0x456a('0x10')));};exports['getContactPreview']=function(_0x10cc0d){return BPromise[_0x456a('0x9')]()[_0x456a('0xa')](cmHopper[_0x456a('0x11')](_0x10cc0d))[_0x456a('0xb')](loggerCatch(_0x456a('0x12')));};exports['createHistory']=function(_0x410df4,_0x42f7d8){create(_0x410df4)[_0x456a('0xb')](loggerCatch(_0x42f7d8));moveContact(_0x410df4)[_0x456a('0xb')](loggerCatch(_0x42f7d8));};exports['createAgentHistory']=function(_0x200eda,_0x448fd6){createAgent(_0x200eda)[_0x456a('0xb')](loggerCatch(_0x448fd6));};exports['createCustomerHistory']=function(_0x3d06b4,_0x520f2f){create(_0x3d06b4)['catch'](loggerCatch(_0x520f2f));};exports[_0x456a('0x13')]=function(_0x562cfa,_0x44d79a){moveContact(_0x562cfa)['catch'](loggerCatch(_0x44d79a));};exports[_0x456a('0x14')]=function(_0x17d0ae,_0x55054e,_0x55a795){if(_0x55054e){_0x17d0ae['UserId']=null;}if(_0x55a795){_0x17d0ae[_0x456a('0x15')]=![];}return BPromise[_0x456a('0x9')]()[_0x456a('0xa')](cmHopper['rescheduleContact'](_0x17d0ae))[_0x456a('0xb')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x59b47e){return BPromise[_0x456a('0x9')]()[_0x456a('0xa')](cmHopper[_0x456a('0x16')](_0x59b47e))['catch'](loggerCatch(_0x456a('0x17')));};exports[_0x456a('0x18')]=function(_0x5b3bef){return BPromise[_0x456a('0x9')]()['then'](cmHopper['unlockContact']({'UserId':null},_0x5b3bef,0x1))[_0x456a('0xb')](loggerCatch('[unlockContact]\x20'));};exports[_0x456a('0x19')]=function(_0x5e6de5){return BPromise[_0x456a('0x9')]()[_0x456a('0xa')](cmHopper[_0x456a('0x18')]({'active':![]},_0x5e6de5,0x1))[_0x456a('0xb')](loggerCatch(_0x456a('0x1a')));};exports[_0x456a('0x1b')]=function(_0x46f3b3){var _0x25da31={};_0x25da31['type']=_0x46f3b3['type'];_0x25da31['uniqueid']=_0x46f3b3[_0x456a('0x1c')];_0x25da31[_0x456a('0x1d')]=_0x46f3b3['calleridnum'];_0x25da31[_0x456a('0x1e')]=_0x46f3b3[_0x456a('0x1e')];_0x25da31[_0x456a('0x1f')]=_0x46f3b3[_0x456a('0x1f')];_0x25da31[_0x456a('0x20')]=_0x46f3b3['answertime'];_0x25da31[_0x456a('0x21')]=_0x46f3b3[_0x456a('0x22')];_0x25da31[_0x456a('0x23')]=0x1;_0x25da31['queuecallercompleteAt']=_0x46f3b3[_0x456a('0x24')];_0x25da31[_0x456a('0x25')]=_0x46f3b3['membername'];_0x25da31[_0x456a('0x26')]=_0x456a('0x27');_0x25da31[_0x456a('0x28')]=_0x456a('0x29');_0x25da31[_0x456a('0x2a')]=0x0;_0x25da31['assigned']=0x1;_0x25da31[_0x456a('0x2b')]=_0x46f3b3[_0x456a('0x2c')];_0x25da31[_0x456a('0x2d')]='COMPLETED';return BPromise['resolve']()[_0x456a('0xa')](voiceQueueReport['create'](_0x25da31))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x456a('0x2e')]=function(_0x7f1a33,_0x425055){return BPromise[_0x456a('0x9')]()['then'](cmHopper[_0x456a('0x2e')](_0x7f1a33,_0x425055))[_0x456a('0xb')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x456a('0x2f')]=function(_0x1dddef){return BPromise[_0x456a('0x9')]()[_0x456a('0xa')](cmHopper[_0x456a('0x14')](_0x1dddef,!![],!![]))['catch'](loggerCatch(_0x456a('0x30')));}; \ 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 834b829..285dc77 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 _0xcf37=['responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','membername','logCustomer','state','ringtime','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','originate','channelAgent','calleridnum','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','queue','interface','buildAcw','not_inuse','status','reachable','push','getDiff','diff','seconds','createBody','CampaignId','type','campaigntype','dialAnswer','calleridname','active','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','UserId','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','lodash','moment','../../../../config/logger','preview','env','127.0.0.1','milliseconds','loggerCatch','inspect','logger','info','error','logger2','getCallerId','string','isUndefined','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','name','ContactId','VoiceQueueId','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','XMD-','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','statedesc','Blacklist','starttime'];(function(_0x50182,_0x4ca3e0){var _0x1094bd=function(_0x3ffeb8){while(--_0x3ffeb8){_0x50182['push'](_0x50182['shift']());}};_0x1094bd(++_0x4ca3e0);}(_0xcf37,0xdc));var _0x7cf3=function(_0x4200a2,_0x2da7f1){_0x4200a2=_0x4200a2-0x0;var _0x19a0c7=_0xcf37[_0x4200a2];return _0x19a0c7;};'use strict';var util=require('util');var _=require(_0x7cf3('0x0'));var moment=require(_0x7cf3('0x1'));var logger=require(_0x7cf3('0x2'))(_0x7cf3('0x3'));var ipAgi=process[_0x7cf3('0x4')]['XCALLY_IP_AGI']||_0x7cf3('0x5');function getSeconds(_0x1fda78,_0x3a015f){var _0x265afb=moment(_0x1fda78)[_0x7cf3('0x6')](0x0);var _0x48c7cf=moment(_0x3a015f)['milliseconds'](0x0);return _0x265afb['diff'](_0x48c7cf,'seconds');}exports[_0x7cf3('0x7')]=function(_0x53502d){return function(_0x110c99){logger['error'](_0x53502d,util[_0x7cf3('0x8')](_0x110c99,{'showHidden':![],'depth':null}));};};exports[_0x7cf3('0x9')]=function(_0x242ffc,_0x2acdde){logger[_0x7cf3('0xa')](_0x242ffc,util[_0x7cf3('0x8')](_0x2acdde,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x28fbc8,_0x6c6d0f){logger[_0x7cf3('0xb')](_0x28fbc8,util[_0x7cf3('0x8')](_0x6c6d0f,{'showHidden':![],'depth':null}));};exports[_0x7cf3('0xc')]=function(_0x5ad7c0){return function(_0x3dda56){logger['info'](_0x5ad7c0,util[_0x7cf3('0x8')](_0x3dda56,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x3280dd,_0x3ac1e4,_0x5a9ead){return{'message':_0x3280dd,'unlock':_0x3ac1e4,'active':_0x5a9ead};};exports[_0x7cf3('0xd')]=function(_0x2b477e,_0x3f4338,_0x11b967){if(!_['isUndefined'](_0x11b967)&&_0x7cf3('0xe')===typeof _0x11b967&&!_['isEmpty'](_0x11b967)){if(!_[_0x7cf3('0xf')](_0x3f4338)&&_0x7cf3('0xe')===typeof _0x3f4338&&!_[_0x7cf3('0x10')](_0x3f4338)){return util[_0x7cf3('0x11')](_0x7cf3('0x12'),_0x3f4338,_0x11b967);}return util[_0x7cf3('0x11')]('\x22%s\x22\x20<%s>',_0x11b967,_0x11b967);}if(!_['isUndefined'](_0x2b477e)&&_0x7cf3('0xe')===typeof _0x2b477e&&!_[_0x7cf3('0x10')](_0x2b477e)){return _0x2b477e;}return _0x7cf3('0x13');};exports['isActive']=function(_0x9b14f8){if(_[_0x7cf3('0x14')](_0x9b14f8)){return![];}return _0x9b14f8;};exports[_0x7cf3('0x15')]=function(_0x27ef8d,_0x369e30,_0x50cea8,_0x2175c1,_0x10508f,_0x4344a1){var _0x230a80={'XMD-QUEUE':_0x369e30[_0x7cf3('0x16')]?_0x369e30['Queue'][_0x7cf3('0x17')]:'','XMD-CALLERID':_0x2175c1,'XMD-CALLERID-PREVIEW':_0x4344a1?util[_0x7cf3('0x11')]('\x22%s\x22\x20<%s>',_0x4344a1['calleridname'],_0x4344a1['calleridnum']):_0x2175c1,'XMD-DIALID':_0x10508f,'XMD-CONTACTID':_0x369e30[_0x7cf3('0x18')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x2175c1,'XMD-VOICEQUEUEID':_0x369e30[_0x7cf3('0x19')],'XMD-DIALCHANNEL':_0x50cea8,'XMD-DIALTIMEOUT':_0x27ef8d['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x7cf3('0x11')]('\x22rtTxX%s%s\x22',_0x27ef8d[_0x7cf3('0x1a')]?'g':'',_['isEmpty'](_0x27ef8d[_0x7cf3('0x1b')])?'':_0x7cf3('0x1c')),'XMD-DIALURL':_0x27ef8d[_0x7cf3('0x1d')]||'','XMD-AGI':_0x27ef8d[_0x7cf3('0x1e')]?util[_0x7cf3('0x11')](_0x7cf3('0x1f'),ipAgi,_0x27ef8d[_0x7cf3('0x1e')]):_0x7cf3('0x20'),'XMD-AGIAFTER':_0x27ef8d[_0x7cf3('0x1a')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x27ef8d[_0x7cf3('0x1a')]):_0x7cf3('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x4344a1?_0x4344a1[_0x7cf3('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0x4344a1?_0x4344a1['originatecalleridname']:'','XMD-DESTINATION':_0x7cf3('0x22')};if(!_[_0x7cf3('0x10')](_0x27ef8d['monitor_format'])){_0x230a80[util[_0x7cf3('0x11')]('%s',_0x7cf3('0x23'))]=_0x27ef8d[_0x7cf3('0x1b')];_0x230a80[util[_0x7cf3('0x11')]('%s',_0x7cf3('0x24'))]=_0x10508f;}if(_0x369e30&&_0x369e30[_0x7cf3('0x25')]){for(var _0x206488 in _0x369e30[_0x7cf3('0x25')]){if(_0x369e30[_0x7cf3('0x25')][_0x7cf3('0x26')](_0x206488)){if(!_['isNil'](_0x369e30[_0x7cf3('0x25')][_0x206488])&&_0x206488!=='id'&&_0x206488!=='tags'&&_0x206488!==_0x7cf3('0x27')&&_0x206488!==_0x7cf3('0x28')){_0x230a80[util[_0x7cf3('0x11')]('%s%s',_0x7cf3('0x29'),_[_0x7cf3('0x2a')](_0x206488))]=_0x369e30['Contact'][_0x206488];}}}}return _0x230a80;};exports[_0x7cf3('0x2b')]=function(_0x17aaa6){var _0x31c8bb={};for(var _0x4180b3 in _0x17aaa6){if(_0x17aaa6[_0x7cf3('0x26')](_0x4180b3)){_0x31c8bb[util[_0x7cf3('0x11')]('%s',_['toLower'](_0x4180b3))]=_0x17aaa6[_0x4180b3];}}return{'variables':_0x31c8bb};};exports[_0x7cf3('0x2c')]=function(_0x1be09c,_0x24d0d2){if(!_[_0x7cf3('0x14')](_0x1be09c)){if(_0x1be09c['hasOwnProperty'](_0x7cf3('0x2d'))){if(_0x1be09c[_0x7cf3('0x2d')]>0x0){_0x1be09c[_0x7cf3('0x2d')]-=0x1;}else{logger[_0x7cf3('0xb')](_0x7cf3('0x2e'),_0x24d0d2);}}}else{logger[_0x7cf3('0xb')](_0x7cf3('0x2f'),_0x24d0d2);}};exports[_0x7cf3('0x30')]=function(_0x347bff){var _0x32ea10=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x347bff['state']=0xd;_0x347bff[_0x7cf3('0x31')]=_0x7cf3('0x32');_0x347bff[_0x7cf3('0x33')]=_0x32ea10;_0x347bff[_0x7cf3('0x34')]=_0x32ea10;_0x347bff[_0x7cf3('0x35')]=_0x32ea10;};exports[_0x7cf3('0x36')]=function(_0x2c7f87,_0xd4ee32,_0x1b62f5){var _0x4ee41c=moment()['format'](_0x7cf3('0x37'));_0x2c7f87['state']=_0xd4ee32;_0x2c7f87['statedesc']=_0x1b62f5;_0x2c7f87[_0x7cf3('0x34')]=_0x4ee41c;_0x2c7f87['ringtime']=getSeconds(_0x2c7f87[_0x7cf3('0x34')],_0x2c7f87[_0x7cf3('0x33')]);};exports['logLookAgent']=function(_0x2e6389,_0x457c34,_0x46865d){_0x2e6389[_0x7cf3('0x38')]=_0x457c34;_0x2e6389['UserId']=_0x46865d;};exports[_0x7cf3('0x39')]=function(_0x1f76d0,_0x4305be,_0x102bf9){var _0x3fa3f8=moment()['format'](_0x7cf3('0x37'));_0x1f76d0[_0x7cf3('0x3a')]=_0x4305be;_0x1f76d0['statedesc']=_0x102bf9;_0x1f76d0[_0x7cf3('0x34')]=_0x1f76d0[_0x7cf3('0x34')]?_0x1f76d0[_0x7cf3('0x34')]:_0x3fa3f8;_0x1f76d0[_0x7cf3('0x35')]=_0x1f76d0[_0x7cf3('0x35')]?_0x1f76d0[_0x7cf3('0x35')]:_0x3fa3f8;_0x1f76d0[_0x7cf3('0x3b')]=getSeconds(_0x1f76d0['responsetime']||0x0,_0x1f76d0[_0x7cf3('0x33')]||0x0);_0x1f76d0[_0x7cf3('0x3c')]=_0x1f76d0['answertime']?getSeconds(_0x1f76d0[_0x7cf3('0x35')],_0x1f76d0[_0x7cf3('0x3d')]):0x0;};exports[_0x7cf3('0x3e')]=function(_0x3529cc){return _0x3529cc===_0x7cf3('0x3f');};exports[_0x7cf3('0x40')]=function(_0x3bc0bb,_0x20c9ce,_0x76f1c,_0x1b1908,_0x53d368){var _0x36ad0b=_0x1b1908?'RECALL':_0x3bc0bb['calleridname'];_0x36ad0b=_0x53d368?_0x7cf3('0x41'):_0x36ad0b;return{'actionid':_0x3bc0bb[_0x7cf3('0x42')],'action':_0x7cf3('0x43'),'channel':_0x3bc0bb[_0x7cf3('0x44')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x36ad0b,_0x3bc0bb[_0x7cf3('0x45')]),'Exten':_0x7cf3('0x22'),'Context':_0x7cf3('0x46'),'Priority':'1','variable':_0x76f1c,'timeout':(_0x20c9ce[_0x7cf3('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3bc0bb['uniqueid']};};exports[_0x7cf3('0x48')]=function(_0x164a55){return _0x164a55[_0x7cf3('0x49')]+_0x164a55[_0x7cf3('0x4a')]+_0x164a55['countnoanswerretry']+_0x164a55[_0x7cf3('0x4b')]+_0x164a55[_0x7cf3('0x4c')];};exports[_0x7cf3('0x4d')]=function(_0x40097d){var _0x7f9726=_[_0x7cf3('0x4e')](_0x40097d);_0x7f9726[_0x7cf3('0x3a')]=0xf;_0x7f9726[_0x7cf3('0x31')]=_0x7cf3('0x4f');return _0x7f9726;};exports['scheduledAt']=function(_0x4b6658,_0x11174a,_0x1d8c03){var _0xd81bda={};_0xd81bda[_0x11174a]=_0x4b6658[_0x11174a];_0xd81bda['active']=![];_0xd81bda['scheduledat']=moment()[_0x7cf3('0x50')](_0x1d8c03,_0x7cf3('0x51'))['format'](_0x7cf3('0x37'));_0xd81bda[_0x7cf3('0x18')]=_0x4b6658[_0x7cf3('0x18')];_0xd81bda[_0x7cf3('0x52')]=_0x4b6658[_0x7cf3('0x52')];_0xd81bda['VoiceQueueId']=_0x4b6658[_0x7cf3('0x19')]||undefined;return _0xd81bda;};exports[_0x7cf3('0x53')]=function(_0x22994f,_0x1bd092){if(!_[_0x7cf3('0x14')](_0x22994f)){if(_0x22994f[_0x7cf3('0x54')]>0x0){_0x22994f[_0x7cf3('0x54')]-=0x1;}else{logger[_0x7cf3('0xb')](_0x1bd092,_0x7cf3('0x55'));}}else{logger[_0x7cf3('0xb')](_0x1bd092,_0x7cf3('0x56'));}};exports['IsNotLoggedIn']=function(_0x1ac0b1){if(_0x1ac0b1<=0x0){return!![];}return![];};exports[_0x7cf3('0x57')]=function(_0x587c24,_0x2c4390){_0x587c24['lastevent']=_0x2c4390;_0x587c24[_0x7cf3('0x17')]=_0x587c24[_0x7cf3('0x58')];_0x587c24[_0x7cf3('0x59')]=_0x587c24['channelAgent'];return _0x587c24;};exports[_0x7cf3('0x5a')]=function(_0x14ee8b){var _0x1153b8={};_0x1153b8[_0x7cf3('0x58')]=_0x14ee8b[_0x7cf3('0x58')];_0x1153b8[_0x7cf3('0x59')]=_0x14ee8b[_0x7cf3('0x44')];_0x1153b8['uniqueid']=_0x14ee8b[_0x7cf3('0x42')];return _0x1153b8;};exports['agentReadyId']=function(_0x1007d0){var _0x3e0bd0=[];for(var _0x22ce86 in _0x1007d0){if(_0x1007d0['hasOwnProperty'](_0x22ce86)){if(!_[_0x7cf3('0x14')](_0x1007d0[_0x22ce86])&&_0x1007d0[_0x22ce86]['state']===_0x7cf3('0x5b')&&_0x1007d0[_0x22ce86][_0x7cf3('0x5c')]===_0x7cf3('0x5d')){_0x3e0bd0[_0x7cf3('0x5e')](_0x1007d0[_0x22ce86]['id']);}}}return _0x3e0bd0;};exports[_0x7cf3('0x5f')]=function(_0x435d6b){var _0x13a876=moment()[_0x7cf3('0x6')](0x0);var _0x1d9c65=moment(_0x435d6b)['milliseconds'](0x0);return _0x13a876[_0x7cf3('0x60')](_0x1d9c65,_0x7cf3('0x61'));};exports[_0x7cf3('0x62')]=function(_0x17beaf){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x17beaf['ContactId'],'ListId':_0x17beaf['ListId'],'VoiceQueueId':_0x17beaf[_0x7cf3('0x19')]||undefined,'CampaignId':_0x17beaf[_0x7cf3('0x63')]||undefined};};exports['filterKey']=function(_0x534bdc){if(_0x534bdc===_0x7cf3('0x42')||_0x534bdc==='idContact'||_0x534bdc===_0x7cf3('0x58')||_0x534bdc===_0x7cf3('0x64')||_0x534bdc===_0x7cf3('0x65')||_0x534bdc===_0x7cf3('0x66')||_0x534bdc===_0x7cf3('0x38')||_0x534bdc===_0x7cf3('0x44')||_0x534bdc===_0x7cf3('0x67')||_0x534bdc===_0x7cf3('0x68')||_0x534bdc===_0x7cf3('0x45')||_0x534bdc==='scheduledat'||_0x534bdc===_0x7cf3('0x49')||_0x534bdc===_0x7cf3('0x4a')||_0x534bdc===_0x7cf3('0x69')||_0x534bdc===_0x7cf3('0x6a')||_0x534bdc===_0x7cf3('0x6b')||_0x534bdc===_0x7cf3('0x6c')||_0x534bdc===_0x7cf3('0x6d')||_0x534bdc==='recallme'||_0x534bdc===_0x7cf3('0x18')||_0x534bdc===_0x7cf3('0x52')||_0x534bdc===_0x7cf3('0x6e')||_0x534bdc==='VoiceQueueId'||_0x534bdc==='sipcallid'||_0x534bdc===_0x7cf3('0x6f')||_0x534bdc===_0x7cf3('0x70')||_0x534bdc==='xmd-phone'||_0x534bdc===_0x7cf3('0x71')||_0x534bdc===_0x7cf3('0x72')||_0x534bdc===_0x7cf3('0x73')||_0x534bdc==='xmd-dialoptions'||_0x534bdc===_0x7cf3('0x74')||_0x534bdc==='xmd-dialchannel'||_0x534bdc===_0x7cf3('0x75')||_0x534bdc===_0x7cf3('0x76')||_0x534bdc===_0x7cf3('0x77')||_0x534bdc==='xmd-agiafter'||_0x534bdc===_0x7cf3('0x78')||_0x534bdc==='rtpaudioqos'||_0x534bdc==='rtpaudioqosbridged'||_0x534bdc===_0x7cf3('0x79')||_0x534bdc==='rtpaudioqosjitterbridged'||_0x534bdc===_0x7cf3('0x7a')||_0x534bdc===_0x7cf3('0x7b')||_0x534bdc===_0x7cf3('0x7c')||_0x534bdc===_0x7cf3('0x7d')||_0x534bdc===_0x7cf3('0x7e')||_0x534bdc===_0x7cf3('0x7f')||_0x534bdc===_0x7cf3('0x79')||_0x534bdc===_0x7cf3('0x80')||_0x534bdc===_0x7cf3('0x7a')||_0x534bdc===_0x7cf3('0x7b')||_0x534bdc===_0x7cf3('0x7c')||_0x534bdc===_0x7cf3('0x7d')||_0x534bdc==='bridgepeer'||_0x534bdc==='bridgepvtcallid'||_0x534bdc==='state'||_0x534bdc===_0x7cf3('0x31')){return![];}return!![];};exports[_0x7cf3('0x81')]=function(_0x231462,_0x76a209){var _0x466d22,_0x5f4a5a,_0x46ec88;if(_0x76a209<=0x0){_0x76a209=0x1;}_0x466d22=new RegExp('\x5cw{0,'+_0x76a209+'}$');_0x5f4a5a=Math[_0x7cf3('0x82')](0xa,_0x76a209-0x1);_0x46ec88=Math['pow'](0xa,_0x76a209)-0x1;return util[_0x7cf3('0x11')]('%s',_[_0x7cf3('0x83')](_0x231462,_0x466d22,_[_0x7cf3('0x84')](_0x5f4a5a,_0x46ec88)));};exports[_0x7cf3('0x85')]=function(_0x322901){var _0x442a6c=_0x322901[_0x7cf3('0x86')](/"(.*?)"/);return _0x442a6c?_0x442a6c[0x1]:_0x322901;};exports[_0x7cf3('0x87')]=function(_0xabfa46){var _0x5ed813=_0xabfa46[_0x7cf3('0x86')](/<(.*?)>/);return _0x5ed813?_0x5ed813[0x1]:_0xabfa46;}; \ No newline at end of file +var _0xef0f=['state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','logCustomer','talktime','answertime','isFailure','variablesAction','BOOKED','uniqueid','originate','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','clone','Global','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','queue','channelAgent','buildAcw','interface','push','getDiff','createBody','filterKey','idContact','type','campaigntype','membername','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosrtt','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','util','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isEmpty','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\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','Contact','hasOwnProperty','%s%s','XMD-','updateOriginated','isNil','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x229128,_0x273558){var _0x1875b9=function(_0x275e35){while(--_0x275e35){_0x229128['push'](_0x229128['shift']());}};_0x1875b9(++_0x273558);}(_0xef0f,0x168));var _0xfef0=function(_0xea6117,_0x58cb1c){_0xea6117=_0xea6117-0x0;var _0x42a6db=_0xef0f[_0xea6117];return _0x42a6db;};'use strict';var util=require(_0xfef0('0x0'));var _=require('lodash');var moment=require(_0xfef0('0x1'));var logger=require(_0xfef0('0x2'))(_0xfef0('0x3'));var ipAgi=process['env'][_0xfef0('0x4')]||_0xfef0('0x5');function getSeconds(_0x4618fb,_0x4e1af6){var _0x2a6fcf=moment(_0x4618fb)[_0xfef0('0x6')](0x0);var _0x2697df=moment(_0x4e1af6)[_0xfef0('0x6')](0x0);return _0x2a6fcf[_0xfef0('0x7')](_0x2697df,_0xfef0('0x8'));}exports['loggerCatch']=function(_0x41ec94){return function(_0x58cf6d){logger[_0xfef0('0x9')](_0x41ec94,util[_0xfef0('0xa')](_0x58cf6d,{'showHidden':![],'depth':null}));};};exports[_0xfef0('0xb')]=function(_0x2d42dc,_0x334e74){logger[_0xfef0('0xc')](_0x2d42dc,util[_0xfef0('0xa')](_0x334e74,{'showHidden':![],'depth':null}));};exports[_0xfef0('0xd')]=function(_0x11bbca,_0x111878){logger[_0xfef0('0x9')](_0x11bbca,util[_0xfef0('0xa')](_0x111878,{'showHidden':![],'depth':null}));};exports[_0xfef0('0xe')]=function(_0x1bdb7b){return function(_0x546c7a){logger[_0xfef0('0xc')](_0x1bdb7b,util[_0xfef0('0xa')](_0x546c7a,{'showHidden':![],'depth':null}));};};exports[_0xfef0('0xf')]=function(_0x30d61d,_0xe9f78d,_0x45599a){return{'message':_0x30d61d,'unlock':_0xe9f78d,'active':_0x45599a};};exports[_0xfef0('0x10')]=function(_0x573ae7,_0x3d1f02,_0x554aaa){if(!_['isUndefined'](_0x554aaa)&&'string'===typeof _0x554aaa&&!_[_0xfef0('0x11')](_0x554aaa)){if(!_[_0xfef0('0x12')](_0x3d1f02)&&_0xfef0('0x13')===typeof _0x3d1f02&&!_[_0xfef0('0x11')](_0x3d1f02)){return util[_0xfef0('0x14')](_0xfef0('0x15'),_0x3d1f02,_0x554aaa);}return util[_0xfef0('0x14')](_0xfef0('0x15'),_0x554aaa,_0x554aaa);}if(!_['isUndefined'](_0x573ae7)&&_0xfef0('0x13')===typeof _0x573ae7&&!_[_0xfef0('0x11')](_0x573ae7)){return _0x573ae7;}return _0xfef0('0x16');};exports[_0xfef0('0x17')]=function(_0x1ad020){if(_['isNil'](_0x1ad020)){return![];}return _0x1ad020;};exports[_0xfef0('0x18')]=function(_0x4e24de,_0x20826b,_0x1a0aa0,_0x28dee1,_0x48408a,_0x2be956){var _0x4c304d={'XMD-QUEUE':_0x20826b[_0xfef0('0x19')]?_0x20826b[_0xfef0('0x19')]['name']:'','XMD-CALLERID':_0x28dee1,'XMD-CALLERID-PREVIEW':_0x2be956?util['format']('\x22%s\x22\x20<%s>',_0x2be956[_0xfef0('0x1a')],_0x2be956['calleridnum']):_0x28dee1,'XMD-DIALID':_0x48408a,'XMD-CONTACTID':_0x20826b[_0xfef0('0x1b')],'XMD-CDRTYPE':_0xfef0('0x1c'),'CALLERID(all)':_0x28dee1,'XMD-VOICEQUEUEID':_0x20826b[_0xfef0('0x1d')],'XMD-DIALCHANNEL':_0x1a0aa0,'XMD-DIALTIMEOUT':_0x4e24de[_0xfef0('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0xfef0('0x14')](_0xfef0('0x1f'),_0x4e24de['dialQueueProject2']?'g':'',_['isEmpty'](_0x4e24de[_0xfef0('0x20')])?'':_0xfef0('0x21')),'XMD-DIALURL':_0x4e24de[_0xfef0('0x22')]||'','XMD-AGI':_0x4e24de[_0xfef0('0x23')]?util[_0xfef0('0x14')](_0xfef0('0x24'),ipAgi,_0x4e24de[_0xfef0('0x23')]):_0xfef0('0x25'),'XMD-AGIAFTER':_0x4e24de[_0xfef0('0x26')]?util['format'](_0xfef0('0x24'),ipAgi,_0x4e24de[_0xfef0('0x26')]):_0xfef0('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x2be956?_0x2be956[_0xfef0('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x2be956?_0x2be956[_0xfef0('0x28')]:'','XMD-DESTINATION':_0xfef0('0x29')};if(!_[_0xfef0('0x11')](_0x4e24de[_0xfef0('0x20')])){_0x4c304d[util[_0xfef0('0x14')]('%s',_0xfef0('0x2a'))]=_0x4e24de[_0xfef0('0x20')];_0x4c304d[util[_0xfef0('0x14')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x48408a;}if(_0x20826b&&_0x20826b[_0xfef0('0x2b')]){for(var _0x5806bd in _0x20826b['Contact']){if(_0x20826b[_0xfef0('0x2b')][_0xfef0('0x2c')](_0x5806bd)){if(!_['isNil'](_0x20826b['Contact'][_0x5806bd])&&_0x5806bd!=='id'&&_0x5806bd!=='tags'&&_0x5806bd!=='createdAt'&&_0x5806bd!=='updatedAt'){_0x4c304d[util[_0xfef0('0x14')](_0xfef0('0x2d'),_0xfef0('0x2e'),_['toUpper'](_0x5806bd))]=_0x20826b['Contact'][_0x5806bd];}}}}return _0x4c304d;};exports['toLowerVariables']=function(_0x1f8110){var _0x55c458={};for(var _0x215032 in _0x1f8110){if(_0x1f8110[_0xfef0('0x2c')](_0x215032)){_0x55c458[util[_0xfef0('0x14')]('%s',_['toLower'](_0x215032))]=_0x1f8110[_0x215032];}}return{'variables':_0x55c458};};exports[_0xfef0('0x2f')]=function(_0x4c3a0f,_0x4234e4){if(!_[_0xfef0('0x30')](_0x4c3a0f)){if(_0x4c3a0f[_0xfef0('0x2c')](_0xfef0('0x31'))){if(_0x4c3a0f[_0xfef0('0x31')]>0x0){_0x4c3a0f[_0xfef0('0x31')]-=0x1;}else{logger[_0xfef0('0x9')](_0xfef0('0x32'),_0x4234e4);}}}else{logger['error'](_0xfef0('0x33'),_0x4234e4);}};exports[_0xfef0('0x34')]=function(_0x388518){var _0x36b2d1=moment()[_0xfef0('0x14')](_0xfef0('0x35'));_0x388518[_0xfef0('0x36')]=0xd;_0x388518[_0xfef0('0x37')]=_0xfef0('0x38');_0x388518[_0xfef0('0x39')]=_0x36b2d1;_0x388518[_0xfef0('0x3a')]=_0x36b2d1;_0x388518[_0xfef0('0x3b')]=_0x36b2d1;};exports[_0xfef0('0x3c')]=function(_0x4a8af4,_0x1f4a1e,_0x4a42a3){var _0x28e5c1=moment()[_0xfef0('0x14')](_0xfef0('0x35'));_0x4a8af4['state']=_0x1f4a1e;_0x4a8af4[_0xfef0('0x37')]=_0x4a42a3;_0x4a8af4[_0xfef0('0x3a')]=_0x28e5c1;_0x4a8af4[_0xfef0('0x3d')]=getSeconds(_0x4a8af4['responsetime'],_0x4a8af4[_0xfef0('0x39')]);};exports[_0xfef0('0x3e')]=function(_0x39b5c2,_0x5577f4,_0x3a6667){_0x39b5c2['membername']=_0x5577f4;_0x39b5c2['UserId']=_0x3a6667;};exports[_0xfef0('0x3f')]=function(_0x547a5d,_0x5c3305,_0xbf6ddd){var _0x61f1ce=moment()[_0xfef0('0x14')](_0xfef0('0x35'));_0x547a5d[_0xfef0('0x36')]=_0x5c3305;_0x547a5d[_0xfef0('0x37')]=_0xbf6ddd;_0x547a5d['responsetime']=_0x547a5d[_0xfef0('0x3a')]?_0x547a5d[_0xfef0('0x3a')]:_0x61f1ce;_0x547a5d['endtime']=_0x547a5d['endtime']?_0x547a5d[_0xfef0('0x3b')]:_0x61f1ce;_0x547a5d['ringtime']=getSeconds(_0x547a5d[_0xfef0('0x3a')]||0x0,_0x547a5d[_0xfef0('0x39')]||0x0);_0x547a5d[_0xfef0('0x40')]=_0x547a5d[_0xfef0('0x41')]?getSeconds(_0x547a5d[_0xfef0('0x3b')],_0x547a5d[_0xfef0('0x41')]):0x0;};exports[_0xfef0('0x42')]=function(_0x15b4a6){return _0x15b4a6==='Failure';};exports[_0xfef0('0x43')]=function(_0x50e372,_0x4b6da1,_0x18c656,_0x17d7f2,_0x5bf416){var _0x2af79f=_0x17d7f2?'RECALL':_0x50e372[_0xfef0('0x1a')];_0x2af79f=_0x5bf416?_0xfef0('0x44'):_0x2af79f;return{'actionid':_0x50e372[_0xfef0('0x45')],'action':_0xfef0('0x46'),'channel':_0x50e372['channelAgent'],'callerid':util[_0xfef0('0x14')](_0xfef0('0x15'),_0x2af79f,_0x50e372['calleridnum']),'Exten':'xcally-motion-preview','Context':_0xfef0('0x47'),'Priority':'1','variable':_0x18c656,'timeout':(_0x4b6da1['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x50e372[_0xfef0('0x45')]};};exports[_0xfef0('0x48')]=function(_0x390247){return _0x390247[_0xfef0('0x49')]+_0x390247[_0xfef0('0x4a')]+_0x390247[_0xfef0('0x4b')]+_0x390247['countagentrejectretry']+_0x390247[_0xfef0('0x4c')];};exports['cloneAction']=function(_0x5a417e){var _0x2f11cb=_[_0xfef0('0x4d')](_0x5a417e);_0x2f11cb[_0xfef0('0x36')]=0xf;_0x2f11cb['statedesc']=_0xfef0('0x4e');return _0x2f11cb;};exports['scheduledAt']=function(_0x5dd26b,_0x51f207,_0x3a475a){var _0x3d471c={};_0x3d471c[_0x51f207]=_0x5dd26b[_0x51f207];_0x3d471c[_0xfef0('0x4f')]=![];_0x3d471c[_0xfef0('0x50')]=moment()[_0xfef0('0x51')](_0x3a475a,_0xfef0('0x52'))[_0xfef0('0x14')](_0xfef0('0x35'));_0x3d471c[_0xfef0('0x1b')]=_0x5dd26b['ContactId'];_0x3d471c['ListId']=_0x5dd26b[_0xfef0('0x53')];_0x3d471c[_0xfef0('0x1d')]=_0x5dd26b[_0xfef0('0x1d')]||undefined;return _0x3d471c;};exports[_0xfef0('0x54')]=function(_0x393fee,_0x1e1458){if(!_[_0xfef0('0x30')](_0x393fee)){if(_0x393fee[_0xfef0('0x55')]>0x0){_0x393fee['pTalking']-=0x1;}else{logger[_0xfef0('0x9')](_0x1e1458,_0xfef0('0x56'));}}else{logger[_0xfef0('0x9')](_0x1e1458,_0xfef0('0x57'));}};exports[_0xfef0('0x58')]=function(_0x5a00db){if(_0x5a00db<=0x0){return!![];}return![];};exports['buildObj']=function(_0x523763,_0x445f3f){_0x523763[_0xfef0('0x59')]=_0x445f3f;_0x523763[_0xfef0('0x5a')]=_0x523763[_0xfef0('0x5b')];_0x523763['interface']=_0x523763[_0xfef0('0x5c')];return _0x523763;};exports[_0xfef0('0x5d')]=function(_0x302908){var _0x28b90c={};_0x28b90c[_0xfef0('0x5b')]=_0x302908[_0xfef0('0x5b')];_0x28b90c[_0xfef0('0x5e')]=_0x302908['channelAgent'];_0x28b90c[_0xfef0('0x45')]=_0x302908[_0xfef0('0x45')];return _0x28b90c;};exports['agentReadyId']=function(_0x291f3f){var _0x59e7c4=[];for(var _0x175e97 in _0x291f3f){if(_0x291f3f[_0xfef0('0x2c')](_0x175e97)){if(!_['isNil'](_0x291f3f[_0x175e97])&&_0x291f3f[_0x175e97][_0xfef0('0x36')]==='not_inuse'&&_0x291f3f[_0x175e97]['status']==='reachable'){_0x59e7c4[_0xfef0('0x5f')](_0x291f3f[_0x175e97]['id']);}}}return _0x59e7c4;};exports[_0xfef0('0x60')]=function(_0x455923){var _0x34fda3=moment()[_0xfef0('0x6')](0x0);var _0x2d63e8=moment(_0x455923)['milliseconds'](0x0);return _0x34fda3[_0xfef0('0x7')](_0x2d63e8,_0xfef0('0x8'));};exports[_0xfef0('0x61')]=function(_0x45abb3){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x45abb3[_0xfef0('0x1b')],'ListId':_0x45abb3['ListId'],'VoiceQueueId':_0x45abb3[_0xfef0('0x1d')]||undefined,'CampaignId':_0x45abb3['CampaignId']||undefined};};exports[_0xfef0('0x62')]=function(_0x5d1c21){if(_0x5d1c21===_0xfef0('0x45')||_0x5d1c21===_0xfef0('0x63')||_0x5d1c21===_0xfef0('0x5b')||_0x5d1c21===_0xfef0('0x64')||_0x5d1c21===_0xfef0('0x65')||_0x5d1c21==='dialAnswer'||_0x5d1c21===_0xfef0('0x66')||_0x5d1c21==='channelAgent'||_0x5d1c21===_0xfef0('0x1a')||_0x5d1c21===_0xfef0('0x4f')||_0x5d1c21==='calleridnum'||_0x5d1c21===_0xfef0('0x50')||_0x5d1c21===_0xfef0('0x49')||_0x5d1c21===_0xfef0('0x4a')||_0x5d1c21===_0xfef0('0x4b')||_0x5d1c21===_0xfef0('0x67')||_0x5d1c21===_0xfef0('0x68')||_0x5d1c21===_0xfef0('0x69')||_0x5d1c21===_0xfef0('0x6a')||_0x5d1c21===_0xfef0('0x6b')||_0x5d1c21===_0xfef0('0x1b')||_0x5d1c21===_0xfef0('0x53')||_0x5d1c21===_0xfef0('0x6c')||_0x5d1c21==='VoiceQueueId'||_0x5d1c21===_0xfef0('0x6d')||_0x5d1c21===_0xfef0('0x6e')||_0x5d1c21===_0xfef0('0x6f')||_0x5d1c21===_0xfef0('0x70')||_0x5d1c21===_0xfef0('0x71')||_0x5d1c21==='xmd-dialurl'||_0x5d1c21===_0xfef0('0x72')||_0x5d1c21===_0xfef0('0x73')||_0x5d1c21===_0xfef0('0x74')||_0x5d1c21===_0xfef0('0x75')||_0x5d1c21===_0xfef0('0x76')||_0x5d1c21===_0xfef0('0x77')||_0x5d1c21===_0xfef0('0x78')||_0x5d1c21===_0xfef0('0x79')||_0x5d1c21===_0xfef0('0x7a')||_0x5d1c21===_0xfef0('0x7b')||_0x5d1c21==='rtpaudioqosbridged'||_0x5d1c21===_0xfef0('0x7c')||_0x5d1c21==='rtpaudioqosjitterbridged'||_0x5d1c21===_0xfef0('0x7d')||_0x5d1c21===_0xfef0('0x7e')||_0x5d1c21==='rtpaudioqosrtt'||_0x5d1c21===_0xfef0('0x7f')||_0x5d1c21===_0xfef0('0x7b')||_0x5d1c21===_0xfef0('0x80')||_0x5d1c21===_0xfef0('0x7c')||_0x5d1c21===_0xfef0('0x81')||_0x5d1c21==='rtpaudioqosloss'||_0x5d1c21===_0xfef0('0x7e')||_0x5d1c21===_0xfef0('0x82')||_0x5d1c21===_0xfef0('0x7f')||_0x5d1c21==='bridgepeer'||_0x5d1c21===_0xfef0('0x83')||_0x5d1c21===_0xfef0('0x36')||_0x5d1c21===_0xfef0('0x37')){return![];}return!![];};exports[_0xfef0('0x84')]=function(_0x7186c8,_0x3cfe32){var _0x45ba65,_0x48c2e1,_0x389181;if(_0x3cfe32<=0x0){_0x3cfe32=0x1;}_0x45ba65=new RegExp(_0xfef0('0x85')+_0x3cfe32+'}$');_0x48c2e1=Math[_0xfef0('0x86')](0xa,_0x3cfe32-0x1);_0x389181=Math[_0xfef0('0x86')](0xa,_0x3cfe32)-0x1;return util[_0xfef0('0x14')]('%s',_[_0xfef0('0x87')](_0x7186c8,_0x45ba65,_['random'](_0x48c2e1,_0x389181)));};exports[_0xfef0('0x88')]=function(_0x3e9a2f){var _0x100fc4=_0x3e9a2f[_0xfef0('0x89')](/"(.*?)"/);return _0x100fc4?_0x100fc4[0x1]:_0x3e9a2f;};exports['extractCalleridNumber']=function(_0x3221a1){var _0x24b25e=_0x3221a1['match'](/<(.*?)>/);return _0x24b25e?_0x24b25e[0x1]:_0x3221a1;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 957149c..f745a9e 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x4bd447,_0x2886c4){var _0x55e3a4=function(_0x50cd1e){while(--_0x50cd1e){_0x4bd447['push'](_0x4bd447['shift']());}};_0x55e3a4(++_0x2886c4);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1e8c3d,_0x378458){_0x1e8c3d=_0x1e8c3d-0x0;var _0x5e29bd=_0x5f2f[_0x1e8c3d];return _0x5e29bd;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x4006c6,_0x200194){var _0x3b634d=function(_0x3ae4f1){while(--_0x3ae4f1){_0x4006c6['push'](_0x4006c6['shift']());}};_0x3b634d(++_0x200194);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5538a,_0x2870b8){_0x5538a=_0x5538a-0x0;var _0x427c68=_0x5f2f[_0x5538a];return _0x427c68;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index be7cd80..a1007dc 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 _0x48c0=['abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','length','isUndefined','initTrunks','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','zohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','seconds','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','faxAccounts','exports','util','lodash','moment','../model/agent','../model/telephone','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','zendeskAccounts','salesforceAccounts','freshdeskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','sumHoldTime','sumDuration','isEmpty','ivrAnswerCallsDay','answered','unmanaged'];(function(_0x52b37e,_0x4b89e4){var _0x52f568=function(_0x203196){while(--_0x203196){_0x52b37e['push'](_0x52b37e['shift']());}};_0x52f568(++_0x4b89e4);}(_0x48c0,0x109));var _0x048c=function(_0x215e65,_0x183f97){_0x215e65=_0x215e65-0x0;var _0xa85842=_0x48c0[_0x215e65];return _0xa85842;};'use strict';var BPromise=require('bluebird');var util=require(_0x048c('0x0'));var _=require(_0x048c('0x1'));var moment=require(_0x048c('0x2'));var Agent=require(_0x048c('0x3'));var Telephone=require(_0x048c('0x4'));var Trunk=require('../model/trunk');var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x048c('0x5'));var Template=require(_0x048c('0x6'));var Campaign=require(_0x048c('0x7'));var VoiceExtension=require(_0x048c('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x048c('0x9'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x048c('0xa'));var ZohoAccount=require(_0x048c('0xb'));var DeskAccount=require(_0x048c('0xc'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x048c('0xd'));var FreshsalesAccount=require(_0x048c('0xe'));var FaxAccount=require(_0x048c('0xf'));var Realtime=function(){this[_0x048c('0x10')]={};this[_0x048c('0x11')]={};this[_0x048c('0x12')]={};this[_0x048c('0x13')]={};this[_0x048c('0x14')]={};this[_0x048c('0x15')]={};this[_0x048c('0x16')]={};this[_0x048c('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x048c('0x18')]={};this[_0x048c('0x19')]={};this[_0x048c('0x1a')]={};this['outboundChannels']={};this['timers']={};this[_0x048c('0x1b')]={};this[_0x048c('0x1c')]={};this['sugarcrmAccounts']={};this[_0x048c('0x1d')]={};this['zohoAccounts']={};this['deskAccounts']={};this['vtigerAccounts']={};this[_0x048c('0x1e')]={};this[_0x048c('0x1f')]={};this[_0x048c('0x20')]={};this['faxAccounts']={};};function freeIsNotKey(_0x28b0b8,_0x58a459,_0x334b57){var _0x46e481=_[_0x048c('0x21')](_0x28b0b8,function(_0x2d30ee,_0x4fa7a9){return _0x2d30ee[_0x334b57];});for(var _0x30aec1 in _0x58a459){if(_0x58a459[_0x048c('0x22')](_0x30aec1)){if(!_0x46e481[_0x30aec1]){delete _0x58a459[_0x30aec1];}}}}function freeIsNotKeySip(_0x448e0c,_0x1432f9){var _0x5482d8=_['mapKeys'](_0x448e0c,function(_0x132cc9,_0x5f05e7){return util[_0x048c('0x23')](_0x048c('0x24'),_0x132cc9[_0x048c('0x25')]);});for(var _0x16119b in _0x1432f9){if(_0x1432f9['hasOwnProperty'](_0x16119b)){if(!_0x5482d8[_0x16119b]){delete _0x1432f9[_0x16119b];}}}}function freeIsNotKeyAgent(_0x3d2158,_0x265296){var _0x46de33=_[_0x048c('0x21')](_0x3d2158,function(_0x49bdda,_0x1d4cd3){var _0x3f4730=_[_0x048c('0x26')](_0x49bdda['interface'])?util[_0x048c('0x23')](_0x048c('0x24'),_0x49bdda[_0x048c('0x25')]):_0x49bdda[_0x048c('0x27')];return _0x3f4730;});for(var _0x27528a in _0x265296){if(_0x265296[_0x048c('0x22')](_0x27528a)){if(!_0x46de33[_0x27528a]){delete _0x265296[_0x27528a];}}}}function clearVoiceCallReports(_0x6d3db){_0x6d3db[_0x048c('0x28')]=0x0;_0x6d3db['answered']=0x0;_0x6d3db[_0x048c('0x29')]=0x0;_0x6d3db[_0x048c('0x2a')]=0x0;_0x6d3db['sumBillable']=0x0;}function clearCampaigns(_0x651b14){if(!_[_0x048c('0x2b')](_0x651b14)){for(var _0x1dfcfe in _0x651b14){if(_0x651b14[_0x048c('0x22')](_0x1dfcfe)){_0x651b14[_0x1dfcfe]['ivrTotalCallsDays']=0x0;_0x651b14[_0x1dfcfe][_0x048c('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x553e92){if(!_[_0x048c('0x2b')](_0x553e92)){for(var _0x5bd144 in _0x553e92){if(_0x553e92['hasOwnProperty'](_0x5bd144)){_0x553e92[_0x5bd144][_0x048c('0x28')]=0x0;_0x553e92[_0x5bd144][_0x048c('0x2d')]=0x0;_0x553e92[_0x5bd144][_0x048c('0x2e')]=0x0;_0x553e92[_0x5bd144][_0x048c('0x2f')]=0x0;_0x553e92[_0x5bd144][_0x048c('0x29')]=0x0;_0x553e92[_0x5bd144][_0x048c('0x2a')]=0x0;_0x553e92[_0x5bd144][_0x048c('0x30')]=0x0;_0x553e92[_0x5bd144][_0x048c('0x31')]=0x0;_0x553e92[_0x5bd144][_0x048c('0x32')]=0x0;_0x553e92[_0x5bd144][_0x048c('0x33')]=0x0;_0x553e92[_0x5bd144][_0x048c('0x34')]=0x0;_0x553e92[_0x5bd144][_0x048c('0x35')]=0x0;_0x553e92[_0x5bd144]['outboundUnknownCallsDay']=0x0;_0x553e92[_0x5bd144]['outboundDropCallsDayTimeout']=0x0;_0x553e92[_0x5bd144][_0x048c('0x36')]=0x0;_0x553e92[_0x5bd144][_0x048c('0x37')]=0x0;_0x553e92[_0x5bd144][_0x048c('0x38')]=0x0;_0x553e92[_0x5bd144]['outboundRejectCallsDay']=0x0;_0x553e92[_0x5bd144]['outboundReCallsDay']=0x0;_0x553e92[_0x5bd144][_0x048c('0x31')]=0x0;_0x553e92[_0x5bd144][_0x048c('0x39')]=0x0;_0x553e92[_0x5bd144][_0x048c('0x3a')]=!![];}}}}Realtime[_0x048c('0x3b')][_0x048c('0x3c')]=function(_0x57ad78,_0x2855ec){for(var _0x17e863 in _0x2855ec){if(_0x57ad78[_0x048c('0x22')](_0x17e863)){_0x57ad78[_0x17e863]=_0x2855ec[_0x17e863];}}};Realtime[_0x048c('0x3b')][_0x048c('0x3d')]=function(){var _0x2558da=this;return function(_0xb5bd1e){if(_0xb5bd1e){freeIsNotKeyAgent(_0xb5bd1e,_0x2558da[_0x048c('0x10')]);for(var _0x271263=0x0,_0xe4a0f9={},_0x316082={};_0x271263<_0xb5bd1e[_0x048c('0x3e')];_0x271263+=0x1){_0xe4a0f9=_0xb5bd1e[_0x271263];var _0x44d154=_['isNil'](_0xe4a0f9[_0x048c('0x27')])?util['format'](_0x048c('0x24'),_0xe4a0f9[_0x048c('0x25')]):_0xe4a0f9['interface'];if(_[_0x048c('0x3f')](_0x2558da[_0x048c('0x10')][_0x44d154])){_0x2558da[_0x048c('0x10')][_0x44d154]=new Agent(_0xe4a0f9);}else{_0x2558da[_0x048c('0x3c')](_0x2558da[_0x048c('0x10')][_0x44d154],_0xe4a0f9);}}}return _0x2558da['agents'];};};Realtime[_0x048c('0x3b')]['initTelephones']=function(){var _0x473efb=this;return function(_0x349ebf){if(_0x349ebf){freeIsNotKeySip(_0x349ebf,_0x473efb[_0x048c('0x11')]);for(var _0x345f08=0x0,_0x3a979a={},_0x4c660f={};_0x345f08<_0x349ebf[_0x048c('0x3e')];_0x345f08+=0x1){_0x3a979a=_0x349ebf[_0x345f08];if(_['isUndefined'](_0x473efb[_0x048c('0x11')][util['format'](_0x048c('0x24'),_0x3a979a[_0x048c('0x25')])])){_0x473efb[_0x048c('0x11')][util[_0x048c('0x23')]('SIP/%s',_0x3a979a['name'])]=new Telephone(_0x3a979a);}else{_0x473efb[_0x048c('0x3c')](_0x473efb['telephones'][util['format']('SIP/%s',_0x3a979a[_0x048c('0x25')])],_0x3a979a);}}}return _0x473efb['telephones'];};};Realtime[_0x048c('0x3b')][_0x048c('0x40')]=function(){var _0x4db45e=this;return function(_0x49adcc){if(_0x49adcc){freeIsNotKeySip(_0x49adcc,_0x4db45e[_0x048c('0x12')]);for(var _0x21c46d=0x0,_0x4d528d={},_0x746e3={};_0x21c46d<_0x49adcc[_0x048c('0x3e')];_0x21c46d+=0x1){_0x4d528d=_0x49adcc[_0x21c46d];if(_['isUndefined'](_0x4db45e['trunks'][util[_0x048c('0x23')]('SIP/%s',_0x4d528d[_0x048c('0x25')])])){_0x4db45e['trunks'][util[_0x048c('0x23')](_0x048c('0x24'),_0x4d528d['name'])]=new Trunk(_0x4d528d);}else{_0x4db45e[_0x048c('0x3c')](_0x4db45e[_0x048c('0x12')][util[_0x048c('0x23')](_0x048c('0x24'),_0x4d528d['name'])],_0x4d528d);}}}return _0x4db45e[_0x048c('0x12')];};};Realtime[_0x048c('0x3b')]['initVoiceQueues']=function(){var _0x2fbdd5=this;return function(_0x5a222b){if(_0x5a222b){freeIsNotKey(_0x5a222b,_0x2fbdd5['voiceQueues'],_0x048c('0x25'));for(var _0x5f1306=0x0,_0x3dbd6e={},_0x3ec833={};_0x5f1306<_0x5a222b['length'];_0x5f1306+=0x1){_0x3dbd6e=_0x5a222b[_0x5f1306];if(_['isUndefined'](_0x2fbdd5[_0x048c('0x13')][_0x3dbd6e[_0x048c('0x25')]])){_0x2fbdd5[_0x048c('0x13')][_0x3dbd6e[_0x048c('0x25')]]=new VoiceQueue(_0x3dbd6e);}else{_0x2fbdd5['mergeFromDatabase'](_0x2fbdd5[_0x048c('0x13')][_0x3dbd6e['name']],_0x3dbd6e);}}}return _0x2fbdd5[_0x048c('0x13')];};};Realtime[_0x048c('0x3b')]['initTriggers']=function(){var _0x312bc0=this;return function(_0x39bb5f){if(_0x39bb5f){freeIsNotKey(_0x39bb5f,_0x312bc0[_0x048c('0x14')],'id');for(var _0x4c10f6=0x0,_0x365ddf={},_0x342a89={};_0x4c10f6<_0x39bb5f['length'];_0x4c10f6+=0x1){_0x365ddf=_0x39bb5f[_0x4c10f6];if(_[_0x048c('0x3f')](_0x312bc0['triggers'][_0x365ddf['id']])){_0x312bc0[_0x048c('0x14')][_0x365ddf['id']]=new Trigger(_0x365ddf);}else{_0x312bc0[_0x048c('0x3c')](_0x312bc0[_0x048c('0x14')][_0x365ddf['id']],_0x365ddf);}}}return _0x312bc0[_0x048c('0x14')];};};Realtime[_0x048c('0x3b')]['initTemplates']=function(){var _0x16bb65=this;return function(_0x52786b){if(_0x52786b){freeIsNotKey(_0x52786b,_0x16bb65['templates'],'id');for(var _0x5421db=0x0,_0x77559f={},_0x1d4dc6={};_0x5421db<_0x52786b[_0x048c('0x3e')];_0x5421db+=0x1){_0x77559f=_0x52786b[_0x5421db];if(_[_0x048c('0x3f')](_0x16bb65['templates'][_0x77559f['id']])){_0x16bb65[_0x048c('0x16')][_0x77559f['id']]=new Template(_0x77559f);}else{_0x16bb65[_0x048c('0x3c')](_0x16bb65[_0x048c('0x16')][_0x77559f['id']],_0x77559f);}}}return _0x16bb65['templates'];};};Realtime[_0x048c('0x3b')][_0x048c('0x41')]=function(){var _0x42f4b5=this;return function(_0x320ca1){if(_0x320ca1){freeIsNotKey(_0x320ca1,_0x42f4b5['zendeskAccounts'],'id');for(var _0x28f8e8=0x0,_0x419f23={},_0x5a5403={};_0x28f8e8<_0x320ca1[_0x048c('0x3e')];_0x28f8e8+=0x1){_0x419f23=_0x320ca1[_0x28f8e8];if(_[_0x048c('0x3f')](_0x42f4b5[_0x048c('0x1b')][_0x419f23['id']])){_0x42f4b5[_0x048c('0x1b')][_0x419f23['id']]=new ZendeskAccount(_0x419f23);}else{_0x42f4b5['mergeFromDatabase'](_0x42f4b5[_0x048c('0x1b')][_0x419f23['id']],_0x419f23);}}}return _0x42f4b5[_0x048c('0x1b')];};};Realtime[_0x048c('0x3b')][_0x048c('0x42')]=function(){var _0x4f1811=this;return function(_0x2fe2a1){if(_0x2fe2a1){freeIsNotKey(_0x2fe2a1,_0x4f1811['salesforceAccounts'],'id');for(var _0x375861=0x0,_0x44134c={},_0x29118d={};_0x375861<_0x2fe2a1[_0x048c('0x3e')];_0x375861+=0x1){_0x44134c=_0x2fe2a1[_0x375861];if(_[_0x048c('0x3f')](_0x4f1811[_0x048c('0x1c')][_0x44134c['id']])){_0x4f1811[_0x048c('0x1c')][_0x44134c['id']]=new SalesforceAccount(_0x44134c);}else{_0x4f1811[_0x048c('0x3c')](_0x4f1811[_0x048c('0x1c')][_0x44134c['id']],_0x44134c);}}}return _0x4f1811[_0x048c('0x1c')];};};Realtime['prototype'][_0x048c('0x43')]=function(){var _0x210dbd=this;return function(_0x105754){if(_0x105754){freeIsNotKey(_0x105754,_0x210dbd[_0x048c('0x1d')],'id');for(var _0x2638d7=0x0,_0x364478={},_0x1b71e5={};_0x2638d7<_0x105754[_0x048c('0x3e')];_0x2638d7+=0x1){_0x364478=_0x105754[_0x2638d7];if(_[_0x048c('0x3f')](_0x210dbd['freshdeskAccounts'][_0x364478['id']])){_0x210dbd[_0x048c('0x1d')][_0x364478['id']]=new FreshdeskAccount(_0x364478);}else{_0x210dbd['mergeFromDatabase'](_0x210dbd[_0x048c('0x1d')][_0x364478['id']],_0x364478);}}}return _0x210dbd[_0x048c('0x1d')];};};Realtime[_0x048c('0x3b')]['initZohoAccounts']=function(){var _0x23cb60=this;return function(_0x4ac3c8){if(_0x4ac3c8){freeIsNotKey(_0x4ac3c8,_0x23cb60[_0x048c('0x44')],'id');for(var _0x480c21=0x0,_0x15cc8c={},_0x1e52cf={};_0x480c21<_0x4ac3c8[_0x048c('0x3e')];_0x480c21+=0x1){_0x15cc8c=_0x4ac3c8[_0x480c21];if(_['isUndefined'](_0x23cb60['zohoAccounts'][_0x15cc8c['id']])){_0x23cb60[_0x048c('0x44')][_0x15cc8c['id']]=new ZohoAccount(_0x15cc8c);}else{_0x23cb60[_0x048c('0x3c')](_0x23cb60['zohoAccounts'][_0x15cc8c['id']],_0x15cc8c);}}}return _0x23cb60[_0x048c('0x44')];};};Realtime[_0x048c('0x3b')][_0x048c('0x45')]=function(){var _0x390b71=this;return function(_0x2cbf2f){if(_0x2cbf2f){freeIsNotKey(_0x2cbf2f,_0x390b71[_0x048c('0x46')],'id');for(var _0x198cb2=0x0,_0x229e09={},_0x212ef6={};_0x198cb2<_0x2cbf2f[_0x048c('0x3e')];_0x198cb2+=0x1){_0x229e09=_0x2cbf2f[_0x198cb2];if(_[_0x048c('0x3f')](_0x390b71[_0x048c('0x46')][_0x229e09['id']])){_0x390b71['deskAccounts'][_0x229e09['id']]=new DeskAccount(_0x229e09);}else{_0x390b71[_0x048c('0x3c')](_0x390b71[_0x048c('0x46')][_0x229e09['id']],_0x229e09);}}}return _0x390b71[_0x048c('0x46')];};};Realtime[_0x048c('0x3b')][_0x048c('0x47')]=function(){var _0x29a2c8=this;return function(_0x10b8fb){if(_0x10b8fb){freeIsNotKey(_0x10b8fb,_0x29a2c8[_0x048c('0x48')],'id');for(var _0x1c28b2=0x0,_0xabc038={},_0x1e28db={};_0x1c28b2<_0x10b8fb[_0x048c('0x3e')];_0x1c28b2+=0x1){_0xabc038=_0x10b8fb[_0x1c28b2];if(_['isUndefined'](_0x29a2c8[_0x048c('0x48')][_0xabc038['id']])){_0x29a2c8[_0x048c('0x48')][_0xabc038['id']]=new SugarcrmAccount(_0xabc038);}else{_0x29a2c8[_0x048c('0x3c')](_0x29a2c8['sugarcrmAccounts'][_0xabc038['id']],_0xabc038);}}}return _0x29a2c8[_0x048c('0x48')];};};Realtime[_0x048c('0x3b')][_0x048c('0x49')]=function(){var _0x1038fc=this;return function(_0xc0128f){if(_0xc0128f){freeIsNotKey(_0xc0128f,_0x1038fc[_0x048c('0x4a')],'id');for(var _0x34bfae=0x0,_0x4fd5b3={},_0x20344a={};_0x34bfae<_0xc0128f[_0x048c('0x3e')];_0x34bfae+=0x1){_0x4fd5b3=_0xc0128f[_0x34bfae];if(_[_0x048c('0x3f')](_0x1038fc['vtigerAccounts'][_0x4fd5b3['id']])){_0x1038fc[_0x048c('0x4a')][_0x4fd5b3['id']]=new VtigerAccount(_0x4fd5b3);}else{_0x1038fc[_0x048c('0x3c')](_0x1038fc[_0x048c('0x4a')][_0x4fd5b3['id']],_0x4fd5b3);}}}return _0x1038fc['vtigerAccounts'];};};Realtime[_0x048c('0x3b')][_0x048c('0x4b')]=function(){var _0x5397db=this;return function(_0x495439){if(_0x495439){freeIsNotKey(_0x495439,_0x5397db[_0x048c('0x1e')],'id');for(var _0x5c8204=0x0,_0x303ab3={},_0x24da70={};_0x5c8204<_0x495439['length'];_0x5c8204+=0x1){_0x303ab3=_0x495439[_0x5c8204];if(_[_0x048c('0x3f')](_0x5397db[_0x048c('0x1e')][_0x303ab3['id']])){_0x5397db[_0x048c('0x1e')][_0x303ab3['id']]=new ServicenowAccount(_0x303ab3);}else{_0x5397db[_0x048c('0x3c')](_0x5397db[_0x048c('0x1e')][_0x303ab3['id']],_0x303ab3);}}}return _0x5397db[_0x048c('0x1e')];};};Realtime[_0x048c('0x3b')][_0x048c('0x4c')]=function(){var _0x23d3eb=this;return function(_0x1dd186){if(_0x1dd186){freeIsNotKey(_0x1dd186,_0x23d3eb[_0x048c('0x1f')],'id');for(var _0x16bee5=0x0,_0x8ca88={},_0x2ba3f7={};_0x16bee5<_0x1dd186[_0x048c('0x3e')];_0x16bee5+=0x1){_0x8ca88=_0x1dd186[_0x16bee5];if(_[_0x048c('0x3f')](_0x23d3eb['dynamics365Accounts'][_0x8ca88['id']])){_0x23d3eb[_0x048c('0x1f')][_0x8ca88['id']]=new Dynamics365Account(_0x8ca88);}else{_0x23d3eb[_0x048c('0x3c')](_0x23d3eb[_0x048c('0x1f')][_0x8ca88['id']],_0x8ca88);}}}return _0x23d3eb[_0x048c('0x1f')];};};Realtime[_0x048c('0x3b')]['initFreshsalesAccounts']=function(){var _0x50bfb4=this;return function(_0x3efbb3){if(_0x3efbb3){freeIsNotKey(_0x3efbb3,_0x50bfb4[_0x048c('0x20')],'id');for(var _0x19fc6a=0x0,_0x1b0331={},_0x222385={};_0x19fc6a<_0x3efbb3[_0x048c('0x3e')];_0x19fc6a+=0x1){_0x1b0331=_0x3efbb3[_0x19fc6a];if(_[_0x048c('0x3f')](_0x50bfb4[_0x048c('0x20')][_0x1b0331['id']])){_0x50bfb4[_0x048c('0x20')][_0x1b0331['id']]=new FreshsalesAccount(_0x1b0331);}else{_0x50bfb4[_0x048c('0x3c')](_0x50bfb4['freshsalesAccounts'][_0x1b0331['id']],_0x1b0331);}}}return _0x50bfb4[_0x048c('0x20')];};};Realtime[_0x048c('0x3b')]['initVoiceQueueHopperHistory']=function(){var _0x176749=this;return function(_0x37ddfe){for(var _0x44e097=0x0;_0x44e097<_0x37ddfe[_0x048c('0x3e')];_0x44e097+=0x1){_['merge'](_0x176749[_0x048c('0x13')][_0x37ddfe[_0x44e097][_0x048c('0x25')]],_0x37ddfe[_0x44e097]);}return _0x176749[_0x048c('0x13')];};};Realtime[_0x048c('0x3b')][_0x048c('0x4d')]=function(){var _0x55b3a5=this;return function(_0x3d4111){clearVoiceQueues(_0x55b3a5[_0x048c('0x13')]);if(_0x3d4111){_0x3d4111=_[_0x048c('0x4e')](_0x3d4111,_0x048c('0x4f'));for(var _0x1f798a in _0x3d4111){if(_0x3d4111[_0x048c('0x22')](_0x1f798a)){var _0xa3559c={};for(var _0x2f6b9f=0x0;_0x2f6b9f<_0x3d4111[_0x1f798a][_0x048c('0x3e')];_0x2f6b9f+=0x1){var _0x2bc0c1=_0x3d4111[_0x1f798a][_0x2f6b9f][_0x048c('0x50')];if(_0x55b3a5['voiceQueues'][_0x2bc0c1]){if(_0x3d4111[_0x1f798a][_0x2f6b9f][_0x048c('0x51')]){_0x55b3a5[_0x048c('0x13')][_0x2bc0c1][_0x048c('0x2e')]+=0x1;}if(_0x3d4111[_0x1f798a][_0x2f6b9f][_0x048c('0x52')]){_0x55b3a5[_0x048c('0x13')][_0x2bc0c1][_0x048c('0x2f')]+=0x1;}_0x55b3a5['voiceQueues'][_0x2bc0c1][_0x048c('0x29')]+=moment(_0x3d4111[_0x1f798a][_0x2f6b9f][_0x048c('0x53')])[_0x048c('0x54')](moment(_0x3d4111[_0x1f798a][_0x2f6b9f][_0x048c('0x55')]),'seconds')||0x0;if(_0x2f6b9f===_0x3d4111[_0x1f798a]['length']-0x1){_0x55b3a5[_0x048c('0x13')][_0x2bc0c1][_0x048c('0x2a')]+=moment(_0x3d4111[_0x1f798a][_0x2f6b9f][_0x048c('0x56')]||_0x3d4111[_0x1f798a][_0x2f6b9f][_0x048c('0x57')]||_0x3d4111[_0x1f798a][_0x2f6b9f]['queuecallerexitAt'])[_0x048c('0x54')](moment(_0x3d4111[_0x1f798a][_0x2f6b9f][_0x048c('0x55')]),_0x048c('0x58'))||0x0;_0x55b3a5[_0x048c('0x13')][_0x2bc0c1][_0x048c('0x28')]+=0x1;if(_0x3d4111[_0x1f798a][_0x2f6b9f][_0x048c('0x59')]){_0x55b3a5[_0x048c('0x13')][_0x2bc0c1][_0x048c('0x2d')]+=0x1;_0x55b3a5['voiceQueues'][_0x2bc0c1][_0x048c('0x30')]+=moment(_0x3d4111[_0x1f798a][_0x2f6b9f][_0x048c('0x56')])[_0x048c('0x54')](moment(_0x3d4111[_0x1f798a][_0x2f6b9f][_0x048c('0x53')]),_0x048c('0x58'))||0x0;}}else{_0x55b3a5['voiceQueues'][_0x2bc0c1][_0x048c('0x2a')]+=_0x55b3a5[_0x048c('0x13')][_0x2bc0c1][_0x048c('0x29')]||0x0;}}}}}}return _0x55b3a5[_0x048c('0x13')];};};Realtime[_0x048c('0x3b')][_0x048c('0x5a')]=function(){var _0x3b0370=this;return function(_0x1d8393){clearVoiceCallReports(_0x3b0370[_0x048c('0x17')]);if(_0x1d8393){for(var _0x1712f8=0x0;_0x1712f8<_0x1d8393[_0x048c('0x3e')];_0x1712f8+=0x1){_0x3b0370[_0x048c('0x17')][_0x048c('0x28')]+=0x1;_0x3b0370[_0x048c('0x17')][_0x048c('0x2a')]+=_0x1d8393[_0x1712f8][_0x048c('0x5b')];if(_0x1d8393[_0x1712f8][_0x048c('0x5c')]===_0x048c('0x5d')){_0x3b0370[_0x048c('0x17')][_0x048c('0x2d')]+=0x1;_0x3b0370[_0x048c('0x17')][_0x048c('0x29')]+=_0x1d8393[_0x1712f8]['duration']-_0x1d8393[_0x1712f8][_0x048c('0x5e')]||0x0;_0x3b0370['outbound'][_0x048c('0x30')]+=_0x1d8393[_0x1712f8][_0x048c('0x5e')];}}}return _0x3b0370[_0x048c('0x17')];};};Realtime[_0x048c('0x3b')][_0x048c('0x5f')]=function(){var _0xe100a2=this;return function(_0x4ff9d0){if(_0x4ff9d0){freeIsNotKey(_0x4ff9d0,_0xe100a2[_0x048c('0x15')],_0x048c('0x25'));for(var _0x1c0146=0x0,_0xd5bbe5={};_0x1c0146<_0x4ff9d0[_0x048c('0x3e')];_0x1c0146+=0x1){_0xd5bbe5=_0x4ff9d0[_0x1c0146];if(_[_0x048c('0x3f')](_0xe100a2[_0x048c('0x15')][_0xd5bbe5[_0x048c('0x25')]])){_0xe100a2[_0x048c('0x15')][_0xd5bbe5['name']]=new Campaign(_0xd5bbe5);}else{_0xe100a2[_0x048c('0x3c')](_0xe100a2[_0x048c('0x15')][_0xd5bbe5['name']],_0xd5bbe5);_0xe100a2[_0x048c('0x15')][_0xd5bbe5[_0x048c('0x25')]][_0x048c('0x60')]=_0xd5bbe5['SquareProject']?_0xd5bbe5[_0x048c('0x61')][_0x048c('0x25')]:undefined;}}}return _0xe100a2[_0x048c('0x15')];};};Realtime['prototype'][_0x048c('0x62')]=function(){var _0x2acb20=this;return function(_0x480a61){if(_0x480a61){freeIsNotKey(_0x480a61,_0x2acb20[_0x048c('0x18')],'id');for(var _0x5518d6=0x0,_0x298d33={};_0x5518d6<_0x480a61[_0x048c('0x3e')];_0x5518d6+=0x1){_0x298d33=_0x480a61[_0x5518d6];if(_[_0x048c('0x3f')](_0x2acb20[_0x048c('0x18')][_0x298d33['id']])){_0x2acb20[_0x048c('0x18')][_0x298d33['id']]=new VoiceExtension(_0x298d33);}else{_0x2acb20[_0x048c('0x3c')](_0x2acb20[_0x048c('0x18')][_0x298d33['id']],_0x298d33);}}}return _0x2acb20['voiceExtensions'];};};Realtime['prototype'][_0x048c('0x63')]=function(){var _0x1b5027=this;return function(_0x4fc45d){clearCampaigns(_0x1b5027['campaigns']);for(var _0x510a0c=0x0;_0x510a0c<_0x4fc45d[_0x048c('0x3e')];_0x510a0c+=0x1){_[_0x048c('0x64')](_0x1b5027[_0x048c('0x15')][_0x4fc45d[_0x510a0c][_0x048c('0x25')]],_0x4fc45d[_0x510a0c]);}return _0x1b5027[_0x048c('0x15')];};};Realtime[_0x048c('0x3b')][_0x048c('0x65')]=function(){var _0xcf72ac=this;return function(_0x57fcf7){if(_0x57fcf7){freeIsNotKey(_0x57fcf7,_0xcf72ac[_0x048c('0x66')],'id');for(var _0x25e71f=0x0,_0xa9c1bc={},_0x16bb48={};_0x25e71f<_0x57fcf7[_0x048c('0x3e')];_0x25e71f+=0x1){_0xa9c1bc=_0x57fcf7[_0x25e71f];if(_[_0x048c('0x3f')](_0xcf72ac[_0x048c('0x66')][_0xa9c1bc['id']])){_0xcf72ac['faxAccounts'][_0xa9c1bc['id']]=new FaxAccount(_0xa9c1bc);}else{_0xcf72ac[_0x048c('0x3c')](_0xcf72ac[_0x048c('0x66')][_0xa9c1bc['id']],_0xa9c1bc);}}}return _0xcf72ac[_0x048c('0x66')];};};module[_0x048c('0x67')]=Realtime; \ No newline at end of file +var _0xeae4=['initVoiceExtensions','faxAccounts','exports','util','lodash','moment','../model/telephone','../model/trunk','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','hasOwnProperty','mapKeys','format','SIP/%s','name','interface','sumDuration','sumBillable','ivrTotalCallsDays','isEmpty','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','initAgents','length','isNil','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTriggers','initTemplates','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','total','queuecallercomplete','initVoiceCallReports','disposition','duration','billableseconds','initCampaigns','SquareProject'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xeae4,0x13b));var _0x4eae=function(_0x5ab463,_0x1dc76a){_0x5ab463=_0x5ab463-0x0;var _0xf6b784=_0xeae4[_0x5ab463];return _0xf6b784;};'use strict';var BPromise=require('bluebird');var util=require(_0x4eae('0x0'));var _=require(_0x4eae('0x1'));var moment=require(_0x4eae('0x2'));var Agent=require('../model/agent');var Telephone=require(_0x4eae('0x3'));var Trunk=require(_0x4eae('0x4'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require('../model/trigger');var Template=require('../model/template');var Campaign=require(_0x4eae('0x5'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x4eae('0x6'));var SalesforceAccount=require(_0x4eae('0x7'));var FreshdeskAccount=require(_0x4eae('0x8'));var SugarcrmAccount=require(_0x4eae('0x9'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x4eae('0xa'));var VtigerAccount=require(_0x4eae('0xb'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x4eae('0xc'));var FreshsalesAccount=require(_0x4eae('0xd'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x4eae('0xe')]={};this[_0x4eae('0xf')]={};this[_0x4eae('0x10')]={};this[_0x4eae('0x11')]={};this[_0x4eae('0x12')]={};this[_0x4eae('0x13')]={};this[_0x4eae('0x14')]={};this[_0x4eae('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x4eae('0x16')]={};this[_0x4eae('0x17')]={};this[_0x4eae('0x18')]={};this['outboundChannels']={};this['timers']={};this[_0x4eae('0x19')]={};this[_0x4eae('0x1a')]={};this[_0x4eae('0x1b')]={};this[_0x4eae('0x1c')]={};this[_0x4eae('0x1d')]={};this['deskAccounts']={};this['vtigerAccounts']={};this[_0x4eae('0x1e')]={};this[_0x4eae('0x1f')]={};this[_0x4eae('0x20')]={};this['faxAccounts']={};};function freeIsNotKey(_0x54ff48,_0x306f68,_0x293ccd){var _0x19ad93=_['mapKeys'](_0x54ff48,function(_0x3edb9b,_0x467e87){return _0x3edb9b[_0x293ccd];});for(var _0x163be7 in _0x306f68){if(_0x306f68[_0x4eae('0x21')](_0x163be7)){if(!_0x19ad93[_0x163be7]){delete _0x306f68[_0x163be7];}}}}function freeIsNotKeySip(_0xf8a600,_0x462209){var _0x436903=_[_0x4eae('0x22')](_0xf8a600,function(_0x20886d,_0x21337a){return util[_0x4eae('0x23')](_0x4eae('0x24'),_0x20886d[_0x4eae('0x25')]);});for(var _0x1c6402 in _0x462209){if(_0x462209[_0x4eae('0x21')](_0x1c6402)){if(!_0x436903[_0x1c6402]){delete _0x462209[_0x1c6402];}}}}function freeIsNotKeyAgent(_0x2229da,_0x569377){var _0x25e9de=_[_0x4eae('0x22')](_0x2229da,function(_0x1fc24f,_0x319d34){var _0xb27c6d=_['isNil'](_0x1fc24f[_0x4eae('0x26')])?util[_0x4eae('0x23')](_0x4eae('0x24'),_0x1fc24f[_0x4eae('0x25')]):_0x1fc24f[_0x4eae('0x26')];return _0xb27c6d;});for(var _0x585509 in _0x569377){if(_0x569377['hasOwnProperty'](_0x585509)){if(!_0x25e9de[_0x585509]){delete _0x569377[_0x585509];}}}}function clearVoiceCallReports(_0x389973){_0x389973['total']=0x0;_0x389973['answered']=0x0;_0x389973['sumHoldTime']=0x0;_0x389973[_0x4eae('0x27')]=0x0;_0x389973[_0x4eae('0x28')]=0x0;}function clearCampaigns(_0x52c6b8){if(!_['isEmpty'](_0x52c6b8)){for(var _0x230d7f in _0x52c6b8){if(_0x52c6b8[_0x4eae('0x21')](_0x230d7f)){_0x52c6b8[_0x230d7f][_0x4eae('0x29')]=0x0;_0x52c6b8[_0x230d7f]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x252004){if(!_[_0x4eae('0x2a')](_0x252004)){for(var _0x51ae86 in _0x252004){if(_0x252004[_0x4eae('0x21')](_0x51ae86)){_0x252004[_0x51ae86]['total']=0x0;_0x252004[_0x51ae86]['answered']=0x0;_0x252004[_0x51ae86][_0x4eae('0x2b')]=0x0;_0x252004[_0x51ae86][_0x4eae('0x2c')]=0x0;_0x252004[_0x51ae86][_0x4eae('0x2d')]=0x0;_0x252004[_0x51ae86]['sumDuration']=0x0;_0x252004[_0x51ae86][_0x4eae('0x28')]=0x0;_0x252004[_0x51ae86][_0x4eae('0x2e')]=0x0;_0x252004[_0x51ae86][_0x4eae('0x2f')]=0x0;_0x252004[_0x51ae86]['outboundBusyCallsDay']=0x0;_0x252004[_0x51ae86][_0x4eae('0x30')]=0x0;_0x252004[_0x51ae86][_0x4eae('0x31')]=0x0;_0x252004[_0x51ae86][_0x4eae('0x32')]=0x0;_0x252004[_0x51ae86][_0x4eae('0x33')]=0x0;_0x252004[_0x51ae86][_0x4eae('0x34')]=0x0;_0x252004[_0x51ae86][_0x4eae('0x35')]=0x0;_0x252004[_0x51ae86][_0x4eae('0x36')]=0x0;_0x252004[_0x51ae86][_0x4eae('0x37')]=0x0;_0x252004[_0x51ae86][_0x4eae('0x38')]=0x0;_0x252004[_0x51ae86]['outboundAnswerAgiCallsDay']=0x0;_0x252004[_0x51ae86][_0x4eae('0x39')]=0x0;_0x252004[_0x51ae86]['queueStatusComplete']=!![];}}}}Realtime[_0x4eae('0x3a')][_0x4eae('0x3b')]=function(_0x25ee43,_0x185389){for(var _0x246b83 in _0x185389){if(_0x25ee43[_0x4eae('0x21')](_0x246b83)){_0x25ee43[_0x246b83]=_0x185389[_0x246b83];}}};Realtime['prototype'][_0x4eae('0x3c')]=function(){var _0x206145=this;return function(_0x73f085){if(_0x73f085){freeIsNotKeyAgent(_0x73f085,_0x206145[_0x4eae('0xe')]);for(var _0x23ebfb=0x0,_0x1a5d7e={},_0x4509eb={};_0x23ebfb<_0x73f085[_0x4eae('0x3d')];_0x23ebfb+=0x1){_0x1a5d7e=_0x73f085[_0x23ebfb];var _0x4c1cfb=_[_0x4eae('0x3e')](_0x1a5d7e[_0x4eae('0x26')])?util[_0x4eae('0x23')]('SIP/%s',_0x1a5d7e[_0x4eae('0x25')]):_0x1a5d7e['interface'];if(_[_0x4eae('0x3f')](_0x206145[_0x4eae('0xe')][_0x4c1cfb])){_0x206145[_0x4eae('0xe')][_0x4c1cfb]=new Agent(_0x1a5d7e);}else{_0x206145[_0x4eae('0x3b')](_0x206145[_0x4eae('0xe')][_0x4c1cfb],_0x1a5d7e);}}}return _0x206145[_0x4eae('0xe')];};};Realtime['prototype'][_0x4eae('0x40')]=function(){var _0x528d8c=this;return function(_0x19a96c){if(_0x19a96c){freeIsNotKeySip(_0x19a96c,_0x528d8c[_0x4eae('0xf')]);for(var _0x42c6ac=0x0,_0x13237c={},_0x3c4d2d={};_0x42c6ac<_0x19a96c[_0x4eae('0x3d')];_0x42c6ac+=0x1){_0x13237c=_0x19a96c[_0x42c6ac];if(_[_0x4eae('0x3f')](_0x528d8c[_0x4eae('0xf')][util[_0x4eae('0x23')](_0x4eae('0x24'),_0x13237c[_0x4eae('0x25')])])){_0x528d8c[_0x4eae('0xf')][util['format'](_0x4eae('0x24'),_0x13237c[_0x4eae('0x25')])]=new Telephone(_0x13237c);}else{_0x528d8c[_0x4eae('0x3b')](_0x528d8c['telephones'][util[_0x4eae('0x23')]('SIP/%s',_0x13237c[_0x4eae('0x25')])],_0x13237c);}}}return _0x528d8c[_0x4eae('0xf')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x41')]=function(){var _0x3e1da9=this;return function(_0x488606){if(_0x488606){freeIsNotKeySip(_0x488606,_0x3e1da9[_0x4eae('0x10')]);for(var _0x5ab396=0x0,_0x113246={},_0x5ac4c4={};_0x5ab396<_0x488606['length'];_0x5ab396+=0x1){_0x113246=_0x488606[_0x5ab396];if(_[_0x4eae('0x3f')](_0x3e1da9[_0x4eae('0x10')][util[_0x4eae('0x23')](_0x4eae('0x24'),_0x113246[_0x4eae('0x25')])])){_0x3e1da9[_0x4eae('0x10')][util['format']('SIP/%s',_0x113246[_0x4eae('0x25')])]=new Trunk(_0x113246);}else{_0x3e1da9['mergeFromDatabase'](_0x3e1da9[_0x4eae('0x10')][util[_0x4eae('0x23')]('SIP/%s',_0x113246[_0x4eae('0x25')])],_0x113246);}}}return _0x3e1da9[_0x4eae('0x10')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x42')]=function(){var _0x1a8ad8=this;return function(_0x18188b){if(_0x18188b){freeIsNotKey(_0x18188b,_0x1a8ad8[_0x4eae('0x11')],_0x4eae('0x25'));for(var _0x51f29e=0x0,_0x37e68e={},_0x513c93={};_0x51f29e<_0x18188b[_0x4eae('0x3d')];_0x51f29e+=0x1){_0x37e68e=_0x18188b[_0x51f29e];if(_[_0x4eae('0x3f')](_0x1a8ad8['voiceQueues'][_0x37e68e['name']])){_0x1a8ad8[_0x4eae('0x11')][_0x37e68e['name']]=new VoiceQueue(_0x37e68e);}else{_0x1a8ad8['mergeFromDatabase'](_0x1a8ad8[_0x4eae('0x11')][_0x37e68e[_0x4eae('0x25')]],_0x37e68e);}}}return _0x1a8ad8[_0x4eae('0x11')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x43')]=function(){var _0x21d990=this;return function(_0x2b1f35){if(_0x2b1f35){freeIsNotKey(_0x2b1f35,_0x21d990[_0x4eae('0x12')],'id');for(var _0x4d6916=0x0,_0x43dfd5={},_0x48c76b={};_0x4d6916<_0x2b1f35['length'];_0x4d6916+=0x1){_0x43dfd5=_0x2b1f35[_0x4d6916];if(_[_0x4eae('0x3f')](_0x21d990['triggers'][_0x43dfd5['id']])){_0x21d990['triggers'][_0x43dfd5['id']]=new Trigger(_0x43dfd5);}else{_0x21d990[_0x4eae('0x3b')](_0x21d990[_0x4eae('0x12')][_0x43dfd5['id']],_0x43dfd5);}}}return _0x21d990[_0x4eae('0x12')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x44')]=function(){var _0x1d4456=this;return function(_0x5ef392){if(_0x5ef392){freeIsNotKey(_0x5ef392,_0x1d4456[_0x4eae('0x14')],'id');for(var _0x4cd617=0x0,_0x52cf7d={},_0xab7b75={};_0x4cd617<_0x5ef392[_0x4eae('0x3d')];_0x4cd617+=0x1){_0x52cf7d=_0x5ef392[_0x4cd617];if(_[_0x4eae('0x3f')](_0x1d4456[_0x4eae('0x14')][_0x52cf7d['id']])){_0x1d4456[_0x4eae('0x14')][_0x52cf7d['id']]=new Template(_0x52cf7d);}else{_0x1d4456[_0x4eae('0x3b')](_0x1d4456[_0x4eae('0x14')][_0x52cf7d['id']],_0x52cf7d);}}}return _0x1d4456[_0x4eae('0x14')];};};Realtime[_0x4eae('0x3a')]['initZendeskAccounts']=function(){var _0x47d5e2=this;return function(_0x54bd4a){if(_0x54bd4a){freeIsNotKey(_0x54bd4a,_0x47d5e2[_0x4eae('0x19')],'id');for(var _0x3ac8be=0x0,_0x30cc4c={},_0x9f8b17={};_0x3ac8be<_0x54bd4a[_0x4eae('0x3d')];_0x3ac8be+=0x1){_0x30cc4c=_0x54bd4a[_0x3ac8be];if(_[_0x4eae('0x3f')](_0x47d5e2['zendeskAccounts'][_0x30cc4c['id']])){_0x47d5e2[_0x4eae('0x19')][_0x30cc4c['id']]=new ZendeskAccount(_0x30cc4c);}else{_0x47d5e2[_0x4eae('0x3b')](_0x47d5e2[_0x4eae('0x19')][_0x30cc4c['id']],_0x30cc4c);}}}return _0x47d5e2[_0x4eae('0x19')];};};Realtime[_0x4eae('0x3a')]['initSalesforceAccounts']=function(){var _0x5d5ec7=this;return function(_0x234cbe){if(_0x234cbe){freeIsNotKey(_0x234cbe,_0x5d5ec7[_0x4eae('0x1a')],'id');for(var _0x50e88e=0x0,_0x563bdd={},_0x52c1fe={};_0x50e88e<_0x234cbe[_0x4eae('0x3d')];_0x50e88e+=0x1){_0x563bdd=_0x234cbe[_0x50e88e];if(_[_0x4eae('0x3f')](_0x5d5ec7[_0x4eae('0x1a')][_0x563bdd['id']])){_0x5d5ec7[_0x4eae('0x1a')][_0x563bdd['id']]=new SalesforceAccount(_0x563bdd);}else{_0x5d5ec7[_0x4eae('0x3b')](_0x5d5ec7[_0x4eae('0x1a')][_0x563bdd['id']],_0x563bdd);}}}return _0x5d5ec7['salesforceAccounts'];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x45')]=function(){var _0x16e82d=this;return function(_0x3628c4){if(_0x3628c4){freeIsNotKey(_0x3628c4,_0x16e82d[_0x4eae('0x1c')],'id');for(var _0x13f3a9=0x0,_0x4b2efe={},_0xce1637={};_0x13f3a9<_0x3628c4[_0x4eae('0x3d')];_0x13f3a9+=0x1){_0x4b2efe=_0x3628c4[_0x13f3a9];if(_[_0x4eae('0x3f')](_0x16e82d[_0x4eae('0x1c')][_0x4b2efe['id']])){_0x16e82d[_0x4eae('0x1c')][_0x4b2efe['id']]=new FreshdeskAccount(_0x4b2efe);}else{_0x16e82d['mergeFromDatabase'](_0x16e82d['freshdeskAccounts'][_0x4b2efe['id']],_0x4b2efe);}}}return _0x16e82d[_0x4eae('0x1c')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x46')]=function(){var _0x8c58de=this;return function(_0x15eab8){if(_0x15eab8){freeIsNotKey(_0x15eab8,_0x8c58de[_0x4eae('0x1d')],'id');for(var _0x5e6ba6=0x0,_0x430c9c={},_0x2117ad={};_0x5e6ba6<_0x15eab8[_0x4eae('0x3d')];_0x5e6ba6+=0x1){_0x430c9c=_0x15eab8[_0x5e6ba6];if(_[_0x4eae('0x3f')](_0x8c58de[_0x4eae('0x1d')][_0x430c9c['id']])){_0x8c58de['zohoAccounts'][_0x430c9c['id']]=new ZohoAccount(_0x430c9c);}else{_0x8c58de[_0x4eae('0x3b')](_0x8c58de['zohoAccounts'][_0x430c9c['id']],_0x430c9c);}}}return _0x8c58de[_0x4eae('0x1d')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x47')]=function(){var _0x589eee=this;return function(_0x1c8ebc){if(_0x1c8ebc){freeIsNotKey(_0x1c8ebc,_0x589eee[_0x4eae('0x48')],'id');for(var _0x240d28=0x0,_0x339057={},_0x1ccfbe={};_0x240d28<_0x1c8ebc[_0x4eae('0x3d')];_0x240d28+=0x1){_0x339057=_0x1c8ebc[_0x240d28];if(_[_0x4eae('0x3f')](_0x589eee['deskAccounts'][_0x339057['id']])){_0x589eee[_0x4eae('0x48')][_0x339057['id']]=new DeskAccount(_0x339057);}else{_0x589eee[_0x4eae('0x3b')](_0x589eee[_0x4eae('0x48')][_0x339057['id']],_0x339057);}}}return _0x589eee[_0x4eae('0x48')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x49')]=function(){var _0x46a837=this;return function(_0x235dac){if(_0x235dac){freeIsNotKey(_0x235dac,_0x46a837[_0x4eae('0x1b')],'id');for(var _0x223ba8=0x0,_0x434964={},_0x26f4c3={};_0x223ba8<_0x235dac[_0x4eae('0x3d')];_0x223ba8+=0x1){_0x434964=_0x235dac[_0x223ba8];if(_[_0x4eae('0x3f')](_0x46a837['sugarcrmAccounts'][_0x434964['id']])){_0x46a837[_0x4eae('0x1b')][_0x434964['id']]=new SugarcrmAccount(_0x434964);}else{_0x46a837[_0x4eae('0x3b')](_0x46a837[_0x4eae('0x1b')][_0x434964['id']],_0x434964);}}}return _0x46a837['sugarcrmAccounts'];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x4a')]=function(){var _0x3262e0=this;return function(_0x4785a3){if(_0x4785a3){freeIsNotKey(_0x4785a3,_0x3262e0['vtigerAccounts'],'id');for(var _0x5bc5ac=0x0,_0x112e9b={},_0x29fb2f={};_0x5bc5ac<_0x4785a3[_0x4eae('0x3d')];_0x5bc5ac+=0x1){_0x112e9b=_0x4785a3[_0x5bc5ac];if(_[_0x4eae('0x3f')](_0x3262e0['vtigerAccounts'][_0x112e9b['id']])){_0x3262e0[_0x4eae('0x4b')][_0x112e9b['id']]=new VtigerAccount(_0x112e9b);}else{_0x3262e0[_0x4eae('0x3b')](_0x3262e0['vtigerAccounts'][_0x112e9b['id']],_0x112e9b);}}}return _0x3262e0['vtigerAccounts'];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x4c')]=function(){var _0x46c1c7=this;return function(_0x1d8489){if(_0x1d8489){freeIsNotKey(_0x1d8489,_0x46c1c7['servicenowAccounts'],'id');for(var _0x350aeb=0x0,_0x1875ed={},_0x49a215={};_0x350aeb<_0x1d8489[_0x4eae('0x3d')];_0x350aeb+=0x1){_0x1875ed=_0x1d8489[_0x350aeb];if(_[_0x4eae('0x3f')](_0x46c1c7['servicenowAccounts'][_0x1875ed['id']])){_0x46c1c7['servicenowAccounts'][_0x1875ed['id']]=new ServicenowAccount(_0x1875ed);}else{_0x46c1c7[_0x4eae('0x3b')](_0x46c1c7[_0x4eae('0x1e')][_0x1875ed['id']],_0x1875ed);}}}return _0x46c1c7[_0x4eae('0x1e')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x4d')]=function(){var _0x199068=this;return function(_0x2b77b0){if(_0x2b77b0){freeIsNotKey(_0x2b77b0,_0x199068[_0x4eae('0x1f')],'id');for(var _0x5826d0=0x0,_0x185efe={},_0xa9b7ee={};_0x5826d0<_0x2b77b0[_0x4eae('0x3d')];_0x5826d0+=0x1){_0x185efe=_0x2b77b0[_0x5826d0];if(_['isUndefined'](_0x199068[_0x4eae('0x1f')][_0x185efe['id']])){_0x199068[_0x4eae('0x1f')][_0x185efe['id']]=new Dynamics365Account(_0x185efe);}else{_0x199068[_0x4eae('0x3b')](_0x199068[_0x4eae('0x1f')][_0x185efe['id']],_0x185efe);}}}return _0x199068[_0x4eae('0x1f')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x4e')]=function(){var _0x122406=this;return function(_0x1f2244){if(_0x1f2244){freeIsNotKey(_0x1f2244,_0x122406[_0x4eae('0x20')],'id');for(var _0x4e65ec=0x0,_0x334d85={},_0x4e7658={};_0x4e65ec<_0x1f2244[_0x4eae('0x3d')];_0x4e65ec+=0x1){_0x334d85=_0x1f2244[_0x4e65ec];if(_[_0x4eae('0x3f')](_0x122406[_0x4eae('0x20')][_0x334d85['id']])){_0x122406[_0x4eae('0x20')][_0x334d85['id']]=new FreshsalesAccount(_0x334d85);}else{_0x122406[_0x4eae('0x3b')](_0x122406['freshsalesAccounts'][_0x334d85['id']],_0x334d85);}}}return _0x122406[_0x4eae('0x20')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x4f')]=function(){var _0x1d0c8f=this;return function(_0x248598){for(var _0x75c147=0x0;_0x75c147<_0x248598[_0x4eae('0x3d')];_0x75c147+=0x1){_[_0x4eae('0x50')](_0x1d0c8f[_0x4eae('0x11')][_0x248598[_0x75c147][_0x4eae('0x25')]],_0x248598[_0x75c147]);}return _0x1d0c8f[_0x4eae('0x11')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x51')]=function(){var _0x5f4362=this;return function(_0x2e7b20){clearVoiceQueues(_0x5f4362[_0x4eae('0x11')]);if(_0x2e7b20){_0x2e7b20=_['groupBy'](_0x2e7b20,_0x4eae('0x52'));for(var _0x3810bd in _0x2e7b20){if(_0x2e7b20[_0x4eae('0x21')](_0x3810bd)){var _0x3bec5b={};for(var _0x1a97b2=0x0;_0x1a97b2<_0x2e7b20[_0x3810bd][_0x4eae('0x3d')];_0x1a97b2+=0x1){var _0x4a229c=_0x2e7b20[_0x3810bd][_0x1a97b2][_0x4eae('0x53')];if(_0x5f4362[_0x4eae('0x11')][_0x4a229c]){if(_0x2e7b20[_0x3810bd][_0x1a97b2][_0x4eae('0x54')]){_0x5f4362['voiceQueues'][_0x4a229c][_0x4eae('0x2b')]+=0x1;}if(_0x2e7b20[_0x3810bd][_0x1a97b2][_0x4eae('0x55')]){_0x5f4362[_0x4eae('0x11')][_0x4a229c]['abandoned']+=0x1;}_0x5f4362[_0x4eae('0x11')][_0x4a229c][_0x4eae('0x2d')]+=moment(_0x2e7b20[_0x3810bd][_0x1a97b2][_0x4eae('0x56')])[_0x4eae('0x57')](moment(_0x2e7b20[_0x3810bd][_0x1a97b2]['queuecallerjoinAt']),_0x4eae('0x58'))||0x0;if(_0x1a97b2===_0x2e7b20[_0x3810bd][_0x4eae('0x3d')]-0x1){_0x5f4362[_0x4eae('0x11')][_0x4a229c][_0x4eae('0x27')]+=moment(_0x2e7b20[_0x3810bd][_0x1a97b2][_0x4eae('0x59')]||_0x2e7b20[_0x3810bd][_0x1a97b2][_0x4eae('0x5a')]||_0x2e7b20[_0x3810bd][_0x1a97b2][_0x4eae('0x5b')])[_0x4eae('0x57')](moment(_0x2e7b20[_0x3810bd][_0x1a97b2][_0x4eae('0x5c')]),_0x4eae('0x58'))||0x0;_0x5f4362['voiceQueues'][_0x4a229c][_0x4eae('0x5d')]+=0x1;if(_0x2e7b20[_0x3810bd][_0x1a97b2][_0x4eae('0x5e')]){_0x5f4362[_0x4eae('0x11')][_0x4a229c]['answered']+=0x1;_0x5f4362[_0x4eae('0x11')][_0x4a229c][_0x4eae('0x28')]+=moment(_0x2e7b20[_0x3810bd][_0x1a97b2]['queuecallercompleteAt'])[_0x4eae('0x57')](moment(_0x2e7b20[_0x3810bd][_0x1a97b2][_0x4eae('0x56')]),'seconds')||0x0;}}else{_0x5f4362['voiceQueues'][_0x4a229c][_0x4eae('0x27')]+=_0x5f4362[_0x4eae('0x11')][_0x4a229c]['sumHoldTime']||0x0;}}}}}}return _0x5f4362['voiceQueues'];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x5f')]=function(){var _0x4588cd=this;return function(_0x537213){clearVoiceCallReports(_0x4588cd[_0x4eae('0x15')]);if(_0x537213){for(var _0x4b1f9c=0x0;_0x4b1f9c<_0x537213['length'];_0x4b1f9c+=0x1){_0x4588cd[_0x4eae('0x15')][_0x4eae('0x5d')]+=0x1;_0x4588cd[_0x4eae('0x15')][_0x4eae('0x27')]+=_0x537213[_0x4b1f9c]['duration'];if(_0x537213[_0x4b1f9c][_0x4eae('0x60')]==='ANSWERED'){_0x4588cd[_0x4eae('0x15')]['answered']+=0x1;_0x4588cd[_0x4eae('0x15')][_0x4eae('0x2d')]+=_0x537213[_0x4b1f9c][_0x4eae('0x61')]-_0x537213[_0x4b1f9c][_0x4eae('0x62')]||0x0;_0x4588cd[_0x4eae('0x15')][_0x4eae('0x28')]+=_0x537213[_0x4b1f9c][_0x4eae('0x62')];}}}return _0x4588cd[_0x4eae('0x15')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x63')]=function(){var _0x386b37=this;return function(_0x206419){if(_0x206419){freeIsNotKey(_0x206419,_0x386b37['campaigns'],_0x4eae('0x25'));for(var _0x5cf7c0=0x0,_0x50da42={};_0x5cf7c0<_0x206419[_0x4eae('0x3d')];_0x5cf7c0+=0x1){_0x50da42=_0x206419[_0x5cf7c0];if(_['isUndefined'](_0x386b37['campaigns'][_0x50da42[_0x4eae('0x25')]])){_0x386b37['campaigns'][_0x50da42['name']]=new Campaign(_0x50da42);}else{_0x386b37[_0x4eae('0x3b')](_0x386b37[_0x4eae('0x13')][_0x50da42[_0x4eae('0x25')]],_0x50da42);_0x386b37['campaigns'][_0x50da42[_0x4eae('0x25')]]['dialQueueProject']=_0x50da42[_0x4eae('0x64')]?_0x50da42['SquareProject']['name']:undefined;}}}return _0x386b37[_0x4eae('0x13')];};};Realtime[_0x4eae('0x3a')][_0x4eae('0x65')]=function(){var _0x224255=this;return function(_0x16c981){if(_0x16c981){freeIsNotKey(_0x16c981,_0x224255[_0x4eae('0x16')],'id');for(var _0x45e2bc=0x0,_0xc33441={};_0x45e2bc<_0x16c981[_0x4eae('0x3d')];_0x45e2bc+=0x1){_0xc33441=_0x16c981[_0x45e2bc];if(_[_0x4eae('0x3f')](_0x224255[_0x4eae('0x16')][_0xc33441['id']])){_0x224255['voiceExtensions'][_0xc33441['id']]=new VoiceExtension(_0xc33441);}else{_0x224255[_0x4eae('0x3b')](_0x224255['voiceExtensions'][_0xc33441['id']],_0xc33441);}}}return _0x224255['voiceExtensions'];};};Realtime[_0x4eae('0x3a')]['initCampaignHopperHistory']=function(){var _0x3b734e=this;return function(_0x55045a){clearCampaigns(_0x3b734e[_0x4eae('0x13')]);for(var _0x16af22=0x0;_0x16af22<_0x55045a['length'];_0x16af22+=0x1){_['merge'](_0x3b734e[_0x4eae('0x13')][_0x55045a[_0x16af22]['name']],_0x55045a[_0x16af22]);}return _0x3b734e[_0x4eae('0x13')];};};Realtime[_0x4eae('0x3a')]['initFaxAccounts']=function(){var _0x4088f3=this;return function(_0x52adcc){if(_0x52adcc){freeIsNotKey(_0x52adcc,_0x4088f3[_0x4eae('0x66')],'id');for(var _0x1f84af=0x0,_0x4dcdf2={},_0xc959ca={};_0x1f84af<_0x52adcc[_0x4eae('0x3d')];_0x1f84af+=0x1){_0x4dcdf2=_0x52adcc[_0x1f84af];if(_[_0x4eae('0x3f')](_0x4088f3[_0x4eae('0x66')][_0x4dcdf2['id']])){_0x4088f3['faxAccounts'][_0x4dcdf2['id']]=new FaxAccount(_0x4dcdf2);}else{_0x4088f3[_0x4eae('0x3b')](_0x4088f3[_0x4eae('0x66')][_0x4dcdf2['id']],_0x4dcdf2);}}}return _0x4088f3['faxAccounts'];};};module[_0x4eae('0x67')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 8793301..d927390 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 _0xc5dd=['assigned','lastAssignedTo','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','voiceCallReport','destination','type','queue','context','from-sip','calleridpreview','calleridnum','originatecalleridnum','channel','destinationchannel','callerid','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','create','monitor','monitors','monitorFilename','filename','exten','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','blindTransfer','exports','bluebird','../../../config/environment','../../../config/logger','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','connectedlinenum'];(function(_0x54ea43,_0x920ff8){var _0x1c8c36=function(_0x537b26){while(--_0x537b26){_0x54ea43['push'](_0x54ea43['shift']());}};_0x1c8c36(++_0x920ff8);}(_0xc5dd,0xd1));var _0xdc5d=function(_0x1bb191,_0x552afb){_0x1bb191=_0x1bb191-0x0;var _0x31b09f=_0xc5dd[_0x1bb191];return _0x31b09f;};'use strict';var BPromise=require(_0xdc5d('0x0'));var _=require('lodash');var moment=require('moment');var util=require('util');var config=require(_0xdc5d('0x1'));var logger=require(_0xdc5d('0x2'))('ami');var ami=require(_0xdc5d('0x3'));var RpcVoiceAgentReport=require(_0xdc5d('0x4'));var RpcVoiceCallReport=require(_0xdc5d('0x5'));var RpcVoiceDialReport=require(_0xdc5d('0x6'));var RpcMemberReport=require(_0xdc5d('0x7'));var RpcVoiceQueueReport=require(_0xdc5d('0x8'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xdc5d('0x9'));var VoiceQueueReport=require(_0xdc5d('0xa'));var VoiceCallReport=require(_0xdc5d('0xb'));var VoiceAgentReport=require(_0xdc5d('0xc'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xdc5d('0xd'));function Report(_0x15f5c9){this[_0xdc5d('0xe')]=_0x15f5c9;this['agents']=_0x15f5c9[_0xdc5d('0xf')];this[_0xdc5d('0x10')]=_0x15f5c9['telephones'];}Report[_0xdc5d('0x11')][_0xdc5d('0x12')]=function(_0x111114){var _0x15eab6=new VoiceQueueReport(this[_0xdc5d('0xe')]);var _0x25a34d=new VoiceAgentReport(this[_0xdc5d('0xe')]);var _0x2ea564=new VoiceDialReport(this[_0xdc5d('0xe')]);var _0x321908=new VoiceCallReport(this[_0xdc5d('0xe')]);var _0x385773=new UserReport(this['realtime']);if(config[_0xdc5d('0x13')]&&config['xdr']['disabled']){ami['on'](_0xdc5d('0x14'),this[_0xdc5d('0x15')][_0xdc5d('0x16')](this));ami['on'](_0xdc5d('0x17'),this['voiceCallReport']['bind'](this));ami['on'](_0xdc5d('0x18'),this[_0xdc5d('0x19')][_0xdc5d('0x16')](this));ami['on'](_0xdc5d('0x1a'),this[_0xdc5d('0x1b')][_0xdc5d('0x16')](this));ami['on'](_0xdc5d('0x1c'),this['blindTransfer'][_0xdc5d('0x16')](this));ami['on']('attendedtransfer',this[_0xdc5d('0x1d')][_0xdc5d('0x16')](this));}};Report[_0xdc5d('0x11')][_0xdc5d('0x1e')]=function(_0xc0e4e4){var _0x54ff35=undefined;_0x54ff35=_[_0xdc5d('0x1f')](this['agents'],function(_0x110030){return _0x110030[_0xdc5d('0x20')]==_0xc0e4e4||_0x110030[_0xdc5d('0x21')]==_0xc0e4e4;});if(_[_0xdc5d('0x22')](_0x54ff35)){var _0x2f8f45=_[_0xdc5d('0x1f')](this[_0xdc5d('0x10')],function(_0x41a21d){return _0x41a21d[_0xdc5d('0x20')]==_0xc0e4e4||_0x41a21d[_0xdc5d('0x21')]==_0xc0e4e4;});if(_0x2f8f45){_0x54ff35=_[_0xdc5d('0x1f')](this[_0xdc5d('0xf')],function(_0x1a6b98){return _0x1a6b98[_0xdc5d('0x23')]==util[_0xdc5d('0x24')](_0xdc5d('0x25'),_0x2f8f45[_0xdc5d('0x21')]);});}}return _0x54ff35;};Report[_0xdc5d('0x11')]['voiceQueueReport']=function(_0x18a01c){for(var _0x571b98=0x0;_0x571b98<_0x18a01c[_0xdc5d('0x26')];_0x571b98+=0x1){var _0x3f83dd=this[_0xdc5d('0x1e')](_0x18a01c[_0x571b98][_0xdc5d('0x27')]);if(_0x3f83dd){_0x18a01c[_0x571b98][_0xdc5d('0x20')]=_0x3f83dd[_0xdc5d('0x20')];_0x18a01c[_0x571b98][_0xdc5d('0x28')]=!![];_0x18a01c[_0x571b98][_0xdc5d('0x29')]=_0x3f83dd[_0xdc5d('0x21')];_0x18a01c[_0x571b98][_0xdc5d('0x23')]=_[_0xdc5d('0x22')](_0x3f83dd[_0xdc5d('0x23')])?util[_0xdc5d('0x24')]('SIP/%s',_0x3f83dd['name']):_0x3f83dd[_0xdc5d('0x23')];if(_0x18a01c[_0x571b98][_0xdc5d('0x2a')]){_0x18a01c[_0x571b98]['queuecallercompleteAt']=moment()[_0xdc5d('0x24')](_0xdc5d('0x2b'));}if(_0x18a01c[_0x571b98][_0xdc5d('0x2c')]){_0x18a01c[_0x571b98][_0xdc5d('0x2d')]=moment()[_0xdc5d('0x24')](_0xdc5d('0x2b'));}RpcMemberReport[_0xdc5d('0x15')](_0x18a01c[_0x571b98]);}RpcVoiceQueueReport['create'](_0x18a01c[_0x571b98]);}};function extractCalleridNumber(_0x33d38e){var _0x5ce164=_0x33d38e[_0xdc5d('0x2e')](/<(.*?)>/);return _0x5ce164?_0x5ce164[0x1]:_0x33d38e;}Report[_0xdc5d('0x11')][_0xdc5d('0x2f')]=function(_0x38734f){_0x38734f['destination']=_0x38734f[_0xdc5d('0x30')]||_0x38734f['exten'];if(_0x38734f[_0xdc5d('0x31')]=='dialer'){_0x38734f['lastapplication']=_0xdc5d('0x32');_0x38734f['lastdata']=_0x38734f['queue'];if(_0x38734f[_0xdc5d('0x33')]=='from-voip-provider'){_0x38734f['accountcode']='';_0x38734f[_0xdc5d('0x30')]=extractCalleridNumber(_0x38734f['callerid']);}else if(_0x38734f['context']==_0xdc5d('0x34')){if(_0x38734f[_0xdc5d('0x30')]=='xcally-motion-preview'){_0x38734f['destination']=extractCalleridNumber(_0x38734f[_0xdc5d('0x35')]);_0x38734f[_0xdc5d('0x36')]=_0x38734f[_0xdc5d('0x37')];_0x38734f['destinationchannel']=[_0x38734f[_0xdc5d('0x38')],_0x38734f[_0xdc5d('0x38')]=_0x38734f[_0xdc5d('0x39')]][0x0];_0x38734f[_0xdc5d('0x3a')]=_0x38734f[_0xdc5d('0x35')];}else{_0x38734f[_0xdc5d('0x30')]=_0x38734f[_0xdc5d('0x36')];_0x38734f['calleridnum']=_0x38734f['originatecalleridnum'];if(_0x38734f[_0xdc5d('0x3b')]==_0xdc5d('0x3c')){_0x38734f['accountcode']=_0x38734f['connectedlinenum'];}else{_0x38734f[_0xdc5d('0x20')]='';}}}}else{_0x38734f[_0xdc5d('0x3a')]=util[_0xdc5d('0x24')](_0xdc5d('0x3d'),_0x38734f[_0xdc5d('0x3e')],_0x38734f[_0xdc5d('0x36')]);}RpcVoiceCallReport[_0xdc5d('0x3f')](_0x38734f);if(_0x38734f[_0xdc5d('0x40')]){for(var _0x1d5320=0x0;_0x1d5320<_0x38734f[_0xdc5d('0x41')][_0xdc5d('0x26')];_0x1d5320+=0x1){_0x38734f[_0xdc5d('0x42')]=_0x38734f[_0xdc5d('0x41')][_0x1d5320][_0xdc5d('0x43')];_0x38734f['createdAt']=_0x38734f[_0xdc5d('0x41')][_0x1d5320]['createdAt'];if(_0x38734f[_0xdc5d('0x44')]=='xcally-motion-preview'){_0x38734f[_0xdc5d('0x36')]=_0x38734f[_0xdc5d('0x27')];_0x38734f[_0xdc5d('0x3e')]=_0x38734f['connectedlinename'];_0x38734f[_0xdc5d('0x27')]=_0x38734f['accountcode'];_0x38734f[_0xdc5d('0x45')]=_0x38734f[_0xdc5d('0x46')];_0x38734f['exten']=_0x38734f[_0xdc5d('0x37')];}else if(_0x38734f[_0xdc5d('0x44')]==_0xdc5d('0x47')){_0x38734f[_0xdc5d('0x36')]=_0x38734f['destination'];_0x38734f['exten']=_0x38734f[_0xdc5d('0x37')];}RpcVoiceRecording[_0xdc5d('0x3f')](_0x38734f);}}};Report[_0xdc5d('0x11')][_0xdc5d('0x19')]=function(_0x59dcfb){if(_[_0xdc5d('0x48')](_0x59dcfb)){_0x59dcfb[_0xdc5d('0x49')](function(_0x166437){RpcVoiceAgentReport[_0xdc5d('0x3f')](_0x166437);});}else{RpcVoiceAgentReport[_0xdc5d('0x3f')](_0x59dcfb);}};Report['prototype']['voiceDialReport']=function(_0xfb77a){RpcVoiceDialReport['create'](_0xfb77a);var _0x5197c8=undefined;var _0x315cf0=_0xfb77a[_0xdc5d('0x38')];if(_[_0xdc5d('0x4a')](_0x315cf0,_0xdc5d('0x4b'))){var _0x180767=_0x315cf0[_0xdc5d('0x4c')](_0x315cf0[_0xdc5d('0x4d')]('/')+0x1,_0x315cf0[_0xdc5d('0x4d')]('@'));_0x5197c8=_[_0xdc5d('0x1f')](this[_0xdc5d('0xf')],function(_0x11c7d6){return _0x11c7d6[_0xdc5d('0x4e')]==_0x180767||_0x11c7d6[_0xdc5d('0x4f')]==_0x180767||_0x11c7d6['accountcode']==_0x180767;});}else{var _0x180767=_0x315cf0[_0xdc5d('0x4c')](_0x315cf0[_0xdc5d('0x4d')]('/')+0x1,_0x315cf0[_0xdc5d('0x50')]('-'));_0x5197c8=this['findAgent'](_0x180767);}if(_0x5197c8){_0xfb77a['interface']=_[_0xdc5d('0x22')](_0x5197c8[_0xdc5d('0x23')])?util[_0xdc5d('0x24')](_0xdc5d('0x25'),_0x5197c8['name']):_0x5197c8[_0xdc5d('0x23')];_0xfb77a[_0xdc5d('0x46')]=_0x5197c8[_0xdc5d('0x21')];_0xfb77a[_0xdc5d('0x20')]=_0x5197c8[_0xdc5d('0x20')];RpcMemberReport[_0xdc5d('0x1b')](_0xfb77a);}};Report['prototype'][_0xdc5d('0x51')]=function(_0x4e443f){RpcVoiceTransferReport[_0xdc5d('0x51')](_0x4e443f);};Report[_0xdc5d('0x11')][_0xdc5d('0x1d')]=function(_0x408189){RpcVoiceTransferReport[_0xdc5d('0x1d')](_0x408189);};module[_0xdc5d('0x52')]=Report; \ No newline at end of file +var _0xe637=['originatecalleridnum','disposition','connectedlinenum','calleridname','monitor','monitors','createdAt','connectedlinename','xcally-motion-dialer','voiceAgentReport','isArray','startsWith','indexOf','mobile','phone','substring','blindTransfer','attendedTransfer','exports','lodash','moment','util','../../../config/environment','ami','../ami','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','realtime','agents','telephones','prototype','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','findAgent','accountcode','name','find','interface','format','SIP/%s','length','lastAssignedTo','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','voiceCallReport','exten','type','lastapplication','queue','from-voip-provider','destination','callerid','context','from-sip','xcally-motion-preview','calleridpreview','calleridnum','channel','destinationchannel'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0xe637,0x14b));var _0x7e63=function(_0x150e99,_0x24f975){_0x150e99=_0x150e99-0x0;var _0x3e17ca=_0xe637[_0x150e99];return _0x3e17ca;};'use strict';var BPromise=require('bluebird');var _=require(_0x7e63('0x0'));var moment=require(_0x7e63('0x1'));var util=require(_0x7e63('0x2'));var config=require(_0x7e63('0x3'));var logger=require('../../../config/logger')(_0x7e63('0x4'));var ami=require(_0x7e63('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x7e63('0x6'));var RpcVoiceQueueReport=require(_0x7e63('0x7'));var RpcVoiceRecording=require(_0x7e63('0x8'));var RpcVoiceTransferReport=require(_0x7e63('0x9'));var VoiceQueueReport=require(_0x7e63('0xa'));var VoiceCallReport=require(_0x7e63('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x7e63('0xc'));var UserReport=require('./userReport');function Report(_0x278c90){this[_0x7e63('0xd')]=_0x278c90;this[_0x7e63('0xe')]=_0x278c90[_0x7e63('0xe')];this[_0x7e63('0xf')]=_0x278c90[_0x7e63('0xf')];}Report[_0x7e63('0x10')]['sync']=function(_0x45e555){var _0xcd8cc9=new VoiceQueueReport(this['realtime']);var _0x318938=new VoiceAgentReport(this['realtime']);var _0x263b13=new VoiceDialReport(this['realtime']);var _0x330aa5=new VoiceCallReport(this[_0x7e63('0xd')]);var _0x422454=new UserReport(this[_0x7e63('0xd')]);if(config['xdr']&&config[_0x7e63('0x11')][_0x7e63('0x12')]){ami['on'](_0x7e63('0x13'),this[_0x7e63('0x14')][_0x7e63('0x15')](this));ami['on'](_0x7e63('0x16'),this['voiceCallReport'][_0x7e63('0x15')](this));ami['on'](_0x7e63('0x17'),this['voiceAgentReport'][_0x7e63('0x15')](this));ami['on'](_0x7e63('0x18'),this[_0x7e63('0x19')][_0x7e63('0x15')](this));ami['on'](_0x7e63('0x1a'),this['blindTransfer'][_0x7e63('0x15')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0x7e63('0x15')](this));}};Report[_0x7e63('0x10')][_0x7e63('0x1b')]=function(_0x21ea59){var _0x132928=undefined;_0x132928=_['find'](this[_0x7e63('0xe')],function(_0x306d83){return _0x306d83[_0x7e63('0x1c')]==_0x21ea59||_0x306d83[_0x7e63('0x1d')]==_0x21ea59;});if(_['isNil'](_0x132928)){var _0x205748=_[_0x7e63('0x1e')](this[_0x7e63('0xf')],function(_0x569a20){return _0x569a20[_0x7e63('0x1c')]==_0x21ea59||_0x569a20[_0x7e63('0x1d')]==_0x21ea59;});if(_0x205748){_0x132928=_[_0x7e63('0x1e')](this[_0x7e63('0xe')],function(_0x52c017){return _0x52c017[_0x7e63('0x1f')]==util[_0x7e63('0x20')](_0x7e63('0x21'),_0x205748['name']);});}}return _0x132928;};Report[_0x7e63('0x10')][_0x7e63('0x14')]=function(_0x6916c9){for(var _0x2f5da6=0x0;_0x2f5da6<_0x6916c9[_0x7e63('0x22')];_0x2f5da6+=0x1){var _0x29234f=this[_0x7e63('0x1b')](_0x6916c9[_0x2f5da6]['connectedlinenum']);if(_0x29234f){_0x6916c9[_0x2f5da6][_0x7e63('0x1c')]=_0x29234f['accountcode'];_0x6916c9[_0x2f5da6]['assigned']=!![];_0x6916c9[_0x2f5da6][_0x7e63('0x23')]=_0x29234f[_0x7e63('0x1d')];_0x6916c9[_0x2f5da6]['interface']=_[_0x7e63('0x24')](_0x29234f[_0x7e63('0x1f')])?util['format'](_0x7e63('0x21'),_0x29234f['name']):_0x29234f[_0x7e63('0x1f')];if(_0x6916c9[_0x2f5da6][_0x7e63('0x25')]){_0x6916c9[_0x2f5da6][_0x7e63('0x26')]=moment()[_0x7e63('0x20')](_0x7e63('0x27'));}if(_0x6916c9[_0x2f5da6][_0x7e63('0x28')]){_0x6916c9[_0x2f5da6][_0x7e63('0x29')]=moment()[_0x7e63('0x20')](_0x7e63('0x27'));}RpcMemberReport[_0x7e63('0x14')](_0x6916c9[_0x2f5da6]);}RpcVoiceQueueReport[_0x7e63('0x2a')](_0x6916c9[_0x2f5da6]);}};function extractCalleridNumber(_0x33c94a){var _0x2a52b8=_0x33c94a[_0x7e63('0x2b')](/<(.*?)>/);return _0x2a52b8?_0x2a52b8[0x1]:_0x33c94a;}Report[_0x7e63('0x10')][_0x7e63('0x2c')]=function(_0x1dfbe9){_0x1dfbe9['destination']=_0x1dfbe9['destination']||_0x1dfbe9[_0x7e63('0x2d')];if(_0x1dfbe9[_0x7e63('0x2e')]=='dialer'){_0x1dfbe9[_0x7e63('0x2f')]='queue';_0x1dfbe9['lastdata']=_0x1dfbe9[_0x7e63('0x30')];if(_0x1dfbe9['context']==_0x7e63('0x31')){_0x1dfbe9[_0x7e63('0x1c')]='';_0x1dfbe9[_0x7e63('0x32')]=extractCalleridNumber(_0x1dfbe9[_0x7e63('0x33')]);}else if(_0x1dfbe9[_0x7e63('0x34')]==_0x7e63('0x35')){if(_0x1dfbe9['destination']==_0x7e63('0x36')){_0x1dfbe9[_0x7e63('0x32')]=extractCalleridNumber(_0x1dfbe9[_0x7e63('0x37')]);_0x1dfbe9[_0x7e63('0x38')]=_0x1dfbe9['originatecalleridnum'];_0x1dfbe9['destinationchannel']=[_0x1dfbe9['channel'],_0x1dfbe9[_0x7e63('0x39')]=_0x1dfbe9[_0x7e63('0x3a')]][0x0];_0x1dfbe9[_0x7e63('0x33')]=_0x1dfbe9[_0x7e63('0x37')];}else{_0x1dfbe9['destination']=_0x1dfbe9['calleridnum'];_0x1dfbe9['calleridnum']=_0x1dfbe9[_0x7e63('0x3b')];if(_0x1dfbe9[_0x7e63('0x3c')]=='ANSWERED'){_0x1dfbe9[_0x7e63('0x1c')]=_0x1dfbe9[_0x7e63('0x3d')];}else{_0x1dfbe9['accountcode']='';}}}}else{_0x1dfbe9[_0x7e63('0x33')]=util[_0x7e63('0x20')]('\x22%s\x22\x20<%s>',_0x1dfbe9[_0x7e63('0x3e')],_0x1dfbe9[_0x7e63('0x38')]);}RpcVoiceCallReport[_0x7e63('0x2a')](_0x1dfbe9);if(_0x1dfbe9[_0x7e63('0x3f')]){for(var _0x4301a5=0x0;_0x4301a5<_0x1dfbe9[_0x7e63('0x40')][_0x7e63('0x22')];_0x4301a5+=0x1){_0x1dfbe9['monitorFilename']=_0x1dfbe9[_0x7e63('0x40')][_0x4301a5]['filename'];_0x1dfbe9[_0x7e63('0x41')]=_0x1dfbe9['monitors'][_0x4301a5][_0x7e63('0x41')];if(_0x1dfbe9['exten']==_0x7e63('0x36')){_0x1dfbe9[_0x7e63('0x38')]=_0x1dfbe9[_0x7e63('0x3d')];_0x1dfbe9[_0x7e63('0x3e')]=_0x1dfbe9[_0x7e63('0x42')];_0x1dfbe9[_0x7e63('0x3d')]=_0x1dfbe9['accountcode'];_0x1dfbe9[_0x7e63('0x42')]=_0x1dfbe9['membername'];_0x1dfbe9[_0x7e63('0x2d')]=_0x1dfbe9[_0x7e63('0x3b')];}else if(_0x1dfbe9[_0x7e63('0x2d')]==_0x7e63('0x43')){_0x1dfbe9[_0x7e63('0x38')]=_0x1dfbe9['destination'];_0x1dfbe9[_0x7e63('0x2d')]=_0x1dfbe9[_0x7e63('0x3b')];}RpcVoiceRecording['create'](_0x1dfbe9);}}};Report[_0x7e63('0x10')][_0x7e63('0x44')]=function(_0x5af72d){if(_[_0x7e63('0x45')](_0x5af72d)){_0x5af72d['forEach'](function(_0x30cb0f){RpcVoiceAgentReport[_0x7e63('0x2a')](_0x30cb0f);});}else{RpcVoiceAgentReport[_0x7e63('0x2a')](_0x5af72d);}};Report[_0x7e63('0x10')][_0x7e63('0x19')]=function(_0x5498d8){RpcVoiceDialReport['create'](_0x5498d8);var _0x40d72b=undefined;var _0x358aa5=_0x5498d8['channel'];if(_[_0x7e63('0x46')](_0x358aa5,'Local')){var _0x353bc0=_0x358aa5['substring'](_0x358aa5[_0x7e63('0x47')]('/')+0x1,_0x358aa5[_0x7e63('0x47')]('@'));_0x40d72b=_['find'](this['agents'],function(_0x21aee3){return _0x21aee3[_0x7e63('0x48')]==_0x353bc0||_0x21aee3[_0x7e63('0x49')]==_0x353bc0||_0x21aee3['accountcode']==_0x353bc0;});}else{var _0x353bc0=_0x358aa5[_0x7e63('0x4a')](_0x358aa5[_0x7e63('0x47')]('/')+0x1,_0x358aa5['lastIndexOf']('-'));_0x40d72b=this[_0x7e63('0x1b')](_0x353bc0);}if(_0x40d72b){_0x5498d8[_0x7e63('0x1f')]=_[_0x7e63('0x24')](_0x40d72b[_0x7e63('0x1f')])?util[_0x7e63('0x20')](_0x7e63('0x21'),_0x40d72b[_0x7e63('0x1d')]):_0x40d72b[_0x7e63('0x1f')];_0x5498d8['membername']=_0x40d72b[_0x7e63('0x1d')];_0x5498d8['accountcode']=_0x40d72b[_0x7e63('0x1c')];RpcMemberReport[_0x7e63('0x19')](_0x5498d8);}};Report[_0x7e63('0x10')][_0x7e63('0x4b')]=function(_0x581a8d){RpcVoiceTransferReport[_0x7e63('0x4b')](_0x581a8d);};Report[_0x7e63('0x10')]['attendedTransfer']=function(_0xef2fec){RpcVoiceTransferReport[_0x7e63('0x4c')](_0xef2fec);};module[_0x7e63('0x4d')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 2c3b5ab..6f0be32 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 _0xbd20=['[syncPeerStatus][UserReport]','lodash','moment','bluebird','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','resolve','then','actionSipShowRegistry','catch','[loopSyncRealTimeShow]','error','inspect','prototype','loopSyncRealTimeShow','actionSipPeerStatus','isNotNull','isUndefined','emit','find','state','merge','omit','actionid','username','trunk:%s','name','trunk:save','[syncRegistry][UserReport]','device','local','toLowerCase','inuse','stateTime','toNumber','format','telephone:%s','startsWith','Queue','Local','substring','indexOf','mobile','phone','[syncDeviceState][UserReport]','syncPeerStatus','peer','registered','status','address','updateStatusRealtime','telephone:save'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xbd20,0xcd));var _0x0bd2=function(_0x553e1e,_0x5bedef){_0x553e1e=_0x553e1e-0x0;var _0x3bb17b=_0xbd20[_0x553e1e];return _0x3bb17b;};'use strict';var _=require(_0x0bd2('0x0'));var moment=require(_0x0bd2('0x1'));var BPromise=require(_0x0bd2('0x2'));var util=require(_0x0bd2('0x3'));var Redis=require(_0x0bd2('0x4'));var config=require(_0x0bd2('0x5'));var logger=require(_0x0bd2('0x6'))(_0x0bd2('0x7'));var ami=require(_0x0bd2('0x8'));config[_0x0bd2('0x9')]=_[_0x0bd2('0xa')](config[_0x0bd2('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x0bd2('0xb'))(new Redis(config[_0x0bd2('0x9')]));function UserReport(_0x11c44f){this[_0x0bd2('0xc')]=_0x11c44f[_0x0bd2('0xc')];this[_0x0bd2('0xd')]=_0x11c44f[_0x0bd2('0xd')];this['telephones']=_0x11c44f[_0x0bd2('0xe')];ami['on']('registryentry',this[_0x0bd2('0xf')][_0x0bd2('0x10')](this));ami['on'](_0x0bd2('0x11'),this['syncRegistry'][_0x0bd2('0x10')](this));ami['on'](_0x0bd2('0x12'),this[_0x0bd2('0x13')][_0x0bd2('0x10')](this));ami['on'](_0x0bd2('0x14'),this['syncPeerStatus'][_0x0bd2('0x10')](this));this['loopSyncRealTimeShow']();return BPromise[_0x0bd2('0x15')]()[_0x0bd2('0x16')](ami[_0x0bd2('0x17')]())[_0x0bd2('0x16')](ami['actionDeviceStateList']())['then'](ami['actionSipPeerStatus']())[_0x0bd2('0x18')](loggerCatch(_0x0bd2('0x19')));}function loggerCatch(_0x25921e){return function(_0x3896ee){logger[_0x0bd2('0x1a')](_0x25921e,util[_0x0bd2('0x1b')](_0x3896ee,{'showHidden':![],'depth':null}));};}UserReport[_0x0bd2('0x1c')][_0x0bd2('0x1d')]=function(){setInterval(function(){BPromise[_0x0bd2('0x15')]()[_0x0bd2('0x16')](ami[_0x0bd2('0x17')]())[_0x0bd2('0x16')](ami['actionDeviceStateList']())[_0x0bd2('0x16')](ami[_0x0bd2('0x1e')]())[_0x0bd2('0x18')](loggerCatch(_0x0bd2('0x19')));},0x32c8);};UserReport[_0x0bd2('0x1c')][_0x0bd2('0x1f')]=function(_0x304a1c){return _0x304a1c!==null&&!_[_0x0bd2('0x20')](_0x304a1c);};UserReport[_0x0bd2('0x1c')][_0x0bd2('0x21')]=function(_0x48f444,_0x38b03e,_0x300d9a){io['to'](_0x48f444)[_0x0bd2('0x21')](_0x38b03e,_0x300d9a);};UserReport[_0x0bd2('0x1c')][_0x0bd2('0xf')]=function(_0xe0f9dd){try{if(this['isNotNull'](_0xe0f9dd)){var _0x4f47f5=_[_0x0bd2('0x22')](this[_0x0bd2('0xc')],{'registry':_0xe0f9dd['username']});if(_0x4f47f5){_0xe0f9dd['stateRegistry']=_0xe0f9dd[_0x0bd2('0x23')];_[_0x0bd2('0x24')](_0x4f47f5,_[_0x0bd2('0x25')](_0xe0f9dd,['event',_0x0bd2('0x26'),_0x0bd2('0x27'),_0x0bd2('0x23')]));this[_0x0bd2('0x21')](util['format'](_0x0bd2('0x28'),_0x4f47f5[_0x0bd2('0x29')]),_0x0bd2('0x2a'),_0x4f47f5);}}}catch(_0x1a89bf){logger[_0x0bd2('0x1a')](_0x0bd2('0x2b'),util[_0x0bd2('0x1b')](_0x1a89bf,{'showHidden':![],'depth':null}));}};UserReport[_0x0bd2('0x1c')][_0x0bd2('0x13')]=function(_0x5c64b2){try{if(this[_0x0bd2('0x1f')](_0x5c64b2)){if(this[_0x0bd2('0xd')][_0x5c64b2[_0x0bd2('0x2c')]]){if(!this[_0x0bd2('0xd')][_0x5c64b2[_0x0bd2('0x2c')]][_0x0bd2('0x2d')]||_0x5c64b2[_0x0bd2('0x23')][_0x0bd2('0x2e')]()==_0x0bd2('0x2f')){this[_0x0bd2('0xd')][_0x5c64b2[_0x0bd2('0x2c')]][_0x0bd2('0x2d')]=![];if(this[_0x0bd2('0xd')][_0x5c64b2[_0x0bd2('0x2c')]][_0x0bd2('0x23')]!==_0x5c64b2[_0x0bd2('0x23')][_0x0bd2('0x2e')]()){this[_0x0bd2('0xd')][_0x5c64b2['device']][_0x0bd2('0x30')]=_[_0x0bd2('0x31')](moment()['format']('x'));}this[_0x0bd2('0xd')][_0x5c64b2[_0x0bd2('0x2c')]][_0x0bd2('0x23')]=_0x5c64b2[_0x0bd2('0x23')][_0x0bd2('0x2e')]();this[_0x0bd2('0xd')][_0x5c64b2[_0x0bd2('0x2c')]]['updateStatusRealtime'](_0x5c64b2);}}else if(this[_0x0bd2('0xe')][_0x5c64b2['device']]){if(this[_0x0bd2('0xe')][_0x5c64b2['device']][_0x0bd2('0x23')]!==_0x5c64b2[_0x0bd2('0x23')][_0x0bd2('0x2e')]()){this['telephones'][_0x5c64b2[_0x0bd2('0x2c')]]['stateTime']=_['toNumber'](moment()['format']('x'));}this[_0x0bd2('0xe')][_0x5c64b2['device']][_0x0bd2('0x23')]=_0x5c64b2[_0x0bd2('0x23')][_0x0bd2('0x2e')]();this[_0x0bd2('0x21')](util[_0x0bd2('0x32')](_0x0bd2('0x33'),this[_0x0bd2('0xe')][_0x5c64b2[_0x0bd2('0x2c')]][_0x0bd2('0x29')]),'telephone:save',this['telephones'][_0x5c64b2['device']]);}else if(this[_0x0bd2('0xc')][_0x5c64b2['device']]){if(this[_0x0bd2('0xc')][_0x5c64b2['device']][_0x0bd2('0x23')]!==_0x5c64b2[_0x0bd2('0x23')][_0x0bd2('0x2e')]()){this[_0x0bd2('0xc')][_0x5c64b2['device']][_0x0bd2('0x30')]=_[_0x0bd2('0x31')](moment()['format']('x'));}this['trunks'][_0x5c64b2[_0x0bd2('0x2c')]][_0x0bd2('0x23')]=_0x5c64b2['state'][_0x0bd2('0x2e')]();this['emit'](util[_0x0bd2('0x32')]('trunk:%s',this[_0x0bd2('0xc')][_0x5c64b2[_0x0bd2('0x2c')]][_0x0bd2('0x29')]),_0x0bd2('0x2a'),this['trunks'][_0x5c64b2[_0x0bd2('0x2c')]]);}else if(_[_0x0bd2('0x34')](_0x5c64b2['device'],_0x0bd2('0x35'))){}else if(_[_0x0bd2('0x34')](_0x5c64b2['device'],_0x0bd2('0x36'))){var _0x5ef829=_0x5c64b2[_0x0bd2('0x2c')];var _0x3ff7f2=_0x5ef829[_0x0bd2('0x37')](_0x5ef829['indexOf']('/')+0x1,_0x5ef829[_0x0bd2('0x38')]('@'));var _0x532661=_[_0x0bd2('0x22')](this[_0x0bd2('0xd')],function(_0x5eacb1){return _0x5eacb1[_0x0bd2('0x39')]==_0x3ff7f2||_0x5eacb1[_0x0bd2('0x3a')]==_0x3ff7f2||_0x5eacb1['accountcode']==_0x3ff7f2;});if(_0x532661){if(_0x532661[_0x0bd2('0x23')]!==_0x5c64b2['state'][_0x0bd2('0x2e')]()){_0x532661['stateTime']=_[_0x0bd2('0x31')](moment()[_0x0bd2('0x32')]('x'));}_0x532661['state']=_0x5c64b2[_0x0bd2('0x23')]['toLowerCase']();_0x532661[_0x0bd2('0x2d')]=!![];_0x532661['updateStatusRealtime'](_0x5c64b2);}}else{}}}catch(_0x3be1ec){logger[_0x0bd2('0x1a')](_0x0bd2('0x3b'),util[_0x0bd2('0x1b')](_0x3be1ec,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x0bd2('0x3c')]=function(_0x3e2f91){try{if(this[_0x0bd2('0x1f')](_0x3e2f91)&&this['isNotNull'](_0x3e2f91[_0x0bd2('0x14')])){if(this[_0x0bd2('0xd')][_0x3e2f91[_0x0bd2('0x3d')]]){if(!this['agents'][_0x3e2f91[_0x0bd2('0x3d')]]['local']||_0x3e2f91[_0x0bd2('0x14')]['toLowerCase']()==_0x0bd2('0x3e')){this[_0x0bd2('0xd')][_0x3e2f91[_0x0bd2('0x3d')]][_0x0bd2('0x2d')]=![];this[_0x0bd2('0xd')][_0x3e2f91[_0x0bd2('0x3d')]][_0x0bd2('0x3f')]=_0x3e2f91[_0x0bd2('0x14')][_0x0bd2('0x2e')]();this[_0x0bd2('0xd')][_0x3e2f91['peer']][_0x0bd2('0x40')]=_0x3e2f91[_0x0bd2('0x40')];this[_0x0bd2('0xd')][_0x3e2f91[_0x0bd2('0x3d')]][_0x0bd2('0x41')](_0x3e2f91);}}else if(this[_0x0bd2('0xe')][_0x3e2f91[_0x0bd2('0x3d')]]){this['telephones'][_0x3e2f91[_0x0bd2('0x3d')]][_0x0bd2('0x3f')]=_0x3e2f91['peerstatus'][_0x0bd2('0x2e')]();this['telephones'][_0x3e2f91[_0x0bd2('0x3d')]]['address']=_0x3e2f91[_0x0bd2('0x40')];this[_0x0bd2('0x21')](util[_0x0bd2('0x32')](_0x0bd2('0x33'),this[_0x0bd2('0xe')][_0x3e2f91[_0x0bd2('0x3d')]]['name']),_0x0bd2('0x42'),this['telephones'][_0x3e2f91[_0x0bd2('0x3d')]]);}else if(this[_0x0bd2('0xc')][_0x3e2f91[_0x0bd2('0x3d')]]){this[_0x0bd2('0xc')][_0x3e2f91[_0x0bd2('0x3d')]][_0x0bd2('0x3f')]=_0x3e2f91[_0x0bd2('0x14')][_0x0bd2('0x2e')]();this[_0x0bd2('0xc')][_0x3e2f91['peer']][_0x0bd2('0x40')]=_0x3e2f91[_0x0bd2('0x40')];this[_0x0bd2('0x21')](util[_0x0bd2('0x32')]('trunk:%s',this[_0x0bd2('0xc')][_0x3e2f91['peer']][_0x0bd2('0x29')]),'trunk:save',this[_0x0bd2('0xc')][_0x3e2f91[_0x0bd2('0x3d')]]);}else{}}}catch(_0xef1cf8){logger['error'](_0x0bd2('0x43'),util[_0x0bd2('0x1b')](_0xef1cf8,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0xe48a=['phone','accountcode','peer','status','address','trunk:save','[syncPeerStatus][UserReport]','lodash','bluebird','util','ioredis','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','actionSipShowRegistry','then','actionSipPeerStatus','[loopSyncRealTimeShow]','error','inspect','prototype','actionDeviceStateList','catch','emit','isNotNull','find','stateRegistry','state','merge','actionid','username','format','name','[syncRegistry][UserReport]','device','toLowerCase','stateTime','toNumber','updateStatusRealtime','telephone:%s','trunk:%s','substring','indexOf','mobile'];(function(_0x3dbf08,_0x1bbc94){var _0x258697=function(_0x7e2111){while(--_0x7e2111){_0x3dbf08['push'](_0x3dbf08['shift']());}};_0x258697(++_0x1bbc94);}(_0xe48a,0x1df));var _0xae48=function(_0x4d2169,_0x353eb9){_0x4d2169=_0x4d2169-0x0;var _0x52e417=_0xe48a[_0x4d2169];return _0x52e417;};'use strict';var _=require(_0xae48('0x0'));var moment=require('moment');var BPromise=require(_0xae48('0x1'));var util=require(_0xae48('0x2'));var Redis=require(_0xae48('0x3'));var config=require(_0xae48('0x4'));var logger=require('../../../config/logger')(_0xae48('0x5'));var ami=require(_0xae48('0x6'));config[_0xae48('0x7')]=_[_0xae48('0x8')](config['redis'],{'host':_0xae48('0x9'),'port':0x18eb});var io=require(_0xae48('0xa'))(new Redis(config[_0xae48('0x7')]));function UserReport(_0x284f5c){this[_0xae48('0xb')]=_0x284f5c[_0xae48('0xb')];this[_0xae48('0xc')]=_0x284f5c['agents'];this[_0xae48('0xd')]=_0x284f5c[_0xae48('0xd')];ami['on']('registryentry',this[_0xae48('0xe')][_0xae48('0xf')](this));ami['on']('registry',this['syncRegistry']['bind'](this));ami['on'](_0xae48('0x10'),this[_0xae48('0x11')][_0xae48('0xf')](this));ami['on'](_0xae48('0x12'),this[_0xae48('0x13')][_0xae48('0xf')](this));this[_0xae48('0x14')]();return BPromise[_0xae48('0x15')]()['then'](ami[_0xae48('0x16')]())[_0xae48('0x17')](ami['actionDeviceStateList']())[_0xae48('0x17')](ami[_0xae48('0x18')]())['catch'](loggerCatch(_0xae48('0x19')));}function loggerCatch(_0x246c81){return function(_0x19d574){logger[_0xae48('0x1a')](_0x246c81,util[_0xae48('0x1b')](_0x19d574,{'showHidden':![],'depth':null}));};}UserReport[_0xae48('0x1c')][_0xae48('0x14')]=function(){setInterval(function(){BPromise[_0xae48('0x15')]()[_0xae48('0x17')](ami[_0xae48('0x16')]())[_0xae48('0x17')](ami[_0xae48('0x1d')]())['then'](ami['actionSipPeerStatus']())[_0xae48('0x1e')](loggerCatch(_0xae48('0x19')));},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x159879){return _0x159879!==null&&!_['isUndefined'](_0x159879);};UserReport[_0xae48('0x1c')][_0xae48('0x1f')]=function(_0x17e2de,_0x5eaaae,_0x8d83d5){io['to'](_0x17e2de)['emit'](_0x5eaaae,_0x8d83d5);};UserReport[_0xae48('0x1c')][_0xae48('0xe')]=function(_0x59ed49){try{if(this[_0xae48('0x20')](_0x59ed49)){var _0x4aa93b=_[_0xae48('0x21')](this[_0xae48('0xb')],{'registry':_0x59ed49['username']});if(_0x4aa93b){_0x59ed49[_0xae48('0x22')]=_0x59ed49[_0xae48('0x23')];_[_0xae48('0x24')](_0x4aa93b,_['omit'](_0x59ed49,['event',_0xae48('0x25'),_0xae48('0x26'),_0xae48('0x23')]));this[_0xae48('0x1f')](util[_0xae48('0x27')]('trunk:%s',_0x4aa93b[_0xae48('0x28')]),'trunk:save',_0x4aa93b);}}}catch(_0x529948){logger[_0xae48('0x1a')](_0xae48('0x29'),util['inspect'](_0x529948,{'showHidden':![],'depth':null}));}};UserReport[_0xae48('0x1c')][_0xae48('0x11')]=function(_0x2b4a22){try{if(this[_0xae48('0x20')](_0x2b4a22)){if(this['agents'][_0x2b4a22['device']]){if(!this[_0xae48('0xc')][_0x2b4a22[_0xae48('0x2a')]]['local']||_0x2b4a22[_0xae48('0x23')]['toLowerCase']()=='inuse'){this['agents'][_0x2b4a22['device']]['local']=![];if(this[_0xae48('0xc')][_0x2b4a22[_0xae48('0x2a')]]['state']!==_0x2b4a22[_0xae48('0x23')][_0xae48('0x2b')]()){this['agents'][_0x2b4a22[_0xae48('0x2a')]][_0xae48('0x2c')]=_[_0xae48('0x2d')](moment()[_0xae48('0x27')]('x'));}this[_0xae48('0xc')][_0x2b4a22['device']][_0xae48('0x23')]=_0x2b4a22[_0xae48('0x23')]['toLowerCase']();this['agents'][_0x2b4a22[_0xae48('0x2a')]][_0xae48('0x2e')](_0x2b4a22);}}else if(this['telephones'][_0x2b4a22['device']]){if(this['telephones'][_0x2b4a22[_0xae48('0x2a')]][_0xae48('0x23')]!==_0x2b4a22['state'][_0xae48('0x2b')]()){this[_0xae48('0xd')][_0x2b4a22[_0xae48('0x2a')]]['stateTime']=_[_0xae48('0x2d')](moment()[_0xae48('0x27')]('x'));}this[_0xae48('0xd')][_0x2b4a22['device']][_0xae48('0x23')]=_0x2b4a22['state'][_0xae48('0x2b')]();this[_0xae48('0x1f')](util[_0xae48('0x27')](_0xae48('0x2f'),this[_0xae48('0xd')][_0x2b4a22[_0xae48('0x2a')]][_0xae48('0x28')]),'telephone:save',this[_0xae48('0xd')][_0x2b4a22[_0xae48('0x2a')]]);}else if(this[_0xae48('0xb')][_0x2b4a22['device']]){if(this[_0xae48('0xb')][_0x2b4a22['device']]['state']!==_0x2b4a22['state'][_0xae48('0x2b')]()){this[_0xae48('0xb')][_0x2b4a22['device']][_0xae48('0x2c')]=_[_0xae48('0x2d')](moment()[_0xae48('0x27')]('x'));}this[_0xae48('0xb')][_0x2b4a22['device']][_0xae48('0x23')]=_0x2b4a22[_0xae48('0x23')][_0xae48('0x2b')]();this['emit'](util['format'](_0xae48('0x30'),this[_0xae48('0xb')][_0x2b4a22[_0xae48('0x2a')]][_0xae48('0x28')]),'trunk:save',this['trunks'][_0x2b4a22[_0xae48('0x2a')]]);}else if(_['startsWith'](_0x2b4a22['device'],'Queue')){}else if(_['startsWith'](_0x2b4a22[_0xae48('0x2a')],'Local')){var _0x334f86=_0x2b4a22['device'];var _0x2cab6e=_0x334f86[_0xae48('0x31')](_0x334f86[_0xae48('0x32')]('/')+0x1,_0x334f86[_0xae48('0x32')]('@'));var _0x38044c=_['find'](this[_0xae48('0xc')],function(_0x10f3fa){return _0x10f3fa[_0xae48('0x33')]==_0x2cab6e||_0x10f3fa[_0xae48('0x34')]==_0x2cab6e||_0x10f3fa[_0xae48('0x35')]==_0x2cab6e;});if(_0x38044c){if(_0x38044c['state']!==_0x2b4a22[_0xae48('0x23')][_0xae48('0x2b')]()){_0x38044c[_0xae48('0x2c')]=_[_0xae48('0x2d')](moment()[_0xae48('0x27')]('x'));}_0x38044c['state']=_0x2b4a22[_0xae48('0x23')][_0xae48('0x2b')]();_0x38044c['local']=!![];_0x38044c[_0xae48('0x2e')](_0x2b4a22);}}else{}}}catch(_0x48205b){logger['error']('[syncDeviceState][UserReport]',util[_0xae48('0x1b')](_0x48205b,{'showHidden':![],'depth':null}));}};UserReport[_0xae48('0x1c')][_0xae48('0x13')]=function(_0xb7535c){try{if(this['isNotNull'](_0xb7535c)&&this[_0xae48('0x20')](_0xb7535c[_0xae48('0x12')])){if(this['agents'][_0xb7535c[_0xae48('0x36')]]){if(!this[_0xae48('0xc')][_0xb7535c[_0xae48('0x36')]]['local']||_0xb7535c[_0xae48('0x12')][_0xae48('0x2b')]()=='registered'){this[_0xae48('0xc')][_0xb7535c[_0xae48('0x36')]]['local']=![];this[_0xae48('0xc')][_0xb7535c['peer']][_0xae48('0x37')]=_0xb7535c[_0xae48('0x12')][_0xae48('0x2b')]();this['agents'][_0xb7535c[_0xae48('0x36')]][_0xae48('0x38')]=_0xb7535c[_0xae48('0x38')];this[_0xae48('0xc')][_0xb7535c['peer']]['updateStatusRealtime'](_0xb7535c);}}else if(this[_0xae48('0xd')][_0xb7535c[_0xae48('0x36')]]){this[_0xae48('0xd')][_0xb7535c[_0xae48('0x36')]][_0xae48('0x37')]=_0xb7535c[_0xae48('0x12')][_0xae48('0x2b')]();this[_0xae48('0xd')][_0xb7535c[_0xae48('0x36')]][_0xae48('0x38')]=_0xb7535c[_0xae48('0x38')];this[_0xae48('0x1f')](util[_0xae48('0x27')]('telephone:%s',this[_0xae48('0xd')][_0xb7535c[_0xae48('0x36')]][_0xae48('0x28')]),'telephone:save',this[_0xae48('0xd')][_0xb7535c[_0xae48('0x36')]]);}else if(this[_0xae48('0xb')][_0xb7535c[_0xae48('0x36')]]){this[_0xae48('0xb')][_0xb7535c[_0xae48('0x36')]]['status']=_0xb7535c[_0xae48('0x12')][_0xae48('0x2b')]();this[_0xae48('0xb')][_0xb7535c[_0xae48('0x36')]][_0xae48('0x38')]=_0xb7535c[_0xae48('0x38')];this['emit'](util[_0xae48('0x27')]('trunk:%s',this[_0xae48('0xb')][_0xb7535c[_0xae48('0x36')]][_0xae48('0x28')]),_0xae48('0x39'),this[_0xae48('0xb')][_0xb7535c[_0xae48('0x36')]]);}else{}}}catch(_0x207018){logger['error'](_0xae48('0x3a'),util['inspect'](_0x207018,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 0e3b53f..7fad160 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 _0xb88f=['acwTimeout','destconnectedlinenum','user:agentcomplete','custom:agentcomplete','addVariable','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','membercalls','memberinterface','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','[syncBlindTransfer][VoiceAgentReport]','channel','substring','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','lastIndexOf','[syncMusicOnHoldStop][VoiceAgentReport]','util','ioredis','../../../config/environment','../ami','redis','defaults','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncAgentComplete','syncVarSet','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','omit','custom:agentcalled','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','agentconnectAt','connect','holdtime','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','user:%s','user:agentconnect','agentringnoanswerAt','reason','lastevent','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','inspect','[syncAgentRingNoAnswer][VoiceAgentReport]','syncQueueCallerAbandon','hasOwnProperty','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','agentcompleteAt','complete','talktime','transfer','agent','acw','agentacw'];(function(_0x2c5919,_0x204c87){var _0x35b831=function(_0x1ddef7){while(--_0x1ddef7){_0x2c5919['push'](_0x2c5919['shift']());}};_0x35b831(++_0x204c87);}(_0xb88f,0x109));var _0xfb88=function(_0x473ee7,_0x4dd754){_0x473ee7=_0x473ee7-0x0;var _0x30f0d4=_0xb88f[_0x473ee7];return _0x30f0d4;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xfb88('0x0'));var Redis=require(_0xfb88('0x1'));var config=require(_0xfb88('0x2'));var logger=require('../../../config/logger')('ami');var ami=require(_0xfb88('0x3'));config[_0xfb88('0x4')]=_[_0xfb88('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xfb88('0x6'))(new Redis(config[_0xfb88('0x4')]));function VoiceAgentReport(_0xd04cdc){this[_0xfb88('0x7')]={};this[_0xfb88('0x8')]=_0xd04cdc['voiceQueues'];this[_0xfb88('0x9')]=_0xd04cdc[_0xfb88('0x9')];this[_0xfb88('0xa')]={};ami['on'](_0xfb88('0xb'),this[_0xfb88('0xc')][_0xfb88('0xd')](this));ami['on'](_0xfb88('0xe'),this[_0xfb88('0xf')][_0xfb88('0xd')](this));ami['on'](_0xfb88('0x10'),this[_0xfb88('0x11')]['bind'](this));ami['on'](_0xfb88('0x12'),this['syncQueueCallerAbandon'][_0xfb88('0xd')](this));ami['on'](_0xfb88('0x13'),this[_0xfb88('0x14')][_0xfb88('0xd')](this));ami['on']('varset',this[_0xfb88('0x15')][_0xfb88('0xd')](this));ami['on']('hangup',this[_0xfb88('0x16')][_0xfb88('0xd')](this));ami['on']('musiconholdstart',this[_0xfb88('0x17')][_0xfb88('0xd')](this));ami['on'](_0xfb88('0x18'),this[_0xfb88('0x19')][_0xfb88('0xd')](this));ami['on'](_0xfb88('0x1a'),this[_0xfb88('0x1b')][_0xfb88('0xd')](this));ami['on'](_0xfb88('0x1c'),this[_0xfb88('0x1d')]['bind'](this));}VoiceAgentReport[_0xfb88('0x1e')][_0xfb88('0x1f')]=function(_0x3171b4,_0x22f548,_0x5d725a){io['to'](_0x3171b4)[_0xfb88('0x1f')](_0x22f548,_0x5d725a);};VoiceAgentReport[_0xfb88('0x1e')][_0xfb88('0x20')]=function(_0x5074b3){return _0x5074b3!==null&&!_[_0xfb88('0x21')](_0x5074b3);};VoiceAgentReport[_0xfb88('0x1e')][_0xfb88('0xc')]=function(_0x4ae299){try{if(this[_0xfb88('0x20')](_0x4ae299)){if(_[_0xfb88('0x21')](this['channels'][_0x4ae299[_0xfb88('0x22')]])){this['channels'][_0x4ae299[_0xfb88('0x22')]]={};}if(_[_0xfb88('0x21')](this[_0xfb88('0x7')][_0x4ae299['uniqueid']][_0x4ae299[_0xfb88('0x23')]])){this[_0xfb88('0x7')][_0x4ae299[_0xfb88('0x22')]][_0x4ae299[_0xfb88('0x23')]]={'agentcalledAt':moment()[_0xfb88('0x24')](_0xfb88('0x25')),'lastevent':_0xfb88('0x26'),'variables':this[_0xfb88('0xa')][_0x4ae299[_0xfb88('0x22')]],'type':this[_0xfb88('0x8')][_0x4ae299['queue']]?this[_0xfb88('0x8')][_0x4ae299[_0xfb88('0x27')]][_0xfb88('0x28')]||_0xfb88('0x29'):_0xfb88('0x29')};}_[_0xfb88('0x2a')](this[_0xfb88('0x7')][_0x4ae299[_0xfb88('0x22')]][_0x4ae299[_0xfb88('0x23')]],_[_0xfb88('0x2b')](_0x4ae299,['event','privilege']));ami[_0xfb88('0x1f')](_0xfb88('0x2c'),this[_0xfb88('0x7')][_0x4ae299['uniqueid']][_0x4ae299[_0xfb88('0x23')]]);this['emit'](util['format']('user:%s',_0x4ae299[_0xfb88('0x2d')]),_0xfb88('0x2e'),this[_0xfb88('0x7')][_0x4ae299[_0xfb88('0x22')]][_0x4ae299[_0xfb88('0x23')]]);}}catch(_0x310623){logger[_0xfb88('0x2f')](_0xfb88('0x30'),util['inspect'](_0x310623,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfb88('0x1e')][_0xfb88('0xf')]=function(_0xfe9f42){try{if(this[_0xfb88('0x20')](_0xfe9f42)){if(this['channels'][_0xfe9f42[_0xfb88('0x22')]]){for(var _0x167801 in this[_0xfb88('0x7')][_0xfe9f42[_0xfb88('0x22')]]){if(this[_0xfb88('0x7')][_0xfe9f42['uniqueid']]['hasOwnProperty'](_0x167801)){if(_0xfe9f42[_0xfb88('0x23')]===_0x167801){this[_0xfb88('0x7')][_0xfe9f42[_0xfb88('0x22')]][_0x167801][_0xfb88('0x31')]=moment()[_0xfb88('0x24')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xfb88('0x7')][_0xfe9f42[_0xfb88('0x22')]][_0x167801]['lastevent']=_0xfb88('0x32');this[_0xfb88('0x7')][_0xfe9f42[_0xfb88('0x22')]][_0x167801]['holdtime']=_0xfe9f42[_0xfb88('0x33')];this[_0xfb88('0x7')][_0xfe9f42[_0xfb88('0x22')]][_0x167801]['connectedlinenum']=_0xfe9f42['connectedlinenum'];this[_0xfb88('0x7')][_0xfe9f42[_0xfb88('0x22')]][_0x167801][_0xfb88('0x34')]=_0xfe9f42[_0xfb88('0x34')];this[_0xfb88('0x7')][_0xfe9f42[_0xfb88('0x22')]][_0x167801]['destchannelstate']=_0xfe9f42[_0xfb88('0x35')];this[_0xfb88('0x7')][_0xfe9f42[_0xfb88('0x22')]][_0x167801][_0xfb88('0x36')]=_0xfe9f42[_0xfb88('0x36')];_['merge'](this[_0xfb88('0x9')][_0xfe9f42[_0xfb88('0x37')]],_[_0xfb88('0x38')](_0xfe9f42,['queue','destconnectedlinenum']));this[_0xfb88('0x1f')](util[_0xfb88('0x24')](_0xfb88('0x39'),_0xfe9f42[_0xfb88('0x2d')]),_0xfb88('0x3a'),this['channels'][_0xfe9f42[_0xfb88('0x22')]][_0xfe9f42[_0xfb88('0x23')]]);ami[_0xfb88('0x1f')]('custom:agentconnect',this[_0xfb88('0x7')][_0xfe9f42[_0xfb88('0x22')]][_0x167801]);}else if(!this[_0xfb88('0x7')][_0xfe9f42[_0xfb88('0x22')]][_0x167801][_0xfb88('0x10')]&&!this['channels'][_0xfe9f42[_0xfb88('0x22')]][_0x167801][_0xfb88('0x13')]){this[_0xfb88('0x7')][_0xfe9f42[_0xfb88('0x22')]][_0x167801][_0xfb88('0x10')]=!![];this[_0xfb88('0x7')][_0xfe9f42['uniqueid']][_0x167801][_0xfb88('0x3b')]=moment()[_0xfb88('0x24')](_0xfb88('0x25'));this[_0xfb88('0x7')][_0xfe9f42[_0xfb88('0x22')]][_0x167801][_0xfb88('0x3c')]='answered_elsewhere';this[_0xfb88('0x7')][_0xfe9f42[_0xfb88('0x22')]][_0x167801][_0xfb88('0x3d')]=_0xfb88('0x3e');this[_0xfb88('0x7')][_0xfe9f42['uniqueid']][_0x167801][_0xfb88('0x3f')]=_0xfe9f42[_0xfb88('0x23')];this['channels'][_0xfe9f42[_0xfb88('0x22')]][_0x167801][_0xfb88('0x40')]=_0xfe9f42['membername'];ami[_0xfb88('0x1f')](_0xfb88('0x41'),this[_0xfb88('0x7')][_0xfe9f42[_0xfb88('0x22')]][_0x167801]);}}}}}}catch(_0x33b37c){logger[_0xfb88('0x2f')](_0xfb88('0x42'),util[_0xfb88('0x43')](_0x33b37c,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentRingNoAnswer']=function(_0x5b45b6){try{if(this[_0xfb88('0x20')](_0x5b45b6)){if(this[_0xfb88('0x7')][_0x5b45b6[_0xfb88('0x22')]]&&this[_0xfb88('0x7')][_0x5b45b6['uniqueid']][_0x5b45b6['destuniqueid']]){this[_0xfb88('0x7')][_0x5b45b6[_0xfb88('0x22')]][_0x5b45b6[_0xfb88('0x23')]][_0xfb88('0x10')]=!![];this[_0xfb88('0x7')][_0x5b45b6[_0xfb88('0x22')]][_0x5b45b6[_0xfb88('0x23')]][_0xfb88('0x3b')]=moment()[_0xfb88('0x24')](_0xfb88('0x25'));this[_0xfb88('0x7')][_0x5b45b6[_0xfb88('0x22')]][_0x5b45b6[_0xfb88('0x23')]][_0xfb88('0x3c')]='rejected';this['channels'][_0x5b45b6[_0xfb88('0x22')]][_0x5b45b6[_0xfb88('0x23')]][_0xfb88('0x3d')]='rejected';ami[_0xfb88('0x1f')]('custom:agentringnoanswer',this[_0xfb88('0x7')][_0x5b45b6[_0xfb88('0x22')]][_0x5b45b6[_0xfb88('0x23')]]);}}}catch(_0x27bdd8){logger[_0xfb88('0x2f')](_0xfb88('0x44'),util[_0xfb88('0x43')](_0x27bdd8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfb88('0x1e')][_0xfb88('0x45')]=function(_0x3d3bda){try{if(this[_0xfb88('0x20')](_0x3d3bda)){if(this[_0xfb88('0x7')][_0x3d3bda[_0xfb88('0x22')]]){for(var _0x1011c1 in this[_0xfb88('0x7')][_0x3d3bda[_0xfb88('0x22')]]){if(this[_0xfb88('0x7')][_0x3d3bda[_0xfb88('0x22')]][_0xfb88('0x46')](_0x1011c1)&&!this['channels'][_0x3d3bda[_0xfb88('0x22')]][_0x1011c1][_0xfb88('0x10')]&&!this['channels'][_0x3d3bda[_0xfb88('0x22')]][_0x1011c1][_0xfb88('0x13')]){this[_0xfb88('0x7')][_0x3d3bda[_0xfb88('0x22')]][_0x1011c1][_0xfb88('0x10')]=!![];this[_0xfb88('0x7')][_0x3d3bda['uniqueid']][_0x1011c1][_0xfb88('0x3b')]=moment()[_0xfb88('0x24')](_0xfb88('0x25'));this[_0xfb88('0x7')][_0x3d3bda[_0xfb88('0x22')]][_0x1011c1][_0xfb88('0x3c')]='abandoned';this[_0xfb88('0x7')][_0x3d3bda[_0xfb88('0x22')]][_0x1011c1][_0xfb88('0x3d')]='abandoned';ami[_0xfb88('0x1f')](_0xfb88('0x47'),this[_0xfb88('0x7')][_0x3d3bda['uniqueid']][_0x1011c1]);}}}}}catch(_0x2b69c2){logger[_0xfb88('0x2f')](_0xfb88('0x48'),util[_0xfb88('0x43')](_0x2b69c2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfb88('0x1e')]['syncAgentComplete']=function(_0xe3569a){try{if(this[_0xfb88('0x20')](_0xe3569a)){if(this[_0xfb88('0x7')][_0xe3569a[_0xfb88('0x22')]]){for(var _0xc5269e in this[_0xfb88('0x7')][_0xe3569a['uniqueid']]){if(this[_0xfb88('0x7')][_0xe3569a[_0xfb88('0x22')]]['hasOwnProperty'](_0xc5269e)){if(this[_0xfb88('0x7')][_0xe3569a['uniqueid']][_0xc5269e][_0xfb88('0x31')]&&!this[_0xfb88('0x7')][_0xe3569a[_0xfb88('0x22')]][_0xc5269e][_0xfb88('0x13')]){this['channels'][_0xe3569a[_0xfb88('0x22')]][_0xc5269e][_0xfb88('0x13')]=!![];this[_0xfb88('0x7')][_0xe3569a['uniqueid']][_0xc5269e][_0xfb88('0x49')]=moment()[_0xfb88('0x24')](_0xfb88('0x25'));this[_0xfb88('0x7')][_0xe3569a[_0xfb88('0x22')]][_0xc5269e]['lastevent']=_0xfb88('0x4a');this[_0xfb88('0x7')][_0xe3569a[_0xfb88('0x22')]][_0xc5269e][_0xfb88('0x4b')]=_0xe3569a['talktime'];this[_0xfb88('0x7')][_0xe3569a['uniqueid']][_0xc5269e]['reason']=_0xe3569a['reason']==_0xfb88('0x4c')?_0xfb88('0x4d'):_0xe3569a[_0xfb88('0x3c')];if(this[_0xfb88('0x8')][_0xe3569a[_0xfb88('0x27')]]&&this[_0xfb88('0x8')][_0xe3569a[_0xfb88('0x27')]][_0xfb88('0x4e')]){this[_0xfb88('0x7')][_0xe3569a[_0xfb88('0x22')]][_0xc5269e][_0xfb88('0x4f')]=!![];this[_0xfb88('0x7')][_0xe3569a[_0xfb88('0x22')]][_0xc5269e]['acwtime']=this[_0xfb88('0x8')][_0xe3569a[_0xfb88('0x27')]][_0xfb88('0x50')];}this['agents'][_0xe3569a[_0xfb88('0x37')]]=_[_0xfb88('0x2b')](this[_0xfb88('0x9')][_0xe3569a['interface']],['queue',_0xfb88('0x51')]);this['emit'](util[_0xfb88('0x24')](_0xfb88('0x39'),_0xe3569a['membername']),_0xfb88('0x52'),this[_0xfb88('0x7')][_0xe3569a[_0xfb88('0x22')]][_0xc5269e]);ami[_0xfb88('0x1f')](_0xfb88('0x53'),this['channels'][_0xe3569a['uniqueid']][_0xc5269e]);}}}}}}catch(_0x52aa2f){logger[_0xfb88('0x2f')]('[syncAgentComplete][VoiceAgentReport]',util[_0xfb88('0x43')](_0x52aa2f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfb88('0x1e')]['syncVarSet']=function(_0x25f55b){try{if(this[_0xfb88('0x20')](_0x25f55b)){this[_0xfb88('0x54')](_0x25f55b[_0xfb88('0x22')],_['keys'](_0x25f55b[_0xfb88('0x55')])[0x0],_0x25f55b[_0xfb88('0x56')]);if(this[_0xfb88('0x7')][_0x25f55b[_0xfb88('0x22')]]){for(var _0x54a620 in this[_0xfb88('0x7')][_0x25f55b[_0xfb88('0x22')]]){if(this[_0xfb88('0x7')][_0x25f55b['uniqueid']][_0xfb88('0x46')](_0x54a620)){if(_[_0xfb88('0x21')](this[_0xfb88('0x7')][_0x25f55b['uniqueid']][_0x54a620]['variables'])){this[_0xfb88('0x7')][_0x25f55b[_0xfb88('0x22')]][_0x54a620][_0xfb88('0xa')]={};}this['channels'][_0x25f55b[_0xfb88('0x22')]][_0x54a620][_0xfb88('0xa')]=this[_0xfb88('0xa')][_0x25f55b[_0xfb88('0x22')]];}}}}}catch(_0x4b4399){logger['error'](_0xfb88('0x57'),util[_0xfb88('0x43')](_0x4b4399,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfb88('0x1e')][_0xfb88('0x54')]=function(_0x15fadf,_0x663f8a,_0x3d0cee){var _0x4f1e6b=[_0xfb88('0x58'),_0xfb88('0x59'),_0xfb88('0x5a'),_0xfb88('0x5b'),_0xfb88('0x5c'),_0xfb88('0x5d'),_0xfb88('0x5e'),_0xfb88('0x5f'),_0xfb88('0x60'),'sipuri',_0xfb88('0x61'),'bridgepvtcallid',_0xfb88('0x62'),'memberdynamic',_0xfb88('0x63'),'memberlastcall',_0xfb88('0x2d'),'memberpenalty','memberrealtime'];if(!_['isNil'](_0x663f8a)&&!_['includes'](_0x4f1e6b,_0x663f8a)){if(_[_0xfb88('0x21')](this[_0xfb88('0xa')][_0x15fadf])){this[_0xfb88('0xa')][_0x15fadf]={};}this['variables'][_0x15fadf][_0x663f8a]=_0x3d0cee;}};VoiceAgentReport[_0xfb88('0x1e')][_0xfb88('0x16')]=function(_0x3a57d6){try{if(this['isNotNull'](_0x3a57d6)){if(this[_0xfb88('0x7')][_0x3a57d6[_0xfb88('0x22')]]){for(var _0x31de05 in this['channels'][_0x3a57d6['uniqueid']]){if(this[_0xfb88('0x7')][_0x3a57d6[_0xfb88('0x22')]][_0xfb88('0x46')](_0x31de05)){if(this[_0xfb88('0x7')][_0x3a57d6[_0xfb88('0x22')]][_0x31de05][_0xfb88('0x3c')]=='transfer'&&this['channels'][_0x3a57d6[_0xfb88('0x22')]][_0x31de05][_0xfb88('0x13')]){this[_0xfb88('0x7')][_0x3a57d6[_0xfb88('0x22')]][_0x31de05][_0xfb88('0x49')]=moment()[_0xfb88('0x24')](_0xfb88('0x25'));}}}ami[_0xfb88('0x1f')](_0xfb88('0x64'),_[_0xfb88('0x65')](this['channels'][_0x3a57d6[_0xfb88('0x22')]]));delete this[_0xfb88('0x7')][_0x3a57d6[_0xfb88('0x22')]];}if(this[_0xfb88('0xa')][_0x3a57d6[_0xfb88('0x22')]]){delete this[_0xfb88('0xa')][_0x3a57d6[_0xfb88('0x22')]];}}}catch(_0x2bfbd2){logger[_0xfb88('0x2f')](_0xfb88('0x66'),util[_0xfb88('0x43')](_0x2bfbd2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfb88('0x1e')][_0xfb88('0x1b')]=function(_0xe1a8){try{if(this[_0xfb88('0x20')](_0xe1a8)){if(this[_0xfb88('0x7')][_0xe1a8[_0xfb88('0x67')]]){for(var _0x9740ce in this[_0xfb88('0x7')][_0xe1a8[_0xfb88('0x67')]]){if(this[_0xfb88('0x7')][_0xe1a8['transfereeuniqueid']][_0xfb88('0x46')](_0x9740ce)){if(_0xe1a8['origtransfereruniqueid']===_0x9740ce){var _0x362d38=moment();this['channels'][_0xe1a8['transfereeuniqueid']][_0x9740ce][_0xfb88('0x13')]=!![];this['channels'][_0xe1a8[_0xfb88('0x67')]][_0x9740ce]['agentcompleteAt']=moment()[_0xfb88('0x24')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xfb88('0x7')][_0xe1a8[_0xfb88('0x67')]][_0x9740ce][_0xfb88('0x3c')]=_0xfb88('0x4c');this[_0xfb88('0x7')][_0xe1a8[_0xfb88('0x67')]][_0x9740ce]['lastevent']=_0xfb88('0x4a');this[_0xfb88('0x7')][_0xe1a8['transfereeuniqueid']][_0x9740ce][_0xfb88('0x4b')]=_0x362d38['diff'](this[_0xfb88('0x7')][_0xe1a8[_0xfb88('0x67')]][_0x9740ce][_0xfb88('0x31')],_0xfb88('0x68'));}}}}if(this[_0xfb88('0x7')][_0xe1a8['secondtransfereruniqueid']]){var _0x309e22=this[_0xfb88('0x7')][_0xe1a8[_0xfb88('0x69')]];this[_0xfb88('0x7')][_0xe1a8[_0xfb88('0x69')]]=this[_0xfb88('0x7')][_0xe1a8[_0xfb88('0x67')]];this[_0xfb88('0x7')][_0xe1a8[_0xfb88('0x67')]]=_0x309e22;}}}catch(_0x268ddc){logger['error'](_0xfb88('0x6a'),util[_0xfb88('0x43')](_0x268ddc,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfb88('0x1e')][_0xfb88('0x1d')]=function(_0x4526b9){try{if(this['isNotNull'](_0x4526b9)){if(this['channels'][_0x4526b9[_0xfb88('0x67')]]){for(var _0x25d2f8 in this['channels'][_0x4526b9[_0xfb88('0x67')]]){if(this['channels'][_0x4526b9[_0xfb88('0x67')]][_0xfb88('0x46')](_0x25d2f8)){if(_0x4526b9[_0xfb88('0x6b')]===_0x25d2f8){var _0x1fc11d=moment();this[_0xfb88('0x7')][_0x4526b9['transfereeuniqueid']][_0x25d2f8][_0xfb88('0x13')]=!![];this['channels'][_0x4526b9[_0xfb88('0x67')]][_0x25d2f8][_0xfb88('0x49')]=_0x1fc11d;this[_0xfb88('0x7')][_0x4526b9[_0xfb88('0x67')]][_0x25d2f8][_0xfb88('0x3c')]=_0xfb88('0x4c');this[_0xfb88('0x7')][_0x4526b9[_0xfb88('0x67')]][_0x25d2f8][_0xfb88('0x3d')]=_0xfb88('0x4a');this[_0xfb88('0x7')][_0x4526b9[_0xfb88('0x67')]][_0x25d2f8]['talktime']=_0x1fc11d['diff'](this[_0xfb88('0x7')][_0x4526b9[_0xfb88('0x67')]][_0x25d2f8][_0xfb88('0x31')],_0xfb88('0x68'));}}}}}}catch(_0x1205b8){logger['error'](_0xfb88('0x6c'),util[_0xfb88('0x43')](_0x1205b8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfb88('0x1e')][_0xfb88('0x17')]=function(_0x55daec){var _0x107495='';try{if(this[_0xfb88('0x20')](_0x55daec)){if(_0x55daec['channel']){_0x107495=_0x55daec[_0xfb88('0x6d')][_0xfb88('0x6e')](0x0,_0x55daec['channel']['lastIndexOf']('-'));if(this[_0xfb88('0x9')][_0x107495]){this[_0xfb88('0x9')][_0x107495][_0xfb88('0x6f')]=!![];}}}}catch(_0x5bf4d8){logger['error'](_0xfb88('0x70'),util[_0xfb88('0x43')](_0x5bf4d8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfb88('0x1e')][_0xfb88('0x19')]=function(_0x156ccd){var _0x676f57='';try{if(this[_0xfb88('0x20')](_0x156ccd)){if(_0x156ccd[_0xfb88('0x6d')]){_0x676f57=_0x156ccd[_0xfb88('0x6d')][_0xfb88('0x6e')](0x0,_0x156ccd['channel'][_0xfb88('0x71')]('-'));if(this[_0xfb88('0x9')][_0x676f57]){this[_0xfb88('0x9')][_0x676f57][_0xfb88('0x6f')]=![];}}}}catch(_0x31ce49){logger[_0xfb88('0x2f')](_0xfb88('0x72'),util[_0xfb88('0x43')](_0x31ce49,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x4f72=['agents','variables','agentcalled','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','bind','varset','hangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','syncAgentCalled','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','merge','omit','event','privilege','custom:agentcalled','membername','user:called','error','inspect','agentconnectAt','lastevent','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','user:%s','user:agentconnect','agentringnoanswer','agentcomplete','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','agentringnoanswerAt','reason','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','syncQueueCallerAbandon','hasOwnProperty','custom:agentqueuecallerabandon','syncAgentComplete','complete','talktime','transfer','acw','agentacw','acwTimeout','[syncAgentComplete][VoiceAgentReport]','syncVarSet','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','agentcompleteAt','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','transfereruniqueid','diff','seconds','[syncBlindTransfer][VoiceAgentReport]','channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','lodash','moment','util','../../../config/logger','redis','defaults','localhost','channels','voiceQueues'];(function(_0xc26f41,_0x207afc){var _0x1b2580=function(_0x3b19ea){while(--_0x3b19ea){_0xc26f41['push'](_0xc26f41['shift']());}};_0x1b2580(++_0x207afc);}(_0x4f72,0x168));var _0x24f7=function(_0x5b3c32,_0x9ee272){_0x5b3c32=_0x5b3c32-0x0;var _0x2a8404=_0x4f72[_0x5b3c32];return _0x2a8404;};'use strict';var _=require(_0x24f7('0x0'));var moment=require(_0x24f7('0x1'));var util=require(_0x24f7('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x24f7('0x3'))('ami');var ami=require('../ami');config[_0x24f7('0x4')]=_[_0x24f7('0x5')](config[_0x24f7('0x4')],{'host':_0x24f7('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x24f7('0x4')]));function VoiceAgentReport(_0x71c14b){this[_0x24f7('0x7')]={};this['voiceQueues']=_0x71c14b[_0x24f7('0x8')];this['agents']=_0x71c14b[_0x24f7('0x9')];this[_0x24f7('0xa')]={};ami['on'](_0x24f7('0xb'),this['syncAgentCalled']['bind'](this));ami['on'](_0x24f7('0xc'),this[_0x24f7('0xd')]['bind'](this));ami['on']('agentringnoanswer',this[_0x24f7('0xe')]['bind'](this));ami['on'](_0x24f7('0xf'),this['syncQueueCallerAbandon'][_0x24f7('0x10')](this));ami['on']('agentcomplete',this['syncAgentComplete']['bind'](this));ami['on'](_0x24f7('0x11'),this['syncVarSet'][_0x24f7('0x10')](this));ami['on'](_0x24f7('0x12'),this['syncHangup']['bind'](this));ami['on'](_0x24f7('0x13'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x24f7('0x14'),this[_0x24f7('0x15')][_0x24f7('0x10')](this));ami['on'](_0x24f7('0x16'),this[_0x24f7('0x17')][_0x24f7('0x10')](this));ami['on'](_0x24f7('0x18'),this[_0x24f7('0x19')][_0x24f7('0x10')](this));}VoiceAgentReport['prototype'][_0x24f7('0x1a')]=function(_0x257068,_0x55d342,_0x4200d3){io['to'](_0x257068)[_0x24f7('0x1a')](_0x55d342,_0x4200d3);};VoiceAgentReport[_0x24f7('0x1b')][_0x24f7('0x1c')]=function(_0x38a0c4){return _0x38a0c4!==null&&!_[_0x24f7('0x1d')](_0x38a0c4);};VoiceAgentReport[_0x24f7('0x1b')][_0x24f7('0x1e')]=function(_0x499655){try{if(this[_0x24f7('0x1c')](_0x499655)){if(_[_0x24f7('0x1d')](this[_0x24f7('0x7')][_0x499655['uniqueid']])){this[_0x24f7('0x7')][_0x499655[_0x24f7('0x1f')]]={};}if(_[_0x24f7('0x1d')](this[_0x24f7('0x7')][_0x499655['uniqueid']][_0x499655[_0x24f7('0x20')]])){this[_0x24f7('0x7')][_0x499655['uniqueid']][_0x499655['destuniqueid']]={'agentcalledAt':moment()[_0x24f7('0x21')](_0x24f7('0x22')),'lastevent':_0x24f7('0x23'),'variables':this['variables'][_0x499655['uniqueid']],'type':this[_0x24f7('0x8')][_0x499655[_0x24f7('0x24')]]?this[_0x24f7('0x8')][_0x499655[_0x24f7('0x24')]][_0x24f7('0x25')]||_0x24f7('0x26'):_0x24f7('0x26')};}_[_0x24f7('0x27')](this[_0x24f7('0x7')][_0x499655[_0x24f7('0x1f')]][_0x499655[_0x24f7('0x20')]],_[_0x24f7('0x28')](_0x499655,[_0x24f7('0x29'),_0x24f7('0x2a')]));ami[_0x24f7('0x1a')](_0x24f7('0x2b'),this['channels'][_0x499655[_0x24f7('0x1f')]][_0x499655[_0x24f7('0x20')]]);this[_0x24f7('0x1a')](util[_0x24f7('0x21')]('user:%s',_0x499655[_0x24f7('0x2c')]),_0x24f7('0x2d'),this[_0x24f7('0x7')][_0x499655[_0x24f7('0x1f')]][_0x499655[_0x24f7('0x20')]]);}}catch(_0x4c17ed){logger[_0x24f7('0x2e')]('[syncAgentCalled][VoiceAgentReport]',util[_0x24f7('0x2f')](_0x4c17ed,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x24f7('0x1b')][_0x24f7('0xd')]=function(_0x1e9de9){try{if(this[_0x24f7('0x1c')](_0x1e9de9)){if(this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]]){for(var _0x5a59be in this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]]){if(this['channels'][_0x1e9de9[_0x24f7('0x1f')]]['hasOwnProperty'](_0x5a59be)){if(_0x1e9de9[_0x24f7('0x20')]===_0x5a59be){this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be][_0x24f7('0x30')]=moment()[_0x24f7('0x21')](_0x24f7('0x22'));this[_0x24f7('0x7')][_0x1e9de9['uniqueid']][_0x5a59be][_0x24f7('0x31')]='connect';this[_0x24f7('0x7')][_0x1e9de9['uniqueid']][_0x5a59be][_0x24f7('0x32')]=_0x1e9de9[_0x24f7('0x32')];this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be][_0x24f7('0x33')]=_0x1e9de9[_0x24f7('0x33')];this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be][_0x24f7('0x34')]=_0x1e9de9['connectedlinename'];this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be][_0x24f7('0x35')]=_0x1e9de9[_0x24f7('0x35')];this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be][_0x24f7('0x36')]=_0x1e9de9[_0x24f7('0x36')];_['merge'](this['agents'][_0x1e9de9[_0x24f7('0x37')]],_['pick'](_0x1e9de9,[_0x24f7('0x24'),'destconnectedlinenum']));this[_0x24f7('0x1a')](util['format'](_0x24f7('0x38'),_0x1e9de9[_0x24f7('0x2c')]),_0x24f7('0x39'),this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]][_0x1e9de9[_0x24f7('0x20')]]);ami[_0x24f7('0x1a')]('custom:agentconnect',this['channels'][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be]);}else if(!this[_0x24f7('0x7')][_0x1e9de9['uniqueid']][_0x5a59be][_0x24f7('0x3a')]&&!this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be][_0x24f7('0x3b')]){this['channels'][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be][_0x24f7('0x3a')]=!![];this['channels'][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be]['agentringnoanswerAt']=moment()['format'](_0x24f7('0x22'));this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be]['reason']=_0x24f7('0x3c');this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be]['lastevent']=_0x24f7('0x3c');this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be][_0x24f7('0x3d')]=_0x1e9de9[_0x24f7('0x20')];this[_0x24f7('0x7')][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be][_0x24f7('0x3e')]=_0x1e9de9[_0x24f7('0x2c')];ami[_0x24f7('0x1a')](_0x24f7('0x3f'),this['channels'][_0x1e9de9[_0x24f7('0x1f')]][_0x5a59be]);}}}}}}catch(_0x151aa9){logger[_0x24f7('0x2e')](_0x24f7('0x40'),util[_0x24f7('0x2f')](_0x151aa9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x24f7('0x1b')]['syncAgentRingNoAnswer']=function(_0x40eb47){try{if(this[_0x24f7('0x1c')](_0x40eb47)){if(this[_0x24f7('0x7')][_0x40eb47[_0x24f7('0x1f')]]&&this['channels'][_0x40eb47[_0x24f7('0x1f')]][_0x40eb47[_0x24f7('0x20')]]){this['channels'][_0x40eb47[_0x24f7('0x1f')]][_0x40eb47[_0x24f7('0x20')]][_0x24f7('0x3a')]=!![];this[_0x24f7('0x7')][_0x40eb47[_0x24f7('0x1f')]][_0x40eb47[_0x24f7('0x20')]][_0x24f7('0x41')]=moment()[_0x24f7('0x21')](_0x24f7('0x22'));this[_0x24f7('0x7')][_0x40eb47[_0x24f7('0x1f')]][_0x40eb47[_0x24f7('0x20')]][_0x24f7('0x42')]=_0x24f7('0x43');this[_0x24f7('0x7')][_0x40eb47[_0x24f7('0x1f')]][_0x40eb47[_0x24f7('0x20')]][_0x24f7('0x31')]=_0x24f7('0x43');ami[_0x24f7('0x1a')](_0x24f7('0x44'),this[_0x24f7('0x7')][_0x40eb47['uniqueid']][_0x40eb47[_0x24f7('0x20')]]);}}}catch(_0x494b49){logger[_0x24f7('0x2e')](_0x24f7('0x45'),util[_0x24f7('0x2f')](_0x494b49,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x24f7('0x1b')][_0x24f7('0x46')]=function(_0x3b463b){try{if(this[_0x24f7('0x1c')](_0x3b463b)){if(this[_0x24f7('0x7')][_0x3b463b[_0x24f7('0x1f')]]){for(var _0x36058b in this[_0x24f7('0x7')][_0x3b463b[_0x24f7('0x1f')]]){if(this[_0x24f7('0x7')][_0x3b463b[_0x24f7('0x1f')]][_0x24f7('0x47')](_0x36058b)&&!this[_0x24f7('0x7')][_0x3b463b[_0x24f7('0x1f')]][_0x36058b][_0x24f7('0x3a')]&&!this['channels'][_0x3b463b[_0x24f7('0x1f')]][_0x36058b][_0x24f7('0x3b')]){this[_0x24f7('0x7')][_0x3b463b[_0x24f7('0x1f')]][_0x36058b][_0x24f7('0x3a')]=!![];this['channels'][_0x3b463b['uniqueid']][_0x36058b][_0x24f7('0x41')]=moment()[_0x24f7('0x21')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x24f7('0x7')][_0x3b463b['uniqueid']][_0x36058b][_0x24f7('0x42')]='abandoned';this['channels'][_0x3b463b[_0x24f7('0x1f')]][_0x36058b][_0x24f7('0x31')]='abandoned';ami['emit'](_0x24f7('0x48'),this[_0x24f7('0x7')][_0x3b463b[_0x24f7('0x1f')]][_0x36058b]);}}}}}catch(_0x35d296){logger[_0x24f7('0x2e')]('[syncQueueCallerAbandon][VoiceAgentReport]',util[_0x24f7('0x2f')](_0x35d296,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x24f7('0x1b')][_0x24f7('0x49')]=function(_0x3a25fe){try{if(this['isNotNull'](_0x3a25fe)){if(this[_0x24f7('0x7')][_0x3a25fe['uniqueid']]){for(var _0x145476 in this[_0x24f7('0x7')][_0x3a25fe['uniqueid']]){if(this['channels'][_0x3a25fe['uniqueid']][_0x24f7('0x47')](_0x145476)){if(this[_0x24f7('0x7')][_0x3a25fe['uniqueid']][_0x145476][_0x24f7('0x30')]&&!this['channels'][_0x3a25fe[_0x24f7('0x1f')]][_0x145476][_0x24f7('0x3b')]){this[_0x24f7('0x7')][_0x3a25fe[_0x24f7('0x1f')]][_0x145476][_0x24f7('0x3b')]=!![];this[_0x24f7('0x7')][_0x3a25fe[_0x24f7('0x1f')]][_0x145476]['agentcompleteAt']=moment()[_0x24f7('0x21')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x24f7('0x7')][_0x3a25fe[_0x24f7('0x1f')]][_0x145476][_0x24f7('0x31')]=_0x24f7('0x4a');this[_0x24f7('0x7')][_0x3a25fe[_0x24f7('0x1f')]][_0x145476][_0x24f7('0x4b')]=_0x3a25fe[_0x24f7('0x4b')];this[_0x24f7('0x7')][_0x3a25fe[_0x24f7('0x1f')]][_0x145476][_0x24f7('0x42')]=_0x3a25fe[_0x24f7('0x42')]==_0x24f7('0x4c')?'agent':_0x3a25fe[_0x24f7('0x42')];if(this[_0x24f7('0x8')][_0x3a25fe[_0x24f7('0x24')]]&&this['voiceQueues'][_0x3a25fe['queue']][_0x24f7('0x4d')]){this['channels'][_0x3a25fe[_0x24f7('0x1f')]][_0x145476][_0x24f7('0x4e')]=!![];this[_0x24f7('0x7')][_0x3a25fe['uniqueid']][_0x145476]['acwtime']=this[_0x24f7('0x8')][_0x3a25fe[_0x24f7('0x24')]][_0x24f7('0x4f')];}this[_0x24f7('0x9')][_0x3a25fe[_0x24f7('0x37')]]=_[_0x24f7('0x28')](this[_0x24f7('0x9')][_0x3a25fe[_0x24f7('0x37')]],[_0x24f7('0x24'),'destconnectedlinenum']);this[_0x24f7('0x1a')](util[_0x24f7('0x21')](_0x24f7('0x38'),_0x3a25fe[_0x24f7('0x2c')]),'user:agentcomplete',this[_0x24f7('0x7')][_0x3a25fe[_0x24f7('0x1f')]][_0x145476]);ami[_0x24f7('0x1a')]('custom:agentcomplete',this[_0x24f7('0x7')][_0x3a25fe['uniqueid']][_0x145476]);}}}}}}catch(_0x4c78a5){logger['error'](_0x24f7('0x50'),util[_0x24f7('0x2f')](_0x4c78a5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x24f7('0x1b')][_0x24f7('0x51')]=function(_0x31205d){try{if(this[_0x24f7('0x1c')](_0x31205d)){this[_0x24f7('0x52')](_0x31205d[_0x24f7('0x1f')],_[_0x24f7('0x53')](_0x31205d[_0x24f7('0x54')])[0x0],_0x31205d[_0x24f7('0x55')]);if(this[_0x24f7('0x7')][_0x31205d[_0x24f7('0x1f')]]){for(var _0x3992b7 in this['channels'][_0x31205d[_0x24f7('0x1f')]]){if(this[_0x24f7('0x7')][_0x31205d[_0x24f7('0x1f')]][_0x24f7('0x47')](_0x3992b7)){if(_['isUndefined'](this[_0x24f7('0x7')][_0x31205d[_0x24f7('0x1f')]][_0x3992b7][_0x24f7('0xa')])){this['channels'][_0x31205d[_0x24f7('0x1f')]][_0x3992b7][_0x24f7('0xa')]={};}this[_0x24f7('0x7')][_0x31205d[_0x24f7('0x1f')]][_0x3992b7][_0x24f7('0xa')]=this[_0x24f7('0xa')][_0x31205d[_0x24f7('0x1f')]];}}}}}catch(_0xb69df8){logger[_0x24f7('0x2e')](_0x24f7('0x56'),util[_0x24f7('0x2f')](_0xb69df8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x24f7('0x1b')][_0x24f7('0x52')]=function(_0x395ea3,_0x1c6a71,_0x36b948){var _0x4a54dc=[_0x24f7('0x57'),_0x24f7('0x58'),_0x24f7('0x59'),_0x24f7('0x5a'),_0x24f7('0x5b'),_0x24f7('0x5c'),_0x24f7('0x5d'),_0x24f7('0x5e'),_0x24f7('0x5f'),_0x24f7('0x60'),_0x24f7('0x61'),_0x24f7('0x62'),_0x24f7('0x63'),_0x24f7('0x64'),_0x24f7('0x65'),_0x24f7('0x66'),_0x24f7('0x2c'),_0x24f7('0x67'),_0x24f7('0x68')];if(!_[_0x24f7('0x69')](_0x1c6a71)&&!_[_0x24f7('0x6a')](_0x4a54dc,_0x1c6a71)){if(_[_0x24f7('0x1d')](this['variables'][_0x395ea3])){this[_0x24f7('0xa')][_0x395ea3]={};}this[_0x24f7('0xa')][_0x395ea3][_0x1c6a71]=_0x36b948;}};VoiceAgentReport[_0x24f7('0x1b')]['syncHangup']=function(_0x58f05a){try{if(this['isNotNull'](_0x58f05a)){if(this[_0x24f7('0x7')][_0x58f05a[_0x24f7('0x1f')]]){for(var _0x5600da in this[_0x24f7('0x7')][_0x58f05a[_0x24f7('0x1f')]]){if(this[_0x24f7('0x7')][_0x58f05a[_0x24f7('0x1f')]][_0x24f7('0x47')](_0x5600da)){if(this[_0x24f7('0x7')][_0x58f05a[_0x24f7('0x1f')]][_0x5600da][_0x24f7('0x42')]==_0x24f7('0x4c')&&this[_0x24f7('0x7')][_0x58f05a[_0x24f7('0x1f')]][_0x5600da][_0x24f7('0x3b')]){this[_0x24f7('0x7')][_0x58f05a[_0x24f7('0x1f')]][_0x5600da][_0x24f7('0x6b')]=moment()[_0x24f7('0x21')](_0x24f7('0x22'));}}}ami[_0x24f7('0x1a')](_0x24f7('0x6c'),_[_0x24f7('0x6d')](this[_0x24f7('0x7')][_0x58f05a[_0x24f7('0x1f')]]));delete this[_0x24f7('0x7')][_0x58f05a[_0x24f7('0x1f')]];}if(this[_0x24f7('0xa')][_0x58f05a[_0x24f7('0x1f')]]){delete this[_0x24f7('0xa')][_0x58f05a[_0x24f7('0x1f')]];}}}catch(_0x6d1b7a){logger[_0x24f7('0x2e')](_0x24f7('0x6e'),util[_0x24f7('0x2f')](_0x6d1b7a,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x24f7('0x17')]=function(_0x368cb2){try{if(this[_0x24f7('0x1c')](_0x368cb2)){if(this[_0x24f7('0x7')][_0x368cb2['transfereeuniqueid']]){for(var _0x1ddc08 in this[_0x24f7('0x7')][_0x368cb2[_0x24f7('0x6f')]]){if(this[_0x24f7('0x7')][_0x368cb2['transfereeuniqueid']][_0x24f7('0x47')](_0x1ddc08)){if(_0x368cb2['origtransfereruniqueid']===_0x1ddc08){var _0x540285=moment();this[_0x24f7('0x7')][_0x368cb2['transfereeuniqueid']][_0x1ddc08][_0x24f7('0x3b')]=!![];this[_0x24f7('0x7')][_0x368cb2[_0x24f7('0x6f')]][_0x1ddc08][_0x24f7('0x6b')]=moment()['format'](_0x24f7('0x22'));this[_0x24f7('0x7')][_0x368cb2[_0x24f7('0x6f')]][_0x1ddc08][_0x24f7('0x42')]=_0x24f7('0x4c');this['channels'][_0x368cb2['transfereeuniqueid']][_0x1ddc08][_0x24f7('0x31')]='complete';this[_0x24f7('0x7')][_0x368cb2[_0x24f7('0x6f')]][_0x1ddc08][_0x24f7('0x4b')]=_0x540285['diff'](this[_0x24f7('0x7')][_0x368cb2[_0x24f7('0x6f')]][_0x1ddc08]['agentconnectAt'],'seconds');}}}}if(this[_0x24f7('0x7')][_0x368cb2['secondtransfereruniqueid']]){var _0x55d269=this[_0x24f7('0x7')][_0x368cb2['secondtransfereruniqueid']];this[_0x24f7('0x7')][_0x368cb2[_0x24f7('0x70')]]=this[_0x24f7('0x7')][_0x368cb2[_0x24f7('0x6f')]];this[_0x24f7('0x7')][_0x368cb2[_0x24f7('0x6f')]]=_0x55d269;}}}catch(_0x30e95a){logger[_0x24f7('0x2e')](_0x24f7('0x71'),util[_0x24f7('0x2f')](_0x30e95a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x24f7('0x1b')]['syncBlindTransfer']=function(_0x35a3a4){try{if(this[_0x24f7('0x1c')](_0x35a3a4)){if(this[_0x24f7('0x7')][_0x35a3a4[_0x24f7('0x6f')]]){for(var _0x4b450b in this[_0x24f7('0x7')][_0x35a3a4['transfereeuniqueid']]){if(this['channels'][_0x35a3a4[_0x24f7('0x6f')]][_0x24f7('0x47')](_0x4b450b)){if(_0x35a3a4[_0x24f7('0x72')]===_0x4b450b){var _0x23d46b=moment();this[_0x24f7('0x7')][_0x35a3a4['transfereeuniqueid']][_0x4b450b][_0x24f7('0x3b')]=!![];this['channels'][_0x35a3a4[_0x24f7('0x6f')]][_0x4b450b][_0x24f7('0x6b')]=_0x23d46b;this[_0x24f7('0x7')][_0x35a3a4[_0x24f7('0x6f')]][_0x4b450b]['reason']=_0x24f7('0x4c');this['channels'][_0x35a3a4[_0x24f7('0x6f')]][_0x4b450b][_0x24f7('0x31')]=_0x24f7('0x4a');this[_0x24f7('0x7')][_0x35a3a4['transfereeuniqueid']][_0x4b450b][_0x24f7('0x4b')]=_0x23d46b[_0x24f7('0x73')](this['channels'][_0x35a3a4['transfereeuniqueid']][_0x4b450b][_0x24f7('0x30')],_0x24f7('0x74'));}}}}}}catch(_0x2689d){logger['error'](_0x24f7('0x75'),util[_0x24f7('0x2f')](_0x2689d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStart']=function(_0x442b89){var _0x4aa49c='';try{if(this[_0x24f7('0x1c')](_0x442b89)){if(_0x442b89[_0x24f7('0x76')]){_0x4aa49c=_0x442b89[_0x24f7('0x76')][_0x24f7('0x77')](0x0,_0x442b89['channel'][_0x24f7('0x78')]('-'));if(this[_0x24f7('0x9')][_0x4aa49c]){this['agents'][_0x4aa49c][_0x24f7('0x79')]=!![];}}}}catch(_0x134e17){logger[_0x24f7('0x2e')](_0x24f7('0x7a'),util[_0x24f7('0x2f')](_0x134e17,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x24f7('0x1b')][_0x24f7('0x15')]=function(_0x1f0430){var _0x460b45='';try{if(this[_0x24f7('0x1c')](_0x1f0430)){if(_0x1f0430[_0x24f7('0x76')]){_0x460b45=_0x1f0430[_0x24f7('0x76')][_0x24f7('0x77')](0x0,_0x1f0430[_0x24f7('0x76')][_0x24f7('0x78')]('-'));if(this[_0x24f7('0x9')][_0x460b45]){this[_0x24f7('0x9')][_0x460b45][_0x24f7('0x79')]=![];}}}}catch(_0x388bf5){logger['error']('[syncMusicOnHoldStop][VoiceAgentReport]',util[_0x24f7('0x2f')](_0x388bf5,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index ebdba55..22d50c2 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 _0xfd61=['lastapplication','lastdata','applicationdata','startsWith','cdr(','queue','[syncNewExten][VoiceCallReport]','answered','answertime','holdtime','diff','connectedlinenum','calleridnum','connectedlinename','calleridname','membername','UserId','[syncNewState][VoiceCallReport]','monitor','endsWith','.wav49','.WAV','monitorFilename','find','monitors','push','variable','mixmonitor_filename','xmd-phone','callerid','value','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','parse','syncMixMonitorFilename','[syncVarSet][VoiceCallReport]','endtime','billableseconds','from-sip','user:agentcomplete','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','syncHangup','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','isNil','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','exports','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','../ami','../model/channel','unknown','not_inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','set','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','varset','syncVarSet','hangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','then','catch','log','prototype','isNotNull','isUndefined','emit','uniqueid','linkedid','merge','pick','keys','error','[syncNewCallerId][VoiceCallReport]','inspect','channel','OutgoingSpoolFailed','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','context','destconnectedlinenum','exten','user:%s','split','name','user:agentconnect','accountcode','[syncNewChannel][VoiceCallReport]','application','toLowerCase','duration','subtract','seconds'];(function(_0x40739b,_0x9bfd6b){var _0x59958b=function(_0x5269d8){while(--_0x5269d8){_0x40739b['push'](_0x40739b['shift']());}};_0x59958b(++_0x9bfd6b);}(_0xfd61,0x176));var _0x1fd6=function(_0x1cf8d1,_0xe6cd99){_0x1cf8d1=_0x1cf8d1-0x0;var _0x227863=_0xfd61[_0x1cf8d1];return _0x227863;};'use strict';var BPromise=require(_0x1fd6('0x0'));var _=require(_0x1fd6('0x1'));var moment=require(_0x1fd6('0x2'));var util=require(_0x1fd6('0x3'));var path=require(_0x1fd6('0x4'));var Redis=require(_0x1fd6('0x5'));var config=require(_0x1fd6('0x6'));var logger=require(_0x1fd6('0x7'))('ami');var ami=require(_0x1fd6('0x8'));var Channel=require(_0x1fd6('0x9'));var statusDesc=[_0x1fd6('0xa'),_0x1fd6('0xb'),'inuse',_0x1fd6('0xc'),_0x1fd6('0xd'),_0x1fd6('0xe'),_0x1fd6('0xf'),_0x1fd6('0x10'),_0x1fd6('0x11')];var applications=[_0x1fd6('0x12'),'queue','agi','dial','playback',_0x1fd6('0x13')];var dispositions=[_0x1fd6('0x14'),_0x1fd6('0x15'),'FAILED','NO\x20ANSWER','NO\x20ANSWER',_0x1fd6('0x14'),_0x1fd6('0x16'),_0x1fd6('0x17'),_0x1fd6('0x15'),_0x1fd6('0x15'),_0x1fd6('0x15')];var actions={};config[_0x1fd6('0x18')]=_['defaults'](config[_0x1fd6('0x18')],{'host':'localhost','port':0x18eb});var io=require(_0x1fd6('0x19'))(new Redis(config[_0x1fd6('0x18')]));function VoiceCallReport(_0x35b7c2){this[_0x1fd6('0x1a')]=_0x35b7c2[_0x1fd6('0x1a')];this[_0x1fd6('0x1b')]=_0x35b7c2[_0x1fd6('0x1b')];ami['on'](_0x1fd6('0x1c'),this[_0x1fd6('0x1d')][_0x1fd6('0x1e')](this));ami['on'](_0x1fd6('0x1f'),this[_0x1fd6('0x1d')][_0x1fd6('0x1e')](this));ami['on'](_0x1fd6('0x20'),this[_0x1fd6('0x21')][_0x1fd6('0x1e')](this));ami['on']('newstate',this['syncNewState'][_0x1fd6('0x1e')](this));ami['on'](_0x1fd6('0x22'),this[_0x1fd6('0x23')][_0x1fd6('0x1e')](this));ami['on'](_0x1fd6('0x24'),this['syncHangup'][_0x1fd6('0x1e')](this));ami['on'](_0x1fd6('0x25'),this[_0x1fd6('0x26')][_0x1fd6('0x1e')](this));ami['on'](_0x1fd6('0x27'),this[_0x1fd6('0x28')]['bind'](this));ami['on'](_0x1fd6('0x29'),this[_0x1fd6('0x2a')][_0x1fd6('0x1e')](this));ami['on'](_0x1fd6('0x2b'),this[_0x1fd6('0x2c')][_0x1fd6('0x1e')](this));ami['on'](_0x1fd6('0x2d'),this[_0x1fd6('0x2e')][_0x1fd6('0x1e')](this));return BPromise[_0x1fd6('0x2f')]()[_0x1fd6('0x30')](ami['actionCoreShowChannels']())[_0x1fd6('0x31')](function(_0x315f66){console[_0x1fd6('0x32')](_0x315f66);});}VoiceCallReport[_0x1fd6('0x33')][_0x1fd6('0x34')]=function(_0x6626e5){return _0x6626e5!==null&&!_[_0x1fd6('0x35')](_0x6626e5);};VoiceCallReport[_0x1fd6('0x33')]['emit']=function(_0x4b1586,_0x31ffb8,_0x868bb4){io['to'](_0x4b1586)[_0x1fd6('0x36')](_0x31ffb8,_0x868bb4);};VoiceCallReport[_0x1fd6('0x33')][_0x1fd6('0x26')]=function(_0x19cdb8){try{if(this[_0x1fd6('0x34')](_0x19cdb8)){if(_0x19cdb8[_0x1fd6('0x37')]===_0x19cdb8[_0x1fd6('0x38')]){if(!_[_0x1fd6('0x35')](this[_0x1fd6('0x1a')][_0x19cdb8['uniqueid']])){_[_0x1fd6('0x39')](this[_0x1fd6('0x1a')][_0x19cdb8[_0x1fd6('0x37')]],_[_0x1fd6('0x3a')](_0x19cdb8,_[_0x1fd6('0x3b')](this[_0x1fd6('0x1a')][_0x19cdb8[_0x1fd6('0x37')]])));}}}}catch(_0x3ee586){logger[_0x1fd6('0x3c')](_0x1fd6('0x3d'),util[_0x1fd6('0x3e')](_0x3ee586,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1fd6('0x33')][_0x1fd6('0x21')]=function(_0x186eb7){try{if(this[_0x1fd6('0x34')](_0x186eb7)){if(_0x186eb7['uniqueid']===_0x186eb7[_0x1fd6('0x38')]&&_0x186eb7[_0x1fd6('0x3f')]!=_0x1fd6('0x40')){if(_[_0x1fd6('0x35')](this['channels'][_0x186eb7['uniqueid']])){this[_0x1fd6('0x1a')][_0x186eb7[_0x1fd6('0x37')]]=new Channel();this[_0x1fd6('0x1a')][_0x186eb7[_0x1fd6('0x37')]][_0x1fd6('0x41')]=moment()[_0x1fd6('0x42')](_0x1fd6('0x43'));this['channels'][_0x186eb7['uniqueid']][_0x1fd6('0x44')]=dispositions[_[_0x1fd6('0x45')](_0x186eb7[_0x1fd6('0x46')])];_[_0x1fd6('0x39')](this[_0x1fd6('0x1a')][_0x186eb7[_0x1fd6('0x37')]],_[_0x1fd6('0x3a')](_0x186eb7,_[_0x1fd6('0x3b')](this[_0x1fd6('0x1a')][_0x186eb7['uniqueid']])));if(_0x186eb7[_0x1fd6('0x47')]==='from-sip'){if(this[_0x1fd6('0x1b')][_0x186eb7[_0x1fd6('0x3f')]['split']('-')[0x0]]){this[_0x1fd6('0x1b')][_0x186eb7[_0x1fd6('0x3f')]['split']('-')[0x0]][_0x1fd6('0x48')]=_0x186eb7[_0x1fd6('0x49')];this[_0x1fd6('0x36')](util[_0x1fd6('0x42')](_0x1fd6('0x4a'),this[_0x1fd6('0x1b')][_0x186eb7[_0x1fd6('0x3f')][_0x1fd6('0x4b')]('-')[0x0]][_0x1fd6('0x4c')]),_0x1fd6('0x4d'),{'destaccountcode':this['agents'][_0x186eb7[_0x1fd6('0x3f')][_0x1fd6('0x4b')]('-')[0x0]][_0x1fd6('0x4e')],'destconnectedlinenum':_0x186eb7['exten']});}}}}}}catch(_0x368079){logger['error'](_0x1fd6('0x4f'),util[_0x1fd6('0x3e')](_0x368079,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x1fd6('0x1d')]=function(_0x44fbc0){try{if(this[_0x1fd6('0x34')](_0x44fbc0)){if(_0x44fbc0['uniqueid']===_0x44fbc0['linkedid']&&_0x44fbc0[_0x1fd6('0x49')]!='h'&&_0x44fbc0[_0x1fd6('0x3f')]!='OutgoingSpoolFailed'){_0x44fbc0[_0x1fd6('0x50')]=_0x44fbc0[_0x1fd6('0x50')]['toLowerCase']();_0x44fbc0['applicationdata']=(_0x44fbc0['appdata']||_0x44fbc0['applicationdata'])[_0x1fd6('0x51')]();if(_[_0x1fd6('0x35')](this[_0x1fd6('0x1a')][_0x44fbc0['uniqueid']])){this[_0x1fd6('0x1a')][_0x44fbc0[_0x1fd6('0x37')]]=new Channel();this[_0x1fd6('0x1a')][_0x44fbc0['uniqueid']][_0x1fd6('0x41')]=_0x44fbc0[_0x1fd6('0x52')]?moment()[_0x1fd6('0x53')](moment[_0x1fd6('0x52')](_0x44fbc0[_0x1fd6('0x52')])[_0x1fd6('0x54')](),_0x1fd6('0x54'))[_0x1fd6('0x42')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x1fd6('0x42')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1fd6('0x1a')][_0x44fbc0[_0x1fd6('0x37')]][_0x1fd6('0x44')]=_0x1fd6('0x14');}_[_0x1fd6('0x39')](this['channels'][_0x44fbc0[_0x1fd6('0x37')]],_['pick'](_0x44fbc0,_[_0x1fd6('0x3b')](this['channels'][_0x44fbc0[_0x1fd6('0x37')]])));if(_['includes'](applications,_0x44fbc0[_0x1fd6('0x50')])){this[_0x1fd6('0x1a')][_0x44fbc0[_0x1fd6('0x37')]][_0x1fd6('0x55')]=_0x44fbc0[_0x1fd6('0x50')];this['channels'][_0x44fbc0[_0x1fd6('0x37')]][_0x1fd6('0x56')]=_0x44fbc0[_0x1fd6('0x57')];if(_0x44fbc0[_0x1fd6('0x50')]===_0x1fd6('0x12')&&_[_0x1fd6('0x58')](_0x44fbc0[_0x1fd6('0x57')],_0x1fd6('0x59'))){var _0x5301bc=_0x44fbc0[_0x1fd6('0x57')][_0x1fd6('0x4b')]('=');var _0x3ab610=_0x5301bc[0x0]['match'](/cdr\((.*)\)/);if(_0x3ab610){this[_0x1fd6('0x1a')][_0x44fbc0[_0x1fd6('0x37')]][_0x3ab610[0x1]]=_0x5301bc[0x1];}}else if(_0x44fbc0['application']===_0x1fd6('0x5a')){this['channels'][_0x44fbc0[_0x1fd6('0x37')]][_0x1fd6('0x5a')]=_0x44fbc0[_0x1fd6('0x57')][_0x1fd6('0x4b')](',')[0x0];}}}}}catch(_0x42822e){logger[_0x1fd6('0x3c')](_0x1fd6('0x5b'),util['inspect'](_0x42822e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1fd6('0x33')]['syncNewState']=function(_0xbffd20){try{if(this[_0x1fd6('0x34')](_0xbffd20)){if(_0xbffd20[_0x1fd6('0x37')]!==_0xbffd20[_0x1fd6('0x38')]){if(this['channels'][_0xbffd20[_0x1fd6('0x38')]]){if(_0xbffd20[_0x1fd6('0x46')]==='6'){if(!this[_0x1fd6('0x1a')][_0xbffd20['linkedid']][_0x1fd6('0x5c')]){var _0x543c7d=moment();this[_0x1fd6('0x1a')][_0xbffd20[_0x1fd6('0x38')]]['answered']=!![];this[_0x1fd6('0x1a')][_0xbffd20[_0x1fd6('0x38')]][_0x1fd6('0x5d')]=_0x543c7d[_0x1fd6('0x42')](_0x1fd6('0x43'));if(this[_0x1fd6('0x1a')][_0xbffd20[_0x1fd6('0x38')]]['starttime']){this['channels'][_0xbffd20['linkedid']][_0x1fd6('0x5e')]=_0x543c7d[_0x1fd6('0x5f')](this['channels'][_0xbffd20[_0x1fd6('0x38')]][_0x1fd6('0x41')],_0x1fd6('0x54'));}}this['channels'][_0xbffd20['linkedid']]['linkedid']=_0xbffd20['uniqueid'];if(_0xbffd20['calleridnum']!=='xcally-motion-preview'){this[_0x1fd6('0x1a')][_0xbffd20[_0x1fd6('0x38')]][_0x1fd6('0x60')]=_0xbffd20[_0x1fd6('0x61')];}this[_0x1fd6('0x1a')][_0xbffd20['linkedid']][_0x1fd6('0x62')]=_0xbffd20[_0x1fd6('0x63')];this['channels'][_0xbffd20[_0x1fd6('0x38')]]['destinationchannel']=_0xbffd20['channel'];this['channels'][_0xbffd20[_0x1fd6('0x38')]][_0x1fd6('0x44')]=dispositions[_[_0x1fd6('0x45')](_0xbffd20[_0x1fd6('0x46')])];if(this[_0x1fd6('0x1b')][_0xbffd20['channel']['split']('-')[0x0]]){this[_0x1fd6('0x1a')][_0xbffd20[_0x1fd6('0x38')]]['UserId']=this[_0x1fd6('0x1b')][_0xbffd20[_0x1fd6('0x3f')][_0x1fd6('0x4b')]('-')[0x0]]['id'];this['channels'][_0xbffd20[_0x1fd6('0x38')]][_0x1fd6('0x64')]=this[_0x1fd6('0x1b')][_0xbffd20[_0x1fd6('0x3f')][_0x1fd6('0x4b')]('-')[0x0]][_0x1fd6('0x4c')];}}}}else{if(this[_0x1fd6('0x1a')][_0xbffd20['uniqueid']]){if(_0xbffd20['channelstate']==='6'){if(this[_0x1fd6('0x1b')][_0xbffd20[_0x1fd6('0x3f')][_0x1fd6('0x4b')]('-')[0x0]]){this['channels'][_0xbffd20[_0x1fd6('0x37')]][_0x1fd6('0x65')]=this[_0x1fd6('0x1b')][_0xbffd20[_0x1fd6('0x3f')][_0x1fd6('0x4b')]('-')[0x0]]['id'];this[_0x1fd6('0x1a')][_0xbffd20[_0x1fd6('0x37')]][_0x1fd6('0x64')]=this[_0x1fd6('0x1b')][_0xbffd20[_0x1fd6('0x3f')][_0x1fd6('0x4b')]('-')[0x0]]['name'];}}}}}}catch(_0x85d07b){logger['error'](_0x1fd6('0x66'),util['inspect'](_0x85d07b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1fd6('0x33')]['syncMixMonitorFilename']=function(_0x3b275b,_0x117d41){if(this['channels'][_0x3b275b]){this[_0x1fd6('0x1a')][_0x3b275b][_0x1fd6('0x67')]=!![];if(_[_0x1fd6('0x68')](_0x117d41,_0x1fd6('0x69'))){_0x117d41=_0x117d41['replace'](_0x1fd6('0x69'),_0x1fd6('0x6a'));}this[_0x1fd6('0x1a')][_0x3b275b][_0x1fd6('0x6b')]=_0x117d41;var _0x53f646=_[_0x1fd6('0x6c')](this[_0x1fd6('0x1a')][_0x3b275b][_0x1fd6('0x6d')],{'filename':_0x117d41});if(_['isNil'](_0x53f646)){this['channels'][_0x3b275b][_0x1fd6('0x6d')][_0x1fd6('0x6e')]({'filename':_0x117d41,'createdAt':moment()['format'](_0x1fd6('0x43')),'mixmonitorid':'','status':'rec'});}}};VoiceCallReport[_0x1fd6('0x33')][_0x1fd6('0x23')]=function(_0x1ee9de){try{if(this[_0x1fd6('0x34')](_0x1ee9de)){if(this['channels'][_0x1ee9de[_0x1fd6('0x37')]]&&_0x1ee9de[_0x1fd6('0x3f')]!='OutgoingSpoolFailed'){if(this[_0x1fd6('0x34')](_0x1ee9de[_0x1fd6('0x6f')])){if(this['isNotNull'](_0x1ee9de[_0x1fd6('0x6f')][_0x1fd6('0x70')])){this['syncMixMonitorFilename'](_0x1ee9de[_0x1fd6('0x37')],_0x1ee9de['value']);}else if(this['isNotNull'](_0x1ee9de[_0x1fd6('0x6f')][_0x1fd6('0x71')])){this['channels'][_0x1ee9de[_0x1fd6('0x37')]][_0x1fd6('0x61')]=_0x1ee9de['value'];}else if(this['isNotNull'](_0x1ee9de['variable']['xmd-callerid'])){this[_0x1fd6('0x1a')][_0x1ee9de[_0x1fd6('0x37')]][_0x1fd6('0x72')]=_0x1ee9de[_0x1fd6('0x73')];}else if(this[_0x1fd6('0x34')](_0x1ee9de[_0x1fd6('0x6f')][_0x1fd6('0x74')])){this[_0x1fd6('0x1a')][_0x1ee9de[_0x1fd6('0x37')]][_0x1fd6('0x75')]=_0x1ee9de['value'];}else if(this[_0x1fd6('0x34')](_0x1ee9de[_0x1fd6('0x6f')][_0x1fd6('0x76')])){this[_0x1fd6('0x1a')][_0x1ee9de['uniqueid']][_0x1fd6('0x5a')]=_0x1ee9de['value'][_0x1fd6('0x4b')](',')[0x0];}else if(this['isNotNull'](_0x1ee9de[_0x1fd6('0x6f')][_0x1fd6('0x77')])){this['channels'][_0x1ee9de[_0x1fd6('0x37')]][_0x1fd6('0x78')]=_0x1ee9de[_0x1fd6('0x73')];}else if(this[_0x1fd6('0x34')](_0x1ee9de[_0x1fd6('0x6f')][_0x1fd6('0x79')])){this[_0x1fd6('0x1a')][_0x1ee9de[_0x1fd6('0x37')]][_0x1fd6('0x7a')]=_0x1ee9de[_0x1fd6('0x73')];}else if(this[_0x1fd6('0x34')](_0x1ee9de['variable']['xmd-callerid-preview'])){this[_0x1fd6('0x1a')][_0x1ee9de[_0x1fd6('0x37')]][_0x1fd6('0x7b')]=_0x1ee9de[_0x1fd6('0x73')];}else if(this[_0x1fd6('0x34')](_0x1ee9de['variable'][_0x1fd6('0x7c')])){this[_0x1fd6('0x1a')][_0x1ee9de[_0x1fd6('0x37')]]['queue']=_0x1ee9de[_0x1fd6('0x73')];}else if(this[_0x1fd6('0x34')](_0x1ee9de[_0x1fd6('0x6f')][_0x1fd6('0x7d')])){this['channels'][_0x1ee9de['uniqueid']][_0x1fd6('0x7e')]=_0x1ee9de[_0x1fd6('0x73')];}}}else if(this['isNotNull'](_0x1ee9de['variable'][_0x1fd6('0x70')])){if(_0x1ee9de['value']){var _0x3593c4=path[_0x1fd6('0x7f')](_0x1ee9de['value'])[_0x1fd6('0x4c')];this[_0x1fd6('0x80')](_0x3593c4,_0x1ee9de['value']);}}else if(this[_0x1fd6('0x1a')][_0x1ee9de[_0x1fd6('0x38')]]){if(this[_0x1fd6('0x34')](_0x1ee9de[_0x1fd6('0x6f')])){if(this['isNotNull'](_0x1ee9de['variable'][_0x1fd6('0x7d')])){this[_0x1fd6('0x1a')][_0x1ee9de[_0x1fd6('0x38')]]['sipcalllinkedid']=_0x1ee9de[_0x1fd6('0x73')];}}}}}catch(_0x5a5f3f){logger[_0x1fd6('0x3c')](_0x1fd6('0x81'),util['inspect'](_0x5a5f3f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1fd6('0x33')]['syncHangup']=function(_0x37c955){try{if(this[_0x1fd6('0x34')](_0x37c955)){if(this[_0x1fd6('0x1a')][_0x37c955[_0x1fd6('0x37')]]){var _0x301e2c=moment();this[_0x1fd6('0x1a')][_0x37c955['uniqueid']][_0x1fd6('0x82')]=_0x301e2c[_0x1fd6('0x42')](_0x1fd6('0x43'));this[_0x1fd6('0x1a')][_0x37c955[_0x1fd6('0x37')]][_0x1fd6('0x52')]=_0x301e2c[_0x1fd6('0x5f')](this['channels'][_0x37c955[_0x1fd6('0x37')]][_0x1fd6('0x41')],'seconds');if(this[_0x1fd6('0x1a')][_0x37c955[_0x1fd6('0x37')]][_0x1fd6('0x5c')]){this[_0x1fd6('0x1a')][_0x37c955['uniqueid']][_0x1fd6('0x83')]=_0x301e2c[_0x1fd6('0x5f')](this[_0x1fd6('0x1a')][_0x37c955[_0x1fd6('0x37')]][_0x1fd6('0x5d')],_0x1fd6('0x54'));this['channels'][_0x37c955[_0x1fd6('0x37')]][_0x1fd6('0x5e')]=this[_0x1fd6('0x1a')][_0x37c955[_0x1fd6('0x37')]][_0x1fd6('0x52')]-this[_0x1fd6('0x1a')][_0x37c955[_0x1fd6('0x37')]]['billableseconds'];}if(_0x37c955['context']===_0x1fd6('0x84')){if(this[_0x1fd6('0x1b')][_0x37c955['channel'][_0x1fd6('0x4b')]('-')[0x0]]){this[_0x1fd6('0x1b')][_0x37c955[_0x1fd6('0x3f')]['split']('-')[0x0]]=_['omit'](this[_0x1fd6('0x1b')][_0x37c955['channel'][_0x1fd6('0x4b')]('-')[0x0]],[_0x1fd6('0x48')]);this[_0x1fd6('0x36')](util[_0x1fd6('0x42')](_0x1fd6('0x4a'),this[_0x1fd6('0x1b')][_0x37c955[_0x1fd6('0x3f')][_0x1fd6('0x4b')]('-')[0x0]][_0x1fd6('0x4c')]),_0x1fd6('0x85'),{'destaccountcode':this[_0x1fd6('0x1b')][_0x37c955['channel']['split']('-')[0x0]][_0x1fd6('0x4e')]});}}ami[_0x1fd6('0x36')]('custom:voiceCallReport',this['channels'][_0x37c955[_0x1fd6('0x37')]]);delete this[_0x1fd6('0x1a')][_0x37c955[_0x1fd6('0x37')]];}}}catch(_0x28c312){logger['error']('[syncHangup][VoiceCallReport]',util[_0x1fd6('0x3e')](_0x28c312,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1fd6('0x33')][_0x1fd6('0x28')]=function(_0x4dbf07){try{if(this[_0x1fd6('0x34')](_0x4dbf07)){if(this[_0x1fd6('0x1a')][_0x4dbf07['transfereeuniqueid']]){this['channels'][_0x4dbf07[_0x1fd6('0x86')]][_0x1fd6('0x87')]=_0x4dbf07[_0x1fd6('0x88')];this[_0x1fd6('0x1a')][_0x4dbf07[_0x1fd6('0x86')]]['transferconnectedlinenum']=_0x4dbf07[_0x1fd6('0x89')];if(this[_0x1fd6('0x1a')][_0x4dbf07[_0x1fd6('0x8a')]]){var _0x6c6e44=this[_0x1fd6('0x1a')][_0x4dbf07[_0x1fd6('0x8a')]];this[_0x1fd6('0x1a')][_0x4dbf07[_0x1fd6('0x8a')]]=this['channels'][_0x4dbf07[_0x1fd6('0x86')]];this[_0x1fd6('0x1a')][_0x4dbf07['transfereeuniqueid']]=_0x6c6e44;}}else if(this[_0x1fd6('0x1a')][_0x4dbf07[_0x1fd6('0x8b')]]){this[_0x1fd6('0x1a')][_0x4dbf07[_0x1fd6('0x8b')]][_0x1fd6('0x87')]=_0x4dbf07[_0x1fd6('0x88')];this[_0x1fd6('0x1a')][_0x4dbf07[_0x1fd6('0x8b')]][_0x1fd6('0x8c')]=_0x4dbf07[_0x1fd6('0x89')];if(this[_0x1fd6('0x1a')][_0x4dbf07[_0x1fd6('0x8d')]]){var _0x6c6e44=this['channels'][_0x4dbf07[_0x1fd6('0x8d')]];this[_0x1fd6('0x1a')][_0x4dbf07[_0x1fd6('0x8d')]]=this[_0x1fd6('0x1a')][_0x4dbf07[_0x1fd6('0x8b')]];this[_0x1fd6('0x1a')][_0x4dbf07[_0x1fd6('0x8b')]]=_0x6c6e44;}}}}catch(_0x31e54d){logger['error'](_0x1fd6('0x8e'),util[_0x1fd6('0x3e')](_0x31e54d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncBlindTransfer']=function(_0x1680ac){try{if(this[_0x1fd6('0x34')](_0x1680ac)){if(this[_0x1fd6('0x1a')][_0x1680ac[_0x1fd6('0x86')]]){this[_0x1fd6('0x1a')][_0x1680ac[_0x1fd6('0x86')]][_0x1fd6('0x87')]=_0x1680ac[_0x1fd6('0x8f')];this['channels'][_0x1680ac[_0x1fd6('0x86')]]['transferconnectedlinenum']=_0x1680ac[_0x1fd6('0x90')];this[_0x1fd6('0x91')]({'event':_0x1fd6('0x92'),'uniqueid':_0x1680ac[_0x1fd6('0x86')],'context':_0x1680ac[_0x1fd6('0x47')],'channel':_0x1680ac[_0x1fd6('0x93')]});}}}catch(_0x415e85){logger[_0x1fd6('0x3c')](_0x1fd6('0x94'),util[_0x1fd6('0x3e')](_0x415e85,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1fd6('0x33')][_0x1fd6('0x2c')]=function(_0x59dd7b){try{if(this[_0x1fd6('0x34')](_0x59dd7b)){if(this[_0x1fd6('0x1a')][_0x59dd7b[_0x1fd6('0x37')]]){if(!_[_0x1fd6('0x95')](this[_0x1fd6('0x1a')][_0x59dd7b[_0x1fd6('0x37')]]['answertime'])){this['channels'][_0x59dd7b['uniqueid']][_0x1fd6('0x96')]=moment()['format'](_0x1fd6('0x43'));}}}}catch(_0x2f03d7){logger[_0x1fd6('0x3c')](_0x1fd6('0x97'),util['inspect'](_0x2f03d7,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStop']=function(_0xc56d0b){try{if(this['isNotNull'](_0xc56d0b)){if(this['channels'][_0xc56d0b[_0x1fd6('0x37')]]){if(!_[_0x1fd6('0x95')](this['channels'][_0xc56d0b[_0x1fd6('0x37')]][_0x1fd6('0x96')])){this[_0x1fd6('0x1a')][_0xc56d0b['uniqueid']]['mohtime']+=moment()['milliseconds'](0x0)[_0x1fd6('0x5f')](this[_0x1fd6('0x1a')][_0xc56d0b[_0x1fd6('0x37')]]['mohstarttime'],_0x1fd6('0x54'));delete this[_0x1fd6('0x1a')][_0xc56d0b[_0x1fd6('0x37')]]['mohstarttime'];}}}}catch(_0x581def){logger['error']('[syncMusicOnHoldStop][VoiceCallReport]',util['inspect'](_0x581def,{'showHidden':![],'depth':null}));}};module[_0x1fd6('0x98')]=VoiceCallReport; \ No newline at end of file +var _0x4745=['pick','keys','context','channel','split','destconnectedlinenum','exten','user:%s','name','user:agentconnect','[syncNewChannel][VoiceCallReport]','application','toLowerCase','applicationdata','appdata','duration','subtract','seconds','lastapplication','lastdata','startsWith','cdr(','match','[syncNewExten][VoiceCallReport]','syncNewState','answered','answertime','holdtime','diff','calleridnum','connectedlinename','calleridname','destinationchannel','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','replace','.wav49','.WAV','find','monitors','push','syncVarSet','variable','mixmonitor_filename','value','callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','sipcallid','sipcalluniqueid','parse','[syncVarSet][VoiceCallReport]','endtime','billableseconds','from-sip','omit','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','syncBlindTransfer','transfereecalleridnum','extension','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','isNil','mohtime','[syncMusicOnHoldStop][VoiceCallReport]','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../model/channel','unknown','inuse','busy','unavailable','ringing','onhold','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','localhost','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','log','isNotNull','prototype','emit','uniqueid','linkedid','merge','error','[syncNewCallerId][VoiceCallReport]','inspect','OutgoingSpoolFailed','isUndefined','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate'];(function(_0x98ac1f,_0x2effb0){var _0x1579d1=function(_0x54b8d7){while(--_0x54b8d7){_0x98ac1f['push'](_0x98ac1f['shift']());}};_0x1579d1(++_0x2effb0);}(_0x4745,0xf3));var _0x5474=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x4745[_0x411add];return _0x238242;};'use strict';var BPromise=require(_0x5474('0x0'));var _=require(_0x5474('0x1'));var moment=require(_0x5474('0x2'));var util=require(_0x5474('0x3'));var path=require(_0x5474('0x4'));var Redis=require(_0x5474('0x5'));var config=require(_0x5474('0x6'));var logger=require(_0x5474('0x7'))(_0x5474('0x8'));var ami=require('../ami');var Channel=require(_0x5474('0x9'));var statusDesc=[_0x5474('0xa'),'not_inuse',_0x5474('0xb'),_0x5474('0xc'),'invalid',_0x5474('0xd'),_0x5474('0xe'),'ringinuse',_0x5474('0xf')];var applications=[_0x5474('0x10'),_0x5474('0x11'),_0x5474('0x12'),_0x5474('0x13'),_0x5474('0x14'),_0x5474('0x15')];var dispositions=[_0x5474('0x16'),_0x5474('0x17'),_0x5474('0x17'),'NO\x20ANSWER','NO\x20ANSWER',_0x5474('0x16'),_0x5474('0x18'),_0x5474('0x19'),_0x5474('0x17'),'FAILED','FAILED'];var actions={};config[_0x5474('0x1a')]=_['defaults'](config[_0x5474('0x1a')],{'host':_0x5474('0x1b'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5474('0x1a')]));function VoiceCallReport(_0x443f01){this['channels']=_0x443f01[_0x5474('0x1c')];this[_0x5474('0x1d')]=_0x443f01[_0x5474('0x1d')];ami['on'](_0x5474('0x1e'),this[_0x5474('0x1f')][_0x5474('0x20')](this));ami['on'](_0x5474('0x21'),this[_0x5474('0x1f')][_0x5474('0x20')](this));ami['on'](_0x5474('0x22'),this[_0x5474('0x23')]['bind'](this));ami['on'](_0x5474('0x24'),this['syncNewState']['bind'](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0x5474('0x25'),this[_0x5474('0x26')][_0x5474('0x20')](this));ami['on'](_0x5474('0x27'),this[_0x5474('0x28')]['bind'](this));ami['on'](_0x5474('0x29'),this[_0x5474('0x2a')][_0x5474('0x20')](this));ami['on'](_0x5474('0x2b'),this['syncBlindTransfer'][_0x5474('0x20')](this));ami['on'](_0x5474('0x2c'),this[_0x5474('0x2d')]['bind'](this));ami['on'](_0x5474('0x2e'),this[_0x5474('0x2f')][_0x5474('0x20')](this));return BPromise[_0x5474('0x30')]()[_0x5474('0x31')](ami[_0x5474('0x32')]())['catch'](function(_0x37dd50){console[_0x5474('0x33')](_0x37dd50);});}VoiceCallReport['prototype'][_0x5474('0x34')]=function(_0x202ea8){return _0x202ea8!==null&&!_['isUndefined'](_0x202ea8);};VoiceCallReport[_0x5474('0x35')][_0x5474('0x36')]=function(_0x2680aa,_0x15a200,_0x5f0936){io['to'](_0x2680aa)['emit'](_0x15a200,_0x5f0936);};VoiceCallReport[_0x5474('0x35')][_0x5474('0x28')]=function(_0x2881d6){try{if(this[_0x5474('0x34')](_0x2881d6)){if(_0x2881d6[_0x5474('0x37')]===_0x2881d6[_0x5474('0x38')]){if(!_['isUndefined'](this[_0x5474('0x1c')][_0x2881d6[_0x5474('0x37')]])){_[_0x5474('0x39')](this[_0x5474('0x1c')][_0x2881d6['uniqueid']],_['pick'](_0x2881d6,_['keys'](this[_0x5474('0x1c')][_0x2881d6[_0x5474('0x37')]])));}}}}catch(_0x2f75c6){logger[_0x5474('0x3a')](_0x5474('0x3b'),util[_0x5474('0x3c')](_0x2f75c6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5474('0x35')][_0x5474('0x23')]=function(_0x30e223){try{if(this[_0x5474('0x34')](_0x30e223)){if(_0x30e223[_0x5474('0x37')]===_0x30e223[_0x5474('0x38')]&&_0x30e223['channel']!=_0x5474('0x3d')){if(_[_0x5474('0x3e')](this['channels'][_0x30e223[_0x5474('0x37')]])){this['channels'][_0x30e223[_0x5474('0x37')]]=new Channel();this[_0x5474('0x1c')][_0x30e223[_0x5474('0x37')]][_0x5474('0x3f')]=moment()[_0x5474('0x40')](_0x5474('0x41'));this[_0x5474('0x1c')][_0x30e223['uniqueid']][_0x5474('0x42')]=dispositions[_[_0x5474('0x43')](_0x30e223[_0x5474('0x44')])];_[_0x5474('0x39')](this[_0x5474('0x1c')][_0x30e223[_0x5474('0x37')]],_[_0x5474('0x45')](_0x30e223,_[_0x5474('0x46')](this[_0x5474('0x1c')][_0x30e223[_0x5474('0x37')]])));if(_0x30e223[_0x5474('0x47')]==='from-sip'){if(this[_0x5474('0x1d')][_0x30e223[_0x5474('0x48')]['split']('-')[0x0]]){this[_0x5474('0x1d')][_0x30e223[_0x5474('0x48')][_0x5474('0x49')]('-')[0x0]][_0x5474('0x4a')]=_0x30e223[_0x5474('0x4b')];this[_0x5474('0x36')](util[_0x5474('0x40')](_0x5474('0x4c'),this[_0x5474('0x1d')][_0x30e223[_0x5474('0x48')][_0x5474('0x49')]('-')[0x0]][_0x5474('0x4d')]),_0x5474('0x4e'),{'destaccountcode':this[_0x5474('0x1d')][_0x30e223['channel'][_0x5474('0x49')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x30e223['exten']});}}}}}}catch(_0x261541){logger[_0x5474('0x3a')](_0x5474('0x4f'),util[_0x5474('0x3c')](_0x261541,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5474('0x35')][_0x5474('0x1f')]=function(_0x405661){try{if(this[_0x5474('0x34')](_0x405661)){if(_0x405661[_0x5474('0x37')]===_0x405661[_0x5474('0x38')]&&_0x405661[_0x5474('0x4b')]!='h'&&_0x405661[_0x5474('0x48')]!=_0x5474('0x3d')){_0x405661[_0x5474('0x50')]=_0x405661['application'][_0x5474('0x51')]();_0x405661[_0x5474('0x52')]=(_0x405661[_0x5474('0x53')]||_0x405661[_0x5474('0x52')])[_0x5474('0x51')]();if(_[_0x5474('0x3e')](this['channels'][_0x405661[_0x5474('0x37')]])){this[_0x5474('0x1c')][_0x405661['uniqueid']]=new Channel();this['channels'][_0x405661[_0x5474('0x37')]][_0x5474('0x3f')]=_0x405661[_0x5474('0x54')]?moment()[_0x5474('0x55')](moment[_0x5474('0x54')](_0x405661[_0x5474('0x54')])[_0x5474('0x56')](),_0x5474('0x56'))['format'](_0x5474('0x41')):moment()[_0x5474('0x40')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x5474('0x1c')][_0x405661[_0x5474('0x37')]][_0x5474('0x42')]=_0x5474('0x16');}_[_0x5474('0x39')](this[_0x5474('0x1c')][_0x405661[_0x5474('0x37')]],_[_0x5474('0x45')](_0x405661,_['keys'](this[_0x5474('0x1c')][_0x405661['uniqueid']])));if(_['includes'](applications,_0x405661[_0x5474('0x50')])){this[_0x5474('0x1c')][_0x405661[_0x5474('0x37')]][_0x5474('0x57')]=_0x405661['application'];this[_0x5474('0x1c')][_0x405661[_0x5474('0x37')]][_0x5474('0x58')]=_0x405661['applicationdata'];if(_0x405661['application']===_0x5474('0x10')&&_[_0x5474('0x59')](_0x405661[_0x5474('0x52')],_0x5474('0x5a'))){var _0x16f3bd=_0x405661[_0x5474('0x52')][_0x5474('0x49')]('=');var _0x1baeb6=_0x16f3bd[0x0][_0x5474('0x5b')](/cdr\((.*)\)/);if(_0x1baeb6){this['channels'][_0x405661[_0x5474('0x37')]][_0x1baeb6[0x1]]=_0x16f3bd[0x1];}}else if(_0x405661['application']==='queue'){this[_0x5474('0x1c')][_0x405661[_0x5474('0x37')]][_0x5474('0x11')]=_0x405661[_0x5474('0x52')][_0x5474('0x49')](',')[0x0];}}}}}catch(_0x20844b){logger[_0x5474('0x3a')](_0x5474('0x5c'),util[_0x5474('0x3c')](_0x20844b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5474('0x35')][_0x5474('0x5d')]=function(_0x47de07){try{if(this[_0x5474('0x34')](_0x47de07)){if(_0x47de07[_0x5474('0x37')]!==_0x47de07[_0x5474('0x38')]){if(this[_0x5474('0x1c')][_0x47de07['linkedid']]){if(_0x47de07[_0x5474('0x44')]==='6'){if(!this[_0x5474('0x1c')][_0x47de07[_0x5474('0x38')]]['answered']){var _0x1ca0db=moment();this[_0x5474('0x1c')][_0x47de07[_0x5474('0x38')]][_0x5474('0x5e')]=!![];this['channels'][_0x47de07[_0x5474('0x38')]][_0x5474('0x5f')]=_0x1ca0db['format'](_0x5474('0x41'));if(this[_0x5474('0x1c')][_0x47de07[_0x5474('0x38')]][_0x5474('0x3f')]){this['channels'][_0x47de07[_0x5474('0x38')]][_0x5474('0x60')]=_0x1ca0db[_0x5474('0x61')](this[_0x5474('0x1c')][_0x47de07[_0x5474('0x38')]][_0x5474('0x3f')],_0x5474('0x56'));}}this['channels'][_0x47de07[_0x5474('0x38')]][_0x5474('0x38')]=_0x47de07[_0x5474('0x37')];if(_0x47de07['calleridnum']!=='xcally-motion-preview'){this['channels'][_0x47de07[_0x5474('0x38')]]['connectedlinenum']=_0x47de07[_0x5474('0x62')];}this[_0x5474('0x1c')][_0x47de07[_0x5474('0x38')]][_0x5474('0x63')]=_0x47de07[_0x5474('0x64')];this[_0x5474('0x1c')][_0x47de07['linkedid']][_0x5474('0x65')]=_0x47de07['channel'];this['channels'][_0x47de07['linkedid']]['disposition']=dispositions[_[_0x5474('0x43')](_0x47de07[_0x5474('0x44')])];if(this[_0x5474('0x1d')][_0x47de07[_0x5474('0x48')][_0x5474('0x49')]('-')[0x0]]){this[_0x5474('0x1c')][_0x47de07['linkedid']][_0x5474('0x66')]=this['agents'][_0x47de07['channel'][_0x5474('0x49')]('-')[0x0]]['id'];this['channels'][_0x47de07[_0x5474('0x38')]]['membername']=this[_0x5474('0x1d')][_0x47de07[_0x5474('0x48')][_0x5474('0x49')]('-')[0x0]][_0x5474('0x4d')];}}}}else{if(this[_0x5474('0x1c')][_0x47de07[_0x5474('0x37')]]){if(_0x47de07[_0x5474('0x44')]==='6'){if(this[_0x5474('0x1d')][_0x47de07[_0x5474('0x48')][_0x5474('0x49')]('-')[0x0]]){this[_0x5474('0x1c')][_0x47de07[_0x5474('0x37')]]['UserId']=this[_0x5474('0x1d')][_0x47de07['channel'][_0x5474('0x49')]('-')[0x0]]['id'];this[_0x5474('0x1c')][_0x47de07['uniqueid']][_0x5474('0x67')]=this[_0x5474('0x1d')][_0x47de07[_0x5474('0x48')][_0x5474('0x49')]('-')[0x0]][_0x5474('0x4d')];}}}}}}catch(_0x120f18){logger[_0x5474('0x3a')](_0x5474('0x68'),util[_0x5474('0x3c')](_0x120f18,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5474('0x35')][_0x5474('0x69')]=function(_0x39622e,_0x3f6bdd){if(this[_0x5474('0x1c')][_0x39622e]){this[_0x5474('0x1c')][_0x39622e][_0x5474('0x6a')]=!![];if(_['endsWith'](_0x3f6bdd,'.wav49')){_0x3f6bdd=_0x3f6bdd[_0x5474('0x6b')](_0x5474('0x6c'),_0x5474('0x6d'));}this[_0x5474('0x1c')][_0x39622e]['monitorFilename']=_0x3f6bdd;var _0x373bdb=_[_0x5474('0x6e')](this[_0x5474('0x1c')][_0x39622e][_0x5474('0x6f')],{'filename':_0x3f6bdd});if(_['isNil'](_0x373bdb)){this[_0x5474('0x1c')][_0x39622e]['monitors'][_0x5474('0x70')]({'filename':_0x3f6bdd,'createdAt':moment()[_0x5474('0x40')](_0x5474('0x41')),'mixmonitorid':'','status':'rec'});}}};VoiceCallReport[_0x5474('0x35')][_0x5474('0x71')]=function(_0x3488f1){try{if(this['isNotNull'](_0x3488f1)){if(this[_0x5474('0x1c')][_0x3488f1['uniqueid']]&&_0x3488f1[_0x5474('0x48')]!=_0x5474('0x3d')){if(this[_0x5474('0x34')](_0x3488f1[_0x5474('0x72')])){if(this['isNotNull'](_0x3488f1['variable'][_0x5474('0x73')])){this['syncMixMonitorFilename'](_0x3488f1['uniqueid'],_0x3488f1[_0x5474('0x74')]);}else if(this[_0x5474('0x34')](_0x3488f1[_0x5474('0x72')]['xmd-phone'])){this[_0x5474('0x1c')][_0x3488f1[_0x5474('0x37')]][_0x5474('0x62')]=_0x3488f1['value'];}else if(this[_0x5474('0x34')](_0x3488f1[_0x5474('0x72')]['xmd-callerid'])){this[_0x5474('0x1c')][_0x3488f1[_0x5474('0x37')]][_0x5474('0x75')]=_0x3488f1[_0x5474('0x74')];}else if(this[_0x5474('0x34')](_0x3488f1[_0x5474('0x72')][_0x5474('0x76')])){this['channels'][_0x3488f1['uniqueid']][_0x5474('0x77')]=_0x3488f1[_0x5474('0x74')];}else if(this['isNotNull'](_0x3488f1[_0x5474('0x72')][_0x5474('0x78')])){this['channels'][_0x3488f1[_0x5474('0x37')]]['queue']=_0x3488f1[_0x5474('0x74')][_0x5474('0x49')](',')[0x0];}else if(this[_0x5474('0x34')](_0x3488f1[_0x5474('0x72')][_0x5474('0x79')])){this[_0x5474('0x1c')][_0x3488f1[_0x5474('0x37')]][_0x5474('0x7a')]=_0x3488f1[_0x5474('0x74')];}else if(this[_0x5474('0x34')](_0x3488f1[_0x5474('0x72')][_0x5474('0x7b')])){this[_0x5474('0x1c')][_0x3488f1[_0x5474('0x37')]][_0x5474('0x7c')]=_0x3488f1[_0x5474('0x74')];}else if(this[_0x5474('0x34')](_0x3488f1['variable'][_0x5474('0x7d')])){this[_0x5474('0x1c')][_0x3488f1['uniqueid']]['calleridpreview']=_0x3488f1[_0x5474('0x74')];}else if(this[_0x5474('0x34')](_0x3488f1[_0x5474('0x72')]['xmcs-queue'])){this[_0x5474('0x1c')][_0x3488f1[_0x5474('0x37')]][_0x5474('0x11')]=_0x3488f1[_0x5474('0x74')];}else if(this[_0x5474('0x34')](_0x3488f1[_0x5474('0x72')][_0x5474('0x7e')])){this[_0x5474('0x1c')][_0x3488f1[_0x5474('0x37')]][_0x5474('0x7f')]=_0x3488f1[_0x5474('0x74')];}}}else if(this[_0x5474('0x34')](_0x3488f1['variable'][_0x5474('0x73')])){if(_0x3488f1[_0x5474('0x74')]){var _0x5e595f=path[_0x5474('0x80')](_0x3488f1[_0x5474('0x74')])[_0x5474('0x4d')];this[_0x5474('0x69')](_0x5e595f,_0x3488f1['value']);}}else if(this[_0x5474('0x1c')][_0x3488f1[_0x5474('0x38')]]){if(this['isNotNull'](_0x3488f1[_0x5474('0x72')])){if(this[_0x5474('0x34')](_0x3488f1['variable'][_0x5474('0x7e')])){this[_0x5474('0x1c')][_0x3488f1['linkedid']]['sipcalllinkedid']=_0x3488f1[_0x5474('0x74')];}}}}}catch(_0xe96cf2){logger['error'](_0x5474('0x81'),util[_0x5474('0x3c')](_0xe96cf2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5474('0x35')][_0x5474('0x26')]=function(_0x130fca){try{if(this[_0x5474('0x34')](_0x130fca)){if(this[_0x5474('0x1c')][_0x130fca['uniqueid']]){var _0x1ac943=moment();this[_0x5474('0x1c')][_0x130fca[_0x5474('0x37')]][_0x5474('0x82')]=_0x1ac943[_0x5474('0x40')](_0x5474('0x41'));this[_0x5474('0x1c')][_0x130fca['uniqueid']][_0x5474('0x54')]=_0x1ac943['diff'](this['channels'][_0x130fca['uniqueid']]['starttime'],_0x5474('0x56'));if(this[_0x5474('0x1c')][_0x130fca['uniqueid']][_0x5474('0x5e')]){this['channels'][_0x130fca[_0x5474('0x37')]][_0x5474('0x83')]=_0x1ac943[_0x5474('0x61')](this['channels'][_0x130fca[_0x5474('0x37')]][_0x5474('0x5f')],'seconds');this[_0x5474('0x1c')][_0x130fca[_0x5474('0x37')]][_0x5474('0x60')]=this[_0x5474('0x1c')][_0x130fca[_0x5474('0x37')]][_0x5474('0x54')]-this[_0x5474('0x1c')][_0x130fca[_0x5474('0x37')]]['billableseconds'];}if(_0x130fca[_0x5474('0x47')]===_0x5474('0x84')){if(this[_0x5474('0x1d')][_0x130fca[_0x5474('0x48')][_0x5474('0x49')]('-')[0x0]]){this['agents'][_0x130fca['channel']['split']('-')[0x0]]=_[_0x5474('0x85')](this[_0x5474('0x1d')][_0x130fca[_0x5474('0x48')][_0x5474('0x49')]('-')[0x0]],[_0x5474('0x4a')]);this[_0x5474('0x36')](util[_0x5474('0x40')](_0x5474('0x4c'),this[_0x5474('0x1d')][_0x130fca[_0x5474('0x48')][_0x5474('0x49')]('-')[0x0]][_0x5474('0x4d')]),_0x5474('0x86'),{'destaccountcode':this[_0x5474('0x1d')][_0x130fca[_0x5474('0x48')][_0x5474('0x49')]('-')[0x0]]['accountcode']});}}ami[_0x5474('0x36')](_0x5474('0x87'),this[_0x5474('0x1c')][_0x130fca['uniqueid']]);delete this[_0x5474('0x1c')][_0x130fca[_0x5474('0x37')]];}}}catch(_0x2c39e2){logger[_0x5474('0x3a')](_0x5474('0x88'),util['inspect'](_0x2c39e2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5474('0x35')][_0x5474('0x2a')]=function(_0x9bd8dc){try{if(this['isNotNull'](_0x9bd8dc)){if(this[_0x5474('0x1c')][_0x9bd8dc[_0x5474('0x89')]]){this[_0x5474('0x1c')][_0x9bd8dc[_0x5474('0x89')]][_0x5474('0x8a')]=_0x9bd8dc[_0x5474('0x8b')];this['channels'][_0x9bd8dc[_0x5474('0x89')]][_0x5474('0x8c')]=_0x9bd8dc[_0x5474('0x8d')];if(this[_0x5474('0x1c')][_0x9bd8dc[_0x5474('0x8e')]]){var _0x404bc0=this[_0x5474('0x1c')][_0x9bd8dc['secondtransfereruniqueid']];this[_0x5474('0x1c')][_0x9bd8dc[_0x5474('0x8e')]]=this[_0x5474('0x1c')][_0x9bd8dc['transfereeuniqueid']];this[_0x5474('0x1c')][_0x9bd8dc['transfereeuniqueid']]=_0x404bc0;}}else if(this['channels'][_0x9bd8dc[_0x5474('0x8f')]]){this[_0x5474('0x1c')][_0x9bd8dc[_0x5474('0x8f')]][_0x5474('0x8a')]=_0x9bd8dc[_0x5474('0x8b')];this[_0x5474('0x1c')][_0x9bd8dc[_0x5474('0x8f')]][_0x5474('0x8c')]=_0x9bd8dc[_0x5474('0x8d')];if(this[_0x5474('0x1c')][_0x9bd8dc['origtransfereruniqueid']]){var _0x404bc0=this[_0x5474('0x1c')][_0x9bd8dc['origtransfereruniqueid']];this[_0x5474('0x1c')][_0x9bd8dc[_0x5474('0x90')]]=this[_0x5474('0x1c')][_0x9bd8dc[_0x5474('0x8f')]];this[_0x5474('0x1c')][_0x9bd8dc[_0x5474('0x8f')]]=_0x404bc0;}}}}catch(_0x1296d8){logger[_0x5474('0x3a')](_0x5474('0x91'),util[_0x5474('0x3c')](_0x1296d8,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x5474('0x92')]=function(_0x43e8e3){try{if(this[_0x5474('0x34')](_0x43e8e3)){if(this[_0x5474('0x1c')][_0x43e8e3[_0x5474('0x89')]]){this['channels'][_0x43e8e3[_0x5474('0x89')]][_0x5474('0x8a')]=_0x43e8e3[_0x5474('0x93')];this[_0x5474('0x1c')][_0x43e8e3['transfereeuniqueid']][_0x5474('0x8c')]=_0x43e8e3[_0x5474('0x94')];this[_0x5474('0x26')]({'event':'BlindTransfer','uniqueid':_0x43e8e3[_0x5474('0x89')],'context':_0x43e8e3[_0x5474('0x47')],'channel':_0x43e8e3[_0x5474('0x95')]});}}}catch(_0x39c4af){logger[_0x5474('0x3a')](_0x5474('0x96'),util[_0x5474('0x3c')](_0x39c4af,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5474('0x35')][_0x5474('0x2d')]=function(_0x4859c4){try{if(this[_0x5474('0x34')](_0x4859c4)){if(this['channels'][_0x4859c4[_0x5474('0x37')]]){if(!_['isNil'](this[_0x5474('0x1c')][_0x4859c4['uniqueid']][_0x5474('0x5f')])){this[_0x5474('0x1c')][_0x4859c4[_0x5474('0x37')]][_0x5474('0x97')]=moment()[_0x5474('0x40')](_0x5474('0x41'));}}}}catch(_0x59c70b){logger['error'](_0x5474('0x98'),util[_0x5474('0x3c')](_0x59c70b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x5474('0x35')][_0x5474('0x2f')]=function(_0x41ecd5){try{if(this['isNotNull'](_0x41ecd5)){if(this['channels'][_0x41ecd5[_0x5474('0x37')]]){if(!_[_0x5474('0x99')](this[_0x5474('0x1c')][_0x41ecd5[_0x5474('0x37')]][_0x5474('0x97')])){this['channels'][_0x41ecd5[_0x5474('0x37')]][_0x5474('0x9a')]+=moment()['milliseconds'](0x0)[_0x5474('0x61')](this[_0x5474('0x1c')][_0x41ecd5[_0x5474('0x37')]][_0x5474('0x97')],'seconds');delete this['channels'][_0x41ecd5[_0x5474('0x37')]][_0x5474('0x97')];}}}}catch(_0x34ec5e){logger['error'](_0x5474('0x9b'),util['inspect'](_0x34ec5e,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 32c4d2c..fa36c41 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 _0xe953=['channels','outboundChannels','outbound','variables','dialbegin','bind','dialend','syncDialEnd','syncVarSet','hangup','syncHangup','prototype','isNotNull','emit','uniqueid','merge','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','connect','custom:dialconnect','[syncDialEnd][VoiceDialReport]','addVariable','variable','value','[syncVarSet][VoiceDialReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','includes','endtime','format','diff','seconds','lastevent','complete','total','answered','billableseconds','sumBillable','duration','custom:dialend','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[syncHangup][VoiceDialReport]','exports','../../../config/logger','ami','redis','socket.io-emitter'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xe953,0x1d0));var _0x3e95=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0xe953[_0x382e89];return _0x3a1318;};'use strict';var _=require('lodash');var moment=require('moment');var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x3e95('0x0'))(_0x3e95('0x1'));var ami=require('../ami');config[_0x3e95('0x2')]=_['defaults'](config[_0x3e95('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0x3e95('0x3'))(new Redis(config[_0x3e95('0x2')]));function VoiceDialReport(_0x45f703){this[_0x3e95('0x4')]=_0x45f703[_0x3e95('0x5')];this['outbound']=_0x45f703[_0x3e95('0x6')];this[_0x3e95('0x7')]={};ami['on'](_0x3e95('0x8'),this['syncDialBegin'][_0x3e95('0x9')](this));ami['on'](_0x3e95('0xa'),this[_0x3e95('0xb')][_0x3e95('0x9')](this));ami['on']('varset',this[_0x3e95('0xc')]['bind'](this));ami['on'](_0x3e95('0xd'),this[_0x3e95('0xe')][_0x3e95('0x9')](this));}VoiceDialReport[_0x3e95('0xf')][_0x3e95('0x10')]=function(_0x152671){return _0x152671!==null&&!_['isUndefined'](_0x152671);};VoiceDialReport[_0x3e95('0xf')][_0x3e95('0x11')]=function(_0x58bb85,_0x1fb8f1,_0x721a12){io['to'](_0x58bb85)[_0x3e95('0x11')](_0x1fb8f1,_0x721a12);};VoiceDialReport[_0x3e95('0xf')]['syncDialBegin']=function(_0xbd4d4){try{if(this[_0x3e95('0x10')](_0xbd4d4)){if(this['channels'][_0xbd4d4[_0x3e95('0x12')]]){_[_0x3e95('0x13')](this[_0x3e95('0x4')][_0xbd4d4[_0x3e95('0x12')]],{'starttime':moment()['format'](_0x3e95('0x14')),'lastevent':'called','interface':_0xbd4d4[_0x3e95('0x15')][_0x3e95('0x16')](0x0,_0xbd4d4['channel'][_0x3e95('0x17')]('-')),'membername':_0xbd4d4[_0x3e95('0x15')][_0x3e95('0x16')](_0xbd4d4[_0x3e95('0x15')][_0x3e95('0x17')]('/')+0x1,_0xbd4d4[_0x3e95('0x15')][_0x3e95('0x17')]('-'))},_[_0x3e95('0x18')](_0xbd4d4,['event',_0x3e95('0x19')]));this['emit'](_0x3e95('0x1a'),_0x3e95('0x1b'),this[_0x3e95('0x4')][_0xbd4d4['uniqueid']]);ami[_0x3e95('0x11')](_0x3e95('0x1c'),this[_0x3e95('0x4')][_0xbd4d4[_0x3e95('0x12')]]);}}}catch(_0x1a601d){logger[_0x3e95('0x1d')](_0x3e95('0x1e'),util[_0x3e95('0x1f')](_0x1a601d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3e95('0xf')][_0x3e95('0xb')]=function(_0x3aa66f){try{if(this[_0x3e95('0x10')](_0x3aa66f)){if(this[_0x3e95('0x4')][_0x3aa66f[_0x3e95('0x12')]]){this[_0x3e95('0x4')][_0x3aa66f[_0x3e95('0x12')]][_0x3e95('0x20')]=_0x3aa66f[_0x3e95('0x20')];if(_0x3aa66f[_0x3e95('0x20')]===_0x3e95('0x21')){this[_0x3e95('0x4')][_0x3aa66f[_0x3e95('0x12')]][_0x3e95('0x22')]=_0x3aa66f[_0x3e95('0x22')];this[_0x3e95('0x4')][_0x3aa66f['uniqueid']][_0x3e95('0x23')]=_0x3aa66f[_0x3e95('0x23')];this[_0x3e95('0x4')][_0x3aa66f[_0x3e95('0x12')]][_0x3e95('0x24')]=moment()['format'](_0x3e95('0x14'));this[_0x3e95('0x4')][_0x3aa66f['uniqueid']]['lastevent']=_0x3e95('0x25');ami['emit'](_0x3e95('0x26'),this[_0x3e95('0x4')][_0x3aa66f['uniqueid']]);}this[_0x3e95('0x11')]('voice:outbound',_0x3e95('0x1b'),this['channels'][_0x3aa66f[_0x3e95('0x12')]]);}}}catch(_0x277ceb){logger[_0x3e95('0x1d')](_0x3e95('0x27'),util['inspect'](_0x277ceb,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3e95('0xf')][_0x3e95('0xc')]=function(_0x4de257){try{if(this[_0x3e95('0x10')](_0x4de257)){this[_0x3e95('0x28')](_0x4de257[_0x3e95('0x12')],_['keys'](_0x4de257[_0x3e95('0x29')])[0x0],_0x4de257['value']);if(this['isNotNull'](_0x4de257[_0x3e95('0x29')])&&this['isNotNull'](_0x4de257[_0x3e95('0x29')]['outboundrouteid'])){if(_['isUndefined'](this['channels'][_0x4de257[_0x3e95('0x12')]])){this[_0x3e95('0x4')][_0x4de257[_0x3e95('0x12')]]={'routeId':_0x4de257[_0x3e95('0x2a')],'variables':this[_0x3e95('0x7')][_0x4de257[_0x3e95('0x12')]]};this[_0x3e95('0x11')](_0x3e95('0x1a'),_0x3e95('0x1b'),this[_0x3e95('0x4')][_0x4de257[_0x3e95('0x12')]]);}}}}catch(_0x31b556){logger[_0x3e95('0x1d')](_0x3e95('0x2b'),util[_0x3e95('0x1f')](_0x31b556,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x3e95('0xf')]['addVariable']=function(_0xe2879a,_0x5678f1,_0x38820a){var _0x11cbb3=['rtpaudioqos',_0x3e95('0x2c'),_0x3e95('0x2d'),'rtpaudioqosjitterbridged',_0x3e95('0x2e'),_0x3e95('0x2f'),_0x3e95('0x30'),_0x3e95('0x31'),_0x3e95('0x32'),_0x3e95('0x33'),_0x3e95('0x34'),_0x3e95('0x35'),_0x3e95('0x36'),'memberdynamic',_0x3e95('0x37'),_0x3e95('0x38'),_0x3e95('0x39'),_0x3e95('0x3a'),_0x3e95('0x3b')];if(!_[_0x3e95('0x3c')](_0x5678f1)&&!_[_0x3e95('0x3d')](_0x11cbb3,_0x5678f1)){if(_['isUndefined'](this[_0x3e95('0x7')][_0xe2879a])){this[_0x3e95('0x7')][_0xe2879a]={};}this[_0x3e95('0x7')][_0xe2879a][_0x5678f1]=_0x38820a;}};VoiceDialReport[_0x3e95('0xf')][_0x3e95('0xe')]=function(_0x388fde){try{if(this[_0x3e95('0x10')](_0x388fde)){if(this[_0x3e95('0x4')][_0x388fde['uniqueid']]){this[_0x3e95('0x4')][_0x388fde[_0x3e95('0x12')]][_0x3e95('0x3e')]=moment()[_0x3e95('0x3f')](_0x3e95('0x14'));this['channels'][_0x388fde['uniqueid']]['duration']=moment(this[_0x3e95('0x4')][_0x388fde['uniqueid']]['endtime'])[_0x3e95('0x40')](this[_0x3e95('0x4')][_0x388fde[_0x3e95('0x12')]]['starttime'],_0x3e95('0x41'));this['channels'][_0x388fde[_0x3e95('0x12')]][_0x3e95('0x42')]=_0x3e95('0x43');this[_0x3e95('0x6')][_0x3e95('0x44')]+=0x1;if(this['channels'][_0x388fde[_0x3e95('0x12')]][_0x3e95('0x24')]){this[_0x3e95('0x6')][_0x3e95('0x45')]+=0x1;this[_0x3e95('0x4')][_0x388fde['uniqueid']]['holdtime']=moment(this[_0x3e95('0x4')][_0x388fde[_0x3e95('0x12')]]['answertime'])[_0x3e95('0x40')](this[_0x3e95('0x4')][_0x388fde[_0x3e95('0x12')]]['starttime'],_0x3e95('0x41'));this[_0x3e95('0x4')][_0x388fde['uniqueid']][_0x3e95('0x46')]=moment(this[_0x3e95('0x4')][_0x388fde[_0x3e95('0x12')]][_0x3e95('0x3e')])[_0x3e95('0x40')](this['channels'][_0x388fde[_0x3e95('0x12')]][_0x3e95('0x24')],_0x3e95('0x41'));this[_0x3e95('0x6')]['sumHoldTime']+=this[_0x3e95('0x4')][_0x388fde['uniqueid']]['holdtime']||0x0;this[_0x3e95('0x6')][_0x3e95('0x47')]+=this['channels'][_0x388fde[_0x3e95('0x12')]][_0x3e95('0x46')];}this[_0x3e95('0x6')]['sumDuration']+=this['channels'][_0x388fde[_0x3e95('0x12')]][_0x3e95('0x48')];ami[_0x3e95('0x11')]('custom:voiceDialReport',this['channels'][_0x388fde[_0x3e95('0x12')]]);ami[_0x3e95('0x11')](_0x3e95('0x49'),this['channels'][_0x388fde[_0x3e95('0x12')]]);this[_0x3e95('0x11')]('voice:outbound','voice_outbound:save',this[_0x3e95('0x6')]);logger['info'](_0x3e95('0x4a'),JSON[_0x3e95('0x4b')](this[_0x3e95('0x4')][_0x388fde[_0x3e95('0x12')]]));this[_0x3e95('0x11')]('voice:outbound','voice_outbound_channel:remove',this[_0x3e95('0x4')][_0x388fde[_0x3e95('0x12')]]);delete this[_0x3e95('0x4')][_0x388fde[_0x3e95('0x12')]];}if(this[_0x3e95('0x7')][_0x388fde['uniqueid']]){delete this['variables'][_0x388fde[_0x3e95('0x12')]];}}}catch(_0x3bfcd9){logger[_0x3e95('0x1d')](_0x3e95('0x4c'),util['inspect'](_0x3bfcd9,{'showHidden':![],'depth':null}));}};module[_0x3e95('0x4d')]=VoiceDialReport; \ No newline at end of file +var _0x76ed=['YYYY-MM-DD\x20HH:mm:ss','duration','endtime','diff','starttime','seconds','total','answertime','answered','holdtime','billableseconds','sumHoldTime','custom:dialend','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','channels','outboundChannels','outbound','dialbegin','syncDialBegin','bind','dialend','varset','hangup','syncHangup','isNotNull','prototype','emit','uniqueid','format','substring','channel','lastIndexOf','omit','event','privilege','voice:outbound','error','[syncDialBegin][VoiceDialReport]','inspect','syncDialEnd','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','connect','custom:dialconnect','voice_outbound_channel:save','[syncDialEnd][VoiceDialReport]','syncVarSet','addVariable','keys','variable','value','outboundrouteid','isUndefined','variables','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','membername','memberpenalty','memberrealtime','includes'];(function(_0x74746c,_0x4b0a70){var _0xfdb2f6=function(_0x1daf23){while(--_0x1daf23){_0x74746c['push'](_0x74746c['shift']());}};_0xfdb2f6(++_0x4b0a70);}(_0x76ed,0x1d0));var _0xd76e=function(_0x3660fc,_0x441e0e){_0x3660fc=_0x3660fc-0x0;var _0x4cec89=_0x76ed[_0x3660fc];return _0x4cec89;};'use strict';var _=require(_0xd76e('0x0'));var moment=require(_0xd76e('0x1'));var util=require('util');var Redis=require(_0xd76e('0x2'));var config=require(_0xd76e('0x3'));var logger=require(_0xd76e('0x4'))(_0xd76e('0x5'));var ami=require(_0xd76e('0x6'));config[_0xd76e('0x7')]=_['defaults'](config['redis'],{'host':_0xd76e('0x8'),'port':0x18eb});var io=require(_0xd76e('0x9'))(new Redis(config[_0xd76e('0x7')]));function VoiceDialReport(_0xb3682c){this[_0xd76e('0xa')]=_0xb3682c[_0xd76e('0xb')];this[_0xd76e('0xc')]=_0xb3682c[_0xd76e('0xc')];this['variables']={};ami['on'](_0xd76e('0xd'),this[_0xd76e('0xe')][_0xd76e('0xf')](this));ami['on'](_0xd76e('0x10'),this['syncDialEnd'][_0xd76e('0xf')](this));ami['on'](_0xd76e('0x11'),this['syncVarSet'][_0xd76e('0xf')](this));ami['on'](_0xd76e('0x12'),this[_0xd76e('0x13')]['bind'](this));}VoiceDialReport['prototype'][_0xd76e('0x14')]=function(_0x58b1d4){return _0x58b1d4!==null&&!_['isUndefined'](_0x58b1d4);};VoiceDialReport[_0xd76e('0x15')][_0xd76e('0x16')]=function(_0x843bff,_0x11219e,_0x36013f){io['to'](_0x843bff)[_0xd76e('0x16')](_0x11219e,_0x36013f);};VoiceDialReport['prototype'][_0xd76e('0xe')]=function(_0x74ad97){try{if(this[_0xd76e('0x14')](_0x74ad97)){if(this['channels'][_0x74ad97[_0xd76e('0x17')]]){_['merge'](this[_0xd76e('0xa')][_0x74ad97['uniqueid']],{'starttime':moment()[_0xd76e('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':'called','interface':_0x74ad97['channel'][_0xd76e('0x19')](0x0,_0x74ad97[_0xd76e('0x1a')]['lastIndexOf']('-')),'membername':_0x74ad97[_0xd76e('0x1a')][_0xd76e('0x19')](_0x74ad97[_0xd76e('0x1a')]['lastIndexOf']('/')+0x1,_0x74ad97[_0xd76e('0x1a')][_0xd76e('0x1b')]('-'))},_[_0xd76e('0x1c')](_0x74ad97,[_0xd76e('0x1d'),_0xd76e('0x1e')]));this[_0xd76e('0x16')](_0xd76e('0x1f'),'voice_outbound_channel:save',this[_0xd76e('0xa')][_0x74ad97[_0xd76e('0x17')]]);ami[_0xd76e('0x16')]('custom:dialbegin',this[_0xd76e('0xa')][_0x74ad97[_0xd76e('0x17')]]);}}}catch(_0x111f31){logger[_0xd76e('0x20')](_0xd76e('0x21'),util[_0xd76e('0x22')](_0x111f31,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd76e('0x15')][_0xd76e('0x23')]=function(_0x3aa0d3){try{if(this[_0xd76e('0x14')](_0x3aa0d3)){if(this[_0xd76e('0xa')][_0x3aa0d3[_0xd76e('0x17')]]){this[_0xd76e('0xa')][_0x3aa0d3[_0xd76e('0x17')]][_0xd76e('0x24')]=_0x3aa0d3[_0xd76e('0x24')];if(_0x3aa0d3[_0xd76e('0x24')]===_0xd76e('0x25')){this[_0xd76e('0xa')][_0x3aa0d3['uniqueid']]['connectedlinenum']=_0x3aa0d3[_0xd76e('0x26')];this[_0xd76e('0xa')][_0x3aa0d3[_0xd76e('0x17')]][_0xd76e('0x27')]=_0x3aa0d3[_0xd76e('0x27')];this['channels'][_0x3aa0d3[_0xd76e('0x17')]]['answertime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x3aa0d3[_0xd76e('0x17')]][_0xd76e('0x28')]=_0xd76e('0x29');ami[_0xd76e('0x16')](_0xd76e('0x2a'),this[_0xd76e('0xa')][_0x3aa0d3[_0xd76e('0x17')]]);}this[_0xd76e('0x16')](_0xd76e('0x1f'),_0xd76e('0x2b'),this[_0xd76e('0xa')][_0x3aa0d3['uniqueid']]);}}}catch(_0x24e550){logger[_0xd76e('0x20')](_0xd76e('0x2c'),util[_0xd76e('0x22')](_0x24e550,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xd76e('0x2d')]=function(_0xa8d903){try{if(this[_0xd76e('0x14')](_0xa8d903)){this[_0xd76e('0x2e')](_0xa8d903[_0xd76e('0x17')],_[_0xd76e('0x2f')](_0xa8d903[_0xd76e('0x30')])[0x0],_0xa8d903[_0xd76e('0x31')]);if(this[_0xd76e('0x14')](_0xa8d903[_0xd76e('0x30')])&&this[_0xd76e('0x14')](_0xa8d903[_0xd76e('0x30')][_0xd76e('0x32')])){if(_[_0xd76e('0x33')](this['channels'][_0xa8d903[_0xd76e('0x17')]])){this[_0xd76e('0xa')][_0xa8d903[_0xd76e('0x17')]]={'routeId':_0xa8d903['value'],'variables':this[_0xd76e('0x34')][_0xa8d903['uniqueid']]};this[_0xd76e('0x16')](_0xd76e('0x1f'),_0xd76e('0x2b'),this[_0xd76e('0xa')][_0xa8d903['uniqueid']]);}}}}catch(_0x55c23d){logger[_0xd76e('0x20')](_0xd76e('0x35'),util[_0xd76e('0x22')](_0x55c23d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd76e('0x15')][_0xd76e('0x2e')]=function(_0x475dc7,_0x46a50b,_0x394994){var _0x5d9715=[_0xd76e('0x36'),_0xd76e('0x37'),'rtpaudioqosjitter',_0xd76e('0x38'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0xd76e('0x39'),_0xd76e('0x3a'),_0xd76e('0x3b'),_0xd76e('0x3c'),_0xd76e('0x3d'),_0xd76e('0x3e'),_0xd76e('0x3f'),_0xd76e('0x40'),'memberinterface',_0xd76e('0x41'),_0xd76e('0x42'),_0xd76e('0x43'),_0xd76e('0x44')];if(!_['isNil'](_0x46a50b)&&!_[_0xd76e('0x45')](_0x5d9715,_0x46a50b)){if(_[_0xd76e('0x33')](this['variables'][_0x475dc7])){this[_0xd76e('0x34')][_0x475dc7]={};}this[_0xd76e('0x34')][_0x475dc7][_0x46a50b]=_0x394994;}};VoiceDialReport[_0xd76e('0x15')][_0xd76e('0x13')]=function(_0x106b85){try{if(this['isNotNull'](_0x106b85)){if(this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]]){this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]]['endtime']=moment()[_0xd76e('0x18')](_0xd76e('0x46'));this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]][_0xd76e('0x47')]=moment(this['channels'][_0x106b85[_0xd76e('0x17')]][_0xd76e('0x48')])[_0xd76e('0x49')](this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]][_0xd76e('0x4a')],_0xd76e('0x4b'));this[_0xd76e('0xa')][_0x106b85['uniqueid']][_0xd76e('0x28')]='complete';this['outbound'][_0xd76e('0x4c')]+=0x1;if(this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]][_0xd76e('0x4d')]){this[_0xd76e('0xc')][_0xd76e('0x4e')]+=0x1;this['channels'][_0x106b85['uniqueid']][_0xd76e('0x4f')]=moment(this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]][_0xd76e('0x4d')])[_0xd76e('0x49')](this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]][_0xd76e('0x4a')],_0xd76e('0x4b'));this[_0xd76e('0xa')][_0x106b85['uniqueid']][_0xd76e('0x50')]=moment(this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]][_0xd76e('0x48')])['diff'](this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]][_0xd76e('0x4d')],_0xd76e('0x4b'));this[_0xd76e('0xc')][_0xd76e('0x51')]+=this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]][_0xd76e('0x4f')]||0x0;this[_0xd76e('0xc')]['sumBillable']+=this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]][_0xd76e('0x50')];}this[_0xd76e('0xc')]['sumDuration']+=this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]][_0xd76e('0x47')];ami[_0xd76e('0x16')]('custom:voiceDialReport',this['channels'][_0x106b85['uniqueid']]);ami['emit'](_0xd76e('0x52'),this[_0xd76e('0xa')][_0x106b85['uniqueid']]);this[_0xd76e('0x16')](_0xd76e('0x1f'),_0xd76e('0x53'),this[_0xd76e('0xc')]);logger[_0xd76e('0x54')](_0xd76e('0x55'),JSON[_0xd76e('0x56')](this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]]));this[_0xd76e('0x16')](_0xd76e('0x1f'),_0xd76e('0x57'),this[_0xd76e('0xa')][_0x106b85[_0xd76e('0x17')]]);delete this[_0xd76e('0xa')][_0x106b85['uniqueid']];}if(this['variables'][_0x106b85[_0xd76e('0x17')]]){delete this[_0xd76e('0x34')][_0x106b85[_0xd76e('0x17')]];}}}catch(_0x181ccd){logger['error'](_0xd76e('0x58'),util['inspect'](_0x181ccd,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 1a816c2..f1e30cd 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 _0xf6aa=['[syncAgentConnect][VoiceQueueReport]','membername','queuecallerexit','transfer','reason','startsWith','toLowerCase','local/','add','seconds','queuecallerexitreason','FORWARDTRANSFER','transferexten','destexten','linkedid','COMPLETEDBY','[syncAgentComplete][VoiceQueueReport]','syncVarSet','addVariable','variable','value','queuestatus','TIMEOUT','lastevent','timeout','custom:timeout','queuecallerexitAt','queueposition','EXITWITHKEY','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberrealtime','isNil','includes','syncHangup','diff','length','milliseconds','sumBillable','custom:queuecallerunmanaged','custom:queuecallerabandon','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','transfereeuniqueid','secondtransfererexten','transferuniqueid','secondtransfereruniqueid','transfertype','ATTENDED','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDEDTRANSFER','[syncAttendedTransfer][VoiceQueueReport]','syncBlindTransfer','BLINDTRANSFER','BLIND','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','mohtime','[syncMusicOnHoldStop][VoiceQueueReport]','lodash','moment','bluebird','util','md5','ioredis','../../../config/logger','../model/queueReport','defaults','redis','socket.io-emitter','prototype','tail','finally','sequence','queueReports','agents','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','varset','hangup','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','loopQueueSummary','loopQueueShow','isUndefined','isEmpty','hasOwnProperty','originated','talking','waiting','queueStatusComplete','clearZombieChannels','channels','switch','Action','status','channel','catch','message','No\x20such\x20channel','[voiceQueueReport][checkChannel]','error','[voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','inspect','emit','emitVoiceQueueChannelSave','format','voice:queue:%s','name','info','stringify','voice_queue_channel:remove','inbound','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','Trunk','active','callerid','Interval','voice_queue:save','queues','[queues]','then','[queuesummary]','isNotNull','queue','callers','toNumber','loggedin','emitVoiceQueueSummary','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','syncQueueSummaryComplete','syncNewExten','uniqueid','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','merge','pick','keys','push','syncQueueCallerAbandon','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','emitVoiceQueueChannelRemove','[syncQueueCallerAbandon][VoiceQueueReport]','queuecallerleaveAt','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','COMPLETEDBYAGENT'];(function(_0x39498e,_0x7607a0){var _0x117035=function(_0x3fcd84){while(--_0x3fcd84){_0x39498e['push'](_0x39498e['shift']());}};_0x117035(++_0x7607a0);}(_0xf6aa,0x118));var _0xaf6a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf6aa[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xaf6a('0x0'));var moment=require(_0xaf6a('0x1'));var BPromise=require(_0xaf6a('0x2'));var util=require(_0xaf6a('0x3'));var md5=require(_0xaf6a('0x4'));var Redis=require(_0xaf6a('0x5'));var config=require('../../../config/environment');var logger=require(_0xaf6a('0x6'))('ami');var ami=require('../ami');var QueueReport=require(_0xaf6a('0x7'));config['redis']=_[_0xaf6a('0x8')](config[_0xaf6a('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xaf6a('0xa'))(new Redis(config[_0xaf6a('0x9')]));var Sequence=function(){};Sequence[_0xaf6a('0xb')]['enqueue']=function(_0x5f3c1f){this[_0xaf6a('0xc')]=this[_0xaf6a('0xc')]?this[_0xaf6a('0xc')][_0xaf6a('0xd')](_0x5f3c1f):_0x5f3c1f();};function VoiceQueueReport(_0x85ce11){this[_0xaf6a('0xe')]=new Sequence();this[_0xaf6a('0xf')]={};this[_0xaf6a('0x10')]=_0x85ce11[_0xaf6a('0x10')];this['channels']=_0x85ce11[_0xaf6a('0x11')];this[_0xaf6a('0x12')]=_0x85ce11[_0xaf6a('0x12')];this[_0xaf6a('0x13')]=!![];this[_0xaf6a('0x14')]=_0x85ce11['campaigns'];this[_0xaf6a('0x15')]={};ami['on'](_0xaf6a('0x16'),this[_0xaf6a('0x17')][_0xaf6a('0x18')](this));ami['on']('queuesummarycomplete',this['syncQueueSummaryComplete'][_0xaf6a('0x18')](this));ami['on'](_0xaf6a('0x19'),this[_0xaf6a('0x1a')][_0xaf6a('0x18')](this));ami['on'](_0xaf6a('0x1b'),this['syncQueueCallerAbandon'][_0xaf6a('0x18')](this));ami['on'](_0xaf6a('0x1c'),this[_0xaf6a('0x1d')][_0xaf6a('0x18')](this));ami['on'](_0xaf6a('0x1e'),this[_0xaf6a('0x1f')][_0xaf6a('0x18')](this));ami['on'](_0xaf6a('0x20'),this['syncAgentConnect'][_0xaf6a('0x18')](this));ami['on'](_0xaf6a('0x21'),this['syncVarSet'][_0xaf6a('0x18')](this));ami['on'](_0xaf6a('0x22'),this['syncHangup'][_0xaf6a('0x18')](this));ami['on']('fullybooted',this[_0xaf6a('0x23')]['bind'](this));ami['on'](_0xaf6a('0x24'),this[_0xaf6a('0x25')][_0xaf6a('0x18')](this));ami['on'](_0xaf6a('0x26'),this[_0xaf6a('0x27')][_0xaf6a('0x18')](this));ami['on'](_0xaf6a('0x28'),this[_0xaf6a('0x29')][_0xaf6a('0x18')](this));ami['on'](_0xaf6a('0x2a'),this['syncBlindTransfer'][_0xaf6a('0x18')](this));this[_0xaf6a('0x2b')]();this[_0xaf6a('0x2c')]();}function isNotNull(_0x6bc530){return _0x6bc530!==null&&!_[_0xaf6a('0x2d')](_0x6bc530);}function clearChannels(_0x31eb65){if(!_[_0xaf6a('0x2e')](_0x31eb65)){for(var _0x4d4f42 in _0x31eb65){if(_0x31eb65['hasOwnProperty'](_0x4d4f42)){delete _0x31eb65[_0x4d4f42];}}}}function clearCampaigns(_0x36c1b7){if(!_[_0xaf6a('0x2e')](_0x36c1b7)){for(var _0x566605 in _0x36c1b7){if(_0x36c1b7[_0xaf6a('0x2f')](_0x566605)){_0x36c1b7[_0x566605]['originated']=0x0;}}}}function clearVoiceQueues(_0x41591a){if(!_[_0xaf6a('0x2e')](_0x41591a)){for(var _0x563a9 in _0x41591a){if(_0x41591a['hasOwnProperty'](_0x563a9)){_0x41591a[_0x563a9][_0xaf6a('0x30')]=0x0;_0x41591a[_0x563a9][_0xaf6a('0x31')]=0x0;_0x41591a[_0x563a9]['pTalking']=0x0;_0x41591a[_0x563a9][_0xaf6a('0x32')]=0x0;_0x41591a[_0x563a9][_0xaf6a('0x33')]=!![];}}}}function clearAgentBooked(_0x36cb70){if(!_[_0xaf6a('0x2e')](_0x36cb70)){for(var _0x7030f3 in _0x36cb70){if(_0x36cb70[_0xaf6a('0x2f')](_0x7030f3)){_0x36cb70[_0x7030f3]['unlockRR']=!![];}}}}VoiceQueueReport[_0xaf6a('0xb')][_0xaf6a('0x34')]=function(){var _0x17cf87=this;for(var _0x527b1c in this['channels']){if(this[_0xaf6a('0x35')][_0xaf6a('0x2f')](_0x527b1c)&&!this[_0xaf6a('0x35')][_0x527b1c][_0xaf6a('0x36')]){this[_0xaf6a('0xe')]['enqueue'](function(){if(!_['isNil'](_0x17cf87[_0xaf6a('0x35')][_0x527b1c])){return ami[_0xaf6a('0x37')]({'action':_0xaf6a('0x38'),'channel':_0x17cf87['channels'][_0x527b1c][_0xaf6a('0x39')]})[_0xaf6a('0x3a')](function(_0x1f98d0){if(_0x1f98d0[_0xaf6a('0x3b')]===_0xaf6a('0x3c')){setTimeout(function(){if(_0x17cf87[_0xaf6a('0x35')][_0x527b1c]){delete _0x17cf87['channels'][_0x527b1c];logger['error'](_0xaf6a('0x3d'),_0x527b1c);}if(_0x17cf87[_0xaf6a('0xf')][_0x527b1c]){delete _0x17cf87[_0xaf6a('0xf')][_0x527b1c];logger['error']('[voiceQueueReport][checkQueueReport]',_0x527b1c);}if(_0x17cf87[_0xaf6a('0x15')][_0x527b1c]){delete _0x17cf87[_0xaf6a('0x15')][_0x527b1c];logger[_0xaf6a('0x3e')](_0xaf6a('0x3f'),_0x527b1c);}},0x1f40);}});}});}}};VoiceQueueReport[_0xaf6a('0xb')]['syncFullyBooted']=function(){logger[_0xaf6a('0x3e')](_0xaf6a('0x40'));clearChannels(this[_0xaf6a('0x35')]);this[_0xaf6a('0x41')](this[_0xaf6a('0xf')]);clearAgentBooked(this[_0xaf6a('0x10')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0xaf6a('0x14')]);};VoiceQueueReport['prototype'][_0xaf6a('0x41')]=function(_0x2b13a8){var _0xf43343=this;if(!_[_0xaf6a('0x2e')](_0x2b13a8)){for(var _0x261337 in _0x2b13a8){if(_0x2b13a8[_0xaf6a('0x2f')](_0x261337)){_0xf43343['emitVoiceQueueChannelRemove'](_0x2b13a8[_0x261337]);delete _0x2b13a8[_0x261337];}}}};function loggerCatch(_0x574349){return function(_0x596bb6){logger['error'](_0x574349,util[_0xaf6a('0x42')](_0x596bb6,{'showHidden':![],'depth':null}));};}VoiceQueueReport['prototype'][_0xaf6a('0x43')]=function(_0x51d5e3,_0x143d22,_0x5c1da5){io['to'](_0x51d5e3)['emit'](_0x143d22,_0x5c1da5);};VoiceQueueReport[_0xaf6a('0xb')][_0xaf6a('0x44')]=function(_0x1b226d){this['emit'](util[_0xaf6a('0x45')](_0xaf6a('0x46'),_0x1b226d[_0xaf6a('0x47')]),'voice_queue_channel:save',_0x1b226d);};VoiceQueueReport['prototype']['emitVoiceQueueChannelRemove']=function(_0x137e89){logger[_0xaf6a('0x48')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0xaf6a('0x49')](_0x137e89));this['emit'](util[_0xaf6a('0x45')](_0xaf6a('0x46'),_0x137e89[_0xaf6a('0x47')]),_0xaf6a('0x4a'),_0x137e89);};VoiceQueueReport[_0xaf6a('0xb')]['emitVoiceQueueSummary']=function(_0x4e72d1){if(_0x4e72d1['type']===_0xaf6a('0x4b')){var _0x3c7d14={'id':_0x4e72d1['id'],'name':_0x4e72d1['name'],'strategy':_0x4e72d1['strategy'],'answered':_0x4e72d1[_0xaf6a('0x4c')],'available':_0x4e72d1[_0xaf6a('0x4d')],'loggedIn':_0x4e72d1[_0xaf6a('0x4e')],'pTalking':_0x4e72d1[_0xaf6a('0x4f')],'sumBillable':_0x4e72d1['sumBillable'],'sumDuration':_0x4e72d1[_0xaf6a('0x50')],'sumHoldTime':_0x4e72d1[_0xaf6a('0x51')]||0x0,'talking':_0x4e72d1[_0xaf6a('0x31')],'total':_0x4e72d1[_0xaf6a('0x52')],'type':_0x4e72d1[_0xaf6a('0x53')],'unmanaged':_0x4e72d1[_0xaf6a('0x54')],'abandoned':_0x4e72d1[_0xaf6a('0x55')],'waiting':_0x4e72d1['waiting']};if(_0x4e72d1['Trunk']){_0x3c7d14[_0xaf6a('0x56')]={'id':_0x4e72d1[_0xaf6a('0x56')]['id'],'name':_0x4e72d1['Trunk'][_0xaf6a('0x47')],'active':_0x4e72d1[_0xaf6a('0x56')][_0xaf6a('0x57')],'callerid':_0x4e72d1[_0xaf6a('0x56')][_0xaf6a('0x58')]};}if(_0x4e72d1[_0xaf6a('0x59')]){_0x3c7d14[_0xaf6a('0x59')]={'id':_0x4e72d1[_0xaf6a('0x59')]['id'],'name':_0x4e72d1[_0xaf6a('0x59')]['name']};}var _0x1d6f48=md5(JSON['stringify'](_0x3c7d14));if(_0x4e72d1[_0xaf6a('0x4')]!==_0x1d6f48){_0x4e72d1[_0xaf6a('0x4')]=_0x1d6f48;this[_0xaf6a('0x43')](util[_0xaf6a('0x45')]('voice:queue:%s',_0x3c7d14[_0xaf6a('0x47')]),_0xaf6a('0x5a'),_0x3c7d14);}}};VoiceQueueReport[_0xaf6a('0xb')]['isNotNull']=function(_0x9fb1c3){return _0x9fb1c3!==null&&!_[_0xaf6a('0x2d')](_0x9fb1c3);};VoiceQueueReport[_0xaf6a('0xb')][_0xaf6a('0x2c')]=function(){var _0x4347f9=this;setInterval(function(){_0x4347f9[_0xaf6a('0x34')]();ami[_0xaf6a('0x37')]({'action':_0xaf6a('0x5b')})[_0xaf6a('0x3a')](loggerCatch(_0xaf6a('0x5c')));},0x2710);};VoiceQueueReport[_0xaf6a('0xb')][_0xaf6a('0x2b')]=function(){var _0x58a07a=this;setInterval(function(){if(_0x58a07a[_0xaf6a('0x13')]){return ami[_0xaf6a('0x37')]({'action':_0xaf6a('0x16')})[_0xaf6a('0x5d')](function(_0x971a75){_0x58a07a[_0xaf6a('0x13')]=![];})[_0xaf6a('0x3a')](loggerCatch(_0xaf6a('0x5e')));}},0x3e8);};VoiceQueueReport[_0xaf6a('0xb')]['syncQueueSummary']=function(_0x34dd6f){try{if(this[_0xaf6a('0x5f')](_0x34dd6f)&&this[_0xaf6a('0x5f')](_0x34dd6f[_0xaf6a('0x60')])){if(this[_0xaf6a('0x12')][_0x34dd6f[_0xaf6a('0x60')]]){var _0x41fba3=_['countBy'](this[_0xaf6a('0x35')],_0xaf6a('0x60'))[_0x34dd6f['queue']]||0x0;var _0x41d8db=_0x41fba3-_0x34dd6f['callers'];if(this[_0xaf6a('0x12')][_0x34dd6f[_0xaf6a('0x60')]][_0xaf6a('0x32')]!==_['toNumber'](_0x34dd6f[_0xaf6a('0x61')])||this[_0xaf6a('0x12')][_0x34dd6f['queue']][_0xaf6a('0x4e')]!==_[_0xaf6a('0x62')](_0x34dd6f['loggedin'])||this[_0xaf6a('0x12')][_0x34dd6f[_0xaf6a('0x60')]][_0xaf6a('0x4d')]!==_[_0xaf6a('0x62')](_0x34dd6f[_0xaf6a('0x4d')])||this[_0xaf6a('0x12')][_0x34dd6f['queue']][_0xaf6a('0x31')]!==_0x41d8db){this[_0xaf6a('0x12')][_0x34dd6f[_0xaf6a('0x60')]][_0xaf6a('0x32')]=_['toNumber'](_0x34dd6f[_0xaf6a('0x61')]);this[_0xaf6a('0x12')][_0x34dd6f['queue']][_0xaf6a('0x4e')]=_[_0xaf6a('0x62')](_0x34dd6f[_0xaf6a('0x63')]);this['voiceQueues'][_0x34dd6f[_0xaf6a('0x60')]][_0xaf6a('0x4d')]=_[_0xaf6a('0x62')](_0x34dd6f['available']);this[_0xaf6a('0x12')][_0x34dd6f[_0xaf6a('0x60')]][_0xaf6a('0x31')]=_0x41d8db>0x0?_0x41d8db:0x0;this[_0xaf6a('0x12')][_0x34dd6f[_0xaf6a('0x60')]][_0xaf6a('0x31')]=this['voiceQueues'][_0x34dd6f['queue']][_0xaf6a('0x31')]>_[_0xaf6a('0x62')](_0x34dd6f[_0xaf6a('0x63')])?_[_0xaf6a('0x62')](_0x34dd6f[_0xaf6a('0x63')]):this[_0xaf6a('0x12')][_0x34dd6f[_0xaf6a('0x60')]]['talking'];this[_0xaf6a('0x64')](this[_0xaf6a('0x12')][_0x34dd6f[_0xaf6a('0x60')]]);}ami[_0xaf6a('0x43')](_0xaf6a('0x65'),this[_0xaf6a('0x12')][_0x34dd6f[_0xaf6a('0x60')]]);}}}catch(_0x41ee2b){logger['error'](_0xaf6a('0x66'),util[_0xaf6a('0x42')](_0x41ee2b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaf6a('0xb')][_0xaf6a('0x67')]=function(_0x55081a){this[_0xaf6a('0x13')]=!![];};VoiceQueueReport[_0xaf6a('0xb')][_0xaf6a('0x68')]=function(_0x3c3e51){};VoiceQueueReport[_0xaf6a('0xb')][_0xaf6a('0x1a')]=function(_0x1171fe){try{if(this[_0xaf6a('0x5f')](_0x1171fe)){if(_[_0xaf6a('0x2d')](this[_0xaf6a('0xf')][_0x1171fe[_0xaf6a('0x69')]])){this[_0xaf6a('0xf')][_0x1171fe[_0xaf6a('0x69')]]=[];this[_0xaf6a('0x35')][_0x1171fe['uniqueid']]={};}var _0x26e98d=new QueueReport();_0x26e98d['name']=_0x1171fe['queue'];_0x26e98d['type']=this[_0xaf6a('0x12')][_0x26e98d[_0xaf6a('0x47')]]&&this['voiceQueues'][_0x26e98d[_0xaf6a('0x47')]]['type']?this[_0xaf6a('0x12')][_0x26e98d['name']][_0xaf6a('0x53')]||_0xaf6a('0x4b'):_0xaf6a('0x4b');_0x26e98d[_0xaf6a('0x60')]=_0x1171fe['queue'];_0x26e98d[_0xaf6a('0x6a')]=moment()[_0xaf6a('0x45')](_0xaf6a('0x6b'));_0x26e98d[_0xaf6a('0x6c')]=_0x1171fe[_0xaf6a('0x6c')];_0x26e98d[_0xaf6a('0x6d')]=_0x1171fe[_0xaf6a('0x6d')];_[_0xaf6a('0x6e')](_0x26e98d,_[_0xaf6a('0x6f')](_0x1171fe,_[_0xaf6a('0x70')](_0x26e98d)));this[_0xaf6a('0xf')][_0x1171fe[_0xaf6a('0x69')]][_0xaf6a('0x71')](_0x26e98d);this[_0xaf6a('0x35')][_0x1171fe[_0xaf6a('0x69')]]=_0x26e98d;this[_0xaf6a('0x44')](_0x26e98d);}}catch(_0x326ab7){logger['error']('[syncQueueCallerJoin][VoiceQueueReport]',util['inspect'](_0x326ab7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xaf6a('0x72')]=function(_0xf0e77e){try{if(this[_0xaf6a('0x5f')](_0xf0e77e)){if(this['queueReports'][_0xf0e77e['uniqueid']]){var _0x4d6bf9=_[_0xaf6a('0x73')](this[_0xaf6a('0xf')][_0xf0e77e[_0xaf6a('0x69')]]);_0x4d6bf9[_0xaf6a('0x74')]=![];_0x4d6bf9[_0xaf6a('0x75')]=null;_0x4d6bf9[_0xaf6a('0x76')]=_0xf0e77e['holdtime'];_0x4d6bf9[_0xaf6a('0x77')]=_0xf0e77e['originalposition'];_0x4d6bf9[_0xaf6a('0x1b')]=!![];_0x4d6bf9[_0xaf6a('0x78')]=moment()['format'](_0xaf6a('0x6b'));_0x4d6bf9['queuecallerexitreason']=_0xaf6a('0x79');_0x4d6bf9[_0xaf6a('0x7a')]=null;this[_0xaf6a('0x35')][_0xf0e77e[_0xaf6a('0x69')]]=_0x4d6bf9;this[_0xaf6a('0x7b')](_0x4d6bf9);}}}catch(_0x2b3ddd){logger['error'](_0xaf6a('0x7c'),util['inspect'](_0x2b3ddd,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xaf6a('0x1d')]=function(_0x4135bd){try{if(this[_0xaf6a('0x5f')](_0x4135bd)){if(this[_0xaf6a('0xf')][_0x4135bd['uniqueid']]){var _0x3e0d63=_[_0xaf6a('0x73')](this['queueReports'][_0x4135bd[_0xaf6a('0x69')]]);_0x3e0d63[_0xaf6a('0x7d')]=moment()[_0xaf6a('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x3e0d63[_0xaf6a('0x7e')]=_0x4135bd[_0xaf6a('0x7e')];_0x3e0d63[_0xaf6a('0x7f')]=_0x4135bd[_0xaf6a('0x7f')];this[_0xaf6a('0x35')][_0x4135bd[_0xaf6a('0x69')]]=_0x3e0d63;this[_0xaf6a('0x44')](_0x3e0d63);}}}catch(_0x1aac18){logger[_0xaf6a('0x3e')](_0xaf6a('0x80'),util[_0xaf6a('0x42')](_0x1aac18,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaf6a('0xb')]['syncAgentConnect']=function(_0x4897a3){try{if(this[_0xaf6a('0x5f')](_0x4897a3)){if(this['queueReports'][_0x4897a3['uniqueid']]){var _0x4bcc77=_[_0xaf6a('0x73')](this[_0xaf6a('0xf')][_0x4897a3['uniqueid']]);_0x4bcc77[_0xaf6a('0x74')]=!![];_0x4bcc77['queuecallerexitreason']=_0xaf6a('0x81');}}}catch(_0x285205){logger[_0xaf6a('0x3e')](_0xaf6a('0x82'),util[_0xaf6a('0x42')](_0x285205,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaf6a('0xb')][_0xaf6a('0x1f')]=function(_0x3f3c2f){try{if(this[_0xaf6a('0x5f')](_0x3f3c2f)){if(this[_0xaf6a('0xf')][_0x3f3c2f[_0xaf6a('0x69')]]){var _0x2cce37=_[_0xaf6a('0x73')](this[_0xaf6a('0xf')][_0x3f3c2f['uniqueid']]);_0x2cce37[_0xaf6a('0x1b')]=![];_0x2cce37['queuecallerabandonAt']=null;_0x2cce37['assigned']=!![];_0x2cce37[_0xaf6a('0x7a')]=_0x3f3c2f[_0xaf6a('0x83')];_0x2cce37['holdtime']=_0x3f3c2f['holdtime'];_0x2cce37['queuecallercomplete']=!![];_0x2cce37[_0xaf6a('0x84')]=![];_0x2cce37['queuecallerexitAt']=null;if(!_0x2cce37[_0xaf6a('0x85')]){if(_0x3f3c2f[_0xaf6a('0x86')]==_0xaf6a('0x85')){_0x2cce37['queuecallerexitreason']='COMPLETED';}else{if(_[_0xaf6a('0x87')](_0x3f3c2f[_0xaf6a('0x39')][_0xaf6a('0x88')](),_0xaf6a('0x89'))){if(this[_0xaf6a('0xf')][_0x3f3c2f['linkedid']]){var _0x3a4466=_[_0xaf6a('0x73')](this[_0xaf6a('0xf')][_0x3f3c2f['linkedid']]);_0x3a4466[_0xaf6a('0x74')]=![];_0x3a4466[_0xaf6a('0x84')]=!![];_0x3a4466['queuecallerexitAt']=moment(_0x2cce37[_0xaf6a('0x6a')])[_0xaf6a('0x8a')](_0x3f3c2f[_0xaf6a('0x76')],_0xaf6a('0x8b'))[_0xaf6a('0x45')](_0xaf6a('0x6b'));_0x3a4466[_0xaf6a('0x8c')]=_0xaf6a('0x8d');_0x3a4466[_0xaf6a('0x85')]=!![];_0x3a4466['transfertype']='FORWARD';_0x3a4466[_0xaf6a('0x8e')]=_0x3f3c2f[_0xaf6a('0x8f')];_0x3a4466['transferuniqueid']=_0x3f3c2f[_0xaf6a('0x69')];var _0x1cfce0=this[_0xaf6a('0xf')][_0x3f3c2f['linkedid']];this[_0xaf6a('0xf')][_0x3f3c2f[_0xaf6a('0x90')]]=this[_0xaf6a('0xf')][_0x3f3c2f['uniqueid']];this[_0xaf6a('0xf')][_0x3f3c2f[_0xaf6a('0x69')]]=_0x1cfce0;}}else{_0x2cce37[_0xaf6a('0x8c')]=_0xaf6a('0x91')+_0x3f3c2f['reason']['toUpperCase']();}}}this[_0xaf6a('0x35')][_0x3f3c2f[_0xaf6a('0x69')]]=_0x2cce37;this[_0xaf6a('0x7b')](_0x2cce37);}}}catch(_0x5e78a8){logger['error'](_0xaf6a('0x92'),util[_0xaf6a('0x42')](_0x5e78a8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xaf6a('0xb')][_0xaf6a('0x93')]=function(_0x194ec5){try{if(this[_0xaf6a('0x5f')](_0x194ec5)){this[_0xaf6a('0x94')](_0x194ec5[_0xaf6a('0x69')],_['keys'](_0x194ec5[_0xaf6a('0x95')])[0x0],_0x194ec5[_0xaf6a('0x96')]);if(this[_0xaf6a('0xf')][_0x194ec5[_0xaf6a('0x69')]]){var _0x5e1ec7=_[_0xaf6a('0x73')](this[_0xaf6a('0xf')][_0x194ec5[_0xaf6a('0x69')]]);if(_0x5e1ec7){if(this[_0xaf6a('0x5f')](_0x194ec5['variable'])&&this['isNotNull'](_0x194ec5[_0xaf6a('0x95')][_0xaf6a('0x97')])){switch(_0x194ec5[_0xaf6a('0x96')]){case'CONTINUE':_0x5e1ec7['queuecallerexit']=![];_0x5e1ec7['queuecallerexitAt']=null;break;case _0xaf6a('0x98'):_0x5e1ec7[_0xaf6a('0x99')]=_0xaf6a('0x9a');ami[_0xaf6a('0x43')](_0xaf6a('0x9b'),_0x5e1ec7);break;default:_0x5e1ec7[_0xaf6a('0x84')]=!![];_0x5e1ec7[_0xaf6a('0x9c')]=moment()[_0xaf6a('0x45')](_0xaf6a('0x6b'));_0x5e1ec7[_0xaf6a('0x7d')]=moment()[_0xaf6a('0x45')](_0xaf6a('0x6b'));}_0x5e1ec7[_0xaf6a('0x1b')]=![];_0x5e1ec7[_0xaf6a('0x78')]=null;_0x5e1ec7['queuecallerexitreason']=_0x194ec5[_0xaf6a('0x96')];this[_0xaf6a('0x35')][_0x194ec5[_0xaf6a('0x69')]]=_0x5e1ec7;this[_0xaf6a('0x7b')](_0x5e1ec7);}else if(this[_0xaf6a('0x5f')](_0x194ec5[_0xaf6a('0x95')])&&this['isNotNull'](_0x194ec5[_0xaf6a('0x95')][_0xaf6a('0x9d')])){if(!_0x5e1ec7[_0xaf6a('0x1b')]){_0x5e1ec7['queuecallerexit']=!![];_0x5e1ec7[_0xaf6a('0x9c')]=moment()['format'](_0xaf6a('0x6b'));_0x5e1ec7[_0xaf6a('0x8c')]=_0xaf6a('0x9e');_0x5e1ec7[_0xaf6a('0x7d')]=moment()[_0xaf6a('0x45')](_0xaf6a('0x6b'));this[_0xaf6a('0x35')][_0x194ec5[_0xaf6a('0x69')]]=_0x5e1ec7;}}_0x5e1ec7[_0xaf6a('0x15')]=this[_0xaf6a('0x15')][_0x194ec5[_0xaf6a('0x69')]];}}}}catch(_0x170903){logger[_0xaf6a('0x3e')]('[syncVarSet][VoiceQueueReport]',util[_0xaf6a('0x42')](_0x170903,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x3b4095,_0x1ac96a,_0x71ab1){var _0x4f1a82=[_0xaf6a('0x9f'),_0xaf6a('0xa0'),_0xaf6a('0xa1'),_0xaf6a('0xa2'),_0xaf6a('0xa3'),'rtpaudioqoslossbridged',_0xaf6a('0xa4'),'rtpaudioqosrttbridged',_0xaf6a('0xa5'),'sipuri',_0xaf6a('0xa6'),_0xaf6a('0xa7'),_0xaf6a('0xa8'),'memberdynamic',_0xaf6a('0xa9'),_0xaf6a('0xaa'),_0xaf6a('0x83'),'memberpenalty',_0xaf6a('0xab')];if(!_[_0xaf6a('0xac')](_0x1ac96a)&&!_[_0xaf6a('0xad')](_0x4f1a82,_0x1ac96a)){if(_[_0xaf6a('0x2d')](this[_0xaf6a('0x15')][_0x3b4095])){this[_0xaf6a('0x15')][_0x3b4095]={};}this[_0xaf6a('0x15')][_0x3b4095][_0x1ac96a]=_0x71ab1;}};VoiceQueueReport[_0xaf6a('0xb')][_0xaf6a('0xae')]=function(_0x17973d){try{if(this[_0xaf6a('0x5f')](_0x17973d)){if(this[_0xaf6a('0xf')][_0x17973d['uniqueid']]){for(var _0x53f6b1=0x0,_0x58b26f={};_0x53f6b10x0?_0x4ca175:0x0;this[_0x3512('0x13')][_0x38a3a7[_0x3512('0x5d')]][_0x3512('0x2e')]=this['voiceQueues'][_0x38a3a7[_0x3512('0x5d')]][_0x3512('0x2e')]>_[_0x3512('0x5f')](_0x38a3a7['loggedin'])?_[_0x3512('0x5f')](_0x38a3a7[_0x3512('0x61')]):this[_0x3512('0x13')][_0x38a3a7[_0x3512('0x5d')]][_0x3512('0x2e')];this[_0x3512('0x44')](this['voiceQueues'][_0x38a3a7['queue']]);}ami[_0x3512('0x3d')](_0x3512('0x63'),this[_0x3512('0x13')][_0x38a3a7[_0x3512('0x5d')]]);}}}catch(_0x5ee759){logger[_0x3512('0x38')](_0x3512('0x64'),util[_0x3512('0x65')](_0x5ee759,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3512('0xb')]['syncQueueSummaryComplete']=function(_0x2f75f2){this[_0x3512('0x5a')]=!![];};VoiceQueueReport[_0x3512('0xb')]['syncNewExten']=function(_0x5db312){};VoiceQueueReport[_0x3512('0xb')][_0x3512('0x19')]=function(_0x46e073){try{if(this['isNotNull'](_0x46e073)){if(_[_0x3512('0x54')](this['queueReports'][_0x46e073[_0x3512('0x66')]])){this[_0x3512('0xf')][_0x46e073[_0x3512('0x66')]]=[];this['channels'][_0x46e073[_0x3512('0x66')]]={};}var _0xa285b9=new QueueReport();_0xa285b9['name']=_0x46e073[_0x3512('0x5d')];_0xa285b9[_0x3512('0x45')]=this[_0x3512('0x13')][_0xa285b9[_0x3512('0x41')]]&&this[_0x3512('0x13')][_0xa285b9['name']][_0x3512('0x45')]?this[_0x3512('0x13')][_0xa285b9[_0x3512('0x41')]][_0x3512('0x45')]||_0x3512('0x46'):_0x3512('0x46');_0xa285b9[_0x3512('0x5d')]=_0x46e073['queue'];_0xa285b9[_0x3512('0x67')]=moment()[_0x3512('0x3f')](_0x3512('0x68'));_0xa285b9['position']=_0x46e073[_0x3512('0x69')];_0xa285b9[_0x3512('0x6a')]=_0x46e073[_0x3512('0x6a')];_[_0x3512('0x6b')](_0xa285b9,_['pick'](_0x46e073,_[_0x3512('0x6c')](_0xa285b9)));this[_0x3512('0xf')][_0x46e073[_0x3512('0x66')]][_0x3512('0x6d')](_0xa285b9);this[_0x3512('0x11')][_0x46e073[_0x3512('0x66')]]=_0xa285b9;this['emitVoiceQueueChannelSave'](_0xa285b9);}}catch(_0x1db831){logger[_0x3512('0x38')](_0x3512('0x6e'),util[_0x3512('0x65')](_0x1db831,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3512('0xb')][_0x3512('0x1a')]=function(_0x495975){try{if(this[_0x3512('0x5c')](_0x495975)){if(this['queueReports'][_0x495975[_0x3512('0x66')]]){var _0x19aa6f=_[_0x3512('0x6f')](this['queueReports'][_0x495975[_0x3512('0x66')]]);_0x19aa6f[_0x3512('0x70')]=![];_0x19aa6f[_0x3512('0x71')]=null;_0x19aa6f[_0x3512('0x72')]=_0x495975[_0x3512('0x72')];_0x19aa6f[_0x3512('0x73')]=_0x495975[_0x3512('0x73')];_0x19aa6f['queuecallerabandon']=!![];_0x19aa6f[_0x3512('0x74')]=moment()[_0x3512('0x3f')](_0x3512('0x68'));_0x19aa6f['queuecallerexitreason']='ABANDONED';_0x19aa6f[_0x3512('0x75')]=null;this['channels'][_0x495975[_0x3512('0x66')]]=_0x19aa6f;this[_0x3512('0x3c')](_0x19aa6f);}}}catch(_0x5a86e3){logger[_0x3512('0x38')](_0x3512('0x76'),util[_0x3512('0x65')](_0x5a86e3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3512('0xb')][_0x3512('0x1c')]=function(_0x2e594d){try{if(this[_0x3512('0x5c')](_0x2e594d)){if(this[_0x3512('0xf')][_0x2e594d[_0x3512('0x66')]]){var _0x56d2d6=_['last'](this[_0x3512('0xf')][_0x2e594d[_0x3512('0x66')]]);_0x56d2d6[_0x3512('0x77')]=moment()[_0x3512('0x3f')](_0x3512('0x68'));_0x56d2d6[_0x3512('0x78')]=_0x2e594d[_0x3512('0x78')];_0x56d2d6[_0x3512('0x79')]=_0x2e594d[_0x3512('0x79')];this[_0x3512('0x11')][_0x2e594d[_0x3512('0x66')]]=_0x56d2d6;this[_0x3512('0x3e')](_0x56d2d6);}}}catch(_0x1bf895){logger[_0x3512('0x38')](_0x3512('0x7a'),util[_0x3512('0x65')](_0x1bf895,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3512('0xb')][_0x3512('0x1f')]=function(_0x3ebd5a){try{if(this['isNotNull'](_0x3ebd5a)){if(this[_0x3512('0xf')][_0x3ebd5a['uniqueid']]){var _0x4d60d4=_[_0x3512('0x6f')](this[_0x3512('0xf')][_0x3ebd5a['uniqueid']]);_0x4d60d4['queuecallercomplete']=!![];_0x4d60d4[_0x3512('0x7b')]='COMPLETEDBYAGENT';}}}catch(_0x4c85b7){logger[_0x3512('0x38')](_0x3512('0x7c'),util[_0x3512('0x65')](_0x4c85b7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3512('0xb')][_0x3512('0x1e')]=function(_0x128b7e){try{if(this[_0x3512('0x5c')](_0x128b7e)){if(this[_0x3512('0xf')][_0x128b7e[_0x3512('0x66')]]){var _0x5d2239=_[_0x3512('0x6f')](this['queueReports'][_0x128b7e['uniqueid']]);_0x5d2239[_0x3512('0x7d')]=![];_0x5d2239[_0x3512('0x74')]=null;_0x5d2239['assigned']=!![];_0x5d2239['lastAssignedTo']=_0x128b7e['membername'];_0x5d2239[_0x3512('0x72')]=_0x128b7e[_0x3512('0x72')];_0x5d2239[_0x3512('0x70')]=!![];_0x5d2239[_0x3512('0x7e')]=![];_0x5d2239[_0x3512('0x7f')]=null;if(!_0x5d2239[_0x3512('0x80')]){if(_0x128b7e[_0x3512('0x81')]=='transfer'){_0x5d2239[_0x3512('0x7b')]='COMPLETED';}else{if(_[_0x3512('0x82')](_0x128b7e[_0x3512('0x35')][_0x3512('0x83')](),_0x3512('0x84'))){if(this[_0x3512('0xf')][_0x128b7e['linkedid']]){var _0x1072aa=_[_0x3512('0x6f')](this[_0x3512('0xf')][_0x128b7e['linkedid']]);_0x1072aa[_0x3512('0x70')]=![];_0x1072aa[_0x3512('0x7e')]=!![];_0x1072aa['queuecallerexitAt']=moment(_0x5d2239[_0x3512('0x67')])[_0x3512('0x85')](_0x128b7e['holdtime'],_0x3512('0x86'))[_0x3512('0x3f')](_0x3512('0x68'));_0x1072aa['queuecallerexitreason']=_0x3512('0x87');_0x1072aa[_0x3512('0x80')]=!![];_0x1072aa[_0x3512('0x88')]=_0x3512('0x89');_0x1072aa['transferexten']=_0x128b7e[_0x3512('0x8a')];_0x1072aa[_0x3512('0x8b')]=_0x128b7e[_0x3512('0x66')];var _0xa07d93=this[_0x3512('0xf')][_0x128b7e[_0x3512('0x8c')]];this[_0x3512('0xf')][_0x128b7e[_0x3512('0x8c')]]=this['queueReports'][_0x128b7e['uniqueid']];this['queueReports'][_0x128b7e[_0x3512('0x66')]]=_0xa07d93;}}else{_0x5d2239[_0x3512('0x7b')]=_0x3512('0x8d')+_0x128b7e[_0x3512('0x81')]['toUpperCase']();}}}this[_0x3512('0x11')][_0x128b7e[_0x3512('0x66')]]=_0x5d2239;this[_0x3512('0x3c')](_0x5d2239);}}}catch(_0x1fe790){logger[_0x3512('0x38')]('[syncAgentComplete][VoiceQueueReport]',util[_0x3512('0x65')](_0x1fe790,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3512('0xb')][_0x3512('0x21')]=function(_0x4af6e7){try{if(this[_0x3512('0x5c')](_0x4af6e7)){this['addVariable'](_0x4af6e7[_0x3512('0x66')],_['keys'](_0x4af6e7[_0x3512('0x8e')])[0x0],_0x4af6e7[_0x3512('0x8f')]);if(this['queueReports'][_0x4af6e7[_0x3512('0x66')]]){var _0x11dcdc=_['last'](this[_0x3512('0xf')][_0x4af6e7['uniqueid']]);if(_0x11dcdc){if(this['isNotNull'](_0x4af6e7['variable'])&&this['isNotNull'](_0x4af6e7[_0x3512('0x8e')]['queuestatus'])){switch(_0x4af6e7[_0x3512('0x8f')]){case _0x3512('0x90'):_0x11dcdc[_0x3512('0x7e')]=![];_0x11dcdc[_0x3512('0x7f')]=null;break;case'TIMEOUT':_0x11dcdc[_0x3512('0x91')]=_0x3512('0x92');ami[_0x3512('0x3d')]('custom:timeout',_0x11dcdc);break;default:_0x11dcdc['queuecallerexit']=!![];_0x11dcdc[_0x3512('0x7f')]=moment()['format'](_0x3512('0x68'));_0x11dcdc[_0x3512('0x77')]=moment()['format'](_0x3512('0x68'));}_0x11dcdc[_0x3512('0x7d')]=![];_0x11dcdc['queuecallerabandonAt']=null;_0x11dcdc[_0x3512('0x7b')]=_0x4af6e7['value'];this[_0x3512('0x11')][_0x4af6e7[_0x3512('0x66')]]=_0x11dcdc;this[_0x3512('0x3c')](_0x11dcdc);}else if(this[_0x3512('0x5c')](_0x4af6e7[_0x3512('0x8e')])&&this[_0x3512('0x5c')](_0x4af6e7[_0x3512('0x8e')][_0x3512('0x93')])){if(!_0x11dcdc[_0x3512('0x7d')]){_0x11dcdc[_0x3512('0x7e')]=!![];_0x11dcdc[_0x3512('0x7f')]=moment()[_0x3512('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');_0x11dcdc[_0x3512('0x7b')]=_0x3512('0x94');_0x11dcdc[_0x3512('0x77')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x3512('0x11')][_0x4af6e7[_0x3512('0x66')]]=_0x11dcdc;}}_0x11dcdc[_0x3512('0x3a')]=this[_0x3512('0x3a')][_0x4af6e7[_0x3512('0x66')]];}}}}catch(_0x398ceb){logger[_0x3512('0x38')](_0x3512('0x95'),util['inspect'](_0x398ceb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x3512('0xb')]['addVariable']=function(_0x24f5d1,_0x30ee5e,_0x27c076){var _0x23e349=[_0x3512('0x96'),'rtpaudioqosbridged',_0x3512('0x97'),_0x3512('0x98'),_0x3512('0x99'),_0x3512('0x9a'),_0x3512('0x9b'),_0x3512('0x9c'),_0x3512('0x9d'),'sipuri',_0x3512('0x9e'),_0x3512('0x9f'),_0x3512('0xa0'),_0x3512('0xa1'),_0x3512('0xa2'),'memberlastcall','membername',_0x3512('0xa3'),_0x3512('0xa4')];if(!_['isNil'](_0x30ee5e)&&!_['includes'](_0x23e349,_0x30ee5e)){if(_[_0x3512('0x54')](this[_0x3512('0x3a')][_0x24f5d1])){this['variables'][_0x24f5d1]={};}this[_0x3512('0x3a')][_0x24f5d1][_0x30ee5e]=_0x27c076;}};VoiceQueueReport[_0x3512('0xb')]['syncHangup']=function(_0x22dcc3){try{if(this[_0x3512('0x5c')](_0x22dcc3)){if(this[_0x3512('0xf')][_0x22dcc3[_0x3512('0x66')]]){for(var _0x1fa94e=0x0,_0x4fe06d={};_0x1fa94e=0x0?moment(_0x4c7409[_0x25d5('0x19')])[_0x25d5('0xe')](_0x4c7409[_0x25d5('0x18')],_0x25d5('0xf')):null,'data1':_0x25d5('0x1a'),'data2':_0x4c7409[_0x25d5('0x14')],'data3':_0x4c7409['exten'],'data4':_0x4c7409[_0x25d5('0x1b')]||null,'role':'agent','internal':_0x4c7409[_0x25d5('0x14')]?_[_0x25d5('0x15')](_0x4c7409[_0x25d5('0x14')]):undefined,'uniqueid':_0x4c7409[_0x25d5('0x16')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x1107=['diff','exten','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','CreateMemberReport','membername','endtime','starttime','seconds','dialstring','../client','voiceQueueReport','queuecallercompleteAt','Request','voice','lastAssignedTo','isNil','interface','format','TALKING','queuecallerleaveAt'];(function(_0x17f773,_0x3e3f55){var _0x16576d=function(_0x220150){while(--_0x220150){_0x17f773['push'](_0x17f773['shift']());}};_0x16576d(++_0x3e3f55);}(_0x1107,0x1b7));var _0x7110=function(_0xa741fa,_0x14b888){_0xa741fa=_0xa741fa-0x0;var _0xfa882c=_0x1107[_0xa741fa];return _0xfa882c;};'use strict';var moment=require('moment');var _=require('lodash');var util=require('util');var client=require(_0x7110('0x0'));exports[_0x7110('0x1')]=function(_0x342108){var _0x1fc19=_0x342108[_0x7110('0x2')]||_0x342108['queuecallerexitAt'];return client[_0x7110('0x3')]('CreateMemberReport',{'body':{'channel':_0x7110('0x4'),'membername':_0x342108[_0x7110('0x5')],'interface':_[_0x7110('0x6')](_0x342108[_0x7110('0x7')])?util[_0x7110('0x8')]('SIP/%s',_0x342108[_0x7110('0x5')]):_0x342108[_0x7110('0x7')],'type':_0x7110('0x9'),'enterAt':_0x342108[_0x7110('0xa')],'exitAt':_0x1fc19,'duration':moment(_0x1fc19)[_0x7110('0xb')](_0x342108['queuecallerleaveAt'],'seconds'),'data1':'inbound','data2':_0x342108['calleridnum'],'data3':_0x342108[_0x7110('0xc')],'data4':null,'data5':_0x342108[_0x7110('0xd')],'role':_0x7110('0xe'),'internal':_0x342108[_0x7110('0xf')]?_[_0x7110('0x10')](_0x342108['accountcode']):undefined,'uniqueid':_0x342108[_0x7110('0x11')]},'log':'CreateMemberReport'});};exports[_0x7110('0x12')]=function(_0x4244e4){return client[_0x7110('0x3')](_0x7110('0x13'),{'body':{'channel':_0x7110('0x4'),'membername':_0x4244e4[_0x7110('0x14')],'interface':_0x4244e4[_0x7110('0x7')],'type':_0x7110('0x9'),'enterAt':_0x4244e4['starttime'],'exitAt':_0x4244e4[_0x7110('0x15')],'duration':moment(_0x4244e4[_0x7110('0x15')])[_0x7110('0xb')](_0x4244e4[_0x7110('0x16')],_0x7110('0x17'))>=0x0?moment(_0x4244e4[_0x7110('0x15')])[_0x7110('0xb')](_0x4244e4[_0x7110('0x16')],_0x7110('0x17')):null,'data1':'outbound','data2':_0x4244e4[_0x7110('0xf')],'data3':_0x4244e4[_0x7110('0xc')],'data4':_0x4244e4[_0x7110('0x18')]||null,'role':'agent','internal':_0x4244e4[_0x7110('0xf')]?_[_0x7110('0x10')](_0x4244e4[_0x7110('0xf')]):undefined,'uniqueid':_0x4244e4[_0x7110('0x11')]},'log':_0x7110('0x13')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 17f0e2c..df2020f 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 _0x777d=['GetTemplate','name','getTemplates'];(function(_0x53c943,_0x25933b){var _0x14342d=function(_0x4d1c20){while(--_0x4d1c20){_0x53c943['push'](_0x53c943['shift']());}};_0x14342d(++_0x25933b);}(_0x777d,0xe9));var _0xd777=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x777d[_0x2a6809];return _0x11c371;};'use strict';var client=require('../client');exports[_0xd777('0x0')]=function(_0xe6b7d9){return function(_0x2b6eab){return client['Request'](_0xd777('0x1'),{'options':{'raw':!![],'attributes':['id',_0xd777('0x2'),'html']},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x6e6c=['getTemplates','Request','html','../client'];(function(_0x4a61fd,_0x144cf0){var _0xfa1b8f=function(_0x24fdf7){while(--_0x24fdf7){_0x4a61fd['push'](_0x4a61fd['shift']());}};_0xfa1b8f(++_0x144cf0);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xc6e6('0x0'));exports[_0xc6e6('0x1')]=function(_0x545f2c){return function(_0x370b21){return client[_0xc6e6('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id','name',_0xc6e6('0x3')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index cd4e03d..5b8795a 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 _0x03b6=['data1','data2','data3','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','operator','value','AnyConditions','field','Actions'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x03b6,0x1c0));var _0x603b=function(_0x20cad9,_0x24ab79){_0x20cad9=_0x20cad9-0x0;var _0x460ac2=_0x03b6[_0x20cad9];return _0x460ac2;};'use strict';var client=require(_0x603b('0x0'));exports[_0x603b('0x1')]=function(_0x1bd5e2){return function(_0x5855b5){return client[_0x603b('0x2')](_0x603b('0x3'),{'options':{'raw':![],'attributes':['id',_0x603b('0x4'),_0x603b('0x5'),_0x603b('0x6')],'include':[{'model':_0x603b('0x7'),'as':_0x603b('0x8'),'attributes':['id','field',_0x603b('0x9'),_0x603b('0xa')]},{'model':_0x603b('0x7'),'as':_0x603b('0xb'),'attributes':['id',_0x603b('0xc'),_0x603b('0x9'),'value']},{'model':'Action','as':_0x603b('0xd'),'attributes':['id','action',_0x603b('0xe'),_0x603b('0xf'),_0x603b('0x10'),_0x603b('0x11'),_0x603b('0x12'),_0x603b('0x13'),_0x603b('0x14')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xe9fe=['channel','operator','value','AnyConditions','Action','Actions','data1','data2','data3','data4','data5','data7','GetTrigger','../client','getTriggers'];(function(_0x324f31,_0x498d91){var _0x1e9dd8=function(_0x25c173){while(--_0x25c173){_0x324f31['push'](_0x324f31['shift']());}};_0x1e9dd8(++_0x498d91);}(_0xe9fe,0x1a2));var _0xee9f=function(_0x58c86a,_0x602654){_0x58c86a=_0x58c86a-0x0;var _0x2bb374=_0xe9fe[_0x58c86a];return _0x2bb374;};'use strict';var client=require(_0xee9f('0x0'));exports[_0xee9f('0x1')]=function(_0x503ebf){return function(_0x581dc7){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0xee9f('0x2'),'status'],'include':[{'model':'Condition','as':'AllConditions','attributes':['id','field',_0xee9f('0x3'),_0xee9f('0x4')]},{'model':'Condition','as':_0xee9f('0x5'),'attributes':['id','field',_0xee9f('0x3'),_0xee9f('0x4')]},{'model':_0xee9f('0x6'),'as':_0xee9f('0x7'),'attributes':['id','action',_0xee9f('0x8'),_0xee9f('0x9'),_0xee9f('0xa'),_0xee9f('0xb'),_0xee9f('0xc'),'data6',_0xee9f('0xd')]}]},'log':_0xee9f('0xe')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index bec14c5..862435c 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 _0xa2bc=['GetTrunk','Request'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xa2bc,0x1cb));var _0xca2b=function(_0x39a80f,_0x99ff6d){_0x39a80f=_0x39a80f-0x0;var _0x4d84aa=_0xa2bc[_0x39a80f];return _0x4d84aa;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x323036){return function(_0x1965b8){return client[_0xca2b('0x0')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry']},'log':_0xca2b('0x1')});};}; \ No newline at end of file +var _0x590a=['../client','Request','registry','GetTrunk'];(function(_0x4c8ced,_0x59a65d){var _0x31d98f=function(_0x5e3531){while(--_0x5e3531){_0x4c8ced['push'](_0x4c8ced['shift']());}};_0x31d98f(++_0x59a65d);}(_0x590a,0x1ac));var _0xa590=function(_0x595e2f,_0x434543){_0x595e2f=_0x595e2f-0x0;var _0x438770=_0x590a[_0x595e2f];return _0x438770;};'use strict';var client=require(_0xa590('0x0'));exports['getTrunks']=function(_0x5b0ebd){return function(_0x172f92){return client[_0xa590('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xa590('0x2')]},'log':_0xa590('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index b234e2f..62d9982 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 _0xd33b=['email','../client','getAgents','Request','GetUser','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','getTelephones','telephone','name','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser','agent'];(function(_0x579011,_0x36a795){var _0x3a2575=function(_0x32ef19){while(--_0x32ef19){_0x579011['push'](_0x579011['shift']());}};_0x3a2575(++_0x36a795);}(_0xd33b,0xb9));var _0xbd33=function(_0x4c3d98,_0x3c4693){_0x4c3d98=_0x4c3d98-0x0;var _0xeafdc7=_0xd33b[_0x4c3d98];return _0xeafdc7;};'use strict';var client=require(_0xbd33('0x0'));exports[_0xbd33('0x1')]=function(){return function(){return client[_0xbd33('0x2')](_0xbd33('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id','name','email',_0xbd33('0x4'),_0xbd33('0x5'),_0xbd33('0x6'),_0xbd33('0x7'),_0xbd33('0x8'),'lastPauseAt',_0xbd33('0x9'),_0xbd33('0xa'),'mobile','interface']},'log':_0xbd33('0x1')});};};exports[_0xbd33('0xb')]=function(){return function(){return client[_0xbd33('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':_0xbd33('0xc')},'attributes':['id',_0xbd33('0xd'),_0xbd33('0x4'),_0xbd33('0xe')]},'log':_0xbd33('0xb')});};};exports[_0xbd33('0xf')]=function(_0x2612bb,_0x1a856d,_0x221e4a){return client['Request'](_0xbd33('0x10'),{'body':{'type':_0x1a856d,'uniqueid':_0x221e4a},'options':{'where':{'id':_0x2612bb['id']}},'log':_0xbd33('0xf')});};exports[_0xbd33('0x11')]=function(_0x16ecbe){return client[_0xbd33('0x2')](_0xbd33('0x12'),{'body':{},'options':{'where':{'id':_0x16ecbe['id']}},'log':_0xbd33('0xf')});};exports[_0xbd33('0x13')]=function(_0x491521){return client['Request'](_0xbd33('0x14'),{'options':{'raw':![],'where':{'role':_0xbd33('0x15'),'id':_0x491521},'attributes':['id',_0xbd33('0xd'),_0xbd33('0x16'),_0xbd33('0x4'),_0xbd33('0x5'),'online',_0xbd33('0x7'),_0xbd33('0x8'),'lastPauseAt',_0xbd33('0x9'),'interface']},'log':_0xbd33('0x13')});}; \ No newline at end of file +var _0x06a5=['agent','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','phone','mobile','interface','name','internal','getTelephones','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','voicePause','getAgent','../client','getAgents','Request','GetUser'];(function(_0x11cb9e,_0x611ac4){var _0x4bfdbc=function(_0x4ff722){while(--_0x4ff722){_0x11cb9e['push'](_0x11cb9e['shift']());}};_0x4bfdbc(++_0x611ac4);}(_0x06a5,0x128));var _0x506a=function(_0x21f5ed,_0x30755f){_0x21f5ed=_0x21f5ed-0x0;var _0x4f68a2=_0x06a5[_0x21f5ed];return _0x4f68a2;};'use strict';var client=require(_0x506a('0x0'));exports[_0x506a('0x1')]=function(){return function(){return client[_0x506a('0x2')](_0x506a('0x3'),{'options':{'raw':![],'where':{'role':_0x506a('0x4')},'attributes':['id','name',_0x506a('0x5'),_0x506a('0x6'),_0x506a('0x7'),_0x506a('0x8'),_0x506a('0x9'),_0x506a('0xa'),_0x506a('0xb'),'voicePause',_0x506a('0xc'),_0x506a('0xd'),_0x506a('0xe')]},'log':'getAgents'});};};exports['getTelephones']=function(){return function(){return client[_0x506a('0x2')](_0x506a('0x3'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x506a('0xf'),_0x506a('0x6'),_0x506a('0x10')]},'log':_0x506a('0x11')});};};exports['savePause']=function(_0xb6ef1,_0x4eb53f,_0x345d95){return client['Request'](_0x506a('0x12'),{'body':{'type':_0x4eb53f,'uniqueid':_0x345d95},'options':{'where':{'id':_0xb6ef1['id']}},'log':_0x506a('0x13')});};exports[_0x506a('0x14')]=function(_0x79d7b1){return client[_0x506a('0x2')](_0x506a('0x15'),{'body':{},'options':{'where':{'id':_0x79d7b1['id']}},'log':'savePause'});};exports['getAgent']=function(_0x7bf29b){return client[_0x506a('0x2')](_0x506a('0x16'),{'options':{'raw':![],'where':{'role':_0x506a('0x4'),'id':_0x7bf29b},'attributes':['id',_0x506a('0xf'),'email','accountcode',_0x506a('0x7'),_0x506a('0x8'),'lastLoginAt','pauseType',_0x506a('0xb'),_0x506a('0x17'),_0x506a('0xe')]},'log':_0x506a('0x18')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index d90d7c3..9410807 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 _0x0d47=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x0d47,0x1b9));var _0x70d4=function(_0x1984ad,_0x1bee93){_0x1984ad=_0x1984ad-0x0;var _0x2df6f3=_0x0d47[_0x1984ad];return _0x2df6f3;};'use strict';var client=require('../client');exports['create']=function(_0x2a0ac3){return client[_0x70d4('0x0')](_0x70d4('0x1'),{'body':_0x2a0ac3,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x932265,_0x2302c3,_0x4e894d){return client['Request'](_0x70d4('0x2'),{'body':_0x932265,'options':{'where':{'uniqueid':_0x2302c3,'interface':_0x4e894d,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0xbc5e=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x191c44,_0x20a896){var _0x1086cd=function(_0x2e2cac){while(--_0x2e2cac){_0x191c44['push'](_0x191c44['shift']());}};_0x1086cd(++_0x20a896);}(_0xbc5e,0xda));var _0xebc5=function(_0x527acd,_0x32b758){_0x527acd=_0x527acd-0x0;var _0x2c990f=_0xbc5e[_0x527acd];return _0x2c990f;};'use strict';var client=require(_0xebc5('0x0'));exports[_0xebc5('0x1')]=function(_0x840ec2){return client[_0xebc5('0x2')](_0xebc5('0x3'),{'body':_0x840ec2,'log':_0xebc5('0x3')});};exports[_0xebc5('0x4')]=function(_0x4aeadd,_0xfdeee0,_0x37c47d){return client[_0xebc5('0x2')]('UpdateVoiceAgentReport',{'body':_0x4aeadd,'options':{'where':{'uniqueid':_0xfdeee0,'interface':_0x37c47d,'agentcomplete':!![]}},'log':_0xebc5('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index dc49522..fbf83bc 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 _0x885e=['endOf','YYYY-MM-DD\x20HH:mm:ss','disposition','util','../client','create','Request','merge','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','startOf','day','format'];(function(_0x585133,_0x2412a1){var _0x18254a=function(_0x4c8aaf){while(--_0x4c8aaf){_0x585133['push'](_0x585133['shift']());}};_0x18254a(++_0x2412a1);}(_0x885e,0xb7));var _0xe885=function(_0x313b6b,_0x5e6acb){_0x313b6b=_0x313b6b-0x0;var _0x57e417=_0x885e[_0x313b6b];return _0x57e417;};'use strict';var moment=require('moment');var util=require(_0xe885('0x0'));var _=require('lodash');var client=require(_0xe885('0x1'));exports[_0xe885('0x2')]=function(_0x2c068d){return client[_0xe885('0x3')]('CreateVoiceCallReport',{'body':_[_0xe885('0x4')](_0x2c068d,{'source':_0x2c068d[_0xe885('0x5')],'destinationcontext':_0x2c068d[_0xe885('0x6')],'callerid':_0x2c068d[_0xe885('0x7')],'amaflags':_0xe885('0x8')}),'log':_0xe885('0x9')});};exports[_0xe885('0xa')]=function(){return function(){return client[_0xe885('0x3')](_0xe885('0xb'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xe885('0xc')](_0xe885('0xd'))[_0xe885('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xe885('0xf')](_0xe885('0xd'))[_0xe885('0xe')](_0xe885('0x10'))]}},'attributes':['type',_0xe885('0x11'),'duration','billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0xedcb=['../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','startOf','format','endOf','day','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','GetVoiceCallReports','moment'];(function(_0x356525,_0x12d354){var _0x26f4c5=function(_0x58b2c7){while(--_0x58b2c7){_0x356525['push'](_0x356525['shift']());}};_0x26f4c5(++_0x12d354);}(_0xedcb,0xef));var _0xbedc=function(_0x351931,_0xe53e64){_0x351931=_0x351931-0x0;var _0x116876=_0xedcb[_0x351931];return _0x116876;};'use strict';var moment=require(_0xbedc('0x0'));var util=require('util');var _=require('lodash');var client=require(_0xbedc('0x1'));exports[_0xbedc('0x2')]=function(_0x1672cd){return client[_0xbedc('0x3')](_0xbedc('0x4'),{'body':_[_0xbedc('0x5')](_0x1672cd,{'source':_0x1672cd[_0xbedc('0x6')],'destinationcontext':_0x1672cd[_0xbedc('0x7')],'callerid':_0x1672cd[_0xbedc('0x8')],'amaflags':_0xbedc('0x9')}),'log':_0xbedc('0x4')});};exports[_0xbedc('0xa')]=function(){return function(){return client[_0xbedc('0x3')]('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xbedc('0xb')]('day')[_0xbedc('0xc')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xbedc('0xd')](_0xbedc('0xe'))[_0xbedc('0xc')](_0xbedc('0xf'))]}},'attributes':[_0xbedc('0x10'),_0xbedc('0x11'),_0xbedc('0x12'),'billableseconds']},'log':_0xbedc('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 135e359..fb00492 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 _0x5679=['Request','CreateVoiceDialReport','create'];(function(_0x1b318e,_0x22b004){var _0x3c88e7=function(_0xa18af0){while(--_0xa18af0){_0x1b318e['push'](_0x1b318e['shift']());}};_0x3c88e7(++_0x22b004);}(_0x5679,0x10a));var _0x9567=function(_0x5cdca1,_0x441b3c){_0x5cdca1=_0x5cdca1-0x0;var _0x3ddf51=_0x5679[_0x5cdca1];return _0x3ddf51;};'use strict';var client=require('../client');exports[_0x9567('0x0')]=function(_0x3b5f2f){return client[_0x9567('0x1')](_0x9567('0x2'),{'body':_0x3b5f2f,'log':_0x9567('0x2')});}; \ No newline at end of file +var _0xd00e=['CreateVoiceDialReport','Request'];(function(_0x101647,_0x260c9f){var _0x2662cd=function(_0x4f03f9){while(--_0x4f03f9){_0x101647['push'](_0x101647['shift']());}};_0x2662cd(++_0x260c9f);}(_0xd00e,0xd9));var _0xed00=function(_0x2e1af3,_0x2a077b){_0x2e1af3=_0x2e1af3-0x0;var _0x4150cd=_0xd00e[_0x2e1af3];return _0x4150cd;};'use strict';var client=require('../client');exports['create']=function(_0x3348f4){return client[_0xed00('0x0')](_0xed00('0x1'),{'body':_0x3348f4,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 162b806..6807d2c 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 _0x84a0=['GetVoiceExtension','recordingFormat','../client','getVoiceExtensions','Request'];(function(_0x353a82,_0x51d1d4){var _0x42f8f5=function(_0x565457){while(--_0x565457){_0x353a82['push'](_0x353a82['shift']());}};_0x42f8f5(++_0x51d1d4);}(_0x84a0,0x66));var _0x084a=function(_0x1a6156,_0x85c3c){_0x1a6156=_0x1a6156-0x0;var _0x480dda=_0x84a0[_0x1a6156];return _0x480dda;};'use strict';var client=require(_0x084a('0x0'));exports[_0x084a('0x1')]=function(){return function(){return client[_0x084a('0x2')](_0x084a('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0x084a('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x084a('0x1')});};}; \ No newline at end of file +var _0x174b=['exten','recordingFormat','getVoiceExtensions','../client','GetVoiceExtension'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x174b,0x19d));var _0xb174=function(_0x3240d6,_0x5a9c83){_0x3240d6=_0x3240d6-0x0;var _0x3294d6=_0x174b[_0x3240d6];return _0x3294d6;};'use strict';var client=require(_0xb174('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0xb174('0x1'),{'options':{'raw':!![],'attributes':['id',_0xb174('0x2'),_0xb174('0x3')],'where':{'VoiceExtensionId':null}},'log':_0xb174('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 63e131e..004c35d 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 _0x5a15=['acw','acwTimeout','autopause','monitor_format','type','dialActive','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name'];(function(_0x5887eb,_0x408513){var _0x274af7=function(_0x5339c2){while(--_0x5339c2){_0x5887eb['push'](_0x5887eb['shift']());}};_0x274af7(++_0x408513);}(_0x5a15,0x1f3));var _0x55a1=function(_0x572f3f,_0x4c4cd8){_0x572f3f=_0x572f3f-0x0;var _0xcc5d66=_0x5a15[_0x572f3f];return _0xcc5d66;};'use strict';var client=require(_0x55a1('0x0'));exports[_0x55a1('0x1')]=function(){return function(){return client[_0x55a1('0x2')](_0x55a1('0x3'),{'options':{'raw':![],'attributes':['id',_0x55a1('0x4'),_0x55a1('0x5'),_0x55a1('0x6'),_0x55a1('0x7'),_0x55a1('0x8'),_0x55a1('0x9'),_0x55a1('0xa'),'dialMethod','dialLimitChannel','dialLimitQueue',_0x55a1('0xb'),_0x55a1('0xc'),'dialPredictiveOptimizationPercentage',_0x55a1('0xd'),_0x55a1('0xe'),_0x55a1('0xf'),_0x55a1('0x10'),_0x55a1('0x11'),_0x55a1('0x12'),_0x55a1('0x13'),_0x55a1('0x14'),_0x55a1('0x15'),_0x55a1('0x16'),_0x55a1('0x17'),'dialNoAnswerMaxRetry',_0x55a1('0x18'),_0x55a1('0x19'),_0x55a1('0x1a'),_0x55a1('0x1b'),_0x55a1('0x1c'),_0x55a1('0x1d'),_0x55a1('0x1e'),'dialAMDInitialSilence',_0x55a1('0x1f'),'dialAMDAfterGreetingSilence',_0x55a1('0x20'),_0x55a1('0x21'),'dialAMDBetweenWordsSilence',_0x55a1('0x22'),'dialAMDSilenceThreshold',_0x55a1('0x23'),'timeout',_0x55a1('0x24'),_0x55a1('0x25'),'dialOrderByScheduledAt',_0x55a1('0x26'),_0x55a1('0x27'),_0x55a1('0x28'),_0x55a1('0x8'),'strategy',_0x55a1('0x29'),'dialCutDigit',_0x55a1('0x2a'),_0x55a1('0x2b'),_0x55a1('0x2c'),_0x55a1('0x2d'),_0x55a1('0x2e'),_0x55a1('0x2f'),_0x55a1('0x30'),_0x55a1('0x31'),_0x55a1('0x32'),_0x55a1('0x33'),_0x55a1('0x34'),_0x55a1('0x35'),_0x55a1('0x36')],'include':[{'model':_0x55a1('0x37'),'as':_0x55a1('0x37'),'attributes':['id',_0x55a1('0x4'),_0x55a1('0x38'),_0x55a1('0x39')]},{'model':_0x55a1('0x3a'),'as':_0x55a1('0x3b'),'attributes':['id',_0x55a1('0x4')]},{'model':_0x55a1('0x37'),'as':_0x55a1('0x3c'),'attributes':['id',_0x55a1('0x4'),_0x55a1('0x38'),_0x55a1('0x39')]},{'model':_0x55a1('0x3d'),'as':_0x55a1('0x3d'),'attributes':['id',_0x55a1('0x4')],'include':[{'model':_0x55a1('0x3d'),'as':_0x55a1('0x3e'),'attributes':['id',_0x55a1('0x4'),'interval']}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x3479=['dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialBusyMaxRetry','dialBusyRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDTotalAnalysisTime'];(function(_0x560486,_0x6857cf){var _0x5cae14=function(_0x34ad54){while(--_0x34ad54){_0x560486['push'](_0x560486['shift']());}};_0x5cae14(++_0x6857cf);}(_0x3479,0x18d));var _0x9347=function(_0x5941f8,_0x4aee3e){_0x5941f8=_0x5941f8-0x0;var _0xb94b96=_0x3479[_0x5941f8];return _0xb94b96;};'use strict';var client=require('../client');exports[_0x9347('0x0')]=function(){return function(){return client[_0x9347('0x1')](_0x9347('0x2'),{'options':{'raw':![],'attributes':['id',_0x9347('0x3'),'acw','acwTimeout',_0x9347('0x4'),_0x9347('0x5'),_0x9347('0x6'),_0x9347('0x7'),_0x9347('0x8'),_0x9347('0x9'),_0x9347('0xa'),_0x9347('0xb'),_0x9347('0xc'),_0x9347('0xd'),'dialPredictiveInterval',_0x9347('0xe'),_0x9347('0xf'),_0x9347('0x10'),_0x9347('0x11'),_0x9347('0x12'),_0x9347('0x13'),'dialCongestionMaxRetry','dialCongestionRetryFrequency',_0x9347('0x14'),_0x9347('0x15'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency',_0x9347('0x16'),_0x9347('0x17'),_0x9347('0x18'),'dialPrefix','dialCheckDuplicateType','dialAMDActive',_0x9347('0x19'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0x9347('0x1a'),_0x9347('0x1b'),_0x9347('0x1c'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x9347('0x1d'),'timeout',_0x9347('0x1e'),'dialRecallInQueue',_0x9347('0x1f'),'dialAgiAfterHangupAgent',_0x9347('0x20'),_0x9347('0x21'),'monitor_format','strategy',_0x9347('0x22'),_0x9347('0x23'),_0x9347('0x24'),_0x9347('0x25'),'dialDropMaxRetry',_0x9347('0x26'),_0x9347('0x27'),'dialAbandonedRetryFrequency',_0x9347('0x28'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x9347('0x29'),_0x9347('0x2a'),_0x9347('0x2b'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0x9347('0x2c'),'as':'Trunk','attributes':['id',_0x9347('0x3'),_0x9347('0x2d'),_0x9347('0x2e')]},{'model':_0x9347('0x2f'),'as':_0x9347('0x30'),'attributes':['id',_0x9347('0x3')]},{'model':_0x9347('0x2c'),'as':_0x9347('0x31'),'attributes':['id',_0x9347('0x3'),_0x9347('0x2d'),_0x9347('0x2e')]},{'model':_0x9347('0x32'),'as':_0x9347('0x32'),'attributes':['id',_0x9347('0x3')],'include':[{'model':_0x9347('0x32'),'as':_0x9347('0x33'),'attributes':['id',_0x9347('0x3'),_0x9347('0x34')]}]}]},'log':_0x9347('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 587b2d0..19a2685 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 _0x571e=['moment','lodash','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','startOf','YYYY-MM-DD\x20HH:mm:ss','day','format','uniqueid','queue','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports'];(function(_0x450d4e,_0xcacc3){var _0x300304=function(_0x49ab27){while(--_0x49ab27){_0x450d4e['push'](_0x450d4e['shift']());}};_0x300304(++_0xcacc3);}(_0x571e,0x1a4));var _0xe571=function(_0x47d31d,_0x5b7a02){_0x47d31d=_0x47d31d-0x0;var _0x1888bd=_0x571e[_0x47d31d];return _0x1888bd;};'use strict';var moment=require(_0xe571('0x0'));var _=require(_0xe571('0x1'));var client=require('../client');exports[_0xe571('0x2')]=function(_0x22204e){return client[_0xe571('0x3')](_0xe571('0x4'),{'body':_0x22204e,'log':_0xe571('0x4')});};exports[_0xe571('0x5')]=function(){return function(){return client[_0xe571('0x3')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0xe571('0x6')]('day')['format'](_0xe571('0x7')),moment()['endOf'](_0xe571('0x8'))[_0xe571('0x9')](_0xe571('0x7'))]}},'attributes':[_0xe571('0xa'),_0xe571('0xb'),'queuecallerjoinAt',_0xe571('0xc'),_0xe571('0xd'),_0xe571('0xe'),_0xe571('0xf'),_0xe571('0x10'),_0xe571('0x11'),_0xe571('0x12')]},'log':_0xe571('0x13')});};}; \ No newline at end of file +var _0x9352=['Request','CreateVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','../client','create'];(function(_0x10e627,_0x26b1a7){var _0x12153a=function(_0x54bb6b){while(--_0x54bb6b){_0x10e627['push'](_0x10e627['shift']());}};_0x12153a(++_0x26b1a7);}(_0x9352,0x1ca));var _0x2935=function(_0x57a58b,_0x5710cb){_0x57a58b=_0x57a58b-0x0;var _0x6679d7=_0x9352[_0x57a58b];return _0x6679d7;};'use strict';var moment=require(_0x2935('0x0'));var _=require(_0x2935('0x1'));var client=require(_0x2935('0x2'));exports[_0x2935('0x3')]=function(_0x21d8f9){return client[_0x2935('0x4')](_0x2935('0x5'),{'body':_0x21d8f9,'log':_0x2935('0x5')});};exports['getVoiceQueueReports']=function(){return function(){return client['Request']('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0x2935('0x6')](_0x2935('0x7'))[_0x2935('0x8')](_0x2935('0x9')),moment()[_0x2935('0xa')](_0x2935('0x7'))[_0x2935('0x8')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x2935('0xb'),_0x2935('0xc'),_0x2935('0xd'),_0x2935('0xe'),_0x2935('0xf'),_0x2935('0x10'),_0x2935('0x11'),_0x2935('0x12'),'queuecallerabandon',_0x2935('0x13')]},'log':_0x2935('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 54e3200..9fe4912 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 _0x7bd5=['getVoiceQueueRtPauses'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7bd5,0x72));var _0x57bd=function(_0x22c524,_0xe0a321){_0x22c524=_0x22c524-0x0;var _0x515e77=_0x7bd5[_0x22c524];return _0x515e77;};'use strict';var client=require('../client');exports[_0x57bd('0x0')]=function(_0x347b2c){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x347b2c,'paused':!![]},'raw':!![]},'log':_0x57bd('0x0')});};}; \ No newline at end of file +var _0x036f=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x441bc0,_0x5b8718){var _0x432cdc=function(_0x320d70){while(--_0x320d70){_0x441bc0['push'](_0x441bc0['shift']());}};_0x432cdc(++_0x5b8718);}(_0x036f,0x13c));var _0xf036=function(_0x5b174b,_0x404869){_0x5b174b=_0x5b174b-0x0;var _0x47ee37=_0x036f[_0x5b174b];return _0x47ee37;};'use strict';var client=require(_0xf036('0x0'));exports[_0xf036('0x1')]=function(_0x36a487){return function(){return client[_0xf036('0x2')](_0xf036('0x3'),{'options':{'where':{'VoiceQueueId':_0x36a487,'paused':!![]},'raw':!![]},'log':_0xf036('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index facd6ca..80667dd 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 _0xdb2c=['CreateVoiceRecording','monitorFilename','lodash','Request'];(function(_0x1a3488,_0x3874b0){var _0x8398da=function(_0x282b95){while(--_0x282b95){_0x1a3488['push'](_0x1a3488['shift']());}};_0x8398da(++_0x3874b0);}(_0xdb2c,0x1d6));var _0xcdb2=function(_0x54f863,_0x4094e5){_0x54f863=_0x54f863-0x0;var _0xbe0fc4=_0xdb2c[_0x54f863];return _0xbe0fc4;};'use strict';var _=require(_0xcdb2('0x0'));var client=require('../client');exports['create']=function(_0x2edb77){return client[_0xcdb2('0x1')](_0xcdb2('0x2'),{'body':_['merge'](_0x2edb77,{'value':_0x2edb77[_0xcdb2('0x3')]}),'log':_0xcdb2('0x2')});}; \ No newline at end of file +var _0xe2e0=['monitorFilename','lodash','Request','CreateVoiceRecording'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe2e0,0x121));var _0x0e2e=function(_0x35cf05,_0x801e3a){_0x35cf05=_0x35cf05-0x0;var _0x57ca7c=_0xe2e0[_0x35cf05];return _0x57ca7c;};'use strict';var _=require(_0x0e2e('0x0'));var client=require('../client');exports['create']=function(_0xc4243c){return client[_0x0e2e('0x1')](_0x0e2e('0x2'),{'body':_['merge'](_0xc4243c,{'value':_0xc4243c[_0x0e2e('0x3')]}),'log':_0x0e2e('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 77c8c87..1f4d296 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 _0xe4e3=['transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridname','transfererconnectedlinenum'];(function(_0x5b26cb,_0x527ab0){var _0x563d12=function(_0x472b38){while(--_0x472b38){_0x5b26cb['push'](_0x5b26cb['shift']());}};_0x563d12(++_0x527ab0);}(_0xe4e3,0x141));var _0x3e4e=function(_0x50788e,_0x3943a9){_0x50788e=_0x50788e-0x0;var _0x564f34=_0xe4e3[_0x50788e];return _0x564f34;};'use strict';var client=require(_0x3e4e('0x0'));exports[_0x3e4e('0x1')]=function(_0x37d639){return client[_0x3e4e('0x2')](_0x3e4e('0x3'),{'body':{'result':_0x37d639[_0x3e4e('0x4')],'transfererchannel':_0x37d639['transfererchannel'],'transferercalleridnum':_0x37d639['transferercalleridnum'],'transferercalleridname':_0x37d639[_0x3e4e('0x5')],'transfererconnectedlinenum':_0x37d639[_0x3e4e('0x6')],'transfererconnectedlinename':_0x37d639[_0x3e4e('0x7')],'transfereraccountcode':_0x37d639['transfereraccountcode'],'transferercontext':_0x37d639[_0x3e4e('0x8')],'transfererexten':_0x37d639[_0x3e4e('0x9')],'transfererlinkedid':_0x37d639[_0x3e4e('0xa')],'transfereechannel':_0x37d639[_0x3e4e('0xb')],'transfereecalleridnum':_0x37d639[_0x3e4e('0xc')],'transfereecalleridname':_0x37d639[_0x3e4e('0xd')],'transfereeconnectedlinenum':_0x37d639[_0x3e4e('0xe')],'transfereeconnectedlinename':_0x37d639[_0x3e4e('0xf')],'transfereeaccountcode':_0x37d639[_0x3e4e('0x10')],'transfereecontext':_0x37d639[_0x3e4e('0x11')],'transfereeexten':_0x37d639[_0x3e4e('0x12')],'transfereelinkedid':_0x37d639[_0x3e4e('0x13')],'isexternal':_0x37d639[_0x3e4e('0x14')],'context':_0x37d639[_0x3e4e('0x15')],'extension':_0x37d639['extension'],'type':_0x3e4e('0x16')},'log':'CreateVoiceTransferReport'});};exports[_0x3e4e('0x17')]=function(_0x3fc58e){return client[_0x3e4e('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x3fc58e[_0x3e4e('0x4')],'transfererchannel':_0x3fc58e[_0x3e4e('0x18')],'transferercalleridnum':_0x3fc58e[_0x3e4e('0x19')],'transferercalleridname':_0x3fc58e[_0x3e4e('0x1a')],'transfererconnectedlinenum':_0x3fc58e[_0x3e4e('0x1b')],'transfererconnectedlinename':_0x3fc58e[_0x3e4e('0x1c')],'transfereraccountcode':_0x3fc58e[_0x3e4e('0x1d')],'transferercontext':_0x3fc58e[_0x3e4e('0x1e')],'transfererexten':_0x3fc58e['secondtransfererexten'],'transfererlinkedid':_0x3fc58e[_0x3e4e('0x1f')],'transfereechannel':_0x3fc58e[_0x3e4e('0x20')],'transfereecalleridnum':_0x3fc58e[_0x3e4e('0x21')],'transfereecalleridname':_0x3fc58e[_0x3e4e('0x22')],'transfereeconnectedlinenum':_0x3fc58e[_0x3e4e('0x23')],'transfereeconnectedlinename':_0x3fc58e[_0x3e4e('0x24')],'transfereeaccountcode':_0x3fc58e[_0x3e4e('0x25')],'transfereecontext':_0x3fc58e[_0x3e4e('0x26')],'transfereeexten':_0x3fc58e[_0x3e4e('0x27')],'transfereelinkedid':_0x3fc58e['transfertargetlinkedid'],'isexternal':_0x3fc58e[_0x3e4e('0x14')],'context':_0x3fc58e[_0x3e4e('0x28')],'extension':_0x3fc58e['origtransfererexten'],'type':'attended'},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xd90f=['origtransferercontext','origtransfererexten','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridname','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetlinkedid'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0xd90f,0x13d));var _0xfd90=function(_0x5f00ea,_0x1f4a70){_0x5f00ea=_0x5f00ea-0x0;var _0x353dc1=_0xd90f[_0x5f00ea];return _0x353dc1;};'use strict';var client=require(_0xfd90('0x0'));exports[_0xfd90('0x1')]=function(_0x1908a6){return client[_0xfd90('0x2')](_0xfd90('0x3'),{'body':{'result':_0x1908a6[_0xfd90('0x4')],'transfererchannel':_0x1908a6['transfererchannel'],'transferercalleridnum':_0x1908a6['transferercalleridnum'],'transferercalleridname':_0x1908a6[_0xfd90('0x5')],'transfererconnectedlinenum':_0x1908a6['transfererconnectedlinenum'],'transfererconnectedlinename':_0x1908a6[_0xfd90('0x6')],'transfereraccountcode':_0x1908a6['transfereraccountcode'],'transferercontext':_0x1908a6[_0xfd90('0x7')],'transfererexten':_0x1908a6[_0xfd90('0x8')],'transfererlinkedid':_0x1908a6[_0xfd90('0x9')],'transfereechannel':_0x1908a6[_0xfd90('0xa')],'transfereecalleridnum':_0x1908a6[_0xfd90('0xb')],'transfereecalleridname':_0x1908a6['transfereecalleridname'],'transfereeconnectedlinenum':_0x1908a6['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x1908a6['transfereeconnectedlinename'],'transfereeaccountcode':_0x1908a6[_0xfd90('0xc')],'transfereecontext':_0x1908a6[_0xfd90('0xd')],'transfereeexten':_0x1908a6[_0xfd90('0xe')],'transfereelinkedid':_0x1908a6['transfereelinkedid'],'isexternal':_0x1908a6[_0xfd90('0xf')],'context':_0x1908a6[_0xfd90('0x10')],'extension':_0x1908a6[_0xfd90('0x11')],'type':_0xfd90('0x12')},'log':_0xfd90('0x3')});};exports[_0xfd90('0x13')]=function(_0x54bac3){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x54bac3[_0xfd90('0x4')],'transfererchannel':_0x54bac3[_0xfd90('0x14')],'transferercalleridnum':_0x54bac3[_0xfd90('0x15')],'transferercalleridname':_0x54bac3[_0xfd90('0x16')],'transfererconnectedlinenum':_0x54bac3[_0xfd90('0x17')],'transfererconnectedlinename':_0x54bac3[_0xfd90('0x18')],'transfereraccountcode':_0x54bac3[_0xfd90('0x19')],'transferercontext':_0x54bac3['secondtransferercontext'],'transfererexten':_0x54bac3[_0xfd90('0x1a')],'transfererlinkedid':_0x54bac3[_0xfd90('0x1b')],'transfereechannel':_0x54bac3[_0xfd90('0x1c')],'transfereecalleridnum':_0x54bac3['transfertargetcalleridnum'],'transfereecalleridname':_0x54bac3[_0xfd90('0x1d')],'transfereeconnectedlinenum':_0x54bac3[_0xfd90('0x1e')],'transfereeconnectedlinename':_0x54bac3['transfertargetconnectedlinename'],'transfereeaccountcode':_0x54bac3[_0xfd90('0x1f')],'transfereecontext':_0x54bac3['transfertargetcontext'],'transfereeexten':_0x54bac3['transfertargetexten'],'transfereelinkedid':_0x54bac3[_0xfd90('0x20')],'isexternal':_0x54bac3['isexternal'],'context':_0x54bac3[_0xfd90('0x21')],'extension':_0x54bac3[_0xfd90('0x22')],'type':'attended'},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 7f1f7ca..c5bdffb 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 _0xe90c=['dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','values','channels','voicechannel','length','find','uniqueid','channel','format','%s.%s','filename','wav','MixMonitor','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','catch','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','status','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','ami\x20disconnected','Hangup','voicequeuechannelredirect','Redirect','exten','context','trunks','outboundChannels','campaigns','emit','event','send','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','../../../config/environment','../properties','listen','%s/%s','SIP','timers','timer','updateAcw','agents','updateStatusRealtime','pause','isConnected','error','asterisk','username','join','pick','keys','module','Reload','Action','then','message','command','Command','content','hasOwnProperty','voiceQueues','name','answered','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xe90c,0xdb));var _0xce90=function(_0x4506a9,_0x18ab7b){_0x4506a9=_0x4506a9-0x0;var _0x4182cb=_0xe90c[_0x4506a9];return _0x4182cb;};'use strict';var _=require(_0xce90('0x0'));var util=require(_0xce90('0x1'));var jayson=require(_0xce90('0x2'));var schema=require(_0xce90('0x3'));var BPromise=require('bluebird');var moment=require('moment');var config=require(_0xce90('0x4'));var properties=require(_0xce90('0x5'));var ami=require('../ami');exports[_0xce90('0x6')]=function(_0x5f5680,_0xf706c6,_0x3c94ca){return new BPromise(function(_0x16792a,_0x19e052){var _0x4bcc59={'QueuePause':function(_0x37b9f7){return new Promise(function(_0x4e5adf,_0x4c0ba2){var _0xd473dc=util['format'](_0xce90('0x7'),_0xce90('0x8'),_0x37b9f7['name']);if(_0x5f5680[_0xce90('0x9')]&&_0x5f5680[_0xce90('0x9')][_0xd473dc]&&_0x5f5680[_0xce90('0x9')][_0xd473dc][_0xce90('0xa')]){_0x5f5680[_0xce90('0x9')][_0xd473dc][_0xce90('0xb')]();}if(_0x5f5680['agents'][_0xd473dc]){_0x5f5680[_0xce90('0xc')][_0xd473dc][_0xce90('0xd')]({'statePause':_0x37b9f7[_0xce90('0xe')]?!![]:![]});}_0x4e5adf({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x4eaa0b){var _0x3de812=this;return new Promise(function(_0x16ac7f,_0x1a089a){if(ami[_0xce90('0xf')]()==![]){return _0x1a089a(_0x3de812[_0xce90('0x10')](0x1f4,[config[_0xce90('0x11')]['ip'],config['asterisk'][_0xce90('0x12')],'ami\x20disconnected'][_0xce90('0x13')]('\x20')));}_0x4eaa0b=_[_0xce90('0x14')](_0x4eaa0b,_[_0xce90('0x15')](properties[_0xce90('0x16')]));_0x4eaa0b['action']=_0xce90('0x17');return ami[_0xce90('0x18')](_0x4eaa0b)[_0xce90('0x19')](function(_0x49d8b5){_0x16ac7f({'code':0xc8,'message':_0x49d8b5['message']});})['catch'](function(_0x499501){_0x1a089a(_0x3de812[_0xce90('0x10')](0x1f5,_0x499501[_0xce90('0x1a')]));});});},'Command':function(_0x2d8eeb){var _0x58bd23=this;return new Promise(function(_0x3b4b7f,_0x293adc){if(ami[_0xce90('0xf')]()==![]){return _0x293adc(_0x58bd23[_0xce90('0x10')](0x1f4,[config[_0xce90('0x11')]['ip'],config[_0xce90('0x11')][_0xce90('0x12')],'ami\x20disconnected'][_0xce90('0x13')]('\x20')));}_0x2d8eeb=_[_0xce90('0x14')](_0x2d8eeb,_0xce90('0x1b'));_0x2d8eeb['action']=_0xce90('0x1c');return ami[_0xce90('0x18')](_0x2d8eeb)[_0xce90('0x19')](function(_0x20840b){_0x3b4b7f({'code':0xc8,'message':_0x20840b[_0xce90('0x1d')]});})['catch'](function(_0x3b70f3){_0x293adc(_0x58bd23[_0xce90('0x10')](0x1f5,_0x3b70f3[_0xce90('0x1a')]));});});},'VoiceQueues':function(_0x2f59c8){return new Promise(function(_0x304b5f,_0x11e3c4){var _0x2ae18a=[];for(var _0x1b40fd in _0x5f5680['voiceQueues']){if(_0x5f5680['voiceQueues'][_0xce90('0x1e')](_0x1b40fd)){var _0x1659a0=_0x5f5680[_0xce90('0x1f')][_0x1b40fd];var _0x2ecf36={'id':_0x1659a0['id'],'name':_0x1659a0[_0xce90('0x20')],'strategy':_0x1659a0['strategy'],'answered':_0x1659a0[_0xce90('0x21')],'available':_0x1659a0['available'],'loggedIn':_0x1659a0['loggedIn'],'pTalking':_0x1659a0['pTalking'],'sumBillable':_0x1659a0[_0xce90('0x22')],'sumDuration':_0x1659a0[_0xce90('0x23')],'sumHoldTime':_0x1659a0[_0xce90('0x24')]||0x0,'talking':_0x1659a0['talking'],'total':_0x1659a0[_0xce90('0x25')],'type':_0x1659a0[_0xce90('0x26')],'unmanaged':_0x1659a0[_0xce90('0x27')],'abandoned':_0x1659a0[_0xce90('0x28')],'waiting':_0x1659a0[_0xce90('0x29')],'loggedInDb':_0x1659a0[_0xce90('0x2a')]};if(_0x1659a0[_0xce90('0x26')]===_0xce90('0x2b')){_0x2ecf36[_0xce90('0x2c')]=_0x1659a0[_0xce90('0x2c')];_0x2ecf36[_0xce90('0x2d')]=_0x1659a0[_0xce90('0x2d')];_0x2ecf36[_0xce90('0x2e')]=_0x1659a0[_0xce90('0x2e')];_0x2ecf36[_0xce90('0x2f')]=_0x1659a0['dialOriginateCallerIdNumber'];_0x2ecf36[_0xce90('0x30')]=_0x1659a0['dialOriginateTimeout'];_0x2ecf36[_0xce90('0x31')]=_0x1659a0[_0xce90('0x31')];_0x2ecf36[_0xce90('0x32')]=_0x1659a0['outboundAnswerAgiCallsDay'];_0x2ecf36[_0xce90('0x33')]=_0x1659a0['outboundAnswerCallsDay'];_0x2ecf36['outboundBlacklistCallsDay']=_0x1659a0[_0xce90('0x34')];_0x2ecf36['outboundBusyCallsDay']=_0x1659a0[_0xce90('0x35')];_0x2ecf36[_0xce90('0x36')]=_0x1659a0['outboundCongestionCallsDay'];_0x2ecf36[_0xce90('0x37')]=_0x1659a0[_0xce90('0x37')];_0x2ecf36[_0xce90('0x38')]=_0x1659a0[_0xce90('0x38')];_0x2ecf36['outboundDropCallsDayTimeout']=_0x1659a0['outboundDropCallsDayTimeout'];_0x2ecf36[_0xce90('0x39')]=_0x1659a0[_0xce90('0x39')];_0x2ecf36[_0xce90('0x3a')]=_0x1659a0[_0xce90('0x3a')];_0x2ecf36[_0xce90('0x3b')]=_0x1659a0[_0xce90('0x3b')];_0x2ecf36['outboundReCallsDay']=_0x1659a0['outboundReCallsDay'];_0x2ecf36['outboundRejectCallsDay']=_0x1659a0[_0xce90('0x3c')];_0x2ecf36[_0xce90('0x3d')]=_0x1659a0[_0xce90('0x3d')];_0x2ecf36['predictiveIntervalAnsweredCalls']=_0x1659a0[_0xce90('0x3e')];_0x2ecf36[_0xce90('0x3f')]=_0x1659a0[_0xce90('0x3f')];_0x2ecf36[_0xce90('0x40')]=_0x1659a0[_0xce90('0x40')];_0x2ecf36[_0xce90('0x41')]=_0x1659a0['predictiveIntervalDroppedCallsCallersExit'];_0x2ecf36['predictiveIntervalDroppedCallsTimeout']=_0x1659a0[_0xce90('0x42')];_0x2ecf36[_0xce90('0x43')]=_0x1659a0['predictiveIntervalErlangCalls'];_0x2ecf36['predictiveIntervalErlangCallsDroppedCalls']=_0x1659a0[_0xce90('0x44')];_0x2ecf36[_0xce90('0x45')]=_0x1659a0[_0xce90('0x45')];_0x2ecf36[_0xce90('0x46')]=_0x1659a0[_0xce90('0x46')];_0x2ecf36[_0xce90('0x47')]=_0x1659a0['predictiveIntervalPauses'];_0x2ecf36[_0xce90('0x48')]=_0x1659a0[_0xce90('0x48')];_0x2ecf36['predictiveIntervalTotalCalls']=_0x1659a0[_0xce90('0x49')];_0x2ecf36[_0xce90('0x1a')]=_0x1659a0[_0xce90('0x1a')];_0x2ecf36[_0xce90('0x4a')]=_0x1659a0[_0xce90('0x4a')];_0x2ecf36[_0xce90('0x4b')]=_0x1659a0['erlangCalls'];_0x2ecf36['erlangCallToSecond']=_0x1659a0[_0xce90('0x4c')];_0x2ecf36[_0xce90('0x4d')]=_0x1659a0[_0xce90('0x4d')];_0x2ecf36[_0xce90('0x4e')]=_0x1659a0['erlangBusyFactor'];_0x2ecf36['startPredictive']=_0x1659a0[_0xce90('0x4f')];_0x2ecf36[_0xce90('0x50')]=_0x1659a0[_0xce90('0x50')];}if(_0x1659a0[_0xce90('0x51')]){_0x2ecf36[_0xce90('0x51')]={'id':_0x1659a0[_0xce90('0x51')]['id'],'name':_0x1659a0[_0xce90('0x51')]['name'],'active':_0x1659a0[_0xce90('0x51')][_0xce90('0x52')],'callerid':_0x1659a0[_0xce90('0x51')][_0xce90('0x53')]};}if(_0x1659a0[_0xce90('0x54')]){_0x2ecf36[_0xce90('0x54')]={'id':_0x1659a0[_0xce90('0x54')]['id'],'name':_0x1659a0[_0xce90('0x54')]['name']};}_0x2ae18a[_0xce90('0x55')](_0x2ecf36);}}_0x304b5f({'count':_0x2ae18a['length'],'rows':_0x2ae18a});});},'VoiceChannels':function(_0x3d560a){return new Promise(function(_0x571b1c,_0x4cfe1f){var _0x47938e=_[_0xce90('0x56')](_0x5f5680[_0xce90('0x57')]);_0x571b1c({'count':_0x47938e['length'],'rows':_0x47938e});});},'VoiceChannelMixMonitor':function(_0x4fbd2f){var _0x12162c=this;return new Promise(function(_0x1f2715,_0x394e6d){if(ami[_0xce90('0xf')]()==![]){return _0x394e6d(_0x12162c[_0xce90('0x10')](0x1f4,[config[_0xce90('0x11')]['ip'],config[_0xce90('0x11')][_0xce90('0x12')],'ami\x20disconnected']['join']('\x20')));}var _0x4b48f8=schema(properties[_0xce90('0x58')])['validate'](_0x4fbd2f);if(_0x4b48f8[_0xce90('0x59')]>0x0){return _0x394e6d(_0x12162c[_0xce90('0x10')](0x1f4,_['map'](_0x4b48f8,_0xce90('0x1a'))[_0xce90('0x13')](',\x20')));}var _0x11c4f4=_[_0xce90('0x5a')](_0x5f5680[_0xce90('0x57')],{'uniqueid':_0x4fbd2f[_0xce90('0x5b')]});if(_0x11c4f4&&_0x11c4f4[_0xce90('0x5c')]){var _0xdd565b=util[_0xce90('0x5d')](_0xce90('0x5e'),_0x4fbd2f[_0xce90('0x5f')]||_0x4fbd2f[_0xce90('0x5b')],_0x4fbd2f[_0xce90('0x5d')]||_0xce90('0x60'));return ami[_0xce90('0x18')]({'action':_0xce90('0x61'),'channel':_0x11c4f4[_0xce90('0x5c')],'file':_0xdd565b,'options':'ai(mixmonitorid)'})[_0xce90('0x19')](function(_0xa93c56){var _0xc61fd1=_[_0xce90('0x5a')](_0x11c4f4[_0xce90('0x62')],{'filename':_0xce90('0x63')+_0xdd565b['toLowerCase']()});if(_[_0xce90('0x64')](_0xc61fd1)){_0x11c4f4[_0xce90('0x62')][_0xce90('0x55')]({'filename':_0xce90('0x63')+_0xdd565b[_0xce90('0x65')](),'createdAt':moment()['format'](_0xce90('0x66')),'mixmonitorid':_0xa93c56['mixmonitorid'],'status':_0xce90('0x67')});}else{_0xc61fd1[_0xce90('0x68')]=_0xa93c56['mixmonitorid'];_0xc61fd1['status']=_0xce90('0x67');}_0x1f2715({'code':0xc8,'message':[_0x4fbd2f[_0xce90('0x5b')],'MixMonitor\x20Success',_0xa93c56['mixmonitorid']]['join']('\x20'),'mixmonitorid':_0xa93c56[_0xce90('0x68')]});})[_0xce90('0x69')](function(_0x265c0e){_0x394e6d(_0x12162c[_0xce90('0x10')](0x1f5,[_0x4fbd2f[_0xce90('0x5b')],_0x265c0e['message'][_0xce90('0x65')]()][_0xce90('0x13')]('\x20')));});}else{return _0x394e6d(_0x12162c[_0xce90('0x10')](0x1f5,_0xce90('0x6a')));}});},'VoiceChannelStopMixMonitor':function(_0x1065df){var _0x492ab1=this;return new Promise(function(_0x363c3d,_0xc40224){if(ami[_0xce90('0xf')]()==![]){return _0xc40224(_0x492ab1[_0xce90('0x10')](0x1f4,[config[_0xce90('0x11')]['ip'],config[_0xce90('0x11')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x4f9526=schema(properties['voicechannel'])[_0xce90('0x3')](_0x1065df);if(_0x4f9526[_0xce90('0x59')]>0x0){return _0xc40224(_0x492ab1[_0xce90('0x10')](0x1f4,_[_0xce90('0x6b')](_0x4f9526,'message')[_0xce90('0x13')](',\x20')));}var _0x561a96=_['find'](_0x5f5680[_0xce90('0x57')],{'uniqueid':_0x1065df[_0xce90('0x5b')]});if(_0x561a96){return BPromise[_0xce90('0x6c')]()[_0xce90('0x19')](function(){if(_0x561a96[_0xce90('0x5c')]){return ami[_0xce90('0x18')]({'action':_0xce90('0x6d'),'channel':_0x561a96[_0xce90('0x5c')],'mixmonitorid':_0x1065df[_0xce90('0x68')]})[_0xce90('0x69')](function(_0x1dce01){});}})[_0xce90('0x19')](function(){if(_0x561a96[_0xce90('0x6e')]){return ami[_0xce90('0x18')]({'action':_0xce90('0x6d'),'channel':_0x561a96[_0xce90('0x6e')],'mixmonitorid':_0x1065df[_0xce90('0x68')]})[_0xce90('0x69')](function(_0x28d581){});}})[_0xce90('0x19')](function(_0x366e36){var _0x554902=_[_0xce90('0x5a')](_0x561a96[_0xce90('0x62')],{'mixmonitorid':_0x1065df['mixmonitorid']});if(_0x554902){_0x554902['status']='stop';}})[_0xce90('0x19')](function(){var _0x4d8a7b=util['format'](_0xce90('0x5e'),_0x1065df['filename']||_0x1065df[_0xce90('0x5b')],_0x1065df[_0xce90('0x5d')]||_0xce90('0x60'));var _0x1493b8=_['find'](_0x561a96[_0xce90('0x62')],{'filename':_0xce90('0x63')+_0x4d8a7b[_0xce90('0x65')]()});if(_0x1493b8){_0x1493b8[_0xce90('0x6f')]=_0xce90('0x70');}})[_0xce90('0x19')](function(){_0x363c3d({'code':0xc8,'message':[_0x1065df['uniqueid'],_0xce90('0x71')][_0xce90('0x13')]('\x20')});})[_0xce90('0x69')](function(_0x3d75ee){_0xc40224(_0x492ab1[_0xce90('0x10')](0x1f5,[_0x1065df[_0xce90('0x5b')],_0x3d75ee[_0xce90('0x1a')][_0xce90('0x65')]()]['join']('\x20')));});}else{return _0xc40224(_0x492ab1['error'](0x1f5,_0xce90('0x6a')));}});},'VoiceQueuesChannels':function(_0x4f044f){return new Promise(function(_0x524c6e,_0x260c40){var _0x4d850b=_['values'](_0x5f5680[_0xce90('0x72')]);_0x524c6e({'count':_0x4d850b[_0xce90('0x59')],'rows':_0x4d850b});});},'VoiceQueuesChannel':function(_0x51456d){var _0x498114=this;return new Promise(function(_0xb17a0d,_0x15a0e5){var _0x56cf33=schema(properties[_0xce90('0x73')])[_0xce90('0x3')](_0x51456d);if(_0x56cf33[_0xce90('0x59')]>0x0){return _0x15a0e5(_0x498114['error'](0x1f4,_[_0xce90('0x6b')](_0x56cf33,_0xce90('0x1a'))['join'](',\x20')));}var _0x205fde=_[_0xce90('0x5a')](_0x5f5680[_0xce90('0x72')],{'uniqueid':_0x51456d[_0xce90('0x5b')]});if(_0x205fde){_0xb17a0d(_0x205fde);}else{return _0x15a0e5(_0x498114[_0xce90('0x10')](0x1f5,_0xce90('0x6a')));}});},'VoiceQueuesChannelHangup':function(_0x1b142c){var _0x4e04eb=this;return new Promise(function(_0x2f6a21,_0x35bbdd){if(ami['isConnected']()==![]){return _0x35bbdd(_0x4e04eb[_0xce90('0x10')](0x1f4,[config[_0xce90('0x11')]['ip'],config['asterisk'][_0xce90('0x12')],_0xce90('0x74')][_0xce90('0x13')]('\x20')));}var _0x1e55d8=schema(properties['voicequeuechannelhangup'])[_0xce90('0x3')](_0x1b142c);if(_0x1e55d8[_0xce90('0x59')]>0x0){return _0x35bbdd(_0x4e04eb['error'](0x1f4,_[_0xce90('0x6b')](_0x1e55d8,'message')['join'](',\x20')));}var _0x4f9ae7=_[_0xce90('0x5a')](_0x5f5680[_0xce90('0x72')],{'uniqueid':_0x1b142c[_0xce90('0x5b')]});if(_0x4f9ae7&&_0x4f9ae7[_0xce90('0x5c')]){return ami[_0xce90('0x18')]({'action':_0xce90('0x75'),'channel':_0x4f9ae7['channel']})[_0xce90('0x19')](function(_0x10f8fc){_0x2f6a21({'code':0xc8,'message':[_0x1b142c[_0xce90('0x5b')],_0x10f8fc['message']['toLowerCase']()][_0xce90('0x13')]('\x20')});})[_0xce90('0x69')](function(_0x109a74){_0x35bbdd(_0x4e04eb[_0xce90('0x10')](0x1f5,[_0x1b142c[_0xce90('0x5b')],_0x109a74[_0xce90('0x1a')][_0xce90('0x65')]()][_0xce90('0x13')]('\x20')));});}else{return _0x35bbdd(_0x4e04eb[_0xce90('0x10')](0x1f5,_0xce90('0x6a')));}});},'VoiceQueuesChannelRedirect':function(_0xf6f8bf){var _0x409b10=this;return new Promise(function(_0x30f39f,_0x50c729){if(ami[_0xce90('0xf')]()==![]){return _0x50c729(_0x409b10[_0xce90('0x10')](0x1f4,[config[_0xce90('0x11')]['ip'],config[_0xce90('0x11')][_0xce90('0x12')],_0xce90('0x74')][_0xce90('0x13')]('\x20')));}var _0x53beef=schema(properties[_0xce90('0x76')])['validate'](_0xf6f8bf);if(_0x53beef[_0xce90('0x59')]>0x0){return _0x50c729(_0x409b10[_0xce90('0x10')](0x1f4,_[_0xce90('0x6b')](_0x53beef,_0xce90('0x1a'))[_0xce90('0x13')](',\x20')));}var _0x142b15=_[_0xce90('0x5a')](_0x5f5680[_0xce90('0x72')],{'uniqueid':_0xf6f8bf[_0xce90('0x5b')]});if(_0x142b15&&_0x142b15[_0xce90('0x5c')]){return ami[_0xce90('0x18')]({'action':_0xce90('0x77'),'channel':_0x142b15[_0xce90('0x5c')],'exten':_0xf6f8bf[_0xce90('0x78')],'context':_0xf6f8bf[_0xce90('0x79')]||_0x142b15[_0xce90('0x79')],'priority':0x1})['then'](function(_0x381447){_0x30f39f({'code':0xc8,'message':[_0xf6f8bf[_0xce90('0x5b')],_0x381447['message']['toLowerCase']()][_0xce90('0x13')]('\x20')});})[_0xce90('0x69')](function(_0x287791){_0x50c729(_0x409b10[_0xce90('0x10')](0x1f5,[_0xf6f8bf['uniqueid'],_0x287791['message'][_0xce90('0x65')]()][_0xce90('0x13')]('\x20')));});}else{return _0x50c729(_0x409b10['error'](0x1f5,_0xce90('0x6a')));}});},'Agents':function(_0x41a94a){return new Promise(function(_0x393e22,_0x5b1fd3){var _0x587ab2=_['values'](_0x5f5680[_0xce90('0xc')]);_0x393e22({'count':_0x587ab2['length'],'rows':_0x587ab2});});},'Telephones':function(_0x231e0b){return new Promise(function(_0x42bc62,_0x26ad60){var _0x7b7f08=_[_0xce90('0x56')](_0x5f5680['telephones']);_0x42bc62({'count':_0x7b7f08['length'],'rows':_0x7b7f08});});},'Trunks':function(_0x4df0bc){return new Promise(function(_0x5f35ee,_0x533443){var _0x15c226=_[_0xce90('0x56')](_0x5f5680[_0xce90('0x7a')]);_0x5f35ee({'count':_0x15c226[_0xce90('0x59')],'rows':_0x15c226});});},'OutboundChannels':function(_0x3ed609){return new Promise(function(_0x466e2e,_0x15d33d){var _0x51e6b7=_['values'](_0x5f5680[_0xce90('0x7b')]);_0x466e2e({'count':_0x51e6b7['length'],'rows':_0x51e6b7});});},'Outbound':function(_0x518d80){return new Promise(function(_0x569e3f,_0x32d39a){_0x569e3f(_0x5f5680[_0xce90('0x2b')]);});},'Campaigns':function(_0x13dc8c){return new Promise(function(_0x38b6d5,_0x235fde){var _0x3bd307=_[_0xce90('0x56')](_0x5f5680[_0xce90('0x7c')]);_0x38b6d5({'count':_0x3bd307[_0xce90('0x59')],'rows':_0x3bd307});});},'VoiceQueuesPreview':function(_0x10233e){var _0x5736a1=this;return new Promise(function(_0x4836dd,_0x2a95bc){_0xf706c6['run'](_0x10233e['id'])['then'](function(_0x1adc37){_0x4836dd({'code':0xc8,'message':_0x1adc37['message']});})[_0xce90('0x69')](function(_0xfe8c83){_0x2a95bc(_0x5736a1[_0xce90('0x10')](0x1f4,_0xfe8c83[_0xce90('0x1a')]));});});},'EventManager':function(_0x15ae5f){var _0x1965ef=this;return new Promise(function(_0x45207f,_0x3273f9){if(!_0x15ae5f['event']){return _0x3273f9(_0x1965ef[_0xce90('0x10')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xce90('0x7d')]('custom:'+_0x15ae5f[_0xce90('0x7e')],_0x15ae5f['message']);_0x45207f({'code':0xc8,'message':_0x15ae5f});});},'FaxAccounts':function(_0x3a096c){return new Promise(function(_0x165e7e,_0xec9545){var _0x20472b=_[_0xce90('0x56')](_0x5f5680['faxAccounts']);_0x165e7e({'count':_0x20472b[_0xce90('0x59')],'rows':_0x20472b});});},'SendFax':function(_0x2c7d62){var _0xd48e5a=this;return new Promise(function(_0x3e3f67,_0x444bda){_0x3c94ca[_0xce90('0x7f')](_0x2c7d62)[_0xce90('0x19')](function(_0x163838){_0x3e3f67({'code':0xc8,'message':_0x163838[_0xce90('0x1a')]});})[_0xce90('0x69')](function(_0xf16e4a){_0x444bda(_0xd48e5a[_0xce90('0x10')](0x1f4,_0xf16e4a[_0xce90('0x1a')]));});});},'CheckAfterSend':function(_0x82534a){var _0x13d2ef=this;return new Promise(function(_0xdb2e98,_0x9cb386){_0x3c94ca['checkAfterSend'](_0x82534a)['then'](function(_0x21466f){_0xdb2e98({'code':0xc8,'message':_0x21466f[_0xce90('0x1a')]});})[_0xce90('0x69')](function(_0x27f67e){_0x9cb386(_0x13d2ef['error'](0x1f4,_0x27f67e['message']));});});}};var _0x47ae6e=jayson[_0xce90('0x80')](_0x4bcc59)[_0xce90('0x81')]();_0x47ae6e['on']('error',function(_0x5b5c85){return _0x19e052(_0x5b5c85);});_0x47ae6e[_0xce90('0x6')](0x232a,_0xce90('0x82'),function(){console[_0xce90('0x83')](_0xce90('0x84'),0x232a);return _0x16792a(_0xce90('0x85')+0x232a);});});}; \ No newline at end of file +var _0xff8e=['available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','values','channels','voicechannel','validate','map','channel','filename','uniqueid','wav','MixMonitor','find','monitors','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','toLowerCase','Channel\x20doesn\x27t\x20exist','ami\x20disconnected','resolve','StopMixMonitor','destinationchannel','stop','%s.%s','StopMixMonitor\x20Success','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','trunks','outboundChannels','campaigns','run','event','emit','custom:','server','http','listen','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','moment','../../../config/environment','../ami','format','%s/%s','SIP','name','timers','timer','updateAcw','pause','QueuePause','asterisk','username','join','pick','keys','module','action','Reload','Action','then','message','error','isConnected','command','Command','content','catch','voiceQueues','hasOwnProperty','answered'];(function(_0xf7463f,_0x31f89d){var _0x5e57f2=function(_0x1a96c0){while(--_0x1a96c0){_0xf7463f['push'](_0xf7463f['shift']());}};_0x5e57f2(++_0x31f89d);}(_0xff8e,0x66));var _0xeff8=function(_0x446489,_0x4f6fc9){_0x446489=_0x446489-0x0;var _0x30a44e=_0xff8e[_0x446489];return _0x30a44e;};'use strict';var _=require(_0xeff8('0x0'));var util=require(_0xeff8('0x1'));var jayson=require(_0xeff8('0x2'));var schema=require('validate');var BPromise=require(_0xeff8('0x3'));var moment=require(_0xeff8('0x4'));var config=require(_0xeff8('0x5'));var properties=require('../properties');var ami=require(_0xeff8('0x6'));exports['listen']=function(_0x38353c,_0x116fee,_0x5e2ec4){return new BPromise(function(_0x12a2a8,_0x33302f){var _0xcb130b={'QueuePause':function(_0x3dcda0){return new Promise(function(_0x5bb69d,_0x52e287){var _0x58459d=util[_0xeff8('0x7')](_0xeff8('0x8'),_0xeff8('0x9'),_0x3dcda0[_0xeff8('0xa')]);if(_0x38353c[_0xeff8('0xb')]&&_0x38353c[_0xeff8('0xb')][_0x58459d]&&_0x38353c[_0xeff8('0xb')][_0x58459d][_0xeff8('0xc')]){_0x38353c[_0xeff8('0xb')][_0x58459d][_0xeff8('0xd')]();}if(_0x38353c['agents'][_0x58459d]){_0x38353c['agents'][_0x58459d]['updateStatusRealtime']({'statePause':_0x3dcda0[_0xeff8('0xe')]?!![]:![]});}_0x5bb69d({'code':0xc8,'message':_0xeff8('0xf')});});},'Reload':function(_0x44f02){var _0x243ce6=this;return new Promise(function(_0x3694fb,_0xa82b74){if(ami['isConnected']()==![]){return _0xa82b74(_0x243ce6['error'](0x1f4,[config[_0xeff8('0x10')]['ip'],config[_0xeff8('0x10')][_0xeff8('0x11')],'ami\x20disconnected'][_0xeff8('0x12')]('\x20')));}_0x44f02=_[_0xeff8('0x13')](_0x44f02,_[_0xeff8('0x14')](properties[_0xeff8('0x15')]));_0x44f02[_0xeff8('0x16')]=_0xeff8('0x17');return ami[_0xeff8('0x18')](_0x44f02)[_0xeff8('0x19')](function(_0x111788){_0x3694fb({'code':0xc8,'message':_0x111788[_0xeff8('0x1a')]});})['catch'](function(_0x186b4f){_0xa82b74(_0x243ce6[_0xeff8('0x1b')](0x1f5,_0x186b4f[_0xeff8('0x1a')]));});});},'Command':function(_0x14f324){var _0x18230e=this;return new Promise(function(_0x4d192b,_0x29c335){if(ami[_0xeff8('0x1c')]()==![]){return _0x29c335(_0x18230e[_0xeff8('0x1b')](0x1f4,[config[_0xeff8('0x10')]['ip'],config[_0xeff8('0x10')][_0xeff8('0x11')],'ami\x20disconnected']['join']('\x20')));}_0x14f324=_[_0xeff8('0x13')](_0x14f324,_0xeff8('0x1d'));_0x14f324[_0xeff8('0x16')]=_0xeff8('0x1e');return ami['Action'](_0x14f324)[_0xeff8('0x19')](function(_0x11012e){_0x4d192b({'code':0xc8,'message':_0x11012e[_0xeff8('0x1f')]});})[_0xeff8('0x20')](function(_0x59cd43){_0x29c335(_0x18230e['error'](0x1f5,_0x59cd43[_0xeff8('0x1a')]));});});},'VoiceQueues':function(_0xc7083){return new Promise(function(_0x5728af,_0x21d405){var _0x820b65=[];for(var _0xfd925d in _0x38353c['voiceQueues']){if(_0x38353c[_0xeff8('0x21')][_0xeff8('0x22')](_0xfd925d)){var _0x6bc8e4=_0x38353c[_0xeff8('0x21')][_0xfd925d];var _0x17a39c={'id':_0x6bc8e4['id'],'name':_0x6bc8e4[_0xeff8('0xa')],'strategy':_0x6bc8e4['strategy'],'answered':_0x6bc8e4[_0xeff8('0x23')],'available':_0x6bc8e4[_0xeff8('0x24')],'loggedIn':_0x6bc8e4[_0xeff8('0x25')],'pTalking':_0x6bc8e4[_0xeff8('0x26')],'sumBillable':_0x6bc8e4[_0xeff8('0x27')],'sumDuration':_0x6bc8e4[_0xeff8('0x28')],'sumHoldTime':_0x6bc8e4[_0xeff8('0x29')]||0x0,'talking':_0x6bc8e4[_0xeff8('0x2a')],'total':_0x6bc8e4[_0xeff8('0x2b')],'type':_0x6bc8e4[_0xeff8('0x2c')],'unmanaged':_0x6bc8e4[_0xeff8('0x2d')],'abandoned':_0x6bc8e4[_0xeff8('0x2e')],'waiting':_0x6bc8e4[_0xeff8('0x2f')],'loggedInDb':_0x6bc8e4['loggedInDb']};if(_0x6bc8e4[_0xeff8('0x2c')]===_0xeff8('0x30')){_0x17a39c[_0xeff8('0x31')]=_0x6bc8e4[_0xeff8('0x31')];_0x17a39c['dialMethod']=_0x6bc8e4[_0xeff8('0x32')];_0x17a39c['dialOriginateCallerIdName']=_0x6bc8e4[_0xeff8('0x33')];_0x17a39c[_0xeff8('0x34')]=_0x6bc8e4['dialOriginateCallerIdNumber'];_0x17a39c['dialOriginateTimeout']=_0x6bc8e4[_0xeff8('0x35')];_0x17a39c[_0xeff8('0x36')]=_0x6bc8e4['dialPrefix'];_0x17a39c[_0xeff8('0x37')]=_0x6bc8e4['outboundAnswerAgiCallsDay'];_0x17a39c[_0xeff8('0x38')]=_0x6bc8e4[_0xeff8('0x38')];_0x17a39c[_0xeff8('0x39')]=_0x6bc8e4[_0xeff8('0x39')];_0x17a39c[_0xeff8('0x3a')]=_0x6bc8e4['outboundBusyCallsDay'];_0x17a39c[_0xeff8('0x3b')]=_0x6bc8e4[_0xeff8('0x3b')];_0x17a39c[_0xeff8('0x3c')]=_0x6bc8e4[_0xeff8('0x3c')];_0x17a39c[_0xeff8('0x3d')]=_0x6bc8e4[_0xeff8('0x3d')];_0x17a39c[_0xeff8('0x3e')]=_0x6bc8e4[_0xeff8('0x3e')];_0x17a39c['outboundNoAnswerCallsDay']=_0x6bc8e4['outboundNoAnswerCallsDay'];_0x17a39c[_0xeff8('0x3f')]=_0x6bc8e4['outboundNoSuchCallsDay'];_0x17a39c[_0xeff8('0x40')]=_0x6bc8e4['outboundOriginateFailureCallsDay'];_0x17a39c[_0xeff8('0x41')]=_0x6bc8e4['outboundReCallsDay'];_0x17a39c['outboundRejectCallsDay']=_0x6bc8e4[_0xeff8('0x42')];_0x17a39c[_0xeff8('0x43')]=_0x6bc8e4[_0xeff8('0x43')];_0x17a39c[_0xeff8('0x44')]=_0x6bc8e4[_0xeff8('0x44')];_0x17a39c[_0xeff8('0x45')]=_0x6bc8e4[_0xeff8('0x45')];_0x17a39c[_0xeff8('0x46')]=_0x6bc8e4[_0xeff8('0x46')];_0x17a39c[_0xeff8('0x47')]=_0x6bc8e4['predictiveIntervalDroppedCallsCallersExit'];_0x17a39c[_0xeff8('0x48')]=_0x6bc8e4[_0xeff8('0x48')];_0x17a39c['predictiveIntervalErlangCalls']=_0x6bc8e4[_0xeff8('0x49')];_0x17a39c['predictiveIntervalErlangCallsDroppedCalls']=_0x6bc8e4['predictiveIntervalErlangCallsDroppedCalls'];_0x17a39c['predictiveIntervalHitRate']=_0x6bc8e4[_0xeff8('0x4a')];_0x17a39c[_0xeff8('0x4b')]=_0x6bc8e4[_0xeff8('0x4b')];_0x17a39c[_0xeff8('0x4c')]=_0x6bc8e4[_0xeff8('0x4c')];_0x17a39c['predictiveIntervalAvailable']=_0x6bc8e4[_0xeff8('0x4d')];_0x17a39c[_0xeff8('0x4e')]=_0x6bc8e4['predictiveIntervalTotalCalls'];_0x17a39c['message']=_0x6bc8e4[_0xeff8('0x1a')];_0x17a39c[_0xeff8('0x4f')]=_0x6bc8e4[_0xeff8('0x4f')];_0x17a39c[_0xeff8('0x50')]=_0x6bc8e4['erlangCalls'];_0x17a39c['erlangCallToSecond']=_0x6bc8e4['erlangCallToSecond'];_0x17a39c['erlangAbandonmentRate']=_0x6bc8e4[_0xeff8('0x51')];_0x17a39c['erlangBusyFactor']=_0x6bc8e4[_0xeff8('0x52')];_0x17a39c[_0xeff8('0x53')]=_0x6bc8e4[_0xeff8('0x53')];_0x17a39c['startProgressive']=_0x6bc8e4[_0xeff8('0x54')];}if(_0x6bc8e4[_0xeff8('0x55')]){_0x17a39c[_0xeff8('0x55')]={'id':_0x6bc8e4[_0xeff8('0x55')]['id'],'name':_0x6bc8e4[_0xeff8('0x55')]['name'],'active':_0x6bc8e4[_0xeff8('0x55')][_0xeff8('0x56')],'callerid':_0x6bc8e4[_0xeff8('0x55')][_0xeff8('0x57')]};}if(_0x6bc8e4['Interval']){_0x17a39c[_0xeff8('0x58')]={'id':_0x6bc8e4[_0xeff8('0x58')]['id'],'name':_0x6bc8e4['Interval'][_0xeff8('0xa')]};}_0x820b65[_0xeff8('0x59')](_0x17a39c);}}_0x5728af({'count':_0x820b65[_0xeff8('0x5a')],'rows':_0x820b65});});},'VoiceChannels':function(_0x253dc9){return new Promise(function(_0x2437b1,_0x4b6df7){var _0x52ab1b=_[_0xeff8('0x5b')](_0x38353c[_0xeff8('0x5c')]);_0x2437b1({'count':_0x52ab1b['length'],'rows':_0x52ab1b});});},'VoiceChannelMixMonitor':function(_0x4834c2){var _0x38bbb6=this;return new Promise(function(_0x3d13ee,_0x2a47c7){if(ami[_0xeff8('0x1c')]()==![]){return _0x2a47c7(_0x38bbb6[_0xeff8('0x1b')](0x1f4,[config[_0xeff8('0x10')]['ip'],config[_0xeff8('0x10')][_0xeff8('0x11')],'ami\x20disconnected'][_0xeff8('0x12')]('\x20')));}var _0x10a027=schema(properties[_0xeff8('0x5d')])[_0xeff8('0x5e')](_0x4834c2);if(_0x10a027[_0xeff8('0x5a')]>0x0){return _0x2a47c7(_0x38bbb6['error'](0x1f4,_[_0xeff8('0x5f')](_0x10a027,_0xeff8('0x1a'))['join'](',\x20')));}var _0xc84228=_['find'](_0x38353c[_0xeff8('0x5c')],{'uniqueid':_0x4834c2['uniqueid']});if(_0xc84228&&_0xc84228[_0xeff8('0x60')]){var _0x53b8e8=util[_0xeff8('0x7')]('%s.%s',_0x4834c2[_0xeff8('0x61')]||_0x4834c2[_0xeff8('0x62')],_0x4834c2['format']||_0xeff8('0x63'));return ami[_0xeff8('0x18')]({'action':_0xeff8('0x64'),'channel':_0xc84228[_0xeff8('0x60')],'file':_0x53b8e8,'options':'ai(mixmonitorid)'})[_0xeff8('0x19')](function(_0x3db3d6){var _0xf551dc=_[_0xeff8('0x65')](_0xc84228[_0xeff8('0x66')],{'filename':'/var/spool/asterisk/monitor/'+_0x53b8e8['toLowerCase']()});if(_[_0xeff8('0x67')](_0xf551dc)){_0xc84228[_0xeff8('0x66')][_0xeff8('0x59')]({'filename':'/var/spool/asterisk/monitor/'+_0x53b8e8['toLowerCase'](),'createdAt':moment()[_0xeff8('0x7')](_0xeff8('0x68')),'mixmonitorid':_0x3db3d6[_0xeff8('0x69')],'status':_0xeff8('0x6a')});}else{_0xf551dc[_0xeff8('0x69')]=_0x3db3d6['mixmonitorid'];_0xf551dc[_0xeff8('0x6b')]=_0xeff8('0x6a');}_0x3d13ee({'code':0xc8,'message':[_0x4834c2['uniqueid'],_0xeff8('0x6c'),_0x3db3d6['mixmonitorid']][_0xeff8('0x12')]('\x20'),'mixmonitorid':_0x3db3d6[_0xeff8('0x69')]});})[_0xeff8('0x20')](function(_0x31f63c){_0x2a47c7(_0x38bbb6[_0xeff8('0x1b')](0x1f5,[_0x4834c2[_0xeff8('0x62')],_0x31f63c['message'][_0xeff8('0x6d')]()][_0xeff8('0x12')]('\x20')));});}else{return _0x2a47c7(_0x38bbb6[_0xeff8('0x1b')](0x1f5,_0xeff8('0x6e')));}});},'VoiceChannelStopMixMonitor':function(_0x19d7ae){var _0x5182b5=this;return new Promise(function(_0x435756,_0x253beb){if(ami['isConnected']()==![]){return _0x253beb(_0x5182b5['error'](0x1f4,[config[_0xeff8('0x10')]['ip'],config[_0xeff8('0x10')][_0xeff8('0x11')],_0xeff8('0x6f')][_0xeff8('0x12')]('\x20')));}var _0x34ecfb=schema(properties[_0xeff8('0x5d')])[_0xeff8('0x5e')](_0x19d7ae);if(_0x34ecfb[_0xeff8('0x5a')]>0x0){return _0x253beb(_0x5182b5[_0xeff8('0x1b')](0x1f4,_[_0xeff8('0x5f')](_0x34ecfb,'message')['join'](',\x20')));}var _0x5ebd42=_[_0xeff8('0x65')](_0x38353c['channels'],{'uniqueid':_0x19d7ae[_0xeff8('0x62')]});if(_0x5ebd42){return BPromise[_0xeff8('0x70')]()[_0xeff8('0x19')](function(){if(_0x5ebd42['channel']){return ami[_0xeff8('0x18')]({'action':_0xeff8('0x71'),'channel':_0x5ebd42[_0xeff8('0x60')],'mixmonitorid':_0x19d7ae['mixmonitorid']})[_0xeff8('0x20')](function(_0x5a90f4){});}})[_0xeff8('0x19')](function(){if(_0x5ebd42[_0xeff8('0x72')]){return ami[_0xeff8('0x18')]({'action':_0xeff8('0x71'),'channel':_0x5ebd42[_0xeff8('0x72')],'mixmonitorid':_0x19d7ae[_0xeff8('0x69')]})['catch'](function(_0x1de898){});}})[_0xeff8('0x19')](function(_0x267c16){var _0x5d1cd2=_['find'](_0x5ebd42['monitors'],{'mixmonitorid':_0x19d7ae[_0xeff8('0x69')]});if(_0x5d1cd2){_0x5d1cd2[_0xeff8('0x6b')]=_0xeff8('0x73');}})[_0xeff8('0x19')](function(){var _0x4beffe=util[_0xeff8('0x7')](_0xeff8('0x74'),_0x19d7ae['filename']||_0x19d7ae[_0xeff8('0x62')],_0x19d7ae[_0xeff8('0x7')]||'wav');var _0x39cb83=_['find'](_0x5ebd42['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x4beffe[_0xeff8('0x6d')]()});if(_0x39cb83){_0x39cb83['status']=_0xeff8('0x73');}})['then'](function(){_0x435756({'code':0xc8,'message':[_0x19d7ae['uniqueid'],_0xeff8('0x75')]['join']('\x20')});})[_0xeff8('0x20')](function(_0x4b9ae2){_0x253beb(_0x5182b5[_0xeff8('0x1b')](0x1f5,[_0x19d7ae[_0xeff8('0x62')],_0x4b9ae2['message'][_0xeff8('0x6d')]()][_0xeff8('0x12')]('\x20')));});}else{return _0x253beb(_0x5182b5[_0xeff8('0x1b')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x2c5aa6){return new Promise(function(_0x1acf44,_0x229fbd){var _0x854121=_[_0xeff8('0x5b')](_0x38353c[_0xeff8('0x76')]);_0x1acf44({'count':_0x854121[_0xeff8('0x5a')],'rows':_0x854121});});},'VoiceQueuesChannel':function(_0x202d62){var _0x2fb582=this;return new Promise(function(_0x1a224d,_0x2902c9){var _0xfd3396=schema(properties['voicequeuechannel'])[_0xeff8('0x5e')](_0x202d62);if(_0xfd3396[_0xeff8('0x5a')]>0x0){return _0x2902c9(_0x2fb582[_0xeff8('0x1b')](0x1f4,_[_0xeff8('0x5f')](_0xfd3396,_0xeff8('0x1a'))[_0xeff8('0x12')](',\x20')));}var _0x244efe=_['find'](_0x38353c['queueChannels'],{'uniqueid':_0x202d62[_0xeff8('0x62')]});if(_0x244efe){_0x1a224d(_0x244efe);}else{return _0x2902c9(_0x2fb582[_0xeff8('0x1b')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x2eb570){var _0x8c4997=this;return new Promise(function(_0x414f61,_0x459c4b){if(ami[_0xeff8('0x1c')]()==![]){return _0x459c4b(_0x8c4997[_0xeff8('0x1b')](0x1f4,[config[_0xeff8('0x10')]['ip'],config[_0xeff8('0x10')][_0xeff8('0x11')],_0xeff8('0x6f')][_0xeff8('0x12')]('\x20')));}var _0x5883a1=schema(properties[_0xeff8('0x77')])[_0xeff8('0x5e')](_0x2eb570);if(_0x5883a1[_0xeff8('0x5a')]>0x0){return _0x459c4b(_0x8c4997['error'](0x1f4,_[_0xeff8('0x5f')](_0x5883a1,_0xeff8('0x1a'))[_0xeff8('0x12')](',\x20')));}var _0x42480a=_['find'](_0x38353c[_0xeff8('0x76')],{'uniqueid':_0x2eb570['uniqueid']});if(_0x42480a&&_0x42480a['channel']){return ami[_0xeff8('0x18')]({'action':_0xeff8('0x78'),'channel':_0x42480a['channel']})[_0xeff8('0x19')](function(_0x403092){_0x414f61({'code':0xc8,'message':[_0x2eb570[_0xeff8('0x62')],_0x403092[_0xeff8('0x1a')]['toLowerCase']()][_0xeff8('0x12')]('\x20')});})[_0xeff8('0x20')](function(_0x3e3ae7){_0x459c4b(_0x8c4997[_0xeff8('0x1b')](0x1f5,[_0x2eb570[_0xeff8('0x62')],_0x3e3ae7['message'][_0xeff8('0x6d')]()][_0xeff8('0x12')]('\x20')));});}else{return _0x459c4b(_0x8c4997['error'](0x1f5,_0xeff8('0x6e')));}});},'VoiceQueuesChannelRedirect':function(_0x3423b6){var _0x142dc9=this;return new Promise(function(_0xb5a1ce,_0x546509){if(ami[_0xeff8('0x1c')]()==![]){return _0x546509(_0x142dc9[_0xeff8('0x1b')](0x1f4,[config['asterisk']['ip'],config[_0xeff8('0x10')]['username'],_0xeff8('0x6f')][_0xeff8('0x12')]('\x20')));}var _0x1227ce=schema(properties[_0xeff8('0x79')])[_0xeff8('0x5e')](_0x3423b6);if(_0x1227ce[_0xeff8('0x5a')]>0x0){return _0x546509(_0x142dc9['error'](0x1f4,_[_0xeff8('0x5f')](_0x1227ce,_0xeff8('0x1a'))[_0xeff8('0x12')](',\x20')));}var _0x1e0103=_[_0xeff8('0x65')](_0x38353c[_0xeff8('0x76')],{'uniqueid':_0x3423b6[_0xeff8('0x62')]});if(_0x1e0103&&_0x1e0103['channel']){return ami[_0xeff8('0x18')]({'action':_0xeff8('0x7a'),'channel':_0x1e0103[_0xeff8('0x60')],'exten':_0x3423b6[_0xeff8('0x7b')],'context':_0x3423b6['context']||_0x1e0103[_0xeff8('0x7c')],'priority':0x1})[_0xeff8('0x19')](function(_0x49f6fa){_0xb5a1ce({'code':0xc8,'message':[_0x3423b6[_0xeff8('0x62')],_0x49f6fa[_0xeff8('0x1a')][_0xeff8('0x6d')]()][_0xeff8('0x12')]('\x20')});})[_0xeff8('0x20')](function(_0x3c3bdb){_0x546509(_0x142dc9[_0xeff8('0x1b')](0x1f5,[_0x3423b6['uniqueid'],_0x3c3bdb[_0xeff8('0x1a')]['toLowerCase']()][_0xeff8('0x12')]('\x20')));});}else{return _0x546509(_0x142dc9[_0xeff8('0x1b')](0x1f5,_0xeff8('0x6e')));}});},'Agents':function(_0x281fe6){return new Promise(function(_0x20d859,_0x4da4ca){var _0x42ddd5=_[_0xeff8('0x5b')](_0x38353c['agents']);_0x20d859({'count':_0x42ddd5[_0xeff8('0x5a')],'rows':_0x42ddd5});});},'Telephones':function(_0xa9e0de){return new Promise(function(_0x33a860,_0x530a8e){var _0x291f31=_[_0xeff8('0x5b')](_0x38353c['telephones']);_0x33a860({'count':_0x291f31['length'],'rows':_0x291f31});});},'Trunks':function(_0x280a41){return new Promise(function(_0x577997,_0x3be36f){var _0x651326=_[_0xeff8('0x5b')](_0x38353c[_0xeff8('0x7d')]);_0x577997({'count':_0x651326[_0xeff8('0x5a')],'rows':_0x651326});});},'OutboundChannels':function(_0x320790){return new Promise(function(_0x45f7b9,_0x755ef5){var _0x21e3a4=_['values'](_0x38353c[_0xeff8('0x7e')]);_0x45f7b9({'count':_0x21e3a4['length'],'rows':_0x21e3a4});});},'Outbound':function(_0x219836){return new Promise(function(_0x46f83d,_0x2514af){_0x46f83d(_0x38353c['outbound']);});},'Campaigns':function(_0x1ec481){return new Promise(function(_0x56f2b4,_0x25e8c3){var _0x179ad1=_[_0xeff8('0x5b')](_0x38353c[_0xeff8('0x7f')]);_0x56f2b4({'count':_0x179ad1[_0xeff8('0x5a')],'rows':_0x179ad1});});},'VoiceQueuesPreview':function(_0x47be93){var _0x59e728=this;return new Promise(function(_0x26f675,_0x4972fb){_0x116fee[_0xeff8('0x80')](_0x47be93['id'])[_0xeff8('0x19')](function(_0x637ef7){_0x26f675({'code':0xc8,'message':_0x637ef7[_0xeff8('0x1a')]});})[_0xeff8('0x20')](function(_0x2518b5){_0x4972fb(_0x59e728[_0xeff8('0x1b')](0x1f4,_0x2518b5[_0xeff8('0x1a')]));});});},'EventManager':function(_0xb72ce){var _0x306ea9=this;return new Promise(function(_0x218e1f,_0x56fd61){if(!_0xb72ce[_0xeff8('0x81')]){return _0x56fd61(_0x306ea9[_0xeff8('0x1b')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xeff8('0x82')](_0xeff8('0x83')+_0xb72ce[_0xeff8('0x81')],_0xb72ce[_0xeff8('0x1a')]);_0x218e1f({'code':0xc8,'message':_0xb72ce});});},'FaxAccounts':function(_0x28309a){return new Promise(function(_0x11c810,_0x28ec7a){var _0x355a94=_[_0xeff8('0x5b')](_0x38353c['faxAccounts']);_0x11c810({'count':_0x355a94[_0xeff8('0x5a')],'rows':_0x355a94});});},'SendFax':function(_0x3265dc){var _0xbb4155=this;return new Promise(function(_0x588f5d,_0x1254e4){_0x5e2ec4['send'](_0x3265dc)[_0xeff8('0x19')](function(_0x3ba1ce){_0x588f5d({'code':0xc8,'message':_0x3ba1ce[_0xeff8('0x1a')]});})[_0xeff8('0x20')](function(_0x563432){_0x1254e4(_0xbb4155[_0xeff8('0x1b')](0x1f4,_0x563432[_0xeff8('0x1a')]));});});},'CheckAfterSend':function(_0x34f975){var _0x18e659=this;return new Promise(function(_0x55cfbb,_0x3f51b1){_0x5e2ec4['checkAfterSend'](_0x34f975)[_0xeff8('0x19')](function(_0x1c6324){_0x55cfbb({'code':0xc8,'message':_0x1c6324['message']});})[_0xeff8('0x20')](function(_0x121cae){_0x3f51b1(_0x18e659[_0xeff8('0x1b')](0x1f4,_0x121cae[_0xeff8('0x1a')]));});});}};var _0x3de173=jayson[_0xeff8('0x84')](_0xcb130b)[_0xeff8('0x85')]();_0x3de173['on'](_0xeff8('0x1b'),function(_0x4a524e){return _0x33302f(_0x4a524e);});_0x3de173[_0xeff8('0x86')](0x232a,_0xeff8('0x87'),function(){console[_0xeff8('0x88')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x12a2a8(_0xeff8('0x89')+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 9a5ef81..84390aa 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 _0xddaa=['[%s][%s]\x20Contact\x20not\x20found','createContact','[%s][%s]\x20Contact\x20created:%s','action','error','[%s][%s]\x20Error\x20creating\x20contact','[%s][%s]\x20Autocreate\x20disabled','toLowerCase','bluebird','lodash','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','[%s][%s]','stringify','exec','data2','data1','isNil','routeId','calleridname','','calleridnum','uniqueid','firstName','destcalleridname','destcalleridnum','resolve','then','info','[%s][%s]\x20Contact\x20found:%s','format','user:%s','name','trigger:%s','merge'];(function(_0x200009,_0x5a1333){var _0x376767=function(_0x4f5779){while(--_0x4f5779){_0x200009['push'](_0x200009['shift']());}};_0x376767(++_0x5a1333);}(_0xddaa,0xd0));var _0xadda=function(_0x77c111,_0x391c4e){_0x77c111=_0x77c111-0x0;var _0x1183a1=_0xddaa[_0x77c111];return _0x1183a1;};'use strict';var BPromise=require(_0xadda('0x0'));var util=require('util');var _=require(_0xadda('0x1'));var Redis=require('ioredis');var config=require(_0xadda('0x2'));var logger=require(_0xadda('0x3'))(_0xadda('0x4'));var cmContactRpc=require('../../rpc/cmContact');config[_0xadda('0x5')]=_[_0xadda('0x6')](config[_0xadda('0x5')],{'host':_0xadda('0x7'),'port':0x18eb});var io=require(_0xadda('0x8'))(new Redis(config[_0xadda('0x5')]));function emit(_0x56cddc,_0x3fe8ef,_0x3d5277,_0x4056c7){logger['info'](_0xadda('0x9'),_0x56cddc,'',_0x3fe8ef,_0x3d5277,JSON[_0xadda('0xa')](_0x4056c7));io['to'](_0x3fe8ef)['emit'](_0x3d5277,_0x4056c7);}exports[_0xadda('0xb')]=function(_0x388a74,_0x2ef5cf,_0x3ed313){_0x3ed313['autoCreate']=0x0;if(_0x2ef5cf['data2']&&parseInt(_0x2ef5cf[_0xadda('0xc')],0xa)){var _0x19c0ed={'ListId':parseInt(_0x2ef5cf[_0xadda('0xd')],0xa),'phone':_0x3ed313['calleridnum']};if(_[_0xadda('0xe')](_0x3ed313[_0xadda('0xf')])){_0x19c0ed['firstName']=_0x3ed313[_0xadda('0x10')]&&_0x3ed313[_0xadda('0x10')]!==_0xadda('0x11')?_0x3ed313[_0xadda('0x10')]:_0x3ed313[_0xadda('0x12')]||_0x3ed313[_0xadda('0x13')];}else{_0x19c0ed[_0xadda('0x14')]=_0x3ed313[_0xadda('0x15')]&&_0x3ed313['destcalleridname']!==_0xadda('0x11')?_0x3ed313[_0xadda('0x15')]:_0x3ed313[_0xadda('0x16')]||_0x3ed313[_0xadda('0x13')];_0x19c0ed['phone']=_0x3ed313[_0xadda('0x15')]&&_0x3ed313['destcalleridname']!==''?_0x3ed313[_0xadda('0x15')]:_0x3ed313[_0xadda('0x16')]||_0x3ed313[_0xadda('0x13')];}BPromise[_0xadda('0x17')]()[_0xadda('0x18')](cmContactRpc['showContact']({'where':_['omit'](_0x19c0ed,[_0xadda('0x14')])}))[_0xadda('0x18')](function(_0x1d6ca7){if(_0x1d6ca7){logger[_0xadda('0x19')](_0xadda('0x1a'),_0x3ed313[_0xadda('0x13')],'',_0x1d6ca7['id']);if(_0x388a74){_0x3ed313['xmd-contactid2']=_0x1d6ca7['id'];emit(_0x3ed313[_0xadda('0x13')],util[_0xadda('0x1b')](_0xadda('0x1c'),_0x388a74[_0xadda('0x1d')]),util[_0xadda('0x1b')](_0xadda('0x1e'),_0x2ef5cf['action']['toLowerCase']()),_[_0xadda('0x1f')](_0x3ed313,{'ListId':parseInt(_0x2ef5cf[_0xadda('0xd')],0xa)}));}return;}else{logger[_0xadda('0x19')](_0xadda('0x20'),_0x3ed313[_0xadda('0x13')],'');return BPromise[_0xadda('0x17')]()['then'](cmContactRpc[_0xadda('0x21')](_0x19c0ed));}})['then'](function(_0x301daa){if(_0x301daa){logger[_0xadda('0x19')](_0xadda('0x22'),_0x3ed313[_0xadda('0x13')],'',_0x301daa['id']);if(_0x388a74){_0x3ed313['xmd-contactid2']=_0x301daa['id'];emit(_0x3ed313['uniqueid'],util[_0xadda('0x1b')](_0xadda('0x1c'),_0x388a74[_0xadda('0x1d')]),util[_0xadda('0x1b')](_0xadda('0x1e'),_0x2ef5cf[_0xadda('0x23')]['toLowerCase']()),_[_0xadda('0x1f')](_0x3ed313,{'ListId':parseInt(_0x2ef5cf[_0xadda('0xd')],0xa)}));}}})['catch'](function(_0x1172f3){logger[_0xadda('0x24')](_0xadda('0x25'),_0x3ed313[_0xadda('0x13')],'',JSON['stringify'](_0x1172f3));});}else{if(_0x388a74){logger[_0xadda('0x19')](_0xadda('0x26'),_0x3ed313['uniqueid'],'');emit(_0x3ed313[_0xadda('0x13')],util[_0xadda('0x1b')](_0xadda('0x1c'),_0x388a74[_0xadda('0x1d')]),util[_0xadda('0x1b')](_0xadda('0x1e'),_0x2ef5cf[_0xadda('0x23')][_0xadda('0x27')]()),_['merge']({'ListId':parseInt(_0x2ef5cf[_0xadda('0xd')],0xa)},_0x3ed313));}}}; \ No newline at end of file +var _0x2a43=['then','[%s][%s]\x20Contact\x20found:%s','xmd-contactid2','format','trigger:%s','action','[%s][%s]\x20Contact\x20not\x20found','resolve','[%s][%s]\x20Contact\x20created:%s','user:%s','name','toLowerCase','merge','catch','[%s][%s]\x20Error\x20creating\x20contact','[%s][%s]\x20Autocreate\x20disabled','bluebird','util','lodash','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','[%s][%s]','stringify','autoCreate','data2','data1','isNil','routeId','firstName','calleridname','','calleridnum','destcalleridname','destcalleridnum','uniqueid','phone','showContact','omit'];(function(_0x47e549,_0x2e53d6){var _0x251374=function(_0x400458){while(--_0x400458){_0x47e549['push'](_0x47e549['shift']());}};_0x251374(++_0x2e53d6);}(_0x2a43,0x9a));var _0x32a4=function(_0x5217cf,_0x1b81c0){_0x5217cf=_0x5217cf-0x0;var _0x46b605=_0x2a43[_0x5217cf];return _0x46b605;};'use strict';var BPromise=require(_0x32a4('0x0'));var util=require(_0x32a4('0x1'));var _=require(_0x32a4('0x2'));var Redis=require(_0x32a4('0x3'));var config=require(_0x32a4('0x4'));var logger=require(_0x32a4('0x5'))(_0x32a4('0x6'));var cmContactRpc=require(_0x32a4('0x7'));config['redis']=_[_0x32a4('0x8')](config[_0x32a4('0x9')],{'host':_0x32a4('0xa'),'port':0x18eb});var io=require(_0x32a4('0xb'))(new Redis(config[_0x32a4('0x9')]));function emit(_0x4bf642,_0x34b4dd,_0x1f023d,_0x20535e){logger[_0x32a4('0xc')](_0x32a4('0xd'),_0x4bf642,'',_0x34b4dd,_0x1f023d,JSON[_0x32a4('0xe')](_0x20535e));io['to'](_0x34b4dd)['emit'](_0x1f023d,_0x20535e);}exports['exec']=function(_0x3dd115,_0x54cedc,_0x4fbd93){_0x4fbd93[_0x32a4('0xf')]=0x0;if(_0x54cedc['data2']&&parseInt(_0x54cedc[_0x32a4('0x10')],0xa)){var _0x22de91={'ListId':parseInt(_0x54cedc[_0x32a4('0x11')],0xa),'phone':_0x4fbd93['calleridnum']};if(_[_0x32a4('0x12')](_0x4fbd93[_0x32a4('0x13')])){_0x22de91[_0x32a4('0x14')]=_0x4fbd93[_0x32a4('0x15')]&&_0x4fbd93[_0x32a4('0x15')]!==_0x32a4('0x16')?_0x4fbd93['calleridname']:_0x4fbd93[_0x32a4('0x17')]||_0x4fbd93['uniqueid'];}else{_0x22de91[_0x32a4('0x14')]=_0x4fbd93['destcalleridname']&&_0x4fbd93[_0x32a4('0x18')]!==_0x32a4('0x16')?_0x4fbd93[_0x32a4('0x18')]:_0x4fbd93[_0x32a4('0x19')]||_0x4fbd93[_0x32a4('0x1a')];_0x22de91[_0x32a4('0x1b')]=_0x4fbd93[_0x32a4('0x18')]&&_0x4fbd93['destcalleridname']!==''?_0x4fbd93[_0x32a4('0x18')]:_0x4fbd93[_0x32a4('0x19')]||_0x4fbd93[_0x32a4('0x1a')];}BPromise['resolve']()['then'](cmContactRpc[_0x32a4('0x1c')]({'where':_[_0x32a4('0x1d')](_0x22de91,[_0x32a4('0x14')])}))[_0x32a4('0x1e')](function(_0x36d5a2){if(_0x36d5a2){logger[_0x32a4('0xc')](_0x32a4('0x1f'),_0x4fbd93['uniqueid'],'',_0x36d5a2['id']);if(_0x3dd115){_0x4fbd93[_0x32a4('0x20')]=_0x36d5a2['id'];emit(_0x4fbd93[_0x32a4('0x1a')],util[_0x32a4('0x21')]('user:%s',_0x3dd115['name']),util['format'](_0x32a4('0x22'),_0x54cedc[_0x32a4('0x23')]['toLowerCase']()),_['merge'](_0x4fbd93,{'ListId':parseInt(_0x54cedc[_0x32a4('0x11')],0xa)}));}return;}else{logger['info'](_0x32a4('0x24'),_0x4fbd93[_0x32a4('0x1a')],'');return BPromise[_0x32a4('0x25')]()[_0x32a4('0x1e')](cmContactRpc['createContact'](_0x22de91));}})[_0x32a4('0x1e')](function(_0x294779){if(_0x294779){logger[_0x32a4('0xc')](_0x32a4('0x26'),_0x4fbd93['uniqueid'],'',_0x294779['id']);if(_0x3dd115){_0x4fbd93[_0x32a4('0x20')]=_0x294779['id'];emit(_0x4fbd93[_0x32a4('0x1a')],util[_0x32a4('0x21')](_0x32a4('0x27'),_0x3dd115[_0x32a4('0x28')]),util['format'](_0x32a4('0x22'),_0x54cedc[_0x32a4('0x23')][_0x32a4('0x29')]()),_[_0x32a4('0x2a')](_0x4fbd93,{'ListId':parseInt(_0x54cedc[_0x32a4('0x11')],0xa)}));}}})[_0x32a4('0x2b')](function(_0x44670a){logger['error'](_0x32a4('0x2c'),_0x4fbd93[_0x32a4('0x1a')],'',JSON['stringify'](_0x44670a));});}else{if(_0x3dd115){logger[_0x32a4('0xc')](_0x32a4('0x2d'),_0x4fbd93[_0x32a4('0x1a')],'');emit(_0x4fbd93[_0x32a4('0x1a')],util[_0x32a4('0x21')](_0x32a4('0x27'),_0x3dd115[_0x32a4('0x28')]),util[_0x32a4('0x21')](_0x32a4('0x22'),_0x54cedc[_0x32a4('0x23')]['toLowerCase']()),_[_0x32a4('0x2a')]({'ListId':parseInt(_0x54cedc[_0x32a4('0x11')],0xa)},_0x4fbd93));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 8f2bc18..5b8f7a4 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 _0x1335=['defaults','localhost','socket.io-emitter','redis','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','custom:agentconnect','bind','custom:agentringnoanswer','syncCustomEvent','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:queuecallerabandon','custom:timeout','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','clone','checkTriggers','interface','status','checkTrigger','variables','Actions','length','action','toLowerCase','contactmanager','motionbar','browser','TemplateId','data2','html','template\x20not\x20found','uri','isNil','data3','data4','location','uriLocation','windowWidth','data5','windowHeight','data6','600','winApplication','render','format','user:%s','name','trigger:%s:%s','data1','merge','jscripty','trigger:%s','exec','integration','routeId','script','buildUri','parse','query','search','AllConditions','every','checkConditions','AnyConditions','some','channel','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','queue','agent','membername','lastevent','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','../../../config/environment','../../../config/logger','trigger'];(function(_0x52a739,_0x4949f4){var _0x1fd038=function(_0x240c92){while(--_0x240c92){_0x52a739['push'](_0x52a739['shift']());}};_0x1fd038(++_0x4949f4);}(_0x1335,0x6f));var _0x5133=function(_0x4a94b7,_0x97312f){_0x4a94b7=_0x4a94b7-0x0;var _0x2c01f5=_0x1335[_0x4a94b7];return _0x2c01f5;};'use strict';var util=require(_0x5133('0x0'));var _=require(_0x5133('0x1'));var url=require(_0x5133('0x2'));var Mustache=require(_0x5133('0x3'));var Redis=require(_0x5133('0x4'));var urlforward=require(_0x5133('0x5'));var integration=require(_0x5133('0x6'));var cmContact=require(_0x5133('0x7'));var script=require('./script');var cmContactRpc=require('../rpc/cmContact');var config=require(_0x5133('0x8'));var logger=require(_0x5133('0x9'))(_0x5133('0xa'));var ami=require('../ami');config['redis']=_[_0x5133('0xb')](config['redis'],{'host':_0x5133('0xc'),'port':0x18eb});var io=require(_0x5133('0xd'))(new Redis(config[_0x5133('0xe')]));var operators={'equals':function(_0x1c6c3f,_0x432d54){return _0x1c6c3f==_0x432d54;},'not_equals':function(_0x31e838,_0x27713a){return _0x31e838!=_0x27713a;}};var barAndWebActions=['popup',_0x5133('0x2'),_0x5133('0xf')];function Trigger(_0x183dee){this[_0x5133('0x10')]=_0x183dee[_0x5133('0x10')];this[_0x5133('0x11')]=_0x183dee[_0x5133('0x11')];this[_0x5133('0x12')]=_0x183dee[_0x5133('0x12')];this[_0x5133('0x13')]=_0x183dee[_0x5133('0x13')];this[_0x5133('0x14')]=_0x183dee[_0x5133('0x14')];this[_0x5133('0x15')]=_0x183dee['zendeskAccounts'];this['freshdeskAccounts']=_0x183dee[_0x5133('0x16')];this[_0x5133('0x17')]=_0x183dee[_0x5133('0x17')];this[_0x5133('0x18')]=_0x183dee['sugarcrmAccounts'];this['zohoAccounts']=_0x183dee[_0x5133('0x19')];this['deskAccounts']=_0x183dee[_0x5133('0x1a')];this[_0x5133('0x1b')]=_0x183dee['vtigerAccounts'];this[_0x5133('0x1c')]=_0x183dee['servicenowAccounts'];this[_0x5133('0x1d')]=_0x183dee[_0x5133('0x1d')];this[_0x5133('0x1e')]=_0x183dee[_0x5133('0x1e')];this[_0x5133('0x1f')]={'zendesk':this[_0x5133('0x15')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x5133('0x16')],'sugarcrm':this[_0x5133('0x18')],'zoho':this[_0x5133('0x19')],'desk':this[_0x5133('0x1a')],'vtiger':this[_0x5133('0x1b')],'dynamics365':this[_0x5133('0x1d')],'freshsales':this[_0x5133('0x1e')],'servicenow':this['servicenowAccounts']};ami['on'](_0x5133('0x20'),this['syncCustomEvent']['bind'](this));ami['on'](_0x5133('0x21'),this['syncCustomEvent'][_0x5133('0x22')](this));ami['on'](_0x5133('0x23'),this[_0x5133('0x24')][_0x5133('0x22')](this));ami['on'](_0x5133('0x25'),this['syncCustomEvent'][_0x5133('0x22')](this));ami['on'](_0x5133('0x26'),this[_0x5133('0x24')][_0x5133('0x22')](this));ami['on'](_0x5133('0x27'),this[_0x5133('0x24')][_0x5133('0x22')](this));ami['on'](_0x5133('0x28'),this[_0x5133('0x24')][_0x5133('0x22')](this));ami['on']('custom:agentcongestion',this[_0x5133('0x24')][_0x5133('0x22')](this));ami['on']('custom:agentreject',this[_0x5133('0x24')][_0x5133('0x22')](this));ami['on'](_0x5133('0x29'),this[_0x5133('0x24')][_0x5133('0x22')](this));ami['on'](_0x5133('0x2a'),this[_0x5133('0x24')][_0x5133('0x22')](this));ami['on'](_0x5133('0x2b'),this['syncAgentDial'][_0x5133('0x22')](this));ami['on'](_0x5133('0x2c'),this[_0x5133('0x2d')]['bind'](this));ami['on'](_0x5133('0x2e'),this[_0x5133('0x2d')]['bind'](this));ami['on'](_0x5133('0x2f'),this[_0x5133('0x24')][_0x5133('0x22')](this));ami['on'](_0x5133('0x30'),this[_0x5133('0x24')][_0x5133('0x22')](this));ami['on']('custom:incomingmessage',this['syncCustomEvent'][_0x5133('0x22')](this));ami['on'](_0x5133('0x31'),this[_0x5133('0x24')]['bind'](this));ami['on'](_0x5133('0x32'),this[_0x5133('0x24')]['bind'](this));ami['on'](_0x5133('0x33'),this['syncCustomEvent'][_0x5133('0x22')](this));}Trigger[_0x5133('0x34')][_0x5133('0x35')]=function(_0x3d5a98,_0x381703,_0x2fa989){logger[_0x5133('0x36')](_0x3d5a98,_0x381703,JSON['stringify'](_0x2fa989));io['to'](_0x3d5a98)[_0x5133('0x35')](_0x381703,_0x2fa989);};Trigger[_0x5133('0x34')][_0x5133('0x24')]=function(_0x245236){var _0x5564a1=_[_0x5133('0x37')](_0x245236);this[_0x5133('0x38')](_0x5564a1);};Trigger['prototype'][_0x5133('0x2d')]=function(_0x282b58){if(this[_0x5133('0x11')][_0x282b58[_0x5133('0x39')]]){this['syncCustomEvent'](_0x282b58);}};Trigger[_0x5133('0x34')][_0x5133('0x38')]=function(_0xc6fb38){var _0x587e79;for(var _0x48c490 in this[_0x5133('0x10')]){if(this[_0x5133('0x10')]['hasOwnProperty'](_0x48c490)){if(this[_0x5133('0x10')][_0x48c490][_0x5133('0x3a')]){_0x587e79=this[_0x5133('0x3b')](this[_0x5133('0x10')][_0x48c490],_0xc6fb38);if(_0x587e79){_['merge'](_0xc6fb38,_0xc6fb38[_0x5133('0x3c')]);for(var _0x58ab72=0x0,_0x337a02,_0x37f2ae,_0x45635f;_0x58ab720x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file +var _0xa9e0=['Getting\x20agent\x20with\x20email','format','total_entries','find','_embedded','entries','then','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','%s/customers/search','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','work','length','map','forEach','type','string','customField','nameField','toLowerCase','content','toString','idField','variable','variableName','custom_fields','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','phone','Motion','CTI','Tags','Descriptions','user','Fields','%s/customers/%d/cases','POST','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','outbound','recordingFormat','none','[OUTBOUND]','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','Desk\x20account\x20type\x20not\x20recognized','catch','monitor_format','lastevent','lodash','request-promise','md5','./util','../../../../config/logger','desk','redis','defaults','socket.io-emitter','emit','validateEmail','info'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var md5=require(_0x0a9e('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x0a9e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));config[_0x0a9e('0x6')]=_[_0x0a9e('0x7')](config[_0x0a9e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0a9e('0x8'))(new Redis(config[_0x0a9e('0x6')]));function emit(_0x2cc193,_0x5f41ea,_0x503809){io['to'](_0x2cc193)[_0x0a9e('0x9')](_0x5f41ea,_0x503809);}var headers={'Content-Type':'application/json','Accept':'application/json'};function getUser(_0x39753a,_0xf81284){if(intUtil[_0x0a9e('0xa')](_0xf81284)===!![]){logger[_0x0a9e('0xb')](_0x0a9e('0xc'),_0xf81284);return request({'uri':util[_0x0a9e('0xd')]('%s/users',_0x39753a['remoteUri'])})['then'](function(_0x4cfe67){if(_0x4cfe67[_0x0a9e('0xe')]){return _[_0x0a9e('0xf')](_0x4cfe67[_0x0a9e('0x10')][_0x0a9e('0x11')],{'email':_0xf81284});}})[_0x0a9e('0x12')](function(_0x69aeb7){if(_0x69aeb7){logger['info'](_0x0a9e('0x13'));return _0x69aeb7;}else{logger[_0x0a9e('0xb')](_0x0a9e('0x14'));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x15'),_0x39753a[_0x0a9e('0x16')])});}});}else{logger['info'](_0x0a9e('0x17'));return request({'uri':util['format'](_0x0a9e('0x15'),_0x39753a['remoteUri'])});}}function request(_0x16033c){logger[_0x0a9e('0x18')]('[HTTP]',JSON[_0x0a9e('0x19')](_0x16033c));return rp(_['defaults'](_0x16033c,{'method':_0x0a9e('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x478723){var _0x106033;if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x1c')){_0x106033=util[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x1f')]);}else if(_0x478723[_0x0a9e('0x1b')]===_0x0a9e('0x20')){_0x106033=util[_0x0a9e('0xd')]('%s/token:%s',_0x478723[_0x0a9e('0x1e')],_0x478723[_0x0a9e('0x20')]);}return util['format'](_0x0a9e('0x21'),new Buffer(_0x106033)['toString']('base64'));}function getEndUser(_0x3a02e1,_0x432e56,_0x38e7c4){logger[_0x0a9e('0xb')]('Searching\x20enduser\x20with\x20phone',_0x38e7c4);return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x22'),_0x3a02e1[_0x0a9e('0x16')]),'qs':{'phone':_0x38e7c4}})[_0x0a9e('0x12')](function(_0x370d86){if(_0x370d86[_0x0a9e('0xe')]){logger[_0x0a9e('0xb')]('Enduser\x20found!');return _0x370d86['_embedded'][_0x0a9e('0x11')][0x0];}else{logger[_0x0a9e('0xb')](_0x0a9e('0x23'));return request({'uri':util[_0x0a9e('0xd')]('%s/customers',_0x3a02e1[_0x0a9e('0x16')]),'method':'POST','body':{'first_name':_0x432e56,'title':_0x432e56,'phone_numbers':[{'type':_0x0a9e('0x24'),'value':_0x38e7c4}]}});}});}function getTags(_0x5bfb33,_0x1dc186){var _0x34dc65=[];if(_0x5bfb33&&_0x5bfb33[_0x0a9e('0x25')]>0x0){_0x34dc65=_[_0x0a9e('0x26')](_0x5bfb33,_0x1dc186);}return _0x34dc65;}function getCustomFields(_0x140511,_0x1538a4){var _0x11c3b6=[];var _0x14de77={'custom_fields':{}};if(_0x140511['length']>0x0){_[_0x0a9e('0x27')](_0x140511,function(_0x468813){if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813['nameField']&&!_0x468813[_0x0a9e('0x2a')]){_0x14de77[_0x468813[_0x0a9e('0x2b')][_0x0a9e('0x2c')]()]=_0x468813[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x29')&&_0x468813[_0x0a9e('0x2f')]&&_0x468813[_0x0a9e('0x2a')]){_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x468813['content'][_0x0a9e('0x2e')]();}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x30')&&_0x468813[_0x0a9e('0x31')]&&_0x468813[_0x0a9e('0x2f')]&&_0x468813['customField']){_0x1538a4[_0x468813[_0x0a9e('0x31')]]&&(_0x14de77[_0x0a9e('0x32')][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x31')]][_0x0a9e('0x2e')]());}else if(_0x468813[_0x0a9e('0x28')]===_0x0a9e('0x33')&&_0x468813[_0x0a9e('0x34')]&&_0x468813['Variable'][_0x0a9e('0x35')]&&_0x468813['idField']&&_0x468813[_0x0a9e('0x2a')]){_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]&&(_0x14de77['custom_fields'][_0x468813[_0x0a9e('0x2f')]]=_0x1538a4[_0x468813[_0x0a9e('0x34')][_0x0a9e('0x35')][_0x0a9e('0x2c')]()]['toString']());}});}if(_0x14de77['priority']){_0x14de77[_0x0a9e('0x36')]=Number(_0x14de77['priority']);}return _0x14de77;}function getTicket(_0x24936a,_0x3d9717,_0x381c37,_0x1ef87a,_0x4f41ae){logger[_0x0a9e('0xb')](_0x0a9e('0x37'));var _0x3cae=_['merge']({'subject':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x39')],_0x4f41ae,'\x20'),'type':_0x0a9e('0x3a'),'status':'new','labels':['xCALLY',_0x0a9e('0x3b'),_0x0a9e('0x3c')]['concat'](getTags(_0x1ef87a[_0x0a9e('0x3d')],_0x0a9e('0x35'))),'description':intUtil[_0x0a9e('0x38')](_0x1ef87a[_0x0a9e('0x3e')],_0x4f41ae,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x3d9717['id']),'class':_0x0a9e('0x3f')}},'message':{'direction':'in','body':intUtil[_0x0a9e('0x38')](_0x1ef87a['Descriptions'],_0x4f41ae,'\x0a')}},getCustomFields(_0x1ef87a[_0x0a9e('0x40')],_0x4f41ae));return request({'uri':util[_0x0a9e('0xd')](_0x0a9e('0x41'),_0x24936a['remoteUri'],_0x381c37['id']),'method':_0x0a9e('0x42'),'body':_0x3cae});}exports[_0x0a9e('0x43')]=function(_0x274e8e,_0x43dd5b,_0x13cb1f,_0xeaa5e5,_0x2881b3,_0x45a9b8){var _0x23b089,_0x3da2cd;_0x45a9b8[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x45a9b8[_0x0a9e('0x16')]);_0x45a9b8[_0x0a9e('0x45')]=intUtil[_0x0a9e('0x44')](_0x45a9b8['serverUrl']);if(_0x2881b3&&_0x2881b3['monitor_format']){logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x47'));_0x43dd5b[_0x0a9e('0x48')]=util[_0x0a9e('0xd')](_0x0a9e('0x49'),_0x45a9b8[_0x0a9e('0x45')],_0x43dd5b[_0x0a9e('0x4a')],md5(_0x43dd5b[_0x0a9e('0x4a')]));}else{_0x43dd5b[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x45a9b8);return getUser(_0x45a9b8,_0xeaa5e5[_0x0a9e('0x4c')])['then'](function(_0x117c99){_0x23b089=_0x117c99;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x23b089['id']);return getEndUser(_0x45a9b8,_0x43dd5b[_0x0a9e('0x4e')],_0x43dd5b[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x21eb86){_0x3da2cd=_0x21eb86;logger[_0x0a9e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3da2cd['id']);return getTicket(_0x45a9b8,_0x23b089,_0x3da2cd,_0x13cb1f,_0x43dd5b);})[_0x0a9e('0x12')](function(_0x48fd45){if(_0x48fd45){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')]('The\x20Ticket\x20ID\x20is:',_0x48fd45['id']);switch(_0x45a9b8[_0x0a9e('0x28')]){case _0x0a9e('0x51'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5['name']),_0x0a9e('0x54'),{'recordId':_0x48fd45['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x56'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0xeaa5e5[_0x0a9e('0x35')]),_0x0a9e('0x57'),{'uri':util['format'](_0x0a9e('0x58'),_0x48fd45['id'])});break;default:logger[_0x0a9e('0x59')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1adfee){console[_0x0a9e('0x59')](_0x1adfee);logger[_0x0a9e('0x59')](_0x0a9e('0x46'),JSON[_0x0a9e('0x19')](_0x1adfee));});};exports[_0x0a9e('0x5a')]=function(_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){var _0x14d602,_0x5bb3ed;_0x39d77d[_0x0a9e('0x16')]=intUtil[_0x0a9e('0x44')](_0x39d77d['remoteUri']);_0x39d77d['serverUrl']=intUtil[_0x0a9e('0x44')](_0x39d77d['serverUrl']);if(_0x204173&&_0x204173[_0x0a9e('0x5b')]&&_0x204173['recordingFormat']!==_0x0a9e('0x5c')){logger[_0x0a9e('0xb')](_0x0a9e('0x5d'),'Recording\x20is\x20enabled!');_0x375c18[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x39d77d['serverUrl'],_0x375c18[_0x0a9e('0x4a')],md5(_0x375c18[_0x0a9e('0x4a')]));}headers['Authorization']=getAuth(_0x39d77d);return getUser(_0x39d77d,_0x4b1b9f[_0x0a9e('0x4c')])['then'](function(_0x211ef9){_0x14d602=_0x211ef9;logger['info'](_0x0a9e('0x4d'),_0x14d602['id']);return getEndUser(_0x39d77d,_0x375c18['destcalleridname'],_0x375c18['destcalleridnum']);})['then'](function(_0x2da03c){_0x5bb3ed=_0x2da03c;logger['info'](_0x0a9e('0x5e'),_0x5bb3ed['id']);return getTicket(_0x39d77d,_0x14d602,_0x5bb3ed,_0x5d38ae,_0x375c18);})[_0x0a9e('0x12')](function(_0x3cfd00){if(_0x3cfd00){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x3cfd00['id']);switch(_0x39d77d[_0x0a9e('0x28')]){case'integrationTab':logger[_0x0a9e('0xb')](_0x0a9e('0x46'),_0x0a9e('0x52'));emit(util[_0x0a9e('0xd')](_0x0a9e('0x53'),_0x4b1b9f[_0x0a9e('0x35')]),'trigger:desk:display',{'recordId':_0x3cfd00['id']});break;case _0x0a9e('0x55'):logger[_0x0a9e('0xb')]('[QUEUE]',_0x0a9e('0x56'));emit(util['format'](_0x0a9e('0x53'),_0x4b1b9f['name']),'trigger:browser:url',{'uri':util['format'](_0x0a9e('0x60'),_0x39d77d['remoteUri'],_0x3cfd00['id'])});break;default:logger[_0x0a9e('0x59')](_0x0a9e('0x5d'),_0x0a9e('0x61'));}}})[_0x0a9e('0x62')](function(_0x1cca9f){logger[_0x0a9e('0x59')]('[OUTBOUND]',JSON[_0x0a9e('0x19')](_0x1cca9f));});};exports['unmanaged']=function(_0xca4ade,_0x1f07cb,_0x51aaf7,_0x5adf8f,_0x453360,_0x156f1c){var _0x119677,_0x32e134;_0x156f1c['remoteUri']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x16')]);_0x156f1c['serverUrl']=intUtil[_0x0a9e('0x44')](_0x156f1c[_0x0a9e('0x45')]);if(_0x453360&&_0x453360[_0x0a9e('0x63')]){logger[_0x0a9e('0xb')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',_0x0a9e('0x47'));_0x1f07cb[_0x0a9e('0x48')]=util[_0x0a9e('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x156f1c[_0x0a9e('0x45')],_0x1f07cb['uniqueid'],md5(_0x1f07cb['uniqueid']));}else{_0x1f07cb[_0x0a9e('0x48')]='';}headers[_0x0a9e('0x4b')]=getAuth(_0x156f1c);return getUser(_0x156f1c)[_0x0a9e('0x12')](function(_0x19c995){_0x119677=_0x19c995;logger[_0x0a9e('0xb')](_0x0a9e('0x4d'),_0x119677['id']);return getEndUser(_0x156f1c,_0x1f07cb[_0x0a9e('0x4e')],_0x1f07cb[_0x0a9e('0x4f')]);})[_0x0a9e('0x12')](function(_0x1cc4f3){_0x32e134=_0x1cc4f3;logger[_0x0a9e('0xb')](_0x0a9e('0x5e'),_0x32e134['id']);return getTicket(_0x156f1c,_0x119677,_0x32e134,_0x51aaf7,_0x1f07cb);})[_0x0a9e('0x12')](function(_0x2b8192){if(_0x2b8192){logger[_0x0a9e('0xb')](_0x0a9e('0x50'));logger[_0x0a9e('0xb')](_0x0a9e('0x5f'),_0x2b8192['id']);}})['catch'](function(_0x1b0b98){logger[_0x0a9e('0x59')]('['+_0x1f07cb[_0x0a9e('0x64')]['toUpperCase']()+']',JSON[_0x0a9e('0x19')](_0x1b0b98));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 1d658a0..47f8e95 100644 --- a/server/services/ami/trigger/integration/dynamics365.js +++ b/server/services/ami/trigger/integration/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8299=['bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','userEmail','email','length','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','internalemailaddress','userId','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','odata-entityid','lastIndexOf','enduserId','contacts?$select=telephone1','telephone1','contactid',']\x20Enduser\x20created!','forEach','type','customField','idField','substring','indexOf','content','ticketType','incidents','assign','getString','Descriptions','/contacts(','/systemusers(','phonecall','phonecalls','Subjects','callDirection','queue','Fields','headers','ticketId','message','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8299,0x65));var _0x9829=function(_0x184474,_0x1b4e2d){_0x184474=_0x184474-0x0;var _0x2d5d11=_0x8299[_0x184474];return _0x2d5d11;};'use strict';var _=require(_0x9829('0x0'));var BPromise=require(_0x9829('0x1'));var rp=require(_0x9829('0x2'));var util=require(_0x9829('0x3'));var intUtil=require(_0x9829('0x4'));var md5=require(_0x9829('0x5'));var Redis=require(_0x9829('0x6'));var logger=require(_0x9829('0x7'))(_0x9829('0x8'));var config=require(_0x9829('0x9'));config[_0x9829('0xa')]=_[_0x9829('0xb')](config[_0x9829('0xa')],{'host':_0x9829('0xc'),'port':0x18eb});var io=require(_0x9829('0xd'))(new Redis(config[_0x9829('0xa')]));function getAuthToken(_0x2959f1,_0x4c08c5,_0x9e5b7d){var _0x563261={'method':_0x9829('0xe'),'uri':_0x4c08c5,'form':{'client_id':_0x2959f1[_0x9829('0xf')],'resource':_0x2959f1[_0x9829('0x10')],'username':_0x2959f1[_0x9829('0x11')],'password':_0x2959f1[_0x9829('0x12')],'grant_type':_0x9829('0x12'),'client_secret':_0x2959f1[_0x9829('0x13')]},'json':!![]};return rp(_0x563261)['then'](function(_0x5a78e8){return _0x5a78e8[_0x9829('0x14')];})[_0x9829('0x15')](function(_0x34d7dc){logger[_0x9829('0x16')]('['+[_0x9e5b7d[_0x9829('0x17')]()]+_0x9829('0x18'));return _0x34d7dc['message'];});}function getUser(_0xf80a6d,_0x5579a0,_0x30a1f2,_0x2f7e15,_0x32e7d5,_0x5e092c){return new BPromise(function(_0x58757b,_0x708e8e){return getAuthToken(_0x5579a0,_0x2f7e15,_0x5e092c)[_0x9829('0x19')](function(_0xd51a90){var _0x501223={'method':_0x9829('0x1a'),'uri':_0x32e7d5+_0x9829('0x1b'),'headers':{'Authorization':_0x9829('0x1c')+_0xd51a90,'OData-Version':_0x9829('0x1d')},'json':!![]};return rp(_0x501223);})['then'](function(_0x6c393d){var _0x470014=_0x6c393d[_0x9829('0x1e')];var _0x4560a8=![];var _0x3b95b7=null;if(!_['isNil'](_0x30a1f2)){if(intUtil[_0x9829('0x1f')](_0x30a1f2['email'])){_0xf80a6d[_0x9829('0x20')]=_0x30a1f2[_0x9829('0x21')];for(_0x3b95b7=0x0;_0x3b95b7<_0x470014[_0x9829('0x22')];_0x3b95b7++){if(_0x470014[_0x3b95b7]['internalemailaddress']===_0x30a1f2[_0x9829('0x21')]&&!_0x470014[_0x3b95b7][_0x9829('0x23')]){_0x4560a8=!![];logger[_0x9829('0x24')]('['+[_0x5e092c[_0x9829('0x17')]()]+_0x9829('0x25')+_0x470014[_0x3b95b7][_0x9829('0x26')]+'!');_0xf80a6d['userId']=_0x470014[_0x3b95b7]['systemuserid'];}}}}if(!_0x4560a8){logger[_0x9829('0x24')]('['+[_0x5e092c[_0x9829('0x17')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0xf80a6d['userEmail']=_0x5579a0[_0x9829('0x11')];for(_0x3b95b7=0x0;_0x3b95b7<_0x470014[_0x9829('0x22')];_0x3b95b7++){if(_0x470014[_0x3b95b7][_0x9829('0x27')]===_0x5579a0[_0x9829('0x11')]){_0xf80a6d[_0x9829('0x28')]=_0x470014[_0x3b95b7]['systemuserid'];}}}_0x58757b(_0xf80a6d);})[_0x9829('0x15')](function(_0x5ecc0a){_0x708e8e(_0x5ecc0a['message']);});});}function createEndUser(_0x18809d,_0x32bc99,_0x5c5bfb,_0x408d03,_0x2b7efe,_0x24c9e0){return new BPromise(function(_0x525e5b,_0x32d93e){return getAuthToken(_0x32bc99,_0x5c5bfb,_0x24c9e0)[_0x9829('0x19')](function(_0x51c31c){var _0x39b99c=_0x24c9e0[_0x9829('0x29')]()===_0x9829('0x2a')?_0x2b7efe[_0x9829('0x2b')]:_0x2b7efe[_0x9829('0x2c')];var _0x149447={'method':'POST','uri':_0x408d03+_0x9829('0x2d'),'body':{'telephone1':_0x39b99c,'fullname':_0x39b99c,'firstname':_0x39b99c,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x18809d['userId']+')'},'headers':{'Authorization':_0x9829('0x1c')+_0x51c31c,'OData-Version':_0x9829('0x1d')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x149447);})['then'](function(_0x1a2124){var _0x402658=_0x1a2124['headers'][_0x9829('0x2e')];var _0x56cbe7=_0x402658['substring'](_0x402658[_0x9829('0x2f')]('(')+0x1,_0x402658[_0x9829('0x2f')](')'));_0x18809d[_0x9829('0x30')]=_0x56cbe7;_0x525e5b(_0x18809d);})[_0x9829('0x15')](function(_0x2352df){_0x32d93e(_0x2352df['message']);});});}function getEndUser(_0x4b71e8,_0x46d3d0,_0x5d06ff,_0x1bbb57,_0x5ac15f,_0x5190c0){return new BPromise(function(_0xf954a6,_0xf4c5ce){return getAuthToken(_0x46d3d0,_0x5d06ff,_0x5190c0)[_0x9829('0x19')](function(_0x3ee089){var _0x40163e={'method':_0x9829('0x1a'),'uri':_0x1bbb57+_0x9829('0x31'),'headers':{'Authorization':_0x9829('0x1c')+_0x3ee089,'If-None-Match':null,'OData-Version':_0x9829('0x1d')},'json':!![]};return rp(_0x40163e);})['then'](function(_0x28963a){var _0x28f134=null;if(_0x28963a){var _0xd3b876=_0x28963a[_0x9829('0x1e')];var _0x379fc0=![];for(_0x28f134=0x0;_0x28f134<_0xd3b876['length'];_0x28f134++){var _0x4053ff=_0x5190c0[_0x9829('0x29')]()===_0x9829('0x2a')?_0x5ac15f[_0x9829('0x2b')]:_0x5ac15f['calleridnum'];if(_0xd3b876[_0x28f134][_0x9829('0x32')]===_0x4053ff){_0x379fc0=!![];_0x4b71e8['enduserId']=_0xd3b876[_0x28f134][_0x9829('0x33')];}}if(_0x379fc0){_0xf954a6(_0x4b71e8);}else{return createEndUser(_0x4b71e8,_0x46d3d0,_0x5d06ff,_0x1bbb57,_0x5ac15f,_0x5190c0)['then'](function(_0x12aab0){logger[_0x9829('0x24')]('['+[_0x5190c0[_0x9829('0x17')]()]+_0x9829('0x34'),_0x12aab0[_0x9829('0x30')]);_0xf954a6(_0x12aab0);});}}else{return createEndUser(_0x4b71e8,_0x46d3d0,_0x5d06ff,_0x1bbb57,_0x5ac15f,_0x5190c0)['then'](function(_0x1ec862){logger[_0x9829('0x24')]('['+[_0x5190c0[_0x9829('0x17')]()]+']\x20Enduser\x20Created!',_0x1ec862[_0x9829('0x30')]);_0xf954a6(_0x1ec862);});}});});}function getCustomFields(_0x32f8f4,_0x1b50c7,_0x547d64){var _0x4f1523={};if(_0x32f8f4[_0x9829('0x22')]>0x0){_[_0x9829('0x35')](_0x32f8f4,function(_0x40b1ff){if(_0x40b1ff[_0x9829('0x36')]==='string'&&_0x40b1ff['nameField']&&!_0x40b1ff[_0x9829('0x37')]){var _0x310648=_0x40b1ff[_0x9829('0x38')]['toLowerCase']();var _0x5045c8=_0x310648[_0x9829('0x39')](0x0,_0x310648[_0x9829('0x3a')]('_'));var _0x504f67=_0x310648[_0x9829('0x39')](_0x310648[_0x9829('0x3a')]('_')+0x1);if(_0x5045c8===_0x547d64){_0x4f1523[_0x504f67]=_0x40b1ff[_0x9829('0x3b')];}}});}return _0x4f1523;}function getTicket(_0x5faa9d,_0x1c6415,_0xd17632,_0x165876,_0x3f01cf,_0x25ed85,_0x182262){return new BPromise(function(_0x444297,_0x4ed0da){var _0x17ffd3;return getAuthToken(_0x1c6415,_0xd17632,_0x182262)['then'](function(_0x2c1a21){if(_0x25ed85[_0x9829('0x3c')]==='incident'){_0x17ffd3={'method':_0x9829('0xe'),'uri':_0x165876+_0x9829('0x3d'),'body':Object[_0x9829('0x3e')]({},{'title':intUtil['getString'](_0x25ed85['Subjects'],_0x3f01cf,'\x20'),'description':intUtil[_0x9829('0x3f')](_0x25ed85[_0x9829('0x40')],_0x3f01cf,'\x0a'),'customerid_contact@odata.bind':_0x9829('0x41')+_0x5faa9d[_0x9829('0x30')]+')','ownerid@odata.bind':_0x9829('0x42')+_0x5faa9d[_0x9829('0x28')]+')','caseorigincode':'1'},getCustomFields(_0x25ed85['Fields'],_0x3f01cf,_0x25ed85[_0x9829('0x3c')])),'headers':{'Authorization':_0x9829('0x1c')+_0x2c1a21,'OData-Version':_0x9829('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x25ed85['ticketType']===_0x9829('0x43')){_0x17ffd3={'method':_0x9829('0xe'),'uri':_0x165876+_0x9829('0x44'),'body':Object[_0x9829('0x3e')]({},{'subject':intUtil[_0x9829('0x3f')](_0x25ed85[_0x9829('0x45')],_0x3f01cf,'\x20'),'phonenumber':String(_0x3f01cf[_0x9829('0x2c')]),'description':intUtil['getString'](_0x25ed85[_0x9829('0x40')],_0x3f01cf,'\x0a'),'regardingobjectid_contact@odata.bind':'/contacts('+_0x5faa9d[_0x9829('0x30')]+')','ownerid@odata.bind':'/systemusers('+_0x5faa9d[_0x9829('0x28')]+')','directioncode':_0x5faa9d[_0x9829('0x46')]===_0x9829('0x47')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x9829('0x42')+_0x5faa9d[_0x9829('0x28')]+')','participationtypemask':_0x5faa9d[_0x9829('0x46')]===_0x9829('0x47')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x5faa9d[_0x9829('0x30')]+')','participationtypemask':_0x5faa9d[_0x9829('0x46')]===_0x9829('0x47')?0x1:0x2}]},getCustomFields(_0x25ed85[_0x9829('0x48')],_0x3f01cf,_0x25ed85[_0x9829('0x3c')])),'headers':{'Authorization':_0x9829('0x1c')+_0x2c1a21,'OData-Version':_0x9829('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x17ffd3);})['then'](function(_0x24c52b){var _0x3c9277=_0x24c52b[_0x9829('0x49')][_0x9829('0x2e')];var _0x2de234=_0x3c9277[_0x9829('0x39')](_0x3c9277['lastIndexOf']('(')+0x1,_0x3c9277[_0x9829('0x2f')](')'));_0x5faa9d[_0x9829('0x4a')]=_0x2de234;_0x444297(_0x5faa9d);})[_0x9829('0x15')](function(_0x5b8bb9){_0x4ed0da(_0x5b8bb9[_0x9829('0x4b')]);});});}function emit(_0x402b6b,_0x109fcf,_0x3c8bc3,_0x497198){var _0x566c00={'uri':util[_0x9829('0x4c')](_0x9829('0x4d'),_0x402b6b,_0x3c8bc3,_0x497198)};io['to'](util[_0x9829('0x4c')](_0x9829('0x4e'),_0x109fcf))[_0x9829('0x4f')]('trigger:browser:url',_0x566c00);}exports['cs']=function(_0x14068d,_0x49c4e3,_0xe7dc29,_0x110157,_0x226be4,_0x430c01,_0x54099b,_0x1db7c2){var _0x1315bf={};_0x430c01[_0x9829('0x10')]=intUtil[_0x9829('0x50')](_0x430c01[_0x9829('0x10')]);_0x430c01[_0x9829('0x51')]=intUtil[_0x9829('0x50')](_0x430c01[_0x9829('0x51')]);_0x1315bf[_0x9829('0x46')]=_0x1db7c2===_0x9829('0x47')||_0x1db7c2===_0x9829('0x52')?'queue':'outbound';var _0x1c6f26=util['format'](_0x9829('0x53'),_0x430c01['remoteUri']);var _0x365e9e=util['format'](_0x9829('0x54'),_0x430c01['tenantId']);var _0x2863ed=util[_0x9829('0x4c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x430c01['serverUrl'],_0x49c4e3[_0x9829('0x55')],md5(_0x49c4e3['uniqueid']));if(_0x226be4&&_0x226be4[_0x9829('0x56')]){logger['info'](_0x9829('0x57'),_0x9829('0x58'));_0x49c4e3[_0x9829('0x59')]=_0x2863ed;}else if(_0x54099b&&_0x54099b['recordingFormat']&&_0x54099b['recordingFormat']!==_0x9829('0x5a')){logger['info'](_0x9829('0x5b'),'Recording\x20is\x20enabled!');_0x49c4e3['recordingURL']=_0x2863ed;}else{_0x49c4e3[_0x9829('0x59')]='';}return getUser(_0x1315bf,_0x430c01,_0x110157,_0x365e9e,_0x1c6f26,_0x1db7c2)[_0x9829('0x19')](function(_0x4a6823){logger[_0x9829('0x24')]('['+_0x1db7c2['toUpperCase']()+_0x9829('0x5c'),_0x4a6823[_0x9829('0x28')]);logger[_0x9829('0x24')]('['+_0x1db7c2[_0x9829('0x17')]()+_0x9829('0x5d'),_0x4a6823['userEmail']);return getEndUser(_0x4a6823,_0x430c01,_0x365e9e,_0x1c6f26,_0x49c4e3,_0x1db7c2);})[_0x9829('0x19')](function(_0x1b9f4b){logger[_0x9829('0x24')]('['+_0x1db7c2[_0x9829('0x17')]()+_0x9829('0x5e'),_0x1b9f4b[_0x9829('0x30')]);logger['info']('['+_0x1db7c2[_0x9829('0x17')]()+_0x9829('0x5f'),_0x49c4e3[_0x9829('0x2c')]);return getTicket(_0x1b9f4b,_0x430c01,_0x365e9e,_0x1c6f26,_0x49c4e3,_0xe7dc29,_0x1db7c2);})[_0x9829('0x19')](function(_0x36867d){logger[_0x9829('0x24')](util[_0x9829('0x4c')]('['+_0x1db7c2[_0x9829('0x17')]()+_0x9829('0x60'),_0xe7dc29[_0x9829('0x3c')],_0x36867d[_0x9829('0x4a')]));logger[_0x9829('0x24')](util[_0x9829('0x4c')]('['+_0x1db7c2[_0x9829('0x17')]()+_0x9829('0x61'),_0x1db7c2));if(_0x1db7c2!==_0x9829('0x52')){logger[_0x9829('0x24')]('['+_0x1db7c2[_0x9829('0x17')]()+']',_0x9829('0x62'));emit(_0x430c01[_0x9829('0x10')],_0x110157[_0x9829('0x63')],_0xe7dc29[_0x9829('0x3c')],_0x36867d[_0x9829('0x4a')]);}})[_0x9829('0x15')](function(_0x41f150){logger[_0x9829('0x16')]('['+_0x1db7c2[_0x9829('0x17')]()+_0x9829('0x64'),util[_0x9829('0x65')](_0x41f150,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x3db4=['recordingFormat','none','[OUTBOUND]',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','localhost','POST','clientId','remoteUri','username','password','clientSecret','then','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','isdisabled','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','type','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','Subjects','getString','Descriptions','/contacts(','Fields','phonecalls','callDirection','queue','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','outbound','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL'];(function(_0xd8f696,_0x44ea51){var _0x408d82=function(_0x1616f1){while(--_0x1616f1){_0xd8f696['push'](_0xd8f696['shift']());}};_0x408d82(++_0x44ea51);}(_0x3db4,0x1ed));var _0x43db=function(_0x1f182b,_0x29eff5){_0x1f182b=_0x1f182b-0x0;var _0x4f602e=_0x3db4[_0x1f182b];return _0x4f602e;};'use strict';var _=require(_0x43db('0x0'));var BPromise=require(_0x43db('0x1'));var rp=require(_0x43db('0x2'));var util=require(_0x43db('0x3'));var intUtil=require(_0x43db('0x4'));var md5=require(_0x43db('0x5'));var Redis=require(_0x43db('0x6'));var logger=require(_0x43db('0x7'))('dynamics365');var config=require(_0x43db('0x8'));config[_0x43db('0x9')]=_['defaults'](config[_0x43db('0x9')],{'host':_0x43db('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x43db('0x9')]));function getAuthToken(_0x264da7,_0x5b902c,_0x3704a9){var _0x551fd7={'method':_0x43db('0xb'),'uri':_0x5b902c,'form':{'client_id':_0x264da7[_0x43db('0xc')],'resource':_0x264da7[_0x43db('0xd')],'username':_0x264da7[_0x43db('0xe')],'password':_0x264da7[_0x43db('0xf')],'grant_type':_0x43db('0xf'),'client_secret':_0x264da7[_0x43db('0x10')]},'json':!![]};return rp(_0x551fd7)[_0x43db('0x11')](function(_0xa58bbf){return _0xa58bbf['access_token'];})[_0x43db('0x12')](function(_0x5b3d3f){logger['error']('['+[_0x3704a9[_0x43db('0x13')]()]+_0x43db('0x14'));return _0x5b3d3f[_0x43db('0x15')];});}function getUser(_0x37ca3f,_0x13646a,_0x444c1c,_0x3a9540,_0x19c5b8,_0x5d9db6){return new BPromise(function(_0x41f167,_0x1b895a){return getAuthToken(_0x13646a,_0x3a9540,_0x5d9db6)['then'](function(_0x2cf016){var _0x3c74e9={'method':_0x43db('0x16'),'uri':_0x19c5b8+_0x43db('0x17'),'headers':{'Authorization':_0x43db('0x18')+_0x2cf016,'OData-Version':_0x43db('0x19')},'json':!![]};return rp(_0x3c74e9);})['then'](function(_0x2e2f0d){var _0x14ad2d=_0x2e2f0d[_0x43db('0x1a')];var _0x28219b=![];var _0x46fbb1=null;if(!_[_0x43db('0x1b')](_0x444c1c)){if(intUtil[_0x43db('0x1c')](_0x444c1c[_0x43db('0x1d')])){_0x37ca3f[_0x43db('0x1e')]=_0x444c1c[_0x43db('0x1d')];for(_0x46fbb1=0x0;_0x46fbb1<_0x14ad2d[_0x43db('0x1f')];_0x46fbb1++){if(_0x14ad2d[_0x46fbb1]['internalemailaddress']===_0x444c1c[_0x43db('0x1d')]&&!_0x14ad2d[_0x46fbb1][_0x43db('0x20')]){_0x28219b=!![];logger[_0x43db('0x21')]('['+[_0x5d9db6['toUpperCase']()]+_0x43db('0x22')+_0x14ad2d[_0x46fbb1][_0x43db('0x23')]+'!');_0x37ca3f['userId']=_0x14ad2d[_0x46fbb1][_0x43db('0x23')];}}}}if(!_0x28219b){logger[_0x43db('0x21')]('['+[_0x5d9db6[_0x43db('0x13')]()]+_0x43db('0x24'));_0x37ca3f[_0x43db('0x1e')]=_0x13646a[_0x43db('0xe')];for(_0x46fbb1=0x0;_0x46fbb1<_0x14ad2d['length'];_0x46fbb1++){if(_0x14ad2d[_0x46fbb1]['internalemailaddress']===_0x13646a[_0x43db('0xe')]){_0x37ca3f[_0x43db('0x25')]=_0x14ad2d[_0x46fbb1][_0x43db('0x23')];}}}_0x41f167(_0x37ca3f);})[_0x43db('0x12')](function(_0x1c77f0){_0x1b895a(_0x1c77f0[_0x43db('0x15')]);});});}function createEndUser(_0x34d25b,_0x48d7cd,_0x29e1d2,_0x19e550,_0x449c60,_0x4c1b4f){return new BPromise(function(_0x375c02,_0x8db51f){return getAuthToken(_0x48d7cd,_0x29e1d2,_0x4c1b4f)[_0x43db('0x11')](function(_0xe9ae82){var _0x31600f=_0x4c1b4f[_0x43db('0x26')]()==='outbound'?_0x449c60[_0x43db('0x27')]:_0x449c60[_0x43db('0x28')];var _0x2b3c05={'method':_0x43db('0xb'),'uri':_0x19e550+_0x43db('0x29'),'body':{'telephone1':_0x31600f,'fullname':_0x31600f,'firstname':_0x31600f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x43db('0x2a')+_0x34d25b[_0x43db('0x25')]+')'},'headers':{'Authorization':_0x43db('0x18')+_0xe9ae82,'OData-Version':_0x43db('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x2b3c05);})[_0x43db('0x11')](function(_0x3ffed7){var _0x3201f1=_0x3ffed7['headers'][_0x43db('0x2b')];var _0x38a2a8=_0x3201f1[_0x43db('0x2c')](_0x3201f1[_0x43db('0x2d')]('(')+0x1,_0x3201f1[_0x43db('0x2d')](')'));_0x34d25b[_0x43db('0x2e')]=_0x38a2a8;_0x375c02(_0x34d25b);})['catch'](function(_0xc90ab5){_0x8db51f(_0xc90ab5[_0x43db('0x15')]);});});}function getEndUser(_0x35a91a,_0x3746d7,_0x44e1d8,_0x364302,_0x59e1da,_0xc219d){return new BPromise(function(_0x11c24f,_0x4b240a){return getAuthToken(_0x3746d7,_0x44e1d8,_0xc219d)[_0x43db('0x11')](function(_0x361727){var _0x28c9d4={'method':'GET','uri':_0x364302+_0x43db('0x2f'),'headers':{'Authorization':_0x43db('0x18')+_0x361727,'If-None-Match':null,'OData-Version':_0x43db('0x19')},'json':!![]};return rp(_0x28c9d4);})[_0x43db('0x11')](function(_0x26297c){var _0x2d2062=null;if(_0x26297c){var _0x3b68e9=_0x26297c[_0x43db('0x1a')];var _0x15d401=![];for(_0x2d2062=0x0;_0x2d2062<_0x3b68e9[_0x43db('0x1f')];_0x2d2062++){var _0x929345=_0xc219d[_0x43db('0x26')]()==='outbound'?_0x59e1da[_0x43db('0x27')]:_0x59e1da[_0x43db('0x28')];if(_0x3b68e9[_0x2d2062][_0x43db('0x30')]===_0x929345){_0x15d401=!![];_0x35a91a[_0x43db('0x2e')]=_0x3b68e9[_0x2d2062][_0x43db('0x31')];}}if(_0x15d401){_0x11c24f(_0x35a91a);}else{return createEndUser(_0x35a91a,_0x3746d7,_0x44e1d8,_0x364302,_0x59e1da,_0xc219d)[_0x43db('0x11')](function(_0x178f67){logger['info']('['+[_0xc219d[_0x43db('0x13')]()]+_0x43db('0x32'),_0x178f67[_0x43db('0x2e')]);_0x11c24f(_0x178f67);});}}else{return createEndUser(_0x35a91a,_0x3746d7,_0x44e1d8,_0x364302,_0x59e1da,_0xc219d)[_0x43db('0x11')](function(_0x8e04ee){logger[_0x43db('0x21')]('['+[_0xc219d[_0x43db('0x13')]()]+_0x43db('0x33'),_0x8e04ee[_0x43db('0x2e')]);_0x11c24f(_0x8e04ee);});}});});}function getCustomFields(_0x589b00,_0x31a9c,_0x250eeb){var _0x56aa72={};if(_0x589b00[_0x43db('0x1f')]>0x0){_[_0x43db('0x34')](_0x589b00,function(_0x41d185){if(_0x41d185[_0x43db('0x35')]==='string'&&_0x41d185[_0x43db('0x36')]&&!_0x41d185[_0x43db('0x37')]){var _0x47deb8=_0x41d185[_0x43db('0x38')][_0x43db('0x26')]();var _0x1b81ea=_0x47deb8[_0x43db('0x2c')](0x0,_0x47deb8[_0x43db('0x39')]('_'));var _0x5674d6=_0x47deb8['substring'](_0x47deb8[_0x43db('0x39')]('_')+0x1);if(_0x1b81ea===_0x250eeb){_0x56aa72[_0x5674d6]=_0x41d185[_0x43db('0x3a')];}}});}return _0x56aa72;}function getTicket(_0x2832fe,_0x202a98,_0x28c87a,_0x874447,_0x3ab231,_0x59464e,_0x2b9c51){return new BPromise(function(_0x3d3eb8,_0xb3d68c){var _0x4a20a4;return getAuthToken(_0x202a98,_0x28c87a,_0x2b9c51)['then'](function(_0x11a2ed){if(_0x59464e[_0x43db('0x3b')]===_0x43db('0x3c')){_0x4a20a4={'method':'POST','uri':_0x874447+_0x43db('0x3d'),'body':Object[_0x43db('0x3e')]({},{'title':intUtil['getString'](_0x59464e[_0x43db('0x3f')],_0x3ab231,'\x20'),'description':intUtil[_0x43db('0x40')](_0x59464e[_0x43db('0x41')],_0x3ab231,'\x0a'),'customerid_contact@odata.bind':_0x43db('0x42')+_0x2832fe[_0x43db('0x2e')]+')','ownerid@odata.bind':_0x43db('0x2a')+_0x2832fe[_0x43db('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x59464e[_0x43db('0x43')],_0x3ab231,_0x59464e[_0x43db('0x3b')])),'headers':{'Authorization':_0x43db('0x18')+_0x11a2ed,'OData-Version':_0x43db('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x59464e['ticketType']==='phonecall'){_0x4a20a4={'method':_0x43db('0xb'),'uri':_0x874447+_0x43db('0x44'),'body':Object[_0x43db('0x3e')]({},{'subject':intUtil[_0x43db('0x40')](_0x59464e['Subjects'],_0x3ab231,'\x20'),'phonenumber':String(_0x3ab231['calleridnum']),'description':intUtil[_0x43db('0x40')](_0x59464e[_0x43db('0x41')],_0x3ab231,'\x0a'),'regardingobjectid_contact@odata.bind':_0x43db('0x42')+_0x2832fe[_0x43db('0x2e')]+')','ownerid@odata.bind':'/systemusers('+_0x2832fe['userId']+')','directioncode':_0x2832fe[_0x43db('0x45')]===_0x43db('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x2832fe['userId']+')','participationtypemask':_0x2832fe[_0x43db('0x45')]===_0x43db('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0x43db('0x42')+_0x2832fe[_0x43db('0x2e')]+')','participationtypemask':_0x2832fe[_0x43db('0x45')]===_0x43db('0x46')?0x1:0x2}]},getCustomFields(_0x59464e[_0x43db('0x43')],_0x3ab231,_0x59464e['ticketType'])),'headers':{'Authorization':_0x43db('0x18')+_0x11a2ed,'OData-Version':_0x43db('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4a20a4);})['then'](function(_0x122a83){var _0x4d7cf6=_0x122a83[_0x43db('0x47')][_0x43db('0x2b')];var _0xeb4fe1=_0x4d7cf6['substring'](_0x4d7cf6[_0x43db('0x2d')]('(')+0x1,_0x4d7cf6[_0x43db('0x2d')](')'));_0x2832fe[_0x43db('0x48')]=_0xeb4fe1;_0x3d3eb8(_0x2832fe);})[_0x43db('0x12')](function(_0x4e5618){_0xb3d68c(_0x4e5618[_0x43db('0x15')]);});});}function emit(_0x39906d,_0x2be0aa,_0x17e315,_0x44b33e){var _0x1764ad={'uri':util[_0x43db('0x49')](_0x43db('0x4a'),_0x39906d,_0x17e315,_0x44b33e)};io['to'](util[_0x43db('0x49')](_0x43db('0x4b'),_0x2be0aa))[_0x43db('0x4c')]('trigger:browser:url',_0x1764ad);}exports['cs']=function(_0x4ae0a6,_0x1653d2,_0x34fef0,_0x4693e2,_0x795934,_0x3e1bc9,_0x350838,_0x4a0188){var _0x1b4e5b={};_0x3e1bc9[_0x43db('0xd')]=intUtil[_0x43db('0x4d')](_0x3e1bc9[_0x43db('0xd')]);_0x3e1bc9[_0x43db('0x4e')]=intUtil[_0x43db('0x4d')](_0x3e1bc9[_0x43db('0x4e')]);_0x1b4e5b[_0x43db('0x45')]=_0x4a0188===_0x43db('0x46')||_0x4a0188===_0x43db('0x4f')?_0x43db('0x46'):_0x43db('0x50');var _0x56ba90=util[_0x43db('0x49')](_0x43db('0x51'),_0x3e1bc9[_0x43db('0xd')]);var _0x472b75=util[_0x43db('0x49')]('https://login.microsoftonline.com/%s/oauth2/token',_0x3e1bc9[_0x43db('0x52')]);var _0x3fe2fa=util['format'](_0x43db('0x53'),_0x3e1bc9[_0x43db('0x4e')],_0x1653d2[_0x43db('0x54')],md5(_0x1653d2[_0x43db('0x54')]));if(_0x795934&&_0x795934[_0x43db('0x55')]){logger['info'](_0x43db('0x56'),_0x43db('0x57'));_0x1653d2[_0x43db('0x58')]=_0x3fe2fa;}else if(_0x350838&&_0x350838[_0x43db('0x59')]&&_0x350838[_0x43db('0x59')]!==_0x43db('0x5a')){logger[_0x43db('0x21')](_0x43db('0x5b'),'Recording\x20is\x20enabled!');_0x1653d2[_0x43db('0x58')]=_0x3fe2fa;}else{_0x1653d2[_0x43db('0x58')]='';}return getUser(_0x1b4e5b,_0x3e1bc9,_0x4693e2,_0x472b75,_0x56ba90,_0x4a0188)['then'](function(_0x10009f){logger['info']('['+_0x4a0188[_0x43db('0x13')]()+']\x20The\x20User\x20ID\x20is:',_0x10009f[_0x43db('0x25')]);logger['info']('['+_0x4a0188['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x10009f['userEmail']);return getEndUser(_0x10009f,_0x3e1bc9,_0x472b75,_0x56ba90,_0x1653d2,_0x4a0188);})[_0x43db('0x11')](function(_0x406bec){logger['info']('['+_0x4a0188[_0x43db('0x13')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x406bec[_0x43db('0x2e')]);logger[_0x43db('0x21')]('['+_0x4a0188[_0x43db('0x13')]()+_0x43db('0x5c'),_0x1653d2['calleridnum']);return getTicket(_0x406bec,_0x3e1bc9,_0x472b75,_0x56ba90,_0x1653d2,_0x34fef0,_0x4a0188);})['then'](function(_0x2cdeec){logger['info'](util[_0x43db('0x49')]('['+_0x4a0188[_0x43db('0x13')]()+_0x43db('0x5d'),_0x34fef0['ticketType'],_0x2cdeec[_0x43db('0x48')]));logger[_0x43db('0x21')](util[_0x43db('0x49')]('['+_0x4a0188[_0x43db('0x13')]()+_0x43db('0x5e'),_0x4a0188));if(_0x4a0188!=='unmanaged'){logger['info']('['+_0x4a0188[_0x43db('0x13')]()+']',_0x43db('0x5f'));emit(_0x3e1bc9['remoteUri'],_0x4693e2['name'],_0x34fef0[_0x43db('0x3b')],_0x2cdeec[_0x43db('0x48')]);}})['catch'](function(_0x54dd1d){logger['error']('['+_0x4a0188[_0x43db('0x13')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x43db('0x60')](_0x54dd1d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 6613210..c6e8e66 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 _0xbee7=['custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','defaults','map','forEach','type','string','nameField','customField','toLowerCase','idField','content','variable','variableName','push','customVariable','Variable','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d','catch','stringify','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','Authorization','The\x20User\x20ID\x20is:','destcalleridnum','trigger:browser:url','error','unmanaged','monitor_format','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Descriptions','
','name','Fields'];(function(_0x58a503,_0x2ae9df){var _0x587add=function(_0x13e50c){while(--_0x13e50c){_0x58a503['push'](_0x58a503['shift']());}};_0x587add(++_0x2ae9df);}(_0xbee7,0x1d0));var _0x7bee=function(_0x1dc82c,_0x4f43eb){_0x1dc82c=_0x1dc82c-0x0;var _0x39b34a=_0xbee7[_0x1dc82c];return _0x39b34a;};'use strict';var _=require(_0x7bee('0x0'));var rp=require(_0x7bee('0x1'));var md5=require(_0x7bee('0x2'));var util=require(_0x7bee('0x3'));var Redis=require(_0x7bee('0x4'));var intUtil=require(_0x7bee('0x5'));var config=require(_0x7bee('0x6'));var logger=require(_0x7bee('0x7'))(_0x7bee('0x8'));config['redis']=_['defaults'](config[_0x7bee('0x9')],{'host':_0x7bee('0xa'),'port':0x18eb});var io=require(_0x7bee('0xb'))(new Redis(config[_0x7bee('0x9')]));var headers={'Content-Type':_0x7bee('0xc'),'Accept':_0x7bee('0xc')};function emit(_0x1a75da,_0x2e7357,_0x574ccc){io['to'](_0x1a75da)[_0x7bee('0xd')](_0x2e7357,_0x574ccc);}function getTicket(_0x2bacb4,_0x5a4b7e,_0x522a1,_0x360010,_0x1cd733){logger[_0x7bee('0xe')](_0x7bee('0xf'));var _0x37d31c=_[_0x7bee('0x10')]({'responder_id':_0x5a4b7e['id'],'requester_id':_0x522a1['id'],'name':util['format'](_0x7bee('0x11'),_0x1cd733[_0x7bee('0x12')]),'phone':_0x1cd733[_0x7bee('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x360010[_0x7bee('0x14')],_0x1cd733,'\x20'),'description':intUtil[_0x7bee('0x15')](_0x360010[_0x7bee('0x16')],_0x1cd733,_0x7bee('0x17')),'tags':getTags(_0x360010['Tags'],_0x7bee('0x18'))},getCustomFields(_0x360010[_0x7bee('0x19')],_0x1cd733));_0x37d31c[_0x7bee('0x1a')]=_[_0x7bee('0x1b')](_[_0x7bee('0x1c')](_0x37d31c['custom_fields'],'id'),_0x7bee('0x1d'));return request({'uri':util[_0x7bee('0x1e')](_0x7bee('0x1f'),_0x2bacb4[_0x7bee('0x20')]),'method':_0x7bee('0x21'),'body':_0x37d31c})['then'](function(_0x3dda8c){logger[_0x7bee('0xe')](_0x7bee('0x22'));return _0x3dda8c;});}function getUser(_0x864b33,_0x6e882f){if(intUtil[_0x7bee('0x23')](_0x6e882f)){return request({'uri':util[_0x7bee('0x1e')](_0x7bee('0x24'),_0x864b33[_0x7bee('0x20')]),'qs':{'email':_0x6e882f}})[_0x7bee('0x25')](function(_0x173483){if(_0x173483[_0x7bee('0x26')]){logger[_0x7bee('0xe')](_0x7bee('0x27'));return _[_0x7bee('0x28')](_0x173483,function(_0x2ef03f){return _0x2ef03f[_0x7bee('0x29')][_0x7bee('0x2a')]===_0x6e882f;});}else{logger['info'](_0x7bee('0x2b'));return request({'uri':util['format'](_0x7bee('0x2c'),_0x864b33['remoteUri'])})[_0x7bee('0x25')](function(_0x598270){logger[_0x7bee('0xe')](_0x7bee('0x2d'));return _0x598270;});}});}else{logger[_0x7bee('0xe')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x7bee('0x1e')](_0x7bee('0x2c'),_0x864b33[_0x7bee('0x20')])})['then'](function(_0x358a53){logger['info'](_0x7bee('0x2d'));return _0x358a53;});}}function getEndUser(_0x3b63da,_0x23acca,_0xe2c595){logger['info'](_0x7bee('0x2e'),_0xe2c595);return request({'uri':util['format'](_0x7bee('0x2f'),_0x3b63da['remoteUri']),'qs':{'phone':_0xe2c595}})['then'](function(_0x1ce93e){if(_0x1ce93e[_0x7bee('0x26')]){logger[_0x7bee('0xe')]('Enduser\x20found!');return _[_0x7bee('0x28')](_0x1ce93e,{'phone':_0xe2c595});}else{logger[_0x7bee('0xe')](_0x7bee('0x30'));return request({'uri':util['format'](_0x7bee('0x2f'),_0x3b63da[_0x7bee('0x20')]),'method':_0x7bee('0x21'),'body':{'name':_0x23acca,'phone':_0xe2c595}})[_0x7bee('0x25')](function(_0x4d19f7){logger[_0x7bee('0xe')](_0x7bee('0x31'));return _0x4d19f7;});}});}function getAuth(_0x493f13){return util['format'](_0x7bee('0x32'),new Buffer(_0x493f13[_0x7bee('0x33')]+':X')[_0x7bee('0x34')](_0x7bee('0x35')));}function request(_0x56ec1b){logger[_0x7bee('0x36')](_0x7bee('0x37'),JSON['stringify'](_0x56ec1b));return rp(_[_0x7bee('0x38')](_0x56ec1b,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x295d49,_0x4e96ef){var _0x1d7ca9=[];if(_0x295d49&&_0x295d49[_0x7bee('0x26')]>0x0){_0x1d7ca9=_[_0x7bee('0x39')](_0x295d49,_0x4e96ef);}return _0x1d7ca9;}function getCustomFields(_0x1dcc40,_0x3ad71c){var _0x5e9659=[];var _0xe6268={'custom_fields':[]};if(_0x1dcc40[_0x7bee('0x26')]>0x0){_[_0x7bee('0x3a')](_0x1dcc40,function(_0x395150){if(_0x395150[_0x7bee('0x3b')]===_0x7bee('0x3c')&&_0x395150[_0x7bee('0x3d')]&&!_0x395150[_0x7bee('0x3e')]){_0xe6268[_0x395150[_0x7bee('0x3d')][_0x7bee('0x3f')]()]=_0x395150['content'][_0x7bee('0x34')]();}else if(_0x395150[_0x7bee('0x3b')]===_0x7bee('0x3c')&&_0x395150[_0x7bee('0x40')]&&_0x395150['customField']){_0xe6268[_0x7bee('0x1a')]['push']({'id':_0x395150['idField'],'value':_0x395150[_0x7bee('0x41')]['toString']()});}else if(_0x395150[_0x7bee('0x3b')]===_0x7bee('0x42')&&_0x395150[_0x7bee('0x43')]&&_0x395150[_0x7bee('0x40')]&&_0x395150[_0x7bee('0x3e')]){_0x3ad71c[_0x395150[_0x7bee('0x43')]]&&_0xe6268[_0x7bee('0x1a')][_0x7bee('0x44')]({'id':_0x395150[_0x7bee('0x40')],'value':_0x3ad71c[_0x395150[_0x7bee('0x43')]][_0x7bee('0x34')]()});}else if(_0x395150[_0x7bee('0x3b')]===_0x7bee('0x45')&&_0x395150[_0x7bee('0x46')]&&_0x395150[_0x7bee('0x46')][_0x7bee('0x18')]&&_0x395150[_0x7bee('0x40')]&&_0x395150[_0x7bee('0x3e')]){_0x3ad71c[_0x395150[_0x7bee('0x46')][_0x7bee('0x18')][_0x7bee('0x3f')]()]&&_0xe6268['custom_fields'][_0x7bee('0x44')]({'id':_0x395150['idField'],'value':_0x3ad71c[_0x395150[_0x7bee('0x46')]['name'][_0x7bee('0x3f')]()][_0x7bee('0x34')]()});}});}return _0xe6268;}exports['queue']=function(_0x188070,_0x1b1e34,_0x5273a6,_0x3fbe7b,_0x996f5e,_0x300eea){var _0x2411fe,_0x55c350;_0x300eea['remoteUri']=intUtil[_0x7bee('0x47')](_0x300eea[_0x7bee('0x20')]);_0x300eea['serverUrl']=intUtil[_0x7bee('0x47')](_0x300eea[_0x7bee('0x48')]);if(_0x996f5e&&_0x996f5e['monitor_format']){logger[_0x7bee('0xe')]('[QUEUE]','Recording\x20is\x20enabled!');_0x1b1e34[_0x7bee('0x49')]=util[_0x7bee('0x1e')](_0x7bee('0x4a'),_0x300eea[_0x7bee('0x48')],_0x1b1e34['uniqueid'],md5(_0x1b1e34[_0x7bee('0x4b')]));}else{_0x1b1e34[_0x7bee('0x49')]='';}headers['Authorization']=getAuth(_0x300eea);return getUser(_0x300eea,_0x3fbe7b['email'])['then'](function(_0x168ada){_0x2411fe=_0x168ada;logger[_0x7bee('0xe')]('The\x20User\x20ID\x20is:',_0x2411fe['id']);return getEndUser(_0x300eea,_0x1b1e34[_0x7bee('0x12')],_0x1b1e34['calleridnum']);})['then'](function(_0xeda9e6){_0x55c350=_0xeda9e6;logger[_0x7bee('0xe')](_0x7bee('0x4c'),_0x55c350['id']);return getTicket(_0x300eea,_0x2411fe,_0x55c350,_0x5273a6,_0x1b1e34);})[_0x7bee('0x25')](function(_0x44d56c){if(_0x44d56c&&_0x44d56c['id']){logger[_0x7bee('0xe')](_0x7bee('0x22'));logger[_0x7bee('0xe')](_0x7bee('0x4d'),_0x44d56c['id']);logger[_0x7bee('0xe')](_0x7bee('0x4e'),_0x7bee('0x4f'));emit(util['format'](_0x7bee('0x50'),_0x3fbe7b[_0x7bee('0x18')]),'trigger:browser:url',{'uri':util[_0x7bee('0x1e')](_0x7bee('0x51'),_0x300eea[_0x7bee('0x20')],_0x44d56c['id'])});}})[_0x7bee('0x52')](function(_0x11d3d9){logger['error'](_0x7bee('0x4e'),JSON[_0x7bee('0x53')](_0x11d3d9));});};exports[_0x7bee('0x54')]=function(_0x3603bd,_0x3e0e8b,_0x1e7ef1,_0x1475a3,_0x24bbac,_0xff127c,_0x192fbc){var _0x566e47,_0x341238;_0xff127c[_0x7bee('0x20')]=intUtil[_0x7bee('0x47')](_0xff127c[_0x7bee('0x20')]);_0xff127c['serverUrl']=intUtil[_0x7bee('0x47')](_0xff127c['serverUrl']);if(_0x192fbc&&_0x192fbc[_0x7bee('0x55')]&&_0x192fbc[_0x7bee('0x55')]!==_0x7bee('0x56')){logger[_0x7bee('0xe')](_0x7bee('0x57'),_0x7bee('0x58'));_0x3e0e8b[_0x7bee('0x49')]=util[_0x7bee('0x1e')](_0x7bee('0x4a'),_0xff127c['serverUrl'],_0x3e0e8b[_0x7bee('0x4b')],md5(_0x3e0e8b[_0x7bee('0x4b')]));}headers[_0x7bee('0x59')]=getAuth(_0xff127c);return getUser(_0xff127c,_0x1475a3['email'])[_0x7bee('0x25')](function(_0x15bd51){_0x566e47=_0x15bd51;logger[_0x7bee('0xe')](_0x7bee('0x5a'),_0x566e47['id']);return getEndUser(_0xff127c,_0x3e0e8b['destcalleridname'],_0x3e0e8b[_0x7bee('0x5b')]);})[_0x7bee('0x25')](function(_0x4da633){_0x341238=_0x4da633;logger[_0x7bee('0xe')](_0x7bee('0x4c'),_0x341238['id']);return getTicket(_0xff127c,_0x566e47,_0x341238,_0x1e7ef1,_0x3e0e8b);})[_0x7bee('0x25')](function(_0x59ad29){if(_0x59ad29&&_0x59ad29['id']){logger[_0x7bee('0xe')]('Ticket\x20created!');logger[_0x7bee('0xe')]('The\x20Ticket\x20ID\x20is:',_0x59ad29['id']);logger[_0x7bee('0xe')]('[OUTBOUND]',_0x7bee('0x4f'));emit(util[_0x7bee('0x1e')](_0x7bee('0x50'),_0x1475a3[_0x7bee('0x18')]),_0x7bee('0x5c'),{'uri':util[_0x7bee('0x1e')](_0x7bee('0x51'),_0xff127c[_0x7bee('0x20')],_0x59ad29['id'])});}})[_0x7bee('0x52')](function(_0x2c1ab1){logger[_0x7bee('0x5d')](_0x7bee('0x57'),JSON[_0x7bee('0x53')](_0x2c1ab1));});};exports[_0x7bee('0x5e')]=function(_0x3389f3,_0x5b6b95,_0x32ec6f,_0x4d503d,_0x513b88,_0x3432e0){var _0x202515,_0x43a20b;_0x3432e0[_0x7bee('0x20')]=intUtil[_0x7bee('0x47')](_0x3432e0['remoteUri']);_0x3432e0[_0x7bee('0x48')]=intUtil[_0x7bee('0x47')](_0x3432e0[_0x7bee('0x48')]);if(_0x513b88&&_0x513b88[_0x7bee('0x5f')]){logger[_0x7bee('0xe')]('['+_0x5b6b95[_0x7bee('0x60')][_0x7bee('0x61')]()+']','Recording\x20is\x20enabled!');_0x5b6b95[_0x7bee('0x49')]=util[_0x7bee('0x1e')](_0x7bee('0x4a'),_0x3432e0[_0x7bee('0x48')],_0x5b6b95[_0x7bee('0x4b')],md5(_0x5b6b95['uniqueid']));}else{_0x5b6b95['recordingURL']='';}headers['Authorization']=getAuth(_0x3432e0);return getUser(_0x3432e0,'')[_0x7bee('0x25')](function(_0x39fcef){_0x202515=_0x39fcef;logger[_0x7bee('0xe')](_0x7bee('0x5a'),_0x202515['id']);return getEndUser(_0x3432e0,_0x5b6b95[_0x7bee('0x12')],_0x5b6b95[_0x7bee('0x13')]);})['then'](function(_0x5994c1){_0x43a20b=_0x5994c1;logger['info'](_0x7bee('0x4c'),_0x43a20b['id']);return getTicket(_0x3432e0,_0x202515,_0x43a20b,_0x32ec6f,_0x5b6b95);})[_0x7bee('0x25')](function(_0x2871fe){if(_0x2871fe){logger[_0x7bee('0xe')](_0x7bee('0x22'));logger['info'](_0x7bee('0x4d'),_0x2871fe['id']);}})[_0x7bee('0x52')](function(_0x3bb3e6){logger['error']('['+_0x5b6b95['lastevent'][_0x7bee('0x61')]()+']',JSON['stringify'](_0x3bb3e6));});}; \ No newline at end of file +var _0xa866=['keyBy','custom_fields','value','remoteUri','then','validateEmail','%s/api/v2/agents','length','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','toString','base64','debug','stringify','map','forEach','type','string','nameField','content','idField','push','variable','customField','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','unmanaged','lastevent','toUpperCase','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','
','name','Fields'];(function(_0x23ae86,_0x1ca899){var _0x240cfd=function(_0x38f6d1){while(--_0x38f6d1){_0x23ae86['push'](_0x23ae86['shift']());}};_0x240cfd(++_0x1ca899);}(_0xa866,0x199));var _0x6a86=function(_0x1fc2d5,_0x54555c){_0x1fc2d5=_0x1fc2d5-0x0;var _0x315041=_0xa866[_0x1fc2d5];return _0x315041;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x6a86('0x0'));var util=require(_0x6a86('0x1'));var Redis=require(_0x6a86('0x2'));var intUtil=require(_0x6a86('0x3'));var config=require(_0x6a86('0x4'));var logger=require('../../../../config/logger')('freshdesk');config[_0x6a86('0x5')]=_[_0x6a86('0x6')](config['redis'],{'host':_0x6a86('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6a86('0x5')]));var headers={'Content-Type':'application/json','Accept':_0x6a86('0x8')};function emit(_0xdeb211,_0x2ad021,_0x4b7019){io['to'](_0xdeb211)[_0x6a86('0x9')](_0x2ad021,_0x4b7019);}function getTicket(_0x267549,_0x4d8c8d,_0x3fcc4b,_0x1981b8,_0x9ce961){logger[_0x6a86('0xa')]('Creating\x20new\x20ticket...');var _0x2152ed=_[_0x6a86('0xb')]({'responder_id':_0x4d8c8d['id'],'requester_id':_0x3fcc4b['id'],'name':util[_0x6a86('0xc')](_0x6a86('0xd'),_0x9ce961[_0x6a86('0xe')]),'phone':_0x9ce961[_0x6a86('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x6a86('0x10')](_0x1981b8[_0x6a86('0x11')],_0x9ce961,'\x20'),'description':intUtil[_0x6a86('0x10')](_0x1981b8['Descriptions'],_0x9ce961,_0x6a86('0x12')),'tags':getTags(_0x1981b8['Tags'],_0x6a86('0x13'))},getCustomFields(_0x1981b8[_0x6a86('0x14')],_0x9ce961));_0x2152ed['custom_fields']=_['mapValues'](_[_0x6a86('0x15')](_0x2152ed[_0x6a86('0x16')],'id'),_0x6a86('0x17'));return request({'uri':util['format']('%s/api/v2/tickets',_0x267549[_0x6a86('0x18')]),'method':'POST','body':_0x2152ed})[_0x6a86('0x19')](function(_0x15457c){logger[_0x6a86('0xa')]('Ticket\x20created!');return _0x15457c;});}function getUser(_0x5ec17d,_0x3d1bdf){if(intUtil[_0x6a86('0x1a')](_0x3d1bdf)){return request({'uri':util[_0x6a86('0xc')](_0x6a86('0x1b'),_0x5ec17d[_0x6a86('0x18')]),'qs':{'email':_0x3d1bdf}})[_0x6a86('0x19')](function(_0x4f2e66){if(_0x4f2e66[_0x6a86('0x1c')]){logger[_0x6a86('0xa')]('Agent\x20found!');return _[_0x6a86('0x1d')](_0x4f2e66,function(_0xd5023a){return _0xd5023a[_0x6a86('0x1e')][_0x6a86('0x1f')]===_0x3d1bdf;});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x6a86('0xc')](_0x6a86('0x20'),_0x5ec17d[_0x6a86('0x18')])})[_0x6a86('0x19')](function(_0x83338){logger[_0x6a86('0xa')](_0x6a86('0x21'));return _0x83338;});}});}else{logger[_0x6a86('0xa')](_0x6a86('0x22'));return request({'uri':util['format'](_0x6a86('0x20'),_0x5ec17d[_0x6a86('0x18')])})[_0x6a86('0x19')](function(_0x334c95){logger[_0x6a86('0xa')]('Admin\x20account\x20selected.');return _0x334c95;});}}function getEndUser(_0x35a270,_0x4225cb,_0x4200c2){logger[_0x6a86('0xa')](_0x6a86('0x23'),_0x4200c2);return request({'uri':util[_0x6a86('0xc')](_0x6a86('0x24'),_0x35a270[_0x6a86('0x18')]),'qs':{'phone':_0x4200c2}})[_0x6a86('0x19')](function(_0x2fb5e8){if(_0x2fb5e8['length']){logger['info']('Enduser\x20found!');return _[_0x6a86('0x1d')](_0x2fb5e8,{'phone':_0x4200c2});}else{logger[_0x6a86('0xa')](_0x6a86('0x25'));return request({'uri':util[_0x6a86('0xc')](_0x6a86('0x24'),_0x35a270['remoteUri']),'method':_0x6a86('0x26'),'body':{'name':_0x4225cb,'phone':_0x4200c2}})[_0x6a86('0x19')](function(_0x541266){logger[_0x6a86('0xa')](_0x6a86('0x27'));return _0x541266;});}});}function getAuth(_0x26349b){return util[_0x6a86('0xc')](_0x6a86('0x28'),new Buffer(_0x26349b['apiKey']+':X')[_0x6a86('0x29')](_0x6a86('0x2a')));}function request(_0x30918c){logger[_0x6a86('0x2b')]('[HTTP]',JSON[_0x6a86('0x2c')](_0x30918c));return rp(_[_0x6a86('0x6')](_0x30918c,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x213476,_0x44a217){var _0x36d3f1=[];if(_0x213476&&_0x213476['length']>0x0){_0x36d3f1=_[_0x6a86('0x2d')](_0x213476,_0x44a217);}return _0x36d3f1;}function getCustomFields(_0x31a8ae,_0x1dc8fb){var _0x4ba888=[];var _0xbb514a={'custom_fields':[]};if(_0x31a8ae['length']>0x0){_[_0x6a86('0x2e')](_0x31a8ae,function(_0xb517e4){if(_0xb517e4[_0x6a86('0x2f')]===_0x6a86('0x30')&&_0xb517e4[_0x6a86('0x31')]&&!_0xb517e4['customField']){_0xbb514a[_0xb517e4[_0x6a86('0x31')]['toLowerCase']()]=_0xb517e4[_0x6a86('0x32')]['toString']();}else if(_0xb517e4[_0x6a86('0x2f')]===_0x6a86('0x30')&&_0xb517e4[_0x6a86('0x33')]&&_0xb517e4['customField']){_0xbb514a[_0x6a86('0x16')][_0x6a86('0x34')]({'id':_0xb517e4[_0x6a86('0x33')],'value':_0xb517e4[_0x6a86('0x32')][_0x6a86('0x29')]()});}else if(_0xb517e4['type']===_0x6a86('0x35')&&_0xb517e4['variableName']&&_0xb517e4[_0x6a86('0x33')]&&_0xb517e4[_0x6a86('0x36')]){_0x1dc8fb[_0xb517e4[_0x6a86('0x37')]]&&_0xbb514a[_0x6a86('0x16')][_0x6a86('0x34')]({'id':_0xb517e4['idField'],'value':_0x1dc8fb[_0xb517e4[_0x6a86('0x37')]][_0x6a86('0x29')]()});}else if(_0xb517e4[_0x6a86('0x2f')]===_0x6a86('0x38')&&_0xb517e4[_0x6a86('0x39')]&&_0xb517e4[_0x6a86('0x39')][_0x6a86('0x13')]&&_0xb517e4['idField']&&_0xb517e4['customField']){_0x1dc8fb[_0xb517e4[_0x6a86('0x39')][_0x6a86('0x13')][_0x6a86('0x3a')]()]&&_0xbb514a[_0x6a86('0x16')][_0x6a86('0x34')]({'id':_0xb517e4['idField'],'value':_0x1dc8fb[_0xb517e4[_0x6a86('0x39')][_0x6a86('0x13')]['toLowerCase']()][_0x6a86('0x29')]()});}});}return _0xbb514a;}exports[_0x6a86('0x3b')]=function(_0x16956d,_0x3be704,_0x555818,_0x1a1182,_0x29c5eb,_0x40576a){var _0x190da7,_0x13fa95;_0x40576a['remoteUri']=intUtil[_0x6a86('0x3c')](_0x40576a['remoteUri']);_0x40576a[_0x6a86('0x3d')]=intUtil[_0x6a86('0x3c')](_0x40576a['serverUrl']);if(_0x29c5eb&&_0x29c5eb[_0x6a86('0x3e')]){logger[_0x6a86('0xa')](_0x6a86('0x3f'),'Recording\x20is\x20enabled!');_0x3be704[_0x6a86('0x40')]=util[_0x6a86('0xc')](_0x6a86('0x41'),_0x40576a[_0x6a86('0x3d')],_0x3be704[_0x6a86('0x42')],md5(_0x3be704[_0x6a86('0x42')]));}else{_0x3be704[_0x6a86('0x40')]='';}headers[_0x6a86('0x43')]=getAuth(_0x40576a);return getUser(_0x40576a,_0x1a1182[_0x6a86('0x1f')])[_0x6a86('0x19')](function(_0x294faf){_0x190da7=_0x294faf;logger[_0x6a86('0xa')](_0x6a86('0x44'),_0x190da7['id']);return getEndUser(_0x40576a,_0x3be704[_0x6a86('0xe')],_0x3be704[_0x6a86('0xf')]);})['then'](function(_0x28ec3d){_0x13fa95=_0x28ec3d;logger[_0x6a86('0xa')](_0x6a86('0x45'),_0x13fa95['id']);return getTicket(_0x40576a,_0x190da7,_0x13fa95,_0x555818,_0x3be704);})[_0x6a86('0x19')](function(_0x53bd6c){if(_0x53bd6c&&_0x53bd6c['id']){logger[_0x6a86('0xa')](_0x6a86('0x46'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x53bd6c['id']);logger['info'](_0x6a86('0x3f'),_0x6a86('0x47'));emit(util[_0x6a86('0xc')](_0x6a86('0x48'),_0x1a1182['name']),_0x6a86('0x49'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x40576a[_0x6a86('0x18')],_0x53bd6c['id'])});}})[_0x6a86('0x4a')](function(_0x1b3391){logger[_0x6a86('0x4b')](_0x6a86('0x3f'),JSON[_0x6a86('0x2c')](_0x1b3391));});};exports[_0x6a86('0x4c')]=function(_0x1be9b4,_0x73d302,_0x32285f,_0x52a9fe,_0xeb6170,_0x3c8098,_0x29539e){var _0x506114,_0x4a178e;_0x3c8098['remoteUri']=intUtil[_0x6a86('0x3c')](_0x3c8098[_0x6a86('0x18')]);_0x3c8098[_0x6a86('0x3d')]=intUtil[_0x6a86('0x3c')](_0x3c8098[_0x6a86('0x3d')]);if(_0x29539e&&_0x29539e['recordingFormat']&&_0x29539e[_0x6a86('0x4d')]!=='none'){logger['info'](_0x6a86('0x4e'),_0x6a86('0x4f'));_0x73d302[_0x6a86('0x40')]=util[_0x6a86('0xc')](_0x6a86('0x41'),_0x3c8098[_0x6a86('0x3d')],_0x73d302[_0x6a86('0x42')],md5(_0x73d302[_0x6a86('0x42')]));}headers[_0x6a86('0x43')]=getAuth(_0x3c8098);return getUser(_0x3c8098,_0x52a9fe[_0x6a86('0x1f')])[_0x6a86('0x19')](function(_0x5a824b){_0x506114=_0x5a824b;logger[_0x6a86('0xa')](_0x6a86('0x44'),_0x506114['id']);return getEndUser(_0x3c8098,_0x73d302[_0x6a86('0x50')],_0x73d302[_0x6a86('0x51')]);})[_0x6a86('0x19')](function(_0x435c08){_0x4a178e=_0x435c08;logger[_0x6a86('0xa')](_0x6a86('0x45'),_0x4a178e['id']);return getTicket(_0x3c8098,_0x506114,_0x4a178e,_0x32285f,_0x73d302);})['then'](function(_0x528a87){if(_0x528a87&&_0x528a87['id']){logger['info'](_0x6a86('0x46'));logger[_0x6a86('0xa')](_0x6a86('0x52'),_0x528a87['id']);logger[_0x6a86('0xa')](_0x6a86('0x4e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6a86('0xc')]('user:%s',_0x52a9fe[_0x6a86('0x13')]),_0x6a86('0x49'),{'uri':util[_0x6a86('0xc')]('%s/helpdesk/tickets/%d',_0x3c8098[_0x6a86('0x18')],_0x528a87['id'])});}})[_0x6a86('0x4a')](function(_0x225b12){logger[_0x6a86('0x4b')](_0x6a86('0x4e'),JSON['stringify'](_0x225b12));});};exports[_0x6a86('0x53')]=function(_0x56705b,_0x3751d7,_0x38861e,_0x525697,_0x552648,_0x367c67){var _0x3dac13,_0x44743b;_0x367c67[_0x6a86('0x18')]=intUtil[_0x6a86('0x3c')](_0x367c67[_0x6a86('0x18')]);_0x367c67[_0x6a86('0x3d')]=intUtil['stripTrailingSlash'](_0x367c67['serverUrl']);if(_0x552648&&_0x552648[_0x6a86('0x3e')]){logger['info']('['+_0x3751d7[_0x6a86('0x54')][_0x6a86('0x55')]()+']',_0x6a86('0x4f'));_0x3751d7[_0x6a86('0x40')]=util['format'](_0x6a86('0x41'),_0x367c67[_0x6a86('0x3d')],_0x3751d7[_0x6a86('0x42')],md5(_0x3751d7['uniqueid']));}else{_0x3751d7[_0x6a86('0x40')]='';}headers[_0x6a86('0x43')]=getAuth(_0x367c67);return getUser(_0x367c67,'')['then'](function(_0x4a219c){_0x3dac13=_0x4a219c;logger[_0x6a86('0xa')]('The\x20User\x20ID\x20is:',_0x3dac13['id']);return getEndUser(_0x367c67,_0x3751d7[_0x6a86('0xe')],_0x3751d7['calleridnum']);})[_0x6a86('0x19')](function(_0x3dd4b6){_0x44743b=_0x3dd4b6;logger['info'](_0x6a86('0x45'),_0x44743b['id']);return getTicket(_0x367c67,_0x3dac13,_0x44743b,_0x38861e,_0x3751d7);})[_0x6a86('0x19')](function(_0xdfcd3){if(_0xdfcd3){logger[_0x6a86('0xa')](_0x6a86('0x46'));logger[_0x6a86('0xa')]('The\x20Ticket\x20ID\x20is:',_0xdfcd3['id']);}})['catch'](function(_0x18d773){logger[_0x6a86('0x4b')]('['+_0x3751d7[_0x6a86('0x54')][_0x6a86('0x55')]()+']',JSON[_0x6a86('0x2c')](_0x18d773));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshsales.js b/server/services/ami/trigger/integration/freshsales.js index 165c09e..5ee72f5 100644 --- a/server/services/ami/trigger/integration/freshsales.js +++ b/server/services/ami/trigger/integration/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x22c4=['/api/contacts','format','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','Subjects','getString','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','/contacts/','user:%s','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','callDirection','queue','unmanaged','agentEmail','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','moment','bluebird','ioredis','./util','freshsales','redis','defaults','socket.io-emitter','GET','/api/selector/owners','length','email','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','headers','Getting\x20user\x20list','then','users','userId','User\x20found:','Admin\x20selected','userEmail','catch','message','/api/contacts/filters','filters','forEach','All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','contacts','find','work_number','contactNumber','mobile_number','Contact\x20found:','Contact\x20created:','endUserId','POST'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x22c4,0x81));var _0x422c=function(_0x3efe87,_0x35ad48){_0x3efe87=_0x3efe87-0x0;var _0x56a4cc=_0x22c4[_0x3efe87];return _0x56a4cc;};'use strict';var _=require(_0x422c('0x0'));var rp=require('request-promise');var md5=require(_0x422c('0x1'));var util=require(_0x422c('0x2'));var moment=require(_0x422c('0x3'));var Promise=require(_0x422c('0x4'));var Redis=require(_0x422c('0x5'));var intUtil=require(_0x422c('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x422c('0x7'));config[_0x422c('0x8')]=_[_0x422c('0x9')](config[_0x422c('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x422c('0xa'))(new Redis(config['redis']));function getAdminId(_0x23024e,_0x5dc273,_0xeba327,_0x46c05e){return new Promise(function(_0x1a0c4d,_0x2d0fdd){var _0x4c46d7=![];var _0x2a97cf={'method':_0x422c('0xb'),'uri':_0x46c05e+_0x422c('0xc'),'json':!![]};_0x2a97cf['headers']=_0xeba327;logger['info']('Getting\x20admin\x20information');return rp(_0x2a97cf)['then'](function(_0x42f2ac){if(_0x42f2ac){var _0x1111fc=_0x42f2ac['users'];var _0x60596d=null;for(_0x60596d=0x0;_0x60596d<_0x1111fc[_0x422c('0xd')];_0x60596d++){if(_0x1111fc[_0x60596d][_0x422c('0xe')]===_0x23024e[_0x422c('0xf')]){_0x23024e[_0x422c('0x10')]=_0x1111fc[_0x60596d]['id'];_0x4c46d7=!![];}}if(_0x4c46d7){logger[_0x422c('0x11')](_0x422c('0x12'),_0x23024e[_0x422c('0x10')]);_0x1a0c4d(_0x23024e);}else{_0x2d0fdd({'statusCode':0x194,'message':_0x422c('0x13')});}}else{_0x2d0fdd({'statusCode':0x194,'message':_0x422c('0x13')});}})['catch'](function(_0x1aad69){logger[_0x422c('0x14')]('['+[_0x5dc273[_0x422c('0x15')]()]+']',_0x1aad69['message']);_0x2d0fdd(_0x1aad69);});});}function getUser(_0x3f86cd,_0x229ecf,_0x35b89b){return function(_0x103fc2){return new Promise(function(_0x3d8fcd,_0x2eb899){var _0x4a500b={'method':_0x422c('0xb'),'uri':_0x35b89b+'/api/selector/owners','json':!![]};_0x4a500b[_0x422c('0x16')]=_0x229ecf;logger[_0x422c('0x11')](_0x422c('0x17'));return rp(_0x4a500b)[_0x422c('0x18')](function(_0x4fd566){if(_0x4fd566){var _0xa9af93=_0x4fd566[_0x422c('0x19')];var _0x36dc8e=![];var _0x50d58e=null;if(_0x103fc2['agentEmail']!==null){logger['info']('Getting\x20user\x20with\x20email',_0x103fc2['agentEmail']);_0x103fc2['userEmail']=_0x103fc2['agentEmail'];for(_0x50d58e=0x0;_0x50d58e<_0xa9af93[_0x422c('0xd')];_0x50d58e++){if(_0xa9af93[_0x50d58e]['email']===_0x103fc2['agentEmail']){_0x36dc8e=!![];_0x103fc2[_0x422c('0x1a')]=_0xa9af93[_0x50d58e]['id'];logger[_0x422c('0x11')](_0x422c('0x1b'),_0x103fc2['userId']);}}}if(!_0x36dc8e){logger['info'](_0x422c('0x1c'));_0x103fc2[_0x422c('0x1d')]=_0x103fc2[_0x422c('0xf')];_0x103fc2[_0x422c('0x1a')]=_0x103fc2[_0x422c('0x10')];_0x36dc8e=!![];}if(_0x36dc8e){_0x3d8fcd(_0x103fc2);}else{_0x2eb899({'statusCode':0x194,'message':_0x422c('0x13')});}}else{_0x2eb899({'statusCode':0x194,'message':_0x422c('0x13')});}})[_0x422c('0x1e')](function(_0x390ee8){logger[_0x422c('0x14')]('['+[_0x3f86cd['toUpperCase']()]+']',_0x390ee8[_0x422c('0x1f')]);_0x2eb899(_0x390ee8);});});};}function getEndUser(_0x537de8,_0x49d4cd,_0xd7b76c){return function(_0x38db3b){return new Promise(function(_0x445353,_0xd8729e){var _0x564b45=0x0;var _0x3a6204={'method':_0x422c('0xb'),'uri':_0xd7b76c+_0x422c('0x20'),'json':!![]};_0x3a6204[_0x422c('0x16')]=_0x49d4cd;logger[_0x422c('0x11')]('Getting\x20contacts\x20filter');return rp(_0x3a6204)[_0x422c('0x18')](function(_0x5f2204){_0x5f2204[_0x422c('0x21')][_0x422c('0x22')](function(_0x437cde){if(_0x437cde['name']===_0x422c('0x23')){_0x564b45=_0x437cde['id'];}});})[_0x422c('0x18')](function(){logger['info'](_0x422c('0x24'));var _0xdf7be4={'method':_0x422c('0xb'),'uri':_0xd7b76c+_0x422c('0x25')+_0x564b45,'json':!![]};_0xdf7be4['headers']=_0x49d4cd;return rp(_0xdf7be4);})[_0x422c('0x18')](function(_0x572b34){logger['info']('Searching\x20contact\x20with\x20phone',_0x38db3b['contactNumber']);if(_0x572b34[_0x422c('0x26')][_0x422c('0xd')]>0x0){var _0x2f5a92=_[_0x422c('0x27')](_0x572b34['contacts'],function(_0x829c82){if(_0x829c82[_0x422c('0x28')]===_0x38db3b[_0x422c('0x29')]||_0x829c82[_0x422c('0x2a')]===_0x38db3b[_0x422c('0x29')]){return _0x829c82;}});if(_0x2f5a92){_0x38db3b['endUserId']=_0x2f5a92['id'];logger['info'](_0x422c('0x2b'),_0x38db3b['endUserId']);_0x445353(_0x38db3b);}else{return createEndUser(_0x38db3b,_0x537de8,_0x49d4cd,_0xd7b76c)[_0x422c('0x18')](function(_0x1c33f9){logger[_0x422c('0x11')](_0x422c('0x2c'),_0x38db3b['endUserId']);_0x445353(_0x1c33f9);});}}else{return createEndUser(_0x38db3b,_0x537de8,_0x49d4cd,_0xd7b76c)[_0x422c('0x18')](function(_0x19402c){logger[_0x422c('0x11')](_0x422c('0x2c'),_0x38db3b[_0x422c('0x2d')]);_0x445353(_0x19402c);});}})['catch'](function(_0x4dd34a){throw new Error(_0x4dd34a['message']);});});};}function createEndUser(_0x5d082b,_0x346b5b,_0x26814f,_0x1fa990){return new Promise(function(_0xdfcaf6,_0xbc6d71){var _0x38f893=moment();var _0x5b08e2={'method':_0x422c('0x2e'),'uri':_0x1fa990+_0x422c('0x2f'),'body':{'contact':{'last_name':_0x5d082b[_0x422c('0x29')],'work_number':_0x5d082b[_0x422c('0x29')],'mobile_number':_0x5d082b['contactNumber'],'owner_id':_0x5d082b[_0x422c('0x1a')],'created_at':_0x38f893[_0x422c('0x30')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x5b08e2[_0x422c('0x16')]=_0x26814f;logger[_0x422c('0x11')](_0x422c('0x31'));return rp(_0x5b08e2)['then'](function(_0x1f2992){_0x5d082b[_0x422c('0x2d')]=_0x1f2992[_0x422c('0x32')]['id'];_0xdfcaf6(_0x5d082b);})[_0x422c('0x1e')](function(_0x5ee196){logger[_0x422c('0x14')]('['+[_0x346b5b[_0x422c('0x15')]()]+']',_0x5ee196['message']);_0xbc6d71(_0x5ee196['message']);});});}function getTicket(_0x276fb6,_0x55285c,_0x580d19,_0x44ad4e,_0x21356b){return function(_0x4c926b){logger[_0x422c('0x11')]('Creating\x20new\x20task');return new Promise(function(_0x28b585,_0x5be24f){var _0x299692=moment();var _0x1d77e1={'method':'POST','uri':_0x580d19+_0x422c('0x33'),'body':{'title':intUtil['getString'](_0x44ad4e[_0x422c('0x34')],_0x21356b,'\x20'),'description':intUtil[_0x422c('0x35')](_0x44ad4e[_0x422c('0x36')],_0x21356b,'\x0a'),'owner_id':_0x4c926b[_0x422c('0x1a')],'creater_id':_0x4c926b[_0x422c('0x10')],'targetable_id':_0x4c926b[_0x422c('0x2d')],'targetable_type':_0x422c('0x37'),'created_at':_0x299692[_0x422c('0x30')](_0x422c('0x38')),'due_date':_0x299692[_0x422c('0x39')](0x1e,'m')[_0x422c('0x30')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x1d77e1[_0x422c('0x16')]=_0x55285c;return rp(_0x1d77e1)[_0x422c('0x18')](function(_0x2f5a5a){_0x4c926b[_0x422c('0x3a')]=_0x2f5a5a[_0x422c('0x3b')]['id'];logger['info'](_0x422c('0x3c'),_0x4c926b[_0x422c('0x3a')]);_0x28b585(_0x4c926b);})['catch'](function(_0xc7c551){logger[_0x422c('0x14')]('['+[_0x276fb6[_0x422c('0x15')]()]+']',_0xc7c551['message']);_0x5be24f(_0xc7c551[_0x422c('0x1f')]);});});};}function emit(_0x8cacca,_0x320109,_0x247526){var _0x2f524d={'uri':_0x8cacca+_0x422c('0x3d')+_0x247526};io['to'](util[_0x422c('0x30')](_0x422c('0x3e'),_0x320109))['emit']('trigger:browser:url',_0x2f524d);}exports['cs']=function(_0x4b1bfc,_0x1d363d,_0x2ccc39,_0x48526d,_0x585a7c,_0x114452,_0x1b50e3,_0x3f3b71){var _0x217aae={};var _0x381ee3={'Authorization':_0x422c('0x3f')+_0x114452[_0x422c('0x40')]};_0x114452[_0x422c('0x41')]=intUtil[_0x422c('0x42')](_0x114452[_0x422c('0x41')]);_0x114452[_0x422c('0x43')]=intUtil['stripTrailingSlash'](_0x114452['serverUrl']);var _0x3d5443=_0x114452[_0x422c('0x41')];_0x217aae['adminEmail']=_0x114452[_0x422c('0x44')];_0x217aae[_0x422c('0x29')]=_0x3f3b71['toLowerCase']()===_0x422c('0x45')?_0x1d363d[_0x422c('0x46')]:_0x1d363d['calleridnum'];_0x217aae[_0x422c('0x47')]=_0x3f3b71===_0x422c('0x48')||_0x3f3b71===_0x422c('0x49')?_0x422c('0x48'):_0x422c('0x45');if(_0x48526d){_0x217aae[_0x422c('0x4a')]=_0x48526d[_0x422c('0xe')];}var _0x3ecbce=util[_0x422c('0x30')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x114452[_0x422c('0x43')],_0x1d363d[_0x422c('0x4b')],md5(_0x1d363d[_0x422c('0x4b')]));if(_0x585a7c&&_0x585a7c[_0x422c('0x4c')]){logger[_0x422c('0x11')](_0x422c('0x4d'),_0x422c('0x4e'));_0x1d363d[_0x422c('0x4f')]=_0x3ecbce;}else if(_0x1b50e3&&_0x1b50e3[_0x422c('0x50')]&&_0x1b50e3[_0x422c('0x50')]!==_0x422c('0x51')){logger[_0x422c('0x11')](_0x422c('0x52'),_0x422c('0x4e'));_0x1d363d[_0x422c('0x4f')]=_0x3ecbce;}else{_0x1d363d['recordingURL']='';}return getAdminId(_0x217aae,_0x3f3b71,_0x381ee3,_0x3d5443)[_0x422c('0x18')](getUser(_0x3f3b71,_0x381ee3,_0x3d5443))['then'](getEndUser(_0x3f3b71,_0x381ee3,_0x3d5443))[_0x422c('0x18')](getTicket(_0x3f3b71,_0x381ee3,_0x3d5443,_0x2ccc39,_0x1d363d))['then'](function(_0x3c3bea){logger['info'](util[_0x422c('0x30')](_0x422c('0x53'),_0x3c3bea[_0x422c('0x3a')]));if(_0x3f3b71!=='unmanaged'){logger[_0x422c('0x11')]('['+[_0x3f3b71[_0x422c('0x15')]()]+']',_0x422c('0x54'));emit(_0x3d5443,_0x48526d[_0x422c('0x55')],_0x3c3bea[_0x422c('0x2d')]);}})[_0x422c('0x1e')](function(_0x20ab96){logger[_0x422c('0x14')]('['+[_0x3f3b71[_0x422c('0x15')]()]+_0x422c('0x56'),util[_0x422c('0x57')](_0x20ab96,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x56eb=['Subjects','Contact','format','add','ticketId','task','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','username','outbound','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','unmanaged','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','message','GET','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','Getting\x20contacts\x20filter','filters','All\x20Contacts','Getting\x20contact\x20list','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contacts','find','work_number','contactNumber','endUserId','Contact\x20found:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','toUpperCase','Creating\x20new\x20task','/api/tasks','getString'];(function(_0x301442,_0x333302){var _0x48ca93=function(_0x2dce41){while(--_0x2dce41){_0x301442['push'](_0x301442['shift']());}};_0x48ca93(++_0x333302);}(_0x56eb,0x16e));var _0xb56e=function(_0x114bf3,_0x31a954){_0x114bf3=_0x114bf3-0x0;var _0x2551ea=_0x56eb[_0x114bf3];return _0x2551ea;};'use strict';var _=require('lodash');var rp=require(_0xb56e('0x0'));var md5=require(_0xb56e('0x1'));var util=require(_0xb56e('0x2'));var moment=require('moment');var Promise=require(_0xb56e('0x3'));var Redis=require(_0xb56e('0x4'));var intUtil=require('./util');var config=require(_0xb56e('0x5'));var logger=require(_0xb56e('0x6'))(_0xb56e('0x7'));config[_0xb56e('0x8')]=_[_0xb56e('0x9')](config[_0xb56e('0x8')],{'host':_0xb56e('0xa'),'port':0x18eb});var io=require(_0xb56e('0xb'))(new Redis(config[_0xb56e('0x8')]));function getAdminId(_0x347704,_0x2321db,_0x594e7e,_0x539f56){return new Promise(function(_0x7a4c1f,_0x22f177){var _0x4f2acd=![];var _0xbca050={'method':'GET','uri':_0x539f56+_0xb56e('0xc'),'json':!![]};_0xbca050[_0xb56e('0xd')]=_0x594e7e;logger[_0xb56e('0xe')](_0xb56e('0xf'));return rp(_0xbca050)[_0xb56e('0x10')](function(_0x1e6767){if(_0x1e6767){var _0x4c0b65=_0x1e6767[_0xb56e('0x11')];var _0x40e4aa=null;for(_0x40e4aa=0x0;_0x40e4aa<_0x4c0b65[_0xb56e('0x12')];_0x40e4aa++){if(_0x4c0b65[_0x40e4aa][_0xb56e('0x13')]===_0x347704[_0xb56e('0x14')]){_0x347704[_0xb56e('0x15')]=_0x4c0b65[_0x40e4aa]['id'];_0x4f2acd=!![];}}if(_0x4f2acd){logger[_0xb56e('0xe')](_0xb56e('0x16'),_0x347704[_0xb56e('0x15')]);_0x7a4c1f(_0x347704);}else{_0x22f177({'statusCode':0x194,'message':_0xb56e('0x17')});}}else{_0x22f177({'statusCode':0x194,'message':_0xb56e('0x17')});}})[_0xb56e('0x18')](function(_0x40f7a3){logger[_0xb56e('0x19')]('['+[_0x2321db['toUpperCase']()]+']',_0x40f7a3[_0xb56e('0x1a')]);_0x22f177(_0x40f7a3);});});}function getUser(_0x3c4424,_0x449e9f,_0x150c91){return function(_0x96cb9b){return new Promise(function(_0x421d01,_0x38c7f9){var _0x4294e4={'method':_0xb56e('0x1b'),'uri':_0x150c91+_0xb56e('0xc'),'json':!![]};_0x4294e4['headers']=_0x449e9f;logger['info']('Getting\x20user\x20list');return rp(_0x4294e4)[_0xb56e('0x10')](function(_0xd1b399){if(_0xd1b399){var _0x3e9795=_0xd1b399[_0xb56e('0x11')];var _0x555653=![];var _0x768790=null;if(_0x96cb9b['agentEmail']!==null){logger[_0xb56e('0xe')](_0xb56e('0x1c'),_0x96cb9b[_0xb56e('0x1d')]);_0x96cb9b[_0xb56e('0x1e')]=_0x96cb9b[_0xb56e('0x1d')];for(_0x768790=0x0;_0x768790<_0x3e9795[_0xb56e('0x12')];_0x768790++){if(_0x3e9795[_0x768790][_0xb56e('0x13')]===_0x96cb9b['agentEmail']){_0x555653=!![];_0x96cb9b[_0xb56e('0x1f')]=_0x3e9795[_0x768790]['id'];logger[_0xb56e('0xe')](_0xb56e('0x20'),_0x96cb9b['userId']);}}}if(!_0x555653){logger[_0xb56e('0xe')](_0xb56e('0x21'));_0x96cb9b['userEmail']=_0x96cb9b[_0xb56e('0x14')];_0x96cb9b[_0xb56e('0x1f')]=_0x96cb9b['adminId'];_0x555653=!![];}if(_0x555653){_0x421d01(_0x96cb9b);}else{_0x38c7f9({'statusCode':0x194,'message':_0xb56e('0x17')});}}else{_0x38c7f9({'statusCode':0x194,'message':_0xb56e('0x17')});}})[_0xb56e('0x18')](function(_0x58f181){logger[_0xb56e('0x19')]('['+[_0x3c4424['toUpperCase']()]+']',_0x58f181[_0xb56e('0x1a')]);_0x38c7f9(_0x58f181);});});};}function getEndUser(_0x888689,_0x5506ca,_0x341311){return function(_0x32048d){return new Promise(function(_0x1e67ce,_0x2ee50b){var _0xee51=0x0;var _0x5c5a17={'method':'GET','uri':_0x341311+'/api/contacts/filters','json':!![]};_0x5c5a17[_0xb56e('0xd')]=_0x5506ca;logger[_0xb56e('0xe')](_0xb56e('0x22'));return rp(_0x5c5a17)['then'](function(_0x582682){_0x582682[_0xb56e('0x23')]['forEach'](function(_0x4722dd){if(_0x4722dd['name']===_0xb56e('0x24')){_0xee51=_0x4722dd['id'];}});})[_0xb56e('0x10')](function(){logger[_0xb56e('0xe')](_0xb56e('0x25'));var _0x5e4441={'method':_0xb56e('0x1b'),'uri':_0x341311+_0xb56e('0x26')+_0xee51,'json':!![]};_0x5e4441[_0xb56e('0xd')]=_0x5506ca;return rp(_0x5e4441);})[_0xb56e('0x10')](function(_0x3eecc2){logger[_0xb56e('0xe')](_0xb56e('0x27'),_0x32048d['contactNumber']);if(_0x3eecc2[_0xb56e('0x28')]['length']>0x0){var _0x184d1f=_[_0xb56e('0x29')](_0x3eecc2[_0xb56e('0x28')],function(_0x8a1e89){if(_0x8a1e89[_0xb56e('0x2a')]===_0x32048d[_0xb56e('0x2b')]||_0x8a1e89['mobile_number']===_0x32048d[_0xb56e('0x2b')]){return _0x8a1e89;}});if(_0x184d1f){_0x32048d[_0xb56e('0x2c')]=_0x184d1f['id'];logger[_0xb56e('0xe')](_0xb56e('0x2d'),_0x32048d['endUserId']);_0x1e67ce(_0x32048d);}else{return createEndUser(_0x32048d,_0x888689,_0x5506ca,_0x341311)['then'](function(_0x2b7ce6){logger['info']('Contact\x20created:',_0x32048d[_0xb56e('0x2c')]);_0x1e67ce(_0x2b7ce6);});}}else{return createEndUser(_0x32048d,_0x888689,_0x5506ca,_0x341311)[_0xb56e('0x10')](function(_0x505405){logger[_0xb56e('0xe')]('Contact\x20created:',_0x32048d['endUserId']);_0x1e67ce(_0x505405);});}})[_0xb56e('0x18')](function(_0x10987c){throw new Error(_0x10987c[_0xb56e('0x1a')]);});});};}function createEndUser(_0x3e17d,_0x162a1f,_0x471c83,_0x1e66a7){return new Promise(function(_0x5ea8dc,_0x4af084){var _0x473185=moment();var _0x2a9341={'method':'POST','uri':_0x1e66a7+_0xb56e('0x2e'),'body':{'contact':{'last_name':_0x3e17d[_0xb56e('0x2b')],'work_number':_0x3e17d[_0xb56e('0x2b')],'mobile_number':_0x3e17d[_0xb56e('0x2b')],'owner_id':_0x3e17d[_0xb56e('0x1f')],'created_at':_0x473185['format'](_0xb56e('0x2f'))}},'json':!![]};_0x2a9341[_0xb56e('0xd')]=_0x471c83;logger[_0xb56e('0xe')](_0xb56e('0x30'));return rp(_0x2a9341)['then'](function(_0x2797bb){_0x3e17d[_0xb56e('0x2c')]=_0x2797bb[_0xb56e('0x31')]['id'];_0x5ea8dc(_0x3e17d);})[_0xb56e('0x18')](function(_0x180399){logger[_0xb56e('0x19')]('['+[_0x162a1f[_0xb56e('0x32')]()]+']',_0x180399[_0xb56e('0x1a')]);_0x4af084(_0x180399[_0xb56e('0x1a')]);});});}function getTicket(_0x4cdff7,_0xdf615e,_0x1d950e,_0x209c84,_0x137688){return function(_0x3efcbf){logger[_0xb56e('0xe')](_0xb56e('0x33'));return new Promise(function(_0x4d760,_0x529170){var _0x6da8a9=moment();var _0x34a1ba={'method':'POST','uri':_0x1d950e+_0xb56e('0x34'),'body':{'title':intUtil[_0xb56e('0x35')](_0x209c84[_0xb56e('0x36')],_0x137688,'\x20'),'description':intUtil[_0xb56e('0x35')](_0x209c84['Descriptions'],_0x137688,'\x0a'),'owner_id':_0x3efcbf[_0xb56e('0x1f')],'creater_id':_0x3efcbf[_0xb56e('0x15')],'targetable_id':_0x3efcbf['endUserId'],'targetable_type':_0xb56e('0x37'),'created_at':_0x6da8a9[_0xb56e('0x38')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x6da8a9[_0xb56e('0x39')](0x1e,'m')[_0xb56e('0x38')](_0xb56e('0x2f'))},'json':!![]};_0x34a1ba['headers']=_0xdf615e;return rp(_0x34a1ba)[_0xb56e('0x10')](function(_0x19fcb5){_0x3efcbf[_0xb56e('0x3a')]=_0x19fcb5[_0xb56e('0x3b')]['id'];logger[_0xb56e('0xe')]('Task\x20created:',_0x3efcbf[_0xb56e('0x3a')]);_0x4d760(_0x3efcbf);})['catch'](function(_0x432530){logger['error']('['+[_0x4cdff7['toUpperCase']()]+']',_0x432530[_0xb56e('0x1a')]);_0x529170(_0x432530[_0xb56e('0x1a')]);});});};}function emit(_0x5063a2,_0x409a0a,_0x4e4f61){var _0xde829a={'uri':_0x5063a2+'/contacts/'+_0x4e4f61};io['to'](util['format']('user:%s',_0x409a0a))[_0xb56e('0x3c')](_0xb56e('0x3d'),_0xde829a);}exports['cs']=function(_0x1d1082,_0x257027,_0x10a003,_0x3823ed,_0x4076f5,_0x40f74a,_0x2116a2,_0x6f79a3){var _0x56ee2a={};var _0x456482={'Authorization':_0xb56e('0x3e')+_0x40f74a[_0xb56e('0x3f')]};_0x40f74a[_0xb56e('0x40')]=intUtil[_0xb56e('0x41')](_0x40f74a[_0xb56e('0x40')]);_0x40f74a['serverUrl']=intUtil[_0xb56e('0x41')](_0x40f74a['serverUrl']);var _0x5cc6a2=_0x40f74a[_0xb56e('0x40')];_0x56ee2a[_0xb56e('0x14')]=_0x40f74a[_0xb56e('0x42')];_0x56ee2a['contactNumber']=_0x6f79a3['toLowerCase']()===_0xb56e('0x43')?_0x257027['destcalleridnum']:_0x257027[_0xb56e('0x44')];_0x56ee2a[_0xb56e('0x45')]=_0x6f79a3===_0xb56e('0x46')||_0x6f79a3==='unmanaged'?'queue':'outbound';if(_0x3823ed){_0x56ee2a['agentEmail']=_0x3823ed['email'];}var _0x5c9a48=util[_0xb56e('0x38')](_0xb56e('0x47'),_0x40f74a[_0xb56e('0x48')],_0x257027[_0xb56e('0x49')],md5(_0x257027[_0xb56e('0x49')]));if(_0x4076f5&&_0x4076f5[_0xb56e('0x4a')]){logger[_0xb56e('0xe')](_0xb56e('0x4b'),_0xb56e('0x4c'));_0x257027[_0xb56e('0x4d')]=_0x5c9a48;}else if(_0x2116a2&&_0x2116a2[_0xb56e('0x4e')]&&_0x2116a2[_0xb56e('0x4e')]!==_0xb56e('0x4f')){logger[_0xb56e('0xe')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x257027[_0xb56e('0x4d')]=_0x5c9a48;}else{_0x257027[_0xb56e('0x4d')]='';}return getAdminId(_0x56ee2a,_0x6f79a3,_0x456482,_0x5cc6a2)[_0xb56e('0x10')](getUser(_0x6f79a3,_0x456482,_0x5cc6a2))[_0xb56e('0x10')](getEndUser(_0x6f79a3,_0x456482,_0x5cc6a2))['then'](getTicket(_0x6f79a3,_0x456482,_0x5cc6a2,_0x10a003,_0x257027))['then'](function(_0x2ff0b5){logger[_0xb56e('0xe')](util[_0xb56e('0x38')]('The\x20ticket\x20ID\x20is:\x20%s',_0x2ff0b5['ticketId']));if(_0x6f79a3!==_0xb56e('0x50')){logger[_0xb56e('0xe')]('['+[_0x6f79a3[_0xb56e('0x32')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x5cc6a2,_0x3823ed[_0xb56e('0x51')],_0x2ff0b5[_0xb56e('0x2c')]);}})[_0xb56e('0x18')](function(_0x32ef09){logger[_0xb56e('0x19')]('['+[_0x6f79a3[_0xb56e('0x32')]()]+_0xb56e('0x52'),util[_0xb56e('0x53')](_0x32ef09,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/index.js b/server/services/ami/trigger/integration/index.js index edfb55e..00e4758 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 _0x4024=['zendesk','salesforce','sugarcrm','zoho','dynamics365','exec','includes','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','desk','vtiger','servicenow','unknown\x20integration','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./salesforce','./sugarcrm','./zoho','./vtiger','./servicenow'];(function(_0x98131f,_0x3b099b){var _0x20270c=function(_0x5a6767){while(--_0x5a6767){_0x98131f['push'](_0x98131f['shift']());}};_0x20270c(++_0x3b099b);}(_0x4024,0x89));var _0x4402=function(_0x32c8bf,_0x2e795e){_0x32c8bf=_0x32c8bf-0x0;var _0x3583c1=_0x4024[_0x32c8bf];return _0x3583c1;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var zendesk=require('./zendesk');var salesforce=require(_0x4402('0x2'));var sugarcrm=require(_0x4402('0x3'));var freshdesk=require('./freshdesk');var zoho=require(_0x4402('0x4'));var desk=require('./desk');var vtiger=require(_0x4402('0x5'));var servicenow=require(_0x4402('0x6'));var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0x4402('0x7'),_0x4402('0x8'),_0x4402('0x9'),'freshdesk',_0x4402('0xa'),'desk','vtiger',_0x4402('0xb'),'freshsales','servicenow'];exports[_0x4402('0xc')]=function(_0x4f56aa,_0x1a4a47,_0x4e1a7e,_0x34b4a6,_0x525531,_0x3663e7){if(_0x4e1a7e){if(_[_0x4402('0xd')](integrations,_0x4f56aa['data1'][_0x4402('0xe')]())){try{var _0x302c4d=null;var _0xa819e9='';var _0x4c9032=_0x4e1a7e[_0x4f56aa[_0x4402('0xf')][_0x4402('0xe')]()];if(_0x4c9032){var _0x42f1b0=_0x4c9032[_0x4f56aa[_0x4402('0x10')]];if(_0x42f1b0){var _0x248ad9=_[_0x4402('0x11')](_0x42f1b0[_0x4402('0x12')],{'id':parseInt(_0x4f56aa[_0x4402('0x13')],0xa)});if(_0x248ad9){if(_0x34b4a6){if(_0x525531&&_0x1a4a47[_0x4402('0x14')]){_0xa819e9=_0x4402('0x14');}else if(_0x1a4a47[_0x4402('0x15')]){_0xa819e9=_0x4402('0x16');}else{console[_0x4402('0x17')](_0x4402('0x18'),_0x1a4a47);}}else{_0xa819e9=_0x4402('0x19');}switch(_0x4f56aa[_0x4402('0xf')][_0x4402('0xe')]()){case _0x4402('0x7'):zendesk[_0xa819e9](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7);break;case _0x4402('0x8'):salesforce[_0xa819e9](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7);break;case _0x4402('0x9'):sugarcrm[_0xa819e9](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7);break;case'freshdesk':freshdesk[_0xa819e9](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7);break;case'zoho':zoho[_0xa819e9](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7);break;case _0x4402('0x1a'):desk[_0xa819e9](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7);break;case _0x4402('0x1b'):vtiger[_0xa819e9](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7);break;case'freshsales':freshsales['cs'](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7,_0xa819e9);break;case _0x4402('0x1c'):servicenow['cs'](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7,_0xa819e9);break;case _0x4402('0xb'):dynamics365['cs'](_0x4f56aa,_0x1a4a47,_0x248ad9,_0x34b4a6,_0x525531,_0x42f1b0,_0x3663e7,_0xa819e9);break;default:console['log'](_0x4402('0x1d'));}}else{_0x302c4d=require('../../../../config/logger')(_0x4f56aa['data1'][_0x4402('0xe')]());_0x302c4d[_0x4402('0x1e')](_0x4402('0x1f'),util['format'](_0x4402('0x20'),_0x4f56aa['data1']['toLowerCase'](),_0x4f56aa[_0x4402('0x13')]));}}else{_0x302c4d=require(_0x4402('0x21'))(_0x4f56aa[_0x4402('0xf')][_0x4402('0xe')]());_0x302c4d[_0x4402('0x1e')](_0x4402('0x1f'),util[_0x4402('0x22')](_0x4402('0x23'),_0x4f56aa[_0x4402('0xf')]['toLowerCase'](),_0x4f56aa[_0x4402('0x10')]));}}else{}}catch(_0x4e1c04){console[_0x4402('0x1e')](_0x4e1c04);}}}}; \ No newline at end of file +var _0x3266=['salesforce','sugarcrm','zoho','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','freshdesk','desk','log','unknown\x20integration','../../../../config/logger','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','error','format','%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','zendesk'];(function(_0x1aa59b,_0x26612c){var _0x33011c=function(_0x29d625){while(--_0x29d625){_0x1aa59b['push'](_0x1aa59b['shift']());}};_0x33011c(++_0x26612c);}(_0x3266,0x6a));var _0x6326=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x3266[_0x1d50f2];return _0x3769b8;};'use strict';var _=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var zendesk=require(_0x6326('0x2'));var salesforce=require(_0x6326('0x3'));var sugarcrm=require(_0x6326('0x4'));var freshdesk=require(_0x6326('0x5'));var zoho=require(_0x6326('0x6'));var desk=require(_0x6326('0x7'));var vtiger=require(_0x6326('0x8'));var servicenow=require('./servicenow');var dynamics365=require(_0x6326('0x9'));var freshsales=require('./freshsales');var integrations=[_0x6326('0xa'),_0x6326('0xb'),_0x6326('0xc'),'freshdesk',_0x6326('0xd'),'desk',_0x6326('0xe'),_0x6326('0xf'),_0x6326('0x10'),_0x6326('0x11')];exports[_0x6326('0x12')]=function(_0x53c3e1,_0x1b45a7,_0x464a36,_0x3590ab,_0x1e6909,_0x416844){if(_0x464a36){if(_[_0x6326('0x13')](integrations,_0x53c3e1[_0x6326('0x14')][_0x6326('0x15')]())){try{var _0x40a68a=null;var _0x379358='';var _0x5c07e1=_0x464a36[_0x53c3e1['data1'][_0x6326('0x15')]()];if(_0x5c07e1){var _0x136946=_0x5c07e1[_0x53c3e1['data2']];if(_0x136946){var _0x425878=_['find'](_0x136946[_0x6326('0x16')],{'id':parseInt(_0x53c3e1[_0x6326('0x17')],0xa)});if(_0x425878){if(_0x3590ab){if(_0x1e6909&&_0x1b45a7[_0x6326('0x18')]){_0x379358=_0x6326('0x18');}else if(_0x1b45a7[_0x6326('0x19')]){_0x379358=_0x6326('0x1a');}else{console['log'](_0x6326('0x1b'),_0x1b45a7);}}else{_0x379358='unmanaged';}switch(_0x53c3e1['data1']['toLowerCase']()){case'zendesk':zendesk[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case'salesforce':salesforce[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case'sugarcrm':sugarcrm[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case _0x6326('0x1c'):freshdesk[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case _0x6326('0xd'):zoho[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case _0x6326('0x1d'):desk[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case'vtiger':vtiger[_0x379358](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844);break;case'freshsales':freshsales['cs'](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844,_0x379358);break;case _0x6326('0x11'):servicenow['cs'](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844,_0x379358);break;case _0x6326('0xf'):dynamics365['cs'](_0x53c3e1,_0x1b45a7,_0x425878,_0x3590ab,_0x1e6909,_0x136946,_0x416844,_0x379358);break;default:console[_0x6326('0x1e')](_0x6326('0x1f'));}}else{_0x40a68a=require(_0x6326('0x20'))(_0x53c3e1[_0x6326('0x14')][_0x6326('0x15')]());_0x40a68a['error'](_0x6326('0x21'),util['format'](_0x6326('0x22'),_0x53c3e1[_0x6326('0x14')][_0x6326('0x15')](),_0x53c3e1[_0x6326('0x17')]));}}else{_0x40a68a=require(_0x6326('0x20'))(_0x53c3e1[_0x6326('0x14')][_0x6326('0x15')]());_0x40a68a[_0x6326('0x23')](_0x6326('0x21'),util[_0x6326('0x24')](_0x6326('0x25'),_0x53c3e1['data1'][_0x6326('0x15')](),_0x53c3e1[_0x6326('0x26')]));}}else{}}catch(_0x575701){console['error'](_0x575701);}}}}; \ 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 8afae40..3e5eb32 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 _0x9009=['name','toLowerCase','password','concat','securityToken','https://login.salesforce.com','clientId','clientSecret','login','stripTrailingSlash','serverUrl','[QUEUE]','uniqueid','recordingURL','email','calleridname','Fields','queue','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','remoteUri','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','catch','stringify','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','isNil','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','assign','utc','getString','Subjects','WhoId','ticketType','Descriptions','ContactId','sobject','create','validateEmail','User','execute','then','length','find','Email','info','Agent\x20%s\x20found.','resolve','Name','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','contact','Case','Phone','Enduser\x20with\x20phone\x20%s\x20found.','','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','moduleCreate','lead','Task','Company','No\x20Company','forEach','type','string','idField','variable','variableName','toString','customVariable','Variable'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9009,0x9d));var _0x9900=function(_0x213b9e,_0x37f3ac){_0x213b9e=_0x213b9e-0x0;var _0x510623=_0x9009[_0x213b9e];return _0x510623;};'use strict';var _=require(_0x9900('0x0'));var rp=require(_0x9900('0x1'));var moment=require(_0x9900('0x2'));var BPromise=require('bluebird');var md5=require('md5');var jsforce=require('jsforce');var util=require(_0x9900('0x3'));var Redis=require(_0x9900('0x4'));var intUtil=require(_0x9900('0x5'));var config=require(_0x9900('0x6'));var logger=require(_0x9900('0x7'))(_0x9900('0x8'));config['redis']=_['defaults'](config[_0x9900('0x9')],{'host':_0x9900('0xa'),'port':0x18eb});var io=require(_0x9900('0xb'))(new Redis(config[_0x9900('0x9')]));function emit(_0xfa70e3,_0x468c1c,_0x2c2e1f){io['to'](_0xfa70e3)[_0x9900('0xc')](_0x468c1c,_0x2c2e1f);}function getTicket(_0x2788c0,_0x302a79,_0x38a6a0,_0x207ed0,_0x187dc5,_0x51c75f,_0x457b37,_0x46e391){var _0x340724={};if(_0x207ed0['ticketType']==='Task'){_0x340724=Object[_0x9900('0xd')]({},{'OwnerId':_0x302a79['id'],'ActivityDate':moment[_0x9900('0xe')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x9900('0xf')](_0x207ed0[_0x9900('0x10')],_0x187dc5,'\x20'),'Description':intUtil[_0x9900('0xf')](_0x207ed0['Descriptions'],_0x187dc5,'\x0a')},getCustomFields(_0x51c75f,_0x187dc5));if(_0x38a6a0){_0x340724[_0x9900('0x11')]=_0x38a6a0['id'];}}else if(_0x207ed0[_0x9900('0x12')]==='Case'){_0x340724=Object[_0x9900('0xd')]({},{'OwnerId':_0x302a79['id'],'Subject':intUtil[_0x9900('0xf')](_0x207ed0[_0x9900('0x10')],_0x187dc5,'\x20'),'Description':intUtil[_0x9900('0xf')](_0x207ed0[_0x9900('0x13')],_0x187dc5,'\x0a')},getCustomFields(_0x51c75f,_0x187dc5));if(_0x38a6a0){_0x340724[_0x9900('0x14')]=_0x38a6a0['id'];}}return _0x457b37[_0x9900('0x15')](_0x207ed0[_0x9900('0x12')])[_0x9900('0x16')](_0x340724);}function getUser(_0x4da4fa,_0x597986,_0x599d85){if(!_['isNil'](_0x597986)&&intUtil[_0x9900('0x17')](_0x597986)){var _0x69e7a0={'Email':_0x597986};var _0x175ec6={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x599d85['sobject'](_0x9900('0x18'))['find'](_0x69e7a0,_0x175ec6)[_0x9900('0x19')]()[_0x9900('0x1a')](function(_0x42b64d){if(_0x42b64d[_0x9900('0x1b')]){var _0x659cf9=_[_0x9900('0x1c')](_0x42b64d,function(_0x460dd8){return _0x460dd8[_0x9900('0x1d')]===_0x597986;});if(_0x659cf9){logger[_0x9900('0x1e')](_0x9900('0x1f'),_0x597986);return BPromise[_0x9900('0x20')]({'id':_0x659cf9['Id'],'name':_0x659cf9[_0x9900('0x21')]});}}else{logger[_0x9900('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x597986);return _0x599d85[_0x9900('0x22')]()[_0x9900('0x1a')](function(_0x5b6017){return BPromise[_0x9900('0x20')]({'id':_0x5b6017[_0x9900('0x23')],'name':_0x5b6017[_0x9900('0x24')]});});}});}else{logger['info'](_0x9900('0x25'),_0x597986);return _0x599d85[_0x9900('0x22')]()[_0x9900('0x1a')](function(_0x78e9cc){return BPromise[_0x9900('0x20')]({'id':_0x78e9cc['user_id'],'name':_0x78e9cc[_0x9900('0x24')]});});}}function getEndUser(_0x337fee,_0x4056ad,_0x57d0be,_0x534fc6,_0x26841d){var _0x39c96b={'Phone':_0x534fc6};var _0x412f69={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x9900('0x20')]()['then'](function(){if(_0x4056ad[_0x9900('0x12')]==='Task'){logger[_0x9900('0x1e')](_0x9900('0x26'),_0x534fc6,_0x4056ad[_0x9900('0x27')]);switch(_0x4056ad['moduleSearch']){case _0x9900('0x28'):return _0x26841d[_0x9900('0x15')](_0x9900('0x29'))[_0x9900('0x1c')](_0x39c96b,_0x412f69)[_0x9900('0x19')]()['then'](function(_0x4bb510){if(_0x4bb510&&_0x4bb510[_0x9900('0x1b')]){return _0x4bb510;}else{return _0x26841d['sobject'](_0x9900('0x2a'))[_0x9900('0x1c')](_0x39c96b,_0x412f69);}});case _0x9900('0x2b'):return _0x26841d[_0x9900('0x15')]('Contact')[_0x9900('0x1c')](_0x39c96b,_0x412f69)[_0x9900('0x19')]();case'lead':return _0x26841d[_0x9900('0x15')](_0x9900('0x2a'))[_0x9900('0x1c')](_0x39c96b,_0x412f69);default:return null;}}else if(_0x4056ad[_0x9900('0x12')]===_0x9900('0x2c')){logger[_0x9900('0x1e')](_0x9900('0x26'),_0x534fc6,'contact');return _0x26841d[_0x9900('0x15')](_0x9900('0x29'))[_0x9900('0x1c')](_0x39c96b,_0x412f69)[_0x9900('0x19')]();}})[_0x9900('0x1a')](function(_0x52f5f3){if(_0x52f5f3&&_0x52f5f3['length']){var _0x19cf92=_['find'](_0x52f5f3,function(_0x5782c8){return _0x5782c8[_0x9900('0x2d')]===_0x534fc6;});if(_0x19cf92){return BPromise['resolve']({'id':_0x19cf92['Id'],'name':_0x19cf92[_0x9900('0x21')],'phone':_0x19cf92[_0x9900('0x2d')]});}}})['then'](function(_0x2f6b8a){if(_0x2f6b8a){logger[_0x9900('0x1e')](_0x9900('0x2e'),_0x534fc6);return BPromise[_0x9900('0x20')](_0x2f6b8a);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found.',_0x534fc6);var _0x5208e0={'LastName':_0x57d0be!==_0x9900('0x2f')?_0x57d0be:util[_0x9900('0x30')](_0x9900('0x31'),_0x534fc6),'Phone':_0x534fc6};if(_0x4056ad['moduleCreate']){if(_0x4056ad['moduleCreate']===_0x9900('0x2b')){logger['info'](_0x9900('0x32'),_0x534fc6,_0x4056ad['moduleCreate']);}else if(_0x4056ad[_0x9900('0x33')]===_0x9900('0x34')&&_0x4056ad[_0x9900('0x12')]===_0x9900('0x35')){logger[_0x9900('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x534fc6,_0x4056ad[_0x9900('0x33')]);_0x5208e0[_0x9900('0x36')]=_0x9900('0x37');}else{return null;}}return _0x26841d[_0x9900('0x15')](_['upperFirst'](_0x4056ad[_0x9900('0x33')]))[_0x9900('0x16')](_0x5208e0);}});}function getCustomFields(_0x20f10f,_0x2e3006){var _0x172baf={};if(_0x20f10f['length']>0x0){_[_0x9900('0x38')](_0x20f10f,function(_0x31944f){if(_0x31944f[_0x9900('0x39')]===_0x9900('0x3a')&&_0x31944f[_0x9900('0x3b')]){_0x172baf[_0x31944f[_0x9900('0x3b')]]=_0x31944f['content']['toString']();}else if(_0x31944f[_0x9900('0x39')]===_0x9900('0x3c')&&_0x31944f[_0x9900('0x3d')]&&_0x31944f['idField']){_0x2e3006[_0x31944f[_0x9900('0x3d')]]&&(_0x172baf[_0x31944f['idField']]=_0x2e3006[_0x31944f['variableName']][_0x9900('0x3e')]());}else if(_0x31944f[_0x9900('0x39')]===_0x9900('0x3f')&&_0x31944f[_0x9900('0x40')]&&_0x31944f[_0x9900('0x40')][_0x9900('0x41')]&&_0x31944f[_0x9900('0x3b')]){_0x2e3006[_0x31944f[_0x9900('0x40')][_0x9900('0x41')][_0x9900('0x42')]()]&&(_0x172baf[_0x31944f['idField']]=_0x2e3006[_0x31944f[_0x9900('0x40')]['name']['toLowerCase']()]['toString']());}});}return _0x172baf;}function getConnection(_0x2ead32){var _0x4587fe=_0x2ead32[_0x9900('0x43')][_0x9900('0x44')](_0x2ead32[_0x9900('0x45')]);var _0x15f7b8=new jsforce['Connection']({'oauth2':{'loginUrl':_0x2ead32['remoteUri']||_0x9900('0x46'),'clientId':_0x2ead32[_0x9900('0x47')],'clientSecret':_0x2ead32[_0x9900('0x48')]}});return _0x15f7b8[_0x9900('0x49')](_0x2ead32['username'],_0x4587fe)[_0x9900('0x1a')](function(){logger[_0x9900('0x1e')]('Connection\x20established.');return _0x15f7b8;});}exports['queue']=function(_0x52f4b3,_0xe1352f,_0x145d71,_0x3a50b2,_0x16b026,_0x557d3d){var _0x5919f1,_0x353848,_0x385e79,_0x5e2e11;_0x557d3d['serverUrl']=intUtil[_0x9900('0x4a')](_0x557d3d[_0x9900('0x4b')]);_0x557d3d['remoteUri']=intUtil[_0x9900('0x4a')](_0x557d3d['remoteUri']);if(_0x16b026&&_0x16b026['monitor_format']){logger[_0x9900('0x1e')](_0x9900('0x4c'),'Recording\x20is\x20enabled!');_0xe1352f['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x557d3d[_0x9900('0x4b')],_0xe1352f['uniqueid'],md5(_0xe1352f[_0x9900('0x4d')]));}else{_0xe1352f[_0x9900('0x4e')]='';}return getConnection(_0x557d3d)['then'](function(_0xf08268){_0x5e2e11=_0xf08268;return getUser(_0x557d3d,_0x3a50b2[_0x9900('0x4f')],_0x5e2e11);})[_0x9900('0x1a')](function(_0x26f3ff){_0x5919f1=_0x26f3ff;return getEndUser(_0x557d3d,_0x145d71,_0xe1352f[_0x9900('0x50')],_0xe1352f['calleridnum'],_0x5e2e11);})[_0x9900('0x1a')](function(_0x1b643d){_0x353848=_0x1b643d;return getTicket(_0x557d3d,_0x5919f1,_0x353848,_0x145d71,_0xe1352f,_0x145d71[_0x9900('0x51')],_0x5e2e11,_0x9900('0x52'));})[_0x9900('0x1a')](function(_0x489025){_0x385e79=_0x489025;logger[_0x9900('0x1e')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x385e79['id']);logger[_0x9900('0x1e')](_0x9900('0x53'),_0x385e79['id'],_0x3a50b2['name'],_0x557d3d[_0x9900('0x39')]);switch(_0x557d3d[_0x9900('0x39')]){case _0x9900('0x54'):emit(util[_0x9900('0x30')](_0x9900('0x55'),_0x3a50b2['name']),_0x9900('0x56'),{'recordId':_0x385e79['id']});break;case _0x9900('0x57'):emit(util[_0x9900('0x30')](_0x9900('0x55'),_0x3a50b2['name']),_0x9900('0x58'),{'uri':util[_0x9900('0x30')](_0x9900('0x59'),_0x5e2e11[_0x9900('0x5a')],_0x385e79['id'])});break;default:logger[_0x9900('0x5b')](_0x9900('0x5c'));}})['catch'](function(_0x454abd){logger[_0x9900('0x5b')](_0x9900('0x4c'),JSON['stringify'](_0x454abd));});};exports[_0x9900('0x5d')]=function(_0x4a9a9a,_0xd4b0e6,_0xd4f5f7,_0x10ee45,_0x46d3c0,_0x259c8a,_0x84e0dd){var _0x246ddf,_0x5df02f,_0x33d7d5,_0xf6378b;_0x259c8a['serverUrl']=intUtil[_0x9900('0x4a')](_0x259c8a[_0x9900('0x4b')]);_0x259c8a[_0x9900('0x5e')]=intUtil[_0x9900('0x4a')](_0x259c8a[_0x9900('0x5e')]);if(_0x84e0dd&&_0x84e0dd[_0x9900('0x5f')]&&_0x84e0dd[_0x9900('0x5f')]!=='none'){logger[_0x9900('0x1e')](_0x9900('0x60'),'Recording\x20is\x20enabled!');_0xd4b0e6[_0x9900('0x4e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x259c8a[_0x9900('0x4b')],_0xd4b0e6[_0x9900('0x4d')],md5(_0xd4b0e6[_0x9900('0x4d')]));}return getConnection(_0x259c8a)[_0x9900('0x1a')](function(_0x290922){_0xf6378b=_0x290922;return getUser(_0x259c8a,_0x10ee45[_0x9900('0x4f')],_0xf6378b);})[_0x9900('0x1a')](function(_0x21e14f){_0x246ddf=_0x21e14f;return getEndUser(_0x259c8a,_0xd4f5f7,_0xd4b0e6[_0x9900('0x61')],_0xd4b0e6[_0x9900('0x62')],_0xf6378b);})[_0x9900('0x1a')](function(_0x5a7323){_0x5df02f=_0x5a7323;return getTicket(_0x259c8a,_0x246ddf,_0x5df02f,_0xd4f5f7,_0xd4b0e6,_0xd4f5f7[_0x9900('0x51')],_0xf6378b,_0x9900('0x5d'));})[_0x9900('0x1a')](function(_0x1aa668){_0x33d7d5=_0x1aa668;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x33d7d5['id']);logger[_0x9900('0x1e')](_0x9900('0x63'),_0x33d7d5['id'],_0x10ee45['name'],_0x259c8a[_0x9900('0x39')]);switch(_0x259c8a[_0x9900('0x39')]){case _0x9900('0x54'):emit(util['format'](_0x9900('0x55'),_0x10ee45[_0x9900('0x41')]),_0x9900('0x56'),{'recordId':_0x33d7d5['id']});break;case _0x9900('0x57'):emit(util['format'](_0x9900('0x55'),_0x10ee45['name']),'trigger:browser:url',{'uri':util[_0x9900('0x30')](_0x9900('0x59'),_0xf6378b['instanceUrl'],_0x33d7d5['id'])});break;default:logger[_0x9900('0x5b')](_0x9900('0x60'),_0x9900('0x64'));}})[_0x9900('0x65')](function(_0x2c03f1){logger[_0x9900('0x5b')](_0x9900('0x60'),JSON[_0x9900('0x66')](_0x2c03f1));});};exports['unmanaged']=function(_0x24c8ee,_0x34a061,_0x231ebb,_0x51f243,_0x5de4f7,_0x2469d2){var _0x1e0495,_0x5b8c84,_0x37b7f5,_0x36d280;_0x2469d2[_0x9900('0x4b')]=intUtil[_0x9900('0x4a')](_0x2469d2[_0x9900('0x4b')]);_0x2469d2[_0x9900('0x5e')]=intUtil[_0x9900('0x4a')](_0x2469d2[_0x9900('0x5e')]);if(_0x5de4f7&&_0x5de4f7[_0x9900('0x67')]){logger[_0x9900('0x1e')]('['+_0x34a061[_0x9900('0x68')][_0x9900('0x69')]()+']',_0x9900('0x6a'));_0x34a061[_0x9900('0x4e')]=util[_0x9900('0x30')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2469d2[_0x9900('0x4b')],_0x34a061[_0x9900('0x4d')],md5(_0x34a061[_0x9900('0x4d')]));}else{_0x34a061[_0x9900('0x4e')]='';}return getConnection(_0x2469d2)['then'](function(_0x494db5){_0x36d280=_0x494db5;if(!_[_0x9900('0x6b')](_0x51f243)){return getUser(_0x2469d2,_0x51f243['name'],_0x36d280);}else{return getUser(_0x2469d2,null,_0x36d280);}})[_0x9900('0x1a')](function(_0x40b7dc){_0x1e0495=_0x40b7dc;return getEndUser(_0x2469d2,_0x231ebb,_0x34a061[_0x9900('0x50')],_0x34a061[_0x9900('0x6c')],_0x36d280);})[_0x9900('0x1a')](function(_0x330140){_0x5b8c84=_0x330140;return getTicket(_0x2469d2,_0x1e0495,_0x5b8c84,_0x231ebb,_0x34a061,_0x231ebb[_0x9900('0x51')],_0x36d280);})[_0x9900('0x1a')](function(_0xa3e14c){_0x37b7f5=_0xa3e14c;logger[_0x9900('0x1e')]('['+_0x34a061[_0x9900('0x68')][_0x9900('0x69')]()+_0x9900('0x6d'),_0x37b7f5['id']);logger[_0x9900('0x1e')]('['+_0x34a061[_0x9900('0x68')][_0x9900('0x69')]()+_0x9900('0x6e'),_0x2469d2[_0x9900('0x39')]);})[_0x9900('0x65')](function(_0x58f5fe){logger[_0x9900('0x5b')]('['+_0x34a061[_0x9900('0x68')][_0x9900('0x69')]()+']',JSON[_0x9900('0x66')](_0x58f5fe));});}; \ No newline at end of file +var _0x860c=['moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','No\x20Company','type','string','idField','toString','variableName','customVariable','Variable','name','toLowerCase','concat','securityToken','Connection','remoteUri','clientId','clientSecret','login','queue','serverUrl','stripTrailingSlash','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','recordingURL','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','stringify','recordingFormat','Recording\x20is\x20enabled!','uniqueid','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','integrationTab','newTab','Salesforce\x20account\x20type\x20not\x20recognized','[OUTBOUND]','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','util','ioredis','../../../../config/logger','salesforce','redis','emit','ticketType','assign','utc','getString','Subjects','Descriptions','WhoId','Case','ContactId','sobject','create','isNil','validateEmail','User','find','then','length','Email','Agent\x20%s\x20found.','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','contact_lead','Contact','execute','Lead','lead','contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','format'];(function(_0x3d8ca8,_0x1a9764){var _0x517e45=function(_0x641ad9){while(--_0x641ad9){_0x3d8ca8['push'](_0x3d8ca8['shift']());}};_0x517e45(++_0x1a9764);}(_0x860c,0x170));var _0xc860=function(_0x4e68a7,_0x436bfd){_0x4e68a7=_0x4e68a7-0x0;var _0x528435=_0x860c[_0x4e68a7];return _0x528435;};'use strict';var _=require(_0xc860('0x0'));var rp=require(_0xc860('0x1'));var moment=require(_0xc860('0x2'));var BPromise=require(_0xc860('0x3'));var md5=require(_0xc860('0x4'));var jsforce=require('jsforce');var util=require(_0xc860('0x5'));var Redis=require(_0xc860('0x6'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xc860('0x7'))(_0xc860('0x8'));config[_0xc860('0x9')]=_['defaults'](config[_0xc860('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc860('0x9')]));function emit(_0xec1434,_0x1b986f,_0x4243bf){io['to'](_0xec1434)[_0xc860('0xa')](_0x1b986f,_0x4243bf);}function getTicket(_0x30a158,_0x59457c,_0x2c6d0d,_0x247d4d,_0x4d9c4e,_0x3a983a,_0x15657d,_0x437d41){var _0xa3ad81={};if(_0x247d4d[_0xc860('0xb')]==='Task'){_0xa3ad81=Object[_0xc860('0xc')]({},{'OwnerId':_0x59457c['id'],'ActivityDate':moment[_0xc860('0xd')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xc860('0xe')](_0x247d4d[_0xc860('0xf')],_0x4d9c4e,'\x20'),'Description':intUtil[_0xc860('0xe')](_0x247d4d[_0xc860('0x10')],_0x4d9c4e,'\x0a')},getCustomFields(_0x3a983a,_0x4d9c4e));if(_0x2c6d0d){_0xa3ad81[_0xc860('0x11')]=_0x2c6d0d['id'];}}else if(_0x247d4d['ticketType']===_0xc860('0x12')){_0xa3ad81=Object[_0xc860('0xc')]({},{'OwnerId':_0x59457c['id'],'Subject':intUtil[_0xc860('0xe')](_0x247d4d[_0xc860('0xf')],_0x4d9c4e,'\x20'),'Description':intUtil['getString'](_0x247d4d['Descriptions'],_0x4d9c4e,'\x0a')},getCustomFields(_0x3a983a,_0x4d9c4e));if(_0x2c6d0d){_0xa3ad81[_0xc860('0x13')]=_0x2c6d0d['id'];}}return _0x15657d[_0xc860('0x14')](_0x247d4d[_0xc860('0xb')])[_0xc860('0x15')](_0xa3ad81);}function getUser(_0x24e286,_0x50f59a,_0x5427e7){if(!_[_0xc860('0x16')](_0x50f59a)&&intUtil[_0xc860('0x17')](_0x50f59a)){var _0x45ea21={'Email':_0x50f59a};var _0x19baf5={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5427e7['sobject'](_0xc860('0x18'))[_0xc860('0x19')](_0x45ea21,_0x19baf5)['execute']()[_0xc860('0x1a')](function(_0x46fcef){if(_0x46fcef[_0xc860('0x1b')]){var _0x4368d6=_[_0xc860('0x19')](_0x46fcef,function(_0x41890a){return _0x41890a[_0xc860('0x1c')]===_0x50f59a;});if(_0x4368d6){logger['info'](_0xc860('0x1d'),_0x50f59a);return BPromise[_0xc860('0x1e')]({'id':_0x4368d6['Id'],'name':_0x4368d6[_0xc860('0x1f')]});}}else{logger[_0xc860('0x20')](_0xc860('0x21'),_0x50f59a);return _0x5427e7[_0xc860('0x22')]()['then'](function(_0x34d056){return BPromise[_0xc860('0x1e')]({'id':_0x34d056[_0xc860('0x23')],'name':_0x34d056['display_name']});});}});}else{logger[_0xc860('0x20')](_0xc860('0x21'),_0x50f59a);return _0x5427e7['identity']()[_0xc860('0x1a')](function(_0x3430c5){return BPromise[_0xc860('0x1e')]({'id':_0x3430c5[_0xc860('0x23')],'name':_0x3430c5[_0xc860('0x24')]});});}}function getEndUser(_0x54373b,_0x188bc4,_0xcdf293,_0xd1428e,_0x31013c){var _0x73c00b={'Phone':_0xd1428e};var _0x558861={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xc860('0x1e')]()[_0xc860('0x1a')](function(){if(_0x188bc4['ticketType']==='Task'){logger[_0xc860('0x20')](_0xc860('0x25'),_0xd1428e,_0x188bc4['moduleSearch']);switch(_0x188bc4['moduleSearch']){case _0xc860('0x26'):return _0x31013c['sobject'](_0xc860('0x27'))[_0xc860('0x19')](_0x73c00b,_0x558861)[_0xc860('0x28')]()['then'](function(_0x1db4d9){if(_0x1db4d9&&_0x1db4d9[_0xc860('0x1b')]){return _0x1db4d9;}else{return _0x31013c[_0xc860('0x14')](_0xc860('0x29'))['find'](_0x73c00b,_0x558861);}});case'contact':return _0x31013c[_0xc860('0x14')](_0xc860('0x27'))[_0xc860('0x19')](_0x73c00b,_0x558861)['execute']();case _0xc860('0x2a'):return _0x31013c[_0xc860('0x14')](_0xc860('0x29'))['find'](_0x73c00b,_0x558861);default:return null;}}else if(_0x188bc4[_0xc860('0xb')]===_0xc860('0x12')){logger[_0xc860('0x20')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0xd1428e,_0xc860('0x2b'));return _0x31013c[_0xc860('0x14')](_0xc860('0x27'))['find'](_0x73c00b,_0x558861)[_0xc860('0x28')]();}})[_0xc860('0x1a')](function(_0x238e31){if(_0x238e31&&_0x238e31[_0xc860('0x1b')]){var _0x47e377=_[_0xc860('0x19')](_0x238e31,function(_0x998ad0){return _0x998ad0[_0xc860('0x2c')]===_0xd1428e;});if(_0x47e377){return BPromise[_0xc860('0x1e')]({'id':_0x47e377['Id'],'name':_0x47e377['Name'],'phone':_0x47e377[_0xc860('0x2c')]});}}})[_0xc860('0x1a')](function(_0x2ddff2){if(_0x2ddff2){logger[_0xc860('0x20')](_0xc860('0x2d'),_0xd1428e);return BPromise[_0xc860('0x1e')](_0x2ddff2);}else{logger[_0xc860('0x20')](_0xc860('0x2e'),_0xd1428e);var _0x233dd2={'LastName':_0xcdf293!==''?_0xcdf293:util[_0xc860('0x2f')]('Caller\x20-\x20%s',_0xd1428e),'Phone':_0xd1428e};if(_0x188bc4[_0xc860('0x30')]){if(_0x188bc4[_0xc860('0x30')]===_0xc860('0x2b')){logger['info'](_0xc860('0x31'),_0xd1428e,_0x188bc4[_0xc860('0x30')]);}else if(_0x188bc4[_0xc860('0x30')]===_0xc860('0x2a')&&_0x188bc4[_0xc860('0xb')]==='Task'){logger['info'](_0xc860('0x31'),_0xd1428e,_0x188bc4['moduleCreate']);_0x233dd2['Company']=_0xc860('0x32');}else{return null;}}return _0x31013c['sobject'](_['upperFirst'](_0x188bc4[_0xc860('0x30')]))[_0xc860('0x15')](_0x233dd2);}});}function getCustomFields(_0x355fc1,_0x555a63){var _0x5710a6={};if(_0x355fc1['length']>0x0){_['forEach'](_0x355fc1,function(_0x3da642){if(_0x3da642[_0xc860('0x33')]===_0xc860('0x34')&&_0x3da642[_0xc860('0x35')]){_0x5710a6[_0x3da642[_0xc860('0x35')]]=_0x3da642['content'][_0xc860('0x36')]();}else if(_0x3da642['type']==='variable'&&_0x3da642[_0xc860('0x37')]&&_0x3da642[_0xc860('0x35')]){_0x555a63[_0x3da642['variableName']]&&(_0x5710a6[_0x3da642[_0xc860('0x35')]]=_0x555a63[_0x3da642[_0xc860('0x37')]][_0xc860('0x36')]());}else if(_0x3da642[_0xc860('0x33')]===_0xc860('0x38')&&_0x3da642[_0xc860('0x39')]&&_0x3da642[_0xc860('0x39')][_0xc860('0x3a')]&&_0x3da642['idField']){_0x555a63[_0x3da642[_0xc860('0x39')][_0xc860('0x3a')][_0xc860('0x3b')]()]&&(_0x5710a6[_0x3da642[_0xc860('0x35')]]=_0x555a63[_0x3da642['Variable'][_0xc860('0x3a')]['toLowerCase']()][_0xc860('0x36')]());}});}return _0x5710a6;}function getConnection(_0x1e2349){var _0x1f6b95=_0x1e2349['password'][_0xc860('0x3c')](_0x1e2349[_0xc860('0x3d')]);var _0x54b5eb=new jsforce[(_0xc860('0x3e'))]({'oauth2':{'loginUrl':_0x1e2349[_0xc860('0x3f')]||'https://login.salesforce.com','clientId':_0x1e2349[_0xc860('0x40')],'clientSecret':_0x1e2349[_0xc860('0x41')]}});return _0x54b5eb[_0xc860('0x42')](_0x1e2349['username'],_0x1f6b95)[_0xc860('0x1a')](function(){logger[_0xc860('0x20')]('Connection\x20established.');return _0x54b5eb;});}exports[_0xc860('0x43')]=function(_0x582085,_0x2a4e48,_0x56840b,_0x11305b,_0x14809e,_0x26e31e){var _0x5f26a2,_0x168d78,_0x2f8ddf,_0x450b2d;_0x26e31e[_0xc860('0x44')]=intUtil[_0xc860('0x45')](_0x26e31e[_0xc860('0x44')]);_0x26e31e[_0xc860('0x3f')]=intUtil[_0xc860('0x45')](_0x26e31e[_0xc860('0x3f')]);if(_0x14809e&&_0x14809e[_0xc860('0x46')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x2a4e48['recordingURL']=util[_0xc860('0x2f')](_0xc860('0x47'),_0x26e31e[_0xc860('0x44')],_0x2a4e48['uniqueid'],md5(_0x2a4e48['uniqueid']));}else{_0x2a4e48[_0xc860('0x48')]='';}return getConnection(_0x26e31e)[_0xc860('0x1a')](function(_0x442116){_0x450b2d=_0x442116;return getUser(_0x26e31e,_0x11305b[_0xc860('0x49')],_0x450b2d);})[_0xc860('0x1a')](function(_0x3e050f){_0x5f26a2=_0x3e050f;return getEndUser(_0x26e31e,_0x56840b,_0x2a4e48[_0xc860('0x4a')],_0x2a4e48[_0xc860('0x4b')],_0x450b2d);})[_0xc860('0x1a')](function(_0x49a058){_0x168d78=_0x49a058;return getTicket(_0x26e31e,_0x5f26a2,_0x168d78,_0x56840b,_0x2a4e48,_0x56840b['Fields'],_0x450b2d,_0xc860('0x43'));})[_0xc860('0x1a')](function(_0xf07108){_0x2f8ddf=_0xf07108;logger[_0xc860('0x20')](_0xc860('0x4c'),_0x2f8ddf['id']);logger[_0xc860('0x20')](_0xc860('0x4d'),_0x2f8ddf['id'],_0x11305b[_0xc860('0x3a')],_0x26e31e['type']);switch(_0x26e31e[_0xc860('0x33')]){case'integrationTab':emit(util['format'](_0xc860('0x4e'),_0x11305b['name']),_0xc860('0x4f'),{'recordId':_0x2f8ddf['id']});break;case'newTab':emit(util['format'](_0xc860('0x4e'),_0x11305b['name']),_0xc860('0x50'),{'uri':util[_0xc860('0x2f')](_0xc860('0x51'),_0x450b2d[_0xc860('0x52')],_0x2f8ddf['id'])});break;default:logger[_0xc860('0x53')](_0xc860('0x54'));}})[_0xc860('0x55')](function(_0x293042){logger[_0xc860('0x53')](_0xc860('0x56'),JSON[_0xc860('0x57')](_0x293042));});};exports['outbound']=function(_0x3d69c7,_0xb3d544,_0x263ffb,_0x47cc6c,_0x38622c,_0x5cb62a,_0x1e4da7){var _0x15933a,_0x392f26,_0x1efeeb,_0x57cd01;_0x5cb62a[_0xc860('0x44')]=intUtil[_0xc860('0x45')](_0x5cb62a['serverUrl']);_0x5cb62a[_0xc860('0x3f')]=intUtil[_0xc860('0x45')](_0x5cb62a[_0xc860('0x3f')]);if(_0x1e4da7&&_0x1e4da7['recordingFormat']&&_0x1e4da7[_0xc860('0x58')]!=='none'){logger[_0xc860('0x20')]('[OUTBOUND]',_0xc860('0x59'));_0xb3d544['recordingURL']=util[_0xc860('0x2f')](_0xc860('0x47'),_0x5cb62a[_0xc860('0x44')],_0xb3d544[_0xc860('0x5a')],md5(_0xb3d544['uniqueid']));}return getConnection(_0x5cb62a)[_0xc860('0x1a')](function(_0x2c6384){_0x57cd01=_0x2c6384;return getUser(_0x5cb62a,_0x47cc6c['email'],_0x57cd01);})[_0xc860('0x1a')](function(_0x47a108){_0x15933a=_0x47a108;return getEndUser(_0x5cb62a,_0x263ffb,_0xb3d544[_0xc860('0x5b')],_0xb3d544[_0xc860('0x5c')],_0x57cd01);})[_0xc860('0x1a')](function(_0x53a6b4){_0x392f26=_0x53a6b4;return getTicket(_0x5cb62a,_0x15933a,_0x392f26,_0x263ffb,_0xb3d544,_0x263ffb['Fields'],_0x57cd01,_0xc860('0x5d'));})[_0xc860('0x1a')](function(_0x4a25b0){_0x1efeeb=_0x4a25b0;logger[_0xc860('0x20')](_0xc860('0x5e'),_0x1efeeb['id']);logger[_0xc860('0x20')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x1efeeb['id'],_0x47cc6c[_0xc860('0x3a')],_0x5cb62a[_0xc860('0x33')]);switch(_0x5cb62a[_0xc860('0x33')]){case _0xc860('0x5f'):emit(util[_0xc860('0x2f')](_0xc860('0x4e'),_0x47cc6c[_0xc860('0x3a')]),_0xc860('0x4f'),{'recordId':_0x1efeeb['id']});break;case _0xc860('0x60'):emit(util['format']('user:%s',_0x47cc6c['name']),_0xc860('0x50'),{'uri':util[_0xc860('0x2f')](_0xc860('0x51'),_0x57cd01[_0xc860('0x52')],_0x1efeeb['id'])});break;default:logger[_0xc860('0x53')]('[OUTBOUND]',_0xc860('0x61'));}})[_0xc860('0x55')](function(_0x1aae1b){logger[_0xc860('0x53')](_0xc860('0x62'),JSON[_0xc860('0x57')](_0x1aae1b));});};exports[_0xc860('0x63')]=function(_0x138463,_0x520338,_0x511f4f,_0x1ea1f7,_0x1df7f1,_0x30cbc2){var _0x245a07,_0x28ed8c,_0x56955b,_0x279917;_0x30cbc2[_0xc860('0x44')]=intUtil[_0xc860('0x45')](_0x30cbc2[_0xc860('0x44')]);_0x30cbc2[_0xc860('0x3f')]=intUtil['stripTrailingSlash'](_0x30cbc2[_0xc860('0x3f')]);if(_0x1df7f1&&_0x1df7f1[_0xc860('0x46')]){logger['info']('['+_0x520338[_0xc860('0x64')][_0xc860('0x65')]()+']',_0xc860('0x59'));_0x520338[_0xc860('0x48')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x30cbc2['serverUrl'],_0x520338[_0xc860('0x5a')],md5(_0x520338[_0xc860('0x5a')]));}else{_0x520338[_0xc860('0x48')]='';}return getConnection(_0x30cbc2)['then'](function(_0x4f47a3){_0x279917=_0x4f47a3;if(!_[_0xc860('0x16')](_0x1ea1f7)){return getUser(_0x30cbc2,_0x1ea1f7[_0xc860('0x3a')],_0x279917);}else{return getUser(_0x30cbc2,null,_0x279917);}})[_0xc860('0x1a')](function(_0x395361){_0x245a07=_0x395361;return getEndUser(_0x30cbc2,_0x511f4f,_0x520338['calleridname'],_0x520338[_0xc860('0x4b')],_0x279917);})[_0xc860('0x1a')](function(_0x45b04c){_0x28ed8c=_0x45b04c;return getTicket(_0x30cbc2,_0x245a07,_0x28ed8c,_0x511f4f,_0x520338,_0x511f4f['Fields'],_0x279917);})[_0xc860('0x1a')](function(_0x51eadd){_0x56955b=_0x51eadd;logger['info']('['+_0x520338[_0xc860('0x64')][_0xc860('0x65')]()+_0xc860('0x66'),_0x56955b['id']);logger[_0xc860('0x20')]('['+_0x520338[_0xc860('0x64')][_0xc860('0x65')]()+_0xc860('0x67'),_0x30cbc2['type']);})[_0xc860('0x55')](function(_0x25adb5){logger['error']('['+_0x520338[_0xc860('0x64')][_0xc860('0x65')]()+']',JSON[_0xc860('0x57')](_0x25adb5));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/servicenow.js b/server/services/ami/trigger/integration/servicenow.js index a63d830..0750ba3 100644 --- a/server/services/ami/trigger/integration/servicenow.js +++ b/server/services/ami/trigger/integration/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['recordingURL','The\x20ticket\x20ID\x20is:\x20%s','format','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','GET','],\x20getUser\x20rp\x20obj','then','length','active','true','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','string','nameField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','customField','name',']\x20getTicket\x20input\x20crm','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','?sysparm_query=name%3D','label_entry','Incident\x20-\x20',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','emit','username','password','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','userEmail','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none'];(function(_0x382278,_0x140b83){var _0x20c68d=function(_0xc8c51a){while(--_0xc8c51a){_0x382278['push'](_0x382278['shift']());}};_0x20c68d(++_0x140b83);}(_0x1261,0x144));var _0x1126=function(_0x4db40c,_0x5aebda){_0x4db40c=_0x4db40c-0x0;var _0x572a4b=_0x1261[_0x4db40c];return _0x572a4b;};'use strict';var _=require('lodash');var Promise=require(_0x1126('0x0'));var rp=require(_0x1126('0x1'));var util=require(_0x1126('0x2'));var md5=require(_0x1126('0x3'));var Redis=require(_0x1126('0x4'));var intUtil=require(_0x1126('0x5'));var config=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));config[_0x1126('0x9')]=_['defaults'](config['redis'],{'host':_0x1126('0xa'),'port':0x18eb});var io=require(_0x1126('0xb'))(new Redis(config['redis']));function getAdminUser(_0x17e5f0,_0x28772d,_0x245be9,_0x3abb0b,_0x2d9033,_0x59cfa1){return new Promise(function(_0x3f09ac,_0x18dbe6){var _0x167ef1={'method':'GET','uri':_0x3abb0b+_0x1126('0xc')+'&'+_0x2d9033+'&'+_0x59cfa1,'auth':_0x28772d,'json':!![]};return rp(_0x167ef1)['then'](function(_0x52ef15){if(_0x52ef15[_0x1126('0xd')]['length']>0x0){_0x245be9[_0x1126('0xe')]=_0x52ef15[_0x1126('0xd')][0x0][_0x1126('0xf')];}logger[_0x1126('0x10')]('['+[_0x17e5f0[_0x1126('0x11')]()]+_0x1126('0x12'),_0x245be9);_0x3f09ac(_0x245be9);})[_0x1126('0x13')](function(_0x2048ad){logger[_0x1126('0x14')]('['+[_0x17e5f0['toUpperCase']()]+']',_0x2048ad['message']);_0x18dbe6(_0x2048ad[_0x1126('0x15')]);});});}function getUser(_0x154e20,_0x279455,_0x4be0c6,_0x45149c,_0x4794a7){return function(_0x35fe9f){logger[_0x1126('0x10')]('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x35fe9f);return new Promise(function(_0x245cd7,_0x1695f6){if(intUtil['validateEmail'](_0x35fe9f['userEmail'])){var _0x22ae0b={'method':_0x1126('0x16'),'uri':_0x4be0c6+'sys_user?sysparm_query=email%3D'+_0x35fe9f['userEmail']+'&'+_0x45149c+'&'+_0x4794a7,'auth':_0x279455,'json':!![]};logger[_0x1126('0x10')]('['+[_0x154e20['toUpperCase']()]+_0x1126('0x17'),_0x22ae0b);return rp(_0x22ae0b)[_0x1126('0x18')](function(_0x2f70ac){logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20entity',_0x2f70ac);if(_0x2f70ac['result'][_0x1126('0x19')]>0x0&&String(_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0x1a')])===_0x1126('0x1b')){_0x35fe9f['userId']=_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0xf')];}else{_0x35fe9f['userId']=_0x35fe9f[_0x1126('0xe')];_0x35fe9f['userEmail']=_0x35fe9f['adminEmail'];}logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1c'),_0x35fe9f);_0x245cd7(_0x35fe9f);})[_0x1126('0x13')](function(_0x34bcf1){logger[_0x1126('0x14')]('['+[_0x154e20[_0x1126('0x11')]()]+']',_0x34bcf1[_0x1126('0x15')]);_0x1695f6(_0x34bcf1[_0x1126('0x15')]);});}else{logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1d'));_0x35fe9f[_0x1126('0x1e')]=_0x35fe9f['adminId'];_0x35fe9f['userEmail']=_0x35fe9f[_0x1126('0x1f')];_0x245cd7(_0x35fe9f);}});};}function createEndUser(_0x39bf0e,_0x55e195,_0x2fb797,_0x23d2bc,_0x4a334a){logger[_0x1126('0x10')]('['+[_0x39bf0e['toUpperCase']()]+_0x1126('0x20'),_0x2fb797);return new Promise(function(_0x4bd50b,_0x771bb8){var _0x583ce6={'method':_0x1126('0x21'),'uri':_0x23d2bc+'sys_user?'+_0x4a334a,'body':{'user_name':_0x2fb797['endUserNumber'],'roles':'user','first_name':_0x2fb797[_0x1126('0x22')],'active':_0x1126('0x1b'),'date_format':_0x1126('0x23'),'phone':_0x2fb797['endUserNumber']},'auth':_0x55e195,'json':!![]};return rp(_0x583ce6)[_0x1126('0x18')](function(_0x226afb){logger['info']('['+[_0x39bf0e[_0x1126('0x11')]()]+_0x1126('0x24'),_0x226afb[_0x1126('0xd')]);_0x2fb797[_0x1126('0x25')]=_0x226afb['result']['sys_id'];_0x4bd50b(_0x2fb797);})[_0x1126('0x13')](function(_0x19e6e4){logger[_0x1126('0x14')]('['+[_0x39bf0e[_0x1126('0x11')]()]+']',_0x19e6e4['message']);_0x771bb8(_0x19e6e4[_0x1126('0x15')]);});});}function getEndUser(_0x6f4312,_0x313ebe,_0x22436c,_0x3b0f79,_0x5df232){return function(_0x2a0dfe){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x26'),_0x2a0dfe);return new Promise(function(_0x5c019d,_0x4ca51c){var _0x22827a={'method':_0x1126('0x16'),'uri':_0x22436c+'sys_user?sysparm_query=phone%3D'+_0x2a0dfe[_0x1126('0x22')]+'&'+_0x3b0f79+'&'+_0x5df232,'auth':_0x313ebe,'json':!![]};return rp(_0x22827a)[_0x1126('0x18')](function(_0x11b0f6){if(_0x11b0f6['result']['length']>0x0){_0x2a0dfe[_0x1126('0x25')]=_0x11b0f6[_0x1126('0xd')][0x0][_0x1126('0xf')];logger[_0x1126('0x10')]('['+[_0x6f4312['toUpperCase']()]+_0x1126('0x27'),_0x2a0dfe);_0x5c019d(_0x2a0dfe);}else{return createEndUser(_0x6f4312,_0x313ebe,_0x2a0dfe,_0x22436c,_0x3b0f79)['then'](function(_0x8abfe3){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x28'),_0x8abfe3);_0x5c019d(_0x8abfe3);});}})[_0x1126('0x13')](function(_0x5746f6){logger[_0x1126('0x14')]('['+[_0x6f4312[_0x1126('0x11')]()]+']',_0x5746f6[_0x1126('0x15')]);_0x4ca51c(_0x5746f6[_0x1126('0x15')]);});});};}function getCustomFields(_0x3469a2,_0x3442b8){var _0x3052f9={};if(_0x3469a2['length']>0x0){_[_0x1126('0x29')](_0x3469a2,function(_0x154c28){if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x2c')]&&!_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x154c28[_0x1126('0x2e')][_0x1126('0x2f')]();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField']['toLowerCase']()]=_0x154c28[_0x1126('0x2e')]['toString']();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x31')&&_0x154c28[_0x1126('0x32')]&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x3442b8[_0x154c28[_0x1126('0x32')]][_0x1126('0x2f')]();}else if(_0x154c28['type']===_0x1126('0x33')&&_0x154c28['Variable']&&_0x154c28[_0x1126('0x34')]['name']&&_0x154c28[_0x1126('0x30')]&&_0x154c28[_0x1126('0x35')]){_0x3052f9[_0x154c28[_0x1126('0x30')]['toLowerCase']()]=_0x3442b8[_0x154c28[_0x1126('0x34')][_0x1126('0x36')][_0x1126('0x2d')]()]['toString']();}});}return _0x3052f9;}function getTicket(_0x58ff3a,_0x4dd7f5,_0x6e78cf,_0x520b62,_0x1e197e,_0x507568){return function(_0x2f45b9){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x37'),_0x2f45b9);return new Promise(function(_0xede3d8,_0x56732f){var _0x198173=_0x58ff3a[_0x1126('0x2d')]()==='outbound'?_0x2f45b9[_0x1126('0x1e')]:_0x2f45b9[_0x1126('0x25')];var _0x575f79={'method':_0x1126('0x21'),'uri':_0x6e78cf+_0x1126('0x38')+'?'+_0x507568,'body':Object['assign']({},{'active':_0x1126('0x1b'),'caller_id':_0x198173,'assigned_to':_0x2f45b9[_0x1126('0x1e')],'short_description':intUtil[_0x1126('0x39')](_0x520b62['Subjects'],_0x1e197e,'\x20'),'description':intUtil[_0x1126('0x39')](_0x520b62[_0x1126('0x3a')],_0x1e197e,'\x0a')},getCustomFields(_0x520b62[_0x1126('0x3b')],_0x1e197e)),'auth':_0x4dd7f5,'json':!![]};return rp(_0x575f79)[_0x1126('0x18')](function(_0x224456){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3c'),_0x224456['result']);_0x2f45b9[_0x1126('0x3d')]=_0x224456['result'][_0x1126('0xf')];_0x2f45b9[_0x1126('0x3e')]=_0x224456['result']['number'];logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3f'),_0x2f45b9);_0xede3d8(_0x2f45b9);})['catch'](function(_0x3cb44c){logger[_0x1126('0x14')]('['+[_0x58ff3a[_0x1126('0x11')]()]+']',_0x3cb44c[_0x1126('0x15')]);_0x56732f(_0x3cb44c['message']);});});};}function createRemoteTag(_0x30d1b3,_0x46551f,_0x5c36b9,_0x4bcc08){return new Promise(function(_0x4abb4d,_0x526b07){var _0x386c10={'method':_0x1126('0x21'),'uri':_0x5c36b9+'label'+'?'+_0x4bcc08,'body':{'short_description':_0x30d1b3,'global':!![],'active':!![],'name':_0x30d1b3},'auth':_0x46551f,'json':!![]};return rp(_0x386c10)[_0x1126('0x18')](function(_0x1c7a2b){var _0x38093e=_0x1c7a2b[_0x1126('0xd')][_0x1126('0xf')];_0x4abb4d(_0x38093e);});});}function getRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414,_0x322016){return new Promise(function(_0x476aca,_0xcc9499){var _0x36b61={'method':_0x1126('0x16'),'uri':_0x267592+'label'+_0x1126('0x40')+_0x4e4d49+'&'+_0x5d6414,'auth':_0x41cbb6,'json':!![]};return rp(_0x36b61)['then'](function(_0x868b2c){if(_0x868b2c[_0x1126('0xd')][_0x1126('0x19')]>0x0){var _0x590bc2=_0x868b2c[_0x1126('0xd')][0x0][_0x1126('0xf')];_0x476aca(_0x590bc2);}else{return createRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414)['then'](function(_0x30812d){_0x476aca(_0x30812d);});}});});}function assignTagToIncident(_0x25038f,_0x9bad53,_0x5a5340,_0x2fe6dc,_0x3377db){return new Promise(function(_0x22ab18,_0x308ee4){var _0x128c94={'method':_0x1126('0x21'),'uri':_0x5a5340+_0x1126('0x41')+'?'+_0x3377db,'body':{'label':_0x25038f,'table':_0x1126('0x38'),'id_type':'Incident','table_key':_0x2fe6dc[_0x1126('0x3d')],'title':_0x1126('0x42')+_0x2fe6dc[_0x1126('0x3e')],'id_display':_0x2fe6dc[_0x1126('0x3e')]},'auth':_0x9bad53,'json':!![]};return rp(_0x128c94)[_0x1126('0x18')](function(_0x4f5772){_0x22ab18();})[_0x1126('0x13')](function(){_0x22ab18();});});}function manageTags(_0x315386,_0x5e0ea1,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91,_0x478806){return new Promise(function(_0x3062d6,_0x21d4ef){var _0x375b76=[];_0x5e0ea1['forEach'](function(_0x13394f){_0x375b76['push'](getRemoteTag(_0x13394f,_0x3767e4,_0x5246aa,_0x10ff91,_0x478806));});return Promise['all'](_0x375b76)[_0x1126('0x18')](function(_0x40185f){if(_0x40185f[_0x1126('0x19')]){logger[_0x1126('0x10')]('['+[_0x315386[_0x1126('0x11')]()]+_0x1126('0x43'),_0x40185f);var _0x1a0e26=[];_0x40185f['forEach'](function(_0x191307){_0x1a0e26[_0x1126('0x44')](assignTagToIncident(_0x191307,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91));});return Promise[_0x1126('0x45')](_0x1a0e26)[_0x1126('0x18')](function(){_0x3062d6();})[_0x1126('0x13')](function(){_0x3062d6();});}else{_0x3062d6();}});});}function getTags(_0x3cd788,_0x5a0804,_0x5b17d6,_0x16a343,_0x3921c2,_0x4bf2b3){return function(_0x5ee130){return new Promise(function(_0x5e9260,_0x51a28d){var _0x964a2=[];var _0x37b1ab=_0x16a343[_0x1126('0x46')];if(_0x37b1ab&&_0x37b1ab['length']>0x0){_0x964a2=_[_0x1126('0x47')](_0x37b1ab,_0x1126('0x36'));}if(_0x964a2[_0x1126('0x19')]>0x0){return manageTags(_0x3cd788,_0x964a2,_0x5a0804,_0x5b17d6,_0x5ee130,_0x3921c2,_0x4bf2b3)[_0x1126('0x18')](function(){_0x5e9260(_0x5ee130);});}else{_0x5e9260(_0x5ee130);}});};}function emit(_0x22d403,_0x3f007b,_0x131056){var _0x49a0a3=_0x1126('0x48')+_0x1126('0x49')+_0x1126('0x4a')+_0x1126('0x4b');var _0x288b9b={'uri':_0x22d403+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x131056+_0x49a0a3};io['to'](util['format'](_0x1126('0x4c'),_0x3f007b))[_0x1126('0x4d')]('trigger:browser:url',_0x288b9b);}exports['cs']=function(_0x3bf25d,_0x1fb2f0,_0x366675,_0x6a41c0,_0x2828d4,_0x30d240,_0x41ce78,_0x247f12){var _0xd20fbe={};var _0x3d5e15={'user':_0x30d240[_0x1126('0x4e')],'pass':_0x30d240[_0x1126('0x4f')]};var _0x3dad39='sysparm_limit=1';var _0x111f49=_0x1126('0x50');_0x30d240[_0x1126('0x51')]=intUtil['stripTrailingSlash'](_0x30d240['remoteUri']);_0x30d240[_0x1126('0x52')]=intUtil[_0x1126('0x53')](_0x30d240[_0x1126('0x52')]);var _0x3bfeb8=util['format']('%s/api/now/table/',_0x30d240['remoteUri']);_0xd20fbe[_0x1126('0x54')]=!_[_0x1126('0x55')](_0x6a41c0)?_0x6a41c0[_0x1126('0x56')]:null;_0xd20fbe[_0x1126('0x1f')]=_0x30d240['email'];_0xd20fbe[_0x1126('0x22')]=_0x247f12['toLowerCase']()===_0x1126('0x57')?_0x1fb2f0[_0x1126('0x58')]:_0x1fb2f0[_0x1126('0x59')];_0xd20fbe[_0x1126('0x5a')]=_0x247f12===_0x1126('0x5b')||_0x247f12===_0x1126('0x5c')?_0x1126('0x5b'):'outbound';var _0xfd2d9=util['format'](_0x1126('0x5d'),_0x30d240[_0x1126('0x52')],_0x1fb2f0['uniqueid'],md5(_0x1fb2f0[_0x1126('0x5e')]));if(_0x2828d4&&_0x2828d4[_0x1126('0x5f')]){logger['info'](_0x1126('0x60'),_0x1126('0x61'));_0x1fb2f0['recordingURL']=_0xfd2d9;}else if(_0x41ce78&&_0x41ce78['recordingFormat']&&_0x41ce78[_0x1126('0x62')]!==_0x1126('0x63')){logger[_0x1126('0x10')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1fb2f0['recordingURL']=_0xfd2d9;}else{_0x1fb2f0[_0x1126('0x64')]='';}return getAdminUser(_0x247f12,_0x3d5e15,_0xd20fbe,_0x3bfeb8,_0x111f49,_0x3dad39)['then'](getUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))['then'](getEndUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))[_0x1126('0x18')](getTicket(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x366675,_0x1fb2f0,_0x111f49))['then'](function(_0x1f320e){logger[_0x1126('0x10')](util['format'](_0x1126('0x65'),_0x1f320e[_0x1126('0x3d')]));logger[_0x1126('0x10')](util[_0x1126('0x66')](_0x1126('0x67'),_0x247f12));if(_0x247f12!=='unmanaged'){logger[_0x1126('0x10')]('['+[_0x247f12[_0x1126('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x30d240[_0x1126('0x51')],_0x6a41c0[_0x1126('0x36')],_0x1f320e[_0x1126('0x3d')]);}})[_0x1126('0x13')](function(_0x2598a7){logger[_0x1126('0x14')]('['+[_0x247f12[_0x1126('0x11')]()]+_0x1126('0x68'),util[_0x1126('0x69')](_0x2598a7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1261=['recordingURL','The\x20ticket\x20ID\x20is:\x20%s','format','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','GET','],\x20getUser\x20rp\x20obj','then','length','active','true','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','string','nameField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','customField','name',']\x20getTicket\x20input\x20crm','incident','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','?sysparm_query=name%3D','label_entry','Incident\x20-\x20',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','emit','username','password','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','userEmail','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none'];(function(_0x5f4382,_0xcb3195){var _0x368006=function(_0x2c8062){while(--_0x2c8062){_0x5f4382['push'](_0x5f4382['shift']());}};_0x368006(++_0xcb3195);}(_0x1261,0x144));var _0x1126=function(_0x5fd828,_0xa7ede9){_0x5fd828=_0x5fd828-0x0;var _0x3c1eaa=_0x1261[_0x5fd828];return _0x3c1eaa;};'use strict';var _=require('lodash');var Promise=require(_0x1126('0x0'));var rp=require(_0x1126('0x1'));var util=require(_0x1126('0x2'));var md5=require(_0x1126('0x3'));var Redis=require(_0x1126('0x4'));var intUtil=require(_0x1126('0x5'));var config=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));config[_0x1126('0x9')]=_['defaults'](config['redis'],{'host':_0x1126('0xa'),'port':0x18eb});var io=require(_0x1126('0xb'))(new Redis(config['redis']));function getAdminUser(_0x17e5f0,_0x28772d,_0x245be9,_0x3abb0b,_0x2d9033,_0x59cfa1){return new Promise(function(_0x3f09ac,_0x18dbe6){var _0x167ef1={'method':'GET','uri':_0x3abb0b+_0x1126('0xc')+'&'+_0x2d9033+'&'+_0x59cfa1,'auth':_0x28772d,'json':!![]};return rp(_0x167ef1)['then'](function(_0x52ef15){if(_0x52ef15[_0x1126('0xd')]['length']>0x0){_0x245be9[_0x1126('0xe')]=_0x52ef15[_0x1126('0xd')][0x0][_0x1126('0xf')];}logger[_0x1126('0x10')]('['+[_0x17e5f0[_0x1126('0x11')]()]+_0x1126('0x12'),_0x245be9);_0x3f09ac(_0x245be9);})[_0x1126('0x13')](function(_0x2048ad){logger[_0x1126('0x14')]('['+[_0x17e5f0['toUpperCase']()]+']',_0x2048ad['message']);_0x18dbe6(_0x2048ad[_0x1126('0x15')]);});});}function getUser(_0x154e20,_0x279455,_0x4be0c6,_0x45149c,_0x4794a7){return function(_0x35fe9f){logger[_0x1126('0x10')]('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x35fe9f);return new Promise(function(_0x245cd7,_0x1695f6){if(intUtil['validateEmail'](_0x35fe9f['userEmail'])){var _0x22ae0b={'method':_0x1126('0x16'),'uri':_0x4be0c6+'sys_user?sysparm_query=email%3D'+_0x35fe9f['userEmail']+'&'+_0x45149c+'&'+_0x4794a7,'auth':_0x279455,'json':!![]};logger[_0x1126('0x10')]('['+[_0x154e20['toUpperCase']()]+_0x1126('0x17'),_0x22ae0b);return rp(_0x22ae0b)[_0x1126('0x18')](function(_0x2f70ac){logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+'],\x20getUser\x20entity',_0x2f70ac);if(_0x2f70ac['result'][_0x1126('0x19')]>0x0&&String(_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0x1a')])===_0x1126('0x1b')){_0x35fe9f['userId']=_0x2f70ac[_0x1126('0xd')][0x0][_0x1126('0xf')];}else{_0x35fe9f['userId']=_0x35fe9f[_0x1126('0xe')];_0x35fe9f['userEmail']=_0x35fe9f['adminEmail'];}logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1c'),_0x35fe9f);_0x245cd7(_0x35fe9f);})[_0x1126('0x13')](function(_0x34bcf1){logger[_0x1126('0x14')]('['+[_0x154e20[_0x1126('0x11')]()]+']',_0x34bcf1[_0x1126('0x15')]);_0x1695f6(_0x34bcf1[_0x1126('0x15')]);});}else{logger['info']('['+[_0x154e20[_0x1126('0x11')]()]+_0x1126('0x1d'));_0x35fe9f[_0x1126('0x1e')]=_0x35fe9f['adminId'];_0x35fe9f['userEmail']=_0x35fe9f[_0x1126('0x1f')];_0x245cd7(_0x35fe9f);}});};}function createEndUser(_0x39bf0e,_0x55e195,_0x2fb797,_0x23d2bc,_0x4a334a){logger[_0x1126('0x10')]('['+[_0x39bf0e['toUpperCase']()]+_0x1126('0x20'),_0x2fb797);return new Promise(function(_0x4bd50b,_0x771bb8){var _0x583ce6={'method':_0x1126('0x21'),'uri':_0x23d2bc+'sys_user?'+_0x4a334a,'body':{'user_name':_0x2fb797['endUserNumber'],'roles':'user','first_name':_0x2fb797[_0x1126('0x22')],'active':_0x1126('0x1b'),'date_format':_0x1126('0x23'),'phone':_0x2fb797['endUserNumber']},'auth':_0x55e195,'json':!![]};return rp(_0x583ce6)[_0x1126('0x18')](function(_0x226afb){logger['info']('['+[_0x39bf0e[_0x1126('0x11')]()]+_0x1126('0x24'),_0x226afb[_0x1126('0xd')]);_0x2fb797[_0x1126('0x25')]=_0x226afb['result']['sys_id'];_0x4bd50b(_0x2fb797);})[_0x1126('0x13')](function(_0x19e6e4){logger[_0x1126('0x14')]('['+[_0x39bf0e[_0x1126('0x11')]()]+']',_0x19e6e4['message']);_0x771bb8(_0x19e6e4[_0x1126('0x15')]);});});}function getEndUser(_0x6f4312,_0x313ebe,_0x22436c,_0x3b0f79,_0x5df232){return function(_0x2a0dfe){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x26'),_0x2a0dfe);return new Promise(function(_0x5c019d,_0x4ca51c){var _0x22827a={'method':_0x1126('0x16'),'uri':_0x22436c+'sys_user?sysparm_query=phone%3D'+_0x2a0dfe[_0x1126('0x22')]+'&'+_0x3b0f79+'&'+_0x5df232,'auth':_0x313ebe,'json':!![]};return rp(_0x22827a)[_0x1126('0x18')](function(_0x11b0f6){if(_0x11b0f6['result']['length']>0x0){_0x2a0dfe[_0x1126('0x25')]=_0x11b0f6[_0x1126('0xd')][0x0][_0x1126('0xf')];logger[_0x1126('0x10')]('['+[_0x6f4312['toUpperCase']()]+_0x1126('0x27'),_0x2a0dfe);_0x5c019d(_0x2a0dfe);}else{return createEndUser(_0x6f4312,_0x313ebe,_0x2a0dfe,_0x22436c,_0x3b0f79)['then'](function(_0x8abfe3){logger[_0x1126('0x10')]('['+[_0x6f4312[_0x1126('0x11')]()]+_0x1126('0x28'),_0x8abfe3);_0x5c019d(_0x8abfe3);});}})[_0x1126('0x13')](function(_0x5746f6){logger[_0x1126('0x14')]('['+[_0x6f4312[_0x1126('0x11')]()]+']',_0x5746f6[_0x1126('0x15')]);_0x4ca51c(_0x5746f6[_0x1126('0x15')]);});});};}function getCustomFields(_0x3469a2,_0x3442b8){var _0x3052f9={};if(_0x3469a2['length']>0x0){_[_0x1126('0x29')](_0x3469a2,function(_0x154c28){if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x2c')]&&!_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x154c28[_0x1126('0x2e')][_0x1126('0x2f')]();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x2b')&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField']['toLowerCase']()]=_0x154c28[_0x1126('0x2e')]['toString']();}else if(_0x154c28[_0x1126('0x2a')]===_0x1126('0x31')&&_0x154c28[_0x1126('0x32')]&&_0x154c28[_0x1126('0x30')]&&_0x154c28['customField']){_0x3052f9[_0x154c28['idField'][_0x1126('0x2d')]()]=_0x3442b8[_0x154c28[_0x1126('0x32')]][_0x1126('0x2f')]();}else if(_0x154c28['type']===_0x1126('0x33')&&_0x154c28['Variable']&&_0x154c28[_0x1126('0x34')]['name']&&_0x154c28[_0x1126('0x30')]&&_0x154c28[_0x1126('0x35')]){_0x3052f9[_0x154c28[_0x1126('0x30')]['toLowerCase']()]=_0x3442b8[_0x154c28[_0x1126('0x34')][_0x1126('0x36')][_0x1126('0x2d')]()]['toString']();}});}return _0x3052f9;}function getTicket(_0x58ff3a,_0x4dd7f5,_0x6e78cf,_0x520b62,_0x1e197e,_0x507568){return function(_0x2f45b9){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x37'),_0x2f45b9);return new Promise(function(_0xede3d8,_0x56732f){var _0x198173=_0x58ff3a[_0x1126('0x2d')]()==='outbound'?_0x2f45b9[_0x1126('0x1e')]:_0x2f45b9[_0x1126('0x25')];var _0x575f79={'method':_0x1126('0x21'),'uri':_0x6e78cf+_0x1126('0x38')+'?'+_0x507568,'body':Object['assign']({},{'active':_0x1126('0x1b'),'caller_id':_0x198173,'assigned_to':_0x2f45b9[_0x1126('0x1e')],'short_description':intUtil[_0x1126('0x39')](_0x520b62['Subjects'],_0x1e197e,'\x20'),'description':intUtil[_0x1126('0x39')](_0x520b62[_0x1126('0x3a')],_0x1e197e,'\x0a')},getCustomFields(_0x520b62[_0x1126('0x3b')],_0x1e197e)),'auth':_0x4dd7f5,'json':!![]};return rp(_0x575f79)[_0x1126('0x18')](function(_0x224456){logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3c'),_0x224456['result']);_0x2f45b9[_0x1126('0x3d')]=_0x224456['result'][_0x1126('0xf')];_0x2f45b9[_0x1126('0x3e')]=_0x224456['result']['number'];logger[_0x1126('0x10')]('['+[_0x58ff3a[_0x1126('0x11')]()]+_0x1126('0x3f'),_0x2f45b9);_0xede3d8(_0x2f45b9);})['catch'](function(_0x3cb44c){logger[_0x1126('0x14')]('['+[_0x58ff3a[_0x1126('0x11')]()]+']',_0x3cb44c[_0x1126('0x15')]);_0x56732f(_0x3cb44c['message']);});});};}function createRemoteTag(_0x30d1b3,_0x46551f,_0x5c36b9,_0x4bcc08){return new Promise(function(_0x4abb4d,_0x526b07){var _0x386c10={'method':_0x1126('0x21'),'uri':_0x5c36b9+'label'+'?'+_0x4bcc08,'body':{'short_description':_0x30d1b3,'global':!![],'active':!![],'name':_0x30d1b3},'auth':_0x46551f,'json':!![]};return rp(_0x386c10)[_0x1126('0x18')](function(_0x1c7a2b){var _0x38093e=_0x1c7a2b[_0x1126('0xd')][_0x1126('0xf')];_0x4abb4d(_0x38093e);});});}function getRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414,_0x322016){return new Promise(function(_0x476aca,_0xcc9499){var _0x36b61={'method':_0x1126('0x16'),'uri':_0x267592+'label'+_0x1126('0x40')+_0x4e4d49+'&'+_0x5d6414,'auth':_0x41cbb6,'json':!![]};return rp(_0x36b61)['then'](function(_0x868b2c){if(_0x868b2c[_0x1126('0xd')][_0x1126('0x19')]>0x0){var _0x590bc2=_0x868b2c[_0x1126('0xd')][0x0][_0x1126('0xf')];_0x476aca(_0x590bc2);}else{return createRemoteTag(_0x4e4d49,_0x41cbb6,_0x267592,_0x5d6414)['then'](function(_0x30812d){_0x476aca(_0x30812d);});}});});}function assignTagToIncident(_0x25038f,_0x9bad53,_0x5a5340,_0x2fe6dc,_0x3377db){return new Promise(function(_0x22ab18,_0x308ee4){var _0x128c94={'method':_0x1126('0x21'),'uri':_0x5a5340+_0x1126('0x41')+'?'+_0x3377db,'body':{'label':_0x25038f,'table':_0x1126('0x38'),'id_type':'Incident','table_key':_0x2fe6dc[_0x1126('0x3d')],'title':_0x1126('0x42')+_0x2fe6dc[_0x1126('0x3e')],'id_display':_0x2fe6dc[_0x1126('0x3e')]},'auth':_0x9bad53,'json':!![]};return rp(_0x128c94)[_0x1126('0x18')](function(_0x4f5772){_0x22ab18();})[_0x1126('0x13')](function(){_0x22ab18();});});}function manageTags(_0x315386,_0x5e0ea1,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91,_0x478806){return new Promise(function(_0x3062d6,_0x21d4ef){var _0x375b76=[];_0x5e0ea1['forEach'](function(_0x13394f){_0x375b76['push'](getRemoteTag(_0x13394f,_0x3767e4,_0x5246aa,_0x10ff91,_0x478806));});return Promise['all'](_0x375b76)[_0x1126('0x18')](function(_0x40185f){if(_0x40185f[_0x1126('0x19')]){logger[_0x1126('0x10')]('['+[_0x315386[_0x1126('0x11')]()]+_0x1126('0x43'),_0x40185f);var _0x1a0e26=[];_0x40185f['forEach'](function(_0x191307){_0x1a0e26[_0x1126('0x44')](assignTagToIncident(_0x191307,_0x3767e4,_0x5246aa,_0x272274,_0x10ff91));});return Promise[_0x1126('0x45')](_0x1a0e26)[_0x1126('0x18')](function(){_0x3062d6();})[_0x1126('0x13')](function(){_0x3062d6();});}else{_0x3062d6();}});});}function getTags(_0x3cd788,_0x5a0804,_0x5b17d6,_0x16a343,_0x3921c2,_0x4bf2b3){return function(_0x5ee130){return new Promise(function(_0x5e9260,_0x51a28d){var _0x964a2=[];var _0x37b1ab=_0x16a343[_0x1126('0x46')];if(_0x37b1ab&&_0x37b1ab['length']>0x0){_0x964a2=_[_0x1126('0x47')](_0x37b1ab,_0x1126('0x36'));}if(_0x964a2[_0x1126('0x19')]>0x0){return manageTags(_0x3cd788,_0x964a2,_0x5a0804,_0x5b17d6,_0x5ee130,_0x3921c2,_0x4bf2b3)[_0x1126('0x18')](function(){_0x5e9260(_0x5ee130);});}else{_0x5e9260(_0x5ee130);}});};}function emit(_0x22d403,_0x3f007b,_0x131056){var _0x49a0a3=_0x1126('0x48')+_0x1126('0x49')+_0x1126('0x4a')+_0x1126('0x4b');var _0x288b9b={'uri':_0x22d403+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x131056+_0x49a0a3};io['to'](util['format'](_0x1126('0x4c'),_0x3f007b))[_0x1126('0x4d')]('trigger:browser:url',_0x288b9b);}exports['cs']=function(_0x3bf25d,_0x1fb2f0,_0x366675,_0x6a41c0,_0x2828d4,_0x30d240,_0x41ce78,_0x247f12){var _0xd20fbe={};var _0x3d5e15={'user':_0x30d240[_0x1126('0x4e')],'pass':_0x30d240[_0x1126('0x4f')]};var _0x3dad39='sysparm_limit=1';var _0x111f49=_0x1126('0x50');_0x30d240[_0x1126('0x51')]=intUtil['stripTrailingSlash'](_0x30d240['remoteUri']);_0x30d240[_0x1126('0x52')]=intUtil[_0x1126('0x53')](_0x30d240[_0x1126('0x52')]);var _0x3bfeb8=util['format']('%s/api/now/table/',_0x30d240['remoteUri']);_0xd20fbe[_0x1126('0x54')]=!_[_0x1126('0x55')](_0x6a41c0)?_0x6a41c0[_0x1126('0x56')]:null;_0xd20fbe[_0x1126('0x1f')]=_0x30d240['email'];_0xd20fbe[_0x1126('0x22')]=_0x247f12['toLowerCase']()===_0x1126('0x57')?_0x1fb2f0[_0x1126('0x58')]:_0x1fb2f0[_0x1126('0x59')];_0xd20fbe[_0x1126('0x5a')]=_0x247f12===_0x1126('0x5b')||_0x247f12===_0x1126('0x5c')?_0x1126('0x5b'):'outbound';var _0xfd2d9=util['format'](_0x1126('0x5d'),_0x30d240[_0x1126('0x52')],_0x1fb2f0['uniqueid'],md5(_0x1fb2f0[_0x1126('0x5e')]));if(_0x2828d4&&_0x2828d4[_0x1126('0x5f')]){logger['info'](_0x1126('0x60'),_0x1126('0x61'));_0x1fb2f0['recordingURL']=_0xfd2d9;}else if(_0x41ce78&&_0x41ce78['recordingFormat']&&_0x41ce78[_0x1126('0x62')]!==_0x1126('0x63')){logger[_0x1126('0x10')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1fb2f0['recordingURL']=_0xfd2d9;}else{_0x1fb2f0[_0x1126('0x64')]='';}return getAdminUser(_0x247f12,_0x3d5e15,_0xd20fbe,_0x3bfeb8,_0x111f49,_0x3dad39)['then'](getUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))['then'](getEndUser(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x111f49,_0x3dad39))[_0x1126('0x18')](getTicket(_0x247f12,_0x3d5e15,_0x3bfeb8,_0x366675,_0x1fb2f0,_0x111f49))['then'](function(_0x1f320e){logger[_0x1126('0x10')](util['format'](_0x1126('0x65'),_0x1f320e[_0x1126('0x3d')]));logger[_0x1126('0x10')](util[_0x1126('0x66')](_0x1126('0x67'),_0x247f12));if(_0x247f12!=='unmanaged'){logger[_0x1126('0x10')]('['+[_0x247f12[_0x1126('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x30d240[_0x1126('0x51')],_0x6a41c0[_0x1126('0x36')],_0x1f320e[_0x1126('0x3d')]);}})[_0x1126('0x13')](function(_0x2598a7){logger[_0x1126('0x14')]('['+[_0x247f12[_0x1126('0x11')]()]+_0x1126('0x68'),util[_0x1126('0x69')](_0x2598a7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index 46b583f..fefdae1 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 _0x8af6=['./util','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','localhost','socket.io-emitter','redis','POST','info','Creating\x20new\x20ticket...','name','assigned_user_id','created_by','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_type','Contacts','parent_name','forEach','push','idField','variableName','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','value','Agent\x20found!','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','map','type','string','nameField','customField','toLowerCase','custom_fields','content','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','charAt','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','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','trigger:browser:url','unmanaged','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis'];(function(_0x28cf0b,_0x2e9496){var _0x2fe4c3=function(_0x4eca06){while(--_0x4eca06){_0x28cf0b['push'](_0x28cf0b['shift']());}};_0x2fe4c3(++_0x2e9496);}(_0x8af6,0x76));var _0x68af=function(_0x3f51fd,_0x11c877){_0x3f51fd=_0x3f51fd-0x0;var _0x22fa09=_0x8af6[_0x3f51fd];return _0x22fa09;};'use strict';var _=require(_0x68af('0x0'));var rp=require(_0x68af('0x1'));var BPromise=require(_0x68af('0x2'));var md5=require(_0x68af('0x3'));var util=require(_0x68af('0x4'));var Redis=require(_0x68af('0x5'));var intUtil=require(_0x68af('0x6'));var config=require(_0x68af('0x7'));var logger=require(_0x68af('0x8'))(_0x68af('0x9'));config['redis']=_[_0x68af('0xa')](config['redis'],{'host':_0x68af('0xb'),'port':0x18eb});var io=require(_0x68af('0xc'))(new Redis(config[_0x68af('0xd')]));var def={'method':_0x68af('0xe'),'json':!![]};function emit(_0x3c6018,_0x20d61c,_0x2a6bda){io['to'](_0x3c6018)['emit'](_0x20d61c,_0x2a6bda);}function getTicket(_0x56bc37,_0x449f3f,_0x33ddae,_0x4a3c97,_0x227485,_0x21b83b,_0x16399b,_0x2aeb15){logger[_0x68af('0xf')](_0x68af('0x10'));var _0x49b6d0=new Date();var _0x58e0e0=[{'name':_0x68af('0x11'),'value':intUtil['getString'](_0x4a3c97['Subjects'],_0x227485,'\x20')},{'name':_0x68af('0x12'),'value':_0x449f3f['id']},{'name':_0x68af('0x13'),'value':_0x449f3f['id']},{'name':_0x68af('0x14'),'value':intUtil['getString'](_0x4a3c97[_0x68af('0x15')],_0x227485,'\x0a')},{'name':'date_start','value':_0x49b6d0[_0x68af('0x16')]()[_0x68af('0x17')](0x0,0x13)[_0x68af('0x18')]('T','\x20')},{'name':_0x68af('0x19'),'value':'0'},{'name':_0x68af('0x1a'),'value':'15'},{'name':'parent_id','value':_0x33ddae['id']},{'name':_0x68af('0x1b'),'value':_0x68af('0x1c')},{'name':_0x68af('0x1d'),'value':_0x33ddae[_0x68af('0x11')]},{'name':'direction','value':_0x2aeb15}];if(_0x21b83b['length']){_[_0x68af('0x1e')](_0x21b83b,function(_0x29ddbf){if(_0x227485[_0x29ddbf['variableName']]){_0x58e0e0[_0x68af('0x1f')]({'name':_0x29ddbf[_0x68af('0x20')],'value':_0x227485[_0x29ddbf[_0x68af('0x21')]]});}});}return request({'form':{'method':_0x68af('0x22'),'input_type':'JSON','response_type':_0x68af('0x23'),'rest_data':JSON[_0x68af('0x24')]({'session':_0x16399b['id'],'module_name':'Calls','name_value_list':_0x58e0e0})}});}function getAuth(_0x5ad458){return util[_0x68af('0x25')](_0x68af('0x26'),new Buffer(_0x5ad458[_0x68af('0x27')]+':X')[_0x68af('0x28')](_0x68af('0x29')));}function getServerInfo(_0x34906b){return request({'form':{'method':'get_server_info','input_type':_0x68af('0x23'),'response_type':_0x68af('0x23'),'rest_data':JSON['stringify']({'session':_0x34906b['id']})}});}function getUser(_0x3ebd57,_0x539bc0,_0x13af7b){if(!_[_0x68af('0x2a')](_0x539bc0)){logger[_0x68af('0xf')](_0x68af('0x2b'),_0x539bc0);return request({'form':{'method':_0x68af('0x2c'),'input_type':_0x68af('0x23'),'response_type':'JSON','rest_data':JSON[_0x68af('0x24')]({'session':_0x13af7b['id'],'module_name':_0x68af('0x2d'),'query':util[_0x68af('0x25')](_0x68af('0x2e'),_0x539bc0),'order_by':'','offset':'0','select_fields':['id',_0x68af('0x11'),_0x68af('0x2f')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x68af('0x30')](function(_0x1839f9){if(_0x1839f9[_0x68af('0x31')]['length']){var _0x1f3963=_[_0x68af('0x32')](_0x1839f9[_0x68af('0x31')],function(_0x3d1303){return _0x3d1303['name_value_list']['user_name'][_0x68af('0x33')]===_0x539bc0;});if(_0x1f3963){logger[_0x68af('0xf')](_0x68af('0x34'));return BPromise['resolve']({'id':_0x1f3963['name_value_list']['id'][_0x68af('0x33')],'name':_0x1f3963[_0x68af('0x35')]['name'][_0x68af('0x33')]});}}logger[_0x68af('0xf')](_0x68af('0x36'));return BPromise[_0x68af('0x37')]({'id':_0x13af7b[_0x68af('0x35')][_0x68af('0x38')][_0x68af('0x33')],'name':_0x13af7b['name_value_list'][_0x68af('0x2f')][_0x68af('0x33')]});});}else{logger[_0x68af('0xf')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x68af('0x37')]({'id':_0x13af7b[_0x68af('0x35')]['user_id'][_0x68af('0x33')],'name':_0x13af7b[_0x68af('0x35')]['user_name'][_0x68af('0x33')]});}}function getEndUser(_0x4bff3d,_0x48c8b4,_0x179cee,_0x54afc3){logger[_0x68af('0xf')](_0x68af('0x39'),_0x179cee);return request({'form':{'method':_0x68af('0x2c'),'input_type':_0x68af('0x23'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x54afc3['id'],'module_name':'Contacts','query':util[_0x68af('0x25')](_0x68af('0x3a'),_0x179cee),'order_by':'','offset':'0','select_fields':['id','name',_0x68af('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x68af('0x30')](function(_0x28c2ae){if(_0x28c2ae['entry_list'][_0x68af('0x3c')]){var _0x1775c9=_[_0x68af('0x32')](_0x28c2ae[_0x68af('0x31')],function(_0x10b28a){return _0x10b28a['name_value_list'][_0x68af('0x3b')][_0x68af('0x33')]===_0x179cee;});if(_0x1775c9){logger[_0x68af('0xf')](_0x68af('0x3d'));return BPromise[_0x68af('0x37')]({'id':_0x1775c9[_0x68af('0x35')]['id'][_0x68af('0x33')],'name':_0x1775c9[_0x68af('0x35')][_0x68af('0x11')][_0x68af('0x33')],'phone':_0x1775c9['name_value_list'][_0x68af('0x3b')][_0x68af('0x33')]});}}else{logger['info'](_0x68af('0x3e'));return request({'form':{'method':_0x68af('0x22'),'input_type':_0x68af('0x23'),'response_type':_0x68af('0x23'),'rest_data':JSON[_0x68af('0x24')]({'session':_0x54afc3['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0x48c8b4!==''?_0x48c8b4:util[_0x68af('0x25')](_0x68af('0x3f'),_0x179cee)},{'name':'phone_home','value':_0x179cee}]})}})[_0x68af('0x30')](function(_0x7e1a4d){logger[_0x68af('0xf')](_0x68af('0x40'));return BPromise['resolve']({'id':_0x7e1a4d['id'],'name':_0x7e1a4d[_0x68af('0x31')][_0x68af('0x41')][_0x68af('0x33')],'phone':_0x7e1a4d[_0x68af('0x31')][_0x68af('0x3b')][_0x68af('0x33')]});});}});}function request(_0x3b0953){logger[_0x68af('0x42')](_0x68af('0x43'),JSON[_0x68af('0x24')](_0x3b0953));return rp(_['merge'](def,_0x3b0953));}function getTags(_0x52adab,_0x395cce){var _0x105243=[];if(_0x52adab&&_0x52adab[_0x68af('0x3c')]>0x0){_0x105243=_[_0x68af('0x44')](_0x52adab,_0x395cce);}return _0x105243;}function getCustomFields(_0xd6dba6,_0x517de3){var _0x29c04b=[];var _0xf41434={'custom_fields':[]};if(_0xd6dba6[_0x68af('0x3c')]>0x0){_['forEach'](_0xd6dba6,function(_0x2bf6c8){if(_0x2bf6c8[_0x68af('0x45')]===_0x68af('0x46')&&_0x2bf6c8[_0x68af('0x47')]&&!_0x2bf6c8[_0x68af('0x48')]){_0xf41434[_0x2bf6c8[_0x68af('0x47')][_0x68af('0x49')]()]=_0x2bf6c8['content'][_0x68af('0x28')]();}else if(_0x2bf6c8[_0x68af('0x45')]===_0x68af('0x46')&&_0x2bf6c8[_0x68af('0x20')]&&_0x2bf6c8['customField']){_0xf41434[_0x68af('0x4a')][_0x68af('0x1f')]({'id':_0x2bf6c8['idField'],'value':_0x2bf6c8[_0x68af('0x4b')]['toString']()});}else if(_0x2bf6c8[_0x68af('0x45')]==='variable'&&_0x2bf6c8[_0x68af('0x21')]&&_0x2bf6c8[_0x68af('0x20')]&&_0x2bf6c8[_0x68af('0x48')]){_0x517de3[_0x2bf6c8[_0x68af('0x21')]]&&_0xf41434[_0x68af('0x4a')][_0x68af('0x1f')]({'id':_0x2bf6c8[_0x68af('0x20')],'value':_0x517de3[_0x2bf6c8[_0x68af('0x21')]][_0x68af('0x28')]()});}else if(_0x2bf6c8[_0x68af('0x45')]===_0x68af('0x4c')&&_0x2bf6c8[_0x68af('0x4d')]&&_0x2bf6c8['Variable'][_0x68af('0x11')]&&_0x2bf6c8[_0x68af('0x20')]&&_0x2bf6c8['customField']){_0x517de3[_0x2bf6c8[_0x68af('0x4d')][_0x68af('0x11')][_0x68af('0x49')]()]&&_0xf41434['custom_fields'][_0x68af('0x1f')]({'id':_0x2bf6c8[_0x68af('0x20')],'value':_0x517de3[_0x2bf6c8[_0x68af('0x4d')][_0x68af('0x11')][_0x68af('0x49')]()]['toString']()});}});}return _0xf41434;}function getConnection(_0x21d207){return request({'method':_0x68af('0xe'),'form':{'method':_0x68af('0x4e'),'input_type':_0x68af('0x23'),'response_type':_0x68af('0x23'),'rest_data':JSON[_0x68af('0x24')]({'user_auth':{'user_name':_0x21d207[_0x68af('0x4f')],'password':_0x21d207[_0x68af('0x50')],'encryption':_0x68af('0x51')},'application':_0x68af('0x52')})}})['then'](function(_0x3a44af){var _0x14f942=_0x3a44af;if(_0x14f942['id']){def[_0x68af('0x53')]=_0x14f942['id'];return BPromise[_0x68af('0x37')](_0x14f942);}else{throw new Error(util[_0x68af('0x25')](_0x68af('0x54'),_0x21d207['id']));}});}function setRelationship(_0x54cd8f,_0x5ca2ae,_0x433d50,_0x5550cd){return request({'form':{'method':'set_relationship','input_type':_0x68af('0x23'),'response_type':_0x68af('0x23'),'rest_data':JSON[_0x68af('0x24')]({'session':_0x54cd8f['id'],'module_name':_0x68af('0x55'),'module_id':_0x433d50['id'],'link_field_name':_0x5550cd,'related_ids':[_0x5ca2ae['id']]})}});}exports[_0x68af('0x56')]=function(_0xab4593,_0x1203ae,_0x53e6ea,_0x2195cd,_0x1b236f,_0x255e1c){var _0x1ffdbb,_0x75884a,_0xc24815,_0x24198e;_0x255e1c[_0x68af('0x57')]=intUtil[_0x68af('0x58')](_0x255e1c['remoteUri']);_0x255e1c[_0x68af('0x59')]=intUtil[_0x68af('0x58')](_0x255e1c[_0x68af('0x59')]);def[_0x68af('0x5a')]=util[_0x68af('0x25')](_0x68af('0x5b'),_0x255e1c['remoteUri']);if(_0x1b236f&&_0x1b236f[_0x68af('0x5c')]){logger['info'](_0x68af('0x5d'),'Recording\x20is\x20enabled!');_0x1203ae['recordingURL']=util['format'](_0x68af('0x5e'),_0x255e1c['serverUrl'],_0x1203ae[_0x68af('0x5f')],md5(_0x1203ae[_0x68af('0x5f')]));}else{_0x1203ae[_0x68af('0x60')]='';}return getConnection(_0x255e1c)[_0x68af('0x30')](function(_0x4178ca){_0x24198e=_0x4178ca;return getUser(_0x255e1c,_0x2195cd[_0x68af('0x11')],_0x24198e);})[_0x68af('0x30')](function(_0x5e7697){_0x1ffdbb=_0x5e7697;logger[_0x68af('0xf')]('The\x20User\x20ID\x20is:',_0x1ffdbb['id']);return getEndUser(_0x255e1c,_0x1203ae[_0x68af('0x61')],_0x1203ae[_0x68af('0x62')],_0x24198e);})[_0x68af('0x30')](function(_0x588453){_0x75884a=_0x588453;logger[_0x68af('0xf')](_0x68af('0x63'),_0x75884a['id']);return getTicket(_0x255e1c,_0x1ffdbb,_0x75884a,_0x53e6ea,_0x1203ae,_0x53e6ea[_0x68af('0x64')],_0x24198e,_0x68af('0x65'));})['then'](function(_0x3fcf9c){_0xc24815=_0x3fcf9c;logger['info'](_0x68af('0x66'));logger['info'](_0x68af('0x67'),_0xc24815['id']);return setRelationship(_0x24198e,_0x1ffdbb,_0xc24815,_0x68af('0x68'));})[_0x68af('0x30')](function(){return setRelationship(_0x24198e,_0x75884a,_0xc24815,'contacts');})[_0x68af('0x30')](function(){return getServerInfo(_0x24198e);})[_0x68af('0x30')](function(_0xc8195e){var _0x36b9ae=parseInt(_0xc8195e['version'][_0x68af('0x69')](0x0));var _0x5cf983=util[_0x68af('0x25')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x255e1c['remoteUri'],_0xc24815['id']);if(_0x36b9ae>0x6){_0x5cf983=util[_0x68af('0x25')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x255e1c[_0x68af('0x57')],_0xc24815['id']);}logger['info'](_0x68af('0x5d'),_0x68af('0x6a'));emit(util['format'](_0x68af('0x6b'),_0x2195cd[_0x68af('0x11')]),'trigger:browser:url',{'uri':_0x5cf983});})[_0x68af('0x6c')](function(_0x8f432){logger[_0x68af('0x6d')](_0x68af('0x5d'),JSON[_0x68af('0x24')](_0x8f432));});};exports['outbound']=function(_0x2f7a3a,_0x409567,_0x173523,_0x4573fb,_0x10b497,_0x2a8ef8,_0x125d2a){var _0x183349,_0x2d814a,_0x486cc0,_0x456bbe;_0x2a8ef8['remoteUri']=intUtil[_0x68af('0x58')](_0x2a8ef8[_0x68af('0x57')]);_0x2a8ef8[_0x68af('0x59')]=intUtil['stripTrailingSlash'](_0x2a8ef8[_0x68af('0x59')]);def[_0x68af('0x5a')]=util['format'](_0x68af('0x5b'),_0x2a8ef8[_0x68af('0x57')]);if(_0x125d2a&&_0x125d2a[_0x68af('0x6e')]&&_0x125d2a[_0x68af('0x6e')]!=='none'){logger[_0x68af('0xf')](_0x68af('0x6f'),_0x68af('0x70'));_0x409567[_0x68af('0x60')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2a8ef8[_0x68af('0x59')],_0x409567[_0x68af('0x5f')],md5(_0x409567['uniqueid']));}return getConnection(_0x2a8ef8)[_0x68af('0x30')](function(_0x10ee9b){_0x456bbe=_0x10ee9b;return getUser(_0x2a8ef8,_0x4573fb[_0x68af('0x11')],_0x456bbe);})[_0x68af('0x30')](function(_0x2ce362){_0x183349=_0x2ce362;logger['info'](_0x68af('0x71'),_0x183349['id']);return getEndUser(_0x2a8ef8,_0x409567[_0x68af('0x72')],_0x409567[_0x68af('0x73')],_0x456bbe);})['then'](function(_0xd6b5f6){_0x2d814a=_0xd6b5f6;logger[_0x68af('0xf')]('The\x20Enduser\x20ID\x20is:',_0x2d814a['id']);return getTicket(_0x2a8ef8,_0x183349,_0x2d814a,_0x173523,_0x409567,_0x173523['Fields'],_0x456bbe,_0x68af('0x74'));})[_0x68af('0x30')](function(_0x2e61f9){_0x486cc0=_0x2e61f9;logger[_0x68af('0xf')]('Ticket\x20created!');logger[_0x68af('0xf')]('The\x20Ticket\x20ID\x20is:',_0x486cc0['id']);return setRelationship(_0x456bbe,_0x183349,_0x486cc0,'users');})['then'](function(){return setRelationship(_0x456bbe,_0x2d814a,_0x486cc0,_0x68af('0x75'));})['then'](function(){return getServerInfo(_0x456bbe);})['then'](function(_0x17a3a6){var _0x16421d=parseInt(_0x17a3a6[_0x68af('0x76')][_0x68af('0x69')](0x0));var _0x242675=util[_0x68af('0x25')](_0x68af('0x77'),_0x2a8ef8['remoteUri'],_0x486cc0['id']);if(_0x16421d>0x6){_0x242675=util[_0x68af('0x25')](_0x68af('0x78'),_0x2a8ef8[_0x68af('0x57')],_0x486cc0['id']);}logger['info'](_0x68af('0x6f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x68af('0x25')](_0x68af('0x6b'),_0x4573fb[_0x68af('0x11')]),_0x68af('0x79'),{'uri':_0x242675});})[_0x68af('0x6c')](function(_0x6b3063){logger[_0x68af('0x6d')](_0x68af('0x6f'),JSON[_0x68af('0x24')](_0x6b3063));});};exports[_0x68af('0x7a')]=function(_0x3e8660,_0x27e434,_0x412f40,_0x576e9d,_0x2a2de9,_0x3b1fec){var _0x489d46,_0x2b814a,_0x20b73b,_0x3cf23a;_0x3b1fec[_0x68af('0x57')]=intUtil[_0x68af('0x58')](_0x3b1fec[_0x68af('0x57')]);_0x3b1fec['serverUrl']=intUtil[_0x68af('0x58')](_0x3b1fec[_0x68af('0x59')]);def[_0x68af('0x5a')]=util['format']('%s/service/v4_1/rest.php',_0x3b1fec[_0x68af('0x57')]);if(_0x2a2de9&&_0x2a2de9[_0x68af('0x5c')]){logger[_0x68af('0xf')]('['+_0x27e434['lastevent'][_0x68af('0x7b')]()+']',_0x68af('0x70'));_0x27e434[_0x68af('0x60')]=util[_0x68af('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3b1fec[_0x68af('0x59')],_0x27e434[_0x68af('0x5f')],md5(_0x27e434[_0x68af('0x5f')]));}else{_0x27e434[_0x68af('0x60')]='';}return getConnection(_0x3b1fec)[_0x68af('0x30')](function(_0x4d2fca){_0x3cf23a=_0x4d2fca;if(!_[_0x68af('0x2a')](_0x576e9d)){return getUser(_0x3b1fec,_0x576e9d[_0x68af('0x11')],_0x3cf23a);}else{return getUser(_0x3b1fec,null,_0x3cf23a);}})[_0x68af('0x30')](function(_0x591ba0){_0x489d46=_0x591ba0;logger[_0x68af('0xf')](_0x68af('0x71'),_0x489d46['id']);return getEndUser(_0x3b1fec,_0x27e434[_0x68af('0x61')],_0x27e434[_0x68af('0x62')],_0x3cf23a);})[_0x68af('0x30')](function(_0x37a22e){_0x2b814a=_0x37a22e;logger['info'](_0x68af('0x63'),_0x2b814a['id']);return getTicket(_0x3b1fec,_0x489d46,_0x2b814a,_0x412f40,_0x27e434,_0x412f40[_0x68af('0x64')],_0x3cf23a,_0x68af('0x65'));})['then'](function(_0x56404f){_0x20b73b=_0x56404f;logger[_0x68af('0xf')](_0x68af('0x66'));logger[_0x68af('0xf')](_0x68af('0x67'),_0x20b73b['id']);return setRelationship(_0x3cf23a,_0x489d46,_0x20b73b,'users');})[_0x68af('0x30')](function(){return setRelationship(_0x3cf23a,_0x2b814a,_0x20b73b,_0x68af('0x75'));})['then'](function(){return getServerInfo(_0x3cf23a);})['catch'](function(_0x3a348c){logger[_0x68af('0x6d')]('['+_0x27e434['lastevent'][_0x68af('0x7b')]()+']',JSON[_0x68af('0x24')](_0x3a348c));});}; \ No newline at end of file +var _0x576b=['The\x20Ticket\x20ID\x20is:','md5','util','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','variableName','push','idField','JSON','format','Basic\x20%s','apiKey','base64','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','set_entry','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','forEach','type','customField','content','toString','custom_fields','variable','customVariable','Variable','toLowerCase','login','Account\x20%d\x20is\x20not\x20valid','Calls','queue','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','remoteUri','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','Inbound','Ticket\x20created!','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','catch','error','outbound','uri','recordingFormat','none','[OUTBOUND]','destcalleridnum','Outbound','users','version','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','unmanaged','lastevent','toUpperCase'];(function(_0x3ea0ce,_0x4e4a95){var _0x2fd827=function(_0x5a909d){while(--_0x5a909d){_0x3ea0ce['push'](_0x3ea0ce['shift']());}};_0x2fd827(++_0x4e4a95);}(_0x576b,0x1d9));var _0xb576=function(_0x315690,_0x464acf){_0x315690=_0x315690-0x0;var _0x5afde7=_0x576b[_0x315690];return _0x5afde7;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0xb576('0x0'));var util=require(_0xb576('0x1'));var Redis=require('ioredis');var intUtil=require(_0xb576('0x2'));var config=require(_0xb576('0x3'));var logger=require('../../../../config/logger')(_0xb576('0x4'));config[_0xb576('0x5')]=_[_0xb576('0x6')](config[_0xb576('0x5')],{'host':_0xb576('0x7'),'port':0x18eb});var io=require(_0xb576('0x8'))(new Redis(config[_0xb576('0x5')]));var def={'method':_0xb576('0x9'),'json':!![]};function emit(_0xe6d2fd,_0x450f16,_0x1148c2){io['to'](_0xe6d2fd)[_0xb576('0xa')](_0x450f16,_0x1148c2);}function getTicket(_0x7cc721,_0x384fcc,_0x395bd2,_0x4b209b,_0x3e21fe,_0x4a3fbb,_0x282aa2,_0x2a0f32){logger[_0xb576('0xb')]('Creating\x20new\x20ticket...');var _0x4fa503=new Date();var _0x1e473a=[{'name':_0xb576('0xc'),'value':intUtil[_0xb576('0xd')](_0x4b209b[_0xb576('0xe')],_0x3e21fe,'\x20')},{'name':_0xb576('0xf'),'value':_0x384fcc['id']},{'name':_0xb576('0x10'),'value':_0x384fcc['id']},{'name':_0xb576('0x11'),'value':intUtil[_0xb576('0xd')](_0x4b209b[_0xb576('0x12')],_0x3e21fe,'\x0a')},{'name':_0xb576('0x13'),'value':_0x4fa503['toISOString']()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0xb576('0x14'),'value':'0'},{'name':_0xb576('0x15'),'value':'15'},{'name':_0xb576('0x16'),'value':_0x395bd2['id']},{'name':_0xb576('0x17'),'value':_0xb576('0x18')},{'name':_0xb576('0x19'),'value':_0x395bd2['name']},{'name':_0xb576('0x1a'),'value':_0x2a0f32}];if(_0x4a3fbb[_0xb576('0x1b')]){_['forEach'](_0x4a3fbb,function(_0x52a0ca){if(_0x3e21fe[_0x52a0ca[_0xb576('0x1c')]]){_0x1e473a[_0xb576('0x1d')]({'name':_0x52a0ca[_0xb576('0x1e')],'value':_0x3e21fe[_0x52a0ca['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0xb576('0x1f'),'rest_data':JSON['stringify']({'session':_0x282aa2['id'],'module_name':'Calls','name_value_list':_0x1e473a})}});}function getAuth(_0x2243b1){return util[_0xb576('0x20')](_0xb576('0x21'),new Buffer(_0x2243b1[_0xb576('0x22')]+':X')['toString'](_0xb576('0x23')));}function getServerInfo(_0x38cf07){return request({'form':{'method':_0xb576('0x24'),'input_type':_0xb576('0x1f'),'response_type':_0xb576('0x1f'),'rest_data':JSON[_0xb576('0x25')]({'session':_0x38cf07['id']})}});}function getUser(_0x2b6074,_0x2a930d,_0x23d3e7){if(!_[_0xb576('0x26')](_0x2a930d)){logger[_0xb576('0xb')](_0xb576('0x27'),_0x2a930d);return request({'form':{'method':_0xb576('0x28'),'input_type':_0xb576('0x1f'),'response_type':'JSON','rest_data':JSON[_0xb576('0x25')]({'session':_0x23d3e7['id'],'module_name':_0xb576('0x29'),'query':util[_0xb576('0x20')](_0xb576('0x2a'),_0x2a930d),'order_by':'','offset':'0','select_fields':['id',_0xb576('0xc'),_0xb576('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xb576('0x2c')](function(_0x535bb9){if(_0x535bb9[_0xb576('0x2d')][_0xb576('0x1b')]){var _0x334bdd=_[_0xb576('0x2e')](_0x535bb9[_0xb576('0x2d')],function(_0x592dfc){return _0x592dfc[_0xb576('0x2f')]['user_name'][_0xb576('0x30')]===_0x2a930d;});if(_0x334bdd){logger[_0xb576('0xb')](_0xb576('0x31'));return BPromise[_0xb576('0x32')]({'id':_0x334bdd[_0xb576('0x2f')]['id']['value'],'name':_0x334bdd[_0xb576('0x2f')][_0xb576('0xc')][_0xb576('0x30')]});}}logger[_0xb576('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xb576('0x32')]({'id':_0x23d3e7[_0xb576('0x2f')][_0xb576('0x33')]['value'],'name':_0x23d3e7['name_value_list']['user_name'][_0xb576('0x30')]});});}else{logger[_0xb576('0xb')](_0xb576('0x34'));return BPromise[_0xb576('0x32')]({'id':_0x23d3e7[_0xb576('0x2f')][_0xb576('0x33')][_0xb576('0x30')],'name':_0x23d3e7[_0xb576('0x2f')][_0xb576('0x2b')]['value']});}}function getEndUser(_0x206292,_0x4a6e72,_0x550ee7,_0x18ed43){logger[_0xb576('0xb')](_0xb576('0x35'),_0x550ee7);return request({'form':{'method':'get_entry_list','input_type':_0xb576('0x1f'),'response_type':_0xb576('0x1f'),'rest_data':JSON['stringify']({'session':_0x18ed43['id'],'module_name':_0xb576('0x18'),'query':util[_0xb576('0x20')](_0xb576('0x36'),_0x550ee7),'order_by':'','offset':'0','select_fields':['id',_0xb576('0xc'),_0xb576('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xb576('0x2c')](function(_0xe4afbc){if(_0xe4afbc[_0xb576('0x2d')][_0xb576('0x1b')]){var _0x217a88=_[_0xb576('0x2e')](_0xe4afbc['entry_list'],function(_0x5b9f8d){return _0x5b9f8d[_0xb576('0x2f')]['phone_home'][_0xb576('0x30')]===_0x550ee7;});if(_0x217a88){logger[_0xb576('0xb')](_0xb576('0x38'));return BPromise[_0xb576('0x32')]({'id':_0x217a88['name_value_list']['id'][_0xb576('0x30')],'name':_0x217a88['name_value_list'][_0xb576('0xc')][_0xb576('0x30')],'phone':_0x217a88[_0xb576('0x2f')]['phone_home'][_0xb576('0x30')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xb576('0x39'),'input_type':_0xb576('0x1f'),'response_type':_0xb576('0x1f'),'rest_data':JSON[_0xb576('0x25')]({'session':_0x18ed43['id'],'module_name':_0xb576('0x18'),'name_value_list':[{'name':_0xb576('0x3a'),'value':_0x4a6e72!==''?_0x4a6e72:util[_0xb576('0x20')](_0xb576('0x3b'),_0x550ee7)},{'name':_0xb576('0x37'),'value':_0x550ee7}]})}})[_0xb576('0x2c')](function(_0x26f25f){logger[_0xb576('0xb')](_0xb576('0x3c'));return BPromise[_0xb576('0x32')]({'id':_0x26f25f['id'],'name':_0x26f25f[_0xb576('0x2d')]['first_name'][_0xb576('0x30')],'phone':_0x26f25f[_0xb576('0x2d')][_0xb576('0x37')][_0xb576('0x30')]});});}});}function request(_0x28a0cb){logger[_0xb576('0x3d')](_0xb576('0x3e'),JSON[_0xb576('0x25')](_0x28a0cb));return rp(_[_0xb576('0x3f')](def,_0x28a0cb));}function getTags(_0x1398fc,_0xca0406){var _0x52d89f=[];if(_0x1398fc&&_0x1398fc['length']>0x0){_0x52d89f=_[_0xb576('0x40')](_0x1398fc,_0xca0406);}return _0x52d89f;}function getCustomFields(_0x381ef1,_0x45db3d){var _0xf423df=[];var _0x470b75={'custom_fields':[]};if(_0x381ef1[_0xb576('0x1b')]>0x0){_[_0xb576('0x41')](_0x381ef1,function(_0x24f099){if(_0x24f099[_0xb576('0x42')]==='string'&&_0x24f099['nameField']&&!_0x24f099[_0xb576('0x43')]){_0x470b75[_0x24f099['nameField']['toLowerCase']()]=_0x24f099[_0xb576('0x44')][_0xb576('0x45')]();}else if(_0x24f099[_0xb576('0x42')]==='string'&&_0x24f099[_0xb576('0x1e')]&&_0x24f099[_0xb576('0x43')]){_0x470b75[_0xb576('0x46')]['push']({'id':_0x24f099['idField'],'value':_0x24f099[_0xb576('0x44')]['toString']()});}else if(_0x24f099[_0xb576('0x42')]===_0xb576('0x47')&&_0x24f099['variableName']&&_0x24f099['idField']&&_0x24f099[_0xb576('0x43')]){_0x45db3d[_0x24f099[_0xb576('0x1c')]]&&_0x470b75[_0xb576('0x46')]['push']({'id':_0x24f099[_0xb576('0x1e')],'value':_0x45db3d[_0x24f099[_0xb576('0x1c')]][_0xb576('0x45')]()});}else if(_0x24f099[_0xb576('0x42')]===_0xb576('0x48')&&_0x24f099[_0xb576('0x49')]&&_0x24f099[_0xb576('0x49')][_0xb576('0xc')]&&_0x24f099[_0xb576('0x1e')]&&_0x24f099[_0xb576('0x43')]){_0x45db3d[_0x24f099[_0xb576('0x49')][_0xb576('0xc')][_0xb576('0x4a')]()]&&_0x470b75[_0xb576('0x46')][_0xb576('0x1d')]({'id':_0x24f099[_0xb576('0x1e')],'value':_0x45db3d[_0x24f099[_0xb576('0x49')][_0xb576('0xc')]['toLowerCase']()][_0xb576('0x45')]()});}});}return _0x470b75;}function getConnection(_0x24d0c5){return request({'method':_0xb576('0x9'),'form':{'method':_0xb576('0x4b'),'input_type':_0xb576('0x1f'),'response_type':_0xb576('0x1f'),'rest_data':JSON[_0xb576('0x25')]({'user_auth':{'user_name':_0x24d0c5['username'],'password':_0x24d0c5['password'],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0xb576('0x2c')](function(_0x4e0edc){var _0xb0ffb1=_0x4e0edc;if(_0xb0ffb1['id']){def['sessionID']=_0xb0ffb1['id'];return BPromise[_0xb576('0x32')](_0xb0ffb1);}else{throw new Error(util['format'](_0xb576('0x4c'),_0x24d0c5['id']));}});}function setRelationship(_0x35961f,_0x1a25d8,_0x6e8217,_0x5a1484){return request({'form':{'method':'set_relationship','input_type':_0xb576('0x1f'),'response_type':'JSON','rest_data':JSON[_0xb576('0x25')]({'session':_0x35961f['id'],'module_name':_0xb576('0x4d'),'module_id':_0x6e8217['id'],'link_field_name':_0x5a1484,'related_ids':[_0x1a25d8['id']]})}});}exports[_0xb576('0x4e')]=function(_0x483b0b,_0x5cbcb9,_0x20f84f,_0x2c480a,_0x270ab1,_0x19f3c1){var _0x236f38,_0x1731ef,_0x409dd2,_0x551d55;_0x19f3c1['remoteUri']=intUtil[_0xb576('0x4f')](_0x19f3c1['remoteUri']);_0x19f3c1[_0xb576('0x50')]=intUtil[_0xb576('0x4f')](_0x19f3c1[_0xb576('0x50')]);def['uri']=util[_0xb576('0x20')](_0xb576('0x51'),_0x19f3c1[_0xb576('0x52')]);if(_0x270ab1&&_0x270ab1[_0xb576('0x53')]){logger[_0xb576('0xb')](_0xb576('0x54'),_0xb576('0x55'));_0x5cbcb9['recordingURL']=util['format'](_0xb576('0x56'),_0x19f3c1[_0xb576('0x50')],_0x5cbcb9[_0xb576('0x57')],md5(_0x5cbcb9[_0xb576('0x57')]));}else{_0x5cbcb9[_0xb576('0x58')]='';}return getConnection(_0x19f3c1)[_0xb576('0x2c')](function(_0x4e6a2f){_0x551d55=_0x4e6a2f;return getUser(_0x19f3c1,_0x2c480a[_0xb576('0xc')],_0x551d55);})['then'](function(_0x17bd79){_0x236f38=_0x17bd79;logger[_0xb576('0xb')](_0xb576('0x59'),_0x236f38['id']);return getEndUser(_0x19f3c1,_0x5cbcb9[_0xb576('0x5a')],_0x5cbcb9[_0xb576('0x5b')],_0x551d55);})['then'](function(_0x8089ff){_0x1731ef=_0x8089ff;logger['info'](_0xb576('0x5c'),_0x1731ef['id']);return getTicket(_0x19f3c1,_0x236f38,_0x1731ef,_0x20f84f,_0x5cbcb9,_0x20f84f[_0xb576('0x5d')],_0x551d55,_0xb576('0x5e'));})['then'](function(_0x29899d){_0x409dd2=_0x29899d;logger['info'](_0xb576('0x5f'));logger[_0xb576('0xb')]('The\x20Ticket\x20ID\x20is:',_0x409dd2['id']);return setRelationship(_0x551d55,_0x236f38,_0x409dd2,'users');})[_0xb576('0x2c')](function(){return setRelationship(_0x551d55,_0x1731ef,_0x409dd2,_0xb576('0x60'));})[_0xb576('0x2c')](function(){return getServerInfo(_0x551d55);})['then'](function(_0x384f54){var _0x2890e5=parseInt(_0x384f54['version'][_0xb576('0x61')](0x0));var _0x38d02e=util[_0xb576('0x20')](_0xb576('0x62'),_0x19f3c1['remoteUri'],_0x409dd2['id']);if(_0x2890e5>0x6){_0x38d02e=util[_0xb576('0x20')](_0xb576('0x63'),_0x19f3c1['remoteUri'],_0x409dd2['id']);}logger[_0xb576('0xb')](_0xb576('0x54'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x2c480a[_0xb576('0xc')]),'trigger:browser:url',{'uri':_0x38d02e});})[_0xb576('0x64')](function(_0x3ae087){logger[_0xb576('0x65')](_0xb576('0x54'),JSON[_0xb576('0x25')](_0x3ae087));});};exports[_0xb576('0x66')]=function(_0x50683a,_0x3e1805,_0x5656f5,_0x30f89d,_0x1d5703,_0x156509,_0x457438){var _0x31b5b6,_0x399eec,_0x228dcc,_0x2225f5;_0x156509['remoteUri']=intUtil[_0xb576('0x4f')](_0x156509[_0xb576('0x52')]);_0x156509[_0xb576('0x50')]=intUtil[_0xb576('0x4f')](_0x156509[_0xb576('0x50')]);def[_0xb576('0x67')]=util[_0xb576('0x20')](_0xb576('0x51'),_0x156509['remoteUri']);if(_0x457438&&_0x457438[_0xb576('0x68')]&&_0x457438['recordingFormat']!==_0xb576('0x69')){logger[_0xb576('0xb')](_0xb576('0x6a'),_0xb576('0x55'));_0x3e1805[_0xb576('0x58')]=util['format'](_0xb576('0x56'),_0x156509[_0xb576('0x50')],_0x3e1805[_0xb576('0x57')],md5(_0x3e1805[_0xb576('0x57')]));}return getConnection(_0x156509)['then'](function(_0x46e8dd){_0x2225f5=_0x46e8dd;return getUser(_0x156509,_0x30f89d[_0xb576('0xc')],_0x2225f5);})[_0xb576('0x2c')](function(_0x43beb1){_0x31b5b6=_0x43beb1;logger[_0xb576('0xb')](_0xb576('0x59'),_0x31b5b6['id']);return getEndUser(_0x156509,_0x3e1805['destcalleridname'],_0x3e1805[_0xb576('0x6b')],_0x2225f5);})[_0xb576('0x2c')](function(_0x1a5259){_0x399eec=_0x1a5259;logger[_0xb576('0xb')](_0xb576('0x5c'),_0x399eec['id']);return getTicket(_0x156509,_0x31b5b6,_0x399eec,_0x5656f5,_0x3e1805,_0x5656f5[_0xb576('0x5d')],_0x2225f5,_0xb576('0x6c'));})[_0xb576('0x2c')](function(_0x1cbc49){_0x228dcc=_0x1cbc49;logger['info'](_0xb576('0x5f'));logger[_0xb576('0xb')]('The\x20Ticket\x20ID\x20is:',_0x228dcc['id']);return setRelationship(_0x2225f5,_0x31b5b6,_0x228dcc,_0xb576('0x6d'));})[_0xb576('0x2c')](function(){return setRelationship(_0x2225f5,_0x399eec,_0x228dcc,_0xb576('0x60'));})[_0xb576('0x2c')](function(){return getServerInfo(_0x2225f5);})['then'](function(_0x34003c){var _0x43f407=parseInt(_0x34003c[_0xb576('0x6e')][_0xb576('0x61')](0x0));var _0x2e565e=util[_0xb576('0x20')](_0xb576('0x62'),_0x156509['remoteUri'],_0x228dcc['id']);if(_0x43f407>0x6){_0x2e565e=util[_0xb576('0x20')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x156509[_0xb576('0x52')],_0x228dcc['id']);}logger[_0xb576('0xb')](_0xb576('0x6a'),_0xb576('0x6f'));emit(util[_0xb576('0x20')](_0xb576('0x70'),_0x30f89d[_0xb576('0xc')]),_0xb576('0x71'),{'uri':_0x2e565e});})[_0xb576('0x64')](function(_0x34180d){logger[_0xb576('0x65')](_0xb576('0x6a'),JSON[_0xb576('0x25')](_0x34180d));});};exports[_0xb576('0x72')]=function(_0x413936,_0x487878,_0x128f34,_0x359edb,_0x5e28f4,_0x1b80b8){var _0x151b40,_0x31cf5c,_0x55d76e,_0xeffb60;_0x1b80b8[_0xb576('0x52')]=intUtil[_0xb576('0x4f')](_0x1b80b8[_0xb576('0x52')]);_0x1b80b8[_0xb576('0x50')]=intUtil[_0xb576('0x4f')](_0x1b80b8[_0xb576('0x50')]);def[_0xb576('0x67')]=util[_0xb576('0x20')](_0xb576('0x51'),_0x1b80b8['remoteUri']);if(_0x5e28f4&&_0x5e28f4['monitor_format']){logger['info']('['+_0x487878[_0xb576('0x73')][_0xb576('0x74')]()+']','Recording\x20is\x20enabled!');_0x487878[_0xb576('0x58')]=util[_0xb576('0x20')](_0xb576('0x56'),_0x1b80b8[_0xb576('0x50')],_0x487878['uniqueid'],md5(_0x487878['uniqueid']));}else{_0x487878['recordingURL']='';}return getConnection(_0x1b80b8)[_0xb576('0x2c')](function(_0xfae9ac){_0xeffb60=_0xfae9ac;if(!_[_0xb576('0x26')](_0x359edb)){return getUser(_0x1b80b8,_0x359edb[_0xb576('0xc')],_0xeffb60);}else{return getUser(_0x1b80b8,null,_0xeffb60);}})[_0xb576('0x2c')](function(_0x2967d1){_0x151b40=_0x2967d1;logger['info'](_0xb576('0x59'),_0x151b40['id']);return getEndUser(_0x1b80b8,_0x487878[_0xb576('0x5a')],_0x487878[_0xb576('0x5b')],_0xeffb60);})['then'](function(_0x5c7702){_0x31cf5c=_0x5c7702;logger[_0xb576('0xb')](_0xb576('0x5c'),_0x31cf5c['id']);return getTicket(_0x1b80b8,_0x151b40,_0x31cf5c,_0x128f34,_0x487878,_0x128f34[_0xb576('0x5d')],_0xeffb60,'Inbound');})[_0xb576('0x2c')](function(_0x102080){_0x55d76e=_0x102080;logger['info'](_0xb576('0x5f'));logger[_0xb576('0xb')](_0xb576('0x75'),_0x55d76e['id']);return setRelationship(_0xeffb60,_0x151b40,_0x55d76e,_0xb576('0x6d'));})['then'](function(){return setRelationship(_0xeffb60,_0x31cf5c,_0x55d76e,_0xb576('0x60'));})[_0xb576('0x2c')](function(){return getServerInfo(_0xeffb60);})[_0xb576('0x64')](function(_0x17dd61){logger[_0xb576('0x65')]('['+_0x487878[_0xb576('0x73')][_0xb576('0x74')]()+']',JSON[_0xb576('0x25')](_0x17dd61));});}; \ 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 ba0d639..4666a5c 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 _0x1c11=['format','%s:\x20%s','variable','customVariable','join','stripTrailingSlash','lastIndexOf','validateEmail','isNil','lodash','util','getString','length','sortBy','type','string','push','content','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','key'];(function(_0x57eb2d,_0x89e2d4){var _0x49b811=function(_0x1d3d1b){while(--_0x1d3d1b){_0x57eb2d['push'](_0x57eb2d['shift']());}};_0x49b811(++_0x89e2d4);}(_0x1c11,0x18f));var _0x11c1=function(_0x1077ce,_0x1dfa4d){_0x1077ce=_0x1077ce-0x0;var _0x542fed=_0x1c11[_0x1077ce];return _0x542fed;};'use strict';var _=require(_0x11c1('0x0'));var util=require(_0x11c1('0x1'));exports[_0x11c1('0x2')]=function(_0x2835f6,_0x36703f,_0xb9cac1){var _0x18a6c9=[];if(_0x2835f6[_0x11c1('0x3')]>0x0){var _0x497440=_[_0x11c1('0x4')](_0x2835f6,['id']);for(var _0x3c833=0x0;_0x3c833<_0x497440[_0x11c1('0x3')];_0x3c833++){var _0x36d0c7=_0x497440[_0x3c833];if(_0x36d0c7[_0x11c1('0x5')]===_0x11c1('0x6')){_0x18a6c9[_0x11c1('0x7')](_0x36d0c7[_0x11c1('0x8')]);}else if(_0x36d0c7[_0x11c1('0x5')]==='variable'&&_0x36d0c7[_0x11c1('0x9')]){_0x36703f[_0x36d0c7[_0x11c1('0x9')]]&&_0x18a6c9['push'](_0x36703f[_0x36d0c7['variableName']][_0x11c1('0xa')]());}else if(_0x36d0c7[_0x11c1('0x5')]==='customVariable'&&_0x36d0c7[_0x11c1('0xb')]&&_0x36d0c7[_0x11c1('0xb')][_0x11c1('0xc')]){_0x36703f[_0x36d0c7[_0x11c1('0xb')][_0x11c1('0xc')]['toLowerCase']()]&&_0x18a6c9['push'](_0x36703f[_0x36d0c7[_0x11c1('0xb')][_0x11c1('0xc')][_0x11c1('0xd')]()][_0x11c1('0xa')]());}else if(_0x36d0c7[_0x11c1('0x5')]===_0x11c1('0xe')){if(_0x36d0c7[_0x11c1('0xf')]===_0x11c1('0x6')&&_0x36d0c7[_0x11c1('0x10')]){_0x18a6c9[_0x11c1('0x7')](util[_0x11c1('0x11')](_0x11c1('0x12'),_0x36d0c7[_0x11c1('0x10')],_0x36d0c7['keyContent']));}else if(_0x36d0c7['keyType']===_0x11c1('0x13')&&_0x36d0c7[_0x11c1('0x9')]&&_0x36d0c7[_0x11c1('0x10')]){_0x36703f[_0x36d0c7[_0x11c1('0x9')]]&&_0x18a6c9[_0x11c1('0x7')](util[_0x11c1('0x11')](_0x11c1('0x12'),_0x36d0c7['key'],_0x36703f[_0x36d0c7[_0x11c1('0x9')]]));}else if(_0x36d0c7[_0x11c1('0xf')]===_0x11c1('0x14')&&_0x36d0c7[_0x11c1('0xb')]&&_0x36d0c7[_0x11c1('0xb')][_0x11c1('0xc')]&&_0x36d0c7[_0x11c1('0x10')]){_0x36703f[_0x36d0c7[_0x11c1('0xb')][_0x11c1('0xc')][_0x11c1('0xd')]()]&&_0x18a6c9[_0x11c1('0x7')](util[_0x11c1('0x11')](_0x11c1('0x12'),_0x36d0c7[_0x11c1('0x10')],_0x36703f[_0x36d0c7['Variable'][_0x11c1('0xc')]['toLowerCase']()]));}}}}return _0x18a6c9[_0x11c1('0x15')](_0xb9cac1);};exports[_0x11c1('0x16')]=function(_0x10942f){var _0xd8e935=_0x10942f['slice'](-0x1);if(_0xd8e935==='/'){_0x10942f=_0x10942f['substring'](0x0,_0x10942f[_0x11c1('0x17')](_0xd8e935));}return _0x10942f;};exports[_0x11c1('0x18')]=function(_0x403a52){if(!_[_0x11c1('0x19')](_0x403a52)&&_0x403a52!==''){var _0x257967=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x257967['test'](String(_0x403a52)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x49d8=['keyType','key','%s:\x20%s','keyContent','format','customVariable','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','util','getString','length','string','content','type','variable','variableName','push','name','Variable','toLowerCase'];(function(_0x10dc60,_0x2fcce1){var _0x47dec5=function(_0x24b5e4){while(--_0x24b5e4){_0x10dc60['push'](_0x10dc60['shift']());}};_0x47dec5(++_0x2fcce1);}(_0x49d8,0x120));var _0x849d=function(_0x556c5a,_0x5d88d7){_0x556c5a=_0x556c5a-0x0;var _0x4bc0a1=_0x49d8[_0x556c5a];return _0x4bc0a1;};'use strict';var _=require('lodash');var util=require(_0x849d('0x0'));exports[_0x849d('0x1')]=function(_0x3e1eae,_0xc6e2a,_0x152cb5){var _0x229498=[];if(_0x3e1eae['length']>0x0){var _0x521119=_['sortBy'](_0x3e1eae,['id']);for(var _0x4d3ae3=0x0;_0x4d3ae3<_0x521119[_0x849d('0x2')];_0x4d3ae3++){var _0x804873=_0x521119[_0x4d3ae3];if(_0x804873['type']===_0x849d('0x3')){_0x229498['push'](_0x804873[_0x849d('0x4')]);}else if(_0x804873[_0x849d('0x5')]===_0x849d('0x6')&&_0x804873[_0x849d('0x7')]){_0xc6e2a[_0x804873[_0x849d('0x7')]]&&_0x229498[_0x849d('0x8')](_0xc6e2a[_0x804873[_0x849d('0x7')]]['toString']());}else if(_0x804873[_0x849d('0x5')]==='customVariable'&&_0x804873['Variable']&&_0x804873['Variable'][_0x849d('0x9')]){_0xc6e2a[_0x804873[_0x849d('0xa')]['name'][_0x849d('0xb')]()]&&_0x229498[_0x849d('0x8')](_0xc6e2a[_0x804873[_0x849d('0xa')][_0x849d('0x9')][_0x849d('0xb')]()]['toString']());}else if(_0x804873[_0x849d('0x5')]==='keyValue'){if(_0x804873[_0x849d('0xc')]==='string'&&_0x804873[_0x849d('0xd')]){_0x229498['push'](util['format'](_0x849d('0xe'),_0x804873[_0x849d('0xd')],_0x804873[_0x849d('0xf')]));}else if(_0x804873[_0x849d('0xc')]===_0x849d('0x6')&&_0x804873[_0x849d('0x7')]&&_0x804873[_0x849d('0xd')]){_0xc6e2a[_0x804873[_0x849d('0x7')]]&&_0x229498[_0x849d('0x8')](util[_0x849d('0x10')](_0x849d('0xe'),_0x804873[_0x849d('0xd')],_0xc6e2a[_0x804873['variableName']]));}else if(_0x804873[_0x849d('0xc')]===_0x849d('0x11')&&_0x804873[_0x849d('0xa')]&&_0x804873['Variable'][_0x849d('0x9')]&&_0x804873[_0x849d('0xd')]){_0xc6e2a[_0x804873[_0x849d('0xa')][_0x849d('0x9')]['toLowerCase']()]&&_0x229498[_0x849d('0x8')](util['format']('%s:\x20%s',_0x804873[_0x849d('0xd')],_0xc6e2a[_0x804873[_0x849d('0xa')][_0x849d('0x9')]['toLowerCase']()]));}}}}return _0x229498[_0x849d('0x12')](_0x152cb5);};exports[_0x849d('0x13')]=function(_0x347ae3){var _0x5ae0d0=_0x347ae3[_0x849d('0x14')](-0x1);if(_0x5ae0d0==='/'){_0x347ae3=_0x347ae3[_0x849d('0x15')](0x0,_0x347ae3[_0x849d('0x16')](_0x5ae0d0));}return _0x347ae3;};exports[_0x849d('0x17')]=function(_0x4fed38){if(!_[_0x849d('0x18')](_0x4fed38)&&_0x4fed38!==''){var _0x57babe=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x57babe['test'](String(_0x4fed38)[_0x849d('0xb')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 043e5b6..888bfa0 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 _0x8371=['catch','createTicket','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','Agent\x20found!','email1','first_name','userId','admin','statusCode','getUser','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','[vTiger],\x20%s,\x20%s,\x20%s','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;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','accessKey','getchallenge','login','token','[HTTP]','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','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','user:%s','trigger:browser:url','outbound','serverUrl','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','type','string','idField','content','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error'];(function(_0x5b78f3,_0x27435a){var _0x4a28ce=function(_0x22a2ef){while(--_0x22a2ef){_0x5b78f3['push'](_0x5b78f3['shift']());}};_0x4a28ce(++_0x27435a);}(_0x8371,0x175));var _0x1837=function(_0x2dcfaa,_0x32785f){_0x2dcfaa=_0x2dcfaa-0x0;var _0x23e9ad=_0x8371[_0x2dcfaa];return _0x23e9ad;};'use strict';var _=require(_0x1837('0x0'));var rp=require(_0x1837('0x1'));var BPromise=require(_0x1837('0x2'));var md5=require(_0x1837('0x3'));var util=require(_0x1837('0x4'));var Redis=require(_0x1837('0x5'));var intUtil=require(_0x1837('0x6'));var config=require(_0x1837('0x7'));var logger=require(_0x1837('0x8'))(_0x1837('0x9'));config[_0x1837('0xa')]=_[_0x1837('0xb')](config[_0x1837('0xa')],{'host':_0x1837('0xc'),'port':0x18eb});var io=require(_0x1837('0xd'))(new Redis(config[_0x1837('0xa')]));function emit(_0x5385ac,_0x2143b5,_0x1d8320){io['to'](_0x5385ac)['emit'](_0x2143b5,_0x1d8320);}function getCustomFields(_0x7e3382,_0x494f18){var _0x3d51fd={};if(_0x7e3382[_0x1837('0xe')]>0x0){_['forEach'](_0x7e3382,function(_0xe6f153){if(_0xe6f153[_0x1837('0xf')]===_0x1837('0x10')&&_0xe6f153[_0x1837('0x11')]){_0x3d51fd[_0xe6f153['idField']]=_0xe6f153[_0x1837('0x12')]['toString']();}else if(_0xe6f153[_0x1837('0xf')]==='variable'&&_0xe6f153[_0x1837('0x13')]&&_0xe6f153[_0x1837('0x11')]&&_0x494f18[_0xe6f153['variableName']]){_0x3d51fd[_0xe6f153['idField']]=_0x494f18[_0xe6f153[_0x1837('0x13')]][_0x1837('0x14')]();}else if(_0xe6f153['type']===_0x1837('0x15')&&_0xe6f153[_0x1837('0x16')]&&_0xe6f153['Variable']['name']&&_0xe6f153[_0x1837('0x11')]&&_0x494f18[_0xe6f153[_0x1837('0x16')][_0x1837('0x17')][_0x1837('0x18')]()]){_0x3d51fd[_0xe6f153[_0x1837('0x11')]]=_0x494f18[_0xe6f153[_0x1837('0x16')][_0x1837('0x17')][_0x1837('0x18')]()][_0x1837('0x14')]();}});}return _0x3d51fd;}function createTicket(_0x30f2a6,_0xbf448c,_0x293a0e,_0x29d7be,_0x2bd724,_0x170792,_0x3dd666){logger[_0x1837('0x19')](_0x1837('0x1a'));var _0xa89a70=_[_0x1837('0x1b')]({'parent_id':'','assigned_user_id':_0xbf448c['id'],'ticketpriorities':_0x1837('0x1c'),'ticketstatus':_0x1837('0x1d'),'ticket_title':intUtil['getString'](_0x29d7be[_0x1837('0x1e')],_0x2bd724,'\x20'),'description':intUtil[_0x1837('0x1f')](_0x29d7be[_0x1837('0x20')],_0x2bd724,'\x0a'),'contact_id':_0x293a0e['id']},getCustomFields(_0x170792,_0x2bd724));var _0x494ec5={'method':_0x1837('0x21'),'uri':util['format'](_0x1837('0x22'),_0x30f2a6[_0x1837('0x23')]),'form':{'operation':_0x1837('0x24'),'username':_0x30f2a6[_0x1837('0x25')],'sessionName':_0x3dd666[_0x1837('0x26')],'elementType':_0x1837('0x27'),'element':JSON[_0x1837('0x28')](_0xa89a70)},'json':!![]};return request(_0x494ec5)[_0x1837('0x29')](function(_0x11e734){if(_0x11e734['success']){return BPromise[_0x1837('0x2a')]({'id':_0x11e734[_0x1837('0x2b')]['id']});}else{throw new Error(util[_0x1837('0x2c')](_0x1837('0x2d'),JSON[_0x1837('0x28')](_0x11e734[_0x1837('0x2e')])));}})[_0x1837('0x2f')](function(_0x1d8ef9){var _0x4f353b=_0x1d8ef9['statusCode']||0x1f4;logger[_0x1837('0x2e')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x1837('0x30'),_0x4f353b,JSON['stringify'](_0x1d8ef9));});}function getUser(_0x542d8f,_0x154bbb,_0x33a9e1){if(intUtil['validateEmail'](_0x154bbb)){logger[_0x1837('0x19')](_0x1837('0x31'),_0x154bbb);return request({'method':_0x1837('0x32'),'uri':util[_0x1837('0x2c')](_0x1837('0x22'),_0x542d8f[_0x1837('0x23')]),'qs':{'operation':_0x1837('0x33'),'username':_0x542d8f['username'],'sessionName':_0x33a9e1[_0x1837('0x26')],'query':util['format'](_0x1837('0x34'),_0x154bbb)},'json':!![]})[_0x1837('0x29')](function(_0x786fdd){if(_0x786fdd[_0x1837('0x35')]&&_0x786fdd[_0x1837('0x2b')][_0x1837('0xe')]){logger[_0x1837('0x19')](_0x1837('0x36'));return BPromise[_0x1837('0x2a')]({'id':_0x786fdd['result'][0x0]['id'],'email':_0x786fdd['result'][0x0][_0x1837('0x37')],'name':_0x786fdd['result'][0x0][_0x1837('0x38')]+'\x20'+_0x786fdd[_0x1837('0x2b')]['last_name']});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x1837('0x2a')]({'id':_0x33a9e1[_0x1837('0x39')],'email':_0x542d8f['username'],'name':_0x1837('0x3a')});}})[_0x1837('0x2f')](function(_0x4d28c4){var _0x5a4e25=_0x4d28c4[_0x1837('0x3b')]||0x1f4;logger[_0x1837('0x2e')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x1837('0x3c'),_0x5a4e25,JSON[_0x1837('0x28')](_0x4d28c4));});}else{logger['info'](_0x1837('0x3d'));return BPromise[_0x1837('0x2a')]({'id':_0x33a9e1[_0x1837('0x39')],'email':_0x542d8f[_0x1837('0x25')],'name':_0x1837('0x3a')})[_0x1837('0x2f')](function(_0x425d4d){var _0x211e33=_0x425d4d[_0x1837('0x3b')]||0x1f4;logger['error'](_0x1837('0x3e'),_0x1837('0x3c'),_0x211e33,JSON[_0x1837('0x28')](_0x425d4d));});}}function getEndUser(_0x386c4f,_0x1dbf8e,_0x4e388e,_0x50f972){logger[_0x1837('0x19')](_0x1837('0x3f'),_0x4e388e);return request({'method':'GET','uri':util[_0x1837('0x2c')](_0x1837('0x22'),_0x386c4f[_0x1837('0x23')]),'qs':{'operation':_0x1837('0x33'),'username':_0x386c4f[_0x1837('0x25')],'sessionName':_0x50f972['sessionName'],'query':util[_0x1837('0x2c')](_0x1837('0x40'),_0x4e388e,_0x4e388e,_0x4e388e,_0x4e388e,_0x4e388e)},'json':!![]})['then'](function(_0x44adaf){if(_0x44adaf['success']&&_0x44adaf[_0x1837('0x2b')][_0x1837('0xe')]){logger[_0x1837('0x19')](_0x1837('0x41'));return BPromise[_0x1837('0x2a')]({'id':_0x44adaf[_0x1837('0x2b')][0x0]['id'],'name':_0x44adaf[_0x1837('0x2b')][0x0][_0x1837('0x42')]+'\x20'+_0x44adaf[_0x1837('0x2b')][0x0][_0x1837('0x43')],'phone':_0x4e388e});}else{logger[_0x1837('0x19')](_0x1837('0x44'));return request({'method':'POST','uri':util[_0x1837('0x2c')](_0x1837('0x22'),_0x386c4f[_0x1837('0x23')]),'form':{'operation':_0x1837('0x24'),'sessionName':_0x50f972[_0x1837('0x26')],'elementType':_0x1837('0x45'),'element':JSON[_0x1837('0x28')]({'lastname':_0x1dbf8e,'phone':_0x4e388e,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x4ae61e){logger[_0x1837('0x19')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x4ae61e[_0x1837('0x2b')]['id'],'name':_0x4ae61e[_0x1837('0x2b')][_0x1837('0x43')],'phone':_0x4ae61e[_0x1837('0x2b')][_0x1837('0x46')]});})[_0x1837('0x2f')](function(_0x44cd95){var _0xac7680=_0x44cd95[_0x1837('0x3b')]||0x1f4;logger[_0x1837('0x2e')](_0x1837('0x3e'),'getEndUser',_0xac7680,JSON[_0x1837('0x28')](_0x44cd95));});}});}function getConnection(_0x314bab){var _0x303531=_0x314bab[_0x1837('0x25')];var _0x581400=_0x314bab[_0x1837('0x47')];return request({'method':'GET','uri':util[_0x1837('0x2c')](_0x1837('0x22'),_0x314bab[_0x1837('0x23')]),'qs':{'operation':_0x1837('0x48'),'username':_0x303531},'json':!![]})[_0x1837('0x29')](function(_0x2cef90){if(_0x2cef90['success']){return request({'method':_0x1837('0x21'),'uri':util[_0x1837('0x2c')](_0x1837('0x22'),_0x314bab[_0x1837('0x23')]),'form':{'operation':_0x1837('0x49'),'username':_0x303531,'accessKey':md5(_0x2cef90[_0x1837('0x2b')][_0x1837('0x4a')]+_0x581400)},'json':!![]});}})[_0x1837('0x29')](function(_0x1ca505){if(_0x1ca505[_0x1837('0x35')]){return BPromise['resolve'](_0x1ca505[_0x1837('0x2b')]);}else{throw new Error(util[_0x1837('0x2c')]('Account\x20%d\x20is\x20not\x20valid',_0x314bab['id']));}})[_0x1837('0x2f')](function(_0x253c30){var _0x22bd4d=_0x253c30['statusCode']||0x1f4;logger[_0x1837('0x2e')](_0x1837('0x3e'),'getConnection',_0x22bd4d,JSON[_0x1837('0x28')](_0x253c30));});}function request(_0x15ad63){logger[_0x1837('0x19')](_0x1837('0x4b'),JSON[_0x1837('0x28')](_0x15ad63));return rp(_0x15ad63);}exports['queue']=function(_0x3cf411,_0x1eb2d7,_0x5995a3,_0x4dc2f8,_0x534032,_0x3a0179){var _0x4ec201,_0x399804,_0x99e3f8,_0x1e2c85;_0x3a0179['remoteUri']=intUtil[_0x1837('0x4c')](_0x3a0179[_0x1837('0x23')]);if(_0x534032&&_0x534032[_0x1837('0x4d')]){logger[_0x1837('0x19')](_0x1837('0x4e'),_0x1837('0x4f'));_0x1eb2d7[_0x1837('0x50')]=util[_0x1837('0x2c')](_0x1837('0x51'),_0x3a0179['serverUrl'],_0x1eb2d7[_0x1837('0x52')],md5(_0x1eb2d7[_0x1837('0x52')]));}else{_0x1eb2d7['recordingURL']='';}return getConnection(_0x3a0179)[_0x1837('0x29')](function(_0xacdc8b){_0x1e2c85=_0xacdc8b;return getUser(_0x3a0179,_0x4dc2f8[_0x1837('0x53')],_0x1e2c85);})[_0x1837('0x29')](function(_0x26f631){_0x4ec201=_0x26f631;logger[_0x1837('0x19')](_0x1837('0x54'),_0x4ec201['id']);return getEndUser(_0x3a0179,_0x1eb2d7[_0x1837('0x55')],_0x1eb2d7[_0x1837('0x56')],_0x1e2c85);})[_0x1837('0x29')](function(_0x2e208c){_0x399804=_0x2e208c;logger[_0x1837('0x19')]('The\x20Enduser\x20ID\x20is:',_0x399804['id']);return createTicket(_0x3a0179,_0x4ec201,_0x399804,_0x5995a3,_0x1eb2d7,_0x5995a3[_0x1837('0x57')],_0x1e2c85);})['then'](function(_0x5f42dd){_0x99e3f8=_0x5f42dd;logger[_0x1837('0x19')](_0x1837('0x58'));logger[_0x1837('0x19')](_0x1837('0x59'),_0x99e3f8['id']);var _0x1aeaf9=util[_0x1837('0x2c')](_0x1837('0x5a'),_0x3a0179['remoteUri'],_['split'](_0x99e3f8['id'],'x')[0x1]);logger[_0x1837('0x19')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x1837('0x5b'),_0x4dc2f8['name']),_0x1837('0x5c'),{'uri':_0x1aeaf9});})[_0x1837('0x2f')](function(_0x275740){logger[_0x1837('0x2e')](_0x1837('0x4e'),JSON[_0x1837('0x28')](_0x275740));});};exports[_0x1837('0x5d')]=function(_0x20bfc3,_0x44bd36,_0x406caa,_0x355e8b,_0x4bb438,_0xaa26bc,_0x5681f7){var _0x32037e,_0x46cf65,_0x518183,_0x332822;_0xaa26bc[_0x1837('0x23')]=intUtil[_0x1837('0x4c')](_0xaa26bc[_0x1837('0x23')]);_0xaa26bc[_0x1837('0x5e')]=intUtil['stripTrailingSlash'](_0xaa26bc['serverUrl']);if(_0x5681f7&&_0x5681f7[_0x1837('0x5f')]&&_0x5681f7[_0x1837('0x5f')]!==_0x1837('0x60')){logger[_0x1837('0x19')](_0x1837('0x61'),_0x1837('0x4f'));_0x44bd36[_0x1837('0x50')]=util[_0x1837('0x2c')](_0x1837('0x51'),_0xaa26bc[_0x1837('0x5e')],_0x44bd36['uniqueid'],md5(_0x44bd36[_0x1837('0x52')]));}return getConnection(_0xaa26bc)['then'](function(_0x3550ae){_0x332822=_0x3550ae;return getUser(_0xaa26bc,_0x355e8b['email'],_0x332822);})[_0x1837('0x29')](function(_0x4b13aa){_0x32037e=_0x4b13aa;logger[_0x1837('0x19')](_0x1837('0x54'),_0x32037e['id']);return getEndUser(_0xaa26bc,_0x44bd36[_0x1837('0x62')],_0x44bd36['destcalleridnum'],_0x332822);})[_0x1837('0x29')](function(_0xa89a47){_0x46cf65=_0xa89a47;logger[_0x1837('0x19')](_0x1837('0x63'),_0x46cf65['id']);return createTicket(_0xaa26bc,_0x32037e,_0x46cf65,_0x406caa,_0x44bd36,_0x406caa[_0x1837('0x57')],_0x332822);})[_0x1837('0x29')](function(_0xf4e583){_0x518183=_0xf4e583;logger[_0x1837('0x19')]('Ticket\x20created!');logger['info'](_0x1837('0x59'),_0x518183['id']);var _0x109607=util[_0x1837('0x2c')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0xaa26bc['remoteUri'],_[_0x1837('0x64')](_0x518183['id'],'x')[0x1]);logger['info']('[OUTBOUND]',_0x1837('0x65'));emit(util[_0x1837('0x2c')]('user:%s',_0x355e8b[_0x1837('0x17')]),_0x1837('0x5c'),{'uri':_0x109607});})['catch'](function(_0xdc554e){logger['error'](_0x1837('0x61'),JSON['stringify'](_0xdc554e));});};exports[_0x1837('0x66')]=function(_0x116a2f,_0x1c4de4,_0x16522f,_0x25cdc4,_0x4a2e0d,_0x4e6f4f){var _0x2309d1,_0x27a6ca,_0x21a104,_0x2ff044;_0x4e6f4f[_0x1837('0x23')]=intUtil[_0x1837('0x4c')](_0x4e6f4f[_0x1837('0x23')]);_0x4e6f4f[_0x1837('0x5e')]=intUtil[_0x1837('0x4c')](_0x4e6f4f[_0x1837('0x5e')]);if(_0x4a2e0d&&_0x4a2e0d['monitor_format']){logger[_0x1837('0x19')]('['+_0x1c4de4[_0x1837('0x67')][_0x1837('0x68')]()+']',_0x1837('0x4f'));_0x1c4de4[_0x1837('0x50')]=util[_0x1837('0x2c')](_0x1837('0x51'),_0x4e6f4f[_0x1837('0x5e')],_0x1c4de4['uniqueid'],md5(_0x1c4de4[_0x1837('0x52')]));}else{_0x1c4de4[_0x1837('0x50')]='';}return getConnection(_0x4e6f4f)[_0x1837('0x29')](function(_0x450f90){_0x2ff044=_0x450f90;return getUser(_0x4e6f4f,'',_0x2ff044);})[_0x1837('0x29')](function(_0x166ee4){_0x2309d1=_0x166ee4;logger[_0x1837('0x19')]('The\x20User\x20ID\x20is:',_0x2309d1['id']);return getEndUser(_0x4e6f4f,_0x1c4de4[_0x1837('0x55')],_0x1c4de4[_0x1837('0x56')],_0x2ff044);})[_0x1837('0x29')](function(_0x5e6522){_0x27a6ca=_0x5e6522;logger[_0x1837('0x19')](_0x1837('0x63'),_0x27a6ca['id']);return createTicket(_0x4e6f4f,_0x2309d1,_0x27a6ca,_0x16522f,_0x1c4de4,_0x16522f[_0x1837('0x57')],_0x2ff044);})['then'](function(_0x56a506){_0x21a104=_0x56a506;logger[_0x1837('0x19')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x21a104['id']);})[_0x1837('0x2f')](function(_0x2f24d0){logger[_0x1837('0x2e')]('['+_0x1c4de4[_0x1837('0x67')][_0x1837('0x68')]()+']',JSON[_0x1837('0x28')](_0x2f24d0));});}; \ No newline at end of file +var _0xd6e6=['idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Open','Subjects','getString','Descriptions','format','%s/webservice.php','remoteUri','create','sessionName','stringify','then','success','resolve','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','email1','first_name','last_name','userId','getUser','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Enduser\x20found!','firstname','lastname','Enduser\x20created.','phone','accessKey','getchallenge','POST','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','user:%s','trigger:browser:url','outbound','serverUrl','recordingFormat','none','[OUTBOUND]','destcalleridname','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','lastevent','toUpperCase','Fields','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','defaults','redis','localhost','socket.io-emitter','length','forEach','type','string'];(function(_0x444223,_0x2636cd){var _0x5110cb=function(_0x44295d){while(--_0x44295d){_0x444223['push'](_0x444223['shift']());}};_0x5110cb(++_0x2636cd);}(_0xd6e6,0x11c));var _0x6d6e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd6e6[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6d6e('0x0'));var rp=require(_0x6d6e('0x1'));var BPromise=require(_0x6d6e('0x2'));var md5=require(_0x6d6e('0x3'));var util=require(_0x6d6e('0x4'));var Redis=require(_0x6d6e('0x5'));var intUtil=require(_0x6d6e('0x6'));var config=require(_0x6d6e('0x7'));var logger=require('../../../../config/logger')('vTiger');config['redis']=_[_0x6d6e('0x8')](config[_0x6d6e('0x9')],{'host':_0x6d6e('0xa'),'port':0x18eb});var io=require(_0x6d6e('0xb'))(new Redis(config[_0x6d6e('0x9')]));function emit(_0x3aa4a2,_0x191446,_0x43b3c8){io['to'](_0x3aa4a2)['emit'](_0x191446,_0x43b3c8);}function getCustomFields(_0x127627,_0xdf3b4f){var _0x27a5f4={};if(_0x127627[_0x6d6e('0xc')]>0x0){_[_0x6d6e('0xd')](_0x127627,function(_0xad1997){if(_0xad1997[_0x6d6e('0xe')]===_0x6d6e('0xf')&&_0xad1997[_0x6d6e('0x10')]){_0x27a5f4[_0xad1997[_0x6d6e('0x10')]]=_0xad1997[_0x6d6e('0x11')][_0x6d6e('0x12')]();}else if(_0xad1997['type']===_0x6d6e('0x13')&&_0xad1997[_0x6d6e('0x14')]&&_0xad1997[_0x6d6e('0x10')]&&_0xdf3b4f[_0xad1997['variableName']]){_0x27a5f4[_0xad1997[_0x6d6e('0x10')]]=_0xdf3b4f[_0xad1997['variableName']][_0x6d6e('0x12')]();}else if(_0xad1997[_0x6d6e('0xe')]===_0x6d6e('0x15')&&_0xad1997[_0x6d6e('0x16')]&&_0xad1997[_0x6d6e('0x16')][_0x6d6e('0x17')]&&_0xad1997[_0x6d6e('0x10')]&&_0xdf3b4f[_0xad1997[_0x6d6e('0x16')][_0x6d6e('0x17')][_0x6d6e('0x18')]()]){_0x27a5f4[_0xad1997[_0x6d6e('0x10')]]=_0xdf3b4f[_0xad1997[_0x6d6e('0x16')]['name'][_0x6d6e('0x18')]()][_0x6d6e('0x12')]();}});}return _0x27a5f4;}function createTicket(_0x2d9cfd,_0x538a25,_0x30e777,_0x41cf8e,_0x51766d,_0x122b72,_0x39b08c){logger[_0x6d6e('0x19')](_0x6d6e('0x1a'));var _0x26af73=_[_0x6d6e('0x1b')]({'parent_id':'','assigned_user_id':_0x538a25['id'],'ticketpriorities':'Normal','ticketstatus':_0x6d6e('0x1c'),'ticket_title':intUtil['getString'](_0x41cf8e[_0x6d6e('0x1d')],_0x51766d,'\x20'),'description':intUtil[_0x6d6e('0x1e')](_0x41cf8e[_0x6d6e('0x1f')],_0x51766d,'\x0a'),'contact_id':_0x30e777['id']},getCustomFields(_0x122b72,_0x51766d));var _0x3cc0ee={'method':'POST','uri':util[_0x6d6e('0x20')](_0x6d6e('0x21'),_0x2d9cfd[_0x6d6e('0x22')]),'form':{'operation':_0x6d6e('0x23'),'username':_0x2d9cfd['username'],'sessionName':_0x39b08c[_0x6d6e('0x24')],'elementType':'HelpDesk','element':JSON[_0x6d6e('0x25')](_0x26af73)},'json':!![]};return request(_0x3cc0ee)[_0x6d6e('0x26')](function(_0x17324c){if(_0x17324c[_0x6d6e('0x27')]){return BPromise[_0x6d6e('0x28')]({'id':_0x17324c['result']['id']});}else{throw new Error(util['format']('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x6d6e('0x25')](_0x17324c[_0x6d6e('0x29')])));}})[_0x6d6e('0x2a')](function(_0x3788dc){var _0x3607c3=_0x3788dc[_0x6d6e('0x2b')]||0x1f4;logger['error'](_0x6d6e('0x2c'),_0x6d6e('0x2d'),_0x3607c3,JSON[_0x6d6e('0x25')](_0x3788dc));});}function getUser(_0x1fdfc0,_0x5ac76c,_0x1527e4){if(intUtil[_0x6d6e('0x2e')](_0x5ac76c)){logger[_0x6d6e('0x19')](_0x6d6e('0x2f'),_0x5ac76c);return request({'method':_0x6d6e('0x30'),'uri':util[_0x6d6e('0x20')](_0x6d6e('0x21'),_0x1fdfc0[_0x6d6e('0x22')]),'qs':{'operation':_0x6d6e('0x31'),'username':_0x1fdfc0[_0x6d6e('0x32')],'sessionName':_0x1527e4['sessionName'],'query':util[_0x6d6e('0x20')](_0x6d6e('0x33'),_0x5ac76c)},'json':!![]})[_0x6d6e('0x26')](function(_0x26dc12){if(_0x26dc12['success']&&_0x26dc12['result']['length']){logger[_0x6d6e('0x19')]('Agent\x20found!');return BPromise[_0x6d6e('0x28')]({'id':_0x26dc12[_0x6d6e('0x34')][0x0]['id'],'email':_0x26dc12[_0x6d6e('0x34')][0x0][_0x6d6e('0x35')],'name':_0x26dc12[_0x6d6e('0x34')][0x0][_0x6d6e('0x36')]+'\x20'+_0x26dc12[_0x6d6e('0x34')][_0x6d6e('0x37')]});}else{logger[_0x6d6e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x1527e4[_0x6d6e('0x38')],'email':_0x1fdfc0[_0x6d6e('0x32')],'name':'admin'});}})[_0x6d6e('0x2a')](function(_0x44073a){var _0x15e0de=_0x44073a[_0x6d6e('0x2b')]||0x1f4;logger[_0x6d6e('0x29')](_0x6d6e('0x2c'),_0x6d6e('0x39'),_0x15e0de,JSON['stringify'](_0x44073a));});}else{logger[_0x6d6e('0x19')](_0x6d6e('0x3a'));return BPromise[_0x6d6e('0x28')]({'id':_0x1527e4[_0x6d6e('0x38')],'email':_0x1fdfc0[_0x6d6e('0x32')],'name':'admin'})['catch'](function(_0x4f5daa){var _0x4a84f6=_0x4f5daa[_0x6d6e('0x2b')]||0x1f4;logger[_0x6d6e('0x29')](_0x6d6e('0x2c'),'getUser',_0x4a84f6,JSON[_0x6d6e('0x25')](_0x4f5daa));});}}function getEndUser(_0x5874f7,_0x500108,_0x555572,_0x4a00b1){logger[_0x6d6e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x555572);return request({'method':_0x6d6e('0x30'),'uri':util['format']('%s/webservice.php',_0x5874f7[_0x6d6e('0x22')]),'qs':{'operation':_0x6d6e('0x31'),'username':_0x5874f7['username'],'sessionName':_0x4a00b1[_0x6d6e('0x24')],'query':util[_0x6d6e('0x20')]('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;',_0x555572,_0x555572,_0x555572,_0x555572,_0x555572)},'json':!![]})[_0x6d6e('0x26')](function(_0xfcf056){if(_0xfcf056[_0x6d6e('0x27')]&&_0xfcf056[_0x6d6e('0x34')][_0x6d6e('0xc')]){logger[_0x6d6e('0x19')](_0x6d6e('0x3b'));return BPromise[_0x6d6e('0x28')]({'id':_0xfcf056[_0x6d6e('0x34')][0x0]['id'],'name':_0xfcf056[_0x6d6e('0x34')][0x0][_0x6d6e('0x3c')]+'\x20'+_0xfcf056['result'][0x0][_0x6d6e('0x3d')],'phone':_0x555572});}else{logger[_0x6d6e('0x19')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util[_0x6d6e('0x20')](_0x6d6e('0x21'),_0x5874f7[_0x6d6e('0x22')]),'form':{'operation':_0x6d6e('0x23'),'sessionName':_0x4a00b1[_0x6d6e('0x24')],'elementType':'Contacts','element':JSON[_0x6d6e('0x25')]({'lastname':_0x500108,'phone':_0x555572,'assigned_user_id':'\x20'})},'json':!![]})[_0x6d6e('0x26')](function(_0x194b33){logger[_0x6d6e('0x19')](_0x6d6e('0x3e'));return BPromise['resolve']({'id':_0x194b33['result']['id'],'name':_0x194b33[_0x6d6e('0x34')][_0x6d6e('0x3d')],'phone':_0x194b33[_0x6d6e('0x34')][_0x6d6e('0x3f')]});})[_0x6d6e('0x2a')](function(_0x1c3b06){var _0x9e7883=_0x1c3b06[_0x6d6e('0x2b')]||0x1f4;logger[_0x6d6e('0x29')](_0x6d6e('0x2c'),'getEndUser',_0x9e7883,JSON[_0x6d6e('0x25')](_0x1c3b06));});}});}function getConnection(_0x5e12a0){var _0x26087a=_0x5e12a0['username'];var _0x550e1b=_0x5e12a0[_0x6d6e('0x40')];return request({'method':'GET','uri':util['format'](_0x6d6e('0x21'),_0x5e12a0['remoteUri']),'qs':{'operation':_0x6d6e('0x41'),'username':_0x26087a},'json':!![]})[_0x6d6e('0x26')](function(_0x6bf31d){if(_0x6bf31d[_0x6d6e('0x27')]){return request({'method':_0x6d6e('0x42'),'uri':util[_0x6d6e('0x20')](_0x6d6e('0x21'),_0x5e12a0[_0x6d6e('0x22')]),'form':{'operation':'login','username':_0x26087a,'accessKey':md5(_0x6bf31d['result'][_0x6d6e('0x43')]+_0x550e1b)},'json':!![]});}})[_0x6d6e('0x26')](function(_0x267331){if(_0x267331[_0x6d6e('0x27')]){return BPromise['resolve'](_0x267331[_0x6d6e('0x34')]);}else{throw new Error(util[_0x6d6e('0x20')](_0x6d6e('0x44'),_0x5e12a0['id']));}})[_0x6d6e('0x2a')](function(_0xcf79e1){var _0x3b76c0=_0xcf79e1[_0x6d6e('0x2b')]||0x1f4;logger[_0x6d6e('0x29')](_0x6d6e('0x2c'),_0x6d6e('0x45'),_0x3b76c0,JSON[_0x6d6e('0x25')](_0xcf79e1));});}function request(_0x123f0b){logger[_0x6d6e('0x19')](_0x6d6e('0x46'),JSON[_0x6d6e('0x25')](_0x123f0b));return rp(_0x123f0b);}exports[_0x6d6e('0x47')]=function(_0x15fa86,_0x14b81c,_0x27e37a,_0x1aeab9,_0x46335d,_0x212173){var _0xa4e4d0,_0x4b7e17,_0x482e1a,_0x12bc68;_0x212173[_0x6d6e('0x22')]=intUtil[_0x6d6e('0x48')](_0x212173['remoteUri']);if(_0x46335d&&_0x46335d[_0x6d6e('0x49')]){logger[_0x6d6e('0x19')](_0x6d6e('0x4a'),_0x6d6e('0x4b'));_0x14b81c['recordingURL']=util['format'](_0x6d6e('0x4c'),_0x212173['serverUrl'],_0x14b81c[_0x6d6e('0x4d')],md5(_0x14b81c['uniqueid']));}else{_0x14b81c[_0x6d6e('0x4e')]='';}return getConnection(_0x212173)[_0x6d6e('0x26')](function(_0x2ff94b){_0x12bc68=_0x2ff94b;return getUser(_0x212173,_0x1aeab9[_0x6d6e('0x4f')],_0x12bc68);})[_0x6d6e('0x26')](function(_0x38b751){_0xa4e4d0=_0x38b751;logger['info'](_0x6d6e('0x50'),_0xa4e4d0['id']);return getEndUser(_0x212173,_0x14b81c[_0x6d6e('0x51')],_0x14b81c[_0x6d6e('0x52')],_0x12bc68);})['then'](function(_0x56a1b2){_0x4b7e17=_0x56a1b2;logger[_0x6d6e('0x19')](_0x6d6e('0x53'),_0x4b7e17['id']);return createTicket(_0x212173,_0xa4e4d0,_0x4b7e17,_0x27e37a,_0x14b81c,_0x27e37a['Fields'],_0x12bc68);})[_0x6d6e('0x26')](function(_0x417f7d){_0x482e1a=_0x417f7d;logger[_0x6d6e('0x19')]('Ticket\x20created!');logger[_0x6d6e('0x19')](_0x6d6e('0x54'),_0x482e1a['id']);var _0x4045df=util[_0x6d6e('0x20')](_0x6d6e('0x55'),_0x212173[_0x6d6e('0x22')],_[_0x6d6e('0x56')](_0x482e1a['id'],'x')[0x1]);logger[_0x6d6e('0x19')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6d6e('0x20')](_0x6d6e('0x57'),_0x1aeab9[_0x6d6e('0x17')]),_0x6d6e('0x58'),{'uri':_0x4045df});})['catch'](function(_0xff6542){logger[_0x6d6e('0x29')](_0x6d6e('0x4a'),JSON[_0x6d6e('0x25')](_0xff6542));});};exports[_0x6d6e('0x59')]=function(_0x27cba4,_0x18452e,_0x4095fc,_0x342886,_0x5ae46d,_0xe2fb84,_0x2e8ec4){var _0x1da459,_0x12eb9a,_0x4ec1e4,_0x4c426b;_0xe2fb84['remoteUri']=intUtil[_0x6d6e('0x48')](_0xe2fb84[_0x6d6e('0x22')]);_0xe2fb84[_0x6d6e('0x5a')]=intUtil['stripTrailingSlash'](_0xe2fb84[_0x6d6e('0x5a')]);if(_0x2e8ec4&&_0x2e8ec4[_0x6d6e('0x5b')]&&_0x2e8ec4[_0x6d6e('0x5b')]!==_0x6d6e('0x5c')){logger['info'](_0x6d6e('0x5d'),_0x6d6e('0x4b'));_0x18452e[_0x6d6e('0x4e')]=util['format'](_0x6d6e('0x4c'),_0xe2fb84[_0x6d6e('0x5a')],_0x18452e[_0x6d6e('0x4d')],md5(_0x18452e[_0x6d6e('0x4d')]));}return getConnection(_0xe2fb84)[_0x6d6e('0x26')](function(_0xc754ec){_0x4c426b=_0xc754ec;return getUser(_0xe2fb84,_0x342886[_0x6d6e('0x4f')],_0x4c426b);})['then'](function(_0x14f350){_0x1da459=_0x14f350;logger['info'](_0x6d6e('0x50'),_0x1da459['id']);return getEndUser(_0xe2fb84,_0x18452e[_0x6d6e('0x5e')],_0x18452e['destcalleridnum'],_0x4c426b);})[_0x6d6e('0x26')](function(_0x42c971){_0x12eb9a=_0x42c971;logger[_0x6d6e('0x19')](_0x6d6e('0x53'),_0x12eb9a['id']);return createTicket(_0xe2fb84,_0x1da459,_0x12eb9a,_0x4095fc,_0x18452e,_0x4095fc['Fields'],_0x4c426b);})[_0x6d6e('0x26')](function(_0x2fa278){_0x4ec1e4=_0x2fa278;logger[_0x6d6e('0x19')](_0x6d6e('0x5f'));logger[_0x6d6e('0x19')](_0x6d6e('0x54'),_0x4ec1e4['id']);var _0x4525a9=util['format'](_0x6d6e('0x55'),_0xe2fb84[_0x6d6e('0x22')],_[_0x6d6e('0x56')](_0x4ec1e4['id'],'x')[0x1]);logger[_0x6d6e('0x19')](_0x6d6e('0x5d'),_0x6d6e('0x60'));emit(util['format'](_0x6d6e('0x57'),_0x342886[_0x6d6e('0x17')]),_0x6d6e('0x58'),{'uri':_0x4525a9});})['catch'](function(_0x23b118){logger[_0x6d6e('0x29')](_0x6d6e('0x5d'),JSON[_0x6d6e('0x25')](_0x23b118));});};exports['unmanaged']=function(_0x977a4b,_0x1ecbdc,_0x55ff3f,_0x5af1b6,_0x46e7f6,_0x2786b9){var _0x24be0c,_0x363c1e,_0x3e7e55,_0x1a8138;_0x2786b9[_0x6d6e('0x22')]=intUtil[_0x6d6e('0x48')](_0x2786b9[_0x6d6e('0x22')]);_0x2786b9['serverUrl']=intUtil[_0x6d6e('0x48')](_0x2786b9[_0x6d6e('0x5a')]);if(_0x46e7f6&&_0x46e7f6[_0x6d6e('0x49')]){logger['info']('['+_0x1ecbdc[_0x6d6e('0x61')][_0x6d6e('0x62')]()+']',_0x6d6e('0x4b'));_0x1ecbdc[_0x6d6e('0x4e')]=util[_0x6d6e('0x20')](_0x6d6e('0x4c'),_0x2786b9['serverUrl'],_0x1ecbdc['uniqueid'],md5(_0x1ecbdc['uniqueid']));}else{_0x1ecbdc[_0x6d6e('0x4e')]='';}return getConnection(_0x2786b9)[_0x6d6e('0x26')](function(_0x524c99){_0x1a8138=_0x524c99;return getUser(_0x2786b9,'',_0x1a8138);})[_0x6d6e('0x26')](function(_0x2cb8f0){_0x24be0c=_0x2cb8f0;logger[_0x6d6e('0x19')]('The\x20User\x20ID\x20is:',_0x24be0c['id']);return getEndUser(_0x2786b9,_0x1ecbdc[_0x6d6e('0x51')],_0x1ecbdc[_0x6d6e('0x52')],_0x1a8138);})['then'](function(_0x5cf759){_0x363c1e=_0x5cf759;logger[_0x6d6e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x363c1e['id']);return createTicket(_0x2786b9,_0x24be0c,_0x363c1e,_0x55ff3f,_0x1ecbdc,_0x55ff3f[_0x6d6e('0x63')],_0x1a8138);})[_0x6d6e('0x26')](function(_0x5e8ff8){_0x3e7e55=_0x5e8ff8;logger['info']('Ticket\x20created!');logger[_0x6d6e('0x19')](_0x6d6e('0x54'),_0x3e7e55['id']);})[_0x6d6e('0x2a')](function(_0x28fb84){logger[_0x6d6e('0x29')]('['+_0x1ecbdc[_0x6d6e('0x61')][_0x6d6e('0x62')]()+']',JSON['stringify'](_0x28fb84));});}; \ 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 129616b..f27a56a 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 _0x4ea3=['trigger:browser:url','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','toUpperCase','catch','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','count','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20found!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','%s/token:%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','push','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','recordingURL','destcalleridname','[OUTBOUND]','user:%s'];(function(_0x420513,_0x30eae3){var _0x1b44ec=function(_0x644f88){while(--_0x644f88){_0x420513['push'](_0x420513['shift']());}};_0x1b44ec(++_0x30eae3);}(_0x4ea3,0x70));var _0x34ea=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x4ea3[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x34ea('0x0'));var rp=require(_0x34ea('0x1'));var md5=require(_0x34ea('0x2'));var util=require(_0x34ea('0x3'));var Redis=require('ioredis');var intUtil=require(_0x34ea('0x4'));var config=require('../../../../config/environment');var logger=require(_0x34ea('0x5'))('zendesk');config['redis']=_[_0x34ea('0x6')](config[_0x34ea('0x7')],{'host':_0x34ea('0x8'),'port':0x18eb});var io=require(_0x34ea('0x9'))(new Redis(config[_0x34ea('0x7')]));function emit(_0x18b461,_0x22b09e,_0x5bec7c){io['to'](_0x18b461)[_0x34ea('0xa')](_0x22b09e,_0x5bec7c);}var headers={'Content-Type':_0x34ea('0xb'),'Accept':_0x34ea('0xb')};function getTicket(_0x5132c4,_0x301b98,_0xea1be2,_0x5126de,_0x4a76b1){logger[_0x34ea('0xc')](_0x34ea('0xd'));return request({'uri':util[_0x34ea('0xe')]('%s/tickets.json',_0x5132c4[_0x34ea('0xf')]),'method':_0x34ea('0x10'),'body':{'ticket':_[_0x34ea('0x11')]({'requester_id':_0xea1be2['id'],'submitter_id':_0x301b98?_0x301b98['id']:undefined,'assignee_id':_0x301b98?_0x301b98['id']:undefined,'tags':getTags(_0x5126de[_0x34ea('0x12')],_0x34ea('0x13')),'subject':intUtil[_0x34ea('0x14')](_0x5126de[_0x34ea('0x15')],_0x4a76b1,'\x20'),'description':intUtil[_0x34ea('0x14')](_0x5126de[_0x34ea('0x16')],_0x4a76b1,'\x0a'),'comment':{'public':![],'body':intUtil[_0x34ea('0x14')](_0x5126de[_0x34ea('0x16')],_0x4a76b1,'\x0a')}},getCustomFields(_0x5126de['Fields'],_0x4a76b1))}})[_0x34ea('0x17')](function(_0x89e3f2){logger[_0x34ea('0xc')](_0x34ea('0x18'));return _0x89e3f2[_0x34ea('0x19')];});}function getUser(_0x56b2d7,_0x6a84a7){if(intUtil[_0x34ea('0x1a')](_0x6a84a7)){logger[_0x34ea('0xc')](_0x34ea('0x1b'),_0x6a84a7);return request({'uri':util['format'](_0x34ea('0x1c'),_0x56b2d7[_0x34ea('0xf')]),'qs':{'query':util[_0x34ea('0xe')]('type:user\x20role:agent\x20email:%s',_0x6a84a7)}})[_0x34ea('0x17')](function(_0x1353de){if(_0x1353de[_0x34ea('0x1d')]){logger[_0x34ea('0xc')]('Agent\x20found!');return _[_0x34ea('0x1e')](_0x1353de[_0x34ea('0x1f')],{'email':_0x6a84a7,'role':_0x34ea('0x20')});}else{logger[_0x34ea('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x34ea('0x21'),_0x56b2d7[_0x34ea('0xf')])})[_0x34ea('0x17')](function(_0x51022f){logger['info'](_0x34ea('0x22'));return _0x51022f[_0x34ea('0x23')];});}});}else{logger[_0x34ea('0xc')](_0x34ea('0x24'));return request({'uri':util[_0x34ea('0xe')](_0x34ea('0x21'),_0x56b2d7['remoteUri'])})[_0x34ea('0x17')](function(_0x46671f){logger[_0x34ea('0xc')](_0x34ea('0x22'));return _0x46671f['user'];});}}function getEndUser(_0x56f320,_0x564d1b,_0x142709){logger[_0x34ea('0xc')](_0x34ea('0x25'),_0x142709);return request({'uri':util[_0x34ea('0xe')]('%s/search.json',_0x56f320[_0x34ea('0xf')]),'qs':{'query':util[_0x34ea('0xe')](_0x34ea('0x26'),_0x142709)}})['then'](function(_0x4cded8){var _0x5b4727;if(_0x4cded8['results'][_0x34ea('0x27')]){_0x4cded8[_0x34ea('0x1f')]=_[_0x34ea('0x28')](_0x4cded8[_0x34ea('0x1f')],{'suspended':![],'role':'end-user'});if(_0x4cded8[_0x34ea('0x1f')]['length']){_0x5b4727=_[_0x34ea('0x29')](_0x4cded8['results']);}}if(_0x5b4727){logger[_0x34ea('0xc')](_0x34ea('0x2a'));return _0x5b4727;}else{logger[_0x34ea('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x34ea('0xe')](_0x34ea('0x2b'),_0x56f320['remoteUri']),'method':_0x34ea('0x10'),'body':{'user':{'role':'end-user','name':util[_0x34ea('0xe')](_0x34ea('0x2c'),_0x564d1b||_0x142709),'phone':_0x142709}}})[_0x34ea('0x17')](function(_0x5ead76){logger['info'](_0x34ea('0x2d'));return _0x5ead76['user'];});}});}function getAuth(_0x151fac){var _0x359a31;if(_0x151fac['authType']===_0x34ea('0x2e')){_0x359a31=util[_0x34ea('0xe')](_0x34ea('0x2f'),_0x151fac[_0x34ea('0x30')],_0x151fac['password']);}else if(_0x151fac['authType']==='token'){_0x359a31=util[_0x34ea('0xe')](_0x34ea('0x31'),_0x151fac[_0x34ea('0x30')],_0x151fac['token']);}return util['format']('Basic\x20%s',new Buffer(_0x359a31)[_0x34ea('0x32')](_0x34ea('0x33')));}function request(_0x583e2d){logger[_0x34ea('0x34')](_0x34ea('0x35'),JSON[_0x34ea('0x36')](_0x583e2d));return rp(_[_0x34ea('0x6')](_0x583e2d,{'method':_0x34ea('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x185883,_0x4e99e4){var _0x2faf49=[];if(_0x185883&&_0x185883[_0x34ea('0x27')]>0x0){_0x2faf49=_[_0x34ea('0x38')](_0x185883,_0x4e99e4);}return _0x2faf49;}function getCustomFields(_0x3a73a1,_0x4f05fc){var _0x5c44ab=[];var _0x6f024c={'custom_fields':[]};if(_0x3a73a1[_0x34ea('0x27')]>0x0){_[_0x34ea('0x39')](_0x3a73a1,function(_0x19f401){if(_0x19f401[_0x34ea('0x3a')]==='string'&&_0x19f401[_0x34ea('0x3b')]&&!_0x19f401[_0x34ea('0x3c')]){_0x6f024c[_0x19f401[_0x34ea('0x3b')][_0x34ea('0x3d')]()]=_0x19f401[_0x34ea('0x3e')][_0x34ea('0x32')]();}else if(_0x19f401[_0x34ea('0x3a')]===_0x34ea('0x3f')&&_0x19f401[_0x34ea('0x40')]&&_0x19f401[_0x34ea('0x3c')]){_0x6f024c[_0x34ea('0x41')][_0x34ea('0x42')]({'id':_0x19f401[_0x34ea('0x40')],'value':_0x19f401[_0x34ea('0x3e')][_0x34ea('0x32')]()});}else if(_0x19f401[_0x34ea('0x3a')]==='variable'&&_0x19f401[_0x34ea('0x43')]&&_0x19f401['idField']&&_0x19f401[_0x34ea('0x3c')]){_0x4f05fc[_0x19f401[_0x34ea('0x43')]]&&_0x6f024c[_0x34ea('0x41')][_0x34ea('0x42')]({'id':_0x19f401[_0x34ea('0x40')],'value':_0x4f05fc[_0x19f401[_0x34ea('0x43')]][_0x34ea('0x32')]()});}else if(_0x19f401[_0x34ea('0x3a')]===_0x34ea('0x44')&&_0x19f401['Variable']&&_0x19f401[_0x34ea('0x45')]['name']&&_0x19f401[_0x34ea('0x40')]&&_0x19f401[_0x34ea('0x3c')]){_0x4f05fc[_0x19f401[_0x34ea('0x45')][_0x34ea('0x13')][_0x34ea('0x3d')]()]&&_0x6f024c[_0x34ea('0x41')]['push']({'id':_0x19f401[_0x34ea('0x40')],'value':_0x4f05fc[_0x19f401[_0x34ea('0x45')]['name'][_0x34ea('0x3d')]()][_0x34ea('0x32')]()});}});}return _0x6f024c;}exports[_0x34ea('0x46')]=function(_0x37de77,_0xf5f2a3,_0x5d8dc9,_0x4384cc,_0x180444,_0x3f7456){var _0x2487bd,_0x3e2e61;_0x3f7456[_0x34ea('0xf')]=intUtil['stripTrailingSlash'](_0x3f7456['remoteUri']);_0x3f7456[_0x34ea('0x47')]=intUtil[_0x34ea('0x48')](_0x3f7456[_0x34ea('0x47')]);if(_0x180444&&_0x180444['monitor_format']){logger[_0x34ea('0xc')]('[QUEUE]',_0x34ea('0x49'));_0xf5f2a3['recordingURL']=util[_0x34ea('0xe')](_0x34ea('0x4a'),_0x3f7456[_0x34ea('0x47')],_0xf5f2a3['uniqueid'],md5(_0xf5f2a3[_0x34ea('0x4b')]));}else{_0xf5f2a3['recordingURL']='';}headers[_0x34ea('0x4c')]=getAuth(_0x3f7456);return getUser(_0x3f7456,_0x4384cc[_0x34ea('0x4d')])[_0x34ea('0x17')](function(_0xb8246e){_0x2487bd=_0xb8246e;logger['info'](_0x34ea('0x4e'),_0x2487bd['id']);return getEndUser(_0x3f7456,_0xf5f2a3[_0x34ea('0x4f')],_0xf5f2a3[_0x34ea('0x50')]);})[_0x34ea('0x17')](function(_0x3df3c8){_0x3e2e61=_0x3df3c8;logger[_0x34ea('0xc')](_0x34ea('0x51'),_0x3e2e61['id']);return getTicket(_0x3f7456,_0x2487bd,_0x3e2e61,_0x5d8dc9,_0xf5f2a3);})['then'](function(_0x1059dc){if(_0x1059dc){logger[_0x34ea('0xc')](_0x34ea('0x52'),_0x1059dc['id']);switch(_0x3f7456[_0x34ea('0x3a')]){case _0x34ea('0x53'):logger[_0x34ea('0xc')](_0x34ea('0x54'),_0x34ea('0x55'));return request({'uri':util[_0x34ea('0xe')](_0x34ea('0x56'),_0x3f7456[_0x34ea('0xf')],_0x2487bd['id'],_0x1059dc['id']),'method':_0x34ea('0x10')});case _0x34ea('0x57'):logger['info'](_0x34ea('0x54'),_0x34ea('0x58'));emit(util[_0x34ea('0xe')]('user:%s',_0x4384cc[_0x34ea('0x13')]),'trigger:browser:url',{'uri':util[_0x34ea('0xe')](_0x34ea('0x59'),_0x3f7456['remoteUri'],_0x1059dc['id'])});break;default:logger[_0x34ea('0x5a')](_0x34ea('0x54'),_0x34ea('0x5b'));}}})['catch'](function(_0x50935b){logger[_0x34ea('0x5a')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x50935b,{'showHidden':!![],'depth':null}));});};exports[_0x34ea('0x5c')]=function(_0x4df7bf,_0x3808ee,_0x2e77c7,_0x3918c5,_0x443c98,_0x46e912,_0x3f844f){var _0x41da1a,_0x6a3da3;_0x46e912[_0x34ea('0xf')]=intUtil[_0x34ea('0x48')](_0x46e912[_0x34ea('0xf')]);_0x46e912[_0x34ea('0x47')]=intUtil[_0x34ea('0x48')](_0x46e912[_0x34ea('0x47')]);if(_0x3f844f&&_0x3f844f[_0x34ea('0x5d')]&&_0x3f844f[_0x34ea('0x5d')]!=='none'){logger[_0x34ea('0xc')]('[OUTBOUND]',_0x34ea('0x49'));_0x3808ee[_0x34ea('0x5e')]=util[_0x34ea('0xe')](_0x34ea('0x4a'),_0x46e912[_0x34ea('0x47')],_0x3808ee[_0x34ea('0x4b')],md5(_0x3808ee['uniqueid']));}headers[_0x34ea('0x4c')]=getAuth(_0x46e912);return getUser(_0x46e912,_0x3918c5[_0x34ea('0x4d')])[_0x34ea('0x17')](function(_0x36c5a0){_0x41da1a=_0x36c5a0;logger[_0x34ea('0xc')]('The\x20User\x20ID\x20is:',_0x41da1a['id']);return getEndUser(_0x46e912,_0x3808ee[_0x34ea('0x5f')],_0x3808ee['destcalleridnum']);})['then'](function(_0x54dc5e){_0x6a3da3=_0x54dc5e;logger[_0x34ea('0xc')]('The\x20Enduser\x20ID\x20is:',_0x6a3da3['id']);return getTicket(_0x46e912,_0x41da1a,_0x6a3da3,_0x2e77c7,_0x3808ee);})[_0x34ea('0x17')](function(_0x53aafe){if(_0x53aafe){logger[_0x34ea('0xc')]('The\x20Ticket\x20ID\x20is:',_0x53aafe['id']);switch(_0x46e912[_0x34ea('0x3a')]){case'integrationTab':logger[_0x34ea('0xc')](_0x34ea('0x60'),_0x34ea('0x55'));return request({'uri':util[_0x34ea('0xe')](_0x34ea('0x56'),_0x46e912['remoteUri'],_0x41da1a['id'],_0x53aafe['id']),'method':'POST'});case _0x34ea('0x57'):logger[_0x34ea('0xc')](_0x34ea('0x60'),_0x34ea('0x58'));emit(util[_0x34ea('0xe')](_0x34ea('0x61'),_0x3918c5[_0x34ea('0x13')]),_0x34ea('0x62'),{'uri':util[_0x34ea('0xe')]('%s/agent/tickets/%s',_0x46e912[_0x34ea('0xf')],_0x53aafe['id'])});break;default:logger[_0x34ea('0x5a')](_0x34ea('0x60'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x13e9c1){logger[_0x34ea('0x5a')](_0x34ea('0x63'),util['inspect'](_0x13e9c1,{'showHidden':!![],'depth':null}));});};exports[_0x34ea('0x64')]=function(_0x3fa4cf,_0x38542d,_0x483c71,_0xeb203a,_0x26a73a,_0x4bba99){var _0x1f3978,_0x2cbc92;_0x4bba99[_0x34ea('0xf')]=intUtil['stripTrailingSlash'](_0x4bba99[_0x34ea('0xf')]);_0x4bba99['serverUrl']=intUtil[_0x34ea('0x48')](_0x4bba99[_0x34ea('0x47')]);if(_0x26a73a&&_0x26a73a[_0x34ea('0x65')]){logger[_0x34ea('0xc')]('['+_0x38542d['lastevent'][_0x34ea('0x66')]()+']',_0x34ea('0x49'));_0x38542d['recordingURL']=util[_0x34ea('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bba99[_0x34ea('0x47')],_0x38542d[_0x34ea('0x4b')],md5(_0x38542d[_0x34ea('0x4b')]));}else{_0x38542d['recordingURL']='';}headers[_0x34ea('0x4c')]=getAuth(_0x4bba99);return getUser(_0x4bba99)[_0x34ea('0x17')](function(_0x2cf2c9){_0x1f3978=_0x2cf2c9;logger[_0x34ea('0xc')]('The\x20User\x20ID\x20is:',_0x1f3978['id']);return getEndUser(_0x4bba99,_0x38542d[_0x34ea('0x4f')],_0x38542d[_0x34ea('0x50')]);})[_0x34ea('0x17')](function(_0x405da9){_0x2cbc92=_0x405da9;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2cbc92['id']);return getTicket(_0x4bba99,_0x1f3978,_0x2cbc92,_0x483c71,_0x38542d);})[_0x34ea('0x17')](function(_0x3200f7){if(_0x3200f7){logger['info'](_0x34ea('0x52'),_0x3200f7['id']);}})[_0x34ea('0x67')](function(_0x30a609){logger['error']('['+_0x38542d['lastevent']['toUpperCase']()+']'+_0x34ea('0x68'),util['inspect'](_0x30a609,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xd547=['variable','variableName','custom_fields','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','destcalleridname','destcalleridnum','[OUTBOUND]','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','calleridnum','The\x20Enduser\x20ID\x20is:','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','md5','util','ioredis','./util','zendesk','defaults','localhost','socket.io-emitter','redis','emit','application/json','Creating\x20new\x20ticket...','format','merge','Tags','name','Subjects','Descriptions','Fields','info','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','remoteUri','then','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','%s/search.json','length','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','base64','debug','[HTTP]','stringify','GET','map','forEach','string','customField','nameField','toString','type','idField','content'];(function(_0xbc346f,_0x3db5c0){var _0x9f9260=function(_0x37e6b9){while(--_0x37e6b9){_0xbc346f['push'](_0xbc346f['shift']());}};_0x9f9260(++_0x3db5c0);}(_0xd547,0x1c1));var _0x7d54=function(_0xa84046,_0x456128){_0xa84046=_0xa84046-0x0;var _0x156dae=_0xd547[_0xa84046];return _0x156dae;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x7d54('0x0'));var util=require(_0x7d54('0x1'));var Redis=require(_0x7d54('0x2'));var intUtil=require(_0x7d54('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x7d54('0x4'));config['redis']=_[_0x7d54('0x5')](config['redis'],{'host':_0x7d54('0x6'),'port':0x18eb});var io=require(_0x7d54('0x7'))(new Redis(config[_0x7d54('0x8')]));function emit(_0x5186ae,_0x5b0b16,_0x478f9b){io['to'](_0x5186ae)[_0x7d54('0x9')](_0x5b0b16,_0x478f9b);}var headers={'Content-Type':_0x7d54('0xa'),'Accept':'application/json'};function getTicket(_0xa5b980,_0x48b250,_0x2bede6,_0x4d9dc3,_0x1d7ff7){logger['info'](_0x7d54('0xb'));return request({'uri':util[_0x7d54('0xc')]('%s/tickets.json',_0xa5b980['remoteUri']),'method':'POST','body':{'ticket':_[_0x7d54('0xd')]({'requester_id':_0x2bede6['id'],'submitter_id':_0x48b250?_0x48b250['id']:undefined,'assignee_id':_0x48b250?_0x48b250['id']:undefined,'tags':getTags(_0x4d9dc3[_0x7d54('0xe')],_0x7d54('0xf')),'subject':intUtil['getString'](_0x4d9dc3[_0x7d54('0x10')],_0x1d7ff7,'\x20'),'description':intUtil['getString'](_0x4d9dc3[_0x7d54('0x11')],_0x1d7ff7,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x4d9dc3[_0x7d54('0x11')],_0x1d7ff7,'\x0a')}},getCustomFields(_0x4d9dc3[_0x7d54('0x12')],_0x1d7ff7))}})['then'](function(_0x268b0c){logger[_0x7d54('0x13')](_0x7d54('0x14'));return _0x268b0c['ticket'];});}function getUser(_0x2b1b0f,_0x33a519){if(intUtil[_0x7d54('0x15')](_0x33a519)){logger[_0x7d54('0x13')](_0x7d54('0x16'),_0x33a519);return request({'uri':util[_0x7d54('0xc')]('%s/search.json',_0x2b1b0f[_0x7d54('0x17')]),'qs':{'query':util[_0x7d54('0xc')]('type:user\x20role:agent\x20email:%s',_0x33a519)}})[_0x7d54('0x18')](function(_0x4b9caf){if(_0x4b9caf['count']){logger[_0x7d54('0x13')](_0x7d54('0x19'));return _[_0x7d54('0x1a')](_0x4b9caf[_0x7d54('0x1b')],{'email':_0x33a519,'role':'agent'});}else{logger[_0x7d54('0x13')](_0x7d54('0x1c'));return request({'uri':util['format'](_0x7d54('0x1d'),_0x2b1b0f[_0x7d54('0x17')])})[_0x7d54('0x18')](function(_0x6cc88b){logger[_0x7d54('0x13')](_0x7d54('0x1e'));return _0x6cc88b[_0x7d54('0x1f')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7d54('0x1d'),_0x2b1b0f[_0x7d54('0x17')])})['then'](function(_0xbfa233){logger[_0x7d54('0x13')](_0x7d54('0x1e'));return _0xbfa233[_0x7d54('0x1f')];});}}function getEndUser(_0x3b611f,_0x6d0375,_0x3614aa){logger[_0x7d54('0x13')]('Searching\x20enduser\x20with\x20phone',_0x3614aa);return request({'uri':util[_0x7d54('0xc')](_0x7d54('0x20'),_0x3b611f['remoteUri']),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x3614aa)}})['then'](function(_0x24f2cc){var _0xa4c745;if(_0x24f2cc['results'][_0x7d54('0x21')]){_0x24f2cc[_0x7d54('0x1b')]=_['filter'](_0x24f2cc[_0x7d54('0x1b')],{'suspended':![],'role':_0x7d54('0x22')});if(_0x24f2cc[_0x7d54('0x1b')][_0x7d54('0x21')]){_0xa4c745=_[_0x7d54('0x23')](_0x24f2cc[_0x7d54('0x1b')]);}}if(_0xa4c745){logger[_0x7d54('0x13')](_0x7d54('0x24'));return _0xa4c745;}else{logger['info'](_0x7d54('0x25'));return request({'uri':util['format']('%s/users.json',_0x3b611f[_0x7d54('0x17')]),'method':_0x7d54('0x26'),'body':{'user':{'role':'end-user','name':util[_0x7d54('0xc')](_0x7d54('0x27'),_0x6d0375||_0x3614aa),'phone':_0x3614aa}}})[_0x7d54('0x18')](function(_0x21a01b){logger[_0x7d54('0x13')](_0x7d54('0x28'));return _0x21a01b[_0x7d54('0x1f')];});}});}function getAuth(_0x546604){var _0xa322a1;if(_0x546604[_0x7d54('0x29')]==='password'){_0xa322a1=util[_0x7d54('0xc')](_0x7d54('0x2a'),_0x546604[_0x7d54('0x2b')],_0x546604['password']);}else if(_0x546604[_0x7d54('0x29')]===_0x7d54('0x2c')){_0xa322a1=util[_0x7d54('0xc')](_0x7d54('0x2d'),_0x546604[_0x7d54('0x2b')],_0x546604['token']);}return util[_0x7d54('0xc')](_0x7d54('0x2e'),new Buffer(_0xa322a1)['toString'](_0x7d54('0x2f')));}function request(_0x24b935){logger[_0x7d54('0x30')](_0x7d54('0x31'),JSON[_0x7d54('0x32')](_0x24b935));return rp(_[_0x7d54('0x5')](_0x24b935,{'method':_0x7d54('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x22dcbc,_0x125974){var _0x32b5fa=[];if(_0x22dcbc&&_0x22dcbc[_0x7d54('0x21')]>0x0){_0x32b5fa=_[_0x7d54('0x34')](_0x22dcbc,_0x125974);}return _0x32b5fa;}function getCustomFields(_0x4f637b,_0x4f52e9){var _0x319d36=[];var _0x3c1066={'custom_fields':[]};if(_0x4f637b[_0x7d54('0x21')]>0x0){_[_0x7d54('0x35')](_0x4f637b,function(_0x5a59fd){if(_0x5a59fd['type']===_0x7d54('0x36')&&_0x5a59fd['nameField']&&!_0x5a59fd[_0x7d54('0x37')]){_0x3c1066[_0x5a59fd[_0x7d54('0x38')]['toLowerCase']()]=_0x5a59fd['content'][_0x7d54('0x39')]();}else if(_0x5a59fd[_0x7d54('0x3a')]==='string'&&_0x5a59fd[_0x7d54('0x3b')]&&_0x5a59fd[_0x7d54('0x37')]){_0x3c1066['custom_fields']['push']({'id':_0x5a59fd[_0x7d54('0x3b')],'value':_0x5a59fd[_0x7d54('0x3c')][_0x7d54('0x39')]()});}else if(_0x5a59fd[_0x7d54('0x3a')]===_0x7d54('0x3d')&&_0x5a59fd[_0x7d54('0x3e')]&&_0x5a59fd[_0x7d54('0x3b')]&&_0x5a59fd[_0x7d54('0x37')]){_0x4f52e9[_0x5a59fd[_0x7d54('0x3e')]]&&_0x3c1066[_0x7d54('0x3f')][_0x7d54('0x40')]({'id':_0x5a59fd['idField'],'value':_0x4f52e9[_0x5a59fd['variableName']][_0x7d54('0x39')]()});}else if(_0x5a59fd[_0x7d54('0x3a')]===_0x7d54('0x41')&&_0x5a59fd[_0x7d54('0x42')]&&_0x5a59fd[_0x7d54('0x42')][_0x7d54('0xf')]&&_0x5a59fd[_0x7d54('0x3b')]&&_0x5a59fd['customField']){_0x4f52e9[_0x5a59fd[_0x7d54('0x42')]['name']['toLowerCase']()]&&_0x3c1066[_0x7d54('0x3f')][_0x7d54('0x40')]({'id':_0x5a59fd[_0x7d54('0x3b')],'value':_0x4f52e9[_0x5a59fd[_0x7d54('0x42')][_0x7d54('0xf')]['toLowerCase']()][_0x7d54('0x39')]()});}});}return _0x3c1066;}exports[_0x7d54('0x43')]=function(_0x5a16d7,_0x18ea23,_0x793350,_0x22e0a9,_0x3e7187,_0x163d65){var _0x3d6f39,_0x5a2fcb;_0x163d65[_0x7d54('0x17')]=intUtil[_0x7d54('0x44')](_0x163d65[_0x7d54('0x17')]);_0x163d65[_0x7d54('0x45')]=intUtil[_0x7d54('0x44')](_0x163d65[_0x7d54('0x45')]);if(_0x3e7187&&_0x3e7187[_0x7d54('0x46')]){logger['info'](_0x7d54('0x47'),_0x7d54('0x48'));_0x18ea23[_0x7d54('0x49')]=util[_0x7d54('0xc')](_0x7d54('0x4a'),_0x163d65['serverUrl'],_0x18ea23[_0x7d54('0x4b')],md5(_0x18ea23['uniqueid']));}else{_0x18ea23[_0x7d54('0x49')]='';}headers['Authorization']=getAuth(_0x163d65);return getUser(_0x163d65,_0x22e0a9['email'])[_0x7d54('0x18')](function(_0x59585d){_0x3d6f39=_0x59585d;logger['info'](_0x7d54('0x4c'),_0x3d6f39['id']);return getEndUser(_0x163d65,_0x18ea23[_0x7d54('0x4d')],_0x18ea23['calleridnum']);})[_0x7d54('0x18')](function(_0x1af735){_0x5a2fcb=_0x1af735;logger[_0x7d54('0x13')]('The\x20Enduser\x20ID\x20is:',_0x5a2fcb['id']);return getTicket(_0x163d65,_0x3d6f39,_0x5a2fcb,_0x793350,_0x18ea23);})[_0x7d54('0x18')](function(_0x57bb14){if(_0x57bb14){logger[_0x7d54('0x13')](_0x7d54('0x4e'),_0x57bb14['id']);switch(_0x163d65[_0x7d54('0x3a')]){case _0x7d54('0x4f'):logger['info']('[QUEUE]',_0x7d54('0x50'));return request({'uri':util[_0x7d54('0xc')](_0x7d54('0x51'),_0x163d65[_0x7d54('0x17')],_0x3d6f39['id'],_0x57bb14['id']),'method':_0x7d54('0x26')});case'newTab':logger[_0x7d54('0x13')](_0x7d54('0x47'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7d54('0xc')](_0x7d54('0x52'),_0x22e0a9[_0x7d54('0xf')]),_0x7d54('0x53'),{'uri':util[_0x7d54('0xc')](_0x7d54('0x54'),_0x163d65[_0x7d54('0x17')],_0x57bb14['id'])});break;default:logger[_0x7d54('0x55')]('[QUEUE]',_0x7d54('0x56'));}}})[_0x7d54('0x57')](function(_0x2938ac){logger['error'](_0x7d54('0x58'),util[_0x7d54('0x59')](_0x2938ac,{'showHidden':!![],'depth':null}));});};exports[_0x7d54('0x5a')]=function(_0x1cb1fc,_0x544dd7,_0x3e4d68,_0x238210,_0xe9db27,_0x55ee74,_0x5be8d3){var _0x508c46,_0x5a5bb1;_0x55ee74[_0x7d54('0x17')]=intUtil[_0x7d54('0x44')](_0x55ee74[_0x7d54('0x17')]);_0x55ee74[_0x7d54('0x45')]=intUtil[_0x7d54('0x44')](_0x55ee74['serverUrl']);if(_0x5be8d3&&_0x5be8d3['recordingFormat']&&_0x5be8d3['recordingFormat']!=='none'){logger[_0x7d54('0x13')]('[OUTBOUND]',_0x7d54('0x48'));_0x544dd7['recordingURL']=util[_0x7d54('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x55ee74[_0x7d54('0x45')],_0x544dd7[_0x7d54('0x4b')],md5(_0x544dd7['uniqueid']));}headers['Authorization']=getAuth(_0x55ee74);return getUser(_0x55ee74,_0x238210['email'])[_0x7d54('0x18')](function(_0x37bf9c){_0x508c46=_0x37bf9c;logger['info']('The\x20User\x20ID\x20is:',_0x508c46['id']);return getEndUser(_0x55ee74,_0x544dd7[_0x7d54('0x5b')],_0x544dd7[_0x7d54('0x5c')]);})[_0x7d54('0x18')](function(_0x450336){_0x5a5bb1=_0x450336;logger[_0x7d54('0x13')]('The\x20Enduser\x20ID\x20is:',_0x5a5bb1['id']);return getTicket(_0x55ee74,_0x508c46,_0x5a5bb1,_0x3e4d68,_0x544dd7);})[_0x7d54('0x18')](function(_0x50e69e){if(_0x50e69e){logger['info'](_0x7d54('0x4e'),_0x50e69e['id']);switch(_0x55ee74[_0x7d54('0x3a')]){case _0x7d54('0x4f'):logger[_0x7d54('0x13')](_0x7d54('0x5d'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x55ee74['remoteUri'],_0x508c46['id'],_0x50e69e['id']),'method':_0x7d54('0x26')});case _0x7d54('0x5e'):logger['info'](_0x7d54('0x5d'),_0x7d54('0x5f'));emit(util['format']('user:%s',_0x238210[_0x7d54('0xf')]),_0x7d54('0x53'),{'uri':util[_0x7d54('0xc')](_0x7d54('0x54'),_0x55ee74['remoteUri'],_0x50e69e['id'])});break;default:logger[_0x7d54('0x55')](_0x7d54('0x5d'),_0x7d54('0x56'));}}})[_0x7d54('0x57')](function(_0x151a47){logger[_0x7d54('0x55')](_0x7d54('0x60'),util['inspect'](_0x151a47,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x2e5956,_0x4f32d2,_0x770d4d,_0x37d990,_0xc2b893,_0x1b97da){var _0x3f0bdc,_0x454177;_0x1b97da['remoteUri']=intUtil[_0x7d54('0x44')](_0x1b97da[_0x7d54('0x17')]);_0x1b97da[_0x7d54('0x45')]=intUtil[_0x7d54('0x44')](_0x1b97da[_0x7d54('0x45')]);if(_0xc2b893&&_0xc2b893[_0x7d54('0x46')]){logger[_0x7d54('0x13')]('['+_0x4f32d2[_0x7d54('0x61')]['toUpperCase']()+']',_0x7d54('0x48'));_0x4f32d2[_0x7d54('0x49')]=util['format'](_0x7d54('0x4a'),_0x1b97da[_0x7d54('0x45')],_0x4f32d2['uniqueid'],md5(_0x4f32d2['uniqueid']));}else{_0x4f32d2[_0x7d54('0x49')]='';}headers['Authorization']=getAuth(_0x1b97da);return getUser(_0x1b97da)['then'](function(_0xb70943){_0x3f0bdc=_0xb70943;logger[_0x7d54('0x13')](_0x7d54('0x4c'),_0x3f0bdc['id']);return getEndUser(_0x1b97da,_0x4f32d2[_0x7d54('0x4d')],_0x4f32d2[_0x7d54('0x62')]);})['then'](function(_0x2f8d84){_0x454177=_0x2f8d84;logger[_0x7d54('0x13')](_0x7d54('0x63'),_0x454177['id']);return getTicket(_0x1b97da,_0x3f0bdc,_0x454177,_0x770d4d,_0x4f32d2);})['then'](function(_0x52baf0){if(_0x52baf0){logger['info'](_0x7d54('0x4e'),_0x52baf0['id']);}})['catch'](function(_0x4cd995){logger[_0x7d54('0x55')]('['+_0x4f32d2[_0x7d54('0x61')][_0x7d54('0x64')]()+']'+_0x7d54('0x65'),util[_0x7d54('0x59')](_0x4cd995,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zoho.js b/server/services/ami/trigger/integration/zoho.js index 90423a4..3cf4f22 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 _0xebc0=['moduleSearch','contact_lead','uri','Contacts','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subjects','Description','getString','Descriptions','enduserType','Who_Id','First_Name','Last_Name','What_Id','Full_Name','talktime','utc','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Call_Result','Answered','rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','merge','Fields','/crm/v2/Calls','Call\x20created!','err','log','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','com','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','/api/voice/recordings/','The\x20User\x20ID\x20is:','destcalleridname','Outbound','[OUTBOUND]','user:%s','unmanaged','toUpperCase','zoho.eu','lodash','request-promise','md5','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','debug','[HTTP]','stringify','length','forEach','type','string','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','expires_in','catch','error','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','profile','Administrator','info','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','startCase','role','first_name','last_name','code','SUCCESS','details','moduleCreate','Error:\x20','CREATE\x20ERROR'];(function(_0x2ccbc6,_0x23c853){var _0x68ee2d=function(_0x4ab7b2){while(--_0x4ab7b2){_0x2ccbc6['push'](_0x2ccbc6['shift']());}};_0x68ee2d(++_0x23c853);}(_0xebc0,0xe5));var _0x0ebc=function(_0x44c21e,_0x4519cd){_0x44c21e=_0x44c21e-0x0;var _0x5dd99a=_0xebc0[_0x44c21e];return _0x5dd99a;};'use strict';var _=require(_0x0ebc('0x0'));var rp=require(_0x0ebc('0x1'));var md5=require(_0x0ebc('0x2'));var util=require('util');var intUtil=require(_0x0ebc('0x3'));var moment=require(_0x0ebc('0x4'));var Redis=require(_0x0ebc('0x5'));var BPromise=require(_0x0ebc('0x6'));var config=require(_0x0ebc('0x7'));var logger=require(_0x0ebc('0x8'))(_0x0ebc('0x9'));config['redis']=_['defaults'](config[_0x0ebc('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0ebc('0xa')]));function emit(_0x30d60c,_0x4e301d,_0x5bed1d){io['to'](_0x30d60c)['emit'](_0x4e301d,_0x5bed1d);}function request(_0xf1b94f){logger[_0x0ebc('0xb')](_0x0ebc('0xc'),JSON[_0x0ebc('0xd')](_0xf1b94f));return rp(_0xf1b94f);}function getCustomFields(_0x51d09d,_0x3b34a0){var _0xc67edb={};if(_0x51d09d[_0x0ebc('0xe')]>0x0){_[_0x0ebc('0xf')](_0x51d09d,function(_0x19b875){if(_0x19b875[_0x0ebc('0x10')]===_0x0ebc('0x11')&&_0x19b875[_0x0ebc('0x12')]){_0xc67edb[_0x19b875[_0x0ebc('0x12')]]=_0x19b875[_0x0ebc('0x13')][_0x0ebc('0x14')]();}else if(_0x19b875[_0x0ebc('0x10')]==='variable'&&_0x19b875[_0x0ebc('0x15')]&&_0x19b875[_0x0ebc('0x12')]&&_0x3b34a0[_0x19b875[_0x0ebc('0x15')]]){_0xc67edb[_0x19b875[_0x0ebc('0x12')]]=_0x3b34a0[_0x19b875[_0x0ebc('0x15')]][_0x0ebc('0x14')]();}else if(_0x19b875[_0x0ebc('0x10')]===_0x0ebc('0x16')&&_0x19b875[_0x0ebc('0x17')]&&_0x19b875[_0x0ebc('0x17')][_0x0ebc('0x18')]&&_0x19b875[_0x0ebc('0x12')]&&_0x3b34a0[_0x19b875['Variable'][_0x0ebc('0x18')][_0x0ebc('0x19')]()]){_0xc67edb[_0x19b875[_0x0ebc('0x12')]]=_0x3b34a0[_0x19b875[_0x0ebc('0x17')][_0x0ebc('0x18')]['toLowerCase']()][_0x0ebc('0x14')]();}});}return _0xc67edb;}function getName(_0x7814a){if(_0x7814a[_0x0ebc('0x1a')]('\x20')>0x0){var _0x21c9cb=_0x7814a[_0x0ebc('0x1b')](/ (.+)/);if(_0x21c9cb[0x1]){return _0x21c9cb;}}return[_0x7814a,_0x7814a];}var accountsTokens={};function getAccessToken(_0x44bbe7){return new Promise(function(_0x4d9325,_0x60bd85){if(!_[_0x0ebc('0x1c')](accountsTokens[_0x44bbe7['id']])&&!_[_0x0ebc('0x1c')](accountsTokens[_0x44bbe7['id']][_0x0ebc('0x1d')])){if(moment()['isBefore'](accountsTokens[_0x44bbe7['id']]['expires_in'])){_0x4d9325(accountsTokens[_0x44bbe7['id']][_0x0ebc('0x1d')]);}}var _0x319dc4;switch(_0x44bbe7[_0x0ebc('0x1e')]){case'US':_0x319dc4=_0x0ebc('0x1f');break;case'AU':_0x319dc4=_0x0ebc('0x20');break;case'EU':_0x319dc4=_0x0ebc('0x21');break;case'IN':_0x319dc4=_0x0ebc('0x22');break;case'CN':_0x319dc4=_0x0ebc('0x23');break;default:_0x319dc4='https://accounts.zoho.eu';break;}var _0x33328b={'method':_0x0ebc('0x24'),'uri':_0x319dc4+_0x0ebc('0x25'),'qs':{'refresh_token':_0x44bbe7[_0x0ebc('0x26')],'client_id':_0x44bbe7[_0x0ebc('0x27')],'client_secret':_0x44bbe7[_0x0ebc('0x28')],'grant_type':_0x0ebc('0x29')},'json':!![]};return rp(_0x33328b)[_0x0ebc('0x2a')](function(_0x2682da){accountsTokens[_0x44bbe7['id']]={'access_token':_0x2682da[_0x0ebc('0x1d')],'expires_in':moment()[_0x0ebc('0x2b')](_0x2682da[_0x0ebc('0x2c')],'seconds')};_0x4d9325(_0x2682da[_0x0ebc('0x1d')]);})[_0x0ebc('0x2d')](function(_0x47a7dc){logger[_0x0ebc('0x2e')]('Failing\x20creating\x20the\x20access_token',_0x47a7dc[_0x0ebc('0x2f')]);_0x60bd85(_0x47a7dc);});});}function getUser(_0x5c3be8,_0x422bb8,_0x4b89fc,_0x34e7c0){logger['info'](_0x0ebc('0x30'));return request({'method':_0x0ebc('0x31'),'uri':util[_0x0ebc('0x32')](_0x0ebc('0x33'),_0x422bb8),'qs':{'type':_0x0ebc('0x34')},'headers':{'Authorization':_0x0ebc('0x35')+_0x5c3be8},'json':!![]})[_0x0ebc('0x2a')](function(_0x1f2513){if(_0x1f2513[_0x0ebc('0x36')]){var _0x352e3a=-0x1;if(_['isArrayLikeObject'](_0x1f2513['users'])){if(!_[_0x0ebc('0x1c')](_0x34e7c0)){_0x352e3a=_[_0x0ebc('0x37')](_0x1f2513[_0x0ebc('0x36')],function(_0x5b99bb){return _0x5b99bb[_0x0ebc('0x38')]===_0x34e7c0;});}if(_0x352e3a>=0x0){logger['info']('Agent\x20found!');}else{logger['info']('Using\x20the\x20admin\x20account!');_0x352e3a=_[_0x0ebc('0x37')](_0x1f2513[_0x0ebc('0x36')],function(_0xb34d83){return _0xb34d83[_0x0ebc('0x39')][_0x0ebc('0x18')]===_0x0ebc('0x3a');});}return _0x1f2513[_0x0ebc('0x36')][_0x352e3a];}else{if(_0x1f2513['user']['profile'][_0x0ebc('0x18')]===_0x0ebc('0x3a')){logger[_0x0ebc('0x3b')](_0x0ebc('0x3c'));user=_0x1f2513['user'];return user;}else{logger['error'](_0x0ebc('0x3d'),JSON[_0x0ebc('0xd')](_0x1f2513));throw new Error(_0x0ebc('0x3e')+JSON[_0x0ebc('0xd')](_0x1f2513));}}}else{logger[_0x0ebc('0x2e')](_0x0ebc('0x3d'),JSON[_0x0ebc('0xd')](_0x1f2513));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x0ebc('0xd')](_0x1f2513));}})[_0x0ebc('0x2d')](function(_0x481e53){console['error'](_0x481e53);});}function getZohoUser(_0x156928,_0x2d78f5){return new BPromise(function(_0x1c830d,_0x4624e4){request(_0x156928)[_0x0ebc('0x2a')](function(_0x357cca){var _0x19b0fd=null;if(_0x357cca){_0x19b0fd=_0x357cca[_0x0ebc('0x3f')][0x0];_0x19b0fd['enduserType']=_0x2d78f5;}_0x1c830d(_0x19b0fd);})['catch'](function(_0x4adc5b){_0x4624e4(_0x4adc5b);});});}function createEndUser(_0x570934,_0x59c569,_0x446d4a,_0x3373fd,_0x65fdfd,_0x5b44ba){var _0x446d4a=getName(_0x446d4a);return request({'method':_0x0ebc('0x24'),'uri':_0x0ebc('0x40')+_0x59c569+'/crm/v2/'+_[_0x0ebc('0x41')](_0x5b44ba['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x446d4a[0x1],'First_Name':_0x446d4a[0x0],'Phone':_0x3373fd,'Owner':{'name':!_[_0x0ebc('0x1c')](_0x65fdfd['role']['name'])?_0x65fdfd[_0x0ebc('0x42')]['name']:!_[_0x0ebc('0x1c')](_0x65fdfd[_0x0ebc('0x43')])?_0x65fdfd[_0x0ebc('0x43')]+'\x20'+_0x65fdfd[_0x0ebc('0x44')]:_0x65fdfd[_0x0ebc('0x44')],'id':_0x65fdfd['id']}}]},'headers':{'Authorization':_0x0ebc('0x35')+_0x570934},'json':!![]})['then'](function(_0x3b2aa9){if(_0x3b2aa9&&_0x3b2aa9[_0x0ebc('0x3f')][0x0][_0x0ebc('0x45')]===_0x0ebc('0x46')){var _0x3e703e=_0x3b2aa9[_0x0ebc('0x3f')][0x0][_0x0ebc('0x47')];_0x3e703e['enduserType']=_['startCase'](_0x5b44ba[_0x0ebc('0x48')])+'s';return _0x3e703e;}logger[_0x0ebc('0x2e')](_0x0ebc('0x3d'),JSON[_0x0ebc('0xd')](data));throw new Error(_0x0ebc('0x49')+JSON[_0x0ebc('0xd')](data));})[_0x0ebc('0x2d')](function(_0x45dff9){console['log'](_0x0ebc('0x4a'),_0x45dff9);});}function getEndUser(_0x43450b,_0x3f1eaf,_0x246a85,_0x59a14c,_0x5615f4,_0x5b94fa,_0x13b6b6){var _0x3b6b38={'method':_0x0ebc('0x31'),'uri':'','headers':{'Authorization':_0x0ebc('0x35')+_0x43450b},'json':!![]};switch(_0x13b6b6[_0x0ebc('0x4b')]){case _0x0ebc('0x4c'):_0x3b6b38[_0x0ebc('0x4d')]=_0x0ebc('0x40')+_0x3f1eaf+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x5615f4+'))';return getZohoUser(_0x3b6b38,_0x0ebc('0x4e'))['then'](function(_0x277061){if(_0x277061)return _0x277061;_0x3b6b38[_0x0ebc('0x4d')]=_0x0ebc('0x40')+_0x3f1eaf+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x5615f4+'))';return getZohoUser(_0x3b6b38,_0x0ebc('0x4f'))[_0x0ebc('0x2a')](function(_0x1bfee4){if(_0x1bfee4)return _0x1bfee4;if(_0x13b6b6[_0x0ebc('0x48')]!=_0x0ebc('0x50')){return createEndUser(_0x43450b,_0x3f1eaf,_0x59a14c,_0x5615f4,_0x5b94fa,_0x13b6b6);}else{return{};}});});break;case _0x0ebc('0x51'):_0x3b6b38['uri']=_0x0ebc('0x40')+_0x3f1eaf+_0x0ebc('0x52')+_0x5615f4+'))';return getZohoUser(_0x3b6b38,_0x0ebc('0x4e'))[_0x0ebc('0x2a')](function(_0x5a2d09){if(_0x5a2d09)return _0x5a2d09;if(_0x13b6b6['moduleCreate']!='nothing'){return createEndUser(_0x43450b,_0x3f1eaf,_0x59a14c,_0x5615f4,_0x5b94fa,_0x13b6b6);}else{return{};}});break;case _0x0ebc('0x53'):_0x3b6b38[_0x0ebc('0x4d')]='https://www.zohoapis.'+_0x3f1eaf+_0x0ebc('0x54')+_0x5615f4+'))';return getZohoUser(_0x3b6b38,'Leads')[_0x0ebc('0x2a')](function(_0xdbcf1e){if(_0xdbcf1e)return _0xdbcf1e;if(_0x13b6b6[_0x0ebc('0x48')]!=_0x0ebc('0x50')){return createEndUser(_0x43450b,_0x3f1eaf,_0x59a14c,_0x5615f4,_0x5b94fa,_0x13b6b6);}else{return{};}});break;}}function getCall(_0x49988e,_0x38fd03,_0x3b4d2d,_0x1e84d5,_0x38fb0d,_0x2e64c4,_0x2b3aa4,_0x447e7d){logger[_0x0ebc('0x3b')](_0x0ebc('0x55'));var _0x5b5c77={};_0x5b5c77[_0x0ebc('0x56')]={'name':!_[_0x0ebc('0x1c')](_0x1e84d5[_0x0ebc('0x42')][_0x0ebc('0x18')])&&!_[_0x0ebc('0x1c')](_0x1e84d5[_0x0ebc('0x39')][_0x0ebc('0x18')])&&_0x1e84d5['profile'][_0x0ebc('0x18')]===_0x0ebc('0x57')?_0x1e84d5[_0x0ebc('0x42')][_0x0ebc('0x18')]:!_[_0x0ebc('0x1c')](_0x1e84d5[_0x0ebc('0x43')])?_0x1e84d5[_0x0ebc('0x43')]+'\x20'+_0x1e84d5['last_name']:_0x1e84d5['last_name'],'id':_0x1e84d5['id']};_0x5b5c77['Subject']=intUtil['getString'](_0x2e64c4[_0x0ebc('0x58')],_0x2b3aa4,'\x20');_0x5b5c77[_0x0ebc('0x59')]=intUtil[_0x0ebc('0x5a')](_0x2e64c4[_0x0ebc('0x5b')],_0x2b3aa4,'\x0a');if(_0x38fb0d[_0x0ebc('0x5c')]===_0x0ebc('0x4e')){_0x5b5c77[_0x0ebc('0x5d')]={'name':!_[_0x0ebc('0x1c')](_0x38fb0d['Full_Name'])?_0x38fb0d['Full_Name']:!_[_0x0ebc('0x1c')](_0x38fb0d[_0x0ebc('0x5e')])?_0x38fb0d['First_Name']+'\x20'+_0x38fb0d[_0x0ebc('0x5f')]:_0x38fb0d[_0x0ebc('0x5f')],'id':_0x38fb0d['id']};}if(_0x38fb0d[_0x0ebc('0x5c')]===_0x0ebc('0x4f')){_0x5b5c77[_0x0ebc('0x60')]={'name':!_[_0x0ebc('0x1c')](_0x38fb0d['Full_Name'])?_0x38fb0d[_0x0ebc('0x61')]:!_['isNil'](_0x38fb0d[_0x0ebc('0x5e')])?_0x38fb0d['First_Name']+'\x20'+_0x38fb0d[_0x0ebc('0x5f')]:_0x38fb0d[_0x0ebc('0x5f')],'id':_0x38fb0d['id']};_0x5b5c77['$se_module']=_['startCase'](_0x38fb0d['enduserType']);}if(_0x2b3aa4[_0x0ebc('0x62')]){_0x5b5c77['Call_Duration']=moment[_0x0ebc('0x63')](parseInt(_0x2b3aa4[_0x0ebc('0x62')])*0x3e8)['format'](_0x0ebc('0x64'));}else if(_0x2b3aa4[_0x0ebc('0x65')]&&_0x2b3aa4[_0x0ebc('0x66')]){_0x5b5c77[_0x0ebc('0x67')]=moment[_0x0ebc('0x63')](moment(_0x2b3aa4[_0x0ebc('0x66')],_0x0ebc('0x68'))['diff'](moment(_0x2b3aa4[_0x0ebc('0x69')],_0x0ebc('0x68'))))[_0x0ebc('0x32')](_0x0ebc('0x64'));}switch(_0x2b3aa4[_0x0ebc('0x6a')]){case _0x0ebc('0x6b'):_0x5b5c77[_0x0ebc('0x6c')]='Called';break;case'complete':case'connect':_0x5b5c77[_0x0ebc('0x6c')]=_0x0ebc('0x6d');break;case _0x0ebc('0x6e'):_0x5b5c77[_0x0ebc('0x6c')]='Rejected';break;case'abandoned':_0x5b5c77['Call_Result']=_0x0ebc('0x6f');break;case _0x0ebc('0x70'):_0x5b5c77['Call_Result']=_0x0ebc('0x71');default:}_0x5b5c77[_0x0ebc('0x72')]=(_0x447e7d===_0x0ebc('0x73')?moment(_0x2b3aa4[_0x0ebc('0x69')])[_0x0ebc('0x32')](_0x0ebc('0x68')):moment(_0x2b3aa4['agentcalledAt'])[_0x0ebc('0x32')](_0x0ebc('0x68')))||moment()[_0x0ebc('0x32')](_0x0ebc('0x68'));_0x5b5c77[_0x0ebc('0x74')]=_0x447e7d||'Inbound';_0x5b5c77=_[_0x0ebc('0x75')](_0x5b5c77,getCustomFields(_0x2e64c4[_0x0ebc('0x76')],_0x2b3aa4));return request({'method':_0x0ebc('0x24'),'uri':_0x0ebc('0x40')+_0x38fd03+_0x0ebc('0x77'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x49988e},'body':{'data':[_0x5b5c77]},'json':!![]})[_0x0ebc('0x2a')](function(_0x5ca0be){if(_0x5ca0be&&_0x5ca0be[_0x0ebc('0x3f')][0x0]['code']===_0x0ebc('0x46')){logger['info'](_0x0ebc('0x78'));return{'id':_0x5ca0be[_0x0ebc('0x3f')][0x0]['details']['id']};}})[_0x0ebc('0x2d')](function(_0x30a298){logger['info'](_0x0ebc('0x79'),_0x30a298[_0x0ebc('0x2f')]);console[_0x0ebc('0x7a')](_0x0ebc('0x79'),_0x30a298);});}exports[_0x0ebc('0x7b')]=function(_0x325514,_0x3badaf,_0x5be1ec,_0x20a1ad,_0x44d25d,_0x3af811){var _0x49b38f,_0x170142,_0x13f807;_0x3af811[_0x0ebc('0x7c')]=intUtil[_0x0ebc('0x7d')](_0x3af811[_0x0ebc('0x7c')]);_0x3af811[_0x0ebc('0x7e')]=intUtil[_0x0ebc('0x7d')](_0x3af811[_0x0ebc('0x7e')]);if(_0x44d25d&&_0x44d25d[_0x0ebc('0x7f')]){logger['info'](_0x0ebc('0x80'),_0x0ebc('0x81'));_0x3badaf[_0x0ebc('0x82')]=_0x3af811[_0x0ebc('0x7e')]+'/api/voice/recordings/'+_0x3badaf[_0x0ebc('0x83')]+_0x0ebc('0x84')+md5(_0x3badaf[_0x0ebc('0x83')]);}else{_0x3badaf[_0x0ebc('0x82')]='';}var _0x410997=_0x3af811['host']==='zoho.eu'?'eu':_0x0ebc('0x85');return getAccessToken(_0x3af811)[_0x0ebc('0x2a')](function(_0x51c399){_0x13f807=_0x51c399;return getUser(_0x13f807,_0x410997,_0x3af811,_0x20a1ad[_0x0ebc('0x38')]);})['then'](function(_0x5bc1c9){_0x49b38f=_0x5bc1c9;logger[_0x0ebc('0x3b')]('The\x20User\x20ID\x20is:',_0x49b38f['id']);return getEndUser(_0x13f807,_0x410997,_0x3af811,_0x3badaf[_0x0ebc('0x86')],_0x3badaf[_0x0ebc('0x87')],_0x49b38f,_0x5be1ec);})[_0x0ebc('0x2a')](function(_0x48f8e7){_0x170142=_0x48f8e7;return getCall(_0x13f807,_0x410997,_0x3af811,_0x49b38f,_0x170142,_0x5be1ec,_0x3badaf,_0x0ebc('0x88'));})[_0x0ebc('0x2a')](function(_0x1c7552){if(_0x1c7552){logger[_0x0ebc('0x3b')](_0x0ebc('0x89'),_0x1c7552['id']);logger[_0x0ebc('0x3b')](_0x0ebc('0x80'),_0x0ebc('0x8a'));emit(util[_0x0ebc('0x32')]('user:%s',_0x20a1ad[_0x0ebc('0x18')]),'trigger:browser:url',{'uri':_0x0ebc('0x8b')+_0x3af811[_0x0ebc('0x7c')]+_0x0ebc('0x8c')+_0x1c7552['id']});}})[_0x0ebc('0x2d')](function(_0x1c5ec7){logger[_0x0ebc('0x2e')](_0x0ebc('0x80'),JSON[_0x0ebc('0xd')](_0x1c5ec7));});};exports[_0x0ebc('0x73')]=function(_0x43e927,_0x52e68b,_0x2e3d61,_0x18dd05,_0x204e04,_0x26cf37,_0x3f5f6d){var _0x54bf40,_0x58dd63,_0x25408e;_0x26cf37[_0x0ebc('0x7c')]=intUtil[_0x0ebc('0x7d')](_0x26cf37[_0x0ebc('0x7c')]);_0x26cf37[_0x0ebc('0x7e')]=intUtil[_0x0ebc('0x7d')](_0x26cf37[_0x0ebc('0x7e')]);if(_0x3f5f6d&&_0x3f5f6d[_0x0ebc('0x8d')]&&_0x3f5f6d[_0x0ebc('0x8d')]!==_0x0ebc('0x8e')){logger[_0x0ebc('0x3b')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x52e68b[_0x0ebc('0x82')]=_0x26cf37[_0x0ebc('0x7e')]+_0x0ebc('0x8f')+_0x52e68b[_0x0ebc('0x83')]+_0x0ebc('0x84')+md5(_0x52e68b[_0x0ebc('0x83')]);}var _0x3bc910=_0x26cf37[_0x0ebc('0x7c')]==='zoho.eu'?'eu':_0x0ebc('0x85');return getAccessToken(_0x26cf37)['then'](function(_0x41dae3){_0x25408e=_0x41dae3;return getUser(_0x25408e,_0x3bc910,_0x26cf37,_0x18dd05[_0x0ebc('0x38')]);})['then'](function(_0x133287){_0x54bf40=_0x133287;logger[_0x0ebc('0x3b')](_0x0ebc('0x90'),_0x54bf40['id']);return getEndUser(_0x25408e,_0x3bc910,_0x26cf37,_0x52e68b[_0x0ebc('0x91')],_0x52e68b['destcalleridnum'],_0x54bf40,_0x2e3d61);})['then'](function(_0x1073a3){_0x58dd63=_0x1073a3;return getCall(_0x25408e,_0x3bc910,_0x26cf37,_0x54bf40,_0x58dd63,_0x2e3d61,_0x52e68b,_0x0ebc('0x92'));})[_0x0ebc('0x2a')](function(_0x4cd11a){if(_0x4cd11a){logger[_0x0ebc('0x3b')](_0x0ebc('0x89'),_0x4cd11a['id']);logger['info'](_0x0ebc('0x93'),_0x0ebc('0x8a'));emit(util[_0x0ebc('0x32')](_0x0ebc('0x94'),_0x18dd05[_0x0ebc('0x18')]),'trigger:browser:url',{'uri':'https://crm.'+_0x26cf37['host']+_0x0ebc('0x8c')+_0x4cd11a['id']});}})[_0x0ebc('0x2d')](function(_0x77b65e){logger[_0x0ebc('0x2e')](_0x0ebc('0x93'),JSON[_0x0ebc('0xd')](_0x77b65e));});};exports[_0x0ebc('0x95')]=function(_0x37fe1c,_0x5aa1bf,_0x553932,_0x586941,_0x4e9970,_0x4575c6){var _0x30947e,_0x375c66,_0x17d5d9;_0x4575c6[_0x0ebc('0x7c')]=intUtil[_0x0ebc('0x7d')](_0x4575c6[_0x0ebc('0x7c')]);_0x4575c6[_0x0ebc('0x7e')]=intUtil[_0x0ebc('0x7d')](_0x4575c6['serverUrl']);if(_0x4e9970&&_0x4e9970[_0x0ebc('0x7f')]){logger[_0x0ebc('0x3b')]('['+_0x5aa1bf['lastevent'][_0x0ebc('0x96')]()+']',_0x0ebc('0x81'));_0x5aa1bf[_0x0ebc('0x82')]=_0x4575c6[_0x0ebc('0x7e')]+_0x0ebc('0x8f')+_0x5aa1bf[_0x0ebc('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x5aa1bf['uniqueid']);}else{_0x5aa1bf['recordingURL']='';}var _0x1768f2=_0x4575c6[_0x0ebc('0x7c')]===_0x0ebc('0x97')?'eu':_0x0ebc('0x85');return getAccessToken(_0x4575c6)[_0x0ebc('0x2a')](function(_0x47bb65){_0x17d5d9=_0x47bb65;return getUser(_0x17d5d9,_0x1768f2,_0x4575c6);})[_0x0ebc('0x2a')](function(_0x41b944){_0x30947e=_0x41b944;logger['info'](_0x0ebc('0x90'),_0x30947e['id']);return getEndUser(_0x17d5d9,_0x1768f2,_0x4575c6,_0x5aa1bf[_0x0ebc('0x86')],_0x5aa1bf[_0x0ebc('0x87')],_0x30947e,_0x553932);})['then'](function(_0x4202ad){_0x375c66=_0x4202ad;return getCall(_0x17d5d9,_0x1768f2,_0x4575c6,_0x30947e,_0x375c66,_0x553932,_0x5aa1bf,_0x0ebc('0x88'));})[_0x0ebc('0x2a')](function(_0x239d57){if(_0x239d57){logger['info'](_0x0ebc('0x89'),_0x239d57['id']);}})[_0x0ebc('0x2d')](function(_0x19f946){logger[_0x0ebc('0x2e')]('['+_0x5aa1bf[_0x0ebc('0x6a')][_0x0ebc('0x96')]()+']',JSON[_0x0ebc('0xd')](_0x19f946));});}; \ No newline at end of file +var _0x8caf=['idField','toString','variable','variableName','Variable','name','toLowerCase','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','stack','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','info','Agent\x20found!','profile','user','Administrator','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','error','data','enduserType','POST','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','SUCCESS','details','moduleCreate','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','Leads','nothing','contact','/crm/v2/Leads/search?criteria=((Phone:equals:','Owner','administrator','Subject','Subjects','Description','getString','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','called','Called','complete','connect','Call_Result','Answered','Rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','queue','stripTrailingSlash','host','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]','toUpperCase','calleridnum','request-promise','md5','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','[HTTP]','stringify','length','forEach','type'];(function(_0x3ae516,_0x4b97c5){var _0x2b257a=function(_0x1aa718){while(--_0x1aa718){_0x3ae516['push'](_0x3ae516['shift']());}};_0x2b257a(++_0x4b97c5);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x32665e,_0x12740e){_0x32665e=_0x32665e-0x0;var _0x10be45=_0x8caf[_0x32665e];return _0x10be45;};'use strict';var _=require('lodash');var rp=require(_0xf8ca('0x0'));var md5=require(_0xf8ca('0x1'));var util=require(_0xf8ca('0x2'));var intUtil=require(_0xf8ca('0x3'));var moment=require(_0xf8ca('0x4'));var Redis=require(_0xf8ca('0x5'));var BPromise=require('bluebird');var config=require(_0xf8ca('0x6'));var logger=require(_0xf8ca('0x7'))(_0xf8ca('0x8'));config[_0xf8ca('0x9')]=_[_0xf8ca('0xa')](config[_0xf8ca('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xf8ca('0xb'))(new Redis(config[_0xf8ca('0x9')]));function emit(_0x3a91d3,_0x31300c,_0x5b7eb8){io['to'](_0x3a91d3)['emit'](_0x31300c,_0x5b7eb8);}function request(_0x3a9674){logger['debug'](_0xf8ca('0xc'),JSON[_0xf8ca('0xd')](_0x3a9674));return rp(_0x3a9674);}function getCustomFields(_0x2daa43,_0x2be477){var _0x5c6c83={};if(_0x2daa43[_0xf8ca('0xe')]>0x0){_[_0xf8ca('0xf')](_0x2daa43,function(_0x16e3bb){if(_0x16e3bb[_0xf8ca('0x10')]==='string'&&_0x16e3bb[_0xf8ca('0x11')]){_0x5c6c83[_0x16e3bb[_0xf8ca('0x11')]]=_0x16e3bb['content'][_0xf8ca('0x12')]();}else if(_0x16e3bb[_0xf8ca('0x10')]===_0xf8ca('0x13')&&_0x16e3bb[_0xf8ca('0x14')]&&_0x16e3bb[_0xf8ca('0x11')]&&_0x2be477[_0x16e3bb[_0xf8ca('0x14')]]){_0x5c6c83[_0x16e3bb[_0xf8ca('0x11')]]=_0x2be477[_0x16e3bb[_0xf8ca('0x14')]][_0xf8ca('0x12')]();}else if(_0x16e3bb[_0xf8ca('0x10')]==='customVariable'&&_0x16e3bb[_0xf8ca('0x15')]&&_0x16e3bb[_0xf8ca('0x15')][_0xf8ca('0x16')]&&_0x16e3bb[_0xf8ca('0x11')]&&_0x2be477[_0x16e3bb[_0xf8ca('0x15')][_0xf8ca('0x16')][_0xf8ca('0x17')]()]){_0x5c6c83[_0x16e3bb[_0xf8ca('0x11')]]=_0x2be477[_0x16e3bb['Variable'][_0xf8ca('0x16')][_0xf8ca('0x17')]()][_0xf8ca('0x12')]();}});}return _0x5c6c83;}function getName(_0xda0419){if(_0xda0419['indexOf']('\x20')>0x0){var _0x1b6cf4=_0xda0419[_0xf8ca('0x18')](/ (.+)/);if(_0x1b6cf4[0x1]){return _0x1b6cf4;}}return[_0xda0419,_0xda0419];}var accountsTokens={};function getAccessToken(_0x32308c){return new Promise(function(_0x2ce194,_0x18e8da){if(!_[_0xf8ca('0x19')](accountsTokens[_0x32308c['id']])&&!_['isNil'](accountsTokens[_0x32308c['id']][_0xf8ca('0x1a')])){if(moment()['isBefore'](accountsTokens[_0x32308c['id']][_0xf8ca('0x1b')])){_0x2ce194(accountsTokens[_0x32308c['id']][_0xf8ca('0x1a')]);}}var _0x179a48;switch(_0x32308c[_0xf8ca('0x1c')]){case'US':_0x179a48=_0xf8ca('0x1d');break;case'AU':_0x179a48=_0xf8ca('0x1e');break;case'EU':_0x179a48='https://accounts.zoho.eu';break;case'IN':_0x179a48='https://accounts.zoho.in';break;case'CN':_0x179a48=_0xf8ca('0x1f');break;default:_0x179a48=_0xf8ca('0x20');break;}var _0x4962a5={'method':'POST','uri':_0x179a48+_0xf8ca('0x21'),'qs':{'refresh_token':_0x32308c[_0xf8ca('0x22')],'client_id':_0x32308c[_0xf8ca('0x23')],'client_secret':_0x32308c[_0xf8ca('0x24')],'grant_type':_0xf8ca('0x25')},'json':!![]};return rp(_0x4962a5)[_0xf8ca('0x26')](function(_0x59279d){accountsTokens[_0x32308c['id']]={'access_token':_0x59279d[_0xf8ca('0x1a')],'expires_in':moment()[_0xf8ca('0x27')](_0x59279d[_0xf8ca('0x1b')],_0xf8ca('0x28'))};_0x2ce194(_0x59279d[_0xf8ca('0x1a')]);})[_0xf8ca('0x29')](function(_0x815050){logger['error']('Failing\x20creating\x20the\x20access_token',_0x815050[_0xf8ca('0x2a')]);_0x18e8da(_0x815050);});});}function getUser(_0x873e43,_0x3a2ce4,_0x53b949,_0x1ff6c0){logger['info']('Search\x20user');return request({'method':_0xf8ca('0x2b'),'uri':util[_0xf8ca('0x2c')](_0xf8ca('0x2d'),_0x3a2ce4),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xf8ca('0x2e')+_0x873e43},'json':!![]})[_0xf8ca('0x26')](function(_0x48bbc5){if(_0x48bbc5[_0xf8ca('0x2f')]){var _0x5ab3a6=-0x1;if(_[_0xf8ca('0x30')](_0x48bbc5['users'])){if(!_['isNil'](_0x1ff6c0)){_0x5ab3a6=_[_0xf8ca('0x31')](_0x48bbc5[_0xf8ca('0x2f')],function(_0x22fda1){return _0x22fda1[_0xf8ca('0x32')]===_0x1ff6c0;});}if(_0x5ab3a6>=0x0){logger[_0xf8ca('0x33')](_0xf8ca('0x34'));}else{logger[_0xf8ca('0x33')]('Using\x20the\x20admin\x20account!');_0x5ab3a6=_[_0xf8ca('0x31')](_0x48bbc5[_0xf8ca('0x2f')],function(_0x176a58){return _0x176a58[_0xf8ca('0x35')][_0xf8ca('0x16')]==='Administrator';});}return _0x48bbc5[_0xf8ca('0x2f')][_0x5ab3a6];}else{if(_0x48bbc5[_0xf8ca('0x36')][_0xf8ca('0x35')][_0xf8ca('0x16')]===_0xf8ca('0x37')){logger[_0xf8ca('0x33')](_0xf8ca('0x38'));user=_0x48bbc5[_0xf8ca('0x36')];return user;}else{logger['error'](_0xf8ca('0x39'),JSON[_0xf8ca('0xd')](_0x48bbc5));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xf8ca('0xd')](_0x48bbc5));}}}else{logger[_0xf8ca('0x3a')](_0xf8ca('0x39'),JSON[_0xf8ca('0xd')](_0x48bbc5));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x48bbc5));}})[_0xf8ca('0x29')](function(_0x1645e2){console['error'](_0x1645e2);});}function getZohoUser(_0x4cdaec,_0x4927bc){return new BPromise(function(_0x4a15a0,_0x3d697f){request(_0x4cdaec)[_0xf8ca('0x26')](function(_0x4a47ac){var _0x523904=null;if(_0x4a47ac){_0x523904=_0x4a47ac[_0xf8ca('0x3b')][0x0];_0x523904[_0xf8ca('0x3c')]=_0x4927bc;}_0x4a15a0(_0x523904);})[_0xf8ca('0x29')](function(_0x24ec1f){_0x3d697f(_0x24ec1f);});});}function createEndUser(_0x53ae43,_0xaf283e,_0x578f96,_0x219a0b,_0xdf3d08,_0x4cc29e){var _0x578f96=getName(_0x578f96);return request({'method':_0xf8ca('0x3d'),'uri':_0xf8ca('0x3e')+_0xaf283e+_0xf8ca('0x3f')+_[_0xf8ca('0x40')](_0x4cc29e['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x578f96[0x1],'First_Name':_0x578f96[0x0],'Phone':_0x219a0b,'Owner':{'name':!_[_0xf8ca('0x19')](_0xdf3d08[_0xf8ca('0x41')][_0xf8ca('0x16')])?_0xdf3d08[_0xf8ca('0x41')]['name']:!_[_0xf8ca('0x19')](_0xdf3d08[_0xf8ca('0x42')])?_0xdf3d08[_0xf8ca('0x42')]+'\x20'+_0xdf3d08[_0xf8ca('0x43')]:_0xdf3d08[_0xf8ca('0x43')],'id':_0xdf3d08['id']}}]},'headers':{'Authorization':_0xf8ca('0x2e')+_0x53ae43},'json':!![]})[_0xf8ca('0x26')](function(_0x9d924){if(_0x9d924&&_0x9d924[_0xf8ca('0x3b')][0x0][_0xf8ca('0x44')]===_0xf8ca('0x45')){var _0x5f6b06=_0x9d924[_0xf8ca('0x3b')][0x0][_0xf8ca('0x46')];_0x5f6b06['enduserType']=_[_0xf8ca('0x40')](_0x4cc29e[_0xf8ca('0x47')])+'s';return _0x5f6b06;}logger['error'](_0xf8ca('0x39'),JSON[_0xf8ca('0xd')](data));throw new Error('Error:\x20'+JSON[_0xf8ca('0xd')](data));})['catch'](function(_0x4d651c){console['log'](_0xf8ca('0x48'),_0x4d651c);});}function getEndUser(_0xa5470b,_0x1998f6,_0xd3aa4f,_0x11ff65,_0x322ccb,_0x48a3db,_0x3756cb){var _0x130e62={'method':_0xf8ca('0x2b'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xa5470b},'json':!![]};switch(_0x3756cb[_0xf8ca('0x49')]){case _0xf8ca('0x4a'):_0x130e62['uri']=_0xf8ca('0x3e')+_0x1998f6+_0xf8ca('0x4b')+_0x322ccb+'))';return getZohoUser(_0x130e62,_0xf8ca('0x4c'))[_0xf8ca('0x26')](function(_0x37fd35){if(_0x37fd35)return _0x37fd35;_0x130e62[_0xf8ca('0x4d')]=_0xf8ca('0x3e')+_0x1998f6+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x322ccb+'))';return getZohoUser(_0x130e62,_0xf8ca('0x4e'))[_0xf8ca('0x26')](function(_0x47e4a4){if(_0x47e4a4)return _0x47e4a4;if(_0x3756cb[_0xf8ca('0x47')]!=_0xf8ca('0x4f')){return createEndUser(_0xa5470b,_0x1998f6,_0x11ff65,_0x322ccb,_0x48a3db,_0x3756cb);}else{return{};}});});break;case _0xf8ca('0x50'):_0x130e62[_0xf8ca('0x4d')]=_0xf8ca('0x3e')+_0x1998f6+_0xf8ca('0x4b')+_0x322ccb+'))';return getZohoUser(_0x130e62,_0xf8ca('0x4c'))[_0xf8ca('0x26')](function(_0x3957b5){if(_0x3957b5)return _0x3957b5;if(_0x3756cb['moduleCreate']!=_0xf8ca('0x4f')){return createEndUser(_0xa5470b,_0x1998f6,_0x11ff65,_0x322ccb,_0x48a3db,_0x3756cb);}else{return{};}});break;case'lead':_0x130e62[_0xf8ca('0x4d')]=_0xf8ca('0x3e')+_0x1998f6+_0xf8ca('0x51')+_0x322ccb+'))';return getZohoUser(_0x130e62,_0xf8ca('0x4e'))['then'](function(_0x1b0643){if(_0x1b0643)return _0x1b0643;if(_0x3756cb[_0xf8ca('0x47')]!=_0xf8ca('0x4f')){return createEndUser(_0xa5470b,_0x1998f6,_0x11ff65,_0x322ccb,_0x48a3db,_0x3756cb);}else{return{};}});break;}}function getCall(_0x31685d,_0x45009a,_0x186358,_0xd7381a,_0x2dbd3b,_0x41eacc,_0x272a31,_0x31297f){logger[_0xf8ca('0x33')]('Creating\x20new\x20call...');var _0x5d1fdb={};_0x5d1fdb[_0xf8ca('0x52')]={'name':!_[_0xf8ca('0x19')](_0xd7381a[_0xf8ca('0x41')][_0xf8ca('0x16')])&&!_['isNil'](_0xd7381a[_0xf8ca('0x35')][_0xf8ca('0x16')])&&_0xd7381a[_0xf8ca('0x35')][_0xf8ca('0x16')]===_0xf8ca('0x53')?_0xd7381a[_0xf8ca('0x41')][_0xf8ca('0x16')]:!_[_0xf8ca('0x19')](_0xd7381a['first_name'])?_0xd7381a[_0xf8ca('0x42')]+'\x20'+_0xd7381a[_0xf8ca('0x43')]:_0xd7381a[_0xf8ca('0x43')],'id':_0xd7381a['id']};_0x5d1fdb[_0xf8ca('0x54')]=intUtil['getString'](_0x41eacc[_0xf8ca('0x55')],_0x272a31,'\x20');_0x5d1fdb[_0xf8ca('0x56')]=intUtil[_0xf8ca('0x57')](_0x41eacc[_0xf8ca('0x58')],_0x272a31,'\x0a');if(_0x2dbd3b['enduserType']===_0xf8ca('0x4c')){_0x5d1fdb['Who_Id']={'name':!_[_0xf8ca('0x19')](_0x2dbd3b[_0xf8ca('0x59')])?_0x2dbd3b[_0xf8ca('0x59')]:!_['isNil'](_0x2dbd3b[_0xf8ca('0x5a')])?_0x2dbd3b[_0xf8ca('0x5a')]+'\x20'+_0x2dbd3b[_0xf8ca('0x5b')]:_0x2dbd3b[_0xf8ca('0x5b')],'id':_0x2dbd3b['id']};}if(_0x2dbd3b[_0xf8ca('0x3c')]===_0xf8ca('0x4e')){_0x5d1fdb[_0xf8ca('0x5c')]={'name':!_[_0xf8ca('0x19')](_0x2dbd3b[_0xf8ca('0x59')])?_0x2dbd3b['Full_Name']:!_[_0xf8ca('0x19')](_0x2dbd3b[_0xf8ca('0x5a')])?_0x2dbd3b[_0xf8ca('0x5a')]+'\x20'+_0x2dbd3b[_0xf8ca('0x5b')]:_0x2dbd3b[_0xf8ca('0x5b')],'id':_0x2dbd3b['id']};_0x5d1fdb[_0xf8ca('0x5d')]=_[_0xf8ca('0x40')](_0x2dbd3b[_0xf8ca('0x3c')]);}if(_0x272a31[_0xf8ca('0x5e')]){_0x5d1fdb[_0xf8ca('0x5f')]=moment[_0xf8ca('0x60')](parseInt(_0x272a31['talktime'])*0x3e8)[_0xf8ca('0x2c')](_0xf8ca('0x61'));}else if(_0x272a31[_0xf8ca('0x62')]&&_0x272a31[_0xf8ca('0x63')]){_0x5d1fdb[_0xf8ca('0x5f')]=moment[_0xf8ca('0x60')](moment(_0x272a31[_0xf8ca('0x63')],_0xf8ca('0x64'))['diff'](moment(_0x272a31[_0xf8ca('0x65')],_0xf8ca('0x64'))))[_0xf8ca('0x2c')](_0xf8ca('0x61'));}switch(_0x272a31[_0xf8ca('0x66')]){case _0xf8ca('0x67'):_0x5d1fdb['Call_Result']=_0xf8ca('0x68');break;case _0xf8ca('0x69'):case _0xf8ca('0x6a'):_0x5d1fdb[_0xf8ca('0x6b')]=_0xf8ca('0x6c');break;case'rejected':_0x5d1fdb[_0xf8ca('0x6b')]=_0xf8ca('0x6d');break;case _0xf8ca('0x6e'):_0x5d1fdb[_0xf8ca('0x6b')]='Abandoned';break;case _0xf8ca('0x6f'):_0x5d1fdb['Call_Result']=_0xf8ca('0x70');default:}_0x5d1fdb[_0xf8ca('0x71')]=(_0x31297f===_0xf8ca('0x72')?moment(_0x272a31[_0xf8ca('0x65')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x272a31['agentcalledAt'])[_0xf8ca('0x2c')](_0xf8ca('0x64')))||moment()[_0xf8ca('0x2c')](_0xf8ca('0x64'));_0x5d1fdb[_0xf8ca('0x73')]=_0x31297f||_0xf8ca('0x74');_0x5d1fdb=_[_0xf8ca('0x75')](_0x5d1fdb,getCustomFields(_0x41eacc['Fields'],_0x272a31));return request({'method':_0xf8ca('0x3d'),'uri':_0xf8ca('0x3e')+_0x45009a+_0xf8ca('0x76'),'headers':{'Authorization':_0xf8ca('0x2e')+_0x31685d},'body':{'data':[_0x5d1fdb]},'json':!![]})[_0xf8ca('0x26')](function(_0x1d0a6f){if(_0x1d0a6f&&_0x1d0a6f[_0xf8ca('0x3b')][0x0]['code']===_0xf8ca('0x45')){logger[_0xf8ca('0x33')](_0xf8ca('0x77'));return{'id':_0x1d0a6f[_0xf8ca('0x3b')][0x0][_0xf8ca('0x46')]['id']};}})[_0xf8ca('0x29')](function(_0x3779f2){logger[_0xf8ca('0x33')]('err',_0x3779f2[_0xf8ca('0x2a')]);console['log'](_0xf8ca('0x78'),_0x3779f2);});}exports[_0xf8ca('0x79')]=function(_0x5c39c8,_0x1285ee,_0xa00768,_0x4c514f,_0xa7141e,_0x48e527){var _0x5a2cf1,_0x5ba366,_0x50a4d6;_0x48e527['host']=intUtil[_0xf8ca('0x7a')](_0x48e527[_0xf8ca('0x7b')]);_0x48e527[_0xf8ca('0x7c')]=intUtil[_0xf8ca('0x7a')](_0x48e527[_0xf8ca('0x7c')]);if(_0xa7141e&&_0xa7141e[_0xf8ca('0x7d')]){logger[_0xf8ca('0x33')](_0xf8ca('0x7e'),'Recording\x20is\x20enabled!');_0x1285ee[_0xf8ca('0x7f')]=_0x48e527[_0xf8ca('0x7c')]+_0xf8ca('0x80')+_0x1285ee[_0xf8ca('0x81')]+_0xf8ca('0x82')+md5(_0x1285ee[_0xf8ca('0x81')]);}else{_0x1285ee[_0xf8ca('0x7f')]='';}var _0x541294=_0x48e527[_0xf8ca('0x7b')]===_0xf8ca('0x83')?'eu':_0xf8ca('0x84');return getAccessToken(_0x48e527)[_0xf8ca('0x26')](function(_0x213ef0){_0x50a4d6=_0x213ef0;return getUser(_0x50a4d6,_0x541294,_0x48e527,_0x4c514f[_0xf8ca('0x32')]);})[_0xf8ca('0x26')](function(_0x5aff25){_0x5a2cf1=_0x5aff25;logger['info'](_0xf8ca('0x85'),_0x5a2cf1['id']);return getEndUser(_0x50a4d6,_0x541294,_0x48e527,_0x1285ee[_0xf8ca('0x86')],_0x1285ee['calleridnum'],_0x5a2cf1,_0xa00768);})['then'](function(_0x26ae7e){_0x5ba366=_0x26ae7e;return getCall(_0x50a4d6,_0x541294,_0x48e527,_0x5a2cf1,_0x5ba366,_0xa00768,_0x1285ee,_0xf8ca('0x74'));})[_0xf8ca('0x26')](function(_0x5351de){if(_0x5351de){logger['info'](_0xf8ca('0x87'),_0x5351de['id']);logger['info'](_0xf8ca('0x7e'),_0xf8ca('0x88'));emit(util[_0xf8ca('0x2c')](_0xf8ca('0x89'),_0x4c514f[_0xf8ca('0x16')]),_0xf8ca('0x8a'),{'uri':_0xf8ca('0x8b')+_0x48e527[_0xf8ca('0x7b')]+_0xf8ca('0x8c')+_0x5351de['id']});}})[_0xf8ca('0x29')](function(_0x4eb918){logger[_0xf8ca('0x3a')](_0xf8ca('0x7e'),JSON[_0xf8ca('0xd')](_0x4eb918));});};exports[_0xf8ca('0x72')]=function(_0x4c71b0,_0x44f1f7,_0x2c3e0b,_0x3ff65e,_0x3704ed,_0x718411,_0x206804){var _0x361084,_0x153b1d,_0x37f705;_0x718411[_0xf8ca('0x7b')]=intUtil[_0xf8ca('0x7a')](_0x718411['host']);_0x718411[_0xf8ca('0x7c')]=intUtil[_0xf8ca('0x7a')](_0x718411[_0xf8ca('0x7c')]);if(_0x206804&&_0x206804[_0xf8ca('0x8d')]&&_0x206804[_0xf8ca('0x8d')]!=='none'){logger['info']('[OUTBOUND]',_0xf8ca('0x8e'));_0x44f1f7[_0xf8ca('0x7f')]=_0x718411[_0xf8ca('0x7c')]+'/api/voice/recordings/'+_0x44f1f7[_0xf8ca('0x81')]+_0xf8ca('0x82')+md5(_0x44f1f7[_0xf8ca('0x81')]);}var _0x2f79fc=_0x718411[_0xf8ca('0x7b')]==='zoho.eu'?'eu':_0xf8ca('0x84');return getAccessToken(_0x718411)[_0xf8ca('0x26')](function(_0x52534f){_0x37f705=_0x52534f;return getUser(_0x37f705,_0x2f79fc,_0x718411,_0x3ff65e['email']);})[_0xf8ca('0x26')](function(_0x1cba2c){_0x361084=_0x1cba2c;logger[_0xf8ca('0x33')]('The\x20User\x20ID\x20is:',_0x361084['id']);return getEndUser(_0x37f705,_0x2f79fc,_0x718411,_0x44f1f7[_0xf8ca('0x8f')],_0x44f1f7[_0xf8ca('0x90')],_0x361084,_0x2c3e0b);})[_0xf8ca('0x26')](function(_0x553c21){_0x153b1d=_0x553c21;return getCall(_0x37f705,_0x2f79fc,_0x718411,_0x361084,_0x153b1d,_0x2c3e0b,_0x44f1f7,'Outbound');})[_0xf8ca('0x26')](function(_0x227c37){if(_0x227c37){logger['info'](_0xf8ca('0x87'),_0x227c37['id']);logger[_0xf8ca('0x33')](_0xf8ca('0x91'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf8ca('0x2c')](_0xf8ca('0x89'),_0x3ff65e[_0xf8ca('0x16')]),_0xf8ca('0x8a'),{'uri':_0xf8ca('0x8b')+_0x718411[_0xf8ca('0x7b')]+_0xf8ca('0x8c')+_0x227c37['id']});}})[_0xf8ca('0x29')](function(_0x159219){logger['error'](_0xf8ca('0x91'),JSON[_0xf8ca('0xd')](_0x159219));});};exports['unmanaged']=function(_0x5cef15,_0x4429f4,_0x58d0a3,_0x419122,_0x6ee6f,_0x5d6699){var _0x35177b,_0x1d6287,_0x35e603;_0x5d6699[_0xf8ca('0x7b')]=intUtil[_0xf8ca('0x7a')](_0x5d6699[_0xf8ca('0x7b')]);_0x5d6699[_0xf8ca('0x7c')]=intUtil['stripTrailingSlash'](_0x5d6699[_0xf8ca('0x7c')]);if(_0x6ee6f&&_0x6ee6f['monitor_format']){logger[_0xf8ca('0x33')]('['+_0x4429f4['lastevent'][_0xf8ca('0x92')]()+']','Recording\x20is\x20enabled!');_0x4429f4[_0xf8ca('0x7f')]=_0x5d6699[_0xf8ca('0x7c')]+_0xf8ca('0x80')+_0x4429f4[_0xf8ca('0x81')]+_0xf8ca('0x82')+md5(_0x4429f4[_0xf8ca('0x81')]);}else{_0x4429f4[_0xf8ca('0x7f')]='';}var _0x423bb3=_0x5d6699[_0xf8ca('0x7b')]===_0xf8ca('0x83')?'eu':_0xf8ca('0x84');return getAccessToken(_0x5d6699)[_0xf8ca('0x26')](function(_0x153d8c){_0x35e603=_0x153d8c;return getUser(_0x35e603,_0x423bb3,_0x5d6699);})[_0xf8ca('0x26')](function(_0x2cdc2b){_0x35177b=_0x2cdc2b;logger[_0xf8ca('0x33')]('The\x20User\x20ID\x20is:',_0x35177b['id']);return getEndUser(_0x35e603,_0x423bb3,_0x5d6699,_0x4429f4[_0xf8ca('0x86')],_0x4429f4[_0xf8ca('0x93')],_0x35177b,_0x58d0a3);})[_0xf8ca('0x26')](function(_0x2a5319){_0x1d6287=_0x2a5319;return getCall(_0x35e603,_0x423bb3,_0x5d6699,_0x35177b,_0x1d6287,_0x58d0a3,_0x4429f4,_0xf8ca('0x74'));})['then'](function(_0x5b3fec){if(_0x5b3fec){logger[_0xf8ca('0x33')]('The\x20Call\x20ID\x20is:',_0x5b3fec['id']);}})[_0xf8ca('0x29')](function(_0xa14a9c){logger[_0xf8ca('0x3a')]('['+_0x4429f4[_0xf8ca('0x66')][_0xf8ca('0x92')]()+']',JSON['stringify'](_0xa14a9c));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/script/index.js b/server/services/ami/trigger/script/index.js index ded814f..edfab4d 100644 --- a/server/services/ami/trigger/script/index.js +++ b/server/services/ami/trigger/script/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x4d267d,_0x225aa4){var _0x20fc65=function(_0x3b9da4){while(--_0x3b9da4){_0x4d267d['push'](_0x4d267d['shift']());}};_0x20fc65(++_0x225aa4);}(_0x7a54,0x106));var _0x47a5=function(_0xdf1aec,_0x1a18f7){_0xdf1aec=_0xdf1aec-0x0;var _0x2af8a7=_0x7a54[_0xdf1aec];return _0x2af8a7;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file +var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x3204dd,_0x476dd8){var _0x1861cf=function(_0x388812){while(--_0x388812){_0x3204dd['push'](_0x3204dd['shift']());}};_0x1861cf(++_0x476dd8);}(_0x7a54,0x106));var _0x47a5=function(_0xae71a1,_0x182b6b){_0xae71a1=_0xae71a1-0x0;var _0x127ebe=_0x7a54[_0xae71a1];return _0x127ebe;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/urlforward/index.js b/server/services/ami/trigger/urlforward/index.js index 5781c1a..e8313e3 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x60a336,_0x2c7f49){var _0x58533d=function(_0x2c2ccc){while(--_0x2c2ccc){_0x60a336['push'](_0x60a336['shift']());}};_0x58533d(++_0x2c7f49);}(_0xb10b,0x12a));var _0xbb10=function(_0x16b672,_0x29071e){_0x16b672=_0x16b672-0x0;var _0x2d69d2=_0xb10b[_0x16b672];return _0x2d69d2;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file +var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x31f973,_0x1f4d1b){var _0x4d1758=function(_0xbf336b){while(--_0xbf336b){_0x31f973['push'](_0x31f973['shift']());}};_0x4d1758(++_0x1f4d1b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x35296f,_0x38d28e){_0x35296f=_0x35296f-0x0;var _0x9f6288=_0x5f2f[_0x35296f];return _0x9f6288;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index d2d3123..d50bfe9 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 _0xc997=['http','request','then','debug','error','result','rpc','exports','bluebird','../../config/logger','routing','client'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0xc997,0x1ac));var _0x7c99=function(_0x2a5179,_0x1a9f4b){_0x2a5179=_0x2a5179-0x0;var _0x437c38=_0xc997[_0x2a5179];return _0x437c38;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x7c99('0x0'));var logger=require(_0x7c99('0x1'))(_0x7c99('0x2'));var client=jayson[_0x7c99('0x3')][_0x7c99('0x4')]({'port':0x2329});client['Request']=function(_0x2226d5,_0x114fe0){return new BPromise(function(_0x705244,_0xbc4d70){return client[_0x7c99('0x5')](_0x2226d5,_0x114fe0)[_0x7c99('0x6')](function(_0x1a21e1){logger[_0x7c99('0x7')]('rpc',_0x7c99('0x2'),_0x2226d5,_0x114fe0,_0x1a21e1);if(_0x1a21e1[_0x7c99('0x8')]){logger[_0x7c99('0x8')]('rpc',_0x7c99('0x2'),_0x2226d5,_0x1a21e1[_0x7c99('0x8')]['message'],_0x114fe0);return _0xbc4d70(_0x1a21e1[_0x7c99('0x8')]['message']);}else{return _0x705244(_0x1a21e1[_0x7c99('0x9')]);}})['catch'](function(_0x4cbf9f){logger[_0x7c99('0x8')](_0x7c99('0xa'),_0x7c99('0x2'),_0x2226d5,_0x4cbf9f,_0x114fe0);return _0xbc4d70(_0x4cbf9f);});});};module[_0x7c99('0xb')]=client; \ No newline at end of file +var _0x8819=['then','rpc','error','message','result','../../config/logger','routing','client','http','Request','request'];(function(_0x43c3f9,_0x1861cb){var _0x4f4f54=function(_0x53ac81){while(--_0x53ac81){_0x43c3f9['push'](_0x43c3f9['shift']());}};_0x4f4f54(++_0x1861cb);}(_0x8819,0x94));var _0x9881=function(_0x227244,_0x58bfad){_0x227244=_0x227244-0x0;var _0x31b2ab=_0x8819[_0x227244];return _0x31b2ab;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x9881('0x0'))(_0x9881('0x1'));var client=jayson[_0x9881('0x2')][_0x9881('0x3')]({'port':0x2329});client[_0x9881('0x4')]=function(_0x5e52c5,_0x333d6f){return new BPromise(function(_0x446deb,_0xf41442){return client[_0x9881('0x5')](_0x5e52c5,_0x333d6f)[_0x9881('0x6')](function(_0x2a3664){logger['debug'](_0x9881('0x7'),'routing',_0x5e52c5,_0x333d6f,_0x2a3664);if(_0x2a3664['error']){logger[_0x9881('0x8')]('rpc','routing',_0x5e52c5,_0x2a3664[_0x9881('0x8')]['message'],_0x333d6f);return _0xf41442(_0x2a3664[_0x9881('0x8')][_0x9881('0x9')]);}else{return _0x446deb(_0x2a3664[_0x9881('0xa')]);}})['catch'](function(_0x1df0ba){logger[_0x9881('0x8')](_0x9881('0x7'),_0x9881('0x1'),_0x5e52c5,_0x1df0ba,_0x333d6f);return _0xf41442(_0x1df0ba);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 8059d9d..8dd6bd3 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 _0x444e=['initMailAccounts','refresh','mailAccounts','Setting','findOne','loginMailFrequency','catch','log','bluebird','./realtime','./rpc/mailAccount','resolve','getMailAccounts','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x444e,0xe8));var _0xe444=function(_0x5ca86c,_0x4076c3){_0x5ca86c=_0x5ca86c-0x0;var _0x2eed50=_0x444e[_0x5ca86c];return _0x2eed50;};'use strict';var BPromise=require(_0xe444('0x0'));var server=require('./server');var Realtime=require(_0xe444('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xe444('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise[_0xe444('0x3')]()['then'](mailAccount[_0xe444('0x4')]())[_0xe444('0x5')](realtime[_0xe444('0x6')]())[_0xe444('0x5')](function(){email[_0xe444('0x7')](realtime[_0xe444('0x8')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xe444('0x5')](function(_0x4b5b7d){return initRealtime();})[_0xe444('0x5')](function(_0x482b98){return db[_0xe444('0x9')][_0xe444('0xa')]({'attributes':['id',_0xe444('0xb')],'raw':!![]});})['then'](function(_0x55697b){return setInterval(initRealtime,_0x55697b[_0xe444('0xb')]*0x3e8);})[_0xe444('0xc')](function(_0x5e53cb){console[_0xe444('0xd')](_0x5e53cb);});}main(); \ No newline at end of file +var _0xf2ca=['./realtime','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','refresh','mailAccounts','listen','Setting','loginMailFrequency','catch','bluebird','./server'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x415f7e,_0x4630b6){_0x415f7e=_0x415f7e-0x0;var _0x311ff4=_0xf2ca[_0x415f7e];return _0x311ff4;};'use strict';var BPromise=require(_0xaf2c('0x0'));var server=require(_0xaf2c('0x1'));var Realtime=require(_0xaf2c('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xaf2c('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xaf2c('0x4'))['db'];function initRealtime(){return BPromise[_0xaf2c('0x5')]()[_0xaf2c('0x6')](mailAccount[_0xaf2c('0x7')]())[_0xaf2c('0x6')](realtime['initMailAccounts']())[_0xaf2c('0x6')](function(){email[_0xaf2c('0x8')](realtime[_0xaf2c('0x9')]);return realtime;});}function main(){return server[_0xaf2c('0xa')](realtime,email)['then'](function(_0x37fedd){return initRealtime();})[_0xaf2c('0x6')](function(_0x4a7397){return db[_0xaf2c('0xb')]['findOne']({'attributes':['id',_0xaf2c('0xc')],'raw':!![]});})['then'](function(_0x2f5099){return setInterval(initRealtime,_0x2f5099[_0xaf2c('0xc')]*0x3e8);})[_0xaf2c('0xd')](function(_0xd891e9){console['log'](_0xd891e9);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 5431bc6..699e1ef 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 _0x983c=['bluebird','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','Imap','messageStatus','total','stringify','md5','mailAccount:update','active','hasOwnProperty','email','box','handleImapBox','bind','end','handleImapEnd','error','handleImapError','isNil','status','disabled','connected','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','send','verifySmtp','Smtp','verify','exports','lodash','moment'];(function(_0x32d0fb,_0x16bc3e){var _0x124125=function(_0x1d3e50){while(--_0x1d3e50){_0x32d0fb['push'](_0x32d0fb['shift']());}};_0x124125(++_0x16bc3e);}(_0x983c,0x13c));var _0xc983=function(_0x207811,_0x3420a6){_0x207811=_0x207811-0x0;var _0x170d56=_0x983c[_0x207811];return _0x170d56;};'use strict';var _=require(_0xc983('0x0'));var moment=require(_0xc983('0x1'));var BPromise=require(_0xc983('0x2'));var md5=require('md5');var Redis=require(_0xc983('0x3'));var config=require(_0xc983('0x4'));var logger=require('../../../config/logger')('email');config['redis']=_[_0xc983('0x5')](config[_0xc983('0x6')],{'host':_0xc983('0x7'),'port':0x18eb});var io=require(_0xc983('0x8'))(new Redis(config['redis']));var EmailImap=require(_0xc983('0x9'));var EmailSmtp=require(_0xc983('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x2728b2){logger[_0xc983('0xb')](_0xc983('0xc'));this['mailAccounts']=_0x2728b2[_0xc983('0xd')];this[_0xc983('0xe')]={};this[_0xc983('0xf')]=new EmailSmtp();}EmailChannel[_0xc983('0x10')][_0xc983('0x11')]=function(_0x3d8a17){var _0x1221df=this[_0xc983('0xd')][_0x3d8a17];var _0x3887be={'id':_0x1221df['id'],'name':_0x1221df[_0xc983('0x12')],'key':_0x1221df['key'],'active':_0x1221df['active'],'Imap':{'status':_0x1221df['Imap']['status'],'messageStatus':_0x1221df[_0xc983('0x13')][_0xc983('0x14')],'total':_0x1221df[_0xc983('0x13')][_0xc983('0x15')]}};if(_['isNil'](md5Accounts[_0x3d8a17])){md5Accounts[_0x3d8a17]={};}var _0x52c880=md5(JSON[_0xc983('0x16')](_0x3887be));if(md5Accounts[_0x3d8a17][_0xc983('0x17')]!==_0x52c880){md5Accounts[_0x3d8a17][_0xc983('0x17')]=_0x52c880;io[_0xc983('0x11')](_0xc983('0x18'),_0x3887be);}};EmailChannel[_0xc983('0x10')]['refresh']=function(_0x3413f7){for(var _0x2fc6f0 in _0x3413f7){if(_0x3413f7['hasOwnProperty'](_0x2fc6f0)){if(_0x3413f7[_0x2fc6f0][_0xc983('0x13')]&&_0x3413f7[_0x2fc6f0][_0xc983('0x19')]){var _0x249324=_0x3413f7[_0x2fc6f0][_0xc983('0x13')];if(!this[_0xc983('0xe')][_0xc983('0x1a')](_0x249324['id'])){this[_0xc983('0xe')][_0x249324['id']]=new EmailImap(_0x249324,_0x3413f7[_0x2fc6f0][_0xc983('0x1b')]);this[_0xc983('0xe')][_0x249324['id']]['on'](_0xc983('0x1c'),this[_0xc983('0x1d')][_0xc983('0x1e')](this,_0x2fc6f0));this[_0xc983('0xe')][_0x249324['id']]['on']('email',this['handleImapEmail'][_0xc983('0x1e')](this,_0x2fc6f0));this['imapAccounts'][_0x249324['id']]['on'](_0xc983('0x1f'),this[_0xc983('0x20')]['bind'](this,_0x2fc6f0));this['imapAccounts'][_0x249324['id']]['on'](_0xc983('0x21'),this[_0xc983('0x22')][_0xc983('0x1e')](this,_0x2fc6f0));}}else{if(_[_0xc983('0x23')](this[_0xc983('0xd')][_0x2fc6f0][_0xc983('0x13')])){this[_0xc983('0xd')][_0x2fc6f0][_0xc983('0x13')]={};}this['mailAccounts'][_0x2fc6f0][_0xc983('0x13')][_0xc983('0x24')]=_0xc983('0x25');this['mailAccounts'][_0x2fc6f0]['Imap'][_0xc983('0x14')]='';this[_0xc983('0x11')](_0x2fc6f0);}}}};EmailChannel[_0xc983('0x10')][_0xc983('0x1d')]=function(_0x5eeeb2,_0x1a7c2d){if(this[_0xc983('0xd')][_0x5eeeb2]){this[_0xc983('0xd')][_0x5eeeb2][_0xc983('0x13')][_0xc983('0x24')]=_0xc983('0x26');this[_0xc983('0xd')][_0x5eeeb2]['Imap'][_0xc983('0x14')]=_0x1a7c2d[_0xc983('0x12')];if(_0x1a7c2d[_0xc983('0x27')]){this[_0xc983('0xd')][_0x5eeeb2][_0xc983('0x13')][_0xc983('0x15')]=_0x1a7c2d[_0xc983('0x27')]['total'];}return this[_0xc983('0x11')](_0x5eeeb2);}};EmailChannel[_0xc983('0x10')][_0xc983('0x28')]=function(_0x385182,_0x508981){logger['info'](_0xc983('0x29'),_0x508981[_0xc983('0x2a')],_0x508981['lastName'],_0x508981['from'],_0x385182);if(this['mailAccounts'][_0x385182]){return mailAccount['notify'](_0x385182,_0x508981)[_0xc983('0x2b')](function(_0x379193){if(_0x379193){logger[_0xc983('0xb')](_0xc983('0x2c'));}})[_0xc983('0x2d')](function(_0x4a0326){logger[_0xc983('0x21')](_0xc983('0x2e'),JSON['stringify'](_0x4a0326));});}};EmailChannel['prototype'][_0xc983('0x20')]=function(_0x2b439f){if(this['mailAccounts'][_0x2b439f]&&this['mailAccounts'][_0x2b439f][_0xc983('0x13')]){if(this[_0xc983('0xe')][this['mailAccounts'][_0x2b439f]['Imap']['id']]){delete this['imapAccounts'][this['mailAccounts'][_0x2b439f]['Imap']['id']];}this[_0xc983('0xd')][_0x2b439f]['Imap'][_0xc983('0x2f')]=moment();this[_0xc983('0x11')](_0x2b439f);}};EmailChannel[_0xc983('0x10')][_0xc983('0x22')]=function(_0x2ba095,_0x5249dd){if(this[_0xc983('0xd')][_0x2ba095]){this[_0xc983('0xd')][_0x2ba095][_0xc983('0x13')][_0xc983('0x24')]=_0xc983('0x21');this[_0xc983('0xd')][_0x2ba095][_0xc983('0x13')]['messageStatus']=_0x5249dd;return this['emit'](_0x2ba095);}};EmailChannel['prototype']['sendMail']=function(_0x1d0a4b,_0x5f1ffa){return this[_0xc983('0xf')][_0xc983('0x30')](_0x1d0a4b,_0x5f1ffa);};EmailChannel[_0xc983('0x10')][_0xc983('0x31')]=function(_0x5e0c0c){var _0x18a89c=this;if(this[_0xc983('0xd')][_0x5e0c0c['id']]){if(_[_0xc983('0x23')](this[_0xc983('0xd')][_0x5e0c0c['id']][_0xc983('0x32')])){this[_0xc983('0xd')][_0x5e0c0c['id']][_0xc983('0x32')]={};}this[_0xc983('0xd')][_0x5e0c0c['id']][_0xc983('0x32')][_0xc983('0x2f')]=moment();return new BPromise(function(_0x2b8a35,_0xc15b42){return _0x18a89c[_0xc983('0xf')][_0xc983('0x33')](_0x5e0c0c)[_0xc983('0x2b')](function(_0x2c95bf){_0x18a89c['mailAccounts'][_0x5e0c0c['id']]['Smtp'][_0xc983('0x24')]='verified';_0x18a89c[_0xc983('0xd')][_0x5e0c0c['id']][_0xc983('0x32')][_0xc983('0x14')]='';_0x18a89c[_0xc983('0x11')](_0x5e0c0c['id']);_0x2b8a35(_0x2c95bf);})[_0xc983('0x2d')](function(_0x118ac7){_0x18a89c[_0xc983('0xd')][_0x5e0c0c['id']][_0xc983('0x32')][_0xc983('0x24')]=_0xc983('0x21');_0x18a89c[_0xc983('0xd')][_0x5e0c0c['id']][_0xc983('0x32')][_0xc983('0x14')]=_0x118ac7;_0x18a89c[_0xc983('0x11')](_0x5e0c0c['id']);_0xc15b42(_0x118ac7);});});}return this[_0xc983('0xf')][_0xc983('0x33')](_0x5e0c0c);};module[_0xc983('0x34')]=EmailChannel; \ No newline at end of file +var _0x9b4c=['handleImapEnd','disabled','connected','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','lastSync','handleImapError','sendMail','send','Smtp','verify','lodash','moment','bluebird','md5','../../../config/environment','email','redis','defaults','localhost','./imap','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','Imap','status','messageStatus','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','active','box','handleImapBox','bind','handleImapEmail','end'];(function(_0x7e8491,_0x4c29ce){var _0x5bcada=function(_0x25a001){while(--_0x25a001){_0x7e8491['push'](_0x7e8491['shift']());}};_0x5bcada(++_0x4c29ce);}(_0x9b4c,0x177));var _0xc9b4=function(_0x50b1c5,_0x1cf2a9){_0x50b1c5=_0x50b1c5-0x0;var _0x344f99=_0x9b4c[_0x50b1c5];return _0x344f99;};'use strict';var _=require(_0xc9b4('0x0'));var moment=require(_0xc9b4('0x1'));var BPromise=require(_0xc9b4('0x2'));var md5=require(_0xc9b4('0x3'));var Redis=require('ioredis');var config=require(_0xc9b4('0x4'));var logger=require('../../../config/logger')(_0xc9b4('0x5'));config[_0xc9b4('0x6')]=_[_0xc9b4('0x7')](config['redis'],{'host':_0xc9b4('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc9b4('0x6')]));var EmailImap=require(_0xc9b4('0x9'));var EmailSmtp=require('./smtp');var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0xda0da2){logger[_0xc9b4('0xa')](_0xc9b4('0xb'));this[_0xc9b4('0xc')]=_0xda0da2[_0xc9b4('0xc')];this[_0xc9b4('0xd')]={};this[_0xc9b4('0xe')]=new EmailSmtp();}EmailChannel[_0xc9b4('0xf')][_0xc9b4('0x10')]=function(_0x27bfb9){var _0x351720=this['mailAccounts'][_0x27bfb9];var _0x3c37dd={'id':_0x351720['id'],'name':_0x351720[_0xc9b4('0x11')],'key':_0x351720[_0xc9b4('0x12')],'active':_0x351720['active'],'Imap':{'status':_0x351720[_0xc9b4('0x13')][_0xc9b4('0x14')],'messageStatus':_0x351720[_0xc9b4('0x13')][_0xc9b4('0x15')],'total':_0x351720[_0xc9b4('0x13')]['total']}};if(_[_0xc9b4('0x16')](md5Accounts[_0x27bfb9])){md5Accounts[_0x27bfb9]={};}var _0x37efec=md5(JSON[_0xc9b4('0x17')](_0x3c37dd));if(md5Accounts[_0x27bfb9][_0xc9b4('0x3')]!==_0x37efec){md5Accounts[_0x27bfb9][_0xc9b4('0x3')]=_0x37efec;io[_0xc9b4('0x10')](_0xc9b4('0x18'),_0x3c37dd);}};EmailChannel['prototype'][_0xc9b4('0x19')]=function(_0x271e56){for(var _0x2572b2 in _0x271e56){if(_0x271e56[_0xc9b4('0x1a')](_0x2572b2)){if(_0x271e56[_0x2572b2][_0xc9b4('0x13')]&&_0x271e56[_0x2572b2][_0xc9b4('0x1b')]){var _0x44de87=_0x271e56[_0x2572b2]['Imap'];if(!this[_0xc9b4('0xd')]['hasOwnProperty'](_0x44de87['id'])){this[_0xc9b4('0xd')][_0x44de87['id']]=new EmailImap(_0x44de87,_0x271e56[_0x2572b2][_0xc9b4('0x5')]);this['imapAccounts'][_0x44de87['id']]['on'](_0xc9b4('0x1c'),this[_0xc9b4('0x1d')][_0xc9b4('0x1e')](this,_0x2572b2));this[_0xc9b4('0xd')][_0x44de87['id']]['on'](_0xc9b4('0x5'),this[_0xc9b4('0x1f')][_0xc9b4('0x1e')](this,_0x2572b2));this[_0xc9b4('0xd')][_0x44de87['id']]['on'](_0xc9b4('0x20'),this[_0xc9b4('0x21')][_0xc9b4('0x1e')](this,_0x2572b2));this[_0xc9b4('0xd')][_0x44de87['id']]['on']('error',this['handleImapError']['bind'](this,_0x2572b2));}}else{if(_[_0xc9b4('0x16')](this[_0xc9b4('0xc')][_0x2572b2][_0xc9b4('0x13')])){this[_0xc9b4('0xc')][_0x2572b2]['Imap']={};}this['mailAccounts'][_0x2572b2][_0xc9b4('0x13')]['status']=_0xc9b4('0x22');this[_0xc9b4('0xc')][_0x2572b2]['Imap']['messageStatus']='';this['emit'](_0x2572b2);}}}};EmailChannel[_0xc9b4('0xf')]['handleImapBox']=function(_0x8182f3,_0x172c0a){if(this[_0xc9b4('0xc')][_0x8182f3]){this[_0xc9b4('0xc')][_0x8182f3][_0xc9b4('0x13')][_0xc9b4('0x14')]=_0xc9b4('0x23');this[_0xc9b4('0xc')][_0x8182f3]['Imap']['messageStatus']=_0x172c0a[_0xc9b4('0x11')];if(_0x172c0a['messages']){this[_0xc9b4('0xc')][_0x8182f3]['Imap'][_0xc9b4('0x24')]=_0x172c0a['messages'][_0xc9b4('0x24')];}return this['emit'](_0x8182f3);}};EmailChannel[_0xc9b4('0xf')][_0xc9b4('0x1f')]=function(_0xde7bfd,_0x3c4b86){logger['info'](_0xc9b4('0x25'),_0x3c4b86[_0xc9b4('0x26')],_0x3c4b86['lastName'],_0x3c4b86[_0xc9b4('0x27')],_0xde7bfd);if(this[_0xc9b4('0xc')][_0xde7bfd]){return mailAccount[_0xc9b4('0x28')](_0xde7bfd,_0x3c4b86)[_0xc9b4('0x29')](function(_0x1edca8){if(_0x1edca8){logger[_0xc9b4('0xa')](_0xc9b4('0x2a'));}})[_0xc9b4('0x2b')](function(_0x416e1f){logger[_0xc9b4('0x2c')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xc9b4('0x17')](_0x416e1f));});}};EmailChannel['prototype'][_0xc9b4('0x21')]=function(_0x3e35a3){if(this[_0xc9b4('0xc')][_0x3e35a3]&&this[_0xc9b4('0xc')][_0x3e35a3][_0xc9b4('0x13')]){if(this[_0xc9b4('0xd')][this[_0xc9b4('0xc')][_0x3e35a3][_0xc9b4('0x13')]['id']]){delete this[_0xc9b4('0xd')][this[_0xc9b4('0xc')][_0x3e35a3]['Imap']['id']];}this[_0xc9b4('0xc')][_0x3e35a3][_0xc9b4('0x13')][_0xc9b4('0x2d')]=moment();this['emit'](_0x3e35a3);}};EmailChannel[_0xc9b4('0xf')][_0xc9b4('0x2e')]=function(_0x243c5b,_0x37a849){if(this[_0xc9b4('0xc')][_0x243c5b]){this[_0xc9b4('0xc')][_0x243c5b][_0xc9b4('0x13')][_0xc9b4('0x14')]=_0xc9b4('0x2c');this['mailAccounts'][_0x243c5b][_0xc9b4('0x13')][_0xc9b4('0x15')]=_0x37a849;return this[_0xc9b4('0x10')](_0x243c5b);}};EmailChannel[_0xc9b4('0xf')][_0xc9b4('0x2f')]=function(_0x452640,_0x4910d3){return this[_0xc9b4('0xe')][_0xc9b4('0x30')](_0x452640,_0x4910d3);};EmailChannel[_0xc9b4('0xf')]['verifySmtp']=function(_0x2c2fb7){var _0x3655a9=this;if(this[_0xc9b4('0xc')][_0x2c2fb7['id']]){if(_[_0xc9b4('0x16')](this[_0xc9b4('0xc')][_0x2c2fb7['id']]['Smtp'])){this['mailAccounts'][_0x2c2fb7['id']][_0xc9b4('0x31')]={};}this['mailAccounts'][_0x2c2fb7['id']]['Smtp'][_0xc9b4('0x2d')]=moment();return new BPromise(function(_0x2d8c81,_0x2c67c1){return _0x3655a9['smtp'][_0xc9b4('0x32')](_0x2c2fb7)[_0xc9b4('0x29')](function(_0x48b4bd){_0x3655a9[_0xc9b4('0xc')][_0x2c2fb7['id']][_0xc9b4('0x31')][_0xc9b4('0x14')]='verified';_0x3655a9['mailAccounts'][_0x2c2fb7['id']][_0xc9b4('0x31')][_0xc9b4('0x15')]='';_0x3655a9[_0xc9b4('0x10')](_0x2c2fb7['id']);_0x2d8c81(_0x48b4bd);})[_0xc9b4('0x2b')](function(_0xdc9038){_0x3655a9[_0xc9b4('0xc')][_0x2c2fb7['id']][_0xc9b4('0x31')][_0xc9b4('0x14')]='error';_0x3655a9[_0xc9b4('0xc')][_0x2c2fb7['id']][_0xc9b4('0x31')][_0xc9b4('0x15')]=_0xdc9038;_0x3655a9[_0xc9b4('0x10')](_0x2c2fb7['id']);_0x2c67c1(_0xdc9038);});});}return this[_0xc9b4('0xe')]['verify'](_0x2c2fb7);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 9092b9c..989953e 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 _0xbd9d=['host','port','tls','autotls','password','anonymous@xcally.com','openBox','handleOpenBox','handleCloseBox','end','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','body','handleMessageBody','handleMessageEnd','handleSimpleParser','handleMessageAttributes','emit','closeBox','stringify','textCode','upperFirst','exports','imap','lodash','mailparser','Iconv','../../../config/logger','email','mailbox','INBOX','account','once','ready','handleReady','bind','handleEnd','error','handleError','connect','prototype','getAccount','connTimeout','authTimeout','isNil','service','authentication','user'];(function(_0x4fcb07,_0x4a77a4){var _0xf2eeb=function(_0x279b1a){while(--_0x279b1a){_0x4fcb07['push'](_0x4fcb07['shift']());}};_0xf2eeb(++_0x4a77a4);}(_0xbd9d,0x1d6));var _0xdbd9=function(_0x10eb9c,_0x4ad94){_0x10eb9c=_0x10eb9c-0x0;var _0x5990ee=_0xbd9d[_0x10eb9c];return _0x5990ee;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require(_0xdbd9('0x0'));var _=require(_0xdbd9('0x1'));var rs=require('randomstring');var simpleParser=require(_0xdbd9('0x2'))['simpleParser'];var Iconv=require('iconv')[_0xdbd9('0x3')];var EventEmitter=require('events')['EventEmitter'];var utils=require('./utils');var logger=require(_0xdbd9('0x4'))(_0xdbd9('0x5'));function EmailImap(_0x1ba7c2,_0x193899){this[_0xdbd9('0x6')]=_0xdbd9('0x7');this['account']=this['getAccount'](_0x1ba7c2,_0x193899);this[_0xdbd9('0x0')]=new Imap(this[_0xdbd9('0x8')]);this[_0xdbd9('0x0')][_0xdbd9('0x9')](_0xdbd9('0xa'),this[_0xdbd9('0xb')][_0xdbd9('0xc')](this));this[_0xdbd9('0x0')][_0xdbd9('0x9')]('end',this[_0xdbd9('0xd')]['bind'](this));this['imap']['on'](_0xdbd9('0xe'),this[_0xdbd9('0xf')][_0xdbd9('0xc')](this));this[_0xdbd9('0x0')][_0xdbd9('0x10')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xdbd9('0x11')][_0xdbd9('0x12')]=function(_0x86e855,_0x5d8e5d){var _0x4cce8b={'connTimeout':_0x86e855['connTimeout']?_0x86e855[_0xdbd9('0x13')]*0x3e8:0x2710,'authTimeout':_0x86e855[_0xdbd9('0x14')]?_0x86e855[_0xdbd9('0x14')]*0x3e8:0x1388};if(_[_0xdbd9('0x15')](_0x86e855[_0xdbd9('0x16')])){if(_0x86e855[_0xdbd9('0x17')]){_0x4cce8b[_0xdbd9('0x18')]=_0x86e855[_0xdbd9('0x18')];_0x4cce8b['password']=_0x86e855['password'];}_0x4cce8b[_0xdbd9('0x19')]=_0x86e855['host'];_0x4cce8b[_0xdbd9('0x1a')]=_0x86e855[_0xdbd9('0x1a')]||0x3e1;if(_0x86e855[_0xdbd9('0x1b')]){_0x4cce8b[_0xdbd9('0x1b')]=!![];}else{_0x4cce8b[_0xdbd9('0x1b')]=![];_0x4cce8b[_0xdbd9('0x1c')]='required';}}else{_0x4cce8b[_0xdbd9('0x18')]=_0x86e855[_0xdbd9('0x18')];_0x4cce8b['password']=_0x86e855[_0xdbd9('0x1d')];_0x4cce8b[_0xdbd9('0x19')]=utils['getHost'](_0x86e855[_0xdbd9('0x16')]);_0x4cce8b[_0xdbd9('0x1a')]=0x3e1;_0x4cce8b[_0xdbd9('0x1b')]=!![];}_0x4cce8b[_0xdbd9('0x5')]=_0x5d8e5d||_0x86e855[_0xdbd9('0x18')]||_0xdbd9('0x1e');return _0x4cce8b;};EmailImap[_0xdbd9('0x11')][_0xdbd9('0xb')]=function(){this[_0xdbd9('0x0')][_0xdbd9('0x1f')](this['mailbox'],![],this[_0xdbd9('0x20')][_0xdbd9('0xc')](this));};EmailImap[_0xdbd9('0x11')][_0xdbd9('0x20')]=function(_0x4b9417,_0x26affb){if(_0x4b9417){this[_0xdbd9('0xf')](_0x4b9417,!![]);}else{this['emit']('box',_0x26affb);this['readUnseen']();}};EmailImap[_0xdbd9('0x11')][_0xdbd9('0x21')]=function(_0x129271){if(_0x129271){this['handleError'](_0x129271,!![]);}else{this['imap'][_0xdbd9('0x22')]();}};EmailImap[_0xdbd9('0x11')][_0xdbd9('0x23')]=function(){this[_0xdbd9('0x0')][_0xdbd9('0x24')]([_0xdbd9('0x25')],this[_0xdbd9('0x26')]['bind'](this));};EmailImap['prototype'][_0xdbd9('0x26')]=function(_0x153994,_0x245af2){if(_0x153994){this[_0xdbd9('0xf')](_0x153994,!![]);}else{if(_0x245af2[_0xdbd9('0x27')]){try{var _0x4b2973=this[_0xdbd9('0x0')][_0xdbd9('0x28')](_0x245af2,{'bodies':'','markSeen':!![]});_0x4b2973['on']('message',this[_0xdbd9('0x29')][_0xdbd9('0xc')](this));_0x4b2973[_0xdbd9('0x9')](_0xdbd9('0xe'),this[_0xdbd9('0x2a')]['bind'](this));_0x4b2973[_0xdbd9('0x9')](_0xdbd9('0x22'),this[_0xdbd9('0x2b')][_0xdbd9('0xc')](this));}catch(_0x23c618){logger[_0xdbd9('0xe')](_0x23c618);}}else{this[_0xdbd9('0x0')]['closeBox'](!![],this[_0xdbd9('0x21')][_0xdbd9('0xc')](this));}}};EmailImap[_0xdbd9('0x11')]['handleFetchMessage']=function(_0x399dda,_0x19ca4b){_0x399dda['on'](_0xdbd9('0x2c'),this[_0xdbd9('0x2d')][_0xdbd9('0xc')](this));_0x399dda[_0xdbd9('0x9')]('attributes',this['handleMessageAttributes'][_0xdbd9('0xc')](this));_0x399dda[_0xdbd9('0x9')](_0xdbd9('0x22'),this[_0xdbd9('0x2e')][_0xdbd9('0xc')](this));};EmailImap['prototype'][_0xdbd9('0x2d')]=function(_0x42aa53,_0x4207be){simpleParser(_0x42aa53,{'Iconv':Iconv},this[_0xdbd9('0x2f')]['bind'](this));};EmailImap[_0xdbd9('0x11')][_0xdbd9('0x30')]=function(_0x269f9e){};EmailImap[_0xdbd9('0x11')][_0xdbd9('0x2e')]=function(){};EmailImap['prototype'][_0xdbd9('0x2f')]=function(_0xb14e85,_0x4c60d0){if(_0xb14e85){logger[_0xdbd9('0xe')](_0xb14e85);}else{var _0x469158=this;utils['parser'](this['account'],_0x4c60d0,function(_0x3dd5dd){_0x469158[_0xdbd9('0x31')](_0xdbd9('0x5'),_0x3dd5dd);});}};EmailImap[_0xdbd9('0x11')]['handleFetchEnd']=function(){this[_0xdbd9('0x0')][_0xdbd9('0x32')](!![],this[_0xdbd9('0x21')]['bind'](this));};EmailImap[_0xdbd9('0x11')][_0xdbd9('0x2a')]=function(_0x569998){this[_0xdbd9('0xf')](_0x569998);this[_0xdbd9('0x0')][_0xdbd9('0x32')](!![],this[_0xdbd9('0x21')]['bind'](this));};EmailImap[_0xdbd9('0x11')][_0xdbd9('0xd')]=function(){this[_0xdbd9('0x31')](_0xdbd9('0x22'));};EmailImap[_0xdbd9('0x11')][_0xdbd9('0xf')]=function(_0x33408d,_0xef7b6d){logger['error'](_0xdbd9('0xf'),this[_0xdbd9('0x8')][_0xdbd9('0x5')],JSON[_0xdbd9('0x33')](_0x33408d));var _0x903f76='';if(_0x33408d){if(_0x33408d['textCode']){_0x903f76=_0x33408d[_0xdbd9('0x34')];}else{for(var _0x72e0cb in _0x33408d){if(_0x33408d['hasOwnProperty'](_0x72e0cb)){_0x903f76+=_[_0xdbd9('0x35')](_0x72e0cb)+':\x20'+_0x33408d[_0x72e0cb]+'\x0a';}}}}if(_0xef7b6d){this[_0xdbd9('0x0')][_0xdbd9('0x22')]();}else{this[_0xdbd9('0x31')]('error',_0x903f76);this[_0xdbd9('0x31')](_0xdbd9('0x22'));}};module[_0xdbd9('0x36')]=EmailImap; \ No newline at end of file +var _0x7fec=['account','once','handleReady','bind','end','handleEnd','handleError','connect','inherits','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','required','getHost','anonymous@xcally.com','prototype','openBox','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','error','handleCloseBox','stringify','textCode','hasOwnProperty','path','util','imap','lodash','randomstring','mailparser','simpleParser','events','EventEmitter','../../../config/logger','email','mailbox','INBOX','getAccount'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7fec,0x128));var _0xc7fe=function(_0xb24cb9,_0x13559c){_0xb24cb9=_0xb24cb9-0x0;var _0x439104=_0x7fec[_0xb24cb9];return _0x439104;};'use strict';var fs=require('fs');var path=require(_0xc7fe('0x0'));var util=require(_0xc7fe('0x1'));var Imap=require(_0xc7fe('0x2'));var _=require(_0xc7fe('0x3'));var rs=require(_0xc7fe('0x4'));var simpleParser=require(_0xc7fe('0x5'))[_0xc7fe('0x6')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0xc7fe('0x7'))[_0xc7fe('0x8')];var utils=require('./utils');var logger=require(_0xc7fe('0x9'))(_0xc7fe('0xa'));function EmailImap(_0x488e4b,_0x949b6e){this[_0xc7fe('0xb')]=_0xc7fe('0xc');this['account']=this[_0xc7fe('0xd')](_0x488e4b,_0x949b6e);this['imap']=new Imap(this[_0xc7fe('0xe')]);this[_0xc7fe('0x2')][_0xc7fe('0xf')]('ready',this[_0xc7fe('0x10')][_0xc7fe('0x11')](this));this[_0xc7fe('0x2')][_0xc7fe('0xf')](_0xc7fe('0x12'),this[_0xc7fe('0x13')][_0xc7fe('0x11')](this));this[_0xc7fe('0x2')]['on']('error',this[_0xc7fe('0x14')][_0xc7fe('0x11')](this));this[_0xc7fe('0x2')][_0xc7fe('0x15')]();}util[_0xc7fe('0x16')](EmailImap,EventEmitter);EmailImap['prototype'][_0xc7fe('0xd')]=function(_0x31f1d2,_0x98720d){var _0x3cb702={'connTimeout':_0x31f1d2[_0xc7fe('0x17')]?_0x31f1d2[_0xc7fe('0x17')]*0x3e8:0x2710,'authTimeout':_0x31f1d2['authTimeout']?_0x31f1d2[_0xc7fe('0x18')]*0x3e8:0x1388};if(_[_0xc7fe('0x19')](_0x31f1d2[_0xc7fe('0x1a')])){if(_0x31f1d2[_0xc7fe('0x1b')]){_0x3cb702['user']=_0x31f1d2[_0xc7fe('0x1c')];_0x3cb702[_0xc7fe('0x1d')]=_0x31f1d2[_0xc7fe('0x1d')];}_0x3cb702[_0xc7fe('0x1e')]=_0x31f1d2[_0xc7fe('0x1e')];_0x3cb702[_0xc7fe('0x1f')]=_0x31f1d2[_0xc7fe('0x1f')]||0x3e1;if(_0x31f1d2[_0xc7fe('0x20')]){_0x3cb702[_0xc7fe('0x20')]=!![];}else{_0x3cb702[_0xc7fe('0x20')]=![];_0x3cb702['autotls']=_0xc7fe('0x21');}}else{_0x3cb702[_0xc7fe('0x1c')]=_0x31f1d2[_0xc7fe('0x1c')];_0x3cb702[_0xc7fe('0x1d')]=_0x31f1d2[_0xc7fe('0x1d')];_0x3cb702[_0xc7fe('0x1e')]=utils[_0xc7fe('0x22')](_0x31f1d2[_0xc7fe('0x1a')]);_0x3cb702[_0xc7fe('0x1f')]=0x3e1;_0x3cb702[_0xc7fe('0x20')]=!![];}_0x3cb702[_0xc7fe('0xa')]=_0x98720d||_0x31f1d2['user']||_0xc7fe('0x23');return _0x3cb702;};EmailImap[_0xc7fe('0x24')]['handleReady']=function(){this[_0xc7fe('0x2')][_0xc7fe('0x25')](this[_0xc7fe('0xb')],![],this[_0xc7fe('0x26')][_0xc7fe('0x11')](this));};EmailImap[_0xc7fe('0x24')]['handleOpenBox']=function(_0x18f795,_0x3dd728){if(_0x18f795){this[_0xc7fe('0x14')](_0x18f795,!![]);}else{this[_0xc7fe('0x27')](_0xc7fe('0x28'),_0x3dd728);this[_0xc7fe('0x29')]();}};EmailImap[_0xc7fe('0x24')]['handleCloseBox']=function(_0x4e05d8){if(_0x4e05d8){this[_0xc7fe('0x14')](_0x4e05d8,!![]);}else{this[_0xc7fe('0x2')]['end']();}};EmailImap[_0xc7fe('0x24')][_0xc7fe('0x29')]=function(){this[_0xc7fe('0x2')][_0xc7fe('0x2a')]([_0xc7fe('0x2b')],this[_0xc7fe('0x2c')][_0xc7fe('0x11')](this));};EmailImap[_0xc7fe('0x24')][_0xc7fe('0x2c')]=function(_0x44d736,_0x2259bb){if(_0x44d736){this[_0xc7fe('0x14')](_0x44d736,!![]);}else{if(_0x2259bb[_0xc7fe('0x2d')]){try{var _0xc21765=this[_0xc7fe('0x2')][_0xc7fe('0x2e')](_0x2259bb,{'bodies':'','markSeen':!![]});_0xc21765['on']('message',this[_0xc7fe('0x2f')][_0xc7fe('0x11')](this));_0xc21765[_0xc7fe('0xf')]('error',this[_0xc7fe('0x30')]['bind'](this));_0xc21765['once'](_0xc7fe('0x12'),this[_0xc7fe('0x31')]['bind'](this));}catch(_0x34c4ec){logger['error'](_0x34c4ec);}}else{this['imap'][_0xc7fe('0x32')](!![],this['handleCloseBox'][_0xc7fe('0x11')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x473b76,_0x335765){_0x473b76['on'](_0xc7fe('0x33'),this[_0xc7fe('0x34')]['bind'](this));_0x473b76[_0xc7fe('0xf')](_0xc7fe('0x35'),this[_0xc7fe('0x36')]['bind'](this));_0x473b76[_0xc7fe('0xf')](_0xc7fe('0x12'),this[_0xc7fe('0x37')][_0xc7fe('0x11')](this));};EmailImap[_0xc7fe('0x24')][_0xc7fe('0x34')]=function(_0x4006cd,_0x5cdede){simpleParser(_0x4006cd,{'Iconv':Iconv},this[_0xc7fe('0x38')][_0xc7fe('0x11')](this));};EmailImap[_0xc7fe('0x24')][_0xc7fe('0x36')]=function(_0x68ae85){};EmailImap[_0xc7fe('0x24')][_0xc7fe('0x37')]=function(){};EmailImap[_0xc7fe('0x24')]['handleSimpleParser']=function(_0x14d640,_0x4ab194){if(_0x14d640){logger[_0xc7fe('0x39')](_0x14d640);}else{var _0x59a184=this;utils['parser'](this[_0xc7fe('0xe')],_0x4ab194,function(_0x48fcbd){_0x59a184['emit'](_0xc7fe('0xa'),_0x48fcbd);});}};EmailImap[_0xc7fe('0x24')]['handleFetchEnd']=function(){this[_0xc7fe('0x2')][_0xc7fe('0x32')](!![],this[_0xc7fe('0x3a')]['bind'](this));};EmailImap[_0xc7fe('0x24')][_0xc7fe('0x30')]=function(_0x7e9d83){this[_0xc7fe('0x14')](_0x7e9d83);this[_0xc7fe('0x2')]['closeBox'](!![],this[_0xc7fe('0x3a')][_0xc7fe('0x11')](this));};EmailImap[_0xc7fe('0x24')][_0xc7fe('0x13')]=function(){this['emit'](_0xc7fe('0x12'));};EmailImap[_0xc7fe('0x24')][_0xc7fe('0x14')]=function(_0x3bb658,_0x224168){logger[_0xc7fe('0x39')](_0xc7fe('0x14'),this[_0xc7fe('0xe')]['email'],JSON[_0xc7fe('0x3b')](_0x3bb658));var _0x4721b6='';if(_0x3bb658){if(_0x3bb658[_0xc7fe('0x3c')]){_0x4721b6=_0x3bb658[_0xc7fe('0x3c')];}else{for(var _0x26128c in _0x3bb658){if(_0x3bb658[_0xc7fe('0x3d')](_0x26128c)){_0x4721b6+=_['upperFirst'](_0x26128c)+':\x20'+_0x3bb658[_0x26128c]+'\x0a';}}}}if(_0x224168){this['imap'][_0xc7fe('0x12')]();}else{this[_0xc7fe('0x27')](_0xc7fe('0x39'),_0x4721b6);this['emit'](_0xc7fe('0x12'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 7b36130..915e2ee 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 _0x5b39=['verify','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','createTransport','use','sendMail','toString'];(function(_0x16987d,_0x566f27){var _0x48b8a4=function(_0x396cad){while(--_0x396cad){_0x16987d['push'](_0x16987d['shift']());}};_0x48b8a4(++_0x566f27);}(_0x5b39,0xd1));var _0x95b3=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x5b39[_0x3511d3];return _0x5d6321;};'use strict';var nodemailer=require(_0x95b3('0x0'));var BPromise=require(_0x95b3('0x1'));var inlineBase64=require(_0x95b3('0x2'));function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x1e22fa,_0x8e9e96){return new BPromise(function(_0x8c58c2,_0xbe78be){var _0x24fc89=nodemailer[_0x95b3('0x3')](_0x1e22fa);_0x24fc89[_0x95b3('0x4')]('compile',inlineBase64());_0x24fc89[_0x95b3('0x5')](_0x8e9e96,function(_0x4c41ad,_0x19dec5){if(_0x4c41ad){_0xbe78be(_0x4c41ad[_0x95b3('0x6')]());}else{_0x8c58c2(_0x19dec5);}});});};EmailSmtp['prototype'][_0x95b3('0x7')]=function(_0x15c4f6){return new BPromise(function(_0x442321,_0x2b3775){var _0x4fc450=nodemailer[_0x95b3('0x3')](_0x15c4f6);_0x4fc450[_0x95b3('0x7')](function(_0x1a7929,_0x540e73){if(_0x1a7929){_0x2b3775(_0x1a7929[_0x95b3('0x6')]());}else{if(_0x540e73){_0x442321(_0x540e73);}else{_0x2b3775('Not\x20verifired');}}});});};module[_0x95b3('0x8')]=EmailSmtp; \ No newline at end of file +var _0x4d05=['Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','sendMail','verify','toString'];(function(_0x2c27a5,_0x11e01d){var _0x46aaa3=function(_0x22ddd3){while(--_0x22ddd3){_0x2c27a5['push'](_0x2c27a5['shift']());}};_0x46aaa3(++_0x11e01d);}(_0x4d05,0x1cf));var _0x54d0=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4d05[_0x3b380d];return _0x54502b;};'use strict';var nodemailer=require(_0x54d0('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0x54d0('0x1'));function EmailSmtp(){}EmailSmtp[_0x54d0('0x2')][_0x54d0('0x3')]=function(_0x3965df,_0x3bdd7b){return new BPromise(function(_0x564f3d,_0x1dcd86){var _0x83bee4=nodemailer[_0x54d0('0x4')](_0x3965df);_0x83bee4[_0x54d0('0x5')](_0x54d0('0x6'),inlineBase64());_0x83bee4[_0x54d0('0x7')](_0x3bdd7b,function(_0xf9d088,_0x455c28){if(_0xf9d088){_0x1dcd86(_0xf9d088['toString']());}else{_0x564f3d(_0x455c28);}});});};EmailSmtp[_0x54d0('0x2')][_0x54d0('0x8')]=function(_0x19bdf7){return new BPromise(function(_0x118b03,_0x434e24){var _0x5ebcf0=nodemailer[_0x54d0('0x4')](_0x19bdf7);_0x5ebcf0[_0x54d0('0x8')](function(_0x3e025a,_0x5541d6){if(_0x3e025a){_0x434e24(_0x3e025a[_0x54d0('0x9')]());}else{if(_0x5541d6){_0x118b03(_0x5541d6);}else{_0x434e24(_0x54d0('0xa'));}}});});};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 fabca22..d0100b6 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 _0x55a6=['gmail','yahoo','hotmail','outlook365','127.0.0.1','moment','randomstring','path','util','email','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','name','split','length','join','Anonymous','html','replace','body','textAsHtml','message','isEmpty','originCc','includes','originTo','bcc','attachments','attach','type','filename','attachment-','format','%s-%s','now','root','writeFileSync','content','push','contentType','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','BodyHTML','

Empty\x20message

','Attachments','Title','getHost'];(function(_0x2edbb1,_0x19834b){var _0x4d5d84=function(_0x5eaa05){while(--_0x5eaa05){_0x2edbb1['push'](_0x2edbb1['shift']());}};_0x4d5d84(++_0x19834b);}(_0x55a6,0x7b));var _0x655a=function(_0xbd8d2f,_0xfd8bb3){_0xbd8d2f=_0xbd8d2f-0x0;var _0xc926bb=_0x55a6[_0xbd8d2f];return _0xc926bb;};'use strict';var _=require('lodash');var moment=require(_0x655a('0x0'));var random=require(_0x655a('0x1'));var fs=require('fs');var path=require(_0x655a('0x2'));var util=require(_0x655a('0x3'));var tnef=require('node-tnef');var logger=require('../../../config/logger')(_0x655a('0x4'));var config=require(_0x655a('0x5'));function getAddress(_0x3451dd){var _0x42b662=_['head'](_0x3451dd[_0x655a('0x6')]);return _0x42b662&&_0x42b662[_0x655a('0x7')]?_0x42b662[_0x655a('0x7')]:_0x655a('0x8')+random[_0x655a('0x9')](0x6)+_0x655a('0xa');}function getFirstName(_0x412c16){var _0x6ee6=_[_0x655a('0xb')](_0x412c16['value']);if(_0x6ee6&&_0x6ee6[_0x655a('0xc')]){var _0x1cf1be=_0x6ee6[_0x655a('0xc')][_0x655a('0xd')](/\s+/);return _0x1cf1be[_0x655a('0xe')]?_0x1cf1be['slice'](0x0,-0x1)[_0x655a('0xf')]('\x20'):_0x6ee6[_0x655a('0xc')];}return _0x655a('0x10');}function getLastName(_0x1c2882){var _0x3fa43a=_[_0x655a('0xb')](_0x1c2882[_0x655a('0x6')]);if(_0x3fa43a&&_0x3fa43a[_0x655a('0xc')]){var _0x1503d0=_0x3fa43a['name'][_0x655a('0xd')](/\s+/);return _0x1503d0[_0x655a('0xe')]>0x1?_0x1503d0['pop']():'';}return'';}function getMails(_0x38d32b,_0x5cefcb){var _0xfc8555='';for(var _0x421aff=0x0;_0x421aff<_0x5cefcb[_0x655a('0x6')][_0x655a('0xe')];_0x421aff+=0x1){if(_0x5cefcb[_0x655a('0x6')][_0x421aff][_0x655a('0x7')]!==_0x38d32b){if(!_['isEmpty'](_0xfc8555)){_0xfc8555+=',';}_0xfc8555+=_0x5cefcb[_0x655a('0x6')][_0x421aff][_0x655a('0xc')]||_0x5cefcb['value'][_0x421aff]['address']||'';_0xfc8555+='\x20<';_0xfc8555+=_0x5cefcb[_0x655a('0x6')][_0x421aff][_0x655a('0x7')]?_0x5cefcb['value'][_0x421aff][_0x655a('0x7')]:_0x655a('0x8')+random['generate'](0x6)+'@xcally.com';_0xfc8555+='>';}}return _0xfc8555;}function parseEmail(_0x5133e0,_0x5a3e69,_0x162899){if(_0x5a3e69['html']){var _0x543f84=/)<[^<]*)*<\/script>/gi;while(_0x543f84['test'](_0x5a3e69[_0x655a('0x11')])){_0x5a3e69[_0x655a('0x11')]=_0x5a3e69[_0x655a('0x11')][_0x655a('0x12')](_0x543f84,'');}_0x162899[_0x655a('0x13')]=_0x5a3e69[_0x655a('0x11')];}else{_0x162899[_0x655a('0x13')]=_0x5a3e69[_0x655a('0x14')];}if(_0x162899[_0x655a('0x13')]){_0x162899[_0x655a('0x13')]=_0x162899[_0x655a('0x13')][_0x655a('0x12')](/Empty\x20message

','Attachments','Title','Data','getHost','imap.gmail.com','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','../../../config/logger','../../../config/environment','head','address','@xcally.com','value','split','length'];(function(_0x1c0483,_0x57b4b6){var _0x246f37=function(_0x567cfd){while(--_0x567cfd){_0x1c0483['push'](_0x1c0483['shift']());}};_0x246f37(++_0x57b4b6);}(_0x86c4,0xa8));var _0x486c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x86c4[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x486c('0x0'));var moment=require(_0x486c('0x1'));var random=require(_0x486c('0x2'));var fs=require('fs');var path=require(_0x486c('0x3'));var util=require('util');var tnef=require('node-tnef');var logger=require(_0x486c('0x4'))('email');var config=require(_0x486c('0x5'));function getAddress(_0x5560e7){var _0x5ac050=_[_0x486c('0x6')](_0x5560e7['value']);return _0x5ac050&&_0x5ac050[_0x486c('0x7')]?_0x5ac050['address']:'anonymous'+random['generate'](0x6)+_0x486c('0x8');}function getFirstName(_0x582c35){var _0x512b02=_[_0x486c('0x6')](_0x582c35[_0x486c('0x9')]);if(_0x512b02&&_0x512b02['name']){var _0x2b1780=_0x512b02['name'][_0x486c('0xa')](/\s+/);return _0x2b1780[_0x486c('0xb')]?_0x2b1780['slice'](0x0,-0x1)[_0x486c('0xc')]('\x20'):_0x512b02[_0x486c('0xd')];}return _0x486c('0xe');}function getLastName(_0x50435a){var _0x4b89bd=_[_0x486c('0x6')](_0x50435a[_0x486c('0x9')]);if(_0x4b89bd&&_0x4b89bd[_0x486c('0xd')]){var _0x1d4150=_0x4b89bd['name'][_0x486c('0xa')](/\s+/);return _0x1d4150[_0x486c('0xb')]>0x1?_0x1d4150[_0x486c('0xf')]():'';}return'';}function getMails(_0xabb295,_0x33d6b9){var _0x478124='';for(var _0x575f06=0x0;_0x575f06<_0x33d6b9['value'][_0x486c('0xb')];_0x575f06+=0x1){if(_0x33d6b9[_0x486c('0x9')][_0x575f06][_0x486c('0x7')]!==_0xabb295){if(!_['isEmpty'](_0x478124)){_0x478124+=',';}_0x478124+=_0x33d6b9[_0x486c('0x9')][_0x575f06][_0x486c('0xd')]||_0x33d6b9[_0x486c('0x9')][_0x575f06][_0x486c('0x7')]||'';_0x478124+='\x20<';_0x478124+=_0x33d6b9[_0x486c('0x9')][_0x575f06][_0x486c('0x7')]?_0x33d6b9['value'][_0x575f06][_0x486c('0x7')]:_0x486c('0x10')+random['generate'](0x6)+_0x486c('0x8');_0x478124+='>';}}return _0x478124;}function parseEmail(_0x2e2266,_0x1d5c33,_0x30c41c){if(_0x1d5c33['html']){var _0x51804d=/)<[^<]*)*<\/script>/gi;while(_0x51804d[_0x486c('0x11')](_0x1d5c33[_0x486c('0x12')])){_0x1d5c33[_0x486c('0x12')]=_0x1d5c33[_0x486c('0x12')][_0x486c('0x13')](_0x51804d,'');}_0x30c41c[_0x486c('0x14')]=_0x1d5c33[_0x486c('0x12')];}else{_0x30c41c[_0x486c('0x14')]=_0x1d5c33[_0x486c('0x15')];}if(_0x30c41c[_0x486c('0x14')]){_0x30c41c[_0x486c('0x14')]=_0x30c41c[_0x486c('0x14')][_0x486c('0x13')](/0x0){if(this[_0x41e653+_0x94c9('0x25')]>0x0&&this[_0x41e653+_0x94c9('0x24')]>=this[_0x41e653+_0x94c9('0x25')]){return _0x94c9('0x26');}else{return'working';}}else{return _0x94c9('0x27');}};Agent['prototype'][_0x94c9('0x21')]=function(){var _0x497c31=[_0x94c9('0x28'),_0x94c9('0x29'),_0x94c9('0x2a'),_0x94c9('0x2b'),_0x94c9('0x2c'),_0x94c9('0x2d')];for(var _0x578ca5=0x0;_0x578ca5<_0x497c31[_0x94c9('0x2e')];_0x578ca5+=0x1){var _0x1ba423=this[_0x94c9('0x23')](_0x497c31[_0x578ca5]);if(this[_0x497c31[_0x578ca5]+'Status']!==_0x1ba423){this[_0x497c31[_0x578ca5]+_0x94c9('0x2f')]=_['toNumber'](moment()[_0x94c9('0x30')]('x'));}this[_0x497c31[_0x578ca5]+_0x94c9('0x31')]=_0x1ba423;}var _0x254210={'id':this['id'],'name':this[_0x94c9('0x5')],'online':this[_0x94c9('0x32')],'voicePause':this[_0x94c9('0x6')],'chatPause':this['chatPause'],'mailPause':this[_0x94c9('0x8')],'smsPause':this[_0x94c9('0xa')],'faxPause':this[_0x94c9('0x9')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x94c9('0xc')],'chatStatusTime':this[_0x94c9('0x33')],'chatCapacity':this[_0x94c9('0xe')],'chatCurrentCapacity':this[_0x94c9('0xf')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x94c9('0x11')],'mailCapacity':this[_0x94c9('0x12')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x94c9('0x34')],'faxStatusTime':this[_0x94c9('0x13')],'faxCapacity':this[_0x94c9('0x14')],'faxCurrentCapacity':this[_0x94c9('0x15')],'smsStatus':this[_0x94c9('0x16')],'smsStatusTime':this[_0x94c9('0x35')],'smsCapacity':this[_0x94c9('0x17')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x94c9('0x19')],'whatsappStatusTime':this[_0x94c9('0x36')],'whatsappCapacity':this[_0x94c9('0x1a')],'whatsappCurrentCapacity':this[_0x94c9('0x1b')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x94c9('0x1d')],'openchannelCapacity':this[_0x94c9('0x1e')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x94c9('0x20')],'busyQueue':this[_0x94c9('0x37')]};var _0x28a0be=md5(JSON['stringify'](_0x254210));if(this[_0x94c9('0x1')]!==_0x28a0be){this[_0x94c9('0x1')]=_0x28a0be;io['emit'](_0x94c9('0x38'),_0x254210);}};module['exports']=Agent; \ No newline at end of file +var _0xcae2=['Status','StatusTime','toNumber','format','chatPause','mailPause','chatStatus','chatStatusTime','mailCurrentCapacity','faxStatusTime','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','faxPause','smsPause','openchannelPause','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','CurrentCapacity','maxcapacity','working','mail','chat','openchannel','fax','sms','whatsapp','length','getChannelStatus'];(function(_0x14fdd8,_0x36ae5c){var _0x4f3b91=function(_0x10ae1e){while(--_0x10ae1e){_0x14fdd8['push'](_0x14fdd8['shift']());}};_0x4f3b91(++_0x36ae5c);}(_0xcae2,0x143));var _0x2cae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcae2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cae('0x0'));var moment=require(_0x2cae('0x1'));var md5=require(_0x2cae('0x2'));var Redis=require(_0x2cae('0x3'));var config=require(_0x2cae('0x4'));config[_0x2cae('0x5')]=_[_0x2cae('0x6')](config['redis'],{'host':_0x2cae('0x7'),'port':0x18eb});var io=require(_0x2cae('0x8'))(new Redis(config[_0x2cae('0x5')]));function Agent(_0x415f20){this['id']=_0x415f20['id']||0x0;this['name']=_0x415f20[_0x2cae('0x9')]||'';this[_0x2cae('0xa')]=_0x415f20[_0x2cae('0xa')]||!![];this[_0x2cae('0xb')]=_0x415f20[_0x2cae('0xb')]||![];this['chatPause']=_0x415f20['chatPause']||![];this['mailPause']=_0x415f20['mailPause']||![];this[_0x2cae('0xc')]=_0x415f20[_0x2cae('0xc')]||![];this[_0x2cae('0xd')]=_0x415f20[_0x2cae('0xd')]||![];this[_0x2cae('0xe')]=_0x415f20[_0x2cae('0xe')]||![];this['chatStatus']=_0x2cae('0xf');this['chatStatusTime']=0x0;this[_0x2cae('0x10')]=_0x415f20[_0x2cae('0x10')]||0x0;this[_0x2cae('0x11')]=0x0;this[_0x2cae('0x12')]=_0x2cae('0xf');this[_0x2cae('0x13')]=0x0;this['mailCapacity']=_0x415f20[_0x2cae('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x2cae('0x15')]=_0x2cae('0xf');this['faxStatusTime']=0x0;this[_0x2cae('0x16')]=_0x415f20[_0x2cae('0x16')]||0x0;this[_0x2cae('0x17')]=0x0;this[_0x2cae('0x18')]='unknown';this[_0x2cae('0x19')]=0x0;this[_0x2cae('0x1a')]=_0x415f20['smsCapacity']||0x0;this[_0x2cae('0x1b')]=0x0;this[_0x2cae('0x1c')]=_0x2cae('0xf');this[_0x2cae('0x1d')]=0x0;this[_0x2cae('0x1e')]=_0x415f20[_0x2cae('0x1e')]||0x0;this[_0x2cae('0x1f')]=0x0;this[_0x2cae('0x20')]='unknown';this['openchannelStatusTime']=0x0;this[_0x2cae('0x21')]=_0x415f20[_0x2cae('0x21')]||0x0;this[_0x2cae('0x22')]=0x0;this[_0x2cae('0x23')]=![];this[_0x2cae('0x24')]=undefined;this[_0x2cae('0x2')]='';this[_0x2cae('0x25')]();}Agent['prototype']['getChannelStatus']=function(_0x1fc980){if(this[_0x1fc980+_0x2cae('0x26')]>0x0){if(this[_0x1fc980+'Capacity']>0x0&&this[_0x1fc980+'CurrentCapacity']>=this[_0x1fc980+'Capacity']){return _0x2cae('0x27');}else{return _0x2cae('0x28');}}else{return'idle';}};Agent['prototype'][_0x2cae('0x25')]=function(){var _0x1c8063=[_0x2cae('0x29'),_0x2cae('0x2a'),_0x2cae('0x2b'),_0x2cae('0x2c'),_0x2cae('0x2d'),_0x2cae('0x2e')];for(var _0x214dba=0x0;_0x214dba<_0x1c8063[_0x2cae('0x2f')];_0x214dba+=0x1){var _0x2eeaf0=this[_0x2cae('0x30')](_0x1c8063[_0x214dba]);if(this[_0x1c8063[_0x214dba]+_0x2cae('0x31')]!==_0x2eeaf0){this[_0x1c8063[_0x214dba]+_0x2cae('0x32')]=_[_0x2cae('0x33')](moment()[_0x2cae('0x34')]('x'));}this[_0x1c8063[_0x214dba]+'Status']=_0x2eeaf0;}var _0x4a6e85={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x2cae('0xb')],'chatPause':this[_0x2cae('0x35')],'mailPause':this[_0x2cae('0x36')],'smsPause':this[_0x2cae('0xd')],'faxPause':this['faxPause'],'openchannelPause':this[_0x2cae('0xe')],'chatStatus':this[_0x2cae('0x37')],'chatStatusTime':this[_0x2cae('0x38')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x2cae('0x11')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x2cae('0x13')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x2cae('0x39')],'faxStatus':this[_0x2cae('0x15')],'faxStatusTime':this[_0x2cae('0x3a')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x2cae('0x17')],'smsStatus':this[_0x2cae('0x18')],'smsStatusTime':this[_0x2cae('0x19')],'smsCapacity':this[_0x2cae('0x1a')],'smsCurrentCapacity':this[_0x2cae('0x1b')],'whatsappStatus':this[_0x2cae('0x1c')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x2cae('0x1f')],'openchannelStatus':this[_0x2cae('0x20')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x2cae('0x23')],'busyQueue':this[_0x2cae('0x24')]};var _0x56ec52=md5(JSON['stringify'](_0x4a6e85));if(this['md5']!==_0x56ec52){this[_0x2cae('0x2')]=_0x56ec52;io[_0x2cae('0x3b')](_0x2cae('0x3c'),_0x4a6e85);}};module[_0x2cae('0x3d')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 9c4854b..5cd9c8b 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 _0xe325=['redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','paused','length','loggedIn','chatPause','available','stringify','format','chat:queue:%s','emit','exports','lodash','util','ioredis','../../../config/environment'];(function(_0x57a880,_0x40939a){var _0x311cbd=function(_0x2168e1){while(--_0x2168e1){_0x57a880['push'](_0x57a880['shift']());}};_0x311cbd(++_0x40939a);}(_0xe325,0x158));var _0x5e32=function(_0x459b3e,_0x5a0c7a){_0x459b3e=_0x459b3e-0x0;var _0xaf15e4=_0xe325[_0x459b3e];return _0xaf15e4;};'use strict';var _=require(_0x5e32('0x0'));var md5=require('md5');var util=require(_0x5e32('0x1'));var Redis=require(_0x5e32('0x2'));var config=require(_0x5e32('0x3'));config[_0x5e32('0x4')]=_[_0x5e32('0x5')](config[_0x5e32('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x5e32('0x6'))(new Redis(config[_0x5e32('0x4')]));function ChatQueue(_0x42b4ec){this['id']=_0x42b4ec['id']||0x0;this[_0x5e32('0x7')]=_0x42b4ec[_0x5e32('0x7')]||'';this['timeout']=_0x42b4ec[_0x5e32('0x8')]||0xa;this[_0x5e32('0x9')]=_0x42b4ec[_0x5e32('0x9')]||'beepall';this[_0x5e32('0xa')]=_0x42b4ec['Agents'];this[_0x5e32('0xb')]={};this[_0x5e32('0xc')]=0x0;this[_0x5e32('0xd')]='';this['updateRouting']();this[_0x5e32('0xe')]();}ChatQueue[_0x5e32('0xf')][_0x5e32('0x10')]=function(){var _0xbba94c=this[_0x5e32('0xb')][_0x5e32('0x11')];this[_0x5e32('0xb')]=_[_0x5e32('0x12')](this[_0x5e32('0xa')],'id');this['mapAgentsId'][_0x5e32('0x11')]=_0xbba94c;};ChatQueue[_0x5e32('0xf')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x5e32('0x13')]=0x0;for(var _0x14f1f5=0x0;_0x14f1f5=0x0?this[_0x5e32('0x17')]:0x0;var _0x4a364f={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5e32('0x15')],'name':this[_0x5e32('0x7')],'paused':this[_0x5e32('0x13')],'waiting':this[_0x5e32('0xc')]};var _0x259e8e=md5(JSON[_0x5e32('0x18')](_0x4a364f));if(this[_0x5e32('0xd')]!==_0x259e8e){this[_0x5e32('0xd')]=_0x259e8e;io['to'](util[_0x5e32('0x19')](_0x5e32('0x1a'),_0x4a364f[_0x5e32('0x7')]))[_0x5e32('0x1b')]('chat_queue:save',_0x4a364f);}};module[_0x5e32('0x1c')]=ChatQueue; \ No newline at end of file +var _0xa74d=['md5','updateRouting','updateRealtime','prototype','_rr','map','length','loggedIn','chatPause','paused','available','stringify','format','chat:queue:%s','emit','exports','../../../config/environment','redis','defaults','localhost','name','timeout','beepall','Agents','mapAgentsId','waiting'];(function(_0x2f8d39,_0x4df0d9){var _0x405763=function(_0xefa193){while(--_0xefa193){_0x2f8d39['push'](_0x2f8d39['shift']());}};_0x405763(++_0x4df0d9);}(_0xa74d,0x1e4));var _0xda74=function(_0x33a20c,_0x2d4372){_0x33a20c=_0x33a20c-0x0;var _0x13b28d=_0xa74d[_0x33a20c];return _0x13b28d;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0xda74('0x0'));config[_0xda74('0x1')]=_[_0xda74('0x2')](config['redis'],{'host':_0xda74('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x6d0299){this['id']=_0x6d0299['id']||0x0;this[_0xda74('0x4')]=_0x6d0299[_0xda74('0x4')]||'';this[_0xda74('0x5')]=_0x6d0299[_0xda74('0x5')]||0xa;this['strategy']=_0x6d0299['strategy']||_0xda74('0x6');this[_0xda74('0x7')]=_0x6d0299['Agents'];this[_0xda74('0x8')]={};this[_0xda74('0x9')]=0x0;this[_0xda74('0xa')]='';this[_0xda74('0xb')]();this[_0xda74('0xc')]();}ChatQueue[_0xda74('0xd')][_0xda74('0xb')]=function(){var _0x3a5bd3=this[_0xda74('0x8')][_0xda74('0xe')];this['mapAgentsId']=_[_0xda74('0xf')](this[_0xda74('0x7')],'id');this[_0xda74('0x8')][_0xda74('0xe')]=_0x3a5bd3;};ChatQueue[_0xda74('0xd')][_0xda74('0xc')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x2f6cf6=0x0;_0x2f6cf6=0x0?this[_0xda74('0x14')]:0x0;var _0x4e119a={'id':this['id'],'available':this[_0xda74('0x14')],'loggedIn':this[_0xda74('0x11')],'name':this['name'],'paused':this[_0xda74('0x13')],'waiting':this['waiting']};var _0xd978a6=md5(JSON[_0xda74('0x15')](_0x4e119a));if(this[_0xda74('0xa')]!==_0xd978a6){this[_0xda74('0xa')]=_0xd978a6;io['to'](util[_0xda74('0x16')](_0xda74('0x17'),_0x4e119a[_0xda74('0x4')]))[_0xda74('0x18')]('chat_queue:save',_0x4e119a);}};module[_0xda74('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 009319f..5d0f441 100644 --- a/server/services/routing/model/faxQueue.js +++ b/server/services/routing/model/faxQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x1ca51b,_0xb8fd90){var _0x805b7e=function(_0x10bad1){while(--_0x10bad1){_0x1ca51b['push'](_0x1ca51b['shift']());}};_0x805b7e(++_0xb8fd90);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file +var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x28f711,_0x5a8729){var _0x9337c7=function(_0x23c922){while(--_0x23c922){_0x28f711['push'](_0x28f711['shift']());}};_0x9337c7(++_0x5a8729);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index b5790e7..60bb7b3 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 _0x2953=['exports','name','Intervals'];(function(_0x8678bf,_0x4265a5){var _0x115686=function(_0x5a20e0){while(--_0x5a20e0){_0x8678bf['push'](_0x8678bf['shift']());}};_0x115686(++_0x4265a5);}(_0x2953,0x160));var _0x3295=function(_0x364c0b,_0x5f0db0){_0x364c0b=_0x364c0b-0x0;var _0x11d2fe=_0x2953[_0x364c0b];return _0x11d2fe;};'use strict';function Interval(_0x2ab600){this['id']=_0x2ab600['id']||0x0;this[_0x3295('0x0')]=_0x2ab600[_0x3295('0x0')]||'';this['Intervals']=_0x2ab600[_0x3295('0x1')]||{};}module[_0x3295('0x2')]=Interval; \ No newline at end of file +var _0x32b0=['Intervals','exports','name'];(function(_0x3ecc30,_0x75412b){var _0x2682bc=function(_0x34c384){while(--_0x34c384){_0x3ecc30['push'](_0x3ecc30['shift']());}};_0x2682bc(++_0x75412b);}(_0x32b0,0x14f));var _0x032b=function(_0x1f858a,_0xff7047){_0x1f858a=_0x1f858a-0x0;var _0x3e3b18=_0x32b0[_0x1f858a];return _0x3e3b18;};'use strict';function Interval(_0x138616){this['id']=_0x138616['id']||0x0;this[_0x032b('0x0')]=_0x138616[_0x032b('0x0')]||'';this['Intervals']=_0x138616[_0x032b('0x1')]||{};}module[_0x032b('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 8629662..b8ece93 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 _0x7e74=['timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','mailPause','paused','available','waiting','stringify','format','mail:queue:%s','name','lodash','md5','redis','localhost','socket.io-emitter'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7e74,0x1d6));var _0x47e7=function(_0x24b3cf,_0x411e3b){_0x24b3cf=_0x24b3cf-0x0;var _0x38b39d=_0x7e74[_0x24b3cf];return _0x38b39d;};'use strict';var _=require(_0x47e7('0x0'));var md5=require(_0x47e7('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x47e7('0x2')]=_['defaults'](config['redis'],{'host':_0x47e7('0x3'),'port':0x18eb});var io=require(_0x47e7('0x4'))(new Redis(config['redis']));function MailQueue(_0x396d43){this['id']=_0x396d43['id']||0x0;this['name']=_0x396d43['name']||'';this[_0x47e7('0x5')]=_0x396d43[_0x47e7('0x5')]||0xa;this[_0x47e7('0x6')]=_0x396d43[_0x47e7('0x6')]||_0x47e7('0x7');this[_0x47e7('0x8')]=_0x396d43['Agents'];this[_0x47e7('0x9')]={};this['waiting']=0x0;this[_0x47e7('0x1')]='';this[_0x47e7('0xa')]();this[_0x47e7('0xb')]();}MailQueue[_0x47e7('0xc')]['updateRouting']=function(){var _0x56a5f0=this[_0x47e7('0x9')][_0x47e7('0xd')];this[_0x47e7('0x9')]=_[_0x47e7('0xe')](this[_0x47e7('0x8')],'id');this[_0x47e7('0x9')][_0x47e7('0xd')]=_0x56a5f0;};MailQueue[_0x47e7('0xc')]['updateRealtime']=function(){this[_0x47e7('0xf')]=0x0;this['paused']=0x0;for(var _0x480cc0=0x0;_0x480cc0=0x0?this[_0x47e7('0x13')]:0x0;var _0x42f354={'id':this['id'],'available':this['available'],'loggedIn':this[_0x47e7('0xf')],'name':this['name'],'paused':this[_0x47e7('0x12')],'waiting':this[_0x47e7('0x14')]};var _0x1b1ef9=md5(JSON[_0x47e7('0x15')](_0x42f354));if(this[_0x47e7('0x1')]!==_0x1b1ef9){this[_0x47e7('0x1')]=_0x1b1ef9;io['to'](util[_0x47e7('0x16')](_0x47e7('0x17'),_0x42f354[_0x47e7('0x18')]))['emit']('mail_queue:save',_0x42f354);}};module['exports']=MailQueue; \ No newline at end of file +var _0xe510=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','mailPause','available','format','mail:queue:%s','exports','lodash','util','ioredis','../../../config/environment'];(function(_0x45b756,_0x77793d){var _0x4de9df=function(_0x434fe0){while(--_0x434fe0){_0x45b756['push'](_0x45b756['shift']());}};_0x4de9df(++_0x77793d);}(_0xe510,0x10a));var _0x0e51=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xe510[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x0e51('0x0'));var md5=require('md5');var util=require(_0x0e51('0x1'));var Redis=require(_0x0e51('0x2'));var config=require(_0x0e51('0x3'));config[_0x0e51('0x4')]=_[_0x0e51('0x5')](config[_0x0e51('0x4')],{'host':_0x0e51('0x6'),'port':0x18eb});var io=require(_0x0e51('0x7'))(new Redis(config['redis']));function MailQueue(_0x304d83){this['id']=_0x304d83['id']||0x0;this[_0x0e51('0x8')]=_0x304d83[_0x0e51('0x8')]||'';this['timeout']=_0x304d83[_0x0e51('0x9')]||0xa;this[_0x0e51('0xa')]=_0x304d83[_0x0e51('0xa')]||_0x0e51('0xb');this[_0x0e51('0xc')]=_0x304d83['Agents'];this[_0x0e51('0xd')]={};this[_0x0e51('0xe')]=0x0;this[_0x0e51('0xf')]='';this[_0x0e51('0x10')]();this[_0x0e51('0x11')]();}MailQueue[_0x0e51('0x12')]['updateRouting']=function(){var _0x1d8fa4=this[_0x0e51('0xd')][_0x0e51('0x13')];this[_0x0e51('0xd')]=_[_0x0e51('0x14')](this[_0x0e51('0xc')],'id');this[_0x0e51('0xd')]['_rr']=_0x1d8fa4;};MailQueue[_0x0e51('0x12')][_0x0e51('0x11')]=function(){this[_0x0e51('0x15')]=0x0;this[_0x0e51('0x16')]=0x0;for(var _0x3cf4ba=0x0;_0x3cf4ba=0x0?this['available']:0x0;var _0x184378={'id':this['id'],'available':this['available'],'loggedIn':this[_0x0e51('0x15')],'name':this[_0x0e51('0x8')],'paused':this[_0x0e51('0x16')],'waiting':this[_0x0e51('0xe')]};var _0x400874=md5(JSON['stringify'](_0x184378));if(this[_0x0e51('0xf')]!==_0x400874){this[_0x0e51('0xf')]=_0x400874;io['to'](util[_0x0e51('0x1b')](_0x0e51('0x1c'),_0x184378['name']))['emit']('mail_queue:save',_0x184378);}};module[_0x0e51('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index e788bef..59f3725 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 _0xa052=['name','timeout','strategy','Agents','mapAgentsId','updateRouting','prototype','map','_rr','updateRealtime','loggedIn','paused','openchannelPause','available','format','openchannel:queue:%s','emit','openchannel_queue:save','md5','util','ioredis','../../../config/environment','defaults','redis'];(function(_0x31c3be,_0x5e540f){var _0x48314d=function(_0x65134b){while(--_0x65134b){_0x31c3be['push'](_0x31c3be['shift']());}};_0x48314d(++_0x5e540f);}(_0xa052,0x8a));var _0x2a05=function(_0x356660,_0x1504b5){_0x356660=_0x356660-0x0;var _0x66fdca=_0xa052[_0x356660];return _0x66fdca;};'use strict';var _=require('lodash');var md5=require(_0x2a05('0x0'));var util=require(_0x2a05('0x1'));var Redis=require(_0x2a05('0x2'));var config=require(_0x2a05('0x3'));config['redis']=_[_0x2a05('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2a05('0x5')]));function OpenchannelQueue(_0x273e80){this['id']=_0x273e80['id']||0x0;this[_0x2a05('0x6')]=_0x273e80[_0x2a05('0x6')]||'';this[_0x2a05('0x7')]=_0x273e80[_0x2a05('0x7')]||0xa;this[_0x2a05('0x8')]=_0x273e80['strategy']||'beepall';this[_0x2a05('0x9')]=_0x273e80[_0x2a05('0x9')];this[_0x2a05('0xa')]={};this['waiting']=0x0;this['md5']='';this[_0x2a05('0xb')]();this['updateRealtime']();}OpenchannelQueue[_0x2a05('0xc')][_0x2a05('0xb')]=function(){var _0x4acfee=this[_0x2a05('0xa')]['_rr'];this[_0x2a05('0xa')]=_[_0x2a05('0xd')](this[_0x2a05('0x9')],'id');this['mapAgentsId'][_0x2a05('0xe')]=_0x4acfee;};OpenchannelQueue[_0x2a05('0xc')][_0x2a05('0xf')]=function(){this[_0x2a05('0x10')]=0x0;this[_0x2a05('0x11')]=0x0;for(var _0x5b1d2f=0x0;_0x5b1d2f=0x0?this[_0x2a05('0x13')]:0x0;var _0x4d6358={'id':this['id'],'available':this[_0x2a05('0x13')],'loggedIn':this[_0x2a05('0x10')],'name':this['name'],'paused':this[_0x2a05('0x11')],'waiting':this['waiting']};var _0x217ceb=md5(JSON['stringify'](_0x4d6358));if(this[_0x2a05('0x0')]!==_0x217ceb){this[_0x2a05('0x0')]=_0x217ceb;io['to'](util[_0x2a05('0x14')](_0x2a05('0x15'),_0x4d6358[_0x2a05('0x6')]))[_0x2a05('0x16')](_0x2a05('0x17'),_0x4d6358);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x8253=['openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','openchannelPause','available','stringify','format'];(function(_0x54b188,_0x28de6d){var _0x4759dc=function(_0x41e5b2){while(--_0x41e5b2){_0x54b188['push'](_0x54b188['shift']());}};_0x4759dc(++_0x28de6d);}(_0x8253,0x1f4));var _0x3825=function(_0x31d98a,_0x292465){_0x31d98a=_0x31d98a-0x0;var _0x56e10e=_0x8253[_0x31d98a];return _0x56e10e;};'use strict';var _=require(_0x3825('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x3825('0x1'));var config=require(_0x3825('0x2'));config[_0x3825('0x3')]=_['defaults'](config[_0x3825('0x3')],{'host':_0x3825('0x4'),'port':0x18eb});var io=require(_0x3825('0x5'))(new Redis(config[_0x3825('0x3')]));function OpenchannelQueue(_0x3c6e95){this['id']=_0x3c6e95['id']||0x0;this[_0x3825('0x6')]=_0x3c6e95['name']||'';this[_0x3825('0x7')]=_0x3c6e95[_0x3825('0x7')]||0xa;this[_0x3825('0x8')]=_0x3c6e95[_0x3825('0x8')]||_0x3825('0x9');this[_0x3825('0xa')]=_0x3c6e95[_0x3825('0xa')];this[_0x3825('0xb')]={};this[_0x3825('0xc')]=0x0;this[_0x3825('0xd')]='';this[_0x3825('0xe')]();this[_0x3825('0xf')]();}OpenchannelQueue[_0x3825('0x10')][_0x3825('0xe')]=function(){var _0x2e6f40=this[_0x3825('0xb')][_0x3825('0x11')];this['mapAgentsId']=_[_0x3825('0x12')](this[_0x3825('0xa')],'id');this[_0x3825('0xb')][_0x3825('0x11')]=_0x2e6f40;};OpenchannelQueue[_0x3825('0x10')]['updateRealtime']=function(){this[_0x3825('0x13')]=0x0;this[_0x3825('0x14')]=0x0;for(var _0x4b204f=0x0;_0x4b204f=0x0?this[_0x3825('0x18')]:0x0;var _0xab5f72={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3825('0x13')],'name':this[_0x3825('0x6')],'paused':this[_0x3825('0x14')],'waiting':this[_0x3825('0xc')]};var _0x885e0d=md5(JSON[_0x3825('0x19')](_0xab5f72));if(this['md5']!==_0x885e0d){this['md5']=_0x885e0d;io['to'](util[_0x3825('0x1a')](_0x3825('0x1b'),_0xab5f72['name']))[_0x3825('0x1c')](_0x3825('0x1d'),_0xab5f72);}};module[_0x3825('0x1e')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 3fa1122..e8840a2 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=['smsPause','paused','available','stringify','sms:queue:%s','emit','sms_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','online'];(function(_0x6c6d75,_0xef7deb){var _0x48a161=function(_0xf0fba0){while(--_0xf0fba0){_0x6c6d75['push'](_0x6c6d75['shift']());}};_0x48a161(++_0xef7deb);}(_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 Redis=require(_0x3071('0x1'));var config=require(_0x3071('0x2'));config[_0x3071('0x3')]=_[_0x3071('0x4')](config['redis'],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x3')]));function SmsQueue(_0x3137c8){this['id']=_0x3137c8['id']||0x0;this[_0x3071('0x7')]=_0x3137c8[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0x3137c8[_0x3071('0x8')]||0xa;this[_0x3071('0x9')]=_0x3137c8[_0x3071('0x9')]||_0x3071('0xa');this[_0x3071('0xb')]=_0x3137c8[_0x3071('0xb')];this['mapAgentsId']={};this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]='';this[_0x3071('0xe')]();this[_0x3071('0xf')]();}SmsQueue[_0x3071('0x10')]['updateRouting']=function(){var _0x2ace21=this[_0x3071('0x11')][_0x3071('0x12')];this[_0x3071('0x11')]=_[_0x3071('0x13')](this['Agents'],'id');this['mapAgentsId'][_0x3071('0x12')]=_0x2ace21;};SmsQueue['prototype'][_0x3071('0xf')]=function(){this[_0x3071('0x14')]=0x0;this['paused']=0x0;for(var _0x104e73=0x0;_0x104e73=0x0?this[_0x3071('0x19')]:0x0;var _0x1068d9={'id':this['id'],'available':this[_0x3071('0x19')],'loggedIn':this[_0x3071('0x14')],'name':this[_0x3071('0x7')],'paused':this[_0x3071('0x18')],'waiting':this[_0x3071('0xc')]};var _0x502a16=md5(JSON[_0x3071('0x1a')](_0x1068d9));if(this[_0x3071('0xd')]!==_0x502a16){this[_0x3071('0xd')]=_0x502a16;io['to'](util['format'](_0x3071('0x1b'),_0x1068d9['name']))[_0x3071('0x1c')](_0x3071('0x1d'),_0x1068d9);}};module[_0x3071('0x1e')]=SmsQueue; \ No newline at end of file +var _0xe706=['prototype','_rr','map','online','loggedIn','smsPause','available','paused','stringify','format','sms:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x281372,_0x2a5398){var _0x4957b6=function(_0x3918ed){while(--_0x3918ed){_0x281372['push'](_0x281372['shift']());}};_0x4957b6(++_0x2a5398);}(_0xe706,0xa3));var _0x6e70=function(_0x50309e,_0x5ab9fb){_0x50309e=_0x50309e-0x0;var _0x4080ae=_0xe706[_0x50309e];return _0x4080ae;};'use strict';var _=require(_0x6e70('0x0'));var md5=require(_0x6e70('0x1'));var util=require(_0x6e70('0x2'));var Redis=require('ioredis');var config=require(_0x6e70('0x3'));config[_0x6e70('0x4')]=_[_0x6e70('0x5')](config[_0x6e70('0x4')],{'host':_0x6e70('0x6'),'port':0x18eb});var io=require(_0x6e70('0x7'))(new Redis(config[_0x6e70('0x4')]));function SmsQueue(_0x506db9){this['id']=_0x506db9['id']||0x0;this[_0x6e70('0x8')]=_0x506db9[_0x6e70('0x8')]||'';this[_0x6e70('0x9')]=_0x506db9[_0x6e70('0x9')]||0xa;this[_0x6e70('0xa')]=_0x506db9[_0x6e70('0xa')]||_0x6e70('0xb');this[_0x6e70('0xc')]=_0x506db9[_0x6e70('0xc')];this[_0x6e70('0xd')]={};this[_0x6e70('0xe')]=0x0;this[_0x6e70('0x1')]='';this[_0x6e70('0xf')]();this[_0x6e70('0x10')]();}SmsQueue[_0x6e70('0x11')][_0x6e70('0xf')]=function(){var _0x5b3d07=this['mapAgentsId'][_0x6e70('0x12')];this[_0x6e70('0xd')]=_[_0x6e70('0x13')](this[_0x6e70('0xc')],'id');this[_0x6e70('0xd')][_0x6e70('0x12')]=_0x5b3d07;};SmsQueue[_0x6e70('0x11')][_0x6e70('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x48bc72=0x0;_0x48bc72=0x0?this['available']:0x0;var _0x28a21f={'id':this['id'],'available':this[_0x6e70('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x6e70('0x18')],'waiting':this[_0x6e70('0xe')]};var _0x2368eb=md5(JSON[_0x6e70('0x19')](_0x28a21f));if(this[_0x6e70('0x1')]!==_0x2368eb){this[_0x6e70('0x1')]=_0x2368eb;io['to'](util[_0x6e70('0x1a')](_0x6e70('0x1b'),_0x28a21f[_0x6e70('0x8')]))[_0x6e70('0x1c')]('sms_queue:save',_0x28a21f);}};module[_0x6e70('0x1d')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 176ebd7..04f0272 100644 --- a/server/services/routing/model/whatsappQueue.js +++ b/server/services/routing/model/whatsappQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77c3=['online','whatsappPause','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length'];(function(_0xd6df91,_0x5e327a){var _0x329673=function(_0x196a68){while(--_0x196a68){_0xd6df91['push'](_0xd6df91['shift']());}};_0x329673(++_0x5e327a);}(_0x77c3,0xda));var _0x377c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77c3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require(_0x377c('0x0'));var util=require(_0x377c('0x1'));var Redis=require(_0x377c('0x2'));var config=require(_0x377c('0x3'));config[_0x377c('0x4')]=_[_0x377c('0x5')](config[_0x377c('0x4')],{'host':_0x377c('0x6'),'port':0x18eb});var io=require(_0x377c('0x7'))(new Redis(config[_0x377c('0x4')]));function WhatsappQueue(_0x158357){this['id']=_0x158357['id']||0x0;this['name']=_0x158357[_0x377c('0x8')]||'';this[_0x377c('0x9')]=_0x158357[_0x377c('0x9')]||0xa;this['strategy']=_0x158357[_0x377c('0xa')]||_0x377c('0xb');this[_0x377c('0xc')]=_0x158357[_0x377c('0xc')];this[_0x377c('0xd')]={};this[_0x377c('0xe')]=0x0;this[_0x377c('0x0')]='';this[_0x377c('0xf')]();this['updateRealtime']();}WhatsappQueue[_0x377c('0x10')][_0x377c('0xf')]=function(){var _0x1a9326=this[_0x377c('0xd')][_0x377c('0x11')];this[_0x377c('0xd')]=_['map'](this[_0x377c('0xc')],'id');this['mapAgentsId']['_rr']=_0x1a9326;};WhatsappQueue[_0x377c('0x10')][_0x377c('0x12')]=function(){this[_0x377c('0x13')]=0x0;this[_0x377c('0x14')]=0x0;for(var _0x317ab8=0x0;_0x317ab8=0x0?this[_0x377c('0x18')]:0x0;var _0x138aee={'id':this['id'],'available':this[_0x377c('0x18')],'loggedIn':this[_0x377c('0x13')],'name':this[_0x377c('0x8')],'paused':this[_0x377c('0x14')],'waiting':this[_0x377c('0xe')]};var _0x538423=md5(JSON['stringify'](_0x138aee));if(this[_0x377c('0x0')]!==_0x538423){this['md5']=_0x538423;io['to'](util[_0x377c('0x19')](_0x377c('0x1a'),_0x138aee['name']))[_0x377c('0x1b')](_0x377c('0x1c'),_0x138aee);}};module[_0x377c('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0x7a81=['localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','whatsappPause','available','paused','format','emit','whatsapp_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults'];(function(_0x537e14,_0xfe1edd){var _0x529e0b=function(_0x302b15){while(--_0x302b15){_0x537e14['push'](_0x537e14['shift']());}};_0x529e0b(++_0xfe1edd);}(_0x7a81,0x190));var _0x17a8=function(_0x4131d9,_0x29dd20){_0x4131d9=_0x4131d9-0x0;var _0x2a2491=_0x7a81[_0x4131d9];return _0x2a2491;};'use strict';var _=require(_0x17a8('0x0'));var md5=require(_0x17a8('0x1'));var util=require(_0x17a8('0x2'));var Redis=require('ioredis');var config=require(_0x17a8('0x3'));config[_0x17a8('0x4')]=_[_0x17a8('0x5')](config[_0x17a8('0x4')],{'host':_0x17a8('0x6'),'port':0x18eb});var io=require(_0x17a8('0x7'))(new Redis(config[_0x17a8('0x4')]));function WhatsappQueue(_0x2ee4c0){this['id']=_0x2ee4c0['id']||0x0;this[_0x17a8('0x8')]=_0x2ee4c0['name']||'';this[_0x17a8('0x9')]=_0x2ee4c0[_0x17a8('0x9')]||0xa;this[_0x17a8('0xa')]=_0x2ee4c0[_0x17a8('0xa')]||'beepall';this[_0x17a8('0xb')]=_0x2ee4c0[_0x17a8('0xb')];this[_0x17a8('0xc')]={};this[_0x17a8('0xd')]=0x0;this[_0x17a8('0x1')]='';this[_0x17a8('0xe')]();this[_0x17a8('0xf')]();}WhatsappQueue[_0x17a8('0x10')]['updateRouting']=function(){var _0x55a94a=this[_0x17a8('0xc')][_0x17a8('0x11')];this['mapAgentsId']=_[_0x17a8('0x12')](this[_0x17a8('0xb')],'id');this[_0x17a8('0xc')]['_rr']=_0x55a94a;};WhatsappQueue[_0x17a8('0x10')][_0x17a8('0xf')]=function(){this[_0x17a8('0x13')]=0x0;this['paused']=0x0;for(var _0x560405=0x0;_0x560405=0x0?this[_0x17a8('0x17')]:0x0;var _0x38c72c={'id':this['id'],'available':this[_0x17a8('0x17')],'loggedIn':this[_0x17a8('0x13')],'name':this[_0x17a8('0x8')],'paused':this[_0x17a8('0x18')],'waiting':this[_0x17a8('0xd')]};var _0x2da836=md5(JSON['stringify'](_0x38c72c));if(this['md5']!==_0x2da836){this['md5']=_0x2da836;io['to'](util[_0x17a8('0x19')]('whatsapp:queue:%s',_0x38c72c[_0x17a8('0x8')]))[_0x17a8('0x1a')](_0x17a8('0x1b'),_0x38c72c);}};module[_0x17a8('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 7c4e9f2..8301b0e 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 _0x7217=['../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','mergeFromDatabase','initOpenchannelQueues','updateRouting','updateRealtime','initFaxQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7217,0x19e));var _0x7721=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x7217[_0x297fd3];return _0x2af381;};'use strict';var BPromise=require(_0x7721('0x0'));var util=require('util');var _=require(_0x7721('0x1'));var moment=require(_0x7721('0x2'));var Agent=require(_0x7721('0x3'));var Interval=require(_0x7721('0x4'));var OpenchannelQueue=require(_0x7721('0x5'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require('../model/smsQueue');var MailQueue=require(_0x7721('0x6'));var FaxQueue=require(_0x7721('0x7'));var WhatsappQueue=require(_0x7721('0x8'));var Realtime=function(){this[_0x7721('0x9')]={};this[_0x7721('0xa')]={};this[_0x7721('0xb')]={};this[_0x7721('0xc')]={};this[_0x7721('0xd')]={};this[_0x7721('0xe')]={};this[_0x7721('0xf')]={};this[_0x7721('0x10')]={};this[_0x7721('0x11')]={};this[_0x7721('0x12')]={};this[_0x7721('0x13')]={};this[_0x7721('0x14')]={};this['faxQueuesWaitingInteractions']={};this[_0x7721('0x15')]={};};function freeIsNotKey(_0x29bc8f,_0x8729a6,_0xf78099){var _0xa8977c=_[_0x7721('0x16')](_0x29bc8f,function(_0x1e7fd7,_0x27b36b){return _0x1e7fd7[_0xf78099];});for(var _0x55b4ca in _0x8729a6){if(_0x8729a6[_0x7721('0x17')](_0x55b4ca)){if(!_0xa8977c[_0x55b4ca]){delete _0x8729a6[_0x55b4ca];}}}}Realtime[_0x7721('0x18')]['mergeFromDatabase']=function(_0x109900,_0x30da54){for(var _0x3f01c5 in _0x30da54){if(_0x109900[_0x7721('0x17')](_0x3f01c5)){_0x109900[_0x3f01c5]=_0x30da54[_0x3f01c5];}}};Realtime['prototype'][_0x7721('0x19')]=function(){var _0x25b1c0=this;return function(_0x534f1b){if(_0x534f1b){freeIsNotKey(_0x534f1b,_0x25b1c0['agents'],'id');for(var _0x4b183e=0x0,_0x5ed54={},_0x25a628={};_0x4b183e<_0x534f1b[_0x7721('0x1a')];_0x4b183e+=0x1){_0x5ed54=_0x534f1b[_0x4b183e];if(_[_0x7721('0x1b')](_0x25b1c0['agents'][_0x5ed54['id']])){_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']]=new Agent(_0x5ed54);}else{_0x25b1c0['mergeFromDatabase'](_0x25b1c0[_0x7721('0x9')][_0x5ed54['id']],_0x5ed54);}}}return _0x25b1c0['agents'];};};Realtime[_0x7721('0x18')][_0x7721('0x1c')]=function(){var _0x3ab5a5=this;return function(_0x3e140d){if(_0x3e140d){freeIsNotKey(_0x3e140d,_0x3ab5a5[_0x7721('0xa')],'id');for(var _0x40af90=0x0,_0x402820={},_0x413263={};_0x40af90<_0x3e140d[_0x7721('0x1a')];_0x40af90+=0x1){_0x402820=_0x3e140d[_0x40af90];if(_[_0x7721('0x1b')](_0x3ab5a5['intervals'][_0x402820['id']])){_0x3ab5a5[_0x7721('0xa')][_0x402820['id']]=new Interval(_0x402820);}else{_0x3ab5a5[_0x7721('0x1d')](_0x3ab5a5[_0x7721('0xa')][_0x402820['id']],_0x402820);}}}return _0x3ab5a5[_0x7721('0xa')];};};Realtime['prototype'][_0x7721('0x1e')]=function(){var _0x512f31=this;return function(_0xb9e9dd){if(_0xb9e9dd){freeIsNotKey(_0xb9e9dd,_0x512f31[_0x7721('0xb')],'id');for(var _0x3e8a4e=0x0,_0x1caad8={},_0x121cc4={};_0x3e8a4e<_0xb9e9dd[_0x7721('0x1a')];_0x3e8a4e+=0x1){_0x1caad8=_0xb9e9dd[_0x3e8a4e];if(_[_0x7721('0x1b')](_0x512f31['openchannelQueues'][_0x1caad8['id']])){_0x512f31[_0x7721('0xb')][_0x1caad8['id']]=new OpenchannelQueue(_0x1caad8);}else{_0x512f31[_0x7721('0x1d')](_0x512f31[_0x7721('0xb')][_0x1caad8['id']],_0x1caad8);}_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x1f')]();_0x512f31[_0x7721('0xb')][_0x1caad8['id']][_0x7721('0x20')]();}}return _0x512f31[_0x7721('0xb')];};};Realtime[_0x7721('0x18')]['initChatQueues']=function(){var _0x258ddf=this;return function(_0x5b0551){if(_0x5b0551){freeIsNotKey(_0x5b0551,_0x258ddf['chatQueues'],'id');for(var _0x315202=0x0,_0x343c19={},_0x53c904={};_0x315202<_0x5b0551[_0x7721('0x1a')];_0x315202+=0x1){_0x343c19=_0x5b0551[_0x315202];if(_[_0x7721('0x1b')](_0x258ddf[_0x7721('0xc')][_0x343c19['id']])){_0x258ddf[_0x7721('0xc')][_0x343c19['id']]=new ChatQueue(_0x343c19);}else{_0x258ddf[_0x7721('0x1d')](_0x258ddf['chatQueues'][_0x343c19['id']],_0x343c19);}_0x258ddf[_0x7721('0xc')][_0x343c19['id']][_0x7721('0x1f')]();_0x258ddf['chatQueues'][_0x343c19['id']]['updateRealtime']();}}return _0x258ddf[_0x7721('0xc')];};};Realtime[_0x7721('0x18')]['initSmsQueues']=function(){var _0x46f772=this;return function(_0x4651b5){if(_0x4651b5){freeIsNotKey(_0x4651b5,_0x46f772[_0x7721('0xd')],'id');for(var _0x58d54b=0x0,_0x3d9a32={},_0x1ff31b={};_0x58d54b<_0x4651b5[_0x7721('0x1a')];_0x58d54b+=0x1){_0x3d9a32=_0x4651b5[_0x58d54b];if(_[_0x7721('0x1b')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']])){_0x46f772['smsQueues'][_0x3d9a32['id']]=new SmsQueue(_0x3d9a32);}else{_0x46f772[_0x7721('0x1d')](_0x46f772[_0x7721('0xd')][_0x3d9a32['id']],_0x3d9a32);}_0x46f772[_0x7721('0xd')][_0x3d9a32['id']]['updateRouting']();_0x46f772[_0x7721('0xd')][_0x3d9a32['id']][_0x7721('0x20')]();}}return _0x46f772['smsQueues'];};};Realtime[_0x7721('0x18')]['initMailQueues']=function(){var _0x2d6ba0=this;return function(_0x326c50){if(_0x326c50){freeIsNotKey(_0x326c50,_0x2d6ba0[_0x7721('0xe')],'id');for(var _0x1d894b=0x0,_0x1c84c0={},_0x13c635={};_0x1d894b<_0x326c50[_0x7721('0x1a')];_0x1d894b+=0x1){_0x1c84c0=_0x326c50[_0x1d894b];if(_[_0x7721('0x1b')](_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']])){_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]=new MailQueue(_0x1c84c0);}else{_0x2d6ba0[_0x7721('0x1d')](_0x2d6ba0['mailQueues'][_0x1c84c0['id']],_0x1c84c0);}_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']]['updateRouting']();_0x2d6ba0[_0x7721('0xe')][_0x1c84c0['id']][_0x7721('0x20')]();}}return _0x2d6ba0[_0x7721('0xe')];};};Realtime[_0x7721('0x18')][_0x7721('0x21')]=function(){var _0x378ba5=this;return function(_0x482b70){if(_0x482b70){freeIsNotKey(_0x482b70,_0x378ba5['faxQueues'],'id');for(var _0x4cadef=0x0,_0x539560={},_0x18001c={};_0x4cadef<_0x482b70[_0x7721('0x1a')];_0x4cadef+=0x1){_0x539560=_0x482b70[_0x4cadef];if(_[_0x7721('0x1b')](_0x378ba5[_0x7721('0xf')][_0x539560['id']])){_0x378ba5['faxQueues'][_0x539560['id']]=new FaxQueue(_0x539560);}else{_0x378ba5[_0x7721('0x1d')](_0x378ba5['faxQueues'][_0x539560['id']],_0x539560);}_0x378ba5[_0x7721('0xf')][_0x539560['id']][_0x7721('0x1f')]();_0x378ba5['faxQueues'][_0x539560['id']][_0x7721('0x20')]();}}return _0x378ba5[_0x7721('0xf')];};};Realtime['prototype']['initWhatsappQueues']=function(){var _0x3d84d3=this;return function(_0xfc4dc4){if(_0xfc4dc4){freeIsNotKey(_0xfc4dc4,_0x3d84d3[_0x7721('0x10')],'id');for(var _0x15e34d=0x0,_0x577af9={},_0x2db173={};_0x15e34d<_0xfc4dc4[_0x7721('0x1a')];_0x15e34d+=0x1){_0x577af9=_0xfc4dc4[_0x15e34d];if(_[_0x7721('0x1b')](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']])){_0x3d84d3[_0x7721('0x10')][_0x577af9['id']]=new WhatsappQueue(_0x577af9);}else{_0x3d84d3['mergeFromDatabase'](_0x3d84d3[_0x7721('0x10')][_0x577af9['id']],_0x577af9);}_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x1f')]();_0x3d84d3['whatsappQueues'][_0x577af9['id']][_0x7721('0x20')]();}}return _0x3d84d3[_0x7721('0x10')];};};module[_0x7721('0x22')]=Realtime; \ No newline at end of file +var _0x9957=['../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','moment','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/faxQueue'];(function(_0x5f31a0,_0x28972b){var _0x56aac2=function(_0x1cdf96){while(--_0x1cdf96){_0x5f31a0['push'](_0x5f31a0['shift']());}};_0x56aac2(++_0x28972b);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var BPromise=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var _=require(_0x7995('0x2'));var moment=require(_0x7995('0x3'));var Agent=require('../model/agent');var Interval=require(_0x7995('0x4'));var OpenchannelQueue=require(_0x7995('0x5'));var ChatQueue=require(_0x7995('0x6'));var SmsQueue=require(_0x7995('0x7'));var MailQueue=require('../model/mailQueue');var FaxQueue=require(_0x7995('0x8'));var WhatsappQueue=require(_0x7995('0x9'));var Realtime=function(){this[_0x7995('0xa')]={};this[_0x7995('0xb')]={};this[_0x7995('0xc')]={};this[_0x7995('0xd')]={};this['smsQueues']={};this[_0x7995('0xe')]={};this[_0x7995('0xf')]={};this['whatsappQueues']={};this[_0x7995('0x10')]={};this[_0x7995('0x11')]={};this[_0x7995('0x12')]={};this[_0x7995('0x13')]={};this[_0x7995('0x14')]={};this[_0x7995('0x15')]={};};function freeIsNotKey(_0x341672,_0x524f7b,_0x245143){var _0x41c652=_['mapKeys'](_0x341672,function(_0xb0c872,_0x2cb37a){return _0xb0c872[_0x245143];});for(var _0x19a27e in _0x524f7b){if(_0x524f7b[_0x7995('0x16')](_0x19a27e)){if(!_0x41c652[_0x19a27e]){delete _0x524f7b[_0x19a27e];}}}}Realtime[_0x7995('0x17')][_0x7995('0x18')]=function(_0x2bbe7a,_0x4cc004){for(var _0x58f5ad in _0x4cc004){if(_0x2bbe7a[_0x7995('0x16')](_0x58f5ad)){_0x2bbe7a[_0x58f5ad]=_0x4cc004[_0x58f5ad];}}};Realtime[_0x7995('0x17')][_0x7995('0x19')]=function(){var _0x321ae8=this;return function(_0x3f1d3e){if(_0x3f1d3e){freeIsNotKey(_0x3f1d3e,_0x321ae8[_0x7995('0xa')],'id');for(var _0x2202ce=0x0,_0x41cbf0={},_0x5377e5={};_0x2202ce<_0x3f1d3e[_0x7995('0x1a')];_0x2202ce+=0x1){_0x41cbf0=_0x3f1d3e[_0x2202ce];if(_['isUndefined'](_0x321ae8[_0x7995('0xa')][_0x41cbf0['id']])){_0x321ae8[_0x7995('0xa')][_0x41cbf0['id']]=new Agent(_0x41cbf0);}else{_0x321ae8[_0x7995('0x18')](_0x321ae8[_0x7995('0xa')][_0x41cbf0['id']],_0x41cbf0);}}}return _0x321ae8[_0x7995('0xa')];};};Realtime[_0x7995('0x17')]['initIntervals']=function(){var _0x54c9ae=this;return function(_0x2536c8){if(_0x2536c8){freeIsNotKey(_0x2536c8,_0x54c9ae['intervals'],'id');for(var _0x555f74=0x0,_0x3ec178={},_0x3d463e={};_0x555f74<_0x2536c8['length'];_0x555f74+=0x1){_0x3ec178=_0x2536c8[_0x555f74];if(_[_0x7995('0x1b')](_0x54c9ae['intervals'][_0x3ec178['id']])){_0x54c9ae['intervals'][_0x3ec178['id']]=new Interval(_0x3ec178);}else{_0x54c9ae[_0x7995('0x18')](_0x54c9ae[_0x7995('0xb')][_0x3ec178['id']],_0x3ec178);}}}return _0x54c9ae[_0x7995('0xb')];};};Realtime[_0x7995('0x17')][_0x7995('0x1c')]=function(){var _0x1c278a=this;return function(_0x5d40ae){if(_0x5d40ae){freeIsNotKey(_0x5d40ae,_0x1c278a[_0x7995('0xc')],'id');for(var _0x46ee4b=0x0,_0x204507={},_0x285437={};_0x46ee4b<_0x5d40ae[_0x7995('0x1a')];_0x46ee4b+=0x1){_0x204507=_0x5d40ae[_0x46ee4b];if(_[_0x7995('0x1b')](_0x1c278a[_0x7995('0xc')][_0x204507['id']])){_0x1c278a[_0x7995('0xc')][_0x204507['id']]=new OpenchannelQueue(_0x204507);}else{_0x1c278a['mergeFromDatabase'](_0x1c278a[_0x7995('0xc')][_0x204507['id']],_0x204507);}_0x1c278a[_0x7995('0xc')][_0x204507['id']][_0x7995('0x1d')]();_0x1c278a[_0x7995('0xc')][_0x204507['id']][_0x7995('0x1e')]();}}return _0x1c278a[_0x7995('0xc')];};};Realtime['prototype'][_0x7995('0x1f')]=function(){var _0x5911c3=this;return function(_0x229742){if(_0x229742){freeIsNotKey(_0x229742,_0x5911c3[_0x7995('0xd')],'id');for(var _0xf16cc2=0x0,_0x132a42={},_0x11c1eb={};_0xf16cc2<_0x229742['length'];_0xf16cc2+=0x1){_0x132a42=_0x229742[_0xf16cc2];if(_[_0x7995('0x1b')](_0x5911c3['chatQueues'][_0x132a42['id']])){_0x5911c3[_0x7995('0xd')][_0x132a42['id']]=new ChatQueue(_0x132a42);}else{_0x5911c3[_0x7995('0x18')](_0x5911c3[_0x7995('0xd')][_0x132a42['id']],_0x132a42);}_0x5911c3['chatQueues'][_0x132a42['id']]['updateRouting']();_0x5911c3['chatQueues'][_0x132a42['id']][_0x7995('0x1e')]();}}return _0x5911c3[_0x7995('0xd')];};};Realtime[_0x7995('0x17')][_0x7995('0x20')]=function(){var _0x2e3493=this;return function(_0x1ca460){if(_0x1ca460){freeIsNotKey(_0x1ca460,_0x2e3493['smsQueues'],'id');for(var _0x481c74=0x0,_0xfa8f15={},_0x5524af={};_0x481c74<_0x1ca460[_0x7995('0x1a')];_0x481c74+=0x1){_0xfa8f15=_0x1ca460[_0x481c74];if(_[_0x7995('0x1b')](_0x2e3493[_0x7995('0x21')][_0xfa8f15['id']])){_0x2e3493[_0x7995('0x21')][_0xfa8f15['id']]=new SmsQueue(_0xfa8f15);}else{_0x2e3493[_0x7995('0x18')](_0x2e3493['smsQueues'][_0xfa8f15['id']],_0xfa8f15);}_0x2e3493[_0x7995('0x21')][_0xfa8f15['id']][_0x7995('0x1d')]();_0x2e3493['smsQueues'][_0xfa8f15['id']]['updateRealtime']();}}return _0x2e3493['smsQueues'];};};Realtime[_0x7995('0x17')][_0x7995('0x22')]=function(){var _0x4a176f=this;return function(_0x3e7020){if(_0x3e7020){freeIsNotKey(_0x3e7020,_0x4a176f['mailQueues'],'id');for(var _0x37917b=0x0,_0x1cb058={},_0x177cb4={};_0x37917b<_0x3e7020['length'];_0x37917b+=0x1){_0x1cb058=_0x3e7020[_0x37917b];if(_['isUndefined'](_0x4a176f[_0x7995('0xe')][_0x1cb058['id']])){_0x4a176f['mailQueues'][_0x1cb058['id']]=new MailQueue(_0x1cb058);}else{_0x4a176f['mergeFromDatabase'](_0x4a176f[_0x7995('0xe')][_0x1cb058['id']],_0x1cb058);}_0x4a176f[_0x7995('0xe')][_0x1cb058['id']]['updateRouting']();_0x4a176f[_0x7995('0xe')][_0x1cb058['id']][_0x7995('0x1e')]();}}return _0x4a176f[_0x7995('0xe')];};};Realtime[_0x7995('0x17')][_0x7995('0x23')]=function(){var _0x53002a=this;return function(_0x2d4285){if(_0x2d4285){freeIsNotKey(_0x2d4285,_0x53002a[_0x7995('0xf')],'id');for(var _0xf612e6=0x0,_0x1d60b8={},_0x4b1541={};_0xf612e6<_0x2d4285[_0x7995('0x1a')];_0xf612e6+=0x1){_0x1d60b8=_0x2d4285[_0xf612e6];if(_[_0x7995('0x1b')](_0x53002a[_0x7995('0xf')][_0x1d60b8['id']])){_0x53002a[_0x7995('0xf')][_0x1d60b8['id']]=new FaxQueue(_0x1d60b8);}else{_0x53002a[_0x7995('0x18')](_0x53002a[_0x7995('0xf')][_0x1d60b8['id']],_0x1d60b8);}_0x53002a['faxQueues'][_0x1d60b8['id']][_0x7995('0x1d')]();_0x53002a[_0x7995('0xf')][_0x1d60b8['id']][_0x7995('0x1e')]();}}return _0x53002a[_0x7995('0xf')];};};Realtime[_0x7995('0x17')][_0x7995('0x24')]=function(){var _0x14d638=this;return function(_0x270c0e){if(_0x270c0e){freeIsNotKey(_0x270c0e,_0x14d638[_0x7995('0x25')],'id');for(var _0x447981=0x0,_0x6fe77b={},_0x270d52={};_0x447981<_0x270c0e[_0x7995('0x1a')];_0x447981+=0x1){_0x6fe77b=_0x270c0e[_0x447981];if(_['isUndefined'](_0x14d638['whatsappQueues'][_0x6fe77b['id']])){_0x14d638[_0x7995('0x25')][_0x6fe77b['id']]=new WhatsappQueue(_0x6fe77b);}else{_0x14d638[_0x7995('0x18')](_0x14d638['whatsappQueues'][_0x6fe77b['id']],_0x6fe77b);}_0x14d638['whatsappQueues'][_0x6fe77b['id']][_0x7995('0x1d')]();_0x14d638['whatsappQueues'][_0x6fe77b['id']]['updateRealtime']();}}return _0x14d638[_0x7995('0x25')];};};module[_0x7995('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 8183c37..951d479 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 _0x03be=['addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction','UpdateChatInteraction','updateChatInteraction'];(function(_0x35444d,_0xf2e83e){var _0x3ddf63=function(_0x5e9e5c){while(--_0x5e9e5c){_0x35444d['push'](_0x35444d['shift']());}};_0x3ddf63(++_0xf2e83e);}(_0x03be,0xe8));var _0xe03b=function(_0x34a853,_0x4b5264){_0x34a853=_0x34a853-0x0;var _0x21c629=_0x03be[_0x34a853];return _0x21c629;};'use strict';var client=require('../client');exports['update']=function(_0x140a78,_0x251814){return client['Request'](_0xe03b('0x0'),{'body':_0x251814,'options':{'where':{'id':_0x140a78}},'log':_0xe03b('0x1')});};exports[_0xe03b('0x2')]=function(_0x76b2d5,_0x128707){return client[_0xe03b('0x3')](_0xe03b('0x4'),{'body':_0x128707,'options':{'where':{'id':_0x76b2d5}},'log':_0xe03b('0x5')});}; \ No newline at end of file +var _0xdc82=['addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction'];(function(_0x27650c,_0x5e654d){var _0x2019ed=function(_0x432e42){while(--_0x432e42){_0x27650c['push'](_0x27650c['shift']());}};_0x2019ed(++_0x5e654d);}(_0xdc82,0x17d));var _0x2dc8=function(_0x1f7b70,_0x13218e){_0x1f7b70=_0x1f7b70-0x0;var _0x6acef3=_0xdc82[_0x1f7b70];return _0x6acef3;};'use strict';var client=require(_0x2dc8('0x0'));exports[_0x2dc8('0x1')]=function(_0x222659,_0x584a4a){return client[_0x2dc8('0x2')](_0x2dc8('0x3'),{'body':_0x584a4a,'options':{'where':{'id':_0x222659}},'log':'updateChatInteraction'});};exports[_0x2dc8('0x4')]=function(_0x15816c,_0x2cd483){return client[_0x2dc8('0x2')](_0x2dc8('0x5'),{'body':_0x2cd483,'options':{'where':{'id':_0x15816c}},'log':_0x2dc8('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 622e115..321f240 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 _0x42d9=['createChatMessage','create','Request'];(function(_0x3d9040,_0x56d4cb){var _0x21b898=function(_0x121a10){while(--_0x121a10){_0x3d9040['push'](_0x3d9040['shift']());}};_0x21b898(++_0x56d4cb);}(_0x42d9,0x199));var _0x942d=function(_0x40bdbc,_0x3fabcd){_0x40bdbc=_0x40bdbc-0x0;var _0xc603a8=_0x42d9[_0x40bdbc];return _0xc603a8;};'use strict';var client=require('../client');exports[_0x942d('0x0')]=function(_0x6d39b4){return client[_0x942d('0x1')]('CreateChatMessage',{'body':_0x6d39b4,'log':_0x942d('0x2')});}; \ No newline at end of file +var _0x5c85=['Request','CreateChatMessage'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x5c85,0x132));var _0x55c8=function(_0x2f88b2,_0x26c631){_0x2f88b2=_0x2f88b2-0x0;var _0x2f4586=_0x5c85[_0x2f88b2];return _0x2f4586;};'use strict';var client=require('../client');exports['create']=function(_0x5a10cf){return client[_0x55c8('0x0')](_0x55c8('0x1'),{'body':_0x5a10cf,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 5a64da2..3878e41 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 _0x8cdc=['getChatQueues','GetChatQueue','name','strategy','User','Agents','chatPause','../client'];(function(_0x466161,_0x29cc00){var _0x2f9c1d=function(_0x1b76cc){while(--_0x1b76cc){_0x466161['push'](_0x466161['shift']());}};_0x2f9c1d(++_0x29cc00);}(_0x8cdc,0xff));var _0xc8cd=function(_0x2f1cab,_0x22bfb5){_0x2f1cab=_0x2f1cab-0x0;var _0x368201=_0x8cdc[_0x2f1cab];return _0x368201;};'use strict';var client=require(_0xc8cd('0x0'));exports[_0xc8cd('0x1')]=function(){return function(){return client['Request'](_0xc8cd('0x2'),{'options':{'raw':![],'attributes':['id',_0xc8cd('0x3'),'timeout',_0xc8cd('0x4')],'include':[{'model':_0xc8cd('0x5'),'as':_0xc8cd('0x6'),'attributes':['id','name','online',_0xc8cd('0x7')]}]},'log':_0xc8cd('0x1')});};}; \ No newline at end of file +var _0xdb4b=['name','timeout','User','Agents','online','../client','getChatQueues','Request','GetChatQueue'];(function(_0x2f9849,_0x209c0e){var _0x1aefac=function(_0x127084){while(--_0x127084){_0x2f9849['push'](_0x2f9849['shift']());}};_0x1aefac(++_0x209c0e);}(_0xdb4b,0x9e));var _0xbdb4=function(_0x37a416,_0x14ee6a){_0x37a416=_0x37a416-0x0;var _0x47959e=_0xdb4b[_0x37a416];return _0x47959e;};'use strict';var client=require(_0xbdb4('0x0'));exports[_0xbdb4('0x1')]=function(){return function(){return client[_0xbdb4('0x2')](_0xbdb4('0x3'),{'options':{'raw':![],'attributes':['id',_0xbdb4('0x4'),_0xbdb4('0x5'),'strategy'],'include':[{'model':_0xbdb4('0x6'),'as':_0xbdb4('0x7'),'attributes':['id',_0xbdb4('0x4'),_0xbdb4('0x8'),'chatPause']}]},'log':_0xbdb4('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 9114ab0..bd1e482 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 _0x8a9c=['../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x4ab3a2,_0x24c0c0){var _0x4b02c1=function(_0x11b8ad){while(--_0x11b8ad){_0x4ab3a2['push'](_0x4ab3a2['shift']());}};_0x4b02c1(++_0x24c0c0);}(_0x8a9c,0x12d));var _0xc8a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a9c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc8a9('0x0'));exports[_0xc8a9('0x1')]=function(_0x358e57){return client[_0xc8a9('0x2')](_0xc8a9('0x3'),{'body':_0x358e57,'log':'CreateChatQueueReport'});};exports[_0xc8a9('0x4')]=function(_0x457342,_0x54a19a){return client[_0xc8a9('0x2')](_0xc8a9('0x5'),{'body':_0x54a19a,'options':{'where':{'uniqueid':_0x457342},'order':[['id',_0xc8a9('0x6')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x9879=['CreateChatQueueReport','update','Request','UpdateChatQueueReport','DESC','../client','create'];(function(_0x4ed32d,_0x327695){var _0xf624df=function(_0x29518c){while(--_0x29518c){_0x4ed32d['push'](_0x4ed32d['shift']());}};_0xf624df(++_0x327695);}(_0x9879,0x98));var _0x9987=function(_0xcee4e5,_0x13e429){_0xcee4e5=_0xcee4e5-0x0;var _0x41123c=_0x9879[_0xcee4e5];return _0x41123c;};'use strict';var client=require(_0x9987('0x0'));exports[_0x9987('0x1')]=function(_0x44026e){return client['Request'](_0x9987('0x2'),{'body':_0x44026e,'log':'CreateChatQueueReport'});};exports[_0x9987('0x3')]=function(_0x2e4478,_0x1fd45d){return client[_0x9987('0x4')](_0x9987('0x5'),{'body':_0x1fd45d,'options':{'where':{'uniqueid':_0x2e4478},'order':[['id',_0x9987('0x6')]],'limit':0x1},'log':_0x9987('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 01a1d5e..602053e 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 _0x9a10=['addTags','AddTagsToFaxInteraction','../client','update','Request','UpdateFaxInteraction','updateFaxInteraction'];(function(_0x2b7e9c,_0x236531){var _0x39ac82=function(_0x351563){while(--_0x351563){_0x2b7e9c['push'](_0x2b7e9c['shift']());}};_0x39ac82(++_0x236531);}(_0x9a10,0xcd));var _0x09a1=function(_0x260753,_0x40d265){_0x260753=_0x260753-0x0;var _0x4bbc05=_0x9a10[_0x260753];return _0x4bbc05;};'use strict';var client=require(_0x09a1('0x0'));exports[_0x09a1('0x1')]=function(_0xdcff10,_0x9f7b37){return client[_0x09a1('0x2')](_0x09a1('0x3'),{'body':_0x9f7b37,'options':{'where':{'id':_0xdcff10}},'log':_0x09a1('0x4')});};exports[_0x09a1('0x5')]=function(_0x335016,_0x2282b2){return client['Request'](_0x09a1('0x6'),{'body':_0x2282b2,'options':{'where':{'id':_0x335016}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0xb708=['addTagsToFaxInteraction','update','UpdateFaxInteraction','updateFaxInteraction','addTags','Request','AddTagsToFaxInteraction'];(function(_0x17e64b,_0x25ee37){var _0x376495=function(_0x4671cc){while(--_0x4671cc){_0x17e64b['push'](_0x17e64b['shift']());}};_0x376495(++_0x25ee37);}(_0xb708,0xa9));var _0x8b70=function(_0x27e811,_0x20137c){_0x27e811=_0x27e811-0x0;var _0x1627fa=_0xb708[_0x27e811];return _0x1627fa;};'use strict';var client=require('../client');exports[_0x8b70('0x0')]=function(_0x3b053b,_0x31aade){return client['Request'](_0x8b70('0x1'),{'body':_0x31aade,'options':{'where':{'id':_0x3b053b}},'log':_0x8b70('0x2')});};exports[_0x8b70('0x3')]=function(_0x4d7203,_0x26e9ad){return client[_0x8b70('0x4')](_0x8b70('0x5'),{'body':_0x26e9ad,'options':{'where':{'id':_0x4d7203}},'log':_0x8b70('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 529fb15..9cdb9bd 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 _0xc4a4=['Request','CreateFaxMessage','create'];(function(_0x44a062,_0x3ed528){var _0x23807c=function(_0x25e855){while(--_0x25e855){_0x44a062['push'](_0x44a062['shift']());}};_0x23807c(++_0x3ed528);}(_0xc4a4,0x1e5));var _0x4c4a=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xc4a4[_0x125ff8];return _0x2d9ef;};'use strict';var client=require('../client');exports[_0x4c4a('0x0')]=function(_0x492262){return client[_0x4c4a('0x1')](_0x4c4a('0x2'),{'body':_0x492262,'log':'createFaxMessage'});}; \ No newline at end of file +var _0xe1e4=['create','CreateFaxMessage','createFaxMessage','../client'];(function(_0x1a918d,_0x42d401){var _0x515bc4=function(_0x5cf1fd){while(--_0x5cf1fd){_0x1a918d['push'](_0x1a918d['shift']());}};_0x515bc4(++_0x42d401);}(_0xe1e4,0x1b7));var _0x4e1e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe1e4[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x4e1e('0x0'));exports[_0x4e1e('0x1')]=function(_0x5c34d4){return client['Request'](_0x4e1e('0x2'),{'body':_0x5c34d4,'log':_0x4e1e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 746bacc..e4dfb13 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 _0x38a8=['name','timeout','User','Agents','online','faxPause','getFaxQueues','Request'];(function(_0x25e4a6,_0x8ccecd){var _0x3fe1d1=function(_0x147be5){while(--_0x147be5){_0x25e4a6['push'](_0x25e4a6['shift']());}};_0x3fe1d1(++_0x8ccecd);}(_0x38a8,0x1ce));var _0x838a=function(_0x261038,_0x2fab28){_0x261038=_0x261038-0x0;var _0x2fd230=_0x38a8[_0x261038];return _0x2fd230;};'use strict';var client=require('../client');exports[_0x838a('0x0')]=function(){return function(){return client[_0x838a('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x838a('0x2'),_0x838a('0x3'),'strategy'],'include':[{'model':_0x838a('0x4'),'as':_0x838a('0x5'),'attributes':['id','name',_0x838a('0x6'),_0x838a('0x7')]}]},'log':_0x838a('0x0')});};}; \ No newline at end of file +var _0xe03c=['strategy','Agents','online','faxPause','getFaxQueues','Request','GetFaxQueue','name','timeout'];(function(_0x148da5,_0x47535a){var _0x2e4d80=function(_0x303f8c){while(--_0x303f8c){_0x148da5['push'](_0x148da5['shift']());}};_0x2e4d80(++_0x47535a);}(_0xe03c,0xc1));var _0xce03=function(_0x1db562,_0x290e26){_0x1db562=_0x1db562-0x0;var _0xa58473=_0xe03c[_0x1db562];return _0xa58473;};'use strict';var client=require('../client');exports[_0xce03('0x0')]=function(){return function(){return client[_0xce03('0x1')](_0xce03('0x2'),{'options':{'raw':![],'attributes':['id',_0xce03('0x3'),_0xce03('0x4'),_0xce03('0x5')],'include':[{'model':'User','as':_0xce03('0x6'),'attributes':['id',_0xce03('0x3'),_0xce03('0x7'),_0xce03('0x8')]}]},'log':_0xce03('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 27e019a..d77907b 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 _0x9d2f=['../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x371d83,_0x49a0ce){var _0x27a8b8=function(_0x5acf2d){while(--_0x5acf2d){_0x371d83['push'](_0x371d83['shift']());}};_0x27a8b8(++_0x49a0ce);}(_0x9d2f,0x14a));var _0xf9d2=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x9d2f[_0x42bdad];return _0x122626;};'use strict';var client=require(_0xf9d2('0x0'));exports[_0xf9d2('0x1')]=function(_0x44a021){return client[_0xf9d2('0x2')]('CreateFaxQueueReport',{'body':_0x44a021,'log':_0xf9d2('0x3')});};exports[_0xf9d2('0x4')]=function(_0x2d28fb,_0x46b468){return client[_0xf9d2('0x2')](_0xf9d2('0x5'),{'body':_0x46b468,'options':{'where':{'uniqueid':_0x2d28fb},'order':[['id','DESC']],'limit':0x1},'log':_0xf9d2('0x5')});}; \ No newline at end of file +var _0xc9a8=['Request','update','DESC','../client'];(function(_0x37e26c,_0x2aabcf){var _0x35c4f6=function(_0x54b2b6){while(--_0x54b2b6){_0x37e26c['push'](_0x37e26c['shift']());}};_0x35c4f6(++_0x2aabcf);}(_0xc9a8,0x143));var _0x8c9a=function(_0x545bed,_0x221e96){_0x545bed=_0x545bed-0x0;var _0x16c79c=_0xc9a8[_0x545bed];return _0x16c79c;};'use strict';var client=require(_0x8c9a('0x0'));exports['create']=function(_0x2ed663){return client[_0x8c9a('0x1')]('CreateFaxQueueReport',{'body':_0x2ed663,'log':'CreateFaxQueueReport'});};exports[_0x8c9a('0x2')]=function(_0x3175b9,_0x259798){return client['Request']('UpdateFaxQueueReport',{'body':_0x259798,'options':{'where':{'uniqueid':_0x3175b9},'order':[['id',_0x8c9a('0x3')]],'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 256497e..ee0ee9d 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 _0x2b65=['GetInterval','name','Interval','Intervals','../client','getIntervals','Request'];(function(_0x4252bf,_0xc977d7){var _0x32a218=function(_0x5e278a){while(--_0x5e278a){_0x4252bf['push'](_0x4252bf['shift']());}};_0x32a218(++_0xc977d7);}(_0x2b65,0x131));var _0x52b6=function(_0x42a584,_0x2d9ee3){_0x42a584=_0x42a584-0x0;var _0x56be59=_0x2b65[_0x42a584];return _0x56be59;};'use strict';var client=require(_0x52b6('0x0'));exports[_0x52b6('0x1')]=function(){return function(){return client[_0x52b6('0x2')](_0x52b6('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x52b6('0x4')],'include':[{'model':_0x52b6('0x5'),'as':_0x52b6('0x6'),'attributes':['id',_0x52b6('0x4'),'interval']}]},'log':_0x52b6('0x1')});};}; \ No newline at end of file +var _0xb9a7=['name','interval','getIntervals','Interval'];(function(_0x28ccc8,_0x5c3b98){var _0x5df269=function(_0xa646cc){while(--_0xa646cc){_0x28ccc8['push'](_0x28ccc8['shift']());}};_0x5df269(++_0x5c3b98);}(_0xb9a7,0x112));var _0x7b9a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xb9a7[_0x4d613c];return _0x301fe3;};'use strict';var client=require('../client');exports[_0x7b9a('0x0')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x7b9a('0x1'),'as':'Intervals','attributes':['id',_0x7b9a('0x2'),_0x7b9a('0x3')]}]},'log':_0x7b9a('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index ce6e9ba..aece812 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 _0xf92e=['AddTagsToMailInteraction','../client','update','Request','updateMailInteraction'];(function(_0x53946c,_0x7b20b3){var _0x41706c=function(_0x37624d){while(--_0x37624d){_0x53946c['push'](_0x53946c['shift']());}};_0x41706c(++_0x7b20b3);}(_0xf92e,0xec));var _0xef92=function(_0xdf58d7,_0xb492c0){_0xdf58d7=_0xdf58d7-0x0;var _0x471e99=_0xf92e[_0xdf58d7];return _0x471e99;};'use strict';var client=require(_0xef92('0x0'));exports[_0xef92('0x1')]=function(_0x41cd98,_0x55f3f7){return client[_0xef92('0x2')]('UpdateMailInteraction',{'body':_0x55f3f7,'options':{'where':{'id':_0x41cd98}},'log':_0xef92('0x3')});};exports['addTags']=function(_0x3b4599,_0x3c1787){return client['Request'](_0xef92('0x4'),{'body':_0x3c1787,'options':{'where':{'id':_0x3b4599}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x869a=['updateMailInteraction','addTags','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0x869a,0x11b));var _0xa869=function(_0x41c9dd,_0x5235dc){_0x41c9dd=_0x41c9dd-0x0;var _0xa1e435=_0x869a[_0x41c9dd];return _0xa1e435;};'use strict';var client=require(_0xa869('0x0'));exports[_0xa869('0x1')]=function(_0x174791,_0x27aa77){return client[_0xa869('0x2')](_0xa869('0x3'),{'body':_0x27aa77,'options':{'where':{'id':_0x174791}},'log':_0xa869('0x4')});};exports[_0xa869('0x5')]=function(_0x16576c,_0x4e907d){return client[_0xa869('0x2')]('AddTagsToMailInteraction',{'body':_0x4e907d,'options':{'where':{'id':_0x16576c}},'log':_0xa869('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index ce33ec5..89792d2 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 _0xc22f=['../client','CreateMailMessage','createMailMessage'];(function(_0x20a879,_0x5827a0){var _0x4dff5c=function(_0x368391){while(--_0x368391){_0x20a879['push'](_0x20a879['shift']());}};_0x4dff5c(++_0x5827a0);}(_0xc22f,0xd2));var _0xfc22=function(_0x5c3f4e,_0x51523a){_0x5c3f4e=_0x5c3f4e-0x0;var _0x42559d=_0xc22f[_0x5c3f4e];return _0x42559d;};'use strict';var client=require(_0xfc22('0x0'));exports['create']=function(_0xadcfc5){return client['Request'](_0xfc22('0x1'),{'body':_0xadcfc5,'log':_0xfc22('0x2')});}; \ No newline at end of file +var _0xa15a=['Request','createMailMessage','../client'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xa15a,0x15b));var _0xaa15=function(_0x355b33,_0x73a11b){_0x355b33=_0x355b33-0x0;var _0x137fd8=_0xa15a[_0x355b33];return _0x137fd8;};'use strict';var client=require(_0xaa15('0x0'));exports['create']=function(_0x3f651f){return client[_0xaa15('0x1')]('CreateMailMessage',{'body':_0x3f651f,'log':_0xaa15('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 1a1ce16..bb8120d 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 _0xf561=['../client','getMailQueues','Request','GetMailQueue','name','strategy','User','Agents','mailPause'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf561,0x19e));var _0x1f56=function(_0x1481d0,_0x2dcebe){_0x1481d0=_0x1481d0-0x0;var _0x1af8ff=_0xf561[_0x1481d0];return _0x1af8ff;};'use strict';var client=require(_0x1f56('0x0'));exports[_0x1f56('0x1')]=function(){return function(){return client[_0x1f56('0x2')](_0x1f56('0x3'),{'options':{'raw':![],'attributes':['id',_0x1f56('0x4'),'timeout',_0x1f56('0x5')],'include':[{'model':_0x1f56('0x6'),'as':_0x1f56('0x7'),'attributes':['id','name','online',_0x1f56('0x8')]}]},'log':_0x1f56('0x1')});};}; \ No newline at end of file +var _0x1209=['Agents','../client','getMailQueues','Request','GetMailQueue','name','User'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1209,0x197));var _0x9120=function(_0x29a8d5,_0x288544){_0x29a8d5=_0x29a8d5-0x0;var _0x57842c=_0x1209[_0x29a8d5];return _0x57842c;};'use strict';var client=require(_0x9120('0x0'));exports[_0x9120('0x1')]=function(){return function(){return client[_0x9120('0x2')](_0x9120('0x3'),{'options':{'raw':![],'attributes':['id',_0x9120('0x4'),'timeout','strategy'],'include':[{'model':_0x9120('0x5'),'as':_0x9120('0x6'),'attributes':['id',_0x9120('0x4'),'online','mailPause']}]},'log':_0x9120('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index fb8ac80..f69aed3 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 _0xe5a5=['UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x12c31d,_0x5b2631){var _0x46b4f8=function(_0x51106){while(--_0x51106){_0x12c31d['push'](_0x12c31d['shift']());}};_0x46b4f8(++_0x5b2631);}(_0xe5a5,0x188));var _0x5e5a=function(_0x3e690c,_0x3efc9d){_0x3e690c=_0x3e690c-0x0;var _0x3a960f=_0xe5a5[_0x3e690c];return _0x3a960f;};'use strict';var client=require(_0x5e5a('0x0'));exports[_0x5e5a('0x1')]=function(_0x2b03f3){return client[_0x5e5a('0x2')](_0x5e5a('0x3'),{'body':_0x2b03f3,'log':_0x5e5a('0x3')});};exports['update']=function(_0x91eab6,_0x136a1c){return client[_0x5e5a('0x2')](_0x5e5a('0x4'),{'body':_0x136a1c,'options':{'where':{'uniqueid':_0x91eab6},'order':[['id',_0x5e5a('0x5')]],'limit':0x1},'log':_0x5e5a('0x4')});}; \ No newline at end of file +var _0x657b=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','Request'];(function(_0x549bf0,_0x545544){var _0x583eca=function(_0x2f5ebc){while(--_0x2f5ebc){_0x549bf0['push'](_0x549bf0['shift']());}};_0x583eca(++_0x545544);}(_0x657b,0xf9));var _0xb657=function(_0x2cc6c3,_0x58a320){_0x2cc6c3=_0x2cc6c3-0x0;var _0x1196b4=_0x657b[_0x2cc6c3];return _0x1196b4;};'use strict';var client=require('../client');exports['create']=function(_0x10b959){return client[_0xb657('0x0')](_0xb657('0x1'),{'body':_0x10b959,'log':_0xb657('0x1')});};exports[_0xb657('0x2')]=function(_0x38eebe,_0x3e67d7){return client[_0xb657('0x0')](_0xb657('0x3'),{'body':_0x3e67d7,'options':{'where':{'uniqueid':_0x38eebe},'order':[['id',_0xb657('0x4')]],'limit':0x1},'log':_0xb657('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 4e1e463..a80f485 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 _0xb25c=['updateOpenchannelInteraction','addTags','addTagsToChatInteraction','../client','update','Request'];(function(_0xa5bcc5,_0x144ddc){var _0x49bd8c=function(_0x106f5e){while(--_0x106f5e){_0xa5bcc5['push'](_0xa5bcc5['shift']());}};_0x49bd8c(++_0x144ddc);}(_0xb25c,0x105));var _0xcb25=function(_0x2f8409,_0x369a87){_0x2f8409=_0x2f8409-0x0;var _0x40ad89=_0xb25c[_0x2f8409];return _0x40ad89;};'use strict';var client=require(_0xcb25('0x0'));exports[_0xcb25('0x1')]=function(_0x5d5497,_0x3e01cc){return client[_0xcb25('0x2')]('UpdateOpenchannelInteraction',{'body':_0x3e01cc,'options':{'where':{'id':_0x5d5497}},'log':_0xcb25('0x3')});};exports[_0xcb25('0x4')]=function(_0x5d1ce7,_0x4ba3d6){return client[_0xcb25('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x4ba3d6,'options':{'where':{'id':_0x5d1ce7}},'log':_0xcb25('0x5')});}; \ No newline at end of file +var _0xd49e=['Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xd49e,0x1ef));var _0xed49=function(_0x1f8053,_0x111077){_0x1f8053=_0x1f8053-0x0;var _0x174fd8=_0xd49e[_0x1f8053];return _0x174fd8;};'use strict';var client=require(_0xed49('0x0'));exports[_0xed49('0x1')]=function(_0x212a2d,_0x58867d){return client[_0xed49('0x2')](_0xed49('0x3'),{'body':_0x58867d,'options':{'where':{'id':_0x212a2d}},'log':_0xed49('0x4')});};exports['addTags']=function(_0x1a2958,_0x4e8903){return client['Request'](_0xed49('0x5'),{'body':_0x4e8903,'options':{'where':{'id':_0x1a2958}},'log':_0xed49('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index e3678bb..3e8eb1f 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 _0xbdb7=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create','Request'];(function(_0x5629e1,_0x5ebdd3){var _0x1ac12e=function(_0x4d1b14){while(--_0x4d1b14){_0x5629e1['push'](_0x5629e1['shift']());}};_0x1ac12e(++_0x5ebdd3);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x46ee3c,_0x1c08f0){_0x46ee3c=_0x46ee3c-0x0;var _0x530a97=_0xbdb7[_0x46ee3c];return _0x530a97;};'use strict';var client=require(_0x7bdb('0x0'));exports[_0x7bdb('0x1')]=function(_0x44467d){return client[_0x7bdb('0x2')](_0x7bdb('0x3'),{'body':_0x44467d,'log':_0x7bdb('0x4')});}; \ No newline at end of file +var _0x70e0=['createOpenchannelMessage','../client','create'];(function(_0x3c2b2b,_0x5250d9){var _0x1484f5=function(_0x6c9957){while(--_0x6c9957){_0x3c2b2b['push'](_0x3c2b2b['shift']());}};_0x1484f5(++_0x5250d9);}(_0x70e0,0x17b));var _0x070e=function(_0x1c3cee,_0x392f43){_0x1c3cee=_0x1c3cee-0x0;var _0x39b9fb=_0x70e0[_0x1c3cee];return _0x39b9fb;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateOpenchannelMessage',{'body':_0x198c2e,'log':_0x070e('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 79da4d8..8f0de1b 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 _0x459d=['Request','GetOpenchannelQueue','name','timeout','User','online','../client','getOpenchannelQueues'];(function(_0x44a57b,_0x17d03e){var _0x3d966f=function(_0x3e5b39){while(--_0x3e5b39){_0x44a57b['push'](_0x44a57b['shift']());}};_0x3d966f(++_0x17d03e);}(_0x459d,0x19e));var _0xd459=function(_0x309554,_0x556470){_0x309554=_0x309554-0x0;var _0x5bfec7=_0x459d[_0x309554];return _0x5bfec7;};'use strict';var client=require(_0xd459('0x0'));exports[_0xd459('0x1')]=function(){return function(){return client[_0xd459('0x2')](_0xd459('0x3'),{'options':{'raw':![],'attributes':['id',_0xd459('0x4'),_0xd459('0x5'),'strategy'],'include':[{'model':_0xd459('0x6'),'as':'Agents','attributes':['id',_0xd459('0x4'),_0xd459('0x7'),'openchannelPause']}]},'log':_0xd459('0x1')});};}; \ No newline at end of file +var _0x159d=['timeout','strategy','User','online','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name'];(function(_0x33dc37,_0x34dae7){var _0x1f88d1=function(_0x2a19c8){while(--_0x2a19c8){_0x33dc37['push'](_0x33dc37['shift']());}};_0x1f88d1(++_0x34dae7);}(_0x159d,0x70));var _0xd159=function(_0x5a5b66,_0x57fc6){_0x5a5b66=_0x5a5b66-0x0;var _0x4bb612=_0x159d[_0x5a5b66];return _0x4bb612;};'use strict';var client=require(_0xd159('0x0'));exports[_0xd159('0x1')]=function(){return function(){return client[_0xd159('0x2')](_0xd159('0x3'),{'options':{'raw':![],'attributes':['id',_0xd159('0x4'),_0xd159('0x5'),_0xd159('0x6')],'include':[{'model':_0xd159('0x7'),'as':'Agents','attributes':['id','name',_0xd159('0x8'),'openchannelPause']}]},'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 7238e35..ec37f36 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 _0x7166=['create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x4bb06f,_0x38afac){var _0x4817ff=function(_0x364fb){while(--_0x364fb){_0x4bb06f['push'](_0x4bb06f['shift']());}};_0x4817ff(++_0x38afac);}(_0x7166,0xa8));var _0x6716=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x7166[_0x138f59];return _0x3d114d;};'use strict';var client=require('../client');exports[_0x6716('0x0')]=function(_0x17201c){return client[_0x6716('0x1')]('CreateOpenchannelQueueReport',{'body':_0x17201c,'log':_0x6716('0x2')});};exports[_0x6716('0x3')]=function(_0x2990f1,_0x4cd520){return client[_0x6716('0x1')](_0x6716('0x4'),{'body':_0x4cd520,'options':{'where':{'uniqueid':_0x2990f1},'order':[['id',_0x6716('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0xab29=['UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x69188b,_0x550923){var _0x3320f4=function(_0x27d05b){while(--_0x27d05b){_0x69188b['push'](_0x69188b['shift']());}};_0x3320f4(++_0x550923);}(_0xab29,0x1ec));var _0x9ab2=function(_0x438531,_0x6c96c5){_0x438531=_0x438531-0x0;var _0x18febe=_0xab29[_0x438531];return _0x18febe;};'use strict';var client=require(_0x9ab2('0x0'));exports[_0x9ab2('0x1')]=function(_0x2f8a4d){return client[_0x9ab2('0x2')](_0x9ab2('0x3'),{'body':_0x2f8a4d,'log':_0x9ab2('0x3')});};exports[_0x9ab2('0x4')]=function(_0x4c4777,_0x1903d6){return client[_0x9ab2('0x2')](_0x9ab2('0x5'),{'body':_0x1903d6,'options':{'where':{'uniqueid':_0x4c4777},'order':[['id',_0x9ab2('0x6')]],'limit':0x1},'log':_0x9ab2('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 1580f49..8d3a1dc 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 _0x5f49=['Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x4d2c9c,_0x5440c7){var _0x2b72d3=function(_0x2315fd){while(--_0x2315fd){_0x4d2c9c['push'](_0x4d2c9c['shift']());}};_0x2b72d3(++_0x5440c7);}(_0x5f49,0x166));var _0x95f4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x5f49[_0x3d42d8];return _0x27fc41;};'use strict';var client=require(_0x95f4('0x0'));exports[_0x95f4('0x1')]=function(_0x3c8988,_0x1b50ac){return client[_0x95f4('0x2')](_0x95f4('0x3'),{'body':_0x1b50ac,'options':{'where':{'id':_0x3c8988}},'log':_0x95f4('0x4')});};exports[_0x95f4('0x5')]=function(_0x5d7869,_0x524249){return client[_0x95f4('0x2')](_0x95f4('0x6'),{'body':_0x524249,'options':{'where':{'id':_0x5d7869}},'log':_0x95f4('0x7')});}; \ No newline at end of file +var _0xa012=['addTags','addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x502d21,_0x30aa2d){var _0x24777e=function(_0x48c117){while(--_0x48c117){_0x502d21['push'](_0x502d21['shift']());}};_0x24777e(++_0x30aa2d);}(_0xa012,0x134));var _0x2a01=function(_0x4126dc,_0x1430f8){_0x4126dc=_0x4126dc-0x0;var _0xef998b=_0xa012[_0x4126dc];return _0xef998b;};'use strict';var client=require('../client');exports[_0x2a01('0x0')]=function(_0x9e6e6a,_0x398e94){return client[_0x2a01('0x1')](_0x2a01('0x2'),{'body':_0x398e94,'options':{'where':{'id':_0x9e6e6a}},'log':_0x2a01('0x3')});};exports[_0x2a01('0x4')]=function(_0x9a1a8e,_0xf3f71f){return client[_0x2a01('0x1')]('AddTagsToSmsInteraction',{'body':_0xf3f71f,'options':{'where':{'id':_0x9a1a8e}},'log':_0x2a01('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 9610105..93cf439 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 _0x9653=['../client','create','Request','CreateSmsMessage'];(function(_0x4b8156,_0x437af2){var _0x4a819c=function(_0xe21347){while(--_0xe21347){_0x4b8156['push'](_0x4b8156['shift']());}};_0x4a819c(++_0x437af2);}(_0x9653,0xf4));var _0x3965=function(_0xa7c26d,_0x12bbe2){_0xa7c26d=_0xa7c26d-0x0;var _0x303214=_0x9653[_0xa7c26d];return _0x303214;};'use strict';var client=require(_0x3965('0x0'));exports[_0x3965('0x1')]=function(_0x509e55){return client[_0x3965('0x2')](_0x3965('0x3'),{'body':_0x509e55,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xd8ae=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xd8ae,0x183));var _0xed8a=function(_0xc7c426,_0x4863dc){_0xc7c426=_0xc7c426-0x0;var _0x27d2bc=_0xd8ae[_0xc7c426];return _0x27d2bc;};'use strict';var client=require(_0xed8a('0x0'));exports[_0xed8a('0x1')]=function(_0x40ca24){return client[_0xed8a('0x2')](_0xed8a('0x3'),{'body':_0x40ca24,'log':_0xed8a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 8cb3169..e242e2f 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 _0xa017=['timeout','strategy','User','Agents','name','online','smsPause','../client','getSmsQueues','Request'];(function(_0x3b52f3,_0x38f344){var _0x17dc3e=function(_0x2ff97c){while(--_0x2ff97c){_0x3b52f3['push'](_0x3b52f3['shift']());}};_0x17dc3e(++_0x38f344);}(_0xa017,0x1f1));var _0x7a01=function(_0x10f761,_0x3ed691){_0x10f761=_0x10f761-0x0;var _0x1e10ee=_0xa017[_0x10f761];return _0x1e10ee;};'use strict';var client=require(_0x7a01('0x0'));exports[_0x7a01('0x1')]=function(){return function(){return client[_0x7a01('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x7a01('0x3'),_0x7a01('0x4')],'include':[{'model':_0x7a01('0x5'),'as':_0x7a01('0x6'),'attributes':['id',_0x7a01('0x7'),_0x7a01('0x8'),_0x7a01('0x9')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x5d58=['getSmsQueues','timeout','strategy','Agents','name','smsPause'];(function(_0x5ca964,_0x1e1366){var _0x447a23=function(_0x5a53b7){while(--_0x5a53b7){_0x5ca964['push'](_0x5ca964['shift']());}};_0x447a23(++_0x1e1366);}(_0x5d58,0x187));var _0x85d5=function(_0x41df93,_0x560d0b){_0x41df93=_0x41df93-0x0;var _0x227e0c=_0x5d58[_0x41df93];return _0x227e0c;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x85d5('0x0'),_0x85d5('0x1')],'include':[{'model':'User','as':_0x85d5('0x2'),'attributes':['id',_0x85d5('0x3'),'online',_0x85d5('0x4')]}]},'log':_0x85d5('0x5')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 2018f00..4bc59ed 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 _0xa509=['Request','CreateSmsQueueReport','UpdateSmsQueueReport','../client','create'];(function(_0x522a27,_0x243230){var _0x2198ea=function(_0x325ef3){while(--_0x325ef3){_0x522a27['push'](_0x522a27['shift']());}};_0x2198ea(++_0x243230);}(_0xa509,0x12f));var _0x9a50=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa509[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x9a50('0x0'));exports[_0x9a50('0x1')]=function(_0x26a917){return client[_0x9a50('0x2')]('CreateSmsQueueReport',{'body':_0x26a917,'log':_0x9a50('0x3')});};exports['update']=function(_0x436f11,_0x2b428a){return client[_0x9a50('0x2')](_0x9a50('0x4'),{'body':_0x2b428a,'options':{'where':{'uniqueid':_0x436f11},'order':[['id','DESC']],'limit':0x1},'log':_0x9a50('0x4')});}; \ No newline at end of file +var _0x5464=['CreateSmsQueueReport','update','DESC','UpdateSmsQueueReport','../client','Request'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x5464,0xb2));var _0x4546=function(_0x21e665,_0xddbc4f){_0x21e665=_0x21e665-0x0;var _0x7a0925=_0x5464[_0x21e665];return _0x7a0925;};'use strict';var client=require(_0x4546('0x0'));exports['create']=function(_0x40a817){return client[_0x4546('0x1')]('CreateSmsQueueReport',{'body':_0x40a817,'log':_0x4546('0x2')});};exports[_0x4546('0x3')]=function(_0x493d6b,_0x497a18){return client[_0x4546('0x1')]('UpdateSmsQueueReport',{'body':_0x497a18,'options':{'where':{'uniqueid':_0x493d6b},'order':[['id',_0x4546('0x4')]],'limit':0x1},'log':_0x4546('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 35b80f3..97f9321 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 _0xe963=['chatCapacity','faxCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','../client','getAgents','Request','pauseType','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause'];(function(_0xeeab2c,_0x51cee7){var _0x429930=function(_0x53d51e){while(--_0x53d51e){_0xeeab2c['push'](_0xeeab2c['shift']());}};_0x429930(++_0x51cee7);}(_0xe963,0x104));var _0x3e96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe963[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x3e96('0x0'));exports[_0x3e96('0x1')]=function(){return function(){return client[_0x3e96('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id','name','online',_0x3e96('0x3'),'lastPauseAt',_0x3e96('0x4'),_0x3e96('0x5'),_0x3e96('0x6'),'faxPause',_0x3e96('0x7'),_0x3e96('0x8'),_0x3e96('0x9'),_0x3e96('0xa'),'mailCapacity',_0x3e96('0xb'),_0x3e96('0xc'),_0x3e96('0xd'),_0x3e96('0xe')]},'log':_0x3e96('0x1')});};}; \ No newline at end of file +var _0x95c2=['openchannelPause','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','openchannelCapacity','getAgents','../client','Request','agent','name','online','pauseType','lastPauseAt','voicePause','chatPause','faxPause','smsPause','whatsappPause'];(function(_0x576c9c,_0x1d38f3){var _0x1ca837=function(_0x27b926){while(--_0x27b926){_0x576c9c['push'](_0x576c9c['shift']());}};_0x1ca837(++_0x1d38f3);}(_0x95c2,0x79));var _0x295c=function(_0x247c20,_0x1bc755){_0x247c20=_0x247c20-0x0;var _0x11216c=_0x95c2[_0x247c20];return _0x11216c;};'use strict';var client=require(_0x295c('0x0'));exports['getAgents']=function(){return function(){return client[_0x295c('0x1')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x295c('0x2')},'attributes':['id',_0x295c('0x3'),_0x295c('0x4'),_0x295c('0x5'),_0x295c('0x6'),_0x295c('0x7'),_0x295c('0x8'),'mailPause',_0x295c('0x9'),_0x295c('0xa'),_0x295c('0xb'),_0x295c('0xc'),_0x295c('0xd'),_0x295c('0xe'),'faxCapacity',_0x295c('0xf'),_0x295c('0x10'),_0x295c('0x11')]},'log':_0x295c('0x12')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 02948f9..7a80d1b 100644 --- a/server/services/routing/rpc/whatsappInteraction.js +++ b/server/services/routing/rpc/whatsappInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x17ba=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x46970c,_0x543655){var _0x2420d6=function(_0x3e65df){while(--_0x3e65df){_0x46970c['push'](_0x46970c['shift']());}};_0x2420d6(++_0x543655);}(_0x17ba,0xab));var _0xa17b=function(_0x471c8a,_0x4ca2be){_0x471c8a=_0x471c8a-0x0;var _0x529ae8=_0x17ba[_0x471c8a];return _0x529ae8;};'use strict';var client=require(_0xa17b('0x0'));exports[_0xa17b('0x1')]=function(_0x4a2032,_0x2ce1c0){return client[_0xa17b('0x2')](_0xa17b('0x3'),{'body':_0x2ce1c0,'options':{'where':{'id':_0x4a2032}},'log':_0xa17b('0x4')});};exports[_0xa17b('0x5')]=function(_0x38c13c,_0x11d7b7){return client[_0xa17b('0x2')](_0xa17b('0x6'),{'body':_0x11d7b7,'options':{'where':{'id':_0x38c13c}},'log':_0xa17b('0x7')});}; \ No newline at end of file +var _0xadec=['../client','update','Request'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0xadec,0x156));var _0xcade=function(_0x1549ae,_0x4ea436){_0x1549ae=_0x1549ae-0x0;var _0x141302=_0xadec[_0x1549ae];return _0x141302;};'use strict';var client=require(_0xcade('0x0'));exports[_0xcade('0x1')]=function(_0x11d900,_0x210817){return client[_0xcade('0x2')]('UpdateWhatsappInteraction',{'body':_0x210817,'options':{'where':{'id':_0x11d900}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0x475533,_0x875b81){return client[_0xcade('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x875b81,'options':{'where':{'id':_0x475533}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 0f2658c..be33425 100644 --- a/server/services/routing/rpc/whatsappMessage.js +++ b/server/services/routing/rpc/whatsappMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcc37=['Request','CreateWhatsappMessage','createWhatsappMessage','create'];(function(_0x259ce2,_0x11e421){var _0x167bb=function(_0x7a78dd){while(--_0x7a78dd){_0x259ce2['push'](_0x259ce2['shift']());}};_0x167bb(++_0x11e421);}(_0xcc37,0xe3));var _0x7cc3=function(_0x2257d4,_0x60b9e9){_0x2257d4=_0x2257d4-0x0;var _0x2d08ef=_0xcc37[_0x2257d4];return _0x2d08ef;};'use strict';var client=require('../client');exports[_0x7cc3('0x0')]=function(_0x1a619d){return client[_0x7cc3('0x1')](_0x7cc3('0x2'),{'body':_0x1a619d,'log':_0x7cc3('0x3')});}; \ No newline at end of file +var _0xff20=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x1d1a81,_0xc4a698){var _0x288bd1=function(_0x309520){while(--_0x309520){_0x1d1a81['push'](_0x1d1a81['shift']());}};_0x288bd1(++_0xc4a698);}(_0xff20,0x18e));var _0x0ff2=function(_0x44a380,_0x53e28b){_0x44a380=_0x44a380-0x0;var _0x115513=_0xff20[_0x44a380];return _0x115513;};'use strict';var client=require(_0x0ff2('0x0'));exports[_0x0ff2('0x1')]=function(_0x5a10e1){return client[_0x0ff2('0x2')](_0x0ff2('0x3'),{'body':_0x5a10e1,'log':_0x0ff2('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 29a13fa..b344f93 100644 --- a/server/services/routing/rpc/whatsappQueue.js +++ b/server/services/routing/rpc/whatsappQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c66=['Agents','online','whatsappPause','getWhatsappQueues','GetWhatsappQueue','name','timeout','strategy','User'];(function(_0x2363fe,_0x5ac5ad){var _0x26af2b=function(_0x346e37){while(--_0x346e37){_0x2363fe['push'](_0x2363fe['shift']());}};_0x26af2b(++_0x5ac5ad);}(_0x3c66,0x8b));var _0x63c6=function(_0x17b80e,_0x36fd7b){_0x17b80e=_0x17b80e-0x0;var _0x535adc=_0x3c66[_0x17b80e];return _0x535adc;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x63c6('0x0'),{'options':{'raw':![],'attributes':['id',_0x63c6('0x1'),_0x63c6('0x2'),_0x63c6('0x3')],'include':[{'model':_0x63c6('0x4'),'as':_0x63c6('0x5'),'attributes':['id',_0x63c6('0x1'),_0x63c6('0x6'),_0x63c6('0x7')]}]},'log':_0x63c6('0x8')});};}; \ No newline at end of file +var _0x594d=['online','getWhatsappQueues','../client','GetWhatsappQueue','name','timeout','User','Agents'];(function(_0x10b538,_0x55835b){var _0x237331=function(_0xc2ab67){while(--_0xc2ab67){_0x10b538['push'](_0x10b538['shift']());}};_0x237331(++_0x55835b);}(_0x594d,0x92));var _0xd594=function(_0x48f7ec,_0xa5fb2c){_0x48f7ec=_0x48f7ec-0x0;var _0x3dbbe8=_0x594d[_0x48f7ec];return _0x3dbbe8;};'use strict';var client=require(_0xd594('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0xd594('0x1'),{'options':{'raw':![],'attributes':['id',_0xd594('0x2'),_0xd594('0x3'),'strategy'],'include':[{'model':_0xd594('0x4'),'as':_0xd594('0x5'),'attributes':['id',_0xd594('0x2'),_0xd594('0x6'),'whatsappPause']}]},'log':_0xd594('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 960a89f..7fe6583 100644 --- a/server/services/routing/rpc/whatsappQueueReport.js +++ b/server/services/routing/rpc/whatsappQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc497=['create','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC'];(function(_0x1b35fe,_0x1c529b){var _0x1cdf0f=function(_0x28bb81){while(--_0x28bb81){_0x1b35fe['push'](_0x1b35fe['shift']());}};_0x1cdf0f(++_0x1c529b);}(_0xc497,0x13b));var _0x7c49=function(_0x5a2e95,_0x2f619f){_0x5a2e95=_0x5a2e95-0x0;var _0x62f9dc=_0xc497[_0x5a2e95];return _0x62f9dc;};'use strict';var client=require('../client');exports[_0x7c49('0x0')]=function(_0x3ce33b){return client[_0x7c49('0x1')](_0x7c49('0x2'),{'body':_0x3ce33b,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x4eff0a,_0x5440a1){return client[_0x7c49('0x1')](_0x7c49('0x3'),{'body':_0x5440a1,'options':{'where':{'uniqueid':_0x4eff0a},'order':[['id',_0x7c49('0x4')]],'limit':0x1},'log':_0x7c49('0x3')});}; \ No newline at end of file +var _0x8183=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','create','Request'];(function(_0x76fea7,_0x164167){var _0x3183c0=function(_0x1f4a4f){while(--_0x1f4a4f){_0x76fea7['push'](_0x76fea7['shift']());}};_0x3183c0(++_0x164167);}(_0x8183,0x142));var _0x3818=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x8183[_0x1992f1];return _0x413dfe;};'use strict';var client=require('../client');exports[_0x3818('0x0')]=function(_0x4c6599){return client[_0x3818('0x1')](_0x3818('0x2'),{'body':_0x4c6599,'log':_0x3818('0x2')});};exports[_0x3818('0x3')]=function(_0x339950,_0x1c98df){return client['Request'](_0x3818('0x4'),{'body':_0x1c98df,'options':{'where':{'uniqueid':_0x339950},'order':[['id',_0x3818('0x5')]],'limit':0x1},'log':_0x3818('0x4')});}; \ 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 3e63938..c2dec6b 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 _0xdcb4=['[%s][AGENT]\x20%s','map','message','stop','agents','timeout','createQueue','atimeout','channel','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','validate','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','consequence','length'];(function(_0x51a6d6,_0x3c9c49){var _0x5ef1a8=function(_0x8ff84a){while(--_0x8ff84a){_0x51a6d6['push'](_0x51a6d6['shift']());}};_0x5ef1a8(++_0x3c9c49);}(_0xdcb4,0xfc));var _0x4dcb=function(_0x257c3d,_0x3ab56d){_0x257c3d=_0x257c3d-0x0;var _0x6c289d=_0xdcb4[_0x257c3d];return _0x6c289d;};'use strict';var schema=require(_0x4dcb('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0x4dcb('0x1'));var logger=require('../../../../config/logger')(_0x4dcb('0x2'));var strategy=require(_0x4dcb('0x3'));var queue=schema({'name':{'type':_0x4dcb('0x4'),'required':!![],'message':_0x4dcb('0x5')},'timeout':{'type':'number','message':_0x4dcb('0x6')}});function writeLog(_0x33345f,_0x122c75,_0x56f3c0){return logger['info'](util[_0x4dcb('0x7')](_0x4dcb('0x8'),_0x33345f,_0x122c75['name'],_0x56f3c0));}function handleFindAgent(_0xaa7327){return function(_0x35eb30){return _0x35eb30[_0x4dcb('0x9')]['toLowerCase']()===_0xaa7327['toLowerCase']();};}exports[_0x4dcb('0xa')]=function(_0x57cd68,_0x15837e,_0x222211,_0x265bde){return function(_0x185b9c){try{var _0x34c2fd={'name':_0x15837e[0x0],'timeout':_0x15837e[0x1]};var _0x4e34e3=queue['validate'](_0x34c2fd,{'typecast':!![]});if(_0x4e34e3[_0x4dcb('0xb')]){logger['error'](_0x4dcb('0xc'),_0x57cd68,_[_0x4dcb('0xd')](_0x4e34e3,_0x4dcb('0xe'))['join'](',\x20'));_0x185b9c[_0x4dcb('0xf')]();}else{var _0x589973=_['find'](_0x222211[_0x4dcb('0x10')],handleFindAgent(_0x34c2fd[_0x4dcb('0x9')]));if(_0x589973){var _0x572d94=(_0x34c2fd[_0x4dcb('0x11')]||0xa)*0x3e8;var _0x395341,_0x446d93;var _0x399e36=seqqueue[_0x4dcb('0x12')](_0x572d94);_0x399e36['id']=_0x57cd68;_0x399e36[_0x4dcb('0x13')]=_0x572d94;_0x399e36[_0x4dcb('0x14')]=_0x265bde[_0x4dcb('0x14')];writeLog(_0x57cd68,_0x589973,util['format']('START:%s',_0x572d94));_0x222211['rules'][_0x57cd68]['on']('end',function(){logger[_0x4dcb('0x15')](_0x4dcb('0x16'),_0x57cd68);clearTimeout(_0x446d93);_0x446d93=undefined;_0x399e36[_0x4dcb('0x17')]();if(_0x222211['rules'][_0x57cd68]){delete _0x222211['rules'][_0x57cd68];}_0x185b9c['stop']();});_0x222211[_0x4dcb('0x18')][_0x57cd68]['on'](_0x4dcb('0x19'),function(){if(_0x222211['rules'][_0x57cd68]){delete _0x222211[_0x4dcb('0x18')][_0x57cd68];}});_0x446d93=setTimeout(function(){logger[_0x4dcb('0x15')](_0x4dcb('0x1a'),_0x57cd68);clearTimeout(_0x446d93);_0x399e36[_0x4dcb('0x17')]();_0x185b9c[_0x4dcb('0x1b')]();},_0x572d94);strategy[_0x4dcb('0x1c')](_0x399e36,_0x589973,_0x222211,_0x265bde);}else{logger[_0x4dcb('0x1d')](_0x4dcb('0x1e'),_0x57cd68,_0x34c2fd[_0x4dcb('0x9')]);_0x185b9c['stop']();}}}catch(_0x12956c){console['log'](_0x12956c);logger[_0x4dcb('0x1d')](_0x4dcb('0x1f'),_0x57cd68,_0x12956c[_0x4dcb('0x20')]);_0x185b9c[_0x4dcb('0xf')]();}};}; \ No newline at end of file +var _0x7d64=['log','[%s][QUEUE]\x20%s','stack','validate','lodash','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','atimeout','format','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7d64,0xb7));var _0x47d6=function(_0x358f52,_0x4abfb0){_0x358f52=_0x358f52-0x0;var _0x4efb8b=_0x7d64[_0x358f52];return _0x4efb8b;};'use strict';var schema=require(_0x47d6('0x0'));var _=require(_0x47d6('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x47d6('0x2'))(_0x47d6('0x3'));var strategy=require(_0x47d6('0x4'));var queue=schema({'name':{'type':_0x47d6('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x47d6('0x6'),'message':_0x47d6('0x7')}});function writeLog(_0x2021b6,_0x2b2d99,_0x46a17a){return logger[_0x47d6('0x8')](util['format'](_0x47d6('0x9'),_0x2021b6,_0x2b2d99[_0x47d6('0xa')],_0x46a17a));}function handleFindAgent(_0x920eac){return function(_0xb57bbf){return _0xb57bbf['name'][_0x47d6('0xb')]()===_0x920eac[_0x47d6('0xb')]();};}exports[_0x47d6('0xc')]=function(_0x4bfca5,_0x18dfb6,_0x5f1f75,_0x5f5365){return function(_0xf93562){try{var _0x2b8935={'name':_0x18dfb6[0x0],'timeout':_0x18dfb6[0x1]};var _0xf853f0=queue['validate'](_0x2b8935,{'typecast':!![]});if(_0xf853f0[_0x47d6('0xd')]){logger['error'](_0x47d6('0xe'),_0x4bfca5,_[_0x47d6('0xf')](_0xf853f0,_0x47d6('0x10'))[_0x47d6('0x11')](',\x20'));_0xf93562[_0x47d6('0x12')]();}else{var _0xbfb206=_[_0x47d6('0x13')](_0x5f1f75[_0x47d6('0x14')],handleFindAgent(_0x2b8935[_0x47d6('0xa')]));if(_0xbfb206){var _0x5baead=(_0x2b8935[_0x47d6('0x15')]||0xa)*0x3e8;var _0x243c41,_0x507b5d;var _0x30942a=seqqueue[_0x47d6('0x16')](_0x5baead);_0x30942a['id']=_0x4bfca5;_0x30942a[_0x47d6('0x17')]=_0x5baead;_0x30942a['channel']=_0x5f5365['channel'];writeLog(_0x4bfca5,_0xbfb206,util[_0x47d6('0x18')](_0x47d6('0x19'),_0x5baead));_0x5f1f75[_0x47d6('0x1a')][_0x4bfca5]['on'](_0x47d6('0x1b'),function(){logger[_0x47d6('0x8')](_0x47d6('0x1c'),_0x4bfca5);clearTimeout(_0x507b5d);_0x507b5d=undefined;_0x30942a[_0x47d6('0x1d')]();if(_0x5f1f75['rules'][_0x4bfca5]){delete _0x5f1f75[_0x47d6('0x1a')][_0x4bfca5];}_0xf93562[_0x47d6('0x12')]();});_0x5f1f75['rules'][_0x4bfca5]['on']('complete',function(){if(_0x5f1f75[_0x47d6('0x1a')][_0x4bfca5]){delete _0x5f1f75[_0x47d6('0x1a')][_0x4bfca5];}});_0x507b5d=setTimeout(function(){logger[_0x47d6('0x8')](_0x47d6('0x1e'),_0x4bfca5);clearTimeout(_0x507b5d);_0x30942a[_0x47d6('0x1d')]();_0xf93562['next']();},_0x5baead);strategy[_0x47d6('0x1f')](_0x30942a,_0xbfb206,_0x5f1f75,_0x5f5365);}else{logger['error'](_0x47d6('0x20'),_0x4bfca5,_0x2b8935['name']);_0xf93562[_0x47d6('0x12')]();}}}catch(_0xcf1cf9){console[_0x47d6('0x21')](_0xcf1cf9);logger['error'](_0x47d6('0x22'),_0x4bfca5,_0xcf1cf9[_0x47d6('0x23')]);_0xf93562[_0x47d6('0x12')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 9fe241c..ac19456 100644 --- a/server/services/routing/server/applications/amazonlex.js +++ b/server/services/routing/server/applications/amazonlex.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','create','then','catch','error','stringify','finally','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','toString','postText','amazonlex','Message','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format'];(function(_0x2ae347,_0x4afc97){var _0x473328=function(_0x42f987){while(--_0x42f987){_0x2ae347['push'](_0x2ae347['shift']());}};_0x473328(++_0x4afc97);}(_0xabce,0x103));var _0xeabc=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xabce[_0x373dee];return _0x46798f;};'use strict';var _=require(_0xeabc('0x0'));var moment=require(_0xeabc('0x1'));var AWS=require(_0xeabc('0x2'));var utils=require(_0xeabc('0x3'));var logger=require(_0xeabc('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xeabc('0x5')),'mailMessage':require(_0xeabc('0x6')),'smsMessage':require(_0xeabc('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xeabc('0x8')]=function(_0x52a4d7,_0x229ba4){return function(_0x52ede8){try{if(!_[_0xeabc('0x9')](this[_0xeabc('0xa')][_0xeabc('0xb')])){logger['info'](_0xeabc('0xc'),_0x52a4d7,_0xeabc('0xd'));return _0x52ede8[_0xeabc('0xe')]();}var _0x1b4d1b={'ContactId':this[_0xeabc('0xf')]['id'],'sentAt':moment()[_0xeabc('0x10')](_0xeabc('0x11')),'direction':_0xeabc('0x12')};var _0xdb5022=this[_0xeabc('0x13')];if(_0xdb5022===_0xeabc('0x14')){_0x1b4d1b[_0xeabc('0x15')]=this[_0xeabc('0x16')]['id'];}else{_0x1b4d1b[_[_0xeabc('0x17')](_0xdb5022)+_0xeabc('0x18')]=this[_0xeabc('0x16')]['id'];}_0x1b4d1b[_['upperFirst'](_0xdb5022)+_0xeabc('0x19')]=this[_0xeabc('0xa')]['id'];if(this[_0xeabc('0xa')]['created']){var _0x5f4ee8=_0x229ba4[0x4];if(!_[_0xeabc('0x1a')](_0x5f4ee8)){_0x1b4d1b[_0xeabc('0x1b')]=utils[_0xeabc('0x1c')](_0x5f4ee8,this);return rpc[_0xdb5022+'Message'][_0xeabc('0x1d')](_0x1b4d1b)[_0xeabc('0x1e')](function(_0x49f2d8){logger['info'](_0xeabc('0xc'),_0x52a4d7,_0x1b4d1b['body']);})[_0xeabc('0x1f')](function(_0x1b64b9){logger[_0xeabc('0x20')](_0xeabc('0xc'),_0x52a4d7,JSON[_0xeabc('0x21')](_0x1b64b9));})[_0xeabc('0x22')](function(){logger[_0xeabc('0x23')](_0xeabc('0x24'),_0x52a4d7);_0x52ede8['stop']();});}else{logger[_0xeabc('0x23')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x52a4d7);_0x52ede8[_0xeabc('0x25')]();}}else{var _0x16530c=this;var _0x502947=new AWS[(_0xeabc('0x26'))]({'accessKeyId':_0x229ba4[0x0],'secretAccessKey':_0x229ba4[0x1],'region':_0x229ba4[0x2]});var _0x41d67a={'botAlias':_0xeabc('0x27'),'botName':_0x229ba4[0x3],'inputText':this[_0xeabc('0x28')][_0xeabc('0x1b')],'userId':this['channel']+':'+this[_0xeabc('0xa')]['id'][_0xeabc('0x29')]()};_0x502947[_0xeabc('0x2a')](_0x41d67a,function(_0x5bdd57,_0x457f27){if(_0x5bdd57){logger[_0xeabc('0x20')](_0xeabc('0xc'),_0x52a4d7,_0x5bdd57[_0xeabc('0x28')]);_0x52ede8['next']();}else if(_0x457f27&&_0x457f27[_0xeabc('0x28')]){_0x16530c['body'][_0xeabc('0x2b')]=_0x457f27;_0x1b4d1b['body']=_0x457f27[_0xeabc('0x28')];return rpc[_0xdb5022+_0xeabc('0x2c')][_0xeabc('0x1d')](_0x1b4d1b)[_0xeabc('0x1e')](function(_0x3a1a04){logger[_0xeabc('0x23')](_0xeabc('0xc'),_0x52a4d7,_0x1b4d1b['body']);if(_0x457f27['dialogState']==_0xeabc('0x2d')){_0x52ede8['next']();}else{_0x52ede8[_0xeabc('0x25')]();}})[_0xeabc('0x1f')](function(_0x48fb52){logger[_0xeabc('0x20')](_0xeabc('0xc'),_0x52a4d7,JSON[_0xeabc('0x21')](_0x48fb52));_0x52ede8[_0xeabc('0xe')]();});}else{_0x52ede8[_0xeabc('0xe')]();}});}}catch(_0x481ee1){logger[_0xeabc('0x20')](_0xeabc('0xc'),_0x52a4d7,JSON[_0xeabc('0x21')](_0x481ee1));_0x52ede8['stop']();}};}; \ No newline at end of file +var _0x3f8a=['channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','create','then','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','next','amazonlex','Message','dialogState','stringify','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4db525,_0x53113c){var _0x13ceda=function(_0x296cb){while(--_0x296cb){_0x4db525['push'](_0x4db525['shift']());}};_0x13ceda(++_0x53113c);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x1414fe,_0x2ce4a4){_0x1414fe=_0x1414fe-0x0;var _0x47f599=_0x3f8a[_0x1414fe];return _0x47f599;};'use strict';var _=require(_0xa3f8('0x0'));var moment=require(_0xa3f8('0x1'));var AWS=require(_0xa3f8('0x2'));var utils=require(_0xa3f8('0x3'));var logger=require('../../../../config/logger')(_0xa3f8('0x4'));var rpc={'chatMessage':require(_0xa3f8('0x5')),'openchannelMessage':require(_0xa3f8('0x6')),'mailMessage':require(_0xa3f8('0x7')),'smsMessage':require(_0xa3f8('0x8')),'faxMessage':require(_0xa3f8('0x9')),'whatsappMessage':require(_0xa3f8('0xa'))};exports[_0xa3f8('0xb')]=function(_0x1f160a,_0xf895d9){return function(_0xcfea5){try{if(!_[_0xa3f8('0xc')](this[_0xa3f8('0xd')][_0xa3f8('0xe')])){logger[_0xa3f8('0xf')](_0xa3f8('0x10'),_0x1f160a,_0xa3f8('0x11'));return _0xcfea5['next']();}var _0x47496a={'ContactId':this[_0xa3f8('0x12')]['id'],'sentAt':moment()[_0xa3f8('0x13')](_0xa3f8('0x14')),'direction':'out'};var _0x206b69=this[_0xa3f8('0x15')];if(_0x206b69===_0xa3f8('0x16')){_0x47496a[_0xa3f8('0x17')]=this[_0xa3f8('0x18')]['id'];}else{_0x47496a[_[_0xa3f8('0x19')](_0x206b69)+_0xa3f8('0x1a')]=this[_0xa3f8('0x18')]['id'];}_0x47496a[_[_0xa3f8('0x19')](_0x206b69)+_0xa3f8('0x1b')]=this[_0xa3f8('0xd')]['id'];if(this[_0xa3f8('0xd')]['created']){var _0x2d8f74=_0xf895d9[0x4];if(!_[_0xa3f8('0x1c')](_0x2d8f74)){_0x47496a[_0xa3f8('0x1d')]=utils[_0xa3f8('0x1e')](_0x2d8f74,this);return rpc[_0x206b69+'Message'][_0xa3f8('0x1f')](_0x47496a)[_0xa3f8('0x20')](function(_0x46a8d9){logger[_0xa3f8('0xf')](_0xa3f8('0x10'),_0x1f160a,_0x47496a[_0xa3f8('0x1d')]);})[_0xa3f8('0x21')](function(_0x3e2e1c){logger[_0xa3f8('0x22')](_0xa3f8('0x10'),_0x1f160a,JSON['stringify'](_0x3e2e1c));})[_0xa3f8('0x23')](function(){logger['info'](_0xa3f8('0x24'),_0x1f160a);_0xcfea5[_0xa3f8('0x25')]();});}else{logger[_0xa3f8('0xf')](_0xa3f8('0x26'),_0x1f160a);_0xcfea5['stop']();}}else{var _0x1f0bb8=this;var _0x5b0d57=new AWS[(_0xa3f8('0x27'))]({'accessKeyId':_0xf895d9[0x0],'secretAccessKey':_0xf895d9[0x1],'region':_0xf895d9[0x2]});var _0x58336d={'botAlias':_0xa3f8('0x28'),'botName':_0xf895d9[0x3],'inputText':this[_0xa3f8('0x29')][_0xa3f8('0x1d')],'userId':this[_0xa3f8('0x15')]+':'+this[_0xa3f8('0xd')]['id'][_0xa3f8('0x2a')]()};_0x5b0d57[_0xa3f8('0x2b')](_0x58336d,function(_0x490717,_0xae76ec){if(_0x490717){logger['error'](_0xa3f8('0x10'),_0x1f160a,_0x490717[_0xa3f8('0x29')]);_0xcfea5[_0xa3f8('0x2c')]();}else if(_0xae76ec&&_0xae76ec[_0xa3f8('0x29')]){_0x1f0bb8[_0xa3f8('0x1d')][_0xa3f8('0x2d')]=_0xae76ec;_0x47496a[_0xa3f8('0x1d')]=_0xae76ec[_0xa3f8('0x29')];return rpc[_0x206b69+_0xa3f8('0x2e')][_0xa3f8('0x1f')](_0x47496a)['then'](function(_0x1c3358){logger[_0xa3f8('0xf')](_0xa3f8('0x10'),_0x1f160a,_0x47496a['body']);if(_0xae76ec[_0xa3f8('0x2f')]=='Failed'){_0xcfea5[_0xa3f8('0x2c')]();}else{_0xcfea5[_0xa3f8('0x25')]();}})[_0xa3f8('0x21')](function(_0x4ea213){logger[_0xa3f8('0x22')]('[%s][AMAZONLEX]\x20%s',_0x1f160a,JSON[_0xa3f8('0x30')](_0x4ea213));_0xcfea5[_0xa3f8('0x2c')]();});}else{_0xcfea5[_0xa3f8('0x2c')]();}});}}catch(_0x406140){logger[_0xa3f8('0x22')](_0xa3f8('0x10'),_0x1f160a,JSON[_0xa3f8('0x30')](_0x406140));_0xcfea5[_0xa3f8('0x25')]();}};}; \ 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 3828729..d35bf79 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 _0xb958=['../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','channel','getMustacheRender','YYYY-MM-DD\x20HH:mm:ss','message','from','phone','read','subject','Re:','chat','upperFirst','AccountId','Message','mail','account','service','Smtp','host','port','secure','authentication','auth','user','pass','messageId','html','','replace','body','','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage'];(function(_0x5a6e7b,_0x3dabdc){var _0x5bef75=function(_0x2fa93b){while(--_0x2fa93b){_0x5a6e7b['push'](_0x5a6e7b['shift']());}};_0x5bef75(++_0x3dabdc);}(_0xb958,0xab));var _0x8b95=function(_0x54d52,_0x2473ba){_0x54d52=_0x54d52-0x0;var _0x968345=_0xb958[_0x54d52];return _0x968345;};'use strict';var _=require(_0x8b95('0x0'));var moment=require(_0x8b95('0x1'));var utils=require(_0x8b95('0x2'));var logger=require(_0x8b95('0x3'))('routing');var rpc={'chatMessage':require(_0x8b95('0x4')),'openchannelMessage':require(_0x8b95('0x5')),'mailMessage':require(_0x8b95('0x6')),'smsMessage':require(_0x8b95('0x7')),'faxMessage':require(_0x8b95('0x8')),'whatsappMessage':require(_0x8b95('0x9'))};var mailRpc=require(_0x8b95('0xa'));exports[_0x8b95('0xb')]=function(_0x4c6a68,_0x114ad8){return function(_0x2a5c31){try{if(_0x114ad8[0x0]==='1'&&(_[_0x8b95('0xc')](this[_0x8b95('0xd')][_0x8b95('0xe')])||!this[_0x8b95('0xd')]['created'])){logger[_0x8b95('0xf')](_0x8b95('0x10'),_0x4c6a68,_0x8b95('0x11'));return _0x2a5c31['next']();}var _0x128d22=this[_0x8b95('0x12')];var _0x418658={'body':utils[_0x8b95('0x13')](_0x114ad8[0x1],this),'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x8b95('0x14')),'direction':'out'};if(this['message']){_0x418658['to']=this[_0x8b95('0x15')][_0x8b95('0x16')]||'';_0x418658['cc']=this[_0x8b95('0x15')]['cc']||'';_0x418658[_0x8b95('0x16')]=this[_0x8b95('0x15')]['to']||'';_0x418658['phone']=this['message'][_0x8b95('0x17')]||'';_0x418658[_0x8b95('0x18')]=!![];if(this[_0x8b95('0x15')][_0x8b95('0x19')]){_0x418658['subject']='';_0x418658[_0x8b95('0x19')]+=_['startsWith'](this['message'][_0x8b95('0x19')],_0x8b95('0x1a'))?'':'Re:\x20';_0x418658[_0x8b95('0x19')]+=this[_0x8b95('0x15')][_0x8b95('0x19')];}}if(this[_0x8b95('0x12')]===_0x8b95('0x1b')){_0x418658['ChatWebsiteId']=this['account']['id'];}else{_0x418658[_[_0x8b95('0x1c')](this[_0x8b95('0x12')])+_0x8b95('0x1d')]=this['account']['id'];}_0x418658[_['upperFirst'](this[_0x8b95('0x12')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x8b95('0x12')]+_0x8b95('0x1e')]){if(this[_0x8b95('0x12')]===_0x8b95('0x1f')){var _0x285d82={'tls':{'rejectUnauthorized':![]}};if(this[_0x8b95('0x20')]['Smtp'][_0x8b95('0x21')]){_0x285d82[_0x8b95('0x21')]=this['account'][_0x8b95('0x22')][_0x8b95('0x21')];}else{_0x285d82['host']=this[_0x8b95('0x20')]['Smtp'][_0x8b95('0x23')];_0x285d82[_0x8b95('0x24')]=this['account']['Smtp'][_0x8b95('0x24')];_0x285d82[_0x8b95('0x25')]=this['account'][_0x8b95('0x22')]['secure'];}if(this[_0x8b95('0x20')][_0x8b95('0x22')][_0x8b95('0x26')]){_0x285d82[_0x8b95('0x27')]={'user':this[_0x8b95('0x20')][_0x8b95('0x22')][_0x8b95('0x28')],'pass':this[_0x8b95('0x20')][_0x8b95('0x22')][_0x8b95('0x29')]};}_0x418658['inReplyTo']=this['message'][_0x8b95('0x2a')];_0x418658[_0x8b95('0x2b')]=_0x8b95('0x2c')+_[_0x8b95('0x2d')](_0x418658[_0x8b95('0x2e')],_0x8b95('0x2f'),_0x8b95('0x30'))+_0x8b95('0x31');return mailRpc['sendMailMessage'](_0x285d82,_0x418658)[_0x8b95('0x32')](function(_0x268ed4){logger[_0x8b95('0xf')](_0x8b95('0x33'),_0x4c6a68);_0x418658[_0x8b95('0x2a')]=_0x268ed4[_0x8b95('0x15')][_0x8b95('0x2a')];return rpc[_0x128d22+_0x8b95('0x1e')][_0x8b95('0x34')](_0x418658);})['then'](function(_0x4cc0fa){logger['info'](_0x8b95('0x10'),_0x4c6a68,JSON['stringify'](_0x4cc0fa));})[_0x8b95('0x35')](function(_0x89a59f){logger[_0x8b95('0x36')](_0x8b95('0x37'),_0x4c6a68,JSON[_0x8b95('0x38')](_0x89a59f));})[_0x8b95('0x39')](function(){_0x2a5c31['next']();});}else{return rpc[this[_0x8b95('0x12')]+'Message'][_0x8b95('0x34')](_0x418658)['then'](function(_0x4bd384){logger[_0x8b95('0xf')](_0x8b95('0x10'),_0x4c6a68,_0x418658[_0x8b95('0x2e')]);})[_0x8b95('0x35')](function(_0x34c51a){logger['error'](_0x8b95('0x10'),_0x4c6a68,JSON[_0x8b95('0x38')](_0x34c51a));})['finally'](function(){_0x2a5c31['next']();});}}}catch(_0x501523){logger[_0x8b95('0x36')]('[%s][AUTOREPLY]\x20%s',_0x4c6a68,JSON[_0x8b95('0x38')](_0x501523));_0x2a5c31[_0x8b95('0x3a')]();}};}; \ No newline at end of file +var _0x2a1a=['inReplyTo','messageId','html','replace','body','','sendMailMessage','then','info','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','[%s][AUTOREPLY]\x20%s','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','stop','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','created','Autoreply\x20already\x20sent','next','channel','getMustacheRender','contact','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','subject','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','Message','mail','Smtp','service','host','port','secure','authentication','auth','user','pass'];(function(_0x5c6299,_0x11bd28){var _0x23b564=function(_0x329ed6){while(--_0x329ed6){_0x5c6299['push'](_0x5c6299['shift']());}};_0x23b564(++_0x11bd28);}(_0x2a1a,0x140));var _0xa2a1=function(_0x13a5b7,_0x29bc4d){_0x13a5b7=_0x13a5b7-0x0;var _0x235deb=_0x2a1a[_0x13a5b7];return _0x235deb;};'use strict';var _=require('lodash');var moment=require(_0xa2a1('0x0'));var utils=require(_0xa2a1('0x1'));var logger=require(_0xa2a1('0x2'))(_0xa2a1('0x3'));var rpc={'chatMessage':require(_0xa2a1('0x4')),'openchannelMessage':require(_0xa2a1('0x5')),'mailMessage':require(_0xa2a1('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xa2a1('0x7')),'whatsappMessage':require(_0xa2a1('0x8'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x709040,_0x21b68b){return function(_0x5cec4e){try{if(_0x21b68b[0x0]==='1'&&(_['isNil'](this['interaction'][_0xa2a1('0x9')])||!this['interaction']['created'])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x709040,_0xa2a1('0xa'));return _0x5cec4e[_0xa2a1('0xb')]();}var _0x5e6b23=this[_0xa2a1('0xc')];var _0x4557eb={'body':utils[_0xa2a1('0xd')](_0x21b68b[0x1],this),'ContactId':this[_0xa2a1('0xe')]['id'],'sentAt':moment()['format'](_0xa2a1('0xf')),'direction':_0xa2a1('0x10')};if(this[_0xa2a1('0x11')]){_0x4557eb['to']=this[_0xa2a1('0x11')]['from']||'';_0x4557eb['cc']=this[_0xa2a1('0x11')]['cc']||'';_0x4557eb[_0xa2a1('0x12')]=this[_0xa2a1('0x11')]['to']||'';_0x4557eb[_0xa2a1('0x13')]=this[_0xa2a1('0x11')]['phone']||'';_0x4557eb['read']=!![];if(this[_0xa2a1('0x11')][_0xa2a1('0x14')]){_0x4557eb[_0xa2a1('0x14')]='';_0x4557eb[_0xa2a1('0x14')]+=_['startsWith'](this['message']['subject'],_0xa2a1('0x15'))?'':_0xa2a1('0x16');_0x4557eb[_0xa2a1('0x14')]+=this['message'][_0xa2a1('0x14')];}}if(this[_0xa2a1('0xc')]===_0xa2a1('0x17')){_0x4557eb[_0xa2a1('0x18')]=this[_0xa2a1('0x19')]['id'];}else{_0x4557eb[_[_0xa2a1('0x1a')](this[_0xa2a1('0xc')])+_0xa2a1('0x1b')]=this[_0xa2a1('0x19')]['id'];}_0x4557eb[_['upperFirst'](this[_0xa2a1('0xc')])+'InteractionId']=this[_0xa2a1('0x1c')]['id'];if(rpc[this[_0xa2a1('0xc')]+_0xa2a1('0x1d')]){if(this['channel']===_0xa2a1('0x1e')){var _0x1067ea={'tls':{'rejectUnauthorized':![]}};if(this[_0xa2a1('0x19')][_0xa2a1('0x1f')][_0xa2a1('0x20')]){_0x1067ea['service']=this[_0xa2a1('0x19')][_0xa2a1('0x1f')][_0xa2a1('0x20')];}else{_0x1067ea[_0xa2a1('0x21')]=this[_0xa2a1('0x19')][_0xa2a1('0x1f')]['host'];_0x1067ea['port']=this[_0xa2a1('0x19')][_0xa2a1('0x1f')][_0xa2a1('0x22')];_0x1067ea[_0xa2a1('0x23')]=this[_0xa2a1('0x19')][_0xa2a1('0x1f')][_0xa2a1('0x23')];}if(this[_0xa2a1('0x19')]['Smtp'][_0xa2a1('0x24')]){_0x1067ea[_0xa2a1('0x25')]={'user':this['account']['Smtp'][_0xa2a1('0x26')],'pass':this[_0xa2a1('0x19')]['Smtp'][_0xa2a1('0x27')]};}_0x4557eb[_0xa2a1('0x28')]=this[_0xa2a1('0x11')][_0xa2a1('0x29')];_0x4557eb[_0xa2a1('0x2a')]=''+_[_0xa2a1('0x2b')](_0x4557eb[_0xa2a1('0x2c')],_0xa2a1('0x2d'),_0xa2a1('0x2e'))+_0xa2a1('0x2f');return mailRpc[_0xa2a1('0x30')](_0x1067ea,_0x4557eb)[_0xa2a1('0x31')](function(_0x5e2eee){logger[_0xa2a1('0x32')](_0xa2a1('0x33'),_0x709040);_0x4557eb[_0xa2a1('0x29')]=_0x5e2eee['message'][_0xa2a1('0x29')];return rpc[_0x5e6b23+_0xa2a1('0x1d')][_0xa2a1('0x34')](_0x4557eb);})[_0xa2a1('0x31')](function(_0x5f5caf){logger[_0xa2a1('0x32')](_0xa2a1('0x35'),_0x709040,JSON[_0xa2a1('0x36')](_0x5f5caf));})[_0xa2a1('0x37')](function(_0x411b97){logger[_0xa2a1('0x38')](_0xa2a1('0x39'),_0x709040,JSON[_0xa2a1('0x36')](_0x411b97));})[_0xa2a1('0x3a')](function(){_0x5cec4e[_0xa2a1('0xb')]();});}else{return rpc[this[_0xa2a1('0xc')]+_0xa2a1('0x1d')][_0xa2a1('0x34')](_0x4557eb)[_0xa2a1('0x31')](function(_0x4d53d4){logger[_0xa2a1('0x32')]('[%s][AUTOREPLY]\x20%s',_0x709040,_0x4557eb[_0xa2a1('0x2c')]);})[_0xa2a1('0x37')](function(_0x1890cf){logger[_0xa2a1('0x38')](_0xa2a1('0x35'),_0x709040,JSON[_0xa2a1('0x36')](_0x1890cf));})['finally'](function(){_0x5cec4e[_0xa2a1('0xb')]();});}}}catch(_0xd12040){logger[_0xa2a1('0x38')]('[%s][AUTOREPLY]\x20%s',_0x709040,JSON[_0xa2a1('0x36')](_0xd12040));_0x5cec4e[_0xa2a1('0x3b')]();}};}; \ 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 d72e464..8115715 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 _0x0e4b=['moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','stop','error'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x47899b,_0x3a9171){_0x47899b=_0x47899b-0x0;var _0x3cf890=_0x0e4b[_0x47899b];return _0x3cf890;};'use strict';var moment=require(_0xb0e4('0x0'));var logger=require(_0xb0e4('0x1'))(_0xb0e4('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xb0e4('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xb0e4('0x4')]=function(_0x136402,_0x57a7a5,_0x45bdf2,_0x3b56c3){return function(_0x78e4ed){try{logger[_0xb0e4('0x5')](_0xb0e4('0x6'),_0x136402,_0x57a7a5[0x0]);var _0x57f45d={'closed':0x1,'closedAt':moment()['format'](_0xb0e4('0x7')),'closeReason':_0xb0e4('0x8'),'disposition':_0x57a7a5[0x0]};if(rpc[_0x3b56c3[_0xb0e4('0x9')]+_0xb0e4('0xa')]){rpc[_0x3b56c3[_0xb0e4('0x9')]+_0xb0e4('0xa')][_0xb0e4('0xb')](_0x3b56c3[_0xb0e4('0xc')]['id'],_0x57f45d)[_0xb0e4('0xd')](function(_0x397bf3){logger[_0xb0e4('0x5')](_0xb0e4('0xe'),_0x136402,_0x3b56c3[_0xb0e4('0xc')]['id']);})[_0xb0e4('0xf')](function(_0xdfa7fd){logger['error'](_0xb0e4('0x10'),_0x136402,JSON[_0xb0e4('0x11')](_0xdfa7fd));})['finally'](function(){_0x78e4ed[_0xb0e4('0x12')]();});}}catch(_0x26f664){logger[_0xb0e4('0x13')](_0xb0e4('0x10'),_0x136402,JSON[_0xb0e4('0x11')](_0x26f664));_0x78e4ed['stop']();}};}; \ No newline at end of file +var _0xf03a=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stop','../../../../config/logger','routing'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xf03a,0x1a0));var _0xaf03=function(_0x13dbae,_0x11d6ef){_0x13dbae=_0x13dbae-0x0;var _0x12cb55=_0xf03a[_0x13dbae];return _0x12cb55;};'use strict';var moment=require('moment');var logger=require(_0xaf03('0x0'))(_0xaf03('0x1'));var rpc={'chatInteraction':require(_0xaf03('0x2')),'openchannelInteraction':require(_0xaf03('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xaf03('0x4')),'faxInteraction':require(_0xaf03('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xaf03('0x6')]=function(_0x10a6a5,_0x120ee0,_0x2e05f7,_0x58a29b){return function(_0x2d19df){try{logger['info'](_0xaf03('0x7'),_0x10a6a5,_0x120ee0[0x0]);var _0x467e7c={'closed':0x1,'closedAt':moment()[_0xaf03('0x8')](_0xaf03('0x9')),'closeReason':_0xaf03('0xa'),'disposition':_0x120ee0[0x0]};if(rpc[_0x58a29b[_0xaf03('0xb')]+'Interaction']){rpc[_0x58a29b[_0xaf03('0xb')]+_0xaf03('0xc')][_0xaf03('0xd')](_0x58a29b[_0xaf03('0xe')]['id'],_0x467e7c)[_0xaf03('0xf')](function(_0x56eb85){logger[_0xaf03('0x10')](_0xaf03('0x11'),_0x10a6a5,_0x58a29b[_0xaf03('0xe')]['id']);})[_0xaf03('0x12')](function(_0x37156e){logger[_0xaf03('0x13')](_0xaf03('0x14'),_0x10a6a5,JSON['stringify'](_0x37156e));})['finally'](function(){_0x2d19df[_0xaf03('0x15')]();});}}catch(_0x525cfb){logger[_0xaf03('0x13')]('[%s][CLOSE]\x20%s',_0x10a6a5,JSON['stringify'](_0x525cfb));_0x2d19df[_0xaf03('0x15')]();}};}; \ 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 756876e..b1c4fc1 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 _0x14e4=['ChatWebsiteId','account','upperFirst','isEmpty','getMustacheRender','Message','create','then','body','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','dialogflow','result','speech','metadata','endConversation','message','lodash','moment','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','out','channel','chat'];(function(_0x5d7ff4,_0x1384c1){var _0x3edd41=function(_0x5b7216){while(--_0x5b7216){_0x5d7ff4['push'](_0x5d7ff4['shift']());}};_0x3edd41(++_0x1384c1);}(_0x14e4,0x11d));var _0x414e=function(_0x1ac453,_0x4e0345){_0x1ac453=_0x1ac453-0x0;var _0x4ddf15=_0x14e4[_0x1ac453];return _0x4ddf15;};'use strict';var _=require(_0x414e('0x0'));var moment=require(_0x414e('0x1'));var apiai=require('apiai-promise');var md5=require(_0x414e('0x2'));var utils=require(_0x414e('0x3'));var logger=require(_0x414e('0x4'))(_0x414e('0x5'));var rpc={'chatMessage':require(_0x414e('0x6')),'openchannelMessage':require(_0x414e('0x7')),'mailMessage':require(_0x414e('0x8')),'smsMessage':require(_0x414e('0x9')),'faxMessage':require(_0x414e('0xa')),'whatsappMessage':require(_0x414e('0xb'))};exports['consequence']=function(_0x1a542f,_0x5d9ced){return function(_0xdfba69){try{if(!_[_0x414e('0xc')](this[_0x414e('0xd')][_0x414e('0xe')])){logger[_0x414e('0xf')](_0x414e('0x10'),_0x1a542f,_0x414e('0x11'));return _0xdfba69[_0x414e('0x12')]();}var _0x33f343={'ContactId':this['contact']['id'],'sentAt':moment()[_0x414e('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x414e('0x14')};var _0x5e3780=this[_0x414e('0x15')];if(_0x5e3780===_0x414e('0x16')){_0x33f343[_0x414e('0x17')]=this[_0x414e('0x18')]['id'];}else{_0x33f343[_[_0x414e('0x19')](_0x5e3780)+'AccountId']=this['account']['id'];}_0x33f343[_['upperFirst'](_0x5e3780)+'InteractionId']=this[_0x414e('0xd')]['id'];if(this[_0x414e('0xd')]['created']){var _0x31878e=_0x5d9ced[0x2];if(!_[_0x414e('0x1a')](_0x31878e)){_0x33f343['body']=utils[_0x414e('0x1b')](_0x31878e,this);return rpc[_0x5e3780+_0x414e('0x1c')][_0x414e('0x1d')](_0x33f343)[_0x414e('0x1e')](function(_0x409568){logger[_0x414e('0xf')](_0x414e('0x10'),_0x1a542f,_0x33f343[_0x414e('0x1f')]);})[_0x414e('0x20')](function(_0x4ccc7d){logger[_0x414e('0x21')](_0x414e('0x10'),_0x1a542f,JSON[_0x414e('0x22')](_0x4ccc7d));})['finally'](function(){logger['info'](_0x414e('0x23'),_0x1a542f);_0xdfba69[_0x414e('0x24')]();});}else{logger[_0x414e('0xf')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1a542f);_0xdfba69[_0x414e('0x24')]();}}else{var _0x1327d8=this;var _0x392a81=apiai(_0x5d9ced[0x0],{'language':_0x5d9ced[0x1]||'en'});return _0x392a81[_0x414e('0x25')](this['message'][_0x414e('0x1f')],{'sessionId':md5(this[_0x414e('0xd')]['id'])})[_0x414e('0x1e')](function(_0x1a61b8){_0x1327d8[_0x414e('0x1f')][_0x414e('0x26')]=_0x1a61b8;_0x33f343['body']=_0x1a61b8[_0x414e('0x27')]['fulfillment'][_0x414e('0x28')];return rpc[_0x5e3780+_0x414e('0x1c')][_0x414e('0x1d')](_0x33f343)[_0x414e('0x1e')](function(_0x3dd0fa){logger[_0x414e('0xf')](_0x414e('0x10'),_0x1a542f,_0x33f343[_0x414e('0x1f')]);if(_0x1a61b8[_0x414e('0x27')][_0x414e('0x29')][_0x414e('0x2a')]){_0xdfba69[_0x414e('0x12')]();}else{_0xdfba69[_0x414e('0x24')]();}})[_0x414e('0x20')](function(_0x32ffac){logger[_0x414e('0x21')](_0x414e('0x10'),_0x1a542f,JSON[_0x414e('0x22')](_0x32ffac));_0xdfba69[_0x414e('0x12')]();});})[_0x414e('0x20')](function(_0xaa1be1){logger[_0x414e('0x21')](_0x414e('0x10'),_0x1a542f,_0xaa1be1[_0x414e('0x2b')]);_0xdfba69[_0x414e('0x12')]();});}}catch(_0x57a22f){logger[_0x414e('0x21')](_0x414e('0x10'),_0x1a542f,JSON[_0x414e('0x22')](_0x57a22f));_0xdfba69[_0x414e('0x24')]();}};}; \ No newline at end of file +var _0x43cf=['body','catch','error','stringify','finally','info','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','speech','Message','create','metadata','endConversation','lodash','moment','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','interaction','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','then'];(function(_0x1bc750,_0x23f442){var _0xcd51da=function(_0x323854){while(--_0x323854){_0x1bc750['push'](_0x1bc750['shift']());}};_0xcd51da(++_0x23f442);}(_0x43cf,0xfd));var _0xf43c=function(_0x5a1a51,_0x144c79){_0x5a1a51=_0x5a1a51-0x0;var _0x47edd7=_0x43cf[_0x5a1a51];return _0x47edd7;};'use strict';var _=require(_0xf43c('0x0'));var moment=require(_0xf43c('0x1'));var apiai=require('apiai-promise');var md5=require(_0xf43c('0x2'));var utils=require('./utils');var logger=require(_0xf43c('0x3'))(_0xf43c('0x4'));var rpc={'chatMessage':require(_0xf43c('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xf43c('0x6')),'smsMessage':require(_0xf43c('0x7')),'faxMessage':require(_0xf43c('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xf43c('0x9')]=function(_0x5118f0,_0x5ef391){return function(_0x125985){try{if(!_['isNil'](this[_0xf43c('0xa')][_0xf43c('0xb')])){logger['info'](_0xf43c('0xc'),_0x5118f0,_0xf43c('0xd'));return _0x125985[_0xf43c('0xe')]();}var _0x4db21e={'ContactId':this[_0xf43c('0xf')]['id'],'sentAt':moment()[_0xf43c('0x10')](_0xf43c('0x11')),'direction':_0xf43c('0x12')};var _0x46ec2a=this[_0xf43c('0x13')];if(_0x46ec2a===_0xf43c('0x14')){_0x4db21e[_0xf43c('0x15')]=this[_0xf43c('0x16')]['id'];}else{_0x4db21e[_[_0xf43c('0x17')](_0x46ec2a)+'AccountId']=this[_0xf43c('0x16')]['id'];}_0x4db21e[_[_0xf43c('0x17')](_0x46ec2a)+_0xf43c('0x18')]=this[_0xf43c('0xa')]['id'];if(this[_0xf43c('0xa')][_0xf43c('0x19')]){var _0x504d46=_0x5ef391[0x2];if(!_[_0xf43c('0x1a')](_0x504d46)){_0x4db21e['body']=utils[_0xf43c('0x1b')](_0x504d46,this);return rpc[_0x46ec2a+'Message']['create'](_0x4db21e)[_0xf43c('0x1c')](function(_0x586829){logger['info'](_0xf43c('0xc'),_0x5118f0,_0x4db21e[_0xf43c('0x1d')]);})[_0xf43c('0x1e')](function(_0x158062){logger[_0xf43c('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0x5118f0,JSON[_0xf43c('0x20')](_0x158062));})[_0xf43c('0x21')](function(){logger[_0xf43c('0x22')](_0xf43c('0x23'),_0x5118f0);_0x125985[_0xf43c('0x24')]();});}else{logger[_0xf43c('0x22')](_0xf43c('0x25'),_0x5118f0);_0x125985[_0xf43c('0x24')]();}}else{var _0x5ba48b=this;var _0x33c764=apiai(_0x5ef391[0x0],{'language':_0x5ef391[0x1]||'en'});return _0x33c764[_0xf43c('0x26')](this[_0xf43c('0x27')][_0xf43c('0x1d')],{'sessionId':md5(this[_0xf43c('0xa')]['id'])})[_0xf43c('0x1c')](function(_0x59ac12){_0x5ba48b['body'][_0xf43c('0x28')]=_0x59ac12;_0x4db21e['body']=_0x59ac12[_0xf43c('0x29')]['fulfillment'][_0xf43c('0x2a')];return rpc[_0x46ec2a+_0xf43c('0x2b')][_0xf43c('0x2c')](_0x4db21e)['then'](function(_0x31f36f){logger[_0xf43c('0x22')](_0xf43c('0xc'),_0x5118f0,_0x4db21e[_0xf43c('0x1d')]);if(_0x59ac12[_0xf43c('0x29')][_0xf43c('0x2d')][_0xf43c('0x2e')]){_0x125985[_0xf43c('0xe')]();}else{_0x125985[_0xf43c('0x24')]();}})[_0xf43c('0x1e')](function(_0x593fe9){logger[_0xf43c('0x1f')](_0xf43c('0xc'),_0x5118f0,JSON[_0xf43c('0x20')](_0x593fe9));_0x125985[_0xf43c('0xe')]();});})['catch'](function(_0x39ae52){logger[_0xf43c('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0x5118f0,_0x39ae52[_0xf43c('0x27')]);_0x125985[_0xf43c('0xe')]();});}}catch(_0x4a1f80){logger[_0xf43c('0x1f')](_0xf43c('0xc'),_0x5118f0,JSON[_0xf43c('0x20')](_0x4a1f80));_0x125985[_0xf43c('0x24')]();}};}; \ 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 22efdee..9f866f5 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 _0xa2ee=['priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','length','error','message','join','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','validate','lodash','html-to-text','./utils','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2ee,0xbc));var _0xea2e=function(_0x297acf,_0x530d6c){_0x297acf=_0x297acf-0x0;var _0x2dd757=_0xa2ee[_0x297acf];return _0x2dd757;};'use strict';var schema=require(_0xea2e('0x0'));var _=require(_0xea2e('0x1'));var htmlToText=require(_0xea2e('0x2'));var utils=require(_0xea2e('0x3'));var logger=require('../../../../config/logger')('routing');var gotoif=schema({'condition':{'type':_0xea2e('0x4'),'required':!![],'message':_0xea2e('0x5')},'priorityTrue':{'type':'number','message':_0xea2e('0x6')},'priorityFalse':{'type':_0xea2e('0x7'),'message':_0xea2e('0x8')}});exports[_0xea2e('0x9')]=function(_0x3248b4,_0x37bcbc){return function(_0x3faae9){try{var _0x2af9b6={'condition':htmlToText[_0xea2e('0xa')](utils['getMustacheRender'](_0x37bcbc[0x0],this),{'wordwrap':![]})[_0xea2e('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x37bcbc[0x1],'priorityFalse':_0x37bcbc[0x2]};var _0x47a4d4=gotoif[_0xea2e('0x0')](_0x2af9b6,{'typecast':!![]});if(_0x47a4d4[_0xea2e('0xc')]){logger[_0xea2e('0xd')]('[%s][GOTOIF]\x20%s',_0x3248b4,_['map'](_0x47a4d4,_0xea2e('0xe'))[_0xea2e('0xf')](',\x20'));_0x3faae9[_0xea2e('0x10')]();}else{try{var _0x523663=eval('('+_0x2af9b6[_0xea2e('0x11')]+')');var _0x24eb45=_0x523663?_0x2af9b6['priorityTrue']:_0x2af9b6[_0xea2e('0x12')];logger[_0xea2e('0x13')](_0xea2e('0x14'),_0x3248b4,_0x2af9b6[_0xea2e('0x11')],_0x523663,_0x24eb45||_0xea2e('0x15'));if(_0x24eb45){var _0x2f07b2=_[_0xea2e('0x16')](_0x3faae9[_0xea2e('0x17')](),{'p':_0x24eb45});if(_0x2f07b2>=0x0){logger['info'](_0xea2e('0x18'),_0x3248b4,_0x24eb45||_0xea2e('0x15'),_0x2f07b2);_0x3faae9[_0xea2e('0x15')](_0x2f07b2);}else{logger['info'](_0xea2e('0x19'),_0x3248b4,_0x24eb45||_0xea2e('0x15'));_0x3faae9['stop']();}}else{_0x3faae9[_0xea2e('0x15')]();}}catch(_0x121ff9){logger[_0xea2e('0xd')](_0xea2e('0x1a'),_0x3248b4,_0x121ff9[_0xea2e('0xe')]);_0x3faae9['stop']();}}}catch(_0x20094d){logger[_0xea2e('0xd')](_0xea2e('0x1b'),_0x3248b4,JSON['stringify'](_0x20094d));_0x3faae9[_0xea2e('0x10')]();}};}; \ No newline at end of file +var _0xc4b0=['html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','error','map','message','join','stop','condition','priorityTrue','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20eval\x20error:\x20%s','[%s][GOTOIF]\x20%s','stringify','validate','lodash'];(function(_0x5bfc5e,_0x80370e){var _0x242f9e=function(_0x49ac5b){while(--_0x49ac5b){_0x5bfc5e['push'](_0x5bfc5e['shift']());}};_0x242f9e(++_0x80370e);}(_0xc4b0,0x80));var _0x0c4b=function(_0x5caf82,_0x9591f7){_0x5caf82=_0x5caf82-0x0;var _0x5cf782=_0xc4b0[_0x5caf82];return _0x5cf782;};'use strict';var schema=require(_0x0c4b('0x0'));var _=require(_0x0c4b('0x1'));var htmlToText=require(_0x0c4b('0x2'));var utils=require(_0x0c4b('0x3'));var logger=require('../../../../config/logger')(_0x0c4b('0x4'));var gotoif=schema({'condition':{'type':_0x0c4b('0x5'),'required':!![],'message':_0x0c4b('0x6')},'priorityTrue':{'type':_0x0c4b('0x7'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x0c4b('0x7'),'message':_0x0c4b('0x8')}});exports[_0x0c4b('0x9')]=function(_0x11de37,_0x25d120){return function(_0x50be9a){try{var _0x302910={'condition':htmlToText[_0x0c4b('0xa')](utils['getMustacheRender'](_0x25d120[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x25d120[0x1],'priorityFalse':_0x25d120[0x2]};var _0x30502e=gotoif[_0x0c4b('0x0')](_0x302910,{'typecast':!![]});if(_0x30502e['length']){logger[_0x0c4b('0xb')]('[%s][GOTOIF]\x20%s',_0x11de37,_[_0x0c4b('0xc')](_0x30502e,_0x0c4b('0xd'))[_0x0c4b('0xe')](',\x20'));_0x50be9a[_0x0c4b('0xf')]();}else{try{var _0x3bf132=eval('('+_0x302910[_0x0c4b('0x10')]+')');var _0x5b05b7=_0x3bf132?_0x302910[_0x0c4b('0x11')]:_0x302910['priorityFalse'];logger[_0x0c4b('0x12')](_0x0c4b('0x13'),_0x11de37,_0x302910['condition'],_0x3bf132,_0x5b05b7||_0x0c4b('0x14'));if(_0x5b05b7){var _0xb7cff1=_[_0x0c4b('0x15')](_0x50be9a['rules'](),{'p':_0x5b05b7});if(_0xb7cff1>=0x0){logger['info'](_0x0c4b('0x16'),_0x11de37,_0x5b05b7||_0x0c4b('0x14'),_0xb7cff1);_0x50be9a['next'](_0xb7cff1);}else{logger[_0x0c4b('0x12')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x11de37,_0x5b05b7||_0x0c4b('0x14'));_0x50be9a[_0x0c4b('0xf')]();}}else{_0x50be9a[_0x0c4b('0x14')]();}}catch(_0x1ff805){logger['error'](_0x0c4b('0x17'),_0x11de37,_0x1ff805[_0x0c4b('0xd')]);_0x50be9a[_0x0c4b('0xf')]();}}}catch(_0x157e8b){logger[_0x0c4b('0xb')](_0x0c4b('0x18'),_0x11de37,JSON[_0x0c4b('0x19')](_0x157e8b));_0x50be9a['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 72ff63d..d90b8f5 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 _0x341f=['[%s][GOTOP]\x20%s','stringify','validate','lodash','../../../../config/logger','routing','number','consequence','length','error','message','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','next'];(function(_0x3eee0b,_0x460350){var _0x65f9ea=function(_0x38d0a0){while(--_0x38d0a0){_0x3eee0b['push'](_0x3eee0b['shift']());}};_0x65f9ea(++_0x460350);}(_0x341f,0x1e8));var _0xf341=function(_0x26b5fa,_0x1bea6f){_0x26b5fa=_0x26b5fa-0x0;var _0x4568c9=_0x341f[_0x26b5fa];return _0x4568c9;};'use strict';var schema=require(_0xf341('0x0'));var _=require(_0xf341('0x1'));var logger=require(_0xf341('0x2'))(_0xf341('0x3'));var gotop=schema({'priority':{'type':_0xf341('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xf341('0x5')]=function(_0x90e402,_0x568bac){return function(_0x36f111){try{var _0x2e21e2={'priority':_0x568bac[0x0]};var _0x4e5d23=gotop[_0xf341('0x0')](_0x2e21e2,{'typecast':!![]});if(_0x4e5d23[_0xf341('0x6')]){logger[_0xf341('0x7')]('[%s][GOTOP]\x20%s',_0x90e402,_['map'](_0x4e5d23,_0xf341('0x8'))['join'](',\x20'));_0x36f111[_0xf341('0x9')]();}else{logger['info'](_0xf341('0xa'),_0x90e402,_0x2e21e2[_0xf341('0xb')]);if(_0x2e21e2[_0xf341('0xb')]){var _0x2f319b=_[_0xf341('0xc')](_0x36f111[_0xf341('0xd')](),{'p':_0x2e21e2[_0xf341('0xb')]});if(_0x2f319b>=0x0){logger[_0xf341('0xe')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x90e402,_0x2e21e2['priority']||_0xf341('0xf'),_0x2f319b);_0x36f111[_0xf341('0xf')](_0x2f319b);}else{logger[_0xf341('0xe')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x90e402,_0x2e21e2[_0xf341('0xb')]||_0xf341('0xf'));_0x36f111[_0xf341('0x9')]();}}else{_0x36f111['next']();}}}catch(_0x288785){logger[_0xf341('0x7')](_0xf341('0x10'),_0x90e402,JSON[_0xf341('0x11')](_0x288785));_0x36f111[_0xf341('0x9')]();}};}; \ No newline at end of file +var _0x47cc=['../../../../config/logger','consequence','length','error','[%s][GOTOP]\x20%s','map','message','stop','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash'];(function(_0x54c98a,_0x2a6ec8){var _0x2d42d5=function(_0x1950e3){while(--_0x1950e3){_0x54c98a['push'](_0x54c98a['shift']());}};_0x2d42d5(++_0x2a6ec8);}(_0x47cc,0x1c0));var _0xc47c=function(_0x1a4b9e,_0x53648c){_0x1a4b9e=_0x1a4b9e-0x0;var _0x1587b1=_0x47cc[_0x1a4b9e];return _0x1587b1;};'use strict';var schema=require(_0xc47c('0x0'));var _=require(_0xc47c('0x1'));var logger=require(_0xc47c('0x2'))('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xc47c('0x3')]=function(_0x65c35e,_0x5231c6){return function(_0x58936f){try{var _0x383057={'priority':_0x5231c6[0x0]};var _0x1e73fa=gotop[_0xc47c('0x0')](_0x383057,{'typecast':!![]});if(_0x1e73fa[_0xc47c('0x4')]){logger[_0xc47c('0x5')](_0xc47c('0x6'),_0x65c35e,_[_0xc47c('0x7')](_0x1e73fa,_0xc47c('0x8'))['join'](',\x20'));_0x58936f[_0xc47c('0x9')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x65c35e,_0x383057[_0xc47c('0xa')]);if(_0x383057[_0xc47c('0xa')]){var _0x4e87fe=_[_0xc47c('0xb')](_0x58936f[_0xc47c('0xc')](),{'p':_0x383057[_0xc47c('0xa')]});if(_0x4e87fe>=0x0){logger[_0xc47c('0xd')](_0xc47c('0xe'),_0x65c35e,_0x383057[_0xc47c('0xa')]||'next',_0x4e87fe);_0x58936f[_0xc47c('0xf')](_0x4e87fe);}else{logger[_0xc47c('0xd')](_0xc47c('0x10'),_0x65c35e,_0x383057[_0xc47c('0xa')]||_0xc47c('0xf'));_0x58936f[_0xc47c('0x9')]();}}else{_0x58936f[_0xc47c('0xf')]();}}}catch(_0x5887ee){logger[_0xc47c('0x5')](_0xc47c('0x6'),_0x65c35e,JSON[_0xc47c('0x11')](_0x5887ee));_0x58936f['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index b00aeed..81dbbaf 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 _0x4fe9=['./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','contact','channel','ChatWebsiteId','account','AccountId','upperFirst','interaction','Message','create','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash'];(function(_0xa6f6a6,_0x138b7a){var _0x71a78a=function(_0x3070d1){while(--_0x3070d1){_0xa6f6a6['push'](_0xa6f6a6['shift']());}};_0x71a78a(++_0x138b7a);}(_0x4fe9,0x151));var _0x94fe=function(_0xecf679,_0x48a7af){_0xecf679=_0xecf679-0x0;var _0x31724c=_0x4fe9[_0xecf679];return _0x31724c;};'use strict';var _=require(_0x94fe('0x0'));var utils=require(_0x94fe('0x1'));var logger=require(_0x94fe('0x2'))(_0x94fe('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x94fe('0x4')),'mailMessage':require(_0x94fe('0x5')),'smsMessage':require(_0x94fe('0x6')),'faxMessage':require(_0x94fe('0x7')),'whatsappMessage':require(_0x94fe('0x8'))};exports['consequence']=function(_0x2a61f0,_0x2811e3){return function(_0x5891a1){try{var _0x2bead6={'body':utils['getMustacheRender'](_0x2811e3[0x0],this),'ContactId':this[_0x94fe('0x9')]['id']};if(this[_0x94fe('0xa')]==='chat'){_0x2bead6[_0x94fe('0xb')]=this[_0x94fe('0xc')]['id'];}else{_0x2bead6[_['upperFirst'](this['channel'])+_0x94fe('0xd')]=this[_0x94fe('0xc')]['id'];}_0x2bead6[_[_0x94fe('0xe')](this[_0x94fe('0xa')])+'InteractionId']=this[_0x94fe('0xf')]['id'];if(rpc[this[_0x94fe('0xa')]+_0x94fe('0x10')]){return rpc[this[_0x94fe('0xa')]+'Message'][_0x94fe('0x11')](_0x2bead6)['then'](function(_0x16cca0){logger[_0x94fe('0x12')](_0x94fe('0x13'),_0x2a61f0,_0x2bead6[_0x94fe('0x14')]);_0x5891a1[_0x94fe('0x15')]();})[_0x94fe('0x16')](function(_0x12c3c3){logger[_0x94fe('0x17')]('[%s][MESSAGE]\x20%s',_0x2a61f0,JSON[_0x94fe('0x18')](_0x12c3c3));_0x5891a1['stop']();});}}catch(_0x59953a){logger[_0x94fe('0x17')]('[%s][MESSAGE]\x20%s',_0x2a61f0,JSON[_0x94fe('0x18')](_0x59953a));_0x5891a1[_0x94fe('0x19')]();}};}; \ No newline at end of file +var _0x7265=['error','stringify','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','body','catch'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x7265,0x73));var _0x5726=function(_0x3fe629,_0x67f6f2){_0x3fe629=_0x3fe629-0x0;var _0xba59dd=_0x7265[_0x3fe629];return _0xba59dd;};'use strict';var _=require('lodash');var utils=require(_0x5726('0x0'));var logger=require(_0x5726('0x1'))(_0x5726('0x2'));var rpc={'chatMessage':require(_0x5726('0x3')),'openchannelMessage':require(_0x5726('0x4')),'mailMessage':require(_0x5726('0x5')),'smsMessage':require(_0x5726('0x6')),'faxMessage':require(_0x5726('0x7')),'whatsappMessage':require(_0x5726('0x8'))};exports[_0x5726('0x9')]=function(_0x1f0cec,_0x3337d8){return function(_0x592a56){try{var _0x52e65a={'body':utils['getMustacheRender'](_0x3337d8[0x0],this),'ContactId':this[_0x5726('0xa')]['id']};if(this[_0x5726('0xb')]===_0x5726('0xc')){_0x52e65a[_0x5726('0xd')]=this[_0x5726('0xe')]['id'];}else{_0x52e65a[_[_0x5726('0xf')](this[_0x5726('0xb')])+_0x5726('0x10')]=this['account']['id'];}_0x52e65a[_['upperFirst'](this['channel'])+_0x5726('0x11')]=this[_0x5726('0x12')]['id'];if(rpc[this[_0x5726('0xb')]+_0x5726('0x13')]){return rpc[this[_0x5726('0xb')]+'Message'][_0x5726('0x14')](_0x52e65a)['then'](function(_0x4f15bf){logger[_0x5726('0x15')](_0x5726('0x16'),_0x1f0cec,_0x52e65a[_0x5726('0x17')]);_0x592a56['next']();})[_0x5726('0x18')](function(_0x5aae96){logger[_0x5726('0x19')]('[%s][MESSAGE]\x20%s',_0x1f0cec,JSON[_0x5726('0x1a')](_0x5aae96));_0x592a56[_0x5726('0x1b')]();});}}catch(_0x419fe7){logger[_0x5726('0x19')]('[%s][MESSAGE]\x20%s',_0x1f0cec,JSON['stringify'](_0x419fe7));_0x592a56[_0x5726('0x1b')]();}};}; \ 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 2f49cc2..c19589b 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 _0xabf8=['getMustacheRender','next','error','stringify','./utils','routing','info','[%s][NOOP]\x20%s'];(function(_0x5a58af,_0x2fd0e0){var _0x40b593=function(_0x354331){while(--_0x354331){_0x5a58af['push'](_0x5a58af['shift']());}};_0x40b593(++_0x2fd0e0);}(_0xabf8,0x124));var _0x8abf=function(_0x10d910,_0x52d53b){_0x10d910=_0x10d910-0x0;var _0x2b824e=_0xabf8[_0x10d910];return _0x2b824e;};'use strict';var utils=require(_0x8abf('0x0'));var logger=require('../../../../config/logger')(_0x8abf('0x1'));exports['consequence']=function(_0x1d66b8,_0x3d50fb){return function(_0x494281){try{logger[_0x8abf('0x2')](_0x8abf('0x3'),_0x1d66b8,utils[_0x8abf('0x4')](_0x3d50fb[0x0],this));_0x494281[_0x8abf('0x5')]();}catch(_0x5212bb){logger[_0x8abf('0x6')]('[%s][NOOP]\x20%s',_0x1d66b8,JSON[_0x8abf('0x7')](_0x5212bb));_0x494281['stop']();}};}; \ No newline at end of file +var _0x33f0=['routing','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stop','../../../../config/logger'];(function(_0x1dd88c,_0x5c8342){var _0x4c94f6=function(_0x1abb34){while(--_0x1abb34){_0x1dd88c['push'](_0x1dd88c['shift']());}};_0x4c94f6(++_0x5c8342);}(_0x33f0,0x177));var _0x033f=function(_0x434e22,_0x537310){_0x434e22=_0x434e22-0x0;var _0xf38879=_0x33f0[_0x434e22];return _0xf38879;};'use strict';var utils=require('./utils');var logger=require(_0x033f('0x0'))(_0x033f('0x1'));exports['consequence']=function(_0xa2ba1c,_0x2277bd){return function(_0x3e90f8){try{logger[_0x033f('0x2')](_0x033f('0x3'),_0xa2ba1c,utils[_0x033f('0x4')](_0x2277bd[0x0],this));_0x3e90f8[_0x033f('0x5')]();}catch(_0x47a9ac){logger[_0x033f('0x6')](_0x033f('0x3'),_0xa2ba1c,JSON['stringify'](_0x47a9ac));_0x3e90f8[_0x033f('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 0db70d6..0a3ff2d 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 _0x008c=['contact','list','upperFirst','QueueId','InteractionId','interaction','message','channel','info','[%s][START:QUEUE][NAME:%s]','name','account','QueueReport','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','body','update','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','timeout','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','rrmemory','beepall','log','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','queue','clone','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x27010e,_0x3acdaa){var _0x1091a5=function(_0x5ee22e){while(--_0x5ee22e){_0x27010e['push'](_0x27010e['shift']());}};_0x1091a5(++_0x3acdaa);}(_0x008c,0x188));var _0xc008=function(_0x13b7fd,_0x4eaf7f){_0x13b7fd=_0x13b7fd-0x0;var _0x32a74a=_0x008c[_0x13b7fd];return _0x32a74a;};'use strict';var schema=require(_0xc008('0x0'));var _=require(_0xc008('0x1'));var util=require(_0xc008('0x2'));var seqqueue=require(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var Redis=require('ioredis');var config=require(_0xc008('0x5'));var logger=require(_0xc008('0x6'))(_0xc008('0x7'));var strategy=require(_0xc008('0x8'));config[_0xc008('0x9')]=_[_0xc008('0xa')](config[_0xc008('0x9')],{'host':_0xc008('0xb'),'port':0x18eb});var io=require(_0xc008('0xc'))(new Redis(config['redis']));var attributes=['id',_0xc008('0xd'),'account',_0xc008('0xe'),'from','joinAt'];function emit(_0x27830d,_0x7231b4,_0x57c46d){io['to'](_0x27830d)['emit'](_0x7231b4,_0x57c46d);}function emitChannelQueueInteraction(_0x543eb8,_0x1eacfa,_0xc881aa,_0x5b2004,_0xae2dab,_0x332fd4,_0x2ea200,_0x2a5b4e){var _0x9ffa93=_[_0xc008('0xf')](_0xc881aa);_0x9ffa93[_0xc008('0xd')]=_0x2a5b4e;_0x9ffa93['queue']=_0x1eacfa;_0x9ffa93['account']=_0x5b2004;_0x9ffa93['id']=_0xae2dab;if(_0x332fd4){_0x2ea200[util[_0xc008('0x10')]('%sQueuesWaitingInteractions',_0x543eb8)][_0xae2dab]=_[_0xc008('0x11')](_0x9ffa93,attributes);}else{delete _0x2ea200[util[_0xc008('0x10')](_0xc008('0x12'),_0x543eb8)][_0xae2dab];}emit(util[_0xc008('0x10')](_0xc008('0x13'),_0x543eb8,_0x1eacfa),util['format']('%s_queue_waiting_interaction:%s',_0x543eb8,_0x332fd4?'save':_0xc008('0x14')),_[_0xc008('0x11')](_0x9ffa93,attributes));}var rpc={'openchannelQueueReport':require(_0xc008('0x15')),'mailQueueReport':require(_0xc008('0x16')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xc008('0x17'),'required':!![],'message':_0xc008('0x18')},'timeout':{'type':'number','message':_0xc008('0x19')}});function startRouting(_0x5906e6,_0x4bd611,_0x543e5d,_0x50261c){if(_0x5906e6&&_0x4bd611&&_0x543e5d){_0x4bd611[_0xc008('0x1a')]+=0x1;var _0x4b9726={'uniqueid':_0x5906e6,'from':_0x543e5d['body']?_0x543e5d['body']['from']:'','joinAt':moment()['format'](_0xc008('0x1b')),'ContactId':_0x543e5d[_0xc008('0x1c')]?_0x543e5d[_0xc008('0x1c')]['id']:null,'ListId':_0x543e5d[_0xc008('0x1d')]?_0x543e5d[_0xc008('0x1d')]['id']:null};_0x4b9726[_[_0xc008('0x1e')](_0x543e5d['channel'])+_0xc008('0x1f')]=_0x4bd611['id']||null;_0x4b9726[_['upperFirst'](_0x543e5d['channel'])+_0xc008('0x20')]=_0x543e5d[_0xc008('0x21')]?_0x543e5d[_0xc008('0x21')]['id']:null;_0x4b9726[_[_0xc008('0x1e')](_0x543e5d['channel'])+'MessageId']=_0x543e5d['message']?_0x543e5d[_0xc008('0x22')]['id']:null;_0x4b9726[_[_0xc008('0x1e')](_0x543e5d[_0xc008('0x23')])+(_0x543e5d[_0xc008('0x23')]!=='chat'?'AccountId':'WebsiteId')]=_0x543e5d['account']?_0x543e5d['account']['id']:null;logger[_0xc008('0x24')](util[_0xc008('0x10')](_0xc008('0x25'),_0x5906e6,_0x4bd611['name']));emitChannelQueueInteraction(_0x543e5d[_0xc008('0x23')],_0x4bd611[_0xc008('0x26')],_0x4b9726,_0x543e5d[_0xc008('0x27')][_0xc008('0x26')],_0x543e5d['message']['id'],!![],_0x50261c,_0x4bd611['id']);if(rpc[_0x543e5d[_0xc008('0x23')]+_0xc008('0x28')]){return rpc[_0x543e5d['channel']+'QueueReport']['create'](_0x4b9726)[_0xc008('0x29')](function(_0x267abd){logger[_0xc008('0x2a')](_0xc008('0x2b'));});}}}function stopRouting(_0x1de04b,_0xceebc3,_0x294f97,_0x22d8e8){if(_0x1de04b&&_0xceebc3){_0xceebc3[_0xc008('0x1a')]-=0x1;var _0x2b862d={'leaveAt':moment()[_0xc008('0x10')](_0xc008('0x1b')),'acceptAt':moment()['format'](_0xc008('0x1b')),'reason':_0xc008('0x2c')};logger['info'](util[_0xc008('0x10')](_0xc008('0x2d'),_0x1de04b,_0xceebc3[_0xc008('0x26')]));emitChannelQueueInteraction(_0x294f97[_0xc008('0x23')],_0xceebc3[_0xc008('0x26')],_0x294f97[_0xc008('0x2e')],_0x294f97[_0xc008('0x27')][_0xc008('0x26')],_0x294f97[_0xc008('0x22')]['id'],![],_0x22d8e8,_0xceebc3['id']);if(rpc[_0x294f97['channel']+_0xc008('0x28')]){return rpc[_0x294f97[_0xc008('0x23')]+_0xc008('0x28')][_0xc008('0x2f')](_0x1de04b,_0x2b862d)[_0xc008('0x29')](function(_0x315562){logger[_0xc008('0x2a')]('update\x20queue\x20report');});}}}function endRouting(_0x35f360,_0x21763f,_0x50e1d4,_0x399b64){if(_0x35f360&&_0x21763f){_0x21763f[_0xc008('0x1a')]-=0x1;var _0x5e38d5={'leaveAt':moment()[_0xc008('0x10')](_0xc008('0x1b')),'exitAt':moment()[_0xc008('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger['info'](util[_0xc008('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x35f360,_0x21763f[_0xc008('0x26')]));emitChannelQueueInteraction(_0x50e1d4[_0xc008('0x23')],_0x21763f[_0xc008('0x26')],_0x50e1d4[_0xc008('0x2e')],_0x50e1d4[_0xc008('0x27')][_0xc008('0x26')],_0x50e1d4[_0xc008('0x22')]['id'],![],_0x399b64);if(rpc[_0x50e1d4[_0xc008('0x23')]+_0xc008('0x28')]){return rpc[_0x50e1d4[_0xc008('0x23')]+_0xc008('0x28')][_0xc008('0x2f')](_0x35f360,_0x5e38d5)[_0xc008('0x29')](function(_0x2bf3fd){logger['error'](_0xc008('0x30'));});}}}function handleFindQueue(_0x23c4db){return function(_0x30b7df){return _0x30b7df[_0xc008('0x26')]['toLowerCase']()===_0x23c4db[_0xc008('0x31')]();};}exports[_0xc008('0x32')]=function(_0xc8cb91,_0x36e7ae,_0x2d142d,_0x5706bb){return function(_0x398cdd){try{var _0x3323f4={'name':_0x36e7ae[0x0],'timeout':_0x36e7ae[0x1]};var _0x3794b0=queue[_0xc008('0x0')](_0x3323f4,{'typecast':!![]});if(_0x3794b0[_0xc008('0x33')]){logger['error'](_0xc008('0x34'),_0xc8cb91,_[_0xc008('0x35')](_0x3794b0,_0xc008('0x22'))[_0xc008('0x36')](',\x20'));_0x398cdd['stop']();}else{var _0x26cd05=_[_0xc008('0x37')](_0x2d142d[_0x5706bb[_0xc008('0x23')]+'Queues'],handleFindQueue(_0x3323f4[_0xc008('0x26')]));if(_0x26cd05){startRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);var _0x49a176=(_0x26cd05[_0xc008('0x38')]||0xa)*0x3e8;var _0x5d3a72=(_0x3323f4[_0xc008('0x38')]||0x14)*0x3e8;var _0x213014,_0x5a5d85;if(_0x49a176>_0x5d3a72){_0x5d3a72=_0x49a176;}var _0x31007c=seqqueue[_0xc008('0x39')](_0x49a176);_0x31007c['id']=_0xc8cb91;_0x31007c[_0xc008('0x3a')]=_0x49a176;_0x31007c['qtimeout']=_0x5d3a72;_0x31007c[_0xc008('0x23')]=_0x5706bb[_0xc008('0x23')];_0x2d142d[_0xc008('0x3b')][_0xc8cb91]['on'](_0xc008('0x3c'),function(){logger[_0xc008('0x24')](_0xc008('0x3d'),_0xc8cb91);stopRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);clearTimeout(_0x213014);_0x213014=undefined;_0x31007c['close'](!![]);if(_0x2d142d['rules'][_0xc8cb91]){delete _0x2d142d['rules'][_0xc8cb91];}_0x398cdd[_0xc008('0x3e')]();});_0x2d142d[_0xc008('0x3b')][_0xc8cb91]['on'](_0xc008('0x3f'),function(){if(_0x2d142d[_0xc008('0x3b')][_0xc8cb91]){delete _0x2d142d[_0xc008('0x3b')][_0xc8cb91];}});_0x213014=setTimeout(function(){logger[_0xc008('0x24')](_0xc008('0x40'),_0xc8cb91);endRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);clearTimeout(_0x213014);_0x31007c[_0xc008('0x41')](!![]);_0x398cdd['next']();},_0x5d3a72);switch(_0x26cd05['strategy']){case'rrmemory':strategy[_0xc008('0x42')](_0x31007c,_0x26cd05,_0x2d142d,_0x5706bb);break;default:strategy[_0xc008('0x43')](_0x31007c,_0x26cd05,_0x2d142d,_0x5706bb);}}else{logger[_0xc008('0x2a')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xc8cb91,_0x3323f4[_0xc008('0x26')]);_0x398cdd[_0xc008('0x3e')]();}}}catch(_0x17ab1a){console[_0xc008('0x44')](_0x17ab1a);logger[_0xc008('0x2a')](_0xc008('0x34'),_0xc8cb91,_0x17ab1a[_0xc008('0x45')]);_0x398cdd[_0xc008('0x3e')]();}};}; \ No newline at end of file +var _0x9957=['seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','account','queue','joinAt','emit','clone','queue_id','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','timeout\x20is\x20a\x20number','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','WebsiteId','info','name','QueueReport','create','catch','error','waiting','accepted','body','[%s][END:QUEUE][NAME:%s]','update','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','timeout','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util'];(function(_0x659f5f,_0x1800a0){var _0xcccfd7=function(_0x56b265){while(--_0x56b265){_0x659f5f['push'](_0x659f5f['shift']());}};_0xcccfd7(++_0x1800a0);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var util=require(_0x7995('0x2'));var seqqueue=require(_0x7995('0x3'));var moment=require('moment');var Redis=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var strategy=require('./strategy');config[_0x7995('0x8')]=_[_0x7995('0x9')](config[_0x7995('0x8')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x8')]));var attributes=['id','queue_id',_0x7995('0xc'),_0x7995('0xd'),'from',_0x7995('0xe')];function emit(_0x3116fb,_0x18c8a3,_0x35b5fe){io['to'](_0x3116fb)[_0x7995('0xf')](_0x18c8a3,_0x35b5fe);}function emitChannelQueueInteraction(_0x1e400a,_0x341672,_0x524f7b,_0x245143,_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e=_[_0x7995('0x10')](_0x524f7b);_0x19a27e[_0x7995('0x11')]=_0x2cb37a;_0x19a27e[_0x7995('0xd')]=_0x341672;_0x19a27e[_0x7995('0xc')]=_0x245143;_0x19a27e['id']=_0x41c652;if(_0x581f22){_0xb0c872[util['format']('%sQueuesWaitingInteractions',_0x1e400a)][_0x41c652]=_[_0x7995('0x12')](_0x19a27e,attributes);}else{delete _0xb0c872[util[_0x7995('0x13')](_0x7995('0x14'),_0x1e400a)][_0x41c652];}emit(util[_0x7995('0x13')](_0x7995('0x15'),_0x1e400a,_0x341672),util[_0x7995('0x13')](_0x7995('0x16'),_0x1e400a,_0x581f22?_0x7995('0x17'):'remove'),_[_0x7995('0x12')](_0x19a27e,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x7995('0x18')),'chatQueueReport':require(_0x7995('0x19')),'smsQueueReport':require(_0x7995('0x1a')),'faxQueueReport':require(_0x7995('0x1b')),'whatsappQueueReport':require(_0x7995('0x1c'))};var queue=schema({'name':{'type':_0x7995('0x1d'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x7995('0x1e')}});function startRouting(_0x5e6f90,_0x555f74,_0x3ec178,_0x3d463e){if(_0x5e6f90&&_0x555f74&&_0x3ec178){_0x555f74['waiting']+=0x1;var _0x3a9b54={'uniqueid':_0x5e6f90,'from':_0x3ec178['body']?_0x3ec178['body'][_0x7995('0x1f')]:'','joinAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'ContactId':_0x3ec178[_0x7995('0x21')]?_0x3ec178[_0x7995('0x21')]['id']:null,'ListId':_0x3ec178[_0x7995('0x22')]?_0x3ec178['list']['id']:null};_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x25')]=_0x555f74['id']||null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+_0x7995('0x26')]=_0x3ec178[_0x7995('0x27')]?_0x3ec178[_0x7995('0x27')]['id']:null;_0x3a9b54[_['upperFirst'](_0x3ec178[_0x7995('0x24')])+_0x7995('0x28')]=_0x3ec178[_0x7995('0x29')]?_0x3ec178[_0x7995('0x29')]['id']:null;_0x3a9b54[_[_0x7995('0x23')](_0x3ec178[_0x7995('0x24')])+(_0x3ec178['channel']!==_0x7995('0x2a')?'AccountId':_0x7995('0x2b'))]=_0x3ec178[_0x7995('0xc')]?_0x3ec178[_0x7995('0xc')]['id']:null;logger[_0x7995('0x2c')](util[_0x7995('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x5e6f90,_0x555f74[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x3ec178['channel'],_0x555f74[_0x7995('0x2d')],_0x3a9b54,_0x3ec178[_0x7995('0xc')][_0x7995('0x2d')],_0x3ec178['message']['id'],!![],_0x3d463e,_0x555f74['id']);if(rpc[_0x3ec178['channel']+'QueueReport']){return rpc[_0x3ec178[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x2f')](_0x3a9b54)[_0x7995('0x30')](function(_0x2e3493){logger[_0x7995('0x31')]('create\x20queue\x20report');});}}}function stopRouting(_0x481c74,_0xfa8f15,_0x5524af,_0x553671){if(_0x481c74&&_0xfa8f15){_0xfa8f15[_0x7995('0x32')]-=0x1;var _0x29fac5={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'acceptAt':moment()['format'](_0x7995('0x20')),'reason':_0x7995('0x33')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x481c74,_0xfa8f15[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x5524af[_0x7995('0x24')],_0xfa8f15['name'],_0x5524af[_0x7995('0x34')],_0x5524af['account'][_0x7995('0x2d')],_0x5524af[_0x7995('0x29')]['id'],![],_0x553671,_0xfa8f15['id']);if(rpc[_0x5524af[_0x7995('0x24')]+'QueueReport']){return rpc[_0x5524af['channel']+_0x7995('0x2e')]['update'](_0x481c74,_0x29fac5)['catch'](function(_0x3e99cd){logger[_0x7995('0x31')]('update\x20queue\x20report');});}}}function endRouting(_0x1baa15,_0x1922b4,_0x2b772f,_0x18667c){if(_0x1baa15&&_0x1922b4){_0x1922b4[_0x7995('0x32')]-=0x1;var _0x53002a={'leaveAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'exitAt':moment()[_0x7995('0x13')](_0x7995('0x20')),'reason':'timeout'};logger[_0x7995('0x2c')](util[_0x7995('0x13')](_0x7995('0x35'),_0x1baa15,_0x1922b4[_0x7995('0x2d')]));emitChannelQueueInteraction(_0x2b772f[_0x7995('0x24')],_0x1922b4[_0x7995('0x2d')],_0x2b772f['body'],_0x2b772f[_0x7995('0xc')][_0x7995('0x2d')],_0x2b772f[_0x7995('0x29')]['id'],![],_0x18667c);if(rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')]){return rpc[_0x2b772f[_0x7995('0x24')]+_0x7995('0x2e')][_0x7995('0x36')](_0x1baa15,_0x53002a)[_0x7995('0x30')](function(_0x447981){logger[_0x7995('0x31')](_0x7995('0x37'));});}}}function handleFindQueue(_0x7b4e67){return function(_0x53cda2){return _0x53cda2['name'][_0x7995('0x38')]()===_0x7b4e67[_0x7995('0x38')]();};}exports['consequence']=function(_0x4b0855,_0x3f8522,_0x4a9fef,_0x504a33){return function(_0x23da6b){try{var _0x36e28b={'name':_0x3f8522[0x0],'timeout':_0x3f8522[0x1]};var _0x35c8ff=queue['validate'](_0x36e28b,{'typecast':!![]});if(_0x35c8ff[_0x7995('0x39')]){logger['error'](_0x7995('0x3a'),_0x4b0855,_['map'](_0x35c8ff,'message')[_0x7995('0x3b')](',\x20'));_0x23da6b[_0x7995('0x3c')]();}else{var _0xc04e5=_[_0x7995('0x3d')](_0x4a9fef[_0x504a33['channel']+_0x7995('0x3e')],handleFindQueue(_0x36e28b[_0x7995('0x2d')]));if(_0xc04e5){startRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);var _0x31b347=(_0xc04e5[_0x7995('0x3f')]||0xa)*0x3e8;var _0x4e09b7=(_0x36e28b['timeout']||0x14)*0x3e8;var _0x1c37c6,_0x55791b;if(_0x31b347>_0x4e09b7){_0x4e09b7=_0x31b347;}var _0x23c41d=seqqueue['createQueue'](_0x31b347);_0x23c41d['id']=_0x4b0855;_0x23c41d[_0x7995('0x40')]=_0x31b347;_0x23c41d['qtimeout']=_0x4e09b7;_0x23c41d[_0x7995('0x24')]=_0x504a33[_0x7995('0x24')];_0x4a9fef['rules'][_0x4b0855]['on'](_0x7995('0x41'),function(){logger[_0x7995('0x2c')](_0x7995('0x42'),_0x4b0855);stopRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x1c37c6=undefined;_0x23c41d[_0x7995('0x43')](!![]);if(_0x4a9fef['rules'][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}_0x23da6b[_0x7995('0x3c')]();});_0x4a9fef[_0x7995('0x44')][_0x4b0855]['on']('complete',function(){if(_0x4a9fef[_0x7995('0x44')][_0x4b0855]){delete _0x4a9fef[_0x7995('0x44')][_0x4b0855];}});_0x1c37c6=setTimeout(function(){logger[_0x7995('0x2c')](_0x7995('0x45'),_0x4b0855);endRouting(_0x4b0855,_0xc04e5,_0x504a33,_0x4a9fef);clearTimeout(_0x1c37c6);_0x23c41d[_0x7995('0x43')](!![]);_0x23da6b['next']();},_0x4e09b7);switch(_0xc04e5[_0x7995('0x46')]){case _0x7995('0x47'):strategy['rrmemory'](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);break;default:strategy[_0x7995('0x48')](_0x23c41d,_0xc04e5,_0x4a9fef,_0x504a33);}}else{logger['error'](_0x7995('0x49'),_0x4b0855,_0x36e28b[_0x7995('0x2d')]);_0x23da6b[_0x7995('0x3c')]();}}}catch(_0x30e220){console[_0x7995('0x4a')](_0x30e220);logger[_0x7995('0x31')](_0x7995('0x3a'),_0x4b0855,_0x30e220['stack']);_0x23da6b[_0x7995('0x3c')]();}};}; \ 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 3882470..89d959f 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 _0x7495=[':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','writeLog','TIMEOUT','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','realtime','channel','agents','busy','busyQueue','showNotification','RINGING'];(function(_0x441b0d,_0x583627){var _0x552c55=function(_0x1e6890){while(--_0x1e6890){_0x441b0d['push'](_0x441b0d['shift']());}};_0x552c55(++_0x583627);}(_0x7495,0x15a));var _0x5749=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x7495[_0x26462c];return _0x509a42;};'use strict';var _=require(_0x5749('0x0'));var uuid=require(_0x5749('0x1'));var util=require('./util');var logger=require(_0x5749('0x2'))(_0x5749('0x3'));var Agent=function(_0x50650f,_0x5cd445,_0x394aac,_0x221eef){this[_0x5749('0x4')]=uuid['v4']();this[_0x5749('0x5')]=_0x50650f;this['agent']=_0x5cd445;this['realtime']=_0x394aac;this[_0x5749('0x3')]=_0x221eef;this['squeue'][_0x5749('0x6')](this[_0x5749('0x7')][_0x5749('0x8')](this),this[_0x5749('0x9')][_0x5749('0x8')](this));this[_0x5749('0x5')]['on'](_0x5749('0xa'),this[_0x5749('0x9')]['bind'](this));this[_0x5749('0x5')]['on'](_0x5749('0xb'),this[_0x5749('0xc')]['bind'](this));};Agent[_0x5749('0xd')][_0x5749('0x6')]=function(){this['squeue'][_0x5749('0x6')](this[_0x5749('0x7')]['bind'](this),this[_0x5749('0x9')][_0x5749('0x8')](this));};Agent['prototype'][_0x5749('0xc')]=function(){this[_0x5749('0x9')](!![]);};Agent[_0x5749('0xd')][_0x5749('0x7')]=function(_0x1a546b){logger[_0x5749('0xe')](_0x5749('0xf'),this[_0x5749('0x5')]['id'],this[_0x5749('0x10')]['id']);if(_[_0x5749('0x11')](this['realtime']['agents'][this[_0x5749('0x10')]['id']])){logger[_0x5749('0xe')](_0x5749('0x12'),this[_0x5749('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x5749('0x6')][_0x5749('0x8')](this),0x3e8);}else{if(this['routing'][_0x5749('0x13')]||util[_0x5749('0x14')](this['squeue']['id'],this[_0x5749('0x15')]['agents'][this[_0x5749('0x10')]['id']],this['squeue'][_0x5749('0x16')],![])){this[_0x5749('0x15')][_0x5749('0x17')][this['agent']['id']][_0x5749('0x18')]=!![];this[_0x5749('0x15')]['agents'][this['agent']['id']][_0x5749('0x19')]=undefined;util[_0x5749('0x1a')](this[_0x5749('0x4')],this['squeue']['id'],this[_0x5749('0x15')][_0x5749('0x17')][this[_0x5749('0x10')]['id']],null,this[_0x5749('0x3')]);util['writeLog'](this[_0x5749('0x5')]['id'],this['realtime'][_0x5749('0x17')][this[_0x5749('0x10')]['id']],_0x5749('0x1b')+(this[_0x5749('0x3')]['forcedOwnership']?_0x5749('0x1c'):''));}else{logger[_0x5749('0xe')](_0x5749('0x1d'),this[_0x5749('0x5')]['id'],this[_0x5749('0x10')]['id']);setTimeout(this[_0x5749('0x6')]['bind'](this),0x3e8);}}};Agent[_0x5749('0xd')][_0x5749('0x9')]=function(_0x12c107){if(_['isNil'](this[_0x5749('0x15')]['agents'][this['agent']['id']])){return logger[_0x5749('0xe')](_0x5749('0x12'),this[_0x5749('0x5')]['id'],this[_0x5749('0x10')]['id']);}else{logger[_0x5749('0xe')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x5749('0x5')]['id'],this['agent']['id']);util[_0x5749('0x1e')](this[_0x5749('0x4')],this[_0x5749('0x5')]['id'],this[_0x5749('0x15')][_0x5749('0x17')][this['agent']['id']],null,this[_0x5749('0x3')]);this['realtime'][_0x5749('0x17')][this[_0x5749('0x10')]['id']][_0x5749('0x18')]=![];this[_0x5749('0x15')][_0x5749('0x17')][this['agent']['id']][_0x5749('0x19')]=undefined;util[_0x5749('0x1f')](this['squeue']['id'],this[_0x5749('0x15')][_0x5749('0x17')][this['agent']['id']],_0x12c107?'STOP':_0x5749('0x20'));}if(!_0x12c107){setTimeout(this[_0x5749('0x6')][_0x5749('0x8')](this),0x3e8);}};function agent(_0x122a92,_0x1f8775,_0xfbaded,_0x50c284){return new Agent(_0x122a92,_0x1f8775,_0xfbaded,_0x50c284);}module[_0x5749('0x21')]=agent; \ No newline at end of file +var _0x6008=['handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','push','handleRun','bind','handleTimeout','drained','prototype'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x6008,0x10b));var _0x8600=function(_0x4c9b7a,_0x2267cf){_0x4c9b7a=_0x4c9b7a-0x0;var _0x529f7b=_0x6008[_0x4c9b7a];return _0x529f7b;};'use strict';var _=require(_0x8600('0x0'));var uuid=require('uuid');var util=require(_0x8600('0x1'));var logger=require(_0x8600('0x2'))(_0x8600('0x3'));var Agent=function(_0x2ab83d,_0x38d794,_0x34c063,_0x468182){this[_0x8600('0x4')]=uuid['v4']();this[_0x8600('0x5')]=_0x2ab83d;this[_0x8600('0x6')]=_0x38d794;this['realtime']=_0x34c063;this['routing']=_0x468182;this[_0x8600('0x5')][_0x8600('0x7')](this[_0x8600('0x8')][_0x8600('0x9')](this),this[_0x8600('0xa')][_0x8600('0x9')](this));this[_0x8600('0x5')]['on']('timeout',this['handleTimeout'][_0x8600('0x9')](this));this['squeue']['on'](_0x8600('0xb'),this['handleDrained']['bind'](this));};Agent[_0x8600('0xc')][_0x8600('0x7')]=function(){this[_0x8600('0x5')][_0x8600('0x7')](this['handleRun'][_0x8600('0x9')](this),this['handleTimeout'][_0x8600('0x9')](this));};Agent[_0x8600('0xc')][_0x8600('0xd')]=function(){this[_0x8600('0xa')](!![]);};Agent[_0x8600('0xc')][_0x8600('0x8')]=function(_0x4b99dd){logger[_0x8600('0xe')](_0x8600('0xf'),this['squeue']['id'],this[_0x8600('0x6')]['id']);if(_[_0x8600('0x10')](this[_0x8600('0x11')][_0x8600('0x12')][this[_0x8600('0x6')]['id']])){logger[_0x8600('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x8600('0x5')]['id'],this[_0x8600('0x6')]['id']);setTimeout(this[_0x8600('0x7')][_0x8600('0x9')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util[_0x8600('0x13')](this[_0x8600('0x5')]['id'],this[_0x8600('0x11')][_0x8600('0x12')][this[_0x8600('0x6')]['id']],this[_0x8600('0x5')][_0x8600('0x14')],![])){this[_0x8600('0x11')]['agents'][this[_0x8600('0x6')]['id']][_0x8600('0x15')]=!![];this[_0x8600('0x11')][_0x8600('0x12')][this[_0x8600('0x6')]['id']][_0x8600('0x16')]=undefined;util[_0x8600('0x17')](this['notificationId'],this[_0x8600('0x5')]['id'],this['realtime'][_0x8600('0x12')][this[_0x8600('0x6')]['id']],null,this[_0x8600('0x3')]);util[_0x8600('0x18')](this['squeue']['id'],this[_0x8600('0x11')]['agents'][this[_0x8600('0x6')]['id']],_0x8600('0x19')+(this[_0x8600('0x3')][_0x8600('0x1a')]?_0x8600('0x1b'):''));}else{logger[_0x8600('0xe')](_0x8600('0x1c'),this[_0x8600('0x5')]['id'],this[_0x8600('0x6')]['id']);setTimeout(this[_0x8600('0x7')]['bind'](this),0x3e8);}}};Agent[_0x8600('0xc')][_0x8600('0xa')]=function(_0x33851c){if(_[_0x8600('0x10')](this[_0x8600('0x11')][_0x8600('0x12')][this[_0x8600('0x6')]['id']])){return logger[_0x8600('0xe')](_0x8600('0x1d'),this[_0x8600('0x5')]['id'],this['agent']['id']);}else{logger[_0x8600('0xe')](_0x8600('0x1e'),this[_0x8600('0x5')]['id'],this[_0x8600('0x6')]['id']);util[_0x8600('0x1f')](this[_0x8600('0x4')],this[_0x8600('0x5')]['id'],this[_0x8600('0x11')][_0x8600('0x12')][this[_0x8600('0x6')]['id']],null,this[_0x8600('0x3')]);this[_0x8600('0x11')]['agents'][this[_0x8600('0x6')]['id']][_0x8600('0x15')]=![];this[_0x8600('0x11')][_0x8600('0x12')][this[_0x8600('0x6')]['id']][_0x8600('0x16')]=undefined;util['writeLog'](this[_0x8600('0x5')]['id'],this[_0x8600('0x11')][_0x8600('0x12')][this[_0x8600('0x6')]['id']],_0x33851c?_0x8600('0x20'):_0x8600('0x21'));}if(!_0x33851c){setTimeout(this[_0x8600('0x7')][_0x8600('0x9')](this),0x3e8);}};function agent(_0xe80a39,_0x375c5c,_0x5178c2,_0x229485){return new Agent(_0xe80a39,_0x375c5c,_0x5178c2,_0x229485);}module[_0x8600('0x22')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 1e097c3..0909438 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 _0x1638=['routing','squeue','queue','realtime','push','bind','handleTimeout','timeout','drained','handleRun','prototype','isNil','Agents','length','agents','info','isAgentAvailable','writeLog','RINGING','busy','busyQueue','name','showNotification','notificationId','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','STOP','TIMEOUT','exports','./util'];(function(_0xa79977,_0x4f7f12){var _0x109f10=function(_0x56780f){while(--_0x56780f){_0xa79977['push'](_0xa79977['shift']());}};_0x109f10(++_0x4f7f12);}(_0x1638,0x7b));var _0x8163=function(_0x468be0,_0x50b945){_0x468be0=_0x468be0-0x0;var _0x3c71ec=_0x1638[_0x468be0];return _0x3c71ec;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x8163('0x0'));var logger=require('../../../../../config/logger')(_0x8163('0x1'));var Beepall=function(_0x415dcd,_0x59d31f,_0x2d2a9c,_0x5cccf8){this['notificationId']=uuid['v4']();this[_0x8163('0x2')]=_0x415dcd;this[_0x8163('0x3')]=_0x59d31f;this[_0x8163('0x4')]=_0x2d2a9c;this[_0x8163('0x1')]=_0x5cccf8;this[_0x8163('0x2')][_0x8163('0x5')](this['handleRun'][_0x8163('0x6')](this),this[_0x8163('0x7')][_0x8163('0x6')](this));this[_0x8163('0x2')]['on'](_0x8163('0x8'),this[_0x8163('0x7')]['bind'](this));this[_0x8163('0x2')]['on'](_0x8163('0x9'),this['handleDrained'][_0x8163('0x6')](this));};Beepall['prototype'][_0x8163('0x5')]=function(){this['squeue'][_0x8163('0x5')](this[_0x8163('0xa')][_0x8163('0x6')](this),this['handleTimeout']['bind'](this));};Beepall['prototype']['handleDrained']=function(_0x5277d0){this[_0x8163('0x7')](!![]);};Beepall[_0x8163('0xb')][_0x8163('0xa')]=function(_0x47e214){var _0x4eb0cf=!![];if(!_[_0x8163('0xc')](this[_0x8163('0x3')])&&!_[_0x8163('0xc')](this['queue'][_0x8163('0xd')])&&this['queue']['Agents'][_0x8163('0xe')]>0x0){for(var _0xd2ceae=0x0,_0xf55204;_0xd2ceae0x0){for(var _0x23ec81=0x0,_0x297621;_0x23ec810x0&&_0x97ee3c[_0x136aee+_0x2600('0x20')]>=_0x97ee3c[_0x136aee+'Capacity']){writeLog(_0x3413b5,_0x97ee3c,_0x136aee[_0x2600('0x21')]()+_0x2600('0x22'));return![];}}return!![];};exports[_0x2600('0x23')]=function(_0x45bf0b,_0x4f0d8e,_0x44f04f,_0x52f4f7,_0x1e3c22){return sendNotification(!![],_0x45bf0b,_0x4f0d8e,_0x44f04f,_0x52f4f7,_0x1e3c22);};exports[_0x2600('0x24')]=function(_0x10916f,_0xa18cc,_0x487b80,_0x405c39,_0xbc26b9){return sendNotification(![],_0x10916f,_0xa18cc,_0x487b80,_0x405c39,_0xbc26b9);};exports['writeLog']=writeLog; \ No newline at end of file +var _0xf290=['notificationShake','body','queue','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','notification:%s','save','remove','isAgentAvailable','busy','BUSY','OFFLINE','PAUSE','hasOwnProperty','Capacity','toUpperCase','hideNotification','util','mustache','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','emit','format','user:%s','name','split','\x20interaction','account','notificationSound'];(function(_0x33a9e0,_0x2ae8c3){var _0x2a56b9=function(_0x229ad0){while(--_0x229ad0){_0x33a9e0['push'](_0x33a9e0['shift']());}};_0x2a56b9(++_0x2ae8c3);}(_0xf290,0xde));var _0x0f29=function(_0x142ec2,_0x5bb03d){_0x142ec2=_0x142ec2-0x0;var _0x45ef4e=_0xf290[_0x142ec2];return _0x45ef4e;};'use strict';var _=require('lodash');var util=require(_0x0f29('0x0'));var utils=require('../utils');var Mustache=require(_0x0f29('0x1'));var Redis=require('ioredis');var config=require(_0x0f29('0x2'));var logger=require(_0x0f29('0x3'))(_0x0f29('0x4'));config[_0x0f29('0x5')]=_[_0x0f29('0x6')](config['redis'],{'host':_0x0f29('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0f29('0x5')]));function emit(_0x1c45ec,_0x355e21,_0xaa2675){io['to'](_0x1c45ec)[_0x0f29('0x8')](_0x355e21,_0xaa2675);}function sendNotification(_0x45350b,_0x2be26e,_0x3c6a6e,_0x376de4,_0x139c65,_0xd4d3af){io['to'](util[_0x0f29('0x9')](_0x0f29('0xa'),_0x376de4[_0x0f29('0xb')]))[_0x0f29('0x8')]('user:save',_0x376de4);var _0x38eb8f=_0xd4d3af||{};var _0x5f4796=_0x3c6a6e[_0x0f29('0xc')]('.');var _0x944e81={'uniqueid':_0x2be26e,'channel':_0x5f4796[0x0],'id':_0x5f4796[0x1],'title':_0x5f4796[0x0]+_0x0f29('0xd'),'interactionId':_0x5f4796[0x2],'queue':_0x139c65?_0x139c65[_0x0f29('0xb')]:null,'sound':_0x38eb8f[_0x0f29('0xe')][_0x0f29('0xf')],'shake':_0x38eb8f['account'][_0x0f29('0x10')]};try{if(!_0x38eb8f[_0x0f29('0x11')]){_0x38eb8f[_0x0f29('0x11')]={};}if(_0x139c65){_0x38eb8f[_0x0f29('0x11')][_0x0f29('0x12')]=_0x139c65;}else if(_0x38eb8f[_0x0f29('0x11')][_0x0f29('0x12')]){delete _0x38eb8f[_0x0f29('0x11')]['queue'];}_0x944e81['msg']=utils[_0x0f29('0x13')](_0x38eb8f[_0x0f29('0xe')][_0x0f29('0x14')],_0x38eb8f);}catch(_0x233c78){_0x944e81['msg']=_0x0f29('0x15');logger['error'](util[_0x0f29('0x9')]('[%s][QUEUE]\x20%s',_0x2be26e,_0x233c78['message']));}io['to'](util['format'](_0x0f29('0xa'),_0x376de4[_0x0f29('0xb')]))[_0x0f29('0x8')](util[_0x0f29('0x9')](_0x0f29('0x16'),_0x45350b?_0x0f29('0x17'):_0x0f29('0x18')),_0x944e81);}function writeLog(_0x4888b6,_0x49d954,_0x5a5a03){return logger['info'](util['format']('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x4888b6,_0x49d954[_0x0f29('0xb')],_0x5a5a03));}exports[_0x0f29('0x19')]=function(_0x563d15,_0x1ac33e,_0x1840e0,_0x346db8){if(_0x1ac33e[_0x0f29('0x1a')]){writeLog(_0x563d15,_0x1ac33e,_0x0f29('0x1b'));return![];}if(!_0x1ac33e['online']){writeLog(_0x563d15,_0x1ac33e,_0x0f29('0x1c'));return![];}if(_0x1ac33e[_0x1840e0+'Pause']){writeLog(_0x563d15,_0x1ac33e,_0x0f29('0x1d'));return![];}if(_0x346db8&&_0x1ac33e[_0x0f29('0x1e')](_0x1840e0+_0x0f29('0x1f'))&&_0x1ac33e[_0x0f29('0x1e')](_0x1840e0+'CurrentCapacity')){if(_0x1ac33e[_0x1840e0+_0x0f29('0x1f')]>0x0&&_0x1ac33e[_0x1840e0+'CurrentCapacity']>=_0x1ac33e[_0x1840e0+'Capacity']){writeLog(_0x563d15,_0x1ac33e,_0x1840e0[_0x0f29('0x20')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x57dcc7,_0x4dd0b0,_0x3c6ce9,_0x1f4ad2,_0x4cc5a0){return sendNotification(!![],_0x57dcc7,_0x4dd0b0,_0x3c6ce9,_0x1f4ad2,_0x4cc5a0);};exports[_0x0f29('0x21')]=function(_0x2ab528,_0x274c9d,_0x51e7dc,_0x56e729,_0x37ebcc){return sendNotification(![],_0x2ab528,_0x274c9d,_0x51e7dc,_0x56e729,_0x37ebcc);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 3107656..e2212ce 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 _0x494a=['./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','validate','error','[%s][SYSTEM]\x20%s','message','join','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim','info','replace','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','shelljs','lodash'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x494a,0x140));var _0xa494=function(_0x2f7360,_0x40f6a6){_0x2f7360=_0x2f7360-0x0;var _0x3c49e9=_0x494a[_0x2f7360];return _0x3c49e9;};'use strict';var schema=require('validate');var sh=require(_0xa494('0x0'));var _=require(_0xa494('0x1'));var utils=require(_0xa494('0x2'));var logger=require(_0xa494('0x3'))('routing');var system=schema({'command':{'type':_0xa494('0x4'),'required':!![],'message':_0xa494('0x5')}});exports['consequence']=function(_0x332a89,_0x54ad85){return function(_0x3af646){try{var _0x1c8548={'command':_0x54ad85[0x0]};var _0x4d8155=system[_0xa494('0x6')](_0x1c8548,{'typecast':!![]});if(_0x4d8155['length']){logger[_0xa494('0x7')](_0xa494('0x8'),_0x332a89,_['map'](_0x4d8155,_0xa494('0x9'))[_0xa494('0xa')](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x332a89);_0x3af646[_0xa494('0xb')]();}else{var _0x1cb621=this;var _0xd4b6c0=utils[_0xa494('0xc')](_0x54ad85[0x0],this);logger['info'](_0xa494('0xd'),_0x332a89,_0xd4b6c0);sh['exec'](_[_0xa494('0xe')](_0xd4b6c0),function(_0x366430,_0x4b65af){logger[_0xa494('0xf')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x332a89,_0x366430);if(_0x366430==0x0){var _0x28d1ec=_0x4b65af[_0xa494('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0xa494('0x11')](_0x54ad85[0x1])||_[_0xa494('0x12')](_0x54ad85[0x1])){logger[_0xa494('0xf')]('[%s][SYSTEM]\x20no\x20variable',_0x332a89);_0x1cb621[_0xa494('0x13')][_0x54ad85[0x1]]=_0x28d1ec;}else{logger[_0xa494('0xf')](_0xa494('0x14'),_0x332a89,_0x54ad85[0x1],_0x28d1ec);_0x1cb621[_0xa494('0x13')][_0x54ad85[0x1]]=_0x28d1ec;}}_0x3af646[_0xa494('0xb')]();});}}catch(_0x24aa75){logger['error']('[%s][SYSTEM]\x20%s',_0x332a89,_['isObject'](_0x24aa75)?JSON[_0xa494('0x15')](_0x24aa75):_0x24aa75);logger['info'](_0xa494('0x16'),_0x332a89);_0x3af646['next']();}};}; \ No newline at end of file +var _0x7dbd=['info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','error','isObject','stringify','validate','shelljs','lodash','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','map','message','join'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7dbd,0x197));var _0xd7db=function(_0x5b013d,_0xc7691c){_0x5b013d=_0x5b013d-0x0;var _0x2b6eef=_0x7dbd[_0x5b013d];return _0x2b6eef;};'use strict';var schema=require(_0xd7db('0x0'));var sh=require(_0xd7db('0x1'));var _=require(_0xd7db('0x2'));var utils=require('./utils');var logger=require(_0xd7db('0x3'))(_0xd7db('0x4'));var system=schema({'command':{'type':_0xd7db('0x5'),'required':!![],'message':_0xd7db('0x6')}});exports[_0xd7db('0x7')]=function(_0x21b161,_0x4c82af){return function(_0xe1102b){try{var _0x4c6db1={'command':_0x4c82af[0x0]};var _0x34168d=system['validate'](_0x4c6db1,{'typecast':!![]});if(_0x34168d[_0xd7db('0x8')]){logger['error'](_0xd7db('0x9'),_0x21b161,_[_0xd7db('0xa')](_0x34168d,_0xd7db('0xb'))[_0xd7db('0xc')](',\x20'));logger[_0xd7db('0xd')](_0xd7db('0xe'),_0x21b161);_0xe1102b['next']();}else{var _0x1e5c36=this;var _0x2462c7=utils[_0xd7db('0xf')](_0x4c82af[0x0],this);logger['info'](_0xd7db('0x10'),_0x21b161,_0x2462c7);sh[_0xd7db('0x11')](_[_0xd7db('0x12')](_0x2462c7),function(_0x570cc2,_0x2ad31d){logger[_0xd7db('0xd')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x21b161,_0x570cc2);if(_0x570cc2==0x0){var _0x2b5d8f=_0x2ad31d[_0xd7db('0x13')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x4c82af[0x1])||_[_0xd7db('0x14')](_0x4c82af[0x1])){logger['info'](_0xd7db('0x15'),_0x21b161);_0x1e5c36[_0xd7db('0x16')][_0x4c82af[0x1]]=_0x2b5d8f;}else{logger[_0xd7db('0xd')](_0xd7db('0x17'),_0x21b161,_0x4c82af[0x1],_0x2b5d8f);_0x1e5c36[_0xd7db('0x16')][_0x4c82af[0x1]]=_0x2b5d8f;}}_0xe1102b[_0xd7db('0x18')]();});}}catch(_0x493051){logger[_0xd7db('0x19')](_0xd7db('0x9'),_0x21b161,_[_0xd7db('0x1a')](_0x493051)?JSON[_0xd7db('0x1b')](_0x493051):_0x493051);logger[_0xd7db('0xd')](_0xd7db('0xe'),_0x21b161);_0xe1102b[_0xd7db('0x18')]();}};}; \ 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 1c01291..58d5bac 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 _0xb271=['../../rpc/mailInteraction','../../rpc/whatsappInteraction','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','channel','catch','finally','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xb271,0x141));var _0x1b27=function(_0x1ba29a,_0x37ac72){_0x1ba29a=_0x1ba29a-0x0;var _0x2a536b=_0xb271[_0x1ba29a];return _0x2a536b;};'use strict';var schema=require(_0x1b27('0x0'));var _=require(_0x1b27('0x1'));var rpc={'chatInteraction':require(_0x1b27('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x1b27('0x3')),'mailInteraction':require(_0x1b27('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x1b27('0x5'))};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0x1b27('0x6'),'required':!![],'message':_0x1b27('0x7')}});exports[_0x1b27('0x8')]=function(_0x40a396,_0x1f21fd,_0x49bc26,_0x13e5f1){return function(_0x4669ed){try{var _0x48050b={'tag':_0x1f21fd[0x0]};var _0x4e59ca=tag['validate'](_0x48050b,{'typecast':!![]});if(_0x4e59ca['length']){logger[_0x1b27('0x9')](_0x1b27('0xa'),_0x40a396,_['map'](_0x4e59ca,_0x1b27('0xb'))[_0x1b27('0xc')](',\x20'));logger[_0x1b27('0xd')](_0x1b27('0xe'),_0x40a396);_0x4669ed[_0x1b27('0xf')]();}else{var _0x541d08={'ids':[_0x1f21fd[0x0]]};if(rpc[_0x13e5f1['channel']+_0x1b27('0x10')]){rpc[_0x13e5f1['channel']+_0x1b27('0x10')][_0x1b27('0x11')](_0x13e5f1[_0x1b27('0x12')]['id'],_0x541d08)[_0x1b27('0x13')](function(_0x531ec3){logger[_0x1b27('0xd')](_0x1b27('0x14'),_0x40a396,_0x1f21fd[0x1],_0x13e5f1[_0x1b27('0x15')],_0x13e5f1['interaction']['id']);})[_0x1b27('0x16')](function(_0x434258){logger[_0x1b27('0x9')](_0x1b27('0xa'),_0x40a396,JSON['stringify'](_0x434258));logger[_0x1b27('0xd')](_0x1b27('0xe'),_0x40a396);})[_0x1b27('0x17')](function(){_0x4669ed[_0x1b27('0xf')]();});}}}catch(_0x19c26d){logger['error'](_0x1b27('0xa'),_0x40a396,_['isObject'](_0x19c26d)?JSON[_0x1b27('0x18')](_0x19c26d):_0x19c26d);logger[_0x1b27('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x40a396);_0x4669ed[_0x1b27('0xf')]();}};}; \ No newline at end of file +var _0xe81e=['routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe81e,0x1cd));var _0xee81=function(_0x17cf02,_0x554107){_0x17cf02=_0x17cf02-0x0;var _0x4b9510=_0xe81e[_0x17cf02];return _0x4b9510;};'use strict';var schema=require(_0xee81('0x0'));var _=require(_0xee81('0x1'));var rpc={'chatInteraction':require(_0xee81('0x2')),'openchannelInteraction':require(_0xee81('0x3')),'smsInteraction':require(_0xee81('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xee81('0x5')),'whatsappInteraction':require(_0xee81('0x6'))};var logger=require('../../../../config/logger')(_0xee81('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0xee81('0x8')}});exports[_0xee81('0x9')]=function(_0x3c4161,_0x53eb2a,_0x3f266,_0x11f0d2){return function(_0x405b57){try{var _0x44a4a4={'tag':_0x53eb2a[0x0]};var _0x52515b=tag['validate'](_0x44a4a4,{'typecast':!![]});if(_0x52515b['length']){logger[_0xee81('0xa')](_0xee81('0xb'),_0x3c4161,_[_0xee81('0xc')](_0x52515b,_0xee81('0xd'))['join'](',\x20'));logger[_0xee81('0xe')](_0xee81('0xf'),_0x3c4161);_0x405b57[_0xee81('0x10')]();}else{var _0x17180d={'ids':[_0x53eb2a[0x0]]};if(rpc[_0x11f0d2[_0xee81('0x11')]+_0xee81('0x12')]){rpc[_0x11f0d2[_0xee81('0x11')]+_0xee81('0x12')][_0xee81('0x13')](_0x11f0d2[_0xee81('0x14')]['id'],_0x17180d)[_0xee81('0x15')](function(_0x562be4){logger[_0xee81('0xe')](_0xee81('0x16'),_0x3c4161,_0x53eb2a[0x1],_0x11f0d2[_0xee81('0x11')],_0x11f0d2[_0xee81('0x14')]['id']);})[_0xee81('0x17')](function(_0x53a56c){logger[_0xee81('0xa')](_0xee81('0xb'),_0x3c4161,JSON[_0xee81('0x18')](_0x53a56c));logger[_0xee81('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x3c4161);})[_0xee81('0x19')](function(){_0x405b57[_0xee81('0x10')]();});}}}catch(_0x4de72e){logger[_0xee81('0xa')]('[%s][TAG]\x20%s',_0x3c4161,_['isObject'](_0x4de72e)?JSON[_0xee81('0x18')](_0x4de72e):_0x4de72e);logger['info'](_0xee81('0xf'),_0x3c4161);_0x405b57[_0xee81('0x10')]();}};}; \ 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 d1d39ee..b889b71 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 _0xbe02=['message','account','interaction','list','lodash','exports','merge','body'];(function(_0x287a05,_0x249168){var _0x2ed3dd=function(_0x64cb6b){while(--_0x64cb6b){_0x287a05['push'](_0x287a05['shift']());}};_0x2ed3dd(++_0x249168);}(_0xbe02,0x124));var _0x2be0=function(_0x6608ce,_0x28000f){_0x6608ce=_0x6608ce-0x0;var _0x2eaa43=_0xbe02[_0x6608ce];return _0x2eaa43;};'use strict';var Mustache=require('mustache');var _=require(_0x2be0('0x0'));module[_0x2be0('0x1')]={'getMustacheRender':function(_0x398bd2,_0x51c23c){return Mustache['render'](_0x398bd2,_[_0x2be0('0x2')](_0x51c23c[_0x2be0('0x3')],{'contact':_0x51c23c['contact'],'message':_0x51c23c[_0x2be0('0x4')],'account':_0x51c23c[_0x2be0('0x5')],'interaction':_0x51c23c[_0x2be0('0x6')],'list':_0x51c23c[_0x2be0('0x7')]}))||'';}}; \ No newline at end of file +var _0x47c7=['message','account','interaction','mustache','exports','render','merge','contact'];(function(_0x3051d9,_0x3de423){var _0xcc0a87=function(_0x588cee){while(--_0x588cee){_0x3051d9['push'](_0x3051d9['shift']());}};_0xcc0a87(++_0x3de423);}(_0x47c7,0x1ab));var _0x747c=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x47c7[_0x2db12b];return _0x20990b;};'use strict';var Mustache=require(_0x747c('0x0'));var _=require('lodash');module[_0x747c('0x1')]={'getMustacheRender':function(_0x63d85a,_0x4a6fc3){return Mustache[_0x747c('0x2')](_0x63d85a,_[_0x747c('0x3')](_0x4a6fc3['body'],{'contact':_0x4a6fc3[_0x747c('0x4')],'message':_0x4a6fc3[_0x747c('0x5')],'account':_0x4a6fc3[_0x747c('0x6')],'interaction':_0x4a6fc3[_0x747c('0x7')],'list':_0x4a6fc3['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 14845d4..dda553e 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 _0xd32d=['chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','uuid','routing','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','applications','isArray','length','existsSync','app','.js','toLowerCase','autoreply','appdata','push','slice','split','join','amazonlex','tag','TagId','format','./interval','condition','intervals','./applications/','consequence','priority','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','stack','routing\x20is\x20empty','QueueReport','UserId','agent','agents','busy','busyQueue','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','paused','mailQueues','name','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values'];(function(_0x183001,_0x18a97d){var _0x3aff6a=function(_0x6ed9ba){while(--_0x6ed9ba){_0x183001['push'](_0x183001['shift']());}};_0x3aff6a(++_0x18a97d);}(_0xd32d,0xb8));var _0xdd32=function(_0x2b244a,_0x285256){_0x2b244a=_0x2b244a-0x0;var _0x18291f=_0xd32d[_0x2b244a];return _0x18291f;};'use strict';var _=require('lodash');var util=require(_0xdd32('0x0'));var path=require(_0xdd32('0x1'));var fs=require('fs');var jayson=require(_0xdd32('0x2'));var BPromise=require(_0xdd32('0x3'));var uuid=require(_0xdd32('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xdd32('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xdd32('0x6')),'smsQueueReport':require(_0xdd32('0x7')),'faxQueueReport':require(_0xdd32('0x8')),'whatsappQueueReport':require(_0xdd32('0x9'))};var RuleEngine=require(_0xdd32('0xa'));function getId(_0x59ce1c,_0x22b951,_0x14ca67){return util['format'](_0xdd32('0xb'),_0x59ce1c,_0x22b951||0x0,_0x14ca67||0x0);}function getIntervals(_0x1d0001,_0x5a58c0){var _0x292ab9=[];if(!_[_0xdd32('0xc')](_0x5a58c0['IntervalId'])&&!_[_0xdd32('0xc')](_0x1d0001[_0x5a58c0[_0xdd32('0xd')]])&&!_[_0xdd32('0xc')](_0x1d0001[_0x5a58c0[_0xdd32('0xd')]][_0xdd32('0xe')])){_0x292ab9=_[_0xdd32('0xf')](_0x1d0001[_0x5a58c0[_0xdd32('0xd')]][_0xdd32('0xe')],_0xdd32('0x10'));}else if(!_[_0xdd32('0xc')](_0x5a58c0[_0xdd32('0x10')])){_0x292ab9=[_0x5a58c0['interval']];}return _0x292ab9;}exports['listen']=function(_0x472f94){_0x472f94[_0xdd32('0x11')]={};return new BPromise(function(_0x1a9514,_0x4cbbd0){var _0x1bceea={'Start':function(_0xfa0e9){var _0x55742e=this;return new Promise(function(_0x40eaa,_0x2cbaa6){if(_0xfa0e9){try{var _0x41c964=[];var _0x381765=getId(_0xfa0e9[_0xdd32('0x12')],_0xfa0e9[_0xdd32('0x13')]?_0xfa0e9[_0xdd32('0x13')]['id']:0x0,_0xfa0e9[_0xdd32('0x14')]?_0xfa0e9['interaction']['id']:0x0);if(_0xfa0e9[_0xdd32('0x15')]&&_[_0xdd32('0x16')](_0xfa0e9[_0xdd32('0x15')])&&_0xfa0e9[_0xdd32('0x15')][_0xdd32('0x17')]){for(var _0x1d6a42=0x0;_0x1d6a42<_0xfa0e9[_0xdd32('0x15')][_0xdd32('0x17')];_0x1d6a42+=0x1){var _0xb76cb5=_0xfa0e9['applications'][_0x1d6a42];if(fs[_0xdd32('0x18')](path['join'](__dirname,_0xdd32('0x15'),_0xb76cb5[_0xdd32('0x19')]+_0xdd32('0x1a')))){var _0x5a0d72=[];switch(_0xb76cb5[_0xdd32('0x19')][_0xdd32('0x1b')]()){case _0xdd32('0x1c'):var _0x28d18d=_0xb76cb5[_0xdd32('0x1d')]['split'](',');_0x5a0d72[_0xdd32('0x1e')](_0x28d18d[0x0]);_0x5a0d72['push'](_0x28d18d[_0xdd32('0x1f')](0x1,_0x28d18d['length'])['join'](','));break;case'dialogflow':var _0x178cda=_0xb76cb5['appdata'][_0xdd32('0x20')](',');_0x5a0d72['push'](_0x178cda[0x0]);_0x5a0d72[_0xdd32('0x1e')](_0x178cda[0x1]);_0x5a0d72[_0xdd32('0x1e')](_0x178cda[_0xdd32('0x1f')](0x2,_0x178cda['length'])[_0xdd32('0x21')](','));break;case _0xdd32('0x22'):var _0x450499=_0xb76cb5[_0xdd32('0x1d')]['split'](',');_0x5a0d72['push'](_0x450499[0x0]);_0x5a0d72[_0xdd32('0x1e')](_0x450499[0x1]);_0x5a0d72[_0xdd32('0x1e')](_0x450499[0x2]);_0x5a0d72[_0xdd32('0x1e')](_0x450499[0x3]);_0x5a0d72[_0xdd32('0x1e')](_0x450499[_0xdd32('0x1f')](0x4,_0x450499['length'])[_0xdd32('0x21')](','));break;case _0xdd32('0x13'):_0x5a0d72[_0xdd32('0x1e')](_0xb76cb5[_0xdd32('0x1d')]);break;case _0xdd32('0x23'):_0x5a0d72[_0xdd32('0x1e')](_0xb76cb5[_0xdd32('0x24')]);_0x5a0d72[_0xdd32('0x1e')](_0xb76cb5['appdata']);break;default:_0x5a0d72=_[_0xdd32('0xc')](_0xb76cb5['appdata'])?[]:_0xb76cb5[_0xdd32('0x1d')][_0xdd32('0x20')](',');}var _0x27f5aa={'id':util[_0xdd32('0x25')]('%s:%s:%s',_0x381765,_0xb76cb5['id'],_0xb76cb5[_0xdd32('0x19')]),'condition':require(_0xdd32('0x26'))[_0xdd32('0x27')](_0x381765,getIntervals(_0x472f94[_0xdd32('0x28')],_0xb76cb5),_0x472f94),'consequence':require(_0xdd32('0x29')+_0xb76cb5['app'])[_0xdd32('0x2a')](_0x381765,_0x5a0d72,_0x472f94,_0xfa0e9),'p':_0xb76cb5[_0xdd32('0x2b')]||0x0};logger['info']('Push\x20new\x20rule',_0x27f5aa['id'],_0xdd32('0x2c'),getIntervals(_0x472f94[_0xdd32('0x28')],_0xb76cb5)['join'](_0xdd32('0x2d')));_0x41c964[_0xdd32('0x1e')](_0x27f5aa);}else{logger[_0xdd32('0x2e')](_0xdd32('0x2f'),path[_0xdd32('0x21')](__dirname,_0xdd32('0x15'),_0xb76cb5[_0xdd32('0x19')]+_0xdd32('0x1a')));}}_0x472f94[_0xdd32('0x11')][_0x381765]=new RuleEngine(_0x41c964);_0x472f94['rules'][_0x381765][_0xdd32('0x30')](_0xfa0e9,function(_0x249a47){logger['info'](_0xdd32('0x31'),JSON[_0xdd32('0x32')](_0x249a47[_0xdd32('0x33')]));if(_0x472f94[_0xdd32('0x11')][_0x381765]){_0x472f94[_0xdd32('0x11')][_0x381765][_0xdd32('0x34')]('complete');}});return _0x40eaa({'code':0xc8,'message':_0xfa0e9});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x40eaa({'code':0xc8,'message':_0xfa0e9});}}catch(_0x3eef88){logger[_0xdd32('0x2e')](_0x3eef88[_0xdd32('0x35')]);return _0x2cbaa6(_0x55742e[_0xdd32('0x2e')](0x1f4,_0x3eef88));}}return _0x2cbaa6(_0xdd32('0x36'));});},'AcceptMessage':function(_0x89e071){var _0xab87a5=this;return new Promise(function(_0x595511,_0x86b368){if(_0x89e071[_0xdd32('0x13')]&&_0x89e071[_0xdd32('0x13')]['id']){try{var _0x4d7030=getId(_0x89e071[_0xdd32('0x12')],_0x89e071[_0xdd32('0x13')]?_0x89e071[_0xdd32('0x13')]['id']:0x0,_0x89e071[_0xdd32('0x14')]?_0x89e071[_0xdd32('0x14')]['id']:0x0);if(_0x472f94['rules'][_0x4d7030]){_0x472f94[_0xdd32('0x11')][_0x4d7030][_0xdd32('0x34')]('end');if(rpc[_0x89e071['channel']+_0xdd32('0x37')]){rpc[_0x89e071[_0xdd32('0x12')]+'QueueReport']['update'](_0x4d7030,{'UserId':_0x89e071[_0xdd32('0x13')][_0xdd32('0x38')]})['catch'](function(_0x5eb263){logger['error']('error\x20update\x20queue\x20report');});}}return _0x595511({'code':0xc8,'message':_0x89e071});}catch(_0x3c1311){logger[_0xdd32('0x2e')](_0x3c1311[_0xdd32('0x35')]);return _0x86b368(_0xab87a5['error'](0x1f4,_0x3c1311));}}logger[_0xdd32('0x2e')]('message\x20is\x20empty');return _0x86b368(_0xab87a5[_0xdd32('0x2e')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x1aa8ce){var _0x1fc446=this;return new Promise(function(_0x7f234b,_0x30228a){if(_0x1aa8ce[_0xdd32('0x39')]&&_0x1aa8ce[_0xdd32('0x39')]['id']){try{if(_0x472f94[_0xdd32('0x3a')][_0x1aa8ce[_0xdd32('0x39')]['id']]){_0x472f94['agents'][_0x1aa8ce['agent']['id']][_0xdd32('0x3b')]=![];_0x472f94[_0xdd32('0x3a')][_0x1aa8ce[_0xdd32('0x39')]['id']][_0xdd32('0x3c')]=undefined;}return _0x7f234b({'code':0xc8,'message':_0x1aa8ce});}catch(_0x1b04b6){logger['error'](_0x1b04b6['stack']);return _0x30228a(_0x1fc446[_0xdd32('0x2e')](0x1f4,_0x1b04b6));}}logger['error']('message\x20is\x20empty');return _0x30228a(_0x1fc446['error'](0x1f4,_0xdd32('0x3d')));});},'AbandonInteraction':function(_0x69df0f){var _0x12721c=this;return new Promise(function(_0x2505e4,_0xb00dd4){if(_0x69df0f[_0xdd32('0x12')]&&_0x69df0f[_0xdd32('0x14')]&&_0x69df0f['interaction']['id']){try{var _0x3c9784=getId(_0x69df0f[_0xdd32('0x12')],_0x69df0f['message']?_0x69df0f[_0xdd32('0x13')]['id']:0x0,_0x69df0f[_0xdd32('0x14')]?_0x69df0f[_0xdd32('0x14')]['id']:0x0);if(_0x472f94[_0xdd32('0x11')][_0x3c9784]){_0x472f94['rules'][_0x3c9784]['emit'](_0xdd32('0x3e'));}return _0x2505e4({'code':0xc8,'message':_0x69df0f});}catch(_0x1558d3){logger['error'](_0x1558d3['stack']);return _0xb00dd4(_0x12721c[_0xdd32('0x2e')](0x1f4,_0x1558d3));}}logger['error'](_0xdd32('0x3d'));return _0xb00dd4(_0x12721c[_0xdd32('0x2e')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x28b6fe){var _0x341246=this;return new Promise(function(_0x5b1a88,_0x57aa54){if(_0x472f94[_0xdd32('0x3a')][_0xdd32('0x3f')](_0x28b6fe['id'])){for(var _0x26e1cd in _0x28b6fe[_0xdd32('0x40')]){if(_0x28b6fe['capacity']['hasOwnProperty'](_0x26e1cd)){if(_0x472f94[_0xdd32('0x3a')][_0x28b6fe['id']][_0xdd32('0x3f')](_0x26e1cd+_0xdd32('0x41'))){_0x472f94['agents'][_0x28b6fe['id']][_0x26e1cd+_0xdd32('0x41')]=parseInt(_0x28b6fe[_0xdd32('0x40')][_0x26e1cd],0xa);}}}_0x472f94[_0xdd32('0x3a')][_0x28b6fe['id']][_0xdd32('0x42')]();return _0x5b1a88({'code':0xc8,'message':_0x472f94[_0xdd32('0x3a')][_0x28b6fe['id']]});}else{return _0x57aa54(_0x341246['error'](0x1f4,_0xdd32('0x43')));}});},'Agents':function(_0x29e92d){return new Promise(function(_0x16e47f,_0x334217){var _0x20e7b0=_['values'](_0x472f94[_0xdd32('0x3a')]);_0x16e47f({'count':_0x20e7b0[_0xdd32('0x17')],'rows':_0x20e7b0});});},'ChatQueues':function(_0x5979ab){return new Promise(function(_0x2ca05d,_0xe42a99){var _0x1d5609=[];for(var _0x2b4e0b in _0x472f94['chatQueues']){if(_0x472f94['chatQueues'][_0xdd32('0x3f')](_0x2b4e0b)){var _0x2c81c3=_0x472f94[_0xdd32('0x44')][_0x2b4e0b];var _0x10638a={'id':_0x2c81c3['id'],'available':_0x2c81c3[_0xdd32('0x45')],'loggedIn':_0x2c81c3[_0xdd32('0x46')],'name':_0x2c81c3['name'],'paused':_0x2c81c3[_0xdd32('0x47')],'waiting':_0x2c81c3['waiting']};_0x1d5609[_0xdd32('0x1e')](_0x10638a);}}_0x2ca05d({'count':_0x1d5609[_0xdd32('0x17')],'rows':_0x1d5609});});},'MailQueues':function(_0x853621){return new Promise(function(_0x59a49b,_0x465854){var _0x5bc3f2=[];for(var _0x4fa977 in _0x472f94['mailQueues']){if(_0x472f94[_0xdd32('0x48')][_0xdd32('0x3f')](_0x4fa977)){var _0x2978a2=_0x472f94[_0xdd32('0x48')][_0x4fa977];var _0x299134={'id':_0x2978a2['id'],'available':_0x2978a2[_0xdd32('0x45')],'loggedIn':_0x2978a2[_0xdd32('0x46')],'name':_0x2978a2[_0xdd32('0x49')],'paused':_0x2978a2['paused'],'waiting':_0x2978a2[_0xdd32('0x4a')]};_0x5bc3f2[_0xdd32('0x1e')](_0x299134);}}_0x59a49b({'count':_0x5bc3f2['length'],'rows':_0x5bc3f2});});},'OpenchannelQueues':function(_0x1eb27c){return new Promise(function(_0xcf3737,_0x5e3230){var _0x4270ce=[];for(var _0x21d5f1 in _0x472f94[_0xdd32('0x4b')]){if(_0x472f94[_0xdd32('0x4b')][_0xdd32('0x3f')](_0x21d5f1)){var _0x152c54=_0x472f94['openchannelQueues'][_0x21d5f1];var _0x4013ff={'id':_0x152c54['id'],'available':_0x152c54[_0xdd32('0x45')],'loggedIn':_0x152c54[_0xdd32('0x46')],'name':_0x152c54[_0xdd32('0x49')],'paused':_0x152c54['paused'],'waiting':_0x152c54[_0xdd32('0x4a')]};_0x4270ce[_0xdd32('0x1e')](_0x4013ff);}}_0xcf3737({'count':_0x4270ce[_0xdd32('0x17')],'rows':_0x4270ce});});},'SmsQueues':function(_0x474720){return new Promise(function(_0x485006,_0x4f4b7e){var _0x57fe6f=[];for(var _0x463390 in _0x472f94[_0xdd32('0x4c')]){if(_0x472f94[_0xdd32('0x4c')][_0xdd32('0x3f')](_0x463390)){var _0x30b4e2=_0x472f94[_0xdd32('0x4c')][_0x463390];var _0x2038bf={'id':_0x30b4e2['id'],'available':_0x30b4e2['available'],'loggedIn':_0x30b4e2['loggedIn'],'name':_0x30b4e2['name'],'paused':_0x30b4e2['paused'],'waiting':_0x30b4e2[_0xdd32('0x4a')]};_0x57fe6f[_0xdd32('0x1e')](_0x2038bf);}}_0x485006({'count':_0x57fe6f[_0xdd32('0x17')],'rows':_0x57fe6f});});},'FaxQueues':function(_0x59d330){return new Promise(function(_0x9cc46c,_0x153446){var _0x211164=[];for(var _0x10c604 in _0x472f94[_0xdd32('0x4d')]){if(_0x472f94[_0xdd32('0x4d')]['hasOwnProperty'](_0x10c604)){var _0x231825=_0x472f94['faxQueues'][_0x10c604];var _0x2c9fea={'id':_0x231825['id'],'available':_0x231825['available'],'loggedIn':_0x231825['loggedIn'],'name':_0x231825['name'],'paused':_0x231825[_0xdd32('0x47')],'waiting':_0x231825[_0xdd32('0x4a')]};_0x211164['push'](_0x2c9fea);}}_0x9cc46c({'count':_0x211164[_0xdd32('0x17')],'rows':_0x211164});});},'WhatsappQueues':function(_0x530bae){return new Promise(function(_0xc74c96,_0x49f616){var _0x492064=[];for(var _0x420068 in _0x472f94['whatsappQueues']){if(_0x472f94[_0xdd32('0x4e')][_0xdd32('0x3f')](_0x420068)){var _0x18dac5=_0x472f94['whatsappQueues'][_0x420068];var _0x2dc3c8={'id':_0x18dac5['id'],'available':_0x18dac5['available'],'loggedIn':_0x18dac5[_0xdd32('0x46')],'name':_0x18dac5[_0xdd32('0x49')],'paused':_0x18dac5[_0xdd32('0x47')],'waiting':_0x18dac5[_0xdd32('0x4a')]};_0x492064['push'](_0x2dc3c8);}}_0xc74c96({'count':_0x492064[_0xdd32('0x17')],'rows':_0x492064});});},'ChatQueuesWaitingInteractions':function(_0x31d102){return new Promise(function(_0x378f53,_0x51820b){var _0x154d65=_[_0xdd32('0x4f')](_0x472f94[_0xdd32('0x50')]);_0x378f53({'count':_0x154d65['length'],'rows':_0x154d65});});},'MailQueuesWaitingInteractions':function(_0x15d2ad){return new Promise(function(_0x3618d3,_0x4d876f){var _0x3d8c3b=_[_0xdd32('0x4f')](_0x472f94[_0xdd32('0x51')]);_0x3618d3({'count':_0x3d8c3b[_0xdd32('0x17')],'rows':_0x3d8c3b});});},'OpenchannelQueuesWaitingInteractions':function(_0xb26f09){return new Promise(function(_0x9c4934,_0x3733c5){var _0x58712a=_[_0xdd32('0x4f')](_0x472f94['openchannelQueuesWaitingInteractions']);_0x9c4934({'count':_0x58712a['length'],'rows':_0x58712a});});},'SmsQueuesWaitingInteractions':function(_0x544a4b){return new Promise(function(_0x2c2782,_0x2853bc){var _0x3fed01=_[_0xdd32('0x4f')](_0x472f94[_0xdd32('0x52')]);_0x2c2782({'count':_0x3fed01[_0xdd32('0x17')],'rows':_0x3fed01});});},'FaxQueuesWaitingInteractions':function(_0x5216fb){return new Promise(function(_0x2878b1,_0x57cb66){var _0x1f404c=_['values'](_0x472f94[_0xdd32('0x53')]);_0x2878b1({'count':_0x1f404c[_0xdd32('0x17')],'rows':_0x1f404c});});},'WhatsappQueuesWaitingInteractions':function(_0x4dee82){return new Promise(function(_0x1ca055,_0x3b720f){var _0x461364=_[_0xdd32('0x4f')](_0x472f94['whatsappQueuesWaitingInteractions']);_0x1ca055({'count':_0x461364['length'],'rows':_0x461364});});}};var _0x58f6ef=jayson['server'](_0x1bceea)[_0xdd32('0x54')]();_0x58f6ef['on'](_0xdd32('0x2e'),function(_0x708765){logger['error'](JSON['stringify'](_0x708765));return _0x4cbbd0(_0x708765);});_0x58f6ef['listen'](0x232c,'127.0.0.1',function(){console[_0xdd32('0x55')](_0xdd32('0x56'),0x232c);return _0x1a9514(_0xdd32('0x57')+0x232c);});});}; \ No newline at end of file +var _0xde51=['routing\x20is\x20empty','end','QueueReport','update','UserId','catch','message\x20is\x20empty','agent','agents','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','isArray','applications','length','existsSync','join','.js','app','toLowerCase','autoreply','push','dialogflow','appdata','split','slice','amazonlex','tag','TagId','format','%s:%s:%s','condition','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','No\x20applications\x20to\x20execute','stack'];(function(_0x27b859,_0x540b7f){var _0x309e69=function(_0x2caffb){while(--_0x2caffb){_0x27b859['push'](_0x27b859['shift']());}};_0x309e69(++_0x540b7f);}(_0xde51,0x139));var _0x1de5=function(_0x2cdec6,_0x39d4c8){_0x2cdec6=_0x2cdec6-0x0;var _0xa36703=_0xde51[_0x2cdec6];return _0xa36703;};'use strict';var _=require(_0x1de5('0x0'));var util=require(_0x1de5('0x1'));var path=require(_0x1de5('0x2'));var fs=require('fs');var jayson=require(_0x1de5('0x3'));var BPromise=require(_0x1de5('0x4'));var uuid=require(_0x1de5('0x5'));var config=require(_0x1de5('0x6'));var logger=require(_0x1de5('0x7'))('routing');var rpc={'openchannelQueueReport':require(_0x1de5('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x1de5('0x9')),'faxQueueReport':require(_0x1de5('0xa')),'whatsappQueueReport':require(_0x1de5('0xb'))};var RuleEngine=require(_0x1de5('0xc'));function getId(_0x49f370,_0x4f3f01,_0x1fce33){return util['format'](_0x1de5('0xd'),_0x49f370,_0x4f3f01||0x0,_0x1fce33||0x0);}function getIntervals(_0x5c3286,_0x54a0bf){var _0x10039c=[];if(!_[_0x1de5('0xe')](_0x54a0bf[_0x1de5('0xf')])&&!_[_0x1de5('0xe')](_0x5c3286[_0x54a0bf[_0x1de5('0xf')]])&&!_[_0x1de5('0xe')](_0x5c3286[_0x54a0bf['IntervalId']][_0x1de5('0x10')])){_0x10039c=_[_0x1de5('0x11')](_0x5c3286[_0x54a0bf[_0x1de5('0xf')]][_0x1de5('0x10')],_0x1de5('0x12'));}else if(!_[_0x1de5('0xe')](_0x54a0bf['interval'])){_0x10039c=[_0x54a0bf[_0x1de5('0x12')]];}return _0x10039c;}exports[_0x1de5('0x13')]=function(_0x282d08){_0x282d08[_0x1de5('0x14')]={};return new BPromise(function(_0xa6a916,_0x102dfd){var _0x42152e={'Start':function(_0x37d840){var _0x247984=this;return new Promise(function(_0x31ec65,_0xd25215){if(_0x37d840){try{var _0xdec1f2=[];var _0x629e07=getId(_0x37d840[_0x1de5('0x15')],_0x37d840[_0x1de5('0x16')]?_0x37d840[_0x1de5('0x16')]['id']:0x0,_0x37d840['interaction']?_0x37d840[_0x1de5('0x17')]['id']:0x0);if(_0x37d840['applications']&&_[_0x1de5('0x18')](_0x37d840[_0x1de5('0x19')])&&_0x37d840[_0x1de5('0x19')][_0x1de5('0x1a')]){for(var _0x309a23=0x0;_0x309a23<_0x37d840[_0x1de5('0x19')][_0x1de5('0x1a')];_0x309a23+=0x1){var _0x4f95ea=_0x37d840[_0x1de5('0x19')][_0x309a23];if(fs[_0x1de5('0x1b')](path[_0x1de5('0x1c')](__dirname,_0x1de5('0x19'),_0x4f95ea['app']+_0x1de5('0x1d')))){var _0x407ea4=[];switch(_0x4f95ea[_0x1de5('0x1e')][_0x1de5('0x1f')]()){case _0x1de5('0x20'):var _0x4d0363=_0x4f95ea['appdata']['split'](',');_0x407ea4[_0x1de5('0x21')](_0x4d0363[0x0]);_0x407ea4[_0x1de5('0x21')](_0x4d0363['slice'](0x1,_0x4d0363[_0x1de5('0x1a')])['join'](','));break;case _0x1de5('0x22'):var _0x232b32=_0x4f95ea[_0x1de5('0x23')][_0x1de5('0x24')](',');_0x407ea4[_0x1de5('0x21')](_0x232b32[0x0]);_0x407ea4[_0x1de5('0x21')](_0x232b32[0x1]);_0x407ea4[_0x1de5('0x21')](_0x232b32[_0x1de5('0x25')](0x2,_0x232b32['length'])[_0x1de5('0x1c')](','));break;case _0x1de5('0x26'):var _0x267a7e=_0x4f95ea[_0x1de5('0x23')][_0x1de5('0x24')](',');_0x407ea4[_0x1de5('0x21')](_0x267a7e[0x0]);_0x407ea4[_0x1de5('0x21')](_0x267a7e[0x1]);_0x407ea4[_0x1de5('0x21')](_0x267a7e[0x2]);_0x407ea4[_0x1de5('0x21')](_0x267a7e[0x3]);_0x407ea4[_0x1de5('0x21')](_0x267a7e[_0x1de5('0x25')](0x4,_0x267a7e[_0x1de5('0x1a')])[_0x1de5('0x1c')](','));break;case _0x1de5('0x16'):_0x407ea4[_0x1de5('0x21')](_0x4f95ea[_0x1de5('0x23')]);break;case _0x1de5('0x27'):_0x407ea4[_0x1de5('0x21')](_0x4f95ea[_0x1de5('0x28')]);_0x407ea4[_0x1de5('0x21')](_0x4f95ea[_0x1de5('0x23')]);break;default:_0x407ea4=_[_0x1de5('0xe')](_0x4f95ea[_0x1de5('0x23')])?[]:_0x4f95ea[_0x1de5('0x23')][_0x1de5('0x24')](',');}var _0x546b59={'id':util[_0x1de5('0x29')](_0x1de5('0x2a'),_0x629e07,_0x4f95ea['id'],_0x4f95ea[_0x1de5('0x1e')]),'condition':require('./interval')[_0x1de5('0x2b')](_0x629e07,getIntervals(_0x282d08[_0x1de5('0x2c')],_0x4f95ea),_0x282d08),'consequence':require('./applications/'+_0x4f95ea[_0x1de5('0x1e')])[_0x1de5('0x2d')](_0x629e07,_0x407ea4,_0x282d08,_0x37d840),'p':_0x4f95ea[_0x1de5('0x2e')]||0x0};logger[_0x1de5('0x2f')](_0x1de5('0x30'),_0x546b59['id'],_0x1de5('0x31'),getIntervals(_0x282d08[_0x1de5('0x2c')],_0x4f95ea)[_0x1de5('0x1c')]('\x20|\x20'));_0xdec1f2[_0x1de5('0x21')](_0x546b59);}else{logger[_0x1de5('0x32')](_0x1de5('0x33'),path[_0x1de5('0x1c')](__dirname,'applications',_0x4f95ea[_0x1de5('0x1e')]+_0x1de5('0x1d')));}}_0x282d08[_0x1de5('0x14')][_0x629e07]=new RuleEngine(_0xdec1f2);_0x282d08[_0x1de5('0x14')][_0x629e07][_0x1de5('0x34')](_0x37d840,function(_0x6d92a2){logger[_0x1de5('0x2f')](_0x1de5('0x35'),JSON[_0x1de5('0x36')](_0x6d92a2[_0x1de5('0x37')]));if(_0x282d08[_0x1de5('0x14')][_0x629e07]){_0x282d08['rules'][_0x629e07][_0x1de5('0x38')]('complete');}});return _0x31ec65({'code':0xc8,'message':_0x37d840});}else{logger[_0x1de5('0x2f')](_0x1de5('0x39'));return _0x31ec65({'code':0xc8,'message':_0x37d840});}}catch(_0x348839){logger[_0x1de5('0x32')](_0x348839[_0x1de5('0x3a')]);return _0xd25215(_0x247984[_0x1de5('0x32')](0x1f4,_0x348839));}}return _0xd25215(_0x1de5('0x3b'));});},'AcceptMessage':function(_0x47d610){var _0x58fe7f=this;return new Promise(function(_0x18f3f0,_0x55175c){if(_0x47d610['message']&&_0x47d610[_0x1de5('0x16')]['id']){try{var _0x9e4f44=getId(_0x47d610['channel'],_0x47d610[_0x1de5('0x16')]?_0x47d610[_0x1de5('0x16')]['id']:0x0,_0x47d610[_0x1de5('0x17')]?_0x47d610[_0x1de5('0x17')]['id']:0x0);if(_0x282d08['rules'][_0x9e4f44]){_0x282d08['rules'][_0x9e4f44]['emit'](_0x1de5('0x3c'));if(rpc[_0x47d610[_0x1de5('0x15')]+_0x1de5('0x3d')]){rpc[_0x47d610[_0x1de5('0x15')]+_0x1de5('0x3d')][_0x1de5('0x3e')](_0x9e4f44,{'UserId':_0x47d610['message'][_0x1de5('0x3f')]})[_0x1de5('0x40')](function(_0x5da937){logger[_0x1de5('0x32')]('error\x20update\x20queue\x20report');});}}return _0x18f3f0({'code':0xc8,'message':_0x47d610});}catch(_0x3294d7){logger[_0x1de5('0x32')](_0x3294d7[_0x1de5('0x3a')]);return _0x55175c(_0x58fe7f[_0x1de5('0x32')](0x1f4,_0x3294d7));}}logger[_0x1de5('0x32')](_0x1de5('0x41'));return _0x55175c(_0x58fe7f[_0x1de5('0x32')](0x1f4,_0x1de5('0x41')));});},'RejectMessage':function(_0x4bde9d){var _0x15e731=this;return new Promise(function(_0x11136f,_0x14e968){if(_0x4bde9d[_0x1de5('0x42')]&&_0x4bde9d[_0x1de5('0x42')]['id']){try{if(_0x282d08['agents'][_0x4bde9d['agent']['id']]){_0x282d08[_0x1de5('0x43')][_0x4bde9d[_0x1de5('0x42')]['id']][_0x1de5('0x44')]=![];_0x282d08['agents'][_0x4bde9d[_0x1de5('0x42')]['id']]['busyQueue']=undefined;}return _0x11136f({'code':0xc8,'message':_0x4bde9d});}catch(_0x3be336){logger[_0x1de5('0x32')](_0x3be336['stack']);return _0x14e968(_0x15e731[_0x1de5('0x32')](0x1f4,_0x3be336));}}logger[_0x1de5('0x32')](_0x1de5('0x41'));return _0x14e968(_0x15e731[_0x1de5('0x32')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x33250d){var _0x360f24=this;return new Promise(function(_0x2d97b9,_0x545b5f){if(_0x33250d[_0x1de5('0x15')]&&_0x33250d[_0x1de5('0x17')]&&_0x33250d[_0x1de5('0x17')]['id']){try{var _0x9cdf3b=getId(_0x33250d[_0x1de5('0x15')],_0x33250d[_0x1de5('0x16')]?_0x33250d['message']['id']:0x0,_0x33250d[_0x1de5('0x17')]?_0x33250d[_0x1de5('0x17')]['id']:0x0);if(_0x282d08['rules'][_0x9cdf3b]){_0x282d08[_0x1de5('0x14')][_0x9cdf3b][_0x1de5('0x38')]('end');}return _0x2d97b9({'code':0xc8,'message':_0x33250d});}catch(_0x583022){logger[_0x1de5('0x32')](_0x583022['stack']);return _0x545b5f(_0x360f24[_0x1de5('0x32')](0x1f4,_0x583022));}}logger['error'](_0x1de5('0x41'));return _0x545b5f(_0x360f24[_0x1de5('0x32')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x1893d7){var _0xe16b6d=this;return new Promise(function(_0x1677a0,_0x834abb){if(_0x282d08[_0x1de5('0x43')][_0x1de5('0x45')](_0x1893d7['id'])){for(var _0x4fd554 in _0x1893d7[_0x1de5('0x46')]){if(_0x1893d7[_0x1de5('0x46')][_0x1de5('0x45')](_0x4fd554)){if(_0x282d08[_0x1de5('0x43')][_0x1893d7['id']][_0x1de5('0x45')](_0x4fd554+_0x1de5('0x47'))){_0x282d08['agents'][_0x1893d7['id']][_0x4fd554+_0x1de5('0x47')]=parseInt(_0x1893d7['capacity'][_0x4fd554],0xa);}}}_0x282d08[_0x1de5('0x43')][_0x1893d7['id']][_0x1de5('0x48')]();return _0x1677a0({'code':0xc8,'message':_0x282d08[_0x1de5('0x43')][_0x1893d7['id']]});}else{return _0x834abb(_0xe16b6d[_0x1de5('0x32')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x84cb81){return new Promise(function(_0x19a14f,_0x185e29){var _0x489e1c=_[_0x1de5('0x49')](_0x282d08[_0x1de5('0x43')]);_0x19a14f({'count':_0x489e1c[_0x1de5('0x1a')],'rows':_0x489e1c});});},'ChatQueues':function(_0x2a048f){return new Promise(function(_0xf535fc,_0xeca8f2){var _0x15e390=[];for(var _0x279d0b in _0x282d08[_0x1de5('0x4a')]){if(_0x282d08[_0x1de5('0x4a')][_0x1de5('0x45')](_0x279d0b)){var _0x16b82d=_0x282d08[_0x1de5('0x4a')][_0x279d0b];var _0x49c081={'id':_0x16b82d['id'],'available':_0x16b82d[_0x1de5('0x4b')],'loggedIn':_0x16b82d[_0x1de5('0x4c')],'name':_0x16b82d[_0x1de5('0x4d')],'paused':_0x16b82d[_0x1de5('0x4e')],'waiting':_0x16b82d[_0x1de5('0x4f')]};_0x15e390[_0x1de5('0x21')](_0x49c081);}}_0xf535fc({'count':_0x15e390['length'],'rows':_0x15e390});});},'MailQueues':function(_0x23fae6){return new Promise(function(_0x14a3d0,_0x2a1801){var _0x59a20d=[];for(var _0x56c6d7 in _0x282d08[_0x1de5('0x50')]){if(_0x282d08['mailQueues'][_0x1de5('0x45')](_0x56c6d7)){var _0x463518=_0x282d08[_0x1de5('0x50')][_0x56c6d7];var _0x1c5f96={'id':_0x463518['id'],'available':_0x463518[_0x1de5('0x4b')],'loggedIn':_0x463518[_0x1de5('0x4c')],'name':_0x463518[_0x1de5('0x4d')],'paused':_0x463518[_0x1de5('0x4e')],'waiting':_0x463518[_0x1de5('0x4f')]};_0x59a20d[_0x1de5('0x21')](_0x1c5f96);}}_0x14a3d0({'count':_0x59a20d['length'],'rows':_0x59a20d});});},'OpenchannelQueues':function(_0x2038eb){return new Promise(function(_0x31484c,_0x298f30){var _0x217587=[];for(var _0x4e2423 in _0x282d08[_0x1de5('0x51')]){if(_0x282d08[_0x1de5('0x51')][_0x1de5('0x45')](_0x4e2423)){var _0x23b7bd=_0x282d08[_0x1de5('0x51')][_0x4e2423];var _0x104c2d={'id':_0x23b7bd['id'],'available':_0x23b7bd['available'],'loggedIn':_0x23b7bd[_0x1de5('0x4c')],'name':_0x23b7bd[_0x1de5('0x4d')],'paused':_0x23b7bd[_0x1de5('0x4e')],'waiting':_0x23b7bd['waiting']};_0x217587[_0x1de5('0x21')](_0x104c2d);}}_0x31484c({'count':_0x217587[_0x1de5('0x1a')],'rows':_0x217587});});},'SmsQueues':function(_0x2549c9){return new Promise(function(_0x5ecadf,_0x2c21ad){var _0x5f29b6=[];for(var _0x22f1a1 in _0x282d08[_0x1de5('0x52')]){if(_0x282d08[_0x1de5('0x52')][_0x1de5('0x45')](_0x22f1a1)){var _0x1e1948=_0x282d08[_0x1de5('0x52')][_0x22f1a1];var _0x572efe={'id':_0x1e1948['id'],'available':_0x1e1948['available'],'loggedIn':_0x1e1948['loggedIn'],'name':_0x1e1948[_0x1de5('0x4d')],'paused':_0x1e1948[_0x1de5('0x4e')],'waiting':_0x1e1948['waiting']};_0x5f29b6['push'](_0x572efe);}}_0x5ecadf({'count':_0x5f29b6[_0x1de5('0x1a')],'rows':_0x5f29b6});});},'FaxQueues':function(_0x3f2143){return new Promise(function(_0xc9f82c,_0x29c8f1){var _0x442f58=[];for(var _0x5352da in _0x282d08['faxQueues']){if(_0x282d08[_0x1de5('0x53')]['hasOwnProperty'](_0x5352da)){var _0x470705=_0x282d08[_0x1de5('0x53')][_0x5352da];var _0x55b76e={'id':_0x470705['id'],'available':_0x470705['available'],'loggedIn':_0x470705[_0x1de5('0x4c')],'name':_0x470705[_0x1de5('0x4d')],'paused':_0x470705[_0x1de5('0x4e')],'waiting':_0x470705[_0x1de5('0x4f')]};_0x442f58[_0x1de5('0x21')](_0x55b76e);}}_0xc9f82c({'count':_0x442f58[_0x1de5('0x1a')],'rows':_0x442f58});});},'WhatsappQueues':function(_0x4f3174){return new Promise(function(_0x415f66,_0x2ecd7){var _0xbf09fa=[];for(var _0x19901 in _0x282d08[_0x1de5('0x54')]){if(_0x282d08[_0x1de5('0x54')][_0x1de5('0x45')](_0x19901)){var _0x21ba5f=_0x282d08[_0x1de5('0x54')][_0x19901];var _0x469c1e={'id':_0x21ba5f['id'],'available':_0x21ba5f[_0x1de5('0x4b')],'loggedIn':_0x21ba5f[_0x1de5('0x4c')],'name':_0x21ba5f[_0x1de5('0x4d')],'paused':_0x21ba5f[_0x1de5('0x4e')],'waiting':_0x21ba5f[_0x1de5('0x4f')]};_0xbf09fa[_0x1de5('0x21')](_0x469c1e);}}_0x415f66({'count':_0xbf09fa[_0x1de5('0x1a')],'rows':_0xbf09fa});});},'ChatQueuesWaitingInteractions':function(_0x1f0d7b){return new Promise(function(_0x1db4aa,_0x29c9d2){var _0x24d866=_['values'](_0x282d08['chatQueuesWaitingInteractions']);_0x1db4aa({'count':_0x24d866['length'],'rows':_0x24d866});});},'MailQueuesWaitingInteractions':function(_0x3698a5){return new Promise(function(_0x11876c,_0xc3dfe2){var _0x373c3a=_[_0x1de5('0x49')](_0x282d08[_0x1de5('0x55')]);_0x11876c({'count':_0x373c3a['length'],'rows':_0x373c3a});});},'OpenchannelQueuesWaitingInteractions':function(_0x248b63){return new Promise(function(_0x7ce7ee,_0x3cc69b){var _0xdf9b6e=_['values'](_0x282d08[_0x1de5('0x56')]);_0x7ce7ee({'count':_0xdf9b6e['length'],'rows':_0xdf9b6e});});},'SmsQueuesWaitingInteractions':function(_0x4668de){return new Promise(function(_0x4228de,_0x42ae5d){var _0x18418a=_[_0x1de5('0x49')](_0x282d08['smsQueuesWaitingInteractions']);_0x4228de({'count':_0x18418a[_0x1de5('0x1a')],'rows':_0x18418a});});},'FaxQueuesWaitingInteractions':function(_0x50a073){return new Promise(function(_0x33912e,_0x42e7f8){var _0x316519=_[_0x1de5('0x49')](_0x282d08['faxQueuesWaitingInteractions']);_0x33912e({'count':_0x316519[_0x1de5('0x1a')],'rows':_0x316519});});},'WhatsappQueuesWaitingInteractions':function(_0x7882fb){return new Promise(function(_0x30ac56,_0x41d56d){var _0x790cad=_['values'](_0x282d08[_0x1de5('0x57')]);_0x30ac56({'count':_0x790cad['length'],'rows':_0x790cad});});}};var _0x11e112=jayson[_0x1de5('0x58')](_0x42152e)[_0x1de5('0x59')]();_0x11e112['on'](_0x1de5('0x32'),function(_0x3c952e){logger[_0x1de5('0x32')](JSON[_0x1de5('0x36')](_0x3c952e));return _0x102dfd(_0x3c952e);});_0x11e112[_0x1de5('0x13')](0x232c,_0x1de5('0x5a'),function(){console[_0x1de5('0x5b')](_0x1de5('0x5c'),0x232c);return _0xa6a916('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index ff3ce25..e40725e 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 _0x919b=['stack','util','bluebird','lodash','routing','client','then','error','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','iftime\x20%s','message','true','[%s][INTERVAL]\x20%s','some','join','log','\x20|\x20'];(function(_0x14282b,_0x36d885){var _0x41fe5b=function(_0xf78409){while(--_0xf78409){_0x14282b['push'](_0x14282b['shift']());}};_0x41fe5b(++_0x36d885);}(_0x919b,0xc1));var _0xb919=function(_0x2c5fae,_0x16ae03){_0x2c5fae=_0x2c5fae-0x0;var _0x1b3d0a=_0x919b[_0x2c5fae];return _0x1b3d0a;};'use strict';var util=require(_0xb919('0x0'));var BPromise=require(_0xb919('0x1'));var jayson=require('jayson/promise');var _=require(_0xb919('0x2'));var logger=require('../../../config/logger')(_0xb919('0x3'));var client=jayson[_0xb919('0x4')]['http']({'port':0x232a});function request(_0x5e638d,_0x5e998b){return new BPromise(function(_0x321836,_0x4a5509){return client['request'](_0x5e638d,_0x5e998b)[_0xb919('0x5')](function(_0x127858){if(_0x127858['error']){return _0x4a5509(_0x127858[_0xb919('0x6')]['message']);}else{return _0x321836(_0x127858['result']);}})[_0xb919('0x7')](function(_0x81cd8e){return _0x4a5509(_0x81cd8e);});});}exports['condition']=function(_0x33ee4f,_0x4ee5ba,_0x15c91d){return function(_0x50bfa9){if(_0x15c91d[_0xb919('0x8')]&&!_0x15c91d[_0xb919('0x8')][_0x33ee4f]){logger[_0xb919('0x9')](_0xb919('0xa'),_0x33ee4f);return _0x50bfa9[_0xb919('0xb')]();}var _0x467e44=[];for(var _0xd7404a=0x0;_0xd7404a<_0x4ee5ba[_0xb919('0xc')];_0xd7404a+=0x1){_0x467e44['push'](request(_0xb919('0xd'),{'command':util[_0xb919('0xe')](_0xb919('0xf'),_0x4ee5ba[_0xd7404a])})[_0xb919('0x5')](function(_0x45ed1f){return _0x45ed1f&&_0x45ed1f[_0xb919('0x10')]&&_0x45ed1f['message']['indexOf'](_0xb919('0x11'))>=0x0?!![]:![];})['catch'](function(_0x54331f){logger['error'](_0xb919('0x12'),_0x33ee4f,_0x4ee5ba[_0xd7404a]);}));}BPromise['all'](_0x467e44)[_0xb919('0x5')](function(_0x428b91){var _0xdec4a3=_[_0xb919('0x13')](_0x428b91);logger[_0xb919('0x9')]('[%s][INTERVAL]\x20%s\x20%s',_0x33ee4f,_0x4ee5ba[_0xb919('0x14')]('\x20|\x20'),_0xdec4a3);_0x50bfa9['when'](_0xdec4a3);})['catch'](function(_0x191178){console[_0xb919('0x15')](_0x191178);logger[_0xb919('0x6')]('[%s][INTERVAL]\x20%s\x20%s',_0x33ee4f,_0x4ee5ba[_0xb919('0x14')](_0xb919('0x16')),_0x191178[_0xb919('0x17')]);_0x50bfa9[_0xb919('0xb')]();});};}; \ No newline at end of file +var _0x1478=['client','http','request','then','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','../../../config/logger','routing'];(function(_0x368806,_0x360d78){var _0xa5d327=function(_0x596c2a){while(--_0x596c2a){_0x368806['push'](_0x368806['shift']());}};_0xa5d327(++_0x360d78);}(_0x1478,0x1ae));var _0x8147=function(_0x270d0d,_0x3fe5af){_0x270d0d=_0x270d0d-0x0;var _0x1e000b=_0x1478[_0x270d0d];return _0x1e000b;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0x8147('0x0'))(_0x8147('0x1'));var client=jayson[_0x8147('0x2')][_0x8147('0x3')]({'port':0x232a});function request(_0x369d54,_0x28bfac){return new BPromise(function(_0x47019e,_0xfd6b49){return client[_0x8147('0x4')](_0x369d54,_0x28bfac)[_0x8147('0x5')](function(_0x5e38ae){if(_0x5e38ae[_0x8147('0x6')]){return _0xfd6b49(_0x5e38ae['error'][_0x8147('0x7')]);}else{return _0x47019e(_0x5e38ae['result']);}})[_0x8147('0x8')](function(_0xd97877){return _0xfd6b49(_0xd97877);});});}exports[_0x8147('0x9')]=function(_0x265f0b,_0x226752,_0x4c3ac1){return function(_0x5a8470){if(_0x4c3ac1[_0x8147('0xa')]&&!_0x4c3ac1[_0x8147('0xa')][_0x265f0b]){logger[_0x8147('0xb')](_0x8147('0xc'),_0x265f0b);return _0x5a8470[_0x8147('0xd')]();}var _0x1b0f7e=[];for(var _0x5ecba7=0x0;_0x5ecba7<_0x226752['length'];_0x5ecba7+=0x1){_0x1b0f7e[_0x8147('0xe')](request(_0x8147('0xf'),{'command':util['format'](_0x8147('0x10'),_0x226752[_0x5ecba7])})[_0x8147('0x5')](function(_0x18c70e){return _0x18c70e&&_0x18c70e['message']&&_0x18c70e[_0x8147('0x7')][_0x8147('0x11')](_0x8147('0x12'))>=0x0?!![]:![];})['catch'](function(_0x3f2a5a){logger[_0x8147('0x6')](_0x8147('0x13'),_0x265f0b,_0x226752[_0x5ecba7]);}));}BPromise[_0x8147('0x14')](_0x1b0f7e)[_0x8147('0x5')](function(_0x2db10e){var _0x1f50c7=_[_0x8147('0x15')](_0x2db10e);logger[_0x8147('0xb')](_0x8147('0x16'),_0x265f0b,_0x226752[_0x8147('0x17')](_0x8147('0x18')),_0x1f50c7);_0x5a8470[_0x8147('0x19')](_0x1f50c7);})[_0x8147('0x8')](function(_0x4f2c66){console[_0x8147('0x1a')](_0x4f2c66);logger[_0x8147('0x6')](_0x8147('0x16'),_0x265f0b,_0x226752['join'](_0x8147('0x18')),_0x4f2c66['stack']);_0x5a8470[_0x8147('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 55c0985..17bbe2b 100644 --- a/server/services/xdr/agents.controller.js +++ b/server/services/xdr/agents.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa508=['agentconnect','agentconnectAt','connect','agentringnoanswerAt','answered_elsewhere','answeredelsewheremembername','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','indexOf','transfer','lodash','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','queue','membername','interface','getVoiceQueueByName','then','type','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalledAt','now','called','connectedlinenum','connectedlinename','error','stack','isNil','lastevent','timeout','reason','ringtime','talktime','push','queuecallerabandon','forIn','includes','agentringnoanswer','abandoned','holdtime'];(function(_0x4b5c54,_0x5a9d65){var _0x3d82e3=function(_0x520104){while(--_0x520104){_0x4b5c54['push'](_0x4b5c54['shift']());}};_0x3d82e3(++_0x5a9d65);}(_0xa508,0x13a));var _0x8a50=function(_0x1044e5,_0x498e01){_0x1044e5=_0x1044e5-0x0;var _0x5ad0dd=_0xa508[_0x1044e5];return _0x5ad0dd;};'use strict';var _=require(_0x8a50('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x3415dd,_0x56f459){utils['info'](util[_0x8a50('0x1')](_0x8a50('0x2'),_0x3415dd[_0x8a50('0x3')],_0x3415dd['channel'],_0x3415dd[_0x8a50('0x4')],_0x3415dd[_0x8a50('0x5')],_0x3415dd[_0x8a50('0x6')],_0x3415dd['calleridnum'],_0x3415dd['connectedlinenum'],_0x3415dd['lastevent']));if(_0x3415dd[_0x8a50('0x4')]){utils[_0x8a50('0x7')](_0x3415dd[_0x8a50('0x4')])[_0x8a50('0x8')](function(_0x418a98){if(_0x418a98){_0x3415dd[_0x8a50('0x9')]=_0x418a98['type'];_0x3415dd['agentacw']=_0x3415dd[_0x8a50('0xa')]?_0x418a98[_0x8a50('0xb')]:![];_0x3415dd[_0x8a50('0xc')]=_0x3415dd['agentacw']?_0x418a98['acwTimeout']:0x0;}utils[_0x8a50('0xd')]('CreateVoiceAgentReport',_0x3415dd);});}else{utils[_0x8a50('0xd')](_0x8a50('0xe'),_0x3415dd);}if(_0x56f459){delete transfers[_0x3415dd[_0x8a50('0x3')]];}else{delete agents[_0x3415dd[_0x8a50('0xf')]];}}exports['agentcalled']=function(_0x4164fb){try{agents[_0x4164fb[_0x8a50('0xf')]]=_0x4164fb;agents[_0x4164fb[_0x8a50('0xf')]][_0x8a50('0x10')]=utils[_0x8a50('0x11')]();agents[_0x4164fb[_0x8a50('0xf')]]['lastevent']=_0x8a50('0x12');agents[_0x4164fb[_0x8a50('0xf')]][_0x8a50('0x13')]=null;agents[_0x4164fb[_0x8a50('0xf')]][_0x8a50('0x14')]=null;}catch(_0x17bbe8){utils[_0x8a50('0x15')](_0x17bbe8[_0x8a50('0x16')]);}};exports['agentringnoanswer']=function(_0x20ce01){try{if(!_[_0x8a50('0x17')](agents[_0x20ce01[_0x8a50('0xf')]])){agents[_0x20ce01[_0x8a50('0xf')]]['agentringnoanswer']=!![];agents[_0x20ce01[_0x8a50('0xf')]]['agentringnoanswerAt']=utils[_0x8a50('0x11')]();agents[_0x20ce01[_0x8a50('0xf')]][_0x8a50('0x18')]=_0x8a50('0x19');agents[_0x20ce01[_0x8a50('0xf')]][_0x8a50('0x1a')]='timeout';agents[_0x20ce01[_0x8a50('0xf')]]['holdtime']=_0x20ce01['ringtime']?parseInt(_0x20ce01[_0x8a50('0x1b')])/0x3e8:0x0;agents[_0x20ce01[_0x8a50('0xf')]][_0x8a50('0x1c')]=0x0;unanswered[_0x8a50('0x1d')](_0x20ce01[_0x8a50('0xf')]);}}catch(_0x5af1d2){utils[_0x8a50('0x15')](_0x5af1d2[_0x8a50('0x16')]);}};exports[_0x8a50('0x1e')]=function(_0x2287fb){try{_[_0x8a50('0x1f')](agents,function(_0x1351d8,_0x54912d){if(_0x1351d8[_0x8a50('0x3')]==_0x2287fb['uniqueid']&&!_[_0x8a50('0x20')](unanswered,_0x1351d8[_0x8a50('0xf')])){_0x1351d8[_0x8a50('0x21')]=!![];_0x1351d8['agentringnoanswerAt']=utils['now']();_0x1351d8[_0x8a50('0x18')]=_0x8a50('0x22');_0x1351d8['reason']=_0x8a50('0x22');_0x1351d8[_0x8a50('0x23')]=_0x2287fb[_0x8a50('0x23')];_0x1351d8[_0x8a50('0x1c')]=0x0;writeDB(_0x1351d8);}});}catch(_0x20ffa2){utils[_0x8a50('0x15')](_0x20ffa2[_0x8a50('0x16')]);}};exports[_0x8a50('0x24')]=function(_0x21a836){try{if(agents[_0x21a836[_0x8a50('0xf')]]){agents[_0x21a836[_0x8a50('0xf')]][_0x8a50('0x25')]=utils[_0x8a50('0x11')]();agents[_0x21a836[_0x8a50('0xf')]][_0x8a50('0x13')]=_0x21a836[_0x8a50('0x13')];agents[_0x21a836[_0x8a50('0xf')]][_0x8a50('0x14')]=_0x21a836['connectedlinename'];agents[_0x21a836[_0x8a50('0xf')]][_0x8a50('0x23')]=_0x21a836[_0x8a50('0x1b')];agents[_0x21a836[_0x8a50('0xf')]][_0x8a50('0x18')]=_0x8a50('0x26');_[_0x8a50('0x1f')](agents,function(_0x2e34dd,_0x872fca){if(_0x2e34dd['destuniqueid']!=_0x21a836[_0x8a50('0xf')]&&_0x2e34dd['uniqueid']==_0x21a836[_0x8a50('0x3')]){_0x2e34dd[_0x8a50('0x1c')]=0x0;_0x2e34dd[_0x8a50('0x23')]=_0x21a836[_0x8a50('0x1b')];_0x2e34dd[_0x8a50('0x21')]=!![];_0x2e34dd[_0x8a50('0x27')]=utils[_0x8a50('0x11')]();_0x2e34dd[_0x8a50('0x18')]=_0x8a50('0x28');_0x2e34dd['reason']=_0x8a50('0x28');_0x2e34dd['answeredelsewheredestinationuniqueid']=_0x21a836['destuniqueid'];_0x2e34dd[_0x8a50('0x29')]=_0x21a836[_0x8a50('0x5')];writeDB(_0x2e34dd);}});}}catch(_0x473d6e){utils[_0x8a50('0x15')](_0x473d6e[_0x8a50('0x16')]);}};exports['agentcomplete']=function(_0x10e99c){try{if(!_[_0x8a50('0x17')](agents[_0x10e99c['destuniqueid']])){agents[_0x10e99c[_0x8a50('0xf')]][_0x8a50('0xa')]=!![];agents[_0x10e99c[_0x8a50('0xf')]][_0x8a50('0x2a')]=utils['now']();agents[_0x10e99c[_0x8a50('0xf')]][_0x8a50('0x1c')]=utils[_0x8a50('0x2b')](agents[_0x10e99c[_0x8a50('0xf')]][_0x8a50('0x2a')],agents[_0x10e99c['destuniqueid']]['agentconnectAt']);agents[_0x10e99c[_0x8a50('0xf')]][_0x8a50('0x1a')]=_0x10e99c['reason'];agents[_0x10e99c[_0x8a50('0xf')]]['lastevent']=_0x8a50('0x2c');writeDB(agents[_0x10e99c[_0x8a50('0xf')]]);}}catch(_0x4d722e){utils['error'](_0x4d722e['stack']);}};exports[_0x8a50('0x2d')]=function(_0x2e92bb){try{if(!_['isNil'](agents[_0x2e92bb['transfereruniqueid']])){agents[_0x2e92bb['transfereruniqueid']]['transfer']=!![];agents[_0x2e92bb[_0x8a50('0x2e')]][_0x8a50('0x2f')]=_0x8a50('0x30');agents[_0x2e92bb[_0x8a50('0x2e')]][_0x8a50('0x31')]=_0x2e92bb[_0x8a50('0x32')];agents[_0x2e92bb[_0x8a50('0x2e')]][_0x8a50('0x33')]=agents[_0x2e92bb[_0x8a50('0x2e')]]['uniqueid'];}}catch(_0x503f34){utils[_0x8a50('0x15')](_0x503f34[_0x8a50('0x16')]);}};exports[_0x8a50('0x34')]=function(_0x403955){try{if(_0x403955[_0x8a50('0x35')]==_0x403955[_0x8a50('0x36')]){if(!_['isNil'](agents[_0x403955[_0x8a50('0x37')]])){agents[_0x403955[_0x8a50('0x37')]]['transfer']=!![];agents[_0x403955[_0x8a50('0x37')]]['transfertype']=_0x8a50('0x38');agents[_0x403955[_0x8a50('0x37')]][_0x8a50('0x31')]=_0x403955[_0x8a50('0x39')];agents[_0x403955[_0x8a50('0x37')]]['transferuniqueid']=_0x403955['origtransfereruniqueid'];}if(_0x403955['transfereeuniqueid']&&agents[_0x403955[_0x8a50('0x3a')]]){agents[_0x403955['transfereeuniqueid']][_0x8a50('0x3b')]=0x1;transfers[_0x403955[_0x8a50('0x3a')]]=_[_0x8a50('0x3c')](agents[_0x403955[_0x8a50('0x3a')]]);transfers[_0x403955['transfereeuniqueid']][_0x8a50('0x3d')]=agents[_0x403955['secondtransfereruniqueid']][_0x8a50('0x3d')];transfers[_0x403955[_0x8a50('0x3a')]][_0x8a50('0x3e')]=agents[_0x403955[_0x8a50('0x37')]][_0x8a50('0x3e')];transfers[_0x403955['transfereeuniqueid']][_0x8a50('0x10')]=utils['now']();transfers[_0x403955[_0x8a50('0x3a')]][_0x8a50('0x25')]=utils[_0x8a50('0x11')]();transfers[_0x403955[_0x8a50('0x3a')]][_0x8a50('0x23')]=0x0;transfers[_0x403955[_0x8a50('0x3a')]]['agententerreason']=0x2;}}else if(_0x403955[_0x8a50('0x37')]==_0x403955['secondtransfererlinkedid']){if(!_[_0x8a50('0x17')](agents[_0x403955[_0x8a50('0x35')]])){agents[_0x403955['origtransfereruniqueid']]['transfer']=!![];agents[_0x403955[_0x8a50('0x35')]]['transfertype']='ATTENDED';agents[_0x403955[_0x8a50('0x35')]]['transferexten']=_0x403955[_0x8a50('0x3f')];agents[_0x403955[_0x8a50('0x35')]]['transferuniqueid']=_0x403955[_0x8a50('0x37')];}if(_0x403955['transfertargetuniqueid']&&agents[_0x403955['transfertargetuniqueid']]){agents[_0x403955[_0x8a50('0x40')]]['agententerreason']=0x1;transfers[_0x403955['transfertargetuniqueid']]=_[_0x8a50('0x3c')](agents[_0x403955['transfertargetuniqueid']]);transfers[_0x403955[_0x8a50('0x40')]]['calleridnum']=agents[_0x403955[_0x8a50('0x35')]][_0x8a50('0x3d')];transfers[_0x403955[_0x8a50('0x40')]][_0x8a50('0x3e')]=agents[_0x403955[_0x8a50('0x35')]][_0x8a50('0x3e')];transfers[_0x403955[_0x8a50('0x40')]][_0x8a50('0x10')]=utils[_0x8a50('0x11')]();transfers[_0x403955['transfertargetuniqueid']][_0x8a50('0x25')]=utils[_0x8a50('0x11')]();transfers[_0x403955['transfertargetuniqueid']][_0x8a50('0x23')]=0x0;transfers[_0x403955['transfertargetuniqueid']][_0x8a50('0x3b')]=0x2;}}}catch(_0x1009f4){utils[_0x8a50('0x15')](_0x1009f4['stack']);}};exports[_0x8a50('0x41')]=function(_0x36e28f){try{if(agents[_0x36e28f[_0x8a50('0x3')]]&&agents[_0x36e28f['uniqueid']]['reason']===_0x8a50('0x19')){if(_0x36e28f[_0x8a50('0x42')]==='21'){agents[_0x36e28f['uniqueid']][_0x8a50('0x1a')]=_0x8a50('0x43');agents[_0x36e28f[_0x8a50('0x3')]]['lastevent']='rejected';}writeDB(agents[_0x36e28f['uniqueid']]);var _0x541aad=unanswered[_0x8a50('0x44')](_0x36e28f['uniqueid']);if(_0x541aad>-0x1)unanswered['splice'](_0x541aad,0x1);}if(transfers[_0x36e28f['uniqueid']]){transfers[_0x36e28f[_0x8a50('0x3')]][_0x8a50('0xa')]=!![];transfers[_0x36e28f['uniqueid']]['agentcompleteAt']=utils[_0x8a50('0x11')]();transfers[_0x36e28f[_0x8a50('0x3')]][_0x8a50('0x1c')]=utils[_0x8a50('0x2b')](transfers[_0x36e28f[_0x8a50('0x3')]][_0x8a50('0x2a')],transfers[_0x36e28f['uniqueid']][_0x8a50('0x25')]);transfers[_0x36e28f[_0x8a50('0x3')]]['reason']='agent';transfers[_0x36e28f[_0x8a50('0x3')]][_0x8a50('0x18')]=_0x8a50('0x2c');writeDB(transfers[_0x36e28f['uniqueid']],!![]);}if(agents[_0x36e28f[_0x8a50('0x3')]]&&agents[_0x36e28f[_0x8a50('0x3')]][_0x8a50('0x25')]){agents[_0x36e28f['uniqueid']][_0x8a50('0xa')]=!![];agents[_0x36e28f[_0x8a50('0x3')]]['agentcompleteAt']=utils['now']();agents[_0x36e28f[_0x8a50('0x3')]]['talktime']=utils[_0x8a50('0x2b')](agents[_0x36e28f[_0x8a50('0x3')]][_0x8a50('0x2a')],agents[_0x36e28f['uniqueid']][_0x8a50('0x25')]);agents[_0x36e28f['uniqueid']][_0x8a50('0x1a')]=agents[_0x36e28f[_0x8a50('0x3')]]['transfer']?_0x8a50('0x45'):'agent';agents[_0x36e28f['uniqueid']][_0x8a50('0x18')]=_0x8a50('0x2c');writeDB(agents[_0x36e28f[_0x8a50('0x3')]]);}}catch(_0x47d320){utils[_0x8a50('0x15')](_0x47d320['stack']);}}; \ No newline at end of file +var _0xc5a5=['request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','called','connectedlinename','error','stack','isNil','agentringnoanswer','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','queuecallerabandon','forIn','abandoned','holdtime','agentconnect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','agentcomplete','agentcompleteAt','transfer','transfereruniqueid','transfertype','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','rejected','splice','diffTime','complete','agent','lodash','util','./utils','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','acw','acwtime','acwTimeout'];(function(_0x173bb7,_0x43062b){var _0x171434=function(_0x5d6766){while(--_0x5d6766){_0x173bb7['push'](_0x173bb7['shift']());}};_0x171434(++_0x43062b);}(_0xc5a5,0x80));var _0x5c5a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc5a5[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5c5a('0x0'));var util=require(_0x5c5a('0x1'));var utils=require(_0x5c5a('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x136700,_0x4b3646){utils['info'](util[_0x5c5a('0x3')](_0x5c5a('0x4'),_0x136700[_0x5c5a('0x5')],_0x136700[_0x5c5a('0x6')],_0x136700[_0x5c5a('0x7')],_0x136700[_0x5c5a('0x8')],_0x136700[_0x5c5a('0x9')],_0x136700[_0x5c5a('0xa')],_0x136700[_0x5c5a('0xb')],_0x136700[_0x5c5a('0xc')]));if(_0x136700[_0x5c5a('0x7')]){utils[_0x5c5a('0xd')](_0x136700[_0x5c5a('0x7')])[_0x5c5a('0xe')](function(_0x35c9bb){if(_0x35c9bb){_0x136700[_0x5c5a('0xf')]=_0x35c9bb[_0x5c5a('0xf')];_0x136700[_0x5c5a('0x10')]=_0x136700['agentcomplete']?_0x35c9bb[_0x5c5a('0x11')]:![];_0x136700[_0x5c5a('0x12')]=_0x136700[_0x5c5a('0x10')]?_0x35c9bb[_0x5c5a('0x13')]:0x0;}utils[_0x5c5a('0x14')](_0x5c5a('0x15'),_0x136700);});}else{utils[_0x5c5a('0x14')](_0x5c5a('0x15'),_0x136700);}if(_0x4b3646){delete transfers[_0x136700[_0x5c5a('0x5')]];}else{delete agents[_0x136700[_0x5c5a('0x16')]];}}exports[_0x5c5a('0x17')]=function(_0x81baea){try{agents[_0x81baea['destuniqueid']]=_0x81baea;agents[_0x81baea[_0x5c5a('0x16')]][_0x5c5a('0x18')]=utils[_0x5c5a('0x19')]();agents[_0x81baea[_0x5c5a('0x16')]][_0x5c5a('0xc')]=_0x5c5a('0x1a');agents[_0x81baea[_0x5c5a('0x16')]][_0x5c5a('0xb')]=null;agents[_0x81baea[_0x5c5a('0x16')]][_0x5c5a('0x1b')]=null;}catch(_0x7b9876){utils[_0x5c5a('0x1c')](_0x7b9876[_0x5c5a('0x1d')]);}};exports['agentringnoanswer']=function(_0x274a35){try{if(!_[_0x5c5a('0x1e')](agents[_0x274a35[_0x5c5a('0x16')]])){agents[_0x274a35[_0x5c5a('0x16')]][_0x5c5a('0x1f')]=!![];agents[_0x274a35[_0x5c5a('0x16')]][_0x5c5a('0x20')]=utils[_0x5c5a('0x19')]();agents[_0x274a35[_0x5c5a('0x16')]]['lastevent']=_0x5c5a('0x21');agents[_0x274a35[_0x5c5a('0x16')]][_0x5c5a('0x22')]=_0x5c5a('0x21');agents[_0x274a35[_0x5c5a('0x16')]]['holdtime']=_0x274a35[_0x5c5a('0x23')]?parseInt(_0x274a35[_0x5c5a('0x23')])/0x3e8:0x0;agents[_0x274a35[_0x5c5a('0x16')]][_0x5c5a('0x24')]=0x0;unanswered[_0x5c5a('0x25')](_0x274a35['destuniqueid']);}}catch(_0x211dd9){utils[_0x5c5a('0x1c')](_0x211dd9['stack']);}};exports[_0x5c5a('0x26')]=function(_0x546a8b){try{_[_0x5c5a('0x27')](agents,function(_0x51037d,_0x5ecea0){if(_0x51037d[_0x5c5a('0x5')]==_0x546a8b['uniqueid']&&!_['includes'](unanswered,_0x51037d[_0x5c5a('0x16')])){_0x51037d[_0x5c5a('0x1f')]=!![];_0x51037d[_0x5c5a('0x20')]=utils[_0x5c5a('0x19')]();_0x51037d[_0x5c5a('0xc')]=_0x5c5a('0x28');_0x51037d[_0x5c5a('0x22')]='abandoned';_0x51037d[_0x5c5a('0x29')]=_0x546a8b[_0x5c5a('0x29')];_0x51037d[_0x5c5a('0x24')]=0x0;writeDB(_0x51037d);}});}catch(_0x3885d3){utils[_0x5c5a('0x1c')](_0x3885d3[_0x5c5a('0x1d')]);}};exports[_0x5c5a('0x2a')]=function(_0x2b1d36){try{if(agents[_0x2b1d36[_0x5c5a('0x16')]]){agents[_0x2b1d36[_0x5c5a('0x16')]][_0x5c5a('0x2b')]=utils[_0x5c5a('0x19')]();agents[_0x2b1d36[_0x5c5a('0x16')]]['connectedlinenum']=_0x2b1d36[_0x5c5a('0xb')];agents[_0x2b1d36[_0x5c5a('0x16')]][_0x5c5a('0x1b')]=_0x2b1d36[_0x5c5a('0x1b')];agents[_0x2b1d36[_0x5c5a('0x16')]]['holdtime']=_0x2b1d36[_0x5c5a('0x23')];agents[_0x2b1d36[_0x5c5a('0x16')]]['lastevent']=_0x5c5a('0x2c');_[_0x5c5a('0x27')](agents,function(_0x45309a,_0x5a7586){if(_0x45309a[_0x5c5a('0x16')]!=_0x2b1d36[_0x5c5a('0x16')]&&_0x45309a[_0x5c5a('0x5')]==_0x2b1d36['uniqueid']){_0x45309a[_0x5c5a('0x24')]=0x0;_0x45309a[_0x5c5a('0x29')]=_0x2b1d36[_0x5c5a('0x23')];_0x45309a[_0x5c5a('0x1f')]=!![];_0x45309a[_0x5c5a('0x20')]=utils[_0x5c5a('0x19')]();_0x45309a[_0x5c5a('0xc')]=_0x5c5a('0x2d');_0x45309a[_0x5c5a('0x22')]=_0x5c5a('0x2d');_0x45309a[_0x5c5a('0x2e')]=_0x2b1d36[_0x5c5a('0x16')];_0x45309a['answeredelsewheremembername']=_0x2b1d36[_0x5c5a('0x8')];writeDB(_0x45309a);}});}}catch(_0x274d1e){utils[_0x5c5a('0x1c')](_0x274d1e['stack']);}};exports[_0x5c5a('0x2f')]=function(_0x5786db){try{if(!_[_0x5c5a('0x1e')](agents[_0x5786db[_0x5c5a('0x16')]])){agents[_0x5786db[_0x5c5a('0x16')]]['agentcomplete']=!![];agents[_0x5786db['destuniqueid']][_0x5c5a('0x30')]=utils[_0x5c5a('0x19')]();agents[_0x5786db[_0x5c5a('0x16')]]['talktime']=utils['diffTime'](agents[_0x5786db[_0x5c5a('0x16')]]['agentcompleteAt'],agents[_0x5786db[_0x5c5a('0x16')]]['agentconnectAt']);agents[_0x5786db[_0x5c5a('0x16')]][_0x5c5a('0x22')]=_0x5786db[_0x5c5a('0x22')];agents[_0x5786db['destuniqueid']][_0x5c5a('0xc')]='complete';writeDB(agents[_0x5786db[_0x5c5a('0x16')]]);}}catch(_0x2cac52){utils[_0x5c5a('0x1c')](_0x2cac52['stack']);}};exports['blindtransfer']=function(_0x13d363){try{if(!_[_0x5c5a('0x1e')](agents[_0x13d363['transfereruniqueid']])){agents[_0x13d363['transfereruniqueid']][_0x5c5a('0x31')]=!![];agents[_0x13d363[_0x5c5a('0x32')]][_0x5c5a('0x33')]='blind';agents[_0x13d363[_0x5c5a('0x32')]]['transferexten']=_0x13d363[_0x5c5a('0x34')];agents[_0x13d363[_0x5c5a('0x32')]][_0x5c5a('0x35')]=agents[_0x13d363[_0x5c5a('0x32')]]['uniqueid'];}}catch(_0x2e4901){utils['error'](_0x2e4901['stack']);}};exports[_0x5c5a('0x36')]=function(_0x427786){try{if(_0x427786[_0x5c5a('0x37')]==_0x427786[_0x5c5a('0x38')]){if(!_[_0x5c5a('0x1e')](agents[_0x427786['secondtransfereruniqueid']])){agents[_0x427786[_0x5c5a('0x39')]]['transfer']=!![];agents[_0x427786['secondtransfereruniqueid']][_0x5c5a('0x33')]=_0x5c5a('0x3a');agents[_0x427786['secondtransfereruniqueid']][_0x5c5a('0x3b')]=_0x427786[_0x5c5a('0x3c')];agents[_0x427786['secondtransfereruniqueid']]['transferuniqueid']=_0x427786[_0x5c5a('0x37')];}if(_0x427786['transfereeuniqueid']&&agents[_0x427786[_0x5c5a('0x3d')]]){agents[_0x427786[_0x5c5a('0x3d')]][_0x5c5a('0x3e')]=0x1;transfers[_0x427786[_0x5c5a('0x3d')]]=_[_0x5c5a('0x3f')](agents[_0x427786['transfereeuniqueid']]);transfers[_0x427786[_0x5c5a('0x3d')]]['calleridnum']=agents[_0x427786[_0x5c5a('0x39')]][_0x5c5a('0xa')];transfers[_0x427786[_0x5c5a('0x3d')]][_0x5c5a('0x40')]=agents[_0x427786['secondtransfereruniqueid']][_0x5c5a('0x40')];transfers[_0x427786[_0x5c5a('0x3d')]][_0x5c5a('0x18')]=utils[_0x5c5a('0x19')]();transfers[_0x427786[_0x5c5a('0x3d')]][_0x5c5a('0x2b')]=utils[_0x5c5a('0x19')]();transfers[_0x427786[_0x5c5a('0x3d')]]['holdtime']=0x0;transfers[_0x427786[_0x5c5a('0x3d')]][_0x5c5a('0x3e')]=0x2;}}else if(_0x427786['secondtransfereruniqueid']==_0x427786[_0x5c5a('0x41')]){if(!_[_0x5c5a('0x1e')](agents[_0x427786[_0x5c5a('0x37')]])){agents[_0x427786['origtransfereruniqueid']][_0x5c5a('0x31')]=!![];agents[_0x427786[_0x5c5a('0x37')]][_0x5c5a('0x33')]=_0x5c5a('0x3a');agents[_0x427786[_0x5c5a('0x37')]]['transferexten']=_0x427786[_0x5c5a('0x42')];agents[_0x427786[_0x5c5a('0x37')]][_0x5c5a('0x35')]=_0x427786[_0x5c5a('0x39')];}if(_0x427786['transfertargetuniqueid']&&agents[_0x427786[_0x5c5a('0x43')]]){agents[_0x427786['transfertargetuniqueid']][_0x5c5a('0x3e')]=0x1;transfers[_0x427786[_0x5c5a('0x43')]]=_[_0x5c5a('0x3f')](agents[_0x427786['transfertargetuniqueid']]);transfers[_0x427786[_0x5c5a('0x43')]][_0x5c5a('0xa')]=agents[_0x427786[_0x5c5a('0x37')]][_0x5c5a('0xa')];transfers[_0x427786[_0x5c5a('0x43')]][_0x5c5a('0x40')]=agents[_0x427786[_0x5c5a('0x37')]][_0x5c5a('0x40')];transfers[_0x427786[_0x5c5a('0x43')]][_0x5c5a('0x18')]=utils['now']();transfers[_0x427786[_0x5c5a('0x43')]][_0x5c5a('0x2b')]=utils[_0x5c5a('0x19')]();transfers[_0x427786[_0x5c5a('0x43')]][_0x5c5a('0x29')]=0x0;transfers[_0x427786['transfertargetuniqueid']][_0x5c5a('0x3e')]=0x2;}}}catch(_0x1b044b){utils[_0x5c5a('0x1c')](_0x1b044b['stack']);}};exports[_0x5c5a('0x44')]=function(_0x41b232){try{if(agents[_0x41b232[_0x5c5a('0x5')]]&&agents[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x22')]===_0x5c5a('0x21')){if(_0x41b232['cause']==='21'){agents[_0x41b232['uniqueid']][_0x5c5a('0x22')]='rejected';agents[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0xc')]=_0x5c5a('0x45');}writeDB(agents[_0x41b232[_0x5c5a('0x5')]]);var _0x27c606=unanswered['indexOf'](_0x41b232['uniqueid']);if(_0x27c606>-0x1)unanswered[_0x5c5a('0x46')](_0x27c606,0x1);}if(transfers[_0x41b232[_0x5c5a('0x5')]]){transfers[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x2f')]=!![];transfers[_0x41b232['uniqueid']][_0x5c5a('0x30')]=utils[_0x5c5a('0x19')]();transfers[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x24')]=utils[_0x5c5a('0x47')](transfers[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x30')],transfers[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x2b')]);transfers[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x22')]='agent';transfers[_0x41b232['uniqueid']][_0x5c5a('0xc')]=_0x5c5a('0x48');writeDB(transfers[_0x41b232[_0x5c5a('0x5')]],!![]);}if(agents[_0x41b232[_0x5c5a('0x5')]]&&agents[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x2b')]){agents[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x2f')]=!![];agents[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x30')]=utils[_0x5c5a('0x19')]();agents[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x24')]=utils[_0x5c5a('0x47')](agents[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x30')],agents[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x2b')]);agents[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x22')]=agents[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0x31')]?'transfer':_0x5c5a('0x49');agents[_0x41b232[_0x5c5a('0x5')]][_0x5c5a('0xc')]='complete';writeDB(agents[_0x41b232[_0x5c5a('0x5')]]);}}catch(_0x3b07e0){utils['error'](_0x3b07e0[_0x5c5a('0x1d')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index f455b51..7d51587 100644 --- a/server/services/xdr/calls.controller.js +++ b/server/services/xdr/calls.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1bc9=['lastapplication','lastdata','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','channel','accountcode','source','destination','callerid','disposition','getUserByInternal','then','UserId','request','CreateVoiceCallReport','uniqueid','linkedid','OutgoingSpoolFailed','calleridnum','exten','context','now','error','stack','isNil','channelstate','systemanswertime','transfer','destinationchannel','answertime','calleridname','endtime','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','transfereechannel','userfield','transfertargetchannel','origtransfererchannel','_attended','musiconholdstart','musiconholdstartAt','musiconholdstop','mohtime','varset','variable','xmd-originatecalleridnum','value','xmd-phone','xmd-callerid','xmd-queue','xmcs-queue','queue','xmd-contactid','xmd-cdrtype','type','outboundrouteid','routeid','sipcallid','newexten','application','toLowerCase','set','appdata','cdr','split','substring','lastIndexOf','hangup','noop','execif','gotoif'];(function(_0x185e79,_0x13fa15){var _0x5409dd=function(_0x5485ee){while(--_0x5485ee){_0x185e79['push'](_0x185e79['shift']());}};_0x5409dd(++_0x13fa15);}(_0x1bc9,0xa6));var _0x91bc=function(_0x1098ec,_0x2afc61){_0x1098ec=_0x1098ec-0x0;var _0x35b0ca=_0x1bc9[_0x1098ec];return _0x35b0ca;};'use strict';var _=require(_0x91bc('0x0'));var util=require(_0x91bc('0x1'));var utils=require(_0x91bc('0x2'));var dispositions=[_0x91bc('0x3'),_0x91bc('0x4'),_0x91bc('0x4'),'NO\x20ANSWER',_0x91bc('0x3'),_0x91bc('0x3'),_0x91bc('0x5'),_0x91bc('0x6'),_0x91bc('0x4'),_0x91bc('0x4'),_0x91bc('0x4')];var channels={};function writeDB(_0x769e42){utils[_0x91bc('0x7')](util[_0x91bc('0x8')](_0x91bc('0x9'),_0x769e42['uniqueid'],_0x769e42[_0x91bc('0xa')],_0x769e42['type'],_0x769e42[_0x91bc('0xb')],_0x769e42[_0x91bc('0xc')],_0x769e42[_0x91bc('0xd')],_0x769e42[_0x91bc('0xe')],_0x769e42[_0x91bc('0xf')]));if(_0x769e42['accountcode']){utils[_0x91bc('0x10')](_0x769e42['accountcode'])[_0x91bc('0x11')](function(_0x547e21){if(_0x547e21){_0x769e42[_0x91bc('0x12')]=_0x547e21['id'];}utils[_0x91bc('0x13')](_0x91bc('0x14'),_0x769e42);});}else{utils[_0x91bc('0x13')]('CreateVoiceCallReport',_0x769e42);}if(channels[_0x769e42['uniqueid']]){delete channels[_0x769e42[_0x91bc('0x15')]];}}exports['newchannel']=function(_0x1b96d7){try{if(_0x1b96d7['uniqueid']==_0x1b96d7[_0x91bc('0x16')]&&_0x1b96d7[_0x91bc('0xa')]!=_0x91bc('0x17')){channels[_0x1b96d7[_0x91bc('0x15')]]={'uniqueid':_0x1b96d7[_0x91bc('0x15')],'accountcode':_0x1b96d7[_0x91bc('0xb')],'source':_0x1b96d7[_0x91bc('0x18')],'destination':_0x1b96d7[_0x91bc('0x19')],'destinationcontext':_0x1b96d7[_0x91bc('0x1a')],'channel':_0x1b96d7['channel'],'starttime':utils[_0x91bc('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x91bc('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x26282d){utils[_0x91bc('0x1c')](_0x26282d[_0x91bc('0x1d')]);}};exports['newstate']=function(_0x3d0bc2){try{if(!_[_0x91bc('0x1e')](channels[_0x3d0bc2['uniqueid']])&&_0x3d0bc2[_0x91bc('0x1f')]==0x6){if(_['isNil'](channels[_0x3d0bc2[_0x91bc('0x15')]][_0x91bc('0x20')])){channels[_0x3d0bc2[_0x91bc('0x15')]]['systemanswertime']=utils['now']();}}else if(!_[_0x91bc('0x1e')](channels[_0x3d0bc2[_0x91bc('0x16')]])&&_0x3d0bc2['channelstate']==0x6&&_0x3d0bc2[_0x91bc('0x1a')]!=_0x91bc('0x21')){channels[_0x3d0bc2['linkedid']][_0x91bc('0xb')]=_0x3d0bc2[_0x91bc('0xb')];channels[_0x3d0bc2[_0x91bc('0x16')]][_0x91bc('0x22')]=_0x3d0bc2[_0x91bc('0xa')];if(_[_0x91bc('0x1e')](channels[_0x3d0bc2[_0x91bc('0x16')]][_0x91bc('0x23')])){channels[_0x3d0bc2[_0x91bc('0x16')]][_0x91bc('0x23')]=utils[_0x91bc('0x1b')]();}channels[_0x3d0bc2[_0x91bc('0x16')]][_0x91bc('0xf')]=dispositions[_['toNumber'](_0x3d0bc2[_0x91bc('0x1f')])]||_0x91bc('0x5');}}catch(_0x34dc82){utils[_0x91bc('0x1c')](_0x34dc82[_0x91bc('0x1d')]);}};exports['hangup']=function(_0xfd26cc){try{if(!_['isNil'](channels[_0xfd26cc[_0x91bc('0x15')]])){if(_['isNil'](channels[_0xfd26cc[_0x91bc('0x15')]][_0x91bc('0xe')])){channels[_0xfd26cc['uniqueid']][_0x91bc('0xe')]=_0xfd26cc[_0x91bc('0x24')]+'\x20<'+_0xfd26cc['calleridnum']+'>';}channels[_0xfd26cc[_0x91bc('0x15')]][_0x91bc('0x25')]=utils[_0x91bc('0x1b')]();channels[_0xfd26cc['uniqueid']]['duration']=utils[_0x91bc('0x26')](channels[_0xfd26cc[_0x91bc('0x15')]]['endtime'],channels[_0xfd26cc[_0x91bc('0x15')]][_0x91bc('0x27')]);channels[_0xfd26cc[_0x91bc('0x15')]][_0x91bc('0x28')]=channels[_0xfd26cc[_0x91bc('0x15')]]['answertime']?utils[_0x91bc('0x26')](channels[_0xfd26cc[_0x91bc('0x15')]][_0x91bc('0x25')],channels[_0xfd26cc['uniqueid']]['answertime']):0x0;writeDB(channels[_0xfd26cc[_0x91bc('0x15')]]);}}catch(_0x401930){utils['error'](_0x401930['stack']);}};exports[_0x91bc('0x29')]=function(_0x40c3b8){try{if(!_[_0x91bc('0x1e')](channels[_0x40c3b8['localtwolinkedid']])){if(channels[_0x40c3b8[_0x91bc('0x2a')]][_0x91bc('0xa')]==_0x40c3b8[_0x91bc('0x2b')]){channels[_0x40c3b8[_0x91bc('0x2a')]]['destinationchannel']=_0x40c3b8['secondtransfererchannel'];channels[_0x40c3b8[_0x91bc('0x2a')]][_0x91bc('0x2c')]='_attended';}else if(channels[_0x40c3b8[_0x91bc('0x2a')]][_0x91bc('0xa')]=_0x40c3b8[_0x91bc('0x2d')]){channels[_0x40c3b8[_0x91bc('0x2a')]]['destinationchannel']=_0x40c3b8[_0x91bc('0x2e')];channels[_0x40c3b8[_0x91bc('0x2a')]][_0x91bc('0x2c')]=_0x91bc('0x2f');}}}catch(_0x2cb592){utils[_0x91bc('0x1c')](_0x2cb592[_0x91bc('0x1d')]);}};exports[_0x91bc('0x30')]=function(_0x5a322a){try{if(!_[_0x91bc('0x1e')](channels[_0x5a322a[_0x91bc('0x15')]])){channels[_0x5a322a[_0x91bc('0x15')]][_0x91bc('0x31')]=utils['now']();}}catch(_0x5772a6){utils[_0x91bc('0x1c')](_0x5772a6[_0x91bc('0x1d')]);}};exports[_0x91bc('0x32')]=function(_0x4f5627){try{if(!_[_0x91bc('0x1e')](channels[_0x4f5627['uniqueid']])){if(!_['isNil'](channels[_0x4f5627[_0x91bc('0x15')]][_0x91bc('0x31')])){channels[_0x4f5627[_0x91bc('0x15')]][_0x91bc('0x33')]+=utils[_0x91bc('0x26')](utils[_0x91bc('0x1b')](),channels[_0x4f5627[_0x91bc('0x15')]][_0x91bc('0x31')]);delete channels[_0x4f5627[_0x91bc('0x15')]][_0x91bc('0x31')];}}}catch(_0x8fcf13){utils['error'](_0x8fcf13[_0x91bc('0x1d')]);}};exports[_0x91bc('0x34')]=function(_0x429bf9){try{if(!_[_0x91bc('0x1e')](channels[_0x429bf9[_0x91bc('0x15')]])){if(!_[_0x91bc('0x1e')](_0x429bf9[_0x91bc('0x35')][_0x91bc('0x36')])){channels[_0x429bf9[_0x91bc('0x15')]][_0x91bc('0xc')]=_0x429bf9[_0x91bc('0x37')];}if(!_['isNil'](_0x429bf9[_0x91bc('0x35')][_0x91bc('0x38')])){channels[_0x429bf9[_0x91bc('0x15')]]['destination']=_0x429bf9[_0x91bc('0x37')];channels[_0x429bf9[_0x91bc('0x15')]][_0x91bc('0xe')]='\x22'+_0x429bf9['value']+'\x22\x20<'+_0x429bf9[_0x91bc('0x37')]+'>';}if(!_[_0x91bc('0x1e')](_0x429bf9[_0x91bc('0x35')]['xmd-callerid-preview'])||!_[_0x91bc('0x1e')](_0x429bf9[_0x91bc('0x35')][_0x91bc('0x39')])){channels[_0x429bf9[_0x91bc('0x15')]]['callerid']=_0x429bf9[_0x91bc('0x37')];}if(!_['isNil'](_0x429bf9[_0x91bc('0x35')][_0x91bc('0x3a')])||!_[_0x91bc('0x1e')](_0x429bf9['variable'][_0x91bc('0x3b')])){channels[_0x429bf9[_0x91bc('0x15')]]['lastapplication']='Queue';channels[_0x429bf9['uniqueid']]['lastdata']=_0x429bf9['value'];channels[_0x429bf9[_0x91bc('0x15')]][_0x91bc('0x3c')]=!![];}if(!_[_0x91bc('0x1e')](_0x429bf9[_0x91bc('0x35')][_0x91bc('0x3d')])){channels[_0x429bf9['uniqueid']]['ContactId']=_0x429bf9[_0x91bc('0x37')];}if(!_[_0x91bc('0x1e')](_0x429bf9[_0x91bc('0x35')][_0x91bc('0x3e')])){channels[_0x429bf9[_0x91bc('0x15')]][_0x91bc('0x3f')]=_0x429bf9['value'];}if(!_['isNil'](_0x429bf9[_0x91bc('0x35')][_0x91bc('0x40')])){channels[_0x429bf9[_0x91bc('0x15')]][_0x91bc('0x41')]=_0x429bf9[_0x91bc('0x37')];}if(!_[_0x91bc('0x1e')](_0x429bf9[_0x91bc('0x35')][_0x91bc('0x42')])){channels[_0x429bf9[_0x91bc('0x15')]]['sipcallid']=_0x429bf9['value'];}}}catch(_0x233f13){utils[_0x91bc('0x1c')](_0x233f13[_0x91bc('0x1d')]);}};exports[_0x91bc('0x43')]=function(_0x4a8d68){try{if(!_[_0x91bc('0x1e')](channels[_0x4a8d68['uniqueid']])){if(_0x4a8d68[_0x91bc('0x44')][_0x91bc('0x45')]()==_0x91bc('0x46')&&_['startsWith'](_0x4a8d68[_0x91bc('0x47')][_0x91bc('0x45')](),_0x91bc('0x48'))){var _0x4b16b9=_0x4a8d68[_0x91bc('0x47')][_0x91bc('0x49')]('=');var _0x575971=_0x4b16b9[0x0][_0x91bc('0x4a')](_0x4b16b9[0x0][_0x91bc('0x4b')]('(')+0x1,_0x4b16b9[0x0][_0x91bc('0x4b')](')'));var _0x2b88bb=_0x4b16b9[0x1];channels[_0x4a8d68[_0x91bc('0x15')]][_0x575971]=_0x2b88bb;}if(!_['includes']([_0x91bc('0x4c'),_0x91bc('0x4d'),_0x91bc('0x4e'),_0x91bc('0x46'),_0x91bc('0x4f')],_0x4a8d68[_0x91bc('0x44')][_0x91bc('0x45')]())){channels[_0x4a8d68[_0x91bc('0x15')]][_0x91bc('0x50')]=_0x4a8d68[_0x91bc('0x44')];channels[_0x4a8d68[_0x91bc('0x15')]][_0x91bc('0x51')]=_0x4a8d68[_0x91bc('0x47')];}}}catch(_0x4dab9a){utils[_0x91bc('0x1c')](_0x4dab9a[_0x91bc('0x1d')]);}}; \ No newline at end of file +var _0x59f8=['transfertargetchannel','destinationchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','varset','variable','xmd-originatecalleridnum','value','xmd-phone','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','Queue','lastdata','queue','xmd-contactid','routeid','sipcallid','newexten','application','toLowerCase','set','appdata','substring','lastIndexOf','includes','hangup','noop','gotoif','lodash','util','./utils','FAILED','NO\x20ANSWER','BUSY','info','format','uniqueid','channel','type','accountcode','source','destination','disposition','then','CreateVoiceCallReport','request','linkedid','OutgoingSpoolFailed','calleridnum','exten','now','stack','newstate','isNil','channelstate','systemanswertime','answertime','toNumber','ANSWERED','error','callerid','calleridname','endtime','duration','diffTime','billableseconds','localtwolinkedid','transfereechannel','secondtransfererchannel','userfield','_attended'];(function(_0x45a8b4,_0x4d6432){var _0x2b4483=function(_0x49554d){while(--_0x49554d){_0x45a8b4['push'](_0x45a8b4['shift']());}};_0x2b4483(++_0x4d6432);}(_0x59f8,0x191));var _0x859f=function(_0x2a68d1,_0x30b274){_0x2a68d1=_0x2a68d1-0x0;var _0x144666=_0x59f8[_0x2a68d1];return _0x144666;};'use strict';var _=require(_0x859f('0x0'));var util=require(_0x859f('0x1'));var utils=require(_0x859f('0x2'));var dispositions=['NO\x20ANSWER','FAILED',_0x859f('0x3'),_0x859f('0x4'),_0x859f('0x4'),_0x859f('0x4'),'ANSWERED',_0x859f('0x5'),_0x859f('0x3'),_0x859f('0x3'),_0x859f('0x3')];var channels={};function writeDB(_0x4b3615){utils[_0x859f('0x6')](util[_0x859f('0x7')]('CALL|%s|%s|%s|%s|%s|%s|%s|%s',_0x4b3615[_0x859f('0x8')],_0x4b3615[_0x859f('0x9')],_0x4b3615[_0x859f('0xa')],_0x4b3615[_0x859f('0xb')],_0x4b3615[_0x859f('0xc')],_0x4b3615[_0x859f('0xd')],_0x4b3615['callerid'],_0x4b3615[_0x859f('0xe')]));if(_0x4b3615[_0x859f('0xb')]){utils['getUserByInternal'](_0x4b3615['accountcode'])[_0x859f('0xf')](function(_0x27dbb4){if(_0x27dbb4){_0x4b3615['UserId']=_0x27dbb4['id'];}utils['request'](_0x859f('0x10'),_0x4b3615);});}else{utils[_0x859f('0x11')]('CreateVoiceCallReport',_0x4b3615);}if(channels[_0x4b3615[_0x859f('0x8')]]){delete channels[_0x4b3615[_0x859f('0x8')]];}}exports['newchannel']=function(_0x7c073b){try{if(_0x7c073b[_0x859f('0x8')]==_0x7c073b[_0x859f('0x12')]&&_0x7c073b[_0x859f('0x9')]!=_0x859f('0x13')){channels[_0x7c073b[_0x859f('0x8')]]={'uniqueid':_0x7c073b[_0x859f('0x8')],'accountcode':_0x7c073b[_0x859f('0xb')],'source':_0x7c073b[_0x859f('0x14')],'destination':_0x7c073b[_0x859f('0x15')],'destinationcontext':_0x7c073b['context'],'channel':_0x7c073b['channel'],'starttime':utils[_0x859f('0x16')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x32cee3){utils['error'](_0x32cee3[_0x859f('0x17')]);}};exports[_0x859f('0x18')]=function(_0x160047){try{if(!_[_0x859f('0x19')](channels[_0x160047[_0x859f('0x8')]])&&_0x160047[_0x859f('0x1a')]==0x6){if(_[_0x859f('0x19')](channels[_0x160047[_0x859f('0x8')]][_0x859f('0x1b')])){channels[_0x160047[_0x859f('0x8')]]['systemanswertime']=utils[_0x859f('0x16')]();}}else if(!_[_0x859f('0x19')](channels[_0x160047['linkedid']])&&_0x160047[_0x859f('0x1a')]==0x6&&_0x160047['context']!='transfer'){channels[_0x160047[_0x859f('0x12')]][_0x859f('0xb')]=_0x160047[_0x859f('0xb')];channels[_0x160047[_0x859f('0x12')]]['destinationchannel']=_0x160047[_0x859f('0x9')];if(_[_0x859f('0x19')](channels[_0x160047[_0x859f('0x12')]]['answertime'])){channels[_0x160047['linkedid']][_0x859f('0x1c')]=utils[_0x859f('0x16')]();}channels[_0x160047[_0x859f('0x12')]][_0x859f('0xe')]=dispositions[_[_0x859f('0x1d')](_0x160047[_0x859f('0x1a')])]||_0x859f('0x1e');}}catch(_0x1f5785){utils[_0x859f('0x1f')](_0x1f5785['stack']);}};exports['hangup']=function(_0x97c39){try{if(!_[_0x859f('0x19')](channels[_0x97c39[_0x859f('0x8')]])){if(_[_0x859f('0x19')](channels[_0x97c39[_0x859f('0x8')]][_0x859f('0x20')])){channels[_0x97c39['uniqueid']][_0x859f('0x20')]=_0x97c39[_0x859f('0x21')]+'\x20<'+_0x97c39['calleridnum']+'>';}channels[_0x97c39[_0x859f('0x8')]][_0x859f('0x22')]=utils[_0x859f('0x16')]();channels[_0x97c39[_0x859f('0x8')]][_0x859f('0x23')]=utils[_0x859f('0x24')](channels[_0x97c39[_0x859f('0x8')]][_0x859f('0x22')],channels[_0x97c39[_0x859f('0x8')]]['starttime']);channels[_0x97c39[_0x859f('0x8')]][_0x859f('0x25')]=channels[_0x97c39[_0x859f('0x8')]][_0x859f('0x1c')]?utils[_0x859f('0x24')](channels[_0x97c39[_0x859f('0x8')]][_0x859f('0x22')],channels[_0x97c39[_0x859f('0x8')]][_0x859f('0x1c')]):0x0;writeDB(channels[_0x97c39[_0x859f('0x8')]]);}}catch(_0xe48e96){utils[_0x859f('0x1f')](_0xe48e96[_0x859f('0x17')]);}};exports['attendedtransfer']=function(_0x2f9f2e){try{if(!_['isNil'](channels[_0x2f9f2e[_0x859f('0x26')]])){if(channels[_0x2f9f2e[_0x859f('0x26')]]['channel']==_0x2f9f2e[_0x859f('0x27')]){channels[_0x2f9f2e[_0x859f('0x26')]]['destinationchannel']=_0x2f9f2e[_0x859f('0x28')];channels[_0x2f9f2e[_0x859f('0x26')]][_0x859f('0x29')]=_0x859f('0x2a');}else if(channels[_0x2f9f2e[_0x859f('0x26')]]['channel']=_0x2f9f2e[_0x859f('0x2b')]){channels[_0x2f9f2e['localtwolinkedid']][_0x859f('0x2c')]=_0x2f9f2e[_0x859f('0x2d')];channels[_0x2f9f2e['localtwolinkedid']][_0x859f('0x29')]='_attended';}}}catch(_0x2424f2){utils[_0x859f('0x1f')](_0x2424f2[_0x859f('0x17')]);}};exports[_0x859f('0x2e')]=function(_0x4f170d){try{if(!_['isNil'](channels[_0x4f170d['uniqueid']])){channels[_0x4f170d[_0x859f('0x8')]]['musiconholdstartAt']=utils[_0x859f('0x16')]();}}catch(_0x2af670){utils[_0x859f('0x1f')](_0x2af670[_0x859f('0x17')]);}};exports['musiconholdstop']=function(_0x16d497){try{if(!_[_0x859f('0x19')](channels[_0x16d497[_0x859f('0x8')]])){if(!_['isNil'](channels[_0x16d497[_0x859f('0x8')]][_0x859f('0x2f')])){channels[_0x16d497[_0x859f('0x8')]]['mohtime']+=utils[_0x859f('0x24')](utils['now'](),channels[_0x16d497[_0x859f('0x8')]][_0x859f('0x2f')]);delete channels[_0x16d497[_0x859f('0x8')]][_0x859f('0x2f')];}}}catch(_0xd4eb35){utils[_0x859f('0x1f')](_0xd4eb35[_0x859f('0x17')]);}};exports[_0x859f('0x30')]=function(_0x32ea73){try{if(!_[_0x859f('0x19')](channels[_0x32ea73[_0x859f('0x8')]])){if(!_[_0x859f('0x19')](_0x32ea73[_0x859f('0x31')][_0x859f('0x32')])){channels[_0x32ea73[_0x859f('0x8')]][_0x859f('0xc')]=_0x32ea73[_0x859f('0x33')];}if(!_[_0x859f('0x19')](_0x32ea73[_0x859f('0x31')][_0x859f('0x34')])){channels[_0x32ea73[_0x859f('0x8')]]['destination']=_0x32ea73[_0x859f('0x33')];channels[_0x32ea73[_0x859f('0x8')]][_0x859f('0x20')]='\x22'+_0x32ea73[_0x859f('0x33')]+_0x859f('0x35')+_0x32ea73[_0x859f('0x33')]+'>';}if(!_[_0x859f('0x19')](_0x32ea73[_0x859f('0x31')][_0x859f('0x36')])||!_[_0x859f('0x19')](_0x32ea73[_0x859f('0x31')][_0x859f('0x37')])){channels[_0x32ea73[_0x859f('0x8')]]['callerid']=_0x32ea73[_0x859f('0x33')];}if(!_[_0x859f('0x19')](_0x32ea73[_0x859f('0x31')][_0x859f('0x38')])||!_[_0x859f('0x19')](_0x32ea73[_0x859f('0x31')]['xmcs-queue'])){channels[_0x32ea73[_0x859f('0x8')]]['lastapplication']=_0x859f('0x39');channels[_0x32ea73['uniqueid']][_0x859f('0x3a')]=_0x32ea73[_0x859f('0x33')];channels[_0x32ea73[_0x859f('0x8')]][_0x859f('0x3b')]=!![];}if(!_[_0x859f('0x19')](_0x32ea73['variable'][_0x859f('0x3c')])){channels[_0x32ea73[_0x859f('0x8')]]['ContactId']=_0x32ea73[_0x859f('0x33')];}if(!_[_0x859f('0x19')](_0x32ea73[_0x859f('0x31')]['xmd-cdrtype'])){channels[_0x32ea73[_0x859f('0x8')]][_0x859f('0xa')]=_0x32ea73[_0x859f('0x33')];}if(!_[_0x859f('0x19')](_0x32ea73[_0x859f('0x31')]['outboundrouteid'])){channels[_0x32ea73[_0x859f('0x8')]][_0x859f('0x3d')]=_0x32ea73[_0x859f('0x33')];}if(!_[_0x859f('0x19')](_0x32ea73[_0x859f('0x31')][_0x859f('0x3e')])){channels[_0x32ea73[_0x859f('0x8')]][_0x859f('0x3e')]=_0x32ea73[_0x859f('0x33')];}}}catch(_0x3dc88d){utils['error'](_0x3dc88d['stack']);}};exports[_0x859f('0x3f')]=function(_0x10dc26){try{if(!_[_0x859f('0x19')](channels[_0x10dc26['uniqueid']])){if(_0x10dc26[_0x859f('0x40')][_0x859f('0x41')]()==_0x859f('0x42')&&_['startsWith'](_0x10dc26[_0x859f('0x43')][_0x859f('0x41')](),'cdr')){var _0x31be97=_0x10dc26[_0x859f('0x43')]['split']('=');var _0x1a2c1=_0x31be97[0x0][_0x859f('0x44')](_0x31be97[0x0][_0x859f('0x45')]('(')+0x1,_0x31be97[0x0][_0x859f('0x45')](')'));var _0x5bf049=_0x31be97[0x1];channels[_0x10dc26[_0x859f('0x8')]][_0x1a2c1]=_0x5bf049;}if(!_[_0x859f('0x46')]([_0x859f('0x47'),_0x859f('0x48'),'execif',_0x859f('0x42'),_0x859f('0x49')],_0x10dc26[_0x859f('0x40')][_0x859f('0x41')]())){channels[_0x10dc26[_0x859f('0x8')]]['lastapplication']=_0x10dc26[_0x859f('0x40')];channels[_0x10dc26[_0x859f('0x8')]][_0x859f('0x3a')]=_0x10dc26[_0x859f('0x43')];}}}catch(_0x3b0caf){utils[_0x859f('0x1f')](_0x3b0caf[_0x859f('0x17')]);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index d6cd2e6..bc0a3c0 100644 --- a/server/services/xdr/core.controller.js +++ b/server/services/xdr/core.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed1c=['error','CLOSE','managerevent','./utils','lodash','info','SHUTDOWN','fullybooted','FULLYBOOTED'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xed1c,0xe4));var _0xced1=function(_0x12357f,_0x13b4b7){_0x12357f=_0x12357f-0x0;var _0x428f41=_0xed1c[_0x12357f];return _0x428f41;};'use strict';var utils=require(_0xced1('0x0'));var _=require(_0xced1('0x1'));exports['connect']=function(){utils['info']('CONNECTED');};exports['shutdown']=function(){utils[_0xced1('0x2')](_0xced1('0x3'));};exports[_0xced1('0x4')]=function(){utils['info'](_0xced1('0x5'));};exports[_0xced1('0x6')]=function(_0x466657){utils[_0xced1('0x6')](_0x466657);};exports['close']=function(){utils[_0xced1('0x2')](_0xced1('0x7'));};exports[_0xced1('0x8')]=function(_0x1fb40b){}; \ No newline at end of file +var _0x4745=['shutdown','SHUTDOWN','fullybooted','FULLYBOOTED','error','close','CLOSE','./utils','lodash','connect','info','CONNECTED'];(function(_0x9c3c56,_0x169b56){var _0x2dd782=function(_0x386962){while(--_0x386962){_0x9c3c56['push'](_0x9c3c56['shift']());}};_0x2dd782(++_0x169b56);}(_0x4745,0x1e7));var _0x5474=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x4745[_0x2f5ac5];return _0x37c9a8;};'use strict';var utils=require(_0x5474('0x0'));var _=require(_0x5474('0x1'));exports[_0x5474('0x2')]=function(){utils[_0x5474('0x3')](_0x5474('0x4'));};exports[_0x5474('0x5')]=function(){utils[_0x5474('0x3')](_0x5474('0x6'));};exports[_0x5474('0x7')]=function(){utils[_0x5474('0x3')](_0x5474('0x8'));};exports[_0x5474('0x9')]=function(_0x4e7ce7){utils[_0x5474('0x9')](_0x4e7ce7);};exports[_0x5474('0xa')]=function(){utils['info'](_0x5474('0xb'));};exports['managerevent']=function(_0x902ba8){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 2c4d5bf..bc9ac7a 100644 --- a/server/services/xdr/dials.controller.js +++ b/server/services/xdr/dials.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee29=['assign','starttime','now','lastevent','called','dialend','dialstatus','ANSWER','connect','hangup','complete','diffTime','endtime','answertime','billableseconds','lodash','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','calleridnum','request','CreateVoiceDialReport','newexten','toLowerCase','startsWith','cdr(routeid)','appdata','split','error','varset','isNil','variable','outboundrouteid','value','stack','dialbegin'];(function(_0x5ee752,_0x3583d4){var _0x1352eb=function(_0x42e91f){while(--_0x42e91f){_0x5ee752['push'](_0x5ee752['shift']());}};_0x1352eb(++_0x3583d4);}(_0xee29,0x81));var _0x9ee2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee29[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9ee2('0x0'));var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x39dfb7){utils['info'](util[_0x9ee2('0x1')](_0x9ee2('0x2'),_0x39dfb7[_0x9ee2('0x3')],_0x39dfb7[_0x9ee2('0x4')],_0x39dfb7[_0x9ee2('0x5')],_0x39dfb7[_0x9ee2('0x6')],_0x39dfb7['connectedlinenum'],_0x39dfb7['dialstatus']));utils[_0x9ee2('0x7')](_0x9ee2('0x8'),_0x39dfb7);delete dials[_0x39dfb7['uniqueid']];}exports[_0x9ee2('0x9')]=function(_0x67513b){try{if(_0x67513b['application'][_0x9ee2('0xa')]()=='set'&&_[_0x9ee2('0xb')](_0x67513b['appdata'][_0x9ee2('0xa')](),_0x9ee2('0xc'))){var _0x1da7be=_0x67513b[_0x9ee2('0xd')][_0x9ee2('0xe')]('=');dials[_0x67513b[_0x9ee2('0x3')]]={'routeId':_0x1da7be[0x1]};}}catch(_0x21b656){utils[_0x9ee2('0xf')](_0x21b656['stack']);}};exports[_0x9ee2('0x10')]=function(_0x3c0ae6){try{if(!_[_0x9ee2('0x11')](_0x3c0ae6[_0x9ee2('0x12')][_0x9ee2('0x13')])){dials[_0x3c0ae6['uniqueid']]={'routeId':_0x3c0ae6[_0x9ee2('0x14')]};}}catch(_0x4bfbb8){utils[_0x9ee2('0xf')](_0x4bfbb8[_0x9ee2('0x15')]);}};exports[_0x9ee2('0x16')]=function(_0x4c8bc6){try{if(!_['isNil'](dials[_0x4c8bc6['uniqueid']])){dials[_0x4c8bc6['uniqueid']]=_[_0x9ee2('0x17')](dials[_0x4c8bc6[_0x9ee2('0x3')]],_0x4c8bc6);dials[_0x4c8bc6[_0x9ee2('0x3')]][_0x9ee2('0x18')]=utils[_0x9ee2('0x19')]();dials[_0x4c8bc6[_0x9ee2('0x3')]][_0x9ee2('0x1a')]=_0x9ee2('0x1b');}}catch(_0xc62872){utils['error'](_0xc62872[_0x9ee2('0x15')]);}};exports[_0x9ee2('0x1c')]=function(_0x32e09c){try{if(!_[_0x9ee2('0x11')](dials[_0x32e09c['uniqueid']])){dials[_0x32e09c['uniqueid']]['dialstatus']=_0x32e09c[_0x9ee2('0x1d')];if(_0x32e09c[_0x9ee2('0x1d')]==_0x9ee2('0x1e')){dials[_0x32e09c['uniqueid']]=_[_0x9ee2('0x17')](dials[_0x32e09c[_0x9ee2('0x3')]],_0x32e09c);dials[_0x32e09c['uniqueid']]['answertime']=utils['now']();dials[_0x32e09c[_0x9ee2('0x3')]][_0x9ee2('0x1a')]=_0x9ee2('0x1f');}}}catch(_0xfd7655){utils[_0x9ee2('0xf')](_0xfd7655[_0x9ee2('0x15')]);}};exports[_0x9ee2('0x20')]=function(_0x4caa38){try{if(!_[_0x9ee2('0x11')](dials[_0x4caa38[_0x9ee2('0x3')]])){dials[_0x4caa38[_0x9ee2('0x3')]]=_[_0x9ee2('0x17')](dials[_0x4caa38[_0x9ee2('0x3')]],{'endtime':utils[_0x9ee2('0x19')](),'lastevent':_0x9ee2('0x21')});dials[_0x4caa38[_0x9ee2('0x3')]]['duration']=utils[_0x9ee2('0x22')](dials[_0x4caa38[_0x9ee2('0x3')]][_0x9ee2('0x23')],dials[_0x4caa38[_0x9ee2('0x3')]]['starttime']);dials[_0x4caa38[_0x9ee2('0x3')]]['holdtime']=utils[_0x9ee2('0x22')](dials[_0x4caa38['uniqueid']][_0x9ee2('0x24')]||dials[_0x4caa38[_0x9ee2('0x3')]][_0x9ee2('0x23')],dials[_0x4caa38[_0x9ee2('0x3')]]['starttime']);dials[_0x4caa38[_0x9ee2('0x3')]][_0x9ee2('0x25')]=dials[_0x4caa38[_0x9ee2('0x3')]]['answertime']?utils[_0x9ee2('0x22')](dials[_0x4caa38[_0x9ee2('0x3')]][_0x9ee2('0x23')],dials[_0x4caa38['uniqueid']]['answertime']):0x0;writeDB(dials[_0x4caa38[_0x9ee2('0x3')]]);}}catch(_0x109b21){utils[_0x9ee2('0xf')](_0x109b21[_0x9ee2('0x15')]);}}; \ No newline at end of file +var _0xaed1=['dialstatus','request','CreateVoiceDialReport','application','toLowerCase','startsWith','appdata','cdr(routeid)','split','error','stack','isNil','dialbegin','assign','starttime','now','lastevent','called','dialend','answertime','hangup','complete','duration','holdtime','diffTime','billableseconds','lodash','util','./utils','info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0xaed1,0x1b1));var _0x1aed=function(_0x2f8a22,_0x143d0e){_0x2f8a22=_0x2f8a22-0x0;var _0x7d7ae5=_0xaed1[_0x2f8a22];return _0x7d7ae5;};'use strict';var _=require(_0x1aed('0x0'));var util=require(_0x1aed('0x1'));var utils=require(_0x1aed('0x2'));var dials={};function writeDB(_0x32b8cd){utils[_0x1aed('0x3')](util[_0x1aed('0x4')](_0x1aed('0x5'),_0x32b8cd[_0x1aed('0x6')],_0x32b8cd[_0x1aed('0x7')],_0x32b8cd[_0x1aed('0x8')],_0x32b8cd[_0x1aed('0x9')],_0x32b8cd[_0x1aed('0xa')],_0x32b8cd[_0x1aed('0xb')]));utils[_0x1aed('0xc')](_0x1aed('0xd'),_0x32b8cd);delete dials[_0x32b8cd[_0x1aed('0x6')]];}exports['newexten']=function(_0x3e0d0f){try{if(_0x3e0d0f[_0x1aed('0xe')][_0x1aed('0xf')]()=='set'&&_[_0x1aed('0x10')](_0x3e0d0f[_0x1aed('0x11')][_0x1aed('0xf')](),_0x1aed('0x12'))){var _0x467a42=_0x3e0d0f['appdata'][_0x1aed('0x13')]('=');dials[_0x3e0d0f['uniqueid']]={'routeId':_0x467a42[0x1]};}}catch(_0x4b4b67){utils[_0x1aed('0x14')](_0x4b4b67[_0x1aed('0x15')]);}};exports['varset']=function(_0x233e4){try{if(!_[_0x1aed('0x16')](_0x233e4['variable']['outboundrouteid'])){dials[_0x233e4[_0x1aed('0x6')]]={'routeId':_0x233e4['value']};}}catch(_0x4d88c9){utils[_0x1aed('0x14')](_0x4d88c9[_0x1aed('0x15')]);}};exports[_0x1aed('0x17')]=function(_0x4056fb){try{if(!_[_0x1aed('0x16')](dials[_0x4056fb[_0x1aed('0x6')]])){dials[_0x4056fb['uniqueid']]=_[_0x1aed('0x18')](dials[_0x4056fb[_0x1aed('0x6')]],_0x4056fb);dials[_0x4056fb[_0x1aed('0x6')]][_0x1aed('0x19')]=utils[_0x1aed('0x1a')]();dials[_0x4056fb[_0x1aed('0x6')]][_0x1aed('0x1b')]=_0x1aed('0x1c');}}catch(_0x272b4c){utils[_0x1aed('0x14')](_0x272b4c['stack']);}};exports[_0x1aed('0x1d')]=function(_0x11a747){try{if(!_[_0x1aed('0x16')](dials[_0x11a747[_0x1aed('0x6')]])){dials[_0x11a747[_0x1aed('0x6')]]['dialstatus']=_0x11a747[_0x1aed('0xb')];if(_0x11a747[_0x1aed('0xb')]=='ANSWER'){dials[_0x11a747[_0x1aed('0x6')]]=_['assign'](dials[_0x11a747[_0x1aed('0x6')]],_0x11a747);dials[_0x11a747[_0x1aed('0x6')]][_0x1aed('0x1e')]=utils['now']();dials[_0x11a747[_0x1aed('0x6')]][_0x1aed('0x1b')]='connect';}}}catch(_0x2ab3f3){utils[_0x1aed('0x14')](_0x2ab3f3[_0x1aed('0x15')]);}};exports[_0x1aed('0x1f')]=function(_0x47fa08){try{if(!_[_0x1aed('0x16')](dials[_0x47fa08[_0x1aed('0x6')]])){dials[_0x47fa08[_0x1aed('0x6')]]=_[_0x1aed('0x18')](dials[_0x47fa08[_0x1aed('0x6')]],{'endtime':utils[_0x1aed('0x1a')](),'lastevent':_0x1aed('0x20')});dials[_0x47fa08[_0x1aed('0x6')]][_0x1aed('0x21')]=utils['diffTime'](dials[_0x47fa08[_0x1aed('0x6')]]['endtime'],dials[_0x47fa08[_0x1aed('0x6')]]['starttime']);dials[_0x47fa08[_0x1aed('0x6')]][_0x1aed('0x22')]=utils[_0x1aed('0x23')](dials[_0x47fa08[_0x1aed('0x6')]][_0x1aed('0x1e')]||dials[_0x47fa08[_0x1aed('0x6')]]['endtime'],dials[_0x47fa08[_0x1aed('0x6')]]['starttime']);dials[_0x47fa08['uniqueid']][_0x1aed('0x24')]=dials[_0x47fa08['uniqueid']][_0x1aed('0x1e')]?utils[_0x1aed('0x23')](dials[_0x47fa08[_0x1aed('0x6')]]['endtime'],dials[_0x47fa08[_0x1aed('0x6')]][_0x1aed('0x1e')]):0x0;writeDB(dials[_0x47fa08[_0x1aed('0x6')]]);}}catch(_0x2d4552){utils[_0x1aed('0x14')](_0x2d4552[_0x1aed('0x15')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 3e72a7f..7b41de1 100644 --- a/server/services/xdr/index.js +++ b/server/services/xdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf586=['agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','asterisk-manager','./utils','asterisk','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled'];(function(_0x21f0b5,_0x24cd86){var _0x483779=function(_0x233884){while(--_0x233884){_0x21f0b5['push'](_0x21f0b5['shift']());}};_0x483779(++_0x24cd86);}(_0xf586,0x170));var _0x6f58=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xf586[_0xa148b7];return _0x51efd3;};var AsteriskManager=require(_0x6f58('0x0'));var config=require('../../config/environment');var utils=require(_0x6f58('0x1'));var ami=new AsteriskManager(config['asterisk']['port'],config[_0x6f58('0x2')]['ip'],config[_0x6f58('0x2')]['username'],config['asterisk'][_0x6f58('0x3')],!![]);ami[_0x6f58('0x4')]();if(config[_0x6f58('0x5')]&&config[_0x6f58('0x5')][_0x6f58('0x6')]){utils[_0x6f58('0x7')](_0x6f58('0x8'));}else{var agents=require(_0x6f58('0x9'));var calls=require(_0x6f58('0xa'));var queues=require('./queues.controller');var recordings=require(_0x6f58('0xb'));var members=require(_0x6f58('0xc'));var dials=require(_0x6f58('0xd'));var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on'](_0x6f58('0xe'),core[_0x6f58('0xe')]);ami['on'](_0x6f58('0xf'),core[_0x6f58('0xf')]);ami['on'](_0x6f58('0x10'),core['fullybooted']);ami['on'](_0x6f58('0x11'),core[_0x6f58('0x11')]);ami['on'](_0x6f58('0x12'),core[_0x6f58('0x12')]);ami['on']('managerevent',core[_0x6f58('0x13')]);ami['on'](_0x6f58('0x14'),function(_0x7c6942){try{members[_0x6f58('0x14')](_0x7c6942);}catch(_0x66f095){utils['error'](_0x66f095);}});ami['on'](_0x6f58('0x15'),function(_0x1dba83){try{agents[_0x6f58('0x15')](_0x1dba83);}catch(_0x1d123b){utils[_0x6f58('0x11')](_0x1d123b);}});ami['on'](_0x6f58('0x16'),function(_0x457bff){try{agents['agentringnoanswer'](_0x457bff);}catch(_0x28917f){utils[_0x6f58('0x11')](_0x28917f);}});ami['on'](_0x6f58('0x17'),function(_0x59b973){try{agents['agentconnect'](_0x59b973);queues[_0x6f58('0x17')](_0x59b973);}catch(_0x2a47a8){utils[_0x6f58('0x11')](_0x2a47a8);}});ami['on'](_0x6f58('0x18'),function(_0xb7e15c){try{agents['agentcomplete'](_0xb7e15c);queues[_0x6f58('0x18')](_0xb7e15c);members[_0x6f58('0x18')](_0xb7e15c);}catch(_0x3e7f17){utils['error'](_0x3e7f17);}});ami['on'](_0x6f58('0x19'),function(_0x43752d){try{agents['queuecallerabandon'](_0x43752d);queues[_0x6f58('0x19')](_0x43752d);}catch(_0x57cc39){utils[_0x6f58('0x11')](_0x57cc39);}});ami['on'](_0x6f58('0x1a'),function(_0x19a60d){try{queues[_0x6f58('0x1a')](_0x19a60d);recordings['queuecallerjoin'](_0x19a60d);}catch(_0x23cfa2){utils[_0x6f58('0x11')](_0x23cfa2);}});ami['on'](_0x6f58('0x1b'),function(_0x49939d){try{queues[_0x6f58('0x1b')](_0x49939d);}catch(_0x473a57){utils[_0x6f58('0x11')](_0x473a57);}});ami['on']('musiconholdstart',function(_0x289f00){try{queues[_0x6f58('0x1c')](_0x289f00);calls[_0x6f58('0x1c')](_0x289f00);}catch(_0x5f26b9){utils[_0x6f58('0x11')](_0x5f26b9);}});ami['on'](_0x6f58('0x1d'),function(_0x13da72){try{queues[_0x6f58('0x1d')](_0x13da72);calls[_0x6f58('0x1d')](_0x13da72);}catch(_0x1d6c01){utils[_0x6f58('0x11')](_0x1d6c01);}});ami['on'](_0x6f58('0x1e'),function(_0x9a3f18){try{calls['newstate'](_0x9a3f18);recordings[_0x6f58('0x1e')](_0x9a3f18);}catch(_0xef2e86){utils[_0x6f58('0x11')](_0xef2e86);}});ami['on'](_0x6f58('0x1f'),function(_0xc5b4ee){try{calls[_0x6f58('0x1f')](_0xc5b4ee);recordings[_0x6f58('0x1f')](_0xc5b4ee);dials[_0x6f58('0x1f')](_0xc5b4ee);agents[_0x6f58('0x1f')](_0xc5b4ee);queues['hangup'](_0xc5b4ee);}catch(_0x42b655){utils[_0x6f58('0x11')](_0x42b655);}});ami['on'](_0x6f58('0x20'),function(_0x18208c){try{members[_0x6f58('0x20')](_0x18208c);}catch(_0x584dcd){utils[_0x6f58('0x11')](_0x584dcd);}});ami['on'](_0x6f58('0x21'),function(_0x2a9c54){try{queues[_0x6f58('0x21')](_0x2a9c54);agents[_0x6f58('0x21')](_0x2a9c54);transfers[_0x6f58('0x21')](_0x2a9c54);}catch(_0x37682b){utils['error'](_0x37682b);}});ami['on'](_0x6f58('0x22'),function(_0x542b61){try{queues[_0x6f58('0x22')](_0x542b61);transfers[_0x6f58('0x22')](_0x542b61);agents[_0x6f58('0x22')](_0x542b61);calls[_0x6f58('0x22')](_0x542b61);}catch(_0x2d1b41){utils[_0x6f58('0x11')](_0x2d1b41);}});ami['on'](_0x6f58('0x23'),function(_0x2e1ae3){try{queues[_0x6f58('0x23')](_0x2e1ae3);recordings[_0x6f58('0x23')](_0x2e1ae3);calls[_0x6f58('0x23')](_0x2e1ae3);dials[_0x6f58('0x23')](_0x2e1ae3);}catch(_0x5eeb3b){utils['error'](_0x5eeb3b);}});ami['on'](_0x6f58('0x24'),function(_0x3d6820){try{calls[_0x6f58('0x24')](_0x3d6820);recordings[_0x6f58('0x24')](_0x3d6820);dials[_0x6f58('0x24')](_0x3d6820);}catch(_0x2b0f4f){utils['error'](_0x2b0f4f);}});ami['on'](_0x6f58('0x25'),function(_0x233eda){try{calls[_0x6f58('0x25')](_0x233eda);recordings[_0x6f58('0x25')](_0x233eda);}catch(_0xb55751){utils[_0x6f58('0x11')](_0xb55751);}});ami['on'](_0x6f58('0x26'),function(_0x3242e5){try{dials['dialbegin'](_0x3242e5);}catch(_0x572a9e){utils[_0x6f58('0x11')](_0x572a9e);}});ami['on']('dialend',function(_0x5cb126){try{dials['dialend'](_0x5cb126);}catch(_0x2c45b8){utils[_0x6f58('0x11')](_0x2c45b8);}});} \ No newline at end of file +var _0xaa29=['queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','./utils','port','asterisk','keepConnected','xdr','disabled','info','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0xaa29,0x1b0));var _0x9aa2=function(_0x3a2977,_0x3d246a){_0x3a2977=_0x3a2977-0x0;var _0x1ec08c=_0xaa29[_0x3a2977];return _0x1ec08c;};var AsteriskManager=require(_0x9aa2('0x0'));var config=require('../../config/environment');var utils=require(_0x9aa2('0x1'));var ami=new AsteriskManager(config['asterisk'][_0x9aa2('0x2')],config['asterisk']['ip'],config['asterisk']['username'],config[_0x9aa2('0x3')]['password'],!![]);ami[_0x9aa2('0x4')]();if(config[_0x9aa2('0x5')]&&config[_0x9aa2('0x5')][_0x9aa2('0x6')]){utils[_0x9aa2('0x7')]('XDR\x20DISABLED');}else{var agents=require(_0x9aa2('0x8'));var calls=require(_0x9aa2('0x9'));var queues=require('./queues.controller');var recordings=require(_0x9aa2('0xa'));var members=require(_0x9aa2('0xb'));var dials=require('./dials.controller');var transfers=require('./transfers.controller');var core=require(_0x9aa2('0xc'));ami['on'](_0x9aa2('0xd'),core['connect']);ami['on'](_0x9aa2('0xe'),core[_0x9aa2('0xe')]);ami['on'](_0x9aa2('0xf'),core[_0x9aa2('0xf')]);ami['on'](_0x9aa2('0x10'),core[_0x9aa2('0x10')]);ami['on'](_0x9aa2('0x11'),core[_0x9aa2('0x11')]);ami['on']('managerevent',core[_0x9aa2('0x12')]);ami['on']('devicestatechange',function(_0x3bc08f){try{members[_0x9aa2('0x13')](_0x3bc08f);}catch(_0x3b34de){utils[_0x9aa2('0x10')](_0x3b34de);}});ami['on']('agentcalled',function(_0x9054ac){try{agents['agentcalled'](_0x9054ac);}catch(_0x292d96){utils[_0x9aa2('0x10')](_0x292d96);}});ami['on'](_0x9aa2('0x14'),function(_0x33c76e){try{agents[_0x9aa2('0x14')](_0x33c76e);}catch(_0x4d051e){utils[_0x9aa2('0x10')](_0x4d051e);}});ami['on'](_0x9aa2('0x15'),function(_0x2196b7){try{agents['agentconnect'](_0x2196b7);queues['agentconnect'](_0x2196b7);}catch(_0x12ed7f){utils[_0x9aa2('0x10')](_0x12ed7f);}});ami['on']('agentcomplete',function(_0x376fb2){try{agents['agentcomplete'](_0x376fb2);queues[_0x9aa2('0x16')](_0x376fb2);members[_0x9aa2('0x16')](_0x376fb2);}catch(_0x1d6daf){utils['error'](_0x1d6daf);}});ami['on'](_0x9aa2('0x17'),function(_0x2f4d0c){try{agents['queuecallerabandon'](_0x2f4d0c);queues['queuecallerabandon'](_0x2f4d0c);}catch(_0x4a81f6){utils[_0x9aa2('0x10')](_0x4a81f6);}});ami['on'](_0x9aa2('0x18'),function(_0x33aedd){try{queues[_0x9aa2('0x18')](_0x33aedd);recordings[_0x9aa2('0x18')](_0x33aedd);}catch(_0x115295){utils['error'](_0x115295);}});ami['on'](_0x9aa2('0x19'),function(_0x5e59c0){try{queues[_0x9aa2('0x19')](_0x5e59c0);}catch(_0x48676e){utils[_0x9aa2('0x10')](_0x48676e);}});ami['on'](_0x9aa2('0x1a'),function(_0x2ccfc0){try{queues[_0x9aa2('0x1a')](_0x2ccfc0);calls[_0x9aa2('0x1a')](_0x2ccfc0);}catch(_0x23519a){utils[_0x9aa2('0x10')](_0x23519a);}});ami['on'](_0x9aa2('0x1b'),function(_0x3544da){try{queues[_0x9aa2('0x1b')](_0x3544da);calls[_0x9aa2('0x1b')](_0x3544da);}catch(_0x33890a){utils['error'](_0x33890a);}});ami['on'](_0x9aa2('0x1c'),function(_0x438a32){try{calls[_0x9aa2('0x1c')](_0x438a32);recordings[_0x9aa2('0x1c')](_0x438a32);}catch(_0x23065d){utils[_0x9aa2('0x10')](_0x23065d);}});ami['on'](_0x9aa2('0x1d'),function(_0x5864e4){try{calls[_0x9aa2('0x1d')](_0x5864e4);recordings['hangup'](_0x5864e4);dials[_0x9aa2('0x1d')](_0x5864e4);agents[_0x9aa2('0x1d')](_0x5864e4);queues[_0x9aa2('0x1d')](_0x5864e4);}catch(_0x312eb8){utils[_0x9aa2('0x10')](_0x312eb8);}});ami['on']('cdr',function(_0x33327b){try{members[_0x9aa2('0x1e')](_0x33327b);}catch(_0x303fc2){utils['error'](_0x303fc2);}});ami['on'](_0x9aa2('0x1f'),function(_0x21cab8){try{queues[_0x9aa2('0x1f')](_0x21cab8);agents[_0x9aa2('0x1f')](_0x21cab8);transfers['blindtransfer'](_0x21cab8);}catch(_0x1fca70){utils['error'](_0x1fca70);}});ami['on'](_0x9aa2('0x20'),function(_0x31a17e){try{queues[_0x9aa2('0x20')](_0x31a17e);transfers['attendedtransfer'](_0x31a17e);agents[_0x9aa2('0x20')](_0x31a17e);calls[_0x9aa2('0x20')](_0x31a17e);}catch(_0x131ef8){utils[_0x9aa2('0x10')](_0x131ef8);}});ami['on']('varset',function(_0x1c4879){try{queues['varset'](_0x1c4879);recordings[_0x9aa2('0x21')](_0x1c4879);calls[_0x9aa2('0x21')](_0x1c4879);dials['varset'](_0x1c4879);}catch(_0x493931){utils['error'](_0x493931);}});ami['on'](_0x9aa2('0x22'),function(_0x222dbb){try{calls[_0x9aa2('0x22')](_0x222dbb);recordings[_0x9aa2('0x22')](_0x222dbb);dials['newexten'](_0x222dbb);}catch(_0x2def0f){utils['error'](_0x2def0f);}});ami['on'](_0x9aa2('0x23'),function(_0x21bf6c){try{calls[_0x9aa2('0x23')](_0x21bf6c);recordings[_0x9aa2('0x23')](_0x21bf6c);}catch(_0x2bd95c){utils[_0x9aa2('0x10')](_0x2bd95c);}});ami['on'](_0x9aa2('0x24'),function(_0x3a0539){try{dials['dialbegin'](_0x3a0539);}catch(_0x54ebf0){utils[_0x9aa2('0x10')](_0x54ebf0);}});ami['on'](_0x9aa2('0x25'),function(_0x35a0a6){try{dials[_0x9aa2('0x25')](_0x35a0a6);}catch(_0x40e8cd){utils[_0x9aa2('0x10')](_0x40e8cd);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 2e0e7b4..977d5e5 100644 --- a/server/services/xdr/members.controller.js +++ b/server/services/xdr/members.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9527=['devicestatechange','state','INUSE','BUSY','device','voice','now','NOT_INUSE','duration','diffTime','exitAt','enterAt','agentcomplete','isNil','assign','queue','cdr','channel','split','data1','data2','source','data3','destinationchannel','lodash','util','info','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','membername','type','getUserByInterface','then','name','CreateMemberReport','getUserByName','internal','request','catch','startsWith'];(function(_0x51127a,_0x1a7def){var _0x28cbeb=function(_0x5e4125){while(--_0x5e4125){_0x51127a['push'](_0x51127a['shift']());}};_0x28cbeb(++_0x1a7def);}(_0x9527,0x160));var _0x7952=function(_0x15ae9a,_0x436974){_0x15ae9a=_0x15ae9a-0x0;var _0x3629b9=_0x9527[_0x15ae9a];return _0x3629b9;};'use strict';var _=require(_0x7952('0x0'));var util=require(_0x7952('0x1'));var utils=require('./utils');var members={};var exclude=['Local/_attended@transfer','Queue:'];function writeDB(_0x3cc329){utils[_0x7952('0x2')](util['format'](_0x7952('0x3'),_0x3cc329[_0x7952('0x4')],_0x3cc329[_0x7952('0x5')],_0x3cc329['channel'],_0x3cc329['data2'],_0x3cc329[_0x7952('0x6')],_0x3cc329[_0x7952('0x7')]));if(_0x3cc329[_0x7952('0x5')]){utils[_0x7952('0x8')](_0x3cc329[_0x7952('0x5')])[_0x7952('0x9')](function(_0x75e537){if(_0x75e537){_0x3cc329[_0x7952('0x6')]=_0x75e537[_0x7952('0xa')];_0x3cc329['internal']=_0x75e537['internal'];utils['request'](_0x7952('0xb'),_0x3cc329);}else{utils[_0x7952('0xc')](_0x3cc329[_0x7952('0x5')]['split']('/')[0x1])[_0x7952('0x9')](function(_0x1e916c){if(_0x1e916c){_0x3cc329['membername']=_0x1e916c[_0x7952('0xa')];_0x3cc329['internal']=_0x1e916c[_0x7952('0xd')];utils[_0x7952('0xe')](_0x7952('0xb'),_0x3cc329);}});}})[_0x7952('0xf')](function(_0x2be16e){utils['error'](_0x2be16e);});}delete members[_0x3cc329[_0x7952('0x5')]];}function startsWith(_0xc66ab,_0x388996){return _['some'](_0xc66ab,function(_0x2dbc12){return _[_0x7952('0x10')](_0x388996,_0x2dbc12);});}exports[_0x7952('0x11')]=function(_0x3baf7f){switch(_0x3baf7f[_0x7952('0x12')]){case _0x7952('0x13'):case _0x7952('0x14'):if(!startsWith(exclude,_0x3baf7f[_0x7952('0x15')])){members[_0x3baf7f[_0x7952('0x15')]]={'channel':_0x7952('0x16'),'interface':_0x3baf7f[_0x7952('0x15')],'type':'TALKING','enterAt':utils[_0x7952('0x17')](),'role':'agent'};}break;case _0x7952('0x18'):if(!_['isNil'](members[_0x3baf7f[_0x7952('0x15')]])){members[_0x3baf7f[_0x7952('0x15')]]['exitAt']=utils['now']();members[_0x3baf7f[_0x7952('0x15')]][_0x7952('0x19')]=utils[_0x7952('0x1a')](members[_0x3baf7f['device']][_0x7952('0x1b')],members[_0x3baf7f[_0x7952('0x15')]][_0x7952('0x1c')]);if(members[_0x3baf7f[_0x7952('0x15')]]['uniqueid']){writeDB(members[_0x3baf7f[_0x7952('0x15')]]);}}default:break;}};exports[_0x7952('0x1d')]=function(_0x472313){if(!_[_0x7952('0x1e')](members[_0x472313[_0x7952('0x5')]])){members[_0x472313['interface']]=_[_0x7952('0x1f')](members[_0x472313[_0x7952('0x5')]],{'data4':_0x472313[_0x7952('0x20')],'uniqueid':_0x472313[_0x7952('0x4')]});}};exports[_0x7952('0x21')]=function(_0x3da115){if(_0x3da115[_0x7952('0x22')]){var _0x142c9f=_0x3da115[_0x7952('0x22')][_0x7952('0x23')]('-')[0x0];if(!_[_0x7952('0x1e')](members[_0x142c9f])){members[_0x142c9f]=_[_0x7952('0x1f')](members[_0x142c9f],{'data1':members[_0x142c9f][_0x7952('0x24')]||_0x3da115['type'],'data2':members[_0x142c9f][_0x7952('0x25')]||_0x3da115[_0x7952('0x26')],'data3':members[_0x142c9f][_0x7952('0x27')]||_0x3da115['destination'],'uniqueid':members[_0x142c9f][_0x7952('0x4')]||_0x3da115[_0x7952('0x4')]});if(members[_0x142c9f]['exitAt']){writeDB(members[_0x142c9f]);}}}if(_0x3da115[_0x7952('0x28')]){var _0x2aa357=_0x3da115[_0x7952('0x28')][_0x7952('0x23')]('-')[0x0];if(!_[_0x7952('0x1e')](members[_0x2aa357])){members[_0x2aa357]=_[_0x7952('0x1f')](members[_0x2aa357],{'data1':members[_0x2aa357]['data1']||_0x3da115[_0x7952('0x7')],'data2':members[_0x2aa357]['data2']||_0x3da115[_0x7952('0x26')],'data3':members[_0x2aa357]['data3']||_0x3da115['destination'],'uniqueid':members[_0x2aa357][_0x7952('0x4')]||_0x3da115[_0x7952('0x4')]});if(members[_0x2aa357][_0x7952('0x1b')]){writeDB(members[_0x2aa357]);}}}}; \ No newline at end of file +var _0x82aa=['uniqueid','agentcomplete','assign','queue','cdr','channel','source','data3','destinationchannel','isNil','destination','lodash','util','./utils','Queue:','info','format','MEMBER|%s|%s|%s|%s|%s|%s','interface','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','some','startsWith','devicestatechange','state','device','voice','agent','NOT_INUSE','exitAt','now','duration','diffTime','enterAt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x82aa,0x92));var _0xa82a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x82aa[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xa82a('0x0'));var util=require(_0xa82a('0x1'));var utils=require(_0xa82a('0x2'));var members={};var exclude=['Local/_attended@transfer',_0xa82a('0x3')];function writeDB(_0x1e9acc){utils[_0xa82a('0x4')](util[_0xa82a('0x5')](_0xa82a('0x6'),_0x1e9acc['uniqueid'],_0x1e9acc[_0xa82a('0x7')],_0x1e9acc['channel'],_0x1e9acc[_0xa82a('0x8')],_0x1e9acc[_0xa82a('0x9')],_0x1e9acc[_0xa82a('0xa')]));if(_0x1e9acc['interface']){utils[_0xa82a('0xb')](_0x1e9acc['interface'])[_0xa82a('0xc')](function(_0x58d439){if(_0x58d439){_0x1e9acc['membername']=_0x58d439[_0xa82a('0xd')];_0x1e9acc[_0xa82a('0xe')]=_0x58d439[_0xa82a('0xe')];utils[_0xa82a('0xf')](_0xa82a('0x10'),_0x1e9acc);}else{utils[_0xa82a('0x11')](_0x1e9acc[_0xa82a('0x7')][_0xa82a('0x12')]('/')[0x1])['then'](function(_0x652198){if(_0x652198){_0x1e9acc['membername']=_0x652198[_0xa82a('0xd')];_0x1e9acc['internal']=_0x652198[_0xa82a('0xe')];utils[_0xa82a('0xf')](_0xa82a('0x10'),_0x1e9acc);}});}})[_0xa82a('0x13')](function(_0x28f33f){utils[_0xa82a('0x14')](_0x28f33f);});}delete members[_0x1e9acc[_0xa82a('0x7')]];}function startsWith(_0x4e3184,_0x382d75){return _[_0xa82a('0x15')](_0x4e3184,function(_0x609bba){return _[_0xa82a('0x16')](_0x382d75,_0x609bba);});}exports[_0xa82a('0x17')]=function(_0x25c780){switch(_0x25c780[_0xa82a('0x18')]){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x25c780[_0xa82a('0x19')])){members[_0x25c780[_0xa82a('0x19')]]={'channel':_0xa82a('0x1a'),'interface':_0x25c780['device'],'type':'TALKING','enterAt':utils['now'](),'role':_0xa82a('0x1b')};}break;case _0xa82a('0x1c'):if(!_['isNil'](members[_0x25c780['device']])){members[_0x25c780[_0xa82a('0x19')]][_0xa82a('0x1d')]=utils[_0xa82a('0x1e')]();members[_0x25c780[_0xa82a('0x19')]][_0xa82a('0x1f')]=utils[_0xa82a('0x20')](members[_0x25c780['device']][_0xa82a('0x1d')],members[_0x25c780['device']][_0xa82a('0x21')]);if(members[_0x25c780['device']][_0xa82a('0x22')]){writeDB(members[_0x25c780[_0xa82a('0x19')]]);}}default:break;}};exports[_0xa82a('0x23')]=function(_0xad5ff9){if(!_['isNil'](members[_0xad5ff9[_0xa82a('0x7')]])){members[_0xad5ff9[_0xa82a('0x7')]]=_[_0xa82a('0x24')](members[_0xad5ff9[_0xa82a('0x7')]],{'data4':_0xad5ff9[_0xa82a('0x25')],'uniqueid':_0xad5ff9[_0xa82a('0x22')]});}};exports[_0xa82a('0x26')]=function(_0xb5c333){if(_0xb5c333[_0xa82a('0x27')]){var _0x2585df=_0xb5c333['channel'][_0xa82a('0x12')]('-')[0x0];if(!_['isNil'](members[_0x2585df])){members[_0x2585df]=_['assign'](members[_0x2585df],{'data1':members[_0x2585df]['data1']||_0xb5c333[_0xa82a('0xa')],'data2':members[_0x2585df][_0xa82a('0x8')]||_0xb5c333[_0xa82a('0x28')],'data3':members[_0x2585df][_0xa82a('0x29')]||_0xb5c333['destination'],'uniqueid':members[_0x2585df][_0xa82a('0x22')]||_0xb5c333[_0xa82a('0x22')]});if(members[_0x2585df][_0xa82a('0x1d')]){writeDB(members[_0x2585df]);}}}if(_0xb5c333[_0xa82a('0x2a')]){var _0x25bf49=_0xb5c333['destinationchannel']['split']('-')[0x0];if(!_[_0xa82a('0x2b')](members[_0x25bf49])){members[_0x25bf49]=_['assign'](members[_0x25bf49],{'data1':members[_0x25bf49]['data1']||_0xb5c333[_0xa82a('0xa')],'data2':members[_0x25bf49][_0xa82a('0x8')]||_0xb5c333['source'],'data3':members[_0x25bf49]['data3']||_0xb5c333[_0xa82a('0x2c')],'uniqueid':members[_0x25bf49]['uniqueid']||_0xb5c333[_0xa82a('0x22')]});if(members[_0x25bf49][_0xa82a('0x1d')]){writeDB(members[_0x25bf49]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 204bacd..097c87c 100644 --- a/server/services/xdr/queues.controller.js +++ b/server/services/xdr/queues.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e95=['transfertargetuniqueid','calleridname','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','mohtime','error','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','lodash','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','channel','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','uniqueid','now','isNil','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','queuecallerenterreason','varset','value','toUpperCase','queuecallerexit','queuecallerexitAt','variable','queueposition','queuecallerabandonAt','EXITWITHKEY','queuecallerabandon','ABANDONED','queuecallerleave','holdtime','queuecallerjoinAt','position','count','connectedlinenum','connectedlinename','assigned','destaccountcode','lastAssignedTo','membername','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone'];(function(_0x166439,_0x1cd91f){var _0x1210e8=function(_0x1b4f53){while(--_0x1b4f53){_0x166439['push'](_0x166439['shift']());}};_0x1210e8(++_0x1cd91f);}(_0x8e95,0x191));var _0x58e9=function(_0x17eac9,_0x21e894){_0x17eac9=_0x17eac9-0x0;var _0x57993a=_0x8e95[_0x17eac9];return _0x57993a;};'use strict';var _=require(_0x58e9('0x0'));var util=require('util');var utils=require(_0x58e9('0x1'));var queues={};function writeDB(_0x4c78c1){utils[_0x58e9('0x2')](util[_0x58e9('0x3')](_0x58e9('0x4'),_0x4c78c1['uniqueid'],_0x4c78c1[_0x58e9('0x5')],_0x4c78c1['queue'],_0x4c78c1['lastAssignedTo'],_0x4c78c1[_0x58e9('0x6')],_0x4c78c1[_0x58e9('0x7')],_0x4c78c1[_0x58e9('0x8')]));if(_0x4c78c1[_0x58e9('0x9')]){utils[_0x58e9('0xa')](_0x4c78c1[_0x58e9('0x9')])[_0x58e9('0xb')](function(_0x10a480){if(_0x10a480){_0x4c78c1['type']=_0x10a480[_0x58e9('0xc')];}utils['request'](_0x58e9('0xd'),_0x4c78c1);});}else{utils[_0x58e9('0xe')](_0x58e9('0xd'),_0x4c78c1);}if(_0x4c78c1[_0x58e9('0xf')]){delete queues[_0x4c78c1['transfereduniqueid']];}else{delete queues[_0x4c78c1[_0x58e9('0x10')]];}}exports['queuecallerjoin']=function(_0xa0796c){queues[_0xa0796c[_0x58e9('0x10')]]=_['assign'](_0xa0796c,{'originalposition':_0xa0796c['position'],'queuecallerjoinAt':utils[_0x58e9('0x11')](),'mohtime':0x0});};exports['hangup']=function(_0x2493e3){if(!_[_0x58e9('0x12')](queues[_0x2493e3[_0x58e9('0x10')]])){if(queues[_0x2493e3[_0x58e9('0x10')]][_0x58e9('0x13')]){if(!queues[_0x2493e3[_0x58e9('0x10')]]['queuecallerabandon']&&!queues[_0x2493e3[_0x58e9('0x10')]]['queuecallerexit']){queues[_0x2493e3[_0x58e9('0x10')]][_0x58e9('0x14')]=!![];queues[_0x2493e3[_0x58e9('0x10')]][_0x58e9('0x15')]=utils[_0x58e9('0x11')]();queues[_0x2493e3['uniqueid']][_0x58e9('0x8')]=_0x58e9('0x16');}writeDB(queues[_0x2493e3[_0x58e9('0x10')]]);}else{if(queues[_0x2493e3[_0x58e9('0x10')]]['transfereduniqueid']){queues[queues[_0x2493e3[_0x58e9('0x10')]]['transfereduniqueid']]=queues[_0x2493e3[_0x58e9('0x10')]];queues[queues[_0x2493e3['uniqueid']]['transfereduniqueid']][_0x58e9('0x17')]=0x2;delete queues[_0x2493e3[_0x58e9('0x10')]];}}}};exports[_0x58e9('0x18')]=function(_0x22b18c){if(!_['isNil'](_0x22b18c['variable']['queuestatus'])&&_0x22b18c[_0x58e9('0x19')][_0x58e9('0x1a')]()!=='CONTINUE'){if(!_['isNil'](queues[_0x22b18c['uniqueid']])){queues[_0x22b18c[_0x58e9('0x10')]]['queuecallerabandon']=![];queues[_0x22b18c['uniqueid']]['queuecallerabandonAt']=null;queues[_0x22b18c[_0x58e9('0x10')]][_0x58e9('0x1b')]=!![];queues[_0x22b18c[_0x58e9('0x10')]][_0x58e9('0x1c')]=utils[_0x58e9('0x11')]();queues[_0x22b18c[_0x58e9('0x10')]]['queuecallerexitreason']=_0x22b18c[_0x58e9('0x19')][_0x58e9('0x1a')]();writeDB(queues[_0x22b18c['uniqueid']]);}}else if(!_['isNil'](_0x22b18c[_0x58e9('0x1d')][_0x58e9('0x1e')])){if(!_[_0x58e9('0x12')](queues[_0x22b18c[_0x58e9('0x10')]])&&!queues[_0x22b18c[_0x58e9('0x10')]]['queuecallerabandon']){queues[_0x22b18c[_0x58e9('0x10')]]['queuecallerabandon']=![];queues[_0x22b18c[_0x58e9('0x10')]][_0x58e9('0x1f')]=null;queues[_0x22b18c['uniqueid']][_0x58e9('0x1b')]=!![];queues[_0x22b18c[_0x58e9('0x10')]][_0x58e9('0x1c')]=utils[_0x58e9('0x11')]();queues[_0x22b18c[_0x58e9('0x10')]][_0x58e9('0x8')]=_0x58e9('0x20');}}};exports[_0x58e9('0x21')]=function(_0x54d96a){if(!_[_0x58e9('0x12')](queues[_0x54d96a['uniqueid']])){queues[_0x54d96a['uniqueid']][_0x58e9('0x1b')]=![];queues[_0x54d96a[_0x58e9('0x10')]][_0x58e9('0x1c')]=null;queues[_0x54d96a[_0x58e9('0x10')]]['queuecallerabandon']=!![];queues[_0x54d96a['uniqueid']]['queuecallerabandonAt']=utils['now']();queues[_0x54d96a[_0x58e9('0x10')]]['queuecallerexitreason']=_0x58e9('0x22');}};exports[_0x58e9('0x23')]=function(_0x3550f4){if(!_[_0x58e9('0x12')](queues[_0x3550f4[_0x58e9('0x10')]])){queues[_0x3550f4[_0x58e9('0x10')]][_0x58e9('0x23')]=!![];queues[_0x3550f4[_0x58e9('0x10')]][_0x58e9('0x13')]=utils['now']();queues[_0x3550f4[_0x58e9('0x10')]][_0x58e9('0x24')]=utils['diffTime'](queues[_0x3550f4[_0x58e9('0x10')]][_0x58e9('0x13')],queues[_0x3550f4[_0x58e9('0x10')]][_0x58e9('0x25')]);queues[_0x3550f4[_0x58e9('0x10')]][_0x58e9('0x26')]=_0x3550f4[_0x58e9('0x26')];queues[_0x3550f4['uniqueid']]['count']=_0x3550f4[_0x58e9('0x27')];queues[_0x3550f4[_0x58e9('0x10')]][_0x58e9('0x28')]=_0x3550f4[_0x58e9('0x28')];queues[_0x3550f4['uniqueid']][_0x58e9('0x29')]=_0x3550f4[_0x58e9('0x29')];}};exports['agentconnect']=function(_0x479562){if(!_[_0x58e9('0x12')](queues[_0x479562[_0x58e9('0x10')]])){queues[_0x479562[_0x58e9('0x10')]][_0x58e9('0x21')]=![];queues[_0x479562[_0x58e9('0x10')]][_0x58e9('0x21')]=![];queues[_0x479562[_0x58e9('0x10')]][_0x58e9('0x1f')]=null;queues[_0x479562[_0x58e9('0x10')]][_0x58e9('0x1b')]=![];queues[_0x479562[_0x58e9('0x10')]][_0x58e9('0x8')]=null;queues[_0x479562[_0x58e9('0x10')]]['queuecallerexitAt']=null;queues[_0x479562[_0x58e9('0x10')]][_0x58e9('0x2a')]=!![];queues[_0x479562[_0x58e9('0x10')]]['accountcode']=_0x479562[_0x58e9('0x2b')];queues[_0x479562['uniqueid']][_0x58e9('0x2c')]=_0x479562[_0x58e9('0x2d')];}};exports[_0x58e9('0x2e')]=function(_0x10ad7e){if(!_['isNil'](queues[_0x10ad7e['uniqueid']])){if(queues[_0x10ad7e[_0x58e9('0x10')]][_0x58e9('0x13')]){queues[_0x10ad7e[_0x58e9('0x10')]]['queuecallerabandon']=![];queues[_0x10ad7e[_0x58e9('0x10')]]['queuecallerabandon']=![];queues[_0x10ad7e[_0x58e9('0x10')]][_0x58e9('0x1f')]=null;queues[_0x10ad7e[_0x58e9('0x10')]][_0x58e9('0x1b')]=![];queues[_0x10ad7e[_0x58e9('0x10')]]['queuecallerexitAt']=null;queues[_0x10ad7e[_0x58e9('0x10')]][_0x58e9('0x2a')]=!![];queues[_0x10ad7e['uniqueid']]['lastAssignedTo']=_0x10ad7e[_0x58e9('0x2d')];queues[_0x10ad7e[_0x58e9('0x10')]][_0x58e9('0x14')]=!![];queues[_0x10ad7e['uniqueid']][_0x58e9('0x15')]=utils['now']();if(_0x10ad7e[_0x58e9('0x2f')]==_0x58e9('0x30')){if(!queues[_0x10ad7e[_0x58e9('0x10')]][_0x58e9('0x30')]){queues[_0x10ad7e[_0x58e9('0x10')]][_0x58e9('0x8')]=_0x58e9('0x31');}}else{queues[_0x10ad7e[_0x58e9('0x10')]][_0x58e9('0x8')]=_0x58e9('0x32')+_0x10ad7e[_0x58e9('0x2f')][_0x58e9('0x1a')]();}writeDB(queues[_0x10ad7e[_0x58e9('0x10')]]);}}};exports['blindtransfer']=function(_0x2ab267){if(!_[_0x58e9('0x12')](queues[_0x2ab267['transfereeuniqueid']])){queues[_0x2ab267[_0x58e9('0x33')]][_0x58e9('0x30')]=!![];queues[_0x2ab267[_0x58e9('0x33')]][_0x58e9('0x34')]=_0x58e9('0x35');queues[_0x2ab267[_0x58e9('0x33')]][_0x58e9('0x36')]=_0x2ab267[_0x58e9('0x37')];queues[_0x2ab267['transfereeuniqueid']][_0x58e9('0x38')]=_0x2ab267[_0x58e9('0x33')];queues[_0x2ab267['transfereeuniqueid']][_0x58e9('0x8')]=_0x58e9('0x39');}};exports[_0x58e9('0x3a')]=function(_0x196200){try{if(_0x196200[_0x58e9('0x3b')]==_0x196200[_0x58e9('0x3c')]){if(!_[_0x58e9('0x12')](queues[_0x196200[_0x58e9('0x3d')]])){queues[_0x196200[_0x58e9('0x3d')]][_0x58e9('0x30')]=!![];queues[_0x196200[_0x58e9('0x3d')]]['transfertype']=_0x58e9('0x3e');queues[_0x196200[_0x58e9('0x3d')]][_0x58e9('0x36')]=_0x196200[_0x58e9('0x3f')];queues[_0x196200[_0x58e9('0x3d')]][_0x58e9('0x38')]=_0x196200[_0x58e9('0x3b')];queues[_0x196200[_0x58e9('0x3d')]][_0x58e9('0x8')]=_0x58e9('0x40');}if(!_['isNil'](queues[_0x196200[_0x58e9('0x3c')]])){if(_0x196200[_0x58e9('0x41')]&&queues[_0x196200[_0x58e9('0x41')]]){queues[_0x196200[_0x58e9('0x41')]][_0x58e9('0x17')]=0x1;queues[_0x196200[_0x58e9('0x33')]]=_[_0x58e9('0x42')](queues[_0x196200['transfereelinkedid']]);queues[_0x196200[_0x58e9('0x33')]][_0x58e9('0xf')]=_0x196200[_0x58e9('0x43')];queues[_0x196200['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x196200[_0x58e9('0x33')]][_0x58e9('0x6')]=queues[_0x196200[_0x58e9('0x3d')]][_0x58e9('0x6')];queues[_0x196200[_0x58e9('0x33')]][_0x58e9('0x44')]=queues[_0x196200[_0x58e9('0x3d')]][_0x58e9('0x44')];queues[_0x196200[_0x58e9('0x33')]]['queuecallerjoinAt']=utils['now']();queues[_0x196200['transfereeuniqueid']][_0x58e9('0x13')]=utils[_0x58e9('0x11')]();queues[_0x196200[_0x58e9('0x33')]][_0x58e9('0x24')]=0x0;queues[_0x196200[_0x58e9('0x33')]]['mohtime']=0x0;}else{queues[_0x196200[_0x58e9('0x3c')]]['transfereduniqueid']=_0x196200[_0x58e9('0x3d')];}}}else if(_0x196200[_0x58e9('0x45')]==_0x196200['secondtransfererlinkedid']){if(!_[_0x58e9('0x12')](queues[_0x196200[_0x58e9('0x3c')]])){queues[_0x196200[_0x58e9('0x3c')]][_0x58e9('0x30')]=!![];queues[_0x196200[_0x58e9('0x3c')]][_0x58e9('0x34')]=_0x58e9('0x3e');queues[_0x196200[_0x58e9('0x3c')]][_0x58e9('0x36')]=_0x196200[_0x58e9('0x46')];queues[_0x196200['origtransfererlinkedid']][_0x58e9('0x38')]=_0x196200[_0x58e9('0x45')];queues[_0x196200[_0x58e9('0x3c')]][_0x58e9('0x8')]='ATTENDEDTRANSFER';}if(!_[_0x58e9('0x12')](queues[_0x196200[_0x58e9('0x3d')]])){if(_0x196200[_0x58e9('0x47')]&&queues[_0x196200['transfertargetlinkedid']]){queues[_0x196200[_0x58e9('0x47')]][_0x58e9('0x17')]=0x1;queues[_0x196200['transfertargetuniqueid']]=_['clone'](queues[_0x196200[_0x58e9('0x47')]]);queues[_0x196200[_0x58e9('0x43')]][_0x58e9('0xf')]=_0x196200[_0x58e9('0x43')];queues[_0x196200[_0x58e9('0x43')]][_0x58e9('0x17')]=0x2;queues[_0x196200[_0x58e9('0x43')]]['calleridnum']=queues[_0x196200[_0x58e9('0x3c')]][_0x58e9('0x6')];queues[_0x196200['transfertargetuniqueid']][_0x58e9('0x44')]=queues[_0x196200[_0x58e9('0x3c')]]['calleridname'];queues[_0x196200[_0x58e9('0x43')]][_0x58e9('0x25')]=utils[_0x58e9('0x11')]();queues[_0x196200[_0x58e9('0x43')]][_0x58e9('0x13')]=utils[_0x58e9('0x11')]();queues[_0x196200[_0x58e9('0x43')]][_0x58e9('0x24')]=0x0;queues[_0x196200['transfertargetuniqueid']][_0x58e9('0x48')]=0x0;}else{queues[_0x196200[_0x58e9('0x3d')]][_0x58e9('0xf')]=_0x196200[_0x58e9('0x3c')];}}}}catch(_0x152447){utils[_0x58e9('0x49')](_0x152447[_0x58e9('0x4a')]);}};exports[_0x58e9('0x4b')]=function(_0xa02b3f){if(!_[_0x58e9('0x12')](queues[_0xa02b3f[_0x58e9('0x10')]])){queues[_0xa02b3f[_0x58e9('0x10')]][_0x58e9('0x4c')]=utils['now']();}};exports[_0x58e9('0x4d')]=function(_0x20d0d9){if(!_[_0x58e9('0x12')](queues[_0x20d0d9[_0x58e9('0x10')]])){if(!_['isNil'](queues[_0x20d0d9[_0x58e9('0x10')]][_0x58e9('0x4c')])){queues[_0x20d0d9[_0x58e9('0x10')]][_0x58e9('0x48')]+=utils['diffTime'](utils[_0x58e9('0x11')](),queues[_0x20d0d9['uniqueid']][_0x58e9('0x4c')]);delete queues[_0x20d0d9[_0x58e9('0x10')]][_0x58e9('0x4c')];}}}; \ No newline at end of file +var _0xbabc=['diffTime','lodash','util','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','position','now','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallercomplete','COMPLETEDBYAGENT','queuecallerenterreason','variable','queuestatus','value','toUpperCase','queuecallerabandonAt','queuecallerexit','queueposition','queuecallerexitAt','EXITWITHKEY','ABANDONED','queuecallerleave','holdtime','queuecallerjoinAt','count','connectedlinename','agentconnect','assigned','accountcode','membername','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','transfereeuniqueid','transferexten','extension','transferuniqueid','BLINDTRANSFER','origtransfererlinkedid','secondtransfererlinkedid','transfertype','ATTENDED','origtransfererexten','origtransfereruniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','secondtransfererexten','secondtransfereruniqueid','transfertargetlinkedid','stack','musiconholdstart','musiconholdstartAt','musiconholdstop'];(function(_0x39efba,_0x4df68a){var _0x28c0dc=function(_0x5722cc){while(--_0x5722cc){_0x39efba['push'](_0x39efba['shift']());}};_0x28c0dc(++_0x4df68a);}(_0xbabc,0xeb));var _0xcbab=function(_0x1c0e04,_0x402de0){_0x1c0e04=_0x1c0e04-0x0;var _0x2e01aa=_0xbabc[_0x1c0e04];return _0x2e01aa;};'use strict';var _=require(_0xcbab('0x0'));var util=require(_0xcbab('0x1'));var utils=require(_0xcbab('0x2'));var queues={};function writeDB(_0x5884ed){utils[_0xcbab('0x3')](util[_0xcbab('0x4')](_0xcbab('0x5'),_0x5884ed[_0xcbab('0x6')],_0x5884ed[_0xcbab('0x7')],_0x5884ed[_0xcbab('0x8')],_0x5884ed[_0xcbab('0x9')],_0x5884ed[_0xcbab('0xa')],_0x5884ed['accountcode'],_0x5884ed[_0xcbab('0xb')]));if(_0x5884ed[_0xcbab('0x8')]){utils[_0xcbab('0xc')](_0x5884ed[_0xcbab('0x8')])[_0xcbab('0xd')](function(_0x36e868){if(_0x36e868){_0x5884ed[_0xcbab('0xe')]=_0x36e868[_0xcbab('0xe')];}utils[_0xcbab('0xf')](_0xcbab('0x10'),_0x5884ed);});}else{utils[_0xcbab('0xf')](_0xcbab('0x10'),_0x5884ed);}if(_0x5884ed[_0xcbab('0x11')]){delete queues[_0x5884ed[_0xcbab('0x11')]];}else{delete queues[_0x5884ed[_0xcbab('0x6')]];}}exports[_0xcbab('0x12')]=function(_0x4ad728){queues[_0x4ad728[_0xcbab('0x6')]]=_[_0xcbab('0x13')](_0x4ad728,{'originalposition':_0x4ad728[_0xcbab('0x14')],'queuecallerjoinAt':utils[_0xcbab('0x15')](),'mohtime':0x0});};exports[_0xcbab('0x16')]=function(_0x2abdf2){if(!_[_0xcbab('0x17')](queues[_0x2abdf2[_0xcbab('0x6')]])){if(queues[_0x2abdf2[_0xcbab('0x6')]][_0xcbab('0x18')]){if(!queues[_0x2abdf2['uniqueid']][_0xcbab('0x19')]&&!queues[_0x2abdf2[_0xcbab('0x6')]]['queuecallerexit']){queues[_0x2abdf2[_0xcbab('0x6')]][_0xcbab('0x1a')]=!![];queues[_0x2abdf2[_0xcbab('0x6')]]['queuecallercompleteAt']=utils[_0xcbab('0x15')]();queues[_0x2abdf2[_0xcbab('0x6')]][_0xcbab('0xb')]=_0xcbab('0x1b');}writeDB(queues[_0x2abdf2[_0xcbab('0x6')]]);}else{if(queues[_0x2abdf2[_0xcbab('0x6')]][_0xcbab('0x11')]){queues[queues[_0x2abdf2[_0xcbab('0x6')]]['transfereduniqueid']]=queues[_0x2abdf2['uniqueid']];queues[queues[_0x2abdf2[_0xcbab('0x6')]][_0xcbab('0x11')]][_0xcbab('0x1c')]=0x2;delete queues[_0x2abdf2[_0xcbab('0x6')]];}}}};exports['varset']=function(_0x245cb6){if(!_[_0xcbab('0x17')](_0x245cb6[_0xcbab('0x1d')][_0xcbab('0x1e')])&&_0x245cb6[_0xcbab('0x1f')][_0xcbab('0x20')]()!=='CONTINUE'){if(!_[_0xcbab('0x17')](queues[_0x245cb6[_0xcbab('0x6')]])){queues[_0x245cb6['uniqueid']]['queuecallerabandon']=![];queues[_0x245cb6[_0xcbab('0x6')]][_0xcbab('0x21')]=null;queues[_0x245cb6[_0xcbab('0x6')]][_0xcbab('0x22')]=!![];queues[_0x245cb6['uniqueid']]['queuecallerexitAt']=utils[_0xcbab('0x15')]();queues[_0x245cb6[_0xcbab('0x6')]][_0xcbab('0xb')]=_0x245cb6[_0xcbab('0x1f')]['toUpperCase']();writeDB(queues[_0x245cb6[_0xcbab('0x6')]]);}}else if(!_['isNil'](_0x245cb6[_0xcbab('0x1d')][_0xcbab('0x23')])){if(!_[_0xcbab('0x17')](queues[_0x245cb6[_0xcbab('0x6')]])&&!queues[_0x245cb6[_0xcbab('0x6')]][_0xcbab('0x19')]){queues[_0x245cb6[_0xcbab('0x6')]][_0xcbab('0x19')]=![];queues[_0x245cb6[_0xcbab('0x6')]][_0xcbab('0x21')]=null;queues[_0x245cb6[_0xcbab('0x6')]][_0xcbab('0x22')]=!![];queues[_0x245cb6[_0xcbab('0x6')]][_0xcbab('0x24')]=utils[_0xcbab('0x15')]();queues[_0x245cb6[_0xcbab('0x6')]][_0xcbab('0xb')]=_0xcbab('0x25');}}};exports['queuecallerabandon']=function(_0x226aab){if(!_[_0xcbab('0x17')](queues[_0x226aab[_0xcbab('0x6')]])){queues[_0x226aab[_0xcbab('0x6')]][_0xcbab('0x22')]=![];queues[_0x226aab['uniqueid']]['queuecallerexitAt']=null;queues[_0x226aab['uniqueid']]['queuecallerabandon']=!![];queues[_0x226aab['uniqueid']]['queuecallerabandonAt']=utils[_0xcbab('0x15')]();queues[_0x226aab[_0xcbab('0x6')]][_0xcbab('0xb')]=_0xcbab('0x26');}};exports[_0xcbab('0x27')]=function(_0x43427e){if(!_[_0xcbab('0x17')](queues[_0x43427e[_0xcbab('0x6')]])){queues[_0x43427e[_0xcbab('0x6')]]['queuecallerleave']=!![];queues[_0x43427e[_0xcbab('0x6')]][_0xcbab('0x18')]=utils[_0xcbab('0x15')]();queues[_0x43427e[_0xcbab('0x6')]][_0xcbab('0x28')]=utils['diffTime'](queues[_0x43427e['uniqueid']][_0xcbab('0x18')],queues[_0x43427e[_0xcbab('0x6')]][_0xcbab('0x29')]);queues[_0x43427e[_0xcbab('0x6')]]['position']=_0x43427e[_0xcbab('0x14')];queues[_0x43427e[_0xcbab('0x6')]][_0xcbab('0x2a')]=_0x43427e[_0xcbab('0x2a')];queues[_0x43427e['uniqueid']]['connectedlinenum']=_0x43427e['connectedlinenum'];queues[_0x43427e[_0xcbab('0x6')]][_0xcbab('0x2b')]=_0x43427e['connectedlinename'];}};exports[_0xcbab('0x2c')]=function(_0xf1c660){if(!_['isNil'](queues[_0xf1c660[_0xcbab('0x6')]])){queues[_0xf1c660['uniqueid']][_0xcbab('0x19')]=![];queues[_0xf1c660['uniqueid']]['queuecallerabandon']=![];queues[_0xf1c660[_0xcbab('0x6')]]['queuecallerabandonAt']=null;queues[_0xf1c660[_0xcbab('0x6')]][_0xcbab('0x22')]=![];queues[_0xf1c660[_0xcbab('0x6')]]['queuecallerexitreason']=null;queues[_0xf1c660[_0xcbab('0x6')]]['queuecallerexitAt']=null;queues[_0xf1c660[_0xcbab('0x6')]][_0xcbab('0x2d')]=!![];queues[_0xf1c660[_0xcbab('0x6')]][_0xcbab('0x2e')]=_0xf1c660['destaccountcode'];queues[_0xf1c660[_0xcbab('0x6')]]['lastAssignedTo']=_0xf1c660['membername'];}};exports['agentcomplete']=function(_0x59af6c){if(!_['isNil'](queues[_0x59af6c[_0xcbab('0x6')]])){if(queues[_0x59af6c[_0xcbab('0x6')]][_0xcbab('0x18')]){queues[_0x59af6c['uniqueid']]['queuecallerabandon']=![];queues[_0x59af6c[_0xcbab('0x6')]][_0xcbab('0x19')]=![];queues[_0x59af6c[_0xcbab('0x6')]][_0xcbab('0x21')]=null;queues[_0x59af6c[_0xcbab('0x6')]][_0xcbab('0x22')]=![];queues[_0x59af6c[_0xcbab('0x6')]][_0xcbab('0x24')]=null;queues[_0x59af6c[_0xcbab('0x6')]]['assigned']=!![];queues[_0x59af6c['uniqueid']][_0xcbab('0x9')]=_0x59af6c[_0xcbab('0x2f')];queues[_0x59af6c[_0xcbab('0x6')]][_0xcbab('0x1a')]=!![];queues[_0x59af6c[_0xcbab('0x6')]][_0xcbab('0x30')]=utils['now']();if(_0x59af6c[_0xcbab('0x31')]==_0xcbab('0x32')){if(!queues[_0x59af6c['uniqueid']][_0xcbab('0x32')]){queues[_0x59af6c[_0xcbab('0x6')]]['queuecallerexitreason']=_0xcbab('0x33');}}else{queues[_0x59af6c[_0xcbab('0x6')]]['queuecallerexitreason']=_0xcbab('0x34')+_0x59af6c['reason'][_0xcbab('0x20')]();}writeDB(queues[_0x59af6c['uniqueid']]);}}};exports['blindtransfer']=function(_0x4be9a0){if(!_[_0xcbab('0x17')](queues[_0x4be9a0[_0xcbab('0x35')]])){queues[_0x4be9a0[_0xcbab('0x35')]][_0xcbab('0x32')]=!![];queues[_0x4be9a0[_0xcbab('0x35')]]['transfertype']='BLIND';queues[_0x4be9a0[_0xcbab('0x35')]][_0xcbab('0x36')]=_0x4be9a0[_0xcbab('0x37')];queues[_0x4be9a0[_0xcbab('0x35')]][_0xcbab('0x38')]=_0x4be9a0[_0xcbab('0x35')];queues[_0x4be9a0[_0xcbab('0x35')]]['queuecallerexitreason']=_0xcbab('0x39');}};exports['attendedtransfer']=function(_0x2924bb){try{if(_0x2924bb['origtransfereruniqueid']==_0x2924bb[_0xcbab('0x3a')]){if(!_['isNil'](queues[_0x2924bb[_0xcbab('0x3b')]])){queues[_0x2924bb[_0xcbab('0x3b')]]['transfer']=!![];queues[_0x2924bb[_0xcbab('0x3b')]][_0xcbab('0x3c')]=_0xcbab('0x3d');queues[_0x2924bb['secondtransfererlinkedid']]['transferexten']=_0x2924bb[_0xcbab('0x3e')];queues[_0x2924bb[_0xcbab('0x3b')]][_0xcbab('0x38')]=_0x2924bb[_0xcbab('0x3f')];queues[_0x2924bb[_0xcbab('0x3b')]][_0xcbab('0xb')]=_0xcbab('0x40');}if(!_['isNil'](queues[_0x2924bb[_0xcbab('0x3a')]])){if(_0x2924bb[_0xcbab('0x41')]&&queues[_0x2924bb['transfereelinkedid']]){queues[_0x2924bb[_0xcbab('0x41')]]['queuecallerenterreason']=0x1;queues[_0x2924bb[_0xcbab('0x35')]]=_[_0xcbab('0x42')](queues[_0x2924bb[_0xcbab('0x41')]]);queues[_0x2924bb['transfereeuniqueid']][_0xcbab('0x11')]=_0x2924bb[_0xcbab('0x43')];queues[_0x2924bb['transfereeuniqueid']]['queuecallerenterreason']=0x2;queues[_0x2924bb[_0xcbab('0x35')]]['calleridnum']=queues[_0x2924bb[_0xcbab('0x3b')]][_0xcbab('0xa')];queues[_0x2924bb[_0xcbab('0x35')]]['calleridname']=queues[_0x2924bb['secondtransfererlinkedid']][_0xcbab('0x44')];queues[_0x2924bb[_0xcbab('0x35')]]['queuecallerjoinAt']=utils[_0xcbab('0x15')]();queues[_0x2924bb[_0xcbab('0x35')]][_0xcbab('0x18')]=utils[_0xcbab('0x15')]();queues[_0x2924bb['transfereeuniqueid']]['holdtime']=0x0;queues[_0x2924bb[_0xcbab('0x35')]][_0xcbab('0x45')]=0x0;}else{queues[_0x2924bb[_0xcbab('0x3a')]]['transfereduniqueid']=_0x2924bb['secondtransfererlinkedid'];}}}else if(_0x2924bb['secondtransfereruniqueid']==_0x2924bb[_0xcbab('0x3b')]){if(!_['isNil'](queues[_0x2924bb[_0xcbab('0x3a')]])){queues[_0x2924bb['origtransfererlinkedid']][_0xcbab('0x32')]=!![];queues[_0x2924bb[_0xcbab('0x3a')]][_0xcbab('0x3c')]=_0xcbab('0x3d');queues[_0x2924bb[_0xcbab('0x3a')]][_0xcbab('0x36')]=_0x2924bb[_0xcbab('0x46')];queues[_0x2924bb[_0xcbab('0x3a')]][_0xcbab('0x38')]=_0x2924bb[_0xcbab('0x47')];queues[_0x2924bb[_0xcbab('0x3a')]][_0xcbab('0xb')]=_0xcbab('0x40');}if(!_[_0xcbab('0x17')](queues[_0x2924bb[_0xcbab('0x3b')]])){if(_0x2924bb[_0xcbab('0x48')]&&queues[_0x2924bb[_0xcbab('0x48')]]){queues[_0x2924bb[_0xcbab('0x48')]]['queuecallerenterreason']=0x1;queues[_0x2924bb[_0xcbab('0x43')]]=_[_0xcbab('0x42')](queues[_0x2924bb['transfertargetlinkedid']]);queues[_0x2924bb[_0xcbab('0x43')]][_0xcbab('0x11')]=_0x2924bb[_0xcbab('0x43')];queues[_0x2924bb[_0xcbab('0x43')]][_0xcbab('0x1c')]=0x2;queues[_0x2924bb[_0xcbab('0x43')]][_0xcbab('0xa')]=queues[_0x2924bb[_0xcbab('0x3a')]][_0xcbab('0xa')];queues[_0x2924bb['transfertargetuniqueid']]['calleridname']=queues[_0x2924bb[_0xcbab('0x3a')]][_0xcbab('0x44')];queues[_0x2924bb['transfertargetuniqueid']][_0xcbab('0x29')]=utils[_0xcbab('0x15')]();queues[_0x2924bb[_0xcbab('0x43')]]['queuecallerleaveAt']=utils[_0xcbab('0x15')]();queues[_0x2924bb[_0xcbab('0x43')]][_0xcbab('0x28')]=0x0;queues[_0x2924bb[_0xcbab('0x43')]]['mohtime']=0x0;}else{queues[_0x2924bb[_0xcbab('0x3b')]][_0xcbab('0x11')]=_0x2924bb['origtransfererlinkedid'];}}}}catch(_0x56b87d){utils['error'](_0x56b87d[_0xcbab('0x49')]);}};exports[_0xcbab('0x4a')]=function(_0x292be7){if(!_[_0xcbab('0x17')](queues[_0x292be7['uniqueid']])){queues[_0x292be7[_0xcbab('0x6')]][_0xcbab('0x4b')]=utils[_0xcbab('0x15')]();}};exports[_0xcbab('0x4c')]=function(_0x3d4da8){if(!_['isNil'](queues[_0x3d4da8[_0xcbab('0x6')]])){if(!_[_0xcbab('0x17')](queues[_0x3d4da8[_0xcbab('0x6')]][_0xcbab('0x4b')])){queues[_0x3d4da8['uniqueid']][_0xcbab('0x45')]+=utils[_0xcbab('0x4d')](utils[_0xcbab('0x15')](),queues[_0x3d4da8['uniqueid']][_0xcbab('0x4b')]);delete queues[_0x3d4da8[_0xcbab('0x6')]][_0xcbab('0x4b')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 37e6e8c..caffb5f 100644 --- a/server/services/xdr/recordings.controller.js +++ b/server/services/xdr/recordings.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['CreateVoiceRecording','newchannel','uniqueid','linkedid','exten','context','channel','error','isNil','channelstate','stack','varset','variable','value','.WAV','find','monitors','hangup','calleridname','connectedlinenum','connectedlinename','forEach','clone','newexten','application','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','accountcode','getUserByInternal','then','membername','name','UserId','request'];(function(_0x3611d8,_0x56cff3){var _0x1ad728=function(_0x515a60){while(--_0x515a60){_0x3611d8['push'](_0x3611d8['shift']());}};_0x1ad728(++_0x56cff3);}(_0xe706,0xa3));var _0x6e70=function(_0x10d244,_0x49c680){_0x10d244=_0x10d244-0x0;var _0x67755d=_0xe706[_0x10d244];return _0x67755d;};'use strict';var _=require(_0x6e70('0x0'));var utils=require(_0x6e70('0x1'));var recordings={};function writeDB(_0x311951){utils['debug'](_0x311951);if(_0x311951[_0x6e70('0x2')]){utils[_0x6e70('0x3')](_0x311951[_0x6e70('0x2')])[_0x6e70('0x4')](function(_0x142c27){if(_0x142c27){_0x311951[_0x6e70('0x5')]=_0x142c27[_0x6e70('0x6')];_0x311951[_0x6e70('0x7')]=_0x142c27['id'];}utils[_0x6e70('0x8')](_0x6e70('0x9'),_0x311951);});}else{utils[_0x6e70('0x8')](_0x6e70('0x9'),_0x311951);}}exports[_0x6e70('0xa')]=function(_0x188ed3){try{if(_0x188ed3[_0x6e70('0xb')]==_0x188ed3[_0x6e70('0xc')]){recordings[_0x188ed3[_0x6e70('0xb')]]={'uniqueid':_0x188ed3[_0x6e70('0xb')],'accountcode':_0x188ed3[_0x6e70('0x2')],'exten':_0x188ed3[_0x6e70('0xd')],'context':_0x188ed3[_0x6e70('0xe')],'channel':_0x188ed3[_0x6e70('0xf')],'monitors':[]};}}catch(_0x37b3e0){utils[_0x6e70('0x10')](_0x37b3e0['stack']);}};exports['newstate']=function(_0x3594c1){try{if(!_[_0x6e70('0x11')](recordings[_0x3594c1[_0x6e70('0xb')]])&&_0x3594c1[_0x6e70('0x12')]==0x6){}else if(!_[_0x6e70('0x11')](recordings[_0x3594c1[_0x6e70('0xc')]])&&_0x3594c1[_0x6e70('0x12')]==0x6&&_0x3594c1[_0x6e70('0xe')]!='transfer'){recordings[_0x3594c1['linkedid']]['accountcode']=_0x3594c1[_0x6e70('0x2')];}}catch(_0x5a37a6){utils['error'](_0x5a37a6[_0x6e70('0x13')]);}};exports[_0x6e70('0x14')]=function(_0x5d9263){try{if(!_[_0x6e70('0x11')](_0x5d9263['variable'])&&!_[_0x6e70('0x11')](_0x5d9263[_0x6e70('0x15')]['mixmonitor_filename'])){if(_['endsWith'](_0x5d9263[_0x6e70('0x16')],'.wav49')){_0x5d9263[_0x6e70('0x16')]=_0x5d9263[_0x6e70('0x16')]['replace']('.wav49',_0x6e70('0x17'));}if(recordings[_0x5d9263[_0x6e70('0xc')]]){var _0x2368eb=_[_0x6e70('0x18')](recordings[_0x5d9263[_0x6e70('0xc')]][_0x6e70('0x19')],{'value':_0x5d9263[_0x6e70('0x16')]});if(_[_0x6e70('0x11')](_0x2368eb)){recordings[_0x5d9263[_0x6e70('0xc')]][_0x6e70('0x19')]['push']({'value':_0x5d9263[_0x6e70('0x16')]});}}}}catch(_0x344b65){utils[_0x6e70('0x10')](_0x344b65['stack']);}};exports[_0x6e70('0x1a')]=function(_0xa5d49){try{if(!_[_0x6e70('0x11')](recordings[_0xa5d49['uniqueid']])){recordings[_0xa5d49[_0x6e70('0xb')]]['calleridnum']=_0xa5d49['calleridnum'];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1b')]=_0xa5d49[_0x6e70('0x1b')];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1c')]=_0xa5d49[_0x6e70('0x1c')];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1d')]=_0xa5d49[_0x6e70('0x1d')];if(recordings[_0xa5d49[_0x6e70('0xb')]]['type']=='outbound'&&recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x2')]){recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x1c')]=recordings[_0xa5d49[_0x6e70('0xb')]]['accountcode'];recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x1d')]='';}recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x19')][_0x6e70('0x1e')](_0x20a225=>{var _0x3f78d2=_[_0x6e70('0x1f')](recordings[_0xa5d49[_0x6e70('0xb')]]);_0x3f78d2[_0x6e70('0x16')]=_0x20a225['value'];writeDB(_0x3f78d2);});delete recordings[_0xa5d49[_0x6e70('0xb')]];}}catch(_0x50d60b){utils[_0x6e70('0x10')](_0x50d60b['stack']);}};exports[_0x6e70('0x20')]=function(_0x2722e8){try{if(!_[_0x6e70('0x11')](recordings[_0x2722e8['uniqueid']])){if(_0x2722e8[_0x6e70('0x21')][_0x6e70('0x22')]()=='set'&&_[_0x6e70('0x23')](_0x2722e8[_0x6e70('0x24')]['toLowerCase'](),_0x6e70('0x25'))){var _0x3665a1=_0x2722e8[_0x6e70('0x24')][_0x6e70('0x26')]('=');var _0x3b4a13=_0x3665a1[0x0][_0x6e70('0x27')](_0x3665a1[0x0][_0x6e70('0x28')]('(')+0x1,_0x3665a1[0x0][_0x6e70('0x28')](')'));var _0xf146fd=_0x3665a1[0x1];recordings[_0x2722e8[_0x6e70('0xb')]][_0x3b4a13]=_0xf146fd;}}}catch(_0x4d32d8){utils[_0x6e70('0x10')](_0x4d32d8['stack']);}};exports[_0x6e70('0x29')]=function(_0x3222a2){try{if(!_[_0x6e70('0x11')](recordings[_0x3222a2[_0x6e70('0xb')]])){recordings[_0x3222a2[_0x6e70('0xb')]][_0x6e70('0x2a')]=_0x3222a2[_0x6e70('0x2a')];}}catch(_0xdd0bee){utils[_0x6e70('0x10')](_0xdd0bee[_0x6e70('0x13')]);}}; \ No newline at end of file +var _0xe706=['CreateVoiceRecording','newchannel','uniqueid','linkedid','exten','context','channel','error','isNil','channelstate','stack','varset','variable','value','.WAV','find','monitors','hangup','calleridname','connectedlinenum','connectedlinename','forEach','clone','newexten','application','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','accountcode','getUserByInternal','then','membername','name','UserId','request'];(function(_0x31d33a,_0x33e480){var _0x24eaa2=function(_0x437ed5){while(--_0x437ed5){_0x31d33a['push'](_0x31d33a['shift']());}};_0x24eaa2(++_0x33e480);}(_0xe706,0xa3));var _0x6e70=function(_0x434f2e,_0x68493e){_0x434f2e=_0x434f2e-0x0;var _0x76c0b9=_0xe706[_0x434f2e];return _0x76c0b9;};'use strict';var _=require(_0x6e70('0x0'));var utils=require(_0x6e70('0x1'));var recordings={};function writeDB(_0x311951){utils['debug'](_0x311951);if(_0x311951[_0x6e70('0x2')]){utils[_0x6e70('0x3')](_0x311951[_0x6e70('0x2')])[_0x6e70('0x4')](function(_0x142c27){if(_0x142c27){_0x311951[_0x6e70('0x5')]=_0x142c27[_0x6e70('0x6')];_0x311951[_0x6e70('0x7')]=_0x142c27['id'];}utils[_0x6e70('0x8')](_0x6e70('0x9'),_0x311951);});}else{utils[_0x6e70('0x8')](_0x6e70('0x9'),_0x311951);}}exports[_0x6e70('0xa')]=function(_0x188ed3){try{if(_0x188ed3[_0x6e70('0xb')]==_0x188ed3[_0x6e70('0xc')]){recordings[_0x188ed3[_0x6e70('0xb')]]={'uniqueid':_0x188ed3[_0x6e70('0xb')],'accountcode':_0x188ed3[_0x6e70('0x2')],'exten':_0x188ed3[_0x6e70('0xd')],'context':_0x188ed3[_0x6e70('0xe')],'channel':_0x188ed3[_0x6e70('0xf')],'monitors':[]};}}catch(_0x37b3e0){utils[_0x6e70('0x10')](_0x37b3e0['stack']);}};exports['newstate']=function(_0x3594c1){try{if(!_[_0x6e70('0x11')](recordings[_0x3594c1[_0x6e70('0xb')]])&&_0x3594c1[_0x6e70('0x12')]==0x6){}else if(!_[_0x6e70('0x11')](recordings[_0x3594c1[_0x6e70('0xc')]])&&_0x3594c1[_0x6e70('0x12')]==0x6&&_0x3594c1[_0x6e70('0xe')]!='transfer'){recordings[_0x3594c1['linkedid']]['accountcode']=_0x3594c1[_0x6e70('0x2')];}}catch(_0x5a37a6){utils['error'](_0x5a37a6[_0x6e70('0x13')]);}};exports[_0x6e70('0x14')]=function(_0x5d9263){try{if(!_[_0x6e70('0x11')](_0x5d9263['variable'])&&!_[_0x6e70('0x11')](_0x5d9263[_0x6e70('0x15')]['mixmonitor_filename'])){if(_['endsWith'](_0x5d9263[_0x6e70('0x16')],'.wav49')){_0x5d9263[_0x6e70('0x16')]=_0x5d9263[_0x6e70('0x16')]['replace']('.wav49',_0x6e70('0x17'));}if(recordings[_0x5d9263[_0x6e70('0xc')]]){var _0x2368eb=_[_0x6e70('0x18')](recordings[_0x5d9263[_0x6e70('0xc')]][_0x6e70('0x19')],{'value':_0x5d9263[_0x6e70('0x16')]});if(_[_0x6e70('0x11')](_0x2368eb)){recordings[_0x5d9263[_0x6e70('0xc')]][_0x6e70('0x19')]['push']({'value':_0x5d9263[_0x6e70('0x16')]});}}}}catch(_0x344b65){utils[_0x6e70('0x10')](_0x344b65['stack']);}};exports[_0x6e70('0x1a')]=function(_0xa5d49){try{if(!_[_0x6e70('0x11')](recordings[_0xa5d49['uniqueid']])){recordings[_0xa5d49[_0x6e70('0xb')]]['calleridnum']=_0xa5d49['calleridnum'];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1b')]=_0xa5d49[_0x6e70('0x1b')];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1c')]=_0xa5d49[_0x6e70('0x1c')];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1d')]=_0xa5d49[_0x6e70('0x1d')];if(recordings[_0xa5d49[_0x6e70('0xb')]]['type']=='outbound'&&recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x2')]){recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x1c')]=recordings[_0xa5d49[_0x6e70('0xb')]]['accountcode'];recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x1d')]='';}recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x19')][_0x6e70('0x1e')](_0x20a225=>{var _0x3f78d2=_[_0x6e70('0x1f')](recordings[_0xa5d49[_0x6e70('0xb')]]);_0x3f78d2[_0x6e70('0x16')]=_0x20a225['value'];writeDB(_0x3f78d2);});delete recordings[_0xa5d49[_0x6e70('0xb')]];}}catch(_0x50d60b){utils[_0x6e70('0x10')](_0x50d60b['stack']);}};exports[_0x6e70('0x20')]=function(_0x2722e8){try{if(!_[_0x6e70('0x11')](recordings[_0x2722e8['uniqueid']])){if(_0x2722e8[_0x6e70('0x21')][_0x6e70('0x22')]()=='set'&&_[_0x6e70('0x23')](_0x2722e8[_0x6e70('0x24')]['toLowerCase'](),_0x6e70('0x25'))){var _0x3665a1=_0x2722e8[_0x6e70('0x24')][_0x6e70('0x26')]('=');var _0x3b4a13=_0x3665a1[0x0][_0x6e70('0x27')](_0x3665a1[0x0][_0x6e70('0x28')]('(')+0x1,_0x3665a1[0x0][_0x6e70('0x28')](')'));var _0xf146fd=_0x3665a1[0x1];recordings[_0x2722e8[_0x6e70('0xb')]][_0x3b4a13]=_0xf146fd;}}}catch(_0x4d32d8){utils[_0x6e70('0x10')](_0x4d32d8['stack']);}};exports[_0x6e70('0x29')]=function(_0x3222a2){try{if(!_[_0x6e70('0x11')](recordings[_0x3222a2[_0x6e70('0xb')]])){recordings[_0x3222a2[_0x6e70('0xb')]][_0x6e70('0x2a')]=_0x3222a2[_0x6e70('0x2a')];}}catch(_0xdd0bee){utils[_0x6e70('0x10')](_0xdd0bee[_0x6e70('0x13')]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 06c6af5..72b2723 100644 --- a/server/services/xdr/transfers.controller.js +++ b/server/services/xdr/transfers.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1052=['format','TRANSFER|%s','type','request','blind','stack','attendedtransfer','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','attended','isNil','transfereechannel','assign','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','error','lodash','util','./utils','info'];(function(_0x5a8705,_0xded66){var _0x47cd8b=function(_0x5990fc){while(--_0x5990fc){_0x5a8705['push'](_0x5a8705['shift']());}};_0x47cd8b(++_0xded66);}(_0x1052,0xf4));var _0x2105=function(_0x574b7f,_0x5a758e){_0x574b7f=_0x574b7f-0x0;var _0x3da1af=_0x1052[_0x574b7f];return _0x3da1af;};'use strict';var _=require(_0x2105('0x0'));var util=require(_0x2105('0x1'));var utils=require(_0x2105('0x2'));function writeDB(_0xed0bfa){utils[_0x2105('0x3')](util[_0x2105('0x4')](_0x2105('0x5'),_0xed0bfa[_0x2105('0x6')]));utils[_0x2105('0x7')]('CreateVoiceTransferReport',_0xed0bfa);}exports['blindtransfer']=function(_0x22705d){try{_0x22705d['type']=_0x2105('0x8');writeDB(_0x22705d);}catch(_0x9b262){utils['error'](_0x9b262[_0x2105('0x9')]);}};exports[_0x2105('0xa')]=function(_0x43ef50){try{_0x43ef50=_['assign'](_0x43ef50,{'transfererchannel':_0x43ef50['origtransfererchannel'],'transferercalleridnum':_0x43ef50[_0x2105('0xb')],'transferercalleridname':_0x43ef50[_0x2105('0xc')],'transfererconnectedlinenum':_0x43ef50[_0x2105('0xd')],'transfererconnectedlinename':_0x43ef50['secondtransfererconnectedlinename'],'transfereraccountcode':_0x43ef50[_0x2105('0xe')],'transferercontext':_0x43ef50[_0x2105('0xf')],'transfererexten':_0x43ef50[_0x2105('0x10')],'transfererlinkedid':_0x43ef50[_0x2105('0x11')],'context':_0x43ef50['origtransferercontext'],'extension':_0x43ef50['origtransfererexten'],'type':_0x2105('0x12')});if(_[_0x2105('0x13')](_0x43ef50[_0x2105('0x14')])){_0x43ef50=_[_0x2105('0x15')](_0x43ef50,{'transfereechannel':_0x43ef50[_0x2105('0x16')],'transfereecalleridnum':_0x43ef50[_0x2105('0x17')],'transfereecalleridname':_0x43ef50[_0x2105('0x18')],'transfereeconnectedlinenum':_0x43ef50[_0x2105('0x19')],'transfereeconnectedlinename':_0x43ef50[_0x2105('0x1a')],'transfereeaccountcode':_0x43ef50[_0x2105('0x1b')],'transfereecontext':_0x43ef50['transfertargetcontext'],'transfereeexten':_0x43ef50[_0x2105('0x1c')],'transfereelinkedid':_0x43ef50[_0x2105('0x1d')]});}writeDB(_0x43ef50);}catch(_0x1a3fa3){utils[_0x2105('0x1e')](_0x1a3fa3['stack']);}}; \ No newline at end of file +var _0x3164=['request','blind','error','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','attended','isNil','transfereechannel','transfertargetcalleridnum','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','lodash','util','./utils','info','TRANSFER|%s','type'];(function(_0x4c7c25,_0x1e16a8){var _0x297619=function(_0x453f76){while(--_0x453f76){_0x4c7c25['push'](_0x4c7c25['shift']());}};_0x297619(++_0x1e16a8);}(_0x3164,0x182));var _0x4316=function(_0x1322b1,_0x34df7c){_0x1322b1=_0x1322b1-0x0;var _0x33e327=_0x3164[_0x1322b1];return _0x33e327;};'use strict';var _=require(_0x4316('0x0'));var util=require(_0x4316('0x1'));var utils=require(_0x4316('0x2'));function writeDB(_0x1738ab){utils[_0x4316('0x3')](util['format'](_0x4316('0x4'),_0x1738ab[_0x4316('0x5')]));utils[_0x4316('0x6')]('CreateVoiceTransferReport',_0x1738ab);}exports['blindtransfer']=function(_0x27bfc8){try{_0x27bfc8[_0x4316('0x5')]=_0x4316('0x7');writeDB(_0x27bfc8);}catch(_0x29c3c1){utils[_0x4316('0x8')](_0x29c3c1[_0x4316('0x9')]);}};exports[_0x4316('0xa')]=function(_0x2b1420){try{_0x2b1420=_[_0x4316('0xb')](_0x2b1420,{'transfererchannel':_0x2b1420[_0x4316('0xc')],'transferercalleridnum':_0x2b1420[_0x4316('0xd')],'transferercalleridname':_0x2b1420[_0x4316('0xe')],'transfererconnectedlinenum':_0x2b1420[_0x4316('0xf')],'transfererconnectedlinename':_0x2b1420[_0x4316('0x10')],'transfereraccountcode':_0x2b1420['origtransfereraccountcode'],'transferercontext':_0x2b1420[_0x4316('0x11')],'transfererexten':_0x2b1420[_0x4316('0x12')],'transfererlinkedid':_0x2b1420[_0x4316('0x13')],'context':_0x2b1420[_0x4316('0x14')],'extension':_0x2b1420['origtransfererexten'],'type':_0x4316('0x15')});if(_[_0x4316('0x16')](_0x2b1420[_0x4316('0x17')])){_0x2b1420=_[_0x4316('0xb')](_0x2b1420,{'transfereechannel':_0x2b1420['transfertargetchannel'],'transfereecalleridnum':_0x2b1420[_0x4316('0x18')],'transfereecalleridname':_0x2b1420['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x2b1420['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2b1420['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2b1420[_0x4316('0x19')],'transfereecontext':_0x2b1420[_0x4316('0x1a')],'transfereeexten':_0x2b1420['transfertargetexten'],'transfereelinkedid':_0x2b1420[_0x4316('0x1b')]});}writeDB(_0x2b1420);}catch(_0x486a64){utils[_0x4316('0x8')](_0x486a64[_0x4316('0x9')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 86ea482..e2e6cbc 100644 --- a/server/services/xdr/utils.js +++ b/server/services/xdr/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf241=['isAfter','isBefore','jayson/promise','bluebird','http','../../config/logger','xdr','info','debug','stringify','error','stack','request','then','catch','GetUser','name','interface','result','FOUND','getUserByInternal','getUserByInterface','getUserByName','GetVoiceQueue','type','acw','acwTimeout','GETVOICEQUEUEBYNAME|','length','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','diff','sumTime'];(function(_0x1ff2ec,_0x386e86){var _0x405683=function(_0x22f921){while(--_0x22f921){_0x1ff2ec['push'](_0x1ff2ec['shift']());}};_0x405683(++_0x386e86);}(_0xf241,0x1a4));var _0x1f24=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf241[_0x2c91e9];return _0x13f0ff;};'use strict';var jayson=require(_0x1f24('0x0'));var moment=require('moment');var BPromise=require(_0x1f24('0x1'));var client=jayson['client'][_0x1f24('0x2')]({'port':0x2329});var logger=require(_0x1f24('0x3'))(_0x1f24('0x4'));exports[_0x1f24('0x5')]=function(_0x13cb28){logger[_0x1f24('0x5')](_0x13cb28);};exports[_0x1f24('0x6')]=function(_0x13319a){logger[_0x1f24('0x6')](JSON[_0x1f24('0x7')](_0x13319a));};exports[_0x1f24('0x8')]=function(_0x3ba3c5){logger[_0x1f24('0x8')](_0x3ba3c5[_0x1f24('0x9')]);};exports[_0x1f24('0xa')]=function(_0x54ac9e,_0x4f358e){return client[_0x1f24('0xa')](_0x54ac9e,{'body':_0x4f358e})[_0x1f24('0xb')](function(_0x25a667){logger[_0x1f24('0x6')](JSON['stringify'](_0x25a667));})[_0x1f24('0xc')](function(_0xd3877f){logger[_0x1f24('0x8')](_0xd3877f[_0x1f24('0x9')]);});};function getUser(_0x2122c1){return client[_0x1f24('0xa')](_0x1f24('0xd'),{'options':{'raw':!![],'attributes':['id','internal',_0x1f24('0xe'),_0x1f24('0xf')],'where':_0x2122c1,'limit':0x1}})[_0x1f24('0xb')](function(_0x17d80b){logger[_0x1f24('0x5')]('GETUSER|'+JSON[_0x1f24('0x7')](_0x2122c1)+'|'+(_0x17d80b[_0x1f24('0x10')]['length']?_0x1f24('0x11'):'NOTFOUND'));return _0x17d80b[_0x1f24('0x10')]['length']?_0x17d80b['result'][0x0]:null;});}exports[_0x1f24('0x12')]=function(_0x4b9b4f){return new BPromise(function(_0x4535ec,_0x2263c9){if(_0x4b9b4f){return getUser({'internal':_0x4b9b4f})[_0x1f24('0xb')](function(_0x509558){return _0x4535ec(_0x509558);})[_0x1f24('0xc')](function(_0x20448d){logger[_0x1f24('0x8')](_0x20448d[_0x1f24('0x9')]);return _0x4535ec(null);});}else{return _0x4535ec(null);}});};exports[_0x1f24('0x13')]=function(_0x4f7428){return new BPromise(function(_0x3266f,_0x211900){if(_0x4f7428){return getUser({'interface':_0x4f7428})[_0x1f24('0xb')](function(_0x43f063){return _0x3266f(_0x43f063);})[_0x1f24('0xc')](function(_0x5dc47f){logger['error'](_0x5dc47f['stack']);return _0x3266f(null);});}else{return _0x3266f(null);}});};exports[_0x1f24('0x14')]=function(_0x4f46cd){return new BPromise(function(_0x2378af,_0x5c67a2){if(_0x4f46cd){return getUser({'name':_0x4f46cd})['then'](function(_0x29420a){return _0x2378af(_0x29420a);})[_0x1f24('0xc')](function(_0x186cc8){logger[_0x1f24('0x8')](_0x186cc8[_0x1f24('0x9')]);return _0x2378af(null);});}else{return _0x2378af(null);}});};exports['getVoiceQueueByName']=function(_0x23d6a6){return new BPromise(function(_0x208159,_0x2a4282){if(_0x23d6a6){return client['request'](_0x1f24('0x15'),{'options':{'raw':!![],'attributes':['id','name',_0x1f24('0x16'),_0x1f24('0x17'),_0x1f24('0x18')],'where':{'name':_0x23d6a6},'limit':0x1}})[_0x1f24('0xb')](function(_0x380fd3){logger['info'](_0x1f24('0x19')+_0x23d6a6+'|'+(_0x380fd3[_0x1f24('0x10')][_0x1f24('0x1a')]?_0x1f24('0x11'):'NOTFOUND'));return _0x208159(_0x380fd3[_0x1f24('0x10')][_0x1f24('0x1a')]?_0x380fd3[_0x1f24('0x10')][0x0]:null);})['catch'](function(_0x15c7ad){logger[_0x1f24('0x8')](_0x15c7ad[_0x1f24('0x9')]);return _0x208159(null);});}else{return _0x208159(null);}});};exports[_0x1f24('0x1b')]=function(_0x191e3a,_0x3e4c40){return moment(_0x191e3a)[_0x1f24('0x1c')](_0x3e4c40,_0x1f24('0x1d'))[_0x1f24('0x1e')](_0x1f24('0x1f'));};exports['subtractTime']=function(_0x292176,_0x4d1540){return moment(_0x292176)[_0x1f24('0x20')](_0x4d1540,'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x1f24('0x21')]=function(_0x1f6f84,_0x348d5f){return moment(_0x1f6f84)[_0x1f24('0x22')](moment(_0x348d5f),_0x1f24('0x1d'));};exports[_0x1f24('0x23')]=function(_0xd60bfb,_0x53d8c7){return parseInt(_0xd60bfb,0xa)+parseInt(_0x53d8c7,0xa);};exports['now']=function(){return moment()[_0x1f24('0x1e')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x1f24('0x24')]=function(_0x31f6b3,_0x55da1e){if(_0x55da1e){return moment(_0x31f6b3)[_0x1f24('0x24')](_0x55da1e);}else{return!![];}};exports[_0x1f24('0x25')]=function(_0x21fcb0,_0x503c4e){if(_0x503c4e){return moment(_0x21fcb0)[_0x1f24('0x25')](_0x503c4e);}else if(_0x21fcb0){return!![];}else{return![];}}; \ No newline at end of file +var _0x341b=['GetUser','internal','GETUSER|','result','length','FOUND','NOTFOUND','getUserByInternal','getUserByInterface','getUserByName','GetVoiceQueue','name','acw','GETVOICEQUEUEBYNAME|','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','sumTime','now','isAfter','jayson/promise','moment','client','http','info','debug','stringify','error','stack','request','then','catch'];(function(_0x594ee0,_0x481731){var _0x41d4df=function(_0x5194f5){while(--_0x5194f5){_0x594ee0['push'](_0x594ee0['shift']());}};_0x41d4df(++_0x481731);}(_0x341b,0xf0));var _0xb341=function(_0x36cb9c,_0x5e5f20){_0x36cb9c=_0x36cb9c-0x0;var _0x391f0c=_0x341b[_0x36cb9c];return _0x391f0c;};'use strict';var jayson=require(_0xb341('0x0'));var moment=require(_0xb341('0x1'));var BPromise=require('bluebird');var client=jayson[_0xb341('0x2')][_0xb341('0x3')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0xb341('0x4')]=function(_0x28520d){logger[_0xb341('0x4')](_0x28520d);};exports[_0xb341('0x5')]=function(_0x1944cf){logger[_0xb341('0x5')](JSON[_0xb341('0x6')](_0x1944cf));};exports[_0xb341('0x7')]=function(_0x2f871f){logger[_0xb341('0x7')](_0x2f871f[_0xb341('0x8')]);};exports[_0xb341('0x9')]=function(_0x4edf76,_0x34b05a){return client[_0xb341('0x9')](_0x4edf76,{'body':_0x34b05a})[_0xb341('0xa')](function(_0x28adbb){logger[_0xb341('0x5')](JSON[_0xb341('0x6')](_0x28adbb));})[_0xb341('0xb')](function(_0x6fe40f){logger['error'](_0x6fe40f['stack']);});};function getUser(_0x5c846f){return client[_0xb341('0x9')](_0xb341('0xc'),{'options':{'raw':!![],'attributes':['id',_0xb341('0xd'),'name','interface'],'where':_0x5c846f,'limit':0x1}})[_0xb341('0xa')](function(_0x4b260a){logger[_0xb341('0x4')](_0xb341('0xe')+JSON[_0xb341('0x6')](_0x5c846f)+'|'+(_0x4b260a[_0xb341('0xf')][_0xb341('0x10')]?_0xb341('0x11'):_0xb341('0x12')));return _0x4b260a[_0xb341('0xf')][_0xb341('0x10')]?_0x4b260a[_0xb341('0xf')][0x0]:null;});}exports[_0xb341('0x13')]=function(_0x1ce211){return new BPromise(function(_0x45ecf3,_0x1c2d2d){if(_0x1ce211){return getUser({'internal':_0x1ce211})[_0xb341('0xa')](function(_0x125514){return _0x45ecf3(_0x125514);})['catch'](function(_0x59e5fb){logger['error'](_0x59e5fb['stack']);return _0x45ecf3(null);});}else{return _0x45ecf3(null);}});};exports[_0xb341('0x14')]=function(_0x147bc8){return new BPromise(function(_0x6620c4,_0x316afb){if(_0x147bc8){return getUser({'interface':_0x147bc8})[_0xb341('0xa')](function(_0x3e4b51){return _0x6620c4(_0x3e4b51);})[_0xb341('0xb')](function(_0x10e85c){logger['error'](_0x10e85c[_0xb341('0x8')]);return _0x6620c4(null);});}else{return _0x6620c4(null);}});};exports[_0xb341('0x15')]=function(_0x1d6889){return new BPromise(function(_0x7b1a62,_0x4a8888){if(_0x1d6889){return getUser({'name':_0x1d6889})[_0xb341('0xa')](function(_0x1ac49f){return _0x7b1a62(_0x1ac49f);})[_0xb341('0xb')](function(_0x4e8d3c){logger[_0xb341('0x7')](_0x4e8d3c['stack']);return _0x7b1a62(null);});}else{return _0x7b1a62(null);}});};exports['getVoiceQueueByName']=function(_0x52082d){return new BPromise(function(_0xf4d0aa,_0x4fd360){if(_0x52082d){return client[_0xb341('0x9')](_0xb341('0x16'),{'options':{'raw':!![],'attributes':['id',_0xb341('0x17'),'type',_0xb341('0x18'),'acwTimeout'],'where':{'name':_0x52082d},'limit':0x1}})[_0xb341('0xa')](function(_0x1fdbe4){logger[_0xb341('0x4')](_0xb341('0x19')+_0x52082d+'|'+(_0x1fdbe4['result'][_0xb341('0x10')]?_0xb341('0x11'):'NOTFOUND'));return _0xf4d0aa(_0x1fdbe4[_0xb341('0xf')]['length']?_0x1fdbe4['result'][0x0]:null);})[_0xb341('0xb')](function(_0x28a6e6){logger[_0xb341('0x7')](_0x28a6e6[_0xb341('0x8')]);return _0xf4d0aa(null);});}else{return _0xf4d0aa(null);}});};exports['addTime']=function(_0x26972e,_0x4a63b8){return moment(_0x26972e)[_0xb341('0x1a')](_0x4a63b8,_0xb341('0x1b'))[_0xb341('0x1c')](_0xb341('0x1d'));};exports[_0xb341('0x1e')]=function(_0x1fc5e5,_0x30d7af){return moment(_0x1fc5e5)[_0xb341('0x1f')](_0x30d7af,'seconds')[_0xb341('0x1c')](_0xb341('0x1d'));};exports[_0xb341('0x20')]=function(_0x10e363,_0x2cebb8){return moment(_0x10e363)['diff'](moment(_0x2cebb8),_0xb341('0x1b'));};exports[_0xb341('0x21')]=function(_0x42a53c,_0x4d7c02){return parseInt(_0x42a53c,0xa)+parseInt(_0x4d7c02,0xa);};exports[_0xb341('0x22')]=function(){return moment()[_0xb341('0x1c')](_0xb341('0x1d'));};exports[_0xb341('0x23')]=function(_0x4a54d2,_0x3b96ca){if(_0x3b96ca){return moment(_0x4a54d2)[_0xb341('0x23')](_0x3b96ca);}else{return!![];}};exports['isBefore']=function(_0x405b69,_0x52d525){if(_0x52d525){return moment(_0x405b69)['isBefore'](_0x52d525);}else if(_0x405b69){return!![];}else{return![];}}; \ No newline at end of file